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); + } }