From 52a44050e01ce97a51edb5d436e17cb4a5190f14 Mon Sep 17 00:00:00 2001 From: wangchao Date: Thu, 30 Apr 2020 01:24:03 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=A1=E6=A0=B8=E5=BB=BA=E7=BE=A4=E5=90=8E?= =?UTF-8?q?=E5=8F=91=E9=80=81=E6=B6=88=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../CustomerStaffGridController.java | 14 ++++ .../service/CustomerStaffGridService.java | 10 +++ .../impl/CustomerStaffGridServiceImpl.java | 27 ++++-- .../feign/EpmetMessageFeignClient.java | 38 +++++++++ .../modules/feign/EpmetUserFeignClient.java | 8 +- .../modules/feign/GovOrgFeignClient.java | 15 ++++ .../EpmetMessageFeignClientFallback.java | 29 +++++++ .../EpmetUserFeignClientFallback.java | 10 ++- .../fallback/GovOrgFeignClientFallBack.java | 14 +++- .../service/impl/ResiGroupServiceImpl.java | 82 ++++++++++++++++++- .../epmet/modules/utils/ModuleConstant.java | 30 +++++++ .../epmet/dto/form/RolesUsersListFormDTO.java | 32 ++++++++ .../epmet/controller/StaffRoleController.java | 12 +++ .../main/java/com/epmet/dao/StaffRoleDao.java | 10 +++ .../com/epmet/service/StaffRoleService.java | 10 +++ .../service/impl/StaffRoleServiceImpl.java | 21 +++++ .../main/resources/mapper/StaffRoleDao.xml | 34 ++++++++ 17 files changed, 376 insertions(+), 20 deletions(-) create mode 100644 epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/feign/EpmetMessageFeignClient.java create mode 100644 epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/feign/fallback/EpmetMessageFeignClientFallback.java create mode 100644 epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/RolesUsersListFormDTO.java diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/CustomerStaffGridController.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/CustomerStaffGridController.java index de20bc5b13..72b6dabe25 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/CustomerStaffGridController.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/CustomerStaffGridController.java @@ -26,6 +26,7 @@ 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.CustomerStaffGridDTO; +import com.epmet.dto.form.CommonGridIdFormDTO; import com.epmet.dto.form.LatestGridFormDTO; import com.epmet.dto.result.CustomerGridByUserIdResultDTO; import com.epmet.excel.CustomerStaffGridExcel; @@ -105,4 +106,17 @@ public class CustomerStaffGridController { ValidatorUtils.validateEntity(latestGridFormDTO); return customerStaffGridService.getStaffGridOrderByGridName(latestGridFormDTO); } + + /** + * @Description 查询一个网格下的所有工作人员 + * @param gridIdFormDTO + * @return Result> + * @author wangc + * @date 2020.04.29 22:59 + **/ + @PostMapping("getgridstaffs") + public Result> getGridStaffs(@RequestBody CommonGridIdFormDTO gridIdFormDTO){ + ValidatorUtils.validateEntity(gridIdFormDTO); + return customerStaffGridService.getAllGridStaffs(gridIdFormDTO); + } } \ No newline at end of file diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/CustomerStaffGridService.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/CustomerStaffGridService.java index 2f9adf3d59..7813dd3b06 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/CustomerStaffGridService.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/CustomerStaffGridService.java @@ -21,6 +21,7 @@ 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.CustomerStaffGridDTO; +import com.epmet.dto.form.CommonGridIdFormDTO; import com.epmet.dto.form.CustomerGridFormDTO; import com.epmet.dto.form.LatestGridFormDTO; import com.epmet.dto.result.CommonStaffInfoResultDTO; @@ -107,4 +108,13 @@ public interface CustomerStaffGridService extends BaseService getStaffGridOrderByGridName(LatestGridFormDTO latestGridFormDTO); + + /** + * @Description 查询一个网格下的所有工作人员 + * @param gridIdFormDTO + * @return Result> + * @author wangc + * @date 2020.04.29 22:59 + **/ + Result> getAllGridStaffs(CommonGridIdFormDTO gridIdFormDTO); } \ No newline at end of file diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerStaffGridServiceImpl.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerStaffGridServiceImpl.java index 456d99f584..44f14521b1 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerStaffGridServiceImpl.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerStaffGridServiceImpl.java @@ -23,17 +23,14 @@ 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.CustomerStaffGridDao; import com.epmet.dto.CustomerGridDTO; import com.epmet.dto.CustomerStaffGridDTO; -import com.epmet.dto.form.CustomerGridFormDTO; +import com.epmet.dto.form.CommonGridIdFormDTO; import com.epmet.dto.form.LatestGridFormDTO; -import com.epmet.dto.result.CommonStaffInfoResultDTO; import com.epmet.dto.result.CustomerGridByUserIdResultDTO; import com.epmet.entity.CustomerStaffGridEntity; -import com.epmet.feign.EpmetUserFeignClient; import com.epmet.redis.CustomerStaffGridRedis; import com.epmet.service.CustomerStaffGridService; import org.apache.commons.lang3.StringUtils; @@ -41,9 +38,11 @@ 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.stream.Collectors; /** * 网格人员关系表 @@ -57,8 +56,6 @@ public class CustomerStaffGridServiceImpl extends BaseServiceImpl page(Map params) { @@ -128,4 +125,22 @@ public class CustomerStaffGridServiceImpl extends BaseServiceImpl().ok(result); } + + /** + * @Description 查询一个网格下的所有工作人员 + * @param gridIdFormDTO + * @return Result> + * @author wangc + * @date 2020.04.29 22:59 + **/ + @Override + public Result> getAllGridStaffs(CommonGridIdFormDTO gridIdFormDTO) { + List staffs = baseDao.selectByGridId(gridIdFormDTO.getGridId()); + return new Result>().ok( + new ArrayList<>( + staffs.stream().map(CustomerStaffGridDTO::getUserId). + collect(Collectors.toSet()) + ) + ); + } } \ No newline at end of file diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/feign/EpmetMessageFeignClient.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/feign/EpmetMessageFeignClient.java new file mode 100644 index 0000000000..bc13516d07 --- /dev/null +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/feign/EpmetMessageFeignClient.java @@ -0,0 +1,38 @@ +package com.epmet.modules.feign; + +import com.epmet.commons.tools.constant.ServiceConstant; +import com.epmet.commons.tools.utils.Result; +import com.epmet.dto.form.UserMessageFormDTO; +import com.epmet.modules.feign.fallback.EpmetMessageFeignClientFallback; +import org.springframework.cloud.openfeign.FeignClient; +import org.springframework.http.MediaType; +import org.springframework.web.bind.annotation.PostMapping; + +import java.util.List; + +/** + * @Description epmet-message服务转发 + * @author wangc + * @date 2020.04.29 23:52 +**/ +@FeignClient(name = ServiceConstant.EPMET_MESSAGE_SERVER, fallback = EpmetMessageFeignClientFallback.class) +public interface EpmetMessageFeignClient { + + /** + * @param formDto + * @return com.epmet.commons.tools.utils.Result + * @Author sun + * @Description 新增未读消息 + **/ + @PostMapping(value = "message/usermessage/saveusermessage", consumes = MediaType.APPLICATION_JSON_UTF8_VALUE) + Result saveUserMessage(UserMessageFormDTO formDto); + + /** + * @param msgList + * @return com.epmet.commons.tools.utils.Result + * @Author sun + * @Description 热心居民申请给网格长们发送消息 + **/ + @PostMapping(value = "message/usermessage/saveusermessagelist", consumes = MediaType.APPLICATION_JSON_UTF8_VALUE) + Result saveUserMessageList(List msgList); +} diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/feign/EpmetUserFeignClient.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/feign/EpmetUserFeignClient.java index 575d610516..c9ad7e98a8 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/feign/EpmetUserFeignClient.java +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/feign/EpmetUserFeignClient.java @@ -2,10 +2,7 @@ package com.epmet.modules.feign; import com.epmet.commons.tools.constant.ServiceConstant; import com.epmet.commons.tools.utils.Result; -import com.epmet.dto.form.UserInvitationFormDTO; -import com.epmet.dto.form.UserResiInfoFormDTO; -import com.epmet.dto.form.UserResiInfoListFormDTO; -import com.epmet.dto.form.UserRoleFormDTO; +import com.epmet.dto.form.*; import com.epmet.dto.result.UserResiInfoResultDTO; import com.epmet.dto.result.UserRoleResultDTO; import com.epmet.modules.feign.fallback.EpmetUserFeignClientFallback; @@ -63,4 +60,7 @@ public interface EpmetUserFeignClient { **/ @PostMapping(value = "epmetuser/userinvitation/saveuserinvitation", consumes = MediaType.APPLICATION_JSON_VALUE) Result saveUserInvitation(@RequestBody UserInvitationFormDTO userInvitationFormDTO); + + @PostMapping(value = "epmetuser/staffrole/specificrolesstaffs", consumes = MediaType.APPLICATION_JSON_VALUE) + Result> specificRolesStaffs(RolesUsersListFormDTO rolesUsersListFormDTO); } diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/feign/GovOrgFeignClient.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/feign/GovOrgFeignClient.java index 23a4c288f1..d12b4125a8 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/feign/GovOrgFeignClient.java +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/feign/GovOrgFeignClient.java @@ -4,9 +4,14 @@ import com.epmet.commons.tools.constant.ServiceConstant; import com.epmet.commons.tools.utils.Result; import com.epmet.dto.CustomerDepartmentDTO; import com.epmet.dto.CustomerGridDTO; +import com.epmet.dto.form.CommonGridIdFormDTO; import com.epmet.modules.feign.fallback.GovOrgFeignClientFallBack; import org.springframework.cloud.openfeign.FeignClient; import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; + +import java.util.List; /** * @Description gov-org服务feginClient 服务间调用 @@ -34,4 +39,14 @@ public interface GovOrgFeignClient { */ @GetMapping("/gov/org/customerdepartment/{id}") Result getDept(String id); + + /** + * @Description 查询一个网格下的所有工作人员 + * @param gridIdFormDTO + * @return Result> + * @author wangc + * @date 2020.04.29 22:59 + **/ + @PostMapping("/gov/org/customerstaffgrid/getgridstaffs") + Result> getGridStaffs(@RequestBody CommonGridIdFormDTO gridIdFormDTO); } diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/feign/fallback/EpmetMessageFeignClientFallback.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/feign/fallback/EpmetMessageFeignClientFallback.java new file mode 100644 index 0000000000..6506ae2f06 --- /dev/null +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/feign/fallback/EpmetMessageFeignClientFallback.java @@ -0,0 +1,29 @@ +package com.epmet.modules.feign.fallback; + +import com.epmet.commons.tools.constant.ServiceConstant; +import com.epmet.commons.tools.utils.ModuleUtils; +import com.epmet.commons.tools.utils.Result; +import com.epmet.dto.form.UserMessageFormDTO; +import com.epmet.modules.feign.EpmetMessageFeignClient; +import org.springframework.stereotype.Component; + +import java.util.List; + +/** + * @Description + * @ClassName EpmetMessageFeignClientFallback + * @Auth wangc + * @Date 2020-04-29 23:53 + */ +@Component +public class EpmetMessageFeignClientFallback implements EpmetMessageFeignClient { + @Override + public Result saveUserMessage(UserMessageFormDTO formDto) { + return ModuleUtils.feignConError(ServiceConstant.EPMET_MESSAGE_SERVER, "saveUserMessage", formDto); + } + + @Override + public Result saveUserMessageList(List msgList) { + return ModuleUtils.feignConError(ServiceConstant.EPMET_MESSAGE_SERVER, "saveUserMessageList", msgList); + } +} diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/feign/fallback/EpmetUserFeignClientFallback.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/feign/fallback/EpmetUserFeignClientFallback.java index 5eacfdb7a4..e778691743 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/feign/fallback/EpmetUserFeignClientFallback.java +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/feign/fallback/EpmetUserFeignClientFallback.java @@ -3,10 +3,7 @@ package com.epmet.modules.feign.fallback; import com.epmet.commons.tools.constant.ServiceConstant; import com.epmet.commons.tools.utils.ModuleUtils; import com.epmet.commons.tools.utils.Result; -import com.epmet.dto.form.UserInvitationFormDTO; -import com.epmet.dto.form.UserResiInfoFormDTO; -import com.epmet.dto.form.UserResiInfoListFormDTO; -import com.epmet.dto.form.UserRoleFormDTO; +import com.epmet.dto.form.*; import com.epmet.dto.result.UserResiInfoResultDTO; import com.epmet.dto.result.UserRoleResultDTO; import com.epmet.modules.feign.EpmetUserFeignClient; @@ -41,4 +38,9 @@ public class EpmetUserFeignClientFallback implements EpmetUserFeignClient { public Result saveUserInvitation(UserInvitationFormDTO userInvitationFormDTO) { return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "saveUserInvitation", userInvitationFormDTO); } + + @Override + public Result> specificRolesStaffs(RolesUsersListFormDTO rolesUsersListFormDTO) { + return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "specificRolesStaffs", rolesUsersListFormDTO); + } } diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/feign/fallback/GovOrgFeignClientFallBack.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/feign/fallback/GovOrgFeignClientFallBack.java index d71016b127..6489af4de3 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/feign/fallback/GovOrgFeignClientFallBack.java +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/feign/fallback/GovOrgFeignClientFallBack.java @@ -1,12 +1,17 @@ package com.epmet.modules.feign.fallback; +import com.epmet.commons.tools.constant.ServiceConstant; +import com.epmet.commons.tools.utils.ModuleUtils; import com.epmet.commons.tools.utils.Result; import com.epmet.dto.CustomerDepartmentDTO; import com.epmet.dto.CustomerGridDTO; +import com.epmet.dto.form.CommonGridIdFormDTO; import com.epmet.modules.feign.GovOrgFeignClient; import org.springframework.stereotype.Component; +import java.util.List; + @Component public class GovOrgFeignClientFallBack implements GovOrgFeignClient { @@ -14,11 +19,16 @@ public class GovOrgFeignClientFallBack implements GovOrgFeignClient { @Override public Result getGrid(String id) { - return null; + return ModuleUtils.feignConError(ServiceConstant.GOV_ORG_SERVER, "getGrid", id); } @Override public Result getDept(String id) { - return null; + return ModuleUtils.feignConError(ServiceConstant.GOV_ORG_SERVER, "getDept", id); + } + + @Override + public Result> getGridStaffs(CommonGridIdFormDTO gridIdFormDTO) { + return ModuleUtils.feignConError(ServiceConstant.GOV_ORG_SERVER, "getGridStaffs", gridIdFormDTO); } } diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/service/impl/ResiGroupServiceImpl.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/service/impl/ResiGroupServiceImpl.java index e229b1c51b..e53a9dd1d0 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/service/impl/ResiGroupServiceImpl.java +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/service/impl/ResiGroupServiceImpl.java @@ -29,12 +29,13 @@ import com.epmet.commons.tools.page.PageData; import com.epmet.commons.tools.utils.ConvertUtils; import com.epmet.commons.tools.utils.DateUtils; import com.epmet.commons.tools.utils.Result; -import com.epmet.dto.form.UserResiInfoFormDTO; -import com.epmet.dto.form.UserResiInfoListFormDTO; -import com.epmet.dto.form.UserRoleFormDTO; +import com.epmet.constant.ReadFlagConstant; +import com.epmet.dto.form.*; import com.epmet.dto.result.UserResiInfoResultDTO; import com.epmet.dto.result.UserRoleResultDTO; +import com.epmet.modules.feign.EpmetMessageFeignClient; import com.epmet.modules.feign.EpmetUserFeignClient; +import com.epmet.modules.feign.GovOrgFeignClient; import com.epmet.modules.group.dao.ResiGroupDao; import com.epmet.modules.group.dao.ResiGroupOperationDao; import com.epmet.modules.group.entity.ResiGroupEntity; @@ -66,6 +67,7 @@ import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; +import sun.security.pkcs11.Secmod; import java.text.SimpleDateFormat; import java.util.*; @@ -110,6 +112,11 @@ public class ResiGroupServiceImpl extends BaseServiceImpl().ok(detail); } + /** + * @Description 给加入此网格的管理员发送消息 + * @param msg + * @param gridId + * @param userId + * @author wangc + * @date 2020.04.29 22:49 + **/ + private void sendMsgResi2Gov(String title,String msg,String gridId,String userId,String customerId){ + //1.查询加入当前网格下的人员 customer_staff_grid + CommonGridIdFormDTO commonGridIdFormDTO = new CommonGridIdFormDTO(); + commonGridIdFormDTO.setGridId(gridId); + commonGridIdFormDTO.setUserId(userId); + Result> gridstaffs = + govOrgFeignClient.getGridStaffs(commonGridIdFormDTO); + //2.查询这些人是否有管理员身份且未被禁用 staff_role customer_staff + if(gridstaffs.success() && null != gridstaffs.getData() && gridstaffs.getData().size() > 0){ + RolesUsersListFormDTO rolesUsersListFormDTO = new RolesUsersListFormDTO(); + rolesUsersListFormDTO.setCustomerId(customerId); + List roleKeys = new ArrayList(); + roleKeys.add(ModuleConstant.STAFF_ROLE_MANAGER); + rolesUsersListFormDTO.setRoleKeys(roleKeys); + rolesUsersListFormDTO.setUserIds(gridstaffs.getData()); + Result> staffRoles = + epmetUserFeignClient.specificRolesStaffs(rolesUsersListFormDTO); + //3.发送消息 + if(staffRoles.success() && null != staffRoles.getData() && staffRoles.getData().size() > 0){ + List msgList = new ArrayList<>(); + for(String to : staffRoles.getData()){ + UserMessageFormDTO msgObj = new UserMessageFormDTO(); + msgObj.setApp(ModuleConstant.APP_RESI); + msgObj.setCustomerId(customerId); + msgObj.setGridId(gridId); + msgObj.setMessageContent(msg); + msgObj.setReadFlag(ReadFlagConstant.UN_READ); + msgObj.setTitle(title); + msgObj.setUserId(to); + msgList.add(msgObj); + } + Result result = epmetMessageFeignClient.saveUserMessageList(msgList); + if(!result.success()){ + logger.warn(String.format(ModuleConstant.FAILED_SEND_MESSAGE,msg)); + } + } + } + + } } diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/utils/ModuleConstant.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/utils/ModuleConstant.java index 2d7cb7b448..2d6b98110a 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/utils/ModuleConstant.java +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/utils/ModuleConstant.java @@ -229,4 +229,34 @@ public interface ModuleConstant extends Constant { * 申请组时的消息模板 */ String CREATION_OF_GROUP_MESSAGE_TEMPLATE = "%s%s申请创建小组【%s】,请审核。"; + + /** + * 工作人员角色key:管理员 + * */ + String STAFF_ROLE_MANAGER = "manager"; + + /** + * 消息发送失败 + */ + String FAILED_SEND_MESSAGE = "消息发送失败,消息内容:【%s】"; + + /** + * 申请建组消息名称 + * */ + String CREATE_GROUP_APPLYING_MSG_TITLE = "您有一条建组申请消息"; + + /** + * 建组审核驳回时消息模板 + * */ + String DISAGREE_CREATING_GROUP_MSG = "您好,您申请的%s小组,由于不符合%s条件的原因,已被驳回。"; + + /** + * 建组审核同意时消息模板 + * */ + String AGREE_CREATING_GROUP_MSG = "您好,您申请的%s小组已通过。"; + + /** + * 审核建组申请消息名称 + * */ + String AUDITED_GROUP_APPLYING_TITLE = "您有一条建组审核消息"; } diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/RolesUsersListFormDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/RolesUsersListFormDTO.java new file mode 100644 index 0000000000..7e395bb3f7 --- /dev/null +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/RolesUsersListFormDTO.java @@ -0,0 +1,32 @@ +package com.epmet.dto.form; + +import lombok.Data; + +import java.io.Serializable; +import java.util.List; + +/** + * @Description 特定的角色 特定的员工 + * @ClassName RolesUsersListFormDTO + * @Auth wangc + * @Date 2020-04-29 23:40 + */ +@Data +public class RolesUsersListFormDTO implements Serializable { + private static final long serialVersionUID = -7375096282690016010L; + + /** + * 客户Id + * */ + private String CustomerId; + + /** + * 角色列表 + * */ + private List roleKeys; + + /** + * 人员Id列表 + */ + private List userIds; +} 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 e332d0ffb5..ca31b146e8 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 @@ -7,6 +7,7 @@ import com.epmet.commons.tools.utils.Result; import com.epmet.commons.tools.validator.ValidatorUtils; import com.epmet.dto.GovStaffRoleDTO; import com.epmet.dto.form.CommonUserFormDTO; +import com.epmet.dto.form.RolesUsersListFormDTO; import com.epmet.dto.form.StaffRoleFormDTO; import com.epmet.dto.result.GovStaffRoleResultDTO; import com.epmet.dto.result.StaffRolesResultDTO; @@ -88,4 +89,15 @@ public class StaffRoleController { ValidatorUtils.validateEntity(commonUserFormDTO); return staffRoleService.getStaffRoles(commonUserFormDTO); } + + /** + * @Description 查找具有特定角色的人员Id(可用) + * @param rolesUsersListFormDTO + * @author wangc + * @date 2020.04.29 23:49 + **/ + @PostMapping("specificrolesstaffs") + public Result> specificRolesStaffs(RolesUsersListFormDTO rolesUsersListFormDTO){ + return staffRoleService.getSpecificRolesStaffs(rolesUsersListFormDTO); + } } 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 8196b45787..3abcf39a6b 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 @@ -66,4 +66,14 @@ public interface StaffRoleDao extends BaseDao { //@DataFilter(tableAliases = { "role" }) StaffRolesResultDTO getStaffRoles(CommonUserFormDTO commonUserFormDTO); + /** + * @Description 查询特定身份的员工Id + * @param roleKeys + * @param userIds + * @param customerId + * @author wangc + * @date 2020.04.29 23:38 + **/ + List selectSpecificRolesStaffs(@Param("roleKeys")List roleKeys,@Param("userIds")List userIds,@Param("customerId")String customerId); + } \ No newline at end of file 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 39680248cb..04dfb2d94f 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 @@ -23,6 +23,7 @@ import com.epmet.commons.tools.page.PageData; import com.epmet.commons.tools.utils.Result; import com.epmet.dto.StaffRoleDTO; import com.epmet.dto.form.CommonUserFormDTO; +import com.epmet.dto.form.RolesUsersListFormDTO; import com.epmet.dto.result.GovStaffRoleResultDTO; import com.epmet.dto.result.StaffRolesResultDTO; import com.epmet.entity.StaffRoleEntity; @@ -120,4 +121,13 @@ public interface StaffRoleService extends BaseService { * @Date 2020.04.26 10:59 **/ Result getStaffRoles(CommonUserFormDTO userParam); + + /** + * @Description 查找具有特定角色的人员Id(可用) + * @param rolesUsersListFormDTO + * @return Result + * @author wangc + * @date 2020.04.29 23:44 + **/ + Result> getSpecificRolesStaffs(RolesUsersListFormDTO rolesUsersListFormDTO); } \ 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 f76d6545c5..01a44db29a 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 @@ -22,6 +22,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage; import com.epmet.commons.mybatis.annotation.DataFilter; import com.epmet.commons.mybatis.entity.DataScope; import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; +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; @@ -29,6 +30,7 @@ import com.epmet.commons.tools.utils.Result; import com.epmet.dao.StaffRoleDao; import com.epmet.dto.StaffRoleDTO; import com.epmet.dto.form.CommonUserFormDTO; +import com.epmet.dto.form.RolesUsersListFormDTO; import com.epmet.dto.result.GovStaffRoleResultDTO; import com.epmet.dto.result.StaffRolesResultDTO; import com.epmet.entity.StaffRoleEntity; @@ -39,6 +41,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; @@ -136,4 +139,22 @@ public class StaffRoleServiceImpl extends BaseServiceImpl().ok(baseDao.getStaffRoles(userParam)); } + /** + * @Description 查找具有特定角色的人员Id(可用) + * @param rolesUsersListFormDTO + * @return Result + * @author wangc + * @date 2020.04.29 23:44 + **/ + @Override + public Result> getSpecificRolesStaffs(RolesUsersListFormDTO rolesUsersListFormDTO) { + if(null != rolesUsersListFormDTO.getRoleKeys() && null != rolesUsersListFormDTO.getUserIds() + && rolesUsersListFormDTO.getRoleKeys().size() > NumConstant.ZERO + && rolesUsersListFormDTO.getUserIds().size() > NumConstant.ZERO){ + return new Result>().ok( + baseDao.selectSpecificRolesStaffs(rolesUsersListFormDTO.getRoleKeys(),rolesUsersListFormDTO.getUserIds(),rolesUsersListFormDTO.getCustomerId())); + } + return new Result>().ok(new ArrayList<>()); + } + } \ No newline at end of file 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 6cbb4c047d..6dcb9625d0 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 @@ -68,4 +68,38 @@ AND staff.USER_ID = #{userId} AND staff.CUSTOMER_ID = #{customerId} + + + \ No newline at end of file