Browse Source

fix

release_toaliyun_real
winter 2 years ago
parent
commit
699099b637
12 changed files with 543 additions and 145 deletions
  1. +59
    -59
      mallinkAdmin/src/main/java/com/iformall/controller/datatower/WxUserStructureController.java
  2. +204
    -1
      mallinkAdmin/src/main/resources/db/migration/V202405004.sql
  3. +6
    -0
      mallinkService/src/main/java/com/iformall/domain/po/WxCUserBasicInfo.java
  4. +4
    -0
      mallinkService/src/main/java/com/iformall/domain/po/WxLevelConfig.java
  5. +28
    -0
      mallinkService/src/main/java/com/iformall/domain/po/WxLevelConfigCoupon.java
  6. +4
    -2
      mallinkService/src/main/java/com/iformall/mapper/WxCUserBasicInfoMapper.java
  7. +15
    -0
      mallinkService/src/main/java/com/iformall/mapper/WxLevelConfigCouponMapper.java
  8. +2
    -2
      mallinkService/src/main/java/com/iformall/service/WxScoreRulesService.java
  9. +33
    -0
      mallinkService/src/main/java/com/iformall/service/impl/WxLevelConfigServiceImpl.java
  10. +116
    -72
      mallinkService/src/main/java/com/iformall/service/impl/WxScoreRulesServiceImpl.java
  11. +20
    -9
      mallinkService/src/main/resources/mapper/WxCUserBasicInfoMapper.xml
  12. +52
    -0
      mallinkService/src/main/resources/mapper/WxLevelConfigCouponMapper.xml

+ 59
- 59
mallinkAdmin/src/main/java/com/iformall/controller/datatower/WxUserStructureController.java View File

@@ -605,65 +605,65 @@ public class WxUserStructureController extends BaseController {
}
return vo;
}
// 成长值扣除
@TenantIgnore
@ApiOperation(value = "用户成长值扣减", notes = "{\"userId\":\"Long\", \"reason\":\"String\", \"score\":\"Integer\"}")
@PostMapping("/scoreReduce")
@SystemControllerLog(description = "会员管理-用户成长值扣减")
public ResultData scoreReduce(@RequestBody Map<String, String> params) {
logger.debug("[" + getIpAddr() + "] WxUserStructureController::scoreReduce");
String userIdStr = params.get("userId");
String reason = params.get("reason");
String scoreStr = params.get("score");
if (StringUtils.isBlank(userIdStr)) {
logger.error("userId为空:" + userIdStr);
return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "userId为空");
}
if (StringUtils.isBlank(reason)) {
logger.error("reason为空:" + reason);
return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "reason为空");
}
if (StringUtils.isBlank(scoreStr)) {
logger.error("score为空:" + scoreStr);
return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "score为空");
}
Long userId = null;
Integer score = null;
try {
userId = Long.valueOf(userIdStr);
score = Integer.valueOf(scoreStr);
} catch (Exception e) {
logger.error(e.getMessage());
}
if(userId == null || userId == 0) {
logger.error(ErrorCode.USER_IS_EMPTY.getMessage());
return new ResultData(ErrorCode.USER_IS_EMPTY);
}
if(score == null ) {
logger.error(ErrorCode.SYS_PARAMETER_NOT_NULL.getMessage());
return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "score不能为空");
}
// 1. 检查用户积分
WxCUserBasicInfo info = wxCUserBasicInfoService.getById(userId,getTenantInfo().getFinalTenantId());
if(info == null) {
logger.error(ErrorCode.USER_IS_EMPTY.getMessage());
return new ResultData(ErrorCode.USER_IS_EMPTY);
}
info.setPoins(info.getPoins() == null ? 0 : info.getPoins());
if(info.getPoins() < score) {
logger.error(ErrorCode.MEM_SCORE_NOT_ENOUGH.getMessage());
return new ResultData(ErrorCode.MEM_SCORE_NOT_ENOUGH);
}
// 2. 扣减积分
wxScoreRulesService.reduceScore(getTenantInfo(),EnumScoreType.MEM_REDUCE, info, reason, score);
return new ResultData();
}
//
// // 成长值扣除
// @TenantIgnore
// @ApiOperation(value = "用户成长值扣减", notes = "{\"userId\":\"Long\", \"reason\":\"String\", \"score\":\"Integer\"}")
// @PostMapping("/scoreReduce")
// @SystemControllerLog(description = "会员管理-用户成长值扣减")
// public ResultData scoreReduce(@RequestBody Map<String, String> params) {
// logger.debug("[" + getIpAddr() + "] WxUserStructureController::scoreReduce");
//
// String userIdStr = params.get("userId");
// String reason = params.get("reason");
// String scoreStr = params.get("score");
// if (StringUtils.isBlank(userIdStr)) {
// logger.error("userId为空:" + userIdStr);
// return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "userId为空");
// }
// if (StringUtils.isBlank(reason)) {
// logger.error("reason为空:" + reason);
// return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "reason为空");
// }
// if (StringUtils.isBlank(scoreStr)) {
// logger.error("score为空:" + scoreStr);
// return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "score为空");
// }
//
// Long userId = null;
// Integer score = null;
//
// try {
// userId = Long.valueOf(userIdStr);
// score = Integer.valueOf(scoreStr);
// } catch (Exception e) {
// logger.error(e.getMessage());
// }
// if(userId == null || userId == 0) {
// logger.error(ErrorCode.USER_IS_EMPTY.getMessage());
// return new ResultData(ErrorCode.USER_IS_EMPTY);
// }
// if(score == null ) {
// logger.error(ErrorCode.SYS_PARAMETER_NOT_NULL.getMessage());
// return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "score不能为空");
// }
//
// // 1. 检查用户积分
// WxCUserBasicInfo info = wxCUserBasicInfoService.getById(userId,getTenantInfo().getFinalTenantId());
// if(info == null) {
// logger.error(ErrorCode.USER_IS_EMPTY.getMessage());
// return new ResultData(ErrorCode.USER_IS_EMPTY);
// }
// info.setPoins(info.getPoins() == null ? 0 : info.getPoins());
// if(info.getPoins() < score) {
// logger.error(ErrorCode.MEM_SCORE_NOT_ENOUGH.getMessage());
// return new ResultData(ErrorCode.MEM_SCORE_NOT_ENOUGH);
// }
// // 2. 扣减积分
// wxScoreRulesService.reduceScore(getTenantInfo(),EnumScoreType.MEM_REDUCE, info, reason, score);
//
// return new ResultData();
// }


}

+ 204
- 1
mallinkAdmin/src/main/resources/db/migration/V202405004.sql View File

@@ -1,2 +1,205 @@
ALTER TABLE wx_raffle_activity_record_item ADD COLUMN item_size INT(3) NOT NULL DEFAULT 1 COMMENT '数量' AFTER `item_id`;
ALTER TABLE wx_raffle_activity_record ADD COLUMN cus_card VARCHAR(100) COMMENT '身份证号' AFTER `cus_name`;
ALTER TABLE wx_raffle_activity_record ADD COLUMN cus_card VARCHAR(100) COMMENT '身份证号' AFTER `cus_name`;


