Commit 01800257 authored by 王果's avatar 王果

移装告知打印告知单

parent 4abf062d
......@@ -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.dto.ESEquipmentCategoryDto;
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.JgTransferNotice;
import com.yeejoin.amos.boot.module.jg.api.entity.JgTransferNoticeEq;
import com.yeejoin.amos.boot.module.jg.api.entity.*;
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.JgTransferNoticeEqMapper;
......@@ -285,30 +283,56 @@ public class JgTransferNoticeServiceImpl extends BaseService<JgTransferNoticeDto
* @return pdf文件路径
*/
@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) {
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));
JgTransferNotice notice = this.getById(sequenceNbr);
List<JgTransferNoticeEq> equList = jgTransferNoticeEqService.lambdaQuery().eq(JgTransferNoticeEq::getEquipTransferId, notice.getSequenceNbr()).list();
HashMap<String, Object> map = new HashMap<>();
ArrayList<Map<String, Object>> maps = new ArrayList<>();
equList.forEach(equ ->{
List<Map<String, Object>> informationList = this.getBaseMapper().queryEquipInformation(equ.getSequenceNbr());
if (Objects.isNull(notice) || CollectionUtils.isEmpty(informationList)) {
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 url = WordTemplateUtils.templateToPdf(tempFileName, "installation-notification-report.ftl", placeholders);
//
// // 更新到数据库
// jgTransferNotice.setNoticeReportUrl(url);
// this.updateById(jgTransferNotice);
WordTemplateUtils.templateToPdfDownload(tempFileName, "installation-notification-report.ftl", placeholders, response);
// String url = WordTemplateUtils.templateToPdf(tempFileName, "installation-notification-report.ftl", placeholders);
//
// // 更新到数据库
// jgInstallationNotice.setNoticeReportUrl(url);
// this.updateById(jgInstallationNotice);
map.put("equipBasicInfoList", maps);
WordTemplateUtils.templateToPdfDownload(tempFileName, "installation-notification-report.ftl", map, response);
}
/**
* 更新移装告知
*
......@@ -547,7 +571,7 @@ public class JgTransferNoticeServiceImpl extends BaseService<JgTransferNoticeDto
BeanUtils.copyProperties(obj, 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());
//业务类型枚举code值
......@@ -640,7 +664,7 @@ public class JgTransferNoticeServiceImpl extends BaseService<JgTransferNoticeDto
taskModelDto.setStartDate(item.getCreateDate());
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();
BeanUtils.copyProperties(item, 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