lyhzzz 2 nedēļas atpakaļ
vecāks
revīzija
fc79eacf4c

+ 17 - 2
src/main/java/com/fdkankan/manage/controller/CaseController.java

@@ -179,8 +179,23 @@ public class CaseController {
 
     @PostMapping("/addOrUpdate")
     public ResultData addOrUpdate(@RequestBody CaseParam param){
-
-        caseService.addOrUpdate(param);
+        if(param.getCaseId() != null){
+            throw new BusinessException(ResultCode.MISSING_REQUIRED_PARAMETERS);
+        }
+        JyUser jyUser = jyUserService.getBySysId(StpUtil.getLoginId());
+        if(jyUser == null){
+            throw new BusinessException(ResultCode.USER_NOT_EXIST);
+        }
+        Case  caseEntity = new Case();
+        caseEntity.setSysUserId(Long.valueOf(StpUtil.getLoginId().toString()));
+        caseEntity.setPlatformId(jyUser.getPlatformId());
+        caseEntity.setUserName((String)StpUtil.getExtra("userName"));
+        caseEntity.setCaseTitle(param.getCaseTitle());
+        caseService.save(caseEntity);
+
+        for (CaseNumType caseNumType : param.getSceneNumParam()) {
+            caseNumService.add(caseEntity.getCaseId(),caseNumType);
+        }
         return ResultData.ok();
     }
 

+ 1 - 17
src/main/java/com/fdkankan/manage/service/impl/CaseServiceImpl.java

@@ -102,23 +102,7 @@ public class CaseServiceImpl extends ServiceImpl<ICaseMapper, Case> implements I
 
     @Override
     public void addOrUpdate(CaseParam param) {
-        if(param.getCaseId() != null){
-            throw new BusinessException(ResultCode.MISSING_REQUIRED_PARAMETERS);
-        }
-        JyUser jyUser = jyUserService.getBySysId(StpUtil.getLoginId());
-        if(jyUser == null){
-            throw new BusinessException(ResultCode.USER_NOT_EXIST);
-        }
-        Case  caseEntity = new Case();
-        caseEntity.setSysUserId(Long.valueOf(StpUtil.getLoginId().toString()));
-        caseEntity.setPlatformId(jyUser.getPlatformId());
-        caseEntity.setUserName((String)StpUtil.getExtra("userName"));
-        caseEntity.setCaseTitle(param.getCaseTitle());
-        this.save(caseEntity);
-
-        for (CaseNumType caseNumType : param.getSceneNumParam()) {
-            caseNumService.add(caseEntity.getCaseId(),caseNumType);
-        }
+
     }
 
     @Override