diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/constant/ServiceConstant.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/constant/ServiceConstant.java index e104c83e54..221d7d3f69 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/constant/ServiceConstant.java +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/constant/ServiceConstant.java @@ -140,7 +140,7 @@ public interface ServiceConstant { String EPMET_POINT_SERVER = "epmet-point-server"; /** - * 开放接口服务 + * 聚合查询服务 */ - String EPMET_EXT_SERVER = "epmet-ext-server"; + String DATA_AGGREGATOR_SERVER = "data-aggregator-server"; } diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/feign/CommonUserFeignClient.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/feign/CommonUserFeignClient.java new file mode 100644 index 0000000000..70b2a1abc5 --- /dev/null +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/feign/CommonUserFeignClient.java @@ -0,0 +1,26 @@ +package com.epmet.commons.tools.feign; + +import com.epmet.commons.tools.constant.ServiceConstant; +import com.epmet.commons.tools.feign.fallback.CommonUserFeignClientFallBackFactory; +import com.epmet.commons.tools.redis.common.bean.CustomerStaffInfoCache; +import com.epmet.commons.tools.utils.Result; +import org.springframework.cloud.openfeign.FeignClient; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.PostMapping; + + +/** + * @Description + * @Author sun + */ +@FeignClient(name = ServiceConstant.DATA_AGGREGATOR_SERVER, fallbackFactory = CommonUserFeignClientFallBackFactory.class) +public interface CommonUserFeignClient { + + /** + * desc:根据工作人员Id 获取工作人员信息 + * @param staffId + * @return + */ + @PostMapping("/data/aggregator/epmetuser/getStaffInfo/{staffId}") + Result getStaffInfo(@PathVariable("staffId") String staffId); +} diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/feign/fallback/CommonUserFeignClientFallBackFactory.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/feign/fallback/CommonUserFeignClientFallBackFactory.java new file mode 100644 index 0000000000..af8bd61954 --- /dev/null +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/feign/fallback/CommonUserFeignClientFallBackFactory.java @@ -0,0 +1,19 @@ +package com.epmet.commons.tools.feign.fallback; + +import com.epmet.commons.tools.exception.ExceptionUtils; +import com.epmet.commons.tools.feign.CommonUserFeignClient; +import feign.hystrix.FallbackFactory; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Component; + +@Component +@Slf4j +public class CommonUserFeignClientFallBackFactory implements FallbackFactory { + private CommonUserFeignClientFallback fallback = new CommonUserFeignClientFallback(); + + @Override + public CommonUserFeignClient create(Throwable cause) { + log.error(String.format("FeignClient调用发生异常,异常信息:%s", ExceptionUtils.getThrowableErrorStackTrace(cause))); + return fallback; + } +} diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/feign/fallback/CommonUserFeignClientFallback.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/feign/fallback/CommonUserFeignClientFallback.java new file mode 100644 index 0000000000..7dca0b3552 --- /dev/null +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/feign/fallback/CommonUserFeignClientFallback.java @@ -0,0 +1,23 @@ +package com.epmet.commons.tools.feign.fallback; + +import com.epmet.commons.tools.constant.ServiceConstant; +import com.epmet.commons.tools.feign.CommonUserFeignClient; +import com.epmet.commons.tools.redis.common.bean.CustomerStaffInfoCache; +import com.epmet.commons.tools.utils.ModuleUtils; +import com.epmet.commons.tools.utils.Result; +import org.springframework.stereotype.Component; + +/** + * 调用政府端权限 + * @Author wxz + * @Description + * @Date 2020/4/24 11:17 + **/ +@Component +public class CommonUserFeignClientFallback implements CommonUserFeignClient { + + @Override + public Result getStaffInfo(String staffId) { + return ModuleUtils.feignConError(ServiceConstant.DATA_AGGREGATOR_SERVER, "getStaffInfo", staffId); + } +} diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/RedisKeys.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/RedisKeys.java index 046802e321..8f669a3656 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/RedisKeys.java +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/RedisKeys.java @@ -490,4 +490,14 @@ public class RedisKeys { public static String getNoRepeatSubmitKey(String key) { return rootPrefix.concat("no_repeat_submit:").concat(key); } + + /** + * desc:根据工作人员Id 获取工作人员缓存key + * @param customerId + * @param staffId + * @return + */ + public static String getCustomerStaffInfoKey(String customerId, String staffId) { + return rootPrefix.concat(customerId).concat(StrConstant.COLON).concat(staffId); + } } diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/common/CustomerStaffRedis.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/common/CustomerStaffRedis.java new file mode 100644 index 0000000000..f45e1b46f8 --- /dev/null +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/common/CustomerStaffRedis.java @@ -0,0 +1,100 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.commons.tools.redis.common; + +import cn.hutool.core.bean.BeanUtil; +import com.alibaba.fastjson.JSON; +import com.epmet.commons.tools.exception.RenException; +import com.epmet.commons.tools.feign.CommonUserFeignClient; +import com.epmet.commons.tools.redis.RedisKeys; +import com.epmet.commons.tools.redis.RedisUtils; +import com.epmet.commons.tools.redis.common.bean.CustomerStaffInfoCache; +import com.epmet.commons.tools.utils.ConvertUtils; +import com.epmet.commons.tools.utils.Result; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +import java.util.Map; + +import static com.epmet.commons.tools.redis.RedisUtils.NOT_EXPIRE; + +/** + * 工作人员缓存 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-04-22 + */ +@Component +public class CustomerStaffRedis { + @Autowired + private RedisUtils redisUtils; + @Autowired + private CommonUserFeignClient commonUserFeignClient; + + //@PostConstruct + public void init(){ + CustomerStaffInfoCache role = this.getRole("45687aa479955f9d06204d415238f7cc", "9e37adcce6472152e6508a19d3683e02"); + System.out.println(JSON.toJSONString(role)); + } + + /** + * @Description 查询工作人员的角色 + * @Param customerId + * @Param userId + * @author zxc + * @date 2021/6/15 3:20 下午 + */ + public CustomerStaffInfoCache getRole(String customerId, String staffId){ + String key = RedisKeys.getCustomerStaffInfoKey(customerId,staffId); + Map roleMap = redisUtils.hGetAll(key); + boolean empty = roleMap.isEmpty(); + if (!empty){ + CustomerStaffInfoCache result = ConvertUtils.mapToEntity(roleMap, CustomerStaffInfoCache.class); + return result; + } + try { + Result staffResult = commonUserFeignClient.getStaffInfo(staffId); + if (staffResult == null || !staffResult.success()){ + throw new RenException("获取工作人员信息失败"); + } + if (staffResult.getData() == null){ + return null; + } + Map map = BeanUtil.beanToMap(staffResult.getData(), false, true); + redisUtils.hMSet(key,map); + } catch (Exception e) { + e.printStackTrace(); + } + return null; + } + + /** + * @Description 放入缓存角色 + * @Param customerId + * @Param userId + * @Param dto + * @author zxc + * @date 2021/6/15 4:01 下午 + */ + public void setRole(String customerId, String staffId, CustomerStaffInfoCache dto){ + String key = RedisKeys.getCustomerStaffInfoKey(customerId,staffId); + Map map = BeanUtil.beanToMap(dto, false, true); + redisUtils.hMSet(key, map,NOT_EXPIRE); + } + +} diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/common/bean/CustomerStaffInfoCache.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/common/bean/CustomerStaffInfoCache.java new file mode 100644 index 0000000000..63eaa7ccf0 --- /dev/null +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/common/bean/CustomerStaffInfoCache.java @@ -0,0 +1,62 @@ +package com.epmet.commons.tools.redis.common.bean; + +import lombok.Data; + +import java.io.Serializable; +import java.util.Map; + +/** + * @Author zxc + * @DateTime 2021/6/15 10:00 上午 + * @DESC + */ +@Data +public class CustomerStaffInfoCache implements Serializable { + + private static final long serialVersionUID = -4078910245000135305L; + /** + * 工作人员所属组织ID + */ + private String agencyId; + + /** + * 工作人员所属组织名称 + */ + private String agencyName; + + /** + * 工作人员ID + */ + private String staffId; + + /** + * 真实姓名 + */ + private String realName; + + /** + * 性别0.未知,1男,2.女 + */ + private Integer gender; + + /** + * 手机号-唯一键 + */ + private String mobile; + + /** + * 头像 + */ + private String headPhoto; + + /** + * 角色map key为角色key value 为角色名称 + */ + private Map roleMap; + + /** + * 工作人员所在网格及部门列表 + */ + private StaffOrgsCache orgInfo; + +} diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/common/bean/StaffOrgsCache.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/common/bean/StaffOrgsCache.java new file mode 100644 index 0000000000..db790af859 --- /dev/null +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/common/bean/StaffOrgsCache.java @@ -0,0 +1,54 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.commons.tools.redis.common.bean; + +import lombok.Data; + +import java.io.Serializable; +import java.util.List; + +/** + * desc: 工作人员所属的组织关系 + * @date 2021/8/19 10:07 上午 + */ +@Data +public class StaffOrgsCache implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 所属组织的上级组织 + */ + private IdAndName parentAgency; + + /** + * 所属网格列表 + */ + private List gridList; + + /** + * 所属部门 + */ + private List deptList; + + @Data + class IdAndName { + private String id; + private String name; + } +} diff --git a/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/constant/DataSourceConstant.java b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/constant/DataSourceConstant.java index d9eea40501..c6a3b0e1bc 100644 --- a/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/constant/DataSourceConstant.java +++ b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/constant/DataSourceConstant.java @@ -32,4 +32,5 @@ public interface DataSourceConstant { String EVALUATION_INDEX = "evaluationIndex"; String OPERCUSTOMIZE="opercustomize"; + String EPMET_MESSAGE="epmentmessage"; } diff --git a/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/epmetuser/form/RoleUsersFormDTO.java b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/epmetuser/form/RoleUsersFormDTO.java new file mode 100644 index 0000000000..5978cd7c2c --- /dev/null +++ b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/epmetuser/form/RoleUsersFormDTO.java @@ -0,0 +1,19 @@ +package com.epmet.dataaggre.dto.epmetuser.form; + +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import java.io.Serializable; + +/** + * @Description + * @Author zhaoqifeng + * @Data 2021/8/19 14:06 + */ +@Data +public class RoleUsersFormDTO implements Serializable { + private static final long serialVersionUID = -7732382052293191415L; + @NotBlank(message = "角色ID不能为空") + private String roleId; + private String customerId; +} diff --git a/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/epmetuser/result/CustomerStaffResultDTO.java b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/epmetuser/result/CustomerStaffResultDTO.java new file mode 100644 index 0000000000..03f7f669be --- /dev/null +++ b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/epmetuser/result/CustomerStaffResultDTO.java @@ -0,0 +1,63 @@ +package com.epmet.dataaggre.dto.epmetuser.result; + +import com.epmet.commons.tools.redis.common.bean.StaffOrgsCache; +import lombok.Data; + +import java.io.Serializable; +import java.util.Map; + +/** + * @Author zxc + * @DateTime 2021/6/15 10:00 上午 + * @DESC + */ +@Data +public class CustomerStaffResultDTO implements Serializable { + + private static final long serialVersionUID = 6989603307304337912L; + /** + * 工作人员所属组织ID + */ + private String agencyId; + + /** + * 工作人员所属组织名称 + */ + private String agencyName; + + /** + * 工作人员ID + */ + private String staffId; + + /** + * 真实姓名 + */ + private String realName; + + /** + * 性别0.未知,1男,2.女 + */ + private Integer gender; + + /** + * 手机号-唯一键 + */ + private String mobile; + + /** + * 头像 + */ + private String headPhoto; + + /** + * 角色map key为角色key value 为角色名称 + */ + private Map roleMap; + + /** + * 工作人员所在网格及部门列表 + */ + private StaffOrgsCache orgInfo; + +} diff --git a/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/epmetuser/result/RoleListResultDTO.java b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/epmetuser/result/RoleListResultDTO.java new file mode 100644 index 0000000000..84a597245d --- /dev/null +++ b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/epmetuser/result/RoleListResultDTO.java @@ -0,0 +1,23 @@ +package com.epmet.dataaggre.dto.epmetuser.result; + +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.io.Serializable; + +/** + * @Description + * @Author zhaoqifeng + * @Date 2021/8/19 14:16 + */ +@NoArgsConstructor +@Data +public class RoleListResultDTO implements Serializable { + + private static final long serialVersionUID = -9030492894290373999L; + private String roleId; + private String description; + private String roleName; + private String roleKey; + private Integer staffNum; +} diff --git a/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/epmetuser/result/RoleUsersResultDTO.java b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/epmetuser/result/RoleUsersResultDTO.java new file mode 100644 index 0000000000..250c4025bd --- /dev/null +++ b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/epmetuser/result/RoleUsersResultDTO.java @@ -0,0 +1,25 @@ +package com.epmet.dataaggre.dto.epmetuser.result; + +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.io.Serializable; +import java.util.List; + +/** + * @Description + * @Author zhaoqifeng + * @Date 2021/8/19 14:06 + */ +@NoArgsConstructor +@Data +public class RoleUsersResultDTO implements Serializable { + + private static final long serialVersionUID = 7109847663910323991L; + private String staffId; + private String name; + private String headPhoto; + private String orgName; + private String gender; + private List roles; +} diff --git a/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/govorg/OrgDTO.java b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/govorg/OrgDTO.java new file mode 100644 index 0000000000..dadb069021 --- /dev/null +++ b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/govorg/OrgDTO.java @@ -0,0 +1,19 @@ +package com.epmet.dataaggre.dto.govorg; + +import lombok.Data; + +import java.io.Serializable; + +/** + * @Description + * @Author zhaoqifeng + * @Date 2021/8/19 14:21 + */ +@Data +public class OrgDTO implements Serializable { + private static final long serialVersionUID = -3659371769044867016L; + private String orgId; + private String orgName; + private String orgType; + private Integer staffNum; +} diff --git a/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/govorg/ReceiverDTO.java b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/govorg/ReceiverDTO.java new file mode 100644 index 0000000000..d743c808cf --- /dev/null +++ b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/govorg/ReceiverDTO.java @@ -0,0 +1,39 @@ +package com.epmet.dataaggre.dto.govorg; + +import lombok.Data; + +import java.io.Serializable; + +/** + * @Description + * @Author zhaoqifeng + * @Date 2021/8/19 14:50 + */ +@Data +public class ReceiverDTO implements Serializable { + private static final long serialVersionUID = 7756394210796777416L; + /** + * ID + */ + private String staffId; + /** + * 姓名 + */ + private String staffName; + /** + * 头像 + */ + private String headPhoto; + /** + * 所属组织目前显示两级 + */ + private String orgName; + /** + * 1:已读;0:未读 + */ + private String readFlag; + /** + * 1男2女0未知 + */ + private String gender; +} diff --git a/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/govorg/form/ReceiversFormDTO.java b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/govorg/form/ReceiversFormDTO.java new file mode 100644 index 0000000000..775086e16d --- /dev/null +++ b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/govorg/form/ReceiversFormDTO.java @@ -0,0 +1,22 @@ +package com.epmet.dataaggre.dto.govorg.form; + +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import java.io.Serializable; + +/** + * @author Administrator + */ +@Data +public class ReceiversFormDTO implements Serializable { + + private static final long serialVersionUID = -1588067365064394258L; + @NotBlank(message = "消息ID不能为空") + private String infoId; + private Integer pageNo = 1; + private Integer pageSize = 10; + private String readFlag; + + +} diff --git a/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/govorg/form/SubOrgFormDTO.java b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/govorg/form/SubOrgFormDTO.java new file mode 100644 index 0000000000..1bc7ccddef --- /dev/null +++ b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/govorg/form/SubOrgFormDTO.java @@ -0,0 +1,18 @@ +package com.epmet.dataaggre.dto.govorg.form; + +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import java.io.Serializable; + +/** + * @Description + * @Author zhaoqifeng + * @Date 2021/8/19 14:18 + */ +@Data +public class SubOrgFormDTO implements Serializable { + private static final long serialVersionUID = -3651225675593357002L; + @NotBlank(message = "组织ID不能为空") + private String agencyId; +} diff --git a/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/govorg/result/ReceiversResultDTO.java b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/govorg/result/ReceiversResultDTO.java new file mode 100644 index 0000000000..4f8993456c --- /dev/null +++ b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/govorg/result/ReceiversResultDTO.java @@ -0,0 +1,19 @@ +package com.epmet.dataaggre.dto.govorg.result; + +import com.epmet.dataaggre.dto.govorg.ReceiverDTO; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.io.Serializable; +import java.util.List; + +/** + * @author Administrator + */ +@NoArgsConstructor +@Data +public class ReceiversResultDTO implements Serializable { + private static final long serialVersionUID = 255217078396991037L; + private Integer total; + private List dataList; +} diff --git a/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/govorg/result/SubOrgResultDTO.java b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/govorg/result/SubOrgResultDTO.java new file mode 100644 index 0000000000..26b915dea0 --- /dev/null +++ b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/govorg/result/SubOrgResultDTO.java @@ -0,0 +1,20 @@ +package com.epmet.dataaggre.dto.govorg.result; + +import com.epmet.dataaggre.dto.govorg.OrgDTO; +import lombok.Data; + +import java.io.Serializable; +import java.util.List; + +/** + * @Description + * @Author zhaoqifeng + * @Date 2021/8/19 14:20 + */ +@Data +public class SubOrgResultDTO implements Serializable { + private static final long serialVersionUID = 3080780461845963616L; + private List subAgencyList; + private List departmentList; + private List gridList; +} diff --git a/epmet-module/data-aggregator/data-aggregator-server/pom.xml b/epmet-module/data-aggregator/data-aggregator-server/pom.xml index b9bb88e7a9..f12fd9b93d 100644 --- a/epmet-module/data-aggregator/data-aggregator-server/pom.xml +++ b/epmet-module/data-aggregator/data-aggregator-server/pom.xml @@ -294,6 +294,12 @@ epmet_oper_customize_user EpmEt-db-UsEr + + + + epmet_message_user + EpmEt-db-UsEr + 0 192.168.1.140 @@ -395,6 +401,12 @@ epmet elink@833066 + + + + epmet + elink@833066 + 0 r-m5eoz5b6tkx09y6bpz.redis.rds.aliyuncs.com @@ -496,6 +508,12 @@ epmet_oper_customize_user EpmEt-db-UsEr + + + + epmet_message_user + EpmEt-db-UsEr + 0 r-m5ez3n1j0qc3ykq2ut.redis.rds.aliyuncs.com diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/controller/DemoController.java b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/controller/DemoController.java index b3300e3fb4..e8fb5e18e3 100644 --- a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/controller/DemoController.java +++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/controller/DemoController.java @@ -1,6 +1,8 @@ package com.epmet.dataaggre.controller; +import com.epmet.commons.tools.redis.common.CustomerStaffRedis; import com.epmet.commons.tools.utils.Result; +import com.epmet.commons.tools.utils.SpringContextUtils; import com.epmet.dataaggre.service.DemoService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.GetMapping; @@ -17,7 +19,14 @@ public class DemoController { @GetMapping("doIt") public Result doIt() { demoService.doIt(); + + + CustomerStaffRedis bean = SpringContextUtils.getBean(CustomerStaffRedis.class); + bean.init(); + return new Result(); } + + } diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/controller/EpmetUserController.java b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/controller/EpmetUserController.java index 88263c88ca..b1bd8de18c 100644 --- a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/controller/EpmetUserController.java +++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/controller/EpmetUserController.java @@ -13,10 +13,7 @@ import com.epmet.dataaggre.dto.govorg.result.GridMemberDataAnalysisResultDTO; import com.epmet.dataaggre.service.datastats.DataStatsService; import com.epmet.dataaggre.service.epmetuser.EpmetUserService; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; +import org.springframework.web.bind.annotation.*; import java.util.ArrayList; import java.util.HashMap; @@ -218,4 +215,42 @@ public class EpmetUserController { return new Result>().ok(epmetUserService.listStaff(formDTO)); } + /** + * @Description 根据角色查询人员列表 + * @Param formDTO + * @Return {@link Result>} + * @Author zhaoqifeng + * @Date 2021/8/19 15:05 + */ + @PostMapping("roleusers") + public Result> roleUsers(@LoginUser TokenDto tokenDto, @RequestBody RoleUsersFormDTO formDTO) { + ValidatorUtils.validateEntity(formDTO); + formDTO.setCustomerId(tokenDto.getCustomerId()); + return new Result>().ok(epmetUserService.getRoleUsers(formDTO)); + + } + + /** + * @Description 角色列表(带人数) + * @Param tokenDto + * @Return {@link Result>} + * @Author zhaoqifeng + * @Date 2021/8/19 15:10 + */ + @PostMapping("rolelist") + public Result> roleList(@LoginUser TokenDto tokenDto) { + return new Result>().ok(epmetUserService.getRoleList(tokenDto.getCustomerId())); + + } + + + /** + * 根据staffId查询用户基本信息 + * remark: + */ + @PostMapping("getStaffInfo/{staffId}") + public Result getStaffInfo(@PathVariable(name = "staffId") String staffId){ + return new Result().ok(epmetUserService.getStaffInfo(staffId)); + } + } diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/controller/GovOrgController.java b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/controller/GovOrgController.java index 5ef0282825..63a0922080 100644 --- a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/controller/GovOrgController.java +++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/controller/GovOrgController.java @@ -9,10 +9,7 @@ import com.epmet.commons.tools.security.dto.TokenDto; import com.epmet.commons.tools.security.user.LoginUserUtil; import com.epmet.commons.tools.utils.Result; import com.epmet.commons.tools.validator.ValidatorUtils; -import com.epmet.dataaggre.dto.govorg.form.GridMemberDataAnalysisFromDTO; -import com.epmet.dataaggre.dto.govorg.form.NextAreaCodeFormDTO; -import com.epmet.dataaggre.dto.govorg.form.OrgStaffListFormDTO; -import com.epmet.dataaggre.dto.govorg.form.StaffDetailV2FormDTO; +import com.epmet.dataaggre.dto.govorg.form.*; import com.epmet.dataaggre.dto.govorg.result.*; import com.epmet.dataaggre.enums.GridMemberDataAnalysisEnums; import com.epmet.dataaggre.service.AggreGridService; @@ -147,4 +144,17 @@ public class GovOrgController { return new Result().ok(govOrgService.staffDetailV2(formDTO)); } + /** + * @Description 下级组织/部门/网格列表 + * @Param formDTO + * @Return {@link Result} + * @Author zhaoqifeng + * @Date 2021/8/19 15:13 + */ + @PostMapping("suborg") + public Result subOrg(@RequestBody SubOrgFormDTO formDTO) { + ValidatorUtils.validateEntity(formDTO); + return new Result().ok(govOrgService.getSubOrg(formDTO)); + } + } diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/controller/InfoController.java b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/controller/InfoController.java new file mode 100644 index 0000000000..29d4ea7e24 --- /dev/null +++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/controller/InfoController.java @@ -0,0 +1,40 @@ +package com.epmet.dataaggre.controller; + +import com.epmet.commons.tools.utils.Result; +import com.epmet.commons.tools.validator.ValidatorUtils; +import com.epmet.dataaggre.dto.govorg.form.ReceiversFormDTO; +import com.epmet.dataaggre.dto.govorg.result.ReceiversResultDTO; +import com.epmet.dataaggre.service.epmetmessage.EpmetMessageService; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import javax.annotation.Resource; + +/** + * @Description + * @Author zhaoqifeng + * @Date 2021/8/19 14:45 + */ +@RestController +@RequestMapping("info") +public class InfoController { + @Resource + private EpmetMessageService epmetMessageService; + + /** + * @Description 已读未读列表 + * @Param formDTO + * @Return {@link Result} + * @Author zhaoqifeng + * @Date 2021/8/19 14:49 + */ + @PostMapping("receivers") + public Result receivers(@RequestBody ReceiversFormDTO formDTO) { + ValidatorUtils.validateEntity(formDTO); + ReceiversResultDTO result = epmetMessageService.getReceiverList(formDTO); + return new Result().ok(result); + + } +} diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/epmetmessage/EpmetMessageService.java b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/epmetmessage/EpmetMessageService.java new file mode 100644 index 0000000000..eb5cd94040 --- /dev/null +++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/epmetmessage/EpmetMessageService.java @@ -0,0 +1,18 @@ +package com.epmet.dataaggre.service.epmetmessage; + +import com.epmet.dataaggre.dto.govorg.form.ReceiversFormDTO; +import com.epmet.dataaggre.dto.govorg.result.ReceiversResultDTO; + +/** + * @author Administrator + */ +public interface EpmetMessageService { + /** + * @Description 获取已读未读人员列表 + * @Param formDTO + * @Return {@link ReceiversResultDTO} + * @Author zhaoqifeng + * @Date 2021/8/19 14:56 + */ + ReceiversResultDTO getReceiverList(ReceiversFormDTO formDTO); +} diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/epmetmessage/impl/EpmetMessageServiceImpl.java b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/epmetmessage/impl/EpmetMessageServiceImpl.java new file mode 100644 index 0000000000..d6d9046123 --- /dev/null +++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/epmetmessage/impl/EpmetMessageServiceImpl.java @@ -0,0 +1,32 @@ +package com.epmet.dataaggre.service.epmetmessage.impl; + +import com.epmet.commons.dynamic.datasource.annotation.DataSource; +import com.epmet.dataaggre.constant.DataSourceConstant; +import com.epmet.dataaggre.dto.govorg.form.ReceiversFormDTO; +import com.epmet.dataaggre.dto.govorg.result.ReceiversResultDTO; +import com.epmet.dataaggre.service.epmetmessage.EpmetMessageService; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Service; + +/** + * @Description + * @Author zhaoqifeng + * @Date 2021/8/19 15:23 + */ +@Service +@DataSource(DataSourceConstant.EPMET_MESSAGE) +@Slf4j +public class EpmetMessageServiceImpl implements EpmetMessageService { + /** + * @param formDTO + * @Description 获取已读未读人员列表 + * @Param formDTO + * @Return {@link ReceiversResultDTO} + * @Author zhaoqifeng + * @Date 2021/8/19 14:56 + */ + @Override + public ReceiversResultDTO getReceiverList(ReceiversFormDTO formDTO) { + return null; + } +} diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/epmetuser/EpmetUserService.java b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/epmetuser/EpmetUserService.java index add57d7886..5f9025171a 100644 --- a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/epmetuser/EpmetUserService.java +++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/epmetuser/EpmetUserService.java @@ -47,7 +47,7 @@ public interface EpmetUserService { /** * 历史巡查日期查询 * @author zhaoqifeng - * @date 2021/6/10 14:36 + * @date 2021/6/10 14:36 * @param formDTO * @return com.epmet.dataaggre.dto.epmetuser.result.PatrolDateListResultDTO */ @@ -83,13 +83,13 @@ public interface EpmetUserService { * @Author sun **/ List getStaffRoleList(String customerId, String userId); - + /** * 我要报事-人大代表个人中心(尹) 是否显示@我,是否显示红点 - * - * @param userId + * + * @param userId * @return com.epmet.dataaggre.dto.epmetuser.result.UserEventLogoResultDTO - * @author yinzuomei + * @author yinzuomei * @date 2021/8/3 15:09 */ UserEventLogoResultDTO mentionMeEvent(String userId); @@ -100,4 +100,29 @@ public interface EpmetUserService { * @author sun */ List listStaff(ListStaffFormDTO formDTO); + + /** + * 根据角色查询人员列表 + * @Param formDTO + * @Return {@link List} + * @Author zhaoqifeng + * @Date 2021/8/19 15:03 + */ + List getRoleUsers(RoleUsersFormDTO formDTO); + + /** + * @Description 获取角色列表 + * @Param customerId + * @Return {@link List} + * @Author zhaoqifeng + * @Date 2021/8/19 15:09 + */ + List getRoleList(String customerId); + + /** + * desc:根据工作人员Id 获取工作人员全部信息 + * @param staffId + * @return + */ + CustomerStaffResultDTO getStaffInfo(String staffId); } diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/epmetuser/impl/EpmetUserServiceImpl.java b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/epmetuser/impl/EpmetUserServiceImpl.java index 3039f4a9c2..b66cd04d1a 100644 --- a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/epmetuser/impl/EpmetUserServiceImpl.java +++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/epmetuser/impl/EpmetUserServiceImpl.java @@ -1,7 +1,9 @@ package com.epmet.dataaggre.service.epmetuser.impl; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.epmet.commons.dynamic.datasource.annotation.DataSource; import com.epmet.commons.tools.constant.NumConstant; +import com.epmet.commons.tools.utils.ConvertUtils; import com.epmet.commons.tools.utils.DateUtils; import com.epmet.constant.BadgeConstant; import com.epmet.dataaggre.constant.DataSourceConstant; @@ -14,6 +16,7 @@ import com.epmet.dataaggre.dto.epmetuser.result.*; import com.epmet.dataaggre.dto.govorg.CustomerAgencyDTO; import com.epmet.dataaggre.dto.govorg.CustomerGridDTO; import com.epmet.dataaggre.dto.govorg.result.GridStaffResultDTO; +import com.epmet.dataaggre.entity.epmetuser.CustomerStaffEntity; import com.epmet.dataaggre.entity.epmetuser.ResiUserBadgeEntity; import com.epmet.dataaggre.service.epmetuser.EpmetUserService; import com.epmet.dataaggre.service.epmetuser.StaffPatrolDetailService; @@ -432,5 +435,48 @@ public class EpmetUserServiceImpl implements EpmetUserService { return null; } + /** + * 根据角色查询人员列表 + * + * @param formDTO + * @Param formDTO + * @Return {@link List} + * @Author zhaoqifeng + * @Date 2021/8/19 15:03 + */ + @Override + public List getRoleUsers(RoleUsersFormDTO formDTO) { + return null; + } + + /** + * @param customerId + * @Description 获取角色列表 + * @Param customerId + * @Return {@link List} + * @Author zhaoqifeng + * @Date 2021/8/19 15:09 + */ + @Override + public List getRoleList(String customerId) { + return null; + } + + @Override + public CustomerStaffResultDTO getStaffInfo(String staffId) { + LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); + queryWrapper.eq(CustomerStaffEntity::getUserId,staffId) + .eq(CustomerStaffEntity::getDelFlag,NumConstant.ZERO_STR); + CustomerStaffEntity staffEntity = customerStaffDao.selectOne(queryWrapper); + CustomerStaffResultDTO result = ConvertUtils.sourceToTarget(staffEntity, CustomerStaffResultDTO.class); + + //1.查询当前人员所属组织及下级所有网格列表数据,供后续封装数据使用 + /*List list = govOrgService.getGridList(staffId); + if (list.size() < NumConstant.ONE) { + return resultList; + }*/ + return result; + } + } diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/govorg/GovOrgService.java b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/govorg/GovOrgService.java index a912b2180b..3a2c10ea1c 100644 --- a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/govorg/GovOrgService.java +++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/govorg/GovOrgService.java @@ -3,9 +3,7 @@ package com.epmet.dataaggre.service.govorg; import com.epmet.commons.tools.security.dto.TokenDto; import com.epmet.dataaggre.dto.govorg.CustomerAgencyDTO; import com.epmet.dataaggre.dto.govorg.CustomerGridDTO; -import com.epmet.dataaggre.dto.govorg.form.NextAreaCodeFormDTO; -import com.epmet.dataaggre.dto.govorg.form.OrgStaffListFormDTO; -import com.epmet.dataaggre.dto.govorg.form.StaffDetailV2FormDTO; +import com.epmet.dataaggre.dto.govorg.form.*; import com.epmet.dataaggre.dto.govorg.result.*; import com.epmet.dataaggre.dto.resigroup.result.OrgInfoCommonDTO; @@ -96,4 +94,13 @@ public interface GovOrgService { * @author sun */ StaffDetailV2FormDTO staffDetailV2(StaffDetailV2ResultDTO formDTO); + + /** + * @Description 下级组织/部门/网格列表 + * @Param formDTO + * @Return {@link SubOrgResultDTO} + * @Author zhaoqifeng + * @Date 2021/8/19 15:12 + */ + SubOrgResultDTO getSubOrg(SubOrgFormDTO formDTO); } diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/govorg/impl/GovOrgServiceImpl.java b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/govorg/impl/GovOrgServiceImpl.java index 1509a52d68..e436e72fac 100644 --- a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/govorg/impl/GovOrgServiceImpl.java +++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/govorg/impl/GovOrgServiceImpl.java @@ -15,9 +15,7 @@ import com.epmet.dataaggre.dto.epmetuser.result.StaffRoleListResultDTO; import com.epmet.dataaggre.dto.govorg.CustomerAgencyDTO; import com.epmet.dataaggre.dto.govorg.CustomerGridDTO; import com.epmet.dataaggre.dto.govorg.CustomerStaffAgencyDTO; -import com.epmet.dataaggre.dto.govorg.form.NextAreaCodeFormDTO; -import com.epmet.dataaggre.dto.govorg.form.OrgStaffListFormDTO; -import com.epmet.dataaggre.dto.govorg.form.StaffDetailV2FormDTO; +import com.epmet.dataaggre.dto.govorg.form.*; import com.epmet.dataaggre.dto.govorg.result.*; import com.epmet.dataaggre.dto.resigroup.result.OrgInfoCommonDTO; import com.epmet.dataaggre.entity.govorg.CustomerAgencyEntity; @@ -394,4 +392,17 @@ public class GovOrgServiceImpl implements GovOrgService { return null; } + /** + * @param formDTO + * @Description 下级组织/部门/网格列表 + * @Param formDTO + * @Return {@link SubOrgResultDTO} + * @Author zhaoqifeng + * @Date 2021/8/19 15:12 + */ + @Override + public SubOrgResultDTO getSubOrg(SubOrgFormDTO formDTO) { + return null; + } + } diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/resources/bootstrap.yml b/epmet-module/data-aggregator/data-aggregator-server/src/main/resources/bootstrap.yml index 98ff885e99..f84136b69a 100644 --- a/epmet-module/data-aggregator/data-aggregator-server/src/main/resources/bootstrap.yml +++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/resources/bootstrap.yml @@ -144,6 +144,11 @@ dynamic: url: @datasource.druid.opercustomize.url@ username: @datasource.druid.opercustomize.username@ password: @datasource.druid.opercustomize.password@ + epmetmessage: + driver-class-name: com.mysql.cj.jdbc.Driver + url: @datasource.druid.epmetmessage.url@ + username: @datasource.druid.epmetmessage.username@ + password: @datasource.druid.epmetmessage.password@ feign: hystrix: enabled: true diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/CustomerStaffInfoDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/CustomerStaffInfoDTO.java new file mode 100644 index 0000000000..3ec1fae999 --- /dev/null +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/CustomerStaffInfoDTO.java @@ -0,0 +1,62 @@ +package com.epmet.dto; + +import lombok.Data; + +import java.io.Serializable; +import java.util.Map; + +/** + * @Author zxc + * @DateTime 2021/6/15 10:00 上午 + * @DESC + */ +@Data +public class CustomerStaffInfoDTO implements Serializable { + + private static final long serialVersionUID = -4078910245000135305L; + /** + * 工作人员所属组织ID + */ + private String agencyId; + + /** + * 工作人员所属组织名称 + */ + private String agencyName; + + /** + * 工作人员ID + */ + private String staffId; + + /** + * 真实姓名 + */ + private String realName; + + /** + * 性别0.未知,1男,2.女 + */ + private Integer gender; + + /** + * 手机号-唯一键 + */ + private String mobile; + + /** + * 头像 + */ + private String headPhoto; + + /** + * 角色map key为角色key value 为角色名称 + */ + private Map roleMap; + + /** + * 工作人员所在网格及部门列表 + */ + private StaffOrgsDTO orgInfo; + +} diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/StaffOrgsDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/StaffOrgsDTO.java new file mode 100644 index 0000000000..ae9e0f7a9a --- /dev/null +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/StaffOrgsDTO.java @@ -0,0 +1,54 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.dto; + +import lombok.Data; + +import java.io.Serializable; +import java.util.List; + +/** + * desc: 工作人员所属的组织关系 + * @date 2021/8/19 10:07 上午 + */ +@Data +public class StaffOrgsDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 所属组织的上级组织 + */ + private IdAndName parentAgency; + + /** + * 所属网格列表 + */ + private List gridList; + + /** + * 所属部门 + */ + private List deptList; + + @Data + class IdAndName { + private String id; + private String name; + } +} diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/redis/StaffInfoRedis.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/redis/StaffInfoRedis.java new file mode 100644 index 0000000000..cf3ae77dda --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/redis/StaffInfoRedis.java @@ -0,0 +1,75 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.redis; + +import cn.hutool.core.bean.BeanUtil; +import com.epmet.commons.tools.redis.RedisKeys; +import com.epmet.commons.tools.redis.RedisUtils; +import com.epmet.commons.tools.utils.ConvertUtils; +import com.epmet.dto.CustomerStaffInfoDTO; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +import java.util.Map; + +import static com.epmet.commons.tools.redis.RedisUtils.NOT_EXPIRE; + +/** + * 工作人员-角色关系表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-04-22 + */ +@Component +public class StaffInfoRedis { + @Autowired + private RedisUtils redisUtils; + + /** + * @Description 查询工作人员的角色 + * @Param customerId + * @Param userId + * @author zxc + * @date 2021/6/15 3:20 下午 + */ + public CustomerStaffInfoDTO getRole(String customerId, String staffId){ + String key = RedisKeys.getCustomerStaffInfoKey(customerId,staffId); + Map roleMap = redisUtils.hGetAll(key); + boolean empty = roleMap.isEmpty(); + if (!empty){ + CustomerStaffInfoDTO result = ConvertUtils.mapToEntity(roleMap, CustomerStaffInfoDTO.class); + return result; + } + return null; + } + + /** + * @Description 放入缓存角色 + * @Param customerId + * @Param userId + * @Param dto + * @author zxc + * @date 2021/6/15 4:01 下午 + */ + public void setRole(String customerId,String staffId,CustomerStaffInfoDTO dto){ + String key = RedisKeys.getCustomerStaffInfoKey(customerId,staffId); + Map map = BeanUtil.beanToMap(dto, false, true); + redisUtils.hMSet(key, map,NOT_EXPIRE); + } + +}