Skip to content

Commit

Permalink
统计模块继续独立,拆分业务
Browse files Browse the repository at this point in the history
  • Loading branch information
chopper711 committed Dec 6, 2021
1 parent a8698fb commit f7ab6dc
Show file tree
Hide file tree
Showing 12 changed files with 113 additions and 87 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -138,12 +138,4 @@ public interface AfterSaleService extends IService<AfterSale> {
*/
StoreAfterSaleAddressDTO getStoreAfterSaleAddressDTO(String sn);

/**
* 获取统计的售后
*
* @param statisticsQueryParam 统计搜索参数
* @param pageVO 分页
* @return 售后分页列表
*/
IPage<AfterSale> getStatistics(StatisticsQueryParam statisticsQueryParam, PageVO pageVO);
}
Original file line number Diff line number Diff line change
Expand Up @@ -372,17 +372,6 @@ public StoreAfterSaleAddressDTO getStoreAfterSaleAddressDTO(String sn) {
return storeDetailService.getStoreAfterSaleAddressDTO(OperationalJudgment.judgment(this.getBySn(sn)).getStoreId());
}

@Override
public IPage<AfterSale> getStatistics(StatisticsQueryParam statisticsQueryParam, PageVO pageVO) {

LambdaQueryWrapper<AfterSale> queryWrapper = new LambdaQueryWrapper<>();
Date[] dates = StatisticsDateUtil.getDateArray(statisticsQueryParam);
queryWrapper.between(AfterSale::getCreateTime, dates[0], dates[1]);
queryWrapper.eq(CharSequenceUtil.isNotEmpty(statisticsQueryParam.getStoreId()), AfterSale::getStoreId, statisticsQueryParam.getStoreId());

return this.page(PageUtil.initPage(pageVO), queryWrapper);
}

/**
* 创建售后
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,27 +31,6 @@ public interface OrderMapper extends BaseMapper<Order> {
@Update({"update li_order set order_status = #{status} where sn = #{orderSn}"})
void updateStatus(String status, String orderSn);

/**
* 查询订单简短信息分页
*
* @param page 分页
* @param queryWrapper 查询条件
* @return 简短订单分页
*/
@Select("select o.sn,o.flow_price,o.create_time,o.order_status,o.pay_status,o.payment_method,o.payment_time,o.member_name,o.store_name as store_name,o.store_id as store_id,o.client_type,o.order_type,o.deliver_status " +
",GROUP_CONCAT(oi.goods_id) as group_goods_id," +
" GROUP_CONCAT(oi.sku_id) as group_sku_id," +
" GROUP_CONCAT(oi.num) as group_num" +
",GROUP_CONCAT(oi.image) as group_images" +
",GROUP_CONCAT(oi.goods_name) as group_name " +
",GROUP_CONCAT(oi.after_sale_status) as group_after_sale_status" +
",GROUP_CONCAT(oi.complain_status) as group_complain_status" +
",GROUP_CONCAT(oi.comment_status) as group_comment_status" +
",GROUP_CONCAT(oi.sn) as group_order_items_sn " +
",GROUP_CONCAT(oi.goods_price) as group_goods_price " +
" FROM li_order o INNER JOIN li_order_item AS oi on o.sn = oi.order_sn ${ew.customSqlSegment} ")
IPage<OrderSimpleVO> queryByParams(IPage<OrderSimpleVO> page, @Param(Constants.WRAPPER) Wrapper<OrderSimpleVO> queryWrapper);

/**
* 查询导出订单DTO列表
*
Expand All @@ -74,4 +53,25 @@ public interface OrderMapper extends BaseMapper<Order> {
@Select("select * from li_order ${ew.customSqlSegment} ")
IPage<PaymentLog> queryPaymentLogs(IPage<PaymentLog> page, @Param(Constants.WRAPPER) Wrapper<PaymentLog> queryWrapper);

/**
* 查询订单简短信息分页
*
* @param page 分页
* @param queryWrapper 查询条件
* @return 简短订单分页
*/
@Select("select o.sn,o.flow_price,o.create_time,o.order_status,o.pay_status,o.payment_method,o.payment_time,o.member_name,o.store_name as store_name,o.store_id as store_id,o.client_type,o.order_type,o.deliver_status " +
",GROUP_CONCAT(oi.goods_id) as group_goods_id," +
" GROUP_CONCAT(oi.sku_id) as group_sku_id," +
" GROUP_CONCAT(oi.num) as group_num" +
",GROUP_CONCAT(oi.image) as group_images" +
",GROUP_CONCAT(oi.goods_name) as group_name " +
",GROUP_CONCAT(oi.after_sale_status) as group_after_sale_status" +
",GROUP_CONCAT(oi.complain_status) as group_complain_status" +
",GROUP_CONCAT(oi.comment_status) as group_comment_status" +
",GROUP_CONCAT(oi.sn) as group_order_items_sn " +
",GROUP_CONCAT(oi.goods_price) as group_goods_price " +
" FROM li_order o INNER JOIN li_order_item AS oi on o.sn = oi.order_sn ${ew.customSqlSegment} ")
IPage<OrderSimpleVO> queryByParams(IPage<OrderSimpleVO> page, @Param(Constants.WRAPPER) Wrapper<OrderSimpleVO> queryWrapper);

}
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package cn.lili.modules.order.order.service;

