From 2e749293e07c949307a2368874756a3c34114399 Mon Sep 17 00:00:00 2001 From: wangchao Date: Thu, 23 Apr 2020 17:11:19 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=E8=8E=B7=E5=8F=96=E5=BD=93=E5=89=8D?= =?UTF-8?q?=E6=9C=BA=E5=85=B3=E4=B8=8B=E7=BD=91=E6=A0=BC=E5=88=97=E8=A1=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/StaffAgencyController.java | 1 + .../com/epmet/feign/EpmetUserFeignClient.java | 2 ++ .../epmet/dto/form/CommonAgencyIdFormDTO.java | 29 ++++++++++++++++ .../dto/result/GridBaseInfoResultDTO.java | 32 ++++++++++++++++++ .../dto/result/GridListInfoResultDTO.java | 33 +++++++++++++++++++ .../java/com/epmet/dao/CustomerGridDao.java | 20 +++++++++++ .../epmet/service/CustomerGridService.java | 13 ++++++++ .../service/CustomerStaffGridService.java | 11 +++++++ .../service/impl/CustomerGridServiceImpl.java | 23 +++++++++++++ .../impl/CustomerStaffGridServiceImpl.java | 26 +++++++++++++++ .../main/resources/mapper/CustomerGridDao.xml | 25 ++++++++++++++ .../dto/result/CommonStaffInfoResultDTO.java | 31 +++++++++++++++++ .../result/UserInfoOnEnterGridResultDTO.java | 18 ++++++++++ 13 files changed, 264 insertions(+) create mode 100644 epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/CommonAgencyIdFormDTO.java create mode 100644 epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/GridBaseInfoResultDTO.java create mode 100644 epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/GridListInfoResultDTO.java create mode 100644 epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/CommonStaffInfoResultDTO.java diff --git a/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/controller/StaffAgencyController.java b/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/controller/StaffAgencyController.java index 6a9c00fe60..cd3dfa9295 100644 --- a/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/controller/StaffAgencyController.java +++ b/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/controller/StaffAgencyController.java @@ -97,4 +97,5 @@ public class StaffAgencyController { return staffAgencyService.getLatestGrid(latestGridFormDTO); } + } \ No newline at end of file diff --git a/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/feign/EpmetUserFeignClient.java b/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/feign/EpmetUserFeignClient.java index 287da51fec..aba15e9636 100644 --- a/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/feign/EpmetUserFeignClient.java +++ b/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/feign/EpmetUserFeignClient.java @@ -18,6 +18,8 @@ import org.springframework.web.bind.annotation.RequestBody; import java.util.List; +import java.util.List; + /** * @Description diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/CommonAgencyIdFormDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/CommonAgencyIdFormDTO.java new file mode 100644 index 0000000000..df06539bb4 --- /dev/null +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/CommonAgencyIdFormDTO.java @@ -0,0 +1,29 @@ +package com.epmet.dto.form; + +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import java.io.Serializable; + +/** + * @Description + * @ClassName CommonAgencyIdFormDTO + * @Author wangc + * @date 2020.04.23 14:37 + */ +@Data +public class CommonAgencyIdFormDTO implements Serializable { + private static final long serialVersionUID = -4634394162176710898L; + + /** + * 机构Id + * */ + @NotBlank(message = "机构Id不可为空") + private String agencyId; + + /** + * 用户Id(政府工作人员) + * */ + @NotBlank(message = "用户Id不能为空") + private String userId; +} diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/GridBaseInfoResultDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/GridBaseInfoResultDTO.java new file mode 100644 index 0000000000..df2bc63f60 --- /dev/null +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/GridBaseInfoResultDTO.java @@ -0,0 +1,32 @@ +package com.epmet.dto.result; + +import lombok.Data; + +import java.io.Serializable; + +/** + * @Description 网格基础信息DTO + * @ClassName GridBaseInfoResultDTO + * @Author wangc + * @date 2020.04.23 14:11 + */ +@Data +public class GridBaseInfoResultDTO implements Serializable { + + private static final long serialVersionUID = -5034984869469273329L; + + /** + * 网格Id + * */ + private String gridId; + + /** + * 网格名称 + * */ + private String gridName; + + /** + * 网格人数 + * */ + private Integer totalUser; +} diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/GridListInfoResultDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/GridListInfoResultDTO.java new file mode 100644 index 0000000000..8f1facbfc9 --- /dev/null +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/GridListInfoResultDTO.java @@ -0,0 +1,33 @@ +package com.epmet.dto.result; + +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; +import lombok.RequiredArgsConstructor; + +import java.io.Serializable; +import java.util.List; + +/** + * @Description 网格列表信息 + * @ClassName GridListInfoResultDTO + * @Author wangc + * @date 2020.04.23 14:21 + */ +@Data +@AllArgsConstructor +@RequiredArgsConstructor +@NoArgsConstructor +public class GridListInfoResultDTO implements Serializable { + private static final long serialVersionUID = -5513674274570559283L; + + /** + * 网格总数 + * */ + private Integer gridCount; + + /** + * 网格信息列表 + * */ + private List gridList; +} diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerGridDao.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerGridDao.java index d387278ec5..3cda7ddcc5 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerGridDao.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerGridDao.java @@ -25,8 +25,10 @@ import com.epmet.dto.form.ListCustomerGridFormDTO; import com.epmet.dto.result.CustomerGridByUserIdResultDTO; import com.epmet.dto.result.CustomerGridForStrangerResultDTO; import com.epmet.dto.result.GridDetailResultDTO; +import com.epmet.dto.result.GridBaseInfoResultDTO; import com.epmet.entity.CustomerGridEntity; import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; import java.util.List; import java.util.Map; @@ -86,4 +88,22 @@ public interface CustomerGridDao extends BaseDao { */ List selectUserIdByGridId(CustomerGridFormDTO customerGridFormDTO); + + /** + * @Description 得到当前机构的网格总数 + * @Param agencyId(String) 对应CUSTOMER_GRID中的PID字段 + * @return int + * @Author wangc + * @Date 2020.04.23 15:05 + **/ + int selectGridCountByAgencyId(@Param("agencyId") String agencyId); + + /** + * @Description 得到当前机构的网格详情列表 + * @Param agencyId(String) 对应CUSTOMER_GRID中的PID字段 + * @return List -> GridBaseInfoResultDTO :: getGridId :: getGridName :: getTotalUser + * @Author wangc + * @Date 2020.04.23 15:30 + **/ + List selectGridListByAgencyId(@Param("agencyId")String agencyId); } \ No newline at end of file diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/CustomerGridService.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/CustomerGridService.java index 5d427e434a..d0a5e69386 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/CustomerGridService.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/CustomerGridService.java @@ -21,11 +21,13 @@ 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.CustomerGridDTO; +import com.epmet.dto.form.CommonAgencyIdFormDTO; import com.epmet.dto.form.CustomerGridFormDTO; import com.epmet.dto.form.ListCustomerGridFormDTO; import com.epmet.dto.result.CustomerGridByUserIdResultDTO; import com.epmet.dto.result.CustomerGridForStrangerResultDTO; import com.epmet.dto.result.GridDetailResultDTO; +import com.epmet.dto.result.GridListInfoResultDTO; import com.epmet.entity.CustomerGridEntity; import java.util.List; @@ -130,4 +132,15 @@ public interface CustomerGridService extends BaseService { * @return */ Result griddetail(CustomerGridFormDTO customerGridFormDTO); + + /** + * @Description 查找指定机构下的网格列表 对应接口:/gov/org/grid/gridlist + * @Param CommonAgencyIdFormDTO -> gridId + * @return Result + * @Author wangc + * @Date 2020.04.23 14:45 + **/ + Result getGridListByAgency(CommonAgencyIdFormDTO agencyFormDTO); + + } \ 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 5a085e3d1d..2199eda56d 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,7 +21,9 @@ 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.CustomerGridFormDTO; import com.epmet.dto.form.LatestGridFormDTO; +import com.epmet.dto.result.CommonStaffInfoResultDTO; import com.epmet.dto.result.CustomerGridByUserIdResultDTO; import com.epmet.entity.CustomerStaffGridEntity; @@ -104,4 +106,13 @@ public interface CustomerStaffGridService extends BaseService getStaffGridOrderByGridName(LatestGridFormDTO latestGridFormDTO); + + /** + * @Description 获取添加网格成员的可选人员列表 + * @Param CustomerGridFormDTO + * @return com.epmet.dto.result.CommonStaffInfoResultDTO[epmet-user-client] + * @Author wangc + * @Date 2020.04.23 16:15 + **/ + Result> getSelectableStaffs(CustomerGridFormDTO customerGridFormDTO); } \ No newline at end of file diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerGridServiceImpl.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerGridServiceImpl.java index da136fb56a..2ab801c954 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerGridServiceImpl.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerGridServiceImpl.java @@ -28,11 +28,14 @@ import com.epmet.dao.CustomerGridDao; import com.epmet.dto.CustomerGridDTO; import com.epmet.dto.CustomerStaffGridDTO; import com.epmet.dto.StaffGridListDTO; +import com.epmet.dto.form.CommonAgencyIdFormDTO; import com.epmet.dto.form.CustomerGridFormDTO; import com.epmet.dto.form.ListCustomerGridFormDTO; import com.epmet.dto.result.CustomerGridByUserIdResultDTO; import com.epmet.dto.result.CustomerGridForStrangerResultDTO; import com.epmet.dto.result.GridDetailResultDTO; +import com.epmet.dto.result.GridBaseInfoResultDTO; +import com.epmet.dto.result.GridListInfoResultDTO; import com.epmet.entity.CustomerGridEntity; import com.epmet.feign.EpmetUserFeignClient; import com.epmet.redis.CustomerGridRedis; @@ -178,4 +181,24 @@ public class CustomerGridServiceImpl extends BaseServiceImpl().ok(griddetail); } + /** + * @Description 查找指定机构下的网格列表 对应接口:/gov/org/grid/gridlist + * @Param CommonAgencyIdFormDTO + * @return Result + * @Author wangc + * @Date 2020.04.23 14:45 + **/ + @Override + public Result getGridListByAgency(CommonAgencyIdFormDTO agencyFormDTO) { + + //1.查当前机构下网格总数 + int gridCount = baseDao.selectGridCountByAgencyId(agencyFormDTO.getAgencyId()); + //2.查当前机构下每个网格的详情 + List gridList = baseDao.selectGridListByAgencyId(agencyFormDTO.getAgencyId()); + //3.封装结果 + GridListInfoResultDTO resultData = new GridListInfoResultDTO(gridCount,gridList); + return new Result().ok(resultData); + } + + } 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 074ac2f36a..0f63802be7 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 @@ -27,9 +27,12 @@ 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.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; @@ -53,6 +56,9 @@ public class CustomerStaffGridServiceImpl extends BaseServiceImpl page(Map params) { IPage page = baseDao.selectPage( @@ -105,6 +111,13 @@ public class CustomerStaffGridServiceImpl extends BaseServiceImpl customerId ; staffId + * @return CustomerGridDTO + * @Author wangc + * @Date 2020.04.23 09:11 + **/ @Override public Result getStaffGridOrderByGridName(LatestGridFormDTO latestGridFormDTO) { CustomerGridDTO grid = baseDao.selectStaffGridOrderByGridName(latestGridFormDTO); @@ -115,4 +128,17 @@ public class CustomerStaffGridServiceImpl extends BaseServiceImpl().ok(result); } + /** + * @Description 获取添加网格成员的可选人员列表,先在本服务下查询userId,然后调用EpmetUserFeign校验账户是否被禁用,使用EpmetUser服务的DTO作为返回参数 + * @Param CustomerGridFormDTO -> gridId + * @return Result> -> CommonStaffInfoResultDTO [epmet-user-client] + * @Author wangc + * @Date 2020.04.23 16:28 + **/ + @Override + public Result> getSelectableStaffs(CustomerGridFormDTO customerGridFormDTO) { + + return null; + } + } \ No newline at end of file diff --git a/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerGridDao.xml b/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerGridDao.xml index f748ba157e..b58526d55f 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerGridDao.xml +++ b/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerGridDao.xml @@ -139,4 +139,29 @@ AND grid_id = #{gridId} + + + + + + \ No newline at end of file diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/CommonStaffInfoResultDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/CommonStaffInfoResultDTO.java new file mode 100644 index 0000000000..69a668fc7a --- /dev/null +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/CommonStaffInfoResultDTO.java @@ -0,0 +1,31 @@ +package com.epmet.dto.result; + +import lombok.Data; + +import java.io.Serializable; + +/** + * @Description 通用工作人员信息DTO + * @ClassName CommonStaffInfoResultDTO + * @Author wangc + * @date 2020.04.23 16:16 + */ +@Data +public class CommonStaffInfoResultDTO implements Serializable { + private static final long serialVersionUID = 4174593133225057232L; + + /** + * 工作人员用户Id + * */ + private String userId; + + /** + * 工作人员用户头像 + * */ + private String userHeadPhoto; + + /** + * 工作人员用户显示昵称 + * */ + private String userShowName; +} diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/UserInfoOnEnterGridResultDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/UserInfoOnEnterGridResultDTO.java index 5bcfd548cc..4f4d31bdb5 100644 --- a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/UserInfoOnEnterGridResultDTO.java +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/UserInfoOnEnterGridResultDTO.java @@ -15,16 +15,34 @@ import java.util.List; public class UserInfoOnEnterGridResultDTO implements Serializable{ private static final long serialVersionUID = 1L; + /** + * 当前客户Id + * */ private String currentCustomerId; + /** + * 当前网格Id + * */ private String currentGridId; + /** + * 当前网格名称 + * */ private String currentGridName; + /** + * 用户昵称 + * */ private String nickname; + /** + * 用户头像 + * */ private String userHeadPhoto; + /** + * 用户身份列表 + * */ private List userRoleList; } From f21e3a5a92673a649ffa7441be4cbbeb2cfb653e Mon Sep 17 00:00:00 2001 From: wangchao Date: Fri, 24 Apr 2020 17:06:31 +0800 Subject: [PATCH 2/3] =?UTF-8?q?=E6=9F=A5=E8=AF=A2=E7=BD=91=E6=A0=BC?= =?UTF-8?q?=E3=80=81=E9=83=A8=E9=97=A8=E5=8F=AF=E9=80=89=E4=BA=BA=E5=91=98?= =?UTF-8?q?=E5=88=97=E8=A1=A8=EF=BC=8C=E6=9F=A5=E8=AF=A2=E9=A6=96=E9=A1=B5?= =?UTF-8?q?=E7=BD=91=E6=A0=BC=E5=88=97=E8=A1=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../epmet/dto/form/CommonGridIdFormDTO.java | 29 ++++++++++++++ .../epmet/dto/form/CustomerGridFormDTO.java | 1 - .../CustomerStaffAgencyController.java | 6 ++- .../com/epmet/controller/GridController.java | 39 +++++++++++++++++++ .../com/epmet/dao/CustomerStaffAgencyDao.java | 13 +++++++ .../com/epmet/feign/EpmetUserFeignClient.java | 11 ++++++ .../EpmetUserFeignClientFallBack.java | 7 ++++ .../service/CustomerStaffAgencyService.java | 11 ++++++ .../service/CustomerStaffGridService.java | 9 ----- .../impl/CustomerStaffAgencyServiceImpl.java | 25 ++++++++++++ .../impl/CustomerStaffGridServiceImpl.java | 14 ------- .../main/resources/mapper/CustomerGridDao.xml | 36 +++++++++-------- .../mapper/CustomerStaffAgencyDao.xml | 31 +++++++++++++++ .../dto/form/CommonUserIdListFormList.java | 26 +++++++++++++ .../dto/result/CommonStaffInfoResultDTO.java | 11 ++++-- .../controller/CustomerStaffController.java | 15 +++++++ .../java/com/epmet/dao/CustomerStaffDao.java | 11 ++++++ .../epmet/service/CustomerStaffService.java | 11 ++++++ .../impl/CustomerStaffServiceImpl.java | 14 +++++++ .../resources/mapper/CustomerStaffDao.xml | 18 +++++++++ 20 files changed, 293 insertions(+), 45 deletions(-) create mode 100644 epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/CommonGridIdFormDTO.java create mode 100644 epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/CommonUserIdListFormList.java diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/CommonGridIdFormDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/CommonGridIdFormDTO.java new file mode 100644 index 0000000000..936aa4312b --- /dev/null +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/CommonGridIdFormDTO.java @@ -0,0 +1,29 @@ +package com.epmet.dto.form; + +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import java.io.Serializable; + +/** + * @Description + * @ClassName CommonGridIdFormDTO + * @Author wangc + * @date 2020.04.24 14:17 + */ +@Data +public class CommonGridIdFormDTO implements Serializable { + private static final long serialVersionUID = 2496019865436084805L; + + /** + * 网格Id + * */ + @NotBlank(message = "网格Id不能为空") + private String gridId; + + /** + * 用户Id + * */ + @NotBlank(message = "用户Id不能为空") + private String userId; +} diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/CustomerGridFormDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/CustomerGridFormDTO.java index c3c237e83a..c34d3c5870 100644 --- a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/CustomerGridFormDTO.java +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/CustomerGridFormDTO.java @@ -38,5 +38,4 @@ public class CustomerGridFormDTO implements Serializable { @NotBlank(message = "网格ID不能为空") private String gridId; - } \ No newline at end of file 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 fa1976bf6d..1f6904f416 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 @@ -17,7 +17,9 @@ 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; @@ -26,6 +28,9 @@ 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.dto.CustomerStaffAgencyDTO; +import com.epmet.dto.form.CommonGridIdFormDTO; +import com.epmet.dto.form.CustomerGridFormDTO; +import com.epmet.dto.result.CommonStaffInfoResultDTO; import com.epmet.dto.result.LatestCustomerResultDTO; import com.epmet.excel.CustomerStaffAgencyExcel; import com.epmet.service.CustomerStaffAgencyService; @@ -103,5 +108,4 @@ public class CustomerStaffAgencyController { public Result getLatestCustomer(@PathVariable("userId") String userId) { return customerStaffAgencyService.getLatestCustomer(userId); } - } \ No newline at end of file diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/GridController.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/GridController.java index 2f2b919b20..8367b6fc95 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/GridController.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/GridController.java @@ -1,15 +1,25 @@ 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.CommonAgencyIdFormDTO; +import com.epmet.dto.form.CommonGridIdFormDTO; import com.epmet.dto.form.CustomerGridFormDTO; +import com.epmet.dto.result.CommonStaffInfoResultDTO; import com.epmet.dto.result.GridDetailResultDTO; +import com.epmet.dto.result.GridListInfoResultDTO; import com.epmet.service.CustomerGridService; +import com.epmet.service.CustomerStaffAgencyService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; +import java.util.List; + /** * @Auther zxc * @Create 2020-04-23 9:50 @@ -21,6 +31,8 @@ public class GridController { @Autowired private CustomerGridService customerGridService; + @Autowired + private CustomerStaffAgencyService customerStaffAgencyService; @PostMapping("griddetail") public Result griddetail(@RequestBody CustomerGridFormDTO customerGridFormDTO){ Result griddetail = customerGridService.griddetail(customerGridFormDTO); @@ -33,4 +45,31 @@ public class GridController { @PostMapping("deletegrid")*/ + /** + * @Description 查找指定机构下的网格列表 + * @Param CommonAgencyIdFormDTO -> gridId + * @return Result + * @Author wangc + * @Date 2020.04.23 14:45 + **/ + @PostMapping("gridlist") + public Result gridList(@LoginUser TokenDto tokenDto,@RequestBody CommonAgencyIdFormDTO agencyFormDTO){ + agencyFormDTO.setAgencyId(tokenDto.getUserId()); + ValidatorUtils.validateEntity(agencyFormDTO); + return customerGridService.getGridListByAgency(agencyFormDTO); + } + + /** + * @Description 在给网格添加工作人员时,查询当前机关下没有加入到此网格下的工作人员,禁用的也不能选(不显示) + * @Param CommonGridIdFormDTO + * @return Result> + * @Author wangc + * @Date 2020.04.24 14:14 + **/ + @PostMapping("selectablestaffs") + public Result> selectableStaffs(@LoginUser TokenDto tokenDto, @RequestBody CommonGridIdFormDTO gridIdFormDTO){ + gridIdFormDTO.setUserId(tokenDto.getUserId()); + ValidatorUtils.validateEntity(gridIdFormDTO); + return customerStaffAgencyService.getSelectableStaffs(gridIdFormDTO); + } } 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 828c6cdd98..4691c4ed9b 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 @@ -19,8 +19,12 @@ package com.epmet.dao; import com.epmet.commons.mybatis.dao.BaseDao; import com.epmet.dto.CustomerStaffAgencyDTO; +import com.epmet.dto.form.CustomerGridFormDTO; import com.epmet.entity.CustomerStaffAgencyEntity; import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +import java.util.List; /** * 人员-机关单位关系表 @@ -37,5 +41,14 @@ public interface CustomerStaffAgencyDao extends BaseDao UserId列表 + * @Author wangc + * @Date 2020.04.24 14:01 + **/ + List getSelectableStaffsForGrid(@Param("gridId") String gridId); } \ No newline at end of file diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/feign/EpmetUserFeignClient.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/feign/EpmetUserFeignClient.java index 1774a21c15..f17f3e6261 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/feign/EpmetUserFeignClient.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/feign/EpmetUserFeignClient.java @@ -5,6 +5,8 @@ import com.epmet.commons.tools.utils.Result; import com.epmet.dto.CustomerStaffDTO; import com.epmet.dto.CustomerStaffGridDTO; import com.epmet.dto.StaffGridListDTO; +import com.epmet.dto.form.CommonUserIdListFormList; +import com.epmet.dto.result.CommonStaffInfoResultDTO; import com.epmet.feign.fallback.EpmetUserFeignClientFallBack; import org.springframework.cloud.openfeign.FeignClient; import org.springframework.web.bind.annotation.PostMapping; @@ -33,4 +35,13 @@ public interface EpmetUserFeignClient { @PostMapping("/epmetuser/customerstaff/selectstaffgridlistbyuserid") Result> getStaffGridList(@RequestBody List customerStaffGridDTOS); + /** + * @Description 通过userId列表查询未被禁用的用户信息 + * @Param CommonUserIdListFormList :: getUserIdList + * @return Result> + * @Author wangc + * @Date 2020.04.24 15:44 + **/ + @PostMapping("/epmetuser/customerstaff/enabestaffmsglist") + Result> enableStaffMsgList(CommonUserIdListFormList userIdList); } diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/feign/fallback/EpmetUserFeignClientFallBack.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/feign/fallback/EpmetUserFeignClientFallBack.java index 05b26449b3..d8940ede62 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/feign/fallback/EpmetUserFeignClientFallBack.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/feign/fallback/EpmetUserFeignClientFallBack.java @@ -6,6 +6,8 @@ import com.epmet.commons.tools.utils.Result; import com.epmet.dto.CustomerStaffDTO; import com.epmet.dto.CustomerStaffGridDTO; import com.epmet.dto.StaffGridListDTO; +import com.epmet.dto.form.CommonUserIdListFormList; +import com.epmet.dto.result.CommonStaffInfoResultDTO; import com.epmet.feign.EpmetUserFeignClient; import org.springframework.stereotype.Component; @@ -25,4 +27,9 @@ public class EpmetUserFeignClientFallBack implements EpmetUserFeignClient { public Result> getStaffGridList(List customerStaffGridDTOS) { return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "getStaffGridList", customerStaffGridDTOS); } + + @Override + public Result> enableStaffMsgList(CommonUserIdListFormList userIdList) { + return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "enableStaffMsgList", userIdList); + } } 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 2aaee92578..4f531dc929 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,6 +21,8 @@ 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.CommonGridIdFormDTO; +import com.epmet.dto.result.CommonStaffInfoResultDTO; import com.epmet.dto.result.LatestCustomerResultDTO; import com.epmet.entity.CustomerStaffAgencyEntity; @@ -102,4 +104,13 @@ public interface CustomerStaffAgencyService extends BaseService getLatestCustomer(String userId); + + /** + * @Description 获取添加网格成员的可选人员列表 + * @Param CommonGridIdFormDTO + * @return com.epmet.dto.result.CommonStaffInfoResultDTO[epmet-user-client] + * @Author wangc + * @Date 2020.04.23 16:15 + **/ + Result> getSelectableStaffs(CommonGridIdFormDTO 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 2199eda56d..cf5285b735 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 @@ -106,13 +106,4 @@ public interface CustomerStaffGridService extends BaseService getStaffGridOrderByGridName(LatestGridFormDTO latestGridFormDTO); - - /** - * @Description 获取添加网格成员的可选人员列表 - * @Param CustomerGridFormDTO - * @return com.epmet.dto.result.CommonStaffInfoResultDTO[epmet-user-client] - * @Author wangc - * @Date 2020.04.23 16:15 - **/ - Result> getSelectableStaffs(CustomerGridFormDTO customerGridFormDTO); } \ No newline at end of file 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 212e5246a1..df4c0114a5 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 @@ -20,6 +20,7 @@ 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.NumConstant; import com.epmet.commons.tools.page.PageData; import com.epmet.commons.tools.utils.ConvertUtils; import com.epmet.commons.tools.constant.FieldConstant; @@ -28,6 +29,9 @@ import com.epmet.dao.CustomerStaffAgencyDao; import com.epmet.dto.CustomerDTO; import com.epmet.dto.CustomerStaffAgencyDTO; import com.epmet.dto.CustomerStaffDTO; +import com.epmet.dto.form.CommonGridIdFormDTO; +import com.epmet.dto.form.CommonUserIdListFormList; +import com.epmet.dto.result.CommonStaffInfoResultDTO; import com.epmet.dto.result.LatestCustomerResultDTO; import com.epmet.entity.CustomerStaffAgencyEntity; import com.epmet.feign.EpmetUserFeignClient; @@ -39,6 +43,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; @@ -133,4 +138,24 @@ public class CustomerStaffAgencyServiceImpl extends BaseServiceImpl().ok(resultDTO); } + /** + * @Description 获取添加网格成员的可选人员列表,先在本服务下查询userId,然后调用EpmetUserFeign校验账户是否被禁用,使用EpmetUser服务的DTO作为返回参数 + * @Param CustomerGridFormDTO -> gridId + * @return Result> -> CommonStaffInfoResultDTO [epmet-user-client] + * @Author wangc + * @Date 2020.04.23 16:28 + **/ + @Override + public Result> getSelectableStaffs(CommonGridIdFormDTO customerGridFormDTO) { + //1.去数据库查询是此网格所属机构且不在此网格下的工作人员,这里无法确认是否被禁用 + List userId = baseDao.getSelectableStaffsForGrid(customerGridFormDTO.getGridId()); + //2.去用户服务下拿取用户基本信息,并校验工作人员身份是否被禁用 + if(null != userId && userId.size() >= NumConstant.ONE){ + //直接返回结果 + return epmetUserFeignClient.enableStaffMsgList(new CommonUserIdListFormList(userId)); + + } + return new Result>().ok(new ArrayList<>()); + } + } \ 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 0f63802be7..4bdf464241 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 @@ -127,18 +127,4 @@ public class CustomerStaffGridServiceImpl extends BaseServiceImpl().ok(result); } - - /** - * @Description 获取添加网格成员的可选人员列表,先在本服务下查询userId,然后调用EpmetUserFeign校验账户是否被禁用,使用EpmetUser服务的DTO作为返回参数 - * @Param CustomerGridFormDTO -> gridId - * @return Result> -> CommonStaffInfoResultDTO [epmet-user-client] - * @Author wangc - * @Date 2020.04.23 16:28 - **/ - @Override - public Result> getSelectableStaffs(CustomerGridFormDTO customerGridFormDTO) { - - return null; - } - } \ No newline at end of file diff --git a/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerGridDao.xml b/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerGridDao.xml index b58526d55f..d0dbc092e2 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerGridDao.xml +++ b/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerGridDao.xml @@ -141,27 +141,29 @@ \ 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 016f75962a..77a21938b0 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 @@ -29,4 +29,35 @@ LIMIT 1 + + + + + + \ No newline at end of file diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/CommonUserIdListFormList.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/CommonUserIdListFormList.java new file mode 100644 index 0000000000..86c49a60c9 --- /dev/null +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/CommonUserIdListFormList.java @@ -0,0 +1,26 @@ +package com.epmet.dto.form; + +import lombok.AllArgsConstructor; +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import java.io.Serializable; +import java.util.List; + +/** + * @Description 通用用户Id列表参数DTO + * @ClassName CommonUserIdListFormList + * @Author wangc + * @date 2020.04.24 15:42 + */ +@Data +@AllArgsConstructor +public class CommonUserIdListFormList implements Serializable{ + private static final long serialVersionUID = -7045691156972928671L; + + /** + * 用户列表 + * */ + @NotBlank(message = "用户列表不能为空") + private List userIdList; +} diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/CommonStaffInfoResultDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/CommonStaffInfoResultDTO.java index 69a668fc7a..f7b7f9b56e 100644 --- a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/CommonStaffInfoResultDTO.java +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/CommonStaffInfoResultDTO.java @@ -17,15 +17,20 @@ public class CommonStaffInfoResultDTO implements Serializable { /** * 工作人员用户Id * */ - private String userId; + private String staffId; /** * 工作人员用户头像 * */ - private String userHeadPhoto; + private String staffHeadPhoto; /** * 工作人员用户显示昵称 * */ - private String userShowName; + private String staffName; + + /** + * 性别 1男2女0未知 + * */ + private Integer gender; } 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 103d4163fc..683c7eaeed 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 @@ -28,8 +28,10 @@ import com.epmet.commons.tools.validator.group.UpdateGroup; import com.epmet.dto.CustomerStaffDTO; import com.epmet.dto.CustomerStaffGridDTO; import com.epmet.dto.StaffGridListDTO; +import com.epmet.dto.form.CommonUserIdListFormList; import com.epmet.dto.form.CustomerGridFormDTO; import com.epmet.dto.form.CustomerStaffFormDTO; +import com.epmet.dto.result.CommonStaffInfoResultDTO; import com.epmet.excel.CustomerStaffExcel; import com.epmet.service.CustomerStaffService; import org.springframework.beans.factory.annotation.Autowired; @@ -143,4 +145,17 @@ public class CustomerStaffController { public Result getCustomerStaffInfoByUserId(CustomerStaffDTO formDTO) { return customerStaffService.getCustomerStaffInfoByUserId(formDTO); } + + /** + * @Description 通过userId列表查询未被禁用的用户信息 + * @Param CommonUserIdListFormList :: getUserIdList + * @return Result> + * @Author wangc + * @Date 2020.04.24 15:44 + **/ + @PostMapping(value = "enabestaffmsglist") + public Result> enableStaffMsgList(@RequestBody CommonUserIdListFormList userIdList){ + ValidatorUtils.validateEntity(userIdList); + return customerStaffService.getEnableStaffMsgList(userIdList); + } } \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/CustomerStaffDao.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/CustomerStaffDao.java index 14d91f75e9..367fe51ec8 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/CustomerStaffDao.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/CustomerStaffDao.java @@ -22,8 +22,10 @@ import com.epmet.dto.CustomerStaffDTO; import com.epmet.dto.CustomerStaffGridDTO; import com.epmet.dto.StaffGridListDTO; import com.epmet.dto.form.CustomerStaffFormDTO; +import com.epmet.dto.result.CommonStaffInfoResultDTO; import com.epmet.entity.CustomerStaffEntity; import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; import java.util.List; @@ -62,4 +64,13 @@ public interface CustomerStaffDao extends BaseDao { * @return */ List selectStaffGridListByUserId(List customerStaffGridDTOS); + + /** + * @Description 根据UserId列表查询用信息,过滤掉被禁用的,包含未激活的 + * @Param List + * @return List + * @Author wangc + * @Date 2020.04.24 15:34 + **/ + List selectEnableStaffMsg(@Param("userIds") List userIds); } \ 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 3775510742..05cfa0aed6 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 @@ -23,8 +23,10 @@ import com.epmet.commons.tools.utils.Result; import com.epmet.dto.CustomerStaffDTO; import com.epmet.dto.CustomerStaffGridDTO; import com.epmet.dto.StaffGridListDTO; +import com.epmet.dto.form.CommonUserIdListFormList; import com.epmet.dto.form.CustomerGridFormDTO; import com.epmet.dto.form.CustomerStaffFormDTO; +import com.epmet.dto.result.CommonStaffInfoResultDTO; import com.epmet.entity.CustomerStaffEntity; import java.util.List; @@ -132,4 +134,13 @@ public interface CustomerStaffService extends BaseService { * @return */ Result> selectStaffGridListByUserId(List customerStaffGridDTOS); + + /** + * @Description 通过userId列表查询未被禁用的用户信息 + * @Param CommonUserIdListFormList :: getUserIdList + * @return Result> + * @Author wangc + * @Date 2020.04.24 15:44 + **/ + Result> getEnableStaffMsgList(CommonUserIdListFormList userIdList); } \ No newline at end of file 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 4ac6f5a529..2cc9e539c8 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 @@ -30,8 +30,10 @@ import com.epmet.dao.CustomerStaffDao; import com.epmet.dto.CustomerStaffDTO; import com.epmet.dto.CustomerStaffGridDTO; import com.epmet.dto.StaffGridListDTO; +import com.epmet.dto.form.CommonUserIdListFormList; import com.epmet.dto.form.CustomerGridFormDTO; import com.epmet.dto.form.CustomerStaffFormDTO; +import com.epmet.dto.result.CommonStaffInfoResultDTO; import com.epmet.entity.CustomerStaffEntity; import com.epmet.redis.CustomerStaffRedis; import com.epmet.service.CustomerStaffService; @@ -149,4 +151,16 @@ public class CustomerStaffServiceImpl extends BaseServiceImpl>().ok(staffGridListDTOS); } + /** + * @Description 通过userId列表查询未被禁用的用户信息 + * @Param CommonUserIdListFormList :: getUserIdList + * @return Result> + * @Author wangc + * @Date 2020.04.24 15:44 + **/ + @Override + public Result> getEnableStaffMsgList(CommonUserIdListFormList userIdList) { + return new Result>().ok(baseDao.selectEnableStaffMsg(userIdList.getUserIdList())); + } + } \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/resources/mapper/CustomerStaffDao.xml b/epmet-user/epmet-user-server/src/main/resources/mapper/CustomerStaffDao.xml index 2e44e2b582..e13443bd23 100644 --- a/epmet-user/epmet-user-server/src/main/resources/mapper/CustomerStaffDao.xml +++ b/epmet-user/epmet-user-server/src/main/resources/mapper/CustomerStaffDao.xml @@ -41,4 +41,22 @@ AND cs.del_flag = 0 + + + \ No newline at end of file From bd4c80705b64ecf8460cea0d3051bda148646297 Mon Sep 17 00:00:00 2001 From: wangchao Date: Sun, 26 Apr 2020 18:06:01 +0800 Subject: [PATCH 3/3] =?UTF-8?q?=E7=BD=91=E6=A0=BC=E7=AE=A1=E7=90=86?= =?UTF-8?q?=E3=80=81=E9=83=A8=E9=97=A8=E7=AE=A1=E7=90=86=E6=8E=A5=E5=8F=A3?= =?UTF-8?q?=E7=9B=B8=E5=85=B3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../dto/form/CommonDepartmentFormDTO.java | 30 ++++ .../CommonDepartmentStaffInfoFormDTO.java | 35 ++++ .../dto/form/CommonGridStaffInfoFormDTO.java | 35 ++++ .../dto/form/CommonGridStaffListFromDTO.java | 38 ++++ .../dto/result/GridListInfoResultDTO.java | 2 - .../controller/DepartmentController.java | 38 +++- .../com/epmet/controller/GridController.java | 54 +++++- .../java/com/epmet/dao/CustomerGridDao.java | 2 +- .../com/epmet/dao/CustomerStaffAgencyDao.java | 8 + .../com/epmet/dao/CustomerStaffGridDao.java | 24 +++ .../com/epmet/feign/EpmetUserFeignClient.java | 26 +-- .../EpmetUserFeignClientFallBack.java | 19 +- .../epmet/service/CustomerGridService.java | 33 +++- .../service/CustomerStaffAgencyService.java | 10 ++ .../com/epmet/service/DepartmentService.java | 9 + .../service/impl/CustomerGridServiceImpl.java | 168 ++++++++++++++++-- .../impl/CustomerStaffAgencyServiceImpl.java | 47 +++-- .../service/impl/DepartmentServiceImpl.java | 42 +++++ .../java/com/epmet/util/ModuleConstant.java | 35 ++++ .../main/resources/mapper/CustomerGridDao.xml | 9 +- .../mapper/CustomerStaffAgencyDao.xml | 33 +++- .../resources/mapper/CustomerStaffGridDao.xml | 45 +++++ .../com/epmet/dto/form/CommonUserFormDTO.java | 29 +++ ...List.java => CommonUserIdListFormDTO.java} | 8 +- .../epmet/dto/result/StaffRolesResultDTO.java | 32 ++++ .../controller/CustomerStaffController.java | 6 +- .../epmet/controller/StaffRoleController.java | 15 ++ .../java/com/epmet/dao/CustomerStaffDao.java | 7 +- .../main/java/com/epmet/dao/StaffRoleDao.java | 11 ++ .../epmet/service/CustomerStaffService.java | 6 +- .../com/epmet/service/StaffRoleService.java | 12 ++ .../impl/CustomerStaffServiceImpl.java | 8 +- .../service/impl/StaffRoleServiceImpl.java | 15 ++ .../resources/mapper/CustomerStaffDao.xml | 2 + .../main/resources/mapper/StaffRoleDao.xml | 31 ++++ 35 files changed, 835 insertions(+), 89 deletions(-) create mode 100644 epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/CommonDepartmentFormDTO.java create mode 100644 epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/CommonDepartmentStaffInfoFormDTO.java create mode 100644 epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/CommonGridStaffInfoFormDTO.java create mode 100644 epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/CommonGridStaffListFromDTO.java create mode 100644 epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/CommonUserFormDTO.java rename epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/{CommonUserIdListFormList.java => CommonUserIdListFormDTO.java} (70%) create mode 100644 epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/StaffRolesResultDTO.java diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/CommonDepartmentFormDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/CommonDepartmentFormDTO.java new file mode 100644 index 0000000000..d821ba7ede --- /dev/null +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/CommonDepartmentFormDTO.java @@ -0,0 +1,30 @@ +package com.epmet.dto.form; + +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import java.io.Serializable; + +/** + * @Description + * @ClassName CommonDepartmentFormDTO + * @Author wangc + * @date 2020.04.26 16:21 + */ +@Data +public class CommonDepartmentFormDTO implements Serializable { + + private static final long serialVersionUID = -7557299771900280575L; + + /** + * 部门Id + * */ + @NotBlank(message = "部门Id不能为空") + private String departmentId; + + /** + * 用户Id + * */ + @NotBlank(message = "用户Id不能为空") + private String userId; +} diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/CommonDepartmentStaffInfoFormDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/CommonDepartmentStaffInfoFormDTO.java new file mode 100644 index 0000000000..9b08da473e --- /dev/null +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/CommonDepartmentStaffInfoFormDTO.java @@ -0,0 +1,35 @@ +package com.epmet.dto.form; + +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import java.io.Serializable; + +/** + * @Description + * @ClassName CommonDepartmentStaffInfoFormDTO + * @Author wangc + * @date 2020.04.26 16:52 + */ +@Data +public class CommonDepartmentStaffInfoFormDTO implements Serializable { + private static final long serialVersionUID = 2895745833519899428L; + + /** + * 部门Id + * */ + @NotBlank(message = "部门Id") + private String departmentId; + + /** + * 工作人员Id + * */ + @NotBlank(message = "工作人员Id不能为空") + private String staffId; + + /** + * 用户Id + * */ + @NotBlank(message = "用户Id不能为空") + private String userId; +} diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/CommonGridStaffInfoFormDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/CommonGridStaffInfoFormDTO.java new file mode 100644 index 0000000000..8307f12258 --- /dev/null +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/CommonGridStaffInfoFormDTO.java @@ -0,0 +1,35 @@ +package com.epmet.dto.form; + +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import java.io.Serializable; + +/** + * @Description 通用的网格工作人员入参DTO 包含网格Id和用户Id + * @ClassName CommonGridStaffInfoFormDTO + * @Author wangc + * @date 2020.04.26 09:38 + */ +@Data +public class CommonGridStaffInfoFormDTO implements Serializable{ + private static final long serialVersionUID = 6345334778886091374L; + + /** + * 网格Id + * */ + @NotBlank(message = "网格Id不能为空") + private String gridId; + + /** + * 员工Id + * */ + @NotBlank(message = "工作人员Id不能为空") + private String staffId; + + /** + * 当前操作人 + * */ + @NotBlank(message = "用户Id不能为空") + private String userId; +} diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/CommonGridStaffListFromDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/CommonGridStaffListFromDTO.java new file mode 100644 index 0000000000..6342518664 --- /dev/null +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/CommonGridStaffListFromDTO.java @@ -0,0 +1,38 @@ +package com.epmet.dto.form; + +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import java.io.Serializable; +import java.util.List; + +/** + * @Description 通用的网格工作人员列表入参DTO 包含网格Id和用户Id集合 + * @ClassName CommonGridStaffListFromDTO + * @Author wangc + * @date 2020.04.26 09:38 + */ +@Data +public class CommonGridStaffListFromDTO implements Serializable{ + + private static final long serialVersionUID = -5753128515827497700L; + + /** + * 网格Id + * */ + @NotBlank(message = "网格Id不能为空") + private String gridId; + + /** + * 员工Id列表 + * */ + @NotBlank(message = "工作人员Id不能为空") + private List selectedList; + + /** + * 当前操作人 + * */ + @NotBlank(message = "用户Id不能为空") + private String userId; + +} diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/GridListInfoResultDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/GridListInfoResultDTO.java index 8f1facbfc9..110ecf7cf4 100644 --- a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/GridListInfoResultDTO.java +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/GridListInfoResultDTO.java @@ -16,8 +16,6 @@ import java.util.List; */ @Data @AllArgsConstructor -@RequiredArgsConstructor -@NoArgsConstructor public class GridListInfoResultDTO implements Serializable { private static final long serialVersionUID = -5513674274570559283L; diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/DepartmentController.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/DepartmentController.java index 33a1d7fe87..2a748a9507 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/DepartmentController.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/DepartmentController.java @@ -3,11 +3,10 @@ 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.AddDepartmentResultDTO; -import com.epmet.dto.result.DepartmentDetailResultDTO; -import com.epmet.dto.result.DepartmentInAgencyResultDTO; -import com.epmet.dto.result.DepartmentListResultDTO; +import com.epmet.dto.result.*; +import com.epmet.service.CustomerStaffAgencyService; import com.epmet.service.DepartmentService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.PostMapping; @@ -28,6 +27,8 @@ public class DepartmentController { @Autowired private DepartmentService departmentService; + @Autowired + private CustomerStaffAgencyService customerStaffAgencyService; @PostMapping(value = "adddepartmentstaff") public Result addDepartmentStaff(@LoginUser TokenDto tokenDto, @RequestBody AddDepartmentFormDTO addDepartmentFormDTO){ @@ -99,4 +100,33 @@ public class DepartmentController { public Result> departmentList(@RequestBody DepartmentListFormDTO formDTO) { return departmentService.departmentList(formDTO); } + + /** + * @Description 查询加入部门的可选人员列表 + * @Param TokenDto + * @Param CommonDepartmentFormDTO + * @return Result> + * @Author wangc + * @Date 2020.04.26 16:47 + **/ + @PostMapping("selectablestaffs") + public Result> selectableStaffs(@LoginUser TokenDto tokenDto,@RequestBody CommonDepartmentFormDTO departmentFormDTO){ + departmentFormDTO.setUserId(tokenDto.getUserId()); + ValidatorUtils.validateEntity(departmentFormDTO); + return customerStaffAgencyService.getSelectableDeptStaffs(departmentFormDTO); + } + + /** + * @Description 移除部门人员 + * @Param TokenDto + * @Param CommonDepartmentStaffInfoFormDTO + * @return Result + * @Author wangc + * @Date 2020.04.26 17:09 + **/ + public Result removeStaff(@LoginUser TokenDto tokenDto,@RequestBody CommonDepartmentStaffInfoFormDTO departmentStaffInfoFormDTO){ + departmentStaffInfoFormDTO.setUserId(tokenDto.getUserId()); + ValidatorUtils.validateEntity(departmentStaffInfoFormDTO); + return departmentService.removeStaff(departmentStaffInfoFormDTO); + } } \ No newline at end of file diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/GridController.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/GridController.java index 6e479cb1b6..bc751b6e88 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/GridController.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/GridController.java @@ -3,15 +3,11 @@ 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.dto.form.AddGridFormDTO; +import com.epmet.dto.form.*; import com.epmet.commons.tools.validator.ValidatorUtils; -import com.epmet.dto.form.CommonAgencyIdFormDTO; -import com.epmet.dto.form.CommonGridIdFormDTO; -import com.epmet.dto.form.CustomerGridFormDTO; -import com.epmet.dto.form.DeleteGridFormDTO; -import com.epmet.dto.form.EditGridFormDTO; import com.epmet.dto.result.AddGridResultDTO; import com.epmet.dto.result.CommonStaffInfoResultDTO; +import com.epmet.dto.result.GridBaseInfoResultDTO; import com.epmet.dto.result.GridDetailResultDTO; import com.epmet.dto.result.GridListInfoResultDTO; import com.epmet.service.CustomerGridService; @@ -76,7 +72,7 @@ public class GridController { /** * @Description 查找指定机构下的网格列表 - * @Param CommonAgencyIdFormDTO -> gridId + * @Param CommonAgencyIdFormDTO -> agencyId * @return Result * @Author wangc * @Date 2020.04.23 14:45 @@ -88,6 +84,20 @@ public class GridController { return customerGridService.getGridListByAgency(agencyFormDTO); } + /** + * @Description 查找指定机构下的全部网格列表 + * @Param CommonAgencyIdFormDTO -> agencyId + * @return Result + * @Author wangc + * @Date 2020.04.23 14:45 + **/ + @PostMapping("allgrids") + public Result> allGrids(@LoginUser TokenDto tokenDto, @RequestBody CommonAgencyIdFormDTO agencyFormDTO){ + agencyFormDTO.setAgencyId(tokenDto.getUserId()); + ValidatorUtils.validateEntity(agencyFormDTO); + return customerGridService.getAllGridsByAgency(agencyFormDTO); + } + /** * @Description 在给网格添加工作人员时,查询当前机关下没有加入到此网格下的工作人员,禁用的也不能选(不显示) * @Param CommonGridIdFormDTO @@ -101,4 +111,34 @@ public class GridController { ValidatorUtils.validateEntity(gridIdFormDTO); return customerStaffAgencyService.getSelectableStaffs(gridIdFormDTO); } + + /** + * @Description 添加网格工作人员 批量 + * @Param tokenDto + * @Param CommonGridStaffListFromDTO + * @return Result + * @Author wangc + * @Date 2020.04.26 15:36 + **/ + @PostMapping("addgridstaffs") + public Result addGridStaffs(@LoginUser TokenDto tokenDto, @RequestBody CommonGridStaffListFromDTO commonGridStaffListFromDTO){ + commonGridStaffListFromDTO.setUserId(tokenDto.getUserId()); + ValidatorUtils.validateEntity(tokenDto); + return customerGridService.addGridStaffs(commonGridStaffListFromDTO); + } + + /** + * @Description 移除网格工作人员 + * @Param tokenDto + * @Param CommonGridStaffInfoFormDTO + * @return Result + * @Author wangc + * @Date 2020.04.26 15:36 + **/ + @PostMapping("removegridstaff") + public Result removeGridStaff(@LoginUser TokenDto tokenDto, @RequestBody CommonGridStaffInfoFormDTO commonGridStaffInfoFormDTO){ + commonGridStaffInfoFormDTO.setUserId(tokenDto.getUserId()); + ValidatorUtils.validateEntity(tokenDto); + return customerGridService.removeGridStaff(commonGridStaffInfoFormDTO); + } } diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerGridDao.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerGridDao.java index c7c6179315..ba82240496 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerGridDao.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerGridDao.java @@ -142,5 +142,5 @@ public interface CustomerGridDao extends BaseDao { * @Author wangc * @Date 2020.04.23 15:30 **/ - List selectGridListByAgencyId(@Param("agencyId")String agencyId); + List selectGridListByAgencyId(@Param("agencyId")String agencyId,@Param("pageSize")Integer pageSize); } \ 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 215eddd613..9de920b942 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 @@ -60,4 +60,12 @@ public interface CustomerStaffAgencyDao extends BaseDao getSelectableStaffsForGrid(@Param("gridId") String gridId); + /** + * @Description 查询当前网格所属机构下的不在此部门的工作人员Id(禁用未知) + * @Param gridId (String) + * @return List UserId列表 + * @Author wangc + * @Date 2020.04.26 16:33 + **/ + List getSelectableStaffsForDept(@Param("departmentId") String departmentId); } \ No newline at end of file diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerStaffGridDao.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerStaffGridDao.java index dc61c9039f..c0e8691363 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerStaffGridDao.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerStaffGridDao.java @@ -19,9 +19,15 @@ package com.epmet.dao; import com.epmet.commons.mybatis.dao.BaseDao; import com.epmet.dto.CustomerGridDTO; +import com.epmet.dto.CustomerStaffGridDTO; import com.epmet.dto.form.LatestGridFormDTO; import com.epmet.entity.CustomerStaffGridEntity; import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +import java.util.HashSet; +import java.util.List; +import java.util.Set; /** * 网格人员关系表 @@ -41,4 +47,22 @@ public interface CustomerStaffGridDao extends BaseDao { **/ CustomerGridDTO selectStaffGridOrderByGridName(LatestGridFormDTO latestGridFormDTO); + /** + * @Description 校验用户是否已加入当前网格 + * @Param userIds + * @Param gridId + * @return Set + * @Author wangc + * @Date 2020.04.26 14:08 + **/ + Set distinctGridStaffs(@Param("userIds")List userIds, @Param("gridId")String gridId); + + /** + * @Description 批量插入网格工作人员 + * @Param List + * @return + * @Author wangc + * @Date 2020.04.26 14:57 + **/ + void insertBatch(List list); } \ No newline at end of file diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/feign/EpmetUserFeignClient.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/feign/EpmetUserFeignClient.java index e9fa4a5d6e..5ccd374e31 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/feign/EpmetUserFeignClient.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/feign/EpmetUserFeignClient.java @@ -3,19 +3,11 @@ package com.epmet.feign; import com.epmet.commons.tools.constant.ServiceConstant; import com.epmet.commons.tools.utils.Result; import com.epmet.dto.*; -import com.epmet.dto.form.DepartmentInStaffFormDTO; -import com.epmet.dto.form.StaffInfoFromDTO; -import com.epmet.dto.form.StaffSubmitFromDTO; -import com.epmet.dto.form.StaffsInAgencyFromDTO; -import com.epmet.dto.result.DepartInStaffListResultDTO; -import com.epmet.dto.result.StaffDetailResultDTO; -import com.epmet.dto.result.StaffInfoResultDTO; -import com.epmet.dto.result.StaffInitResultDTO; +import com.epmet.dto.form.*; +import com.epmet.dto.result.*; import com.epmet.dto.CustomerStaffDTO; import com.epmet.dto.CustomerStaffGridDTO; import com.epmet.dto.StaffGridListDTO; -import com.epmet.dto.form.CommonUserIdListFormList; -import com.epmet.dto.result.CommonStaffInfoResultDTO; import com.epmet.feign.fallback.EpmetUserFeignClientFallBack; import org.springframework.cloud.openfeign.FeignClient; import org.springframework.web.bind.annotation.PostMapping; @@ -127,11 +119,21 @@ public interface EpmetUserFeignClient { /** * @Description 通过userId列表查询未被禁用的用户信息 - * @Param CommonUserIdListFormList :: getUserIdList + * @Param CommonUserIdListFormDTO :: getUserIdList * @return Result> * @Author wangc * @Date 2020.04.24 15:44 **/ @PostMapping("/epmetuser/customerstaff/enabestaffmsglist") - Result> enableStaffMsgList(CommonUserIdListFormList userIdList); + Result> enableStaffMsgList(CommonUserIdListFormDTO userIdList); + + /** + * @Description 查询一个员工在指定客户下的角色 + * @Param CommonUserFormDTO + * @return Result + * @Author wangc + * @Date 2020.04.26 13:08 + **/ + @PostMapping("/epmetuser/staffrole/getcustomerstaffroles") + Result getCustomerStaffRoles(CommonUserFormDTO commonUserFormDTO); } diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/feign/fallback/EpmetUserFeignClientFallBack.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/feign/fallback/EpmetUserFeignClientFallBack.java index ee6df9e3f0..809771ee5a 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/feign/fallback/EpmetUserFeignClientFallBack.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/feign/fallback/EpmetUserFeignClientFallBack.java @@ -4,19 +4,11 @@ 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.*; -import com.epmet.dto.form.DepartmentInStaffFormDTO; -import com.epmet.dto.form.StaffInfoFromDTO; -import com.epmet.dto.form.StaffSubmitFromDTO; -import com.epmet.dto.form.StaffsInAgencyFromDTO; -import com.epmet.dto.result.DepartInStaffListResultDTO; -import com.epmet.dto.result.StaffDetailResultDTO; -import com.epmet.dto.result.StaffInfoResultDTO; -import com.epmet.dto.result.StaffInitResultDTO; +import com.epmet.dto.form.*; +import com.epmet.dto.result.*; import com.epmet.dto.CustomerStaffDTO; import com.epmet.dto.CustomerStaffGridDTO; import com.epmet.dto.StaffGridListDTO; -import com.epmet.dto.form.CommonUserIdListFormList; -import com.epmet.dto.result.CommonStaffInfoResultDTO; import com.epmet.feign.EpmetUserFeignClient; import org.springframework.stereotype.Component; @@ -89,7 +81,12 @@ public class EpmetUserFeignClientFallBack implements EpmetUserFeignClient { } @Override - public Result> enableStaffMsgList(CommonUserIdListFormList userIdList) { + public Result> enableStaffMsgList(CommonUserIdListFormDTO userIdList) { return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "enableStaffMsgList", userIdList); } + + @Override + public Result getCustomerStaffRoles(CommonUserFormDTO commonUserFormDTO) { + return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "getCustomerStaffRoles", commonUserFormDTO); + } } diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/CustomerGridService.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/CustomerGridService.java index 12bf528f5b..45d3572e74 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/CustomerGridService.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/CustomerGridService.java @@ -28,10 +28,7 @@ import com.epmet.dto.result.AddGridResultDTO; import com.epmet.dto.form.CommonAgencyIdFormDTO; import com.epmet.dto.form.CustomerGridFormDTO; import com.epmet.dto.form.ListCustomerGridFormDTO; -import com.epmet.dto.result.CustomerGridByUserIdResultDTO; -import com.epmet.dto.result.CustomerGridForStrangerResultDTO; -import com.epmet.dto.result.GridDetailResultDTO; -import com.epmet.dto.result.GridListInfoResultDTO; +import com.epmet.dto.result.*; import com.epmet.entity.CustomerGridEntity; import org.springframework.web.bind.annotation.RequestBody; @@ -160,12 +157,38 @@ public interface CustomerGridService extends BaseService { /** * @Description 查找指定机构下的网格列表 对应接口:/gov/org/grid/gridlist - * @Param CommonAgencyIdFormDTO -> gridId + * @Param CommonAgencyIdFormDTO -> agencyId * @return Result * @Author wangc * @Date 2020.04.23 14:45 **/ Result getGridListByAgency(CommonAgencyIdFormDTO agencyFormDTO); + + /** + * @Description 查找指定机构下的全部网格列表 对应接口:/gov/org/grid/allgrids + * @Param CommonAgencyIdFormDTO -> agencyId + * @return Result> + * @Author wangc + * @Date 2020.04.24 17:16 + **/ + Result> getAllGridsByAgency(CommonAgencyIdFormDTO agencyFormDTO); + + /** + * @Description 移除网格工作人员 + * @Param CommonGridStaffInfoFormDTO + * @return Result + * @Author wangc + * @Date 2020.04.26 09:48 + **/ + Result removeGridStaff(CommonGridStaffInfoFormDTO staffInfoFormDTO); + /** + * @Description 批量添加网格工作人员 + * @Param CommonGridStaffListFromDTO + * @return Result + * @Author wangc + * @Date 2020.04.26 09:50 + **/ + Result addGridStaffs(CommonGridStaffListFromDTO staffListFormDTO); } \ No newline at end of file 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 6ed1a5746c..b6b5bd86b0 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,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.CustomerStaffAgencyDTO; +import com.epmet.dto.form.CommonDepartmentFormDTO; import com.epmet.dto.form.StaffsInAgencyFromDTO; import com.epmet.dto.form.CommonGridIdFormDTO; import com.epmet.dto.result.CommonStaffInfoResultDTO; @@ -123,4 +124,13 @@ public interface CustomerStaffAgencyService extends BaseService> getSelectableStaffs(CommonGridIdFormDTO gridIdFormDTO); + + /** + * @Description 获取添加部门成员的可选人员列表 + * @Param CommonDepartmentFormDTO + * @return com.epmet.dto.result.CommonStaffInfoResultDTO[epmet-user-client] + * @Author wangc + * @Date 2020.04.26 16:37 + **/ + Result> getSelectableDeptStaffs(CommonDepartmentFormDTO departmentFormDTO); } \ No newline at end of file diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/DepartmentService.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/DepartmentService.java index 48fe029fb0..c23a4cc984 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/DepartmentService.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/DepartmentService.java @@ -77,4 +77,13 @@ public interface DepartmentService { * @Description 获取机构下部门列表 */ Result> departmentList(DepartmentListFormDTO formDTO); + + /** + * @Description 部门人员移除 + * @Param CommonDepartmentStaffInfoFormDTO + * @return Result + * @Author wangc + * @Date 2020.04.26 16:57 + **/ + Result removeStaff(CommonDepartmentStaffInfoFormDTO departmentStaffInfoFormDTO); } \ No newline at end of file diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerGridServiceImpl.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerGridServiceImpl.java index c05f915241..ff76c2faa9 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerGridServiceImpl.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerGridServiceImpl.java @@ -22,38 +22,39 @@ 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.EpmetErrorCode; -import com.epmet.commons.tools.exception.ErrorCode; -import com.epmet.commons.tools.exception.RenException; +import com.epmet.commons.tools.constant.NumConstant; import com.epmet.commons.tools.page.PageData; 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.dao.CustomerGridDao; +import com.epmet.dao.CustomerStaffGridDao; import com.epmet.dto.*; import com.epmet.dto.form.*; -import com.epmet.dto.result.AddGridResultDTO; +import com.epmet.dto.result.*; import com.epmet.dto.CustomerGridDTO; import com.epmet.dto.CustomerStaffGridDTO; import com.epmet.dto.StaffGridListDTO; import com.epmet.dto.form.CommonAgencyIdFormDTO; import com.epmet.dto.form.CustomerGridFormDTO; import com.epmet.dto.form.ListCustomerGridFormDTO; -import com.epmet.dto.result.CustomerGridByUserIdResultDTO; -import com.epmet.dto.result.CustomerGridForStrangerResultDTO; -import com.epmet.dto.result.GridDetailResultDTO; -import com.epmet.dto.result.GridBaseInfoResultDTO; -import com.epmet.dto.result.GridListInfoResultDTO; import com.epmet.entity.CustomerGridEntity; import com.epmet.feign.EpmetUserFeignClient; import com.epmet.redis.CustomerGridRedis; import com.epmet.service.CustomerGridService; +import com.epmet.service.CustomerStaffGridService; import com.epmet.util.ModuleConstant; +import lombok.extern.slf4j.Slf4j; 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; + import java.util.*; +import java.util.stream.Collectors; /** * 客户网格表 @@ -62,12 +63,18 @@ import java.util.*; * @since v1.0.0 2020-03-16 */ @Service +@Slf4j public class CustomerGridServiceImpl extends BaseServiceImpl implements CustomerGridService { + private static final Logger logger = LoggerFactory.getLogger(CustomerGridServiceImpl.class); @Autowired private CustomerGridRedis customerGridRedis; @Autowired private EpmetUserFeignClient epmetUserFeignClient; + @Autowired + private CustomerStaffGridService customerStaffGridService; + @Autowired + private CustomerStaffGridDao customerStaffGridDao; @Override public PageData page(Map params) { @@ -243,7 +250,7 @@ public class CustomerGridServiceImpl extends BaseServiceImpl * @Author wangc @@ -254,12 +261,151 @@ public class CustomerGridServiceImpl extends BaseServiceImpl gridList = baseDao.selectGridListByAgencyId(agencyFormDTO.getAgencyId()); + //2.查当前机构下每个网格的详情,按照创建时间倒叙取前十个 + List gridList = baseDao.selectGridListByAgencyId(agencyFormDTO.getAgencyId(), NumConstant.TEN); //3.封装结果 GridListInfoResultDTO resultData = new GridListInfoResultDTO(gridCount,gridList); return new Result().ok(resultData); } + /** + * @Description 查找指定机构下的全部网格列表 + * @Param CommonAgencyIdFormDTO -> agencyId + * @return Result> + * @Author wangc + * @Date 2020.04.24 17:16 + **/ + @Override + public Result> getAllGridsByAgency(CommonAgencyIdFormDTO agencyFormDTO) { + return new Result>().ok(baseDao.selectGridListByAgencyId(agencyFormDTO.getAgencyId(),null)); + } + + /** + * @Description 移除网格工作人员 + * @Param CommonGridStaffInfoFormDTO + * @return Result + * @Author wangc + * @Date 2020.04.26 09:48 + **/ + @Override + public Result removeGridStaff(CommonGridStaffInfoFormDTO staffInfoFormDTO) { + + Result authResult = authenticateManager(staffInfoFormDTO.getGridId(),staffInfoFormDTO.getUserId()); + if(authResult.success()){ + //3.移除操作 + //3.1 人员剔除 + CustomerStaffGridDTO staff = new CustomerStaffGridDTO(); + staff.setUserId(staffInfoFormDTO.getStaffId()); + staff.setGridId(staffInfoFormDTO.getGridId()); + staff.setUpdatedBy(staffInfoFormDTO.getUserId()); + staff.setDelFlag(NumConstant.ONE); + customerStaffGridService.update(staff); + //3.2 人数减一 + CustomerGridDTO grid = new CustomerGridDTO(); + grid.setId(authResult.getData().getId()); + grid.setUpdatedBy(staffInfoFormDTO.getUserId()); + grid.setTotalUser(authResult.getData().getTotalUser() == null || authResult.getData().getTotalUser() <= 0 + ? 0 : (authResult.getData().getTotalUser() - 1)); + update(grid); + } + + return new Result().error(); + } + + /** + * @Description 批量添加网格工作人员 + * @Param CommonGridStaffListFromDTO + * @return Result + * @Author wangc + * @Date 2020.04.26 09:50 + **/ + @Override + public Result addGridStaffs(CommonGridStaffListFromDTO staffListFormDTO) { + //1.校验管理员权限 + Result authResult = authenticateManager(staffListFormDTO.getGridId(),staffListFormDTO.getUserId()); + if(authResult.success()){ + //2.校验人员重复信息,剔除重复人员 + Set existedStaffIds = + customerStaffGridDao.distinctGridStaffs(staffListFormDTO.getSelectedList(),staffListFormDTO.getGridId()); + Set staffIds = new HashSet<>(staffListFormDTO.getSelectedList()); + staffIds.removeAll(existedStaffIds); + //3.校验人员是否被禁用 + Result> staffsFeignResult = + epmetUserFeignClient.enableStaffMsgList(new CommonUserIdListFormDTO( + new ArrayList<>(staffIds), + authResult.getData().getCustomerId() + )); + if(staffsFeignResult.success() && null != staffsFeignResult.getData() && staffsFeignResult.getData().size() > 0){ + //4.添加 + List validStaffIds = + staffsFeignResult.getData() + .stream() + .map(CommonStaffInfoResultDTO::getStaffId) + .collect(Collectors.toList()); + List staffs2Insert = new LinkedList<>(); + for(String id : validStaffIds){ + CustomerStaffGridDTO staff2Insert = new CustomerStaffGridDTO(); + staff2Insert.setUserId(id); + staff2Insert.setGridId(staffListFormDTO.getGridId()); + staff2Insert.setCustomerId(authResult.getData().getCustomerId()); + staff2Insert.setCreatedBy(staffListFormDTO.getUserId()); + staff2Insert.setUpdatedBy(staffListFormDTO.getUserId()); + staffs2Insert.add(staff2Insert); + } + //4.1 批量新增网格工作人员 + customerStaffGridDao.insertBatch(staffs2Insert); + CustomerGridDTO grid2Update = new CustomerGridDTO(); + grid2Update.setId(staffListFormDTO.getGridId()); + grid2Update.setUpdatedBy(staffListFormDTO.getUserId()); + grid2Update.setTotalUser( + null == authResult.getData().getTotalUser() ? + validStaffIds.size() : authResult.getData().getTotalUser() + validStaffIds.size() + ); + //4.2 更新网格人数 + update(grid2Update); + return new Result(); + } + + } + return new Result().error(); + } + + /** + * @Description 对管理员身份进行权鉴 + * @Param + * @return + * @Author wangc + * @Date 2020.04.26 13:44 + **/ + private Result authenticateManager(String gridId,String userId){ + //1.查询网格相关信息 + CustomerGridEntity gridMsg = + baseDao.selectById(gridId); + //2.校验权限 + if(null != gridMsg && StringUtils.isNotBlank(gridMsg.getId()) && StringUtils.equals(gridMsg.getDelFlag(),NumConstant.ZERO_STR)){ + CommonUserFormDTO userParam = new CommonUserFormDTO(); + userParam.setCustomerId(gridMsg.getCustomerId()); + userParam.setUserId(userId); + Result staffFeignResult = + epmetUserFeignClient.getCustomerStaffRoles(userParam); + StaffRolesResultDTO resultData = staffFeignResult.getData(); + if(staffFeignResult.success() && null != resultData && StringUtils.isNotBlank(resultData.getStaffId())){ + if(null != resultData.getRoleList() + && StringUtils.equals(ModuleConstant.ENABLE,resultData.getEnableFlag()) + && resultData.getRoleList().size() > 0 + && resultData.getRoleList().contains(ModuleConstant.MANAGER)){ + return new Result().ok(gridMsg); + }else{ + log.error(ModuleConstant.NO_AUTH_OR_DISABLE); + } + }else{ + log.error(ModuleConstant.STAFF_INFO_NOT_FOUND); + } + }else{ + log.error(ModuleConstant.GRID_INFO_NOT_FOUND); + } + return new Result().error(); + } + } 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 d2a122cc21..38b1c66ce6 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 @@ -26,22 +26,20 @@ 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.CustomerStaffAgencyDao; -import com.epmet.dto.CustomerDTO; -import com.epmet.dto.CustomerStaffAgencyDTO; -import com.epmet.dto.CustomerStaffDTO; +import com.epmet.dto.*; +import com.epmet.dto.form.CommonDepartmentFormDTO; +import com.epmet.dto.form.CommonUserIdListFormDTO; import com.epmet.dto.form.StaffsInAgencyFromDTO; import com.epmet.dto.form.CommonGridIdFormDTO; -import com.epmet.dto.form.CommonUserIdListFormList; import com.epmet.dto.result.CommonStaffInfoResultDTO; import com.epmet.dto.result.LatestCustomerResultDTO; -import com.epmet.dto.result.StaffInfoResultDTO; -import com.epmet.dto.result.StaffsInAgencyResultDTO; -import com.epmet.entity.CustomerAgencyEntity; import com.epmet.entity.CustomerStaffAgencyEntity; import com.epmet.feign.EpmetUserFeignClient; import com.epmet.feign.OperCrmFeignClient; import com.epmet.redis.CustomerStaffAgencyRedis; import com.epmet.service.CustomerAgencyService; +import com.epmet.service.CustomerDepartmentService; +import com.epmet.service.CustomerGridService; import com.epmet.service.CustomerStaffAgencyService; import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; @@ -52,7 +50,6 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.List; import java.util.Map; -import java.util.stream.Collectors; /** * 人员-机关单位关系表 @@ -71,6 +68,10 @@ public class CustomerStaffAgencyServiceImpl extends BaseServiceImpl page(Map params) { @@ -166,9 +167,35 @@ public class CustomerStaffAgencyServiceImpl extends BaseServiceImpl userId = baseDao.getSelectableStaffsForGrid(customerGridFormDTO.getGridId()); //2.去用户服务下拿取用户基本信息,并校验工作人员身份是否被禁用 if(null != userId && userId.size() >= NumConstant.ONE){ - //直接返回结果 - return epmetUserFeignClient.enableStaffMsgList(new CommonUserIdListFormList(userId)); + CustomerGridDTO gridMsg = + customerGridService.get(customerGridFormDTO.getGridId()); + if(null != gridMsg && StringUtils.isNotBlank(gridMsg.getId())){ + //直接返回结果 + return epmetUserFeignClient.enableStaffMsgList(new CommonUserIdListFormDTO(userId,gridMsg.getCustomerId())); + } + } + return new Result>().ok(new ArrayList<>()); + } + /** + * @Description 获取添加部门成员的可选人员列表 + * @Param CommonDepartmentFormDTO + * @return com.epmet.dto.result.CommonStaffInfoResultDTO[epmet-user-client] + * @Author wangc + * @Date 2020.04.26 16:37 + **/ + @Override + public Result> getSelectableDeptStaffs(CommonDepartmentFormDTO departmentFormDTO) { + //1.去数据库查询是此网格所属机构且不在此网格下的工作人员,这里无法确认是否被禁用 + List userId = baseDao.getSelectableStaffsForDept(departmentFormDTO.getDepartmentId()); + //2.去用户服务下拿取用户基本信息,并校验工作人员身份是否被禁用 + if(null != userId && userId.size() >= NumConstant.ONE){ + CustomerDepartmentDTO deptMsg = + customerDepartmentService.get(departmentFormDTO.getDepartmentId()); + if(null != deptMsg && StringUtils.isNotBlank(deptMsg.getId())){ + //直接返回结果 + return epmetUserFeignClient.enableStaffMsgList(new CommonUserIdListFormDTO(userId,deptMsg.getCustomerId())); + } } return new Result>().ok(new ArrayList<>()); } diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/DepartmentServiceImpl.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/DepartmentServiceImpl.java index 263daff4ac..12b8739b6e 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/DepartmentServiceImpl.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/DepartmentServiceImpl.java @@ -26,14 +26,19 @@ import com.epmet.constant.CustomerDepartmentConstant; import com.epmet.dao.CustomerAgencyDao; import com.epmet.dao.CustomerDepartmentDao; import com.epmet.dao.CustomerStaffDepartmentDao; +import com.epmet.dto.CustomerDepartmentDTO; +import com.epmet.dto.CustomerStaffDepartmentDTO; import com.epmet.dto.StaffRoleDTO; import com.epmet.dto.form.*; import com.epmet.dto.result.*; import com.epmet.entity.CustomerAgencyEntity; import com.epmet.entity.CustomerDepartmentEntity; import com.epmet.feign.EpmetUserFeignClient; +import com.epmet.service.CustomerDepartmentService; +import com.epmet.service.CustomerStaffDepartmentService; import com.epmet.service.DepartmentService; import com.epmet.util.ModuleConstant; +import org.apache.commons.lang3.StringUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; @@ -57,8 +62,12 @@ public class DepartmentServiceImpl implements DepartmentService { @Autowired private CustomerDepartmentDao customerDepartmentDao; @Autowired + private CustomerDepartmentService customerDepartmentService; + @Autowired private CustomerStaffDepartmentDao customerStaffDepartmentDao; @Autowired + private CustomerStaffDepartmentService customerStaffDepartmentService; + @Autowired private EpmetUserFeignClient epmetUserFeignClient; /** @@ -197,4 +206,37 @@ public class DepartmentServiceImpl implements DepartmentService { List departmentList = customerDepartmentDao.selectDepartmentList(formDTO.getAgencyId()); return new Result>().ok(departmentList); } + + + /** + * @Description 部门人员移除 + * @Param CommonDepartmentStaffInfoFormDTO + * @return Result + * @Author wangc + * @Date 2020.04.26 16:57 + **/ + @Override + public Result removeStaff(CommonDepartmentStaffInfoFormDTO departmentStaffInfoFormDTO) { + //1.剔除工作人员 + CustomerStaffDepartmentDTO staff = new CustomerStaffDepartmentDTO(); + staff.setUserId(departmentStaffInfoFormDTO.getStaffId()); + staff.setDepartmentId(departmentStaffInfoFormDTO.getDepartmentId()); + staff.setUpdatedBy(departmentStaffInfoFormDTO.getUserId()); + staff.setDelFlag(NumConstant.ONE_STR); + customerStaffDepartmentService.update(staff); + //2.部门人数减一 + CustomerDepartmentDTO dept = + customerDepartmentService.get(departmentStaffInfoFormDTO.getDepartmentId()); + if(null != dept && StringUtils.isNotBlank(dept.getId())){ + CustomerDepartmentDTO dept2Update = new CustomerDepartmentDTO(); + dept2Update.setId(dept.getId()); + dept2Update.setTotalUser(null == dept.getTotalUser() || dept.getTotalUser() == 0 + ? 0 : dept.getTotalUser() - NumConstant.ONE); + dept2Update.setUpdatedBy(departmentStaffInfoFormDTO.getUserId()); + customerDepartmentService.update(dept2Update); + return new Result(); + } + log.warn(ModuleConstant.DEPT_INFO_NOT_FOUND); + return new Result().error(); + } } \ No newline at end of file diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/util/ModuleConstant.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/util/ModuleConstant.java index ed987de678..f2085748a5 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/util/ModuleConstant.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/util/ModuleConstant.java @@ -18,4 +18,39 @@ public interface ModuleConstant { * tokenDto不能为null userId不能为空 */ String USER_NOT_NULL="用户信息不能为空"; + + /** + * 用户未被禁用标识 + * */ + String ENABLE = "enable"; + + /** + * 用户被禁用标识 + * */ + String DISABLE = "disable"; + + /** + * 管理员角色名称 + * */ + String MANAGER = "管理员"; + + /** + * 操作者账号失效或没有相应权限 + * */ + String NO_AUTH_OR_DISABLE = "操作者账号失效或没有相应权限,终止操作。"; + + /** + * 查询操作者身份信息失败 + * */ + String STAFF_INFO_NOT_FOUND = "查询操作者身份信息失败,终止操作。"; + + /** + * 网格信息有误 + * */ + String GRID_INFO_NOT_FOUND = "网格信息有误,终止操作。"; + + /** + * 找不到相关部门信息 + * */ + String DEPT_INFO_NOT_FOUND = "找不到相关部门信息"; } diff --git a/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerGridDao.xml b/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerGridDao.xml index 2bf81ebcde..5bfcddaeb8 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerGridDao.xml +++ b/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerGridDao.xml @@ -207,18 +207,21 @@ - SELECT ID AS grdiId, GRID_NAME, TOTAL_USER FROM CUSTOMER_GRID - WHERE + DEL_FLAG = '0' AND PID = #{agencyId} ORDER BY CREATED_TIME DESC - LIMIT 10 + + LIMIT #{pageSize} + + \ 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 4622c0afe6..5183cf79b6 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 @@ -60,13 +60,40 @@ SELECT grid2.USER_ID FROM - CUSTOMER_STAFF_GRID grid2 + CUSTOMER_STAFF_GRID WHERE - grid2.DEL_FLAG = '0' + DEL_FLAG = '0' AND - grid2.GRID_ID = #{gridId} ) + GRID_ID = #{gridId} ) + + diff --git a/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerStaffGridDao.xml b/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerStaffGridDao.xml index 47a9de4a33..5e4c9bd1a3 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerStaffGridDao.xml +++ b/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerStaffGridDao.xml @@ -41,4 +41,49 @@ LIMIT 1 + + + + + + insert into customer_staff_grid + ( + id, + user_id, + grid_id, + customer_id, + del_flag, + revision, + created_by, + created_time, + updated_by, + updated_time + ) values + + ( + (SELECT REPLACE(UUID(), '-', '') AS id), + #{item.userId}, + #{item.gridId}, + #{item.customerId}, + '0', + 0, + #{item.createdBy}, + now(), + #{item.updatedBy}, + now() + ) + + \ No newline at end of file diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/CommonUserFormDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/CommonUserFormDTO.java new file mode 100644 index 0000000000..9b2eec5757 --- /dev/null +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/CommonUserFormDTO.java @@ -0,0 +1,29 @@ +package com.epmet.dto.form; + +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import java.io.Serializable; + +/** + * @Description 通用的用户Id入参 + * @ClassName CommonUserFormDTO + * @Author wangc + * @date 2020.04.26 10:53 + */ +@Data +public class CommonUserFormDTO implements Serializable{ + private static final long serialVersionUID = -7994579456530273809L; + + /** + * 用户Id + * */ + @NotBlank(message = "用户Id不能为空") + private String userId; + + /** + * 客户Id + * */ + @NotBlank(message = "客户Id不能为空") + private String customerId; +} diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/CommonUserIdListFormList.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/CommonUserIdListFormDTO.java similarity index 70% rename from epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/CommonUserIdListFormList.java rename to epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/CommonUserIdListFormDTO.java index 86c49a60c9..04c87ac74f 100644 --- a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/CommonUserIdListFormList.java +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/CommonUserIdListFormDTO.java @@ -2,6 +2,7 @@ package com.epmet.dto.form; import lombok.AllArgsConstructor; import lombok.Data; +import lombok.NoArgsConstructor; import javax.validation.constraints.NotBlank; import java.io.Serializable; @@ -9,13 +10,13 @@ import java.util.List; /** * @Description 通用用户Id列表参数DTO - * @ClassName CommonUserIdListFormList + * @ClassName CommonUserIdListFormDTO * @Author wangc * @date 2020.04.24 15:42 */ @Data @AllArgsConstructor -public class CommonUserIdListFormList implements Serializable{ +public class CommonUserIdListFormDTO implements Serializable{ private static final long serialVersionUID = -7045691156972928671L; /** @@ -23,4 +24,7 @@ public class CommonUserIdListFormList implements Serializable{ * */ @NotBlank(message = "用户列表不能为空") private List userIdList; + + @NotBlank(message = "客户Id不能为空") + private String customerId; } diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/StaffRolesResultDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/StaffRolesResultDTO.java new file mode 100644 index 0000000000..003a727fac --- /dev/null +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/StaffRolesResultDTO.java @@ -0,0 +1,32 @@ +package com.epmet.dto.result; + +import lombok.Data; + +import java.io.Serializable; +import java.util.List; + +/** + * @Description 通用的员工角色返参 + * @ClassName StaffRolesResultDTO + * @Author wangc + * @date 2020.04.26 10:29 + */ +@Data +public class StaffRolesResultDTO implements Serializable { + private static final long serialVersionUID = -2049883620062097446L; + + /** + * 员工Id + * */ + private String staffId; + + /** + * 角色列表 + * */ + private List roleList; + + /** + * 是否被禁用 未禁用enable,已禁用disabled + * */ + private String enableFlag; +} 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 159a223021..8a1afe94d0 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 @@ -34,8 +34,6 @@ import com.epmet.dto.result.StaffInitResultDTO; import com.epmet.dto.CustomerStaffDTO; import com.epmet.dto.CustomerStaffGridDTO; import com.epmet.dto.StaffGridListDTO; -import com.epmet.dto.form.CommonUserIdListFormList; -import com.epmet.dto.form.CustomerGridFormDTO; import com.epmet.dto.form.CustomerStaffFormDTO; import com.epmet.dto.result.CommonStaffInfoResultDTO; import com.epmet.excel.CustomerStaffExcel; @@ -256,13 +254,13 @@ public class CustomerStaffController { /** * @Description 通过userId列表查询未被禁用的用户信息 - * @Param CommonUserIdListFormList :: getUserIdList + * @Param CommonUserIdListFormDTO :: getUserIdList * @return Result> * @Author wangc * @Date 2020.04.24 15:44 **/ @PostMapping(value = "enabestaffmsglist") - public Result> enableStaffMsgList(@RequestBody CommonUserIdListFormList userIdList){ + public Result> enableStaffMsgList(@RequestBody CommonUserIdListFormDTO userIdList){ ValidatorUtils.validateEntity(userIdList); return customerStaffService.getEnableStaffMsgList(userIdList); } 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 795b0a34d9..f246940807 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 @@ -3,8 +3,10 @@ package com.epmet.controller; 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.StaffRoleFormDTO; import com.epmet.dto.result.GovStaffRoleResultDTO; +import com.epmet.dto.result.StaffRolesResultDTO; import com.epmet.entity.GovStaffRoleEntity; import com.epmet.service.GovStaffRoleService; import com.epmet.service.StaffRoleService; @@ -15,6 +17,7 @@ import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; + import java.util.ArrayList; import java.util.List; @@ -69,4 +72,16 @@ public class StaffRoleController { return new Result>().ok(staffRoleDTOS); } + /** + * @Description 查询一个员工在指定客户下的角色 + * @Param CommonUserFormDTO + * @return Result + * @Author wangc + * @Date 2020.04.26 13:06 + **/ + @PostMapping("getcustomerstaffroles") + public Result getCustomerStaffRoles(@RequestBody CommonUserFormDTO commonUserFormDTO){ + ValidatorUtils.validateEntity(commonUserFormDTO); + return staffRoleService.getStaffRoles(commonUserFormDTO); + } } diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/CustomerStaffDao.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/CustomerStaffDao.java index 4c381c5280..775cb008df 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/CustomerStaffDao.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/CustomerStaffDao.java @@ -117,11 +117,6 @@ public interface CustomerStaffDao extends BaseDao { * @Description 根据客户Id及userId集合查询用户基本信息 */ List selectDepartmentStaffList(DepartmentInStaffFormDTO fromDTO); - * 根据userId查询查询网格下的用户信息 - * @param customerStaffGridDTOS - * @return - */ - List selectStaffGridListByUserId(List customerStaffGridDTOS); /** * @Description 根据UserId列表查询用信息,过滤掉被禁用的,包含未激活的 @@ -130,5 +125,5 @@ public interface CustomerStaffDao extends BaseDao { * @Author wangc * @Date 2020.04.24 15:34 **/ - List selectEnableStaffMsg(@Param("userIds") List userIds); + List selectEnableStaffMsg(@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/dao/StaffRoleDao.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/StaffRoleDao.java index 6d65865681..42a85a7111 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 @@ -19,7 +19,9 @@ package com.epmet.dao; import com.epmet.commons.mybatis.dao.BaseDao; import com.epmet.dto.StaffRoleDTO; +import com.epmet.dto.form.CommonUserFormDTO; import com.epmet.dto.result.GovStaffRoleResultDTO; +import com.epmet.dto.result.StaffRolesResultDTO; import com.epmet.entity.StaffRoleEntity; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; @@ -49,4 +51,13 @@ public interface StaffRoleDao extends BaseDao { */ boolean delStaffRoles(StaffRoleDTO dto); + /** + * @Description 得到指定客户下的某个用户的全部角色 + * @Param getCustomerId :: getUserId + * @return StaffRolesResultDTO + * @Author wangc + * @Date 2020.04.26 11:01 + **/ + StaffRolesResultDTO getStaffRoles(CommonUserFormDTO commonUserFormDTO); + } \ 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 b4b692da05..3956c86fc5 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 @@ -25,7 +25,7 @@ import com.epmet.dto.form.CustomerGridFormDTO; import com.epmet.dto.CustomerStaffDTO; import com.epmet.dto.CustomerStaffGridDTO; import com.epmet.dto.StaffGridListDTO; -import com.epmet.dto.form.CommonUserIdListFormList; +import com.epmet.dto.form.CommonUserIdListFormDTO; import com.epmet.dto.form.CustomerGridFormDTO; import com.epmet.dto.form.CustomerStaffFormDTO; import com.epmet.dto.form.StaffInfoFromDTO; @@ -224,10 +224,10 @@ public interface CustomerStaffService extends BaseService { /** * @Description 通过userId列表查询未被禁用的用户信息 - * @Param CommonUserIdListFormList :: getUserIdList + * @Param CommonUserIdListFormDTO :: getUserIdList * @return Result> * @Author wangc * @Date 2020.04.24 15:44 **/ - Result> getEnableStaffMsgList(CommonUserIdListFormList userIdList); + Result> getEnableStaffMsgList(CommonUserIdListFormDTO userIdList); } \ 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 88742d7400..456a88b720 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 @@ -19,8 +19,11 @@ package com.epmet.service; 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.StaffRoleDTO; +import com.epmet.dto.form.CommonUserFormDTO; import com.epmet.dto.result.GovStaffRoleResultDTO; +import com.epmet.dto.result.StaffRolesResultDTO; import com.epmet.entity.StaffRoleEntity; import java.util.List; @@ -107,4 +110,13 @@ public interface StaffRoleService extends BaseService { * @param dto */ void clearStaffRoles(StaffRoleDTO dto); + + /** + * @Description 得到某一个员工在一个客户下的所有角色 + * @Param CommonUserFormDTO :: getUserId :: getCustomerId + * @return Result + * @Author wangc + * @Date 2020.04.26 10:59 + **/ + Result getStaffRoles(CommonUserFormDTO userParam); } \ No newline at end of file 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 ea2fa2536b..459b27acd0 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 @@ -35,8 +35,6 @@ import com.epmet.dto.result.*; import com.epmet.dto.CustomerStaffDTO; import com.epmet.dto.CustomerStaffGridDTO; import com.epmet.dto.StaffGridListDTO; -import com.epmet.dto.form.CommonUserIdListFormList; -import com.epmet.dto.form.CustomerGridFormDTO; import com.epmet.dto.form.CustomerStaffFormDTO; import com.epmet.dto.result.CommonStaffInfoResultDTO; import com.epmet.entity.CustomerStaffEntity; @@ -361,14 +359,14 @@ public class CustomerStaffServiceImpl extends BaseServiceImpl> * @Author wangc * @Date 2020.04.24 15:44 **/ @Override - public Result> getEnableStaffMsgList(CommonUserIdListFormList userIdList) { - return new Result>().ok(baseDao.selectEnableStaffMsg(userIdList.getUserIdList())); + public Result> getEnableStaffMsgList(CommonUserIdListFormDTO userIdList) { + return new Result>().ok(baseDao.selectEnableStaffMsg(userIdList.getUserIdList(),userIdList.getCustomerId())); } } \ 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 0a9d7ce90d..c9ca5f516f 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 @@ -23,9 +23,12 @@ import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; 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.StaffRoleDao; import com.epmet.dto.StaffRoleDTO; +import com.epmet.dto.form.CommonUserFormDTO; import com.epmet.dto.result.GovStaffRoleResultDTO; +import com.epmet.dto.result.StaffRolesResultDTO; import com.epmet.entity.StaffRoleEntity; import com.epmet.redis.StaffRoleRedis; import com.epmet.service.StaffRoleService; @@ -120,4 +123,16 @@ public class StaffRoleServiceImpl extends BaseServiceImpl + * @Author wangc + * @Date 2020.04.26 10:59 + **/ + @Override + public Result getStaffRoles(CommonUserFormDTO userParam) { + return new Result().ok(baseDao.getStaffRoles(userParam)); + } + } \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/resources/mapper/CustomerStaffDao.xml b/epmet-user/epmet-user-server/src/main/resources/mapper/CustomerStaffDao.xml index f9c2046406..e65d4e86db 100644 --- a/epmet-user/epmet-user-server/src/main/resources/mapper/CustomerStaffDao.xml +++ b/epmet-user/epmet-user-server/src/main/resources/mapper/CustomerStaffDao.xml @@ -157,6 +157,8 @@ CUSTOMER_STAFF WHERE DEL_FLAG = '0' + AND + CUSTOMER_ID = #{customerId} AND ENABLE_FLAG = 'enable' 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 7ad99146cb..718e47a182 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 @@ -35,4 +35,35 @@ r.ROLE_KEY = #{roleKey} AND sr.ORG_ID = #{orgId} + + + + + + + + + + + + + + + + \ No newline at end of file