diff --git a/mallinkAdmin/src/main/resources/db/migration/V2023033000001_upd_merchant_credit_locked.sql b/mallinkAdmin/src/main/resources/db/migration/V2023033000001_upd_merchant_credit_locked.sql index fa6e682b0..e94ae4fc7 100644 --- a/mallinkAdmin/src/main/resources/db/migration/V2023033000001_upd_merchant_credit_locked.sql +++ b/mallinkAdmin/src/main/resources/db/migration/V2023033000001_upd_merchant_credit_locked.sql @@ -13,9 +13,9 @@ DROP COLUMN `credit_locked`; --type=2 积分规则,追加老带新规则 缓存--缓存--缓存 -update wx_score_rules set rules = JSON_ARRAY_APPEND(rules, '$',CAST('{"id": 25, "desc": "老带新奖励", "step": 1, "limit": 0, "score": 0}' AS JSON)) +update wx_score_rules set rules = JSON_ARRAY_APPEND(rules, '$',CAST('{"id": 25, "desc": "会员推广奖励", "step": 1, "limit": 0, "score": 0}' AS JSON)) where type = 2; -update wx_score_rules set rules = JSON_ARRAY_APPEND(rules, '$',CAST('{"id": 26, "desc": "老带新消费奖励", "step": 1, "limit": 0, "score": 0}' AS JSON)) +update wx_score_rules set rules = JSON_ARRAY_APPEND(rules, '$',CAST('{"id": 26, "desc": "推广会员加积分奖励", "step": 1, "limit": 0, "score": 0}' AS JSON)) where type = 2; diff --git a/mallinkAdmin/src/main/resources/db/migration/V2023040300001_add_permission.sql b/mallinkAdmin/src/main/resources/db/migration/V2023040300001_add_permission.sql new file mode 100644 index 000000000..7767ac739 --- /dev/null +++ b/mallinkAdmin/src/main/resources/db/migration/V2023040300001_add_permission.sql @@ -0,0 +1,20 @@ +INSERT INTO `mallink`.`mall_permission`(`id`, `name`, `parent_id`, `available`, `permission`, `resource_type`, `module_color`, `module_color_num`, `url`, `icon`, `version_type`, `sort`) VALUES (210, '业态管理', 2, 'Y', NULL, 0, NULL, NULL, NULL, 'icon-tuoke', 0, 210); +INSERT INTO `mallink`.`mall_permission`(`id`, `name`, `parent_id`, `available`, `permission`, `resource_type`, `module_color`, `module_color_num`, `url`, `icon`, `version_type`, `sort`) VALUES (261, '业态列表', 210, 'Y', NULL, 1, NULL, NULL, 'businessTreeList', NULL, 0, 261); + + + +--205,251 + + +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, 205, 206, 207, 251, 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; diff --git a/mallinkService/src/main/java/com/iformall/enums/EnumScoreType.java b/mallinkService/src/main/java/com/iformall/enums/EnumScoreType.java index cafbbee96..98d3735c4 100644 --- a/mallinkService/src/main/java/com/iformall/enums/EnumScoreType.java +++ b/mallinkService/src/main/java/com/iformall/enums/EnumScoreType.java @@ -33,8 +33,8 @@ public enum EnumScoreType { REFUND_REDUCE_CREDIT(23, "积分兑换退款"), POINT_CHANGE(24, "其他积分变动"),// - OLD_WITH_NEW(25, "老带新奖励"), - OLD_WITH_NEW_CONSUME(26, "老带新消费奖励"), + OLD_WITH_NEW(25, "会员推广奖励"), + OLD_WITH_NEW_CONSUME(26, "推广会员加积分奖励"), ; public static EnumScoreType getEnum(Integer code) { diff --git a/mallinkService/src/main/java/com/iformall/mapper/TtCUserMapper.java b/mallinkService/src/main/java/com/iformall/mapper/TtCUserMapper.java index d8fbd308d..347c9addc 100644 --- a/mallinkService/src/main/java/com/iformall/mapper/TtCUserMapper.java +++ b/mallinkService/src/main/java/com/iformall/mapper/TtCUserMapper.java @@ -41,4 +41,6 @@ public interface TtCUserMapper extends CommonMapper { List findTokenList(@Param("id")Long id,@Param("userId")Long userId, @Param("tenantId")String tenantId); List findCountData(WxCUserBasicInfoDto dto); + + Long findCuserId(@Param("userId")Long userId, @Param("tenantId")String tenantId); } diff --git a/mallinkService/src/main/java/com/iformall/mapper/WxCUserFromMapper.java b/mallinkService/src/main/java/com/iformall/mapper/WxCUserFromMapper.java index 296b979f4..fb9ca1b5d 100644 --- a/mallinkService/src/main/java/com/iformall/mapper/WxCUserFromMapper.java +++ b/mallinkService/src/main/java/com/iformall/mapper/WxCUserFromMapper.java @@ -11,4 +11,6 @@ public interface WxCUserFromMapper extends CommonMapper{ List findList(WxCUserFrom record); List visits(WxCUserFromVo record); + + Long findfirstFromId(WxCUserFrom cUserFrom); } diff --git a/mallinkService/src/main/java/com/iformall/service/WxCUserBasicInfoService.java b/mallinkService/src/main/java/com/iformall/service/WxCUserBasicInfoService.java index 3df549dd4..95a59f9c6 100644 --- a/mallinkService/src/main/java/com/iformall/service/WxCUserBasicInfoService.java +++ b/mallinkService/src/main/java/com/iformall/service/WxCUserBasicInfoService.java @@ -172,7 +172,7 @@ public interface WxCUserBasicInfoService { WxCUserBasicInfo registerByPhone(TenantEntity tenantEntity, String phone, String nickName,String name, Integer sex, String avatarUrl); - int addCredit(Long userId, TenantEntity tenantInfo, EnumScoreType wechatPhone); + int addCredit(Long userId,Long fromUserId, TenantEntity tenantInfo, EnumScoreType scoreType); void registerJinmao(TenantEntity tenantInfo,WxCUserBasicInfo basicInfo); diff --git a/mallinkService/src/main/java/com/iformall/service/WxCUserFromService.java b/mallinkService/src/main/java/com/iformall/service/WxCUserFromService.java index 71cba8023..3a2f54318 100644 --- a/mallinkService/src/main/java/com/iformall/service/WxCUserFromService.java +++ b/mallinkService/src/main/java/com/iformall/service/WxCUserFromService.java @@ -1,8 +1,11 @@ package com.iformall.service; import com.github.pagehelper.PageInfo; +import com.iformall.domain.po.WxCUserBasicInfo; import com.iformall.domain.po.WxCUserFrom; +import com.iformall.domain.po.base.TenantEntity; import com.iformall.domain.vo.WxCUserFromVo; +import com.iformall.enums.EnumAppPlat; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; @@ -23,8 +26,11 @@ public interface WxCUserFromService { void save(WxCUserFrom wxCUserFrom); - void exportData(HttpServletRequest request, HttpServletResponse response, WxCUserFrom record); void exportDataVisits(HttpServletRequest request, HttpServletResponse response, WxCUserFromVo record); + + WxCUserBasicInfo selectOldByNew(TenantEntity tenantEntity, Long basicUserId, EnumAppPlat plat); + + void oldAddCredit(TenantEntity tenantEntity, Long basicUserId, EnumAppPlat wx); } diff --git a/mallinkService/src/main/java/com/iformall/service/cuser/CUserServiceApapter.java b/mallinkService/src/main/java/com/iformall/service/cuser/CUserServiceApapter.java index c45189f59..b0f06a5ea 100644 --- a/mallinkService/src/main/java/com/iformall/service/cuser/CUserServiceApapter.java +++ b/mallinkService/src/main/java/com/iformall/service/cuser/CUserServiceApapter.java @@ -50,4 +50,6 @@ public interface CUserServiceApapter { String updateQrCode(CUser user); List findCountData(WxCUserBasicInfoDto dto); + + Long findCuserId(Long basicUserId,String tenantId); } diff --git a/mallinkService/src/main/java/com/iformall/service/cuser/tt/TtBUserServiceAdapter.java b/mallinkService/src/main/java/com/iformall/service/cuser/tt/TtBUserServiceAdapter.java index 876ec32f5..0ba5d77cf 100644 --- a/mallinkService/src/main/java/com/iformall/service/cuser/tt/TtBUserServiceAdapter.java +++ b/mallinkService/src/main/java/com/iformall/service/cuser/tt/TtBUserServiceAdapter.java @@ -271,6 +271,11 @@ public class TtBUserServiceAdapter extends BasicCUserService implements CUserSer return null; } + @Override + public Long findCuserId(Long basicUserId, String tenantId) { + return null; + } + private void updateTokenCache(String token,Object cuser) { BaseCUserEntity baseUser = this.getByObj(cuser); setCache(token,baseUser); diff --git a/mallinkService/src/main/java/com/iformall/service/cuser/tt/TtCUserServiceAdapter.java b/mallinkService/src/main/java/com/iformall/service/cuser/tt/TtCUserServiceAdapter.java index fc4721436..56d69ebaf 100644 --- a/mallinkService/src/main/java/com/iformall/service/cuser/tt/TtCUserServiceAdapter.java +++ b/mallinkService/src/main/java/com/iformall/service/cuser/tt/TtCUserServiceAdapter.java @@ -362,6 +362,11 @@ public class TtCUserServiceAdapter extends BasicCUserService implements CUserSer return ttCUserMapper.findCountData(dto); } + @Override + public Long findCuserId(Long basicUserId, String tenantId) { + return ttCUserMapper.findCuserId(basicUserId,tenantId); + } + private void delForUserIdOnly(Long id, Long userId, String tenantId) { List tokenList = ttCUserMapper.findTokenList(id,userId, tenantId); diff --git a/mallinkService/src/main/java/com/iformall/service/cuser/wx/WxBUserServiceAdapter.java b/mallinkService/src/main/java/com/iformall/service/cuser/wx/WxBUserServiceAdapter.java index 26a028499..539a08736 100644 --- a/mallinkService/src/main/java/com/iformall/service/cuser/wx/WxBUserServiceAdapter.java +++ b/mallinkService/src/main/java/com/iformall/service/cuser/wx/WxBUserServiceAdapter.java @@ -275,6 +275,11 @@ public class WxBUserServiceAdapter extends BasicCUserService implements CUserSer return null; } + @Override + public Long findCuserId(Long basicUserId, String tenantId) { + return null; + } + private WxMaService getWxMaService(WxAppinfo wxAppinfo, Boolean isFmOpen) { WxMaService wxMaService = null; if (isFmOpen) { diff --git a/mallinkService/src/main/java/com/iformall/service/cuser/wx/WxCUserServiceAdapter.java b/mallinkService/src/main/java/com/iformall/service/cuser/wx/WxCUserServiceAdapter.java index ec967304b..3aca98cfd 100644 --- a/mallinkService/src/main/java/com/iformall/service/cuser/wx/WxCUserServiceAdapter.java +++ b/mallinkService/src/main/java/com/iformall/service/cuser/wx/WxCUserServiceAdapter.java @@ -375,6 +375,11 @@ public class WxCUserServiceAdapter extends BasicCUserService implements CUserSer return wxCUserMapper.findCountData(dto); } + @Override + public Long findCuserId(Long basicUserId, String tenantId) { + return wxCUserMapper.findCuserId(basicUserId,tenantId); + } + private WxMaService getWxMaService(WxAppinfo wxAppinfo, Boolean isFmOpen) { WxMaService wxMaService = null; if (isFmOpen) { diff --git a/mallinkService/src/main/java/com/iformall/service/impl/WxCUserBasicInfoServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/impl/WxCUserBasicInfoServiceImpl.java index e1b924e41..187d08978 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxCUserBasicInfoServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxCUserBasicInfoServiceImpl.java @@ -711,7 +711,7 @@ public class WxCUserBasicInfoServiceImpl implements WxCUserBasicInfoService,IExc } @Override - public int addCredit(Long userId, TenantEntity tenantInfo, EnumScoreType enumScoreType) { + public int addCredit(Long userId,Long fromUserId,TenantEntity tenantInfo, EnumScoreType scoreType) { if(userId == null){ return 0; } @@ -720,8 +720,8 @@ public class WxCUserBasicInfoServiceImpl implements WxCUserBasicInfoService,IExc wxCreditHistory.setTenantId(tenantInfo.getFinalTenantId()); wxCreditHistory.setFinalTenantId(tenantInfo.getFinalTenantId()); wxCreditHistory.setCreateDate(new Date()); - wxCreditHistory.setCreditType(enumScoreType.getCode()); - wxCreditHistory.setChangePurpose(enumScoreType.getMessage()); + wxCreditHistory.setCreditType(scoreType.getCode()); + wxCreditHistory.setChangePurpose(scoreType.getMessage()); wxCreditHistory.setOperatorType(EnumUserType.CUSERBASIC.getCode()); wxCreditHistory.setOperatorId(userId); WxCreditHistory record = wxCreditHistoryService.saveOrUpdate(wxCreditHistory,tenantInfo); diff --git a/mallinkService/src/main/java/com/iformall/service/impl/WxCUserFromServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/impl/WxCUserFromServiceImpl.java index d7b2fa755..2b576c47f 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxCUserFromServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxCUserFromServiceImpl.java @@ -3,12 +3,16 @@ package com.iformall.service.impl; import cn.afterturn.easypoi.handler.inter.IExcelExportServer; import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageInfo; +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.domain.vo.WxCUserFromVo; -import com.iformall.enums.EnumCUserFrom; +import com.iformall.enums.*; import com.iformall.mapper.*; import com.iformall.service.*; +import com.iformall.service.cuser.CUserServiceFactory; import lombok.extern.slf4j.Slf4j; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -28,6 +32,12 @@ public class WxCUserFromServiceImpl implements WxCUserFromService, IExcelExportS @Autowired WxCUserFromMapper wxCUserFromMapper; + @Autowired + CUserServiceFactory cuserFactory; + + @Autowired + private WxCUserBasicInfoService wxCUserBasicInfoService; + @Autowired WxCUserBasicInfoMapper wxCUserBasicInfoMapper; @@ -95,6 +105,46 @@ public class WxCUserFromServiceImpl implements WxCUserFromService, IExcelExportS // excelService.exportExcel(visits, null, "门店/用户分享报表", WxCUserFromVo.class, "门店/用户分享报表.xlsx", response, false); } + @Override + public WxCUserBasicInfo selectOldByNew(TenantEntity tenantEntity, Long basicUserId, EnumAppPlat plat) { + Long cuserId = cuserFactory.getCUserService(plat).findCuserId(basicUserId,tenantEntity.getTenantId()); + if(cuserId == null){ + return null; + } + WxCUserFrom cUserFrom = new WxCUserFrom(); + cUserFrom.updateTenantInfo(tenantEntity); + cUserFrom.setFromType(EnumCUserFrom.FROM_C_USER_BASIC_INFO.getCode()); + cUserFrom.setIsNewUser(EnumYesOrNo.YES.getCode()); + cUserFrom.setPlat(plat.getCode()); + cUserFrom.setCUserId(cuserId); + Long fromId = wxCUserFromMapper.findfirstFromId(cUserFrom); + if(fromId == null){ + return null; + } + WxCUserBasicInfo basicInfo = wxCUserBasicInfoMapper.selectById(fromId, tenantEntity.getFinalTenantId()); + if (null != basicInfo && EnumCreditLockedStatus.CLOSE.getCode().equals(basicInfo.getStatus())){ + logger.info("该会员已锁定>> "+ fromId); + return null; + } + return basicInfo; + } + + @Override + public void oldAddCredit(TenantEntity tenantEntity, Long basicUserId, EnumAppPlat plat) { + try{ + //查询推荐人 + WxCUserBasicInfo basicInfo = selectOldByNew(tenantEntity, basicUserId, plat); + if(basicInfo == null){ + return; + } + wxCUserBasicInfoService.addCredit(basicInfo.getId(),basicUserId,tenantEntity, EnumScoreType.OLD_WITH_NEW); + + }catch(Exception e){ + + } + + } + @Override public List selectListForExcelExport(Object queryParams, int page) { if(queryParams instanceof WxCUserFromVo){ diff --git a/mallinkService/src/main/java/com/iformall/service/impl/WxCreditHistoryServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/impl/WxCreditHistoryServiceImpl.java index 7022a55dd..78f854d1f 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxCreditHistoryServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxCreditHistoryServiceImpl.java @@ -636,7 +636,6 @@ public class WxCreditHistoryServiceImpl implements WxCreditHistoryService { wxMemberCardService.sendsyncMemberCardBonusMsg(tenantEntity,null,wxCUserBasicInfo.getId(),record.getId()); - } else { //wxCreditHistoryMapper.updateById(record); } @@ -829,6 +828,12 @@ public class WxCreditHistoryServiceImpl implements WxCreditHistoryService { record.setRulesTenantId(tenantEntity.getTenantId()); return record.getCreditNum(); } + if (record.getCreditType() == EnumScoreType.OLD_WITH_NEW.getCode()) { + return oldAddByNewCredit(record,tenantEntity); + } + if (record.getCreditType() == EnumScoreType.OLD_WITH_NEW_CONSUME.getCode()) { + return oldAddByNewConsumeCredit(record,tenantEntity); + } return 0; } @@ -985,4 +990,37 @@ public class WxCreditHistoryServiceImpl implements WxCreditHistoryService { return addCreditNumber; } + + private int oldAddByNewCredit(WxCreditHistory record,TenantEntity tenantEntity) { + WxScoreRules wxScoreRules = wxScoreRulesService.getCreditRules(tenantEntity); + record.setRulesTenantId(wxScoreRules.getTenantId()); + // 2. 获取积分 + return wxScoreRules.getRule(EnumScoreType.OLD_WITH_NEW, WxScoreRules.SCORE); + } + + private int oldAddByNewConsumeCredit(WxCreditHistory record,TenantEntity tenantEntity) { + + WxScoreRules wxScoreRules = wxScoreRulesService.getCreditRules(tenantEntity); + record.setRulesTenantId(wxScoreRules.getTenantId()); + + JSONObject newConsumeRules = WxScoreRules.getRuleObj(wxScoreRules.getRules(),EnumScoreType.OLD_WITH_NEW_CONSUME); + + Double priceCondition = newConsumeRules.getDouble(WxScoreRules.STEP) * 100; // 元->分 + int baseScore = newConsumeRules.getInteger(WxScoreRules.SCORE); // 消费增长积分 + + int addCreditNumber = 0; + + if (record.getSpend() >= priceCondition.intValue()) { + Double dScoreT = Math.floor(record.getSpend() * 1.0D / priceCondition * baseScore); + addCreditNumber = dScoreT.intValue(); + log.info("CREDIT:" + newConsumeRules.toJSONString() + "\nAddCredit: " + addCreditNumber); + } else { + log.info("CREDIT:" + newConsumeRules.toJSONString() + "\nAddCredit: 0, not touch credit limit"); + return 0; + } + // 2. 获取积分 + return addCreditNumber; + } + + } diff --git a/mallinkService/src/main/java/com/iformall/service/msg/impl/FmInsideBasicUserPhoneFirstMsgServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/msg/impl/FmInsideBasicUserPhoneFirstMsgServiceImpl.java index 3f6148e40..441c11fc1 100644 --- a/mallinkService/src/main/java/com/iformall/service/msg/impl/FmInsideBasicUserPhoneFirstMsgServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/msg/impl/FmInsideBasicUserPhoneFirstMsgServiceImpl.java @@ -4,6 +4,7 @@ import com.iformall.domain.po.WxCUserBasicInfo; import com.iformall.domain.po.base.TenantEntity; import com.iformall.domain.po.msg.BaseMsg; import com.iformall.domain.po.msg.FmInsideBasicUserMsg; +import com.iformall.enums.EnumAppPlat; import com.iformall.enums.EnumAssignTagsTrigger; import com.iformall.enums.EnumScoreType; import com.iformall.service.*; @@ -38,6 +39,9 @@ public class FmInsideBasicUserPhoneFirstMsgServiceImpl implements MsgSendService @Autowired private WxCUserTagsService wxCUserTagsService; + @Autowired + private WxCUserFromService wxCUserFromService; + @Override public void send(BaseMsg baseMsg) throws Exception{ FmInsideBasicUserMsg msg = (FmInsideBasicUserMsg)baseMsg; @@ -57,12 +61,15 @@ public class FmInsideBasicUserPhoneFirstMsgServiceImpl implements MsgSendService // 成长值 wxScoreRulesService.addScore(tenantEntity, EnumScoreType.WECHAT_PHONE, basicInfo); // 增加积分 - wxCUserBasicInfoService.addCredit(basicInfo.getId(),tenantEntity,EnumScoreType.WECHAT_PHONE); + wxCUserBasicInfoService.addCredit(basicInfo.getId(),basicInfo.getId(),tenantEntity,EnumScoreType.WECHAT_PHONE); + //老带新增加积分 todo 先处理微信的业务 + wxCUserFromService.oldAddCredit(tenantEntity,basicInfo.getId(),EnumAppPlat.WX); // 外部注券 memCouponFromDspService.couponOrderFromDsp(tenantEntity, basicInfo.getPhone()); //推送猫酷 mallCooUserInfoService.pullByMobileMsg(tenantEntity, basicInfo.getId()); + } //打标签 diff --git a/mallinkService/src/main/resources/mapper/TtCUserMapper.xml b/mallinkService/src/main/resources/mapper/TtCUserMapper.xml index 76630969b..42e250310 100644 --- a/mallinkService/src/main/resources/mapper/TtCUserMapper.xml +++ b/mallinkService/src/main/resources/mapper/TtCUserMapper.xml @@ -419,4 +419,8 @@ + + diff --git a/mallinkService/src/main/resources/mapper/WxCUserFromMapper.xml b/mallinkService/src/main/resources/mapper/WxCUserFromMapper.xml index 7ac51de6d..90cf89108 100644 --- a/mallinkService/src/main/resources/mapper/WxCUserFromMapper.xml +++ b/mallinkService/src/main/resources/mapper/WxCUserFromMapper.xml @@ -111,25 +111,6 @@ limit #{begin}, #{limit} - - - - - - - - - - - - - - - - - - - + + +