店铺流水相关代码优化,流水与结算单业务隔离。

相关方法进行优化,迁移。
This commit is contained in:
Chopper 2021-11-30 16:57:19 +08:00
parent bea807c7b4
commit 6184ba9b82
17 changed files with 67 additions and 153 deletions

View File

@ -1,4 +1,4 @@
package cn.lili.controller.system;
package cn.lili.controller.message;
import cn.lili.common.enums.ResultUtil;
import cn.lili.common.security.context.UserContext;

View File

@ -66,4 +66,25 @@ public interface StoreFlowService extends IService<StoreFlow> {
*/
List<StoreFlowRefundDownloadVO> getStoreFlowRefundDownloadVO(Wrapper<StoreFlow> queryWrapper);
/**
* 根据结算单ID获取商家流水
*
* @param pageVO 分页
* @param id 结算单ID
* @param type 类型
* @return 商家流水
*/
IPage<StoreFlow> getStoreFlow(String id, String type, PageVO pageVO);
/**
* 根据结算单ID获取商家流水
*
* @param pageVO 分页
* @param id 结算单ID
* @return 商家流水
*/
IPage<StoreFlow> getDistributionFlow(String id, PageVO pageVO);
}

View File

@ -15,8 +15,10 @@ import cn.lili.modules.order.order.service.OrderService;
import cn.lili.modules.order.order.service.StoreFlowService;
import cn.lili.modules.payment.entity.RefundLog;
import cn.lili.modules.payment.service.RefundLogService;
import cn.lili.modules.store.entity.dos.Bill;
import cn.lili.modules.store.entity.vos.StoreFlowPayDownloadVO;
import cn.lili.modules.store.entity.vos.StoreFlowRefundDownloadVO;
import cn.lili.modules.store.service.BillService;
import cn.lili.mybatis.util.PageUtil;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
@ -59,6 +61,9 @@ public class StoreFlowServiceImpl extends ServiceImpl<StoreFlowMapper, StoreFlow
@Autowired
private RefundLogService refundLogService;
@Autowired
private BillService billService;
@Override
public void payOrder(String orderSn) {
//根据订单编号获取子订单列表
@ -180,4 +185,18 @@ public class StoreFlowServiceImpl extends ServiceImpl<StoreFlowMapper, StoreFlow
public List<StoreFlowRefundDownloadVO> getStoreFlowRefundDownloadVO(Wrapper<StoreFlow> queryWrapper) {
return baseMapper.getStoreFlowRefundDownloadVO(queryWrapper);
}
@Override
public IPage<StoreFlow> getStoreFlow(String id, String type, PageVO pageVO) {
Bill bill = billService.getById(id);
return this.getStoreFlow(bill.getStoreId(), type, false, pageVO, bill.getStartTime(), bill.getCreateTime());
}
@Override
public IPage<StoreFlow> getDistributionFlow(String id, PageVO pageVO) {
Bill bill = billService.getById(id);
return this.getStoreFlow(bill.getStoreId(), null, true, pageVO, bill.getStartTime(), bill.getCreateTime());
}
}

View File

