|
|
@@ -58,6 +58,8 @@ public class AdminContractApiController extends CertifyApiController {
|
|
|
@Resource
|
|
|
private TechProjectService techProjectService;
|
|
|
|
|
|
+ private static final Integer SECTION_YEAR = 4;
|
|
|
+
|
|
|
/**
|
|
|
* 批量删除合同
|
|
|
*/
|
|
|
@@ -108,7 +110,7 @@ public class AdminContractApiController extends CertifyApiController {
|
|
|
}
|
|
|
|
|
|
if (null != c.getCognizanceYear() && !c.getCognizanceYear().equals(0)) {
|
|
|
- if (!disposeCog(c.getCognizanceYear(), c.getUid(), res).getError().isEmpty()) {
|
|
|
+ if (!disposeCog(c.getId(), c.getCognizanceYear(), c.getUid(), res).getError().isEmpty()) {
|
|
|
return res;
|
|
|
}
|
|
|
}
|
|
|
@@ -303,8 +305,8 @@ public class AdminContractApiController extends CertifyApiController {
|
|
|
res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "找不到用户", "用户"));
|
|
|
return res;
|
|
|
}
|
|
|
-
|
|
|
- if (null == contract.getType()){
|
|
|
+
|
|
|
+ if (null == contract.getType()) {
|
|
|
res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "", "合同类型"));
|
|
|
return res;
|
|
|
}
|
|
|
@@ -315,7 +317,7 @@ public class AdminContractApiController extends CertifyApiController {
|
|
|
}
|
|
|
|
|
|
if (null != contract.getCognizanceYear() && !contract.getCognizanceYear().equals(0)) {
|
|
|
- if (!disposeCog(contract.getCognizanceYear(), contract.getUid(), res).getError().isEmpty()) {
|
|
|
+ if (!disposeCog(contract.getId(), contract.getCognizanceYear(), contract.getUid(), res).getError().isEmpty()) {
|
|
|
return res;
|
|
|
}
|
|
|
}
|
|
|
@@ -356,8 +358,8 @@ public class AdminContractApiController extends CertifyApiController {
|
|
|
res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "找不到用户", "用户"));
|
|
|
return res;
|
|
|
}
|
|
|
-
|
|
|
- if (null == ic.getType()){
|
|
|
+
|
|
|
+ if (null == ic.getType()) {
|
|
|
res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "", "合同类型"));
|
|
|
return res;
|
|
|
}
|
|
|
@@ -368,7 +370,7 @@ public class AdminContractApiController extends CertifyApiController {
|
|
|
}
|
|
|
|
|
|
if (null != ic.getCognizanceYear() && !ic.getCognizanceYear().equals(0)) {
|
|
|
- if (!disposeCog(ic.getCognizanceYear(), ic.getUid(), res).getError().isEmpty()) {
|
|
|
+ if (!disposeCog(ic.getId(), ic.getCognizanceYear(), ic.getUid(), res).getError().isEmpty()) {
|
|
|
return res;
|
|
|
}
|
|
|
}
|
|
|
@@ -468,17 +470,32 @@ public class AdminContractApiController extends CertifyApiController {
|
|
|
return res;
|
|
|
}
|
|
|
|
|
|
- private Result disposeCog(Integer year, String uid, Result res) {
|
|
|
+ private Result disposeCog(String id, Integer year, String uid, Result res) {
|
|
|
Integer latelyYear = orgCognizanceService.selectLatelyRecordYear(uid);
|
|
|
- if (null != latelyYear && year - latelyYear < 4) {
|
|
|
+ if (null != latelyYear && year - latelyYear < SECTION_YEAR) {
|
|
|
res.getError()
|
|
|
- .add(buildError(ErrorConstants.STATUS_ERROR, "高企认定申请中或认定未到期!无法提交新申请!", "高企认定申请中或认定未到期!无法提交新申请!"));
|
|
|
+ .add(buildError(ErrorConstants.STATUS_ERROR, "高企认定申请中或认定未到期!无法提交新申请!", "高企认定申请中或认定未到期!无法提交新申请!"));
|
|
|
return res;
|
|
|
}
|
|
|
- Contract c = contractService.findByUidAndYear(uid, year);
|
|
|
+
|
|
|
+ Contract c = contractService.findLatelyRecordByUid(uid);
|
|
|
+ boolean flag = Boolean.TRUE;
|
|
|
if (null != c) {
|
|
|
- res.getError().add(buildError("", "当前年份已有合同申请,无法提交新申请!"));
|
|
|
+ if (StringUtils.isNotBlank(id)) {
|
|
|
+ if (null != c.getCognizanceYear() && year - c.getCognizanceYear() < SECTION_YEAR
|
|
|
+ && !id.equals(c.getId())) {
|
|
|
+ flag = false;
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ if (null != c.getCognizanceYear() && year - c.getCognizanceYear() < SECTION_YEAR) {
|
|
|
+ flag = false;
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
+ if (!flag) {
|
|
|
+ res.getError().add(buildError(ErrorConstants.CONTRACT_YEAR_SECTION));
|
|
|
+ }
|
|
|
+
|
|
|
return res;
|
|
|
}
|
|
|
|