Commit 01800257 authored by 王果's avatar 王果

移装告知打印告知单

parent 4abf062d
...@@ -17,9 +17,7 @@ import com.yeejoin.amos.boot.biz.common.utils.RedisUtils; ...@@ -17,9 +17,7 @@ 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.JgRegistrationHistory; import com.yeejoin.amos.boot.module.jg.api.entity.*;
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;
...@@ -285,30 +283,56 @@ public class JgTransferNoticeServiceImpl extends BaseService<JgTransferNoticeDto ...@@ -285,30 +283,56 @@ 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 jgTransferNotice = this.getById(sequenceNbr); List<JgTransferNoticeEq> equList = jgTransferNoticeEqService.lambdaQuery().eq(JgTransferNoticeEq::getEquipTransferId, notice.getSequenceNbr()).list();
List<Map<String, Object>> informationList = jgTransferNoticeMapper.queryEquipInformation(sequenceNbr); HashMap<String, Object> map = new HashMap<>();
if (Objects.isNull(jgTransferNotice) || CollectionUtils.isEmpty(informationList)) { ArrayList<Map<String, Object>> maps = new ArrayList<>();
throw new IllegalArgumentException("移装告知单不存在"); equList.forEach(equ ->{
} List<Map<String, Object>> informationList = this.getBaseMapper().queryEquipInformation(equ.getSequenceNbr());
if (Objects.isNull(notice) || CollectionUtils.isEmpty(informationList)) {
Map<String, Object> placeholders = jgInstallationNoticeService.fullFillTemplateObj(informationList, BusinessTypeEnum.JG_ADVICE_REMOVAL.getName().substring(0, 2)); throw new IllegalArgumentException("移装告知单不存在");
}
Map<String, Object> placeholders = jgInstallationNoticeService.fullFillTemplateObj(informationList, BusinessTypeEnum.JG_ADVICE_REMOVAL.getName().substring(0, 2));
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);
// //
// // 更新到数据库 // // 更新到数据库
// jgTransferNotice.setNoticeReportUrl(url); // jgInstallationNotice.setNoticeReportUrl(url);
// this.updateById(jgTransferNotice); // this.updateById(jgInstallationNotice);
map.put("equipBasicInfoList", maps);
WordTemplateUtils.templateToPdfDownload(tempFileName, "installation-notification-report.ftl", placeholders, response); WordTemplateUtils.templateToPdfDownload(tempFileName, "installation-notification-report.ftl", map, response);
} }
/** /**
* 更新移装告知 * 更新移装告知
* *
...@@ -547,7 +571,7 @@ public class JgTransferNoticeServiceImpl extends BaseService<JgTransferNoticeDto ...@@ -547,7 +571,7 @@ public class JgTransferNoticeServiceImpl extends BaseService<JgTransferNoticeDto
BeanUtils.copyProperties(obj, taskMessageDto); BeanUtils.copyProperties(obj, taskMessageDto);
dto.setModel(taskMessageDto); dto.setModel(taskMessageDto);
//摘要 按原有规则组装 //摘要 按原有规则组装
dto.setTaskContent(String.format("来自%s【%s】的业务办理,【申请单号:%s】", obj.getEquList(), StringUtils.isEmpty(obj.getSupervisoryCode()) ? "" : obj.getSupervisoryCode(), obj.getApplyNo())); dto.setTaskContent(String.format("来自%s的业务办理,【申请单号:%s】", obj.getEquList(), obj.getApplyNo()));
//申请单号 //申请单号
dto.setTaskCode(obj.getApplyNo()); dto.setTaskCode(obj.getApplyNo());
//业务类型枚举code值 //业务类型枚举code值
...@@ -640,7 +664,7 @@ public class JgTransferNoticeServiceImpl extends BaseService<JgTransferNoticeDto ...@@ -640,7 +664,7 @@ public class JgTransferNoticeServiceImpl extends BaseService<JgTransferNoticeDto
taskModelDto.setStartDate(item.getCreateDate()); taskModelDto.setStartDate(item.getCreateDate());
taskModelDto.setNextExecuteUser(item.getNextExecuteIds()); taskModelDto.setNextExecuteUser(item.getNextExecuteIds());
taskModelDto.setTaskContent(String.format("来自%s【%s】的业务办理,【申请单号:%s】", item.getEquList(), StringUtils.isEmpty(item.getSupervisoryCode()) ? "" : item.getSupervisoryCode(), item.getApplyNo())); taskModelDto.setTaskContent(String.format("来自%s的业务办理,【申请单号:%s】", item.getEquList(), item.getApplyNo()));
TaskMessageDto taskMessageDto = new TaskMessageDto(); TaskMessageDto taskMessageDto = new TaskMessageDto();
BeanUtils.copyProperties(item, taskMessageDto); BeanUtils.copyProperties(item, taskMessageDto);
taskModelDto.setModel(taskMessageDto); taskModelDto.setModel(taskMessageDto);
......
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