diff --git a/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/api/user/PBomApi.java b/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/api/user/PBomApi.java index 65e6a989..2f097f7f 100644 --- a/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/api/user/PBomApi.java +++ b/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/api/user/PBomApi.java @@ -9,7 +9,6 @@ import com.nflg.product.bomnew.constant.EBomConstant; import com.nflg.product.bomnew.constant.PBomEditStatusEnum; import com.nflg.product.bomnew.constant.PBomStatusEnum; import com.nflg.product.bomnew.pojo.dto.*; -import com.nflg.product.bomnew.pojo.dto.sap.ImportToSapDTO; import com.nflg.product.bomnew.pojo.dto.sap.impart2.ImportSapParamDTO; import com.nflg.product.bomnew.pojo.entity.BomNewPbomParentEntity; import com.nflg.product.bomnew.pojo.entity.BomNewTechnologyPackageTypeEntity; @@ -17,12 +16,10 @@ 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.BomNewTechnologyPackageTypeVO; import com.nflg.product.bomnew.service.*; import com.nflg.product.bomnew.util.VUtils; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; -import nflg.product.common.constant.STATE; import nflg.product.common.vo.ResultVO; import org.springframework.web.bind.annotation.*; @@ -30,10 +27,8 @@ import javax.annotation.Resource; import javax.servlet.http.HttpServletResponse; import javax.validation.Valid; import java.io.IOException; -import java.io.UnsupportedEncodingException; import java.util.List; import java.util.Map; -import java.util.Objects; import java.util.concurrent.ExecutionException; /** @@ -83,7 +78,7 @@ public class PBomApi extends BaseApi { @ApiOperation("导出工作列表--导出") @LogRecord(success = "PBom-导出工作列表,操作结果:{{#_ret}}", bizNo = "",type = "PBom-导出工作列表") public void exportWorkDownLoad(@RequestBody BomNewPbomParentQuery query ,HttpServletResponse response) throws IOException { - bomNewPbomParentService.workDetailsExcel(query,response); + bomNewPbomParentService.workDetailsExcel(query,response); } @PostMapping("releaseListDownLoad") @@ -93,6 +88,23 @@ public class PBomApi extends BaseApi { bomNewPbomParentService.releaseListExcel(query,response); } +// @PostMapping("exportWorkDetailsListByPage") +// @ApiOperation("导出工作列表--导出") +// @LogRecord(success = "PBom-导出工作列表,操作结果:{{#_ret}}", bizNo = "",type = "PBom-导出工作列表") +// public void exportWorkDownLoad(@RequestBody List bomRowIds, HttpServletResponse response) throws IOException { +// List 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 List bomRowIds, HttpServletResponse response) throws IOException { +// List data = bomNewPbomParentService.exportExcel(bomRowIds); +// EecExcelUtil.export(response, data, BomNewPbomWorkExcelVO.class, "pbom已发布明细列表"); +// } + @GetMapping("getChild") @ApiOperation("获取子级") public ResultVO> getChild(@RequestParam("bomRowId") Long bomRowId){ @@ -102,9 +114,8 @@ public class PBomApi extends BaseApi { @PostMapping("editStaging") @ApiOperation("编辑-暂存") @LogRecord(success = "PBom-编辑-暂存,物料编码:{{#bom.materialNo}}-版本:{{#bom.currentVersion}},操作结果:{{#_ret}}", bizNo = "{{#param.bomRowId}}",type = "PBom-编辑-暂存") - public ResultVO editStaging(@Valid @RequestBody EditPBomParamDTO param){ - bomNewPbomParentService.editSave(param,PBomEditStatusEnum.HANDLER_TEMP); - return ResultVO.success(true); + public ResultVO> editStaging(@Valid @RequestBody EditPBomParamDTO param){ + return ResultVO.success(bomNewPbomParentService.editSave(param,PBomEditStatusEnum.HANDLER_TEMP)); } @PostMapping("editSubmit") diff --git a/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/mapper/master/BomNewPbomParentMapper.java b/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/mapper/master/BomNewPbomParentMapper.java index 9a1ed8c2..dbf42682 100644 --- a/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/mapper/master/BomNewPbomParentMapper.java +++ b/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/mapper/master/BomNewPbomParentMapper.java @@ -49,4 +49,6 @@ public interface BomNewPbomParentMapper extends BaseMapper exportExcel(List bomRowIds); } diff --git a/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/service/BomNewEbomParentService.java b/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/service/BomNewEbomParentService.java index 2dfd7f50..7fcd1570 100644 --- a/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/service/BomNewEbomParentService.java +++ b/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/service/BomNewEbomParentService.java @@ -144,8 +144,14 @@ public class BomNewEbomParentService extends ServiceImpl result = this.getBaseMapper().getEBomListPage(new Page<>(query.getPage(), query.getPageSize()), query, userRoleService.getUserJob(), SessionUtil.getUserCode()); - - materialMainService.intiMaterialInfo(result.getRecords(), EBomConstant.EBOM_IGNORED_FIELDS_INIT_MATERIAL_DEFAULT); + if (!result.getRecords().isEmpty()) { + //如果是自己创建的根节点且异常状态为“项目类别为空”时,异常状态改为正常 + result.getRecords().stream() + .filter(f -> f.getCreatedBy().equals(SessionUtil.getUserCode()) + && Objects.equals(f.getExceptionStatus(), EBomExceptionStatusEnum.EXCEPT_NO_8.getValue())) + .forEach(f -> f.setExceptionStatus(EBomExceptionStatusEnum.OK.getValue())); + materialMainService.intiMaterialInfo(result.getRecords(), EBomConstant.EBOM_IGNORED_FIELDS_INIT_MATERIAL_DEFAULT); + } returnResult = result; } //动态判断异常 diff --git a/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/service/BomNewPbomParentService.java b/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/service/BomNewPbomParentService.java index ef4463db..ddbf0aef 100644 --- a/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/service/BomNewPbomParentService.java +++ b/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/service/BomNewPbomParentService.java @@ -6,7 +6,6 @@ import cn.hutool.core.convert.Convert; import cn.hutool.core.util.NumberUtil; import cn.hutool.core.util.StrUtil; import cn.hutool.extra.spring.SpringUtil; -import com.alibaba.excel.enums.BooleanEnum; import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.toolkit.IdWorker; @@ -20,9 +19,6 @@ import com.nflg.product.base.core.exception.NflgBusinessException; import com.nflg.product.bomnew.constant.*; import com.nflg.product.bomnew.mapper.master.BomNewPbomParentMapper; import com.nflg.product.bomnew.pojo.dto.*; -import com.nflg.product.bomnew.pojo.dto.sap.ImportToSapChildDTO; -import com.nflg.product.bomnew.pojo.dto.sap.ImportToSapDTO; -import com.nflg.product.bomnew.pojo.dto.sap.ImportToSapParentDTO; import com.nflg.product.bomnew.pojo.dto.sap.impart2.ImportSapParamDTO; import com.nflg.product.bomnew.pojo.entity.*; import com.nflg.product.bomnew.pojo.query.BomNewPbomParentQuery; @@ -30,7 +26,6 @@ import com.nflg.product.bomnew.pojo.vo.*; import com.nflg.product.bomnew.service.domain.PBom.*; import com.nflg.product.bomnew.service.domain.Sap; import com.nflg.product.bomnew.util.*; -import com.nflg.product.bomnew.util.LevelNumUtil; import nflg.product.common.constant.STATE; import nflg.product.common.vo.ResultVO; import org.springframework.beans.factory.annotation.Qualifier; @@ -43,9 +38,7 @@ import javax.annotation.Resource; import javax.servlet.http.HttpServletResponse; import java.io.IOException; import java.math.BigDecimal; -import java.text.SimpleDateFormat; import java.time.LocalDateTime; -import java.time.format.DateTimeFormatter; import java.util.*; import java.util.concurrent.ExecutionException; import java.util.concurrent.ForkJoinPool; @@ -227,6 +220,12 @@ public class BomNewPbomParentService extends ServiceImpl(result)).writeTo(response.getOutputStream()); } + public List exportExcel(List bomRowIds) { + List result = this.getBaseMapper().exportExcel(bomRowIds); + materialMainService.intiMaterialInfo(result, BomNewPbomWorkExcelVO::getMaterialNo, EBomConstant.EBOM_IGNORED_FIELDS_INIT_MATERIAL_DEFAULT); + return result; + } + /** * 导出正式工作表 * @@ -310,7 +309,7 @@ public class BomNewPbomParentService extends ServiceImpl editSave(EditPBomParamDTO paramDTO, PBomEditStatusEnum editStatus) { BomNewPbomParentEntity parent = this.getById(paramDTO.getBomRowId()); VUtils.isTure(Objects.isNull(parent)).throwMessage("参数错误,该BOM不存在"); LogRecordContext.putVariable("bom",parent); @@ -321,8 +320,11 @@ public class BomNewPbomParentService extends ServiceImpl void export(HttpServletResponse response, List 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() { + @Override + protected Class getTClass() { + return clazz; // 指定类型 + } + }.setData(data)).writeTo(response.getOutputStream()); + } } diff --git a/nflg_project_dev/nflg-bom-new/src/main/resources/mapper/master/BomNewPbomParentMapper.xml b/nflg_project_dev/nflg-bom-new/src/main/resources/mapper/master/BomNewPbomParentMapper.xml index c12355d6..536e34ac 100644 --- a/nflg_project_dev/nflg-bom-new/src/main/resources/mapper/master/BomNewPbomParentMapper.xml +++ b/nflg_project_dev/nflg-bom-new/src/main/resources/mapper/master/BomNewPbomParentMapper.xml @@ -213,6 +213,12 @@ and b.material_no=#{materialNo} and b.created_by=#{jobNo} - - +