Commit b74285b7 authored by 刘林's avatar 刘林

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

parent 9e9766f2
...@@ -100,9 +100,9 @@ public class JgOverDesignServiceLifeController extends BaseController { ...@@ -100,9 +100,9 @@ public class JgOverDesignServiceLifeController extends BaseController {
@GetMapping("/getPageList") @GetMapping("/getPageList")
@ApiOperation(httpMethod = "GET", value = "分页查询", notes = "分页查询") @ApiOperation(httpMethod = "GET", value = "分页查询", notes = "分页查询")
public ResponseModel<Page<Map<String, Object>>> getPageList(@RequestParam("current") int current, public ResponseModel<Page<Map<String, Object>>> getPageList(@RequestParam("current") int current,
@RequestParam("size") int size, @RequestParam("size") int size,
@RequestParam(value = "sort", required = false) String sort, @RequestParam(value = "sort", required = false) String sort,
JgOverDesignServiceLifeDto dto) { JgOverDesignServiceLifeDto dto) {
ReginParams reginParams = getSelectedOrgInfo(); ReginParams reginParams = getSelectedOrgInfo();
dto.setUnitCode(Optional.ofNullable(reginParams.getCompany().getCompanyCode()) dto.setUnitCode(Optional.ofNullable(reginParams.getCompany().getCompanyCode())
.map(code -> code.contains("_") ? code.split("_")[1] : code) .map(code -> code.contains("_") ? code.split("_")[1] : code)
......
...@@ -106,6 +106,7 @@ import java.nio.charset.StandardCharsets; ...@@ -106,6 +106,7 @@ import java.nio.charset.StandardCharsets;
import java.nio.file.Files; import java.nio.file.Files;
import java.text.ParseException; import java.text.ParseException;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.time.LocalDate;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter; import java.time.format.DateTimeFormatter;
import java.util.*; import java.util.*;
...@@ -1246,12 +1247,12 @@ public class CommonServiceImpl implements ICommonService { ...@@ -1246,12 +1247,12 @@ public class CommonServiceImpl implements ICommonService {
Map<String, Object> noticeObj = (Map<String, Object>) map.get(notice); Map<String, Object> noticeObj = (Map<String, Object>) map.get(notice);
Map<String, Object> techInfoObj = (Map<String, Object>) map.get(techInfo); Map<String, Object> techInfoObj = (Map<String, Object>) map.get(techInfo);
Map<String, Object> useRegFormUploadObj = (Map<String, Object>) map.get(useRegFormUpload); Map<String, Object> useRegFormUploadObj = (Map<String, Object>) map.get(useRegFormUpload);
String uploadMode = String.valueOf(useRegFormUploadObj.get("uploadMode"));
Map<String, Object> provideMap = new HashMap<>(); Map<String, Object> provideMap = new HashMap<>();
String type = (String) basicObj.get("type"); String type = (String) basicObj.get("type");
noticeObj.put("businessCode", type); noticeObj.put("businessCode", type);
if (type.equals(ApplicationFormTypeEnum.AZGZ.getBusinessCode())) { if (type.equals(ApplicationFormTypeEnum.AZGZ.getBusinessCode())) {
JgInstallationNoticeDto jgInstallationNoticeDto = JSON.parseObject(JSON.toJSONString(noticeObj), JgInstallationNoticeDto.class); 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"))); jgInstallationNoticeDto.setReceiveOrgCreditCode(!ObjectUtils.isEmpty(basicObj.get("receiveOrgCreditCode")) ? String.valueOf(basicObj.get("receiveOrgCreditCode")) : String.valueOf(basicObj.get("receiveOrgCreditCode1")));
JSONObject jsonObject1 = (JSONObject) JSONObject.toJSON(jgInstallationNoticeDto); JSONObject jsonObject1 = (JSONObject) JSONObject.toJSON(jgInstallationNoticeDto);
...@@ -1347,7 +1348,9 @@ public class CommonServiceImpl implements ICommonService { ...@@ -1347,7 +1348,9 @@ public class CommonServiceImpl implements ICommonService {
JSONObject jsonObject = new JSONObject(noticeObj); JSONObject jsonObject = new JSONObject(noticeObj);
return jgEnableDisableServiceImpl.saveOrUpdate(jsonObject, reginParams); return jgEnableDisableServiceImpl.saveOrUpdate(jsonObject, reginParams);
} else if (type.equals(ApplicationFormTypeEnum.CSJ.getBusinessCode())) { } 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("formType", "add");
noticeObj.put("receiveOrgCode", !ObjectUtils.isEmpty(basicObj.get("receiveOrgCreditCode")) ? String.valueOf(basicObj.get("receiveOrgCreditCode")) : String.valueOf(basicObj.get("receiveOrgCreditCode1"))); noticeObj.put("receiveOrgCode", !ObjectUtils.isEmpty(basicObj.get("receiveOrgCreditCode")) ? String.valueOf(basicObj.get("receiveOrgCreditCode")) : String.valueOf(basicObj.get("receiveOrgCreditCode1")));
JSONObject jsonObject = new JSONObject(noticeObj); JSONObject jsonObject = new JSONObject(noticeObj);
...@@ -2464,8 +2467,35 @@ public class CommonServiceImpl implements ICommonService { ...@@ -2464,8 +2467,35 @@ public class CommonServiceImpl implements ICommonService {
.filter(obj -> obj instanceof Map) .filter(obj -> obj instanceof Map)
.map(obj -> (Map<String, Object>) obj) .map(obj -> (Map<String, Object>) obj)
.collect(Collectors.toList()); .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)) { if (!CollectionUtils.isEmpty(equips)) {
Map<String, Object> firstEquip = equips.get(0); Map<String, Object> firstEquip = equips.get(0);
String equList = Objects.toString(firstEquip.get("equList"),"");
String equDefine = Objects.toString(firstEquip.get("equDefine"),"--"); String equDefine = Objects.toString(firstEquip.get("equDefine"),"--");
String equCategory = Objects.toString(firstEquip.get("equCategory"),""); String equCategory = Objects.toString(firstEquip.get("equCategory"),"");
formDataList = equips.stream().map(v -> { formDataList = equips.stream().map(v -> {
...@@ -2473,6 +2503,7 @@ public class CommonServiceImpl implements ICommonService { ...@@ -2473,6 +2503,7 @@ public class CommonServiceImpl implements ICommonService {
formData.putAll(jsonObject); formData.putAll(jsonObject);
formData.put("equDefine", equDefine); formData.put("equDefine", equDefine);
formData.put("equCategory", equCategory); formData.put("equCategory", equCategory);
formData.put("equList", equList);
formData.entrySet().removeIf(entry -> entry.getValue() == null); formData.entrySet().removeIf(entry -> entry.getValue() == null);
DateTimeFormatter inputFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"); DateTimeFormatter inputFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
DateTimeFormatter outputFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd"); DateTimeFormatter outputFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
...@@ -2582,7 +2613,7 @@ public class CommonServiceImpl implements ICommonService { ...@@ -2582,7 +2613,7 @@ public class CommonServiceImpl implements ICommonService {
@Override @Override
public Map<String, Object> getRegistrationChangeCertificateUrl(JSONObject jsonObject) { public Map<String, Object> getRegistrationChangeCertificateUrl(JSONObject jsonObject) {
String applyNo = jsonObject.getString("applyNo"); String applyNo = jsonObject.getString("applyNo");
if (StringUtils.isEmpty(applyNo)) { if (StringUtils.isEmpty(applyNo)) {
ResponseModel<List<String>> listResponseModel = tzsServiceFeignClient.applicationFormCode(ApplicationFormTypeEnum.CSJ.getCode(), 1); ResponseModel<List<String>> listResponseModel = tzsServiceFeignClient.applicationFormCode(ApplicationFormTypeEnum.CSJ.getCode(), 1);
if (!ObjectUtils.isEmpty(listResponseModel) && listResponseModel.getStatus() != HttpStatus.OK.value()) { if (!ObjectUtils.isEmpty(listResponseModel) && listResponseModel.getStatus() != HttpStatus.OK.value()) {
......
...@@ -72,9 +72,10 @@ import org.typroject.tyboot.core.foundation.utils.ValidationUtil; ...@@ -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.rdbms.service.BaseService;
import org.typroject.tyboot.core.restful.exception.instance.BadRequest; import org.typroject.tyboot.core.restful.exception.instance.BadRequest;
import org.typroject.tyboot.core.restful.utils.ResponseModel; import org.typroject.tyboot.core.restful.utils.ResponseModel;
import java.nio.charset.StandardCharsets; import java.nio.charset.StandardCharsets;
import java.time.LocalDate;
import java.time.ZoneId; import java.time.ZoneId;
import java.time.format.DateTimeFormatter;
import java.util.*; import java.util.*;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
import java.util.function.Function; import java.util.function.Function;
...@@ -173,9 +174,24 @@ public class JgOverDesignServiceLifeServiceImpl extends BaseService<JgOverDesign ...@@ -173,9 +174,24 @@ public class JgOverDesignServiceLifeServiceImpl extends BaseService<JgOverDesign
ObjectUtils.isEmpty(info.getInspectConclusion()) || ObjectUtils.isEmpty(info.getInspectOrgCode()))) { ObjectUtils.isEmpty(info.getInspectConclusion()) || ObjectUtils.isEmpty(info.getInspectOrgCode()))) {
throw new BadRequest("请补充设备检验检测信息后提交!"); throw new BadRequest("请补充设备检验检测信息后提交!");
} }
if (inspectionDetectionInfoList.stream().anyMatch(info -> if ("2000".equals(Objects.toString(map.get("equListCode"))) && equipmentLists.stream().anyMatch(info -> !"WTJY".equals(info.get("inspectType")))) {
"2000".equals(map.get("equListCode")) && !"WTJY".equals(info.getInspectType()))) { throw new BadRequest("压力容器需要先做委托检验后提交!");
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( List<IdxBizJgDesignInfo> designInfoList = idxBizJgDesignInfoServiceImpl.checkOverDesignRegNum(
equipmentLists.stream() 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