fix(feature/DM/nflg-bom): pbom工作表和正式工作表导出应只导出所选择的行
This commit is contained in:
parent
a824218822
commit
39023e438e
|
|
@ -16,7 +16,9 @@ import com.nflg.product.bomnew.pojo.query.BomNewPbomParentQuery;
|
|||
import com.nflg.product.bomnew.pojo.vo.BaseMaterialVO;
|
||||
import com.nflg.product.bomnew.pojo.vo.BomCopyCheckResultVO;
|
||||
import com.nflg.product.bomnew.pojo.vo.BomNewPbomParentVO;
|
||||
import com.nflg.product.bomnew.pojo.vo.BomNewPbomWorkExcelVO;
|
||||
import com.nflg.product.bomnew.service.*;
|
||||
import com.nflg.product.bomnew.util.EecExcelUtil;
|
||||
import com.nflg.product.bomnew.util.VUtils;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
|
|
@ -77,15 +79,18 @@ public class PBomApi extends BaseApi {
|
|||
@PostMapping("exportWorkDetailsListByPage")
|
||||
@ApiOperation("导出工作列表--导出")
|
||||
@LogRecord(success = "PBom-导出工作列表,操作结果:{{#_ret}}", bizNo = "",type = "PBom-导出工作列表")
|
||||
public void exportWorkDownLoad(@RequestBody BomNewPbomParentQuery query ,HttpServletResponse response) throws IOException {
|
||||
bomNewPbomParentService.workDetailsExcel(query,response);
|
||||
public void exportWorkDownLoad(@RequestBody List<Long> bomRowIds, HttpServletResponse response) throws IOException {
|
||||
List<BomNewPbomWorkExcelVO> data = bomNewPbomParentService.exportExcel(bomRowIds);
|
||||
//new Workbook().addSheet(new ListSheet<>(data)).writeTo(response.getOutputStream());
|
||||
EecExcelUtil.export(response, data, BomNewPbomWorkExcelVO.class, "pbom明细列表");
|
||||
}
|
||||
|
||||
@PostMapping("releaseListDownLoad")
|
||||
@ApiOperation("PBom已发布工作列表--导出")
|
||||
@LogRecord(success = "PBom-导出已发布工作列表,操作结果:{{#_ret}}", bizNo = "",type = "PBom-已发布工作列表")
|
||||
public void releaseListDownLoad(@RequestBody BomNewPbomParentQuery query ,HttpServletResponse response) throws IOException {
|
||||
bomNewPbomParentService.releaseListExcel(query,response);
|
||||
public void releaseListDownLoad(@RequestBody List<Long> bomRowIds, HttpServletResponse response) throws IOException {
|
||||
List<BomNewPbomWorkExcelVO> data = bomNewPbomParentService.exportExcel(bomRowIds);
|
||||
EecExcelUtil.export(response, data, BomNewPbomWorkExcelVO.class, "pbom已发布明细列表");
|
||||
}
|
||||
|
||||
@GetMapping("getChild")
|
||||
|
|
|
|||
|
|
@ -49,4 +49,6 @@ public interface BomNewPbomParentMapper extends BaseMapper<BomNewPbomParentEntit
|
|||
Integer checkIsRoot(@Param("materialNo")String materialNo);
|
||||
|
||||
Integer checkIsUserRoot(@Param("materialNo") String materialNo, @Param("jobNo") String jobNo);
|
||||
|
||||
List<BomNewPbomWorkExcelVO> exportExcel(List<Long> bomRowIds);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -220,6 +220,12 @@ public class BomNewPbomParentService extends ServiceImpl<BomNewPbomParentMapper,
|
|||
new Workbook().addSheet(new ListSheet<>(result)).writeTo(response.getOutputStream());
|
||||
}
|
||||
|
||||
public List<BomNewPbomWorkExcelVO> exportExcel(List<Long> bomRowIds) {
|
||||
List<BomNewPbomWorkExcelVO> result = this.getBaseMapper().exportExcel(bomRowIds);
|
||||
materialMainService.intiMaterialInfo(result, BomNewPbomWorkExcelVO::getMaterialNo, EBomConstant.EBOM_IGNORED_FIELDS_INIT_MATERIAL_DEFAULT);
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出正式工作表
|
||||
*
|
||||
|
|
|
|||
|
|
@ -3,6 +3,8 @@ package com.nflg.product.bomnew.util;
|
|||
import com.nflg.product.base.core.exception.NflgBusinessException;
|
||||
import com.nflg.product.bomnew.pojo.dto.BaseImportExcelDTO;
|
||||
import nflg.product.common.constant.STATE;
|
||||
import org.springframework.http.HttpHeaders;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.ttzero.excel.entity.ListSheet;
|
||||
import org.ttzero.excel.entity.Workbook;
|
||||
import org.ttzero.excel.reader.ExcelReader;
|
||||
|
|
@ -172,4 +174,15 @@ public class EecExcelUtil {
|
|||
public static String StringTrim(String str) {
|
||||
return str.replaceAll("[\\s\\u00A0]+", "").trim();
|
||||
}
|
||||
|
||||
public static <T> void export(HttpServletResponse response, List<T> data,Class<?> clazz,String name) throws IOException {
|
||||
response.setContentType(MediaType.APPLICATION_OCTET_STREAM_VALUE);
|
||||
response.setHeader(HttpHeaders.CONTENT_DISPOSITION, "attachment; filename=\"" + URLEncoder.encode(name, "utf-8") + ".xlsx\"");
|
||||
new Workbook().addSheet(new ListSheet<T>() {
|
||||
@Override
|
||||
protected Class<?> getTClass() {
|
||||
return clazz; // 指定类型
|
||||
}
|
||||
}.setData(data)).writeTo(response.getOutputStream());
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -213,6 +213,12 @@
|
|||
and b.material_no=#{materialNo} and b.created_by=#{jobNo}
|
||||
</select>
|
||||
|
||||
|
||||
|
||||
<select id="exportExcel" resultType="com.nflg.product.bomnew.pojo.vo.BomNewPbomWorkExcelVO">
|
||||
select *
|
||||
from t_bom_new_pbom_parent where row_id in
|
||||
<foreach collection="bomRowIds" item="item" open="(" separator="," close=")">
|
||||
#{item}
|
||||
</foreach>
|
||||
order by created_time desc
|
||||
</select>
|
||||
</mapper>
|
||||
|
|
|
|||
Loading…
Reference in New Issue