Commit c8498463 authored by 韩桐桐's avatar 韩桐桐

fix(jg):改造告知

parent 3b074585
......@@ -32,13 +32,8 @@ public interface JgReformNoticeMapper extends CustomBaseMapper<JgReformNotice> {
@Param("type") String type, @Param("orgCode") String orgCode,
@Param("currentUserId") String currentUserId);
/**
* 根据改造告知编号查询设备、设计、制造等信息
*
* @param sequenceNbr 改造告知编号
*/
@MapKey ("sequenceNbr")
List<Map<String, Object>> queryEquipInformation(@Param("sequenceNbr") long sequenceNbr);
Map<String, Object> queryEquipInformation(@Param("sequenceNbr") long sequenceNbr);
void updatePromoter(@Param("id") Long id);
......
......@@ -118,7 +118,7 @@
isn.plan_date AS installStartDate,
isn.construction_manager AS installLeaderName,
isn.construction_manager_phone AS installLeaderPhone,
isn.inform_number AS informNumber,
re.inform_number AS informNumber,
ri.equ_code AS equRegisterCode,
fi.FACTORY_NUM AS produceCode,
ri.product_name AS productName,
......@@ -157,12 +157,12 @@
(select tec.name from tz_equipment_category tec WHERE ri."EQU_CATEGORY"::text = tec.code::text) AS equDefine,
(select oi.SUPERVISORY_CODE from idx_biz_jg_other_info oi WHERE ri.RECORD = oi.RECORD) AS supervisoryCode,
re.equ_id AS equId
FROM tzs_jg_reform_notice isn
LEFT JOIN tzs_jg_reform_notice_eq re ON re.equip_transfer_id = isn.sequence_nbr
FROM tzs_jg_reform_notice_eq re
LEFT JOIN tzs_jg_reform_notice isn ON re.equip_transfer_id = isn.sequence_nbr
LEFT JOIN idx_biz_jg_register_info ri ON ri.record = re.equ_id
LEFT JOIN idx_biz_jg_design_info di ON di.record = re.equ_id
LEFT JOIN idx_biz_jg_factory_info fi ON fi.record = re.equ_id
WHERE isn.sequence_nbr = #{sequenceNbr}
WHERE re.sequence_nbr = #{sequenceNbr}
LIMIT 1
</select>
......
......@@ -143,14 +143,7 @@ public class JgReformNoticeServiceImpl extends BaseService<JgReformNoticeDto, Jg
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 {
// 新数据逻辑
if (!ValidationUtil.isEmpty(hisData)) {
// 格式化基本通用信息的时间类型字段
CommonServiceImpl.formatTime2StrDateForEquip(hisData);
hisData.putAll(reformNoticeMap);
......@@ -164,8 +157,13 @@ public class JgReformNoticeServiceImpl extends BaseService<JgReformNoticeDto, Jg
Iterable<ESEquipmentCategoryDto> equips = esEquipmentCategory.findAllById(ids);
List<Map<String, Object>> equipListMaps = getEquipListMaps(equips);
reformNoticeMap.put("deviceList", equipListMaps);
reformNoticeMap.put("EQU_LIST_CODE", notice.getEquListCode());
reformNoticeMap.put("EQU_CATEGORY_CODE", notice.getEquCategoryCode());
reformNoticeMap.put("QUERY_TYPE", "GZ_GZ");
reformNoticeMap.put("IS_INTO_MANAGEMENT", Boolean.TRUE);
return reformNoticeMap;
}
return new HashMap<>();
}
private List<Map<String, Object>> getEquipListMaps(Iterable<ESEquipmentCategoryDto> equips) {
......@@ -188,21 +186,6 @@ public class JgReformNoticeServiceImpl extends BaseService<JgReformNoticeDto, Jg
return String.format("%s%s", usePlace, address);
}
private Map<String, Object> setEquipInfoNew(Long sequenceNbr) {
Map<String, Object> equipMap = new HashMap<>();
List<Map<String, Object>> equipmentInfos = jgReformNoticeMapper.queryEquipInformation(sequenceNbr);
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", ""));
}
}
return equipMap;
}
/**
* 更新改造告知
*
......@@ -380,21 +363,27 @@ public class JgReformNoticeServiceImpl extends BaseService<JgReformNoticeDto, Jg
throw new IllegalArgumentException("参数不能为空");
}
JgReformNotice JgReformNotice = this.getById(sequenceNbr);
List<Map<String, Object>> informationList = jgReformNoticeMapper.queryEquipInformation(sequenceNbr);
if (Objects.isNull(JgReformNotice) || CollectionUtils.isEmpty(informationList)) {
JgReformNotice notice = this.getById(sequenceNbr);
List<JgReformNoticeEq> noticeEqs = jgReformNoticeEqMapper.selectList(new LambdaQueryWrapper<JgReformNoticeEq>().eq(JgReformNoticeEq::getEquipTransferId, notice.getSequenceNbr()));
if (CollectionUtils.isEmpty(noticeEqs)) {
throw new IllegalArgumentException("改造告知单不存在");
}
Map<String, Object> placeholders = jgInstallationNoticeService.fullFillTemplateObj(informationList, BusinessTypeEnum.JG_MODIFICATION_NOTIFICATION.getName().substring(0, 2));
String tempFileName = "改造告知单_" + System.currentTimeMillis() + "_temp";
// String url = WordTemplateUtils.templateToPdf(tempFileName, "installation-notification-report.ftl", placeholders);
//
// // 更新到数据库
// JgReformNotice.setNoticeReportUrl(url);
// this.updateById(JgReformNotice);
Map<String, Object> data = new HashMap<>();
ArrayList<Map<String, Object>> maps = new ArrayList<>();
for (JgReformNoticeEq noticeEq : noticeEqs) {
WordTemplateUtils.templateToPdfDownload(tempFileName, "installation-notification-report.ftl", placeholders, response);
Map<String, Object> information = jgReformNoticeMapper.queryEquipInformation(noticeEq.getSequenceNbr());
if (CollectionUtils.isEmpty(information)) {
throw new IllegalArgumentException("改造告知单不存在");
}
Map<String, Object> stringObjectMap = jgInstallationNoticeService.fullFillTemplateObj(Collections.singletonList(information), BusinessTypeEnum.JG_MODIFICATION_NOTIFICATION.getName().substring(0, 2));
maps.add(stringObjectMap);
}
data.put("equipBasicInfoList", maps);
WordTemplateUtils.templateToPdfDownload(tempFileName, "installation-notification-report.ftl", data, response);
}
......@@ -564,7 +553,7 @@ public class JgReformNoticeServiceImpl extends BaseService<JgReformNoticeDto, Jg
private TaskModelDto buildTempTaskModelDto(JgReformNotice item) {
return TaskModelDto.builder()
.model(item)
.taskContent(String.format("来自%s【%s】的业务办理,【申请单号:%s】", item.getEquList(), Objects.toString(item.getSupervisoryCode(), ""), item.getApplyNo()))
.taskContent(String.format("来自%s的业务办理,【申请单号:%s】", item.getEquListName(), item.getApplyNo()))
.taskCode(item.getApplyNo())
.taskType(BusinessTypeEnum.JG_MODIFICATION_NOTIFICATION.getCode())
.relationId(item.getSequenceNbr() + "")
......@@ -606,8 +595,8 @@ public class JgReformNoticeServiceImpl extends BaseService<JgReformNoticeDto, Jg
.flowStatus(FlowStatusEnum.TO_BE_PROCESSED.getCode())
.flowCode(workflowResultDto.getNextTaskId())
.flowStatusLabel(FlowStatusEnum.TO_BE_PROCESSED.getName())
.taskContent(String.format("来自%s【%s】的业务办理,【申请单号:%s】", item.getEquList(), item.getSupervisoryCode(), item.getApplyNo()))
.taskDesc(String.format("来自%s【%s】的业务办理,【申请单号:%s】", item.getEquList(), item.getSupervisoryCode(), item.getApplyNo()))
.taskContent(String.format("来自%s的业务办理,【申请单号:%s】", item.getEquList(), item.getApplyNo()))
.taskDesc(String.format("来自%s的业务办理,【申请单号:%s】", item.getEquList(), item.getApplyNo()))
.startUserId(item.getCreateUserId())
.startUser(item.getCreateUserName())
.startUserCompanyName(item.getCreateUserCompanyName())
......@@ -833,7 +822,7 @@ public class JgReformNoticeServiceImpl extends BaseService<JgReformNoticeDto, Jg
LambdaQueryWrapper<JgReformNoticeEq> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(JgReformNoticeEq::getEquipTransferId, jgReformNoticeDto.getSequenceNbr());
List<JgReformNoticeEq> noticeEqs = jgReformNoticeEqMapper.selectList(queryWrapper);
noticeEqs.forEach(noticeEq ->{
noticeEqs.forEach(noticeEq -> {
// 安装告知书编号
String ym = null;
try {
......@@ -899,7 +888,7 @@ public class JgReformNoticeServiceImpl extends BaseService<JgReformNoticeDto, Jg
}
private void saveHisDataBeforeUpdate(JgReformNotice jgReformNotice,JSONObject jsonObject) {
private void saveHisDataBeforeUpdate(JgReformNotice jgReformNotice, JSONObject jsonObject) {
commonService.saveOrUpdateHistory(BusinessTypeEnum.JG_MODIFICATION_NOTIFICATION.getName(),
new JSONObject(jsonObject), null, String.valueOf(jgReformNotice.getSequenceNbr()));
}
......@@ -951,8 +940,8 @@ public class JgReformNoticeServiceImpl extends BaseService<JgReformNoticeDto, Jg
.flowStatus(statusEnum.getCode())
.flowCode(workflowResultDto.getNextTaskId())
.flowStatusLabel(statusEnum.getName())
.taskContent(String.format("来自%s【%s】的业务办理,【申请单号:%s】", transfer.getEquList(), Objects.toString(transfer.getSupervisoryCode(), ""), transfer.getApplyNo()))
.taskDesc(String.format("来自%s【%s】的业务办理,【申请单号:%s】", transfer.getEquList(), Objects.toString(transfer.getSupervisoryCode(), ""), transfer.getApplyNo()))
.taskContent(String.format("来自%s的业务办理,【申请单号:%s】", transfer.getEquList(), transfer.getApplyNo()))
.taskDesc(String.format("来自%s的业务办理,【申请单号:%s】", transfer.getEquList(), transfer.getApplyNo()))
.startUserCompanyName(transfer.getCreateUserCompanyName())
.startUserId(taskV2Model.getStartUserId())
.startUser(taskV2Model.getStartUser())
......
......@@ -21,7 +21,7 @@ public class UseRegisterEquipUsedCheckImpl extends BaseEquipUsedCheckService {
private RedissonClient redissonClient;
private String bizType = "useRegistration";
private String bizType = "useRegister";
private JgUseRegistrationMapper useRegistrationMapper;
......
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