Commit 8761383f authored by suhuiguang's avatar suhuiguang

4个告知详情调整

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