Commit 5ce82a31 by 张富康

fix(rpc-dj-staff): 增加绩效计算和订单匹配的日志输出

- 在evaluatePerformanceConfigs方法中增加详细的上下文配置信息日志
- 对绩效明细列表performanceDetailDTOS进行JSON格式日志打印
- 打印筛选后的符合条件的订单编号和子订单编号
- StaffPerformanceOrderUtil中记录订单匹配函数的输入参数日志
- 引入Slf4j日志依赖并使用JSONUtil序列化对象便于调试分析
1 parent 1780a0bb
...@@ -1215,9 +1215,9 @@ public class StaffPerformanceCalService { ...@@ -1215,9 +1215,9 @@ public class StaffPerformanceCalService {
context.setAssessmentFactorDependencyData(dependencyData); context.setAssessmentFactorDependencyData(dependencyData);
List<StaffPerformanceDetailDTO> performanceDetailDTOS = thiz.evaluatePerformanceConfigs(context); List<StaffPerformanceDetailDTO> performanceDetailDTOS = thiz.evaluatePerformanceConfigs(context);
log.info("明细列表-performanceDetailDTOS:{}", JSONUtil.toJsonStr(performanceDetailDTOS));
// 保存StaffPerformanceDetailDTO // 保存StaffPerformanceDetailDTO
staffPerformanceDetailService.saveStaffPerformanceDetails(config, staffPerformanceDetailService.saveStaffPerformanceDetails(config, performanceDetailDTOS);
performanceDetailDTOS);
// 汇总计算保存StaffProductPerformance // 汇总计算保存StaffProductPerformance
staffProductPerformanceService.saveStaffProductPerformance(context, performanceDetailDTOS); staffProductPerformanceService.saveStaffProductPerformance(context, performanceDetailDTOS);
// 汇总计算保存StaffPerformance // 汇总计算保存StaffPerformance
...@@ -1265,10 +1265,10 @@ public class StaffPerformanceCalService { ...@@ -1265,10 +1265,10 @@ public class StaffPerformanceCalService {
*/ */
@Transactional(propagation = Propagation.REQUIRED, rollbackFor = RpcServiceException.class) @Transactional(propagation = Propagation.REQUIRED, rollbackFor = RpcServiceException.class)
public List<StaffPerformanceDetailDTO> evaluatePerformanceConfigs(StaffPerformanceCalContextDTO context) { public List<StaffPerformanceDetailDTO> evaluatePerformanceConfigs(StaffPerformanceCalContextDTO context) {
log.info("开始提成配置计算: staffPhone={}, month={}, merchantName={}, businessType={}, brandName={}, childBrandName={}", log.info("开始提成配置计算: staffPhone={}, month={}, merchantName={}, businessType={}, brandName={}, childBrandName={}, performanceConfig={}, assessmentFactorDependencyData={}",
context.getStaffPhone(), context.getPerformanceMonth(), context.getMerchantName(), context.getStaffPhone(), context.getPerformanceMonth(), context.getMerchantName(),
context.getBusinessType(), context.getBrandName(), context.getChildBrandName()); context.getBusinessType(), context.getBrandName(), context.getChildBrandName(),
log.info("上下文-context:{}", JSONUtil.toJsonStr(context)); JSONUtil.toJsonStr(context.getPerformanceConfig()), JSONUtil.toJsonStr(context.getAssessmentFactorDependencyData()));
// 配置按照考核因子+品类信息分组 // 配置按照考核因子+品类信息分组
List<StaffPerformanceDetailDTO> groupResults = new ArrayList<>(); List<StaffPerformanceDetailDTO> groupResults = new ArrayList<>();
Map<String, List<PerformanceParamConfigDTO>> paramConfigGroupMap = context.getPerformanceConfig() Map<String, List<PerformanceParamConfigDTO>> paramConfigGroupMap = context.getPerformanceConfig()
...@@ -1461,7 +1461,13 @@ public class StaffPerformanceCalService { ...@@ -1461,7 +1461,13 @@ public class StaffPerformanceCalService {
BigDecimal outputTotal = filteredOrders.stream() BigDecimal outputTotal = filteredOrders.stream()
.map(o -> Optional.ofNullable(o.getOutputAmount()).orElse(BigDecimal.ZERO)) .map(o -> Optional.ofNullable(o.getOutputAmount()).orElse(BigDecimal.ZERO))
.reduce(BigDecimal.ZERO, BigDecimal::add); .reduce(BigDecimal.ZERO, BigDecimal::add);
// filteredOrders 打印主订单编号和子订单编号
log.info("筛选符合条件的订单如下:");
if (CollUtil.isNotEmpty(filteredOrders)) {
for (StaffPerformanceSubOrderDTO filteredOrder : filteredOrders) {
log.info("orderCode:{},subOrderCode:{}", filteredOrder.getOrderCode(), filteredOrder.getSubOrderCode());
}
}
// 更新上下文数据 // 更新上下文数据
AssessmentFactorOrderDataDTO orderData = context.getAssessmentFactorDependencyData().getOrderData(); AssessmentFactorOrderDataDTO orderData = context.getAssessmentFactorDependencyData().getOrderData();
orderData.setMainOrderCountByBrandAndCategory(mainOrderCount); orderData.setMainOrderCountByBrandAndCategory(mainOrderCount);
......
...@@ -7,6 +7,8 @@ import cn.com.glsx.dj.staff.enums.GoodsConfigTypeEnum; ...@@ -7,6 +7,8 @@ import cn.com.glsx.dj.staff.enums.GoodsConfigTypeEnum;
import cn.com.glsx.framework.core.enums.DefaultErrorEnum; import cn.com.glsx.framework.core.enums.DefaultErrorEnum;
import cn.com.glsx.framework.core.exception.RpcServiceException; import cn.com.glsx.framework.core.exception.RpcServiceException;
import cn.com.glsx.framework.core.util.RpcAssert; import cn.com.glsx.framework.core.util.RpcAssert;
import cn.hutool.json.JSONUtil;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections.CollectionUtils; import org.apache.commons.collections.CollectionUtils;
import java.util.ArrayList; import java.util.ArrayList;
...@@ -19,6 +21,7 @@ import java.util.stream.Collectors; ...@@ -19,6 +21,7 @@ import java.util.stream.Collectors;
* 员工绩效订单匹配工具类 * 员工绩效订单匹配工具类
* 提供订单与配置的匹配逻辑 * 提供订单与配置的匹配逻辑
*/ */
@Slf4j
public class StaffPerformanceOrderUtil { public class StaffPerformanceOrderUtil {
/** /**
...@@ -143,6 +146,9 @@ public class StaffPerformanceOrderUtil { ...@@ -143,6 +146,9 @@ public class StaffPerformanceOrderUtil {
Integer thirdLevelGoodsType, Integer thirdLevelGoodsType,
MerchantPerformanceProductDefineDTO productDefine) { MerchantPerformanceProductDefineDTO productDefine) {
RpcAssert.assertNotNull(goodsConfigType, DefaultErrorEnum.DATA_NULL, "goodsConfigType不能为空"); RpcAssert.assertNotNull(goodsConfigType, DefaultErrorEnum.DATA_NULL, "goodsConfigType不能为空");
// 打印入参
log.info("判断单个订单是否匹配各类条件-goodsConfigType:{},goodsType:{},secondaryGoodsType:{},thirdLevelGoodsType:{},productDefine:{}",
goodsConfigType, goodsType, secondaryGoodsType, thirdLevelGoodsType, JSONUtil.toJsonStr(productDefine));
// TODO 改用枚举 // TODO 改用枚举
// -1:全部商品 // -1:全部商品
if (Objects.equals(GoodsConfigTypeEnum.ALL_PRODUCT.getCode(), goodsConfigType)) { if (Objects.equals(GoodsConfigTypeEnum.ALL_PRODUCT.getCode(), goodsConfigType)) {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!