@ -12,53 +12,14 @@ import java.util.Date;
/**
* 店铺流水下载
*
* @author Bulbasaur
* @date: 2021/8/13 4:14 下午
*
*/
@Data
public class StoreFlowRefundDownloadVO {
@CreatedDate
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@TableField(fill = FieldFill.INSERT)
@ApiModelProperty(value = "创建时间", hidden = true)
private Date createTime;
@ApiModelProperty(value = "订单sn")
private String orderSn;
public class StoreFlowRefundDownloadVO extends StoreFlowPayDownloadVO {
@ApiModelProperty(value = "售后SN")
private String refundSn;
@ApiModelProperty(value = "店铺名称 ")
private String storeName;
@ApiModelProperty(value = "商品名称")
private String goodsName;
@ApiModelProperty(value = "销售量")
private Integer num;
@ApiModelProperty(value = "流水金额")
private Double finalPrice;
@ApiModelProperty(value = "平台收取交易佣金")
private Double commissionPrice;
@ApiModelProperty(value = "平台优惠券 使用金额")
private Double siteCouponPrice;
@ApiModelProperty(value = "单品分销返现支出")
private Double distributionRebate;
@ApiModelProperty(value = "积分活动商品结算价格")
private Double pointSettlementPrice;
@ApiModelProperty(value = "砍价活动商品结算价格")
private Double kanjiaSettlementPrice;
@ApiModelProperty(value = "最终结算金额")
private Double billPrice;
}

View File

@ -42,25 +42,6 @@ public interface BillService extends IService<Bill> {
*/
void immediatelyBill(String storeId, Long endTime);
/**
* 根据结算单ID获取商家流水
*
* @param pageVO 分页
* @param id 结算单ID
* @param type 类型
* @return 商家流水
*/
IPage<StoreFlow> getStoreFlow(String id, String type, PageVO pageVO);
/**
* 根据结算单ID获取商家流水
*
* @param pageVO 分页
* @param id 结算单ID
* @return 商家流水
*/
IPage<StoreFlow> getDistributionFlow(String id, PageVO pageVO);
/**
* 获取结算单分页
*

View File

@ -161,18 +161,6 @@ public class BillServiceImpl extends ServiceImpl<BillMapper, Bill> implements Bi
// this.createBill(storeId, startTime, endTime);
}
@Override
public IPage<StoreFlow> getStoreFlow(String id, String type, PageVO pageVO) {
Bill bill = this.getById(id);
return storeFlowService.getStoreFlow(bill.getStoreId(), type, false, pageVO, bill.getStartTime(), bill.getCreateTime());
}
@Override
public IPage<StoreFlow> getDistributionFlow(String id, PageVO pageVO) {
Bill bill = this.getById(id);
return storeFlowService.getStoreFlow(bill.getStoreId(), null, true, pageVO, bill.getStartTime(), bill.getCreateTime());
}
@Override
public IPage<BillListVO> billPage(BillSearchParams billSearchParams) {
QueryWrapper<BillListVO> queryWrapper = billSearchParams.queryWrapper();
@ -282,11 +270,11 @@ public class BillServiceImpl extends ServiceImpl<BillMapper, Bill> implements Bi
writer.setColumnWidth(12, 20);
//存放入账列表
LambdaQueryWrapper<StoreFlow> storeFlowlambdaQueryWrapper = Wrappers.lambdaQuery();
storeFlowlambdaQueryWrapper.eq(StoreFlow::getStoreId, bill.getStoreId());
storeFlowlambdaQueryWrapper.between(StoreFlow::getCreateTime, bill.getStartTime(), bill.getCreateTime());
storeFlowlambdaQueryWrapper.eq(StoreFlow::getFlowType, FlowTypeEnum.PAY.name());
List<StoreFlowRefundDownloadVO> storeFlowRefundDownloadVOList = storeFlowService.getStoreFlowRefundDownloadVO(storeFlowlambdaQueryWrapper);
LambdaQueryWrapper<StoreFlow> storeFlowLambdaQueryWrapper = Wrappers.lambdaQuery();
storeFlowLambdaQueryWrapper.eq(StoreFlow::getStoreId, bill.getStoreId());
storeFlowLambdaQueryWrapper.between(StoreFlow::getCreateTime, bill.getStartTime(), bill.getCreateTime());
storeFlowLambdaQueryWrapper.eq(StoreFlow::getFlowType, FlowTypeEnum.PAY.name());
List<StoreFlowRefundDownloadVO> storeFlowRefundDownloadVOList = storeFlowService.getStoreFlowRefundDownloadVO(storeFlowLambdaQueryWrapper);
writer.write(storeFlowRefundDownloadVOList, true);
ServletOutputStream out = null;

View File

@ -15,11 +15,9 @@ import cn.lili.modules.goods.entity.enums.GoodsStatusEnum;
import cn.lili.modules.goods.service.GoodsService;
import cn.lili.modules.goods.service.GoodsSkuService;
import cn.lili.modules.member.entity.dos.Member;
import cn.lili.modules.member.entity.dos.StoreCollection;
import cn.lili.modules.member.entity.dto.CollectionDTO;
import cn.lili.modules.member.service.MemberService;
import cn.lili.modules.member.service.StoreCollectionService;
import cn.lili.modules.page.service.PageDataService;
import cn.lili.modules.store.entity.dos.Store;
import cn.lili.modules.store.entity.dos.StoreDetail;
import cn.lili.modules.store.entity.dto.*;
@ -63,21 +61,11 @@ public class StoreServiceImpl extends ServiceImpl<StoreMapper, Store> implements
*/
@Autowired
private GoodsService goodsService;
/**
* 商品SKU
*/
@Autowired
private GoodsSkuService goodsSkuService;
/**
* 店铺详情
*/
@Autowired
private StoreDetailService storeDetailService;
/**
* 店铺收藏
*/
@Autowired
private StoreCollectionService storeCollectionService;
@Override
public IPage<StoreVO> findByConditionPage(StoreSearchParams storeSearchParams, PageVO page) {

View File

@ -1,18 +0,0 @@
package cn.lili.modules.system.aspect.annotation;
import java.lang.annotation.*;
/**
* 演示站点注解
*
* @author Bulbasaur
* @since 2021/7/9 1:40 上午
*/
@Target(ElementType.METHOD)
@Retention(RetentionPolicy.RUNTIME)
@Documented
@Inherited
public @interface DemoSite {
}

View File

@ -1,34 +0,0 @@
package cn.lili.modules.system.aspect.interceptor;
import cn.lili.common.enums.ResultCode;
import cn.lili.common.exception.ServiceException;
import cn.lili.common.properties.SystemSettingProperties;
import cn.lili.modules.system.aspect.annotation.DemoSite;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Before;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
/**
* 演示站点拦截
* DemoInterceptor
*
* @author Chopper
* @version v1.0
* 2021-05-12 17:55
*/
@Component
@Aspect
public class DemoInterceptor {
@Autowired
private SystemSettingProperties systemSettingProperties;
@Before("@annotation(demoSite)")
public void doAfter(DemoSite demoSite) {
if (systemSettingProperties.getIsDemoSite()) {
throw new ServiceException(ResultCode.DEMO_SITE_EXCEPTION);
}
}
}

View File

@ -9,7 +9,7 @@ import cn.lili.modules.member.entity.dto.MemberAddDTO;
import cn.lili.modules.member.entity.vo.MemberSearchVO;
import cn.lili.modules.member.entity.vo.MemberVO;
import cn.lili.modules.member.service.MemberService;
import cn.lili.modules.system.aspect.annotation.DemoSite;
import cn.lili.common.aop.annotation.DemoSite;
import com.baomidou.mybatisplus.core.metadata.IPage;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;

View File

@ -1,4 +1,4 @@
package cn.lili.controller.member;
package cn.lili.controller.message;
import cn.lili.common.enums.ResultUtil;
import cn.lili.common.vo.PageVO;

View File

@ -1,4 +1,4 @@
package cn.lili.controller.member;
package cn.lili.controller.message;
import cn.lili.common.enums.ResultUtil;
import cn.lili.mybatis.util.PageUtil;

View File

@ -1,4 +1,4 @@
package cn.lili.controller.member;
package cn.lili.controller.message;
import cn.lili.common.enums.ResultUtil;
import cn.lili.common.security.context.UserContext;

View File

@ -1,4 +1,4 @@
package cn.lili.controller.member;
package cn.lili.controller.message;
import cn.lili.common.enums.ResultUtil;
import cn.lili.mybatis.util.PageUtil;

View File

@ -4,6 +4,7 @@ import cn.lili.common.enums.ResultUtil;
import cn.lili.common.vo.PageVO;
import cn.lili.common.vo.ResultMessage;
import cn.lili.modules.order.order.entity.dos.StoreFlow;
import cn.lili.modules.order.order.service.StoreFlowService;
import cn.lili.modules.store.entity.dos.Bill;
import cn.lili.modules.store.entity.dto.BillSearchParams;
import cn.lili.modules.store.entity.vos.BillListVO;
@ -31,6 +32,9 @@ public class BillManagerController {
@Autowired
private BillService billService;
@Autowired
private StoreFlowService storeFlowService;
@ApiOperation(value = "通过id获取结算单")
@ApiImplicitParam(name = "id", value = "结算单ID", required = true, paramType = "path")
@GetMapping(value = "/get/{id}")
@ -51,7 +55,7 @@ public class BillManagerController {
})
@GetMapping(value = "/{id}/getStoreFlow")
public ResultMessage<IPage<StoreFlow>> getStoreFlow(@PathVariable String id, String flowType, PageVO pageVO) {
return ResultUtil.data(billService.getStoreFlow(id, flowType, pageVO));
return ResultUtil.data(storeFlowService.getStoreFlow(id, flowType, pageVO));
}
@ApiOperation(value = "支付结算单")

View File

@ -1,4 +1,4 @@
package cn.lili.controller.settings;
package cn.lili.controller.message;
import cn.lili.common.enums.ResultUtil;

View File

@ -6,6 +6,7 @@ import cn.lili.common.security.context.UserContext;
import cn.lili.common.vo.PageVO;
import cn.lili.common.vo.ResultMessage;
import cn.lili.modules.order.order.entity.dos.StoreFlow;
import cn.lili.modules.order.order.service.StoreFlowService;
import cn.lili.modules.store.entity.dos.Bill;
import cn.lili.modules.store.entity.dto.BillSearchParams;
import cn.lili.modules.store.entity.vos.BillListVO;
@ -36,6 +37,9 @@ public class BillStoreController {
@Autowired
private BillService billService;
@Autowired
private StoreFlowService storeFlowService;
@ApiOperation(value = "获取结算单分页")
@GetMapping(value = "/getByPage")
public ResultMessage<IPage<BillListVO>> getByPage(BillSearchParams billSearchParams) {
@ -59,7 +63,7 @@ public class BillStoreController {
@GetMapping(value = "/{id}/getStoreFlow")
public ResultMessage<IPage<StoreFlow>> getStoreFlow(@PathVariable String id, String flowType, PageVO pageVO) {
OperationalJudgment.judgment(billService.getById(id));
return ResultUtil.data(billService.getStoreFlow(id, flowType, pageVO));
return ResultUtil.data(storeFlowService.getStoreFlow(id, flowType, pageVO));
}
@ApiOperation(value = "获取商家分销订单流水分页")
@ -69,7 +73,7 @@ public class BillStoreController {
@GetMapping(value = "/{id}/getDistributionFlow")
public ResultMessage<IPage<StoreFlow>> getDistributionFlow(@PathVariable String id, PageVO pageVO) {
OperationalJudgment.judgment(billService.getById(id));
return ResultUtil.data(billService.getDistributionFlow(id, pageVO));
return ResultUtil.data(storeFlowService.getDistributionFlow(id, pageVO));
}
@ApiOperation(value = "核对结算单")
@ -81,13 +85,13 @@ public class BillStoreController {
return ResultUtil.success();
}
@ApiOperation(value = "下载结算单",produces="application/octet-stream")
@ApiOperation(value = "下载结算单", produces = "application/octet-stream")
@ApiImplicitParam(name = "id", value = "结算单ID", required = true, paramType = "path", dataType = "String")
@GetMapping(value = "/downLoad/{id}")
public void downLoadDeliverExcel(@PathVariable String id) {
OperationalJudgment.judgment(billService.getById(id));
HttpServletResponse response = ThreadContextHolder.getHttpResponse();
billService.download(response,id);
billService.download(response, id);
}