Browse Source

add:增加商场的库存品导出功能

dist.1.3.0
pref_mail@163.com 6 months ago
parent
commit
9435b4eeb4
  1. 8
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/controller/MallOrderController.java
  2. 81
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/controller/MallStockController.java
  3. 2
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/IDistributionStockListService.java
  4. 66
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionStockListServiceImpl.java

8
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<IPage<DistributionStockArticleVO>> 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<String, Object> paramMap, BladeUser bladeUser, HttpServletResponse response) {

81
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<IPage<DistributionStockListVO>> page(@ApiIgnore @RequestParam Map<String, Object> distributionStockList, Query query) {
IPage<DistributionStockListVO> 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<String, Object> distributionStockList, BladeUser bladeUser, HttpServletResponse response) {
List<DistributionStockListExcel> list = distributionStockListService.exportStock(distributionStockList);
ExcelUtil.export(response, "商场库存品管理数据" + DateUtil.time(), "商场库存品管理数据表", list, DistributionStockListExcel.class);
}
}

2
blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/IDistributionStockListService.java

@ -218,6 +218,8 @@ public interface IDistributionStockListService extends BaseService<DistributionS
void clearAllocationByIds(List<Long> clearAllocationStockListIds);
List<DistributionStockListExcel> exportStock(Map<String, Object> distributionStockList);
// /**

66
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<Distributi
@Override
public List<DistributionStockListExcel> exportDistributionStockList(Map<String, Object> 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<Distributi
if(ObjectUtils.isNotNull(ids)){
queryWrapper.in(ObjectUtils.isNotNull(ids),"id",String.valueOf(ids).split(","));
}
List<DistributionStockListEntity> distributionStockListEntities = baseMapper.exportDistributionStockList(queryWrapper);
List<DistributionStockListExcel> 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<WarehouseTrayGoodsEntity> 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<DistributionStockListExcel> exportStock(Map<String, Object> 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<DistributionStockListEntity> 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<BasicdataClientUserEntity> basicdataClientUserEntityListByUserIds = basicdataClientClient.getBasicdataClientUserEntityListByUserId(AuthUtil.getUserId());
List<Long> 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<DistributionStockListEntity> distributionStockListEntities = baseMapper.exportDistributionStockList(queryWrapper);
List<DistributionStockListExcel> excelList = new ArrayList<>();
distributionStockListEntities.forEach(stockList -> {
// stockList.setServiceType(DictBizCache.getValue(DictBizConstant.DISTRIBUTION_TYPE, stockList.getServiceType()));

Loading…
Cancel
Save