bug51803+51806相关人员导出相关问题+51798任务计划名称同步
This commit is contained in:
+8
-22
@@ -2,11 +2,9 @@ package com.jero.modules.project.controller;
|
|||||||
|
|
||||||
import com.jero.common.api.vo.Result;
|
import com.jero.common.api.vo.Result;
|
||||||
import com.jero.common.aspect.annotation.AutoLog;
|
import com.jero.common.aspect.annotation.AutoLog;
|
||||||
import com.jero.common.constant.enums.CutEnum;
|
|
||||||
import com.jero.common.system.base.controller.JeroController;
|
import com.jero.common.system.base.controller.JeroController;
|
||||||
import com.jero.modules.project.entity.ProjectRelatedPersonnel;
|
import com.jero.modules.project.entity.ProjectRelatedPersonnel;
|
||||||
import com.jero.modules.project.service.IProjectRelatedPersonnelService;
|
import com.jero.modules.project.service.IProjectRelatedPersonnelService;
|
||||||
import com.jero.modules.project.util.ExcelLangUtils;
|
|
||||||
import com.jero.modules.system.entity.SysUser;
|
import com.jero.modules.system.entity.SysUser;
|
||||||
import io.swagger.annotations.Api;
|
import io.swagger.annotations.Api;
|
||||||
import io.swagger.annotations.ApiOperation;
|
import io.swagger.annotations.ApiOperation;
|
||||||
@@ -15,7 +13,6 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|||||||
import org.springframework.http.MediaType;
|
import org.springframework.http.MediaType;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
import org.springframework.web.servlet.ModelAndView;
|
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
@@ -140,18 +137,13 @@ public class ProjectRelatedPersonnelController extends JeroController<ProjectRel
|
|||||||
@AutoLog(value = "项目库-相关人员维护表-导出excel")
|
@AutoLog(value = "项目库-相关人员维护表-导出excel")
|
||||||
@ApiOperation(value="项目库-相关人员维护表-导出excel", notes="项目库-相关人员维护表-导出excel")
|
@ApiOperation(value="项目库-相关人员维护表-导出excel", notes="项目库-相关人员维护表-导出excel")
|
||||||
@GetMapping(value = "/exportXls", produces = MediaType.APPLICATION_OCTET_STREAM_VALUE)
|
@GetMapping(value = "/exportXls", produces = MediaType.APPLICATION_OCTET_STREAM_VALUE)
|
||||||
public ModelAndView exportXls(HttpServletRequest request,@RequestParam(name="id") String id,
|
public void exportXls(@RequestParam(name="id") String id,
|
||||||
@RequestParam(name="projectId") String projectId,
|
@RequestParam(name="projectId") String projectId,
|
||||||
@RequestParam(name="cut") String cut)
|
@RequestParam(name="cut") String cut,
|
||||||
throws NoSuchFieldException, IllegalAccessException {
|
HttpServletResponse response, HttpServletRequest request) throws Exception {
|
||||||
//获取导出的数据
|
//获取导出的数据
|
||||||
List<ProjectRelatedPersonnel> records = projectRelatedPersonnelService.disposeExportXls(id, projectId);
|
List<ProjectRelatedPersonnel> records = projectRelatedPersonnelService.disposeExportXls(id, projectId,cut);
|
||||||
if (cut.equals(CutEnum.CN.getValue())) {
|
projectRelatedPersonnelService.exportDataToXls(cut,response,request,records);
|
||||||
return projectRelatedPersonnelService.exportDataToXls(request, records, ProjectRelatedPersonnel.class, "相关人员名单", cut);
|
|
||||||
}else{
|
|
||||||
return projectRelatedPersonnelService.exportDataToXls(request, records, ProjectRelatedPersonnel.class, "List of relevant personnel", cut);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -160,14 +152,8 @@ public class ProjectRelatedPersonnelController extends JeroController<ProjectRel
|
|||||||
@AutoLog(value = "项目库-相关人员维护表-导出excel模板")
|
@AutoLog(value = "项目库-相关人员维护表-导出excel模板")
|
||||||
@ApiOperation(value="项目库-相关人员维护表-导出excel模板", notes="项目库-相关人员维护表-导出excel模板")
|
@ApiOperation(value="项目库-相关人员维护表-导出excel模板", notes="项目库-相关人员维护表-导出excel模板")
|
||||||
@GetMapping(value = "/exportTemplate", produces = MediaType.APPLICATION_OCTET_STREAM_VALUE)
|
@GetMapping(value = "/exportTemplate", produces = MediaType.APPLICATION_OCTET_STREAM_VALUE)
|
||||||
public ModelAndView exportTemplate(HttpServletRequest request,@RequestParam(name="cut",required=true) String cut)
|
public void exportTemplate(ProjectRelatedPersonnel projectRelatedPersonnel, HttpServletResponse response, HttpServletRequest request) throws Exception {
|
||||||
throws NoSuchFieldException, IllegalAccessException {
|
projectRelatedPersonnelService.exportTemplate(projectRelatedPersonnel,response,request);
|
||||||
//return projectRelatedPersonnelService.setExporTemplate(request, ProjectRelatedPersonnel.class, "相关人员名单",cut);
|
|
||||||
if (cut.equals(CutEnum.CN.getValue())) {
|
|
||||||
return projectRelatedPersonnelService.setExporTemplate(request, ExcelLangUtils.chooseLang(ProjectRelatedPersonnel.class, CutEnum.CN.getValue()), "相关人员名单", cut);
|
|
||||||
}else{
|
|
||||||
return projectRelatedPersonnelService.setExporTemplate(request, ExcelLangUtils.chooseLang(ProjectRelatedPersonnel.class, CutEnum.EN.getValue()), "List of relevant personnel", cut);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* 通过excel导入数据
|
* 通过excel导入数据
|
||||||
|
|||||||
+56
-5
@@ -39,30 +39,30 @@ public class ProjectRelatedPersonnel implements Serializable {
|
|||||||
private java.lang.String projectId;
|
private java.lang.String projectId;
|
||||||
|
|
||||||
/**责任领域*/
|
/**责任领域*/
|
||||||
@Excel(name = "责任领域,dutyTerritory", width = 15,orderNum = "1",dicCode = "duty_territory")
|
@Excel(name = "责任领域,Responsible Field", width = 15,orderNum = "1",dicCode = "duty_territory")
|
||||||
@Dict(dicCode = "duty_territory")
|
@Dict(dicCode = "duty_territory")
|
||||||
private java.lang.String dutyTerritory;
|
private java.lang.String dutyTerritory;
|
||||||
|
|
||||||
/**法规工程师*/
|
/**法规工程师*/
|
||||||
private java.lang.String lawEngineer;
|
private java.lang.String lawEngineer;
|
||||||
@TableField(exist = false)
|
@TableField(exist = false)
|
||||||
@Excel(name = "法规工程师,lawEngineerName", width = 15,orderNum = "2")
|
@Excel(name = "法规工程师,Regulation Engineer", width = 15,orderNum = "2")
|
||||||
private java.lang.String lawEngineerName;
|
private java.lang.String lawEngineerName;
|
||||||
|
|
||||||
/**工程接口人*/
|
/**工程接口人*/
|
||||||
private java.lang.String engineeringInterfacePerson;
|
private java.lang.String engineeringInterfacePerson;
|
||||||
@TableField(exist = false)
|
@TableField(exist = false)
|
||||||
@Excel(name = "工程接口人,engineeringInterfacePersonName", width = 15,orderNum = "3")
|
@Excel(name = "工程接口人,Engineering Interface", width = 15,orderNum = "3")
|
||||||
private java.lang.String engineeringInterfacePersonName;
|
private java.lang.String engineeringInterfacePersonName;
|
||||||
|
|
||||||
/**认证工程师*/
|
/**认证工程师*/
|
||||||
private java.lang.String certificationEngineer;
|
private java.lang.String certificationEngineer;
|
||||||
@TableField(exist = false)
|
@TableField(exist = false)
|
||||||
@Excel(name = "认证工程师,certificationEngineerName", width = 15,orderNum = "4")
|
@Excel(name = "认证工程师,Homologation Engineer", width = 15,orderNum = "4")
|
||||||
private java.lang.String certificationEngineerName;
|
private java.lang.String certificationEngineerName;
|
||||||
|
|
||||||
/**备注*/
|
/**备注*/
|
||||||
@Excel(name = "备注,remark", width = 15,orderNum = "5")
|
@Excel(name = "备注,Comments", width = 15,orderNum = "5")
|
||||||
private java.lang.String remark;
|
private java.lang.String remark;
|
||||||
|
|
||||||
/**创建人*/
|
/**创建人*/
|
||||||
@@ -89,3 +89,54 @@ public class ProjectRelatedPersonnel implements Serializable {
|
|||||||
@TableField(exist = false)
|
@TableField(exist = false)
|
||||||
private String cut;
|
private String cut;
|
||||||
}
|
}
|
||||||
|
/* *//**责任领域*//*
|
||||||
|
@Excel(name = "责任领域,Responsible Field", width = 15,orderNum = "1",dicCode = "duty_territory")
|
||||||
|
@Dict(dicCode = "duty_territory")
|
||||||
|
private java.lang.String dutyTerritory;
|
||||||
|
|
||||||
|
*//**法规工程师*//*
|
||||||
|
private java.lang.String lawEngineer;
|
||||||
|
@TableField(exist = false)
|
||||||
|
@Excel(name = "法规工程师,Regulation Engineer", width = 15,orderNum = "2")
|
||||||
|
private java.lang.String lawEngineerName;
|
||||||
|
|
||||||
|
*//**工程接口人*//*
|
||||||
|
private java.lang.String engineeringInterfacePerson;
|
||||||
|
@TableField(exist = false)
|
||||||
|
@Excel(name = "工程接口人,Engineering Interface", width = 15,orderNum = "3")
|
||||||
|
private java.lang.String engineeringInterfacePersonName;
|
||||||
|
|
||||||
|
*//**认证工程师*//*
|
||||||
|
private java.lang.String certificationEngineer;
|
||||||
|
@TableField(exist = false)
|
||||||
|
@Excel(name = "认证工程师,Homologation Engineer", width = 15,orderNum = "4")
|
||||||
|
private java.lang.String certificationEngineerName;
|
||||||
|
|
||||||
|
*//**备注*//*
|
||||||
|
@Excel(name = "备注,Comments", width = 15,orderNum = "5")
|
||||||
|
private java.lang.String remark;
|
||||||
|
|
||||||
|
*//**创建人*//*
|
||||||
|
private java.lang.String createBy;
|
||||||
|
|
||||||
|
*//**创建日期*//*
|
||||||
|
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
|
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
|
||||||
|
private java.util.Date createTime;
|
||||||
|
|
||||||
|
*//**更新人*//*
|
||||||
|
private java.lang.String updateBy;
|
||||||
|
|
||||||
|
*//**更新日期*//*
|
||||||
|
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
|
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
|
||||||
|
private java.util.Date updateTime;
|
||||||
|
|
||||||
|
*//**所属部门*//*
|
||||||
|
@ApiModelProperty(value = "所属部门")
|
||||||
|
private String sysOrgCode;
|
||||||
|
|
||||||
|
*//**中英切换标志*//*
|
||||||
|
@TableField(exist = false)
|
||||||
|
private String cut;
|
||||||
|
}*/
|
||||||
|
|||||||
+7
-7
@@ -1,13 +1,13 @@
|
|||||||
package com.jero.modules.project.enums;
|
package com.jero.modules.project.enums;
|
||||||
|
|
||||||
public enum ProjectTaskPlanningNameEnum {
|
public enum ProjectTaskPlanningNameEnum {
|
||||||
LIST_CONFIRMATION("法规清单确认","listConfirmation"),
|
LIST_CONFIRMATION("法规清单确认"," Confirmation of regulations list"),
|
||||||
LEGAL_TASK_CONFIRMATION("法规任务确认","legalTaskConfirmation"),
|
LEGAL_TASK_CONFIRMATION("法规任务确认","Regulatory task confirmation"),
|
||||||
DESIGN_DEADLINE("设计符合性确认截止时间","designDeadline"),
|
DESIGN_DEADLINE("设计符合性确认","Design Compliance Check"),
|
||||||
PREHOMO_DEADLINE("PreHomo确认截止时间","prehomoDeadline"),
|
PREHOMO_DEADLINE("PreHomo确认","Pre-homo Check"),
|
||||||
ATTESTATION_START_TIME("认证开始","attestationStartTime"),
|
ATTESTATION_START_TIME("认证开始","Certification start"),
|
||||||
ATTESTATION_END_TIME("认证结束","attestationEndTime"),
|
ATTESTATION_END_TIME("认证结束"," Certification end\n"),
|
||||||
VERIFY_DEADLINE("验证符合性确认截止时间","verifyDeadline"),
|
VERIFY_DEADLINE("验证符合性确认截止时间","Verification compliance confirmation deadline"),
|
||||||
|
|
||||||
;
|
;
|
||||||
String name;
|
String name;
|
||||||
|
|||||||
+3
-4
@@ -4,7 +4,6 @@ import com.baomidou.mybatisplus.extension.service.IService;
|
|||||||
import com.jero.common.api.vo.Result;
|
import com.jero.common.api.vo.Result;
|
||||||
import com.jero.modules.project.entity.ProjectRelatedPersonnel;
|
import com.jero.modules.project.entity.ProjectRelatedPersonnel;
|
||||||
import com.jero.modules.system.entity.SysUser;
|
import com.jero.modules.system.entity.SysUser;
|
||||||
import org.springframework.web.servlet.ModelAndView;
|
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
@@ -71,13 +70,13 @@ public interface IProjectRelatedPersonnelService extends IService<ProjectRelated
|
|||||||
Map<String,Object> queryPersonByProjectId(String projectId, String dutyTerritory);
|
Map<String,Object> queryPersonByProjectId(String projectId, String dutyTerritory);
|
||||||
|
|
||||||
/**处理导出数据*/
|
/**处理导出数据*/
|
||||||
List<ProjectRelatedPersonnel> disposeExportXls(String id,String projectId);
|
List<ProjectRelatedPersonnel> disposeExportXls(String id,String projectId,String cut);
|
||||||
|
|
||||||
/**导出excel*/
|
/**导出excel*/
|
||||||
ModelAndView exportDataToXls(HttpServletRequest request, List<ProjectRelatedPersonnel> dataList, Class<ProjectRelatedPersonnel> clazz, String title,String cut);
|
void exportDataToXls(String cut, HttpServletResponse response, HttpServletRequest request, List<ProjectRelatedPersonnel> dataList);
|
||||||
|
|
||||||
/**设置导出模板*/
|
/**设置导出模板*/
|
||||||
ModelAndView setExporTemplate(HttpServletRequest request, Class<ProjectRelatedPersonnel> clazz, String title,String cut);
|
void exportTemplate(ProjectRelatedPersonnel projectRelatedPersonnel, HttpServletResponse response, HttpServletRequest request);
|
||||||
|
|
||||||
Result<?> importExcel(HttpServletRequest request, HttpServletResponse response, Class<ProjectRelatedPersonnel> clazz, String projectId,String cut);
|
Result<?> importExcel(HttpServletRequest request, HttpServletResponse response, Class<ProjectRelatedPersonnel> clazz, String projectId,String cut);
|
||||||
|
|
||||||
|
|||||||
+223
-68
@@ -1,5 +1,7 @@
|
|||||||
package com.jero.modules.project.service.impl;
|
package com.jero.modules.project.service.impl;
|
||||||
|
|
||||||
|
import cn.afterturn.easypoi.excel.ExcelImportUtil;
|
||||||
|
import cn.afterturn.easypoi.excel.entity.ImportParams;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
@@ -11,7 +13,7 @@ import com.jero.modules.enums.DictCodeEnum;
|
|||||||
import com.jero.modules.project.entity.ProjectRelatedPersonnel;
|
import com.jero.modules.project.entity.ProjectRelatedPersonnel;
|
||||||
import com.jero.modules.project.mapper.ProjectRelatedPersonnelMapper;
|
import com.jero.modules.project.mapper.ProjectRelatedPersonnelMapper;
|
||||||
import com.jero.modules.project.service.IProjectRelatedPersonnelService;
|
import com.jero.modules.project.service.IProjectRelatedPersonnelService;
|
||||||
import com.jero.modules.project.util.ExcelLangUtils;
|
import com.jero.modules.system.entity.SysDictItem;
|
||||||
import com.jero.modules.system.entity.SysUser;
|
import com.jero.modules.system.entity.SysUser;
|
||||||
import com.jero.modules.system.mapper.SysDictItemMapper;
|
import com.jero.modules.system.mapper.SysDictItemMapper;
|
||||||
import com.jero.modules.system.mapper.SysDictMapper;
|
import com.jero.modules.system.mapper.SysDictMapper;
|
||||||
@@ -20,21 +22,28 @@ import com.jero.modules.system.service.ISysDictService;
|
|||||||
import com.jero.modules.system.service.ISysUserService;
|
import com.jero.modules.system.service.ISysUserService;
|
||||||
import com.jero.modules.system.util.StringUtils;
|
import com.jero.modules.system.util.StringUtils;
|
||||||
import org.apache.commons.collections4.CollectionUtils;
|
import org.apache.commons.collections4.CollectionUtils;
|
||||||
|
import org.apache.commons.io.IOUtils;
|
||||||
|
import org.apache.poi.hssf.usermodel.HSSFCellStyle;
|
||||||
|
import org.apache.poi.hssf.usermodel.HSSFRichTextString;
|
||||||
|
import org.apache.poi.hssf.usermodel.HSSFSheet;
|
||||||
|
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
|
||||||
|
import org.apache.poi.ss.usermodel.Cell;
|
||||||
|
import org.apache.poi.ss.usermodel.HorizontalAlignment;
|
||||||
|
import org.apache.poi.ss.usermodel.Row;
|
||||||
|
import org.apache.poi.ss.usermodel.VerticalAlignment;
|
||||||
|
import org.apache.poi.ss.util.CellRangeAddress;
|
||||||
import org.apache.shiro.SecurityUtils;
|
import org.apache.shiro.SecurityUtils;
|
||||||
import org.jeecgframework.poi.excel.ExcelImportUtil;
|
|
||||||
import org.jeecgframework.poi.excel.def.NormalExcelConstants;
|
|
||||||
import org.jeecgframework.poi.excel.entity.ExportParams;
|
|
||||||
import org.jeecgframework.poi.excel.entity.ImportParams;
|
|
||||||
import org.jeecgframework.poi.excel.view.JeecgEntityExcelView;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.web.multipart.MultipartFile;
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
import org.springframework.web.multipart.MultipartHttpServletRequest;
|
import org.springframework.web.multipart.MultipartHttpServletRequest;
|
||||||
import org.springframework.web.servlet.ModelAndView;
|
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
import java.io.OutputStream;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
@@ -62,6 +71,10 @@ public class ProjectRelatedPersonnelServiceImpl extends ServiceImpl<ProjectRelat
|
|||||||
private SysDictMapper sysDictMapper;
|
private SysDictMapper sysDictMapper;
|
||||||
@Autowired
|
@Autowired
|
||||||
private SysDictItemMapper sysDictItemMapper;
|
private SysDictItemMapper sysDictItemMapper;
|
||||||
|
|
||||||
|
@Value(value = "${jero.path.upload}")
|
||||||
|
private String uploadpath;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 保存
|
* 保存
|
||||||
*
|
*
|
||||||
@@ -158,10 +171,11 @@ public class ProjectRelatedPersonnelServiceImpl extends ServiceImpl<ProjectRelat
|
|||||||
public List<ProjectRelatedPersonnel> queryPageList(String projectId) {
|
public List<ProjectRelatedPersonnel> queryPageList(String projectId) {
|
||||||
//查询数据
|
//查询数据
|
||||||
List<ProjectRelatedPersonnel> result = projectRelatedPersonnelMapper.queryPageList(projectId);
|
List<ProjectRelatedPersonnel> result = projectRelatedPersonnelMapper.queryPageList(projectId);
|
||||||
|
//查标签内容里的责任领域数据
|
||||||
|
List<String> sysDictItemValueList = sysDictItemMapper.selectItemValueByDictCode(DictCodeEnum.DUTY_TERRITORY.getValue());
|
||||||
//没有数据->新增所有责任领域,查询
|
//没有数据->新增所有责任领域,查询
|
||||||
if(CollectionUtils.isEmpty(result)){
|
if(result.size()<sysDictItemValueList.size()){
|
||||||
//查标签内容里的责任领域数据
|
// if(CollectionUtils.isEmpty(result)){
|
||||||
List<String> sysDictItemValueList = sysDictItemMapper.selectItemValueByDictCode(DictCodeEnum.DUTY_TERRITORY.getValue());
|
|
||||||
//新建相关人员表里的责任领域数据
|
//新建相关人员表里的责任领域数据
|
||||||
if (CollectionUtils.isNotEmpty(sysDictItemValueList)) {
|
if (CollectionUtils.isNotEmpty(sysDictItemValueList)) {
|
||||||
for (String sysDictItemValue : sysDictItemValueList) {
|
for (String sysDictItemValue : sysDictItemValueList) {
|
||||||
@@ -384,7 +398,7 @@ public class ProjectRelatedPersonnelServiceImpl extends ServiceImpl<ProjectRelat
|
|||||||
|
|
||||||
/**处理导出数据*/
|
/**处理导出数据*/
|
||||||
@Override
|
@Override
|
||||||
public List<ProjectRelatedPersonnel> disposeExportXls(String id,String projectId){
|
public List<ProjectRelatedPersonnel> disposeExportXls(String id,String projectId,String cut){
|
||||||
List<ProjectRelatedPersonnel> records=null;
|
List<ProjectRelatedPersonnel> records=null;
|
||||||
|
|
||||||
if(StringUtils.isNotBlank(id)) {//多个id
|
if(StringUtils.isNotBlank(id)) {//多个id
|
||||||
@@ -392,9 +406,10 @@ public class ProjectRelatedPersonnelServiceImpl extends ServiceImpl<ProjectRelat
|
|||||||
//id有值,按id查
|
//id有值,按id查
|
||||||
if (id.contains(",")) {//多个id
|
if (id.contains(",")) {//多个id
|
||||||
List<String> idList = Arrays.asList(id.split(","));
|
List<String> idList = Arrays.asList(id.split(","));
|
||||||
for (String midId : idList) {
|
QueryWrapper<ProjectRelatedPersonnel> queryWrapper = new QueryWrapper<>();
|
||||||
records = queryById(midId);
|
queryWrapper.in("id",idList);
|
||||||
}
|
records = list(queryWrapper);
|
||||||
|
|
||||||
} else {//1个id
|
} else {//1个id
|
||||||
records = queryById(id);
|
records = queryById(id);
|
||||||
}
|
}
|
||||||
@@ -402,85 +417,224 @@ public class ProjectRelatedPersonnelServiceImpl extends ServiceImpl<ProjectRelat
|
|||||||
records=queryPageList(projectId);
|
records=queryPageList(projectId);
|
||||||
}
|
}
|
||||||
//id无值,传全部
|
//id无值,传全部
|
||||||
|
disposeDutyTerritory(records,cut);
|
||||||
return records;
|
return records;
|
||||||
}
|
}
|
||||||
|
public void disposeDutyTerritory(List<ProjectRelatedPersonnel> records,String cut) {
|
||||||
|
//查标签内容里的责任领域数据
|
||||||
|
List<SysDictItem> sysDictItemValueList = sysDictItemMapper.selectItemsByDictCode(DictCodeEnum.DUTY_TERRITORY.getValue());
|
||||||
|
if (CollectionUtils.isNotEmpty(records)) {
|
||||||
|
List<String> dutyTerritory = new ArrayList<>();
|
||||||
|
for (ProjectRelatedPersonnel projectRelatedPersonnel : records) {
|
||||||
|
if (CutEnum.CN.getValue().equals(cut)) {
|
||||||
|
dutyTerritory = sysDictItemValueList.stream().filter(f -> f.getItemValue().equals(projectRelatedPersonnel.getDutyTerritory())).map(e -> e.getItemText()).collect(Collectors.toList());
|
||||||
|
} else {
|
||||||
|
dutyTerritory = sysDictItemValueList.stream().filter(f -> f.getItemValue().equals(projectRelatedPersonnel.getDutyTerritory())).map(e -> e.getEnName()).collect(Collectors.toList());
|
||||||
|
}
|
||||||
|
projectRelatedPersonnel.setDutyTerritory(dutyTerritory.get(0));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
/**
|
/**
|
||||||
* 根据查到的数据,导出excel
|
* 根据查到的数据,导出excel
|
||||||
*
|
*
|
||||||
* @param request
|
* @param request
|
||||||
*/@Override
|
*/
|
||||||
public ModelAndView exportDataToXls(HttpServletRequest request, List<ProjectRelatedPersonnel> dataList,
|
@Override
|
||||||
Class<ProjectRelatedPersonnel> clazz, String title,String cut) {
|
public void exportDataToXls(String cut, HttpServletResponse response, HttpServletRequest request, List<ProjectRelatedPersonnel> dataList) {
|
||||||
// Step.1 组装查询条件
|
OutputStream os = null;
|
||||||
LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
|
HSSFWorkbook workbook = new HSSFWorkbook();
|
||||||
// Step.2 AutoPoi 导出Excel
|
String fileOriName = "法规清单导入模板.xls";
|
||||||
ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
|
String filePath = uploadpath + File.separator + fileOriName;
|
||||||
ExportParams exportParams=null;
|
|
||||||
try {
|
try {
|
||||||
//中英切换
|
String titleOne = "";
|
||||||
if(CutEnum.CN.getValue().equals(cut)) {
|
if(CutEnum.CN.getValue().equals(cut)){
|
||||||
exportParams=new ExportParams(title , null, title);
|
titleOne = "*责任领域,*法规工程师,*工程接口人,*认证工程师,备注";
|
||||||
mv.addObject(NormalExcelConstants.CLASS, ExcelLangUtils.chooseLang(clazz, CutEnum.CN.getValue()));
|
}else{
|
||||||
}
|
titleOne = "*Responsible Field,*Regulation Engineer,*Engineering Interface,*Homologation Engineer,Comments";
|
||||||
else {
|
|
||||||
exportParams=new ExportParams(title , null, title);
|
|
||||||
mv.addObject(NormalExcelConstants.CLASS, ExcelLangUtils.chooseLang(clazz, CutEnum.EN.getValue()));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
mv.addObject(NormalExcelConstants.FILE_NAME, title); //此处设置的filename无效 ,前端会重更新设置一下
|
//创建临时文件夹
|
||||||
|
File nowFile = new File(filePath);
|
||||||
|
if (nowFile.exists()) {
|
||||||
|
nowFile.delete();
|
||||||
|
}
|
||||||
|
nowFile.mkdirs();
|
||||||
|
HSSFSheet sheet = workbook.createSheet("虚拟清单导入模板");
|
||||||
|
sheet.setDefaultColumnWidth(16);//列宽
|
||||||
|
HSSFCellStyle cellStyle = workbook.createCellStyle();
|
||||||
|
cellStyle.setWrapText(true);//自动换行
|
||||||
|
cellStyle.setAlignment(HorizontalAlignment.CENTER);//垂直居中
|
||||||
|
cellStyle.setVerticalAlignment(VerticalAlignment.CENTER);//水平居中
|
||||||
|
|
||||||
|
HSSFCellStyle cellStyleTemp = workbook.createCellStyle();
|
||||||
|
cellStyleTemp.setWrapText(true);//自动换行
|
||||||
|
|
||||||
mv.addObject(NormalExcelConstants.PARAMS,exportParams);
|
int startLine = 0;
|
||||||
mv.addObject(NormalExcelConstants.DATA_LIST, dataList);
|
int endLine = 4;
|
||||||
return mv;
|
//合并单元格
|
||||||
}catch(Exception e){
|
CellRangeAddress region1 =
|
||||||
throw new JeroBootException("出现异常,请重新登录");
|
new CellRangeAddress(1, 1, startLine, endLine); //参数1:起始行 参数2:终止行 参数3:起始列 参数4:终止列
|
||||||
|
sheet.addMergedRegion(region1);
|
||||||
|
|
||||||
|
String explainInfo= null;
|
||||||
|
|
||||||
|
if(CutEnum.CN.getValue().equals(cut)){
|
||||||
|
explainInfo = "填写说明\n" +
|
||||||
|
"1.导入数据从第四行开始\n" +
|
||||||
|
"2.所有带*号的字段必须填写\n"+
|
||||||
|
"3.认证类型,认证级别,实施类别,交付物类型,发起人,责任人,字段是单选属性,必须和系统中的对应字段选项相匹配\n" +
|
||||||
|
"4.责任领域,字段是多选属性,必须和系统中的对应字段选项相匹配,填写多个时采用英文或中文逗号分割\n" +
|
||||||
|
"5.编号,子标题,WVTA ID,备注,填写文本内容\n" +
|
||||||
|
"6.交付物模板字段为文件属性,填写时需要在本文件同级目录下以标准号为名称建立文件夹,并在文件夹下放置文件,假设在AAA标准号下放置了B.docx,则应填写AAA/B.docx";
|
||||||
|
}else{
|
||||||
|
explainInfo = "filling explanation\n" +
|
||||||
|
"1.import data starts at the fourth line\n" +
|
||||||
|
"2.all fields marked with * must be filled in\n"+
|
||||||
|
"3.certification type,certification level,implementation category,type of deliverables,initiator,person liable,Fields are radio attributes that must match the corresponding field option in the system\n" +
|
||||||
|
"4.area of responsibility, field is a multi-select attribute and must match the corresponding field in the system. If multiple fields are filled in, separate them by commas (,)\n" +
|
||||||
|
"5.serial number,subtitle,WVTA ID,remarks,Fill in the text\n" +
|
||||||
|
"6.deliverable template,When filling in the field, you need to create a folder in the directory of the same level as the file with the name of the standard number and place the file in the folder. If b. diocx is stored under the AAA standard number, enter AAA/B. diocx";
|
||||||
|
}
|
||||||
|
HSSFRichTextString explain=new HSSFRichTextString(explainInfo);
|
||||||
|
|
||||||
|
//表头
|
||||||
|
Row row = sheet.createRow(0);//开始创建标题行
|
||||||
|
String[] headerArr = titleOne.split(",");
|
||||||
|
for (int m = 0; m < headerArr.length; m++) {
|
||||||
|
row.createCell(m).setCellValue(headerArr[m]);
|
||||||
|
}
|
||||||
|
|
||||||
|
Row rowExplain = sheet.createRow(1);
|
||||||
|
short height = (short) (7 * 252);
|
||||||
|
rowExplain.setHeight((short) height);
|
||||||
|
Cell cell = rowExplain.createCell(0);
|
||||||
|
cell.setCellValue(explain);
|
||||||
|
cell.setCellStyle(cellStyleTemp);
|
||||||
|
|
||||||
|
//设置导出数据
|
||||||
|
if(CollectionUtils.isNotEmpty(dataList)) {
|
||||||
|
for (int j = 2; j < dataList.size()+2; j++) {
|
||||||
|
Row dataRow = sheet.createRow(j);
|
||||||
|
dataRow.createCell(0).setCellValue(dataList.get(j - 2).getDutyTerritory());
|
||||||
|
dataRow.createCell(1).setCellValue(dataList.get(j - 2).getLawEngineerName());
|
||||||
|
dataRow.createCell(2).setCellValue(dataList.get(j - 2).getEngineeringInterfacePersonName());
|
||||||
|
dataRow.createCell(3).setCellValue(dataList.get(j - 2).getCertificationEngineerName());
|
||||||
|
dataRow.createCell(4).setCellValue(dataList.get(j - 2).getRemark());
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
response.setHeader("Content-Disposition",
|
||||||
|
"attachment; filename=\"" + fileOriName + ".xls");
|
||||||
|
response.setContentType("application/force-download");
|
||||||
|
response.flushBuffer();
|
||||||
|
os = response.getOutputStream();
|
||||||
|
workbook.write(os);
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
throw new JeroBootException("下载文件失败,请重试");
|
||||||
|
} finally {
|
||||||
|
IOUtils.closeQuietly(os);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 导出excel模板
|
* 导出excel模板
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public ModelAndView setExporTemplate(HttpServletRequest request, Class<ProjectRelatedPersonnel> clazz, String title,String cut){
|
public void exportTemplate(ProjectRelatedPersonnel projectRelatedPersonnel, HttpServletResponse response, HttpServletRequest request) {
|
||||||
List<ProjectRelatedPersonnel> records=new ArrayList<>();
|
OutputStream os = null;
|
||||||
// ProjectRelatedPersonnel projectRelatedPersonnel=new ProjectRelatedPersonnel();
|
HSSFWorkbook workbook = new HSSFWorkbook();
|
||||||
// Step.1 组装查询条件
|
String fileOriName = "法规清单导入模板.xls";
|
||||||
LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
|
String filePath = uploadpath + File.separator + fileOriName;
|
||||||
ExportParams exportParams=null;
|
|
||||||
// Step.2 AutoPoi 导出Excel
|
|
||||||
ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
|
|
||||||
try {
|
try {
|
||||||
//中英切换模板
|
String titleOne = "";
|
||||||
if(CutEnum.CN.getValue().equals(cut)) {
|
if(CutEnum.CN.getValue().equals(projectRelatedPersonnel.getCut())){
|
||||||
//projectRelatedPersonnel.setDutyTerritory(ExportTemplateEnum.DUTY_TERRITORY_FIELD_of_PRODUCTION.getName());
|
titleOne = "*责任领域,*法规工程师,*工程接口人,*认证工程师,备注";
|
||||||
exportParams=new ExportParams(title , null, title);
|
|
||||||
}else{
|
}else{
|
||||||
//projectRelatedPersonnel.setDutyTerritory(ExportTemplateEnum.DUTY_TERRITORY_FIELD_of_PRODUCTION.getValue());
|
titleOne = "*Responsible Field,*Regulation Engineer,*Engineering Interface,*Homologation Engineer,Comments";
|
||||||
exportParams=new ExportParams(title , null, title);
|
|
||||||
}
|
}
|
||||||
//查标签内容里的责任领域数据
|
|
||||||
List<String> dictItemNameList = sysDictMapper.queryDictNameByCode(DictCodeEnum.DUTY_TERRITORY.getValue());
|
//创建临时文件夹
|
||||||
//新建相关人员表里的责任领域数据
|
File nowFile = new File(filePath);
|
||||||
if (CollectionUtils.isNotEmpty(dictItemNameList)) {
|
if (nowFile.exists()) {
|
||||||
for (String dictItemName : dictItemNameList) {
|
nowFile.delete();
|
||||||
ProjectRelatedPersonnel projectRelatedPersonnel=new ProjectRelatedPersonnel();
|
|
||||||
projectRelatedPersonnel.setDutyTerritory(dictItemName);
|
|
||||||
records.add(projectRelatedPersonnel);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
mv.addObject(NormalExcelConstants.FILE_NAME, title); //此处设置的filename无效 ,前端会重更新设置一下
|
nowFile.mkdirs();
|
||||||
mv.addObject(NormalExcelConstants.CLASS, clazz);//!!!!这里设置中英切换
|
HSSFSheet sheet = workbook.createSheet("虚拟清单导入模板");
|
||||||
mv.addObject(NormalExcelConstants.PARAMS,exportParams);
|
sheet.setDefaultColumnWidth(16);//列宽
|
||||||
mv.addObject(NormalExcelConstants.DATA_LIST,records);
|
HSSFCellStyle cellStyle = workbook.createCellStyle();
|
||||||
return mv;
|
cellStyle.setWrapText(true);//自动换行
|
||||||
}catch(Exception e){
|
cellStyle.setAlignment(HorizontalAlignment.CENTER);//垂直居中
|
||||||
throw new JeroBootException("出现异常,请重新登录");
|
cellStyle.setVerticalAlignment(VerticalAlignment.CENTER);//水平居中
|
||||||
|
|
||||||
|
HSSFCellStyle cellStyleTemp = workbook.createCellStyle();
|
||||||
|
cellStyleTemp.setWrapText(true);//自动换行
|
||||||
|
|
||||||
|
int startLine = 0;
|
||||||
|
int endLine = 4;
|
||||||
|
//合并单元格
|
||||||
|
CellRangeAddress region1 =
|
||||||
|
new CellRangeAddress(1, 1, startLine, endLine); //参数1:起始行 参数2:终止行 参数3:起始列 参数4:终止列
|
||||||
|
sheet.addMergedRegion(region1);
|
||||||
|
|
||||||
|
String explainInfo= null;
|
||||||
|
|
||||||
|
if(CutEnum.CN.getValue().equals(projectRelatedPersonnel.getCut())){
|
||||||
|
explainInfo = "填写说明\n" +
|
||||||
|
"1.导入数据从第四行开始\n" +
|
||||||
|
"2.所有带*号的字段必须填写\n"+
|
||||||
|
"3.认证类型,认证级别,实施类别,交付物类型,发起人,责任人,字段是单选属性,必须和系统中的对应字段选项相匹配\n" +
|
||||||
|
"4.责任领域,字段是多选属性,必须和系统中的对应字段选项相匹配,填写多个时采用英文或中文逗号分割\n" +
|
||||||
|
"5.编号,子标题,WVTA ID,备注,填写文本内容\n" +
|
||||||
|
"6.交付物模板字段为文件属性,填写时需要在本文件同级目录下以标准号为名称建立文件夹,并在文件夹下放置文件,假设在AAA标准号下放置了B.docx,则应填写AAA/B.docx";
|
||||||
|
}else{
|
||||||
|
explainInfo = "filling explanation\n" +
|
||||||
|
"1.import data starts at the fourth line\n" +
|
||||||
|
"2.all fields marked with * must be filled in\n"+
|
||||||
|
"3.certification type,certification level,implementation category,type of deliverables,initiator,person liable,Fields are radio attributes that must match the corresponding field option in the system\n" +
|
||||||
|
"4.area of responsibility, field is a multi-select attribute and must match the corresponding field in the system. If multiple fields are filled in, separate them by commas (,)\n" +
|
||||||
|
"5.serial number,subtitle,WVTA ID,remarks,Fill in the text\n" +
|
||||||
|
"6.deliverable template,When filling in the field, you need to create a folder in the directory of the same level as the file with the name of the standard number and place the file in the folder. If b. diocx is stored under the AAA standard number, enter AAA/B. diocx";
|
||||||
|
}
|
||||||
|
HSSFRichTextString explain=new HSSFRichTextString(explainInfo);
|
||||||
|
|
||||||
|
//表头
|
||||||
|
Row row = sheet.createRow(0);//开始创建标题行
|
||||||
|
String[] headerArr = titleOne.split(",");
|
||||||
|
for (int m = 0; m < headerArr.length; m++) {
|
||||||
|
row.createCell(m).setCellValue(headerArr[m]);
|
||||||
|
}
|
||||||
|
|
||||||
|
Row rowExplain = sheet.createRow(1);
|
||||||
|
short height = (short) (7 * 252);
|
||||||
|
rowExplain.setHeight((short) height);
|
||||||
|
Cell cell = rowExplain.createCell(0);
|
||||||
|
cell.setCellValue(explain);
|
||||||
|
cell.setCellStyle(cellStyleTemp);
|
||||||
|
|
||||||
|
response.setHeader("Content-Disposition",
|
||||||
|
"attachment; filename=\"" + fileOriName + ".xls");
|
||||||
|
response.setContentType("application/force-download");
|
||||||
|
response.flushBuffer();
|
||||||
|
os = response.getOutputStream();
|
||||||
|
workbook.write(os);
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
throw new JeroBootException("下载文件失败,请重试");
|
||||||
|
} finally {
|
||||||
|
IOUtils.closeQuietly(os);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 导入excel数据
|
* 导入excel数据
|
||||||
*
|
*
|
||||||
@@ -543,7 +697,6 @@ public class ProjectRelatedPersonnelServiceImpl extends ServiceImpl<ProjectRelat
|
|||||||
|
|
||||||
for (ProjectRelatedPersonnel projectRelatedPersonnel:records) {
|
for (ProjectRelatedPersonnel projectRelatedPersonnel:records) {
|
||||||
//查标签内容里的责任领域数据
|
//查标签内容里的责任领域数据
|
||||||
//List<String> dictItemNameList = sysDictMapper.queryDictNameByCode(DictCodeEnum.DUTY_TERRITORY.getValue());
|
|
||||||
List<String> sysDictItemValueList = sysDictItemMapper.selectItemValueByDictCode(DictCodeEnum.DUTY_TERRITORY.getValue());
|
List<String> sysDictItemValueList = sysDictItemMapper.selectItemValueByDictCode(DictCodeEnum.DUTY_TERRITORY.getValue());
|
||||||
if(!sysDictItemValueList.contains(projectRelatedPersonnel.getDutyTerritory())){
|
if(!sysDictItemValueList.contains(projectRelatedPersonnel.getDutyTerritory())){
|
||||||
if (CutEnum.CN.getValue().equals(cut)) {
|
if (CutEnum.CN.getValue().equals(cut)) {
|
||||||
@@ -628,7 +781,7 @@ public class ProjectRelatedPersonnelServiceImpl extends ServiceImpl<ProjectRelat
|
|||||||
}
|
}
|
||||||
|
|
||||||
//工程接口人
|
//工程接口人
|
||||||
List<SysUser> engineeringInterfacePersonUsers = new ArrayList<>();
|
List<SysUser> engineeringInterfacePersonUsers = new ArrayList<>();
|
||||||
if (StringUtils.isNotBlank(projectRelatedPersonnel.getEngineeringInterfacePersonName())){
|
if (StringUtils.isNotBlank(projectRelatedPersonnel.getEngineeringInterfacePersonName())){
|
||||||
List<String> engineeringInterfacePersonNameList = Arrays.asList(projectRelatedPersonnel.getEngineeringInterfacePersonName().split(","));
|
List<String> engineeringInterfacePersonNameList = Arrays.asList(projectRelatedPersonnel.getEngineeringInterfacePersonName().split(","));
|
||||||
if (CollectionUtils.isNotEmpty(engineeringInterfacePersonNameList) && StringUtils.isNotBlank(engineeringInterfacePersonNameList.get(0))) {
|
if (CollectionUtils.isNotEmpty(engineeringInterfacePersonNameList) && StringUtils.isNotBlank(engineeringInterfacePersonNameList.get(0))) {
|
||||||
@@ -788,4 +941,6 @@ public class ProjectRelatedPersonnelServiceImpl extends ServiceImpl<ProjectRelat
|
|||||||
}
|
}
|
||||||
return certificationEngineerUsers;
|
return certificationEngineerUsers;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user