diff --git a/hai-service/src/main/java/com/hai/dao/HighCouponAgentRelMapperExt.java b/hai-service/src/main/java/com/hai/dao/HighCouponAgentRelMapperExt.java index 7c332ce1..97c8b1ed 100644 --- a/hai-service/src/main/java/com/hai/dao/HighCouponAgentRelMapperExt.java +++ b/hai-service/src/main/java/com/hai/dao/HighCouponAgentRelMapperExt.java @@ -69,14 +69,14 @@ public interface HighCouponAgentRelMapperExt { " b.sales_price price" + " from high_coupon_agent_code a " + " LEFT JOIN high_coupon_agent_rel b on b.id = a.coupon_agent_id" + - " where b.id = 22 and a.`status` = 2) a," + + " where b.id = #{couponAgentRelId} and a.`status` = 2) a," + " (select " + " b.id," + " count(1) usedNum," + " b.sales_price price" + " from high_coupon_agent_code a" + " LEFT JOIN high_coupon_agent_rel b on b.id = a.coupon_agent_id" + - " where b.id = 22 and a.`status` = 3) b" + + " where b.id = #{couponAgentRelId} and a.`status` = 3) b" + " where a.id = b.id ") Map getUseNum(@Param("couponAgentRelId") Long couponAgentRelId); } diff --git a/hai-service/src/main/java/com/hai/service/impl/HighCouponAgentServiceImpl.java b/hai-service/src/main/java/com/hai/service/impl/HighCouponAgentServiceImpl.java index c30be274..e557825e 100644 --- a/hai-service/src/main/java/com/hai/service/impl/HighCouponAgentServiceImpl.java +++ b/hai-service/src/main/java/com/hai/service/impl/HighCouponAgentServiceImpl.java @@ -427,6 +427,11 @@ public class HighCouponAgentServiceImpl implements HighCouponAgentService { throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "暂时无法使用兑换码"); } HighCouponCode couponCode = codeList.get(0); + couponCode.setIsAssignAgent(true); + couponCode.setAgentId(couponCode.getAgentId()); + couponCode.setReceiveTime(new Date()); + couponCode.setStatus(2); + highCouponCodeService.updateCouponCode(couponCode); convertCode.setCouponCodeId(couponCode.getId()); convertCode.setCouponCode(couponCode.getSalesCode());