|
@@ -6,6 +6,7 @@ import api.common.pojo.param.scene.ScenePackageParam;
|
|
|
import api.common.pojo.po.scene.ScenePackagePO;
|
|
|
import api.common.pojo.vo.scene.ScenePackageSublistVO;
|
|
|
import api.common.pojo.vo.scene.ScenePackageVO;
|
|
|
+import api.common.util.CollectionUtil;
|
|
|
import api.common.util.ObjectUtil;
|
|
|
import com.css.simulation.resource.common.utils.PageUtil;
|
|
|
import com.css.simulation.resource.scene.service.ScenePackageService;
|
|
@@ -13,7 +14,10 @@ import com.css.simulation.resource.system.service.ParameterService;
|
|
|
import com.github.pagehelper.PageInfo;
|
|
|
import org.springframework.beans.BeanUtils;
|
|
|
import org.springframework.security.access.prepost.PreAuthorize;
|
|
|
-import org.springframework.web.bind.annotation.*;
|
|
|
+import org.springframework.web.bind.annotation.PostMapping;
|
|
|
+import org.springframework.web.bind.annotation.RequestBody;
|
|
|
+import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
+import org.springframework.web.bind.annotation.RestController;
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
import java.util.ArrayList;
|
|
@@ -48,21 +52,33 @@ public class ScenePackageController {
|
|
|
return new ResponseBodyVO<>(ResponseBodyVO.Response.SUCCESS, pageInfo);
|
|
|
}
|
|
|
|
|
|
-
|
|
|
- //新增测试包
|
|
|
+
|
|
|
@PostMapping("/saveScenePackage")
|
|
|
public ResponseBodyVO<String> saveScenePackage(@RequestBody Map<String, List<ScenePackageSublistVO>> map) {
|
|
|
+ ResponseBodyVO<String> result = new ResponseBodyVO<>(ResponseBodyVO.Response.SERVER_FAILURE);
|
|
|
List<ScenePackageSublistVO> params = map.get("params");
|
|
|
- if (params == null || params.size() < 1) { // 参数错误
|
|
|
- return new ResponseBodyVO<>(ResponseBodyVO.Response.CLIENT_FAILURE, "参数不能为空,请检查");
|
|
|
- } else if (params.get(0).getId() == null // 新增场景测试包
|
|
|
- || params.get(0).getPackageLevel() == 1 // level 是 1 表示是场景测试包
|
|
|
- ) {
|
|
|
+ if (CollectionUtil.isEmpty(params)) { // 参数错误
|
|
|
+ result = new ResponseBodyVO<>(ResponseBodyVO.Response.CLIENT_FAILURE, "参数不能为空,请检查");
|
|
|
+ }
|
|
|
+ String packageId = params.get(0).getId();
|
|
|
+ int packageLevel = params.get(0).getPackageLevel();
|
|
|
+ if ("1".equals(packageId)) { // 新增场景测试包(传 id 为 1)
|
|
|
params.get(0).setId("");
|
|
|
- return scenePackageService.saveScenePackage(params, params.get(0).getPackageLevel());
|
|
|
- } else {
|
|
|
- return scenePackageService.updateScenePackage(params);
|
|
|
+ result = scenePackageService.saveScenePackage(params, params.get(0).getPackageLevel());
|
|
|
+ } else if (0 == packageLevel) {
|
|
|
+ /*
|
|
|
+ 修改保存
|
|
|
+ */
|
|
|
+ result = scenePackageService.updateScenePackage(params);
|
|
|
+ } else if (1 == packageLevel) {
|
|
|
+ /*
|
|
|
+ 私有另存为成私有
|
|
|
+ 公有另存为成私有
|
|
|
+ */
|
|
|
+ params.get(0).setId("");
|
|
|
+ result = scenePackageService.saveScenePackage(params, params.get(0).getPackageLevel());
|
|
|
}
|
|
|
+ return result;
|
|
|
}
|
|
|
|
|
|
//修改
|
|
@@ -105,7 +121,7 @@ public class ScenePackageController {
|
|
|
|
|
|
//查询测试包数量
|
|
|
@PostMapping("/queryPackageCount")
|
|
|
- public ResponseBodyVO<Map<String,Integer>> queryPackageCount() {
|
|
|
+ public ResponseBodyVO<Map<String, Integer>> queryPackageCount() {
|
|
|
return new ResponseBodyVO<>(ResponseBodyVO.Response.SUCCESS, scenePackageService.queryPackageCount());
|
|
|
}
|
|
|
|