Commit 8761383f authored by suhuiguang's avatar suhuiguang

4个告知详情调整

parent bb070893
......@@ -223,7 +223,7 @@ public class JgReformNoticeDto extends BaseDto {
private String transferToUserIds;
@ApiModelProperty (value = "其他附件")
private String otherAccessories;
private List<JSONObject> otherAccessories;
/**
......
......@@ -355,6 +355,7 @@ public class JgReformNotice extends BaseEntity {
/**
* 其他附件
*/
@TableField(value = "other_accessories")
private String otherAccessories;
@TableField(value = "other_accessories", typeHandler = FastjsonTypeHandler.class)
private List<JSONObject> otherAccessories;
}
......@@ -2,6 +2,7 @@ package com.yeejoin.amos.boot.module.jg.biz.service.impl;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.date.DatePattern;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.io.IoUtil;
import cn.hutool.json.JSONUtil;
......@@ -1602,4 +1603,13 @@ public class CommonServiceImpl implements ICommonService {
return jgRegistrationHistory != null ? JSON.parse(jgRegistrationHistory.getChangeData()) : null;
}
public static void formatTime2StrDateForEquip(JSONObject jsonObject){
String[] timeFields = {"designDate" ,"produceDate", "inspectDate", "nextInspectDate"};
for(String field: timeFields){
if(jsonObject.get(field) != null && jsonObject.get(field) instanceof Long){
jsonObject.put(field, DateUtil.format(new Date(Long.parseLong(jsonObject.get(field).toString())) , DatePattern.NORM_DATETIME_PATTERN));
}
}
}
}
\ No newline at end of file
......@@ -169,6 +169,7 @@ public class JgChangeRegistrationUnitServiceImpl extends BaseService<JgChangeReg
if(his == null){
return getEquipInfo(notice.getSequenceNbr(), changeInfo);
}
CommonServiceImpl.formatTime2StrDateForEquip(his);
return his;
}
// 非完成状态返回实时设备数据
......
......@@ -666,12 +666,13 @@ public class JgEnableDisableServiceImpl extends BaseService<JgEnableDisableDto,
if(enableDisable.getAuditStatus().equals(FlowStatusEnum.TO_BE_FINISHED.getName())){
// 完成状态查询历史表
JSONObject jsonObject = commonService.queryHistoryData(sequenceNbr);
// 兼容老业务
// 兼容老数据
if(jsonObject == null){
// 数据逻辑
// 数据逻辑
fillRuntimeEquipInfoData(sequenceNbr, resultMap);
} else {
// 新数据逻辑
// 老数据逻辑
CommonServiceImpl.formatTime2StrDateForEquip(jsonObject);
resultMap.putAll(jsonObject);
}
resultMap.putAll(beanMap);
......
......@@ -588,6 +588,7 @@ public class JgEquipTransferServiceImpl extends BaseService<JgEquipTransferDto,
return equipMap;
} else {
// 2.移交业务字段信息
CommonServiceImpl.formatTime2StrDateForEquip(his);
his.putAll(equipTransferInfo);
return his;
}
......
......@@ -175,7 +175,7 @@ public class JgInstallationNoticeServiceImpl extends BaseService<JgInstallationN
if (Objects.isNull(notice)) {
return null;
}
Map<String, Object> installationInfo = BeanUtil.beanToMap(notice);
Map<String, Object> installationInfo = BeanUtil.beanToMap(notice, false, true);
installationInfo.put("province", notice.getProvince() + "_" + notice.getProvinceName());
installationInfo.put("city", notice.getCity() + "_" + notice.getCityName());
......@@ -207,6 +207,32 @@ public class JgInstallationNoticeServiceImpl extends BaseService<JgInstallationN
installationInfo.put(s, ObjectUtils.isEmpty(installationInfo.get(s)) ? new JSONArray() : parseArray(installationInfo.get(s).toString()));
}
}
if(Integer.parseInt(notice.getNoticeStatus()) == FlowStatusEnum.TO_BE_FINISHED.getCode()){
// 完成时显示历史数据
JSONObject hisData = commonService.queryHistoryData(notice.getSequenceNbr());
// 兼容老数据
if(hisData == null){
Map<String, Object> detail = setNewEquipData(companyLevel, installationInfo, equipmentInfos);
return new HashMap<String, Map<String, Object>>() {{
this.put("installationInfo", detail);
}};
} else {
hisData.putAll(installationInfo);
CommonServiceImpl.formatTime2StrDateForEquip(hisData);
return new HashMap<String, Map<String, Object>>() {{
this.put("installationInfo", hisData);
}};
}
} else {
// 显示最新的设备信息
Map<String, Object> detail = setNewEquipData(companyLevel, installationInfo, equipmentInfos);
return new HashMap<String, Map<String, Object>>() {{
this.put("installationInfo", detail);
}};
}
}
private Map<String, Object> setNewEquipData(String companyLevel, Map<String, Object> installationInfo, List<Map<String, Object>> equipmentInfos) {
Map<String, Object> detail = equipmentInfos.get(0);
Map<String, Object> equInfo = idxBizJgRegisterInfoService.getDetailFieldCamelCaseByRecord(detail.get("equId").toString());
equInfo.put("useUnitCreditCodeUse", equInfo.getOrDefault("useUnitCreditCode", ""));
......@@ -222,9 +248,7 @@ public class JgInstallationNoticeServiceImpl extends BaseService<JgInstallationN
BeanUtil.copyProperties(equInfo, detail);
BeanUtil.copyProperties(installationInfo, detail, "equList", "supervisoryCode", "factoryNum", "equRegisterCode");
detail.put("companyLevel", companyLevel);
return new HashMap<String, Map<String, Object>>() {{
this.put("installationInfo", detail);
}};
return detail;
}
/**
......@@ -861,6 +885,7 @@ public class JgInstallationNoticeServiceImpl extends BaseService<JgInstallationN
LambdaQueryWrapper<JgInstallationNoticeEq> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(JgInstallationNoticeEq::getEquipTransferId,dto.getSequenceNbr());
JgInstallationNoticeEq jgRelationEquip = jgInstallationNoticeEqMapper.selectOne(queryWrapper);
this.saveHisDataBeforeUpdate(jgInstallationNotice, jgRelationEquip.getEquId());
LambdaQueryWrapper<OtherInfo> queryWrapper1 = new LambdaQueryWrapper<>();
queryWrapper1.eq(OtherInfo::getRecord,jgRelationEquip.getEquId());
OtherInfo tzsJgOtherInfo = tzsJgOtherInfoMapper.selectOne(queryWrapper1);
......@@ -869,7 +894,6 @@ public class JgInstallationNoticeServiceImpl extends BaseService<JgInstallationN
RegistrationInfo tzsJgRegistrationInfo = tzsJgRegistrationInfoMapper.selectOne(queryWrapper2);
stringBuffer.append(tzsJgRegistrationInfo.getEquCategory()).append(jgInstallationNotice.getReceiveOrgCreditCode()).append(ym);
String equCode = stringBuffer.toString();
ResponseModel<String> responseModel = tzsServiceFeignClient.deviceRegistrationCode(equCode);
String deviceRegistrationCode = responseModel.getResult();
Map<String, Object> map = new HashMap<>();
......@@ -974,7 +998,6 @@ public class JgInstallationNoticeServiceImpl extends BaseService<JgInstallationN
BeanUtils.copyProperties(jgInstallationNotice, taskMessageDto);
taskMap.put("model", taskMessageDto);
taskV2Model = commonService.updateTaskModel(taskMap);
} else {
jgInstallationNotice.setNextExecuteIds(workflowResultDto.getNextExecutorRoleIds());
jgInstallationNotice.setNextExecuteUserIds(workflowResultDto.getNextExecutorUserIds());
......@@ -1046,6 +1069,11 @@ public class JgInstallationNoticeServiceImpl extends BaseService<JgInstallationN
}
}
private void saveHisDataBeforeUpdate(JgInstallationNotice jgInstallationNotice, String equId) {
Map<String, Object> map = idxBizJgRegisterInfoService.getDetailFieldCamelCaseByRecord(equId);
commonService.saveOrUpdateHistory(BusinessTypeEnum.JG_INSTALLATION_NOTIFICATION.getName(), new JSONObject(map), equId, jgInstallationNotice.getSequenceNbr().toString());
}
public InstanceRuntimeData buildInstanceRuntimeData(JgInstallationNotice jgInstallationNotice) {
return InstanceRuntimeData.builder()
.nextExecuteUserIds(jgInstallationNotice.getNextExecuteUserIds())
......
......@@ -15,6 +15,7 @@ import com.yeejoin.amos.boot.biz.common.service.impl.DataDictionaryServiceImpl;
import com.yeejoin.amos.boot.biz.common.utils.DateUtils;
import com.yeejoin.amos.boot.biz.common.utils.RedisUtils;
import com.yeejoin.amos.boot.module.jg.api.dto.*;
import com.yeejoin.amos.boot.module.jg.api.entity.JgInstallationNotice;
import com.yeejoin.amos.boot.module.jg.api.entity.JgMaintainNotice;
import com.yeejoin.amos.boot.module.jg.api.entity.JgMaintainNoticeEq;
import com.yeejoin.amos.boot.module.jg.api.enums.BusinessTypeEnum;
......@@ -123,11 +124,12 @@ public class JgMaintainNoticeServiceImpl extends BaseService<JgMaintainNoticeDto
public Map<String, Map<String, Object>> queryBySequenceNbr(Long sequenceNbr) {
// 维修告知信息
JgMaintainNotice notice = jgMaintainNoticeMapper.selectById(sequenceNbr);
if (Objects.isNull(notice))
if (Objects.isNull(notice)) {
return null;
}
Map<String, Object> maintainInfo = BeanUtil.beanToMap(notice);
maintainInfo.put("powerOfAttorneyList", JSON.parseArray(notice.getPowerOfAttorney()));
maintainInfo.put("constructionContractList", JSON.parseArray(notice.getConstructionContract()));
maintainInfo.put("powerOfAttorneyList", JSON.parse(notice.getPowerOfAttorney()));
maintainInfo.put("constructionContractList", JSON.parse(notice.getConstructionContract()));
maintainInfo.put("province", notice.getProvince() + "_" + notice.getProvinceName());
maintainInfo.put("city", ObjectUtils.isEmpty(notice.getCity()) ? null : notice.getCity() + "_" + notice.getCityName());
maintainInfo.put("constructionManagerId", ObjectUtils.isEmpty(notice.getConstructionManagerId()) ? null : notice.getConstructionManagerId() + "_" + notice.getConstructionManager());
......@@ -141,26 +143,40 @@ public class JgMaintainNoticeServiceImpl extends BaseService<JgMaintainNoticeDto
if (!ValidationUtil.isEmpty(notice.getStreet()) && !ValidationUtil.isEmpty(notice.getStreetName())) {
maintainInfo.put("street", notice.getStreet() + "_" + notice.getStreetName());
}
String[] fields = {"productPhoto", "designDoc", "designStandard", "factoryStandard", "productQualityYieldProve",
"insUseMaintainExplain", "inspectReport", "proxyStatementAttachment", "installContractAttachment"};
// 设备信息 "equCategory", "equDefine", "equRegisterCode", "produceCountry", "produceLicenseNum",
if(Integer.parseInt(notice.getNoticeStatus()) == FlowStatusEnum.TO_BE_FINISHED.getCode()){
// 完成时显示历史数据
JSONObject hisData = commonService.queryHistoryData(notice.getSequenceNbr());
// 兼容老数据
if(hisData == null){
// 老数据逻辑
setNewEquipInfo(sequenceNbr, maintainInfo);
return new HashMap<String, Map<String, Object>>() {{
put(TABLE_PAGE_ID, maintainInfo);
}};
} else {
// 新数据逻辑
hisData.putAll(maintainInfo);
CommonServiceImpl.formatTime2StrDateForEquip(hisData);
return new HashMap<String, Map<String, Object>>() {{
this.put(TABLE_PAGE_ID, hisData);
}};
}
} else {
setNewEquipInfo(sequenceNbr, maintainInfo);
return new HashMap<String, Map<String, Object>>() {{
put(TABLE_PAGE_ID, maintainInfo);
}};
}
}
private void setNewEquipInfo(Long sequenceNbr, Map<String, Object> maintainInfo) {
JgMaintainNoticeEq jgMaintainNoticeEq = jgMaintainNoticeEqMapper.selectOne(new LambdaQueryWrapper<JgMaintainNoticeEq>().eq(JgMaintainNoticeEq::getEquipTransferId, sequenceNbr));
Map<String, Object> map = idxBizJgRegisterInfoService.getDetailFieldCamelCaseByRecord(jgMaintainNoticeEq.getEquId());
map.put("uuseUnitCreditCode", map.get("useUnitCreditCode"));
map.remove("useUnitCreditCode");
map.remove("address");
map.remove("sequenceNbr");
for (String s : fields) {
if (maintainInfo.containsKey(s) && !ObjectUtils.isEmpty(map.get(s)))
maintainInfo.put(s, JSON.parseArray(maintainInfo.get(s).toString()));
if (map.containsKey(s) && !ObjectUtils.isEmpty(map.get(s)))
map.put(s, JSON.parseArray(map.get(s).toString()));
}
maintainInfo.putAll(map);
return new HashMap<String, Map<String, Object>>() {{
put(TABLE_PAGE_ID, maintainInfo);
}};
}
/**
......@@ -771,6 +787,7 @@ public class JgMaintainNoticeServiceImpl extends BaseService<JgMaintainNoticeDto
LambdaQueryWrapper<JgMaintainNoticeEq> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(JgMaintainNoticeEq::getEquipTransferId, dto.getSequenceNbr());
JgMaintainNoticeEq jgRelationEquip = jgMaintainNoticeEqMapper.selectOne(queryWrapper);
this.saveHisDataBeforeUpdate(jgMaintainNotice, jgRelationEquip.getEquId());
LambdaQueryWrapper<RegistrationInfo> queryWrapper2 = new LambdaQueryWrapper<>();
queryWrapper2.eq(RegistrationInfo::getRecord, jgRelationEquip.getEquId());
RegistrationInfo tzsJgRegistrationInfo = tzsJgRegistrationInfoMapper.selectOne(queryWrapper2);
......@@ -877,6 +894,12 @@ public class JgMaintainNoticeServiceImpl extends BaseService<JgMaintainNoticeDto
}
private void saveHisDataBeforeUpdate(JgMaintainNotice jgMaintainNotice, String equId) {
Map<String, Object> map = idxBizJgRegisterInfoService.getDetailFieldCamelCaseByRecord(equId);
commonService.saveOrUpdateHistory(BusinessTypeEnum.JG_MAINTENANCE_NOTIFICATION.getName(), new JSONObject(map), equId, jgMaintainNotice.getSequenceNbr().toString());
}
private TaskResultDTO assembleData(JgMaintainNotice jgMaintainNotice, String op, String opinion) {
TaskResultDTO taskResultDTO = new TaskResultDTO();
taskResultDTO.setResultCode("approvalStatus");
......
......@@ -53,7 +53,6 @@ import java.text.ParseException;
import java.util.*;
import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors;
import java.util.stream.Stream;
/**
* 改造告知服务实现类
......@@ -117,56 +116,55 @@ public class JgReformNoticeServiceImpl extends BaseService<JgReformNoticeDto, Jg
public Map<String, Object> queryBySequenceNbr(Long sequenceNbr) {
// 改造告知信息
JgReformNotice notice = jgReformNoticeMapper.selectById(sequenceNbr);
if (Objects.isNull(notice)) {
return null;
}
Map<String, Object> installationInfo = BeanUtil.beanToMap(notice);
installationInfo.put("province", notice.getProvince() + "_" + notice.getProvinceName());
installationInfo.put("city", notice.getCity() + "_" + notice.getCityName());
installationInfo.put("county", notice.getCounty() + "_" + notice.getCountyName());
installationInfo.put("fullAddress", notice.getProvinceName() + notice.getCityName() + notice.getCountyName() + notice.getStreetName() + notice.getAddress());
installationInfo.put("useUnitCreditCode", notice.getUseUnitCreditCode() + "_" + notice.getUseUnitName());
// installationInfo.put("receiveOrgCreditCode", notice.getReceiveOrgCode() + "_" + notice.getReceiveOrgName());
installationInfo.put("receiveOrgCode", notice.getReceiveOrgCode() + "_" + notice.getReceiveOrgName());
// if (!ValidationUtil.isEmpty(notice.getInspectUnitId()) && ValidationUtil.isEmpty(notice.getInspectUnitName())) {
// installationInfo.put("inspectUnitId", notice.getInspectUnitId() + "_" + notice.getInspectUnitName());
// }
Map<String, Object> reformNoticeMap = BeanUtil.beanToMap(notice, false ,true);
reformNoticeMap.put("province", notice.getProvince() + "_" + notice.getProvinceName());
reformNoticeMap.put("city", notice.getCity() + "_" + notice.getCityName());
reformNoticeMap.put("county", notice.getCounty() + "_" + notice.getCountyName());
reformNoticeMap.put("fullAddress", notice.getProvinceName() + notice.getCityName() + notice.getCountyName() + notice.getStreetName() + notice.getAddress());
reformNoticeMap.put("useUnitCreditCode", notice.getUseUnitCreditCode() + "_" + notice.getUseUnitName());
reformNoticeMap.put("receiveOrgCode", notice.getReceiveOrgCode() + "_" + notice.getReceiveOrgName());
if (!ValidationUtil.isEmpty(notice.getStreet()) && !ValidationUtil.isEmpty(notice.getStreetName())) {
installationInfo.put("street", notice.getStreet() + "_" + notice.getStreetName());
reformNoticeMap.put("street", notice.getStreet() + "_" + notice.getStreetName());
}
reformNoticeMap.put("constructionManagerId", notice.getConstructionManagerId() + "_" + notice.getConstructionManager());
if(Integer.parseInt(notice.getNoticeStatus()) == FlowStatusEnum.TO_BE_FINISHED.getCode()){
// 完成时显示历史数据
JSONObject hisData = commonService.queryHistoryData(notice.getSequenceNbr());
// 兼容老数据
if(hisData == null){
// 老数据逻辑
Map<String, Object> equipMap = setEquipInfoNew(sequenceNbr);
equipMap.putAll(reformNoticeMap);
return equipMap;
} else {
// 新数据逻辑
// 格式化基本通用信息的时间类型字段
CommonServiceImpl.formatTime2StrDateForEquip(hisData);
hisData.putAll(reformNoticeMap);
return hisData;
}
} else {
// 显示最新的设备信息
Map<String, Object> equipMap = setEquipInfoNew(sequenceNbr);
equipMap.putAll(reformNoticeMap);
return equipMap;
}
String[] fields = {"productPhoto", "designDoc", "designStandard", "factoryStandard",
"productQualityYieldProve", "insUseMaintainExplain", "inspectReport",
"proxyStatementAttachment", "installContractAttachment", "otherAccessories"};
// 设备信息
}
private Map<String, Object> setEquipInfoNew(Long sequenceNbr) {
Map<String, Object> equipMap = new HashMap<>();
List<Map<String, Object>> equipmentInfos = jgReformNoticeMapper.queryEquipInformation(sequenceNbr);
Map<String, Object> equipMap = null;
if (equipmentInfos != null && !equipmentInfos.isEmpty()) {
String equId = (String) equipmentInfos.get(0).get("equId");
if (equId != null) {
equipMap = idxBizJgRegisterInfoService.getDetailFieldCamelCaseByRecord(equId);
equipMap.put("useUnitCreditCodeUse", equipMap.getOrDefault("useUnitCreditCode", ""));
equipMap.put("useUnitNameUse", equipMap.getOrDefault("useUnitName", ""));
equipMap.put("equRegisterCode", equipMap.getOrDefault("equCode", ""));
for (String s : fields) {
if (installationInfo.containsKey(s)) {
installationInfo.put(s, JSON.parse(String.valueOf(installationInfo.get(s))));
}
if (equipMap.containsKey(s)) {
equipMap.put(s, JSON.parse(String.valueOf(equipMap.get(s))));
}
}
}
}
installationInfo.put("constructionManagerId", notice.getConstructionManagerId() + "_" + notice.getConstructionManager());
return Stream.concat(
installationInfo.entrySet().stream(),
equipMap.entrySet().stream()
)
.filter(entry -> entry.getValue() != null)
.collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue, (existing, replacement) -> existing));
return equipMap;
}
/**
......@@ -742,7 +740,8 @@ public class JgReformNoticeServiceImpl extends BaseService<JgReformNoticeDto, Jg
LambdaQueryWrapper<JgReformNoticeEq> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(JgReformNoticeEq::getEquipTransferId, dto.getSequenceNbr());
JgReformNoticeEq jgRelationEquip = jgReformNoticeEqMapper.selectOne(queryWrapper);
// 通过时记录历史数据
this.saveHisDataBeforeUpdate(jgReformNotice, jgRelationEquip.getEquId());
LambdaQueryWrapper<RegistrationInfo> queryWrapper2 = new LambdaQueryWrapper<>();
queryWrapper2.eq(RegistrationInfo::getRecord, jgRelationEquip.getEquId());
RegistrationInfo tzsJgRegistrationInfo = tzsJgRegistrationInfoMapper.selectOne(queryWrapper2);
......@@ -799,6 +798,12 @@ public class JgReformNoticeServiceImpl extends BaseService<JgReformNoticeDto, Jg
}
}
private void saveHisDataBeforeUpdate(JgReformNotice jgReformNotice, String equId) {
Map<String, Object> map = idxBizJgRegisterInfoService.getDetailFieldCamelCaseByRecord(equId);
commonService.saveOrUpdateHistory(BusinessTypeEnum.JG_MODIFICATION_NOTIFICATION.getName(), new JSONObject(map), equId, jgReformNotice.getSequenceNbr().toString());
}
public InstanceRuntimeData buildInstanceRuntimeData(JgReformNotice jgReformNotice) {
return InstanceRuntimeData.builder()
.nextExecuteUserIds(jgReformNotice.getNextExecuteUserIds())
......
......@@ -541,11 +541,12 @@ public class JgScrapCancelServiceImpl extends BaseService<JgScrapCancelDto, JgSc
if(scrapCancel.getAuditStatus().equals(FlowStatusEnum.TO_BE_FINISHED.getName())){
// 完成状态查询历史表
JSONObject jsonObject = commonService.queryHistoryData(sequenceNbr);
// 兼容老业务
// 兼容老数据
if(jsonObject == null){
// 老数据逻辑
fillRuntimeData(sequenceNbr, resultMap);
} else {
CommonServiceImpl.formatTime2StrDateForEquip(jsonObject);
// 新数据逻辑
resultMap.putAll(jsonObject);
}
......
......@@ -111,7 +111,7 @@ public class JgTransferNoticeServiceImpl extends BaseService<JgTransferNoticeDto
if (Objects.isNull(notice)) {
return null;
}
Map<String, Object> transferNotice = BeanUtil.beanToMap(notice);
Map<String, Object> transferNotice = BeanUtil.beanToMap(notice, false, true);
transferNotice.put("province", notice.getProvince() + "_" + notice.getProvinceName());
transferNotice.put("city", notice.getCity() + "_" + notice.getCityName());
transferNotice.put("county", notice.getCounty() + "_" + notice.getCountyName());
......@@ -123,9 +123,7 @@ public class JgTransferNoticeServiceImpl extends BaseService<JgTransferNoticeDto
if (!ValidationUtil.isEmpty(notice.getConstructionManagerId()) && !ValidationUtil.isEmpty(notice.getConstructionManager())) {
transferNotice.put("constructionManagerId", notice.getConstructionManagerId() + "_" + notice.getConstructionManager());
}
String[] fields = {"productPhoto", "designDoc", "designStandard", "factoryStandard",
"productQualityYieldProve", "insUseMaintainExplain", "inspectReport", "otherAccessories",
"proxyStatementAttachment", "installContractAttachment", "powerOfAttorney", "constructionContract"};
String[] fields = {"otherAccessories", "powerOfAttorney", "constructionContract"};
// 设备信息
List<Map<String, Object>> equipmentInfos = jgTransferNoticeMapper.queryEquipInformation(sequenceNbr);
......@@ -140,6 +138,33 @@ public class JgTransferNoticeServiceImpl extends BaseService<JgTransferNoticeDto
}
}
}
if (Integer.parseInt(notice.getNoticeStatus()) == FlowStatusEnum.TO_BE_FINISHED.getCode()) {
// 完成时显示历史数据
JSONObject hisData = commonService.queryHistoryData(notice.getSequenceNbr());
// 兼容老数据
if (hisData == null) {
Map<String, Object> detail = getEquipInfoNew(companyLevel, transferNotice, equipmentInfos);
return new HashMap<String, Map<String, Object>>() {{
this.put("transferNoticeInfo", detail);
}};
} else {
CommonServiceImpl.formatTime2StrDateForEquip(hisData);
hisData.putAll(transferNotice);
return new HashMap<String, Map<String, Object>>() {{
this.put("transferNoticeInfo", hisData);
}};
}
} else {
// 显示最新的设备信息
Map<String, Object> detail = getEquipInfoNew(companyLevel, transferNotice, equipmentInfos);
return new HashMap<String, Map<String, Object>>() {{
this.put("transferNoticeInfo", detail);
}};
}
}
private Map<String, Object> getEquipInfoNew(String companyLevel, Map<String, Object> transferNotice, List<Map<String, Object>> equipmentInfos) {
Map<String, Object> detail = equipmentInfos.get(0);
Map<String, Object> equInfo = idxBizJgRegisterInfoService.getDetailFieldCamelCaseByRecord(detail.get("equId").toString());
equInfo.put("useUnitCreditCodeUse", equInfo.getOrDefault("useUnitCreditCode", ""));
......@@ -154,10 +179,7 @@ public class JgTransferNoticeServiceImpl extends BaseService<JgTransferNoticeDto
BeanUtil.copyProperties(equInfo, detail);
BeanUtil.copyProperties(transferNotice, detail, "equList", "supervisoryCode");
detail.put("companyLevel", companyLevel);
return new HashMap<String, Map<String, Object>>() {{
this.put("transferNoticeInfo", detail);
}};
return detail;
}
@Override
......@@ -196,7 +218,7 @@ public class JgTransferNoticeServiceImpl extends BaseService<JgTransferNoticeDto
throw new IllegalArgumentException("移装告知单不存在");
}
Map<String, Object> placeholders = jgInstallationNoticeService.fullFillTemplateObj(informationList, BusinessTypeEnum.JG_ADVICE_REMOVAL.getName().substring(0,2));
Map<String, Object> placeholders = jgInstallationNoticeService.fullFillTemplateObj(informationList, BusinessTypeEnum.JG_ADVICE_REMOVAL.getName().substring(0, 2));
String tempFileName = "移装告知单_" + System.currentTimeMillis() + "_temp";
String url = WordTemplateUtils.templateToPdf(tempFileName, "installation-notification-report.ftl", placeholders);
......@@ -319,7 +341,7 @@ public class JgTransferNoticeServiceImpl extends BaseService<JgTransferNoticeDto
commonService.buildTaskModel(Collections.singletonList(taskModelDto));
}
}
commonService.saveExecuteFlowData2Redis(notice.getInstanceId(),this.buildInstanceRuntimeData(notice));
commonService.saveExecuteFlowData2Redis(notice.getInstanceId(), this.buildInstanceRuntimeData(notice));
} else {
JgTransferNotice bean = new JgTransferNotice();
BeanUtils.copyProperties(noticeDto, bean);
......@@ -705,6 +727,8 @@ public class JgTransferNoticeServiceImpl extends BaseService<JgTransferNoticeDto
LambdaQueryWrapper<JgTransferNoticeEq> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(JgTransferNoticeEq::getEquipTransferId, dto.getSequenceNbr());
JgTransferNoticeEq jgTransferNoticeEq = jgTransferNoticeEqMapper.selectOne(queryWrapper);
// 历史设备数据记录
this.saveHisDataBeforeUpdate(jgTransferNotice, jgTransferNoticeEq.getEquId());
LambdaQueryWrapper<RegistrationInfo> queryWrapper2 = new LambdaQueryWrapper<>();
queryWrapper2.eq(RegistrationInfo::getRecord, jgTransferNoticeEq.getEquId());
RegistrationInfo tzsJgRegistrationInfo = tzsJgRegistrationInfoMapper.selectOne(queryWrapper2);
......@@ -833,6 +857,12 @@ public class JgTransferNoticeServiceImpl extends BaseService<JgTransferNoticeDto
}
}
private void saveHisDataBeforeUpdate(JgTransferNotice jgTransferNotice, String equId) {
Map<String, Object> map = idxBizJgRegisterInfoService.getDetailFieldCamelCaseByRecord(equId);
commonService.saveOrUpdateHistory(BusinessTypeEnum.JG_ADVICE_REMOVAL.getName(), new JSONObject(map), equId, jgTransferNotice.getSequenceNbr().toString());
}
/**
* 执行工作流并返回组装好的工作流信息
*
......
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