From 19c887b939f13e261cbe8eeddb24c4d1bee8b60b Mon Sep 17 00:00:00 2001 From: hurui <177768073@qq.com> Date: Thu, 2 Feb 2023 14:20:59 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8F=90=E4=BA=A4=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../cweb/controller/HighCouponController.java | 1 + .../java/com/hai/dao/HighCouponMapperExt.java | 13 +++++- .../java/com/hai/model/HighCouponModel.java | 44 ++----------------- .../com/hai/service/HighCouponService.java | 7 +++ .../service/impl/HighCouponServiceImpl.java | 5 +++ 5 files changed, 29 insertions(+), 41 deletions(-) diff --git a/hai-cweb/src/main/java/com/cweb/controller/HighCouponController.java b/hai-cweb/src/main/java/com/cweb/controller/HighCouponController.java index 6a579f3d..98dba365 100644 --- a/hai-cweb/src/main/java/com/cweb/controller/HighCouponController.java +++ b/hai-cweb/src/main/java/com/cweb/controller/HighCouponController.java @@ -122,6 +122,7 @@ public class HighCouponController { HighCoupon coupon = highCouponService.getCouponById(couponId); if (coupon != null & userId != null) { + coupon.setMonthlySales(highCouponService.getMonthlySales(couponId)); coupon.setNumberUpperLimitStatus(highCouponService.userBuyLimitNumber(userId, coupon.getId())); } return ResponseMsgUtil.success(coupon); diff --git a/hai-service/src/main/java/com/hai/dao/HighCouponMapperExt.java b/hai-service/src/main/java/com/hai/dao/HighCouponMapperExt.java index 24d13ebc..f22e1092 100644 --- a/hai-service/src/main/java/com/hai/dao/HighCouponMapperExt.java +++ b/hai-service/src/main/java/com/hai/dao/HighCouponMapperExt.java @@ -1,7 +1,18 @@ package com.hai.dao; +import org.apache.ibatis.annotations.Param; +import org.apache.ibatis.annotations.Select; + /** * mapper扩展类 */ public interface HighCouponMapperExt { -} \ No newline at end of file + /** + * 查询月销量 + * @param couponId + * @return + */ + @Select({"SELECT count(1) FROM `high_child_order` " + + "where goods_type = 1 and goods_id = #{couponId} and child_order_status in (2,3,6,7) and DATE_FORMAT(pay_time,'%Y%m')=DATE_FORMAT(CURDATE(),'%Y%m');"}) + int getMonthlySales(@Param("couponId") Long couponId); +} diff --git a/hai-service/src/main/java/com/hai/model/HighCouponModel.java b/hai-service/src/main/java/com/hai/model/HighCouponModel.java index 4cf0919d..d598c6b1 100644 --- a/hai-service/src/main/java/com/hai/model/HighCouponModel.java +++ b/hai-service/src/main/java/com/hai/model/HighCouponModel.java @@ -2,6 +2,7 @@ package com.hai.model; import com.hai.entity.HighCoupon; import com.hai.entity.HighCouponHandsel; +import lombok.Data; import java.util.List; @@ -10,6 +11,7 @@ import java.util.List; * @Description: 卡卷模型 * @Date: 2021/3/11 22:27 */ +@Data public class HighCouponModel { // 商户名称 @@ -18,6 +20,8 @@ public class HighCouponModel { // 库存数量 private Integer stockCount; + private Integer monthlySales; + // 赠送卡卷id private List handselCouponId; @@ -26,44 +30,4 @@ public class HighCouponModel { // 赠送卡卷 private List handselCouponList; - - public Boolean getNumberUpperLimitStatus() { - return numberUpperLimitStatus; - } - - public void setNumberUpperLimitStatus(Boolean numberUpperLimitStatus) { - this.numberUpperLimitStatus = numberUpperLimitStatus; - } - - public String getMerchantName() { - return merchantName; - } - - public void setMerchantName(String merchantName) { - this.merchantName = merchantName; - } - - public Integer getStockCount() { - return stockCount; - } - - public void setStockCount(Integer stockCount) { - this.stockCount = stockCount; - } - - public List getHandselCouponId() { - return handselCouponId; - } - - public void setHandselCouponId(List handselCouponId) { - this.handselCouponId = handselCouponId; - } - - public List getHandselCouponList() { - return handselCouponList; - } - - public void setHandselCouponList(List handselCouponList) { - this.handselCouponList = handselCouponList; - } } diff --git a/hai-service/src/main/java/com/hai/service/HighCouponService.java b/hai-service/src/main/java/com/hai/service/HighCouponService.java index 7b98f940..2ff10e01 100644 --- a/hai-service/src/main/java/com/hai/service/HighCouponService.java +++ b/hai-service/src/main/java/com/hai/service/HighCouponService.java @@ -156,4 +156,11 @@ public interface HighCouponService { * @param childOrderNo */ HighCouponCode assignOrderStock(Long couponId, String childOrderNo) throws InterruptedException; + + /** + * 月销量 + * @param couponId + * @return + */ + int getMonthlySales(Long couponId); } diff --git a/hai-service/src/main/java/com/hai/service/impl/HighCouponServiceImpl.java b/hai-service/src/main/java/com/hai/service/impl/HighCouponServiceImpl.java index 1f58aa10..641e9c8d 100644 --- a/hai-service/src/main/java/com/hai/service/impl/HighCouponServiceImpl.java +++ b/hai-service/src/main/java/com/hai/service/impl/HighCouponServiceImpl.java @@ -592,4 +592,9 @@ public class HighCouponServiceImpl implements HighCouponService { } return null; } + + @Override + public int getMonthlySales(Long couponId) { + return highCouponMapper.getMonthlySales(couponId); + } }