alter table wx_c_user_basic_info_0 add column poins_change_coupons varchar(1000) comment '成长值变更发券备注' after poins;
alter table wx_c_user_basic_info_1 add column poins_change_coupons varchar(1000) comment '成长值变更发券备注' after poins;
alter table wx_c_user_basic_info_2 add column poins_change_coupons varchar(1000) comment '成长值变更发券备注' after poins;
alter table wx_c_user_basic_info_3 add column poins_change_coupons varchar(1000) comment '成长值变更发券备注' after poins;
alter table wx_c_user_basic_info_4 add column poins_change_coupons varchar(1000) comment '成长值变更发券备注' after poins;
alter table wx_c_user_basic_info_5 add column poins_change_coupons varchar(1000) comment '成长值变更发券备注' after poins;
alter table wx_c_user_basic_info_6 add column poins_change_coupons varchar(1000) comment '成长值变更发券备注' after poins;
alter table wx_c_user_basic_info_7 add column poins_change_coupons varchar(1000) comment '成长值变更发券备注' after poins;
alter table wx_c_user_basic_info_8 add column poins_change_coupons varchar(1000) comment '成长值变更发券备注' after poins;
alter table wx_c_user_basic_info_9 add column poins_change_coupons varchar(1000) comment '成长值变更发券备注' after poins;
alter table wx_c_user_basic_info_10 add column poins_change_coupons varchar(1000) comment '成长值变更发券备注' after poins;
alter table wx_c_user_basic_info_11 add column poins_change_coupons varchar(1000) comment '成长值变更发券备注' after poins;
alter table wx_c_user_basic_info_12 add column poins_change_coupons varchar(1000) comment '成长值变更发券备注' after poins;
alter table wx_c_user_basic_info_13 add column poins_change_coupons varchar(1000) comment '成长值变更发券备注' after poins;
alter table wx_c_user_basic_info_14 add column poins_change_coupons varchar(1000) comment '成长值变更发券备注' after poins;
alter table wx_c_user_basic_info_15 add column poins_change_coupons varchar(1000) comment '成长值变更发券备注' after poins;
alter table wx_c_user_basic_info_16 add column poins_change_coupons varchar(1000) comment '成长值变更发券备注' after poins;
alter table wx_c_user_basic_info_17 add column poins_change_coupons varchar(1000) comment '成长值变更发券备注' after poins;
alter table wx_c_user_basic_info_18 add column poins_change_coupons varchar(1000) comment '成长值变更发券备注' after poins;
alter table wx_c_user_basic_info_19 add column poins_change_coupons varchar(1000) comment '成长值变更发券备注' after poins;
alter table wx_c_user_basic_info_20 add column poins_change_coupons varchar(1000) comment '成长值变更发券备注' after poins;
alter table wx_c_user_basic_info_21 add column poins_change_coupons varchar(1000) comment '成长值变更发券备注' after poins;
alter table wx_c_user_basic_info_22 add column poins_change_coupons varchar(1000) comment '成长值变更发券备注' after poins;
alter table wx_c_user_basic_info_23 add column poins_change_coupons varchar(1000) comment '成长值变更发券备注' after poins;
alter table wx_c_user_basic_info_24 add column poins_change_coupons varchar(1000) comment '成长值变更发券备注' after poins;
alter table wx_c_user_basic_info_25 add column poins_change_coupons varchar(1000) comment '成长值变更发券备注' after poins;
alter table wx_c_user_basic_info_26 add column poins_change_coupons varchar(1000) comment '成长值变更发券备注' after poins;
alter table wx_c_user_basic_info_27 add column poins_change_coupons varchar(1000) comment '成长值变更发券备注' after poins;
alter table wx_c_user_basic_info_28 add column poins_change_coupons varchar(1000) comment '成长值变更发券备注' after poins;
alter table wx_c_user_basic_info_29 add column poins_change_coupons varchar(1000) comment '成长值变更发券备注' after poins;
alter table wx_c_user_basic_info_30 add column poins_change_coupons varchar(1000) comment '成长值变更发券备注' after poins;
alter table wx_c_user_basic_info_31 add column poins_change_coupons varchar(1000) comment '成长值变更发券备注' after poins;
alter table wx_c_user_basic_info_32 add column poins_change_coupons varchar(1000) comment '成长值变更发券备注' after poins;
alter table wx_c_user_basic_info_33 add column poins_change_coupons varchar(1000) comment '成长值变更发券备注' after poins;
alter table wx_c_user_basic_info_34 add column poins_change_coupons varchar(1000) comment '成长值变更发券备注' after poins;
alter table wx_c_user_basic_info_35 add column poins_change_coupons varchar(1000) comment '成长值变更发券备注' after poins;
alter table wx_c_user_basic_info_36 add column poins_change_coupons varchar(1000) comment '成长值变更发券备注' after poins;
alter table wx_c_user_basic_info_37 add column poins_change_coupons varchar(1000) comment '成长值变更发券备注' after poins;
alter table wx_c_user_basic_info_38 add column poins_change_coupons varchar(1000) comment '成长值变更发券备注' after poins;
alter table wx_c_user_basic_info_39 add column poins_change_coupons varchar(1000) comment '成长值变更发券备注' after poins;
alter table wx_c_user_basic_info_40 add column poins_change_coupons varchar(1000) comment '成长值变更发券备注' after poins;
alter table wx_c_user_basic_info_41 add column poins_change_coupons varchar(1000) comment '成长值变更发券备注' after poins;
alter table wx_c_user_basic_info_42 add column poins_change_coupons varchar(1000) comment '成长值变更发券备注' after poins;
alter table wx_c_user_basic_info_43 add column poins_change_coupons varchar(1000) comment '成长值变更发券备注' after poins;
alter table wx_c_user_basic_info_44 add column poins_change_coupons varchar(1000) comment '成长值变更发券备注' after poins;
alter table wx_c_user_basic_info_45 add column poins_change_coupons varchar(1000) comment '成长值变更发券备注' after poins;
alter table wx_c_user_basic_info_46 add column poins_change_coupons varchar(1000) comment '成长值变更发券备注' after poins;
alter table wx_c_user_basic_info_47 add column poins_change_coupons varchar(1000) comment '成长值变更发券备注' after poins;
alter table wx_c_user_basic_info_48 add column poins_change_coupons varchar(1000) comment '成长值变更发券备注' after poins;
alter table wx_c_user_basic_info_49 add column poins_change_coupons varchar(1000) comment '成长值变更发券备注' after poins;
alter table wx_c_user_basic_info_50 add column poins_change_coupons varchar(1000) comment '成长值变更发券备注' after poins;
alter table wx_c_user_basic_info_51 add column poins_change_coupons varchar(1000) comment '成长值变更发券备注' after poins;
alter table wx_c_user_basic_info_52 add column poins_change_coupons varchar(1000) comment '成长值变更发券备注' after poins;
alter table wx_c_user_basic_info_53 add column poins_change_coupons varchar(1000) comment '成长值变更发券备注' after poins;
alter table wx_c_user_basic_info_54 add column poins_change_coupons varchar(1000) comment '成长值变更发券备注' after poins;
alter table wx_c_user_basic_info_55 add column poins_change_coupons varchar(1000) comment '成长值变更发券备注' after poins;
alter table wx_c_user_basic_info_56 add column poins_change_coupons varchar(1000) comment '成长值变更发券备注' after poins;
alter table wx_c_user_basic_info_57 add column poins_change_coupons varchar(1000) comment '成长值变更发券备注' after poins;
alter table wx_c_user_basic_info_58 add column poins_change_coupons varchar(1000) comment '成长值变更发券备注' after poins;
alter table wx_c_user_basic_info_59 add column poins_change_coupons varchar(1000) comment '成长值变更发券备注' after poins;
alter table wx_c_user_basic_info_60 add column poins_change_coupons varchar(1000) comment '成长值变更发券备注' after poins;
alter table wx_c_user_basic_info_61 add column poins_change_coupons varchar(1000) comment '成长值变更发券备注' after poins;
alter table wx_c_user_basic_info_62 add column poins_change_coupons varchar(1000) comment '成长值变更发券备注' after poins;
alter table wx_c_user_basic_info_63 add column poins_change_coupons varchar(1000) comment '成长值变更发券备注' after poins;
alter table wx_c_user_basic_info_64 add column poins_change_coupons varchar(1000) comment '成长值变更发券备注' after poins;
alter table wx_c_user_basic_info_65 add column poins_change_coupons varchar(1000) comment '成长值变更发券备注' after poins;
alter table wx_c_user_basic_info_66 add column poins_change_coupons varchar(1000) comment '成长值变更发券备注' after poins;
alter table wx_c_user_basic_info_67 add column poins_change_coupons varchar(1000) comment '成长值变更发券备注' after poins;
alter table wx_c_user_basic_info_68 add column poins_change_coupons varchar(1000) comment '成长值变更发券备注' after poins;
alter table wx_c_user_basic_info_69 add column poins_change_coupons varchar(1000) comment '成长值变更发券备注' after poins;
alter table wx_c_user_basic_info_70 add column poins_change_coupons varchar(1000) comment '成长值变更发券备注' after poins;
alter table wx_c_user_basic_info_71 add column poins_change_coupons varchar(1000) comment '成长值变更发券备注' after poins;
alter table wx_c_user_basic_info_72 add column poins_change_coupons varchar(1000) comment '成长值变更发券备注' after poins;
alter table wx_c_user_basic_info_73 add column poins_change_coupons varchar(1000) comment '成长值变更发券备注' after poins;
alter table wx_c_user_basic_info_74 add column poins_change_coupons varchar(1000) comment '成长值变更发券备注' after poins;
alter table wx_c_user_basic_info_75 add column poins_change_coupons varchar(1000) comment '成长值变更发券备注' after poins;
alter table wx_c_user_basic_info_76 add column poins_change_coupons varchar(1000) comment '成长值变更发券备注' after poins;
alter table wx_c_user_basic_info_77 add column poins_change_coupons varchar(1000) comment '成长值变更发券备注' after poins;
alter table wx_c_user_basic_info_78 add column poins_change_coupons varchar(1000) comment '成长值变更发券备注' after poins;
alter table wx_c_user_basic_info_79 add column poins_change_coupons varchar(1000) comment '成长值变更发券备注' after poins;
alter table wx_c_user_basic_info_80 add column poins_change_coupons varchar(1000) comment '成长值变更发券备注' after poins;
alter table wx_c_user_basic_info_81 add column poins_change_coupons varchar(1000) comment '成长值变更发券备注' after poins;
alter table wx_c_user_basic_info_82 add column poins_change_coupons varchar(1000) comment '成长值变更发券备注' after poins;
alter table wx_c_user_basic_info_83 add column poins_change_coupons varchar(1000) comment '成长值变更发券备注' after poins;
alter table wx_c_user_basic_info_84 add column poins_change_coupons varchar(1000) comment '成长值变更发券备注' after poins;
alter table wx_c_user_basic_info_85 add column poins_change_coupons varchar(1000) comment '成长值变更发券备注' after poins;
alter table wx_c_user_basic_info_86 add column poins_change_coupons varchar(1000) comment '成长值变更发券备注' after poins;
alter table wx_c_user_basic_info_87 add column poins_change_coupons varchar(1000) comment '成长值变更发券备注' after poins;
alter table wx_c_user_basic_info_88 add column poins_change_coupons varchar(1000) comment '成长值变更发券备注' after poins;
alter table wx_c_user_basic_info_89 add column poins_change_coupons varchar(1000) comment '成长值变更发券备注' after poins;
alter table wx_c_user_basic_info_90 add column poins_change_coupons varchar(1000) comment '成长值变更发券备注' after poins;
alter table wx_c_user_basic_info_91 add column poins_change_coupons varchar(1000) comment '成长值变更发券备注' after poins;
alter table wx_c_user_basic_info_92 add column poins_change_coupons varchar(1000) comment '成长值变更发券备注' after poins;
alter table wx_c_user_basic_info_93 add column poins_change_coupons varchar(1000) comment '成长值变更发券备注' after poins;
alter table wx_c_user_basic_info_94 add column poins_change_coupons varchar(1000) comment '成长值变更发券备注' after poins;
alter table wx_c_user_basic_info_95 add column poins_change_coupons varchar(1000) comment '成长值变更发券备注' after poins;
alter table wx_c_user_basic_info_96 add column poins_change_coupons varchar(1000) comment '成长值变更发券备注' after poins;
alter table wx_c_user_basic_info_97 add column poins_change_coupons varchar(1000) comment '成长值变更发券备注' after poins;
alter table wx_c_user_basic_info_98 add column poins_change_coupons varchar(1000) comment '成长值变更发券备注' after poins;
alter table wx_c_user_basic_info_99 add column poins_change_coupons varchar(1000) comment '成长值变更发券备注' after poins;

