diff --git a/doc/开发规范/命名规范.txt b/doc/开发规范/命名规范.txt index 439096e23c..cae303ba64 100644 --- a/doc/开发规范/命名规范.txt +++ b/doc/开发规范/命名规范.txt @@ -9,6 +9,7 @@ 4、插入:insertXXX 5、删除:deleteXXX 6、获取统计值的方法用 selectCount +索引命名规范 idx_ 普通索引; unq_唯一索引 diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/constant/NumConstant.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/constant/NumConstant.java index 2010b316d3..1281b269f4 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/constant/NumConstant.java +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/constant/NumConstant.java @@ -36,9 +36,11 @@ public interface NumConstant { int THIRTY_ONE = 31; int FORTY = 40; int FORTY_ONE = 41; + int FORTY_NINE = 49; int FIFTY = 50; int FIFTY_ONE = 51; int SIXTY = 60; + int NINETY_NINE=99; int ONE_HUNDRED = 100; int TWO_HUNDRED = 200; int FIVE_HUNDRED = 500; 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/dto/form/IdAndNameDTO.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/dto/form/IdAndNameDTO.java new file mode 100644 index 0000000000..306f47bbc5 --- /dev/null +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/dto/form/IdAndNameDTO.java @@ -0,0 +1,21 @@ +package com.epmet.commons.tools.dto.form; + +import lombok.Data; + +import java.io.Serializable; + +/** + * desc:通用Id and Name 不要轻易修改 + * + * @author: LiuJanJun + * @date: 2021/8/19 4:12 下午 + * @version: 1.0 + */ +@Data +public class IdAndNameDTO implements Serializable { + + private static final long serialVersionUID = 4481647404402681862L; + private String id; + private String name; + +} diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/dto/result/CustomerStaffInfoCacheResult.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/dto/result/CustomerStaffInfoCacheResult.java new file mode 100644 index 0000000000..d8cf9a8265 --- /dev/null +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/dto/result/CustomerStaffInfoCacheResult.java @@ -0,0 +1,86 @@ +package com.epmet.commons.tools.dto.result; + +import com.epmet.commons.tools.dto.form.IdAndNameDTO; +import lombok.Data; + +import java.io.Serializable; +import java.util.List; +import java.util.Map; + +/** + * desc:工作人员信息结果类 + * @Author zxc + * @DateTime 2021/6/15 10:00 上午 + * @DESC + */ +@Data +public class CustomerStaffInfoCacheResult implements Serializable { + + private static final long serialVersionUID = 3519630252798469087L; + /** + * 工作人员所属组织ID + */ + private String agencyId; + + /** + * 工作人员所属组织名称 + */ + private String agencyName; + + /** + * 2级组织名称 根据添加的来源返回(xx组织-组织/网格/部门) + */ + private String twoOrgName; + + /** + * 工作人员ID + */ + private String staffId; + + /** + * 真实姓名 + */ + private String realName; + + /** + * 性别0.未知,1男,2.女 + */ + private Integer gender; + + /** + * 手机号-唯一键 + */ + private String mobile; + + /** + * 头像 + */ + private String headPhoto; + + /** + * 工作人员是从哪中组织类型添加的 3个值:agency,grid,dept + * @see com.epmet.commons.tools.enums.OrgTypeEnum + */ + private String fromOrgType; + + /** + * 角色map key为角色key value 为角色名称 + */ + private Map roleMap; + + /** + * 所属组织的上级组织 + */ + private IdAndNameDTO parentAgency; + + /** + * 所属网格列表 + */ + private List gridList; + + /** + * 所属部门 + */ + private List deptList; + +} diff --git a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/eum/OrgTypeEnum.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/enums/OrgTypeEnum.java similarity index 92% rename from epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/eum/OrgTypeEnum.java rename to epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/enums/OrgTypeEnum.java index 6938746a29..0f61110113 100644 --- a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/eum/OrgTypeEnum.java +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/enums/OrgTypeEnum.java @@ -1,4 +1,4 @@ -package com.epmet.datareport.eum; +package com.epmet.commons.tools.enums; /** * 需要组织类型枚举类 @@ -8,6 +8,7 @@ package com.epmet.datareport.eum; **/ public enum OrgTypeEnum { DEPARTMENT("department", "部门"), + DEPT("dept", "部门"), AGENCY("agency", "组织"), GRID("grid", "网格"), ; diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/enums/RequirePermissionEnum.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/enums/RequirePermissionEnum.java index 17b7c21b99..13b7d37057 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/enums/RequirePermissionEnum.java +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/enums/RequirePermissionEnum.java @@ -54,6 +54,7 @@ public enum RequirePermissionEnum { ORG_STAFF_CREATE("org_staff_create", "组织:工作人员:新增", "组织:工作人员:新增"), ORG_STAFF_UPDATE("org_staff_update", "组织:工作人员:编辑", "组织:工作人员:编辑"), ORG_STAFF_FORBIDDEN("org_staff_forbidden", "组织:工作人员:禁用", "组织:工作人员:禁用"), + ORG_STAFF_ENABLE("org_staff_enable", "组织:工作人员:解禁", "组织:工作人员:解禁"), ORG_STAFF_TRANSFER("org_staff_transfer", "组织:工作人员:调动", "组织:工作人员:调动"), /** diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java index 8ba25b63e6..3ec318507f 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java @@ -103,6 +103,11 @@ public enum EpmetErrorCode { RESI_EVENT_CAN_NOT_CLOSE_CASE(8607,"事件尚未处理,请处理完成后进行办结"), RESI_EVENT_SHIFT_PROJECT(8608,"事件已立项,请勿重复操作"), + PLEASE_CHOOSE_RECEIVER(8609,"请选择接收人"), + REPLY_INFO_CONTENT_NOT_NULL(8610,"回复内容不能为空"), + PLEASE_CHOOSE_MEMBER(8611,"请选择成员"), + INFO_GROUP_NAME_EXISTS(8612,"名称已存在"), + // 爱心互助 居民端 NOT_IN_THE_SIGN_IN_RANGE(8510, "您还未进入指定的签到范围~"), // 活动报名失败,弹窗:志愿者认证 diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/feign/CommonAggFeignClient.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/feign/CommonAggFeignClient.java new file mode 100644 index 0000000000..d9ceb0f3a0 --- /dev/null +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/feign/CommonAggFeignClient.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.CommonAggFeignClientFallBackFactory; +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 = CommonAggFeignClientFallBackFactory.class) +public interface CommonAggFeignClient { + + /** + * 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/CommonAggFeignClientFallBackFactory.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/feign/fallback/CommonAggFeignClientFallBackFactory.java new file mode 100644 index 0000000000..cd396ed402 --- /dev/null +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/feign/fallback/CommonAggFeignClientFallBackFactory.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.CommonAggFeignClient; +import feign.hystrix.FallbackFactory; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Component; + +@Component +@Slf4j +public class CommonAggFeignClientFallBackFactory implements FallbackFactory { + private CommonAggFeignClientFallback fallback = new CommonAggFeignClientFallback(); + + @Override + public CommonAggFeignClient 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/CommonAggFeignClientFallback.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/feign/fallback/CommonAggFeignClientFallback.java new file mode 100644 index 0000000000..2495d6b588 --- /dev/null +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/feign/fallback/CommonAggFeignClientFallback.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.CommonAggFeignClient; +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 CommonAggFeignClientFallback implements CommonAggFeignClient { + + @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/filter/LogMsgSendFilter.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/filter/LogMsgSendFilter.java index 4a6332f74a..33807f7f08 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/filter/LogMsgSendFilter.java +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/filter/LogMsgSendFilter.java @@ -205,7 +205,7 @@ public class LogMsgSendFilter extends LevelFilter { } return slashMatcher.start(); } catch (Exception e) { - logger.warn("getCharacterPosition no matche", e); + logger.warn("getCharacterPosition no matche"); return string.length(); } } 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 fe61c76bfc..f16bb16c2b 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 @@ -491,4 +491,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("gov:staff:").concat(customerId).concat(StrConstant.COLON).concat(staffId); + } } diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/RedisUtils.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/RedisUtils.java index cbd00c3aeb..1de1fce475 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/RedisUtils.java +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/RedisUtils.java @@ -115,8 +115,8 @@ public class RedisUtils { redisTemplate.delete(keys(pattern)); } - public void delete(String key) { - redisTemplate.delete(key); + public Boolean delete(String key) { + return redisTemplate.delete(key); } public void delete(Collection keys) { 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..831d2f177d --- /dev/null +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/common/CustomerStaffRedis.java @@ -0,0 +1,133 @@ +package com.epmet.commons.tools.redis.common; + +import cn.hutool.core.bean.BeanUtil; +import com.alibaba.fastjson.JSON; +import com.epmet.commons.tools.dto.result.CustomerStaffInfoCacheResult; +import com.epmet.commons.tools.exception.RenException; +import com.epmet.commons.tools.feign.CommonAggFeignClient; +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 lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang3.StringUtils; +import org.jetbrains.annotations.Nullable; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; +import org.springframework.util.CollectionUtils; + +import javax.annotation.PostConstruct; +import java.util.Map; + +/** + * 工作人员缓存通用类 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-04-22 + */ +@Slf4j +@Component +public class CustomerStaffRedis { + @Autowired + private RedisUtils redisUtils; + @Autowired + private CommonAggFeignClient commonAggFeignClient; + + private static CustomerStaffRedis customerStaffRedis; + private static final String ROLE_MAP_KEY = "roleMap"; + + @PostConstruct + public void init() { + customerStaffRedis = this; + customerStaffRedis.redisUtils = this.redisUtils; + customerStaffRedis.commonAggFeignClient = this.commonAggFeignClient; + } + + public static void initTest() { + CustomerStaffInfoCacheResult role = getStaffInfo("45687aa479955f9d06204d415238f7cc", "9e37adcce6472152e6508a19d3683e02"); + role = getStaffInfo("45687aa479955f9d06204d415238f7cc", "e08316376c972b5cb3f085bb39a3680f"); + System.out.println(JSON.toJSONString(role)); + role = getStaffInfo("45687aa479955f9d06204d415238f7cc", "ec524bbbc41d0662cbb36236161005e9"); + System.out.println(JSON.toJSONString(role)); + System.out.println(JSON.toJSONString(getStaffRoleMap("45687aa479955f9d06204d415238f7cc", "7f694a66efe60a47c2114875f310248a"))); + } + + /** + * desc: 根据工作人员Id 获取某工作人员信息,如果缓存不存在则查询db返回;缓存默认一天 + * + * @param customerId + * @param staffId + * @return com.epmet.commons.tools.redis.common.bean.CustomerStaffInfoCache + * @author LiuJanJun + * @date 2021/8/19 10:29 下午 + * @remark 此方法仅用于 获取某个工作人员的信息,不用于获取客户下所有工作人员信息 + */ + public static CustomerStaffInfoCacheResult getStaffInfo(String customerId, String staffId) { + String key = RedisKeys.getCustomerStaffInfoKey(customerId, staffId); + Map roleMap = customerStaffRedis.redisUtils.hGetAll(key); + if (!CollectionUtils.isEmpty(roleMap)) { + return ConvertUtils.mapToEntity(roleMap, CustomerStaffInfoCacheResult.class); + } + + CustomerStaffInfoCache resultData = reloadStaffCache(staffId, key); + if (resultData == null) { + return null; + } + + return ConvertUtils.sourceToTarget(resultData, CustomerStaffInfoCacheResult.class); + } + + @Nullable + private static CustomerStaffInfoCache reloadStaffCache(String staffId, String key) { + Result staffResult = customerStaffRedis.commonAggFeignClient.getStaffInfo(staffId); + if (staffResult == null || !staffResult.success()) { + throw new RenException("获取工作人员信息失败"); + } + CustomerStaffInfoCache resultData = staffResult.getData(); + if (resultData == null) { + log.warn("getStaffInfo staff is null,staffId:{}", staffId); + return null; + } + + Map map = BeanUtil.beanToMap(resultData, false, true); + customerStaffRedis.redisUtils.hMSet(key, map); + return resultData; + } + + /** + * desc: 根据工作人员Id 获取某工作人员角色map信息 + * + * @param customerId + * @param staffId + */ + public static Map getStaffRoleMap(String customerId, String staffId) { + String key = RedisKeys.getCustomerStaffInfoKey(customerId, staffId); + Map roleMap = (Map) customerStaffRedis.redisUtils.hGet(key, ROLE_MAP_KEY); + if (!CollectionUtils.isEmpty(roleMap)) { + return roleMap; + } + + reloadStaffCache(staffId, key); + return getStaffRoleMap(customerId, staffId); + } + + /** + * desc: 根据客户id及工作人员Id 删除缓存 + * + * @param customerId + * @param staffId + * @return boolean + * @author LiuJanJun + * @date 2021/8/19 10:39 下午 + */ + public static Boolean delStaffInfoFormCache(String customerId, String staffId) { + if (StringUtils.isBlank(customerId) || StringUtils.isBlank(staffId)) { + log.warn("delStaffInfoFormCache param is blank,customerId:{},staffId:{}", customerId, staffId); + return false; + } + String key = RedisKeys.getCustomerStaffInfoKey(customerId, staffId); + return customerStaffRedis.redisUtils.delete(key); + } + +} 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..577bdf3910 --- /dev/null +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/common/bean/CustomerStaffInfoCache.java @@ -0,0 +1,91 @@ +package com.epmet.commons.tools.redis.common.bean; + +import com.epmet.commons.tools.dto.form.IdAndNameDTO; +import lombok.Data; + +import java.io.Serializable; +import java.util.List; +import java.util.Map; + +/** + * desc:客户工作人员缓存实体类 + * @Author zxc + * @DateTime 2021/6/15 10:00 上午 + * @DESC + */ +@Data +public class CustomerStaffInfoCache implements Serializable { + + private static final long serialVersionUID = 4627478063125903910L; + /** + * 工作人员所属组织ID + */ + private String agencyId; + + /** + * 工作人员所属组织名称 + */ + private String agencyName; + + /** + * 2级组织名称 根据添加的来源返回(xx组织-组织/网格/部门) + */ + private String twoOrgName; + + /** + * 工作人员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; + + /** + * 工作人员是从哪中组织类型添加的 3个值:agency,grid,dept + * @see com.epmet.commons.tools.enums.OrgTypeEnum + */ + private String fromOrgType; + + /** + * 工作人员是从哪中组织添加的 组织Id + */ + private String fromOrgId; + + /** + * 所属组织的上级组织 + */ + private IdAndNameDTO parentAgency; + + /** + * 所属网格列表 + */ + private List gridList; + + /** + * 所属部门 + */ + private List deptList; + +} 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..dd9ab18035 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="epmetmessage"; } diff --git a/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/epmetuser/form/ListStaffFormDTO.java b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/epmetuser/form/ListStaffFormDTO.java new file mode 100644 index 0000000000..e7569b16d1 --- /dev/null +++ b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/epmetuser/form/ListStaffFormDTO.java @@ -0,0 +1,28 @@ +package com.epmet.dataaggre.dto.epmetuser.form; + +import com.epmet.commons.tools.validator.group.CustomerClientShowGroup; +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import java.io.Serializable; + +/** + * @Description 对外接口--【通讯录】姓名检索工作人员-接口入参 + * @Auth sun + */ +@Data +public class ListStaffFormDTO implements Serializable { + + private static final long serialVersionUID = -3381286960911634231L; + /** + * 待检索姓名 + */ + @NotBlank(message = "姓名不能为空", groups = ListStaffFormDTO.Staff.class) + private String realName; + /** + * token中客户Id + */ + private String customerId; + public interface Staff extends CustomerClientShowGroup {} + +} 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..b12ea53fec --- /dev/null +++ b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/epmetuser/result/CustomerStaffResultDTO.java @@ -0,0 +1,91 @@ +package com.epmet.dataaggre.dto.epmetuser.result; + +import com.epmet.commons.tools.dto.form.IdAndNameDTO; +import lombok.Data; + +import java.io.Serializable; +import java.util.List; +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; + + /** + * 工作人员是从哪中组织类型添加的 3个值:agency,grid,dept + * @see com.epmet.commons.tools.enums.OrgTypeEnum + */ + private String fromOrgType; + + /** + * 工作人员是从哪中组织添加的 组织Id + */ + private String fromOrgId; + + /** + * 角色map key为角色key value 为角色名称 + */ + private Map roleMap; + + /** + * 所属组织的上级组织 + */ + private IdAndNameDTO parentAgency; + + /** + * 所属网格列表 + */ + private List gridList; + + /** + * 所属部门 + */ + private List deptList; + + //特殊处理的 属性 start ========== + /** + * 2级组织名称 根据添加的来源返回(xx组织-组织/网格/部门) + */ + private String twoOrgName; + +} diff --git a/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/epmetuser/result/ListStaffResultDTO.java b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/epmetuser/result/ListStaffResultDTO.java new file mode 100644 index 0000000000..d9fe352c1e --- /dev/null +++ b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/epmetuser/result/ListStaffResultDTO.java @@ -0,0 +1,33 @@ +package com.epmet.dataaggre.dto.epmetuser.result; + +import lombok.Data; + +import java.io.Serializable; +import java.util.List; + +/** + * @Description 【通讯录】姓名检索工作人员-接口返参 + * @Auth sun + */ +@Data +public class ListStaffResultDTO implements Serializable { + private static final long serialVersionUID = 7129564173128153335L; + + //工作人员用户id + private String staffId = ""; + //工作人员姓名 + private String name = ""; + //性别 + private String gender = ""; + //头像 + private String headPhoto = ""; + //手机号 + private String mobile = ""; + //未禁用enable,已禁用disabled + private String enableFlag = ""; + //人员新增所属组织名【组织-组织,组织-部门,组织-网格】 + private String orgName = ""; + //职责名称列表 + private List roles; + +} 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..ab1b966ac0 --- /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 Integer 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..76bc2f957b --- /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 Boolean readFlag; + /** + * 1男2女0未知 + */ + private Integer gender; +} diff --git a/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/govorg/form/OrgStaffListFormDTO.java b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/govorg/form/OrgStaffListFormDTO.java new file mode 100644 index 0000000000..add6167998 --- /dev/null +++ b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/govorg/form/OrgStaffListFormDTO.java @@ -0,0 +1,44 @@ +package com.epmet.dataaggre.dto.govorg.form; + +import com.epmet.commons.tools.validator.group.CustomerClientShowGroup; +import lombok.Data; + +import javax.validation.constraints.Min; +import javax.validation.constraints.NotBlank; +import java.io.Serializable; +import java.util.List; + +/** + * @Description 【通讯录】组织/部门/网格下人员列表-接口入参 + * @Auth sun + */ +@Data +public class OrgStaffListFormDTO implements Serializable { + private static final long serialVersionUID = -1974456701949979946L; + /** + * 组织部门网格Id + */ + @NotBlank(message = "类型Id不能为空", groups = OrgStaffListFormDTO.OrgStaff.class) + private String orgId; + /** + * 类型【组织:agency 部门:dept 网格:grid】 + */ + @NotBlank(message = "类型不能为空", groups = OrgStaffListFormDTO.OrgStaff.class) + private String orgType; + /** + * 页码,从1开始 + */ + @Min(value = 1, message = "页码必须大于0", groups = OrgStaffListFormDTO.OrgStaff.class) + private Integer pageNo; + /** + * 页容量,默认10页 + */ + @Min(value = 1, message = "每页条数必须大于0", groups = OrgStaffListFormDTO.OrgStaff.class) + private Integer pageSize = 10; + //客户Id + private String customerId; + //工作人员id集合 + private List staffIds; + public interface OrgStaff extends CustomerClientShowGroup {} + +} 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/StaffDetailV2FormDTO.java b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/govorg/form/StaffDetailV2FormDTO.java new file mode 100644 index 0000000000..d568099084 --- /dev/null +++ b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/govorg/form/StaffDetailV2FormDTO.java @@ -0,0 +1,45 @@ +package com.epmet.dataaggre.dto.govorg.form; + +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import java.io.Serializable; +import java.util.Date; +import java.util.List; + +/** + * @Description 【通讯录】人员详情v2-接口返参 + * @Auth sun + */ +@Data +public class StaffDetailV2FormDTO implements Serializable { + private static final long serialVersionUID = -1974456701949979946L; + + //工作人员用户id + private String staffId = ""; + //工作人员姓名 + private String name = ""; + //性别 + private String gender = ""; + //手机号 + private String mobile = ""; + //头像 + private String headPhoto = ""; + //激活状态:inactive未激活,active已激活 + private String activeFlag = ""; + //激活时间 + private Date activeTime; + //未禁用enable,已禁用disabled + private String enableFlag = ""; + //fulltime专职parttime兼职 + private String workType = ""; + //人员新增所属组织名【组织-组织,组织-部门,组织-网格】 + private String orgName = ""; + //人员添加类型的Id + private String orgId = ""; + //人员添加时的类型【agency;dept;grid】 + private String orgType = ""; + //职责名称列表 + private List roles; + +} 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/OrgStaffListResultDTO.java b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/govorg/result/OrgStaffListResultDTO.java new file mode 100644 index 0000000000..20933648fe --- /dev/null +++ b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/govorg/result/OrgStaffListResultDTO.java @@ -0,0 +1,45 @@ +/** + * 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.dataaggre.dto.govorg.result; + +import com.epmet.dataaggre.dto.epmetuser.result.ListStaffResultDTO; +import lombok.Data; + +import java.io.Serializable; +import java.util.List; + + +/** + * @Description 【通讯录】组织/部门/网格下人员列表-接口返参 + * @Auth sun + */ +@Data +public class OrgStaffListResultDTO implements Serializable { + + private static final long serialVersionUID = 1L; + /** + * 人员总数 + */ + private Integer staffCount; + /** + * 人员列表 + */ + private List staffList; + + +} \ No newline at end of file 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/StaffAgencyDTO.java b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/govorg/result/StaffAgencyDTO.java new file mode 100644 index 0000000000..7a1a144f31 --- /dev/null +++ b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/govorg/result/StaffAgencyDTO.java @@ -0,0 +1,82 @@ +/** + * 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.dataaggre.dto.govorg.result; + +import lombok.Data; + +import java.io.Serializable; + + +/** + * 机关单位信息表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-04-20 + */ +@Data +public class StaffAgencyDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + private String agencyId; + + /** + * 组织名称 + */ + private String agencyName; + + /** + * 上级组织机构ID + */ + private String pid; + + /** + * 所有上级组织机构ID(以英文:隔开) + */ + private String pids; + + /** + * 所有上级名称,以-连接 + */ + private String allParentName; + + private String parentAgencyName; + + /** + * 机关级别(社区级:community, + 乡(镇、街道)级:street, + 区县级: district, + 市级: city + 省级:province) 机关级别(社区级:community,乡(镇、街道)级:street,区县级: district,市级: city省级:province) + */ + private String level; + + /** + * 地区编码 + */ + private String areaCode; + + /** + * 当前组织的上级行政地区编码add0204;举例平阴县对应的是济南市3701 + */ + private String parentAreaCode; + +} diff --git a/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/govorg/result/StaffDetailV2ResultDTO.java b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/govorg/result/StaffDetailV2ResultDTO.java new file mode 100644 index 0000000000..0813592884 --- /dev/null +++ b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/govorg/result/StaffDetailV2ResultDTO.java @@ -0,0 +1,43 @@ +/** + * 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.dataaggre.dto.govorg.result; + +import com.epmet.commons.tools.validator.group.CustomerClientShowGroup; +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import java.io.Serializable; + + +/** + * @Description 【通讯录】人员详情v2-接口返参 + * @Auth sun + */ +@Data +public class StaffDetailV2ResultDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 工资人员Id + */ + @NotBlank(message = "人员Id不能为空", groups = StaffDetailV2ResultDTO.Staff.class) + private String staffId; + public interface Staff extends CustomerClientShowGroup {} + +} \ No newline at end of file diff --git a/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/govorg/result/StaffOrgNameResultDTO.java b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/govorg/result/StaffOrgNameResultDTO.java new file mode 100644 index 0000000000..5ab2977494 --- /dev/null +++ b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/govorg/result/StaffOrgNameResultDTO.java @@ -0,0 +1,45 @@ +/** + * 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.dataaggre.dto.govorg.result; + +import lombok.Data; + +import java.io.Serializable; + + +/** + * 查询工作人员注册组织信息 + * @author sun + */ +@Data +public class StaffOrgNameResultDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + //工作人员所属组织Id + private String agencyId = ""; + //人员Id + private String staffId = ""; + //人员注册时所属组织名【组织-组织,组织-部门,组织-网格】 + private String orgName = ""; + //工作人员添加入口Id(agencyId;deptId;gridId) + private String orgId = ""; + //工作人员添加入口类型(组织:agency;部门:dept;网格:gridId) + private String orgType = ""; + +} \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/redis/CustomerStaffRedis.java b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/govorg/result/StaffOrgRelationResultDTO.java similarity index 58% rename from epmet-user/epmet-user-server/src/main/java/com/epmet/redis/CustomerStaffRedis.java rename to epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/govorg/result/StaffOrgRelationResultDTO.java index 0fb5b1b369..6ede0cb39e 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/redis/CustomerStaffRedis.java +++ b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/govorg/result/StaffOrgRelationResultDTO.java @@ -15,33 +15,37 @@ * along with this program. If not, see . */ -package com.epmet.redis; +package com.epmet.dataaggre.dto.govorg.result; + +import lombok.Data; + +import java.io.Serializable; -import com.epmet.commons.tools.redis.RedisUtils; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Component; /** - * 政府工作人员表 + * 工作人员注册组织关系表 * * @author generator generator@elink-cn.com - * @since v1.0.0 2020-04-18 + * @since v1.0.0 2021-08-19 */ -@Component -public class CustomerStaffRedis { - @Autowired - private RedisUtils redisUtils; - - public void delete(Object[] ids) { +@Data +public class StaffOrgRelationResultDTO implements Serializable { - } + private static final long serialVersionUID = 1L; + /** + * 工作人员Id + */ + private String staffId; - public void set(){ + /** + * 工作人员添加入口Id(agencyId;deptId;gridId) + */ + private String orgId; - } + /** + * 工作人员添加入口类型(组织:agency;部门:dept;网格:gridId) + */ + private String orgType; - public String get(String id){ - return null; - } -} \ No newline at end of file +} 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-client/src/main/java/com/epmet/dataaggre/dto/message/form/InfoGroupDetailFormDTO.java b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/message/form/InfoGroupDetailFormDTO.java new file mode 100644 index 0000000000..7b1ba38061 --- /dev/null +++ b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/message/form/InfoGroupDetailFormDTO.java @@ -0,0 +1,34 @@ +package com.epmet.dataaggre.dto.message.form; + +import com.epmet.commons.tools.dto.form.PageFormDTO; +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import java.io.Serializable; + +/** + * @Description 群组列表 + * @Author yinzuomei + * @Date 2021/8/20 12:54 下午 + */ +@Data +public class InfoGroupDetailFormDTO extends PageFormDTO implements Serializable { + @NotBlank(message = "群组id不能为空",groups = PageFormDTO.AddUserInternalGroup.class) + private String receiverGroupId; + + + + //以下参数从token中获取 + /** + * 当前用户id + */ + @NotBlank(message = "userId不能为空",groups =PageFormDTO.AddUserInternalGroup.class) + private String userId; + + /** + * 当前客户id + */ + @NotBlank(message = "customerId不能为空",groups = PageFormDTO.AddUserInternalGroup.class) + private String customerId; +} + diff --git a/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/message/form/InfoIdDTO.java b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/message/form/InfoIdDTO.java new file mode 100644 index 0000000000..8df6bd657e --- /dev/null +++ b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/message/form/InfoIdDTO.java @@ -0,0 +1,36 @@ +package com.epmet.dataaggre.dto.message.form; + +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import java.io.Serializable; + +/** + * @Description 通用dto + * @Author yinzuomei + * @Date 2021/8/20 7:48 下午 + */ +@Data +public class InfoIdDTO implements Serializable { + private static final long serialVersionUID = -3852837936492128925L; + public interface AddUserInternalGroup { + } + + @NotBlank(message = "消息id不能为空",groups = AddUserInternalGroup.class) + private String infoId; + + + //以下参数从token中获取 + /** + * 当前用户id + */ + @NotBlank(message = "userId不能为空",groups = AddUserInternalGroup.class) + private String userId; + + /** + * 当前客户id + */ + @NotBlank(message = "customerId不能为空",groups = AddUserInternalGroup.class) + private String customerId; +} + diff --git a/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/message/form/InfoRepliesFormDTO.java b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/message/form/InfoRepliesFormDTO.java new file mode 100644 index 0000000000..2544e2ad63 --- /dev/null +++ b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/message/form/InfoRepliesFormDTO.java @@ -0,0 +1,33 @@ +package com.epmet.dataaggre.dto.message.form; + +import com.epmet.commons.tools.dto.form.PageFormDTO; +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import java.io.Serializable; + +/** + * @Description 发送消息详情页-回复列表 + * @Author yinzuomei + * @Date 2021/8/20 1:42 下午 + */ +@Data +public class InfoRepliesFormDTO extends PageFormDTO implements Serializable { + private static final long serialVersionUID = 8001971787502569463L; + @NotBlank(message = "消息id不能为空",groups = PageFormDTO.AddUserInternalGroup.class) + private String infoId; + + //以下参数从token中获取 + /** + * 当前用户id + */ + @NotBlank(message = "userId不能为空",groups =PageFormDTO.AddUserInternalGroup.class) + private String userId; + + /** + * 当前客户id + */ + @NotBlank(message = "customerId不能为空",groups = PageFormDTO.AddUserInternalGroup.class) + private String customerId; +} + diff --git a/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/message/form/MySentFormDTO.java b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/message/form/MySentFormDTO.java new file mode 100644 index 0000000000..91af2354d2 --- /dev/null +++ b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/message/form/MySentFormDTO.java @@ -0,0 +1,33 @@ +package com.epmet.dataaggre.dto.message.form; + +import com.epmet.commons.tools.dto.form.PageFormDTO; +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import java.io.Serializable; + +/** + * @Description 我发出的消息列表查询 + * @Author yinzuomei + * @Date 2021/8/20 2:58 下午 + */ +@Data +public class MySentFormDTO extends PageFormDTO implements Serializable { + private static final long serialVersionUID = 2007425752362914036L; + + private String content; + + //以下参数从token中获取 + /** + * 当前用户id + */ + @NotBlank(message = "userId不能为空",groups =PageFormDTO.AddUserInternalGroup.class) + private String userId; + + /** + * 当前客户id + */ + @NotBlank(message = "customerId不能为空",groups = PageFormDTO.AddUserInternalGroup.class) + private String customerId; +} + diff --git a/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/message/result/InfoDetailResDTO.java b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/message/result/InfoDetailResDTO.java new file mode 100644 index 0000000000..d3b9f34c96 --- /dev/null +++ b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/message/result/InfoDetailResDTO.java @@ -0,0 +1,97 @@ +package com.epmet.dataaggre.dto.message.result; + +import com.epmet.commons.tools.dto.form.FileCommonDTO; +import com.fasterxml.jackson.annotation.JsonFormat; +import lombok.Data; + +import java.io.Serializable; +import java.util.Date; +import java.util.List; + +/** + * @Description 消息详情 + * @Author yinzuomei + * @Date 2021/8/20 7:49 下午 + */ +@Data +public class InfoDetailResDTO implements Serializable { + private String infoId; + + /** + * 发布人头像 + */ + private String headPhoto; + + /** + * 发布人id + */ + private String publishStaffId; + + /** + * 发布人姓名 + */ + private String publishStaffName; + + /** + * 发布人2级组织名 + */ + private String publishOrgName; + + /** + * 发布人性别 + */ + private String publishStaffGender; + + /** + * 是否本人发布,true:是当前用户发布 + */ + private Boolean isMine; + + /** + * 消息内容完整版 + */ + private String content; + + /** + * 发送时间 + */ + @JsonFormat(pattern = "yyyy-MM-dd HH:mm", timezone = "GMT+8") + private Date publishTime; + + /** + * 共XX个接收人 + */ + private Integer totalReceiver; + + /** + * 已读的数量 + */ + private Integer readTotal; + + /** + * 未读的数量 + */ + private Integer unReadCount; + + /** + * 第一个接受人的id + */ + //@JsonIgnore + private String firstReceiverStaffId; + + /** + * 第一个接受人的姓名 + */ + private String firstReceiverName; + + /** + * 未读的回复数量 + */ + private Integer unReadReplyNum; + + /** + * 附件列表 + */ + private List attachmentList; +} + diff --git a/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/message/result/InfoGroupDetailResDTO.java b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/message/result/InfoGroupDetailResDTO.java new file mode 100644 index 0000000000..552e4c2a77 --- /dev/null +++ b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/message/result/InfoGroupDetailResDTO.java @@ -0,0 +1,19 @@ +package com.epmet.dataaggre.dto.message.result; + +import lombok.Data; + +import java.io.Serializable; +import java.util.List; + +/** + * @Description 群组详情 + * @Author yinzuomei + * @Date 2021/8/20 12:58 下午 + */ +@Data +public class InfoGroupDetailResDTO implements Serializable { + private String receiverGroupId; + private String name; + private List staffList; +} + diff --git a/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/message/result/InfoRedDotResultDTO.java b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/message/result/InfoRedDotResultDTO.java new file mode 100644 index 0000000000..40f96878c5 --- /dev/null +++ b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/message/result/InfoRedDotResultDTO.java @@ -0,0 +1,27 @@ +package com.epmet.dataaggre.dto.message.result; + +import com.epmet.commons.tools.constant.NumConstant; +import lombok.Data; + +import java.io.Serializable; + +/** + * @Author zxc + * @DateTime 2021/8/20 3:22 下午 + * @DESC + */ +@Data +public class InfoRedDotResultDTO implements Serializable { + + private static final long serialVersionUID = 6417699657069808978L; + + /** + * 我发出的,新回复数量 + */ + private Integer sentNewReplyCount = NumConstant.ZERO; + + /** + * 我收到的未读的消息数量 + */ + private Integer receivedUnReadCount = NumConstant.ZERO; +} diff --git a/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/message/result/InfoReplyDetail.java b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/message/result/InfoReplyDetail.java new file mode 100644 index 0000000000..2a4bde6fc2 --- /dev/null +++ b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/message/result/InfoReplyDetail.java @@ -0,0 +1,28 @@ +package com.epmet.dataaggre.dto.message.result; + +import com.epmet.commons.tools.dto.form.FileCommonDTO; +import com.fasterxml.jackson.annotation.JsonFormat; +import lombok.Data; + +import java.io.Serializable; +import java.util.Date; +import java.util.List; + +/** + * @Description 发送消息-回复详情 + * @Author yinzuomei + * @Date 2021/8/20 2:01 下午 + */ +@Data +public class InfoReplyDetail extends StaffInfoCommonDTO implements Serializable { + private static final long serialVersionUID = -9038141920493410767L; + private String replyId; + @JsonFormat(pattern = "yyyy-MM-dd HH:mm", timezone = "GMT+8") + private Date replyTime; + private String content; + /** + * 附件列表 + */ + private List attachmentList; +} + diff --git a/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/message/result/InfoReplyResDTO.java b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/message/result/InfoReplyResDTO.java new file mode 100644 index 0000000000..a30090acb1 --- /dev/null +++ b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/message/result/InfoReplyResDTO.java @@ -0,0 +1,18 @@ +package com.epmet.dataaggre.dto.message.result; + +import lombok.Data; + +import java.io.Serializable; +import java.util.List; + +/** + * @Description 发送消息-回复列表 + * @Author yinzuomei + * @Date 2021/8/20 2:00 下午 + */ +@Data +public class InfoReplyResDTO implements Serializable { + private Integer total; + private List dataList; +} + diff --git a/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/message/result/MyInfoGroupResultDTO.java b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/message/result/MyInfoGroupResultDTO.java new file mode 100644 index 0000000000..4e4c89b2d0 --- /dev/null +++ b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/message/result/MyInfoGroupResultDTO.java @@ -0,0 +1,24 @@ +package com.epmet.dataaggre.dto.message.result; + +import com.fasterxml.jackson.annotation.JsonIgnore; +import lombok.Data; + +import java.io.Serializable; +import java.util.List; + +/** + * @Description 我创建的群组列表 + * @Author yinzuomei + * @Date 2021/8/20 10:30 上午 + */ +@Data +public class MyInfoGroupResultDTO implements Serializable { + private static final long serialVersionUID = 3621868560778309056L; + private String receiverGroupId; + private String name; + private Integer totalMem; + @JsonIgnore + private List staffIdList; + private List staffNameList; +} + diff --git a/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/message/result/MyReceivedResDTO.java b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/message/result/MyReceivedResDTO.java new file mode 100644 index 0000000000..d5a5f5b830 --- /dev/null +++ b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/message/result/MyReceivedResDTO.java @@ -0,0 +1,35 @@ +package com.epmet.dataaggre.dto.message.result; + +import com.epmet.commons.tools.dto.form.FileCommonDTO; +import com.fasterxml.jackson.annotation.JsonFormat; +import lombok.Data; + +import java.io.Serializable; +import java.util.Date; +import java.util.List; + +/** + * @Description 我收到的消息列表 + * @Author yinzuomei + * @Date 2021/8/20 6:55 下午 + */ +@Data +public class MyReceivedResDTO implements Serializable { + private static final long serialVersionUID = 2602131254448130443L; + private String infoId; + private String publishStaffName; + private String publishStaffOrgName; + private String headPhoto; + private String content; + @JsonFormat(pattern = "yyyy-MM-dd HH:mm", timezone = "GMT+8") + private Date publishTime; + /** + * 附件列表 列表默认返回一个 + */ + private List attachmentList; + private Boolean readFlag; + private String publishStaffGender; + + private String firstAttId; +} + diff --git a/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/message/result/MySentResDTO.java b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/message/result/MySentResDTO.java new file mode 100644 index 0000000000..dbb72ca045 --- /dev/null +++ b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/message/result/MySentResDTO.java @@ -0,0 +1,31 @@ +package com.epmet.dataaggre.dto.message.result; + +import com.epmet.commons.tools.dto.form.FileCommonDTO; +import com.fasterxml.jackson.annotation.JsonFormat; +import lombok.Data; + +import java.io.Serializable; +import java.util.Date; +import java.util.List; + +/** + * @Description 我发送的消息列表 + * @Author yinzuomei + * @Date 2021/8/20 3:01 下午 + */ +@Data +public class MySentResDTO implements Serializable { + private static final long serialVersionUID = -6765856639039569052L; + private String infoId; + private String content; + @JsonFormat(pattern = "yyyy-MM-dd HH:mm", timezone = "GMT+8") + private Date publishTime; + private Integer totalReceiver; + private Integer readTotal; + private String firstAttId; + /** + * 附件列表 列表默认返回一个 + */ + private List attachmentList; +} + diff --git a/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/message/result/StaffInfoCommonDTO.java b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/message/result/StaffInfoCommonDTO.java new file mode 100644 index 0000000000..c766f176ec --- /dev/null +++ b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/message/result/StaffInfoCommonDTO.java @@ -0,0 +1,21 @@ +package com.epmet.dataaggre.dto.message.result; + +import lombok.Data; + +import java.io.Serializable; + +/** + * @Description 工作人员列表基本信息,通用吧 + * @Author yinzuomei + * @Date 2021/8/20 1:02 下午 + */ +@Data +public class StaffInfoCommonDTO implements Serializable { + private String staffId; + private String staffName; + private String gender; + private String orgName; + private String headPhoto; + +} + 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..16d6aa362f 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,5 +1,6 @@ package com.epmet.dataaggre.controller; +import com.epmet.commons.tools.redis.common.CustomerStaffRedis; import com.epmet.commons.tools.utils.Result; import com.epmet.dataaggre.service.DemoService; import org.springframework.beans.factory.annotation.Autowired; @@ -17,7 +18,14 @@ public class DemoController { @GetMapping("doIt") public Result doIt() { demoService.doIt(); + + + //CustomerStaffRedis bean = SpringContextUtils.getBean(CustomerStaffRedis.class); + CustomerStaffRedis.initTest(); + 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 0e59d1de3c..0a97ac36df 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 @@ -14,6 +14,7 @@ import com.epmet.dataaggre.dto.epmetuser.form.OpenStaffDetailFormDTO; import com.epmet.dataaggre.dto.epmetuser.form.PatrolDateListFormDTO; import com.epmet.dataaggre.dto.epmetuser.form.PatrolRecordListFormDTO; import com.epmet.dataaggre.dto.epmetuser.form.StaffListFormDTO; +import com.epmet.dataaggre.dto.epmetuser.form.*; import com.epmet.dataaggre.dto.epmetuser.result.*; import com.epmet.dataaggre.dto.govorg.result.GridMemberDataAnalysisResultDTO; import com.epmet.dataaggre.excel.StaffPatrollExcel; @@ -220,4 +221,54 @@ public class EpmetUserController { ExcelUtils.exportExcelToTarget(response, null, resultDTOS, StaffPatrollExcel.class); } + /** + * @Param formDTO + * @Description 通讯录】姓名检索工作人员 + * @author sun + */ + @PostMapping("stafflistbyrealname") + public Result> staffListByRealName(@LoginUser TokenDto tokenDto, @RequestBody ListStaffFormDTO formDTO) { + ValidatorUtils.validateEntity(formDTO, ListStaffFormDTO.Staff.class); + formDTO.setCustomerId(tokenDto.getCustomerId()); + 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 1f044a21e2..3f3020c147 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,12 +9,8 @@ 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.result.AgencyGridListResultDTO; -import com.epmet.dataaggre.dto.govorg.result.GridMemberDataAnalysisResultDTO; -import com.epmet.dataaggre.dto.govorg.result.NextAreaCodeResultDTO; -import com.epmet.dataaggre.dto.govorg.result.StaffAgencyGridListResultDTO; +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; import com.epmet.dataaggre.service.govorg.GovOrgService; @@ -128,4 +124,43 @@ public class GovOrgController { return new Result().ok(govOrgService.staffAgencyGridList(tokenDto)); } + /** + * @Param formDTO + * @Description 【通讯录】组织/部门/网格下人员列表 + * @author sun + */ + @PostMapping("stafflist") + public Result staffList(@LoginUser TokenDto tokenDto, @RequestBody OrgStaffListFormDTO formDTO) { + ValidatorUtils.validateEntity(formDTO, OrgStaffListFormDTO.OrgStaff.class); + if(!"agency".equals(formDTO.getOrgType())&&!"dept".equals(formDTO.getOrgType())&&!"grid".equals(formDTO.getOrgType())){ + throw new RenException("参数类型错误"); + } + formDTO.setCustomerId(tokenDto.getCustomerId()); + return new Result().ok(govOrgService.staffList(formDTO)); + } + + /** + * @Param formDTO + * @Description 【通讯录】人员详情v2 + * @author sun + */ + @PostMapping("staffdetailv2") + public Result staffDetailV2(@RequestBody StaffDetailV2ResultDTO formDTO) { + ValidatorUtils.validateEntity(formDTO, StaffDetailV2ResultDTO.Staff.class); + 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..0d5cc65eba --- /dev/null +++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/controller/InfoController.java @@ -0,0 +1,158 @@ +package com.epmet.dataaggre.controller; + +import com.epmet.commons.tools.annotation.LoginUser; +import com.epmet.commons.tools.dto.form.PageFormDTO; +import com.epmet.commons.tools.security.dto.TokenDto; +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.dto.message.form.InfoGroupDetailFormDTO; +import com.epmet.dataaggre.dto.message.form.InfoIdDTO; +import com.epmet.dataaggre.dto.message.form.InfoRepliesFormDTO; +import com.epmet.dataaggre.dto.message.form.MySentFormDTO; +import com.epmet.dataaggre.dto.message.result.*; +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; +import java.util.List; + +/** + * @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); + + } + + /** + * 发送消息-我创建的群组列表 + * + * @param tokenDto + * @return com.epmet.commons.tools.utils.Result> + * @author yinzuomei + * @date 2021/8/20 10:32 上午 + */ + @PostMapping("grouplist") + public Result> queryMyGroupList(@LoginUser TokenDto tokenDto){ + return new Result>().ok(epmetMessageService.queryMyGroupList(tokenDto.getUserId(),tokenDto.getCustomerId())); + } + + /** + * 发送消息-群组详情 + * + * @param tokenDto + * @param formDTO + * @return com.epmet.commons.tools.utils.Result + * @author yinzuomei + * @date 2021/8/20 12:59 下午 + */ + @PostMapping("groupdetail") + public Result queryGroupDetail(@LoginUser TokenDto tokenDto, @RequestBody InfoGroupDetailFormDTO formDTO){ + formDTO.setCustomerId(tokenDto.getCustomerId()); + formDTO.setUserId(tokenDto.getUserId()); + ValidatorUtils.validateEntity(formDTO, PageFormDTO.AddUserInternalGroup.class); + return new Result().ok(epmetMessageService.queryGroupDetail(formDTO)); + } + + /** + * 发送消息-消息详情-回复列表(分页查询) + * + * @param formDTO + * @return com.epmet.commons.tools.utils.Result + * @author yinzuomei + * @date 2021/8/20 2:09 下午 + */ + @PostMapping("replylist") + public Result queryInfoReplies(@LoginUser TokenDto tokenDto,@RequestBody InfoRepliesFormDTO formDTO){ + formDTO.setCustomerId(tokenDto.getCustomerId()); + formDTO.setUserId(tokenDto.getUserId()); + ValidatorUtils.validateEntity(formDTO, PageFormDTO.AddUserInternalGroup.class); + return new Result().ok(epmetMessageService.queryInfoReplies(formDTO)); + } + + /** + * @Description 【发送消息】我收到、我发送红点 + * @Param userId + * @author zxc + * @date 2021/8/20 3:38 下午 + */ + @PostMapping("reddot") + public Result redDot(@LoginUser TokenDto tokenDto){ + return new Result().ok(epmetMessageService.redDot(tokenDto.getUserId())); + } + + + /** + * 发送消息-我发送的列表 可根据内容搜索 + * + * @param tokenDto + * @param mySentFormDTO + * @return com.epmet.commons.tools.utils.Result> + * @author yinzuomei + * @date 2021/8/20 3:02 下午 + */ + @PostMapping("sentlist") + public Result> queryMySent(@LoginUser TokenDto tokenDto, @RequestBody MySentFormDTO mySentFormDTO){ + mySentFormDTO.setCustomerId(tokenDto.getCustomerId()); + mySentFormDTO.setUserId(tokenDto.getUserId()); + ValidatorUtils.validateEntity(mySentFormDTO,PageFormDTO.AddUserInternalGroup.class); + return new Result>().ok(epmetMessageService.queryMySent(mySentFormDTO)); + } + + /** + * 发送消息-我收到的列表 + * + * @param tokenDto + * @param formDTO + * @return com.epmet.commons.tools.utils.Result + * @author yinzuomei + * @date 2021/8/20 6:54 下午 + */ + @PostMapping("receivedlist") + public Result> queryMyReceivedList(@LoginUser TokenDto tokenDto, @RequestBody MySentFormDTO formDTO){ + formDTO.setCustomerId(tokenDto.getCustomerId()); + formDTO.setUserId(tokenDto.getUserId()); + ValidatorUtils.validateEntity(formDTO,PageFormDTO.AddUserInternalGroup.class); + return new Result>().ok(epmetMessageService.queryMyReceivedList(formDTO)); + } + + /** + * 消息详情:我收到的,我发送的,通用 + * + * @param tokenDto + * @param infoIdDTO + * @return com.epmet.commons.tools.utils.Result + * @author yinzuomei + * @date 2021/8/20 7:57 下午 + */ + @PostMapping("infodetail") + public Result queryInfoDetail(@LoginUser TokenDto tokenDto,@RequestBody InfoIdDTO infoIdDTO){ + infoIdDTO.setCustomerId(tokenDto.getCustomerId()); + infoIdDTO.setUserId(tokenDto.getUserId()); + ValidatorUtils.validateEntity(infoIdDTO,InfoIdDTO.AddUserInternalGroup.class); + return new Result().ok(epmetMessageService.queryInfoDetail(infoIdDTO)); + } +} diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/epmetmessage/InfoProfileDao.java b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/epmetmessage/InfoProfileDao.java new file mode 100644 index 0000000000..9dd9eae766 --- /dev/null +++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/epmetmessage/InfoProfileDao.java @@ -0,0 +1,72 @@ +/** + * 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.dataaggre.dao.epmetmessage; + +import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.commons.tools.dto.form.FileCommonDTO; +import com.epmet.dataaggre.dto.message.result.InfoDetailResDTO; +import com.epmet.dataaggre.dto.message.result.MyReceivedResDTO; +import com.epmet.dataaggre.dto.message.result.MySentResDTO; +import com.epmet.dataaggre.entity.epmetmessage.InfoProfileEntity; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + * 消息概要表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2021-08-18 + */ +@Mapper +public interface InfoProfileDao extends BaseDao { + + /** + * 我发出的消息列表 + * + * @param publishStaffId + * @return java.util.List + * @author yinzuomei + * @date 2021/8/20 3:46 下午 + */ + List selectListMySent(@Param("publishStaffId") String publishStaffId,@Param("content") String content); + + /** + * 我收到的消息列表 + * + * @param userId + * @param content + * @return java.util.List + * @author yinzuomei + * @date 2021/8/20 7:01 下午 + */ + List selectListMyReceived(@Param("userId") String userId, @Param("content") String content); + + /** + * 消息详情 + * + * @param infoId + * @return com.epmet.dataaggre.dto.message.result.InfoDetailResDTO + * @author yinzuomei + * @date 2021/8/20 7:58 下午 + */ + InfoDetailResDTO selectInfoDetail(String infoId); + + List selectInfoAtt(String infoId); +} \ No newline at end of file diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/epmetmessage/InfoReceiversDao.java b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/epmetmessage/InfoReceiversDao.java new file mode 100644 index 0000000000..5d232ffe09 --- /dev/null +++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/epmetmessage/InfoReceiversDao.java @@ -0,0 +1,109 @@ +/** + * 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.dataaggre.dao.epmetmessage; + +import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.commons.tools.dto.form.FileCommonDTO; +import com.epmet.dataaggre.dto.message.result.InfoGroupDetailResDTO; +import com.epmet.dataaggre.dto.message.result.InfoReplyDetail; +import com.epmet.dataaggre.dto.message.result.MyInfoGroupResultDTO; +import com.epmet.dataaggre.entity.epmetmessage.InfoReceiversEntity; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + * 消息接收人记录表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2021-08-18 + */ +@Mapper +public interface InfoReceiversDao extends BaseDao { + + /** + * 我创建的群组列表 + * + * @param staffId + * @param customerId + * @return java.util.List + * @author yinzuomei + * @date 2021/8/20 10:37 上午 + */ + List selectMyGroupList(@Param("staffId") String staffId,@Param("customerId") String customerId,@Param("receiverGroupId")String receiverGroupId); + + /** + * 我创建的组内所有的人 + * + * @param staffId + * @param customerId + * @return java.util.List + * @author yinzuomei + * @date 2021/8/20 10:46 上午 + */ + List selectDistinctStaffIds(@Param("staffId") String staffId, + @Param("customerId") String customerId, + @Param("receiverGroupId")String receiverGroupId); + + /** + * 根据小组id,查询群组基本信息 (群组id, 群组名称) + * + * @param receiverGroupId + * @return com.epmet.dataaggre.dto.message.result.InfoGroupDetailResDTO + * @author yinzuomei + * @date 2021/8/20 2:19 下午 + */ + InfoGroupDetailResDTO selectGroupInfo(String receiverGroupId); + + /** + * 分页查询消息的回复列表 + * + * @param infoId + * @return java.util.List + * @author yinzuomei + * @date 2021/8/20 2:20 下午 + */ + List selectListReply(String infoId); + + /** + * 回复附件 + * + * @param replyId + * @return java.util.List + * @author yinzuomei + * @date 2021/8/20 2:31 下午 + */ + List selectReplyAtt(String replyId); + + /** + * @Description 查询我收到的未读的消息数量 + * @Param userId + * @author zxc + * @date 2021/8/20 4:16 下午 + */ + Integer selectUnReadCount(@Param("userId") String userId); + + /** + * @Description 我发出的,新回复数量 + * @Param userId + * @author zxc + * @date 2021/8/20 4:20 下午 + */ + Integer selectNewReplyCount(@Param("userId") String userId); +} \ No newline at end of file diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/epmetuser/CustomerStaffDao.java b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/epmetuser/CustomerStaffDao.java index 3e96cbcc26..e06011fe40 100644 --- a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/epmetuser/CustomerStaffDao.java +++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/epmetuser/CustomerStaffDao.java @@ -19,6 +19,8 @@ package com.epmet.dataaggre.dao.epmetuser; import com.epmet.commons.mybatis.dao.BaseDao; import com.epmet.dataaggre.dto.epmetuser.CustomerStaffDTO; +import com.epmet.dataaggre.dto.epmetuser.result.ListStaffResultDTO; +import com.epmet.dataaggre.dto.govorg.form.OrgStaffListFormDTO; import com.epmet.dataaggre.entity.epmetuser.CustomerStaffEntity; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; @@ -44,4 +46,22 @@ public interface CustomerStaffDao extends BaseDao { * @author sun */ List selectByStaffIds(@Param("staffIds") List staffIds, @Param("realName") String realName); + + /** + * @Description 模糊查询用户、角色信息 + * @author sun + */ + List selectByRealName(@Param("customerId") String customerId, @Param("realName") String realName); + + /** + * @Description 分页查询工作人员基础信息、角色信息【组织人员单位领导角色人员在前;部门人员部门领导角色人员在前;网格人员网格长角色人员在前】 + * @author sun + */ + List selectStaffList(OrgStaffListFormDTO formDTO); + + /** + * @Description 查询工作人员基础信息 + * @author sun + */ + CustomerStaffDTO selectByStaffId(@Param("staffId") String staffId); } \ No newline at end of file diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/epmetuser/GovStaffRoleDao.java b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/epmetuser/GovStaffRoleDao.java index 5cdb42779f..a1bb0cccd9 100644 --- a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/epmetuser/GovStaffRoleDao.java +++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/epmetuser/GovStaffRoleDao.java @@ -19,7 +19,11 @@ package com.epmet.dataaggre.dao.epmetuser; import com.epmet.commons.mybatis.dao.BaseDao; import com.epmet.dataaggre.entity.epmetuser.GovStaffRoleEntity; +import com.epmet.dto.result.StaffRoleResultDTO; import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +import java.util.List; /** * 政府端角色表 @@ -29,5 +33,12 @@ import org.apache.ibatis.annotations.Mapper; */ @Mapper public interface GovStaffRoleDao extends BaseDao { - -} \ No newline at end of file + + /** + * desc:根据员工id 获取角色列表 + * + * @param staffId + * @return + */ + List getStaffRoleList(@Param("staffId") String staffId); +} diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/epmetuser/StaffRoleDao.java b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/epmetuser/StaffRoleDao.java index e6435c6507..bfee2a0129 100644 --- a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/epmetuser/StaffRoleDao.java +++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/epmetuser/StaffRoleDao.java @@ -18,6 +18,7 @@ package com.epmet.dataaggre.dao.epmetuser; import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.dataaggre.dto.epmetuser.result.RoleListResultDTO; import com.epmet.dataaggre.dto.epmetuser.result.StaffRoleListResultDTO; import com.epmet.dataaggre.dto.govorg.result.GridStaffResultDTO; import com.epmet.dataaggre.entity.epmetuser.StaffRoleEntity; @@ -48,4 +49,19 @@ public interface StaffRoleDao extends BaseDao { **/ List selectStaffRoleList(@Param("customerId") String customerId, @Param("staffId") String staffId); + /** + * @Description 查询工作人员拥有的角色名称列表 + * @Author sun + **/ + List selectByStaffId(@Param("staffId") String staffId); + + /** + * @Description 角色人数 + * @Param customerId + * @Return {@link List< RoleListResultDTO>} + * @Author zhaoqifeng + * @Date 2021/8/19 17:16 + */ + List getRoleCountList(@Param("customerId") String customerId); + } \ No newline at end of file diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/govorg/CustomerAgencyDao.java b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/govorg/CustomerAgencyDao.java index 8287c13882..544f7387dd 100644 --- a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/govorg/CustomerAgencyDao.java +++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/govorg/CustomerAgencyDao.java @@ -20,6 +20,8 @@ package com.epmet.dataaggre.dao.govorg; import com.epmet.commons.mybatis.dao.BaseDao; import com.epmet.dataaggre.dto.govorg.result.AgencyGridResultDTO; import com.epmet.dataaggre.dto.govorg.result.StaffAgencyGridListResultDTO; +import com.epmet.dataaggre.dto.govorg.result.StaffOrgNameResultDTO; +import com.epmet.dataaggre.dto.govorg.result.StaffOrgRelationResultDTO; import com.epmet.dataaggre.entity.govorg.CustomerAgencyEntity; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; @@ -42,7 +44,7 @@ public interface CustomerAgencyDao extends BaseDao { List selectAllSubAgency(@Param("subPids") String subPids); /** - * @Description 根据userId查询组织ID + * @Description 根据userId查询组织ID * @Param userId * @author zxc * @date 2020/12/25 下午4:55 @@ -52,11 +54,24 @@ public interface CustomerAgencyDao extends BaseDao { List selectUsedAreaCodeList(@Param("parentAreaCode") String parentAreaCode); - List selectNextAgency(@Param("customerId")String customerId, @Param("pid")String pid); + List selectNextAgency(@Param("customerId") String customerId, @Param("pid") String pid); /** * @Author sun * @Description 递归查询当前组织的直属下级组织列表 **/ List selectSubAgencyList(@Param("subAgencyPids") String subAgencyPids); -} \ No newline at end of file + + /** + * @Description 批量查询工作人员注册组织信息 + * @author sun + */ + List selelctStaffOrg(@Param("staffIdList") List staffIdList); + + /** + * desc:获取工作人员是怎么添加的 + * @param staffId + * @return + */ + StaffOrgRelationResultDTO getStaffFromOrgType(@Param("staffId") String staffId); +} diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/govorg/CustomerStaffAgencyDao.java b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/govorg/CustomerStaffAgencyDao.java index 445e796c61..06869bcfdb 100644 --- a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/govorg/CustomerStaffAgencyDao.java +++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/govorg/CustomerStaffAgencyDao.java @@ -19,11 +19,15 @@ package com.epmet.dataaggre.dao.govorg; import com.epmet.commons.mybatis.dao.BaseDao; 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.OrgDTO; import com.epmet.dataaggre.entity.govorg.CustomerStaffAgencyEntity; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; +import java.util.List; + /** * 人员-机关单位关系表 * @@ -44,4 +48,27 @@ public interface CustomerStaffAgencyDao extends BaseDao getStaffGridList(@Param("staffId") String staffId); + + /** + * @Description 按类型查询组织、部门、网格下所有工作人员Id列表 + * @author sun + */ + List selectStaffList(@Param("orgId") String orgId, @Param("orgType") String orgType); + + /** + * @Description 获取下级组织列表 + * @Param agencyId + * @Return {@link List} + * @Author zhaoqifeng + * @Date 2021/8/20 14:08 + */ + List selectSubAgency(@Param("agencyId") String agencyId); + +} diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/govorg/CustomerStaffDepartmentDao.java b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/govorg/CustomerStaffDepartmentDao.java index bde0fbaf92..014c374aca 100644 --- a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/govorg/CustomerStaffDepartmentDao.java +++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/govorg/CustomerStaffDepartmentDao.java @@ -18,11 +18,16 @@ package com.epmet.dataaggre.dao.govorg; import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.dataaggre.dto.govorg.CustomerDepartmentDTO; +import com.epmet.dataaggre.dto.govorg.OrgDTO; import com.epmet.dataaggre.entity.govorg.CustomerStaffDepartmentEntity; import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +import java.util.List; /** - * 部门人员关系表 + * 部门人员关系表 * * @author generator generator@elink-cn.com * @since v1.0.0 2020-04-20 @@ -30,4 +35,20 @@ import org.apache.ibatis.annotations.Mapper; @Mapper public interface CustomerStaffDepartmentDao extends BaseDao { -} \ No newline at end of file + /** + * desc:获取工作人员所在的部门列表 + * + * @param staffId + * @return + */ + List getStaffDeptList(@Param("staffId") String staffId); + + /** + * @Description + * @Param agencyId + * @Return {@link List< OrgDTO>} + * @Author zhaoqifeng + * @Date 2021/8/20 14:29 + */ + List selectDepartmentList(@Param("agencyId") String agencyId); +} diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/govorg/CustomerStaffGridDao.java b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/govorg/CustomerStaffGridDao.java index a6757c8cca..9a4c01d8b6 100644 --- a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/govorg/CustomerStaffGridDao.java +++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/govorg/CustomerStaffGridDao.java @@ -18,6 +18,7 @@ package com.epmet.dataaggre.dao.govorg; import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.dataaggre.dto.govorg.OrgDTO; import com.epmet.dataaggre.dto.govorg.result.GridStaffResultDTO; import com.epmet.dataaggre.dto.govorg.result.StaffAgencyGridListResultDTO; import com.epmet.dataaggre.entity.govorg.CustomerStaffGridEntity; @@ -46,4 +47,13 @@ public interface CustomerStaffGridDao extends BaseDao { * @author sun */ List getStaffGridList(@Param("agencyId") String agencyId, @Param("staffId") String staffId); + + /** + * @Description 获取组织下的网格级网格人数 + * @Param agencyId + * @Return {@link List< OrgDTO>} + * @Author zhaoqifeng + * @Date 2021/8/20 14:37 + */ + List selectGridList(@Param("agencyId") String agencyId); } \ No newline at end of file diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/entity/epmetmessage/InfoProfileEntity.java b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/entity/epmetmessage/InfoProfileEntity.java new file mode 100644 index 0000000000..769e95ad69 --- /dev/null +++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/entity/epmetmessage/InfoProfileEntity.java @@ -0,0 +1,78 @@ +/** + * 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.dataaggre.entity.epmetmessage; + +import com.baomidou.mybatisplus.annotation.TableName; +import com.epmet.commons.mybatis.entity.BaseEpmetEntity; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 消息概要表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2021-08-18 + */ +@Data +@EqualsAndHashCode(callSuper=false) +@TableName("info_profile") +public class InfoProfileEntity extends BaseEpmetEntity { + + private static final long serialVersionUID = 1L; + + /** + * 客户id + */ + private String customerId; + + /** + * 消息主表的id + */ + private String infoId; + + /** + * 发布人id + */ + private String publishStaffId; + + /** + * 内容概要,取前100字 + */ + private String content; + + /** + * 附件ID,第一个用于展示 + */ + private String firstAttId; + + /** + * 应读人数 + */ + private Integer totalReceiver; + + /** + * 已读人数,插入是为0 + */ + private Integer readTotal; + + /** + * 未读的回复数量:发布人每次查看详情后,置为0;接收人回复一条+1 + */ + private Integer unReadReplyNum; + +} diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/entity/epmetmessage/InfoReceiversEntity.java b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/entity/epmetmessage/InfoReceiversEntity.java new file mode 100644 index 0000000000..b80aeeb3a4 --- /dev/null +++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/entity/epmetmessage/InfoReceiversEntity.java @@ -0,0 +1,58 @@ +/** + * 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.dataaggre.entity.epmetmessage; + +import com.baomidou.mybatisplus.annotation.TableName; +import com.epmet.commons.mybatis.entity.BaseEpmetEntity; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 消息接收人记录表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2021-08-18 + */ +@Data +@EqualsAndHashCode(callSuper=false) +@TableName("info_receivers") +public class InfoReceiversEntity extends BaseEpmetEntity { + + private static final long serialVersionUID = 1L; + + /** + * 客户ID + */ + private String customerId; + + /** + * 消息主表.id + */ + private String infoId; + + /** + * 工作人员id + */ + private String staffId; + + /** + * 已读:1;未读:0 + */ + private Boolean readFlag; + +} 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..09f13e55b7 --- /dev/null +++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/epmetmessage/EpmetMessageService.java @@ -0,0 +1,94 @@ +package com.epmet.dataaggre.service.epmetmessage; + +import com.epmet.dataaggre.dto.govorg.form.ReceiversFormDTO; +import com.epmet.dataaggre.dto.govorg.result.ReceiversResultDTO; +import com.epmet.dataaggre.dto.message.form.InfoGroupDetailFormDTO; +import com.epmet.dataaggre.dto.message.form.InfoIdDTO; +import com.epmet.dataaggre.dto.message.form.InfoRepliesFormDTO; +import com.epmet.dataaggre.dto.message.form.MySentFormDTO; +import com.epmet.dataaggre.dto.message.result.*; + +import java.util.List; + +/** + * @author Administrator + */ +public interface EpmetMessageService { + /** + * @Description 获取已读未读人员列表 + * @Param formDTO + * @Return {@link ReceiversResultDTO} + * @Author zhaoqifeng + * @Date 2021/8/19 14:56 + */ + ReceiversResultDTO getReceiverList(ReceiversFormDTO formDTO); + + /** + * 我创建的群组列表 + * + * @param staffId + * @param customerId + * @return java.util.List + * @author yinzuomei + * @date 2021/8/20 10:33 上午 + */ + List queryMyGroupList(String staffId, String customerId); + + /** + * 发送消息-群组详情 + * + * @param formDTO + * @return com.epmet.dataaggre.dto.message.result.InfoGroupDetailResDTO + * @author yinzuomei + * @date 2021/8/20 12:59 下午 + */ + InfoGroupDetailResDTO queryGroupDetail(InfoGroupDetailFormDTO formDTO); + + /** + * 发送消息-消息详情-回复列表(分页查询) + * + * @param formDTO + * @return com.epmet.dataaggre.dto.message.result.InfoReplyResDTO + * @author yinzuomei + * @date 2021/8/20 2:09 下午 + */ + InfoReplyResDTO queryInfoReplies(InfoRepliesFormDTO formDTO); + + /** + * @Description 【发送消息】我收到、我发送红点 + * @Param userId + * @author zxc + * @date 2021/8/20 3:38 下午 + */ + InfoRedDotResultDTO redDot(String userId); + + /** + * 发送消息-我发送的列表 可根据内容搜索 + * + * @param mySentFormDTO + * @return java.util.List + * @author yinzuomei + * @date 2021/8/20 3:03 下午 + */ + List queryMySent(MySentFormDTO mySentFormDTO); + + /** + * 发送消息-我收到的消息列表 可根据内容搜索 + * + * @param formDTO + * @return java.util.List + * @author yinzuomei + * @date 2021/8/20 7:00 下午 + */ + List queryMyReceivedList(MySentFormDTO formDTO); + + /** + * 消息详情:我收到的,我发送的,通用 + * + * @param infoIdDTO + * @return com.epmet.dataaggre.dto.message.result.InfoDetailResDTO + * @author yinzuomei + * @date 2021/8/20 7:57 下午 + */ + InfoDetailResDTO queryInfoDetail(InfoIdDTO infoIdDTO); +} 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..df8653357b --- /dev/null +++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/epmetmessage/impl/EpmetMessageServiceImpl.java @@ -0,0 +1,268 @@ +package com.epmet.dataaggre.service.epmetmessage.impl; + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.epmet.commons.dynamic.datasource.annotation.DataSource; +import com.epmet.commons.tools.constant.NumConstant; +import com.epmet.commons.tools.constant.StrConstant; +import com.epmet.commons.tools.dto.result.CustomerStaffInfoCacheResult; +import com.epmet.commons.tools.exception.RenException; +import com.epmet.commons.tools.redis.common.CustomerStaffRedis; +import com.epmet.dataaggre.constant.DataSourceConstant; +import com.epmet.dataaggre.dao.epmetmessage.InfoProfileDao; +import com.epmet.dataaggre.dao.epmetmessage.InfoReceiversDao; +import com.epmet.dataaggre.dto.govorg.ReceiverDTO; +import com.epmet.dataaggre.dto.govorg.form.ReceiversFormDTO; +import com.epmet.dataaggre.dto.govorg.result.ReceiversResultDTO; +import com.epmet.dataaggre.dto.message.form.InfoGroupDetailFormDTO; +import com.epmet.dataaggre.dto.message.form.InfoIdDTO; +import com.epmet.dataaggre.dto.message.form.InfoRepliesFormDTO; +import com.epmet.dataaggre.dto.message.form.MySentFormDTO; +import com.epmet.dataaggre.dto.message.result.*; +import com.epmet.dataaggre.entity.epmetmessage.InfoReceiversEntity; +import com.epmet.dataaggre.service.epmetmessage.EpmetMessageService; +import com.github.pagehelper.PageHelper; +import com.github.pagehelper.PageInfo; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.collections4.CollectionUtils; +import org.apache.commons.lang3.StringUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; +import java.util.stream.Collectors; + +/** + * @Description + * @Author zhaoqifeng + * @Date 2021/8/19 15:23 + */ +@Service +@DataSource(DataSourceConstant.EPMET_MESSAGE) +@Slf4j +public class EpmetMessageServiceImpl implements EpmetMessageService { + @Autowired + private InfoReceiversDao infoReceiversDao; + @Autowired + private InfoProfileDao infoProfileDao; + + /** + * @param formDTO + * @Description 获取已读未读人员列表 + * @Param formDTO + * @Return {@link ReceiversResultDTO} + * @Author zhaoqifeng + * @Date 2021/8/19 14:56 + */ + @Override + public ReceiversResultDTO getReceiverList(ReceiversFormDTO formDTO) { + ReceiversResultDTO result = new ReceiversResultDTO(); + //检索已读/未读人员列表,并分页 + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper.eq(InfoReceiversEntity :: getInfoId, formDTO.getInfoId()); + wrapper.eq(StringUtils.isNotBlank(formDTO.getReadFlag()), InfoReceiversEntity :: getReadFlag, NumConstant.ONE_STR.equals(formDTO.getReadFlag())); + Page page = new Page<>(formDTO.getPageNo(), formDTO.getPageSize()); + IPage iPage = infoReceiversDao.selectPage(page, wrapper); + List list = iPage.getRecords(); + result.setTotal((int) iPage.getTotal()); + //结果为空,返回 + if (CollectionUtils.isEmpty(list)) { + result.setDataList(Collections.emptyList()); + return result; + } + //构建人员列表 + List dataList = list.stream().map(item -> { + ReceiverDTO dto = new ReceiverDTO(); + dto.setStaffId(item.getStaffId()); + dto.setReadFlag(item.getReadFlag()); + CustomerStaffInfoCacheResult staffInfoCache = CustomerStaffRedis.getStaffInfo(item.getCustomerId(), item.getStaffId()); + dto.setStaffName(staffInfoCache.getRealName()); + dto.setGender(staffInfoCache.getGender()); + dto.setHeadPhoto(staffInfoCache.getHeadPhoto()); + dto.setOrgName(staffInfoCache.getTwoOrgName()); + return dto; + }).collect(Collectors.toList()); + result.setDataList(dataList); + return result; + } + + /** + * 我创建的群组列表 + * + * @param staffId + * @param customerId + * @return java.util.List + * @author yinzuomei + * @date 2021/8/20 10:33 上午 + */ + @Override + public List queryMyGroupList(String staffId, String customerId) { + // 按照小组的创建时间升序,新创建在后面, 显示的人员时按照info_group_receivers 群成员表的主键升序 + List list = infoReceiversDao.selectMyGroupList(staffId, customerId,null); + if (CollectionUtils.isNotEmpty(list)) { + // 2、遍历每个群组,赋值工作人员姓名列表 + for (MyInfoGroupResultDTO group : list) { + List staffNameList = new ArrayList<>(); + for (String userId : group.getStaffIdList()) { + //查询每个工作人员的基本信息,获取姓名 + CustomerStaffInfoCacheResult staffInfoCache = CustomerStaffRedis.getStaffInfo(customerId, userId); + if (null != staffInfoCache) { + staffNameList.add(staffInfoCache.getRealName()); + } + } + group.setStaffNameList(staffNameList); + } + } + return list; + } + + /** + * 发送消息-群组详情 + * + * @param formDTO + * @return com.epmet.dataaggre.dto.message.result.InfoGroupDetailResDTO + * @author yinzuomei + * @date 2021/8/20 12:59 下午 + */ + @Override + public InfoGroupDetailResDTO queryGroupDetail(InfoGroupDetailFormDTO formDTO) { + InfoGroupDetailResDTO resDTO = infoReceiversDao.selectGroupInfo(formDTO.getReceiverGroupId()); + if (null == resDTO) { + throw new RenException("info_receiver_group dosen't have record"); + } + resDTO.setStaffList(new ArrayList<>()); + //按照info_group_receivers 群成员表的主键升序 + PageInfo staffIds = PageHelper.startPage(formDTO.getPageNo(), formDTO.getPageSize()).doSelectPageInfo(() -> infoReceiversDao.selectDistinctStaffIds(formDTO.getUserId(), formDTO.getCustomerId(), formDTO.getReceiverGroupId())); + if (CollectionUtils.isNotEmpty(staffIds.getList())) { + for (String userId : staffIds.getList()) { + //查询每个工作人员的基本信息 + CustomerStaffInfoCacheResult staffInfoCache = CustomerStaffRedis.getStaffInfo(formDTO.getCustomerId(), userId); + if (null != staffInfoCache) { + StaffInfoCommonDTO staffInfo = new StaffInfoCommonDTO(); + staffInfo.setStaffId(userId); + staffInfo.setStaffName(staffInfoCache.getRealName()); + staffInfo.setGender(staffInfoCache.getGender().toString()); + staffInfo.setHeadPhoto(StringUtils.isNotBlank(staffInfoCache.getHeadPhoto()) ? staffInfoCache.getHeadPhoto() : StrConstant.EPMETY_STR); + staffInfo.setOrgName(staffInfoCache.getTwoOrgName()); + resDTO.getStaffList().add(staffInfo); + } + } + } + return resDTO; + } + + /** + * 发送消息-消息详情-回复列表(分页查询) + * + * @param formDTO + * @return com.epmet.dataaggre.dto.message.result.InfoReplyResDTO + * @author yinzuomei + * @date 2021/8/20 2:09 下午 + */ + @Override + public InfoReplyResDTO queryInfoReplies(InfoRepliesFormDTO formDTO) { + InfoReplyResDTO result = new InfoReplyResDTO(); + // 按照回复时间降序排列 ,新回复的在最上面 + PageInfo data = PageHelper.startPage(formDTO.getPageNo(), formDTO.getPageSize()).doSelectPageInfo(() -> infoReceiversDao.selectListReply(formDTO.getInfoId())); + result.setTotal((int) data.getTotal()); + for (InfoReplyDetail detail : data.getList()) { + //查询每个工作人员的基本信息 + CustomerStaffInfoCacheResult staffInfoCache = CustomerStaffRedis.getStaffInfo(formDTO.getCustomerId(), detail.getStaffId()); + detail.setStaffName(staffInfoCache.getRealName()); + detail.setGender(staffInfoCache.getGender().toString()); + detail.setHeadPhoto(StringUtils.isNotBlank(staffInfoCache.getHeadPhoto()) ? staffInfoCache.getHeadPhoto() : StrConstant.EPMETY_STR); + detail.setOrgName(staffInfoCache.getTwoOrgName()); + } + result.setDataList(data.getList()); + return result; + } + + /** + * @Description 【发送消息】我收到、我发送红点 + * 我发出的查询info_profile限制住created_by=当前用户, sum未读的回复数 + * 我收到的info_receivers,并且未读的 count(distinct info_id) + * @Param userId + * @author zxc + * @date 2021/8/20 3:38 下午 + */ + @Override + public InfoRedDotResultDTO redDot(String userId) { + InfoRedDotResultDTO result = new InfoRedDotResultDTO(); + result.setReceivedUnReadCount(infoReceiversDao.selectUnReadCount(userId)); + result.setSentNewReplyCount(infoReceiversDao.selectNewReplyCount(userId)); + return result; + } + + /** + * 发送消息-我发送的列表 可根据内容搜索 + * + * @param formDTO + * @return java.util.List + * @author yinzuomei + * @date 2021/8/20 3:03 下午 + */ + @Override + public List queryMySent(MySentFormDTO formDTO) { + PageInfo data = PageHelper.startPage(formDTO.getPageNo(), formDTO.getPageSize()).doSelectPageInfo(() -> infoProfileDao.selectListMySent(formDTO.getUserId(),formDTO.getContent())); + return data.getList(); + } + + /** + * 发送消息-我收到的消息列表 可根据内容搜索 + * + * @param formDTO + * @return java.util.List + * @author yinzuomei + * @date 2021/8/20 7:00 下午 + */ + @Override + public List queryMyReceivedList(MySentFormDTO formDTO) { + PageInfo data = PageHelper.startPage(formDTO.getPageNo(), formDTO.getPageSize()) + .doSelectPageInfo(() -> infoProfileDao.selectListMyReceived(formDTO.getUserId(),formDTO.getContent())); + CustomerStaffInfoCacheResult staffInfoCache = CustomerStaffRedis.getStaffInfo(formDTO.getCustomerId(), formDTO.getUserId()); + for(MyReceivedResDTO resDTO: data.getList()){ + resDTO.setHeadPhoto(StringUtils.isNotBlank(staffInfoCache.getHeadPhoto()) ? staffInfoCache.getHeadPhoto() : StrConstant.EPMETY_STR); + resDTO.setPublishStaffGender(String.valueOf(staffInfoCache.getGender())); + resDTO.setPublishStaffOrgName(staffInfoCache.getTwoOrgName()); + resDTO.setPublishStaffName(staffInfoCache.getRealName()); + } + return data.getList(); + } + + /** + * 消息详情:我收到的,我发送的,通用 + * + * @param infoIdDTO + * @return com.epmet.dataaggre.dto.message.result.InfoDetailResDTO + * @author yinzuomei + * @date 2021/8/20 7:57 下午 + */ + @Override + public InfoDetailResDTO queryInfoDetail(InfoIdDTO infoIdDTO) { + InfoDetailResDTO resDTO=infoProfileDao.selectInfoDetail(infoIdDTO.getInfoId()); + if(null!=resDTO){ + if (resDTO.getPublishStaffId().equals(infoIdDTO.getUserId())) { + resDTO.setIsMine(true); + } else { + resDTO.setIsMine(false); + } + resDTO.setAttachmentList(infoProfileDao.selectInfoAtt(infoIdDTO.getInfoId())); + if(StringUtils.isNotBlank(resDTO.getPublishStaffId())){ + CustomerStaffInfoCacheResult publisher = CustomerStaffRedis.getStaffInfo(infoIdDTO.getCustomerId(), resDTO.getPublishStaffId()); + resDTO.setHeadPhoto(StringUtils.isNotBlank(publisher.getHeadPhoto()) ? publisher.getHeadPhoto() : StrConstant.EPMETY_STR); + resDTO.setPublishOrgName(publisher.getTwoOrgName()); + resDTO.setPublishStaffGender(publisher.getGender().toString()); + resDTO.setPublishStaffName(publisher.getRealName()); + } + if(StringUtils.isNotBlank(resDTO.getFirstReceiverStaffId())){ + CustomerStaffInfoCacheResult first = CustomerStaffRedis.getStaffInfo(infoIdDTO.getCustomerId(), resDTO.getFirstReceiverStaffId()); + resDTO.setFirstReceiverName(first.getRealName()); + } + } + return resDTO; + } + +} 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 e1941c1c08..28820e015b 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 @@ -1,10 +1,10 @@ package com.epmet.dataaggre.service.epmetuser; -import com.epmet.dataaggre.dto.epmetuser.form.OpenStaffDetailFormDTO; -import com.epmet.dataaggre.dto.epmetuser.form.PatrolDateListFormDTO; -import com.epmet.dataaggre.dto.epmetuser.form.PatrolRecordListFormDTO; -import com.epmet.dataaggre.dto.epmetuser.form.StaffListFormDTO; +import com.epmet.dataaggre.dto.epmetuser.CustomerStaffDTO; +import com.epmet.dataaggre.dto.epmetuser.form.*; import com.epmet.dataaggre.dto.epmetuser.result.*; +import com.epmet.dataaggre.dto.govorg.form.OrgStaffListFormDTO; +import com.epmet.dataaggre.dto.govorg.form.StaffDetailV2FormDTO; import com.epmet.dataaggre.dto.govorg.result.GridStaffResultDTO; import java.util.List; @@ -50,7 +50,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 */ @@ -86,14 +86,58 @@ 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); + + /** + * @Param formDTO + * @Description 通讯录】姓名检索工作人员 + * @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); + + /** + * @Description 分页查询工作人员基础信息、角色信息【组织人员单位领导角色人员在前;部门人员部门领导角色人员在前;网格人员网格长角色人员在前】 + * @author sun + */ + List getStaffInfoList(OrgStaffListFormDTO formDTO); + + /** + * @Description 查询工作人员基础信息、角色信息 + * @author sun + */ + StaffDetailV2FormDTO selectByStaffId(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 32bce002dc..3cfb3acf89 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,14 @@ 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.constant.StrConstant; +import com.epmet.commons.tools.dto.form.IdAndNameDTO; +import com.epmet.commons.tools.dto.result.CustomerStaffInfoCacheResult; +import com.epmet.commons.tools.enums.OrgTypeEnum; +import com.epmet.commons.tools.redis.common.CustomerStaffRedis; +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; @@ -9,20 +16,26 @@ import com.epmet.dataaggre.dao.epmetuser.*; import com.epmet.dataaggre.dto.epmetuser.CustomerStaffDTO; import com.epmet.dataaggre.dto.epmetuser.StaffPatrolDetailDTO; import com.epmet.dataaggre.dto.epmetuser.StaffPatrolRecordDTO; -import com.epmet.dataaggre.dto.epmetuser.form.OpenStaffDetailFormDTO; -import com.epmet.dataaggre.dto.epmetuser.form.PatrolDateListFormDTO; -import com.epmet.dataaggre.dto.epmetuser.form.PatrolRecordListFormDTO; -import com.epmet.dataaggre.dto.epmetuser.form.StaffListFormDTO; +import com.epmet.dataaggre.dto.epmetuser.form.*; import com.epmet.dataaggre.dto.epmetuser.result.*; import com.epmet.dataaggre.dto.govorg.CustomerAgencyDTO; +import com.epmet.dataaggre.dto.govorg.CustomerDepartmentDTO; import com.epmet.dataaggre.dto.govorg.CustomerGridDTO; +import com.epmet.dataaggre.dto.govorg.form.OrgStaffListFormDTO; +import com.epmet.dataaggre.dto.govorg.form.StaffDetailV2FormDTO; import com.epmet.dataaggre.dto.govorg.result.GridStaffResultDTO; +import com.epmet.dataaggre.dto.govorg.result.StaffOrgNameResultDTO; +import com.epmet.dataaggre.dto.govorg.result.StaffOrgRelationResultDTO; +import com.epmet.dataaggre.entity.epmetuser.CustomerStaffEntity; +import com.epmet.dataaggre.entity.epmetuser.GovStaffRoleEntity; import com.epmet.dataaggre.entity.epmetuser.ResiUserBadgeEntity; +import com.epmet.dataaggre.entity.epmetuser.StaffRoleEntity; import com.epmet.dataaggre.service.epmetuser.EpmetUserService; import com.epmet.dataaggre.service.epmetuser.StaffPatrolDetailService; import com.epmet.dataaggre.service.epmetuser.StaffPatrolRecordService; import com.epmet.dataaggre.service.govorg.GovOrgService; import com.epmet.dataaggre.service.govproject.GovProjectService; +import com.epmet.dto.result.StaffRoleResultDTO; import lombok.extern.slf4j.Slf4j; import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.lang3.StringUtils; @@ -61,6 +74,8 @@ public class EpmetUserServiceImpl implements EpmetUserService { private ResiUserBadgeDao resiUserBadgeDao; @Autowired private GovProjectService govProjectService; + @Resource + private GovStaffRoleDao govStaffRoleDao; /** * @Description 根据UserIds查询 @@ -424,5 +439,202 @@ public class EpmetUserServiceImpl implements EpmetUserService { return resultDTO; } + /** + * @Param formDTO + * @Description 【通讯录】姓名检索工作人员 + * @author sun + */ + @Override + public List listStaff(ListStaffFormDTO formDTO) { + //1.模糊查询用户、角色信息 + List resultList = customerStaffDao.selectByRealName(formDTO.getCustomerId(), formDTO.getRealName()); + if (null == resultList || resultList.size() < NumConstant.ONE) { + return new ArrayList<>(); + } + + //2.查询用户注册组织信息 + List staffIdList = resultList.stream().map(ListStaffResultDTO::getStaffId).collect(Collectors.toList()); + List orgList = govOrgService.getStaffOrgName(staffIdList); + + //3.封装数据并返回 + resultList.forEach(re -> orgList.stream().filter(l -> re.getStaffId().equals(l.getStaffId())).forEach(s -> re.setOrgName(s.getOrgName()))); + + return resultList; + } + + + /** + * 根据角色查询人员列表 + * + * @param formDTO + * @Param formDTO + * @Return {@link List} + * @Author zhaoqifeng + * @Date 2021/8/19 15:03 + */ + @Override + public List getRoleUsers(RoleUsersFormDTO formDTO) { + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper.eq(StaffRoleEntity :: getCustomerId, formDTO.getCustomerId()); + wrapper.eq(StaffRoleEntity::getRoleId, formDTO.getRoleId()); + List staffRoleList = staffRoleDao.selectList(wrapper); + if (CollectionUtils.isEmpty(staffRoleList)) { + return Collections.emptyList(); + } + return staffRoleList.stream().map(item -> { + RoleUsersResultDTO dto = new RoleUsersResultDTO(); + dto.setStaffId(item.getStaffId()); + //从redis获取用户信息 + CustomerStaffInfoCacheResult staffInfoCache = CustomerStaffRedis.getStaffInfo(item.getCustomerId(), item.getStaffId()); + dto.setGender(staffInfoCache.getGender()); + dto.setHeadPhoto(staffInfoCache.getHeadPhoto()); + dto.setName(staffInfoCache.getRealName()); + dto.setOrgName(staffInfoCache.getTwoOrgName()); + dto.setRoles(new ArrayList<>(staffInfoCache.getRoleMap().values())); + return dto; + }).collect(Collectors.toList()); + } + + /** + * @param customerId + * @Description 获取角色列表 + * @Param customerId + * @Return {@link List} + * @Author zhaoqifeng + * @Date 2021/8/19 15:09 + */ + @Override + public List getRoleList(String customerId) { + //获取角色列表 + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper.eq(GovStaffRoleEntity :: getCustomerId, customerId); + wrapper.orderByAsc(GovStaffRoleEntity ::getSort); + List list = govStaffRoleDao.selectList(wrapper); + //获取角色人数 + List countList = staffRoleDao.getRoleCountList(customerId); + Map map = new HashMap<>(); + if (CollectionUtils.isNotEmpty(countList)) { + map = countList.stream().collect(Collectors.toMap(RoleListResultDTO :: getRoleId, RoleListResultDTO :: getStaffNum)); + } + Map finalMap = map; + //构建返回值 + return list.stream().map(item -> { + RoleListResultDTO dto = new RoleListResultDTO(); + dto.setRoleId(item.getId()); + dto.setRoleKey(item.getRoleKey()); + dto.setRoleName(item.getRoleName()); + dto.setDescription(item.getDescription()); + dto.setStaffNum(null == finalMap.get(item.getId())?NumConstant.ZERO:finalMap.get(item.getId())); + return dto; + }).collect(Collectors.toList()); + } + + @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); + + //查询工作人员所属组织信息 + CustomerAgencyDTO agencyDTO = govOrgService.gridByAgencyId(null,staffId); + if (agencyDTO == null){ + log.error("getStaffInfo have any agency staffId:{}",staffId); + return null; + } + result.setAgencyName(agencyDTO.getOrganizationName()); + StaffOrgRelationResultDTO fromOrgTypeDto = govOrgService.getStaffFromOrgType(staffId); + String fromOrgType = OrgTypeEnum.AGENCY.getCode(); + if (fromOrgTypeDto != null){ + fromOrgType = fromOrgTypeDto.getOrgType(); + result.setFromOrgId(fromOrgTypeDto.getOrgId()); + } + result.setFromOrgType(fromOrgType); + boolean isContinueMkName = true; + StringBuilder showNameBuilder = new StringBuilder(16); + if (OrgTypeEnum.AGENCY.getCode().equals(fromOrgType)){ + String allParentName = agencyDTO.getAllParentName(); + if (StringUtils.isNotBlank(allParentName)){ + showNameBuilder.append(allParentName.substring(allParentName.lastIndexOf(StrConstant.HYPHEN)+NumConstant.ONE)); + showNameBuilder.append(StrConstant.HYPHEN); + showNameBuilder.append(agencyDTO.getOrganizationName()); + isContinueMkName = false; + }else{ + showNameBuilder.append(agencyDTO.getOrganizationName()); + } + } + + List roleList = govStaffRoleDao.getStaffRoleList(staffId); + Map roleMap = roleList.stream().collect(Collectors.toMap(StaffRoleResultDTO::getRoleKey, StaffRoleResultDTO::getRoleName)); + result.setRoleMap(roleMap); + + //1.查询工作人员所在的网格列表 + List list = govOrgService.getStaffGridList(staffId); + List idAndNameList = new ArrayList<>(); + for (CustomerGridDTO customerGridDTO : list) { + IdAndNameDTO grid = new IdAndNameDTO(); + grid.setId(customerGridDTO.getId()); + grid.setName(customerGridDTO.getGridName()); + idAndNameList.add(grid); + if (isContinueMkName && OrgTypeEnum.GRID.getCode().equals(fromOrgType)&&grid.getId().equals(result.getFromOrgId())){ + showNameBuilder.append(agencyDTO.getOrganizationName()).append(StrConstant.HYPHEN).append(grid.getName()); + } + } + result.setGridList(idAndNameList); + + //查询工作人员所在的部门列表 + List deptList = govOrgService.getStaffDeptList(staffId); + idAndNameList = new ArrayList<>(); + for (CustomerDepartmentDTO org : deptList) { + IdAndNameDTO dept = new IdAndNameDTO(); + dept.setId(org.getId()); + dept.setName(org.getDepartmentName()); + idAndNameList.add(dept); + if (isContinueMkName && OrgTypeEnum.DEPT.getCode().equals(fromOrgType)&&dept.getId().equals(result.getFromOrgId())){ + showNameBuilder.append(agencyDTO.getOrganizationName()).append(StrConstant.HYPHEN).append(dept.getName()); + } + } + result.setDeptList(idAndNameList); + //特殊处理 显示的名字 + result.setTwoOrgName(showNameBuilder.toString()); + return result; + } + + /** + * @Description 分页查询工作人员基础信息、角色信息【组织人员单位领导角色人员在前;部门人员部门领导角色人员在前;网格人员网格长角色人员在前】 + * @author sun + */ + @Override + public List getStaffInfoList(OrgStaffListFormDTO formDTO) { + //分别查询不能类型下人员信息、角色信息,按需求排序 + int pageIndex = (formDTO.getPageNo() - NumConstant.ONE) * formDTO.getPageSize(); + formDTO.setPageNo(pageIndex); + List resultList = customerStaffDao.selectStaffList(formDTO); + return resultList; + } + + /** + * @Description 查询工作人员基础信息、角色信息 + * @author sun + */ + @Override + public StaffDetailV2FormDTO selectByStaffId(String staffId) { + StaffDetailV2FormDTO result = new StaffDetailV2FormDTO(); + //基本信息 + CustomerStaffDTO dto = customerStaffDao.selectByStaffId(staffId); + if (null == dto) { + return result; + } + //角色信息 + List list = staffRoleDao.selectByStaffId(staffId); + //汇总数据 + result = ConvertUtils.sourceToTarget(dto, StaffDetailV2FormDTO.class); + result.setName(dto.getRealName()); + result.setRoles(list); + + 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 2e5422376b..a641be3095 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 @@ -2,8 +2,12 @@ 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.CustomerDepartmentDTO; 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.SubOrgFormDTO; import com.epmet.dataaggre.dto.govorg.result.*; import com.epmet.dataaggre.dto.resigroup.result.OrgInfoCommonDTO; @@ -81,4 +85,54 @@ public interface GovOrgService { */ StaffAgencyGridListResultDTO staffAgencyGridList(TokenDto tokenDto); + /** + * @Param formDTO + * @Description 【通讯录】组织/部门/网格下人员列表 + * @author sun + */ + OrgStaffListResultDTO staffList(OrgStaffListFormDTO formDTO); + + /** + * @Param formDTO + * @Description 【通讯录】人员详情v2 + * @author sun + */ + StaffDetailV2FormDTO staffDetailV2(StaffDetailV2ResultDTO formDTO); + + /** + * @Description 下级组织/部门/网格列表 + * @Param formDTO + * @Return {@link SubOrgResultDTO} + * @Author zhaoqifeng + * @Date 2021/8/19 15:12 + */ + SubOrgResultDTO getSubOrg(SubOrgFormDTO formDTO); + + /** + * @Description 批量查询工作人员注册组织信息 + * @author sun + */ + List getStaffOrgName(List staffIdList); + + + /** + * desc:工作人员所在网格 + * @param staffId + * @return + */ + List getStaffGridList(String staffId); + + /** + * desc:工作人员所在部门 + * @param staffId + * @return + */ + List getStaffDeptList(String staffId); + + /** + * desc:获取工作人员是由哪个类型添加进来的 + * @param staffId + * @return + */ + StaffOrgRelationResultDTO getStaffFromOrgType(String staffId); } 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 eff9f0bdd2..3eb77fe2dd 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 @@ -1,21 +1,26 @@ package com.epmet.dataaggre.service.govorg.impl; import com.alibaba.fastjson.JSON; +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.exception.EpmetErrorCode; import com.epmet.commons.tools.exception.RenException; import com.epmet.commons.tools.security.dto.TokenDto; import com.epmet.dataaggre.constant.DataSourceConstant; -import com.epmet.dataaggre.dao.govorg.CustomerAgencyDao; -import com.epmet.dataaggre.dao.govorg.CustomerGridDao; -import com.epmet.dataaggre.dao.govorg.CustomerStaffAgencyDao; -import com.epmet.dataaggre.dao.govorg.CustomerStaffGridDao; +import com.epmet.dataaggre.dao.govorg.*; +import com.epmet.dataaggre.dto.epmetuser.result.ListStaffResultDTO; import com.epmet.dataaggre.dto.epmetuser.result.StaffRoleListResultDTO; +import com.epmet.dataaggre.dto.govorg.*; +import com.epmet.dataaggre.dto.govorg.form.*; import com.epmet.dataaggre.dto.govorg.CustomerAgencyDTO; +import com.epmet.dataaggre.dto.govorg.CustomerDepartmentDTO; 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.SubOrgFormDTO; import com.epmet.dataaggre.dto.govorg.result.*; import com.epmet.dataaggre.dto.resigroup.result.OrgInfoCommonDTO; import com.epmet.dataaggre.entity.govorg.CustomerAgencyEntity; @@ -48,6 +53,8 @@ public class GovOrgServiceImpl implements GovOrgService { @Autowired private CustomerStaffAgencyDao customerStaffAgencyDao; @Autowired + private CustomerStaffDepartmentDao customerStaffDepartmentDao; + @Autowired private CustomerGridDao customerGridDao; @Autowired private AreaCodeService areaCodeService; @@ -372,4 +379,105 @@ public class GovOrgServiceImpl implements GovOrgService { return subAgencyList; } + /** + * @Param formDTO + * @Description 【通讯录】组织/部门/网格下人员列表 + * @author sun + */ + @Override + public OrgStaffListResultDTO staffList(OrgStaffListFormDTO formDTO) { + OrgStaffListResultDTO resultDTO = new OrgStaffListResultDTO(); + //1.按类型查询组织、部门、网格下所有工作人员Id列表[需要按角色排序 所以这里不能分页] + List staffIds = customerStaffAgencyDao.selectStaffList(formDTO.getOrgId(), formDTO.getOrgType()); + if (org.springframework.util.CollectionUtils.isEmpty(staffIds)) { + return resultDTO; + } + formDTO.setStaffIds(staffIds); + + //2.分页查询工作人员基础信息、角色信息【组织人员单位领导角色人员在前;部门人员部门领导角色人员在前;网格人员网格长角色人员在前】 + List staffList = epmetUserService.getStaffInfoList(formDTO); + + //3.封装数据并返回 + resultDTO.setStaffCount(staffIds.size()); + resultDTO.setStaffList((null == staffList ? new ArrayList<>() : staffList)); + return resultDTO; + } + + /** + * @Param formDTO + * @Description 【通讯录】人员详情v2 + * @author sun + */ + @Override + public StaffDetailV2FormDTO staffDetailV2(StaffDetailV2ResultDTO formDTO) { + //1.查询工作人员基本信息、角色信息 + StaffDetailV2FormDTO result = epmetUserService.selectByStaffId(formDTO.getStaffId()); + if (null == result) { + return new StaffDetailV2FormDTO(); + } + + //2.查询工作人员注册组织关系信息 + List staffIdList = new ArrayList<>(); + staffIdList.add(formDTO.getStaffId()); + List list = customerAgencyDao.selelctStaffOrg(staffIdList); + if (null == list || list.size() < NumConstant.ONE) { + throw new RenException("未查询到工作人员注册组织信息"); + } + + //3.封装数据并返回 + result.setOrgId(list.get(0).getOrgId()); + result.setOrgName(list.get(0).getOrgName()); + result.setOrgType(list.get(0).getOrgType()); + + return result; + } + + /** + * @param formDTO + * @Description 下级组织/部门/网格列表 + * @Param formDTO + * @Return {@link SubOrgResultDTO} + * @Author zhaoqifeng + * @Date 2021/8/19 15:12 + */ + @Override + public SubOrgResultDTO getSubOrg(SubOrgFormDTO formDTO) { + //下级组织列表 + List subAgencyList = customerStaffAgencyDao.selectSubAgency(formDTO.getAgencyId()); + //下级部门列表 + List departmentList = customerStaffDepartmentDao.selectDepartmentList(formDTO.getAgencyId()); + //下级网格列表 + List gridList = customerStaffGridDao.selectGridList(formDTO.getAgencyId()); + SubOrgResultDTO result = new SubOrgResultDTO(); + result.setSubAgencyList(subAgencyList); + result.setDepartmentList(departmentList); + result.setGridList(gridList); + return result; + } + + /** + * @Description 批量查询工作人员注册组织信息 + * @author sun + */ + @Override + public List getStaffOrgName(List staffIdList) { + List resultList = customerAgencyDao.selelctStaffOrg(staffIdList); + return resultList; + } + + @Override + public List getStaffGridList(String staffId) { + return customerStaffAgencyDao.getStaffGridList(staffId); + } + + @Override + public List getStaffDeptList(String staffId) { + return customerStaffDepartmentDao.getStaffDeptList(staffId); + } + + @Override + public StaffOrgRelationResultDTO getStaffFromOrgType(String staffId) { + return customerAgencyDao.getStaffFromOrgType(staffId); + } + } 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-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/epmetmessage/InfoProfileDao.xml b/epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/epmetmessage/InfoProfileDao.xml new file mode 100644 index 0000000000..a899fc3372 --- /dev/null +++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/epmetmessage/InfoProfileDao.xml @@ -0,0 +1,139 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/epmetmessage/InfoReceiversDao.xml b/epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/epmetmessage/InfoReceiversDao.xml new file mode 100644 index 0000000000..e522a780b2 --- /dev/null +++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/epmetmessage/InfoReceiversDao.xml @@ -0,0 +1,136 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/epmetuser/CustomerStaffDao.xml b/epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/epmetuser/CustomerStaffDao.xml index 0e06223aa7..2f1cae9706 100644 --- a/epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/epmetuser/CustomerStaffDao.xml +++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/epmetuser/CustomerStaffDao.xml @@ -31,4 +31,93 @@ + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/epmetuser/GovStaffRoleDao.xml b/epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/epmetuser/GovStaffRoleDao.xml index 70497272c6..d81d193c57 100644 --- a/epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/epmetuser/GovStaffRoleDao.xml +++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/epmetuser/GovStaffRoleDao.xml @@ -3,4 +3,18 @@ - \ No newline at end of file + + + diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/epmetuser/StaffRoleDao.xml b/epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/epmetuser/StaffRoleDao.xml index fe5ecb1ff5..7426446a05 100644 --- a/epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/epmetuser/StaffRoleDao.xml +++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/epmetuser/StaffRoleDao.xml @@ -46,4 +46,27 @@ + + + \ No newline at end of file diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/govorg/CustomerAgencyDao.xml b/epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/govorg/CustomerAgencyDao.xml index 58856e4c7c..ff6fd8e7c3 100644 --- a/epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/govorg/CustomerAgencyDao.xml +++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/govorg/CustomerAgencyDao.xml @@ -62,4 +62,92 @@ created_time DESC - \ No newline at end of file + + + + diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/govorg/CustomerStaffAgencyDao.xml b/epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/govorg/CustomerStaffAgencyDao.xml index 4ed6d3a2d1..29da78941d 100644 --- a/epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/govorg/CustomerStaffAgencyDao.xml +++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/govorg/CustomerStaffAgencyDao.xml @@ -33,8 +33,87 @@ WHERE csa.del_flag = '0' AND ca.del_flag = '0' - AND csa.customer_id = #{customerId} + + AND csa.customer_id = #{customerId} + AND csa.user_id = #{staffId} + - \ No newline at end of file + + + + + diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/govorg/CustomerStaffDepartmentDao.xml b/epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/govorg/CustomerStaffDepartmentDao.xml index b7ae78179e..3d217ce65e 100644 --- a/epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/govorg/CustomerStaffDepartmentDao.xml +++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/govorg/CustomerStaffDepartmentDao.xml @@ -2,4 +2,35 @@ - \ No newline at end of file + + + + diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/govorg/CustomerStaffGridDao.xml b/epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/govorg/CustomerStaffGridDao.xml index 6c5cb0281d..1534bf1fab 100644 --- a/epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/govorg/CustomerStaffGridDao.xml +++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/govorg/CustomerStaffGridDao.xml @@ -35,4 +35,21 @@ AND ca.id = #{agencyId} + \ No newline at end of file diff --git a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/controller/screen/IndexController.java b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/controller/screen/IndexController.java index b0f7fcf03f..31fed42445 100644 --- a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/controller/screen/IndexController.java +++ b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/controller/screen/IndexController.java @@ -1,8 +1,8 @@ package com.epmet.datareport.controller.screen; +import com.epmet.commons.tools.enums.OrgTypeEnum; import com.epmet.commons.tools.utils.Result; import com.epmet.commons.tools.validator.ValidatorUtils; -import com.epmet.datareport.eum.OrgTypeEnum; import com.epmet.datareport.service.evaluationindex.screen.IndexService; import com.epmet.evaluationindex.screen.dto.form.*; import com.epmet.evaluationindex.screen.dto.result.*; diff --git a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/impl/ScreenProjectServiceImpl.java b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/impl/ScreenProjectServiceImpl.java index cbfb044895..c740aa4c5e 100644 --- a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/impl/ScreenProjectServiceImpl.java +++ b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/impl/ScreenProjectServiceImpl.java @@ -2,6 +2,7 @@ package com.epmet.datareport.service.evaluationindex.screen.impl; import com.epmet.commons.dynamic.datasource.annotation.DataSource; import com.epmet.commons.tools.constant.NumConstant; +import com.epmet.commons.tools.redis.common.CustomerStaffRedis; import com.epmet.commons.tools.utils.ConvertUtils; import com.epmet.commons.tools.utils.Result; import com.epmet.constant.DataSourceConstant; @@ -10,7 +11,6 @@ import com.epmet.datareport.dao.evaluationindex.screen.ScreenEventImgDataDao; import com.epmet.datareport.dao.evaluationindex.screen.ScreenProjectCategoryOrgDailyDao; import com.epmet.datareport.dao.evaluationindex.screen.ScreenProjectDataDao; import com.epmet.datareport.service.evaluationindex.screen.ScreenProjectService; -import com.epmet.dto.CustomerAgencyUserRoleDTO; import com.epmet.dto.form.CustomerAgencyUserRoleFormDTO; import com.epmet.dto.form.screen.CategoryAnalysisFormDTO; import com.epmet.dto.form.screen.ColorProjectTotalFormDTO; @@ -117,14 +117,9 @@ public class ScreenProjectServiceImpl implements ScreenProjectService { CustomerAgencyUserRoleFormDTO userRoleFormDTO = new CustomerAgencyUserRoleFormDTO(); userRoleFormDTO.setCustomerId(formDTO.getCustomerId()); userRoleFormDTO.setStaffId(item.getReportUserId()); - - Result userRoles = userOpenFeignClient.getUserRoles(userRoleFormDTO); - if (userRoles != null && userRoles.success() && userRoles.getData() != null){ - Map roles = userRoles.getData().getRoles(); - - if (!CollectionUtils.isEmpty(roles)){ - item.setReportUserRoleSet(roles.keySet()); - } + Map staffRoleMap = CustomerStaffRedis.getStaffRoleMap(formDTO.getCustomerId(), item.getReportUserId()); + if (!CollectionUtils.isEmpty(staffRoleMap)){ + item.setReportUserRoleSet(staffRoleMap.keySet()); } } diff --git a/epmet-module/epmet-message/epmet-message-client/src/main/java/com/epmet/dto/form/AddReceiverGroupFormDTO.java b/epmet-module/epmet-message/epmet-message-client/src/main/java/com/epmet/dto/form/AddReceiverGroupFormDTO.java new file mode 100644 index 0000000000..392b3d382b --- /dev/null +++ b/epmet-module/epmet-message/epmet-message-client/src/main/java/com/epmet/dto/form/AddReceiverGroupFormDTO.java @@ -0,0 +1,52 @@ +package com.epmet.dto.form; + +import com.epmet.commons.tools.validator.group.CustomerClientShowGroup; +import lombok.Data; +import org.hibernate.validator.constraints.Length; + +import javax.validation.constraints.NotBlank; +import java.io.Serializable; +import java.util.Set; + +/** + * @Description 发送消息-新增群组 + * @Author yinzuomei + * @Date 2021/8/20 9:39 上午 + */ +@Data +public class AddReceiverGroupFormDTO implements Serializable { + private static final long serialVersionUID = 6221853016790893895L; + public interface AddUserInternalGroup { + } + public interface AddUserShowGroup extends CustomerClientShowGroup { + } + + @NotBlank(message = "名称不能为空",groups = AddUserShowGroup.class) + @Length(min = 1,max = 20,groups = AddUserShowGroup.class,message = "名称最多输入20个字") + private String name; + + + /** + * 单独选择的人的userId集合 + */ + private Set staffIdList; + /** + * 按架构选择的,组织或者网格或者部门的集合 + */ + private Set orgList; + + + //以下参数从token中获取 + /** + * 当前用户id + */ + @NotBlank(message = "userId不能为空", groups = AddUserInternalGroup.class) + private String userId; + + /** + * 当前客户id + */ + @NotBlank(message = "customerId不能为空", groups = AddUserInternalGroup.class) + private String customerId; +} + diff --git a/epmet-module/epmet-message/epmet-message-client/src/main/java/com/epmet/dto/form/OrgCommonDTO.java b/epmet-module/epmet-message/epmet-message-client/src/main/java/com/epmet/dto/form/OrgCommonDTO.java new file mode 100644 index 0000000000..612e02e8f4 --- /dev/null +++ b/epmet-module/epmet-message/epmet-message-client/src/main/java/com/epmet/dto/form/OrgCommonDTO.java @@ -0,0 +1,17 @@ +package com.epmet.dto.form; + +import lombok.Data; + +import java.io.Serializable; + +/** + * @Description 从架构通用dto + * @Author yinzuomei + * @Date 2021/8/19 10:00 上午 + */ +@Data +public class OrgCommonDTO implements Serializable { + private String orgId; + private String orgType; +} + diff --git a/epmet-module/epmet-message/epmet-message-client/src/main/java/com/epmet/dto/form/ReadInfoFormDTO.java b/epmet-module/epmet-message/epmet-message-client/src/main/java/com/epmet/dto/form/ReadInfoFormDTO.java new file mode 100644 index 0000000000..955bb0e86a --- /dev/null +++ b/epmet-module/epmet-message/epmet-message-client/src/main/java/com/epmet/dto/form/ReadInfoFormDTO.java @@ -0,0 +1,36 @@ +package com.epmet.dto.form; + +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import java.io.Serializable; + +/** + * @Description 我收到的,列表有红点的,点击消息,调用此接口 + * @Author yinzuomei + * @Date 2021/8/19 4:58 下午 + */ +@Data +public class ReadInfoFormDTO implements Serializable { + public interface AddUserInternalGroup { + } + + @NotBlank(message = "infoId不能为空",groups = AddUserInternalGroup.class) + private String infoId; + + + + //以下参数从token中获取 + /** + * 当前用户id + */ + @NotBlank(message = "userId不能为空",groups = AddUserInternalGroup.class) + private String userId; + + /** + * 当前客户id + */ + @NotBlank(message = "customerId不能为空",groups = AddUserInternalGroup.class) + private String customerId; +} + diff --git a/epmet-module/epmet-message/epmet-message-client/src/main/java/com/epmet/dto/form/ReadReplyFormDTO.java b/epmet-module/epmet-message/epmet-message-client/src/main/java/com/epmet/dto/form/ReadReplyFormDTO.java new file mode 100644 index 0000000000..d374fb5e56 --- /dev/null +++ b/epmet-module/epmet-message/epmet-message-client/src/main/java/com/epmet/dto/form/ReadReplyFormDTO.java @@ -0,0 +1,37 @@ +package com.epmet.dto.form; + +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import java.io.Serializable; + +/** + * @Description 我发出的,发布人点击详情后,阅读回复,将未读回复数置为0 + * @Author yinzuomei + * @Date 2021/8/19 5:49 下午 + */ +@Data +public class ReadReplyFormDTO implements Serializable { + private static final long serialVersionUID = 1315143292245373474L; + + public interface AddUserInternalGroup { + } + + @NotBlank(message = "infoId不能为空", groups = AddUserInternalGroup.class) + private String infoId; + + + //以下参数从token中获取 + /** + * 当前用户id + */ + @NotBlank(message = "userId不能为空", groups = AddUserInternalGroup.class) + private String userId; + + /** + * 当前客户id + */ + @NotBlank(message = "customerId不能为空", groups = AddUserInternalGroup.class) + private String customerId; +} + diff --git a/epmet-module/epmet-message/epmet-message-client/src/main/java/com/epmet/dto/form/ReplyInfoFormDTO.java b/epmet-module/epmet-message/epmet-message-client/src/main/java/com/epmet/dto/form/ReplyInfoFormDTO.java new file mode 100644 index 0000000000..33d4c2ca7d --- /dev/null +++ b/epmet-module/epmet-message/epmet-message-client/src/main/java/com/epmet/dto/form/ReplyInfoFormDTO.java @@ -0,0 +1,43 @@ +package com.epmet.dto.form; + +import com.epmet.commons.tools.dto.form.FileCommonDTO; +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import java.io.Serializable; +import java.util.List; + +/** + * @Description 回复消息 + * @Author yinzuomei + * @Date 2021/8/19 5:18 下午 + */ + +@Data +public class ReplyInfoFormDTO implements Serializable { + public interface AddUserInternalGroup { + } + + @NotBlank(message = "infoId不能为空",groups = ReadInfoFormDTO.AddUserInternalGroup.class) + private String infoId; + + private String content; + /** + * 附件列表 + */ + private List attachmentList; + + //以下参数从token中获取 + /** + * 当前用户id + */ + @NotBlank(message = "userId不能为空",groups = ReadInfoFormDTO.AddUserInternalGroup.class) + private String userId; + + /** + * 当前客户id + */ + @NotBlank(message = "customerId不能为空",groups = ReadInfoFormDTO.AddUserInternalGroup.class) + private String customerId; +} + diff --git a/epmet-module/epmet-message/epmet-message-client/src/main/java/com/epmet/dto/form/SendInfoFormDTO.java b/epmet-module/epmet-message/epmet-message-client/src/main/java/com/epmet/dto/form/SendInfoFormDTO.java new file mode 100644 index 0000000000..6090d7f4e6 --- /dev/null +++ b/epmet-module/epmet-message/epmet-message-client/src/main/java/com/epmet/dto/form/SendInfoFormDTO.java @@ -0,0 +1,69 @@ +package com.epmet.dto.form; + +import com.epmet.commons.tools.dto.form.FileCommonDTO; +import com.epmet.commons.tools.validator.group.CustomerClientShowGroup; +import lombok.Data; +import org.hibernate.validator.constraints.Length; + +import javax.validation.constraints.NotBlank; +import java.io.Serializable; +import java.util.List; +import java.util.Set; + +/** + * @Description 发送消息入参DTO + * @Author yinzuomei + * @Date 2021/8/19 9:52 上午 + */ +@Data +public class SendInfoFormDTO implements Serializable { + private static final long serialVersionUID = -3668230349576949684L; + + public interface AddUserInternalGroup { + } + + public interface AddUserShowGroup extends CustomerClientShowGroup { + } + + /** + * 消息内容,不能超过100,不可为空 + */ + @NotBlank(message = "消息内容不能为空",groups = AddUserShowGroup.class) + @Length(min = 1, max = 1000, message = "消息内容最多输入1000字", groups = AddUserShowGroup.class) + private String content; + /** + * 单独选择的人的userId集合 + */ + private Set staffIdList; + /** + * 按架构选择的,组织或者网格或者部门的集合 + */ + private Set orgList; + /** + * 按职责选择时,角色的id集合 + */ + private Set roleIdList; + /** + * 按群组选择时,群组的id集合 + */ + private Set groupIdList; + /** + * 附件列表 + */ + private List attachmentList; + + + //以下参数从token中获取 + /** + * 当前用户id + */ + @NotBlank(message = "userId不能为空",groups =AddUserInternalGroup.class) + private String userId; + + /** + * 当前客户id + */ + @NotBlank(message = "customerId不能为空",groups = AddUserInternalGroup.class) + private String customerId; +} + diff --git a/epmet-module/epmet-message/epmet-message-client/src/main/java/com/epmet/dto/result/AddReceiverGroupResultDTO.java b/epmet-module/epmet-message/epmet-message-client/src/main/java/com/epmet/dto/result/AddReceiverGroupResultDTO.java new file mode 100644 index 0000000000..59f1519d2f --- /dev/null +++ b/epmet-module/epmet-message/epmet-message-client/src/main/java/com/epmet/dto/result/AddReceiverGroupResultDTO.java @@ -0,0 +1,17 @@ +package com.epmet.dto.result; + +import lombok.Data; + +import java.io.Serializable; + +/** + * @Description 添加小组返参 + * @Author yinzuomei + * @Date 2021/8/20 9:56 上午 + */ +@Data +public class AddReceiverGroupResultDTO implements Serializable { + private static final long serialVersionUID = 4729777797252376046L; + private String receiverGroupId; +} + diff --git a/epmet-module/epmet-message/epmet-message-client/src/main/java/com/epmet/dto/result/ReplyInfoResultDTO.java b/epmet-module/epmet-message/epmet-message-client/src/main/java/com/epmet/dto/result/ReplyInfoResultDTO.java new file mode 100644 index 0000000000..90aed81589 --- /dev/null +++ b/epmet-module/epmet-message/epmet-message-client/src/main/java/com/epmet/dto/result/ReplyInfoResultDTO.java @@ -0,0 +1,17 @@ +package com.epmet.dto.result; + +import lombok.Data; + +import java.io.Serializable; + +/** + * @Description 回复消息返参 + * @Author yinzuomei + * @Date 2021/8/20 9:51 上午 + */ +@Data +public class ReplyInfoResultDTO implements Serializable { + private static final long serialVersionUID = -634463925415755405L; + private String replyId; +} + diff --git a/epmet-module/epmet-message/epmet-message-client/src/main/java/com/epmet/dto/result/SendInfoResultDTO.java b/epmet-module/epmet-message/epmet-message-client/src/main/java/com/epmet/dto/result/SendInfoResultDTO.java new file mode 100644 index 0000000000..70e0c0c371 --- /dev/null +++ b/epmet-module/epmet-message/epmet-message-client/src/main/java/com/epmet/dto/result/SendInfoResultDTO.java @@ -0,0 +1,17 @@ +package com.epmet.dto.result; + +import lombok.Data; + +import java.io.Serializable; + +/** + * @Description 发送消息返参DTO + * @Author yinzuomei + * @Date 2021/8/19 10:20 上午 + */ +@Data +public class SendInfoResultDTO implements Serializable { + private static final long serialVersionUID = 3339252317982375852L; + private String infoId; +} + diff --git a/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/constant/UserMessageConstans.java b/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/constant/UserMessageConstans.java index 455169adf9..7c20b668a6 100644 --- a/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/constant/UserMessageConstans.java +++ b/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/constant/UserMessageConstans.java @@ -18,4 +18,8 @@ public interface UserMessageConstans { */ String APP = "app"; + String INFO_TITLE="您有一条新消息"; + + String MESSAGE_TYPE_INFO="info"; + String INFO_CONTENT_TEMP="您有一条【%s】的新消息,请您查看"; } diff --git a/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/controller/InfoController.java b/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/controller/InfoController.java new file mode 100644 index 0000000000..859db0c3f6 --- /dev/null +++ b/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/controller/InfoController.java @@ -0,0 +1,153 @@ +/** + * 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.controller; + +import com.epmet.commons.tools.annotation.LoginUser; +import com.epmet.commons.tools.security.dto.TokenDto; +import com.epmet.commons.tools.utils.Result; +import com.epmet.commons.tools.validator.ValidatorUtils; +import com.epmet.dto.form.*; +import com.epmet.dto.result.AddReceiverGroupResultDTO; +import com.epmet.dto.result.ReplyInfoResultDTO; +import com.epmet.dto.result.SendInfoResultDTO; +import com.epmet.service.InfoService; +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; + + +/** + * 消息主表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2021-08-18 + */ +@RestController +@RequestMapping("info") +public class InfoController { + + @Autowired + private InfoService infoService; + + + /** + * 发送消息 + * + * @param tokenDto + * @param formDTO + * @return com.epmet.commons.tools.utils.Result + * @author yinzuomei + * @date 2021/8/19 10:25 上午 + */ + @PostMapping("send") + public Result sendInfo(@LoginUser TokenDto tokenDto, @RequestBody SendInfoFormDTO formDTO) { + formDTO.setCustomerId(tokenDto.getCustomerId()); + formDTO.setUserId(tokenDto.getUserId()); + ValidatorUtils.validateEntity(formDTO, SendInfoFormDTO.AddUserShowGroup.class, SendInfoFormDTO.AddUserInternalGroup.class); + return new Result().ok(infoService.sendInfo(formDTO)); + } + + /** + * 【发送消息】我收到的-阅读消息 + * + * @param tokenDto + * @param formDTO + * @return com.epmet.commons.tools.utils.Result + * @author yinzuomei + * @date 2021/8/19 5:03 下午 + */ + @PostMapping("read-info") + public Result readInfo(@LoginUser TokenDto tokenDto,@RequestBody ReadInfoFormDTO formDTO){ + formDTO.setCustomerId(tokenDto.getCustomerId()); + formDTO.setUserId(tokenDto.getUserId()); + ValidatorUtils.validateEntity(formDTO,ReadInfoFormDTO.AddUserInternalGroup.class); + infoService.readInfo(formDTO); + return new Result(); + } + + /** + * 回复消息(目前需求是发布人不可以回复) + * + * @param tokenDto + * @param formDTO + * @return com.epmet.commons.tools.utils.Result + * @author yinzuomei + * @date 2021/8/19 5:29 下午 + */ + @PostMapping("reply-info") + public Result replyInfo(@LoginUser TokenDto tokenDto, @RequestBody ReplyInfoFormDTO formDTO){ + formDTO.setCustomerId(tokenDto.getCustomerId()); + formDTO.setUserId(tokenDto.getUserId()); + ValidatorUtils.validateEntity(formDTO,ReplyInfoFormDTO.AddUserInternalGroup.class); + return new Result().ok(infoService.replyInfo(formDTO)); + } + + /** + * 我发出的,发布人点击详情后,阅读回复,将未读回复数置为0 + * + * @param tokenDto + * @param formDTO + * @return com.epmet.commons.tools.utils.Result + * @author yinzuomei + * @date 2021/8/19 5:51 下午 + */ + @PostMapping("read-reply") + public Result readInfoReply(@LoginUser TokenDto tokenDto,@RequestBody ReadReplyFormDTO formDTO){ + formDTO.setCustomerId(tokenDto.getCustomerId()); + formDTO.setUserId(tokenDto.getUserId()); + ValidatorUtils.validateEntity(formDTO,ReadReplyFormDTO.AddUserInternalGroup.class); + infoService.readInfoReply(formDTO); + return new Result(); + } + + + /** + * 添加群组 + * + * @param tokenDto + * @param formDTO + * @return com.epmet.commons.tools.utils.Result + * @author yinzuomei + * @date 2021/8/20 9:58 上午 + */ + @PostMapping("add-receivergroup") + public Result addReceiverGroup(@LoginUser TokenDto tokenDto, @RequestBody AddReceiverGroupFormDTO formDTO){ + formDTO.setCustomerId(tokenDto.getCustomerId()); + formDTO.setUserId(tokenDto.getUserId()); + ValidatorUtils.validateEntity(formDTO,AddReceiverGroupFormDTO.AddUserShowGroup.class,AddReceiverGroupFormDTO.AddUserInternalGroup.class); + return new Result().ok(infoService.addReceiverGroup(formDTO)); + } + + + + + + + + + + + + + + + + +} \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/redis/GovStaffRoleRedis.java b/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/dao/InfoAttDao.java similarity index 62% rename from epmet-user/epmet-user-server/src/main/java/com/epmet/redis/GovStaffRoleRedis.java rename to epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/dao/InfoAttDao.java index 2ad77b306a..45005bf028 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/redis/GovStaffRoleRedis.java +++ b/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/dao/InfoAttDao.java @@ -15,33 +15,19 @@ * along with this program. If not, see . */ -package com.epmet.redis; +package com.epmet.dao; -import com.epmet.commons.tools.redis.RedisUtils; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Component; +import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.entity.InfoAttEntity; +import org.apache.ibatis.annotations.Mapper; /** - * 政府端角色表 + * 消息的附件表 * * @author generator generator@elink-cn.com - * @since v1.0.0 2020-04-22 + * @since v1.0.0 2021-08-18 */ -@Component -public class GovStaffRoleRedis { - @Autowired - private RedisUtils redisUtils; - - public void delete(Object[] ids) { - - } - - public void set(){ - - } - - public String get(String id){ - return null; - } - +@Mapper +public interface InfoAttDao extends BaseDao { + } \ No newline at end of file diff --git a/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/dao/InfoDao.java b/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/dao/InfoDao.java new file mode 100644 index 0000000000..e6eaacaef6 --- /dev/null +++ b/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/dao/InfoDao.java @@ -0,0 +1,33 @@ +/** + * 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.dao; + +import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.entity.InfoEntity; +import org.apache.ibatis.annotations.Mapper; + +/** + * 消息主表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2021-08-18 + */ +@Mapper +public interface InfoDao extends BaseDao { + +} \ No newline at end of file diff --git a/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/dao/InfoGroupReceiversDao.java b/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/dao/InfoGroupReceiversDao.java new file mode 100644 index 0000000000..5ddcf73e9c --- /dev/null +++ b/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/dao/InfoGroupReceiversDao.java @@ -0,0 +1,44 @@ +/** + * 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.dao; + +import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.entity.InfoGroupReceiversEntity; +import org.apache.ibatis.annotations.Mapper; + +import java.util.Set; + +/** + * 消息-群组成员关系表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2021-08-18 + */ +@Mapper +public interface InfoGroupReceiversDao extends BaseDao { + + /** + * 群组里面的工作人员,去重 + * + * @param groupIdList + * @return java.util.Set + * @author yinzuomei + * @date 2021/8/19 10:51 上午 + */ + Set selectStaffIds(Set groupIdList); +} \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/redis/RoleRedis.java b/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/dao/InfoProfileDao.java similarity index 63% rename from epmet-user/epmet-user-server/src/main/java/com/epmet/redis/RoleRedis.java rename to epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/dao/InfoProfileDao.java index 3af1f8f2ce..4f7c61ea61 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/redis/RoleRedis.java +++ b/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/dao/InfoProfileDao.java @@ -15,33 +15,22 @@ * along with this program. If not, see . */ -package com.epmet.redis; +package com.epmet.dao; -import com.epmet.commons.tools.redis.RedisUtils; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Component; +import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.entity.InfoProfileEntity; +import org.apache.ibatis.annotations.Mapper; /** - * 角色表 + * 消息概要表 * * @author generator generator@elink-cn.com - * @since v1.0.0 2020-03-30 + * @since v1.0.0 2021-08-18 */ -@Component -public class RoleRedis { - @Autowired - private RedisUtils redisUtils; +@Mapper +public interface InfoProfileDao extends BaseDao { - public void delete(Object[] ids) { - - } - - public void set(){ - - } - - public String get(String id){ - return null; - } + int addReadTotal(String infoId); + InfoProfileEntity selectByInfoId(String infoId); } \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/redis/UserRoleRedis.java b/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/dao/InfoReceiverGroupDao.java similarity index 62% rename from epmet-user/epmet-user-server/src/main/java/com/epmet/redis/UserRoleRedis.java rename to epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/dao/InfoReceiverGroupDao.java index ff678b345d..3b60dbc623 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/redis/UserRoleRedis.java +++ b/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/dao/InfoReceiverGroupDao.java @@ -15,33 +15,21 @@ * along with this program. If not, see . */ -package com.epmet.redis; +package com.epmet.dao; -import com.epmet.commons.tools.redis.RedisUtils; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Component; +import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.entity.InfoReceiverGroupEntity; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; /** - * 用户角色关系表 + * 消息-群组表 * * @author generator generator@elink-cn.com - * @since v1.0.0 2020-03-30 + * @since v1.0.0 2021-08-18 */ -@Component -public class UserRoleRedis { - @Autowired - private RedisUtils redisUtils; - - public void delete(Object[] ids) { - - } - - public void set(){ - - } - - public String get(String id){ - return null; - } +@Mapper +public interface InfoReceiverGroupDao extends BaseDao { + int selectCountName(@Param("name") String name, @Param("customerId")String customerId, @Param("userId")String userId); } \ No newline at end of file diff --git a/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/dao/InfoReceiversDao.java b/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/dao/InfoReceiversDao.java new file mode 100644 index 0000000000..05371ca5a1 --- /dev/null +++ b/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/dao/InfoReceiversDao.java @@ -0,0 +1,44 @@ +/** + * 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.dao; + +import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.entity.InfoReceiversEntity; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +/** + * 消息接收人记录表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2021-08-18 + */ +@Mapper +public interface InfoReceiversDao extends BaseDao { + + /** + * 消息的某一个接收人记录 + * + * @param infoId + * @param userId + * @return com.epmet.entity.InfoReceiversEntity + * @author yinzuomei + * @date 2021/8/19 5:11 下午 + */ + InfoReceiversEntity selectInfoReceiver(@Param("infoId")String infoId, @Param("userId")String userId); +} \ No newline at end of file diff --git a/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/dao/InfoReplyContentDao.java b/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/dao/InfoReplyContentDao.java new file mode 100644 index 0000000000..03d0fc4399 --- /dev/null +++ b/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/dao/InfoReplyContentDao.java @@ -0,0 +1,33 @@ +/** + * 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.dao; + +import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.entity.InfoReplyContentEntity; +import org.apache.ibatis.annotations.Mapper; + +/** + * 回复详情表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2021-08-18 + */ +@Mapper +public interface InfoReplyContentDao extends BaseDao { + +} \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/redis/OperUserRedis.java b/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/dao/InfoReplyDao.java similarity index 62% rename from epmet-user/epmet-user-server/src/main/java/com/epmet/redis/OperUserRedis.java rename to epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/dao/InfoReplyDao.java index ec0df3ca96..201e36a54d 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/redis/OperUserRedis.java +++ b/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/dao/InfoReplyDao.java @@ -15,33 +15,19 @@ * along with this program. If not, see . */ -package com.epmet.redis; +package com.epmet.dao; -import com.epmet.commons.tools.redis.RedisUtils; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Component; +import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.entity.InfoReplyEntity; +import org.apache.ibatis.annotations.Mapper; /** - * 运营人员表 + * 消息回复表 * * @author generator generator@elink-cn.com - * @since v1.0.0 2020-03-18 + * @since v1.0.0 2021-08-18 */ -@Component -public class OperUserRedis { - @Autowired - private RedisUtils redisUtils; - - public void delete(Object[] ids) { - - } - - public void set(){ - - } - - public String get(String id){ - return null; - } - +@Mapper +public interface InfoReplyDao extends BaseDao { + } \ No newline at end of file diff --git a/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/entity/InfoAttEntity.java b/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/entity/InfoAttEntity.java new file mode 100644 index 0000000000..01e385aa50 --- /dev/null +++ b/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/entity/InfoAttEntity.java @@ -0,0 +1,82 @@ +/** + * 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.entity; + +import com.baomidou.mybatisplus.annotation.TableName; +import com.epmet.commons.mybatis.entity.BaseEpmetEntity; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 消息的附件表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2021-08-18 + */ +@Data +@EqualsAndHashCode(callSuper=false) +@TableName("info_att") +public class InfoAttEntity extends BaseEpmetEntity { + + private static final long serialVersionUID = 1L; + + /** + * 客户ID + */ + private String customerId; + + /** + * 消息主表的id + */ + private String infoId; + + /** + * 附件名 + */ + private String attachmentName; + + /** + * 文件格式(JPG、PNG、PDF、JPEG、BMP、MP4、WMA、M4A、MP3、DOC、DOCX、XLS) + */ + private String attachmentFormat; + + /** + * 附件类型((图片 - image、 视频 - video、 语音 - voice、 文档 - doc)) + */ + private String attachmentType; + + /** + * 附件地址 + */ + private String attachmentUrl; + + /** + * 排序字段 + */ + private Integer sort; + + /** + * 文件大小 + */ + private Integer attachmentSize; + /** + * 语音或视频时长,秒 + */ + private Integer duration; + +} diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/redis/GridLatestRedis.java b/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/entity/InfoEntity.java similarity index 55% rename from epmet-user/epmet-user-server/src/main/java/com/epmet/redis/GridLatestRedis.java rename to epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/entity/InfoEntity.java index 41bf0cfb49..d3cd0ca82f 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/redis/GridLatestRedis.java +++ b/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/entity/InfoEntity.java @@ -15,33 +15,42 @@ * along with this program. If not, see . */ -package com.epmet.redis; +package com.epmet.entity; -import com.epmet.commons.tools.redis.RedisUtils; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Component; +import com.baomidou.mybatisplus.annotation.TableName; + +import com.epmet.commons.mybatis.entity.BaseEpmetEntity; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.util.Date; /** - * 最近访问网格表 记录用户访问网格的最近一次记录,对同一网格只记录一条记录,同一网格每次只更新最近一次访问的时间 + * 消息主表 * * @author generator generator@elink-cn.com - * @since v1.0.0 2020-03-16 + * @since v1.0.0 2021-08-18 */ -@Component -public class GridLatestRedis { - @Autowired - private RedisUtils redisUtils; - - public void delete(Object[] ids) { +@Data +@EqualsAndHashCode(callSuper=false) +@TableName("info") +public class InfoEntity extends BaseEpmetEntity { - } + private static final long serialVersionUID = 1L; - public void set(){ + /** + * 客户id + */ + private String customerId; - } + /** + * 发布人id + */ + private String publishStaffId; - public String get(String id){ - return null; - } + /** + * 内容,这里存储全部的内容。 + */ + private String content; -} \ No newline at end of file +} diff --git a/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/entity/InfoGroupReceiversEntity.java b/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/entity/InfoGroupReceiversEntity.java new file mode 100644 index 0000000000..9de1c52bc0 --- /dev/null +++ b/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/entity/InfoGroupReceiversEntity.java @@ -0,0 +1,56 @@ +/** + * 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.entity; + +import com.baomidou.mybatisplus.annotation.TableName; + +import com.epmet.commons.mybatis.entity.BaseEpmetEntity; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.util.Date; + +/** + * 消息-群组成员关系表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2021-08-18 + */ +@Data +@EqualsAndHashCode(callSuper=false) +@TableName("info_group_receivers") +public class InfoGroupReceiversEntity extends BaseEpmetEntity { + + private static final long serialVersionUID = 1L; + + /** + * 客户ID + */ + private String customerId; + + /** + * 群组id + */ + private String infoReceiverGroupId; + + /** + * 工作人员id + */ + private String staffId; + +} diff --git a/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/entity/InfoProfileEntity.java b/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/entity/InfoProfileEntity.java new file mode 100644 index 0000000000..74f662b523 --- /dev/null +++ b/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/entity/InfoProfileEntity.java @@ -0,0 +1,78 @@ +/** + * 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.entity; + +import com.baomidou.mybatisplus.annotation.TableName; +import com.epmet.commons.mybatis.entity.BaseEpmetEntity; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 消息概要表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2021-08-18 + */ +@Data +@EqualsAndHashCode(callSuper=false) +@TableName("info_profile") +public class InfoProfileEntity extends BaseEpmetEntity { + + private static final long serialVersionUID = 1L; + + /** + * 客户id + */ + private String customerId; + + /** + * 消息主表的id + */ + private String infoId; + + /** + * 发布人id + */ + private String publishStaffId; + + /** + * 内容概要,取前100字 + */ + private String content; + + /** + * 附件ID,第一个用于展示 + */ + private String firstAttId; + + /** + * 应读人数 + */ + private Integer totalReceiver; + + /** + * 已读人数,插入是为0 + */ + private Integer readTotal; + + /** + * 未读的回复数量:发布人每次查看详情后,置为0;接收人回复一条+1 + */ + private Integer unReadReplyNum; + +} diff --git a/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/entity/InfoReceiverGroupEntity.java b/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/entity/InfoReceiverGroupEntity.java new file mode 100644 index 0000000000..d7efe67896 --- /dev/null +++ b/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/entity/InfoReceiverGroupEntity.java @@ -0,0 +1,56 @@ +/** + * 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.entity; + +import com.baomidou.mybatisplus.annotation.TableName; + +import com.epmet.commons.mybatis.entity.BaseEpmetEntity; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.util.Date; + +/** + * 消息-群组表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2021-08-18 + */ +@Data +@EqualsAndHashCode(callSuper=false) +@TableName("info_receiver_group") +public class InfoReceiverGroupEntity extends BaseEpmetEntity { + + private static final long serialVersionUID = 1L; + + /** + * 客户ID + */ + private String customerId; + + /** + * 群组名称,我创建的范围内唯一 + */ + private String name; + + /** + * 创建人id + */ + private String createStaffId; + +} diff --git a/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/entity/InfoReceiversEntity.java b/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/entity/InfoReceiversEntity.java new file mode 100644 index 0000000000..ccf55c5dfb --- /dev/null +++ b/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/entity/InfoReceiversEntity.java @@ -0,0 +1,58 @@ +/** + * 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.entity; + +import com.baomidou.mybatisplus.annotation.TableName; +import com.epmet.commons.mybatis.entity.BaseEpmetEntity; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 消息接收人记录表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2021-08-18 + */ +@Data +@EqualsAndHashCode(callSuper=false) +@TableName("info_receivers") +public class InfoReceiversEntity extends BaseEpmetEntity { + + private static final long serialVersionUID = 1L; + + /** + * 客户ID + */ + private String customerId; + + /** + * 消息主表.id + */ + private String infoId; + + /** + * 工作人员id + */ + private String staffId; + + /** + * 已读:1;未读:0 + */ + private Boolean readFlag; + +} diff --git a/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/entity/InfoReplyContentEntity.java b/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/entity/InfoReplyContentEntity.java new file mode 100644 index 0000000000..04e9160c71 --- /dev/null +++ b/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/entity/InfoReplyContentEntity.java @@ -0,0 +1,83 @@ +/** + * 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.entity; + +import com.baomidou.mybatisplus.annotation.TableName; +import com.epmet.commons.mybatis.entity.BaseEpmetEntity; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 回复详情表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2021-08-18 + */ +@Data +@EqualsAndHashCode(callSuper=false) +@TableName("info_reply_content") +public class InfoReplyContentEntity extends BaseEpmetEntity { + + private static final long serialVersionUID = 1L; + + /** + * 客户ID + */ + private String customerId; + + /** + * INFO_REPLY的id + */ + private String infoReplyId; + + /** + * 附件名 + */ + private String attachmentName; + + /** + * 文件格式(JPG、PNG、PDF、JPEG、BMP、MP4、WMA、M4A、MP3、DOC、DOCX、XLS) + */ + private String attachmentFormat; + + /** + * 回复的类型(文本-text、图片 - image、 视频 - video、 语音 - voice、 文档 - doc)) + */ + private String replyType; + + /** + * 如果是文本对应的是文字,如果是其他类型,对应的是url + */ + private String content; + + /** + * 排序字段 + */ + private Integer sort; + + + /** + * 文件大小 + */ + private Integer attachmentSize; + /** + * 语音或视频时长,秒 + */ + private Integer duration; + +} diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/redis/GridVisitedRedis.java b/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/entity/InfoReplyEntity.java similarity index 55% rename from epmet-user/epmet-user-server/src/main/java/com/epmet/redis/GridVisitedRedis.java rename to epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/entity/InfoReplyEntity.java index 9316d6f3c7..9e67742cae 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/redis/GridVisitedRedis.java +++ b/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/entity/InfoReplyEntity.java @@ -15,33 +15,42 @@ * along with this program. If not, see . */ -package com.epmet.redis; +package com.epmet.entity; -import com.epmet.commons.tools.redis.RedisUtils; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Component; +import com.baomidou.mybatisplus.annotation.TableName; + +import com.epmet.commons.mybatis.entity.BaseEpmetEntity; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.util.Date; /** - * 网格访问记录表 用户对网格访问的一个记录,只有在访问网格首页时才存储数据,一个用户一天对一个网格的访问只有一条记录 + * 消息回复表 * * @author generator generator@elink-cn.com - * @since v1.0.0 2020-03-16 + * @since v1.0.0 2021-08-18 */ -@Component -public class GridVisitedRedis { - @Autowired - private RedisUtils redisUtils; - - public void delete(Object[] ids) { +@Data +@EqualsAndHashCode(callSuper=false) +@TableName("info_reply") +public class InfoReplyEntity extends BaseEpmetEntity { - } + private static final long serialVersionUID = 1L; - public void set(){ + /** + * 客户ID + */ + private String customerId; - } + /** + * 消息主表的id + */ + private String infoId; - public String get(String id){ - return null; - } + /** + * 回复人用户Id + */ + private String fromUserId; -} \ No newline at end of file +} diff --git a/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/entity/UserMessageEntity.java b/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/entity/UserMessageEntity.java index dcdd460cde..5d908e98c5 100644 --- a/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/entity/UserMessageEntity.java +++ b/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/entity/UserMessageEntity.java @@ -75,4 +75,12 @@ public class UserMessageEntity extends BaseEpmetEntity { */ private String referer; + /** + * 消息分类:info-上传下达消息 + */ + private String messageType; + /** + * 消息对应的业务id,比如message_type=info时,此列存储的是消息id,可跳转到消息详情 + */ + private String targetId; } diff --git a/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/service/InfoService.java b/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/service/InfoService.java new file mode 100644 index 0000000000..601cbb4ab0 --- /dev/null +++ b/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/service/InfoService.java @@ -0,0 +1,84 @@ +/** + * 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.service; + +import com.epmet.commons.mybatis.service.BaseService; +import com.epmet.dto.form.*; +import com.epmet.dto.result.AddReceiverGroupResultDTO; +import com.epmet.dto.result.ReplyInfoResultDTO; +import com.epmet.dto.result.SendInfoResultDTO; +import com.epmet.entity.InfoEntity; + +/** + * 消息主表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2021-08-18 + */ +public interface InfoService extends BaseService { + + /** + * 发送消息 + * + * @param formDTO + * @return com.epmet.dto.result.SendInfoResultDTO + * @author yinzuomei + * @date 2021/8/19 10:27 上午 + */ + SendInfoResultDTO sendInfo(SendInfoFormDTO formDTO); + + /** + * 【发送消息】我收到的-阅读消息 + * + * @param formDTO + * @return void + * @author yinzuomei + * @date 2021/8/19 5:03 下午 + */ + void readInfo(ReadInfoFormDTO formDTO); + + /** + * 回复消息(目前需求是发布人不可以回复) + * + * @param formDTO + * @return void + * @author yinzuomei + * @date 2021/8/19 5:30 下午 + */ + ReplyInfoResultDTO replyInfo(ReplyInfoFormDTO formDTO); + + /** + * 我发出的,发布人点击详情后,阅读回复,将未读回复数置为0 + * + * @param formDTO + * @return void + * @author yinzuomei + * @date 2021/8/19 5:51 下午 + */ + void readInfoReply(ReadReplyFormDTO formDTO); + + /** + * 添加群组 + * + * @param formDTO + * @return com.epmet.dto.result.AddReceiverGroupResultDTO + * @author yinzuomei + * @date 2021/8/20 9:58 上午 + */ + AddReceiverGroupResultDTO addReceiverGroup(AddReceiverGroupFormDTO formDTO); +} \ No newline at end of file diff --git a/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/service/impl/InfoServiceImpl.java b/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/service/impl/InfoServiceImpl.java new file mode 100644 index 0000000000..8139440f91 --- /dev/null +++ b/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/service/impl/InfoServiceImpl.java @@ -0,0 +1,431 @@ +/** + * 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.service.impl; + +import com.alibaba.fastjson.JSON; +import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; +import com.epmet.commons.tools.constant.AppClientConstant; +import com.epmet.commons.tools.constant.NumConstant; +import com.epmet.commons.tools.constant.StrConstant; +import com.epmet.commons.tools.dto.form.FileCommonDTO; +import com.epmet.commons.tools.exception.EpmetErrorCode; +import com.epmet.commons.tools.exception.RenException; +import com.epmet.commons.tools.utils.Result; +import com.epmet.constant.UserMessageConstans; +import com.epmet.dao.*; +import com.epmet.dto.form.*; +import com.epmet.dto.result.AddReceiverGroupResultDTO; +import com.epmet.dto.result.ReplyInfoResultDTO; +import com.epmet.dto.result.SendInfoResultDTO; +import com.epmet.entity.*; +import com.epmet.feign.EpmetUserOpenFeignClient; +import com.epmet.feign.GovOrgOpenFeignClient; +import com.epmet.service.InfoService; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.collections4.CollectionUtils; +import org.apache.commons.lang3.StringUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.util.Collections; +import java.util.LinkedHashSet; +import java.util.Set; + +/** + * 消息主表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2021-08-18 + */ +@Slf4j +@Service +public class InfoServiceImpl extends BaseServiceImpl implements InfoService { + @Autowired + private InfoAttDao infoAttDao; + @Autowired + private InfoReceiversDao infoReceiversDao; + @Autowired + private InfoGroupReceiversDao infoGroupReceiversDao; + @Autowired + private InfoReceiverGroupDao infoReceiverGroupDao; + @Autowired + private InfoProfileDao infoProfileDao; + @Autowired + private InfoReplyDao infoReplyDao; + @Autowired + private InfoReplyContentDao infoReplyContentDao; + @Autowired + private EpmetUserOpenFeignClient epmetUserOpenFeignClient; + @Autowired + private GovOrgOpenFeignClient govOrgOpenFeignClient; + @Autowired + private UserMessageDao userMessageDao; + + /** + * 发送消息 + * + * @param formDTO + * @return com.epmet.dto.result.SendInfoResultDTO + * @author yinzuomei + * @date 2021/8/19 10:27 上午 + */ + @Transactional(rollbackFor = Exception.class) + @Override + public SendInfoResultDTO sendInfo(SendInfoFormDTO formDTO) { + //1、请先选择接收人 + if (CollectionUtils.isEmpty(formDTO.getStaffIdList()) && + CollectionUtils.isEmpty(formDTO.getOrgList()) && + CollectionUtils.isEmpty(formDTO.getRoleIdList()) + && CollectionUtils.isEmpty(formDTO.getGroupIdList())) { + throw new RenException(EpmetErrorCode.PLEASE_CHOOSE_RECEIVER.getCode(), EpmetErrorCode.PLEASE_CHOOSE_RECEIVER.getMsg()); + } + //2、选择的组织、角色、或者小组、是否有人呢?? + Set orgStaffIds=queryOrgStaffIds(formDTO.getCustomerId(),formDTO.getOrgList()); + Set roleStaffIds=queryRoleStaffIds(formDTO.getRoleIdList(),formDTO.getCustomerId()); + Set groupStaffIds = CollectionUtils.isNotEmpty(formDTO.getGroupIdList()) ? infoGroupReceiversDao.selectStaffIds(formDTO.getGroupIdList()) : Collections.EMPTY_SET; + log.info("群组选择的人:"+JSON.toJSONString(groupStaffIds,true)); + + //3、计算接收人: + Set totalReceiver=new LinkedHashSet(); + totalReceiver.addAll(formDTO.getStaffIdList()); + totalReceiver.addAll(orgStaffIds); + totalReceiver.addAll(roleStaffIds); + totalReceiver.addAll(groupStaffIds); + if(CollectionUtils.isEmpty(totalReceiver)){ + throw new RenException(EpmetErrorCode.PLEASE_CHOOSE_RECEIVER.getCode(), EpmetErrorCode.PLEASE_CHOOSE_RECEIVER.getMsg()); + } + + //4、插入主表 + InfoEntity infoEntity=constructInfoEntity(formDTO); + baseDao.insert(infoEntity); + //5、插入附件表 + String firstAttId= StrConstant.EPMETY_STR; + if(CollectionUtils.isNotEmpty(formDTO.getAttachmentList())){ + int sort=1; + for (FileCommonDTO att : formDTO.getAttachmentList()) { + InfoAttEntity infoAttEntity = new InfoAttEntity(); + infoAttEntity.setInfoId(infoEntity.getId()); + infoAttEntity.setCustomerId(formDTO.getCustomerId()); + infoAttEntity.setAttachmentFormat(att.getFormat()); + infoAttEntity.setAttachmentName(att.getName()); + infoAttEntity.setAttachmentType(att.getType()); + infoAttEntity.setAttachmentUrl(att.getUrl()); + infoAttEntity.setSort(sort); + infoAttEntity.setAttachmentSize(att.getSize()); + infoAttEntity.setDuration(att.getDuration()); + infoAttDao.insert(infoAttEntity); + if(sort==1){ + firstAttId=infoAttEntity.getId(); + } + sort++; + } + } + //6、接收人 + totalReceiver.forEach(staffId->{ + InfoReceiversEntity infoReceiversEntity=new InfoReceiversEntity(); + infoReceiversEntity.setCustomerId(formDTO.getCustomerId()); + infoReceiversEntity.setInfoId(infoEntity.getId()); + infoReceiversEntity.setStaffId(staffId); + infoReceiversEntity.setReadFlag(false); + infoReceiversDao.insert(infoReceiversEntity); + // 6.1 插入站内信: + UserMessageEntity userMessageEntity=new UserMessageEntity(); + userMessageEntity.setCustomerId(formDTO.getCustomerId()); + userMessageEntity.setGridId(StrConstant.STAR); + userMessageEntity.setUserId(staffId); + userMessageEntity.setApp(AppClientConstant.APP_GOV); + userMessageEntity.setTitle(UserMessageConstans.INFO_TITLE); + userMessageEntity.setMessageContent(String.format(UserMessageConstans.INFO_CONTENT_TEMP, + infoEntity.getContent().length() >= NumConstant.FIFTY ? + StringUtils.substring(infoEntity.getContent(), NumConstant.FORTY_NINE) : infoEntity.getContent())); + userMessageEntity.setReadFlag(UserMessageConstans.UNREAD); + userMessageEntity.setMessageType(UserMessageConstans.MESSAGE_TYPE_INFO); + userMessageEntity.setTargetId(infoEntity.getId()); + userMessageEntity.setCreatedBy(formDTO.getUserId()); + userMessageEntity.setUpdatedBy(formDTO.getUserId()); + userMessageDao.insert(userMessageEntity); + + }); + //7、插入概要表 + InfoProfileEntity infoProfileEntity=new InfoProfileEntity(); + infoProfileEntity.setCustomerId(formDTO.getCustomerId()); + infoProfileEntity.setInfoId(infoEntity.getId()); + infoProfileEntity.setContent(infoEntity.getContent().length() >= NumConstant.FIFTY ? StringUtils.substring(infoEntity.getContent(), NumConstant.FORTY_NINE) : infoEntity.getContent()); + infoProfileEntity.setPublishStaffId(formDTO.getUserId()); + infoProfileEntity.setTotalReceiver(totalReceiver.size()); + infoProfileEntity.setFirstAttId(firstAttId); + infoProfileEntity.setReadTotal(NumConstant.ZERO); + infoProfileEntity.setUnReadReplyNum(NumConstant.ZERO); + infoProfileEntity.setCreatedTime(infoEntity.getCreatedTime()); + infoProfileEntity.setUpdatedTime(infoEntity.getUpdatedTime()); + infoProfileDao.insert(infoProfileEntity); + + SendInfoResultDTO resultDTO=new SendInfoResultDTO(); + resultDTO.setInfoId(infoEntity.getId()); + return resultDTO; + } + + /** + * 【发送消息】我收到的-阅读消息 + * + * @param formDTO + * @return void + * @author yinzuomei + * @date 2021/8/19 5:03 下午 + */ + @Transactional(rollbackFor = Exception.class) + @Override + public void readInfo(ReadInfoFormDTO formDTO) { + //已读总人数+1 + //修改为已读 + InfoReceiversEntity receiver = infoReceiversDao.selectInfoReceiver(formDTO.getInfoId(), formDTO.getUserId()); + if (!receiver.getReadFlag()) { + receiver.setReadFlag(true); + int affectRows = infoReceiversDao.updateById(receiver); + if (affectRows == 1) { + infoProfileDao.addReadTotal(formDTO.getInfoId()); + log.info("已读总人数+1"); + } + } + + } + + /** + * 回复消息(目前需求是发布人不可以回复) + * + * @param formDTO + * @return void + * @author yinzuomei + * @date 2021/8/19 5:30 下午 + */ + @Transactional(rollbackFor = Exception.class) + @Override + public ReplyInfoResultDTO replyInfo(ReplyInfoFormDTO formDTO) { + //1、插入回复记录、回复附件 + //内容和附件 2选一 + if(StringUtils.isBlank(formDTO.getContent())&&CollectionUtils.isEmpty(formDTO.getAttachmentList())){ + throw new RenException(EpmetErrorCode.REPLY_INFO_CONTENT_NOT_NULL.getCode(), EpmetErrorCode.REPLY_INFO_CONTENT_NOT_NULL.getMsg()); + } + InfoReplyEntity infoReplyEntity=new InfoReplyEntity(); + infoReplyEntity.setInfoId(formDTO.getInfoId()); + infoReplyEntity.setCustomerId(formDTO.getCustomerId()); + infoReplyEntity.setFromUserId(formDTO.getUserId()); + infoReplyDao.insert(infoReplyEntity); + int sort=1; + if(StringUtils.isNotBlank(formDTO.getContent())){ + InfoReplyContentEntity contentEntity=new InfoReplyContentEntity(); + contentEntity.setCustomerId(formDTO.getCustomerId()); + contentEntity.setInfoReplyId(infoReplyEntity.getId()); + contentEntity.setReplyType("text"); + contentEntity.setContent(formDTO.getContent()); + contentEntity.setSort(sort); + infoReplyContentDao.insert(contentEntity); + sort++; + } + if(CollectionUtils.isNotEmpty(formDTO.getAttachmentList())){ + for(FileCommonDTO att:formDTO.getAttachmentList()) { + InfoReplyContentEntity contentEntity = new InfoReplyContentEntity(); + contentEntity.setCustomerId(formDTO.getCustomerId()); + contentEntity.setInfoReplyId(infoReplyEntity.getId()); + contentEntity.setReplyType(att.getType()); + contentEntity.setContent(att.getUrl()); + contentEntity.setAttachmentFormat(att.getFormat()); + contentEntity.setAttachmentSize(att.getSize()); + contentEntity.setDuration(att.getDuration()); + contentEntity.setAttachmentName(att.getName()); + contentEntity.setSort(sort); + infoReplyContentDao.insert(contentEntity); + sort++; + } + } + // 2、未读的回复数+1 + InfoProfileEntity infoProfileEntity=infoProfileDao.selectByInfoId(formDTO.getInfoId()); + // 3、现在是发布人不可以回复,日后如果发布人可以回复,自己发布的,不需要提示未读红点 + if(!formDTO.getUserId().equals(infoProfileEntity.getCreatedBy())){ + infoProfileEntity.setUnReadReplyNum(infoProfileEntity.getUnReadReplyNum()+1); + infoProfileDao.updateById(infoProfileEntity); + } + ReplyInfoResultDTO resultDTO=new ReplyInfoResultDTO(); + resultDTO.setReplyId(infoReplyEntity.getId()); + return resultDTO; + } + + /** + * 我发出的,发布人点击详情后,阅读回复,将未读回复数置为0 + * + * @param formDTO + * @return void + * @author yinzuomei + * @date 2021/8/19 5:51 下午 + */ + @Transactional(rollbackFor = Exception.class) + @Override + public void readInfoReply(ReadReplyFormDTO formDTO) { + InfoProfileEntity infoProfile = infoProfileDao.selectByInfoId(formDTO.getInfoId()); + if (null != infoProfile && infoProfile.getCreatedBy().equals(formDTO.getUserId()) && infoProfile.getUnReadReplyNum() > 0) { + infoProfile.setUnReadReplyNum(NumConstant.ZERO); + infoProfileDao.updateById(infoProfile); + } + } + + /** + * 添加群组 + * + * @param formDTO + * @return com.epmet.dto.result.AddReceiverGroupResultDTO + * @author yinzuomei + * @date 2021/8/20 9:58 上午 + */ + @Transactional(rollbackFor = Exception.class) + @Override + public AddReceiverGroupResultDTO addReceiverGroup(AddReceiverGroupFormDTO formDTO) { + // 1、人员列表和组织列表不能同时为空 + if(CollectionUtils.isEmpty(formDTO.getStaffIdList())&&CollectionUtils.isEmpty(formDTO.getOrgList())){ + throw new RenException(EpmetErrorCode.PLEASE_CHOOSE_MEMBER.getCode(), EpmetErrorCode.PLEASE_CHOOSE_MEMBER.getMsg()); + } + // 2、选择了组织,但是组织下没有人,也要提示给用户,:请选择成员 + Set orgStaffIds=queryOrgStaffIds(formDTO.getCustomerId(),formDTO.getOrgList()); + if(CollectionUtils.isEmpty(formDTO.getStaffIdList())&&CollectionUtils.isEmpty(orgStaffIds)){ + throw new RenException(EpmetErrorCode.PLEASE_CHOOSE_MEMBER.getCode(), EpmetErrorCode.PLEASE_CHOOSE_MEMBER.getMsg()); + } + // 3、群名称是否存在 + if (infoReceiverGroupDao.selectCountName(formDTO.getName().trim(),formDTO.getCustomerId(),formDTO.getUserId()) > 1) { + throw new RenException(EpmetErrorCode.INFO_GROUP_NAME_EXISTS.getCode(), EpmetErrorCode.INFO_GROUP_NAME_EXISTS.getMsg()); + } + InfoReceiverGroupEntity groupEntity=new InfoReceiverGroupEntity(); + groupEntity.setCustomerId(formDTO.getCustomerId()); + groupEntity.setName(formDTO.getName()); + groupEntity.setCreateStaffId(formDTO.getUserId()); + // 4、插入小组表 + infoReceiverGroupDao.insert(groupEntity); + + Set members=new LinkedHashSet(); + members.addAll(formDTO.getStaffIdList()); + members.addAll(orgStaffIds); + members.forEach(memStaffId->{ + // 5、插入群成员表 + InfoGroupReceiversEntity memberEntity=new InfoGroupReceiversEntity(); + memberEntity.setCustomerId(formDTO.getCustomerId()); + memberEntity.setInfoReceiverGroupId(groupEntity.getId()); + memberEntity.setStaffId(memStaffId); + infoGroupReceiversDao.insert(memberEntity); + }); + + // 6、返回小组id + AddReceiverGroupResultDTO resultDTO=new AddReceiverGroupResultDTO(); + resultDTO.setReceiverGroupId(groupEntity.getId()); + return resultDTO; + } + + /** + * 查询架构里面的人 + * + * @param orgList + * @return java.util.Set + * @author yinzuomei + * @date 2021/8/19 11:34 上午 + */ + private Set queryOrgStaffIds(String customerId,Set orgList) { + if (CollectionUtils.isEmpty(orgList)) { + return Collections.EMPTY_SET; + } + //如果我选择的是 东阿镇,是发送给本级及下级所有工作人员 + OrgStaffFormDTO orgStaffFormDTO=new OrgStaffFormDTO(); + orgStaffFormDTO.setCustomerId(customerId); + for(OrgCommonDTO org:orgList){ + if("grid".equals(org.getOrgType())){ + orgStaffFormDTO.getGridIds().add(org.getOrgId()); + }else if("agency".equals(org.getOrgType())){ + orgStaffFormDTO.getAgencyIds().add(org.getOrgId()); + }else if("dept".equals(org.getOrgType())){ + orgStaffFormDTO.getDeptIds().add(org.getOrgId()); + } + } + Result> result=govOrgOpenFeignClient.queryOrgStaffs(orgStaffFormDTO); + if (!result.success()) { + throw new RenException("根据组织查询工作人员异常"); + } + if(CollectionUtils.isEmpty(result.getData())){ + log.info("已选择的架构里没有工作人员"); + return Collections.EMPTY_SET; + } + return result.getData(); + } + + /** + * 查询角色里面的人 + * + * @param roleIdList + * @param customerId + * @return java.util.Set + * @author yinzuomei + * @date 2021/8/19 11:34 上午 + */ + private Set queryRoleStaffIds(Set roleIdList, String customerId) { + if (CollectionUtils.isEmpty(roleIdList)) { + return Collections.EMPTY_SET; + } + RoleStaffIdFormDTO formDTO = new RoleStaffIdFormDTO(); + formDTO.setCustomerId(customerId); + formDTO.setRoleIds(roleIdList); + Result> result = epmetUserOpenFeignClient.queryRoleStaffIds(formDTO); + if (!result.success()) { + throw new RenException("根据角色查询工作人员异常"); + } + if(CollectionUtils.isEmpty(result.getData())){ + log.info("角色下没有工作人员"); + return Collections.EMPTY_SET; + } + return result.getData(); + } + + /** + * 构造主表 + * + * @param formDTO + * @return com.epmet.entity.InfoEntity + * @author yinzuomei + * @date 2021/8/19 10:38 上午 + */ + private InfoEntity constructInfoEntity(SendInfoFormDTO formDTO) { + InfoEntity infoEntity=new InfoEntity(); + infoEntity.setContent(formDTO.getContent()); + infoEntity.setPublishStaffId(formDTO.getUserId()); + infoEntity.setCustomerId(formDTO.getCustomerId()); + return infoEntity; + } + + + + + + + + + + + + + + + + + + +} \ No newline at end of file diff --git a/epmet-module/epmet-message/epmet-message-server/src/main/resources/db/migration/V0.3.14__create_info_table.sql b/epmet-module/epmet-message/epmet-message-server/src/main/resources/db/migration/V0.3.14__create_info_table.sql new file mode 100644 index 0000000000..820e8ca67c --- /dev/null +++ b/epmet-module/epmet-message/epmet-message-server/src/main/resources/db/migration/V0.3.14__create_info_table.sql @@ -0,0 +1,141 @@ +-- 上传下达消息表 +CREATE TABLE `info` ( + `ID` varchar(64) NOT NULL COMMENT '主键', + `CUSTOMER_ID` varchar(64) NOT NULL COMMENT '客户id', + `publish_staff_id` varchar(64) NOT NULL COMMENT '发布人id', + `content` varchar(1024) NOT NULL COMMENT '内容,这里存储全部的内容。', + `DEL_FLAG` varchar(1) NOT NULL COMMENT '删除标识', + `REVISION` int(10) NOT NULL COMMENT '乐观锁', + `CREATED_BY` varchar(32) NOT NULL COMMENT '创建人', + `CREATED_TIME` datetime NOT NULL COMMENT '创建时间', + `UPDATED_BY` varchar(32) NOT NULL COMMENT '更新人', + `UPDATED_TIME` datetime NOT NULL COMMENT '更新时间', + PRIMARY KEY (`ID`) USING BTREE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='消息主表'; + + +CREATE TABLE `info_att` ( + `ID` varchar(64) NOT NULL COMMENT '主键', + `CUSTOMER_ID` varchar(64) NOT NULL COMMENT '客户ID', + `INFO_ID` varchar(64) NOT NULL COMMENT '消息主表的id', + `ATTACHMENT_NAME` varchar(64) NOT NULL COMMENT '附件名', + `ATTACHMENT_FORMAT` varchar(64) NOT NULL COMMENT '文件格式(JPG、PNG、PDF、JPEG、BMP、MP4、WMA、M4A、MP3、DOC、DOCX、XLS)', + `ATTACHMENT_TYPE` varchar(64) NOT NULL COMMENT '附件类型((图片 - image、 视频 - video、 语音 - voice、 文档 - doc))', + `ATTACHMENT_URL` varchar(255) NOT NULL COMMENT '附件地址', + `ATTACHMENT_SIZE` int(11) DEFAULT NULL COMMENT '文件大小,单位b', + `DURATION` int(11) unsigned DEFAULT '0' COMMENT '语音或视频时长,秒', + `SORT` int(1) NOT NULL COMMENT '排序字段', + `DEL_FLAG` varchar(1) NOT NULL COMMENT '删除标记 0:未删除,1:已删除', + `REVISION` int(11) NOT NULL COMMENT '乐观锁', + `CREATED_BY` varchar(32) NOT NULL COMMENT '创建人', + `CREATED_TIME` datetime NOT NULL COMMENT '创建时间', + `UPDATED_BY` varchar(32) NOT NULL COMMENT '更新人', + `UPDATED_TIME` datetime NOT NULL COMMENT '更新时间', + PRIMARY KEY (`ID`) USING BTREE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 ROW_FORMAT=COMPACT COMMENT='消息的附件表'; + + +CREATE TABLE `info_group_receivers` ( + `ID` varchar(64) NOT NULL COMMENT '主键', + `CUSTOMER_ID` varchar(64) NOT NULL COMMENT '客户ID', + `info_receiver_group_id` varchar(64) NOT NULL COMMENT '群组id', + `STAFF_ID` varchar(64) NOT NULL COMMENT '工作人员id', + `DEL_FLAG` varchar(1) NOT NULL COMMENT '删除标记 0:未删除,1:已删除', + `REVISION` int(11) NOT NULL COMMENT '乐观锁', + `CREATED_BY` varchar(32) NOT NULL COMMENT '创建人', + `CREATED_TIME` datetime NOT NULL COMMENT '创建时间', + `UPDATED_BY` varchar(32) NOT NULL COMMENT '更新人', + `UPDATED_TIME` datetime NOT NULL COMMENT '更新时间', + PRIMARY KEY (`ID`) USING BTREE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 ROW_FORMAT=COMPACT COMMENT='消息-群组成员关系表'; + + +CREATE TABLE `info_profile` ( + `ID` varchar(64) NOT NULL COMMENT '主键', + `CUSTOMER_ID` varchar(64) NOT NULL COMMENT '客户id', + `INFO_ID` varchar(64) NOT NULL COMMENT '消息主表的id', + `publish_staff_id` varchar(64) NOT NULL COMMENT '发布人id', + `content` varchar(512) NOT NULL COMMENT '内容概要,取前100字', + `first_att_id` varchar(64) NOT NULL COMMENT '默认附件表的第一个条用于展示', + `total_receiver` int(11) NOT NULL COMMENT '应读人数', + `read_total` int(11) NOT NULL COMMENT '已读人数,插入是为0', + `UN_READ_REPLY_NUM` int(11) NOT NULL COMMENT '未读的回复数量:发布人每次查看详情后,置为0;接收人回复一条+1', + `DEL_FLAG` varchar(1) NOT NULL COMMENT '删除标识', + `REVISION` int(10) NOT NULL COMMENT '乐观锁', + `CREATED_BY` varchar(32) NOT NULL COMMENT '创建人', + `CREATED_TIME` datetime NOT NULL COMMENT '创建时间', + `UPDATED_BY` varchar(32) NOT NULL COMMENT '更新人', + `UPDATED_TIME` datetime NOT NULL COMMENT '更新时间', + PRIMARY KEY (`ID`) USING BTREE, + UNIQUE KEY `IDX_IP_INFO_ID` (`INFO_ID`), + KEY `IDX_IP_STAFF_ID` (`publish_staff_id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='消息概要表'; + + +CREATE TABLE `info_receiver_group` ( + `ID` varchar(64) NOT NULL COMMENT '主键', + `CUSTOMER_ID` varchar(64) NOT NULL COMMENT '客户ID', + `NAME` varchar(64) NOT NULL COMMENT '群组名称,我创建的范围内唯一', + `CREATE_STAFF_ID` varchar(64) NOT NULL COMMENT '创建人id', + `DEL_FLAG` varchar(1) NOT NULL COMMENT '删除标记 0:未删除,1:已删除', + `REVISION` int(11) NOT NULL COMMENT '乐观锁', + `CREATED_BY` varchar(32) NOT NULL COMMENT '创建人', + `CREATED_TIME` datetime NOT NULL COMMENT '创建时间', + `UPDATED_BY` varchar(32) NOT NULL COMMENT '更新人', + `UPDATED_TIME` datetime NOT NULL COMMENT '更新时间', + PRIMARY KEY (`ID`) USING BTREE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 ROW_FORMAT=COMPACT COMMENT='消息-群组表'; + + +CREATE TABLE `info_receivers` ( + `ID` varchar(64) NOT NULL COMMENT '主键,群组id', + `CUSTOMER_ID` varchar(64) NOT NULL COMMENT '客户ID', + `INFO_ID` varchar(64) NOT NULL COMMENT '消息主表.id', + `STAFF_ID` varchar(64) NOT NULL COMMENT '工作人员id', + `READ_FLAG` tinyint(1) NOT NULL DEFAULT '0' COMMENT '已读:1;未读:0', + `DEL_FLAG` varchar(1) NOT NULL COMMENT '删除标记 0:未删除,1:已删除', + `REVISION` int(11) NOT NULL COMMENT '乐观锁', + `CREATED_BY` varchar(32) NOT NULL COMMENT '创建人', + `CREATED_TIME` datetime NOT NULL COMMENT '创建时间', + `UPDATED_BY` varchar(32) NOT NULL COMMENT '更新人', + `UPDATED_TIME` datetime NOT NULL COMMENT '更新时间', + PRIMARY KEY (`ID`) USING BTREE, + KEY `IDX_IR_INFO_ID` (`INFO_ID`), + KEY `IDX_IR_STAFF_ID` (`STAFF_ID`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 ROW_FORMAT=COMPACT COMMENT='消息接收人记录表'; + + +CREATE TABLE `info_reply` ( + `ID` varchar(64) NOT NULL COMMENT '主键', + `CUSTOMER_ID` varchar(64) NOT NULL COMMENT '客户ID', + `INFO_ID` varchar(64) NOT NULL COMMENT '消息主表的id', + `FROM_USER_ID` varchar(64) NOT NULL COMMENT '回复人用户Id', + `DEL_FLAG` varchar(1) NOT NULL COMMENT '删除标记 0:未删除,1:已删除', + `REVISION` int(11) NOT NULL COMMENT '乐观锁', + `CREATED_BY` varchar(32) NOT NULL COMMENT '创建人', + `CREATED_TIME` datetime NOT NULL COMMENT '创建时间', + `UPDATED_BY` varchar(32) NOT NULL COMMENT '更新人', + `UPDATED_TIME` datetime NOT NULL COMMENT '更新时间', + PRIMARY KEY (`ID`) USING BTREE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 ROW_FORMAT=COMPACT COMMENT='消息回复表'; + + +CREATE TABLE `info_reply_content` ( + `ID` varchar(64) NOT NULL COMMENT '主键', + `CUSTOMER_ID` varchar(64) NOT NULL COMMENT '客户ID', + `INFO_REPLY_ID` varchar(64) NOT NULL COMMENT 'INFO_REPLY的id', + `ATTACHMENT_NAME` varchar(64) DEFAULT NULL COMMENT '附件名', + `ATTACHMENT_FORMAT` varchar(64) DEFAULT NULL COMMENT '文件格式(JPG、PNG、PDF、JPEG、BMP、MP4、WMA、M4A、MP3、DOC、DOCX、XLS)', + `REPLY_TYPE` varchar(64) NOT NULL COMMENT '回复的类型(文本-text、图片 - image、 视频 - video、 语音 - voice、 文档 - doc))', + `CONTENT` varchar(255) NOT NULL COMMENT '如果是文本对应的是文字,如果是其他类型,对应的是url', + `SORT` int(1) NOT NULL COMMENT '排序字段', + `ATTACHMENT_SIZE` int(11) DEFAULT NULL COMMENT '文件大小,单位b', + `DURATION` int(11) unsigned DEFAULT '0' COMMENT '语音或视频时长,秒', + `DEL_FLAG` varchar(1) NOT NULL COMMENT '删除标记 0:未删除,1:已删除', + `REVISION` int(11) NOT NULL COMMENT '乐观锁', + `CREATED_BY` varchar(32) NOT NULL COMMENT '创建人', + `CREATED_TIME` datetime NOT NULL COMMENT '创建时间', + `UPDATED_BY` varchar(32) NOT NULL COMMENT '更新人', + `UPDATED_TIME` datetime NOT NULL COMMENT '更新时间', + PRIMARY KEY (`ID`) USING BTREE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 ROW_FORMAT=COMPACT COMMENT='回复详情表'; diff --git a/epmet-module/epmet-message/epmet-message-server/src/main/resources/db/migration/V0.3.15__alter_user_message.sql b/epmet-module/epmet-message/epmet-message-server/src/main/resources/db/migration/V0.3.15__alter_user_message.sql new file mode 100644 index 0000000000..c4bfcc7743 --- /dev/null +++ b/epmet-module/epmet-message/epmet-message-server/src/main/resources/db/migration/V0.3.15__alter_user_message.sql @@ -0,0 +1,3 @@ + +alter table user_message add COLUMN message_type VARCHAR(32) comment '消息分类:info-上传下达消息' AFTER app; +alter table user_message add COLUMN target_id VARCHAR(64) comment '消息对应的业务id,比如message_type=info时,此列存储的是消息id,可跳转到消息详情' AFTER message_type; \ No newline at end of file diff --git a/epmet-module/epmet-message/epmet-message-server/src/main/resources/db/migration/V0.3.16__add_infocontent_idx.sql b/epmet-module/epmet-message/epmet-message-server/src/main/resources/db/migration/V0.3.16__add_infocontent_idx.sql new file mode 100644 index 0000000000..4e49a38915 --- /dev/null +++ b/epmet-module/epmet-message/epmet-message-server/src/main/resources/db/migration/V0.3.16__add_infocontent_idx.sql @@ -0,0 +1,2 @@ +alter table info add fulltext index idx_fulltext_infocontent(content) WITH PARSER ngram; +drop index idx_fulltext_infocontent on info; diff --git a/epmet-module/epmet-message/epmet-message-server/src/main/resources/mapper/InfoAttDao.xml b/epmet-module/epmet-message/epmet-message-server/src/main/resources/mapper/InfoAttDao.xml new file mode 100644 index 0000000000..4d3710f54f --- /dev/null +++ b/epmet-module/epmet-message/epmet-message-server/src/main/resources/mapper/InfoAttDao.xml @@ -0,0 +1,24 @@ + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/epmet-module/epmet-message/epmet-message-server/src/main/resources/mapper/InfoDao.xml b/epmet-module/epmet-message/epmet-message-server/src/main/resources/mapper/InfoDao.xml new file mode 100644 index 0000000000..25ef13a201 --- /dev/null +++ b/epmet-module/epmet-message/epmet-message-server/src/main/resources/mapper/InfoDao.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/epmet-module/epmet-message/epmet-message-server/src/main/resources/mapper/InfoGroupReceiversDao.xml b/epmet-module/epmet-message/epmet-message-server/src/main/resources/mapper/InfoGroupReceiversDao.xml new file mode 100644 index 0000000000..d8aefa0520 --- /dev/null +++ b/epmet-module/epmet-message/epmet-message-server/src/main/resources/mapper/InfoGroupReceiversDao.xml @@ -0,0 +1,21 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/epmet-module/epmet-message/epmet-message-server/src/main/resources/mapper/InfoProfileDao.xml b/epmet-module/epmet-message/epmet-message-server/src/main/resources/mapper/InfoProfileDao.xml new file mode 100644 index 0000000000..4aa4e77000 --- /dev/null +++ b/epmet-module/epmet-message/epmet-message-server/src/main/resources/mapper/InfoProfileDao.xml @@ -0,0 +1,22 @@ + + + + + + + + UPDATE info_profile + SET read_total = read_total + 1, + UPDATED_TIME = NOW() + WHERE + INFO_ID = #{infoId} + AND DEL_FLAG = '0' + + + + \ No newline at end of file diff --git a/epmet-module/epmet-message/epmet-message-server/src/main/resources/mapper/InfoReceiverGroupDao.xml b/epmet-module/epmet-message/epmet-message-server/src/main/resources/mapper/InfoReceiverGroupDao.xml new file mode 100644 index 0000000000..23f4fec727 --- /dev/null +++ b/epmet-module/epmet-message/epmet-message-server/src/main/resources/mapper/InfoReceiverGroupDao.xml @@ -0,0 +1,18 @@ + + + + + + + + \ No newline at end of file diff --git a/epmet-module/epmet-message/epmet-message-server/src/main/resources/mapper/InfoReceiversDao.xml b/epmet-module/epmet-message/epmet-message-server/src/main/resources/mapper/InfoReceiversDao.xml new file mode 100644 index 0000000000..38c13d2489 --- /dev/null +++ b/epmet-module/epmet-message/epmet-message-server/src/main/resources/mapper/InfoReceiversDao.xml @@ -0,0 +1,17 @@ + + + + + + + + \ No newline at end of file diff --git a/epmet-module/epmet-message/epmet-message-server/src/main/resources/mapper/InfoReplyContentDao.xml b/epmet-module/epmet-message/epmet-message-server/src/main/resources/mapper/InfoReplyContentDao.xml new file mode 100644 index 0000000000..0e02284cd4 --- /dev/null +++ b/epmet-module/epmet-message/epmet-message-server/src/main/resources/mapper/InfoReplyContentDao.xml @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/epmet-module/epmet-message/epmet-message-server/src/main/resources/mapper/InfoReplyDao.xml b/epmet-module/epmet-message/epmet-message-server/src/main/resources/mapper/InfoReplyDao.xml new file mode 100644 index 0000000000..0411abe306 --- /dev/null +++ b/epmet-module/epmet-message/epmet-message-server/src/main/resources/mapper/InfoReplyDao.xml @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/StaffOrgRelationDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/StaffOrgRelationDTO.java new file mode 100644 index 0000000000..9e29a92560 --- /dev/null +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/StaffOrgRelationDTO.java @@ -0,0 +1,96 @@ +/** + * 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 java.io.Serializable; +import java.util.Date; +import lombok.Data; + + +/** + * 工作人员注册组织关系表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2021-08-19 + */ +@Data +public class StaffOrgRelationDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + private String id; + + /** + * 客户ID + */ + private String customerId; + + /** + * 所有上级组织机构ID(以英文:隔开)部门/网格得拼上所属组织Id + */ + private String pids; + + /** + * 工作人员Id + */ + private String staffId; + + /** + * 工作人员添加入口Id(agencyId;deptId;gridId) + */ + private String orgId; + + /** + * 工作人员添加入口类型(组织:agency;部门:dept;网格:gridId) + */ + private String orgType; + + /** + * 删除标识 + */ + private String delFlag; + + /** + * 乐观锁 + */ + private Integer revision; + + /** + * 创建人 + */ + private String createdBy; + + /** + * 创建时间 + */ + private Date createdTime; + + /** + * 更新人 + */ + private String updatedBy; + + /** + * 更新时间 + */ + private Date updatedTime; + +} \ No newline at end of file diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/AddStaffV2FromDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/AddStaffV2FromDTO.java new file mode 100644 index 0000000000..5f369289e9 --- /dev/null +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/AddStaffV2FromDTO.java @@ -0,0 +1,74 @@ +package com.epmet.dto.form; + +import com.epmet.commons.tools.validator.group.CustomerClientShowGroup; +import lombok.Data; +import lombok.NoArgsConstructor; +import org.hibernate.validator.constraints.Length; + +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; +import javax.validation.constraints.Pattern; +import java.io.Serializable; +import java.util.List; + +/** + * @author sun + * @dscription + */ +@NoArgsConstructor +@Data +public class AddStaffV2FromDTO implements Serializable { + private static final long serialVersionUID = 1L; + /** + * 新增人员所属类型Id + */ + private String orgId; + /** + * 客户ID + */ + private String customerId; + /** + * 新增人员所属类型【组织:agency;部门:dept;网格:grid】】 + */ + private String orgType; + /** + * 姓名 + */ + @NotBlank(message = "姓名不能为空", groups = AddStaffV2FromDTO.AddStaff.class) + @Length(max = 15, message = "姓名仅允许输入15个字符", groups = AddStaffV2FromDTO.AddStaff.class) + private String name; + /** + * 人员ID + */ + private String staffId; + /** + * 手机 + */ + @NotBlank(message = "手机号不能为空", groups = AddStaffV2FromDTO.AddStaff.class) + @Pattern(regexp = "^[1][3,4,5,6,7,8,9][0-9]{9}$", message = "请输入正确的手机号", groups = AddStaffV2FromDTO.AddStaff.class) + private String mobile; + /** + * 性别 + */ + @NotNull(message = "性别不能为空", groups = AddStaffV2FromDTO.AddStaff.class) + private Integer gender; + /** + * 专兼职 + */ + @NotBlank(message = "专兼职不能为空", groups = AddStaffV2FromDTO.AddStaff.class) + private String workType; + /** + * 角色id列表 + */ + @NotNull(message = "角色不能为空", groups = AddStaffV2FromDTO.AddStaff.class) + private List roles; + public interface AddStaff extends CustomerClientShowGroup {} + /** + * 来源app(政府端:gov、居民端:resi、运营端:oper) + */ + private String app; + /** + * 来源client(PC端:web、微信小程序:wxmp) + */ + private String client; +} diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/OrgStaffFormDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/OrgStaffFormDTO.java new file mode 100644 index 0000000000..21755b9c43 --- /dev/null +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/OrgStaffFormDTO.java @@ -0,0 +1,28 @@ +package com.epmet.dto.form; + +import com.epmet.commons.tools.constant.StrConstant; +import lombok.Data; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.List; + +/** + * @Description 按架构选择了那些人? 查询入参 + * @Author yinzuomei + * @Date 2021/8/19 1:37 下午 + */ +@Data +public class OrgStaffFormDTO implements Serializable { + private List agencyIds; + private List deptIds; + private List gridIds; + private String customerId; + public OrgStaffFormDTO(){ + this.agencyIds=new ArrayList<>(); + this.deptIds=new ArrayList<>(); + this.gridIds=new ArrayList<>(); + this.customerId= StrConstant.EPMETY_STR; + } +} + diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/OrgResultDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/OrgResultDTO.java new file mode 100644 index 0000000000..54cd3a5cc1 --- /dev/null +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/OrgResultDTO.java @@ -0,0 +1,91 @@ +/** + * 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.result; + +import lombok.Data; + +import java.io.Serializable; + + +/** + * 按类型查询对应机关信息 + */ +@Data +public class OrgResultDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 机关Id + */ + private String agencyId; + + /** + * 客户ID + */ + private String customerId; + + /** + * 上级组织机构ID + */ + private String pid; + + /** + * 所有上级组织机构ID(以英文:隔开) + */ + private String pids; + + /** + * 所有上级名称,以-连接 + */ + private String allParentName; + + /** + * 组织名称 + */ + private String organizationName; + + /** + * 机关级别(社区级:community, +乡(镇、街道)级:street, +区县级: district, +市级: city +省级:province) 机关级别(社区级:community,乡(镇、街道)级:street,区县级: district,市级: city省级:province) + */ + private String level; + + /** + * 地区编码 + */ + private String areaCode; + + /** + * 总人数 + */ + private Integer totalUser = 0; + + /** + * 部门总人数 + */ + private Integer DeptTotalUser = 0; + + /** + * 网格总人数 + */ + private Integer gridTotalUser = 0; +} \ No newline at end of file diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/StaffRoleResultDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/StaffRoleResultDTO.java index b39085d40c..7962be5504 100644 --- a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/StaffRoleResultDTO.java +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/StaffRoleResultDTO.java @@ -17,6 +17,10 @@ public class StaffRoleResultDTO implements Serializable { * 角色ID */ private String roleId; + /** + * 角色key + */ + private String roleKey; /** * 角色名称 */ diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/feign/GovOrgOpenFeignClient.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/feign/GovOrgOpenFeignClient.java index 7237abcc5b..e6af374fe2 100644 --- a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/feign/GovOrgOpenFeignClient.java +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/feign/GovOrgOpenFeignClient.java @@ -7,13 +7,13 @@ import com.epmet.dto.CustomerGridDTO; import com.epmet.dto.CustomerPartyBranchDTO; import com.epmet.dto.form.*; import com.epmet.dto.result.*; -import com.epmet.feign.fallback.GovOrgOpenFeignClientFallback; import com.epmet.feign.fallback.GovOrgOpenFeignClientFallbackFactory; import org.springframework.cloud.openfeign.FeignClient; import org.springframework.http.MediaType; import org.springframework.web.bind.annotation.*; import java.util.List; +import java.util.Set; /** * 本服务对外开放的API,其他服务通过引用此client调用该服务 @@ -407,4 +407,14 @@ public interface GovOrgOpenFeignClient { @PostMapping("/gov/org/customergrid/selectorgsbyuserid") Result> selectOrgsByUserId(@RequestParam("userId")String userId); + /** + * 架构里面的人 + * + * @param formDTO + * @return com.epmet.commons.tools.utils.Result> + * @author yinzuomei + * @date 2021/8/19 2:27 下午 + */ + @PostMapping("/gov/org/customerstaffagency/queryOrgStaffs") + Result> queryOrgStaffs(@RequestBody OrgStaffFormDTO formDTO); } diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/feign/fallback/GovOrgOpenFeignClientFallback.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/feign/fallback/GovOrgOpenFeignClientFallback.java index 91f9052c84..b517c20344 100644 --- a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/feign/fallback/GovOrgOpenFeignClientFallback.java +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/feign/fallback/GovOrgOpenFeignClientFallback.java @@ -9,9 +9,9 @@ import com.epmet.dto.CustomerPartyBranchDTO; import com.epmet.dto.form.*; import com.epmet.dto.result.*; import com.epmet.feign.GovOrgOpenFeignClient; -import org.springframework.stereotype.Component; import java.util.List; +import java.util.Set; /** * 本服务对外开放的API,其他服务通过引用此client调用该服务 @@ -235,6 +235,19 @@ public class GovOrgOpenFeignClientFallback implements GovOrgOpenFeignClient { return ModuleUtils.feignConError(ServiceConstant.GOV_ORG_SERVER, "selectOrgsByUserId", userId); } + /** + * 架构里面的人 + * + * @param formDTO + * @return com.epmet.commons.tools.utils.Result> + * @author yinzuomei + * @date 2021/8/19 2:27 下午 + */ + @Override + public Result> queryOrgStaffs(OrgStaffFormDTO formDTO) { + return ModuleUtils.feignConError(ServiceConstant.GOV_ORG_SERVER, "queryOrgStaffs", formDTO); + } + @Override public Result selectPidsByGridId(String gridId) { return ModuleUtils.feignConError(ServiceConstant.GOV_ORG_SERVER, "selectPidsByGridId", gridId); diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/CustomerStaffAgencyController.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/CustomerStaffAgencyController.java index ad965efef7..0339163bf3 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/CustomerStaffAgencyController.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/CustomerStaffAgencyController.java @@ -23,10 +23,11 @@ import com.epmet.commons.tools.utils.Result; import com.epmet.commons.tools.validator.AssertUtils; import com.epmet.commons.tools.validator.ValidatorUtils; import com.epmet.commons.tools.validator.group.AddGroup; -import com.epmet.commons.tools.validator.group.UpdateGroup; import com.epmet.commons.tools.validator.group.DefaultGroup; +import com.epmet.commons.tools.validator.group.UpdateGroup; import com.epmet.dto.CustomerStaffAgencyDTO; import com.epmet.dto.form.AgencyIdFormDTO; +import com.epmet.dto.form.OrgStaffFormDTO; import com.epmet.dto.result.LatestCustomerResultDTO; import com.epmet.excel.CustomerStaffAgencyExcel; import com.epmet.service.CustomerStaffAgencyService; @@ -36,6 +37,7 @@ import org.springframework.web.bind.annotation.*; import javax.servlet.http.HttpServletResponse; import java.util.List; import java.util.Map; +import java.util.Set; /** @@ -116,4 +118,16 @@ public class CustomerStaffAgencyController { return new Result>().ok(customerStaffAgencyService.getAgencyStaffs(agencyIdFormDTO)); } + /** + * 按组织架构选择发消息时, 查询出组织|部门|网格的人,去重 + * + * @param formDTO + * @return com.epmet.commons.tools.utils.Result> + * @author yinzuomei + * @date 2021/8/19 1:40 下午 + */ + @PostMapping("queryOrgStaffs") + public Result> queryOrgStaffs(@RequestBody OrgStaffFormDTO formDTO) { + return new Result>().ok(customerStaffAgencyService.queryOrgStaffs(formDTO)); + } } \ No newline at end of file diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/StaffController.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/StaffController.java index 834cd56869..2dafc1e158 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/StaffController.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/StaffController.java @@ -165,4 +165,19 @@ public class StaffController { public Result staffName(@RequestParam("userId")String userId){ return new Result().ok(staffService.staffName(userId)); } + + /** + * 【通讯录】人员添加v2 + * @author sun + */ + @PostMapping("addstaffv2") + @RequirePermission(requirePermission = RequirePermissionEnum.ORG_STAFF_CREATE) + public Result addStaffV2(@LoginUser TokenDto tokenDto, @RequestBody AddStaffV2FromDTO fromDTO){ + ValidatorUtils.validateEntity(fromDTO, AddStaffV2FromDTO.AddStaff.class); + fromDTO.setCustomerId(tokenDto.getCustomerId()); + fromDTO.setApp(tokenDto.getApp()); + fromDTO.setClient(tokenDto.getClient()); + return staffService.addStaffV2(fromDTO); + } + } diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/StaffOrgRelationController.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/StaffOrgRelationController.java new file mode 100644 index 0000000000..065ad9d578 --- /dev/null +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/StaffOrgRelationController.java @@ -0,0 +1,85 @@ +/** + * 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.controller; + +import com.epmet.commons.tools.page.PageData; +import com.epmet.commons.tools.utils.Result; +import com.epmet.commons.tools.validator.AssertUtils; +import com.epmet.commons.tools.validator.ValidatorUtils; +import com.epmet.commons.tools.validator.group.AddGroup; +import com.epmet.commons.tools.validator.group.DefaultGroup; +import com.epmet.commons.tools.validator.group.UpdateGroup; +import com.epmet.dto.StaffOrgRelationDTO; +import com.epmet.service.StaffOrgRelationService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +import java.util.Map; + + +/** + * 工作人员注册组织关系表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2021-08-19 + */ +@RestController +@RequestMapping("stafforgrelation") +public class StaffOrgRelationController { + + @Autowired + private StaffOrgRelationService staffOrgRelationService; + + @GetMapping("page") + public Result> page(@RequestParam Map params){ + PageData page = staffOrgRelationService.page(params); + return new Result>().ok(page); + } + + @GetMapping("{id}") + public Result get(@PathVariable("id") String id){ + StaffOrgRelationDTO data = staffOrgRelationService.get(id); + return new Result().ok(data); + } + + @PostMapping + public Result save(@RequestBody StaffOrgRelationDTO dto){ + //效验数据 + ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class); + staffOrgRelationService.save(dto); + return new Result(); + } + + @PutMapping + public Result update(@RequestBody StaffOrgRelationDTO dto){ + //效验数据 + ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class); + staffOrgRelationService.update(dto); + return new Result(); + } + + @DeleteMapping + public Result delete(@RequestBody String[] ids){ + //效验数据 + AssertUtils.isArrayEmpty(ids, "id"); + staffOrgRelationService.delete(ids); + return new Result(); + } + + +} \ No newline at end of file diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerAgencyDao.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerAgencyDao.java index dc5518a35c..b0149c28d8 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerAgencyDao.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerAgencyDao.java @@ -233,4 +233,10 @@ public interface CustomerAgencyDao extends BaseDao { @Param("customerId") String customerId, @Param("agencyId") String agencyId, @Param("parentAgencyId") String parentAgencyId); + + /** + * 根据新增人员类型判断查询机关信息 + * @author sun + */ + OrgResultDTO selectAgencyDetail(@Param("orgId") String orgId, @Param("orgType") String orgType); } \ No newline at end of file diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerStaffAgencyDao.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerStaffAgencyDao.java index 864603ee07..c1a7f52efa 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerStaffAgencyDao.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerStaffAgencyDao.java @@ -27,6 +27,7 @@ import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; import java.util.List; +import java.util.Set; /** * 人员-机关单位关系表 @@ -116,4 +117,20 @@ public interface CustomerStaffAgencyDao extends BaseDao + * @author yinzuomei + * @date 2021/8/19 2:01 下午 + */ + Set selectAgencyStaffs(@Param("customerId")String customerId, + @Param("agencyIds")List agencyIds); + + Set selectDeptStaffs(@Param("customerId")String customerId, @Param("deptIds")List deptIds); + + Set selectGridStaffs(@Param("customerId")String customerId, @Param("gridIds")List gridids); } \ No newline at end of file diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/StaffOrgRelationDao.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/StaffOrgRelationDao.java new file mode 100644 index 0000000000..a4d6610658 --- /dev/null +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/StaffOrgRelationDao.java @@ -0,0 +1,33 @@ +/** + * 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.dao; + +import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.entity.StaffOrgRelationEntity; +import org.apache.ibatis.annotations.Mapper; + +/** + * 工作人员注册组织关系表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2021-08-19 + */ +@Mapper +public interface StaffOrgRelationDao extends BaseDao { + +} \ No newline at end of file diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/entity/StaffOrgRelationEntity.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/entity/StaffOrgRelationEntity.java new file mode 100644 index 0000000000..f9c31b49d9 --- /dev/null +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/entity/StaffOrgRelationEntity.java @@ -0,0 +1,66 @@ +/** + * 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.entity; + +import com.baomidou.mybatisplus.annotation.TableName; + +import com.epmet.commons.mybatis.entity.BaseEpmetEntity; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.util.Date; + +/** + * 工作人员注册组织关系表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2021-08-19 + */ +@Data +@EqualsAndHashCode(callSuper=false) +@TableName("staff_org_relation") +public class StaffOrgRelationEntity extends BaseEpmetEntity { + + private static final long serialVersionUID = 1L; + + /** + * 客户ID + */ + private String customerId; + + /** + * 所有上级组织机构ID(以英文:隔开)部门/网格得拼上所属组织Id + */ + private String pids; + + /** + * 工作人员Id + */ + private String staffId; + + /** + * 工作人员添加入口Id(agencyId;deptId;gridId) + */ + private String orgId; + + /** + * 工作人员添加入口类型(组织:agency;部门:dept;网格:gridId) + */ + private String orgType; + +} diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/CustomerStaffAgencyService.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/CustomerStaffAgencyService.java index 8f6f47dfdb..5ac6a78696 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/CustomerStaffAgencyService.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/CustomerStaffAgencyService.java @@ -21,16 +21,14 @@ import com.epmet.commons.mybatis.service.BaseService; import com.epmet.commons.tools.page.PageData; import com.epmet.commons.tools.utils.Result; import com.epmet.dto.CustomerStaffAgencyDTO; -import com.epmet.dto.form.AgencyIdFormDTO; -import com.epmet.dto.form.CommonDepartmentFormDTO; -import com.epmet.dto.form.StaffsInAgencyFromDTO; -import com.epmet.dto.form.CommonGridIdFormDTO; +import com.epmet.dto.form.*; import com.epmet.dto.result.CommonStaffInfoResultDTO; import com.epmet.dto.result.LatestCustomerResultDTO; import com.epmet.entity.CustomerStaffAgencyEntity; import java.util.List; import java.util.Map; +import java.util.Set; /** * 人员-机关单位关系表 @@ -151,4 +149,14 @@ public interface CustomerStaffAgencyService extends BaseService getAgencyStaffs(AgencyIdFormDTO agencyIdFormDTO); + + /** + * 按组织架构选择发消息时, 查询出组织|部门|网格的人,去重 + * + * @param formDTO + * @return java.util.Set + * @author yinzuomei + * @date 2021/8/19 1:41 下午 + */ + Set queryOrgStaffs(OrgStaffFormDTO formDTO); } \ No newline at end of file diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/StaffOrgRelationService.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/StaffOrgRelationService.java new file mode 100644 index 0000000000..ce5d6ba496 --- /dev/null +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/StaffOrgRelationService.java @@ -0,0 +1,95 @@ +/** + * 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.service; + +import com.epmet.commons.mybatis.service.BaseService; +import com.epmet.commons.tools.page.PageData; +import com.epmet.dto.StaffOrgRelationDTO; +import com.epmet.entity.StaffOrgRelationEntity; + +import java.util.List; +import java.util.Map; + +/** + * 工作人员注册组织关系表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2021-08-19 + */ +public interface StaffOrgRelationService extends BaseService { + + /** + * 默认分页 + * + * @param params + * @return PageData + * @author generator + * @date 2021-08-19 + */ + PageData page(Map params); + + /** + * 默认查询 + * + * @param params + * @return java.util.List + * @author generator + * @date 2021-08-19 + */ + List list(Map params); + + /** + * 单条查询 + * + * @param id + * @return StaffOrgRelationDTO + * @author generator + * @date 2021-08-19 + */ + StaffOrgRelationDTO get(String id); + + /** + * 默认保存 + * + * @param dto + * @return void + * @author generator + * @date 2021-08-19 + */ + void save(StaffOrgRelationDTO dto); + + /** + * 默认更新 + * + * @param dto + * @return void + * @author generator + * @date 2021-08-19 + */ + void update(StaffOrgRelationDTO dto); + + /** + * 批量删除 + * + * @param ids + * @return void + * @author generator + * @date 2021-08-19 + */ + void delete(String[] ids); +} \ No newline at end of file diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/StaffService.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/StaffService.java index 5ac3ac549a..e399369dee 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/StaffService.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/StaffService.java @@ -113,4 +113,10 @@ public interface StaffService { * @date 2021/8/4 3:38 下午 */ String staffName(String userId); + + /** + * 【通讯录】人员添加v2 + * @author sun + */ + Result addStaffV2(AddStaffV2FromDTO fromDTO); } diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerStaffAgencyServiceImpl.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerStaffAgencyServiceImpl.java index 7b6a784a83..c30abd4025 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerStaffAgencyServiceImpl.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerStaffAgencyServiceImpl.java @@ -44,10 +44,7 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; -import java.util.Map; +import java.util.*; /** * 人员-机关单位关系表 @@ -234,4 +231,23 @@ public class CustomerStaffAgencyServiceImpl extends BaseServiceImpl + * @author yinzuomei + * @date 2021/8/19 1:41 下午 + */ + @Override + public Set queryOrgStaffs(OrgStaffFormDTO formDTO) { + Set agencyUserIds=customerStaffAgencyDao.selectAgencyStaffs(formDTO.getCustomerId(),formDTO.getAgencyIds()); + Set deptUserIds=customerStaffAgencyDao.selectDeptStaffs(formDTO.getCustomerId(),formDTO.getDeptIds()); + Set gridUserIds=customerStaffAgencyDao.selectGridStaffs(formDTO.getCustomerId(),formDTO.getGridIds()); + Set result=new LinkedHashSet(); + result.addAll(agencyUserIds); + result.addAll(deptUserIds); + result.addAll(gridUserIds); + return result; + } } \ No newline at end of file diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/StaffOrgRelationServiceImpl.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/StaffOrgRelationServiceImpl.java new file mode 100644 index 0000000000..a4e528a1cc --- /dev/null +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/StaffOrgRelationServiceImpl.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.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; +import com.epmet.commons.tools.constant.FieldConstant; +import com.epmet.commons.tools.page.PageData; +import com.epmet.commons.tools.utils.ConvertUtils; +import com.epmet.dao.StaffOrgRelationDao; +import com.epmet.dto.StaffOrgRelationDTO; +import com.epmet.entity.StaffOrgRelationEntity; +import com.epmet.service.StaffOrgRelationService; +import org.apache.commons.lang3.StringUtils; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.util.Arrays; +import java.util.List; +import java.util.Map; + +/** + * 工作人员注册组织关系表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2021-08-19 + */ +@Service +public class StaffOrgRelationServiceImpl extends BaseServiceImpl implements StaffOrgRelationService { + + + @Override + public PageData page(Map params) { + IPage page = baseDao.selectPage( + getPage(params, FieldConstant.CREATED_TIME, false), + getWrapper(params) + ); + return getPageData(page, StaffOrgRelationDTO.class); + } + + @Override + public List list(Map params) { + List entityList = baseDao.selectList(getWrapper(params)); + + return ConvertUtils.sourceToTarget(entityList, StaffOrgRelationDTO.class); + } + + private QueryWrapper getWrapper(Map params){ + String id = (String)params.get(FieldConstant.ID_HUMP); + + QueryWrapper wrapper = new QueryWrapper<>(); + wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id); + + return wrapper; + } + + @Override + public StaffOrgRelationDTO get(String id) { + StaffOrgRelationEntity entity = baseDao.selectById(id); + return ConvertUtils.sourceToTarget(entity, StaffOrgRelationDTO.class); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void save(StaffOrgRelationDTO dto) { + StaffOrgRelationEntity entity = ConvertUtils.sourceToTarget(dto, StaffOrgRelationEntity.class); + insert(entity); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void update(StaffOrgRelationDTO dto) { + StaffOrgRelationEntity entity = ConvertUtils.sourceToTarget(dto, StaffOrgRelationEntity.class); + updateById(entity); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void delete(String[] ids) { + // 逻辑删除(@TableLogic 注解) + baseDao.deleteBatchIds(Arrays.asList(ids)); + } + +} \ No newline at end of file diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/StaffServiceImpl.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/StaffServiceImpl.java index ec8ea004aa..3aaa7a5484 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/StaffServiceImpl.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/StaffServiceImpl.java @@ -6,16 +6,20 @@ import com.epmet.commons.tools.exception.RenException; import com.epmet.commons.tools.redis.RedisKeys; import com.epmet.commons.tools.redis.RedisUtils; import com.epmet.commons.tools.security.dto.TokenDto; +import com.epmet.commons.tools.utils.ConvertUtils; import com.epmet.commons.tools.utils.Result; +import com.epmet.constant.CustomerAgencyConstant; +import com.epmet.dao.CustomerAgencyDao; import com.epmet.dao.CustomerStaffAgencyDao; import com.epmet.dto.*; import com.epmet.dto.form.*; import com.epmet.dto.result.*; -import com.epmet.entity.CustomerAgencyEntity; -import com.epmet.entity.CustomerStaffAgencyEntity; +import com.epmet.entity.*; import com.epmet.feign.*; import com.epmet.service.*; import org.apache.commons.lang3.StringUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @@ -31,6 +35,7 @@ import java.util.stream.Collectors; */ @Service public class StaffServiceImpl implements StaffService { + private static final Logger logger = LoggerFactory.getLogger(StaffServiceImpl.class); @Autowired private EpmetUserFeignClient epmetUserFeignClient; @Autowired @@ -55,6 +60,14 @@ public class StaffServiceImpl implements StaffService { private RedisUtils redisUtils; @Autowired private CustomerStaffAgencyDao customerStaffAgencyDao; + @Autowired + private com.epmet.dao.CustomerAgencyDao customerAgencyDao; + @Autowired + private CustomerStaffDepartmentService customerStaffDepartmentService; + @Autowired + private CustomerStaffGridService customerStaffGridService; + @Autowired + private StaffOrgRelationService staffOrgRelationService; @Override public Result getStaffInfoForHome(StaffsInAgencyFromDTO fromDTO) { @@ -301,4 +314,84 @@ public class StaffServiceImpl implements StaffService { String result = agencyName.concat(staffBasicInfo.getData().getRealName()); return result; } + + /** + * 【通讯录】人员添加v2 + * @author sun + */ + @Override + @Transactional(rollbackFor = Exception.class) + public Result addStaffV2(AddStaffV2FromDTO fromDTO) { + //1.根据新增人员类型判断查询机关信息 + OrgResultDTO orgDTO = customerAgencyDao.selectAgencyDetail(fromDTO.getOrgId(), fromDTO.getOrgType()); + if (null == orgDTO) { + logger.error(String.format("工作人员新增,根据新增人员组织类型未查询到相关组织信息,orgId->%s,orgType->%s", fromDTO.getOrgId(), fromDTO.getOrgType())); + throw new RenException("根据新增人员组织类型未查询到相关组织信息"); + } + + //2.调用user服务,新增用户信息 + StaffSubmitFromDTO submitDTO = ConvertUtils.sourceToTarget(fromDTO, StaffSubmitFromDTO.class); + submitDTO.setAgencyId(fromDTO.getOrgId()); + Result result = epmetUserFeignClient.addStaff(submitDTO); + if (!result.success()) { + if (result.getCode() != EpmetErrorCode.SERVER_ERROR.getCode()) { + return new Result().error(result.getCode(), result.getMsg()); + } + return new Result().error(EpmetErrorCode.STAFF_ADD_FAILED.getCode(), EpmetErrorCode.STAFF_ADD_FAILED.getMsg()); + } + + //3.人员机关表总人数加一、关系表新增关系数据 + //人员机关关系表 + CustomerStaffAgencyEntity customerStaffAgencyEntity = new CustomerStaffAgencyEntity(); + customerStaffAgencyEntity.setCustomerId(fromDTO.getCustomerId()); + customerStaffAgencyEntity.setUserId(result.getData().getUserId()); + customerStaffAgencyEntity.setAgencyId(orgDTO.getAgencyId()); + customerStaffAgencyService.insert(customerStaffAgencyEntity); + //机关总人数加一 + CustomerAgencyEntity agencyEntity = new CustomerAgencyEntity(); + agencyEntity.setId(orgDTO.getAgencyId()); + agencyEntity.setTotalUser(orgDTO.getTotalUser() + 1); + customerAgencyService.updateById(agencyEntity); + + //4.部门、网格主表、关系表修改、新增数据 + if ("dept".equals(fromDTO.getOrgType())) { + CustomerStaffDepartmentEntity dept = new CustomerStaffDepartmentEntity(); + dept.setCustomerId(fromDTO.getCustomerId()); + dept.setUserId(result.getData().getUserId()); + dept.setDepartmentId(fromDTO.getOrgId()); + customerStaffDepartmentService.insert(dept); + CustomerDepartmentEntity departmentEntity = new CustomerDepartmentEntity(); + departmentEntity.setId(fromDTO.getOrgId()); + departmentEntity.setTotalUser(orgDTO.getDeptTotalUser() + 1); + customerDepartmentService.updateById(departmentEntity); + } + if ("grid".equals(fromDTO.getOrgType())) { + CustomerStaffGridEntity grid = new CustomerStaffGridEntity(); + grid.setCustomerId(fromDTO.getCustomerId()); + grid.setUserId(result.getData().getUserId()); + grid.setGridId(fromDTO.getOrgId()); + customerStaffGridService.insert(grid); + CustomerGridEntity gridEntity = new CustomerGridEntity(); + gridEntity.setId(fromDTO.getOrgId()); + gridEntity.setTotalUser(orgDTO.getGridTotalUser() + 1); + customerGridService.updateById(gridEntity); + } + + //5.工作人员注册组织关系表新增数据 + StaffOrgRelationEntity staffOrgRelationEntity = new StaffOrgRelationEntity(); + staffOrgRelationEntity.setCustomerId(fromDTO.getCustomerId()); + if("agency".equals(fromDTO.getOrgType())){ + staffOrgRelationEntity.setPids(("".equals(orgDTO.getPids()) ? "" : orgDTO.getPids())); + }else { + staffOrgRelationEntity.setPids(("".equals(orgDTO.getPids()) ? "" : orgDTO.getPids() + ":") + orgDTO.getAgencyId()); + } + staffOrgRelationEntity.setStaffId(result.getData().getUserId()); + staffOrgRelationEntity.setOrgId(fromDTO.getOrgId()); + staffOrgRelationEntity.setOrgType(fromDTO.getOrgType()); + staffOrgRelationService.insert(staffOrgRelationEntity); + + return new Result(); + } + + } diff --git a/epmet-module/gov-org/gov-org-server/src/main/resources/db/migration/V0.0.6__add_staff_org_relation.sql b/epmet-module/gov-org/gov-org-server/src/main/resources/db/migration/V0.0.6__add_staff_org_relation.sql new file mode 100644 index 0000000000..c9cb535ea7 --- /dev/null +++ b/epmet-module/gov-org/gov-org-server/src/main/resources/db/migration/V0.0.6__add_staff_org_relation.sql @@ -0,0 +1,35 @@ +CREATE TABLE `staff_org_relation` ( + `ID` varchar(64) NOT NULL COMMENT 'ID', + `CUSTOMER_ID` varchar(64) NOT NULL COMMENT '客户ID', + `PIDS` varchar(1024) NOT NULL COMMENT '所有上级组织机构ID(以英文:隔开)部门/网格得拼上所属组织Id', + `STAFF_ID` varchar(64) NOT NULL COMMENT '工作人员Id', + `ORG_ID` varchar(64) NOT NULL COMMENT '工作人员添加入口Id(agencyId;deptId;gridId)', + `ORG_TYPE` varchar(30) NOT NULL COMMENT '工作人员添加入口类型(组织:agency;部门:dept;网格:gridId)', + `DEL_FLAG` varchar(1) NOT NULL COMMENT '删除标识', + `REVISION` int(10) NOT NULL COMMENT '乐观锁', + `CREATED_BY` varchar(32) NOT NULL COMMENT '创建人', + `CREATED_TIME` datetime NOT NULL COMMENT '创建时间', + `UPDATED_BY` varchar(32) NOT NULL COMMENT '更新人', + `UPDATED_TIME` datetime NOT NULL COMMENT '更新时间', + PRIMARY KEY (`ID`) USING BTREE, + KEY `staffid` (`STAFF_ID`) USING BTREE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 ROW_FORMAT=DYNAMIC COMMENT='工作人员注册组织关系表'; + +INSERT INTO staff_org_relation SELECT + MD5(UUID()), + cs.CUSTOMER_ID, + ca.pids, + cs.USER_ID, + ca.id, + 'agency', + '0', + '0', + 'APP_USER', + NOW(), + 'APP_USER', + NOW() +FROM + customer_staff_agency cs +INNER JOIN customer_agency ca ON cs.AGENCY_ID = ca.ID +WHERE cs.DEL_FLAG = '0'; + diff --git a/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerAgencyDao.xml b/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerAgencyDao.xml index 58d2fd628e..a30207d922 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerAgencyDao.xml +++ b/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerAgencyDao.xml @@ -441,4 +441,67 @@ AND ca.pid =#{parentAgencyId} + + + \ No newline at end of file diff --git a/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerStaffAgencyDao.xml b/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerStaffAgencyDao.xml index b7559668a8..0235999cb4 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerStaffAgencyDao.xml +++ b/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerStaffAgencyDao.xml @@ -162,4 +162,54 @@ WHERE sa.DEL_FLAG = 0 AND sa.USER_ID = #{staffId} + + + + + + + \ No newline at end of file diff --git a/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/StaffOrgRelationDao.xml b/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/StaffOrgRelationDao.xml new file mode 100644 index 0000000000..350dae73ac --- /dev/null +++ b/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/StaffOrgRelationDao.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file 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-server/src/main/java/com/epmet/redis/RegisterRelationRedis.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/StaffOrgsDTO.java similarity index 56% rename from epmet-user/epmet-user-server/src/main/java/com/epmet/redis/RegisterRelationRedis.java rename to epmet-user/epmet-user-client/src/main/java/com/epmet/dto/StaffOrgsDTO.java index 5a9abca115..ae9e0f7a9a 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/redis/RegisterRelationRedis.java +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/StaffOrgsDTO.java @@ -15,33 +15,40 @@ * along with this program. If not, see . */ -package com.epmet.redis; +package com.epmet.dto; -import com.epmet.commons.tools.redis.RedisUtils; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Component; +import lombok.Data; + +import java.io.Serializable; +import java.util.List; /** - * 注册关系表 用于统计客户网格的注册居民数 - * - * @author generator generator@elink-cn.com - * @since v1.0.0 2020-03-30 + * desc: 工作人员所属的组织关系 + * @date 2021/8/19 10:07 上午 */ -@Component -public class RegisterRelationRedis { - @Autowired - private RedisUtils redisUtils; - - public void delete(Object[] ids) { - - } - - public void set(){ - - } - - public String get(String id){ - return null; - } - -} \ No newline at end of file +@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-client/src/main/java/com/epmet/dto/form/EnableStaffFormDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/EnableStaffFormDTO.java new file mode 100644 index 0000000000..beb2fae20f --- /dev/null +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/EnableStaffFormDTO.java @@ -0,0 +1,25 @@ +package com.epmet.dto.form; + +import lombok.Data; +import lombok.NoArgsConstructor; + +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotEmpty; +import java.io.Serializable; +import java.util.List; + +/** + * @author sun + * @dscription 【通讯录】工作人员解禁-接口入参 + */ +@NoArgsConstructor +@Data +public class EnableStaffFormDTO implements Serializable { + + private static final long serialVersionUID = -5220529162950147825L; + /** + * 被解禁用户Id + */ + private String staffId; + +} diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/RoleStaffIdFormDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/RoleStaffIdFormDTO.java new file mode 100644 index 0000000000..7973e65bd1 --- /dev/null +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/RoleStaffIdFormDTO.java @@ -0,0 +1,24 @@ +package com.epmet.dto.form; + +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotEmpty; +import java.io.Serializable; +import java.util.Set; + +/** + * @Description 查询角色对应的工作人员集合 去重 + * @Author yinzuomei + * @Date 2021/8/19 11:19 上午 + */ +@Data +public class RoleStaffIdFormDTO implements Serializable { + public interface AddUserInternalGroup { + } + @NotBlank(message = "客户id不能为空",groups = AddUserInternalGroup.class) + private String customerId; + @NotEmpty(message = "角色id不能为空",groups = AddUserInternalGroup.class) + private Set roleIds; +} + diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/feign/EpmetUserOpenFeignClient.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/feign/EpmetUserOpenFeignClient.java index d764eb993a..7dd60fed83 100644 --- a/epmet-user/epmet-user-client/src/main/java/com/epmet/feign/EpmetUserOpenFeignClient.java +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/feign/EpmetUserOpenFeignClient.java @@ -14,6 +14,7 @@ import org.springframework.web.bind.annotation.*; import java.util.List; import java.util.Map; +import java.util.Set; /** * 本服务对外开放的API,其他服务通过引用此client调用该服务 @@ -587,15 +588,6 @@ public interface EpmetUserOpenFeignClient { @PostMapping("/epmetuser/staffpatrol/patroltrack") Result> patrolTrack(@RequestBody PatrolTrackFormDTO formDTO); - /** - * @Description 查询角色 - * @Param formDTO - * @author zxc - * @date 2021/6/15 3:03 下午 - */ - @PostMapping("/epmetuser/staffrole/getroles") - Result getUserRoles(@RequestBody CustomerAgencyUserRoleFormDTO formDTO); - /** * 结束巡查 定时任务 * @author zhaoqifeng @@ -623,4 +615,15 @@ public interface EpmetUserOpenFeignClient { */ @PostMapping("/epmetuser/statsstaffpatrolrecorddaily/patrolcount") Result patrolCount(@RequestBody PatrolCountFormDTO formDTO); + + /** + * 根据角色,查询里面的人,去重 + * + * @param formDTO + * @return com.epmet.commons.tools.utils.Result> + * @author yinzuomei + * @date 2021/8/19 11:09 上午 + */ + @PostMapping("/epmetuser/staffrole/queryRoleStaffIds") + Result> queryRoleStaffIds(@RequestBody RoleStaffIdFormDTO formDTO); } diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/feign/fallback/EpmetUserOpenFeignClientFallback.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/feign/fallback/EpmetUserOpenFeignClientFallback.java index ea37ce19af..e08ad9f945 100644 --- a/epmet-user/epmet-user-client/src/main/java/com/epmet/feign/fallback/EpmetUserOpenFeignClientFallback.java +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/feign/fallback/EpmetUserOpenFeignClientFallback.java @@ -8,10 +8,10 @@ import com.epmet.dto.*; import com.epmet.dto.form.*; import com.epmet.dto.result.*; import com.epmet.feign.EpmetUserOpenFeignClient; -import org.springframework.stereotype.Component; import java.util.List; import java.util.Map; +import java.util.Set; /** * 本服务对外开放的API,其他服务通过引用此client调用该服务 @@ -404,11 +404,6 @@ public class EpmetUserOpenFeignClientFallback implements EpmetUserOpenFeignClien return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "patrolTrack", formDTO); } - @Override - public Result getUserRoles(CustomerAgencyUserRoleFormDTO formDTO) { - return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "getUserRoles", formDTO); - } - /** * 结束巡查 定时任务 * @@ -437,4 +432,17 @@ public class EpmetUserOpenFeignClientFallback implements EpmetUserOpenFeignClien public Result patrolCount(PatrolCountFormDTO formDTO) { return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "patrolCount", formDTO); } + + /** + * 根据角色,查询里面的人,去重 + * + * @param formDTO + * @return com.epmet.commons.tools.utils.Result> + * @author yinzuomei + * @date 2021/8/19 11:09 上午 + */ + @Override + public Result> queryRoleStaffIds(RoleStaffIdFormDTO formDTO) { + return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "queryRoleStaffIds", formDTO); + } } diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/CustomerStaffController.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/CustomerStaffController.java index cb9673ccf6..f467d60712 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/CustomerStaffController.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/CustomerStaffController.java @@ -18,6 +18,10 @@ package com.epmet.controller; import com.epmet.commons.tools.annotation.LoginUser; +import com.epmet.commons.tools.annotation.RequirePermission; +import com.epmet.commons.tools.enums.RequirePermissionEnum; +import com.epmet.commons.tools.exception.EpmetErrorCode; +import com.epmet.commons.tools.exception.RenException; import com.epmet.commons.tools.page.PageData; import com.epmet.commons.tools.security.dto.TokenDto; import com.epmet.commons.tools.security.user.LoginUserUtil; @@ -428,5 +432,19 @@ public class CustomerStaffController { return new Result>().ok(staffs); } + /** + * 【通讯录】工作人员解禁 + * @author sun + */ + @PostMapping("enablestaff") + @RequirePermission(requirePermission = RequirePermissionEnum.ORG_STAFF_ENABLE) + public Result enableStaff(@LoginUser TokenDto tokenDto, @RequestBody EnableStaffFormDTO fromDTO){ + if (tokenDto.getUserId().equals(fromDTO.getStaffId())) { + throw new RenException("工作人员自己不能解禁自己"); + } + customerStaffService.enableStaff(fromDTO); + return new Result(); + } + } diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/StaffRoleController.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/StaffRoleController.java index 969eae7e66..998c3eba7e 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/StaffRoleController.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/StaffRoleController.java @@ -4,27 +4,18 @@ import cn.hutool.core.collection.CollectionUtil; import com.epmet.commons.mybatis.entity.DataScope; import com.epmet.commons.tools.utils.Result; import com.epmet.commons.tools.validator.ValidatorUtils; -import com.epmet.dto.CustomerAgencyUserRoleDTO; import com.epmet.dto.GovStaffRoleDTO; import com.epmet.dto.StaffRoleDTO; -import com.epmet.dto.form.CommonUserFormDTO; -import com.epmet.dto.form.CustomerRoleFormDTO; -import com.epmet.dto.form.RolesUsersListFormDTO; -import com.epmet.dto.form.StaffRoleFormDTO; -import com.epmet.dto.result.*; import com.epmet.dto.form.*; +import com.epmet.dto.result.*; import com.epmet.entity.GovStaffRoleEntity; import com.epmet.service.GovStaffRoleService; import com.epmet.service.StaffRoleService; -import oracle.jdbc.proxy.annotation.Post; import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; +import java.util.*; /** * @return 工作人员相关api @@ -192,26 +183,16 @@ public class StaffRoleController { } /** - * @Description 补全缓存 工作人员角色 - * @Param - * @author zxc - * @date 2021/6/15 2:05 下午 - */ - @PostMapping("repairstaffrolecache") - public Result repairStaffRoleCache(){ - staffRoleService.repairStaffRoleCache(); - return new Result(); - } - - /** - * @Description 查询角色 - * @Param formDTO - * @author zxc - * @date 2021/6/15 3:03 下午 + * 根据角色,查询里面的人,去重 + * + * @param formDTO + * @return com.epmet.commons.tools.utils.Result> + * @author yinzuomei + * @date 2021/8/19 11:14 上午 */ - @PostMapping("getroles") - public Result getUserRoles(@RequestBody CustomerAgencyUserRoleFormDTO formDTO){ - ValidatorUtils.validateEntity(formDTO, CustomerAgencyUserRoleFormDTO.CustomerAgencyUserRoleForm.class); - return new Result().ok(staffRoleService.getUserRoles(formDTO)); + @PostMapping("queryRoleStaffIds") + Result> queryRoleStaffIds(@RequestBody RoleStaffIdFormDTO formDTO){ + ValidatorUtils.validateEntity(formDTO,RoleStaffIdFormDTO.AddUserInternalGroup.class); + return new Result>().ok(staffRoleService.queryRoleStaffIds(formDTO)); } } diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/StaffRoleDao.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/StaffRoleDao.java index da289c6308..876634717b 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/StaffRoleDao.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/StaffRoleDao.java @@ -17,7 +17,6 @@ package com.epmet.dao; -import com.epmet.commons.mybatis.annotation.DataFilter; import com.epmet.commons.mybatis.dao.BaseDao; import com.epmet.commons.mybatis.entity.DataScope; import com.epmet.dto.StaffRoleDTO; @@ -30,6 +29,7 @@ import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; import java.util.List; +import java.util.Set; /** * 工作人员-角色关系表 @@ -152,4 +152,15 @@ public interface StaffRoleDao extends BaseDao { * @date 2021/6/15 5:54 下午 */ List selectAllUserRoles(); + + /** + * 根据角色,查询里面的人,去重 + * + * @param roleIds + * @param customerId + * @return java.util.Set + * @author yinzuomei + * @date 2021/8/19 11:16 上午 + */ + Set selectRoleStaffIds(@Param("customerId") String customerId,@Param("roleIds") Set roleIds); } diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/redis/StaffRoleRedis.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/redis/StaffRoleRedis.java deleted file mode 100644 index 2086c6c9e2..0000000000 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/redis/StaffRoleRedis.java +++ /dev/null @@ -1,86 +0,0 @@ -/** - * 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.RedisUtils; -import com.epmet.commons.tools.utils.ConvertUtils; -import com.epmet.dto.CustomerAgencyUserRoleDTO; -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 StaffRoleRedis { - @Autowired - private RedisUtils redisUtils; - - public void delete(Object[] ids) { - - } - - public void set(){ - - } - - public String get(String id){ - return null; - } - - /** - * @Description 查询工作人员的角色 - * @Param customerId - * @Param userId - * @author zxc - * @date 2021/6/15 3:20 下午 - */ - public CustomerAgencyUserRoleDTO getRole(String customerId, String userId){ - String key = "epmet:staffrole:"+customerId+":"+userId; - Map roleMap = redisUtils.hGetAll(key); - boolean empty = roleMap.isEmpty(); - if (!empty){ - CustomerAgencyUserRoleDTO result = ConvertUtils.mapToEntity(roleMap, CustomerAgencyUserRoleDTO.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 userId,CustomerAgencyUserRoleDTO dto){ - String key = "epmet:staffrole:"+customerId+":"+userId; - Map map = BeanUtil.beanToMap(dto, false, true); - redisUtils.hMSet(key, map,NOT_EXPIRE); - } - -} \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/redis/UserAdviceImgRedis.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/redis/UserAdviceImgRedis.java deleted file mode 100644 index 5c409ddb94..0000000000 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/redis/UserAdviceImgRedis.java +++ /dev/null @@ -1,47 +0,0 @@ -/** - * 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 com.epmet.commons.tools.redis.RedisUtils; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Component; - -/** - * 用户建议图片 - * - * @author qu qu@elink-cn.com - * @since v1.0.0 2020-11-04 - */ -@Component -public class UserAdviceImgRedis { - @Autowired - private RedisUtils redisUtils; - - public void delete(Object[] ids) { - - } - - public void set(){ - - } - - public String get(String id){ - return null; - } - -} \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/redis/UserAdviceRedis.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/redis/UserAdviceRedis.java deleted file mode 100644 index d35e8427b9..0000000000 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/redis/UserAdviceRedis.java +++ /dev/null @@ -1,47 +0,0 @@ -/** - * 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 com.epmet.commons.tools.redis.RedisUtils; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Component; - -/** - * user_advice - * - * @author qu qu@elink-cn.com - * @since v1.0.0 2020-11-06 - */ -@Component -public class UserAdviceRedis { - @Autowired - private RedisUtils redisUtils; - - public void delete(Object[] ids) { - - } - - public void set(){ - - } - - public String get(String id){ - return null; - } - -} \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/redis/UserInvitationRedis.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/redis/UserInvitationRedis.java deleted file mode 100644 index 766bac411a..0000000000 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/redis/UserInvitationRedis.java +++ /dev/null @@ -1,47 +0,0 @@ -/** - * 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 com.epmet.commons.tools.redis.RedisUtils; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Component; - -/** - * 人员邀请关系表 记录user之间的邀请关系 - * - * @author generator generator@elink-cn.com - * @since v1.0.0 2020-03-30 - */ -@Component -public class UserInvitationRedis { - @Autowired - private RedisUtils redisUtils; - - public void delete(Object[] ids) { - - } - - public void set(){ - - } - - public String get(String id){ - return null; - } - -} \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/redis/UserResiRegisterVisitRedis.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/redis/UserResiRegisterVisitRedis.java deleted file mode 100644 index 59c492f966..0000000000 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/redis/UserResiRegisterVisitRedis.java +++ /dev/null @@ -1,47 +0,0 @@ -/** - * 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 com.epmet.commons.tools.redis.RedisUtils; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Component; - -/** - * 用户居民端注册访问记录表 - * - * @author generator generator@elink-cn.com - * @since v1.0.0 2020-03-30 - */ -@Component -public class UserResiRegisterVisitRedis { - @Autowired - private RedisUtils redisUtils; - - public void delete(Object[] ids) { - - } - - public void set(){ - - } - - public String get(String id){ - return null; - } - -} \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/CustomerStaffService.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/CustomerStaffService.java index 7f5b43161e..74c16285e0 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/CustomerStaffService.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/CustomerStaffService.java @@ -329,4 +329,10 @@ public interface CustomerStaffService extends BaseService { * @date 2021.06.08 10:52 */ List list(String customerId, String realName, String mobile, List ids); + + /** + * 【通讯录】工作人员解禁 + * @author sun + */ + void enableStaff(EnableStaffFormDTO fromDTO); } diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/StaffRoleService.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/StaffRoleService.java index b34f90d294..e8737d7a0c 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/StaffRoleService.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/StaffRoleService.java @@ -21,17 +21,17 @@ import com.epmet.commons.mybatis.entity.DataScope; import com.epmet.commons.mybatis.service.BaseService; import com.epmet.commons.tools.page.PageData; import com.epmet.commons.tools.utils.Result; -import com.epmet.dto.CustomerAgencyUserRoleDTO; import com.epmet.dto.StaffRoleDTO; import com.epmet.dto.form.CommonUserFormDTO; -import com.epmet.dto.form.CustomerAgencyUserRoleFormDTO; import com.epmet.dto.form.CustomerStaffRoleListFormDTO; +import com.epmet.dto.form.RoleStaffIdFormDTO; import com.epmet.dto.form.RolesUsersListFormDTO; import com.epmet.dto.result.*; import com.epmet.entity.StaffRoleEntity; import java.util.List; import java.util.Map; +import java.util.Set; /** * 工作人员-角色关系表 @@ -168,18 +168,12 @@ public interface StaffRoleService extends BaseService { List staffGridRole(List forms); /** - * @Description 查询角色 - * @Param formDTO - * @author zxc - * @date 2021/6/15 3:03 下午 - */ - CustomerAgencyUserRoleDTO getUserRoles(CustomerAgencyUserRoleFormDTO formDTO); - - /** - * @Description 补全缓存 工作人员角色 - * @Param - * @author zxc - * @date 2021/6/15 2:05 下午 + * 根据角色,查询里面的人,去重 + * + * @param formDTO + * @return java.util.Set + * @author yinzuomei + * @date 2021/8/19 11:14 上午 */ - void repairStaffRoleCache(); -} \ No newline at end of file + Set queryRoleStaffIds(RoleStaffIdFormDTO formDTO); +} diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/CustomerStaffServiceImpl.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/CustomerStaffServiceImpl.java index 8a8764e5b0..9405f9a4a9 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/CustomerStaffServiceImpl.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/CustomerStaffServiceImpl.java @@ -18,7 +18,6 @@ package com.epmet.service.impl; import com.alibaba.fastjson.JSON; -import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.epmet.commons.mybatis.entity.DataScope; @@ -30,6 +29,7 @@ import com.epmet.commons.tools.exception.EpmetErrorCode; import com.epmet.commons.tools.exception.ExceptionUtils; import com.epmet.commons.tools.exception.RenException; import com.epmet.commons.tools.page.PageData; +import com.epmet.commons.tools.redis.common.CustomerStaffRedis; import com.epmet.commons.tools.security.password.PasswordUtils; import com.epmet.commons.tools.utils.ConvertUtils; import com.epmet.commons.tools.utils.CpUserDetailRedis; @@ -51,14 +51,11 @@ import com.epmet.entity.UserEntity; import com.epmet.feign.AuthFeignClient; import com.epmet.feign.GovOrgOpenFeignClient; import com.epmet.feign.OperCrmOpenFeignClient; -import com.epmet.redis.CustomerStaffRedis; -import com.epmet.redis.StaffRoleRedis; import com.epmet.service.CustomerStaffService; import com.epmet.service.GovStaffRoleService; import com.epmet.service.StaffRoleService; import com.epmet.service.UserService; import com.epmet.util.ModuleConstant; -import kotlin.jvm.internal.Lambda; import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang3.StringUtils; import org.apache.logging.log4j.LogManager; @@ -83,8 +80,6 @@ import java.util.stream.Collectors; public class CustomerStaffServiceImpl extends BaseServiceImpl implements CustomerStaffService { private Logger logger = LogManager.getLogger(getClass()); @Autowired - private CustomerStaffRedis customerStaffRedis; - @Autowired private GovStaffRoleService govStaffRoleService; @Autowired private UserService userService; @@ -104,8 +99,6 @@ public class CustomerStaffServiceImpl extends BaseServiceImpl page(Map params) { @@ -348,7 +341,7 @@ public class CustomerStaffServiceImpl extends BaseServiceImpl().ok(ConvertUtils.sourceToTarget(staffEntity, CustomerStaffDTO.class)); } @@ -421,7 +414,7 @@ public class CustomerStaffServiceImpl extends BaseServiceImpl list(String customerId, String realName, String mobile, List userIds) { return baseDao.listDTOS(customerId, realName, mobile, userIds); } + + /** + * 【通讯录】工作人员解禁 + * @author sun + */ + @Override + public void enableStaff(EnableStaffFormDTO fromDTO) { + CustomerStaffEntity customerStaffEntity = baseDao.selectByUserId(fromDTO.getStaffId()); + if (null == customerStaffEntity) { + logger.error(String.format("工作人员解禁,未查询到被解禁人信息,被解禁人Id->%s", fromDTO.getStaffId())); + throw new RenException("未查询到被解禁人信息,请核对后操作"); + } + CustomerStaffEntity staffEntity = new CustomerStaffEntity(); + staffEntity.setId(customerStaffEntity.getId()); + staffEntity.setEnableFlag(CustomerStaffConstant.ENABLE); + baseDao.updateById(staffEntity); + } + } diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/GovStaffRoleServiceImpl.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/GovStaffRoleServiceImpl.java index b359f60058..8dbac5b6b1 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/GovStaffRoleServiceImpl.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/GovStaffRoleServiceImpl.java @@ -35,7 +35,6 @@ import com.epmet.dto.form.UpGovRoleFormDTO; import com.epmet.dto.result.*; import com.epmet.entity.GovStaffRoleEntity; import com.epmet.feign.GovAccessFeignClient; -import com.epmet.redis.GovStaffRoleRedis; import com.epmet.service.GovStaffRoleService; import org.apache.commons.lang3.StringUtils; import org.slf4j.Logger; @@ -45,8 +44,6 @@ import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import java.util.*; -import java.util.concurrent.ConcurrentHashMap; -import java.util.function.Function; import java.util.stream.Collectors; /** @@ -60,9 +57,6 @@ public class GovStaffRoleServiceImpl extends BaseServiceImpl implements GridLatestService { - private Logger logger = LoggerFactory.getLogger(getClass()); - @Autowired - private GridLatestRedis gridLatestRedis; @Autowired private GridLatestDao gridLatestDao; @Autowired private UserBaseInfoRedis userBaseInfoRedis; @Autowired private UserWechatDao userWechatDao; - @Autowired - private EpmetHeartOpenFeignClient epmetHeartOpenFeignClient; @Override diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/OperUserServiceImpl.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/OperUserServiceImpl.java index 3d3e0c986e..aba125363b 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/OperUserServiceImpl.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/OperUserServiceImpl.java @@ -32,7 +32,6 @@ import com.epmet.dto.OperUserDTO; import com.epmet.entity.OperUserEntity; import com.epmet.entity.UserEntity; import com.epmet.feign.OperRoleUserFeignClient; -import com.epmet.redis.OperUserRedis; import com.epmet.service.OperUserService; import com.epmet.service.UserService; import org.apache.commons.lang3.StringUtils; @@ -53,8 +52,6 @@ import java.util.Map; @Service public class OperUserServiceImpl extends BaseServiceImpl implements OperUserService { - @Autowired - private OperUserRedis operUserRedis; @Autowired private OperUserDao operUserDao; @Autowired @@ -145,4 +142,4 @@ public class OperUserServiceImpl extends BaseServiceImpl implements RoleService { - - @Autowired - private RoleRedis roleRedis; @Autowired private UserRoleDao userRoleDao; @Autowired @@ -132,4 +128,4 @@ public class RoleServiceImpl extends BaseServiceImpl implem } return list; } -} \ No newline at end of file +} diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/StaffRoleServiceImpl.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/StaffRoleServiceImpl.java index 51f5e189b6..181b788434 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/StaffRoleServiceImpl.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/StaffRoleServiceImpl.java @@ -17,37 +17,30 @@ package com.epmet.service.impl; -import com.alibaba.fastjson.JSON; -import com.alibaba.fastjson.JSONObject; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.epmet.commons.mybatis.entity.DataScope; import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; +import com.epmet.commons.tools.constant.FieldConstant; import com.epmet.commons.tools.constant.NumConstant; import com.epmet.commons.tools.page.PageData; import com.epmet.commons.tools.utils.ConvertUtils; -import com.epmet.commons.tools.constant.FieldConstant; import com.epmet.commons.tools.utils.Result; -import com.epmet.dao.GovStaffRoleTemplateDao; import com.epmet.dao.StaffRoleDao; -import com.epmet.dto.CustomerAgencyUserRoleDTO; import com.epmet.dto.StaffRoleDTO; import com.epmet.dto.form.CommonUserFormDTO; -import com.epmet.dto.form.CustomerAgencyUserRoleFormDTO; import com.epmet.dto.form.CustomerStaffRoleListFormDTO; +import com.epmet.dto.form.RoleStaffIdFormDTO; import com.epmet.dto.form.RolesUsersListFormDTO; import com.epmet.dto.result.*; import com.epmet.entity.StaffRoleEntity; -import com.epmet.redis.StaffRoleRedis; import com.epmet.service.StaffRoleService; import org.apache.commons.lang3.StringUtils; -import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import org.springframework.util.CollectionUtils; import java.util.*; -import java.util.stream.Collectors; /** * 工作人员-角色关系表 @@ -58,12 +51,6 @@ import java.util.stream.Collectors; @Service public class StaffRoleServiceImpl extends BaseServiceImpl implements StaffRoleService { - @Autowired - private StaffRoleRedis staffRoleRedis; - - @Autowired - private GovStaffRoleTemplateDao govStaffRoleTemplateDao; - @Override public PageData page(Map params) { IPage page = baseDao.selectPage( @@ -207,64 +194,19 @@ public class StaffRoleServiceImpl extends BaseServiceImpl rolesByDB = baseDao.getRolesByDB(staffId); - if (!CollectionUtils.isEmpty(rolesByDB)) { - CustomerAgencyUserRoleDTO dto = new CustomerAgencyUserRoleDTO(); - dto.setStaffId(rolesByDB.get(NumConstant.ZERO).getStaffId()); - dto.setCustomerId(customerId); - dto.setAgencyId(rolesByDB.get(NumConstant.ZERO).getOrgId()); - Map map = new HashMap(16); - rolesByDB.forEach(l -> { - map.put(l.getRoleKey(), l.getRoleName()); - }); - dto.setRoles(map); - staffRoleRedis.setRole(customerId, staffId, dto); - return dto; - } - } - return null; - } - - /** - * @Description 补全缓存 工作人员角色 - * @Param - * @author zxc - * @date 2021/6/15 2:05 下午 + * 根据角色,查询里面的人,去重 + * + * @param formDTO + * @return java.util.Set + * @author yinzuomei + * @date 2021/8/19 11:14 上午 */ @Override - public void repairStaffRoleCache() { - // 查询所有工作人员的角色 - List allRoles = baseDao.selectAllUserRoles(); - if (!CollectionUtils.isEmpty(allRoles)){ - // 根据 userId分组【staffId】 - Map> groupByStaff = allRoles.stream().collect(Collectors.groupingBy(RepairStaffRoleCacheResultDTO::getStaffId)); - groupByStaff.forEach((userId,list) -> { - CustomerAgencyUserRoleDTO dto = new CustomerAgencyUserRoleDTO(); - String customerId = list.get(NumConstant.ZERO).getCustomerId(); - dto.setStaffId(list.get(NumConstant.ZERO).getStaffId()); - dto.setCustomerId(customerId); - dto.setAgencyId(list.get(NumConstant.ZERO).getOrgId()); - Map map = new HashMap(16); - list.forEach(l -> { - map.put(l.getRoleKey(), l.getRoleName()); - }); - dto.setRoles(map); - staffRoleRedis.setRole(customerId, userId, dto); - }); + public Set queryRoleStaffIds(RoleStaffIdFormDTO formDTO) { + if(CollectionUtils.isEmpty(formDTO.getRoleIds())){ + return Collections.EMPTY_SET; } + return baseDao.selectRoleStaffIds(formDTO.getCustomerId(),formDTO.getRoleIds()); } -} \ No newline at end of file +} diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/UserAdviceImgServiceImpl.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/UserAdviceImgServiceImpl.java index cc8a164969..16f7ac6089 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/UserAdviceImgServiceImpl.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/UserAdviceImgServiceImpl.java @@ -20,16 +20,14 @@ package com.epmet.service.impl; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; +import com.epmet.commons.tools.constant.FieldConstant; import com.epmet.commons.tools.page.PageData; import com.epmet.commons.tools.utils.ConvertUtils; -import com.epmet.commons.tools.constant.FieldConstant; import com.epmet.dao.UserAdviceImgDao; import com.epmet.dto.UserAdviceImgDTO; import com.epmet.entity.UserAdviceImgEntity; -import com.epmet.redis.UserAdviceImgRedis; import com.epmet.service.UserAdviceImgService; import org.apache.commons.lang3.StringUtils; -import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @@ -46,9 +44,6 @@ import java.util.Map; @Service public class UserAdviceImgServiceImpl extends BaseServiceImpl implements UserAdviceImgService { - @Autowired - private UserAdviceImgRedis userAdviceImgRedis; - @Override public PageData page(Map params) { IPage page = baseDao.selectPage( diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/UserAdviceServiceImpl.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/UserAdviceServiceImpl.java index 9fb3f13947..bdf908849f 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/UserAdviceServiceImpl.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/UserAdviceServiceImpl.java @@ -37,7 +37,6 @@ import com.epmet.commons.tools.utils.Result; import com.epmet.commons.tools.utils.ScanContentUtils; import com.epmet.constant.UserAdviceConstant; import com.epmet.dao.UserAdviceDao; -import com.epmet.dto.CustomerAgencyDTO; import com.epmet.dto.CustomerDTO; import com.epmet.dto.CustomerGridDTO; import com.epmet.dto.UserAdviceDTO; @@ -47,7 +46,6 @@ import com.epmet.entity.UserAdviceEntity; import com.epmet.entity.UserAdviceImgEntity; import com.epmet.feign.GovOrgOpenFeignClient; import com.epmet.feign.OperCrmOpenFeignClient; -import com.epmet.redis.UserAdviceRedis; import com.epmet.service.UserAdviceImgService; import com.epmet.service.UserAdviceService; import com.epmet.service.UserResiInfoService; @@ -61,8 +59,6 @@ import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; -import java.text.ParseException; -import java.text.SimpleDateFormat; import java.util.*; /** @@ -75,8 +71,6 @@ import java.util.*; public class UserAdviceServiceImpl extends BaseServiceImpl implements UserAdviceService { private Logger logger = LogManager.getLogger(UserAdviceServiceImpl.class); - @Autowired - private UserAdviceRedis userAdviceRedis; @Autowired private UserAdviceImgService userAdviceImgService; diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/UserInvitationServiceImpl.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/UserInvitationServiceImpl.java index 30e26b0a98..9655e7ab65 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/UserInvitationServiceImpl.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/UserInvitationServiceImpl.java @@ -20,18 +20,16 @@ package com.epmet.service.impl; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; +import com.epmet.commons.tools.constant.FieldConstant; import com.epmet.commons.tools.page.PageData; import com.epmet.commons.tools.utils.ConvertUtils; -import com.epmet.commons.tools.constant.FieldConstant; import com.epmet.commons.tools.utils.Result; import com.epmet.dao.UserInvitationDao; import com.epmet.dto.UserInvitationDTO; import com.epmet.dto.form.UserInvitationFormDTO; import com.epmet.entity.UserInvitationEntity; -import com.epmet.redis.UserInvitationRedis; import com.epmet.service.UserInvitationService; import org.apache.commons.lang3.StringUtils; -import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import org.springframework.util.CollectionUtils; @@ -50,9 +48,6 @@ import java.util.Map; @Service public class UserInvitationServiceImpl extends BaseServiceImpl implements UserInvitationService { - @Autowired - private UserInvitationRedis userInvitationRedis; - @Override public PageData page(Map params) { IPage page = baseDao.selectPage( diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/UserResiRegisterVisitServiceImpl.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/UserResiRegisterVisitServiceImpl.java index 1182611384..ecab05eaf2 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/UserResiRegisterVisitServiceImpl.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/UserResiRegisterVisitServiceImpl.java @@ -19,11 +19,8 @@ package com.epmet.service.impl; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; -import com.baomidou.mybatisplus.core.toolkit.IdWorker; import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; import com.epmet.commons.tools.constant.FieldConstant; -import com.epmet.commons.tools.constant.NumConstant; -import com.epmet.commons.tools.exception.EpmetErrorCode; import com.epmet.commons.tools.page.PageData; import com.epmet.commons.tools.utils.ConvertUtils; import com.epmet.commons.tools.utils.Result; @@ -34,9 +31,7 @@ import com.epmet.dto.UserResiRegisterVisitDTO; import com.epmet.dto.form.ResiRegisterFormDTO; import com.epmet.dto.form.VerificationCodeFormDTO; import com.epmet.dto.result.ResiRegisterResultDTO; -import com.epmet.entity.UserResiInfoEntity; import com.epmet.entity.UserResiRegisterVisitEntity; -import com.epmet.redis.UserResiRegisterVisitRedis; import com.epmet.service.UserResiRegisterVisitService; import org.apache.commons.lang3.StringUtils; import org.slf4j.Logger; @@ -61,8 +56,6 @@ public class UserResiRegisterVisitServiceImpl extends BaseServiceImpl implements UserRoleService { - @Autowired - private UserRoleRedis userRoleRedis; @Autowired private RoleService roleService; diff --git a/epmet-user/epmet-user-server/src/main/resources/mapper/StaffRoleDao.xml b/epmet-user/epmet-user-server/src/main/resources/mapper/StaffRoleDao.xml index 98328339b5..05ce74c660 100644 --- a/epmet-user/epmet-user-server/src/main/resources/mapper/StaffRoleDao.xml +++ b/epmet-user/epmet-user-server/src/main/resources/mapper/StaffRoleDao.xml @@ -235,4 +235,22 @@ LEFT JOIN gov_staff_role gsr ON gsr.ID = sr.ROLE_ID AND gsr.DEL_FLAG = 0 WHERE sr.DEL_FLAG = 0 + + +