Merge remote-tracking branch 'origin/test' into test
This commit is contained in:
@@ -18,7 +18,7 @@
|
||||
<file>logs/market/logback.log</file>
|
||||
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
|
||||
<!--生成日志文件名称-->
|
||||
<fileNamePattern>logs/product/history/%d{yyyy-MM-dd}/logback.%i.log.gz</fileNamePattern>
|
||||
<fileNamePattern>logs/market/history/%d{yyyy-MM-dd}/logback.%i.log.gz</fileNamePattern>
|
||||
<!--日志文件保留天数-->
|
||||
<MaxHistory>30</MaxHistory>
|
||||
<maxFileSize>20MB</maxFileSize>
|
||||
|
||||
@@ -67,6 +67,10 @@ public class OrderDetail implements Serializable {
|
||||
* 最终单价
|
||||
*/
|
||||
private BigDecimal unitPrice;
|
||||
/**
|
||||
* 是否赠送 0否 1是
|
||||
*/
|
||||
private Integer isGift;
|
||||
|
||||
/**
|
||||
* 折扣金额(商品优惠券抵扣金额)
|
||||
@@ -195,19 +199,6 @@ public class OrderDetail implements Serializable {
|
||||
*/
|
||||
private LocalDateTime foodServeTime;
|
||||
|
||||
/**
|
||||
* 是否赠送 0否 1是
|
||||
*/
|
||||
@Column(ignore = true)
|
||||
private Integer isGift = 0;
|
||||
|
||||
|
||||
public void initGift() {
|
||||
if (price.compareTo(BigDecimal.ZERO) == 0) {
|
||||
isGift = 1;
|
||||
}
|
||||
}
|
||||
|
||||
public BigDecimal getRefundNum() {
|
||||
return refundNum == null ? BigDecimal.ZERO : refundNum;
|
||||
}
|
||||
|
||||
@@ -113,14 +113,12 @@ public class MkConsumeCashbackServiceImpl extends ServiceImpl<MkConsumeCashbackM
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void cashback(Long shopId, Long userId, BigDecimal amount, Long orderId, String orderNo) {
|
||||
AssertUtil.isTrue(amount == null || amount.compareTo(BigDecimal.ZERO) == 0, "金额必须大于0");
|
||||
log.info("消费返现1, shopId: {}, userId: {}, amount: {}, orderId: {}, orderNo: {}", shopId, userId, amount, orderId, orderNo);
|
||||
Long mainShopId = shopInfoService.getMainIdByShopId(shopId);
|
||||
MkConsumeCashbackVO config = detail(mainShopId);
|
||||
if (config.getIsEnable() == 0) {
|
||||
log.info("消费返现未开启, {}", shopId);
|
||||
return;
|
||||
}
|
||||
log.info("消费返现2, orderId: {}, orderNo: {}, config: {}", orderId, orderNo, config);
|
||||
ShopUser shopUser = shopUserService.getOne(new QueryWrapper().eq(ShopUser::getMainShopId, mainShopId).eq(ShopUser::getUserId, userId));
|
||||
if (StrUtil.isNotBlank(config.getApplicableUser()) && !"all".equals(config.getApplicableUser())) {
|
||||
if ("new".equals(config.getApplicableUser())) {
|
||||
@@ -134,12 +132,10 @@ public class MkConsumeCashbackServiceImpl extends ServiceImpl<MkConsumeCashbackM
|
||||
}
|
||||
}
|
||||
List<MkConsumeCashbackStep> cashbackStepList = config.getCashbackStepList();
|
||||
log.info("消费返现2, orderId: {}, cashbackStepList:{}", orderId, cashbackStepList);
|
||||
if (CollUtil.isNotEmpty(cashbackStepList)) {
|
||||
|
||||
config.setCashbackStepList(cashbackStepList.stream().sorted(Comparator.comparing(MkConsumeCashbackStep::getAmount).reversed()).collect(Collectors.toList()));
|
||||
for (MkConsumeCashbackStep cashbackStep : config.getCashbackStepList()) {
|
||||
log.info("消费返现3, cashbackStep: {}, userId: {}, amount: {}, orderId: {}", cashbackStep, userId, amount, orderId);
|
||||
if (cashbackStep.getAmount().compareTo(amount) <= 0) {
|
||||
BigDecimal cashbackAmount;
|
||||
// 固定金额
|
||||
@@ -159,17 +155,10 @@ public class MkConsumeCashbackServiceImpl extends ServiceImpl<MkConsumeCashbackM
|
||||
shopUserService.updateMoney(new ShopUserMoneyEditDTO().setId(shopUser.getId()).setType(1)
|
||||
.setRelationId(mkConsumeCashbackRecord.getId()).setMoney(cashbackAmount).setBizEnum(ShopUserFlowBizEnum.CASHBACK)
|
||||
.setRemark(StrUtil.format("订单消费: {}, 返现: {}", amount, cashbackAmount)));
|
||||
log.info("店铺用户id: {}, 消费返现: {}, 返现: {}", shopUser.getId(), amount, cashbackAmount);
|
||||
log.info("订单返现 订单ID:{}, 店铺用户id: {}, 订单消费: {}, 返现: {}",orderId, shopUser.getId(), amount, cashbackAmount);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
long count = 15L;
|
||||
if (count > 0) {
|
||||
System.out.println(1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -203,7 +203,6 @@ public class OrderInfoCustomServiceImpl implements OrderInfoCustomService {
|
||||
if ("Array".equals(orderDetail.getProGroupInfo())) {
|
||||
orderDetail.setProGroupInfo("");
|
||||
}
|
||||
orderDetail.initGift();
|
||||
// 获取当前订单详情的 placeNum
|
||||
Integer placeNum = orderDetail.getPlaceNum();
|
||||
// 检查 Map 中是否已经存在该 placeNum 对应的列表
|
||||
@@ -250,7 +249,6 @@ public class OrderInfoCustomServiceImpl implements OrderInfoCustomService {
|
||||
Map<String, List<OrderDetail>> resultMap = new HashMap<>();
|
||||
// 遍历订单详情列表
|
||||
for (OrderDetail orderDetail : orderDetails) {
|
||||
orderDetail.initGift();
|
||||
// 获取当前订单详情的 placeNum
|
||||
Integer placeNum = orderDetail.getPlaceNum();
|
||||
// 检查 Map 中是否已经存在该 placeNum 对应的列表
|
||||
@@ -926,7 +924,9 @@ public class OrderInfoCustomServiceImpl implements OrderInfoCustomService {
|
||||
public void getOrderAmount(List<OrderDetail> orderDetails, BigDecimalDTO totalAmount, BigDecimalDTO packAmount,
|
||||
BigDecimalDTO tempAmount, LimitRateDTO limitRate, boolean isAllPack, Integer userAllPack, boolean isVipPrice) {
|
||||
for (OrderDetail orderDetail : orderDetails) {
|
||||
if (orderDetail.getDiscountSaleAmount() != null && orderDetail.getDiscountSaleAmount().compareTo(BigDecimal.ZERO) > 0) {
|
||||
if (orderDetail.getIsGift() == 1) {
|
||||
orderDetail.setUnitPrice(BigDecimal.ZERO);
|
||||
} else if (orderDetail.getDiscountSaleAmount() != null && orderDetail.getDiscountSaleAmount().compareTo(BigDecimal.ZERO) > 0) {
|
||||
orderDetail.setUnitPrice(orderDetail.getDiscountSaleAmount());
|
||||
} else {
|
||||
if (orderDetail.getIsTimeDiscount() == 1) {
|
||||
@@ -1278,7 +1278,6 @@ public class OrderInfoCustomServiceImpl implements OrderInfoCustomService {
|
||||
log.error("订单{}消费赠券失败", orderInfo.getId(), e);
|
||||
}
|
||||
}
|
||||
log.info("消费返现 start, orderId: {}, payType1: {} ,payType2: {}", orderInfo.getId(), orderInfo.getPayType(), payType);
|
||||
String[] payTypes = {PayEnums.VIP_PAY.getValue(), PayEnums.CREDIT_PAY.getValue()};
|
||||
if ((orderInfo.getPayType() != null && !ArrayUtil.contains(payTypes, orderInfo.getPayType()))
|
||||
|| (payType != null && !ArrayUtil.contains(payTypes, payType))) {
|
||||
|
||||
@@ -3,7 +3,6 @@ package com.czg.service.order.service.impl;
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.bean.copier.CopyOptions;
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import com.czg.exception.CzgException;
|
||||
import com.czg.order.entity.ShopOrderStatistic;
|
||||
import com.czg.order.service.ShopOrderStatisticService;
|
||||
@@ -19,7 +18,10 @@ import org.springframework.stereotype.Service;
|
||||
import java.math.BigDecimal;
|
||||
import java.math.RoundingMode;
|
||||
import java.time.LocalDate;
|
||||
import java.util.*;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.Optional;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
|
||||
@@ -124,15 +126,12 @@ public class ShopOrderStatisticServiceImpl extends ServiceImpl<ShopOrderStatisti
|
||||
CopyOptions copyOptions = CopyOptions.create().setIgnoreNullValue(true);
|
||||
if (onlineStat != null) {
|
||||
BeanUtil.copyProperties(onlineStat, result, copyOptions);
|
||||
log.info("合并onlineStat后 result:{}", JSONObject.toJSONString(result));
|
||||
}
|
||||
if (orderStat != null) {
|
||||
BeanUtil.copyProperties(orderStat, result, copyOptions);
|
||||
log.info("合并orderStat后 result:{}", JSONObject.toJSONString(result));
|
||||
}
|
||||
if (userFlowStat != null) {
|
||||
BeanUtil.copyProperties(userFlowStat, result, copyOptions);
|
||||
log.info("合并userFlowStat后 result:{}", JSONObject.toJSONString(result));
|
||||
}
|
||||
|
||||
result.setShopId(shopId);
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
cart.is_temporary as isTemporary,
|
||||
cart.discount_sale_note as discountSaleNote,
|
||||
cart.is_print as isPrint,
|
||||
cart.is_gift as isGift,
|
||||
cart.is_wait_call as isWaitCall,
|
||||
cart.pro_group_info as proGroupInfo,
|
||||
cart.remark as remark,
|
||||
|
||||
Reference in New Issue
Block a user