Просмотр исходного кода

//scorerules

release_toaliyun_real
xhxu 3 лет назад
Родитель
Сommit
35f2121579
30 измененных файлов: 266 добавлений и 160 удалений
  1. +1
    -1
      mallinkAdmin/src/main/java/com/iformall/controller/basic/WxMallDisposeController.java
  2. +1
    -1
      mallinkAdmin/src/main/java/com/iformall/controller/mem/WxCreditHistoryController.java
  3. +43
    -31
      mallinkAdmin/src/main/java/com/iformall/controller/mem/WxScoreRulesController.java
  4. +41
    -0
      mallinkAdmin/src/main/resources/db/migration/V2023032800002_add_permission.sql
  5. +1
    -1
      mallinkBApi/src/main/java/com/iformall/controller/WxCUserController.java
  6. +1
    -1
      mallinkBApi/src/main/java/com/iformall/controller/WxCreditHistoryController.java
  7. +1
    -1
      mallinkBApi/src/main/java/com/iformall/controller/WxMerchantBUserController.java
  8. +2
    -2
      mallinkCApi/src/main/java/com/iformall/controller/WxCreditHistoryController.java
  9. +2
    -2
      mallinkPosApi/src/main/java/com/iformall/service/impl/PosServiceImpl.java
  10. +1
    -1
      mallinkSchedule/src/main/java/com/iformall/schedule/CouponSendSchedule.java
  11. +5
    -0
      mallinkService/src/main/java/com/iformall/domain/po/WxScoreRules.java
  12. +1
    -1
      mallinkService/src/main/java/com/iformall/service/WxCreditHistoryService.java
  13. +21
    -1
      mallinkService/src/main/java/com/iformall/service/WxScoreRulesService.java
  14. +2
    -2
      mallinkService/src/main/java/com/iformall/service/impl/AliBusinessCircleOrderServiceImpl.java
  15. +1
    -1
      mallinkService/src/main/java/com/iformall/service/impl/WxActivityJoinServiceImpl.java
  16. +2
    -2
      mallinkService/src/main/java/com/iformall/service/impl/WxBusinessCircleOrderServiceImpl.java
  17. +2
    -2
      mallinkService/src/main/java/com/iformall/service/impl/WxCUserBasicInfoServiceImpl.java
  18. +1
    -1
      mallinkService/src/main/java/com/iformall/service/impl/WxCUserBasicSignServiceImpl.java
  19. +2
    -2
      mallinkService/src/main/java/com/iformall/service/impl/WxCardSpendServiceImpl.java
  20. +2
    -2
      mallinkService/src/main/java/com/iformall/service/impl/WxCouponOrderServiceImpl.java
  21. +38
    -44
      mallinkService/src/main/java/com/iformall/service/impl/WxCreditHistoryServiceImpl.java
  22. +2
    -2
      mallinkService/src/main/java/com/iformall/service/impl/WxGameServiceImpl.java
  23. +3
    -2
      mallinkService/src/main/java/com/iformall/service/impl/WxMallDisposeServiceImpl.java
  24. +2
    -2
      mallinkService/src/main/java/com/iformall/service/impl/WxOrderServiceImpl.java
  25. +1
    -1
      mallinkService/src/main/java/com/iformall/service/impl/WxQuestionOneselfUserServiceImpl.java
  26. +69
    -36
      mallinkService/src/main/java/com/iformall/service/impl/WxScoreRulesServiceImpl.java
  27. +5
    -5
      mallinkService/src/main/java/com/iformall/service/impl/WxThirdPartyOrdersServiceImpl.java
  28. +1
    -1
      mallinkService/src/main/java/com/iformall/service/msg/impl/FmInsideBasicUserCompleteInfoMsgServiceImpl.java
  29. +1
    -1
      mallinkService/src/main/java/com/iformall/service/park/impl/util/ParkHelper.java
  30. +11
    -11
      mallinkService/src/main/java/com/iformall/utils/CreditUtil.java

+ 1
- 1
mallinkAdmin/src/main/java/com/iformall/controller/basic/WxMallDisposeController.java Просмотреть файл

@@ -51,7 +51,7 @@ public class WxMallDisposeController extends BaseController {
return new ResultData(page);
}

@ApiOperation("分页列表接口")
@ApiOperation("查询配置")
@GetMapping("getMallDispose")
@SystemControllerLog(description = "列表")
public ResultData getMallDispose() {


+ 1
- 1
mallinkAdmin/src/main/java/com/iformall/controller/mem/WxCreditHistoryController.java Просмотреть файл

@@ -109,7 +109,7 @@ public class WxCreditHistoryController extends BaseController {
wxCreditHistory.setChangePurpose(desc);
try {
wxCreditHistoryService.creditUsercheck(wxCreditHistory.getCUserId(),getTenantInfo()) ;
WxCreditHistory credit = wxCreditHistoryService.saveOrUpdate(wxCreditHistory,getTenantInfo().getTenantId());
WxCreditHistory credit = wxCreditHistoryService.saveOrUpdate(wxCreditHistory,getTenantInfo());
return new ResultData(Result.SUCCESS, "操作成功", credit);
} catch (MallinkException e) {
logger.error(e.getMessage());


+ 43
- 31
mallinkAdmin/src/main/java/com/iformall/controller/mem/WxScoreRulesController.java Просмотреть файл

@@ -5,11 +5,14 @@ import com.iformall.common.ErrorCode;
import com.iformall.common.ResultData;
import com.iformall.controller.base.BaseController;
import com.iformall.domain.po.WxMall;
import com.iformall.domain.po.WxMallDispose;
import com.iformall.domain.po.WxScoreRules;
import com.iformall.domain.po.base.TenantEntity;
import com.iformall.enums.EnumCreditLockedStatus;
import com.iformall.enums.EnumGroupSupport;
import com.iformall.enums.EnumMallDispose;
import com.iformall.enums.EnumScoreRules;
import com.iformall.service.WxMallDisposeService;
import com.iformall.service.WxMallService;
import com.iformall.service.WxScoreRulesService;
import io.swagger.annotations.Api;
@@ -26,20 +29,23 @@ import org.springframework.web.bind.annotation.*;
public class WxScoreRulesController extends BaseController {
private final Logger logger = LoggerFactory.getLogger(this.getClass());

@Autowired
private WxMallDisposeService wxMallDisposeService;

@Autowired
private WxScoreRulesService wxScoreRulesService;

@Autowired
private WxMallService wxMallService;

@ApiOperation("成长值配置")
@ApiOperation("获取成长值配置")
@GetMapping("setting")
@SystemControllerLog(description = "成长值-配置")
public ResultData list() {
logger.debug("[" + getIpAddr() + "] WxScoreRulesController::list");
public ResultData setting() {
logger.debug("[" + getIpAddr() + "] WxScoreRulesController::setting");
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);
}
@@ -49,50 +55,56 @@ public class WxScoreRulesController extends BaseController {
@SystemControllerLog(description = "成长值-积分-配置-新增")
public ResultData add(@RequestBody WxScoreRules wxScoreRules) {
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()) {
return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(),"规则内容有项重复");
return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(),"规则内容有项重复");
}
wxScoreRulesService.saveOrUpdate(wxScoreRules);
return new ResultData();
}

@ApiOperation("积分配置")
@ApiOperation("获取积分配置")
@GetMapping("/credit_rules")
@SystemControllerLog(description = "积分-配置")
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);
}

