Commit 3b074585 authored by tianyiming's avatar tianyiming

维修告知单下载

parent ce504948
......@@ -152,7 +152,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_list AS equList,
ri.equ_category AS equCategory,
ri.EQU_DEFINE AS equDefine,
......@@ -199,7 +199,7 @@
LEFT JOIN idx_biz_jg_factory_info fi ON fi.record = re.equ_id
LEFT JOIN tz_base_enterprise_info useUnit ON useUnit.use_code = isn.use_unit_credit_code
LEFT JOIN tz_base_enterprise_info installUnit ON installUnit.use_code = isn.install_unit_credit_code
WHERE isn.sequence_nbr = #{sequenceNbr} LIMIT 1
WHERE re.sequence_nbr = #{sequenceNbr}
</select>
<select id="getEquipInfoByRecord" resultType="java.util.Map">
......
package com.yeejoin.amos.boot.module.jg.biz.service.impl;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.text.CharSequenceUtil;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
......@@ -29,7 +28,6 @@ import com.yeejoin.amos.boot.module.jg.api.mapper.JgInstallationNoticeMapper;
import com.yeejoin.amos.boot.module.jg.api.mapper.JgRegistrationHistoryMapper;
import com.yeejoin.amos.boot.module.jg.api.mapper.JgUseRegistrationMapper;
import com.yeejoin.amos.boot.module.jg.api.service.IJgInstallationNoticeService;
import com.yeejoin.amos.boot.module.jg.api.service.IJgRegistrationHistoryService;
import com.yeejoin.amos.boot.module.jg.api.vo.SortVo;
import com.yeejoin.amos.boot.module.jg.biz.config.LocalBadRequest;
import com.yeejoin.amos.boot.module.jg.biz.context.EquipUsedCheckStrategyContext;
......@@ -77,7 +75,6 @@ import org.typroject.tyboot.core.restful.exception.instance.BadRequest;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
import javax.servlet.http.HttpServletResponse;
import java.lang.reflect.Field;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.*;
......
......@@ -459,18 +459,27 @@ public class JgMaintainNoticeServiceImpl extends BaseService<JgMaintainNoticeDto
throw new IllegalArgumentException("参数不能为空");
}
JgMaintainNotice JgMaintainNotice = this.getById(sequenceNbr);
List<Map<String, Object>> informationList = jgMaintainNoticeMapper.queryEquipInformation(sequenceNbr);
if (Objects.isNull(JgMaintainNotice) || CollectionUtils.isEmpty(informationList)) {
throw new IllegalArgumentException("维修告知单不存在");
List<JgMaintainNoticeEq> list = jgMaintainNoticeEqService.lambdaQuery().eq(JgMaintainNoticeEq::getEquipTransferId, sequenceNbr).list();
HashMap<String, Object> map = new HashMap<>();
List<Map<String, Object>> placeholderList = new ArrayList<>();
if(!CollectionUtils.isEmpty(list)){
for (JgMaintainNoticeEq jgMaintainNoticeEq : list) {
List<Map<String, Object>> informationList = jgMaintainNoticeMapper.queryEquipInformation(jgMaintainNoticeEq.getSequenceNbr());
if (Objects.isNull(JgMaintainNotice) || CollectionUtils.isEmpty(informationList)) {
throw new IllegalArgumentException("维修告知单不存在");
}
Map<String, Object> placeholders = jgInstallationNoticeService.fullFillTemplateObj(informationList, BusinessTypeEnum.JG_MAINTENANCE_NOTIFICATION.getName().substring(0, 2));
placeholderList.add(placeholders);
}
}
Map<String, Object> placeholders = jgInstallationNoticeService.fullFillTemplateObj(informationList, BusinessTypeEnum.JG_MAINTENANCE_NOTIFICATION.getName().substring(0, 2));
map.put("equipBasicInfoList", placeholderList);
String tempFileName = "维修告知单_" + System.currentTimeMillis() + "_temp";
// String url = WordTemplateUtils.templateToPdf(tempFileName, "installation-notification-report.ftl", placeholders);
// // 更新到数据库
// JgMaintainNotice.setNoticeReportUrl(url);
// this.updateById(JgMaintainNotice);
WordTemplateUtils.templateToPdfDownload(tempFileName, "installation-notification-report.ftl", placeholders, response);
WordTemplateUtils.templateToPdfDownload(tempFileName, "installation-notification-report.ftl", map, response);
}
@Override
......
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