Merge remote-tracking branch 'origin/test' into test
This commit is contained in:
@@ -43,11 +43,11 @@ public class AChatCouponController {
|
|||||||
*/
|
*/
|
||||||
@GetMapping("/page")
|
@GetMapping("/page")
|
||||||
@SaAdminCheckPermission(value = "chat:coupon:page", name = "群聊优惠券活动-分页查询")
|
@SaAdminCheckPermission(value = "chat:coupon:page", name = "群聊优惠券活动-分页查询")
|
||||||
public Page<ChatCouponVO> pageChatCoupon(@RequestParam(required = false, defaultValue = "1") Integer page,
|
public CzgResult<Page<ChatCouponVO>> pageChatCoupon(@RequestParam(required = false, defaultValue = "1") Integer page,
|
||||||
@RequestParam(required = false, defaultValue = "10") Integer size,
|
@RequestParam(required = false, defaultValue = "10") Integer size,
|
||||||
@RequestParam(required = false) Integer status) {
|
@RequestParam(required = false) Integer status) {
|
||||||
Long shopId = StpKit.USER.getShopId();
|
Long shopId = StpKit.USER.getShopId();
|
||||||
return chatCouponService.pageChatCoupon(shopId, page, size, status);
|
return CzgResult.success(chatCouponService.pageChatCoupon(shopId, page, size, status));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -55,10 +55,9 @@ public class AChatCouponController {
|
|||||||
*/
|
*/
|
||||||
@DeleteMapping("/expired/{id}")
|
@DeleteMapping("/expired/{id}")
|
||||||
@SaAdminCheckPermission(value = "chat:coupon:expired", name = "群聊优惠券活动-失效")
|
@SaAdminCheckPermission(value = "chat:coupon:expired", name = "群聊优惠券活动-失效")
|
||||||
public CzgResult<Void> expiredChatCoupon(@PathVariable Long id) {
|
public CzgResult<Boolean> expiredChatCoupon(@PathVariable Long id) {
|
||||||
Long shopId = StpKit.USER.getShopId();
|
Long shopId = StpKit.USER.getShopId();
|
||||||
chatCouponService.expiredChatCoupon(shopId, id);
|
return CzgResult.success(chatCouponService.expiredChatCoupon(shopId, id));
|
||||||
return CzgResult.success();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -66,11 +65,11 @@ public class AChatCouponController {
|
|||||||
*/
|
*/
|
||||||
@GetMapping("/record")
|
@GetMapping("/record")
|
||||||
@SaAdminCheckPermission(value = "chat:coupon:record", name = "群聊优惠券活动-发放记录")
|
@SaAdminCheckPermission(value = "chat:coupon:record", name = "群聊优惠券活动-发放记录")
|
||||||
public Page<MkShopCouponRecord> grantChatCouponRecord(@RequestParam Long id,
|
public CzgResult<Page<MkShopCouponRecord>> grantChatCouponRecord(@RequestParam Long id,
|
||||||
@RequestParam(required = false) Integer status,
|
@RequestParam(required = false) Integer status,
|
||||||
@RequestParam(required = false, defaultValue = "1") Integer page,
|
@RequestParam(required = false, defaultValue = "1") Integer page,
|
||||||
@RequestParam(required = false, defaultValue = "10") Integer size) {
|
@RequestParam(required = false, defaultValue = "10") Integer size) {
|
||||||
return chatCouponService.grantChatCouponRecord(id, status, page, size);
|
return CzgResult.success(chatCouponService.grantChatCouponRecord(id, status, page, size));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -23,8 +23,8 @@ public class UChatCouponController {
|
|||||||
* 群聊优惠券活动-发放优惠券
|
* 群聊优惠券活动-发放优惠券
|
||||||
*/
|
*/
|
||||||
@PostMapping("/grant")
|
@PostMapping("/grant")
|
||||||
public CzgResult<Void> grantChatCoupon(@RequestBody ChatCouponGrantDTO chatCouponGrant) {
|
public CzgResult<Boolean> grantChatCoupon(@RequestBody ChatCouponGrantDTO chatCouponGrant) {
|
||||||
chatCouponService.grantChatCoupon(chatCouponGrant.getId(), chatCouponGrant.getShopUserId(), chatCouponGrant.getUserId());
|
chatCouponService.grantChatCoupon(chatCouponGrant.getId(), chatCouponGrant.getShopUserId(), chatCouponGrant.getUserId());
|
||||||
return CzgResult.success();
|
return CzgResult.success(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -122,6 +122,9 @@ public class MkShopCouponRecord implements Serializable {
|
|||||||
private LocalDateTime useEndTime;
|
private LocalDateTime useEndTime;
|
||||||
@JSONField(format = "yyyy-MM-dd HH:mm:ss")
|
@JSONField(format = "yyyy-MM-dd HH:mm:ss")
|
||||||
private LocalDateTime useStartTime;
|
private LocalDateTime useStartTime;
|
||||||
|
|
||||||
|
@Column(ignore = true)
|
||||||
|
private String couponName;
|
||||||
/**
|
/**
|
||||||
* 有效期类型:fixed(固定时间),custom(自定义时间)
|
* 有效期类型:fixed(固定时间),custom(自定义时间)
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ public interface ChatCouponService extends IService<ChatCoupon> {
|
|||||||
/**
|
/**
|
||||||
* 失效
|
* 失效
|
||||||
*/
|
*/
|
||||||
void expiredChatCoupon(Long shopId, Long id);
|
boolean expiredChatCoupon(Long shopId, Long id);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 发放优惠券
|
* 发放优惠券
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ public interface ShopCouponService extends IService<ShopCoupon> {
|
|||||||
|
|
||||||
List<UserCouponVo> findCoupon(Long shopId, Long shopUserId, Integer type, Integer isFood);
|
List<UserCouponVo> findCoupon(Long shopId, Long shopUserId, Integer type, Integer isFood);
|
||||||
|
|
||||||
Boolean use(List<Long> ids, Long shopUserId, Long orderId);
|
void use(List<Long> ids, Long shopUserId, Long orderId);
|
||||||
|
|
||||||
Boolean refund(Long orderId, Long shopUserId);
|
Boolean refund(Long orderId, Long shopUserId);
|
||||||
|
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ import lombok.NoArgsConstructor;
|
|||||||
import java.io.Serial;
|
import java.io.Serial;
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 订单详情 实体类。
|
* 订单详情 实体类。
|
||||||
@@ -35,6 +36,11 @@ public class OrderDetailSmallVO implements Serializable {
|
|||||||
private BigDecimal unitPrice;
|
private BigDecimal unitPrice;
|
||||||
private BigDecimal payAmount;
|
private BigDecimal payAmount;
|
||||||
private String remark;
|
private String remark;
|
||||||
|
private String subStatus;
|
||||||
|
private LocalDateTime orderTime;
|
||||||
|
private LocalDateTime startOrderTime;
|
||||||
|
private LocalDateTime dishOutTime;
|
||||||
|
private LocalDateTime foodServeTime;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -82,10 +82,10 @@ public class ChatCouponServiceImpl extends ServiceImpl<ChatCouponMapper, ChatCou
|
|||||||
* 失效
|
* 失效
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void expiredChatCoupon(Long shopId, Long id) {
|
public boolean expiredChatCoupon(Long shopId, Long id) {
|
||||||
ChatCoupon coupon = new ChatCoupon();
|
ChatCoupon coupon = new ChatCoupon();
|
||||||
coupon.setStatus(3);
|
coupon.setStatus(3);
|
||||||
update(coupon, QueryWrapper.create()
|
return update(coupon, QueryWrapper.create()
|
||||||
.eq(ChatCoupon::getId, id)
|
.eq(ChatCoupon::getId, id)
|
||||||
.eq(ChatCoupon::getShopId, shopId)
|
.eq(ChatCoupon::getShopId, shopId)
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -519,11 +519,10 @@ public class MkShopCouponRecordServiceImpl extends ServiceImpl<MkShopCouponRecor
|
|||||||
public MkShopCouponRecord assembleRecord(Long chatCouponId, ShopCoupon coupon) {
|
public MkShopCouponRecord assembleRecord(Long chatCouponId, ShopCoupon coupon) {
|
||||||
MkShopCouponRecord record = new MkShopCouponRecord();
|
MkShopCouponRecord record = new MkShopCouponRecord();
|
||||||
record.setShopId(coupon.getShopId());
|
record.setShopId(coupon.getShopId());
|
||||||
|
record.setCouponName(coupon.getTitle());
|
||||||
record.setCouponId(coupon.getId());
|
record.setCouponId(coupon.getId());
|
||||||
record.setCouponSyncId(coupon.getSyncId());
|
record.setCouponSyncId(coupon.getSyncId());
|
||||||
record.setSourceId(chatCouponId);
|
record.setSourceId(chatCouponId);
|
||||||
|
|
||||||
record.setSource("群聊发放");
|
record.setSource("群聊发放");
|
||||||
record.setStatus(0);
|
record.setStatus(0);
|
||||||
record.setType(coupon.getCouponType());
|
record.setType(coupon.getCouponType());
|
||||||
|
|||||||
@@ -339,11 +339,10 @@ public class ShopCouponServiceImpl extends ServiceImpl<ShopCouponMapper, ShopCou
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Async
|
@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);
|
List<MkShopCouponRecord> records = recordService.listByIds(ids);
|
||||||
if (records.isEmpty()) {
|
if (records.isEmpty()) {
|
||||||
log.error("优惠券使用失败,订单Id:{}", orderId);
|
log.error("优惠券使用失败,订单Id:{}", orderId);
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
Map<Long, Long> chatCouponIdCountMap = records.stream()
|
Map<Long, Long> chatCouponIdCountMap = records.stream()
|
||||||
.filter(record -> "群聊发放".equals(record.getSource()))
|
.filter(record -> "群聊发放".equals(record.getSource()))
|
||||||
@@ -389,7 +388,7 @@ public class ShopCouponServiceImpl extends ServiceImpl<ShopCouponMapper, ShopCou
|
|||||||
}
|
}
|
||||||
update(coupon1, recordQueryWrapper);
|
update(coupon1, recordQueryWrapper);
|
||||||
});
|
});
|
||||||
return recordService.updateChain()
|
recordService.updateChain()
|
||||||
.set(MkShopCouponRecord::getStatus, 1)
|
.set(MkShopCouponRecord::getStatus, 1)
|
||||||
.set(MkShopCouponRecord::getTargetId, orderId)
|
.set(MkShopCouponRecord::getTargetId, orderId)
|
||||||
.set(MkShopCouponRecord::getUseTime, LocalDateTime.now())
|
.set(MkShopCouponRecord::getUseTime, LocalDateTime.now())
|
||||||
|
|||||||
@@ -500,9 +500,9 @@ public class OrderInfoCustomServiceImpl implements OrderInfoCustomService {
|
|||||||
if (param.getVipDiscountAmount().compareTo(BigDecimal.ZERO) <= 0) {
|
if (param.getVipDiscountAmount().compareTo(BigDecimal.ZERO) <= 0) {
|
||||||
param.setVipDiscountAmount(BigDecimal.ZERO);
|
param.setVipDiscountAmount(BigDecimal.ZERO);
|
||||||
} else {
|
} 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);
|
BigDecimal discountAmount = newTotalAmount.multiply(discount);
|
||||||
discountAmount = discountAmount.setScale(2, RoundingMode.HALF_DOWN);
|
discountAmount = discountAmount.setScale(2, RoundingMode.DOWN);
|
||||||
if (discountAmount.compareTo(param.getVipDiscountAmount()) != 0) {
|
if (discountAmount.compareTo(param.getVipDiscountAmount()) != 0) {
|
||||||
log.info("会员整单折扣金额不正确:传递为:{},计算为:{}", param.getVipDiscountAmount(), discountAmount);
|
log.info("会员整单折扣金额不正确:传递为:{},计算为:{}", param.getVipDiscountAmount(), discountAmount);
|
||||||
throw new OrderValidateException("生成支付订单失败,会员整单折扣金额不正确");
|
throw new OrderValidateException("生成支付订单失败,会员整单折扣金额不正确");
|
||||||
|
|||||||
@@ -96,7 +96,7 @@
|
|||||||
sum(statistic.refund_amount) AS refundAmount
|
sum(statistic.refund_amount) AS refundAmount
|
||||||
FROM
|
FROM
|
||||||
tb_shop_prod_statistic statistic
|
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
|
WHERE
|
||||||
statistic.shop_id = #{shopId}
|
statistic.shop_id = #{shopId}
|
||||||
AND statistic.create_day = #{day}
|
AND statistic.create_day = #{day}
|
||||||
|
|||||||
Reference in New Issue
Block a user