|
@@ -6,7 +6,6 @@ import cn.iselab.mooctest.site.common.constant.SubsiteConstants;
|
|
|
import cn.iselab.mooctest.site.dao.*;
|
|
import cn.iselab.mooctest.site.dao.*;
|
|
|
import cn.iselab.mooctest.site.models.*;
|
|
import cn.iselab.mooctest.site.models.*;
|
|
|
import cn.iselab.mooctest.site.service.application.ApiService;
|
|
import cn.iselab.mooctest.site.service.application.ApiService;
|
|
|
-import org.apache.commons.lang3.StringUtils;
|
|
|
|
|
import org.json.JSONArray;
|
|
import org.json.JSONArray;
|
|
|
import org.json.JSONObject;
|
|
import org.json.JSONObject;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
@@ -44,14 +43,11 @@ public class ApiServiceImpl implements ApiService {
|
|
|
private AppDao appDao;
|
|
private AppDao appDao;
|
|
|
@Autowired
|
|
@Autowired
|
|
|
private SubjectDao subjectDao;
|
|
private SubjectDao subjectDao;
|
|
|
-
|
|
|
|
|
- private static long generateCase(List<Long> caseIdsList) {
|
|
|
|
|
- int serial = new Double(Math.floor(Math.random() * caseIdsList.size()))
|
|
|
|
|
- .intValue();
|
|
|
|
|
- return caseIdsList.get(serial);
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ @Autowired
|
|
|
|
|
+ private Task2AssistantManagerDao task2AssistantManagerDao;
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
|
|
+ *
|
|
|
* GET methods
|
|
* GET methods
|
|
|
*/
|
|
*/
|
|
|
@Override
|
|
@Override
|
|
@@ -69,11 +65,12 @@ public class ApiServiceImpl implements ApiService {
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
List<AssignedTask> assignedTasks = new ArrayList<AssignedTask>();
|
|
List<AssignedTask> assignedTasks = new ArrayList<AssignedTask>();
|
|
|
- if (groupId == null) {
|
|
|
|
|
|
|
+ if (groupId == null){
|
|
|
assignedTasks = assignedTaskDao.findByWorkerId(workerId);
|
|
assignedTasks = assignedTaskDao.findByWorkerId(workerId);
|
|
|
- } else {
|
|
|
|
|
|
|
+ }
|
|
|
|
|
+ else{
|
|
|
List<Task2Group> task2Groups = task2GroupDao.findByGroupId(groupId);
|
|
List<Task2Group> task2Groups = task2GroupDao.findByGroupId(groupId);
|
|
|
- for (Task2Group task2Group : task2Groups) {
|
|
|
|
|
|
|
+ for (Task2Group task2Group : task2Groups){
|
|
|
Task taskInGroup = taskDao.findOne(task2Group.getTaskId());
|
|
Task taskInGroup = taskDao.findOne(task2Group.getTaskId());
|
|
|
assignedTasks.add(assignedTaskDao.findByTaskIdAndWorkerId(taskInGroup.getId(), workerId));
|
|
assignedTasks.add(assignedTaskDao.findByTaskIdAndWorkerId(taskInGroup.getId(), workerId));
|
|
|
}
|
|
}
|
|
@@ -81,13 +78,13 @@ public class ApiServiceImpl implements ApiService {
|
|
|
|
|
|
|
|
// generate output JSON
|
|
// generate output JSON
|
|
|
JSONArray resultArr = new JSONArray();
|
|
JSONArray resultArr = new JSONArray();
|
|
|
- for (AssignedTask assignedTask : assignedTasks) {
|
|
|
|
|
|
|
+ for (AssignedTask assignedTask : assignedTasks){
|
|
|
JSONObject resultObj = new JSONObject();
|
|
JSONObject resultObj = new JSONObject();
|
|
|
Task taskAssigned = taskDao.findOne(assignedTask.getTaskId());
|
|
Task taskAssigned = taskDao.findOne(assignedTask.getTaskId());
|
|
|
Subsite subsiteAssigned = subsiteDao.findOne(taskAssigned.getSubsiteId());
|
|
Subsite subsiteAssigned = subsiteDao.findOne(taskAssigned.getSubsiteId());
|
|
|
Manager managerOfTask = managerDao.findOne(taskAssigned.getManagerId());
|
|
Manager managerOfTask = managerDao.findOne(taskAssigned.getManagerId());
|
|
|
|
|
|
|
|
- if (subsiteAssigned.getId() != subsite.getId()) {
|
|
|
|
|
|
|
+ if (subsiteAssigned.getId() != subsite.getId()){
|
|
|
continue;
|
|
continue;
|
|
|
}
|
|
}
|
|
|
resultObj.put("name", taskAssigned.getName());
|
|
resultObj.put("name", taskAssigned.getName());
|
|
@@ -99,7 +96,7 @@ public class ApiServiceImpl implements ApiService {
|
|
|
|
|
|
|
|
JSONArray groupArr = new JSONArray();
|
|
JSONArray groupArr = new JSONArray();
|
|
|
List<Task2Group> task2Groups = task2GroupDao.findByTaskId(taskAssigned.getId());
|
|
List<Task2Group> task2Groups = task2GroupDao.findByTaskId(taskAssigned.getId());
|
|
|
- for (Task2Group task2Group : task2Groups) {
|
|
|
|
|
|
|
+ for (Task2Group task2Group : task2Groups){
|
|
|
Group groupInTask = groupDao.findOne(task2Group.getGroupId());
|
|
Group groupInTask = groupDao.findOne(task2Group.getGroupId());
|
|
|
groupArr.put(groupInTask.getName());
|
|
groupArr.put(groupInTask.getName());
|
|
|
}
|
|
}
|
|
@@ -117,7 +114,7 @@ public class ApiServiceImpl implements ApiService {
|
|
|
Task task = taskDao.findOne(taskId);
|
|
Task task = taskDao.findOne(taskId);
|
|
|
Worker worker = workerDao.findOne(workerId);
|
|
Worker worker = workerDao.findOne(workerId);
|
|
|
|
|
|
|
|
- if (task == null || worker == null) {
|
|
|
|
|
|
|
+ if (task == null || worker == null){
|
|
|
return "";
|
|
return "";
|
|
|
}
|
|
}
|
|
|
Manager managerOfTask = managerDao.findOne(task.getManagerId());
|
|
Manager managerOfTask = managerDao.findOne(task.getManagerId());
|
|
@@ -132,8 +129,8 @@ public class ApiServiceImpl implements ApiService {
|
|
|
result.put("managerId", managerOfTask.getId());
|
|
result.put("managerId", managerOfTask.getId());
|
|
|
JSONArray groupArr = new JSONArray();
|
|
JSONArray groupArr = new JSONArray();
|
|
|
List<Task2Group> task2Groups = task2GroupDao.findByTaskId(taskId);
|
|
List<Task2Group> task2Groups = task2GroupDao.findByTaskId(taskId);
|
|
|
- if (task2Groups != null) {
|
|
|
|
|
- for (Task2Group task2Group : task2Groups) {
|
|
|
|
|
|
|
+ if (task2Groups != null){
|
|
|
|
|
+ for (Task2Group task2Group : task2Groups){
|
|
|
Group groupInTask = groupDao.findOne(task2Group.getGroupId());
|
|
Group groupInTask = groupDao.findOne(task2Group.getGroupId());
|
|
|
groupArr.put(groupInTask.getName());
|
|
groupArr.put(groupInTask.getName());
|
|
|
}
|
|
}
|
|
@@ -141,7 +138,7 @@ public class ApiServiceImpl implements ApiService {
|
|
|
result.put("groups", groupArr);
|
|
result.put("groups", groupArr);
|
|
|
|
|
|
|
|
AssignedTask assignedTask = assignedTaskDao.findByTaskIdAndWorkerId(taskId, workerId);
|
|
AssignedTask assignedTask = assignedTaskDao.findByTaskIdAndWorkerId(taskId, workerId);
|
|
|
- if (assignedTask == null) {
|
|
|
|
|
|
|
+ if (assignedTask == null){
|
|
|
return "";
|
|
return "";
|
|
|
}
|
|
}
|
|
|
JSONArray caseListArr = new JSONArray();
|
|
JSONArray caseListArr = new JSONArray();
|
|
@@ -153,7 +150,7 @@ public class ApiServiceImpl implements ApiService {
|
|
|
JSONObject contentObj = new JSONObject(assignedTask.getContent());
|
|
JSONObject contentObj = new JSONObject(assignedTask.getContent());
|
|
|
JSONObject casesObj = contentObj.getJSONObject("cases");
|
|
JSONObject casesObj = contentObj.getJSONObject("cases");
|
|
|
Set<String> keySet = casesObj.keySet();
|
|
Set<String> keySet = casesObj.keySet();
|
|
|
- for (String key : keySet) {
|
|
|
|
|
|
|
+ for (String key : keySet){
|
|
|
subsiteCaseIds.add(key);
|
|
subsiteCaseIds.add(key);
|
|
|
JSONObject caseObj = new JSONObject();
|
|
JSONObject caseObj = new JSONObject();
|
|
|
caseObj.put("id", key);
|
|
caseObj.put("id", key);
|
|
@@ -164,9 +161,9 @@ public class ApiServiceImpl implements ApiService {
|
|
|
// check if there are any cases which are not assigned(need to be picked by workers themselves)
|
|
// check if there are any cases which are not assigned(need to be picked by workers themselves)
|
|
|
Task taskAssigned = taskDao.findOne(assignedTask.getTaskId());
|
|
Task taskAssigned = taskDao.findOne(assignedTask.getTaskId());
|
|
|
List<Task2Case> task2Cases = task2CaseDao.findByTaskId(taskAssigned.getId());
|
|
List<Task2Case> task2Cases = task2CaseDao.findByTaskId(taskAssigned.getId());
|
|
|
- for (Task2Case task2Case : task2Cases) {
|
|
|
|
|
|
|
+ for (Task2Case task2Case : task2Cases){
|
|
|
Case cazeInTask = caseDao.findOne(task2Case.getId());
|
|
Case cazeInTask = caseDao.findOne(task2Case.getId());
|
|
|
- if ((!task2Case.isAutoSelect()) && (!subsiteCaseIds.contains(cazeInTask.getCaseId()))) {
|
|
|
|
|
|
|
+ if ((!task2Case.isAutoSelect()) && (!subsiteCaseIds.contains(cazeInTask.getCaseId()))){
|
|
|
|
|
|
|
|
Case caze = caseDao.findOne(task2Case.getCaseId());
|
|
Case caze = caseDao.findOne(task2Case.getCaseId());
|
|
|
subsiteCaseIds.add(caze.getCaseId());
|
|
subsiteCaseIds.add(caze.getCaseId());
|
|
@@ -187,7 +184,7 @@ public class ApiServiceImpl implements ApiService {
|
|
|
JSONObject result = new JSONObject();
|
|
JSONObject result = new JSONObject();
|
|
|
|
|
|
|
|
Task task = taskDao.findOne(taskId);
|
|
Task task = taskDao.findOne(taskId);
|
|
|
- if (task == null) {
|
|
|
|
|
|
|
+ if (task == null){
|
|
|
return "";
|
|
return "";
|
|
|
}
|
|
}
|
|
|
result.put("id", task.getId());
|
|
result.put("id", task.getId());
|
|
@@ -197,13 +194,14 @@ public class ApiServiceImpl implements ApiService {
|
|
|
return result.toString();
|
|
return result.toString();
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+
|
|
|
@Override
|
|
@Override
|
|
|
public String getCases(Long workerId) {
|
|
public String getCases(Long workerId) {
|
|
|
JSONArray result = new JSONArray();
|
|
JSONArray result = new JSONArray();
|
|
|
|
|
|
|
|
List<AssignedTask> assignedTasks = assignedTaskDao.findByWorkerId(workerId);
|
|
List<AssignedTask> assignedTasks = assignedTaskDao.findByWorkerId(workerId);
|
|
|
Set<String> outputCaseIds = new HashSet<String>();
|
|
Set<String> outputCaseIds = new HashSet<String>();
|
|
|
- for (AssignedTask assignedTask : assignedTasks) {
|
|
|
|
|
|
|
+ for (AssignedTask assignedTask : assignedTasks){
|
|
|
Task taskAssigned = taskDao.findOne(assignedTask.getTaskId());
|
|
Task taskAssigned = taskDao.findOne(assignedTask.getTaskId());
|
|
|
Subsite subsiteAssigned = subsiteDao.findOne(taskAssigned.getSubsiteId());
|
|
Subsite subsiteAssigned = subsiteDao.findOne(taskAssigned.getSubsiteId());
|
|
|
if (subsiteAssigned.getId() != SubsiteConstants.KIKBUG_SUBSITE_ID && subsiteAssigned.getId() != SubsiteConstants.KIJAM_SUBSITE_ID) {
|
|
if (subsiteAssigned.getId() != SubsiteConstants.KIKBUG_SUBSITE_ID && subsiteAssigned.getId() != SubsiteConstants.KIJAM_SUBSITE_ID) {
|
|
@@ -212,7 +210,7 @@ public class ApiServiceImpl implements ApiService {
|
|
|
JSONObject contentObj = new JSONObject(assignedTask.getContent());
|
|
JSONObject contentObj = new JSONObject(assignedTask.getContent());
|
|
|
JSONObject casesObj = contentObj.getJSONObject("cases");
|
|
JSONObject casesObj = contentObj.getJSONObject("cases");
|
|
|
Set<String> keySet = casesObj.keySet();
|
|
Set<String> keySet = casesObj.keySet();
|
|
|
- for (String key : keySet) {
|
|
|
|
|
|
|
+ for (String key : keySet){
|
|
|
outputCaseIds.add(key);
|
|
outputCaseIds.add(key);
|
|
|
JSONObject caseObj = new JSONObject();
|
|
JSONObject caseObj = new JSONObject();
|
|
|
caseObj.put("caseId", key);
|
|
caseObj.put("caseId", key);
|
|
@@ -222,14 +220,14 @@ public class ApiServiceImpl implements ApiService {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
List<Task2Case> task2Cases = task2CaseDao.findByTaskId(assignedTask.getTaskId());
|
|
List<Task2Case> task2Cases = task2CaseDao.findByTaskId(assignedTask.getTaskId());
|
|
|
- for (Task2Case task2Case : task2Cases) {
|
|
|
|
|
|
|
+ for (Task2Case task2Case : task2Cases){
|
|
|
taskAssigned = taskDao.findOne(assignedTask.getTaskId());
|
|
taskAssigned = taskDao.findOne(assignedTask.getTaskId());
|
|
|
subsiteAssigned = subsiteDao.findOne(taskAssigned.getSubsiteId());
|
|
subsiteAssigned = subsiteDao.findOne(taskAssigned.getSubsiteId());
|
|
|
- if (subsiteAssigned.getId() != SubsiteConstants.KIKBUG_SUBSITE_ID || subsiteAssigned.getId() != SubsiteConstants.KIJAM_SUBSITE_ID) {
|
|
|
|
|
|
|
+ if (subsiteAssigned.getId() != SubsiteConstants.KIKBUG_SUBSITE_ID || subsiteAssigned.getId() != SubsiteConstants.KIJAM_SUBSITE_ID){
|
|
|
continue;
|
|
continue;
|
|
|
}
|
|
}
|
|
|
Case cazeInTask = caseDao.findOne(task2Case.getCaseId());
|
|
Case cazeInTask = caseDao.findOne(task2Case.getCaseId());
|
|
|
- if (!task2Case.isAutoSelect() && (!outputCaseIds.contains(cazeInTask.getCaseId()))) {
|
|
|
|
|
|
|
+ if (!task2Case.isAutoSelect() && (!outputCaseIds.contains(cazeInTask.getCaseId()))){
|
|
|
outputCaseIds.add(cazeInTask.getCaseId());
|
|
outputCaseIds.add(cazeInTask.getCaseId());
|
|
|
JSONObject caseObj = new JSONObject();
|
|
JSONObject caseObj = new JSONObject();
|
|
|
caseObj.put("caseId", cazeInTask.getCaseId());
|
|
caseObj.put("caseId", cazeInTask.getCaseId());
|
|
@@ -244,8 +242,11 @@ public class ApiServiceImpl implements ApiService {
|
|
|
return result.toString();
|
|
return result.toString();
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+
|
|
|
/**
|
|
/**
|
|
|
|
|
+ *
|
|
|
* POST methods
|
|
* POST methods
|
|
|
|
|
+ *
|
|
|
*/
|
|
*/
|
|
|
@Override
|
|
@Override
|
|
|
public boolean verifyApp(Long appId, String url) {
|
|
public boolean verifyApp(Long appId, String url) {
|
|
@@ -265,18 +266,18 @@ public class ApiServiceImpl implements ApiService {
|
|
|
|
|
|
|
|
Group group = groupDao.findOne(groupId);
|
|
Group group = groupDao.findOne(groupId);
|
|
|
// check privilege
|
|
// check privilege
|
|
|
- if (groupId != PrivilegeConstants.SUPER_GROUP_ID) {
|
|
|
|
|
- if (privilegeExpired(managerDao.findOne(group.getManagerId())) || groupMemberExceeded(group)) {
|
|
|
|
|
|
|
+ if (groupId != PrivilegeConstants.SUPER_GROUP_ID){
|
|
|
|
|
+ if (privilegeExpired(managerDao.findOne(group.getManagerId())) || groupMemberExceeded(group)){
|
|
|
return false;
|
|
return false;
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
if (group != null) {
|
|
if (group != null) {
|
|
|
Worker worker = workerDao.findOne(workerId);
|
|
Worker worker = workerDao.findOne(workerId);
|
|
|
Manager manager = managerDao.findOne(group.getManagerId());
|
|
Manager manager = managerDao.findOne(group.getManagerId());
|
|
|
- if (!manager.getName().equals(managerName)) {
|
|
|
|
|
|
|
+ if (!manager.getName().equals(managerName)){
|
|
|
return false;
|
|
return false;
|
|
|
}
|
|
}
|
|
|
- if (group2WorkerDao.findByWorkerIdAndGroupId(workerId, groupId) != null) {
|
|
|
|
|
|
|
+ if (group2WorkerDao.findByWorkerIdAndGroupId(workerId, groupId) != null){
|
|
|
return false;
|
|
return false;
|
|
|
}
|
|
}
|
|
|
group2Worker.setWorkerId(worker.getId());
|
|
group2Worker.setWorkerId(worker.getId());
|
|
@@ -292,58 +293,79 @@ public class ApiServiceImpl implements ApiService {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|
|
|
- public boolean addScore(Long workerId, Long taskId, Double score, String resultUrl, String picked, String host) {
|
|
|
|
|
- JSONObject caseContentObj = new JSONObject(picked);
|
|
|
|
|
- AssignedTask assignedTask = assignedTaskDao.findByTaskIdAndWorkerId(taskId, workerId);
|
|
|
|
|
|
|
+ public boolean addScores(String host, Long taskId, Long[] workerIds, Double[] scores, String[] resultUrls, String[] pickeds){
|
|
|
|
|
+ for (int idx = 0 ; idx < workerIds.length ; idx ++){
|
|
|
|
|
+ String picked = pickeds[idx];
|
|
|
|
|
+ double score = scores[idx];
|
|
|
|
|
+ long workerId = workerIds[idx];
|
|
|
|
|
+ String resultUrl = resultUrls[idx];
|
|
|
|
|
+
|
|
|
|
|
+ JSONObject caseContentObj = new JSONObject(picked);
|
|
|
|
|
+ AssignedTask assignedTask = assignedTaskDao.findByTaskIdAndWorkerId(taskId, workerId);
|
|
|
|
|
+
|
|
|
|
|
+ JSONObject results = new JSONObject(assignedTask.getResult());
|
|
|
|
|
+ JSONObject resultObj = results.getJSONObject("results");
|
|
|
|
|
+
|
|
|
|
|
+ String subsiteCaseId = caseContentObj.getString("caseId");
|
|
|
|
|
+
|
|
|
|
|
+ double weight = caseContentObj.getDouble("weight");
|
|
|
|
|
+ JSONObject caseResultObj = new JSONObject();
|
|
|
|
|
+ JSONArray caseScoreArr = new JSONArray(), caseResultUrlArr = new JSONArray();
|
|
|
|
|
+ double maxScore = score;
|
|
|
|
|
+ if (resultObj.has(String.valueOf(subsiteCaseId))){
|
|
|
|
|
|
|
|
- JSONObject results = new JSONObject(assignedTask.getResult());
|
|
|
|
|
- JSONObject resultObj = results.getJSONObject("results");
|
|
|
|
|
-
|
|
|
|
|
- String subsiteCaseId = caseContentObj.getString("caseId");
|
|
|
|
|
-
|
|
|
|
|
- double weight = caseContentObj.getDouble("weight");
|
|
|
|
|
- JSONObject caseResultObj = new JSONObject();
|
|
|
|
|
- JSONArray caseScoreArr = new JSONArray(), caseResultUrlArr = new JSONArray();
|
|
|
|
|
- double maxScore = score;
|
|
|
|
|
- if (resultObj.has(String.valueOf(subsiteCaseId))) {
|
|
|
|
|
-
|
|
|
|
|
- caseResultObj = resultObj.getJSONObject(String.valueOf(subsiteCaseId));
|
|
|
|
|
- caseScoreArr = caseResultObj.getJSONArray("scores");
|
|
|
|
|
- caseResultUrlArr = caseResultObj.getJSONArray("resultUrls");
|
|
|
|
|
- maxScore = Math.max(caseResultObj.getDouble("maxScore"), score);
|
|
|
|
|
- } else {
|
|
|
|
|
- caseResultObj.put("id", caseContentObj.getLong("id"));
|
|
|
|
|
- caseResultObj.put("name", caseContentObj.getString("name"));
|
|
|
|
|
- caseResultObj.put("weight", caseContentObj.getDouble("weight"));
|
|
|
|
|
- }
|
|
|
|
|
- caseScoreArr.put(score);
|
|
|
|
|
- caseResultObj.put("scores", caseScoreArr);
|
|
|
|
|
- caseResultUrlArr.put(resultUrl);
|
|
|
|
|
- caseResultObj.put("resultUrls", caseResultUrlArr);
|
|
|
|
|
- caseResultObj.put("maxScore", maxScore);
|
|
|
|
|
-
|
|
|
|
|
- // update resultObj
|
|
|
|
|
- resultObj.put(String.valueOf(subsiteCaseId), caseResultObj);
|
|
|
|
|
- results.put("results", resultObj);
|
|
|
|
|
-
|
|
|
|
|
- // update assignedTask score
|
|
|
|
|
- assignedTask.setScore(score);
|
|
|
|
|
- assignedTask.setResult(results.toString());
|
|
|
|
|
- assignedTaskDao.save(assignedTask);
|
|
|
|
|
|
|
+ caseResultObj = resultObj.getJSONObject(String.valueOf(subsiteCaseId));
|
|
|
|
|
+ caseScoreArr = caseResultObj.getJSONArray("scores");
|
|
|
|
|
+ caseResultUrlArr = caseResultObj.getJSONArray("resultUrls");
|
|
|
|
|
+ maxScore = Math.max(maxScore, caseResultObj.getDouble("maxScore"));
|
|
|
|
|
+
|
|
|
|
|
+ }
|
|
|
|
|
+ else{
|
|
|
|
|
+ caseResultObj.put("id", caseContentObj.getLong("id"));
|
|
|
|
|
+ caseResultObj.put("name", caseContentObj.getString("name"));
|
|
|
|
|
+ caseResultObj.put("weight", caseContentObj.getDouble("weight"));
|
|
|
|
|
+ }
|
|
|
|
|
+ caseScoreArr.put(score);
|
|
|
|
|
+ caseResultObj.put("scores", caseScoreArr);
|
|
|
|
|
+ caseResultUrlArr.put(resultUrl);
|
|
|
|
|
+ caseResultObj.put("resultUrls", caseResultUrlArr);
|
|
|
|
|
+ caseResultObj.put("maxScore", maxScore);
|
|
|
|
|
+
|
|
|
|
|
+ // update resultObj
|
|
|
|
|
+ resultObj.put(String.valueOf(subsiteCaseId), caseResultObj);
|
|
|
|
|
+ results.put("results", resultObj);
|
|
|
|
|
+
|
|
|
|
|
+ // update assignedTask score
|
|
|
|
|
+ assignedTask.setScore(score);
|
|
|
|
|
+ assignedTask.setResult(results.toString());
|
|
|
|
|
+ assignedTaskDao.save(assignedTask);
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
return true;
|
|
return true;
|
|
|
|
|
+
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public boolean addScore(Long workerId, Long taskId, Double score,
|
|
|
|
|
+ String resultUrl, String picked, String host) {
|
|
|
|
|
+ Long[] workerIds = {workerId};
|
|
|
|
|
+ String[] pickeds = {picked};
|
|
|
|
|
+ String[] resultUrls = {resultUrl};
|
|
|
|
|
+ Double[] scores = {score};
|
|
|
|
|
+
|
|
|
|
|
+ return addScores(host, taskId, workerIds, scores, resultUrls, pickeds);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|
|
|
public String uploadApp(String host, String name, String caseUrl, Boolean isPublic, Long uploaderId) {
|
|
public String uploadApp(String host, String name, String caseUrl, Boolean isPublic, Long uploaderId) {
|
|
|
String message = "";
|
|
String message = "";
|
|
|
Subsite subsite = subsiteDao.findByBaseUrl(host);
|
|
Subsite subsite = subsiteDao.findByBaseUrl(host);
|
|
|
- if (subsite == null) {
|
|
|
|
|
|
|
+ if (subsite == null){
|
|
|
return "No subsite match from host";
|
|
return "No subsite match from host";
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
Manager uploader = managerDao.findById(uploaderId);
|
|
Manager uploader = managerDao.findById(uploaderId);
|
|
|
- if (uploader == null) {
|
|
|
|
|
|
|
+ if (uploader == null){
|
|
|
return "No such manager";
|
|
return "No such manager";
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -367,13 +389,13 @@ public class ApiServiceImpl implements ApiService {
|
|
|
App app = appDao.findOne(appId);
|
|
App app = appDao.findOne(appId);
|
|
|
|
|
|
|
|
Subsite subsite = subsiteDao.findByBaseUrl(host);
|
|
Subsite subsite = subsiteDao.findByBaseUrl(host);
|
|
|
- if (subsite == null) {
|
|
|
|
|
|
|
+ if (subsite == null){
|
|
|
return "No subsite match from host";
|
|
return "No subsite match from host";
|
|
|
}
|
|
}
|
|
|
description = (description == null) ? "" : description;
|
|
description = (description == null) ? "" : description;
|
|
|
|
|
|
|
|
Subject subject = subjectDao.findBySubsiteIdAndTypeName(subsite.getId(), typeName);
|
|
Subject subject = subjectDao.findBySubsiteIdAndTypeName(subsite.getId(), typeName);
|
|
|
- if (subject == null) {
|
|
|
|
|
|
|
+ if (subject == null){
|
|
|
subject = new Subject();
|
|
subject = new Subject();
|
|
|
subject.setName(typeName);
|
|
subject.setName(typeName);
|
|
|
subject.setTargetUrl("");
|
|
subject.setTargetUrl("");
|
|
@@ -383,7 +405,7 @@ public class ApiServiceImpl implements ApiService {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
Case oldCase = caseDao.findBySubsiteIdAndSubsiteCaseId(subsite.getId(), caseId);
|
|
Case oldCase = caseDao.findBySubsiteIdAndSubsiteCaseId(subsite.getId(), caseId);
|
|
|
- if (oldCase != null) {
|
|
|
|
|
|
|
+ if (oldCase != null){
|
|
|
return "case already exists";
|
|
return "case already exists";
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -408,14 +430,14 @@ public class ApiServiceImpl implements ApiService {
|
|
|
String message = "";
|
|
String message = "";
|
|
|
|
|
|
|
|
Subsite subsite = subsiteDao.findByBaseUrl(host);
|
|
Subsite subsite = subsiteDao.findByBaseUrl(host);
|
|
|
- if (subsite == null) {
|
|
|
|
|
|
|
+ if (subsite == null){
|
|
|
return "No subsite match from host";
|
|
return "No subsite match from host";
|
|
|
}
|
|
}
|
|
|
- Manager manager = (managerId == null) ? null : managerDao.findById(managerId);
|
|
|
|
|
|
|
+ Manager manager = (managerId == null) ? null : managerDao.findById(managerId);
|
|
|
description = (description == null) ? "" : description;
|
|
description = (description == null) ? "" : description;
|
|
|
|
|
|
|
|
Subject subject = subjectDao.findBySubsiteIdAndTypeName(subsite.getId(), typeName);
|
|
Subject subject = subjectDao.findBySubsiteIdAndTypeName(subsite.getId(), typeName);
|
|
|
- if (subject == null) {
|
|
|
|
|
|
|
+ if (subject == null){
|
|
|
subject = new Subject();
|
|
subject = new Subject();
|
|
|
subject.setName(typeName);
|
|
subject.setName(typeName);
|
|
|
subject.setTargetUrl("");
|
|
subject.setTargetUrl("");
|
|
@@ -425,7 +447,7 @@ public class ApiServiceImpl implements ApiService {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
Case oldCase = caseDao.findBySubsiteIdAndSubsiteCaseId(subsite.getId(), caseId);
|
|
Case oldCase = caseDao.findBySubsiteIdAndSubsiteCaseId(subsite.getId(), caseId);
|
|
|
- if (oldCase != null) {
|
|
|
|
|
|
|
+ if (oldCase != null){
|
|
|
return "case already exists";
|
|
return "case already exists";
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -445,6 +467,7 @@ public class ApiServiceImpl implements ApiService {
|
|
|
return message;
|
|
return message;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+
|
|
|
@Override
|
|
@Override
|
|
|
public String takeTask(Long workerId, Long taskId, String subsiteCaseId, String host) {
|
|
public String takeTask(Long workerId, Long taskId, String subsiteCaseId, String host) {
|
|
|
// get all entities
|
|
// get all entities
|
|
@@ -457,12 +480,12 @@ public class ApiServiceImpl implements ApiService {
|
|
|
// parse content
|
|
// parse content
|
|
|
String content = assignedTask.getContent();
|
|
String content = assignedTask.getContent();
|
|
|
JSONObject assignedContent = new JSONObject();
|
|
JSONObject assignedContent = new JSONObject();
|
|
|
- if (content.length() > 0) {
|
|
|
|
|
|
|
+ if (content.length() > 0){
|
|
|
assignedContent = new JSONObject(content);
|
|
assignedContent = new JSONObject(content);
|
|
|
}
|
|
}
|
|
|
JSONObject assignedObjs = assignedContent.has("cases") ? assignedContent.getJSONObject("cases") : new JSONObject();
|
|
JSONObject assignedObjs = assignedContent.has("cases") ? assignedContent.getJSONObject("cases") : new JSONObject();
|
|
|
boolean picked = false;
|
|
boolean picked = false;
|
|
|
- if (assignedObjs.has(String.valueOf(caze.getCaseId()))) {
|
|
|
|
|
|
|
+ if (assignedObjs.has(String.valueOf(caze.getCaseId()))){
|
|
|
picked = true;
|
|
picked = true;
|
|
|
}
|
|
}
|
|
|
JSONObject assignedCase = new JSONObject();
|
|
JSONObject assignedCase = new JSONObject();
|
|
@@ -479,7 +502,7 @@ public class ApiServiceImpl implements ApiService {
|
|
|
assignedObjs.put(String.valueOf(caze.getCaseId()), assignedCase);
|
|
assignedObjs.put(String.valueOf(caze.getCaseId()), assignedCase);
|
|
|
assignedContent.put("cases", assignedObjs);
|
|
assignedContent.put("cases", assignedObjs);
|
|
|
// update assignedTask if not chosen
|
|
// update assignedTask if not chosen
|
|
|
- if (!picked) {
|
|
|
|
|
|
|
+ if (!picked){
|
|
|
// if not picked before
|
|
// if not picked before
|
|
|
assignedTask.setContent(assignedContent.toString());
|
|
assignedTask.setContent(assignedContent.toString());
|
|
|
assignedTaskDao.save(assignedTask);
|
|
assignedTaskDao.save(assignedTask);
|
|
@@ -493,44 +516,83 @@ public class ApiServiceImpl implements ApiService {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
|
|
+ *
|
|
|
* UTILs methods
|
|
* UTILs methods
|
|
|
|
|
+ *
|
|
|
*/
|
|
*/
|
|
|
@Override
|
|
@Override
|
|
|
- public String checkCaseAssignment(Long workerId, String subsiteCaseId, Long taskId, String host) {
|
|
|
|
|
- AssignedTask assignedTask = assignedTaskDao.findByTaskIdAndWorkerId(taskId, workerId);
|
|
|
|
|
|
|
+ public String checkCaseAssignment(Long workerId,
|
|
|
|
|
+ String subsiteCaseId, Long taskId, String host) {
|
|
|
|
|
+ Long[] workerIds = {workerId};
|
|
|
|
|
+ String[] results = checkCaseAssignments(workerIds, subsiteCaseId, taskId, host);
|
|
|
|
|
+ if (results != null){
|
|
|
|
|
+ return results[0];
|
|
|
|
|
+ }
|
|
|
|
|
+ else{
|
|
|
|
|
+ return null;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public String[] checkCaseAssignments(Long[] workerIds, String subsiteCaseId, Long taskId, String host){
|
|
|
|
|
+ String[] results = new String[workerIds.length];
|
|
|
Subsite subsite = subsiteDao.findByBaseUrl(host);
|
|
Subsite subsite = subsiteDao.findByBaseUrl(host);
|
|
|
|
|
+ if (subsite == null){
|
|
|
|
|
+ return null;
|
|
|
|
|
+ }
|
|
|
Case caze = caseDao.findBySubsiteIdAndSubsiteCaseId(subsite.getId(), subsiteCaseId);
|
|
Case caze = caseDao.findBySubsiteIdAndSubsiteCaseId(subsite.getId(), subsiteCaseId);
|
|
|
- if (assignedTask == null || subsite == null || caze == null) {
|
|
|
|
|
|
|
+ if (caze == null){
|
|
|
return null;
|
|
return null;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- JSONObject contentObj = new JSONObject(assignedTask.getContent());
|
|
|
|
|
- JSONObject casesObj = contentObj.getJSONObject("cases");
|
|
|
|
|
- if (casesObj.has(String.valueOf(caze.getCaseId()))) {
|
|
|
|
|
- return casesObj.get(String.valueOf(caze.getCaseId())).toString();
|
|
|
|
|
- } else {
|
|
|
|
|
- return null;
|
|
|
|
|
|
|
+ for (int idx = 0 ; idx < workerIds.length; idx ++ ){
|
|
|
|
|
+ AssignedTask assignedTask = assignedTaskDao.findByTaskIdAndWorkerId(taskId, workerIds[idx]);
|
|
|
|
|
+ if (assignedTask == null){
|
|
|
|
|
+ return null;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ JSONObject contentObj = new JSONObject(assignedTask.getContent());
|
|
|
|
|
+ JSONObject casesObj = contentObj.getJSONObject("cases");
|
|
|
|
|
+ if (casesObj.has(String.valueOf(caze.getCaseId()))){
|
|
|
|
|
+ results[idx] = casesObj.get(String.valueOf(caze.getCaseId())).toString();
|
|
|
|
|
+ }
|
|
|
|
|
+ else{
|
|
|
|
|
+ return null;
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ return results;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|
|
|
- public String checkCaseExists(Long workerId, String subsiteCaseId, Long taskId, String host) {
|
|
|
|
|
- AssignedTask assignedTask = assignedTaskDao.findByTaskIdAndWorkerId(taskId, workerId);
|
|
|
|
|
|
|
+ public String checkCaseExists(Long workerId, String subsiteCaseId,
|
|
|
|
|
+ Long taskId, String host) {
|
|
|
|
|
+ Long[] workerIds = {workerId};
|
|
|
|
|
+ return checkCaseExists(workerIds, subsiteCaseId, taskId, host);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public String checkCaseExists(Long[] workerIds, String subsiteCaseId, Long taskId, String host){
|
|
|
Subsite subsite = subsiteDao.findByBaseUrl(host);
|
|
Subsite subsite = subsiteDao.findByBaseUrl(host);
|
|
|
- if (subsite == null) {
|
|
|
|
|
|
|
+ if (subsite == null){
|
|
|
return "No subsite match from host";
|
|
return "No subsite match from host";
|
|
|
}
|
|
}
|
|
|
|
|
+ String result = "";
|
|
|
|
|
+ for (Long workerId : workerIds){
|
|
|
|
|
+ AssignedTask assignedTask = assignedTaskDao.findByTaskIdAndWorkerId(taskId, workerId);
|
|
|
|
|
+ if (assignedTask == null){
|
|
|
|
|
+ result += "AssignedTask not found by task " + taskId + " and worker " + workerId + "; ";
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
- Case caze = caseDao.findBySubsiteIdAndSubsiteCaseId(subsite.getId(), subsiteCaseId);
|
|
|
|
|
|
|
+ Case caze = caseDao.findBySubsiteIdAndSubsiteCaseId(subsite.getId(), subsiteCaseId);
|
|
|
|
|
+ if (caze == null){
|
|
|
|
|
+ result += "Case " + subsiteCaseId + " in subsite " + subsite.getName() + " not found; ";
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
- if (assignedTask == null) {
|
|
|
|
|
- return "AssignedTask not found by task and worker";
|
|
|
|
|
- }
|
|
|
|
|
- if (caze == null) {
|
|
|
|
|
- return "Case not found";
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- return "";
|
|
|
|
|
|
|
+ return result;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|
|
@@ -552,64 +614,82 @@ public class ApiServiceImpl implements ApiService {
|
|
|
return result;
|
|
return result;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- private boolean groupMemberExceeded(Group group) {
|
|
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public Task getTask(Long taskId) {
|
|
|
|
|
+ return taskDao.findOne(taskId);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public String getManagerJson(Task task) {
|
|
|
|
|
+ JSONObject result = new JSONObject();
|
|
|
|
|
+
|
|
|
|
|
+ List<Task2AssistantManager> t2as = task2AssistantManagerDao.findByTaskId(task.getId());
|
|
|
|
|
+ JSONArray assistantManagers = new JSONArray();
|
|
|
|
|
+ for (Task2AssistantManager t2a : t2as){
|
|
|
|
|
+ assistantManagers.put(t2a.getManagerId());
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ result.put("owner_id", task.getManagerId());
|
|
|
|
|
+ result.put("assistant_ids", assistantManagers);
|
|
|
|
|
+
|
|
|
|
|
+ return result.toString();
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ private boolean groupMemberExceeded(Group group){
|
|
|
return (group2WorkerDao.findByGroupId(group.getId()).size() >= managerDao.findOne(group.getManagerId()).getGroupSize());
|
|
return (group2WorkerDao.findByGroupId(group.getId()).size() >= managerDao.findOne(group.getManagerId()).getGroupSize());
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- private boolean privilegeExpired(Manager manager) {
|
|
|
|
|
|
|
+ private boolean privilegeExpired(Manager manager){
|
|
|
Timestamp current = new Timestamp(System.currentTimeMillis());
|
|
Timestamp current = new Timestamp(System.currentTimeMillis());
|
|
|
if (manager.getExpireTime() == null) {
|
|
if (manager.getExpireTime() == null) {
|
|
|
return true;
|
|
return true;
|
|
|
}
|
|
}
|
|
|
return manager.getExpireTime().before(current);
|
|
return manager.getExpireTime().before(current);
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
public boolean assignTaskForNewMember(String workerEmail, String workerMobile, long groupId) {
|
|
public boolean assignTaskForNewMember(String workerEmail, String workerMobile, long groupId) {
|
|
|
- if (!StringUtils.isEmpty(workerEmail)) {
|
|
|
|
|
- return assignTaskForNewMember(workerDao.findByAccount(workerEmail), groupId);
|
|
|
|
|
- } else {
|
|
|
|
|
- return assignTaskForNewMember(workerDao.findByAccount(workerMobile), groupId);
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ Worker worker = workerDao.findByAccount(workerEmail, workerMobile);
|
|
|
|
|
+ return assignTaskForNewMember(worker, groupId);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
public boolean assignTaskForNewMember(long workerId, long groupId) {
|
|
public boolean assignTaskForNewMember(long workerId, long groupId) {
|
|
|
return assignTaskForNewMember(workerDao.findOne(workerId), groupId);
|
|
return assignTaskForNewMember(workerDao.findOne(workerId), groupId);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- private boolean assignTaskForNewMember(Worker worker, long groupId) {
|
|
|
|
|
- if (worker == null) {
|
|
|
|
|
|
|
+ private boolean assignTaskForNewMember(Worker worker, long groupId){
|
|
|
|
|
+ if (worker == null){
|
|
|
return false;
|
|
return false;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
List<Task2Group> taskGroupList = task2GroupDao.findByGroupId(groupId);
|
|
List<Task2Group> taskGroupList = task2GroupDao.findByGroupId(groupId);
|
|
|
- for (Task2Group task2Group : taskGroupList) {
|
|
|
|
|
|
|
+ for (Task2Group task2Group : taskGroupList){
|
|
|
Task task = taskDao.findOne(task2Group.getTaskId());
|
|
Task task = taskDao.findOne(task2Group.getTaskId());
|
|
|
// Check if there are already assigned tasks
|
|
// Check if there are already assigned tasks
|
|
|
AssignedTask existingAssignedTask = assignedTaskDao.findByTaskIdAndWorkerIdIgnoringDeletion(task.getId(), worker.getId());
|
|
AssignedTask existingAssignedTask = assignedTaskDao.findByTaskIdAndWorkerIdIgnoringDeletion(task.getId(), worker.getId());
|
|
|
- if (existingAssignedTask != null) {
|
|
|
|
|
|
|
+ if (existingAssignedTask != null){
|
|
|
existingAssignedTask.setDeleted(false);
|
|
existingAssignedTask.setDeleted(false);
|
|
|
assignedTaskDao.save(existingAssignedTask);
|
|
assignedTaskDao.save(existingAssignedTask);
|
|
|
continue;
|
|
continue;
|
|
|
- } else {
|
|
|
|
|
|
|
+ }
|
|
|
|
|
+ else{
|
|
|
existingAssignedTask = new AssignedTask();
|
|
existingAssignedTask = new AssignedTask();
|
|
|
}
|
|
}
|
|
|
List<Task2Case> task2CaseList = task2CaseDao.findByTaskId(task.getId());
|
|
List<Task2Case> task2CaseList = task2CaseDao.findByTaskId(task.getId());
|
|
|
HashMap<Long, List<Long>> caseGroupMap = new HashMap<Long, List<Long>>();
|
|
HashMap<Long, List<Long>> caseGroupMap = new HashMap<Long, List<Long>>();
|
|
|
HashMap<Long, Double> weightGroupMap = new HashMap<Long, Double>();
|
|
HashMap<Long, Double> weightGroupMap = new HashMap<Long, Double>();
|
|
|
- for (Task2Case task2Case : task2CaseList) {
|
|
|
|
|
|
|
+ for (Task2Case task2Case : task2CaseList){
|
|
|
long caseGroupId = task2Case.getCaseIndex();
|
|
long caseGroupId = task2Case.getCaseIndex();
|
|
|
List<Long> caseList = (caseGroupMap.containsKey(caseGroupId)) ? caseGroupMap.get(caseGroupId) : new ArrayList<Long>();
|
|
List<Long> caseList = (caseGroupMap.containsKey(caseGroupId)) ? caseGroupMap.get(caseGroupId) : new ArrayList<Long>();
|
|
|
caseList.add(task2Case.getCaseId());
|
|
caseList.add(task2Case.getCaseId());
|
|
|
caseGroupMap.put(caseGroupId, caseList);
|
|
caseGroupMap.put(caseGroupId, caseList);
|
|
|
|
|
|
|
|
- if (!weightGroupMap.containsKey(caseGroupId)) {
|
|
|
|
|
|
|
+ if (!weightGroupMap.containsKey(caseGroupId)){
|
|
|
weightGroupMap.put(caseGroupId, task2Case.getWeight());
|
|
weightGroupMap.put(caseGroupId, task2Case.getWeight());
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
// prepare cases content for AssignedTask
|
|
// prepare cases content for AssignedTask
|
|
|
JSONObject assignedTaskObj = new JSONObject(), assignedCasesObj = new JSONObject();
|
|
JSONObject assignedTaskObj = new JSONObject(), assignedCasesObj = new JSONObject();
|
|
|
- for (Long caseGroupId : caseGroupMap.keySet()) {
|
|
|
|
|
|
|
+ for (Long caseGroupId : caseGroupMap.keySet()){
|
|
|
// Add new AssignedTask
|
|
// Add new AssignedTask
|
|
|
List<Long> caseList = caseGroupMap.get(caseGroupId);
|
|
List<Long> caseList = caseGroupMap.get(caseGroupId);
|
|
|
long chosenCaseId = generateCase(caseList);
|
|
long chosenCaseId = generateCase(caseList);
|
|
@@ -654,11 +734,18 @@ public class ApiServiceImpl implements ApiService {
|
|
|
return true;
|
|
return true;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ private static long generateCase(List<Long> caseIdsList) {
|
|
|
|
|
+ int serial = new Double(Math.floor(Math.random() * caseIdsList.size()))
|
|
|
|
|
+ .intValue();
|
|
|
|
|
+ return caseIdsList.get(serial);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
@Override
|
|
@Override
|
|
|
public String getGroupJSON(Long groupId) {
|
|
public String getGroupJSON(Long groupId) {
|
|
|
JSONObject result = new JSONObject();
|
|
JSONObject result = new JSONObject();
|
|
|
Group group = groupDao.findOne(groupId);
|
|
Group group = groupDao.findOne(groupId);
|
|
|
- if (group == null) {
|
|
|
|
|
|
|
+ if (group == null){
|
|
|
return null;
|
|
return null;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -677,7 +764,7 @@ public class ApiServiceImpl implements ApiService {
|
|
|
|
|
|
|
|
List<Group> groups = new ArrayList<Group>();
|
|
List<Group> groups = new ArrayList<Group>();
|
|
|
List<Group2Worker> group2Workers = group2WorkerDao.findByWorkerId(workerId);
|
|
List<Group2Worker> group2Workers = group2WorkerDao.findByWorkerId(workerId);
|
|
|
- for (Group2Worker group2Worker : group2Workers) {
|
|
|
|
|
|
|
+ for (Group2Worker group2Worker : group2Workers){
|
|
|
Group group = groupDao.findOne(group2Worker.getGroupId());
|
|
Group group = groupDao.findOne(group2Worker.getGroupId());
|
|
|
|
|
|
|
|
Manager groupManager = managerDao.findOne(group.getManagerId());
|
|
Manager groupManager = managerDao.findOne(group.getManagerId());
|