alter table wx_c_user_basic_info_0 add column last_change_coupon_poins int(10) comment '最近一次变更发券的成长值' after poins;
alter table wx_c_user_basic_info_1 add column last_change_coupon_poins int(10) comment '最近一次变更发券的成长值' after poins;
alter table wx_c_user_basic_info_2 add column last_change_coupon_poins int(10) comment '最近一次变更发券的成长值' after poins;
alter table wx_c_user_basic_info_3 add column last_change_coupon_poins int(10) comment '最近一次变更发券的成长值' after poins;
alter table wx_c_user_basic_info_4 add column last_change_coupon_poins int(10) comment '最近一次变更发券的成长值' after poins;
alter table wx_c_user_basic_info_5 add column last_change_coupon_poins int(10) comment '最近一次变更发券的成长值' after poins;
alter table wx_c_user_basic_info_6 add column last_change_coupon_poins int(10) comment '最近一次变更发券的成长值' after poins;
alter table wx_c_user_basic_info_7 add column last_change_coupon_poins int(10) comment '最近一次变更发券的成长值' after poins;
alter table wx_c_user_basic_info_8 add column last_change_coupon_poins int(10) comment '最近一次变更发券的成长值' after poins;
alter table wx_c_user_basic_info_9 add column last_change_coupon_poins int(10) comment '最近一次变更发券的成长值' after poins;
alter table wx_c_user_basic_info_10 add column last_change_coupon_poins int(10) comment '最近一次变更发券的成长值' after poins;
alter table wx_c_user_basic_info_11 add column last_change_coupon_poins int(10) comment '最近一次变更发券的成长值' after poins;
alter table wx_c_user_basic_info_12 add column last_change_coupon_poins int(10) comment '最近一次变更发券的成长值' after poins;
alter table wx_c_user_basic_info_13 add column last_change_coupon_poins int(10) comment '最近一次变更发券的成长值' after poins;
alter table wx_c_user_basic_info_14 add column last_change_coupon_poins int(10) comment '最近一次变更发券的成长值' after poins;
alter table wx_c_user_basic_info_15 add column last_change_coupon_poins int(10) comment '最近一次变更发券的成长值' after poins;
alter table wx_c_user_basic_info_16 add column last_change_coupon_poins int(10) comment '最近一次变更发券的成长值' after poins;
alter table wx_c_user_basic_info_17 add column last_change_coupon_poins int(10) comment '最近一次变更发券的成长值' after poins;
alter table wx_c_user_basic_info_18 add column last_change_coupon_poins int(10) comment '最近一次变更发券的成长值' after poins;
alter table wx_c_user_basic_info_19 add column last_change_coupon_poins int(10) comment '最近一次变更发券的成长值' after poins;
alter table wx_c_user_basic_info_20 add column last_change_coupon_poins int(10) comment '最近一次变更发券的成长值' after poins;
alter table wx_c_user_basic_info_21 add column last_change_coupon_poins int(10) comment '最近一次变更发券的成长值' after poins;
alter table wx_c_user_basic_info_22 add column last_change_coupon_poins int(10) comment '最近一次变更发券的成长值' after poins;
alter table wx_c_user_basic_info_23 add column last_change_coupon_poins int(10) comment '最近一次变更发券的成长值' after poins;
alter table wx_c_user_basic_info_24 add column last_change_coupon_poins int(10) comment '最近一次变更发券的成长值' after poins;
alter table wx_c_user_basic_info_25 add column last_change_coupon_poins int(10) comment '最近一次变更发券的成长值' after poins;
alter table wx_c_user_basic_info_26 add column last_change_coupon_poins int(10) comment '最近一次变更发券的成长值' after poins;
alter table wx_c_user_basic_info_27 add column last_change_coupon_poins int(10) comment '最近一次变更发券的成长值' after poins;
alter table wx_c_user_basic_info_28 add column last_change_coupon_poins int(10) comment '最近一次变更发券的成长值' after poins;
alter table wx_c_user_basic_info_29 add column last_change_coupon_poins int(10) comment '最近一次变更发券的成长值' after poins;
alter table wx_c_user_basic_info_30 add column last_change_coupon_poins int(10) comment '最近一次变更发券的成长值' after poins;
alter table wx_c_user_basic_info_31 add column last_change_coupon_poins int(10) comment '最近一次变更发券的成长值' after poins;
alter table wx_c_user_basic_info_32 add column last_change_coupon_poins int(10) comment '最近一次变更发券的成长值' after poins;
alter table wx_c_user_basic_info_33 add column last_change_coupon_poins int(10) comment '最近一次变更发券的成长值' after poins;
alter table wx_c_user_basic_info_34 add column last_change_coupon_poins int(10) comment '最近一次变更发券的成长值' after poins;
alter table wx_c_user_basic_info_35 add column last_change_coupon_poins int(10) comment '最近一次变更发券的成长值' after poins;
alter table wx_c_user_basic_info_36 add column last_change_coupon_poins int(10) comment '最近一次变更发券的成长值' after poins;
alter table wx_c_user_basic_info_37 add column last_change_coupon_poins int(10) comment '最近一次变更发券的成长值' after poins;
alter table wx_c_user_basic_info_38 add column last_change_coupon_poins int(10) comment '最近一次变更发券的成长值' after poins;
alter table wx_c_user_basic_info_39 add column last_change_coupon_poins int(10) comment '最近一次变更发券的成长值' after poins;
alter table wx_c_user_basic_info_40 add column last_change_coupon_poins int(10) comment '最近一次变更发券的成长值' after poins;
alter table wx_c_user_basic_info_41 add column last_change_coupon_poins int(10) comment '最近一次变更发券的成长值' after poins;
alter table wx_c_user_basic_info_42 add column last_change_coupon_poins int(10) comment '最近一次变更发券的成长值' after poins;
alter table wx_c_user_basic_info_43 add column last_change_coupon_poins int(10) comment '最近一次变更发券的成长值' after poins;
alter table wx_c_user_basic_info_44 add column last_change_coupon_poins int(10) comment '最近一次变更发券的成长值' after poins;
alter table wx_c_user_basic_info_45 add column last_change_coupon_poins int(10) comment '最近一次变更发券的成长值' after poins;
alter table wx_c_user_basic_info_46 add column last_change_coupon_poins int(10) comment '最近一次变更发券的成长值' after poins;
alter table wx_c_user_basic_info_47 add column last_change_coupon_poins int(10) comment '最近一次变更发券的成长值' after poins;
alter table wx_c_user_basic_info_48 add column last_change_coupon_poins int(10) comment '最近一次变更发券的成长值' after poins;
alter table wx_c_user_basic_info_49 add column last_change_coupon_poins int(10) comment '最近一次变更发券的成长值' after poins;
alter table wx_c_user_basic_info_50 add column last_change_coupon_poins int(10) comment '最近一次变更发券的成长值' after poins;
alter table wx_c_user_basic_info_51 add column last_change_coupon_poins int(10) comment '最近一次变更发券的成长值' after poins;
alter table wx_c_user_basic_info_52 add column last_change_coupon_poins int(10) comment '最近一次变更发券的成长值' after poins;
alter table wx_c_user_basic_info_53 add column last_change_coupon_poins int(10) comment '最近一次变更发券的成长值' after poins;
alter table wx_c_user_basic_info_54 add column last_change_coupon_poins int(10) comment '最近一次变更发券的成长值' after poins;
alter table wx_c_user_basic_info_55 add column last_change_coupon_poins int(10) comment '最近一次变更发券的成长值' after poins;
alter table wx_c_user_basic_info_56 add column last_change_coupon_poins int(10) comment '最近一次变更发券的成长值' after poins;
alter table wx_c_user_basic_info_57 add column last_change_coupon_poins int(10) comment '最近一次变更发券的成长值' after poins;
alter table wx_c_user_basic_info_58 add column last_change_coupon_poins int(10) comment '最近一次变更发券的成长值' after poins;
alter table wx_c_user_basic_info_59 add column last_change_coupon_poins int(10) comment '最近一次变更发券的成长值' after poins;
alter table wx_c_user_basic_info_60 add column last_change_coupon_poins int(10) comment '最近一次变更发券的成长值' after poins;
alter table wx_c_user_basic_info_61 add column last_change_coupon_poins int(10) comment '最近一次变更发券的成长值' after poins;
alter table wx_c_user_basic_info_62 add column last_change_coupon_poins int(10) comment '最近一次变更发券的成长值' after poins;
alter table wx_c_user_basic_info_63 add column last_change_coupon_poins int(10) comment '最近一次变更发券的成长值' after poins;
alter table wx_c_user_basic_info_64 add column last_change_coupon_poins int(10) comment '最近一次变更发券的成长值' after poins;
alter table wx_c_user_basic_info_65 add column last_change_coupon_poins int(10) comment '最近一次变更发券的成长值' after poins;
alter table wx_c_user_basic_info_66 add column last_change_coupon_poins int(10) comment '最近一次变更发券的成长值' after poins;
alter table wx_c_user_basic_info_67 add column last_change_coupon_poins int(10) comment '最近一次变更发券的成长值' after poins;
alter table wx_c_user_basic_info_68 add column last_change_coupon_poins int(10) comment '最近一次变更发券的成长值' after poins;
alter table wx_c_user_basic_info_69 add column last_change_coupon_poins int(10) comment '最近一次变更发券的成长值' after poins;
alter table wx_c_user_basic_info_70 add column last_change_coupon_poins int(10) comment '最近一次变更发券的成长值' after poins;
alter table wx_c_user_basic_info_71 add column last_change_coupon_poins int(10) comment '最近一次变更发券的成长值' after poins;
alter table wx_c_user_basic_info_72 add column last_change_coupon_poins int(10) comment '最近一次变更发券的成长值' after poins;
alter table wx_c_user_basic_info_73 add column last_change_coupon_poins int(10) comment '最近一次变更发券的成长值' after poins;
alter table wx_c_user_basic_info_74 add column last_change_coupon_poins int(10) comment '最近一次变更发券的成长值' after poins;
alter table wx_c_user_basic_info_75 add column last_change_coupon_poins int(10) comment '最近一次变更发券的成长值' after poins;
alter table wx_c_user_basic_info_76 add column last_change_coupon_poins int(10) comment '最近一次变更发券的成长值' after poins;
alter table wx_c_user_basic_info_77 add column last_change_coupon_poins int(10) comment '最近一次变更发券的成长值' after poins;
alter table wx_c_user_basic_info_78 add column last_change_coupon_poins int(10) comment '最近一次变更发券的成长值' after poins;
alter table wx_c_user_basic_info_79 add column last_change_coupon_poins int(10) comment '最近一次变更发券的成长值' after poins;
alter table wx_c_user_basic_info_80 add column last_change_coupon_poins int(10) comment '最近一次变更发券的成长值' after poins;
alter table wx_c_user_basic_info_81 add column last_change_coupon_poins int(10) comment '最近一次变更发券的成长值' after poins;
alter table wx_c_user_basic_info_82 add column last_change_coupon_poins int(10) comment '最近一次变更发券的成长值' after poins;
alter table wx_c_user_basic_info_83 add column last_change_coupon_poins int(10) comment '最近一次变更发券的成长值' after poins;
alter table wx_c_user_basic_info_84 add column last_change_coupon_poins int(10) comment '最近一次变更发券的成长值' after poins;
alter table wx_c_user_basic_info_85 add column last_change_coupon_poins int(10) comment '最近一次变更发券的成长值' after poins;
alter table wx_c_user_basic_info_86 add column last_change_coupon_poins int(10) comment '最近一次变更发券的成长值' after poins;
alter table wx_c_user_basic_info_87 add column last_change_coupon_poins int(10) comment '最近一次变更发券的成长值' after poins;
alter table wx_c_user_basic_info_88 add column last_change_coupon_poins int(10) comment '最近一次变更发券的成长值' after poins;
alter table wx_c_user_basic_info_89 add column last_change_coupon_poins int(10) comment '最近一次变更发券的成长值' after poins;
alter table wx_c_user_basic_info_90 add column last_change_coupon_poins int(10) comment '最近一次变更发券的成长值' after poins;
alter table wx_c_user_basic_info_91 add column last_change_coupon_poins int(10) comment '最近一次变更发券的成长值' after poins;
alter table wx_c_user_basic_info_92 add column last_change_coupon_poins int(10) comment '最近一次变更发券的成长值' after poins;
alter table wx_c_user_basic_info_93 add column last_change_coupon_poins int(10) comment '最近一次变更发券的成长值' after poins;
alter table wx_c_user_basic_info_94 add column last_change_coupon_poins int(10) comment '最近一次变更发券的成长值' after poins;
alter table wx_c_user_basic_info_95 add column last_change_coupon_poins int(10) comment '最近一次变更发券的成长值' after poins;
alter table wx_c_user_basic_info_96 add column last_change_coupon_poins int(10) comment '最近一次变更发券的成长值' after poins;
alter table wx_c_user_basic_info_97 add column last_change_coupon_poins int(10) comment '最近一次变更发券的成长值' after poins;
alter table wx_c_user_basic_info_98 add column last_change_coupon_poins int(10) comment '最近一次变更发券的成长值' after poins;
alter table wx_c_user_basic_info_99 add column last_change_coupon_poins int(10) comment '最近一次变更发券的成长值' after poins;

