| @@ -0,0 +1 @@ | |||||
| ALTER TABLE `wx_c_user_basic_info` ADD COLUMN `score_date` datetime COMMENT '生日倍率日期' AFTER `act_record`; | |||||
| @@ -21,7 +21,6 @@ import org.apache.commons.lang3.ArrayUtils; | |||||
| import org.slf4j.Logger; | import org.slf4j.Logger; | ||||
| import org.slf4j.LoggerFactory; | import org.slf4j.LoggerFactory; | ||||
| import org.springframework.beans.factory.annotation.Autowired; | import org.springframework.beans.factory.annotation.Autowired; | ||||
| import org.springframework.util.CollectionUtils; | |||||
| import org.springframework.web.bind.annotation.*; | import org.springframework.web.bind.annotation.*; | ||||
| import javax.annotation.Resource; | import javax.annotation.Resource; | ||||
| @@ -72,7 +71,7 @@ public class WxCouponSendController extends BaseController { | |||||
| @ApiOperation("商户注券") | @ApiOperation("商户注券") | ||||
| @PostMapping("/handSel") | @PostMapping("/handSel") | ||||
| @ApiImplicitParams({ | @ApiImplicitParams({ | ||||
| @ApiImplicitParam(name = "wxCouponSendIds", value = "CouponSend ID数组", dataType = "string[]",allowMultiple=true, paramType = "query", required = true), | |||||
| @ApiImplicitParam(name = "wxCouponSendIds", value = "CouponSend ID数组", dataType = "string",allowMultiple=true, paramType = "query", required = true), | |||||
| @ApiImplicitParam(name = "cUserId", value = "用户ID", dataType = "long", paramType = "query", required = true), | @ApiImplicitParam(name = "cUserId", value = "用户ID", dataType = "long", paramType = "query", required = true), | ||||
| }) | }) | ||||
| public ResultData handSel(String[] wxCouponSendIds, Long cUserId) { | public ResultData handSel(String[] wxCouponSendIds, Long cUserId) { | ||||
| @@ -314,8 +314,15 @@ public class CouponSendSchedule { | |||||
| " 电话-" + cu.getPhone() + | " 电话-" + cu.getPhone() + | ||||
| " id-" + cu.getId()); | " id-" + cu.getId()); | ||||
| } | } | ||||
| if(sent) { | |||||
| if (sent) { | |||||
| sendSMS(cu, mall); | sendSMS(cu, mall); | ||||
| // 记录积分倍率日期 | |||||
| try { | |||||
| cu.setScoreDate(cu.getBirthdate()); | |||||
| wxCUserBasicInfoMapper.updateByPrimaryKeySelective(cu); | |||||
| } catch (Exception e) { | |||||
| logger.error("定时发券:记录积分倍率日期失败 {}", e.getMessage()); | |||||
| } | |||||
| } | } | ||||
| }); | }); | ||||
| }); | }); | ||||
| @@ -22,7 +22,10 @@ public class WxCUserBasicInfo extends BaseEntity { | |||||
| @Id | @Id | ||||
| protected Long id; | protected Long id; | ||||
| @Transient | |||||
| protected Date scoreDate; | |||||
| @Transient | @Transient | ||||
| protected List<Long> ids; | protected List<Long> ids; | ||||
| @@ -116,15 +116,16 @@ public class WxCouponSendServiceImpl implements WxCouponSendService { | |||||
| if (Objects.isNull(merchantIdStr)) { | if (Objects.isNull(merchantIdStr)) { | ||||
| throw new MallinkException(ErrorCode.MERCHANT_INFO_NOT_FOUND); | throw new MallinkException(ErrorCode.MERCHANT_INFO_NOT_FOUND); | ||||
| } | } | ||||
| WxCouponMerchant couponMerchantQ = new WxCouponMerchant(); | |||||
| couponMerchantQ.setTenantId(record.getTenantId()); | |||||
| couponMerchantQ.setProductId(record.getCouponId()); | |||||
| couponMerchantQ.setMerchantId(Long.parseLong(merchantIdStr)); | |||||
| couponMerchantQ.setStatus(EnumCouponMerchantStatus.COUPON_MERCHANT_STATUS_VALID.getCode()); | |||||
| WxCouponMerchant couponMerchant = wxCouponMerchantMapper.selectOne(couponMerchantQ); | |||||
| if (Objects.isNull(couponMerchant)) { | |||||
| throw new MallinkException(ErrorCode.COUPON_MERCHANT_NOT_FOUND); | |||||
| } | |||||
| //产品需求,暂时不约束发券商户和券所属商户 | |||||
| //WxCouponMerchant couponMerchantQ = new WxCouponMerchant(); | |||||
| //couponMerchantQ.setTenantId(record.getTenantId()); | |||||
| //couponMerchantQ.setProductId(record.getCouponId()); | |||||
| //couponMerchantQ.setMerchantId(Long.parseLong(merchantIdStr)); | |||||
| //couponMerchantQ.setStatus(EnumCouponMerchantStatus.COUPON_MERCHANT_STATUS_VALID.getCode()); | |||||
| //WxCouponMerchant couponMerchant = wxCouponMerchantMapper.selectOne(couponMerchantQ); | |||||
| //if (Objects.isNull(couponMerchant)) { | |||||
| // throw new MallinkException(ErrorCode.COUPON_MERCHANT_NOT_FOUND); | |||||
| //} | |||||
| int merchantLnventory = jo.getInteger(WxCouponSend.KEY_MERCHANT_LNVENTORY); | int merchantLnventory = jo.getInteger(WxCouponSend.KEY_MERCHANT_LNVENTORY); | ||||
| //商家购券数不能大于总库存 | //商家购券数不能大于总库存 | ||||
| if (merchantLnventory > wxCouponOfDb.getRemainInventory()) { | if (merchantLnventory > wxCouponOfDb.getRemainInventory()) { | ||||
| @@ -34,9 +34,8 @@ public class CreditUtil { | |||||
| // 获取生日积分倍率: | // 获取生日积分倍率: | ||||
| int birthdayScale = WxScoreRules.DEFAULT_SCALE; | int birthdayScale = WxScoreRules.DEFAULT_SCALE; | ||||
| // TODO,如有修改生日,生日积分倍率也只在一天有效 | |||||
| //判断是否生日当天 | |||||
| if (Objects.nonNull(wxCUserBasicInfo.getBirthdate()) && DateUtils.birthdaysBetween(wxCUserBasicInfo.getBirthdate()) == 0) { | |||||
| //判断是否生日当天,一年一天有效 | |||||
| if (Objects.nonNull(wxCUserBasicInfo.getScoreDate()) && DateUtils.birthdaysBetween(wxCUserBasicInfo.getScoreDate()) == 0) { | |||||
| WxScoreRules rules = wxScoreRulesService.getCreditRules(wxCUser.getTenantId()); | WxScoreRules rules = wxScoreRulesService.getCreditRules(wxCUser.getTenantId()); | ||||
| if (Objects.nonNull(rules) && Objects.nonNull(rules.getScale())) { | if (Objects.nonNull(rules) && Objects.nonNull(rules.getScale())) { | ||||
| birthdayScale = rules.getScale(); | birthdayScale = rules.getScale(); | ||||
| @@ -20,6 +20,7 @@ | |||||
| <result column="credit" jdbcType="INTEGER" property="credit"/> | <result column="credit" jdbcType="INTEGER" property="credit"/> | ||||
| <result column="active_time" jdbcType="TIMESTAMP" property="activeTime"/> | <result column="active_time" jdbcType="TIMESTAMP" property="activeTime"/> | ||||
| <result column="act_record" jdbcType="INTEGER" property="actRecord"/> | <result column="act_record" jdbcType="INTEGER" property="actRecord"/> | ||||
| <result column="score_date" jdbcType="TIMESTAMP" property="scoreDate"/> | |||||
| </resultMap> | </resultMap> | ||||
| <sql id="allColumns"> | <sql id="allColumns"> | ||||
| @@ -201,7 +202,7 @@ | |||||
| <sql id="allColumnsOfScoreList"> | <sql id="allColumnsOfScoreList"> | ||||
| cub.id,cub.phone,cub.birthdate,cub.education,cub.sex,cub.email,cub.address,cub.poins,cub.tag_id, | cub.id,cub.phone,cub.birthdate,cub.education,cub.sex,cub.email,cub.address,cub.poins,cub.tag_id, | ||||
| cub.create_date,cub.update_date,cub.tenant_id,cub.name,cub.level,cub.nick_name | |||||
| cub.create_date,cub.update_date,cub.tenant_id,cub.name,cub.level,cub.nick_name,cub.score_date | |||||
| </sql> | </sql> | ||||
| <select id="findListByScore" parameterType="com.iformall.domain.dto.WxCUserBasicInfoDto" resultMap="BaseResultMap"> | <select id="findListByScore" parameterType="com.iformall.domain.dto.WxCUserBasicInfoDto" resultMap="BaseResultMap"> | ||||
| @@ -227,8 +227,8 @@ | |||||
| LEFT JOIN wx_coupon c ON cal.coupon_id = c.id | LEFT JOIN wx_coupon c ON cal.coupon_id = c.id | ||||
| LEFT JOIN wx_c_user cu ON cu.id = co.c_user_id | LEFT JOIN wx_c_user cu ON cu.id = co.c_user_id | ||||
| LEFT JOIN wx_merchant_b_user mbu ON co.b_user_id = mbu.id | LEFT JOIN wx_merchant_b_user mbu ON co.b_user_id = mbu.id | ||||
| WHERE cal.channel_type = #{channelType} | |||||
| AND cal.tenant_id = #{tenantId} | |||||
| WHERE cal.tenant_id = #{tenantId} | |||||
| AND cal.channel_type = #{channelType} | |||||
| AND mbu.merchant_id = #{merchantId} | AND mbu.merchant_id = #{merchantId} | ||||
| <if test=" null != beginDate "> | <if test=" null != beginDate "> | ||||
| and cal.create_time >= #{beginDate} | and cal.create_time >= #{beginDate} | ||||