import cn.lili.common.vo.PageVO;
import cn.lili.modules.member.entity.dto.MemberAddressDTO;
import cn.lili.modules.order.cart.entity.dto.TradeDTO;
import cn.lili.modules.order.order.entity.dos.Order;
Expand All @@ -10,13 +9,10 @@
import cn.lili.modules.order.order.entity.vo.OrderDetailVO;
import cn.lili.modules.order.order.entity.vo.OrderSimpleVO;
import cn.lili.modules.order.order.entity.vo.PaymentLog;
import cn.lili.modules.statistics.entity.dto.StatisticsQueryParam;
import cn.lili.modules.system.entity.vo.Traces;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Constants;
import com.baomidou.mybatisplus.extension.service.IService;
import org.apache.ibatis.annotations.Param;
import org.springframework.web.multipart.MultipartFile;

import javax.servlet.http.HttpServletResponse;
Expand Down Expand Up @@ -190,16 +186,6 @@ public interface OrderService extends IService<Order> {
*/
void deleteOrder(String sn);

/**
* 获取统计的订单
*
* @param statisticsQueryParam
* @param pageVO
* @return
*/
IPage<OrderSimpleVO> getStatistics(StatisticsQueryParam statisticsQueryParam, PageVO pageVO);


/**
* 开具发票
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -481,21 +481,6 @@ public void deleteOrder(String sn) {
this.orderItemService.update(orderItemLambdaUpdateWrapper);
}

@Override
public IPage<OrderSimpleVO> getStatistics(StatisticsQueryParam statisticsQueryParam, PageVO pageVO) {

QueryWrapper<OrderSimpleVO> queryWrapper = new QueryWrapper<>();
Date[] dates = StatisticsDateUtil.getDateArray(statisticsQueryParam);
queryWrapper.between("o.create_time", dates[0], dates[1]);
queryWrapper.eq(StringUtils.isNotEmpty(statisticsQueryParam.getStoreId()),
"o.store_id", statisticsQueryParam.getStoreId());

queryWrapper.eq("o.delete_flag", false);
queryWrapper.groupBy("o.id");
queryWrapper.orderByDesc("o.id");
return this.baseMapper.queryByParams(PageUtil.initPage(pageVO), queryWrapper);
}

@Override
public Boolean invoice(String sn) {
//根据订单号查询发票信息
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
package cn.lili.modules.statistics.mapper;

import cn.lili.modules.order.order.entity.dos.StoreFlow;
import cn.lili.modules.order.order.entity.vo.OrderSimpleVO;
import cn.lili.modules.statistics.entity.vo.OrderStatisticsDataVO;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Constants;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
Expand Down Expand Up @@ -35,4 +37,25 @@ public interface OrderStatisticsMapper extends BaseMapper<StoreFlow> {
@Select("SELECT count(0) FROM li_order ${ew.customSqlSegment}")
Integer count(@Param(Constants.WRAPPER) Wrapper queryWrapper);

/**
* 查询订单简短信息分页
*
* @param page 分页
* @param queryWrapper 查询条件
* @return 简短订单分页
*/
@Select("select o.sn,o.flow_price,o.create_time,o.order_status,o.pay_status,o.payment_method,o.payment_time,o.member_name,o.store_name as store_name,o.store_id as store_id,o.client_type,o.order_type,o.deliver_status " +
",GROUP_CONCAT(oi.goods_id) as group_goods_id," +
" GROUP_CONCAT(oi.sku_id) as group_sku_id," +
" GROUP_CONCAT(oi.num) as group_num" +
",GROUP_CONCAT(oi.image) as group_images" +
",GROUP_CONCAT(oi.goods_name) as group_name " +
",GROUP_CONCAT(oi.after_sale_status) as group_after_sale_status" +
",GROUP_CONCAT(oi.complain_status) as group_complain_status" +
",GROUP_CONCAT(oi.comment_status) as group_comment_status" +
",GROUP_CONCAT(oi.sn) as group_order_items_sn " +
",GROUP_CONCAT(oi.goods_price) as group_goods_price " +
" FROM li_order o INNER JOIN li_order_item AS oi on o.sn = oi.order_sn ${ew.customSqlSegment} ")
IPage<OrderSimpleVO> queryByParams(IPage<OrderSimpleVO> page, @Param(Constants.WRAPPER) Wrapper<OrderSimpleVO> queryWrapper);

}
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
package cn.lili.modules.statistics.service;

