Merge remote-tracking branch 'origin/cc_20230520_partner' into cc_20230520_partner
This commit is contained in:
@@ -70,7 +70,6 @@
|
|||||||
<orderEntry type="library" name="Maven: com.github.pagehelper:pagehelper-spring-boot-autoconfigure:1.4.6" level="project" />
|
<orderEntry type="library" name="Maven: com.github.pagehelper:pagehelper-spring-boot-autoconfigure:1.4.6" level="project" />
|
||||||
<orderEntry type="library" name="Maven: com.github.pagehelper:pagehelper:5.3.2" level="project" />
|
<orderEntry type="library" name="Maven: com.github.pagehelper:pagehelper:5.3.2" level="project" />
|
||||||
<orderEntry type="library" name="Maven: com.github.jsqlparser:jsqlparser:4.5" level="project" />
|
<orderEntry type="library" name="Maven: com.github.jsqlparser:jsqlparser:4.5" level="project" />
|
||||||
<orderEntry type="library" name="Maven: com.coolstore:coolstore-base:1.5.3" level="project" />
|
|
||||||
<orderEntry type="library" name="Maven: com.google.guava:guava:20.0" level="project" />
|
<orderEntry type="library" name="Maven: com.google.guava:guava:20.0" level="project" />
|
||||||
</component>
|
</component>
|
||||||
</module>
|
</module>
|
||||||
@@ -66,10 +66,6 @@
|
|||||||
<groupId>com.github.pagehelper</groupId>
|
<groupId>com.github.pagehelper</groupId>
|
||||||
<artifactId>pagehelper-spring-boot-starter</artifactId>
|
<artifactId>pagehelper-spring-boot-starter</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
|
||||||
<groupId>com.coolstore</groupId>
|
|
||||||
<artifactId>coolstore-base</artifactId>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.google.guava</groupId>
|
<groupId>com.google.guava</groupId>
|
||||||
<artifactId>guava</artifactId>
|
<artifactId>guava</artifactId>
|
||||||
|
|||||||
@@ -0,0 +1,218 @@
|
|||||||
|
package com.cool.store.constants;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* redis key 类
|
||||||
|
* @author byd
|
||||||
|
* @date 2021-03-11 14:55
|
||||||
|
*/
|
||||||
|
public class RedisConstant {
|
||||||
|
|
||||||
|
public static final String TB_DISPLAY_HANDLE = "tb_display_handle_";
|
||||||
|
/**
|
||||||
|
* 新陈列审核
|
||||||
|
*/
|
||||||
|
public static final String TB_DISPLAY_APPROVE = "tb_display_approve_";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新陈列复核
|
||||||
|
*/
|
||||||
|
public static final String TB_DISPLAY_RECHECK = "tb_display_recheck";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新陈列三级审批
|
||||||
|
*/
|
||||||
|
public static final String TB_DISPLAY_THIRD_APPROVE = "tb_display_third_approve";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新陈列四级审批
|
||||||
|
*/
|
||||||
|
public static final String TB_DISPLAY_FOUR_APPROVE = "tb_display_four_approve";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新陈列五级审批
|
||||||
|
*/
|
||||||
|
public static final String TB_DISPLAY_FIVE_APPROVE = "tb_display_five_approve";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 区域/组织同步锁key 点击同步锁key
|
||||||
|
*/
|
||||||
|
public static final String REGION_SYNC_LOCK = "region_sync_lock_";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 问题工单key
|
||||||
|
*/
|
||||||
|
public static final String QUESTION_TASK_LOCK = "question_task_lock_";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 店务工单key
|
||||||
|
*/
|
||||||
|
public static final String STORE_WORK_QUESTION_TASK_LOCK = "store_work_question_task_lock_";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 企业同步key 有效拦截
|
||||||
|
*/
|
||||||
|
public static final String EID_SYNC_EFFECTIVE = "eid_sync_effective_";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 通知key做为拦截
|
||||||
|
*/
|
||||||
|
public static final String TASK_STAGE_NOTICE = "task_stage_notice_";
|
||||||
|
|
||||||
|
public static final String TASK_DEL_FLAG = "task_del_flag_";
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 系统内区域key
|
||||||
|
*/
|
||||||
|
public static final String REGION_SYNC_ALL= "region_sync_all_";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 系统内区域key
|
||||||
|
*/
|
||||||
|
public static final String STORE_SYNC_ALL= "store_sync_all_";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 企业广告配置信息key前缀
|
||||||
|
*/
|
||||||
|
public static final String ADVERT_SETTING_PREFIX= "advert_setting_";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 企业广告配置信息value
|
||||||
|
*/
|
||||||
|
public static final String ADVERT_SETTING_VALUE= "1";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 企业广告配置信息value
|
||||||
|
*/
|
||||||
|
public static final String COOL_TOKEN_PREFIX= "cool_token_";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户企业token前缀
|
||||||
|
*/
|
||||||
|
public static final String ACCESS_TOKEN_PREFIX ="access_token:";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* refresh token
|
||||||
|
*/
|
||||||
|
public static final String REFRESH_TOKEN_PREFIX ="refresh_token:";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户账号密码错误次数key
|
||||||
|
*/
|
||||||
|
public static final String ERROR_PASSWORD_COUNT_KEY = "errorPasswordCount_{0}_{1}";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 未完成转码
|
||||||
|
*/
|
||||||
|
public static final String VIDEO_NOT_COMPLETE_CACHE = "video_not_complete_cache";
|
||||||
|
/**
|
||||||
|
* 任务抓拍状态记录
|
||||||
|
*/
|
||||||
|
public static final String CAPTURE_PICTURE_STATUS_PREFIX ="capture_picture_status:";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 视频转码回调
|
||||||
|
*/
|
||||||
|
public static final String VIDEO_CALLBACK_CACHE = "video_callback_cache_";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 任务重新分配 防止重复提交
|
||||||
|
*/
|
||||||
|
public static final String TASK_STORE_REALLOCATE = "task_store_reallocate_";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否返回区域对应门店权限redis控制key
|
||||||
|
*/
|
||||||
|
public static final String SHOW_STORE_AUTH = "show_store_auth";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否返回区域对应门店权限redis控制key
|
||||||
|
*/
|
||||||
|
public static final String FIRST_LOGIN = "first_login_";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 区域全路径名称缓存
|
||||||
|
*/
|
||||||
|
public static final String REGION_ALL_NAME_CACHE = "region_all_name_cache_";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取菜单引导key
|
||||||
|
*/
|
||||||
|
public static final String GUIDE_INFO = "guide_info_";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 组织架构模块是否第一次登录
|
||||||
|
*/
|
||||||
|
public static final String OrgModuleFirstLogin = "OrgModuleFirstLogin:{0}:{1}";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 历史企业key
|
||||||
|
*/
|
||||||
|
public static final String HISTORY_ENTERPRISE = "historyEnterprise";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 留资企业key
|
||||||
|
*/
|
||||||
|
public static final String LEAVE_ENTERPRISE = "leaveEnterprise";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 留资开关
|
||||||
|
*/
|
||||||
|
public static final String LEAVE_OPEN = "leaveOpen";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 工单分享key
|
||||||
|
*/
|
||||||
|
public static final String QUESTION_SHARE_KEY = "question_share:{0}";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 企业配置信息
|
||||||
|
*/
|
||||||
|
public static final String ENTERPRISE_CONFIG_KEY = "enterpriseConfig:{0}";
|
||||||
|
|
||||||
|
public static final String ENTERPRISE_KEY = "enterpriseInfo:{0}";
|
||||||
|
|
||||||
|
|
||||||
|
public static final String ENTERPRISE_DB_SERVER = "enterpriseDBServer:{0}";
|
||||||
|
|
||||||
|
public static final String QUESTION_SETTING_CACHE_KEY = "questionSettingCacheKey:{0}";
|
||||||
|
|
||||||
|
public static final String ENTERPRISE_SETTING_CACHE_KEY = "enterpriseSettingCacheKey:{0}";
|
||||||
|
|
||||||
|
public static final String ENTERPRISE_STORE_SETTING_CACHE_KEY = "enterpriseStoreSettingCacheKey:{0}";
|
||||||
|
|
||||||
|
public static final String QUESTION_CACHE_KEY = "questionDataCache:{0}:{1}:{2}_{3}";
|
||||||
|
|
||||||
|
|
||||||
|
public static final String QUESTION_NOTICE_KEY = "questionNoticeCache:{0}:{1}:{2}:{3}_{4}_{5}_{6}";
|
||||||
|
|
||||||
|
public static final String STOREWORK_NOTICE_KEY = "storeWorkNoticeCache:{0}:{1}:{2}:{3}";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 七天
|
||||||
|
*/
|
||||||
|
public static final int SEVEN_DAY = 7 * 24 * 60 * 60;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 1天
|
||||||
|
*/
|
||||||
|
public static final int ONE_DAY_SECONDS = 24 * 60 * 60;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 3天
|
||||||
|
*/
|
||||||
|
public static final int THREE_DAY = 3 * 24 * 60 * 60 * 1000;
|
||||||
|
|
||||||
|
public static final String UPCOMING_BACKLOG_ID = "upcoming_backlog:{0}:{1}:{2}";
|
||||||
|
|
||||||
|
|
||||||
|
public static final String ENTERPRISE_OPEN_STATUS_KEY = "enterprise_open_status:{0}_{1}";
|
||||||
|
|
||||||
|
public static final String STOREWORK_BUILD_CACHE_KEY = "storeworkBuildDataCache:{0}:{1}:{2}";
|
||||||
|
|
||||||
|
public static final String STORE_WORK_COMMENT_CACHE_KEY = "storeWorkCommentCache:{0}:{1}:{2}";
|
||||||
|
|
||||||
|
public static final String DEVICE_OPEN_TOKEN = "device_open_token:{0}:{1}:{2}";
|
||||||
|
|
||||||
|
}
|
||||||
@@ -1,18 +1,65 @@
|
|||||||
package com.cool.store.enums;
|
package com.cool.store.enums;
|
||||||
|
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.function.Function;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author zhangchenbiao
|
* 应用类型
|
||||||
* @FileName: AppTypeEnum
|
|
||||||
* @Description:
|
|
||||||
* @date 2023-05-23 9:41
|
|
||||||
*/
|
*/
|
||||||
public enum AppTypeEnum {
|
public enum AppTypeEnum {
|
||||||
|
// 数智门店-钉钉
|
||||||
|
DING_DING("dingding","数智门店-钉钉"),
|
||||||
|
|
||||||
FEI_SHU("fei_shu", "飞书");
|
//酷店掌-钉钉
|
||||||
|
DING_DING2("dingding2","酷店掌-钉钉"),
|
||||||
|
|
||||||
|
// 企业微信-数智门店
|
||||||
|
WX_APP("qw","数智门店-企业微信"),
|
||||||
|
|
||||||
|
// 企业微信-酷店掌
|
||||||
|
WX_APP2("qw2","酷店掌-企业微信"),
|
||||||
|
|
||||||
|
//用户自己添加 独立app
|
||||||
|
APP("app","数智门店-客户端"),
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 酷店掌-自建企业微信
|
||||||
|
*/
|
||||||
|
WX_SELF_APP("qw_self", "酷店掌-自建企业微信"),
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 酷店掌-自建企业微信代开发
|
||||||
|
*/
|
||||||
|
WX_SELF_DKF("qw_self_dkf", "酷店掌--自建企业微信代开发"),
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 酷店掌-企业微信私服
|
||||||
|
*/
|
||||||
|
WX_PRIVATE_APP("qw_private", "酷店掌-企业微信私服"),
|
||||||
|
|
||||||
|
WX_PRIVATE_ZHOU("qw_private_zdf","酷店掌-企业微信私服-周大福"),
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 门店通应用
|
||||||
|
*/
|
||||||
|
ONE_PARTY_APP("one_party", "门店通-钉钉"),
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 飞书
|
||||||
|
*/
|
||||||
|
FEI_SHU("fei_shu", "飞书")
|
||||||
|
|
||||||
|
;
|
||||||
private String value;
|
private String value;
|
||||||
|
|
||||||
private String message;
|
private String message;
|
||||||
|
|
||||||
|
private static final Map<String, AppTypeEnum> map = Arrays.stream(values()).collect(Collectors.toMap(AppTypeEnum::getValue, Function.identity()));
|
||||||
|
|
||||||
AppTypeEnum(String value, String message) {
|
AppTypeEnum(String value, String message) {
|
||||||
this.value = value;
|
this.value = value;
|
||||||
this.message = message;
|
this.message = message;
|
||||||
@@ -25,4 +72,142 @@ public enum AppTypeEnum {
|
|||||||
public String getMessage() {
|
public String getMessage() {
|
||||||
return message;
|
return message;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static String getMessage(String value){
|
||||||
|
if(StringUtils.isBlank(value)){
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
for (AppTypeEnum appTypeEnum : AppTypeEnum.values()) {
|
||||||
|
if(appTypeEnum.value.equals(value)){
|
||||||
|
return appTypeEnum.message;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
public static AppTypeEnum getAppType(String appType){
|
||||||
|
for (AppTypeEnum appTypeEnum : AppTypeEnum.values()) {
|
||||||
|
if(appTypeEnum.value.equals(appType)){
|
||||||
|
return appTypeEnum;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(appType.startsWith(WX_SELF_APP.getValue())) {
|
||||||
|
return WX_SELF_APP;
|
||||||
|
}
|
||||||
|
if(appType.startsWith(WX_PRIVATE_APP.getValue())) {
|
||||||
|
return WX_PRIVATE_APP;
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 判断是否是钉钉平台
|
||||||
|
* @param value
|
||||||
|
* @author: xugangkun
|
||||||
|
* @return java.lang.Boolean
|
||||||
|
* @date: 2021/10/26 15:03
|
||||||
|
*/
|
||||||
|
public static Boolean isDingType(String value) {
|
||||||
|
if (DING_DING.getValue().equals(value) || DING_DING2.getValue().equals(value) || ONE_PARTY_APP.getValue().equals(value)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 判断是否是企业微信平台
|
||||||
|
* @param value
|
||||||
|
* @author: xugangkun
|
||||||
|
* @return java.lang.Boolean
|
||||||
|
* @date: 2021/10/26 15:03
|
||||||
|
*/
|
||||||
|
public static Boolean isQwType(String value) {
|
||||||
|
if (WX_APP.getValue().equals(value) || WX_APP2.getValue().equals(value)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 判断是否是飞书
|
||||||
|
* @param value
|
||||||
|
* @author: xugangkun
|
||||||
|
* @return java.lang.Boolean
|
||||||
|
* @date: 2021/10/26 15:03
|
||||||
|
*/
|
||||||
|
public static Boolean isFsType(String value) {
|
||||||
|
if (FEI_SHU.getValue().equals(value)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 判断是否是酷店掌
|
||||||
|
* @param value
|
||||||
|
* @author: xugangkun
|
||||||
|
* @return java.lang.Boolean
|
||||||
|
* @date: 2021/10/26 15:03
|
||||||
|
*/
|
||||||
|
public static Boolean isCoolStore(String value) {
|
||||||
|
if (WX_APP2.getValue().equals(value) || DING_DING2.getValue().equals(value)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 判断是否是数智门店
|
||||||
|
* @param value
|
||||||
|
* @author: xugangkun
|
||||||
|
* @return java.lang.Boolean
|
||||||
|
* @date: 2021/10/26 15:03
|
||||||
|
*/
|
||||||
|
public static Boolean isCoolCollege(String value) {
|
||||||
|
if (WX_APP.getValue().equals(value) || DING_DING.getValue().equals(value)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否是企微自建应用或者企微私服
|
||||||
|
* @param appType
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public static boolean isWxSelfAndPrivateType(String appType) {
|
||||||
|
if(StringUtils.isBlank(appType)){
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return appType.startsWith(AppTypeEnum.WX_SELF_APP.getValue())
|
||||||
|
|| appType.startsWith(AppTypeEnum.WX_PRIVATE_APP.getValue());
|
||||||
|
}
|
||||||
|
|
||||||
|
public static boolean qwIsGetUserName(String appType){
|
||||||
|
if(StringUtils.isBlank(appType) || isDingType(appType)){
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return appType.startsWith(AppTypeEnum.WX_SELF_APP.getValue()) || appType.startsWith(AppTypeEnum.WX_PRIVATE_APP.getValue())
|
||||||
|
|| appType.startsWith(AppTypeEnum.WX_SELF_DKF.getValue()) || appType.startsWith(AppTypeEnum.WX_PRIVATE_ZHOU.getValue());
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String getCode(String value){
|
||||||
|
if(StringUtils.isBlank(value)){
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
for (AppTypeEnum appTypeEnum : AppTypeEnum.values()) {
|
||||||
|
if(appTypeEnum.message.equals(value)){
|
||||||
|
return appTypeEnum.value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
public static AppTypeEnum parseValue(String value) {
|
||||||
|
return map.get(value);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,58 @@
|
|||||||
|
package com.cool.store.enums;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.function.Function;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* describe:
|
||||||
|
*
|
||||||
|
* @author zhouyiping
|
||||||
|
* @date 2020/10/13
|
||||||
|
*/
|
||||||
|
public enum AuthRoleEnum {
|
||||||
|
/**
|
||||||
|
* 全企业数据
|
||||||
|
*/
|
||||||
|
ALL("all", "全企业数据"),
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 所在组织架构包含下级
|
||||||
|
*/
|
||||||
|
INCLUDE_SUBORDINATE("include_subordinate","所在组织架构包含下级"),
|
||||||
|
|
||||||
|
|
||||||
|
// /**
|
||||||
|
// * 所在的组织架构不包含下级
|
||||||
|
// */
|
||||||
|
NOT_INCLUDE_SUBORDINATE("not_include_subordinate","所在的组织架构不包含下级"),
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 仅自己的数据
|
||||||
|
*/
|
||||||
|
PERSONAL("personal","仅自己的数据");
|
||||||
|
|
||||||
|
private String code;
|
||||||
|
private String msg;
|
||||||
|
|
||||||
|
protected static final Map<String, AuthRoleEnum> map = Arrays.stream(values()).collect(
|
||||||
|
Collectors.toMap(AuthRoleEnum::getCode, Function.identity()));
|
||||||
|
|
||||||
|
AuthRoleEnum(String code, String msg){
|
||||||
|
this.code=code;
|
||||||
|
this.msg=msg;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getCode() {
|
||||||
|
return code;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getMsg() {
|
||||||
|
return msg;
|
||||||
|
}
|
||||||
|
public static AuthRoleEnum getByCode(String code) {
|
||||||
|
return map.get(code);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -41,6 +41,8 @@ public enum ErrorCodeEnum {
|
|||||||
SESSION_KEY_ERROR(1021022, "sessionKey过期", null),
|
SESSION_KEY_ERROR(1021022, "sessionKey过期", null),
|
||||||
GET_WECHAT_USER_INFO_FAIL(1021023,"获取小程序用户信息失败", null),
|
GET_WECHAT_USER_INFO_FAIL(1021023,"获取小程序用户信息失败", null),
|
||||||
FEISHU_SERVICE_ERROR(1021024,"飞书服务调用异常", null),
|
FEISHU_SERVICE_ERROR(1021024,"飞书服务调用异常", null),
|
||||||
|
USER_GROUP_NAME_EXIST(1021076, "用户分组名称已存在", null),
|
||||||
|
USER_GROUP_NOT_EXIST(1021077, "用户分组不存在", null),
|
||||||
;
|
;
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,286 @@
|
|||||||
|
package com.cool.store.enums;
|
||||||
|
|
||||||
|
import com.cool.store.utils.CommonContextUtil;
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author zhangchenbiao
|
||||||
|
* @FileName: RocketMqGroupEnum
|
||||||
|
* @Description:
|
||||||
|
* @date 2021-12-22 17:28
|
||||||
|
*/
|
||||||
|
public enum RocketMqGroupEnum {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 写在前面 读在前面
|
||||||
|
* 同一个group 监听的topic 和 tag必须一致 不然会出现消息丢失问题
|
||||||
|
* 即不能以下情况
|
||||||
|
* 实例1:
|
||||||
|
* 服务A中某个Listener的groupId为GroupA 监听topicA 过滤的消息tagA
|
||||||
|
* 服务B中某个Listener的groupId为GroupA 监听topicB 过滤的消息tagA
|
||||||
|
* 实例2:
|
||||||
|
* 服务A中某个Listener的groupId为GroupA 监听topicA 过滤的消息tagA
|
||||||
|
* 服务B中某个Listener的groupId为GroupA 监听topicA 过滤的消息tagB
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* es数据处理
|
||||||
|
*/
|
||||||
|
ES_DATA_DEAL("es_data_deal", "coolcollege-intelligent", new ArrayList<>(Arrays.asList(RocketMqTagEnum.ES_PATROL_DATA_DEAL, RocketMqTagEnum.ES_DISPLAY_DATA_DEAL))),
|
||||||
|
/**
|
||||||
|
* es数据处理
|
||||||
|
*/
|
||||||
|
ES_DATA_SYNC("es_data_sync", "coolcollege-special",new ArrayList<>(Arrays.asList(RocketMqTagEnum.ES_DATA_SYNC))),
|
||||||
|
/**
|
||||||
|
* 导入导出
|
||||||
|
*/
|
||||||
|
EXPORT_IMPORT_MESSAGE("export_import_message","coolcollege-intelligent", new ArrayList<>(Arrays.asList(RocketMqTagEnum.EXPORT_IMPORT_MESSAGE))),
|
||||||
|
/**
|
||||||
|
* 区域门店数量计算队列
|
||||||
|
*/
|
||||||
|
CAL_REGION_STORE_NUM("cal_region_store_num", "coolcollege-intelligent", new ArrayList<>(Arrays.asList(RocketMqTagEnum.CAL_REGION_STORE_NUM,RocketMqTagEnum.REGION_STORE_NUM_UPDATE))),
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 企业开通
|
||||||
|
*/
|
||||||
|
ENTERPRISE_OPEN("enterprise_open", "coolcollege-intelligent-config", new ArrayList<>(Arrays.asList(RocketMqTagEnum.ENTERPRISE_OPEN))),
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 企业开通平台库脚本
|
||||||
|
*/
|
||||||
|
ENTERPRISE_OPEN_CONFIG_RUN_SCRIPT("enterprise_open_config_run_script", "coolcollege-intelligent-config", new ArrayList<>(Arrays.asList(RocketMqTagEnum.ENTERPRISE_OPEN_CONFIG_RUN_SCRIPT))),
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 企业开通企业库脚本
|
||||||
|
*/
|
||||||
|
ENTERPRISE_OPEN_ENTERPRISE_RUN_SCRIPT("enterprise_open_enterprise_run_script", "coolcollege-intelligent", new ArrayList<>(Arrays.asList(RocketMqTagEnum.ENTERPRISE_OPEN_ENTERPRISE_RUN_SCRIPT))),
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 企业开通数据同步
|
||||||
|
*/
|
||||||
|
ENTERPRISE_OPEN_DATA_SYNC("enterprise_open_data_sync", "coolcollege-intelligent", new ArrayList<>(Arrays.asList(RocketMqTagEnum.ENTERPRISE_OPEN_DATA_SYNC))),
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 部门顺序值补全
|
||||||
|
*/
|
||||||
|
ENTERPRISE_INIT_DEPT_ORDER("enterprise_init_handler_dept_order","coolcollege-intelligent", new ArrayList<>(Arrays.asList(RocketMqTagEnum.ENTERPRISE_INIT_DEPT_ORDER))),
|
||||||
|
/**
|
||||||
|
* 父任务处理人
|
||||||
|
*/
|
||||||
|
TASK_PARENT_USER("task_parent_user", "coolcollege-intelligent", new ArrayList<>(Arrays.asList(RocketMqTagEnum.TASK_PARENT_USER_SAVE))),
|
||||||
|
/**
|
||||||
|
* 企业购买事件
|
||||||
|
*/
|
||||||
|
PAY_MARKET_BUY("pay_market_buy","coolcollege-intelligent", new ArrayList<>(Arrays.asList(RocketMqTagEnum.PAY_MARKET_BUY))),
|
||||||
|
/**
|
||||||
|
* 钉钉消息监听
|
||||||
|
*/
|
||||||
|
DING_MSG_DEAL("ding_msg_deal","coolcollege-intelligent", new ArrayList<>(Arrays.asList(RocketMqTagEnum.DING_STORE_ADDRESS_BOOK, RocketMqTagEnum.DING_SINGLE_USER_SYNC))),
|
||||||
|
/**
|
||||||
|
* 授权队列
|
||||||
|
*/
|
||||||
|
AUTH_QUEUE("auth_queue","coolcollege-intelligent", new ArrayList<>(Arrays.asList(RocketMqTagEnum.AUTH_QUEUE))),
|
||||||
|
/**
|
||||||
|
* 企微消息监听
|
||||||
|
*/
|
||||||
|
QW_MSG_DEAL("qw_msg_deal","coolcollege-intelligent", new ArrayList<>(Arrays.asList(RocketMqTagEnum.QW_CHANGE_ORDER_QUEUE,RocketMqTagEnum.QW_OPEN_ORDER_CHANGE_QUEUE))),
|
||||||
|
/**
|
||||||
|
* 钉钉同步
|
||||||
|
*/
|
||||||
|
DING_SYNC_ALL_DATA_QUEUE("ding_sync_all_data_queue","coolcollege-intelligent", new ArrayList<>(Arrays.asList(RocketMqTagEnum.DING_SYNC_ALL_DATA_QUEUE))),
|
||||||
|
/**
|
||||||
|
* 第三方同步
|
||||||
|
*/
|
||||||
|
DING_SYNC_ALL_DATA_OA_QUEUE("ding_sync_all_data_oa_queue","coolcollege-intelligent-special", new ArrayList<>(Arrays.asList(RocketMqTagEnum.DING_SYNC_ALL_DATA_OA_QUEUE))),
|
||||||
|
/**
|
||||||
|
* 第三方单个用户同步
|
||||||
|
*/
|
||||||
|
THIRD_OA_SYNC_SINGLE_QUEUE("third_oa_sync_single_queue","coolcollege-intelligent-special", new ArrayList<>(Arrays.asList(RocketMqTagEnum.THIRD_OA_SYNC_SINGLE_QUEUE))),
|
||||||
|
/**
|
||||||
|
* 萤石云设备托管
|
||||||
|
*/
|
||||||
|
YINGSHI_DEVICE_MANAGE("yingshi_device_manage","coolcollege-intelligent", new ArrayList<>(Arrays.asList(RocketMqTagEnum.YINGSHI_DEVICE_MANAGE))),
|
||||||
|
/**
|
||||||
|
* 阿里云开通门店事件
|
||||||
|
*/
|
||||||
|
MQ_OPEN_ENTERPRISE_ALIYUN("mq_open_enterprise_aliyun","coolcollege-intelligent", new ArrayList<>(Arrays.asList(RocketMqTagEnum.MQ_OPEN_ENTERPRISE_ALIYUN))),
|
||||||
|
/**
|
||||||
|
* 初始化设备
|
||||||
|
*/
|
||||||
|
INIT_DEVICE_QUEUE("init_device_queue","coolcollege-intelligent", new ArrayList<>(Arrays.asList(RocketMqTagEnum.INIT_DEVICE_QUEUE))),
|
||||||
|
/**
|
||||||
|
* 陈列抄送人处理
|
||||||
|
*/
|
||||||
|
DISPLAY_CC_USER_QUEUE("display_cc_user_queue","coolcollege-intelligent", new ArrayList<>(Arrays.asList(RocketMqTagEnum.DISPLAY_CC_USER_QUEUE))),
|
||||||
|
/**
|
||||||
|
* 门店子任务消息监听
|
||||||
|
*/
|
||||||
|
STORE_SUB_TASK_DATA_QUEUE("store_sub_task_data_queue","coolcollege-intelligent", new ArrayList<>(Arrays.asList(RocketMqTagEnum.STORE_SUB_TASK_DATA_QUEUE))),
|
||||||
|
/**
|
||||||
|
* 定时巡检抓拍
|
||||||
|
*/
|
||||||
|
PATROL_STORE_CAPTURE_PICTURE_QUEUE("patrol_store_capture_picture_queue","coolcollege-intelligent", new ArrayList<>(Arrays.asList(RocketMqTagEnum.PATROL_MANUAL_STORE_CAPTURE_PICTURE_QUEUE,RocketMqTagEnum.PATROL_STORE_CAPTURE_PICTURE_QUEUE))),
|
||||||
|
/**
|
||||||
|
* 巡店分数计算
|
||||||
|
*/
|
||||||
|
PATROL_STORE_SCORE_COUNT_QUEUE("patrol_store_score_count_queue","coolcollege-intelligent", new ArrayList<>(Arrays.asList(RocketMqTagEnum.PATROL_STORE_SCORE_COUNT_QUEUE))),
|
||||||
|
/**
|
||||||
|
* 陈列任务创建
|
||||||
|
*/
|
||||||
|
UNIFY_TASK_DISPLAY("unify_task_display","coolcollege-intelligent", new ArrayList<>(Arrays.asList(RocketMqTagEnum.UNIFY_TASK_DISPLAY))),
|
||||||
|
/**
|
||||||
|
* 巡店任务创建
|
||||||
|
*/
|
||||||
|
UNIFY_TASK_PATROL("unify_task_patrol","coolcollege-intelligent", new ArrayList<>(Arrays.asList(RocketMqTagEnum.UNIFY_TASK_PATROL))),
|
||||||
|
/**
|
||||||
|
* 工单任务创建
|
||||||
|
*/
|
||||||
|
UNIFY_TASK_QUESTION("unify_task_question","coolcollege-intelligent", new ArrayList<>(Arrays.asList(RocketMqTagEnum.UNIFY_TASK_QUESTION))),
|
||||||
|
/**
|
||||||
|
* 信息补全
|
||||||
|
*/
|
||||||
|
INFORMATION_COMPLETION("information_completion","coolcollege-intelligent", new ArrayList<>(Arrays.asList(RocketMqTagEnum.INFORMATION_COMPLETION))),
|
||||||
|
/**
|
||||||
|
* 微应用钉钉消息发送
|
||||||
|
*/
|
||||||
|
STORE_DING_QUEUE("store_ding_queue","coolcollege-intelligent-isv", new ArrayList<>(Arrays.asList(RocketMqTagEnum.STORE_DING_QUEUE))),
|
||||||
|
/**
|
||||||
|
* 待办任务名称
|
||||||
|
*/
|
||||||
|
STORE_BACK_LOG("store_back_log","coolcollege-intelligent-isv", new ArrayList<>(Arrays.asList(RocketMqTagEnum.STORE_BACK_LOG,RocketMqTagEnum.STORE_BACK_LOG_UPDATE))),
|
||||||
|
/**
|
||||||
|
* 待办消息结束队列
|
||||||
|
*/
|
||||||
|
UPCOMING_FINISH("upcoming_finish","coolcollege-intelligent-isv", new ArrayList<>(Arrays.asList(RocketMqTagEnum.UPCOMING_FINISH))),
|
||||||
|
/**
|
||||||
|
* 发送开通成功消息
|
||||||
|
*/
|
||||||
|
OPEN_SUCCEEDED_MSG_QUEUE("open_succeeded_msg_queue","coolcollege-intelligent-isv", new ArrayList<>(Arrays.asList(RocketMqTagEnum.OPEN_SUCCEEDED_MSG_QUEUE))),
|
||||||
|
/**
|
||||||
|
* 发送成员授权模式下模板消息
|
||||||
|
*/
|
||||||
|
QW_MEMBER_TEMPLE_MSG_QUEUE("qw_member_temple_msg_queue","coolcollege-intelligent-isv", new ArrayList<>(Arrays.asList(RocketMqTagEnum.QW_MEMBER_TEMPLE_MSG_QUEUE))),
|
||||||
|
/**
|
||||||
|
* app推送队列
|
||||||
|
*/
|
||||||
|
APP_PUSH_QUEUE("app_push_queue","coolcollege-intelligent-isv", new ArrayList<>(Arrays.asList(RocketMqTagEnum.APP_PUSH_QUEUE))),
|
||||||
|
/**
|
||||||
|
* 证照信息补全任务
|
||||||
|
*/
|
||||||
|
INFORMATION_COMPLETION_LICENSE("information_completion_license","hz-coolstore-license", new ArrayList<>(Arrays.asList(RocketMqTagEnum.INFORMATION_COMPLETION_LICENSE))),
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 解除应用
|
||||||
|
*/
|
||||||
|
REMOVE_APPLICATION("remove_application","coolcollege-intelligent-config", new ArrayList<>(Arrays.asList(RocketMqTagEnum.REMOVE_APPLICATION))),
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取开通酷学院开通完成后的结果
|
||||||
|
*/
|
||||||
|
GET_OPEN_COOL_COLLEGE_RESULT("get_open_cool_college_result","coolcollege-intelligent", new ArrayList<>(Arrays.asList(RocketMqTagEnum.GET_OPEN_COOL_COLLEGE_RESULT))),
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 酷学院同步用户 首次使用人员异步延迟推送
|
||||||
|
*/
|
||||||
|
COLLEGE_SYNC_USER_DELAY("college_sync_user_delay","coolcollege-intelligent", new ArrayList<>(Arrays.asList(RocketMqTagEnum.COLLEGE_SYNC_USER_DELAY))),
|
||||||
|
|
||||||
|
/**
|
||||||
|
*门店端的部门,人员,职位,发生变化后的推送消息队列
|
||||||
|
*/
|
||||||
|
COOL_STORE_DATA_CHANGE("cool_store_data_change","coolcollege-intelligent", new ArrayList<>(Arrays.asList(RocketMqTagEnum.COOL_STORE_DATA_CHANGE))),
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 全量企微用户同步
|
||||||
|
*/
|
||||||
|
QW_SYNC_FULL_USER("qw_sync_full_user_msg_queue", "coolcollege-intelligent", new ArrayList(Arrays.asList(RocketMqTagEnum.QW_SYNC_FULL_USER))),
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 按人子任务消息监听
|
||||||
|
*/
|
||||||
|
PERSON_SUB_TASK_DATA_QUEUE("person_sub_task_data_queue","coolcollege-intelligent", new ArrayList<>(Arrays.asList(RocketMqTagEnum.PERSON_SUB_TASK_DATA_QUEUE))),
|
||||||
|
|
||||||
|
IMOU_DEVICE_CALLBACK("imou_device_callback","coolcollege-intelligent", new ArrayList<>(Arrays.asList(RocketMqTagEnum.IMOU_DEVICE_CALLBACK))),
|
||||||
|
/**
|
||||||
|
* 店务提交、点评消息监听
|
||||||
|
*/
|
||||||
|
STOREWORK_SUBMIT_COMMENT_DATA_QUEUE("storework_submit_comment_data_queue", "coolcollege-intelligent", new ArrayList<>(Arrays.asList(RocketMqTagEnum.STOREWORK_SUBMIT_DATA_QUEUE, RocketMqTagEnum.STOREWORK_COMMENT_DATA_QUEUE, RocketMqTagEnum.STOREWORK_DELETE_DATA_QUEUE))),
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 流程引擎接收主应用消息
|
||||||
|
*/
|
||||||
|
STORE_SEND_TOPIC("store_send_topic","hz-oldworkflow", new ArrayList<>(Arrays.asList(RocketMqTagEnum.STORE_SEND_TOPIC))),
|
||||||
|
/**
|
||||||
|
* 主应用接收流程引擎消息
|
||||||
|
*/
|
||||||
|
WORKFLOW_SEND_TOPIC("workflow_send_topic","coolcollege-intelligent", new ArrayList<>(Arrays.asList(RocketMqTagEnum.WORKFLOW_SEND_TOPIC))),
|
||||||
|
/**
|
||||||
|
* 企业微信用户部门信息补全消息监听
|
||||||
|
*/
|
||||||
|
QYWX_USERDEPTINFO_COMPLETE_QUEUE("qywx_userdeptinfo_complete_queue","coolcollege-intelligent", new ArrayList<>(Arrays.asList(RocketMqTagEnum.QYWX_USERDEPTINFO_COMPLETE_QUEUE))),
|
||||||
|
|
||||||
|
SHOP_STORE_GROUP_SYNC("shop_store_group_sync","coolcollege-intelligent", new ArrayList<>(Arrays.asList(RocketMqTagEnum.SHOP_STORE_GROUP_SYNC))),
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 授权码更新
|
||||||
|
*/
|
||||||
|
PERMANENT_CODE_UPDATE("permanent_code_update", "coolcollege-intelligent-config", new ArrayList<>(Arrays.asList(RocketMqTagEnum.PERMANENT_CODE_UPDATE))),
|
||||||
|
|
||||||
|
QUESTION_EXPIRE_REMIND("question_expire_remind", "coolcollege-intelligent", new ArrayList<>(Arrays.asList(RocketMqTagEnum.QUESTION_EXPIRE_BEFORE_REMIND, RocketMqTagEnum.QUESTION_EXPIRE_REMIND))),
|
||||||
|
|
||||||
|
STOREWORK_EXPIRE_REMIND("storework_expire_remind", "coolcollege-intelligent", new ArrayList<>(Arrays.asList(RocketMqTagEnum.STOREWORK_BEFORE_START_REMIND, RocketMqTagEnum.STOREWORK_BEFORE_END_REMIND))),
|
||||||
|
|
||||||
|
STOREWORK_TASK_RESOLVE("storework_task_resolve", "coolcollege-intelligent", new ArrayList<>(Arrays.asList(RocketMqTagEnum.STOREWORK_TASK_RESOLVE,RocketMqTagEnum.STOREWORK_TASK_SINGLE_STORE_RESOLVE))),
|
||||||
|
|
||||||
|
LICENSE_NOTICE_TIMER("license_notice_timer", "hz-coolstore-license", new ArrayList<>(Arrays.asList(RocketMqTagEnum.LICENSE_NOTICE_TIMER))),
|
||||||
|
LICENSE_NOTICE_DEAL("license_notice_deal", "coolcollege-intelligent", new ArrayList<>(Arrays.asList(RocketMqTagEnum.LICENSE_NOTICE_DEAL))),
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 任务工作交接
|
||||||
|
*/
|
||||||
|
WORK_HANDOVER_TASK("work_handover_task", "coolcollege-intelligent", new ArrayList<>(Arrays.asList(RocketMqTagEnum.WORK_HANDOVER_TASK))),
|
||||||
|
|
||||||
|
SUPERVISION_RESOLVE_DELAY("supervision_resolve_delay","coolcollege",new ArrayList<>(Arrays.asList(RocketMqTagEnum.SUPERVISION_RESOLVE_DELAY))),
|
||||||
|
/**
|
||||||
|
* 定时任务回调
|
||||||
|
*/
|
||||||
|
SCHEDULER_CALLBACK("scheduler_callback","coolcollege", new ArrayList<>(Arrays.asList(RocketMqTagEnum.SCHEDULER_CALLBACK))),
|
||||||
|
/**
|
||||||
|
* 任务补发
|
||||||
|
*/
|
||||||
|
TASK_REISSUE("task_reissue","coolcollege", new ArrayList<>(Arrays.asList(RocketMqTagEnum.TASK_REISSUE))),
|
||||||
|
|
||||||
|
;
|
||||||
|
|
||||||
|
private final String group;
|
||||||
|
|
||||||
|
private final List<RocketMqTagEnum> tagList;
|
||||||
|
|
||||||
|
private final String listener;
|
||||||
|
|
||||||
|
|
||||||
|
RocketMqGroupEnum(String group,String listener,List<RocketMqTagEnum> tagList) {
|
||||||
|
this.group = group;
|
||||||
|
this.listener = listener;
|
||||||
|
this.tagList = tagList;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getDefaultGroup() {
|
||||||
|
return group;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String getGroupId(RocketMqGroupEnum groupEnum){
|
||||||
|
return groupEnum.group + "_" + CommonContextUtil.getProfileName();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String getTag(RocketMqGroupEnum groupEnum){
|
||||||
|
return StringUtils.join(groupEnum.tagList.stream().map(RocketMqTagEnum::getTag).collect(Collectors.toList()),"||");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,126 @@
|
|||||||
|
package com.cool.store.enums;
|
||||||
|
|
||||||
|
|
||||||
|
import com.cool.store.utils.CommonContextUtil;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author zhangchenbiao
|
||||||
|
* @FileName: RocketMqTagEnum
|
||||||
|
* @Description:
|
||||||
|
* @date 2021-12-23 16:14
|
||||||
|
*/
|
||||||
|
public enum RocketMqTagEnum {
|
||||||
|
|
||||||
|
DEFAULT("default","默认"),
|
||||||
|
ES_PATROL_DATA_DEAL("es_patrol_data_deal","巡店数据加工"),
|
||||||
|
ES_DISPLAY_DATA_DEAL("es_display_data_deal","陈列数据加工"),
|
||||||
|
ES_DATA_SYNC("es_data_sync","数据插入到ES_队列"),
|
||||||
|
EXPORT_IMPORT_MESSAGE("export_import_message","导入导出消息"),
|
||||||
|
CAL_REGION_STORE_NUM("cal_region_store_num","计算门店区域数量"),
|
||||||
|
REGION_STORE_NUM_UPDATE("region_store_num_update","计算门店区域数量"),
|
||||||
|
|
||||||
|
ENTERPRISE_OPEN("enterprise_open","企业开通"),
|
||||||
|
ENTERPRISE_OPEN_CONFIG_RUN_SCRIPT("enterprise_open_config_run_script","企业开通平台库脚本执行"),
|
||||||
|
ENTERPRISE_OPEN_ENTERPRISE_RUN_SCRIPT("enterprise_open_enterprise_run_script","企业开通企业库脚本执行"),
|
||||||
|
ENTERPRISE_OPEN_DATA_SYNC("enterprise_open_data_sync","企业开通数据同步"),
|
||||||
|
|
||||||
|
AUTH_QUEUE("auth_queue","授权队列"),
|
||||||
|
DING_STORE_ADDRESS_BOOK("ding_store_address_book","钉钉通讯录变更事件"),
|
||||||
|
PAY_MARKET_BUY("pay_market_buy","企业购买队列"),
|
||||||
|
|
||||||
|
QW_OPEN_ORDER_CHANGE_QUEUE("qw_openorder_change_queue","企业微信付费监听"),
|
||||||
|
QW_CHANGE_ORDER_QUEUE("qw_change_order_queue","企业微信改单事件,因涉及到两个订单,和普通的订单事件分开"),
|
||||||
|
|
||||||
|
DING_SYNC_ALL_DATA_QUEUE("ding_sync_all_data_queue","钉钉全量同步"),
|
||||||
|
DING_SYNC_ALL_DATA_QUEUE_BAILI("ding_sync_all_data_queue_baili","百丽全量同步"),
|
||||||
|
DING_SYNC_ALL_DATA_OA_QUEUE("ding_sync_all_data_oa_queue","第三方同步"),
|
||||||
|
THIRD_OA_SYNC_SINGLE_QUEUE("third_oa_sync_single_queue","第三方单个用户同步"),
|
||||||
|
|
||||||
|
MQ_OPEN_ENTERPRISE_ALIYUN("mq_open_enterprise_aliyun","阿里云开通门店事件"),
|
||||||
|
YINGSHI_DEVICE_MANAGE("yingshi_device_manage","萤石云设备托管"),
|
||||||
|
INIT_DEVICE_QUEUE("init_device_queue","初始化设备"),
|
||||||
|
|
||||||
|
DISPLAY_CC_USER_QUEUE("display_cc_user_queue","陈列抄送人处理"),
|
||||||
|
STORE_SUB_TASK_DATA_QUEUE("store_sub_task_data_queue","门店子任务消息监听"),
|
||||||
|
|
||||||
|
PATROL_MANUAL_STORE_CAPTURE_PICTURE_QUEUE("patrol_manual_store_capture_picture_queue","定时巡检抓拍"),
|
||||||
|
PATROL_STORE_CAPTURE_PICTURE_QUEUE("patrol_store_capture_picture_queue","定时巡检抓拍"),
|
||||||
|
PATROL_STORE_SCORE_COUNT_QUEUE("patrol_store_score_count_queue","巡店分数计算"),
|
||||||
|
|
||||||
|
UNIFY_TASK_DISPLAY("unify_task_display","陈列任务创建"),
|
||||||
|
UNIFY_TASK_PATROL("unify_task_patrol","巡店任务创建"),
|
||||||
|
UNIFY_TASK_QUESTION("unify_task_question","工单任务创建"),
|
||||||
|
|
||||||
|
INFORMATION_COMPLETION("information_completion","信息补全任务"),
|
||||||
|
INFORMATION_COMPLETION_LICENSE("information_completion_license","证照信息补全任务"),
|
||||||
|
ENTERPRISE_INIT_DEPT_ORDER("enterprise_init_handler_dept_order","补全部门的顺序值"),
|
||||||
|
TASK_PARENT_USER_SAVE("task_parent_user_save", "新增或覆盖父任务处理人映射"),
|
||||||
|
|
||||||
|
STORE_DING_QUEUE("store_ding_queue", "微应用钉钉消息发送"),
|
||||||
|
STORE_BACK_LOG("store_back_log", "待办任务名称"),
|
||||||
|
STORE_BACK_LOG_UPDATE("store_back_log_update", "更新待办任务名称"),
|
||||||
|
UPCOMING_FINISH("upcoming_finish", "待办消息结束队列"),
|
||||||
|
OPEN_SUCCEEDED_MSG_QUEUE("open_succeeded_msg_queue", "发送开通成功消息"),
|
||||||
|
QW_MEMBER_TEMPLE_MSG_QUEUE("qw_member_temple_msg_queue", "发送成员授权模式下模板消息"),
|
||||||
|
APP_PUSH_QUEUE("app_push_queue", "app推送队列"),
|
||||||
|
REMOVE_APPLICATION("remove_application", "解除应用"),
|
||||||
|
GET_OPEN_COOL_COLLEGE_RESULT("get_open_cool_college_result", "获取开通酷学院开通完成后的结果"),
|
||||||
|
COLLEGE_SYNC_USER_DELAY("college_sync_user_delay", "同步人与延迟推送"),
|
||||||
|
COOL_STORE_DATA_CHANGE("cool_store_data_change", "门店端的部门,人员,职位,发生变化后的推送消息队列"),
|
||||||
|
QW_SYNC_FULL_USER("qw_sync_full_user_msg_queue", "企微全量用户同步"),
|
||||||
|
PERSON_SUB_TASK_DATA_QUEUE("person_sub_task_data_queue","按人子任务消息监听"),
|
||||||
|
IMOU_DEVICE_CALLBACK("imou_device_callback","乐橙设备回调事件"),
|
||||||
|
PERMANENT_CODE_UPDATE("permanent_code_update", "授权码变更"),
|
||||||
|
SHOP_STORE_GROUP_SYNC("shop_store_group_sync","门店通门店分组同步"),
|
||||||
|
DING_SINGLE_USER_SYNC("ding_single_user_sync","钉钉用户信息拉取"),
|
||||||
|
STORE_SEND_TOPIC("store_send_topic","流程引擎接收主应用消息"),
|
||||||
|
WORKFLOW_SEND_TOPIC("workflow_send_topic","主应用接收流程引擎消息"),
|
||||||
|
QYWX_USERDEPTINFO_COMPLETE_QUEUE("qywx_userdeptinfo_complete_queue","企业微信用户部门信息补全消息监听"),
|
||||||
|
QUESTION_EXPIRE_BEFORE_REMIND("question_expire_before_remind","工单逾期前提醒"),
|
||||||
|
QUESTION_EXPIRE_REMIND("question_expire_remind","工单逾期提醒"),
|
||||||
|
STOREWORK_SUBMIT_DATA_QUEUE("storework_submit_data_queue","店务提交消息监听"),
|
||||||
|
STOREWORK_COMMENT_DATA_QUEUE("storework_comment_data_queue","店务点评消息监听"),
|
||||||
|
STOREWORK_DELETE_DATA_QUEUE("storework_delete_data_queue","店务删除消息监听"),
|
||||||
|
STOREWORK_BEFORE_START_REMIND("storework_before_start_remind","店务开始前提醒"),
|
||||||
|
STOREWORK_BEFORE_END_REMIND("storework_before_end_remind","店务结束前提醒"),
|
||||||
|
STOREWORK_TASK_RESOLVE("storework_task_resolve","店务分解"),
|
||||||
|
STOREWORK_TASK_SINGLE_STORE_RESOLVE("storework_task_single_store_resolve","单店店务数据分解"),
|
||||||
|
LICENSE_NOTICE_TIMER("license_notice_timer","证照定时任务提醒"),
|
||||||
|
LICENSE_NOTICE_DEAL("license_notice_deal","证照提醒处理"),
|
||||||
|
WORK_HANDOVER_TASK("work_handover_task","工作任务交接"),
|
||||||
|
SUPERVISION_RESOLVE_DELAY("supervision_resolve_delay", "督导任务延迟分解"),
|
||||||
|
SCHEDULER_CALLBACK("scheduler_callback","定时任务回调"),
|
||||||
|
TASK_REISSUE("task_reissue","任务补发"),
|
||||||
|
;
|
||||||
|
|
||||||
|
|
||||||
|
private final String tag;
|
||||||
|
|
||||||
|
private final String remark;
|
||||||
|
|
||||||
|
RocketMqTagEnum(String tag, String remark) {
|
||||||
|
this.tag = tag;
|
||||||
|
this.remark = remark;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getDefaultTag() {
|
||||||
|
return tag;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getTag() {
|
||||||
|
return tag + "_" + CommonContextUtil.getProfileName();
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getRemark() {
|
||||||
|
return remark;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static RocketMqTagEnum getByTag(String tag){
|
||||||
|
for (RocketMqTagEnum value : values()) {
|
||||||
|
if(value.getTag().equals(tag)){
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return ES_PATROL_DATA_DEAL;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,42 @@
|
|||||||
|
package com.cool.store.enums;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.function.Function;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author wxp
|
||||||
|
* @FileName: SubordinateSourceEnum
|
||||||
|
* @Description: auto自动关联 select手动选择
|
||||||
|
* @date 2022-12-30 17:12
|
||||||
|
*/
|
||||||
|
public enum SubordinateSourceEnum {
|
||||||
|
|
||||||
|
AUTO("auto", "关联区域门店权限"),
|
||||||
|
SELECT("select", "手动选择");
|
||||||
|
|
||||||
|
private String code;
|
||||||
|
|
||||||
|
private String msg;
|
||||||
|
|
||||||
|
protected static final Map<String, SubordinateSourceEnum> map = Arrays.stream(values()).collect(
|
||||||
|
Collectors.toMap(SubordinateSourceEnum::getCode, Function.identity()));
|
||||||
|
|
||||||
|
SubordinateSourceEnum(String code, String msg) {
|
||||||
|
this.code = code;
|
||||||
|
this.msg = msg;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getCode() {
|
||||||
|
return code;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getMsg() {
|
||||||
|
return msg;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static SubordinateSourceEnum getByCode(String code) {
|
||||||
|
return map.get(code);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,44 @@
|
|||||||
|
package com.cool.store.enums;
|
||||||
|
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.function.Function;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author zyp
|
||||||
|
*/
|
||||||
|
public enum UserAuthMappingTypeEnum {
|
||||||
|
/**
|
||||||
|
* 区域
|
||||||
|
*/
|
||||||
|
REGION("region","区域"),
|
||||||
|
/**
|
||||||
|
* 门店
|
||||||
|
*/
|
||||||
|
STORE("store","门店");
|
||||||
|
|
||||||
|
private String code;
|
||||||
|
private String desc;
|
||||||
|
public static final Map<String, UserAuthMappingTypeEnum> map = Arrays.stream(values()).collect(
|
||||||
|
Collectors.toMap(UserAuthMappingTypeEnum::getCode, Function.identity()));
|
||||||
|
|
||||||
|
UserAuthMappingTypeEnum(String code, String desc) {
|
||||||
|
this.code = code;
|
||||||
|
this.desc = desc;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getCode() {
|
||||||
|
return code;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getDesc() {
|
||||||
|
return desc;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static UserAuthMappingTypeEnum getByCode(String code) {
|
||||||
|
return map.get(code);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,43 @@
|
|||||||
|
package com.cool.store.enums;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.function.Function;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author wxp
|
||||||
|
* @FileName: UserSelectRangeEnum
|
||||||
|
* @Description: 用户选取范围 共同编辑人范围:self-仅自己,all-全部人员,define-自定义
|
||||||
|
* @date 2022-12-30 17:12
|
||||||
|
*/
|
||||||
|
public enum UserSelectRangeEnum {
|
||||||
|
|
||||||
|
SELF("self", "仅自己"),
|
||||||
|
ALL("all", "全部人员"),
|
||||||
|
DEFINE("define", "自定义");
|
||||||
|
|
||||||
|
private String code;
|
||||||
|
|
||||||
|
private String msg;
|
||||||
|
|
||||||
|
protected static final Map<String, UserSelectRangeEnum> map = Arrays.stream(values()).collect(
|
||||||
|
Collectors.toMap(UserSelectRangeEnum::getCode, Function.identity()));
|
||||||
|
|
||||||
|
UserSelectRangeEnum(String code, String msg) {
|
||||||
|
this.code = code;
|
||||||
|
this.msg = msg;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getCode() {
|
||||||
|
return code;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getMsg() {
|
||||||
|
return msg;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static UserSelectRangeEnum getByCode(String code) {
|
||||||
|
return map.get(code);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,109 @@
|
|||||||
|
package com.cool.store.utils;
|
||||||
|
|
||||||
|
import org.springframework.beans.BeansException;
|
||||||
|
import org.springframework.beans.factory.NoSuchBeanDefinitionException;
|
||||||
|
import org.springframework.context.ApplicationContext;
|
||||||
|
import org.springframework.context.ApplicationContextAware;
|
||||||
|
|
||||||
|
public class CommonContextUtil implements ApplicationContextAware {
|
||||||
|
|
||||||
|
private static ApplicationContext applicationContext; //Spring应用上下文环境
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 实现ApplicationContextAware接口的回调方法,设置上下文环境
|
||||||
|
*
|
||||||
|
* @param applicationContext
|
||||||
|
* @throws BeansException
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
|
||||||
|
CommonContextUtil.applicationContext = applicationContext;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return ApplicationContext
|
||||||
|
*/
|
||||||
|
public static ApplicationContext getApplicationContext() {
|
||||||
|
return applicationContext;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取对象
|
||||||
|
*
|
||||||
|
* @param name
|
||||||
|
* @return Object 一个以所给名字注册的bean的实例
|
||||||
|
* @throws BeansException
|
||||||
|
*/
|
||||||
|
public static Object getBean(String name) throws BeansException {
|
||||||
|
return applicationContext.getBean(name);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据某种类型获取对象
|
||||||
|
* @param requiredType
|
||||||
|
* @return
|
||||||
|
* @throws BeansException
|
||||||
|
*/
|
||||||
|
public static <T> T getBean(Class<T> requiredType) throws BeansException {
|
||||||
|
return applicationContext.getBean(requiredType);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取类型为requiredType的对象
|
||||||
|
* 如果bean不能被类型转换,相应的异常将会被抛出(BeanNotOfRequiredTypeException)
|
||||||
|
*
|
||||||
|
* @param name bean注册名
|
||||||
|
* @param requiredType 返回对象类型
|
||||||
|
* @return Object 返回requiredType类型对象
|
||||||
|
* @throws BeansException
|
||||||
|
*/
|
||||||
|
public static <T> T getBean(String name, Class<T> requiredType) throws BeansException {
|
||||||
|
return applicationContext.getBean(name, requiredType);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 如果BeanFactory包含一个与所给名称匹配的bean定义,则返回true
|
||||||
|
*
|
||||||
|
* @param name
|
||||||
|
* @return boolean
|
||||||
|
*/
|
||||||
|
public static boolean containsBean(String name) {
|
||||||
|
return applicationContext.containsBean(name);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 判断以给定名字注册的bean定义是一个singleton还是一个prototype。
|
||||||
|
* 如果与给定名字相应的bean定义没有被找到,将会抛出一个异常(NoSuchBeanDefinitionException)
|
||||||
|
*
|
||||||
|
* @param name
|
||||||
|
* @return boolean
|
||||||
|
* @throws NoSuchBeanDefinitionException
|
||||||
|
*/
|
||||||
|
public static boolean isSingleton(String name) throws NoSuchBeanDefinitionException {
|
||||||
|
return applicationContext.isSingleton(name);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param name
|
||||||
|
* @return Class 注册对象的类型
|
||||||
|
* @throws NoSuchBeanDefinitionException
|
||||||
|
*/
|
||||||
|
public static Class getType(String name) throws NoSuchBeanDefinitionException {
|
||||||
|
return applicationContext.getType(name);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 如果给定的bean名字在bean定义中有别名,则返回这些别名
|
||||||
|
*
|
||||||
|
* @param name
|
||||||
|
* @return
|
||||||
|
* @throws NoSuchBeanDefinitionException
|
||||||
|
*/
|
||||||
|
public static String[] getAliases(String name) throws NoSuchBeanDefinitionException {
|
||||||
|
return applicationContext.getAliases(name);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String getProfileName(){
|
||||||
|
return applicationContext.getEnvironment().getActiveProfiles()[0];
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,97 @@
|
|||||||
|
package com.cool.store.utils;
|
||||||
|
|
||||||
|
import org.apache.commons.collections4.CollectionUtils;
|
||||||
|
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.LinkedList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* describe:
|
||||||
|
*
|
||||||
|
* @author zhouyiping
|
||||||
|
* @date 2020/09/21
|
||||||
|
*/
|
||||||
|
public class CommonNodeUtils {
|
||||||
|
/**
|
||||||
|
* 树型数据的所有子项(list结构包含本身)(节点为Long)
|
||||||
|
* @param rootId
|
||||||
|
* @param id
|
||||||
|
* @param all 树的所有节点
|
||||||
|
* @param parentGroupMap Map<parentId,List<id>>
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public static List<Long> getAllChildListContainSelf(Long rootId,Long id, List<Long> all,Map<Long,List<Long>> parentGroupMap) {
|
||||||
|
List<Long> childList = new LinkedList<>();
|
||||||
|
if(CollectionUtils.isEmpty(all)){
|
||||||
|
return Collections.emptyList();
|
||||||
|
}
|
||||||
|
if(id.equals(rootId)&&!all.contains(id)){
|
||||||
|
return Collections.emptyList();
|
||||||
|
}
|
||||||
|
List<Long> idList = parentGroupMap.get(id);
|
||||||
|
childList.add(id);
|
||||||
|
if(CollectionUtils.isEmpty(idList)){
|
||||||
|
return childList;
|
||||||
|
}
|
||||||
|
childList.addAll(idList);
|
||||||
|
for (Long item:idList){
|
||||||
|
getChildList(item,parentGroupMap,childList);
|
||||||
|
}
|
||||||
|
return childList;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void getChildList(Long id,Map<Long,List<Long>> parentGroupMap, List<Long> childList) {
|
||||||
|
List<Long> child = parentGroupMap.get(id);
|
||||||
|
if (CollectionUtils.isNotEmpty(child)) {
|
||||||
|
childList.addAll(child);
|
||||||
|
for (Long cid : child) {
|
||||||
|
getChildList(cid, parentGroupMap, childList);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 树型数据的所有子项(list结构包含本身)(节点为String)
|
||||||
|
* @param rootId
|
||||||
|
* @param id
|
||||||
|
* @param all 树的所有节点
|
||||||
|
* @param parentGroupMap Map<parentId,List<id>>
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public static List<String> getAllChildListContainSelf(String rootId,String id, List<String> all,Map<String,List<String>> parentGroupMap) {
|
||||||
|
List<String> childList = new LinkedList<>();
|
||||||
|
if(CollectionUtils.isEmpty(all)){
|
||||||
|
return Collections.emptyList();
|
||||||
|
}
|
||||||
|
if(id.equals(rootId)&&!all.contains(id)){
|
||||||
|
return Collections.emptyList();
|
||||||
|
}
|
||||||
|
List<String> idList = parentGroupMap.get(id);
|
||||||
|
childList.add(id);
|
||||||
|
if(CollectionUtils.isEmpty(idList)){
|
||||||
|
return childList;
|
||||||
|
}
|
||||||
|
childList.addAll(idList);
|
||||||
|
for (String item:idList){
|
||||||
|
getChildList(item,parentGroupMap,childList);
|
||||||
|
}
|
||||||
|
return childList;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void getChildList(String id,Map<String,List<String>> parentGroupMap, List<String> childList) {
|
||||||
|
List<String> child = parentGroupMap.get(id);
|
||||||
|
if (CollectionUtils.isNotEmpty(child)) {
|
||||||
|
childList.addAll(child);
|
||||||
|
for (String cid : child) {
|
||||||
|
getChildList(cid, parentGroupMap, childList);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,93 @@
|
|||||||
|
package com.cool.store.utils;
|
||||||
|
|
||||||
|
|
||||||
|
import com.cool.store.constants.RedisConstant;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* redis常量工具类
|
||||||
|
*
|
||||||
|
* @author byd
|
||||||
|
*/
|
||||||
|
@Component
|
||||||
|
@Slf4j
|
||||||
|
public class RedisConstantUtil {
|
||||||
|
|
||||||
|
@Value("${spring.profiles.active}")
|
||||||
|
private String active;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取钉钉同步区域key
|
||||||
|
*
|
||||||
|
* @param eid
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public String getSyncRegionKey(String eid) {
|
||||||
|
|
||||||
|
return active + "_" + RedisConstant.REGION_SYNC_ALL + eid;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取门店同步key
|
||||||
|
*
|
||||||
|
* @param eid
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public String getSyncStoreKey(String eid) {
|
||||||
|
|
||||||
|
return active + "_" + RedisConstant.STORE_SYNC_ALL + eid;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getSyncLockKey(String eid) {
|
||||||
|
|
||||||
|
return active + "_" + RedisConstant.REGION_SYNC_LOCK + eid;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getSyncEidEffectiveKey(String eid) {
|
||||||
|
|
||||||
|
return active + "_" + RedisConstant.EID_SYNC_EFFECTIVE + eid;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getTaskStageNoticeKey(String key) {
|
||||||
|
|
||||||
|
return active + "_" + RedisConstant.TASK_STAGE_NOTICE + key;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getTaskDelFlagKey(String key) {
|
||||||
|
|
||||||
|
return active + "_" + RedisConstant.TASK_DEL_FLAG + key;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getCapturePicture(String key) {
|
||||||
|
|
||||||
|
return active + "_" + RedisConstant.CAPTURE_PICTURE_STATUS_PREFIX + key;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public String getQuestionTaskLockKey(String eid, String key) {
|
||||||
|
return active + "_" + RedisConstant.QUESTION_TASK_LOCK + "_" + eid + "_" + key;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getStoreWorkQuestionTaskLockKey(String eid, String key) {
|
||||||
|
return active + "_" + RedisConstant.STORE_WORK_QUESTION_TASK_LOCK + "_" + eid + "_" + key;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getShowStoreAuthKey() {
|
||||||
|
return active + "_" + RedisConstant.SHOW_STORE_AUTH;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getRegionNameKey(String eid, String regionId) {
|
||||||
|
return active + "_" + RedisConstant.REGION_ALL_NAME_CACHE + eid + ":" + regionId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getGuideInfoKey(String eid, Long menuId) {
|
||||||
|
return active + "_" + RedisConstant.GUIDE_INFO + eid + ":" + menuId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getRegionNameListKey(String eid, String regionId) {
|
||||||
|
return active + "_" + RedisConstant.REGION_ALL_NAME_CACHE + eid + ":" + regionId;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -92,7 +92,6 @@
|
|||||||
<orderEntry type="library" name="Maven: com.github.pagehelper:pagehelper-spring-boot-autoconfigure:1.4.6" level="project" />
|
<orderEntry type="library" name="Maven: com.github.pagehelper:pagehelper-spring-boot-autoconfigure:1.4.6" level="project" />
|
||||||
<orderEntry type="library" name="Maven: com.github.pagehelper:pagehelper:5.3.2" level="project" />
|
<orderEntry type="library" name="Maven: com.github.pagehelper:pagehelper:5.3.2" level="project" />
|
||||||
<orderEntry type="library" name="Maven: com.github.jsqlparser:jsqlparser:4.5" level="project" />
|
<orderEntry type="library" name="Maven: com.github.jsqlparser:jsqlparser:4.5" level="project" />
|
||||||
<orderEntry type="library" name="Maven: com.coolstore:coolstore-base:1.5.3" level="project" />
|
|
||||||
<orderEntry type="library" name="Maven: com.google.guava:guava:20.0" level="project" />
|
<orderEntry type="library" name="Maven: com.google.guava:guava:20.0" level="project" />
|
||||||
<orderEntry type="library" name="Maven: mysql:mysql-connector-java:8.0.18" level="project" />
|
<orderEntry type="library" name="Maven: mysql:mysql-connector-java:8.0.18" level="project" />
|
||||||
<orderEntry type="library" name="Maven: com.google.protobuf:protobuf-java:3.6.1" level="project" />
|
<orderEntry type="library" name="Maven: com.google.protobuf:protobuf-java:3.6.1" level="project" />
|
||||||
|
|||||||
@@ -1,9 +1,12 @@
|
|||||||
package com.cool.store.dao;
|
package com.cool.store.dao;
|
||||||
|
|
||||||
|
import com.cool.store.dto.enterprise.EnterpriseUserDTO;
|
||||||
import com.cool.store.entity.EnterpriseUserDO;
|
import com.cool.store.entity.EnterpriseUserDO;
|
||||||
import com.cool.store.mapper.EnterpriseUserMapper;
|
import com.cool.store.mapper.EnterpriseUserMapper;
|
||||||
|
import com.google.common.collect.Lists;
|
||||||
import org.apache.commons.collections4.CollectionUtils;
|
import org.apache.commons.collections4.CollectionUtils;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
@@ -48,4 +51,47 @@ public class EnterpriseUserDAO {
|
|||||||
}
|
}
|
||||||
enterpriseUserMapper.batchUpdateDiffUserDiffRegionIds(enterpriseId, enterpriseUserList);
|
enterpriseUserMapper.batchUpdateDiffUserDiffRegionIds(enterpriseId, enterpriseUserList);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public List<EnterpriseUserDO> fuzzyUsersByDepartment(String eid,
|
||||||
|
String deptId,
|
||||||
|
Long roleId,
|
||||||
|
String orderBy,
|
||||||
|
String orderRule,
|
||||||
|
String userName,
|
||||||
|
String jobnumber,
|
||||||
|
Integer userStatus,
|
||||||
|
List<String> userIdList,
|
||||||
|
String regionId){
|
||||||
|
return enterpriseUserMapper.fuzzyUsersByDepartment(eid, deptId, roleId, orderBy, orderRule, userName, jobnumber, userStatus, userIdList, regionId);
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<EnterpriseUserDO> fuzzyUsersByNotRole(String eid,
|
||||||
|
String deptId,
|
||||||
|
String orderBy,
|
||||||
|
String orderRule,
|
||||||
|
String userName,
|
||||||
|
String jobnumber,
|
||||||
|
Integer userStatus,
|
||||||
|
List<String> userIdList,
|
||||||
|
String regionId){
|
||||||
|
return enterpriseUserMapper.fuzzyUsersByNotRole(eid, deptId, orderBy, orderRule, userName, jobnumber, userStatus, userIdList, regionId);
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<EnterpriseUserDO> selectUsersByUserIds(String eid, List<String> userIds) {
|
||||||
|
return enterpriseUserMapper.selectUsersByUserIds(eid, userIds);
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<EnterpriseUserDO> listUserByGroupId(String eid, String groupId, String userName, List<String> userIdList){
|
||||||
|
if(StringUtils.isAnyBlank(eid, groupId)){
|
||||||
|
return Lists.newArrayList();
|
||||||
|
}
|
||||||
|
return enterpriseUserMapper.listUserByGroupId(eid, groupId, userName, userIdList);
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<EnterpriseUserDO> listByRegionIdList(String eid, List<String> regionIdList){
|
||||||
|
if(StringUtils.isBlank(eid) || CollectionUtils.isEmpty(regionIdList)){
|
||||||
|
return Lists.newArrayList();
|
||||||
|
}
|
||||||
|
return enterpriseUserMapper.listByRegionIdList(eid, regionIdList);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,63 @@
|
|||||||
|
package com.cool.store.dao;
|
||||||
|
|
||||||
|
import com.cool.store.entity.EnterpriseUserGroupDO;
|
||||||
|
import com.cool.store.mapper.EnterpriseUserGroupMapper;
|
||||||
|
import org.apache.commons.collections4.CollectionUtils;
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
import org.springframework.stereotype.Repository;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户分组
|
||||||
|
* @author wxp
|
||||||
|
* @date 2022-12-29 14:56
|
||||||
|
*/
|
||||||
|
@Repository
|
||||||
|
public class EnterpriseUserGroupDAO {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private EnterpriseUserGroupMapper enterpriseUserGroupMapper;
|
||||||
|
|
||||||
|
public int insertSelective(EnterpriseUserGroupDO record, String enterpriseId){
|
||||||
|
return enterpriseUserGroupMapper.insertSelective(record,enterpriseId);
|
||||||
|
}
|
||||||
|
|
||||||
|
public int updateByPrimaryKeySelective(EnterpriseUserGroupDO record, String enterpriseId){
|
||||||
|
return enterpriseUserGroupMapper.updateByPrimaryKeySelective(record,enterpriseId);
|
||||||
|
}
|
||||||
|
|
||||||
|
public int updateByGroupId(EnterpriseUserGroupDO record, String enterpriseId){
|
||||||
|
return enterpriseUserGroupMapper.updateByGroupId(record,enterpriseId);
|
||||||
|
}
|
||||||
|
|
||||||
|
public int countByGroupName(String enterpriseId, String groupName, String groupId){
|
||||||
|
return enterpriseUserGroupMapper.countByGroupName(enterpriseId, groupName, groupId);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void deleteByGroupIdList(String enterpriseId, List<String> groupIdList) {
|
||||||
|
if(StringUtils.isBlank(enterpriseId) || CollectionUtils.isEmpty(groupIdList)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
enterpriseUserGroupMapper.deleteByGroupIdList(enterpriseId, groupIdList);
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<EnterpriseUserGroupDO> listUserGroup(String enterpriseId, String groupName){
|
||||||
|
return enterpriseUserGroupMapper.listUserGroup(enterpriseId, groupName);
|
||||||
|
}
|
||||||
|
|
||||||
|
public EnterpriseUserGroupDO getByGroupId(String enterpriseId, String groupId){
|
||||||
|
return enterpriseUserGroupMapper.getByGroupId(enterpriseId, groupId);
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<EnterpriseUserGroupDO> listByGroupIdList(String enterpriseId, List<String> groupIdList){
|
||||||
|
if (StringUtils.isBlank(enterpriseId) || CollectionUtils.isEmpty(groupIdList)) {
|
||||||
|
return new ArrayList<>();
|
||||||
|
}
|
||||||
|
return enterpriseUserGroupMapper.listByGroupIdList(enterpriseId, groupIdList);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,71 @@
|
|||||||
|
package com.cool.store.dao;
|
||||||
|
|
||||||
|
import com.cool.store.entity.EnterpriseUserGroupMappingDO;
|
||||||
|
import com.cool.store.mapper.EnterpriseUserGroupMappingMapper;
|
||||||
|
import org.apache.commons.collections4.CollectionUtils;
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
import org.springframework.stereotype.Repository;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户分组映射
|
||||||
|
* @author wxp
|
||||||
|
* @date 2022-12-29 14:56
|
||||||
|
*/
|
||||||
|
@Repository
|
||||||
|
public class EnterpriseUserGroupMappingDAO {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private EnterpriseUserGroupMappingMapper enterpriseUserGroupMappingMapper;
|
||||||
|
|
||||||
|
public void deleteUserGroupMappingByGroupId(String enterpriseId, String groupId) {
|
||||||
|
if (StringUtils.isBlank(enterpriseId) || StringUtils.isBlank(groupId)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
enterpriseUserGroupMappingMapper.deleteUserGroupMappingByGroupId(enterpriseId, groupId);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void batchInsertMapping(String enterpriseId, List<String> userIdList, String groupId) {
|
||||||
|
if (StringUtils.isBlank(enterpriseId) || CollectionUtils.isEmpty(userIdList) || StringUtils.isBlank(groupId)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
enterpriseUserGroupMappingMapper.batchInsertMapping(enterpriseId, userIdList, groupId);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void deleteMappingByGroupIdList(String enterpriseId, String groupId, List<String> userIdList) {
|
||||||
|
if(StringUtils.isBlank(enterpriseId) || StringUtils.isBlank(groupId)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
enterpriseUserGroupMappingMapper.deleteMappingByGroupIdList(enterpriseId, groupId, userIdList);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void deleteMappingByUserIdList(String enterpriseId, List<String> userIdList) {
|
||||||
|
if(StringUtils.isBlank(enterpriseId) || CollectionUtils.isEmpty(userIdList)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
enterpriseUserGroupMappingMapper.deleteMappingByUserIdList(enterpriseId, userIdList);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public List<EnterpriseUserGroupMappingDO> listByGroupIdList(String enterpriseId, List<String> groupIdList){
|
||||||
|
return enterpriseUserGroupMappingMapper.listByGroupIdList(enterpriseId, groupIdList);
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<EnterpriseUserGroupMappingDO> listByUserIdList(String enterpriseId, List<String> userIdList){
|
||||||
|
if (StringUtils.isBlank(enterpriseId) || CollectionUtils.isEmpty(userIdList)) {
|
||||||
|
return new ArrayList<>();
|
||||||
|
}
|
||||||
|
return enterpriseUserGroupMappingMapper.listByUserIdList(enterpriseId, userIdList);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void batchInsertOrUpdateUserGroupMapping(String enterpriseId, List<EnterpriseUserGroupMappingDO> userGroupMappingDOList) {
|
||||||
|
if (CollectionUtils.isEmpty(userGroupMappingDOList)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
enterpriseUserGroupMappingMapper.batchInsertOrUpdateUserGroupMapping(enterpriseId, userGroupMappingDOList);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -1,8 +1,15 @@
|
|||||||
package com.cool.store.dao;
|
package com.cool.store.dao;
|
||||||
|
|
||||||
|
import com.cool.store.dto.buser.UserRoleDTO;
|
||||||
import com.cool.store.dto.enterprise.EnterpriseUserRole;
|
import com.cool.store.dto.enterprise.EnterpriseUserRole;
|
||||||
|
import com.cool.store.entity.SysRoleDO;
|
||||||
|
import com.cool.store.enums.RoleEnum;
|
||||||
import com.cool.store.mapper.EnterpriseUserMapper;
|
import com.cool.store.mapper.EnterpriseUserMapper;
|
||||||
import com.cool.store.mapper.EnterpriseUserRoleMapper;
|
import com.cool.store.mapper.EnterpriseUserRoleMapper;
|
||||||
|
import com.google.common.collect.Lists;
|
||||||
|
import org.apache.commons.collections4.CollectionUtils;
|
||||||
|
import org.apache.commons.collections4.ListUtils;
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
@@ -22,4 +29,21 @@ public class EnterpriseUserRoleDAO {
|
|||||||
return enterpriseUserRoleMapper.insertBatchUserRole(eid, userRole);
|
return enterpriseUserRoleMapper.insertBatchUserRole(eid, userRole);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public List<UserRoleDTO> getUserAndRolesByUserId(String enterpriseId, List<String> userIdList){
|
||||||
|
if(StringUtils.isBlank(enterpriseId) || CollectionUtils.isEmpty(userIdList)){
|
||||||
|
return Lists.newArrayList();
|
||||||
|
}
|
||||||
|
return enterpriseUserRoleMapper.getUserAndRolesByUserId(enterpriseId, userIdList);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Boolean checkIsAdmin(String enterpriseId, String userId) {
|
||||||
|
// 1.取出所有用户角色
|
||||||
|
// 2.匹配是否有管理员角色
|
||||||
|
List<SysRoleDO> sysRoleDOList = enterpriseUserRoleMapper.listRoleByUserId(enterpriseId, userId);
|
||||||
|
return ListUtils.emptyIfNull(sysRoleDOList)
|
||||||
|
.stream()
|
||||||
|
.anyMatch(role-> StringUtils.equals(RoleEnum.MASTER.getRoleEnum(),role.getRoleEnum()));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -1,11 +1,15 @@
|
|||||||
package com.cool.store.dao;
|
package com.cool.store.dao;
|
||||||
|
|
||||||
import com.cool.store.constants.CommonConstants;
|
import com.cool.store.constants.CommonConstants;
|
||||||
|
import com.cool.store.dto.region.RegionPathDTO;
|
||||||
import com.cool.store.entity.RegionDO;
|
import com.cool.store.entity.RegionDO;
|
||||||
import com.cool.store.enums.RegionTypeEnum;
|
import com.cool.store.enums.RegionTypeEnum;
|
||||||
import com.cool.store.mapper.RegionMapper;
|
import com.cool.store.mapper.RegionMapper;
|
||||||
|
import com.google.common.collect.Lists;
|
||||||
import org.apache.commons.collections4.CollectionUtils;
|
import org.apache.commons.collections4.CollectionUtils;
|
||||||
import org.apache.commons.collections4.ListUtils;
|
import org.apache.commons.collections4.ListUtils;
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
@@ -71,4 +75,33 @@ public class RegionDAO {
|
|||||||
.stream()
|
.stream()
|
||||||
.collect(Collectors.toMap(RegionDO::getSynDingDeptId, RegionDO::getId, (r, e) -> r));
|
.collect(Collectors.toMap(RegionDO::getSynDingDeptId, RegionDO::getId, (r, e) -> r));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public List<RegionDO> getAllRegion(String eid){
|
||||||
|
if(StringUtils.isBlank(eid)){
|
||||||
|
return Lists.newArrayList();
|
||||||
|
}
|
||||||
|
return regionMapper.getAllRegion(eid);
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<RegionDO> listStoreRegionByIds(String enterpriseId, List<Long> regionIds){
|
||||||
|
if(StringUtils.isBlank(enterpriseId) || CollectionUtils.isEmpty(regionIds)){
|
||||||
|
return Lists.newArrayList();
|
||||||
|
}
|
||||||
|
return regionMapper.listStoreRegionByIds(enterpriseId, regionIds);
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<RegionPathDTO> getRegionPathByList(String eid, List<String> regionIds) {
|
||||||
|
List<RegionDO> regionList = regionMapper.getRegionByRegionIds(eid, regionIds);
|
||||||
|
return ListUtils.emptyIfNull(regionList)
|
||||||
|
.stream()
|
||||||
|
.map(data->{
|
||||||
|
RegionPathDTO regionPathDTO =new RegionPathDTO();
|
||||||
|
regionPathDTO.setRegionId(data.getRegionId());
|
||||||
|
regionPathDTO.setRegionPath(data.getFullRegionPath());
|
||||||
|
regionPathDTO.setRegionName(data.getName());
|
||||||
|
regionPathDTO.setStoreNum(data.getStoreNum() == null? 0 : data.getStoreNum());
|
||||||
|
regionPathDTO.setRegionType(data.getRegionType());
|
||||||
|
return regionPathDTO;
|
||||||
|
}).collect(Collectors.toList());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,61 @@
|
|||||||
|
package com.cool.store.dao;
|
||||||
|
|
||||||
|
import com.cool.store.dto.store.StoreAreaDTO;
|
||||||
|
import com.cool.store.entity.StoreDO;
|
||||||
|
import com.cool.store.mapper.StoreMapper;
|
||||||
|
import com.google.common.collect.Lists;
|
||||||
|
import org.apache.commons.collections4.CollectionUtils;
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author zhangchenbiao
|
||||||
|
* @FileName: StoreDAO
|
||||||
|
* @Description:
|
||||||
|
* @date 2023-05-31 11:52
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class StoreDAO {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private StoreMapper storeMapper;
|
||||||
|
|
||||||
|
public List<StoreAreaDTO> listStoreByRegionIdList(String eid, List<String> regionIdList) {
|
||||||
|
if(StringUtils.isBlank(eid) || CollectionUtils.isEmpty(regionIdList)){
|
||||||
|
return Collections.emptyList();
|
||||||
|
}
|
||||||
|
return storeMapper.listStoreByRegionIdList(eid, regionIdList);
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<StoreDO> getStoreListByStoreIds(String enterpriseId, List<String> storeIdList){
|
||||||
|
if(StringUtils.isBlank(enterpriseId) || CollectionUtils.isEmpty(storeIdList)){
|
||||||
|
return Lists.newArrayList();
|
||||||
|
}
|
||||||
|
return storeMapper.getStoreListByStoreIds(enterpriseId, storeIdList);
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<StoreAreaDTO> listStoreByRegionIdListNotChild(String eid, List<String> regionIdList) {
|
||||||
|
if(StringUtils.isBlank(eid) || CollectionUtils.isEmpty(regionIdList)){
|
||||||
|
return Lists.newArrayList();
|
||||||
|
}
|
||||||
|
return storeMapper.listStoreByRegionIdListNotChild(eid, regionIdList);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getStoreCount(String enterpriseId){
|
||||||
|
return storeMapper.countStore(enterpriseId);
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<String> getAllStoreList (String eid,Boolean isReturnList){
|
||||||
|
List<String> invalidStores=new ArrayList<>();
|
||||||
|
if(isReturnList){
|
||||||
|
return storeMapper.listStoreIdList(eid);
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,43 @@
|
|||||||
|
package com.cool.store.dao;
|
||||||
|
|
||||||
|
import com.cool.store.entity.SubordinateMappingDO;
|
||||||
|
import com.cool.store.mapper.SubordinateMappingMapper;
|
||||||
|
import com.google.common.collect.Lists;
|
||||||
|
import org.apache.commons.collections4.CollectionUtils;
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author zhangchenbiao
|
||||||
|
* @FileName: SubordinateMappingDAO
|
||||||
|
* @Description:
|
||||||
|
* @date 2023-05-31 14:27
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class SubordinateMappingDAO {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private SubordinateMappingMapper subordinateMappingMapper;
|
||||||
|
|
||||||
|
public List<SubordinateMappingDO> selectByUserIds(String enterpriseId, List<String> userIds){
|
||||||
|
if (StringUtils.isBlank(enterpriseId) || CollectionUtils.isEmpty(userIds)){
|
||||||
|
return Lists.newArrayList();
|
||||||
|
}
|
||||||
|
return subordinateMappingMapper.selectByUserIds(enterpriseId,userIds);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void batchInsertSubordinateMapping(String enterpriseId, List<SubordinateMappingDO> subordinateMappingDOS) {
|
||||||
|
if (CollectionUtils.isEmpty(subordinateMappingDOS)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
List<SubordinateMappingDO> distinctData = subordinateMappingDOS.stream()
|
||||||
|
.distinct()
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
subordinateMappingMapper.batchInsertSubordinateMapping(enterpriseId, distinctData);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -1,7 +1,15 @@
|
|||||||
package com.cool.store.dao;
|
package com.cool.store.dao;
|
||||||
|
|
||||||
|
import com.cool.store.entity.UserAuthMappingDO;
|
||||||
|
import com.cool.store.mapper.UserAuthMappingMapper;
|
||||||
|
import com.google.common.collect.Lists;
|
||||||
|
import org.apache.commons.collections4.CollectionUtils;
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author zhangchenbiao
|
* @author zhangchenbiao
|
||||||
* @date 2023-05-19 02:54
|
* @date 2023-05-19 02:54
|
||||||
@@ -9,4 +17,21 @@ import org.springframework.stereotype.Service;
|
|||||||
@Service
|
@Service
|
||||||
public class UserAuthMappingDAO {
|
public class UserAuthMappingDAO {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private UserAuthMappingMapper userAuthMappingMapper;
|
||||||
|
|
||||||
|
|
||||||
|
public List<UserAuthMappingDO> listUserAuthMappingByUserId(String eid, String userId){
|
||||||
|
if(StringUtils.isAnyBlank(eid, userId)){
|
||||||
|
return Lists.newArrayList();
|
||||||
|
}
|
||||||
|
return userAuthMappingMapper.listUserAuthMappingByUserId(eid, userId);
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<UserAuthMappingDO> listUserAuthMappingByUserIds(String eid, List<String> userIds){
|
||||||
|
if(StringUtils.isBlank(eid) || CollectionUtils.isEmpty(userIds)){
|
||||||
|
return Lists.newArrayList();
|
||||||
|
}
|
||||||
|
return userAuthMappingMapper.listUserAuthMappingByUserIds(eid, userIds);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,40 @@
|
|||||||
|
package com.cool.store.mapper;
|
||||||
|
|
||||||
|
import com.cool.store.entity.EnterpriseUserGroupDO;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author zhangchenbiao
|
||||||
|
* @date 2023-05-31 02:43
|
||||||
|
*/
|
||||||
|
public interface EnterpriseUserGroupMapper {
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* 默认插入方法,只会给有值的字段赋值
|
||||||
|
* 会对传进来的字段做判空处理,如果字段为空,则使用数据库默认字段或者null
|
||||||
|
* dateTime:2023-05-31 02:43
|
||||||
|
*/
|
||||||
|
int insertSelective(@Param("record") EnterpriseUserGroupDO record, @Param("enterpriseId") String enterpriseId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* 默认更新方法,根据主键更新,不会把null值更新到数据库,避免覆盖之前有值的
|
||||||
|
* dateTime:2023-05-31 02:43
|
||||||
|
*/
|
||||||
|
int updateByPrimaryKeySelective(@Param("record") EnterpriseUserGroupDO record, @Param("enterpriseId") String enterpriseId);
|
||||||
|
|
||||||
|
|
||||||
|
int countByGroupName(@Param("enterpriseId") String enterpriseId, @Param("groupName") String groupName, @Param("groupId") String groupId);
|
||||||
|
|
||||||
|
void deleteByGroupIdList(@Param("enterpriseId") String enterpriseId, @Param("groupIdList") List<String> groupIdList);
|
||||||
|
|
||||||
|
List<EnterpriseUserGroupDO> listUserGroup(@Param("enterpriseId")String enterpriseId, @Param("groupName")String groupName);
|
||||||
|
|
||||||
|
EnterpriseUserGroupDO getByGroupId(@Param("enterpriseId")String enterpriseId, @Param("groupId")String groupId);
|
||||||
|
|
||||||
|
List<EnterpriseUserGroupDO> listByGroupIdList(@Param("enterpriseId") String enterpriseId, @Param("groupIdList") List<String> groupIdList);
|
||||||
|
|
||||||
|
int updateByGroupId(@Param("record")EnterpriseUserGroupDO record, @Param("enterpriseId") String enterpriseId);
|
||||||
|
}
|
||||||
@@ -0,0 +1,41 @@
|
|||||||
|
package com.cool.store.mapper;
|
||||||
|
|
||||||
|
import com.cool.store.entity.EnterpriseUserGroupMappingDO;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author zhangchenbiao
|
||||||
|
* @date 2023-05-31 02:43
|
||||||
|
*/
|
||||||
|
public interface EnterpriseUserGroupMappingMapper {
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* 默认插入方法,只会给有值的字段赋值
|
||||||
|
* 会对传进来的字段做判空处理,如果字段为空,则使用数据库默认字段或者null
|
||||||
|
* dateTime:2023-05-31 02:43
|
||||||
|
*/
|
||||||
|
int insertSelective(@Param("record") EnterpriseUserGroupMappingDO record, @Param("enterpriseId") String enterpriseId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* 默认更新方法,根据主键更新,不会把null值更新到数据库,避免覆盖之前有值的
|
||||||
|
* dateTime:2023-05-31 02:43
|
||||||
|
*/
|
||||||
|
int updateByPrimaryKeySelective(@Param("record") EnterpriseUserGroupMappingDO record, @Param("enterpriseId") String enterpriseId);
|
||||||
|
|
||||||
|
void deleteUserGroupMappingByGroupId(@Param("enterpriseId")String enterpriseId, @Param("groupId") String groupId);
|
||||||
|
|
||||||
|
Integer batchInsertMapping(@Param("enterpriseId") String enterpriseId, @Param("userIdList") List<String> userIdList, @Param("groupId") String groupId);
|
||||||
|
|
||||||
|
Integer deleteMappingByGroupIdList(@Param("enterpriseId") String enterpriseId, @Param("groupId") String groupId, @Param("userIdList") List<String> userIdList);
|
||||||
|
|
||||||
|
Integer deleteMappingByUserIdList(@Param("enterpriseId") String enterpriseId, @Param("userIdList") List<String> userIdList);
|
||||||
|
|
||||||
|
List<EnterpriseUserGroupMappingDO> listByGroupIdList(@Param("enterpriseId") String enterpriseId, @Param("groupIdList") List<String> groupIdList);
|
||||||
|
|
||||||
|
List<EnterpriseUserGroupMappingDO> listByUserIdList(@Param("enterpriseId") String enterpriseId, @Param("userIdList") List<String> userIdList);
|
||||||
|
|
||||||
|
void batchInsertOrUpdateUserGroupMapping(@Param("enterpriseId") String enterpriseId,@Param("userGroupMappingList") List<EnterpriseUserGroupMappingDO> userGroupMappingList);
|
||||||
|
}
|
||||||
@@ -1,5 +1,6 @@
|
|||||||
package com.cool.store.mapper;
|
package com.cool.store.mapper;
|
||||||
|
|
||||||
|
import com.cool.store.dto.enterprise.EnterpriseUserDTO;
|
||||||
import com.cool.store.entity.EnterpriseUserDO;
|
import com.cool.store.entity.EnterpriseUserDO;
|
||||||
import org.apache.ibatis.annotations.Param;
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
@@ -48,4 +49,41 @@ public interface EnterpriseUserMapper {
|
|||||||
*/
|
*/
|
||||||
Boolean batchUpdateDiffUserDiffRegionIds(@Param("eid") String eid, @Param("list") List<EnterpriseUserDO> enterpriseUserDOList);
|
Boolean batchUpdateDiffUserDiffRegionIds(@Param("eid") String eid, @Param("list") List<EnterpriseUserDO> enterpriseUserDOList);
|
||||||
|
|
||||||
|
List<EnterpriseUserDO> fuzzyUsersByDepartment(@Param("eid") String eid,
|
||||||
|
@Param("deptId") String deptId,
|
||||||
|
@Param("roleId") Long roleId,
|
||||||
|
@Param("orderBy") String orderBy,
|
||||||
|
@Param("orderRule") String orderRule,
|
||||||
|
@Param("userName") String userName,
|
||||||
|
@Param("jobNumber") String jobnumber,
|
||||||
|
@Param("userStatus") Integer userStatus,
|
||||||
|
@Param("userIdList") List<String> userIdList,
|
||||||
|
@Param("regionId") String regionId);
|
||||||
|
|
||||||
|
List<EnterpriseUserDO> fuzzyUsersByNotRole(@Param("eid") String eid,
|
||||||
|
@Param("deptId") String deptId,
|
||||||
|
@Param("orderBy") String orderBy,
|
||||||
|
@Param("orderRule") String orderRule,
|
||||||
|
@Param("userName") String userName,
|
||||||
|
@Param("jobNumber") String jobnumber,
|
||||||
|
@Param("userStatus") Integer userStatus,
|
||||||
|
@Param("userIdList") List<String> userIdList,
|
||||||
|
@Param("regionId") String regionId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据用户id数组获取用户
|
||||||
|
* @param eid
|
||||||
|
* @param userIds
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
List<EnterpriseUserDO> selectUsersByUserIds(@Param("eid") String eid, @Param("userIds") List<String> userIds);
|
||||||
|
|
||||||
|
|
||||||
|
List<EnterpriseUserDO> listUserByGroupId(@Param("eid") String eid,
|
||||||
|
@Param("groupId") String groupId,
|
||||||
|
@Param("userName") String userName,
|
||||||
|
@Param("userIdList") List<String> userIdList);
|
||||||
|
|
||||||
|
List<EnterpriseUserDO> listByRegionIdList(@Param("eid") String eid, @Param("regionIdList") List<String> regionIdList);
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -1,7 +1,9 @@
|
|||||||
package com.cool.store.mapper;
|
package com.cool.store.mapper;
|
||||||
|
|
||||||
|
import com.cool.store.dto.buser.UserRoleDTO;
|
||||||
import com.cool.store.dto.enterprise.EnterpriseUserRole;
|
import com.cool.store.dto.enterprise.EnterpriseUserRole;
|
||||||
import com.cool.store.entity.EnterpriseUserRoleDO;
|
import com.cool.store.entity.EnterpriseUserRoleDO;
|
||||||
|
import com.cool.store.entity.SysRoleDO;
|
||||||
import org.apache.ibatis.annotations.Param;
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@@ -33,4 +35,8 @@ public interface EnterpriseUserRoleMapper {
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
Boolean insertBatchUserRole(@Param("eid") String enterpriseId, @Param("userRoles") List<EnterpriseUserRole> userRoles);
|
Boolean insertBatchUserRole(@Param("eid") String enterpriseId, @Param("userRoles") List<EnterpriseUserRole> userRoles);
|
||||||
|
|
||||||
|
List<UserRoleDTO> getUserAndRolesByUserId(@Param("eip") String enterpriseId, @Param("userIdList") List<String> userIdList);
|
||||||
|
|
||||||
|
List<SysRoleDO> listRoleByUserId(@Param("eip") String enterpriseId, @Param("userId") String userId);
|
||||||
}
|
}
|
||||||
@@ -37,4 +37,8 @@ public interface RegionMapper {
|
|||||||
Integer batchInsertRegionsByDepartments(@Param("eid") String eid, @Param("regions") List<RegionDO> regions);
|
Integer batchInsertRegionsByDepartments(@Param("eid") String eid, @Param("regions") List<RegionDO> regions);
|
||||||
|
|
||||||
List<RegionDO> selectRegionBySynDingDeptIds(@Param("eid") String eid, @Param("synDingDeptIds") List<String> synDingDeptIds);
|
List<RegionDO> selectRegionBySynDingDeptIds(@Param("eid") String eid, @Param("synDingDeptIds") List<String> synDingDeptIds);
|
||||||
|
|
||||||
|
List<RegionDO> getAllRegion(@Param("eid") String eid);
|
||||||
|
|
||||||
|
List<RegionDO> listStoreRegionByIds(@Param("eid")String enterpriseId, @Param("regionIds")List<Long> regionIds);
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,38 @@
|
|||||||
|
package com.cool.store.mapper;
|
||||||
|
|
||||||
|
import com.cool.store.dto.store.StoreAreaDTO;
|
||||||
|
import com.cool.store.entity.StoreDO;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author zhangchenbiao
|
||||||
|
* @date 2023-05-31 11:51
|
||||||
|
*/
|
||||||
|
public interface StoreMapper {
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* 默认插入方法,只会给有值的字段赋值
|
||||||
|
* 会对传进来的字段做判空处理,如果字段为空,则使用数据库默认字段或者null
|
||||||
|
* dateTime:2023-05-31 11:51
|
||||||
|
*/
|
||||||
|
int insertSelective(@Param("record") StoreDO record, @Param("enterpriseId") String enterpriseId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* 默认更新方法,根据主键更新,不会把null值更新到数据库,避免覆盖之前有值的
|
||||||
|
* dateTime:2023-05-31 11:51
|
||||||
|
*/
|
||||||
|
int updateByPrimaryKeySelective(@Param("record") StoreDO record, @Param("enterpriseId") String enterpriseId);
|
||||||
|
|
||||||
|
List<StoreAreaDTO> listStoreByRegionIdList(@Param("eid") String eid, @Param("regionIdList") List<String> regionIdList);
|
||||||
|
|
||||||
|
List<StoreDO> getStoreListByStoreIds(@Param("enterpriseId") String enterpriseId, @Param("storeIdList") List<String> storeIdList);
|
||||||
|
|
||||||
|
List<StoreAreaDTO> listStoreByRegionIdListNotChild(@Param("eid") String eid, @Param("regionIdList") List<String> regionIdList);
|
||||||
|
|
||||||
|
Integer countStore(@Param("eid") String eid);
|
||||||
|
|
||||||
|
List<String> listStoreIdList(@Param("eid") String eid);
|
||||||
|
}
|
||||||
@@ -0,0 +1,43 @@
|
|||||||
|
package com.cool.store.mapper;
|
||||||
|
|
||||||
|
import com.cool.store.entity.SubordinateMappingDO;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author zhangchenbiao
|
||||||
|
* @date 2023-05-31 02:27
|
||||||
|
*/
|
||||||
|
public interface SubordinateMappingMapper {
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* 默认插入方法,只会给有值的字段赋值
|
||||||
|
* 会对传进来的字段做判空处理,如果字段为空,则使用数据库默认字段或者null
|
||||||
|
* dateTime:2023-05-31 02:27
|
||||||
|
*/
|
||||||
|
int insertSelective(@Param("record") SubordinateMappingDO record, @Param("enterpriseId") String enterpriseId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* 默认更新方法,根据主键更新,不会把null值更新到数据库,避免覆盖之前有值的
|
||||||
|
* dateTime:2023-05-31 02:27
|
||||||
|
*/
|
||||||
|
int updateByPrimaryKeySelective(@Param("record") SubordinateMappingDO record, @Param("enterpriseId") String enterpriseId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据用户ids查询直属上级列表
|
||||||
|
* @param enterpriseId
|
||||||
|
* @param userIds
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
List<SubordinateMappingDO> selectByUserIds(@Param("enterpriseId") String enterpriseId, @Param("userIds") List<String> userIds);
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量新增用户的下属部门
|
||||||
|
* @param enterpriseId
|
||||||
|
* @param subordinateMappingDOS
|
||||||
|
*/
|
||||||
|
void batchInsertSubordinateMapping(@Param("enterpriseId") String enterpriseId,@Param("subordinateMappingDOS") List<SubordinateMappingDO> subordinateMappingDOS);
|
||||||
|
}
|
||||||
@@ -3,6 +3,8 @@ package com.cool.store.mapper;
|
|||||||
import com.cool.store.entity.UserAuthMappingDO;
|
import com.cool.store.entity.UserAuthMappingDO;
|
||||||
import org.apache.ibatis.annotations.Param;
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author zhangchenbiao
|
* @author zhangchenbiao
|
||||||
* @date 2023-05-19 02:54
|
* @date 2023-05-19 02:54
|
||||||
@@ -22,4 +24,9 @@ public interface UserAuthMappingMapper {
|
|||||||
* dateTime:2023-05-19 02:54
|
* dateTime:2023-05-19 02:54
|
||||||
*/
|
*/
|
||||||
int updateByPrimaryKeySelective(@Param("record") UserAuthMappingDO record, @Param("enterpriseId") String enterpriseId);
|
int updateByPrimaryKeySelective(@Param("record") UserAuthMappingDO record, @Param("enterpriseId") String enterpriseId);
|
||||||
|
|
||||||
|
List<UserAuthMappingDO> listUserAuthMappingByUserId(@Param("eid") String eid, @Param("userId") String userId);
|
||||||
|
|
||||||
|
List<UserAuthMappingDO> listUserAuthMappingByUserIds(@Param("eid") String eid,
|
||||||
|
@Param("userIds") List<String> userIds);
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,184 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
|
<mapper namespace="com.cool.store.mapper.EnterpriseUserGroupMapper">
|
||||||
|
<resultMap id="BaseResultMap" type="com.cool.store.entity.EnterpriseUserGroupDO">
|
||||||
|
<id column="id" jdbcType="BIGINT" property="id"/>
|
||||||
|
<result column="group_id" jdbcType="VARCHAR" property="groupId"/>
|
||||||
|
<result column="group_name" jdbcType="VARCHAR" property="groupName"/>
|
||||||
|
<result column="create_time" jdbcType="TIMESTAMP" property="createTime"/>
|
||||||
|
<result column="create_user_id" jdbcType="VARCHAR" property="createUserId"/>
|
||||||
|
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime"/>
|
||||||
|
<result column="update_user_id" jdbcType="VARCHAR" property="updateUserId"/>
|
||||||
|
<result column="deleted" jdbcType="BIT" property="deleted"/>
|
||||||
|
</resultMap>
|
||||||
|
<resultMap extends="BaseResultMap" id="ResultMapWithBLOBs" type="com.cool.store.entity.EnterpriseUserGroupDO">
|
||||||
|
<result column="common_edit_userids" jdbcType="LONGVARCHAR" property="commonEditUserids"/>
|
||||||
|
</resultMap>
|
||||||
|
<sql id="Base_Column_List">
|
||||||
|
id, group_id, group_name, create_time, create_user_id, update_time, update_user_id,
|
||||||
|
deleted
|
||||||
|
</sql>
|
||||||
|
<sql id="Blob_Column_List">
|
||||||
|
common_edit_userids
|
||||||
|
</sql>
|
||||||
|
<insert id="insertSelective" keyColumn="id" keyProperty="record.id" useGeneratedKeys="true">
|
||||||
|
insert into enterprise_user_group_${enterpriseId}
|
||||||
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||||
|
<if test="record.groupId != null">
|
||||||
|
group_id,
|
||||||
|
</if>
|
||||||
|
<if test="record.groupName != null">
|
||||||
|
group_name,
|
||||||
|
</if>
|
||||||
|
<if test="record.createTime != null">
|
||||||
|
create_time,
|
||||||
|
</if>
|
||||||
|
<if test="record.createUserId != null">
|
||||||
|
create_user_id,
|
||||||
|
</if>
|
||||||
|
<if test="record.updateTime != null">
|
||||||
|
update_time,
|
||||||
|
</if>
|
||||||
|
<if test="record.updateUserId != null">
|
||||||
|
update_user_id,
|
||||||
|
</if>
|
||||||
|
<if test="record.deleted != null">
|
||||||
|
deleted,
|
||||||
|
</if>
|
||||||
|
<if test="record.commonEditUserids != null">
|
||||||
|
common_edit_userids,
|
||||||
|
</if>
|
||||||
|
</trim>
|
||||||
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||||
|
<if test="record.groupId != null">
|
||||||
|
#{record.groupId},
|
||||||
|
</if>
|
||||||
|
<if test="record.groupName != null">
|
||||||
|
#{record.groupName},
|
||||||
|
</if>
|
||||||
|
<if test="record.createTime != null">
|
||||||
|
#{record.createTime},
|
||||||
|
</if>
|
||||||
|
<if test="record.createUserId != null">
|
||||||
|
#{record.createUserId},
|
||||||
|
</if>
|
||||||
|
<if test="record.updateTime != null">
|
||||||
|
#{record.updateTime},
|
||||||
|
</if>
|
||||||
|
<if test="record.updateUserId != null">
|
||||||
|
#{record.updateUserId},
|
||||||
|
</if>
|
||||||
|
<if test="record.deleted != null">
|
||||||
|
#{record.deleted},
|
||||||
|
</if>
|
||||||
|
<if test="record.commonEditUserids != null">
|
||||||
|
#{record.commonEditUserids},
|
||||||
|
</if>
|
||||||
|
</trim>
|
||||||
|
</insert>
|
||||||
|
<update id="updateByPrimaryKeySelective">
|
||||||
|
update enterprise_user_group_${enterpriseId}
|
||||||
|
<set>
|
||||||
|
<if test="record.groupId != null">
|
||||||
|
group_id = #{record.groupId},
|
||||||
|
</if>
|
||||||
|
<if test="record.groupName != null">
|
||||||
|
group_name = #{record.groupName},
|
||||||
|
</if>
|
||||||
|
<if test="record.createTime != null">
|
||||||
|
create_time = #{record.createTime},
|
||||||
|
</if>
|
||||||
|
<if test="record.createUserId != null">
|
||||||
|
create_user_id = #{record.createUserId},
|
||||||
|
</if>
|
||||||
|
<if test="record.updateTime != null">
|
||||||
|
update_time = #{record.updateTime},
|
||||||
|
</if>
|
||||||
|
<if test="record.updateUserId != null">
|
||||||
|
update_user_id = #{record.updateUserId},
|
||||||
|
</if>
|
||||||
|
<if test="record.deleted != null">
|
||||||
|
deleted = #{record.deleted},
|
||||||
|
</if>
|
||||||
|
<if test="record.commonEditUserids != null">
|
||||||
|
common_edit_userids = #{record.commonEditUserids},
|
||||||
|
</if>
|
||||||
|
</set>
|
||||||
|
where id = #{record.id}
|
||||||
|
</update>
|
||||||
|
<select id="countByGroupName" resultType="int">
|
||||||
|
select count(1)
|
||||||
|
from enterprise_user_group_${enterpriseId}
|
||||||
|
where group_name = #{groupName}
|
||||||
|
<if test="groupId != null">
|
||||||
|
and group_id != #{groupId}
|
||||||
|
</if>
|
||||||
|
and deleted = 0
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<delete id="deleteByGroupIdList">
|
||||||
|
delete from enterprise_user_group_${enterpriseId}
|
||||||
|
where group_id in
|
||||||
|
<foreach collection="groupIdList" item="groupId" open="(" separator="," close=")">
|
||||||
|
#{groupId}
|
||||||
|
</foreach>
|
||||||
|
</delete>
|
||||||
|
|
||||||
|
<select id="listUserGroup" resultMap="BaseResultMap">
|
||||||
|
select
|
||||||
|
<include refid="Base_Column_List"/>
|
||||||
|
from enterprise_user_group_${enterpriseId}
|
||||||
|
<if test="groupName != null and groupName !=''">
|
||||||
|
where group_name like concat('%',#{groupName},'%')
|
||||||
|
</if>
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="getByGroupId" resultMap="BaseResultMap">
|
||||||
|
select
|
||||||
|
<include refid="Base_Column_List"/>
|
||||||
|
from enterprise_user_group_${enterpriseId}
|
||||||
|
where group_id = #{groupId}
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="listByGroupIdList" resultMap="BaseResultMap">
|
||||||
|
select
|
||||||
|
<include refid="Base_Column_List"/>
|
||||||
|
from enterprise_user_group_${enterpriseId}
|
||||||
|
where group_id in
|
||||||
|
<foreach collection="groupIdList" item="groupId" open="(" separator="," close=")">
|
||||||
|
#{groupId}
|
||||||
|
</foreach>
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<update id="updateByGroupId">
|
||||||
|
update enterprise_user_group_${enterpriseId}
|
||||||
|
<set>
|
||||||
|
<if test="record.groupId != null">
|
||||||
|
group_id = #{record.groupId},
|
||||||
|
</if>
|
||||||
|
<if test="record.groupName != null">
|
||||||
|
group_name = #{record.groupName},
|
||||||
|
</if>
|
||||||
|
<if test="record.commonEditUserids != null">
|
||||||
|
common_edit_userids = #{record.commonEditUserids},
|
||||||
|
</if>
|
||||||
|
<if test="record.createTime != null">
|
||||||
|
create_time = #{record.createTime},
|
||||||
|
</if>
|
||||||
|
<if test="record.createUserId != null">
|
||||||
|
create_user_id = #{record.createUserId},
|
||||||
|
</if>
|
||||||
|
<if test="record.updateTime != null">
|
||||||
|
update_time = #{record.updateTime},
|
||||||
|
</if>
|
||||||
|
<if test="record.updateUserId != null">
|
||||||
|
update_user_id = #{record.updateUserId},
|
||||||
|
</if>
|
||||||
|
<if test="record.deleted != null">
|
||||||
|
deleted = #{record.deleted},
|
||||||
|
</if>
|
||||||
|
</set>
|
||||||
|
where group_id = #{record.groupId}
|
||||||
|
</update>
|
||||||
|
|
||||||
|
</mapper>
|
||||||
@@ -0,0 +1,181 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
|
<mapper namespace="com.cool.store.mapper.EnterpriseUserGroupMappingMapper">
|
||||||
|
<resultMap id="BaseResultMap" type="com.cool.store.entity.EnterpriseUserGroupMappingDO">
|
||||||
|
<id column="id" jdbcType="BIGINT" property="id"/>
|
||||||
|
<result column="user_id" jdbcType="VARCHAR" property="userId"/>
|
||||||
|
<result column="group_id" jdbcType="VARCHAR" property="groupId"/>
|
||||||
|
<result column="create_time" jdbcType="TIMESTAMP" property="createTime"/>
|
||||||
|
<result column="create_user_id" jdbcType="VARCHAR" property="createUserId"/>
|
||||||
|
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime"/>
|
||||||
|
<result column="update_user_id" jdbcType="VARCHAR" property="updateUserId"/>
|
||||||
|
<result column="deleted" jdbcType="BIT" property="deleted"/>
|
||||||
|
</resultMap>
|
||||||
|
<sql id="Base_Column_List">
|
||||||
|
id, user_id, group_id, create_time, create_user_id, update_time, update_user_id,
|
||||||
|
deleted
|
||||||
|
</sql>
|
||||||
|
<insert id="insertSelective" keyColumn="id" keyProperty="record.id" useGeneratedKeys="true">
|
||||||
|
insert into enterprise_user_group_mapping_${enterpriseId}
|
||||||
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||||
|
<if test="record.userId != null">
|
||||||
|
user_id,
|
||||||
|
</if>
|
||||||
|
<if test="record.groupId != null">
|
||||||
|
group_id,
|
||||||
|
</if>
|
||||||
|
<if test="record.createTime != null">
|
||||||
|
create_time,
|
||||||
|
</if>
|
||||||
|
<if test="record.createUserId != null">
|
||||||
|
create_user_id,
|
||||||
|
</if>
|
||||||
|
<if test="record.updateTime != null">
|
||||||
|
update_time,
|
||||||
|
</if>
|
||||||
|
<if test="record.updateUserId != null">
|
||||||
|
update_user_id,
|
||||||
|
</if>
|
||||||
|
<if test="record.deleted != null">
|
||||||
|
deleted,
|
||||||
|
</if>
|
||||||
|
</trim>
|
||||||
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||||
|
<if test="record.userId != null">
|
||||||
|
#{record.userId},
|
||||||
|
</if>
|
||||||
|
<if test="record.groupId != null">
|
||||||
|
#{record.groupId},
|
||||||
|
</if>
|
||||||
|
<if test="record.createTime != null">
|
||||||
|
#{record.createTime},
|
||||||
|
</if>
|
||||||
|
<if test="record.createUserId != null">
|
||||||
|
#{record.createUserId},
|
||||||
|
</if>
|
||||||
|
<if test="record.updateTime != null">
|
||||||
|
#{record.updateTime},
|
||||||
|
</if>
|
||||||
|
<if test="record.updateUserId != null">
|
||||||
|
#{record.updateUserId},
|
||||||
|
</if>
|
||||||
|
<if test="record.deleted != null">
|
||||||
|
#{record.deleted},
|
||||||
|
</if>
|
||||||
|
</trim>
|
||||||
|
</insert>
|
||||||
|
<update id="updateByPrimaryKeySelective">
|
||||||
|
update enterprise_user_group_mapping_${enterpriseId}
|
||||||
|
<set>
|
||||||
|
<if test="record.userId != null">
|
||||||
|
user_id = #{record.userId},
|
||||||
|
</if>
|
||||||
|
<if test="record.groupId != null">
|
||||||
|
group_id = #{record.groupId},
|
||||||
|
</if>
|
||||||
|
<if test="record.createTime != null">
|
||||||
|
create_time = #{record.createTime},
|
||||||
|
</if>
|
||||||
|
<if test="record.createUserId != null">
|
||||||
|
create_user_id = #{record.createUserId},
|
||||||
|
</if>
|
||||||
|
<if test="record.updateTime != null">
|
||||||
|
update_time = #{record.updateTime},
|
||||||
|
</if>
|
||||||
|
<if test="record.updateUserId != null">
|
||||||
|
update_user_id = #{record.updateUserId},
|
||||||
|
</if>
|
||||||
|
<if test="record.deleted != null">
|
||||||
|
deleted = #{record.deleted},
|
||||||
|
</if>
|
||||||
|
</set>
|
||||||
|
where id = #{record.id}
|
||||||
|
</update>
|
||||||
|
|
||||||
|
<delete id="deleteUserGroupMappingByGroupId">
|
||||||
|
delete from enterprise_user_group_mapping_${enterpriseId}
|
||||||
|
where group_id in (#{groupId})
|
||||||
|
</delete>
|
||||||
|
|
||||||
|
<insert id="batchInsertMapping">
|
||||||
|
insert into enterprise_user_group_mapping_${enterpriseId}
|
||||||
|
(
|
||||||
|
group_id,
|
||||||
|
user_id
|
||||||
|
)
|
||||||
|
values
|
||||||
|
<foreach collection="userIdList" separator="," item="userId">
|
||||||
|
(
|
||||||
|
#{groupId},
|
||||||
|
#{userId}
|
||||||
|
)
|
||||||
|
</foreach>
|
||||||
|
</insert>
|
||||||
|
|
||||||
|
<delete id="deleteMappingByGroupIdList">
|
||||||
|
delete from enterprise_user_group_mapping_${enterpriseId}
|
||||||
|
where group_id = #{groupId}
|
||||||
|
<if test="userIdList != null and userIdList.size > 0">
|
||||||
|
<foreach collection="userIdList" open="and user_id in (" close=")" separator="," item="userId">
|
||||||
|
#{userId}
|
||||||
|
</foreach>
|
||||||
|
</if>
|
||||||
|
</delete>
|
||||||
|
|
||||||
|
<delete id="deleteMappingByUserIdList">
|
||||||
|
delete from enterprise_user_group_mapping_${enterpriseId}
|
||||||
|
where user_id in
|
||||||
|
<if test="userIdList != null and userIdList.size > 0">
|
||||||
|
<foreach collection="userIdList" open="(" close=")" separator="," item="userId">
|
||||||
|
#{userId}
|
||||||
|
</foreach>
|
||||||
|
</if>
|
||||||
|
</delete>
|
||||||
|
|
||||||
|
<select id="listByGroupIdList" resultMap="BaseResultMap">
|
||||||
|
select
|
||||||
|
<include refid="Base_Column_List" />
|
||||||
|
from enterprise_user_group_mapping_${enterpriseId}
|
||||||
|
where group_id in (
|
||||||
|
<foreach collection="groupIdList" item="groupId" separator=",">
|
||||||
|
#{groupId}
|
||||||
|
</foreach>
|
||||||
|
)
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="listByUserIdList" resultMap="BaseResultMap">
|
||||||
|
select
|
||||||
|
<include refid="Base_Column_List" />
|
||||||
|
from enterprise_user_group_mapping_${enterpriseId}
|
||||||
|
where user_id in (
|
||||||
|
<foreach collection="userIdList" item="userId" separator=",">
|
||||||
|
#{userId}
|
||||||
|
</foreach>
|
||||||
|
)
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<insert id="batchInsertOrUpdateUserGroupMapping">
|
||||||
|
insert into enterprise_user_group_mapping_${enterpriseId}
|
||||||
|
(
|
||||||
|
user_id,
|
||||||
|
group_id,
|
||||||
|
create_time,
|
||||||
|
create_user_id,
|
||||||
|
update_time,
|
||||||
|
update_user_id
|
||||||
|
)
|
||||||
|
values
|
||||||
|
<foreach collection="userGroupMappingList" item="entity" separator=",">
|
||||||
|
(
|
||||||
|
#{entity.userId},
|
||||||
|
#{entity.groupId},
|
||||||
|
now(),
|
||||||
|
#{entity.createUserId},
|
||||||
|
now(),
|
||||||
|
#{entity.updateUserId}
|
||||||
|
)
|
||||||
|
</foreach>
|
||||||
|
ON DUPLICATE KEY UPDATE
|
||||||
|
update_time = now()
|
||||||
|
</insert>
|
||||||
|
</mapper>
|
||||||
@@ -468,7 +468,6 @@
|
|||||||
jobnumber=values(jobnumber)
|
jobnumber=values(jobnumber)
|
||||||
</insert>
|
</insert>
|
||||||
|
|
||||||
|
|
||||||
<update id="batchUpdateDiffUserDiffRegionIds">
|
<update id="batchUpdateDiffUserDiffRegionIds">
|
||||||
update enterprise_user_${eid}
|
update enterprise_user_${eid}
|
||||||
set user_region_ids =
|
set user_region_ids =
|
||||||
@@ -480,4 +479,195 @@
|
|||||||
#{item.userId}
|
#{item.userId}
|
||||||
</foreach>
|
</foreach>
|
||||||
</update>
|
</update>
|
||||||
|
|
||||||
|
<select id="fuzzyUsersByDepartment" resultType="com.cool.store.entity.EnterpriseUserDO">
|
||||||
|
select
|
||||||
|
u.user_id as userId,
|
||||||
|
u.name as name,
|
||||||
|
u.roles as roles,
|
||||||
|
u.jobnumber as jobnumber,
|
||||||
|
u.remark as remark,
|
||||||
|
u.mobile as mobile,
|
||||||
|
u.email as email,
|
||||||
|
u.org_email as orgEmail,
|
||||||
|
u.avatar as avatar,
|
||||||
|
u.user_status as userStatus,
|
||||||
|
u.unionid as unionid
|
||||||
|
from enterprise_user_${eid} u
|
||||||
|
left join enterprise_user_role_${eid} ul on u.user_id=ul.user_id
|
||||||
|
left join sys_role_${eid} r on ul.role_id=r.id
|
||||||
|
<where>
|
||||||
|
u.active = true and u.user_id != 'a100000001'
|
||||||
|
<if test="deptId !=null and deptId !=''">
|
||||||
|
and u.departments like concat('%/',#{deptId},'/%')
|
||||||
|
</if>
|
||||||
|
<if test="userName !=null and userName !=''">
|
||||||
|
and u.name like concat('%',#{userName},'%')
|
||||||
|
</if>
|
||||||
|
<if test="jobNumber !=null and jobNumber !=''">
|
||||||
|
and u.jobnumber = #{jobNumber}
|
||||||
|
</if>
|
||||||
|
<if test="roleId !=null ">
|
||||||
|
and r.id=#{roleId}
|
||||||
|
</if>
|
||||||
|
<if test="userStatus !=null ">
|
||||||
|
and u.user_status=#{userStatus}
|
||||||
|
</if>
|
||||||
|
<if test="regionId !=null and regionId !=''">
|
||||||
|
and user_region_ids like concat('%/',#{regionId},'/%')
|
||||||
|
</if>
|
||||||
|
<if test="userIdList != null and userIdList.size > 0">
|
||||||
|
and u.user_id in
|
||||||
|
<foreach collection="userIdList" item="userId" separator="," open="(" close=")">
|
||||||
|
#{userId}
|
||||||
|
</foreach>
|
||||||
|
</if>
|
||||||
|
</where>
|
||||||
|
GROUP BY u.user_id
|
||||||
|
<if test="orderBy != null and orderBy != '' ">
|
||||||
|
order by u.${orderBy} ${orderRule}
|
||||||
|
</if>
|
||||||
|
</select>
|
||||||
|
|
||||||
|
|
||||||
|
<select id="fuzzyUsersByNotRole" resultType="com.cool.store.entity.EnterpriseUserDO">
|
||||||
|
select
|
||||||
|
user_id as userId,
|
||||||
|
name as name,
|
||||||
|
jobnumber as jobnumber,
|
||||||
|
remark as remark,
|
||||||
|
mobile as mobile,
|
||||||
|
email as email,
|
||||||
|
org_email as orgEmail,
|
||||||
|
avatar as avatar,
|
||||||
|
roles as roles,
|
||||||
|
departments as departments,
|
||||||
|
user_status as userStatus,
|
||||||
|
unionid
|
||||||
|
from enterprise_user_${eid}
|
||||||
|
<where>
|
||||||
|
active = true and user_id != 'a100000001'
|
||||||
|
<if test="deptId !=null and deptId !=''">
|
||||||
|
and departments like concat('%/',#{deptId},'/%')
|
||||||
|
</if>
|
||||||
|
<if test="userName !=null and userName !=''">
|
||||||
|
and name like concat('%',#{userName},'%')
|
||||||
|
</if>
|
||||||
|
<if test="jobNumber !=null and jobNumber !=''">
|
||||||
|
and jobnumber = #{jobNumber}
|
||||||
|
</if>
|
||||||
|
<if test="userStatus !=null">
|
||||||
|
and user_status = #{userStatus}
|
||||||
|
</if>
|
||||||
|
<if test="regionId !=null and regionId !=''">
|
||||||
|
and user_region_ids like concat('%/',#{regionId},'/%')
|
||||||
|
</if>
|
||||||
|
<if test="userIdList != null and userIdList.size > 0">
|
||||||
|
and user_id in
|
||||||
|
<foreach collection="userIdList" item="userId" separator="," open="(" close=")">
|
||||||
|
#{userId}
|
||||||
|
</foreach>
|
||||||
|
</if>
|
||||||
|
|
||||||
|
</where>
|
||||||
|
ORDER BY user_id
|
||||||
|
<if test="orderBy != null and orderBy != '' ">
|
||||||
|
, ${orderBy}
|
||||||
|
</if>
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="selectUsersByUserIds" resultType="com.cool.store.entity.EnterpriseUserDO">
|
||||||
|
select
|
||||||
|
id,
|
||||||
|
user_id as userId,
|
||||||
|
`name` as name,
|
||||||
|
avatar,
|
||||||
|
active,
|
||||||
|
mobile,
|
||||||
|
jobnumber,
|
||||||
|
`language`,
|
||||||
|
user_status as userStatus,
|
||||||
|
subordinate_range as subordinateRange
|
||||||
|
from enterprise_user_${eid}
|
||||||
|
<where>
|
||||||
|
user_id != 'a100000001'
|
||||||
|
and
|
||||||
|
<if test="userIds.size()>0 and userIds!=null">or
|
||||||
|
user_id in
|
||||||
|
<foreach
|
||||||
|
collection="userIds" item="userId" separator="," open="(" close=")">
|
||||||
|
#{userId, jdbcType=VARCHAR}
|
||||||
|
</foreach>
|
||||||
|
</if>
|
||||||
|
</where>
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="listUserByGroupId" resultType="com.cool.store.entity.EnterpriseUserDO">
|
||||||
|
select
|
||||||
|
u.user_id as userId,
|
||||||
|
u.name as name,
|
||||||
|
u.roles as roles,
|
||||||
|
u.jobnumber as jobnumber,
|
||||||
|
u.mobile as mobile,
|
||||||
|
u.email as email,
|
||||||
|
u.org_email as orgEmail,
|
||||||
|
u.avatar as avatar,
|
||||||
|
u.departments as departments,
|
||||||
|
u.user_status as userStatus,
|
||||||
|
u.unionid as unionid
|
||||||
|
from enterprise_user_${eid} u
|
||||||
|
left join enterprise_user_group_mapping_${eid} ug on u.user_id=ug.user_id
|
||||||
|
<where>
|
||||||
|
ug.group_id = #{groupId} and u.active = true and u.user_id != 'a100000001'
|
||||||
|
<if test="userName !=null and userName !=''">
|
||||||
|
and u.name like concat('%',#{userName},'%')
|
||||||
|
</if>
|
||||||
|
<if test="userIdList != null and userIdList.size > 0">
|
||||||
|
and u.user_id in
|
||||||
|
<foreach collection="userIdList" item="userId" separator="," open="(" close=")">
|
||||||
|
#{userId}
|
||||||
|
</foreach>
|
||||||
|
</if>
|
||||||
|
</where>
|
||||||
|
GROUP BY u.user_id
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="listByRegionIdList" resultType="com.cool.store.entity.EnterpriseUserDO">
|
||||||
|
select
|
||||||
|
id as id,
|
||||||
|
user_id as userId,
|
||||||
|
`name` as name,
|
||||||
|
tel as tel,
|
||||||
|
work_place as workPlace,
|
||||||
|
remark as remark,
|
||||||
|
mobile as mobile,
|
||||||
|
email as email,
|
||||||
|
org_email as orgEmail,
|
||||||
|
active as active,
|
||||||
|
order_in_depts as orderInDepts,
|
||||||
|
is_admin as isAdmin,
|
||||||
|
is_boss as isBoss,
|
||||||
|
dingId as dingId,
|
||||||
|
unionid as unionid,
|
||||||
|
is_leader_in_depts as isLeaderInDepts,
|
||||||
|
is_hide as isHide,
|
||||||
|
`position` as position,
|
||||||
|
avatar as avatar,
|
||||||
|
jobnumber as jobnumber,
|
||||||
|
extattr as extattr,
|
||||||
|
is_enterprise as isEnterprise,
|
||||||
|
roles as roles,
|
||||||
|
monitored_departments as monitoredDepartments,
|
||||||
|
departments as departments,
|
||||||
|
is_leader as isLeader,
|
||||||
|
face_url as faceUrl,
|
||||||
|
create_time as createTime,
|
||||||
|
`language` as language
|
||||||
|
from enterprise_user_${eid} where user_id != 'a100000001'
|
||||||
|
<foreach collection="regionIdList" item="regionId" separator=" or " open="and (" close=" )">
|
||||||
|
user_region_ids like concat('%/', #{regionId}, '/%')
|
||||||
|
</foreach>
|
||||||
|
order by id
|
||||||
|
</select>
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
||||||
@@ -69,4 +69,35 @@
|
|||||||
(#{userRole.roleId}, #{userRole.userId} ,#{userRole.createTime})
|
(#{userRole.roleId}, #{userRole.userId} ,#{userRole.createTime})
|
||||||
</foreach>
|
</foreach>
|
||||||
</insert>
|
</insert>
|
||||||
|
|
||||||
|
<select id="getUserAndRolesByUserId" resultType="com.cool.store.dto.buser.UserRoleDTO">
|
||||||
|
select
|
||||||
|
a.role_id as roleId,
|
||||||
|
a.user_id as userId,
|
||||||
|
b.role_name as roleName,
|
||||||
|
b.role_auth as roleAuth,
|
||||||
|
b.role_enum as roleEnum,
|
||||||
|
b.priority as priority
|
||||||
|
from enterprise_user_role_${eip} a left join sys_role_${eip} b on a.role_id=b.id
|
||||||
|
<where>
|
||||||
|
<if test="userIdList != null and userIdList.size>0">
|
||||||
|
<foreach collection="userIdList" item="userId" separator="," open="a.user_id in (" close=")">
|
||||||
|
#{userId}
|
||||||
|
</foreach>
|
||||||
|
</if>
|
||||||
|
AND b.role_name IS NOT NULL
|
||||||
|
</where>
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="listRoleByUserId" resultType="com.cool.store.entity.SysRoleDO">
|
||||||
|
select
|
||||||
|
c.id as id,
|
||||||
|
c.role_name as roleName,
|
||||||
|
c.role_auth as roleAuth,
|
||||||
|
c.source as source,
|
||||||
|
c.role_enum as roleEnum
|
||||||
|
from enterprise_user_role_${eip} b
|
||||||
|
left join sys_role_${eip} c on c.id = b.role_id
|
||||||
|
where b.user_id = #{userId}
|
||||||
|
</select>
|
||||||
</mapper>
|
</mapper>
|
||||||
@@ -340,4 +340,49 @@
|
|||||||
</foreach>
|
</foreach>
|
||||||
)
|
)
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<select id="getAllRegion" resultType="com.cool.store.entity.RegionDO">
|
||||||
|
select
|
||||||
|
id ,
|
||||||
|
id as regionId,
|
||||||
|
name ,
|
||||||
|
parent_id as parentId,
|
||||||
|
group_id as groupId,
|
||||||
|
create_time as createTime,
|
||||||
|
create_name as createName,
|
||||||
|
update_time as updateTime,
|
||||||
|
update_name as updateName,
|
||||||
|
syn_ding_dept_id as synDingDeptId,
|
||||||
|
region_type as regionType,
|
||||||
|
region_path as regionPath,
|
||||||
|
deleted as deleted,
|
||||||
|
third_dept_id as thirdDeptId
|
||||||
|
from region_${eid}
|
||||||
|
where deleted = 0 and id > 0
|
||||||
|
and region_type != 'store'
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="listStoreRegionByIds" resultType="com.cool.store.entity.RegionDO">
|
||||||
|
select
|
||||||
|
id ,
|
||||||
|
region_id as regionId,
|
||||||
|
name as name ,
|
||||||
|
parent_id as parentId,
|
||||||
|
group_id as groupId,
|
||||||
|
create_time as createTime,
|
||||||
|
create_name as createName,
|
||||||
|
update_time as updateTime,
|
||||||
|
update_name as updateName,
|
||||||
|
syn_ding_dept_id as synDingDeptId,
|
||||||
|
region_type as regionType,
|
||||||
|
deleted as deleted,
|
||||||
|
store_id as storeId
|
||||||
|
from region_${eid}
|
||||||
|
where region_type = 'store'
|
||||||
|
and id in (
|
||||||
|
<foreach collection="regionIds" item="item" separator=",">
|
||||||
|
#{item}
|
||||||
|
</foreach>
|
||||||
|
)
|
||||||
|
</select>
|
||||||
</mapper>
|
</mapper>
|
||||||
454
coolstore-partner-dao/src/main/resources/mapper/StoreMapper.xml
Normal file
454
coolstore-partner-dao/src/main/resources/mapper/StoreMapper.xml
Normal file
@@ -0,0 +1,454 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
|
<mapper namespace="com.cool.store.mapper.StoreMapper">
|
||||||
|
<resultMap id="BaseResultMap" type="com.cool.store.entity.StoreDO">
|
||||||
|
<id column="id" jdbcType="BIGINT" property="id"/>
|
||||||
|
<result column="store_id" jdbcType="VARCHAR" property="storeId"/>
|
||||||
|
<result column="store_name" jdbcType="VARCHAR" property="storeName"/>
|
||||||
|
<result column="store_num" jdbcType="VARCHAR" property="storeNum"/>
|
||||||
|
<result column="avatar" jdbcType="VARCHAR" property="avatar"/>
|
||||||
|
<result column="ding_id" jdbcType="VARCHAR" property="dingId"/>
|
||||||
|
<result column="region_id" jdbcType="BIGINT" property="regionId"/>
|
||||||
|
<result column="province" jdbcType="VARCHAR" property="province"/>
|
||||||
|
<result column="city" jdbcType="VARCHAR" property="city"/>
|
||||||
|
<result column="county" jdbcType="VARCHAR" property="county"/>
|
||||||
|
<result column="store_address" jdbcType="VARCHAR" property="storeAddress"/>
|
||||||
|
<result column="location_address" jdbcType="VARCHAR" property="locationAddress"/>
|
||||||
|
<result column="is_lock" jdbcType="CHAR" property="isLock"/>
|
||||||
|
<result column="longitude_latitude" jdbcType="VARCHAR" property="longitudeLatitude"/>
|
||||||
|
<result column="longitude" jdbcType="VARCHAR" property="longitude"/>
|
||||||
|
<result column="latitude" jdbcType="VARCHAR" property="latitude"/>
|
||||||
|
<result column="is_delete" jdbcType="CHAR" property="isDelete"/>
|
||||||
|
<result column="telephone" jdbcType="VARCHAR" property="telephone"/>
|
||||||
|
<result column="business_hours" jdbcType="VARCHAR" property="businessHours"/>
|
||||||
|
<result column="store_acreage" jdbcType="VARCHAR" property="storeAcreage"/>
|
||||||
|
<result column="store_bandwidth" jdbcType="VARCHAR" property="storeBandwidth"/>
|
||||||
|
<result column="create_time" jdbcType="BIGINT" property="createTime"/>
|
||||||
|
<result column="create_name" jdbcType="VARCHAR" property="createName"/>
|
||||||
|
<result column="create_user" jdbcType="VARCHAR" property="createUser"/>
|
||||||
|
<result column="update_time" jdbcType="BIGINT" property="updateTime"/>
|
||||||
|
<result column="update_name" jdbcType="VARCHAR" property="updateName"/>
|
||||||
|
<result column="update_user" jdbcType="VARCHAR" property="updateUser"/>
|
||||||
|
<result column="aliyun_corp_id" jdbcType="VARCHAR" property="aliyunCorpId"/>
|
||||||
|
<result column="source" jdbcType="VARCHAR" property="source"/>
|
||||||
|
<result column="vds_corp_id" jdbcType="VARCHAR" property="vdsCorpId"/>
|
||||||
|
<result column="syn_ding_dept_id" jdbcType="VARCHAR" property="synDingDeptId"/>
|
||||||
|
<result column="region_path" jdbcType="VARCHAR" property="regionPath"/>
|
||||||
|
<result column="has_camera" jdbcType="BIT" property="hasCamera"/>
|
||||||
|
<result column="store_status" jdbcType="CHAR" property="storeStatus"/>
|
||||||
|
<result column="third_dept_id" jdbcType="VARCHAR" property="thirdDeptId"/>
|
||||||
|
</resultMap>
|
||||||
|
<resultMap extends="BaseResultMap" id="ResultMapWithBLOBs" type="com.cool.store.entity.StoreDO">
|
||||||
|
<result column="remark" jdbcType="LONGVARCHAR" property="remark"/>
|
||||||
|
<result column="extend_field" jdbcType="LONGVARCHAR" property="extendField"/>
|
||||||
|
<result column="address_point" jdbcType="BINARY" property="addressPoint"/>
|
||||||
|
</resultMap>
|
||||||
|
<sql id="Base_Column_List">
|
||||||
|
id, store_id, store_name, store_num, avatar, ding_id, region_id, province, city,
|
||||||
|
county, store_address, location_address, is_lock, longitude_latitude, longitude,
|
||||||
|
latitude, is_delete, telephone, business_hours, store_acreage, store_bandwidth, create_time,
|
||||||
|
create_name, create_user, update_time, update_name, update_user, aliyun_corp_id,
|
||||||
|
source, vds_corp_id, syn_ding_dept_id, region_path, has_camera, store_status, third_dept_id
|
||||||
|
</sql>
|
||||||
|
<sql id="Blob_Column_List">
|
||||||
|
remark, extend_field, address_point
|
||||||
|
</sql>
|
||||||
|
<insert id="insertSelective" keyColumn="id" keyProperty="record.id" useGeneratedKeys="true">
|
||||||
|
insert into store_${enterpriseId}
|
||||||
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||||
|
<if test="record.storeId != null">
|
||||||
|
store_id,
|
||||||
|
</if>
|
||||||
|
<if test="record.storeName != null">
|
||||||
|
store_name,
|
||||||
|
</if>
|
||||||
|
<if test="record.storeNum != null">
|
||||||
|
store_num,
|
||||||
|
</if>
|
||||||
|
<if test="record.avatar != null">
|
||||||
|
avatar,
|
||||||
|
</if>
|
||||||
|
<if test="record.dingId != null">
|
||||||
|
ding_id,
|
||||||
|
</if>
|
||||||
|
<if test="record.regionId != null">
|
||||||
|
region_id,
|
||||||
|
</if>
|
||||||
|
<if test="record.province != null">
|
||||||
|
province,
|
||||||
|
</if>
|
||||||
|
<if test="record.city != null">
|
||||||
|
city,
|
||||||
|
</if>
|
||||||
|
<if test="record.county != null">
|
||||||
|
county,
|
||||||
|
</if>
|
||||||
|
<if test="record.storeAddress != null">
|
||||||
|
store_address,
|
||||||
|
</if>
|
||||||
|
<if test="record.locationAddress != null">
|
||||||
|
location_address,
|
||||||
|
</if>
|
||||||
|
<if test="record.isLock != null">
|
||||||
|
is_lock,
|
||||||
|
</if>
|
||||||
|
<if test="record.longitudeLatitude != null">
|
||||||
|
longitude_latitude,
|
||||||
|
</if>
|
||||||
|
<if test="record.longitude != null">
|
||||||
|
longitude,
|
||||||
|
</if>
|
||||||
|
<if test="record.latitude != null">
|
||||||
|
latitude,
|
||||||
|
</if>
|
||||||
|
<if test="record.isDelete != null">
|
||||||
|
is_delete,
|
||||||
|
</if>
|
||||||
|
<if test="record.telephone != null">
|
||||||
|
telephone,
|
||||||
|
</if>
|
||||||
|
<if test="record.businessHours != null">
|
||||||
|
business_hours,
|
||||||
|
</if>
|
||||||
|
<if test="record.storeAcreage != null">
|
||||||
|
store_acreage,
|
||||||
|
</if>
|
||||||
|
<if test="record.storeBandwidth != null">
|
||||||
|
store_bandwidth,
|
||||||
|
</if>
|
||||||
|
<if test="record.createTime != null">
|
||||||
|
create_time,
|
||||||
|
</if>
|
||||||
|
<if test="record.createName != null">
|
||||||
|
create_name,
|
||||||
|
</if>
|
||||||
|
<if test="record.createUser != null">
|
||||||
|
create_user,
|
||||||
|
</if>
|
||||||
|
<if test="record.updateTime != null">
|
||||||
|
update_time,
|
||||||
|
</if>
|
||||||
|
<if test="record.updateName != null">
|
||||||
|
update_name,
|
||||||
|
</if>
|
||||||
|
<if test="record.updateUser != null">
|
||||||
|
update_user,
|
||||||
|
</if>
|
||||||
|
<if test="record.aliyunCorpId != null">
|
||||||
|
aliyun_corp_id,
|
||||||
|
</if>
|
||||||
|
<if test="record.source != null">
|
||||||
|
source,
|
||||||
|
</if>
|
||||||
|
<if test="record.vdsCorpId != null">
|
||||||
|
vds_corp_id,
|
||||||
|
</if>
|
||||||
|
<if test="record.synDingDeptId != null">
|
||||||
|
syn_ding_dept_id,
|
||||||
|
</if>
|
||||||
|
<if test="record.regionPath != null">
|
||||||
|
region_path,
|
||||||
|
</if>
|
||||||
|
<if test="record.hasCamera != null">
|
||||||
|
has_camera,
|
||||||
|
</if>
|
||||||
|
<if test="record.storeStatus != null">
|
||||||
|
store_status,
|
||||||
|
</if>
|
||||||
|
<if test="record.thirdDeptId != null">
|
||||||
|
third_dept_id,
|
||||||
|
</if>
|
||||||
|
<if test="record.remark != null">
|
||||||
|
remark,
|
||||||
|
</if>
|
||||||
|
<if test="record.extendField != null">
|
||||||
|
extend_field,
|
||||||
|
</if>
|
||||||
|
<if test="record.addressPoint != null">
|
||||||
|
address_point,
|
||||||
|
</if>
|
||||||
|
</trim>
|
||||||
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||||
|
<if test="record.storeId != null">
|
||||||
|
#{record.storeId},
|
||||||
|
</if>
|
||||||
|
<if test="record.storeName != null">
|
||||||
|
#{record.storeName},
|
||||||
|
</if>
|
||||||
|
<if test="record.storeNum != null">
|
||||||
|
#{record.storeNum},
|
||||||
|
</if>
|
||||||
|
<if test="record.avatar != null">
|
||||||
|
#{record.avatar},
|
||||||
|
</if>
|
||||||
|
<if test="record.dingId != null">
|
||||||
|
#{record.dingId},
|
||||||
|
</if>
|
||||||
|
<if test="record.regionId != null">
|
||||||
|
#{record.regionId},
|
||||||
|
</if>
|
||||||
|
<if test="record.province != null">
|
||||||
|
#{record.province},
|
||||||
|
</if>
|
||||||
|
<if test="record.city != null">
|
||||||
|
#{record.city},
|
||||||
|
</if>
|
||||||
|
<if test="record.county != null">
|
||||||
|
#{record.county},
|
||||||
|
</if>
|
||||||
|
<if test="record.storeAddress != null">
|
||||||
|
#{record.storeAddress},
|
||||||
|
</if>
|
||||||
|
<if test="record.locationAddress != null">
|
||||||
|
#{record.locationAddress},
|
||||||
|
</if>
|
||||||
|
<if test="record.isLock != null">
|
||||||
|
#{record.isLock},
|
||||||
|
</if>
|
||||||
|
<if test="record.longitudeLatitude != null">
|
||||||
|
#{record.longitudeLatitude},
|
||||||
|
</if>
|
||||||
|
<if test="record.longitude != null">
|
||||||
|
#{record.longitude},
|
||||||
|
</if>
|
||||||
|
<if test="record.latitude != null">
|
||||||
|
#{record.latitude},
|
||||||
|
</if>
|
||||||
|
<if test="record.isDelete != null">
|
||||||
|
#{record.isDelete},
|
||||||
|
</if>
|
||||||
|
<if test="record.telephone != null">
|
||||||
|
#{record.telephone},
|
||||||
|
</if>
|
||||||
|
<if test="record.businessHours != null">
|
||||||
|
#{record.businessHours},
|
||||||
|
</if>
|
||||||
|
<if test="record.storeAcreage != null">
|
||||||
|
#{record.storeAcreage},
|
||||||
|
</if>
|
||||||
|
<if test="record.storeBandwidth != null">
|
||||||
|
#{record.storeBandwidth},
|
||||||
|
</if>
|
||||||
|
<if test="record.createTime != null">
|
||||||
|
#{record.createTime},
|
||||||
|
</if>
|
||||||
|
<if test="record.createName != null">
|
||||||
|
#{record.createName},
|
||||||
|
</if>
|
||||||
|
<if test="record.createUser != null">
|
||||||
|
#{record.createUser},
|
||||||
|
</if>
|
||||||
|
<if test="record.updateTime != null">
|
||||||
|
#{record.updateTime},
|
||||||
|
</if>
|
||||||
|
<if test="record.updateName != null">
|
||||||
|
#{record.updateName},
|
||||||
|
</if>
|
||||||
|
<if test="record.updateUser != null">
|
||||||
|
#{record.updateUser},
|
||||||
|
</if>
|
||||||
|
<if test="record.aliyunCorpId != null">
|
||||||
|
#{record.aliyunCorpId},
|
||||||
|
</if>
|
||||||
|
<if test="record.source != null">
|
||||||
|
#{record.source},
|
||||||
|
</if>
|
||||||
|
<if test="record.vdsCorpId != null">
|
||||||
|
#{record.vdsCorpId},
|
||||||
|
</if>
|
||||||
|
<if test="record.synDingDeptId != null">
|
||||||
|
#{record.synDingDeptId},
|
||||||
|
</if>
|
||||||
|
<if test="record.regionPath != null">
|
||||||
|
#{record.regionPath},
|
||||||
|
</if>
|
||||||
|
<if test="record.hasCamera != null">
|
||||||
|
#{record.hasCamera},
|
||||||
|
</if>
|
||||||
|
<if test="record.storeStatus != null">
|
||||||
|
#{record.storeStatus},
|
||||||
|
</if>
|
||||||
|
<if test="record.thirdDeptId != null">
|
||||||
|
#{record.thirdDeptId},
|
||||||
|
</if>
|
||||||
|
<if test="record.remark != null">
|
||||||
|
#{record.remark},
|
||||||
|
</if>
|
||||||
|
<if test="record.extendField != null">
|
||||||
|
#{record.extendField},
|
||||||
|
</if>
|
||||||
|
<if test="record.addressPoint != null">
|
||||||
|
#{record.addressPoint},
|
||||||
|
</if>
|
||||||
|
</trim>
|
||||||
|
</insert>
|
||||||
|
<update id="updateByPrimaryKeySelective">
|
||||||
|
update store_${enterpriseId}
|
||||||
|
<set>
|
||||||
|
<if test="record.storeId != null">
|
||||||
|
store_id = #{record.storeId},
|
||||||
|
</if>
|
||||||
|
<if test="record.storeName != null">
|
||||||
|
store_name = #{record.storeName},
|
||||||
|
</if>
|
||||||
|
<if test="record.storeNum != null">
|
||||||
|
store_num = #{record.storeNum},
|
||||||
|
</if>
|
||||||
|
<if test="record.avatar != null">
|
||||||
|
avatar = #{record.avatar},
|
||||||
|
</if>
|
||||||
|
<if test="record.dingId != null">
|
||||||
|
ding_id = #{record.dingId},
|
||||||
|
</if>
|
||||||
|
<if test="record.regionId != null">
|
||||||
|
region_id = #{record.regionId},
|
||||||
|
</if>
|
||||||
|
<if test="record.province != null">
|
||||||
|
province = #{record.province},
|
||||||
|
</if>
|
||||||
|
<if test="record.city != null">
|
||||||
|
city = #{record.city},
|
||||||
|
</if>
|
||||||
|
<if test="record.county != null">
|
||||||
|
county = #{record.county},
|
||||||
|
</if>
|
||||||
|
<if test="record.storeAddress != null">
|
||||||
|
store_address = #{record.storeAddress},
|
||||||
|
</if>
|
||||||
|
<if test="record.locationAddress != null">
|
||||||
|
location_address = #{record.locationAddress},
|
||||||
|
</if>
|
||||||
|
<if test="record.isLock != null">
|
||||||
|
is_lock = #{record.isLock},
|
||||||
|
</if>
|
||||||
|
<if test="record.longitudeLatitude != null">
|
||||||
|
longitude_latitude = #{record.longitudeLatitude},
|
||||||
|
</if>
|
||||||
|
<if test="record.longitude != null">
|
||||||
|
longitude = #{record.longitude},
|
||||||
|
</if>
|
||||||
|
<if test="record.latitude != null">
|
||||||
|
latitude = #{record.latitude},
|
||||||
|
</if>
|
||||||
|
<if test="record.isDelete != null">
|
||||||
|
is_delete = #{record.isDelete},
|
||||||
|
</if>
|
||||||
|
<if test="record.telephone != null">
|
||||||
|
telephone = #{record.telephone},
|
||||||
|
</if>
|
||||||
|
<if test="record.businessHours != null">
|
||||||
|
business_hours = #{record.businessHours},
|
||||||
|
</if>
|
||||||
|
<if test="record.storeAcreage != null">
|
||||||
|
store_acreage = #{record.storeAcreage},
|
||||||
|
</if>
|
||||||
|
<if test="record.storeBandwidth != null">
|
||||||
|
store_bandwidth = #{record.storeBandwidth},
|
||||||
|
</if>
|
||||||
|
<if test="record.createTime != null">
|
||||||
|
create_time = #{record.createTime},
|
||||||
|
</if>
|
||||||
|
<if test="record.createName != null">
|
||||||
|
create_name = #{record.createName},
|
||||||
|
</if>
|
||||||
|
<if test="record.createUser != null">
|
||||||
|
create_user = #{record.createUser},
|
||||||
|
</if>
|
||||||
|
<if test="record.updateTime != null">
|
||||||
|
update_time = #{record.updateTime},
|
||||||
|
</if>
|
||||||
|
<if test="record.updateName != null">
|
||||||
|
update_name = #{record.updateName},
|
||||||
|
</if>
|
||||||
|
<if test="record.updateUser != null">
|
||||||
|
update_user = #{record.updateUser},
|
||||||
|
</if>
|
||||||
|
<if test="record.aliyunCorpId != null">
|
||||||
|
aliyun_corp_id = #{record.aliyunCorpId},
|
||||||
|
</if>
|
||||||
|
<if test="record.source != null">
|
||||||
|
source = #{record.source},
|
||||||
|
</if>
|
||||||
|
<if test="record.vdsCorpId != null">
|
||||||
|
vds_corp_id = #{record.vdsCorpId},
|
||||||
|
</if>
|
||||||
|
<if test="record.synDingDeptId != null">
|
||||||
|
syn_ding_dept_id = #{record.synDingDeptId},
|
||||||
|
</if>
|
||||||
|
<if test="record.regionPath != null">
|
||||||
|
region_path = #{record.regionPath},
|
||||||
|
</if>
|
||||||
|
<if test="record.hasCamera != null">
|
||||||
|
has_camera = #{record.hasCamera},
|
||||||
|
</if>
|
||||||
|
<if test="record.storeStatus != null">
|
||||||
|
store_status = #{record.storeStatus},
|
||||||
|
</if>
|
||||||
|
<if test="record.thirdDeptId != null">
|
||||||
|
third_dept_id = #{record.thirdDeptId},
|
||||||
|
</if>
|
||||||
|
<if test="record.remark != null">
|
||||||
|
remark = #{record.remark},
|
||||||
|
</if>
|
||||||
|
<if test="record.extendField != null">
|
||||||
|
extend_field = #{record.extendField},
|
||||||
|
</if>
|
||||||
|
<if test="record.addressPoint != null">
|
||||||
|
address_point = #{record.addressPoint},
|
||||||
|
</if>
|
||||||
|
</set>
|
||||||
|
where id = #{record.id}
|
||||||
|
</update>
|
||||||
|
|
||||||
|
<select id="listStoreByRegionIdList" resultType="com.cool.store.dto.store.StoreAreaDTO">
|
||||||
|
select
|
||||||
|
store_name as storeName,
|
||||||
|
store_id as storeId,
|
||||||
|
region_path as regionPath,
|
||||||
|
region_id as areaId,
|
||||||
|
region_id as regionId
|
||||||
|
from store_${eid}
|
||||||
|
where is_delete = 'effective'
|
||||||
|
<foreach collection="regionIdList" item="regionId" separator=" or " open="and (" close=" )">
|
||||||
|
region_path like concat('%/', #{regionId}, '/%')
|
||||||
|
</foreach>
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="getStoreListByStoreIds" resultMap="BaseResultMap">
|
||||||
|
select <include refid="Base_Column_List"/>
|
||||||
|
from store_${enterpriseId}
|
||||||
|
where is_delete = 'effective'
|
||||||
|
and store_id in (
|
||||||
|
<foreach collection="storeIdList" separator="," item="item">
|
||||||
|
#{item}
|
||||||
|
</foreach>
|
||||||
|
)
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="listStoreByRegionIdListNotChild" resultType="com.cool.store.dto.store.StoreAreaDTO">
|
||||||
|
select
|
||||||
|
store_name as storeName,
|
||||||
|
store_id as storeId,
|
||||||
|
region_path as regionPath,
|
||||||
|
region_id as regionId,
|
||||||
|
region_id as areaId
|
||||||
|
from store_${eid}
|
||||||
|
where is_delete = 'effective'
|
||||||
|
<if test="regionIdList != null and regionIdList.size >0 ">
|
||||||
|
and region_id in
|
||||||
|
<foreach collection="regionIdList" item="regionId" separator="," open="(" close=" )">
|
||||||
|
#{regionId,jdbcType=BIGINT}
|
||||||
|
</foreach>
|
||||||
|
</if>
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="countStore" resultType="java.lang.Integer">
|
||||||
|
select count(store_id) from store_${eid}
|
||||||
|
where is_delete ='effective'
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="listStoreIdList" resultType="java.lang.String">
|
||||||
|
select store_id from store_${eid}
|
||||||
|
where is_delete ='effective'
|
||||||
|
</select>
|
||||||
|
</mapper>
|
||||||
@@ -0,0 +1,167 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
|
<mapper namespace="com.cool.store.mapper.SubordinateMappingMapper">
|
||||||
|
<resultMap id="BaseResultMap" type="com.cool.store.entity.SubordinateMappingDO">
|
||||||
|
<id column="id" jdbcType="INTEGER" property="id"/>
|
||||||
|
<result column="user_id" jdbcType="VARCHAR" property="userId"/>
|
||||||
|
<result column="region_id" jdbcType="VARCHAR" property="regionId"/>
|
||||||
|
<result column="personal_id" jdbcType="VARCHAR" property="personalId"/>
|
||||||
|
<result column="type" jdbcType="TINYINT" property="type"/>
|
||||||
|
<result column="create_id" jdbcType="VARCHAR" property="createId"/>
|
||||||
|
<result column="create_time" jdbcType="BIGINT" property="createTime"/>
|
||||||
|
<result column="update_id" jdbcType="VARCHAR" property="updateId"/>
|
||||||
|
<result column="update_time" jdbcType="BIGINT" property="updateTime"/>
|
||||||
|
<result column="user_range" jdbcType="VARCHAR" property="userRange"/>
|
||||||
|
<result column="source" jdbcType="VARCHAR" property="source"/>
|
||||||
|
</resultMap>
|
||||||
|
<sql id="Base_Column_List">
|
||||||
|
id, user_id, region_id, personal_id, type, create_id, create_time, update_id, update_time,
|
||||||
|
user_range, source
|
||||||
|
</sql>
|
||||||
|
<insert id="insertSelective" keyColumn="id" keyProperty="record.id" useGeneratedKeys="true">
|
||||||
|
insert into subordinate_mapping_${enterpriseId}
|
||||||
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||||
|
<if test="record.userId != null">
|
||||||
|
user_id,
|
||||||
|
</if>
|
||||||
|
<if test="record.regionId != null">
|
||||||
|
region_id,
|
||||||
|
</if>
|
||||||
|
<if test="record.personalId != null">
|
||||||
|
personal_id,
|
||||||
|
</if>
|
||||||
|
<if test="record.type != null">
|
||||||
|
type,
|
||||||
|
</if>
|
||||||
|
<if test="record.createId != null">
|
||||||
|
create_id,
|
||||||
|
</if>
|
||||||
|
<if test="record.createTime != null">
|
||||||
|
create_time,
|
||||||
|
</if>
|
||||||
|
<if test="record.updateId != null">
|
||||||
|
update_id,
|
||||||
|
</if>
|
||||||
|
<if test="record.updateTime != null">
|
||||||
|
update_time,
|
||||||
|
</if>
|
||||||
|
<if test="record.userRange != null">
|
||||||
|
user_range,
|
||||||
|
</if>
|
||||||
|
<if test="record.source != null">
|
||||||
|
source,
|
||||||
|
</if>
|
||||||
|
</trim>
|
||||||
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||||
|
<if test="record.userId != null">
|
||||||
|
#{record.userId},
|
||||||
|
</if>
|
||||||
|
<if test="record.regionId != null">
|
||||||
|
#{record.regionId},
|
||||||
|
</if>
|
||||||
|
<if test="record.personalId != null">
|
||||||
|
#{record.personalId},
|
||||||
|
</if>
|
||||||
|
<if test="record.type != null">
|
||||||
|
#{record.type},
|
||||||
|
</if>
|
||||||
|
<if test="record.createId != null">
|
||||||
|
#{record.createId},
|
||||||
|
</if>
|
||||||
|
<if test="record.createTime != null">
|
||||||
|
#{record.createTime},
|
||||||
|
</if>
|
||||||
|
<if test="record.updateId != null">
|
||||||
|
#{record.updateId},
|
||||||
|
</if>
|
||||||
|
<if test="record.updateTime != null">
|
||||||
|
#{record.updateTime},
|
||||||
|
</if>
|
||||||
|
<if test="record.userRange != null">
|
||||||
|
#{record.userRange},
|
||||||
|
</if>
|
||||||
|
<if test="record.source != null">
|
||||||
|
#{record.source},
|
||||||
|
</if>
|
||||||
|
</trim>
|
||||||
|
</insert>
|
||||||
|
<update id="updateByPrimaryKeySelective">
|
||||||
|
update subordinate_mapping_${enterpriseId}
|
||||||
|
<set>
|
||||||
|
<if test="record.userId != null">
|
||||||
|
user_id = #{record.userId},
|
||||||
|
</if>
|
||||||
|
<if test="record.regionId != null">
|
||||||
|
region_id = #{record.regionId},
|
||||||
|
</if>
|
||||||
|
<if test="record.personalId != null">
|
||||||
|
personal_id = #{record.personalId},
|
||||||
|
</if>
|
||||||
|
<if test="record.type != null">
|
||||||
|
type = #{record.type},
|
||||||
|
</if>
|
||||||
|
<if test="record.createId != null">
|
||||||
|
create_id = #{record.createId},
|
||||||
|
</if>
|
||||||
|
<if test="record.createTime != null">
|
||||||
|
create_time = #{record.createTime},
|
||||||
|
</if>
|
||||||
|
<if test="record.updateId != null">
|
||||||
|
update_id = #{record.updateId},
|
||||||
|
</if>
|
||||||
|
<if test="record.updateTime != null">
|
||||||
|
update_time = #{record.updateTime},
|
||||||
|
</if>
|
||||||
|
<if test="record.userRange != null">
|
||||||
|
user_range = #{record.userRange},
|
||||||
|
</if>
|
||||||
|
<if test="record.source != null">
|
||||||
|
source = #{record.source},
|
||||||
|
</if>
|
||||||
|
</set>
|
||||||
|
where id = #{record.id}
|
||||||
|
</update>
|
||||||
|
|
||||||
|
<select id="selectByUserIds" resultMap="BaseResultMap">
|
||||||
|
select
|
||||||
|
<include refid="Base_Column_List"/>
|
||||||
|
from subordinate_mapping_${enterpriseId}
|
||||||
|
where user_id in
|
||||||
|
<foreach collection="userIds" open="(" close=")" separator="," item="userId">
|
||||||
|
#{userId}
|
||||||
|
</foreach>
|
||||||
|
and type = 0
|
||||||
|
</select>
|
||||||
|
|
||||||
|
|
||||||
|
<insert id="batchInsertSubordinateMapping">
|
||||||
|
insert into subordinate_mapping_${enterpriseId}
|
||||||
|
(
|
||||||
|
user_id,
|
||||||
|
region_id,
|
||||||
|
personal_id,
|
||||||
|
`type`,
|
||||||
|
create_id,
|
||||||
|
create_time,
|
||||||
|
update_id,
|
||||||
|
update_time,
|
||||||
|
user_range,
|
||||||
|
source
|
||||||
|
)
|
||||||
|
values
|
||||||
|
<foreach collection="subordinateMappingDOS" item="entity" separator=",">
|
||||||
|
(
|
||||||
|
#{entity.userId},
|
||||||
|
#{entity.regionId},
|
||||||
|
#{entity.personalId},
|
||||||
|
#{entity.type},
|
||||||
|
#{entity.createId},
|
||||||
|
now(),
|
||||||
|
#{entity.updateId},
|
||||||
|
now(),
|
||||||
|
#{entity.userRange},
|
||||||
|
#{entity.source}
|
||||||
|
)
|
||||||
|
</foreach>
|
||||||
|
</insert>
|
||||||
|
</mapper>
|
||||||
@@ -100,4 +100,16 @@
|
|||||||
</set>
|
</set>
|
||||||
where id = #{record.id}
|
where id = #{record.id}
|
||||||
</update>
|
</update>
|
||||||
|
|
||||||
|
<select id="listUserAuthMappingByUserId" resultMap="BaseResultMap">
|
||||||
|
select * from user_auth_mapping_${eid}
|
||||||
|
where user_id=#{userId}
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="listUserAuthMappingByUserIds" resultMap="BaseResultMap">
|
||||||
|
select * from user_auth_mapping_${eid}
|
||||||
|
<foreach collection="userIds" item="userId" open="user_id in (" separator="," close=")">
|
||||||
|
#{userId}
|
||||||
|
</foreach>
|
||||||
|
</select>
|
||||||
</mapper>
|
</mapper>
|
||||||
@@ -3,4 +3,4 @@ jdbc.url = jdbc:mysql://dingpushcoolcollege.mysql.rds.aliyuncs.com:3306/coolcoll
|
|||||||
jdbc.user= coolstore
|
jdbc.user= coolstore
|
||||||
jdbc.password = CSCErYcXniNYm7bT
|
jdbc.password = CSCErYcXniNYm7bT
|
||||||
|
|
||||||
table.name = login_record_e88b6a2bc1334164b54977a4dbfe5d9d
|
table.name = enterprise_user_group_mapping_e88b6a2bc1334164b54977a4dbfe5d9d
|
||||||
@@ -71,7 +71,6 @@
|
|||||||
<orderEntry type="library" name="Maven: com.github.pagehelper:pagehelper-spring-boot-autoconfigure:1.4.6" level="project" />
|
<orderEntry type="library" name="Maven: com.github.pagehelper:pagehelper-spring-boot-autoconfigure:1.4.6" level="project" />
|
||||||
<orderEntry type="library" name="Maven: com.github.pagehelper:pagehelper:5.3.2" level="project" />
|
<orderEntry type="library" name="Maven: com.github.pagehelper:pagehelper:5.3.2" level="project" />
|
||||||
<orderEntry type="library" name="Maven: com.github.jsqlparser:jsqlparser:4.5" level="project" />
|
<orderEntry type="library" name="Maven: com.github.jsqlparser:jsqlparser:4.5" level="project" />
|
||||||
<orderEntry type="library" name="Maven: com.coolstore:coolstore-base:1.5.3" level="project" />
|
|
||||||
<orderEntry type="library" name="Maven: com.google.guava:guava:20.0" level="project" />
|
<orderEntry type="library" name="Maven: com.google.guava:guava:20.0" level="project" />
|
||||||
<orderEntry type="library" name="Maven: com.github.xiaoymin:knife4j-spring-boot-starter:2.0.4" level="project" />
|
<orderEntry type="library" name="Maven: com.github.xiaoymin:knife4j-spring-boot-starter:2.0.4" level="project" />
|
||||||
<orderEntry type="library" name="Maven: com.github.xiaoymin:knife4j-spring-boot-autoconfigure:2.0.4" level="project" />
|
<orderEntry type="library" name="Maven: com.github.xiaoymin:knife4j-spring-boot-autoconfigure:2.0.4" level="project" />
|
||||||
|
|||||||
@@ -0,0 +1,18 @@
|
|||||||
|
package com.cool.store.dto.auth;
|
||||||
|
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* describe:
|
||||||
|
*
|
||||||
|
* @author zhouyiping
|
||||||
|
* @date 2020/12/09
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class AuthRegionStoreDTO {
|
||||||
|
String userId;
|
||||||
|
private List<AuthRegionStoreUserDTO> authRegionStoreUserList;
|
||||||
|
}
|
||||||
@@ -0,0 +1,38 @@
|
|||||||
|
package com.cool.store.dto.auth;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* describe:
|
||||||
|
*
|
||||||
|
* @author zhouyiping
|
||||||
|
* @date 2020/10/10
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class AuthRegionStoreUserDTO {
|
||||||
|
|
||||||
|
private String id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 名称
|
||||||
|
*/
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否是门店
|
||||||
|
*/
|
||||||
|
@JsonProperty("store_flag")
|
||||||
|
private Boolean storeFlag ;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 权限来源 create-数智门店创建 sync-钉钉同步
|
||||||
|
*/
|
||||||
|
private String source;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 门店类型区域对应的 门店id
|
||||||
|
*/
|
||||||
|
@JsonProperty("store_id")
|
||||||
|
private String storeId;
|
||||||
|
}
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
package com.cool.store.dto.auth;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* describe:
|
||||||
|
*
|
||||||
|
* @author zhouyiping
|
||||||
|
* @date 2020/11/17
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class AuthStoreCountDTO {
|
||||||
|
|
||||||
|
private String userId;
|
||||||
|
private List<String> storeList;
|
||||||
|
private Integer storeCount;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,27 @@
|
|||||||
|
package com.cool.store.dto.buser;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author suzhuhong
|
||||||
|
* @Date 2022/2/28 17:27
|
||||||
|
* @Version 1.0
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class MySubordinatesDTO {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 映射ID
|
||||||
|
*/
|
||||||
|
String regionId;
|
||||||
|
|
||||||
|
String regionName;
|
||||||
|
|
||||||
|
String personalId;
|
||||||
|
|
||||||
|
String personalName;
|
||||||
|
/**
|
||||||
|
* 节点类型 区域 人员
|
||||||
|
*/
|
||||||
|
String nodeType;
|
||||||
|
}
|
||||||
@@ -0,0 +1,35 @@
|
|||||||
|
package com.cool.store.dto.buser;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ClassName SubordinateUserRangeDTO
|
||||||
|
* @Description 用户管辖范围
|
||||||
|
* @author wxp
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class SubordinateUserRangeDTO {
|
||||||
|
|
||||||
|
private String userId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 管辖用户范围:self-仅自己,all-全部人员,define-自定义
|
||||||
|
*/
|
||||||
|
private String subordinateUserRange;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* auto自动关联 select手动选择
|
||||||
|
*/
|
||||||
|
private List<String> sourceList;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 我的下属集合
|
||||||
|
*/
|
||||||
|
private List<MySubordinatesDTO> mySubordinates;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
package com.cool.store.dto.buser;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* describe:
|
||||||
|
*
|
||||||
|
* @author zhouyiping
|
||||||
|
* @date 2020/11/06
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class UserRoleDTO {
|
||||||
|
private String userId;
|
||||||
|
private String roleName;
|
||||||
|
private String roleAuth;
|
||||||
|
private Long roleId;
|
||||||
|
private Integer priority;
|
||||||
|
|
||||||
|
private String roleEnum;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,27 @@
|
|||||||
|
package com.cool.store.dto.region;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author 邵凌志
|
||||||
|
* @date 2020/12/22 13:48
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
public class RegionPathDTO {
|
||||||
|
|
||||||
|
private String regionId;
|
||||||
|
|
||||||
|
private String regionPath;
|
||||||
|
|
||||||
|
private Integer storeNum;
|
||||||
|
|
||||||
|
private String regionName;
|
||||||
|
|
||||||
|
private String regionType;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,99 @@
|
|||||||
|
package com.cool.store.dto.response;
|
||||||
|
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* rpc统一返回实体类
|
||||||
|
*
|
||||||
|
* @author byd
|
||||||
|
*/
|
||||||
|
public class ResultDTO<T extends Object> implements Serializable {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = -2217360460304088285L;
|
||||||
|
|
||||||
|
private boolean success = true;
|
||||||
|
/**
|
||||||
|
* 返回码
|
||||||
|
*/
|
||||||
|
private int code;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 返回信息
|
||||||
|
*/
|
||||||
|
private String message;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 返回数据
|
||||||
|
*/
|
||||||
|
private T data;
|
||||||
|
|
||||||
|
public boolean isSuccess() {
|
||||||
|
return success;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSuccess(boolean success) {
|
||||||
|
this.success = success;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getCode() {
|
||||||
|
return code;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCode(int code) {
|
||||||
|
this.code = code;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getMessage() {
|
||||||
|
return message;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMessage(String message) {
|
||||||
|
this.message = message;
|
||||||
|
}
|
||||||
|
|
||||||
|
public T getData() {
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setData(T data) {
|
||||||
|
this.data = data;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ResultDTO() {
|
||||||
|
super();
|
||||||
|
}
|
||||||
|
|
||||||
|
public ResultDTO(T data) {
|
||||||
|
super();
|
||||||
|
this.data = data;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ResultDTO(int code, String message, T data) {
|
||||||
|
this.code = code;
|
||||||
|
this.message = message;
|
||||||
|
this.data = data;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ResultDTO(int code, String message) {
|
||||||
|
this.code = code;
|
||||||
|
this.message = message;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static ResultDTO successResult() {
|
||||||
|
return new ResultDTO(200000, "请求成功");
|
||||||
|
}
|
||||||
|
|
||||||
|
public static ResultDTO successResult(Object data) {
|
||||||
|
return new ResultDTO(200000, "请求成功", data);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static ResultDTO failResult(String msg) {
|
||||||
|
return new ResultDTO(400000, msg);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static ResultDTO failResult(int code, String msg) {
|
||||||
|
return new ResultDTO(code, msg);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,48 @@
|
|||||||
|
package com.cool.store.dto.store;
|
||||||
|
|
||||||
|
import cn.hutool.core.util.StrUtil;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* describe:
|
||||||
|
*
|
||||||
|
* @author zhouyiping
|
||||||
|
* @date 2020/10/22
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class StoreAreaDTO {
|
||||||
|
|
||||||
|
private String storeId;
|
||||||
|
private String storeName;
|
||||||
|
/**
|
||||||
|
* 门店所属区域的全部节点信息
|
||||||
|
*/
|
||||||
|
private String regionPath;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 门店挂靠的区域Id
|
||||||
|
*/
|
||||||
|
private String areaId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 门店的挂挂靠的父节点区域ID
|
||||||
|
*/
|
||||||
|
private List<String> areaIdList;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 所属区域id
|
||||||
|
*/
|
||||||
|
private Long regionId;
|
||||||
|
|
||||||
|
private String storeStatus;
|
||||||
|
|
||||||
|
|
||||||
|
public List<String> getAreaIdList(){
|
||||||
|
return StrUtil.splitTrim(regionPath,"/");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,33 @@
|
|||||||
|
package com.cool.store.dto.usergroup;
|
||||||
|
|
||||||
|
import io.swagger.annotations.ApiModel;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
import org.hibernate.validator.constraints.Length;
|
||||||
|
|
||||||
|
import javax.validation.constraints.NotBlank;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author wxp
|
||||||
|
*/
|
||||||
|
@ApiModel(value = "分组创建")
|
||||||
|
@Data
|
||||||
|
public class UserGroupAddRequest {
|
||||||
|
|
||||||
|
@ApiModelProperty("分组id")
|
||||||
|
private String groupId;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "分组名称", required = true)
|
||||||
|
@NotBlank(message = "分组名称不能为空")
|
||||||
|
@Length(max = 100, message = "名称最多100个字")
|
||||||
|
private String groupName;
|
||||||
|
|
||||||
|
@ApiModelProperty("共同编辑人userId集合")
|
||||||
|
private List<String> commonEditUserIdList;
|
||||||
|
|
||||||
|
@ApiModelProperty("配置用户userId集合")
|
||||||
|
private List<String> userIdList;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,24 @@
|
|||||||
|
package com.cool.store.dto.usergroup;
|
||||||
|
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户分组dto
|
||||||
|
* @ClassName: UserGroupDTO
|
||||||
|
* @Author: wxp
|
||||||
|
* @Date: 2023/1/5 16:04
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class UserGroupDTO {
|
||||||
|
|
||||||
|
@ApiModelProperty("组别id")
|
||||||
|
private String groupId;
|
||||||
|
|
||||||
|
@ApiModelProperty("组别名称")
|
||||||
|
private String groupName;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,47 @@
|
|||||||
|
package com.cool.store.entity;
|
||||||
|
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.Date;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Builder;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author zhangchenbiao
|
||||||
|
* @date 2023-05-31 02:43
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@Builder
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
public class EnterpriseUserGroupDO implements Serializable {
|
||||||
|
@ApiModelProperty("主键")
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
@ApiModelProperty("组别id")
|
||||||
|
private String groupId;
|
||||||
|
|
||||||
|
@ApiModelProperty("组别名称")
|
||||||
|
private String groupName;
|
||||||
|
|
||||||
|
@ApiModelProperty("创建时间")
|
||||||
|
private Date createTime;
|
||||||
|
|
||||||
|
@ApiModelProperty("创建人id")
|
||||||
|
private String createUserId;
|
||||||
|
|
||||||
|
@ApiModelProperty("更新时间")
|
||||||
|
private Date updateTime;
|
||||||
|
|
||||||
|
@ApiModelProperty("更新人")
|
||||||
|
private String updateUserId;
|
||||||
|
|
||||||
|
@ApiModelProperty("删除标识")
|
||||||
|
private Boolean deleted;
|
||||||
|
|
||||||
|
@ApiModelProperty("共同编辑人userId集合(前后逗号分隔)")
|
||||||
|
private String commonEditUserids;
|
||||||
|
}
|
||||||
@@ -0,0 +1,44 @@
|
|||||||
|
package com.cool.store.entity;
|
||||||
|
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.Date;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Builder;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author zhangchenbiao
|
||||||
|
* @date 2023-05-31 02:43
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@Builder
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
public class EnterpriseUserGroupMappingDO implements Serializable {
|
||||||
|
@ApiModelProperty("主键")
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
@ApiModelProperty("用户id")
|
||||||
|
private String userId;
|
||||||
|
|
||||||
|
@ApiModelProperty("组别id")
|
||||||
|
private String groupId;
|
||||||
|
|
||||||
|
@ApiModelProperty("创建时间")
|
||||||
|
private Date createTime;
|
||||||
|
|
||||||
|
@ApiModelProperty("创建人id")
|
||||||
|
private String createUserId;
|
||||||
|
|
||||||
|
@ApiModelProperty("更新时间")
|
||||||
|
private Date updateTime;
|
||||||
|
|
||||||
|
@ApiModelProperty("更新人")
|
||||||
|
private String updateUserId;
|
||||||
|
|
||||||
|
@ApiModelProperty("删除标识")
|
||||||
|
private Boolean deleted;
|
||||||
|
}
|
||||||
@@ -0,0 +1,133 @@
|
|||||||
|
package com.cool.store.entity;
|
||||||
|
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import java.io.Serializable;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Builder;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author zhangchenbiao
|
||||||
|
* @date 2023-05-31 11:51
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@Builder
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
public class StoreDO implements Serializable {
|
||||||
|
@ApiModelProperty("自增ID")
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
@ApiModelProperty("门店ID")
|
||||||
|
private String storeId;
|
||||||
|
|
||||||
|
@ApiModelProperty("门店名称")
|
||||||
|
private String storeName;
|
||||||
|
|
||||||
|
@ApiModelProperty("门店编号")
|
||||||
|
private String storeNum;
|
||||||
|
|
||||||
|
@ApiModelProperty("门头照")
|
||||||
|
private String avatar;
|
||||||
|
|
||||||
|
@ApiModelProperty("钉钉id")
|
||||||
|
private String dingId;
|
||||||
|
|
||||||
|
@ApiModelProperty("所属区域id")
|
||||||
|
private Long regionId;
|
||||||
|
|
||||||
|
@ApiModelProperty("省")
|
||||||
|
private String province;
|
||||||
|
|
||||||
|
@ApiModelProperty("市")
|
||||||
|
private String city;
|
||||||
|
|
||||||
|
@ApiModelProperty("区")
|
||||||
|
private String county;
|
||||||
|
|
||||||
|
@ApiModelProperty("门店地址")
|
||||||
|
private String storeAddress;
|
||||||
|
|
||||||
|
@ApiModelProperty("定位地址")
|
||||||
|
private String locationAddress;
|
||||||
|
|
||||||
|
@ApiModelProperty("锁定定位:locked/锁定,not_locked/未锁定")
|
||||||
|
private String isLock;
|
||||||
|
|
||||||
|
@ApiModelProperty("经纬度")
|
||||||
|
private String longitudeLatitude;
|
||||||
|
|
||||||
|
@ApiModelProperty("经度")
|
||||||
|
private String longitude;
|
||||||
|
|
||||||
|
@ApiModelProperty("纬度")
|
||||||
|
private String latitude;
|
||||||
|
|
||||||
|
@ApiModelProperty("状态:effective/有效,invalid/失效,ignored/不可用, unSync/未同步")
|
||||||
|
private String isDelete;
|
||||||
|
|
||||||
|
@ApiModelProperty("电话号码")
|
||||||
|
private String telephone;
|
||||||
|
|
||||||
|
@ApiModelProperty("营业时间")
|
||||||
|
private String businessHours;
|
||||||
|
|
||||||
|
@ApiModelProperty("门店面积")
|
||||||
|
private String storeAcreage;
|
||||||
|
|
||||||
|
@ApiModelProperty("门店带宽")
|
||||||
|
private String storeBandwidth;
|
||||||
|
|
||||||
|
@ApiModelProperty("创建时间")
|
||||||
|
private Long createTime;
|
||||||
|
|
||||||
|
@ApiModelProperty("创建人")
|
||||||
|
private String createName;
|
||||||
|
|
||||||
|
@ApiModelProperty("创建人id")
|
||||||
|
private String createUser;
|
||||||
|
|
||||||
|
@ApiModelProperty("更新时间")
|
||||||
|
private Long updateTime;
|
||||||
|
|
||||||
|
@ApiModelProperty("更新人")
|
||||||
|
private String updateName;
|
||||||
|
|
||||||
|
@ApiModelProperty("修改人id")
|
||||||
|
private String updateUser;
|
||||||
|
|
||||||
|
@ApiModelProperty("阿里云corpId")
|
||||||
|
private String aliyunCorpId;
|
||||||
|
|
||||||
|
@ApiModelProperty("门店来源")
|
||||||
|
private String source;
|
||||||
|
|
||||||
|
@ApiModelProperty("vds的corpId")
|
||||||
|
private String vdsCorpId;
|
||||||
|
|
||||||
|
@ApiModelProperty("dinging部门id")
|
||||||
|
private String synDingDeptId;
|
||||||
|
|
||||||
|
@ApiModelProperty("区域路径")
|
||||||
|
private String regionPath;
|
||||||
|
|
||||||
|
@ApiModelProperty("是否绑定绑定摄像头,0:未绑定;1:已绑定")
|
||||||
|
private Boolean hasCamera;
|
||||||
|
|
||||||
|
@ApiModelProperty("门店状态(open:营业;closed:闭店;not_open:未开业)")
|
||||||
|
private String storeStatus;
|
||||||
|
|
||||||
|
@ApiModelProperty("第三方唯一id")
|
||||||
|
private String thirdDeptId;
|
||||||
|
|
||||||
|
@ApiModelProperty("备注")
|
||||||
|
private String remark;
|
||||||
|
|
||||||
|
@ApiModelProperty("动态扩展字段")
|
||||||
|
private String extendField;
|
||||||
|
|
||||||
|
@ApiModelProperty("地址经纬度point")
|
||||||
|
private byte[] addressPoint;
|
||||||
|
}
|
||||||
@@ -0,0 +1,52 @@
|
|||||||
|
package com.cool.store.entity;
|
||||||
|
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import java.io.Serializable;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Builder;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author zhangchenbiao
|
||||||
|
* @date 2023-05-31 02:27
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@Builder
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
public class SubordinateMappingDO implements Serializable {
|
||||||
|
@ApiModelProperty("主键")
|
||||||
|
private Integer id;
|
||||||
|
|
||||||
|
@ApiModelProperty("用户ID")
|
||||||
|
private String userId;
|
||||||
|
|
||||||
|
@ApiModelProperty("部门ID")
|
||||||
|
private String regionId;
|
||||||
|
|
||||||
|
@ApiModelProperty("人员ID")
|
||||||
|
private String personalId;
|
||||||
|
|
||||||
|
@ApiModelProperty("0 下属 , 1 直属上级")
|
||||||
|
private Integer type;
|
||||||
|
|
||||||
|
@ApiModelProperty("创建人")
|
||||||
|
private String createId;
|
||||||
|
|
||||||
|
@ApiModelProperty("创建时间")
|
||||||
|
private Long createTime;
|
||||||
|
|
||||||
|
@ApiModelProperty("更新人")
|
||||||
|
private String updateId;
|
||||||
|
|
||||||
|
@ApiModelProperty("更新时间")
|
||||||
|
private Long updateTime;
|
||||||
|
|
||||||
|
@ApiModelProperty("管辖用户范围:self-仅自己,all-全部人员,define-自定义")
|
||||||
|
private String userRange;
|
||||||
|
|
||||||
|
@ApiModelProperty("auto自动关联 select手动选择")
|
||||||
|
private String source;
|
||||||
|
}
|
||||||
@@ -0,0 +1,121 @@
|
|||||||
|
package com.cool.store.vo.buser;
|
||||||
|
|
||||||
|
import com.cool.store.dto.auth.AuthRegionStoreUserDTO;
|
||||||
|
import com.cool.store.dto.buser.MySubordinatesDTO;
|
||||||
|
import com.cool.store.dto.usergroup.UserGroupDTO;
|
||||||
|
import com.cool.store.entity.EnterpriseUserDO;
|
||||||
|
import com.cool.store.utils.UUIDUtils;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Builder;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author zhangchenbiao
|
||||||
|
* @date 2022-01-18 04:40
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@Builder
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
public class EnterpriseUserPageVO implements Serializable {
|
||||||
|
|
||||||
|
@ApiModelProperty("钉钉用户id")
|
||||||
|
private String userId;
|
||||||
|
|
||||||
|
@ApiModelProperty("")
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
@ApiModelProperty("是否已经激活, true表示已激活, false表示未激活")
|
||||||
|
private Boolean active;
|
||||||
|
|
||||||
|
@ApiModelProperty("是否是主管理员,0:否,1:是")
|
||||||
|
private Boolean mainAdmin;
|
||||||
|
|
||||||
|
@ApiModelProperty("是否为企业的管理员, true表示是, false表示不是")
|
||||||
|
private Boolean isAdmin;
|
||||||
|
|
||||||
|
@ApiModelProperty("手机号码")
|
||||||
|
private String mobile;
|
||||||
|
|
||||||
|
@ApiModelProperty("员工的电子邮箱")
|
||||||
|
private String email;
|
||||||
|
|
||||||
|
@ApiModelProperty("在当前isv全局范围内唯一标识一个用户的身份,用户无法修改")
|
||||||
|
private String unionid;
|
||||||
|
|
||||||
|
@ApiModelProperty("员工的企业邮箱")
|
||||||
|
private String orgEmail;
|
||||||
|
|
||||||
|
@ApiModelProperty("头像url")
|
||||||
|
private String avatar;
|
||||||
|
|
||||||
|
@ApiModelProperty("")
|
||||||
|
private String roles;
|
||||||
|
|
||||||
|
@ApiModelProperty("工号")
|
||||||
|
private String jobnumber;
|
||||||
|
|
||||||
|
@ApiModelProperty("备注")
|
||||||
|
private String remark;
|
||||||
|
|
||||||
|
@ApiModelProperty("")
|
||||||
|
private String roleName;
|
||||||
|
|
||||||
|
@ApiModelProperty("部门")
|
||||||
|
private String departments;
|
||||||
|
|
||||||
|
@ApiModelProperty("用户状态 0待审核 1正常 2冻结")
|
||||||
|
private Integer userStatus;
|
||||||
|
|
||||||
|
@ApiModelProperty("门店数量")
|
||||||
|
private Integer storeCount;
|
||||||
|
|
||||||
|
private String department;
|
||||||
|
|
||||||
|
@ApiModelProperty("用户分组")
|
||||||
|
private List<UserGroupDTO> userGroupList;
|
||||||
|
|
||||||
|
@ApiModelProperty("管辖用户范围")
|
||||||
|
private String subordinateUserRange;
|
||||||
|
|
||||||
|
@ApiModelProperty("auto自动关联 select手动选择")
|
||||||
|
private List<String> sourceList;
|
||||||
|
|
||||||
|
@ApiModelProperty("我的下属集合")
|
||||||
|
private List<MySubordinatesDTO> mySubordinates;
|
||||||
|
|
||||||
|
private List<AuthRegionStoreUserDTO> authRegionStoreList;
|
||||||
|
|
||||||
|
@ApiModelProperty("选取权限 true可选 false不可选")
|
||||||
|
private Boolean selectFlag;
|
||||||
|
|
||||||
|
|
||||||
|
public static List<EnterpriseUserPageVO> transUserDOToVO(List<EnterpriseUserDO> enterpriseUserList) {
|
||||||
|
List<EnterpriseUserPageVO> resultList = new ArrayList<>();
|
||||||
|
for (EnterpriseUserDO enterpriseUserDTO : enterpriseUserList) {
|
||||||
|
EnterpriseUserPageVO enterpriseUserDO = new EnterpriseUserPageVO();
|
||||||
|
enterpriseUserDO.setUserId(enterpriseUserDTO.getUserId());
|
||||||
|
enterpriseUserDO.setName(enterpriseUserDTO.getName());
|
||||||
|
enterpriseUserDO.setActive(Boolean.TRUE);
|
||||||
|
enterpriseUserDO.setMainAdmin(enterpriseUserDTO.getMainAdmin());
|
||||||
|
enterpriseUserDO.setIsAdmin(enterpriseUserDTO.getIsAdmin());
|
||||||
|
enterpriseUserDO.setMobile(enterpriseUserDTO.getMobile());
|
||||||
|
enterpriseUserDO.setEmail(enterpriseUserDTO.getEmail());
|
||||||
|
enterpriseUserDO.setOrgEmail(enterpriseUserDTO.getOrgEmail());
|
||||||
|
enterpriseUserDO.setUnionid(enterpriseUserDTO.getUnionid());
|
||||||
|
enterpriseUserDO.setAvatar(enterpriseUserDTO.getAvatar());
|
||||||
|
enterpriseUserDO.setJobnumber(enterpriseUserDTO.getJobnumber());
|
||||||
|
enterpriseUserDO.setRemark(enterpriseUserDTO.getRemark());
|
||||||
|
resultList.add(enterpriseUserDO);
|
||||||
|
}
|
||||||
|
return resultList;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,47 @@
|
|||||||
|
package com.cool.store.vo.usergroup;
|
||||||
|
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class UserGroupVO {
|
||||||
|
|
||||||
|
@ApiModelProperty("分组名称")
|
||||||
|
private String groupName;
|
||||||
|
|
||||||
|
@ApiModelProperty("分组id")
|
||||||
|
private String groupId;
|
||||||
|
|
||||||
|
@ApiModelProperty("人员数量")
|
||||||
|
private Integer userCount;
|
||||||
|
|
||||||
|
private List<UserSimpleDTO> commonEditUserList;
|
||||||
|
|
||||||
|
@ApiModelProperty("更新人")
|
||||||
|
private String updateUserName;
|
||||||
|
|
||||||
|
@ApiModelProperty("更新时间")
|
||||||
|
private Date updateTime;
|
||||||
|
|
||||||
|
@ApiModelProperty("更新人")
|
||||||
|
private String updateUserId;
|
||||||
|
|
||||||
|
@ApiModelProperty("创建人")
|
||||||
|
private String createUserName;
|
||||||
|
|
||||||
|
@ApiModelProperty("创建时间")
|
||||||
|
private Date createTime;
|
||||||
|
|
||||||
|
@ApiModelProperty("创建人id")
|
||||||
|
private String createUserId;
|
||||||
|
|
||||||
|
@ApiModelProperty("配置用户集合")
|
||||||
|
private List<UserSimpleDTO> configUserList;
|
||||||
|
|
||||||
|
@ApiModelProperty("编辑权限")
|
||||||
|
private Boolean editFlag;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
package com.cool.store.vo.usergroup;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author :xugangkun
|
||||||
|
* @date :2022/3/8 14:22
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class UserSimpleDTO {
|
||||||
|
/**
|
||||||
|
* 用户id
|
||||||
|
*/
|
||||||
|
private String userId;
|
||||||
|
/**
|
||||||
|
* 用户名称
|
||||||
|
*/
|
||||||
|
private String userName;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -17,7 +17,6 @@
|
|||||||
<orderEntry type="library" name="Maven: com.alibaba:fastjson:1.2.60" level="project" />
|
<orderEntry type="library" name="Maven: com.alibaba:fastjson:1.2.60" level="project" />
|
||||||
<orderEntry type="library" name="Maven: org.apache.commons:commons-collections4:4.1" level="project" />
|
<orderEntry type="library" name="Maven: org.apache.commons:commons-collections4:4.1" level="project" />
|
||||||
<orderEntry type="library" name="Maven: org.apache.commons:commons-pool2:2.8.0" level="project" />
|
<orderEntry type="library" name="Maven: org.apache.commons:commons-pool2:2.8.0" level="project" />
|
||||||
<orderEntry type="library" name="Maven: redis.clients:jedis:2.8.0" level="project" />
|
|
||||||
<orderEntry type="library" name="Maven: org.apache.tika:tika-core:1.9" level="project" />
|
<orderEntry type="library" name="Maven: org.apache.tika:tika-core:1.9" level="project" />
|
||||||
<orderEntry type="library" name="Maven: xerces:xercesImpl:2.11.0" level="project" />
|
<orderEntry type="library" name="Maven: xerces:xercesImpl:2.11.0" level="project" />
|
||||||
<orderEntry type="library" name="Maven: xml-apis:xml-apis:1.4.01" level="project" />
|
<orderEntry type="library" name="Maven: xml-apis:xml-apis:1.4.01" level="project" />
|
||||||
@@ -32,8 +31,6 @@
|
|||||||
<orderEntry type="library" name="Maven: org.apache.logging.log4j:log4j-api:2.12.1" level="project" />
|
<orderEntry type="library" name="Maven: org.apache.logging.log4j:log4j-api:2.12.1" level="project" />
|
||||||
<orderEntry type="library" name="Maven: org.slf4j:jul-to-slf4j:1.7.30" level="project" />
|
<orderEntry type="library" name="Maven: org.slf4j:jul-to-slf4j:1.7.30" level="project" />
|
||||||
<orderEntry type="library" name="Maven: jakarta.annotation:jakarta.annotation-api:1.3.5" level="project" />
|
<orderEntry type="library" name="Maven: jakarta.annotation:jakarta.annotation-api:1.3.5" level="project" />
|
||||||
<orderEntry type="library" name="Maven: org.springframework:spring-core:5.2.5.RELEASE" level="project" />
|
|
||||||
<orderEntry type="library" name="Maven: org.springframework:spring-jcl:5.2.5.RELEASE" level="project" />
|
|
||||||
<orderEntry type="library" scope="RUNTIME" name="Maven: org.yaml:snakeyaml:1.25" level="project" />
|
<orderEntry type="library" scope="RUNTIME" name="Maven: org.yaml:snakeyaml:1.25" level="project" />
|
||||||
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-json:2.2.6.RELEASE" level="project" />
|
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-json:2.2.6.RELEASE" level="project" />
|
||||||
<orderEntry type="library" name="Maven: com.fasterxml.jackson.core:jackson-databind:2.10.3" level="project" />
|
<orderEntry type="library" name="Maven: com.fasterxml.jackson.core:jackson-databind:2.10.3" level="project" />
|
||||||
@@ -51,8 +48,6 @@
|
|||||||
<orderEntry type="library" name="Maven: org.hibernate.validator:hibernate-validator:6.0.18.Final" level="project" />
|
<orderEntry type="library" name="Maven: org.hibernate.validator:hibernate-validator:6.0.18.Final" level="project" />
|
||||||
<orderEntry type="library" name="Maven: org.jboss.logging:jboss-logging:3.4.1.Final" level="project" />
|
<orderEntry type="library" name="Maven: org.jboss.logging:jboss-logging:3.4.1.Final" level="project" />
|
||||||
<orderEntry type="library" name="Maven: com.fasterxml:classmate:1.5.1" level="project" />
|
<orderEntry type="library" name="Maven: com.fasterxml:classmate:1.5.1" level="project" />
|
||||||
<orderEntry type="library" name="Maven: org.springframework:spring-web:5.2.5.RELEASE" level="project" />
|
|
||||||
<orderEntry type="library" name="Maven: org.springframework:spring-beans:5.2.5.RELEASE" level="project" />
|
|
||||||
<orderEntry type="library" name="Maven: org.springframework:spring-webmvc:5.2.5.RELEASE" level="project" />
|
<orderEntry type="library" name="Maven: org.springframework:spring-webmvc:5.2.5.RELEASE" level="project" />
|
||||||
<orderEntry type="library" name="Maven: org.springframework:spring-aop:5.2.5.RELEASE" level="project" />
|
<orderEntry type="library" name="Maven: org.springframework:spring-aop:5.2.5.RELEASE" level="project" />
|
||||||
<orderEntry type="library" name="Maven: org.springframework:spring-context:5.2.5.RELEASE" level="project" />
|
<orderEntry type="library" name="Maven: org.springframework:spring-context:5.2.5.RELEASE" level="project" />
|
||||||
@@ -64,9 +59,6 @@
|
|||||||
<orderEntry type="library" name="Maven: org.mybatis:mybatis:3.5.9" level="project" />
|
<orderEntry type="library" name="Maven: org.mybatis:mybatis:3.5.9" level="project" />
|
||||||
<orderEntry type="library" name="Maven: org.mybatis:mybatis-spring:2.0.7" level="project" />
|
<orderEntry type="library" name="Maven: org.mybatis:mybatis-spring:2.0.7" level="project" />
|
||||||
<orderEntry type="library" name="Maven: com.github.pagehelper:pagehelper-spring-boot-autoconfigure:1.4.6" level="project" />
|
<orderEntry type="library" name="Maven: com.github.pagehelper:pagehelper-spring-boot-autoconfigure:1.4.6" level="project" />
|
||||||
<orderEntry type="library" name="Maven: com.github.pagehelper:pagehelper:5.3.2" level="project" />
|
|
||||||
<orderEntry type="library" name="Maven: com.github.jsqlparser:jsqlparser:4.5" level="project" />
|
|
||||||
<orderEntry type="library" name="Maven: com.coolstore:coolstore-base:1.5.3" level="project" />
|
|
||||||
<orderEntry type="library" name="Maven: com.google.guava:guava:20.0" level="project" />
|
<orderEntry type="library" name="Maven: com.google.guava:guava:20.0" level="project" />
|
||||||
<orderEntry type="module" module-name="coolstore-partner-dao" />
|
<orderEntry type="module" module-name="coolstore-partner-dao" />
|
||||||
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-jdbc:3.0.2" level="project" />
|
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-jdbc:3.0.2" level="project" />
|
||||||
@@ -120,5 +112,12 @@
|
|||||||
<orderEntry type="library" name="Maven: com.squareup.okio:okio:1.17.2" level="project" />
|
<orderEntry type="library" name="Maven: com.squareup.okio:okio:1.17.2" level="project" />
|
||||||
<orderEntry type="library" name="Maven: com.aliyun:ons20190214:1.0.0" level="project" />
|
<orderEntry type="library" name="Maven: com.aliyun:ons20190214:1.0.0" level="project" />
|
||||||
<orderEntry type="library" name="Maven: com.aliyun:endpoint-util:0.0.6" level="project" />
|
<orderEntry type="library" name="Maven: com.aliyun:endpoint-util:0.0.6" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: com.github.pagehelper:pagehelper:5.3.2" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: com.github.jsqlparser:jsqlparser:4.5" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: redis.clients:jedis:2.8.0" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.springframework:spring-web:5.2.5.RELEASE" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.springframework:spring-beans:5.2.5.RELEASE" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.springframework:spring-core:5.2.5.RELEASE" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.springframework:spring-jcl:5.2.5.RELEASE" level="project" />
|
||||||
</component>
|
</component>
|
||||||
</module>
|
</module>
|
||||||
@@ -45,6 +45,20 @@
|
|||||||
<groupId>com.aliyun</groupId>
|
<groupId>com.aliyun</groupId>
|
||||||
<artifactId>ons20190214</artifactId>
|
<artifactId>ons20190214</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.github.pagehelper</groupId>
|
||||||
|
<artifactId>pagehelper</artifactId>
|
||||||
|
<version>5.3.2</version>
|
||||||
|
<scope>compile</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>redis.clients</groupId>
|
||||||
|
<artifactId>jedis</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework</groupId>
|
||||||
|
<artifactId>spring-web</artifactId>
|
||||||
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
</project>
|
</project>
|
||||||
@@ -7,10 +7,10 @@ import com.aliyun.openservices.ons.api.Message;
|
|||||||
import com.aliyun.openservices.ons.api.MessageListener;
|
import com.aliyun.openservices.ons.api.MessageListener;
|
||||||
import com.cool.store.constants.CommonConstants;
|
import com.cool.store.constants.CommonConstants;
|
||||||
import com.cool.store.dto.enterprise.EnterpriseInitDTO;
|
import com.cool.store.dto.enterprise.EnterpriseInitDTO;
|
||||||
|
import com.cool.store.enums.AppTypeEnum;
|
||||||
import com.cool.store.enums.EnterpriseStatusEnum;
|
import com.cool.store.enums.EnterpriseStatusEnum;
|
||||||
import com.cool.store.service.EnterpriseInitService;
|
import com.cool.store.service.EnterpriseInitService;
|
||||||
import com.cool.store.utils.RedisUtilPool;
|
import com.cool.store.utils.RedisUtilPool;
|
||||||
import com.coolstore.base.enums.AppTypeEnum;
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
|||||||
@@ -6,8 +6,8 @@ import com.aliyun.openservices.ons.api.ConsumeContext;
|
|||||||
import com.aliyun.openservices.ons.api.Message;
|
import com.aliyun.openservices.ons.api.Message;
|
||||||
import com.aliyun.openservices.ons.api.MessageListener;
|
import com.aliyun.openservices.ons.api.MessageListener;
|
||||||
import com.cool.store.dto.enterprise.EnterpriseOpenMsg;
|
import com.cool.store.dto.enterprise.EnterpriseOpenMsg;
|
||||||
|
import com.cool.store.enums.RocketMqTagEnum;
|
||||||
import com.cool.store.service.EnterpriseInitService;
|
import com.cool.store.service.EnterpriseInitService;
|
||||||
import com.coolstore.base.enums.RocketMqTagEnum;
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|||||||
@@ -6,8 +6,8 @@ import com.cool.store.dto.enterprise.AuthScopeDTO;
|
|||||||
import com.cool.store.dto.enterprise.EnterpriseUserDTO;
|
import com.cool.store.dto.enterprise.EnterpriseUserDTO;
|
||||||
import com.cool.store.dto.enterprise.SysDepartmentDTO;
|
import com.cool.store.dto.enterprise.SysDepartmentDTO;
|
||||||
import com.cool.store.dto.login.UserIdInfoDTO;
|
import com.cool.store.dto.login.UserIdInfoDTO;
|
||||||
|
import com.cool.store.dto.response.ResultDTO;
|
||||||
import com.cool.store.utils.RestTemplateUtil;
|
import com.cool.store.utils.RestTemplateUtil;
|
||||||
import com.coolstore.base.dto.ResultDTO;
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.beans.factory.annotation.Value;
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
import org.springframework.http.ResponseEntity;
|
import org.springframework.http.ResponseEntity;
|
||||||
|
|||||||
@@ -1,14 +1,11 @@
|
|||||||
package com.cool.store.http;
|
package com.cool.store.http;
|
||||||
|
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
import com.cool.store.dto.enterprise.EnterpriseUserDTO;
|
|
||||||
import com.cool.store.dto.wx.CodeSessionDTO;
|
import com.cool.store.dto.wx.CodeSessionDTO;
|
||||||
import com.cool.store.enums.ErrorCodeEnum;
|
import com.cool.store.enums.ErrorCodeEnum;
|
||||||
import com.cool.store.exception.ServiceException;
|
import com.cool.store.exception.ServiceException;
|
||||||
import com.cool.store.utils.RestTemplateUtil;
|
import com.cool.store.utils.RestTemplateUtil;
|
||||||
import com.coolstore.base.dto.ResultDTO;
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.apache.shiro.crypto.hash.Hash;
|
|
||||||
import org.springframework.http.ResponseEntity;
|
import org.springframework.http.ResponseEntity;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
package com.cool.store.mq;
|
package com.cool.store.mq;
|
||||||
|
|
||||||
import com.aliyun.openservices.ons.api.SendResult;
|
import com.aliyun.openservices.ons.api.SendResult;
|
||||||
import com.coolstore.base.enums.RocketMqTagEnum;
|
import com.cool.store.enums.RocketMqTagEnum;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author zhangchenbiao
|
* @author zhangchenbiao
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ package com.cool.store.mq;
|
|||||||
|
|
||||||
import com.aliyun.openservices.ons.api.SendCallback;
|
import com.aliyun.openservices.ons.api.SendCallback;
|
||||||
import com.aliyun.openservices.ons.api.SendResult;
|
import com.aliyun.openservices.ons.api.SendResult;
|
||||||
import com.coolstore.base.enums.RocketMqTagEnum;
|
import com.cool.store.enums.RocketMqTagEnum;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author zhangchenbiao
|
* @author zhangchenbiao
|
||||||
|
|||||||
@@ -4,10 +4,10 @@ import com.aliyun.openservices.ons.api.Message;
|
|||||||
import com.aliyun.openservices.ons.api.SendResult;
|
import com.aliyun.openservices.ons.api.SendResult;
|
||||||
import com.aliyun.openservices.ons.api.bean.OrderProducerBean;
|
import com.aliyun.openservices.ons.api.bean.OrderProducerBean;
|
||||||
import com.cool.store.constants.CommonConstants;
|
import com.cool.store.constants.CommonConstants;
|
||||||
|
import com.cool.store.enums.RocketMqTagEnum;
|
||||||
import com.cool.store.mq.OrderMessageService;
|
import com.cool.store.mq.OrderMessageService;
|
||||||
import com.cool.store.mq.RocketMqConfig;
|
import com.cool.store.mq.RocketMqConfig;
|
||||||
import com.cool.store.utils.UUIDUtils;
|
import com.cool.store.utils.UUIDUtils;
|
||||||
import com.coolstore.base.enums.RocketMqTagEnum;
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.slf4j.MDC;
|
import org.slf4j.MDC;
|
||||||
|
|||||||
@@ -6,10 +6,10 @@ import com.aliyun.openservices.ons.api.SendCallback;
|
|||||||
import com.aliyun.openservices.ons.api.SendResult;
|
import com.aliyun.openservices.ons.api.SendResult;
|
||||||
import com.aliyun.openservices.ons.api.bean.ProducerBean;
|
import com.aliyun.openservices.ons.api.bean.ProducerBean;
|
||||||
import com.cool.store.constants.CommonConstants;
|
import com.cool.store.constants.CommonConstants;
|
||||||
|
import com.cool.store.enums.RocketMqTagEnum;
|
||||||
import com.cool.store.mq.RocketMqConfig;
|
import com.cool.store.mq.RocketMqConfig;
|
||||||
import com.cool.store.mq.SimpleMessageService;
|
import com.cool.store.mq.SimpleMessageService;
|
||||||
import com.cool.store.utils.UUIDUtils;
|
import com.cool.store.utils.UUIDUtils;
|
||||||
import com.coolstore.base.enums.RocketMqTagEnum;
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.slf4j.MDC;
|
import org.slf4j.MDC;
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import com.aliyun.ons20190214.*;
|
|||||||
import com.aliyun.ons20190214.models.*;
|
import com.aliyun.ons20190214.models.*;
|
||||||
import com.aliyun.teaopenapi.models.Config;
|
import com.aliyun.teaopenapi.models.Config;
|
||||||
import com.cool.store.constants.CommonConstants;
|
import com.cool.store.constants.CommonConstants;
|
||||||
import com.coolstore.base.enums.RocketMqGroupEnum;
|
import com.cool.store.enums.RocketMqGroupEnum;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.apache.commons.collections4.CollectionUtils;
|
import org.apache.commons.collections4.CollectionUtils;
|
||||||
import org.apache.commons.collections4.ListUtils;
|
import org.apache.commons.collections4.ListUtils;
|
||||||
|
|||||||
@@ -0,0 +1,48 @@
|
|||||||
|
package com.cool.store.service;
|
||||||
|
|
||||||
|
import com.cool.store.dto.auth.AuthRegionStoreDTO;
|
||||||
|
import com.cool.store.dto.auth.AuthRegionStoreUserDTO;
|
||||||
|
import com.cool.store.dto.auth.AuthStoreCountDTO;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* describe:可视化权限服务
|
||||||
|
*
|
||||||
|
* @author zhouyiping
|
||||||
|
* @date 2020/10/14
|
||||||
|
*/
|
||||||
|
public interface AuthVisualService {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* do
|
||||||
|
* 查询权限区域/门店(配置区域使用)
|
||||||
|
* @param eid
|
||||||
|
* @param userId
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
List<AuthRegionStoreUserDTO> authRegionStore(String eid, String userId);
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* do
|
||||||
|
* 查询权限区域/门店(配置区域使用)
|
||||||
|
* @param eid
|
||||||
|
* @param userIdList
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
List<AuthRegionStoreDTO> authRegionStoreByUserList(String eid, List<String> userIdList);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* do
|
||||||
|
* 获取人员拥有的门店总数
|
||||||
|
* @param eid
|
||||||
|
* @param userId
|
||||||
|
* @param isReturnList 是否返回门店列表
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
List<AuthStoreCountDTO> authStoreCount(String eid, List<String> userId, Boolean isReturnList);
|
||||||
|
|
||||||
|
}
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
package com.cool.store.service;
|
package com.cool.store.service;
|
||||||
|
|
||||||
import com.cool.store.dto.enterprise.EnterpriseOpenMsg;
|
import com.cool.store.dto.enterprise.EnterpriseOpenMsg;
|
||||||
import com.coolstore.base.enums.AppTypeEnum;
|
import com.cool.store.enums.AppTypeEnum;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,55 @@
|
|||||||
|
package com.cool.store.service;
|
||||||
|
|
||||||
|
import com.cool.store.context.CurrentUser;
|
||||||
|
import com.cool.store.dto.enterprise.EnterpriseUserDTO;
|
||||||
|
import com.cool.store.dto.usergroup.UserGroupAddRequest;
|
||||||
|
import com.cool.store.dto.usergroup.UserGroupDTO;
|
||||||
|
import com.cool.store.vo.buser.EnterpriseUserPageVO;
|
||||||
|
import com.cool.store.vo.usergroup.UserGroupVO;
|
||||||
|
import com.github.pagehelper.PageInfo;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author wxp
|
||||||
|
* @Date 2022/12/29 11:18
|
||||||
|
* @Version 1.0
|
||||||
|
*/
|
||||||
|
public interface EnterpriseUserGroupService {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 增加用户分组
|
||||||
|
* @param enterpriseId
|
||||||
|
* @param userGroupAddRequest
|
||||||
|
* @param user
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
Boolean saveOrUpdateUserGroup(String enterpriseId, UserGroupAddRequest userGroupAddRequest, CurrentUser user);
|
||||||
|
|
||||||
|
Boolean updateUserGroup(String enterpriseId,Long userGroupId,List<String> userIdList);
|
||||||
|
|
||||||
|
void batchDeleteGroup(String enterpriseId, String groupId, List<String> userIdList);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取用户分组列表
|
||||||
|
* @param enterpriseId
|
||||||
|
* @param groupName 分组名,模糊查询用
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
List<UserGroupVO> listUserGroup(String enterpriseId, String groupName, CurrentUser user);
|
||||||
|
|
||||||
|
UserGroupVO getGroupInfo(String enterpriseId, String groupId, CurrentUser user);
|
||||||
|
|
||||||
|
PageInfo<EnterpriseUserPageVO> listUserByGroupId(String enterpriseId, String groupId, String userName, Integer pageNum, Integer pageSize, CurrentUser currentUser);
|
||||||
|
|
||||||
|
void updateUserGroup(String enterpriseId, List<String> groupIdList, String userId, CurrentUser currentUser);
|
||||||
|
|
||||||
|
Boolean configUser(String enterpriseId, UserGroupAddRequest userGroupAddRequest, CurrentUser user);
|
||||||
|
|
||||||
|
Map<String, List<UserGroupDTO>> getUserGroupMap(String enterpriseId, List<String> userIdList);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -1,6 +1,12 @@
|
|||||||
package com.cool.store.service;
|
package com.cool.store.service;
|
||||||
|
|
||||||
|
import com.cool.store.dto.buser.SubordinateUserRangeDTO;
|
||||||
|
import com.cool.store.dto.enterprise.EnterpriseUserDTO;
|
||||||
|
import com.cool.store.entity.EnterpriseUserDO;
|
||||||
|
import com.cool.store.vo.buser.EnterpriseUserPageVO;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author zhangchenbiao
|
* @author zhangchenbiao
|
||||||
@@ -12,4 +18,20 @@ public interface EnterpriseUserService {
|
|||||||
|
|
||||||
void updateUserRegionPathList(String enterpriseId, List<String> userIds);
|
void updateUserRegionPathList(String enterpriseId, List<String> userIds);
|
||||||
|
|
||||||
|
List<EnterpriseUserPageVO> listUser(String enterpriseId, String userName, String deptId,
|
||||||
|
String orderBy, String orderRule,
|
||||||
|
Long roleId, Integer userStatus, Integer pageNum, Integer pageSize, String jobNumber, String regionId, Boolean hasPage);
|
||||||
|
|
||||||
|
List<String> initUserRole(String enterpriseId, List<EnterpriseUserPageVO> enterpriseUserList);
|
||||||
|
|
||||||
|
Map<String, SubordinateUserRangeDTO> fillUserSubordinateNames(String enterpriseId, List<String> userIdList);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取人员所属部门
|
||||||
|
* @param enterpriseId
|
||||||
|
* @param userIdList
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
Map<String, String> getUserRegion(String enterpriseId, List<String> userIdList);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,33 @@
|
|||||||
|
package com.cool.store.service;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public interface SubordinateMappingService {
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 判断用户是否管辖全部用户
|
||||||
|
* @param enterpriseId
|
||||||
|
* @param currentUserId
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
Boolean checkHaveAllSubordinateUser(String enterpriseId, String currentUserId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取管辖用户
|
||||||
|
* @param enterpriseId
|
||||||
|
* @param currentUserId
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
List<String> getSubordinateUserIdList(String enterpriseId, String currentUserId,Boolean addCurrentFlag);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 保留管辖用户
|
||||||
|
* @param enterpriseId
|
||||||
|
* @param currentUserId
|
||||||
|
* @param userIdList
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
List<String> retainSubordinateUserIdList(String enterpriseId, String currentUserId, List<String> userIdList,Boolean addCurrentFlag);
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,365 @@
|
|||||||
|
package com.cool.store.service.impl;
|
||||||
|
|
||||||
|
import com.cool.store.dao.*;
|
||||||
|
import com.cool.store.dto.auth.AuthRegionStoreDTO;
|
||||||
|
import com.cool.store.dto.auth.AuthRegionStoreUserDTO;
|
||||||
|
import com.cool.store.dto.auth.AuthStoreCountDTO;
|
||||||
|
import com.cool.store.dto.buser.UserRoleDTO;
|
||||||
|
import com.cool.store.dto.store.StoreAreaDTO;
|
||||||
|
import com.cool.store.entity.RegionDO;
|
||||||
|
import com.cool.store.entity.StoreDO;
|
||||||
|
import com.cool.store.entity.UserAuthMappingDO;
|
||||||
|
import com.cool.store.enums.*;
|
||||||
|
import com.cool.store.service.AuthVisualService;
|
||||||
|
import com.cool.store.utils.CommonNodeUtils;
|
||||||
|
import com.cool.store.utils.RedisConstantUtil;
|
||||||
|
import com.cool.store.utils.RedisUtilPool;
|
||||||
|
import javafx.util.Pair;
|
||||||
|
import org.apache.commons.collections4.CollectionUtils;
|
||||||
|
import org.apache.commons.collections4.ListUtils;
|
||||||
|
import org.apache.commons.collections4.MapUtils;
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import java.util.*;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* describe:
|
||||||
|
*
|
||||||
|
* @author zhouyiping
|
||||||
|
* @date 2020/10/14
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class AuthVisualServiceImpl implements AuthVisualService {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private UserAuthMappingDAO userAuthMappingDAO;
|
||||||
|
@Resource
|
||||||
|
private RegionDAO regionDAO;
|
||||||
|
@Autowired
|
||||||
|
private RedisUtilPool redisUtilPool;
|
||||||
|
@Autowired
|
||||||
|
private EnterpriseUserRoleDAO enterpriseUserRoleDAO;
|
||||||
|
@Resource
|
||||||
|
private UserRegionMappingDAO userRegionMappingDAO;
|
||||||
|
@Resource
|
||||||
|
private RedisConstantUtil redisConstantUtil;
|
||||||
|
@Resource
|
||||||
|
private StoreDAO storeDAO;
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<AuthRegionStoreUserDTO> authRegionStore(String eid, String userId) {
|
||||||
|
|
||||||
|
List<UserAuthMappingDO> userAuthMappingList = userAuthMappingDAO.listUserAuthMappingByUserId(eid, userId);
|
||||||
|
return getAuthRegionStoreUserDTO(eid, userAuthMappingList);
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<AuthRegionStoreUserDTO> getAuthRegionStoreUserDTO(String eid, List<UserAuthMappingDO> userAuthMappingList) {
|
||||||
|
List<AuthRegionStoreUserDTO> authRegionStoreDTOList = new ArrayList<>();
|
||||||
|
Pair<List<String>, List<String>> listListTwoResultTuple = splitUserAuthMapping(userAuthMappingList);
|
||||||
|
List<String> storeIdList = listListTwoResultTuple.getKey();
|
||||||
|
List<String> regionIdList = listListTwoResultTuple.getValue();
|
||||||
|
//将组织架构权限中的区域转换
|
||||||
|
if (CollectionUtils.isNotEmpty(regionIdList)) {
|
||||||
|
List<RegionDO> regionByRegionIds = regionDAO.getRegionByRegionIds(eid, regionIdList);
|
||||||
|
List<AuthRegionStoreUserDTO> regionAuthRegionStoreList = ListUtils.emptyIfNull(regionByRegionIds).stream()
|
||||||
|
.map(data -> mapAuthRegionStoreByRegion(data.getName(), data.getRegionId(), false, data.getStoreId()))
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
List<String> regionStoreIdList = ListUtils.emptyIfNull(regionByRegionIds).stream()
|
||||||
|
.filter(e -> StringUtils.isNotBlank(e.getStoreId()) && RegionTypeEnum.STORE.getType().equals(e.getRegionType()))
|
||||||
|
.map(RegionDO::getStoreId)
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
if (CollectionUtils.isNotEmpty(regionAuthRegionStoreList)) {
|
||||||
|
authRegionStoreDTOList.addAll(regionAuthRegionStoreList);
|
||||||
|
}
|
||||||
|
// 是否需要展示区域对应门店权限数据
|
||||||
|
if (storeIdList != null && CollectionUtils.isNotEmpty(regionStoreIdList)
|
||||||
|
&& StringUtils.isNotBlank(redisUtilPool.getString(redisConstantUtil.getShowStoreAuthKey()))) {
|
||||||
|
storeIdList.addAll(regionStoreIdList);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//将组织架构权限中的门店转换
|
||||||
|
if (CollectionUtils.isNotEmpty(storeIdList) && StringUtils.isNotBlank(redisUtilPool.getString(redisConstantUtil.getShowStoreAuthKey()))) {
|
||||||
|
List<StoreDO> storeListByStoreIds = storeDAO.getStoreListByStoreIds(eid, storeIdList);
|
||||||
|
List<AuthRegionStoreUserDTO> storeAuthRegionStoreList = ListUtils.emptyIfNull(storeListByStoreIds).stream()
|
||||||
|
.map(data -> mapAuthRegionStoreByRegion(data.getStoreName(), data.getStoreId(), true, data.getStoreId()))
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
if (CollectionUtils.isNotEmpty(storeAuthRegionStoreList)) {
|
||||||
|
authRegionStoreDTOList.addAll(storeAuthRegionStoreList);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return authRegionStoreDTOList;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Pair<List<String>, List<String>> splitUserAuthMapping(List<UserAuthMappingDO> userAuthMappingList) {
|
||||||
|
|
||||||
|
List<UserAuthMappingDO> store = new ArrayList<>();
|
||||||
|
List<UserAuthMappingDO> region = new ArrayList<>();
|
||||||
|
ListUtils.emptyIfNull(userAuthMappingList)
|
||||||
|
.forEach(data -> {
|
||||||
|
if (data.getType().equals(UserAuthMappingTypeEnum.STORE.getCode())) {
|
||||||
|
store.add(data);
|
||||||
|
} else {
|
||||||
|
region.add(data);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
List<String> storeIdList = ListUtils.emptyIfNull(store).stream()
|
||||||
|
.map(UserAuthMappingDO::getMappingId).distinct().filter(Objects::nonNull).collect(Collectors.toList());
|
||||||
|
List<String> regionIdList = ListUtils.emptyIfNull(region).stream()
|
||||||
|
.map(UserAuthMappingDO::getMappingId).distinct().filter(Objects::nonNull).collect(Collectors.toList());
|
||||||
|
return new Pair(storeIdList, regionIdList);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<AuthRegionStoreDTO> authRegionStoreByUserList(String eid, List<String> userIdList) {
|
||||||
|
|
||||||
|
List<UserAuthMappingDO> userAuthMappingList = userAuthMappingDAO.listUserAuthMappingByUserIds(eid, userIdList);
|
||||||
|
List<AuthRegionStoreUserDTO> authRegionStoreUserDTO = getAuthRegionStoreUserDTO(eid, userAuthMappingList);
|
||||||
|
Map<String, AuthRegionStoreUserDTO> regionStoreUserMap = ListUtils.emptyIfNull(authRegionStoreUserDTO)
|
||||||
|
.stream()
|
||||||
|
.collect(Collectors.toMap(AuthRegionStoreUserDTO::getId, data -> data, (a, b) -> a));
|
||||||
|
Map<String, List<UserAuthMappingDO>> userAuthGroup = ListUtils.emptyIfNull(userAuthMappingList)
|
||||||
|
.stream()
|
||||||
|
.collect(Collectors.groupingBy(UserAuthMappingDO::getUserId));
|
||||||
|
return userIdList.stream()
|
||||||
|
.map(data -> mapAuthRegionStoreDTO(regionStoreUserMap, userAuthGroup, data))
|
||||||
|
.filter(Objects::nonNull)
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<AuthStoreCountDTO> authStoreCount(String eid, List<String> userIdList, Boolean isReturnList) {
|
||||||
|
/**
|
||||||
|
* 1.查询出所有关于用户的权限门店
|
||||||
|
* 1.权限区域角色权限
|
||||||
|
* 2.权限门店
|
||||||
|
* 2.分组聚合
|
||||||
|
* 3.去重统计门店数
|
||||||
|
*/
|
||||||
|
//用户配置的区域权限
|
||||||
|
List<UserAuthMappingDO> userAuthMappingDOList = userAuthMappingDAO.listUserAuthMappingByUserIds(eid, userIdList);
|
||||||
|
|
||||||
|
List<String> allAuthRegionList = ListUtils.emptyIfNull(userAuthMappingDOList)
|
||||||
|
.stream()
|
||||||
|
.filter(data -> StringUtils.equals(UserAuthMappingTypeEnum.REGION.getCode(), data.getType()))
|
||||||
|
.map(UserAuthMappingDO::getMappingId)
|
||||||
|
.distinct()
|
||||||
|
.filter(Objects::nonNull)
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
|
||||||
|
List<StoreAreaDTO> storeAreaDTOS = storeDAO.listStoreByRegionIdList(eid, allAuthRegionList);
|
||||||
|
Map<String, List<String>> storeAreaMap = ListUtils.emptyIfNull(storeAreaDTOS)
|
||||||
|
.stream()
|
||||||
|
.collect(Collectors.groupingBy(StoreAreaDTO::getAreaId,
|
||||||
|
Collectors.mapping(StoreAreaDTO::getStoreId, Collectors.toList())));
|
||||||
|
Map<String, List<UserAuthMappingDO>> authMappingMap = ListUtils.emptyIfNull(userAuthMappingDOList)
|
||||||
|
.stream()
|
||||||
|
.collect(Collectors.groupingBy(UserAuthMappingDO::getUserId));
|
||||||
|
//用户角色可视化范围
|
||||||
|
List<UserRoleDTO> userRoleList = enterpriseUserRoleDAO.getUserAndRolesByUserId(eid, userIdList);
|
||||||
|
//取优先级最大角色去查询权限
|
||||||
|
//todo role
|
||||||
|
Map<String, UserRoleDTO> userRoleMap = ListUtils.emptyIfNull(userRoleList)
|
||||||
|
.stream()
|
||||||
|
.collect(Collectors.toMap(UserRoleDTO::getUserId, data -> data, (a, b) -> {
|
||||||
|
if (a.getPriority() == null || b.getPriority() == null) {
|
||||||
|
return a;
|
||||||
|
}
|
||||||
|
return a.getPriority() > b.getPriority() ? b : a;
|
||||||
|
}));
|
||||||
|
List<UserRoleDTO> minUserRoleList = new ArrayList<UserRoleDTO>(userRoleMap.values());
|
||||||
|
List<String> allStoreList = storeDAO.getAllStoreList(eid, isReturnList);
|
||||||
|
Integer allStoreCount = storeDAO.getStoreCount(eid);
|
||||||
|
|
||||||
|
//子区域计算
|
||||||
|
List<Long> all = null;
|
||||||
|
Map<Long, List<Long>> regionParentGroupMap = null;
|
||||||
|
Map<String, String> regionIdStoreIdMap = null;
|
||||||
|
if (CollectionUtils.isNotEmpty(allAuthRegionList)) {
|
||||||
|
List<RegionDO> allRegion = regionDAO.getAllRegion(eid);
|
||||||
|
ListUtils.emptyIfNull(allRegion).forEach(this::initRoot);
|
||||||
|
all = ListUtils.emptyIfNull(allRegion)
|
||||||
|
.stream()
|
||||||
|
.map(RegionDO::getId)
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
regionParentGroupMap = ListUtils.emptyIfNull(allRegion)
|
||||||
|
.stream()
|
||||||
|
.collect(Collectors.groupingBy(data -> Long.valueOf(data.getParentId()),
|
||||||
|
Collectors.mapping(RegionDO::getId, Collectors.toList())));
|
||||||
|
|
||||||
|
List<Long> storeRegionIdList = allAuthRegionList.stream()
|
||||||
|
.map(e -> Long.valueOf(e)).collect(Collectors.toList());
|
||||||
|
List<RegionDO> storeRegionList = regionDAO.listStoreRegionByIds(eid, storeRegionIdList);
|
||||||
|
regionIdStoreIdMap = ListUtils.emptyIfNull(storeRegionList).stream()
|
||||||
|
.filter(e -> StringUtils.isNotBlank(e.getStoreId()) && !e.getDeleted() && RegionTypeEnum.STORE.getType().equals(e.getRegionType()))
|
||||||
|
.collect(Collectors.toMap(data->String.valueOf(data.getId()), RegionDO::getStoreId, (a, b) -> a));
|
||||||
|
}
|
||||||
|
|
||||||
|
List<Long> finalAll = all;
|
||||||
|
Map<Long, List<Long>> finalRegionParentGroupMap = regionParentGroupMap;
|
||||||
|
Map<String, String> finalRegionIdStoreIdMap = regionIdStoreIdMap;
|
||||||
|
return ListUtils.emptyIfNull(minUserRoleList).stream()
|
||||||
|
.map(data -> mapAuStoreCountDTO(data, authMappingMap, storeAreaMap, allStoreList, allStoreCount, finalAll, finalRegionParentGroupMap, finalRegionIdStoreIdMap))
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
private AuthRegionStoreDTO mapAuthRegionStoreDTO(Map<String, AuthRegionStoreUserDTO> regionStoreUserMap, Map<String, List<UserAuthMappingDO>> userAuthGroup, String data) {
|
||||||
|
if (MapUtils.isNotEmpty(userAuthGroup) && CollectionUtils.isNotEmpty(userAuthGroup.get(data)) && MapUtils.isNotEmpty(regionStoreUserMap)) {
|
||||||
|
List<AuthRegionStoreUserDTO> authRegionStoreUserDTOList = ListUtils.emptyIfNull(userAuthGroup.get(data))
|
||||||
|
.stream()
|
||||||
|
.map(userAuthMappingDO -> regionStoreUserMap.get(userAuthMappingDO.getMappingId()))
|
||||||
|
.distinct()
|
||||||
|
.filter(Objects::nonNull)
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
AuthRegionStoreDTO authRegionStoreDTO = new AuthRegionStoreDTO();
|
||||||
|
authRegionStoreDTO.setUserId(data);
|
||||||
|
authRegionStoreDTO.setAuthRegionStoreUserList(authRegionStoreUserDTOList);
|
||||||
|
return authRegionStoreDTO;
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void initRoot(RegionDO regionDO) {
|
||||||
|
if (regionDO.getParentId() == null) {
|
||||||
|
regionDO.setParentId("0");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取区域下的门店(不包含子节点)
|
||||||
|
* @param storeIdList
|
||||||
|
* @param areaStoreList
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
private List<String> authStoreId(List<String> storeIdList,
|
||||||
|
List<String> areaStoreList) {
|
||||||
|
|
||||||
|
List<String> allStoreIdList = new ArrayList<>();
|
||||||
|
if (CollectionUtils.isNotEmpty(storeIdList)) {
|
||||||
|
allStoreIdList.addAll(storeIdList);
|
||||||
|
}
|
||||||
|
//聚合区域下的门店信息
|
||||||
|
|
||||||
|
if (CollectionUtils.isNotEmpty(areaStoreList)) {
|
||||||
|
allStoreIdList.addAll(areaStoreList);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//去除重复的StoreId
|
||||||
|
return ListUtils.emptyIfNull(allStoreIdList).stream()
|
||||||
|
.distinct()
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
}
|
||||||
|
|
||||||
|
private AuthStoreCountDTO mapAuStoreCountDTO(UserRoleDTO userRoleDTO,
|
||||||
|
Map<String, List<UserAuthMappingDO>> authMappingMap,
|
||||||
|
Map<String, List<String>> storeAreaMap,
|
||||||
|
List<String> invalidStores,
|
||||||
|
Integer allStoreCount,
|
||||||
|
List<Long> all,
|
||||||
|
Map<Long, List<Long>> regionParentGroupMap, Map<String, String> regionIdStoreIdMap) {
|
||||||
|
AuthStoreCountDTO authStoreCountDTO = new AuthStoreCountDTO();
|
||||||
|
if (userRoleDTO == null || userRoleDTO.getRoleAuth() == null) {
|
||||||
|
return authStoreCountDTO;
|
||||||
|
}
|
||||||
|
String userId = userRoleDTO.getUserId();
|
||||||
|
authStoreCountDTO.setUserId(userId);
|
||||||
|
//全企业数据或者管理员 直接返回企业下所有的门店总数
|
||||||
|
if (StringUtils.equals(userRoleDTO.getRoleEnum(), (RoleEnum.MASTER.getRoleEnum()))) {
|
||||||
|
authStoreCountDTO.setStoreList(invalidStores);
|
||||||
|
authStoreCountDTO.setStoreCount(allStoreCount);
|
||||||
|
return authStoreCountDTO;
|
||||||
|
}
|
||||||
|
List<String> storeIdList = new ArrayList<>();
|
||||||
|
List<String> regionIdList = new ArrayList<>();
|
||||||
|
List<String> areaStoreList;
|
||||||
|
|
||||||
|
if (MapUtils.isNotEmpty(authMappingMap)) {
|
||||||
|
List<UserAuthMappingDO> userAuthMappingDOList = authMappingMap.get(userId);
|
||||||
|
Pair<List<String>, List<String>> listListTwoResultTuple = splitUserAuthMapping(userAuthMappingDOList);
|
||||||
|
storeIdList = listListTwoResultTuple.getKey();
|
||||||
|
regionIdList = listListTwoResultTuple.getValue();
|
||||||
|
if(CollectionUtils.isNotEmpty(regionIdList) && regionIdStoreIdMap != null){
|
||||||
|
List<String> finalStoreIdList = storeIdList;
|
||||||
|
regionIdList.forEach(regionId -> {
|
||||||
|
String regionStoreId = regionIdStoreIdMap.get(regionId);
|
||||||
|
if (StringUtils.isNotBlank(regionStoreId)) {
|
||||||
|
finalStoreIdList.add(regionStoreId);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
switch (AuthRoleEnum.getByCode(userRoleDTO.getRoleAuth())) {
|
||||||
|
case ALL:
|
||||||
|
authStoreCountDTO.setStoreList(invalidStores);
|
||||||
|
authStoreCountDTO.setStoreCount(allStoreCount);
|
||||||
|
break;
|
||||||
|
case INCLUDE_SUBORDINATE:
|
||||||
|
|
||||||
|
areaStoreList = ListUtils.emptyIfNull(regionIdList)
|
||||||
|
.stream()
|
||||||
|
.map(data -> CommonNodeUtils.getAllChildListContainSelf(0L,
|
||||||
|
Long.valueOf(data), all, regionParentGroupMap))
|
||||||
|
.flatMap(Collection::stream)
|
||||||
|
.map(data -> data.toString())
|
||||||
|
.map(data -> {
|
||||||
|
if (MapUtils.isNotEmpty(storeAreaMap)) {
|
||||||
|
return storeAreaMap.get(data);
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
})
|
||||||
|
.filter(Objects::nonNull)
|
||||||
|
.flatMap(Collection::stream)
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
List<String> includeSubordinateStoreIdList = authStoreId(storeIdList, areaStoreList);
|
||||||
|
if (CollectionUtils.isNotEmpty(includeSubordinateStoreIdList)) {
|
||||||
|
authStoreCountDTO.setStoreList(includeSubordinateStoreIdList);
|
||||||
|
authStoreCountDTO.setStoreCount(ListUtils.emptyIfNull(includeSubordinateStoreIdList).size());
|
||||||
|
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case PERSONAL:
|
||||||
|
areaStoreList = ListUtils.emptyIfNull(regionIdList)
|
||||||
|
.stream()
|
||||||
|
.map(data -> CommonNodeUtils.getAllChildListContainSelf(0L,
|
||||||
|
Long.valueOf(data), all, regionParentGroupMap))
|
||||||
|
.flatMap(Collection::stream)
|
||||||
|
.map(data -> data.toString())
|
||||||
|
.map(data -> {
|
||||||
|
if (MapUtils.isNotEmpty(storeAreaMap)) {
|
||||||
|
return storeAreaMap.get(data);
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
})
|
||||||
|
.filter(Objects::nonNull)
|
||||||
|
.flatMap(Collection::stream)
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
List<String> personalStoreIdList = authStoreId(storeIdList, areaStoreList);
|
||||||
|
if (CollectionUtils.isNotEmpty(personalStoreIdList)) {
|
||||||
|
authStoreCountDTO.setStoreList(personalStoreIdList);
|
||||||
|
authStoreCountDTO.setStoreCount(ListUtils.emptyIfNull(personalStoreIdList).size());
|
||||||
|
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return authStoreCountDTO;
|
||||||
|
}
|
||||||
|
|
||||||
|
private AuthRegionStoreUserDTO mapAuthRegionStoreByRegion(String name, String regionId, boolean b, String storeId) {
|
||||||
|
AuthRegionStoreUserDTO authRegionStoreDTO = new AuthRegionStoreUserDTO();
|
||||||
|
authRegionStoreDTO.setName(name);
|
||||||
|
authRegionStoreDTO.setId(regionId);
|
||||||
|
authRegionStoreDTO.setStoreFlag(b);
|
||||||
|
authRegionStoreDTO.setStoreId(storeId);
|
||||||
|
return authRegionStoreDTO;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -8,10 +8,7 @@ import com.cool.store.entity.EnterpriseUserDO;
|
|||||||
import com.cool.store.entity.RegionDO;
|
import com.cool.store.entity.RegionDO;
|
||||||
import com.cool.store.entity.SysDepartmentDO;
|
import com.cool.store.entity.SysDepartmentDO;
|
||||||
import com.cool.store.entity.UserRegionMappingDO;
|
import com.cool.store.entity.UserRegionMappingDO;
|
||||||
import com.cool.store.enums.AIEnum;
|
import com.cool.store.enums.*;
|
||||||
import com.cool.store.enums.ErrorCodeEnum;
|
|
||||||
import com.cool.store.enums.RegionTypeEnum;
|
|
||||||
import com.cool.store.enums.RoleEnum;
|
|
||||||
import com.cool.store.exception.ServiceException;
|
import com.cool.store.exception.ServiceException;
|
||||||
import com.cool.store.http.ISVHttpRequest;
|
import com.cool.store.http.ISVHttpRequest;
|
||||||
import com.cool.store.mq.SimpleMessageService;
|
import com.cool.store.mq.SimpleMessageService;
|
||||||
@@ -22,8 +19,6 @@ import com.cool.store.utils.DataSourceHelper;
|
|||||||
import com.cool.store.utils.ListOptUtils;
|
import com.cool.store.utils.ListOptUtils;
|
||||||
import com.cool.store.utils.ScriptUtil;
|
import com.cool.store.utils.ScriptUtil;
|
||||||
import com.cool.store.utils.UUIDUtils;
|
import com.cool.store.utils.UUIDUtils;
|
||||||
import com.coolstore.base.enums.AppTypeEnum;
|
|
||||||
import com.coolstore.base.enums.RocketMqTagEnum;
|
|
||||||
import com.google.common.collect.Lists;
|
import com.google.common.collect.Lists;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.apache.commons.collections4.CollectionUtils;
|
import org.apache.commons.collections4.CollectionUtils;
|
||||||
|
|||||||
@@ -0,0 +1,389 @@
|
|||||||
|
package com.cool.store.service.impl;
|
||||||
|
|
||||||
|
import cn.hutool.core.util.StrUtil;
|
||||||
|
import com.cool.store.constants.CommonConstants;
|
||||||
|
import com.cool.store.context.CurrentUser;
|
||||||
|
import com.cool.store.dao.EnterpriseUserDAO;
|
||||||
|
import com.cool.store.dao.EnterpriseUserGroupDAO;
|
||||||
|
import com.cool.store.dao.EnterpriseUserGroupMappingDAO;
|
||||||
|
import com.cool.store.dao.EnterpriseUserRoleDAO;
|
||||||
|
import com.cool.store.dto.auth.AuthRegionStoreDTO;
|
||||||
|
import com.cool.store.dto.buser.SubordinateUserRangeDTO;
|
||||||
|
import com.cool.store.dto.usergroup.UserGroupAddRequest;
|
||||||
|
import com.cool.store.dto.usergroup.UserGroupDTO;
|
||||||
|
import com.cool.store.entity.EnterpriseUserDO;
|
||||||
|
import com.cool.store.entity.EnterpriseUserGroupDO;
|
||||||
|
import com.cool.store.entity.EnterpriseUserGroupMappingDO;
|
||||||
|
import com.cool.store.enums.ErrorCodeEnum;
|
||||||
|
import com.cool.store.exception.ServiceException;
|
||||||
|
import com.cool.store.service.AuthVisualService;
|
||||||
|
import com.cool.store.service.EnterpriseUserGroupService;
|
||||||
|
import com.cool.store.service.EnterpriseUserService;
|
||||||
|
import com.cool.store.service.SubordinateMappingService;
|
||||||
|
import com.cool.store.utils.UUIDUtils;
|
||||||
|
import com.cool.store.vo.buser.EnterpriseUserPageVO;
|
||||||
|
import com.cool.store.vo.usergroup.UserGroupVO;
|
||||||
|
import com.cool.store.vo.usergroup.UserSimpleDTO;
|
||||||
|
import com.github.pagehelper.PageHelper;
|
||||||
|
import com.github.pagehelper.PageInfo;
|
||||||
|
import com.google.common.collect.Lists;
|
||||||
|
import com.google.common.collect.Maps;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.apache.commons.collections4.CollectionUtils;
|
||||||
|
import org.apache.commons.collections4.ListUtils;
|
||||||
|
import org.apache.commons.collections4.MapUtils;
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
import org.springframework.beans.BeanUtils;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import java.util.*;
|
||||||
|
import java.util.function.Function;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
import java.util.stream.Stream;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author wxp
|
||||||
|
* @Date 2022/12/29 11:18
|
||||||
|
* @Version 1.0
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
@Slf4j
|
||||||
|
public class EnterpriseUserGroupServiceImpl implements EnterpriseUserGroupService {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private EnterpriseUserGroupDAO enterpriseUserGroupDAO;
|
||||||
|
@Resource
|
||||||
|
private EnterpriseUserGroupMappingDAO enterpriseUserGroupMappingDAO;
|
||||||
|
@Autowired
|
||||||
|
public EnterpriseUserService enterpriseUserService;
|
||||||
|
@Resource
|
||||||
|
private EnterpriseUserDAO enterpriseUserDAO;
|
||||||
|
@Resource
|
||||||
|
private AuthVisualService visualService;
|
||||||
|
@Resource
|
||||||
|
private SubordinateMappingService subordinateMappingService;
|
||||||
|
@Resource
|
||||||
|
private EnterpriseUserRoleDAO enterpriseUserRoleDAO;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Boolean saveOrUpdateUserGroup(String enterpriseId, UserGroupAddRequest userGroupAddRequest, CurrentUser currentUser) {
|
||||||
|
int count = enterpriseUserGroupDAO.countByGroupName(enterpriseId, userGroupAddRequest.getGroupName(), userGroupAddRequest.getGroupId());
|
||||||
|
if (count > 0) {
|
||||||
|
throw new ServiceException(ErrorCodeEnum.USER_GROUP_NAME_EXIST);
|
||||||
|
}
|
||||||
|
EnterpriseUserGroupDO userGroupDO = translateToUserGroupDO(userGroupAddRequest, currentUser);
|
||||||
|
if(StringUtils.isBlank(userGroupAddRequest.getGroupId())){
|
||||||
|
enterpriseUserGroupDAO.insertSelective(userGroupDO, enterpriseId);
|
||||||
|
}else {
|
||||||
|
enterpriseUserGroupDAO.updateByGroupId(userGroupDO, enterpriseId);
|
||||||
|
}
|
||||||
|
List<String> userIdList = userGroupAddRequest.getUserIdList();
|
||||||
|
if(CollectionUtils.isEmpty(userIdList)){
|
||||||
|
return Boolean.TRUE;
|
||||||
|
}
|
||||||
|
enterpriseUserGroupMappingDAO.deleteUserGroupMappingByGroupId(enterpriseId, userGroupDO.getGroupId());
|
||||||
|
List<EnterpriseUserGroupMappingDO> userGroupMappingDOList = new ArrayList<>();
|
||||||
|
for (String userId: userIdList) {
|
||||||
|
EnterpriseUserGroupMappingDO userGroupMappingDO = new EnterpriseUserGroupMappingDO();
|
||||||
|
userGroupMappingDO.setUserId(userId);
|
||||||
|
userGroupMappingDO.setGroupId(userGroupDO.getGroupId());
|
||||||
|
userGroupMappingDO.setCreateUserId(currentUser.getUserId());
|
||||||
|
userGroupMappingDO.setUpdateUserId(currentUser.getUserId());
|
||||||
|
userGroupMappingDOList.add(userGroupMappingDO);
|
||||||
|
}
|
||||||
|
if (CollectionUtils.isNotEmpty(userGroupMappingDOList)) {
|
||||||
|
enterpriseUserGroupMappingDAO.batchInsertOrUpdateUserGroupMapping(enterpriseId, userGroupMappingDOList);
|
||||||
|
}
|
||||||
|
return Boolean.TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Boolean updateUserGroup(String enterpriseId, Long userGroupId, List<String> userIdList){
|
||||||
|
enterpriseUserGroupMappingDAO.deleteUserGroupMappingByGroupId(enterpriseId, String.valueOf(userGroupId));
|
||||||
|
List<EnterpriseUserGroupMappingDO> userGroupMappingDOList = new ArrayList<>();
|
||||||
|
for (String userId: userIdList) {
|
||||||
|
EnterpriseUserGroupMappingDO userGroupMappingDO = new EnterpriseUserGroupMappingDO();
|
||||||
|
userGroupMappingDO.setUserId(userId);
|
||||||
|
userGroupMappingDO.setGroupId(String.valueOf(userGroupId));
|
||||||
|
userGroupMappingDO.setCreateUserId("");
|
||||||
|
userGroupMappingDO.setUpdateUserId("");
|
||||||
|
userGroupMappingDOList.add(userGroupMappingDO);
|
||||||
|
}
|
||||||
|
if (CollectionUtils.isNotEmpty(userGroupMappingDOList)) {
|
||||||
|
enterpriseUserGroupMappingDAO.batchInsertOrUpdateUserGroupMapping(enterpriseId, userGroupMappingDOList);
|
||||||
|
}
|
||||||
|
return Boolean.TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void batchDeleteGroup(String enterpriseId, String groupId, List<String> userIdList) {
|
||||||
|
enterpriseUserGroupMappingDAO.deleteMappingByGroupIdList(enterpriseId, groupId, userIdList);
|
||||||
|
if(CollectionUtils.isEmpty(userIdList)){
|
||||||
|
enterpriseUserGroupDAO.deleteByGroupIdList(enterpriseId, Collections.singletonList(groupId));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<UserGroupVO> listUserGroup(String enterpriseId, String groupName, CurrentUser user) {
|
||||||
|
List<EnterpriseUserGroupDO> userGroupDOList = enterpriseUserGroupDAO.listUserGroup(enterpriseId,groupName);
|
||||||
|
List<UserGroupVO> resultList = new ArrayList<>();
|
||||||
|
if (CollectionUtils.isEmpty(userGroupDOList)) {
|
||||||
|
return resultList;
|
||||||
|
}
|
||||||
|
List<String> groupIdList = userGroupDOList.stream().map(EnterpriseUserGroupDO::getGroupId).collect(Collectors.toList());
|
||||||
|
Set<String> userIdSet = userGroupDOList.stream()
|
||||||
|
.flatMap(c->Stream.of(c.getCreateUserId(),c.getUpdateUserId()))
|
||||||
|
.collect(Collectors.toSet());
|
||||||
|
List<EnterpriseUserDO> userDOList = enterpriseUserDAO.selectUsersByUserIds(enterpriseId, new ArrayList<>(userIdSet));
|
||||||
|
Map<String, EnterpriseUserDO> userMap = userDOList.stream().collect(Collectors.toMap(EnterpriseUserDO::getUserId, Function.identity()));
|
||||||
|
List<EnterpriseUserGroupMappingDO> userGroupMappingDOList = enterpriseUserGroupMappingDAO.listByGroupIdList(enterpriseId, groupIdList);
|
||||||
|
Map<String, List<EnterpriseUserGroupMappingDO>> userGroupMappingMap = userGroupMappingDOList.stream()
|
||||||
|
.collect(Collectors.groupingBy(EnterpriseUserGroupMappingDO::getGroupId));
|
||||||
|
for (EnterpriseUserGroupDO enterpriseUserGroupDO : userGroupDOList) {
|
||||||
|
UserGroupVO userGroupVO = new UserGroupVO();
|
||||||
|
userGroupVO.setCreateUserId(enterpriseUserGroupDO.getCreateUserId());
|
||||||
|
userGroupVO.setGroupId(enterpriseUserGroupDO.getGroupId());
|
||||||
|
userGroupVO.setGroupName(enterpriseUserGroupDO.getGroupName());
|
||||||
|
userGroupVO.setCreateTime(enterpriseUserGroupDO.getCreateTime());
|
||||||
|
userGroupVO.setUpdateTime(enterpriseUserGroupDO.getUpdateTime());
|
||||||
|
EnterpriseUserDO createUser = userMap.get(enterpriseUserGroupDO.getCreateUserId());
|
||||||
|
if (createUser != null) {
|
||||||
|
userGroupVO.setCreateUserName(createUser.getName());
|
||||||
|
}
|
||||||
|
EnterpriseUserDO updateUser = userMap.get(enterpriseUserGroupDO.getUpdateUserId());
|
||||||
|
if (updateUser != null) {
|
||||||
|
userGroupVO.setUpdateUserName(updateUser.getName());
|
||||||
|
}
|
||||||
|
if(!CollectionUtils.isEmpty(userGroupMappingMap.get(enterpriseUserGroupDO.getGroupId()))){
|
||||||
|
userGroupVO.setUserCount(userGroupMappingMap.get(enterpriseUserGroupDO.getGroupId()).size());
|
||||||
|
}
|
||||||
|
userGroupVO.setEditFlag(checkUserEditFlag(enterpriseId, enterpriseUserGroupDO, user.getUserId()));
|
||||||
|
resultList.add(userGroupVO);
|
||||||
|
}
|
||||||
|
return resultList;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public UserGroupVO getGroupInfo(String enterpriseId, String groupId, CurrentUser user) {
|
||||||
|
EnterpriseUserGroupDO userGroupDO = enterpriseUserGroupDAO.getByGroupId(enterpriseId, groupId);
|
||||||
|
if (userGroupDO == null) {
|
||||||
|
throw new ServiceException(ErrorCodeEnum.USER_GROUP_NOT_EXIST);
|
||||||
|
}
|
||||||
|
UserGroupVO userGroupVO = new UserGroupVO();
|
||||||
|
BeanUtils.copyProperties(userGroupDO, userGroupVO);
|
||||||
|
fillUserGroupVO(enterpriseId, userGroupDO, userGroupVO);
|
||||||
|
userGroupVO.setEditFlag(checkUserEditFlag(enterpriseId, userGroupDO, user.getUserId()));
|
||||||
|
return userGroupVO;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public PageInfo<EnterpriseUserPageVO> listUserByGroupId(String enterpriseId, String groupId, String userName, Integer pageNum, Integer pageSize, CurrentUser currentUser) {
|
||||||
|
PageHelper.startPage(pageNum,pageSize);
|
||||||
|
List<EnterpriseUserDO> enterpriseUserList = enterpriseUserDAO.listUserByGroupId(enterpriseId, groupId, userName, null);
|
||||||
|
PageInfo pageInfo = new PageInfo<>();
|
||||||
|
if (CollectionUtils.isEmpty(enterpriseUserList)) {
|
||||||
|
return pageInfo;
|
||||||
|
}
|
||||||
|
List<EnterpriseUserPageVO> resultList = new ArrayList<>();
|
||||||
|
resultList = EnterpriseUserPageVO.transUserDOToVO(enterpriseUserList);
|
||||||
|
pageInfo = new PageInfo<>(resultList);
|
||||||
|
//填充角色信息如果存在角色信息
|
||||||
|
List<String> userIdList = enterpriseUserService.initUserRole(enterpriseId, resultList);
|
||||||
|
List<AuthRegionStoreDTO> authRegionStoreDTOList = visualService.authRegionStoreByUserList(enterpriseId, userIdList);
|
||||||
|
Map<String, AuthRegionStoreDTO> authRegionStoreMap = ListUtils.emptyIfNull(authRegionStoreDTOList)
|
||||||
|
.stream()
|
||||||
|
.collect(Collectors.toMap(AuthRegionStoreDTO::getUserId, data -> data, (a, b) -> a));
|
||||||
|
Map<String, SubordinateUserRangeDTO> subordinateUserRangeMap = enterpriseUserService.fillUserSubordinateNames(enterpriseId, userIdList);
|
||||||
|
Map<String, String> userRegionMap = enterpriseUserService.getUserRegion(enterpriseId, userIdList);
|
||||||
|
|
||||||
|
Boolean haveAllSubordinateUser = subordinateMappingService.checkHaveAllSubordinateUser(enterpriseId, currentUser.getUserId());
|
||||||
|
List<String> userSubordinateList = Lists.newArrayList();
|
||||||
|
if(!haveAllSubordinateUser){
|
||||||
|
userSubordinateList = subordinateMappingService.getSubordinateUserIdList(enterpriseId, currentUser.getUserId(),Boolean.TRUE);
|
||||||
|
}
|
||||||
|
List<String> finalUserSubordinateList = userSubordinateList;
|
||||||
|
resultList.stream()
|
||||||
|
.forEach(data->{
|
||||||
|
if(MapUtils.isNotEmpty(authRegionStoreMap)&&authRegionStoreMap.get(data.getUserId())!=null){
|
||||||
|
AuthRegionStoreDTO authRegionStoreDTO = authRegionStoreMap.get(data.getUserId());
|
||||||
|
data.setAuthRegionStoreList(authRegionStoreDTO.getAuthRegionStoreUserList());
|
||||||
|
}
|
||||||
|
// 填充下属用户
|
||||||
|
if (subordinateUserRangeMap.get(data.getUserId()) != null){
|
||||||
|
data.setSubordinateUserRange(subordinateUserRangeMap.get(data.getUserId()).getSubordinateUserRange());
|
||||||
|
data.setSourceList(subordinateUserRangeMap.get(data.getUserId()).getSourceList());
|
||||||
|
data.setMySubordinates(subordinateUserRangeMap.get(data.getUserId()).getMySubordinates());
|
||||||
|
}
|
||||||
|
data.setDepartment(userRegionMap.get(data.getUserId()));
|
||||||
|
if(haveAllSubordinateUser){
|
||||||
|
data.setSelectFlag(true);
|
||||||
|
}else {
|
||||||
|
data.setSelectFlag(finalUserSubordinateList.contains(data.getUserId()));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return pageInfo;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void updateUserGroup(String enterpriseId, List<String> groupIdList, String userId, CurrentUser currentUser) {
|
||||||
|
if(CollectionUtils.isEmpty(groupIdList)){
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
enterpriseUserGroupMappingDAO.deleteMappingByUserIdList(enterpriseId, Collections.singletonList(userId));
|
||||||
|
List<EnterpriseUserGroupMappingDO> userGroupMappingDOList = new ArrayList<>();
|
||||||
|
for (String groupId: groupIdList) {
|
||||||
|
EnterpriseUserGroupMappingDO userGroupMappingDO = new EnterpriseUserGroupMappingDO();
|
||||||
|
userGroupMappingDO.setUserId(userId);
|
||||||
|
userGroupMappingDO.setGroupId(groupId);
|
||||||
|
userGroupMappingDO.setCreateUserId(currentUser.getUserId());
|
||||||
|
userGroupMappingDO.setUpdateUserId(currentUser.getUserId());
|
||||||
|
userGroupMappingDOList.add(userGroupMappingDO);
|
||||||
|
}
|
||||||
|
if (CollectionUtils.isNotEmpty(userGroupMappingDOList)) {
|
||||||
|
enterpriseUserGroupMappingDAO.batchInsertOrUpdateUserGroupMapping(enterpriseId, userGroupMappingDOList);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Boolean configUser(String enterpriseId, UserGroupAddRequest userGroupAddRequest, CurrentUser currentUser) {
|
||||||
|
EnterpriseUserGroupDO userGroupDO = enterpriseUserGroupDAO.getByGroupId(enterpriseId, userGroupAddRequest.getGroupId());
|
||||||
|
if (userGroupDO == null) {
|
||||||
|
throw new ServiceException(ErrorCodeEnum.USER_GROUP_NOT_EXIST);
|
||||||
|
}
|
||||||
|
List<String> userIdList = userGroupAddRequest.getUserIdList();
|
||||||
|
if(CollectionUtils.isEmpty(userIdList)){
|
||||||
|
return Boolean.TRUE;
|
||||||
|
}
|
||||||
|
List<EnterpriseUserGroupMappingDO> userGroupMappingDOList = new ArrayList<>();
|
||||||
|
for (String userId: userIdList) {
|
||||||
|
EnterpriseUserGroupMappingDO userGroupMappingDO = new EnterpriseUserGroupMappingDO();
|
||||||
|
userGroupMappingDO.setUserId(userId);
|
||||||
|
userGroupMappingDO.setGroupId(userGroupDO.getGroupId());
|
||||||
|
userGroupMappingDO.setCreateUserId(currentUser.getUserId());
|
||||||
|
userGroupMappingDO.setUpdateUserId(currentUser.getUserId());
|
||||||
|
userGroupMappingDOList.add(userGroupMappingDO);
|
||||||
|
}
|
||||||
|
if (CollectionUtils.isNotEmpty(userGroupMappingDOList)) {
|
||||||
|
enterpriseUserGroupMappingDAO.batchInsertOrUpdateUserGroupMapping(enterpriseId, userGroupMappingDOList);
|
||||||
|
}
|
||||||
|
return Boolean.TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Map<String, List<UserGroupDTO>> getUserGroupMap(String enterpriseId, List<String> userIdList) {
|
||||||
|
Map<String, List<UserGroupDTO>> resultMap = Maps.newHashMap();
|
||||||
|
if(CollectionUtils.isEmpty(userIdList)){
|
||||||
|
return resultMap;
|
||||||
|
}
|
||||||
|
List<EnterpriseUserGroupMappingDO> enterpriseUserGroupMappingDOList = enterpriseUserGroupMappingDAO.listByUserIdList(enterpriseId, userIdList);
|
||||||
|
List<String> allGroupIdList = ListUtils.emptyIfNull(enterpriseUserGroupMappingDOList)
|
||||||
|
.stream().map(EnterpriseUserGroupMappingDO::getGroupId)
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
List<EnterpriseUserGroupDO> userGroupDOList = enterpriseUserGroupDAO.listByGroupIdList(enterpriseId, allGroupIdList);
|
||||||
|
//封装 userId-userGroup map,以表示一个用户对应几个分组
|
||||||
|
Map<String, Set<String>> userGroupMap = ListUtils.emptyIfNull(enterpriseUserGroupMappingDOList)
|
||||||
|
.stream().collect(Collectors.groupingBy(EnterpriseUserGroupMappingDO::getUserId,
|
||||||
|
Collectors.mapping(EnterpriseUserGroupMappingDO::getGroupId, Collectors.toSet())));
|
||||||
|
//获得分组id -分组名称的map
|
||||||
|
Map<String, String> groupNameMap = ListUtils.emptyIfNull(userGroupDOList)
|
||||||
|
.stream()
|
||||||
|
.filter(data -> StringUtils.isNotBlank(data.getGroupName()))
|
||||||
|
.collect(Collectors.toMap(EnterpriseUserGroupDO::getGroupId, EnterpriseUserGroupDO::getGroupName, (a, b) -> a));
|
||||||
|
userIdList.forEach(userId -> {
|
||||||
|
Set<String> groupIdList = userGroupMap.get(userId);
|
||||||
|
if (CollectionUtils.isNotEmpty(groupIdList)) {
|
||||||
|
List<UserGroupDTO> userGroupDTOList = resultMap.get(userId);
|
||||||
|
if (CollectionUtils.isEmpty(userGroupDTOList)) {
|
||||||
|
userGroupDTOList = Lists.newArrayList();
|
||||||
|
resultMap.put(userId, userGroupDTOList);
|
||||||
|
}
|
||||||
|
for (String groupId: groupIdList) {
|
||||||
|
UserGroupDTO userGroupDTO = new UserGroupDTO();
|
||||||
|
userGroupDTO.setGroupId(groupId);
|
||||||
|
userGroupDTO.setGroupName(groupNameMap.get(groupId));
|
||||||
|
userGroupDTOList.add(userGroupDTO);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return resultMap;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void fillUserGroupVO(String enterpriseId, EnterpriseUserGroupDO userGroupDO, UserGroupVO userGroupVO) {
|
||||||
|
List<EnterpriseUserGroupMappingDO> userGroupMappingDOList = enterpriseUserGroupMappingDAO.listByGroupIdList(enterpriseId, Collections.singletonList(userGroupDO.getGroupId()));
|
||||||
|
if (CollectionUtils.isNotEmpty(userGroupMappingDOList)){
|
||||||
|
List<String> configUserIdList = userGroupMappingDOList.stream().map(EnterpriseUserGroupMappingDO::getUserId).collect(Collectors.toList());
|
||||||
|
List<EnterpriseUserDO> enterpriseUserDOList = enterpriseUserDAO.selectUsersByUserIds(enterpriseId, configUserIdList);
|
||||||
|
List<UserSimpleDTO> configUserList = ListUtils.emptyIfNull(enterpriseUserDOList).stream()
|
||||||
|
.map(this::translateToUserSimpleDTO)
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
userGroupVO.setConfigUserList(configUserList);
|
||||||
|
}
|
||||||
|
if(StringUtils.isNotBlank(userGroupDO.getCommonEditUserids())){
|
||||||
|
List<String> commonEditUserIdList = StrUtil.splitTrim(userGroupDO.getCommonEditUserids(), ",");
|
||||||
|
List<EnterpriseUserDO> enterpriseUserDOList = enterpriseUserDAO.selectUsersByUserIds(enterpriseId, commonEditUserIdList);
|
||||||
|
List<UserSimpleDTO> commonEditUserList = ListUtils.emptyIfNull(enterpriseUserDOList).stream()
|
||||||
|
.map(this::translateToUserSimpleDTO)
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
userGroupVO.setCommonEditUserList(commonEditUserList);
|
||||||
|
}
|
||||||
|
|
||||||
|
List<String> userIdList = Lists.newArrayList();
|
||||||
|
userIdList.add(userGroupDO.getCreateUserId());
|
||||||
|
userIdList.add(userGroupDO.getUpdateUserId());
|
||||||
|
List<EnterpriseUserDO> userDOList = enterpriseUserDAO.selectUsersByUserIds(enterpriseId, userIdList);
|
||||||
|
Map<String, EnterpriseUserDO> userMap = userDOList.stream().collect(Collectors.toMap(EnterpriseUserDO::getUserId, Function.identity()));
|
||||||
|
EnterpriseUserDO createUser = userMap.get(userGroupDO.getCreateUserId());
|
||||||
|
if (createUser != null) {
|
||||||
|
userGroupVO.setCreateUserName(createUser.getName());
|
||||||
|
}
|
||||||
|
EnterpriseUserDO updateUser = userMap.get(userGroupDO.getUpdateUserId());
|
||||||
|
if (updateUser != null) {
|
||||||
|
userGroupVO.setUpdateUserName(updateUser.getName());
|
||||||
|
}
|
||||||
|
if (CommonConstants.SYSTEM_USER_ID.equals(userGroupDO.getCreateUserId())) {
|
||||||
|
userGroupVO.setCreateUserName(CommonConstants.SYSTEM_USER_ID);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private UserSimpleDTO translateToUserSimpleDTO(EnterpriseUserDO enterpriseUserDO) {
|
||||||
|
UserSimpleDTO userSimpleDTO = new UserSimpleDTO();
|
||||||
|
userSimpleDTO.setUserId(enterpriseUserDO.getUserId());
|
||||||
|
userSimpleDTO.setUserName(enterpriseUserDO.getName());
|
||||||
|
return userSimpleDTO;
|
||||||
|
}
|
||||||
|
|
||||||
|
public EnterpriseUserGroupDO translateToUserGroupDO(UserGroupAddRequest request, CurrentUser user) {
|
||||||
|
EnterpriseUserGroupDO userGroupDO = new EnterpriseUserGroupDO();
|
||||||
|
String groupId = StringUtils.isNotBlank(request.getGroupId()) ? request.getGroupId() : UUIDUtils.get32UUID();
|
||||||
|
userGroupDO.setGroupId(groupId);
|
||||||
|
userGroupDO.setGroupName(request.getGroupName());
|
||||||
|
if(CollectionUtils.isNotEmpty(request.getCommonEditUserIdList())){
|
||||||
|
userGroupDO.setCommonEditUserids(CommonConstants.COMMA + StringUtils.join(request.getCommonEditUserIdList(), CommonConstants.COMMA) + CommonConstants.COMMA);
|
||||||
|
}else {
|
||||||
|
userGroupDO.setCommonEditUserids("");
|
||||||
|
}
|
||||||
|
if(StringUtils.isNotBlank(request.getGroupId())){
|
||||||
|
userGroupDO.setUpdateTime(new Date());
|
||||||
|
userGroupDO.setUpdateUserId(user.getUserId());
|
||||||
|
}else {
|
||||||
|
userGroupDO.setCreateTime(new Date());
|
||||||
|
userGroupDO.setCreateUserId(user.getUserId());
|
||||||
|
}
|
||||||
|
return userGroupDO;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// 校验用户是否有编辑权限
|
||||||
|
public Boolean checkUserEditFlag(String eid, EnterpriseUserGroupDO enterpriseUserGroupDO, String userId){
|
||||||
|
// 是否管理员
|
||||||
|
boolean isAdmin = enterpriseUserRoleDAO.checkIsAdmin(eid, userId);
|
||||||
|
if(isAdmin || userId.equals(enterpriseUserGroupDO.getCreateUserId()) || (StringUtils.isNotBlank(enterpriseUserGroupDO.getCommonEditUserids()) && enterpriseUserGroupDO.getCommonEditUserids().contains(userId))){
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -1,17 +1,30 @@
|
|||||||
package com.cool.store.service.impl;
|
package com.cool.store.service.impl;
|
||||||
|
|
||||||
|
import cn.hutool.core.util.StrUtil;
|
||||||
import com.cool.store.constants.CommonConstants;
|
import com.cool.store.constants.CommonConstants;
|
||||||
import com.cool.store.context.CurrentUser;
|
import com.cool.store.context.CurrentUser;
|
||||||
import com.cool.store.dao.EnterpriseUserDAO;
|
import com.cool.store.dao.*;
|
||||||
import com.cool.store.dao.RegionDAO;
|
import com.cool.store.dto.auth.AuthRegionStoreDTO;
|
||||||
import com.cool.store.dao.UserRegionMappingDAO;
|
import com.cool.store.dto.auth.AuthStoreCountDTO;
|
||||||
import com.cool.store.entity.EnterpriseUserDO;
|
import com.cool.store.dto.buser.MySubordinatesDTO;
|
||||||
import com.cool.store.entity.RegionDO;
|
import com.cool.store.dto.buser.SubordinateUserRangeDTO;
|
||||||
import com.cool.store.entity.UserRegionMappingDO;
|
import com.cool.store.dto.buser.UserRoleDTO;
|
||||||
|
import com.cool.store.dto.region.RegionPathDTO;
|
||||||
|
import com.cool.store.dto.usergroup.UserGroupDTO;
|
||||||
|
import com.cool.store.entity.*;
|
||||||
|
import com.cool.store.enums.SubordinateSourceEnum;
|
||||||
|
import com.cool.store.enums.UserSelectRangeEnum;
|
||||||
|
import com.cool.store.service.AuthVisualService;
|
||||||
|
import com.cool.store.service.EnterpriseUserGroupService;
|
||||||
import com.cool.store.service.EnterpriseUserService;
|
import com.cool.store.service.EnterpriseUserService;
|
||||||
|
import com.cool.store.vo.buser.EnterpriseUserPageVO;
|
||||||
|
import com.github.pagehelper.PageHelper;
|
||||||
|
import com.google.common.collect.Maps;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.apache.commons.collections4.CollectionUtils;
|
import org.apache.commons.collections4.CollectionUtils;
|
||||||
import org.apache.commons.collections4.ListUtils;
|
import org.apache.commons.collections4.ListUtils;
|
||||||
|
import org.apache.commons.collections4.MapUtils;
|
||||||
|
import org.apache.commons.collections4.SetUtils;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
@@ -35,6 +48,14 @@ public class EnterpriseUserServiceImpl implements EnterpriseUserService {
|
|||||||
private RegionDAO regionDAO;
|
private RegionDAO regionDAO;
|
||||||
@Resource
|
@Resource
|
||||||
private EnterpriseUserDAO enterpriseUserDAO;
|
private EnterpriseUserDAO enterpriseUserDAO;
|
||||||
|
@Resource
|
||||||
|
private AuthVisualService authVisualService;
|
||||||
|
@Resource
|
||||||
|
private EnterpriseUserRoleDAO enterpriseUserRoleDAO;
|
||||||
|
@Resource
|
||||||
|
private EnterpriseUserGroupService enterpriseUserGroupService;
|
||||||
|
@Resource
|
||||||
|
private SubordinateMappingDAO subordinateMappingDAO;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void updateUserRegionPathList(String enterpriseId, List<String> userIds) {
|
public void updateUserRegionPathList(String enterpriseId, List<String> userIds) {
|
||||||
@@ -91,6 +112,100 @@ public class EnterpriseUserServiceImpl implements EnterpriseUserService {
|
|||||||
enterpriseUserDAO.batchUpdateDiffUserDiffRegionIds(enterpriseId, enterpriseUserList);
|
enterpriseUserDAO.batchUpdateDiffUserDiffRegionIds(enterpriseId, enterpriseUserList);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<EnterpriseUserPageVO> listUser(String enterpriseId, String userName, String deptId,
|
||||||
|
String orderBy, String orderRule,
|
||||||
|
Long roleId, Integer userStatus, Integer pageNum, Integer pageSize, String jobNumber, String regionId, Boolean hasPage) {
|
||||||
|
if (hasPage){
|
||||||
|
PageHelper.startPage(pageNum,pageSize);
|
||||||
|
}
|
||||||
|
List<EnterpriseUserDO> enterpriseUserList = new ArrayList<>();
|
||||||
|
//企微用户 用户名在数据表中加密,需要再次请求企业端接口根据名称去筛选数据
|
||||||
|
if(roleId!=null){
|
||||||
|
enterpriseUserList = enterpriseUserDAO.fuzzyUsersByDepartment(enterpriseId, deptId, roleId, orderBy, orderRule, userName, jobNumber, userStatus, null,regionId);
|
||||||
|
}else {
|
||||||
|
enterpriseUserList= enterpriseUserDAO.fuzzyUsersByNotRole(enterpriseId, deptId, orderBy, orderRule, userName, jobNumber, userStatus, null,regionId);
|
||||||
|
}
|
||||||
|
List<EnterpriseUserPageVO> resultList = new ArrayList<>();
|
||||||
|
if(CollectionUtils.isEmpty(enterpriseUserList)){
|
||||||
|
return resultList;
|
||||||
|
}
|
||||||
|
resultList = EnterpriseUserPageVO.transUserDOToVO(enterpriseUserList);
|
||||||
|
//填充角色信息如果存在角色信息
|
||||||
|
List<String> userIdList = initUserRole(enterpriseId, resultList);
|
||||||
|
//根据人员查询该人员所在部门集合
|
||||||
|
List<UserRegionMappingDO> userRegionMappingDOS = userRegionMappingDAO.listUserRegionMappingByUserId(enterpriseId, userIdList);
|
||||||
|
//regionids 集合
|
||||||
|
List<String> regionIds = ListUtils.emptyIfNull(userRegionMappingDOS).stream().map(UserRegionMappingDO::getRegionId).distinct().collect(Collectors.toList());
|
||||||
|
|
||||||
|
List<RegionDO> regionDOs = new ArrayList<>();
|
||||||
|
if (CollectionUtils.isNotEmpty(regionIds)){
|
||||||
|
regionDOs = regionDAO.getRegionByRegionIds(enterpriseId, regionIds);
|
||||||
|
}
|
||||||
|
//部门map KV key-部门id value-部门名称
|
||||||
|
Map<String, String> regionMap = ListUtils.emptyIfNull(regionDOs)
|
||||||
|
.stream()
|
||||||
|
.filter(a->a.getId()!=null&&a.getName()!=null)
|
||||||
|
.collect(Collectors.toMap(data->data.getId().toString(), RegionDO::getName, (a, b) -> a));
|
||||||
|
//人员所在部门map key-人员id value-部门set集合(set去重)
|
||||||
|
Map<String, Set<String>> userRegionMap = ListUtils.emptyIfNull(userRegionMappingDOS)
|
||||||
|
.stream().filter(a->a.getId()!=null&&a.getRegionId()!=null)
|
||||||
|
.collect(Collectors.groupingBy(UserRegionMappingDO::getUserId,
|
||||||
|
Collectors.mapping(UserRegionMappingDO::getRegionId, Collectors.toSet())));
|
||||||
|
|
||||||
|
//填充门店总数以及权限区域列表
|
||||||
|
List<AuthRegionStoreDTO> authRegionStoreDTOList = authVisualService.authRegionStoreByUserList(enterpriseId, userIdList);
|
||||||
|
List<AuthStoreCountDTO> authStoreCountDTOS = authVisualService.authStoreCount(enterpriseId, userIdList, false);
|
||||||
|
Map<String, AuthStoreCountDTO> storeCountMap = ListUtils.emptyIfNull(authStoreCountDTOS)
|
||||||
|
.stream()
|
||||||
|
.collect(Collectors.toMap(AuthStoreCountDTO::getUserId, data -> data, (a, b) -> a));
|
||||||
|
Map<String, AuthRegionStoreDTO> authRegionStoreMap = ListUtils.emptyIfNull(authRegionStoreDTOList)
|
||||||
|
.stream()
|
||||||
|
.collect(Collectors.toMap(AuthRegionStoreDTO::getUserId, data -> data, (a, b) -> a));
|
||||||
|
|
||||||
|
Map<String, List<UserGroupDTO>> userGroupMap = enterpriseUserGroupService.getUserGroupMap(enterpriseId, userIdList);
|
||||||
|
Map<String, SubordinateUserRangeDTO> subordinateUserRangeMap = fillUserSubordinateNames(enterpriseId, userIdList);
|
||||||
|
|
||||||
|
resultList.stream()
|
||||||
|
.forEach(data->{
|
||||||
|
if(MapUtils.isNotEmpty(authRegionStoreMap)&&authRegionStoreMap.get(data.getUserId())!=null){
|
||||||
|
AuthRegionStoreDTO authRegionStoreDTO = authRegionStoreMap.get(data.getUserId());
|
||||||
|
data.setAuthRegionStoreList(authRegionStoreDTO.getAuthRegionStoreUserList());
|
||||||
|
}
|
||||||
|
if(MapUtils.isNotEmpty(storeCountMap)&&storeCountMap.get(data.getUserId())!=null){
|
||||||
|
AuthStoreCountDTO authStoreCountDTO = storeCountMap.get(data.getUserId());
|
||||||
|
if(authStoreCountDTO.getStoreCount()!=null){
|
||||||
|
data.setStoreCount(authStoreCountDTO.getStoreCount());
|
||||||
|
}else {
|
||||||
|
data.setStoreCount(0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(MapUtils.isNotEmpty(userRegionMap)&&MapUtils.isNotEmpty(regionMap)) {
|
||||||
|
Set<String> regions = userRegionMap.get(data.getUserId());
|
||||||
|
String deptNames = SetUtils.emptyIfNull(regions)
|
||||||
|
.stream()
|
||||||
|
.map(dept -> regionMap.get(dept.toString()))
|
||||||
|
.filter(StringUtils::isNotBlank)
|
||||||
|
.collect(Collectors.joining(CommonConstants.COMMA));
|
||||||
|
data.setDepartment(deptNames);
|
||||||
|
}
|
||||||
|
//填充用户分组
|
||||||
|
data.setUserGroupList(userGroupMap.get(data.getUserId()));
|
||||||
|
// 填充下属用户
|
||||||
|
if (subordinateUserRangeMap.get(data.getUserId()) != null){
|
||||||
|
data.setSubordinateUserRange(subordinateUserRangeMap.get(data.getUserId()).getSubordinateUserRange());
|
||||||
|
data.setSourceList(subordinateUserRangeMap.get(data.getUserId()).getSourceList());
|
||||||
|
data.setMySubordinates(subordinateUserRangeMap.get(data.getUserId()).getMySubordinates());
|
||||||
|
}
|
||||||
|
});
|
||||||
|
// 添加至常用联系人
|
||||||
|
if (StringUtils.isNotBlank(userName)) {
|
||||||
|
List<String> userIds = enterpriseUserList.stream().map(EnterpriseUserDO::getUserId).collect(Collectors.toList());
|
||||||
|
//lruService.putRecentUseUser(enterpriseId, UserHolder.getUser().getUserId(), userIds);
|
||||||
|
}
|
||||||
|
return resultList;
|
||||||
|
}
|
||||||
|
|
||||||
private void addUserRegionMappingDO(String enterpriseId,String userId,String regionId,CurrentUser currentUser){
|
private void addUserRegionMappingDO(String enterpriseId,String userId,String regionId,CurrentUser currentUser){
|
||||||
UserRegionMappingDO userRegionMappingDO = new UserRegionMappingDO();
|
UserRegionMappingDO userRegionMappingDO = new UserRegionMappingDO();
|
||||||
userRegionMappingDO.setUserId(userId);
|
userRegionMappingDO.setUserId(userId);
|
||||||
@@ -102,4 +217,154 @@ public class EnterpriseUserServiceImpl implements EnterpriseUserService {
|
|||||||
//将用户添加到未分组
|
//将用户添加到未分组
|
||||||
userRegionMappingDAO.batchInsertRegionMapping(enterpriseId, Arrays.asList(userRegionMappingDO));
|
userRegionMappingDAO.batchInsertRegionMapping(enterpriseId, Arrays.asList(userRegionMappingDO));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Map<String, SubordinateUserRangeDTO> fillUserSubordinateNames(String enterpriseId, List<String> userIdList) {
|
||||||
|
Map<String, SubordinateUserRangeDTO> subordinateUserRangeMap = Maps.newHashMap();
|
||||||
|
if (CollectionUtils.isNotEmpty(userIdList)) {
|
||||||
|
//查询该用户的下属
|
||||||
|
List<SubordinateMappingDO> subordinateMappingDOS = subordinateMappingDAO.selectByUserIds(enterpriseId, userIdList);
|
||||||
|
|
||||||
|
List<EnterpriseUserDO> enterpriseUserDOS = enterpriseUserDAO.selectUsersByUserIds(enterpriseId, userIdList);
|
||||||
|
Map<String, String> subordinateRangeMap = ListUtils.emptyIfNull(enterpriseUserDOS).stream().collect(Collectors.toMap(EnterpriseUserDO::getUserId, EnterpriseUserDO::getSubordinateRange));
|
||||||
|
|
||||||
|
List<SubordinateMappingDO> defineSelectMappingLit = subordinateMappingDOS.stream().filter(x -> SubordinateSourceEnum.SELECT.getCode().equals(x.getSource())).collect(Collectors.toList());
|
||||||
|
Map<String, List<SubordinateMappingDO>> defineSelectMappingMap = ListUtils.emptyIfNull(defineSelectMappingLit).stream()
|
||||||
|
.collect(Collectors.groupingBy(SubordinateMappingDO::getUserId));
|
||||||
|
userIdList.forEach(userId -> {
|
||||||
|
SubordinateUserRangeDTO subordinateUserRangeDTO = new SubordinateUserRangeDTO();
|
||||||
|
subordinateUserRangeMap.put(userId, subordinateUserRangeDTO);
|
||||||
|
String subordinateUserRange = subordinateRangeMap.get(userId);
|
||||||
|
if (StringUtils.isNotBlank(subordinateUserRange)) {
|
||||||
|
subordinateUserRangeDTO.setSubordinateUserRange(subordinateUserRange);
|
||||||
|
if (UserSelectRangeEnum.DEFINE.getCode().equals(subordinateUserRange)) {
|
||||||
|
List<SubordinateMappingDO> myDefineSelectMappingLit = defineSelectMappingMap.get(userId);
|
||||||
|
List<String> regionIds = ListUtils.emptyIfNull(myDefineSelectMappingLit).stream().filter(x -> StringUtils.isNotBlank(x.getRegionId()))
|
||||||
|
.map(SubordinateMappingDO::getRegionId).collect(Collectors.toList());
|
||||||
|
Map<String, String> regionMap = new HashMap<>();
|
||||||
|
List<RegionPathDTO> regionPathByList = regionDAO.getRegionPathByList(enterpriseId, regionIds);
|
||||||
|
regionMap = regionPathByList.stream().collect(Collectors.toMap(RegionPathDTO::getRegionId, RegionPathDTO::getRegionName));
|
||||||
|
|
||||||
|
List<String> personalIds = ListUtils.emptyIfNull(myDefineSelectMappingLit).stream().filter(x -> StringUtils.isNotBlank(x.getPersonalId()))
|
||||||
|
.map(SubordinateMappingDO::getPersonalId).collect(Collectors.toList());
|
||||||
|
|
||||||
|
List<EnterpriseUserDO> personalList = new ArrayList<>();
|
||||||
|
if (CollectionUtils.isNotEmpty(personalIds)) {
|
||||||
|
personalList = enterpriseUserDAO.selectUsersByUserIds(enterpriseId, personalIds);
|
||||||
|
}
|
||||||
|
Map<String, String> personalMap = personalList.stream().collect(Collectors.toMap(EnterpriseUserDO::getUserId, EnterpriseUserDO::getName));
|
||||||
|
|
||||||
|
List<MySubordinatesDTO> nodeTypeList = new ArrayList<>();
|
||||||
|
|
||||||
|
if (CollectionUtils.isNotEmpty(myDefineSelectMappingLit)) {
|
||||||
|
for (SubordinateMappingDO item : myDefineSelectMappingLit) {
|
||||||
|
MySubordinatesDTO nodeTypeDTO = new MySubordinatesDTO();
|
||||||
|
if (StringUtils.isNotBlank(item.getRegionId())) {
|
||||||
|
String regionName = regionMap.get(item.getRegionId());
|
||||||
|
nodeTypeDTO.setNodeType("region");
|
||||||
|
nodeTypeDTO.setRegionName(regionName);
|
||||||
|
nodeTypeDTO.setRegionId(item.getRegionId());
|
||||||
|
}
|
||||||
|
if (StringUtils.isNotBlank(item.getPersonalId())) {
|
||||||
|
String personalName = personalMap.get(item.getPersonalId());
|
||||||
|
nodeTypeDTO.setNodeType("personal");
|
||||||
|
nodeTypeDTO.setPersonalName(personalName);
|
||||||
|
nodeTypeDTO.setPersonalId(item.getPersonalId());
|
||||||
|
}
|
||||||
|
nodeTypeList.add(nodeTypeDTO);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
List<String> sourceList = subordinateMappingDOS.stream().filter(x -> StringUtils.isNotBlank(x.getSource()))
|
||||||
|
.map(SubordinateMappingDO::getSource).distinct().collect(Collectors.toList());
|
||||||
|
subordinateUserRangeDTO.setSourceList(sourceList);
|
||||||
|
if (CollectionUtils.isEmpty(sourceList)) {
|
||||||
|
subordinateUserRangeDTO.setSourceList(Collections.singletonList(SubordinateSourceEnum.AUTO.getCode()));
|
||||||
|
}
|
||||||
|
subordinateUserRangeDTO.setMySubordinates(nodeTypeList);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
return subordinateUserRangeMap;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<String> initUserRole(String enterpriseId, List<EnterpriseUserPageVO> enterpriseUserList) {
|
||||||
|
List<String> userIdList = ListUtils.emptyIfNull(enterpriseUserList)
|
||||||
|
.stream()
|
||||||
|
.map(EnterpriseUserPageVO::getUserId)
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
|
||||||
|
if(CollectionUtils.isNotEmpty(userIdList)){
|
||||||
|
List<UserRoleDTO> userRoleDTOS = enterpriseUserRoleDAO.getUserAndRolesByUserId(enterpriseId, userIdList);
|
||||||
|
//封装 userId-userRole map,以表示一个用户对应几个角色
|
||||||
|
Map<String, List<Long>> userRoleDtoMap = new HashMap<>();
|
||||||
|
userRoleDTOS.forEach(roleDto -> {
|
||||||
|
List<Long> check = userRoleDtoMap.get(roleDto.getUserId());
|
||||||
|
if (check == null) {
|
||||||
|
List<Long> roleDtoList = new ArrayList<>();
|
||||||
|
roleDtoList.add(roleDto.getRoleId());
|
||||||
|
userRoleDtoMap.put(roleDto.getUserId(), roleDtoList);
|
||||||
|
} else {
|
||||||
|
check.add(roleDto.getRoleId());
|
||||||
|
userRoleDtoMap.put(roleDto.getUserId(), check);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
//获得角色id -角色名称的map
|
||||||
|
Map<Long, String> roleNameMap = ListUtils.emptyIfNull(userRoleDTOS)
|
||||||
|
.stream()
|
||||||
|
.filter(data -> StringUtils.isNotBlank(data.getRoleName()))
|
||||||
|
.collect(Collectors.toMap(UserRoleDTO::getRoleId, UserRoleDTO::getRoleName, (a, b) -> a));
|
||||||
|
enterpriseUserList.forEach(user -> {
|
||||||
|
List<Long> roleIdList = userRoleDtoMap.get(user.getUserId());
|
||||||
|
if (roleIdList != null && roleIdList.size() != 0) {
|
||||||
|
String roleName = roleIdList.stream()
|
||||||
|
.filter(data -> roleNameMap.get(data) != null)
|
||||||
|
.map(role -> roleNameMap.get(role))
|
||||||
|
.collect(Collectors.joining(","));
|
||||||
|
user.setRoleName(roleName);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
return userIdList;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Map<String, String> getUserRegion(String enterpriseId, List<String> userIdList) {
|
||||||
|
Map<String, String> resultMap = Maps.newHashMap();
|
||||||
|
//根据人员查询该人员所在部门集合
|
||||||
|
List<UserRegionMappingDO> userRegionMappingDOS = userRegionMappingDAO.listUserRegionMappingByUserId(enterpriseId, userIdList);
|
||||||
|
//regionids 集合
|
||||||
|
List<String> regionIds = ListUtils.emptyIfNull(userRegionMappingDOS).stream()
|
||||||
|
.map(UserRegionMappingDO::getRegionId).distinct().collect(Collectors.toList());
|
||||||
|
|
||||||
|
List<RegionDO> regionDOs = new ArrayList<>();
|
||||||
|
if (CollectionUtils.isNotEmpty(regionIds)){
|
||||||
|
regionDOs = regionDAO.getRegionByRegionIds(enterpriseId, regionIds);
|
||||||
|
}
|
||||||
|
//部门map KV key-部门id value-部门名称
|
||||||
|
Map<String, String> regionMap = ListUtils.emptyIfNull(regionDOs)
|
||||||
|
.stream()
|
||||||
|
.filter(a->a.getId()!=null&&a.getName()!=null)
|
||||||
|
.collect(Collectors.toMap(data->data.getId().toString(), RegionDO::getName, (a, b) -> a));
|
||||||
|
//人员所在部门map key-人员id value-部门set集合(set去重)
|
||||||
|
Map<String, Set<String>> userRegionMap = ListUtils.emptyIfNull(userRegionMappingDOS)
|
||||||
|
.stream().filter(a->a.getId()!=null&&a.getRegionId()!=null)
|
||||||
|
.collect(Collectors.groupingBy(UserRegionMappingDO::getUserId,
|
||||||
|
Collectors.mapping(UserRegionMappingDO::getRegionId, Collectors.toSet())));
|
||||||
|
userIdList.stream()
|
||||||
|
.forEach(userId->{
|
||||||
|
if(MapUtils.isNotEmpty(userRegionMap)&&MapUtils.isNotEmpty(regionMap)) {
|
||||||
|
Set<String> regions = userRegionMap.get(userId);
|
||||||
|
|
||||||
|
String deptNames = SetUtils.emptyIfNull(regions)
|
||||||
|
.stream()
|
||||||
|
.map(dept -> regionMap.get(dept.toString()))
|
||||||
|
.filter(StrUtil::isNotBlank)
|
||||||
|
.collect(Collectors.joining(CommonConstants.COMMA));
|
||||||
|
resultMap.put(userId, deptNames);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return resultMap;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,164 @@
|
|||||||
|
package com.cool.store.service.impl;
|
||||||
|
|
||||||
|
import com.cool.store.constants.CommonConstants;
|
||||||
|
import com.cool.store.dao.EnterpriseUserDAO;
|
||||||
|
import com.cool.store.dao.EnterpriseUserRoleDAO;
|
||||||
|
import com.cool.store.dao.SubordinateMappingDAO;
|
||||||
|
import com.cool.store.entity.EnterpriseUserDO;
|
||||||
|
import com.cool.store.entity.SubordinateMappingDO;
|
||||||
|
import com.cool.store.entity.UserAuthMappingDO;
|
||||||
|
import com.cool.store.enums.SubordinateSourceEnum;
|
||||||
|
import com.cool.store.enums.UserSelectRangeEnum;
|
||||||
|
import com.cool.store.mapper.EnterpriseUserMapper;
|
||||||
|
import com.cool.store.mapper.UserAuthMappingMapper;
|
||||||
|
import com.cool.store.service.EnterpriseUserService;
|
||||||
|
import com.cool.store.service.SubordinateMappingService;
|
||||||
|
import com.google.common.collect.Lists;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.apache.commons.collections4.CollectionUtils;
|
||||||
|
import org.apache.commons.collections4.ListUtils;
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author wxp
|
||||||
|
* @Date 2023/1/6 11:18
|
||||||
|
* @Version 1.0
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
@Slf4j
|
||||||
|
public class SubordinateMappingServiceImpl implements SubordinateMappingService {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private SubordinateMappingDAO subordinateMappingDAO;
|
||||||
|
@Autowired
|
||||||
|
private EnterpriseUserService enterpriseUserService;
|
||||||
|
@Resource
|
||||||
|
private EnterpriseUserMapper enterpriseUserMapper;
|
||||||
|
@Resource
|
||||||
|
private EnterpriseUserDAO enterpriseUserDAO;
|
||||||
|
@Resource
|
||||||
|
private EnterpriseUserRoleDAO enterpriseUserRoleDAO;
|
||||||
|
@Resource
|
||||||
|
private UserAuthMappingMapper userAuthMappingMapper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 判断用户是否管辖全部用户
|
||||||
|
* @param enterpriseId
|
||||||
|
* @param currentUserId
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public Boolean checkHaveAllSubordinateUser(String enterpriseId, String currentUserId) {
|
||||||
|
if(CommonConstants.SYSTEM_USER_ID.equals(currentUserId)){
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
// 判断是否是管理员
|
||||||
|
boolean isAdmin = enterpriseUserRoleDAO.checkIsAdmin(enterpriseId, currentUserId);
|
||||||
|
EnterpriseUserDO user = enterpriseUserDAO.getUserInfoById(enterpriseId, currentUserId);
|
||||||
|
//失效人员没有权限
|
||||||
|
if(user == null){
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if(isAdmin || UserSelectRangeEnum.ALL.getCode().equals(user.getSubordinateRange())){
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取管辖用户
|
||||||
|
* @param enterpriseId
|
||||||
|
* @param currentUserId
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public List<String> getSubordinateUserIdList(String enterpriseId, String currentUserId,Boolean addCurrentFlag) {
|
||||||
|
|
||||||
|
List<String> allUserIdList = Lists.newArrayList();
|
||||||
|
if (addCurrentFlag){
|
||||||
|
allUserIdList.add(currentUserId);
|
||||||
|
}
|
||||||
|
EnterpriseUserDO user = enterpriseUserDAO.getUserInfoById(enterpriseId, currentUserId);
|
||||||
|
// 查询管辖用户
|
||||||
|
List<SubordinateMappingDO> subordinateMappingList = subordinateMappingDAO.selectByUserIds(enterpriseId, Collections.singletonList(currentUserId));
|
||||||
|
// 如果用户关联用户配置是自定义,但是没有具体数据,默认关联区域门店区域权限下的人
|
||||||
|
if(user != null && UserSelectRangeEnum.DEFINE.getCode().equals(user.getSubordinateRange()) && CollectionUtils.isEmpty(subordinateMappingList)){
|
||||||
|
subordinateMappingList = Lists.newArrayList();
|
||||||
|
SubordinateMappingDO subordinateMappingDO = fillDefaultAutoSubordinate(currentUserId, UserSelectRangeEnum.DEFINE.getCode(), SubordinateSourceEnum.AUTO.getCode());
|
||||||
|
subordinateMappingList.add(subordinateMappingDO);
|
||||||
|
subordinateMappingDAO.batchInsertSubordinateMapping(enterpriseId, subordinateMappingList);
|
||||||
|
}
|
||||||
|
|
||||||
|
List<String> sourceList = ListUtils.emptyIfNull(subordinateMappingList).stream().filter(x -> StringUtils.isNotBlank(x.getSource()))
|
||||||
|
.map(SubordinateMappingDO::getSource).distinct().collect(Collectors.toList());
|
||||||
|
|
||||||
|
//自动关联单独查询 过滤自动关联
|
||||||
|
subordinateMappingList = ListUtils.emptyIfNull(subordinateMappingList).stream().filter(o -> !SubordinateSourceEnum.AUTO.getCode().equals(o.getSource())).collect(Collectors.toList());
|
||||||
|
|
||||||
|
List<String> regionIds = ListUtils.emptyIfNull(subordinateMappingList).stream().filter(x -> StringUtils.isNotBlank(x.getRegionId()))
|
||||||
|
.map(SubordinateMappingDO::getRegionId).collect(Collectors.toList());
|
||||||
|
List<String> personalIds = ListUtils.emptyIfNull(subordinateMappingList).stream().filter(x -> StringUtils.isNotBlank(x.getPersonalId()))
|
||||||
|
.map(SubordinateMappingDO::getPersonalId).collect(Collectors.toList());
|
||||||
|
if(CollectionUtils.isNotEmpty(personalIds)) {
|
||||||
|
allUserIdList.addAll(personalIds);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(CollectionUtils.isNotEmpty(sourceList) && sourceList.contains(SubordinateSourceEnum.AUTO.getCode())) {
|
||||||
|
List<UserAuthMappingDO> userAuthList = userAuthMappingMapper.listUserAuthMappingByUserId(enterpriseId, currentUserId);
|
||||||
|
List<String> authRegionIdList = ListUtils.emptyIfNull(userAuthList)
|
||||||
|
.stream().map(UserAuthMappingDO::getMappingId)
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
regionIds.addAll(authRegionIdList);
|
||||||
|
}
|
||||||
|
if(CollectionUtils.isNotEmpty(regionIds)) {
|
||||||
|
List<EnterpriseUserDO> enterpriseUserDOList = enterpriseUserMapper.listByRegionIdList(enterpriseId, regionIds);
|
||||||
|
if (CollectionUtils.isNotEmpty(enterpriseUserDOList)) {
|
||||||
|
List<String> enterpriseUserIds = enterpriseUserDOList.stream()
|
||||||
|
.map(EnterpriseUserDO::getUserId)
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
allUserIdList.addAll(enterpriseUserIds);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
allUserIdList = allUserIdList.stream().distinct().collect(Collectors.toList());
|
||||||
|
return allUserIdList;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 保留管辖用户 userId管辖用户范围
|
||||||
|
* @param enterpriseId
|
||||||
|
* @param currentUserId
|
||||||
|
* @param userIdList
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public List<String> retainSubordinateUserIdList(String enterpriseId, String currentUserId, List<String> userIdList,Boolean addCurrentFlag) {
|
||||||
|
Boolean flag = this.checkHaveAllSubordinateUser(enterpriseId, currentUserId);
|
||||||
|
if(flag){
|
||||||
|
return userIdList;
|
||||||
|
}
|
||||||
|
List<String> subordinateUserIdList = getSubordinateUserIdList(enterpriseId, currentUserId,addCurrentFlag);
|
||||||
|
userIdList.retainAll(subordinateUserIdList);
|
||||||
|
return userIdList;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private SubordinateMappingDO fillDefaultAutoSubordinate(String userId, String userRange, String source) {
|
||||||
|
SubordinateMappingDO subordinateMappingDO = new SubordinateMappingDO();
|
||||||
|
subordinateMappingDO.setUserId(userId);
|
||||||
|
subordinateMappingDO.setRegionId(CommonConstants.ZERO_STR);
|
||||||
|
subordinateMappingDO.setCreateId(CommonConstants.SYSTEM_USER_ID);
|
||||||
|
subordinateMappingDO.setUpdateId(CommonConstants.SYSTEM_USER_ID);
|
||||||
|
subordinateMappingDO.setType(CommonConstants.ZERO);
|
||||||
|
subordinateMappingDO.setUserRange(userRange);
|
||||||
|
subordinateMappingDO.setSource(source);
|
||||||
|
return subordinateMappingDO;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -18,7 +18,6 @@
|
|||||||
<orderEntry type="library" name="Maven: com.alibaba:fastjson:1.2.60" level="project" />
|
<orderEntry type="library" name="Maven: com.alibaba:fastjson:1.2.60" level="project" />
|
||||||
<orderEntry type="library" name="Maven: org.apache.commons:commons-collections4:4.1" level="project" />
|
<orderEntry type="library" name="Maven: org.apache.commons:commons-collections4:4.1" level="project" />
|
||||||
<orderEntry type="library" name="Maven: org.apache.commons:commons-pool2:2.8.0" level="project" />
|
<orderEntry type="library" name="Maven: org.apache.commons:commons-pool2:2.8.0" level="project" />
|
||||||
<orderEntry type="library" name="Maven: redis.clients:jedis:2.8.0" level="project" />
|
|
||||||
<orderEntry type="library" name="Maven: org.apache.tika:tika-core:1.9" level="project" />
|
<orderEntry type="library" name="Maven: org.apache.tika:tika-core:1.9" level="project" />
|
||||||
<orderEntry type="library" name="Maven: xerces:xercesImpl:2.11.0" level="project" />
|
<orderEntry type="library" name="Maven: xerces:xercesImpl:2.11.0" level="project" />
|
||||||
<orderEntry type="library" name="Maven: xml-apis:xml-apis:1.4.01" level="project" />
|
<orderEntry type="library" name="Maven: xml-apis:xml-apis:1.4.01" level="project" />
|
||||||
@@ -30,9 +29,6 @@
|
|||||||
<orderEntry type="library" name="Maven: org.mybatis:mybatis:3.5.9" level="project" />
|
<orderEntry type="library" name="Maven: org.mybatis:mybatis:3.5.9" level="project" />
|
||||||
<orderEntry type="library" name="Maven: org.mybatis:mybatis-spring:2.0.7" level="project" />
|
<orderEntry type="library" name="Maven: org.mybatis:mybatis-spring:2.0.7" level="project" />
|
||||||
<orderEntry type="library" name="Maven: com.github.pagehelper:pagehelper-spring-boot-autoconfigure:1.4.6" level="project" />
|
<orderEntry type="library" name="Maven: com.github.pagehelper:pagehelper-spring-boot-autoconfigure:1.4.6" level="project" />
|
||||||
<orderEntry type="library" name="Maven: com.github.pagehelper:pagehelper:5.3.2" level="project" />
|
|
||||||
<orderEntry type="library" name="Maven: com.github.jsqlparser:jsqlparser:4.5" level="project" />
|
|
||||||
<orderEntry type="library" name="Maven: com.coolstore:coolstore-base:1.5.3" level="project" />
|
|
||||||
<orderEntry type="library" name="Maven: com.google.guava:guava:20.0" level="project" />
|
<orderEntry type="library" name="Maven: com.google.guava:guava:20.0" level="project" />
|
||||||
<orderEntry type="module" module-name="coolstore-partner-dao" />
|
<orderEntry type="module" module-name="coolstore-partner-dao" />
|
||||||
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-jdbc:3.0.2" level="project" />
|
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-jdbc:3.0.2" level="project" />
|
||||||
@@ -85,6 +81,13 @@
|
|||||||
<orderEntry type="library" name="Maven: com.squareup.okio:okio:1.17.2" level="project" />
|
<orderEntry type="library" name="Maven: com.squareup.okio:okio:1.17.2" level="project" />
|
||||||
<orderEntry type="library" name="Maven: com.aliyun:ons20190214:1.0.0" level="project" />
|
<orderEntry type="library" name="Maven: com.aliyun:ons20190214:1.0.0" level="project" />
|
||||||
<orderEntry type="library" name="Maven: com.aliyun:endpoint-util:0.0.6" level="project" />
|
<orderEntry type="library" name="Maven: com.aliyun:endpoint-util:0.0.6" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: com.github.pagehelper:pagehelper:5.3.2" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: com.github.jsqlparser:jsqlparser:4.5" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: redis.clients:jedis:2.8.0" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.springframework:spring-web:5.2.5.RELEASE" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.springframework:spring-beans:5.2.5.RELEASE" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.springframework:spring-core:5.2.5.RELEASE" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.springframework:spring-jcl:5.2.5.RELEASE" level="project" />
|
||||||
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-web:2.2.6.RELEASE" level="project" />
|
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-web:2.2.6.RELEASE" level="project" />
|
||||||
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter:2.2.6.RELEASE" level="project" />
|
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter:2.2.6.RELEASE" level="project" />
|
||||||
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot:2.2.6.RELEASE" level="project" />
|
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot:2.2.6.RELEASE" level="project" />
|
||||||
@@ -96,8 +99,6 @@
|
|||||||
<orderEntry type="library" name="Maven: org.apache.logging.log4j:log4j-api:2.12.1" level="project" />
|
<orderEntry type="library" name="Maven: org.apache.logging.log4j:log4j-api:2.12.1" level="project" />
|
||||||
<orderEntry type="library" name="Maven: org.slf4j:jul-to-slf4j:1.7.30" level="project" />
|
<orderEntry type="library" name="Maven: org.slf4j:jul-to-slf4j:1.7.30" level="project" />
|
||||||
<orderEntry type="library" name="Maven: jakarta.annotation:jakarta.annotation-api:1.3.5" level="project" />
|
<orderEntry type="library" name="Maven: jakarta.annotation:jakarta.annotation-api:1.3.5" level="project" />
|
||||||
<orderEntry type="library" name="Maven: org.springframework:spring-core:5.2.5.RELEASE" level="project" />
|
|
||||||
<orderEntry type="library" name="Maven: org.springframework:spring-jcl:5.2.5.RELEASE" level="project" />
|
|
||||||
<orderEntry type="library" scope="RUNTIME" name="Maven: org.yaml:snakeyaml:1.25" level="project" />
|
<orderEntry type="library" scope="RUNTIME" name="Maven: org.yaml:snakeyaml:1.25" level="project" />
|
||||||
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-json:2.2.6.RELEASE" level="project" />
|
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-json:2.2.6.RELEASE" level="project" />
|
||||||
<orderEntry type="library" name="Maven: com.fasterxml.jackson.core:jackson-databind:2.10.3" level="project" />
|
<orderEntry type="library" name="Maven: com.fasterxml.jackson.core:jackson-databind:2.10.3" level="project" />
|
||||||
@@ -115,8 +116,6 @@
|
|||||||
<orderEntry type="library" name="Maven: org.hibernate.validator:hibernate-validator:6.0.18.Final" level="project" />
|
<orderEntry type="library" name="Maven: org.hibernate.validator:hibernate-validator:6.0.18.Final" level="project" />
|
||||||
<orderEntry type="library" name="Maven: org.jboss.logging:jboss-logging:3.4.1.Final" level="project" />
|
<orderEntry type="library" name="Maven: org.jboss.logging:jboss-logging:3.4.1.Final" level="project" />
|
||||||
<orderEntry type="library" name="Maven: com.fasterxml:classmate:1.5.1" level="project" />
|
<orderEntry type="library" name="Maven: com.fasterxml:classmate:1.5.1" level="project" />
|
||||||
<orderEntry type="library" name="Maven: org.springframework:spring-web:5.2.5.RELEASE" level="project" />
|
|
||||||
<orderEntry type="library" name="Maven: org.springframework:spring-beans:5.2.5.RELEASE" level="project" />
|
|
||||||
<orderEntry type="library" name="Maven: org.springframework:spring-webmvc:5.2.5.RELEASE" level="project" />
|
<orderEntry type="library" name="Maven: org.springframework:spring-webmvc:5.2.5.RELEASE" level="project" />
|
||||||
<orderEntry type="library" name="Maven: org.springframework:spring-aop:5.2.5.RELEASE" level="project" />
|
<orderEntry type="library" name="Maven: org.springframework:spring-aop:5.2.5.RELEASE" level="project" />
|
||||||
<orderEntry type="library" name="Maven: org.springframework:spring-context:5.2.5.RELEASE" level="project" />
|
<orderEntry type="library" name="Maven: org.springframework:spring-context:5.2.5.RELEASE" level="project" />
|
||||||
|
|||||||
@@ -0,0 +1,53 @@
|
|||||||
|
package com.cool.store.controller;
|
||||||
|
|
||||||
|
import com.cool.store.dto.enterprise.EnterpriseUserDTO;
|
||||||
|
import com.cool.store.response.ResponseResult;
|
||||||
|
import com.cool.store.service.EnterpriseUserService;
|
||||||
|
import com.cool.store.utils.DataSourceHelper;
|
||||||
|
import com.cool.store.vo.buser.EnterpriseUserPageVO;
|
||||||
|
import com.github.pagehelper.PageInfo;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.apache.commons.collections4.CollectionUtils;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author zhangchenbiao
|
||||||
|
* @FileName: EnterpriseUserController
|
||||||
|
* @Description:
|
||||||
|
* @date 2023-05-30 17:20
|
||||||
|
*/
|
||||||
|
@RestController
|
||||||
|
@RequestMapping({"/enterprises/{enterprise-id}/users"})
|
||||||
|
@Slf4j
|
||||||
|
public class EnterpriseUserController {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
public EnterpriseUserService enterpriseUserService;
|
||||||
|
|
||||||
|
@GetMapping(path = "/dept/userList")
|
||||||
|
public ResponseResult<PageInfo<EnterpriseUserPageVO>> getUserList(@PathVariable(value = "enterprise-id", required = true) String eid,
|
||||||
|
@RequestParam(name = "user_name", required = false) String userName,
|
||||||
|
@RequestParam(name = "dept_id", required = false) String deptId,
|
||||||
|
@RequestParam(name = "role_id", required = false) Long roleId,
|
||||||
|
@RequestParam(name = "order_by", required = false) String orderBy,
|
||||||
|
@RequestParam(name = "order_rule", required = false, defaultValue = "asc") String orderRule,
|
||||||
|
@RequestParam(name = "user_status", required = false) Integer userStatus,
|
||||||
|
@RequestParam(name = "page_num", required = false, defaultValue = "1") Integer pageNum,
|
||||||
|
@RequestParam(name = "page_size", required = false, defaultValue = "10") Integer pageSize,
|
||||||
|
@RequestParam(name = "job_number", required = false) String jobNumber,
|
||||||
|
@RequestParam(name = "region_id", required = false) String regionId,
|
||||||
|
@RequestParam(name = "has_page", required = false,defaultValue = "true") Boolean hasPage) {
|
||||||
|
DataSourceHelper.changeToMy();
|
||||||
|
List<EnterpriseUserPageVO> deptUserList = enterpriseUserService.listUser(eid, userName, deptId, orderBy, orderRule, roleId, userStatus, pageNum, pageSize, jobNumber,regionId,hasPage);
|
||||||
|
if(CollectionUtils.isNotEmpty(deptUserList)){
|
||||||
|
return ResponseResult.success(new PageInfo<>(deptUserList));
|
||||||
|
}else {
|
||||||
|
return ResponseResult.success(new PageInfo<>());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -18,7 +18,6 @@
|
|||||||
<orderEntry type="library" name="Maven: com.alibaba:fastjson:1.2.60" level="project" />
|
<orderEntry type="library" name="Maven: com.alibaba:fastjson:1.2.60" level="project" />
|
||||||
<orderEntry type="library" name="Maven: org.apache.commons:commons-collections4:4.1" level="project" />
|
<orderEntry type="library" name="Maven: org.apache.commons:commons-collections4:4.1" level="project" />
|
||||||
<orderEntry type="library" name="Maven: org.apache.commons:commons-pool2:2.8.0" level="project" />
|
<orderEntry type="library" name="Maven: org.apache.commons:commons-pool2:2.8.0" level="project" />
|
||||||
<orderEntry type="library" name="Maven: redis.clients:jedis:2.8.0" level="project" />
|
|
||||||
<orderEntry type="library" name="Maven: org.apache.tika:tika-core:1.9" level="project" />
|
<orderEntry type="library" name="Maven: org.apache.tika:tika-core:1.9" level="project" />
|
||||||
<orderEntry type="library" name="Maven: xerces:xercesImpl:2.11.0" level="project" />
|
<orderEntry type="library" name="Maven: xerces:xercesImpl:2.11.0" level="project" />
|
||||||
<orderEntry type="library" name="Maven: xml-apis:xml-apis:1.4.01" level="project" />
|
<orderEntry type="library" name="Maven: xml-apis:xml-apis:1.4.01" level="project" />
|
||||||
@@ -30,9 +29,6 @@
|
|||||||
<orderEntry type="library" name="Maven: org.mybatis:mybatis:3.5.9" level="project" />
|
<orderEntry type="library" name="Maven: org.mybatis:mybatis:3.5.9" level="project" />
|
||||||
<orderEntry type="library" name="Maven: org.mybatis:mybatis-spring:2.0.7" level="project" />
|
<orderEntry type="library" name="Maven: org.mybatis:mybatis-spring:2.0.7" level="project" />
|
||||||
<orderEntry type="library" name="Maven: com.github.pagehelper:pagehelper-spring-boot-autoconfigure:1.4.6" level="project" />
|
<orderEntry type="library" name="Maven: com.github.pagehelper:pagehelper-spring-boot-autoconfigure:1.4.6" level="project" />
|
||||||
<orderEntry type="library" name="Maven: com.github.pagehelper:pagehelper:5.3.2" level="project" />
|
|
||||||
<orderEntry type="library" name="Maven: com.github.jsqlparser:jsqlparser:4.5" level="project" />
|
|
||||||
<orderEntry type="library" name="Maven: com.coolstore:coolstore-base:1.5.3" level="project" />
|
|
||||||
<orderEntry type="library" name="Maven: com.google.guava:guava:20.0" level="project" />
|
<orderEntry type="library" name="Maven: com.google.guava:guava:20.0" level="project" />
|
||||||
<orderEntry type="module" module-name="coolstore-partner-dao" />
|
<orderEntry type="module" module-name="coolstore-partner-dao" />
|
||||||
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-jdbc:3.0.2" level="project" />
|
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-jdbc:3.0.2" level="project" />
|
||||||
@@ -85,6 +81,11 @@
|
|||||||
<orderEntry type="library" name="Maven: com.squareup.okio:okio:1.17.2" level="project" />
|
<orderEntry type="library" name="Maven: com.squareup.okio:okio:1.17.2" level="project" />
|
||||||
<orderEntry type="library" name="Maven: com.aliyun:ons20190214:1.0.0" level="project" />
|
<orderEntry type="library" name="Maven: com.aliyun:ons20190214:1.0.0" level="project" />
|
||||||
<orderEntry type="library" name="Maven: com.aliyun:endpoint-util:0.0.6" level="project" />
|
<orderEntry type="library" name="Maven: com.aliyun:endpoint-util:0.0.6" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: com.github.pagehelper:pagehelper:5.3.2" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: com.github.jsqlparser:jsqlparser:4.5" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: redis.clients:jedis:2.8.0" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.springframework:spring-web:5.2.5.RELEASE" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.springframework:spring-beans:5.2.5.RELEASE" level="project" />
|
||||||
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-web:2.2.6.RELEASE" level="project" />
|
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-web:2.2.6.RELEASE" level="project" />
|
||||||
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-json:2.2.6.RELEASE" level="project" />
|
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-json:2.2.6.RELEASE" level="project" />
|
||||||
<orderEntry type="library" name="Maven: com.fasterxml.jackson.core:jackson-databind:2.10.3" level="project" />
|
<orderEntry type="library" name="Maven: com.fasterxml.jackson.core:jackson-databind:2.10.3" level="project" />
|
||||||
@@ -102,8 +103,6 @@
|
|||||||
<orderEntry type="library" name="Maven: org.hibernate.validator:hibernate-validator:6.0.18.Final" level="project" />
|
<orderEntry type="library" name="Maven: org.hibernate.validator:hibernate-validator:6.0.18.Final" level="project" />
|
||||||
<orderEntry type="library" name="Maven: org.jboss.logging:jboss-logging:3.4.1.Final" level="project" />
|
<orderEntry type="library" name="Maven: org.jboss.logging:jboss-logging:3.4.1.Final" level="project" />
|
||||||
<orderEntry type="library" name="Maven: com.fasterxml:classmate:1.5.1" level="project" />
|
<orderEntry type="library" name="Maven: com.fasterxml:classmate:1.5.1" level="project" />
|
||||||
<orderEntry type="library" name="Maven: org.springframework:spring-web:5.2.5.RELEASE" level="project" />
|
|
||||||
<orderEntry type="library" name="Maven: org.springframework:spring-beans:5.2.5.RELEASE" level="project" />
|
|
||||||
<orderEntry type="library" name="Maven: org.springframework:spring-webmvc:5.2.5.RELEASE" level="project" />
|
<orderEntry type="library" name="Maven: org.springframework:spring-webmvc:5.2.5.RELEASE" level="project" />
|
||||||
<orderEntry type="library" name="Maven: org.springframework:spring-aop:5.2.5.RELEASE" level="project" />
|
<orderEntry type="library" name="Maven: org.springframework:spring-aop:5.2.5.RELEASE" level="project" />
|
||||||
<orderEntry type="library" name="Maven: org.springframework:spring-context:5.2.5.RELEASE" level="project" />
|
<orderEntry type="library" name="Maven: org.springframework:spring-context:5.2.5.RELEASE" level="project" />
|
||||||
|
|||||||
5
pom.xml
5
pom.xml
@@ -136,11 +136,6 @@
|
|||||||
<artifactId>hutool-all</artifactId>
|
<artifactId>hutool-all</artifactId>
|
||||||
<version>5.0.7</version>
|
<version>5.0.7</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
|
||||||
<groupId>com.coolstore</groupId>
|
|
||||||
<artifactId>coolstore-base</artifactId>
|
|
||||||
<version>1.5.3</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.aliyun</groupId>
|
<groupId>com.aliyun</groupId>
|
||||||
<artifactId>tea-openapi</artifactId>
|
<artifactId>tea-openapi</artifactId>
|
||||||
|
|||||||
Reference in New Issue
Block a user