Commit b74285b7 authored by 刘林's avatar 刘林

fix(jg):超设计使用年限bug修改

parent 9e9766f2
......@@ -106,6 +106,7 @@ import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.*;
......@@ -1246,12 +1247,12 @@ public class CommonServiceImpl implements ICommonService {
Map<String, Object> noticeObj = (Map<String, Object>) map.get(notice);
Map<String, Object> techInfoObj = (Map<String, Object>) map.get(techInfo);
Map<String, Object> useRegFormUploadObj = (Map<String, Object>) map.get(useRegFormUpload);
String uploadMode = String.valueOf(useRegFormUploadObj.get("uploadMode"));
Map<String, Object> provideMap = new HashMap<>();
String type = (String) basicObj.get("type");
noticeObj.put("businessCode", type);
if (type.equals(ApplicationFormTypeEnum.AZGZ.getBusinessCode())) {
JgInstallationNoticeDto jgInstallationNoticeDto = JSON.parseObject(JSON.toJSONString(noticeObj), JgInstallationNoticeDto.class);
jgInstallationNoticeDto.setReceiveOrgCreditCode(!ObjectUtils.isEmpty(basicObj.get("receiveOrgCreditCode")) ? String.valueOf(basicObj.get("receiveOrgCreditCode")) : String.valueOf(basicObj.get("receiveOrgCreditCode1")));
JSONObject jsonObject1 = (JSONObject) JSONObject.toJSON(jgInstallationNoticeDto);
......@@ -1347,7 +1348,9 @@ public class CommonServiceImpl implements ICommonService {
JSONObject jsonObject = new JSONObject(noticeObj);
return jgEnableDisableServiceImpl.saveOrUpdate(jsonObject, reginParams);
} else if (type.equals(ApplicationFormTypeEnum.CSJ.getBusinessCode())) {
noticeObj.put("submit", submitType);
if ("1".equals(uploadMode)) {
noticeObj.put("submit", Boolean.TRUE);
}
noticeObj.put("formType", "add");
noticeObj.put("receiveOrgCode", !ObjectUtils.isEmpty(basicObj.get("receiveOrgCreditCode")) ? String.valueOf(basicObj.get("receiveOrgCreditCode")) : String.valueOf(basicObj.get("receiveOrgCreditCode1")));
JSONObject jsonObject = new JSONObject(noticeObj);
......@@ -2464,8 +2467,35 @@ public class CommonServiceImpl implements ICommonService {
.filter(obj -> obj instanceof Map)
.map(obj -> (Map<String, Object>) obj)
.collect(Collectors.toList());
if (equips.stream().anyMatch(info -> info.get("safetyAssessmentReport") == null || "".equals(info.get("safetyAssessmentReport")))) {
throw new BadRequest("请补充设备安全评估报告信息后提交!");
}
if ("2000".equals(Objects.toString(jsonObject.get("equListCode")))) {
if (equips.stream().anyMatch(info -> !"WTJY".equals(info.get("inspectType")))){
throw new BadRequest("压力容器需要先做委托检验后提交!");
}
}
boolean hasInvalidDate = equips.stream().anyMatch(info -> {
String nextInspectDateStr = (String) info.get("nextInspectDate");
if (nextInspectDateStr != null) {
try {
LocalDate nextInspectDate = LocalDate.parse(nextInspectDateStr, DateTimeFormatter.ISO_DATE);
return nextInspectDate.isBefore(LocalDate.now());
} catch (Exception e) {
return false;
}
}
return false;
});
if (hasInvalidDate) {
throw new BadRequest("委托检验下次检验日期超期,请重新填写后提交!");
}
if (!CollectionUtils.isEmpty(equips)) {
Map<String, Object> firstEquip = equips.get(0);
String equList = Objects.toString(firstEquip.get("equList"),"");
String equDefine = Objects.toString(firstEquip.get("equDefine"),"--");
String equCategory = Objects.toString(firstEquip.get("equCategory"),"");
formDataList = equips.stream().map(v -> {
......@@ -2473,6 +2503,7 @@ public class CommonServiceImpl implements ICommonService {
formData.putAll(jsonObject);
formData.put("equDefine", equDefine);
formData.put("equCategory", equCategory);
formData.put("equList", equList);
formData.entrySet().removeIf(entry -> entry.getValue() == null);
DateTimeFormatter inputFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
DateTimeFormatter outputFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
......
......@@ -72,9 +72,10 @@ import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import org.typroject.tyboot.core.rdbms.service.BaseService;
import org.typroject.tyboot.core.restful.exception.instance.BadRequest;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
import java.nio.charset.StandardCharsets;
import java.time.LocalDate;
import java.time.ZoneId;
import java.time.format.DateTimeFormatter;
import java.util.*;
import java.util.concurrent.TimeUnit;
import java.util.function.Function;
......@@ -173,9 +174,24 @@ public class JgOverDesignServiceLifeServiceImpl extends BaseService<JgOverDesign
ObjectUtils.isEmpty(info.getInspectConclusion()) || ObjectUtils.isEmpty(info.getInspectOrgCode()))) {
throw new BadRequest("请补充设备检验检测信息后提交!");
}
if (inspectionDetectionInfoList.stream().anyMatch(info ->
"2000".equals(map.get("equListCode")) && !"WTJY".equals(info.getInspectType()))) {
throw new BadRequest("压力容器需要先做委托检验后提交!!");
if ("2000".equals(Objects.toString(map.get("equListCode"))) && equipmentLists.stream().anyMatch(info -> !"WTJY".equals(info.get("inspectType")))) {
throw new BadRequest("压力容器需要先做委托检验后提交!");
}
boolean hasInvalidDate = equipmentLists.stream().anyMatch(info -> {
String nextInspectDateStr = (String) info.get("nextInspectDate");
if (nextInspectDateStr != null) {
try {
LocalDate nextInspectDate = LocalDate.parse(nextInspectDateStr, DateTimeFormatter.ISO_DATE);
return nextInspectDate.isBefore(LocalDate.now());
} catch (Exception e) {
return false;
}
}
return false;
});
if (hasInvalidDate) {
throw new BadRequest("委托检验下次检验日期超期,请重新填写后提交!");
}
List<IdxBizJgDesignInfo> designInfoList = idxBizJgDesignInfoServiceImpl.checkOverDesignRegNum(
equipmentLists.stream()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment