|
@@ -33,7 +33,7 @@ import org.springframework.data.domain.Pageable;
|
|
|
import org.springframework.stereotype.Component;
|
|
|
import org.springframework.web.client.RestTemplate;
|
|
|
|
|
|
-import java.io.UnsupportedEncodingException;
|
|
|
+import java.text.SimpleDateFormat;
|
|
|
import java.util.*;
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
@@ -1134,10 +1134,15 @@ public class WebMediatorImpl implements ViewMediator {
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public QualificationDTO addQualification(long userId, QualificationVO qualificationVO) throws UnsupportedEncodingException {
|
|
|
- if (qualificationVO.getNumber().getBytes("UTF-8").length != qualificationVO.getNumber().length()) {
|
|
|
+ public QualificationDTO addQualification(long userId, QualificationVO qualificationVO){
|
|
|
+ String regex = "^[a-z0-9A-Z]+$";
|
|
|
+ if (!qualificationVO.getNumber().matches(regex)) {
|
|
|
throw new HttpBadRequestException("请输入正确的证书编号");
|
|
|
}
|
|
|
+ Date now = new Date();
|
|
|
+ if(qualificationVO.getTime().after(now)){
|
|
|
+ throw new HttpBadRequestException("请输入正确的发证时间");
|
|
|
+ }
|
|
|
QualificationPO qualificationPO = new QualificationPO();
|
|
|
List<QualificationPO> qualificationPOList = qualificationDao.findByUserIdAndIsDeleted(userId, DeletedStatus.isNotDeleted);
|
|
|
for (int i = 0; i < qualificationPOList.size(); i++) {
|
|
@@ -1446,9 +1451,13 @@ public class WebMediatorImpl implements ViewMediator {
|
|
|
|
|
|
private TaskOperationControl initTaskPermission(CrowdTestProject project, CrowdTestTask task, User user) {
|
|
|
TaskOperationControl taskOperationControl = new TaskOperationControl();
|
|
|
- if (user == null)
|
|
|
+
|
|
|
+ if (user == null || task.getStatus() == CrowdTestTaskStatus.HAS_FINISHED || task.getStatus() == CrowdTestTaskStatus.HAS_TIME_OUT) {
|
|
|
return taskOperationControl;
|
|
|
- if (task.getStatus() == CrowdTestTaskStatus.HAS_TIME_OUT) {
|
|
|
+ }
|
|
|
+
|
|
|
+ //发包机构和发包人员视角
|
|
|
+ if (user.getRoleList().stream().anyMatch(role -> role.getName().equals(RoleType.PARTY_AGENCY.getName()) || role.getName().equals(RoleType.PARTY_USER.getName())) && task.getStatus() != CrowdTestTaskStatus.HAS_REJECTED) {
|
|
|
return taskOperationControl;
|
|
|
}
|
|
|
|
|
@@ -1466,8 +1475,8 @@ public class WebMediatorImpl implements ViewMediator {
|
|
|
taskOperationControl.setConfirmFinish(false);
|
|
|
}
|
|
|
}
|
|
|
- //评测机构视角
|
|
|
- if (user.getRoleList().stream().anyMatch(role -> role.getName().equals("evaluationAgency")) && task.getStatus() != CrowdTestTaskStatus.HAS_REJECTED) {
|
|
|
+ //评测机构和测评人员视角 //??? 已拒绝视图
|
|
|
+ else if (user.getRoleList().stream().anyMatch(role -> role.getName().equals("evaluationAgency") || role.getName().equals(RoleType.EVALUATION_USER.getName())) && task.getStatus() != CrowdTestTaskStatus.HAS_REJECTED) {
|
|
|
if ((task.getDistributionType() == 0 && task.getEvaluationAgencyId().equals(user.getId()))
|
|
|
|| (task.getDistributionType() == 2 && task.getStatus() >= CrowdTestTaskStatus.HAS_RECEIVED)) {
|
|
|
List<TaskToUser> acceptedUserList = task.getAcceptedUserList();
|
|
@@ -1511,9 +1520,7 @@ public class WebMediatorImpl implements ViewMediator {
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- if (task.getStatus() == CrowdTestTaskStatus.HAS_FINISHED || task.getStatus() == CrowdTestTaskStatus.HAS_TIME_OUT) {
|
|
|
- taskOperationControl.noAll();
|
|
|
- }
|
|
|
+
|
|
|
System.out.println(taskOperationControl);
|
|
|
return taskOperationControl;
|
|
|
}
|