diff --git a/mallinkAdmin/src/main/resources/db/migration/V201908261540__W_ALTER_USER.sql b/mallinkAdmin/src/main/resources/db/migration/V201908261540__W_ALTER_USER.sql new file mode 100644 index 000000000..d21da836b --- /dev/null +++ b/mallinkAdmin/src/main/resources/db/migration/V201908261540__W_ALTER_USER.sql @@ -0,0 +1 @@ +ALTER TABLE `wx_c_user_basic_info` ADD COLUMN `score_date` datetime COMMENT '生日倍率日期' AFTER `act_record`; \ No newline at end of file diff --git a/mallinkBApi/src/main/java/com/iformall/controller/WxCouponSendController.java b/mallinkBApi/src/main/java/com/iformall/controller/WxCouponSendController.java index e9ec98fc9..1ff6f6d15 100644 --- a/mallinkBApi/src/main/java/com/iformall/controller/WxCouponSendController.java +++ b/mallinkBApi/src/main/java/com/iformall/controller/WxCouponSendController.java @@ -21,7 +21,6 @@ import org.apache.commons.lang3.ArrayUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.util.CollectionUtils; import org.springframework.web.bind.annotation.*; import javax.annotation.Resource; @@ -72,7 +71,7 @@ public class WxCouponSendController extends BaseController { @ApiOperation("商户注券") @PostMapping("/handSel") @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), }) public ResultData handSel(String[] wxCouponSendIds, Long cUserId) { diff --git a/mallinkSchedule/src/main/java/com/iformall/schedule/CouponSendSchedule.java b/mallinkSchedule/src/main/java/com/iformall/schedule/CouponSendSchedule.java index 9386d1df4..8895876d5 100644 --- a/mallinkSchedule/src/main/java/com/iformall/schedule/CouponSendSchedule.java +++ b/mallinkSchedule/src/main/java/com/iformall/schedule/CouponSendSchedule.java @@ -314,8 +314,15 @@ public class CouponSendSchedule { " 电话-" + cu.getPhone() + " id-" + cu.getId()); } - if(sent) { + if (sent) { sendSMS(cu, mall); + // 记录积分倍率日期 + try { + cu.setScoreDate(cu.getBirthdate()); + wxCUserBasicInfoMapper.updateByPrimaryKeySelective(cu); + } catch (Exception e) { + logger.error("定时发券:记录积分倍率日期失败 {}", e.getMessage()); + } } }); }); diff --git a/mallinkService/src/main/java/com/iformall/domain/po/WxCUserBasicInfo.java b/mallinkService/src/main/java/com/iformall/domain/po/WxCUserBasicInfo.java index f791ab351..952dd7c35 100644 --- a/mallinkService/src/main/java/com/iformall/domain/po/WxCUserBasicInfo.java +++ b/mallinkService/src/main/java/com/iformall/domain/po/WxCUserBasicInfo.java @@ -22,7 +22,10 @@ public class WxCUserBasicInfo extends BaseEntity { @Id protected Long id; - + + @Transient + protected Date scoreDate; + @Transient protected List ids; diff --git a/mallinkService/src/main/java/com/iformall/service/impl/WxCouponSendServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/impl/WxCouponSendServiceImpl.java index 745e94bd0..cd398b355 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxCouponSendServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxCouponSendServiceImpl.java @@ -116,15 +116,16 @@ public class WxCouponSendServiceImpl implements WxCouponSendService { if (Objects.isNull(merchantIdStr)) { 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); //商家购券数不能大于总库存 if (merchantLnventory > wxCouponOfDb.getRemainInventory()) { diff --git a/mallinkService/src/main/java/com/iformall/utils/CreditUtil.java b/mallinkService/src/main/java/com/iformall/utils/CreditUtil.java index ea2175e9d..f8e93b38e 100644 --- a/mallinkService/src/main/java/com/iformall/utils/CreditUtil.java +++ b/mallinkService/src/main/java/com/iformall/utils/CreditUtil.java @@ -34,9 +34,8 @@ public class CreditUtil { // 获取生日积分倍率: 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()); if (Objects.nonNull(rules) && Objects.nonNull(rules.getScale())) { birthdayScale = rules.getScale(); diff --git a/mallinkService/src/main/resources/mapper/WxCUserBasicInfoMapper.xml b/mallinkService/src/main/resources/mapper/WxCUserBasicInfoMapper.xml index cd62c1f61..d58297beb 100644 --- a/mallinkService/src/main/resources/mapper/WxCUserBasicInfoMapper.xml +++ b/mallinkService/src/main/resources/mapper/WxCUserBasicInfoMapper.xml @@ -20,6 +20,7 @@ + @@ -201,7 +202,7 @@ 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