虚拟清单导出(英文)

This commit is contained in:
zhn
2022-05-17 17:24:53 +08:00
parent e523614459
commit 18ed4a7775
3 changed files with 438 additions and 43 deletions
@@ -74,34 +74,44 @@ public class DummyInventoryInfoEO implements Serializable {
@ApiModelProperty(value = "标题")
private java.lang.String title;
/**子标题*/
@Excel(name = "子标题", width = 15)
@ApiModelProperty(value = "子标题")
private java.lang.String subtitle;
/**适用地区*/
@ApiModelProperty(value = "适用地区")
@Dict(dicCode ="region")
@Excel(name = "适用地区", width = 15, dicCode = "region")
private java.lang.String region;
/**适用范围*/
@Excel(name = "适用范围", width = 15, dicCode = "apply_scope")
@ApiModelProperty(value = "适用范围")
@Dict(dicCode ="apply_scope")
private java.lang.String shi4Yong4Fan4Wei2;
/**适用地区*/
@ApiModelProperty(value = "适用地区")
@Dict(dicCode ="region")
@Excel(name = "适用地区", width = 15, dicCode = "region")
private java.lang.String region;
/**状态*/
@Excel(name = "状态", width = 15,dicCode ="state")
@ApiModelProperty(value = "状态")
@Dict(dicCode ="state")
private java.lang.String state;
/**技术领域*/
@Excel(name = "技术领域", width = 15)
@ApiModelProperty(value = "技术领域")
private java.lang.String technologyTerritory;
/**对应标准*/
@Excel(name = "对应标准", width = 15)
@ApiModelProperty(value = "对应标准")
private java.lang.String correspondingStandard;
@TableField(exist = false)
private java.lang.String correspondingStandardName;
@TableField(exist = false)
private java.lang.String technologyTerritoryName;
/**实施类别*/
@Excel(name = "实施类别", width = 15,dicCode ="implement_type")
@ApiModelProperty(value = "实施类别")
@Dict(dicCode ="implement_type")
private java.lang.String implementType;
/**新车型实施日期*/
@Excel(name = "新车型实施日期", width = 15,format = "yyyy-MM-dd")
/**新车型实施日期*/
@Excel(name = "新车型实施日期", width = 15,format = "yyyy-MM-dd")
@ApiModelProperty(value = "新车型实施日期")
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd")
@DateTimeFormat(pattern="yyyy-MM-dd")
@@ -109,8 +119,8 @@ public class DummyInventoryInfoEO implements Serializable {
@TableField(exist = false)
private String xin1Che1Xing2Shi2Shi1Ri4Qi1String;
/**在产车实施日期*/
@Excel(name = "在产车实施日期", width = 15,format = "yyyy-MM-dd")
/**在产车实施日期*/
@Excel(name = "在产车实施日期", width = 15,format = "yyyy-MM-dd")
@ApiModelProperty(value = "在产车实施日期")
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd")
@DateTimeFormat(pattern="yyyy-MM-dd")
@@ -118,37 +128,21 @@ public class DummyInventoryInfoEO implements Serializable {
@TableField(exist = false)
private String implementTimeString;
/**对应标准*/
@Excel(name = "对应标准", width = 15)
@ApiModelProperty(value = "对应标准")
private java.lang.String correspondingStandard;
@TableField(exist = false)
private java.lang.String correspondingStandardName;
/**WVTA ID*/
@Excel(name = "WVTA ID", width = 15)
/**WVTA ID*/
@Excel(name = "WVTA ID", width = 15)
@ApiModelProperty(value = "WVTA ID")
private java.lang.String wvtaId;
/**子标题*/
@Excel(name = "子标题", width = 15)
@ApiModelProperty(value = "子标题")
private java.lang.String subtitle;
/**实施类别*/
@Excel(name = "实施类别", width = 15,dicCode ="implement_type")
@ApiModelProperty(value = "实施类别")
@Dict(dicCode ="implement_type")
private java.lang.String implementType;
/**认证类型*/
@Excel(name = "认证类型", width = 15,dicCode ="attestation_type")
/**认证类型*/
@Excel(name = "认证类型", width = 15,dicCode ="attestation_type")
@ApiModelProperty(value = "认证类型")
@Dict(dicCode ="attestation_type")
private java.lang.String attestationType;
/**认证级别*/
@Excel(name = "认证级别", width = 15,dicCode ="attestation_rank")
/**认证级别*/
@Excel(name = "认证级别", width = 15,dicCode ="attestation_rank")
@ApiModelProperty(value = "认证级别")
@Dict(dicCode ="attestation_rank")
private java.lang.String attestationRank;
@@ -158,6 +152,14 @@ public class DummyInventoryInfoEO implements Serializable {
@Excel(name = "适用增补件", width = 15)
private java.lang.String applicableSupplement;
/**技术领域*/
@Excel(name = "技术领域", width = 15)
@ApiModelProperty(value = "技术领域")
private java.lang.String technologyTerritory;
@TableField(exist = false)
private java.lang.String technologyTerritoryName;
/**责任领域*/
@Excel(name = "责任领域", width = 15,dicCode ="duty_territory")
@ApiModelProperty(value = "责任领域")
@@ -0,0 +1,268 @@
package com.jero.modules.dummy.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.jero.common.aspect.annotation.Dict;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import org.jeecgframework.poi.excel.annotation.Excel;
import org.springframework.format.annotation.DateTimeFormat;
import java.io.Serializable;
/**
* @Description: 虚拟清单详情表
* @Author: jero-boot
* @Date: 2022-04-11
* @Version: V1.0
*/
@Data
@TableName("dummy_inventory_info")
@Accessors(chain = true)
@EqualsAndHashCode(callSuper = false)
@ApiModel(value="dummy_inventory_info对象", description="虚拟清单详情表")
public class DummyInventoryInfoEOEn implements Serializable {
private static final long serialVersionUID = 1L;
/**主键*/
@TableId(type = IdType.ASSIGN_ID)
@ApiModelProperty(value = "主键")
private String id;
/**法规清单基础表id*/
@ApiModelProperty(value = "法规清单基础表id")
private String dummyInventoryBaseId;
/**创建人*/
@ApiModelProperty(value = "创建人")
private String createBy;
/**创建日期*/
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
@ApiModelProperty(value = "创建日期")
private java.util.Date createTime;
/**更新人*/
@ApiModelProperty(value = "更新人")
private String updateBy;
/**更新日期*/
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
@ApiModelProperty(value = "更新日期")
private java.util.Date updateTime;
/**所属部门*/
@ApiModelProperty(value = "所属部门")
private String sysOrgCode;
/**编号*/
@Excel(name = "Number", width = 15)
@ApiModelProperty(value = "编号")
private String serialNumber;
/**标题*/
@Excel(name = "title", width = 15)
@ApiModelProperty(value = "标题")
private String title;
/**子标题*/
@Excel(name = "Sub-Title", width = 15)
@ApiModelProperty(value = "子标题")
private String subtitle;
/**适用地区*/
@ApiModelProperty(value = "适用地区")
@Dict(dicCode ="region")
@Excel(name = "Area", width = 15, dicCode = "region")
private String region;
/**适用范围*/
@Excel(name = "Scope of application", width = 15, dicCode = "apply_scope")
@ApiModelProperty(value = "适用范围")
@Dict(dicCode ="apply_scope")
private String shi4Yong4Fan4Wei2;
/**状态*/
@Excel(name = "state", width = 15,dicCode ="state")
@ApiModelProperty(value = "状态")
@Dict(dicCode ="state")
private String state;
/**对应标准*/
@Excel(name = "Compare", width = 15)
@ApiModelProperty(value = "对应标准")
private String correspondingStandard;
@TableField(exist = false)
private String correspondingStandardName;
/**实施类别*/
@Excel(name = "Usage", width = 15,dicCode ="implement_type")
@ApiModelProperty(value = "实施类别")
@Dict(dicCode ="implement_type")
private String implementType;
/**新车型实施日期*/
@Excel(name = "New Type Execute Date", width = 15,format = "yyyy-MM-dd")
@ApiModelProperty(value = "新车型实施日期")
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd")
@DateTimeFormat(pattern="yyyy-MM-dd")
private java.util.Date xin1Che1Xing2Shi2Shi1Ri4Qi1;
@TableField(exist = false)
private String xin1Che1Xing2Shi2Shi1Ri4Qi1String;
/**在产车实施日期*/
@Excel(name = "New Vehicle Execute Date", width = 15,format = "yyyy-MM-dd")
@ApiModelProperty(value = "在产车实施日期")
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd")
@DateTimeFormat(pattern="yyyy-MM-dd")
private java.util.Date implementTime;
@TableField(exist = false)
private String implementTimeString;
/**WVTA ID*/
@Excel(name = "WVTA ID", width = 15)
@ApiModelProperty(value = "WVTA ID")
private String wvtaId;
/**认证类型*/
@Excel(name = "Certification Type", width = 15,dicCode ="attestation_type")
@ApiModelProperty(value = "认证类型")
@Dict(dicCode ="attestation_type")
private String attestationType;
/**认证级别*/
@Excel(name = "Certification Level", width = 15,dicCode ="attestation_rank")
@ApiModelProperty(value = "认证级别")
@Dict(dicCode ="attestation_rank")
private String attestationRank;
/**适用增补件*/
@ApiModelProperty(value = "适用增补件")
@Excel(name = "Applicable Supplement", width = 15)
private String applicableSupplement;
/**技术领域*/
@Excel(name = "Technical Field", width = 15)
@ApiModelProperty(value = "技术领域")
private String technologyTerritory;
@TableField(exist = false)
private String technologyTerritoryName;
/**责任领域*/
@Excel(name = "Responsible Field", width = 15,dicCode ="duty_territory")
@ApiModelProperty(value = "责任领域")
@Dict(dicCode ="duty_territory")
private String dutyTerritory;
/**备注*/
@Excel(name = "Comments", width = 15)
@ApiModelProperty(value = "备注")
private String remark;
/**设计符合性确认-交付物类型*/
@Excel(name = "design-Deliverables", width = 15,dicCode ="deliverable_template")
@ApiModelProperty(value = "设计符合性确认-交付物类型")
@Dict(dicCode ="deliverable_template")
private String designDeliverableType;
/**设计符合性确认-交付物模板*/
@ApiModelProperty(value = "设计符合性确认-交付物模板")
private String designDeliverableTemplate;
@TableField(exist = false)
@Excel(name = "design-Deliverable Template", width = 15)
private String designDeliverableTemplateName;
/**设计符合性确认-发起人*/
@Excel(name = "design-Initiator", width = 15,dicCode ="fa1_qi3_ren2")
@ApiModelProperty(value = "设计符合性确认-发起人")
@Dict(dicCode ="fa1_qi3_ren2")
private String designInitiator;
/**设计符合性确认-责任人*/
@Excel(name = "design-Assignee", width = 15,dicCode ="ze2_ren4_ren2")
@ApiModelProperty(value = "设计符合性确认-责任人")
@Dict(dicCode ="ze2_ren4_ren2")
private String designDuty;
/**prehomo确认-交付物类型*/
@Excel(name = "Prehomo-Deliverables", width = 15,dicCode ="deliverable_template")
@ApiModelProperty(value = "prehomo确认-交付物类型")
@Dict(dicCode ="deliverable_template")
private String prehomoDeliverableType;
/**prehomo确认-交付物模板*/
@ApiModelProperty(value = "prehomo确认-交付物模板")
private String prehomoDeliverableTemplate;
@TableField(exist = false)
@Excel(name = "Prehomo-Deliverable Template", width = 15)
private String prehomoDeliverableTemplateName;
/**prehomo确认-发起人*/
@Excel(name = "Prehomo-Initiator", width = 15,dicCode ="fa1_qi3_ren2")
@ApiModelProperty(value = "prehomo确认-发起人")
@Dict(dicCode ="fa1_qi3_ren2")
private String prehomoInitiator;
/**prehomo确认-责任人*/
@Excel(name = "Prehomo-Assignee", width = 15,dicCode ="ze2_ren4_ren2")
@ApiModelProperty(value = "prehomo确认-责任人")
@Dict(dicCode ="ze2_ren4_ren2")
private String prehomoDuty;
/**验证符合性确认-交付物类型*/
@Excel(name = "verify-Deliverables", width = 15,dicCode ="deliverable_template")
@ApiModelProperty(value = "验证符合性确认-交付物类型")
@Dict(dicCode ="deliverable_template")
private String verifyDeliverableType;
/**验证符合性确认-交付物模板*/
@ApiModelProperty(value = "验证符合性确认-交付物模板")
private String verifyDeliverableTemplate;
@TableField(exist = false)
@Excel(name = "verify-Deliverable Template", width = 15)
private String verifyDeliverableTemplateName;
/**验证符合性确认-发起人*/
@Excel(name = "verify-Initiator", width = 15,dicCode ="fa1_qi3_ren2")
@ApiModelProperty(value = "验证符合性确认-发起人")
@Dict(dicCode ="fa1_qi3_ren2")
private String verifyInitiator;
/**验证符合性确认-责任人*/
@Excel(name = "verify-Assignee", width = 15,dicCode ="ze2_ren4_ren2")
@ApiModelProperty(value = "验证符合性确认-责任人")
@Dict(dicCode ="ze2_ren4_ren2")
private String verifyDuty;
@TableField(exist = false)
private String cut;
@TableField(exist = false)
private String ids;
@TableField(exist = false)
private Integer pageNo;
@TableField(exist = false)
private Integer pageSize;
}
@@ -16,6 +16,7 @@ import com.jero.common.util.DateUtils;
import com.jero.modules.document.entity.BussDocumentLibraryEO;
import com.jero.modules.document.service.IBussDocumentLibraryEOService;
import com.jero.modules.dummy.entity.DummyInventoryInfoEO;
import com.jero.modules.dummy.entity.DummyInventoryInfoEOEn;
import com.jero.modules.dummy.entity.DummyLogEO;
import com.jero.modules.dummy.enums.DummyInventoryBaseFieldEnum;
import com.jero.modules.dummy.mapper.DummyInventoryInfoEOMapper;
@@ -1505,7 +1506,7 @@ public class DummyInventoryInfoEOServiceImpl extends ServiceImpl<DummyInventoryI
//文件
List<OSSFile> fileInfos = getOssFiles(dataList);
//数据转换(文件名称,技术领域,对应标准)
dataTransition(dataList, fileInfos);
dataTransition(dataList, fileInfos,dummyInventoryInfoEO);
OutputStream os = null;
try {
@@ -1523,7 +1524,19 @@ public class DummyInventoryInfoEOServiceImpl extends ServiceImpl<DummyInventoryI
OutputStream excelOS = new FileOutputStream(path + File.separator + "虚拟清单.xlsx");
ExportParams exportParams = new ExportParams();
exportParams.setType(ExcelType.XSSF);
workbook = ExcelExportUtil.exportExcel(exportParams, DummyInventoryInfoEO.class, dataList);
if(CutEnum.CN.getValue().equals(dummyInventoryInfoEO.getCut())){
workbook = ExcelExportUtil.exportExcel(exportParams, DummyInventoryInfoEO.class, dataList);
}else{
List<DummyInventoryInfoEOEn> dataListEn = new ArrayList<>();
for (DummyInventoryInfoEO inventoryInfoEO : dataList) {
DummyInventoryInfoEOEn dummyInventoryInfoEOEn = new DummyInventoryInfoEOEn();
BeanUtils.copyProperties(inventoryInfoEO,dummyInventoryInfoEOEn);
dataListEn.add(dummyInventoryInfoEOEn);
}
//下拉选中英文转换
transition(dataListEn);
workbook = ExcelExportUtil.exportExcel(exportParams, DummyInventoryInfoEOEn.class, dataListEn);
}
workbook.write(excelOS);
excelOS.flush();
@@ -1551,12 +1564,120 @@ public class DummyInventoryInfoEOServiceImpl extends ServiceImpl<DummyInventoryI
}
}
private void transition(List<DummyInventoryInfoEOEn> dataListEn){
//下拉选数据字典
List<SysCategory> sysCategoryList = sysCategoryService.list();
//技术领域数据字典
List<SysDictItem> sysDictItems = sysDictItemServiceImpl.selectItemsAll();
for (DummyInventoryInfoEOEn dummyInventoryInfoEOEn : dataListEn) {
//适用地区
String region = dummyInventoryInfoEOEn.getRegion();
String pullRegion = pull(sysDictItems, region,"region");
if(StringUtils.isNotBlank(pullRegion)){
dummyInventoryInfoEOEn.setRegion(pullRegion);
}
//适用范围shi4Yong4Fan4Wei2
String shi4Yong4Fan4Wei2 = dummyInventoryInfoEOEn.getShi4Yong4Fan4Wei2();
String pullshi4Yong4Fan4Wei2 = pull(sysDictItems, shi4Yong4Fan4Wei2,"apply_scope");
if(StringUtils.isNotBlank(pullshi4Yong4Fan4Wei2)){
dummyInventoryInfoEOEn.setShi4Yong4Fan4Wei2(pullshi4Yong4Fan4Wei2);
}
//状态state
String state = dummyInventoryInfoEOEn.getState();
String pullState = pull(sysDictItems, state,"state");
if(StringUtils.isNotBlank(pullState)){
dummyInventoryInfoEOEn.setState(pullState);
}
///认证类型attestationType
String attestationType = dummyInventoryInfoEOEn.getAttestationType();
String pullAttestationType = pull(sysDictItems, attestationType,"attestation_type");
if(StringUtils.isNotBlank(pullAttestationType)){
dummyInventoryInfoEOEn.setAttestationType(pullAttestationType);
}
//责任领域dutyTerritory
String dutyTerritory = dummyInventoryInfoEOEn.getDutyTerritory();
String pullDutyTerritory = pull(sysDictItems, dutyTerritory,"duty_territory");
if(StringUtils.isNotBlank(pullDutyTerritory)){
dummyInventoryInfoEOEn.setDutyTerritory(pullDutyTerritory);
}
//认证级别attestationRank
String attestationRank = dummyInventoryInfoEOEn.getAttestationRank();
String pullAttestationRank = pull(sysDictItems, attestationRank,"attestation_rank");
if(StringUtils.isNotBlank(pullAttestationRank)){
dummyInventoryInfoEOEn.setAttestationRank(pullAttestationRank);
}
//实施类别implementType
String implementType = dummyInventoryInfoEOEn.getImplementType();
String pullImplementType = pull(sysDictItems, implementType,"implement_type");
if(StringUtils.isNotBlank(pullImplementType)){
dummyInventoryInfoEOEn.setImplementType(pullImplementType);
}
//设计交付物类型designDeliverableType
String designDeliverableType = dummyInventoryInfoEOEn.getDesignDeliverableType();
String pullDesignDeliverableType = pull(sysDictItems, designDeliverableType,"deliverable_template");
if(StringUtils.isNotBlank(pullDesignDeliverableType)){
dummyInventoryInfoEOEn.setDesignDeliverableType(pullDesignDeliverableType);
}
//pre交付物类型prehomoDeliverableType
String prehomoDeliverableType = dummyInventoryInfoEOEn.getPrehomoDeliverableType();
String pullPrehomoDeliverableType = pull(sysDictItems, prehomoDeliverableType,"deliverable_template");
if(StringUtils.isNotBlank(pullPrehomoDeliverableType)){
dummyInventoryInfoEOEn.setPrehomoDeliverableType(pullPrehomoDeliverableType);
}
//验证交付物类型verifyDeliverableType
String verifyDeliverableType = dummyInventoryInfoEOEn.getVerifyDeliverableType();
String pullVerifyDeliverableType = pull(sysDictItems, verifyDeliverableType,"deliverable_template");
if(StringUtils.isNotBlank(pullVerifyDeliverableType)){
dummyInventoryInfoEOEn.setVerifyDeliverableType(pullVerifyDeliverableType);
}
//技术领域
// String technologyTerritory = dummyInventoryInfoEOEn.getTechnologyTerritory();
// if(StringUtils.isNotBlank(technologyTerritory)){
// StringBuilder sb = new StringBuilder();
// for (String s : technologyTerritory.split(",")) {
// List<SysCategory> collect = sysCategoryList.stream()
// .filter(e -> s.equals(e.getId())).collect(Collectors.toList());
// if(collect.size() != 0){
// sb.append(collect.get(0).getEnName()+",");
// }
// }
// if(StringUtils.isNotBlank(sb)){
// String substring = sb.substring(0, sb.length() - 1);
// dummyInventoryInfoEOEn.setTechnologyTerritory(substring);
// }
// }
}
}
private String pull(List<SysDictItem> sysDictItems, String field,String dictCode) {
if(StringUtils.isBlank(field)){
return null;
}
StringBuilder sb = new StringBuilder();
for (String s : field.split(",")) {
List<SysDictItem> collect = sysDictItems.stream().filter(e -> dictCode.equals(e.getDictCode()) && s.equals(e.getItemValue())).collect(Collectors.toList());
if(collect.size() != 0){
sb.append(collect.get(0).getEnName() + ",");
}
}
if(StringUtils.isNotBlank(sb)){
String substring = sb.substring(0, sb.length() - 1);
return substring;
}
return null;
}
/**
* 数据转换(文件名称,技术领域,对应标准)
* @param dataList
* @param fileInfos
*/
private void dataTransition(List<DummyInventoryInfoEO> dataList, List<OSSFile> fileInfos) {
private void dataTransition(List<DummyInventoryInfoEO> dataList, List<OSSFile> fileInfos,DummyInventoryInfoEO dummyInventoryInfoEO) {
//技术领域
List<SysCategory> sysCategoryList = sysCategoryService.list();
//文档库数据
@@ -1601,7 +1722,11 @@ public class DummyInventoryInfoEOServiceImpl extends ServiceImpl<DummyInventoryI
List<SysCategory> collect = sysCategoryList.stream()
.filter(e -> s.equals(e.getId())).collect(Collectors.toList());
if(collect.size() != 0){
sb.append(collect.get(0).getName()+",");
if(CutEnum.CN.getValue().equals(dummyInventoryInfoEO.getCut())){
sb.append(collect.get(0).getName()+",");
}else{
sb.append(collect.get(0).getEnName()+",");
}
}
}
if(StringUtils.isNotBlank(sb)){