+ 6
- 0
mallinkService/src/main/java/com/iformall/domain/po/WxCUserBasicInfo.java View File

@@ -104,6 +104,12 @@ public class WxCUserBasicInfo extends TenantEntityWithoutFinalTenantId {
@Excel(name="成长值",width = 20, orderNum = "11")
@io.swagger.annotations.ApiModelProperty(value="成长值",name="poins")
private Integer poins;
@io.swagger.annotations.ApiModelProperty(value="最近变更发券时的等级成长值",name="lastChangeCouponPoins")
private Integer lastChangeCouponPoins;
@io.swagger.annotations.ApiModelProperty(value="成长值变更发券备注",name="poinsChangeCoupons")
private String poinsChangeCoupons;

@io.swagger.annotations.ApiModelProperty(value="地址",name="address")
private String address;


+ 4
- 0
mallinkService/src/main/java/com/iformall/domain/po/WxLevelConfig.java View File

@@ -7,6 +7,7 @@ import lombok.Data;
import lombok.EqualsAndHashCode;

import java.util.Date;
import java.util.List;

@TableName(value = "wx_level_config")
@Data
@@ -42,5 +43,8 @@ public class WxLevelConfig extends BaseTenantEntity {

@TableField(exist = false)
protected Long userCount;
@TableField(exist = false)
protected List<WxLevelConfigCoupon> coupons;

}

+ 28
- 0
mallinkService/src/main/java/com/iformall/domain/po/WxLevelConfigCoupon.java View File

@@ -0,0 +1,28 @@
package com.iformall.domain.po;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.iformall.domain.po.base.BaseTenantEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;

import java.util.Date;

@TableName(value = "wx_level_config_coupon")
@Data
@EqualsAndHashCode(callSuper = true)
public class WxLevelConfigCoupon extends BaseTenantEntity {
@TableField(exist = false)
public static final int DEFAULT_SCALE = 10;

protected Long id;

@io.swagger.annotations.ApiModelProperty(value="等级ID",name="levelId")
private Long levelId;
@io.swagger.annotations.ApiModelProperty(value="券编号",name="couponId")
private Long couponId;
@io.swagger.annotations.ApiModelProperty(value="创建时间",name="createDate")
private Date createDate;
@io.swagger.annotations.ApiModelProperty(value="更新时间",name="updateDate")
private Date updateDate;
}

+ 4
- 2
mallinkService/src/main/java/com/iformall/mapper/WxCUserBasicInfoMapper.java View File

@@ -27,9 +27,11 @@ public interface WxCUserBasicInfoMapper extends CommonMapper<WxCUserBasicInfo, S
WxCUserBasicInfo selectById(@Param("id")Long id,@Param("finalTenantId")String finalTenantId);

void updateScore(WxCUserBasicInfo record);
void updatePoinsChangeCoupon(WxCUserBasicInfo record);

void updateUpScore(WxCUserBasicInfo record);
void updateDownScore(WxCUserBasicInfo record);
//void updateUpScore(WxCUserBasicInfo record);
//void updateDownScore(WxCUserBasicInfo record);

void updateNewId(CUserBaseVo record);



+ 15
- 0
mallinkService/src/main/java/com/iformall/mapper/WxLevelConfigCouponMapper.java View File

@@ -0,0 +1,15 @@
package com.iformall.mapper;

import com.iformall.common.CommonMapper;
import com.iformall.domain.po.WxLevelConfig;
import com.iformall.domain.po.WxLevelConfigCoupon;

import org.apache.ibatis.annotations.Param;

import java.util.List;

public interface WxLevelConfigCouponMapper extends CommonMapper<WxLevelConfigCoupon, Long> {

List<WxLevelConfigCoupon> findList(WxLevelConfigCoupon wxLevelConfig);
void deleteByConfig(WxLevelConfigCoupon wxLevelConfig);
}

+ 2
- 2
mallinkService/src/main/java/com/iformall/service/WxScoreRulesService.java View File

@@ -58,7 +58,7 @@ public interface WxScoreRulesService {
*
* @param record
*/
int cancelScore(WxScoreHistory record);
// int cancelScore(WxScoreHistory record);

/**
* 增加成长值
@@ -73,7 +73,7 @@ public interface WxScoreRulesService {
/**
* 扣减成长值
*/
int reduceScore(TenantEntity tenantEntity,EnumScoreType scoreType, Object param1, Object param2, Object param3);
// int reduceScore(TenantEntity tenantEntity,EnumScoreType scoreType, Object param1, Object param2, Object param3);

List<WxScoreRules> findList(WxScoreRules wxScoreRules);



+ 33
- 0
mallinkService/src/main/java/com/iformall/service/impl/WxLevelConfigServiceImpl.java View File

@@ -7,11 +7,13 @@ import com.github.pagehelper.PageInfo;
import com.iformall.common.IdWorker;
import com.iformall.domain.dto.WxCUserBasicInfoDto;
import com.iformall.domain.po.WxLevelConfig;
import com.iformall.domain.po.WxLevelConfigCoupon;
import com.iformall.domain.po.WxLevelMerchant;
import com.iformall.domain.po.base.BaseEntity;
import com.iformall.domain.po.base.TenantEntity;
import com.iformall.domain.vo.WxLevelMerchantCVo;
import com.iformall.mapper.WxCUserBasicInfoMapper;
import com.iformall.mapper.WxLevelConfigCouponMapper;
import com.iformall.mapper.WxLevelConfigMapper;
import com.iformall.mapper.WxLevelMerchantMapper;
import com.iformall.service.WxCUserBasicInfoService;
@@ -39,6 +41,9 @@ public class WxLevelConfigServiceImpl implements WxLevelConfigService {

@Autowired
WxLevelConfigMapper wxLevelConfigMapper;
@Autowired
WxLevelConfigCouponMapper wxLevelConfigCouponMapper;

@Autowired
WxLevelMerchantMapper wxLevelMerchantapper;
@@ -143,6 +148,15 @@ public class WxLevelConfigServiceImpl implements WxLevelConfigService {
wxLevelConfig.setTenantId(tenantEntity.getFinalTenantId());
wxLevelConfig.setSortColumns(BaseEntity.SortField.Points_ASC);
clist = wxLevelConfigMapper.findList(wxLevelConfig);
if (null != clist ) {
for (int i = 0 ; i < clist.size() ;i++) {
WxLevelConfig lc = clist.get(i);
WxLevelConfigCoupon cc = new WxLevelConfigCoupon();
cc.updateTenantInfo(tenantEntity);
cc.setLevelId(lc.getId());
lc.setCoupons(wxLevelConfigCouponMapper.findList(cc));
}
}
RedisCacheUtils.cache(wxLevelConfigListRedisTemplate, key, clist, 3600*24*7);
}
return clist;
@@ -183,8 +197,27 @@ public class WxLevelConfigServiceImpl implements WxLevelConfigService {
// levelConfig.updateTenantInfo(tenantEntity);
levelConfig.setTenantId(tenantEntity.getFinalTenantId());
levelConfigs.add(levelConfig);
WxLevelConfigCoupon lc = new WxLevelConfigCoupon();
lc.updateTenantInfo(tenantEntity);
lc.setLevelId(levelConfig.getId());
wxLevelConfigCouponMapper.deleteByConfig(lc);
if (null != levelConfig.getCoupons()) {
for (int i = 0 ; i < levelConfig.getCoupons().size(); i++) {
WxLevelConfigCoupon lcc = levelConfig.getCoupons().get(i);
WxLevelConfigCoupon wlcc = new WxLevelConfigCoupon();
wlcc.updateTenantInfo(tenantEntity);
wlcc.setCouponId(lcc.getCouponId());
wlcc.setId(idWorker.nextId());
wlcc.setCreateDate(new Date());
wlcc.setUpdateDate(new Date());
wlcc.setLevelId(levelConfig.getId());
wxLevelConfigCouponMapper.insert(wlcc);
}
}
}
wxLevelConfigMapper.insertBatch(levelConfigs);

this.deleteRedis(tenantEntity.getFinalTenantId());
}



+ 116
- 72
mallinkService/src/main/java/com/iformall/service/impl/WxScoreRulesServiceImpl.java View File

@@ -56,6 +56,16 @@ public class WxScoreRulesServiceImpl implements WxScoreRulesService {

@Autowired
SysConfigService sysConfigService;
@Autowired
WxLevelConfigMapper wxLevelConfigMapper;
@Autowired
WxLevelConfigCouponMapper wxLevelConfigCouponMapper;
@Lazy
@Autowired
WxOrderService wxOrderService;


@Override
@@ -267,46 +277,80 @@ public class WxScoreRulesServiceImpl implements WxScoreRulesService {

}

@Override
public int cancelScore(WxScoreHistory record) {
int num = 0;
WxScoreHistory history = null;
// 1. delete history
List<WxScoreHistory> histories = wxScoreHistoryMapper.findList(record);
if (histories.size() >= 1) {
history = histories.get(0);
}
if (history != null) {
num = wxScoreHistoryMapper.deleteById(history.getId(),record.getTenantId());
if (num != 1) {
logger.error("删除成长值历史出错"+ history.toString());
throw new MallinkException(ErrorCode.DB_FAIL.getCode(), "删除成长值历史出错");
}
} else {
logger.warn("未找到成长值历史");
return 0;
}
// 2. user score back
WxCUserBasicInfo wxCUserBasicInfo = wxCUserBasicInfoMapper.selectById(record.getCUserId(),record.getTenantId());
if (wxCUserBasicInfo != null) {
WxCUserBasicInfo wxCUserBasicInfoNew = new WxCUserBasicInfo();
wxCUserBasicInfoNew.setId(wxCUserBasicInfo.getId());
wxCUserBasicInfoNew.setPoins(wxCUserBasicInfo.getPoins()-history.getScoreAmount());
wxCUserBasicInfoNew.setUpdateDate(new Date());
wxCUserBasicInfoMapper.updateById(wxCUserBasicInfoNew);
}
return num;
}
// @Override
// public int cancelScore(WxScoreHistory record) {
// int num = 0;
// WxScoreHistory history = null;
// // 1. delete history
// List<WxScoreHistory> histories = wxScoreHistoryMapper.findList(record);
// if (histories.size() >= 1) {
// history = histories.get(0);
// }
// if (history != null) {
// num = wxScoreHistoryMapper.deleteById(history.getId(),record.getTenantId());
// if (num != 1) {
// logger.error("删除成长值历史出错"+ history.toString());
// throw new MallinkException(ErrorCode.DB_FAIL.getCode(), "删除成长值历史出错");
// }
// } else {
// logger.warn("未找到成长值历史");
// return 0;
// }
// // 2. user score back
// WxCUserBasicInfo wxCUserBasicInfo = wxCUserBasicInfoMapper.selectById(record.getCUserId(),record.getTenantId());
// if (wxCUserBasicInfo != null) {
// WxCUserBasicInfo wxCUserBasicInfoNew = new WxCUserBasicInfo();
// wxCUserBasicInfoNew.setId(wxCUserBasicInfo.getId());
// wxCUserBasicInfoNew.setPoins(wxCUserBasicInfo.getPoins()-history.getScoreAmount());
// wxCUserBasicInfoNew.setUpdateDate(new Date());
// wxCUserBasicInfoMapper.updateById(wxCUserBasicInfoNew);
// }
// return num;
// }

private void updateScore(Long userId, TenantEntity tenantinfo, int addedScoreNumber) {
WxCUserBasicInfo wxCUserBasicInfo = wxCUserBasicInfoMapper.selectById(userId,tenantinfo.getFinalTenantId());
if (wxCUserBasicInfo.getPoins() == null) {
wxCUserBasicInfo.setPoins(0);
}
int newScore = wxCUserBasicInfo.getPoins() + addedScoreNumber;
wxCUserBasicInfo.setPoins(newScore);
int oldPoins = wxCUserBasicInfo.getPoins();
int newPoins = oldPoins + addedScoreNumber;
wxCUserBasicInfo.setPoins(newPoins);
wxCUserBasicInfoMapper.updateScore(wxCUserBasicInfo);

sendLevelChangeCoupons(tenantinfo,userId,wxCUserBasicInfo.getLastChangeCouponPoins(),oldPoins,newPoins);
}
private void sendLevelChangeCoupons(TenantEntity tenantinfo,Long userId,Integer userLastChangeScore,int oldPoins,int newPoins) {
WxLevelConfig levelConfig = new WxLevelConfig();
levelConfig.updateTenantInfo(tenantinfo);
levelConfig.setSortColumns("poins asc");
List<WxLevelConfig> lcList = wxLevelConfigMapper.findList(levelConfig);
if (null != lcList && lcList.size() > 0 ) {
for (int i = 0 ; i < lcList.size(); i++) {
WxLevelConfig wlc = lcList.get(i);
//达到等级值
if (newPoins >= wlc.getPoints()) {
//上一次升级的值比现在的值小,则现在时必须要升级
if (null == userLastChangeScore || userLastChangeScore < wlc.getPoints()) {
WxLevelConfigCoupon lcc = new WxLevelConfigCoupon();
lcc.updateTenantInfo(tenantinfo);
lcc.setLevelId(wlc.getId());
List<WxLevelConfigCoupon> lcoupons = wxLevelConfigCouponMapper.findList(lcc);
if (null != lcoupons && lcoupons.size() > 0 ) {
for (int j = 0 ; j < lcoupons.size(); j ++) {
WxLevelConfigCoupon _lcc = lcoupons.get(j);
WxCouponOrder couponOrder = wxOrderService.sendFreeCouponToUser(userId,tenantinfo, _lcc.getCouponId(), null,EnumPayWay.PAY_WAY_NOT_UNPAY_SYSTEM_SEND,EnumPayVersion.NO_VERSION,null,null);
}
WxCUserBasicInfo wxCUserBasicInfo = wxCUserBasicInfoMapper.selectById(userId,tenantinfo.getFinalTenantId());
wxCUserBasicInfo.setLastChangeCouponPoins(wlc.getPoints());
wxCUserBasicInfo.setPoinsChangeCoupons("升级到["+wlc.getLevel()+"]送券成功.");
wxCUserBasicInfoMapper.updatePoinsChangeCoupon(wxCUserBasicInfo);
userLastChangeScore = wlc.getPoints();
}
}
}
}
}
}


@@ -495,27 +539,27 @@ public class WxScoreRulesServiceImpl implements WxScoreRulesService {
return userInfo.getPoins();
}

private int memReduceScore(TenantEntity tenantEntity,WxCUserBasicInfo userInfo, String reason, Integer scoreNum) {
int score = userInfo.getPoins() - scoreNum;
// 1. update score/ 修改basic表积分
userInfo.setPoins(scoreNum);
wxCUserBasicInfoMapper.updateDownScore(userInfo);
// 2. 修改 c_user表积分 score
// if (userInfo.getPhone() != null) {
// WxCUser wxCUser = new WxCUser();
// wxCUser.setId(userInfo.getId());
// wxCUser.updateTenantInfo(userInfo);
// wxCUser.setPhone(userInfo.getPhone());
// wxCUser.setScore(score);
// wxCUserService.saveOrUpdate(wxCUser);;
// }
// 2. 记录历史
recordReduceScoreHistory(tenantEntity,scoreNum, reason, userInfo.getId(), EnumScoreType.MEM_REDUCE);
return score;
}
// private int memReduceScore(TenantEntity tenantEntity,WxCUserBasicInfo userInfo, String reason, Integer scoreNum) {
// int score = userInfo.getPoins() - scoreNum;
//
// // 1. update score/ 修改basic表积分
// userInfo.setPoins(scoreNum);
// wxCUserBasicInfoMapper.updateDownScore(userInfo);
//
// // 2. 修改 c_user表积分 score
//// if (userInfo.getPhone() != null) {
//// WxCUser wxCUser = new WxCUser();
//// wxCUser.setId(userInfo.getId());
//// wxCUser.updateTenantInfo(userInfo);
//// wxCUser.setPhone(userInfo.getPhone());
//// wxCUser.setScore(score);
//// wxCUserService.saveOrUpdate(wxCUser);;
//// }
//
// // 2. 记录历史
// recordReduceScoreHistory(tenantEntity,scoreNum, reason, userInfo.getId(), EnumScoreType.MEM_REDUCE);
// return score;
// }

private void recordScoreHistory(TenantEntity tenantEntity,WxCUserBasicInfo userInfo, EnumScoreType wechatPhone) {
final IdWorker idWorker = IdWorker.get();
@@ -675,24 +719,24 @@ public class WxScoreRulesServiceImpl implements WxScoreRulesService {
return 0;
}

@Override
public int reduceScore(TenantEntity tenantEntity,EnumScoreType scoreType, Object param1, Object param2, Object param3) {
WxCUserBasicInfo user = (WxCUserBasicInfo) param1;
if (user != null && user.getStatus().equals(EnumCUserBasicInfoStatus.LOCKED.getCode())) {
logger.info("会员权益被锁定:cUserId:" + user.getId());
return 0;
}
switch (scoreType){
case MEM_REDUCE: {
String reason = (String)param2;
Integer scoreNum = (Integer)param3;
return memReduceScore(tenantEntity,user, reason, scoreNum);
}
default:
break;
}
return 0;
}
// @Override
// public int reduceScore(TenantEntity tenantEntity,EnumScoreType scoreType, Object param1, Object param2, Object param3) {
// WxCUserBasicInfo user = (WxCUserBasicInfo) param1;
// if (user != null && user.getStatus().equals(EnumCUserBasicInfoStatus.LOCKED.getCode())) {
// logger.info("会员权益被锁定:cUserId:" + user.getId());
// return 0;
// }
// switch (scoreType){
// case MEM_REDUCE: {
// String reason = (String)param2;
// Integer scoreNum = (Integer)param3;
// return memReduceScore(tenantEntity,user, reason, scoreNum);
// }
// default:
// break;
// }
// return 0;
// }

@Override
public List<WxScoreRules> findList(WxScoreRules wxScoreRules) {


+ 20
- 9
mallinkService/src/main/resources/mapper/WxCUserBasicInfoMapper.xml View File

@@ -13,6 +13,8 @@
<result column="email" jdbcType="VARCHAR" property="email"/>
<result column="address" jdbcType="VARCHAR" property="address"/>
<result column="poins" jdbcType="INTEGER" property="poins"/>
<result column="last_change_coupon_poins" jdbcType="INTEGER" property="lastChangeCouponPoins"/>
<result column="poins_change_coupons" jdbcType="VARCHAR" property="poinsChangeCoupons"/>
<result column="tag_id" jdbcType="BIGINT" property="tagId"/>
<result column="create_date" jdbcType="TIMESTAMP" property="createDate"/>
<result column="update_date" jdbcType="TIMESTAMP" property="updateDate"/>
@@ -34,8 +36,8 @@

<sql id="allColumns">
wcubi.`id`,wcubi.`phone`,wcubi.`birthdate`,wcubi.`education`,wcubi.`sex`,wcubi.`height`,wcubi.`weight`,wcubi.`id_card`,wcubi.`email`,
wcubi.`address`,wcubi.`poins`,wcubi.`tag_id`,wcubi.`create_date`,wcubi.`update_date`,
wcubi.`final_tenant_id`,wcubi.`tenant_id`,wcubi.`parent_tenant_id`,wcubi.`name`,wcubi.`nick_name`,
wcubi.`address`,wcubi.`poins`,wcubi.`last_change_coupon_poins`,wcubi.`poins_change_coupons`,wcubi.`tag_id`,wcubi.`create_date`,
wcubi.`update_date`,wcubi.`final_tenant_id`,wcubi.`tenant_id`,wcubi.`parent_tenant_id`,wcubi.`name`,wcubi.`nick_name`,
wcubi.`avatar_url`,wcubi.`credit`,wcubi.`active_time`,wcubi.`locate_city`,wcubi.`login_count`,wcubi.`act_record`,
wcubi.score_date,wcubi.status
</sql>
@@ -167,8 +169,13 @@
set poins = #{poins}
where id = #{id}
</update>

<update id="updateUpScore" parameterType="com.iformall.domain.po.WxCUserBasicInfo">
<update id="updatePoinsChangeCoupon" parameterType="com.iformall.domain.po.WxCUserBasicInfo">
update wx_c_user_basic_info set last_change_coupon_poins = #{lastChangeCouponPoins},poins_change_coupons = #{poinsChangeCoupons}
where id = #{id}
</update>
<!-- <update id="updateUpScore" parameterType="com.iformall.domain.po.WxCUserBasicInfo">
update wx_c_user_basic_info
set poins = poins+#{poins}
where id = #{id}
@@ -177,7 +184,7 @@
update wx_c_user_basic_info
set poins = poins-#{poins}
where id = #{id}
</update>
</update> -->

<update id="updateNewId" parameterType="com.iformall.domain.vo.CUserBaseVo">
update wx_c_user_basic_info
@@ -258,8 +265,9 @@
</select>

<sql id="allColumnsOfScoreList">
wcubi.id,wcubi.phone,wcubi.birthdate,wcubi.education,wcubi.sex,wcubi.`height`,wcubi.`weight`,wcubi.`id_card`,wcubi.email,wcubi.address,wcubi.poins,wcubi.tag_id,
wcubi.create_date,wcubi.update_date,wcubi.name,wcubi.level,wcubi.nick_name,wcubi.score_date,wcubi.final_tenant_id
wcubi.id,wcubi.phone,wcubi.birthdate,wcubi.education,wcubi.sex,wcubi.`height`,wcubi.`weight`,wcubi.`id_card`,wcubi.email,wcubi.address,
wcubi.poins,wcubi.`last_change_coupon_poins`,wcubi.`poins_change_coupons`,wcubi.tag_id,wcubi.create_date,wcubi.update_date,wcubi.name,
wcubi.level,wcubi.nick_name,wcubi.score_date,wcubi.final_tenant_id
</sql>

<select id="findListByScore" parameterType="com.iformall.domain.dto.WxCUserBasicInfoDto" resultMap="BaseResultMap">
@@ -359,6 +367,8 @@
<result column="email" jdbcType="VARCHAR" property="email"/>
<result column="address" jdbcType="VARCHAR" property="address"/>
<result column="poins" jdbcType="INTEGER" property="poins"/>
<result column="last_change_coupon_poins" jdbcType="INTEGER" property="lastChangeCouponPoins"/>
<result column="poins_change_coupons" jdbcType="VARCHAR" property="poinsChangeCoupons"/>
<result column="tag_id" jdbcType="BIGINT" property="tagId"/>
<result column="create_date" jdbcType="TIMESTAMP" property="createDate"/>
<result column="update_date" jdbcType="TIMESTAMP" property="updateDate"/>
@@ -451,8 +461,9 @@

<select id="findVoList" parameterType="com.iformall.domain.po.WxCUserBasicInfo" resultMap="VoBaseResultMap">
select
wcubi.`id`,wcubi.`name`,wcubi.`sex`,wcubi.`height`,wcubi.`weight`,wcubi.`id_card`,wcubi.`phone`,wcubi.`nick_name`,wcubi.`education`,wcubi.`birthdate`,wcubi.`address`,
wcubi.`active_time`,wcubi.`create_date`,wcubi.`poins`,wcubi.`credit`,wcubi.`tag_id`
wcubi.`id`,wcubi.`name`,wcubi.`sex`,wcubi.`height`,wcubi.`weight`,wcubi.`id_card`,wcubi.`phone`,wcubi.`nick_name`,
wcubi.`education`,wcubi.`birthdate`,wcubi.`address`,wcubi.`active_time`,wcubi.`create_date`,wcubi.`poins`,
wcubi.`last_change_coupon_poins`,wcubi.`poins_change_coupons`,wcubi.`credit`,wcubi.`tag_id`
from wx_c_user_basic_info wcubi
<include refid="dynamicVoWhereConditions"/>
<if test=" null != begin ">


+ 52
- 0
mallinkService/src/main/resources/mapper/WxLevelConfigCouponMapper.xml View File

@@ -0,0 +1,52 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.iformall.mapper.WxLevelConfigCouponMapper">
<resultMap id="BaseResultMap" type="com.iformall.domain.po.WxLevelConfigCoupon">
<id column="id" jdbcType="BIGINT" property="id"/>
<result column="tenant_id" jdbcType="VARCHAR" property="tenantId"/>
<result column="level_id" jdbcType="BIGINT" property="levelId"/>
<result column="coupon_id" jdbcType="BIGINT" property="couponId"/>
<result column="create_date" jdbcType="TIMESTAMP" property="createDate"/>
<result column="update_date" jdbcType="TIMESTAMP" property="updateDate"/>
</resultMap>

<sql id="allColumns">
`id`, `tenant_id`, `level_id`, `coupon_id`, `create_date`, `update_date`
</sql>

<sql id="dynamicWhereConditions">
where `tenant_id` = #{finalTenantId}

<if test=" null != id ">
and `id` = #{id}
</if>

<if test=" null != levelId ">
and `level_id` = #{levelId}
</if>

<if test=" null != couponId ">
and `coupon_id` = #{couponId}
</if>

<if test=" null != ids ">
and id in
<foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")">
#{idItem}
</foreach>
</if>
<if test=" null != sortColumns">order by ${sortColumns}</if>
</sql>

<select id="findList" parameterType="com.iformall.domain.po.WxLevelConfigCoupon" resultMap="BaseResultMap">
select
<include refid="allColumns"/>
from wx_level_config_coupon
<include refid="dynamicWhereConditions"/>
</select>

<delete id="deleteByConfig" parameterType="com.iformall.domain.po.WxLevelConfigCoupon">
delete from wx_level_config_coupon where `tenant_id` = #{tenantId} and level_id = #{levelId}
</delete>

</mapper>

Loading…
Cancel
Save