Commit a46c0788 authored by Lambertliu's avatar Lambertliu

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

parents 80397e98 14aece43
...@@ -2082,6 +2082,14 @@ public class CommonServiceImpl implements ICommonService { ...@@ -2082,6 +2082,14 @@ public class CommonServiceImpl implements ICommonService {
return jgRegistrationHistory != null ? JSONObject.parseObject(jgRegistrationHistory.getChangeData()) : null; return jgRegistrationHistory != null ? JSONObject.parseObject(jgRegistrationHistory.getChangeData()) : null;
} }
public JSONObject queryHisOldData(String currentDocumentId) {
LambdaQueryWrapper<JgRegistrationHistory> lambda = new QueryWrapper<JgRegistrationHistory>().lambda();
lambda.eq(JgRegistrationHistory::getCurrentDocumentId, currentDocumentId);
lambda.eq(JgRegistrationHistory::getIsDelete, false);
JgRegistrationHistory jgRegistrationHistory = jgRegistrationHistoryService.getBaseMapper().selectOne(lambda);
return jgRegistrationHistory != null ? JSONObject.parseObject(jgRegistrationHistory.getOldData()) : new JSONObject();
}
@Override @Override
public JSONArray queryHistoryDataObj(Long currentDocumentId) { public JSONArray queryHistoryDataObj(Long currentDocumentId) {
LambdaQueryWrapper<JgRegistrationHistory> lambda = new QueryWrapper<JgRegistrationHistory>().lambda(); LambdaQueryWrapper<JgRegistrationHistory> lambda = new QueryWrapper<JgRegistrationHistory>().lambda();
......
...@@ -36,6 +36,7 @@ import com.yeejoin.amos.boot.module.ymt.api.enums.EquipmentClassifityEnum; ...@@ -36,6 +36,7 @@ import com.yeejoin.amos.boot.module.ymt.api.enums.EquipmentClassifityEnum;
import com.yeejoin.amos.boot.module.ymt.api.enums.FlowStatusEnum; import com.yeejoin.amos.boot.module.ymt.api.enums.FlowStatusEnum;
import com.yeejoin.amos.boot.module.ymt.api.mapper.IdxBizJgRegisterInfoMapper; import com.yeejoin.amos.boot.module.ymt.api.mapper.IdxBizJgRegisterInfoMapper;
import com.yeejoin.amos.boot.module.ymt.api.mapper.IdxBizJgTechParamsElevatorMapper; import com.yeejoin.amos.boot.module.ymt.api.mapper.IdxBizJgTechParamsElevatorMapper;
import com.yeejoin.amos.boot.module.ymt.api.mapper.InspectionDetectionInfoMapper;
import com.yeejoin.amos.boot.module.ymt.api.mapper.OtherInfoMapper; import com.yeejoin.amos.boot.module.ymt.api.mapper.OtherInfoMapper;
import com.yeejoin.amos.component.feign.model.FeignClientResult; import com.yeejoin.amos.component.feign.model.FeignClientResult;
import com.yeejoin.amos.feign.privilege.Privilege; import com.yeejoin.amos.feign.privilege.Privilege;
...@@ -57,6 +58,7 @@ import org.springframework.stereotype.Service; ...@@ -57,6 +58,7 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.ObjectUtils; import org.springframework.util.ObjectUtils;
import org.typroject.tyboot.core.foundation.context.RequestContext; import org.typroject.tyboot.core.foundation.context.RequestContext;
import org.typroject.tyboot.core.foundation.utils.Bean;
import org.typroject.tyboot.core.foundation.utils.ValidationUtil; 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;
...@@ -164,6 +166,11 @@ public class JgChangeRegistrationReformServiceImpl extends BaseService<JgChangeR ...@@ -164,6 +166,11 @@ public class JgChangeRegistrationReformServiceImpl extends BaseService<JgChangeR
@Autowired @Autowired
private JgChangeRegistrationReformEqServiceImpl jgChangeRegistrationReformEqServiceImpl; private JgChangeRegistrationReformEqServiceImpl jgChangeRegistrationReformEqServiceImpl;
@Autowired
private InspectionDetectionInfoMapper inspectionDetectionInfoMapper;
@Autowired
private JgRegistrationHistoryServiceImpl jgRegistrationHistoryServiceImpl;
/*** /***
* @deprecated 根据查询调教获取分页对象 * @deprecated 根据查询调教获取分页对象
* @param dto 查询的dto对象 * @param dto 查询的dto对象
...@@ -600,7 +607,7 @@ public class JgChangeRegistrationReformServiceImpl extends BaseService<JgChangeR ...@@ -600,7 +607,7 @@ public class JgChangeRegistrationReformServiceImpl extends BaseService<JgChangeR
} else { // 压力管道逻辑 } else { // 压力管道逻辑
// 1.批量更新技术参数 // 1.批量更新技术参数
// 1.1 技术参数更新 // 1.1 技术参数更新
List<IdxBizJgTechParamsPipeline> paramsPipelines = updatePieLineTechBatch(jgChangeRegistrationReform); List<IdxBizJgTechParamsPipeline> paramsPipelines = updatePieLineTechAndInspection(jgChangeRegistrationReform);
// 2.按照装置生成证流水 // 2.按照装置生成证流水
saveCertFlowBatch(jgChangeRegistrationReform, paramsPipelines, taskV2Model); saveCertFlowBatch(jgChangeRegistrationReform, paramsPipelines, taskV2Model);
} }
...@@ -654,7 +661,12 @@ public class JgChangeRegistrationReformServiceImpl extends BaseService<JgChangeR ...@@ -654,7 +661,12 @@ public class JgChangeRegistrationReformServiceImpl extends BaseService<JgChangeR
jgCertificateChangeRecordEqService.saveBatch(changeRecordEqs); jgCertificateChangeRecordEqService.saveBatch(changeRecordEqs);
} }
private List<IdxBizJgTechParamsPipeline> updatePieLineTechBatch(JgChangeRegistrationReform jgChangeRegistrationReform) { /**
* 管道的技术参数及检验信息更新
* @param jgChangeRegistrationReform 改造变更登记单据
* @return 更新的管道信息
*/
private List<IdxBizJgTechParamsPipeline> updatePieLineTechAndInspection(JgChangeRegistrationReform jgChangeRegistrationReform) {
JSONObject hisData = commonServiceImpl.queryHistoryData(jgChangeRegistrationReform.getApplyNo()); JSONObject hisData = commonServiceImpl.queryHistoryData(jgChangeRegistrationReform.getApplyNo());
JSONArray piePines = hisData.getJSONArray("equipmentLists"); JSONArray piePines = hisData.getJSONArray("equipmentLists");
List<IdxBizJgTechParamsPipeline> paramsPipelines = new ArrayList<>(); List<IdxBizJgTechParamsPipeline> paramsPipelines = new ArrayList<>();
...@@ -672,8 +684,11 @@ public class JgChangeRegistrationReformServiceImpl extends BaseService<JgChangeR ...@@ -672,8 +684,11 @@ public class JgChangeRegistrationReformServiceImpl extends BaseService<JgChangeR
pipeline.setPipeLength(item.getString("pipeLength")); pipeline.setPipeLength(item.getString("pipeLength"));
LambdaUpdateWrapper<IdxBizJgTechParamsPipeline> updateWrapper = new LambdaUpdateWrapper<>(); LambdaUpdateWrapper<IdxBizJgTechParamsPipeline> updateWrapper = new LambdaUpdateWrapper<>();
updateWrapper.eq(IdxBizJgTechParamsPipeline::getRecord, item.getString("record")); updateWrapper.eq(IdxBizJgTechParamsPipeline::getRecord, item.getString("record"));
// 技术参数更新
iIdxBizJgTechParamsPipelineService.update(pipeline, updateWrapper); iIdxBizJgTechParamsPipelineService.update(pipeline, updateWrapper);
pipeline.setRecord(String.valueOf(item.getString("record"))); pipeline.setRecord(String.valueOf(item.getString("record")));
// 检验信息更新或者插入及记录原始数据用来作废时恢复数据用
updateOrCreateInspectionDetection(item, jgChangeRegistrationReform);
paramsPipelines.add(pipeline); paramsPipelines.add(pipeline);
} }
return paramsPipelines; return paramsPipelines;
...@@ -1589,6 +1604,72 @@ public class JgChangeRegistrationReformServiceImpl extends BaseService<JgChangeR ...@@ -1589,6 +1604,72 @@ public class JgChangeRegistrationReformServiceImpl extends BaseService<JgChangeR
return re; return re;
} }
private void updateOrCreateInspectionDetection(Map<String, Object> equipment, JgChangeRegistrationReform registrationReform) {
InspectionDetectionInfo inspectionDetectionInfo = new InspectionDetectionInfo();
BeanUtil.copyProperties(equipment, inspectionDetectionInfo);
// 编辑时会有此数据,所以用来做标识,根据设备record + 检验报告编号判定唯一一条检验流水,有进行更新,无则进行插入
if(inspectionDetectionInfo.getInspectReportNo() != null && inspectionDetectionInfo.getInspectReport() != null){
String record = equipment.get("record").toString();
inspectionDetectionInfo.setInspectConclusion((String) equipment.get("inspectConclusionCode"));
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()){
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());
JSONObject inspectData = oldData.getJSONObject("inspectData") == null ? new JSONObject() : oldData.getJSONObject("inspectData");
// 插入的检验数据ids
this.setInsertIds(inspectData, insertId);
// 被更新的原行数据
this.setOData(inspectData, oInspectionDetectionInfos);
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) {
JSONArray oData = inspectData.getJSONArray("oData");
if(oData == null){
oData = new JSONArray();
}
oData.addAll(oInspectionDetectionInfos);
}
private void setInsertIds(JSONObject inspectData, String insertId) {
JSONArray existInsertIds = inspectData.getJSONArray("insertIds");
if(existInsertIds == null){
existInsertIds = new JSONArray();
}
if(insertId != null){
existInsertIds.add(insertId);
}
}
/** /**
* 使用地点-使用登记完成后回把使用登记的地点信息写到装置表。定期检验时显示 * 使用地点-使用登记完成后回把使用登记的地点信息写到装置表。定期检验时显示
* @param projectContraption 装置 * @param projectContraption 装置
......
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