code review:订单统计

This commit is contained in:
zhijiantianya@gmail.com 2023-10-17 20:42:22 +08:00
parent 0dcab0363d
commit 4b0333f3e9
8 changed files with 13 additions and 10 deletions

View File

@ -88,6 +88,8 @@ public class ServletUtils {
return ServletUtil.getClientIP(request);
}
// TODO @疯狂terminal 还是从 ServletUtils 里拿更容易全局治理
public static boolean isJsonRequest(ServletRequest request) {
return StrUtil.startWithIgnoreCase(request.getContentType(), MediaType.APPLICATION_JSON_VALUE);
}

View File

@ -108,6 +108,7 @@ public class TradeStatisticsController {
// 订单统计
Long undeliveredCount = tradeOrderStatisticsService.getCountByStatusAndDeliveryType(
TradeOrderStatusEnum.UNDELIVERED.getStatus(), DeliveryTypeEnum.EXPRESS.getType());
// TODO @疯狂订单支付后如果是门店自提的需要 update DELIVERED目前还没搞~~突然反应过来
Long pickUpCount = tradeOrderStatisticsService.getCountByStatusAndDeliveryType(
TradeOrderStatusEnum.DELIVERED.getStatus(), DeliveryTypeEnum.PICK_UP.getType());
// 售后统计

View File

@ -2,6 +2,7 @@ package cn.iocoder.yudao.module.statistics.job.trade;
import cn.hutool.core.convert.Convert;
import cn.hutool.core.util.NumberUtil;
import cn.hutool.core.util.ObjUtil;
import cn.hutool.core.util.StrUtil;
import cn.iocoder.yudao.framework.quartz.core.handler.JobHandler;
import cn.iocoder.yudao.framework.tenant.core.job.TenantJob;
@ -10,6 +11,7 @@ import org.springframework.stereotype.Component;
import javax.annotation.Resource;
// TODO 芋艿缺个 Job 的配置等和 Product 一起配置
/**
* 交易统计 Job
*
@ -31,9 +33,9 @@ public class TradeStatisticsJob implements JobHandler {
@TenantJob
public String execute(String param) {
// 默认昨日
if (StrUtil.isBlank(param)) {
param = "1";
} else if (!NumberUtil.isInteger(param)) {
param = ObjUtil.defaultIfBlank(param, "1");
// 校验参数的合理性
if (!NumberUtil.isInteger(param)) {
throw new RuntimeException("交易统计任务的参数只能为是正整数");
}
Integer days = Convert.toInt(param, 0);

View File

@ -129,7 +129,6 @@ public class TradeStatisticsServiceImpl implements TradeStatisticsService {
entity = TradeStatisticsConvert.INSTANCE.convert(date, orderSummary, afterSaleSummary, brokerageSettlementPrice,
walletSummary);
tradeStatisticsMapper.insert(entity);
// TODO @疯狂这里是不是也要把日期带上类似 108 那边; 110 已经带上了
return stopWatch.prettyPrint();
}

View File

@ -21,7 +21,6 @@ public enum TradeOrderOperateTypeEnum {
MEMBER_RECEIVE(30, "用户已收货"),
SYSTEM_RECEIVE(31, "到期未收货,系统自动确认收货"),
ADMIN_PICK_UP_RECEIVE(32, "管理员自提收货"),
MEMBER_PICK_UP_RECEIVE(32, "用户自提收货"),
MEMBER_COMMENT(33, "用户评价"),
SYSTEM_COMMENT(34, "到期未评价,系统自动评价"),
MEMBER_CANCEL(40, "取消订单"),

View File

@ -131,7 +131,7 @@ public class TradeOrderController {
@Parameter(name = "id", description = "交易订单编号")
@PreAuthorize("@ss.hasPermission('trade:order:pick-up')")
public CommonResult<Boolean> pickUpOrderById(@RequestParam("id") Long id) {
tradeOrderUpdateService.pickUpOrderByMember(id);
tradeOrderUpdateService.pickUpOrderByAdmin(id);
return success(true);
}

View File

@ -122,7 +122,7 @@ public interface TradeOrderUpdateService {
*
* @param id 订单编号
*/
void pickUpOrderByMember(Long id);
void pickUpOrderByAdmin(Long id);
/**
* 管理员核销订单

View File

@ -669,8 +669,8 @@ public class TradeOrderUpdateServiceImpl implements TradeOrderUpdateService {
}
@Override
@TradeOrderLog(operateType = TradeOrderOperateTypeEnum.MEMBER_PICK_UP_RECEIVE)
public void pickUpOrderByMember(Long id) {
@TradeOrderLog(operateType = TradeOrderOperateTypeEnum.ADMIN_PICK_UP_RECEIVE)
public void pickUpOrderByAdmin(Long id) {
getSelf().pickUpOrder(tradeOrderMapper.selectById(id));
}