|
@@ -1,10 +1,13 @@
|
|
package cn.iselab.mooctest.site.service.application.impl;
|
|
package cn.iselab.mooctest.site.service.application.impl;
|
|
|
|
|
|
import cn.iselab.mooctest.site.dao.*;
|
|
import cn.iselab.mooctest.site.dao.*;
|
|
|
|
+import cn.iselab.mooctest.site.data.UserDTOForMT;
|
|
import cn.iselab.mooctest.site.models.*;
|
|
import cn.iselab.mooctest.site.models.*;
|
|
import cn.iselab.mooctest.site.service.ExamService;
|
|
import cn.iselab.mooctest.site.service.ExamService;
|
|
import cn.iselab.mooctest.site.service.User2RoleService;
|
|
import cn.iselab.mooctest.site.service.User2RoleService;
|
|
|
|
+import cn.iselab.mooctest.site.service.UserService;
|
|
import cn.iselab.mooctest.site.service.application.WechatService;
|
|
import cn.iselab.mooctest.site.service.application.WechatService;
|
|
|
|
+import cn.iselab.mooctest.site.util.data.Converter;
|
|
import cn.iselab.mooctest.site.util.data.EncryptionUtil;
|
|
import cn.iselab.mooctest.site.util.data.EncryptionUtil;
|
|
import org.json.JSONArray;
|
|
import org.json.JSONArray;
|
|
import org.json.JSONObject;
|
|
import org.json.JSONObject;
|
|
@@ -30,7 +33,7 @@ public class WechatServiceImpl implements WechatService {
|
|
private GroupDao groupDao;
|
|
private GroupDao groupDao;
|
|
|
|
|
|
@Autowired
|
|
@Autowired
|
|
- private UserDao userDao;
|
|
|
|
|
|
+ private UserService userService;
|
|
|
|
|
|
@Autowired
|
|
@Autowired
|
|
private User2RoleService user2RoleService;
|
|
private User2RoleService user2RoleService;
|
|
@@ -51,11 +54,10 @@ public class WechatServiceImpl implements WechatService {
|
|
public String checkAccount(String account, String password) throws Exception {
|
|
public String checkAccount(String account, String password) throws Exception {
|
|
JSONObject result = new JSONObject();
|
|
JSONObject result = new JSONObject();
|
|
String encryptedPassword = EncryptionUtil.encryptMD5(password);
|
|
String encryptedPassword = EncryptionUtil.encryptMD5(password);
|
|
- User user=checkUser(account);
|
|
|
|
- if (user == null || (!user.getPassword().equals(encryptedPassword))){
|
|
|
|
|
|
+ User user = checkUser(account);
|
|
|
|
+ if (user == null || (!user.getPassword().equals(encryptedPassword))) {
|
|
result.put("success", false);
|
|
result.put("success", false);
|
|
- }
|
|
|
|
- else{
|
|
|
|
|
|
+ } else {
|
|
result.put("success", true);
|
|
result.put("success", true);
|
|
}
|
|
}
|
|
|
|
|
|
@@ -65,15 +67,15 @@ public class WechatServiceImpl implements WechatService {
|
|
@Override
|
|
@Override
|
|
public String getTaskInfo(String account) {
|
|
public String getTaskInfo(String account) {
|
|
JSONArray result = new JSONArray();
|
|
JSONArray result = new JSONArray();
|
|
- User user=checkUser(account);
|
|
|
|
- if (user == null){
|
|
|
|
|
|
+ User user = checkUser(account);
|
|
|
|
+ if (user == null) {
|
|
return null;
|
|
return null;
|
|
}
|
|
}
|
|
List<ParticipantExam> participantExams = participantExamDao.findByParticipantId(user.getId());
|
|
List<ParticipantExam> participantExams = participantExamDao.findByParticipantId(user.getId());
|
|
- for(ParticipantExam participantExam : participantExams){
|
|
|
|
|
|
+ for (ParticipantExam participantExam : participantExams) {
|
|
Exam exam = examService.getExamByName(participantExam.getName());
|
|
Exam exam = examService.getExamByName(participantExam.getName());
|
|
Timestamp currentTimestamp = new Timestamp(System.currentTimeMillis());
|
|
Timestamp currentTimestamp = new Timestamp(System.currentTimeMillis());
|
|
- if (exam.getEndTime().after(currentTimestamp)){
|
|
|
|
|
|
+ if (exam.getEndTime().after(currentTimestamp)) {
|
|
JSONObject taskObj = new JSONObject();
|
|
JSONObject taskObj = new JSONObject();
|
|
taskObj.put("id", exam.getId());
|
|
taskObj.put("id", exam.getId());
|
|
taskObj.put("taskName", exam.getName());
|
|
taskObj.put("taskName", exam.getName());
|
|
@@ -94,15 +96,15 @@ public class WechatServiceImpl implements WechatService {
|
|
@Override
|
|
@Override
|
|
public String getFinishedTaskInfo(String account) {
|
|
public String getFinishedTaskInfo(String account) {
|
|
JSONArray result = new JSONArray();
|
|
JSONArray result = new JSONArray();
|
|
- User user=checkUser(account);
|
|
|
|
- if (user == null){
|
|
|
|
|
|
+ User user = checkUser(account);
|
|
|
|
+ if (user == null) {
|
|
return null;
|
|
return null;
|
|
}
|
|
}
|
|
List<SubmitRecord> submitRecordList = submitRecordDao.findByParticipantId(user.getId());
|
|
List<SubmitRecord> submitRecordList = submitRecordDao.findByParticipantId(user.getId());
|
|
- for (SubmitRecord submitRecord : submitRecordList){
|
|
|
|
|
|
+ for (SubmitRecord submitRecord : submitRecordList) {
|
|
Exam exam = examDao.findOne(submitRecord.getExamId());
|
|
Exam exam = examDao.findOne(submitRecord.getExamId());
|
|
Timestamp currentTimestamp = new Timestamp(System.currentTimeMillis());
|
|
Timestamp currentTimestamp = new Timestamp(System.currentTimeMillis());
|
|
- if (exam.getEndTime().before(currentTimestamp)){
|
|
|
|
|
|
+ if (exam.getEndTime().before(currentTimestamp)) {
|
|
JSONObject taskObj = new JSONObject();
|
|
JSONObject taskObj = new JSONObject();
|
|
taskObj.put("id", exam.getId());
|
|
taskObj.put("id", exam.getId());
|
|
taskObj.put("taskName", exam.getName());
|
|
taskObj.put("taskName", exam.getName());
|
|
@@ -115,48 +117,50 @@ public class WechatServiceImpl implements WechatService {
|
|
|
|
|
|
@Override
|
|
@Override
|
|
public String getGroupList(String account) {
|
|
public String getGroupList(String account) {
|
|
- JSONArray result = new JSONArray();
|
|
|
|
|
|
+ JSONArray result = new JSONArray();
|
|
|
|
|
|
- User user=checkUser(account);
|
|
|
|
- if (user == null){
|
|
|
|
|
|
+ User user = checkUser(account);
|
|
|
|
+ if (user == null) {
|
|
return null;
|
|
return null;
|
|
}
|
|
}
|
|
List<Group2Worker> group2Workers = group2WorkerDao.findByParticipantId(user.getId());
|
|
List<Group2Worker> group2Workers = group2WorkerDao.findByParticipantId(user.getId());
|
|
|
|
|
|
- for (Group2Worker group2Worker : group2Workers){
|
|
|
|
|
|
+ for (Group2Worker group2Worker : group2Workers) {
|
|
Group group = groupDao.findOne(group2Worker.getGroupId());
|
|
Group group = groupDao.findOne(group2Worker.getGroupId());
|
|
|
|
|
|
JSONObject groupObj = new JSONObject();
|
|
JSONObject groupObj = new JSONObject();
|
|
groupObj.put("id", group.getId());
|
|
groupObj.put("id", group.getId());
|
|
groupObj.put("groupName", group.getName());
|
|
groupObj.put("groupName", group.getName());
|
|
- User user1 = userDao.findOne(group.getOwnerId());
|
|
|
|
- groupObj.put("managerName", user1.getName());
|
|
|
|
|
|
+ UserDTOForMT userDTOForMT = userService.findByUserId(group.getOwnerId());
|
|
|
|
+ if (userDTOForMT==null){
|
|
|
|
+ continue;
|
|
|
|
+ }
|
|
|
|
+ groupObj.put("managerName", userDTOForMT.getName());
|
|
|
|
|
|
result.put(groupObj);
|
|
result.put(groupObj);
|
|
}
|
|
}
|
|
|
|
|
|
- return result.toString();
|
|
|
|
|
|
+ return result.toString();
|
|
}
|
|
}
|
|
|
|
|
|
@Override
|
|
@Override
|
|
public String joinGroup(String account, Long groupId, String managerName) {
|
|
public String joinGroup(String account, Long groupId, String managerName) {
|
|
JSONObject result = new JSONObject();
|
|
JSONObject result = new JSONObject();
|
|
- User user=checkUser(account);
|
|
|
|
- Group group = groupDao.findOne(groupId);
|
|
|
|
- if (user == null || group == null){
|
|
|
|
|
|
+ User user = checkUser(account);
|
|
|
|
+ Group group = groupDao.findOne(groupId);
|
|
|
|
+ if (user == null || group == null) {
|
|
result.put("success", false);
|
|
result.put("success", false);
|
|
result.put("message", "group or worker not found");
|
|
result.put("message", "group or worker not found");
|
|
}
|
|
}
|
|
else{
|
|
else{
|
|
- User user2= userDao.findOne(group.getOwnerId());
|
|
|
|
|
|
+ UserDTOForMT user2= userService.findByUserId(group.getOwnerId());
|
|
if (!user2.getName().equals(managerName)){
|
|
if (!user2.getName().equals(managerName)){
|
|
result.put("success", false);
|
|
result.put("success", false);
|
|
result.put("message", "manager name mismatch");
|
|
result.put("message", "manager name mismatch");
|
|
- }
|
|
|
|
- else{
|
|
|
|
|
|
+ } else {
|
|
// Join group
|
|
// Join group
|
|
Group2Worker group2Worker = new Group2Worker();
|
|
Group2Worker group2Worker = new Group2Worker();
|
|
- if (group2WorkerDao.findByParticipantIdAndGroupId(user.getId(), group.getId()) != null){
|
|
|
|
|
|
+ if (group2WorkerDao.findByParticipantIdAndGroupId(user.getId(), group.getId()) != null) {
|
|
result.put("success", false);
|
|
result.put("success", false);
|
|
result.put("message", "worker already in group");
|
|
result.put("message", "worker already in group");
|
|
}
|
|
}
|
|
@@ -175,22 +179,22 @@ public class WechatServiceImpl implements WechatService {
|
|
@Override
|
|
@Override
|
|
public String getGroupsByManager(long managerId) {
|
|
public String getGroupsByManager(long managerId) {
|
|
JSONObject result = new JSONObject();
|
|
JSONObject result = new JSONObject();
|
|
- User user=userDao.findById(managerId);
|
|
|
|
|
|
+ UserDTOForMT user=userService.findByUserId(managerId);
|
|
if (user == null){
|
|
if (user == null){
|
|
return null;
|
|
return null;
|
|
- }else {
|
|
|
|
- boolean isManager=false;
|
|
|
|
- List<User2Role> user2Roles=user2RoleService.getByUserId(user.getId());
|
|
|
|
- for(User2Role user2Role:user2Roles){
|
|
|
|
- if(user2Role.getRoleId()==2) {
|
|
|
|
|
|
+ } else {
|
|
|
|
+ boolean isManager = false;
|
|
|
|
+ List<User2Role> user2Roles = user2RoleService.getByUserId(user.getId());
|
|
|
|
+ for (User2Role user2Role : user2Roles) {
|
|
|
|
+ if (user2Role.getRoleId() == 2) {
|
|
isManager = true;
|
|
isManager = true;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- if(!isManager) {
|
|
|
|
|
|
+ if (!isManager) {
|
|
result.put("message", "manager not found");
|
|
result.put("message", "manager not found");
|
|
} else {
|
|
} else {
|
|
JSONArray groupArr = new JSONArray();
|
|
JSONArray groupArr = new JSONArray();
|
|
- List<Group> groups = groupDao.findByOwnerIdAndIsActive(user.getId(),true);
|
|
|
|
|
|
+ List<Group> groups = groupDao.findByOwnerIdAndIsActiveAndIsDeleted(user.getId(), true, false);
|
|
for (Group group : groups) {
|
|
for (Group group : groups) {
|
|
JSONObject groupObj = new JSONObject();
|
|
JSONObject groupObj = new JSONObject();
|
|
groupObj.put("id", group.getId());
|
|
groupObj.put("id", group.getId());
|
|
@@ -209,10 +213,10 @@ public class WechatServiceImpl implements WechatService {
|
|
public String getUserInfoWechat(long userId) {
|
|
public String getUserInfoWechat(long userId) {
|
|
JSONObject resultObj = new JSONObject();
|
|
JSONObject resultObj = new JSONObject();
|
|
|
|
|
|
- User user=userDao.findById(userId);
|
|
|
|
|
|
+ UserDTOForMT user=userService.findByUserId(userId);
|
|
if(user==null){
|
|
if(user==null){
|
|
resultObj.put("message", "user not found");
|
|
resultObj.put("message", "user not found");
|
|
- }else {
|
|
|
|
|
|
+ } else {
|
|
resultObj.put("email", user.getEmail());
|
|
resultObj.put("email", user.getEmail());
|
|
resultObj.put("mobile", user.getMobile());
|
|
resultObj.put("mobile", user.getMobile());
|
|
resultObj.put("name", user.getName());
|
|
resultObj.put("name", user.getName());
|
|
@@ -226,7 +230,7 @@ public class WechatServiceImpl implements WechatService {
|
|
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;
|
|
}
|
|
}
|
|
|
|
|
|
@@ -234,7 +238,10 @@ public class WechatServiceImpl implements WechatService {
|
|
List<Group2Worker> group2Workers = group2WorkerDao.findByGroupId(groupId);
|
|
List<Group2Worker> group2Workers = group2WorkerDao.findByGroupId(groupId);
|
|
for (Group2Worker group2Worker : group2Workers){
|
|
for (Group2Worker group2Worker : group2Workers){
|
|
if(group2Worker.getParticipantId()!=null) {
|
|
if(group2Worker.getParticipantId()!=null) {
|
|
- User user = userDao.findOne(group2Worker.getParticipantId());
|
|
|
|
|
|
+ UserDTOForMT user = userService.findByUserId(group2Worker.getParticipantId());
|
|
|
|
+ if (user==null){
|
|
|
|
+ continue;
|
|
|
|
+ }
|
|
JSONObject workerObj = new JSONObject();
|
|
JSONObject workerObj = new JSONObject();
|
|
workerObj.put("id", user.getId());
|
|
workerObj.put("id", user.getId());
|
|
workerObj.put("email", user.getEmail());
|
|
workerObj.put("email", user.getEmail());
|
|
@@ -246,24 +253,23 @@ public class WechatServiceImpl implements WechatService {
|
|
}
|
|
}
|
|
|
|
|
|
result.put("workers", workerArr);
|
|
result.put("workers", workerArr);
|
|
- return result.toString();
|
|
|
|
|
|
+ return result.toString();
|
|
}
|
|
}
|
|
|
|
|
|
@Override
|
|
@Override
|
|
public String checkManager(String account, String password) {
|
|
public String checkManager(String account, String password) {
|
|
JSONObject resultObj = new JSONObject();
|
|
JSONObject resultObj = new JSONObject();
|
|
- User user=checkUser(account);
|
|
|
|
|
|
+ User user = checkUser(account);
|
|
if (user == null) {
|
|
if (user == null) {
|
|
resultObj.put("message", "manager not found");
|
|
resultObj.put("message", "manager not found");
|
|
- }
|
|
|
|
- else {
|
|
|
|
- boolean isManager=false;
|
|
|
|
- List<User2Role> user2Roles=user2RoleService.getByUserId(user.getId());
|
|
|
|
- for(User2Role user2Role:user2Roles){
|
|
|
|
- if(user2Role.getRoleId()==2)
|
|
|
|
- isManager=true;
|
|
|
|
|
|
+ } else {
|
|
|
|
+ boolean isManager = false;
|
|
|
|
+ List<User2Role> user2Roles = user2RoleService.getByUserId(user.getId());
|
|
|
|
+ for (User2Role user2Role : user2Roles) {
|
|
|
|
+ if (user2Role.getRoleId() == 2)
|
|
|
|
+ isManager = true;
|
|
}
|
|
}
|
|
- if(!isManager)
|
|
|
|
|
|
+ if (!isManager)
|
|
resultObj.put("message", "manager not found");
|
|
resultObj.put("message", "manager not found");
|
|
else {
|
|
else {
|
|
String encryptedPassword = EncryptionUtil.encryptMD5(password);
|
|
String encryptedPassword = EncryptionUtil.encryptMD5(password);
|
|
@@ -282,10 +288,9 @@ public class WechatServiceImpl implements WechatService {
|
|
public String checkWorker(String account, String password) {
|
|
public String checkWorker(String account, String password) {
|
|
JSONObject resultObj = new JSONObject();
|
|
JSONObject resultObj = new JSONObject();
|
|
User user = checkUser(account);
|
|
User user = checkUser(account);
|
|
- if (user == null){
|
|
|
|
|
|
+ if (user == null) {
|
|
resultObj.put("message", "worker not found");
|
|
resultObj.put("message", "worker not found");
|
|
- }
|
|
|
|
- else {
|
|
|
|
|
|
+ } else {
|
|
String encryptedPassword = EncryptionUtil.encryptMD5(password);
|
|
String encryptedPassword = EncryptionUtil.encryptMD5(password);
|
|
if (user.getPassword().equals(encryptedPassword)) {
|
|
if (user.getPassword().equals(encryptedPassword)) {
|
|
resultObj.put("id", user.getId());
|
|
resultObj.put("id", user.getId());
|
|
@@ -300,18 +305,17 @@ public class WechatServiceImpl implements WechatService {
|
|
@Override
|
|
@Override
|
|
public String getManagerTask(long userId) {
|
|
public String getManagerTask(long userId) {
|
|
JSONObject resultObj = new JSONObject();
|
|
JSONObject resultObj = new JSONObject();
|
|
- User user = userDao.findById(userId);
|
|
|
|
|
|
+ UserDTOForMT user = userService.findByUserId(userId);
|
|
if (user == null){
|
|
if (user == null){
|
|
resultObj.put("message", "manager not found");
|
|
resultObj.put("message", "manager not found");
|
|
- }
|
|
|
|
- else {
|
|
|
|
- boolean isManager=false;
|
|
|
|
- List<User2Role> user2Roles=user2RoleService.getByUserId(user.getId());
|
|
|
|
- for(User2Role user2Role:user2Roles){
|
|
|
|
- if(user2Role.getRoleId()==2)
|
|
|
|
- isManager=true;
|
|
|
|
|
|
+ } else {
|
|
|
|
+ boolean isManager = false;
|
|
|
|
+ List<User2Role> user2Roles = user2RoleService.getByUserId(user.getId());
|
|
|
|
+ for (User2Role user2Role : user2Roles) {
|
|
|
|
+ if (user2Role.getRoleId() == 2)
|
|
|
|
+ isManager = true;
|
|
}
|
|
}
|
|
- if(!isManager)
|
|
|
|
|
|
+ if (!isManager)
|
|
resultObj.put("message", "manager not found");
|
|
resultObj.put("message", "manager not found");
|
|
else {
|
|
else {
|
|
JSONArray taskArr = new JSONArray();
|
|
JSONArray taskArr = new JSONArray();
|
|
@@ -346,17 +350,16 @@ public class WechatServiceImpl implements WechatService {
|
|
public String getWorkersPassword(long taskId) {
|
|
public String getWorkersPassword(long taskId) {
|
|
JSONObject resultObj = new JSONObject();
|
|
JSONObject resultObj = new JSONObject();
|
|
Exam exam = examDao.findOne(taskId);
|
|
Exam exam = examDao.findOne(taskId);
|
|
- if (exam == null){
|
|
|
|
|
|
+ if (exam == null) {
|
|
resultObj.put("message", "exam not found");
|
|
resultObj.put("message", "exam not found");
|
|
- }
|
|
|
|
- else {
|
|
|
|
|
|
+ } else {
|
|
JSONArray passwordArr = new JSONArray();
|
|
JSONArray passwordArr = new JSONArray();
|
|
List<Exam2Group> exam2Groups = exam2GroupDao.findByExamId(taskId);
|
|
List<Exam2Group> exam2Groups = exam2GroupDao.findByExamId(taskId);
|
|
- List<Group2Worker> workers=group2WorkerDao.findByGroupId(exam2Groups.get(0).getGroupId());
|
|
|
|
- for (Group2Worker group2Worker:workers){
|
|
|
|
|
|
+ List<Group2Worker> workers = group2WorkerDao.findByGroupId(exam2Groups.get(0).getGroupId());
|
|
|
|
+ for (Group2Worker group2Worker : workers) {
|
|
JSONObject passwordObj = new JSONObject();
|
|
JSONObject passwordObj = new JSONObject();
|
|
if(group2Worker.getParticipantId()!=null) {
|
|
if(group2Worker.getParticipantId()!=null) {
|
|
- User user = userDao.findOne(group2Worker.getParticipantId());
|
|
|
|
|
|
+ UserDTOForMT user = userService.findByUserId(group2Worker.getParticipantId());
|
|
passwordObj.put("workerId", user.getId());
|
|
passwordObj.put("workerId", user.getId());
|
|
passwordObj.put("workerName", user.getName());
|
|
passwordObj.put("workerName", user.getName());
|
|
try {
|
|
try {
|
|
@@ -378,16 +381,15 @@ public class WechatServiceImpl implements WechatService {
|
|
public String getWorkersGrade(long taskId) {
|
|
public String getWorkersGrade(long taskId) {
|
|
JSONObject resultObj = new JSONObject();
|
|
JSONObject resultObj = new JSONObject();
|
|
Exam exam = examDao.findOne(taskId);
|
|
Exam exam = examDao.findOne(taskId);
|
|
- if (exam == null){
|
|
|
|
|
|
+ if (exam == null) {
|
|
resultObj.put("message", "exam not found");
|
|
resultObj.put("message", "exam not found");
|
|
- }
|
|
|
|
- else {
|
|
|
|
|
|
+ } else {
|
|
JSONArray gradeArr = new JSONArray();
|
|
JSONArray gradeArr = new JSONArray();
|
|
List<SubmitRecord> submitRecords = submitRecordDao.findByExamId(taskId);
|
|
List<SubmitRecord> submitRecords = submitRecordDao.findByExamId(taskId);
|
|
- for (SubmitRecord submitRecord : submitRecords){
|
|
|
|
|
|
+ for (SubmitRecord submitRecord : submitRecords) {
|
|
JSONObject gradeObj = new JSONObject();
|
|
JSONObject gradeObj = new JSONObject();
|
|
if(submitRecord.getParticipantId()!=null) {
|
|
if(submitRecord.getParticipantId()!=null) {
|
|
- User user = userDao.findOne(submitRecord.getParticipantId());
|
|
|
|
|
|
+ UserDTOForMT user = userService.findByUserId(submitRecord.getParticipantId());
|
|
if (user != null) {
|
|
if (user != null) {
|
|
gradeObj.put("workerId", user.getId());
|
|
gradeObj.put("workerId", user.getId());
|
|
gradeObj.put("workerName", user.getName());
|
|
gradeObj.put("workerName", user.getName());
|
|
@@ -401,49 +403,33 @@ public class WechatServiceImpl implements WechatService {
|
|
|
|
|
|
return resultObj.toString();
|
|
return resultObj.toString();
|
|
}
|
|
}
|
|
-
|
|
|
|
- public String getContests(long userId){
|
|
|
|
- JSONObject resultObj=new JSONObject();
|
|
|
|
- List<SubmitRecord> tasks= submitRecordDao.findByParticipantId(userId);
|
|
|
|
- if (tasks == null || tasks.isEmpty()){
|
|
|
|
- resultObj.put("message", "task not found");
|
|
|
|
- return resultObj.toString();
|
|
|
|
- }else {
|
|
|
|
- JSONArray jsonArray=new JSONArray();
|
|
|
|
- tasks.forEach(task-> {
|
|
|
|
- JSONObject object=new JSONObject();
|
|
|
|
- object.put("id",task.getExamId());
|
|
|
|
- object.put("name",task.getName());
|
|
|
|
- jsonArray.put(object);
|
|
|
|
- });
|
|
|
|
- return jsonArray.toString();
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
public int getContestParticipant(String taskName){
|
|
public int getContestParticipant(String taskName){
|
|
if(taskName.indexOf("开发者")!=-1) {
|
|
if(taskName.indexOf("开发者")!=-1) {
|
|
- return 4897;
|
|
|
|
|
|
+ if (taskName.indexOf("团队")>-1){
|
|
|
|
+ return 273;
|
|
|
|
+ }
|
|
|
|
+ return 1394;
|
|
}else if(taskName.indexOf("移动应用")!=-1){
|
|
}else if(taskName.indexOf("移动应用")!=-1){
|
|
if(taskName.indexOf("个人")!=-1)
|
|
if(taskName.indexOf("个人")!=-1)
|
|
- return 2925;
|
|
|
|
|
|
+ return 1054;
|
|
else
|
|
else
|
|
- return 1269;
|
|
|
|
|
|
+ return 338;
|
|
}else if(taskName.indexOf("Web")!=-1){
|
|
}else if(taskName.indexOf("Web")!=-1){
|
|
- if(taskName.indexOf("应用")!=-1)
|
|
|
|
- return 1653;
|
|
|
|
|
|
+ if(taskName.indexOf("团队")!=-1)
|
|
|
|
+ return 607;
|
|
else
|
|
else
|
|
- return 3148;
|
|
|
|
|
|
+ return 587;
|
|
}else if(taskName.indexOf("嵌入式")!=-1){
|
|
}else if(taskName.indexOf("嵌入式")!=-1){
|
|
- return 1838;
|
|
|
|
|
|
+ return 319;
|
|
}else
|
|
}else
|
|
return 0;
|
|
return 0;
|
|
}
|
|
}
|
|
|
|
|
|
private User checkUser(String account){
|
|
private User checkUser(String account){
|
|
- User user=userDao.findByEmail(account);
|
|
|
|
|
|
+ UserDTOForMT user=userService.findByEmail(account);
|
|
if(user==null){
|
|
if(user==null){
|
|
- user=userDao.findByMobile(account);
|
|
|
|
|
|
+ user=userService.findByMobile(account);
|
|
}
|
|
}
|
|
- return user;
|
|
|
|
|
|
+ return user!=null? Converter.convert(User.class,user):null;
|
|
}
|
|
}
|
|
}
|
|
}
|