فهرست منبع

Merge branch 'fix-caseUpdate' into 'DEV'

fix:case修改接口以及case获取的逻辑



See merge request !275

huangyong 8 سال پیش
والد
کامیت
927575614f

+ 3 - 3
mooctest-site-server/src/main/java/cn/iselab/mooctest/site/web/ctrl/CaseController.java

@@ -102,9 +102,9 @@ public class CaseController extends BaseController {
         if (!SecurityUtils.getSubject().isPermitted(new CasePermission(permissionStr))) {
             throw new UnauthorizedException("unauthorized");
         }
-        if(caseId!=caseExtendsVO.getId()){
-            throw new IllegalArgumentException("Id are not same");
-        }
+//        if(caseId!=caseExtendsVO.getId()){
+//            throw new IllegalArgumentException("Id are not same");
+//        }
         caseLogic.update(caseExtendsVO,caseId);
     }
 

+ 3 - 2
mooctest-site-server/src/main/java/cn/iselab/mooctest/site/web/logic/impl/CaseLogicImpl.java

@@ -229,12 +229,12 @@ public class CaseLogicImpl implements CaseLogic {
 
     @Override
     public void update(CaseExtendsVO caseExtendsVO, Long caseExtendsId) {
-        CaseExtends caseExtends = caseService.getCaseExtendsById(caseExtendsId);
+        CaseExtends caseExtends = caseService.getCaseExtendsById(caseExtendsVO.getId());
         if (caseExtends == null)
             throw new IllegalArgumentException("Cannot find the caseExtends");
         Timestamp timestamp = caseExtends.getCreateTime();
         Converter.copy(caseExtends, caseExtendsVO);
-        caseExtends.setId(caseExtendsId);
+        //caseExtends.setId(caseExtendsId);
         caseExtends.setCreateTime(timestamp);
         caseExtends.setOwnerId(caseExtendsVO.getManagerId());
         caseService.save(caseExtends);
@@ -257,6 +257,7 @@ public class CaseLogicImpl implements CaseLogic {
             throw new IllegalArgumentException();
 
         CaseExtendsVO re = Converter.convert(CaseExtendsVO.class, caseExtends);
+        re.setManagerId(caseExtends.getOwnerId());
         App app = targetService.findById(caseExtends.getAppId());
         re.setTargetName(app.getName());
         re.setTargetType(app.getTargetType());