Browse Source

HL-5987 1.报废出库申请,新增明细的报废原因,输入超长字符报异常,应加字符限制;2.报废出库任务,页面承接人、完成人、部门应显示中文 > 部门删除 承接人 完成人直接去Name 业务类型不变 +导出

hella_online_20240924
李达明 2 months ago
parent
commit
66a24626e3
  1. 7
      win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/controller/deliverRecord/DeliverRecordDetailController.java
  2. 73
      win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/controller/scrapJob/ScrapJobDetailController.java
  3. 24
      win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/controller/scrapJob/ScrapJobMainController.java
  4. 10
      win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/controller/scrapJob/vo/ScrapJobMainExcelVO.java
  5. 73
      win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/controller/scrapRecord/ScrapRecordDetailController.java
  6. 58
      win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/controller/scrapRecord/ScrapRecordMainController.java
  7. 6
      win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/controller/scrapRecord/vo/ScrapRecordMainExcelVO.java
  8. 87
      win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/controller/scrapRequest/ScrapRequestDetailController.java
  9. 75
      win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/controller/scrapRequest/ScrapRequestMainController.java

7
win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/controller/deliverRecord/DeliverRecordDetailController.java

@ -26,6 +26,7 @@ import javax.servlet.http.HttpServletResponse;
import javax.validation.Valid;
import java.io.IOException;
import java.util.*;
import java.util.stream.Collectors;
import static com.win.framework.common.pojo.CommonResult.success;
import static com.win.framework.operatelog.core.enums.OperateTypeEnum.EXPORT;
@ -98,11 +99,9 @@ public class DeliverRecordDetailController {
PageResult<DeliverRecordDetailDO> pageResult = deliverRecordDetailService.getDeliverRecordDetailPage(pageVO);
PageResult<DeliverRecordDetailRespVO> result = DeliverRecordDetailConvert.INSTANCE.convertPage(pageResult);
if(pageResult.getList().size() > 0){
Set<Long> masterIdSet = new HashSet<>();
for(DeliverRecordDetailDO deliverRecordDetailDO:pageResult.getList()){
masterIdSet.add(deliverRecordDetailDO.getMasterId());
}
Set<Long> masterIdSet = pageResult.getList().stream().map(DeliverRecordDetailDO::getMasterId).collect(Collectors.toSet());
Map<Long, DeliverRecordMainDO> mainMap = deliverRecordMainMapper.queryMainListToMap(masterIdSet);
CopyOptions options = CopyOptions.create().setIgnoreNullValue(true);
for(DeliverRecordDetailRespVO vo : result.getList()) {
vo.setCreator(userApi.getUserNickname(vo.getCreator()));

73
win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/controller/scrapJob/ScrapJobDetailController.java

@ -5,16 +5,15 @@ import cn.hutool.core.bean.copier.CopyOptions;
import com.win.framework.common.pojo.CommonResult;
import com.win.framework.common.pojo.CustomConditions;
import com.win.framework.common.pojo.PageResult;
import com.win.framework.common.util.collection.CollectionUtils;
import com.win.framework.excel.core.util.ExcelUtils;
import com.win.framework.operatelog.core.annotations.OperateLog;
import com.win.module.system.api.user.AdminUserApi;
import com.win.module.system.api.user.dto.AdminUserRespDTO;
import com.win.module.wms.controller.scrapJob.vo.ScrapJobDetailRespVO;
import com.win.module.wms.controller.scrapJob.vo.*;
import com.win.module.wms.convert.scrapJob.ScrapJobDetailConvert;
import com.win.module.wms.dal.dataobject.scrapJob.ScrapJobDetailDO;
import com.win.module.wms.dal.dataobject.scrapJob.ScrapJobMainDO;
import com.win.module.wms.dal.dataobject.scrapJob.ScrapJobDetailDO;
import com.win.module.wms.dal.mysql.scrapJob.ScrapJobMainMapper;
import com.win.module.wms.service.scrapJob.ScrapJobDetailService;
import io.swagger.v3.oas.annotations.Operation;
@ -29,6 +28,7 @@ import javax.servlet.http.HttpServletResponse;
import javax.validation.Valid;
import java.io.IOException;
import java.util.*;
import java.util.stream.Collectors;
import static com.win.framework.common.pojo.CommonResult.success;
import static com.win.framework.operatelog.core.enums.OperateTypeEnum.EXPORT;
@ -46,7 +46,6 @@ public class ScrapJobDetailController {
@Resource
private ScrapJobMainMapper scrapJobMainMapper;
@PostMapping("/create")
@Operation(summary = "创建报废出库任务子")
@PreAuthorize("@ss.hasPermission('wms:scrap-job-detail:create')")
@ -91,65 +90,49 @@ public class ScrapJobDetailController {
@Operation(summary = "获得报废出库任务子分页")
public CommonResult<PageResult<ScrapJobDetailRespVO>> getScrapJobDetailPage(@Valid ScrapJobDetailPageReqVO pageVO) {
PageResult<ScrapJobDetailDO> pageResult = scrapJobDetailService.getScrapJobDetailPage(pageVO);
PageResult<ScrapJobDetailRespVO> result = getScrapJobDetailRespVOPageResult(pageResult);
return success(result);
}
private PageResult<ScrapJobDetailRespVO> getScrapJobDetailRespVOPageResult(PageResult<ScrapJobDetailDO> pageResult) {
PageResult<ScrapJobDetailRespVO> result = ScrapJobDetailConvert.INSTANCE.convertPage(pageResult);
if(pageResult.getList().size() > 0){
Set<Long> masterIdSet = new HashSet<>();
for(ScrapJobDetailDO scrapJobDetailDO:pageResult.getList()){
masterIdSet.add(scrapJobDetailDO.getMasterId());
}
if (pageResult.getList().size() > 0) {
//主
Set<Long> masterIdSet = pageResult.getList().stream().map(ScrapJobDetailDO::getMasterId).collect(Collectors.toSet());
Map<Long, ScrapJobMainDO> mainMap = scrapJobMainMapper.queryMainListToMap(masterIdSet);
//用户
Set<String> userIdSet = pageResult.getList().stream().map(ScrapJobDetailDO::getCreator).collect(Collectors.toSet());
userIdSet.addAll(pageResult.getList().stream().map(ScrapJobDetailDO::getUpdater).collect(Collectors.toSet()));
Map<String, String> userNicknameMap = userApi.getUserNicknameToString(userIdSet);
CopyOptions options = CopyOptions.create().setIgnoreNullValue(true);
for(ScrapJobDetailRespVO vo : result.getList()) {
vo.setCreator(userApi.getUserNickname(vo.getCreator()));
vo.setUpdater(userApi.getUserNickname(vo.getUpdater()));
result.getList().stream().iterator().forEachRemaining(vo -> {
vo.setCreator(Optional.ofNullable(userNicknameMap.get(vo.getCreator())).orElse(""));
vo.setUpdater(Optional.ofNullable(userNicknameMap.get(vo.getUpdater())).orElse(""));
ScrapJobMainDO scrapJobMainDO = mainMap.get(vo.getMasterId());
if(scrapJobMainDO != null){
if (scrapJobMainDO != null) {
scrapJobMainDO.setId(null);
scrapJobMainDO.setCreator(null);
scrapJobMainDO.setCreateTime(null);
scrapJobMainDO.setUpdateTime(null);
scrapJobMainDO.setUpdater(null);
String remarkMain =Optional.ofNullable(scrapJobMainDO.getRemark()).orElse("");
String remarkSub=Optional.ofNullable(vo.getRemark()).orElse("");
BeanUtil.copyProperties(scrapJobMainDO,vo,options);
String remarkMain = Optional.ofNullable(scrapJobMainDO.getRemark()).orElse("");
String remarkSub = Optional.ofNullable(vo.getRemark()).orElse("");
BeanUtil.copyProperties(scrapJobMainDO, vo, options);
vo.setRemarkMain(remarkMain);
vo.setRemark(remarkSub);
}
}
});
}
return success(result);
return result;
}
@PostMapping("/senior")
@Operation(summary = "高级搜索获得物料基本信息分页")
public CommonResult<PageResult<ScrapJobDetailRespVO>> getScrapJobDetailSenior(@Valid @RequestBody CustomConditions conditions) {
PageResult<ScrapJobDetailDO> pageResult = scrapJobDetailService.getScrapJobDetailSenior(conditions);
PageResult<ScrapJobDetailRespVO> result = ScrapJobDetailConvert.INSTANCE.convertPage(pageResult);
if(pageResult.getList().size() > 0){
Set<Long> masterIdSet = new HashSet<>();
for(ScrapJobDetailDO scrapJobDetailDO:pageResult.getList()){
masterIdSet.add(scrapJobDetailDO.getMasterId());
}
Map<Long, ScrapJobMainDO> mainMap = scrapJobMainMapper.queryMainListToMap(masterIdSet);
CopyOptions options = CopyOptions.create().setIgnoreNullValue(true);
for(ScrapJobDetailRespVO vo : result.getList()) {
vo.setCreator(userApi.getUserNickname(vo.getCreator()));
vo.setUpdater(userApi.getUserNickname(vo.getUpdater()));
ScrapJobMainDO scrapJobMainDO = mainMap.get(vo.getMasterId());
if(scrapJobMainDO != null){
scrapJobMainDO.setId(null);
scrapJobMainDO.setCreator(null);
scrapJobMainDO.setCreateTime(null);
scrapJobMainDO.setUpdateTime(null);
scrapJobMainDO.setUpdater(null);
String remarkMain =Optional.ofNullable(scrapJobMainDO.getRemark()).orElse("");
String remarkSub=Optional.ofNullable(vo.getRemark()).orElse("");
BeanUtil.copyProperties(scrapJobMainDO,vo,options);
vo.setRemarkMain(remarkMain);
vo.setRemark(remarkSub);
}
}
}
PageResult<ScrapJobDetailRespVO> result = getScrapJobDetailRespVOPageResult(pageResult);
return success(result);
}
@ -158,11 +141,11 @@ public class ScrapJobDetailController {
@PreAuthorize("@ss.hasPermission('wms:scrap-job-detail:export')")
@OperateLog(type = EXPORT)
public void exportScrapJobDetailExcel(@Valid ScrapJobDetailExportReqVO exportReqVO,
HttpServletResponse response) throws IOException {
HttpServletResponse response) throws IOException {
List<ScrapJobDetailDO> list = scrapJobDetailService.getScrapJobDetailList(exportReqVO);
// 导出 Excel
List<ScrapJobDetailExcelVO> datas = ScrapJobDetailConvert.INSTANCE.convertList02(list);
for(ScrapJobDetailExcelVO vo : datas) {
for (ScrapJobDetailExcelVO vo : datas) {
AdminUserRespDTO user = userApi.getUser(Long.valueOf(vo.getCreator()));
//后端创建个字段作为前端展示的虚拟字段
vo.setCreator(user.getNickname());

24
win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/controller/scrapJob/ScrapJobMainController.java

@ -18,7 +18,6 @@ import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.tags.Tag;
import jodd.util.StringUtil;
import org.apache.commons.lang3.StringUtils;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.util.CollectionUtils;
import org.springframework.validation.annotation.Validated;
@ -30,6 +29,7 @@ import javax.validation.Valid;
import java.io.IOException;
import java.math.RoundingMode;
import java.util.*;
import java.util.stream.Collectors;
import static com.win.framework.common.pojo.CommonResult.success;
import static com.win.framework.operatelog.core.enums.OperateTypeEnum.EXPORT;
@ -143,25 +143,24 @@ public class ScrapJobMainController {
private List<ScrapJobMainExcelVO> getExcelVo(List<ScrapJobDetailDO> detailDOList) {
List<ScrapJobMainExcelVO> resultList = new ArrayList<>();
if (!CollectionUtils.isEmpty(detailDOList)) {
Set<Long> masterIdSet = new HashSet<>();
for (ScrapJobDetailDO detailDO : detailDOList) {
masterIdSet.add(detailDO.getMasterId());
}
Set<Long> masterIdSet = detailDOList.stream().map(ScrapJobDetailDO::getMasterId).collect(Collectors.toSet());
Map<Long, ScrapJobMainDO> mainMap = scrapJobMainMapper.queryMainListToMap(masterIdSet);
for (ScrapJobDetailDO detailDO : detailDOList) {
Set<String> userIdSet = detailDOList.stream().map(ScrapJobDetailDO::getCreator).collect(Collectors.toSet());
Map<String, String> userNicknameMap = userApi.getUserNicknameToString(userIdSet);
detailDOList.stream().iterator().forEachRemaining(detailDO -> {
ScrapJobMainDO mainDO = mainMap.get(detailDO.getMasterId());
ScrapJobMainExcelVO vo = ScrapJobMainConvert.INSTANCE.convert(mainDO, detailDO);
// if(mainDO != null ){
// vo.setRemarkMain(mainDO.getRemark());
// }
if(StringUtils.isNotEmpty(vo.getCreator())){
vo.setCreator(userApi.getUserNickname(vo.getCreator()));
}
if(vo.getQty() != null){
vo.setCreator(Optional.ofNullable(userNicknameMap.get(vo.getCreator())).orElse(""));
if (vo.getQty() != null) {
vo.setQty(vo.getQty().setScale(2, RoundingMode.HALF_UP));
}
resultList.add(vo);
}
});
}
return resultList;
}
@ -174,7 +173,8 @@ public class ScrapJobMainController {
ScrapJobMainRespVO result = ScrapJobMainConvert.INSTANCE.convert(scrapJobMain);
if (result == null) {
return success(result);
} ;
}
;
ScrapJobDetailExportReqVO reqVO = new ScrapJobDetailExportReqVO();
reqVO.setMasterId(result.getId());
List<ScrapJobDetailDO> scrapJobDetailList = scrapJobDetailService.getScrapJobDetailList(reqVO);

10
win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/controller/scrapJob/vo/ScrapJobMainExcelVO.java

@ -118,9 +118,9 @@ public class ScrapJobMainExcelVO {
@Colour(IndexedColors.LIGHT_YELLOW)
private String businessType;
@ExcelProperty("部门")
@Colour(IndexedColors.LIGHT_YELLOW)
private String departmentCode;
// @ExcelProperty("部门")
// @Colour(IndexedColors.LIGHT_YELLOW)
// private String departmentCode;
// @ExcelProperty("通知单描述")
// @Colour(IndexedColors.LIGHT_YELLOW)
@ -183,7 +183,7 @@ public class ScrapJobMainExcelVO {
@ExcelProperty("承接人")
@Colour(IndexedColors.LIGHT_YELLOW)
private String acceptUserId;
private String acceptUserName;
@ExcelProperty("完成时间")
@ColumnWidth(value = 16)
@ -192,7 +192,7 @@ public class ScrapJobMainExcelVO {
@ExcelProperty("完成人")
@Colour(IndexedColors.LIGHT_YELLOW)
private String completeUserId;
private String completeUserName;
@ExcelProperty("物料代码")
private String itemCode;

73
win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/controller/scrapRecord/ScrapRecordDetailController.java

@ -10,6 +10,7 @@ import com.win.framework.operatelog.core.annotations.OperateLog;
import com.win.module.system.api.user.AdminUserApi;
import com.win.module.wms.controller.scrapRecord.vo.*;
import com.win.module.wms.convert.scrapRecord.ScrapRecordDetailConvert;
import com.win.module.wms.dal.dataobject.scrapJob.ScrapJobDetailDO;
import com.win.module.wms.dal.dataobject.scrapRecord.ScrapRecordDetailDO;
import com.win.module.wms.dal.dataobject.scrapRecord.ScrapRecordMainDO;
import com.win.module.wms.dal.mysql.scrapRecord.ScrapRecordMainMapper;
@ -27,6 +28,7 @@ import javax.validation.Valid;
import java.io.IOException;
import java.math.RoundingMode;
import java.util.*;
import java.util.stream.Collectors;
import static com.win.framework.common.pojo.CommonResult.success;
import static com.win.framework.operatelog.core.enums.OperateTypeEnum.EXPORT;
@ -88,42 +90,49 @@ public class ScrapRecordDetailController {
@Operation(summary = "获得报废出库记录子分页")
public CommonResult<PageResult<ScrapRecordDetailRespVO>> getScrapRecordDetailPage(@Valid ScrapRecordDetailPageReqVO pageVO) {
PageResult<ScrapRecordDetailDO> pageResult = scrapRecordDetailService.getScrapRecordDetailPage(pageVO);
PageResult<ScrapRecordDetailRespVO> result = getScrapRecordDetailRespVOPageResult(pageResult);
return success(result);
}
private PageResult<ScrapRecordDetailRespVO> getScrapRecordDetailRespVOPageResult(PageResult<ScrapRecordDetailDO> pageResult) {
PageResult<ScrapRecordDetailRespVO> result = ScrapRecordDetailConvert.INSTANCE.convertPage(pageResult);
if(pageResult.getList().size() > 0){
Set<Long> masterIdSet = new HashSet<>();
for(ScrapRecordDetailDO scrapRecordDetailDO:pageResult.getList()){
masterIdSet.add(scrapRecordDetailDO.getMasterId());
}
if (pageResult.getList().size() > 0) {
Set<Long> masterIdSet = pageResult.getList().stream().map(ScrapRecordDetailDO::getMasterId).collect(Collectors.toSet());
Map<Long, ScrapRecordMainDO> mainMap = scrapRecordMainMapper.queryMainListToMap(masterIdSet);
//用户
Set<String> userIdSet = pageResult.getList().stream().map(ScrapRecordDetailDO::getCreator).collect(Collectors.toSet());
userIdSet.addAll(pageResult.getList().stream().map(ScrapRecordDetailDO::getUpdater).collect(Collectors.toSet()));
Map<String, String> userNicknameMap = userApi.getUserNicknameToString(userIdSet);
CopyOptions options = CopyOptions.create().setIgnoreNullValue(true);
for(ScrapRecordDetailRespVO vo : result.getList()) {
vo.setCreator(userApi.getUserNickname(vo.getCreator()));
vo.setUpdater(userApi.getUserNickname(vo.getUpdater()));
result.getList().stream().iterator().forEachRemaining(vo -> {
vo.setCreator(Optional.ofNullable(userNicknameMap.get(vo.getCreator())).orElse(""));
vo.setUpdater(Optional.ofNullable(userNicknameMap.get(vo.getUpdater())).orElse(""));
ScrapRecordMainDO scrapRecordMainDO = mainMap.get(vo.getMasterId());
if(scrapRecordMainDO != null){
if (scrapRecordMainDO != null) {
scrapRecordMainDO.setId(null);
scrapRecordMainDO.setCreator(null);
scrapRecordMainDO.setCreateTime(null);
scrapRecordMainDO.setUpdateTime(null);
scrapRecordMainDO.setUpdater(null);
String remarkMain =Optional.ofNullable(scrapRecordMainDO.getRemark()).orElse("");
String remarkSub=Optional.ofNullable(vo.getRemark()).orElse("");
BeanUtil.copyProperties(scrapRecordMainDO,vo,options);
if(vo.getQty() != null){
String remarkMain = Optional.ofNullable(scrapRecordMainDO.getRemark()).orElse("");
String remarkSub = Optional.ofNullable(vo.getRemark()).orElse("");
BeanUtil.copyProperties(scrapRecordMainDO, vo, options);
if (vo.getQty() != null) {
vo.setQty(vo.getQty().setScale(2, RoundingMode.HALF_UP));
}
if(vo.getSinglePrice() != null){
vo.setSinglePrice(vo.getSinglePrice().setScale(2,RoundingMode.HALF_UP));
if (vo.getSinglePrice() != null) {
vo.setSinglePrice(vo.getSinglePrice().setScale(2, RoundingMode.HALF_UP));
}
if(vo.getAmount() != null){
vo.setAmount(vo.getAmount().setScale(2,RoundingMode.HALF_UP));
if (vo.getAmount() != null) {
vo.setAmount(vo.getAmount().setScale(2, RoundingMode.HALF_UP));
}
vo.setRemarkMain(remarkMain);
vo.setRemark(remarkSub);
}
}
});
}
return success(result);
return result;
}
@PostMapping("/senior")
@ -131,34 +140,34 @@ public class ScrapRecordDetailController {
public CommonResult<PageResult<ScrapRecordDetailRespVO>> getScrapRecordDetailSenior(@Valid @RequestBody CustomConditions conditions) {
PageResult<ScrapRecordDetailDO> pageResult = scrapRecordDetailService.getScrapRecordDetailSenior(conditions);
PageResult<ScrapRecordDetailRespVO> result = ScrapRecordDetailConvert.INSTANCE.convertPage(pageResult);
if(pageResult.getList().size() > 0){
if (pageResult.getList().size() > 0) {
Set<Long> masterIdSet = new HashSet<>();
for(ScrapRecordDetailDO scrapRecordDetailDO:pageResult.getList()){
for (ScrapRecordDetailDO scrapRecordDetailDO : pageResult.getList()) {
masterIdSet.add(scrapRecordDetailDO.getMasterId());
}
Map<Long, ScrapRecordMainDO> mainMap = scrapRecordMainMapper.queryMainListToMap(masterIdSet);
CopyOptions options = CopyOptions.create().setIgnoreNullValue(true);
for(ScrapRecordDetailRespVO vo : result.getList()) {
for (ScrapRecordDetailRespVO vo : result.getList()) {
vo.setCreator(userApi.getUserNickname(vo.getCreator()));
vo.setUpdater(userApi.getUserNickname(vo.getUpdater()));
ScrapRecordMainDO scrapRecordMainDO = mainMap.get(vo.getMasterId());
if(scrapRecordMainDO != null){
if (scrapRecordMainDO != null) {
scrapRecordMainDO.setId(null);
scrapRecordMainDO.setCreator(null);
scrapRecordMainDO.setCreateTime(null);
scrapRecordMainDO.setUpdateTime(null);
scrapRecordMainDO.setUpdater(null);
String remarkMain =Optional.ofNullable(scrapRecordMainDO.getRemark()).orElse("");
String remarkSub=Optional.ofNullable(vo.getRemark()).orElse("");
BeanUtil.copyProperties(scrapRecordMainDO,vo,options);
if(vo.getQty() != null){
String remarkMain = Optional.ofNullable(scrapRecordMainDO.getRemark()).orElse("");
String remarkSub = Optional.ofNullable(vo.getRemark()).orElse("");
BeanUtil.copyProperties(scrapRecordMainDO, vo, options);
if (vo.getQty() != null) {
vo.setQty(vo.getQty().setScale(2, RoundingMode.HALF_UP));
}
if(vo.getSinglePrice() != null){
vo.setSinglePrice(vo.getSinglePrice().setScale(2,RoundingMode.HALF_UP));
if (vo.getSinglePrice() != null) {
vo.setSinglePrice(vo.getSinglePrice().setScale(2, RoundingMode.HALF_UP));
}
if(vo.getAmount() != null){
vo.setAmount(vo.getAmount().setScale(2,RoundingMode.HALF_UP));
if (vo.getAmount() != null) {
vo.setAmount(vo.getAmount().setScale(2, RoundingMode.HALF_UP));
}
vo.setRemarkMain(remarkMain);
vo.setRemark(remarkSub);
@ -173,7 +182,7 @@ public class ScrapRecordDetailController {
@PreAuthorize("@ss.hasPermission('wms:scrap-record-detail:export')")
@OperateLog(type = EXPORT)
public void exportScrapRecordDetailExcel(@Valid ScrapRecordDetailExportReqVO exportReqVO,
HttpServletResponse response) throws IOException {
HttpServletResponse response) throws IOException {
List<ScrapRecordDetailDO> list = scrapRecordDetailService.getScrapRecordDetailList(exportReqVO);
// 导出 Excel
List<ScrapRecordDetailExcelVO> datas = ScrapRecordDetailConvert.INSTANCE.convertList02(list);

58
win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/controller/scrapRecord/ScrapRecordMainController.java

@ -1,21 +1,5 @@
package com.win.module.wms.controller.scrapRecord;
import static com.win.framework.common.pojo.CommonResult.success;
import static com.win.framework.operatelog.core.enums.OperateTypeEnum.EXPORT;
import java.io.IOException;
import java.math.RoundingMode;
import java.util.*;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import javax.validation.Valid;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.util.CollectionUtils;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import com.win.framework.common.pojo.CommonResult;
import com.win.framework.common.pojo.CustomConditions;
import com.win.framework.common.pojo.PageResult;
@ -29,10 +13,24 @@ import com.win.module.wms.dal.dataobject.scrapRecord.ScrapRecordMainDO;
import com.win.module.wms.dal.mysql.scrapRecord.ScrapRecordMainMapper;
import com.win.module.wms.service.scrapRecord.ScrapRecordDetailService;
import com.win.module.wms.service.scrapRecord.ScrapRecordMainService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.util.CollectionUtils;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import javax.validation.Valid;
import java.io.IOException;
import java.math.RoundingMode;
import java.util.*;
import java.util.stream.Collectors;
import static com.win.framework.common.pojo.CommonResult.success;
import static com.win.framework.operatelog.core.enums.OperateTypeEnum.EXPORT;
@Tag(name = "管理后台 - 报废出库记录主")
@RestController
@ -109,6 +107,7 @@ public class ScrapRecordMainController {
public CommonResult<PageResult<ScrapRecordMainRespVO>> getScrapRecordMainSenior(@Valid @RequestBody CustomConditions conditions) {
PageResult<ScrapRecordMainDO> pageResult = scrapRecordMainService.getScrapRecordMainSenior(conditions);
PageResult<ScrapRecordMainRespVO> result = ScrapRecordMainConvert.INSTANCE.convertPage(pageResult);
for (ScrapRecordMainRespVO vo : result.getList()) {
vo.setCreator(userApi.getUserNickname(vo.getCreator()));
vo.setUpdater(userApi.getUserNickname(vo.getUpdater()));
@ -142,29 +141,30 @@ public class ScrapRecordMainController {
private List<ScrapRecordMainExcelVO> getExcelVo(List<ScrapRecordDetailDO> detailDOList) {
List<ScrapRecordMainExcelVO> resultList = new ArrayList<>();
if (!CollectionUtils.isEmpty(detailDOList)) {
Set<Long> masterIdSet = new HashSet<>();
for (ScrapRecordDetailDO detailDO : detailDOList) {
masterIdSet.add(detailDO.getMasterId());
}
Set<Long> masterIdSet = detailDOList.stream().map(ScrapRecordDetailDO::getMasterId).collect(Collectors.toSet());
Map<Long, ScrapRecordMainDO> mainMap = scrapRecordMainMapper.queryMainListToMap(masterIdSet);
for (ScrapRecordDetailDO detailDO : detailDOList) {
Set<String> userIdSet = detailDOList.stream().map(ScrapRecordDetailDO::getCreator).collect(Collectors.toSet());
Map<String, String> userNicknameMap = userApi.getUserNicknameToString(userIdSet);
detailDOList.stream().iterator().forEachRemaining(detailDO -> {
ScrapRecordMainDO mainDO = mainMap.get(detailDO.getMasterId());
ScrapRecordMainExcelVO vo = ScrapRecordMainConvert.INSTANCE.convert(mainDO, detailDO);
vo.setCreator(userApi.getUserNickname(vo.getCreator(),true));
vo.setCreator(Optional.ofNullable(userNicknameMap.get(vo.getCreator())).orElse(""));
// if(mainDO != null ){
// vo.setRemarkMain(mainDO.getRemark());
// }
if(vo.getQty() != null){
if (vo.getQty() != null) {
vo.setQty(vo.getQty().setScale(2, RoundingMode.HALF_UP));
}
if(vo.getSinglePrice() != null){
vo.setSinglePrice(vo.getSinglePrice().setScale(2,RoundingMode.HALF_UP));
if (vo.getSinglePrice() != null) {
vo.setSinglePrice(vo.getSinglePrice().setScale(2, RoundingMode.HALF_UP));
}
if(vo.getAmount() != null){
vo.setAmount(vo.getAmount().setScale(2,RoundingMode.HALF_UP));
if (vo.getAmount() != null) {
vo.setAmount(vo.getAmount().setScale(2, RoundingMode.HALF_UP));
}
resultList.add(vo);
}
});
}
return resultList;
}

6
win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/controller/scrapRecord/vo/ScrapRecordMainExcelVO.java

@ -117,9 +117,9 @@ public class ScrapRecordMainExcelVO {
@Colour(IndexedColors.LIGHT_YELLOW)
private String businessType;
@ExcelProperty("部门")
@Colour(IndexedColors.LIGHT_YELLOW)
private String departmentCode;
// @ExcelProperty("部门")
// @Colour(IndexedColors.LIGHT_YELLOW)
// private String departmentCode;
// @ExcelProperty("单据备注")
// @Colour(IndexedColors.LIGHT_YELLOW)

87
win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/controller/scrapRequest/ScrapRequestDetailController.java

@ -8,13 +8,10 @@ import com.win.framework.common.pojo.PageResult;
import com.win.framework.excel.core.util.ExcelUtils;
import com.win.framework.operatelog.core.annotations.OperateLog;
import com.win.module.system.api.user.AdminUserApi;
import com.win.module.system.api.user.dto.AdminUserRespDTO;
import com.win.module.wms.controller.scrapRequest.vo.ScrapRequestDetailRespVO;
import com.win.module.wms.controller.scrapRequest.vo.*;
import com.win.module.wms.convert.scrapRequest.ScrapRequestDetailConvert;
import com.win.module.wms.dal.dataobject.scrapRequest.ScrapRequestDetailDO;
import com.win.module.wms.dal.dataobject.scrapRequest.ScrapRequestMainDO;
import com.win.module.wms.dal.dataobject.scrapRequest.ScrapRequestDetailDO;
import com.win.module.wms.dal.mysql.scrapRequest.ScrapRequestMainMapper;
import com.win.module.wms.service.scrapRequest.ScrapRequestDetailService;
import io.swagger.v3.oas.annotations.Operation;
@ -30,6 +27,7 @@ import javax.validation.Valid;
import java.io.IOException;
import java.math.RoundingMode;
import java.util.*;
import java.util.stream.Collectors;
import static com.win.framework.common.pojo.CommonResult.success;
import static com.win.framework.operatelog.core.enums.OperateTypeEnum.EXPORT;
@ -91,83 +89,56 @@ public class ScrapRequestDetailController {
@Operation(summary = "获得报废出库申请子分页")
public CommonResult<PageResult<ScrapRequestDetailRespVO>> getScrapRequestDetailPage(@Valid ScrapRequestDetailPageReqVO pageVO) {
PageResult<ScrapRequestDetailDO> pageResult = scrapRequestDetailService.getScrapRequestDetailPage(pageVO);
PageResult<ScrapRequestDetailRespVO> result = getScrapRequestDetailRespVOPageResult(pageResult);
return success(result);
}
private PageResult<ScrapRequestDetailRespVO> getScrapRequestDetailRespVOPageResult(PageResult<ScrapRequestDetailDO> pageResult) {
PageResult<ScrapRequestDetailRespVO> result = ScrapRequestDetailConvert.INSTANCE.convertPage(pageResult);
if(pageResult.getList().size() > 0){
Set<Long> masterIdSet = new HashSet<>();
for(ScrapRequestDetailDO scrapRequestDetailDO:pageResult.getList()){
masterIdSet.add(scrapRequestDetailDO.getMasterId());
}
if (pageResult.getList().size() > 0) {
Set<Long> masterIdSet = pageResult.getList().stream().map(ScrapRequestDetailDO::getMasterId).collect(Collectors.toSet());
Map<Long, ScrapRequestMainDO> mainMap = scrapRequestMainMapper.queryMainListToMap(masterIdSet);
//用户
Set<String> userIdSet = pageResult.getList().stream().map(ScrapRequestDetailDO::getCreator).collect(Collectors.toSet());
userIdSet.addAll(pageResult.getList().stream().map(ScrapRequestDetailDO::getCreator).collect(Collectors.toSet()));
Map<String, String> userNicknameMap = userApi.getUserNicknameToString(userIdSet);
CopyOptions options = CopyOptions.create().setIgnoreNullValue(true);
for(ScrapRequestDetailRespVO vo : result.getList()) {
vo.setCreator(userApi.getUserNickname(vo.getCreator()));
vo.setUpdater(userApi.getUserNickname(vo.getUpdater()));
result.getList().stream().iterator().forEachRemaining(vo -> {
vo.setCreator(Optional.ofNullable(userNicknameMap.get(vo.getCreator())).orElse(""));
vo.setUpdater(Optional.ofNullable(userNicknameMap.get(vo.getUpdater())).orElse(""));
ScrapRequestMainDO scrapRequestMainDO = mainMap.get(vo.getMasterId());
if(scrapRequestMainDO != null){
if (scrapRequestMainDO != null) {
scrapRequestMainDO.setId(null);
scrapRequestMainDO.setCreator(null);
scrapRequestMainDO.setCreateTime(null);
scrapRequestMainDO.setUpdateTime(null);
scrapRequestMainDO.setUpdater(null);
String remarkMain =Optional.ofNullable(scrapRequestMainDO.getRemark()).orElse("");
String remarkSub=Optional.ofNullable(vo.getRemark()).orElse("");
BeanUtil.copyProperties(scrapRequestMainDO,vo,options);
if(vo.getQty() != null){
String remarkMain = Optional.ofNullable(scrapRequestMainDO.getRemark()).orElse("");
String remarkSub = Optional.ofNullable(vo.getRemark()).orElse("");
BeanUtil.copyProperties(scrapRequestMainDO, vo, options);
if (vo.getQty() != null) {
vo.setQty(vo.getQty().setScale(2, RoundingMode.HALF_UP));
}
if(vo.getSinglePrice() != null){
vo.setSinglePrice(vo.getSinglePrice().setScale(2,RoundingMode.HALF_UP));
if (vo.getSinglePrice() != null) {
vo.setSinglePrice(vo.getSinglePrice().setScale(2, RoundingMode.HALF_UP));
}
if(vo.getAmount() != null){
vo.setAmount(vo.getAmount().setScale(2,RoundingMode.HALF_UP));
if (vo.getAmount() != null) {
vo.setAmount(vo.getAmount().setScale(2, RoundingMode.HALF_UP));
}
vo.setRemarkMain(remarkMain);
vo.setRemark(remarkSub);
}
}
});
}
return success(result);
return result;
}
@PostMapping("/senior")
@Operation(summary = "高级搜索获得物料基本信息分页")
public CommonResult<PageResult<ScrapRequestDetailRespVO>> getScrapRequestDetailSenior(@Valid @RequestBody CustomConditions conditions) {
PageResult<ScrapRequestDetailDO> pageResult = scrapRequestDetailService.getScrapRequestDetailSenior(conditions);
PageResult<ScrapRequestDetailRespVO> result = ScrapRequestDetailConvert.INSTANCE.convertPage(pageResult);
if(pageResult.getList().size() > 0){
Set<Long> masterIdSet = new HashSet<>();
for(ScrapRequestDetailDO scrapRequestDetailDO:pageResult.getList()){
masterIdSet.add(scrapRequestDetailDO.getMasterId());
}
Map<Long, ScrapRequestMainDO> mainMap = scrapRequestMainMapper.queryMainListToMap(masterIdSet);
CopyOptions options = CopyOptions.create().setIgnoreNullValue(true);
for(ScrapRequestDetailRespVO vo : result.getList()) {
vo.setCreator(userApi.getUserNickname(vo.getCreator()));
vo.setUpdater(userApi.getUserNickname(vo.getUpdater()));
ScrapRequestMainDO scrapRequestMainDO = mainMap.get(vo.getMasterId());
if(scrapRequestMainDO != null){
scrapRequestMainDO.setId(null);
scrapRequestMainDO.setCreator(null);
scrapRequestMainDO.setCreateTime(null);
scrapRequestMainDO.setUpdateTime(null);
scrapRequestMainDO.setUpdater(null);
String remarkMain =Optional.ofNullable(scrapRequestMainDO.getRemark()).orElse("");
String remarkSub=Optional.ofNullable(vo.getRemark()).orElse("");
BeanUtil.copyProperties(scrapRequestMainDO,vo,options);
if(vo.getQty() != null){
vo.setQty(vo.getQty().setScale(2, RoundingMode.HALF_UP));
}
if(vo.getSinglePrice() != null){
vo.setSinglePrice(vo.getSinglePrice().setScale(2,RoundingMode.HALF_UP));
}
if(vo.getAmount() != null){
vo.setAmount(vo.getAmount().setScale(2,RoundingMode.HALF_UP));
}
vo.setRemarkMain(remarkMain);
vo.setRemark(remarkSub);
}
}
}
PageResult<ScrapRequestDetailRespVO> result = getScrapRequestDetailRespVOPageResult(pageResult);
return success(result);
}
@ -176,7 +147,7 @@ public class ScrapRequestDetailController {
@PreAuthorize("@ss.hasPermission('wms:scrap-request-detail:export')")
@OperateLog(type = EXPORT)
public void exportScrapRequestDetailExcel(@Valid ScrapRequestDetailExportReqVO exportReqVO,
HttpServletResponse response) throws IOException {
HttpServletResponse response) throws IOException {
List<ScrapRequestDetailDO> list = scrapRequestDetailService.getScrapRequestDetailList(exportReqVO);
// 导出 Excel
List<ScrapRequestDetailExcelVO> datas = ScrapRequestDetailConvert.INSTANCE.convertList02(list);

75
win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/controller/scrapRequest/ScrapRequestMainController.java

@ -1,26 +1,5 @@
package com.win.module.wms.controller.scrapRequest;
import static com.win.framework.common.pojo.CommonResult.success;
import static com.win.framework.operatelog.core.enums.OperateTypeEnum.EXPORT;
import java.io.IOException;
import java.math.RoundingMode;
import java.time.LocalDateTime;
import java.time.ZoneOffset;
import java.util.*;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import javax.validation.Valid;
import org.apache.commons.lang3.StringUtils;
import org.springframework.context.annotation.Lazy;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.util.CollectionUtils;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import com.win.framework.common.pojo.CommonResult;
import com.win.framework.common.pojo.CustomConditions;
import com.win.framework.common.pojo.PageResult;
@ -38,11 +17,29 @@ import com.win.module.wms.dal.mysql.scrapRequest.ScrapRequestMainMapper;
import com.win.module.wms.enums.DictTypeConstants;
import com.win.module.wms.service.scrapRequest.ScrapRequestDetailService;
import com.win.module.wms.service.scrapRequest.ScrapRequestMainService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.Parameters;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.context.annotation.Lazy;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.util.CollectionUtils;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import javax.validation.Valid;
import java.io.IOException;
import java.math.RoundingMode;
import java.time.LocalDateTime;
import java.time.ZoneOffset;
import java.util.*;
import java.util.stream.Collectors;
import static com.win.framework.common.pojo.CommonResult.success;
import static com.win.framework.operatelog.core.enums.OperateTypeEnum.EXPORT;
@Tag(name = "管理后台 - 报废出库申请主")
@RestController
@ -138,10 +135,10 @@ public class ScrapRequestMainController {
@PostMapping("/import")
@Operation(summary = "导入报废出库请基本信息")
@Parameters({@Parameter(name = "file", description = "Excel 文件", required = true), @Parameter(name = "mode", description = "导入模式1更新2追加3覆盖", example = "1"),
@Parameter(name = "updatePart", description = "部分更新,默认为 true", example = "true")})
@Parameter(name = "updatePart", description = "部分更新,默认为 true", example = "true")})
@PreAuthorize("@ss.hasPermission('wms:scrap-request-main:import')")
public CommonResult<Map<String, Object>> importExcel(HttpServletResponse response, @RequestParam("file") MultipartFile file, @RequestParam(value = "mode") Integer mode,
@RequestParam(value = "updatePart", required = false, defaultValue = "false") Boolean updatePart) throws Exception {
@RequestParam(value = "updatePart", required = false, defaultValue = "false") Boolean updatePart) throws Exception {
List<ScrapRequestImportVO> list = ExcelUtils.read(file, ScrapRequestImportVO.class);
ConvertUtil<ScrapRequestMainCreateReqVO> convertUtil = new ConvertUtil<>(ScrapRequestMainCreateReqVO.class);
List<ScrapRequestMainCreateReqVO> createReqVOList = convertUtil.invoke(list).getDataList();
@ -183,31 +180,30 @@ public class ScrapRequestMainController {
private List<ScrapRequestMainExcelVO> getExcelVo(List<ScrapRequestDetailDO> detailDOList) {
List<ScrapRequestMainExcelVO> resultList = new ArrayList<>();
if (!CollectionUtils.isEmpty(detailDOList)) {
Set<Long> masterIdSet = new HashSet<>();
for (ScrapRequestDetailDO detailDO : detailDOList) {
masterIdSet.add(detailDO.getMasterId());
}
Set<Long> masterIdSet = detailDOList.stream().map(ScrapRequestDetailDO::getMasterId).collect(Collectors.toSet());
Map<Long, ScrapRequestMainDO> mainMap = scrapRequestMainMapper.queryMainListToMap(masterIdSet);
for (ScrapRequestDetailDO detailDO : detailDOList) {
Set<String> userIdSet = detailDOList.stream().map(ScrapRequestDetailDO::getCreator).collect(Collectors.toSet());
Map<String, String> userNicknameMap = userApi.getUserNicknameToString(userIdSet);
detailDOList.stream().iterator().forEachRemaining(detailDO -> {
ScrapRequestMainDO mainDO = mainMap.get(detailDO.getMasterId());
ScrapRequestMainExcelVO vo = ScrapRequestMainConvert.INSTANCE.convert(mainDO, detailDO);
// if(mainDO != null ){
// vo.setRemarkMain(mainDO.getRemark());
// }
if(StringUtils.isNotEmpty(vo.getCreator())){
vo.setCreator(userApi.getUserNickname(vo.getCreator()));
}
if(vo.getQty() != null){
vo.setCreator(Optional.ofNullable(userNicknameMap.get(vo.getCreator())).orElse(""));
if (vo.getQty() != null) {
vo.setQty(vo.getQty().setScale(2, RoundingMode.HALF_UP));
}
if(vo.getSinglePrice() != null){
vo.setSinglePrice(vo.getSinglePrice().setScale(2,RoundingMode.HALF_UP));
if (vo.getSinglePrice() != null) {
vo.setSinglePrice(vo.getSinglePrice().setScale(2, RoundingMode.HALF_UP));
}
if(vo.getAmount() != null){
vo.setAmount(vo.getAmount().setScale(2,RoundingMode.HALF_UP));
if (vo.getAmount() != null) {
vo.setAmount(vo.getAmount().setScale(2, RoundingMode.HALF_UP));
}
resultList.add(vo);
}
});
}
return resultList;
}
@ -220,7 +216,8 @@ public class ScrapRequestMainController {
ScrapRequestMainRespVO result = ScrapRequestMainConvert.INSTANCE.convert(scrapRequestMain);
if (result == null) {
return success(result);
} ;
}
;
ScrapRequestDetailExportReqVO reqVO = new ScrapRequestDetailExportReqVO();
reqVO.setMasterId(result.getId());
List<ScrapRequestDetailDO> list = scrapRequestDetailService.getScrapRequestDetailList(reqVO);

Loading…
Cancel
Save