From 699099b63706ced6bb24d3a923d3c3576d4dbfa2 Mon Sep 17 00:00:00 2001 From: winter Date: Mon, 13 May 2024 22:37:11 +0800 Subject: [PATCH] fix --- .../datatower/WxUserStructureController.java | 118 +++++----- .../resources/db/migration/V202405004.sql | 205 +++++++++++++++++- .../iformall/domain/po/WxCUserBasicInfo.java | 6 + .../com/iformall/domain/po/WxLevelConfig.java | 4 + .../domain/po/WxLevelConfigCoupon.java | 28 +++ .../mapper/WxCUserBasicInfoMapper.java | 6 +- .../mapper/WxLevelConfigCouponMapper.java | 15 ++ .../iformall/service/WxScoreRulesService.java | 4 +- .../impl/WxLevelConfigServiceImpl.java | 33 +++ .../service/impl/WxScoreRulesServiceImpl.java | 188 ++++++++++------ .../mapper/WxCUserBasicInfoMapper.xml | 29 ++- .../mapper/WxLevelConfigCouponMapper.xml | 52 +++++ 12 files changed, 543 insertions(+), 145 deletions(-) create mode 100644 mallinkService/src/main/java/com/iformall/domain/po/WxLevelConfigCoupon.java create mode 100644 mallinkService/src/main/java/com/iformall/mapper/WxLevelConfigCouponMapper.java create mode 100644 mallinkService/src/main/resources/mapper/WxLevelConfigCouponMapper.xml diff --git a/mallinkAdmin/src/main/java/com/iformall/controller/datatower/WxUserStructureController.java b/mallinkAdmin/src/main/java/com/iformall/controller/datatower/WxUserStructureController.java index ce6165ae4..faa444998 100644 --- a/mallinkAdmin/src/main/java/com/iformall/controller/datatower/WxUserStructureController.java +++ b/mallinkAdmin/src/main/java/com/iformall/controller/datatower/WxUserStructureController.java @@ -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 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 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(); +// } } diff --git a/mallinkAdmin/src/main/resources/db/migration/V202405004.sql b/mallinkAdmin/src/main/resources/db/migration/V202405004.sql index 7442fb60d..5de5c9c2a 100644 --- a/mallinkAdmin/src/main/resources/db/migration/V202405004.sql +++ b/mallinkAdmin/src/main/resources/db/migration/V202405004.sql @@ -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`; \ No newline at end of file +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; \ No newline at end of file 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 aa9e41aa4..1d2c65dfc 100644 --- a/mallinkService/src/main/java/com/iformall/domain/po/WxCUserBasicInfo.java +++ b/mallinkService/src/main/java/com/iformall/domain/po/WxCUserBasicInfo.java @@ -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; diff --git a/mallinkService/src/main/java/com/iformall/domain/po/WxLevelConfig.java b/mallinkService/src/main/java/com/iformall/domain/po/WxLevelConfig.java index 5e4730b04..4adb96f7f 100644 --- a/mallinkService/src/main/java/com/iformall/domain/po/WxLevelConfig.java +++ b/mallinkService/src/main/java/com/iformall/domain/po/WxLevelConfig.java @@ -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 coupons; } diff --git a/mallinkService/src/main/java/com/iformall/domain/po/WxLevelConfigCoupon.java b/mallinkService/src/main/java/com/iformall/domain/po/WxLevelConfigCoupon.java new file mode 100644 index 000000000..9cc87535c --- /dev/null +++ b/mallinkService/src/main/java/com/iformall/domain/po/WxLevelConfigCoupon.java @@ -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; +} diff --git a/mallinkService/src/main/java/com/iformall/mapper/WxCUserBasicInfoMapper.java b/mallinkService/src/main/java/com/iformall/mapper/WxCUserBasicInfoMapper.java index 8febc7e6f..072340471 100644 --- a/mallinkService/src/main/java/com/iformall/mapper/WxCUserBasicInfoMapper.java +++ b/mallinkService/src/main/java/com/iformall/mapper/WxCUserBasicInfoMapper.java @@ -27,9 +27,11 @@ public interface WxCUserBasicInfoMapper extends CommonMapper { + + List findList(WxLevelConfigCoupon wxLevelConfig); + void deleteByConfig(WxLevelConfigCoupon wxLevelConfig); +} diff --git a/mallinkService/src/main/java/com/iformall/service/WxScoreRulesService.java b/mallinkService/src/main/java/com/iformall/service/WxScoreRulesService.java index f4e150be4..8db607e97 100644 --- a/mallinkService/src/main/java/com/iformall/service/WxScoreRulesService.java +++ b/mallinkService/src/main/java/com/iformall/service/WxScoreRulesService.java @@ -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 findList(WxScoreRules wxScoreRules); diff --git a/mallinkService/src/main/java/com/iformall/service/impl/WxLevelConfigServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/impl/WxLevelConfigServiceImpl.java index 7787898d4..11edca80a 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxLevelConfigServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxLevelConfigServiceImpl.java @@ -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()); } 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 252913895..e4e9f328c 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxScoreRulesServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxScoreRulesServiceImpl.java @@ -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 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 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 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 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 findList(WxScoreRules wxScoreRules) { diff --git a/mallinkService/src/main/resources/mapper/WxCUserBasicInfoMapper.xml b/mallinkService/src/main/resources/mapper/WxCUserBasicInfoMapper.xml index cc02c5cff..fa2a8baca 100644 --- a/mallinkService/src/main/resources/mapper/WxCUserBasicInfoMapper.xml +++ b/mallinkService/src/main/resources/mapper/WxCUserBasicInfoMapper.xml @@ -13,6 +13,8 @@ + + @@ -34,8 +36,8 @@ 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 @@ -167,8 +169,13 @@ set poins = #{poins} where id = #{id} - - + + + update wx_c_user_basic_info set last_change_coupon_poins = #{lastChangeCouponPoins},poins_change_coupons = #{poinsChangeCoupons} + where id = #{id} + + + update wx_c_user_basic_info @@ -258,8 +265,9 @@ - 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 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 diff --git a/mallinkService/src/main/resources/mapper/WxLevelConfigCouponMapper.xml b/mallinkService/src/main/resources/mapper/WxLevelConfigCouponMapper.xml new file mode 100644 index 000000000..e6e1e4f37 --- /dev/null +++ b/mallinkService/src/main/resources/mapper/WxLevelConfigCouponMapper.xml @@ -0,0 +1,52 @@ + + + + + + + + + + + + + + `id`, `tenant_id`, `level_id`, `coupon_id`, `create_date`, `update_date` + + + + where `tenant_id` = #{finalTenantId} + + + and `id` = #{id} + + + + and `level_id` = #{levelId} + + + + and `coupon_id` = #{couponId} + + + + and id in + + #{idItem} + + + order by ${sortColumns} + + + + + + delete from wx_level_config_coupon where `tenant_id` = #{tenantId} and level_id = #{levelId} + + +