|
|
@@ -1,6 +1,7 @@
|
|
|
package cn.iselab.mooctest.site.web.logic.impl;
|
|
|
|
|
|
-import cn.iselab.mooctest.site.common.constant.SubsiteConstants;
|
|
|
+import cn.iselab.mooctest.site.common.constant.AnswerWayConstants;
|
|
|
+import cn.iselab.mooctest.site.common.constant.TargetTypeConstants;
|
|
|
import cn.iselab.mooctest.site.common.constant.ThirdPartConstants;
|
|
|
import cn.iselab.mooctest.site.data.CaseBlock;
|
|
|
import cn.iselab.mooctest.site.models.*;
|
|
|
@@ -24,6 +25,7 @@ import org.springframework.data.domain.Page;
|
|
|
import org.springframework.data.domain.Pageable;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
+import java.lang.annotation.Target;
|
|
|
import java.sql.Timestamp;
|
|
|
import java.util.ArrayList;
|
|
|
import java.util.List;
|
|
|
@@ -134,9 +136,11 @@ public class CaseLogicImpl implements CaseLogic {
|
|
|
}
|
|
|
long caseid = caseBlock.getCaseIds().get(0);
|
|
|
CaseExtendsVO caseExtendsVO = Converter.convert(CaseExtendsVO.class, caseService.getCaseExtendsById(caseid));
|
|
|
- if (caseExtendsVO.getSubsiteId() == SubsiteConstants.KIKBUG_SUBSITE_ID) {
|
|
|
- caseExtendsVO.setAppLocation(applicationService.getAppById(caseExtendsVO.getTargetId()).getAppLocation());
|
|
|
- ;
|
|
|
+ if(caseExtendsVO.getAppId()!=null) {
|
|
|
+ App app = targetService.findById(caseExtendsVO.getAppId());
|
|
|
+ if (app.getTargetType() == TargetTypeConstants.KIBUG) {
|
|
|
+ caseExtendsVO.setAppLocation(app.getUrl());
|
|
|
+ }
|
|
|
}
|
|
|
caseVoList.add(caseExtendsVO);
|
|
|
}
|
|
|
@@ -161,13 +165,17 @@ public class CaseLogicImpl implements CaseLogic {
|
|
|
Converter.copy(caseExtends, caseExtendsVO);
|
|
|
caseExtends.setCreateTime(new Timestamp(System.currentTimeMillis()));
|
|
|
caseExtends.setOwnerId(caseExtendsVO.getManagerId());
|
|
|
- caseExtends.setAppId(caseExtendsVO.getTargetId());
|
|
|
- if (caseExtendsVO.getSubsiteId() == SubsiteConstants.KIKBUG_SUBSITE_ID) {
|
|
|
- Application application = applicationService.getApplicaitonByUploaderCaseId(caseExtendsVO.getTargetId());
|
|
|
+ caseExtends.setAppId(caseExtendsVO.getAppId());
|
|
|
+ App app = targetService.findById(caseExtendsVO.getAppId());
|
|
|
+ if(app.getTargetType() == TargetTypeConstants.KIBUG) {
|
|
|
+ Application application = applicationService.getApplicaitonByUploaderCaseId(caseExtendsVO.getAppId());
|
|
|
caseExtends.setTargetId(application.getId());
|
|
|
- } else if (caseExtendsVO.getSubsiteId() == SubsiteConstants.DEV_SUBSITE_ID || caseExtends.getSubsiteId() == SubsiteConstants.DEVELOP_SUBSITE_ID) {
|
|
|
- DevTarget devTarget = targetService.findDevByUpLoadCaseId(caseExtendsVO.getTargetId());
|
|
|
+ } else if (app.getTargetType() == TargetTypeConstants.DEV) {
|
|
|
+ DevTarget devTarget = targetService.findDevByUpLoadCaseId(caseExtendsVO.getAppId());
|
|
|
caseExtends.setTargetId(devTarget.getId());
|
|
|
+ } else if (app.getTargetType() == TargetTypeConstants.WEB) {
|
|
|
+ WebTarget webTarget = targetService.findWebByAppId(caseExtendsVO.getAppId());
|
|
|
+ caseExtends.setTargetId(webTarget.getId());
|
|
|
}
|
|
|
|
|
|
CaseExtends savedCase = caseService.save(caseExtends);
|
|
|
@@ -209,15 +217,9 @@ public class CaseLogicImpl implements CaseLogic {
|
|
|
throw new IllegalArgumentException();
|
|
|
|
|
|
CaseExtendsVO re = Converter.convert(CaseExtendsVO.class, caseExtends);
|
|
|
-
|
|
|
- if (caseExtends.getSubsiteId() == SubsiteConstants.KIKBUG_SUBSITE_ID || caseExtends.getSubsiteId() == SubsiteConstants.KIJAM_SUBSITE_ID) {
|
|
|
- Application application = applicationService.getAppById(caseExtends.getTargetId());
|
|
|
- re.setTargetName(application.getName());
|
|
|
- } else if (caseExtends.getSubsiteId() == SubsiteConstants.DEV_SUBSITE_ID || caseExtends.getSubsiteId() == SubsiteConstants.DEVELOP_SUBSITE_ID) {
|
|
|
- App app = appService.getAppById(caseExtends.getAppId());
|
|
|
- re.setTargetName(app.getName());
|
|
|
- }
|
|
|
-
|
|
|
+ App app = targetService.findById(caseExtends.getAppId());
|
|
|
+ re.setTargetName(app.getName());
|
|
|
+ re.setTargetType(app.getTargetType());
|
|
|
return re;
|
|
|
}
|
|
|
|
|
|
@@ -239,27 +241,34 @@ public class CaseLogicImpl implements CaseLogic {
|
|
|
continue;
|
|
|
}
|
|
|
long caseid = caseBlock.getCaseIds().get(0);
|
|
|
- CaseExtendsVO caseExtendsVO = Converter.convert(CaseExtendsVO.class, caseService.getCaseExtendsById(caseid));
|
|
|
+ CaseExtends caseExtends=caseService.getCaseExtendsById(caseid);
|
|
|
+ CaseExtendsVO caseExtendsVO = Converter.convert(CaseExtendsVO.class, caseExtends);
|
|
|
caseExtendsVO.setTaskId(examId);
|
|
|
- if (isWorker == true && caseExtendsVO.getSubsiteId() == SubsiteConstants.DEV_SUBSITE_ID){
|
|
|
+ if (caseExtends.getAppId() != null) {
|
|
|
+ App app=targetService.findById(caseExtends.getAppId());
|
|
|
+ caseExtendsVO.setTargetType(app.getTargetType());
|
|
|
+ if(app.getTargetType()==TargetTypeConstants.KIBUG) {
|
|
|
+ caseExtendsVO.setAppLocation(app.getUrl());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (isWorker == true && (caseExtendsVO.getAnswerWay() == AnswerWayConstants.DEV_ECLIPSE || caseExtendsVO.getAnswerWay() == AnswerWayConstants.APP_ECLIPSE
|
|
|
+ || caseExtendsVO.getAnswerWay() == AnswerWayConstants.WEB_ECLIPSE || caseExtendsVO.getAnswerWay() == AnswerWayConstants.JMETER)){
|
|
|
caseExtendsVO.setSecret(indexService.getSecret(userId, examId));
|
|
|
caseExtendsVO.setSubmitted(assignedTaskService.isSubmitted(examId,userId,caseExtendsVO.getId(),caseExtendsVO.getCaseId()));
|
|
|
}
|
|
|
- if (caseExtendsVO.getSubsiteId() == SubsiteConstants.KIKBUG_SUBSITE_ID) {
|
|
|
- caseExtendsVO.setAppLocation(applicationService.getAppById(caseExtendsVO.getTargetId()).getAppLocation());
|
|
|
- if(caseExtendsVO.getId()==297)
|
|
|
- caseExtendsVO.setSecret(indexService.getSecret(userId,examId));
|
|
|
- else {
|
|
|
- Report report = reportService.getReport(examId, caseid, userId);
|
|
|
- if (report != null)
|
|
|
- caseExtendsVO.setReportId(report.getId());
|
|
|
- if (isManager)
|
|
|
- caseExtendsVO.setCaseReportUrl("/report/list/" + examId + "/" + caseid);
|
|
|
- }
|
|
|
+ if (caseExtendsVO.getAnswerWay() == AnswerWayConstants.REPORT) {
|
|
|
+ Report report = reportService.getReport(examId, caseid, userId);
|
|
|
+ if (report != null)
|
|
|
+ caseExtendsVO.setReportId(report.getId());
|
|
|
+ if (isManager)
|
|
|
+ caseExtendsVO.setCaseReportUrl("/report/list/" + examId + "/" + caseid);
|
|
|
}
|
|
|
- if (caseExtendsVO.getSubsiteId() == SubsiteConstants.KIJAM_SUBSITE_ID) {
|
|
|
+ if (caseExtendsVO.getAnswerWay() == AnswerWayConstants.THIRD_PARTY) {
|
|
|
String openId=openId2UserIdService.findOpenIdByUserId(userId);
|
|
|
caseExtendsVO.setEntrance("http://api.mooctest.net/oauth/thirdPart?openId="+openId+"&taskId="+examId+"&thirdPartId="+ ThirdPartConstants.ZEZHONG+"&caseId="+caseid);
|
|
|
+ Report report = reportService.getReport(examId, caseid, userId);
|
|
|
+ if(report != null)
|
|
|
+ caseExtendsVO.setReportId(report.getId());
|
|
|
}
|
|
|
caseVoList.add(caseExtendsVO);
|
|
|
}
|