Browse Source

修改订单导出

training
caoyizhong 1 year ago
parent
commit
74ca7ecc28
  1. 13
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/controller/DistributionStockArticleController.java
  2. 67
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/excel/DistributionStockArticleExcel.java
  3. 2
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionStockArticleMapper.java
  4. 2
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionStockArticleMapper.xml
  5. 7
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/IDistributionStockArticleService.java
  6. 56
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionStockArticleServiceImpl.java

13
blade-service/logpm-distribution/src/main/java/com/logpm/distribution/controller/DistributionStockArticleController.java

@ -16,10 +16,8 @@
*/ */
package com.logpm.distribution.controller; package com.logpm.distribution.controller;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport; import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import com.logpm.basicdata.entity.BasicdataWarehouseEntity; import com.logpm.basicdata.entity.BasicdataWarehouseEntity;
import com.logpm.basicdata.feign.IBasicdataWarehouseClient; import com.logpm.basicdata.feign.IBasicdataWarehouseClient;
@ -38,7 +36,6 @@ import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam; import io.swagger.annotations.ApiParam;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springblade.common.utils.CommonUtil;
import org.springblade.core.boot.ctrl.BladeController; import org.springblade.core.boot.ctrl.BladeController;
import org.springblade.core.excel.util.ExcelUtil; import org.springblade.core.excel.util.ExcelUtil;
import org.springblade.core.mp.support.Condition; import org.springblade.core.mp.support.Condition;
@ -48,7 +45,6 @@ import org.springblade.core.tool.api.R;
import org.springblade.core.tool.constant.BladeConstant; import org.springblade.core.tool.constant.BladeConstant;
import org.springblade.core.tool.utils.DateUtil; import org.springblade.core.tool.utils.DateUtil;
import org.springblade.core.tool.utils.Func; import org.springblade.core.tool.utils.Func;
import org.springblade.core.tool.utils.ObjectUtil;
import org.springblade.system.feign.IDictBizClient; import org.springblade.system.feign.IDictBizClient;
import org.springblade.system.feign.IUserClient; import org.springblade.system.feign.IUserClient;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
@ -60,7 +56,6 @@ import javax.validation.Valid;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.stream.Collectors;
/** /**
* 配送在库订单 控制器 * 配送在库订单 控制器
@ -353,12 +348,8 @@ public class DistributionStockArticleController extends BladeController {
@ApiOperationSupport(order = 9) @ApiOperationSupport(order = 9)
@ApiOperation(value = "导出数据", notes = "传入distributionStockArticle") @ApiOperation(value = "导出数据", notes = "传入distributionStockArticle")
public void exportDistributionStockArticle(@ApiIgnore @RequestParam Map<String, Object> distributionStockArticle, BladeUser bladeUser, HttpServletResponse response) { public void exportDistributionStockArticle(@ApiIgnore @RequestParam Map<String, Object> distributionStockArticle, BladeUser bladeUser, HttpServletResponse response) {
QueryWrapper<DistributionStockArticleEntity> queryWrapper = Condition.getQueryWrapper(distributionStockArticle, DistributionStockArticleEntity.class);
//if (!AuthUtil.isAdministrator()) { List<DistributionStockArticleExcel> list = distributionStockArticleService.exportDistributionStockArticle(distributionStockArticle);
// queryWrapper.lambda().eq(DistributionStockArticle::getTenantId, bladeUser.getTenantId());
//}
queryWrapper.lambda().eq(DistributionStockArticleEntity::getIsDeleted, BladeConstant.DB_NOT_DELETED);
List<DistributionStockArticleExcel> list = distributionStockArticleService.exportDistributionStockArticle(queryWrapper);
ExcelUtil.export(response, "配送在库订单数据" + DateUtil.time(), "配送在库订单数据表", list, DistributionStockArticleExcel.class); ExcelUtil.export(response, "配送在库订单数据" + DateUtil.time(), "配送在库订单数据表", list, DistributionStockArticleExcel.class);
} }

67
blade-service/logpm-distribution/src/main/java/com/logpm/distribution/excel/DistributionStockArticleExcel.java

@ -40,49 +40,6 @@ import java.util.Date;
public class DistributionStockArticleExcel implements Serializable { public class DistributionStockArticleExcel implements Serializable {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
/**
* 租户号
*/
@ColumnWidth(20)
@ExcelProperty("租户号")
private String tenantId;
/**
* 是否已删除
*/
@ColumnWidth(20)
@ExcelProperty("是否已删除")
private Integer isDeleted;
/**
* 预留1
*/
@ColumnWidth(20)
@ExcelProperty("预留1")
private String reserve1;
/**
* 预留2
*/
@ColumnWidth(20)
@ExcelProperty("预留2")
private String reserve2;
/**
* 预留3
*/
@ColumnWidth(20)
@ExcelProperty("预留3")
private String reserve3;
/**
* 预留4
*/
@ColumnWidth(20)
@ExcelProperty("预留4")
private String reserve4;
/**
* 预留5
*/
@ColumnWidth(20)
@ExcelProperty("预留5")
private String reserve5;
/** /**
* 服务号 * 服务号
*/ */
@ -94,7 +51,7 @@ public class DistributionStockArticleExcel implements Serializable {
*/ */
@ColumnWidth(20) @ColumnWidth(20)
@ExcelProperty("订单自编号") @ExcelProperty("订单自编号")
private String orderSelfNumbering; private String orderCode;
/** /**
* 商场名称 * 商场名称
*/ */
@ -130,7 +87,7 @@ public class DistributionStockArticleExcel implements Serializable {
*/ */
@ColumnWidth(20) @ColumnWidth(20)
@ExcelProperty("在库时间") @ExcelProperty("在库时间")
private Date storeTime; private String storeTime;
/** /**
* 订单总件数 * 订单总件数
*/ */
@ -148,7 +105,7 @@ public class DistributionStockArticleExcel implements Serializable {
*/ */
@ColumnWidth(20) @ColumnWidth(20)
@ExcelProperty("是否齐套") @ExcelProperty("是否齐套")
private Integer completeSet; private String completeSet;
/** /**
* 品牌 * 品牌
*/ */
@ -198,16 +155,22 @@ public class DistributionStockArticleExcel implements Serializable {
@ExcelProperty("收货单位") @ExcelProperty("收货单位")
private String consigneeUnit; private String consigneeUnit;
/** /**
* 类型;1 预约单 2库存单 * 订单来源
*/ */
@ColumnWidth(20) @ColumnWidth(20)
@ExcelProperty("类型;1 预约单 2库存单") @ExcelProperty("订单来源")
private Integer genre; private String resource;
/**
* 类型;1 预约单 2库存单
*/
// @ColumnWidth(20)
// @ExcelProperty("类型;1 预约单 2库存单")
// private Integer genre;
/** /**
* 状态;1 配送 2 待配送 * 状态;1 配送 2 待配送
*/ */
@ColumnWidth(20) // @ColumnWidth(20)
@ExcelProperty("状态;1 配送 2 待配送") // @ExcelProperty("状态;1 配送 2 待配送")
private Integer state; // private Integer state;
} }

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

@ -58,7 +58,7 @@ public interface DistributionStockArticleMapper extends BaseMapper<DistributionS
* @param queryWrapper * @param queryWrapper
* @return * @return
*/ */
List<DistributionStockArticleExcel> exportDistributionStockArticle(@Param("ew") Wrapper<DistributionStockArticleEntity> queryWrapper); List<DistributionStockArticleEntity> exportDistributionStockArticle(@Param("ew") Wrapper<DistributionStockArticleEntity> queryWrapper);
void addHandQuantity(@Param("id") Long id,@Param("num") int num); void addHandQuantity(@Param("id") Long id,@Param("num") int num);

2
blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionStockArticleMapper.xml

@ -56,7 +56,7 @@
</select> </select>
<select id="exportDistributionStockArticle" resultType="com.logpm.distribution.excel.DistributionStockArticleExcel"> <select id="exportDistributionStockArticle" resultType="com.logpm.distribution.entity.DistributionStockArticleEntity">
SELECT * FROM logpm_distribution_stock_article ${ew.customSqlSegment} SELECT * FROM logpm_distribution_stock_article ${ew.customSqlSegment}
</select> </select>

7
blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/IDistributionStockArticleService.java

@ -16,8 +16,6 @@
*/ */
package com.logpm.distribution.service; package com.logpm.distribution.service;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.logpm.distribution.dto.DistributionStockArticleDTO; import com.logpm.distribution.dto.DistributionStockArticleDTO;
import com.logpm.distribution.dto.app.queryOrderDTO; import com.logpm.distribution.dto.app.queryOrderDTO;
@ -56,10 +54,9 @@ public interface IDistributionStockArticleService extends BaseService<Distributi
/** /**
* 导出数据 * 导出数据
* *
* @param queryWrapper * @param distributionStockArticle@return
* @return
*/ */
List<DistributionStockArticleExcel> exportDistributionStockArticle(Wrapper<DistributionStockArticleEntity> queryWrapper); List<DistributionStockArticleExcel> exportDistributionStockArticle(Map<String, Object> distributionStockArticle);
Boolean saveStock(String ids); Boolean saveStock(String ids);

56
blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionStockArticleServiceImpl.java

@ -16,9 +16,7 @@
*/ */
package com.logpm.distribution.service.impl; package com.logpm.distribution.service.impl;
import cn.hutool.core.util.ArrayUtil;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
@ -62,6 +60,7 @@ import org.springblade.core.mp.support.Query;
import org.springblade.core.secure.BladeUser; import org.springblade.core.secure.BladeUser;
import org.springblade.core.secure.utils.AuthUtil; import org.springblade.core.secure.utils.AuthUtil;
import org.springblade.core.tool.api.R; import org.springblade.core.tool.api.R;
import org.springblade.core.tool.constant.BladeConstant;
import org.springblade.core.tool.utils.BeanUtil; import org.springblade.core.tool.utils.BeanUtil;
import org.springblade.core.tool.utils.Func; import org.springblade.core.tool.utils.Func;
import org.springblade.core.tool.utils.ObjectUtil; import org.springblade.core.tool.utils.ObjectUtil;
@ -132,14 +131,49 @@ public class DistributionStockArticleServiceImpl extends BaseServiceImpl<Distrib
return page.setRecords(distributionStockArticleVOS); return page.setRecords(distributionStockArticleVOS);
} }
/**
* 导出数据
* @param distributionStockArticle@return
* @return
*/
@Override @Override
public List<DistributionStockArticleExcel> exportDistributionStockArticle(Wrapper<DistributionStockArticleEntity> queryWrapper) { public List<DistributionStockArticleExcel> exportDistributionStockArticle(Map<String, Object> distributionStockArticle) {
List<DistributionStockArticleExcel> distributionStockArticleList = baseMapper.exportDistributionStockArticle(queryWrapper);
//distributionStockArticleList.forEach(distributionStockArticle -> { Object o = distributionStockArticle.get("ids");
// distributionStockArticle.setTypeName(DictCache.getValue(DictEnum.YES_NO, DistributionStockArticle.getType())); if(ObjectUtils.isNotNull(o)){
//}); distributionStockArticle.remove("ids");
return distributionStockArticleList; }
QueryWrapper<DistributionStockArticleEntity> queryWrapper = Condition.getQueryWrapper(distributionStockArticle, DistributionStockArticleEntity.class);
//if (!AuthUtil.isAdministrator()) {
// queryWrapper.lambda().eq(DistributionStockArticle::getTenantId, bladeUser.getTenantId());
//}
queryWrapper.lambda().eq(DistributionStockArticleEntity::getIsDeleted, BladeConstant.DB_NOT_DELETED);
if(ObjectUtils.isNotNull(o)){
queryWrapper.in("id",String.valueOf(o).split(","));
}
BasicdataWarehouseEntity myCurrentWarehouse = warehouseClient.getMyCurrentWarehouse();
if(ObjectUtils.isNull(myCurrentWarehouse)){
throw new ServiceException("没有仓库信息!");
}
queryWrapper.eq("warehouse_id",myCurrentWarehouse.getId());
queryWrapper.apply("order_status != 70");
List<DistributionStockArticleEntity> list = baseMapper.exportDistributionStockArticle(queryWrapper);
List<DistributionStockArticleExcel> listExcel = new ArrayList<>();
list.forEach(s -> {
// distributionStockArticle.setTypeName(DictCache.getValue(DictEnum.YES_NO, DistributionStockArticle.getType()));
DistributionStockArticleExcel stockArticleExcel = new DistributionStockArticleExcel();
BasicdataWarehouseEntity entityWarehouse = warehouseClient.getEntityWarehouseId(s.getWarehouseId());
BeanUtil.copyProperties(s,stockArticleExcel);
stockArticleExcel.setWarehouseCode(entityWarehouse.getWarehouseCode());
String s1 = s.getCompleteSet().equals("1") ? "否" : "是";
stockArticleExcel.setCompleteSet(s1);
String value = DictBizCache.getValue(DictBizConstant.DISTRIBUTION_TYPE, s.getTypeService());
stockArticleExcel.setTypeService(value);
listExcel.add(stockArticleExcel);
});
return listExcel;
} }
/** /**
@ -1013,7 +1047,7 @@ public class DistributionStockArticleServiceImpl extends BaseServiceImpl<Distrib
stockArticleEntity.setFreezeStatus("10"); stockArticleEntity.setFreezeStatus("10");
stockArticleEntity.setBrand(i.getBrand()); stockArticleEntity.setBrand(i.getBrand());
stockArticleEntity.setDescriptionGoods(i.getDescriptionGoods()); stockArticleEntity.setDescriptionGoods(i.getDescriptionGoods());
stockArticleEntity.setOrderCode(i.getOrderSelfNumbering()); stockArticleEntity.setOrderCode(i.getOrderCode());
stockArticleEntity.setMallName(i.getMallName()); stockArticleEntity.setMallName(i.getMallName());
stockArticleEntity.setTotalNumber(i.getTotalNumber()); stockArticleEntity.setTotalNumber(i.getTotalNumber());
stockArticleEntity.setHandQuantity(i.getHandQuantity()); stockArticleEntity.setHandQuantity(i.getHandQuantity());
@ -1038,7 +1072,7 @@ public class DistributionStockArticleServiceImpl extends BaseServiceImpl<Distrib
parcelListEntity.setWarehouse(i.getWarehouse()); parcelListEntity.setWarehouse(i.getWarehouse());
parcelListEntity.setWarehouseId(warehouse.getId()); parcelListEntity.setWarehouseId(warehouse.getId());
parcelListEntity.setConditions(1); parcelListEntity.setConditions(1);
parcelListEntity.setOrderCode(i.getOrderSelfNumbering()); parcelListEntity.setOrderCode(i.getOrderCode());
parcelListEntity.setServiceNumber(i.getServiceNumber()); parcelListEntity.setServiceNumber(i.getServiceNumber());
parcelListEntity.setBrandName(Optional.ofNullable(i.getBrand()).orElse(null)); parcelListEntity.setBrandName(Optional.ofNullable(i.getBrand()).orElse(null));
if(i.getDescriptionGoods().contains(",")){ if(i.getDescriptionGoods().contains(",")){

Loading…
Cancel
Save