Commit 5d68c1a9 authored by 刘林's avatar 刘林

Merge remote-tracking branch 'origin/develop_tzs_register_test' into develop_tzs_register_test

parents 55edaa13 04e80df8
......@@ -33,7 +33,11 @@ import java.util.Map;
public class IdxBizJgProjectContraptionController extends BaseController {
// 设备基本信息表单id
private static final String EQUIP_INFO_FORM_ID = "equipInfo";
@Autowired
public static final String PIPELINE_LIST = "pipelineList";
public static final String DEVICE_LIST = "deviceList";
public static final String USE_UNIT_CREDIT_CODE = "USE_UNIT_CREDIT_CODE";
public static final String USE_UNIT_NAME = "USE_UNIT_NAME";
@Autowired
IdxBizJgProjectContraptionServiceImpl idxBizJgProjectContraptionServiceImpl;
/**
......@@ -141,8 +145,9 @@ public class IdxBizJgProjectContraptionController extends BaseController {
// 传record的原因是前端组件内部写死了,此处是工程装置表seq
public ResponseModel<Object> detailsNotFormId(@RequestParam("record") String sequenceNbr) {
Map<String, Object> objectMap = idxBizJgProjectContraptionServiceImpl.details(sequenceNbr).get(EQUIP_INFO_FORM_ID);
Object pipelineListObj = objectMap.remove("pipelineList");
objectMap.put("deviceList", pipelineListObj);
Object pipelineListObj = objectMap.remove(PIPELINE_LIST);
objectMap.put(DEVICE_LIST, pipelineListObj);
objectMap.put("useUnitCreditCode", objectMap.get(USE_UNIT_CREDIT_CODE) + "_" + objectMap.get(USE_UNIT_NAME));
return ResponseHelper.buildResponse(objectMap);
}
......
......@@ -2260,10 +2260,14 @@ public class CommonServiceImpl implements ICommonService {
DateTimeFormatter inputFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
DateTimeFormatter outputFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
Pattern timePattern = Pattern.compile("\\d{4}-\\d{2}-\\d{2} \\d{2}:\\d{2}:\\d{2}");
//如果是历史无证的修改类型为SP_TT并且枚举没有在登记类型中
if(Objects.isNull(RegistrationTypeEnum.getNameByType(formData.getString("type"))) && "jg_his_black".equals(formData.getString("dataSource"))){
formData.put("type","SP_TT");
}
//登记类型
if (jsonObject.containsKey("type")){
formData.put("registrationType",RegistrationTypeEnum.getNameByType(jsonObject.getString("type")));
if (formData.containsKey("type")){
formData.put("registrationType",RegistrationTypeEnum.getNameByType(formData.getString("type")));
}
for (String key : formData.keySet()) {
if (key.contains("Date") && timePattern.matcher(formData.getString(key)).matches()){
......@@ -2318,7 +2322,7 @@ public class CommonServiceImpl implements ICommonService {
.map(obj -> (Map<String, Object>) obj).collect(Collectors.toList());
if (manageType.equals(UNIT) && !CollectionUtils.isEmpty(equips)){
//管道计算的是管道长度
if (formData.containsKey("equListCode") && formData.getString("equListCode").equals("8000")){
if ("8000".equals(formData.getString("equListCode")) || "8000".equals(formData.getString("EQU_LIST_CODE"))){
double pipeLength = equips.stream().filter(Objects::nonNull)
.filter(map -> map.containsKey("pipeLength") && StringUtils.isNotEmpty((String)map.get("pipeLength")))
.mapToDouble(map -> Double.parseDouble((String) map.get("pipeLength")))
......
......@@ -228,6 +228,8 @@ public class JgReformNoticeServiceImpl extends BaseService<JgReformNoticeDto, Jg
// 业务单据中的设备主键 管道的为record 其他设备为SEQUENCE_NBR
String equSeq = !EquipmentClassifityEnum.YLGD.getCode().equals(notice.getEquListCode()) ? SEQUENCE_NBR : RECORD;
List<Map<String, Object>> deviceList = noticeDto.getDeviceList();
// 管道校验管道编号不重复
this.verifyThatThePipeNumberIsUnique(notice.getEquListCode(), deviceList);
List<String> records = deviceList.stream().filter(item -> !Objects.isNull(item.get(RECORD))).map(equ -> String.valueOf(equ.get(RECORD))).collect(Collectors.toList());
this.checkRepeatUsed(submitType, records, notice);
if (SUBMIT_TYPE_FLOW.equals(submitType)) {
......@@ -474,6 +476,8 @@ public class JgReformNoticeServiceImpl extends BaseService<JgReformNoticeDto, Jg
if (CollectionUtils.isEmpty(deviceList)) {
throw new BadRequest("请选择设备!");
}
// 管道校验管道编号不重复
this.verifyThatThePipeNumberIsUnique(equListCode, deviceList);
// 提交时对设备状态进行校验(处理并发问题,一个未被使用的设备同时被多个使用这打开,同时提交发起申请) todo 回滚异常未写
if (SUBMIT_TYPE_FLOW.equals(submitType)) {
this.repeatUsedEquipCheck(deviceList, reginParams.getCompany().getCompanyCode());
......@@ -570,6 +574,23 @@ public class JgReformNoticeServiceImpl extends BaseService<JgReformNoticeDto, Jg
}
/**
* 压力管道校验管道编号不能重复
*
* @param equListCode 设备种类
* @param deviceList 设备列表
*/
public void verifyThatThePipeNumberIsUnique(String equListCode, List<Map<String, Object>> deviceList) {
if (EquipmentClassifityEnum.YLGD.getCode().equals(equListCode)) {
if (!CollectionUtils.isEmpty(deviceList) && deviceList.size() != deviceList.stream()
.map(v -> (String) v.get("pipelineNumber"))
.distinct()
.count()) {
throw new BadRequest("同一工程装置下管道编号不能重复!");
}
}
}
/**
* 计算管道长度变化 正值为增长,负值为减少
*
* @param oldPipData 旧管道数据
......@@ -1010,6 +1031,9 @@ public class JgReformNoticeServiceImpl extends BaseService<JgReformNoticeDto, Jg
}
private void delPipDataWithFlowPass(List<String> toDeletePipRecords) {
if (toDeletePipRecords.isEmpty()) {
return;
}
List<ESEquipmentCategoryDto> esEquipmentCategoryDtoList = toDeletePipRecords.stream().map(
record -> new ESEquipmentCategoryDto().setSEQUENCE_NBR(record)
).collect(Collectors.toList());
......
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