Merge branch 'feature/community-center' into preview

master
yang 2025-03-10 16:25:48 +08:00
commit 8cff519d1c
1 changed files with 9 additions and 8 deletions

View File

@ -189,7 +189,7 @@ public class OrderTradeServiceImpl extends ServiceImpl<OrderTradeMapper, OrderTr
todayIncome = orderTradeMapper.getTodayIncome();
// 保留小数点后两位
double doubleValue = new BigDecimal(todayIncome).setScale(2, RoundingMode.HALF_UP).doubleValue();
redisCache.setCacheObject("income:todayIncome", doubleValue, 1, TimeUnit.MINUTES);
redisCache.setCacheObject("income:todayIncome", doubleValue, 10, TimeUnit.MINUTES);
return doubleValue;
}
@ -206,7 +206,7 @@ public class OrderTradeServiceImpl extends ServiceImpl<OrderTradeMapper, OrderTr
}
monthIncome = orderTradeMapper.getMonthIncome();
double doubleValue = new BigDecimal(monthIncome).setScale(2, RoundingMode.HALF_UP).doubleValue();
redisCache.setCacheObject("income:monthIncome", doubleValue, 1, TimeUnit.MINUTES);
redisCache.setCacheObject("income:monthIncome", doubleValue, 10, TimeUnit.MINUTES);
return doubleValue;
}
@ -223,7 +223,7 @@ public class OrderTradeServiceImpl extends ServiceImpl<OrderTradeMapper, OrderTr
}
yearIncome = orderTradeMapper.getYearIncome();
double doubleValue = new BigDecimal(yearIncome).setScale(2, RoundingMode.HALF_UP).doubleValue();
redisCache.setCacheObject("income:yearIncome", doubleValue, 1, TimeUnit.MINUTES);
redisCache.setCacheObject("income:yearIncome", doubleValue, 10, TimeUnit.MINUTES);
return doubleValue;
}
@ -396,6 +396,12 @@ public class OrderTradeServiceImpl extends ServiceImpl<OrderTradeMapper, OrderTr
@Transactional(rollbackFor = Exception.class)
public void orderHandler(OrderTrade orderTrade, String suffix, Map<String, String> params) {
String buyerPayAmountStr = params.get("buyer_pay_amount");
if (buyerPayAmountStr != null && !buyerPayAmountStr.isEmpty()) {
BigDecimal buyerPayAmount = new BigDecimal(buyerPayAmountStr);
orderTrade.setPaymentAmount(buyerPayAmount.intValue());
}
// 根据订单类型进行处理
if (OrderTypeEnum.POINTS.getName().equals(suffix)) {
pointsHandler(orderTrade, params);
@ -507,11 +513,6 @@ public class OrderTradeServiceImpl extends ServiceImpl<OrderTradeMapper, OrderTr
BigDecimal totalAmount = new BigDecimal(totalAmountStr);
orderTrade.setTotalAmount(totalAmount.doubleValue());
}
String buyerPayAmountStr = params.get("buyer_pay_amount");
if (buyerPayAmountStr != null && !buyerPayAmountStr.isEmpty()) {
BigDecimal buyerPayAmount = new BigDecimal(buyerPayAmountStr);
orderTrade.setPaymentAmount(buyerPayAmount.intValue());
}
orderTrade.setUpdateTime(new Date());
orderTradeService.updateById(orderTrade);
}