|
@@ -40,7 +40,7 @@ public class ReviewJobService {
|
|
|
return jobDao.findJobs();
|
|
|
}
|
|
|
|
|
|
- public String uploadJob(String examId,String caseId,String name, String description, String paperId, String startTime, String endTime, @RequestParam(name = "workerList") List<String>workerList, String workerDistribution){
|
|
|
+ public String uploadJob(String examId,String caseId,String name, String description, String paperId, String startTime, String endTime, List<String>workerList, String workerDistribution){
|
|
|
ReviewJob reviewJob=new ReviewJob(examId,caseId,name,description,Long.toString(System.currentTimeMillis()),paperId,startTime,endTime,"");
|
|
|
String jobId=jobDao.save(reviewJob);
|
|
|
List<String>workerIds=new ArrayList<>();
|
|
@@ -53,11 +53,31 @@ public class ReviewJobService {
|
|
|
List<String>reportIds=new ArrayList<>();
|
|
|
for(int i=0;i<reviewReports.size();i++)
|
|
|
reportIds.add(reviewReports.get(i).getId());
|
|
|
- groupDao.save(new ReviewGroup("default","",workerIds,jobId,reportIds));
|
|
|
+ saveJobDistribution(workerDistribution,jobId);
|
|
|
return jobId;
|
|
|
}
|
|
|
|
|
|
- public MessageVO uploadJobByJson(@RequestBody JobJsonDTO jobJsonDTO){
|
|
|
+ private void saveJobDistribution(String workerDistribution,String jobId){
|
|
|
+ JSONArray jsonArray=new JSONArray(workerDistribution);
|
|
|
+ for(int i=0;i<jsonArray.length();i++){
|
|
|
+ JSONObject jsonObject=jsonArray.getJSONObject(i);
|
|
|
+ String name=jsonObject.getString("name");
|
|
|
+ String desciption=jsonObject.getString("description");
|
|
|
+ JSONArray jsonArray1=jsonObject.getJSONArray("worker");
|
|
|
+ List<String>workerIds=new ArrayList<>();
|
|
|
+ for(int j=0;j<jsonArray1.length();j++){
|
|
|
+ workerIds.add(String.valueOf(jsonArray1.get(j)));
|
|
|
+ }
|
|
|
+ JSONArray jsonArray2=jsonObject.getJSONArray("report");
|
|
|
+ List<String>reportIds=new ArrayList<>();
|
|
|
+ for(int j=0;j<jsonArray2.length();j++){
|
|
|
+ reportIds.add(String.valueOf(jsonArray1.get(j)));
|
|
|
+ }
|
|
|
+ groupDao.save(new ReviewGroup(name,desciption,workerIds,jobId,reportIds));
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ public MessageVO uploadJobByJson(JobJsonDTO jobJsonDTO){
|
|
|
String jobName=jobJsonDTO.getJob_name();
|
|
|
String jobDescription=jobJsonDTO.getJob_description();
|
|
|
String startTime=jobJsonDTO.getStart_time();
|
|
@@ -80,7 +100,13 @@ public class ReviewJobService {
|
|
|
return messageVO;
|
|
|
}
|
|
|
String paperId=paperResult.getString("paperId");
|
|
|
+ List<ReviewReport>reports=reviewPaperService.getReportsByPaperId(paperId);
|
|
|
+ List<String>reportIds=new ArrayList<>();
|
|
|
+ for(int i=0;i<reports.size();i++){
|
|
|
+ reportIds.add(reports.get(i).getId());
|
|
|
+ }
|
|
|
String jobId=uploadJob(examId,caseId,jobName,jobDescription,paperId,startTime,endTime,workerList,"");
|
|
|
+ groupDao.save(new ReviewGroup("default","",workerList,jobId,reportIds));
|
|
|
messageVO.setStatus("200");
|
|
|
messageVO.setMessage(jobId);
|
|
|
} catch (IOException e) {
|
|
@@ -109,7 +135,7 @@ public class ReviewJobService {
|
|
|
List<String>reportIds=new ArrayList<>();
|
|
|
for(int i=0;i<reviewReports.size();i++)
|
|
|
reportIds.add(reviewReports.get(i).getId());
|
|
|
- groupDao.save(new ReviewGroup("default","",workerIds,jobId,reportIds));
|
|
|
+ saveJobDistribution(workerDistribution,jobId);
|
|
|
return true;
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
@@ -129,4 +155,20 @@ public class ReviewJobService {
|
|
|
return false;
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ public JSONArray getJobDistribution(String jobId){
|
|
|
+ List<ReviewGroup>reviewGroups=groupDao.getGroupsByJob(jobId);
|
|
|
+ JSONArray jsonArray=new JSONArray();
|
|
|
+ for(int i=0;i<reviewGroups.size();i++){
|
|
|
+ ReviewGroup reviewGroup=reviewGroups.get(i);
|
|
|
+ JSONObject jsonObject=new JSONObject();
|
|
|
+ jsonObject.put("name",reviewGroup.getName());
|
|
|
+ jsonObject.put("description",reviewGroup.getDescription());
|
|
|
+ jsonObject.put("worker",reviewGroup.getWorkers_id());
|
|
|
+ jsonObject.put("report",reviewGroup.getReport_id());
|
|
|
+ jsonArray.put(jsonObject);
|
|
|
+ }
|
|
|
+ return jsonArray;
|
|
|
+
|
|
|
+ }
|
|
|
}
|