update:修复导出
This commit is contained in:
+16
-6
@@ -21,6 +21,7 @@ import com.adc.da.base.web.BaseController;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.net.URLEncoder;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
@@ -117,14 +118,19 @@ public class SarLawsAttrDetailedListController extends BaseController<SarLawsAtt
|
||||
@ApiOperation(value = "导出标准信息")
|
||||
@GetMapping("/ExportLawsById")
|
||||
public void ExportLawsById(HttpServletResponse response, StandExcelVo standExcelVo){
|
||||
try {
|
||||
|
||||
response.setContentType("application/vnd.ms-excel");
|
||||
response.setCharacterEncoding("utf-8");
|
||||
if(standExcelVo.getExportName()==null){
|
||||
standExcelVo.setExportName("标准导出信息");
|
||||
}
|
||||
String fileName = URLEncoder.encode(standExcelVo.getExportName(), "UTF-8").replaceAll("\\+", "%20");
|
||||
response.setHeader("Content-disposition", "attachment;filename*=utf-8''" + fileName + ".xlsx");
|
||||
String fileName = null;
|
||||
try {
|
||||
fileName = URLEncoder.encode(standExcelVo.getExportName(), "UTF-8").replaceAll("\\+", "%20");
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
response.setHeader("Content-disposition", "attachment;filename*=utf-8''" + fileName + ".xlsx");
|
||||
List<LawsDto> data = new ArrayList<>();
|
||||
if (CollectionUtils.isEmpty(standExcelVo.getIds())){
|
||||
List<String> list= sarLawsAttrDetailedListDao.selectLawsId2(standExcelVo.getId());
|
||||
@@ -248,10 +254,14 @@ public class SarLawsAttrDetailedListController extends BaseController<SarLawsAtt
|
||||
}
|
||||
}
|
||||
}
|
||||
try {
|
||||
EasyExcel.write(response.getOutputStream(), LawsDto.class).useDefaultStyle(false).autoCloseStream(Boolean.FALSE).sheet("sheet1")
|
||||
.doWrite(data);
|
||||
} catch (Exception e) {
|
||||
response.reset();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
response.reset();
|
||||
response.setContentType("application/json");
|
||||
response.setCharacterEncoding("utf-8");
|
||||
try {
|
||||
@@ -261,6 +271,6 @@ public class SarLawsAttrDetailedListController extends BaseController<SarLawsAtt
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
+41
-17
@@ -26,66 +26,90 @@ import lombok.NoArgsConstructor;
|
||||
public class LawsDto {
|
||||
@ApiModelProperty(value = "主键")
|
||||
private String id;
|
||||
@ExcelProperty(value = "标准编号")
|
||||
|
||||
@ExcelProperty(value = "标准编号", index = 0)
|
||||
@ApiModelProperty(value = "标准编号")
|
||||
private String standNumber;
|
||||
@ExcelProperty(value = "中文名称")
|
||||
|
||||
@ExcelProperty(value = "中文名称", index = 1)
|
||||
@ApiModelProperty(value = "中文名称")
|
||||
private String standName;
|
||||
@ExcelProperty(value = "英文名称")
|
||||
|
||||
@ExcelProperty(value = "英文名称", index = 2)
|
||||
@ApiModelProperty(value = "英文名称")
|
||||
private String standEnName;
|
||||
@ExcelProperty(value = "适用车型")
|
||||
|
||||
@ExcelProperty(value = "适用车型", index = 3)
|
||||
@ApiModelProperty(value = "适用车型")
|
||||
private String typeApplicable;
|
||||
@ExcelProperty(value = "能源类型")
|
||||
|
||||
@ExcelProperty(value = "能源类型", index = 4)
|
||||
@ApiModelProperty(value = "能源类型")
|
||||
private String NYLX;
|
||||
@ExcelProperty(value = "标准年份")
|
||||
|
||||
@ApiModelProperty(value = "标准年份")
|
||||
@ExcelProperty(value = "标准年份", index = 5)
|
||||
private String standYear;
|
||||
@ExcelProperty(value = "标准类别")
|
||||
|
||||
@ApiModelProperty(value = "标准类别")
|
||||
@ExcelProperty(value = "标准类别", index = 6)
|
||||
private String standSortShow;
|
||||
|
||||
@ApiModelProperty(value = "标准发表日期")
|
||||
@ExcelProperty(value = "标准发表日期", index = 7)
|
||||
private String issueTime;
|
||||
|
||||
@ColumnWidth(16)
|
||||
@ExcelProperty(value = "标准实施日期")
|
||||
@ExcelProperty(value = "标准实施日期", index = 8)
|
||||
@ApiModelProperty(value = "标准实施日期")
|
||||
@DateTimeFormat("yyyy年MM月dd日")
|
||||
private String putTime;
|
||||
|
||||
@ColumnWidth(16)
|
||||
@ExcelProperty(value = "新车型实施日期")
|
||||
@ExcelProperty(value = "新车型实施日期", index = 9)
|
||||
@ApiModelProperty(value = "新车型实施日期")
|
||||
@DateTimeFormat("yyyy年MM月dd日")
|
||||
private String XCXSSRQGJ;
|
||||
|
||||
@ColumnWidth(16)
|
||||
@ExcelProperty(value = "在产车实施日期")
|
||||
@ExcelProperty(value = "在产车实施日期", index = 10)
|
||||
@ApiModelProperty(value = "在产车实施日期")
|
||||
@DateTimeFormat("yyyy年MM月dd日")
|
||||
private String ZCCSSRQGJ;
|
||||
@ExcelProperty(value = "责任部门")
|
||||
|
||||
@ExcelProperty(value = "责任部门", index = 11)
|
||||
@ApiModelProperty(value = "责任部门")
|
||||
private String ZRBM;
|
||||
|
||||
@ColumnWidth(14)
|
||||
@ExcelProperty(value = "适用产品线")
|
||||
@ExcelProperty(value = "适用产品线", index = 12)
|
||||
@ApiModelProperty(value = "适用产品线")
|
||||
private String SYCPX;
|
||||
|
||||
@ColumnWidth(20)
|
||||
@ExcelProperty(value = "乘用车VPPS编码")
|
||||
@ExcelProperty(value = "乘用车VPPS编码", index = 13)
|
||||
@ApiModelProperty(value = "乘用车VPPS编码")
|
||||
private String CYCVPPSBM;
|
||||
|
||||
@ColumnWidth(20)
|
||||
@ExcelProperty(value = "乘用车vpps中文名称")
|
||||
@ExcelProperty(value = "乘用车vpps中文名称", index = 14)
|
||||
@ApiModelProperty(value = "乘用车vpps中文名称")
|
||||
private String CYCVPPSCN;
|
||||
|
||||
@ColumnWidth(20)
|
||||
@ExcelProperty(value = "卡车VPPS编码")
|
||||
@ExcelProperty(value = "卡车VPPS编码", index = 15)
|
||||
@ApiModelProperty(value = "卡车VPPS编码")
|
||||
private String KCCVPPSBM;
|
||||
|
||||
@ColumnWidth(20)
|
||||
@ExcelProperty(value = "卡车vpps中文名称")
|
||||
@ExcelProperty(value = "卡车vpps中文名称", index = 16)
|
||||
@ApiModelProperty(value = "卡车vpps中文名称")
|
||||
private String KCCVPPSCN;
|
||||
|
||||
@ApiModelProperty(value = "责任工程师")
|
||||
@ExcelProperty(value = "责任工程师")
|
||||
@ExcelProperty(value = "责任工程师", index = 17)
|
||||
private String responsibleEngineer;
|
||||
|
||||
@ApiModelProperty(value = "1")
|
||||
private String standType;
|
||||
}
|
||||
|
||||
+3
-1
@@ -3,12 +3,13 @@
|
||||
<mapper namespace="com.adc.da.slrs.sarLawsAttrDetailedList.dao.SarLawsAttrDetailedListDao">
|
||||
|
||||
<select id="selectLawsById" parameterType="com.adc.da.slrs.sarLawsAttrDetailedList.entity.SarFindDto" resultType="com.adc.da.slrs.sarLawsAttrDetailedList.entity.LawsDto">
|
||||
SELECT a.ID,a.STAND_NUMBER,a.STAND_NAME,a.STAND_EN_NAME,b.NYLX,a.PUT_TIME,b.XCXSSRQGJ,b.ZCCSSRQGJ,b.ZRBM,b.SYCPX,b.CYCVPPSBM,b.CYCVPPSCN,b.KCCVPPSBM,b.KCCVPPSCN,
|
||||
SELECT a.ID,a.STAND_NUMBER as standNumber,a.STAND_NAME as standName,a.STAND_EN_NAME,b.NYLX,a.PUT_TIME,b.XCXSSRQGJ,b.ZCCSSRQGJ,b.ZRBM,b.SYCPX,b.CYCVPPSBM,b.CYCVPPSCN,b.KCCVPPSBM,b.KCCVPPSCN,
|
||||
b.CLLX as typeApplicable,dicstandSort.DIC_TYPE_NAME as standSortShow ,a.STAND_YEAR as standYear,ISSUE_TIME as issueTime,a.STAND_TYPE as standType
|
||||
FROM sar_standards_info a LEFT JOIN sar_stand_attr_info b on
|
||||
a.ID = b.STAND_ID left join TS_DICTYPE dicstandSort on (dicstandSort.dic_type_code = a.stand_sort and
|
||||
dicstandSort.dic_id is not null and dicstandSort.valid_flag = 0 and dicstandSort.PARENT_ID is null)
|
||||
<where>
|
||||
<if test="sarFindDto !=null">
|
||||
<if test="sarFindDto.standName != null">
|
||||
(a.STAND_NUMBER LIKE concat ('%',#{sarFindDto.standName,jdbcType=VARCHAR},'%')
|
||||
or a.STAND_NAME LIKE concat ('%',#{sarFindDto.standName,jdbcType=VARCHAR},'%')
|
||||
@@ -37,6 +38,7 @@
|
||||
b.SYCPX LIKE concat ('%',#{sarFindDto.SYCPX,jdbcType=VARCHAR},'%')
|
||||
and
|
||||
</if>
|
||||
</if>
|
||||
a.ID IN
|
||||
<foreach collection="param1" item="item" open="(" separator="," close=")">
|
||||
#{item}
|
||||
|
||||
Reference in New Issue
Block a user