From 9435b4eeb45101b7877a63ca57819e42ba559972 Mon Sep 17 00:00:00 2001 From: "pref_mail@163.com" Date: Wed, 31 Jul 2024 16:31:14 +0800 Subject: [PATCH] =?UTF-8?q?add:=E5=A2=9E=E5=8A=A0=E5=95=86=E5=9C=BA?= =?UTF-8?q?=E7=9A=84=E5=BA=93=E5=AD=98=E5=93=81=E5=AF=BC=E5=87=BA=E5=8A=9F?= =?UTF-8?q?=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/MallOrderController.java | 8 +- .../controller/MallStockController.java | 81 +++++++++++++++++++ .../IDistributionStockListService.java | 2 + .../DistributionStockListServiceImpl.java | 66 ++++++++++++++- 4 files changed, 152 insertions(+), 5 deletions(-) create mode 100644 blade-service/logpm-distribution/src/main/java/com/logpm/distribution/controller/MallStockController.java diff --git a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/controller/MallOrderController.java b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/controller/MallOrderController.java index 17a5cdfd9..547070c4b 100644 --- a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/controller/MallOrderController.java +++ b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/controller/MallOrderController.java @@ -42,15 +42,15 @@ import java.util.stream.Collectors; @RestController @Slf4j @AllArgsConstructor -@RequestMapping("/maill") -@Api(value = "商场在库订单", tags = "配送在库订单接口") +@RequestMapping("/mall/order/") +@Api(value = "商场在库订单", tags = "商场在库订单") public class MallOrderController extends BladeController { private final IDistributionStockArticleService distributionStockArticleService; private final IBasicdataClientClient basicdataClientClient; private IBasicdataWarehouseClient warehouseClient; - @GetMapping("/clientList") + @GetMapping("/page") @ApiOperationSupport(order = 2) @ApiOperation(value = "分页", notes = "传入distributionStockArticle") public R> clientList(@ApiIgnore DistributionStockArticleVO distributionStockArticle, Query query) { @@ -77,7 +77,7 @@ public class MallOrderController extends BladeController { /** * 导出数据 */ - @GetMapping("/export-maillOrder") + @GetMapping("/export-order") @ApiOperationSupport(order = 9) @ApiOperation(value = "导出已签订单数据", notes = "传入distributionStockArticle") public void exportMaillOrder(@ApiIgnore @RequestParam Map paramMap, BladeUser bladeUser, HttpServletResponse response) { diff --git a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/controller/MallStockController.java b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/controller/MallStockController.java new file mode 100644 index 000000000..36f5f7c0a --- /dev/null +++ b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/controller/MallStockController.java @@ -0,0 +1,81 @@ +package com.logpm.distribution.controller; + +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport; +import com.logpm.basicdata.entity.BasicdataClientUserEntity; +import com.logpm.basicdata.feign.IBasicdataClientClient; +import com.logpm.basicdata.feign.IBasicdataWarehouseClient; +import com.logpm.distribution.entity.DistributionStockArticleEntity; +import com.logpm.distribution.excel.DistributionStockArticleExcel; +import com.logpm.distribution.excel.DistributionStockListExcel; +import com.logpm.distribution.service.IDistributionStockArticleService; +import com.logpm.distribution.service.IDistributionStockListService; +import com.logpm.distribution.vo.DistributionStockArticleVO; +import com.logpm.distribution.vo.DistributionStockListVO; +import com.logpm.distribution.wrapper.DistributionStockArticleWrapper; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.AllArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springblade.core.boot.ctrl.BladeController; +import org.springblade.core.excel.util.ExcelUtil; +import org.springblade.core.mp.support.Condition; +import org.springblade.core.mp.support.Query; +import org.springblade.core.secure.BladeUser; +import org.springblade.core.secure.utils.AuthUtil; +import org.springblade.core.tool.api.R; +import org.springblade.core.tool.utils.DateUtil; +import org.springblade.core.tool.utils.Func; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.RestController; +import springfox.documentation.annotations.ApiIgnore; + +import javax.servlet.http.HttpServletResponse; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; + +/** + * 商家库存品控制器 + * @date 2019/07/01 + * @author pref + */ +@RestController +@Slf4j +@AllArgsConstructor +@RequestMapping("/mall/stock") +@Api(value = "商场库存品", tags = "商场库存品") +public class MallStockController extends BladeController { + private final IDistributionStockArticleService distributionStockArticleService; + + private final IBasicdataClientClient basicdataClientClient; + + private final IDistributionStockListService distributionStockListService; + + private IBasicdataWarehouseClient warehouseClient; + /** + * 库存品管理 商城客户查询列表 + */ + @GetMapping("/page") + @ApiOperationSupport(order = 2) + @ApiOperation(value = "分页", notes = "传入distributionStockList") + public R> page(@ApiIgnore @RequestParam Map distributionStockList, Query query) { + IPage pages = distributionStockListService.pageClient(Condition.getPage(query), distributionStockList); + return R.data(pages); + } + + /** + * 导出数据 + */ + @GetMapping("/export-stock") + @ApiOperationSupport(order = 9) + @ApiOperation(value = "导出在库库存品数据") + public void exportStock(@ApiIgnore @RequestParam Map distributionStockList, BladeUser bladeUser, HttpServletResponse response) { + + List list = distributionStockListService.exportStock(distributionStockList); + ExcelUtil.export(response, "商场库存品管理数据" + DateUtil.time(), "商场库存品管理数据表", list, DistributionStockListExcel.class); + } + +} diff --git a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/IDistributionStockListService.java b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/IDistributionStockListService.java index 5951d9fab..b5e08aa2c 100644 --- a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/IDistributionStockListService.java +++ b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/IDistributionStockListService.java @@ -218,6 +218,8 @@ public interface IDistributionStockListService extends BaseService clearAllocationStockListIds); + List exportStock(Map distributionStockList); + // /** diff --git a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionStockListServiceImpl.java b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionStockListServiceImpl.java index 0cb196dda..fef367c12 100644 --- a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionStockListServiceImpl.java +++ b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionStockListServiceImpl.java @@ -52,6 +52,7 @@ import org.springblade.common.constant.DictBizConstant; import org.springblade.common.constant.WorkNodeEnums; import org.springblade.common.constant.orderpackage.OrderPackageStockupStatusConstant; import org.springblade.common.constant.printTemplate.PrintTemplateStatusConstant; +import org.springblade.common.exception.CustomerException; import org.springblade.common.utils.QRCodeUtil; import org.springblade.common.utils.TemplateUtil; import org.springblade.core.log.exception.ServiceException; @@ -151,7 +152,6 @@ public class DistributionStockListServiceImpl extends BaseServiceImpl exportDistributionStockList(Map distributionStockList) { - Object o = distributionStockList.get("row"); Object ids = distributionStockList.get("ids"); if(ObjectUtils.isNotNull(ids)){ distributionStockList.remove("ids"); @@ -168,7 +168,71 @@ public class DistributionStockListServiceImpl extends BaseServiceImpl distributionStockListEntities = baseMapper.exportDistributionStockList(queryWrapper); + + + + List excelList = new ArrayList<>(); + distributionStockListEntities.forEach(stockList -> { +// stockList.setServiceType(DictBizCache.getValue(DictBizConstant.DISTRIBUTION_TYPE, stockList.getServiceType())); + DistributionStockListExcel distributionStockListExcel = new DistributionStockListExcel(); + BeanUtil.copyProperties(stockList,distributionStockListExcel); + String value = DictBizCache.getValue(DictBizConstant.DISTRIBUTION_TYPE, stockList.getServiceType()); + distributionStockListExcel.setServiceTypeName(value); + distributionStockListExcel.setUnpack(stockList.getUnpack() ? "是":"否"); + //查询包装数量 + BasicMaterialEntity materialOwnId = basicMaterialClient.getMaterialOwnId(stockList.getMaterialId()); + if(ObjectUtils.isNotNull(materialOwnId)){ + distributionStockListExcel.setPackNum(materialOwnId.getPackageNum()); + } + //查询托盘信息 + WarehouseTrayGoodsEntity warehouseTrayGoodsEntity = new WarehouseTrayGoodsEntity(); + warehouseTrayGoodsEntity.setMarketId(stockList.getMarketId()); + warehouseTrayGoodsEntity.setWarehouseId(myCurrentWarehouse.getId()); + warehouseTrayGoodsEntity.setIncomingBatch(stockList.getIncomingBatch()); + warehouseTrayGoodsEntity.setAssociationId(stockList.getMaterialId()); + warehouseTrayGoodsEntity.setAssociationType("4"); + List trayList = warehouseTrayGoodsClient.getTrayList(warehouseTrayGoodsEntity); + if(!trayList.isEmpty()){ + distributionStockListExcel.setTrayCode(trayList.stream().map(WarehouseTrayGoodsEntity::getTrayCode).collect(Collectors.joining(","))); + } + excelList.add(distributionStockListExcel); + }); + return excelList; + } + + @Override + public List exportStock(Map distributionStockList) { + Object ids = distributionStockList.get("ids"); + if(ObjectUtils.isNotNull(ids)){ + distributionStockList.remove("ids"); + } + + BasicdataWarehouseEntity myCurrentWarehouse = basicdataWarehouseClient.getMyCurrentWarehouse(); + if(ObjectUtils.isNotNull(myCurrentWarehouse)){ + distributionStockList.put("warehouseId",myCurrentWarehouse.getId()); + }else{ + throw new ServiceException("请选择仓库,在进行导出数据!!!"); + } + QueryWrapper queryWrapper = Condition.getQueryWrapper(distributionStockList, DistributionStockListEntity.class); + queryWrapper.lambda().eq(DistributionStockListEntity::getIsDeleted, BladeConstant.DB_NOT_DELETED); + if(ObjectUtils.isNotNull(ids)){ + queryWrapper.in(ObjectUtils.isNotNull(ids),"id",String.valueOf(ids).split(",")); + } + + List basicdataClientUserEntityListByUserIds = basicdataClientClient.getBasicdataClientUserEntityListByUserId(AuthUtil.getUserId()); + List clientIds = null; + if (Func.isNotEmpty(basicdataClientUserEntityListByUserIds)) { + clientIds = basicdataClientUserEntityListByUserIds.stream().map(BasicdataClientUserEntity::getClientId).collect(Collectors.toList()); + queryWrapper.in("market_id",clientIds); + } else { + throw new CustomerException("当前账号没有绑定商场"); + } + List distributionStockListEntities = baseMapper.exportDistributionStockList(queryWrapper); + List excelList = new ArrayList<>(); distributionStockListEntities.forEach(stockList -> { // stockList.setServiceType(DictBizCache.getValue(DictBizConstant.DISTRIBUTION_TYPE, stockList.getServiceType()));