diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/DepartmentStaffListFormDTO.java b/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/form/DepartmentStaffListFormDTO.java similarity index 73% rename from epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/DepartmentStaffListFormDTO.java rename to epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/form/DepartmentStaffListFormDTO.java index 4542a587db..3b3bad7698 100644 --- a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/DepartmentStaffListFormDTO.java +++ b/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/form/DepartmentStaffListFormDTO.java @@ -6,7 +6,7 @@ import javax.validation.constraints.NotBlank; import java.io.Serializable; /** - * @Description 项目跟踪-部门人员选择-接口入参 + * @Description 议题管理-部门人员选择-接口入参 * @Author sun */ @Data @@ -16,5 +16,10 @@ public class DepartmentStaffListFormDTO implements Serializable { @NotBlank(message = "机关组织Id不能为空") private String agencyId; + /** + * token中工作人员Id + */ + private String staffId; + } diff --git a/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/form/TickStaffFormDTO.java b/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/form/TickStaffFormDTO.java index b163fd5781..790d21914a 100644 --- a/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/form/TickStaffFormDTO.java +++ b/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/form/TickStaffFormDTO.java @@ -19,12 +19,12 @@ public class TickStaffFormDTO implements Serializable { /** * 部门Id(为空表示勾选的人不是部门下的,可能是组织下的也可能是网格下的) */ - private String departmentId; + private String departmentId=""; /** * 网格Id(为空表示勾选的人不是网格下的,可能是组织下的也可能是部门下的) */ - private String gridId; + private String gridId=""; @NotBlank(message = "内部备注不能为空") private String staffId; diff --git a/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/controller/IssueManageController.java b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/controller/IssueManageController.java index 922c7824ab..3c184229b2 100644 --- a/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/controller/IssueManageController.java +++ b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/controller/IssueManageController.java @@ -6,9 +6,6 @@ import com.epmet.commons.tools.enums.RequirePermissionEnum; 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.CloseIssueFormDTO; -import com.epmet.dto.form.DepartmentStaffListFormDTO; -import com.epmet.dto.form.ShiftProjectListFromDTO; import com.epmet.dto.form.*; import com.epmet.dto.result.*; import com.epmet.service.IssueService; @@ -58,6 +55,7 @@ public class IssueManageController { @PostMapping("departmentstafflist") @RequirePermission(requirePermission = RequirePermissionEnum.WORK_GRASSROOTS_ISSUE_SHIFT_PROJECT) public Result departmentStaffList(@LoginUser TokenDto tokenDTO, @RequestBody DepartmentStaffListFormDTO formDTO) { + formDTO.setStaffId(tokenDTO.getUserId()); ValidatorUtils.validateEntity(formDTO); return new Result().ok(issueService.departmentStaffList(formDTO)); } diff --git a/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/feign/GovOrgFeignClient.java b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/feign/GovOrgFeignClient.java index 7848d0bedf..f521975727 100644 --- a/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/feign/GovOrgFeignClient.java +++ b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/feign/GovOrgFeignClient.java @@ -2,9 +2,8 @@ package com.epmet.feign; import com.epmet.commons.tools.constant.ServiceConstant; import com.epmet.commons.tools.utils.Result; -import com.epmet.dto.CustomerGridDTO; import com.epmet.dto.form.BelongGridNameFormDTO; -import com.epmet.dto.form.CustomerGridFormDTO; +import com.epmet.dto.form.CanTickStaffListFormDTO; import com.epmet.dto.result.AgencyGridResultDTO; import com.epmet.dto.result.BelongGridNameResultDTO; import com.epmet.dto.result.DepartmentStaffListResultDTO; @@ -32,13 +31,13 @@ public interface GovOrgFeignClient { Result getAgencyAndGrid(AgencyGridResultDTO agencyGridResultDTO); /** - * @param agencyId + * @param canTick * @return * @Author sun * @Description 查询组织下人员,组织下部门人员,组织下网格人员列表信息 **/ - @PostMapping(value = "/gov/org/customeragency/departmentstafflist/{agencyId}") - Result departmentStaffList(@PathVariable("agencyId") String agencyId); + @PostMapping(value = "/gov/org/customeragency/departmentstafflist") + Result departmentStaffList(CanTickStaffListFormDTO canTick); /** * @param agencyId diff --git a/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/feign/fallback/GovOrgFeignClientFallBack.java b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/feign/fallback/GovOrgFeignClientFallBack.java index d216667d86..a659baa435 100644 --- a/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/feign/fallback/GovOrgFeignClientFallBack.java +++ b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/feign/fallback/GovOrgFeignClientFallBack.java @@ -4,6 +4,7 @@ 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.BelongGridNameFormDTO; +import com.epmet.dto.form.CanTickStaffListFormDTO; import com.epmet.dto.result.AgencyGridResultDTO; import com.epmet.dto.result.BelongGridNameResultDTO; import com.epmet.dto.result.DepartmentStaffListResultDTO; @@ -24,8 +25,8 @@ public class GovOrgFeignClientFallBack implements GovOrgFeignClient { } @Override - public Result departmentStaffList(String agencyId) { - return ModuleUtils.feignConError(ServiceConstant.GOV_ORG_SERVER, "departmentStaffList", agencyId); + public Result departmentStaffList(CanTickStaffListFormDTO canTick) { + return ModuleUtils.feignConError(ServiceConstant.GOV_ORG_SERVER, "departmentStaffList", canTick); } @Override diff --git a/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/impl/IssueServiceImpl.java b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/impl/IssueServiceImpl.java index e75679364b..39770665de 100644 --- a/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/impl/IssueServiceImpl.java +++ b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/impl/IssueServiceImpl.java @@ -15,19 +15,13 @@ import com.epmet.constant.IssueConstant; import com.epmet.constant.ReadFlagConstant; import com.epmet.constant.UserMessageConstant; import com.epmet.dao.IssueDao; +import com.epmet.dao.IssueProcessDao; import com.epmet.dao.IssueProjectRelationDao; import com.epmet.dto.IssueDTO; import com.epmet.dto.IssueProcessDTO; import com.epmet.dto.IssueVoteStatisticalDTO; -import com.epmet.dto.form.CommonIssueListFormDTO; -import com.epmet.dao.IssueProcessDao; import com.epmet.dto.form.*; import com.epmet.dto.result.*; -import com.epmet.dto.form.CloseIssueFormDTO; -import com.epmet.dto.form.DepartmentStaffListFormDTO; -import com.epmet.dto.form.IssueDetailFormDTO; -import com.epmet.dto.form.IssueShiftedFromTopicFormDTO; -import com.epmet.dto.form.UserMessageFormDTO; import com.epmet.entity.IssueEntity; import com.epmet.entity.IssueProcessEntity; import com.epmet.entity.IssueProjectRelationEntity; @@ -51,9 +45,6 @@ import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import java.util.*; -import java.util.ArrayList; -import java.util.Date; -import java.util.List; import java.util.stream.Collectors; /** @@ -153,71 +144,6 @@ public class IssueServiceImpl extends BaseServiceImpl imp return issueResult; } - /** - * @param formDTO - * @return - * @Author sun - * @Description 议题管理-关闭议题 - **/ - - @Override - @Transactional(rollbackFor = Exception.class) - public void closeIssue(CloseIssueFormDTO formDTO) { - Date date = new Date(); - //1:更新议题详情表数据 - IssueEntity entity = baseDao.selectById(formDTO.getIssueId()); - if (null == entity) { - throw new RenException(IssueConstant.SELECT_EXCEPTION); - } - entity.setIssueStatus(IssueConstant.ISSUE_CLOSED); - entity.setCloseReason(formDTO.getCloseReason()); - entity.setResolveType(formDTO.getResolveType()); - entity.setVotingDeadline(date); - entity.setClosedTime(date); - if (baseDao.updateById(entity) < NumConstant.ONE) { - throw new RenException(IssueConstant.UPPDATE_EXCEPTION); - } - - //2:调用gov-org服务,查询组织网格名称 - AgencyGridResultDTO agencyGridResultDTO = new AgencyGridResultDTO(); - agencyGridResultDTO.setAgencyId(entity.getOrgId()); - agencyGridResultDTO.setGridId(entity.getGridId()); - Result resultDTO = govOrgFeignClient.getAgencyAndGrid(agencyGridResultDTO); - agencyGridResultDTO = resultDTO.getData(); - - //3:议题进展记录表新增数据 - IssueProcessEntity processEntity = new IssueProcessEntity(); - processEntity.setIssueId(formDTO.getIssueId()); - processEntity.setIssueStatus(IssueConstant.ISSUE_CLOSED); - processEntity.setOrgType(IssueConstant.ISSUE_GRID); - processEntity.setOrgId(entity.getOrgId()); - processEntity.setOperationExplain(formDTO.getCloseReason()); - processEntity.setOrgName(agencyGridResultDTO.getAgencyName() + "-" + agencyGridResultDTO.getGridName()); - issueProcessDao.insert(processEntity); - - //4:调用epmet-message服务,给居民端话题创建人和议题发起人发送消息 - //4.1:调用resi-group查询话题创建人数据(目前议题来源只有来自话题) - Result resultTopicDTO = resiGroupFeignClient.getTopicById(entity.getSourceId()); - if (!resultTopicDTO.success() || null == resultTopicDTO.getData()) { - throw new RenException(IssueConstant.SELECT_TOPIC_EXCEPTION); - } - ResiTopicDTO topicDTO = resultTopicDTO.getData(); - //4.2:创建消息模板 - String messageContent = ""; - if (IssueConstant.ISSUE_RESLOVED.equals(formDTO.getResolveType())) { - messageContent = String.format(UserMessageConstant.ISSUE_RESLOVED_MSG, topicDTO.getTopicContent(), formDTO.getCloseReason()); - } else if (IssueConstant.ISSUE_UNRESLOVED.equals(formDTO.getResolveType())) { - messageContent = String.format(UserMessageConstant.ISSUE_UNRESLOVED_MSG, topicDTO.getTopicContent(), formDTO.getCloseReason()); - } - //4.3:调用服务,发送消息 - if (!saveUserMessageList(topicDTO, messageContent, entity).success()) { - throw new RenException(IssueConstant.SAVE_MSG_EXCEPTION); - } - - //5:缓存中网格下表决中的议题总数减1 - govIssueRedis.subtractWorkGrassrootsIssueRedDotValue(entity.getGridId()); - } - /** * @Description 根据issueId查询gridId * @param issueId @@ -231,27 +157,6 @@ public class IssueServiceImpl extends BaseServiceImpl imp return gridIdResult; } - /** - * @Description 关闭议题、议题转项目时给话题创建人和议题发起人发送消息 - * @author sun - */ - private Result saveUserMessageList(ResiTopicDTO topicDTO, String messageContent, IssueEntity entity) { - //2:分别给话题创建人、议题发起人发送消息 - List msgList = new ArrayList<>(); - UserMessageFormDTO msgDTO = new UserMessageFormDTO(); - msgDTO.setCustomerId(entity.getCustomerId()); - msgDTO.setGridId(entity.getGridId()); - msgDTO.setApp(AppClientConstant.APP_RESI); - msgDTO.setTitle(UserMessageConstant.ISSUE_TITLE); - msgDTO.setMessageContent(messageContent); - msgDTO.setReadFlag(ReadFlagConstant.UN_READ); - msgDTO.setUserId(topicDTO.getCreatedBy()); - msgList.add(msgDTO); - msgDTO.setUserId(entity.getCreatedBy()); - msgList.add(msgDTO); - return messageFeignClient.saveUserMessageList(msgList); - } - @Override public List queryVotingIssueCount(List gridIdList) { List list = new ArrayList<>(); @@ -269,19 +174,6 @@ public class IssueServiceImpl extends BaseServiceImpl imp return list; } - /** - * @param formDTO - * @return - * @Author sun - * @Description 议题管理-部门人员选择 - **/ - @Override - public DepartmentStaffListResultDTO departmentStaffList(DepartmentStaffListFormDTO formDTO) { - //1:调用gov-org服务,分别查询组织下人员,组织下部门人员,组织下网格人员列表信息 - Result resultDTOResult = govOrgFeignClient.departmentStaffList(formDTO.getAgencyId()); - return resultDTOResult.getData(); - } - @Override public List getShiftProjectList(ShiftProjectListFromDTO fromDTO) { List resultList = new ArrayList<>(); @@ -310,24 +202,6 @@ public class IssueServiceImpl extends BaseServiceImpl imp return resultList; } - /** - * @param formDTO - * @return - * @Author sun - * @Description 议题管理-议题人员选择 - **/ - @Override - public ProcessorListResultDTO processorList(ProcessorListFormDTO formDTO) { - //1:查询当前议题工作人员所属组织Id - IssueEntity entity = baseDao.selectById(formDTO.getIssueId()); - if (null == entity) { - throw new RenException(IssueConstant.SELECT_EXCEPTION); - } - //2:调用gov-org服务,查询组织树 - Result resultDTOResult = govOrgFeignClient.getProcessorList(entity.getOrgId()); - return resultDTOResult.getData(); - } - /** * @Description 话题转为议题入口 返回生成的议题Id * @param issueShiftedFromTopicFormDTO IssueShiftedFromTopicFormDTO.class @@ -457,6 +331,125 @@ public class IssueServiceImpl extends BaseServiceImpl imp return null; } + /** + * @param formDTO + * @return + * @Author sun + * @Description 议题管理-关闭议题 + **/ + @Override + @Transactional(rollbackFor = Exception.class) + public void closeIssue(CloseIssueFormDTO formDTO) { + Date date = new Date(); + //1:更新议题详情表数据 + IssueEntity entity = baseDao.selectById(formDTO.getIssueId()); + if (null == entity) { + throw new RenException(IssueConstant.SELECT_EXCEPTION); + } + entity.setIssueStatus(IssueConstant.ISSUE_CLOSED); + entity.setCloseReason(formDTO.getCloseReason()); + entity.setResolveType(formDTO.getResolveType()); + entity.setVotingDeadline(date); + entity.setClosedTime(date); + if (baseDao.updateById(entity) < NumConstant.ONE) { + throw new RenException(IssueConstant.UPPDATE_EXCEPTION); + } + + //2:调用gov-org服务,查询组织网格名称 + AgencyGridResultDTO agencyGridResultDTO = new AgencyGridResultDTO(); + agencyGridResultDTO.setAgencyId(entity.getOrgId()); + agencyGridResultDTO.setGridId(entity.getGridId()); + Result resultDTO = govOrgFeignClient.getAgencyAndGrid(agencyGridResultDTO); + agencyGridResultDTO = resultDTO.getData(); + + //3:议题进展记录表新增数据 + IssueProcessEntity processEntity = new IssueProcessEntity(); + processEntity.setIssueId(formDTO.getIssueId()); + processEntity.setIssueStatus(IssueConstant.ISSUE_CLOSED); + processEntity.setOrgType(IssueConstant.ISSUE_GRID); + processEntity.setOrgId(entity.getOrgId()); + processEntity.setOperationExplain(formDTO.getCloseReason()); + processEntity.setOrgName(agencyGridResultDTO.getAgencyName() + "-" + agencyGridResultDTO.getGridName()); + issueProcessDao.insert(processEntity); + + //4:调用epmet-message服务,给居民端话题创建人和议题发起人发送消息 + //4.1:调用resi-group查询话题创建人数据(目前议题来源只有来自话题) + Result resultTopicDTO = resiGroupFeignClient.getTopicById(entity.getSourceId()); + if (!resultTopicDTO.success() || null == resultTopicDTO.getData()) { + throw new RenException(IssueConstant.SELECT_TOPIC_EXCEPTION); + } + ResiTopicDTO topicDTO = resultTopicDTO.getData(); + //4.2:创建消息模板 + String messageContent = ""; + if (IssueConstant.ISSUE_RESLOVED.equals(formDTO.getResolveType())) { + messageContent = String.format(UserMessageConstant.ISSUE_RESLOVED_MSG, topicDTO.getTopicContent(), formDTO.getCloseReason()); + } else if (IssueConstant.ISSUE_UNRESLOVED.equals(formDTO.getResolveType())) { + messageContent = String.format(UserMessageConstant.ISSUE_UNRESLOVED_MSG, topicDTO.getTopicContent(), formDTO.getCloseReason()); + } + //4.3:调用服务,发送消息 + if (!saveUserMessageList(topicDTO, messageContent, entity).success()) { + throw new RenException(IssueConstant.SAVE_MSG_EXCEPTION); + } + + //5:缓存中网格下表决中的议题总数减1 + govIssueRedis.subtractWorkGrassrootsIssueRedDotValue(entity.getGridId()); + } + + /** + * @Description 关闭议题、议题转项目时给话题创建人和议题发起人发送消息 + * @author sun + */ + private Result saveUserMessageList(ResiTopicDTO topicDTO, String messageContent, IssueEntity entity) { + //2:分别给话题创建人、议题发起人发送消息 + List msgList = new ArrayList<>(); + UserMessageFormDTO msgDTO = new UserMessageFormDTO(); + msgDTO.setCustomerId(entity.getCustomerId()); + msgDTO.setGridId(entity.getGridId()); + msgDTO.setApp(AppClientConstant.APP_RESI); + msgDTO.setTitle(UserMessageConstant.ISSUE_TITLE); + msgDTO.setMessageContent(messageContent); + msgDTO.setReadFlag(ReadFlagConstant.UN_READ); + msgDTO.setUserId(topicDTO.getCreatedBy()); + msgList.add(msgDTO); + msgDTO.setUserId(entity.getCreatedBy()); + msgList.add(msgDTO); + return messageFeignClient.saveUserMessageList(msgList); + } + + /** + * @param formDTO + * @return + * @Author sun + * @Description 议题管理-部门人员选择 + **/ + @Override + public DepartmentStaffListResultDTO departmentStaffList(DepartmentStaffListFormDTO formDTO) { + //1:调用gov-org服务,分别查询组织下人员,组织下部门人员,组织下网格人员列表信息 + CanTickStaffListFormDTO canTick = new CanTickStaffListFormDTO(); + canTick.setAgencyId(formDTO.getAgencyId()); + canTick.setType("issue"); + Result resultDTOResult = govOrgFeignClient.departmentStaffList(canTick); + return resultDTOResult.getData(); + } + + /** + * @param formDTO + * @return + * @Author sun + * @Description 议题管理-议题人员选择 + **/ + @Override + public ProcessorListResultDTO processorList(ProcessorListFormDTO formDTO) { + //1:查询当前议题工作人员所属组织Id + IssueEntity entity = baseDao.selectById(formDTO.getIssueId()); + if (null == entity) { + throw new RenException(IssueConstant.SELECT_EXCEPTION); + } + //2:调用gov-org服务,查询组织树 + Result resultDTOResult = govOrgFeignClient.getProcessorList(entity.getOrgId()); + return resultDTOResult.getData(); + } + /** * @param formDTO * @return diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/StaffListResultDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/StaffListResultDTO.java index 27ff1b358b..ef496b28e5 100644 --- a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/StaffListResultDTO.java +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/StaffListResultDTO.java @@ -15,15 +15,15 @@ public class StaffListResultDTO implements Serializable { /** * 人员Id */ - private String staffId; + private String staffId=""; /** * 人员名称 */ - private String staffName; + private String staffName=""; /** * 人员头像 */ - private String staffHeadPhoto; + private String staffHeadPhoto=""; /** * 性别 */ @@ -31,6 +31,6 @@ public class StaffListResultDTO implements Serializable { /** * 角色名称(机关领导、部门领导、网格长) */ - private String roleName; + private String roleName=""; } diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/CustomerAgencyController.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/CustomerAgencyController.java index 73728f19de..8ddc017fa2 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/CustomerAgencyController.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/CustomerAgencyController.java @@ -17,9 +17,7 @@ package com.epmet.controller; -import com.epmet.commons.tools.annotation.LoginUser; import com.epmet.commons.tools.page.PageData; -import com.epmet.commons.tools.security.dto.TokenDto; import com.epmet.commons.tools.utils.ExcelUtils; import com.epmet.commons.tools.utils.Result; import com.epmet.commons.tools.validator.AssertUtils; @@ -29,6 +27,7 @@ import com.epmet.commons.tools.validator.group.DefaultGroup; import com.epmet.commons.tools.validator.group.UpdateGroup; import com.epmet.dto.CustomerAgencyDTO; import com.epmet.dto.form.AgencyDeptGridFormDTO; +import com.epmet.dto.form.CanTickStaffListFormDTO; import com.epmet.dto.form.StaffOrgFormDTO; import com.epmet.dto.result.*; import com.epmet.excel.CustomerAgencyExcel; @@ -120,14 +119,14 @@ public class CustomerAgencyController { } /** - * @param agencyId + * @param canTick * @return * @Author sun * @Description 查询组织下人员,组织下部门人员,组织下网格人员列表信息 **/ - @PostMapping("departmentstafflist/{agencyId}") - public Result departmentStaffList(@PathVariable("agencyId") String agencyId) { - return new Result().ok(customerAgencyService.departmentStaffList(agencyId)); + @PostMapping("departmentstafflist") + public Result departmentStaffList(CanTickStaffListFormDTO canTick) { + return new Result().ok(customerAgencyService.departmentStaffList(canTick)); } /** 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 7be691d69f..4334657bb9 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 @@ -74,5 +74,5 @@ public interface CustomerStaffAgencyDao extends BaseDao selectAgencyStaffList(@Param("agencyId") String agencyId); + List selectAgencyStaffList(@Param("agencyId") String agencyId, @Param("staffId") String staffId); } \ No newline at end of file diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/CustomerAgencyService.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/CustomerAgencyService.java index 96132b35da..6cc44ea483 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/CustomerAgencyService.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/CustomerAgencyService.java @@ -22,6 +22,7 @@ import com.epmet.commons.tools.page.PageData; import com.epmet.commons.tools.utils.Result; import com.epmet.dto.CustomerAgencyDTO; import com.epmet.dto.form.AgencyDeptGridFormDTO; +import com.epmet.dto.form.CanTickStaffListFormDTO; import com.epmet.dto.form.StaffOrgFormDTO; import com.epmet.dto.result.*; import com.epmet.entity.CustomerAgencyEntity; @@ -115,12 +116,12 @@ public interface CustomerAgencyService extends BaseService AgencyGridResultDTO getAgencyAndGrid(AgencyGridResultDTO agencyGridResultDTO); /** - * @param agencyId + * @param canTick * @return * @Author sun * @Description 查询组织下人员,组织下部门人员,组织下网格人员列表信息 **/ - DepartmentStaffListResultDTO departmentStaffList(String agencyId); + DepartmentStaffListResultDTO departmentStaffList(CanTickStaffListFormDTO canTick); /** * @param formDTO diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerAgencyServiceImpl.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerAgencyServiceImpl.java index d046a50c14..5be49bf353 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerAgencyServiceImpl.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerAgencyServiceImpl.java @@ -31,6 +31,7 @@ import com.epmet.constant.CustomerGridConstant; import com.epmet.dao.*; import com.epmet.dto.*; import com.epmet.dto.form.AgencyDeptGridFormDTO; +import com.epmet.dto.form.CanTickStaffListFormDTO; import com.epmet.dto.form.CustomerFormDTO; import com.epmet.dto.form.StaffOrgFormDTO; import com.epmet.dto.result.*; @@ -178,20 +179,24 @@ public class CustomerAgencyServiceImpl extends BaseServiceImpl agencyStaffList = customerStaffAgencyDao.selectAgencyStaffList(agencyId); + //1:根据组织Id查询该组织下工作人员列表(如果当前操作人是组织下的则不查询) + String staffId = ""; + if("project".equals(canTick.getType())&&"".equals(canTick.getDeptOrGridId())){ + staffId = canTick.getStaffId(); + } + List agencyStaffList = customerStaffAgencyDao.selectAgencyStaffList(canTick.getAgencyId(),staffId); //2:根据组织Id查询该组织下部门、人员列表 //2.1:查询组织下部门列表 - List listDept = customerDepartmentDao.selectDepartmentList(agencyId); + List listDept = customerDepartmentDao.selectDepartmentList(canTick.getAgencyId()); List departmentList = ConvertUtils.sourceToTarget(listDept, DeptListResultDTO.class); //2.2:查询每一个部门下人员列表 List deptIdList = departmentList.stream().map(DeptListResultDTO::getDepartmentId).collect(Collectors.toList()); @@ -199,17 +204,19 @@ public class CustomerAgencyServiceImpl extends BaseServiceImpl{ List departmentStaffList = new ArrayList<>(); deptStaffs.forEach(ds->{ - if(dept.getDepartmentId().equals(ds.getDepartmentId())){ - StaffListResultDTO sf = new StaffListResultDTO(); - sf.setStaffId(ds.getUserId()); - departmentStaffList.add(sf); + if (dept.getDepartmentId().equals(ds.getDepartmentId())) { + if (!"project".equals(canTick.getType()) || "".equals(canTick.getDeptOrGridId()) || !dept.getDepartmentId().equals(canTick.getDeptOrGridId())) { + StaffListResultDTO sf = new StaffListResultDTO(); + sf.setStaffId(ds.getUserId()); + departmentStaffList.add(sf); + } } }); dept.setDepartmentStaffList(departmentStaffList); }); //3:根据组织Id查询该组织下网格、人员列表 //3.1:查询组织下网格列表 - List gridList = customerGridDao.selectGridList(agencyId); + List gridList = customerGridDao.selectGridList(canTick.getAgencyId()); //3.2:查询每一个网格下人员列表 List gridIdList = gridList.stream().map(GridListResultDTO::getGridId).collect(Collectors.toList()); List gridStaffs = customerStaffGridDao.selectGridStaffs(gridIdList); @@ -217,9 +224,11 @@ public class CustomerAgencyServiceImpl extends BaseServiceImpl gridStaffList = new ArrayList<>(); gridStaffs.forEach(gs->{ if(grid.getGridId().equals(gs.getGridId())){ - StaffListResultDTO sf = new StaffListResultDTO(); - sf.setStaffId(gs.getUserId()); - gridStaffList.add(sf); + if (!"project".equals(canTick.getType()) || "".equals(canTick.getDeptOrGridId()) || !grid.getGridId().equals(canTick.getDeptOrGridId())) { + StaffListResultDTO sf = new StaffListResultDTO(); + sf.setStaffId(gs.getUserId()); + gridStaffList.add(sf); + } } }); grid.setGridStaffList(gridStaffList); @@ -242,7 +251,10 @@ public class CustomerAgencyServiceImpl extends BaseServiceImpl agencyList = baseDao.selectAgencyListByIds(formDTO.getAgencyIdList()); + List agencyList = new ArrayList<>(); + if (null != formDTO.getAgencyIdList()) { + agencyList = baseDao.selectAgencyListByIds(formDTO.getAgencyIdList()); + } //2:根据部门Id批量查询部门信息 - List deptList = customerDepartmentDao.selectDeptListByIds(formDTO.getDeptIdList()); + List deptList = new ArrayList<>(); + if (null != formDTO.getDeptIdList()) { + deptList = customerDepartmentDao.selectDeptListByIds(formDTO.getDeptIdList()); + } //3:根据网格Id批量查询网格信息 - List gridList = customerGridDao.selectGridListByIds(formDTO.getGridIdList()); + List gridList = new ArrayList<>(); + if (null != formDTO.getGridIdList()) { + gridList = customerGridDao.selectGridListByIds(formDTO.getGridIdList()); + } agencyDeptGrid.setAgencyList(agencyList); agencyDeptGrid.setDeptList(deptList); agencyDeptGrid.setGridList(gridList); 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 1b5fdf92a5..11c5693e43 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 @@ -119,10 +119,11 @@ ca.id = #{agencyId} ORDER BY field( - ca.id, + ca.id, #{agencyId} + ) \ No newline at end of file diff --git a/epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/form/DepartmentStaffListFormDTO.java b/epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/form/DepartmentStaffListFormDTO.java new file mode 100644 index 0000000000..10ac948b8c --- /dev/null +++ b/epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/form/DepartmentStaffListFormDTO.java @@ -0,0 +1,28 @@ +package com.epmet.dto.form; + +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import java.io.Serializable; + +/** + * @Description 项目跟踪-部门人员选择-接口入参 + * @Author sun + */ +@Data +public class DepartmentStaffListFormDTO implements Serializable { + private static final long serialVersionUID = 4859779755214502427L; + + @NotBlank(message = "机关组织Id不能为空") + private String agencyId; + + @NotBlank(message = "项目人员关联Id不能为空") + private String projectStaffId; + + /** + * token中工作人员Id + */ + private String staffId; + +} + diff --git a/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/constant/ProjectConstant.java b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/constant/ProjectConstant.java index d341afd494..c2919ffbfd 100644 --- a/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/constant/ProjectConstant.java +++ b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/constant/ProjectConstant.java @@ -85,4 +85,8 @@ public interface ProjectConstant { * 更新项目人员关联表数据失败 */ String DATE_EXCEPTION = "未勾选流转人员"; + /** + * 调用gov-org服务查询数据失败 + */ + String SELECT_GOV_ORG_EXCEPTION = "获取组织、部门、网格信息失败"; } diff --git a/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/controller/ProjectTraceController.java b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/controller/ProjectTraceController.java index 28c14a862e..7f90d5e362 100644 --- a/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/controller/ProjectTraceController.java +++ b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/controller/ProjectTraceController.java @@ -12,7 +12,6 @@ import com.epmet.service.ProjectProcessService; import com.epmet.service.ProjectSatisfactionDetailService; import com.epmet.service.ProjectStaffService; import com.epmet.service.ProjectTraceService; -import oracle.jdbc.proxy.annotation.Post; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; @@ -153,18 +152,32 @@ public class ProjectTraceController { return new Result(); } - /** - * @param formDTO - * @return - * @Author sun - * @Description 项目跟踪-项目处理进展列表 - **/ - @PostMapping("processlist") - @RequirePermission(requirePermission = RequirePermissionEnum.WORK_PROJECT_TRACE_DETAIL) - public Result> processList(@LoginUser TokenDto tokenDTO, @RequestBody ProcessListFormDTO formDTO) { - ValidatorUtils.validateEntity(formDTO); - return new Result>().ok(projectProcessService.progressList(formDTO)); - } + /** + * 我的处理部门 + * @author zhaoqifeng + * @date 2020/5/14 14:22 + * @param tokenDto + * @param fromDTO + * @return com.epmet.commons.tools.utils.Result> + */ + @PostMapping("mydepartmentlist") + @RequirePermission(requirePermission = RequirePermissionEnum.WORK_PROJECT_TRACE_DETAIL) + public Result> myDepartmentList(@LoginUser TokenDto tokenDto, @RequestBody ProjectDetailFromDTO fromDTO) { + return new Result>().ok(projectTraceService.myDepartmentList(tokenDto, fromDTO)); + } + + /** + * @param formDTO + * @return + * @Author sun + * @Description 项目跟踪-项目处理进展列表 + **/ + @PostMapping("processlist") + @RequirePermission(requirePermission = RequirePermissionEnum.WORK_PROJECT_TRACE_DETAIL) + public Result> processList(@LoginUser TokenDto tokenDTO, @RequestBody ProcessListFormDTO formDTO) { + ValidatorUtils.validateEntity(formDTO); + return new Result>().ok(projectProcessService.progressList(formDTO)); + } /** * @param formDTO @@ -188,6 +201,7 @@ public class ProjectTraceController { @PostMapping("departmentstafflist") @RequirePermission(requirePermission = RequirePermissionEnum.WORK_PROJECT_TRACE_TRANSFER) public Result departmentStaffList(@LoginUser TokenDto tokenDTO, @RequestBody DepartmentStaffListFormDTO formDTO) { + formDTO.setStaffId(tokenDTO.getUserId()); ValidatorUtils.validateEntity(formDTO); return new Result().ok(projectStaffService.departmentStaffList(formDTO)); } @@ -206,20 +220,6 @@ public class ProjectTraceController { return new Result(); } - /** - * 我的处理部门 - * @author zhaoqifeng - * @date 2020/5/14 14:22 - * @param tokenDto - * @param fromDTO - * @return com.epmet.commons.tools.utils.Result> - */ - @PostMapping("mydepartmentlist") - @RequirePermission(requirePermission = RequirePermissionEnum.WORK_PROJECT_TRACE_DETAIL) - public Result> myDepartmentList(@LoginUser TokenDto tokenDto, @RequestBody ProjectDetailFromDTO fromDTO) { - return new Result>().ok(projectTraceService.myDepartmentList(tokenDto, fromDTO)); - } - /** * @param formDTO * @return diff --git a/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/feign/GovOrgFeignClient.java b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/feign/GovOrgFeignClient.java index a086079472..ccd4421b7b 100644 --- a/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/feign/GovOrgFeignClient.java +++ b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/feign/GovOrgFeignClient.java @@ -6,6 +6,7 @@ import com.epmet.commons.tools.utils.Result; import com.epmet.dto.CustomerAgencyDTO; import com.epmet.commons.tools.utils.Result; import com.epmet.dto.form.AgencyDeptGridFormDTO; +import com.epmet.dto.form.CanTickStaffListFormDTO; import com.epmet.dto.result.AgencyDeptGridResultDTO; import com.epmet.dto.result.DepartmentStaffListResultDTO; import com.epmet.dto.result.ProcessorListResultDTO; @@ -30,13 +31,13 @@ public interface GovOrgFeignClient { @PostMapping("/gov/org/agency/agencybyid/{agencyId}") Result getAgencyById(@PathVariable("agencyId") String agencyId); /** - * @param agencyId + * @param canTick * @return * @Author sun * @Description 查询组织下人员,组织下部门人员,组织下网格人员列表信息 **/ - @PostMapping(value = "/gov/org/customeragency/departmentstafflist/{agencyId}") - Result departmentStaffList(@PathVariable("agencyId") String agencyId); + @PostMapping(value = "/gov/org/customeragency/departmentstafflist") + Result departmentStaffList(CanTickStaffListFormDTO canTick); /** * @param formDTO diff --git a/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/feign/fallback/GovOrgFeignClientFallBack.java b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/feign/fallback/GovOrgFeignClientFallBack.java index 1fad4e06c6..e5dec301d0 100644 --- a/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/feign/fallback/GovOrgFeignClientFallBack.java +++ b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/feign/fallback/GovOrgFeignClientFallBack.java @@ -8,6 +8,7 @@ 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.AgencyDeptGridFormDTO; +import com.epmet.dto.form.CanTickStaffListFormDTO; import com.epmet.dto.result.AgencyDeptGridResultDTO; import com.epmet.dto.result.DepartmentStaffListResultDTO; import com.epmet.dto.result.ProcessorListResultDTO; @@ -26,8 +27,8 @@ public class GovOrgFeignClientFallBack implements GovOrgFeignClient { return ModuleUtils.feignConError(ServiceConstant.GOV_ORG_SERVER, "getAgencyById", agencyId); } @Override - public Result departmentStaffList(String agencyId) { - return ModuleUtils.feignConError(ServiceConstant.GOV_ORG_SERVER, "departmentStaffList", agencyId); + public Result departmentStaffList(CanTickStaffListFormDTO canTick) { + return ModuleUtils.feignConError(ServiceConstant.GOV_ORG_SERVER, "departmentStaffList", canTick); } @Override diff --git a/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/ProjectStaffService.java b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/ProjectStaffService.java index ba73f3a7de..6457dc7749 100644 --- a/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/ProjectStaffService.java +++ b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/ProjectStaffService.java @@ -22,7 +22,6 @@ import com.epmet.commons.tools.page.PageData; import com.epmet.dto.ProjectStaffDTO; import com.epmet.dto.form.DepartmentStaffListFormDTO; import com.epmet.dto.result.DepartmentResultDTO; -import com.epmet.entity.ProjectProcessEntity; import com.epmet.dto.result.DepartmentStaffListResultDTO; import com.epmet.entity.ProjectStaffEntity; diff --git a/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/impl/ProjectServiceImpl.java b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/impl/ProjectServiceImpl.java index 0fff916e28..d3c37b531e 100644 --- a/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/impl/ProjectServiceImpl.java +++ b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/impl/ProjectServiceImpl.java @@ -20,21 +20,17 @@ 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.constant.NumConstant; 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.utils.ConvertUtils; -import com.epmet.commons.tools.constant.FieldConstant; import com.epmet.commons.tools.utils.Result; import com.epmet.constant.ParameterKeyConstant; import com.epmet.constant.ProjectConstant; import com.epmet.dao.ProjectDao; -import com.epmet.dto.CustomerProjectParameterDTO; -import com.epmet.dto.CustomerStaffDTO; -import com.epmet.dto.IssueDTO; -import com.epmet.dto.ProjectDTO; -import com.epmet.dto.ProjectStaffDTO; +import com.epmet.dto.*; import com.epmet.dto.form.*; import com.epmet.dto.result.*; import com.epmet.entity.ProjectEntity; @@ -437,6 +433,9 @@ public class ProjectServiceImpl extends BaseServiceImpl resultDTO = govOrgFeignClient.getAgencyDeptGridList(agencyDeptGridFormDTO); + if (!resultDTO.success() || null == resultDTO.getData()) { + throw new RenException(ProjectConstant.SELECT_GOV_ORG_EXCEPTION); + } AgencyDeptGridResultDTO agencyDeptGrid = resultDTO.getData(); //2:项目表新增数据 diff --git a/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/impl/ProjectStaffServiceImpl.java b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/impl/ProjectStaffServiceImpl.java index 03b6c60045..19d65197a7 100644 --- a/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/impl/ProjectStaffServiceImpl.java +++ b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/impl/ProjectStaffServiceImpl.java @@ -21,11 +21,14 @@ 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.exception.RenException; import com.epmet.commons.tools.page.PageData; import com.epmet.commons.tools.utils.ConvertUtils; import com.epmet.commons.tools.utils.Result; +import com.epmet.constant.ProjectConstant; import com.epmet.dao.ProjectStaffDao; import com.epmet.dto.ProjectStaffDTO; +import com.epmet.dto.form.CanTickStaffListFormDTO; import com.epmet.dto.form.DepartmentStaffListFormDTO; import com.epmet.dto.result.DepartmentResultDTO; import com.epmet.dto.result.DepartmentStaffListResultDTO; @@ -120,8 +123,23 @@ public class ProjectStaffServiceImpl extends BaseServiceImpl resultDTOResult = govOrgFeignClient.departmentStaffList(formDTO.getAgencyId()); + //1:查询当前工作人员代表的是哪个部门(组织下的、组织部门下的、组织网格下的),用于在人员选择时去掉自己选自己的情况(自己选自己只的是当前工作的部门下的自己) + ProjectStaffEntity entity = baseDao.selectById(formDTO.getProjectStaffId()); + if (null == entity) { + throw new RenException(ProjectConstant.SELECT_PROJECTSTAFF_EXCEPTION); + } + //2:调用gov-org服务,分别查询组织下人员,组织下部门人员,组织下网格人员列表信息 + CanTickStaffListFormDTO canTick = new CanTickStaffListFormDTO(); + canTick.setAgencyId(formDTO.getAgencyId()); + canTick.setType("project"); + if(null!=entity.getDepartmentId()||!"".equals(entity.getDepartmentId())){ + canTick.setDeptOrGridId(entity.getDepartmentId()); + } + if(null!=entity.getGridId()||!"".equals(entity.getGridId())){ + canTick.setDeptOrGridId(entity.getGridId()); + } + canTick.setStaffId(formDTO.getStaffId()); + Result resultDTOResult = govOrgFeignClient.departmentStaffList(canTick); return resultDTOResult.getData(); }