From c30e513ad87f151ba01ba7b3b8b9149ed58a5d6c Mon Sep 17 00:00:00 2001 From: Burce Date: Mon, 26 Aug 2019 16:42:08 +0800 Subject: [PATCH] =?UTF-8?q?=E5=95=86=E6=88=B7=E6=B3=A8=E5=88=B8->=E6=B3=A8?= =?UTF-8?q?=E5=88=B8=E5=88=97=E8=A1=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/WxCouponSendController.java | 3 +-- .../iformall/schedule/CouponSendSchedule.java | 9 ++++++++- .../iformall/domain/po/WxCUserBasicInfo.java | 5 ++++- .../service/impl/WxCouponSendServiceImpl.java | 19 ++++++++++--------- .../java/com/iformall/utils/CreditUtil.java | 5 ++--- .../mapper/WxCUserBasicInfoMapper.xml | 3 ++- .../mapper/WxCouponActionLogMapper.xml | 4 ++-- 7 files changed, 29 insertions(+), 19 deletions(-) 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