Commit 7dacd2b3 authored by 韩桐桐's avatar 韩桐桐

fix(jg):压力管道打印安装告知书调整

parent 31a4333a
...@@ -612,6 +612,15 @@ public class JgInstallationNoticeServiceImpl extends BaseService<JgInstallationN ...@@ -612,6 +612,15 @@ public class JgInstallationNoticeServiceImpl extends BaseService<JgInstallationN
List<JgInstallationNoticeEq> equList = jgInstallationNoticeEqService.lambdaQuery().eq(JgInstallationNoticeEq::getEquipTransferId, jgInstallationNotice.getSequenceNbr()).list(); List<JgInstallationNoticeEq> equList = jgInstallationNoticeEqService.lambdaQuery().eq(JgInstallationNoticeEq::getEquipTransferId, jgInstallationNotice.getSequenceNbr()).list();
HashMap<String, Object> map = new HashMap<>(); HashMap<String, Object> map = new HashMap<>();
ArrayList<Map<String, Object>> maps = new ArrayList<>(); ArrayList<Map<String, Object>> maps = new ArrayList<>();
// 管道按照装置打一份告知书
if ("8000".equals(jgInstallationNotice.getEquListCode()) && !equList.isEmpty()) {
List<Map<String, Object>> informationList = jgInstallationNoticeMapper.queryEquipInformation(equList.get(0).getSequenceNbr());
if (CollectionUtils.isEmpty(informationList)) {
throw new IllegalArgumentException("安装告知单不存在");
}
Map<String, Object> placeholders = fullFillTemplateObj(informationList, BusinessTypeEnum.JG_INSTALLATION_NOTIFICATION.getName().substring(0, 2));
maps.add(placeholders);
} else {
equList.forEach(equ -> { equList.forEach(equ -> {
List<Map<String, Object>> informationList = jgInstallationNoticeMapper.queryEquipInformation(equ.getSequenceNbr()); List<Map<String, Object>> informationList = jgInstallationNoticeMapper.queryEquipInformation(equ.getSequenceNbr());
if (CollectionUtils.isEmpty(informationList)) { if (CollectionUtils.isEmpty(informationList)) {
...@@ -620,6 +629,8 @@ public class JgInstallationNoticeServiceImpl extends BaseService<JgInstallationN ...@@ -620,6 +629,8 @@ public class JgInstallationNoticeServiceImpl extends BaseService<JgInstallationN
Map<String, Object> placeholders = fullFillTemplateObj(informationList, BusinessTypeEnum.JG_INSTALLATION_NOTIFICATION.getName().substring(0, 2)); Map<String, Object> placeholders = fullFillTemplateObj(informationList, BusinessTypeEnum.JG_INSTALLATION_NOTIFICATION.getName().substring(0, 2));
maps.add(placeholders); maps.add(placeholders);
}); });
}
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);
...@@ -633,7 +644,7 @@ public class JgInstallationNoticeServiceImpl extends BaseService<JgInstallationN ...@@ -633,7 +644,7 @@ public class JgInstallationNoticeServiceImpl extends BaseService<JgInstallationN
public Map<String, Object> fullFillTemplateObj(List<Map<String, Object>> informationList, String businessType) { public Map<String, Object> fullFillTemplateObj(List<Map<String, Object>> informationList, String businessType) {
Map<String, Object> informObj = informationList.get(0); Map<String, Object> informObj = informationList.get(0);
String sequenceNbr = String.valueOf(informObj.get("sequenceNbr"));
String useCode = String.valueOf(informObj.get("installUnitCreditCode")); String useCode = String.valueOf(informObj.get("installUnitCreditCode"));
LambdaQueryWrapper<TzBaseUnitLicence> wrapper = new LambdaQueryWrapper<>(); LambdaQueryWrapper<TzBaseUnitLicence> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(TzBaseUnitLicence::getUnitCode, useCode); wrapper.eq(TzBaseUnitLicence::getUnitCode, useCode);
...@@ -672,9 +683,7 @@ public class JgInstallationNoticeServiceImpl extends BaseService<JgInstallationN ...@@ -672,9 +683,7 @@ public class JgInstallationNoticeServiceImpl extends BaseService<JgInstallationN
placeholders.put("equList", getValue.apply("equList")); placeholders.put("equList", getValue.apply("equList"));
placeholders.put("installUnitName", getValue.apply("installUnitName")); placeholders.put("installUnitName", getValue.apply("installUnitName"));
placeholders.put("informNumber", getValue.apply("informNumber")); placeholders.put("informNumber", getValue.apply("informNumber"));
placeholders.put("productName", getValue.apply("productName"));
placeholders.put("equipCode", getValue.apply("equRegisterCode")); placeholders.put("equipCode", getValue.apply("equRegisterCode"));
placeholders.put("produceCode", getValue.apply("factoryNum")); // 出厂编号
placeholders.put("produceUnitName", getValue.apply("produceUnitName")); placeholders.put("produceUnitName", getValue.apply("produceUnitName"));
placeholders.put("produceLicenseNum", getValue.apply("produceLicenseNum")); placeholders.put("produceLicenseNum", getValue.apply("produceLicenseNum"));
placeholders.put("installUnitAddress", getValue.apply("installUnitAddress")); // 施工单位地址 placeholders.put("installUnitAddress", getValue.apply("installUnitAddress")); // 施工单位地址
...@@ -688,11 +697,18 @@ public class JgInstallationNoticeServiceImpl extends BaseService<JgInstallationN ...@@ -688,11 +697,18 @@ public class JgInstallationNoticeServiceImpl extends BaseService<JgInstallationN
placeholders.put("useUnitLeaderPhone", getValue.apply("safetyManagerPhone")); placeholders.put("useUnitLeaderPhone", getValue.apply("safetyManagerPhone"));
placeholders.put("useUnitLeaderAddress", getValue.apply("useUnitLeaderAddress")); placeholders.put("useUnitLeaderAddress", getValue.apply("useUnitLeaderAddress"));
if ("压力管道".equals(getValue.apply("equList"))) { if ("压力管道".equals(getValue.apply("equList"))) {
ArrayList<String> equipTypeList = new ArrayList<>();// todo JgRegistrationHistory history = jgRegistrationHistoryMapper.selectOne(new LambdaQueryWrapper<JgRegistrationHistory>().eq(JgRegistrationHistory::getCurrentDocumentId, sequenceNbr));
equipTypeList.add("123123"); JSONObject historyJson = JSON.parseObject(history.getChangeData());
List<Map<String, Object>> deviceList = (List<Map<String, Object>>) historyJson.get("deviceList");
List<Object> equipTypeList = deviceList.stream().limit(3).map(item -> item.get("pipelineNumber") + "(" + item.get("nominalDiameter") + "/" + item.get("wallThickness") + "/" + item.get("pipeLength") + ")").collect(Collectors.toList());
List<Object> factoryNumList = deviceList.stream().limit(3).map(item -> item.get("pipelineNumber")).collect(Collectors.toList());
placeholders.put("equipTypeList", equipTypeList); placeholders.put("equipTypeList", equipTypeList);
placeholders.put("produceCodeList", factoryNumList);
placeholders.put("productName", historyJson.get("projectContraption"));
} else { } else {
placeholders.put("equipType", getValue.apply("equType")); placeholders.put("equipType", getValue.apply("equType"));
placeholders.put("produceCode", getValue.apply("factoryNum"));
placeholders.put("productName", getValue.apply("productName"));
} }
......
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