虚拟清单-导出数据
This commit is contained in:
+24
-14
@@ -1,13 +1,10 @@
|
|||||||
package com.jero.modules.dummy.controller;
|
package com.jero.modules.dummy.controller;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
||||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
||||||
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.constant.enums.CutEnum;
|
||||||
import com.jero.common.system.base.controller.JeroController;
|
import com.jero.common.system.base.controller.JeroController;
|
||||||
import com.jero.common.system.query.QueryGenerator;
|
|
||||||
import com.jero.modules.dummy.entity.DummyInventoryInfoEO;
|
import com.jero.modules.dummy.entity.DummyInventoryInfoEO;
|
||||||
import com.jero.modules.dummy.service.IDummyInventoryInfoEOService;
|
import com.jero.modules.dummy.service.IDummyInventoryInfoEOService;
|
||||||
import io.swagger.annotations.Api;
|
import io.swagger.annotations.Api;
|
||||||
@@ -146,16 +143,17 @@ public class DummyInventoryInfoEOController extends JeroController<DummyInventor
|
|||||||
return Result.OK(dummyInventoryInfoEO);
|
return Result.OK(dummyInventoryInfoEO);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
// /**
|
||||||
* 导出excel
|
// * 导出excel
|
||||||
*
|
// *
|
||||||
* @param request
|
// * @param request
|
||||||
* @param dummyInventoryInfoEO
|
// * @param dummyInventoryInfoEO
|
||||||
*/
|
// */
|
||||||
@RequestMapping(value = "/exportXls")
|
// @RequestMapping(value = "/exportXls")
|
||||||
public ModelAndView exportXls(HttpServletRequest request, DummyInventoryInfoEO dummyInventoryInfoEO) {
|
// public ModelAndView exportXls(HttpServletRequest request, DummyInventoryInfoEO dummyInventoryInfoEO) {
|
||||||
return super.exportXls(request, dummyInventoryInfoEO, DummyInventoryInfoEO.class, "虚拟清单详情表");
|
// return super.exportXls(request, dummyInventoryInfoEO, DummyInventoryInfoEO.class, "虚拟清单详情表");
|
||||||
}
|
// }
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 通过excel导入数据
|
* 通过excel导入数据
|
||||||
@@ -175,11 +173,23 @@ public class DummyInventoryInfoEOController extends JeroController<DummyInventor
|
|||||||
* @param request
|
* @param request
|
||||||
* @param dummyInventoryInfoEO
|
* @param dummyInventoryInfoEO
|
||||||
*/
|
*/
|
||||||
@GetMapping(value = "/exportData")
|
@GetMapping(value = "/exportXls")
|
||||||
public ModelAndView exportDate(HttpServletRequest request, DummyInventoryInfoEO dummyInventoryInfoEO) {
|
public ModelAndView exportDate(HttpServletRequest request, DummyInventoryInfoEO dummyInventoryInfoEO) {
|
||||||
return super.exportXls(request, dummyInventoryInfoEO, DummyInventoryInfoEO.class, "虚拟清单详情表");
|
return super.exportXls(request, dummyInventoryInfoEO, DummyInventoryInfoEO.class, "虚拟清单详情表");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 导出数据
|
||||||
|
* @param request
|
||||||
|
* @param dummyInventoryInfoEO
|
||||||
|
*/
|
||||||
|
@RequestMapping(value = "/exportData")
|
||||||
|
public void exportData(HttpServletResponse response,
|
||||||
|
HttpServletRequest request,
|
||||||
|
DummyInventoryInfoEO dummyInventoryInfoEO) {
|
||||||
|
dummyInventoryInfoEOService.exportData(response,request, dummyInventoryInfoEO);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 导入数据
|
* 导入数据
|
||||||
*
|
*
|
||||||
|
|||||||
+29
-29
@@ -1,22 +1,20 @@
|
|||||||
package com.jero.modules.dummy.entity;
|
package com.jero.modules.dummy.entity;
|
||||||
|
|
||||||
import java.io.Serializable;
|
|
||||||
import java.io.UnsupportedEncodingException;
|
|
||||||
import java.math.BigDecimal;
|
|
||||||
import com.baomidou.mybatisplus.annotation.IdType;
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
import com.baomidou.mybatisplus.annotation.TableField;
|
import com.baomidou.mybatisplus.annotation.TableField;
|
||||||
import com.baomidou.mybatisplus.annotation.TableId;
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
import com.baomidou.mybatisplus.annotation.TableName;
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
import lombok.Data;
|
|
||||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
import org.springframework.format.annotation.DateTimeFormat;
|
|
||||||
import org.jeecgframework.poi.excel.annotation.Excel;
|
|
||||||
import com.jero.common.aspect.annotation.Dict;
|
import com.jero.common.aspect.annotation.Dict;
|
||||||
import io.swagger.annotations.ApiModel;
|
import io.swagger.annotations.ApiModel;
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
import lombok.EqualsAndHashCode;
|
import lombok.EqualsAndHashCode;
|
||||||
import lombok.experimental.Accessors;
|
import lombok.experimental.Accessors;
|
||||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
import org.jeecgframework.poi.excel.annotation.Excel;
|
||||||
|
import org.springframework.format.annotation.DateTimeFormat;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -39,7 +37,6 @@ public class DummyInventoryInfoEO implements Serializable {
|
|||||||
private java.lang.String id;
|
private java.lang.String id;
|
||||||
|
|
||||||
/**法规清单基础表id*/
|
/**法规清单基础表id*/
|
||||||
@Excel(name = "法规清单基础表id", width = 15)
|
|
||||||
@ApiModelProperty(value = "法规清单基础表id")
|
@ApiModelProperty(value = "法规清单基础表id")
|
||||||
private java.lang.String dummyInventoryBaseId;
|
private java.lang.String dummyInventoryBaseId;
|
||||||
|
|
||||||
@@ -78,7 +75,7 @@ public class DummyInventoryInfoEO implements Serializable {
|
|||||||
private java.lang.String title;
|
private java.lang.String title;
|
||||||
|
|
||||||
/**适用范围*/
|
/**适用范围*/
|
||||||
@Excel(name = "适用范围", width = 15)
|
@Excel(name = "适用范围", width = 15, dicCode = "apply_scope")
|
||||||
@ApiModelProperty(value = "适用范围")
|
@ApiModelProperty(value = "适用范围")
|
||||||
@Dict(dicCode ="apply_scope")
|
@Dict(dicCode ="apply_scope")
|
||||||
private java.lang.String shi4Yong4Fan4Wei2;
|
private java.lang.String shi4Yong4Fan4Wei2;
|
||||||
@@ -86,10 +83,11 @@ public class DummyInventoryInfoEO implements Serializable {
|
|||||||
/**适用地区*/
|
/**适用地区*/
|
||||||
@ApiModelProperty(value = "适用地区")
|
@ApiModelProperty(value = "适用地区")
|
||||||
@Dict(dicCode ="region")
|
@Dict(dicCode ="region")
|
||||||
|
@Excel(name = "适用地区", width = 15, dicCode = "region")
|
||||||
private java.lang.String region;
|
private java.lang.String region;
|
||||||
|
|
||||||
/**状态*/
|
/**状态*/
|
||||||
@Excel(name = "状态", width = 15)
|
@Excel(name = "状态", width = 15,dicCode ="state")
|
||||||
@ApiModelProperty(value = "状态")
|
@ApiModelProperty(value = "状态")
|
||||||
@Dict(dicCode ="state")
|
@Dict(dicCode ="state")
|
||||||
private java.lang.String state;
|
private java.lang.String state;
|
||||||
@@ -103,14 +101,14 @@ public class DummyInventoryInfoEO implements Serializable {
|
|||||||
private java.lang.String technologyTerritoryName;
|
private java.lang.String technologyTerritoryName;
|
||||||
|
|
||||||
/**新车型实施日期*/
|
/**新车型实施日期*/
|
||||||
@Excel(name = "新车型实施日期", width = 15)
|
@Excel(name = "新车型实施日期", width = 15,format = "yyyy-MM-dd")
|
||||||
@ApiModelProperty(value = "新车型实施日期")
|
@ApiModelProperty(value = "新车型实施日期")
|
||||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd")
|
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd")
|
||||||
@DateTimeFormat(pattern="yyyy-MM-dd")
|
@DateTimeFormat(pattern="yyyy-MM-dd")
|
||||||
private java.util.Date xin1Che1Xing2Shi2Shi1Ri4Qi1;
|
private java.util.Date xin1Che1Xing2Shi2Shi1Ri4Qi1;
|
||||||
|
|
||||||
/**在产车实施日期*/
|
/**在产车实施日期*/
|
||||||
@Excel(name = "在产车实施日期", width = 15)
|
@Excel(name = "在产车实施日期", width = 15,format = "yyyy-MM-dd")
|
||||||
@ApiModelProperty(value = "在产车实施日期")
|
@ApiModelProperty(value = "在产车实施日期")
|
||||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd")
|
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd")
|
||||||
@DateTimeFormat(pattern="yyyy-MM-dd")
|
@DateTimeFormat(pattern="yyyy-MM-dd")
|
||||||
@@ -134,25 +132,25 @@ public class DummyInventoryInfoEO implements Serializable {
|
|||||||
private java.lang.String subtitle;
|
private java.lang.String subtitle;
|
||||||
|
|
||||||
/**实施类别*/
|
/**实施类别*/
|
||||||
@Excel(name = "实施类别", width = 15)
|
@Excel(name = "实施类别", width = 15,dicCode ="implement_type")
|
||||||
@ApiModelProperty(value = "实施类别")
|
@ApiModelProperty(value = "实施类别")
|
||||||
@Dict(dicCode ="implement_type")
|
@Dict(dicCode ="implement_type")
|
||||||
private java.lang.String implementType;
|
private java.lang.String implementType;
|
||||||
|
|
||||||
/**认证类型*/
|
/**认证类型*/
|
||||||
@Excel(name = "认证类型", width = 15)
|
@Excel(name = "认证类型", width = 15,dicCode ="attestation_type")
|
||||||
@ApiModelProperty(value = "认证类型")
|
@ApiModelProperty(value = "认证类型")
|
||||||
@Dict(dicCode ="attestation_type")
|
@Dict(dicCode ="attestation_type")
|
||||||
private java.lang.String attestationType;
|
private java.lang.String attestationType;
|
||||||
|
|
||||||
/**认证级别*/
|
/**认证级别*/
|
||||||
@Excel(name = "认证级别", width = 15)
|
@Excel(name = "认证级别", width = 15,dicCode ="attestation_rank")
|
||||||
@ApiModelProperty(value = "认证级别")
|
@ApiModelProperty(value = "认证级别")
|
||||||
@Dict(dicCode ="attestation_rank")
|
@Dict(dicCode ="attestation_rank")
|
||||||
private java.lang.String attestationRank;
|
private java.lang.String attestationRank;
|
||||||
|
|
||||||
/**责任领域*/
|
/**责任领域*/
|
||||||
@Excel(name = "责任领域", width = 15)
|
@Excel(name = "责任领域", width = 15,dicCode ="duty_territory")
|
||||||
@ApiModelProperty(value = "责任领域")
|
@ApiModelProperty(value = "责任领域")
|
||||||
@Dict(dicCode ="duty_territory")
|
@Dict(dicCode ="duty_territory")
|
||||||
private java.lang.String dutyTerritory;
|
private java.lang.String dutyTerritory;
|
||||||
@@ -163,79 +161,82 @@ public class DummyInventoryInfoEO implements Serializable {
|
|||||||
private java.lang.String remark;
|
private java.lang.String remark;
|
||||||
|
|
||||||
/**设计符合性确认-交付物类型*/
|
/**设计符合性确认-交付物类型*/
|
||||||
@Excel(name = "设计符合性确认-交付物类型", width = 15)
|
@Excel(name = "交付物类型", width = 15,dicCode ="deliverable_template")
|
||||||
@ApiModelProperty(value = "设计符合性确认-交付物类型")
|
@ApiModelProperty(value = "设计符合性确认-交付物类型")
|
||||||
@Dict(dicCode ="deliverable_template")
|
@Dict(dicCode ="deliverable_template")
|
||||||
private java.lang.String designDeliverableType;
|
private java.lang.String designDeliverableType;
|
||||||
|
|
||||||
/**设计符合性确认-交付物模板*/
|
/**设计符合性确认-交付物模板*/
|
||||||
@Excel(name = "设计符合性确认-交付物模板", width = 15)
|
|
||||||
@ApiModelProperty(value = "设计符合性确认-交付物模板")
|
@ApiModelProperty(value = "设计符合性确认-交付物模板")
|
||||||
private java.lang.String designDeliverableTemplate;
|
private java.lang.String designDeliverableTemplate;
|
||||||
|
|
||||||
@TableField(exist = false)
|
@TableField(exist = false)
|
||||||
|
@Excel(name = "交付物模板", width = 15)
|
||||||
private java.lang.String designDeliverableTemplateName;
|
private java.lang.String designDeliverableTemplateName;
|
||||||
|
|
||||||
/**设计符合性确认-发起人*/
|
/**设计符合性确认-发起人*/
|
||||||
@Excel(name = "设计符合性确认-发起人", width = 15)
|
@Excel(name = "发起人", width = 15,dicCode ="fa1_qi3_ren2")
|
||||||
@ApiModelProperty(value = "设计符合性确认-发起人")
|
@ApiModelProperty(value = "设计符合性确认-发起人")
|
||||||
@Dict(dicCode ="fa1_qi3_ren2")
|
@Dict(dicCode ="fa1_qi3_ren2")
|
||||||
private java.lang.String designInitiator;
|
private java.lang.String designInitiator;
|
||||||
|
|
||||||
/**设计符合性确认-责任人*/
|
/**设计符合性确认-责任人*/
|
||||||
@Excel(name = "设计符合性确认-责任人", width = 15)
|
@Excel(name = "责任人", width = 15,dicCode ="ze2_ren4_ren2")
|
||||||
@ApiModelProperty(value = "设计符合性确认-责任人")
|
@ApiModelProperty(value = "设计符合性确认-责任人")
|
||||||
@Dict(dicCode ="ze2_ren4_ren2")
|
@Dict(dicCode ="ze2_ren4_ren2")
|
||||||
private java.lang.String designDuty;
|
private java.lang.String designDuty;
|
||||||
|
|
||||||
/**prehomo确认-交付物类型*/
|
/**prehomo确认-交付物类型*/
|
||||||
@Excel(name = "prehomo确认-交付物类型", width = 15)
|
@Excel(name = "交付物类型", width = 15,dicCode ="deliverable_template")
|
||||||
@ApiModelProperty(value = "prehomo确认-交付物类型")
|
@ApiModelProperty(value = "prehomo确认-交付物类型")
|
||||||
@Dict(dicCode ="deliverable_template")
|
@Dict(dicCode ="deliverable_template")
|
||||||
private java.lang.String prehomoDeliverableType;
|
private java.lang.String prehomoDeliverableType;
|
||||||
|
|
||||||
/**prehomo确认-交付物模板*/
|
/**prehomo确认-交付物模板*/
|
||||||
@Excel(name = "prehomo确认-交付物模板", width = 15)
|
|
||||||
@ApiModelProperty(value = "prehomo确认-交付物模板")
|
@ApiModelProperty(value = "prehomo确认-交付物模板")
|
||||||
private java.lang.String prehomoDeliverableTemplate;
|
private java.lang.String prehomoDeliverableTemplate;
|
||||||
|
|
||||||
@TableField(exist = false)
|
@TableField(exist = false)
|
||||||
|
@Excel(name = "交付物模板", width = 15)
|
||||||
private java.lang.String prehomoDeliverableTemplateName;
|
private java.lang.String prehomoDeliverableTemplateName;
|
||||||
|
|
||||||
/**prehomo确认-发起人*/
|
/**prehomo确认-发起人*/
|
||||||
@Excel(name = "prehomo确认-发起人", width = 15)
|
@Excel(name = "发起人", width = 15,dicCode ="fa1_qi3_ren2")
|
||||||
@ApiModelProperty(value = "prehomo确认-发起人")
|
@ApiModelProperty(value = "prehomo确认-发起人")
|
||||||
@Dict(dicCode ="fa1_qi3_ren2")
|
@Dict(dicCode ="fa1_qi3_ren2")
|
||||||
private java.lang.String prehomoInitiator;
|
private java.lang.String prehomoInitiator;
|
||||||
|
|
||||||
/**prehomo确认-责任人*/
|
/**prehomo确认-责任人*/
|
||||||
@Excel(name = "prehomo确认-责任人", width = 15)
|
@Excel(name = "责任人", width = 15,dicCode ="ze2_ren4_ren2")
|
||||||
@ApiModelProperty(value = "prehomo确认-责任人")
|
@ApiModelProperty(value = "prehomo确认-责任人")
|
||||||
@Dict(dicCode ="ze2_ren4_ren2")
|
@Dict(dicCode ="ze2_ren4_ren2")
|
||||||
private java.lang.String prehomoDuty;
|
private java.lang.String prehomoDuty;
|
||||||
|
|
||||||
/**验证符合性确认-交付物类型*/
|
/**验证符合性确认-交付物类型*/
|
||||||
@Excel(name = "验证符合性确认-交付物类型", width = 15)
|
@Excel(name = "交付物类型", width = 15,dicCode ="deliverable_template")
|
||||||
@ApiModelProperty(value = "验证符合性确认-交付物类型")
|
@ApiModelProperty(value = "验证符合性确认-交付物类型")
|
||||||
@Dict(dicCode ="deliverable_template")
|
@Dict(dicCode ="deliverable_template")
|
||||||
private java.lang.String verifyDeliverableType;
|
private java.lang.String verifyDeliverableType;
|
||||||
|
|
||||||
/**验证符合性确认-交付物模板*/
|
/**验证符合性确认-交付物模板*/
|
||||||
@Excel(name = "验证符合性确认-交付物模板", width = 15)
|
|
||||||
@ApiModelProperty(value = "验证符合性确认-交付物模板")
|
@ApiModelProperty(value = "验证符合性确认-交付物模板")
|
||||||
private java.lang.String verifyDeliverableTemplate;
|
private java.lang.String verifyDeliverableTemplate;
|
||||||
|
|
||||||
@TableField(exist = false)
|
@TableField(exist = false)
|
||||||
|
@Excel(name = "交付物模板", width = 15)
|
||||||
private java.lang.String verifyDeliverableTemplateName;
|
private java.lang.String verifyDeliverableTemplateName;
|
||||||
|
|
||||||
/**验证符合性确认-发起人*/
|
/**验证符合性确认-发起人*/
|
||||||
@Excel(name = "验证符合性确认-发起人", width = 15)
|
@Excel(name = "发起人", width = 15,dicCode ="fa1_qi3_ren2")
|
||||||
@ApiModelProperty(value = "验证符合性确认-发起人")
|
@ApiModelProperty(value = "验证符合性确认-发起人")
|
||||||
@Dict(dicCode ="fa1_qi3_ren2")
|
@Dict(dicCode ="fa1_qi3_ren2")
|
||||||
private java.lang.String verifyInitiator;
|
private java.lang.String verifyInitiator;
|
||||||
|
|
||||||
/**验证符合性确认-责任人*/
|
/**验证符合性确认-责任人*/
|
||||||
@Excel(name = "验证符合性确认-责任人", width = 15)
|
@Excel(name = "责任人", width = 15,dicCode ="ze2_ren4_ren2")
|
||||||
@ApiModelProperty(value = "验证符合性确认-责任人")
|
@ApiModelProperty(value = "验证符合性确认-责任人")
|
||||||
@Dict(dicCode ="ze2_ren4_ren2")
|
@Dict(dicCode ="ze2_ren4_ren2")
|
||||||
private java.lang.String verifyDuty;
|
private java.lang.String verifyDuty;
|
||||||
@@ -243,7 +244,6 @@ public class DummyInventoryInfoEO implements Serializable {
|
|||||||
@TableField(exist = false)
|
@TableField(exist = false)
|
||||||
private String cut;
|
private String cut;
|
||||||
|
|
||||||
/**文档库id*/
|
|
||||||
@TableField(exist = false)
|
@TableField(exist = false)
|
||||||
private String ids;
|
private String ids;
|
||||||
|
|
||||||
|
|||||||
+11
@@ -89,4 +89,15 @@ public interface IDummyInventoryInfoEOService extends IService<DummyInventoryInf
|
|||||||
* @param dummyInventoryInfoEO
|
* @param dummyInventoryInfoEO
|
||||||
*/
|
*/
|
||||||
void importData(MultipartFile file, DummyInventoryInfoEO dummyInventoryInfoEO);
|
void importData(MultipartFile file, DummyInventoryInfoEO dummyInventoryInfoEO);
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 数据导出
|
||||||
|
* @param response
|
||||||
|
* @param request
|
||||||
|
* @param dummyInventoryInfoEO
|
||||||
|
*/
|
||||||
|
void exportData(HttpServletResponse response,
|
||||||
|
HttpServletRequest request,
|
||||||
|
DummyInventoryInfoEO dummyInventoryInfoEO);
|
||||||
}
|
}
|
||||||
|
|||||||
+233
-2
@@ -1,5 +1,6 @@
|
|||||||
package com.jero.modules.dummy.service.impl;
|
package com.jero.modules.dummy.service.impl;
|
||||||
|
|
||||||
|
import cn.hutool.core.util.ZipUtil;
|
||||||
import com.alibaba.fastjson.JSON;
|
import com.alibaba.fastjson.JSON;
|
||||||
import com.aliyuncs.utils.IOUtils;
|
import com.aliyuncs.utils.IOUtils;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
@@ -40,6 +41,11 @@ import org.apache.poi.ss.usermodel.VerticalAlignment;
|
|||||||
import org.apache.poi.ss.usermodel.Workbook;
|
import org.apache.poi.ss.usermodel.Workbook;
|
||||||
import org.apache.poi.ss.usermodel.WorkbookFactory;
|
import org.apache.poi.ss.usermodel.WorkbookFactory;
|
||||||
import org.apache.poi.ss.util.CellRangeAddress;
|
import org.apache.poi.ss.util.CellRangeAddress;
|
||||||
|
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
|
||||||
|
import org.aspectj.util.FileUtil;
|
||||||
|
import org.jeecgframework.poi.excel.ExcelExportUtil;
|
||||||
|
import org.jeecgframework.poi.excel.entity.ExportParams;
|
||||||
|
import org.jeecgframework.poi.excel.entity.enmus.ExcelType;
|
||||||
import org.springframework.beans.BeanUtils;
|
import org.springframework.beans.BeanUtils;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.beans.factory.annotation.Value;
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
@@ -51,6 +57,7 @@ import javax.servlet.http.HttpServletRequest;
|
|||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.FileInputStream;
|
import java.io.FileInputStream;
|
||||||
|
import java.io.FileOutputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.OutputStream;
|
import java.io.OutputStream;
|
||||||
import java.text.DateFormat;
|
import java.text.DateFormat;
|
||||||
@@ -66,6 +73,8 @@ import java.util.Set;
|
|||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
import static com.jero.modules.document.service.impl.BussDocumentLibraryEOServiceImpl.copyFile;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Description: 虚拟清单详情表
|
* @Description: 虚拟清单详情表
|
||||||
* @Author: jero-boot
|
* @Author: jero-boot
|
||||||
@@ -297,15 +306,16 @@ public class DummyInventoryInfoEOServiceImpl extends ServiceImpl<DummyInventoryI
|
|||||||
String titleOne = "";
|
String titleOne = "";
|
||||||
String titleTwo = "";
|
String titleTwo = "";
|
||||||
if(CutEnum.CN.getValue().equals(dummyInventoryInfoEO.getCut())){
|
if(CutEnum.CN.getValue().equals(dummyInventoryInfoEO.getCut())){
|
||||||
titleOne = "编号,标题,子标题,适用范围,状态,对应标准,实施类别,新车实施日期,在产车实施日期,WVTA ID,认证类型," +
|
titleOne = "编号,标题,子标题,适用范围,状态,对应标准,实施类别," +
|
||||||
|
"新车实施日期,在产车实施日期,WVTA ID,认证类型," +
|
||||||
"认证级别,技术领域," +
|
"认证级别,技术领域," +
|
||||||
"责任领域,适用地区,备注," +
|
"责任领域,适用地区,备注," +
|
||||||
"设计符合性确认,Pre-homo确认,验证符合性确认";
|
"设计符合性确认,Pre-homo确认,验证符合性确认";
|
||||||
titleTwo = "交付物类型,交付物模板,发起人,责任人,交付物类型,交付物模板,发起人,责任人,交付物类型,交付物模板,发起人,责任人";
|
titleTwo = "交付物类型,交付物模板,发起人,责任人,交付物类型,交付物模板,发起人,责任人,交付物类型,交付物模板,发起人,责任人";
|
||||||
}else{
|
}else{
|
||||||
titleOne = "serial number,title,subtitle,scope of application,state,corresponding standard,implementation category," +
|
titleOne = "serial number,title,subtitle,scope of application,state,corresponding standard,implementation category," +
|
||||||
"certification level,technical field," +
|
|
||||||
"new car implementation date,on the production vehicle implementation date,WVTA ID,certification type," +
|
"new car implementation date,on the production vehicle implementation date,WVTA ID,certification type," +
|
||||||
|
"certification level,technical field," +
|
||||||
"area of responsibility,zone of application,remarks," +
|
"area of responsibility,zone of application,remarks," +
|
||||||
"design compliance check,pre-homo check,validation compliance chech";
|
"design compliance check,pre-homo check,validation compliance chech";
|
||||||
titleTwo = "type of deliverables,deliverable template,initiator,person liable," +
|
titleTwo = "type of deliverables,deliverable template,initiator,person liable," +
|
||||||
@@ -766,6 +776,7 @@ public class DummyInventoryInfoEOServiceImpl extends ServiceImpl<DummyInventoryI
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private void importDatas(List<DummyInventoryInfoEO> dataList,
|
private void importDatas(List<DummyInventoryInfoEO> dataList,
|
||||||
List<SysCategory> categoryList,
|
List<SysCategory> categoryList,
|
||||||
List<SysDictItem> dictItemList,
|
List<SysDictItem> dictItemList,
|
||||||
@@ -1278,4 +1289,224 @@ public class DummyInventoryInfoEOServiceImpl extends ServiceImpl<DummyInventoryI
|
|||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 数据导出
|
||||||
|
* @param response
|
||||||
|
* @param request
|
||||||
|
* @param dummyInventoryInfoEO
|
||||||
|
*/
|
||||||
|
@SneakyThrows
|
||||||
|
@Override
|
||||||
|
public void exportData(HttpServletResponse response, HttpServletRequest request, DummyInventoryInfoEO dummyInventoryInfoEO) {
|
||||||
|
List<DummyInventoryInfoEO> dataList = new ArrayList<>();
|
||||||
|
QueryWrapper<DummyInventoryInfoEO> queryWrapper = QueryGenerator.initQueryWrapper(dummyInventoryInfoEO,request.getParameterMap());
|
||||||
|
if(StringUtils.isNotBlank(dummyInventoryInfoEO.getIds())){
|
||||||
|
queryWrapper.in("id",Arrays.asList(dummyInventoryInfoEO.getIds().split(",")));
|
||||||
|
}
|
||||||
|
//导出的数据
|
||||||
|
dataList = this.list(queryWrapper);
|
||||||
|
|
||||||
|
//文件
|
||||||
|
List<OSSFile> fileInfos = getOssFiles(dataList);
|
||||||
|
//数据转换(文件名称,技术领域,对应标准)
|
||||||
|
dataTransition(dataList, fileInfos);
|
||||||
|
|
||||||
|
OutputStream os = null;
|
||||||
|
try {
|
||||||
|
response.setContentType("application/force-download");
|
||||||
|
Workbook workbook = new XSSFWorkbook();
|
||||||
|
String path = uploadpath + "/tempZip";
|
||||||
|
File fileTemp = new File(path);
|
||||||
|
if (fileTemp.exists()) {
|
||||||
|
fileTemp.delete();
|
||||||
|
}
|
||||||
|
fileTemp.mkdirs();
|
||||||
|
//文件
|
||||||
|
exportFile(dataList,fileInfos);
|
||||||
|
//excel
|
||||||
|
OutputStream excelOS = new FileOutputStream(path + File.separator + "虚拟清单.xlsx");
|
||||||
|
ExportParams exportParams = new ExportParams();
|
||||||
|
exportParams.setType(ExcelType.XSSF);
|
||||||
|
workbook = ExcelExportUtil.exportExcel(exportParams, DummyInventoryInfoEO.class, dataList);
|
||||||
|
workbook.write(excelOS);
|
||||||
|
excelOS.flush();
|
||||||
|
|
||||||
|
ZipUtil.zip(path, path + ".zip");
|
||||||
|
//文件
|
||||||
|
FileInputStream fis = new FileInputStream(path + ".zip");
|
||||||
|
os = response.getOutputStream();
|
||||||
|
|
||||||
|
int len = 0;
|
||||||
|
while ((len = fis.read()) != -1) {
|
||||||
|
os.write(len);
|
||||||
|
}
|
||||||
|
os.flush();
|
||||||
|
fis.close();
|
||||||
|
} catch (IOException e) {
|
||||||
|
if(CutEnum.CN.getValue().equals(dummyInventoryInfoEO.getCut())){
|
||||||
|
throw new JeroBootException("下载文件失败");
|
||||||
|
}else{
|
||||||
|
throw new JeroBootException("Failed to download file");
|
||||||
|
}
|
||||||
|
} finally {
|
||||||
|
IOUtils.closeQuietly(os);
|
||||||
|
File file = new File(uploadpath + "/tempZip");
|
||||||
|
FileUtil.deleteContents(file);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 数据转换(文件名称,技术领域,对应标准)
|
||||||
|
* @param dataList
|
||||||
|
* @param fileInfos
|
||||||
|
*/
|
||||||
|
private void dataTransition(List<DummyInventoryInfoEO> dataList, List<OSSFile> fileInfos) {
|
||||||
|
//技术领域
|
||||||
|
List<SysCategory> sysCategoryList = sysCategoryService.list();
|
||||||
|
//文档库数据
|
||||||
|
List<String> correspondingStandardIdList = new ArrayList<>();
|
||||||
|
for (DummyInventoryInfoEO inventoryInfoEO : dataList) {
|
||||||
|
String correspondingStandard = inventoryInfoEO.getCorrespondingStandard();
|
||||||
|
if(StringUtils.isNotBlank(correspondingStandard)){
|
||||||
|
correspondingStandardIdList.addAll(Arrays.asList(correspondingStandard.split(",")));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
LambdaQueryWrapper<BussDocumentLibraryEO> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||||
|
lambdaQueryWrapper.in(BussDocumentLibraryEO::getId,correspondingStandardIdList);
|
||||||
|
List<BussDocumentLibraryEO> bussDocumentLibraryEOList = iBussDocumentLibraryEOService.list(lambdaQueryWrapper);
|
||||||
|
|
||||||
|
for (DummyInventoryInfoEO inventoryInfoEO : dataList) {
|
||||||
|
String correspondingStandard = inventoryInfoEO.getCorrespondingStandard();
|
||||||
|
String technologyTerritory = inventoryInfoEO.getTechnologyTerritory();
|
||||||
|
String designDeliverableTemplate = inventoryInfoEO.getDesignDeliverableTemplate();
|
||||||
|
String prehomoDeliverableTemplate = inventoryInfoEO.getPrehomoDeliverableTemplate();
|
||||||
|
String verifyDeliverableTemplate = inventoryInfoEO.getVerifyDeliverableTemplate();
|
||||||
|
//对应标准
|
||||||
|
if(StringUtils.isNotBlank(correspondingStandard)){
|
||||||
|
StringBuilder sb = new StringBuilder();
|
||||||
|
for (String s : correspondingStandard.split(",")) {
|
||||||
|
List<BussDocumentLibraryEO> collect = bussDocumentLibraryEOList.stream()
|
||||||
|
.filter(e -> s.equals(e.getId())).collect(Collectors.toList());
|
||||||
|
if(collect.size() != 0){
|
||||||
|
sb.append(collect.get(0).getSerialNumber() + ",");
|
||||||
|
}else{
|
||||||
|
sb.append(s + ",");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(StringUtils.isNotBlank(sb)){
|
||||||
|
String substring = sb.substring(0, sb.length() - 1);
|
||||||
|
inventoryInfoEO.setCorrespondingStandard(substring);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//技术领域
|
||||||
|
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).getName()+",");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(StringUtils.isNotBlank(sb)){
|
||||||
|
String substring = sb.substring(0, sb.length() - 1);
|
||||||
|
inventoryInfoEO.setTechnologyTerritory(substring);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//设计交付物模板
|
||||||
|
if(StringUtils.isNotBlank(designDeliverableTemplate)){
|
||||||
|
String designDeliverableTemplateName = template(fileInfos, designDeliverableTemplate);
|
||||||
|
inventoryInfoEO.setDesignDeliverableTemplateName(designDeliverableTemplateName);
|
||||||
|
}
|
||||||
|
//设计交付物模板
|
||||||
|
if(StringUtils.isNotBlank(prehomoDeliverableTemplate)){
|
||||||
|
String prehomoDeliverableTemplateName = template(fileInfos, prehomoDeliverableTemplate);
|
||||||
|
inventoryInfoEO.setPrehomoDeliverableTemplateName(prehomoDeliverableTemplateName);
|
||||||
|
|
||||||
|
}
|
||||||
|
//设计交付物模板
|
||||||
|
if(StringUtils.isNotBlank(verifyDeliverableTemplate)){
|
||||||
|
String verifyDeliverableTemplateName = template(fileInfos, verifyDeliverableTemplate);
|
||||||
|
inventoryInfoEO.setVerifyDeliverableTemplateName(verifyDeliverableTemplateName);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 模板名称转换
|
||||||
|
* @param fileInfos
|
||||||
|
* @param value
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
private String template(List<OSSFile> fileInfos, String value) {
|
||||||
|
StringBuilder sb = new StringBuilder();
|
||||||
|
for (String s : value.split(",")) {
|
||||||
|
List<OSSFile> collect = fileInfos.stream().filter(e -> s.equals(e.getId())).collect(Collectors.toList());
|
||||||
|
if(collect.size() != 0){
|
||||||
|
sb.append(collect.get(0).getFileName()+",");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
String substring = "";
|
||||||
|
if(StringUtils.isNotBlank(sb)){
|
||||||
|
substring = sb.substring(0, sb.length() - 1);
|
||||||
|
}
|
||||||
|
return substring;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取文件
|
||||||
|
* @param dataList
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
private List<OSSFile> getOssFiles(List<DummyInventoryInfoEO> dataList) {
|
||||||
|
List<String> fileIdList = new ArrayList<>();
|
||||||
|
List<String> design = dataList.stream().map(DummyInventoryInfoEO::getDesignDeliverableTemplate).collect(Collectors.toList());
|
||||||
|
List<String> prehomo = dataList.stream().map(DummyInventoryInfoEO::getPrehomoDeliverableTemplate).collect(Collectors.toList());
|
||||||
|
List<String> verify = dataList.stream().map(DummyInventoryInfoEO::getVerifyDeliverableTemplate).collect(Collectors.toList());
|
||||||
|
fileIdList.addAll(design);
|
||||||
|
fileIdList.addAll(prehomo);
|
||||||
|
fileIdList.addAll(verify);
|
||||||
|
|
||||||
|
//查询所有的文件
|
||||||
|
List<OSSFile> fileInfos = new ArrayList<>();
|
||||||
|
if(fileIdList.size() != 0){
|
||||||
|
fileInfos = iOSSFileService.getFileInfos(StringUtils.join(fileIdList, ","));
|
||||||
|
}
|
||||||
|
return fileInfos;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void exportFile(List<DummyInventoryInfoEO> dataList,List<OSSFile> fileInfos) throws IOException {
|
||||||
|
if(fileInfos.size() != 0){
|
||||||
|
for (DummyInventoryInfoEO inventoryInfoEO : dataList) {
|
||||||
|
String designDeliverableTemplate = inventoryInfoEO.getDesignDeliverableTemplate();
|
||||||
|
String prehomoDeliverableTemplate = inventoryInfoEO.getPrehomoDeliverableTemplate();
|
||||||
|
String verifyDeliverableTemplate = inventoryInfoEO.getVerifyDeliverableTemplate();
|
||||||
|
String serialNumber = inventoryInfoEO.getSerialNumber();
|
||||||
|
if(StringUtils.isBlank(serialNumber)){
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
List<OSSFile> designFileList = fileInfos.stream().filter(e -> designDeliverableTemplate.contains(e.getId())).collect(Collectors.toList());
|
||||||
|
List<OSSFile> prehomoFileList = fileInfos.stream().filter(e -> prehomoDeliverableTemplate.contains(e.getId())).collect(Collectors.toList());
|
||||||
|
List<OSSFile> verifyFileList = fileInfos.stream().filter(e -> verifyDeliverableTemplate.contains(e.getId())).collect(Collectors.toList());
|
||||||
|
List<OSSFile> oSSFileList = new ArrayList<>();
|
||||||
|
oSSFileList.addAll(designFileList);
|
||||||
|
oSSFileList.addAll(prehomoFileList);
|
||||||
|
oSSFileList.addAll(verifyFileList);
|
||||||
|
if(oSSFileList.size() != 0){
|
||||||
|
String fileNowPath = uploadpath + "/tempZip/" + serialNumber;
|
||||||
|
File file = new File(fileNowPath);
|
||||||
|
if (file.exists()) {
|
||||||
|
file.delete();
|
||||||
|
}
|
||||||
|
file.mkdirs();
|
||||||
|
for (OSSFile ossFile : oSSFileList) {
|
||||||
|
String url = ossFile.getUrl();
|
||||||
|
copyFile(url, fileNowPath + File.separator + ossFile.getFileName());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user