模版下载接口
This commit is contained in:
parent
35ed22e757
commit
8ec39ef898
|
|
@ -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());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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<TbCompanyPerfVo> peoplePerfList;
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
||||
/**
|
||||
* 职称
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -122,4 +122,6 @@ public class TbCompanyPerfVo {
|
|||
* 人员名称
|
||||
*/
|
||||
private String personName;
|
||||
|
||||
private List<String> perfIds;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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<TbFileSourceVo> 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<TbCompanyPerfVo> 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<String, Object> data = new HashMap<>(16);
|
||||
List<Map<String, Object>> list = new ArrayList<>();
|
||||
List<Map<String, Object>> list2 = new ArrayList<>();
|
||||
List<Map<String, Object>> list3 = new ArrayList<>();
|
||||
List<Map<String, Object>> list4 = new ArrayList<>();
|
||||
List<Map<String, Object>> list5 = new ArrayList<>();
|
||||
|
||||
// 设置标题等基础信息
|
||||
data.put("title", tbData.getName());
|
||||
// 处理公司业绩数据(近年完成的类似项目情况表)
|
||||
if (tbData.getComPerfList() != null && !tbData.getComPerfList().isEmpty()) {
|
||||
int index = 1;
|
||||
for (ComPerformanceBean item : tbData.getComPerfList()) {
|
||||
Map<String, Object> 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<String, Object> perfImgMap = new HashMap<>();
|
||||
perfImgMap.put("proName", index + "." + item.getProName());
|
||||
List<Map<String, Object>> imgList = new ArrayList<>();
|
||||
int imgIndex = 1;
|
||||
for (TbFileSourceVo file : item.getFileList()) {
|
||||
Map<String, Object> 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<String, Object> subMap = new HashMap<>();
|
||||
subMap.put("i", subIndex++);
|
||||
subMap.put("unit", item.getSubName() != null ? item.getSubName() : "");
|
||||
List<Map<String, Object>> yjList = new ArrayList<>();
|
||||
List<Map<String, Object>> zzList = new ArrayList<>();
|
||||
List<Map<String, Object>> personList = new ArrayList<>();
|
||||
List<Map<String, Object>> personImgList = new ArrayList<>();
|
||||
List<Map<String, Object>> zmImgList = new ArrayList<>();
|
||||
// 处理分包商业绩
|
||||
if (item.getSubPerfList() != null && !item.getSubPerfList().isEmpty()) {
|
||||
int perfIndex = 1;
|
||||
for (SubPerformanceBean perfItem : item.getSubPerfList()) {
|
||||
Map<String, Object> 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<String, Object> zmMap = new HashMap<>();
|
||||
zmMap.put("proName", perfIndex + "、" + perfItem.getProName());
|
||||
List<Map<String, Object>> imgList = new ArrayList<>();
|
||||
int imgIndex = 1;
|
||||
for (TbFileSourceVo file : perfItem.getSubPerfFileList()) {
|
||||
Map<String, Object> 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<String, Object> 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<String, Object> 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<String, Object> personImgMap = new HashMap<>();
|
||||
personImgMap.put("userType", personItem.getPostName() != null ? personItem.getPostName() : "");
|
||||
List<Map<String, Object>> imgList = new ArrayList<>();
|
||||
int imgIndex = 1;
|
||||
// 处理身份证
|
||||
if (personItem.getIdCardFileList() != null && !personItem.getIdCardFileList().isEmpty()) {
|
||||
for (TbFileSourceVo file : personItem.getIdCardFileList()) {
|
||||
Map<String, Object> 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<String, Object> 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<String, Object> 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<String, Object> personConfigMap = new HashMap<>();
|
||||
List<Map<String, Object>> otherUserList = new ArrayList<>();
|
||||
List<Map<String, Object>> userSettingList = new ArrayList<>();
|
||||
List<Map<String, Object>> personImgList = new ArrayList<>();
|
||||
|
||||
if (tbData.getComOtherList() != null && !tbData.getComOtherList().isEmpty()) {
|
||||
int otherIndex = 1;
|
||||
for (ComOtherPersonBean item : tbData.getComOtherList()) {
|
||||
Map<String, Object> 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<Map<String, Object>> zsList = new ArrayList<>();
|
||||
// if (item.getDiploma() != null || item.getDiplomaNum() != null || item.getMajor() != null || item.getLevel() != null) {
|
||||
// Map<String, Object> 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<TbFileSourceVo> allImages = new ArrayList<>();
|
||||
if (item.getIdCardFileList() != null) {
|
||||
for (TbFileSourceVo file : item.getIdCardFileList()) {
|
||||
Map<String, Object> 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<String, Object> 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<String, Object> 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<String, Object> personMap = new HashMap<>();
|
||||
List<Map<String, Object>> jlList = new ArrayList<>();
|
||||
List<Map<String, Object>> corePersonImgList = new ArrayList<>();
|
||||
|
||||
personMap.put("jlTitle", (item.getPostName() != null ? item.getPostName() : "项目经理") + "简历及证明材料");
|
||||
personMap.put("userType", item.getPostName() != null ? item.getPostName() : "项目经理");
|
||||
|
||||
// 处理简历信息
|
||||
Map<String, Object> 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<Map<String, Object>> yjList = new ArrayList<>();
|
||||
if (item.getPeoplePerfList() != null && !item.getPeoplePerfList().isEmpty()) {
|
||||
List<TbCompanyPerfVo> peoplePerfList = item.getPeoplePerfList();
|
||||
for (int i = 0; i < peoplePerfList.size(); i++) {
|
||||
TbCompanyPerfVo tbCompanyPerfVo = peoplePerfList.get(i);
|
||||
Map<String, Object> 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<TbFileSourceVo> 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<String, Object> 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 <E> 继承自PersonFileBean的类型
|
||||
|
|
|
|||
|
|
@ -27,7 +27,6 @@ public class TestGW {
|
|||
List<Map<String, Object>> list3 = new ArrayList<>();
|
||||
List<Map<String, Object>> list4 = new ArrayList<>();
|
||||
List<Map<String, Object>> list5 = new ArrayList<>();
|
||||
String fileName = null;
|
||||
try {
|
||||
data.put("title", "中老500千伏联网项目(老挝段)EPC总承包项目投标技术文件");
|
||||
// 近年完成的类似项目情况表
|
||||
|
|
|
|||
|
|
@ -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 "";
|
||||
|
|
|
|||
|
|
@ -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() {
|
||||
|
|
|
|||
|
|
@ -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}
|
||||
</select>
|
||||
|
||||
|
|
|
|||
|
|
@ -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}
|
||||
</select>
|
||||
|
||||
|
|
|
|||
|
|
@ -28,6 +28,7 @@
|
|||
position,
|
||||
in_time,
|
||||
out_time,
|
||||
perf_id,
|
||||
pro_perf
|
||||
)values
|
||||
<foreach collection="list" item="item" separator=",">
|
||||
|
|
@ -37,6 +38,7 @@
|
|||
#{item.postName},
|
||||
#{item.einDate},
|
||||
#{item.exitDate},
|
||||
#{item.perfId},
|
||||
#{item.proPerf}
|
||||
)
|
||||
</foreach>
|
||||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -97,5 +97,11 @@
|
|||
<if test="startTime != null and endTime != null">
|
||||
and tcp.start_time BETWEEN STR_TO_DATE(#{startTime}, '%Y-%m-%d') AND STR_TO_DATE(#{endTime}, '%Y-%m-%d')
|
||||
</if>
|
||||
<if test="perfIds != '' and perfIds != null">
|
||||
and tcp.id in
|
||||
<foreach collection="list" item="item" open="(" close=")" separator=",">
|
||||
#{item}
|
||||
</foreach>
|
||||
</if>
|
||||
</select>
|
||||
</mapper>
|
||||
|
|
|
|||
Loading…
Reference in New Issue