Commit 28e50234 authored by suhuiguang's avatar suhuiguang

refactor(大编辑):代码重构

1.联调自测
parent 520b3807
......@@ -33,7 +33,6 @@ public class JgBizChangeLogDto extends BaseDto {
@ApiModelProperty(value = "变更附件")
private String changeAttachment;
@ApiModelProperty(value = "触发的id(列入使用登记变化后,安装告知数据也变化,则记录两条:使用登记的oid为空,按照告知的为使用登记的id)")
private String oId;
......
......@@ -57,14 +57,17 @@ public class BizDataChangeController extends BaseController {
public ResponseModel<IPage<?>> getDetailV2(@ApiParam(value = "单据编号或者设备装置唯一标识") @RequestParam String applyNo,
@ApiParam(value = "业务类型") @PathVariable String bizType,
@ApiParam(value = "详情类型:设备、装置列表") @RequestParam DetailType type,
@ApiParam(value = "查询参数") @RequestParam JSONObject searchParams) {
return ResponseHelper.buildResponse(bizDataChangeService.queryDetail(applyNo, bizType, type, searchParams));
@ApiParam(value = "查询参数") @RequestParam Map<String, Object> searchParams) {
return ResponseHelper.buildResponse(bizDataChangeService.queryDetail(applyNo, bizType, type, new JSONObject(searchParams)));
}
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/v2/{bizType}/sub-detail")
@ApiOperation(value = "编辑二级页面详情查询--通用", httpMethod = "GET")
public ResponseModel<Map<String, ?>> getSubDetailV2(@ApiParam(value = "设备或者装置唯一标识") @RequestParam String bizId, @ApiParam(value = "单据编号,装置时需要") @RequestParam(required = false) String applyNo, @ApiParam(value = "详情类型:设备、装置") @RequestParam DetailType type, @ApiParam(value = "业务类型") @PathVariable String bizType) {
public ResponseModel<Map<String, ?>> getSubDetailV2(@ApiParam(value = "设备或者装置唯一标识") @RequestParam String bizId,
@ApiParam(value = "单据编号,装置时需要") @RequestParam(required = false) String applyNo,
@ApiParam(value = "详情类型:设备、装置") @RequestParam DetailType type,
@ApiParam(value = "业务类型") @PathVariable String bizType) {
return ResponseHelper.buildResponse(bizDataChangeService.querySubDetail(applyNo, bizId, bizType, type));
}
......
......@@ -23,7 +23,7 @@ public class BizDataChangeServiceImpl {
* @param bizType 业务类型
* @param modelType 处理器类型
* @param changeData 变化后的数据
* @param selectedOrgInfo
* @param selectedOrgInfo 登录人信息
*/
@Transactional(rollbackFor = Exception.class)
public void save(String bizId,
......
......@@ -131,6 +131,9 @@ public class CommonEquipDataProcessService {
throw new RuntimeException(e);
}
}
public static <T extends IBaseChangeData> void castMap2Bean(Map<String, Object> map, T target) {
BeanUtil.copyProperties(JSON.parse(JSONObject.toJSONString(map)), target, true);
}
public void checkValidField(String record, BaseChangeDataDto changeDataDto, String equList, String equCategory, String equDefine) {
......@@ -718,12 +721,13 @@ public class CommonEquipDataProcessService {
// 转json
this.castJsonFields(re);
// 转下滑线大写下划线
this.cast2UnderCase(re);
Map<String, Object> result = this.cast2UnderCase(re);
// 流水主键赋值 用于后续的更新
re.put("jySeq", inspectionDetectionInfo != null ? inspectionDetectionInfo.getSequenceNbr() : null);
re.put("maintenanceSeq", idxBizJgMaintenanceRecordInfo != null ? idxBizJgMaintenanceRecordInfo.getSequenceNbr() : null);
re.put("constructionInfoSeq", constructionInfo != null ? constructionInfo.getSequenceNbr() : null);
return re;
result.put("jySeq", inspectionDetectionInfo != null ? inspectionDetectionInfo.getSequenceNbr() : null);
result.put("maintenanceSeq", idxBizJgMaintenanceRecordInfo != null ? idxBizJgMaintenanceRecordInfo.getSequenceNbr() : null);
result.put("constructionInfoSeq", constructionInfo != null ? constructionInfo.getSequenceNbr() : null);
result.put("record", useInfo.getRecord());
return result;
}
public IPage<?> getEquListByRecords(Set<String> eqs, JSONObject map) {
......
......@@ -32,32 +32,32 @@ public class SingleEquipChangeProcess implements IEquipChangeDataProcessStrategy
IdxBizJgUseInfo useInfoOld = commonEquipDataProcessService.getJgUseRegistrationService().getUseInfoMapper().selectOne(new LambdaQueryWrapper<IdxBizJgUseInfo>().eq(IdxBizJgUseInfo::getRecord, record));
IdxBizJgUseInfo useInfoNew = BeanUtil.copyProperties(useInfoOld, IdxBizJgUseInfo.class);
BeanUtil.copyProperties(changeJson, useInfoNew);
CommonEquipDataProcessService.castMap2Bean(changeJson, useInfoNew);
useInfoNew.setSequenceNbr(useInfoOld.getSequenceNbr());
IdxBizJgRegisterInfo registerInfoOld = commonEquipDataProcessService.getJgUseRegistrationService().getIdxBizJgRegisterInfoService().getOne(new LambdaQueryWrapper<IdxBizJgRegisterInfo>().eq(IdxBizJgRegisterInfo::getRecord, record));
IdxBizJgRegisterInfo registerInfoNew = BeanUtil.copyProperties(registerInfoOld, IdxBizJgRegisterInfo.class);
BeanUtil.copyProperties(changeJson, registerInfoNew);
CommonEquipDataProcessService.castMap2Bean(changeJson, registerInfoNew);
registerInfoNew.setSequenceNbr(registerInfoOld.getSequenceNbr());
IdxBizJgFactoryInfo factoryInfoOld = commonEquipDataProcessService.getJgFactoryInfoMapper().selectOne(new LambdaQueryWrapper<IdxBizJgFactoryInfo>().eq(IdxBizJgFactoryInfo::getRecord, record));
IdxBizJgFactoryInfo factoryInfoNew = BeanUtil.copyProperties(factoryInfoOld, IdxBizJgFactoryInfo.class);
BeanUtil.copyProperties(changeJson, factoryInfoNew);
CommonEquipDataProcessService.castMap2Bean(changeJson, factoryInfoNew);
factoryInfoNew.setSequenceNbr(factoryInfoOld.getSequenceNbr());
IdxBizJgDesignInfo designInfoOld = commonEquipDataProcessService.getIdxBizJgDesignInfoMapper().selectOne(new LambdaQueryWrapper<IdxBizJgDesignInfo>().eq(IdxBizJgDesignInfo::getRecord, record));
IdxBizJgDesignInfo designInfoNew = BeanUtil.copyProperties(factoryInfoOld, IdxBizJgDesignInfo.class);
BeanUtil.copyProperties(changeJson, designInfoNew);
IdxBizJgDesignInfo designInfoNew = BeanUtil.copyProperties(factoryInfoOld, IdxBizJgDesignInfo.class);;
CommonEquipDataProcessService.castMap2Bean(changeJson, designInfoNew);
designInfoNew.setSequenceNbr(designInfoOld.getSequenceNbr());
IdxBizJgOtherInfo otherInfoOld = commonEquipDataProcessService.getIdxBizJgOtherInfoMapper().selectOne(new LambdaQueryWrapper<IdxBizJgOtherInfo>().eq(IdxBizJgOtherInfo::getRecord, record));
IdxBizJgOtherInfo otherInfoNew = BeanUtil.copyProperties(factoryInfoOld, IdxBizJgOtherInfo.class);
BeanUtil.copyProperties(changeJson, otherInfoNew);
CommonEquipDataProcessService.castMap2Bean(changeJson, otherInfoNew);
otherInfoNew.setSequenceNbr(otherInfoOld.getSequenceNbr());
IdxBizJgSupervisionInfo idxBizJgSupervisionInfoOld = commonEquipDataProcessService.getJgUseRegistrationService().getIdxBizJgSupervisionInfoMapper().selectOne(new LambdaQueryWrapper<IdxBizJgSupervisionInfo>().eq(IdxBizJgSupervisionInfo::getRecord, record));
IdxBizJgSupervisionInfo idxBizJgSupervisionInfoNew = BeanUtil.copyProperties(factoryInfoOld, IdxBizJgSupervisionInfo.class);
BeanUtil.copyProperties(changeJson, idxBizJgSupervisionInfoNew);
CommonEquipDataProcessService.castMap2Bean(changeJson, idxBizJgSupervisionInfoNew);
idxBizJgSupervisionInfoNew.setSequenceNbr(idxBizJgSupervisionInfoOld.getSequenceNbr());
String jySeq = changeJson.getString("jySeq");
......@@ -66,7 +66,7 @@ public class SingleEquipChangeProcess implements IEquipChangeDataProcessStrategy
if (jySeq != null) {
IdxBizJgInspectionDetectionInfo inspectionDetectionInfoOld = commonEquipDataProcessService.getJgUseRegistrationService().getInspectionDetectionInfoService().getById(jySeq);
IdxBizJgInspectionDetectionInfo inspectionDetectionInfoNew = BeanUtil.copyProperties(inspectionDetectionInfoOld, IdxBizJgInspectionDetectionInfo.class);
BeanUtil.copyProperties(changeJson, idxBizJgSupervisionInfoNew);
CommonEquipDataProcessService.castMap2Bean(changeJson, idxBizJgSupervisionInfoNew);
inspectionDetectionInfoNew.setSequenceNbr(inspectionDetectionInfoOld.getSequenceNbr());
List<FieldChangeMeta> inspectionFieldChangeMetas = commonEquipDataProcessService.simpleTrackAndUpdate(commonEquipDataProcessService.getJgUseRegistrationService().getInspectionDetectionInfoService().getBaseMapper(), inspectionDetectionInfoOld, inspectionDetectionInfoNew, useInfoNew.getRecord(), "SEQUENCE_NBR", inspectionDetectionInfoOld.getSequenceNbr());
allChangeColumns.addAll(inspectionFieldChangeMetas);
......@@ -75,7 +75,7 @@ public class SingleEquipChangeProcess implements IEquipChangeDataProcessStrategy
if (maintenanceSeq != null) {
IdxBizJgMaintenanceRecordInfo idxBizJgMaintenanceRecordInfoOld = commonEquipDataProcessService.getJgUseRegistrationService().getIdxBizJgMaintenanceRecordInfoService().getById(maintenanceSeq);
IdxBizJgMaintenanceRecordInfo idxBizJgMaintenanceRecordInfoNew = BeanUtil.copyProperties(factoryInfoOld, IdxBizJgMaintenanceRecordInfo.class);
BeanUtil.copyProperties(changeJson, idxBizJgMaintenanceRecordInfoNew);
CommonEquipDataProcessService.castMap2Bean(changeJson, idxBizJgMaintenanceRecordInfoNew);
idxBizJgMaintenanceRecordInfoNew.setSequenceNbr(idxBizJgMaintenanceRecordInfoOld.getSequenceNbr());
List<FieldChangeMeta> idxBizJgMaintenanceFieldChangeMetas = commonEquipDataProcessService.simpleTrackAndUpdate(commonEquipDataProcessService.getJgUseRegistrationService().getIdxBizJgMaintenanceRecordInfoService().getBaseMapper(), idxBizJgMaintenanceRecordInfoOld, idxBizJgMaintenanceRecordInfoNew, useInfoNew.getRecord(), "SEQUENCE_NBR", idxBizJgMaintenanceRecordInfoOld.getSequenceNbr());
allChangeColumns.addAll(idxBizJgMaintenanceFieldChangeMetas);
......@@ -83,7 +83,7 @@ public class SingleEquipChangeProcess implements IEquipChangeDataProcessStrategy
if (constructionInfoSeq != null) {
IdxBizJgConstructionInfo constructionInfoOld = commonEquipDataProcessService.getJgUseRegistrationService().getIdxBizJgConstructionInfoService().getById(constructionInfoSeq);
IdxBizJgConstructionInfo constructionInfoNew = BeanUtil.copyProperties(constructionInfoOld, IdxBizJgConstructionInfo.class);
BeanUtil.copyProperties(changeJson, constructionInfoNew);
CommonEquipDataProcessService.castMap2Bean(changeJson, constructionInfoNew);
constructionInfoNew.setSequenceNbr(constructionInfoOld.getSequenceNbr());
List<FieldChangeMeta> constructionInfoFieldChangeMetas = commonEquipDataProcessService.simpleTrackAndUpdate(commonEquipDataProcessService.getJgUseRegistrationService().getIdxBizJgConstructionInfoService().getBaseMapper(), constructionInfoOld, constructionInfoNew, useInfoNew.getRecord(), "SEQUENCE_NBR", constructionInfoOld.getSequenceNbr());
allChangeColumns.addAll(constructionInfoFieldChangeMetas);
......
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