From 8ec39ef8983be8ce8e31fb1e782b2ce4c9f378df Mon Sep 17 00:00:00 2001 From: fl <3098731433@qq.com> Date: Tue, 29 Apr 2025 17:10:10 +0800 Subject: [PATCH] =?UTF-8?q?=E6=A8=A1=E7=89=88=E4=B8=8B=E8=BD=BD=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../search/StateGridController.java | 8 +- .../com/bonus/tool/dto/ComCorePersonBean.java | 20 +- .../bonus/tool/dto/SubOtherPeopleBean.java | 7 +- .../com/bonus/tool/dto/TbCompanyPerfVo.java | 2 + .../bonus/tool/service/StateGridService.java | 4 +- .../service/impl/StateGridServiceImpl.java | 399 +++++++++++++++++- .../java/com/bonus/tool/template/TestGW.java | 1 - .../tool/template/util/FreeMarkerUtil.java | 6 +- .../bonus/tool/template/util/WordUtils.java | 9 - .../src/main/resources/mapper/EpcMapper.xml | 4 +- .../src/main/resources/mapper/SouthMapper.xml | 4 +- .../main/resources/mapper/StateGridMapper.xml | 6 + .../resources/mapper/TbCompanyPerfMapper.xml | 6 + 13 files changed, 449 insertions(+), 27 deletions(-) diff --git a/search-tool/src/main/java/com/bonus/tool/controller/search/StateGridController.java b/search-tool/src/main/java/com/bonus/tool/controller/search/StateGridController.java index 52502a5..0c072a7 100644 --- a/search-tool/src/main/java/com/bonus/tool/controller/search/StateGridController.java +++ b/search-tool/src/main/java/com/bonus/tool/controller/search/StateGridController.java @@ -12,6 +12,7 @@ import lombok.extern.slf4j.Slf4j; import org.springframework.web.bind.annotation.*; import javax.annotation.Resource; +import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.util.List; @@ -125,12 +126,11 @@ public class StateGridController extends BaseController { @ApiOperation(value = "国网模版下载") // @PreAuthorize("@ss.hasPermi('key:people:add')") @PostMapping("/downloadStateGridTemp") - public AjaxResult downloadStateGridTemp(@RequestBody TbGwModelDto o) { + public void downloadStateGridTemp(HttpServletRequest request, HttpServletResponse response, @RequestBody TbGwModelDto o) { try { - return service.downloadStateGridTemp(o); + service.downloadStateGridTemp(request, response, o); }catch (Exception e){ - log.info("国网模版修改失败{}",e.getMessage()); - return error(e.getMessage()); + log.info("国网模版下载失败{}",e.getMessage()); } } diff --git a/search-tool/src/main/java/com/bonus/tool/dto/ComCorePersonBean.java b/search-tool/src/main/java/com/bonus/tool/dto/ComCorePersonBean.java index b67be6e..74def81 100644 --- a/search-tool/src/main/java/com/bonus/tool/dto/ComCorePersonBean.java +++ b/search-tool/src/main/java/com/bonus/tool/dto/ComCorePersonBean.java @@ -48,6 +48,15 @@ public class ComCorePersonBean extends PersonFileBean{ */ private String diploma; + /** + * 资格证书编号 + */ + private String diplomaNum; + + /** + * 学历 + */ + private String education; /** * 在本施工队伍中的职责分工 @@ -65,8 +74,17 @@ public class ComCorePersonBean extends PersonFileBean{ private String exitDate; /** - * 同类工程业绩 + * 同类工程业绩(多个,逗号隔开) + */ + private String perfId; + + /** + * 同类工程业绩(多个,逗号隔开) */ private String proPerf; + /** + * 单人业绩(word用) + */ + private List peoplePerfList; } diff --git a/search-tool/src/main/java/com/bonus/tool/dto/SubOtherPeopleBean.java b/search-tool/src/main/java/com/bonus/tool/dto/SubOtherPeopleBean.java index 6f03ffa..c0f45d0 100644 --- a/search-tool/src/main/java/com/bonus/tool/dto/SubOtherPeopleBean.java +++ b/search-tool/src/main/java/com/bonus/tool/dto/SubOtherPeopleBean.java @@ -21,7 +21,7 @@ public class SubOtherPeopleBean extends PersonFileBean{ private Long id; /** - * 主键 + * 分包ID */ private Long subId; @@ -45,6 +45,11 @@ public class SubOtherPeopleBean extends PersonFileBean{ */ private String diploma; + /** + * 资格证书号码 + */ + private String diplomaNum; + /** * 职称 */ diff --git a/search-tool/src/main/java/com/bonus/tool/dto/TbCompanyPerfVo.java b/search-tool/src/main/java/com/bonus/tool/dto/TbCompanyPerfVo.java index 5b7b509..6fe836d 100644 --- a/search-tool/src/main/java/com/bonus/tool/dto/TbCompanyPerfVo.java +++ b/search-tool/src/main/java/com/bonus/tool/dto/TbCompanyPerfVo.java @@ -122,4 +122,6 @@ public class TbCompanyPerfVo { * 人员名称 */ private String personName; + + private List perfIds; } diff --git a/search-tool/src/main/java/com/bonus/tool/service/StateGridService.java b/search-tool/src/main/java/com/bonus/tool/service/StateGridService.java index 340c4db..ee33758 100644 --- a/search-tool/src/main/java/com/bonus/tool/service/StateGridService.java +++ b/search-tool/src/main/java/com/bonus/tool/service/StateGridService.java @@ -5,6 +5,8 @@ import com.bonus.tool.dto.TbCompanyPerfVo; import com.bonus.tool.dto.TbGwModelDto; import com.bonus.tool.dto.TbGwModelVo; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; import java.util.List; public interface StateGridService { @@ -48,5 +50,5 @@ public interface StateGridService { * @param * @return */ - AjaxResult downloadStateGridTemp(TbGwModelDto o); + AjaxResult downloadStateGridTemp(HttpServletRequest request, HttpServletResponse response, TbGwModelDto o); } diff --git a/search-tool/src/main/java/com/bonus/tool/service/impl/StateGridServiceImpl.java b/search-tool/src/main/java/com/bonus/tool/service/impl/StateGridServiceImpl.java index b1c1ed5..22feda8 100644 --- a/search-tool/src/main/java/com/bonus/tool/service/impl/StateGridServiceImpl.java +++ b/search-tool/src/main/java/com/bonus/tool/service/impl/StateGridServiceImpl.java @@ -3,16 +3,22 @@ package com.bonus.tool.service.impl; import com.bonus.common.core.domain.AjaxResult; import com.bonus.common.enums.TableType; import com.bonus.common.utils.SecurityUtils; +import com.bonus.common.utils.StringUtils; import com.bonus.tool.dto.*; import com.bonus.tool.mapper.StateGridMapper; +import com.bonus.tool.mapper.TbCompanyPerfMapper; import com.bonus.tool.service.StateGridService; +import com.bonus.tool.template.util.FreeMarkerUtil; +import com.bonus.tool.template.util.WordUtils; import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import javax.annotation.Resource; -import java.util.ArrayList; -import java.util.List; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.util.*; /** * @author fly @@ -25,6 +31,9 @@ public class StateGridServiceImpl implements StateGridService { @Resource private StateGridMapper mapper; + @Resource + private TbCompanyPerfMapper tbCompanyPerfMapper; + /** * 国网模版列表查询 * @@ -192,7 +201,7 @@ public class StateGridServiceImpl implements StateGridService { * @return */ @Override - public AjaxResult downloadStateGridTemp(TbGwModelDto o) { + public AjaxResult downloadStateGridTemp(HttpServletRequest request, HttpServletResponse response, TbGwModelDto o) { AjaxResult ajaxResult = getStateGridTempById(o); if (ajaxResult.isSuccess()) { TbGwModelVo data = (TbGwModelVo) ajaxResult.get("data"); @@ -208,6 +217,17 @@ public class StateGridServiceImpl implements StateGridService { //获取附件信息 List comCoreList = getFileSourceList(item.getId(),TableType.TB_KEY_PEOPLE.getCode()); personFileGroup(item, comCoreList); + //获取附件信息 + TbCompanyPerfVo tbCompanyPerfVo = new TbCompanyPerfVo(); + tbCompanyPerfVo.setPersonId(item.getUserId()); + String perfId = item.getPerfId(); + if(StringUtils.isNotEmpty(perfId)){ + String[] split = perfId.split(","); + tbCompanyPerfVo.setPerfIds(Arrays.asList(split)); + List personPerfList = tbCompanyPerfMapper.getTbCompanyPerfListByPersonId(tbCompanyPerfVo); + item.setPeoplePerfList(personPerfList); + } + }); //1.3公司其他人员文件 @@ -237,11 +257,384 @@ public class StateGridServiceImpl implements StateGridService { }); }); + //将数据转换为模版数据 + dealWithWordData(request,response,data); } return AjaxResult.success(); } + @Value("file.domain") + private String prefixPath; + + @Value("file.prefix") + private String mappingPath; + + /** + * 将数据转换为模版数据 + * @param request + * @param response + * @param tbData + */ + private void dealWithWordData(HttpServletRequest request, HttpServletResponse response,TbGwModelVo tbData) { + try { + Map data = new HashMap<>(16); + List> list = new ArrayList<>(); + List> list2 = new ArrayList<>(); + List> list3 = new ArrayList<>(); + List> list4 = new ArrayList<>(); + List> list5 = new ArrayList<>(); + + // 设置标题等基础信息 + data.put("title", tbData.getName()); + // 处理公司业绩数据(近年完成的类似项目情况表) + if (tbData.getComPerfList() != null && !tbData.getComPerfList().isEmpty()) { + int index = 1; + for (ComPerformanceBean item : tbData.getComPerfList()) { + Map map = new HashMap<>(); + map.put("i", index++); + map.put("proName", item.getProName() != null ? item.getProName() : ""); + map.put("dy", item.getVoltage() != null ? item.getVoltage() : ""); + map.put("num", item.getStationNum() != null ? item.getStationNum() : ""); + map.put("line", item.getLineScale() != null ? item.getLineScale()+"km" : ""); + map.put("date", item.getStopTime() != null ? item.getStopTime() : ""); + map.put("fw", item.getContractRang() != null ? item.getContractRang() : ""); + map.put("fr", item.getOwnerUnit() != null ? item.getOwnerUnit() : ""); + map.put("phone", item.getOwnerPhone() != null ? item.getOwnerPhone() : ""); + list.add(map); + + // 处理业绩材料图片 + if (item.getFileList() != null && !item.getFileList().isEmpty()) { + Map perfImgMap = new HashMap<>(); + perfImgMap.put("proName", index + "." + item.getProName()); + List> imgList = new ArrayList<>(); + int imgIndex = 1; + for (TbFileSourceVo file : item.getFileList()) { + Map imgMap = new HashMap<>(); + imgMap.put("index", 100 * index + imgIndex++); + imgMap.put("width", "5325745"); + imgMap.put("height", "7534910"); + imgMap.put("base64Url", file.getFilePath() != null ? FreeMarkerUtil.getImageBase(prefixPath+mappingPath+file.getFilePath()) : ""); + imgList.add(imgMap); + } + perfImgMap.put("imgList", imgList); + list2.add(perfImgMap); + } + } + } + + // 处理分包商数据(核心分包商业绩证明) + if (tbData.getSubList() != null && !tbData.getSubList().isEmpty()) { + int subIndex = 1; + for (SubBean item : tbData.getSubList()) { + Map subMap = new HashMap<>(); + subMap.put("i", subIndex++); + subMap.put("unit", item.getSubName() != null ? item.getSubName() : ""); + List> yjList = new ArrayList<>(); + List> zzList = new ArrayList<>(); + List> personList = new ArrayList<>(); + List> personImgList = new ArrayList<>(); + List> zmImgList = new ArrayList<>(); + // 处理分包商业绩 + if (item.getSubPerfList() != null && !item.getSubPerfList().isEmpty()) { + int perfIndex = 1; + for (SubPerformanceBean perfItem : item.getSubPerfList()) { + Map perfMap = new HashMap<>(); + perfMap.put("i", perfIndex++); + perfMap.put("proName", perfItem.getProName() != null ? perfItem.getProName() : ""); + perfMap.put("unit", perfItem.getConsUnit() != null ? perfItem.getConsUnit() : ""); + perfMap.put("money", perfItem.getMoney() != null ? perfItem.getMoney().toString() : ""); + String dateRange = ""; + if (perfItem.getStartTime() != null) { + dateRange = perfItem.getStartTime(); + } + if (perfItem.getEndTime() != null) { + dateRange += "至" + perfItem.getEndTime(); + } + perfMap.put("date", dateRange); + perfMap.put("sf", "分包人"); + perfMap.put("bz", perfItem.getHtRemark() != null ? perfItem.getHtRemark() : ""); + yjList.add(perfMap); + // 处理业绩证明材料图片 + if (perfItem.getSubPerfFileList() != null && !perfItem.getSubPerfFileList().isEmpty()) { + Map zmMap = new HashMap<>(); + zmMap.put("proName", perfIndex + "、" + perfItem.getProName()); + List> imgList = new ArrayList<>(); + int imgIndex = 1; + for (TbFileSourceVo file : perfItem.getSubPerfFileList()) { + Map imgMap = new HashMap<>(); + imgMap.put("index", 100000 * perfIndex + imgIndex++); + imgMap.put("width", "5325745"); + imgMap.put("height", "7534910"); + imgMap.put("base64Url", file.getFilePath() != null ? FreeMarkerUtil.getImageBase(prefixPath+mappingPath+file.getFilePath()) : ""); + imgList.add(imgMap); + } + zmMap.put("imgList", imgList); + zmImgList.add(zmMap); + } + } + } + // 处理分包资质证明材料图片 + if (item.getSubFileList() != null && !item.getSubFileList().isEmpty()) { + int zzIndex = 1; + for (TbFileSourceVo file : item.getSubFileList()) { + Map zzMap = new HashMap<>(); + zzMap.put("index", 1000 * subIndex + zzIndex++); + zzMap.put("width", "5325745"); + zzMap.put("height", "7534910"); + zzMap.put("base64Url", file.getFilePath() != null ? FreeMarkerUtil.getImageBase(prefixPath+mappingPath+file.getFilePath()) : ""); + zzList.add(zzMap); + } + } + // 处理分包商拟派人员 + if (item.getSubPersonList() != null && !item.getSubPersonList().isEmpty()) { + int personIndex = 1; + for (SubOtherPeopleBean personItem : item.getSubPersonList()) { + Map personMap = new HashMap<>(); + personMap.put("i", personIndex++); + personMap.put("name", personItem.getUserName() != null ? personItem.getUserName() : ""); + personMap.put("zc", personItem.getTitle() != null ? personItem.getTitle() : ""); + personMap.put("zf", (personItem.getDiplomaNum() != null || personItem.getIdCard() != null) ? personItem.getDiplomaNum()+personItem.getIdCard() : ""); + personMap.put("fg", personItem.getPostName() != null ? personItem.getPostName() : ""); + personMap.put("yj", personItem.getProPerf() != null ? personItem.getProPerf() : ""); + personMap.put("bz", ""); + personList.add(personMap); + // 处理拟派人员证件图片 + Map personImgMap = new HashMap<>(); + personImgMap.put("userType", personItem.getPostName() != null ? personItem.getPostName() : ""); + List> imgList = new ArrayList<>(); + int imgIndex = 1; + // 处理身份证 + if (personItem.getIdCardFileList() != null && !personItem.getIdCardFileList().isEmpty()) { + for (TbFileSourceVo file : personItem.getIdCardFileList()) { + Map imgMap = new HashMap<>(); + imgMap.put("index", 10000 * personIndex + imgIndex++); + imgMap.put("width", "4959860"); + imgMap.put("height", "3492375"); + imgMap.put("base64Url", file.getFilePath() != null ? FreeMarkerUtil.getImageBase(prefixPath+mappingPath+file.getFilePath()) : ""); + imgList.add(imgMap); + } + } + // 处理资格证书 + if (personItem.getDiplomaFileList() != null && !personItem.getDiplomaFileList().isEmpty()) { + for (TbFileSourceVo file : personItem.getDiplomaFileList()) { + Map imgMap = new HashMap<>(); + imgMap.put("index", 10000 * personIndex + imgIndex++); + imgMap.put("width", "5325745"); + imgMap.put("height", "7534910"); + imgMap.put("base64Url", file.getFilePath() != null ? FreeMarkerUtil.getImageBase(prefixPath+mappingPath+file.getFilePath()) : ""); + imgList.add(imgMap); + } + } + // 处理其他资质 + if (personItem.getOtherFileList() != null && !personItem.getOtherFileList().isEmpty()) { + for (TbFileSourceVo file : personItem.getOtherFileList()) { + Map imgMap = new HashMap<>(); + imgMap.put("index", 10000 * personIndex + imgIndex++); + imgMap.put("width", "5325745"); + imgMap.put("height", "7534910"); + imgMap.put("base64Url", file.getFilePath() != null ? FreeMarkerUtil.getImageBase(prefixPath+mappingPath+file.getFilePath()) : ""); + imgList.add(imgMap); + } + } + if (!imgList.isEmpty()) { + personImgMap.put("imgList", imgList); + personImgList.add(personImgMap); + } + } + } + subMap.put("yjList", yjList); + subMap.put("zzList", zzList); + subMap.put("personList", personList); + subMap.put("personImgList", personImgList); + subMap.put("zmImgList", zmImgList); + list3.add(subMap); + } + } + // 处理公司其他人员数据(项目人员配置情况) + Map personConfigMap = new HashMap<>(); + List> otherUserList = new ArrayList<>(); + List> userSettingList = new ArrayList<>(); + List> personImgList = new ArrayList<>(); + + if (tbData.getComOtherList() != null && !tbData.getComOtherList().isEmpty()) { + int otherIndex = 1; + for (ComOtherPersonBean item : tbData.getComOtherList()) { + Map otherMap = new HashMap<>(); + otherMap.put("zw", item.getPostName() != null ? item.getPostName() : ""); + otherMap.put("name", item.getUserName() != null ? item.getUserName() : ""); + otherMap.put("zc", item.getTitle() != null ? item.getTitle() : ""); + otherMap.put("yg", item.getDiploma()); + otherMap.put("zs", item.getDiploma() != null ? item.getDiploma() : ""); + otherMap.put("jb", item.getLevel() != null ? item.getLevel() : ""); + otherMap.put("zh", item.getDiplomaNum() != null ? item.getDiplomaNum() : ""); + otherMap.put("zy", item.getMajor() != null ? item.getMajor() : ""); + otherMap.put("bh", ""); + // 处理证书列表 + List> zsList = new ArrayList<>(); +// if (item.getDiploma() != null || item.getDiplomaNum() != null || item.getMajor() != null || item.getLevel() != null) { +// Map zsMap = new HashMap<>(); +// zsMap.put("zs", item.getDiploma() != null ? item.getDiploma() : ""); +// zsMap.put("jb", item.getLevel() != null ? item.getLevel() : ""); +// zsMap.put("zh", item.getDiplomaNum() != null ? item.getDiplomaNum() : ""); +// zsMap.put("zy", item.getMajor() != null ? item.getMajor() : ""); +// zsMap.put("bh", ""); +// zsList.add(zsMap); +// } + otherMap.put("zsList", zsList); + otherUserList.add(otherMap); + // 处理人员证件图片 + int imgIndex = 1; + // 处理身份证、资格证书和其他资质的图片 + List allImages = new ArrayList<>(); + if (item.getIdCardFileList() != null) { + for (TbFileSourceVo file : item.getIdCardFileList()) { + Map imgMap = new HashMap<>(); + imgMap.put("index", 1000000 * otherIndex + imgIndex++); + imgMap.put("width", "4959860"); + imgMap.put("height", "3492375"); + imgMap.put("base64Url", file.getFilePath() != null ? FreeMarkerUtil.getImageBase(prefixPath+mappingPath+file.getFilePath()) : ""); + personImgList.add(imgMap); + } + } + + if (item.getDiplomaFileList() != null) { + allImages.addAll(item.getDiplomaFileList()); + } + if (item.getOtherFileList() != null) { + allImages.addAll(item.getOtherFileList()); + } + + for (TbFileSourceVo file : allImages) { + Map imgMap = new HashMap<>(); + imgMap.put("index", 1000000 * otherIndex + imgIndex++); + imgMap.put("width", "5325745"); + imgMap.put("height", "7534910"); + imgMap.put("base64Url", file.getFilePath() != null ? FreeMarkerUtil.getImageBase(prefixPath+mappingPath+file.getFilePath()) : ""); + personImgList.add(imgMap); + } + } + } + + // 可选:处理项目设置信息(根据实际业务需求可能需要添加) + Map userSettingMap = new HashMap<>(); + userSettingMap.put("i", 1); + userSettingMap.put("fbbh", ""); + userSettingMap.put("name", ""); + userSettingMap.put("bh", ""); + // 初始化所有可能的职位对应的字段为空字符串 + userSettingMap.put("xmName", ""); + userSettingMap.put("zsmc", ""); + userSettingMap.put("zch", ""); + userSettingMap.put("xm", ""); + userSettingMap.put("safety", ""); + userSettingMap.put("aqy", ""); + userSettingMap.put("zjy", ""); + userSettingMap.put("zz", ""); + //遍历项目人员关键人员信息信息 + for (ComCorePersonBean item : tbData.getComCoreList()) { + if("项目经理".equals(item.getPostName())){ + userSettingMap.put("xmName", item.getUserName()); + userSettingMap.put("zsmc", item.getDiploma()); + userSettingMap.put("zch", item.getDiplomaNum()); + }else if("项目总工".equals(item.getPostName())){ + userSettingMap.put("xm", item.getUserName()); + }else if("安全总监".equals(item.getPostName())){ + userSettingMap.put("safety", item.getUserName()); + }else if("项目部安全员".equals(item.getPostName())){ + userSettingMap.put("aqy", item.getUserName()); + }else if("项目部质检员".equals(item.getPostName())){ + userSettingMap.put("zjy", item.getUserName()); + }else if("技术专责".equals(item.getPostName())){ + userSettingMap.put("zz", item.getUserName()); + } + } + + userSettingList.add(userSettingMap); + personConfigMap.put("otherUserList", otherUserList); + personConfigMap.put("userSettingList", userSettingList); + personConfigMap.put("personImgList", personImgList); + list4.add(personConfigMap); + + // 处理核心人员简历及证明材料 + if (tbData.getComCoreList() != null && !tbData.getComCoreList().isEmpty()) { + for (ComCorePersonBean item : tbData.getComCoreList()) { + Map personMap = new HashMap<>(); + List> jlList = new ArrayList<>(); + List> corePersonImgList = new ArrayList<>(); + + personMap.put("jlTitle", (item.getPostName() != null ? item.getPostName() : "项目经理") + "简历及证明材料"); + personMap.put("userType", item.getPostName() != null ? item.getPostName() : "项目经理"); + + // 处理简历信息 + Map jlMap = new HashMap<>(); + jlMap.put("type", item.getPostName() != null ? item.getPostName() : ""); + jlMap.put("name", item.getUserName() != null ? item.getUserName() : ""); + jlMap.put("card", item.getIdCard() != null ? item.getIdCard() : ""); + jlMap.put("xl", item.getEducation() != null ? item.getEducation() : ""); // 没有学历字段 + jlMap.put("zc", item.getTitle() != null ? item.getTitle() : ""); + jlMap.put("zs", item.getDiploma() != null ? item.getDiploma() : ""); + jlMap.put("bh", item.getDiplomaNum() != null ? item.getDiplomaNum() : ""); // 没有编号字段 + jlMap.put("rcdate", item.getEinDate() != null ? item.getEinDate() : ""); + jlMap.put("tcDate", item.getExitDate() != null ? item.getExitDate() : ""); + + // 处理业绩经历 + List> yjList = new ArrayList<>(); + if (item.getPeoplePerfList() != null && !item.getPeoplePerfList().isEmpty()) { + List peoplePerfList = item.getPeoplePerfList(); + for (int i = 0; i < peoplePerfList.size(); i++) { + TbCompanyPerfVo tbCompanyPerfVo = peoplePerfList.get(i); + Map yjMap = new HashMap<>(); + yjMap.put("date", tbCompanyPerfVo.getStartTime()+"至"+tbCompanyPerfVo.getEndTime()); + yjMap.put("proName", tbCompanyPerfVo.getProName()); + yjMap.put("gm", tbCompanyPerfVo.getLineScale()+"km"); + yjMap.put("content", tbCompanyPerfVo.getContractRang()); + yjMap.put("zw", item.getPostName() != null ? item.getPostName() : ""); + yjList.add(yjMap); + } + } + jlMap.put("yjList", yjList); + jlList.add(jlMap); + // 处理人员证件图片 + int imgIndex = 1; + // 处理身份证、资格证书和其他资质的图片 + List allImages = new ArrayList<>(); + if (item.getIdCardFileList() != null) { + allImages.addAll(item.getIdCardFileList()); + } + if (item.getDiplomaFileList() != null) { + allImages.addAll(item.getDiplomaFileList()); + } + if (item.getOtherFileList() != null) { + allImages.addAll(item.getOtherFileList()); + } + for (TbFileSourceVo file : allImages) { + Map imgMap = new HashMap<>(); + imgMap.put("index", imgIndex++); + imgMap.put("width", "5325745"); + imgMap.put("height", "7534910"); + imgMap.put("base64Url", file.getFilePath() != null ? FreeMarkerUtil.getImageBase(prefixPath+mappingPath+file.getFilePath()) : ""); + corePersonImgList.add(imgMap); + } + + personMap.put("jlList", jlList); + personMap.put("personImgList", corePersonImgList); + list5.add(personMap); + } + } + // 设置数据到结果 + data.put("tbr", tbData.getCreateUser() != null ? tbData.getCreateUser() : ""); + data.put("list", list); + data.put("list2", list2); + data.put("list3", list3); + data.put("list4", list4); + data.put("list5", list5); + WordUtils.exportMillCertificateWord(request,response,data,tbData.getName(),"GW.ftl" ); + } catch (Exception e) { + log.error("处理国网模版下载数据失败", e); + } + } + /** * 根据文件类型对文件列表进行分组,并设置到item对象中。 * @param 继承自PersonFileBean的类型 diff --git a/search-tool/src/main/java/com/bonus/tool/template/TestGW.java b/search-tool/src/main/java/com/bonus/tool/template/TestGW.java index e040842..ab74c90 100644 --- a/search-tool/src/main/java/com/bonus/tool/template/TestGW.java +++ b/search-tool/src/main/java/com/bonus/tool/template/TestGW.java @@ -27,7 +27,6 @@ public class TestGW { List> list3 = new ArrayList<>(); List> list4 = new ArrayList<>(); List> list5 = new ArrayList<>(); - String fileName = null; try { data.put("title", "中老500千伏联网项目(老挝段)EPC总承包项目投标技术文件"); // 近年完成的类似项目情况表 diff --git a/search-tool/src/main/java/com/bonus/tool/template/util/FreeMarkerUtil.java b/search-tool/src/main/java/com/bonus/tool/template/util/FreeMarkerUtil.java index b728a1a..afe9779 100644 --- a/search-tool/src/main/java/com/bonus/tool/template/util/FreeMarkerUtil.java +++ b/search-tool/src/main/java/com/bonus/tool/template/util/FreeMarkerUtil.java @@ -6,9 +6,9 @@ import freemarker.template.Template; import freemarker.template.TemplateExceptionHandler; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import sun.misc.BASE64Encoder; import java.io.*; +import java.util.Base64; import java.util.Locale; import java.util.Map; @@ -94,8 +94,8 @@ public class FreeMarkerUtil { data = new byte[in.available()]; in.read(data); in.close(); - BASE64Encoder encoder = new BASE64Encoder(); - return encoder.encode(data); + // 编码 + return Base64.getEncoder().encodeToString(data); } catch (IOException e) { e.printStackTrace(); return ""; diff --git a/search-tool/src/main/java/com/bonus/tool/template/util/WordUtils.java b/search-tool/src/main/java/com/bonus/tool/template/util/WordUtils.java index d286552..9c4f288 100644 --- a/search-tool/src/main/java/com/bonus/tool/template/util/WordUtils.java +++ b/search-tool/src/main/java/com/bonus/tool/template/util/WordUtils.java @@ -19,9 +19,6 @@ import java.util.Objects; */ public class WordUtils { - @Value("${file.upload_path}") - private String UPLOAD_PATH; - //配置信息,代码本身写的还是很可读的,就不过多注解了 private static Configuration configuration = null; @@ -31,12 +28,6 @@ public class WordUtils { configuration = new Configuration(); configuration.setDefaultEncoding("utf-8"); configuration.setClassForTemplateLoading(WordUtils.class, "/download/"); -// try { -// -//// configuration.setDirectoryForTemplateLoading(new File(templateFolder)); -// } catch (IOException e) { -// e.printStackTrace(); -// } } private WordUtils() { diff --git a/search-tool/src/main/resources/mapper/EpcMapper.xml b/search-tool/src/main/resources/mapper/EpcMapper.xml index f128bac..fca2cfe 100644 --- a/search-tool/src/main/resources/mapper/EpcMapper.xml +++ b/search-tool/src/main/resources/mapper/EpcMapper.xml @@ -162,8 +162,8 @@ tkp.diploma, tkp.diploma_num, tgou.position as post_name - FROM tb_epc_other_user tgou - LEFT JOIN tb_sub_people tkp ON tgou.other_id = tkp.id + FROM tb_epc_sub_user tgou + LEFT JOIN tb_sub_people tkp ON tgou.user_id = tkp.id WHERE tgou.epc_id = #{id} diff --git a/search-tool/src/main/resources/mapper/SouthMapper.xml b/search-tool/src/main/resources/mapper/SouthMapper.xml index 041290e..0a0e8f6 100644 --- a/search-tool/src/main/resources/mapper/SouthMapper.xml +++ b/search-tool/src/main/resources/mapper/SouthMapper.xml @@ -162,8 +162,8 @@ tkp.diploma, tkp.diploma_num, tgou.position as post_name - FROM tb_south_other_user tgou - LEFT JOIN tb_sub_people tkp ON tgou.other_id = tkp.id + FROM tb_south_sub_user tgou + LEFT JOIN tb_sub_people tkp ON tgou.user_id = tkp.id WHERE tgou.south_id = #{id} diff --git a/search-tool/src/main/resources/mapper/StateGridMapper.xml b/search-tool/src/main/resources/mapper/StateGridMapper.xml index 0e5de7f..16ba9f9 100644 --- a/search-tool/src/main/resources/mapper/StateGridMapper.xml +++ b/search-tool/src/main/resources/mapper/StateGridMapper.xml @@ -28,6 +28,7 @@ position, in_time, out_time, + perf_id, pro_perf )values @@ -37,6 +38,7 @@ #{item.postName}, #{item.einDate}, #{item.exitDate}, + #{item.perfId}, #{item.proPerf} ) @@ -178,11 +180,14 @@ tkp.id as userId, tkp.user_name, tkp.id_card, + tkp.education, tkp.title, tkp.diploma, + tkp.diploma_num, tgku.position as post_name, tgku.in_time as ein_date, tgku.out_time as exit_date, + tgku.perf_id, tgku.pro_perf FROM tb_gw_key_user tgku LEFT JOIN tb_key_people tkp ON tgku.key_id = tkp.id @@ -234,6 +239,7 @@ tkp.id_card, tkp.title, tkp.diploma, + tkp.diploma_num, tgsu.position AS post_name, tgsu.pro_perf FROM tb_gw_sub_user tgsu diff --git a/search-tool/src/main/resources/mapper/TbCompanyPerfMapper.xml b/search-tool/src/main/resources/mapper/TbCompanyPerfMapper.xml index fcdbdaa..bef0b80 100644 --- a/search-tool/src/main/resources/mapper/TbCompanyPerfMapper.xml +++ b/search-tool/src/main/resources/mapper/TbCompanyPerfMapper.xml @@ -97,5 +97,11 @@ and tcp.start_time BETWEEN STR_TO_DATE(#{startTime}, '%Y-%m-%d') AND STR_TO_DATE(#{endTime}, '%Y-%m-%d') + + and tcp.id in + + #{item} + +