| @@ -13,9 +13,9 @@ DROP COLUMN `credit_locked`; | |||||
| --type=2 积分规则,追加老带新规则 缓存--缓存--缓存 | --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; | 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; | where type = 2; | ||||
| @@ -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; | |||||
| @@ -33,8 +33,8 @@ public enum EnumScoreType { | |||||
| REFUND_REDUCE_CREDIT(23, "积分兑换退款"), | REFUND_REDUCE_CREDIT(23, "积分兑换退款"), | ||||
| POINT_CHANGE(24, "其他积分变动"),// | 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) { | public static EnumScoreType getEnum(Integer code) { | ||||
| @@ -41,4 +41,6 @@ public interface TtCUserMapper extends CommonMapper<TtCUser, Long> { | |||||
| List<String> findTokenList(@Param("id")Long id,@Param("userId")Long userId, @Param("tenantId")String tenantId); | List<String> findTokenList(@Param("id")Long id,@Param("userId")Long userId, @Param("tenantId")String tenantId); | ||||
| List<UserStructureVo> findCountData(WxCUserBasicInfoDto dto); | List<UserStructureVo> findCountData(WxCUserBasicInfoDto dto); | ||||
| Long findCuserId(@Param("userId")Long userId, @Param("tenantId")String tenantId); | |||||
| } | } | ||||
| @@ -11,4 +11,6 @@ public interface WxCUserFromMapper extends CommonMapper<WxCUserFrom, Long>{ | |||||
| List<WxCUserFrom> findList(WxCUserFrom record); | List<WxCUserFrom> findList(WxCUserFrom record); | ||||
| List<WxCUserFromVo> visits(WxCUserFromVo record); | List<WxCUserFromVo> visits(WxCUserFromVo record); | ||||
| Long findfirstFromId(WxCUserFrom cUserFrom); | |||||
| } | } | ||||
| @@ -172,7 +172,7 @@ public interface WxCUserBasicInfoService { | |||||
| WxCUserBasicInfo registerByPhone(TenantEntity tenantEntity, String phone, String nickName,String name, Integer sex, String avatarUrl); | 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); | void registerJinmao(TenantEntity tenantInfo,WxCUserBasicInfo basicInfo); | ||||
| @@ -1,8 +1,11 @@ | |||||
| package com.iformall.service; | package com.iformall.service; | ||||
| import com.github.pagehelper.PageInfo; | import com.github.pagehelper.PageInfo; | ||||
| import com.iformall.domain.po.WxCUserBasicInfo; | |||||
| import com.iformall.domain.po.WxCUserFrom; | import com.iformall.domain.po.WxCUserFrom; | ||||
| import com.iformall.domain.po.base.TenantEntity; | |||||
| import com.iformall.domain.vo.WxCUserFromVo; | import com.iformall.domain.vo.WxCUserFromVo; | ||||
| import com.iformall.enums.EnumAppPlat; | |||||
| import javax.servlet.http.HttpServletRequest; | import javax.servlet.http.HttpServletRequest; | ||||
| import javax.servlet.http.HttpServletResponse; | import javax.servlet.http.HttpServletResponse; | ||||
| @@ -23,8 +26,11 @@ public interface WxCUserFromService { | |||||
| void save(WxCUserFrom wxCUserFrom); | void save(WxCUserFrom wxCUserFrom); | ||||
| void exportData(HttpServletRequest request, HttpServletResponse response, WxCUserFrom record); | void exportData(HttpServletRequest request, HttpServletResponse response, WxCUserFrom record); | ||||
| void exportDataVisits(HttpServletRequest request, HttpServletResponse response, WxCUserFromVo 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); | |||||
| } | } | ||||
| @@ -50,4 +50,6 @@ public interface CUserServiceApapter { | |||||
| String updateQrCode(CUser user); | String updateQrCode(CUser user); | ||||
| List<UserStructureVo> findCountData(WxCUserBasicInfoDto dto); | List<UserStructureVo> findCountData(WxCUserBasicInfoDto dto); | ||||
| Long findCuserId(Long basicUserId,String tenantId); | |||||
| } | } | ||||
| @@ -271,6 +271,11 @@ public class TtBUserServiceAdapter extends BasicCUserService implements CUserSer | |||||
| return null; | return null; | ||||
| } | } | ||||
| @Override | |||||
| public Long findCuserId(Long basicUserId, String tenantId) { | |||||
| return null; | |||||
| } | |||||
| private void updateTokenCache(String token,Object cuser) { | private void updateTokenCache(String token,Object cuser) { | ||||
| BaseCUserEntity baseUser = this.getByObj(cuser); | BaseCUserEntity baseUser = this.getByObj(cuser); | ||||
| setCache(token,baseUser); | setCache(token,baseUser); | ||||
| @@ -362,6 +362,11 @@ public class TtCUserServiceAdapter extends BasicCUserService implements CUserSer | |||||
| return ttCUserMapper.findCountData(dto); | 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) { | private void delForUserIdOnly(Long id, Long userId, String tenantId) { | ||||
| List<String> tokenList = ttCUserMapper.findTokenList(id,userId, tenantId); | List<String> tokenList = ttCUserMapper.findTokenList(id,userId, tenantId); | ||||
| @@ -275,6 +275,11 @@ public class WxBUserServiceAdapter extends BasicCUserService implements CUserSer | |||||
| return null; | return null; | ||||
| } | } | ||||
| @Override | |||||
| public Long findCuserId(Long basicUserId, String tenantId) { | |||||
| return null; | |||||
| } | |||||
| private WxMaService getWxMaService(WxAppinfo wxAppinfo, Boolean isFmOpen) { | private WxMaService getWxMaService(WxAppinfo wxAppinfo, Boolean isFmOpen) { | ||||
| WxMaService wxMaService = null; | WxMaService wxMaService = null; | ||||
| if (isFmOpen) { | if (isFmOpen) { | ||||
| @@ -375,6 +375,11 @@ public class WxCUserServiceAdapter extends BasicCUserService implements CUserSer | |||||
| return wxCUserMapper.findCountData(dto); | return wxCUserMapper.findCountData(dto); | ||||
| } | } | ||||
| @Override | |||||
| public Long findCuserId(Long basicUserId, String tenantId) { | |||||
| return wxCUserMapper.findCuserId(basicUserId,tenantId); | |||||
| } | |||||
| private WxMaService getWxMaService(WxAppinfo wxAppinfo, Boolean isFmOpen) { | private WxMaService getWxMaService(WxAppinfo wxAppinfo, Boolean isFmOpen) { | ||||
| WxMaService wxMaService = null; | WxMaService wxMaService = null; | ||||
| if (isFmOpen) { | if (isFmOpen) { | ||||
| @@ -711,7 +711,7 @@ public class WxCUserBasicInfoServiceImpl implements WxCUserBasicInfoService,IExc | |||||
| } | } | ||||
| @Override | @Override | ||||
| public int addCredit(Long userId, TenantEntity tenantInfo, EnumScoreType enumScoreType) { | |||||
| public int addCredit(Long userId,Long fromUserId,TenantEntity tenantInfo, EnumScoreType scoreType) { | |||||
| if(userId == null){ | if(userId == null){ | ||||
| return 0; | return 0; | ||||
| } | } | ||||
| @@ -720,8 +720,8 @@ public class WxCUserBasicInfoServiceImpl implements WxCUserBasicInfoService,IExc | |||||
| wxCreditHistory.setTenantId(tenantInfo.getFinalTenantId()); | wxCreditHistory.setTenantId(tenantInfo.getFinalTenantId()); | ||||
| wxCreditHistory.setFinalTenantId(tenantInfo.getFinalTenantId()); | wxCreditHistory.setFinalTenantId(tenantInfo.getFinalTenantId()); | ||||
| wxCreditHistory.setCreateDate(new Date()); | 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.setOperatorType(EnumUserType.CUSERBASIC.getCode()); | ||||
| wxCreditHistory.setOperatorId(userId); | wxCreditHistory.setOperatorId(userId); | ||||
| WxCreditHistory record = wxCreditHistoryService.saveOrUpdate(wxCreditHistory,tenantInfo); | WxCreditHistory record = wxCreditHistoryService.saveOrUpdate(wxCreditHistory,tenantInfo); | ||||
| @@ -3,12 +3,16 @@ package com.iformall.service.impl; | |||||
| import cn.afterturn.easypoi.handler.inter.IExcelExportServer; | import cn.afterturn.easypoi.handler.inter.IExcelExportServer; | ||||
| import com.github.pagehelper.PageHelper; | import com.github.pagehelper.PageHelper; | ||||
| import com.github.pagehelper.PageInfo; | import com.github.pagehelper.PageInfo; | ||||
| import com.iformall.common.ErrorCode; | |||||
| import com.iformall.common.IdWorker; | import com.iformall.common.IdWorker; | ||||
| import com.iformall.common.ResultData; | |||||
| import com.iformall.domain.po.*; | import com.iformall.domain.po.*; | ||||
| import com.iformall.domain.po.base.TenantEntity; | |||||
| import com.iformall.domain.vo.WxCUserFromVo; | import com.iformall.domain.vo.WxCUserFromVo; | ||||
| import com.iformall.enums.EnumCUserFrom; | |||||
| import com.iformall.enums.*; | |||||
| import com.iformall.mapper.*; | import com.iformall.mapper.*; | ||||
| import com.iformall.service.*; | import com.iformall.service.*; | ||||
| import com.iformall.service.cuser.CUserServiceFactory; | |||||
| import lombok.extern.slf4j.Slf4j; | import lombok.extern.slf4j.Slf4j; | ||||
| import org.slf4j.Logger; | import org.slf4j.Logger; | ||||
| import org.slf4j.LoggerFactory; | import org.slf4j.LoggerFactory; | ||||
| @@ -28,6 +32,12 @@ public class WxCUserFromServiceImpl implements WxCUserFromService, IExcelExportS | |||||
| @Autowired | @Autowired | ||||
| WxCUserFromMapper wxCUserFromMapper; | WxCUserFromMapper wxCUserFromMapper; | ||||
| @Autowired | |||||
| CUserServiceFactory cuserFactory; | |||||
| @Autowired | |||||
| private WxCUserBasicInfoService wxCUserBasicInfoService; | |||||
| @Autowired | @Autowired | ||||
| WxCUserBasicInfoMapper wxCUserBasicInfoMapper; | WxCUserBasicInfoMapper wxCUserBasicInfoMapper; | ||||
| @@ -95,6 +105,46 @@ public class WxCUserFromServiceImpl implements WxCUserFromService, IExcelExportS | |||||
| // excelService.exportExcel(visits, null, "门店/用户分享报表", WxCUserFromVo.class, "门店/用户分享报表.xlsx", response, false); | // 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 | @Override | ||||
| public List<Object> selectListForExcelExport(Object queryParams, int page) { | public List<Object> selectListForExcelExport(Object queryParams, int page) { | ||||
| if(queryParams instanceof WxCUserFromVo){ | if(queryParams instanceof WxCUserFromVo){ | ||||
| @@ -636,7 +636,6 @@ public class WxCreditHistoryServiceImpl implements WxCreditHistoryService { | |||||
| wxMemberCardService.sendsyncMemberCardBonusMsg(tenantEntity,null,wxCUserBasicInfo.getId(),record.getId()); | wxMemberCardService.sendsyncMemberCardBonusMsg(tenantEntity,null,wxCUserBasicInfo.getId(),record.getId()); | ||||
| } else { | } else { | ||||
| //wxCreditHistoryMapper.updateById(record); | //wxCreditHistoryMapper.updateById(record); | ||||
| } | } | ||||
| @@ -829,6 +828,12 @@ public class WxCreditHistoryServiceImpl implements WxCreditHistoryService { | |||||
| record.setRulesTenantId(tenantEntity.getTenantId()); | record.setRulesTenantId(tenantEntity.getTenantId()); | ||||
| return record.getCreditNum(); | 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; | return 0; | ||||
| } | } | ||||
| @@ -985,4 +990,37 @@ public class WxCreditHistoryServiceImpl implements WxCreditHistoryService { | |||||
| return addCreditNumber; | 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; | |||||
| } | |||||
| } | } | ||||
| @@ -4,6 +4,7 @@ import com.iformall.domain.po.WxCUserBasicInfo; | |||||
| import com.iformall.domain.po.base.TenantEntity; | import com.iformall.domain.po.base.TenantEntity; | ||||
| import com.iformall.domain.po.msg.BaseMsg; | import com.iformall.domain.po.msg.BaseMsg; | ||||
| import com.iformall.domain.po.msg.FmInsideBasicUserMsg; | import com.iformall.domain.po.msg.FmInsideBasicUserMsg; | ||||
| import com.iformall.enums.EnumAppPlat; | |||||
| import com.iformall.enums.EnumAssignTagsTrigger; | import com.iformall.enums.EnumAssignTagsTrigger; | ||||
| import com.iformall.enums.EnumScoreType; | import com.iformall.enums.EnumScoreType; | ||||
| import com.iformall.service.*; | import com.iformall.service.*; | ||||
| @@ -38,6 +39,9 @@ public class FmInsideBasicUserPhoneFirstMsgServiceImpl implements MsgSendService | |||||
| @Autowired | @Autowired | ||||
| private WxCUserTagsService wxCUserTagsService; | private WxCUserTagsService wxCUserTagsService; | ||||
| @Autowired | |||||
| private WxCUserFromService wxCUserFromService; | |||||
| @Override | @Override | ||||
| public void send(BaseMsg baseMsg) throws Exception{ | public void send(BaseMsg baseMsg) throws Exception{ | ||||
| FmInsideBasicUserMsg msg = (FmInsideBasicUserMsg)baseMsg; | FmInsideBasicUserMsg msg = (FmInsideBasicUserMsg)baseMsg; | ||||
| @@ -57,12 +61,15 @@ public class FmInsideBasicUserPhoneFirstMsgServiceImpl implements MsgSendService | |||||
| // 成长值 | // 成长值 | ||||
| wxScoreRulesService.addScore(tenantEntity, EnumScoreType.WECHAT_PHONE, basicInfo); | 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()); | memCouponFromDspService.couponOrderFromDsp(tenantEntity, basicInfo.getPhone()); | ||||
| //推送猫酷 | //推送猫酷 | ||||
| mallCooUserInfoService.pullByMobileMsg(tenantEntity, basicInfo.getId()); | mallCooUserInfoService.pullByMobileMsg(tenantEntity, basicInfo.getId()); | ||||
| } | } | ||||
| //打标签 | //打标签 | ||||
| @@ -419,4 +419,8 @@ | |||||
| <select id="findOpenIdList" parameterType="hashmap" resultType="String" > | <select id="findOpenIdList" parameterType="hashmap" resultType="String" > | ||||
| select open_id from tt_c_user where user_id=#{userId} and tenant_id = #{tenantId} | select open_id from tt_c_user where user_id=#{userId} and tenant_id = #{tenantId} | ||||
| </select> | </select> | ||||
| <select id="findCuserId" parameterType="hashmap" resultType="Long" > | |||||
| select id from tt_c_user where user_id=#{userId} and tenant_id = #{tenantId} | |||||
| </select> | |||||
| </mapper> | </mapper> | ||||
| @@ -111,25 +111,6 @@ | |||||
| <if test=" null != begin "> | <if test=" null != begin "> | ||||
| limit #{begin}, #{limit} | limit #{begin}, #{limit} | ||||
| </if> | </if> | ||||
| <!-- select <include refid="allColumns" />--> | |||||
| <!-- ,(select nick_name from wx_c_user where id = wcuf.c_user_id ) user_nick_name--> | |||||
| <!-- ,(select description from wx_user_channel where scene_address = wcuf.scene_address ) scene_address_desc--> | |||||
| <!-- ,case when wcuf.from_type = 1 then (select nick_name from wx_c_user where id = wcuf.from_id)--> | |||||
| <!-- when wcuf.from_type = 2 then (select nick_name from wx_c_user_basic_info where id = wcuf.from_id)--> | |||||
| <!-- when wcuf.from_type = 3 then (select name from wx_merchant_b_user where id = wcuf.from_id)--> | |||||
| <!-- when wcuf.from_type = 4 then (select name from mall_user_info where id = wcuf.from_id)--> | |||||
| <!-- when wcuf.from_type = 5 then (select name from wx_merchant where id = wcuf.from_id)--> | |||||
| <!-- when wcuf.from_type = 6 then (select title from wx_coupon_channel where id = wcuf.from_id)--> | |||||
| <!-- when wcuf.from_type = 7 then (select title from wx_activity where id = wcuf.from_id)--> | |||||
| <!-- else '' end from_name--> | |||||
| <!-- ,case when wcuf.share_user_type = 1 then (select nick_name from wx_c_user where id = wcuf.share_user)--> | |||||
| <!-- when wcuf.share_user_type = 2 then (select nick_name from wx_c_user_basic_info where id = wcuf.share_user)--> | |||||
| <!-- when wcuf.share_user_type = 3 then (select name from wx_merchant_b_user where id = wcuf.share_user)--> | |||||
| <!-- when wcuf.share_user_type = 4 then (select name from mall_user_info where id = wcuf.share_user)--> | |||||
| <!-- else '' end share_user_name--> | |||||
| <!-- from wx_c_user_from wcuf--> | |||||
| <!-- <include refid="dynamicWhereConditions" />--> | |||||
| </select> | </select> | ||||
| <select id="visits" parameterType="com.iformall.domain.vo.WxCUserFromVo" resultType="com.iformall.domain.vo.WxCUserFromVo"> | <select id="visits" parameterType="com.iformall.domain.vo.WxCUserFromVo" resultType="com.iformall.domain.vo.WxCUserFromVo"> | ||||
| @@ -202,4 +183,16 @@ | |||||
| </if> | </if> | ||||
| </select> | </select> | ||||
| <select id="findfirstFromId" parameterType="com.iformall.domain.po.WxCUserFrom" resultType="Long"> | |||||
| select wcuf.`from_id` | |||||
| from wx_c_user_from wcuf | |||||
| <include refid="dynamicWhereConditions" /> | |||||
| <if test=" null != isNewUser and isNewUser == 1"> | |||||
| and wcuf.`is_new_user` = 1 | |||||
| </if> | |||||
| order by wcuf.`create_date` | |||||
| limit 1 | |||||
| </select> | |||||
| </mapper> | </mapper> | ||||