Commit 79c5067f authored by hezhuozhi's avatar hezhuozhi

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

parents d5feb64e 55d7139a
......@@ -2307,7 +2307,7 @@ public class CommonServiceImpl implements ICommonService {
formData.put("productName", formData.getString("projectContraption"));
}
//单位模版 部分字段需从设备列表中获取
if (formData.containsKey("equipmentLists") && manageType.equals(UNIT) ){
if (formData.containsKey("equipmentLists")){
JSONArray equipmentLists = formData.getJSONArray("equipmentLists");
List<Map<String, Object>> equips = equipmentLists.stream()
.filter(obj -> obj instanceof Map)
......@@ -2317,7 +2317,28 @@ public class CommonServiceImpl implements ICommonService {
formData.put("equNum",equipmentLists.size());
//设备品种
formData.put("equDefine",equips.get(0).get("equDefineName"));
}else if (manageType.equals(UNIT) && !CollectionUtils.isEmpty(equips)){
Set<String> productNameSet = equips.stream()
.filter(Objects::nonNull) // 过滤掉equip为null的情况
.map(e -> e.get("productName")) // 获取productName
.filter(Objects::nonNull) // 过滤掉productName为null的情况
.map(Object::toString) // 转换为String类型
.collect(Collectors.toSet()); // 收集到Set中
// 将set转成字符串逗号拼接
String productName="";
List<String> sortedProductNameList = new
ArrayList<>(productNameSet);
if (sortedProductNameList.size() > 3
) {
productName = String.join(",", sortedProductNameList.subList(0, 3)) + ",...";
} else
{
productName = String.join(",", sortedProductNameList);
}
formData.put("productName",equips.get(0).get("productName"));
}else if (manageType.equals(VEHICLE) && !CollectionUtils.isEmpty(equips)){
//气瓶数量
formData.put("gasNum",equips.size());
//设备品种
......
......@@ -667,6 +667,7 @@ public class IdxBizJgProjectContraptionServiceImpl extends BaseService<IdxBizJgP
result.put("inspectConclusionCode", info.getInspectConclusion());
result.put("inspectConclusion", Optional.ofNullable(dataDictionaryServiceImpl.getByCode(info.getInspectConclusion(), "JYJL"))
.map(DataDictionary::getName).orElse(""));
result.put("jySeq", info.getSequenceNbr());
return result;
}
}
\ No newline at end of file
......@@ -1526,6 +1526,26 @@ public class JgChangeRegistrationReformServiceImpl extends BaseService<JgChangeR
pipeline.setSequenceNbr(sequence.nextId() + "");
iIdxBizJgTechParamsPipelineService.save(pipeline);
}
// 检验信息恢复
JSONObject inspectData = jsonObject.getJSONObject("inspectData");
if(inspectData != null){
// 被更新前的检验信息
JSONArray oData = Optional.ofNullable(inspectData.getJSONArray("oData")).orElse(new JSONArray());
// 改造登记本次插入的检验信息主键sequenceNbr数组
JSONArray insertIds = Optional.ofNullable(inspectData.getJSONArray("insertIds")).orElse(new JSONArray());
// 更新的检验信息换成原来的
for(int i = 0; i < oData.size(); i++){
JSONObject item = oData.getJSONObject(i);
InspectionDetectionInfo inspectionDetectionInfo = BeanUtil.copyProperties(item, InspectionDetectionInfo.class);
inspectionDetectionInfoMapper.deleteById(inspectionDetectionInfo.getSequenceNbr());
inspectionDetectionInfoMapper.insert(inspectionDetectionInfo);
}
// 新插入的删除
if(!insertIds.isEmpty()){
List<String> ids = insertIds.toJavaList(String.class);
inspectionDetectionInfoMapper.deleteBatchIds(ids);
}
}
break;
// 起重机械
case QZJX:
......@@ -1610,33 +1630,27 @@ public class JgChangeRegistrationReformServiceImpl extends BaseService<JgChangeR
// 编辑时会有此数据,所以用来做标识,根据设备record + 检验报告编号判定唯一一条检验流水,有进行更新,无则进行插入
if(inspectionDetectionInfo.getInspectReportNo() != null && inspectionDetectionInfo.getInspectReport() != null){
String record = equipment.get("record").toString();
String jySeq = equipment.get("jySeq") == null ? null : equipment.get("jySeq").toString();
inspectionDetectionInfo.setInspectConclusion((String) equipment.get("inspectConclusionCode"));
inspectionDetectionInfo.setSequenceNbr(jySeq);
saveEquipOfPieLineInspectData(record, inspectionDetectionInfo, registrationReform);
}
}
private void saveEquipOfPieLineInspectData(String record, InspectionDetectionInfo inspectionDetectionInfo, JgChangeRegistrationReform registrationReform) {
// 1.检验机构 + 设备+ 检验报告编号时 , 是唯一的为了防止老数据有重复的,程序健壮,故使用list进行处理
LambdaQueryWrapper<InspectionDetectionInfo> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(AbstractEquipBaseEntity::getRecord, record)
.eq(InspectionDetectionInfo::getInspectReportNo, inspectionDetectionInfo.getInspectReportNo())
.eq(InspectionDetectionInfo::getInspectOrgCode, inspectionDetectionInfo.getInspectOrgCode());
List<InspectionDetectionInfo> inspectionDetectionInfos = inspectionDetectionInfoMapper.selectList(wrapper);
List<InspectionDetectionInfo> oInspectionDetectionInfos = new ArrayList<>(inspectionDetectionInfos);
JSONObject data = new JSONObject();
String insertId = null;
if(inspectionDetectionInfos.isEmpty()){
InspectionDetectionInfo inspectionDetectionInfoOld = null;
if(inspectionDetectionInfo.getSequenceNbr() != null){ // 编辑
inspectionDetectionInfoOld = inspectionDetectionInfoMapper.selectById(inspectionDetectionInfo.getSequenceNbr());
inspectionDetectionInfo.setRecDate(new Date());
inspectionDetectionInfoMapper.updateById(inspectionDetectionInfo);
} else { // 新增
insertId = sequence.nextId() + "";
inspectionDetectionInfo.setRecord(record);
inspectionDetectionInfo.setRecDate(new Date());
inspectionDetectionInfo.setSequenceNbr(sequence.nextId() + "");
inspectionDetectionInfoMapper.insert(inspectionDetectionInfo);
} else {
for (InspectionDetectionInfo inspectionDetectionInfo1 : inspectionDetectionInfos) {
Bean.copyExistPropertis(inspectionDetectionInfo, inspectionDetectionInfo1);
inspectionDetectionInfo1.setRecDate(new Date());
inspectionDetectionInfoMapper.updateById(inspectionDetectionInfo1);
}
}
// 2.记录原始检验流水用来作废时恢复数据
JSONObject oldData = commonServiceImpl.queryHisOldData(registrationReform.getApplyNo());
......@@ -1644,25 +1658,30 @@ public class JgChangeRegistrationReformServiceImpl extends BaseService<JgChangeR
// 插入的检验数据ids
this.setInsertIds(inspectData, insertId);
// 被更新的原行数据
this.setOData(inspectData, oInspectionDetectionInfos);
this.setOData(inspectData, inspectionDetectionInfoOld);
oldData.put("inspectData", inspectData);
LambdaUpdateWrapper<JgRegistrationHistory> updateWrapper = new LambdaUpdateWrapper<>();
updateWrapper.eq(JgRegistrationHistory::getCurrentDocumentId, registrationReform.getApplyNo());
updateWrapper.set(JgRegistrationHistory::getOldData, JSONObject.toJSONString(oldData));
jgRegistrationHistoryServiceImpl.update(updateWrapper);
}
private void setOData(JSONObject inspectData, List<InspectionDetectionInfo> oInspectionDetectionInfos) {
private void setOData(JSONObject inspectData, InspectionDetectionInfo oInspectionDetectionInfo) {
JSONArray oData = inspectData.getJSONArray("oData");
if(oData == null){
oData = new JSONArray();
inspectData.put("oData",oData);
}
if(oInspectionDetectionInfo != null){
oData.add(oInspectionDetectionInfo);
}
oData.addAll(oInspectionDetectionInfos);
}
private void setInsertIds(JSONObject inspectData, String insertId) {
JSONArray existInsertIds = inspectData.getJSONArray("insertIds");
if(existInsertIds == null){
existInsertIds = new JSONArray();
inspectData.put("insertIds",existInsertIds);
}
if(insertId != null){
existInsertIds.add(insertId);
......
......@@ -2191,7 +2191,7 @@
<w:spacing w:val="-1"/>
<w:lang w:val="en-US" w:eastAsia="zh-CN"/>
</w:rPr>
<w:t>${(resultNo)!''}</w:t>
<w:t>${(inspectReportNo)!''}</w:t>
</w:r>
</w:p>
</w:tc>
......
......@@ -543,7 +543,7 @@
<w:sz w:val="21"/>
<w:sz-cs w:val="21"/>
</w:rPr>
<w:t>${(registrationType)!''}</w:t>
<w:t>${(registrationType)!'新设备首次启用'}</w:t>
</w:r>
</w:p>
<w:p>
......
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