| @@ -21,6 +21,9 @@ public class WxCoupon implements Serializable { | |||
| @Transient | |||
| protected List<Long> ids; | |||
| @Transient | |||
| protected List<Integer> types; | |||
| @Transient | |||
| protected List<Long> notinTypes; | |||
| @Transient | |||
| @@ -49,6 +52,14 @@ public class WxCoupon implements Serializable { | |||
| this.ids = ids; | |||
| } | |||
| public List<Integer> getTypes() { | |||
| return types; | |||
| } | |||
| public void setTypes(List<Integer> types) { | |||
| this.types = types; | |||
| } | |||
| @Transient | |||
| private String salePriceStr; | |||
| @@ -70,8 +81,8 @@ public class WxCoupon implements Serializable { | |||
| /**租户ID**/ | |||
| @io.swagger.annotations.ApiModelProperty(value="租户ID",name="tenantId") | |||
| private String tenantId; | |||
| /**券类型(1.满减券,2.代金券,3.团购券,4.礼品券,5.停车券,6.多商户券,8.砍价券,9.团购券,100.消费卡)**/ | |||
| @io.swagger.annotations.ApiModelProperty(value="券类型(1.满减券,2.代金券,3.团购券,4.礼品券,5.停车券,6.多商户券,8.砍价券,9.团购券,50.积分券,51积分停车券,100.消费卡)",name="type") | |||
| /**券类型(1.满减券,2.代金券,3.团购券,4.礼品券,5.停车券,6.多商户券,8.砍价券,9.团购券,50.积分券,51.积分停车券,100.消费卡)**/ | |||
| @io.swagger.annotations.ApiModelProperty(value="券类型(1.满减券,2.代金券,3.团购券,4.礼品券,5.停车券,6.多商户券,8.砍价券,9.团购券,50.积分券,51.积分停车券,100.消费卡)",name="type") | |||
| private Integer type; | |||
| /**封面图**/ | |||
| @io.swagger.annotations.ApiModelProperty(value="封面图",name="coverImg") | |||
| @@ -27,10 +27,9 @@ public class WxScoreRules implements Serializable { | |||
| private static final long serialVersionUID = 1L; | |||
| @Transient | |||
| private static final String defaultRules = | |||
| private static final String scoreDefaultRules = | |||
| "[" + | |||
| "{\"id\":1,\"limit\":0,\"step\":1,\"score\":10 ,\"desc\":\"每日登陆\"}," + | |||
| // "{\"id\":2,\"limit\":0,\"step\":1,\"score\":50 ,\"desc\":\"线上交易1元\"}," + | |||
| "{\"id\":2,\"childs\":[" + | |||
| " {\"businessId\":1,\"limit\":0,\"step\":1,\"score\":50 ,\"desc\":\"线上交易1元\"}," + | |||
| " {\"businessId\":2,\"limit\":0,\"step\":1,\"score\":50 ,\"desc\":\"线上交易1元\"}," + | |||
| @@ -50,6 +49,29 @@ public class WxScoreRules implements Serializable { | |||
| "{\"id\":7,\"limit\":1,\"step\":1,\"score\":100,\"desc\":\"编辑个人信息\"}" + | |||
| "]"; | |||
| @Transient | |||
| private static final String creditDefaultRules = | |||
| "[" + | |||
| "{\"id\":1,\"limit\":0,\"step\":1,\"score\":0 ,\"desc\":\"每日登陆\"}," + | |||
| "{\"id\":2,\"childs\":[" + | |||
| " {\"businessId\":1,\"limit\":0,\"step\":1,\"score\":0 ,\"desc\":\"线上交易1元\"}," + | |||
| " {\"businessId\":2,\"limit\":0,\"step\":1,\"score\":0 ,\"desc\":\"线上交易1元\"}," + | |||
| " {\"businessId\":3,\"limit\":0,\"step\":1,\"score\":0 ,\"desc\":\"线上交易1元\"}," + | |||
| " {\"businessId\":4,\"limit\":0,\"step\":1,\"score\":0 ,\"desc\":\"线上交易1元\"}," + | |||
| " {\"businessId\":5,\"limit\":0,\"step\":1,\"score\":0 ,\"desc\":\"线上交易1元\"}," + | |||
| " {\"businessId\":7,\"limit\":0,\"step\":1,\"score\":0 ,\"desc\":\"线上交易1元\"}," + | |||
| " {\"businessId\":8,\"limit\":0,\"step\":1,\"score\":0 ,\"desc\":\"线上交易1元\"}," + | |||
| " {\"businessId\":9,\"limit\":0,\"step\":1,\"score\":0 ,\"desc\":\"线上交易1元\"}," + | |||
| " {\"businessId\":10,\"limit\":0,\"step\":1,\"score\":0 ,\"desc\":\"线上交易1元\"}," + | |||
| " {\"businessId\":6,\"limit\":0,\"step\":1,\"score\":0 ,\"desc\":\"线上交易1元\"}" + | |||
| "]}," + | |||
| "{\"id\":3,\"limit\":1,\"step\":1,\"score\":0,\"desc\":\"绑定车牌1个\"}," + | |||
| "{\"id\":4,\"limit\":0,\"step\":1,\"score\":0 ,\"desc\":\"连接WIFI1次\"}," + | |||
| "{\"id\":5,\"limit\":1,\"step\":1,\"score\":0,\"desc\":\"授权个人信息\"}," + | |||
| "{\"id\":6,\"limit\":1,\"step\":1,\"score\":0,\"desc\":\"授权手机号\"}," + | |||
| "{\"id\":7,\"limit\":1,\"step\":1,\"score\":0,\"desc\":\"编辑个人信息\"}" + | |||
| "]"; | |||
| @Transient | |||
| public static final String ID = "id"; | |||
| @Transient | |||
| @@ -114,9 +136,12 @@ public class WxScoreRules implements Serializable { | |||
| tenantId = _tenantId; | |||
| } | |||
| public static String getScoreDefaultRules() { | |||
| return scoreDefaultRules; | |||
| } | |||
| public static String getDefaultRules() { | |||
| return defaultRules; | |||
| public static String getCreditDefaultRules() { | |||
| return creditDefaultRules; | |||
| } | |||
| public void setRules(String rules) { | |||
| @@ -64,13 +64,13 @@ public class WxScoreRulesServiceImpl implements WxScoreRulesService { | |||
| List<WxScoreRules> list = wxScoreRulesMapper.findList(scoreRules); | |||
| if (list.size() > 0) { | |||
| scoreRules = list.get(0); | |||
| scoreRules.setRules(getScoreRulesNew(scoreRules.getRules())); | |||
| scoreRules.setRules(getScoreRulesNew(scoreRules.getRules(),EnumScoreRules.SCORE)); | |||
| } else { | |||
| // 如果成长值规则不存在,启用默认值 | |||
| final IdWorker idWorker = IdWorker.get(); | |||
| scoreRules.setId(idWorker.nextId()); | |||
| scoreRules.setRules(WxScoreRules.getDefaultRules()); | |||
| scoreRules.setRules(WxScoreRules.getScoreDefaultRules()); | |||
| wxScoreRulesMapper.insertSelective(scoreRules); | |||
| } | |||
| @@ -82,10 +82,11 @@ public class WxScoreRulesServiceImpl implements WxScoreRulesService { | |||
| } | |||
| //当成长值或积分规则新增时,将新增的数据一并返回给接口调用端 | |||
| private String getScoreRulesNew(String scoreRules){ | |||
| private String getScoreRulesNew(String scoreRules,EnumScoreRules enumScoreRules){ | |||
| //getJSONObject(1) 为EnumScoreType.CONSUMPTION(2, "消费")的下标值 | |||
| JSONArray jsonArrayOld = JSONArray.parseArray(scoreRules).getJSONObject(1).getJSONArray("childs"); | |||
| JSONArray jsonArrayDefault = JSONArray.parseArray(WxScoreRules.getDefaultRules()).getJSONObject(1).getJSONArray("childs"); | |||
| String defaultRules = enumScoreRules.equals(EnumScoreRules.SCORE) ? WxScoreRules.getScoreDefaultRules() : WxScoreRules.getCreditDefaultRules(); | |||
| JSONArray jsonArrayDefault = JSONArray.parseArray(defaultRules).getJSONObject(1).getJSONArray("childs"); | |||
| if (jsonArrayOld.size() < jsonArrayDefault.size()) { | |||
| JSONArray childsJsonArray = new JSONArray(); | |||
| JSONObject otherJSONObject = new JSONObject(); | |||
| @@ -138,12 +139,12 @@ public class WxScoreRulesServiceImpl implements WxScoreRulesService { | |||
| List<WxScoreRules> list = wxScoreRulesMapper.findList(scoreRules); | |||
| if (list.size() > 0) { | |||
| scoreRules = list.get(0); | |||
| scoreRules.setRules(getScoreRulesNew(scoreRules.getRules())); | |||
| scoreRules.setRules(getScoreRulesNew(scoreRules.getRules(),EnumScoreRules.CREDIT)); | |||
| } else { | |||
| // 如果积分规则不存在,启用默认值 | |||
| final IdWorker idWorker = IdWorker.get(); | |||
| scoreRules.setId(idWorker.nextId()); | |||
| scoreRules.setRules(WxScoreRules.getDefaultRules()); | |||
| scoreRules.setRules(WxScoreRules.getCreditDefaultRules()); | |||
| wxScoreRulesMapper.insertSelective(scoreRules); | |||
| } | |||
| @@ -266,7 +266,7 @@ | |||
| and c.`tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null == type "> | |||
| <if test=" null == type and null == types"> | |||
| and c.`type` < 7 | |||
| </if> | |||
| @@ -393,6 +393,13 @@ | |||
| #{idItem} | |||
| </foreach> | |||
| </if> | |||
| <if test=" null != types "> | |||
| and c.type in | |||
| <foreach collection="types" index="index" item="typesItem" open="(" separator="," close=")"> | |||
| #{typesItem} | |||
| </foreach> | |||
| </if> | |||
| <if test=" null != sortColumns">order by ${sortColumns}</if> | |||
| </sql> | |||