diff --git a/mallinkCApi/src/main/java/com/iformall/controller/WxCarController.java b/mallinkCApi/src/main/java/com/iformall/controller/WxCarController.java index b0b07a7c8..73c1a137c 100644 --- a/mallinkCApi/src/main/java/com/iformall/controller/WxCarController.java +++ b/mallinkCApi/src/main/java/com/iformall/controller/WxCarController.java @@ -266,7 +266,7 @@ public class WxCarController extends BaseController { userCar.setUpdateDate(curr); wxCUserCarService.saveOrUpdate(userCar); - wxScoreRulesService.bindCarAddScore(userCar); + wxScoreRulesService.addScore(EnumScoreType.BIND_CAR,userCar); JSONObject dataObj = retObj.getJSONObject("data"); return new ResultData(dataObj); } else { @@ -320,7 +320,7 @@ public class WxCarController extends BaseController { userCar.setUpdateDate(curr); try { wxCUserCarService.save(userCar); - wxScoreRulesService.bindCarAddScore(userCar); + wxScoreRulesService.addScore(EnumScoreType.BIND_CAR,userCar); } catch (Exception e) { logger.error(e.getMessage()); return new ResultData(ErrorCode.DB_FAIL.getCode(), "TJD保存车牌失败, e:" + e.getMessage()); diff --git a/mallinkCApi/src/main/java/com/iformall/controller/WxUserGrantController.java b/mallinkCApi/src/main/java/com/iformall/controller/WxUserGrantController.java index 4f3da28a4..09db7d938 100755 --- a/mallinkCApi/src/main/java/com/iformall/controller/WxUserGrantController.java +++ b/mallinkCApi/src/main/java/com/iformall/controller/WxUserGrantController.java @@ -14,6 +14,7 @@ import com.iformall.common.ResultData; import com.iformall.domain.po.*; import com.iformall.domain.vo.WxCUserVo; import com.iformall.enums.EnumAssignTagsTrigger; +import com.iformall.enums.EnumScoreType; import com.iformall.interceptor.AuthorizationInterceptor; import com.iformall.service.*; import com.iformall.utils.IPUtil; @@ -239,7 +240,7 @@ public class WxUserGrantController extends BaseController { wxCUserService.saveOrUpdate(user); // 成长值 - wxScoreRulesService.personAddScore(user); + wxScoreRulesService.addScore(EnumScoreType.WECHAT_PERSION,user); resultMap.put("openId", user.getOpenId()); resultMap.put("unionId", user.getUnionId()); @@ -294,7 +295,7 @@ public class WxUserGrantController extends BaseController { wxCUserService.saveOrUpdate(user); // 成长值 - wxScoreRulesService.phoneAddScore(user); + wxScoreRulesService.addScore(EnumScoreType.WECHAT_PHONE,user); resultMap.put("msg","授权手机成功!"); resultMap.put("phone",phoneNoInfo.getPhoneNumber()); @@ -509,6 +510,7 @@ public class WxUserGrantController extends BaseController { record.setId(getUser().getId()); record.setUpdateDate(new Date()); wxCUserBasicInfoService.update(record); + wxScoreRulesService.addScore(EnumScoreType.COMPLETE_INFO, record); wxCUserTagsService.triggerAssignTags(EnumAssignTagsTrigger.ASSIGN_TAGS_TRIGGER_IMPORT, record); } return new ResultData(); diff --git a/mallinkService/src/main/java/com/iformall/domain/po/WxScoreRules.java b/mallinkService/src/main/java/com/iformall/domain/po/WxScoreRules.java index f7328dc40..efb78d4b3 100644 --- a/mallinkService/src/main/java/com/iformall/domain/po/WxScoreRules.java +++ b/mallinkService/src/main/java/com/iformall/domain/po/WxScoreRules.java @@ -1,5 +1,8 @@ package com.iformall.domain.po; +import com.alibaba.fastjson.JSONObject; +import com.iformall.enums.EnumScoreType; + import javax.persistence.*; import java.util.*; import javax.persistence.Transient; @@ -14,12 +17,34 @@ import java.io.Serializable; * 4. 绑车牌获得成长值 * 5. 微信昵称授权获取成长值 * 6. 微信手机授权获取成长值 + * 7. 完善个人信息获取成长值 */ @Table(name = "wx_score_rules") public class WxScoreRules implements Serializable { private static final long serialVersionUID = 1L; - + + @Transient + private static final String defaultRules = + "[" + + "{\"id\":1,\"limit\":0,\"step\":1,\"score\":10 ,\"desc\":\"每日登陆\"}," + + "{\"id\":2,\"limit\":0,\"step\":1,\"score\":50 ,\"desc\":\"线上交易1元\"}," + + "{\"id\":3,\"limit\":1,\"step\":1,\"score\":100,\"desc\":\"绑定车牌1个\"}," + + "{\"id\":4,\"limit\":0,\"step\":1,\"score\":10 ,\"desc\":\"连接WIFI1次\"}," + + "{\"id\":5,\"limit\":1,\"step\":1,\"score\":100,\"desc\":\"授权个人信息\"}," + + "{\"id\":6,\"limit\":1,\"step\":1,\"score\":100,\"desc\":\"授权手机号\"}," + + "{\"id\":7,\"limit\":1,\"step\":1,\"score\":100,\"desc\":\"编辑个人信息\"}" + + "]"; + + @Transient + public static final String ID = "id"; + @Transient + public static final String LIMIT = "limit"; + @Transient + public static final String STEP = "step"; + @Transient + public static final String SCORE = "score"; + @Id protected Long id; @@ -51,36 +76,9 @@ public class WxScoreRules implements Serializable { /**租户ID**/ @io.swagger.annotations.ApiModelProperty(value="租户ID",name="tenantId") private String tenantId; - /**登录次数**/ - @io.swagger.annotations.ApiModelProperty(value="登录次数",name="loginCount") - private Integer loginCount; - /**登录获取积分**/ - @io.swagger.annotations.ApiModelProperty(value="登录获取积分",name="loginScoreNumber") - private Integer loginScoreNumber; - /**消费金额**/ - @io.swagger.annotations.ApiModelProperty(value="消费金额",name="consumptionAmount") - private Integer consumptionAmount; - /**消费获取积分**/ - @io.swagger.annotations.ApiModelProperty(value="消费获取积分",name="consumptionScoreNumber") - private Integer consumptionScoreNumber; - /**绑车牌次数**/ - @io.swagger.annotations.ApiModelProperty(value="绑车牌",name="bindCarNumber") - private Integer bindCarNumber; - /**绑车牌获取积分**/ - @io.swagger.annotations.ApiModelProperty(value="绑车牌获取积分",name="bindCarScoreNumber") - private Integer bindCarScoreNumber; - /**连接wifi次数**/ - @io.swagger.annotations.ApiModelProperty(value="连接wifi次数",name="wifiNumber") - private Integer wifiNumber; - /**连接wifi获取积分**/ - @io.swagger.annotations.ApiModelProperty(value="连接wifi获取积分",name="wifiScoreNumber") - private Integer wifiScoreNumber; - /**个人信息获取积分**/ - @io.swagger.annotations.ApiModelProperty(value="个人信息获取积分",name="personScoreNumber") - private Integer personScoreNumber; - /**手机授权获取积分**/ - @io.swagger.annotations.ApiModelProperty(value="手机授权获取积分",name="phoneScoreNumber") - private Integer phoneScoreNumber; + + @io.swagger.annotations.ApiModelProperty(value="规则",name="rules") + private String rules; /**创建时间**/ @io.swagger.annotations.ApiModelProperty(value="创建时间",name="createDate") @@ -90,84 +88,45 @@ public class WxScoreRules implements Serializable { private Date updateDate; - public String getTenantId() { return tenantId; } public void setTenantId(String _tenantId) { tenantId = _tenantId; } - public Integer getLoginCount() { - return loginCount; - } - public void setLoginCount(Integer _loginCount) { - loginCount = _loginCount; - } - public Integer getLoginScoreNumber() { - return loginScoreNumber; - } - public void setLoginScoreNumber(Integer _loginScoreNumber) { - loginScoreNumber = _loginScoreNumber; - } - public Integer getConsumptionAmount() { - return consumptionAmount; - } - public void setConsumptionAmount(Integer _consumptionAmount) { - consumptionAmount = _consumptionAmount; - } - public Integer getConsumptionScoreNumber() { - return consumptionScoreNumber; - } - public void setConsumptionScoreNumber(Integer _consumptionScoreNumber) { - consumptionScoreNumber = _consumptionScoreNumber; - } - public Integer getBindCarNumber() { - return bindCarNumber; - } - public void setBindCarNumber(Integer bindCarNumber) { - this.bindCarNumber = bindCarNumber; + public static String getDefaultRules() { + return defaultRules; } - public Integer getBindCarScoreNumber() { - return bindCarScoreNumber; + public void setRules(String rules) { + this.rules = rules; } - public void setBindCarScoreNumber(Integer bindCarScoreNumber) { - this.bindCarScoreNumber = bindCarScoreNumber; + public String getRules() { + return rules; } - public Integer getWifiNumber() { - return wifiNumber; - } - public void setWifiNumber(Integer wifiNumber) { - this.wifiNumber = wifiNumber; - } + public Integer getRule(EnumScoreType scoreType, String element) { + if (rules == null) + return null; - public Integer getWifiScoreNumber() { - return wifiScoreNumber; - } + List list = JSONObject.parseArray(rules, JSONObject.class); + if (list == null) + return null; + if (list.size() == 0) + return null; - public void setWifiScoreNumber(Integer wifiScoreNumber) { - this.wifiScoreNumber = wifiScoreNumber; - } - - public Integer getPersonScoreNumber() { - return personScoreNumber; - } - - public void setPersonScoreNumber(Integer personScoreNumber) { - this.personScoreNumber = personScoreNumber; - } - - public Integer getPhoneScoreNumber() { - return phoneScoreNumber; - } + for (JSONObject jo:list) { + Integer id = jo.getInteger(WxScoreRules.ID); + if ( id!= null && id.equals(scoreType.getCode())){ + return jo.getInteger(element); + } + } - public void setPhoneScoreNumber(Integer phoneScoreNumber) { - this.phoneScoreNumber = phoneScoreNumber; + return null; } public Date getCreateDate() { @@ -187,10 +146,6 @@ public class WxScoreRules implements Serializable { { Id_ASC("`id` ASC"),Id_DESC("`id` DESC") ,TenantId_ASC("`tenant_id` ASC"),TenantId_DESC("`tenant_id` DESC") - ,LoginCount_ASC("`login_count` ASC"),LoginCount_DESC("`login_count` DESC") - ,LoginScoreNumber_ASC("`login_score_number` ASC"),LoginScoreNumber_DESC("`login_score_number` DESC") - ,ConsumptionAmount_ASC("`consumption_amount` ASC"),ConsumptionAmount_DESC("`consumption_amount` DESC") - ,ConsumptionScoreNumber_ASC("`consumption_score_number` ASC"),ConsumptionScoreNumber_DESC("`consumption_score_number` DESC") ,CreateDate_ASC("`create_date` ASC"),CreateDate_DESC("`create_date` DESC") ,UpdateDate_ASC("`update_date` ASC"),UpdateDate_DESC("`update_date` DESC") ; diff --git a/mallinkService/src/main/java/com/iformall/enums/EnumScoreType.java b/mallinkService/src/main/java/com/iformall/enums/EnumScoreType.java index 44b4f3f8a..23d4ffc64 100644 --- a/mallinkService/src/main/java/com/iformall/enums/EnumScoreType.java +++ b/mallinkService/src/main/java/com/iformall/enums/EnumScoreType.java @@ -7,10 +7,11 @@ public enum EnumScoreType { LOGIN(1, "每日登录"), CONSUMPTION(2, "消费"), - BINDCAR(3, "绑车牌"), + BIND_CAR(3, "绑车牌"), WIFI_CONNECTION(4, "连接WIFI"), WECHAT_PERSION(5, "微信用户昵称授权"), - WECHAT_PHONE(6, "微信用户手机授权"); + WECHAT_PHONE(6, "微信用户手机授权"), + COMPLETE_INFO(7, "完善个人信息"); public static EnumScoreType getEnum(Integer code) { for (EnumScoreType value : values()) { diff --git a/mallinkService/src/main/java/com/iformall/mapper/WxScoreHistoryMapper.java b/mallinkService/src/main/java/com/iformall/mapper/WxScoreHistoryMapper.java index 1c3ca232e..d2f1347c5 100644 --- a/mallinkService/src/main/java/com/iformall/mapper/WxScoreHistoryMapper.java +++ b/mallinkService/src/main/java/com/iformall/mapper/WxScoreHistoryMapper.java @@ -9,8 +9,8 @@ public interface WxScoreHistoryMapper extends CommonMapper findList(WxScoreHistory wxScoreHistory); + int countTodayList(WxScoreHistory wxScoreHistory); + int countList(WxScoreHistory wxScoreHistory); - - } diff --git a/mallinkService/src/main/java/com/iformall/service/WxScoreRulesService.java b/mallinkService/src/main/java/com/iformall/service/WxScoreRulesService.java index 514a1a5f2..c04e59669 100644 --- a/mallinkService/src/main/java/com/iformall/service/WxScoreRulesService.java +++ b/mallinkService/src/main/java/com/iformall/service/WxScoreRulesService.java @@ -5,6 +5,7 @@ import com.iformall.domain.po.WxCUser; import com.iformall.domain.po.WxCUserCar; import com.iformall.domain.po.WxOrder; import com.iformall.domain.po.WxScoreRules; +import com.iformall.enums.EnumScoreType; public interface WxScoreRulesService { @@ -14,8 +15,6 @@ public interface WxScoreRulesService { * @return */ WxScoreRules getScoreRules(String tenantId); - - /** * 保存或更新实体 * @@ -24,45 +23,8 @@ public interface WxScoreRulesService { void saveOrUpdate(WxScoreRules record); /** - * 登录获取成长值 - * @param user - * @return 新增的积分值 - */ - int loginAddScore(WxCUser user); - - /** - * 订单获取成长值 - * @param order - * @return 新增的积分值 - */ - int payAddScore(WxOrder order); - - /** - * 绑车牌获取成长值 - * @param userCar - * @return 新增的积分值 - */ - int bindCarAddScore(WxCUserCar userCar); - - /** - * wifi获取成长值 - * @return - */ - int wifiAddScore(); - - /** - * 微信昵称授权获取成长值 - * @param user - * @return - */ - int personAddScore(WxCUser user); - - - /** - * 微信手机授权获取成长值 - * @param user - * @return + * 增加成长值 */ - int phoneAddScore(WxCUser user); + int addScore(EnumScoreType scoreType, Object param); } diff --git a/mallinkService/src/main/java/com/iformall/service/impl/WxCUserServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/impl/WxCUserServiceImpl.java index 0f157e4f7..d4dc0c2a8 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxCUserServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxCUserServiceImpl.java @@ -97,23 +97,10 @@ public class WxCUserServiceImpl implements WxCUserService { return PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxCUserMapper.listByChannel(sceneList, tenantId)); } - private int checkTodayLoginScoreCount(WxCUser cUser) { - WxScoreHistory scoreHistory = new WxScoreHistory(); - scoreHistory.setTenantId(cUser.getTenantId()); - scoreHistory.setCUserId(cUser.getId()); - scoreHistory.setScoreType(EnumScoreType.LOGIN.getCode()); - return wxScoreHistoryMapper.countList(scoreHistory); - } @Override public void scoreCalculate(WxCUser user, boolean isNew) { - if (isNew) { - wxScoreRulesService.loginAddScore(user); - } else { - if (checkTodayLoginScoreCount(user) <= 0) { - wxScoreRulesService.loginAddScore(user); - } - } + wxScoreRulesService.addScore(EnumScoreType.LOGIN,user); } diff --git a/mallinkService/src/main/java/com/iformall/service/impl/WxOrderServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/impl/WxOrderServiceImpl.java index 945a26d3e..ca3707376 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxOrderServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxOrderServiceImpl.java @@ -548,7 +548,7 @@ public class WxOrderServiceImpl implements WxOrderService { // 成长值 计算 try { - wxScoreRulesService.payAddScore(updateOrder); + wxScoreRulesService.addScore(EnumScoreType.CONSUMPTION,updateOrder); } catch (Exception e) { logger.error("成长值:" + e.getMessage()); } diff --git a/mallinkService/src/main/java/com/iformall/service/impl/WxScoreRulesServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/impl/WxScoreRulesServiceImpl.java index 68d007afa..6c28a4df1 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxScoreRulesServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxScoreRulesServiceImpl.java @@ -59,16 +59,8 @@ public class WxScoreRulesServiceImpl implements WxScoreRulesService { // 如果成长值规则不存在,启用默认值 final IdWorker idWorker = IdWorker.get(); scoreRules.setId(idWorker.nextId()); - scoreRules.setLoginCount(1); - scoreRules.setLoginScoreNumber(10); - scoreRules.setConsumptionAmount(1); - scoreRules.setConsumptionScoreNumber(50); - scoreRules.setBindCarNumber(1); - scoreRules.setBindCarScoreNumber(100); - scoreRules.setWifiNumber(1); - scoreRules.setWifiScoreNumber(10); - scoreRules.setPersonScoreNumber(100); - scoreRules.setPhoneScoreNumber(100); + scoreRules.setRules(WxScoreRules.getDefaultRules()); + wxScoreRulesMapper.insertSelective(scoreRules); } @@ -126,15 +118,25 @@ public class WxScoreRulesServiceImpl implements WxScoreRulesService { } } + private int checkTodayLoginScoreCount(WxCUser cUser) { + WxScoreHistory scoreHistory = new WxScoreHistory(); + scoreHistory.setTenantId(cUser.getTenantId()); + scoreHistory.setCUserId(cUser.getId()); + scoreHistory.setScoreType(EnumScoreType.LOGIN.getCode()); + return wxScoreHistoryMapper.countTodayList(scoreHistory); + } - @Override - public int loginAddScore(WxCUser user) { + private int loginAddScore(WxCUser user) { int addScoreNumber = 0; + + if (checkTodayLoginScoreCount(user) > 0) + return 0; + // 1. score_rules WxScoreRules scoreRules = getScoreRules(user.getTenantId()); // 2. 增长的成长值 - addScoreNumber = scoreRules.getLoginScoreNumber(); + addScoreNumber = scoreRules.getRule(EnumScoreType.LOGIN,WxScoreRules.SCORE); updateScore(user.getId(), addScoreNumber); user.setScore(addScoreNumber); @@ -152,8 +154,7 @@ public class WxScoreRulesServiceImpl implements WxScoreRulesService { return addScoreNumber; } - @Override - public int payAddScore(WxOrder order) { + private int payAddScore(WxOrder order) { int addScoreNumber = 0; // 订单金额为0时不计入 if (order.getPayment() == 0) @@ -162,8 +163,8 @@ public class WxScoreRulesServiceImpl implements WxScoreRulesService { WxScoreRules scoreRules = getScoreRules(order.getTenantId()); // 2. 获取成长值 - int priceCondition = scoreRules.getConsumptionAmount() * 100; // 元->分 - int baseScore = scoreRules.getConsumptionScoreNumber();//消费增长积分 + int priceCondition = scoreRules.getRule(EnumScoreType.CONSUMPTION,WxScoreRules.STEP) * 100; // 元->分 + int baseScore = scoreRules.getRule(EnumScoreType.CONSUMPTION,WxScoreRules.SCORE);//消费增长积分 // 3. 计算成长值 Long dScoreT = Math.round(order.getPayment() * 1.0d / priceCondition * baseScore); @@ -188,14 +189,14 @@ public class WxScoreRulesServiceImpl implements WxScoreRulesService { return addScoreNumber; } - @Override - public int bindCarAddScore(WxCUserCar userCar) { + + private int bindCarAddScore(WxCUserCar userCar) { int addScoreNumber = 0; // 1. 获取score rules WxScoreRules scoreRules = getScoreRules(userCar.getTenantId()); // 2. 获取成长值 - addScoreNumber = scoreRules.getBindCarScoreNumber(); + addScoreNumber = scoreRules.getRule(EnumScoreType.BIND_CAR,WxScoreRules.SCORE); // 3. 增长的成长值 updateScore(userCar.getCUserId(), addScoreNumber); @@ -207,26 +208,24 @@ public class WxScoreRulesServiceImpl implements WxScoreRulesService { history.setTenantId(userCar.getTenantId()); history.setCUserId(userCar.getCUserId()); history.setCreateDate(new Date()); - history.setScoreType(EnumScoreType.BINDCAR.getCode()); + history.setScoreType(EnumScoreType.BIND_CAR.getCode()); history.setScoreAmount(addScoreNumber); wxScoreHistoryMapper.insert(history); return addScoreNumber; } - @Override - public int wifiAddScore() { + private int wifiAddScore() { int addScoreNumber = 0; return addScoreNumber; } - @Override - public int personAddScore(WxCUser user) { + private int personAddScore(WxCUser user) { int addScoreNumber = 0; // 1. 获取score rules WxScoreRules scoreRules = getScoreRules(user.getTenantId()); // 2. 获取成长值 - addScoreNumber = scoreRules.getPersonScoreNumber(); + addScoreNumber = scoreRules.getRule(EnumScoreType.WECHAT_PERSION,WxScoreRules.SCORE); // 3. 增长的成长值 updateScore(user.getId(), addScoreNumber); @@ -244,14 +243,13 @@ public class WxScoreRulesServiceImpl implements WxScoreRulesService { return addScoreNumber; } - @Override - public int phoneAddScore(WxCUser user) { + private int phoneAddScore(WxCUser user) { int addScoreNumber = 0; // 1. 获取score rules WxScoreRules scoreRules = getScoreRules(user.getTenantId()); // 2. 获取成长值 - addScoreNumber = scoreRules.getPhoneScoreNumber(); + addScoreNumber = scoreRules.getRule(EnumScoreType.WECHAT_PHONE,WxScoreRules.SCORE); // 3. 增长的成长值 updateScore(user.getId(), addScoreNumber); @@ -269,5 +267,78 @@ public class WxScoreRulesServiceImpl implements WxScoreRulesService { return addScoreNumber; } + private int checkCompleteInfoScoreCount(WxCUser cUser) { + WxScoreHistory scoreHistory = new WxScoreHistory(); + scoreHistory.setTenantId(cUser.getTenantId()); + scoreHistory.setCUserId(cUser.getId()); + scoreHistory.setScoreType(EnumScoreType.COMPLETE_INFO.getCode()); + return wxScoreHistoryMapper.countList(scoreHistory); + } + + private int infoAddScore(WxCUserBasicInfo userInfo) { + int addScoreNumber = 0; + WxCUser user = wxCUserService.getById(userInfo.getId()); + + if (user == null || checkCompleteInfoScoreCount(user) > 0) + return 0; + // 1. 获取score rules + WxScoreRules scoreRules = getScoreRules(user.getTenantId()); + + // 2. 获取成长值 + addScoreNumber = scoreRules.getRule(EnumScoreType.COMPLETE_INFO,WxScoreRules.SCORE); + + // 3. 增长的成长值 + updateScore(user.getId(), addScoreNumber); + + // 4. 记录历史 + final IdWorker idWorker = IdWorker.get(); + WxScoreHistory history = new WxScoreHistory(); + history.setId(idWorker.nextId()); + history.setTenantId(user.getTenantId()); + history.setCUserId(user.getId()); + history.setCreateDate(new Date()); + history.setScoreType(EnumScoreType.COMPLETE_INFO.getCode()); + history.setScoreAmount(addScoreNumber); + wxScoreHistoryMapper.insert(history); + return addScoreNumber; + } + + + @Override + public int addScore(EnumScoreType scoreType ,Object param) { + + switch (scoreType){ + case LOGIN: { + WxCUser user = (WxCUser) param; + return loginAddScore(user); + } + case CONSUMPTION: { + WxOrder order = (WxOrder) param; + return payAddScore(order); + } + case BIND_CAR:{ + WxCUserCar userCar = (WxCUserCar) param; + return bindCarAddScore(userCar); + } + case WIFI_CONNECTION:{ + return wifiAddScore(); + } + case WECHAT_PERSION:{ + WxCUser user = (WxCUser) param; + return personAddScore(user); + } + case WECHAT_PHONE:{ + WxCUser user = (WxCUser) param; + return phoneAddScore(user); + } + case COMPLETE_INFO:{ + WxCUserBasicInfo user = (WxCUserBasicInfo) param; + return infoAddScore(user); + } + default: { + } + } + return 0; + } } diff --git a/mallinkService/src/main/resources/mapper/WxScoreHistoryMapper.xml b/mallinkService/src/main/resources/mapper/WxScoreHistoryMapper.xml index a4c0b3c3f..defd6aa1e 100644 --- a/mallinkService/src/main/resources/mapper/WxScoreHistoryMapper.xml +++ b/mallinkService/src/main/resources/mapper/WxScoreHistoryMapper.xml @@ -76,7 +76,7 @@ - select count(*) from wx_score_history where 1=1 @@ -92,5 +92,19 @@ and DATEDIFF(`create_date`,now())=0 + diff --git a/mallinkService/src/main/resources/mapper/WxScoreRulesMapper.xml b/mallinkService/src/main/resources/mapper/WxScoreRulesMapper.xml index b93f8fbd9..b6b25712f 100644 --- a/mallinkService/src/main/resources/mapper/WxScoreRulesMapper.xml +++ b/mallinkService/src/main/resources/mapper/WxScoreRulesMapper.xml @@ -4,22 +4,13 @@ - - - - - - - - - - + - `id`,`tenant_id`,`login_count`,`login_score_number`,`consumption_amount`,`consumption_score_number`,`bind_car_number`,`bind_car_score_number`,`wifi_number`,`wifi_score_number`,`person_score_number`,`phone_score_number`,`create_date`,`update_date` + `id`,`tenant_id`,`rules`,`create_date`,`update_date` @@ -31,36 +22,7 @@ and `tenant_id` = #{tenantId} - - and `login_count` = #{loginCount} - - - and `login_score_number` = #{loginScoreNumber} - - - and `consumption_amount` = #{consumptionAmount} - - - and `consumption_score_number` = #{consumptionScoreNumber} - - - and `bind_car_number` = #{bindCarNumber} - - - and `bind_car_score_number` = #{bindCarScoreNumber} - - - and `wifi_number` = #{wifiNumber} - - - and `wifi_score_number` = #{wifiScoreNumber} - - - and `person_score_number` = #{personScoreNumber} - - - and `phone_score_number` = #{phoneScoreNumber} - + and `create_date` = #{createDate}