| @@ -106,6 +106,8 @@ public class WxOrderController extends BaseController { | |||||
| WxCUserBasicInfo cUserBasicInfo = wxCUserBasicInfoService.getById(user.getId()); | WxCUserBasicInfo cUserBasicInfo = wxCUserBasicInfoService.getById(user.getId()); | ||||
| if (cUserBasicInfo != null && cUserBasicInfo.getActRecord() > 0) | if (cUserBasicInfo != null && cUserBasicInfo.getActRecord() > 0) | ||||
| return new ResultData(ErrorCode.COUPON_ONLY_FOR_NEW_MEMBER); | return new ResultData(ErrorCode.COUPON_ONLY_FOR_NEW_MEMBER); | ||||
| if (wxOrderService.countCouponConditionType1(user) > 0) | |||||
| return new ResultData(ErrorCode.COUPON_ALREADY_IN_NEW_MEMBER); | |||||
| }else if (jo.getIntValue("type") == EnumCouponConditionType.SCORE_SCOPE.getCode()){ | }else if (jo.getIntValue("type") == EnumCouponConditionType.SCORE_SCOPE.getCode()){ | ||||
| int max = jo.getIntValue("max"); | int max = jo.getIntValue("max"); | ||||
| int min = jo.getIntValue("min"); | int min = jo.getIntValue("min"); | ||||
| @@ -110,7 +110,7 @@ public enum ErrorCode{ | |||||
| COUPON_VALID_DATE_ERR(2035, "券有效期设置错误"), | COUPON_VALID_DATE_ERR(2035, "券有效期设置错误"), | ||||
| COUPON_STOCK_VALID_DATE_SETTING_ERR(2036, "券库存有效期未修改"), | COUPON_STOCK_VALID_DATE_SETTING_ERR(2036, "券库存有效期未修改"), | ||||
| COUPON_STOCK_DATE_NO_CAR(2037, "券库存不支持停车券"), | COUPON_STOCK_DATE_NO_CAR(2037, "券库存不支持停车券"), | ||||
| COUPON_ONLY_FOR_NEW_MEMBER(2038, "您已参加过新会员活动"), | |||||
| COUPON_SCORE_NOT_IN_RANGE(2038, "您的成长值/等级与要求不符"), | COUPON_SCORE_NOT_IN_RANGE(2038, "您的成长值/等级与要求不符"), | ||||
| COUPON_STOCK_NO_EQUAL_ERR(2039, "券库存设置要保证同增同减"), | COUPON_STOCK_NO_EQUAL_ERR(2039, "券库存设置要保证同增同减"), | ||||
| COUPON_STOCK_ENDTIME_ERR(2043, "抱歉,有效期截止时间只能增加不能减少!"), | COUPON_STOCK_ENDTIME_ERR(2043, "抱歉,有效期截止时间只能增加不能减少!"), | ||||
| @@ -118,6 +118,9 @@ public enum ErrorCode{ | |||||
| PUSH_LIMIT_UP_TO_1DAYLIMIT(2040, "此用户一天内发券到达疲劳度限制"), | PUSH_LIMIT_UP_TO_1DAYLIMIT(2040, "此用户一天内发券到达疲劳度限制"), | ||||
| PUSH_LIMIT_UP_TO_COUPONLIMIT(2041, "此用户发此券到达疲劳度限制"), | PUSH_LIMIT_UP_TO_COUPONLIMIT(2041, "此用户发此券到达疲劳度限制"), | ||||
| PUSH_LIMIT_NOT_INRANG(2042, "不在疲劳度允许的时间段"), | PUSH_LIMIT_NOT_INRANG(2042, "不在疲劳度允许的时间段"), | ||||
| COUPON_ONLY_FOR_NEW_MEMBER(2044, "您已经参加过新会员活动"), | |||||
| COUPON_ALREADY_IN_NEW_MEMBER(2045, "您正在参加别的新会员活动"), | |||||
| /** | /** | ||||
| * 车流 2040 | * 车流 2040 | ||||
| */ | */ | ||||
| @@ -14,6 +14,7 @@ public interface WxOrderMapper extends CommonMapper<WxOrder, Long> { | |||||
| List<WxOrder> findList(WxOrder wxOrder); | List<WxOrder> findList(WxOrder wxOrder); | ||||
| Integer countList(WxOrder wxOrder); | Integer countList(WxOrder wxOrder); | ||||
| int countCouponConditionType1(WxOrder wxOrder); | |||||
| List<WxOrder> findListOfUnpaidOrderByDate(Map dateMap); | List<WxOrder> findListOfUnpaidOrderByDate(Map dateMap); | ||||
| @@ -166,6 +166,7 @@ public interface WxOrderService { | |||||
| */ | */ | ||||
| WxOrder getUnPaidOrder(WxCUser cUser, WxCoupon coupon); | WxOrder getUnPaidOrder(WxCUser cUser, WxCoupon coupon); | ||||
| int countCouponConditionType1(WxCUser user); | |||||
| /** | /** | ||||
| * 订单处理 | * 订单处理 | ||||
| * 1. 检查coupon是否免费 | * 1. 检查coupon是否免费 | ||||
| @@ -248,6 +248,36 @@ public class WxOrderServiceImpl implements WxOrderService { | |||||
| return null; | return null; | ||||
| } | } | ||||
| /** | |||||
| * 用户正在参加的新手活动 | |||||
| * @param user | |||||
| * @return | |||||
| */ | |||||
| public int countCouponConditionType1(WxCUser user) { | |||||
| // + Order 待支付 | |||||
| try { | |||||
| WxOrder orderQ = new WxOrder(); | |||||
| orderQ.setTenantId(user.getTenantId()); | |||||
| orderQ.setType(EnumOrderType.COUPON.getCode()); | |||||
| orderQ.setCUserId(user.getId()); | |||||
| List<Integer> statusS = new ArrayList<>(); | |||||
| statusS.add(EnumOrderStatus.ORDER_STATUS_PENDING_PAYMENT.getCode()); | |||||
| statusS.add(EnumOrderStatus.ORDER_STATUS_PAYMENT_SUCCESS.getCode()); | |||||
| statusS.add(EnumOrderStatus.ORDER_STATUS_PRESSING.getCode()); | |||||
| statusS.add(EnumOrderStatus.ORDER_STATUS_PRESS_COMPLETE.getCode()); | |||||
| statusS.add(EnumOrderStatus.ORDER_STATUS_COOPERATING.getCode()); | |||||
| statusS.add(EnumOrderStatus.ORDER_STATUS_COOPERATING_COMPLETE.getCode()); | |||||
| statusS.add(EnumOrderStatus.ORDER_STATUS_COOPERATING_UNPAID.getCode()); | |||||
| orderQ.setStatusS(statusS); | |||||
| return wxOrderMapper.countCouponConditionType1(orderQ); | |||||
| } catch (Exception e) { | |||||
| logger.error("用户正在参加的新手活动, userId: " + user.getId() + ", e:" + e.getMessage()); | |||||
| throw new MallinkException(ErrorCode.ORDER_IS_NOT_FIND); | |||||
| } | |||||
| } | |||||
| /** | /** | ||||
| * 用户购买的券包数量- 待使用的券 | * 用户购买的券包数量- 待使用的券 | ||||
| * @param user | * @param user | ||||
| @@ -136,6 +136,32 @@ | |||||
| <include refid="dynamicWhereConditions"/> | <include refid="dynamicWhereConditions"/> | ||||
| </select> | </select> | ||||
| <select id="countCouponConditionType1" parameterType="com.iformall.domain.po.WxOrder" resultType="java.lang.Integer"> | |||||
| select count(*) from wx_order o,wx_coupon c | |||||
| where o.product_id = c.id | |||||
| and c.conditions is not null | |||||
| and JSON_EXTRACT(c.conditions, '$.type') = 1 | |||||
| <if test=" null != cUserId "> | |||||
| and o.c_user_id = #{cUserId} | |||||
| </if> | |||||
| <if test=" null != tenantId "> | |||||
| and o.tenant_id = #{tenantId} | |||||
| </if> | |||||
| <if test=" null != type "> | |||||
| and o.type = #{type} | |||||
| </if> | |||||
| <if test=" null != statusS "> | |||||
| and o.order_status in | |||||
| <foreach collection="statusS" index="index" item="sItem" open="(" separator="," close=")"> | |||||
| #{sItem} | |||||
| </foreach> | |||||
| </if> | |||||
| </select> | |||||
| <select id="findListOfUnpaidOrderByDate" parameterType="map" resultMap="BaseResultMap"> | <select id="findListOfUnpaidOrderByDate" parameterType="map" resultMap="BaseResultMap"> | ||||
| select | select | ||||