订单统计接口
This commit is contained in:
@@ -2,6 +2,7 @@ package com.czg.service.market.mapper;
|
||||
|
||||
import com.czg.market.vo.PpOrderListVO;
|
||||
import com.czg.order.dto.GbOrderQueryParam;
|
||||
import com.czg.order.vo.GbOrderCountVO;
|
||||
import com.mybatisflex.core.BaseMapper;
|
||||
import com.czg.market.entity.PpPackageOrder;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
@@ -19,4 +20,6 @@ public interface PpPackageOrderMapper extends BaseMapper<PpPackageOrder> {
|
||||
List<PpOrderListVO> getOrderList(@Param("shopId") Long shopId,
|
||||
@Param("userId") Long userId,
|
||||
@Param("param") GbOrderQueryParam param);
|
||||
|
||||
GbOrderCountVO getOrderCount(@Param("shopId") Long shopId, @Param("param") GbOrderQueryParam param);
|
||||
}
|
||||
|
||||
@@ -17,6 +17,7 @@ import com.czg.market.service.PpPackageService;
|
||||
import com.czg.market.vo.PpOrderListVO;
|
||||
import com.czg.market.vo.PpPackageVO;
|
||||
import com.czg.order.dto.GbOrderQueryParam;
|
||||
import com.czg.order.vo.GbOrderCountVO;
|
||||
import com.czg.sa.StpKit;
|
||||
import com.czg.service.market.mapper.PpPackageOrderMapper;
|
||||
import com.czg.utils.CzgRandomUtils;
|
||||
@@ -147,6 +148,11 @@ public class PpPackageOrderServiceImpl extends ServiceImpl<PpPackageOrderMapper,
|
||||
return PageUtil.convert(new PageInfo<>(result));
|
||||
}
|
||||
|
||||
@Override
|
||||
public GbOrderCountVO orderCount(Long shopId, GbOrderQueryParam param) {
|
||||
return mapper.getOrderCount(shopId, param);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public boolean cancelOrder(Long orderId) {
|
||||
@@ -242,6 +248,10 @@ public class PpPackageOrderServiceImpl extends ServiceImpl<PpPackageOrderMapper,
|
||||
updateById(order);
|
||||
|
||||
ppHelpRecordService.removeHelpRecord(orderId);
|
||||
|
||||
PpPackage ppPackage = ppPackageService.getById(order.getPackageId());
|
||||
ppPackage.setSaleNum(ppPackage.getSaleNum() + 1);
|
||||
ppPackageService.updateById(ppPackage);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -213,6 +213,7 @@ public class PpPackageServiceImpl extends ServiceImpl<PpPackageMapper, PpPackage
|
||||
packageVO.setOnlineStatus(ppPackage.getOnlineStatus());
|
||||
packageVO.setCreateTime(ppPackage.getCreateTime());
|
||||
packageVO.setUpdateTime(ppPackage.getUpdateTime());
|
||||
packageVO.setSaleNum(ppPackage.getSaleNum());
|
||||
|
||||
packageVO.setUseWeeks(JSONArray.parseArray(ppPackage.getUseWeeks(), String.class));
|
||||
packageVO.setPackageContent(JSONArray.parseArray(ppPackage.getPackageContent(), PpPackageVO.PackageContent.class));
|
||||
|
||||
@@ -38,4 +38,29 @@
|
||||
order by o.create_time desc
|
||||
</select>
|
||||
|
||||
<select id="getOrderCount" resultType="com.czg.order.vo.GbOrderCountVO">
|
||||
SELECT
|
||||
COUNT(*) AS countNum,
|
||||
COALESCE(SUM(IF(pay_time IS NOT NULL, IFNULL(final_price, 0), 0)), 0) AS paidAmountTotal,
|
||||
COALESCE(SUM(IF(status IN ('refunding', 'refund'), IFNULL(o.final_price, 0), 0)), 0) AS refundAmount
|
||||
from pp_package_order o
|
||||
left join pp_package p on o.package_id = p.id
|
||||
where o.shop_id = #{shopId}
|
||||
<if test="param.orderNo != null">
|
||||
and o.order_no = #{param.orderNo}
|
||||
</if>
|
||||
<if test="param.status != null">
|
||||
and o.status = #{param.status}
|
||||
</if>
|
||||
<if test="param.orderStartTime != null and param.orderEndTime != null ">
|
||||
and o.pay_time BETWEEN #{param.orderStartTime} and #{param.orderEndTime}
|
||||
</if>
|
||||
<if test="param.verifyStartTime != null and param.verifyEndTime != null ">
|
||||
and o.verify_time BETWEEN #{param.verifyStartTime} and #{param.verifyEndTime}
|
||||
</if>
|
||||
<if test="param.name != null">
|
||||
and p.package_name like concat('%', #{param.name}, '%')
|
||||
</if>
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
|
||||
Reference in New Issue
Block a user