diff --git a/mallinkAdmin/src/main/resources/db/migration/V202009041200__commercialPreferential.sql b/mallinkAdmin/src/main/resources/db/migration/V202009041200__commercialPreferential.sql index 3d37497e9..cfa5ab317 100644 --- a/mallinkAdmin/src/main/resources/db/migration/V202009041200__commercialPreferential.sql +++ b/mallinkAdmin/src/main/resources/db/migration/V202009041200__commercialPreferential.sql @@ -1,17 +1,23 @@ -INSERT INTO `mallink`.`mall_permission`(`id`, `name`, `parent_id`, `available`, `permission`, `resource_type`, `module_color`, `module_color_num`, `url`, `icon`, `version_type`, `sort`) VALUES (646, '商户建券  ', 602, 'Y', NULL, 1, NULL, NULL, 'commercialPreferential', NULL, 0, 646); +--加商户发卷菜单 +INSERT INTO `mall_permission`(`id`, `name`, `parent_id`, `available`, `permission`, `resource_type`, `module_color`, `module_color_num`, `url`, `icon`, `version_type`, `sort`) VALUES (646, '商户建券  ', 602, 'Y', NULL, 1, NULL, NULL, 'commercialPreferential', NULL, 0, 646); +--销售类型加权限 update 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, 201, 202, 203, 204, 205, 206, 211, 212, 221, 222, 251, 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, 501, 502, 503, 504, 505, 506, 507, 508, 509, 511, 512, 513, 521, 522, 523, 531, 532, 533, 591, 592, 595, 601, 602, 603, 604, 605, 606, 607, 608, 609, 610, 611, 612, 621, 622, 623, 624, 625, 626, 627, 641, 642, 643, 644, 645, 646, 651, 661, 662, 663, 671, 672, 673, 674, 675, 681, 682, 683, 684, 685, 686, 691, 692, 693, 694, 695, 701, 702, 703, 711, 712, 713, 901, 902, 903, 931, 932, 951, 952, 961, 962, 963, 965, 966, 967, 968, 1001, 1002, 1003, 1004]' where id=1; update 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, 211, 212, 221, 222, 251, 409, 410, 411, 416, 501, 502, 503, 504, 505, 506, 507, 508, 509, 511, 512, 513, 521, 522, 523, 531, 532, 533, 591, 592, 595, 601, 602, 603, 604, 605, 606, 607, 608, 609, 610, 611, 612, 621, 622, 623, 624, 625, 626, 627, 641, 642, 643, 644, 645, 646, 651, 661, 662, 663, 671, 672, 673, 674, 675, 681, 682, 683, 684, 685, 686, 691, 692, 693, 694, 695, 701, 702, 703, 711, 712, 713, 901, 902, 903, 931, 932, 951, 961]' where id=2; update mall_sale_type set menus = '[2, 4, 5, 6, 7, 10, 50, 201, 202, 205, 211, 212, 221, 222, 251, 409, 410, 411, 416, 501, 502, 503, 504, 505, 506, 507, 508, 511, 512, 513, 521, 522, 523, 531, 532, 533, 591, 592, 601, 602, 603, 604, 605, 606, 607, 608, 609, 610, 611, 612, 621, 622, 623, 624, 625, 626, 641, 642, 643, 644, 645, 646, 651, 661, 662, 663, 671, 672, 673, 674, 675, 681, 682, 683, 684, 685, 686, 691, 692, 693, 694, 695, 701, 702, 703, 711, 712, 713, 901, 902, 903, 931, 932]' where id=3; +--所有广场管理员角色加权限 +INSERT INTO `mall_role_permission`(`id`, `tenant_id`, `parent_tenant_id`, `permission_id`, `role_id`) + select CEILING(RAND()*90000000000+10000000000) ,mui.tenant_id,mui.parent_tenant_id,646,mur.role_id +from mall_user_info mui +left join mall_user_role mur on mui.id = mur.uid +where mui.is_admin = 1 and mur.role_id is not null GROUP BY mur.role_id +ALTER TABLE `wx_coupon` +ADD COLUMN `source_type` tinyint(1) NOT NULL DEFAULT 1 COMMENT '1:A端发卷,2:B端发卷' AFTER `password_support`; - - +--用户 ALTER TABLE `wx_c_user_basic_info` MODIFY COLUMN `tenant_id` varchar(250) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '租户ID' AFTER `id`; - - -ALTER TABLE `mallink`.`wx_coupon` -ADD COLUMN `source_type` tinyint(1) NOT NULL DEFAULT 1 COMMENT '1:A端发卷,2:B端发卷' AFTER `password_support`; \ No newline at end of file +update wx_c_user_basic_info set tenant_id = concat(",",final_tenant_id,","); \ No newline at end of file diff --git a/mallinkCApi/src/main/java/com/iformall/controller/BaseController.java b/mallinkCApi/src/main/java/com/iformall/controller/BaseController.java index a63381adc..4bb9c1ab4 100644 --- a/mallinkCApi/src/main/java/com/iformall/controller/BaseController.java +++ b/mallinkCApi/src/main/java/com/iformall/controller/BaseController.java @@ -238,6 +238,10 @@ public class BaseController { if(byId != null && !byId.getPhone().equals(basicInfo.getPhone())){ return Long.valueOf(-1); } + if(!basicInfo.getTenantId().contains(","+tenantEntity.getTenantId()+",")){ + basicInfo.setTenantId(basicInfo.getTenantId()+tenantEntity.getTenantId()+","); + wxCUserBasicInfoService.update(basicInfo); + } // WxCUserBasicInfo basicInfo = list.get(0); // 微信名称,统一成微信昵称 // if (!Objects.equals(basicInfo.getNickName(), user.getNickName())) { @@ -270,6 +274,7 @@ public class BaseController { basicInfo = new WxCUserBasicInfo(); final IdWorker idWorker = IdWorker.get(); basicInfo.setId(idWorker.nextId()); + basicInfo.setTenantId(","+tenantEntity.getTenantId()+","); basicInfo.undateFinalTenantId(tenantEntity); basicInfo.setPhone(userPhone); basicInfo.setNickName(userName); diff --git a/mallinkService/src/main/java/com/iformall/domain/po/WxCUserBasicInfo.java b/mallinkService/src/main/java/com/iformall/domain/po/WxCUserBasicInfo.java index 32f160f35..6651b6e1e 100644 --- a/mallinkService/src/main/java/com/iformall/domain/po/WxCUserBasicInfo.java +++ b/mallinkService/src/main/java/com/iformall/domain/po/WxCUserBasicInfo.java @@ -22,7 +22,7 @@ import java.util.Objects; @Data @ToString(callSuper = true) @EqualsAndHashCode(callSuper = true) -public class WxCUserBasicInfo extends BaseEntity { +public class WxCUserBasicInfo extends TenantEntity { protected Long id; diff --git a/mallinkService/src/main/java/com/iformall/mapper/WxCUserBasicInfoMapper.java b/mallinkService/src/main/java/com/iformall/mapper/WxCUserBasicInfoMapper.java index 4c246d274..a9949651c 100644 --- a/mallinkService/src/main/java/com/iformall/mapper/WxCUserBasicInfoMapper.java +++ b/mallinkService/src/main/java/com/iformall/mapper/WxCUserBasicInfoMapper.java @@ -71,7 +71,7 @@ public interface WxCUserBasicInfoMapper extends CommonMapper selectNotCUserList(); +// List selectNotCUserList(); void cuserOldToNew(@Param(value = "oldCuserId")Long oldCuserId, @Param(value = "newCuserId")Long newCuserId); 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 f2abd48f5..073be6bcd 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxCUserBasicInfoServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxCUserBasicInfoServiceImpl.java @@ -946,6 +946,9 @@ public class WxCUserBasicInfoServiceImpl implements WxCUserBasicInfoService,IExc // } if (oldUserBase != null) { + if(!oldUserBase.getTenantId().contains(","+mallUserInfo.getTenantId()+",")){ + oldUserBase.setTenantId(oldUserBase.getTenantId()+mallUserInfo.getTenantId()+","); + } oldUserBase.setName(userBase.getName()); oldUserBase.setSex(userBase.getSex()); oldUserBase.setNickName(userBase.getNickName()); @@ -968,6 +971,7 @@ public class WxCUserBasicInfoServiceImpl implements WxCUserBasicInfoService,IExc } } else { userBase.setId(idWorker.nextId()); + userBase.setTenantId(","+mallUserInfo.getTenantId()+","); userBase.setUpdateDate(userBase.getUpdateDate() == null ? new Date() : userBase.getUpdateDate()); userBase.setCreateDate(userBase.getCreateDate() == null ? new Date() : userBase.getCreateDate()); //新增积分 diff --git a/mallinkService/src/main/resources/mapper/WxCUserBasicInfoMapper.xml b/mallinkService/src/main/resources/mapper/WxCUserBasicInfoMapper.xml index 91782744f..afa22da10 100644 --- a/mallinkService/src/main/resources/mapper/WxCUserBasicInfoMapper.xml +++ b/mallinkService/src/main/resources/mapper/WxCUserBasicInfoMapper.xml @@ -146,10 +146,7 @@ - and wcu.`tenant_id` = #{tenantInfo.tenantId} - - - and wcu.`parent_tenant_id` = #{tenantInfo.parentTenantId} + and wcubi.`tenant_id` like concat('%,', #{tenantInfo.tenantId},',%') @@ -227,7 +224,6 @@ select from wx_c_user_basic_info wcubi - left join wx_c_user wcu on wcu.user_id = wcubi.id ) r where 1=1 @@ -270,7 +266,6 @@ @@ -316,7 +308,6 @@ @@ -375,7 +362,6 @@ @@ -434,7 +417,6 @@ @@ -459,7 +438,6 @@ select from wx_c_user_basic_info cub - inner join wx_c_user cu on cu.user_id = cub.id where cub.status = 0 AND DATE_FORMAT(cub.birthdate,'%m-%d') >= #{begin} AND DATE_FORMAT(cub.birthdate,'%m-%d') <= #{end} - and cu.`tenant_id` = #{tenantId} - - - and cu.`parent_tenant_id` = #{parentTenantId} + and cub.`tenant_id` like concat('%,', #{tenantInfo.tenantId},',%') order by cub.`active_time` DESC @@ -504,7 +478,6 @@ @@ -910,10 +868,7 @@ where 1=1 - and c.`tenant_id` = #{tenantInfo.tenantId} - - - and c.`parent_tenant_id` = #{tenantInfo.parentTenantId} + and cu.`tenant_id` like concat('%,', #{tenantInfo.tenantId},',%') @@ -989,7 +944,6 @@ select from wx_c_user_basic_info cu - left join wx_c_user c on c.user_id = cu.id join wx_c_user_tags cut on cut.`id` = cu.`tag_id` @@ -1030,10 +983,7 @@ left join wx_c_user cu on cubi.id=cu.user_id where cu.id is null - and cu.`tenant_id` = #{tenantId} - - - and cu.`parent_tenant_id` = #{parentTenantId} + and cubi.`tenant_id` like concat('%,', #{tenantInfo.tenantId},',%') --> @@ -1051,10 +1001,7 @@ left join wx_c_user cu on cubi.id=cu.user_id where cu.id is not null - and cu.`tenant_id` = #{tenantId} - - - and cu.`parent_tenant_id` = #{parentTenantId} + and cubi.`tenant_id` like concat('%,', #{tenantInfo.tenantId},',%') @@ -1062,9 +1009,9 @@ UPDATE wx_c_user_basic_info set act_record = act_record +1 where id = #{id} -