Merge remote-tracking branch 'origin/test' into test

This commit is contained in:
张松
2025-12-04 09:50:36 +08:00
11 changed files with 27 additions and 21 deletions

View File

@@ -82,10 +82,10 @@ public class ChatCouponServiceImpl extends ServiceImpl<ChatCouponMapper, ChatCou
* 失效
*/
@Override
public void expiredChatCoupon(Long shopId, Long id) {
public boolean expiredChatCoupon(Long shopId, Long id) {
ChatCoupon coupon = new ChatCoupon();
coupon.setStatus(3);
update(coupon, QueryWrapper.create()
return update(coupon, QueryWrapper.create()
.eq(ChatCoupon::getId, id)
.eq(ChatCoupon::getShopId, shopId)
);

View File

@@ -519,11 +519,10 @@ public class MkShopCouponRecordServiceImpl extends ServiceImpl<MkShopCouponRecor
public MkShopCouponRecord assembleRecord(Long chatCouponId, ShopCoupon coupon) {
MkShopCouponRecord record = new MkShopCouponRecord();
record.setShopId(coupon.getShopId());
record.setCouponName(coupon.getTitle());
record.setCouponId(coupon.getId());
record.setCouponSyncId(coupon.getSyncId());
record.setSourceId(chatCouponId);
record.setSource("群聊发放");
record.setStatus(0);
record.setType(coupon.getCouponType());

View File

@@ -339,11 +339,10 @@ public class ShopCouponServiceImpl extends ServiceImpl<ShopCouponMapper, ShopCou
@Override
@Async
public Boolean use(List<Long> ids, Long shopUserId, Long orderId) {
public void use(List<Long> ids, Long shopUserId, Long orderId) {
List<MkShopCouponRecord> records = recordService.listByIds(ids);
if (records.isEmpty()) {
log.error("优惠券使用失败订单Id:{}", orderId);
return false;
}
Map<Long, Long> chatCouponIdCountMap = records.stream()
.filter(record -> "群聊发放".equals(record.getSource()))
@@ -389,7 +388,7 @@ public class ShopCouponServiceImpl extends ServiceImpl<ShopCouponMapper, ShopCou
}
update(coupon1, recordQueryWrapper);
});
return recordService.updateChain()
recordService.updateChain()
.set(MkShopCouponRecord::getStatus, 1)
.set(MkShopCouponRecord::getTargetId, orderId)
.set(MkShopCouponRecord::getUseTime, LocalDateTime.now())

View File

@@ -500,9 +500,9 @@ public class OrderInfoCustomServiceImpl implements OrderInfoCustomService {
if (param.getVipDiscountAmount().compareTo(BigDecimal.ZERO) <= 0) {
param.setVipDiscountAmount(BigDecimal.ZERO);
} else {
BigDecimal discount = BigDecimal.valueOf(100).subtract(BigDecimal.valueOf(shopUser.getDiscount())).divide(BigDecimal.valueOf(100), 2, RoundingMode.HALF_UP);
BigDecimal discount = BigDecimal.valueOf(100).subtract(BigDecimal.valueOf(shopUser.getDiscount())).divide(BigDecimal.valueOf(100), 2, RoundingMode.DOWN);
BigDecimal discountAmount = newTotalAmount.multiply(discount);
discountAmount = discountAmount.setScale(2, RoundingMode.HALF_DOWN);
discountAmount = discountAmount.setScale(2, RoundingMode.DOWN);
if (discountAmount.compareTo(param.getVipDiscountAmount()) != 0) {
log.info("会员整单折扣金额不正确:传递为:{},计算为:{}", param.getVipDiscountAmount(), discountAmount);
throw new OrderValidateException("生成支付订单失败,会员整单折扣金额不正确");

View File

@@ -96,7 +96,7 @@
sum(statistic.refund_amount) AS refundAmount
FROM
tb_shop_prod_statistic statistic
INNER JOIN tb_product prod ON tb_shop_prod_statistic.prod_id = prod.id
INNER JOIN tb_product prod ON statistic.prod_id = prod.id
WHERE
statistic.shop_id = #{shopId}
AND statistic.create_day = #{day}