店铺流水查询交互参数从querywrapper调整为DTO

This commit is contained in:
Chopper 2021-12-08 14:36:14 +08:00
parent 357b214192
commit 2e5f383db4
4 changed files with 48 additions and 17 deletions

View File

@ -4,7 +4,6 @@ import cn.hutool.core.date.DateField;
import cn.hutool.core.date.DateTime;
import cn.hutool.json.JSONUtil;
import cn.lili.common.utils.CurrencyUtil;
import cn.lili.mybatis.util.PageUtil;
import cn.lili.modules.distribution.entity.dos.Distribution;
import cn.lili.modules.distribution.entity.dos.DistributionOrder;
import cn.lili.modules.distribution.entity.enums.DistributionOrderStatusEnum;
@ -14,6 +13,7 @@ import cn.lili.modules.distribution.service.DistributionOrderService;
import cn.lili.modules.distribution.service.DistributionService;
import cn.lili.modules.order.order.entity.dos.Order;
import cn.lili.modules.order.order.entity.dos.StoreFlow;
import cn.lili.modules.order.order.entity.dto.StoreFlowQueryDTO;
import cn.lili.modules.order.order.entity.enums.PayStatusEnum;
import cn.lili.modules.order.order.service.OrderService;
import cn.lili.modules.order.order.service.StoreFlowService;
@ -21,6 +21,7 @@ import cn.lili.modules.system.entity.dos.Setting;
import cn.lili.modules.system.entity.dto.DistributionSetting;
import cn.lili.modules.system.entity.enums.SettingEnum;
import cn.lili.modules.system.service.SettingService;
import cn.lili.mybatis.util.PageUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
@ -87,10 +88,9 @@ public class DistributionOrderServiceImpl extends ServiceImpl<DistributionOrderM
//判断是否为分销订单如果为分销订单则获取分销佣金
if (order.getDistributionId() != null) {
//根据订单编号获取有分销金额的店铺流水记录
List<StoreFlow> storeFlowList = storeFlowService.list(new LambdaQueryWrapper<StoreFlow>()
.eq(StoreFlow::getOrderSn, orderSn)
.isNotNull(StoreFlow::getDistributionRebate));
Double rebate = 0.0;
List<StoreFlow> storeFlowList = storeFlowService
.listStoreFlow(StoreFlowQueryDTO.builder().justDistribution(true).orderSn(orderSn).build());
double rebate = 0.0;
//循环店铺流水记录判断是否包含分销商品
//包含分销商品则进行记录分销订单计算分销总额
for (StoreFlow storeFlow : storeFlowList) {
@ -165,7 +165,7 @@ public class DistributionOrderServiceImpl extends ServiceImpl<DistributionOrderM
return;
}
//分销金额
Double rebate = 0.0;
double rebate = 0.0;
//包含分销商品则进行记录分销订单计算分销总额
for (DistributionOrder distributionOrder : distributionOrderList) {
@ -187,9 +187,7 @@ public class DistributionOrderServiceImpl extends ServiceImpl<DistributionOrderM
@Override
public void refundOrder(String afterSaleSn) {
//判断是否为分销订单
StoreFlow storeFlow = storeFlowService.getOne(new LambdaQueryWrapper<StoreFlow>()
.eq(StoreFlow::getRefundSn, afterSaleSn)
.isNotNull(StoreFlow::getDistributionRebate));
StoreFlow storeFlow = storeFlowService.queryOne(StoreFlowQueryDTO.builder().justDistribution(true).refundSn(afterSaleSn).build());
if (storeFlow != null) {
//获取收款分销订单
@ -199,12 +197,7 @@ public class DistributionOrderServiceImpl extends ServiceImpl<DistributionOrderM
if (distributionOrder == null) {
return;
}
//已提交无法重复提交
if (distributionOrder.getDistributionOrderStatus().equals(DistributionOrderStatusEnum.CANCEL.name())) {
return;
}
//如果未结算则将分销订单取消
else if (distributionOrder.getDistributionOrderStatus().equals(DistributionOrderStatusEnum.WAIT_BILL.name())) {
if (distributionOrder.getDistributionOrderStatus().equals(DistributionOrderStatusEnum.WAIT_BILL.name())) {
this.update(new LambdaUpdateWrapper<DistributionOrder>()
.eq(DistributionOrder::getOrderItemSn, storeFlow.getOrderItemSn())
.set(DistributionOrder::getDistributionOrderStatus, DistributionOrderStatusEnum.CANCEL.name()));

View File

@ -20,6 +20,12 @@ public class StoreFlowQueryDTO {
@ApiModelProperty(value = "类型")
private String type;
@ApiModelProperty(value = "售后编号")
private String refundSn;
@ApiModelProperty(value = "售后编号")
private String orderSn;
@ApiModelProperty(value = "过滤只看分销订单")
private Boolean justDistribution;

View File

@ -41,6 +41,14 @@ public interface StoreFlowService extends IService<StoreFlow> {
*/
IPage<StoreFlow> getStoreFlow(StoreFlowQueryDTO storeFlowQueryDTO);
/**
* 根据参数查询一条数据
*
* @param storeFlowQueryDTO 查询参数
* @return 返回分页
*/
StoreFlow queryOne(StoreFlowQueryDTO storeFlowQueryDTO);
/**
* 获取结算单地入账流水
*
@ -78,4 +86,11 @@ public interface StoreFlowService extends IService<StoreFlow> {
IPage<StoreFlow> getDistributionFlow(String id, PageVO pageVO);
/**
* 获取店铺流水
*
* @param storeFlowQueryDTO 店铺流水查询参数
* @return 商家流水集合
*/
List<StoreFlow> listStoreFlow(StoreFlowQueryDTO storeFlowQueryDTO);
}

View File

@ -174,6 +174,10 @@ public class StoreFlowServiceImpl extends ServiceImpl<StoreFlowMapper, StoreFlow
return this.page(PageUtil.initPage(storeFlowQueryDTO.getPageVO()), generatorQueryWrapper(storeFlowQueryDTO));
}
@Override
public StoreFlow queryOne(StoreFlowQueryDTO storeFlowQueryDTO) {
return this.getOne(generatorQueryWrapper(storeFlowQueryDTO));
}
@Override
public List<StoreFlowPayDownloadVO> getStoreFlowPayDownloadVO(StoreFlowQueryDTO storeFlowQueryDTO) {
@ -198,11 +202,16 @@ public class StoreFlowServiceImpl extends ServiceImpl<StoreFlowMapper, StoreFlow
return this.getStoreFlow(StoreFlowQueryDTO.builder().pageVO(pageVO).bill(bill).build());
}
@Override
public List<StoreFlow> listStoreFlow(StoreFlowQueryDTO storeFlowQueryDTO) {
return this.list(generatorQueryWrapper(storeFlowQueryDTO));
}
/**
* 生成查询wrapper
*
* @param storeFlowQueryDTO
* @return
* @param storeFlowQueryDTO 搜索参数
* @return 查询wrapper
*/
private LambdaQueryWrapper generatorQueryWrapper(StoreFlowQueryDTO storeFlowQueryDTO) {
@ -216,6 +225,14 @@ public class StoreFlowServiceImpl extends ServiceImpl<StoreFlowMapper, StoreFlow
lambdaQueryWrapper.eq(StringUtils.isNotEmpty(storeFlowQueryDTO.getType()),
StoreFlow::getFlowType, storeFlowQueryDTO.getType());
//售后编号判定
lambdaQueryWrapper.eq(StringUtils.isNotEmpty(storeFlowQueryDTO.getRefundSn()),
StoreFlow::getRefundSn, storeFlowQueryDTO.getRefundSn());
//售后编号判定
lambdaQueryWrapper.eq(StringUtils.isNotEmpty(storeFlowQueryDTO.getOrderSn()),
StoreFlow::getOrderSn, storeFlowQueryDTO.getOrderSn());
//结算单非空则校对结算单参数
if (storeFlowQueryDTO.getBill() != null) {
Bill bill = storeFlowQueryDTO.getBill();