| @@ -51,7 +51,7 @@ public class WxMallDisposeController extends BaseController { | |||||
| return new ResultData(page); | return new ResultData(page); | ||||
| } | } | ||||
| @ApiOperation("分页列表接口") | |||||
| @ApiOperation("查询配置") | |||||
| @GetMapping("getMallDispose") | @GetMapping("getMallDispose") | ||||
| @SystemControllerLog(description = "列表") | @SystemControllerLog(description = "列表") | ||||
| public ResultData getMallDispose() { | public ResultData getMallDispose() { | ||||
| @@ -109,7 +109,7 @@ public class WxCreditHistoryController extends BaseController { | |||||
| wxCreditHistory.setChangePurpose(desc); | wxCreditHistory.setChangePurpose(desc); | ||||
| try { | try { | ||||
| wxCreditHistoryService.creditUsercheck(wxCreditHistory.getCUserId(),getTenantInfo()) ; | wxCreditHistoryService.creditUsercheck(wxCreditHistory.getCUserId(),getTenantInfo()) ; | ||||
| WxCreditHistory credit = wxCreditHistoryService.saveOrUpdate(wxCreditHistory,getTenantInfo().getTenantId()); | |||||
| WxCreditHistory credit = wxCreditHistoryService.saveOrUpdate(wxCreditHistory,getTenantInfo()); | |||||
| return new ResultData(Result.SUCCESS, "操作成功", credit); | return new ResultData(Result.SUCCESS, "操作成功", credit); | ||||
| } catch (MallinkException e) { | } catch (MallinkException e) { | ||||
| logger.error(e.getMessage()); | logger.error(e.getMessage()); | ||||
| @@ -5,11 +5,14 @@ import com.iformall.common.ErrorCode; | |||||
| import com.iformall.common.ResultData; | import com.iformall.common.ResultData; | ||||
| import com.iformall.controller.base.BaseController; | import com.iformall.controller.base.BaseController; | ||||
| import com.iformall.domain.po.WxMall; | import com.iformall.domain.po.WxMall; | ||||
| import com.iformall.domain.po.WxMallDispose; | |||||
| import com.iformall.domain.po.WxScoreRules; | import com.iformall.domain.po.WxScoreRules; | ||||
| import com.iformall.domain.po.base.TenantEntity; | import com.iformall.domain.po.base.TenantEntity; | ||||
| import com.iformall.enums.EnumCreditLockedStatus; | import com.iformall.enums.EnumCreditLockedStatus; | ||||
| import com.iformall.enums.EnumGroupSupport; | import com.iformall.enums.EnumGroupSupport; | ||||
| import com.iformall.enums.EnumMallDispose; | |||||
| import com.iformall.enums.EnumScoreRules; | import com.iformall.enums.EnumScoreRules; | ||||
| import com.iformall.service.WxMallDisposeService; | |||||
| import com.iformall.service.WxMallService; | import com.iformall.service.WxMallService; | ||||
| import com.iformall.service.WxScoreRulesService; | import com.iformall.service.WxScoreRulesService; | ||||
| import io.swagger.annotations.Api; | import io.swagger.annotations.Api; | ||||
| @@ -26,20 +29,23 @@ import org.springframework.web.bind.annotation.*; | |||||
| public class WxScoreRulesController extends BaseController { | public class WxScoreRulesController extends BaseController { | ||||
| private final Logger logger = LoggerFactory.getLogger(this.getClass()); | private final Logger logger = LoggerFactory.getLogger(this.getClass()); | ||||
| @Autowired | |||||
| private WxMallDisposeService wxMallDisposeService; | |||||
| @Autowired | @Autowired | ||||
| private WxScoreRulesService wxScoreRulesService; | private WxScoreRulesService wxScoreRulesService; | ||||
| @Autowired | @Autowired | ||||
| private WxMallService wxMallService; | private WxMallService wxMallService; | ||||
| @ApiOperation("成长值配置") | |||||
| @ApiOperation("获取成长值配置") | |||||
| @GetMapping("setting") | @GetMapping("setting") | ||||
| @SystemControllerLog(description = "成长值-配置") | @SystemControllerLog(description = "成长值-配置") | ||||
| public ResultData list() { | |||||
| logger.debug("[" + getIpAddr() + "] WxScoreRulesController::list"); | |||||
| public ResultData setting() { | |||||
| logger.debug("[" + getIpAddr() + "] WxScoreRulesController::setting"); | |||||
| WxScoreRules scoreRules = wxScoreRulesService.getScoreRules(getTenantInfo()); | WxScoreRules scoreRules = wxScoreRulesService.getScoreRules(getTenantInfo()); | ||||
| if (scoreRules.getCreditLocked() == null) { | |||||
| scoreRules.setCreditLocked(EnumCreditLockedStatus.OPEN.getCode()); | |||||
| if(getUser().getTenantId().equals(scoreRules.getTenantId())){ | |||||
| scoreRules.setEditable(true); | |||||
| } | } | ||||
| return new ResultData(scoreRules); | return new ResultData(scoreRules); | ||||
| } | } | ||||
| @@ -49,50 +55,56 @@ public class WxScoreRulesController extends BaseController { | |||||
| @SystemControllerLog(description = "成长值-积分-配置-新增") | @SystemControllerLog(description = "成长值-积分-配置-新增") | ||||
| public ResultData add(@RequestBody WxScoreRules wxScoreRules) { | public ResultData add(@RequestBody WxScoreRules wxScoreRules) { | ||||
| logger.debug("[" + getIpAddr() + "] WxScoreRulesController::add"); | logger.debug("[" + getIpAddr() + "] WxScoreRulesController::add"); | ||||
| if(wxScoreRules.getType() != null){ | |||||
| if(wxScoreRules.getType().equals(EnumScoreRules.SCORE.getCode()) || wxScoreRules.getType().equals(EnumScoreRules.CREDIT.getCode())){ | |||||
| TenantEntity tenantEntity = getTenantInfo(); | |||||
| if (StringUtils.isNotBlank(tenantEntity.getParentTenantId())) { | |||||
| return new ResultData(ErrorCode.USER_NO_PERMISSION.getCode(), "子广场用户无此权限"); | |||||
| } | |||||
| wxScoreRules.updateTenantInfo(tenantEntity); | |||||
| }else if(wxScoreRules.getType().equals(EnumScoreRules.CREDIT_DOUBLE.getCode())){ | |||||
| TenantEntity tenantEntity = getTenantInfo(); | |||||
| if(wxMallService.isgroupSupport(tenantEntity)){ | |||||
| return new ResultData(ErrorCode.USER_NO_PERMISSION.getCode(), "集团用户无此权限"); | |||||
| } | |||||
| wxScoreRules.updateTenantInfo(tenantEntity); | |||||
| }else{ | |||||
| return new ResultData(ErrorCode.SYS_PARAMETER_ERROR,"type"); | |||||
| } | |||||
| }else{ | |||||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL,"type"); | |||||
| if(wxScoreRules.getId() == null){ | |||||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(),"id 为空"); | |||||
| } | |||||
| WxScoreRules record = wxScoreRulesService.getById(wxScoreRules.getId()); | |||||
| if(record == null){ | |||||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(),"当前未查询到数据"); | |||||
| } | |||||
| if(!getUser().getTenantId().equals(record.getTenantId())){ | |||||
| return new ResultData(ErrorCode.SYS_AUTH_ERROR.getCode(),"当前没有权限修改"); | |||||
| } | |||||
| if(wxScoreRules.getType() == null){ | |||||
| wxScoreRules.setType(record.getType()); | |||||
| // return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(),"type 为空"); | |||||
| } | |||||
| EnumScoreRules ScoreRulesEnum = EnumScoreRules.getEnum(wxScoreRules.getType()); | |||||
| if(ScoreRulesEnum == null){ | |||||
| return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(),"type 不符合规范"); | |||||
| } | |||||
| if(StringUtils.isBlank(wxScoreRules.getRules())){ | |||||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL,"规则 为空"); | |||||
| } | } | ||||
| if (!wxScoreRules.checkRules()) { | if (!wxScoreRules.checkRules()) { | ||||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(),"规则内容有项重复"); | |||||
| return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(),"规则内容有项重复"); | |||||
| } | } | ||||
| wxScoreRulesService.saveOrUpdate(wxScoreRules); | wxScoreRulesService.saveOrUpdate(wxScoreRules); | ||||
| return new ResultData(); | return new ResultData(); | ||||
| } | } | ||||
| @ApiOperation("积分配置") | |||||
| @ApiOperation("获取积分配置") | |||||
| @GetMapping("/credit_rules") | @GetMapping("/credit_rules") | ||||
| @SystemControllerLog(description = "积分-配置") | @SystemControllerLog(description = "积分-配置") | ||||
| public ResultData creditRulesList() { | public ResultData creditRulesList() { | ||||
| logger.debug("[" + getIpAddr() + "] creditRulesList::list"); | |||||
| WxScoreRules scoreRules = wxScoreRulesService.getCreditRules(getTenantInfo().getFinalTenantId()); | |||||
| logger.debug("[" + getIpAddr() + "] creditRulesList::credit_rules"); | |||||
| WxScoreRules scoreRules = wxScoreRulesService.getCreditRules(getTenantInfo()); | |||||
| if(getUser().getTenantId().equals(scoreRules.getTenantId())){ | |||||
| scoreRules.setEditable(true); | |||||
| } | |||||
| return new ResultData(scoreRules); | return new ResultData(scoreRules); | ||||
| } | } | ||||
| @ApiOperation("积分倍率") | |||||
| @ApiOperation("获取积分倍率设置") | |||||
| @GetMapping("/credit_double") | @GetMapping("/credit_double") | ||||
| @SystemControllerLog(description = "积分-配置") | @SystemControllerLog(description = "积分-配置") | ||||
| public ResultData creditDoubleRulesList() { | public ResultData creditDoubleRulesList() { | ||||
| logger.debug("[" + getIpAddr() + "] creditDoubleRulesList::list"); | logger.debug("[" + getIpAddr() + "] creditDoubleRulesList::list"); | ||||
| if(wxMallService.isgroupSupport(getUser())){ | |||||
| return new ResultData(ErrorCode.USER_NO_PERMISSION.getCode(), "集团用户无此权限"); | |||||
| WxScoreRules scoreRules = wxScoreRulesService.getCreditDoubleRules(getTenantInfo()); | |||||
| if(getUser().getTenantId().equals(scoreRules.getTenantId())){ | |||||
| scoreRules.setEditable(true); | |||||
| } | } | ||||
| WxScoreRules scoreRules = wxScoreRulesService.getCreditDoubleRules(getTenantInfo().getTenantId()); | |||||
| return new ResultData(scoreRules); | return new ResultData(scoreRules); | ||||
| } | } | ||||
| @@ -0,0 +1,41 @@ | |||||
| UPDATE `mallink`.`mall_permission` SET `name` = '用户趋势',`url` = 'yonghuShuliang' WHERE `id` = 502; | |||||
| INSERT INTO `mallink`.`mall_permission`(`id`, `name`, `parent_id`, `available`, `permission`, `resource_type`, `module_color`, `module_color_num`, `url`, `icon`, `version_type`, `sort`) VALUES (5502, '会员趋势', 5, 'Y', NULL, 1, NULL, NULL, 'huiyuanShuliang', 'icon-yonghuguanli2', 0, 502); | |||||
| UPDATE `mallink`.`mall_sale_type` SET `menus` = '[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 50, 101, 102, 103, 104, 105, 106, 107, 108, 109, 201, 202, 203, 204, 205, 206, 209, 210, 211, 212, 221, 222, 224, 225, 251, 261, 299, 300, 301, 302, 303, 304, 305, 306, 401, 402, 403, 404, 405, 406, 407, 408, 409, 410, 411, 412, 413, 414, 415, 416, 417, 418, 420, 421, 422, 431, 432, 501, 502, 503, 504, 505, 506, 507, 508, 509, 511, 512, 513, 514, 521, 522, 523, 531, 532, 533, 591, 592, 595, 601, 602, 603, 604, 605, 606, 607, 608, 609, 610, 611, 612, 613, 616, 621, 622, 623, 624, 625, 626, 627, 641, 642, 643, 644, 645, 646, 651, 652, 661, 662, 663, 664, 665, 666, 671, 672, 673, 674, 675, 681, 682, 683, 684, 685, 687, 691, 692, 693, 694, 695, 701, 702, 703, 704, 711, 713, 714, 715, 901, 902, 903, 904, 905, 906, 907, 908, 910, 931, 932, 951, 952, 961, 962, 963, 965, 966, 967, 968, 1001, 1002, 1003, 1004, 1005, 1006, 1007, 1008, 1009, 1010, 1011, 1012, 1013, 1014, 1015, 1016, 1017, 5502, 6610, 6611, 41701, 41702, 60701, 60702, 61201]' WHERE `id` = 1; | |||||
| UPDATE `mallink`.`mall_sale_type` SET `menus` = '[1, 2, 4, 5, 6, 7, 8, 9, 10, 50, 101, 102, 103, 104, 105, 106, 107, 201, 202, 203, 204, 205, 209, 210, 211, 212, 221, 222, 224, 225, 251, 261, 409, 410, 411, 416, 418, 420, 421, 501, 502, 503, 504, 505, 506, 507, 508, 509, 511, 512, 513, 514, 521, 522, 523, 531, 532, 533, 591, 592, 595, 601, 602, 603, 604, 605, 606, 607, 608, 609, 610, 611, 612, 613, 616, 621, 622, 623, 624, 625, 626, 627, 641, 642, 643, 644, 645, 646, 651, 652, 661, 662, 663, 664, 665, 666, 671, 672, 673, 674, 675, 681, 682, 683, 684, 685, 691, 692, 693, 694, 695, 701, 702, 703, 704, 711, 713, 714, 715, 901, 902, 903, 904, 905, 906, 907, 908, 910, 931, 932, 951, 961, 5502, 6610, 6611, 60701, 60702, 61201]' WHERE `id` = 2; | |||||
| UPDATE `mallink`.`mall_sale_type` SET `menus` = '[2, 4, 5, 6, 7, 10, 50, 201, 202, 205, 210, 211, 212, 221, 222, 224, 225, 251, 261, 409, 410, 411, 416, 418, 501, 502, 503, 504, 505, 506, 507, 508, 511, 512, 513, 514, 521, 522, 523, 531, 532, 533, 591, 592, 601, 602, 603, 604, 605, 606, 607, 608, 609, 610, 611, 612, 613, 621, 622, 623, 624, 625, 626, 641, 642, 643, 644, 645, 646, 651, 652, 661, 662, 663, 664, 671, 672, 673, 674, 675, 681, 682, 683, 684, 685, 691, 692, 693, 694, 695, 701, 702, 703, 704, 711, 713, 715, 901, 902, 903, 904, 905, 906, 907, 908, 910, 931, 932, 5502, 60701, 60702, 61201]' WHERE `id` = 3; | |||||
| UPDATE `mallink`.`mall_sale_type` SET `menus` = '[2, 4, 5, 6, 7, 10, 50, 201, 202, 205, 210, 211, 212, 221, 222, 224, 251, 261, 409, 410, 411, 416, 418, 501, 502, 503, 504, 505, 506, 507, 508, 511, 512, 513, 514, 521, 522, 523, 531, 532, 591, 601, 602, 604, 605, 606, 607, 608, 610, 611, 612, 613, 622, 623, 624, 625, 626, 641, 642, 643, 644, 661, 662, 663, 664, 671, 672, 674, 675, 681, 682, 684, 685, 691, 692, 693, 694, 695, 711, 901, 902, 904, 905, 906, 907, 908, 910, 931, 932, 5502, 60701, 60702, 61201]' WHERE `id` = 4; | |||||
| UPDATE `mallink`.`mall_sale_type` SET `menus` = '[1, 2, 4, 5, 6, 50, 105, 110, 201, 205, 202, 210, 211, 212, 221, 222, 223, 224, 251, 261, 409, 410, 411, 416, 500, 502, 504, 505, 506, 507, 511, 512, 521, 522, 523, 591, 592, 595, 601, 602, 605, 606, 610, 612, 615, 622, 647, 676, 680, 711, 901, 902, 904, 907, 5502, 61202, 61501, 61502]' WHERE `id` = 11; | |||||
| UPDATE `mallink`.`mall_sale_type` SET `menus` = '[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 50, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 201, 202, 203, 204, 205, 206, 209, 210, 211, 212, 221, 222, 223, 224, 225, 251, 261, 299, 300, 301, 302, 303, 304, 305, 306, 401, 402, 403, 404, 405, 406, 407, 408, 409, 410, 411, 412, 413, 414, 415, 416, 417, 418, 420, 421, 422, 431, 432, 500, 501, 502, 503, 504, 505, 506, 507, 508, 509, 511, 512, 513, 514, 521, 522, 523, 531, 532, 533, 591, 592, 595, 601, 602, 603, 604, 605, 606, 607, 608, 609, 610, 611, 612, 613, 615, 616, 621, 622, 623, 624, 625, 626, 627, 641, 642, 643, 644, 645, 646, 647, 651, 652, 661, 662, 663, 664, 665, 666, 671, 672, 673, 674, 675, 676, 680, 681, 682, 683, 684, 685, 687, 691, 692, 693, 694, 695, 701, 702, 703, 704, 711, 713, 714, 715, 901, 902, 903, 904, 905, 906, 907, 908, 910, 931, 932, 951, 952, 961, 962, 963, 965, 966, 967, 968, 1001, 1002, 1003, 1004, 1005, 1006, 1007, 1008, 1009, 1010, 1011, 1012, 1013, 1014, 1015, 1016, 1017, 5502, 6610, 6611, 41701, 41702, 60701, 60702, 61201, 61202, 61501, 61502]' WHERE `id` = 12; | |||||
| UPDATE `mallink`.`mall_sale_type` SET `menus` = '[1, 2, 5, 6, 8, 10, 50, 101, 102, 104, 105, 106, 108, 109, 203, 204, 206, 207, 501, 502, 503, 504, 505, 506, 507, 511, 512, 522, 523, 509, 591, 595, 601, 605, 621, 622, 623, 624, 625, 626, 627, 671, 901, 902, 5502]' WHERE `id` = 100; | |||||
| UPDATE `mallink`.`mall_sale_type` SET `menus` = '[1, 2, 4, 5, 6, 50, 105, 110, 201, 205, 202, 211, 212, 221, 222, 223, 224, 251, 409, 410, 411, 416, 500, 502, 504, 505, 506, 507, 511, 512, 521, 522, 523, 591, 592, 595, 601, 602, 605, 606, 610, 615, 622, 648, 649, 676, 680, 711, 901, 902, 904, 907, 5502, 61501, 61502]' WHERE `id` = 101; | |||||
| UPDATE `mallink`.`mall_sale_type` SET `menus` = '[1, 2, 4, 5, 6, 50, 105, 110, 201, 205, 202, 210, 211, 212, 221, 222, 223, 224, 251, 261, 409, 410, 411, 416, 500, 504, 505, 506, 507, 511, 512, 521, 522, 523, 591, 592, 595, 601, 602, 605, 606, 610, 612, 615, 622, 647, 650, 676, 680, 711, 901, 902, 904, 907, 5502, 41001, 61202, 61501, 61502, 71101]' WHERE `id` = 102; | |||||
| UPDATE `mallink`.`mall_sale_type` SET `menus` = '[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 50, 101, 102, 103, 104, 105, 106, 107, 108, 109, 201, 202, 203, 204, 205, 206, 209, 210, 211, 212, 221, 222, 224, 225, 251, 261, 299, 300, 301, 302, 303, 304, 305, 306, 401, 402, 403, 404, 405, 406, 407, 408, 409, 410, 411, 412, 413, 414, 415, 416, 417, 418, 420, 421, 422, 431, 432, 501, 502, 503, 504, 505, 506, 507, 508, 509, 511, 512, 513, 514, 521, 522, 523, 531, 532, 533, 591, 592, 595, 601, 602, 603, 604, 605, 606, 607, 608, 609, 610, 611, 612, 613, 616, 621, 622, 623, 624, 625, 626, 627, 641, 642, 643, 644, 645, 646, 651, 652, 661, 662, 663, 664, 665, 666, 671, 672, 673, 674, 675, 681, 682, 683, 684, 685, 687, 691, 692, 693, 694, 695, 701, 702, 703, 704, 711, 713, 714, 715, 901, 902, 903, 904, 905, 906, 907, 910, 931, 932, 951, 952, 961, 962, 963, 965, 966, 967, 968, 1001, 1002, 1003, 1004, 1005, 1006, 1007, 1008, 1009, 1010, 1011, 1012, 1013, 1014, 1015, 1016, 1017, 5502, 6610, 6611, 41701, 41702, 60701, 60702, 61201]' WHERE `id` = 1028; | |||||
| UPDATE `mallink`.`mall_sale_type` SET `menus` = '[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 50, 101, 102, 103, 104, 105, 106, 107, 108, 109, 201, 202, 203, 204, 205, 206, 209, 210, 211, 212, 221, 222, 224, 225, 251, 261, 299, 300, 307, 308, 401, 402, 403, 404, 405, 406, 407, 408, 409, 410, 411, 412, 413, 414, 415, 416, 417, 418, 420, 421, 422, 431, 432, 501, 502, 503, 504, 505, 506, 507, 508, 509, 511, 512, 513, 514, 521, 522, 523, 531, 532, 533, 591, 592, 595, 601, 602, 603, 604, 605, 606, 607, 608, 609, 610, 611, 612, 613, 616, 621, 622, 623, 624, 625, 626, 627, 641, 642, 643, 644, 645, 646, 651, 652, 661, 662, 663, 664, 665, 666, 671, 672, 673, 674, 675, 681, 682, 683, 684, 685, 687, 691, 692, 693, 694, 695, 701, 702, 703, 704, 711, 713, 714, 715, 901, 902, 903, 904, 905, 906, 907, 908, 910, 931, 932, 951, 952, 961, 962, 963, 965, 966, 967, 968, 1001, 1002, 1003, 1004, 1005, 1006, 1007, 1008, 1009, 1010, 1011, 1012, 1013, 1014, 1015, 1016, 1017, 5502, 6610, 6611, 41701, 41702, 60701, 60702, 61201]' WHERE `id` = 1035001036; | |||||
| UPDATE `mallink`.`mall_sale_type` SET `menus` = '[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 50, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 201, 202, 203, 204, 205, 206, 209, 210, 211, 212, 221, 222, 225, 223, 224, 251, 261, 299, 300, 307, 308, 401, 402, 403, 404, 405, 406, 407, 408, 409, 410, 411, 412, 413, 414, 415, 416, 417, 418, 420, 421, 422, 431, 432, 500, 501, 502, 503, 504, 505, 506, 507, 508, 509, 511, 512, 513, 514, 521, 522, 523, 531, 532, 533, 591, 592, 595, 601, 602, 603, 604, 605, 606, 607, 608, 609, 610, 611, 612, 613, 615, 616, 621, 622, 623, 624, 625, 626, 627, 641, 642, 643, 644, 645, 646, 647, 651, 652, 661, 662, 663, 664, 665, 666, 671, 672, 673, 674, 675, 676, 680, 681, 682, 683, 684, 685, 687, 691, 692, 693, 694, 695, 701, 702, 703, 704, 711, 713, 714, 715, 901, 902, 903, 904, 905, 906, 907, 908, 910, 931, 932, 951, 952, 961, 962, 963, 965, 966, 967, 968, 1001, 1002, 1003, 1004, 1005, 1006, 1007, 1008, 1009, 1010, 1011, 1012, 1013, 1014, 1015, 1016, 1017, 5502, 6610, 6611, 41701, 41702, 60701, 60702, 61201, 61202, 61501, 61502]' WHERE `id` = 103500103610; | |||||
| --备份 | |||||
| --INSERT INTO `mallink`.`mall_permission`(`id`, `name`, `parent_id`, `available`, `permission`, `resource_type`, `module_color`, `module_color_num`, `url`, `icon`, `version_type`, `sort`) VALUES (500, '抖音用户概览', 5, 'Y', NULL, 1, NULL, NULL, 'ttuserHome', 'icon-yonghushuju', 0, 500); | |||||
| --INSERT INTO `mallink`.`mall_permission`(`id`, `name`, `parent_id`, `available`, `permission`, `resource_type`, `module_color`, `module_color_num`, `url`, `icon`, `version_type`, `sort`) VALUES (501, '用户概览', 5, 'Y', NULL, 1, NULL, NULL, 'huiyuanHome', 'icon-tubiaochicundaochuSVGshangchuandaoalibaba-', 0, 501); | |||||
| delete from `mallink`.`mall_permission` where id = 500; | |||||
| delete from `mallink`.`mall_permission` where id = 501; | |||||
| UPDATE `mallink`.`mall_sale_type` SET `menus` = '[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 50, 101, 102, 103, 104, 105, 106, 107, 108, 109, 201, 202, 203, 204, 205, 206, 209, 210, 211, 212, 221, 222, 224, 225, 251, 261, 299, 300, 301, 302, 303, 304, 305, 306, 401, 402, 403, 404, 405, 406, 407, 408, 409, 410, 411, 412, 413, 414, 415, 416, 417, 418, 420, 421, 422, 431, 432, 502, 503, 504, 505, 506, 507, 508, 509, 511, 512, 513, 514, 521, 522, 523, 531, 532, 533, 591, 592, 595, 601, 602, 603, 604, 605, 606, 607, 608, 609, 610, 611, 612, 613, 616, 621, 622, 623, 624, 625, 626, 627, 641, 642, 643, 644, 645, 646, 651, 652, 661, 662, 663, 664, 665, 666, 671, 672, 673, 674, 675, 681, 682, 683, 684, 685, 687, 691, 692, 693, 694, 695, 701, 702, 703, 704, 711, 713, 714, 715, 901, 902, 903, 904, 905, 906, 907, 908, 910, 931, 932, 951, 952, 961, 962, 963, 965, 966, 967, 968, 1001, 1002, 1003, 1004, 1005, 1006, 1007, 1008, 1009, 1010, 1011, 1012, 1013, 1014, 1015, 1016, 1017, 5502, 6610, 6611, 41701, 41702, 60701, 60702, 61201]' WHERE `id` = 1; | |||||
| UPDATE `mallink`.`mall_sale_type` SET `menus` = '[1, 2, 4, 5, 6, 7, 8, 9, 10, 50, 101, 102, 103, 104, 105, 106, 107, 201, 202, 203, 204, 205, 209, 210, 211, 212, 221, 222, 224, 225, 251, 261, 409, 410, 411, 416, 418, 420, 421, 502, 503, 504, 505, 506, 507, 508, 509, 511, 512, 513, 514, 521, 522, 523, 531, 532, 533, 591, 592, 595, 601, 602, 603, 604, 605, 606, 607, 608, 609, 610, 611, 612, 613, 616, 621, 622, 623, 624, 625, 626, 627, 641, 642, 643, 644, 645, 646, 651, 652, 661, 662, 663, 664, 665, 666, 671, 672, 673, 674, 675, 681, 682, 683, 684, 685, 691, 692, 693, 694, 695, 701, 702, 703, 704, 711, 713, 714, 715, 901, 902, 903, 904, 905, 906, 907, 908, 910, 931, 932, 951, 961, 5502, 6610, 6611, 60701, 60702, 61201]' WHERE `id` = 2; | |||||
| UPDATE `mallink`.`mall_sale_type` SET `menus` = '[2, 4, 5, 6, 7, 10, 50, 201, 202, 205, 210, 211, 212, 221, 222, 224, 225, 251, 261, 409, 410, 411, 416, 418, 502, 503, 504, 505, 506, 507, 508, 511, 512, 513, 514, 521, 522, 523, 531, 532, 533, 591, 592, 601, 602, 603, 604, 605, 606, 607, 608, 609, 610, 611, 612, 613, 621, 622, 623, 624, 625, 626, 641, 642, 643, 644, 645, 646, 651, 652, 661, 662, 663, 664, 671, 672, 673, 674, 675, 681, 682, 683, 684, 685, 691, 692, 693, 694, 695, 701, 702, 703, 704, 711, 713, 715, 901, 902, 903, 904, 905, 906, 907, 908, 910, 931, 932, 5502, 60701, 60702, 61201]' WHERE `id` = 3; | |||||
| UPDATE `mallink`.`mall_sale_type` SET `menus` = '[2, 4, 5, 6, 7, 10, 50, 201, 202, 205, 210, 211, 212, 221, 222, 224, 251, 261, 409, 410, 411, 416, 418, 502, 503, 504, 505, 506, 507, 508, 511, 512, 513, 514, 521, 522, 523, 531, 532, 591, 601, 602, 604, 605, 606, 607, 608, 610, 611, 612, 613, 622, 623, 624, 625, 626, 641, 642, 643, 644, 661, 662, 663, 664, 671, 672, 674, 675, 681, 682, 684, 685, 691, 692, 693, 694, 695, 711, 901, 902, 904, 905, 906, 907, 908, 910, 931, 932, 5502, 60701, 60702, 61201]' WHERE `id` = 4; | |||||
| UPDATE `mallink`.`mall_sale_type` SET `menus` = '[1, 2, 4, 5, 6, 50, 105, 110, 201, 205, 202, 210, 211, 212, 221, 222, 223, 224, 251, 261, 409, 410, 411, 416, 502, 504, 505, 506, 507, 511, 512, 521, 522, 523, 591, 592, 595, 601, 602, 605, 606, 610, 612, 615, 622, 647, 676, 680, 711, 901, 902, 904, 907, 5502, 61202, 61501, 61502]' WHERE `id` = 11; | |||||
| UPDATE `mallink`.`mall_sale_type` SET `menus` = '[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 50, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 201, 202, 203, 204, 205, 206, 209, 210, 211, 212, 221, 222, 223, 224, 225, 251, 261, 299, 300, 301, 302, 303, 304, 305, 306, 401, 402, 403, 404, 405, 406, 407, 408, 409, 410, 411, 412, 413, 414, 415, 416, 417, 418, 420, 421, 422, 431, 432, 502, 503, 504, 505, 506, 507, 508, 509, 511, 512, 513, 514, 521, 522, 523, 531, 532, 533, 591, 592, 595, 601, 602, 603, 604, 605, 606, 607, 608, 609, 610, 611, 612, 613, 615, 616, 621, 622, 623, 624, 625, 626, 627, 641, 642, 643, 644, 645, 646, 647, 651, 652, 661, 662, 663, 664, 665, 666, 671, 672, 673, 674, 675, 676, 680, 681, 682, 683, 684, 685, 687, 691, 692, 693, 694, 695, 701, 702, 703, 704, 711, 713, 714, 715, 901, 902, 903, 904, 905, 906, 907, 908, 910, 931, 932, 951, 952, 961, 962, 963, 965, 966, 967, 968, 1001, 1002, 1003, 1004, 1005, 1006, 1007, 1008, 1009, 1010, 1011, 1012, 1013, 1014, 1015, 1016, 1017, 5502, 6610, 6611, 41701, 41702, 60701, 60702, 61201, 61202, 61501, 61502]' WHERE `id` = 12; | |||||
| UPDATE `mallink`.`mall_sale_type` SET `menus` = '[1, 2, 5, 6, 8, 10, 50, 101, 102, 104, 105, 106, 108, 109, 203, 204, 206, 207, 502, 503, 504, 505, 506, 507, 511, 512, 522, 523, 509, 591, 595, 601, 605, 621, 622, 623, 624, 625, 626, 627, 671, 901, 902, 5502]' WHERE `id` = 100; | |||||
| UPDATE `mallink`.`mall_sale_type` SET `menus` = '[1, 2, 4, 5, 6, 50, 105, 110, 201, 205, 202, 211, 212, 221, 222, 223, 224, 251, 409, 410, 411, 416, 502, 504, 505, 506, 507, 511, 512, 521, 522, 523, 591, 592, 595, 601, 602, 605, 606, 610, 615, 622, 648, 649, 676, 680, 711, 901, 902, 904, 907, 5502, 61501, 61502]' WHERE `id` = 101; | |||||
| UPDATE `mallink`.`mall_sale_type` SET `menus` = '[1, 2, 4, 5, 6, 50, 105, 110, 201, 205, 202, 210, 211, 212, 221, 222, 223, 224, 251, 261, 409, 410, 411, 416, 504, 505, 506, 507, 511, 512, 521, 522, 523, 591, 592, 595, 601, 602, 605, 606, 610, 612, 615, 622, 647, 650, 676, 680, 711, 901, 902, 904, 907, 5502, 41001, 61202, 61501, 61502, 71101]' WHERE `id` = 102; | |||||
| UPDATE `mallink`.`mall_sale_type` SET `menus` = '[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 50, 101, 102, 103, 104, 105, 106, 107, 108, 109, 201, 202, 203, 204, 205, 206, 209, 210, 211, 212, 221, 222, 224, 225, 251, 261, 299, 300, 301, 302, 303, 304, 305, 306, 401, 402, 403, 404, 405, 406, 407, 408, 409, 410, 411, 412, 413, 414, 415, 416, 417, 418, 420, 421, 422, 431, 432, 502, 503, 504, 505, 506, 507, 508, 509, 511, 512, 513, 514, 521, 522, 523, 531, 532, 533, 591, 592, 595, 601, 602, 603, 604, 605, 606, 607, 608, 609, 610, 611, 612, 613, 616, 621, 622, 623, 624, 625, 626, 627, 641, 642, 643, 644, 645, 646, 651, 652, 661, 662, 663, 664, 665, 666, 671, 672, 673, 674, 675, 681, 682, 683, 684, 685, 687, 691, 692, 693, 694, 695, 701, 702, 703, 704, 711, 713, 714, 715, 901, 902, 903, 904, 905, 906, 907, 910, 931, 932, 951, 952, 961, 962, 963, 965, 966, 967, 968, 1001, 1002, 1003, 1004, 1005, 1006, 1007, 1008, 1009, 1010, 1011, 1012, 1013, 1014, 1015, 1016, 1017, 5502, 6610, 6611, 41701, 41702, 60701, 60702, 61201]' WHERE `id` = 1028; | |||||
| UPDATE `mallink`.`mall_sale_type` SET `menus` = '[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 50, 101, 102, 103, 104, 105, 106, 107, 108, 109, 201, 202, 203, 204, 205, 206, 209, 210, 211, 212, 221, 222, 224, 225, 251, 261, 299, 300, 307, 308, 401, 402, 403, 404, 405, 406, 407, 408, 409, 410, 411, 412, 413, 414, 415, 416, 417, 418, 420, 421, 422, 431, 432, 502, 503, 504, 505, 506, 507, 508, 509, 511, 512, 513, 514, 521, 522, 523, 531, 532, 533, 591, 592, 595, 601, 602, 603, 604, 605, 606, 607, 608, 609, 610, 611, 612, 613, 616, 621, 622, 623, 624, 625, 626, 627, 641, 642, 643, 644, 645, 646, 651, 652, 661, 662, 663, 664, 665, 666, 671, 672, 673, 674, 675, 681, 682, 683, 684, 685, 687, 691, 692, 693, 694, 695, 701, 702, 703, 704, 711, 713, 714, 715, 901, 902, 903, 904, 905, 906, 907, 908, 910, 931, 932, 951, 952, 961, 962, 963, 965, 966, 967, 968, 1001, 1002, 1003, 1004, 1005, 1006, 1007, 1008, 1009, 1010, 1011, 1012, 1013, 1014, 1015, 1016, 1017, 5502, 6610, 6611, 41701, 41702, 60701, 60702, 61201]' WHERE `id` = 1035001036; | |||||
| UPDATE `mallink`.`mall_sale_type` SET `menus` = '[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 50, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 201, 202, 203, 204, 205, 206, 209, 210, 211, 212, 221, 222, 225, 223, 224, 251, 261, 299, 300, 307, 308, 401, 402, 403, 404, 405, 406, 407, 408, 409, 410, 411, 412, 413, 414, 415, 416, 417, 418, 420, 421, 422, 431, 432, 502, 503, 504, 505, 506, 507, 508, 509, 511, 512, 513, 514, 521, 522, 523, 531, 532, 533, 591, 592, 595, 601, 602, 603, 604, 605, 606, 607, 608, 609, 610, 611, 612, 613, 615, 616, 621, 622, 623, 624, 625, 626, 627, 641, 642, 643, 644, 645, 646, 647, 651, 652, 661, 662, 663, 664, 665, 666, 671, 672, 673, 674, 675, 676, 680, 681, 682, 683, 684, 685, 687, 691, 692, 693, 694, 695, 701, 702, 703, 704, 711, 713, 714, 715, 901, 902, 903, 904, 905, 906, 907, 908, 910, 931, 932, 951, 952, 961, 962, 963, 965, 966, 967, 968, 1001, 1002, 1003, 1004, 1005, 1006, 1007, 1008, 1009, 1010, 1011, 1012, 1013, 1014, 1015, 1016, 1017, 5502, 6610, 6611, 41701, 41702, 60701, 60702, 61201, 61202, 61501, 61502]' WHERE `id` = 103500103610; | |||||
| @@ -270,7 +270,7 @@ public class WxCUserController extends BaseController { | |||||
| wxCreditHistory.setChangePurpose("商户端["+wxMerchant.getName()+"]操作完善个人信息"); | wxCreditHistory.setChangePurpose("商户端["+wxMerchant.getName()+"]操作完善个人信息"); | ||||
| wxCreditHistory.setOperatorType(EnumUserType.BUSER.getCode()); | wxCreditHistory.setOperatorType(EnumUserType.BUSER.getCode()); | ||||
| wxCreditHistory.setOperatorId(bUser.getId()); | wxCreditHistory.setOperatorId(bUser.getId()); | ||||
| wxCreditHistoryService.saveOrUpdate(wxCreditHistory,wxMerchant.getTenantId()); | |||||
| wxCreditHistoryService.saveOrUpdate(wxCreditHistory,wxMerchant); | |||||
| } | } | ||||
| @@ -128,7 +128,7 @@ public class WxCreditHistoryController extends BaseController { | |||||
| if (null != getLoginBUser().getBuserId()) { | if (null != getLoginBUser().getBuserId()) { | ||||
| wxCreditHistory.setBuserId(getLoginBUser().getBuserId()); | wxCreditHistory.setBuserId(getLoginBUser().getBuserId()); | ||||
| } | } | ||||
| WxCreditHistory credit = wxCreditHistoryService.saveOrUpdate(wxCreditHistory,tenantInfo.getTenantId()); | |||||
| WxCreditHistory credit = wxCreditHistoryService.saveOrUpdate(wxCreditHistory,tenantInfo); | |||||
| //更新标签 | //更新标签 | ||||
| if (wxCreditHistory.getTags() != null && !wxCreditHistory.getTags().isEmpty()) { | if (wxCreditHistory.getTags() != null && !wxCreditHistory.getTags().isEmpty()) { | ||||
| wxCUserTagsService.updateTagByUserId(wxCreditHistory.getCUserId(),tenantInfo, wxCreditHistory.getTags()); | wxCUserTagsService.updateTagByUserId(wxCreditHistory.getCUserId(),tenantInfo, wxCreditHistory.getTags()); | ||||
| @@ -86,7 +86,7 @@ public class WxMerchantBUserController extends BaseController { | |||||
| } | } | ||||
| resultMap.put("creditLocked", merchant.getCreditLocked()); | resultMap.put("creditLocked", merchant.getCreditLocked()); | ||||
| WxScoreRules scoreRules = wxScoreRulesService.getCreditRules(user.getFinalTenantId()); | |||||
| WxScoreRules scoreRules = wxScoreRulesService.getCreditRules(user); | |||||
| if (scoreRules.getCreditLocked().equals(EnumCreditLockedStatus.CLOSE.getCode())) { | if (scoreRules.getCreditLocked().equals(EnumCreditLockedStatus.CLOSE.getCode())) { | ||||
| resultMap.put("creditLocked", EnumCreditLockedStatus.CLOSE.getCode()); | resultMap.put("creditLocked", EnumCreditLockedStatus.CLOSE.getCode()); | ||||
| } | } | ||||
| @@ -84,7 +84,7 @@ public class WxCreditHistoryController extends BaseController{ | |||||
| try { | try { | ||||
| wxCreditHistoryService.creditUsercheck(wxCreditHistory.getCUserId(),getTenantInfo()) ; | wxCreditHistoryService.creditUsercheck(wxCreditHistory.getCUserId(),getTenantInfo()) ; | ||||
| WxCreditHistory credit = wxCreditHistoryService.saveOrUpdate(wxCreditHistory,getTenantInfo().getTenantId()); | |||||
| WxCreditHistory credit = wxCreditHistoryService.saveOrUpdate(wxCreditHistory,getTenantInfo()); | |||||
| removeCacheCUser(); | removeCacheCUser(); | ||||
| return new ResultData(Result.SUCCESS, "操作成功", credit); | return new ResultData(Result.SUCCESS, "操作成功", credit); | ||||
| } catch (MallinkException e) { | } catch (MallinkException e) { | ||||
| @@ -97,7 +97,7 @@ public class WxCreditHistoryController extends BaseController{ | |||||
| @GetMapping("/credit_rules") | @GetMapping("/credit_rules") | ||||
| public ResultData creditRulesList() { | public ResultData creditRulesList() { | ||||
| logger.debug("[" + getIpAddr() + "] creditRulesList::list"); | logger.debug("[" + getIpAddr() + "] creditRulesList::list"); | ||||
| WxScoreRules scoreRules = wxScoreRulesService.getCreditRules(getTenantInfo().getFinalTenantId()); | |||||
| WxScoreRules scoreRules = wxScoreRulesService.getCreditRules(getTenantInfo()); | |||||
| return new ResultData(scoreRules); | return new ResultData(scoreRules); | ||||
| } | } | ||||
| @@ -1345,7 +1345,7 @@ public class PosServiceImpl implements PosService { | |||||
| //如果券与商户一对一 则直接将消费商户更新为此商户 若一对多 则消费商户显示多商户 | //如果券与商户一对一 则直接将消费商户更新为此商户 若一对多 则消费商户显示多商户 | ||||
| creditHistory.setMerchantId(wxMerchant.getId()); | creditHistory.setMerchantId(wxMerchant.getId()); | ||||
| creditHistory.setChangePurpose("pos消费:消费商户["+wxMerchant.getName()+"] 卷名称["+coupon.getTitle()+"("+creditHistory.getSpendStr()+"元)] "); | creditHistory.setChangePurpose("pos消费:消费商户["+wxMerchant.getName()+"] 卷名称["+coupon.getTitle()+"("+creditHistory.getSpendStr()+"元)] "); | ||||
| creditHistory = creditHistoryService.saveOrUpdate(creditHistory,couponOrderCVo.getTenantId()); | |||||
| creditHistory = creditHistoryService.saveOrUpdate(creditHistory,couponOrderCVo); | |||||
| if (creditHistory.getCreditNum() != null) { | if (creditHistory.getCreditNum() != null) { | ||||
| return creditHistory.getCreditNum(); | return creditHistory.getCreditNum(); | ||||
| } else { | } else { | ||||
| @@ -1374,7 +1374,7 @@ public class PosServiceImpl implements PosService { | |||||
| //如果券与商户一对一 则直接将消费商户更新为此商户 若一对多 则消费商户显示多商户 | //如果券与商户一对一 则直接将消费商户更新为此商户 若一对多 则消费商户显示多商户 | ||||
| creditHistory.setMerchantId(merchant.getId()); | creditHistory.setMerchantId(merchant.getId()); | ||||
| creditHistory.setChangePurpose("pos消费:消费商户["+merchant.getName()+"] 消费金额["+creditHistory.getSpendStr()+"元]"); | creditHistory.setChangePurpose("pos消费:消费商户["+merchant.getName()+"] 消费金额["+creditHistory.getSpendStr()+"元]"); | ||||
| creditHistory = creditHistoryService.saveOrUpdate(creditHistory,merchant.getTenantId()); | |||||
| creditHistory = creditHistoryService.saveOrUpdate(creditHistory,merchant); | |||||
| if (creditHistory.getCreditNum() != null) { | if (creditHistory.getCreditNum() != null) { | ||||
| return creditHistory.getCreditNum(); | return creditHistory.getCreditNum(); | ||||
| } else { | } else { | ||||
| @@ -339,7 +339,7 @@ public class CouponSendSchedule { | |||||
| } | } | ||||
| } | } | ||||
| int birthdayScale = CreditUtil.getBirthdayScoreScale(tenantEntity.getFinalTenantId(), wxScoreRulesService); | |||||
| int birthdayScale = CreditUtil.getBirthdayScoreScale(tenantEntity, wxScoreRulesService); | |||||
| for (WxCUserBasicInfo cu : couponSendedUsers) { | for (WxCUserBasicInfo cu : couponSendedUsers) { | ||||
| // 记录积分倍率日期 | // 记录积分倍率日期 | ||||
| try { | try { | ||||
| @@ -189,4 +189,9 @@ public class WxScoreRules extends BaseTenantEntity { | |||||
| return true; | return true; | ||||
| } | } | ||||
| @TableField(exist = false) | |||||
| @io.swagger.annotations.ApiModelProperty(value="是否可编辑",name="isEditable") | |||||
| private boolean isEditable; | |||||
| } | } | ||||
| @@ -54,7 +54,7 @@ public interface WxCreditHistoryService { | |||||
| * | * | ||||
| * @param record | * @param record | ||||
| */ | */ | ||||
| WxCreditHistory saveOrUpdate(WxCreditHistory record,String tenantId); | |||||
| WxCreditHistory saveOrUpdate(WxCreditHistory record,TenantEntity tenantinfo); | |||||
| /** | /** | ||||
| * 积分历史回退 | * 积分历史回退 | ||||
| @@ -18,7 +18,14 @@ public interface WxScoreRulesService { | |||||
| /** | /** | ||||
| * 获取租户的ScoreRules | * 获取租户的ScoreRules | ||||
| * @param tenantEntity | |||||
| * @param | |||||
| * @return | |||||
| */ | |||||
| WxScoreRules getScoreRules(String tenantId); | |||||
| /** | |||||
| * 获取租户的ScoreRules | |||||
| * @param | |||||
| * @return | * @return | ||||
| */ | */ | ||||
| WxScoreRules getScoreRules(TenantEntity tenantEntity); | WxScoreRules getScoreRules(TenantEntity tenantEntity); | ||||
| @@ -29,6 +36,14 @@ public interface WxScoreRulesService { | |||||
| * @return | * @return | ||||
| */ | */ | ||||
| WxScoreRules getCreditRules(String tenantId); | WxScoreRules getCreditRules(String tenantId); | ||||
| /** | |||||
| * 获取租户的积分规则 | |||||
| * @param | |||||
| * @return | |||||
| */ | |||||
| WxScoreRules getCreditRules(TenantEntity tenantEntity); | |||||
| /** | /** | ||||
| * 保存或更新实体 | * 保存或更新实体 | ||||
| * | * | ||||
| @@ -63,4 +78,9 @@ public interface WxScoreRulesService { | |||||
| void updateCreditLocked(WxScoreRules wxScoreRules); | void updateCreditLocked(WxScoreRules wxScoreRules); | ||||
| WxScoreRules getCreditDoubleRules(String tenantId); | WxScoreRules getCreditDoubleRules(String tenantId); | ||||
| WxScoreRules getCreditDoubleRules(TenantEntity tenantEntity); | |||||
| WxScoreRules getById(Long id); | |||||
| } | } | ||||
| @@ -205,7 +205,7 @@ public class AliBusinessCircleOrderServiceImpl implements AliBusinessCircleOrder | |||||
| creditHistory.setCreditType(EnumScoreType.CONSUMPTION.getCode()); | creditHistory.setCreditType(EnumScoreType.CONSUMPTION.getCode()); | ||||
| creditHistory.setSpend(record.getPayAmount()); | creditHistory.setSpend(record.getPayAmount()); | ||||
| creditHistory.setChangePurpose("支付宝商圈消费:商户["+record.getMerchantName()+"] ("+record.getPayAmountStr()+"元) "); | creditHistory.setChangePurpose("支付宝商圈消费:商户["+record.getMerchantName()+"] ("+record.getPayAmountStr()+"元) "); | ||||
| creditHistory = creditHistoryService.saveOrUpdate(creditHistory,record.getTenantId()); | |||||
| creditHistory = creditHistoryService.saveOrUpdate(creditHistory,record); | |||||
| Integer creditNum = 0; | Integer creditNum = 0; | ||||
| if (creditHistory.getCreditNum() != null) { | if (creditHistory.getCreditNum() != null) { | ||||
| creditNum = creditHistory.getCreditNum(); | creditNum = creditHistory.getCreditNum(); | ||||
| @@ -324,7 +324,7 @@ public class AliBusinessCircleOrderServiceImpl implements AliBusinessCircleOrder | |||||
| creditHistory.setCreditNum(points); | creditHistory.setCreditNum(points); | ||||
| creditHistory.setSpend(0-record.getRefundAmount()); | creditHistory.setSpend(0-record.getRefundAmount()); | ||||
| creditHistory.setChangePurpose("支付宝商圈退款:商户["+record.getMerchantName()+"] ("+record.getRefundAmountStr()+"元) "); | creditHistory.setChangePurpose("支付宝商圈退款:商户["+record.getMerchantName()+"] ("+record.getRefundAmountStr()+"元) "); | ||||
| creditHistory = creditHistoryService.saveOrUpdate(creditHistory,record.getTenantId()); | |||||
| creditHistory = creditHistoryService.saveOrUpdate(creditHistory,record); | |||||
| if (creditHistory.getCreditNum() != null) { | if (creditHistory.getCreditNum() != null) { | ||||
| creditNum = creditHistory.getCreditNum(); | creditNum = creditHistory.getCreditNum(); | ||||
| @@ -238,7 +238,7 @@ public class WxActivityJoinServiceImpl implements WxActivityJoinService { | |||||
| wxCreditHistory.setChangePurpose(EnumScoreType.ACTIVITY_JOIN.getMessage()+"["+wxActivity.getTitle()+"]"); | wxCreditHistory.setChangePurpose(EnumScoreType.ACTIVITY_JOIN.getMessage()+"["+wxActivity.getTitle()+"]"); | ||||
| wxCreditHistory.setOperatorType(EnumUserType.CUSERBASIC.getCode()); | wxCreditHistory.setOperatorType(EnumUserType.CUSERBASIC.getCode()); | ||||
| wxCreditHistory.setOperatorId(wxActivityJoin.getUserId()); | wxCreditHistory.setOperatorId(wxActivityJoin.getUserId()); | ||||
| wxCreditHistoryService.saveOrUpdate(wxCreditHistory,wxActivity.getTenantId()); | |||||
| wxCreditHistoryService.saveOrUpdate(wxCreditHistory,wxActivity); | |||||
| } | } | ||||
| return new ResultData(); | return new ResultData(); | ||||
| @@ -223,7 +223,7 @@ public class WxBusinessCircleOrderServiceImpl implements WxBusinessCircleOrderSe | |||||
| creditHistory.setCreditType(EnumScoreType.CONSUMPTION.getCode()); | creditHistory.setCreditType(EnumScoreType.CONSUMPTION.getCode()); | ||||
| creditHistory.setSpend(record.getPayAmount()); | creditHistory.setSpend(record.getPayAmount()); | ||||
| creditHistory.setChangePurpose("微信商圈消费:商户["+record.getMerchantName()+"] ("+record.getPayAmountStr()+"元) "); | creditHistory.setChangePurpose("微信商圈消费:商户["+record.getMerchantName()+"] ("+record.getPayAmountStr()+"元) "); | ||||
| creditHistory = creditHistoryService.saveOrUpdate(creditHistory,record.getTenantId()); | |||||
| creditHistory = creditHistoryService.saveOrUpdate(creditHistory,record); | |||||
| if (creditHistory.getCreditNum() != null) { | if (creditHistory.getCreditNum() != null) { | ||||
| creditNum = creditHistory.getCreditNum(); | creditNum = creditHistory.getCreditNum(); | ||||
| @@ -350,7 +350,7 @@ public class WxBusinessCircleOrderServiceImpl implements WxBusinessCircleOrderSe | |||||
| creditHistory.setCreditNum(points); | creditHistory.setCreditNum(points); | ||||
| creditHistory.setSpend(0-record.getRefundAmount()); | creditHistory.setSpend(0-record.getRefundAmount()); | ||||
| creditHistory.setChangePurpose("微信商圈退款:商户["+record.getMerchantName()+"] ("+record.getRefundAmountStr()+"元) "); | creditHistory.setChangePurpose("微信商圈退款:商户["+record.getMerchantName()+"] ("+record.getRefundAmountStr()+"元) "); | ||||
| creditHistory = creditHistoryService.saveOrUpdate(creditHistory,record.getTenantId()); | |||||
| creditHistory = creditHistoryService.saveOrUpdate(creditHistory,record); | |||||
| if (creditHistory.getCreditNum() != null) { | if (creditHistory.getCreditNum() != null) { | ||||
| creditNum = creditHistory.getCreditNum(); | creditNum = creditHistory.getCreditNum(); | ||||
| @@ -724,7 +724,7 @@ public class WxCUserBasicInfoServiceImpl implements WxCUserBasicInfoService,IExc | |||||
| wxCreditHistory.setChangePurpose(enumScoreType.getMessage()); | wxCreditHistory.setChangePurpose(enumScoreType.getMessage()); | ||||
| wxCreditHistory.setOperatorType(EnumUserType.CUSERBASIC.getCode()); | wxCreditHistory.setOperatorType(EnumUserType.CUSERBASIC.getCode()); | ||||
| wxCreditHistory.setOperatorId(userId); | wxCreditHistory.setOperatorId(userId); | ||||
| WxCreditHistory record = wxCreditHistoryService.saveOrUpdate(wxCreditHistory,tenantInfo.getTenantId()); | |||||
| WxCreditHistory record = wxCreditHistoryService.saveOrUpdate(wxCreditHistory,tenantInfo); | |||||
| return record.getCreditAmount(); | return record.getCreditAmount(); | ||||
| } | } | ||||
| @@ -1188,7 +1188,7 @@ public class WxCUserBasicInfoServiceImpl implements WxCUserBasicInfoService,IExc | |||||
| } | } | ||||
| wxCreditHistory.setCreditAmount(credit); | wxCreditHistory.setCreditAmount(credit); | ||||
| wxCreditHistory.setCreditNum(credit); | wxCreditHistory.setCreditNum(credit); | ||||
| wxCreditHistoryService.saveOrUpdate(wxCreditHistory,mallUserInfo.getTenantId()); | |||||
| wxCreditHistoryService.saveOrUpdate(wxCreditHistory,mallUserInfo); | |||||
| } | } | ||||
| } catch (Exception e) { | } catch (Exception e) { | ||||
| logger.error(e.getMessage()); | logger.error(e.getMessage()); | ||||
| @@ -228,7 +228,7 @@ public class WxCUserBasicSignServiceImpl implements WxCUserBasicSignService { | |||||
| wxCreditHistory.setChangePurpose(enumScoreType.getMessage()); | wxCreditHistory.setChangePurpose(enumScoreType.getMessage()); | ||||
| wxCreditHistory.setOperatorType(EnumUserType.CUSERBASIC.getCode()); | wxCreditHistory.setOperatorType(EnumUserType.CUSERBASIC.getCode()); | ||||
| wxCreditHistory.setOperatorId(record.getUserId()); | wxCreditHistory.setOperatorId(record.getUserId()); | ||||
| WxCreditHistory wxCreditHistory1 = wxCreditHistoryService.saveOrUpdate(wxCreditHistory, tenantEntity.getTenantId()); | |||||
| WxCreditHistory wxCreditHistory1 = wxCreditHistoryService.saveOrUpdate(wxCreditHistory, tenantEntity); | |||||
| if(wxCreditHistory1.getCreditNum() == null){ | if(wxCreditHistory1.getCreditNum() == null){ | ||||
| return 0; | return 0; | ||||
| } | } | ||||
| @@ -335,7 +335,7 @@ public class WxCardSpendServiceImpl implements WxCardSpendService { | |||||
| creditHistory.setMerchantId(record.getMerchantId()); | creditHistory.setMerchantId(record.getMerchantId()); | ||||
| WxMerchant wxMerchant = wxMerchantMapper.selectById(record.getMerchantId()); | WxMerchant wxMerchant = wxMerchantMapper.selectById(record.getMerchantId()); | ||||
| creditHistory.setChangePurpose("卡消费:消费商户["+wxMerchant.getName()+"] 金额["+creditHistory.getSpendStr()+"元]"); | creditHistory.setChangePurpose("卡消费:消费商户["+wxMerchant.getName()+"] 金额["+creditHistory.getSpendStr()+"元]"); | ||||
| wxCreditHistoryService.saveOrUpdate(creditHistory,record.getTenantId()); | |||||
| wxCreditHistoryService.saveOrUpdate(creditHistory,record); | |||||
| } catch (Exception e) { | } catch (Exception e) { | ||||
| logger.error("积分值:" + e.getMessage()); | logger.error("积分值:" + e.getMessage()); | ||||
| } | } | ||||
| @@ -1334,7 +1334,7 @@ public class WxCardSpendServiceImpl implements WxCardSpendService { | |||||
| creditHistory.setMerchantId(record.getMerchantId()); | creditHistory.setMerchantId(record.getMerchantId()); | ||||
| // WxMerchant wxMerchant = wxMerchantMapper.selectById(record.getMerchantId()); | // WxMerchant wxMerchant = wxMerchantMapper.selectById(record.getMerchantId()); | ||||
| creditHistory.setChangePurpose("pos卡消费:消费商户["+merchant.getName()+"] 金额["+creditHistory.getSpendStr()+"元]"); | creditHistory.setChangePurpose("pos卡消费:消费商户["+merchant.getName()+"] 金额["+creditHistory.getSpendStr()+"元]"); | ||||
| creditHistory = wxCreditHistoryService.saveOrUpdate(creditHistory,record.getTenantId()); | |||||
| creditHistory = wxCreditHistoryService.saveOrUpdate(creditHistory,record); | |||||
| if (creditHistory != null) { | if (creditHistory != null) { | ||||
| scoreCreditCalc.setCredit(scoreCreditCalc.getCredit() + creditHistory.getCreditNum()); | scoreCreditCalc.setCredit(scoreCreditCalc.getCredit() + creditHistory.getCreditNum()); | ||||
| } | } | ||||
| @@ -1663,7 +1663,7 @@ public class WxCouponOrderServiceImpl implements WxCouponOrderService { | |||||
| creditHistory.setBusinessId(wxCoupon.getBusiness()); | creditHistory.setBusinessId(wxCoupon.getBusiness()); | ||||
| creditHistory.setSpend(couponOrder.getCouponPrice()); | creditHistory.setSpend(couponOrder.getCouponPrice()); | ||||
| creditHistory.setChangePurpose("券["+wxCoupon.getTitle()+"("+creditHistory.getSpendStr()+"元)] 使用成功"); | creditHistory.setChangePurpose("券["+wxCoupon.getTitle()+"("+creditHistory.getSpendStr()+"元)] 使用成功"); | ||||
| wxCreditHistoryService.saveOrUpdate(creditHistory,couponOrder.getTenantId()); | |||||
| wxCreditHistoryService.saveOrUpdate(creditHistory,couponOrder); | |||||
| } catch (Exception e) { | } catch (Exception e) { | ||||
| logger.error("积分值:" + e.getMessage()); | logger.error("积分值:" + e.getMessage()); | ||||
| } | } | ||||
| @@ -1700,7 +1700,7 @@ public class WxCouponOrderServiceImpl implements WxCouponOrderService { | |||||
| creditHistory.setBusinessId(wxCoupon.getBusiness()); | creditHistory.setBusinessId(wxCoupon.getBusiness()); | ||||
| creditHistory.setSpend(couponOrder.getCouponPrice()); | creditHistory.setSpend(couponOrder.getCouponPrice()); | ||||
| creditHistory.setChangePurpose("核销停车劵["+wxCoupon.getTitle()+"("+creditHistory.getSpendStr()+"元)] "); | creditHistory.setChangePurpose("核销停车劵["+wxCoupon.getTitle()+"("+creditHistory.getSpendStr()+"元)] "); | ||||
| wxCreditHistoryService.saveOrUpdate(creditHistory,couponOrder.getTenantId()); | |||||
| wxCreditHistoryService.saveOrUpdate(creditHistory,couponOrder); | |||||
| } catch (Exception e) { | } catch (Exception e) { | ||||
| logger.error("积分值:" + e.getMessage()); | logger.error("积分值:" + e.getMessage()); | ||||
| } | } | ||||
| @@ -577,7 +577,7 @@ public class WxCreditHistoryServiceImpl implements WxCreditHistoryService { | |||||
| @Override | @Override | ||||
| @Transactional(propagation = Propagation.REQUIRED, readOnly = false, rollbackFor = {Exception.class}) | @Transactional(propagation = Propagation.REQUIRED, readOnly = false, rollbackFor = {Exception.class}) | ||||
| public WxCreditHistory saveOrUpdate(WxCreditHistory record,String tenantId) { | |||||
| public WxCreditHistory saveOrUpdate(WxCreditHistory record,TenantEntity tenantEntity) { | |||||
| WxCUserBasicInfo wxCUserBasicInfo = wxCUserBasicInfoMapper.selectById(record.getCUserId(),record.getTenantId()); | WxCUserBasicInfo wxCUserBasicInfo = wxCUserBasicInfoMapper.selectById(record.getCUserId(),record.getTenantId()); | ||||
| if (wxCUserBasicInfo == null) { | if (wxCUserBasicInfo == null) { | ||||
| //验证此用户是否存在 | //验证此用户是否存在 | ||||
| @@ -598,7 +598,7 @@ public class WxCreditHistoryServiceImpl implements WxCreditHistoryService { | |||||
| } | } | ||||
| record.setCreditAmount(currentCreditAmount); | record.setCreditAmount(currentCreditAmount); | ||||
| int creditChangeNumOrigin = creditIncrement(record); | |||||
| int creditChangeNumOrigin = creditIncrement(record,tenantEntity); | |||||
| int creditChangeNum = creditChangeNumOrigin ; | int creditChangeNum = creditChangeNumOrigin ; | ||||
| //是否参与了生日积分倍率 | //是否参与了生日积分倍率 | ||||
| boolean hasBirthDateCredit = false; | boolean hasBirthDateCredit = false; | ||||
| @@ -606,7 +606,7 @@ public class WxCreditHistoryServiceImpl implements WxCreditHistoryService { | |||||
| || record.getCreditType().equals(EnumScoreType.SPEND_CREDIT.getCode())) { | || record.getCreditType().equals(EnumScoreType.SPEND_CREDIT.getCode())) { | ||||
| //等级积分配置 | //等级积分配置 | ||||
| try { | try { | ||||
| creditChangeNum = CreditUtil.calUserCredit(creditChangeNumOrigin, wxCUserBasicInfo, tenantId, wxScoreRulesService,wxLevelConfigMapper); | |||||
| creditChangeNum = CreditUtil.calUserCredit(creditChangeNumOrigin, wxCUserBasicInfo, tenantEntity, wxScoreRulesService,wxLevelConfigMapper); | |||||
| if (Objects.nonNull(CreditUtil.getIsBirthDayScale())) { | if (Objects.nonNull(CreditUtil.getIsBirthDayScale())) { | ||||
| hasBirthDateCredit = true; | hasBirthDateCredit = true; | ||||
| } | } | ||||
| @@ -648,12 +648,8 @@ public class WxCreditHistoryServiceImpl implements WxCreditHistoryService { | |||||
| } | } | ||||
| //发消息 | //发消息 | ||||
| sendCreditUpdRemind(wxCUserBasicInfo,record,tenantId); | |||||
| TenantEntity tenantEntity = new TenantEntity(); | |||||
| tenantEntity.setTenantId(tenantId); | |||||
| if(!record.getTenantId().equals(tenantId)){ | |||||
| tenantEntity.setParentTenantId(record.getTenantId()); | |||||
| } | |||||
| sendCreditUpdRemind(wxCUserBasicInfo,record,tenantEntity); | |||||
| wxMemberCardService.sendsyncMemberCardBonusMsg(tenantEntity,null,wxCUserBasicInfo.getId(),record.getId()); | wxMemberCardService.sendsyncMemberCardBonusMsg(tenantEntity,null,wxCUserBasicInfo.getId(),record.getId()); | ||||
| @@ -664,19 +660,17 @@ public class WxCreditHistoryServiceImpl implements WxCreditHistoryService { | |||||
| return record; | return record; | ||||
| } | } | ||||
| private void sendCreditUpdRemind(WxCUserBasicInfo wxCUserBasicInfo,WxCreditHistory record,String tenantId){ | |||||
| private void sendCreditUpdRemind(WxCUserBasicInfo wxCUserBasicInfo,WxCreditHistory record,TenantEntity tenantEntity){ | |||||
| try { | try { | ||||
| WxTemplateMsg temp = new WxTemplateMsg(); | WxTemplateMsg temp = new WxTemplateMsg(); | ||||
| // temp.updateTenantInfo(record); | |||||
| temp.setTenantId(tenantId); | |||||
| temp.updateTenantInfo(tenantEntity); | |||||
| temp.setType(EnumTemplateType.CREDIT_UPD_REMIND.getCode()); | temp.setType(EnumTemplateType.CREDIT_UPD_REMIND.getCode()); | ||||
| temp = wxTemplateMsgService.getByObj(temp); | temp = wxTemplateMsgService.getByObj(temp); | ||||
| if(temp != null){ | if(temp != null){ | ||||
| String openId = wxCUserMapper.findOpenId(wxCUserBasicInfo.getId(),tenantId); | |||||
| String openId = wxCUserMapper.findOpenId(wxCUserBasicInfo.getId(),tenantEntity.getTenantId()); | |||||
| if(StringUtils.isNotBlank(openId)){ | if(StringUtils.isNotBlank(openId)){ | ||||
| WxMsg msg = new WxMsg(); | WxMsg msg = new WxMsg(); | ||||
| // msg.updateTenantInfo(record); | |||||
| msg.setTenantId(tenantId); | |||||
| msg.updateTenantInfo(tenantEntity); | |||||
| // msg.setWay(EnumSendWay.APPINFOR.getCode()); | // msg.setWay(EnumSendWay.APPINFOR.getCode()); | ||||
| // msg.setIsright(EnumMsgSend.MSG_SEND_IMMEDIATELY.getCode()); | // msg.setIsright(EnumMsgSend.MSG_SEND_IMMEDIATELY.getCode()); | ||||
| // msg.setStatus(EnumMsgStatus.MSG_STATUS_NOT_SEND.getCode()); | // msg.setStatus(EnumMsgStatus.MSG_STATUS_NOT_SEND.getCode()); | ||||
| @@ -755,11 +749,11 @@ public class WxCreditHistoryServiceImpl implements WxCreditHistoryService { | |||||
| int creditNew = 0 ; | int creditNew = 0 ; | ||||
| if (StringUtils.isNotBlank(spendStr)) { | if (StringUtils.isNotBlank(spendStr)) { | ||||
| wxCreditHistory.setSpend(new BigDecimal(spendStr).multiply(new BigDecimal(100)).intValue()); | wxCreditHistory.setSpend(new BigDecimal(spendStr).multiply(new BigDecimal(100)).intValue()); | ||||
| credit = payAddCredit(wxCreditHistory); | |||||
| credit = payAddCredit(wxCreditHistory,wxMerchant); | |||||
| if (Objects.nonNull(userId)) { | if (Objects.nonNull(userId)) { | ||||
| WxCUserBasicInfo wxCUserBasicInfo = wxCUserBasicInfoMapper.selectById(userId,wxMerchant.getFinalTenantId()); | WxCUserBasicInfo wxCUserBasicInfo = wxCUserBasicInfoMapper.selectById(userId,wxMerchant.getFinalTenantId()); | ||||
| try { | try { | ||||
| creditNew = CreditUtil.calUserCredit(credit, wxCUserBasicInfo, wxMerchant.getTenantId(), wxScoreRulesService,wxLevelConfigMapper); | |||||
| creditNew = CreditUtil.calUserCredit(credit, wxCUserBasicInfo, wxMerchant, wxScoreRulesService,wxLevelConfigMapper); | |||||
| } catch (Exception e) { | } catch (Exception e) { | ||||
| logger.error("积分倍率计算异常",e); | logger.error("积分倍率计算异常",e); | ||||
| } finally { | } finally { | ||||
| @@ -776,23 +770,23 @@ public class WxCreditHistoryServiceImpl implements WxCreditHistoryService { | |||||
| //根据积分类型计算"增加积分" | //根据积分类型计算"增加积分" | ||||
| private int creditIncrement(WxCreditHistory record) { | |||||
| private int creditIncrement(WxCreditHistory record,TenantEntity tenantEntity) { | |||||
| //查找C端用户的成长值 | //查找C端用户的成长值 | ||||
| if (record.getCreditType() == EnumScoreType.LOGIN.getCode()) { | if (record.getCreditType() == EnumScoreType.LOGIN.getCode()) { | ||||
| // return loginAddCredit(record);//登陆加积分取消 | |||||
| // return loginAddCredit(record,tenantEntity);//登陆加积分取消 | |||||
| return 0; | return 0; | ||||
| } | } | ||||
| if (record.getCreditType() == EnumScoreType.BIND_CAR.getCode()) { | if (record.getCreditType() == EnumScoreType.BIND_CAR.getCode()) { | ||||
| return bindCarAddCredit(record); | |||||
| return bindCarAddCredit(record,tenantEntity); | |||||
| } | } | ||||
| // if (record.getCreditType() == EnumScoreType.WECHAT_PERSION.getCode()) { | // if (record.getCreditType() == EnumScoreType.WECHAT_PERSION.getCode()) { | ||||
| // return personAddCredit(record); | |||||
| // return personAddCredit(record,tenantEntity); | |||||
| // } | // } | ||||
| if (record.getCreditType() == EnumScoreType.WECHAT_PHONE.getCode()) { | if (record.getCreditType() == EnumScoreType.WECHAT_PHONE.getCode()) { | ||||
| return phoneAddCredit(record); | |||||
| return phoneAddCredit(record,tenantEntity); | |||||
| } | } | ||||
| if (record.getCreditType() == EnumScoreType.COMPLETE_INFO.getCode()) { | if (record.getCreditType() == EnumScoreType.COMPLETE_INFO.getCode()) { | ||||
| return infoAddCredit(record); | |||||
| return infoAddCredit(record,tenantEntity); | |||||
| } | } | ||||
| if (record.getCreditType() == EnumScoreType.SPEND_CREDIT.getCode()) { | if (record.getCreditType() == EnumScoreType.SPEND_CREDIT.getCode()) { | ||||
| return spendCredit(record); | return spendCredit(record); | ||||
| @@ -801,7 +795,7 @@ public class WxCreditHistoryServiceImpl implements WxCreditHistoryService { | |||||
| return changeCredit(record); | return changeCredit(record); | ||||
| } | } | ||||
| if (record.getCreditType() == EnumScoreType.CONSUMPTION.getCode()) { | if (record.getCreditType() == EnumScoreType.CONSUMPTION.getCode()) { | ||||
| return payAddCredit(record); | |||||
| return payAddCredit(record,tenantEntity); | |||||
| } | } | ||||
| if (record.getCreditType() == EnumScoreType.REDUCE_CREDIT.getCode()) { | if (record.getCreditType() == EnumScoreType.REDUCE_CREDIT.getCode()) { | ||||
| return reduceCredit(record); | return reduceCredit(record); | ||||
| @@ -820,16 +814,16 @@ public class WxCreditHistoryServiceImpl implements WxCreditHistoryService { | |||||
| } | } | ||||
| if (record.getCreditType() == EnumScoreType.SIGN_IN_DAY.getCode()) { | if (record.getCreditType() == EnumScoreType.SIGN_IN_DAY.getCode()) { | ||||
| return signinCredit(record); | |||||
| return signinCredit(record,tenantEntity); | |||||
| } | } | ||||
| if (record.getCreditType() == EnumScoreType.SIGN_IN_SEVENDAY.getCode()) { | if (record.getCreditType() == EnumScoreType.SIGN_IN_SEVENDAY.getCode()) { | ||||
| return signinMonthCredit(record,EnumScoreType.SIGN_IN_SEVENDAY); | |||||
| return signinMonthCredit(record,tenantEntity,EnumScoreType.SIGN_IN_SEVENDAY); | |||||
| } | } | ||||
| if (record.getCreditType() == EnumScoreType.SIGN_IN_FTDAY.getCode()) { | if (record.getCreditType() == EnumScoreType.SIGN_IN_FTDAY.getCode()) { | ||||
| return signinMonthCredit(record,EnumScoreType.SIGN_IN_FTDAY); | |||||
| return signinMonthCredit(record,tenantEntity,EnumScoreType.SIGN_IN_FTDAY); | |||||
| } | } | ||||
| if (record.getCreditType() == EnumScoreType.SIGN_IN_TEDAY.getCode()) { | if (record.getCreditType() == EnumScoreType.SIGN_IN_TEDAY.getCode()) { | ||||
| return signinMonthCredit(record,EnumScoreType.SIGN_IN_TEDAY); | |||||
| return signinMonthCredit(record,tenantEntity,EnumScoreType.SIGN_IN_TEDAY); | |||||
| } | } | ||||
| if (record.getCreditType() == EnumScoreType.QUESTION_ADD_CREDIT.getCode()) { | if (record.getCreditType() == EnumScoreType.QUESTION_ADD_CREDIT.getCode()) { | ||||
| @@ -854,59 +848,59 @@ public class WxCreditHistoryServiceImpl implements WxCreditHistoryService { | |||||
| return -reduceCredit; | return -reduceCredit; | ||||
| } | } | ||||
| private int loginAddCredit(WxCreditHistory record) { | |||||
| private int loginAddCredit(WxCreditHistory record,TenantEntity tenantEntity) { | |||||
| //如果当天已经登录过则跳过 | //如果当天已经登录过则跳过 | ||||
| if (wxCreditHistoryMapper.loginCount(record) > 0) { | if (wxCreditHistoryMapper.loginCount(record) > 0) { | ||||
| return 0; | return 0; | ||||
| } | } | ||||
| // 1. 获取当前租户下积分的增加规则 | // 1. 获取当前租户下积分的增加规则 | ||||
| WxScoreRules wxScoreRules = wxScoreRulesService.getCreditRules(record.getTenantId()); | |||||
| WxScoreRules wxScoreRules = wxScoreRulesService.getCreditRules(tenantEntity); | |||||
| // 2. 增长的积分 | // 2. 增长的积分 | ||||
| return wxScoreRules.getRule(EnumScoreType.LOGIN, WxScoreRules.SCORE); | return wxScoreRules.getRule(EnumScoreType.LOGIN, WxScoreRules.SCORE); | ||||
| } | } | ||||
| private int signinCredit(WxCreditHistory record) { | |||||
| private int signinCredit(WxCreditHistory record,TenantEntity tenantEntity) { | |||||
| //如果当天已经登录过则跳过 | //如果当天已经登录过则跳过 | ||||
| if (wxCreditHistoryMapper.loginCount(record) > 0) { | if (wxCreditHistoryMapper.loginCount(record) > 0) { | ||||
| return 0; | return 0; | ||||
| } | } | ||||
| // 1. 获取当前租户下积分的增加规则 | // 1. 获取当前租户下积分的增加规则 | ||||
| WxScoreRules wxScoreRules = wxScoreRulesService.getCreditRules(record.getTenantId()); | |||||
| WxScoreRules wxScoreRules = wxScoreRulesService.getCreditRules(tenantEntity); | |||||
| // 2. 增长的积分 | // 2. 增长的积分 | ||||
| return wxScoreRules.getRule(EnumScoreType.SIGN_IN_DAY, WxScoreRules.SCORE); | return wxScoreRules.getRule(EnumScoreType.SIGN_IN_DAY, WxScoreRules.SCORE); | ||||
| } | } | ||||
| private int signinMonthCredit(WxCreditHistory record,EnumScoreType enumScoreType) { | |||||
| private int signinMonthCredit(WxCreditHistory record,TenantEntity tenantEntity,EnumScoreType enumScoreType) { | |||||
| //签到周期按月来 | //签到周期按月来 | ||||
| // if (wxCreditHistoryMapper.monthCount(record) > 0) { | // if (wxCreditHistoryMapper.monthCount(record) > 0) { | ||||
| // return 0; | // return 0; | ||||
| // } | // } | ||||
| // 1. 获取当前租户下积分的增加规则 | // 1. 获取当前租户下积分的增加规则 | ||||
| WxScoreRules wxScoreRules = wxScoreRulesService.getCreditRules(record.getTenantId()); | |||||
| WxScoreRules wxScoreRules = wxScoreRulesService.getCreditRules(tenantEntity); | |||||
| // 2. 增长的积分 | // 2. 增长的积分 | ||||
| return wxScoreRules.getRule(enumScoreType, WxScoreRules.SCORE); | return wxScoreRules.getRule(enumScoreType, WxScoreRules.SCORE); | ||||
| } | } | ||||
| private int bindCarAddCredit(WxCreditHistory record) { | |||||
| private int bindCarAddCredit(WxCreditHistory record,TenantEntity tenantEntity) { | |||||
| if (wxCreditHistoryMapper.countList(record) > 0) { | if (wxCreditHistoryMapper.countList(record) > 0) { | ||||
| return 0; | return 0; | ||||
| } | } | ||||
| // 1. 获取score rules | // 1. 获取score rules | ||||
| WxScoreRules wxScoreRules = wxScoreRulesService.getCreditRules(record.getTenantId()); | |||||
| WxScoreRules wxScoreRules = wxScoreRulesService.getCreditRules(tenantEntity); | |||||
| // 2. 增长的积分 | // 2. 增长的积分 | ||||
| return wxScoreRules.getRule(EnumScoreType.BIND_CAR, WxScoreRules.SCORE); | return wxScoreRules.getRule(EnumScoreType.BIND_CAR, WxScoreRules.SCORE); | ||||
| } | } | ||||
| // private int personAddCredit(WxCreditHistory record) { | |||||
| // private int personAddCredit(WxCreditHistory record,TenantEntity tenantEntity) { | |||||
| // // 1. 获取score rules | // // 1. 获取score rules | ||||
| // WxScoreRules wxScoreRules = wxScoreRulesService.getCreditRules(record.getTenantId()); | |||||
| // WxScoreRules wxScoreRules = wxScoreRulesService.getCreditRules(tenantEntity); | |||||
| // // 2. 增长的积分 | // // 2. 增长的积分 | ||||
| // return wxScoreRules.getRule(EnumScoreType.WECHAT_PERSION, WxScoreRules.SCORE); | // return wxScoreRules.getRule(EnumScoreType.WECHAT_PERSION, WxScoreRules.SCORE); | ||||
| // } | // } | ||||
| private int phoneAddCredit(WxCreditHistory record) { | |||||
| private int phoneAddCredit(WxCreditHistory record,TenantEntity tenantEntity) { | |||||
| // 1. 获取score rules | // 1. 获取score rules | ||||
| WxScoreRules wxScoreRules = wxScoreRulesService.getCreditRules(record.getTenantId()); | |||||
| WxScoreRules wxScoreRules = wxScoreRulesService.getCreditRules(tenantEntity); | |||||
| // 2. 获取成长值 | // 2. 获取成长值 | ||||
| return wxScoreRules.getRule(EnumScoreType.WECHAT_PHONE, WxScoreRules.SCORE); | return wxScoreRules.getRule(EnumScoreType.WECHAT_PHONE, WxScoreRules.SCORE); | ||||
| } | } | ||||
| @@ -920,12 +914,12 @@ public class WxCreditHistoryServiceImpl implements WxCreditHistoryService { | |||||
| return wxCreditHistoryMapper.countList(wxCreditHistory); | return wxCreditHistoryMapper.countList(wxCreditHistory); | ||||
| } | } | ||||
| private int infoAddCredit(WxCreditHistory record) { | |||||
| private int infoAddCredit(WxCreditHistory record,TenantEntity tenantEntity) { | |||||
| WxCUserBasicInfo user = wxCUserBasicInfoMapper.selectById(record.getCUserId(),record.getTenantId()); | WxCUserBasicInfo user = wxCUserBasicInfoMapper.selectById(record.getCUserId(),record.getTenantId()); | ||||
| if (user == null || checkCompleteInfoScoreCount(user) > 0) | if (user == null || checkCompleteInfoScoreCount(user) > 0) | ||||
| return 0; | return 0; | ||||
| // 1. 获取score rules | // 1. 获取score rules | ||||
| WxScoreRules scoreRules = wxScoreRulesService.getCreditRules(record.getTenantId()); | |||||
| WxScoreRules scoreRules = wxScoreRulesService.getCreditRules(tenantEntity); | |||||
| // 2. 获取成长值 | // 2. 获取成长值 | ||||
| return scoreRules.getRule(EnumScoreType.COMPLETE_INFO, WxScoreRules.SCORE); | return scoreRules.getRule(EnumScoreType.COMPLETE_INFO, WxScoreRules.SCORE); | ||||
| } | } | ||||
| @@ -948,13 +942,13 @@ public class WxCreditHistoryServiceImpl implements WxCreditHistoryService { | |||||
| return -changeCredit; | return -changeCredit; | ||||
| } | } | ||||
| private int payAddCredit(WxCreditHistory record) { | |||||
| private int payAddCredit(WxCreditHistory record,TenantEntity tenantEntity) { | |||||
| int addCreditNumber = 0; | int addCreditNumber = 0; | ||||
| // 订单金额为0时不计入 | // 订单金额为0时不计入 | ||||
| if (record.getCreditNum() != null && record.getCreditNum() == 0) | if (record.getCreditNum() != null && record.getCreditNum() == 0) | ||||
| return 0; | return 0; | ||||
| // 1. 获取score rules | // 1. 获取score rules | ||||
| WxScoreRules scoreRules = wxScoreRulesService.getCreditRules(record.getTenantId()); | |||||
| WxScoreRules scoreRules = wxScoreRulesService.getCreditRules(tenantEntity); | |||||
| // 2. 获取成长值 by id | // 2. 获取成长值 by id | ||||
| JSONObject payRule = WxScoreRules.getRuleObj(scoreRules.getRules(),EnumScoreType.CONSUMPTION); | JSONObject payRule = WxScoreRules.getRuleObj(scoreRules.getRules(),EnumScoreType.CONSUMPTION); | ||||
| @@ -481,7 +481,7 @@ public class WxGameServiceImpl implements WxGameService { | |||||
| wxCreditHistory.setCreditType(EnumScoreType.GAME_ADD_CREDIT.getCode()); | wxCreditHistory.setCreditType(EnumScoreType.GAME_ADD_CREDIT.getCode()); | ||||
| wxCreditHistory.setChangePurpose(EnumScoreType.GAME_ADD_CREDIT.getMessage()); | wxCreditHistory.setChangePurpose(EnumScoreType.GAME_ADD_CREDIT.getMessage()); | ||||
| wxCreditHistoryService.creditUsercheck(wxCreditHistory.getCUserId(),wxGame) ; | wxCreditHistoryService.creditUsercheck(wxCreditHistory.getCUserId(),wxGame) ; | ||||
| wxCreditHistoryService.saveOrUpdate(wxCreditHistory,wxGame.getTenantId()); | |||||
| wxCreditHistoryService.saveOrUpdate(wxCreditHistory,wxGame); | |||||
| addCredit = credit; | addCredit = credit; | ||||
| orderId = Constant.creditPlayOrderIdTab; | orderId = Constant.creditPlayOrderIdTab; | ||||
| }else{ | }else{ | ||||
| @@ -528,7 +528,7 @@ public class WxGameServiceImpl implements WxGameService { | |||||
| wxCreditHistory.setCreditType(EnumScoreType.GAME_LES_CREDIT.getCode()); | wxCreditHistory.setCreditType(EnumScoreType.GAME_LES_CREDIT.getCode()); | ||||
| wxCreditHistory.setChangePurpose(EnumScoreType.GAME_LES_CREDIT.getMessage()); | wxCreditHistory.setChangePurpose(EnumScoreType.GAME_LES_CREDIT.getMessage()); | ||||
| wxCreditHistoryService.creditUsercheck(wxCreditHistory.getCUserId(),wxGame) ; | wxCreditHistoryService.creditUsercheck(wxCreditHistory.getCUserId(),wxGame) ; | ||||
| wxCreditHistoryService.saveOrUpdate(wxCreditHistory,wxGame.getTenantId()); | |||||
| wxCreditHistoryService.saveOrUpdate(wxCreditHistory,wxGame); | |||||
| return this.luckDraw(gameId,userId,wxGame.getPlayCredit()); | return this.luckDraw(gameId,userId,wxGame.getPlayCredit()); | ||||
| }else{ | }else{ | ||||
| @@ -59,8 +59,9 @@ public class WxMallDisposeServiceImpl implements WxMallDisposeService { | |||||
| mallDispose = new WxMallDispose(); | mallDispose = new WxMallDispose(); | ||||
| mallDispose.updateTenantInfo(tenantEntity); | mallDispose.updateTenantInfo(tenantEntity); | ||||
| } | } | ||||
| if(wxMallService.isgroupSupport(tenantEntity)){ | |||||
| //如果是集团,都可以配置 | |||||
| if(wxMallService.isgroupSupport(tenantEntity) | |||||
| || StringUtils.isBlank(tenantEntity.getParentTenantId())){ | |||||
| //如果是集团,单广场,都可以配置 | |||||
| mallDispose.setPointsDispose(EnumMallDispose.MALL.getCode()); | mallDispose.setPointsDispose(EnumMallDispose.MALL.getCode()); | ||||
| mallDispose.setGrowthValueDispose(EnumMallDispose.MALL.getCode()); | mallDispose.setGrowthValueDispose(EnumMallDispose.MALL.getCode()); | ||||
| }else{ | }else{ | ||||
| @@ -2379,7 +2379,7 @@ public class WxOrderServiceImpl implements WxOrderService { | |||||
| creditHistory.setChangePurpose("付款码消费:消费商户["+wxMerchant.getName()+"] 金额["+creditHistory.getSpendStr()+"元]"); | creditHistory.setChangePurpose("付款码消费:消费商户["+wxMerchant.getName()+"] 金额["+creditHistory.getSpendStr()+"元]"); | ||||
| wxCreditHistoryService.saveOrUpdate(creditHistory,wxMerchant.getTenantId()); | |||||
| wxCreditHistoryService.saveOrUpdate(creditHistory,wxMerchant); | |||||
| } catch (Exception e) { | } catch (Exception e) { | ||||
| logger.error("积分值:" + e.getMessage()); | logger.error("积分值:" + e.getMessage()); | ||||
| } | } | ||||
| @@ -3379,7 +3379,7 @@ public class WxOrderServiceImpl implements WxOrderService { | |||||
| creditHistory.setChangePurpose("积分兑换"+"["+coupon.getTitle()+"]"); | creditHistory.setChangePurpose("积分兑换"+"["+coupon.getTitle()+"]"); | ||||
| } | } | ||||
| wxCreditHistoryService.saveOrUpdate(creditHistory,coupon.getTenantId()); | |||||
| wxCreditHistoryService.saveOrUpdate(creditHistory,coupon); | |||||
| } | } | ||||
| @@ -165,7 +165,7 @@ public class WxQuestionOneselfUserServiceImpl implements WxQuestionOneselfUserSe | |||||
| wxCreditHistory.setCreditNum(wxQuestionOneself.getRewardCredit()); | wxCreditHistory.setCreditNum(wxQuestionOneself.getRewardCredit()); | ||||
| wxCreditHistory.setCreditType(EnumScoreType.QUESTION_ADD_CREDIT.getCode()); | wxCreditHistory.setCreditType(EnumScoreType.QUESTION_ADD_CREDIT.getCode()); | ||||
| wxCreditHistory.setChangePurpose(EnumScoreType.QUESTION_ADD_CREDIT.getMessage()); | wxCreditHistory.setChangePurpose(EnumScoreType.QUESTION_ADD_CREDIT.getMessage()); | ||||
| wxCreditHistoryService.saveOrUpdate(wxCreditHistory,record.getTenantId()); | |||||
| wxCreditHistoryService.saveOrUpdate(wxCreditHistory,record); | |||||
| } | } | ||||
| } | } | ||||
| @@ -5,14 +5,13 @@ import com.alibaba.fastjson.JSONArray; | |||||
| import com.alibaba.fastjson.JSONObject; | import com.alibaba.fastjson.JSONObject; | ||||
| import com.iformall.common.ErrorCode; | import com.iformall.common.ErrorCode; | ||||
| import com.iformall.common.IdWorker; | import com.iformall.common.IdWorker; | ||||
| import com.iformall.common.ResultData; | |||||
| import com.iformall.domain.po.*; | import com.iformall.domain.po.*; | ||||
| import com.iformall.domain.po.base.TenantEntity; | import com.iformall.domain.po.base.TenantEntity; | ||||
| import com.iformall.enums.*; | import com.iformall.enums.*; | ||||
| import com.iformall.exception.MallinkException; | import com.iformall.exception.MallinkException; | ||||
| import com.iformall.mapper.*; | import com.iformall.mapper.*; | ||||
| import com.iformall.service.WxBusinessService; | |||||
| import com.iformall.service.WxCUserService; | |||||
| import com.iformall.service.WxScoreRulesService; | |||||
| import com.iformall.service.*; | |||||
| import com.iformall.utils.Constant; | import com.iformall.utils.Constant; | ||||
| import org.apache.commons.lang3.StringUtils; | import org.apache.commons.lang3.StringUtils; | ||||
| import org.slf4j.Logger; | import org.slf4j.Logger; | ||||
| @@ -55,6 +54,13 @@ public class WxScoreRulesServiceImpl implements WxScoreRulesService { | |||||
| @Autowired | @Autowired | ||||
| WxBusinessService wxBusinessService; | WxBusinessService wxBusinessService; | ||||
| @Autowired | |||||
| WxMallDisposeService wxMallDisposeService; | |||||
| @Autowired | |||||
| WxMallService wxMallService; | |||||
| @Override | @Override | ||||
| public void wxScoreRulesInit(String tenantId) { | public void wxScoreRulesInit(String tenantId) { | ||||
| WxScoreRules wxScoreRules = new WxScoreRules(); | WxScoreRules wxScoreRules = new WxScoreRules(); | ||||
| @@ -76,13 +82,7 @@ public class WxScoreRulesServiceImpl implements WxScoreRulesService { | |||||
| } | } | ||||
| @Override | @Override | ||||
| public WxScoreRules getScoreRules(TenantEntity tenantEntity) { | |||||
| String tenantId = ""; | |||||
| if(StringUtils.isNotBlank(tenantEntity.getParentTenantId())){ | |||||
| tenantId = tenantEntity.getParentTenantId(); | |||||
| }else{ | |||||
| tenantId = tenantEntity.getTenantId(); | |||||
| } | |||||
| public WxScoreRules getScoreRules(String tenantId) { | |||||
| // get pushLime from cache | // get pushLime from cache | ||||
| String key = Constant.SCORE_RULES_KEY_PREV + tenantId; | String key = Constant.SCORE_RULES_KEY_PREV + tenantId; | ||||
| @@ -97,18 +97,20 @@ public class WxScoreRulesServiceImpl implements WxScoreRulesService { | |||||
| scoreRules.setTenantId(tenantId); | scoreRules.setTenantId(tenantId); | ||||
| scoreRules.setType(EnumScoreRules.SCORE.getCode()); | scoreRules.setType(EnumScoreRules.SCORE.getCode()); | ||||
| List<WxScoreRules> list = wxScoreRulesMapper.findList(scoreRules); | List<WxScoreRules> list = wxScoreRulesMapper.findList(scoreRules); | ||||
| TenantEntity baseTenantEntity = new TenantEntity(); | |||||
| baseTenantEntity.setTenantId(tenantId); | |||||
| if (list.size() > 0) { | if (list.size() > 0) { | ||||
| scoreRules = list.get(0); | scoreRules = list.get(0); | ||||
| scoreRules.setRules(getScoreRulesNew(tenantEntity,scoreRules.getRules(),EnumScoreRules.SCORE)); | |||||
| scoreRules.setRules(getScoreRulesNew(baseTenantEntity,scoreRules.getRules(),EnumScoreRules.SCORE)); | |||||
| } else { | } else { | ||||
| // 如果成长值规则不存在,启用默认值 | // 如果成长值规则不存在,启用默认值 | ||||
| this.saveOrUpdate(scoreRules); | |||||
| //final IdWorker idWorker = IdWorker.get(); | |||||
| //scoreRules.setId(idWorker.nextId()); | |||||
| //scoreRules.setRules(WxScoreRules.getScoreDefaultRules()); | |||||
| // | |||||
| //wxScoreRulesMapper.insert(scoreRules); | |||||
| final IdWorker idWorker = IdWorker.get(); | |||||
| scoreRules.setId(idWorker.nextId()); | |||||
| scoreRules.setRules(getScoreRulesNew(baseTenantEntity,WxScoreRules.getScoreDefaultRules(),EnumScoreRules.SCORE)); | |||||
| scoreRules.setCreditLocked(EnumCreditLockedStatus.OPEN.getCode()); | |||||
| wxScoreRulesMapper.insert(scoreRules); | |||||
| } | } | ||||
| // 插入缓存 | // 插入缓存 | ||||
| scoreRulesRedisTemplate.opsForValue().set(key, scoreRules); | scoreRulesRedisTemplate.opsForValue().set(key, scoreRules); | ||||
| @@ -117,6 +119,18 @@ public class WxScoreRulesServiceImpl implements WxScoreRulesService { | |||||
| return scoreRules; | return scoreRules; | ||||
| } | } | ||||
| @Override | |||||
| public WxScoreRules getScoreRules(TenantEntity tenantEntity) { | |||||
| WxScoreRules scoreRules = null; | |||||
| WxMallDispose mallDispose = wxMallDisposeService.getMallDispose(tenantEntity); | |||||
| if(EnumMallDispose.MALL.equals(mallDispose.getGrowthValueDispose())){ | |||||
| scoreRules = this.getScoreRules(tenantEntity.getTenantId()); | |||||
| }else{ | |||||
| scoreRules = this.getScoreRules(tenantEntity.getFinalTenantId()); | |||||
| } | |||||
| return scoreRules; | |||||
| } | |||||
| //当成长值或积分规则新增时,将新增的数据一并返回给接口调用端 | //当成长值或积分规则新增时,将新增的数据一并返回给接口调用端 | ||||
| private String getScoreRulesNew(TenantEntity tenantEntity,String scoreRules,EnumScoreRules enumScoreRules){ | private String getScoreRulesNew(TenantEntity tenantEntity,String scoreRules,EnumScoreRules enumScoreRules){ | ||||
| JSONObject businessObject = WxScoreRules.getRuleObj(scoreRules, EnumScoreType.CONSUMPTION); | JSONObject businessObject = WxScoreRules.getRuleObj(scoreRules, EnumScoreType.CONSUMPTION); | ||||
| @@ -168,12 +182,6 @@ public class WxScoreRulesServiceImpl implements WxScoreRulesService { | |||||
| @Override | @Override | ||||
| public WxScoreRules getCreditRules(String tenantId) { | public WxScoreRules getCreditRules(String tenantId) { | ||||
| // String tenantId = ""; | |||||
| // if(StringUtils.isNotBlank(tenantEntity.getParentTenantId())){ | |||||
| // tenantId = tenantEntity.getParentTenantId(); | |||||
| // }else{ | |||||
| // tenantId = tenantEntity.getTenantId(); | |||||
| // } | |||||
| // get pushLime from cache | // get pushLime from cache | ||||
| String key = Constant.CREDIT_RULES_KEY_PREV + tenantId; | String key = Constant.CREDIT_RULES_KEY_PREV + tenantId; | ||||
| @@ -187,10 +195,10 @@ public class WxScoreRulesServiceImpl implements WxScoreRulesService { | |||||
| WxScoreRules scoreRules = new WxScoreRules(); | WxScoreRules scoreRules = new WxScoreRules(); | ||||
| scoreRules.setTenantId(tenantId); | scoreRules.setTenantId(tenantId); | ||||
| scoreRules.setType(EnumScoreRules.CREDIT.getCode()); | scoreRules.setType(EnumScoreRules.CREDIT.getCode()); | ||||
| List<WxScoreRules> list = wxScoreRulesMapper.findList(scoreRules); | |||||
| TenantEntity baseTenantEntity = new TenantEntity(); | TenantEntity baseTenantEntity = new TenantEntity(); | ||||
| baseTenantEntity.setTenantId(tenantId); | baseTenantEntity.setTenantId(tenantId); | ||||
| List<WxScoreRules> list = wxScoreRulesMapper.findList(scoreRules); | |||||
| if (list.size() > 0) { | if (list.size() > 0) { | ||||
| scoreRules = list.get(0); | scoreRules = list.get(0); | ||||
| scoreRules.setRules(getScoreRulesNew(baseTenantEntity,scoreRules.getRules(),EnumScoreRules.CREDIT)); | scoreRules.setRules(getScoreRulesNew(baseTenantEntity,scoreRules.getRules(),EnumScoreRules.CREDIT)); | ||||
| @@ -198,8 +206,9 @@ public class WxScoreRulesServiceImpl implements WxScoreRulesService { | |||||
| // 如果积分规则不存在,启用默认值 | // 如果积分规则不存在,启用默认值 | ||||
| final IdWorker idWorker = IdWorker.get(); | final IdWorker idWorker = IdWorker.get(); | ||||
| scoreRules.setId(idWorker.nextId()); | scoreRules.setId(idWorker.nextId()); | ||||
| scoreRules.setRules(getScoreRulesNew(baseTenantEntity,null,EnumScoreRules.CREDIT)); | |||||
| scoreRules.setRules(getScoreRulesNew(baseTenantEntity,WxScoreRules.getCreditDefaultRules(),EnumScoreRules.CREDIT)); | |||||
| scoreRules.setScale(WxScoreRules.DEFAULT_SCALE); | scoreRules.setScale(WxScoreRules.DEFAULT_SCALE); | ||||
| scoreRules.setCreditLocked(EnumCreditLockedStatus.OPEN.getCode()); | |||||
| wxScoreRulesMapper.insert(scoreRules); | wxScoreRulesMapper.insert(scoreRules); | ||||
| } | } | ||||
| @@ -210,12 +219,23 @@ public class WxScoreRulesServiceImpl implements WxScoreRulesService { | |||||
| return scoreRules; | return scoreRules; | ||||
| } | } | ||||
| @Override | |||||
| public WxScoreRules getCreditRules(TenantEntity tenantEntity) { | |||||
| WxScoreRules scoreRules = null; | |||||
| WxMallDispose mallDispose = wxMallDisposeService.getMallDispose(tenantEntity); | |||||
| if(EnumMallDispose.MALL.equals(mallDispose.getPointsDispose())){ | |||||
| scoreRules = this.getCreditRules(tenantEntity.getTenantId()); | |||||
| }else{ | |||||
| scoreRules = this.getCreditRules(tenantEntity.getFinalTenantId()); | |||||
| } | |||||
| return scoreRules; | |||||
| } | |||||
| @Override | @Override | ||||
| public void saveOrUpdate(WxScoreRules record) { | public void saveOrUpdate(WxScoreRules record) { | ||||
| //校验规则不能重复 | //校验规则不能重复 | ||||
| Date date = new Date(); | Date date = new Date(); | ||||
| record.setUpdateDate(date); | record.setUpdateDate(date); | ||||
| if (record.getId() == null) { | if (record.getId() == null) { | ||||
| @@ -255,8 +275,6 @@ public class WxScoreRulesServiceImpl implements WxScoreRulesService { | |||||
| } | } | ||||
| } | } | ||||
| //更新商户数据 | |||||
| //updateMerchantCreditLocked(record); | |||||
| } | } | ||||
| @Override | @Override | ||||
| @@ -675,6 +693,14 @@ public class WxScoreRulesServiceImpl implements WxScoreRulesService { | |||||
| updateMerchantCreditLocked(wxScoreRules); | updateMerchantCreditLocked(wxScoreRules); | ||||
| } | } | ||||
| public void updateMerchantCreditLocked(WxScoreRules wxScoreRules) { | |||||
| WxMerchant wxMerchant = new WxMerchant(); | |||||
| wxMerchant.updateTenantInfo(wxScoreRules); | |||||
| wxMerchant.setStatus(wxScoreRules.getCreditLocked()); | |||||
| wxMerchant.setUpdateDate(new Date()); | |||||
| wxMerchantMapper.updateCreditLocked(wxMerchant); | |||||
| } | |||||
| @Override | @Override | ||||
| public WxScoreRules getCreditDoubleRules(String tenantId) { | public WxScoreRules getCreditDoubleRules(String tenantId) { | ||||
| String key = Constant.CREDIT_DOUBLE_RULES_KEY_PREV + tenantId; | String key = Constant.CREDIT_DOUBLE_RULES_KEY_PREV + tenantId; | ||||
| @@ -701,11 +727,18 @@ public class WxScoreRulesServiceImpl implements WxScoreRulesService { | |||||
| return scoreRules; | return scoreRules; | ||||
| } | } | ||||
| public void updateMerchantCreditLocked(WxScoreRules wxScoreRules) { | |||||
| WxMerchant wxMerchant = new WxMerchant(); | |||||
| wxMerchant.updateTenantInfo(wxScoreRules); | |||||
| wxMerchant.setStatus(wxScoreRules.getCreditLocked()); | |||||
| wxMerchant.setUpdateDate(new Date()); | |||||
| wxMerchantMapper.updateCreditLocked(wxMerchant); | |||||
| @Override | |||||
| public WxScoreRules getCreditDoubleRules(TenantEntity tenantEntity) { | |||||
| if(wxMallService.isgroupSupport(tenantEntity)){ | |||||
| return null; | |||||
| } | |||||
| return getCreditDoubleRules(tenantEntity.getTenantId()); | |||||
| } | |||||
| @Override | |||||
| public WxScoreRules getById(Long id) { | |||||
| return wxScoreRulesMapper.selectById(id); | |||||
| } | } | ||||
| } | } | ||||
| @@ -200,7 +200,7 @@ public class WxThirdPartyOrdersServiceImpl implements WxThirdPartyOrdersService | |||||
| creditHistory.setCreditType(EnumScoreType.CONSUMPTION.getCode()); | creditHistory.setCreditType(EnumScoreType.CONSUMPTION.getCode()); | ||||
| creditHistory.setSpend(record.getPayAmount()); | creditHistory.setSpend(record.getPayAmount()); | ||||
| creditHistory.setChangePurpose(record.getSourceAppName()+"·消费:商户["+record.getMerchantName()+"] ("+record.getPayAmountStr()+"元) "); | creditHistory.setChangePurpose(record.getSourceAppName()+"·消费:商户["+record.getMerchantName()+"] ("+record.getPayAmountStr()+"元) "); | ||||
| creditHistory = wxCreditHistoryService.saveOrUpdate(creditHistory,record.getTenantId()); | |||||
| creditHistory = wxCreditHistoryService.saveOrUpdate(creditHistory,record); | |||||
| Integer creditNum = 0; | Integer creditNum = 0; | ||||
| if (creditHistory.getCreditNum() != null) { | if (creditHistory.getCreditNum() != null) { | ||||
| creditNum = creditHistory.getCreditNum(); | creditNum = creditHistory.getCreditNum(); | ||||
| @@ -328,7 +328,7 @@ public class WxThirdPartyOrdersServiceImpl implements WxThirdPartyOrdersService | |||||
| creditHistory.setCreditNum(points); | creditHistory.setCreditNum(points); | ||||
| creditHistory.setSpend(0-record.getRefundAmount()); | creditHistory.setSpend(0-record.getRefundAmount()); | ||||
| creditHistory.setChangePurpose(record.getSourceAppName()+"·消费退款:商户["+record.getMerchantName()+"] ("+record.getRefundAmountStr()+"元) "); | creditHistory.setChangePurpose(record.getSourceAppName()+"·消费退款:商户["+record.getMerchantName()+"] ("+record.getRefundAmountStr()+"元) "); | ||||
| creditHistory = wxCreditHistoryService.saveOrUpdate(creditHistory,record.getTenantId()); | |||||
| creditHistory = wxCreditHistoryService.saveOrUpdate(creditHistory,record); | |||||
| if (creditHistory.getCreditNum() != null) { | if (creditHistory.getCreditNum() != null) { | ||||
| creditNum = creditHistory.getCreditNum(); | creditNum = creditHistory.getCreditNum(); | ||||
| @@ -431,7 +431,7 @@ public class WxThirdPartyOrdersServiceImpl implements WxThirdPartyOrdersService | |||||
| creditHistory.setCreditType(EnumScoreType.CHANGE_CREDIT.getCode()); | creditHistory.setCreditType(EnumScoreType.CHANGE_CREDIT.getCode()); | ||||
| creditHistory.setChangePurpose(record.getSourceAppName()+"·积分抵扣-"+record.getPayAmount()+"("+record.getSummary()+")"); | creditHistory.setChangePurpose(record.getSourceAppName()+"·积分抵扣-"+record.getPayAmount()+"("+record.getSummary()+")"); | ||||
| creditHistory.setCouponId(record.getId()); | creditHistory.setCouponId(record.getId()); | ||||
| creditHistory = wxCreditHistoryService.saveOrUpdate(creditHistory, record.getTenantId()); | |||||
| creditHistory = wxCreditHistoryService.saveOrUpdate(creditHistory, record); | |||||
| Integer creditNum = 0; | Integer creditNum = 0; | ||||
| if (creditHistory.getCreditNum() != null) { | if (creditHistory.getCreditNum() != null) { | ||||
| creditNum = creditHistory.getCreditNum(); | creditNum = creditHistory.getCreditNum(); | ||||
| @@ -521,7 +521,7 @@ public class WxThirdPartyOrdersServiceImpl implements WxThirdPartyOrdersService | |||||
| creditHistory.setCreditNum(record.getRefundAmount()); | creditHistory.setCreditNum(record.getRefundAmount()); | ||||
| creditHistory.setSpend(0-record.getRefundAmount()); | creditHistory.setSpend(0-record.getRefundAmount()); | ||||
| creditHistory.setChangePurpose(record.getSourceAppName()+"·积分抵扣退款:商户["+record.getMerchantName()+"] (-"+record.getRefundAmount()+") "); | creditHistory.setChangePurpose(record.getSourceAppName()+"·积分抵扣退款:商户["+record.getMerchantName()+"] (-"+record.getRefundAmount()+") "); | ||||
| creditHistory = wxCreditHistoryService.saveOrUpdate(creditHistory,record.getTenantId()); | |||||
| creditHistory = wxCreditHistoryService.saveOrUpdate(creditHistory,record); | |||||
| if (creditHistory.getCreditNum() != null) { | if (creditHistory.getCreditNum() != null) { | ||||
| creditNum = creditHistory.getCreditNum(); | creditNum = creditHistory.getCreditNum(); | ||||
| @@ -606,7 +606,7 @@ public class WxThirdPartyOrdersServiceImpl implements WxThirdPartyOrdersService | |||||
| } | } | ||||
| creditHistory.setCouponId(record.getId()); | creditHistory.setCouponId(record.getId()); | ||||
| creditHistory = wxCreditHistoryService.saveOrUpdate(creditHistory, record.getTenantId()); | |||||
| creditHistory = wxCreditHistoryService.saveOrUpdate(creditHistory, record); | |||||
| Integer creditNum = 0; | Integer creditNum = 0; | ||||
| if (creditHistory.getCreditNum() != null) { | if (creditHistory.getCreditNum() != null) { | ||||
| creditNum = creditHistory.getCreditNum(); | creditNum = creditHistory.getCreditNum(); | ||||
| @@ -73,7 +73,7 @@ public class FmInsideBasicUserCompleteInfoMsgServiceImpl implements MsgSendServi | |||||
| wxCreditHistory.setChangePurpose(EnumScoreType.COMPLETE_INFO.getMessage()); | wxCreditHistory.setChangePurpose(EnumScoreType.COMPLETE_INFO.getMessage()); | ||||
| wxCreditHistory.setOperatorType(EnumUserType.CUSERBASIC.getCode()); | wxCreditHistory.setOperatorType(EnumUserType.CUSERBASIC.getCode()); | ||||
| wxCreditHistory.setOperatorId(basicUserId); | wxCreditHistory.setOperatorId(basicUserId); | ||||
| wxCreditHistoryService.saveOrUpdate(wxCreditHistory,tenantEntity.getTenantId()); | |||||
| wxCreditHistoryService.saveOrUpdate(wxCreditHistory,tenantEntity); | |||||
| //打标签 | //打标签 | ||||
| wxCUserTagsService.triggerAssignTags(EnumAssignTagsTrigger.ASSIGN_TAGS_TRIGGER_IMPORT, basicInfo,tenantEntity,null); | wxCUserTagsService.triggerAssignTags(EnumAssignTagsTrigger.ASSIGN_TAGS_TRIGGER_IMPORT, basicInfo,tenantEntity,null); | ||||
| @@ -97,7 +97,7 @@ public class ParkHelper { | |||||
| wxCreditHistory.setChangePurpose(EnumScoreType.BIND_CAR.getMessage()); | wxCreditHistory.setChangePurpose(EnumScoreType.BIND_CAR.getMessage()); | ||||
| wxCreditHistory.setOperatorType(EnumUserType.CUSERBASIC.getCode()); | wxCreditHistory.setOperatorType(EnumUserType.CUSERBASIC.getCode()); | ||||
| wxCreditHistory.setOperatorId(cuUserId); | wxCreditHistory.setOperatorId(cuUserId); | ||||
| wxCreditHistoryService.saveOrUpdate(wxCreditHistory,park.getTenantId()); | |||||
| wxCreditHistoryService.saveOrUpdate(wxCreditHistory,park); | |||||
| } | } | ||||
| public ResultData unbindCar(Map<String, String> paramMap, WxPark park, Long cuUserId) { | public ResultData unbindCar(Map<String, String> paramMap, WxPark park, Long cuUserId) { | ||||
| @@ -29,7 +29,7 @@ public class CreditUtil { | |||||
| * @param wxLevelConfigMapper | * @param wxLevelConfigMapper | ||||
| * @return | * @return | ||||
| */ | */ | ||||
| public static int calUserCredit(int creditOrigin, WxCUserBasicInfo wxCUserBasicInfo, String tenantId, WxScoreRulesService wxScoreRulesService, WxLevelConfigMapper wxLevelConfigMapper) { | |||||
| public static int calUserCredit(int creditOrigin, WxCUserBasicInfo wxCUserBasicInfo, TenantEntity tenantEntity, WxScoreRulesService wxScoreRulesService, WxLevelConfigMapper wxLevelConfigMapper) { | |||||
| Long userId = wxCUserBasicInfo.getId(); | Long userId = wxCUserBasicInfo.getId(); | ||||
| Integer score = wxCUserBasicInfo.getPoins(); | Integer score = wxCUserBasicInfo.getPoins(); | ||||
| String finalTenantId = wxCUserBasicInfo.getFinalTenantId(); | String finalTenantId = wxCUserBasicInfo.getFinalTenantId(); | ||||
| @@ -39,10 +39,10 @@ public class CreditUtil { | |||||
| int levelScale = getLevelScale(score, levelScaleConfig); | int levelScale = getLevelScale(score, levelScaleConfig); | ||||
| // 获取生日积分倍率: | // 获取生日积分倍率: | ||||
| int birthdayScale = getBirthdayScale(wxCUserBasicInfo, tenantId, wxScoreRulesService); | |||||
| int birthdayScale = getBirthdayScale(wxCUserBasicInfo, tenantEntity, wxScoreRulesService); | |||||
| // 获取会员日倍率: | // 获取会员日倍率: | ||||
| int memberDayScale = getMemberDayScale(tenantId, wxScoreRulesService); | |||||
| int memberDayScale = getMemberDayScale(tenantEntity, wxScoreRulesService); | |||||
| int creditNew = new BigDecimal(creditOrigin) | int creditNew = new BigDecimal(creditOrigin) | ||||
| .multiply(new BigDecimal(levelScale)) | .multiply(new BigDecimal(levelScale)) | ||||
| @@ -86,7 +86,7 @@ public class CreditUtil { | |||||
| * @param wxScoreRulesService | * @param wxScoreRulesService | ||||
| * @return | * @return | ||||
| */ | */ | ||||
| private static int getBirthdayScale(WxCUserBasicInfo wxCUserBasicInfo,String tenantId, WxScoreRulesService wxScoreRulesService) { | |||||
| private static int getBirthdayScale(WxCUserBasicInfo wxCUserBasicInfo,TenantEntity tenantEntity, WxScoreRulesService wxScoreRulesService) { | |||||
| int birthdayScale = WxScoreRules.DEFAULT_SCALE; | int birthdayScale = WxScoreRules.DEFAULT_SCALE; | ||||
| if (Objects.isNull(wxCUserBasicInfo) || StringUtils.isBlank(wxCUserBasicInfo.getPhone())) { | if (Objects.isNull(wxCUserBasicInfo) || StringUtils.isBlank(wxCUserBasicInfo.getPhone())) { | ||||
| return 0; | return 0; | ||||
| @@ -96,7 +96,7 @@ public class CreditUtil { | |||||
| if(Objects.isNull(wxCUserBasicInfo.getScoreDate())) { | if(Objects.isNull(wxCUserBasicInfo.getScoreDate())) { | ||||
| //设置过生日的用户 | //设置过生日的用户 | ||||
| if (Objects.nonNull(wxCUserBasicInfo.getBirthdate()) && DateUtils.isBirthdays(wxCUserBasicInfo.getBirthdate())) { | if (Objects.nonNull(wxCUserBasicInfo.getBirthdate()) && DateUtils.isBirthdays(wxCUserBasicInfo.getBirthdate())) { | ||||
| birthdayScale = getBirthdayScoreScale(tenantId,wxScoreRulesService); | |||||
| birthdayScale = getBirthdayScoreScale(tenantEntity,wxScoreRulesService); | |||||
| } else { | } else { | ||||
| log.info("积分倍率计算:未设置生日或生日条件未匹配={}", wxCUserBasicInfo.getScoreDate()); | log.info("积分倍率计算:未设置生日或生日条件未匹配={}", wxCUserBasicInfo.getScoreDate()); | ||||
| } | } | ||||
| @@ -106,11 +106,11 @@ public class CreditUtil { | |||||
| int year = DateUtils.getYear(new Date()); | int year = DateUtils.getYear(new Date()); | ||||
| if(scoreYear == year){ | if(scoreYear == year){ | ||||
| if(DateUtils.isBirthdays(wxCUserBasicInfo.getScoreDate())){ | if(DateUtils.isBirthdays(wxCUserBasicInfo.getScoreDate())){ | ||||
| birthdayScale = getBirthdayScoreScale(tenantId, wxScoreRulesService); | |||||
| birthdayScale = getBirthdayScoreScale(tenantEntity, wxScoreRulesService); | |||||
| } | } | ||||
| }else{ | }else{ | ||||
| if (Objects.nonNull(wxCUserBasicInfo.getBirthdate()) && DateUtils.isBirthdays(wxCUserBasicInfo.getBirthdate())) { | if (Objects.nonNull(wxCUserBasicInfo.getBirthdate()) && DateUtils.isBirthdays(wxCUserBasicInfo.getBirthdate())) { | ||||
| birthdayScale = getBirthdayScoreScale(tenantId,wxScoreRulesService); | |||||
| birthdayScale = getBirthdayScoreScale(tenantEntity,wxScoreRulesService); | |||||
| } else { | } else { | ||||
| log.info("积分倍率计算:未设置生日或生日条件未匹配={}", wxCUserBasicInfo.getScoreDate()); | log.info("积分倍率计算:未设置生日或生日条件未匹配={}", wxCUserBasicInfo.getScoreDate()); | ||||
| } | } | ||||
| @@ -133,9 +133,9 @@ public class CreditUtil { | |||||
| * @param wxScoreRulesService | * @param wxScoreRulesService | ||||
| * @return | * @return | ||||
| */ | */ | ||||
| public static int getBirthdayScoreScale(String tenantId, WxScoreRulesService wxScoreRulesService) { | |||||
| public static int getBirthdayScoreScale(TenantEntity tenantEntity, WxScoreRulesService wxScoreRulesService) { | |||||
| int birthdayScale = WxScoreRules.DEFAULT_SCALE; | int birthdayScale = WxScoreRules.DEFAULT_SCALE; | ||||
| WxScoreRules rules = wxScoreRulesService.getCreditDoubleRules(tenantId); | |||||
| WxScoreRules rules = wxScoreRulesService.getCreditDoubleRules(tenantEntity); | |||||
| if (Objects.nonNull(rules) && Objects.nonNull(rules.getScale())) { | if (Objects.nonNull(rules) && Objects.nonNull(rules.getScale())) { | ||||
| //规则存使用积分倍率 | //规则存使用积分倍率 | ||||
| birthdayScale = rules.getScale(); | birthdayScale = rules.getScale(); | ||||
| @@ -154,10 +154,10 @@ public class CreditUtil { | |||||
| * @param wxScoreRulesService | * @param wxScoreRulesService | ||||
| * @return | * @return | ||||
| */ | */ | ||||
| private static int getMemberDayScale(String tenantId, WxScoreRulesService wxScoreRulesService) { | |||||
| private static int getMemberDayScale(TenantEntity tenantEntity, WxScoreRulesService wxScoreRulesService) { | |||||
| int memberDayScale = WxScoreRules.DEFAULT_SCALE; | int memberDayScale = WxScoreRules.DEFAULT_SCALE; | ||||
| WxScoreRules rules = wxScoreRulesService.getCreditDoubleRules(tenantId); | |||||
| WxScoreRules rules = wxScoreRulesService.getCreditDoubleRules(tenantEntity); | |||||
| if (Objects.nonNull(rules) && Objects.nonNull(rules.getRules())) { | if (Objects.nonNull(rules) && Objects.nonNull(rules.getRules())) { | ||||
| Date date = new Date(); | Date date = new Date(); | ||||
| int weekDay = DateUtils.getWeekOfDate(date); | int weekDay = DateUtils.getWeekOfDate(date); | ||||