@ApiOperation("积分倍率")
@ApiOperation("获取积分倍率设置")
@GetMapping("/credit_double")
@SystemControllerLog(description = "积分-配置")
public ResultData creditDoubleRulesList() {
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);
}



+ 41
- 0
mallinkAdmin/src/main/resources/db/migration/V2023032800002_add_permission.sql Просмотреть файл

@@ -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;


+ 1
- 1
mallinkBApi/src/main/java/com/iformall/controller/WxCUserController.java Просмотреть файл

@@ -270,7 +270,7 @@ public class WxCUserController extends BaseController {
wxCreditHistory.setChangePurpose("商户端["+wxMerchant.getName()+"]操作完善个人信息");
wxCreditHistory.setOperatorType(EnumUserType.BUSER.getCode());
wxCreditHistory.setOperatorId(bUser.getId());
wxCreditHistoryService.saveOrUpdate(wxCreditHistory,wxMerchant.getTenantId());
wxCreditHistoryService.saveOrUpdate(wxCreditHistory,wxMerchant);
}




+ 1
- 1
mallinkBApi/src/main/java/com/iformall/controller/WxCreditHistoryController.java Просмотреть файл

@@ -128,7 +128,7 @@ public class WxCreditHistoryController extends BaseController {
if (null != 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()) {
wxCUserTagsService.updateTagByUserId(wxCreditHistory.getCUserId(),tenantInfo, wxCreditHistory.getTags());


+ 1
- 1
mallinkBApi/src/main/java/com/iformall/controller/WxMerchantBUserController.java Просмотреть файл

@@ -86,7 +86,7 @@ public class WxMerchantBUserController extends BaseController {
}

resultMap.put("creditLocked", merchant.getCreditLocked());
WxScoreRules scoreRules = wxScoreRulesService.getCreditRules(user.getFinalTenantId());
WxScoreRules scoreRules = wxScoreRulesService.getCreditRules(user);
if (scoreRules.getCreditLocked().equals(EnumCreditLockedStatus.CLOSE.getCode())) {
resultMap.put("creditLocked", EnumCreditLockedStatus.CLOSE.getCode());
}


+ 2
- 2
mallinkCApi/src/main/java/com/iformall/controller/WxCreditHistoryController.java Просмотреть файл

@@ -84,7 +84,7 @@ public class WxCreditHistoryController extends BaseController{

try {
wxCreditHistoryService.creditUsercheck(wxCreditHistory.getCUserId(),getTenantInfo()) ;
WxCreditHistory credit = wxCreditHistoryService.saveOrUpdate(wxCreditHistory,getTenantInfo().getTenantId());
WxCreditHistory credit = wxCreditHistoryService.saveOrUpdate(wxCreditHistory,getTenantInfo());
removeCacheCUser();
return new ResultData(Result.SUCCESS, "操作成功", credit);
} catch (MallinkException e) {
@@ -97,7 +97,7 @@ public class WxCreditHistoryController extends BaseController{
@GetMapping("/credit_rules")
public ResultData creditRulesList() {
logger.debug("[" + getIpAddr() + "] creditRulesList::list");
WxScoreRules scoreRules = wxScoreRulesService.getCreditRules(getTenantInfo().getFinalTenantId());
WxScoreRules scoreRules = wxScoreRulesService.getCreditRules(getTenantInfo());
return new ResultData(scoreRules);
}



+ 2
- 2
mallinkPosApi/src/main/java/com/iformall/service/impl/PosServiceImpl.java Просмотреть файл

@@ -1345,7 +1345,7 @@ public class PosServiceImpl implements PosService {
//如果券与商户一对一 则直接将消费商户更新为此商户 若一对多 则消费商户显示多商户
creditHistory.setMerchantId(wxMerchant.getId());
creditHistory.setChangePurpose("pos消费:消费商户["+wxMerchant.getName()+"] 卷名称["+coupon.getTitle()+"("+creditHistory.getSpendStr()+"元)] ");
creditHistory = creditHistoryService.saveOrUpdate(creditHistory,couponOrderCVo.getTenantId());
creditHistory = creditHistoryService.saveOrUpdate(creditHistory,couponOrderCVo);
if (creditHistory.getCreditNum() != null) {
return creditHistory.getCreditNum();
} else {
@@ -1374,7 +1374,7 @@ public class PosServiceImpl implements PosService {
//如果券与商户一对一 则直接将消费商户更新为此商户 若一对多 则消费商户显示多商户
creditHistory.setMerchantId(merchant.getId());
creditHistory.setChangePurpose("pos消费:消费商户["+merchant.getName()+"] 消费金额["+creditHistory.getSpendStr()+"元]");
creditHistory = creditHistoryService.saveOrUpdate(creditHistory,merchant.getTenantId());
creditHistory = creditHistoryService.saveOrUpdate(creditHistory,merchant);
if (creditHistory.getCreditNum() != null) {
return creditHistory.getCreditNum();
} else {


+ 1
- 1
mallinkSchedule/src/main/java/com/iformall/schedule/CouponSendSchedule.java Просмотреть файл

@@ -339,7 +339,7 @@ public class CouponSendSchedule {
}
}

int birthdayScale = CreditUtil.getBirthdayScoreScale(tenantEntity.getFinalTenantId(), wxScoreRulesService);
int birthdayScale = CreditUtil.getBirthdayScoreScale(tenantEntity, wxScoreRulesService);
for (WxCUserBasicInfo cu : couponSendedUsers) {
// 记录积分倍率日期
try {


+ 5
- 0
mallinkService/src/main/java/com/iformall/domain/po/WxScoreRules.java Просмотреть файл

@@ -189,4 +189,9 @@ public class WxScoreRules extends BaseTenantEntity {
return true;
}


@TableField(exist = false)
@io.swagger.annotations.ApiModelProperty(value="是否可编辑",name="isEditable")
private boolean isEditable;

}

+ 1
- 1
mallinkService/src/main/java/com/iformall/service/WxCreditHistoryService.java Просмотреть файл

@@ -54,7 +54,7 @@ public interface WxCreditHistoryService {
*
* @param record
*/
WxCreditHistory saveOrUpdate(WxCreditHistory record,String tenantId);
WxCreditHistory saveOrUpdate(WxCreditHistory record,TenantEntity tenantinfo);

/**
* 积分历史回退


+ 21
- 1
mallinkService/src/main/java/com/iformall/service/WxScoreRulesService.java Просмотреть файл

@@ -18,7 +18,14 @@ public interface WxScoreRulesService {

/**
* 获取租户的ScoreRules
* @param tenantEntity
* @param
* @return
*/
WxScoreRules getScoreRules(String tenantId);

/**
* 获取租户的ScoreRules
* @param
* @return
*/
WxScoreRules getScoreRules(TenantEntity tenantEntity);
@@ -29,6 +36,14 @@ public interface WxScoreRulesService {
* @return
*/
WxScoreRules getCreditRules(String tenantId);

/**
* 获取租户的积分规则
* @param
* @return
*/
WxScoreRules getCreditRules(TenantEntity tenantEntity);

/**
* 保存或更新实体
*
@@ -63,4 +78,9 @@ public interface WxScoreRulesService {
void updateCreditLocked(WxScoreRules wxScoreRules);

WxScoreRules getCreditDoubleRules(String tenantId);

WxScoreRules getCreditDoubleRules(TenantEntity tenantEntity);

WxScoreRules getById(Long id);

}

+ 2
- 2
mallinkService/src/main/java/com/iformall/service/impl/AliBusinessCircleOrderServiceImpl.java Просмотреть файл

@@ -205,7 +205,7 @@ public class AliBusinessCircleOrderServiceImpl implements AliBusinessCircleOrder
creditHistory.setCreditType(EnumScoreType.CONSUMPTION.getCode());
creditHistory.setSpend(record.getPayAmount());
creditHistory.setChangePurpose("支付宝商圈消费:商户["+record.getMerchantName()+"] ("+record.getPayAmountStr()+"元) ");
creditHistory = creditHistoryService.saveOrUpdate(creditHistory,record.getTenantId());
creditHistory = creditHistoryService.saveOrUpdate(creditHistory,record);
Integer creditNum = 0;
if (creditHistory.getCreditNum() != null) {
creditNum = creditHistory.getCreditNum();
@@ -324,7 +324,7 @@ public class AliBusinessCircleOrderServiceImpl implements AliBusinessCircleOrder
creditHistory.setCreditNum(points);
creditHistory.setSpend(0-record.getRefundAmount());
creditHistory.setChangePurpose("支付宝商圈退款:商户["+record.getMerchantName()+"] ("+record.getRefundAmountStr()+"元) ");
creditHistory = creditHistoryService.saveOrUpdate(creditHistory,record.getTenantId());
creditHistory = creditHistoryService.saveOrUpdate(creditHistory,record);

if (creditHistory.getCreditNum() != null) {
creditNum = creditHistory.getCreditNum();


+ 1
- 1
mallinkService/src/main/java/com/iformall/service/impl/WxActivityJoinServiceImpl.java Просмотреть файл

@@ -238,7 +238,7 @@ public class WxActivityJoinServiceImpl implements WxActivityJoinService {
wxCreditHistory.setChangePurpose(EnumScoreType.ACTIVITY_JOIN.getMessage()+"["+wxActivity.getTitle()+"]");
wxCreditHistory.setOperatorType(EnumUserType.CUSERBASIC.getCode());
wxCreditHistory.setOperatorId(wxActivityJoin.getUserId());
wxCreditHistoryService.saveOrUpdate(wxCreditHistory,wxActivity.getTenantId());
wxCreditHistoryService.saveOrUpdate(wxCreditHistory,wxActivity);
}

return new ResultData();


+ 2
- 2
mallinkService/src/main/java/com/iformall/service/impl/WxBusinessCircleOrderServiceImpl.java Просмотреть файл

@@ -223,7 +223,7 @@ public class WxBusinessCircleOrderServiceImpl implements WxBusinessCircleOrderSe
creditHistory.setCreditType(EnumScoreType.CONSUMPTION.getCode());
creditHistory.setSpend(record.getPayAmount());
creditHistory.setChangePurpose("微信商圈消费:商户["+record.getMerchantName()+"] ("+record.getPayAmountStr()+"元) ");
creditHistory = creditHistoryService.saveOrUpdate(creditHistory,record.getTenantId());
creditHistory = creditHistoryService.saveOrUpdate(creditHistory,record);

if (creditHistory.getCreditNum() != null) {
creditNum = creditHistory.getCreditNum();
@@ -350,7 +350,7 @@ public class WxBusinessCircleOrderServiceImpl implements WxBusinessCircleOrderSe
creditHistory.setCreditNum(points);
creditHistory.setSpend(0-record.getRefundAmount());
creditHistory.setChangePurpose("微信商圈退款:商户["+record.getMerchantName()+"] ("+record.getRefundAmountStr()+"元) ");
creditHistory = creditHistoryService.saveOrUpdate(creditHistory,record.getTenantId());
creditHistory = creditHistoryService.saveOrUpdate(creditHistory,record);

if (creditHistory.getCreditNum() != null) {
creditNum = creditHistory.getCreditNum();


+ 2
- 2
mallinkService/src/main/java/com/iformall/service/impl/WxCUserBasicInfoServiceImpl.java Просмотреть файл

@@ -724,7 +724,7 @@ public class WxCUserBasicInfoServiceImpl implements WxCUserBasicInfoService,IExc
wxCreditHistory.setChangePurpose(enumScoreType.getMessage());
wxCreditHistory.setOperatorType(EnumUserType.CUSERBASIC.getCode());
wxCreditHistory.setOperatorId(userId);
WxCreditHistory record = wxCreditHistoryService.saveOrUpdate(wxCreditHistory,tenantInfo.getTenantId());
WxCreditHistory record = wxCreditHistoryService.saveOrUpdate(wxCreditHistory,tenantInfo);
return record.getCreditAmount();
}

@@ -1188,7 +1188,7 @@ public class WxCUserBasicInfoServiceImpl implements WxCUserBasicInfoService,IExc
}
wxCreditHistory.setCreditAmount(credit);
wxCreditHistory.setCreditNum(credit);
wxCreditHistoryService.saveOrUpdate(wxCreditHistory,mallUserInfo.getTenantId());
wxCreditHistoryService.saveOrUpdate(wxCreditHistory,mallUserInfo);
}
} catch (Exception e) {
logger.error(e.getMessage());


+ 1
- 1
mallinkService/src/main/java/com/iformall/service/impl/WxCUserBasicSignServiceImpl.java Просмотреть файл

@@ -228,7 +228,7 @@ public class WxCUserBasicSignServiceImpl implements WxCUserBasicSignService {
wxCreditHistory.setChangePurpose(enumScoreType.getMessage());
wxCreditHistory.setOperatorType(EnumUserType.CUSERBASIC.getCode());
wxCreditHistory.setOperatorId(record.getUserId());
WxCreditHistory wxCreditHistory1 = wxCreditHistoryService.saveOrUpdate(wxCreditHistory, tenantEntity.getTenantId());
WxCreditHistory wxCreditHistory1 = wxCreditHistoryService.saveOrUpdate(wxCreditHistory, tenantEntity);
if(wxCreditHistory1.getCreditNum() == null){
return 0;
}


+ 2
- 2
mallinkService/src/main/java/com/iformall/service/impl/WxCardSpendServiceImpl.java Просмотреть файл

@@ -335,7 +335,7 @@ public class WxCardSpendServiceImpl implements WxCardSpendService {
creditHistory.setMerchantId(record.getMerchantId());
WxMerchant wxMerchant = wxMerchantMapper.selectById(record.getMerchantId());
creditHistory.setChangePurpose("卡消费:消费商户["+wxMerchant.getName()+"] 金额["+creditHistory.getSpendStr()+"元]");
wxCreditHistoryService.saveOrUpdate(creditHistory,record.getTenantId());
wxCreditHistoryService.saveOrUpdate(creditHistory,record);
} catch (Exception e) {
logger.error("积分值:" + e.getMessage());
}
@@ -1334,7 +1334,7 @@ public class WxCardSpendServiceImpl implements WxCardSpendService {
creditHistory.setMerchantId(record.getMerchantId());
// WxMerchant wxMerchant = wxMerchantMapper.selectById(record.getMerchantId());
creditHistory.setChangePurpose("pos卡消费:消费商户["+merchant.getName()+"] 金额["+creditHistory.getSpendStr()+"元]");
creditHistory = wxCreditHistoryService.saveOrUpdate(creditHistory,record.getTenantId());
creditHistory = wxCreditHistoryService.saveOrUpdate(creditHistory,record);
if (creditHistory != null) {
scoreCreditCalc.setCredit(scoreCreditCalc.getCredit() + creditHistory.getCreditNum());
}


+ 2
- 2
mallinkService/src/main/java/com/iformall/service/impl/WxCouponOrderServiceImpl.java Просмотреть файл

@@ -1663,7 +1663,7 @@ public class WxCouponOrderServiceImpl implements WxCouponOrderService {
creditHistory.setBusinessId(wxCoupon.getBusiness());
creditHistory.setSpend(couponOrder.getCouponPrice());
creditHistory.setChangePurpose("券["+wxCoupon.getTitle()+"("+creditHistory.getSpendStr()+"元)] 使用成功");
wxCreditHistoryService.saveOrUpdate(creditHistory,couponOrder.getTenantId());
wxCreditHistoryService.saveOrUpdate(creditHistory,couponOrder);
} catch (Exception e) {
logger.error("积分值:" + e.getMessage());
}
@@ -1700,7 +1700,7 @@ public class WxCouponOrderServiceImpl implements WxCouponOrderService {
creditHistory.setBusinessId(wxCoupon.getBusiness());
creditHistory.setSpend(couponOrder.getCouponPrice());
creditHistory.setChangePurpose("核销停车劵["+wxCoupon.getTitle()+"("+creditHistory.getSpendStr()+"元)] ");
wxCreditHistoryService.saveOrUpdate(creditHistory,couponOrder.getTenantId());
wxCreditHistoryService.saveOrUpdate(creditHistory,couponOrder);
} catch (Exception e) {
logger.error("积分值:" + e.getMessage());
}


+ 38
- 44
mallinkService/src/main/java/com/iformall/service/impl/WxCreditHistoryServiceImpl.java Просмотреть файл

@@ -577,7 +577,7 @@ public class WxCreditHistoryServiceImpl implements WxCreditHistoryService {

@Override
@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());
if (wxCUserBasicInfo == null) {
//验证此用户是否存在
@@ -598,7 +598,7 @@ public class WxCreditHistoryServiceImpl implements WxCreditHistoryService {
}
record.setCreditAmount(currentCreditAmount);

int creditChangeNumOrigin = creditIncrement(record);
int creditChangeNumOrigin = creditIncrement(record,tenantEntity);
int creditChangeNum = creditChangeNumOrigin ;
//是否参与了生日积分倍率
boolean hasBirthDateCredit = false;
@@ -606,7 +606,7 @@ public class WxCreditHistoryServiceImpl implements WxCreditHistoryService {
|| record.getCreditType().equals(EnumScoreType.SPEND_CREDIT.getCode())) {
//等级积分配置
try {
creditChangeNum = CreditUtil.calUserCredit(creditChangeNumOrigin, wxCUserBasicInfo, tenantId, wxScoreRulesService,wxLevelConfigMapper);
creditChangeNum = CreditUtil.calUserCredit(creditChangeNumOrigin, wxCUserBasicInfo, tenantEntity, wxScoreRulesService,wxLevelConfigMapper);
if (Objects.nonNull(CreditUtil.getIsBirthDayScale())) {
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());


@@ -664,19 +660,17 @@ public class WxCreditHistoryServiceImpl implements WxCreditHistoryService {
return record;
}

private void sendCreditUpdRemind(WxCUserBasicInfo wxCUserBasicInfo,WxCreditHistory record,String tenantId){
private void sendCreditUpdRemind(WxCUserBasicInfo wxCUserBasicInfo,WxCreditHistory record,TenantEntity tenantEntity){
try {
WxTemplateMsg temp = new WxTemplateMsg();
// temp.updateTenantInfo(record);
temp.setTenantId(tenantId);
temp.updateTenantInfo(tenantEntity);
temp.setType(EnumTemplateType.CREDIT_UPD_REMIND.getCode());
temp = wxTemplateMsgService.getByObj(temp);
if(temp != null){
String openId = wxCUserMapper.findOpenId(wxCUserBasicInfo.getId(),tenantId);
String openId = wxCUserMapper.findOpenId(wxCUserBasicInfo.getId(),tenantEntity.getTenantId());
if(StringUtils.isNotBlank(openId)){
WxMsg msg = new WxMsg();
// msg.updateTenantInfo(record);
msg.setTenantId(tenantId);
msg.updateTenantInfo(tenantEntity);
// msg.setWay(EnumSendWay.APPINFOR.getCode());
// msg.setIsright(EnumMsgSend.MSG_SEND_IMMEDIATELY.getCode());
// msg.setStatus(EnumMsgStatus.MSG_STATUS_NOT_SEND.getCode());
@@ -755,11 +749,11 @@ public class WxCreditHistoryServiceImpl implements WxCreditHistoryService {
int creditNew = 0 ;
if (StringUtils.isNotBlank(spendStr)) {
wxCreditHistory.setSpend(new BigDecimal(spendStr).multiply(new BigDecimal(100)).intValue());
credit = payAddCredit(wxCreditHistory);
credit = payAddCredit(wxCreditHistory,wxMerchant);
if (Objects.nonNull(userId)) {
WxCUserBasicInfo wxCUserBasicInfo = wxCUserBasicInfoMapper.selectById(userId,wxMerchant.getFinalTenantId());
try {
creditNew = CreditUtil.calUserCredit(credit, wxCUserBasicInfo, wxMerchant.getTenantId(), wxScoreRulesService,wxLevelConfigMapper);
creditNew = CreditUtil.calUserCredit(credit, wxCUserBasicInfo, wxMerchant, wxScoreRulesService,wxLevelConfigMapper);
} catch (Exception e) {
logger.error("积分倍率计算异常",e);
} finally {
@@ -776,23 +770,23 @@ public class WxCreditHistoryServiceImpl implements WxCreditHistoryService {


//根据积分类型计算"增加积分"
private int creditIncrement(WxCreditHistory record) {
private int creditIncrement(WxCreditHistory record,TenantEntity tenantEntity) {
//查找C端用户的成长值
if (record.getCreditType() == EnumScoreType.LOGIN.getCode()) {
// return loginAddCredit(record);//登陆加积分取消
// return loginAddCredit(record,tenantEntity);//登陆加积分取消
return 0;
}
if (record.getCreditType() == EnumScoreType.BIND_CAR.getCode()) {
return bindCarAddCredit(record);
return bindCarAddCredit(record,tenantEntity);
}
// if (record.getCreditType() == EnumScoreType.WECHAT_PERSION.getCode()) {
// return personAddCredit(record);
// return personAddCredit(record,tenantEntity);
// }
if (record.getCreditType() == EnumScoreType.WECHAT_PHONE.getCode()) {
return phoneAddCredit(record);
return phoneAddCredit(record,tenantEntity);
}
if (record.getCreditType() == EnumScoreType.COMPLETE_INFO.getCode()) {
return infoAddCredit(record);
return infoAddCredit(record,tenantEntity);
}
if (record.getCreditType() == EnumScoreType.SPEND_CREDIT.getCode()) {
return spendCredit(record);
@@ -801,7 +795,7 @@ public class WxCreditHistoryServiceImpl implements WxCreditHistoryService {
return changeCredit(record);
}
if (record.getCreditType() == EnumScoreType.CONSUMPTION.getCode()) {
return payAddCredit(record);
return payAddCredit(record,tenantEntity);
}
if (record.getCreditType() == EnumScoreType.REDUCE_CREDIT.getCode()) {
return reduceCredit(record);
@@ -820,16 +814,16 @@ public class WxCreditHistoryServiceImpl implements WxCreditHistoryService {
}

if (record.getCreditType() == EnumScoreType.SIGN_IN_DAY.getCode()) {
return signinCredit(record);
return signinCredit(record,tenantEntity);
}
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()) {
return signinMonthCredit(record,EnumScoreType.SIGN_IN_FTDAY);
return signinMonthCredit(record,tenantEntity,EnumScoreType.SIGN_IN_FTDAY);
}
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()) {
@@ -854,59 +848,59 @@ public class WxCreditHistoryServiceImpl implements WxCreditHistoryService {
return -reduceCredit;
}

private int loginAddCredit(WxCreditHistory record) {
private int loginAddCredit(WxCreditHistory record,TenantEntity tenantEntity) {
//如果当天已经登录过则跳过
if (wxCreditHistoryMapper.loginCount(record) > 0) {
return 0;
}
// 1. 获取当前租户下积分的增加规则
WxScoreRules wxScoreRules = wxScoreRulesService.getCreditRules(record.getTenantId());
WxScoreRules wxScoreRules = wxScoreRulesService.getCreditRules(tenantEntity);
// 2. 增长的积分
return wxScoreRules.getRule(EnumScoreType.LOGIN, WxScoreRules.SCORE);
}

private int signinCredit(WxCreditHistory record) {
private int signinCredit(WxCreditHistory record,TenantEntity tenantEntity) {
//如果当天已经登录过则跳过
if (wxCreditHistoryMapper.loginCount(record) > 0) {
return 0;
}
// 1. 获取当前租户下积分的增加规则
WxScoreRules wxScoreRules = wxScoreRulesService.getCreditRules(record.getTenantId());
WxScoreRules wxScoreRules = wxScoreRulesService.getCreditRules(tenantEntity);
// 2. 增长的积分
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) {
// return 0;
// }
// 1. 获取当前租户下积分的增加规则
WxScoreRules wxScoreRules = wxScoreRulesService.getCreditRules(record.getTenantId());
WxScoreRules wxScoreRules = wxScoreRulesService.getCreditRules(tenantEntity);
// 2. 增长的积分
return wxScoreRules.getRule(enumScoreType, WxScoreRules.SCORE);
}

private int bindCarAddCredit(WxCreditHistory record) {
private int bindCarAddCredit(WxCreditHistory record,TenantEntity tenantEntity) {
if (wxCreditHistoryMapper.countList(record) > 0) {
return 0;
}
// 1. 获取score rules
WxScoreRules wxScoreRules = wxScoreRulesService.getCreditRules(record.getTenantId());
WxScoreRules wxScoreRules = wxScoreRulesService.getCreditRules(tenantEntity);
// 2. 增长的积分
return wxScoreRules.getRule(EnumScoreType.BIND_CAR, WxScoreRules.SCORE);
}

// private int personAddCredit(WxCreditHistory record) {
// private int personAddCredit(WxCreditHistory record,TenantEntity tenantEntity) {
// // 1. 获取score rules
// WxScoreRules wxScoreRules = wxScoreRulesService.getCreditRules(record.getTenantId());
// WxScoreRules wxScoreRules = wxScoreRulesService.getCreditRules(tenantEntity);
// // 2. 增长的积分
// return wxScoreRules.getRule(EnumScoreType.WECHAT_PERSION, WxScoreRules.SCORE);
// }

private int phoneAddCredit(WxCreditHistory record) {
private int phoneAddCredit(WxCreditHistory record,TenantEntity tenantEntity) {
// 1. 获取score rules
WxScoreRules wxScoreRules = wxScoreRulesService.getCreditRules(record.getTenantId());
WxScoreRules wxScoreRules = wxScoreRulesService.getCreditRules(tenantEntity);
// 2. 获取成长值
return wxScoreRules.getRule(EnumScoreType.WECHAT_PHONE, WxScoreRules.SCORE);
}
@@ -920,12 +914,12 @@ public class WxCreditHistoryServiceImpl implements WxCreditHistoryService {
return wxCreditHistoryMapper.countList(wxCreditHistory);
}

private int infoAddCredit(WxCreditHistory record) {
private int infoAddCredit(WxCreditHistory record,TenantEntity tenantEntity) {
WxCUserBasicInfo user = wxCUserBasicInfoMapper.selectById(record.getCUserId(),record.getTenantId());
if (user == null || checkCompleteInfoScoreCount(user) > 0)
return 0;
// 1. 获取score rules
WxScoreRules scoreRules = wxScoreRulesService.getCreditRules(record.getTenantId());
WxScoreRules scoreRules = wxScoreRulesService.getCreditRules(tenantEntity);
// 2. 获取成长值
return scoreRules.getRule(EnumScoreType.COMPLETE_INFO, WxScoreRules.SCORE);
}
@@ -948,13 +942,13 @@ public class WxCreditHistoryServiceImpl implements WxCreditHistoryService {
return -changeCredit;
}

private int payAddCredit(WxCreditHistory record) {
private int payAddCredit(WxCreditHistory record,TenantEntity tenantEntity) {
int addCreditNumber = 0;
// 订单金额为0时不计入
if (record.getCreditNum() != null && record.getCreditNum() == 0)
return 0;
// 1. 获取score rules
WxScoreRules scoreRules = wxScoreRulesService.getCreditRules(record.getTenantId());
WxScoreRules scoreRules = wxScoreRulesService.getCreditRules(tenantEntity);

// 2. 获取成长值 by id
JSONObject payRule = WxScoreRules.getRuleObj(scoreRules.getRules(),EnumScoreType.CONSUMPTION);


+ 2
- 2
mallinkService/src/main/java/com/iformall/service/impl/WxGameServiceImpl.java Просмотреть файл

@@ -481,7 +481,7 @@ public class WxGameServiceImpl implements WxGameService {
wxCreditHistory.setCreditType(EnumScoreType.GAME_ADD_CREDIT.getCode());
wxCreditHistory.setChangePurpose(EnumScoreType.GAME_ADD_CREDIT.getMessage());
wxCreditHistoryService.creditUsercheck(wxCreditHistory.getCUserId(),wxGame) ;
wxCreditHistoryService.saveOrUpdate(wxCreditHistory,wxGame.getTenantId());
wxCreditHistoryService.saveOrUpdate(wxCreditHistory,wxGame);
addCredit = credit;
orderId = Constant.creditPlayOrderIdTab;
}else{
@@ -528,7 +528,7 @@ public class WxGameServiceImpl implements WxGameService {
wxCreditHistory.setCreditType(EnumScoreType.GAME_LES_CREDIT.getCode());
wxCreditHistory.setChangePurpose(EnumScoreType.GAME_LES_CREDIT.getMessage());
wxCreditHistoryService.creditUsercheck(wxCreditHistory.getCUserId(),wxGame) ;
wxCreditHistoryService.saveOrUpdate(wxCreditHistory,wxGame.getTenantId());
wxCreditHistoryService.saveOrUpdate(wxCreditHistory,wxGame);

return this.luckDraw(gameId,userId,wxGame.getPlayCredit());
}else{


+ 3
- 2
mallinkService/src/main/java/com/iformall/service/impl/WxMallDisposeServiceImpl.java Просмотреть файл

@@ -59,8 +59,9 @@ public class WxMallDisposeServiceImpl implements WxMallDisposeService {
mallDispose = new WxMallDispose();
mallDispose.updateTenantInfo(tenantEntity);
}
if(wxMallService.isgroupSupport(tenantEntity)){
//如果是集团,都可以配置
if(wxMallService.isgroupSupport(tenantEntity)
|| StringUtils.isBlank(tenantEntity.getParentTenantId())){
//如果是集团,单广场,都可以配置
mallDispose.setPointsDispose(EnumMallDispose.MALL.getCode());
mallDispose.setGrowthValueDispose(EnumMallDispose.MALL.getCode());
}else{


+ 2
- 2
mallinkService/src/main/java/com/iformall/service/impl/WxOrderServiceImpl.java Просмотреть файл

@@ -2379,7 +2379,7 @@ public class WxOrderServiceImpl implements WxOrderService {
creditHistory.setChangePurpose("付款码消费:消费商户["+wxMerchant.getName()+"] 金额["+creditHistory.getSpendStr()+"元]");


wxCreditHistoryService.saveOrUpdate(creditHistory,wxMerchant.getTenantId());
wxCreditHistoryService.saveOrUpdate(creditHistory,wxMerchant);
} catch (Exception e) {
logger.error("积分值:" + e.getMessage());
}
@@ -3379,7 +3379,7 @@ public class WxOrderServiceImpl implements WxOrderService {
creditHistory.setChangePurpose("积分兑换"+"["+coupon.getTitle()+"]");
}

wxCreditHistoryService.saveOrUpdate(creditHistory,coupon.getTenantId());
wxCreditHistoryService.saveOrUpdate(creditHistory,coupon);
}




+ 1
- 1
mallinkService/src/main/java/com/iformall/service/impl/WxQuestionOneselfUserServiceImpl.java Просмотреть файл

@@ -165,7 +165,7 @@ public class WxQuestionOneselfUserServiceImpl implements WxQuestionOneselfUserSe
wxCreditHistory.setCreditNum(wxQuestionOneself.getRewardCredit());
wxCreditHistory.setCreditType(EnumScoreType.QUESTION_ADD_CREDIT.getCode());
wxCreditHistory.setChangePurpose(EnumScoreType.QUESTION_ADD_CREDIT.getMessage());
wxCreditHistoryService.saveOrUpdate(wxCreditHistory,record.getTenantId());
wxCreditHistoryService.saveOrUpdate(wxCreditHistory,record);
}

}


+ 69
- 36
mallinkService/src/main/java/com/iformall/service/impl/WxScoreRulesServiceImpl.java Просмотреть файл

@@ -5,14 +5,13 @@ import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.iformall.common.ErrorCode;
import com.iformall.common.IdWorker;
import com.iformall.common.ResultData;
import com.iformall.domain.po.*;
import com.iformall.domain.po.base.TenantEntity;
import com.iformall.enums.*;
import com.iformall.exception.MallinkException;
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 org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
@@ -55,6 +54,13 @@ public class WxScoreRulesServiceImpl implements WxScoreRulesService {
@Autowired
WxBusinessService wxBusinessService;

@Autowired
WxMallDisposeService wxMallDisposeService;

@Autowired
WxMallService wxMallService;


@Override
public void wxScoreRulesInit(String tenantId) {
WxScoreRules wxScoreRules = new WxScoreRules();
@@ -76,13 +82,7 @@ public class WxScoreRulesServiceImpl implements WxScoreRulesService {
}

@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
String key = Constant.SCORE_RULES_KEY_PREV + tenantId;

@@ -97,18 +97,20 @@ public class WxScoreRulesServiceImpl implements WxScoreRulesService {
scoreRules.setTenantId(tenantId);
scoreRules.setType(EnumScoreRules.SCORE.getCode());
List<WxScoreRules> list = wxScoreRulesMapper.findList(scoreRules);

TenantEntity baseTenantEntity = new TenantEntity();
baseTenantEntity.setTenantId(tenantId);
if (list.size() > 0) {
scoreRules = list.get(0);
scoreRules.setRules(getScoreRulesNew(tenantEntity,scoreRules.getRules(),EnumScoreRules.SCORE));
scoreRules.setRules(getScoreRulesNew(baseTenantEntity,scoreRules.getRules(),EnumScoreRules.SCORE));

} 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);
@@ -117,6 +119,18 @@ public class WxScoreRulesServiceImpl implements WxScoreRulesService {
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){
JSONObject businessObject = WxScoreRules.getRuleObj(scoreRules, EnumScoreType.CONSUMPTION);
@@ -168,12 +182,6 @@ public class WxScoreRulesServiceImpl implements WxScoreRulesService {
@Override
public WxScoreRules getCreditRules(String tenantId) {
// String tenantId = "";
// if(StringUtils.isNotBlank(tenantEntity.getParentTenantId())){
// tenantId = tenantEntity.getParentTenantId();
// }else{
// tenantId = tenantEntity.getTenantId();
// }
// get pushLime from cache
String key = Constant.CREDIT_RULES_KEY_PREV + tenantId;

@@ -187,10 +195,10 @@ public class WxScoreRulesServiceImpl implements WxScoreRulesService {
WxScoreRules scoreRules = new WxScoreRules();
scoreRules.setTenantId(tenantId);
scoreRules.setType(EnumScoreRules.CREDIT.getCode());
List<WxScoreRules> list = wxScoreRulesMapper.findList(scoreRules);

TenantEntity baseTenantEntity = new TenantEntity();
baseTenantEntity.setTenantId(tenantId);
List<WxScoreRules> list = wxScoreRulesMapper.findList(scoreRules);
if (list.size() > 0) {
scoreRules = list.get(0);
scoreRules.setRules(getScoreRulesNew(baseTenantEntity,scoreRules.getRules(),EnumScoreRules.CREDIT));
@@ -198,8 +206,9 @@ public class WxScoreRulesServiceImpl implements WxScoreRulesService {
// 如果积分规则不存在,启用默认值
final IdWorker idWorker = IdWorker.get();
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.setCreditLocked(EnumCreditLockedStatus.OPEN.getCode());
wxScoreRulesMapper.insert(scoreRules);
}

@@ -210,12 +219,23 @@ public class WxScoreRulesServiceImpl implements WxScoreRulesService {
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
public void saveOrUpdate(WxScoreRules record) {
//校验规则不能重复

Date date = new Date();
record.setUpdateDate(date);
if (record.getId() == null) {
@@ -255,8 +275,6 @@ public class WxScoreRulesServiceImpl implements WxScoreRulesService {
}
}

//更新商户数据
//updateMerchantCreditLocked(record);
}

@Override
@@ -675,6 +693,14 @@ public class WxScoreRulesServiceImpl implements WxScoreRulesService {
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
public WxScoreRules getCreditDoubleRules(String tenantId) {
String key = Constant.CREDIT_DOUBLE_RULES_KEY_PREV + tenantId;
@@ -701,11 +727,18 @@ public class WxScoreRulesServiceImpl implements WxScoreRulesService {
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);
}

}

+ 5
- 5
mallinkService/src/main/java/com/iformall/service/impl/WxThirdPartyOrdersServiceImpl.java Просмотреть файл

@@ -200,7 +200,7 @@ public class WxThirdPartyOrdersServiceImpl implements WxThirdPartyOrdersService
creditHistory.setCreditType(EnumScoreType.CONSUMPTION.getCode());
creditHistory.setSpend(record.getPayAmount());
creditHistory.setChangePurpose(record.getSourceAppName()+"·消费:商户["+record.getMerchantName()+"] ("+record.getPayAmountStr()+"元) ");
creditHistory = wxCreditHistoryService.saveOrUpdate(creditHistory,record.getTenantId());
creditHistory = wxCreditHistoryService.saveOrUpdate(creditHistory,record);
Integer creditNum = 0;
if (creditHistory.getCreditNum() != null) {
creditNum = creditHistory.getCreditNum();
@@ -328,7 +328,7 @@ public class WxThirdPartyOrdersServiceImpl implements WxThirdPartyOrdersService
creditHistory.setCreditNum(points);
creditHistory.setSpend(0-record.getRefundAmount());
creditHistory.setChangePurpose(record.getSourceAppName()+"·消费退款:商户["+record.getMerchantName()+"] ("+record.getRefundAmountStr()+"元) ");
creditHistory = wxCreditHistoryService.saveOrUpdate(creditHistory,record.getTenantId());
creditHistory = wxCreditHistoryService.saveOrUpdate(creditHistory,record);

if (creditHistory.getCreditNum() != null) {
creditNum = creditHistory.getCreditNum();
@@ -431,7 +431,7 @@ public class WxThirdPartyOrdersServiceImpl implements WxThirdPartyOrdersService
creditHistory.setCreditType(EnumScoreType.CHANGE_CREDIT.getCode());
creditHistory.setChangePurpose(record.getSourceAppName()+"·积分抵扣-"+record.getPayAmount()+"("+record.getSummary()+")");
creditHistory.setCouponId(record.getId());
creditHistory = wxCreditHistoryService.saveOrUpdate(creditHistory, record.getTenantId());
creditHistory = wxCreditHistoryService.saveOrUpdate(creditHistory, record);
Integer creditNum = 0;
if (creditHistory.getCreditNum() != null) {
creditNum = creditHistory.getCreditNum();
@@ -521,7 +521,7 @@ public class WxThirdPartyOrdersServiceImpl implements WxThirdPartyOrdersService
creditHistory.setCreditNum(record.getRefundAmount());
creditHistory.setSpend(0-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) {
creditNum = creditHistory.getCreditNum();
@@ -606,7 +606,7 @@ public class WxThirdPartyOrdersServiceImpl implements WxThirdPartyOrdersService
}

creditHistory.setCouponId(record.getId());
creditHistory = wxCreditHistoryService.saveOrUpdate(creditHistory, record.getTenantId());
creditHistory = wxCreditHistoryService.saveOrUpdate(creditHistory, record);
Integer creditNum = 0;
if (creditHistory.getCreditNum() != null) {
creditNum = creditHistory.getCreditNum();


+ 1
- 1
mallinkService/src/main/java/com/iformall/service/msg/impl/FmInsideBasicUserCompleteInfoMsgServiceImpl.java Просмотреть файл

@@ -73,7 +73,7 @@ public class FmInsideBasicUserCompleteInfoMsgServiceImpl implements MsgSendServi
wxCreditHistory.setChangePurpose(EnumScoreType.COMPLETE_INFO.getMessage());
wxCreditHistory.setOperatorType(EnumUserType.CUSERBASIC.getCode());
wxCreditHistory.setOperatorId(basicUserId);
wxCreditHistoryService.saveOrUpdate(wxCreditHistory,tenantEntity.getTenantId());
wxCreditHistoryService.saveOrUpdate(wxCreditHistory,tenantEntity);

//打标签
wxCUserTagsService.triggerAssignTags(EnumAssignTagsTrigger.ASSIGN_TAGS_TRIGGER_IMPORT, basicInfo,tenantEntity,null);


+ 1
- 1
mallinkService/src/main/java/com/iformall/service/park/impl/util/ParkHelper.java Просмотреть файл

@@ -97,7 +97,7 @@ public class ParkHelper {
wxCreditHistory.setChangePurpose(EnumScoreType.BIND_CAR.getMessage());
wxCreditHistory.setOperatorType(EnumUserType.CUSERBASIC.getCode());
wxCreditHistory.setOperatorId(cuUserId);
wxCreditHistoryService.saveOrUpdate(wxCreditHistory,park.getTenantId());
wxCreditHistoryService.saveOrUpdate(wxCreditHistory,park);
}
public ResultData unbindCar(Map<String, String> paramMap, WxPark park, Long cuUserId) {


+ 11
- 11
mallinkService/src/main/java/com/iformall/utils/CreditUtil.java Просмотреть файл

@@ -29,7 +29,7 @@ public class CreditUtil {
* @param wxLevelConfigMapper
* @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();
Integer score = wxCUserBasicInfo.getPoins();
String finalTenantId = wxCUserBasicInfo.getFinalTenantId();
@@ -39,10 +39,10 @@ public class CreditUtil {
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)
.multiply(new BigDecimal(levelScale))
@@ -86,7 +86,7 @@ public class CreditUtil {
* @param wxScoreRulesService
* @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;
if (Objects.isNull(wxCUserBasicInfo) || StringUtils.isBlank(wxCUserBasicInfo.getPhone())) {
return 0;
@@ -96,7 +96,7 @@ public class CreditUtil {
if(Objects.isNull(wxCUserBasicInfo.getScoreDate())) {
//设置过生日的用户
if (Objects.nonNull(wxCUserBasicInfo.getBirthdate()) && DateUtils.isBirthdays(wxCUserBasicInfo.getBirthdate())) {
birthdayScale = getBirthdayScoreScale(tenantId,wxScoreRulesService);
birthdayScale = getBirthdayScoreScale(tenantEntity,wxScoreRulesService);
} else {
log.info("积分倍率计算:未设置生日或生日条件未匹配={}", wxCUserBasicInfo.getScoreDate());
}
@@ -106,11 +106,11 @@ public class CreditUtil {
int year = DateUtils.getYear(new Date());
if(scoreYear == year){
if(DateUtils.isBirthdays(wxCUserBasicInfo.getScoreDate())){
birthdayScale = getBirthdayScoreScale(tenantId, wxScoreRulesService);
birthdayScale = getBirthdayScoreScale(tenantEntity, wxScoreRulesService);
}
}else{
if (Objects.nonNull(wxCUserBasicInfo.getBirthdate()) && DateUtils.isBirthdays(wxCUserBasicInfo.getBirthdate())) {
birthdayScale = getBirthdayScoreScale(tenantId,wxScoreRulesService);
birthdayScale = getBirthdayScoreScale(tenantEntity,wxScoreRulesService);
} else {
log.info("积分倍率计算:未设置生日或生日条件未匹配={}", wxCUserBasicInfo.getScoreDate());
}
@@ -133,9 +133,9 @@ public class CreditUtil {
* @param wxScoreRulesService
* @return
*/
public static int getBirthdayScoreScale(String tenantId, WxScoreRulesService wxScoreRulesService) {
public static int getBirthdayScoreScale(TenantEntity tenantEntity, WxScoreRulesService wxScoreRulesService) {
int birthdayScale = WxScoreRules.DEFAULT_SCALE;
WxScoreRules rules = wxScoreRulesService.getCreditDoubleRules(tenantId);
WxScoreRules rules = wxScoreRulesService.getCreditDoubleRules(tenantEntity);
if (Objects.nonNull(rules) && Objects.nonNull(rules.getScale())) {
//规则存使用积分倍率
birthdayScale = rules.getScale();
@@ -154,10 +154,10 @@ public class CreditUtil {
* @param wxScoreRulesService
* @return
*/
private static int getMemberDayScale(String tenantId, WxScoreRulesService wxScoreRulesService) {
private static int getMemberDayScale(TenantEntity tenantEntity, WxScoreRulesService wxScoreRulesService) {
int memberDayScale = WxScoreRules.DEFAULT_SCALE;

WxScoreRules rules = wxScoreRulesService.getCreditDoubleRules(tenantId);
WxScoreRules rules = wxScoreRulesService.getCreditDoubleRules(tenantEntity);
if (Objects.nonNull(rules) && Objects.nonNull(rules.getRules())) {
Date date = new Date();
int weekDay = DateUtils.getWeekOfDate(date);


Загрузка…
Отмена
Сохранить