import cn.lili.common.vo.PageVO;
import cn.lili.modules.order.aftersale.entity.dos.AfterSale;
import cn.lili.modules.statistics.entity.dto.StatisticsQueryParam;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.IService;

/**
Expand All @@ -18,4 +21,13 @@ public interface AfterSaleStatisticsService extends IService<AfterSale> {
* @return 待处理售后数量
*/
Integer applyNum(String serviceType);

/**
* 获取统计的售后
*
* @param statisticsQueryParam 统计搜索参数
* @param pageVO 分页
* @return 售后分页列表
*/
IPage<AfterSale> getStatistics(StatisticsQueryParam statisticsQueryParam, PageVO pageVO);
}
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
package cn.lili.modules.statistics.service;

import cn.lili.common.vo.PageVO;
import cn.lili.modules.order.order.entity.dos.StoreFlow;
import cn.lili.modules.order.order.entity.vo.OrderSimpleVO;
import cn.lili.modules.statistics.entity.dto.StatisticsQueryParam;
import cn.lili.modules.statistics.entity.vo.OrderOverviewVO;
import cn.lili.modules.statistics.entity.vo.OrderStatisticsDataVO;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.IService;

import java.util.List;
Expand Down Expand Up @@ -56,4 +59,12 @@ public interface OrderStatisticsService extends IService<StoreFlow> {
*/
List<OrderStatisticsDataVO> statisticsChart(StatisticsQueryParam statisticsQueryParam);

/**
* 获取统计的订单
*
* @param statisticsQueryParam
* @param pageVO
* @return
*/
IPage<OrderSimpleVO> getStatistics(StatisticsQueryParam statisticsQueryParam, PageVO pageVO);
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,21 @@
import cn.lili.common.security.AuthUser;
import cn.lili.common.security.context.UserContext;
import cn.lili.common.security.enums.UserEnums;
import cn.lili.common.vo.PageVO;
import cn.lili.modules.order.aftersale.entity.dos.AfterSale;
import cn.lili.modules.order.trade.entity.enums.AfterSaleStatusEnum;
import cn.lili.modules.statistics.entity.dto.StatisticsQueryParam;
import cn.lili.modules.statistics.mapper.AfterSaleStatisticsMapper;
import cn.lili.modules.statistics.service.AfterSaleStatisticsService;
import cn.lili.modules.statistics.util.StatisticsDateUtil;
import cn.lili.mybatis.util.PageUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

import java.util.Date;
import java.util.Objects;

/**
Expand All @@ -35,4 +41,17 @@ public Integer applyNum(String serviceType) {
AfterSale::getStoreId, authUser.getStoreId());
return this.count(queryWrapper);
}


@Override
public IPage<AfterSale> getStatistics(StatisticsQueryParam statisticsQueryParam, PageVO pageVO) {

LambdaQueryWrapper<AfterSale> queryWrapper = new LambdaQueryWrapper<>();
Date[] dates = StatisticsDateUtil.getDateArray(statisticsQueryParam);
queryWrapper.between(AfterSale::getCreateTime, dates[0], dates[1]);
queryWrapper.eq(CharSequenceUtil.isNotEmpty(statisticsQueryParam.getStoreId()), AfterSale::getStoreId, statisticsQueryParam.getStoreId());

return this.page(PageUtil.initPage(pageVO), queryWrapper);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,24 @@
import cn.lili.common.utils.CurrencyUtil;
import cn.lili.common.utils.DateUtil;
import cn.lili.common.utils.StringUtils;
import cn.lili.common.vo.PageVO;
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.enums.FlowTypeEnum;
import cn.lili.modules.order.order.entity.enums.PayStatusEnum;
import cn.lili.modules.order.order.entity.vo.OrderSimpleVO;
import cn.lili.modules.order.order.service.OrderService;
import cn.lili.modules.statistics.mapper.OrderStatisticsMapper;
import cn.lili.modules.statistics.entity.dto.StatisticsQueryParam;
import cn.lili.modules.statistics.entity.vo.OrderOverviewVO;
import cn.lili.modules.statistics.entity.vo.OrderStatisticsDataVO;
import cn.lili.modules.statistics.mapper.OrderStatisticsMapper;
import cn.lili.modules.statistics.service.OrderStatisticsService;
import cn.lili.modules.statistics.service.PlatformViewService;
import cn.lili.modules.statistics.util.StatisticsDateUtil;
import cn.lili.mybatis.util.PageUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
Expand Down Expand Up @@ -268,6 +272,20 @@ public List<OrderStatisticsDataVO> statisticsChart(StatisticsQueryParam statisti
return result;
}

@Override
public IPage<OrderSimpleVO> getStatistics(StatisticsQueryParam statisticsQueryParam, PageVO pageVO) {

QueryWrapper<OrderSimpleVO> queryWrapper = new QueryWrapper<>();
Date[] dates = StatisticsDateUtil.getDateArray(statisticsQueryParam);
queryWrapper.between("o.create_time", dates[0], dates[1]);
queryWrapper.eq(StringUtils.isNotEmpty(statisticsQueryParam.getStoreId()),
"o.store_id", statisticsQueryParam.getStoreId());

queryWrapper.eq("o.delete_flag", false);
queryWrapper.groupBy("o.id");
queryWrapper.orderByDesc("o.id");
return this.baseMapper.queryByParams(PageUtil.initPage(pageVO), queryWrapper);
}
private QueryWrapper getQueryWrapper(StatisticsQueryParam statisticsQueryParam) {

QueryWrapper queryWrapper = Wrappers.query();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,10 @@
import cn.lili.common.vo.ResultMessage;
import cn.lili.modules.order.aftersale.entity.dos.AfterSale;
import cn.lili.modules.order.order.entity.vo.OrderSimpleVO;
import cn.lili.modules.order.aftersale.service.AfterSaleService;
import cn.lili.modules.order.order.service.OrderService;
import cn.lili.modules.statistics.entity.dto.StatisticsQueryParam;
import cn.lili.modules.statistics.entity.vo.OrderOverviewVO;
import cn.lili.modules.statistics.entity.vo.OrderStatisticsDataVO;
import cn.lili.modules.statistics.service.AfterSaleStatisticsService;
import cn.lili.modules.statistics.service.OrderStatisticsService;
import com.baomidou.mybatisplus.core.metadata.IPage;
import io.swagger.annotations.Api;
Expand All @@ -36,9 +35,7 @@ public class OrderStatisticsManagerController {
@Autowired
private OrderStatisticsService orderStatisticsService;
@Autowired
private OrderService orderService;
@Autowired
private AfterSaleService afterSaleService;
private AfterSaleStatisticsService afterSaleStatisticsService;

@ApiOperation(value = "订单概览统计")
@GetMapping("/overview")
Expand Down Expand Up @@ -67,7 +64,7 @@ public ResultMessage<List<OrderStatisticsDataVO>> statisticsChart(StatisticsQuer
@GetMapping("/order")
public ResultMessage<IPage<OrderSimpleVO>> order(StatisticsQueryParam statisticsQueryParam, PageVO pageVO) {
try {
return ResultUtil.data(orderService.getStatistics(statisticsQueryParam, pageVO));
return ResultUtil.data(orderStatisticsService.getStatistics(statisticsQueryParam, pageVO));
} catch (Exception e) {
log.error("订单统计",e);
}
Expand All @@ -78,6 +75,6 @@ public ResultMessage<IPage<OrderSimpleVO>> order(StatisticsQueryParam statistics
@ApiOperation(value = "退单统计")
@GetMapping("/refund")
public ResultMessage<IPage<AfterSale>> refund(StatisticsQueryParam statisticsQueryParam, PageVO pageVO) {
return ResultUtil.data(afterSaleService.getStatistics(statisticsQueryParam, pageVO));
return ResultUtil.data(afterSaleStatisticsService.getStatistics(statisticsQueryParam, pageVO));
}
}
Loading

0 comments on commit f7ab6dc

Please sign in to comment.