Commit 0d45acd3 authored by 王果's avatar 王果

移装告知打印告知单

parent 01800257
...@@ -25,6 +25,8 @@ ...@@ -25,6 +25,8 @@
tjtn.create_user_id as createUserId, tjtn.create_user_id as createUserId,
tjtn.next_execute_user_ids as nextExecuteUserIds, tjtn.next_execute_user_ids as nextExecuteUserIds,
tjtn.next_task_id AS nextTaskId, tjtn.next_task_id AS nextTaskId,
tjtn.equ_category AS equCategory,
tjtn.equ_list AS equList,
DATE_FORMAT(tjtn.notice_date,'%Y-%m-%d') AS noticeDate, DATE_FORMAT(tjtn.notice_date,'%Y-%m-%d') AS noticeDate,
DATE_FORMAT(tjtn.handle_date,'%Y-%m-%d') AS handleDate, DATE_FORMAT(tjtn.handle_date,'%Y-%m-%d') AS handleDate,
DATE_FORMAT(tjtn.plan_date,'%Y-%m-%d') AS planDate DATE_FORMAT(tjtn.plan_date,'%Y-%m-%d') AS planDate
...@@ -125,7 +127,7 @@ ...@@ -125,7 +127,7 @@
tjtn.plan_date AS installStartDate, tjtn.plan_date AS installStartDate,
tjtn.construction_manager AS installLeaderName, tjtn.construction_manager AS installLeaderName,
tjtn.construction_manager_phone AS installLeaderPhone, tjtn.construction_manager_phone AS installLeaderPhone,
tjtn.inform_number AS informNumber, re.inform_number AS informNumber,
re.equ_id as equId, re.equ_id as equId,
ri.EQU_CODE AS equRegisterCode, ri.EQU_CODE AS equRegisterCode,
ri.PRODUCT_NAME AS productName, ri.PRODUCT_NAME AS productName,
...@@ -176,7 +178,6 @@ ...@@ -176,7 +178,6 @@
LEFT JOIN idx_biz_jg_factory_info fi ON fi.record = re.equ_id LEFT JOIN idx_biz_jg_factory_info fi ON fi.record = re.equ_id
WHERE WHERE
tjtn.sequence_nbr = #{sequenceNbr} tjtn.sequence_nbr = #{sequenceNbr}
LIMIT 1
</select> </select>
<select id="queryForFlowingEquipList" resultType="com.yeejoin.amos.boot.module.jg.api.dto.CompanyEquipCountDto"> <select id="queryForFlowingEquipList" resultType="com.yeejoin.amos.boot.module.jg.api.dto.CompanyEquipCountDto">
select select
......
...@@ -17,7 +17,9 @@ import com.yeejoin.amos.boot.biz.common.utils.RedisUtils; ...@@ -17,7 +17,9 @@ import com.yeejoin.amos.boot.biz.common.utils.RedisUtils;
import com.yeejoin.amos.boot.module.common.api.dao.ESEquipmentCategory; import com.yeejoin.amos.boot.module.common.api.dao.ESEquipmentCategory;
import com.yeejoin.amos.boot.module.common.api.dto.ESEquipmentCategoryDto; import com.yeejoin.amos.boot.module.common.api.dto.ESEquipmentCategoryDto;
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.*; import com.yeejoin.amos.boot.module.jg.api.entity.JgRegistrationHistory;
import com.yeejoin.amos.boot.module.jg.api.entity.JgTransferNotice;
import com.yeejoin.amos.boot.module.jg.api.entity.JgTransferNoticeEq;
import com.yeejoin.amos.boot.module.jg.api.enums.BusinessTypeEnum; import com.yeejoin.amos.boot.module.jg.api.enums.BusinessTypeEnum;
import com.yeejoin.amos.boot.module.jg.api.mapper.JgRegistrationHistoryMapper; import com.yeejoin.amos.boot.module.jg.api.mapper.JgRegistrationHistoryMapper;
import com.yeejoin.amos.boot.module.jg.api.mapper.JgTransferNoticeEqMapper; import com.yeejoin.amos.boot.module.jg.api.mapper.JgTransferNoticeEqMapper;
...@@ -283,52 +285,24 @@ public class JgTransferNoticeServiceImpl extends BaseService<JgTransferNoticeDto ...@@ -283,52 +285,24 @@ public class JgTransferNoticeServiceImpl extends BaseService<JgTransferNoticeDto
* @return pdf文件路径 * @return pdf文件路径
*/ */
@Override @Override
// public void generateTransferNoticeReport(Long sequenceNbr, HttpServletResponse response) {
// if (Objects.isNull(sequenceNbr)) {
// throw new IllegalArgumentException("参数不能为空");
// }
//
// JgTransferNotice jgTransferNotice = this.getById(sequenceNbr);
// List<Map<String, Object>> informationList = jgTransferNoticeMapper.queryEquipInformation(sequenceNbr);
// if (Objects.isNull(jgTransferNotice) || CollectionUtils.isEmpty(informationList)) {
// throw new IllegalArgumentException("移装告知单不存在");
// }
//
// 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);
// //
// // // 更新到数据库
// // jgTransferNotice.setNoticeReportUrl(url);
// // this.updateById(jgTransferNotice);
//
// WordTemplateUtils.templateToPdfDownload(tempFileName, "installation-notification-report.ftl", placeholders, response);
// }
public void generateTransferNoticeReport(Long sequenceNbr, HttpServletResponse response) { public void generateTransferNoticeReport(Long sequenceNbr, HttpServletResponse response) {
if (Objects.isNull(sequenceNbr)) { if (Objects.isNull(sequenceNbr)) {
throw new IllegalArgumentException("参数不能为空"); throw new IllegalArgumentException("参数不能为空");
} }
JgTransferNotice notice = this.getById(sequenceNbr); JgTransferNotice notice = this.getById(sequenceNbr);
List<JgTransferNoticeEq> equList = jgTransferNoticeEqService.lambdaQuery().eq(JgTransferNoticeEq::getEquipTransferId, notice.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<>();
equList.forEach(equ ->{ List<Map<String, Object>> informationList = this.getBaseMapper().queryEquipInformation(notice.getSequenceNbr());
List<Map<String, Object>> informationList = this.getBaseMapper().queryEquipInformation(equ.getSequenceNbr()); if (CollectionUtils.isEmpty(informationList)) {
if (Objects.isNull(notice) || CollectionUtils.isEmpty(informationList)) { throw new IllegalArgumentException("移装告知单不存在");
throw new IllegalArgumentException("移装告知单不存在"); }
} for (Map<String, Object> objectMap : informationList) {
Map<String, Object> placeholders = jgInstallationNoticeService.fullFillTemplateObj(informationList, BusinessTypeEnum.JG_ADVICE_REMOVAL.getName().substring(0, 2)); List<Map<String, Object>> temp = new ArrayList<>();
temp.add(objectMap);
Map<String, Object> placeholders = jgInstallationNoticeService.fullFillTemplateObj(temp, BusinessTypeEnum.JG_ADVICE_REMOVAL.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);
//
// // 更新到数据库
// jgInstallationNotice.setNoticeReportUrl(url);
// this.updateById(jgInstallationNotice);
map.put("equipBasicInfoList", maps); map.put("equipBasicInfoList", maps);
WordTemplateUtils.templateToPdfDownload(tempFileName, "installation-notification-report.ftl", map, response); WordTemplateUtils.templateToPdfDownload(tempFileName, "installation-notification-report.ftl", map, response);
} }
......
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