From 6de6509b1919b712d982c66a9a3f948e61499351 Mon Sep 17 00:00:00 2001 From: yinzuomei <576302893@qq.com> Date: Mon, 20 Apr 2020 16:15:53 +0800 Subject: [PATCH 01/85] =?UTF-8?q?=E6=94=BF=E5=BA=9C=E7=AB=AF=E5=B0=8F?= =?UTF-8?q?=E7=A8=8B=E5=BA=8F=E7=99=BB=E5=BD=95=E5=8F=91=E9=80=81=E9=AA=8C?= =?UTF-8?q?=E8=AF=81=E7=A0=81=E3=80=81wxCode=E8=8E=B7=E5=8F=96=E6=9C=80?= =?UTF-8?q?=E8=BF=91=E4=B8=80=E6=AC=A1=E7=99=BB=E5=BD=95=E8=B4=A6=E6=88=B7?= =?UTF-8?q?token=E3=80=81enterorg=E6=8E=A5=E5=8F=A3=E5=BC=80=E5=8F=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- epmet-auth/pom.xml | 14 +- .../epmet/controller/GovLoginController.java | 81 ++++++ .../com/epmet/controller/LoginController.java | 31 +- .../epmet/dto/form/GovWxmpEnteOrgFormDTO.java | 39 +++ .../com/epmet/dto/form/GovWxmpFormDTO.java | 21 ++ ...ormDTO.java => GovWxmpGetOrgsFormDTO.java} | 10 +- .../epmet/dto/form/SendSmsCodeFormDTO.java | 4 +- .../com/epmet/feign/EpmetUserFeignClient.java | 43 ++- .../com/epmet/feign/GovOrgFeignClient.java | 23 ++ .../EpmetUserFeignClientFallback.java | 24 +- .../fallback/GovOrgFeignClientFallback.java | 25 ++ .../java/com/epmet/redis/CaptchaRedis.java | 9 +- .../com/epmet/service/GovLoginService.java | 51 ++++ .../java/com/epmet/service/LoginService.java | 19 -- .../service/impl/GovLoginServiceImpl.java | 264 ++++++++++++++++++ .../epmet/service/impl/LoginServiceImpl.java | 99 ------- .../commons/tools/annotation/LoginUser.java | 2 +- .../tools/exception/EpmetErrorCode.java | 1 + .../tools/security/dto/GovTokenDto.java | 80 ++++++ ...oginUserHandlerMethodArgumentResolver.java | 11 +- .../tools/utils/CpUserDetailRedis.java | 31 ++ epmet-gateway/pom.xml | 60 ++-- .../epmet/dto/form/StaffGridInfoFormDTO.java | 30 ++ .../dto/result/StaffGridInfoResultDTO.java | 39 +++ .../controller/CustomerGridController.java | 19 +- .../java/com/epmet/dao/CustomerGridDao.java | 16 +- .../epmet/service/CustomerGridService.java | 11 + .../service/impl/CustomerGridServiceImpl.java | 8 + .../main/resources/mapper/CustomerGridDao.xml | 20 ++ .../epmet/controller/OperMenuController.java | 13 +- .../epmet/controller/CustomerController.java | 3 +- .../controller/ResiCommentController.java | 6 +- .../group/controller/ResiGroupController.java | 34 ++- .../controller/GroupInvitationController.java | 11 +- .../controller/ResiGroupMemberController.java | 25 +- .../topic/controller/ResiTopicController.java | 17 +- .../StrangerResiGuideController.java | 3 +- .../epmet/controller/UserGuideController.java | 3 +- .../controller/ResiMineGridController.java | 3 +- .../controller/UserMessageController.java | 7 +- .../controller/PartyMemberController.java | 9 +- .../controller/ResiRegisterController.java | 7 +- .../controller/ResiWarmheartedController.java | 5 +- .../com/epmet/dto/StaffLoginHistoryDTO.java | 102 +++++++ .../epmet/dto/form/CustomerStaffFormDTO.java | 21 ++ .../dto/form/StaffLoginHistoryFormDTO.java | 44 +++ .../LatestStaffWechatLoginResultDTO.java | 46 +++ .../controller/CustomerStaffController.java | 36 ++- .../epmet/controller/OperUserController.java | 3 +- .../StaffLoginHistoryController.java | 64 +++++ .../com/epmet/controller/UserController.java | 3 +- .../java/com/epmet/dao/CustomerStaffDao.java | 23 +- .../com/epmet/dao/StaffLoginHistoryDao.java | 42 +++ .../epmet/entity/StaffLoginHistoryEntity.java | 68 +++++ .../epmet/service/CustomerStaffService.java | 14 +- .../service/StaffLoginHistoryService.java | 116 ++++++++ .../impl/CustomerStaffServiceImpl.java | 26 +- .../impl/StaffLoginHistoryServiceImpl.java | 121 ++++++++ .../resources/db/migration/epmet_user.sql | 20 +- .../resources/mapper/CustomerStaffDao.xml | 34 +-- .../resources/mapper/StaffLoginHistoryDao.xml | 40 +++ 61 files changed, 1705 insertions(+), 349 deletions(-) create mode 100644 epmet-auth/src/main/java/com/epmet/controller/GovLoginController.java create mode 100644 epmet-auth/src/main/java/com/epmet/dto/form/GovWxmpEnteOrgFormDTO.java create mode 100644 epmet-auth/src/main/java/com/epmet/dto/form/GovWxmpFormDTO.java rename epmet-auth/src/main/java/com/epmet/dto/form/{LoginByPhoneFormDTO.java => GovWxmpGetOrgsFormDTO.java} (60%) create mode 100644 epmet-auth/src/main/java/com/epmet/feign/GovOrgFeignClient.java create mode 100644 epmet-auth/src/main/java/com/epmet/feign/fallback/GovOrgFeignClientFallback.java create mode 100644 epmet-auth/src/main/java/com/epmet/service/GovLoginService.java create mode 100644 epmet-auth/src/main/java/com/epmet/service/impl/GovLoginServiceImpl.java create mode 100644 epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/security/dto/GovTokenDto.java create mode 100644 epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/StaffGridInfoFormDTO.java create mode 100644 epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/StaffGridInfoResultDTO.java create mode 100644 epmet-user/epmet-user-client/src/main/java/com/epmet/dto/StaffLoginHistoryDTO.java create mode 100644 epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/CustomerStaffFormDTO.java create mode 100644 epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/StaffLoginHistoryFormDTO.java create mode 100644 epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/LatestStaffWechatLoginResultDTO.java create mode 100644 epmet-user/epmet-user-server/src/main/java/com/epmet/controller/StaffLoginHistoryController.java create mode 100644 epmet-user/epmet-user-server/src/main/java/com/epmet/dao/StaffLoginHistoryDao.java create mode 100644 epmet-user/epmet-user-server/src/main/java/com/epmet/entity/StaffLoginHistoryEntity.java create mode 100644 epmet-user/epmet-user-server/src/main/java/com/epmet/service/StaffLoginHistoryService.java create mode 100644 epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/StaffLoginHistoryServiceImpl.java create mode 100644 epmet-user/epmet-user-server/src/main/resources/mapper/StaffLoginHistoryDao.xml diff --git a/epmet-auth/pom.xml b/epmet-auth/pom.xml index 9d1876810e..be588da1e1 100644 --- a/epmet-auth/pom.xml +++ b/epmet-auth/pom.xml @@ -92,6 +92,12 @@ 2.0.0 compile + + com.epmet + gov-org-client + 2.0.0 + compile + @@ -187,8 +193,8 @@ wx9b6102a8ee5add65 16fdb68bc2b3e732324ba5d8b8a9b5e2 - wx3d1372029eb816a3 - 651f02d71ed3f123dfb584b8bf0f4d8b + wx3d1372029eb816a3 + 651f02d71ed3f123dfb584b8bf0f4d8b @@ -224,8 +230,8 @@ wx9b6102a8ee5add65 16fdb68bc2b3e732324ba5d8b8a9b5e2 - wx3d1372029eb816a3 - 651f02d71ed3f123dfb584b8bf0f4d8b + wx3d1372029eb816a3 + 651f02d71ed3f123dfb584b8bf0f4d8b diff --git a/epmet-auth/src/main/java/com/epmet/controller/GovLoginController.java b/epmet-auth/src/main/java/com/epmet/controller/GovLoginController.java new file mode 100644 index 0000000000..0539be499d --- /dev/null +++ b/epmet-auth/src/main/java/com/epmet/controller/GovLoginController.java @@ -0,0 +1,81 @@ +package com.epmet.controller; + +import com.epmet.commons.tools.utils.Result; +import com.epmet.commons.tools.validator.ValidatorUtils; +import com.epmet.dto.form.GovWxmpEnteOrgFormDTO; +import com.epmet.dto.form.GovWxmpFormDTO; +import com.epmet.dto.form.GovWxmpGetOrgsFormDTO; +import com.epmet.dto.form.SendSmsCodeFormDTO; +import com.epmet.dto.result.UserTokenResultDTO; +import com.epmet.service.GovLoginService; +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; + +/** + * @Description 政府端登录 + * @Author yinzuomei + * @Date 2020/4/20 10:54 + */ +@RestController +@RequestMapping("gov") +public class GovLoginController { + @Autowired + private GovLoginService govLoginService; + + /** + * @param formDTO + * @return com.epmet.commons.tools.utils.Result + * @Author yinzuomei + * @Description 1、政府端小程序根据wxCode获取上一次登录信息,返回token + * @Date 2020/4/20 11:22 + **/ + @PostMapping(value = "/loginwxmp/loginbywxcode") + public Result loginByWxCode(GovWxmpFormDTO formDTO) { + ValidatorUtils.validateEntity(formDTO); + return govLoginService.loginByWxCode(formDTO); + } + + /** + * @param formDTO 手机号 + * @return com.epmet.commons.tools.utils.Result + * @Author yinzuomei + * @Description 2、政府端微信小程序登录-发送验证码 + * @Date 2020/4/18 10:58 + **/ + @PostMapping(value = "/loginwxmp/sendsmscode") + public Result sendSmsCode(@RequestBody SendSmsCodeFormDTO formDTO) { + ValidatorUtils.validateEntity(formDTO); + return govLoginService.sendSmsCode(formDTO); + } + + /** + * @param formDTO + * @return com.epmet.commons.tools.utils.Result + * @Author yinzuomei + * @Description 3、手机验证码获取组织 + * @Date 2020/4/18 21:14 + **/ + @PostMapping(value = "/loginwxmp/getorgs") + public Result getorgs(GovWxmpGetOrgsFormDTO formDTO) { + ValidatorUtils.validateEntity(formDTO); + return govLoginService.getorgs(formDTO); + } + + /** + * @param formDTO + * @return com.epmet.commons.tools.utils.Result + * @Author yinzuomei + * @Description 4、选择组织,进入首页 + * @Date 2020/4/20 13:07 + **/ + @PostMapping(value = "/loginwxmp/enterorg") + public Result enterOrg(GovWxmpEnteOrgFormDTO formDTO) { + ValidatorUtils.validateEntity(formDTO); + return govLoginService.enterOrg(formDTO); + } + +} + diff --git a/epmet-auth/src/main/java/com/epmet/controller/LoginController.java b/epmet-auth/src/main/java/com/epmet/controller/LoginController.java index 47c778977a..dc876a1ccc 100644 --- a/epmet-auth/src/main/java/com/epmet/controller/LoginController.java +++ b/epmet-auth/src/main/java/com/epmet/controller/LoginController.java @@ -1,15 +1,12 @@ package com.epmet.controller; -import com.epmet.commons.tools.annotation.LoginUser; import com.epmet.commons.tools.exception.ErrorCode; import com.epmet.commons.tools.security.dto.TokenDto; import com.epmet.commons.tools.utils.Result; import com.epmet.commons.tools.validator.AssertUtils; import com.epmet.commons.tools.validator.ValidatorUtils; import com.epmet.dto.form.LoginByPassWordFormDTO; -import com.epmet.dto.form.LoginByPhoneFormDTO; import com.epmet.dto.form.LoginByWxCodeFormDTO; -import com.epmet.dto.form.SendSmsCodeFormDTO; import com.epmet.dto.result.UserTokenResultDTO; import com.epmet.service.CaptchaService; import com.epmet.service.LoginService; @@ -95,34 +92,8 @@ public class LoginController { * @Date 2020/3/18 22:43 **/ @PostMapping(value = "logout") - public Result logout(@LoginUser TokenDto tokenDto, HttpServletRequest request) { + public Result logout(TokenDto tokenDto, HttpServletRequest request) { //String token = request.getParameter(Constant.TOKEN_HEADER); return loginService.logoutByToken(tokenDto); } - - /** - * @param formDTO 手机号 - * @return com.epmet.commons.tools.utils.Result - * @Author yinzuomei - * @Description 政府端微信小程序登录-发送验证码 - * @Date 2020/4/18 10:58 - **/ - @PostMapping(value = "/govwxmp/sendsmscode") - public Result sendSmsCode(@RequestBody SendSmsCodeFormDTO formDTO) { - ValidatorUtils.validateEntity(formDTO); - return loginService.sendSmsCode(formDTO); - } - - /** - * @param formDTO - * @return com.epmet.commons.tools.utils.Result - * @Author yinzuomei - * @Description 政府端微信小程序登录-手机验证码登录 - * @Date 2020/4/18 21:14 - **/ - @PostMapping(value = "/govwxmp/loginbyphone") - public Result loginByPhone(LoginByPhoneFormDTO formDTO) { - ValidatorUtils.validateEntity(formDTO); - return loginService.loginByPhone(formDTO); - } } diff --git a/epmet-auth/src/main/java/com/epmet/dto/form/GovWxmpEnteOrgFormDTO.java b/epmet-auth/src/main/java/com/epmet/dto/form/GovWxmpEnteOrgFormDTO.java new file mode 100644 index 0000000000..8655268c8e --- /dev/null +++ b/epmet-auth/src/main/java/com/epmet/dto/form/GovWxmpEnteOrgFormDTO.java @@ -0,0 +1,39 @@ +package com.epmet.dto.form; + +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import java.io.Serializable; + +/** + * @Description 选择组织,进入首页入参Dto + * @Author yinzuomei + * @Date 2020/4/20 13:03 + */ +@Data +public class GovWxmpEnteOrgFormDTO implements Serializable { + /** + * wxCode + */ + @NotBlank(message = "wxCode不能为空") + private String wxCode; + + /** + * 手机号 + */ + @NotBlank(message = "手机号不能为空") + private String mobile; + + /** + * 选择的组织所属的id + */ + @NotBlank(message = "客户id不能为空") + private String customerId; + + /** + * 选择的要进入的组织(根组织id) + */ + @NotBlank(message = "组织id不能为空") + private String orgId; +} + diff --git a/epmet-auth/src/main/java/com/epmet/dto/form/GovWxmpFormDTO.java b/epmet-auth/src/main/java/com/epmet/dto/form/GovWxmpFormDTO.java new file mode 100644 index 0000000000..72c43cbfa7 --- /dev/null +++ b/epmet-auth/src/main/java/com/epmet/dto/form/GovWxmpFormDTO.java @@ -0,0 +1,21 @@ +package com.epmet.dto.form; + +import lombok.Data; + +import javax.validation.constraints.NotBlank; + +/** + * @Description 政府端小程序根据wxCode获取上一次登录信息,返回token + * @Author yinzuomei + * @Date 2020/4/20 11:20 + */ +@Data +public class GovWxmpFormDTO extends LoginCommonFormDTO{ + private static final long serialVersionUID = -207861963128774742L; + /** + * wxCode + */ + @NotBlank(message = "wxCode不能为空") + private String wxCode; +} + diff --git a/epmet-auth/src/main/java/com/epmet/dto/form/LoginByPhoneFormDTO.java b/epmet-auth/src/main/java/com/epmet/dto/form/GovWxmpGetOrgsFormDTO.java similarity index 60% rename from epmet-auth/src/main/java/com/epmet/dto/form/LoginByPhoneFormDTO.java rename to epmet-auth/src/main/java/com/epmet/dto/form/GovWxmpGetOrgsFormDTO.java index 591e6063b1..b2674f3277 100644 --- a/epmet-auth/src/main/java/com/epmet/dto/form/LoginByPhoneFormDTO.java +++ b/epmet-auth/src/main/java/com/epmet/dto/form/GovWxmpGetOrgsFormDTO.java @@ -6,22 +6,18 @@ import javax.validation.constraints.NotBlank; import java.io.Serializable; /** - * @Description 政府端手机号+验证码登录接口入参 + * @Description 手机验证码获取组织接口入参 * @Author yinzuomei * @Date 2020/4/18 10:38 */ @Data -public class LoginByPhoneFormDTO extends LoginCommonFormDTO implements Serializable { +public class GovWxmpGetOrgsFormDTO implements Serializable { private static final long serialVersionUID = 4193133227120225342L; - @NotBlank(message = "wxCode不能为空") - private String wxCode; - @NotBlank(message = "手机号不能为空") - private String phone; + private String mobile; @NotBlank(message="验证码不能为空") private String smsCode; - } diff --git a/epmet-auth/src/main/java/com/epmet/dto/form/SendSmsCodeFormDTO.java b/epmet-auth/src/main/java/com/epmet/dto/form/SendSmsCodeFormDTO.java index 806ddc43e2..8d82624aee 100644 --- a/epmet-auth/src/main/java/com/epmet/dto/form/SendSmsCodeFormDTO.java +++ b/epmet-auth/src/main/java/com/epmet/dto/form/SendSmsCodeFormDTO.java @@ -11,9 +11,9 @@ import java.io.Serializable; * @Date 2020/04/18 10:26 */ @Data -public class SendSmsCodeFormDTO extends LoginCommonFormDTO implements Serializable { +public class SendSmsCodeFormDTO implements Serializable { private static final long serialVersionUID = -1852541457359282018L; @NotBlank(message = "手机号不能为空") - private String phone; + private String mobile; } diff --git a/epmet-auth/src/main/java/com/epmet/feign/EpmetUserFeignClient.java b/epmet-auth/src/main/java/com/epmet/feign/EpmetUserFeignClient.java index 5b339e18ce..45fe847c49 100644 --- a/epmet-auth/src/main/java/com/epmet/feign/EpmetUserFeignClient.java +++ b/epmet-auth/src/main/java/com/epmet/feign/EpmetUserFeignClient.java @@ -5,9 +5,8 @@ import com.epmet.commons.tools.utils.Result; import com.epmet.dto.CustomerStaffDTO; import com.epmet.dto.UserDTO; import com.epmet.dto.UserWechatDTO; -import com.epmet.dto.form.PasswordLoginUserInfoFormDTO; -import com.epmet.dto.form.StaffWechatFormDTO; -import com.epmet.dto.form.WxLoginUserInfoFormDTO; +import com.epmet.dto.form.*; +import com.epmet.dto.result.LatestStaffWechatLoginResultDTO; import com.epmet.dto.result.PasswordLoginUserInfoResultDTO; import com.epmet.feign.fallback.EpmetUserFeignClientFallback; import org.springframework.cloud.openfeign.FeignClient; @@ -17,6 +16,8 @@ import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; +import java.util.List; + /** * @Description * @Author yinzuomei @@ -58,14 +59,14 @@ public interface EpmetUserFeignClient { Result selectLoginUserInfoByPassword(@RequestBody PasswordLoginUserInfoFormDTO passwordLoginUserInfoFormDTO); /** - * @param phone + * @param mobile * @return com.epmet.commons.tools.utils.Result * @Author yinzuomei * @Description 根据手机号查询政府端工作人员基本信息,校验用户是否存在 * @Date 2020/4/18 14:03 **/ - @GetMapping(value = "epmetuser/customerstaff/getcustsomerstaffbyphone/{phone}") - Result checkCustomerStaff(@PathVariable("phone") String phone); + @GetMapping(value = "epmetuser/customerstaff/getcustsomerstaffbyphone/{mobile}") + Result> checkCustomerStaff(@PathVariable("mobile") String mobile); /** * @param staffWechatFormDTO @@ -76,4 +77,34 @@ public interface EpmetUserFeignClient { **/ @PostMapping(value = "epmetuser/staffwechat/savestaffwechat", consumes = MediaType.APPLICATION_JSON_VALUE) Result savestaffwechat(@RequestBody StaffWechatFormDTO staffWechatFormDTO); + + /** + * @param openId + * @return com.epmet.commons.tools.utils.Result + * @Author yinzuomei + * @Description 获取当前微信上次登录的账号信息 + * @Date 2020/4/20 12:53 + **/ + @GetMapping(value = "epmetuser/staffloginhistory/getlatest/{openId}") + Result getLatestStaffWechatLoginRecord(@PathVariable("openId") String openId); + + /** + * @param customerStaffFormDTO + * @return com.epmet.commons.tools.utils.Result + * @Author yinzuomei + * @Description 根据手机号+客户id获取工作人员基本信息 + * @Date 2020/4/20 14:16 + **/ + @PostMapping(value = "epmetuser/customerstaff/getcustomerstaffinfo", consumes = MediaType.APPLICATION_JSON_VALUE) + Result getCustomerStaffInfo(@RequestBody CustomerStaffFormDTO customerStaffFormDTO); + + /** + * @param staffLoginHistoryFormDTO + * @return com.epmet.commons.tools.utils.Result + * @Author yinzuomei + * @Description 保存登录日志 + * @Date 2020/4/20 14:38 + **/ + @PostMapping(value = "epmetuser/staffloginhistory/saveStaffLoginRecord", consumes = MediaType.APPLICATION_JSON_VALUE) + Result saveStaffLoginRecord(StaffLoginHistoryFormDTO staffLoginHistoryFormDTO); } diff --git a/epmet-auth/src/main/java/com/epmet/feign/GovOrgFeignClient.java b/epmet-auth/src/main/java/com/epmet/feign/GovOrgFeignClient.java new file mode 100644 index 0000000000..0d3fe7c566 --- /dev/null +++ b/epmet-auth/src/main/java/com/epmet/feign/GovOrgFeignClient.java @@ -0,0 +1,23 @@ +package com.epmet.feign; + +import com.epmet.commons.tools.constant.ServiceConstant; +import com.epmet.commons.tools.utils.Result; +import com.epmet.dto.form.StaffGridInfoFormDTO; +import com.epmet.dto.result.StaffGridInfoResultDTO; +import com.epmet.feign.fallback.GovOrgFeignClientFallback; +import org.springframework.cloud.openfeign.FeignClient; +import org.springframework.http.MediaType; +import org.springframework.web.bind.annotation.PostMapping; + +import java.util.List; + +/** + * @Description 政府端组织机构模块 + * @Author yinzuomei + * @Date 2020/4/20 15:18 + */ +@FeignClient(name = ServiceConstant.GOV_ORG_SERVER, fallback = GovOrgFeignClientFallback.class) +public interface GovOrgFeignClient { + @PostMapping(value = "getStaffGridInfo",consumes = MediaType.APPLICATION_JSON_VALUE) + Result> getStaffGridInfo(StaffGridInfoFormDTO staffGridInfoFormDTO); +} diff --git a/epmet-auth/src/main/java/com/epmet/feign/fallback/EpmetUserFeignClientFallback.java b/epmet-auth/src/main/java/com/epmet/feign/fallback/EpmetUserFeignClientFallback.java index 60b63d04da..9126cf63b8 100644 --- a/epmet-auth/src/main/java/com/epmet/feign/fallback/EpmetUserFeignClientFallback.java +++ b/epmet-auth/src/main/java/com/epmet/feign/fallback/EpmetUserFeignClientFallback.java @@ -6,13 +6,14 @@ import com.epmet.commons.tools.utils.Result; import com.epmet.dto.CustomerStaffDTO; import com.epmet.dto.UserDTO; import com.epmet.dto.UserWechatDTO; -import com.epmet.dto.form.PasswordLoginUserInfoFormDTO; -import com.epmet.dto.form.StaffWechatFormDTO; -import com.epmet.dto.form.WxLoginUserInfoFormDTO; +import com.epmet.dto.form.*; +import com.epmet.dto.result.LatestStaffWechatLoginResultDTO; import com.epmet.dto.result.PasswordLoginUserInfoResultDTO; import com.epmet.feign.EpmetUserFeignClient; import org.springframework.stereotype.Component; +import java.util.List; + /** * @Description * @Author yinzuomei @@ -37,7 +38,7 @@ public class EpmetUserFeignClientFallback implements EpmetUserFeignClient { } @Override - public Result checkCustomerStaff(String phone) { + public Result> checkCustomerStaff(String phone) { return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "getCustsomerStaffByPhone", phone); } @@ -46,4 +47,19 @@ public class EpmetUserFeignClientFallback implements EpmetUserFeignClient { return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "saveStaffWechat", staffWechatFormDTO); } + @Override + public Result getLatestStaffWechatLoginRecord(String openId) { + return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "getLatestStaffWechatLoginRecord", openId); + } + + @Override + public Result getCustomerStaffInfo(CustomerStaffFormDTO customerStaffFormDTO) { + return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "getCustomerStaffInfo", customerStaffFormDTO); + } + + @Override + public Result saveStaffLoginRecord(StaffLoginHistoryFormDTO staffLoginHistoryFormDTO) { + return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "saveStaffLoginRecord", staffLoginHistoryFormDTO); + } + } diff --git a/epmet-auth/src/main/java/com/epmet/feign/fallback/GovOrgFeignClientFallback.java b/epmet-auth/src/main/java/com/epmet/feign/fallback/GovOrgFeignClientFallback.java new file mode 100644 index 0000000000..94a235f3ec --- /dev/null +++ b/epmet-auth/src/main/java/com/epmet/feign/fallback/GovOrgFeignClientFallback.java @@ -0,0 +1,25 @@ +package com.epmet.feign.fallback; + +import com.epmet.commons.tools.constant.ServiceConstant; +import com.epmet.commons.tools.utils.ModuleUtils; +import com.epmet.commons.tools.utils.Result; +import com.epmet.dto.form.StaffGridInfoFormDTO; +import com.epmet.dto.result.StaffGridInfoResultDTO; +import com.epmet.feign.GovOrgFeignClient; +import org.springframework.stereotype.Component; + +import java.util.List; + +/** + * @Description 政府端组织机构模块 + * @Author yinzuomei + * @Date 2020/4/20 15:19 + */ +@Component +public class GovOrgFeignClientFallback implements GovOrgFeignClient { + @Override + public Result> getStaffGridInfo(StaffGridInfoFormDTO staffGridInfoFormDTO) { + return ModuleUtils.feignConError(ServiceConstant.GOV_ORG_SERVER, "getStaffGridInfo", staffGridInfoFormDTO); + } +} + diff --git a/epmet-auth/src/main/java/com/epmet/redis/CaptchaRedis.java b/epmet-auth/src/main/java/com/epmet/redis/CaptchaRedis.java index 7363eb93c2..0ec9158dae 100644 --- a/epmet-auth/src/main/java/com/epmet/redis/CaptchaRedis.java +++ b/epmet-auth/src/main/java/com/epmet/redis/CaptchaRedis.java @@ -8,9 +8,10 @@ package com.epmet.redis; +import com.epmet.common.token.constant.LoginConstant; import com.epmet.commons.tools.redis.RedisKeys; import com.epmet.commons.tools.redis.RedisUtils; -import com.epmet.dto.form.LoginByPhoneFormDTO; +import com.epmet.dto.form.GovWxmpGetOrgsFormDTO; import com.epmet.dto.form.SendSmsCodeFormDTO; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; @@ -65,7 +66,7 @@ public class CaptchaRedis { * @Date 2020/4/18 13:53 **/ public void saveSmsCode(SendSmsCodeFormDTO sendSmsCodeFormDTO, String smsCode) { - String smsCodeKey = RedisKeys.getLoginSmsCodeKey(sendSmsCodeFormDTO.getApp(), sendSmsCodeFormDTO.getClient(), sendSmsCodeFormDTO.getPhone()); + String smsCodeKey = RedisKeys.getLoginSmsCodeKey(LoginConstant.APP_GOV, LoginConstant.CLIENT_WXMP, sendSmsCodeFormDTO.getMobile()); logger.info(String.format("短信验证码key=%s", smsCodeKey)); redisUtils.set(smsCodeKey, smsCode, MINUTE_THIRTY_EXPIRE); } @@ -77,8 +78,8 @@ public class CaptchaRedis { * @Description 获取登录时发送的验证码 * @Date 2020/4/18 21:33 **/ - public String getSmsCode(LoginByPhoneFormDTO formDTO) { - String smsCodeKey = RedisKeys.getLoginSmsCodeKey(formDTO.getApp(), formDTO.getClient(), formDTO.getPhone()); + public String getSmsCode(GovWxmpGetOrgsFormDTO formDTO) { + String smsCodeKey = RedisKeys.getLoginSmsCodeKey(LoginConstant.APP_GOV, LoginConstant.CLIENT_WXMP, formDTO.getMobile()); String smsCode = (String) redisUtils.get(smsCodeKey); return smsCode; } diff --git a/epmet-auth/src/main/java/com/epmet/service/GovLoginService.java b/epmet-auth/src/main/java/com/epmet/service/GovLoginService.java new file mode 100644 index 0000000000..b805bbf217 --- /dev/null +++ b/epmet-auth/src/main/java/com/epmet/service/GovLoginService.java @@ -0,0 +1,51 @@ +package com.epmet.service; + +import com.epmet.commons.tools.utils.Result; +import com.epmet.dto.form.GovWxmpEnteOrgFormDTO; +import com.epmet.dto.form.GovWxmpFormDTO; +import com.epmet.dto.form.GovWxmpGetOrgsFormDTO; +import com.epmet.dto.form.SendSmsCodeFormDTO; +import com.epmet.dto.result.UserTokenResultDTO; + +/** + * @Description 政府端登录服务 + * @Author yinzuomei + * @Date 2020/4/20 10:56 + */ +public interface GovLoginService { + /** + * @param formDTO + * @return com.epmet.commons.tools.utils.Result + * @Author yinzuomei + * @Description 政府端微信小程序登录-发送验证码 + * @Date 2020/4/18 10:59 + **/ + Result sendSmsCode(SendSmsCodeFormDTO formDTO); + + /** + * @param formDTO + * @return com.epmet.commons.tools.utils.Result + * @Author yinzuomei + * @Description 3、手机验证码获取组织 + * @Date 2020/4/18 21:11 + **/ + Result getorgs(GovWxmpGetOrgsFormDTO formDTO); + + /** + * @param formDTO + * @return com.epmet.commons.tools.utils.Result + * @Author yinzuomei + * @Description 政府端小程序根据wxCode获取上一次登录信息,返回token + * @Date 2020/4/20 11:23 + **/ + Result loginByWxCode(GovWxmpFormDTO formDTO); + + /** + * @param formDTO + * @return com.epmet.commons.tools.utils.Result + * @Author yinzuomei + * @Description 4、选择组织,进入首页 + * @Date 2020/4/20 13:08 + **/ + Result enterOrg(GovWxmpEnteOrgFormDTO formDTO); +} diff --git a/epmet-auth/src/main/java/com/epmet/service/LoginService.java b/epmet-auth/src/main/java/com/epmet/service/LoginService.java index 1433393413..37ab5f8f74 100644 --- a/epmet-auth/src/main/java/com/epmet/service/LoginService.java +++ b/epmet-auth/src/main/java/com/epmet/service/LoginService.java @@ -4,9 +4,7 @@ import cn.binarywang.wx.miniapp.bean.WxMaJscode2SessionResult; import com.epmet.commons.tools.security.dto.TokenDto; import com.epmet.commons.tools.utils.Result; import com.epmet.dto.form.LoginByPassWordFormDTO; -import com.epmet.dto.form.LoginByPhoneFormDTO; import com.epmet.dto.form.LoginByWxCodeFormDTO; -import com.epmet.dto.form.SendSmsCodeFormDTO; import com.epmet.dto.result.UserTokenResultDTO; /** @@ -52,21 +50,4 @@ public interface LoginService { **/ WxMaJscode2SessionResult getWxMaUser(String app, String wxCode); - /** - * @param formDTO - * @return com.epmet.commons.tools.utils.Result - * @Author yinzuomei - * @Description 政府端微信小程序登录-发送验证码 - * @Date 2020/4/18 10:59 - **/ - Result sendSmsCode(SendSmsCodeFormDTO formDTO); - - /** - * @param formDTO - * @return com.epmet.commons.tools.utils.Result - * @Author yinzuomei - * @Description 政府端微信小程序登录-手机验证码登录 - * @Date 2020/4/18 21:11 - **/ - Result loginByPhone(LoginByPhoneFormDTO formDTO); } diff --git a/epmet-auth/src/main/java/com/epmet/service/impl/GovLoginServiceImpl.java b/epmet-auth/src/main/java/com/epmet/service/impl/GovLoginServiceImpl.java new file mode 100644 index 0000000000..f41e0b81d9 --- /dev/null +++ b/epmet-auth/src/main/java/com/epmet/service/impl/GovLoginServiceImpl.java @@ -0,0 +1,264 @@ +package com.epmet.service.impl; + +import cn.binarywang.wx.miniapp.bean.WxMaJscode2SessionResult; +import com.epmet.common.token.constant.LoginConstant; +import com.epmet.commons.tools.exception.EpmetErrorCode; +import com.epmet.commons.tools.security.dto.GovTokenDto; +import com.epmet.commons.tools.utils.CpUserDetailRedis; +import com.epmet.commons.tools.utils.DateUtils; +import com.epmet.commons.tools.utils.Result; +import com.epmet.commons.tools.validator.PhoneValidatorUtils; +import com.epmet.dto.CustomerStaffDTO; +import com.epmet.dto.form.*; +import com.epmet.dto.result.LatestStaffWechatLoginResultDTO; +import com.epmet.dto.result.StaffGridInfoResultDTO; +import com.epmet.dto.result.UserTokenResultDTO; +import com.epmet.feign.EpmetUserFeignClient; +import com.epmet.feign.GovOrgFeignClient; +import com.epmet.feign.MessageFeignClient; +import com.epmet.jwt.JwtTokenProperties; +import com.epmet.jwt.JwtTokenUtils; +import com.epmet.redis.CaptchaRedis; +import com.epmet.service.GovLoginService; +import com.epmet.service.LoginService; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * @Description 政府端登录服务 + * @Author yinzuomei + * @Date 2020/4/20 10:56 + */ +@Service +public class GovLoginServiceImpl implements GovLoginService { + private static final Logger logger = LoggerFactory.getLogger(GovLoginServiceImpl.class); + private static final String SEND_SMS_CODE_ERROR = "发送短信验证码异常,手机号[%s],code[%s],msg[%s]"; + @Autowired + private LoginService loginService; + @Autowired + private EpmetUserFeignClient epmetUserFeignClient; + @Autowired + private CaptchaRedis captchaRedis; + @Autowired + private MessageFeignClient messageFeignClient; + @Autowired + private JwtTokenUtils jwtTokenUtils; + @Autowired + private JwtTokenProperties jwtTokenProperties; + @Autowired + private CpUserDetailRedis cpUserDetailRedis; + @Autowired + private GovOrgFeignClient govOrgFeignClient; + + /** + * @param formDTO + * @return com.epmet.commons.tools.utils.Result + * @Author yinzuomei + * @Description 政府端微信小程序登录-发送验证码 + * @Date 2020/4/18 10:59 + **/ + @Override + public Result sendSmsCode(SendSmsCodeFormDTO formDTO) { + //1、校验手机号是否符合规范 + if (!PhoneValidatorUtils.isMobile(formDTO.getMobile())) { + logger.error(String.format(SEND_SMS_CODE_ERROR, formDTO.getMobile(), EpmetErrorCode.ERROR_PHONE.getCode(), EpmetErrorCode.ERROR_PHONE.getMsg())); + return new Result().error(EpmetErrorCode.ERROR_PHONE.getCode()); + } + //2、根据手机号校验用户是否存在 + Result> customerStaffResult = epmetUserFeignClient.checkCustomerStaff(formDTO.getMobile()); + if (!customerStaffResult.success()) { + logger.error(String.format(SEND_SMS_CODE_ERROR, formDTO.getMobile(), customerStaffResult.getCode(), customerStaffResult.getMsg())); + return new Result().error(customerStaffResult.getCode()); + } + //3、发送短信验证码 + Result> smsCodeResult = messageFeignClient.sendSmsCaptcha(formDTO.getMobile()); + if (!smsCodeResult.success()) { + logger.error(String.format(SEND_SMS_CODE_ERROR, formDTO.getMobile(), smsCodeResult.getCode(), smsCodeResult.getMsg())); + return new Result().error(smsCodeResult.getCode()); + } + //4、保存短信验证码(删除现有短信验证码、将新的短信验证码存入Redis) + captchaRedis.saveSmsCode(formDTO, smsCodeResult.getData().get("code")); + logger.info(String.format("发送短信验证码成功,手机号[%s]", formDTO.getMobile())); + return new Result(); + } + + /** + * @param formDTO + * @return com.epmet.commons.tools.utils.Result + * @Author yinzuomei + * @Description 3、手机验证码获取组织 + * @Date 2020/4/18 21:11 + **/ + @Override + public Result getorgs(GovWxmpGetOrgsFormDTO formDTO) { + //1、根据手机号查询到用户信息 + Result> customerStaffResult = epmetUserFeignClient.checkCustomerStaff(formDTO.getMobile()); + if (!customerStaffResult.success()) { + logger.error(String.format("手机验证码登录异常,手机号[%s],code[%s],msg[%s]", formDTO.getMobile(), customerStaffResult.getCode(), customerStaffResult.getMsg())); + return new Result().error(customerStaffResult.getCode()); + } + //2、验证码是否正确 + String rightSmsCode = captchaRedis.getSmsCode(formDTO); + if (!formDTO.getSmsCode().equals(rightSmsCode)) { + return new Result().error(EpmetErrorCode.MOBILE_CODE_ERROR.getCode()); + } + //3、TODO返回组织树 + return new Result(); + } + + @Override + public Result loginByWxCode(GovWxmpFormDTO formDTO) { + //1、解析微信用户 + WxMaJscode2SessionResult wxMaJscode2SessionResult = loginService.getWxMaUser(formDTO.getApp(), formDTO.getWxCode()); + Result latestStaffWechat = epmetUserFeignClient.getLatestStaffWechatLoginRecord(wxMaJscode2SessionResult.getOpenid()); + if (!latestStaffWechat.success() || null == latestStaffWechat.getData()) { + logger.error(String.format("没有获取到用户最近一次登录账户信息,code[%s],msg[%s]", EpmetErrorCode.PLEASE_LOGIN.getCode(), EpmetErrorCode.PLEASE_LOGIN.getMsg())); + return new Result().error(EpmetErrorCode.PLEASE_LOGIN.getCode()); + } + LatestStaffWechatLoginResultDTO latestStaffWechatLoginDTO = latestStaffWechat.getData(); + //2、记录staff_wechat + this.savestaffwechat(latestStaffWechatLoginDTO.getStaffId(), wxMaJscode2SessionResult.getOpenid()); + //3、记录登录日志 + this.saveStaffLoginRecord(latestStaffWechatLoginDTO); + //4、获取用户token + String token = this.generateGovWxmpToken(latestStaffWechatLoginDTO.getStaffId()); + //5、保存到redis + this.saveGovTokenDto(latestStaffWechatLoginDTO.getOrgId(), latestStaffWechatLoginDTO.getGridId(), latestStaffWechatLoginDTO.getStaffId(), wxMaJscode2SessionResult, token); + UserTokenResultDTO userTokenResultDTO = new UserTokenResultDTO(); + userTokenResultDTO.setToken(token); + return new Result().ok(userTokenResultDTO); + } + + //保存登录日志 + private Result saveStaffLoginRecord(LatestStaffWechatLoginResultDTO latestStaffWechatLoginDTO) { + StaffLoginHistoryFormDTO staffLoginHistoryFormDTO = new StaffLoginHistoryFormDTO(); + staffLoginHistoryFormDTO.setCustomerId(latestStaffWechatLoginDTO.getCustomerId()); + staffLoginHistoryFormDTO.setStaffId(latestStaffWechatLoginDTO.getStaffId()); + staffLoginHistoryFormDTO.setWxOpenId(latestStaffWechatLoginDTO.getWxOpenId()); + staffLoginHistoryFormDTO.setMobile(latestStaffWechatLoginDTO.getMobile()); + staffLoginHistoryFormDTO.setOrgId(latestStaffWechatLoginDTO.getOrgId()); + staffLoginHistoryFormDTO.setGridId(latestStaffWechatLoginDTO.getGridId()); + Result staffLoginRecordResult = epmetUserFeignClient.saveStaffLoginRecord(staffLoginHistoryFormDTO); + return staffLoginRecordResult; + } + + @Override + public Result enterOrg(GovWxmpEnteOrgFormDTO formDTO) { + //1、需要校验要登录的客户,是否被禁用 + CustomerStaffFormDTO customerStaffFormDTO = new CustomerStaffFormDTO(); + customerStaffFormDTO.setCustomerId(formDTO.getCustomerId()); + customerStaffFormDTO.setMobile(formDTO.getMobile()); + Result customerStaffDTOResult = epmetUserFeignClient.getCustomerStaffInfo(customerStaffFormDTO); + if (!customerStaffDTOResult.success() || null == customerStaffDTOResult.getData()) { + logger.error(String.format("获取工作人员信息失败,手机号[%s],客户id:[%s],code[%s],msg[%s]", formDTO.getMobile(), formDTO.getCustomerId(), customerStaffDTOResult.getCode(), customerStaffDTOResult.getMsg())); + return new Result().error(customerStaffDTOResult.getCode()); + } + CustomerStaffDTO customerStaff = customerStaffDTOResult.getData(); + //2、解析微信用户 + WxMaJscode2SessionResult wxMaJscode2SessionResult = loginService.getWxMaUser(LoginConstant.APP_GOV, formDTO.getWxCode()); + //3、记录staff_wechat + this.savestaffwechat(customerStaff.getUserId(), wxMaJscode2SessionResult.getOpenid()); + //4、记录登录日志 + StaffGridInfoFormDTO staffGridInfoFormDTO = new StaffGridInfoFormDTO(); + staffGridInfoFormDTO.setCustomerId(formDTO.getCustomerId()); + staffGridInfoFormDTO.setOrgId(formDTO.getOrgId()); + staffGridInfoFormDTO.setStaffId(customerStaff.getUserId()); + Result> staffGridInfoListResult = govOrgFeignClient.getStaffGridInfo(staffGridInfoFormDTO); + String gridId = null; + if (staffGridInfoListResult.success() && null != staffGridInfoListResult.getData() && staffGridInfoListResult.getData().size() > 0) { + gridId = staffGridInfoListResult.getData().get(0).getGridId(); + } + this.saveStaffLoginRecord(formDTO, customerStaff.getUserId(), wxMaJscode2SessionResult.getOpenid(), gridId); + UserTokenResultDTO userTokenResultDTO = this.getAuthorizationInfo(formDTO.getOrgId(), gridId, customerStaff.getUserId(), wxMaJscode2SessionResult); + return new Result().ok(userTokenResultDTO); + } + + //保存登录日志 + private Result saveStaffLoginRecord(GovWxmpEnteOrgFormDTO formDTO, String staffId, String openId, String grid) { + StaffLoginHistoryFormDTO staffLoginHistoryFormDTO = new StaffLoginHistoryFormDTO(); + staffLoginHistoryFormDTO.setCustomerId(formDTO.getCustomerId()); + staffLoginHistoryFormDTO.setStaffId(staffId); + staffLoginHistoryFormDTO.setWxOpenId(openId); + staffLoginHistoryFormDTO.setMobile(formDTO.getMobile()); + staffLoginHistoryFormDTO.setOrgId(formDTO.getOrgId()); + staffLoginHistoryFormDTO.setGridId(grid); + Result staffLoginRecordResult = epmetUserFeignClient.saveStaffLoginRecord(staffLoginHistoryFormDTO); + return staffLoginRecordResult; + } + + private UserTokenResultDTO getAuthorizationInfo(String orgId, + String gridId, + String staffId, + WxMaJscode2SessionResult wxMaJscode2SessionResult) { + //1、获取用户token + String token = this.generateGovWxmpToken(staffId); + //2、保存到redis + this.saveGovTokenDto(orgId, gridId, staffId, wxMaJscode2SessionResult, token); + UserTokenResultDTO userTokenResultDTO = new UserTokenResultDTO(); + userTokenResultDTO.setToken(token); + return userTokenResultDTO; + } + + /** + * @param userId + * @param openid + * @return com.epmet.commons.tools.utils.Result + * @Author yinzuomei + * @Description 保存微信和当前登录用户关系 + * @Date 2020/4/18 22:54 + **/ + private Result savestaffwechat(String userId, String openid) { + StaffWechatFormDTO staffWechatFormDTO = new StaffWechatFormDTO(); + staffWechatFormDTO.setUserId(userId); + staffWechatFormDTO.setWxOpenId(openid); + return epmetUserFeignClient.savestaffwechat(staffWechatFormDTO); + } + + /** + * @Description 生成token + * @Date 2020/4/18 23:04 + **/ + private String generateGovWxmpToken(String staffId) { + Map map = new HashMap<>(); + map.put("app", LoginConstant.APP_GOV); + map.put("client", LoginConstant.CLIENT_WXMP); + map.put("staffId", staffId); + String token = jwtTokenUtils.createToken(map); + logger.info("app:" + LoginConstant.APP_GOV + ";client:" + LoginConstant.CLIENT_WXMP + ";staffId:" + staffId + ";生成token[" + token + "]"); + return token; + } + + /** + * @Description 生成token + * @Date 2020/4/18 23:04 + **/ + private String saveGovTokenDto(String orgId, + String gridId, + String staffId, + WxMaJscode2SessionResult wxMaJscode2SessionResult, + String token) { + int expire = jwtTokenProperties.getExpire(); + GovTokenDto govTokenDto = new GovTokenDto(); + govTokenDto.setApp(LoginConstant.APP_GOV); + govTokenDto.setClient(LoginConstant.CLIENT_WXMP); + govTokenDto.setStaffId(staffId); + govTokenDto.setOpenId(wxMaJscode2SessionResult.getOpenid()); + govTokenDto.setSessionKey(wxMaJscode2SessionResult.getSessionKey()); + govTokenDto.setUnionId(wxMaJscode2SessionResult.getUnionid()); + govTokenDto.setToken(token); + govTokenDto.setUpdateTime(System.currentTimeMillis()); + govTokenDto.setExpireTime(jwtTokenUtils.getExpiration(token).getTime()); + govTokenDto.setOrgId(orgId); + govTokenDto.setGridId(gridId); + cpUserDetailRedis.set(govTokenDto, expire); + logger.info("截止时间:" + DateUtils.format(jwtTokenUtils.getExpiration(token), "yyyy-MM-dd HH:mm:ss")); + return token; + } +} + diff --git a/epmet-auth/src/main/java/com/epmet/service/impl/LoginServiceImpl.java b/epmet-auth/src/main/java/com/epmet/service/impl/LoginServiceImpl.java index 669c0596a5..225e2520fb 100644 --- a/epmet-auth/src/main/java/com/epmet/service/impl/LoginServiceImpl.java +++ b/epmet-auth/src/main/java/com/epmet/service/impl/LoginServiceImpl.java @@ -3,7 +3,6 @@ package com.epmet.service.impl; import cn.binarywang.wx.miniapp.bean.WxMaJscode2SessionResult; import cn.binarywang.wx.miniapp.bean.WxMaUserInfo; import com.epmet.common.token.constant.LoginConstant; -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.security.dto.TokenDto; @@ -11,18 +10,14 @@ import com.epmet.commons.tools.security.password.PasswordUtils; import com.epmet.commons.tools.utils.CpUserDetailRedis; import com.epmet.commons.tools.utils.DateUtils; import com.epmet.commons.tools.utils.Result; -import com.epmet.commons.tools.validator.PhoneValidatorUtils; -import com.epmet.dto.CustomerStaffDTO; import com.epmet.dto.UserDTO; import com.epmet.dto.UserWechatDTO; import com.epmet.dto.form.*; import com.epmet.dto.result.PasswordLoginUserInfoResultDTO; import com.epmet.dto.result.UserTokenResultDTO; import com.epmet.feign.EpmetUserFeignClient; -import com.epmet.feign.MessageFeignClient; import com.epmet.jwt.JwtTokenProperties; import com.epmet.jwt.JwtTokenUtils; -import com.epmet.redis.CaptchaRedis; import com.epmet.service.CaptchaService; import com.epmet.service.LoginService; import com.epmet.utils.WxMaServiceUtils; @@ -65,12 +60,6 @@ public class LoginServiceImpl implements LoginService { @Autowired private CaptchaService captchaService; - @Autowired - private CaptchaRedis captchaRedis; - - @Autowired - private MessageFeignClient messageFeignClient; - /** * 居民端微信小程序登录 * @@ -327,94 +316,6 @@ public class LoginServiceImpl implements LoginService { return new Result().ok("退出登录!"); } - private static final String SEND_SMS_CODE_ERROR="发送短信验证码异常,手机号[%s],code[%s],msg[%s]"; - - /** - * @param formDTO - * @return com.epmet.commons.tools.utils.Result - * @Author yinzuomei - * @Description 政府端微信小程序登录-发送验证码 - * @Date 2020/4/18 10:59 - **/ - @Override - public Result sendSmsCode(SendSmsCodeFormDTO formDTO) { - //1、校验手机号是否符合规范 - if(!PhoneValidatorUtils.isMobile(formDTO.getPhone())){ - logger.error(String.format(SEND_SMS_CODE_ERROR,formDTO.getPhone(), EpmetErrorCode.ERROR_PHONE.getCode(),EpmetErrorCode.ERROR_PHONE.getMsg())); - return new Result().error(EpmetErrorCode.ERROR_PHONE.getCode()); - } - //2、根据手机号校验用户是否存在 - Result customerStaffResult=epmetUserFeignClient.checkCustomerStaff(formDTO.getPhone()); - if(!customerStaffResult.success()){ - logger.error(String.format(SEND_SMS_CODE_ERROR,formDTO.getPhone(),customerStaffResult.getCode(),customerStaffResult.getMsg())); - return new Result().error(customerStaffResult.getCode()); - } - //3、发送短信验证码 - Result> smsCodeResult=messageFeignClient.sendSmsCaptcha(formDTO.getPhone()); - if(!smsCodeResult.success()){ - logger.error(String.format(SEND_SMS_CODE_ERROR,formDTO.getPhone(),smsCodeResult.getCode(),smsCodeResult.getMsg())); - return new Result().error(smsCodeResult.getCode()); - } - //4、保存短信验证码(删除现有短信验证码、将新的短信验证码存入Redis) - captchaRedis.saveSmsCode(formDTO,smsCodeResult.getData().get("code")); - logger.info(String.format("发送短信验证码成功,手机号[%s]",formDTO.getPhone())); - return new Result(); - } - - /** - * @param formDTO - * @return com.epmet.commons.tools.utils.Result - * @Author yinzuomei - * @Description 政府端微信小程序登录-手机验证码登录 - * @Date 2020/4/18 21:11 - **/ - @Override - public Result loginByPhone(LoginByPhoneFormDTO formDTO) { - //1、根据手机号查询到用户信息 - Result customerStaffResult=epmetUserFeignClient.checkCustomerStaff(formDTO.getPhone()); - if(!customerStaffResult.success()){ - logger.error(String.format("手机验证码登录异常,手机号[%s],code[%s],msg[%s]",formDTO.getPhone(),customerStaffResult.getCode(),customerStaffResult.getMsg())); - return new Result().error(customerStaffResult.getCode()); - } - //2、验证码是否正确 - String rightSmsCode=captchaRedis.getSmsCode(formDTO); - if(!formDTO.getSmsCode().equals(rightSmsCode)){ - return new Result().error(EpmetErrorCode.MOBILE_CODE_ERROR.getCode()); - } - //3、解析wxCode - UserTokenResultDTO userTokenResultDTO=this.getAuthorizationInfo(formDTO,customerStaffResult.getData()); - return new Result().ok(userTokenResultDTO); - } - - private UserTokenResultDTO getAuthorizationInfo(LoginByPhoneFormDTO formDTO, CustomerStaffDTO customerStaff) { - //1、解析微信用户 - WxMaJscode2SessionResult wxMaJscode2SessionResult=this.getWxMaUser(formDTO.getApp(),formDTO.getWxCode()); - //2、记录staff_wechat - this.savestaffwechat(customerStaff.getUserId(),wxMaJscode2SessionResult.getOpenid()); - //3、获取用户token - String token=this.generateToken(formDTO,customerStaff.getUserId()); - //4、保存到redis - this.saveTokenDto(formDTO,customerStaff.getUserId(),wxMaJscode2SessionResult,token); - UserTokenResultDTO userTokenResultDTO = new UserTokenResultDTO(); - userTokenResultDTO.setToken(token); - return userTokenResultDTO; - } - - /** - * @return com.epmet.commons.tools.utils.Result - * @param userId - * @param openid - * @Author yinzuomei - * @Description 保存微信和当前登录用户关系 - * @Date 2020/4/18 22:54 - **/ - private Result savestaffwechat(String userId, String openid) { - StaffWechatFormDTO staffWechatFormDTO = new StaffWechatFormDTO(); - staffWechatFormDTO.setUserId(userId); - staffWechatFormDTO.setWxOpenId(openid); - return epmetUserFeignClient.savestaffwechat(staffWechatFormDTO); - } - /** * @Description 生成token * @Date 2020/4/18 23:04 diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/annotation/LoginUser.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/annotation/LoginUser.java index 0a7f7b625a..03ba0cb04f 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/annotation/LoginUser.java +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/annotation/LoginUser.java @@ -19,7 +19,7 @@ package com.epmet.commons.tools.annotation; import java.lang.annotation.*; /** - * 登录用户信息 + * 居民登录用户信息 * * @author chenshun * @email sunlightcs@gmail.com diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java index a77e4f3130..230c53fbc8 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java @@ -14,6 +14,7 @@ public enum EpmetErrorCode { GOV_STAFF_DISABLED(8005,"您好,您的账户已被冻结,请联系管理员。"), LOSE_EFFICACY(8006,"此邀请链接已过期"), ERROR_PHONE(8007,"请输入正确的手机号"), + PLEASE_LOGIN(8008,"请重新登录"), MOBILE_HAS_BEEN_USED(8101, "该手机号已注册,请更换手机号或使用原绑定的微信账号登录"), MOBILE_CODE_ERROR(8102, "验证码错误"), AUTO_CONFIRM_FAILED(8103, "党员注册失败"), diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/security/dto/GovTokenDto.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/security/dto/GovTokenDto.java new file mode 100644 index 0000000000..08d9954eda --- /dev/null +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/security/dto/GovTokenDto.java @@ -0,0 +1,80 @@ +package com.epmet.commons.tools.security.dto; + +import lombok.Data; + +import java.io.Serializable; +import java.util.List; + +/** + * @Description 政府端登录信息 + * @Author yinzuomei + * @Date 2020/4/20 11:01 + */ +@Data +public class GovTokenDto implements Serializable { + /** + * 政府端:gov、居民端:resi、运营端:oper + */ + private String app; + + /** + * PC端:web、微信小程序:wxmp + */ + private String client; + + /** + * 用户ID + */ + private String staffId; + + /** + * sessionKey + */ + private String sessionKey; + + /** + * openId + */ + private String openId; + + /** + * unionId + */ + private String unionId; + + /** + * token字符串 + */ + private String token; + + /** + * 过期时间戳 + */ + private Long expireTime; + + /** + * 最后一次更新时间 + */ + private long updateTime; + + /** + * 当前登录的组织id + */ + private String orgId; + + /** + * 待定 + */ + private String orgIdPath; + + /** + * 待定 + */ + private String gridId; + + /** + * 待定 + */ + private List deptIdList; +} + diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/security/resolver/LoginUserHandlerMethodArgumentResolver.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/security/resolver/LoginUserHandlerMethodArgumentResolver.java index 7af851b8bf..ec70df9403 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/security/resolver/LoginUserHandlerMethodArgumentResolver.java +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/security/resolver/LoginUserHandlerMethodArgumentResolver.java @@ -72,12 +72,11 @@ public class LoginUserHandlerMethodArgumentResolver implements HandlerMethodArgu if (StringUtils.isEmpty(redisKey)) { throw new RenException(ErrorCode.UNAUTHORIZED); } - String[] keyArray=redisKey.split("-"); - String app=keyArray[0]; - String client=keyArray[1]; - String userId=keyArray[2]; - - //TokenDto tokenDto = cpUserDetailRedis.get(app,client,userId); +// String[] keyArray=redisKey.split("-"); +// String app=keyArray[0]; +// String client=keyArray[1]; +// String userId=keyArray[2]; +// TokenDto tokenDto = cpUserDetailRedis.get(app,client,userId); TokenDto tokenDto = new TokenDto(); tokenDto.setUserId(request.getHeader("userId")); tokenDto.setApp(request.getHeader("app")); diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/CpUserDetailRedis.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/CpUserDetailRedis.java index f49c9ddcb5..100c583a01 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/CpUserDetailRedis.java +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/CpUserDetailRedis.java @@ -12,6 +12,7 @@ import cn.hutool.core.bean.BeanUtil; import cn.hutool.core.map.MapUtil; import com.epmet.commons.tools.redis.RedisKeys; import com.epmet.commons.tools.redis.RedisUtils; +import com.epmet.commons.tools.security.dto.GovTokenDto; import com.epmet.commons.tools.security.dto.TokenDto; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; @@ -99,4 +100,34 @@ public class CpUserDetailRedis { public long getExpire(String app, String client, String userId) { return redisUtils.getExpire(RedisKeys.getCpUserKey(app, client, userId)); } + + public void set(GovTokenDto user, long expire) { + if (user == null) { + return; + } + String key = RedisKeys.getCpUserKey(user.getApp(), user.getClient(), user.getStaffId()); + //bean to map + Map map = BeanUtil.beanToMap(user, false, true); + redisUtils.hMSet(key, map, expire); + } + + /** + * 获取token信息 + * + * @param app 居民端resi;政府端gov;运营端oper + * @param client PC端:web;微信小程序端:wxmp + * @param userId oper_user、customer_user、customer_staff表主键 + * @return + */ + public GovTokenDto getGovTokenDto(String app, String client, String userId) { + String key = RedisKeys.getCpUserKey(app,client,userId); + + Map map = redisUtils.hGetAll(key); + if (MapUtil.isEmpty(map)) { + return null; + } + //map to bean + GovTokenDto govTokenDto = BeanUtil.mapToBean(map, GovTokenDto.class, true); + return govTokenDto; + } } diff --git a/epmet-gateway/pom.xml b/epmet-gateway/pom.xml index a451ebf0b2..eed74d589d 100644 --- a/epmet-gateway/pom.xml +++ b/epmet-gateway/pom.xml @@ -108,53 +108,53 @@ - - http://127.0.0.1:8081 + lb://epmet-auth-server + - - http://127.0.0.1:8082 + lb://epmet-admin-server + - - http://127.0.0.1:8083 + lb://epmet-oss-server + - - http://127.0.0.1:8085 + lb://epmet-message-server + - - http://127.0.0.1:8086 + lb://epmet-activiti-server + - - http://127.0.0.1:8084 + lb://epmet-job-server + - - http://127.0.0.1:8087 + lb://epmet-user-server + http://127.0.0.1:8088 - - http://127.0.0.1:8089 + lb://oper-customize-server + - - http://127.0.0.1:8090 + lb://oper-crm-server + - - http://127.0.0.1:8091 + lb://resi-guide-server + - - http://127.0.0.1:8092 + lb://gov-org-server + - - http://127.0.0.1:8093 + lb://oper-access-server + - - http://127.0.0.1:8094 + lb://resi-mine-server + - - http://127.0.0.1:8095 + lb://resi-group-server + - http://127.0.0.1:8096 - + + lb://resi-partymember-server diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/StaffGridInfoFormDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/StaffGridInfoFormDTO.java new file mode 100644 index 0000000000..85b321f25a --- /dev/null +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/StaffGridInfoFormDTO.java @@ -0,0 +1,30 @@ +package com.epmet.dto.form; + +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import java.io.Serializable; + +/** + * @Description 根据用户选择的组织,查询用户与网格的关系列表 + * @Author yinzuomei + * @Date 2020/4/20 15:29 + */ +@Data +public class StaffGridInfoFormDTO implements Serializable { + /** + * 用户选择的组织所属的id + */ + @NotBlank(message = "客户id不能为空") + private String customerId; + + /** + * 用户选择的要进入的组织(根组织id) + */ + @NotBlank(message = "组织id不能为空") + private String orgId; + + @NotBlank(message = "staffId不能为空") + private String staffId; +} + diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/StaffGridInfoResultDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/StaffGridInfoResultDTO.java new file mode 100644 index 0000000000..e636db75ee --- /dev/null +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/StaffGridInfoResultDTO.java @@ -0,0 +1,39 @@ +package com.epmet.dto.result; + +import lombok.Data; + +import java.io.Serializable; + +/** + * @Description 根据用户选择的组织,查询用户与网格的关系列表 + * @Author yinzuomei + * @Date 2020/4/20 15:22 + */ +@Data +public class StaffGridInfoResultDTO implements Serializable { + /** + * ID 唯一标识 + */ + private String gridId; + + /** + * 客户ID + */ + private String customerId; + + /** + * 网格名称 + */ + private String gridName; + + /** + * 所属组织机构ID(customer_organization.id) + */ + private String pid; + + /** + * 所有上级组织ID + */ + private String pids; +} + diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/CustomerGridController.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/CustomerGridController.java index ed7db2c1c7..8163a30c15 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/CustomerGridController.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/CustomerGridController.java @@ -23,12 +23,14 @@ import com.epmet.commons.tools.utils.Result; import com.epmet.commons.tools.validator.AssertUtils; import com.epmet.commons.tools.validator.ValidatorUtils; import com.epmet.commons.tools.validator.group.AddGroup; -import com.epmet.commons.tools.validator.group.UpdateGroup; import com.epmet.commons.tools.validator.group.DefaultGroup; +import com.epmet.commons.tools.validator.group.UpdateGroup; import com.epmet.dto.CustomerGridDTO; +import com.epmet.dto.form.CustomerGridFormDTO; import com.epmet.dto.form.ListCustomerGridFormDTO; +import com.epmet.dto.form.StaffGridInfoFormDTO; import com.epmet.dto.result.CustomerGridForStrangerResultDTO; -import com.epmet.dto.form.CustomerGridFormDTO; +import com.epmet.dto.result.StaffGridInfoResultDTO; import com.epmet.excel.CustomerGridExcel; import com.epmet.service.CustomerGridService; import org.springframework.beans.factory.annotation.Autowired; @@ -124,4 +126,17 @@ public class CustomerGridController { CustomerGridDTO data = customerGridService.get(id); return new Result().ok(data); } + + /** + * @param staffGridInfoFormDTO + * @return com.epmet.commons.tools.utils.Result> + * @Author yinzuomei + * @Description 根据用户选择的组织,查询用户与网格的关系列表 + * @Date 2020/4/20 15:34 + **/ + @PostMapping(value = "getStaffGridInfo") + public Result> getStaffGridInfo(@RequestBody StaffGridInfoFormDTO staffGridInfoFormDTO) { + ValidatorUtils.validateEntity(staffGridInfoFormDTO); + return customerGridService.listStaffGridInfo(staffGridInfoFormDTO); + } } 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 a0b7899e9c..b42077b396 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 @@ -18,13 +18,14 @@ package com.epmet.dao; import com.epmet.commons.mybatis.dao.BaseDao; -import com.epmet.dto.form.ListCustomerGridFormDTO; -import com.epmet.dto.result.CustomerGridForStrangerResultDTO; import com.epmet.dto.CustomerGridDTO; import com.epmet.dto.form.CustomerGridFormDTO; +import com.epmet.dto.form.ListCustomerGridFormDTO; +import com.epmet.dto.form.StaffGridInfoFormDTO; +import com.epmet.dto.result.CustomerGridForStrangerResultDTO; +import com.epmet.dto.result.StaffGridInfoResultDTO; 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; @@ -61,4 +62,13 @@ public interface CustomerGridDao extends BaseDao { List selectRestGridWithoutGivenAreaCode(Map paramsMap); CustomerGridDTO getCustomerGridByGridId(CustomerGridFormDTO customerGridFormDTO); + + /** + * @param staffGridInfoFormDTO + * @return java.util.List + * @Author yinzuomei + * @Description 查询工作人员绑定的网格列表 + * @Date 2020/4/20 15:36 + **/ + List selectListStaffGridInfo(StaffGridInfoFormDTO staffGridInfoFormDTO); } \ 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 3da56bc4d2..d8728c39dd 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 @@ -23,7 +23,9 @@ import com.epmet.commons.tools.utils.Result; import com.epmet.dto.CustomerGridDTO; import com.epmet.dto.form.CustomerGridFormDTO; import com.epmet.dto.form.ListCustomerGridFormDTO; +import com.epmet.dto.form.StaffGridInfoFormDTO; import com.epmet.dto.result.CustomerGridForStrangerResultDTO; +import com.epmet.dto.result.StaffGridInfoResultDTO; import com.epmet.entity.CustomerGridEntity; import java.util.List; @@ -113,4 +115,13 @@ public interface CustomerGridService extends BaseService { * @date 2020-03-17 */ Result getCustomerGridByGridId(CustomerGridFormDTO customerGridFormDTO); + + /** + * @param staffGridInfoFormDTO + * @return com.epmet.commons.tools.utils.Result> + * @Author yinzuomei + * @Description 根据用户选择的组织,查询用户与网格的关系列表 + * @Date 2020/4/20 15:35 + **/ + Result> listStaffGridInfo(StaffGridInfoFormDTO staffGridInfoFormDTO); } \ 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 ea8bc48c65..d4e61df8b1 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,7 +28,9 @@ import com.epmet.dao.CustomerGridDao; import com.epmet.dto.CustomerGridDTO; import com.epmet.dto.form.CustomerGridFormDTO; import com.epmet.dto.form.ListCustomerGridFormDTO; +import com.epmet.dto.form.StaffGridInfoFormDTO; import com.epmet.dto.result.CustomerGridForStrangerResultDTO; +import com.epmet.dto.result.StaffGridInfoResultDTO; import com.epmet.entity.CustomerGridEntity; import com.epmet.redis.CustomerGridRedis; @@ -152,4 +154,10 @@ public class CustomerGridServiceImpl extends BaseServiceImpl().ok(baseDao.getCustomerGridByGridId(customerGridFormDTO)); } + @Override + public Result> listStaffGridInfo(StaffGridInfoFormDTO staffGridInfoFormDTO) { + List list = baseDao.selectListStaffGridInfo(staffGridInfoFormDTO); + return new Result>().ok(list); + } + } 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 7c35a3e1c5..6ea3950fb8 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 @@ -92,4 +92,24 @@ LIMIT #{pageNo}, #{pageSize} + + + \ No newline at end of file diff --git a/epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/controller/OperMenuController.java b/epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/controller/OperMenuController.java index 80f82dff81..12e8fae171 100644 --- a/epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/controller/OperMenuController.java +++ b/epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/controller/OperMenuController.java @@ -1,6 +1,5 @@ package com.epmet.controller; -import com.epmet.commons.tools.annotation.LoginUser; import com.epmet.commons.tools.exception.ErrorCode; import com.epmet.commons.tools.page.PageData; import com.epmet.commons.tools.security.dto.TokenDto; @@ -58,7 +57,7 @@ public class OperMenuController { } @PostMapping - public Result save(@RequestBody OperMenuDTO dto, @LoginUser TokenDto tokenDto){ + public Result save(@RequestBody OperMenuDTO dto, TokenDto tokenDto){ //效验数据 ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class); operMenuService.save(dto,tokenDto); @@ -66,7 +65,7 @@ public class OperMenuController { } @PutMapping - public Result update(@RequestBody OperMenuDTO dto, @LoginUser TokenDto tokenDto){ + public Result update(@RequestBody OperMenuDTO dto, TokenDto tokenDto){ //效验数据 ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class); operMenuService.update(dto,tokenDto); @@ -82,7 +81,7 @@ public class OperMenuController { } @DeleteMapping("{id}") - public Result delete(@PathVariable("id") String id, @LoginUser TokenDto tokenDto){ + public Result delete(@PathVariable("id") String id, TokenDto tokenDto){ //效验数据 AssertUtils.isNull(id, "id"); @@ -121,7 +120,7 @@ public class OperMenuController { * @return List */ @GetMapping("nav") - public Result> nav(@LoginUser TokenDto tokenDto){ + public Result> nav(TokenDto tokenDto){ List list = operMenuService.getUserMenuNavList(tokenDto); return new Result>().ok(list); } @@ -132,7 +131,7 @@ public class OperMenuController { * @return Set */ @GetMapping("permissions") - public Result> permissions(@LoginUser TokenDto tokenDto){ + public Result> permissions(TokenDto tokenDto){ Set set = operMenuService.getUserPermissions(tokenDto); return new Result>().ok(set); } @@ -143,7 +142,7 @@ public class OperMenuController { * @return */ @GetMapping("select") - public Result> select(@LoginUser TokenDto tokenDto){ + public Result> select(TokenDto tokenDto){ List list = operMenuService.getUserMenuList(tokenDto, null); return new Result>().ok(list); diff --git a/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/controller/CustomerController.java b/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/controller/CustomerController.java index 4a9bbd1119..7cca833383 100644 --- a/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/controller/CustomerController.java +++ b/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/controller/CustomerController.java @@ -18,7 +18,6 @@ package com.epmet.controller; import com.alibaba.fastjson.JSON; -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; @@ -133,7 +132,7 @@ public class CustomerController { * @Date 2020/3/11 21:58 **/ @GetMapping("getvalidcustomerlist") - public Result> getValidCustomerList(@LoginUser TokenDto tokenDTO) { + public Result> getValidCustomerList(TokenDto tokenDTO) { logger.info("getvalidcustomerlist:"+ JSON.toJSONString(tokenDTO)); return customerService.getValidCustomerList(); } diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/comment/controller/ResiCommentController.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/comment/controller/ResiCommentController.java index 4b37c30352..bc29a28ee2 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/comment/controller/ResiCommentController.java +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/comment/controller/ResiCommentController.java @@ -1,11 +1,9 @@ package com.epmet.modules.comment.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.modules.topic.service.ResiTopicCommentService; -import com.epmet.modules.utils.ModuleConstant; import com.epmet.resi.group.dto.comment.form.ResiQueryCommentFormDTO; import com.epmet.resi.group.dto.comment.result.ResiCommentResultDTO; import com.epmet.resi.group.dto.topic.form.ResiPublishCommentFormDTO; @@ -39,7 +37,7 @@ public class ResiCommentController { * @Date 2020.04.01 18:06 **/ @PostMapping("commenttopic") - public Result commentTopic(@LoginUser TokenDto tokenDto, @RequestBody ResiPublishCommentFormDTO publishCommentFormDTO){ + public Result commentTopic(TokenDto tokenDto, @RequestBody ResiPublishCommentFormDTO publishCommentFormDTO){ ValidatorUtils.validateEntity(publishCommentFormDTO); return commentService.commentTopic(tokenDto,publishCommentFormDTO); } @@ -53,7 +51,7 @@ public class ResiCommentController { * @Date 2020.04.01 23:49 **/ @PostMapping("getcommentlistoftopic") - public Result> getCommentListOfTopic(@LoginUser TokenDto tokenDto,@RequestBody ResiQueryCommentFormDTO queryCommentFormDTO){ + public Result> getCommentListOfTopic(TokenDto tokenDto, @RequestBody ResiQueryCommentFormDTO queryCommentFormDTO){ ValidatorUtils.validateEntity(queryCommentFormDTO); return commentService.getCommentList(tokenDto,queryCommentFormDTO); } diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/controller/ResiGroupController.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/controller/ResiGroupController.java index ef1bbd22c8..54db90c905 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/controller/ResiGroupController.java +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/controller/ResiGroupController.java @@ -17,12 +17,10 @@ package com.epmet.modules.group.controller; -import com.epmet.commons.tools.annotation.LoginUser; import com.epmet.commons.tools.exception.RenException; 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.UserResiInfoFormDTO; import com.epmet.modules.group.service.ResiGroupService; import com.epmet.modules.utils.ModuleConstant; import com.epmet.resi.group.dto.group.form.*; @@ -65,7 +63,7 @@ public class ResiGroupController { * @Date 2020/3/28 20:36 **/ @PostMapping("getmygroup") - public Result> getMyGroup(@LoginUser TokenDto tokenDto, @RequestBody MyGroupFormDTO myGroupFormDTO) { + public Result> getMyGroup(TokenDto tokenDto, @RequestBody MyGroupFormDTO myGroupFormDTO) { myGroupFormDTO.setUserId(tokenDto.getUserId()); ValidatorUtils.validateEntity(myGroupFormDTO); return resiGroupService.getMyGroup(myGroupFormDTO); @@ -80,8 +78,8 @@ public class ResiGroupController { * @Date 2020/3/28 19:52 **/ @PostMapping("getrecommendgroup") - public Result> getRecommendGroup(@LoginUser TokenDto tokenDto, - @RequestBody RecommendGroupFormDTO recommendGroupFormDTO) { + public Result> getRecommendGroup(TokenDto tokenDto, + @RequestBody RecommendGroupFormDTO recommendGroupFormDTO) { recommendGroupFormDTO.setUserId(tokenDto.getUserId()); ValidatorUtils.validateEntity(recommendGroupFormDTO); return resiGroupService.getRecommendGroup(recommendGroupFormDTO); @@ -96,8 +94,8 @@ public class ResiGroupController { * @Date 2020/3/28 21:59 **/ @PostMapping("getcreated") - public Result> getCreated(@LoginUser TokenDto tokenDto, - @RequestBody CreatedFormDTO createdFormDTO) { + public Result> getCreated(TokenDto tokenDto, + @RequestBody CreatedFormDTO createdFormDTO) { createdFormDTO.setUserId(tokenDto.getUserId()); ValidatorUtils.validateEntity(createdFormDTO); return resiGroupService.getCreated(createdFormDTO); @@ -112,7 +110,7 @@ public class ResiGroupController { * @Date 2020/3/28 22:20 **/ @PostMapping("modifygroup") - public Result modifyGroup(@LoginUser TokenDto tokenDto, @RequestBody ModifyGroupFormDTO modifyGroupFormDTO) { + public Result modifyGroup(TokenDto tokenDto, @RequestBody ModifyGroupFormDTO modifyGroupFormDTO) { modifyGroupFormDTO.setUserId(tokenDto.getUserId()); ValidatorUtils.validateEntity(modifyGroupFormDTO); return resiGroupService.modifyGroup(modifyGroupFormDTO); @@ -127,8 +125,8 @@ public class ResiGroupController { * @Date 2020/3/29 17:32 **/ @PostMapping("getgroupsummarize") - public Result getGroupSummarize(@LoginUser TokenDto tokenDto, - @RequestBody GroupSummarizeFormDTO groupSummarizeFormDTO) { + public Result getGroupSummarize(TokenDto tokenDto, + @RequestBody GroupSummarizeFormDTO groupSummarizeFormDTO) { groupSummarizeFormDTO.setUserId(tokenDto.getUserId()); ValidatorUtils.validateEntity(groupSummarizeFormDTO); return resiGroupService.getGroupSummarize(groupSummarizeFormDTO); @@ -143,8 +141,8 @@ public class ResiGroupController { * @Date 2020/3/29 19:26 **/ @PostMapping("applycreategroup") - public Result applyCreateGroup(@LoginUser TokenDto tokenDto, - @RequestBody ApplyCreateGroupFormDTO applyCreateGroupFormDTO) { + public Result applyCreateGroup(TokenDto tokenDto, + @RequestBody ApplyCreateGroupFormDTO applyCreateGroupFormDTO) { applyCreateGroupFormDTO.setUserId(tokenDto.getUserId()); applyCreateGroupFormDTO.setApp(tokenDto.getApp()); ValidatorUtils.validateEntity(applyCreateGroupFormDTO); @@ -160,8 +158,8 @@ public class ResiGroupController { * @Date 2020/3/30 10:11 **/ @PostMapping("initapplygroup") - public Result initApplyGroup(@LoginUser TokenDto tokenDto, - @RequestBody InitApplyGroupFormDTO initApplyGroupFormDTO) { + public Result initApplyGroup(TokenDto tokenDto, + @RequestBody InitApplyGroupFormDTO initApplyGroupFormDTO) { if (null == tokenDto) { logger.error(ModuleConstant.USER_NOT_NULL); throw new RenException(ModuleConstant.USER_NOT_NULL); @@ -180,8 +178,8 @@ public class ResiGroupController { * @Date 2020/3/30 15:44 **/ @PostMapping("initapplycreategroup") - public Result initApplyCreatedGroup(@LoginUser TokenDto tokenDto, - @RequestBody InitApplyCreatedGroupFormDTO initApplyCreatedGroupFormDTO) { + public Result initApplyCreatedGroup(TokenDto tokenDto, + @RequestBody InitApplyCreatedGroupFormDTO initApplyCreatedGroupFormDTO) { if (null == tokenDto) { logger.error(ModuleConstant.USER_NOT_NULL); throw new RenException(ModuleConstant.USER_NOT_NULL); @@ -200,7 +198,7 @@ public class ResiGroupController { * @Date 2020/3/31 12:31 **/ @PostMapping("agreeapplygroup") - public Result agreeApplyGroup(@LoginUser TokenDto tokenDto, @RequestBody AgreeApplyGroupFormDTO agreeApplyGroupFormDTO) { + public Result agreeApplyGroup(TokenDto tokenDto, @RequestBody AgreeApplyGroupFormDTO agreeApplyGroupFormDTO) { agreeApplyGroupFormDTO.setUserId(tokenDto.getUserId()); ValidatorUtils.validateEntity(agreeApplyGroupFormDTO); return resiGroupService.agreeApplyGroup(agreeApplyGroupFormDTO); @@ -215,7 +213,7 @@ public class ResiGroupController { * @Date 2020/3/31 13:23 **/ @PostMapping("disagreeapplygroup") - public Result disagreeApplyGroup(@LoginUser TokenDto tokenDto, @RequestBody DisAgreeApplyGroupFormDTO disAgreeApplyGroupFormDTO) { + public Result disagreeApplyGroup(TokenDto tokenDto, @RequestBody DisAgreeApplyGroupFormDTO disAgreeApplyGroupFormDTO) { disAgreeApplyGroupFormDTO.setUserId(tokenDto.getUserId()); ValidatorUtils.validateEntity(disAgreeApplyGroupFormDTO); return resiGroupService.disagreeApplyGroup(disAgreeApplyGroupFormDTO); diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/invitation/controller/GroupInvitationController.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/invitation/controller/GroupInvitationController.java index 62a9bbd452..6fcc9f75f9 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/invitation/controller/GroupInvitationController.java +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/invitation/controller/GroupInvitationController.java @@ -17,7 +17,6 @@ package com.epmet.modules.invitation.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; @@ -56,8 +55,8 @@ public class GroupInvitationController { * @Date 2020/3/31 22:50 **/ @PostMapping("creategroupinvitation") - public Result createGroupInvitation(@LoginUser TokenDto tokenDto, - @RequestBody CreateGroupInvitationFormDTO formDTO) { + public Result createGroupInvitation(TokenDto tokenDto, + @RequestBody CreateGroupInvitationFormDTO formDTO) { formDTO.setUserId(tokenDto.getUserId()); ValidatorUtils.validateEntity(formDTO); return groupInvitationService.createGroupInvitation(formDTO); @@ -71,8 +70,8 @@ public class GroupInvitationController { * @Date 2020/3/31 23:11 **/ @PostMapping("getlinkgroupinfo") - public Result getLinkGroupInfo(@LoginUser TokenDto tokenDto, - @RequestBody LinkGroupInfoFormDTO formDTO) { + public Result getLinkGroupInfo(TokenDto tokenDto, + @RequestBody LinkGroupInfoFormDTO formDTO) { formDTO.setUserId(tokenDto.getUserId()); ValidatorUtils.validateEntity(formDTO); return groupInvitationService.getLinkGroupInfo(formDTO); @@ -87,7 +86,7 @@ public class GroupInvitationController { * @Date 2020/3/31 23:47 **/ @PostMapping("acceptinvitation") - public Result accetInvitation(@LoginUser TokenDto tokenDto, + public Result accetInvitation(TokenDto tokenDto, @RequestBody AccetInvitationFormDTO formDTO) { formDTO.setUserId(tokenDto.getUserId()); formDTO.setApp(tokenDto.getApp()); diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/member/controller/ResiGroupMemberController.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/member/controller/ResiGroupMemberController.java index 0ddb15285e..c358e1917c 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/member/controller/ResiGroupMemberController.java +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/member/controller/ResiGroupMemberController.java @@ -17,7 +17,6 @@ package com.epmet.modules.member.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; @@ -52,8 +51,8 @@ public class ResiGroupMemberController { * @Date 2020/3/29 20:01 **/ @PostMapping("applyjoingroup") - public Result applyJoinGroup(@LoginUser TokenDto tokenDto, - @RequestBody ApplyJoinGroupFormDTO applyJoinGroupFormDTO) { + public Result applyJoinGroup(TokenDto tokenDto, + @RequestBody ApplyJoinGroupFormDTO applyJoinGroupFormDTO) { applyJoinGroupFormDTO.setUserId(tokenDto.getUserId()); applyJoinGroupFormDTO.setApp(tokenDto.getApp()); ValidatorUtils.validateEntity(applyJoinGroupFormDTO); @@ -69,8 +68,8 @@ public class ResiGroupMemberController { * @Date 2020/3/30 21:14 **/ @PostMapping("getgroupmember") - public Result> getGroupMemberList(@LoginUser TokenDto tokenDto, - @RequestBody GroupMemberListFormDTO groupMemberListFormDTO) { + public Result> getGroupMemberList(TokenDto tokenDto, + @RequestBody GroupMemberListFormDTO groupMemberListFormDTO) { ValidatorUtils.validateEntity(groupMemberListFormDTO); return resiGroupMemberService.getGroupMemberList(groupMemberListFormDTO); } @@ -84,8 +83,8 @@ public class ResiGroupMemberController { * @Date 2020/3/30 21:37 **/ @PostMapping("getapplyingmember") - public Result> getApplyingMember(@LoginUser TokenDto tokenDto, - @RequestBody ApplyingMemberFormDTO applyingMemberFormDTO) { + public Result> getApplyingMember(TokenDto tokenDto, + @RequestBody ApplyingMemberFormDTO applyingMemberFormDTO) { ValidatorUtils.validateEntity(applyingMemberFormDTO); return resiGroupMemberService.getApplyingMember(applyingMemberFormDTO); } @@ -99,8 +98,8 @@ public class ResiGroupMemberController { * @Date 2020/3/30 22:07 **/ @PostMapping("agreeapply") - public Result agreeApply(@LoginUser TokenDto tokenDto, - @RequestBody AgreeApplyFormDTO agreeApplyFormDTO) { + public Result agreeApply(TokenDto tokenDto, + @RequestBody AgreeApplyFormDTO agreeApplyFormDTO) { agreeApplyFormDTO.setUserId(tokenDto.getUserId()); agreeApplyFormDTO.setApp(tokenDto.getApp()); ValidatorUtils.validateEntity(agreeApplyFormDTO); @@ -116,8 +115,8 @@ public class ResiGroupMemberController { * @Date 2020/3/30 22:07 **/ @PostMapping("disagreeapply") - public Result disAgreeApply(@LoginUser TokenDto tokenDto, - @RequestBody DisagreeApplyFormDTO disagreeApplyFormDTO) { + public Result disAgreeApply(TokenDto tokenDto, + @RequestBody DisagreeApplyFormDTO disagreeApplyFormDTO) { disagreeApplyFormDTO.setUserId(tokenDto.getUserId()); ValidatorUtils.validateEntity(disagreeApplyFormDTO); return resiGroupMemberService.disAgreeApply(disagreeApplyFormDTO); @@ -128,7 +127,7 @@ public class ResiGroupMemberController { * @Description 楼院小组--删除组成员 **/ @PostMapping("removemember") - public Result removeMember(@LoginUser TokenDto tokenDto, @RequestBody RemoveMemberFormDTO removeMemberFormDTO) { + public Result removeMember(TokenDto tokenDto, @RequestBody RemoveMemberFormDTO removeMemberFormDTO) { removeMemberFormDTO.setUserId(tokenDto.getUserId()); removeMemberFormDTO.setApp(tokenDto.getApp()); ValidatorUtils.validateEntity(removeMemberFormDTO); @@ -143,7 +142,7 @@ public class ResiGroupMemberController { * @Description 楼院小组--禁言组员 **/ @PostMapping("slientmember") - public Result slientMember(@LoginUser TokenDto tokenDto, @RequestBody SlientMemberFormDTO slientMemberFormDTO) { + public Result slientMember(TokenDto tokenDto, @RequestBody SlientMemberFormDTO slientMemberFormDTO) { slientMemberFormDTO.setUserId(tokenDto.getUserId()); slientMemberFormDTO.setApp(tokenDto.getApp()); ValidatorUtils.validateEntity(slientMemberFormDTO); diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/controller/ResiTopicController.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/controller/ResiTopicController.java index 9415d59760..6b8af29d96 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/controller/ResiTopicController.java +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/controller/ResiTopicController.java @@ -1,6 +1,5 @@ package com.epmet.modules.topic.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; @@ -36,7 +35,7 @@ public class ResiTopicController { * @Date 2020.03.31 13:15 **/ @PostMapping("createtopic") - public Result createTopic(@LoginUser TokenDto tokenDto, @RequestBody ResiTopicPublishFormDTO topicPublishFormDTO){ + public Result createTopic(TokenDto tokenDto, @RequestBody ResiTopicPublishFormDTO topicPublishFormDTO){ ValidatorUtils.validateEntity(topicPublishFormDTO); return topicService.createTopic(tokenDto,topicPublishFormDTO); @@ -51,7 +50,7 @@ public class ResiTopicController { * @Date 2020.04.01 23:48 **/ @PostMapping("gettopicdetail") - public Result getTopicDetail(@LoginUser TokenDto tokenDto, @RequestBody ResiTopicDetailFormDTO topicDetailFormDTO ){ + public Result getTopicDetail(TokenDto tokenDto, @RequestBody ResiTopicDetailFormDTO topicDetailFormDTO ){ ValidatorUtils.validateEntity(topicDetailFormDTO); return topicService.getTopicDetail(tokenDto,topicDetailFormDTO.getTopicId()); } @@ -65,7 +64,7 @@ public class ResiTopicController { * @Date 2020.04.01 10:36 **/ @PostMapping("getpasttopiclist") - public Result> getPastTopicList(@LoginUser TokenDto tokenDto, @RequestBody ResiTopicPageFormDTO topicPageFormDTO){ + public Result> getPastTopicList(TokenDto tokenDto, @RequestBody ResiTopicPageFormDTO topicPageFormDTO){ ValidatorUtils.validateEntity(topicPageFormDTO); return topicService.getPastTopicList(tokenDto,topicPageFormDTO); } @@ -79,7 +78,7 @@ public class ResiTopicController { * @Date 2020.04.02 00:01 **/ @PostMapping("getlatesttopics") - Result> getLatestTopics(@LoginUser TokenDto tokenDto,@RequestBody ResiTopicDefaultPageFormDTO topicDefaultPageFormDTO){ + Result> getLatestTopics(TokenDto tokenDto, @RequestBody ResiTopicDefaultPageFormDTO topicDefaultPageFormDTO){ ValidatorUtils.validateEntity(topicDefaultPageFormDTO); return topicService.getLatestTopics(tokenDto,topicDefaultPageFormDTO.getGroupId()); } @@ -93,7 +92,7 @@ public class ResiTopicController { * @Date 2020.04.01 12:38 **/ @RequestMapping("hidetopic") - Result hideTopic(@LoginUser TokenDto tokenDto,@RequestBody ResiTopicOperationFormDTO hiddenFormDTO){ + Result hideTopic(TokenDto tokenDto, @RequestBody ResiTopicOperationFormDTO hiddenFormDTO){ ValidatorUtils.validateEntity(hiddenFormDTO); return topicService.hideTopic(tokenDto,hiddenFormDTO); } @@ -107,7 +106,7 @@ public class ResiTopicController { * @Date 2020.04.01 16:45 **/ @PostMapping("gethiddentopic") - Result> getHiddenTopic(@LoginUser TokenDto tokenDto,@RequestBody ResiTopicPageFormDTO topicPageFormDTO){ + Result> getHiddenTopic(TokenDto tokenDto, @RequestBody ResiTopicPageFormDTO topicPageFormDTO){ ValidatorUtils.validateEntity(topicPageFormDTO); return topicService.getHiddenTopics(tokenDto,topicPageFormDTO); } @@ -121,7 +120,7 @@ public class ResiTopicController { * @Date 2020.04.01 14:17 **/ @PostMapping("cancelhiddentopics") - Result cancelHiddenTopics(@LoginUser TokenDto tokenDto,@RequestBody ResiTopicCancelHiddenFormDTO cancelHiddenFormDTO){ + Result cancelHiddenTopics(TokenDto tokenDto, @RequestBody ResiTopicCancelHiddenFormDTO cancelHiddenFormDTO){ return topicService.cancelHiddenTopics(tokenDto,cancelHiddenFormDTO.getTopicIds()); } @@ -134,7 +133,7 @@ public class ResiTopicController { * @Date 2020.04.01 15:37 **/ @PostMapping("closetopic") - Result closeTopic(@LoginUser TokenDto tokenDto,@RequestBody ResiTopicOperationFormDTO closeFormDTO){ + Result closeTopic(TokenDto tokenDto, @RequestBody ResiTopicOperationFormDTO closeFormDTO){ ValidatorUtils.validateEntity(closeFormDTO); return topicService.closeTopic(tokenDto,closeFormDTO); } diff --git a/epmet-module/resi-guide/resi-guide-server/src/main/java/com/epmet/controller/StrangerResiGuideController.java b/epmet-module/resi-guide/resi-guide-server/src/main/java/com/epmet/controller/StrangerResiGuideController.java index 7c3b78194f..4e9aa206cc 100644 --- a/epmet-module/resi-guide/resi-guide-server/src/main/java/com/epmet/controller/StrangerResiGuideController.java +++ b/epmet-module/resi-guide/resi-guide-server/src/main/java/com/epmet/controller/StrangerResiGuideController.java @@ -17,7 +17,6 @@ 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; @@ -54,7 +53,7 @@ public class StrangerResiGuideController { * @Date 2020/3/16 **/ @PostMapping("getgridhome") - public Result getGridHome( @LoginUser TokenDto tokenDTO, @RequestBody StrangerFormDTO strangerFormDTO) throws Exception { + public Result getGridHome( TokenDto tokenDTO, @RequestBody StrangerFormDTO strangerFormDTO) throws Exception { return strangerAccessRecordService.getGridHome(tokenDTO, strangerFormDTO); } diff --git a/epmet-module/resi-guide/resi-guide-server/src/main/java/com/epmet/controller/UserGuideController.java b/epmet-module/resi-guide/resi-guide-server/src/main/java/com/epmet/controller/UserGuideController.java index fe4d4d15ea..81e59f7130 100644 --- a/epmet-module/resi-guide/resi-guide-server/src/main/java/com/epmet/controller/UserGuideController.java +++ b/epmet-module/resi-guide/resi-guide-server/src/main/java/com/epmet/controller/UserGuideController.java @@ -1,6 +1,5 @@ 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; @@ -27,7 +26,7 @@ public class UserGuideController { private UserAccessService userAccessService; @PostMapping("entergrid") - Result enterGrid(@LoginUser TokenDto token, @RequestBody UserEnterGridFormDTO userEnterGridFormDTO){ + Result enterGrid(TokenDto token, @RequestBody UserEnterGridFormDTO userEnterGridFormDTO){ ValidatorUtils.validateEntity(userEnterGridFormDTO); diff --git a/epmet-module/resi-mine/resi-mine-server/src/main/java/com/epmet/modules/grid/controller/ResiMineGridController.java b/epmet-module/resi-mine/resi-mine-server/src/main/java/com/epmet/modules/grid/controller/ResiMineGridController.java index 626f78bfd4..1127ec72b5 100644 --- a/epmet-module/resi-mine/resi-mine-server/src/main/java/com/epmet/modules/grid/controller/ResiMineGridController.java +++ b/epmet-module/resi-mine/resi-mine-server/src/main/java/com/epmet/modules/grid/controller/ResiMineGridController.java @@ -1,6 +1,5 @@ package com.epmet.modules.grid.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.result.LatestGridInfoResultDTO; @@ -29,7 +28,7 @@ public class ResiMineGridController { * @Date 2020/3/24 11:10 **/ @GetMapping("getlatestgridinfo") - public Result getLatestGridInfo(@LoginUser TokenDto tokenDto){ + public Result getLatestGridInfo(TokenDto tokenDto){ return resiMineGridService.getLatestGridInfo(tokenDto); } } diff --git a/epmet-module/resi-mine/resi-mine-server/src/main/java/com/epmet/modules/message/controller/UserMessageController.java b/epmet-module/resi-mine/resi-mine-server/src/main/java/com/epmet/modules/message/controller/UserMessageController.java index 2af9dfb554..c0c2b493aa 100644 --- a/epmet-module/resi-mine/resi-mine-server/src/main/java/com/epmet/modules/message/controller/UserMessageController.java +++ b/epmet-module/resi-mine/resi-mine-server/src/main/java/com/epmet/modules/message/controller/UserMessageController.java @@ -1,6 +1,5 @@ package com.epmet.modules.message.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; @@ -35,8 +34,8 @@ public class UserMessageController { * @Date 2020/3/29 20:53 **/ @PostMapping("getmymessage") - public Result> getMyMessage(@LoginUser TokenDto tokenDto, - @RequestBody MymessageFormDTO mymessageFormDTO) { + public Result> getMyMessage(TokenDto tokenDto, + @RequestBody MymessageFormDTO mymessageFormDTO) { mymessageFormDTO.setUserId(tokenDto.getUserId()); ValidatorUtils.validateEntity(mymessageFormDTO); //逻辑待实现 @@ -64,7 +63,7 @@ public class UserMessageController { * @Date 2020/3/29 21:06 **/ @PostMapping("readallmsg") - public Result readAllMessage(@LoginUser TokenDto tokenDto, @RequestBody UserMessageDTO userMessageDTO) { + public Result readAllMessage(TokenDto tokenDto, @RequestBody UserMessageDTO userMessageDTO) { //逻辑待实现 return userMessageService.readAllMessage(tokenDto, userMessageDTO); } diff --git a/epmet-module/resi-mine/resi-mine-server/src/main/java/com/epmet/modules/partymember/controller/PartyMemberController.java b/epmet-module/resi-mine/resi-mine-server/src/main/java/com/epmet/modules/partymember/controller/PartyMemberController.java index 379a9491e9..bfa776d92e 100644 --- a/epmet-module/resi-mine/resi-mine-server/src/main/java/com/epmet/modules/partymember/controller/PartyMemberController.java +++ b/epmet-module/resi-mine/resi-mine-server/src/main/java/com/epmet/modules/partymember/controller/PartyMemberController.java @@ -1,6 +1,5 @@ package com.epmet.modules.partymember.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.modules.partymember.service.PartyMemberService; @@ -34,7 +33,7 @@ public class PartyMemberController { * @return Result */ @PostMapping("init") - public Result init(@LoginUser TokenDto tokenDto, @RequestBody PartyMemberInitFromDTO fromDto) { + public Result init(TokenDto tokenDto, @RequestBody PartyMemberInitFromDTO fromDto) { fromDto.setUserId(tokenDto.getUserId()); return partyMemberService.init(fromDto); } @@ -47,7 +46,7 @@ public class PartyMemberController { * @date 2020/3/30 13:50 */ @PostMapping("getverificationcode") - public Result getVerificationCode(@LoginUser TokenDto tokenDto, @RequestBody VerificationCodeFromDTO fromDto) { + public Result getVerificationCode(TokenDto tokenDto, @RequestBody VerificationCodeFromDTO fromDto) { return partyMemberService.getVerificationCode(tokenDto, fromDto); } @@ -59,7 +58,7 @@ public class PartyMemberController { * @date 2020/3/30 13:50 */ @PostMapping("submit") - public Result submit(@LoginUser TokenDto tokenDto, @RequestBody PartyMemberSubmitFromDTO fromDto) { + public Result submit(TokenDto tokenDto, @RequestBody PartyMemberSubmitFromDTO fromDto) { return partyMemberService.submit(tokenDto, fromDto); } @@ -71,7 +70,7 @@ public class PartyMemberController { * @date 2020/3/30 13:50 */ @PostMapping("extra") - public Result partyMemberInfoExtra(@LoginUser TokenDto tokenDto, @RequestBody PartyMemberSubmitFromDTO fromDto) { + public Result partyMemberInfoExtra(TokenDto tokenDto, @RequestBody PartyMemberSubmitFromDTO fromDto) { return partyMemberService.partyMemberInfoExtra(tokenDto, fromDto); } } diff --git a/epmet-module/resi-mine/resi-mine-server/src/main/java/com/epmet/modules/resiregister/controller/ResiRegisterController.java b/epmet-module/resi-mine/resi-mine-server/src/main/java/com/epmet/modules/resiregister/controller/ResiRegisterController.java index e9d591581e..3a8c6dee7b 100644 --- a/epmet-module/resi-mine/resi-mine-server/src/main/java/com/epmet/modules/resiregister/controller/ResiRegisterController.java +++ b/epmet-module/resi-mine/resi-mine-server/src/main/java/com/epmet/modules/resiregister/controller/ResiRegisterController.java @@ -1,6 +1,5 @@ package com.epmet.modules.resiregister.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; @@ -34,7 +33,7 @@ public class ResiRegisterController { * @Date 2020/3/30 **/ @PostMapping("init") - public Result init(@LoginUser TokenDto tokenDTO, @RequestBody ResiRegisterFormDTO resiRegisterFormDTO) { + public Result init(TokenDto tokenDTO, @RequestBody ResiRegisterFormDTO resiRegisterFormDTO) { ValidatorUtils.validateEntity(resiRegisterFormDTO); return resiRegisterService.init(tokenDTO, resiRegisterFormDTO); } @@ -45,7 +44,7 @@ public class ResiRegisterController { * @Description 居民端-居民注册信息提交 **/ @PostMapping("submit") - public Result submit(@LoginUser TokenDto tokenDTO, @RequestBody ResiInfoSubmitFormDTO resiInfoSubmitFormDTO) { + public Result submit(TokenDto tokenDTO, @RequestBody ResiInfoSubmitFormDTO resiInfoSubmitFormDTO) { ValidatorUtils.validateEntity(resiInfoSubmitFormDTO); return resiRegisterService.submit(tokenDTO, resiInfoSubmitFormDTO); } @@ -56,7 +55,7 @@ public class ResiRegisterController { * @Description 居民端-居民注册根据手机号获取验证码 **/ @PostMapping("getverificationcode") - public Result getVerificationCode(@LoginUser TokenDto tokenDTO, @RequestBody VerificationCodeFormDTO formDTO) { + public Result getVerificationCode(TokenDto tokenDTO, @RequestBody VerificationCodeFormDTO formDTO) { ValidatorUtils.validateEntity(formDTO); return resiRegisterService.getVerificationCode(tokenDTO, formDTO); } diff --git a/epmet-module/resi-mine/resi-mine-server/src/main/java/com/epmet/modules/warmhearted/controller/ResiWarmheartedController.java b/epmet-module/resi-mine/resi-mine-server/src/main/java/com/epmet/modules/warmhearted/controller/ResiWarmheartedController.java index 03283c179a..9d555d6d40 100644 --- a/epmet-module/resi-mine/resi-mine-server/src/main/java/com/epmet/modules/warmhearted/controller/ResiWarmheartedController.java +++ b/epmet-module/resi-mine/resi-mine-server/src/main/java/com/epmet/modules/warmhearted/controller/ResiWarmheartedController.java @@ -1,6 +1,5 @@ package com.epmet.modules.warmhearted.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; @@ -31,7 +30,7 @@ public class ResiWarmheartedController { * @Description 居民端-热心居民申请页面初始化-查询有无申请、新增访问行为记录数据 **/ @PostMapping("init") - public Result init(@LoginUser TokenDto tokenDTO, @RequestBody ResiWarmheartedFormDTO resiWarmheartedFormDTO) { + public Result init(TokenDto tokenDTO, @RequestBody ResiWarmheartedFormDTO resiWarmheartedFormDTO) { ValidatorUtils.validateEntity(resiWarmheartedFormDTO); return resiWarmheartedService.init(tokenDTO, resiWarmheartedFormDTO); } @@ -42,7 +41,7 @@ public class ResiWarmheartedController { * @Description 居民端-热心居民申请-提交申请数据 **/ @PostMapping("submit") - public Result submit(@LoginUser TokenDto tokenDTO, @RequestBody ResiWarmheartedSubmitFormDTO formDTO) { + public Result submit(TokenDto tokenDTO, @RequestBody ResiWarmheartedSubmitFormDTO formDTO) { ValidatorUtils.validateEntity(formDTO); return resiWarmheartedService.submit(tokenDTO, formDTO); } diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/StaffLoginHistoryDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/StaffLoginHistoryDTO.java new file mode 100644 index 0000000000..6d1674936f --- /dev/null +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/StaffLoginHistoryDTO.java @@ -0,0 +1,102 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

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

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

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.dto; + +import lombok.Data; + +import java.io.Serializable; +import java.util.Date; + + +/** + * 工作人员登录日志表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-04-20 + */ +@Data +public class StaffLoginHistoryDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 唯一标识 + */ + private String id; + + /** + * 客户ID + */ + private String customerId; + + /** + * customer_staff.userId + */ + private String staffId; + + /** + * 微信openId + */ + private String wxOpenId; + + /** + * 手机号 + */ + private String mobile; + + /** + * 组织机构id + */ + private String orgId; + + /** + * 网格表Id (CUSTOMER_GRID.id) + */ + private String gridId; + + /** + * 删除标识:0.未删除 1.已删除 + */ + private Integer delFlag; + + /** + * 乐观锁 + */ + private Integer revision; + + /** + * 创建人 + */ + private String createdBy; + + /** + * 创建时间,登录时间 + */ + private Date createdTime; + + /** + * 更新人 + */ + private String updatedBy; + + /** + * 更新时间 + */ + private Date updatedTime; + +} \ No newline at end of file diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/CustomerStaffFormDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/CustomerStaffFormDTO.java new file mode 100644 index 0000000000..43acb11d1c --- /dev/null +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/CustomerStaffFormDTO.java @@ -0,0 +1,21 @@ +package com.epmet.dto.form; + +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import java.io.Serializable; + +/** + * @Description 根据手机号+客户id获取工作人员基本信息 + * @Author yinzuomei + * @Date 2020/4/20 14:02 + */ +@Data +public class CustomerStaffFormDTO implements Serializable { + private static final long serialVersionUID = 7619815083427853431L; + @NotBlank(message = "手机号不能为空") + private String mobile; + @NotBlank(message = "客户id不能为空") + private String customerId; +} + diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/StaffLoginHistoryFormDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/StaffLoginHistoryFormDTO.java new file mode 100644 index 0000000000..14a205d032 --- /dev/null +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/StaffLoginHistoryFormDTO.java @@ -0,0 +1,44 @@ +package com.epmet.dto.form; + +import lombok.Data; + +import java.io.Serializable; + +/** + * @Description 保存工作人员登录日志 + * @Author yinzuomei + * @Date 2020/4/20 14:26 + */ +@Data +public class StaffLoginHistoryFormDTO implements Serializable { + /** + * 客户ID + */ + private String customerId; + + /** + * customer_staff.userId + */ + private String staffId; + + /** + * 微信openId + */ + private String wxOpenId; + + /** + * 手机号 + */ + private String mobile; + + /** + * 组织机构id + */ + private String orgId; + + /** + * 网格表Id (CUSTOMER_GRID.id) + */ + private String gridId; +} + diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/LatestStaffWechatLoginResultDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/LatestStaffWechatLoginResultDTO.java new file mode 100644 index 0000000000..5ad4ebde86 --- /dev/null +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/LatestStaffWechatLoginResultDTO.java @@ -0,0 +1,46 @@ +package com.epmet.dto.result; + +import lombok.Data; + +import java.io.Serializable; + +/** + * @Description 当前微信上次登录的账号信息返参DTO + * @Author yinzuomei + * @Date 2020/4/20 12:23 + */ +@Data +public class LatestStaffWechatLoginResultDTO implements Serializable { + private static final long serialVersionUID = -7088774184276785902L; + + /** + * 客户ID + */ + private String customerId; + + /** + * customer_staff.userId + */ + private String staffId; + + /** + * 微信openId + */ + private String wxOpenId; + + /** + * 手机号 + */ + private String mobile; + + /** + * 组织机构id + */ + private String orgId; + + /** + * 网格表Id (CUSTOMER_GRID.id) + */ + private String gridId; +} + 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 f097f86d5e..b68ea382c6 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 @@ -23,9 +23,10 @@ import com.epmet.commons.tools.utils.Result; import com.epmet.commons.tools.validator.AssertUtils; import com.epmet.commons.tools.validator.ValidatorUtils; import com.epmet.commons.tools.validator.group.AddGroup; -import com.epmet.commons.tools.validator.group.UpdateGroup; import com.epmet.commons.tools.validator.group.DefaultGroup; +import com.epmet.commons.tools.validator.group.UpdateGroup; import com.epmet.dto.CustomerStaffDTO; +import com.epmet.dto.form.CustomerStaffFormDTO; import com.epmet.excel.CustomerStaffExcel; import com.epmet.service.CustomerStaffService; import org.springframework.beans.factory.annotation.Autowired; @@ -45,24 +46,24 @@ import java.util.Map; @RestController @RequestMapping("customerstaff") public class CustomerStaffController { - + @Autowired private CustomerStaffService customerStaffService; @GetMapping("page") - public Result> page(@RequestParam Map params){ + public Result> page(@RequestParam Map params) { PageData page = customerStaffService.page(params); return new Result>().ok(page); } @GetMapping("{id}") - public Result get(@PathVariable("id") String id){ + public Result get(@PathVariable("id") String id) { CustomerStaffDTO data = customerStaffService.get(id); return new Result().ok(data); } @PostMapping - public Result save(@RequestBody CustomerStaffDTO dto){ + public Result save(@RequestBody CustomerStaffDTO dto) { //效验数据 ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class); customerStaffService.save(dto); @@ -70,7 +71,7 @@ public class CustomerStaffController { } @PutMapping - public Result update(@RequestBody CustomerStaffDTO dto){ + public Result update(@RequestBody CustomerStaffDTO dto) { //效验数据 ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class); customerStaffService.update(dto); @@ -78,7 +79,7 @@ public class CustomerStaffController { } @DeleteMapping - public Result delete(@RequestBody String[] ids){ + public Result delete(@RequestBody String[] ids) { //效验数据 AssertUtils.isArrayEmpty(ids, "id"); customerStaffService.delete(ids); @@ -92,14 +93,27 @@ public class CustomerStaffController { } /** - * @param phone 手机号 + * @param mobile 手机号 * @return com.epmet.commons.tools.utils.Result * @Author yinzuomei * @Description 根据手机号查询政府端工作人员基本信息,校验用户是否存在 * @Date 2020/4/18 14:07 **/ - @GetMapping(value = "getcustsomerstaffbyphone/{phone}") - public Result getCustsomerStaffByPhone(@PathVariable("phone") String phone) { - return customerStaffService.getCustsomerStaffByPhone(phone); + @GetMapping(value = "getcustsomerstaffbyphone/{mobile}") + public Result> getCustsomerStaffByPhone(@PathVariable("mobile") String mobile) { + return customerStaffService.getCustsomerStaffByPhone(mobile); + } + + /** + * @param formDTO + * @return com.epmet.commons.tools.utils.Result + * @Author yinzuomei + * @Description 根据手机号+客户id获取工作人员基本信息 + * @Date 2020/4/20 14:04 + **/ + @PostMapping(value = "getcustomerstaffinfo") + public Result getCustomerStaffInfo(@RequestBody CustomerStaffFormDTO formDTO) { + ValidatorUtils.validateEntity(formDTO); + return customerStaffService.getCustomerStaffInfo(formDTO); } } \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/OperUserController.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/OperUserController.java index f9d88ddd6a..b44f404523 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/OperUserController.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/OperUserController.java @@ -17,7 +17,6 @@ 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.ConvertUtils; @@ -109,7 +108,7 @@ public class OperUserController { * @author zhaoqifeng */ @GetMapping("queryOperUserDto") - public Result queryOperUserDto(@LoginUser TokenDto tokenDto) { + public Result queryOperUserDto(TokenDto tokenDto) { OperUserDTO data = operUserService.getOperUserInfoById(tokenDto.getUserId()); QueryOperUserResultDto dto = ConvertUtils.sourceToTarget(data, QueryOperUserResultDto.class); return new Result().ok(dto); diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/StaffLoginHistoryController.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/StaffLoginHistoryController.java new file mode 100644 index 0000000000..08c8e02c94 --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/StaffLoginHistoryController.java @@ -0,0 +1,64 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

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

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

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.controller; + +import com.epmet.commons.tools.utils.Result; +import com.epmet.dto.form.StaffLoginHistoryFormDTO; +import com.epmet.dto.result.LatestStaffWechatLoginResultDTO; +import com.epmet.service.StaffLoginHistoryService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + + +/** + * 工作人员登录日志表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-04-20 + */ +@RestController +@RequestMapping("staffloginhistory") +public class StaffLoginHistoryController { + + @Autowired + private StaffLoginHistoryService staffLoginHistoryService; + + /** + * @param openId + * @return com.epmet.commons.tools.utils.Result + * @Author yinzuomei + * @Description 获取当前微信上次登录的账号信息 + * @Date 2020/4/20 12:42 + **/ + @GetMapping(value = "getlatest/{openId}") + public Result getLatestStaffWechatLoginRecord(@PathVariable("openId") String openId) { + return staffLoginHistoryService.getLatestStaffWechatLoginRecord(openId); + } + + /** + * @param formDTO + * @return com.epmet.commons.tools.utils.Result + * @Author yinzuomei + * @Description 保存登录日志 + * @Date 2020/4/20 14:29 + **/ + @PostMapping(value = "saveStaffLoginRecord") + public Result saveStaffLoginRecord(@RequestBody StaffLoginHistoryFormDTO formDTO) { + return staffLoginHistoryService.saveStaffLoginRecord(formDTO); + } +} \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/UserController.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/UserController.java index 6081d38fe1..8c1930d6ac 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/UserController.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/UserController.java @@ -1,6 +1,5 @@ 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; @@ -80,7 +79,7 @@ public class UserController { * @Description 居民端个人信息-同步用户微信信息 **/ @PostMapping("updatewxuserinfo") - public Result updateWxUserInfo(@LoginUser TokenDto tokenDTO, @RequestBody WxUserInfoFormDTO wxUserInfoFormDTO) { + public Result updateWxUserInfo(TokenDto tokenDTO, @RequestBody WxUserInfoFormDTO wxUserInfoFormDTO) { wxUserInfoFormDTO.setUserId(tokenDTO.getUserId()); ValidatorUtils.validateEntity(wxUserInfoFormDTO); return userService.updateWxUserInfo(wxUserInfoFormDTO); 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 89f2754a38..a676eb8a2c 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 @@ -18,9 +18,13 @@ package com.epmet.dao; import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.dto.CustomerStaffDTO; +import com.epmet.dto.form.CustomerStaffFormDTO; import com.epmet.entity.CustomerStaffEntity; import org.apache.ibatis.annotations.Mapper; +import java.util.List; + /** * 政府工作人员表 * @@ -29,5 +33,22 @@ import org.apache.ibatis.annotations.Mapper; */ @Mapper public interface CustomerStaffDao extends BaseDao { - + + /** + * @param mobile + * @return java.util.List + * @Author yinzuomei + * @Description 根据手机号查询工作人员信息 + * @Date 2020/4/20 13:17 + **/ + List selectListCustomerStaffDTO(String mobile); + + /** + * @param formDTO + * @return com.epmet.dto.CustomerStaffDTO + * @Author yinzuomei + * @Description 根据手机号+客户id获取工作人员基本信息 + * @Date 2020/4/20 14:08 + **/ + CustomerStaffDTO selectListCustomerStaffInfo(CustomerStaffFormDTO formDTO); } \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/StaffLoginHistoryDao.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/StaffLoginHistoryDao.java new file mode 100644 index 0000000000..1458be2a28 --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/StaffLoginHistoryDao.java @@ -0,0 +1,42 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

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

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

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.dao; + +import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.dto.result.LatestStaffWechatLoginResultDTO; +import com.epmet.entity.StaffLoginHistoryEntity; +import org.apache.ibatis.annotations.Mapper; + +/** + * 工作人员登录日志表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-04-20 + */ +@Mapper +public interface StaffLoginHistoryDao extends BaseDao { + + /** + * @return com.epmet.dto.result.LatestStaffWechatLoginDTO + * @param openId + * @Author yinzuomei + * @Description 获取当前微信上次登录的账号信息 + * @Date 2020/4/20 12:45 + **/ + LatestStaffWechatLoginResultDTO selectLatestStaffWechatLoginRecord(String openId); +} \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/StaffLoginHistoryEntity.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/StaffLoginHistoryEntity.java new file mode 100644 index 0000000000..9a9377ecfe --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/StaffLoginHistoryEntity.java @@ -0,0 +1,68 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

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

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

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.entity; + +import com.baomidou.mybatisplus.annotation.TableName; +import com.epmet.commons.mybatis.entity.BaseEpmetEntity; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 工作人员登录日志表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-04-20 + */ +@Data +@EqualsAndHashCode(callSuper=false) +@TableName("staff_login_history") +public class StaffLoginHistoryEntity extends BaseEpmetEntity { + + private static final long serialVersionUID = 1L; + + /** + * 客户ID + */ + private String customerId; + + /** + * customer_staff.userId + */ + private String staffId; + + /** + * 微信openId + */ + private String wxOpenId; + + /** + * 手机号 + */ + private String mobile; + + /** + * 组织机构id + */ + private String orgId; + + /** + * 网格表Id (CUSTOMER_GRID.id) + */ + private String gridId; + +} 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 ef5d1559b9..b459bdb83c 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 @@ -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.CustomerStaffDTO; +import com.epmet.dto.form.CustomerStaffFormDTO; import com.epmet.entity.CustomerStaffEntity; import java.util.List; @@ -95,11 +96,20 @@ public interface CustomerStaffService extends BaseService { void delete(String[] ids); /** - * @param phone 手机号 + * @param mobile 手机号 * @return com.epmet.commons.tools.utils.Result * @Author yinzuomei * @Description 根据手机号查询政府端工作人员基本信息,校验用户是否存在 * @Date 2020/4/18 14:07 **/ - Result getCustsomerStaffByPhone(String phone); + Result> getCustsomerStaffByPhone(String mobile); + + /** + * @param formDTO + * @return com.epmet.commons.tools.utils.Result + * @Author yinzuomei + * @Description 根据手机号+客户id获取工作人员基本信息 + * @Date 2020/4/20 14:05 + **/ + Result getCustomerStaffInfo(CustomerStaffFormDTO formDTO); } \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/StaffLoginHistoryService.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/StaffLoginHistoryService.java new file mode 100644 index 0000000000..fab2c9f20e --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/StaffLoginHistoryService.java @@ -0,0 +1,116 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

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

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

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.service; + +import com.epmet.commons.mybatis.service.BaseService; +import com.epmet.commons.tools.page.PageData; +import com.epmet.commons.tools.utils.Result; +import com.epmet.dto.StaffLoginHistoryDTO; +import com.epmet.dto.form.StaffLoginHistoryFormDTO; +import com.epmet.dto.result.LatestStaffWechatLoginResultDTO; +import com.epmet.entity.StaffLoginHistoryEntity; + +import java.util.List; +import java.util.Map; + +/** + * 工作人员登录日志表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-04-20 + */ +public interface StaffLoginHistoryService extends BaseService { + + /** + * 默认分页 + * + * @param params + * @return PageData + * @author generator + * @date 2020-04-20 + */ + PageData page(Map params); + + /** + * 默认查询 + * + * @param params + * @return java.util.List + * @author generator + * @date 2020-04-20 + */ + List list(Map params); + + /** + * 单条查询 + * + * @param id + * @return StaffLoginHistoryDTO + * @author generator + * @date 2020-04-20 + */ + StaffLoginHistoryDTO get(String id); + + /** + * 默认保存 + * + * @param dto + * @return void + * @author generator + * @date 2020-04-20 + */ + void save(StaffLoginHistoryDTO dto); + + /** + * 默认更新 + * + * @param dto + * @return void + * @author generator + * @date 2020-04-20 + */ + void update(StaffLoginHistoryDTO dto); + + /** + * 批量删除 + * + * @param ids + * @return void + * @author generator + * @date 2020-04-20 + */ + void delete(String[] ids); + + /** + * @param openId + * @return com.epmet.commons.tools.utils.Result + * @Author yinzuomei + * @Description 获取当前微信上次登录的账号信息 + * @Date 2020/4/20 12:43 + **/ + Result getLatestStaffWechatLoginRecord(String openId); + + /** + * @param formDTO + * @return com.epmet.commons.tools.utils.Result + * @Author yinzuomei + * @Description 保存登录日志 + * @Date 2020/4/20 14:33 + **/ + Result saveStaffLoginRecord(StaffLoginHistoryFormDTO formDTO); +} \ 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 7470edc96d..7fdbb725e3 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 @@ -28,6 +28,7 @@ import com.epmet.commons.tools.utils.Result; import com.epmet.constant.UserConstant; import com.epmet.dao.CustomerStaffDao; import com.epmet.dto.CustomerStaffDTO; +import com.epmet.dto.form.CustomerStaffFormDTO; import com.epmet.entity.CustomerStaffEntity; import com.epmet.redis.CustomerStaffRedis; import com.epmet.service.CustomerStaffService; @@ -107,23 +108,26 @@ public class CustomerStaffServiceImpl extends BaseServiceImpl getCustsomerStaffByPhone(String phone) { + public Result> getCustsomerStaffByPhone(String mobile) { //判断用户是否存在 - QueryWrapper wrapper = new QueryWrapper<>(); - wrapper.eq(StringUtils.isNotBlank(phone), FieldConstant.MOBILE, phone); - List customerStaffEntityList = baseDao.selectList(wrapper); - if (null == customerStaffEntityList || customerStaffEntityList.size() == 0) { - logger.error(String.format("根据手机号查询用户异常,手机号:[%s],code[%s],msg[%s]",phone,EpmetErrorCode.GOV_STAFF_NOT_EXISTS.getCode(),EpmetErrorCode.GOV_STAFF_NOT_EXISTS.getMsg())); + List customerStaffDTOList = baseDao.selectListCustomerStaffDTO(mobile); + if (null == customerStaffDTOList || customerStaffDTOList.size() == 0) { + logger.error(String.format("根据手机号查询用户异常,手机号:[%s],code[%s],msg[%s]", mobile, EpmetErrorCode.GOV_STAFF_NOT_EXISTS.getCode(), EpmetErrorCode.GOV_STAFF_NOT_EXISTS.getMsg())); return new Result().error(EpmetErrorCode.GOV_STAFF_NOT_EXISTS.getCode()); } + return new Result>().ok(customerStaffDTOList); + } + + + @Override + public Result getCustomerStaffInfo(CustomerStaffFormDTO formDTO) { + CustomerStaffDTO customerStaffDTO = baseDao.selectListCustomerStaffInfo(formDTO); //判断用户是否已被禁用 - CustomerStaffEntity customerStaff = customerStaffEntityList.get(0); - if (UserConstant.DISABLED.equals(customerStaff.getEnableFlag())) { - logger.error(String.format("根据手机号查询用户异常,手机号:[%s],code[%s],msg[%s]",phone,EpmetErrorCode.GOV_STAFF_DISABLED.getCode(),EpmetErrorCode.GOV_STAFF_DISABLED.getMsg())); + if (null != customerStaffDTO && UserConstant.DISABLED.equals(customerStaffDTO.getEnableFlag())) { + logger.error(String.format("根据手机号查询用户异常,手机号:[%s],客户id:[%s],code[%s],msg[%s]", formDTO.getMobile(), formDTO.getCustomerId(), EpmetErrorCode.GOV_STAFF_DISABLED.getCode(), EpmetErrorCode.GOV_STAFF_DISABLED.getMsg())); return new Result().error(EpmetErrorCode.GOV_STAFF_DISABLED.getCode()); } - CustomerStaffDTO customerStaffDTO=ConvertUtils.sourceToTarget(customerStaff, CustomerStaffDTO.class); - return new Result().ok(customerStaffDTO); + return new Result().ok(customerStaffDTO); } } \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/StaffLoginHistoryServiceImpl.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/StaffLoginHistoryServiceImpl.java new file mode 100644 index 0000000000..2cccdf9f3e --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/StaffLoginHistoryServiceImpl.java @@ -0,0 +1,121 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

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

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

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; +import com.epmet.commons.tools.constant.FieldConstant; +import com.epmet.commons.tools.page.PageData; +import com.epmet.commons.tools.utils.ConvertUtils; +import com.epmet.commons.tools.utils.Result; +import com.epmet.dao.StaffLoginHistoryDao; +import com.epmet.dto.StaffLoginHistoryDTO; +import com.epmet.dto.form.StaffLoginHistoryFormDTO; +import com.epmet.dto.result.LatestStaffWechatLoginResultDTO; +import com.epmet.entity.StaffLoginHistoryEntity; +import com.epmet.service.StaffLoginHistoryService; +import org.apache.commons.lang3.StringUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.util.Arrays; +import java.util.List; +import java.util.Map; + +/** + * 工作人员登录日志表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-04-20 + */ +@Service +public class StaffLoginHistoryServiceImpl extends BaseServiceImpl implements StaffLoginHistoryService { + private static final Logger logger = LoggerFactory.getLogger(StaffLoginHistoryServiceImpl.class); + @Override + public PageData page(Map params) { + IPage page = baseDao.selectPage( + getPage(params, FieldConstant.CREATED_TIME, false), + getWrapper(params) + ); + return getPageData(page, StaffLoginHistoryDTO.class); + } + + @Override + public List list(Map params) { + List entityList = baseDao.selectList(getWrapper(params)); + + return ConvertUtils.sourceToTarget(entityList, StaffLoginHistoryDTO.class); + } + + private QueryWrapper getWrapper(Map params){ + String id = (String)params.get(FieldConstant.ID_HUMP); + + QueryWrapper wrapper = new QueryWrapper<>(); + wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id); + + return wrapper; + } + + @Override + public StaffLoginHistoryDTO get(String id) { + StaffLoginHistoryEntity entity = baseDao.selectById(id); + return ConvertUtils.sourceToTarget(entity, StaffLoginHistoryDTO.class); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void save(StaffLoginHistoryDTO dto) { + StaffLoginHistoryEntity entity = ConvertUtils.sourceToTarget(dto, StaffLoginHistoryEntity.class); + insert(entity); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void update(StaffLoginHistoryDTO dto) { + StaffLoginHistoryEntity entity = ConvertUtils.sourceToTarget(dto, StaffLoginHistoryEntity.class); + updateById(entity); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void delete(String[] ids) { + // 逻辑删除(@TableLogic 注解) + baseDao.deleteBatchIds(Arrays.asList(ids)); + } + + @Override + public Result getLatestStaffWechatLoginRecord(String openId) { + if (StringUtils.isNotBlank(openId)) { + logger.error("openId 不能为空"); + return new Result(); + } + LatestStaffWechatLoginResultDTO latestStaffWechatLoginDTO = baseDao.selectLatestStaffWechatLoginRecord(openId); + return new Result().ok(latestStaffWechatLoginDTO); + } + + @Override + public Result saveStaffLoginRecord(StaffLoginHistoryFormDTO formDTO) { + StaffLoginHistoryEntity entity = ConvertUtils.sourceToTarget(formDTO, StaffLoginHistoryEntity.class); + insert(entity); + return new Result(); + } + +} \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/resources/db/migration/epmet_user.sql b/epmet-user/epmet-user-server/src/main/resources/db/migration/epmet_user.sql index 19f25df536..e09dd173a2 100644 --- a/epmet-user/epmet-user-server/src/main/resources/db/migration/epmet_user.sql +++ b/epmet-user/epmet-user-server/src/main/resources/db/migration/epmet_user.sql @@ -35,4 +35,22 @@ CREATE TABLE `staff_wechat` ( PRIMARY KEY (`ID`) USING BTREE ) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=COMPACT COMMENT='工作人员微信关系表 '; -alter table grid_latest MODIFY COLUMN PID VARCHAR(64) comment'上级组织ID (数据统计字段)' \ No newline at end of file +alter table grid_latest MODIFY COLUMN PID VARCHAR(64) comment'上级组织ID (数据统计字段)'; +alter table staff_wechat add column LATEST_LOGIN_TIME datetime NOT NULL COMMENT '最后一次登录时间'; +alter table staff_wechat drop column LATEST_LOGIN_TIME; +CREATE TABLE `staff_login_history` ( + `ID` varchar(64) NOT NULL COMMENT '唯一标识', + `CUSTOMER_ID` varchar(64) NOT NULL COMMENT '客户ID', + `STAFF_ID` varchar(64) NOT NULL COMMENT 'customer_staff.userId', + WX_OPEN_ID varchar(64) NOT NULL COMMENT '微信openId', + `MOBILE` varchar(20) NOT NULL COMMENT '手机号', + `ORG_ID` varchar(64) NOT NULL COMMENT '组织机构id', + `GRID_ID` varchar(64) COMMENT '网格表Id (CUSTOMER_GRID.id)', + `DEL_FLAG` int(11) NOT NULL COMMENT '删除标识:0.未删除 1.已删除', + `REVISION` int(11) NOT NULL COMMENT '乐观锁', + `CREATED_BY` varchar(32) NOT NULL COMMENT '创建人', + `CREATED_TIME` datetime NOT NULL COMMENT '创建时间,登录时间', + `UPDATED_BY` varchar(32) DEFAULT NULL COMMENT '更新人', + `UPDATED_TIME` datetime DEFAULT NULL COMMENT '更新时间', + PRIMARY KEY (`ID`) USING BTREE +) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=COMPACT COMMENT='工作人员登录日志表'; \ 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 c5ba17deab..1a8958a306 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 @@ -3,26 +3,18 @@ - - - - - - - - - - - - - - - - - - - - - + + + + \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/resources/mapper/StaffLoginHistoryDao.xml b/epmet-user/epmet-user-server/src/main/resources/mapper/StaffLoginHistoryDao.xml new file mode 100644 index 0000000000..4f382bfa10 --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/resources/mapper/StaffLoginHistoryDao.xml @@ -0,0 +1,40 @@ + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file From 4b96cd16ecd32d6436f4094ab7b8d878b488c2c0 Mon Sep 17 00:00:00 2001 From: yinzuomei <576302893@qq.com> Date: Mon, 20 Apr 2020 16:24:24 +0800 Subject: [PATCH 02/85] =?UTF-8?q?=E4=BF=AE=E6=94=B9auth=E3=80=81gateway?= =?UTF-8?q?=E6=A8=A1=E5=9D=97redis=E8=BF=9E=E6=8E=A5=E5=9C=B0=E5=9D=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- epmet-auth/pom.xml | 2 +- epmet-gateway/pom.xml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/epmet-auth/pom.xml b/epmet-auth/pom.xml index be588da1e1..93feb4625c 100644 --- a/epmet-auth/pom.xml +++ b/epmet-auth/pom.xml @@ -135,7 +135,7 @@ 0 - 127.0.0.1 + 192.168.1.130 6379 123456 diff --git a/epmet-gateway/pom.xml b/epmet-gateway/pom.xml index eed74d589d..5b943229db 100644 --- a/epmet-gateway/pom.xml +++ b/epmet-gateway/pom.xml @@ -95,7 +95,7 @@ 0 - 127.0.0.1 + 192.168.1.130 6379 123456 From 3d2c935228c2024bf311bd06bbc1bb8de6ec81d2 Mon Sep 17 00:00:00 2001 From: yinzuomei <576302893@qq.com> Date: Mon, 20 Apr 2020 16:36:04 +0800 Subject: [PATCH 03/85] =?UTF-8?q?getCustomerStaffInfo=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/epmet/service/GovLoginService.java | 2 +- .../main/java/com/epmet/service/impl/GovLoginServiceImpl.java | 4 ++-- .../java/com/epmet/service/impl/CustomerStaffServiceImpl.java | 4 ++++ 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/epmet-auth/src/main/java/com/epmet/service/GovLoginService.java b/epmet-auth/src/main/java/com/epmet/service/GovLoginService.java index b805bbf217..f01e6ef096 100644 --- a/epmet-auth/src/main/java/com/epmet/service/GovLoginService.java +++ b/epmet-auth/src/main/java/com/epmet/service/GovLoginService.java @@ -29,7 +29,7 @@ public interface GovLoginService { * @Description 3、手机验证码获取组织 * @Date 2020/4/18 21:11 **/ - Result getorgs(GovWxmpGetOrgsFormDTO formDTO); + Result getorgs(GovWxmpGetOrgsFormDTO formDTO); /** * @param formDTO diff --git a/epmet-auth/src/main/java/com/epmet/service/impl/GovLoginServiceImpl.java b/epmet-auth/src/main/java/com/epmet/service/impl/GovLoginServiceImpl.java index f41e0b81d9..055d169e27 100644 --- a/epmet-auth/src/main/java/com/epmet/service/impl/GovLoginServiceImpl.java +++ b/epmet-auth/src/main/java/com/epmet/service/impl/GovLoginServiceImpl.java @@ -96,7 +96,7 @@ public class GovLoginServiceImpl implements GovLoginService { * @Date 2020/4/18 21:11 **/ @Override - public Result getorgs(GovWxmpGetOrgsFormDTO formDTO) { + public Result getorgs(GovWxmpGetOrgsFormDTO formDTO) { //1、根据手机号查询到用户信息 Result> customerStaffResult = epmetUserFeignClient.checkCustomerStaff(formDTO.getMobile()); if (!customerStaffResult.success()) { @@ -106,7 +106,7 @@ public class GovLoginServiceImpl implements GovLoginService { //2、验证码是否正确 String rightSmsCode = captchaRedis.getSmsCode(formDTO); if (!formDTO.getSmsCode().equals(rightSmsCode)) { - return new Result().error(EpmetErrorCode.MOBILE_CODE_ERROR.getCode()); + return new Result<>().error(EpmetErrorCode.MOBILE_CODE_ERROR.getCode()); } //3、TODO返回组织树 return new Result(); 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 7fdbb725e3..9d9e11a64c 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 @@ -122,6 +122,10 @@ public class CustomerStaffServiceImpl extends BaseServiceImpl getCustomerStaffInfo(CustomerStaffFormDTO formDTO) { CustomerStaffDTO customerStaffDTO = baseDao.selectListCustomerStaffInfo(formDTO); + if (null == customerStaffDTO) { + logger.error(String.format("根据手机号查询用户异常,手机号:[%s],code[%s],msg[%s]", formDTO.getMobile(), EpmetErrorCode.GOV_STAFF_NOT_EXISTS.getCode(), EpmetErrorCode.GOV_STAFF_NOT_EXISTS.getMsg())); + return new Result().error(EpmetErrorCode.GOV_STAFF_NOT_EXISTS.getCode()); + } //判断用户是否已被禁用 if (null != customerStaffDTO && UserConstant.DISABLED.equals(customerStaffDTO.getEnableFlag())) { logger.error(String.format("根据手机号查询用户异常,手机号:[%s],客户id:[%s],code[%s],msg[%s]", formDTO.getMobile(), formDTO.getCustomerId(), EpmetErrorCode.GOV_STAFF_DISABLED.getCode(), EpmetErrorCode.GOV_STAFF_DISABLED.getMsg())); From 84614c5a14bea25dc11859a5760ef823fc3c788b Mon Sep 17 00:00:00 2001 From: yinzuomei <576302893@qq.com> Date: Mon, 20 Apr 2020 22:32:08 +0800 Subject: [PATCH 04/85] =?UTF-8?q?=E8=B5=9E=E6=8F=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../epmet/controller/GovLoginController.java | 11 +- ...OrgsFormDTO.java => StaffOrgsFormDTO.java} | 8 +- .../com/epmet/feign/EpmetUserFeignClient.java | 2 +- .../com/epmet/feign/GovOrgFeignClient.java | 27 ++++- .../EpmetUserFeignClientFallback.java | 2 +- .../fallback/GovOrgFeignClientFallback.java | 15 ++- .../java/com/epmet/redis/CaptchaRedis.java | 7 +- .../com/epmet/service/GovLoginService.java | 7 +- .../service/impl/GovLoginServiceImpl.java | 104 +++++++++++------- .../tools/security/dto/GovTokenDto.java | 13 ++- ....java => StaffLatestLoginGridFormDTO.java} | 5 +- .../com/epmet/dto/form/StaffOrgFormDTO.java | 18 +++ ...ava => StaffLatestLoginGridResultDTO.java} | 2 +- .../epmet/dto/result/StaffOrgsResultDTO.java | 31 ++++++ .../controller/CustomerAgencyController.java | 15 ++- .../java/com/epmet/dao/CustomerAgencyDao.java | 13 ++- .../epmet/service/CustomerAgencyService.java | 12 ++ .../impl/CustomerAgencyServiceImpl.java | 13 ++- .../resources/mapper/CustomerAgencyDao.xml | 17 ++- .../resources/mapper/CustomerStaffDao.xml | 1 + 20 files changed, 254 insertions(+), 69 deletions(-) rename epmet-auth/src/main/java/com/epmet/dto/form/{GovWxmpGetOrgsFormDTO.java => StaffOrgsFormDTO.java} (79%) rename epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/{StaffGridInfoFormDTO.java => StaffLatestLoginGridFormDTO.java} (85%) create mode 100644 epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/StaffOrgFormDTO.java rename epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/{StaffGridInfoResultDTO.java => StaffLatestLoginGridResultDTO.java} (89%) create mode 100644 epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/StaffOrgsResultDTO.java diff --git a/epmet-auth/src/main/java/com/epmet/controller/GovLoginController.java b/epmet-auth/src/main/java/com/epmet/controller/GovLoginController.java index 0539be499d..ea4b5c8974 100644 --- a/epmet-auth/src/main/java/com/epmet/controller/GovLoginController.java +++ b/epmet-auth/src/main/java/com/epmet/controller/GovLoginController.java @@ -4,8 +4,9 @@ import com.epmet.commons.tools.utils.Result; import com.epmet.commons.tools.validator.ValidatorUtils; import com.epmet.dto.form.GovWxmpEnteOrgFormDTO; import com.epmet.dto.form.GovWxmpFormDTO; -import com.epmet.dto.form.GovWxmpGetOrgsFormDTO; import com.epmet.dto.form.SendSmsCodeFormDTO; +import com.epmet.dto.form.StaffOrgsFormDTO; +import com.epmet.dto.result.StaffOrgsResultDTO; import com.epmet.dto.result.UserTokenResultDTO; import com.epmet.service.GovLoginService; import org.springframework.beans.factory.annotation.Autowired; @@ -14,6 +15,8 @@ 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; + /** * @Description 政府端登录 * @Author yinzuomei @@ -58,10 +61,10 @@ public class GovLoginController { * @Description 3、手机验证码获取组织 * @Date 2020/4/18 21:14 **/ - @PostMapping(value = "/loginwxmp/getorgs") - public Result getorgs(GovWxmpGetOrgsFormDTO formDTO) { + @PostMapping(value = "/loginwxmp/getmyorg") + public Result> getmyorg(StaffOrgsFormDTO formDTO) { ValidatorUtils.validateEntity(formDTO); - return govLoginService.getorgs(formDTO); + return govLoginService.getMyOrg(formDTO); } /** diff --git a/epmet-auth/src/main/java/com/epmet/dto/form/GovWxmpGetOrgsFormDTO.java b/epmet-auth/src/main/java/com/epmet/dto/form/StaffOrgsFormDTO.java similarity index 79% rename from epmet-auth/src/main/java/com/epmet/dto/form/GovWxmpGetOrgsFormDTO.java rename to epmet-auth/src/main/java/com/epmet/dto/form/StaffOrgsFormDTO.java index b2674f3277..e36c100809 100644 --- a/epmet-auth/src/main/java/com/epmet/dto/form/GovWxmpGetOrgsFormDTO.java +++ b/epmet-auth/src/main/java/com/epmet/dto/form/StaffOrgsFormDTO.java @@ -11,12 +11,18 @@ import java.io.Serializable; * @Date 2020/4/18 10:38 */ @Data -public class GovWxmpGetOrgsFormDTO implements Serializable { +public class StaffOrgsFormDTO implements Serializable { private static final long serialVersionUID = 4193133227120225342L; + /** + * 手机号 + */ @NotBlank(message = "手机号不能为空") private String mobile; + /** + * 验证码 + */ @NotBlank(message="验证码不能为空") private String smsCode; } diff --git a/epmet-auth/src/main/java/com/epmet/feign/EpmetUserFeignClient.java b/epmet-auth/src/main/java/com/epmet/feign/EpmetUserFeignClient.java index 45fe847c49..d62c41b2c4 100644 --- a/epmet-auth/src/main/java/com/epmet/feign/EpmetUserFeignClient.java +++ b/epmet-auth/src/main/java/com/epmet/feign/EpmetUserFeignClient.java @@ -76,7 +76,7 @@ public interface EpmetUserFeignClient { * @Date 2020/4/18 22:44 **/ @PostMapping(value = "epmetuser/staffwechat/savestaffwechat", consumes = MediaType.APPLICATION_JSON_VALUE) - Result savestaffwechat(@RequestBody StaffWechatFormDTO staffWechatFormDTO); + Result saveStaffWechat(@RequestBody StaffWechatFormDTO staffWechatFormDTO); /** * @param openId diff --git a/epmet-auth/src/main/java/com/epmet/feign/GovOrgFeignClient.java b/epmet-auth/src/main/java/com/epmet/feign/GovOrgFeignClient.java index 0d3fe7c566..f284da98ab 100644 --- a/epmet-auth/src/main/java/com/epmet/feign/GovOrgFeignClient.java +++ b/epmet-auth/src/main/java/com/epmet/feign/GovOrgFeignClient.java @@ -2,8 +2,10 @@ package com.epmet.feign; import com.epmet.commons.tools.constant.ServiceConstant; import com.epmet.commons.tools.utils.Result; -import com.epmet.dto.form.StaffGridInfoFormDTO; -import com.epmet.dto.result.StaffGridInfoResultDTO; +import com.epmet.dto.form.StaffLatestLoginGridFormDTO; +import com.epmet.dto.form.StaffOrgFormDTO; +import com.epmet.dto.result.StaffLatestLoginGridResultDTO; +import com.epmet.dto.result.StaffOrgsResultDTO; import com.epmet.feign.fallback.GovOrgFeignClientFallback; import org.springframework.cloud.openfeign.FeignClient; import org.springframework.http.MediaType; @@ -18,6 +20,23 @@ import java.util.List; */ @FeignClient(name = ServiceConstant.GOV_ORG_SERVER, fallback = GovOrgFeignClientFallback.class) public interface GovOrgFeignClient { - @PostMapping(value = "getStaffGridInfo",consumes = MediaType.APPLICATION_JSON_VALUE) - Result> getStaffGridInfo(StaffGridInfoFormDTO staffGridInfoFormDTO); + /** + * @return com.epmet.commons.tools.utils.Result> + * @param staffGridInfoFormDTO + * @Author yinzuomei + * @Description + * @Date 2020/4/20 21:36 + **/ + @PostMapping(value = "gov/org/customergrid/getStaffGridInfo",consumes = MediaType.APPLICATION_JSON_VALUE) + Result getStaffLatestLoginGrid(StaffLatestLoginGridFormDTO staffGridInfoFormDTO); + + /** + * @return com.epmet.commons.tools.utils.Result> + * @param staffOrgFormDTO + * @Author yinzuomei + * @Description 获取客户对应的根级组织名称 + * @Date 2020/4/20 21:37 + **/ + @PostMapping(value = "/gov/org/customeragency/getStaffOrgList",consumes = MediaType.APPLICATION_JSON_VALUE) + Result> getStaffOrgList(StaffOrgFormDTO staffOrgFormDTO); } diff --git a/epmet-auth/src/main/java/com/epmet/feign/fallback/EpmetUserFeignClientFallback.java b/epmet-auth/src/main/java/com/epmet/feign/fallback/EpmetUserFeignClientFallback.java index 9126cf63b8..571785b43f 100644 --- a/epmet-auth/src/main/java/com/epmet/feign/fallback/EpmetUserFeignClientFallback.java +++ b/epmet-auth/src/main/java/com/epmet/feign/fallback/EpmetUserFeignClientFallback.java @@ -43,7 +43,7 @@ public class EpmetUserFeignClientFallback implements EpmetUserFeignClient { } @Override - public Result savestaffwechat(StaffWechatFormDTO staffWechatFormDTO) { + public Result saveStaffWechat(StaffWechatFormDTO staffWechatFormDTO) { return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "saveStaffWechat", staffWechatFormDTO); } diff --git a/epmet-auth/src/main/java/com/epmet/feign/fallback/GovOrgFeignClientFallback.java b/epmet-auth/src/main/java/com/epmet/feign/fallback/GovOrgFeignClientFallback.java index 94a235f3ec..6121363dfd 100644 --- a/epmet-auth/src/main/java/com/epmet/feign/fallback/GovOrgFeignClientFallback.java +++ b/epmet-auth/src/main/java/com/epmet/feign/fallback/GovOrgFeignClientFallback.java @@ -3,8 +3,10 @@ package com.epmet.feign.fallback; import com.epmet.commons.tools.constant.ServiceConstant; import com.epmet.commons.tools.utils.ModuleUtils; import com.epmet.commons.tools.utils.Result; -import com.epmet.dto.form.StaffGridInfoFormDTO; -import com.epmet.dto.result.StaffGridInfoResultDTO; +import com.epmet.dto.form.StaffLatestLoginGridFormDTO; +import com.epmet.dto.form.StaffOrgFormDTO; +import com.epmet.dto.result.StaffLatestLoginGridResultDTO; +import com.epmet.dto.result.StaffOrgsResultDTO; import com.epmet.feign.GovOrgFeignClient; import org.springframework.stereotype.Component; @@ -18,8 +20,13 @@ import java.util.List; @Component public class GovOrgFeignClientFallback implements GovOrgFeignClient { @Override - public Result> getStaffGridInfo(StaffGridInfoFormDTO staffGridInfoFormDTO) { - return ModuleUtils.feignConError(ServiceConstant.GOV_ORG_SERVER, "getStaffGridInfo", staffGridInfoFormDTO); + public Result getStaffLatestLoginGrid(StaffLatestLoginGridFormDTO staffLatestLoginGridFormDTO) { + return ModuleUtils.feignConError(ServiceConstant.GOV_ORG_SERVER, "getStaffLatestLoginGrid", staffLatestLoginGridFormDTO); + } + + @Override + public Result> getStaffOrgList(StaffOrgFormDTO staffOrgFormDTO) { + return ModuleUtils.feignConError(ServiceConstant.GOV_ORG_SERVER, "getStaffOrgList", staffOrgFormDTO); } } diff --git a/epmet-auth/src/main/java/com/epmet/redis/CaptchaRedis.java b/epmet-auth/src/main/java/com/epmet/redis/CaptchaRedis.java index 0ec9158dae..acdd85f490 100644 --- a/epmet-auth/src/main/java/com/epmet/redis/CaptchaRedis.java +++ b/epmet-auth/src/main/java/com/epmet/redis/CaptchaRedis.java @@ -11,7 +11,6 @@ package com.epmet.redis; import com.epmet.common.token.constant.LoginConstant; import com.epmet.commons.tools.redis.RedisKeys; import com.epmet.commons.tools.redis.RedisUtils; -import com.epmet.dto.form.GovWxmpGetOrgsFormDTO; import com.epmet.dto.form.SendSmsCodeFormDTO; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; @@ -72,14 +71,14 @@ public class CaptchaRedis { } /** - * @param formDTO + * @param mobile * @return java.lang.String * @Author yinzuomei * @Description 获取登录时发送的验证码 * @Date 2020/4/18 21:33 **/ - public String getSmsCode(GovWxmpGetOrgsFormDTO formDTO) { - String smsCodeKey = RedisKeys.getLoginSmsCodeKey(LoginConstant.APP_GOV, LoginConstant.CLIENT_WXMP, formDTO.getMobile()); + public String getSmsCode(String mobile) { + String smsCodeKey = RedisKeys.getLoginSmsCodeKey(LoginConstant.APP_GOV, LoginConstant.CLIENT_WXMP, mobile); String smsCode = (String) redisUtils.get(smsCodeKey); return smsCode; } diff --git a/epmet-auth/src/main/java/com/epmet/service/GovLoginService.java b/epmet-auth/src/main/java/com/epmet/service/GovLoginService.java index f01e6ef096..8e98ad44de 100644 --- a/epmet-auth/src/main/java/com/epmet/service/GovLoginService.java +++ b/epmet-auth/src/main/java/com/epmet/service/GovLoginService.java @@ -3,10 +3,13 @@ package com.epmet.service; import com.epmet.commons.tools.utils.Result; import com.epmet.dto.form.GovWxmpEnteOrgFormDTO; import com.epmet.dto.form.GovWxmpFormDTO; -import com.epmet.dto.form.GovWxmpGetOrgsFormDTO; import com.epmet.dto.form.SendSmsCodeFormDTO; +import com.epmet.dto.form.StaffOrgsFormDTO; +import com.epmet.dto.result.StaffOrgsResultDTO; import com.epmet.dto.result.UserTokenResultDTO; +import java.util.List; + /** * @Description 政府端登录服务 * @Author yinzuomei @@ -29,7 +32,7 @@ public interface GovLoginService { * @Description 3、手机验证码获取组织 * @Date 2020/4/18 21:11 **/ - Result getorgs(GovWxmpGetOrgsFormDTO formDTO); + Result> getMyOrg(StaffOrgsFormDTO formDTO); /** * @param formDTO diff --git a/epmet-auth/src/main/java/com/epmet/service/impl/GovLoginServiceImpl.java b/epmet-auth/src/main/java/com/epmet/service/impl/GovLoginServiceImpl.java index 055d169e27..5f6480ef2c 100644 --- a/epmet-auth/src/main/java/com/epmet/service/impl/GovLoginServiceImpl.java +++ b/epmet-auth/src/main/java/com/epmet/service/impl/GovLoginServiceImpl.java @@ -10,9 +10,7 @@ import com.epmet.commons.tools.utils.Result; import com.epmet.commons.tools.validator.PhoneValidatorUtils; import com.epmet.dto.CustomerStaffDTO; import com.epmet.dto.form.*; -import com.epmet.dto.result.LatestStaffWechatLoginResultDTO; -import com.epmet.dto.result.StaffGridInfoResultDTO; -import com.epmet.dto.result.UserTokenResultDTO; +import com.epmet.dto.result.*; import com.epmet.feign.EpmetUserFeignClient; import com.epmet.feign.GovOrgFeignClient; import com.epmet.feign.MessageFeignClient; @@ -26,6 +24,7 @@ import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; +import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -96,7 +95,7 @@ public class GovLoginServiceImpl implements GovLoginService { * @Date 2020/4/18 21:11 **/ @Override - public Result getorgs(GovWxmpGetOrgsFormDTO formDTO) { + public Result> getMyOrg(StaffOrgsFormDTO formDTO) { //1、根据手机号查询到用户信息 Result> customerStaffResult = epmetUserFeignClient.checkCustomerStaff(formDTO.getMobile()); if (!customerStaffResult.success()) { @@ -104,12 +103,19 @@ public class GovLoginServiceImpl implements GovLoginService { return new Result().error(customerStaffResult.getCode()); } //2、验证码是否正确 - String rightSmsCode = captchaRedis.getSmsCode(formDTO); + String rightSmsCode = captchaRedis.getSmsCode(formDTO.getMobile()); if (!formDTO.getSmsCode().equals(rightSmsCode)) { - return new Result<>().error(EpmetErrorCode.MOBILE_CODE_ERROR.getCode()); + return new Result>().error(EpmetErrorCode.MOBILE_CODE_ERROR.getCode()); } - //3、TODO返回组织树 - return new Result(); + //3、查询用户所有的组织信息 + List customerIdList = new ArrayList<>(); + for (CustomerStaffDTO customerStaffDTO : customerStaffResult.getData()) { + customerIdList.add(customerStaffDTO.getCustomerId()); + } + StaffOrgFormDTO staffOrgFormDTO = new StaffOrgFormDTO(); + staffOrgFormDTO.setCustomerIdList(customerIdList); + Result> result = govOrgFeignClient.getStaffOrgList(staffOrgFormDTO); + return result; } @Override @@ -129,12 +135,34 @@ public class GovLoginServiceImpl implements GovLoginService { //4、获取用户token String token = this.generateGovWxmpToken(latestStaffWechatLoginDTO.getStaffId()); //5、保存到redis - this.saveGovTokenDto(latestStaffWechatLoginDTO.getOrgId(), latestStaffWechatLoginDTO.getGridId(), latestStaffWechatLoginDTO.getStaffId(), wxMaJscode2SessionResult, token); + this.saveLatestGovTokenDto(latestStaffWechatLoginDTO, wxMaJscode2SessionResult, token); UserTokenResultDTO userTokenResultDTO = new UserTokenResultDTO(); userTokenResultDTO.setToken(token); return new Result().ok(userTokenResultDTO); } + //保存tokenDto到redis + private void saveLatestGovTokenDto(LatestStaffWechatLoginResultDTO latestStaffWechatLoginDTO, + WxMaJscode2SessionResult wxMaJscode2SessionResult, + String token) { + int expire = jwtTokenProperties.getExpire(); + GovTokenDto govTokenDto = new GovTokenDto(); + govTokenDto.setApp(LoginConstant.APP_GOV); + govTokenDto.setClient(LoginConstant.CLIENT_WXMP); + govTokenDto.setStaffId(latestStaffWechatLoginDTO.getStaffId()); + govTokenDto.setOpenId(wxMaJscode2SessionResult.getOpenid()); + govTokenDto.setSessionKey(wxMaJscode2SessionResult.getSessionKey()); + govTokenDto.setUnionId(wxMaJscode2SessionResult.getUnionid()); + govTokenDto.setToken(token); + govTokenDto.setUpdateTime(System.currentTimeMillis()); + govTokenDto.setExpireTime(jwtTokenUtils.getExpiration(token).getTime()); + govTokenDto.setOrgId(latestStaffWechatLoginDTO.getOrgId()); + govTokenDto.setGridId(latestStaffWechatLoginDTO.getGridId()); + govTokenDto.setCustomerId(latestStaffWechatLoginDTO.getCustomerId()); + cpUserDetailRedis.set(govTokenDto, expire); + logger.info("截止时间:" + DateUtils.format(jwtTokenUtils.getExpiration(token), "yyyy-MM-dd HH:mm:ss")); + } + //保存登录日志 private Result saveStaffLoginRecord(LatestStaffWechatLoginResultDTO latestStaffWechatLoginDTO) { StaffLoginHistoryFormDTO staffLoginHistoryFormDTO = new StaffLoginHistoryFormDTO(); @@ -164,19 +192,30 @@ public class GovLoginServiceImpl implements GovLoginService { WxMaJscode2SessionResult wxMaJscode2SessionResult = loginService.getWxMaUser(LoginConstant.APP_GOV, formDTO.getWxCode()); //3、记录staff_wechat this.savestaffwechat(customerStaff.getUserId(), wxMaJscode2SessionResult.getOpenid()); - //4、记录登录日志 - StaffGridInfoFormDTO staffGridInfoFormDTO = new StaffGridInfoFormDTO(); + //4、查询用户绑定的网格 + StaffLatestLoginGridResultDTO latestGridInfo = this.getLatestGridInfo(formDTO, customerStaff.getUserId()); + //5、记录登录日志 + this.saveStaffLoginRecord(formDTO, customerStaff.getUserId(), wxMaJscode2SessionResult.getOpenid(), latestGridInfo.getGridId()); + //1、获取用户token + String token = this.generateGovWxmpToken(customerStaff.getUserId()); + //2、保存到redis + this.saveGovTokenDto(formDTO.getOrgId(), formDTO.getCustomerId(), latestGridInfo.getGridId(), customerStaff.getUserId(), wxMaJscode2SessionResult, token); + UserTokenResultDTO userTokenResultDTO = new UserTokenResultDTO(); + userTokenResultDTO.setToken(token); + return new Result().ok(userTokenResultDTO); + } + + //查询用户绑定的网格 + private StaffLatestLoginGridResultDTO getLatestGridInfo(GovWxmpEnteOrgFormDTO formDTO, String userId) { + StaffLatestLoginGridFormDTO staffGridInfoFormDTO = new StaffLatestLoginGridFormDTO(); staffGridInfoFormDTO.setCustomerId(formDTO.getCustomerId()); staffGridInfoFormDTO.setOrgId(formDTO.getOrgId()); - staffGridInfoFormDTO.setStaffId(customerStaff.getUserId()); - Result> staffGridInfoListResult = govOrgFeignClient.getStaffGridInfo(staffGridInfoFormDTO); - String gridId = null; - if (staffGridInfoListResult.success() && null != staffGridInfoListResult.getData() && staffGridInfoListResult.getData().size() > 0) { - gridId = staffGridInfoListResult.getData().get(0).getGridId(); + staffGridInfoFormDTO.setStaffId(userId); + Result staffGridInfoListResult = govOrgFeignClient.getStaffLatestLoginGrid(staffGridInfoFormDTO); + if (staffGridInfoListResult.success() && null != staffGridInfoListResult.getData()) { + return staffGridInfoListResult.getData(); } - this.saveStaffLoginRecord(formDTO, customerStaff.getUserId(), wxMaJscode2SessionResult.getOpenid(), gridId); - UserTokenResultDTO userTokenResultDTO = this.getAuthorizationInfo(formDTO.getOrgId(), gridId, customerStaff.getUserId(), wxMaJscode2SessionResult); - return new Result().ok(userTokenResultDTO); + return new StaffLatestLoginGridResultDTO(); } //保存登录日志 @@ -192,18 +231,6 @@ public class GovLoginServiceImpl implements GovLoginService { return staffLoginRecordResult; } - private UserTokenResultDTO getAuthorizationInfo(String orgId, - String gridId, - String staffId, - WxMaJscode2SessionResult wxMaJscode2SessionResult) { - //1、获取用户token - String token = this.generateGovWxmpToken(staffId); - //2、保存到redis - this.saveGovTokenDto(orgId, gridId, staffId, wxMaJscode2SessionResult, token); - UserTokenResultDTO userTokenResultDTO = new UserTokenResultDTO(); - userTokenResultDTO.setToken(token); - return userTokenResultDTO; - } /** * @param userId @@ -217,7 +244,7 @@ public class GovLoginServiceImpl implements GovLoginService { StaffWechatFormDTO staffWechatFormDTO = new StaffWechatFormDTO(); staffWechatFormDTO.setUserId(userId); staffWechatFormDTO.setWxOpenId(openid); - return epmetUserFeignClient.savestaffwechat(staffWechatFormDTO); + return epmetUserFeignClient.saveStaffWechat(staffWechatFormDTO); } /** @@ -238,11 +265,12 @@ public class GovLoginServiceImpl implements GovLoginService { * @Description 生成token * @Date 2020/4/18 23:04 **/ - private String saveGovTokenDto(String orgId, - String gridId, - String staffId, - WxMaJscode2SessionResult wxMaJscode2SessionResult, - String token) { + private void saveGovTokenDto(String orgId, + String customerId, + String gridId, + String staffId, + WxMaJscode2SessionResult wxMaJscode2SessionResult, + String token) { int expire = jwtTokenProperties.getExpire(); GovTokenDto govTokenDto = new GovTokenDto(); govTokenDto.setApp(LoginConstant.APP_GOV); @@ -256,9 +284,9 @@ public class GovLoginServiceImpl implements GovLoginService { govTokenDto.setExpireTime(jwtTokenUtils.getExpiration(token).getTime()); govTokenDto.setOrgId(orgId); govTokenDto.setGridId(gridId); + govTokenDto.setCustomerId(customerId); cpUserDetailRedis.set(govTokenDto, expire); logger.info("截止时间:" + DateUtils.format(jwtTokenUtils.getExpiration(token), "yyyy-MM-dd HH:mm:ss")); - return token; } } diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/security/dto/GovTokenDto.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/security/dto/GovTokenDto.java index 08d9954eda..e46a4c1119 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/security/dto/GovTokenDto.java +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/security/dto/GovTokenDto.java @@ -58,22 +58,27 @@ public class GovTokenDto implements Serializable { private long updateTime; /** - * 当前登录的组织id + * 当前工作人员进入的客户id + */ + private String customerId; + + /** + * 当前登录的组织id(顶级) */ private String orgId; /** - * 待定 + * 当前网格对应的组织结构id的全路径用:隔开 */ private String orgIdPath; /** - * 待定 + * 当前所在网格id */ private String gridId; /** - * 待定 + * 部门id列表 */ private List deptIdList; } diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/StaffGridInfoFormDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/StaffLatestLoginGridFormDTO.java similarity index 85% rename from epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/StaffGridInfoFormDTO.java rename to epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/StaffLatestLoginGridFormDTO.java index 85b321f25a..f07e657f73 100644 --- a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/StaffGridInfoFormDTO.java +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/StaffLatestLoginGridFormDTO.java @@ -11,7 +11,7 @@ import java.io.Serializable; * @Date 2020/4/20 15:29 */ @Data -public class StaffGridInfoFormDTO implements Serializable { +public class StaffLatestLoginGridFormDTO implements Serializable { /** * 用户选择的组织所属的id */ @@ -24,6 +24,9 @@ public class StaffGridInfoFormDTO implements Serializable { @NotBlank(message = "组织id不能为空") private String orgId; + /** + * 工作人员id + */ @NotBlank(message = "staffId不能为空") private String staffId; } diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/StaffOrgFormDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/StaffOrgFormDTO.java new file mode 100644 index 0000000000..d2cb982645 --- /dev/null +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/StaffOrgFormDTO.java @@ -0,0 +1,18 @@ +package com.epmet.dto.form; + +import lombok.Data; + +import java.io.Serializable; +import java.util.List; + +/** + * @Description 根据客户id查询组织结构信息入参 + * @Author yinzuomei + * @Date 2020/4/20 21:42 + */ +@Data +public class StaffOrgFormDTO implements Serializable { + private static final long serialVersionUID = 2514896455028592288L; + private List customerIdList; +} + diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/StaffGridInfoResultDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/StaffLatestLoginGridResultDTO.java similarity index 89% rename from epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/StaffGridInfoResultDTO.java rename to epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/StaffLatestLoginGridResultDTO.java index e636db75ee..4c067bdbe2 100644 --- a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/StaffGridInfoResultDTO.java +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/StaffLatestLoginGridResultDTO.java @@ -10,7 +10,7 @@ import java.io.Serializable; * @Date 2020/4/20 15:22 */ @Data -public class StaffGridInfoResultDTO implements Serializable { +public class StaffLatestLoginGridResultDTO implements Serializable { /** * ID 唯一标识 */ diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/StaffOrgsResultDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/StaffOrgsResultDTO.java new file mode 100644 index 0000000000..58955cc634 --- /dev/null +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/StaffOrgsResultDTO.java @@ -0,0 +1,31 @@ +package com.epmet.dto.result; + +import lombok.Data; + +import java.io.Serializable; + +/** + * @Description 政府端工作人员获取我的组织 + * @Author yinzuomei + * @Date 2020/4/20 18:45 + */ +@Data +public class StaffOrgsResultDTO implements Serializable { + private static final long serialVersionUID = -9148184731135509803L; + + /** + * 组织id + */ + private String orgId; + + /** + * 客户id + */ + private String customerId; + + /** + * 组织名称 + */ + private String orgName; +} + diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/CustomerAgencyController.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/CustomerAgencyController.java index 550cdb1832..a1e5ea58fe 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/CustomerAgencyController.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/CustomerAgencyController.java @@ -23,9 +23,11 @@ import com.epmet.commons.tools.utils.Result; import com.epmet.commons.tools.validator.AssertUtils; import com.epmet.commons.tools.validator.ValidatorUtils; import com.epmet.commons.tools.validator.group.AddGroup; -import com.epmet.commons.tools.validator.group.UpdateGroup; import com.epmet.commons.tools.validator.group.DefaultGroup; +import com.epmet.commons.tools.validator.group.UpdateGroup; import com.epmet.dto.CustomerAgencyDTO; +import com.epmet.dto.form.StaffOrgFormDTO; +import com.epmet.dto.result.StaffOrgsResultDTO; import com.epmet.excel.CustomerAgencyExcel; import com.epmet.service.CustomerAgencyService; import org.springframework.beans.factory.annotation.Autowired; @@ -91,4 +93,15 @@ public class CustomerAgencyController { ExcelUtils.exportExcelToTarget(response, null, list, CustomerAgencyExcel.class); } + /** + * @return com.epmet.commons.tools.utils.Result> + * @param staffOrgsFormDTO + * @Author yinzuomei + * @Description 登录-获取工作人员所有组织 + * @Date 2020/4/20 21:59 + **/ + @PostMapping("getStaffOrgList") + public Result> getStaffOrgList(@RequestBody StaffOrgFormDTO staffOrgsFormDTO){ + return customerAgencyService.getStaffOrgList(staffOrgsFormDTO); + } } \ No newline at end of file diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerAgencyDao.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerAgencyDao.java index 185d2d33a1..4f85e09091 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerAgencyDao.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerAgencyDao.java @@ -18,8 +18,12 @@ package com.epmet.dao; import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.dto.result.StaffOrgsResultDTO; import com.epmet.entity.CustomerAgencyEntity; import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +import java.util.List; /** * 机关单位信息表 @@ -29,5 +33,12 @@ import org.apache.ibatis.annotations.Mapper; */ @Mapper public interface CustomerAgencyDao extends BaseDao { - + /** + * @param customerIdList + * @return java.util.List + * @Author yinzuomei + * @Description 查询客户对应的根级组织 + * @Date 2020/4/20 21:48 + **/ + List selectStaffOrgList(@Param("customerIdList") List customerIdList); } \ No newline at end of file diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/CustomerAgencyService.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/CustomerAgencyService.java index 319e26890f..62892b4576 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/CustomerAgencyService.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/CustomerAgencyService.java @@ -19,7 +19,10 @@ 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.CustomerAgencyDTO; +import com.epmet.dto.form.StaffOrgFormDTO; +import com.epmet.dto.result.StaffOrgsResultDTO; import com.epmet.entity.CustomerAgencyEntity; import java.util.List; @@ -92,4 +95,13 @@ public interface CustomerAgencyService extends BaseService * @date 2020-04-20 */ void delete(String[] ids); + + /** + * @param staffOrgsFormDTO + * @return com.epmet.commons.tools.utils.Result> + * @Author yinzuomei + * @Description 根据客户id查询组织名称 + * @Date 2020/4/20 21:45 + **/ + Result> getStaffOrgList(StaffOrgFormDTO staffOrgsFormDTO); } \ No newline at end of file diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerAgencyServiceImpl.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerAgencyServiceImpl.java index fa513326e4..2a2b79a024 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerAgencyServiceImpl.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerAgencyServiceImpl.java @@ -20,11 +20,14 @@ package com.epmet.service.impl; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; +import com.epmet.commons.tools.constant.FieldConstant; import com.epmet.commons.tools.page.PageData; import com.epmet.commons.tools.utils.ConvertUtils; -import com.epmet.commons.tools.constant.FieldConstant; +import com.epmet.commons.tools.utils.Result; import com.epmet.dao.CustomerAgencyDao; import com.epmet.dto.CustomerAgencyDTO; +import com.epmet.dto.form.StaffOrgFormDTO; +import com.epmet.dto.result.StaffOrgsResultDTO; import com.epmet.entity.CustomerAgencyEntity; import com.epmet.redis.CustomerAgencyRedis; import com.epmet.service.CustomerAgencyService; @@ -101,4 +104,12 @@ public class CustomerAgencyServiceImpl extends BaseServiceImpl> getStaffOrgList(StaffOrgFormDTO staffOrgsFormDTO) { + if (null == staffOrgsFormDTO || staffOrgsFormDTO.getCustomerIdList().size() == 0) { + return new Result<>(); + } + List list = baseDao.selectStaffOrgList(staffOrgsFormDTO.getCustomerIdList()); + return new Result>().ok(list); + } } \ No newline at end of file diff --git a/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerAgencyDao.xml b/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerAgencyDao.xml index 18bb63b7b9..03f2671806 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerAgencyDao.xml +++ b/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerAgencyDao.xml @@ -21,5 +21,20 @@ - + + \ 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 1a8958a306..3478b0fbba 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 @@ -8,6 +8,7 @@ select * from customer_staff cs where cs.MOBILE=#{mobile} and cs.DEL_FLAG='1' + order by cs.ACTIVE_TIME desc,cs.CREATED_TIME asc From aa2c0d1ab76fd874fae0fa70ac03cda29a8a5b98 Mon Sep 17 00:00:00 2001 From: yinzuomei <576302893@qq.com> Date: Mon, 20 Apr 2020 23:06:26 +0800 Subject: [PATCH 05/85] =?UTF-8?q?=E5=88=A0=E9=99=A4staff=5Flogin=5Fhistory?= =?UTF-8?q?=EF=BC=8C=E6=94=B9=E4=B8=BAstaff=5Fagency=5Fhistory?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/epmet/feign/EpmetUserFeignClient.java | 10 ++-- .../EpmetUserFeignClientFallback.java | 6 +- .../service/impl/GovLoginServiceImpl.java | 58 +++++++++--------- .../controller/CustomerGridController.java | 6 +- .../java/com/epmet/dao/CustomerGridDao.java | 6 +- .../epmet/service/CustomerGridService.java | 6 +- .../service/impl/CustomerGridServiceImpl.java | 16 ++--- .../main/resources/mapper/CustomerGridDao.xml | 2 +- ...ava => StaffLoginAgencyRecordFormDTO.java} | 2 +- ...O.java => StaffLatestAgencyResultDTO.java} | 7 +-- ...java => StaffAgencyHistoryController.java} | 23 +++---- ...oryDao.java => StaffAgencyHistoryDao.java} | 13 ++-- ...ce.java => StaffAgencyHistoryService.java} | 33 +++++----- ...ava => StaffAgencyHistoryServiceImpl.java} | 60 +++++++++---------- 14 files changed, 121 insertions(+), 127 deletions(-) rename epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/{StaffLoginHistoryFormDTO.java => StaffLoginAgencyRecordFormDTO.java} (89%) rename epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/{LatestStaffWechatLoginResultDTO.java => StaffLatestAgencyResultDTO.java} (80%) rename epmet-user/epmet-user-server/src/main/java/com/epmet/controller/{StaffLoginHistoryController.java => StaffAgencyHistoryController.java} (68%) rename epmet-user/epmet-user-server/src/main/java/com/epmet/dao/{StaffLoginHistoryDao.java => StaffAgencyHistoryDao.java} (78%) rename epmet-user/epmet-user-server/src/main/java/com/epmet/service/{StaffLoginHistoryService.java => StaffAgencyHistoryService.java} (71%) rename epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/{StaffLoginHistoryServiceImpl.java => StaffAgencyHistoryServiceImpl.java} (54%) diff --git a/epmet-auth/src/main/java/com/epmet/feign/EpmetUserFeignClient.java b/epmet-auth/src/main/java/com/epmet/feign/EpmetUserFeignClient.java index d62c41b2c4..d0a61aa757 100644 --- a/epmet-auth/src/main/java/com/epmet/feign/EpmetUserFeignClient.java +++ b/epmet-auth/src/main/java/com/epmet/feign/EpmetUserFeignClient.java @@ -6,8 +6,8 @@ import com.epmet.dto.CustomerStaffDTO; import com.epmet.dto.UserDTO; import com.epmet.dto.UserWechatDTO; import com.epmet.dto.form.*; -import com.epmet.dto.result.LatestStaffWechatLoginResultDTO; import com.epmet.dto.result.PasswordLoginUserInfoResultDTO; +import com.epmet.dto.result.StaffLatestAgencyResultDTO; import com.epmet.feign.fallback.EpmetUserFeignClientFallback; import org.springframework.cloud.openfeign.FeignClient; import org.springframework.http.MediaType; @@ -85,8 +85,8 @@ public interface EpmetUserFeignClient { * @Description 获取当前微信上次登录的账号信息 * @Date 2020/4/20 12:53 **/ - @GetMapping(value = "epmetuser/staffloginhistory/getlatest/{openId}") - Result getLatestStaffWechatLoginRecord(@PathVariable("openId") String openId); + @GetMapping(value = "epmetuser/staffagencyhistory/getlatest/{openId}") + Result getLatestStaffWechatLoginRecord(@PathVariable("openId") String openId); /** * @param customerStaffFormDTO @@ -105,6 +105,6 @@ public interface EpmetUserFeignClient { * @Description 保存登录日志 * @Date 2020/4/20 14:38 **/ - @PostMapping(value = "epmetuser/staffloginhistory/saveStaffLoginRecord", consumes = MediaType.APPLICATION_JSON_VALUE) - Result saveStaffLoginRecord(StaffLoginHistoryFormDTO staffLoginHistoryFormDTO); + @PostMapping(value = "epmetuser/staffagencyhistory/saveStaffLoginRecord", consumes = MediaType.APPLICATION_JSON_VALUE) + Result saveStaffLoginRecord(StaffLoginAgencyRecordFormDTO staffLoginHistoryFormDTO); } diff --git a/epmet-auth/src/main/java/com/epmet/feign/fallback/EpmetUserFeignClientFallback.java b/epmet-auth/src/main/java/com/epmet/feign/fallback/EpmetUserFeignClientFallback.java index 571785b43f..b08fcbca1a 100644 --- a/epmet-auth/src/main/java/com/epmet/feign/fallback/EpmetUserFeignClientFallback.java +++ b/epmet-auth/src/main/java/com/epmet/feign/fallback/EpmetUserFeignClientFallback.java @@ -7,8 +7,8 @@ import com.epmet.dto.CustomerStaffDTO; import com.epmet.dto.UserDTO; import com.epmet.dto.UserWechatDTO; import com.epmet.dto.form.*; -import com.epmet.dto.result.LatestStaffWechatLoginResultDTO; import com.epmet.dto.result.PasswordLoginUserInfoResultDTO; +import com.epmet.dto.result.StaffLatestAgencyResultDTO; import com.epmet.feign.EpmetUserFeignClient; import org.springframework.stereotype.Component; @@ -48,7 +48,7 @@ public class EpmetUserFeignClientFallback implements EpmetUserFeignClient { } @Override - public Result getLatestStaffWechatLoginRecord(String openId) { + public Result getLatestStaffWechatLoginRecord(String openId) { return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "getLatestStaffWechatLoginRecord", openId); } @@ -58,7 +58,7 @@ public class EpmetUserFeignClientFallback implements EpmetUserFeignClient { } @Override - public Result saveStaffLoginRecord(StaffLoginHistoryFormDTO staffLoginHistoryFormDTO) { + public Result saveStaffLoginRecord(StaffLoginAgencyRecordFormDTO staffLoginHistoryFormDTO) { return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "saveStaffLoginRecord", staffLoginHistoryFormDTO); } diff --git a/epmet-auth/src/main/java/com/epmet/service/impl/GovLoginServiceImpl.java b/epmet-auth/src/main/java/com/epmet/service/impl/GovLoginServiceImpl.java index 5f6480ef2c..d8ebf53c1e 100644 --- a/epmet-auth/src/main/java/com/epmet/service/impl/GovLoginServiceImpl.java +++ b/epmet-auth/src/main/java/com/epmet/service/impl/GovLoginServiceImpl.java @@ -122,57 +122,55 @@ public class GovLoginServiceImpl implements GovLoginService { public Result loginByWxCode(GovWxmpFormDTO formDTO) { //1、解析微信用户 WxMaJscode2SessionResult wxMaJscode2SessionResult = loginService.getWxMaUser(formDTO.getApp(), formDTO.getWxCode()); - Result latestStaffWechat = epmetUserFeignClient.getLatestStaffWechatLoginRecord(wxMaJscode2SessionResult.getOpenid()); + Result latestStaffWechat = epmetUserFeignClient.getLatestStaffWechatLoginRecord(wxMaJscode2SessionResult.getOpenid()); if (!latestStaffWechat.success() || null == latestStaffWechat.getData()) { logger.error(String.format("没有获取到用户最近一次登录账户信息,code[%s],msg[%s]", EpmetErrorCode.PLEASE_LOGIN.getCode(), EpmetErrorCode.PLEASE_LOGIN.getMsg())); return new Result().error(EpmetErrorCode.PLEASE_LOGIN.getCode()); } - LatestStaffWechatLoginResultDTO latestStaffWechatLoginDTO = latestStaffWechat.getData(); + StaffLatestAgencyResultDTO staffLatestAgencyResultDTO = latestStaffWechat.getData(); //2、记录staff_wechat - this.savestaffwechat(latestStaffWechatLoginDTO.getStaffId(), wxMaJscode2SessionResult.getOpenid()); + this.savestaffwechat(staffLatestAgencyResultDTO.getStaffId(), wxMaJscode2SessionResult.getOpenid()); //3、记录登录日志 - this.saveStaffLoginRecord(latestStaffWechatLoginDTO); + this.saveStaffLoginRecord(staffLatestAgencyResultDTO); //4、获取用户token - String token = this.generateGovWxmpToken(latestStaffWechatLoginDTO.getStaffId()); + String token = this.generateGovWxmpToken(staffLatestAgencyResultDTO.getStaffId()); //5、保存到redis - this.saveLatestGovTokenDto(latestStaffWechatLoginDTO, wxMaJscode2SessionResult, token); + this.saveLatestGovTokenDto(staffLatestAgencyResultDTO, wxMaJscode2SessionResult, token); UserTokenResultDTO userTokenResultDTO = new UserTokenResultDTO(); userTokenResultDTO.setToken(token); return new Result().ok(userTokenResultDTO); } //保存tokenDto到redis - private void saveLatestGovTokenDto(LatestStaffWechatLoginResultDTO latestStaffWechatLoginDTO, + private void saveLatestGovTokenDto(StaffLatestAgencyResultDTO staffLatestAgency, WxMaJscode2SessionResult wxMaJscode2SessionResult, String token) { int expire = jwtTokenProperties.getExpire(); GovTokenDto govTokenDto = new GovTokenDto(); govTokenDto.setApp(LoginConstant.APP_GOV); govTokenDto.setClient(LoginConstant.CLIENT_WXMP); - govTokenDto.setStaffId(latestStaffWechatLoginDTO.getStaffId()); + govTokenDto.setStaffId(staffLatestAgency.getStaffId()); govTokenDto.setOpenId(wxMaJscode2SessionResult.getOpenid()); govTokenDto.setSessionKey(wxMaJscode2SessionResult.getSessionKey()); govTokenDto.setUnionId(wxMaJscode2SessionResult.getUnionid()); govTokenDto.setToken(token); govTokenDto.setUpdateTime(System.currentTimeMillis()); govTokenDto.setExpireTime(jwtTokenUtils.getExpiration(token).getTime()); - govTokenDto.setOrgId(latestStaffWechatLoginDTO.getOrgId()); - govTokenDto.setGridId(latestStaffWechatLoginDTO.getGridId()); - govTokenDto.setCustomerId(latestStaffWechatLoginDTO.getCustomerId()); + govTokenDto.setOrgId(staffLatestAgency.getOrgId()); + govTokenDto.setCustomerId(staffLatestAgency.getCustomerId()); cpUserDetailRedis.set(govTokenDto, expire); logger.info("截止时间:" + DateUtils.format(jwtTokenUtils.getExpiration(token), "yyyy-MM-dd HH:mm:ss")); } //保存登录日志 - private Result saveStaffLoginRecord(LatestStaffWechatLoginResultDTO latestStaffWechatLoginDTO) { - StaffLoginHistoryFormDTO staffLoginHistoryFormDTO = new StaffLoginHistoryFormDTO(); - staffLoginHistoryFormDTO.setCustomerId(latestStaffWechatLoginDTO.getCustomerId()); - staffLoginHistoryFormDTO.setStaffId(latestStaffWechatLoginDTO.getStaffId()); - staffLoginHistoryFormDTO.setWxOpenId(latestStaffWechatLoginDTO.getWxOpenId()); - staffLoginHistoryFormDTO.setMobile(latestStaffWechatLoginDTO.getMobile()); - staffLoginHistoryFormDTO.setOrgId(latestStaffWechatLoginDTO.getOrgId()); - staffLoginHistoryFormDTO.setGridId(latestStaffWechatLoginDTO.getGridId()); - Result staffLoginRecordResult = epmetUserFeignClient.saveStaffLoginRecord(staffLoginHistoryFormDTO); + private Result saveStaffLoginRecord(StaffLatestAgencyResultDTO latestStaffWechatLoginDTO) { + StaffLoginAgencyRecordFormDTO staffLoginAgencyRecordFormDTO = new StaffLoginAgencyRecordFormDTO(); + staffLoginAgencyRecordFormDTO.setCustomerId(latestStaffWechatLoginDTO.getCustomerId()); + staffLoginAgencyRecordFormDTO.setStaffId(latestStaffWechatLoginDTO.getStaffId()); + staffLoginAgencyRecordFormDTO.setWxOpenId(latestStaffWechatLoginDTO.getWxOpenId()); + staffLoginAgencyRecordFormDTO.setMobile(latestStaffWechatLoginDTO.getMobile()); + staffLoginAgencyRecordFormDTO.setOrgId(latestStaffWechatLoginDTO.getOrgId()); + Result staffLoginRecordResult = epmetUserFeignClient.saveStaffLoginRecord(staffLoginAgencyRecordFormDTO); return staffLoginRecordResult; } @@ -199,7 +197,7 @@ public class GovLoginServiceImpl implements GovLoginService { //1、获取用户token String token = this.generateGovWxmpToken(customerStaff.getUserId()); //2、保存到redis - this.saveGovTokenDto(formDTO.getOrgId(), formDTO.getCustomerId(), latestGridInfo.getGridId(), customerStaff.getUserId(), wxMaJscode2SessionResult, token); + this.saveGovTokenDto(formDTO.getOrgId(), formDTO.getCustomerId(), customerStaff.getUserId(), wxMaJscode2SessionResult, token); UserTokenResultDTO userTokenResultDTO = new UserTokenResultDTO(); userTokenResultDTO.setToken(token); return new Result().ok(userTokenResultDTO); @@ -220,14 +218,14 @@ public class GovLoginServiceImpl implements GovLoginService { //保存登录日志 private Result saveStaffLoginRecord(GovWxmpEnteOrgFormDTO formDTO, String staffId, String openId, String grid) { - StaffLoginHistoryFormDTO staffLoginHistoryFormDTO = new StaffLoginHistoryFormDTO(); - staffLoginHistoryFormDTO.setCustomerId(formDTO.getCustomerId()); - staffLoginHistoryFormDTO.setStaffId(staffId); - staffLoginHistoryFormDTO.setWxOpenId(openId); - staffLoginHistoryFormDTO.setMobile(formDTO.getMobile()); - staffLoginHistoryFormDTO.setOrgId(formDTO.getOrgId()); - staffLoginHistoryFormDTO.setGridId(grid); - Result staffLoginRecordResult = epmetUserFeignClient.saveStaffLoginRecord(staffLoginHistoryFormDTO); + StaffLoginAgencyRecordFormDTO staffLoginAgencyRecordFormDTO = new StaffLoginAgencyRecordFormDTO(); + staffLoginAgencyRecordFormDTO.setCustomerId(formDTO.getCustomerId()); + staffLoginAgencyRecordFormDTO.setStaffId(staffId); + staffLoginAgencyRecordFormDTO.setWxOpenId(openId); + staffLoginAgencyRecordFormDTO.setMobile(formDTO.getMobile()); + staffLoginAgencyRecordFormDTO.setOrgId(formDTO.getOrgId()); + staffLoginAgencyRecordFormDTO.setGridId(grid); + Result staffLoginRecordResult = epmetUserFeignClient.saveStaffLoginRecord(staffLoginAgencyRecordFormDTO); return staffLoginRecordResult; } @@ -267,7 +265,6 @@ public class GovLoginServiceImpl implements GovLoginService { **/ private void saveGovTokenDto(String orgId, String customerId, - String gridId, String staffId, WxMaJscode2SessionResult wxMaJscode2SessionResult, String token) { @@ -283,7 +280,6 @@ public class GovLoginServiceImpl implements GovLoginService { govTokenDto.setUpdateTime(System.currentTimeMillis()); govTokenDto.setExpireTime(jwtTokenUtils.getExpiration(token).getTime()); govTokenDto.setOrgId(orgId); - govTokenDto.setGridId(gridId); govTokenDto.setCustomerId(customerId); cpUserDetailRedis.set(govTokenDto, expire); logger.info("截止时间:" + DateUtils.format(jwtTokenUtils.getExpiration(token), "yyyy-MM-dd HH:mm:ss")); diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/CustomerGridController.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/CustomerGridController.java index 8163a30c15..b9c8f8672f 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/CustomerGridController.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/CustomerGridController.java @@ -28,9 +28,9 @@ import com.epmet.commons.tools.validator.group.UpdateGroup; import com.epmet.dto.CustomerGridDTO; import com.epmet.dto.form.CustomerGridFormDTO; import com.epmet.dto.form.ListCustomerGridFormDTO; -import com.epmet.dto.form.StaffGridInfoFormDTO; +import com.epmet.dto.form.StaffLatestLoginGridFormDTO; import com.epmet.dto.result.CustomerGridForStrangerResultDTO; -import com.epmet.dto.result.StaffGridInfoResultDTO; +import com.epmet.dto.result.StaffLatestLoginGridResultDTO; import com.epmet.excel.CustomerGridExcel; import com.epmet.service.CustomerGridService; import org.springframework.beans.factory.annotation.Autowired; @@ -135,7 +135,7 @@ public class CustomerGridController { * @Date 2020/4/20 15:34 **/ @PostMapping(value = "getStaffGridInfo") - public Result> getStaffGridInfo(@RequestBody StaffGridInfoFormDTO staffGridInfoFormDTO) { + public Result getStaffGridInfo(@RequestBody StaffLatestLoginGridFormDTO staffGridInfoFormDTO) { ValidatorUtils.validateEntity(staffGridInfoFormDTO); return customerGridService.listStaffGridInfo(staffGridInfoFormDTO); } 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 b42077b396..d8c308ec90 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 @@ -21,9 +21,9 @@ import com.epmet.commons.mybatis.dao.BaseDao; import com.epmet.dto.CustomerGridDTO; import com.epmet.dto.form.CustomerGridFormDTO; import com.epmet.dto.form.ListCustomerGridFormDTO; -import com.epmet.dto.form.StaffGridInfoFormDTO; +import com.epmet.dto.form.StaffLatestLoginGridFormDTO; import com.epmet.dto.result.CustomerGridForStrangerResultDTO; -import com.epmet.dto.result.StaffGridInfoResultDTO; +import com.epmet.dto.result.StaffLatestLoginGridResultDTO; import com.epmet.entity.CustomerGridEntity; import org.apache.ibatis.annotations.Mapper; @@ -70,5 +70,5 @@ public interface CustomerGridDao extends BaseDao { * @Description 查询工作人员绑定的网格列表 * @Date 2020/4/20 15:36 **/ - List selectListStaffGridInfo(StaffGridInfoFormDTO staffGridInfoFormDTO); + List selectListStaffGridInfo(StaffLatestLoginGridFormDTO staffGridInfoFormDTO); } \ 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 d8728c39dd..7b48c8724d 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 @@ -23,9 +23,9 @@ import com.epmet.commons.tools.utils.Result; import com.epmet.dto.CustomerGridDTO; import com.epmet.dto.form.CustomerGridFormDTO; import com.epmet.dto.form.ListCustomerGridFormDTO; -import com.epmet.dto.form.StaffGridInfoFormDTO; +import com.epmet.dto.form.StaffLatestLoginGridFormDTO; import com.epmet.dto.result.CustomerGridForStrangerResultDTO; -import com.epmet.dto.result.StaffGridInfoResultDTO; +import com.epmet.dto.result.StaffLatestLoginGridResultDTO; import com.epmet.entity.CustomerGridEntity; import java.util.List; @@ -123,5 +123,5 @@ public interface CustomerGridService extends BaseService { * @Description 根据用户选择的组织,查询用户与网格的关系列表 * @Date 2020/4/20 15:35 **/ - Result> listStaffGridInfo(StaffGridInfoFormDTO staffGridInfoFormDTO); + Result listStaffGridInfo(StaffLatestLoginGridFormDTO staffGridInfoFormDTO); } \ 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 d4e61df8b1..b27f57019f 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 @@ -20,19 +20,18 @@ package com.epmet.service.impl; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; +import com.epmet.commons.tools.constant.FieldConstant; import com.epmet.commons.tools.page.PageData; import com.epmet.commons.tools.utils.ConvertUtils; -import com.epmet.commons.tools.constant.FieldConstant; import com.epmet.commons.tools.utils.Result; import com.epmet.dao.CustomerGridDao; import com.epmet.dto.CustomerGridDTO; import com.epmet.dto.form.CustomerGridFormDTO; import com.epmet.dto.form.ListCustomerGridFormDTO; -import com.epmet.dto.form.StaffGridInfoFormDTO; +import com.epmet.dto.form.StaffLatestLoginGridFormDTO; import com.epmet.dto.result.CustomerGridForStrangerResultDTO; -import com.epmet.dto.result.StaffGridInfoResultDTO; +import com.epmet.dto.result.StaffLatestLoginGridResultDTO; import com.epmet.entity.CustomerGridEntity; - import com.epmet.redis.CustomerGridRedis; import com.epmet.service.CustomerGridService; import com.epmet.util.ModuleConstant; @@ -155,9 +154,12 @@ public class CustomerGridServiceImpl extends BaseServiceImpl> listStaffGridInfo(StaffGridInfoFormDTO staffGridInfoFormDTO) { - List list = baseDao.selectListStaffGridInfo(staffGridInfoFormDTO); - return new Result>().ok(list); + public Result listStaffGridInfo(StaffLatestLoginGridFormDTO staffGridInfoFormDTO) { + List list = baseDao.selectListStaffGridInfo(staffGridInfoFormDTO); + if(null!=list&&list.size()>0){ + return new Result().ok(list.get(0)); + } + return new Result<>(); } } 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 6ea3950fb8..5fa9468faa 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 @@ -94,7 +94,7 @@ - SELECT csg.GRID_ID, cg.CUSTOMER_ID, diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/StaffLoginHistoryFormDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/StaffLoginAgencyRecordFormDTO.java similarity index 89% rename from epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/StaffLoginHistoryFormDTO.java rename to epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/StaffLoginAgencyRecordFormDTO.java index 14a205d032..c4fe580a11 100644 --- a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/StaffLoginHistoryFormDTO.java +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/StaffLoginAgencyRecordFormDTO.java @@ -10,7 +10,7 @@ import java.io.Serializable; * @Date 2020/4/20 14:26 */ @Data -public class StaffLoginHistoryFormDTO implements Serializable { +public class StaffLoginAgencyRecordFormDTO implements Serializable { /** * 客户ID */ diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/LatestStaffWechatLoginResultDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/StaffLatestAgencyResultDTO.java similarity index 80% rename from epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/LatestStaffWechatLoginResultDTO.java rename to epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/StaffLatestAgencyResultDTO.java index 5ad4ebde86..4b006dd8e6 100644 --- a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/LatestStaffWechatLoginResultDTO.java +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/StaffLatestAgencyResultDTO.java @@ -10,7 +10,7 @@ import java.io.Serializable; * @Date 2020/4/20 12:23 */ @Data -public class LatestStaffWechatLoginResultDTO implements Serializable { +public class StaffLatestAgencyResultDTO implements Serializable { private static final long serialVersionUID = -7088774184276785902L; /** @@ -37,10 +37,5 @@ public class LatestStaffWechatLoginResultDTO implements Serializable { * 组织机构id */ private String orgId; - - /** - * 网格表Id (CUSTOMER_GRID.id) - */ - private String gridId; } diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/StaffLoginHistoryController.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/StaffAgencyHistoryController.java similarity index 68% rename from epmet-user/epmet-user-server/src/main/java/com/epmet/controller/StaffLoginHistoryController.java rename to epmet-user/epmet-user-server/src/main/java/com/epmet/controller/StaffAgencyHistoryController.java index 08c8e02c94..aa1a81426f 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/StaffLoginHistoryController.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/StaffAgencyHistoryController.java @@ -18,25 +18,26 @@ package com.epmet.controller; import com.epmet.commons.tools.utils.Result; -import com.epmet.dto.form.StaffLoginHistoryFormDTO; -import com.epmet.dto.result.LatestStaffWechatLoginResultDTO; -import com.epmet.service.StaffLoginHistoryService; +import com.epmet.dto.form.StaffLoginAgencyRecordFormDTO; +import com.epmet.dto.result.StaffLatestAgencyResultDTO; +import com.epmet.service.StaffAgencyHistoryService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; /** - * 工作人员登录日志表 + * 工作人员登录组织日志表 * * @author generator generator@elink-cn.com * @since v1.0.0 2020-04-20 */ @RestController -@RequestMapping("staffloginhistory") -public class StaffLoginHistoryController { +@RequestMapping("staffagencyhistory") +public class StaffAgencyHistoryController { @Autowired - private StaffLoginHistoryService staffLoginHistoryService; + private StaffAgencyHistoryService staffAgencyHistoryService; + /** * @param openId @@ -46,8 +47,8 @@ public class StaffLoginHistoryController { * @Date 2020/4/20 12:42 **/ @GetMapping(value = "getlatest/{openId}") - public Result getLatestStaffWechatLoginRecord(@PathVariable("openId") String openId) { - return staffLoginHistoryService.getLatestStaffWechatLoginRecord(openId); + public Result getLatestStaffWechatLoginRecord(@PathVariable("openId") String openId) { + return staffAgencyHistoryService.getLatestStaffWechatLoginRecord(openId); } /** @@ -58,7 +59,7 @@ public class StaffLoginHistoryController { * @Date 2020/4/20 14:29 **/ @PostMapping(value = "saveStaffLoginRecord") - public Result saveStaffLoginRecord(@RequestBody StaffLoginHistoryFormDTO formDTO) { - return staffLoginHistoryService.saveStaffLoginRecord(formDTO); + public Result saveStaffLoginRecord(@RequestBody StaffLoginAgencyRecordFormDTO formDTO) { + return staffAgencyHistoryService.saveStaffLoginRecord(formDTO); } } \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/StaffLoginHistoryDao.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/StaffAgencyHistoryDao.java similarity index 78% rename from epmet-user/epmet-user-server/src/main/java/com/epmet/dao/StaffLoginHistoryDao.java rename to epmet-user/epmet-user-server/src/main/java/com/epmet/dao/StaffAgencyHistoryDao.java index 1458be2a28..0e6739ad58 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/StaffLoginHistoryDao.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/StaffAgencyHistoryDao.java @@ -18,25 +18,24 @@ package com.epmet.dao; import com.epmet.commons.mybatis.dao.BaseDao; -import com.epmet.dto.result.LatestStaffWechatLoginResultDTO; -import com.epmet.entity.StaffLoginHistoryEntity; +import com.epmet.dto.result.StaffLatestAgencyResultDTO; +import com.epmet.entity.StaffAgencyHistoryEntity; import org.apache.ibatis.annotations.Mapper; /** - * 工作人员登录日志表 + * 工作人员登录组织日志表 * * @author generator generator@elink-cn.com * @since v1.0.0 2020-04-20 */ @Mapper -public interface StaffLoginHistoryDao extends BaseDao { - +public interface StaffAgencyHistoryDao extends BaseDao { /** - * @return com.epmet.dto.result.LatestStaffWechatLoginDTO * @param openId + * @return com.epmet.dto.result.LatestStaffWechatLoginDTO * @Author yinzuomei * @Description 获取当前微信上次登录的账号信息 * @Date 2020/4/20 12:45 **/ - LatestStaffWechatLoginResultDTO selectLatestStaffWechatLoginRecord(String openId); + StaffLatestAgencyResultDTO selectLatestStaffWechatLoginRecord(String openId); } \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/StaffLoginHistoryService.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/StaffAgencyHistoryService.java similarity index 71% rename from epmet-user/epmet-user-server/src/main/java/com/epmet/service/StaffLoginHistoryService.java rename to epmet-user/epmet-user-server/src/main/java/com/epmet/service/StaffAgencyHistoryService.java index fab2c9f20e..413c555f7d 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/StaffLoginHistoryService.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/StaffAgencyHistoryService.java @@ -20,51 +20,51 @@ 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.StaffLoginHistoryDTO; -import com.epmet.dto.form.StaffLoginHistoryFormDTO; -import com.epmet.dto.result.LatestStaffWechatLoginResultDTO; -import com.epmet.entity.StaffLoginHistoryEntity; +import com.epmet.dto.StaffAgencyHistoryDTO; +import com.epmet.dto.form.StaffLoginAgencyRecordFormDTO; +import com.epmet.dto.result.StaffLatestAgencyResultDTO; +import com.epmet.entity.StaffAgencyHistoryEntity; import java.util.List; import java.util.Map; /** - * 工作人员登录日志表 + * 工作人员登录组织日志表 * * @author generator generator@elink-cn.com * @since v1.0.0 2020-04-20 */ -public interface StaffLoginHistoryService extends BaseService { +public interface StaffAgencyHistoryService extends BaseService { /** * 默认分页 * * @param params - * @return PageData + * @return PageData * @author generator * @date 2020-04-20 */ - PageData page(Map params); + PageData page(Map params); /** * 默认查询 * * @param params - * @return java.util.List + * @return java.util.List * @author generator * @date 2020-04-20 */ - List list(Map params); + List list(Map params); /** * 单条查询 * * @param id - * @return StaffLoginHistoryDTO + * @return StaffAgencyHistoryDTO * @author generator * @date 2020-04-20 */ - StaffLoginHistoryDTO get(String id); + StaffAgencyHistoryDTO get(String id); /** * 默认保存 @@ -74,7 +74,7 @@ public interface StaffLoginHistoryService extends BaseService @@ -103,7 +104,7 @@ public interface StaffLoginHistoryService extends BaseService getLatestStaffWechatLoginRecord(String openId); + Result getLatestStaffWechatLoginRecord(String openId); /** * @param formDTO @@ -112,5 +113,5 @@ public interface StaffLoginHistoryService extends BaseService implements StaffLoginHistoryService { - private static final Logger logger = LoggerFactory.getLogger(StaffLoginHistoryServiceImpl.class); +public class StaffAgencyHistoryServiceImpl extends BaseServiceImpl implements StaffAgencyHistoryService { + private static final Logger logger = LoggerFactory.getLogger(StaffAgencyHistoryServiceImpl.class); + @Override - public PageData page(Map params) { - IPage page = baseDao.selectPage( + public PageData page(Map params) { + IPage page = baseDao.selectPage( getPage(params, FieldConstant.CREATED_TIME, false), getWrapper(params) ); - return getPageData(page, StaffLoginHistoryDTO.class); + return getPageData(page, StaffAgencyHistoryDTO.class); } @Override - public List list(Map params) { - List entityList = baseDao.selectList(getWrapper(params)); + public List list(Map params) { + List entityList = baseDao.selectList(getWrapper(params)); - return ConvertUtils.sourceToTarget(entityList, StaffLoginHistoryDTO.class); + return ConvertUtils.sourceToTarget(entityList, StaffAgencyHistoryDTO.class); } - private QueryWrapper getWrapper(Map params){ + private QueryWrapper getWrapper(Map params){ String id = (String)params.get(FieldConstant.ID_HUMP); - QueryWrapper wrapper = new QueryWrapper<>(); + QueryWrapper wrapper = new QueryWrapper<>(); wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id); return wrapper; } @Override - public StaffLoginHistoryDTO get(String id) { - StaffLoginHistoryEntity entity = baseDao.selectById(id); - return ConvertUtils.sourceToTarget(entity, StaffLoginHistoryDTO.class); + public StaffAgencyHistoryDTO get(String id) { + StaffAgencyHistoryEntity entity = baseDao.selectById(id); + return ConvertUtils.sourceToTarget(entity, StaffAgencyHistoryDTO.class); } @Override @Transactional(rollbackFor = Exception.class) - public void save(StaffLoginHistoryDTO dto) { - StaffLoginHistoryEntity entity = ConvertUtils.sourceToTarget(dto, StaffLoginHistoryEntity.class); + public void save(StaffAgencyHistoryDTO dto) { + StaffAgencyHistoryEntity entity = ConvertUtils.sourceToTarget(dto, StaffAgencyHistoryEntity.class); insert(entity); } @Override @Transactional(rollbackFor = Exception.class) - public void update(StaffLoginHistoryDTO dto) { - StaffLoginHistoryEntity entity = ConvertUtils.sourceToTarget(dto, StaffLoginHistoryEntity.class); + public void update(StaffAgencyHistoryDTO dto) { + StaffAgencyHistoryEntity entity = ConvertUtils.sourceToTarget(dto, StaffAgencyHistoryEntity.class); updateById(entity); } @@ -102,20 +103,19 @@ public class StaffLoginHistoryServiceImpl extends BaseServiceImpl getLatestStaffWechatLoginRecord(String openId) { + public Result getLatestStaffWechatLoginRecord(String openId) { if (StringUtils.isNotBlank(openId)) { logger.error("openId 不能为空"); return new Result(); } - LatestStaffWechatLoginResultDTO latestStaffWechatLoginDTO = baseDao.selectLatestStaffWechatLoginRecord(openId); - return new Result().ok(latestStaffWechatLoginDTO); + StaffLatestAgencyResultDTO latestStaffWechatLoginDTO = baseDao.selectLatestStaffWechatLoginRecord(openId); + return new Result().ok(latestStaffWechatLoginDTO); } @Override - public Result saveStaffLoginRecord(StaffLoginHistoryFormDTO formDTO) { - StaffLoginHistoryEntity entity = ConvertUtils.sourceToTarget(formDTO, StaffLoginHistoryEntity.class); + public Result saveStaffLoginRecord(StaffLoginAgencyRecordFormDTO formDTO) { + StaffAgencyHistoryEntity entity = ConvertUtils.sourceToTarget(formDTO, StaffAgencyHistoryEntity.class); insert(entity); return new Result(); } - } \ No newline at end of file From b05fb2a12bb06b3a6b74394ff9e8a06cd8284183 Mon Sep 17 00:00:00 2001 From: yinzuomei <576302893@qq.com> Date: Mon, 20 Apr 2020 23:07:26 +0800 Subject: [PATCH 06/85] =?UTF-8?q?=E5=88=A0=E9=99=A4staff=5Flogin=5Fhistory?= =?UTF-8?q?=EF=BC=8C=E6=94=B9=E4=B8=BAstaff=5Fagency=5Fhistory?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...oryDTO.java => StaffAgencyHistoryDTO.java} | 9 ++---- ...ity.java => StaffAgencyHistoryEntity.java} | 14 ++++------ ...storyDao.xml => StaffAgencyHistoryDao.xml} | 28 +++++++++---------- 3 files changed, 21 insertions(+), 30 deletions(-) rename epmet-user/epmet-user-client/src/main/java/com/epmet/dto/{StaffLoginHistoryDTO.java => StaffAgencyHistoryDTO.java} (91%) rename epmet-user/epmet-user-server/src/main/java/com/epmet/entity/{StaffLoginHistoryEntity.java => StaffAgencyHistoryEntity.java} (87%) rename epmet-user/epmet-user-server/src/main/resources/mapper/{StaffLoginHistoryDao.xml => StaffAgencyHistoryDao.xml} (64%) diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/StaffLoginHistoryDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/StaffAgencyHistoryDTO.java similarity index 91% rename from epmet-user/epmet-user-client/src/main/java/com/epmet/dto/StaffLoginHistoryDTO.java rename to epmet-user/epmet-user-client/src/main/java/com/epmet/dto/StaffAgencyHistoryDTO.java index 6d1674936f..21b6eb47b6 100644 --- a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/StaffLoginHistoryDTO.java +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/StaffAgencyHistoryDTO.java @@ -24,13 +24,13 @@ import java.util.Date; /** - * 工作人员登录日志表 + * 工作人员登录组织日志表 * * @author generator generator@elink-cn.com * @since v1.0.0 2020-04-20 */ @Data -public class StaffLoginHistoryDTO implements Serializable { +public class StaffAgencyHistoryDTO implements Serializable { private static final long serialVersionUID = 1L; @@ -64,11 +64,6 @@ public class StaffLoginHistoryDTO implements Serializable { */ private String orgId; - /** - * 网格表Id (CUSTOMER_GRID.id) - */ - private String gridId; - /** * 删除标识:0.未删除 1.已删除 */ diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/StaffLoginHistoryEntity.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/StaffAgencyHistoryEntity.java similarity index 87% rename from epmet-user/epmet-user-server/src/main/java/com/epmet/entity/StaffLoginHistoryEntity.java rename to epmet-user/epmet-user-server/src/main/java/com/epmet/entity/StaffAgencyHistoryEntity.java index 9a9377ecfe..618bcba59f 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/StaffLoginHistoryEntity.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/StaffAgencyHistoryEntity.java @@ -18,20 +18,23 @@ package com.epmet.entity; import com.baomidou.mybatisplus.annotation.TableName; + import com.epmet.commons.mybatis.entity.BaseEpmetEntity; import lombok.Data; import lombok.EqualsAndHashCode; +import java.util.Date; + /** - * 工作人员登录日志表 + * 工作人员登录组织日志表 * * @author generator generator@elink-cn.com * @since v1.0.0 2020-04-20 */ @Data @EqualsAndHashCode(callSuper=false) -@TableName("staff_login_history") -public class StaffLoginHistoryEntity extends BaseEpmetEntity { +@TableName("staff_agency_history") +public class StaffAgencyHistoryEntity extends BaseEpmetEntity { private static final long serialVersionUID = 1L; @@ -60,9 +63,4 @@ public class StaffLoginHistoryEntity extends BaseEpmetEntity { */ private String orgId; - /** - * 网格表Id (CUSTOMER_GRID.id) - */ - private String gridId; - } diff --git a/epmet-user/epmet-user-server/src/main/resources/mapper/StaffLoginHistoryDao.xml b/epmet-user/epmet-user-server/src/main/resources/mapper/StaffAgencyHistoryDao.xml similarity index 64% rename from epmet-user/epmet-user-server/src/main/resources/mapper/StaffLoginHistoryDao.xml rename to epmet-user/epmet-user-server/src/main/resources/mapper/StaffAgencyHistoryDao.xml index 4f382bfa10..a9ce119bff 100644 --- a/epmet-user/epmet-user-server/src/main/resources/mapper/StaffLoginHistoryDao.xml +++ b/epmet-user/epmet-user-server/src/main/resources/mapper/StaffAgencyHistoryDao.xml @@ -1,16 +1,15 @@ - + - + - @@ -18,23 +17,22 @@ + - SELECT - slh.CUSTOMER_ID, - slh.STAFF_ID, - slh.WX_OPEN_ID, - slh.MOBILE, - slh.ORG_ID, - slh.GRID_ID + sah.CUSTOMER_ID, + sah.STAFF_ID, + sah.WX_OPEN_ID, + sah.MOBILE, + sah.ORG_ID FROM - staff_login_history slh + staff_agency_history sah WHERE - slh.DEL_FLAG = '0' - AND slh.WX_OPEN_ID =#{openId} + sah.DEL_FLAG = '0' + AND sah.WX_OPEN_ID =#{openId} ORDER BY - slh.CREATED_TIME DESC + sah.CREATED_TIME DESC LIMIT 1 - \ No newline at end of file From 0919eb7a454b85c830c362b5f06faf451184b3d7 Mon Sep 17 00:00:00 2001 From: yinzuomei <576302893@qq.com> Date: Mon, 20 Apr 2020 23:16:33 +0800 Subject: [PATCH 07/85] =?UTF-8?q?/loginwxmp/getmyorg=E6=8E=A5=E5=8F=A3?= =?UTF-8?q?=E5=BC=80=E5=8F=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/epmet/feign/GovOrgFeignClient.java | 12 ------ .../fallback/GovOrgFeignClientFallback.java | 6 --- .../service/impl/GovLoginServiceImpl.java | 20 +--------- .../dto/form/StaffLatestLoginGridFormDTO.java | 33 ---------------- .../result/StaffLatestLoginGridResultDTO.java | 39 ------------------- .../controller/CustomerGridController.java | 14 ------- .../java/com/epmet/dao/CustomerGridDao.java | 10 ----- .../epmet/service/CustomerGridService.java | 10 ----- .../service/impl/CustomerGridServiceImpl.java | 11 ------ .../main/resources/mapper/CustomerGridDao.xml | 19 --------- .../form/StaffLoginAgencyRecordFormDTO.java | 4 -- 11 files changed, 2 insertions(+), 176 deletions(-) delete mode 100644 epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/StaffLatestLoginGridFormDTO.java delete mode 100644 epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/StaffLatestLoginGridResultDTO.java diff --git a/epmet-auth/src/main/java/com/epmet/feign/GovOrgFeignClient.java b/epmet-auth/src/main/java/com/epmet/feign/GovOrgFeignClient.java index f284da98ab..527db417ef 100644 --- a/epmet-auth/src/main/java/com/epmet/feign/GovOrgFeignClient.java +++ b/epmet-auth/src/main/java/com/epmet/feign/GovOrgFeignClient.java @@ -2,9 +2,7 @@ package com.epmet.feign; import com.epmet.commons.tools.constant.ServiceConstant; import com.epmet.commons.tools.utils.Result; -import com.epmet.dto.form.StaffLatestLoginGridFormDTO; import com.epmet.dto.form.StaffOrgFormDTO; -import com.epmet.dto.result.StaffLatestLoginGridResultDTO; import com.epmet.dto.result.StaffOrgsResultDTO; import com.epmet.feign.fallback.GovOrgFeignClientFallback; import org.springframework.cloud.openfeign.FeignClient; @@ -20,16 +18,6 @@ import java.util.List; */ @FeignClient(name = ServiceConstant.GOV_ORG_SERVER, fallback = GovOrgFeignClientFallback.class) public interface GovOrgFeignClient { - /** - * @return com.epmet.commons.tools.utils.Result> - * @param staffGridInfoFormDTO - * @Author yinzuomei - * @Description - * @Date 2020/4/20 21:36 - **/ - @PostMapping(value = "gov/org/customergrid/getStaffGridInfo",consumes = MediaType.APPLICATION_JSON_VALUE) - Result getStaffLatestLoginGrid(StaffLatestLoginGridFormDTO staffGridInfoFormDTO); - /** * @return com.epmet.commons.tools.utils.Result> * @param staffOrgFormDTO diff --git a/epmet-auth/src/main/java/com/epmet/feign/fallback/GovOrgFeignClientFallback.java b/epmet-auth/src/main/java/com/epmet/feign/fallback/GovOrgFeignClientFallback.java index 6121363dfd..a1ccd0bdf0 100644 --- a/epmet-auth/src/main/java/com/epmet/feign/fallback/GovOrgFeignClientFallback.java +++ b/epmet-auth/src/main/java/com/epmet/feign/fallback/GovOrgFeignClientFallback.java @@ -3,9 +3,7 @@ package com.epmet.feign.fallback; import com.epmet.commons.tools.constant.ServiceConstant; import com.epmet.commons.tools.utils.ModuleUtils; import com.epmet.commons.tools.utils.Result; -import com.epmet.dto.form.StaffLatestLoginGridFormDTO; import com.epmet.dto.form.StaffOrgFormDTO; -import com.epmet.dto.result.StaffLatestLoginGridResultDTO; import com.epmet.dto.result.StaffOrgsResultDTO; import com.epmet.feign.GovOrgFeignClient; import org.springframework.stereotype.Component; @@ -19,10 +17,6 @@ import java.util.List; */ @Component public class GovOrgFeignClientFallback implements GovOrgFeignClient { - @Override - public Result getStaffLatestLoginGrid(StaffLatestLoginGridFormDTO staffLatestLoginGridFormDTO) { - return ModuleUtils.feignConError(ServiceConstant.GOV_ORG_SERVER, "getStaffLatestLoginGrid", staffLatestLoginGridFormDTO); - } @Override public Result> getStaffOrgList(StaffOrgFormDTO staffOrgFormDTO) { diff --git a/epmet-auth/src/main/java/com/epmet/service/impl/GovLoginServiceImpl.java b/epmet-auth/src/main/java/com/epmet/service/impl/GovLoginServiceImpl.java index d8ebf53c1e..6ceb130e79 100644 --- a/epmet-auth/src/main/java/com/epmet/service/impl/GovLoginServiceImpl.java +++ b/epmet-auth/src/main/java/com/epmet/service/impl/GovLoginServiceImpl.java @@ -190,10 +190,8 @@ public class GovLoginServiceImpl implements GovLoginService { WxMaJscode2SessionResult wxMaJscode2SessionResult = loginService.getWxMaUser(LoginConstant.APP_GOV, formDTO.getWxCode()); //3、记录staff_wechat this.savestaffwechat(customerStaff.getUserId(), wxMaJscode2SessionResult.getOpenid()); - //4、查询用户绑定的网格 - StaffLatestLoginGridResultDTO latestGridInfo = this.getLatestGridInfo(formDTO, customerStaff.getUserId()); //5、记录登录日志 - this.saveStaffLoginRecord(formDTO, customerStaff.getUserId(), wxMaJscode2SessionResult.getOpenid(), latestGridInfo.getGridId()); + this.saveStaffLoginRecord(formDTO, customerStaff.getUserId(), wxMaJscode2SessionResult.getOpenid()); //1、获取用户token String token = this.generateGovWxmpToken(customerStaff.getUserId()); //2、保存到redis @@ -203,28 +201,14 @@ public class GovLoginServiceImpl implements GovLoginService { return new Result().ok(userTokenResultDTO); } - //查询用户绑定的网格 - private StaffLatestLoginGridResultDTO getLatestGridInfo(GovWxmpEnteOrgFormDTO formDTO, String userId) { - StaffLatestLoginGridFormDTO staffGridInfoFormDTO = new StaffLatestLoginGridFormDTO(); - staffGridInfoFormDTO.setCustomerId(formDTO.getCustomerId()); - staffGridInfoFormDTO.setOrgId(formDTO.getOrgId()); - staffGridInfoFormDTO.setStaffId(userId); - Result staffGridInfoListResult = govOrgFeignClient.getStaffLatestLoginGrid(staffGridInfoFormDTO); - if (staffGridInfoListResult.success() && null != staffGridInfoListResult.getData()) { - return staffGridInfoListResult.getData(); - } - return new StaffLatestLoginGridResultDTO(); - } - //保存登录日志 - private Result saveStaffLoginRecord(GovWxmpEnteOrgFormDTO formDTO, String staffId, String openId, String grid) { + private Result saveStaffLoginRecord(GovWxmpEnteOrgFormDTO formDTO, String staffId, String openId) { StaffLoginAgencyRecordFormDTO staffLoginAgencyRecordFormDTO = new StaffLoginAgencyRecordFormDTO(); staffLoginAgencyRecordFormDTO.setCustomerId(formDTO.getCustomerId()); staffLoginAgencyRecordFormDTO.setStaffId(staffId); staffLoginAgencyRecordFormDTO.setWxOpenId(openId); staffLoginAgencyRecordFormDTO.setMobile(formDTO.getMobile()); staffLoginAgencyRecordFormDTO.setOrgId(formDTO.getOrgId()); - staffLoginAgencyRecordFormDTO.setGridId(grid); Result staffLoginRecordResult = epmetUserFeignClient.saveStaffLoginRecord(staffLoginAgencyRecordFormDTO); return staffLoginRecordResult; } diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/StaffLatestLoginGridFormDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/StaffLatestLoginGridFormDTO.java deleted file mode 100644 index f07e657f73..0000000000 --- a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/StaffLatestLoginGridFormDTO.java +++ /dev/null @@ -1,33 +0,0 @@ -package com.epmet.dto.form; - -import lombok.Data; - -import javax.validation.constraints.NotBlank; -import java.io.Serializable; - -/** - * @Description 根据用户选择的组织,查询用户与网格的关系列表 - * @Author yinzuomei - * @Date 2020/4/20 15:29 - */ -@Data -public class StaffLatestLoginGridFormDTO implements Serializable { - /** - * 用户选择的组织所属的id - */ - @NotBlank(message = "客户id不能为空") - private String customerId; - - /** - * 用户选择的要进入的组织(根组织id) - */ - @NotBlank(message = "组织id不能为空") - private String orgId; - - /** - * 工作人员id - */ - @NotBlank(message = "staffId不能为空") - private String staffId; -} - diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/StaffLatestLoginGridResultDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/StaffLatestLoginGridResultDTO.java deleted file mode 100644 index 4c067bdbe2..0000000000 --- a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/StaffLatestLoginGridResultDTO.java +++ /dev/null @@ -1,39 +0,0 @@ -package com.epmet.dto.result; - -import lombok.Data; - -import java.io.Serializable; - -/** - * @Description 根据用户选择的组织,查询用户与网格的关系列表 - * @Author yinzuomei - * @Date 2020/4/20 15:22 - */ -@Data -public class StaffLatestLoginGridResultDTO implements Serializable { - /** - * ID 唯一标识 - */ - private String gridId; - - /** - * 客户ID - */ - private String customerId; - - /** - * 网格名称 - */ - private String gridName; - - /** - * 所属组织机构ID(customer_organization.id) - */ - private String pid; - - /** - * 所有上级组织ID - */ - private String pids; -} - diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/CustomerGridController.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/CustomerGridController.java index b9c8f8672f..2599fa67e3 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/CustomerGridController.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/CustomerGridController.java @@ -28,9 +28,7 @@ import com.epmet.commons.tools.validator.group.UpdateGroup; import com.epmet.dto.CustomerGridDTO; import com.epmet.dto.form.CustomerGridFormDTO; import com.epmet.dto.form.ListCustomerGridFormDTO; -import com.epmet.dto.form.StaffLatestLoginGridFormDTO; import com.epmet.dto.result.CustomerGridForStrangerResultDTO; -import com.epmet.dto.result.StaffLatestLoginGridResultDTO; import com.epmet.excel.CustomerGridExcel; import com.epmet.service.CustomerGridService; import org.springframework.beans.factory.annotation.Autowired; @@ -127,16 +125,4 @@ public class CustomerGridController { return new Result().ok(data); } - /** - * @param staffGridInfoFormDTO - * @return com.epmet.commons.tools.utils.Result> - * @Author yinzuomei - * @Description 根据用户选择的组织,查询用户与网格的关系列表 - * @Date 2020/4/20 15:34 - **/ - @PostMapping(value = "getStaffGridInfo") - public Result getStaffGridInfo(@RequestBody StaffLatestLoginGridFormDTO staffGridInfoFormDTO) { - ValidatorUtils.validateEntity(staffGridInfoFormDTO); - return customerGridService.listStaffGridInfo(staffGridInfoFormDTO); - } } 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 d8c308ec90..a8113682c4 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 @@ -21,9 +21,7 @@ import com.epmet.commons.mybatis.dao.BaseDao; import com.epmet.dto.CustomerGridDTO; import com.epmet.dto.form.CustomerGridFormDTO; import com.epmet.dto.form.ListCustomerGridFormDTO; -import com.epmet.dto.form.StaffLatestLoginGridFormDTO; import com.epmet.dto.result.CustomerGridForStrangerResultDTO; -import com.epmet.dto.result.StaffLatestLoginGridResultDTO; import com.epmet.entity.CustomerGridEntity; import org.apache.ibatis.annotations.Mapper; @@ -63,12 +61,4 @@ public interface CustomerGridDao extends BaseDao { CustomerGridDTO getCustomerGridByGridId(CustomerGridFormDTO customerGridFormDTO); - /** - * @param staffGridInfoFormDTO - * @return java.util.List - * @Author yinzuomei - * @Description 查询工作人员绑定的网格列表 - * @Date 2020/4/20 15:36 - **/ - List selectListStaffGridInfo(StaffLatestLoginGridFormDTO staffGridInfoFormDTO); } \ 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 7b48c8724d..cf24460d88 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 @@ -23,9 +23,7 @@ import com.epmet.commons.tools.utils.Result; import com.epmet.dto.CustomerGridDTO; import com.epmet.dto.form.CustomerGridFormDTO; import com.epmet.dto.form.ListCustomerGridFormDTO; -import com.epmet.dto.form.StaffLatestLoginGridFormDTO; import com.epmet.dto.result.CustomerGridForStrangerResultDTO; -import com.epmet.dto.result.StaffLatestLoginGridResultDTO; import com.epmet.entity.CustomerGridEntity; import java.util.List; @@ -116,12 +114,4 @@ public interface CustomerGridService extends BaseService { */ Result getCustomerGridByGridId(CustomerGridFormDTO customerGridFormDTO); - /** - * @param staffGridInfoFormDTO - * @return com.epmet.commons.tools.utils.Result> - * @Author yinzuomei - * @Description 根据用户选择的组织,查询用户与网格的关系列表 - * @Date 2020/4/20 15:35 - **/ - Result listStaffGridInfo(StaffLatestLoginGridFormDTO staffGridInfoFormDTO); } \ 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 b27f57019f..86cb83f0c2 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,9 +28,7 @@ import com.epmet.dao.CustomerGridDao; import com.epmet.dto.CustomerGridDTO; import com.epmet.dto.form.CustomerGridFormDTO; import com.epmet.dto.form.ListCustomerGridFormDTO; -import com.epmet.dto.form.StaffLatestLoginGridFormDTO; import com.epmet.dto.result.CustomerGridForStrangerResultDTO; -import com.epmet.dto.result.StaffLatestLoginGridResultDTO; import com.epmet.entity.CustomerGridEntity; import com.epmet.redis.CustomerGridRedis; import com.epmet.service.CustomerGridService; @@ -151,15 +149,6 @@ public class CustomerGridServiceImpl extends BaseServiceImpl getCustomerGridByGridId(CustomerGridFormDTO customerGridFormDTO) { return new Result().ok(baseDao.getCustomerGridByGridId(customerGridFormDTO)); -} - - @Override - public Result listStaffGridInfo(StaffLatestLoginGridFormDTO staffGridInfoFormDTO) { - List list = baseDao.selectListStaffGridInfo(staffGridInfoFormDTO); - if(null!=list&&list.size()>0){ - return new Result().ok(list.get(0)); - } - return new Result<>(); } } 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 5fa9468faa..a2421ac708 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 @@ -93,23 +93,4 @@ - - \ No newline at end of file diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/StaffLoginAgencyRecordFormDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/StaffLoginAgencyRecordFormDTO.java index c4fe580a11..ad67aba726 100644 --- a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/StaffLoginAgencyRecordFormDTO.java +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/StaffLoginAgencyRecordFormDTO.java @@ -36,9 +36,5 @@ public class StaffLoginAgencyRecordFormDTO implements Serializable { */ private String orgId; - /** - * 网格表Id (CUSTOMER_GRID.id) - */ - private String gridId; } From 106382199c575afb1a062f0d6fd1752ffc74e1ff Mon Sep 17 00:00:00 2001 From: yinzuomei <576302893@qq.com> Date: Mon, 20 Apr 2020 23:18:28 +0800 Subject: [PATCH 08/85] =?UTF-8?q?=E5=88=A0=E9=99=A4staff=5Flogin=5Fhistory?= =?UTF-8?q?=E8=A1=A8=EF=BC=8C=E5=88=9B=E5=BB=BAstaff=5Fagency=5Fhistory?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../resources/db/migration/epmet_user.sql | 20 ++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/epmet-user/epmet-user-server/src/main/resources/db/migration/epmet_user.sql b/epmet-user/epmet-user-server/src/main/resources/db/migration/epmet_user.sql index e09dd173a2..90e2427edd 100644 --- a/epmet-user/epmet-user-server/src/main/resources/db/migration/epmet_user.sql +++ b/epmet-user/epmet-user-server/src/main/resources/db/migration/epmet_user.sql @@ -53,4 +53,22 @@ CREATE TABLE `staff_login_history` ( `UPDATED_BY` varchar(32) DEFAULT NULL COMMENT '更新人', `UPDATED_TIME` datetime DEFAULT NULL COMMENT '更新时间', PRIMARY KEY (`ID`) USING BTREE -) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=COMPACT COMMENT='工作人员登录日志表'; \ No newline at end of file +) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=COMPACT COMMENT='工作人员登录日志表'; + +drop table if EXISTS staff_login_history; + +CREATE TABLE `staff_agency_history` ( + `ID` varchar(64) NOT NULL COMMENT '唯一标识', + `CUSTOMER_ID` varchar(64) NOT NULL COMMENT '客户ID', + `STAFF_ID` varchar(64) NOT NULL COMMENT 'customer_staff.userId', + `WX_OPEN_ID` varchar(64) NOT NULL COMMENT '微信openId', + `MOBILE` varchar(20) NOT NULL COMMENT '手机号', + `ORG_ID` varchar(64) NOT NULL COMMENT '组织机构id', + `DEL_FLAG` int(11) NOT NULL COMMENT '删除标识:0.未删除 1.已删除', + `REVISION` int(11) NOT NULL COMMENT '乐观锁', + `CREATED_BY` varchar(32) NOT NULL COMMENT '创建人', + `CREATED_TIME` datetime NOT NULL COMMENT '创建时间,登录时间', + `UPDATED_BY` varchar(32) DEFAULT NULL COMMENT '更新人', + `UPDATED_TIME` datetime DEFAULT NULL COMMENT '更新时间', + PRIMARY KEY (`ID`) USING BTREE +) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=COMPACT COMMENT='工作人员登录组织日志表'; \ No newline at end of file From e51b747bc21300e64dd368fa91b75db94a6aa715 Mon Sep 17 00:00:00 2001 From: wxz Date: Tue, 21 Apr 2020 13:30:51 +0800 Subject: [PATCH 09/85] =?UTF-8?q?1.=E6=96=B0=E5=A2=9Egov-access=E6=A8=A1?= =?UTF-8?q?=E5=9D=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../gov-access/gov-access-client/pom.xml | 16 ++ .../gov-access/gov-access-server/pom.xml | 182 ++++++++++++++++++ .../java/com/epmet/GovAccessApplication.java | 20 ++ .../com/epmet/config/ModuleConfigImpl.java | 26 +++ .../src/main/resources/bootstrap.yml | 103 ++++++++++ .../src/main/resources/logback-spring.xml | 159 +++++++++++++++ epmet-module/gov-access/pom.xml | 21 ++ epmet-module/pom.xml | 3 +- 8 files changed, 529 insertions(+), 1 deletion(-) create mode 100644 epmet-module/gov-access/gov-access-client/pom.xml create mode 100644 epmet-module/gov-access/gov-access-server/pom.xml create mode 100644 epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/GovAccessApplication.java create mode 100644 epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/config/ModuleConfigImpl.java create mode 100644 epmet-module/gov-access/gov-access-server/src/main/resources/bootstrap.yml create mode 100644 epmet-module/gov-access/gov-access-server/src/main/resources/logback-spring.xml create mode 100644 epmet-module/gov-access/pom.xml diff --git a/epmet-module/gov-access/gov-access-client/pom.xml b/epmet-module/gov-access/gov-access-client/pom.xml new file mode 100644 index 0000000000..ad7c7ab019 --- /dev/null +++ b/epmet-module/gov-access/gov-access-client/pom.xml @@ -0,0 +1,16 @@ + + + 0.3.0 + + gov-access + com.epmet + 0.3.0 + + 4.0.0 + + gov-access-client + + + \ No newline at end of file diff --git a/epmet-module/gov-access/gov-access-server/pom.xml b/epmet-module/gov-access/gov-access-server/pom.xml new file mode 100644 index 0000000000..31695bd331 --- /dev/null +++ b/epmet-module/gov-access/gov-access-server/pom.xml @@ -0,0 +1,182 @@ + + + 0.3.0 + + gov-access + com.epmet + 0.3.0 + + 4.0.0 + + gov-access-server + jar + + + + com.epmet + gov-access-client + 0.3.0 + + + com.epmet + epmet-commons-tools + 2.0.0 + + + com.epmet + epmet-commons-mybatis + 2.0.0 + + + org.springframework.boot + spring-boot-starter-web + + + org.springframework + spring-context-support + + + org.springframework.boot + spring-boot-starter-actuator + + + de.codecentric + spring-boot-admin-starter-client + ${spring.boot.admin.version} + + + com.alibaba.cloud + spring-cloud-starter-alibaba-nacos-discovery + + + com.alibaba.cloud + spring-cloud-starter-alibaba-nacos-config + + + + io.github.openfeign + feign-httpclient + 10.3.0 + + + + + ${project.artifactId} + + + org.springframework.boot + spring-boot-maven-plugin + + + org.apache.maven.plugins + maven-surefire-plugin + + true + + + + ${project.basedir}/src/main/java + + + true + ${basedir}/src/main/resources + + + + + + + dev-local + + true + + + 8097 + dev + + + + + + epmet_gov_access_user + EpmEt-db-UsEr + + 0 + 192.168.1.130 + 6379 + 123456 + + false + 122.152.200.70:8848 + fcd6fc8f-ca3a-4b01-8026-2b05cdc5976b + + + false + + + + + dev + + + 8093 + dev + + + + + + epmet + elink@833066 + + 0 + r-m5eoz5b6tkx09y6bpz.redis.rds.aliyuncs.com + 6379 + EpmEtrEdIs!q@w + + true + 192.168.10.150:8848 + 67e3c350-533e-4d7c-9f8f-faf1b4aa82ae + + + false + + + + + test + + + 8093 + test + + + + + + epmet + elink@833066 + + 0 + 10.10.10.248 + 6379 + 123456 + + true + 122.152.200.70:8848 + fcd6fc8f-ca3a-4b01-8026-2b05cdc5976b + + + false + + + + + + \ No newline at end of file diff --git a/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/GovAccessApplication.java b/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/GovAccessApplication.java new file mode 100644 index 0000000000..f4781aa923 --- /dev/null +++ b/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/GovAccessApplication.java @@ -0,0 +1,20 @@ +package com.epmet; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.cloud.client.discovery.EnableDiscoveryClient; +import org.springframework.cloud.openfeign.EnableFeignClients; + +/** + * + * @author Mark sunlightcs@gmail.com + * @since 1.0.0 + */ +@SpringBootApplication +@EnableDiscoveryClient +@EnableFeignClients +public class GovAccessApplication { + public static void main(String[] args) { + SpringApplication.run(GovAccessApplication.class, args); + } +} diff --git a/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/config/ModuleConfigImpl.java b/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/config/ModuleConfigImpl.java new file mode 100644 index 0000000000..128f1060ef --- /dev/null +++ b/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/config/ModuleConfigImpl.java @@ -0,0 +1,26 @@ +/** + * Copyright (c) 2018 人人开源 All rights reserved. + *

+ * https://www.renren.io + *

+ * 版权所有,侵权必究! + */ + +package com.epmet.config; + +import com.epmet.commons.tools.config.ModuleConfig; +import org.springframework.stereotype.Service; + +/** + * 模块配置信息-新闻公告模块 + * + * @author Mark sunlightcs@gmail.com + * @since 1.0.0 + */ +@Service +public class ModuleConfigImpl implements ModuleConfig { + @Override + public String getName() { + return "govaccess"; + } +} diff --git a/epmet-module/gov-access/gov-access-server/src/main/resources/bootstrap.yml b/epmet-module/gov-access/gov-access-server/src/main/resources/bootstrap.yml new file mode 100644 index 0000000000..cf118b769a --- /dev/null +++ b/epmet-module/gov-access/gov-access-server/src/main/resources/bootstrap.yml @@ -0,0 +1,103 @@ +server: + port: @server.port@ + servlet: + context-path: /gov/access + +spring: + main: + allow-bean-definition-overriding: true + application: + name: gov-access-server + #环境 dev|test|prod + profiles: + active: dev + jackson: + time-zone: GMT+8 + date-format: yyyy-MM-dd HH:mm:ss + redis: + database: @spring.redis.index@ + host: @spring.redis.host@ + port: @spring.redis.port@ + password: @spring.redis.password@ + timeout: 30s + datasource: + druid: + #MySQL + driver-class-name: com.mysql.cj.jdbc.Driver + url: @spring.datasource.druid.url@ + username: @spring.datasource.druid.username@ + password: @spring.datasource.druid.password@ + cloud: + nacos: + discovery: + server-addr: @nacos.server-addr@ + #nacos的命名空间ID,默认是public + namespace: @nacos.discovery.namespace@ + #不把自己注册到注册中心的地址 + register-enabled: @nacos.register-enabled@ + ip: @nacos.ip@ + config: + enabled: @nacos.config-enabled@ + server-addr: @nacos.server-addr@ + namespace: @nacos.config.namespace@ + group: @nacos.config.group@ + file-extension: yaml + #指定共享配置,且支持动态刷新 +# ext-config: +# - data-id: datasource.yaml +# group: ${spring.cloud.nacos.config.group} +# refresh: true +# - data-id: common.yaml +# group: ${spring.cloud.nacos.config.group} +# refresh: true +management: + endpoints: + web: + exposure: + include: "*" + endpoint: + health: + show-details: ALWAYS + +mybatis-plus: + mapper-locations: classpath:/mapper/**/*.xml + #实体扫描,多个package用逗号或者分号分隔 + typeAliasesPackage: com.epmet.entity + global-config: + #数据库相关配置 + db-config: + #主键类型 AUTO:"数据库ID自增", INPUT:"用户输入ID", ID_WORKER:"全局唯一ID (数字类型唯一ID)", UUID:"全局唯一ID UUID"; + id-type: ID_WORKER + #字段策略 IGNORED:"忽略判断",NOT_NULL:"非 NULL 判断"),NOT_EMPTY:"非空判断" + field-strategy: NOT_NULL + #驼峰下划线转换 + column-underline: true + banner: false + #原生配置 + configuration: + map-underscore-to-camel-case: true + cache-enabled: false + call-setters-on-nulls: true + jdbc-type-for-null: 'null' + +feign: + hystrix: + enabled: true + client: + config: + default: + loggerLevel: BASIC + httpclient: + enabled: true + +hystrix: + command: + default: + execution: + isolation: + thread: + timeoutInMilliseconds: 60000 #缺省为1000 + +ribbon: + ReadTimeout: 300000 + ConnectTimeout: 300000 diff --git a/epmet-module/gov-access/gov-access-server/src/main/resources/logback-spring.xml b/epmet-module/gov-access/gov-access-server/src/main/resources/logback-spring.xml new file mode 100644 index 0000000000..86fc4a6979 --- /dev/null +++ b/epmet-module/gov-access/gov-access-server/src/main/resources/logback-spring.xml @@ -0,0 +1,159 @@ + + + + + + + + + + + + + + debug + + + ${CONSOLE_LOG_PATTERN} + + UTF-8 + + + + + + + + ${log.path}/debug.log + + + %d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n + UTF-8 + + + + + ${log.path}/debug-%d{yyyy-MM-dd}.%i.log + + 100MB + + + 15 + + + + debug + ACCEPT + DENY + + + + + + + ${log.path}/info.log + + + %d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n + UTF-8 + + + + + ${log.path}/info-%d{yyyy-MM-dd}.%i.log + + 100MB + + + 15 + + + + info + ACCEPT + DENY + + + + + + + ${log.path}/warn.log + + + %d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n + UTF-8 + + + + ${log.path}/warn-%d{yyyy-MM-dd}.%i.log + + 100MB + + + 15 + + + + warn + ACCEPT + DENY + + + + + + + ${log.path}/error.log + + + %d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n + UTF-8 + + + + ${log.path}/error-%d{yyyy-MM-dd}.%i.log + + 100MB + + + 15 + + + + ERROR + ACCEPT + DENY + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/epmet-module/gov-access/pom.xml b/epmet-module/gov-access/pom.xml new file mode 100644 index 0000000000..3c5ac0d7dd --- /dev/null +++ b/epmet-module/gov-access/pom.xml @@ -0,0 +1,21 @@ + + + + epmet-module + com.epmet + 2.0.0 + + 4.0.0 + + gov-access + pom + 0.3.0 + + gov-access-client + gov-access-server + + + + \ No newline at end of file diff --git a/epmet-module/pom.xml b/epmet-module/pom.xml index f48d428c3e..d4fc0c7ae2 100644 --- a/epmet-module/pom.xml +++ b/epmet-module/pom.xml @@ -27,6 +27,7 @@ resi-mine resi-group resi-partymember - + gov-access + From 0b50a182f313d6112923a759254b5eff770a9513 Mon Sep 17 00:00:00 2001 From: wxz Date: Tue, 21 Apr 2020 13:35:52 +0800 Subject: [PATCH 10/85] =?UTF-8?q?1.CustomerDepartment=E4=B8=AD=E7=9A=84?= =?UTF-8?q?=E5=AD=97=E6=AE=B5org=5Fid=E6=94=B9=E4=B8=BAagency=5Fid?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/com/epmet/entity/CustomerDepartmentEntity.java | 4 ++-- .../src/main/resources/mapper/CustomerDepartmentDao.xml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/entity/CustomerDepartmentEntity.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/entity/CustomerDepartmentEntity.java index b34f814bc1..70771bee51 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/entity/CustomerDepartmentEntity.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/entity/CustomerDepartmentEntity.java @@ -44,9 +44,9 @@ public class CustomerDepartmentEntity extends BaseEpmetEntity { private String customerId; /** - * 所属组织机构ID(customer_organization.id) + * 所属组织机构ID(customer_agency.id) */ - private String orgId; + private String agencyId; /** * 部门名称 diff --git a/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerDepartmentDao.xml b/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerDepartmentDao.xml index 9f595da2fe..7543fe31f6 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerDepartmentDao.xml +++ b/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerDepartmentDao.xml @@ -6,7 +6,7 @@ - + From c80183c7cdd7b78ae5cf9486653361faf6a3662c Mon Sep 17 00:00:00 2001 From: yinzuomei <576302893@qq.com> Date: Tue, 21 Apr 2020 16:10:17 +0800 Subject: [PATCH 11/85] =?UTF-8?q?=E6=9A=82=E5=AD=981?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/epmet/feign/EpmetUserFeignClient.java | 4 +- .../service/impl/GovLoginServiceImpl.java | 4 +- .../src/main/resources/application.yml | 6 +- .../com/epmet/dto/CustomerDepartmentDTO.java | 7 +- .../entity/CustomerDepartmentEntity.java | 5 +- .../resources/db/migration/epmet_gov_org.sql | 34 +++---- ...oryDTO.java => StaffAgencyVisitedDTO.java} | 13 ++- .../com/epmet/dto/StaffGridVisitedDTO.java | 86 ++++++++++++++++ ...java => StaffAgencyVisitedController.java} | 17 ++-- .../StaffGridVisitedController.java | 39 ++++++++ ...oryDao.java => StaffAgencyVisitedDao.java} | 8 +- .../com/epmet/dao/StaffGridVisitedDao.java | 33 +++++++ ...ity.java => StaffAgencyVisitedEntity.java} | 12 +-- .../epmet/entity/StaffGridVisitedEntity.java | 56 +++++++++++ ...ce.java => StaffAgencyVisitedService.java} | 39 ++++---- .../service/StaffGridVisitedService.java | 95 ++++++++++++++++++ .../service/UserResiRegisterVisitService.java | 2 - ...ava => StaffAgencyVisitedServiceImpl.java} | 48 ++++----- .../impl/StaffGridVisitedServiceImpl.java | 99 +++++++++++++++++++ .../resources/db/migration/epmet_user.sql | 20 +++- ...storyDao.xml => StaffAgencyVisitedDao.xml} | 6 +- .../resources/mapper/StaffGridVisitedDao.xml | 20 ++++ 22 files changed, 544 insertions(+), 109 deletions(-) rename epmet-user/epmet-user-client/src/main/java/com/epmet/dto/{StaffAgencyHistoryDTO.java => StaffAgencyVisitedDTO.java} (89%) create mode 100644 epmet-user/epmet-user-client/src/main/java/com/epmet/dto/StaffGridVisitedDTO.java rename epmet-user/epmet-user-server/src/main/java/com/epmet/controller/{StaffAgencyHistoryController.java => StaffAgencyVisitedController.java} (82%) create mode 100644 epmet-user/epmet-user-server/src/main/java/com/epmet/controller/StaffGridVisitedController.java rename epmet-user/epmet-user-server/src/main/java/com/epmet/dao/{StaffAgencyHistoryDao.java => StaffAgencyVisitedDao.java} (86%) create mode 100644 epmet-user/epmet-user-server/src/main/java/com/epmet/dao/StaffGridVisitedDao.java rename epmet-user/epmet-user-server/src/main/java/com/epmet/entity/{StaffAgencyHistoryEntity.java => StaffAgencyVisitedEntity.java} (85%) create mode 100644 epmet-user/epmet-user-server/src/main/java/com/epmet/entity/StaffGridVisitedEntity.java rename epmet-user/epmet-user-server/src/main/java/com/epmet/service/{StaffAgencyHistoryService.java => StaffAgencyVisitedService.java} (74%) create mode 100644 epmet-user/epmet-user-server/src/main/java/com/epmet/service/StaffGridVisitedService.java rename epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/{StaffAgencyHistoryServiceImpl.java => StaffAgencyVisitedServiceImpl.java} (67%) create mode 100644 epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/StaffGridVisitedServiceImpl.java rename epmet-user/epmet-user-server/src/main/resources/mapper/{StaffAgencyHistoryDao.xml => StaffAgencyVisitedDao.xml} (86%) create mode 100644 epmet-user/epmet-user-server/src/main/resources/mapper/StaffGridVisitedDao.xml diff --git a/epmet-auth/src/main/java/com/epmet/feign/EpmetUserFeignClient.java b/epmet-auth/src/main/java/com/epmet/feign/EpmetUserFeignClient.java index d0a61aa757..6bebb97f96 100644 --- a/epmet-auth/src/main/java/com/epmet/feign/EpmetUserFeignClient.java +++ b/epmet-auth/src/main/java/com/epmet/feign/EpmetUserFeignClient.java @@ -85,7 +85,7 @@ public interface EpmetUserFeignClient { * @Description 获取当前微信上次登录的账号信息 * @Date 2020/4/20 12:53 **/ - @GetMapping(value = "epmetuser/staffagencyhistory/getlatest/{openId}") + @GetMapping(value = "epmetuser/staffagencyvisited/getlatest/{openId}") Result getLatestStaffWechatLoginRecord(@PathVariable("openId") String openId); /** @@ -105,6 +105,6 @@ public interface EpmetUserFeignClient { * @Description 保存登录日志 * @Date 2020/4/20 14:38 **/ - @PostMapping(value = "epmetuser/staffagencyhistory/saveStaffLoginRecord", consumes = MediaType.APPLICATION_JSON_VALUE) + @PostMapping(value = "epmetuser/staffagencyvisited/saveStaffLoginRecord", consumes = MediaType.APPLICATION_JSON_VALUE) Result saveStaffLoginRecord(StaffLoginAgencyRecordFormDTO staffLoginHistoryFormDTO); } diff --git a/epmet-auth/src/main/java/com/epmet/service/impl/GovLoginServiceImpl.java b/epmet-auth/src/main/java/com/epmet/service/impl/GovLoginServiceImpl.java index 6ceb130e79..85c6991c39 100644 --- a/epmet-auth/src/main/java/com/epmet/service/impl/GovLoginServiceImpl.java +++ b/epmet-auth/src/main/java/com/epmet/service/impl/GovLoginServiceImpl.java @@ -149,7 +149,7 @@ public class GovLoginServiceImpl implements GovLoginService { GovTokenDto govTokenDto = new GovTokenDto(); govTokenDto.setApp(LoginConstant.APP_GOV); govTokenDto.setClient(LoginConstant.CLIENT_WXMP); - govTokenDto.setStaffId(staffLatestAgency.getStaffId()); + govTokenDto.setUserId(staffLatestAgency.getStaffId()); govTokenDto.setOpenId(wxMaJscode2SessionResult.getOpenid()); govTokenDto.setSessionKey(wxMaJscode2SessionResult.getSessionKey()); govTokenDto.setUnionId(wxMaJscode2SessionResult.getUnionid()); @@ -256,7 +256,7 @@ public class GovLoginServiceImpl implements GovLoginService { GovTokenDto govTokenDto = new GovTokenDto(); govTokenDto.setApp(LoginConstant.APP_GOV); govTokenDto.setClient(LoginConstant.CLIENT_WXMP); - govTokenDto.setStaffId(staffId); + govTokenDto.setUserId(staffId); govTokenDto.setOpenId(wxMaJscode2SessionResult.getOpenid()); govTokenDto.setSessionKey(wxMaJscode2SessionResult.getSessionKey()); govTokenDto.setUnionId(wxMaJscode2SessionResult.getUnionid()); diff --git a/epmet-cloud-generator/src/main/resources/application.yml b/epmet-cloud-generator/src/main/resources/application.yml index ec95859518..f759f036b9 100644 --- a/epmet-cloud-generator/src/main/resources/application.yml +++ b/epmet-cloud-generator/src/main/resources/application.yml @@ -9,9 +9,9 @@ spring: type: com.alibaba.druid.pool.DruidDataSource #MySQL配置 driverClassName: com.mysql.jdbc.Driver - url: jdbc:mysql://localhost:3306/epmet_user?useUnicode=true&characterEncoding=UTF-8&useSSL=false - username: epmet - password: elink@833066 + url: jdbc:mysql://192.168.1.130:3306/epmet_user?useUnicode=true&characterEncoding=UTF-8&useSSL=false + username: epmet_dba + password: EpmEt-dbA-UsEr #oracle配置 # driverClassName: oracle.jdbc.OracleDriver # url: jdbc:oracle:thin:@192.168.10.10:1521:helowin diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/CustomerDepartmentDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/CustomerDepartmentDTO.java index 0248ff77e2..3c97da56b3 100644 --- a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/CustomerDepartmentDTO.java +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/CustomerDepartmentDTO.java @@ -17,9 +17,10 @@ package com.epmet.dto; +import lombok.Data; + import java.io.Serializable; import java.util.Date; -import lombok.Data; /** @@ -44,9 +45,9 @@ public class CustomerDepartmentDTO implements Serializable { private String customerId; /** - * 所属组织机构ID(customer_organization.id) + * 所属组织机构ID(customer_organization.id)AGENCY_ID */ - private String orgId; + private String agencyId; /** * 部门名称 diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/entity/CustomerDepartmentEntity.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/entity/CustomerDepartmentEntity.java index b34f814bc1..4c0ccf2156 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/entity/CustomerDepartmentEntity.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/entity/CustomerDepartmentEntity.java @@ -18,13 +18,10 @@ package com.epmet.entity; import com.baomidou.mybatisplus.annotation.TableName; - import com.epmet.commons.mybatis.entity.BaseEpmetEntity; import lombok.Data; import lombok.EqualsAndHashCode; -import java.util.Date; - /** * 客户部门表 * @@ -46,7 +43,7 @@ public class CustomerDepartmentEntity extends BaseEpmetEntity { /** * 所属组织机构ID(customer_organization.id) */ - private String orgId; + private String agencyId; /** * 部门名称 diff --git a/epmet-module/gov-org/gov-org-server/src/main/resources/db/migration/epmet_gov_org.sql b/epmet-module/gov-org/gov-org-server/src/main/resources/db/migration/epmet_gov_org.sql index c53d7724f0..34bf6d70cc 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/resources/db/migration/epmet_gov_org.sql +++ b/epmet-module/gov-org/gov-org-server/src/main/resources/db/migration/epmet_gov_org.sql @@ -2,7 +2,7 @@ DROP TABLE IF EXISTS `customer_department`; CREATE TABLE `customer_department` ( `ID` varchar(64) NOT NULL COMMENT 'ID 唯一标识', `CUSTOMER_ID` varchar(64) NOT NULL COMMENT '客户ID', - `ORG_ID` varchar(64) NOT NULL COMMENT '所属组织机构ID(customer_organization.id)', + `AGENCY_ID` varchar(64) NOT NULL COMMENT '所属机关ID(customer_agency.id)', `DEPARTMENT_NAME` varchar(128) NOT NULL COMMENT '部门名称', `DEPARTMENT_DUTY` varchar(255) NOT NULL COMMENT '部门职责', `TOTAL_USER` int(11) NOT NULL COMMENT '总人数', @@ -12,19 +12,19 @@ CREATE TABLE `customer_department` ( `CREATED_TIME` datetime NOT NULL COMMENT '创建时间', `UPDATED_BY` varchar(32) NOT NULL COMMENT '更新人', `UPDATED_TIME` datetime NOT NULL COMMENT '更新时间', - PRIMARY KEY (`ID`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='客户部门表 '; + PRIMARY KEY (`ID`) USING BTREE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 ROW_FORMAT=DYNAMIC COMMENT='客户部门表 '; -- ----------------------------------------------------------------------- -- ----------------------------------------------------------------------- -DROP TABLE IF EXISTS `customer_organization`; -CREATE TABLE `customer_organization` ( +DROP TABLE IF EXISTS `customer_agency`; +CREATE TABLE `customer_agency` ( `ID` varchar(64) NOT NULL COMMENT 'ID', `CUSTOMER_ID` varchar(64) NOT NULL COMMENT '客户ID', `PID` varchar(64) NOT NULL COMMENT '上级组织机构ID', `PIDS` varchar(1024) NOT NULL COMMENT '所有上级组织机构ID(以英文:隔开)', `ALL_PARENT_NAME` varchar(1024) DEFAULT NULL COMMENT '所有上级名称,以-连接', `ORGANIZATION_NAME` varchar(64) NOT NULL COMMENT '组织名称', - `LEVEL` int(10) NOT NULL COMMENT '机关级别(社区级:community,\r\n乡(镇、街道)级:street,\r\n区县级: district,\r\n市级: city\r\n省级:province) 机关级别(社区级:community,乡(镇、街道)级:street,区县级: district,市级: city省级:province)', + `LEVEL` varchar(30) NOT NULL COMMENT '机关级别(社区级:community,\r\n乡(镇、街道)级:street,\r\n区县级: district,\r\n市级: city\r\n省级:province) 机关级别(社区级:community,乡(镇、街道)级:street,区县级: district,市级: city省级:province)', `AREA_CODE` int(10) NOT NULL COMMENT '地区编码', `DEL_FLAG` varchar(1) NOT NULL COMMENT '删除标识', `REVISION` int(10) NOT NULL COMMENT '乐观锁', @@ -33,8 +33,8 @@ CREATE TABLE `customer_organization` ( `UPDATED_BY` varchar(32) NOT NULL COMMENT '更新人', `UPDATED_TIME` datetime NOT NULL COMMENT '更新时间', `TOTAL_USER` int(11) DEFAULT NULL COMMENT '总人数', - PRIMARY KEY (`ID`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='组织机构表 '; + PRIMARY KEY (`ID`) USING BTREE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 ROW_FORMAT=DYNAMIC COMMENT='机关单位信息表'; -- ----------------------------------------------------------------------- -- ----------------------------------------------------------------------- DROP TABLE IF EXISTS `customer_staff_department`; @@ -49,8 +49,8 @@ CREATE TABLE `customer_staff_department` ( `CREATED_TIME` datetime NOT NULL COMMENT '创建时间', `UPDATED_BY` varchar(32) NOT NULL COMMENT '更新人', `UPDATED_TIME` datetime NOT NULL COMMENT '更新时间', - PRIMARY KEY (`ID`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='部门人员关系表 '; + PRIMARY KEY (`ID`) USING BTREE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 ROW_FORMAT=DYNAMIC COMMENT='部门人员关系表 '; -- ----------------------------------------------------------------------- -- ----------------------------------------------------------------------- @@ -66,24 +66,24 @@ CREATE TABLE `customer_staff_grid` ( `CREATED_TIME` datetime NOT NULL COMMENT '创建时间', `UPDATED_BY` varchar(32) NOT NULL COMMENT '更新人', `UPDATED_TIME` datetime NOT NULL COMMENT '更新时间', - PRIMARY KEY (`ID`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='网格人员关系表 '; + PRIMARY KEY (`ID`) USING BTREE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 ROW_FORMAT=DYNAMIC COMMENT='网格人员关系表 '; -- ----------------------------------------------------------------------- -- ----------------------------------------------------------------------- -DROP TABLE IF EXISTS `customer_staff_organization`; -CREATE TABLE `customer_staff_organization` ( +DROP TABLE IF EXISTS `customer_staff_agency`; +CREATE TABLE `customer_staff_agency` ( `ID` varchar(64) NOT NULL COMMENT 'ID', `CUSTOMER_ID` varchar(64) NOT NULL COMMENT '客户ID', `USER_ID` varchar(64) NOT NULL COMMENT '用户ID', - `ORG_ID` varchar(64) NOT NULL COMMENT '组织机构ID customer_organization.id', + `AGENCY_ID` varchar(64) NOT NULL COMMENT '组织机构ID customer_agency.id', `DEL_FLAG` int(10) NOT NULL COMMENT '删除标识', `REVISION` int(10) NOT NULL COMMENT '乐观锁', `CREATED_BY` varchar(32) NOT NULL COMMENT '创建人', `CREATED_TIME` datetime NOT NULL COMMENT '创建时间', `UPDATED_BY` varchar(32) NOT NULL COMMENT '更新人', `UPDATED_TIME` datetime NOT NULL COMMENT '更新时间', - PRIMARY KEY (`ID`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='组织人员关系表 '; + PRIMARY KEY (`ID`) USING BTREE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 ROW_FORMAT=DYNAMIC COMMENT='人员-机关单位关系表'; -- ----------------------------------------------------------------------- -- ----------------------------------------------------------------------- diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/StaffAgencyHistoryDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/StaffAgencyVisitedDTO.java similarity index 89% rename from epmet-user/epmet-user-client/src/main/java/com/epmet/dto/StaffAgencyHistoryDTO.java rename to epmet-user/epmet-user-client/src/main/java/com/epmet/dto/StaffAgencyVisitedDTO.java index 21b6eb47b6..45c5c443a8 100644 --- a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/StaffAgencyHistoryDTO.java +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/StaffAgencyVisitedDTO.java @@ -17,20 +17,19 @@ package com.epmet.dto; -import lombok.Data; - import java.io.Serializable; import java.util.Date; +import lombok.Data; /** - * 工作人员登录组织日志表 + * 工作人员进入组织日志表 * * @author generator generator@elink-cn.com - * @since v1.0.0 2020-04-20 + * @since v1.0.0 2020-04-21 */ @Data -public class StaffAgencyHistoryDTO implements Serializable { +public class StaffAgencyVisitedDTO implements Serializable { private static final long serialVersionUID = 1L; @@ -60,9 +59,9 @@ public class StaffAgencyHistoryDTO implements Serializable { private String mobile; /** - * 组织机构id + * 机关单位id来源于customer_agency.id */ - private String orgId; + private String agencyId; /** * 删除标识:0.未删除 1.已删除 diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/StaffGridVisitedDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/StaffGridVisitedDTO.java new file mode 100644 index 0000000000..328aafad2e --- /dev/null +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/StaffGridVisitedDTO.java @@ -0,0 +1,86 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

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

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

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.dto; + +import java.io.Serializable; +import java.util.Date; +import lombok.Data; + + +/** + * 工作人员进入网格日志表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-04-21 + */ +@Data +public class StaffGridVisitedDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 唯一标识 + */ + private String id; + + /** + * 客户ID + */ + private String customerId; + + /** + * 网格ID + */ + private String gridId; + + /** + * customer_staff.userId + */ + private String staffId; + + /** + * 删除标识:0.未删除 1.已删除 + */ + private Integer delFlag; + + /** + * 乐观锁 + */ + private Integer revision; + + /** + * 创建人 + */ + private String createdBy; + + /** + * 创建时间,登录时间 + */ + private Date createdTime; + + /** + * 更新人 + */ + private String updatedBy; + + /** + * 更新时间 + */ + private Date updatedTime; + +} \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/StaffAgencyHistoryController.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/StaffAgencyVisitedController.java similarity index 82% rename from epmet-user/epmet-user-server/src/main/java/com/epmet/controller/StaffAgencyHistoryController.java rename to epmet-user/epmet-user-server/src/main/java/com/epmet/controller/StaffAgencyVisitedController.java index aa1a81426f..5111dc2a25 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/StaffAgencyHistoryController.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/StaffAgencyVisitedController.java @@ -20,24 +20,23 @@ package com.epmet.controller; import com.epmet.commons.tools.utils.Result; import com.epmet.dto.form.StaffLoginAgencyRecordFormDTO; import com.epmet.dto.result.StaffLatestAgencyResultDTO; -import com.epmet.service.StaffAgencyHistoryService; +import com.epmet.service.StaffAgencyVisitedService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; /** - * 工作人员登录组织日志表 + * 工作人员进入组织日志表 * * @author generator generator@elink-cn.com - * @since v1.0.0 2020-04-20 + * @since v1.0.0 2020-04-21 */ @RestController -@RequestMapping("staffagencyhistory") -public class StaffAgencyHistoryController { +@RequestMapping("staffagencyvisited") +public class StaffAgencyVisitedController { @Autowired - private StaffAgencyHistoryService staffAgencyHistoryService; - + private StaffAgencyVisitedService staffAgencyVisitedService; /** * @param openId @@ -48,7 +47,7 @@ public class StaffAgencyHistoryController { **/ @GetMapping(value = "getlatest/{openId}") public Result getLatestStaffWechatLoginRecord(@PathVariable("openId") String openId) { - return staffAgencyHistoryService.getLatestStaffWechatLoginRecord(openId); + return staffAgencyVisitedService.getLatestStaffWechatLoginRecord(openId); } /** @@ -60,6 +59,6 @@ public class StaffAgencyHistoryController { **/ @PostMapping(value = "saveStaffLoginRecord") public Result saveStaffLoginRecord(@RequestBody StaffLoginAgencyRecordFormDTO formDTO) { - return staffAgencyHistoryService.saveStaffLoginRecord(formDTO); + return staffAgencyVisitedService.saveStaffLoginRecord(formDTO); } } \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/StaffGridVisitedController.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/StaffGridVisitedController.java new file mode 100644 index 0000000000..ec34fb21fb --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/StaffGridVisitedController.java @@ -0,0 +1,39 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

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

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

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.controller; + +import com.epmet.service.StaffGridVisitedService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + + +/** + * 工作人员进入网格日志表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-04-21 + */ +@RestController +@RequestMapping("staffgridvisited") +public class StaffGridVisitedController { + + @Autowired + private StaffGridVisitedService staffGridVisitedService; + +} \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/StaffAgencyHistoryDao.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/StaffAgencyVisitedDao.java similarity index 86% rename from epmet-user/epmet-user-server/src/main/java/com/epmet/dao/StaffAgencyHistoryDao.java rename to epmet-user/epmet-user-server/src/main/java/com/epmet/dao/StaffAgencyVisitedDao.java index 0e6739ad58..189b179f0c 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/StaffAgencyHistoryDao.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/StaffAgencyVisitedDao.java @@ -19,17 +19,17 @@ package com.epmet.dao; import com.epmet.commons.mybatis.dao.BaseDao; import com.epmet.dto.result.StaffLatestAgencyResultDTO; -import com.epmet.entity.StaffAgencyHistoryEntity; +import com.epmet.entity.StaffAgencyVisitedEntity; import org.apache.ibatis.annotations.Mapper; /** - * 工作人员登录组织日志表 + * 工作人员进入组织日志表 * * @author generator generator@elink-cn.com - * @since v1.0.0 2020-04-20 + * @since v1.0.0 2020-04-21 */ @Mapper -public interface StaffAgencyHistoryDao extends BaseDao { +public interface StaffAgencyVisitedDao extends BaseDao { /** * @param openId * @return com.epmet.dto.result.LatestStaffWechatLoginDTO diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/StaffGridVisitedDao.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/StaffGridVisitedDao.java new file mode 100644 index 0000000000..d905202603 --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/StaffGridVisitedDao.java @@ -0,0 +1,33 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

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

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

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.dao; + +import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.entity.StaffGridVisitedEntity; +import org.apache.ibatis.annotations.Mapper; + +/** + * 工作人员进入网格日志表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-04-21 + */ +@Mapper +public interface StaffGridVisitedDao extends BaseDao { + +} \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/StaffAgencyHistoryEntity.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/StaffAgencyVisitedEntity.java similarity index 85% rename from epmet-user/epmet-user-server/src/main/java/com/epmet/entity/StaffAgencyHistoryEntity.java rename to epmet-user/epmet-user-server/src/main/java/com/epmet/entity/StaffAgencyVisitedEntity.java index 618bcba59f..44c0ab2f51 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/StaffAgencyHistoryEntity.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/StaffAgencyVisitedEntity.java @@ -26,15 +26,15 @@ import lombok.EqualsAndHashCode; import java.util.Date; /** - * 工作人员登录组织日志表 + * 工作人员进入组织日志表 * * @author generator generator@elink-cn.com - * @since v1.0.0 2020-04-20 + * @since v1.0.0 2020-04-21 */ @Data @EqualsAndHashCode(callSuper=false) -@TableName("staff_agency_history") -public class StaffAgencyHistoryEntity extends BaseEpmetEntity { +@TableName("staff_agency_visited") +public class StaffAgencyVisitedEntity extends BaseEpmetEntity { private static final long serialVersionUID = 1L; @@ -59,8 +59,8 @@ public class StaffAgencyHistoryEntity extends BaseEpmetEntity { private String mobile; /** - * 组织机构id + * 机关单位id来源于customer_agency.id */ - private String orgId; + private String agencyId; } diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/StaffGridVisitedEntity.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/StaffGridVisitedEntity.java new file mode 100644 index 0000000000..9c6ffe281e --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/StaffGridVisitedEntity.java @@ -0,0 +1,56 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

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

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

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.entity; + +import com.baomidou.mybatisplus.annotation.TableName; + +import com.epmet.commons.mybatis.entity.BaseEpmetEntity; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.util.Date; + +/** + * 工作人员进入网格日志表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-04-21 + */ +@Data +@EqualsAndHashCode(callSuper=false) +@TableName("staff_grid_visited") +public class StaffGridVisitedEntity extends BaseEpmetEntity { + + private static final long serialVersionUID = 1L; + + /** + * 客户ID + */ + private String customerId; + + /** + * 网格ID + */ + private String gridId; + + /** + * customer_staff.userId + */ + private String staffId; + +} diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/StaffAgencyHistoryService.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/StaffAgencyVisitedService.java similarity index 74% rename from epmet-user/epmet-user-server/src/main/java/com/epmet/service/StaffAgencyHistoryService.java rename to epmet-user/epmet-user-server/src/main/java/com/epmet/service/StaffAgencyVisitedService.java index 413c555f7d..4b67657992 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/StaffAgencyHistoryService.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/StaffAgencyVisitedService.java @@ -20,51 +20,51 @@ 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.StaffAgencyHistoryDTO; +import com.epmet.dto.StaffAgencyVisitedDTO; import com.epmet.dto.form.StaffLoginAgencyRecordFormDTO; import com.epmet.dto.result.StaffLatestAgencyResultDTO; -import com.epmet.entity.StaffAgencyHistoryEntity; +import com.epmet.entity.StaffAgencyVisitedEntity; import java.util.List; import java.util.Map; /** - * 工作人员登录组织日志表 + * 工作人员进入组织日志表 * * @author generator generator@elink-cn.com - * @since v1.0.0 2020-04-20 + * @since v1.0.0 2020-04-21 */ -public interface StaffAgencyHistoryService extends BaseService { +public interface StaffAgencyVisitedService extends BaseService { /** * 默认分页 * * @param params - * @return PageData + * @return PageData * @author generator - * @date 2020-04-20 + * @date 2020-04-21 */ - PageData page(Map params); + PageData page(Map params); /** * 默认查询 * * @param params - * @return java.util.List + * @return java.util.List * @author generator - * @date 2020-04-20 + * @date 2020-04-21 */ - List list(Map params); + List list(Map params); /** * 单条查询 * * @param id - * @return StaffAgencyHistoryDTO + * @return StaffAgencyVisitedDTO * @author generator - * @date 2020-04-20 + * @date 2020-04-21 */ - StaffAgencyHistoryDTO get(String id); + StaffAgencyVisitedDTO get(String id); /** * 默认保存 @@ -72,9 +72,9 @@ public interface StaffAgencyHistoryService extends BaseService diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/StaffGridVisitedService.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/StaffGridVisitedService.java new file mode 100644 index 0000000000..ce181b1323 --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/StaffGridVisitedService.java @@ -0,0 +1,95 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

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

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

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.service; + +import com.epmet.commons.mybatis.service.BaseService; +import com.epmet.commons.tools.page.PageData; +import com.epmet.dto.StaffGridVisitedDTO; +import com.epmet.entity.StaffGridVisitedEntity; + +import java.util.List; +import java.util.Map; + +/** + * 工作人员进入网格日志表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-04-21 + */ +public interface StaffGridVisitedService extends BaseService { + + /** + * 默认分页 + * + * @param params + * @return PageData + * @author generator + * @date 2020-04-21 + */ + PageData page(Map params); + + /** + * 默认查询 + * + * @param params + * @return java.util.List + * @author generator + * @date 2020-04-21 + */ + List list(Map params); + + /** + * 单条查询 + * + * @param id + * @return StaffGridVisitedDTO + * @author generator + * @date 2020-04-21 + */ + StaffGridVisitedDTO get(String id); + + /** + * 默认保存 + * + * @param dto + * @return void + * @author generator + * @date 2020-04-21 + */ + void save(StaffGridVisitedDTO dto); + + /** + * 默认更新 + * + * @param dto + * @return void + * @author generator + * @date 2020-04-21 + */ + void update(StaffGridVisitedDTO dto); + + /** + * 批量删除 + * + * @param ids + * @return void + * @author generator + * @date 2020-04-21 + */ + void delete(String[] ids); +} \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/UserResiRegisterVisitService.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/UserResiRegisterVisitService.java index 579cb1e1c3..414706ee2c 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/UserResiRegisterVisitService.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/UserResiRegisterVisitService.java @@ -19,12 +19,10 @@ package com.epmet.service; import com.epmet.commons.mybatis.service.BaseService; import com.epmet.commons.tools.page.PageData; -import com.epmet.commons.tools.security.dto.TokenDto; import com.epmet.commons.tools.utils.Result; import com.epmet.dto.UserResiInfoDTO; import com.epmet.dto.UserResiRegisterVisitDTO; import com.epmet.dto.form.ResiRegisterFormDTO; -import com.epmet.dto.form.UserResiInfoFormDTO; import com.epmet.dto.form.VerificationCodeFormDTO; import com.epmet.dto.result.ResiRegisterResultDTO; import com.epmet.entity.UserResiRegisterVisitEntity; diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/StaffAgencyHistoryServiceImpl.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/StaffAgencyVisitedServiceImpl.java similarity index 67% rename from epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/StaffAgencyHistoryServiceImpl.java rename to epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/StaffAgencyVisitedServiceImpl.java index 90d2e6160d..399b4c6bf0 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/StaffAgencyHistoryServiceImpl.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/StaffAgencyVisitedServiceImpl.java @@ -24,12 +24,12 @@ import com.epmet.commons.tools.constant.FieldConstant; import com.epmet.commons.tools.page.PageData; import com.epmet.commons.tools.utils.ConvertUtils; import com.epmet.commons.tools.utils.Result; -import com.epmet.dao.StaffAgencyHistoryDao; -import com.epmet.dto.StaffAgencyHistoryDTO; +import com.epmet.dao.StaffAgencyVisitedDao; +import com.epmet.dto.StaffAgencyVisitedDTO; import com.epmet.dto.form.StaffLoginAgencyRecordFormDTO; import com.epmet.dto.result.StaffLatestAgencyResultDTO; -import com.epmet.entity.StaffAgencyHistoryEntity; -import com.epmet.service.StaffAgencyHistoryService; +import com.epmet.entity.StaffAgencyVisitedEntity; +import com.epmet.service.StaffAgencyVisitedService; import org.apache.commons.lang3.StringUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -41,57 +41,57 @@ import java.util.List; import java.util.Map; /** - * 工作人员登录组织日志表 + * 工作人员进入组织日志表 * * @author generator generator@elink-cn.com - * @since v1.0.0 2020-04-20 + * @since v1.0.0 2020-04-21 */ @Service -public class StaffAgencyHistoryServiceImpl extends BaseServiceImpl implements StaffAgencyHistoryService { - private static final Logger logger = LoggerFactory.getLogger(StaffAgencyHistoryServiceImpl.class); +public class StaffAgencyVisitedServiceImpl extends BaseServiceImpl implements StaffAgencyVisitedService { + private static final Logger logger = LoggerFactory.getLogger(StaffAgencyVisitedServiceImpl.class); @Override - public PageData page(Map params) { - IPage page = baseDao.selectPage( + public PageData page(Map params) { + IPage page = baseDao.selectPage( getPage(params, FieldConstant.CREATED_TIME, false), getWrapper(params) ); - return getPageData(page, StaffAgencyHistoryDTO.class); + return getPageData(page, StaffAgencyVisitedDTO.class); } @Override - public List list(Map params) { - List entityList = baseDao.selectList(getWrapper(params)); + public List list(Map params) { + List entityList = baseDao.selectList(getWrapper(params)); - return ConvertUtils.sourceToTarget(entityList, StaffAgencyHistoryDTO.class); + return ConvertUtils.sourceToTarget(entityList, StaffAgencyVisitedDTO.class); } - private QueryWrapper getWrapper(Map params){ + private QueryWrapper getWrapper(Map params){ String id = (String)params.get(FieldConstant.ID_HUMP); - QueryWrapper wrapper = new QueryWrapper<>(); + QueryWrapper wrapper = new QueryWrapper<>(); wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id); return wrapper; } @Override - public StaffAgencyHistoryDTO get(String id) { - StaffAgencyHistoryEntity entity = baseDao.selectById(id); - return ConvertUtils.sourceToTarget(entity, StaffAgencyHistoryDTO.class); + public StaffAgencyVisitedDTO get(String id) { + StaffAgencyVisitedEntity entity = baseDao.selectById(id); + return ConvertUtils.sourceToTarget(entity, StaffAgencyVisitedDTO.class); } @Override @Transactional(rollbackFor = Exception.class) - public void save(StaffAgencyHistoryDTO dto) { - StaffAgencyHistoryEntity entity = ConvertUtils.sourceToTarget(dto, StaffAgencyHistoryEntity.class); + public void save(StaffAgencyVisitedDTO dto) { + StaffAgencyVisitedEntity entity = ConvertUtils.sourceToTarget(dto, StaffAgencyVisitedEntity.class); insert(entity); } @Override @Transactional(rollbackFor = Exception.class) - public void update(StaffAgencyHistoryDTO dto) { - StaffAgencyHistoryEntity entity = ConvertUtils.sourceToTarget(dto, StaffAgencyHistoryEntity.class); + public void update(StaffAgencyVisitedDTO dto) { + StaffAgencyVisitedEntity entity = ConvertUtils.sourceToTarget(dto, StaffAgencyVisitedEntity.class); updateById(entity); } @@ -114,7 +114,7 @@ public class StaffAgencyHistoryServiceImpl extends BaseServiceImpl + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

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

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; +import com.epmet.commons.tools.constant.FieldConstant; +import com.epmet.commons.tools.page.PageData; +import com.epmet.commons.tools.utils.ConvertUtils; +import com.epmet.dao.StaffGridVisitedDao; +import com.epmet.dto.StaffGridVisitedDTO; +import com.epmet.entity.StaffGridVisitedEntity; +import com.epmet.service.StaffGridVisitedService; +import org.apache.commons.lang3.StringUtils; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.util.Arrays; +import java.util.List; +import java.util.Map; + +/** + * 工作人员进入网格日志表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-04-21 + */ +@Service +public class StaffGridVisitedServiceImpl extends BaseServiceImpl implements StaffGridVisitedService { + + @Override + public PageData page(Map params) { + IPage page = baseDao.selectPage( + getPage(params, FieldConstant.CREATED_TIME, false), + getWrapper(params) + ); + return getPageData(page, StaffGridVisitedDTO.class); + } + + @Override + public List list(Map params) { + List entityList = baseDao.selectList(getWrapper(params)); + + return ConvertUtils.sourceToTarget(entityList, StaffGridVisitedDTO.class); + } + + private QueryWrapper getWrapper(Map params){ + String id = (String)params.get(FieldConstant.ID_HUMP); + + QueryWrapper wrapper = new QueryWrapper<>(); + wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id); + + return wrapper; + } + + @Override + public StaffGridVisitedDTO get(String id) { + StaffGridVisitedEntity entity = baseDao.selectById(id); + return ConvertUtils.sourceToTarget(entity, StaffGridVisitedDTO.class); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void save(StaffGridVisitedDTO dto) { + StaffGridVisitedEntity entity = ConvertUtils.sourceToTarget(dto, StaffGridVisitedEntity.class); + insert(entity); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void update(StaffGridVisitedDTO dto) { + StaffGridVisitedEntity entity = ConvertUtils.sourceToTarget(dto, StaffGridVisitedEntity.class); + updateById(entity); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void delete(String[] ids) { + // 逻辑删除(@TableLogic 注解) + baseDao.deleteBatchIds(Arrays.asList(ids)); + } + +} \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/resources/db/migration/epmet_user.sql b/epmet-user/epmet-user-server/src/main/resources/db/migration/epmet_user.sql index 90e2427edd..9283e23220 100644 --- a/epmet-user/epmet-user-server/src/main/resources/db/migration/epmet_user.sql +++ b/epmet-user/epmet-user-server/src/main/resources/db/migration/epmet_user.sql @@ -57,13 +57,13 @@ CREATE TABLE `staff_login_history` ( drop table if EXISTS staff_login_history; -CREATE TABLE `staff_agency_history` ( +CREATE TABLE `staff_agency_visited` ( `ID` varchar(64) NOT NULL COMMENT '唯一标识', `CUSTOMER_ID` varchar(64) NOT NULL COMMENT '客户ID', `STAFF_ID` varchar(64) NOT NULL COMMENT 'customer_staff.userId', `WX_OPEN_ID` varchar(64) NOT NULL COMMENT '微信openId', `MOBILE` varchar(20) NOT NULL COMMENT '手机号', - `ORG_ID` varchar(64) NOT NULL COMMENT '组织机构id', + `AGENCY_ID` varchar(64) NOT NULL COMMENT '机关单位id来源于customer_agency.id', `DEL_FLAG` int(11) NOT NULL COMMENT '删除标识:0.未删除 1.已删除', `REVISION` int(11) NOT NULL COMMENT '乐观锁', `CREATED_BY` varchar(32) NOT NULL COMMENT '创建人', @@ -71,4 +71,18 @@ CREATE TABLE `staff_agency_history` ( `UPDATED_BY` varchar(32) DEFAULT NULL COMMENT '更新人', `UPDATED_TIME` datetime DEFAULT NULL COMMENT '更新时间', PRIMARY KEY (`ID`) USING BTREE -) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=COMPACT COMMENT='工作人员登录组织日志表'; \ No newline at end of file +) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=COMPACT COMMENT='工作人员进入组织日志表'; + +CREATE TABLE `staff_grid_visited` ( + `ID` varchar(64) NOT NULL COMMENT '唯一标识', + `CUSTOMER_ID` varchar(64) NOT NULL COMMENT '客户ID', + `GRID_ID` varchar(64) NOT NULL COMMENT '网格ID', + `STAFF_ID` varchar(64) NOT NULL COMMENT 'customer_staff.userId', + `DEL_FLAG` int(11) NOT NULL COMMENT '删除标识:0.未删除 1.已删除', + `REVISION` int(11) NOT NULL COMMENT '乐观锁', + `CREATED_BY` varchar(32) NOT NULL COMMENT '创建人', + `CREATED_TIME` datetime NOT NULL COMMENT '创建时间,登录时间', + `UPDATED_BY` varchar(32) DEFAULT NULL COMMENT '更新人', + `UPDATED_TIME` datetime DEFAULT NULL COMMENT '更新时间', + PRIMARY KEY (`ID`) USING BTREE +) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=COMPACT COMMENT='工作人员进入网格日志表'; \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/resources/mapper/StaffAgencyHistoryDao.xml b/epmet-user/epmet-user-server/src/main/resources/mapper/StaffAgencyVisitedDao.xml similarity index 86% rename from epmet-user/epmet-user-server/src/main/resources/mapper/StaffAgencyHistoryDao.xml rename to epmet-user/epmet-user-server/src/main/resources/mapper/StaffAgencyVisitedDao.xml index a9ce119bff..687edca880 100644 --- a/epmet-user/epmet-user-server/src/main/resources/mapper/StaffAgencyHistoryDao.xml +++ b/epmet-user/epmet-user-server/src/main/resources/mapper/StaffAgencyVisitedDao.xml @@ -1,15 +1,15 @@ - + - + - + diff --git a/epmet-user/epmet-user-server/src/main/resources/mapper/StaffGridVisitedDao.xml b/epmet-user/epmet-user-server/src/main/resources/mapper/StaffGridVisitedDao.xml new file mode 100644 index 0000000000..38ce0bff3c --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/resources/mapper/StaffGridVisitedDao.xml @@ -0,0 +1,20 @@ + + + + + + + + + + + + + + + + + + + + \ No newline at end of file From 02ab6e9e62b11c0ea20e3a6994f31d2e3df547de Mon Sep 17 00:00:00 2001 From: yinzuomei <576302893@qq.com> Date: Tue, 21 Apr 2020 16:27:45 +0800 Subject: [PATCH 12/85] =?UTF-8?q?=E6=89=BE=E5=9B=9E@LoginUser?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/epmet/controller/LoginController.java | 3 ++- .../tools/security/dto/GovTokenDto.java | 2 +- .../tools/utils/CpUserDetailRedis.java | 2 +- .../epmet/controller/OperMenuController.java | 13 ++++++----- .../epmet/controller/CustomerController.java | 5 +++-- .../controller/ResiCommentController.java | 5 +++-- .../group/controller/ResiGroupController.java | 21 +++++++++--------- .../controller/GroupInvitationController.java | 7 +++--- .../controller/ResiGroupMemberController.java | 20 ++++++++++------- .../topic/controller/ResiTopicController.java | 22 +++++++++++-------- .../StrangerResiGuideController.java | 3 ++- .../epmet/controller/UserGuideController.java | 3 ++- .../controller/ResiMineGridController.java | 3 ++- .../controller/UserMessageController.java | 5 +++-- .../controller/PartyMemberController.java | 9 ++++---- .../controller/ResiRegisterController.java | 7 +++--- .../controller/ResiWarmheartedController.java | 5 +++-- .../epmet/controller/OperUserController.java | 5 +++-- .../com/epmet/controller/UserController.java | 3 ++- 19 files changed, 83 insertions(+), 60 deletions(-) diff --git a/epmet-auth/src/main/java/com/epmet/controller/LoginController.java b/epmet-auth/src/main/java/com/epmet/controller/LoginController.java index dc876a1ccc..12f697188a 100644 --- a/epmet-auth/src/main/java/com/epmet/controller/LoginController.java +++ b/epmet-auth/src/main/java/com/epmet/controller/LoginController.java @@ -1,5 +1,6 @@ package com.epmet.controller; +import com.epmet.commons.tools.annotation.LoginUser; import com.epmet.commons.tools.exception.ErrorCode; import com.epmet.commons.tools.security.dto.TokenDto; import com.epmet.commons.tools.utils.Result; @@ -92,7 +93,7 @@ public class LoginController { * @Date 2020/3/18 22:43 **/ @PostMapping(value = "logout") - public Result logout(TokenDto tokenDto, HttpServletRequest request) { + public Result logout(@LoginUser TokenDto tokenDto, HttpServletRequest request) { //String token = request.getParameter(Constant.TOKEN_HEADER); return loginService.logoutByToken(tokenDto); } diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/security/dto/GovTokenDto.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/security/dto/GovTokenDto.java index e46a4c1119..e2b6b18bda 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/security/dto/GovTokenDto.java +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/security/dto/GovTokenDto.java @@ -25,7 +25,7 @@ public class GovTokenDto implements Serializable { /** * 用户ID */ - private String staffId; + private String userId; /** * sessionKey diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/CpUserDetailRedis.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/CpUserDetailRedis.java index 100c583a01..9d3e2c3083 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/CpUserDetailRedis.java +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/CpUserDetailRedis.java @@ -105,7 +105,7 @@ public class CpUserDetailRedis { if (user == null) { return; } - String key = RedisKeys.getCpUserKey(user.getApp(), user.getClient(), user.getStaffId()); + String key = RedisKeys.getCpUserKey(user.getApp(), user.getClient(), user.getUserId()); //bean to map Map map = BeanUtil.beanToMap(user, false, true); redisUtils.hMSet(key, map, expire); diff --git a/epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/controller/OperMenuController.java b/epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/controller/OperMenuController.java index 12e8fae171..80f82dff81 100644 --- a/epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/controller/OperMenuController.java +++ b/epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/controller/OperMenuController.java @@ -1,5 +1,6 @@ package com.epmet.controller; +import com.epmet.commons.tools.annotation.LoginUser; import com.epmet.commons.tools.exception.ErrorCode; import com.epmet.commons.tools.page.PageData; import com.epmet.commons.tools.security.dto.TokenDto; @@ -57,7 +58,7 @@ public class OperMenuController { } @PostMapping - public Result save(@RequestBody OperMenuDTO dto, TokenDto tokenDto){ + public Result save(@RequestBody OperMenuDTO dto, @LoginUser TokenDto tokenDto){ //效验数据 ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class); operMenuService.save(dto,tokenDto); @@ -65,7 +66,7 @@ public class OperMenuController { } @PutMapping - public Result update(@RequestBody OperMenuDTO dto, TokenDto tokenDto){ + public Result update(@RequestBody OperMenuDTO dto, @LoginUser TokenDto tokenDto){ //效验数据 ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class); operMenuService.update(dto,tokenDto); @@ -81,7 +82,7 @@ public class OperMenuController { } @DeleteMapping("{id}") - public Result delete(@PathVariable("id") String id, TokenDto tokenDto){ + public Result delete(@PathVariable("id") String id, @LoginUser TokenDto tokenDto){ //效验数据 AssertUtils.isNull(id, "id"); @@ -120,7 +121,7 @@ public class OperMenuController { * @return List */ @GetMapping("nav") - public Result> nav(TokenDto tokenDto){ + public Result> nav(@LoginUser TokenDto tokenDto){ List list = operMenuService.getUserMenuNavList(tokenDto); return new Result>().ok(list); } @@ -131,7 +132,7 @@ public class OperMenuController { * @return Set */ @GetMapping("permissions") - public Result> permissions(TokenDto tokenDto){ + public Result> permissions(@LoginUser TokenDto tokenDto){ Set set = operMenuService.getUserPermissions(tokenDto); return new Result>().ok(set); } @@ -142,7 +143,7 @@ public class OperMenuController { * @return */ @GetMapping("select") - public Result> select(TokenDto tokenDto){ + public Result> select(@LoginUser TokenDto tokenDto){ List list = operMenuService.getUserMenuList(tokenDto, null); return new Result>().ok(list); diff --git a/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/controller/CustomerController.java b/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/controller/CustomerController.java index 7cca833383..87b1f0f38b 100644 --- a/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/controller/CustomerController.java +++ b/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/controller/CustomerController.java @@ -18,6 +18,7 @@ package com.epmet.controller; import com.alibaba.fastjson.JSON; +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; @@ -25,8 +26,8 @@ import com.epmet.commons.tools.utils.Result; import com.epmet.commons.tools.validator.AssertUtils; import com.epmet.commons.tools.validator.ValidatorUtils; import com.epmet.commons.tools.validator.group.AddGroup; -import com.epmet.commons.tools.validator.group.UpdateGroup; import com.epmet.commons.tools.validator.group.DefaultGroup; +import com.epmet.commons.tools.validator.group.UpdateGroup; import com.epmet.dto.CustomerDTO; import com.epmet.dto.result.ValidCustomerResultDTO; import com.epmet.excel.CustomerExcel; @@ -132,7 +133,7 @@ public class CustomerController { * @Date 2020/3/11 21:58 **/ @GetMapping("getvalidcustomerlist") - public Result> getValidCustomerList(TokenDto tokenDTO) { + public Result> getValidCustomerList(@LoginUser TokenDto tokenDTO) { logger.info("getvalidcustomerlist:"+ JSON.toJSONString(tokenDTO)); return customerService.getValidCustomerList(); } diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/comment/controller/ResiCommentController.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/comment/controller/ResiCommentController.java index bc29a28ee2..321069290b 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/comment/controller/ResiCommentController.java +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/comment/controller/ResiCommentController.java @@ -1,5 +1,6 @@ package com.epmet.modules.comment.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; @@ -37,7 +38,7 @@ public class ResiCommentController { * @Date 2020.04.01 18:06 **/ @PostMapping("commenttopic") - public Result commentTopic(TokenDto tokenDto, @RequestBody ResiPublishCommentFormDTO publishCommentFormDTO){ + public Result commentTopic(@LoginUser TokenDto tokenDto, @RequestBody ResiPublishCommentFormDTO publishCommentFormDTO){ ValidatorUtils.validateEntity(publishCommentFormDTO); return commentService.commentTopic(tokenDto,publishCommentFormDTO); } @@ -51,7 +52,7 @@ public class ResiCommentController { * @Date 2020.04.01 23:49 **/ @PostMapping("getcommentlistoftopic") - public Result> getCommentListOfTopic(TokenDto tokenDto, @RequestBody ResiQueryCommentFormDTO queryCommentFormDTO){ + public Result> getCommentListOfTopic(@LoginUser TokenDto tokenDto, @RequestBody ResiQueryCommentFormDTO queryCommentFormDTO){ ValidatorUtils.validateEntity(queryCommentFormDTO); return commentService.getCommentList(tokenDto,queryCommentFormDTO); } diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/controller/ResiGroupController.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/controller/ResiGroupController.java index 54db90c905..ccb77ea7cb 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/controller/ResiGroupController.java +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/controller/ResiGroupController.java @@ -17,6 +17,7 @@ package com.epmet.modules.group.controller; +import com.epmet.commons.tools.annotation.LoginUser; import com.epmet.commons.tools.exception.RenException; import com.epmet.commons.tools.security.dto.TokenDto; import com.epmet.commons.tools.utils.Result; @@ -63,7 +64,7 @@ public class ResiGroupController { * @Date 2020/3/28 20:36 **/ @PostMapping("getmygroup") - public Result> getMyGroup(TokenDto tokenDto, @RequestBody MyGroupFormDTO myGroupFormDTO) { + public Result> getMyGroup(@LoginUser TokenDto tokenDto, @RequestBody MyGroupFormDTO myGroupFormDTO) { myGroupFormDTO.setUserId(tokenDto.getUserId()); ValidatorUtils.validateEntity(myGroupFormDTO); return resiGroupService.getMyGroup(myGroupFormDTO); @@ -78,7 +79,7 @@ public class ResiGroupController { * @Date 2020/3/28 19:52 **/ @PostMapping("getrecommendgroup") - public Result> getRecommendGroup(TokenDto tokenDto, + public Result> getRecommendGroup(@LoginUser TokenDto tokenDto, @RequestBody RecommendGroupFormDTO recommendGroupFormDTO) { recommendGroupFormDTO.setUserId(tokenDto.getUserId()); ValidatorUtils.validateEntity(recommendGroupFormDTO); @@ -94,7 +95,7 @@ public class ResiGroupController { * @Date 2020/3/28 21:59 **/ @PostMapping("getcreated") - public Result> getCreated(TokenDto tokenDto, + public Result> getCreated(@LoginUser TokenDto tokenDto, @RequestBody CreatedFormDTO createdFormDTO) { createdFormDTO.setUserId(tokenDto.getUserId()); ValidatorUtils.validateEntity(createdFormDTO); @@ -110,7 +111,7 @@ public class ResiGroupController { * @Date 2020/3/28 22:20 **/ @PostMapping("modifygroup") - public Result modifyGroup(TokenDto tokenDto, @RequestBody ModifyGroupFormDTO modifyGroupFormDTO) { + public Result modifyGroup(@LoginUser TokenDto tokenDto, @RequestBody ModifyGroupFormDTO modifyGroupFormDTO) { modifyGroupFormDTO.setUserId(tokenDto.getUserId()); ValidatorUtils.validateEntity(modifyGroupFormDTO); return resiGroupService.modifyGroup(modifyGroupFormDTO); @@ -125,7 +126,7 @@ public class ResiGroupController { * @Date 2020/3/29 17:32 **/ @PostMapping("getgroupsummarize") - public Result getGroupSummarize(TokenDto tokenDto, + public Result getGroupSummarize(@LoginUser TokenDto tokenDto, @RequestBody GroupSummarizeFormDTO groupSummarizeFormDTO) { groupSummarizeFormDTO.setUserId(tokenDto.getUserId()); ValidatorUtils.validateEntity(groupSummarizeFormDTO); @@ -141,7 +142,7 @@ public class ResiGroupController { * @Date 2020/3/29 19:26 **/ @PostMapping("applycreategroup") - public Result applyCreateGroup(TokenDto tokenDto, + public Result applyCreateGroup(@LoginUser TokenDto tokenDto, @RequestBody ApplyCreateGroupFormDTO applyCreateGroupFormDTO) { applyCreateGroupFormDTO.setUserId(tokenDto.getUserId()); applyCreateGroupFormDTO.setApp(tokenDto.getApp()); @@ -158,7 +159,7 @@ public class ResiGroupController { * @Date 2020/3/30 10:11 **/ @PostMapping("initapplygroup") - public Result initApplyGroup(TokenDto tokenDto, + public Result initApplyGroup(@LoginUser TokenDto tokenDto, @RequestBody InitApplyGroupFormDTO initApplyGroupFormDTO) { if (null == tokenDto) { logger.error(ModuleConstant.USER_NOT_NULL); @@ -178,7 +179,7 @@ public class ResiGroupController { * @Date 2020/3/30 15:44 **/ @PostMapping("initapplycreategroup") - public Result initApplyCreatedGroup(TokenDto tokenDto, + public Result initApplyCreatedGroup(@LoginUser TokenDto tokenDto, @RequestBody InitApplyCreatedGroupFormDTO initApplyCreatedGroupFormDTO) { if (null == tokenDto) { logger.error(ModuleConstant.USER_NOT_NULL); @@ -198,7 +199,7 @@ public class ResiGroupController { * @Date 2020/3/31 12:31 **/ @PostMapping("agreeapplygroup") - public Result agreeApplyGroup(TokenDto tokenDto, @RequestBody AgreeApplyGroupFormDTO agreeApplyGroupFormDTO) { + public Result agreeApplyGroup(@LoginUser TokenDto tokenDto, @RequestBody AgreeApplyGroupFormDTO agreeApplyGroupFormDTO) { agreeApplyGroupFormDTO.setUserId(tokenDto.getUserId()); ValidatorUtils.validateEntity(agreeApplyGroupFormDTO); return resiGroupService.agreeApplyGroup(agreeApplyGroupFormDTO); @@ -213,7 +214,7 @@ public class ResiGroupController { * @Date 2020/3/31 13:23 **/ @PostMapping("disagreeapplygroup") - public Result disagreeApplyGroup(TokenDto tokenDto, @RequestBody DisAgreeApplyGroupFormDTO disAgreeApplyGroupFormDTO) { + public Result disagreeApplyGroup(@LoginUser TokenDto tokenDto, @RequestBody DisAgreeApplyGroupFormDTO disAgreeApplyGroupFormDTO) { disAgreeApplyGroupFormDTO.setUserId(tokenDto.getUserId()); ValidatorUtils.validateEntity(disAgreeApplyGroupFormDTO); return resiGroupService.disagreeApplyGroup(disAgreeApplyGroupFormDTO); diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/invitation/controller/GroupInvitationController.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/invitation/controller/GroupInvitationController.java index 6fcc9f75f9..1364dcbba8 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/invitation/controller/GroupInvitationController.java +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/invitation/controller/GroupInvitationController.java @@ -17,6 +17,7 @@ package com.epmet.modules.invitation.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; @@ -55,7 +56,7 @@ public class GroupInvitationController { * @Date 2020/3/31 22:50 **/ @PostMapping("creategroupinvitation") - public Result createGroupInvitation(TokenDto tokenDto, + public Result createGroupInvitation(@LoginUser TokenDto tokenDto, @RequestBody CreateGroupInvitationFormDTO formDTO) { formDTO.setUserId(tokenDto.getUserId()); ValidatorUtils.validateEntity(formDTO); @@ -70,7 +71,7 @@ public class GroupInvitationController { * @Date 2020/3/31 23:11 **/ @PostMapping("getlinkgroupinfo") - public Result getLinkGroupInfo(TokenDto tokenDto, + public Result getLinkGroupInfo(@LoginUser TokenDto tokenDto, @RequestBody LinkGroupInfoFormDTO formDTO) { formDTO.setUserId(tokenDto.getUserId()); ValidatorUtils.validateEntity(formDTO); @@ -86,7 +87,7 @@ public class GroupInvitationController { * @Date 2020/3/31 23:47 **/ @PostMapping("acceptinvitation") - public Result accetInvitation(TokenDto tokenDto, + public Result accetInvitation(@LoginUser TokenDto tokenDto, @RequestBody AccetInvitationFormDTO formDTO) { formDTO.setUserId(tokenDto.getUserId()); formDTO.setApp(tokenDto.getApp()); diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/member/controller/ResiGroupMemberController.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/member/controller/ResiGroupMemberController.java index c358e1917c..75489585f9 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/member/controller/ResiGroupMemberController.java +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/member/controller/ResiGroupMemberController.java @@ -17,6 +17,7 @@ package com.epmet.modules.member.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; @@ -25,7 +26,10 @@ import com.epmet.resi.group.dto.member.form.*; import com.epmet.resi.group.dto.member.result.ApplyingMemberResultDTO; import com.epmet.resi.group.dto.member.result.GroupMemberListResultDTO; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.*; +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; @@ -51,7 +55,7 @@ public class ResiGroupMemberController { * @Date 2020/3/29 20:01 **/ @PostMapping("applyjoingroup") - public Result applyJoinGroup(TokenDto tokenDto, + public Result applyJoinGroup(@LoginUser TokenDto tokenDto, @RequestBody ApplyJoinGroupFormDTO applyJoinGroupFormDTO) { applyJoinGroupFormDTO.setUserId(tokenDto.getUserId()); applyJoinGroupFormDTO.setApp(tokenDto.getApp()); @@ -68,7 +72,7 @@ public class ResiGroupMemberController { * @Date 2020/3/30 21:14 **/ @PostMapping("getgroupmember") - public Result> getGroupMemberList(TokenDto tokenDto, + public Result> getGroupMemberList(@LoginUser TokenDto tokenDto, @RequestBody GroupMemberListFormDTO groupMemberListFormDTO) { ValidatorUtils.validateEntity(groupMemberListFormDTO); return resiGroupMemberService.getGroupMemberList(groupMemberListFormDTO); @@ -83,7 +87,7 @@ public class ResiGroupMemberController { * @Date 2020/3/30 21:37 **/ @PostMapping("getapplyingmember") - public Result> getApplyingMember(TokenDto tokenDto, + public Result> getApplyingMember(@LoginUser TokenDto tokenDto, @RequestBody ApplyingMemberFormDTO applyingMemberFormDTO) { ValidatorUtils.validateEntity(applyingMemberFormDTO); return resiGroupMemberService.getApplyingMember(applyingMemberFormDTO); @@ -98,7 +102,7 @@ public class ResiGroupMemberController { * @Date 2020/3/30 22:07 **/ @PostMapping("agreeapply") - public Result agreeApply(TokenDto tokenDto, + public Result agreeApply(@LoginUser TokenDto tokenDto, @RequestBody AgreeApplyFormDTO agreeApplyFormDTO) { agreeApplyFormDTO.setUserId(tokenDto.getUserId()); agreeApplyFormDTO.setApp(tokenDto.getApp()); @@ -115,7 +119,7 @@ public class ResiGroupMemberController { * @Date 2020/3/30 22:07 **/ @PostMapping("disagreeapply") - public Result disAgreeApply(TokenDto tokenDto, + public Result disAgreeApply(@LoginUser TokenDto tokenDto, @RequestBody DisagreeApplyFormDTO disagreeApplyFormDTO) { disagreeApplyFormDTO.setUserId(tokenDto.getUserId()); ValidatorUtils.validateEntity(disagreeApplyFormDTO); @@ -127,7 +131,7 @@ public class ResiGroupMemberController { * @Description 楼院小组--删除组成员 **/ @PostMapping("removemember") - public Result removeMember(TokenDto tokenDto, @RequestBody RemoveMemberFormDTO removeMemberFormDTO) { + public Result removeMember(@LoginUser TokenDto tokenDto, @RequestBody RemoveMemberFormDTO removeMemberFormDTO) { removeMemberFormDTO.setUserId(tokenDto.getUserId()); removeMemberFormDTO.setApp(tokenDto.getApp()); ValidatorUtils.validateEntity(removeMemberFormDTO); @@ -142,7 +146,7 @@ public class ResiGroupMemberController { * @Description 楼院小组--禁言组员 **/ @PostMapping("slientmember") - public Result slientMember(TokenDto tokenDto, @RequestBody SlientMemberFormDTO slientMemberFormDTO) { + public Result slientMember(@LoginUser TokenDto tokenDto, @RequestBody SlientMemberFormDTO slientMemberFormDTO) { slientMemberFormDTO.setUserId(tokenDto.getUserId()); slientMemberFormDTO.setApp(tokenDto.getApp()); ValidatorUtils.validateEntity(slientMemberFormDTO); diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/controller/ResiTopicController.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/controller/ResiTopicController.java index 6b8af29d96..b8dba5abcc 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/controller/ResiTopicController.java +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/controller/ResiTopicController.java @@ -1,5 +1,6 @@ package com.epmet.modules.topic.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; @@ -8,7 +9,10 @@ import com.epmet.resi.group.dto.topic.form.*; import com.epmet.resi.group.dto.topic.result.ResiTopicDetailResultDTO; import com.epmet.resi.group.dto.topic.result.ResiTopicInfoResultDTO; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.*; +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; @@ -35,7 +39,7 @@ public class ResiTopicController { * @Date 2020.03.31 13:15 **/ @PostMapping("createtopic") - public Result createTopic(TokenDto tokenDto, @RequestBody ResiTopicPublishFormDTO topicPublishFormDTO){ + public Result createTopic(@LoginUser TokenDto tokenDto, @RequestBody ResiTopicPublishFormDTO topicPublishFormDTO){ ValidatorUtils.validateEntity(topicPublishFormDTO); return topicService.createTopic(tokenDto,topicPublishFormDTO); @@ -50,7 +54,7 @@ public class ResiTopicController { * @Date 2020.04.01 23:48 **/ @PostMapping("gettopicdetail") - public Result getTopicDetail(TokenDto tokenDto, @RequestBody ResiTopicDetailFormDTO topicDetailFormDTO ){ + public Result getTopicDetail(@LoginUser TokenDto tokenDto, @RequestBody ResiTopicDetailFormDTO topicDetailFormDTO ){ ValidatorUtils.validateEntity(topicDetailFormDTO); return topicService.getTopicDetail(tokenDto,topicDetailFormDTO.getTopicId()); } @@ -64,7 +68,7 @@ public class ResiTopicController { * @Date 2020.04.01 10:36 **/ @PostMapping("getpasttopiclist") - public Result> getPastTopicList(TokenDto tokenDto, @RequestBody ResiTopicPageFormDTO topicPageFormDTO){ + public Result> getPastTopicList(@LoginUser TokenDto tokenDto, @RequestBody ResiTopicPageFormDTO topicPageFormDTO){ ValidatorUtils.validateEntity(topicPageFormDTO); return topicService.getPastTopicList(tokenDto,topicPageFormDTO); } @@ -78,7 +82,7 @@ public class ResiTopicController { * @Date 2020.04.02 00:01 **/ @PostMapping("getlatesttopics") - Result> getLatestTopics(TokenDto tokenDto, @RequestBody ResiTopicDefaultPageFormDTO topicDefaultPageFormDTO){ + Result> getLatestTopics(@LoginUser TokenDto tokenDto, @RequestBody ResiTopicDefaultPageFormDTO topicDefaultPageFormDTO){ ValidatorUtils.validateEntity(topicDefaultPageFormDTO); return topicService.getLatestTopics(tokenDto,topicDefaultPageFormDTO.getGroupId()); } @@ -92,7 +96,7 @@ public class ResiTopicController { * @Date 2020.04.01 12:38 **/ @RequestMapping("hidetopic") - Result hideTopic(TokenDto tokenDto, @RequestBody ResiTopicOperationFormDTO hiddenFormDTO){ + Result hideTopic(@LoginUser TokenDto tokenDto, @RequestBody ResiTopicOperationFormDTO hiddenFormDTO){ ValidatorUtils.validateEntity(hiddenFormDTO); return topicService.hideTopic(tokenDto,hiddenFormDTO); } @@ -106,7 +110,7 @@ public class ResiTopicController { * @Date 2020.04.01 16:45 **/ @PostMapping("gethiddentopic") - Result> getHiddenTopic(TokenDto tokenDto, @RequestBody ResiTopicPageFormDTO topicPageFormDTO){ + Result> getHiddenTopic(@LoginUser TokenDto tokenDto, @RequestBody ResiTopicPageFormDTO topicPageFormDTO){ ValidatorUtils.validateEntity(topicPageFormDTO); return topicService.getHiddenTopics(tokenDto,topicPageFormDTO); } @@ -120,7 +124,7 @@ public class ResiTopicController { * @Date 2020.04.01 14:17 **/ @PostMapping("cancelhiddentopics") - Result cancelHiddenTopics(TokenDto tokenDto, @RequestBody ResiTopicCancelHiddenFormDTO cancelHiddenFormDTO){ + Result cancelHiddenTopics(@LoginUser TokenDto tokenDto, @RequestBody ResiTopicCancelHiddenFormDTO cancelHiddenFormDTO){ return topicService.cancelHiddenTopics(tokenDto,cancelHiddenFormDTO.getTopicIds()); } @@ -133,7 +137,7 @@ public class ResiTopicController { * @Date 2020.04.01 15:37 **/ @PostMapping("closetopic") - Result closeTopic(TokenDto tokenDto, @RequestBody ResiTopicOperationFormDTO closeFormDTO){ + Result closeTopic(@LoginUser TokenDto tokenDto, @RequestBody ResiTopicOperationFormDTO closeFormDTO){ ValidatorUtils.validateEntity(closeFormDTO); return topicService.closeTopic(tokenDto,closeFormDTO); } diff --git a/epmet-module/resi-guide/resi-guide-server/src/main/java/com/epmet/controller/StrangerResiGuideController.java b/epmet-module/resi-guide/resi-guide-server/src/main/java/com/epmet/controller/StrangerResiGuideController.java index 4e9aa206cc..875d4badd0 100644 --- a/epmet-module/resi-guide/resi-guide-server/src/main/java/com/epmet/controller/StrangerResiGuideController.java +++ b/epmet-module/resi-guide/resi-guide-server/src/main/java/com/epmet/controller/StrangerResiGuideController.java @@ -17,6 +17,7 @@ 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; @@ -53,7 +54,7 @@ public class StrangerResiGuideController { * @Date 2020/3/16 **/ @PostMapping("getgridhome") - public Result getGridHome( TokenDto tokenDTO, @RequestBody StrangerFormDTO strangerFormDTO) throws Exception { + public Result getGridHome(@LoginUser TokenDto tokenDTO, @RequestBody StrangerFormDTO strangerFormDTO) throws Exception { return strangerAccessRecordService.getGridHome(tokenDTO, strangerFormDTO); } diff --git a/epmet-module/resi-guide/resi-guide-server/src/main/java/com/epmet/controller/UserGuideController.java b/epmet-module/resi-guide/resi-guide-server/src/main/java/com/epmet/controller/UserGuideController.java index 81e59f7130..fe4d4d15ea 100644 --- a/epmet-module/resi-guide/resi-guide-server/src/main/java/com/epmet/controller/UserGuideController.java +++ b/epmet-module/resi-guide/resi-guide-server/src/main/java/com/epmet/controller/UserGuideController.java @@ -1,5 +1,6 @@ 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; @@ -26,7 +27,7 @@ public class UserGuideController { private UserAccessService userAccessService; @PostMapping("entergrid") - Result enterGrid(TokenDto token, @RequestBody UserEnterGridFormDTO userEnterGridFormDTO){ + Result enterGrid(@LoginUser TokenDto token, @RequestBody UserEnterGridFormDTO userEnterGridFormDTO){ ValidatorUtils.validateEntity(userEnterGridFormDTO); diff --git a/epmet-module/resi-mine/resi-mine-server/src/main/java/com/epmet/modules/grid/controller/ResiMineGridController.java b/epmet-module/resi-mine/resi-mine-server/src/main/java/com/epmet/modules/grid/controller/ResiMineGridController.java index 1127ec72b5..626f78bfd4 100644 --- a/epmet-module/resi-mine/resi-mine-server/src/main/java/com/epmet/modules/grid/controller/ResiMineGridController.java +++ b/epmet-module/resi-mine/resi-mine-server/src/main/java/com/epmet/modules/grid/controller/ResiMineGridController.java @@ -1,5 +1,6 @@ package com.epmet.modules.grid.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.result.LatestGridInfoResultDTO; @@ -28,7 +29,7 @@ public class ResiMineGridController { * @Date 2020/3/24 11:10 **/ @GetMapping("getlatestgridinfo") - public Result getLatestGridInfo(TokenDto tokenDto){ + public Result getLatestGridInfo(@LoginUser TokenDto tokenDto){ return resiMineGridService.getLatestGridInfo(tokenDto); } } diff --git a/epmet-module/resi-mine/resi-mine-server/src/main/java/com/epmet/modules/message/controller/UserMessageController.java b/epmet-module/resi-mine/resi-mine-server/src/main/java/com/epmet/modules/message/controller/UserMessageController.java index c0c2b493aa..217c08d278 100644 --- a/epmet-module/resi-mine/resi-mine-server/src/main/java/com/epmet/modules/message/controller/UserMessageController.java +++ b/epmet-module/resi-mine/resi-mine-server/src/main/java/com/epmet/modules/message/controller/UserMessageController.java @@ -1,5 +1,6 @@ package com.epmet.modules.message.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; @@ -34,7 +35,7 @@ public class UserMessageController { * @Date 2020/3/29 20:53 **/ @PostMapping("getmymessage") - public Result> getMyMessage(TokenDto tokenDto, + public Result> getMyMessage(@LoginUser TokenDto tokenDto, @RequestBody MymessageFormDTO mymessageFormDTO) { mymessageFormDTO.setUserId(tokenDto.getUserId()); ValidatorUtils.validateEntity(mymessageFormDTO); @@ -63,7 +64,7 @@ public class UserMessageController { * @Date 2020/3/29 21:06 **/ @PostMapping("readallmsg") - public Result readAllMessage(TokenDto tokenDto, @RequestBody UserMessageDTO userMessageDTO) { + public Result readAllMessage(@LoginUser TokenDto tokenDto, @RequestBody UserMessageDTO userMessageDTO) { //逻辑待实现 return userMessageService.readAllMessage(tokenDto, userMessageDTO); } diff --git a/epmet-module/resi-mine/resi-mine-server/src/main/java/com/epmet/modules/partymember/controller/PartyMemberController.java b/epmet-module/resi-mine/resi-mine-server/src/main/java/com/epmet/modules/partymember/controller/PartyMemberController.java index bfa776d92e..379a9491e9 100644 --- a/epmet-module/resi-mine/resi-mine-server/src/main/java/com/epmet/modules/partymember/controller/PartyMemberController.java +++ b/epmet-module/resi-mine/resi-mine-server/src/main/java/com/epmet/modules/partymember/controller/PartyMemberController.java @@ -1,5 +1,6 @@ package com.epmet.modules.partymember.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.modules.partymember.service.PartyMemberService; @@ -33,7 +34,7 @@ public class PartyMemberController { * @return Result */ @PostMapping("init") - public Result init(TokenDto tokenDto, @RequestBody PartyMemberInitFromDTO fromDto) { + public Result init(@LoginUser TokenDto tokenDto, @RequestBody PartyMemberInitFromDTO fromDto) { fromDto.setUserId(tokenDto.getUserId()); return partyMemberService.init(fromDto); } @@ -46,7 +47,7 @@ public class PartyMemberController { * @date 2020/3/30 13:50 */ @PostMapping("getverificationcode") - public Result getVerificationCode(TokenDto tokenDto, @RequestBody VerificationCodeFromDTO fromDto) { + public Result getVerificationCode(@LoginUser TokenDto tokenDto, @RequestBody VerificationCodeFromDTO fromDto) { return partyMemberService.getVerificationCode(tokenDto, fromDto); } @@ -58,7 +59,7 @@ public class PartyMemberController { * @date 2020/3/30 13:50 */ @PostMapping("submit") - public Result submit(TokenDto tokenDto, @RequestBody PartyMemberSubmitFromDTO fromDto) { + public Result submit(@LoginUser TokenDto tokenDto, @RequestBody PartyMemberSubmitFromDTO fromDto) { return partyMemberService.submit(tokenDto, fromDto); } @@ -70,7 +71,7 @@ public class PartyMemberController { * @date 2020/3/30 13:50 */ @PostMapping("extra") - public Result partyMemberInfoExtra(TokenDto tokenDto, @RequestBody PartyMemberSubmitFromDTO fromDto) { + public Result partyMemberInfoExtra(@LoginUser TokenDto tokenDto, @RequestBody PartyMemberSubmitFromDTO fromDto) { return partyMemberService.partyMemberInfoExtra(tokenDto, fromDto); } } diff --git a/epmet-module/resi-mine/resi-mine-server/src/main/java/com/epmet/modules/resiregister/controller/ResiRegisterController.java b/epmet-module/resi-mine/resi-mine-server/src/main/java/com/epmet/modules/resiregister/controller/ResiRegisterController.java index 3a8c6dee7b..e9d591581e 100644 --- a/epmet-module/resi-mine/resi-mine-server/src/main/java/com/epmet/modules/resiregister/controller/ResiRegisterController.java +++ b/epmet-module/resi-mine/resi-mine-server/src/main/java/com/epmet/modules/resiregister/controller/ResiRegisterController.java @@ -1,5 +1,6 @@ package com.epmet.modules.resiregister.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; @@ -33,7 +34,7 @@ public class ResiRegisterController { * @Date 2020/3/30 **/ @PostMapping("init") - public Result init(TokenDto tokenDTO, @RequestBody ResiRegisterFormDTO resiRegisterFormDTO) { + public Result init(@LoginUser TokenDto tokenDTO, @RequestBody ResiRegisterFormDTO resiRegisterFormDTO) { ValidatorUtils.validateEntity(resiRegisterFormDTO); return resiRegisterService.init(tokenDTO, resiRegisterFormDTO); } @@ -44,7 +45,7 @@ public class ResiRegisterController { * @Description 居民端-居民注册信息提交 **/ @PostMapping("submit") - public Result submit(TokenDto tokenDTO, @RequestBody ResiInfoSubmitFormDTO resiInfoSubmitFormDTO) { + public Result submit(@LoginUser TokenDto tokenDTO, @RequestBody ResiInfoSubmitFormDTO resiInfoSubmitFormDTO) { ValidatorUtils.validateEntity(resiInfoSubmitFormDTO); return resiRegisterService.submit(tokenDTO, resiInfoSubmitFormDTO); } @@ -55,7 +56,7 @@ public class ResiRegisterController { * @Description 居民端-居民注册根据手机号获取验证码 **/ @PostMapping("getverificationcode") - public Result getVerificationCode(TokenDto tokenDTO, @RequestBody VerificationCodeFormDTO formDTO) { + public Result getVerificationCode(@LoginUser TokenDto tokenDTO, @RequestBody VerificationCodeFormDTO formDTO) { ValidatorUtils.validateEntity(formDTO); return resiRegisterService.getVerificationCode(tokenDTO, formDTO); } diff --git a/epmet-module/resi-mine/resi-mine-server/src/main/java/com/epmet/modules/warmhearted/controller/ResiWarmheartedController.java b/epmet-module/resi-mine/resi-mine-server/src/main/java/com/epmet/modules/warmhearted/controller/ResiWarmheartedController.java index 9d555d6d40..03283c179a 100644 --- a/epmet-module/resi-mine/resi-mine-server/src/main/java/com/epmet/modules/warmhearted/controller/ResiWarmheartedController.java +++ b/epmet-module/resi-mine/resi-mine-server/src/main/java/com/epmet/modules/warmhearted/controller/ResiWarmheartedController.java @@ -1,5 +1,6 @@ package com.epmet.modules.warmhearted.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; @@ -30,7 +31,7 @@ public class ResiWarmheartedController { * @Description 居民端-热心居民申请页面初始化-查询有无申请、新增访问行为记录数据 **/ @PostMapping("init") - public Result init(TokenDto tokenDTO, @RequestBody ResiWarmheartedFormDTO resiWarmheartedFormDTO) { + public Result init(@LoginUser TokenDto tokenDTO, @RequestBody ResiWarmheartedFormDTO resiWarmheartedFormDTO) { ValidatorUtils.validateEntity(resiWarmheartedFormDTO); return resiWarmheartedService.init(tokenDTO, resiWarmheartedFormDTO); } @@ -41,7 +42,7 @@ public class ResiWarmheartedController { * @Description 居民端-热心居民申请-提交申请数据 **/ @PostMapping("submit") - public Result submit(TokenDto tokenDTO, @RequestBody ResiWarmheartedSubmitFormDTO formDTO) { + public Result submit(@LoginUser TokenDto tokenDTO, @RequestBody ResiWarmheartedSubmitFormDTO formDTO) { ValidatorUtils.validateEntity(formDTO); return resiWarmheartedService.submit(tokenDTO, formDTO); } diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/OperUserController.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/OperUserController.java index b44f404523..acc2bb9e9f 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/OperUserController.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/OperUserController.java @@ -17,6 +17,7 @@ package com.epmet.controller; +import com.epmet.commons.tools.annotation.LoginUser; import com.epmet.commons.tools.page.PageData; import com.epmet.commons.tools.security.dto.TokenDto; import com.epmet.commons.tools.utils.ConvertUtils; @@ -25,8 +26,8 @@ import com.epmet.commons.tools.utils.Result; import com.epmet.commons.tools.validator.AssertUtils; import com.epmet.commons.tools.validator.ValidatorUtils; import com.epmet.commons.tools.validator.group.AddGroup; -import com.epmet.commons.tools.validator.group.UpdateGroup; import com.epmet.commons.tools.validator.group.DefaultGroup; +import com.epmet.commons.tools.validator.group.UpdateGroup; import com.epmet.dto.OperUserDTO; import com.epmet.dto.result.QueryOperUserResultDto; import com.epmet.excel.OperUserExcel; @@ -108,7 +109,7 @@ public class OperUserController { * @author zhaoqifeng */ @GetMapping("queryOperUserDto") - public Result queryOperUserDto(TokenDto tokenDto) { + public Result queryOperUserDto(@LoginUser TokenDto tokenDto) { OperUserDTO data = operUserService.getOperUserInfoById(tokenDto.getUserId()); QueryOperUserResultDto dto = ConvertUtils.sourceToTarget(data, QueryOperUserResultDto.class); return new Result().ok(dto); diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/UserController.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/UserController.java index 8c1930d6ac..6081d38fe1 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/UserController.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/UserController.java @@ -1,5 +1,6 @@ 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; @@ -79,7 +80,7 @@ public class UserController { * @Description 居民端个人信息-同步用户微信信息 **/ @PostMapping("updatewxuserinfo") - public Result updateWxUserInfo(TokenDto tokenDTO, @RequestBody WxUserInfoFormDTO wxUserInfoFormDTO) { + public Result updateWxUserInfo(@LoginUser TokenDto tokenDTO, @RequestBody WxUserInfoFormDTO wxUserInfoFormDTO) { wxUserInfoFormDTO.setUserId(tokenDTO.getUserId()); ValidatorUtils.validateEntity(wxUserInfoFormDTO); return userService.updateWxUserInfo(wxUserInfoFormDTO); From fd166da9645e03b094f7ef7baeb01b7bd7b4d2b1 Mon Sep 17 00:00:00 2001 From: yinzuomei <576302893@qq.com> Date: Tue, 21 Apr 2020 16:43:06 +0800 Subject: [PATCH 13/85] =?UTF-8?q?orgId=E6=94=B9=E4=B8=BAagencyId?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/impl/GovLoginServiceImpl.java | 8 ++++---- .../tools/security/dto/GovTokenDto.java | 2 +- .../form/StaffLoginAgencyRecordFormDTO.java | 2 +- .../dto/result/StaffLatestAgencyResultDTO.java | 2 +- .../resources/mapper/StaffAgencyVisitedDao.xml | 18 +++++++++--------- 5 files changed, 16 insertions(+), 16 deletions(-) diff --git a/epmet-auth/src/main/java/com/epmet/service/impl/GovLoginServiceImpl.java b/epmet-auth/src/main/java/com/epmet/service/impl/GovLoginServiceImpl.java index 85c6991c39..c9b5d05ac2 100644 --- a/epmet-auth/src/main/java/com/epmet/service/impl/GovLoginServiceImpl.java +++ b/epmet-auth/src/main/java/com/epmet/service/impl/GovLoginServiceImpl.java @@ -156,7 +156,7 @@ public class GovLoginServiceImpl implements GovLoginService { govTokenDto.setToken(token); govTokenDto.setUpdateTime(System.currentTimeMillis()); govTokenDto.setExpireTime(jwtTokenUtils.getExpiration(token).getTime()); - govTokenDto.setOrgId(staffLatestAgency.getOrgId()); + govTokenDto.setAgencyId(staffLatestAgency.getAgencyId()); govTokenDto.setCustomerId(staffLatestAgency.getCustomerId()); cpUserDetailRedis.set(govTokenDto, expire); logger.info("截止时间:" + DateUtils.format(jwtTokenUtils.getExpiration(token), "yyyy-MM-dd HH:mm:ss")); @@ -169,7 +169,7 @@ public class GovLoginServiceImpl implements GovLoginService { staffLoginAgencyRecordFormDTO.setStaffId(latestStaffWechatLoginDTO.getStaffId()); staffLoginAgencyRecordFormDTO.setWxOpenId(latestStaffWechatLoginDTO.getWxOpenId()); staffLoginAgencyRecordFormDTO.setMobile(latestStaffWechatLoginDTO.getMobile()); - staffLoginAgencyRecordFormDTO.setOrgId(latestStaffWechatLoginDTO.getOrgId()); + staffLoginAgencyRecordFormDTO.setAgencyId(latestStaffWechatLoginDTO.getAgencyId()); Result staffLoginRecordResult = epmetUserFeignClient.saveStaffLoginRecord(staffLoginAgencyRecordFormDTO); return staffLoginRecordResult; } @@ -208,7 +208,7 @@ public class GovLoginServiceImpl implements GovLoginService { staffLoginAgencyRecordFormDTO.setStaffId(staffId); staffLoginAgencyRecordFormDTO.setWxOpenId(openId); staffLoginAgencyRecordFormDTO.setMobile(formDTO.getMobile()); - staffLoginAgencyRecordFormDTO.setOrgId(formDTO.getOrgId()); + staffLoginAgencyRecordFormDTO.setAgencyId(formDTO.getOrgId()); Result staffLoginRecordResult = epmetUserFeignClient.saveStaffLoginRecord(staffLoginAgencyRecordFormDTO); return staffLoginRecordResult; } @@ -263,7 +263,7 @@ public class GovLoginServiceImpl implements GovLoginService { govTokenDto.setToken(token); govTokenDto.setUpdateTime(System.currentTimeMillis()); govTokenDto.setExpireTime(jwtTokenUtils.getExpiration(token).getTime()); - govTokenDto.setOrgId(orgId); + govTokenDto.setAgencyId(orgId); govTokenDto.setCustomerId(customerId); cpUserDetailRedis.set(govTokenDto, expire); logger.info("截止时间:" + DateUtils.format(jwtTokenUtils.getExpiration(token), "yyyy-MM-dd HH:mm:ss")); diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/security/dto/GovTokenDto.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/security/dto/GovTokenDto.java index e2b6b18bda..182a6b0576 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/security/dto/GovTokenDto.java +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/security/dto/GovTokenDto.java @@ -65,7 +65,7 @@ public class GovTokenDto implements Serializable { /** * 当前登录的组织id(顶级) */ - private String orgId; + private String agencyId; /** * 当前网格对应的组织结构id的全路径用:隔开 diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/StaffLoginAgencyRecordFormDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/StaffLoginAgencyRecordFormDTO.java index ad67aba726..6bfb38de7b 100644 --- a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/StaffLoginAgencyRecordFormDTO.java +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/StaffLoginAgencyRecordFormDTO.java @@ -34,7 +34,7 @@ public class StaffLoginAgencyRecordFormDTO implements Serializable { /** * 组织机构id */ - private String orgId; + private String agencyId; } diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/StaffLatestAgencyResultDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/StaffLatestAgencyResultDTO.java index 4b006dd8e6..45dcef0416 100644 --- a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/StaffLatestAgencyResultDTO.java +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/StaffLatestAgencyResultDTO.java @@ -36,6 +36,6 @@ public class StaffLatestAgencyResultDTO implements Serializable { /** * 组织机构id */ - private String orgId; + private String agencyId; } diff --git a/epmet-user/epmet-user-server/src/main/resources/mapper/StaffAgencyVisitedDao.xml b/epmet-user/epmet-user-server/src/main/resources/mapper/StaffAgencyVisitedDao.xml index 687edca880..d211f53ac4 100644 --- a/epmet-user/epmet-user-server/src/main/resources/mapper/StaffAgencyVisitedDao.xml +++ b/epmet-user/epmet-user-server/src/main/resources/mapper/StaffAgencyVisitedDao.xml @@ -21,18 +21,18 @@ \ No newline at end of file From 142dead6b2cc828f4e037f85e90f66770a7b9d1f Mon Sep 17 00:00:00 2001 From: yinzuomei <576302893@qq.com> Date: Tue, 21 Apr 2020 18:47:20 +0800 Subject: [PATCH 14/85] =?UTF-8?q?=E9=80=89=E6=8B=A9=E7=BB=84=E7=BB=87?= =?UTF-8?q?=EF=BC=8C=E8=BF=9B=E5=85=A5=E9=A6=96=E9=A1=B5=E5=85=A5=E5=8F=82?= =?UTF-8?q?Dto=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/com/epmet/dto/form/GovWxmpEnteOrgFormDTO.java | 2 +- .../main/java/com/epmet/service/impl/GovLoginServiceImpl.java | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/epmet-auth/src/main/java/com/epmet/dto/form/GovWxmpEnteOrgFormDTO.java b/epmet-auth/src/main/java/com/epmet/dto/form/GovWxmpEnteOrgFormDTO.java index 8655268c8e..42920853ee 100644 --- a/epmet-auth/src/main/java/com/epmet/dto/form/GovWxmpEnteOrgFormDTO.java +++ b/epmet-auth/src/main/java/com/epmet/dto/form/GovWxmpEnteOrgFormDTO.java @@ -34,6 +34,6 @@ public class GovWxmpEnteOrgFormDTO implements Serializable { * 选择的要进入的组织(根组织id) */ @NotBlank(message = "组织id不能为空") - private String orgId; + private String agencyId; } diff --git a/epmet-auth/src/main/java/com/epmet/service/impl/GovLoginServiceImpl.java b/epmet-auth/src/main/java/com/epmet/service/impl/GovLoginServiceImpl.java index c9b5d05ac2..75cf5d7300 100644 --- a/epmet-auth/src/main/java/com/epmet/service/impl/GovLoginServiceImpl.java +++ b/epmet-auth/src/main/java/com/epmet/service/impl/GovLoginServiceImpl.java @@ -195,7 +195,7 @@ public class GovLoginServiceImpl implements GovLoginService { //1、获取用户token String token = this.generateGovWxmpToken(customerStaff.getUserId()); //2、保存到redis - this.saveGovTokenDto(formDTO.getOrgId(), formDTO.getCustomerId(), customerStaff.getUserId(), wxMaJscode2SessionResult, token); + this.saveGovTokenDto(formDTO.getAgencyId(), formDTO.getCustomerId(), customerStaff.getUserId(), wxMaJscode2SessionResult, token); UserTokenResultDTO userTokenResultDTO = new UserTokenResultDTO(); userTokenResultDTO.setToken(token); return new Result().ok(userTokenResultDTO); @@ -208,7 +208,7 @@ public class GovLoginServiceImpl implements GovLoginService { staffLoginAgencyRecordFormDTO.setStaffId(staffId); staffLoginAgencyRecordFormDTO.setWxOpenId(openId); staffLoginAgencyRecordFormDTO.setMobile(formDTO.getMobile()); - staffLoginAgencyRecordFormDTO.setAgencyId(formDTO.getOrgId()); + staffLoginAgencyRecordFormDTO.setAgencyId(formDTO.getAgencyId()); Result staffLoginRecordResult = epmetUserFeignClient.saveStaffLoginRecord(staffLoginAgencyRecordFormDTO); return staffLoginRecordResult; } From d551b175f95005472d650bcd7be483d42fece00c Mon Sep 17 00:00:00 2001 From: wxz Date: Tue, 21 Apr 2020 18:47:42 +0800 Subject: [PATCH 15/85] =?UTF-8?q?1.=E8=B0=83=E6=95=B4=E6=8B=A6=E6=88=AATok?= =?UTF-8?q?enDto=20Filter=E7=9A=84=E9=80=BB=E8=BE=91=EF=BC=8C=E5=A2=9E?= =?UTF-8?q?=E5=8A=A0BaseTokenDto?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../tools/security/dto/BaseTokenDto.java | 42 ++++++++++++++++ .../tools/security/dto/GovTokenDto.java | 41 +++++----------- .../commons/tools/security/dto/TokenDto.java | 22 +-------- .../filter/CpAuthGatewayFilterFactory.java | 48 +++++++++++++------ .../com/epmet/filter/FeignRequestFilter.java | 14 ++++-- .../com/epmet/filter/UserTokenFilter.java | 27 ++++------- 6 files changed, 108 insertions(+), 86 deletions(-) create mode 100644 epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/security/dto/BaseTokenDto.java diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/security/dto/BaseTokenDto.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/security/dto/BaseTokenDto.java new file mode 100644 index 0000000000..c3065c7200 --- /dev/null +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/security/dto/BaseTokenDto.java @@ -0,0 +1,42 @@ +package com.epmet.commons.tools.security.dto; + +import lombok.Data; + +@Data +public class BaseTokenDto { + /** + * 政府端:gov、居民端:resi、运营端:oper + */ + private String app; + + /** + * PC端:web、微信小程序:wxmp + */ + private String client; + + /** + * 用户ID + */ + private String userId; + + /** + * token字符串 + */ + private String token; + + public BaseTokenDto() { + } + + public BaseTokenDto(String app, String client, String userId) { + this.app = app; + this.client = client; + this.userId = userId; + } + + public BaseTokenDto(String app, String client, String userId, String token) { + this.app = app; + this.client = client; + this.userId = userId; + this.token = token; + } +} diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/security/dto/GovTokenDto.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/security/dto/GovTokenDto.java index 182a6b0576..2a8fd7c05b 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/security/dto/GovTokenDto.java +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/security/dto/GovTokenDto.java @@ -11,21 +11,7 @@ import java.util.List; * @Date 2020/4/20 11:01 */ @Data -public class GovTokenDto implements Serializable { - /** - * 政府端:gov、居民端:resi、运营端:oper - */ - private String app; - - /** - * PC端:web、微信小程序:wxmp - */ - private String client; - - /** - * 用户ID - */ - private String userId; +public class GovTokenDto extends BaseTokenDto implements Serializable { /** * sessionKey @@ -42,21 +28,6 @@ public class GovTokenDto implements Serializable { */ private String unionId; - /** - * token字符串 - */ - private String token; - - /** - * 过期时间戳 - */ - private Long expireTime; - - /** - * 最后一次更新时间 - */ - private long updateTime; - /** * 当前工作人员进入的客户id */ @@ -81,5 +52,15 @@ public class GovTokenDto implements Serializable { * 部门id列表 */ private List deptIdList; + + /** + * 过期时间戳 + */ + private Long expireTime; + + /** + * 最后一次更新时间 + */ + private long updateTime; } diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/security/dto/TokenDto.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/security/dto/TokenDto.java index fb8a5dd7ec..402dfc1b59 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/security/dto/TokenDto.java +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/security/dto/TokenDto.java @@ -11,22 +11,8 @@ import java.io.Serializable; * @Date 2020-03-14 */ @Data -public class TokenDto implements Serializable { +public class TokenDto extends BaseTokenDto implements Serializable { private static final long serialVersionUID = 8883581762088390769L; - /** - * 政府端:gov、居民端:resi、运营端:oper - */ - private String app; - - /** - * PC端:web、微信小程序:wxmp - */ - private String client; - - /** - * 用户ID - */ - private String userId; /** * sessionKey @@ -43,11 +29,6 @@ public class TokenDto implements Serializable { */ private String unionId; - /** - * token字符串 - */ - private String token; - /** * 过期时间戳 */ @@ -57,4 +38,5 @@ public class TokenDto implements Serializable { * 最后一次更新时间 */ private long updateTime; + } diff --git a/epmet-gateway/src/main/java/com/epmet/filter/CpAuthGatewayFilterFactory.java b/epmet-gateway/src/main/java/com/epmet/filter/CpAuthGatewayFilterFactory.java index e398b5978a..c4687b2ea6 100644 --- a/epmet-gateway/src/main/java/com/epmet/filter/CpAuthGatewayFilterFactory.java +++ b/epmet-gateway/src/main/java/com/epmet/filter/CpAuthGatewayFilterFactory.java @@ -6,6 +6,7 @@ import com.epmet.common.token.enums.ErrorCode; import com.epmet.commons.tools.constant.AppClientConstant; import com.epmet.commons.tools.constant.Constant; import com.epmet.commons.tools.exception.RenException; +import com.epmet.commons.tools.security.dto.BaseTokenDto; import com.epmet.commons.tools.security.dto.TokenDto; import com.epmet.commons.tools.utils.CpUserDetailRedis; import com.epmet.commons.tools.utils.Result; @@ -91,24 +92,22 @@ public class CpAuthGatewayFilterFactory extends AbstractGatewayFilterFactory().error(ErrorCode.ERR10005.getCode(),ErrorCode.ERR10005.getMsg())); } try { + BaseTokenDto baseTokenDto = getBaseTokenDto(token, jwtTokenUtils); + validateTokenDto(baseTokenDto, token); + //当前登录用户userId,添加到header中 - TokenDto user = getLoginUserInfoByToken(token, jwtTokenUtils, cpUserDetailRedis); - if (user != null) { - String redisKey = user.getApp() + "-" + user.getClient() + "-" + user.getUserId(); - logger.info("redisKey=" + redisKey); - ServerHttpRequest build = exchange.getRequest().mutate() - .header(Constant.APP_USER_KEY, redisKey) - .header(AppClientConstant.APP,user.getApp()) - .header(AppClientConstant.CLIENT,user.getClient()) - .header(AppClientConstant.USER_ID,user.getUserId()) - .build(); - return chain.filter(exchange.mutate().request(build).build()); - } + String redisKey = baseTokenDto.getApp() + "-" + baseTokenDto.getClient() + "-" + baseTokenDto.getUserId(); + logger.info("redisKey=" + redisKey); + ServerHttpRequest build = exchange.getRequest().mutate() + .header(Constant.APP_USER_KEY, redisKey) + .header(AppClientConstant.APP,baseTokenDto.getApp()) + .header(AppClientConstant.CLIENT,baseTokenDto.getClient()) + .header(AppClientConstant.USER_ID,baseTokenDto.getUserId()) + .build(); + return chain.filter(exchange.mutate().request(build).build()); }catch(RenException e){ return response(exchange,new Result<>().error(e.getCode(),e.getMsg())); } - - return chain.filter(exchange); }; } @@ -182,4 +181,25 @@ public class CpAuthGatewayFilterFactory extends AbstractGatewayFilterFactory T getLoginUserInfoByToken(String token, JwtTokenUtils jwtTokenUtils, CpUserDetailRedis cpUserDetailRedis, Class clz) { + BaseTokenDto baseTokenDto = getBaseTokenDto(token, jwtTokenUtils); + //查询Redis + T tokenDto = (T)cpUserDetailRedis.get(baseTokenDto.getApp(), baseTokenDto.getClient(), baseTokenDto.getUserId()); return tokenDto; } From 1314211d3981324a5c5339aeb16dc1c312445075 Mon Sep 17 00:00:00 2001 From: yinzuomei <576302893@qq.com> Date: Tue, 21 Apr 2020 19:03:07 +0800 Subject: [PATCH 16/85] =?UTF-8?q?=E5=BE=AE=E4=BF=A1=E5=B0=8F=E7=A8=8B?= =?UTF-8?q?=E5=BA=8Fid=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- epmet-auth/pom.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/epmet-auth/pom.xml b/epmet-auth/pom.xml index 93feb4625c..d7f65bb65c 100644 --- a/epmet-auth/pom.xml +++ b/epmet-auth/pom.xml @@ -156,8 +156,8 @@ wx9b6102a8ee5add65 16fdb68bc2b3e732324ba5d8b8a9b5e2 - wx3d1372029eb816a3 - 651f02d71ed3f123dfb584b8bf0f4d8b + wx3d1372029eb816a3 + 651f02d71ed3f123dfb584b8bf0f4d8b From 022bf25985d87aca78c648d1a5c66a44b0448b27 Mon Sep 17 00:00:00 2001 From: wxz Date: Tue, 21 Apr 2020 19:06:59 +0800 Subject: [PATCH 17/85] =?UTF-8?q?1.=E8=B0=83=E6=95=B4=E6=8B=A6=E6=88=AATok?= =?UTF-8?q?enDto=20Filter=E7=9A=84=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/epmet/common/token/util/TokenUtil.java | 5 ----- .../epmet/commons/tools/utils/CpUserDetailRedis.java | 6 ++---- .../com/epmet/filter/CpAuthGatewayFilterFactory.java | 11 ++++++++++- .../main/java/com/epmet/filter/UserTokenFilter.java | 3 +-- 4 files changed, 13 insertions(+), 12 deletions(-) diff --git a/epmet-commons/epmet-common-clienttoken/src/main/java/com/epmet/common/token/util/TokenUtil.java b/epmet-commons/epmet-common-clienttoken/src/main/java/com/epmet/common/token/util/TokenUtil.java index efefc5e16a..8042695c85 100644 --- a/epmet-commons/epmet-common-clienttoken/src/main/java/com/epmet/common/token/util/TokenUtil.java +++ b/epmet-commons/epmet-common-clienttoken/src/main/java/com/epmet/common/token/util/TokenUtil.java @@ -25,11 +25,6 @@ public class TokenUtil { @Autowired private CpUserDetailRedis redisUtils; - public TokenDto getTokenInfo(String app, String client, String userId) { - TokenDto tokenDto = redisUtils.get(app,client,userId); - return tokenDto; - } - public void expireToken(String app,String client,String userId) { redisUtils.logout(app,client,userId); } diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/CpUserDetailRedis.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/CpUserDetailRedis.java index 9d3e2c3083..4c0845fc6c 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/CpUserDetailRedis.java +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/CpUserDetailRedis.java @@ -49,7 +49,7 @@ public class CpUserDetailRedis { * @param userId oper_user、customer_user、customer_staff表主键 * @return */ - public TokenDto get(String app, String client, String userId) { + public T get(String app, String client, String userId, Class clz) { String key = RedisKeys.getCpUserKey(app,client,userId); Map map = redisUtils.hGetAll(key); @@ -58,9 +58,7 @@ public class CpUserDetailRedis { } //map to bean - TokenDto user = BeanUtil.mapToBean(map, TokenDto.class, true); - - return user; + return BeanUtil.mapToBean(map, clz, true); } /** diff --git a/epmet-gateway/src/main/java/com/epmet/filter/CpAuthGatewayFilterFactory.java b/epmet-gateway/src/main/java/com/epmet/filter/CpAuthGatewayFilterFactory.java index c4687b2ea6..ba348745d9 100644 --- a/epmet-gateway/src/main/java/com/epmet/filter/CpAuthGatewayFilterFactory.java +++ b/epmet-gateway/src/main/java/com/epmet/filter/CpAuthGatewayFilterFactory.java @@ -7,6 +7,7 @@ import com.epmet.commons.tools.constant.AppClientConstant; import com.epmet.commons.tools.constant.Constant; import com.epmet.commons.tools.exception.RenException; import com.epmet.commons.tools.security.dto.BaseTokenDto; +import com.epmet.commons.tools.security.dto.GovTokenDto; import com.epmet.commons.tools.security.dto.TokenDto; import com.epmet.commons.tools.utils.CpUserDetailRedis; import com.epmet.commons.tools.utils.Result; @@ -93,7 +94,15 @@ public class CpAuthGatewayFilterFactory extends AbstractGatewayFilterFactory T getLoginUserInfoByToken(String token, JwtTokenUtils jwtTokenUtils, CpUserDetailRedis cpUserDetailRedis, Class clz) { BaseTokenDto baseTokenDto = getBaseTokenDto(token, jwtTokenUtils); //查询Redis - T tokenDto = (T)cpUserDetailRedis.get(baseTokenDto.getApp(), baseTokenDto.getClient(), baseTokenDto.getUserId()); - return tokenDto; + return cpUserDetailRedis.get(baseTokenDto.getApp(), baseTokenDto.getClient(), baseTokenDto.getUserId(), clz); } } From d85b33f637114ad69e4e77ed3ce5f819f93fd9d7 Mon Sep 17 00:00:00 2001 From: yinzuomei <576302893@qq.com> Date: Tue, 21 Apr 2020 22:48:15 +0800 Subject: [PATCH 18/85] =?UTF-8?q?=E5=88=A0=E9=99=A4ErrorCode?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../epmet/controller/GovLoginController.java | 13 +++++ .../com/epmet/service/GovLoginService.java | 10 ++++ .../service/impl/GovLoginServiceImpl.java | 16 +++++- .../epmet/service/impl/LoginServiceImpl.java | 2 +- .../epmet/common/token/enums/ErrorCode.java | 51 ------------------- .../epmet/common/token/error/IErrorCode.java | 11 ---- .../tools/exception/EpmetErrorCode.java | 5 ++ .../filter/CpAuthGatewayFilterFactory.java | 10 ++-- .../com/epmet/filter/FeignRequestFilter.java | 5 -- .../com/epmet/filter/UserTokenFilter.java | 5 +- .../com/epmet/dto/form/StaffOrgFormDTO.java | 4 ++ .../epmet/controller/CustomerController.java | 6 +-- .../controller/UserMessageController.java | 11 ++-- 13 files changed, 59 insertions(+), 90 deletions(-) delete mode 100644 epmet-commons/epmet-common-clienttoken/src/main/java/com/epmet/common/token/enums/ErrorCode.java delete mode 100644 epmet-commons/epmet-common-clienttoken/src/main/java/com/epmet/common/token/error/IErrorCode.java diff --git a/epmet-auth/src/main/java/com/epmet/controller/GovLoginController.java b/epmet-auth/src/main/java/com/epmet/controller/GovLoginController.java index ea4b5c8974..886fb67bd0 100644 --- a/epmet-auth/src/main/java/com/epmet/controller/GovLoginController.java +++ b/epmet-auth/src/main/java/com/epmet/controller/GovLoginController.java @@ -1,5 +1,7 @@ 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.GovWxmpEnteOrgFormDTO; @@ -80,5 +82,16 @@ public class GovLoginController { return govLoginService.enterOrg(formDTO); } + /** + * @param tokenDto + * @return com.epmet.commons.tools.utils.Result + * @Author yinzuomei + * @Description 政府端小程序退出 + * @Date 2020/4/21 22:22 + **/ + @PostMapping("/loginwxmp/loginout") + public Result loginOut(@LoginUser TokenDto tokenDto) { + return govLoginService.loginOut(tokenDto); + } } diff --git a/epmet-auth/src/main/java/com/epmet/service/GovLoginService.java b/epmet-auth/src/main/java/com/epmet/service/GovLoginService.java index 8e98ad44de..f61e9c8fab 100644 --- a/epmet-auth/src/main/java/com/epmet/service/GovLoginService.java +++ b/epmet-auth/src/main/java/com/epmet/service/GovLoginService.java @@ -1,5 +1,6 @@ package com.epmet.service; +import com.epmet.commons.tools.security.dto.TokenDto; import com.epmet.commons.tools.utils.Result; import com.epmet.dto.form.GovWxmpEnteOrgFormDTO; import com.epmet.dto.form.GovWxmpFormDTO; @@ -51,4 +52,13 @@ public interface GovLoginService { * @Date 2020/4/20 13:08 **/ Result enterOrg(GovWxmpEnteOrgFormDTO formDTO); + + /** + * @return com.epmet.commons.tools.utils.Result + * @param tokenDto + * @Author yinzuomei + * @Description 政府端工作人员退出登录 + * @Date 2020/4/21 22:08 + **/ + Result loginOut(TokenDto tokenDto); } diff --git a/epmet-auth/src/main/java/com/epmet/service/impl/GovLoginServiceImpl.java b/epmet-auth/src/main/java/com/epmet/service/impl/GovLoginServiceImpl.java index 75cf5d7300..2c0300a947 100644 --- a/epmet-auth/src/main/java/com/epmet/service/impl/GovLoginServiceImpl.java +++ b/epmet-auth/src/main/java/com/epmet/service/impl/GovLoginServiceImpl.java @@ -3,14 +3,18 @@ package com.epmet.service.impl; import cn.binarywang.wx.miniapp.bean.WxMaJscode2SessionResult; import com.epmet.common.token.constant.LoginConstant; import com.epmet.commons.tools.exception.EpmetErrorCode; +import com.epmet.commons.tools.exception.RenException; import com.epmet.commons.tools.security.dto.GovTokenDto; +import com.epmet.commons.tools.security.dto.TokenDto; import com.epmet.commons.tools.utils.CpUserDetailRedis; import com.epmet.commons.tools.utils.DateUtils; import com.epmet.commons.tools.utils.Result; import com.epmet.commons.tools.validator.PhoneValidatorUtils; import com.epmet.dto.CustomerStaffDTO; import com.epmet.dto.form.*; -import com.epmet.dto.result.*; +import com.epmet.dto.result.StaffLatestAgencyResultDTO; +import com.epmet.dto.result.StaffOrgsResultDTO; +import com.epmet.dto.result.UserTokenResultDTO; import com.epmet.feign.EpmetUserFeignClient; import com.epmet.feign.GovOrgFeignClient; import com.epmet.feign.MessageFeignClient; @@ -201,6 +205,16 @@ public class GovLoginServiceImpl implements GovLoginService { return new Result().ok(userTokenResultDTO); } + @Override + public Result loginOut(TokenDto tokenDto) { + if(null == tokenDto){ + logger.error("token解析失败,直接跳转重新登录即可"); + throw new RenException("当前用户信息获取失败"); + } + cpUserDetailRedis.logout(tokenDto.getApp() , tokenDto.getClient() , tokenDto.getUserId()); + return new Result(); + } + //保存登录日志 private Result saveStaffLoginRecord(GovWxmpEnteOrgFormDTO formDTO, String staffId, String openId) { StaffLoginAgencyRecordFormDTO staffLoginAgencyRecordFormDTO = new StaffLoginAgencyRecordFormDTO(); diff --git a/epmet-auth/src/main/java/com/epmet/service/impl/LoginServiceImpl.java b/epmet-auth/src/main/java/com/epmet/service/impl/LoginServiceImpl.java index 225e2520fb..f3cef61f98 100644 --- a/epmet-auth/src/main/java/com/epmet/service/impl/LoginServiceImpl.java +++ b/epmet-auth/src/main/java/com/epmet/service/impl/LoginServiceImpl.java @@ -313,7 +313,7 @@ public class LoginServiceImpl implements LoginService { } cpUserDetailRedis.logout(tokenDto.getApp() , tokenDto.getClient() , tokenDto.getUserId()); //web端清空菜单栏和权限 - return new Result().ok("退出登录!"); + return new Result(); } /** diff --git a/epmet-commons/epmet-common-clienttoken/src/main/java/com/epmet/common/token/enums/ErrorCode.java b/epmet-commons/epmet-common-clienttoken/src/main/java/com/epmet/common/token/enums/ErrorCode.java deleted file mode 100644 index 9296333cac..0000000000 --- a/epmet-commons/epmet-common-clienttoken/src/main/java/com/epmet/common/token/enums/ErrorCode.java +++ /dev/null @@ -1,51 +0,0 @@ -package com.epmet.common.token.enums; - - -import com.epmet.common.token.error.IErrorCode; - -/** - * client token错误码 - * - * @author rongchao - * @Date 18-11-24 - */ -public enum ErrorCode implements IErrorCode { - - SUCCESS(0, "请求成功"), - - ERR10001(10001, "token解析失败"), - ERR10002(10002, "token失效"), - ERR10003(10003, "token生成失败,请重试。"), - ERR10004(10004, "返回的Object类型不是EsuaResponse,无法添加token!"), - ERR10005(10005, "token不能为空"), - ERR10006(10006, "登录超时,请重新登录"), - ERR10007(10007, "当前帐号已在别处登录"), - - ERR500(500, "Internal Server Error"), - ERR501(501, "参数绑定异常"), - ERR401(401, "未授权"), - - - ERR(ErrorCode.COMMON_ERR_CODE, "其他异常"); - - private int code; - - private String msg; - - ErrorCode(final int code, final String msg) { - this.code = code; - this.msg = msg; - } - - public static final int COMMON_ERR_CODE = -1; - - @Override - public int getCode() { - return code; - } - - @Override - public String getMsg() { - return msg; - } -} diff --git a/epmet-commons/epmet-common-clienttoken/src/main/java/com/epmet/common/token/error/IErrorCode.java b/epmet-commons/epmet-common-clienttoken/src/main/java/com/epmet/common/token/error/IErrorCode.java deleted file mode 100644 index 9b58ccc96e..0000000000 --- a/epmet-commons/epmet-common-clienttoken/src/main/java/com/epmet/common/token/error/IErrorCode.java +++ /dev/null @@ -1,11 +0,0 @@ -package com.epmet.common.token.error; - -/** - * @author rongchao - * @Date 18-11-20 - */ -public interface IErrorCode { - int getCode(); - - String getMsg(); -} diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java index 230c53fbc8..0ddc89d09b 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java @@ -6,6 +6,11 @@ package com.epmet.commons.tools.exception; * @Description: */ public enum EpmetErrorCode { + ERR10005(10005, "token不能为空"), + ERR10006(10006, "登录超时,请重新登录"), + ERR10007(10007, "当前帐号已在别处登录"), + ERR401(401, "未授权"), + SERVER_ERROR(8000, "服务器开小差了..."), CANNOT_JOIN_GROUP(8001, "只有认证党员和居民才可以加入小组,请选择您的身份"), CANNOT_CREATE_GROUP(8002, "只有党员和热心居民才能创建小组,请选择您的身份"), diff --git a/epmet-gateway/src/main/java/com/epmet/filter/CpAuthGatewayFilterFactory.java b/epmet-gateway/src/main/java/com/epmet/filter/CpAuthGatewayFilterFactory.java index ba348745d9..d3c7d60b6d 100644 --- a/epmet-gateway/src/main/java/com/epmet/filter/CpAuthGatewayFilterFactory.java +++ b/epmet-gateway/src/main/java/com/epmet/filter/CpAuthGatewayFilterFactory.java @@ -2,9 +2,9 @@ package com.epmet.filter; import com.alibaba.fastjson.JSON; -import com.epmet.common.token.enums.ErrorCode; import com.epmet.commons.tools.constant.AppClientConstant; import com.epmet.commons.tools.constant.Constant; +import com.epmet.commons.tools.exception.EpmetErrorCode; import com.epmet.commons.tools.exception.RenException; import com.epmet.commons.tools.security.dto.BaseTokenDto; import com.epmet.commons.tools.security.dto.GovTokenDto; @@ -12,7 +12,6 @@ import com.epmet.commons.tools.security.dto.TokenDto; import com.epmet.commons.tools.utils.CpUserDetailRedis; import com.epmet.commons.tools.utils.Result; import com.epmet.jwt.JwtTokenUtils; -import io.jsonwebtoken.Claims; import org.apache.commons.lang3.StringUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -33,7 +32,6 @@ import reactor.core.publisher.Mono; import java.nio.charset.StandardCharsets; import java.util.Arrays; import java.util.List; -import java.util.function.Consumer; /** * app接口权限过滤器 @@ -90,7 +88,7 @@ public class CpAuthGatewayFilterFactory extends AbstractGatewayFilterFactory().error(ErrorCode.ERR10005.getCode(),ErrorCode.ERR10005.getMsg())); + return response(exchange,new Result<>().error(EpmetErrorCode.ERR10005.getCode(),EpmetErrorCode.ERR10005.getMsg())); } try { BaseTokenDto baseTokenDto = getBaseTokenDto(token, jwtTokenUtils); @@ -199,7 +197,7 @@ public class CpAuthGatewayFilterFactory extends AbstractGatewayFilterFactory customerIdList; } diff --git a/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/controller/CustomerController.java b/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/controller/CustomerController.java index 87b1f0f38b..4beebeae8d 100644 --- a/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/controller/CustomerController.java +++ b/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/controller/CustomerController.java @@ -17,10 +17,7 @@ package com.epmet.controller; -import com.alibaba.fastjson.JSON; -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; @@ -133,8 +130,7 @@ public class CustomerController { * @Date 2020/3/11 21:58 **/ @GetMapping("getvalidcustomerlist") - public Result> getValidCustomerList(@LoginUser TokenDto tokenDTO) { - logger.info("getvalidcustomerlist:"+ JSON.toJSONString(tokenDTO)); + public Result> getValidCustomerList() { return customerService.getValidCustomerList(); } } diff --git a/epmet-module/resi-mine/resi-mine-server/src/main/java/com/epmet/modules/message/controller/UserMessageController.java b/epmet-module/resi-mine/resi-mine-server/src/main/java/com/epmet/modules/message/controller/UserMessageController.java index 217c08d278..e7d2ed2bf2 100644 --- a/epmet-module/resi-mine/resi-mine-server/src/main/java/com/epmet/modules/message/controller/UserMessageController.java +++ b/epmet-module/resi-mine/resi-mine-server/src/main/java/com/epmet/modules/message/controller/UserMessageController.java @@ -30,7 +30,7 @@ public class UserMessageController { /** * @param * @return com.epmet.commons.tools.utils.Result - * @Author yinzuomei + * @Author zhaoqifeng * @Description 查询我的消息 * @Date 2020/3/29 20:53 **/ @@ -39,33 +39,30 @@ public class UserMessageController { @RequestBody MymessageFormDTO mymessageFormDTO) { mymessageFormDTO.setUserId(tokenDto.getUserId()); ValidatorUtils.validateEntity(mymessageFormDTO); - //逻辑待实现 return userMessageService.getMessageList(tokenDto, mymessageFormDTO); } /** * @param fromDTO * @return com.epmet.commons.tools.utils.Result - * @Author yinzuomei + * @Author zhaoqifeng * @Description 单条消息标记为已读 * @Date 2020/3/29 21:05 **/ @PostMapping("readmsg") - public Result readMessage(@RequestBody ReadMessageFromDTO fromDTO) { - //逻辑待实现 + public Result readMessage(@LoginUser TokenDto tokenDto,@RequestBody ReadMessageFromDTO fromDTO) { return userMessageService.readMessage(fromDTO.getMessageId()); } /** * @param tokenDto * @return com.epmet.commons.tools.utils.Result - * @Author yinzuomei + * @Author zhaoqifeng * @Description 全部已读 * @Date 2020/3/29 21:06 **/ @PostMapping("readallmsg") public Result readAllMessage(@LoginUser TokenDto tokenDto, @RequestBody UserMessageDTO userMessageDTO) { - //逻辑待实现 return userMessageService.readAllMessage(tokenDto, userMessageDTO); } } From 10b427ed2fda16ba523190c2dd6975fbd9db9768 Mon Sep 17 00:00:00 2001 From: wxz Date: Wed, 22 Apr 2020 11:09:35 +0800 Subject: [PATCH 19/85] =?UTF-8?q?1.=E6=96=B0=E5=A2=9Egov-mine=E6=9C=8D?= =?UTF-8?q?=E5=8A=A1=E6=A8=A1=E5=9D=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/resources/logback-spring.xml | 2 +- epmet-module/gov-mine/gov-mine-client/pom.xml | 17 ++ epmet-module/gov-mine/gov-mine-server/pom.xml | 159 ++++++++++++++++++ .../src/main/resources/bootstrap.yml | 96 +++++++++++ .../src/main/resources/logback-spring.xml | 159 ++++++++++++++++++ epmet-module/gov-mine/pom.xml | 19 +++ epmet-module/pom.xml | 1 + 7 files changed, 452 insertions(+), 1 deletion(-) create mode 100644 epmet-module/gov-mine/gov-mine-client/pom.xml create mode 100644 epmet-module/gov-mine/gov-mine-server/pom.xml create mode 100644 epmet-module/gov-mine/gov-mine-server/src/main/resources/bootstrap.yml create mode 100644 epmet-module/gov-mine/gov-mine-server/src/main/resources/logback-spring.xml create mode 100644 epmet-module/gov-mine/pom.xml diff --git a/epmet-module/gov-access/gov-access-server/src/main/resources/logback-spring.xml b/epmet-module/gov-access/gov-access-server/src/main/resources/logback-spring.xml index 86fc4a6979..e43fd0e845 100644 --- a/epmet-module/gov-access/gov-access-server/src/main/resources/logback-spring.xml +++ b/epmet-module/gov-access/gov-access-server/src/main/resources/logback-spring.xml @@ -2,7 +2,7 @@ - + + + + epmet-module + com.epmet + 2.0.0 + ../../pom.xml + + 4.0.0 + + gov-mine-client + 0.3.0 + + + \ No newline at end of file diff --git a/epmet-module/gov-mine/gov-mine-server/pom.xml b/epmet-module/gov-mine/gov-mine-server/pom.xml new file mode 100644 index 0000000000..69ec7833d8 --- /dev/null +++ b/epmet-module/gov-mine/gov-mine-server/pom.xml @@ -0,0 +1,159 @@ + + + + epmet-module + com.epmet + 2.0.0 + ../../pom.xml + + 4.0.0 + + gov-mine-server + 0.3.0 + + + + com.epmet + epmet-commons-tools + 2.0.0 + + + com.epmet + epmet-commons-mybatis + 2.0.0 + + + org.springframework.boot + spring-boot-starter-web + + + org.springframework + spring-context-support + + + org.springframework.boot + spring-boot-starter-actuator + + + de.codecentric + spring-boot-admin-starter-client + ${spring.boot.admin.version} + + + com.alibaba.cloud + spring-cloud-starter-alibaba-nacos-discovery + + + com.alibaba.cloud + spring-cloud-starter-alibaba-nacos-config + + + + io.github.openfeign + feign-httpclient + 10.3.0 + + + + + ${project.artifactId} + + + org.springframework.boot + spring-boot-maven-plugin + + + org.apache.maven.plugins + maven-surefire-plugin + + true + + + + ${project.basedir}/src/main/java + + + true + ${basedir}/src/main/resources + + + + + + + dev-local + + true + + + 8098 + dev + + + 0 + 192.168.1.130 + 6379 + 123456 + + false + 122.152.200.70:8848 + fcd6fc8f-ca3a-4b01-8026-2b05cdc5976b + + + false + + + + + dev + + + 8098 + dev + + + 0 + r-m5eoz5b6tkx09y6bpz.redis.rds.aliyuncs.com + 6379 + EpmEtrEdIs!q@w + + true + 192.168.10.150:8848 + 67e3c350-533e-4d7c-9f8f-faf1b4aa82ae + + + false + + + + + test + + + 8098 + test + + + 0 + 10.10.10.248 + 6379 + 123456 + + true + 122.152.200.70:8848 + fcd6fc8f-ca3a-4b01-8026-2b05cdc5976b + + + false + + + + + + \ No newline at end of file diff --git a/epmet-module/gov-mine/gov-mine-server/src/main/resources/bootstrap.yml b/epmet-module/gov-mine/gov-mine-server/src/main/resources/bootstrap.yml new file mode 100644 index 0000000000..372d057000 --- /dev/null +++ b/epmet-module/gov-mine/gov-mine-server/src/main/resources/bootstrap.yml @@ -0,0 +1,96 @@ +server: + port: @server.port@ + servlet: + context-path: /gov/mine + +spring: + main: + allow-bean-definition-overriding: true + application: + name: gov-mine-server + #环境 dev|test|prod + profiles: + active: dev + jackson: + time-zone: GMT+8 + date-format: yyyy-MM-dd HH:mm:ss + redis: + database: @spring.redis.index@ + host: @spring.redis.host@ + port: @spring.redis.port@ + password: @spring.redis.password@ + timeout: 30s + cloud: + nacos: + discovery: + server-addr: @nacos.server-addr@ + #nacos的命名空间ID,默认是public + namespace: @nacos.discovery.namespace@ + #不把自己注册到注册中心的地址 + register-enabled: @nacos.register-enabled@ + ip: @nacos.ip@ + config: + enabled: @nacos.config-enabled@ + server-addr: @nacos.server-addr@ + namespace: @nacos.config.namespace@ + group: @nacos.config.group@ + file-extension: yaml + #指定共享配置,且支持动态刷新 +# ext-config: +# - data-id: datasource.yaml +# group: ${spring.cloud.nacos.config.group} +# refresh: true +# - data-id: common.yaml +# group: ${spring.cloud.nacos.config.group} +# refresh: true +management: + endpoints: + web: + exposure: + include: "*" + endpoint: + health: + show-details: ALWAYS + +mybatis-plus: + mapper-locations: classpath:/mapper/**/*.xml + #实体扫描,多个package用逗号或者分号分隔 + typeAliasesPackage: com.epmet.entity + global-config: + #数据库相关配置 + db-config: + #主键类型 AUTO:"数据库ID自增", INPUT:"用户输入ID", ID_WORKER:"全局唯一ID (数字类型唯一ID)", UUID:"全局唯一ID UUID"; + id-type: ID_WORKER + #字段策略 IGNORED:"忽略判断",NOT_NULL:"非 NULL 判断"),NOT_EMPTY:"非空判断" + field-strategy: NOT_NULL + #驼峰下划线转换 + column-underline: true + banner: false + #原生配置 + configuration: + map-underscore-to-camel-case: true + cache-enabled: false + call-setters-on-nulls: true + jdbc-type-for-null: 'null' + +feign: + hystrix: + enabled: true + client: + config: + default: + loggerLevel: BASIC + httpclient: + enabled: true + +hystrix: + command: + default: + execution: + isolation: + thread: + timeoutInMilliseconds: 60000 #缺省为1000 + +ribbon: + ReadTimeout: 300000 + ConnectTimeout: 300000 diff --git a/epmet-module/gov-mine/gov-mine-server/src/main/resources/logback-spring.xml b/epmet-module/gov-mine/gov-mine-server/src/main/resources/logback-spring.xml new file mode 100644 index 0000000000..e12ce1b94a --- /dev/null +++ b/epmet-module/gov-mine/gov-mine-server/src/main/resources/logback-spring.xml @@ -0,0 +1,159 @@ + + + + + + + + + + + + + + debug + + + ${CONSOLE_LOG_PATTERN} + + UTF-8 + + + + + + + + ${log.path}/debug.log + + + %d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n + UTF-8 + + + + + ${log.path}/debug-%d{yyyy-MM-dd}.%i.log + + 100MB + + + 15 + + + + debug + ACCEPT + DENY + + + + + + + ${log.path}/info.log + + + %d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n + UTF-8 + + + + + ${log.path}/info-%d{yyyy-MM-dd}.%i.log + + 100MB + + + 15 + + + + info + ACCEPT + DENY + + + + + + + ${log.path}/warn.log + + + %d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n + UTF-8 + + + + ${log.path}/warn-%d{yyyy-MM-dd}.%i.log + + 100MB + + + 15 + + + + warn + ACCEPT + DENY + + + + + + + ${log.path}/error.log + + + %d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n + UTF-8 + + + + ${log.path}/error-%d{yyyy-MM-dd}.%i.log + + 100MB + + + 15 + + + + ERROR + ACCEPT + DENY + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/epmet-module/gov-mine/pom.xml b/epmet-module/gov-mine/pom.xml new file mode 100644 index 0000000000..ef1a4d528b --- /dev/null +++ b/epmet-module/gov-mine/pom.xml @@ -0,0 +1,19 @@ + + + + epmet-module + com.epmet + 2.0.0 + + 4.0.0 + + gov-mine + + + gov-mine-client + gov-mine-server + + + \ No newline at end of file diff --git a/epmet-module/pom.xml b/epmet-module/pom.xml index d4fc0c7ae2..f1e9ea9c5b 100644 --- a/epmet-module/pom.xml +++ b/epmet-module/pom.xml @@ -28,6 +28,7 @@ resi-group resi-partymember gov-access + gov-mine From 794f3f0d3f40c0711c6a1a086929f7538c572303 Mon Sep 17 00:00:00 2001 From: wxz Date: Wed, 22 Apr 2020 12:32:03 +0800 Subject: [PATCH 20/85] =?UTF-8?q?1.=E6=96=B0=E5=A2=9Eepmet-user,gov-access?= =?UTF-8?q?,oper-customize=20db=E8=84=9A=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../db.migration/epmet_gov_access.sql | 92 +++++++++++++++++++ .../db.migration/customer_foot_bar.sql | 36 ++++++++ .../resources/db/migration/epmet_user.sql | 33 ++++++- 3 files changed, 160 insertions(+), 1 deletion(-) create mode 100644 epmet-module/gov-access/gov-access-server/src/main/resources/db.migration/epmet_gov_access.sql create mode 100644 epmet-module/oper-customize/oper-customize-server/src/main/resources/db.migration/customer_foot_bar.sql diff --git a/epmet-module/gov-access/gov-access-server/src/main/resources/db.migration/epmet_gov_access.sql b/epmet-module/gov-access/gov-access-server/src/main/resources/db.migration/epmet_gov_access.sql new file mode 100644 index 0000000000..89cfdb3d94 --- /dev/null +++ b/epmet-module/gov-access/gov-access-server/src/main/resources/db.migration/epmet_gov_access.sql @@ -0,0 +1,92 @@ +/* + Date: 22/04/2020 12:13:38 +*/ + +-- SET NAMES utf8mb4; +-- #SET FOREIGN_KEY_CHECKS = 0; + +-- DROP TABLE IF EXISTS `permission_scope`; +CREATE TABLE `permission_scope` ( + `ID` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT 'id', + `SCOPE_KEY` varchar(30) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '范围key', + `SCOPE_NAME` varchar(30) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '范围名称', + `DEL_FLAG` tinyint(1) NULL DEFAULT NULL COMMENT '是否删除,0:未删除,1:已删除', + `REVISION` int(10) NULL DEFAULT NULL COMMENT '乐观锁', + `CREATED_BY` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '创建者id', + `CREATED_TIME` datetime(0) NULL DEFAULT NULL COMMENT '创建时间', + `UPDATED_BY` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '更新者id', + `UPDATED_TIME` datetime(0) NULL DEFAULT NULL COMMENT '更新时间', + PRIMARY KEY (`ID`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '权限范围表' ROW_FORMAT = Dynamic; + +-- ---------------------------- +-- Table structure for resource_ope +-- ---------------------------- +DROP TABLE IF EXISTS `resource_ope`; +CREATE TABLE `resource_ope` ( + `ID` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, + `OPERATION_KEY` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, + `OPERATION_NAME` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL, + `BRIEF` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '操作简介', + `DEL_FLAG` tinyint(1) NULL DEFAULT NULL, + `REVISION` int(10) NULL DEFAULT NULL, + `CREATED_BY` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL, + `CREATED_TIME` datetime(0) NULL DEFAULT NULL, + `UPDATED_BY` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL, + `UPDATED_TIME` datetime(0) NULL DEFAULT NULL, + PRIMARY KEY (`ID`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '操作类型表' ROW_FORMAT = Dynamic; + +-- ---------------------------- +-- Table structure for role_operation +-- ---------------------------- +DROP TABLE IF EXISTS `role_operation`; +CREATE TABLE `role_operation` ( + `ID` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, + `ROLE_ID` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '角色ID', + `OPERATION_KEY` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '操作key', + `DEL_FLAG` tinyint(1) NULL DEFAULT NULL COMMENT '是否删除,0:未删除,1:已删除', + `REVISION` int(10) NULL DEFAULT NULL COMMENT '乐观锁', + `CREATED_BY` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '创建者id', + `CREATED_TIME` datetime(0) NULL DEFAULT NULL COMMENT '创建时间', + `UPDATED_BY` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '更新者id', + `UPDATED_TIME` datetime(0) NULL DEFAULT NULL COMMENT '更新时间', + PRIMARY KEY (`ID`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '角色能进行那些操作' ROW_FORMAT = Dynamic; + +-- ---------------------------- +-- Table structure for role_scope +-- ---------------------------- +DROP TABLE IF EXISTS `role_scope`; +CREATE TABLE `role_scope` ( + `ID` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, + `ROLE_ID` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '角色ID', + `PERMISSION_KEY` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '权限key', + `DEL_FLAG` tinyint(1) NULL DEFAULT NULL COMMENT '是否删除,0:未删除,1:已删除', + `REVISION` int(10) NULL DEFAULT NULL COMMENT '乐观锁', + `CREATED_BY` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '创建者id', + `CREATED_TIME` datetime(0) NULL DEFAULT NULL COMMENT '创建时间', + `UPDATED_BY` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '更新者id', + `UPDATED_TIME` datetime(0) NULL DEFAULT NULL COMMENT '更新时间', + PRIMARY KEY (`ID`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '角色能操作哪些范围' ROW_FORMAT = Dynamic; + +-- ---------------------------- +-- Table structure for role_template +-- ---------------------------- +DROP TABLE IF EXISTS `role_template`; +CREATE TABLE `role_template` ( + `ID` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT 'ID', + `ROLE_KEY` varchar(30) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '角色key', + `ROLE_NAME` varchar(30) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '角色名称', + `ORG_TYPE` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '角色所属体系类型:org,dept,grid', + `DEL_FLAG` tinyint(1) NULL DEFAULT NULL, + `REVISION` int(10) NULL DEFAULT NULL, + `CREATED_BY` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL, + `CREATED_TIME` datetime(0) NULL DEFAULT NULL, + `UPDATED_BY` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL, + `UPDATED_TIME` datetime(0) NULL DEFAULT NULL, + PRIMARY KEY (`ID`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '政府端角色模板表' ROW_FORMAT = Dynamic; + +-- SET FOREIGN_KEY_CHECKS = 1; diff --git a/epmet-module/oper-customize/oper-customize-server/src/main/resources/db.migration/customer_foot_bar.sql b/epmet-module/oper-customize/oper-customize-server/src/main/resources/db.migration/customer_foot_bar.sql new file mode 100644 index 0000000000..fc496afa9a --- /dev/null +++ b/epmet-module/oper-customize/oper-customize-server/src/main/resources/db.migration/customer_foot_bar.sql @@ -0,0 +1,36 @@ +/* + Date: 22/04/2020 12:21:32 wxz +*/ + +-- SET NAMES utf8mb4; +-- SET FOREIGN_KEY_CHECKS = 0; + +-- ---------------------------- +-- Table structure for customer_foot_bar +-- ---------------------------- +DROP TABLE IF EXISTS `customer_foot_bar`; +CREATE TABLE `customer_foot_bar` ( + `ID` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '唯一标识', + `BAR_NAME` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT 'bar名称', + `KEY` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT 'KEY', + `PAGE_TITLE` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '页面标题', + `ICON_PATH` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '图标路径', + `SELECTED_ICON_PATH` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '选中页面图标路径', + `DEL_FLAG` int(11) NOT NULL COMMENT '删除标识:0.未删除 1.已删除', + `REVISION` int(11) NOT NULL COMMENT '乐观锁', + `CREATED_BY` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '创建人', + `CREATED_TIME` datetime(0) NOT NULL COMMENT '创建时间', + `UPDATED_BY` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '更新人', + `UPDATED_TIME` datetime(0) NOT NULL COMMENT '更新时间', + PRIMARY KEY (`ID`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = 'APP底部菜单栏信息' ROW_FORMAT = Compact; + +-- ---------------------------- +-- Records of customer_foot_bar +-- ---------------------------- +INSERT INTO `customer_foot_bar` VALUES ('1', '工作', 'work', '党群e事通-政府端', NULL, NULL, 0, 0, 'wxz', '2020-04-22 10:53:22', 'wxz', '2020-04-22 10:53:26'); +INSERT INTO `customer_foot_bar` VALUES ('2', '组织', 'org', '组织机构', NULL, NULL, 0, 0, 'wxz', '2020-04-22 10:53:56', 'wxz', '2020-04-22 10:54:00'); +INSERT INTO `customer_foot_bar` VALUES ('3', '数据', 'data', '数据', NULL, NULL, 0, 0, 'wxz', '2020-04-22 11:20:54', 'wxz', '2020-04-22 11:20:58'); +INSERT INTO `customer_foot_bar` VALUES ('4', '发现', 'find', '发现', NULL, NULL, 0, 0, 'wxz', '2020-04-22 11:21:48', 'wxz', '2020-04-22 11:21:53'); + +-- SET FOREIGN_KEY_CHECKS = 1; diff --git a/epmet-user/epmet-user-server/src/main/resources/db/migration/epmet_user.sql b/epmet-user/epmet-user-server/src/main/resources/db/migration/epmet_user.sql index 9283e23220..0076d0ef90 100644 --- a/epmet-user/epmet-user-server/src/main/resources/db/migration/epmet_user.sql +++ b/epmet-user/epmet-user-server/src/main/resources/db/migration/epmet_user.sql @@ -85,4 +85,35 @@ CREATE TABLE `staff_grid_visited` ( `UPDATED_BY` varchar(32) DEFAULT NULL COMMENT '更新人', `UPDATED_TIME` datetime DEFAULT NULL COMMENT '更新时间', PRIMARY KEY (`ID`) USING BTREE -) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=COMPACT COMMENT='工作人员进入网格日志表'; \ No newline at end of file +) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=COMPACT COMMENT='工作人员进入网格日志表'; + +-- 2020.4.22 增加政府端角色表&政府工作人员-角色关系表 + +CREATE TABLE `staff_role` ( + `ID` varchar(64) NOT NULL, + `STAFF_ID` varchar(64) NOT NULL COMMENT '用户ID', + `ROLE_ID` varchar(64) NOT NULL COMMENT '角色ID', + `ORG_ID` varchar(255) DEFAULT NULL COMMENT '角色所属类型的ID。例如,机关的角色,那该字段就是所属机关的ID;部门的角色,该字段就是所属部门的ID;网格的角色,该字段就是所属网格ID', + `DEL_FLAG` tinyint(1) DEFAULT NULL, + `REVISION` int(10) DEFAULT NULL, + `CREATED_BY` varchar(64) DEFAULT NULL, + `CREATED_TIME` datetime DEFAULT NULL, + `UPDATED_BY` varchar(64) DEFAULT NULL, + `UPDATED_TIME` datetime DEFAULT NULL, + PRIMARY KEY (`ID`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='工作人员-角色关系表'; + +CREATE TABLE `gov_staff_role` ( + `ID` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT 'ID', + `CUSTOMER_ID` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '客户ID。如果该角色由客户定制,其下的机关和部门都不再各自定制自己的角色,这个字段会比较有用。包括通用角色以及客户定制角色。', + `ROLE_KEY` varchar(30) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '角色key', + `ROLE_NAME` varchar(30) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '角色名称', + `ORG_TYPE` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '角色所属体系类型:agency,department,grid', + `DEL_FLAG` tinyint(1) NULL DEFAULT NULL, + `REVISION` int(10) NULL DEFAULT NULL, + `CREATED_BY` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL, + `CREATED_TIME` datetime(0) NULL DEFAULT NULL, + `UPDATED_BY` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL, + `UPDATED_TIME` datetime(0) NULL DEFAULT NULL, + PRIMARY KEY (`ID`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '政府端角色表' ROW_FORMAT = Dynamic; From d521b63fa62443ea296de5bde79fb20e60a0025c Mon Sep 17 00:00:00 2001 From: wxz Date: Wed, 22 Apr 2020 12:45:56 +0800 Subject: [PATCH 21/85] =?UTF-8?q?1.db=E8=84=9A=E6=9C=AC=E8=A1=A5=E5=85=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../db.migration/epmet_gov_access.sql | 18 --------------- .../resources/db/migration/epmet_user.sql | 23 +++++++++++++++++++ 2 files changed, 23 insertions(+), 18 deletions(-) diff --git a/epmet-module/gov-access/gov-access-server/src/main/resources/db.migration/epmet_gov_access.sql b/epmet-module/gov-access/gov-access-server/src/main/resources/db.migration/epmet_gov_access.sql index 89cfdb3d94..c7c63b6c42 100644 --- a/epmet-module/gov-access/gov-access-server/src/main/resources/db.migration/epmet_gov_access.sql +++ b/epmet-module/gov-access/gov-access-server/src/main/resources/db.migration/epmet_gov_access.sql @@ -71,22 +71,4 @@ CREATE TABLE `role_scope` ( PRIMARY KEY (`ID`) USING BTREE ) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '角色能操作哪些范围' ROW_FORMAT = Dynamic; --- ---------------------------- --- Table structure for role_template --- ---------------------------- -DROP TABLE IF EXISTS `role_template`; -CREATE TABLE `role_template` ( - `ID` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT 'ID', - `ROLE_KEY` varchar(30) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '角色key', - `ROLE_NAME` varchar(30) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '角色名称', - `ORG_TYPE` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '角色所属体系类型:org,dept,grid', - `DEL_FLAG` tinyint(1) NULL DEFAULT NULL, - `REVISION` int(10) NULL DEFAULT NULL, - `CREATED_BY` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL, - `CREATED_TIME` datetime(0) NULL DEFAULT NULL, - `UPDATED_BY` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL, - `UPDATED_TIME` datetime(0) NULL DEFAULT NULL, - PRIMARY KEY (`ID`) USING BTREE -) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '政府端角色模板表' ROW_FORMAT = Dynamic; - -- SET FOREIGN_KEY_CHECKS = 1; diff --git a/epmet-user/epmet-user-server/src/main/resources/db/migration/epmet_user.sql b/epmet-user/epmet-user-server/src/main/resources/db/migration/epmet_user.sql index 0076d0ef90..bdefcc6a31 100644 --- a/epmet-user/epmet-user-server/src/main/resources/db/migration/epmet_user.sql +++ b/epmet-user/epmet-user-server/src/main/resources/db/migration/epmet_user.sql @@ -117,3 +117,26 @@ CREATE TABLE `gov_staff_role` ( `UPDATED_TIME` datetime(0) NULL DEFAULT NULL, PRIMARY KEY (`ID`) USING BTREE ) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '政府端角色表' ROW_FORMAT = Dynamic; + +CREATE TABLE `gov_role_template` ( + `ID` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT 'ID', + `ROLE_KEY` varchar(30) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '角色key', + `ROLE_NAME` varchar(30) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '角色名称', + `ORG_TYPE` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '角色所属体系类型:org,dept,grid', + `DEL_FLAG` tinyint(1) NULL DEFAULT NULL, + `REVISION` int(10) NULL DEFAULT NULL, + `CREATED_BY` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL, + `CREATED_TIME` datetime(0) NULL DEFAULT NULL, + `UPDATED_BY` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL, + `UPDATED_TIME` datetime(0) NULL DEFAULT NULL, + PRIMARY KEY (`ID`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '政府端角色模板表' ROW_FORMAT = Dynamic; + +INSERT INTO `gov_role_template` VALUES ('1', 'agency_leader', '单位领导', 'agency', 0, NULL, NULL, NULL, NULL, NULL); +INSERT INTO `gov_role_template` VALUES ('2', 'dept_leader', '部门领导', 'department', 0, NULL, NULL, NULL, NULL, NULL); +INSERT INTO `gov_role_template` VALUES ('3', 'party_principals', '党建负责人', '', 0, NULL, NULL, NULL, NULL, NULL); +INSERT INTO `gov_role_template` VALUES ('4', 'manager', '管理员', NULL, 0, NULL, NULL, NULL, NULL, NULL); +INSERT INTO `gov_role_template` VALUES ('5', 'staff', '工作人员', NULL, 0, NULL, NULL, NULL, NULL, NULL); +INSERT INTO `gov_role_template` VALUES ('6', 'grid_manager', '网格长', NULL, 0, NULL, NULL, NULL, NULL, NULL); +INSERT INTO `gov_role_template` VALUES ('7', 'grid_party_director', '网格党建指导员', NULL, 0, NULL, NULL, NULL, NULL, NULL); +INSERT INTO `gov_role_template` VALUES ('8', 'grid_member', '网格员', NULL, 0, NULL, NULL, NULL, NULL, NULL); \ No newline at end of file From fd00986a70e1f2a0aaa87e4f995afc78956d8ddd Mon Sep 17 00:00:00 2001 From: wxz Date: Wed, 22 Apr 2020 12:50:08 +0800 Subject: [PATCH 22/85] =?UTF-8?q?1.db=E8=84=9A=E6=9C=AC=E8=A1=A5=E5=85=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../resources/db/migration/epmet_user.sql | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/epmet-user/epmet-user-server/src/main/resources/db/migration/epmet_user.sql b/epmet-user/epmet-user-server/src/main/resources/db/migration/epmet_user.sql index bdefcc6a31..10c5d34b4c 100644 --- a/epmet-user/epmet-user-server/src/main/resources/db/migration/epmet_user.sql +++ b/epmet-user/epmet-user-server/src/main/resources/db/migration/epmet_user.sql @@ -107,7 +107,7 @@ CREATE TABLE `gov_staff_role` ( `ID` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT 'ID', `CUSTOMER_ID` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '客户ID。如果该角色由客户定制,其下的机关和部门都不再各自定制自己的角色,这个字段会比较有用。包括通用角色以及客户定制角色。', `ROLE_KEY` varchar(30) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '角色key', - `ROLE_NAME` varchar(30) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '角色名称', + `ROLE_NAME` varchar(30) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '角色名称', `ORG_TYPE` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '角色所属体系类型:agency,department,grid', `DEL_FLAG` tinyint(1) NULL DEFAULT NULL, `REVISION` int(10) NULL DEFAULT NULL, @@ -118,7 +118,7 @@ CREATE TABLE `gov_staff_role` ( PRIMARY KEY (`ID`) USING BTREE ) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '政府端角色表' ROW_FORMAT = Dynamic; -CREATE TABLE `gov_role_template` ( +CREATE TABLE `gov_staff_role_template` ( `ID` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT 'ID', `ROLE_KEY` varchar(30) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '角色key', `ROLE_NAME` varchar(30) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '角色名称', @@ -132,11 +132,11 @@ CREATE TABLE `gov_role_template` ( PRIMARY KEY (`ID`) USING BTREE ) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '政府端角色模板表' ROW_FORMAT = Dynamic; -INSERT INTO `gov_role_template` VALUES ('1', 'agency_leader', '单位领导', 'agency', 0, NULL, NULL, NULL, NULL, NULL); -INSERT INTO `gov_role_template` VALUES ('2', 'dept_leader', '部门领导', 'department', 0, NULL, NULL, NULL, NULL, NULL); -INSERT INTO `gov_role_template` VALUES ('3', 'party_principals', '党建负责人', '', 0, NULL, NULL, NULL, NULL, NULL); -INSERT INTO `gov_role_template` VALUES ('4', 'manager', '管理员', NULL, 0, NULL, NULL, NULL, NULL, NULL); -INSERT INTO `gov_role_template` VALUES ('5', 'staff', '工作人员', NULL, 0, NULL, NULL, NULL, NULL, NULL); -INSERT INTO `gov_role_template` VALUES ('6', 'grid_manager', '网格长', NULL, 0, NULL, NULL, NULL, NULL, NULL); -INSERT INTO `gov_role_template` VALUES ('7', 'grid_party_director', '网格党建指导员', NULL, 0, NULL, NULL, NULL, NULL, NULL); -INSERT INTO `gov_role_template` VALUES ('8', 'grid_member', '网格员', NULL, 0, NULL, NULL, NULL, NULL, NULL); \ No newline at end of file +INSERT INTO `gov_staff_role_template` VALUES ('1', 'agency_leader', '单位领导', 'agency', 0, NULL, NULL, NULL, NULL, NULL); +INSERT INTO `gov_staff_role_template` VALUES ('2', 'dept_leader', '部门领导', 'department', 0, NULL, NULL, NULL, NULL, NULL); +INSERT INTO `gov_staff_role_template` VALUES ('3', 'party_principals', '党建负责人', '', 0, NULL, NULL, NULL, NULL, NULL); +INSERT INTO `gov_staff_role_template` VALUES ('4', 'manager', '管理员', NULL, 0, NULL, NULL, NULL, NULL, NULL); +INSERT INTO `gov_staff_role_template` VALUES ('5', 'staff', '工作人员', NULL, 0, NULL, NULL, NULL, NULL, NULL); +INSERT INTO `gov_staff_role_template` VALUES ('6', 'grid_manager', '网格长', NULL, 0, NULL, NULL, NULL, NULL, NULL); +INSERT INTO `gov_staff_role_template` VALUES ('7', 'grid_party_director', '网格党建指导员', NULL, 0, NULL, NULL, NULL, NULL, NULL); +INSERT INTO `gov_staff_role_template` VALUES ('8', 'grid_member', '网格员', NULL, 0, NULL, NULL, NULL, NULL, NULL); \ No newline at end of file From b0b8ecb4fa645de1a348ecf6491da538315da9d0 Mon Sep 17 00:00:00 2001 From: sunyuchao Date: Wed, 22 Apr 2020 13:38:38 +0800 Subject: [PATCH 23/85] =?UTF-8?q?gov-mine=E6=9C=8D=E5=8A=A1=E6=A8=A1?= =?UTF-8?q?=E6=9D=BF=E6=96=87=E4=BB=B6=E6=8F=90=E4=BA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/epmet/config/.gitkeep | 0 .../controller/CustomerAgencyController.java | 33 +++++++++++++ .../src/main/java/com/epmet/dao/.gitkeep | 0 .../src/main/java/com/epmet/entity/.gitkeep | 0 .../src/main/java/com/epmet/excel/.gitkeep | 0 .../com/epmet/feign/EpmetUserFeignClient.java | 13 +++++ .../com/epmet/feign/GovOrgFeignClient.java | 14 ++++++ .../EpmetUserFeignClientFallback.java | 13 +++++ .../fallback/GovOrgFeignClientFallBack.java | 13 +++++ .../com/epmet/redis/CustomerAgencyRedis.java | 47 +++++++++++++++++++ .../epmet/service/CustomerAgencyService.java | 35 ++++++++++++++ .../impl/CustomerAgencyServiceImpl.java | 34 ++++++++++++++ 12 files changed, 202 insertions(+) create mode 100644 epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/config/.gitkeep create mode 100644 epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/controller/CustomerAgencyController.java create mode 100644 epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/dao/.gitkeep create mode 100644 epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/entity/.gitkeep create mode 100644 epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/excel/.gitkeep create mode 100644 epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/feign/EpmetUserFeignClient.java create mode 100644 epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/feign/GovOrgFeignClient.java create mode 100644 epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/feign/fallback/EpmetUserFeignClientFallback.java create mode 100644 epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/feign/fallback/GovOrgFeignClientFallBack.java create mode 100644 epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/redis/CustomerAgencyRedis.java create mode 100644 epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/service/CustomerAgencyService.java create mode 100644 epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/service/impl/CustomerAgencyServiceImpl.java diff --git a/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/config/.gitkeep b/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/config/.gitkeep new file mode 100644 index 0000000000..e69de29bb2 diff --git a/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/controller/CustomerAgencyController.java b/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/controller/CustomerAgencyController.java new file mode 100644 index 0000000000..ae25f3a97f --- /dev/null +++ b/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/controller/CustomerAgencyController.java @@ -0,0 +1,33 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

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

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

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.controller; + +/** + * 机关单位信息表 + * + * @author generator generator@elink-cn.com + */ +@RestController +@RequestMapping("agency") +public class CustomerAgencyController { + + @Autowired + private CustomerAgencyService customerAgencyService; + + +} \ No newline at end of file diff --git a/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/dao/.gitkeep b/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/dao/.gitkeep new file mode 100644 index 0000000000..e69de29bb2 diff --git a/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/entity/.gitkeep b/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/entity/.gitkeep new file mode 100644 index 0000000000..e69de29bb2 diff --git a/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/excel/.gitkeep b/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/excel/.gitkeep new file mode 100644 index 0000000000..e69de29bb2 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 new file mode 100644 index 0000000000..07d46c559d --- /dev/null +++ b/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/feign/EpmetUserFeignClient.java @@ -0,0 +1,13 @@ +package com.epmet.feign; + +import com.epmet.commons.tools.constant.ServiceConstant; +import com.epmet.feign.fallback.EpmetUserFeignClientFallback; +import org.springframework.cloud.openfeign.FeignClient; + +/** + * @Description + * @Author sun + */ +@FeignClient(name = ServiceConstant.EPMET_USER_SERVER, fallback = EpmetUserFeignClientFallback.class) +public interface EpmetUserFeignClient { +} diff --git a/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/feign/GovOrgFeignClient.java b/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/feign/GovOrgFeignClient.java new file mode 100644 index 0000000000..fd2853340f --- /dev/null +++ b/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/feign/GovOrgFeignClient.java @@ -0,0 +1,14 @@ +package com.epmet.feign; + +import com.epmet.commons.tools.constant.ServiceConstant; +import com.epmet.feign.fallback.GovOrgFeignClientFallBack; +import org.springframework.cloud.openfeign.FeignClient; + +/** + * @Description + * @Author sun + */ +@FeignClient(name = ServiceConstant.GOV_ORG_SERVER, fallback = GovOrgFeignClientFallBack.class) +public interface GovOrgFeignClient { + +} diff --git a/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/feign/fallback/EpmetUserFeignClientFallback.java b/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/feign/fallback/EpmetUserFeignClientFallback.java new file mode 100644 index 0000000000..9c5a63a4fd --- /dev/null +++ b/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/feign/fallback/EpmetUserFeignClientFallback.java @@ -0,0 +1,13 @@ +package com.epmet.feign.fallback; + +import com.epmet.feign.EpmetUserFeignClient; +import org.springframework.stereotype.Component; + +/** + * @Description + * @Author sun + */ +@Component +public class EpmetUserFeignClientFallback implements EpmetUserFeignClient { + +} diff --git a/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/feign/fallback/GovOrgFeignClientFallBack.java b/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/feign/fallback/GovOrgFeignClientFallBack.java new file mode 100644 index 0000000000..80ab9be7be --- /dev/null +++ b/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/feign/fallback/GovOrgFeignClientFallBack.java @@ -0,0 +1,13 @@ +package com.epmet.feign.fallback; + +import com.epmet.feign.GovOrgFeignClient; +import org.springframework.stereotype.Component; + +/** + * @Description + * @Author sun + */ +@Component +public class GovOrgFeignClientFallBack implements GovOrgFeignClient { + +} \ No newline at end of file diff --git a/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/redis/CustomerAgencyRedis.java b/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/redis/CustomerAgencyRedis.java new file mode 100644 index 0000000000..3b8e96c9a2 --- /dev/null +++ b/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/redis/CustomerAgencyRedis.java @@ -0,0 +1,47 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

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

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

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.redis; + +import com.epmet.commons.tools.redis.RedisUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +/** + * 机关单位信息表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-04-20 + */ +@Component +public class CustomerAgencyRedis { + @Autowired + private RedisUtils redisUtils; + + public void delete(Object[] ids) { + + } + + public void set(){ + + } + + public String get(String id){ + return null; + } + +} \ No newline at end of file diff --git a/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/service/CustomerAgencyService.java b/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/service/CustomerAgencyService.java new file mode 100644 index 0000000000..8f685b7f7e --- /dev/null +++ b/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/service/CustomerAgencyService.java @@ -0,0 +1,35 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

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

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

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.service; + +import com.epmet.commons.mybatis.service.BaseService; +import com.epmet.entity.CustomerAgencyEntity; + +/** + * 机关单位信息表 + * + * @author generator generator@elink-cn.com + */ +public interface CustomerAgencyService extends BaseService { + + @Autowired + private GovOrgFeignClient govOrgFeignClient; + @Autowired + private EpmetUserFeignClient epmetUserFeignClient; + +} \ No newline at end of file diff --git a/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/service/impl/CustomerAgencyServiceImpl.java b/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/service/impl/CustomerAgencyServiceImpl.java new file mode 100644 index 0000000000..de50deb280 --- /dev/null +++ b/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/service/impl/CustomerAgencyServiceImpl.java @@ -0,0 +1,34 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

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

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

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.service.impl; + +import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; +import com.epmet.dao.CustomerAgencyDao; +import com.epmet.entity.CustomerAgencyEntity; +import com.epmet.service.CustomerAgencyService; +import org.springframework.stereotype.Service; + +/** + * 机关单位信息表 + * + * @author generator generator@elink-cn.com + */ +@Service +public class CustomerAgencyServiceImpl extends BaseServiceImpl implements CustomerAgencyService { + +} \ No newline at end of file From 93e5db24f7521060418bd3b4b1815b52447bf269 Mon Sep 17 00:00:00 2001 From: sunyuchao Date: Wed, 22 Apr 2020 13:44:32 +0800 Subject: [PATCH 24/85] =?UTF-8?q?=E6=A8=A1=E6=9D=BF=E4=BB=A3=E7=A0=81?= =?UTF-8?q?=E6=8F=90=E4=BA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/com/epmet/service/CustomerAgencyService.java | 5 ----- .../com/epmet/service/impl/CustomerAgencyServiceImpl.java | 6 ++++++ 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/service/CustomerAgencyService.java b/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/service/CustomerAgencyService.java index 8f685b7f7e..85de6deeaf 100644 --- a/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/service/CustomerAgencyService.java +++ b/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/service/CustomerAgencyService.java @@ -27,9 +27,4 @@ import com.epmet.entity.CustomerAgencyEntity; */ public interface CustomerAgencyService extends BaseService { - @Autowired - private GovOrgFeignClient govOrgFeignClient; - @Autowired - private EpmetUserFeignClient epmetUserFeignClient; - } \ No newline at end of file diff --git a/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/service/impl/CustomerAgencyServiceImpl.java b/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/service/impl/CustomerAgencyServiceImpl.java index de50deb280..1f89cc5bd7 100644 --- a/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/service/impl/CustomerAgencyServiceImpl.java +++ b/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/service/impl/CustomerAgencyServiceImpl.java @@ -31,4 +31,10 @@ import org.springframework.stereotype.Service; @Service public class CustomerAgencyServiceImpl extends BaseServiceImpl implements CustomerAgencyService { + @Autowired + private GovOrgFeignClient govOrgFeignClient; + @Autowired + private EpmetUserFeignClient epmetUserFeignClient; + + } \ No newline at end of file From 56980799b5428dc53424df472a06259d37b0f4d4 Mon Sep 17 00:00:00 2001 From: sunyuchao Date: Wed, 22 Apr 2020 14:09:02 +0800 Subject: [PATCH 25/85] =?UTF-8?q?=E6=A0=B9=E6=8D=AEuserId=E6=9F=A5?= =?UTF-8?q?=E8=AF=A2=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-module/gov-mine/gov-mine-server/pom.xml | 18 ++++++ .../controller/CustomerAgencyController.java | 33 ----------- .../controller/StaffAgencyController.java | 55 +++++++++++++++++++ .../com/epmet/feign/GovOrgFeignClient.java | 14 +++++ .../fallback/GovOrgFeignClientFallBack.java | 10 ++++ ...AgencyRedis.java => StaffAgencyRedis.java} | 2 +- ...cyService.java => StaffAgencyService.java} | 16 +++++- ...eImpl.java => StaffAgencyServiceImpl.java} | 25 +++++++-- .../result/CustomerGridByUserIdResultDTO.java | 30 ++++++++++ .../controller/CustomerGridController.java | 11 ++++ .../java/com/epmet/dao/CustomerGridDao.java | 8 +++ .../epmet/service/CustomerGridService.java | 8 +++ .../service/impl/CustomerGridServiceImpl.java | 12 ++++ .../main/resources/mapper/CustomerGridDao.xml | 16 ++++++ 14 files changed, 216 insertions(+), 42 deletions(-) delete mode 100644 epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/controller/CustomerAgencyController.java create mode 100644 epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/controller/StaffAgencyController.java rename epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/redis/{CustomerAgencyRedis.java => StaffAgencyRedis.java} (97%) rename epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/service/{CustomerAgencyService.java => StaffAgencyService.java} (65%) rename epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/service/impl/{CustomerAgencyServiceImpl.java => StaffAgencyServiceImpl.java} (57%) create mode 100644 epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/CustomerGridByUserIdResultDTO.java diff --git a/epmet-module/gov-mine/gov-mine-server/pom.xml b/epmet-module/gov-mine/gov-mine-server/pom.xml index 69ec7833d8..a6077f5fa3 100644 --- a/epmet-module/gov-mine/gov-mine-server/pom.xml +++ b/epmet-module/gov-mine/gov-mine-server/pom.xml @@ -55,6 +55,24 @@ feign-httpclient 10.3.0 + + com.epmet + gov-org-client + 2.0.0 + compile + + + com.epmet + gov-org-client + 2.0.0 + compile + + + com.epmet + gov-org-client + 2.0.0 + compile + diff --git a/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/controller/CustomerAgencyController.java b/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/controller/CustomerAgencyController.java deleted file mode 100644 index ae25f3a97f..0000000000 --- a/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/controller/CustomerAgencyController.java +++ /dev/null @@ -1,33 +0,0 @@ -/** - * Copyright 2018 人人开源 https://www.renren.io - *

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

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

- * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -package com.epmet.controller; - -/** - * 机关单位信息表 - * - * @author generator generator@elink-cn.com - */ -@RestController -@RequestMapping("agency") -public class CustomerAgencyController { - - @Autowired - private CustomerAgencyService customerAgencyService; - - -} \ No newline at end of file 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 new file mode 100644 index 0000000000..4ba21fb7be --- /dev/null +++ b/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/controller/StaffAgencyController.java @@ -0,0 +1,55 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

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

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

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.controller; + +import com.epmet.commons.tools.annotation.LoginUser; +import com.epmet.commons.tools.security.dto.TokenDto; +import com.epmet.commons.tools.utils.Result; +import com.epmet.dto.result.CustomerGridByUserIdResultDTO; +import com.epmet.service.StaffAgencyService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import java.util.List; + +/** + * 机关单位信息表 + * + * @author generator generator@elink-cn.com + */ +@RestController +@RequestMapping("agency") +public class StaffAgencyController { + + @Autowired + private StaffAgencyService staffAgencyService; + + /** + * @param tokenDTO + * @return + * @Description 根据userId查询该用户涉及的所有网格列表 + * @Author sun + */ + @PostMapping("getmygrids") + public Result> getMyGrids(@LoginUser TokenDto tokenDTO) { + return staffAgencyService.getMyGrids(tokenDTO); + } + +} \ No newline at end of file diff --git a/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/feign/GovOrgFeignClient.java b/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/feign/GovOrgFeignClient.java index fd2853340f..6866e03ecd 100644 --- a/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/feign/GovOrgFeignClient.java +++ b/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/feign/GovOrgFeignClient.java @@ -1,8 +1,14 @@ package com.epmet.feign; import com.epmet.commons.tools.constant.ServiceConstant; +import com.epmet.commons.tools.utils.Result; +import com.epmet.dto.result.CustomerGridByUserIdResultDTO; import com.epmet.feign.fallback.GovOrgFeignClientFallBack; import org.springframework.cloud.openfeign.FeignClient; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; + +import java.util.List; /** * @Description @@ -11,4 +17,12 @@ import org.springframework.cloud.openfeign.FeignClient; @FeignClient(name = ServiceConstant.GOV_ORG_SERVER, fallback = GovOrgFeignClientFallBack.class) public interface GovOrgFeignClient { + /** + * @param userId + * @return + * @Description 根据userId查询该用户涉及的所有网格列表 + * @Author sun + */ + @GetMapping(value = "/gov/org/customergrid/getmygrids/{userId}") + Result> getMyGrids(@PathVariable("userId") String userId); } diff --git a/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/feign/fallback/GovOrgFeignClientFallBack.java b/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/feign/fallback/GovOrgFeignClientFallBack.java index 80ab9be7be..7e7b838d38 100644 --- a/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/feign/fallback/GovOrgFeignClientFallBack.java +++ b/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/feign/fallback/GovOrgFeignClientFallBack.java @@ -1,8 +1,14 @@ package com.epmet.feign.fallback; +import com.epmet.commons.tools.constant.ServiceConstant; +import com.epmet.commons.tools.utils.ModuleUtils; +import com.epmet.commons.tools.utils.Result; +import com.epmet.dto.result.CustomerGridByUserIdResultDTO; import com.epmet.feign.GovOrgFeignClient; import org.springframework.stereotype.Component; +import java.util.List; + /** * @Description * @Author sun @@ -10,4 +16,8 @@ import org.springframework.stereotype.Component; @Component public class GovOrgFeignClientFallBack implements GovOrgFeignClient { + @Override + public Result> getMyGrids(String userId) { + return ModuleUtils.feignConError(ServiceConstant.GOV_ORG_SERVER, "getMyGrids", userId); + } } \ No newline at end of file diff --git a/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/redis/CustomerAgencyRedis.java b/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/redis/StaffAgencyRedis.java similarity index 97% rename from epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/redis/CustomerAgencyRedis.java rename to epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/redis/StaffAgencyRedis.java index 3b8e96c9a2..73608057c8 100644 --- a/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/redis/CustomerAgencyRedis.java +++ b/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/redis/StaffAgencyRedis.java @@ -28,7 +28,7 @@ import org.springframework.stereotype.Component; * @since v1.0.0 2020-04-20 */ @Component -public class CustomerAgencyRedis { +public class StaffAgencyRedis { @Autowired private RedisUtils redisUtils; diff --git a/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/service/CustomerAgencyService.java b/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/service/StaffAgencyService.java similarity index 65% rename from epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/service/CustomerAgencyService.java rename to epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/service/StaffAgencyService.java index 85de6deeaf..ae1329232c 100644 --- a/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/service/CustomerAgencyService.java +++ b/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/service/StaffAgencyService.java @@ -17,14 +17,24 @@ package com.epmet.service; -import com.epmet.commons.mybatis.service.BaseService; -import com.epmet.entity.CustomerAgencyEntity; +import com.epmet.commons.tools.security.dto.TokenDto; +import com.epmet.commons.tools.utils.Result; +import com.epmet.dto.result.CustomerGridByUserIdResultDTO; + +import java.util.List; /** * 机关单位信息表 * * @author generator generator@elink-cn.com */ -public interface CustomerAgencyService extends BaseService { +public interface StaffAgencyService { + /** + * @param tokenDTO + * @return + * @Description 根据userId查询该用户涉及的所有网格列表 + * @Author sun + */ + Result> getMyGrids(TokenDto tokenDTO); } \ No newline at end of file diff --git a/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/service/impl/CustomerAgencyServiceImpl.java b/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/service/impl/StaffAgencyServiceImpl.java similarity index 57% rename from epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/service/impl/CustomerAgencyServiceImpl.java rename to epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/service/impl/StaffAgencyServiceImpl.java index 1f89cc5bd7..c65f231671 100644 --- a/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/service/impl/CustomerAgencyServiceImpl.java +++ b/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/service/impl/StaffAgencyServiceImpl.java @@ -17,24 +17,39 @@ package com.epmet.service.impl; -import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; -import com.epmet.dao.CustomerAgencyDao; -import com.epmet.entity.CustomerAgencyEntity; -import com.epmet.service.CustomerAgencyService; +import com.epmet.commons.tools.security.dto.TokenDto; +import com.epmet.commons.tools.utils.Result; +import com.epmet.dto.result.CustomerGridByUserIdResultDTO; +import com.epmet.feign.EpmetUserFeignClient; +import com.epmet.feign.GovOrgFeignClient; +import com.epmet.service.StaffAgencyService; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; +import java.util.List; + /** * 机关单位信息表 * * @author generator generator@elink-cn.com */ @Service -public class CustomerAgencyServiceImpl extends BaseServiceImpl implements CustomerAgencyService { +public class StaffAgencyServiceImpl implements StaffAgencyService { @Autowired private GovOrgFeignClient govOrgFeignClient; @Autowired private EpmetUserFeignClient epmetUserFeignClient; + /** + * @param tokenDTO + * @return + * @Description 根据userId查询该用户涉及的所有网格列表 + * @Author sun + */ + @Override + public Result> getMyGrids(TokenDto tokenDTO) { + return govOrgFeignClient.getMyGrids(tokenDTO.getUserId()); + } } \ No newline at end of file diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/CustomerGridByUserIdResultDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/CustomerGridByUserIdResultDTO.java new file mode 100644 index 0000000000..b0b04da974 --- /dev/null +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/CustomerGridByUserIdResultDTO.java @@ -0,0 +1,30 @@ +package com.epmet.dto.result; + +import lombok.Data; + +import java.io.Serializable; + +/** + * @Description 根据userId查询该用户涉及的所有网格返回结果 + * @ClassName CustomerGridByUserIdResultDTO + * @Author sun + */ +@Data +public class CustomerGridByUserIdResultDTO implements Serializable { + private static final long serialVersionUID = -1L; + + /** + * 网格直属组织ID + */ + private String agencyId; + + /** + * 网格ID + */ + private String gridId; + + /** + * 网格名称 + */ + private String gridName; +} diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/CustomerGridController.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/CustomerGridController.java index 2599fa67e3..1e565d5b76 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/CustomerGridController.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/CustomerGridController.java @@ -28,6 +28,7 @@ import com.epmet.commons.tools.validator.group.UpdateGroup; import com.epmet.dto.CustomerGridDTO; 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.excel.CustomerGridExcel; import com.epmet.service.CustomerGridService; @@ -125,4 +126,14 @@ public class CustomerGridController { return new Result().ok(data); } + /** + * @param userId + * @return + * @Description 根据userId查询该用户涉及的所有网格列表 + * @Author sun + */ + @PostMapping("getmygrids/{userId}") + public Result> getMyGrids(@PathVariable("userId") String userId) { + return customerGridService.getMyGrids(userId); + } } 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 a8113682c4..edf49d86d1 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 @@ -21,6 +21,7 @@ import com.epmet.commons.mybatis.dao.BaseDao; import com.epmet.dto.CustomerGridDTO; 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.entity.CustomerGridEntity; import org.apache.ibatis.annotations.Mapper; @@ -61,4 +62,11 @@ public interface CustomerGridDao extends BaseDao { CustomerGridDTO getCustomerGridByGridId(CustomerGridFormDTO customerGridFormDTO); + /** + * @param userId + * @return + * @Description 根据userId查询该用户涉及的所有网格列表 + * @Author sun + */ + List getMyGrids(String userId); } \ 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 cf24460d88..44b206c7c5 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 @@ -23,6 +23,7 @@ import com.epmet.commons.tools.utils.Result; import com.epmet.dto.CustomerGridDTO; 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.entity.CustomerGridEntity; @@ -114,4 +115,11 @@ public interface CustomerGridService extends BaseService { */ Result getCustomerGridByGridId(CustomerGridFormDTO customerGridFormDTO); + /** + * @param userId + * @return + * @Description 根据userId查询该用户涉及的所有网格列表 + * @Author sun + */ + Result> getMyGrids(String userId); } \ 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 86cb83f0c2..f11352265f 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,6 +28,7 @@ import com.epmet.dao.CustomerGridDao; import com.epmet.dto.CustomerGridDTO; 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.entity.CustomerGridEntity; import com.epmet.redis.CustomerGridRedis; @@ -151,4 +152,15 @@ public class CustomerGridServiceImpl extends BaseServiceImpl().ok(baseDao.getCustomerGridByGridId(customerGridFormDTO)); } + /** + * @param userId + * @return + * @Description 根据userId查询该用户涉及的所有网格列表 + * @Author sun + */ + @Override + public Result> getMyGrids(String userId) { + return new Result>().ok(baseDao.getMyGrids(userId)); + } + } 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 a2421ac708..343558b7d7 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 @@ -93,4 +93,20 @@ + + \ No newline at end of file From 9bcd561b561ffb11e412eb32c80081750d54529a Mon Sep 17 00:00:00 2001 From: sunyuchao Date: Wed, 22 Apr 2020 16:23:49 +0800 Subject: [PATCH 26/85] =?UTF-8?q?customer=5Fagency=E8=A1=A8=E6=B7=BB?= =?UTF-8?q?=E5=8A=A0=E5=AD=97=E6=AE=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/resources/db/migration/epmet_gov_org.sql | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/epmet-module/gov-org/gov-org-server/src/main/resources/db/migration/epmet_gov_org.sql b/epmet-module/gov-org/gov-org-server/src/main/resources/db/migration/epmet_gov_org.sql index 34bf6d70cc..2dc0bba345 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/resources/db/migration/epmet_gov_org.sql +++ b/epmet-module/gov-org/gov-org-server/src/main/resources/db/migration/epmet_gov_org.sql @@ -106,3 +106,8 @@ alter table customer_grid drop column SORT; alter table customer_grid add column ORG_ID varchar(64) NOT NULL COMMENT '所属组织机构ID(customer_organization.id)'; alter table customer_grid add column MANAGE_DISTRICT varchar(255) DEFAULT "" NOT NULL COMMENT '管辖区域'; alter table customer_grid add column TOTAL_USER INT(11) DEFAULT 0 NOT NULL COMMENT '当前网格总人数'; +ALTER TABLE customer_agency ADD ( + COUNTRY VARCHAR (32) DEFAULT NULL COMMENT '国家', + PROVINCE VARCHAR (32) DEFAULT NULL COMMENT '省份', + CITY VARCHAR (32) DEFAULT NULL COMMENT '城市' +); \ No newline at end of file From 74af1354c6840a0ef271a2937d3fbf2925160dac Mon Sep 17 00:00:00 2001 From: zhaoqifeng Date: Wed, 22 Apr 2020 17:00:20 +0800 Subject: [PATCH 27/85] =?UTF-8?q?=E8=8E=B7=E5=8F=96=E6=9C=80=E8=BF=91?= =?UTF-8?q?=E4=B8=80=E6=AC=A1=E7=99=BB=E5=BD=95=E7=9A=84=E5=AE=A2=E6=88=B7?= =?UTF-8?q?=E4=BF=A1=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- epmet-module/gov-mine/gov-mine-server/pom.xml | 6 + .../controller/StaffAgencyController.java | 38 ++-- .../com/epmet/feign/EpmetUserFeignClient.java | 13 ++ .../EpmetUserFeignClientFallback.java | 8 + .../com/epmet/service/StaffAgencyService.java | 8 + .../service/impl/StaffAgencyServiceImpl.java | 7 + .../epmet/controller/CustomerController.java | 11 ++ .../com/epmet/service/CustomerService.java | 7 + .../service/impl/CustomerServiceImpl.java | 6 + .../dto/result/LatestCustomerResultDTO.java | 31 ++++ epmet-user/epmet-user-server/pom.xml | 6 + .../StaffAgencyVisitedController.java | 63 ++++--- .../java/com/epmet/dao/CustomerStaffDao.java | 2 + .../com/epmet/dao/StaffAgencyVisitedDao.java | 3 + .../com/epmet/feign/OperCrmFeignClient.java | 25 +++ .../fallback/OperCrmFeignClientFallBack.java | 19 ++ .../epmet/service/CustomerStaffService.java | 150 ++++++++------- .../service/StaffAgencyVisitedService.java | 151 ++++++++------- .../impl/CustomerStaffServiceImpl.java | 6 + .../impl/StaffAgencyVisitedServiceImpl.java | 172 +++++++++++------- .../resources/mapper/CustomerStaffDao.xml | 5 + .../mapper/StaffAgencyVisitedDao.xml | 15 ++ 22 files changed, 504 insertions(+), 248 deletions(-) create mode 100644 epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/LatestCustomerResultDTO.java create mode 100644 epmet-user/epmet-user-server/src/main/java/com/epmet/feign/OperCrmFeignClient.java create mode 100644 epmet-user/epmet-user-server/src/main/java/com/epmet/feign/fallback/OperCrmFeignClientFallBack.java diff --git a/epmet-module/gov-mine/gov-mine-server/pom.xml b/epmet-module/gov-mine/gov-mine-server/pom.xml index a6077f5fa3..aac182bf35 100644 --- a/epmet-module/gov-mine/gov-mine-server/pom.xml +++ b/epmet-module/gov-mine/gov-mine-server/pom.xml @@ -73,6 +73,12 @@ 2.0.0 compile + + com.epmet + epmet-user-client + 2.0.0 + compile + 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 4ba21fb7be..a4718c4482 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 @@ -21,6 +21,7 @@ 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.result.CustomerGridByUserIdResultDTO; +import com.epmet.dto.result.LatestCustomerResultDTO; import com.epmet.service.StaffAgencyService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.PostMapping; @@ -38,18 +39,29 @@ import java.util.List; @RequestMapping("agency") public class StaffAgencyController { - @Autowired - private StaffAgencyService staffAgencyService; - - /** - * @param tokenDTO - * @return - * @Description 根据userId查询该用户涉及的所有网格列表 - * @Author sun - */ - @PostMapping("getmygrids") - public Result> getMyGrids(@LoginUser TokenDto tokenDTO) { - return staffAgencyService.getMyGrids(tokenDTO); - } + @Autowired + private StaffAgencyService staffAgencyService; + + /** + * @param tokenDTO + * @return + * @Description 根据userId查询该用户涉及的所有网格列表 + * @Author sun + */ + @PostMapping("getmygrids") + public Result> getMyGrids(@LoginUser TokenDto tokenDTO) { + return staffAgencyService.getMyGrids(tokenDTO); + } + + /** + * 获取最近一次登录的客户信息 + * + * @param tokenDTO + * @return + */ + @PostMapping("getlatestcustomer") + public Result getLatestCustomer(@LoginUser TokenDto tokenDTO) { + return staffAgencyService.getLatestCustomer(tokenDTO); + } } \ 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 07d46c559d..78f955955d 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 @@ -1,8 +1,13 @@ package com.epmet.feign; import com.epmet.commons.tools.constant.ServiceConstant; +import com.epmet.commons.tools.utils.Result; +import com.epmet.dto.result.LatestCustomerResultDTO; import com.epmet.feign.fallback.EpmetUserFeignClientFallback; import org.springframework.cloud.openfeign.FeignClient; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestBody; /** * @Description @@ -10,4 +15,12 @@ import org.springframework.cloud.openfeign.FeignClient; */ @FeignClient(name = ServiceConstant.EPMET_USER_SERVER, fallback = EpmetUserFeignClientFallback.class) public interface EpmetUserFeignClient { + /** + * 获取最近一次登录的客户信息 + * + * @param userId + * @return + */ + @GetMapping("/epmetuser/staffagencyvisited/getlatestcustomer/{userId}") + Result getLatestCustomer(@PathVariable("userId") String userId); } diff --git a/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/feign/fallback/EpmetUserFeignClientFallback.java b/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/feign/fallback/EpmetUserFeignClientFallback.java index 9c5a63a4fd..dfd80859f3 100644 --- a/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/feign/fallback/EpmetUserFeignClientFallback.java +++ b/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/feign/fallback/EpmetUserFeignClientFallback.java @@ -1,5 +1,9 @@ package com.epmet.feign.fallback; +import com.epmet.commons.tools.constant.ServiceConstant; +import com.epmet.commons.tools.utils.ModuleUtils; +import com.epmet.commons.tools.utils.Result; +import com.epmet.dto.result.LatestCustomerResultDTO; import com.epmet.feign.EpmetUserFeignClient; import org.springframework.stereotype.Component; @@ -10,4 +14,8 @@ import org.springframework.stereotype.Component; @Component public class EpmetUserFeignClientFallback implements EpmetUserFeignClient { + @Override + public Result getLatestCustomer(String userId) { + return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "getLatestCustomer", userId); + } } diff --git a/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/service/StaffAgencyService.java b/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/service/StaffAgencyService.java index ae1329232c..589a0ed64e 100644 --- a/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/service/StaffAgencyService.java +++ b/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/service/StaffAgencyService.java @@ -20,6 +20,7 @@ package com.epmet.service; import com.epmet.commons.tools.security.dto.TokenDto; import com.epmet.commons.tools.utils.Result; import com.epmet.dto.result.CustomerGridByUserIdResultDTO; +import com.epmet.dto.result.LatestCustomerResultDTO; import java.util.List; @@ -37,4 +38,11 @@ public interface StaffAgencyService { * @Author sun */ Result> getMyGrids(TokenDto tokenDTO); + + /** + * 获取最近一次登录的客户信息 + * @param tokenDTO + * @return + */ + Result getLatestCustomer(TokenDto tokenDTO); } \ No newline at end of file diff --git a/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/service/impl/StaffAgencyServiceImpl.java b/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/service/impl/StaffAgencyServiceImpl.java index c65f231671..5ead6f7e81 100644 --- a/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/service/impl/StaffAgencyServiceImpl.java +++ b/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/service/impl/StaffAgencyServiceImpl.java @@ -20,6 +20,7 @@ package com.epmet.service.impl; import com.epmet.commons.tools.security.dto.TokenDto; import com.epmet.commons.tools.utils.Result; import com.epmet.dto.result.CustomerGridByUserIdResultDTO; +import com.epmet.dto.result.LatestCustomerResultDTO; import com.epmet.feign.EpmetUserFeignClient; import com.epmet.feign.GovOrgFeignClient; import com.epmet.service.StaffAgencyService; @@ -52,4 +53,10 @@ public class StaffAgencyServiceImpl implements StaffAgencyService { return govOrgFeignClient.getMyGrids(tokenDTO.getUserId()); } + @Override + public Result getLatestCustomer(TokenDto tokenDTO) { + return epmetUserFeignClient.getLatestCustomer(tokenDTO.getUserId()); + } + + } \ No newline at end of file diff --git a/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/controller/CustomerController.java b/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/controller/CustomerController.java index 4beebeae8d..4e683e3ffc 100644 --- a/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/controller/CustomerController.java +++ b/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/controller/CustomerController.java @@ -133,4 +133,15 @@ public class CustomerController { public Result> getValidCustomerList() { return customerService.getValidCustomerList(); } + + /** + * 获取客户信息 + * @param dto + * @return + */ + @PostMapping("getcostomerInfo") + public Result getCustomerInfo(@RequestBody CustomerDTO dto) { + return customerService.getCustomerInfo(dto); + } + } diff --git a/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/service/CustomerService.java b/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/service/CustomerService.java index 1ef60f3762..b36bd6f5b2 100644 --- a/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/service/CustomerService.java +++ b/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/service/CustomerService.java @@ -113,4 +113,11 @@ public interface CustomerService extends BaseService { * @Date 2020/3/18 9:44 **/ Result saveCustomerInfo(CustomerDTO dto); + + /** + * 获取客户信息 + * @param dto + * @return + */ + Result getCustomerInfo(CustomerDTO dto); } diff --git a/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/service/impl/CustomerServiceImpl.java b/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/service/impl/CustomerServiceImpl.java index 512eb55d40..5384193128 100644 --- a/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/service/impl/CustomerServiceImpl.java +++ b/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/service/impl/CustomerServiceImpl.java @@ -129,4 +129,10 @@ public class CustomerServiceImpl extends BaseServiceImpl().ok(entity.getId()); } + @Override + public Result getCustomerInfo(CustomerDTO dto) { + CustomerEntity entity = baseDao.selectById(dto.getId()); + return new Result().ok(ConvertUtils.sourceToTarget(entity, CustomerDTO.class)); + } + } diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/LatestCustomerResultDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/LatestCustomerResultDTO.java new file mode 100644 index 0000000000..5bdf00228b --- /dev/null +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/LatestCustomerResultDTO.java @@ -0,0 +1,31 @@ +package com.epmet.dto.result; + +import lombok.Data; + +import java.io.Serializable; + +/** + * @author zhaoqifeng + * @dscription + * @date 2020/4/22 9:59 + */ +@Data +public class LatestCustomerResultDTO implements Serializable { + private static final long serialVersionUID = 1L; + /** + * 客户ID + */ + private String customerId; + /** + * 客户名称 + */ + private String customerName; + /** + * 客户顶级名称 + */ + private String agencyId; + /** + * 工作人员头像 + */ + private String staffHeadPhoto; +} diff --git a/epmet-user/epmet-user-server/pom.xml b/epmet-user/epmet-user-server/pom.xml index adc3bba016..761a0299a9 100644 --- a/epmet-user/epmet-user-server/pom.xml +++ b/epmet-user/epmet-user-server/pom.xml @@ -70,6 +70,12 @@ 2.0.0 compile + + com.epmet + oper-crm-client + 2.0.0 + compile + diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/StaffAgencyVisitedController.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/StaffAgencyVisitedController.java index 5111dc2a25..73d2ea4d27 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/StaffAgencyVisitedController.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/StaffAgencyVisitedController.java @@ -19,6 +19,7 @@ package com.epmet.controller; import com.epmet.commons.tools.utils.Result; import com.epmet.dto.form.StaffLoginAgencyRecordFormDTO; +import com.epmet.dto.result.LatestCustomerResultDTO; import com.epmet.dto.result.StaffLatestAgencyResultDTO; import com.epmet.service.StaffAgencyVisitedService; import org.springframework.beans.factory.annotation.Autowired; @@ -34,31 +35,43 @@ import org.springframework.web.bind.annotation.*; @RestController @RequestMapping("staffagencyvisited") public class StaffAgencyVisitedController { - - @Autowired - private StaffAgencyVisitedService staffAgencyVisitedService; - /** - * @param openId - * @return com.epmet.commons.tools.utils.Result - * @Author yinzuomei - * @Description 获取当前微信上次登录的账号信息 - * @Date 2020/4/20 12:42 - **/ - @GetMapping(value = "getlatest/{openId}") - public Result getLatestStaffWechatLoginRecord(@PathVariable("openId") String openId) { - return staffAgencyVisitedService.getLatestStaffWechatLoginRecord(openId); - } + @Autowired + private StaffAgencyVisitedService staffAgencyVisitedService; - /** - * @param formDTO - * @return com.epmet.commons.tools.utils.Result - * @Author yinzuomei - * @Description 保存登录日志 - * @Date 2020/4/20 14:29 - **/ - @PostMapping(value = "saveStaffLoginRecord") - public Result saveStaffLoginRecord(@RequestBody StaffLoginAgencyRecordFormDTO formDTO) { - return staffAgencyVisitedService.saveStaffLoginRecord(formDTO); - } + /** + * @param openId + * @return com.epmet.commons.tools.utils.Result + * @Author yinzuomei + * @Description 获取当前微信上次登录的账号信息 + * @Date 2020/4/20 12:42 + **/ + @GetMapping(value = "getlatest/{openId}") + public Result getLatestStaffWechatLoginRecord(@PathVariable("openId") String openId) { + return staffAgencyVisitedService.getLatestStaffWechatLoginRecord(openId); + } + + /** + * @param formDTO + * @return com.epmet.commons.tools.utils.Result + * @Author yinzuomei + * @Description 保存登录日志 + * @Date 2020/4/20 14:29 + **/ + @PostMapping(value = "saveStaffLoginRecord") + public Result saveStaffLoginRecord(@RequestBody StaffLoginAgencyRecordFormDTO formDTO) { + return staffAgencyVisitedService.saveStaffLoginRecord(formDTO); + } + + /** + * 获取最近一次登录的客户信息 + * + * @param userId 参数 + * @return Result + * @author zhaoqifeng + */ + @GetMapping("getlatestcustomer/{userId}") + public Result getLatestCustomer(@PathVariable("userId") String userId) { + return staffAgencyVisitedService.getLatestCustomer(userId); + } } \ 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 a676eb8a2c..689af6a49b 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 @@ -51,4 +51,6 @@ public interface CustomerStaffDao extends BaseDao { * @Date 2020/4/20 14:08 **/ CustomerStaffDTO selectListCustomerStaffInfo(CustomerStaffFormDTO formDTO); + + CustomerStaffDTO selectStaffInfoByUserId(CustomerStaffDTO formDTO); } \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/StaffAgencyVisitedDao.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/StaffAgencyVisitedDao.java index 189b179f0c..4e55a5e731 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/StaffAgencyVisitedDao.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/StaffAgencyVisitedDao.java @@ -38,4 +38,7 @@ public interface StaffAgencyVisitedDao extends BaseDao * @Date 2020/4/20 12:45 **/ StaffLatestAgencyResultDTO selectLatestStaffWechatLoginRecord(String openId); + + + StaffLatestAgencyResultDTO selectLatestCustomer(String userId); } \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/feign/OperCrmFeignClient.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/feign/OperCrmFeignClient.java new file mode 100644 index 0000000000..9cd6369f4f --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/feign/OperCrmFeignClient.java @@ -0,0 +1,25 @@ +package com.epmet.feign; + +import com.epmet.commons.tools.constant.ServiceConstant; +import com.epmet.commons.tools.utils.Result; +import com.epmet.dto.CustomerDTO; +import com.epmet.feign.fallback.OperCrmFeignClientFallBack; +import org.springframework.cloud.openfeign.FeignClient; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; + +/** + * @author zhaoqifeng + * @dscription + * @date 2020/4/22 10:41 + */ +@FeignClient(name = ServiceConstant.OPER_CRM_SERVER, fallback = OperCrmFeignClientFallBack.class) +public interface OperCrmFeignClient { + /** + * 获取客户信息 + * @param dto + * @return + */ + @PostMapping("/oper/crm/customer/getcostomerInfo") + Result getCustomerInfo(@RequestBody CustomerDTO dto); +} diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/feign/fallback/OperCrmFeignClientFallBack.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/feign/fallback/OperCrmFeignClientFallBack.java new file mode 100644 index 0000000000..473a1fe64f --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/feign/fallback/OperCrmFeignClientFallBack.java @@ -0,0 +1,19 @@ +package com.epmet.feign.fallback; + +import com.epmet.commons.tools.constant.ServiceConstant; +import com.epmet.commons.tools.utils.ModuleUtils; +import com.epmet.commons.tools.utils.Result; +import com.epmet.dto.CustomerDTO; +import com.epmet.feign.OperCrmFeignClient; + +/** + * @author zhaoqifeng + * @dscription + * @date 2020/4/22 10:43 + */ +public class OperCrmFeignClientFallBack implements OperCrmFeignClient { + @Override + public Result getCustomerInfo(CustomerDTO dto) { + return ModuleUtils.feignConError(ServiceConstant.OPER_CRM_SERVER, "getCustomerInfo", dto); + } +} 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 b459bdb83c..12c2c04c52 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 @@ -35,81 +35,91 @@ import java.util.Map; */ public interface CustomerStaffService extends BaseService { - /** - * 默认分页 - * - * @param params - * @return PageData - * @author generator - * @date 2020-04-18 - */ - PageData page(Map params); + /** + * 默认分页 + * + * @param params + * @return PageData + * @author generator + * @date 2020-04-18 + */ + PageData page(Map params); - /** - * 默认查询 - * - * @param params - * @return java.util.List - * @author generator - * @date 2020-04-18 - */ - List list(Map params); + /** + * 默认查询 + * + * @param params + * @return java.util.List + * @author generator + * @date 2020-04-18 + */ + List list(Map params); - /** - * 单条查询 - * - * @param id - * @return CustomerStaffDTO - * @author generator - * @date 2020-04-18 - */ - CustomerStaffDTO get(String id); + /** + * 单条查询 + * + * @param id + * @return CustomerStaffDTO + * @author generator + * @date 2020-04-18 + */ + CustomerStaffDTO get(String id); - /** - * 默认保存 - * - * @param dto - * @return void - * @author generator - * @date 2020-04-18 - */ - void save(CustomerStaffDTO dto); + /** + * 默认保存 + * + * @param dto + * @return void + * @author generator + * @date 2020-04-18 + */ + void save(CustomerStaffDTO dto); - /** - * 默认更新 - * - * @param dto - * @return void - * @author generator - * @date 2020-04-18 - */ - void update(CustomerStaffDTO dto); + /** + * 默认更新 + * + * @param dto + * @return void + * @author generator + * @date 2020-04-18 + */ + void update(CustomerStaffDTO dto); - /** - * 批量删除 - * - * @param ids - * @return void - * @author generator - * @date 2020-04-18 - */ - void delete(String[] ids); + /** + * 批量删除 + * + * @param ids + * @return void + * @author generator + * @date 2020-04-18 + */ + void delete(String[] ids); - /** - * @param mobile 手机号 - * @return com.epmet.commons.tools.utils.Result - * @Author yinzuomei - * @Description 根据手机号查询政府端工作人员基本信息,校验用户是否存在 - * @Date 2020/4/18 14:07 - **/ - Result> getCustsomerStaffByPhone(String mobile); + /** + * @param mobile 手机号 + * @return com.epmet.commons.tools.utils.Result + * @Author yinzuomei + * @Description 根据手机号查询政府端工作人员基本信息,校验用户是否存在 + * @Date 2020/4/18 14:07 + **/ + Result> getCustsomerStaffByPhone(String mobile); - /** - * @param formDTO - * @return com.epmet.commons.tools.utils.Result - * @Author yinzuomei - * @Description 根据手机号+客户id获取工作人员基本信息 - * @Date 2020/4/20 14:05 - **/ - Result getCustomerStaffInfo(CustomerStaffFormDTO formDTO); + /** + * @param formDTO + * @return com.epmet.commons.tools.utils.Result + * @Author yinzuomei + * @Description 根据手机号+客户id获取工作人员基本信息 + * @Date 2020/4/20 14:05 + **/ + Result getCustomerStaffInfo(CustomerStaffFormDTO formDTO); + + /** + * 根据用户ID获取工作人员基本信息 + * + * @param formDTO + * @return com.epmet.commons.tools.utils.Result + * @author zhaoqifeng + * @date 2020/4/22 10:05 + **/ + Result getCustomerStaffInfoByUserId(CustomerStaffDTO formDTO); } \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/StaffAgencyVisitedService.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/StaffAgencyVisitedService.java index 4b67657992..d8a3dc064e 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/StaffAgencyVisitedService.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/StaffAgencyVisitedService.java @@ -19,9 +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.security.dto.TokenDto; import com.epmet.commons.tools.utils.Result; import com.epmet.dto.StaffAgencyVisitedDTO; import com.epmet.dto.form.StaffLoginAgencyRecordFormDTO; +import com.epmet.dto.result.LatestCustomerResultDTO; import com.epmet.dto.result.StaffLatestAgencyResultDTO; import com.epmet.entity.StaffAgencyVisitedEntity; @@ -36,81 +38,90 @@ import java.util.Map; */ public interface StaffAgencyVisitedService extends BaseService { - /** - * 默认分页 - * - * @param params - * @return PageData - * @author generator - * @date 2020-04-21 - */ - PageData page(Map params); + /** + * 默认分页 + * + * @param params + * @return PageData + * @author generator + * @date 2020-04-21 + */ + PageData page(Map params); - /** - * 默认查询 - * - * @param params - * @return java.util.List - * @author generator - * @date 2020-04-21 - */ - List list(Map params); + /** + * 默认查询 + * + * @param params + * @return java.util.List + * @author generator + * @date 2020-04-21 + */ + List list(Map params); - /** - * 单条查询 - * - * @param id - * @return StaffAgencyVisitedDTO - * @author generator - * @date 2020-04-21 - */ - StaffAgencyVisitedDTO get(String id); + /** + * 单条查询 + * + * @param id + * @return StaffAgencyVisitedDTO + * @author generator + * @date 2020-04-21 + */ + StaffAgencyVisitedDTO get(String id); - /** - * 默认保存 - * - * @param dto - * @return void - * @author generator - * @date 2020-04-21 - */ - void save(StaffAgencyVisitedDTO dto); + /** + * 默认保存 + * + * @param dto + * @return void + * @author generator + * @date 2020-04-21 + */ + void save(StaffAgencyVisitedDTO dto); - /** - * 默认更新 - * - * @param dto - * @return void - * @author generator - * @date 2020-04-21 - */ - void update(StaffAgencyVisitedDTO dto); + /** + * 默认更新 + * + * @param dto + * @return void + * @author generator + * @date 2020-04-21 + */ + void update(StaffAgencyVisitedDTO dto); - /** - * 批量删除 - * - * @param ids - * @return void - * @author generator - * @date 2020-04-21 - */ - void delete(String[] ids); + /** + * 批量删除 + * + * @param ids + * @return void + * @author generator + * @date 2020-04-21 + */ + void delete(String[] ids); - /** - * @param openId - * @return com.epmet.commons.tools.utils.Result - * @Author yinzuomei - * @Description 获取当前微信上次登录的账号信息 - * @Date 2020/4/20 12:43 - **/ - Result getLatestStaffWechatLoginRecord(String openId); + /** + * @param openId + * @return com.epmet.commons.tools.utils.Result + * @Author yinzuomei + * @Description 获取当前微信上次登录的账号信息 + * @Date 2020/4/20 12:43 + **/ + Result getLatestStaffWechatLoginRecord(String openId); - /** - * @param formDTO - * @return com.epmet.commons.tools.utils.Result - * @Author yinzuomei - * @Description 保存登录日志 - * @Date 2020/4/20 14:33 - **/ - Result saveStaffLoginRecord(StaffLoginAgencyRecordFormDTO formDTO); + /** + * @param formDTO + * @return com.epmet.commons.tools.utils.Result + * @Author yinzuomei + * @Description 保存登录日志 + * @Date 2020/4/20 14:33 + **/ + Result saveStaffLoginRecord(StaffLoginAgencyRecordFormDTO formDTO); + + /** + * 获取最近一次登录的客户信息 + * + * @param userId 参数 + * @return Result + * @author zhaoqifeng + */ + Result getLatestCustomer(String userId); } \ 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 9d9e11a64c..e0d2c3ac8f 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 @@ -134,4 +134,10 @@ public class CustomerStaffServiceImpl extends BaseServiceImpl().ok(customerStaffDTO); } + @Override + public Result getCustomerStaffInfoByUserId(CustomerStaffDTO formDTO) { + CustomerStaffDTO customerStaffDTO = baseDao.selectStaffInfoByUserId(formDTO); + return new Result().ok(customerStaffDTO); + } + } \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/StaffAgencyVisitedServiceImpl.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/StaffAgencyVisitedServiceImpl.java index 399b4c6bf0..5108b1d8a5 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/StaffAgencyVisitedServiceImpl.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/StaffAgencyVisitedServiceImpl.java @@ -22,17 +22,24 @@ import com.baomidou.mybatisplus.core.metadata.IPage; import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; import com.epmet.commons.tools.constant.FieldConstant; import com.epmet.commons.tools.page.PageData; +import com.epmet.commons.tools.security.dto.TokenDto; import com.epmet.commons.tools.utils.ConvertUtils; import com.epmet.commons.tools.utils.Result; import com.epmet.dao.StaffAgencyVisitedDao; +import com.epmet.dto.CustomerDTO; +import com.epmet.dto.CustomerStaffDTO; import com.epmet.dto.StaffAgencyVisitedDTO; import com.epmet.dto.form.StaffLoginAgencyRecordFormDTO; +import com.epmet.dto.result.LatestCustomerResultDTO; import com.epmet.dto.result.StaffLatestAgencyResultDTO; import com.epmet.entity.StaffAgencyVisitedEntity; +import com.epmet.feign.OperCrmFeignClient; +import com.epmet.service.CustomerStaffService; import com.epmet.service.StaffAgencyVisitedService; 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; @@ -48,74 +55,99 @@ import java.util.Map; */ @Service public class StaffAgencyVisitedServiceImpl extends BaseServiceImpl implements StaffAgencyVisitedService { - private static final Logger logger = LoggerFactory.getLogger(StaffAgencyVisitedServiceImpl.class); - - @Override - public PageData page(Map params) { - IPage page = baseDao.selectPage( - getPage(params, FieldConstant.CREATED_TIME, false), - getWrapper(params) - ); - return getPageData(page, StaffAgencyVisitedDTO.class); - } - - @Override - public List list(Map params) { - List entityList = baseDao.selectList(getWrapper(params)); - - return ConvertUtils.sourceToTarget(entityList, StaffAgencyVisitedDTO.class); - } - - private QueryWrapper getWrapper(Map params){ - String id = (String)params.get(FieldConstant.ID_HUMP); - - QueryWrapper wrapper = new QueryWrapper<>(); - wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id); - - return wrapper; - } - - @Override - public StaffAgencyVisitedDTO get(String id) { - StaffAgencyVisitedEntity entity = baseDao.selectById(id); - return ConvertUtils.sourceToTarget(entity, StaffAgencyVisitedDTO.class); - } - - @Override - @Transactional(rollbackFor = Exception.class) - public void save(StaffAgencyVisitedDTO dto) { - StaffAgencyVisitedEntity entity = ConvertUtils.sourceToTarget(dto, StaffAgencyVisitedEntity.class); - insert(entity); - } - - @Override - @Transactional(rollbackFor = Exception.class) - public void update(StaffAgencyVisitedDTO dto) { - StaffAgencyVisitedEntity entity = ConvertUtils.sourceToTarget(dto, StaffAgencyVisitedEntity.class); - updateById(entity); - } - - @Override - @Transactional(rollbackFor = Exception.class) - public void delete(String[] ids) { - // 逻辑删除(@TableLogic 注解) - baseDao.deleteBatchIds(Arrays.asList(ids)); - } - - @Override - public Result getLatestStaffWechatLoginRecord(String openId) { - if (StringUtils.isNotBlank(openId)) { - logger.error("openId 不能为空"); - return new Result(); - } - StaffLatestAgencyResultDTO latestStaffWechatLoginDTO = baseDao.selectLatestStaffWechatLoginRecord(openId); - return new Result().ok(latestStaffWechatLoginDTO); - } - - @Override - public Result saveStaffLoginRecord(StaffLoginAgencyRecordFormDTO formDTO) { - StaffAgencyVisitedEntity entity = ConvertUtils.sourceToTarget(formDTO, StaffAgencyVisitedEntity.class); - insert(entity); - return new Result(); - } + private static final Logger logger = LoggerFactory.getLogger(StaffAgencyVisitedServiceImpl.class); + + @Autowired + private CustomerStaffService customerStaffService; + @Autowired + private OperCrmFeignClient operCrmFeignClient; + + @Override + public PageData page(Map params) { + IPage page = baseDao.selectPage( + getPage(params, FieldConstant.CREATED_TIME, false), + getWrapper(params) + ); + return getPageData(page, StaffAgencyVisitedDTO.class); + } + + @Override + public List list(Map params) { + List entityList = baseDao.selectList(getWrapper(params)); + + return ConvertUtils.sourceToTarget(entityList, StaffAgencyVisitedDTO.class); + } + + private QueryWrapper getWrapper(Map params) { + String id = (String) params.get(FieldConstant.ID_HUMP); + + QueryWrapper wrapper = new QueryWrapper<>(); + wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id); + + return wrapper; + } + + @Override + public StaffAgencyVisitedDTO get(String id) { + StaffAgencyVisitedEntity entity = baseDao.selectById(id); + return ConvertUtils.sourceToTarget(entity, StaffAgencyVisitedDTO.class); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void save(StaffAgencyVisitedDTO dto) { + StaffAgencyVisitedEntity entity = ConvertUtils.sourceToTarget(dto, StaffAgencyVisitedEntity.class); + insert(entity); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void update(StaffAgencyVisitedDTO dto) { + StaffAgencyVisitedEntity entity = ConvertUtils.sourceToTarget(dto, StaffAgencyVisitedEntity.class); + updateById(entity); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void delete(String[] ids) { + // 逻辑删除(@TableLogic 注解) + baseDao.deleteBatchIds(Arrays.asList(ids)); + } + + @Override + public Result getLatestStaffWechatLoginRecord(String openId) { + if (StringUtils.isNotBlank(openId)) { + logger.error("openId 不能为空"); + return new Result(); + } + StaffLatestAgencyResultDTO latestStaffWechatLoginDTO = baseDao.selectLatestStaffWechatLoginRecord(openId); + return new Result().ok(latestStaffWechatLoginDTO); + } + + @Override + public Result saveStaffLoginRecord(StaffLoginAgencyRecordFormDTO formDTO) { + StaffAgencyVisitedEntity entity = ConvertUtils.sourceToTarget(formDTO, StaffAgencyVisitedEntity.class); + insert(entity); + return new Result(); + } + + @Override + public Result getLatestCustomer(String userId) { + LatestCustomerResultDTO resultDTO = new LatestCustomerResultDTO(); + StaffLatestAgencyResultDTO latestCustomer = baseDao.selectLatestCustomer(userId); + resultDTO.setAgencyId(latestCustomer.getAgencyId()); + resultDTO.setCustomerId(latestCustomer.getCustomerId()); + //获取工作人员头像 + CustomerStaffDTO customerStaffParam = new CustomerStaffDTO(); + customerStaffParam.setUserId(userId); + Result staffInfo = + customerStaffService.getCustomerStaffInfoByUserId(customerStaffParam); + resultDTO.setStaffHeadPhoto(staffInfo.getData().getHeadPhoto()); + //获取客户名称 + CustomerDTO customerDTO = new CustomerDTO(); + customerDTO.setId(latestCustomer.getCustomerId()); + Result customerResult = operCrmFeignClient.getCustomerInfo(customerDTO); + resultDTO.setCustomerName(customerResult.getData().getCustomerName()); + return new Result().ok(resultDTO); + } } \ 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 3478b0fbba..08b3afb984 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 @@ -18,4 +18,9 @@ and cs.CUSTOMER_ID=#{customerId} and cs.DEL_FLAG='1' + \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/resources/mapper/StaffAgencyVisitedDao.xml b/epmet-user/epmet-user-server/src/main/resources/mapper/StaffAgencyVisitedDao.xml index d211f53ac4..82bc2cace3 100644 --- a/epmet-user/epmet-user-server/src/main/resources/mapper/StaffAgencyVisitedDao.xml +++ b/epmet-user/epmet-user-server/src/main/resources/mapper/StaffAgencyVisitedDao.xml @@ -35,4 +35,19 @@ sav.CREATED_TIME DESC LIMIT 1 + \ No newline at end of file From 455d84210d0281541a007cc8cbc0e670969db321 Mon Sep 17 00:00:00 2001 From: zhaoqifeng Date: Wed, 22 Apr 2020 17:02:43 +0800 Subject: [PATCH 28/85] =?UTF-8?q?=E8=8E=B7=E5=8F=96=E6=9C=80=E8=BF=91?= =?UTF-8?q?=E4=B8=80=E6=AC=A1=E7=99=BB=E5=BD=95=E7=9A=84=E5=AE=A2=E6=88=B7?= =?UTF-8?q?=E4=BF=A1=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/epmet/feign/fallback/OperCrmFeignClientFallBack.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/feign/fallback/OperCrmFeignClientFallBack.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/feign/fallback/OperCrmFeignClientFallBack.java index 473a1fe64f..d40619a04c 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/feign/fallback/OperCrmFeignClientFallBack.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/feign/fallback/OperCrmFeignClientFallBack.java @@ -5,12 +5,14 @@ import com.epmet.commons.tools.utils.ModuleUtils; import com.epmet.commons.tools.utils.Result; import com.epmet.dto.CustomerDTO; import com.epmet.feign.OperCrmFeignClient; +import org.springframework.stereotype.Component; /** * @author zhaoqifeng * @dscription * @date 2020/4/22 10:43 */ +@Component public class OperCrmFeignClientFallBack implements OperCrmFeignClient { @Override public Result getCustomerInfo(CustomerDTO dto) { From 4e4c0700bf986b91a2da39e926ecbc2a14eeadce Mon Sep 17 00:00:00 2001 From: wxz Date: Wed, 22 Apr 2020 17:27:46 +0800 Subject: [PATCH 29/85] =?UTF-8?q?1.gov=E2=80=94mine=E5=92=8Cgov-access?= =?UTF-8?q?=E5=BE=AE=E6=9C=8D=E5=8A=A1=E9=94=99=E8=AF=AF=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../gov-access/gov-access-server/pom.xml | 6 ++--- epmet-module/gov-mine/gov-mine-client/pom.xml | 25 ++++++++++++++++--- epmet-module/gov-mine/gov-mine-server/pom.xml | 11 ++++---- .../java/com/epmet/GovMineApplication.java | 13 ++++++++++ .../com/epmet/config/ModuleConfigImpl.java | 24 ++++++++++++++++++ 5 files changed, 67 insertions(+), 12 deletions(-) create mode 100644 epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/GovMineApplication.java create mode 100644 epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/config/ModuleConfigImpl.java diff --git a/epmet-module/gov-access/gov-access-server/pom.xml b/epmet-module/gov-access/gov-access-server/pom.xml index 31695bd331..b6da423ab1 100644 --- a/epmet-module/gov-access/gov-access-server/pom.xml +++ b/epmet-module/gov-access/gov-access-server/pom.xml @@ -93,7 +93,7 @@ true - 8097 + 8099 dev @@ -123,7 +123,7 @@ true --> - 8093 + 8099 dev @@ -153,7 +153,7 @@ true --> - 8093 + 8099 test diff --git a/epmet-module/gov-mine/gov-mine-client/pom.xml b/epmet-module/gov-mine/gov-mine-client/pom.xml index c97b0dceb3..193f0aeebd 100644 --- a/epmet-module/gov-mine/gov-mine-client/pom.xml +++ b/epmet-module/gov-mine/gov-mine-client/pom.xml @@ -2,16 +2,35 @@ + 0.3.0 - epmet-module com.epmet + gov-mine 2.0.0 - ../../pom.xml 4.0.0 gov-mine-client - 0.3.0 + + + + com.epmet + epmet-commons-tools + 2.0.0 + + + io.springfox + springfox-swagger2 + + + io.springfox + springfox-swagger-ui + + + + + ${project.artifactId} + \ No newline at end of file diff --git a/epmet-module/gov-mine/gov-mine-server/pom.xml b/epmet-module/gov-mine/gov-mine-server/pom.xml index a6077f5fa3..71d033d62d 100644 --- a/epmet-module/gov-mine/gov-mine-server/pom.xml +++ b/epmet-module/gov-mine/gov-mine-server/pom.xml @@ -2,26 +2,25 @@ + 0.3.0 - epmet-module com.epmet + gov-mine 2.0.0 - ../../pom.xml 4.0.0 gov-mine-server - 0.3.0 com.epmet - epmet-commons-tools - 2.0.0 + gov-mine-client + 0.3.0 com.epmet - epmet-commons-mybatis + epmet-commons-tools 2.0.0 diff --git a/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/GovMineApplication.java b/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/GovMineApplication.java new file mode 100644 index 0000000000..ab542b8327 --- /dev/null +++ b/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/GovMineApplication.java @@ -0,0 +1,13 @@ +package com.epmet; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; + +@SpringBootApplication +public class GovMineApplication { + + public static void main(String[] args) { + SpringApplication.run(GovMineApplication.class, args); + } + +} diff --git a/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/config/ModuleConfigImpl.java b/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/config/ModuleConfigImpl.java new file mode 100644 index 0000000000..8ccca90cd1 --- /dev/null +++ b/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/config/ModuleConfigImpl.java @@ -0,0 +1,24 @@ +/** + * Copyright (c) 2018 人人开源 All rights reserved. + *

+ * https://www.renren.io + *

+ * 版权所有,侵权必究! + */ + +package com.epmet.config; + +import com.epmet.commons.tools.config.ModuleConfig; +import org.springframework.stereotype.Service; + +/** + * @author Mark sunlightcs@gmail.com + * @since 1.0.0 + */ +@Service +public class ModuleConfigImpl implements ModuleConfig { + @Override + public String getName() { + return "govmine"; + } +} From fafe406379eda124c91a0d65e8c2dce20c5f1a88 Mon Sep 17 00:00:00 2001 From: wxz Date: Wed, 22 Apr 2020 17:54:26 +0800 Subject: [PATCH 30/85] =?UTF-8?q?1.=E8=A7=A3=E5=86=B3=E5=AF=B9client?= =?UTF-8?q?=E9=87=8D=E5=A4=8D=E4=BE=9D=E8=B5=96=E5=86=B2=E7=AA=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- epmet-module/gov-mine/gov-mine-server/pom.xml | 12 ------------ epmet-module/gov-mine/pom.xml | 1 + epmet-module/gov-org/gov-org-server/pom.xml | 5 ----- epmet-module/resi-mine/resi-mine-server/pom.xml | 5 ----- 4 files changed, 1 insertion(+), 22 deletions(-) diff --git a/epmet-module/gov-mine/gov-mine-server/pom.xml b/epmet-module/gov-mine/gov-mine-server/pom.xml index cd7d669cdd..877a7af756 100644 --- a/epmet-module/gov-mine/gov-mine-server/pom.xml +++ b/epmet-module/gov-mine/gov-mine-server/pom.xml @@ -60,18 +60,6 @@ 2.0.0 compile - - com.epmet - gov-org-client - 2.0.0 - compile - - - com.epmet - gov-org-client - 2.0.0 - compile - com.epmet epmet-user-client diff --git a/epmet-module/gov-mine/pom.xml b/epmet-module/gov-mine/pom.xml index ef1a4d528b..2aa523997f 100644 --- a/epmet-module/gov-mine/pom.xml +++ b/epmet-module/gov-mine/pom.xml @@ -8,6 +8,7 @@ 2.0.0 4.0.0 + pom gov-mine diff --git a/epmet-module/gov-org/gov-org-server/pom.xml b/epmet-module/gov-org/gov-org-server/pom.xml index deb18a6168..3bb6930492 100644 --- a/epmet-module/gov-org/gov-org-server/pom.xml +++ b/epmet-module/gov-org/gov-org-server/pom.xml @@ -56,11 +56,6 @@ - - com.epmet - gov-org-client - 2.0.0 - com.epmet resi-partymember-client diff --git a/epmet-module/resi-mine/resi-mine-server/pom.xml b/epmet-module/resi-mine/resi-mine-server/pom.xml index 18d3fdbc41..77cc559c92 100644 --- a/epmet-module/resi-mine/resi-mine-server/pom.xml +++ b/epmet-module/resi-mine/resi-mine-server/pom.xml @@ -12,11 +12,6 @@ jar - - com.epmet - resi-mine-client - 2.0.0 - com.epmet epmet-commons-tools From 6f57c14b09c341f265830054f138fc7dfc08a49f Mon Sep 17 00:00:00 2001 From: wxz Date: Wed, 22 Apr 2020 18:20:32 +0800 Subject: [PATCH 31/85] =?UTF-8?q?1.gov-access=E5=92=8Cgov-mine=E5=BE=AE?= =?UTF-8?q?=E6=9C=8D=E5=8A=A1=E8=B0=83=E6=95=B4=EF=BC=8C=E4=BF=AE=E5=A4=8D?= =?UTF-8?q?=E9=94=99=E8=AF=AF=202.=E5=B0=86=E6=96=B0=E6=9C=8D=E5=8A=A1?= =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E5=88=B0gateway=E4=B8=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- epmet-gateway/pom.xml | 19 +++++++++++++++ .../src/main/resources/bootstrap.yml | 23 +++++++++++++++++++ .../com/epmet/controller/TestController.java | 17 ++++++++++++++ .../controller/StaffAgencyController.java | 2 +- 4 files changed, 60 insertions(+), 1 deletion(-) create mode 100644 epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/controller/TestController.java diff --git a/epmet-gateway/pom.xml b/epmet-gateway/pom.xml index 5b943229db..57d6203598 100644 --- a/epmet-gateway/pom.xml +++ b/epmet-gateway/pom.xml @@ -155,6 +155,14 @@ lb://resi-partymember-server + + + + lb://gov-access-server + + + + lb://gov-mine-server @@ -211,6 +219,12 @@ lb://resi-group-server lb://resi-partymember-server + + + lb://gov-access-server + + + lb://gov-mine-server @@ -267,6 +281,11 @@ lb://resi-group-server lb://resi-partymember-server + + lb://gov-access-server + + + lb://gov-mine-server diff --git a/epmet-gateway/src/main/resources/bootstrap.yml b/epmet-gateway/src/main/resources/bootstrap.yml index dec03ba191..d7f1d28a50 100644 --- a/epmet-gateway/src/main/resources/bootstrap.yml +++ b/epmet-gateway/src/main/resources/bootstrap.yml @@ -167,6 +167,27 @@ spring: filters: - StripPrefix=1 - CpAuth=true + + + #政府端权限服务 + - id: gov-access-server + uri: @gateway.routes.gov-access-server.uri@ + order: 18 + predicates: + - Path=${server.servlet.context-path}/gov/access/** + filters: + - StripPrefix=1 + - CpAuth=true + + #政府端-我的-服务 + - id: gov-mine-server + uri: @gateway.routes.gov-mine-server.uri@ + order: 19 + predicates: + - Path=${server.servlet.context-path}/gov/mine/** + filters: + - StripPrefix=1 + - CpAuth=true nacos: discovery: server-addr: @nacos.server-addr@ @@ -272,6 +293,8 @@ epmet: - /resi/mine/** - /resi/group/** - /resi/partymember/** +# - /gov/mine/** +# - /gov/access/** swaggerUrls: jwt: diff --git a/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/controller/TestController.java b/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/controller/TestController.java new file mode 100644 index 0000000000..438f105eab --- /dev/null +++ b/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/controller/TestController.java @@ -0,0 +1,17 @@ +package com.epmet.controller; + +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +@RestController +@RequestMapping("test") +public class TestController { + + @GetMapping("test") + public void test() { + System.out.println(666); + } + +} 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 a4718c4482..83b649e63a 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 @@ -49,7 +49,7 @@ public class StaffAgencyController { * @Author sun */ @PostMapping("getmygrids") - public Result> getMyGrids(@LoginUser TokenDto tokenDTO) { + public Result> getMyGrids(TokenDto tokenDTO) { return staffAgencyService.getMyGrids(tokenDTO); } From 4c29ed52a72de911e3bb43842065045606f851d3 Mon Sep 17 00:00:00 2001 From: wxz Date: Wed, 22 Apr 2020 22:07:31 +0800 Subject: [PATCH 32/85] =?UTF-8?q?1.=E6=96=B0=E5=A2=9E=EF=BC=9A=E6=9F=A5?= =?UTF-8?q?=E8=AF=A2=E5=AE=A2=E6=88=B7footbar=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- epmet-module/gov-mine/gov-mine-server/pom.xml | 5 + .../java/com/epmet/GovMineApplication.java | 4 + .../com/epmet/controller/AppController.java | 37 ++++++ .../epmet/feign/OperCustomizeFeignClient.java | 21 ++++ .../OperCustomizeFeignClientFallBack.java | 22 ++++ .../com/epmet/dto/CustomerFootBarDTO.java | 96 ++++++++++++++ .../dto/form/CustomerFootBarFormDTO.java | 13 ++ .../dto/result/CustomerFootBarResultDTO.java | 97 +++++++++++++++ .../controller/CustomerFootBarController.java | 117 ++++++++++++++++++ .../com/epmet/dao/CustomerFootBarDao.java | 37 ++++++ .../epmet/entity/CustomerFootBarEntity.java | 66 ++++++++++ .../com/epmet/excel/CustomerFootBarExcel.java | 71 +++++++++++ .../com/epmet/redis/CustomerFootBarRedis.java | 47 +++++++ .../epmet/service/CustomerFootBarService.java | 97 +++++++++++++++ .../impl/CustomerFootBarServiceImpl.java | 109 ++++++++++++++++ .../db.migration/customer_foot_bar.sql | 3 +- .../resources/mapper/CustomerFootBarDao.xml | 34 +++++ 17 files changed, 875 insertions(+), 1 deletion(-) create mode 100644 epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/controller/AppController.java create mode 100644 epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/feign/OperCustomizeFeignClient.java create mode 100644 epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/feign/fallback/OperCustomizeFeignClientFallBack.java create mode 100644 epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/CustomerFootBarDTO.java create mode 100644 epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/form/CustomerFootBarFormDTO.java create mode 100644 epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/result/CustomerFootBarResultDTO.java create mode 100644 epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/controller/CustomerFootBarController.java create mode 100644 epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/dao/CustomerFootBarDao.java create mode 100644 epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/entity/CustomerFootBarEntity.java create mode 100644 epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/excel/CustomerFootBarExcel.java create mode 100644 epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/redis/CustomerFootBarRedis.java create mode 100644 epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/CustomerFootBarService.java create mode 100644 epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/impl/CustomerFootBarServiceImpl.java create mode 100644 epmet-module/oper-customize/oper-customize-server/src/main/resources/mapper/CustomerFootBarDao.xml diff --git a/epmet-module/gov-mine/gov-mine-server/pom.xml b/epmet-module/gov-mine/gov-mine-server/pom.xml index 877a7af756..8b45fb732d 100644 --- a/epmet-module/gov-mine/gov-mine-server/pom.xml +++ b/epmet-module/gov-mine/gov-mine-server/pom.xml @@ -18,6 +18,11 @@ gov-mine-client 0.3.0 + + com.epmet + oper-customize-client + 2.0.0 + com.epmet epmet-commons-tools diff --git a/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/GovMineApplication.java b/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/GovMineApplication.java index ab542b8327..f804c3926e 100644 --- a/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/GovMineApplication.java +++ b/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/GovMineApplication.java @@ -2,8 +2,12 @@ package com.epmet; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.cloud.client.discovery.EnableDiscoveryClient; +import org.springframework.cloud.openfeign.EnableFeignClients; @SpringBootApplication +@EnableDiscoveryClient +@EnableFeignClients public class GovMineApplication { public static void main(String[] args) { diff --git a/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/controller/AppController.java b/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/controller/AppController.java new file mode 100644 index 0000000000..93fef03372 --- /dev/null +++ b/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/controller/AppController.java @@ -0,0 +1,37 @@ +package com.epmet.controller; + +import com.epmet.commons.tools.utils.Result; +import com.epmet.dto.CustomerFootBarDTO; +import com.epmet.dto.form.CustomerFootBarFormDTO; +import com.epmet.feign.OperCustomizeFeignClient; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.util.CollectionUtils; +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; + +@RestController +@RequestMapping("app") +public class AppController { + + @Autowired + private OperCustomizeFeignClient operCustomizeFeign; + + /** + * 查询 + * @param formDTO + * @return + */ + @PostMapping("getcustomerfootbars") + public Result> getCustomerFootBars(@RequestBody CustomerFootBarFormDTO formDTO) { + Result> result = operCustomizeFeign.getCustomerfootbars(formDTO); + if (CollectionUtils.isEmpty(result.getData())) { + formDTO.setCustomerId("default"); + result = operCustomizeFeign.getCustomerfootbars(formDTO); + } + return result; + } +} diff --git a/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/feign/OperCustomizeFeignClient.java b/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/feign/OperCustomizeFeignClient.java new file mode 100644 index 0000000000..a645d0d44b --- /dev/null +++ b/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/feign/OperCustomizeFeignClient.java @@ -0,0 +1,21 @@ +package com.epmet.feign; + +import com.epmet.commons.tools.constant.ServiceConstant; +import com.epmet.commons.tools.utils.Result; +import com.epmet.dto.CustomerFootBarDTO; +import com.epmet.dto.form.CustomerFootBarFormDTO; +import com.epmet.feign.fallback.OperCustomizeFeignClientFallBack; +import org.springframework.cloud.openfeign.FeignClient; +import org.springframework.http.MediaType; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; + +import java.util.List; + +@FeignClient(name = ServiceConstant.OPER_CUSTOMIZE_SERVER, fallback = OperCustomizeFeignClientFallBack.class) +public interface OperCustomizeFeignClient { + + @PostMapping(value = "/oper/customize/customerfootbar/customerfootbars", consumes = MediaType.APPLICATION_JSON_UTF8_VALUE) + Result> getCustomerfootbars(@RequestBody CustomerFootBarFormDTO formDTO); + +} diff --git a/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/feign/fallback/OperCustomizeFeignClientFallBack.java b/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/feign/fallback/OperCustomizeFeignClientFallBack.java new file mode 100644 index 0000000000..6f343f3857 --- /dev/null +++ b/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/feign/fallback/OperCustomizeFeignClientFallBack.java @@ -0,0 +1,22 @@ +package com.epmet.feign.fallback; + +import com.epmet.commons.tools.constant.ServiceConstant; +import com.epmet.commons.tools.utils.ModuleUtils; +import com.epmet.commons.tools.utils.Result; +import com.epmet.dto.CustomerFootBarDTO; +import com.epmet.dto.form.CustomerFootBarFormDTO; +import com.epmet.dto.form.CustomerHomeFormDTO; +import com.epmet.dto.result.HomeDesignByCustomerResultDTO; +import com.epmet.feign.OperCustomizeFeignClient; +import org.springframework.stereotype.Component; + +import java.util.List; + +@Component +public class OperCustomizeFeignClientFallBack implements OperCustomizeFeignClient { + + @Override + public Result> getCustomerfootbars(CustomerFootBarFormDTO formDTO) { + return ModuleUtils.feignConError(ServiceConstant.OPER_CUSTOMIZE_SERVER, "getCustomerfootbars",formDTO); + } +} diff --git a/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/CustomerFootBarDTO.java b/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/CustomerFootBarDTO.java new file mode 100644 index 0000000000..2cc9b89b0e --- /dev/null +++ b/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/CustomerFootBarDTO.java @@ -0,0 +1,96 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

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

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

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.dto; + +import java.io.Serializable; +import java.util.Date; +import lombok.Data; + + +/** + * APP底部菜单栏信息 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-04-22 + */ +@Data +public class CustomerFootBarDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 唯一标识 + */ + private String id; + + /** + * bar名称 + */ + private String barName; + + /** + * KEY + */ + private String barKey; + + /** + * 页面标题 + */ + private String pageTitle; + + /** + * 图标路径 + */ + private String iconPath; + + /** + * 选中页面图标路径 + */ + private String selectedIconPath; + + /** + * 删除标识:0.未删除 1.已删除 + */ + private Integer delFlag; + + /** + * 乐观锁 + */ + private Integer revision; + + /** + * 创建人 + */ + private String createdBy; + + /** + * 创建时间 + */ + private Date createdTime; + + /** + * 更新人 + */ + private String updatedBy; + + /** + * 更新时间 + */ + private Date updatedTime; + +} \ No newline at end of file diff --git a/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/form/CustomerFootBarFormDTO.java b/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/form/CustomerFootBarFormDTO.java new file mode 100644 index 0000000000..73b4c7b500 --- /dev/null +++ b/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/form/CustomerFootBarFormDTO.java @@ -0,0 +1,13 @@ +package com.epmet.dto.form; + +import lombok.Data; + +import javax.validation.constraints.NotBlank; + +@Data +public class CustomerFootBarFormDTO { + + //@NotBlank(message = "客户ID不能为空") + private String customerId; + +} diff --git a/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/result/CustomerFootBarResultDTO.java b/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/result/CustomerFootBarResultDTO.java new file mode 100644 index 0000000000..832e06944c --- /dev/null +++ b/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/result/CustomerFootBarResultDTO.java @@ -0,0 +1,97 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

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

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

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.dto.result; + +import lombok.Data; + +import java.io.Serializable; +import java.util.Date; + + +/** + * APP底部菜单栏信息 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-04-22 + */ +@Data +public class CustomerFootBarResultDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 唯一标识 + */ + private String id; + + /** + * bar名称 + */ + private String barName; + + /** + * KEY + */ + private String barKey; + + /** + * 页面标题 + */ + private String pageTitle; + + /** + * 图标路径 + */ + private String iconPath; + + /** + * 选中页面图标路径 + */ + private String selectedIconPath; + + /** + * 删除标识:0.未删除 1.已删除 + */ + private Integer delFlag; + + /** + * 乐观锁 + */ + private Integer revision; + + /** + * 创建人 + */ + private String createdBy; + + /** + * 创建时间 + */ + private Date createdTime; + + /** + * 更新人 + */ + private String updatedBy; + + /** + * 更新时间 + */ + private Date updatedTime; + +} \ No newline at end of file diff --git a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/controller/CustomerFootBarController.java b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/controller/CustomerFootBarController.java new file mode 100644 index 0000000000..a0bd33d16c --- /dev/null +++ b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/controller/CustomerFootBarController.java @@ -0,0 +1,117 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

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

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

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.controller; + +import com.epmet.commons.tools.page.PageData; +import com.epmet.commons.tools.utils.ExcelUtils; +import com.epmet.commons.tools.utils.Result; +import com.epmet.commons.tools.validator.AssertUtils; +import com.epmet.commons.tools.validator.ValidatorUtils; +import com.epmet.commons.tools.validator.group.AddGroup; +import com.epmet.commons.tools.validator.group.UpdateGroup; +import com.epmet.commons.tools.validator.group.DefaultGroup; +import com.epmet.dto.CustomerFootBarDTO; +import com.epmet.dto.form.CustomerFootBarFormDTO; +import com.epmet.entity.CustomerFootBarEntity; +import com.epmet.excel.CustomerFootBarExcel; +import com.epmet.service.CustomerFootBarService; +import org.springframework.beans.BeanUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +import javax.servlet.http.HttpServletResponse; +import java.util.LinkedList; +import java.util.List; +import java.util.Map; + + +/** + * APP底部菜单栏信息 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-04-22 + */ +@RestController +@RequestMapping("customerfootbar") +public class CustomerFootBarController { + + @Autowired + private CustomerFootBarService customerFootBarService; + + @GetMapping("page") + public Result> page(@RequestParam Map params){ + PageData page = customerFootBarService.page(params); + return new Result>().ok(page); + } + + @GetMapping("{id}") + public Result get(@PathVariable("id") String id){ + CustomerFootBarDTO data = customerFootBarService.get(id); + return new Result().ok(data); + } + + @PostMapping + public Result save(@RequestBody CustomerFootBarDTO dto){ + //效验数据 + ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class); + customerFootBarService.save(dto); + return new Result(); + } + + @PutMapping + public Result update(@RequestBody CustomerFootBarDTO dto){ + //效验数据 + ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class); + customerFootBarService.update(dto); + return new Result(); + } + + @DeleteMapping + public Result delete(@RequestBody String[] ids){ + //效验数据 + AssertUtils.isArrayEmpty(ids, "id"); + customerFootBarService.delete(ids); + return new Result(); + } + + @GetMapping("export") + public void export(@RequestParam Map params, HttpServletResponse response) throws Exception { + List list = customerFootBarService.list(params); + ExcelUtils.exportExcelToTarget(response, null, list, CustomerFootBarExcel.class); + } + + /** + * 查询客户的APP footbar + * @param formDTO + * @return + */ + @PostMapping("customerfootbars") + public Result> getCustomerfootbars(@RequestBody CustomerFootBarFormDTO formDTO) { + ValidatorUtils.validateEntity(formDTO); + String customerId = formDTO.getCustomerId(); + + List footbars = customerFootBarService.listCustomerFootBars(customerId); + List barDTOS = new LinkedList<>(); + footbars.forEach(barEntity -> { + CustomerFootBarDTO barDTO = new CustomerFootBarDTO(); + BeanUtils.copyProperties(barEntity, barDTO); + barDTOS.add(barDTO); + }); + return new Result>().ok(barDTOS); + } +} \ No newline at end of file diff --git a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/dao/CustomerFootBarDao.java b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/dao/CustomerFootBarDao.java new file mode 100644 index 0000000000..f22bc917ad --- /dev/null +++ b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/dao/CustomerFootBarDao.java @@ -0,0 +1,37 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

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

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

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.dao; + +import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.entity.CustomerFootBarEntity; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + * APP底部菜单栏信息 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-04-22 + */ +@Mapper +public interface CustomerFootBarDao extends BaseDao { + + List listCustomerFootBars(@Param("customerId") String customerId); +} \ No newline at end of file diff --git a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/entity/CustomerFootBarEntity.java b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/entity/CustomerFootBarEntity.java new file mode 100644 index 0000000000..8bfc92afb1 --- /dev/null +++ b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/entity/CustomerFootBarEntity.java @@ -0,0 +1,66 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

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

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

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.entity; + +import com.baomidou.mybatisplus.annotation.TableName; + +import com.epmet.commons.mybatis.entity.BaseEpmetEntity; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.util.Date; + +/** + * APP底部菜单栏信息 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-04-22 + */ +@Data +@EqualsAndHashCode(callSuper=false) +@TableName("customer_foot_bar") +public class CustomerFootBarEntity extends BaseEpmetEntity { + + private static final long serialVersionUID = 1L; + + /** + * bar名称 + */ + private String barName; + + /** + * KEY + */ + private String barKey; + + /** + * 页面标题 + */ + private String pageTitle; + + /** + * 图标路径 + */ + private String iconPath; + + /** + * 选中页面图标路径 + */ + private String selectedIconPath; + +} diff --git a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/excel/CustomerFootBarExcel.java b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/excel/CustomerFootBarExcel.java new file mode 100644 index 0000000000..d282380f8f --- /dev/null +++ b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/excel/CustomerFootBarExcel.java @@ -0,0 +1,71 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

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

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

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.excel; + +import cn.afterturn.easypoi.excel.annotation.Excel; +import lombok.Data; + +import java.util.Date; + +/** + * APP底部菜单栏信息 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-04-22 + */ +@Data +public class CustomerFootBarExcel { + + @Excel(name = "唯一标识") + private String id; + + @Excel(name = "bar名称") + private String barName; + + @Excel(name = "KEY") + private String key; + + @Excel(name = "页面标题") + private String pageTitle; + + @Excel(name = "图标路径") + private String iconPath; + + @Excel(name = "选中页面图标路径") + private String selectedIconPath; + + @Excel(name = "删除标识:0.未删除 1.已删除") + private Integer delFlag; + + @Excel(name = "乐观锁") + private Integer revision; + + @Excel(name = "创建人") + private String createdBy; + + @Excel(name = "创建时间") + private Date createdTime; + + @Excel(name = "更新人") + private String updatedBy; + + @Excel(name = "更新时间") + private Date updatedTime; + + +} \ No newline at end of file diff --git a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/redis/CustomerFootBarRedis.java b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/redis/CustomerFootBarRedis.java new file mode 100644 index 0000000000..1d120429d8 --- /dev/null +++ b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/redis/CustomerFootBarRedis.java @@ -0,0 +1,47 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

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

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

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.redis; + +import com.epmet.commons.tools.redis.RedisUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +/** + * APP底部菜单栏信息 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-04-22 + */ +@Component +public class CustomerFootBarRedis { + @Autowired + private RedisUtils redisUtils; + + public void delete(Object[] ids) { + + } + + public void set(){ + + } + + public String get(String id){ + return null; + } + +} \ No newline at end of file diff --git a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/CustomerFootBarService.java b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/CustomerFootBarService.java new file mode 100644 index 0000000000..f3a793793d --- /dev/null +++ b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/CustomerFootBarService.java @@ -0,0 +1,97 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

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

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

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.service; + +import com.epmet.commons.mybatis.service.BaseService; +import com.epmet.commons.tools.page.PageData; +import com.epmet.dto.CustomerFootBarDTO; +import com.epmet.entity.CustomerFootBarEntity; + +import java.util.List; +import java.util.Map; + +/** + * APP底部菜单栏信息 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-04-22 + */ +public interface CustomerFootBarService extends BaseService { + + /** + * 默认分页 + * + * @param params + * @return PageData + * @author generator + * @date 2020-04-22 + */ + PageData page(Map params); + + /** + * 默认查询 + * + * @param params + * @return java.util.List + * @author generator + * @date 2020-04-22 + */ + List list(Map params); + + /** + * 单条查询 + * + * @param id + * @return CustomerFootBarDTO + * @author generator + * @date 2020-04-22 + */ + CustomerFootBarDTO get(String id); + + /** + * 默认保存 + * + * @param dto + * @return void + * @author generator + * @date 2020-04-22 + */ + void save(CustomerFootBarDTO dto); + + /** + * 默认更新 + * + * @param dto + * @return void + * @author generator + * @date 2020-04-22 + */ + void update(CustomerFootBarDTO dto); + + /** + * 批量删除 + * + * @param ids + * @return void + * @author generator + * @date 2020-04-22 + */ + void delete(String[] ids); + + List listCustomerFootBars(String customerId); +} \ No newline at end of file diff --git a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/impl/CustomerFootBarServiceImpl.java b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/impl/CustomerFootBarServiceImpl.java new file mode 100644 index 0000000000..15336d92fc --- /dev/null +++ b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/impl/CustomerFootBarServiceImpl.java @@ -0,0 +1,109 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

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

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

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.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.page.PageData; +import com.epmet.commons.tools.utils.ConvertUtils; +import com.epmet.commons.tools.constant.FieldConstant; +import com.epmet.dao.CustomerFootBarDao; +import com.epmet.dto.CustomerFootBarDTO; +import com.epmet.entity.CustomerFootBarEntity; +import com.epmet.redis.CustomerFootBarRedis; +import com.epmet.service.CustomerFootBarService; +import org.apache.commons.lang3.StringUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.util.Arrays; +import java.util.List; +import java.util.Map; + +/** + * APP底部菜单栏信息 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-04-22 + */ +@Service +public class CustomerFootBarServiceImpl extends BaseServiceImpl implements CustomerFootBarService { + + @Autowired + private CustomerFootBarRedis customerFootBarRedis; + + @Override + public PageData page(Map params) { + IPage page = baseDao.selectPage( + getPage(params, FieldConstant.CREATED_TIME, false), + getWrapper(params) + ); + return getPageData(page, CustomerFootBarDTO.class); + } + + @Override + public List list(Map params) { + List entityList = baseDao.selectList(getWrapper(params)); + + return ConvertUtils.sourceToTarget(entityList, CustomerFootBarDTO.class); + } + + private QueryWrapper getWrapper(Map params){ + String id = (String)params.get(FieldConstant.ID_HUMP); + + QueryWrapper wrapper = new QueryWrapper<>(); + wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id); + + return wrapper; + } + + @Override + public CustomerFootBarDTO get(String id) { + CustomerFootBarEntity entity = baseDao.selectById(id); + return ConvertUtils.sourceToTarget(entity, CustomerFootBarDTO.class); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void save(CustomerFootBarDTO dto) { + CustomerFootBarEntity entity = ConvertUtils.sourceToTarget(dto, CustomerFootBarEntity.class); + insert(entity); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void update(CustomerFootBarDTO dto) { + CustomerFootBarEntity entity = ConvertUtils.sourceToTarget(dto, CustomerFootBarEntity.class); + updateById(entity); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void delete(String[] ids) { + // 逻辑删除(@TableLogic 注解) + baseDao.deleteBatchIds(Arrays.asList(ids)); + } + + @Override + public List listCustomerFootBars(String customerId) { + return baseDao.listCustomerFootBars(customerId); + } + +} \ No newline at end of file diff --git a/epmet-module/oper-customize/oper-customize-server/src/main/resources/db.migration/customer_foot_bar.sql b/epmet-module/oper-customize/oper-customize-server/src/main/resources/db.migration/customer_foot_bar.sql index fc496afa9a..dc9eebc971 100644 --- a/epmet-module/oper-customize/oper-customize-server/src/main/resources/db.migration/customer_foot_bar.sql +++ b/epmet-module/oper-customize/oper-customize-server/src/main/resources/db.migration/customer_foot_bar.sql @@ -11,8 +11,9 @@ DROP TABLE IF EXISTS `customer_foot_bar`; CREATE TABLE `customer_foot_bar` ( `ID` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '唯一标识', + `CUSTOMER_ID` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '客户ID', `BAR_NAME` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT 'bar名称', - `KEY` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT 'KEY', + `BAR_KEY` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT 'KEY', `PAGE_TITLE` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '页面标题', `ICON_PATH` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '图标路径', `SELECTED_ICON_PATH` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '选中页面图标路径', diff --git a/epmet-module/oper-customize/oper-customize-server/src/main/resources/mapper/CustomerFootBarDao.xml b/epmet-module/oper-customize/oper-customize-server/src/main/resources/mapper/CustomerFootBarDao.xml new file mode 100644 index 0000000000..a11df38ba6 --- /dev/null +++ b/epmet-module/oper-customize/oper-customize-server/src/main/resources/mapper/CustomerFootBarDao.xml @@ -0,0 +1,34 @@ + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file From 6fa3ed19b846d5020d7a606d2204c06bf09744f3 Mon Sep 17 00:00:00 2001 From: wxz Date: Wed, 22 Apr 2020 22:16:32 +0800 Subject: [PATCH 33/85] =?UTF-8?q?1.=E4=BF=AE=E6=94=B9pom=E7=89=88=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- epmet-module/gov-access/gov-access-client/pom.xml | 3 +-- epmet-module/gov-access/gov-access-server/pom.xml | 4 ++-- epmet-module/gov-access/pom.xml | 2 +- epmet-module/gov-mine/gov-mine-client/pom.xml | 1 - epmet-module/gov-mine/gov-mine-server/pom.xml | 2 +- 5 files changed, 5 insertions(+), 7 deletions(-) diff --git a/epmet-module/gov-access/gov-access-client/pom.xml b/epmet-module/gov-access/gov-access-client/pom.xml index ad7c7ab019..35a138e635 100644 --- a/epmet-module/gov-access/gov-access-client/pom.xml +++ b/epmet-module/gov-access/gov-access-client/pom.xml @@ -2,11 +2,10 @@ - 0.3.0 gov-access com.epmet - 0.3.0 + 2.0.0 4.0.0 diff --git a/epmet-module/gov-access/gov-access-server/pom.xml b/epmet-module/gov-access/gov-access-server/pom.xml index b6da423ab1..f71a21d4a0 100644 --- a/epmet-module/gov-access/gov-access-server/pom.xml +++ b/epmet-module/gov-access/gov-access-server/pom.xml @@ -6,7 +6,7 @@ gov-access com.epmet - 0.3.0 + 2.0.0 4.0.0 @@ -17,7 +17,7 @@ com.epmet gov-access-client - 0.3.0 + 2.0.0 com.epmet diff --git a/epmet-module/gov-access/pom.xml b/epmet-module/gov-access/pom.xml index 3c5ac0d7dd..b81b68f895 100644 --- a/epmet-module/gov-access/pom.xml +++ b/epmet-module/gov-access/pom.xml @@ -11,7 +11,7 @@ gov-access pom - 0.3.0 + gov-access-client gov-access-server diff --git a/epmet-module/gov-mine/gov-mine-client/pom.xml b/epmet-module/gov-mine/gov-mine-client/pom.xml index 193f0aeebd..7dd4b864f7 100644 --- a/epmet-module/gov-mine/gov-mine-client/pom.xml +++ b/epmet-module/gov-mine/gov-mine-client/pom.xml @@ -2,7 +2,6 @@ - 0.3.0 com.epmet gov-mine diff --git a/epmet-module/gov-mine/gov-mine-server/pom.xml b/epmet-module/gov-mine/gov-mine-server/pom.xml index 8b45fb732d..e9965f902b 100644 --- a/epmet-module/gov-mine/gov-mine-server/pom.xml +++ b/epmet-module/gov-mine/gov-mine-server/pom.xml @@ -16,7 +16,7 @@ com.epmet gov-mine-client - 0.3.0 + 2.0.0 com.epmet From c7c2ce05be0de7dcf733d927b1562af38f72992b Mon Sep 17 00:00:00 2001 From: sunyuchao Date: Thu, 23 Apr 2020 09:53:08 +0800 Subject: [PATCH 34/85] =?UTF-8?q?customer=5Fagency=E8=A1=A8=E6=B7=BB?= =?UTF-8?q?=E5=8A=A0=E5=AD=97=E6=AE=B5=E5=AF=B9=E5=BA=94=E5=AE=9E=E4=BD=93?= =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E5=B1=9E=E6=80=A7=E5=AD=97=E6=AE=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/epmet/dto/CustomerAgencyDTO.java | 15 +++++++++++++++ .../com/epmet/entity/CustomerAgencyEntity.java | 15 +++++++++++++++ .../java/com/epmet/excel/CustomerAgencyExcel.java | 9 +++++++++ 3 files changed, 39 insertions(+) diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/CustomerAgencyDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/CustomerAgencyDTO.java index 9523753483..d1e6c3f40a 100644 --- a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/CustomerAgencyDTO.java +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/CustomerAgencyDTO.java @@ -112,4 +112,19 @@ public class CustomerAgencyDTO implements Serializable { */ private Integer totalUser; + /** + * 国家 + */ + private String country; + + /** + * 省份 + */ + private String province; + + /** + * 城市 + */ + private String city; + } \ No newline at end of file diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/entity/CustomerAgencyEntity.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/entity/CustomerAgencyEntity.java index b06e833347..84f0e78f1c 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/entity/CustomerAgencyEntity.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/entity/CustomerAgencyEntity.java @@ -82,4 +82,19 @@ public class CustomerAgencyEntity extends BaseEpmetEntity { */ private Integer totalUser; + /** + * 国家 + */ + private String country; + + /** + * 省份 + */ + private String province; + + /** + * 城市 + */ + private String city; + } diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/excel/CustomerAgencyExcel.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/excel/CustomerAgencyExcel.java index 27422f3157..61ea84eb40 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/excel/CustomerAgencyExcel.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/excel/CustomerAgencyExcel.java @@ -76,5 +76,14 @@ public class CustomerAgencyExcel { @Excel(name = "总人数") private Integer totalUser; + @Excel(name = "国家") + private String country; + + @Excel(name = "省份") + private String province; + + @Excel(name = "城市") + private String city; + } \ No newline at end of file From c55ca2d106e52f12f0f87aef47509c267564b5d5 Mon Sep 17 00:00:00 2001 From: zhaoqifeng Date: Thu, 23 Apr 2020 10:19:33 +0800 Subject: [PATCH 35/85] =?UTF-8?q?=E4=BF=AE=E6=94=B9=20=E8=8E=B7=E5=8F=96?= =?UTF-8?q?=E6=9C=80=E8=BF=91=E4=B8=80=E6=AC=A1=E7=99=BB=E5=BD=95=E7=9A=84?= =?UTF-8?q?=E5=AE=A2=E6=88=B7=E4=BF=A1=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/epmet/feign/EpmetUserFeignClient.java | 10 +- .../com/epmet/feign/GovOrgFeignClient.java | 10 ++ .../EpmetUserFeignClientFallback.java | 4 - .../service/impl/StaffAgencyServiceImpl.java | 2 +- .../com/epmet/dto/CustomerStaffAgencyDTO.java | 2 +- .../dto/result/LatestCustomerResultDTO.java | 4 + epmet-module/gov-org/gov-org-server/pom.xml | 12 ++ .../CustomerStaffAgencyController.java | 13 ++ .../com/epmet/dao/CustomerStaffAgencyDao.java | 8 ++ .../entity/CustomerStaffAgencyEntity.java | 2 +- .../com/epmet/feign/EpmetUserFeignClient.java | 30 +++++ .../com/epmet/feign/OperCrmFeignClient.java | 25 ++++ .../EpmetUserFeignClientFallback.java | 23 ++++ .../fallback/OperCrmFeignClientFallBack.java | 21 ++++ .../service/CustomerStaffAgencyService.java | 118 ++++++++++-------- .../impl/CustomerStaffAgencyServiceImpl.java | 31 +++++ .../mapper/CustomerStaffAgencyDao.xml | 16 ++- .../controller/CustomerStaffController.java | 13 ++ .../StaffAgencyVisitedController.java | 12 -- .../service/StaffAgencyVisitedService.java | 10 -- .../impl/StaffAgencyVisitedServiceImpl.java | 23 ---- 21 files changed, 272 insertions(+), 117 deletions(-) rename {epmet-user/epmet-user-client => epmet-module/gov-org/gov-org-client}/src/main/java/com/epmet/dto/result/LatestCustomerResultDTO.java (91%) create mode 100644 epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/feign/EpmetUserFeignClient.java create mode 100644 epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/feign/OperCrmFeignClient.java create mode 100644 epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/feign/fallback/EpmetUserFeignClientFallback.java create mode 100644 epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/feign/fallback/OperCrmFeignClientFallBack.java 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 78f955955d..af24c8b644 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 @@ -7,7 +7,6 @@ import com.epmet.feign.fallback.EpmetUserFeignClientFallback; import org.springframework.cloud.openfeign.FeignClient; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PathVariable; -import org.springframework.web.bind.annotation.RequestBody; /** * @Description @@ -15,12 +14,5 @@ import org.springframework.web.bind.annotation.RequestBody; */ @FeignClient(name = ServiceConstant.EPMET_USER_SERVER, fallback = EpmetUserFeignClientFallback.class) public interface EpmetUserFeignClient { - /** - * 获取最近一次登录的客户信息 - * - * @param userId - * @return - */ - @GetMapping("/epmetuser/staffagencyvisited/getlatestcustomer/{userId}") - Result getLatestCustomer(@PathVariable("userId") String userId); + } diff --git a/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/feign/GovOrgFeignClient.java b/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/feign/GovOrgFeignClient.java index 6866e03ecd..f87abc24e4 100644 --- a/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/feign/GovOrgFeignClient.java +++ b/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/feign/GovOrgFeignClient.java @@ -3,6 +3,7 @@ package com.epmet.feign; import com.epmet.commons.tools.constant.ServiceConstant; import com.epmet.commons.tools.utils.Result; import com.epmet.dto.result.CustomerGridByUserIdResultDTO; +import com.epmet.dto.result.LatestCustomerResultDTO; import com.epmet.feign.fallback.GovOrgFeignClientFallBack; import org.springframework.cloud.openfeign.FeignClient; import org.springframework.web.bind.annotation.GetMapping; @@ -25,4 +26,13 @@ public interface GovOrgFeignClient { */ @GetMapping(value = "/gov/org/customergrid/getmygrids/{userId}") Result> getMyGrids(@PathVariable("userId") String userId); + + /** + * 获取最近一次登录的客户信息 + * + * @param userId + * @return + */ + @GetMapping("/gov/org/customerstaffagency/getlatestcustomer/{userId}") + Result getLatestCustomer(@PathVariable("userId") String userId); } diff --git a/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/feign/fallback/EpmetUserFeignClientFallback.java b/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/feign/fallback/EpmetUserFeignClientFallback.java index dfd80859f3..5f551bef80 100644 --- a/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/feign/fallback/EpmetUserFeignClientFallback.java +++ b/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/feign/fallback/EpmetUserFeignClientFallback.java @@ -14,8 +14,4 @@ import org.springframework.stereotype.Component; @Component public class EpmetUserFeignClientFallback implements EpmetUserFeignClient { - @Override - public Result getLatestCustomer(String userId) { - return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "getLatestCustomer", userId); - } } diff --git a/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/service/impl/StaffAgencyServiceImpl.java b/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/service/impl/StaffAgencyServiceImpl.java index 5ead6f7e81..1a7a56e39a 100644 --- a/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/service/impl/StaffAgencyServiceImpl.java +++ b/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/service/impl/StaffAgencyServiceImpl.java @@ -55,7 +55,7 @@ public class StaffAgencyServiceImpl implements StaffAgencyService { @Override public Result getLatestCustomer(TokenDto tokenDTO) { - return epmetUserFeignClient.getLatestCustomer(tokenDTO.getUserId()); + return govOrgFeignClient.getLatestCustomer(tokenDTO.getUserId()); } diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/CustomerStaffAgencyDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/CustomerStaffAgencyDTO.java index c97e5097a1..8cc0f73320 100644 --- a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/CustomerStaffAgencyDTO.java +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/CustomerStaffAgencyDTO.java @@ -51,7 +51,7 @@ public class CustomerStaffAgencyDTO implements Serializable { /** * 组织机构ID customer_organization.id */ - private String orgId; + private String agencyId; /** * 删除标识 diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/LatestCustomerResultDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/LatestCustomerResultDTO.java similarity index 91% rename from epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/LatestCustomerResultDTO.java rename to epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/LatestCustomerResultDTO.java index 5bdf00228b..1979096f1a 100644 --- a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/LatestCustomerResultDTO.java +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/LatestCustomerResultDTO.java @@ -28,4 +28,8 @@ public class LatestCustomerResultDTO implements Serializable { * 工作人员头像 */ private String staffHeadPhoto; + /** + * 性别 + */ + private Integer gender; } diff --git a/epmet-module/gov-org/gov-org-server/pom.xml b/epmet-module/gov-org/gov-org-server/pom.xml index 3bb6930492..a9bd2b6ba3 100644 --- a/epmet-module/gov-org/gov-org-server/pom.xml +++ b/epmet-module/gov-org/gov-org-server/pom.xml @@ -62,6 +62,18 @@ 2.0.0 compile + + com.epmet + oper-crm-client + 2.0.0 + compile + + + com.epmet + epmet-user-client + 2.0.0 + compile + 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 58219da027..fa1976bf6d 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 @@ -26,6 +26,7 @@ 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.result.LatestCustomerResultDTO; import com.epmet.excel.CustomerStaffAgencyExcel; import com.epmet.service.CustomerStaffAgencyService; import org.springframework.beans.factory.annotation.Autowired; @@ -91,4 +92,16 @@ public class CustomerStaffAgencyController { ExcelUtils.exportExcelToTarget(response, null, list, CustomerStaffAgencyExcel.class); } + /** + * 获取最近一次登录的客户信息 + * + * @param userId 参数 + * @return Result + * @author zhaoqifeng + */ + @GetMapping("getlatestcustomer/{userId}") + 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/dao/CustomerStaffAgencyDao.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerStaffAgencyDao.java index 8ac905edcb..828c6cdd98 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 @@ -18,6 +18,7 @@ package com.epmet.dao; import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.dto.CustomerStaffAgencyDTO; import com.epmet.entity.CustomerStaffAgencyEntity; import org.apache.ibatis.annotations.Mapper; @@ -29,5 +30,12 @@ import org.apache.ibatis.annotations.Mapper; */ @Mapper public interface CustomerStaffAgencyDao extends BaseDao { + + /** + * 获取最近一次登录的客户信息 + * @param userId + * @return + */ + CustomerStaffAgencyDTO selectLatestCustomerByStaff(String userId); } \ No newline at end of file diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/entity/CustomerStaffAgencyEntity.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/entity/CustomerStaffAgencyEntity.java index 9c333137a9..0aa07837ec 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/entity/CustomerStaffAgencyEntity.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/entity/CustomerStaffAgencyEntity.java @@ -51,6 +51,6 @@ public class CustomerStaffAgencyEntity extends BaseEpmetEntity { /** * 组织机构ID customer_organization.id */ - private String orgId; + private String agencyId; } 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 new file mode 100644 index 0000000000..27332bf916 --- /dev/null +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/feign/EpmetUserFeignClient.java @@ -0,0 +1,30 @@ +package com.epmet.feign; + +import com.epmet.commons.tools.constant.ServiceConstant; +import com.epmet.commons.tools.utils.Result; +import com.epmet.dto.CustomerStaffDTO; +import com.epmet.feign.fallback.EpmetUserFeignClientFallback; +import org.springframework.cloud.openfeign.FeignClient; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.PostMapping; + +/** + * @author zhaoqifeng + * @dscription + * @date 2020/3/19 9:32 + */ +@FeignClient(name = ServiceConstant.EPMET_USER_SERVER, fallback = EpmetUserFeignClientFallback.class) +public interface EpmetUserFeignClient { + /** + * 根据用户ID获取工作人员基本信息 + * + * @param formDTO + * @return Result + * @author zhaoqifeng + * @date 2020/4/22 10:05 + **/ + @PostMapping(value = "/epmetuser/customerstaff/getstaffinfobyuserid") + Result getCustomerStaffInfoByUserId(CustomerStaffDTO formDTO); + +} diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/feign/OperCrmFeignClient.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/feign/OperCrmFeignClient.java new file mode 100644 index 0000000000..9cd6369f4f --- /dev/null +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/feign/OperCrmFeignClient.java @@ -0,0 +1,25 @@ +package com.epmet.feign; + +import com.epmet.commons.tools.constant.ServiceConstant; +import com.epmet.commons.tools.utils.Result; +import com.epmet.dto.CustomerDTO; +import com.epmet.feign.fallback.OperCrmFeignClientFallBack; +import org.springframework.cloud.openfeign.FeignClient; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; + +/** + * @author zhaoqifeng + * @dscription + * @date 2020/4/22 10:41 + */ +@FeignClient(name = ServiceConstant.OPER_CRM_SERVER, fallback = OperCrmFeignClientFallBack.class) +public interface OperCrmFeignClient { + /** + * 获取客户信息 + * @param dto + * @return + */ + @PostMapping("/oper/crm/customer/getcostomerInfo") + Result getCustomerInfo(@RequestBody CustomerDTO dto); +} 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 new file mode 100644 index 0000000000..df59c03f22 --- /dev/null +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/feign/fallback/EpmetUserFeignClientFallback.java @@ -0,0 +1,23 @@ +package com.epmet.feign.fallback; + +import com.epmet.commons.tools.constant.ServiceConstant; +import com.epmet.commons.tools.utils.ModuleUtils; +import com.epmet.commons.tools.utils.Result; +import com.epmet.dto.CustomerStaffDTO; +import com.epmet.dto.OperUserDTO; +import com.epmet.feign.EpmetUserFeignClient; +import org.springframework.stereotype.Component; + +/** + * 用户模块 + * @author zhaoqifeng + * @date 2020/3/19 9:34 + */ +@Component +public class EpmetUserFeignClientFallback implements EpmetUserFeignClient { + + @Override + public Result getCustomerStaffInfoByUserId(CustomerStaffDTO formDTO) { + return ModuleUtils.feignConError(ServiceConstant.OPER_CRM_SERVER, "getCustomerStaffInfoByUserId", formDTO); + } +} diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/feign/fallback/OperCrmFeignClientFallBack.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/feign/fallback/OperCrmFeignClientFallBack.java new file mode 100644 index 0000000000..d40619a04c --- /dev/null +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/feign/fallback/OperCrmFeignClientFallBack.java @@ -0,0 +1,21 @@ +package com.epmet.feign.fallback; + +import com.epmet.commons.tools.constant.ServiceConstant; +import com.epmet.commons.tools.utils.ModuleUtils; +import com.epmet.commons.tools.utils.Result; +import com.epmet.dto.CustomerDTO; +import com.epmet.feign.OperCrmFeignClient; +import org.springframework.stereotype.Component; + +/** + * @author zhaoqifeng + * @dscription + * @date 2020/4/22 10:43 + */ +@Component +public class OperCrmFeignClientFallBack implements OperCrmFeignClient { + @Override + public Result getCustomerInfo(CustomerDTO dto) { + return ModuleUtils.feignConError(ServiceConstant.OPER_CRM_SERVER, "getCustomerInfo", dto); + } +} 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 9ba776f271..2aaee92578 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 @@ -19,7 +19,9 @@ 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.CustomerStaffAgencyDTO; +import com.epmet.dto.result.LatestCustomerResultDTO; import com.epmet.entity.CustomerStaffAgencyEntity; import java.util.List; @@ -33,63 +35,71 @@ import java.util.Map; */ public interface CustomerStaffAgencyService extends BaseService { - /** - * 默认分页 - * - * @param params - * @return PageData - * @author generator - * @date 2020-04-20 - */ - PageData page(Map params); + /** + * 默认分页 + * + * @param params + * @return PageData + * @author generator + * @date 2020-04-20 + */ + PageData page(Map params); - /** - * 默认查询 - * - * @param params - * @return java.util.List - * @author generator - * @date 2020-04-20 - */ - List list(Map params); + /** + * 默认查询 + * + * @param params + * @return java.util.List + * @author generator + * @date 2020-04-20 + */ + List list(Map params); - /** - * 单条查询 - * - * @param id - * @return CustomerStaffAgencyDTO - * @author generator - * @date 2020-04-20 - */ - CustomerStaffAgencyDTO get(String id); + /** + * 单条查询 + * + * @param id + * @return CustomerStaffAgencyDTO + * @author generator + * @date 2020-04-20 + */ + CustomerStaffAgencyDTO get(String id); - /** - * 默认保存 - * - * @param dto - * @return void - * @author generator - * @date 2020-04-20 - */ - void save(CustomerStaffAgencyDTO dto); + /** + * 默认保存 + * + * @param dto + * @return void + * @author generator + * @date 2020-04-20 + */ + void save(CustomerStaffAgencyDTO dto); - /** - * 默认更新 - * - * @param dto - * @return void - * @author generator - * @date 2020-04-20 - */ - void update(CustomerStaffAgencyDTO dto); + /** + * 默认更新 + * + * @param dto + * @return void + * @author generator + * @date 2020-04-20 + */ + void update(CustomerStaffAgencyDTO dto); - /** - * 批量删除 - * - * @param ids - * @return void - * @author generator - * @date 2020-04-20 - */ - void delete(String[] ids); + /** + * 批量删除 + * + * @param ids + * @return void + * @author generator + * @date 2020-04-20 + */ + void delete(String[] ids); + + /** + * 获取最近一次登录的客户信息 + * + * @param userId + * @return + */ + Result getLatestCustomer(String userId); } \ 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 f1786860da..57d8ae21d8 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 @@ -23,9 +23,14 @@ 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.CustomerStaffAgencyDao; +import com.epmet.dto.CustomerDTO; import com.epmet.dto.CustomerStaffAgencyDTO; +import com.epmet.dto.CustomerStaffDTO; import com.epmet.entity.CustomerStaffAgencyEntity; +import com.epmet.feign.EpmetUserFeignClient; +import com.epmet.feign.OperCrmFeignClient; import com.epmet.redis.CustomerStaffAgencyRedis; import com.epmet.service.CustomerStaffAgencyService; import org.apache.commons.lang3.StringUtils; @@ -48,6 +53,10 @@ public class CustomerStaffAgencyServiceImpl extends BaseServiceImpl page(Map params) { @@ -101,4 +110,26 @@ public class CustomerStaffAgencyServiceImpl extends BaseServiceImpl getLatestCustomer(String userId) { + LatestCustomerResultDTO resultDTO = new LatestCustomerResultDTO(); + CustomerStaffAgencyDTO customerStaffAgencyDTO = baseDao.selectLatestCustomerByStaff(userId); + + resultDTO.setAgencyId(customerStaffAgencyDTO.getAgencyId()); + resultDTO.setCustomerId(customerStaffAgencyDTO.getCustomerId()); + //获取工作人员头像 + CustomerStaffDTO customerStaffParam = new CustomerStaffDTO(); + customerStaffParam.setUserId(userId); + Result staffInfo = + epmetUserFeignClient.getCustomerStaffInfoByUserId(customerStaffParam); + resultDTO.setStaffHeadPhoto(staffInfo.getData().getHeadPhoto()); + resultDTO.setGender(staffInfo.getData().getGender()); + //获取客户名称 + CustomerDTO customerDTO = new CustomerDTO(); + customerDTO.setId(customerStaffAgencyDTO.getCustomerId()); + Result customerResult = operCrmFeignClient.getCustomerInfo(customerDTO); + resultDTO.setCustomerName(customerResult.getData().getCustomerName()); + return new Result().ok(resultDTO); + } + } \ 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 33dbb3e61d..016f75962a 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 @@ -7,7 +7,7 @@ - + @@ -15,6 +15,18 @@ - + \ No newline at end of file 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 b68ea382c6..6ae1285955 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 @@ -116,4 +116,17 @@ public class CustomerStaffController { ValidatorUtils.validateEntity(formDTO); return customerStaffService.getCustomerStaffInfo(formDTO); } + + /** + * 根据用户ID获取工作人员基本信息 + * + * @param formDTO + * @return com.epmet.commons.tools.utils.Result + * @author zhaoqifeng + * @date 2020/4/22 10:05 + **/ + @PostMapping(value = "getstaffinfobyuserid") + public Result getCustomerStaffInfoByUserId(CustomerStaffDTO formDTO) { + return customerStaffService.getCustomerStaffInfoByUserId(formDTO); + } } \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/StaffAgencyVisitedController.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/StaffAgencyVisitedController.java index 73d2ea4d27..488a103ef0 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/StaffAgencyVisitedController.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/StaffAgencyVisitedController.java @@ -19,7 +19,6 @@ package com.epmet.controller; import com.epmet.commons.tools.utils.Result; import com.epmet.dto.form.StaffLoginAgencyRecordFormDTO; -import com.epmet.dto.result.LatestCustomerResultDTO; import com.epmet.dto.result.StaffLatestAgencyResultDTO; import com.epmet.service.StaffAgencyVisitedService; import org.springframework.beans.factory.annotation.Autowired; @@ -63,15 +62,4 @@ public class StaffAgencyVisitedController { return staffAgencyVisitedService.saveStaffLoginRecord(formDTO); } - /** - * 获取最近一次登录的客户信息 - * - * @param userId 参数 - * @return Result - * @author zhaoqifeng - */ - @GetMapping("getlatestcustomer/{userId}") - public Result getLatestCustomer(@PathVariable("userId") String userId) { - return staffAgencyVisitedService.getLatestCustomer(userId); - } } \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/StaffAgencyVisitedService.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/StaffAgencyVisitedService.java index d8a3dc064e..71622dfa4a 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/StaffAgencyVisitedService.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/StaffAgencyVisitedService.java @@ -19,11 +19,9 @@ package com.epmet.service; import com.epmet.commons.mybatis.service.BaseService; import com.epmet.commons.tools.page.PageData; -import com.epmet.commons.tools.security.dto.TokenDto; import com.epmet.commons.tools.utils.Result; import com.epmet.dto.StaffAgencyVisitedDTO; import com.epmet.dto.form.StaffLoginAgencyRecordFormDTO; -import com.epmet.dto.result.LatestCustomerResultDTO; import com.epmet.dto.result.StaffLatestAgencyResultDTO; import com.epmet.entity.StaffAgencyVisitedEntity; @@ -116,12 +114,4 @@ public interface StaffAgencyVisitedService extends BaseService getLatestCustomer(String userId); } \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/StaffAgencyVisitedServiceImpl.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/StaffAgencyVisitedServiceImpl.java index 5108b1d8a5..126dfd728c 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/StaffAgencyVisitedServiceImpl.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/StaffAgencyVisitedServiceImpl.java @@ -22,15 +22,11 @@ import com.baomidou.mybatisplus.core.metadata.IPage; import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; import com.epmet.commons.tools.constant.FieldConstant; import com.epmet.commons.tools.page.PageData; -import com.epmet.commons.tools.security.dto.TokenDto; import com.epmet.commons.tools.utils.ConvertUtils; import com.epmet.commons.tools.utils.Result; import com.epmet.dao.StaffAgencyVisitedDao; -import com.epmet.dto.CustomerDTO; -import com.epmet.dto.CustomerStaffDTO; import com.epmet.dto.StaffAgencyVisitedDTO; import com.epmet.dto.form.StaffLoginAgencyRecordFormDTO; -import com.epmet.dto.result.LatestCustomerResultDTO; import com.epmet.dto.result.StaffLatestAgencyResultDTO; import com.epmet.entity.StaffAgencyVisitedEntity; import com.epmet.feign.OperCrmFeignClient; @@ -131,23 +127,4 @@ public class StaffAgencyVisitedServiceImpl extends BaseServiceImpl getLatestCustomer(String userId) { - LatestCustomerResultDTO resultDTO = new LatestCustomerResultDTO(); - StaffLatestAgencyResultDTO latestCustomer = baseDao.selectLatestCustomer(userId); - resultDTO.setAgencyId(latestCustomer.getAgencyId()); - resultDTO.setCustomerId(latestCustomer.getCustomerId()); - //获取工作人员头像 - CustomerStaffDTO customerStaffParam = new CustomerStaffDTO(); - customerStaffParam.setUserId(userId); - Result staffInfo = - customerStaffService.getCustomerStaffInfoByUserId(customerStaffParam); - resultDTO.setStaffHeadPhoto(staffInfo.getData().getHeadPhoto()); - //获取客户名称 - CustomerDTO customerDTO = new CustomerDTO(); - customerDTO.setId(latestCustomer.getCustomerId()); - Result customerResult = operCrmFeignClient.getCustomerInfo(customerDTO); - resultDTO.setCustomerName(customerResult.getData().getCustomerName()); - return new Result().ok(resultDTO); - } } \ No newline at end of file From 95dad66035272d52252d30a6117a231f0c5fbbe4 Mon Sep 17 00:00:00 2001 From: zhaoqifeng Date: Thu, 23 Apr 2020 10:26:36 +0800 Subject: [PATCH 36/85] =?UTF-8?q?=E4=BF=AE=E6=94=B9=20=E8=8E=B7=E5=8F=96?= =?UTF-8?q?=E6=9C=80=E8=BF=91=E4=B8=80=E6=AC=A1=E7=99=BB=E5=BD=95=E7=9A=84?= =?UTF-8?q?=E5=AE=A2=E6=88=B7=E4=BF=A1=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/epmet/service/impl/CustomerStaffAgencyServiceImpl.java | 1 + 1 file changed, 1 insertion(+) 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 57d8ae21d8..212e5246a1 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 @@ -28,6 +28,7 @@ import com.epmet.dao.CustomerStaffAgencyDao; import com.epmet.dto.CustomerDTO; import com.epmet.dto.CustomerStaffAgencyDTO; import com.epmet.dto.CustomerStaffDTO; +import com.epmet.dto.result.LatestCustomerResultDTO; import com.epmet.entity.CustomerStaffAgencyEntity; import com.epmet.feign.EpmetUserFeignClient; import com.epmet.feign.OperCrmFeignClient; From a3c60823e93ae9213760817dd42f8ad1dc9f6fb0 Mon Sep 17 00:00:00 2001 From: zhaoqifeng Date: Thu, 23 Apr 2020 10:54:06 +0800 Subject: [PATCH 37/85] =?UTF-8?q?=E4=BF=AE=E6=94=B9=20=E8=8E=B7=E5=8F=96?= =?UTF-8?q?=E6=9C=80=E8=BF=91=E4=B8=80=E6=AC=A1=E7=99=BB=E5=BD=95=E7=9A=84?= =?UTF-8?q?=E5=AE=A2=E6=88=B7=E4=BF=A1=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/epmet/feign/fallback/GovOrgFeignClientFallBack.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/feign/fallback/GovOrgFeignClientFallBack.java b/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/feign/fallback/GovOrgFeignClientFallBack.java index 7e7b838d38..944eef1619 100644 --- a/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/feign/fallback/GovOrgFeignClientFallBack.java +++ b/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/feign/fallback/GovOrgFeignClientFallBack.java @@ -4,6 +4,7 @@ import com.epmet.commons.tools.constant.ServiceConstant; import com.epmet.commons.tools.utils.ModuleUtils; import com.epmet.commons.tools.utils.Result; import com.epmet.dto.result.CustomerGridByUserIdResultDTO; +import com.epmet.dto.result.LatestCustomerResultDTO; import com.epmet.feign.GovOrgFeignClient; import org.springframework.stereotype.Component; @@ -20,4 +21,9 @@ public class GovOrgFeignClientFallBack implements GovOrgFeignClient { public Result> getMyGrids(String userId) { return ModuleUtils.feignConError(ServiceConstant.GOV_ORG_SERVER, "getMyGrids", userId); } + + @Override + public Result getLatestCustomer(String userId) { + return ModuleUtils.feignConError(ServiceConstant.GOV_ORG_SERVER, "getLatestCustomer", userId); + } } \ No newline at end of file From f243849a3c754115bd153240ab3a05ef020421c9 Mon Sep 17 00:00:00 2001 From: yinzuomei <576302893@qq.com> Date: Thu, 23 Apr 2020 10:56:20 +0800 Subject: [PATCH 38/85] =?UTF-8?q?=E5=88=87=E6=8D=A2=E7=BD=91=E6=A0=BC?= =?UTF-8?q?=E5=88=9D=E5=A7=8B=E6=8F=90=E4=BA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/epmet/dto/form/SwitchGridFormDTO.java | 27 +++++++++++++++++++ .../controller/StaffAgencyController.java | 16 ++++++++++- .../com/epmet/service/StaffAgencyService.java | 11 ++++++++ .../service/impl/StaffAgencyServiceImpl.java | 12 ++++++--- 4 files changed, 62 insertions(+), 4 deletions(-) create mode 100644 epmet-module/gov-mine/gov-mine-client/src/main/java/com/epmet/dto/form/SwitchGridFormDTO.java diff --git a/epmet-module/gov-mine/gov-mine-client/src/main/java/com/epmet/dto/form/SwitchGridFormDTO.java b/epmet-module/gov-mine/gov-mine-client/src/main/java/com/epmet/dto/form/SwitchGridFormDTO.java new file mode 100644 index 0000000000..f9908e24dc --- /dev/null +++ b/epmet-module/gov-mine/gov-mine-client/src/main/java/com/epmet/dto/form/SwitchGridFormDTO.java @@ -0,0 +1,27 @@ +package com.epmet.dto.form; + +import lombok.Data; + +import java.io.Serializable; + +/** + * @Description 切换网格入参 + * @Author yinzuomei + * @Date 2020/4/23 10:41 + */ +@Data +public class SwitchGridFormDTO implements Serializable { + private static final long serialVersionUID = -2898130727929596798L; + + /** + * sessionKey + */ + private String customerId; + + /** + * sessionKey + */ + private String gridId; + +} + 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 83b649e63a..372936494b 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 @@ -20,14 +20,17 @@ 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.SwitchGridFormDTO; import com.epmet.dto.result.CustomerGridByUserIdResultDTO; import com.epmet.dto.result.LatestCustomerResultDTO; import com.epmet.service.StaffAgencyService; 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 javax.validation.Valid; import java.util.List; /** @@ -49,7 +52,7 @@ public class StaffAgencyController { * @Author sun */ @PostMapping("getmygrids") - public Result> getMyGrids(TokenDto tokenDTO) { + public Result> getMyGrids(@LoginUser TokenDto tokenDTO) { return staffAgencyService.getMyGrids(tokenDTO); } @@ -64,4 +67,15 @@ public class StaffAgencyController { return staffAgencyService.getLatestCustomer(tokenDTO); } + /** + * @param tokenDto + * @return com.epmet.commons.tools.utils.Result> + * @Author yinzuomei + * @Description 切换网格 + * @Date 2020/4/23 10:34 + **/ + @PostMapping("switchgrid") + public Result> switchGrid(@LoginUser TokenDto tokenDto, @RequestBody @Valid SwitchGridFormDTO switchGridFormDTO) { + return staffAgencyService.switchGrid(switchGridFormDTO); + } } \ No newline at end of file diff --git a/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/service/StaffAgencyService.java b/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/service/StaffAgencyService.java index 589a0ed64e..d2f7254998 100644 --- a/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/service/StaffAgencyService.java +++ b/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/service/StaffAgencyService.java @@ -19,6 +19,7 @@ package com.epmet.service; import com.epmet.commons.tools.security.dto.TokenDto; import com.epmet.commons.tools.utils.Result; +import com.epmet.dto.form.SwitchGridFormDTO; import com.epmet.dto.result.CustomerGridByUserIdResultDTO; import com.epmet.dto.result.LatestCustomerResultDTO; @@ -41,8 +42,18 @@ public interface StaffAgencyService { /** * 获取最近一次登录的客户信息 + * * @param tokenDTO * @return */ Result getLatestCustomer(TokenDto tokenDTO); + + /** + * @param switchGridFormDTO + * @return com.epmet.commons.tools.utils.Result> + * @Author yinzuomei + * @Description 切换网格 + * @Date 2020/4/23 10:49 + **/ + Result> switchGrid(SwitchGridFormDTO switchGridFormDTO); } \ No newline at end of file diff --git a/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/service/impl/StaffAgencyServiceImpl.java b/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/service/impl/StaffAgencyServiceImpl.java index 1a7a56e39a..575ab2ef4d 100644 --- a/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/service/impl/StaffAgencyServiceImpl.java +++ b/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/service/impl/StaffAgencyServiceImpl.java @@ -19,9 +19,9 @@ package com.epmet.service.impl; import com.epmet.commons.tools.security.dto.TokenDto; import com.epmet.commons.tools.utils.Result; +import com.epmet.dto.form.SwitchGridFormDTO; import com.epmet.dto.result.CustomerGridByUserIdResultDTO; import com.epmet.dto.result.LatestCustomerResultDTO; -import com.epmet.feign.EpmetUserFeignClient; import com.epmet.feign.GovOrgFeignClient; import com.epmet.service.StaffAgencyService; import org.springframework.beans.factory.annotation.Autowired; @@ -39,8 +39,6 @@ public class StaffAgencyServiceImpl implements StaffAgencyService { @Autowired private GovOrgFeignClient govOrgFeignClient; - @Autowired - private EpmetUserFeignClient epmetUserFeignClient; /** * @param tokenDTO @@ -59,4 +57,12 @@ public class StaffAgencyServiceImpl implements StaffAgencyService { } + @Override + public Result> switchGrid(SwitchGridFormDTO switchGridFormDTO) { + //记录网格访问记录 + //查询网格的权限 + return new Result<>(); + } + + } \ No newline at end of file From d5edd5952baea7b4b762cf43a869312746b7b885 Mon Sep 17 00:00:00 2001 From: wxz Date: Thu, 23 Apr 2020 11:13:56 +0800 Subject: [PATCH 39/85] =?UTF-8?q?1.=E6=9F=A5=E8=AF=A2=E7=94=A8=E6=88=B7?= =?UTF-8?q?=E6=9C=89=E6=9D=83=E9=99=90=E7=9A=84=E6=93=8D=E4=BD=9C=E5=88=97?= =?UTF-8?q?=E8=A1=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../tools/constant/ServiceConstant.java | 5 + .../gov-access/gov-access-client/pom.xml | 8 +- .../java/com/epmet/dto/RoleOperationDTO.java | 82 +++++++++++++ .../dto/result/RoleOperationResultDTO.java | 87 +++++++++++++ .../com/epmet/controller/RoleController.java | 33 +++++ .../java/com/epmet/dao/RoleOperationDao.java | 38 ++++++ .../com/epmet/entity/RoleOperationEntity.java | 51 ++++++++ .../com/epmet/excel/RoleOperationExcel.java | 62 ++++++++++ .../com/epmet/redis/RoleOperationRedis.java | 47 ++++++++ .../epmet/service/RoleOperationService.java | 103 ++++++++++++++++ .../impl/RoleOperationServiceImpl.java | 110 +++++++++++++++++ .../db.migration/epmet_gov_access.sql | 10 +- .../resources/mapper/RoleOperationDao.xml | 33 +++++ .../com/epmet/dto/form/StaffOperationDTO.java | 13 ++ .../com/epmet/dto/form/StaffRoleFormDTO.java | 9 ++ epmet-module/gov-mine/gov-mine-server/pom.xml | 6 + .../epmet/controller/AccessController.java | 42 +++++++ .../com/epmet/feign/EpmetUserFeignClient.java | 20 +++ .../com/epmet/feign/GovAccessFeignClient.java | 25 ++++ .../EpmetUserFeignClientFallback.java | 13 ++ .../GovAccessFeignClientFallback.java | 28 +++++ .../java/com/epmet/service/AccessService.java | 19 +++ .../epmet/service/impl/AccessServiceImpl.java | 61 ++++++++++ .../java/com/epmet/dto/GovStaffRoleDTO.java | 91 ++++++++++++++ .../main/java/com/epmet/dto/StaffRoleDTO.java | 86 +++++++++++++ .../com/epmet/dto/form/StaffRoleFormDTO.java | 18 +++ .../epmet/controller/StaffRoleController.java | 53 ++++++++ .../java/com/epmet/dao/GovStaffRoleDao.java | 37 ++++++ .../main/java/com/epmet/dao/StaffRoleDao.java | 33 +++++ .../com/epmet/entity/GovStaffRoleEntity.java | 61 ++++++++++ .../com/epmet/entity/StaffRoleEntity.java | 56 +++++++++ .../com/epmet/excel/GovStaffRoleExcel.java | 68 +++++++++++ .../java/com/epmet/excel/StaffRoleExcel.java | 65 ++++++++++ .../com/epmet/redis/GovStaffRoleRedis.java | 47 ++++++++ .../java/com/epmet/redis/StaffRoleRedis.java | 47 ++++++++ .../epmet/service/GovStaffRoleService.java | 102 ++++++++++++++++ .../com/epmet/service/StaffRoleService.java | 95 +++++++++++++++ .../service/impl/GovStaffRoleServiceImpl.java | 114 ++++++++++++++++++ .../service/impl/StaffRoleServiceImpl.java | 104 ++++++++++++++++ .../main/resources/mapper/GovStaffRoleDao.xml | 32 +++++ .../main/resources/mapper/StaffRoleDao.xml | 20 +++ 41 files changed, 2028 insertions(+), 6 deletions(-) create mode 100644 epmet-module/gov-access/gov-access-client/src/main/java/com/epmet/dto/RoleOperationDTO.java create mode 100644 epmet-module/gov-access/gov-access-client/src/main/java/com/epmet/dto/result/RoleOperationResultDTO.java create mode 100644 epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/controller/RoleController.java create mode 100644 epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/dao/RoleOperationDao.java create mode 100644 epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/entity/RoleOperationEntity.java create mode 100644 epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/excel/RoleOperationExcel.java create mode 100644 epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/redis/RoleOperationRedis.java create mode 100644 epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/service/RoleOperationService.java create mode 100644 epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/service/impl/RoleOperationServiceImpl.java create mode 100644 epmet-module/gov-access/gov-access-server/src/main/resources/mapper/RoleOperationDao.xml create mode 100644 epmet-module/gov-mine/gov-mine-client/src/main/java/com/epmet/dto/form/StaffOperationDTO.java create mode 100644 epmet-module/gov-mine/gov-mine-client/src/main/java/com/epmet/dto/form/StaffRoleFormDTO.java create mode 100644 epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/controller/AccessController.java create mode 100644 epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/feign/GovAccessFeignClient.java create mode 100644 epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/feign/fallback/GovAccessFeignClientFallback.java create mode 100644 epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/service/AccessService.java create mode 100644 epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/service/impl/AccessServiceImpl.java create mode 100644 epmet-user/epmet-user-client/src/main/java/com/epmet/dto/GovStaffRoleDTO.java create mode 100644 epmet-user/epmet-user-client/src/main/java/com/epmet/dto/StaffRoleDTO.java create mode 100644 epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/StaffRoleFormDTO.java create mode 100644 epmet-user/epmet-user-server/src/main/java/com/epmet/controller/StaffRoleController.java create mode 100644 epmet-user/epmet-user-server/src/main/java/com/epmet/dao/GovStaffRoleDao.java create mode 100644 epmet-user/epmet-user-server/src/main/java/com/epmet/dao/StaffRoleDao.java create mode 100644 epmet-user/epmet-user-server/src/main/java/com/epmet/entity/GovStaffRoleEntity.java create mode 100644 epmet-user/epmet-user-server/src/main/java/com/epmet/entity/StaffRoleEntity.java create mode 100644 epmet-user/epmet-user-server/src/main/java/com/epmet/excel/GovStaffRoleExcel.java create mode 100644 epmet-user/epmet-user-server/src/main/java/com/epmet/excel/StaffRoleExcel.java create mode 100644 epmet-user/epmet-user-server/src/main/java/com/epmet/redis/GovStaffRoleRedis.java create mode 100644 epmet-user/epmet-user-server/src/main/java/com/epmet/redis/StaffRoleRedis.java create mode 100644 epmet-user/epmet-user-server/src/main/java/com/epmet/service/GovStaffRoleService.java create mode 100644 epmet-user/epmet-user-server/src/main/java/com/epmet/service/StaffRoleService.java create mode 100644 epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/GovStaffRoleServiceImpl.java create mode 100644 epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/StaffRoleServiceImpl.java create mode 100644 epmet-user/epmet-user-server/src/main/resources/mapper/GovStaffRoleDao.xml create mode 100644 epmet-user/epmet-user-server/src/main/resources/mapper/StaffRoleDao.xml diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/constant/ServiceConstant.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/constant/ServiceConstant.java index eab4df7b72..f8fb4b718d 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/constant/ServiceConstant.java +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/constant/ServiceConstant.java @@ -73,4 +73,9 @@ public interface ServiceConstant { * 消息服务 */ String EPMET_MESSAGE_SERVER = "epmet-message-server"; + + /** + * 政府端权限服务 + */ + String GOV_ACCESS_SERVER = "gov-access-server"; } diff --git a/epmet-module/gov-access/gov-access-client/pom.xml b/epmet-module/gov-access/gov-access-client/pom.xml index 35a138e635..b20a28582a 100644 --- a/epmet-module/gov-access/gov-access-client/pom.xml +++ b/epmet-module/gov-access/gov-access-client/pom.xml @@ -11,5 +11,11 @@ gov-access-client - + + + com.epmet + epmet-commons-tools + 2.0.0 + + \ No newline at end of file diff --git a/epmet-module/gov-access/gov-access-client/src/main/java/com/epmet/dto/RoleOperationDTO.java b/epmet-module/gov-access/gov-access-client/src/main/java/com/epmet/dto/RoleOperationDTO.java new file mode 100644 index 0000000000..bda4931386 --- /dev/null +++ b/epmet-module/gov-access/gov-access-client/src/main/java/com/epmet/dto/RoleOperationDTO.java @@ -0,0 +1,82 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

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

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

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.dto; + +import lombok.Data; + +import java.io.Serializable; +import java.util.Date; + + +/** + * 角色能进行那些操作 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-04-22 + */ +@Data +public class RoleOperationDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * + */ + private String id; + + /** + * 角色ID + */ + private String roleId; + + /** + * 操作key + */ + private String operationKey; + + /** + * 是否删除,0:未删除,1:已删除 + */ + private Integer delFlag; + + /** + * 乐观锁 + */ + private Integer revision; + + /** + * 创建者id + */ + private String createdBy; + + /** + * 创建时间 + */ + private Date createdTime; + + /** + * 更新者id + */ + private String updatedBy; + + /** + * 更新时间 + */ + private Date updatedTime; + +} \ No newline at end of file diff --git a/epmet-module/gov-access/gov-access-client/src/main/java/com/epmet/dto/result/RoleOperationResultDTO.java b/epmet-module/gov-access/gov-access-client/src/main/java/com/epmet/dto/result/RoleOperationResultDTO.java new file mode 100644 index 0000000000..dc7fc1559e --- /dev/null +++ b/epmet-module/gov-access/gov-access-client/src/main/java/com/epmet/dto/result/RoleOperationResultDTO.java @@ -0,0 +1,87 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

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

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

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.dto.result; + +import lombok.Data; + +import java.io.Serializable; +import java.util.Date; + + +/** + * 角色能进行那些操作 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-04-22 + */ +@Data +public class RoleOperationResultDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * + */ + private String id; + + /** + * 角色ID + */ + private String roleId; + + /** + * 操作key + */ + private String operationKey; + + /** + * 操作名称 + */ + private String operationName; + + /** + * 是否删除,0:未删除,1:已删除 + */ + private String delFlag; + + /** + * 乐观锁 + */ + private Integer revision; + + /** + * 创建者id + */ + private String createdBy; + + /** + * 创建时间 + */ + private Date createdTime; + + /** + * 更新者id + */ + private String updatedBy; + + /** + * 更新时间 + */ + private Date updatedTime; + +} \ No newline at end of file diff --git a/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/controller/RoleController.java b/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/controller/RoleController.java new file mode 100644 index 0000000000..8e9778734b --- /dev/null +++ b/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/controller/RoleController.java @@ -0,0 +1,33 @@ +package com.epmet.controller; + +import com.epmet.commons.tools.utils.Result; +import com.epmet.dto.result.RoleOperationResultDTO; +import com.epmet.service.RoleOperationService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import java.util.List; + +@RestController +@RequestMapping("role") +public class RoleController { + + @Autowired + private RoleOperationService roleOperationService; + + /** + * 查询角色对应的操作列表 + * @param roleId + * @return + */ + @PostMapping("operations/{roleId}") + public Result> listOperationsByRoleId(@PathVariable("roleId") String roleId) { + List roleOperationResultDTOS = roleOperationService.listOperationsByRoleId(roleId); + return new Result>().ok(roleOperationResultDTOS); + } + + +} diff --git a/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/dao/RoleOperationDao.java b/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/dao/RoleOperationDao.java new file mode 100644 index 0000000000..a1b408ba7a --- /dev/null +++ b/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/dao/RoleOperationDao.java @@ -0,0 +1,38 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

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

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

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.dao; + +import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.dto.result.RoleOperationResultDTO; +import com.epmet.entity.RoleOperationEntity; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + * 角色能进行那些操作 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-04-22 + */ +@Mapper +public interface RoleOperationDao extends BaseDao { + + List listOperationsByRoleId(@Param("roleId") String roleId); +} \ No newline at end of file diff --git a/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/entity/RoleOperationEntity.java b/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/entity/RoleOperationEntity.java new file mode 100644 index 0000000000..96f70de1be --- /dev/null +++ b/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/entity/RoleOperationEntity.java @@ -0,0 +1,51 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

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

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

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.entity; + +import com.baomidou.mybatisplus.annotation.TableName; + +import com.epmet.commons.mybatis.entity.BaseEpmetEntity; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.util.Date; + +/** + * 角色能进行那些操作 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-04-22 + */ +@Data +@EqualsAndHashCode(callSuper=false) +@TableName("role_operation") +public class RoleOperationEntity extends BaseEpmetEntity { + + private static final long serialVersionUID = 1L; + + /** + * 角色ID + */ + private String roleId; + + /** + * 操作key + */ + private String operationKey; + +} diff --git a/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/excel/RoleOperationExcel.java b/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/excel/RoleOperationExcel.java new file mode 100644 index 0000000000..4b0c4ee373 --- /dev/null +++ b/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/excel/RoleOperationExcel.java @@ -0,0 +1,62 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

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

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

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.excel; + +import cn.afterturn.easypoi.excel.annotation.Excel; +import lombok.Data; + +import java.util.Date; + +/** + * 角色能进行那些操作 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-04-22 + */ +@Data +public class RoleOperationExcel { + + @Excel(name = "") + private String id; + + @Excel(name = "角色ID") + private String roleId; + + @Excel(name = "操作key") + private String operationKey; + + @Excel(name = "是否删除,0:未删除,1:已删除") + private Integer delFlag; + + @Excel(name = "乐观锁") + private Integer revision; + + @Excel(name = "创建者id") + private String createdBy; + + @Excel(name = "创建时间") + private Date createdTime; + + @Excel(name = "更新者id") + private String updatedBy; + + @Excel(name = "更新时间") + private Date updatedTime; + + +} \ No newline at end of file diff --git a/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/redis/RoleOperationRedis.java b/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/redis/RoleOperationRedis.java new file mode 100644 index 0000000000..d57c02ebde --- /dev/null +++ b/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/redis/RoleOperationRedis.java @@ -0,0 +1,47 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

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

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

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.redis; + +import com.epmet.commons.tools.redis.RedisUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +/** + * 角色能进行那些操作 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-04-22 + */ +@Component +public class RoleOperationRedis { + @Autowired + private RedisUtils redisUtils; + + public void delete(Object[] ids) { + + } + + public void set(){ + + } + + public String get(String id){ + return null; + } + +} \ No newline at end of file diff --git a/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/service/RoleOperationService.java b/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/service/RoleOperationService.java new file mode 100644 index 0000000000..ebc000a36b --- /dev/null +++ b/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/service/RoleOperationService.java @@ -0,0 +1,103 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

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

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

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.service; + +import com.epmet.commons.mybatis.service.BaseService; +import com.epmet.commons.tools.page.PageData; +import com.epmet.dto.RoleOperationDTO; +import com.epmet.dto.result.RoleOperationResultDTO; +import com.epmet.entity.RoleOperationEntity; + +import java.util.List; +import java.util.Map; + +/** + * 角色能进行那些操作 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-04-22 + */ +public interface RoleOperationService extends BaseService { + + /** + * 默认分页 + * + * @param params + * @return PageData + * @author generator + * @date 2020-04-22 + */ + PageData page(Map params); + + /** + * 默认查询 + * + * @param params + * @return java.util.List + * @author generator + * @date 2020-04-22 + */ + List list(Map params); + + /** + * 单条查询 + * + * @param id + * @return RoleOperationDTO + * @author generator + * @date 2020-04-22 + */ + RoleOperationDTO get(String id); + + /** + * 默认保存 + * + * @param dto + * @return void + * @author generator + * @date 2020-04-22 + */ + void save(RoleOperationDTO dto); + + /** + * 默认更新 + * + * @param dto + * @return void + * @author generator + * @date 2020-04-22 + */ + void update(RoleOperationDTO dto); + + /** + * 批量删除 + * + * @param ids + * @return void + * @author generator + * @date 2020-04-22 + */ + void delete(String[] ids); + + /** + * 查询角色对应的操作列表 + * @param roleId + * @return + */ + List listOperationsByRoleId(String roleId); +} \ No newline at end of file diff --git a/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/service/impl/RoleOperationServiceImpl.java b/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/service/impl/RoleOperationServiceImpl.java new file mode 100644 index 0000000000..bb6d914d2e --- /dev/null +++ b/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/service/impl/RoleOperationServiceImpl.java @@ -0,0 +1,110 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

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

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

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; +import com.epmet.commons.tools.page.PageData; +import com.epmet.commons.tools.utils.ConvertUtils; +import com.epmet.commons.tools.constant.FieldConstant; +import com.epmet.dao.RoleOperationDao; +import com.epmet.dto.RoleOperationDTO; +import com.epmet.dto.result.RoleOperationResultDTO; +import com.epmet.entity.RoleOperationEntity; +import com.epmet.redis.RoleOperationRedis; +import com.epmet.service.RoleOperationService; +import org.apache.commons.lang3.StringUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.util.Arrays; +import java.util.List; +import java.util.Map; + +/** + * 角色能进行那些操作 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-04-22 + */ +@Service +public class RoleOperationServiceImpl extends BaseServiceImpl implements RoleOperationService { + + @Autowired + private RoleOperationRedis roleOperationRedis; + + @Override + public PageData page(Map params) { + IPage page = baseDao.selectPage( + getPage(params, FieldConstant.CREATED_TIME, false), + getWrapper(params) + ); + return getPageData(page, RoleOperationDTO.class); + } + + @Override + public List list(Map params) { + List entityList = baseDao.selectList(getWrapper(params)); + + return ConvertUtils.sourceToTarget(entityList, RoleOperationDTO.class); + } + + private QueryWrapper getWrapper(Map params){ + String id = (String)params.get(FieldConstant.ID_HUMP); + + QueryWrapper wrapper = new QueryWrapper<>(); + wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id); + + return wrapper; + } + + @Override + public RoleOperationDTO get(String id) { + RoleOperationEntity entity = baseDao.selectById(id); + return ConvertUtils.sourceToTarget(entity, RoleOperationDTO.class); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void save(RoleOperationDTO dto) { + RoleOperationEntity entity = ConvertUtils.sourceToTarget(dto, RoleOperationEntity.class); + insert(entity); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void update(RoleOperationDTO dto) { + RoleOperationEntity entity = ConvertUtils.sourceToTarget(dto, RoleOperationEntity.class); + updateById(entity); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void delete(String[] ids) { + // 逻辑删除(@TableLogic 注解) + baseDao.deleteBatchIds(Arrays.asList(ids)); + } + + @Override + public List listOperationsByRoleId(String roleId) { + return baseDao.listOperationsByRoleId(roleId); + } + +} \ No newline at end of file diff --git a/epmet-module/gov-access/gov-access-server/src/main/resources/db.migration/epmet_gov_access.sql b/epmet-module/gov-access/gov-access-server/src/main/resources/db.migration/epmet_gov_access.sql index c7c63b6c42..67e7a5c7b2 100644 --- a/epmet-module/gov-access/gov-access-server/src/main/resources/db.migration/epmet_gov_access.sql +++ b/epmet-module/gov-access/gov-access-server/src/main/resources/db.migration/epmet_gov_access.sql @@ -6,7 +6,7 @@ -- #SET FOREIGN_KEY_CHECKS = 0; -- DROP TABLE IF EXISTS `permission_scope`; -CREATE TABLE `permission_scope` ( +CREATE TABLE `operation_scope` ( `ID` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT 'id', `SCOPE_KEY` varchar(30) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '范围key', `SCOPE_NAME` varchar(30) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '范围名称', @@ -22,8 +22,8 @@ CREATE TABLE `permission_scope` ( -- ---------------------------- -- Table structure for resource_ope -- ---------------------------- -DROP TABLE IF EXISTS `resource_ope`; -CREATE TABLE `resource_ope` ( +-- DROP TABLE IF EXISTS `operation`; +CREATE TABLE `operation` ( `ID` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, `OPERATION_KEY` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, `OPERATION_NAME` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL, @@ -40,7 +40,7 @@ CREATE TABLE `resource_ope` ( -- ---------------------------- -- Table structure for role_operation -- ---------------------------- -DROP TABLE IF EXISTS `role_operation`; +-- DROP TABLE IF EXISTS `role_operation`; CREATE TABLE `role_operation` ( `ID` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, `ROLE_ID` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '角色ID', @@ -57,7 +57,7 @@ CREATE TABLE `role_operation` ( -- ---------------------------- -- Table structure for role_scope -- ---------------------------- -DROP TABLE IF EXISTS `role_scope`; +-- DROP TABLE IF EXISTS `role_scope`; CREATE TABLE `role_scope` ( `ID` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, `ROLE_ID` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '角色ID', diff --git a/epmet-module/gov-access/gov-access-server/src/main/resources/mapper/RoleOperationDao.xml b/epmet-module/gov-access/gov-access-server/src/main/resources/mapper/RoleOperationDao.xml new file mode 100644 index 0000000000..0845fc5202 --- /dev/null +++ b/epmet-module/gov-access/gov-access-server/src/main/resources/mapper/RoleOperationDao.xml @@ -0,0 +1,33 @@ + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/epmet-module/gov-mine/gov-mine-client/src/main/java/com/epmet/dto/form/StaffOperationDTO.java b/epmet-module/gov-mine/gov-mine-client/src/main/java/com/epmet/dto/form/StaffOperationDTO.java new file mode 100644 index 0000000000..220f1f4a8f --- /dev/null +++ b/epmet-module/gov-mine/gov-mine-client/src/main/java/com/epmet/dto/form/StaffOperationDTO.java @@ -0,0 +1,13 @@ +package com.epmet.dto.form; + +import lombok.Data; + +@Data +public class StaffOperationDTO { + + //@NotBlank(message = "角色所属组织ID不能为空") + private String agencyId; + + //@NotBlank(message = "角色所属网格ID不能为空") + private String gridId; +} diff --git a/epmet-module/gov-mine/gov-mine-client/src/main/java/com/epmet/dto/form/StaffRoleFormDTO.java b/epmet-module/gov-mine/gov-mine-client/src/main/java/com/epmet/dto/form/StaffRoleFormDTO.java new file mode 100644 index 0000000000..48938483bb --- /dev/null +++ b/epmet-module/gov-mine/gov-mine-client/src/main/java/com/epmet/dto/form/StaffRoleFormDTO.java @@ -0,0 +1,9 @@ +package com.epmet.dto.form; + +import lombok.Data; + +@Data +public class StaffRoleFormDTO { + private String staffId; + private String orgId; +} diff --git a/epmet-module/gov-mine/gov-mine-server/pom.xml b/epmet-module/gov-mine/gov-mine-server/pom.xml index e9965f902b..b06d8fc331 100644 --- a/epmet-module/gov-mine/gov-mine-server/pom.xml +++ b/epmet-module/gov-mine/gov-mine-server/pom.xml @@ -71,6 +71,12 @@ 2.0.0 compile + + com.epmet + gov-access-client + 2.0.0 + compile + diff --git a/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/controller/AccessController.java b/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/controller/AccessController.java new file mode 100644 index 0000000000..9cef45a3b4 --- /dev/null +++ b/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/controller/AccessController.java @@ -0,0 +1,42 @@ +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.StaffOperationDTO; +import com.epmet.service.AccessService; +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; +import java.util.Set; + +/** + * @return + * 我的权限相关 + * @Author wxz + * @Description + * @Date 2020/4/22 22:18 + **/ +@RestController +@RequestMapping("access") +public class AccessController { + + @Autowired + private AccessService accessService; + + @PostMapping("getstaffoperations") + public Result> getStaffOperations(@LoginUser TokenDto tokenDto, @RequestBody StaffOperationDTO staffOperationDTO) { + //public Result> getStaffOperations(@RequestBody StaffOperationDTO staffOperationDTO) { + String agencyId = staffOperationDTO.getAgencyId(); + String gridId = staffOperationDTO.getGridId(); + String staffId = tokenDto.getUserId(); + Set opeKeys = accessService.listOpeKeysByStaffId(staffId, agencyId, gridId); + return new Result>().ok(opeKeys); + } + +} 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 af24c8b644..f5eebb41b7 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 @@ -2,11 +2,16 @@ package com.epmet.feign; import com.epmet.commons.tools.constant.ServiceConstant; import com.epmet.commons.tools.utils.Result; +import com.epmet.dto.GovStaffRoleDTO; +import com.epmet.dto.form.StaffRoleFormDTO; import com.epmet.dto.result.LatestCustomerResultDTO; import com.epmet.feign.fallback.EpmetUserFeignClientFallback; import org.springframework.cloud.openfeign.FeignClient; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.PostMapping; + +import java.util.List; /** * @Description @@ -14,5 +19,20 @@ import org.springframework.web.bind.annotation.PathVariable; */ @FeignClient(name = ServiceConstant.EPMET_USER_SERVER, fallback = EpmetUserFeignClientFallback.class) public interface EpmetUserFeignClient { + /** + * 获取最近一次登录的客户信息 + * + * @param userId + * @return + */ + @GetMapping("/epmetuser/staffagencyvisited/getlatestcustomer/{userId}") + Result getLatestCustomer(@PathVariable("userId") String userId); + /** + * 查询工作人员的角色 + * @return + */ + @PostMapping("/epmetuser/staffrole/staffRoles") + Result> getRolesOfStaff(StaffRoleFormDTO staffRoleFormDTO); } + diff --git a/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/feign/GovAccessFeignClient.java b/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/feign/GovAccessFeignClient.java new file mode 100644 index 0000000000..facacdb301 --- /dev/null +++ b/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/feign/GovAccessFeignClient.java @@ -0,0 +1,25 @@ +package com.epmet.feign; + +import com.epmet.commons.tools.constant.ServiceConstant; +import com.epmet.commons.tools.utils.Result; +import com.epmet.dto.result.CustomerGridByUserIdResultDTO; +import com.epmet.dto.result.RoleOperationResultDTO; +import com.epmet.feign.fallback.GovAccessFeignClientFallback; +import com.epmet.feign.fallback.GovOrgFeignClientFallBack; +import org.springframework.cloud.openfeign.FeignClient; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.PostMapping; + +import java.util.List; + +/** + * @Description + * @Author sun + */ +@FeignClient(name = ServiceConstant.GOV_ACCESS_SERVER, fallback = GovAccessFeignClientFallback.class) +public interface GovAccessFeignClient { + + @PostMapping("/gov/access/role/operations/{roleId}") + Result> listOperationsByRoleId(@PathVariable("roleId") String roleId); +} diff --git a/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/feign/fallback/EpmetUserFeignClientFallback.java b/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/feign/fallback/EpmetUserFeignClientFallback.java index 5f551bef80..a74421416f 100644 --- a/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/feign/fallback/EpmetUserFeignClientFallback.java +++ b/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/feign/fallback/EpmetUserFeignClientFallback.java @@ -3,10 +3,14 @@ package com.epmet.feign.fallback; import com.epmet.commons.tools.constant.ServiceConstant; import com.epmet.commons.tools.utils.ModuleUtils; import com.epmet.commons.tools.utils.Result; +import com.epmet.dto.GovStaffRoleDTO; +import com.epmet.dto.form.StaffRoleFormDTO; import com.epmet.dto.result.LatestCustomerResultDTO; import com.epmet.feign.EpmetUserFeignClient; import org.springframework.stereotype.Component; +import java.util.List; + /** * @Description * @Author sun @@ -14,4 +18,13 @@ import org.springframework.stereotype.Component; @Component public class EpmetUserFeignClientFallback implements EpmetUserFeignClient { + @Override + public Result getLatestCustomer(String userId) { + return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "getLatestCustomer", userId); + } + + @Override + public Result> getRolesOfStaff(StaffRoleFormDTO staffRoleFormDTO) { + return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "getRolesOfStaff"); + } } diff --git a/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/feign/fallback/GovAccessFeignClientFallback.java b/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/feign/fallback/GovAccessFeignClientFallback.java new file mode 100644 index 0000000000..0fc5df6a94 --- /dev/null +++ b/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/feign/fallback/GovAccessFeignClientFallback.java @@ -0,0 +1,28 @@ +package com.epmet.feign.fallback; + +import com.epmet.commons.tools.constant.ServiceConstant; +import com.epmet.commons.tools.utils.ModuleUtils; +import com.epmet.commons.tools.utils.Result; +import com.epmet.dto.StaffRoleDTO; +import com.epmet.dto.form.StaffRoleFormDTO; +import com.epmet.dto.result.CustomerGridByUserIdResultDTO; +import com.epmet.dto.result.LatestCustomerResultDTO; +import com.epmet.dto.result.RoleOperationResultDTO; +import com.epmet.feign.EpmetUserFeignClient; +import com.epmet.feign.GovAccessFeignClient; +import org.springframework.stereotype.Component; + +import java.util.List; + +/** + * @Description + * @Author sun + */ +@Component +public class GovAccessFeignClientFallback implements GovAccessFeignClient { + + @Override + public Result> listOperationsByRoleId(String roleId) { + return ModuleUtils.feignConError(ServiceConstant.GOV_ACCESS_SERVER, "listOperationsByRoleId"); + } +} diff --git a/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/service/AccessService.java b/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/service/AccessService.java new file mode 100644 index 0000000000..bb213bd94d --- /dev/null +++ b/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/service/AccessService.java @@ -0,0 +1,19 @@ +package com.epmet.service; + +import java.util.List; +import java.util.Set; + +/** + * 权限service + * @Author wxz + * @Description + * @Date 2020/4/22 23:29 + **/ +public interface AccessService { + /** + * 根据staffId查询角色Key列表 + * @param staffId + * @return + */ + Set listOpeKeysByStaffId(String staffId, String agencyId, String gridId); +} diff --git a/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/service/impl/AccessServiceImpl.java b/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/service/impl/AccessServiceImpl.java new file mode 100644 index 0000000000..c7823cd335 --- /dev/null +++ b/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/service/impl/AccessServiceImpl.java @@ -0,0 +1,61 @@ +package com.epmet.service.impl; + +import com.epmet.commons.tools.utils.Result; +import com.epmet.dto.GovStaffRoleDTO; +import com.epmet.dto.StaffRoleDTO; +import com.epmet.dto.form.StaffRoleFormDTO; +import com.epmet.dto.result.RoleOperationResultDTO; +import com.epmet.feign.EpmetUserFeignClient; +import com.epmet.feign.GovAccessFeignClient; +import com.epmet.service.AccessService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.util.CollectionUtils; + +import java.util.ArrayList; +import java.util.HashSet; +import java.util.List; +import java.util.Set; + +@Service +public class AccessServiceImpl implements AccessService { + + @Autowired + private EpmetUserFeignClient userFeignClient; + + @Autowired + private GovAccessFeignClient govAccessFeignClient; + + @Override + public Set listOpeKeysByStaffId(String staffId, String agencyId, String gridId) { + List roleDTOS = new ArrayList<>(); + // 查询机关单位权限 + StaffRoleFormDTO formDTO = new StaffRoleFormDTO(); + formDTO.setStaffId(staffId); + formDTO.setOrgId(agencyId); + Result> agencyResult = userFeignClient.getRolesOfStaff(formDTO); + if (!CollectionUtils.isEmpty(agencyResult.getData())) { + roleDTOS.addAll(agencyResult.getData()); + } + // 查询网格权限 + formDTO.setStaffId(staffId); + formDTO.setOrgId(gridId); + Result> gridResult = userFeignClient.getRolesOfStaff(formDTO); + if (!CollectionUtils.isEmpty(gridResult.getData())) { + roleDTOS.addAll(gridResult.getData()); + } + + // 拼装 + Set opeKeys = new HashSet<>(); + roleDTOS.forEach(roleDto -> { + String roleId = roleDto.getId(); + List roleOperations = govAccessFeignClient.listOperationsByRoleId(roleId).getData(); + roleOperations.forEach(roleOpe -> { + if (roleOpe != null) { + opeKeys.add(roleOpe.getOperationKey()); + } + }); + }); + return opeKeys; + } +} diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/GovStaffRoleDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/GovStaffRoleDTO.java new file mode 100644 index 0000000000..78905406ba --- /dev/null +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/GovStaffRoleDTO.java @@ -0,0 +1,91 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

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

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

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.dto; + +import java.io.Serializable; +import java.util.Date; +import lombok.Data; + + +/** + * 政府端角色表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-04-22 + */ +@Data +public class GovStaffRoleDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + private String id; + + /** + * 客户ID。如果该角色由客户定制,其下的机关和部门都不再各自定制自己的角色,这个字段会比较有用。包括通用角色以及客户定制角色。 + */ + private String customerId; + + /** + * 角色key + */ + private String roleKey; + + /** + * 角色名称 + */ + private String roleName; + + /** + * 角色所属体系类型:agency,department,grid + */ + private String orgType; + + /** + * + */ + private Integer delFlag; + + /** + * + */ + private Integer revision; + + /** + * + */ + private String createdBy; + + /** + * + */ + private Date createdTime; + + /** + * + */ + private String updatedBy; + + /** + * + */ + private Date updatedTime; + +} \ No newline at end of file diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/StaffRoleDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/StaffRoleDTO.java new file mode 100644 index 0000000000..59d649f970 --- /dev/null +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/StaffRoleDTO.java @@ -0,0 +1,86 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

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

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

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.dto; + +import java.io.Serializable; +import java.util.Date; +import lombok.Data; + + +/** + * 工作人员-角色关系表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-04-22 + */ +@Data +public class StaffRoleDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * + */ + private String id; + + /** + * 用户ID + */ + private String staffId; + + /** + * 角色ID + */ + private String roleId; + + /** + * 角色所属类型的ID。例如,机关的角色,那该字段就是所属机关的ID;部门的角色,该字段就是所属部门的ID;网格的角色,该字段就是所属网格ID + */ + private String orgId; + + /** + * + */ + private Integer delFlag; + + /** + * + */ + private Integer revision; + + /** + * + */ + private String createdBy; + + /** + * + */ + private Date createdTime; + + /** + * + */ + private String updatedBy; + + /** + * + */ + private Date updatedTime; + +} \ No newline at end of file diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/StaffRoleFormDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/StaffRoleFormDTO.java new file mode 100644 index 0000000000..ac116b4a4f --- /dev/null +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/StaffRoleFormDTO.java @@ -0,0 +1,18 @@ +package com.epmet.dto.form; + +import lombok.Data; + +import javax.validation.constraints.NotBlank; + +@Data +public class StaffRoleFormDTO { + + @NotBlank(message = "工作人员ID不能为空") + private String staffId; + + /** + * 机构id,可以是agencyId,DeptId,GridId + */ + @NotBlank(message = "工作人员所属组织ID不能为空") + private String orgId; +} 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 new file mode 100644 index 0000000000..98aacba35d --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/StaffRoleController.java @@ -0,0 +1,53 @@ +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.StaffRoleDTO; +import com.epmet.dto.form.StaffRoleFormDTO; +import com.epmet.entity.GovStaffRoleEntity; +import com.epmet.service.GovStaffRoleService; +import org.springframework.beans.BeanUtils; +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.ArrayList; +import java.util.List; + +/** + * @return + * 工作人员相关api + * @Author wxz + * @Description + * @Date 2020/4/22 22:44 + **/ +@RestController +@RequestMapping("staffrole") +public class StaffRoleController { + + @Autowired + private GovStaffRoleService govStaffRoleService; + + /** + * 根据工作人员查询工作人员具有的角色列表 + * @return + */ + @PostMapping("staffRoles") + public Result> getRolesOfStaff(@RequestBody StaffRoleFormDTO staffRoleFormDTO) { + ValidatorUtils.validateEntity(staffRoleFormDTO); + String staffId = staffRoleFormDTO.getStaffId(); + String orgId = staffRoleFormDTO.getOrgId(); + List staffRoleEntities = govStaffRoleService.listRolesByStaffId(staffId, orgId); + List staffRoleDTOS = new ArrayList<>(); + staffRoleEntities.forEach(role -> { + GovStaffRoleDTO dto = new GovStaffRoleDTO(); + BeanUtils.copyProperties(role, dto); + staffRoleDTOS.add(dto); + }); + return new Result>().ok(staffRoleDTOS); + } + +} diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/GovStaffRoleDao.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/GovStaffRoleDao.java new file mode 100644 index 0000000000..8967f79733 --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/GovStaffRoleDao.java @@ -0,0 +1,37 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

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

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

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.dao; + +import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.entity.GovStaffRoleEntity; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + * 政府端角色表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-04-22 + */ +@Mapper +public interface GovStaffRoleDao extends BaseDao { + + List listRolesByStaffId(@Param("staffId") String staffId, @Param("orgId") String orgId); +} \ 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 new file mode 100644 index 0000000000..1a69f5a6c2 --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/StaffRoleDao.java @@ -0,0 +1,33 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

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

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

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.dao; + +import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.entity.StaffRoleEntity; +import org.apache.ibatis.annotations.Mapper; + +/** + * 工作人员-角色关系表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-04-22 + */ +@Mapper +public interface StaffRoleDao extends BaseDao { + +} \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/GovStaffRoleEntity.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/GovStaffRoleEntity.java new file mode 100644 index 0000000000..80ee011dcd --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/GovStaffRoleEntity.java @@ -0,0 +1,61 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

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

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

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.entity; + +import com.baomidou.mybatisplus.annotation.TableName; + +import com.epmet.commons.mybatis.entity.BaseEpmetEntity; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.util.Date; + +/** + * 政府端角色表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-04-22 + */ +@Data +@EqualsAndHashCode(callSuper=false) +@TableName("gov_staff_role") +public class GovStaffRoleEntity extends BaseEpmetEntity { + + private static final long serialVersionUID = 1L; + + /** + * 客户ID。如果该角色由客户定制,其下的机关和部门都不再各自定制自己的角色,这个字段会比较有用。包括通用角色以及客户定制角色。 + */ + private String customerId; + + /** + * 角色key + */ + private String roleKey; + + /** + * 角色名称 + */ + private String roleName; + + /** + * 角色所属体系类型:agency,department,grid + */ + private String orgType; + +} diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/StaffRoleEntity.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/StaffRoleEntity.java new file mode 100644 index 0000000000..20f828a52d --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/StaffRoleEntity.java @@ -0,0 +1,56 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

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

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

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.entity; + +import com.baomidou.mybatisplus.annotation.TableName; + +import com.epmet.commons.mybatis.entity.BaseEpmetEntity; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.util.Date; + +/** + * 工作人员-角色关系表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-04-22 + */ +@Data +@EqualsAndHashCode(callSuper=false) +@TableName("staff_role") +public class StaffRoleEntity extends BaseEpmetEntity { + + private static final long serialVersionUID = 1L; + + /** + * 用户ID + */ + private String staffId; + + /** + * 角色ID + */ + private String roleId; + + /** + * 角色所属类型的ID。例如,机关的角色,那该字段就是所属机关的ID;部门的角色,该字段就是所属部门的ID;网格的角色,该字段就是所属网格ID + */ + private String orgId; + +} diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/excel/GovStaffRoleExcel.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/excel/GovStaffRoleExcel.java new file mode 100644 index 0000000000..3448b75a7e --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/excel/GovStaffRoleExcel.java @@ -0,0 +1,68 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

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

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

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.excel; + +import cn.afterturn.easypoi.excel.annotation.Excel; +import lombok.Data; + +import java.util.Date; + +/** + * 政府端角色表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-04-22 + */ +@Data +public class GovStaffRoleExcel { + + @Excel(name = "ID") + private String id; + + @Excel(name = "客户ID。如果该角色由客户定制,其下的机关和部门都不再各自定制自己的角色,这个字段会比较有用。包括通用角色以及客户定制角色。") + private String customerId; + + @Excel(name = "角色key") + private String roleKey; + + @Excel(name = "角色名称") + private String roleName; + + @Excel(name = "角色所属体系类型:agency,department,grid") + private String orgType; + + @Excel(name = "") + private Integer delFlag; + + @Excel(name = "") + private Integer revision; + + @Excel(name = "") + private String createdBy; + + @Excel(name = "") + private Date createdTime; + + @Excel(name = "") + private String updatedBy; + + @Excel(name = "") + private Date updatedTime; + + +} \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/excel/StaffRoleExcel.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/excel/StaffRoleExcel.java new file mode 100644 index 0000000000..78def4343b --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/excel/StaffRoleExcel.java @@ -0,0 +1,65 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

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

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

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.excel; + +import cn.afterturn.easypoi.excel.annotation.Excel; +import lombok.Data; + +import java.util.Date; + +/** + * 工作人员-角色关系表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-04-22 + */ +@Data +public class StaffRoleExcel { + + @Excel(name = "") + private String id; + + @Excel(name = "用户ID") + private String staffId; + + @Excel(name = "角色ID") + private String roleId; + + @Excel(name = "角色所属类型的ID。例如,机关的角色,那该字段就是所属机关的ID;部门的角色,该字段就是所属部门的ID;网格的角色,该字段就是所属网格ID") + private String orgId; + + @Excel(name = "") + private Integer delFlag; + + @Excel(name = "") + private Integer revision; + + @Excel(name = "") + private String createdBy; + + @Excel(name = "") + private Date createdTime; + + @Excel(name = "") + private String updatedBy; + + @Excel(name = "") + private Date updatedTime; + + +} \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/redis/GovStaffRoleRedis.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/redis/GovStaffRoleRedis.java new file mode 100644 index 0000000000..2ad77b306a --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/redis/GovStaffRoleRedis.java @@ -0,0 +1,47 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

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

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

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.redis; + +import com.epmet.commons.tools.redis.RedisUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +/** + * 政府端角色表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-04-22 + */ +@Component +public class GovStaffRoleRedis { + @Autowired + private RedisUtils redisUtils; + + public void delete(Object[] ids) { + + } + + public void set(){ + + } + + public String get(String id){ + return null; + } + +} \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/redis/StaffRoleRedis.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/redis/StaffRoleRedis.java new file mode 100644 index 0000000000..47714034af --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/redis/StaffRoleRedis.java @@ -0,0 +1,47 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

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

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

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.redis; + +import com.epmet.commons.tools.redis.RedisUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +/** + * 工作人员-角色关系表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-04-22 + */ +@Component +public class StaffRoleRedis { + @Autowired + private RedisUtils redisUtils; + + public void delete(Object[] ids) { + + } + + public void set(){ + + } + + public String get(String id){ + return null; + } + +} \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/GovStaffRoleService.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/GovStaffRoleService.java new file mode 100644 index 0000000000..942a001921 --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/GovStaffRoleService.java @@ -0,0 +1,102 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

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

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

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.service; + +import com.epmet.commons.mybatis.service.BaseService; +import com.epmet.commons.tools.page.PageData; +import com.epmet.dto.GovStaffRoleDTO; +import com.epmet.entity.GovStaffRoleEntity; + +import java.util.List; +import java.util.Map; + +/** + * 政府端角色表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-04-22 + */ +public interface GovStaffRoleService extends BaseService { + + /** + * 默认分页 + * + * @param params + * @return PageData + * @author generator + * @date 2020-04-22 + */ + PageData page(Map params); + + /** + * 默认查询 + * + * @param params + * @return java.util.List + * @author generator + * @date 2020-04-22 + */ + List list(Map params); + + /** + * 单条查询 + * + * @param id + * @return GovStaffRoleDTO + * @author generator + * @date 2020-04-22 + */ + GovStaffRoleDTO get(String id); + + /** + * 默认保存 + * + * @param dto + * @return void + * @author generator + * @date 2020-04-22 + */ + void save(GovStaffRoleDTO dto); + + /** + * 默认更新 + * + * @param dto + * @return void + * @author generator + * @date 2020-04-22 + */ + void update(GovStaffRoleDTO dto); + + /** + * 批量删除 + * + * @param ids + * @return void + * @author generator + * @date 2020-04-22 + */ + void delete(String[] ids); + + /** + * 根据staffId查询具有的角色列表 + * @param staffId + * @return + */ + List listRolesByStaffId(String staffId, String orgId); +} \ 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 new file mode 100644 index 0000000000..f5787beaa8 --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/StaffRoleService.java @@ -0,0 +1,95 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

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

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

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.service; + +import com.epmet.commons.mybatis.service.BaseService; +import com.epmet.commons.tools.page.PageData; +import com.epmet.dto.StaffRoleDTO; +import com.epmet.entity.StaffRoleEntity; + +import java.util.List; +import java.util.Map; + +/** + * 工作人员-角色关系表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-04-22 + */ +public interface StaffRoleService extends BaseService { + + /** + * 默认分页 + * + * @param params + * @return PageData + * @author generator + * @date 2020-04-22 + */ + PageData page(Map params); + + /** + * 默认查询 + * + * @param params + * @return java.util.List + * @author generator + * @date 2020-04-22 + */ + List list(Map params); + + /** + * 单条查询 + * + * @param id + * @return StaffRoleDTO + * @author generator + * @date 2020-04-22 + */ + StaffRoleDTO get(String id); + + /** + * 默认保存 + * + * @param dto + * @return void + * @author generator + * @date 2020-04-22 + */ + void save(StaffRoleDTO dto); + + /** + * 默认更新 + * + * @param dto + * @return void + * @author generator + * @date 2020-04-22 + */ + void update(StaffRoleDTO dto); + + /** + * 批量删除 + * + * @param ids + * @return void + * @author generator + * @date 2020-04-22 + */ + void delete(String[] ids); +} \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/GovStaffRoleServiceImpl.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/GovStaffRoleServiceImpl.java new file mode 100644 index 0000000000..fac6d94901 --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/GovStaffRoleServiceImpl.java @@ -0,0 +1,114 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

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

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

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; +import com.epmet.commons.tools.page.PageData; +import com.epmet.commons.tools.utils.ConvertUtils; +import com.epmet.commons.tools.constant.FieldConstant; +import com.epmet.dao.GovStaffRoleDao; +import com.epmet.dto.GovStaffRoleDTO; +import com.epmet.entity.GovStaffRoleEntity; +import com.epmet.redis.GovStaffRoleRedis; +import com.epmet.service.GovStaffRoleService; +import org.apache.commons.lang3.StringUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.util.Arrays; +import java.util.List; +import java.util.Map; + +/** + * 政府端角色表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-04-22 + */ +@Service +public class GovStaffRoleServiceImpl extends BaseServiceImpl implements GovStaffRoleService { + + @Autowired + private GovStaffRoleRedis govStaffRoleRedis; + + @Override + public PageData page(Map params) { + IPage page = baseDao.selectPage( + getPage(params, FieldConstant.CREATED_TIME, false), + getWrapper(params) + ); + return getPageData(page, GovStaffRoleDTO.class); + } + + @Override + public List list(Map params) { + List entityList = baseDao.selectList(getWrapper(params)); + + return ConvertUtils.sourceToTarget(entityList, GovStaffRoleDTO.class); + } + + private QueryWrapper getWrapper(Map params){ + String id = (String)params.get(FieldConstant.ID_HUMP); + + QueryWrapper wrapper = new QueryWrapper<>(); + wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id); + + return wrapper; + } + + @Override + public GovStaffRoleDTO get(String id) { + GovStaffRoleEntity entity = baseDao.selectById(id); + return ConvertUtils.sourceToTarget(entity, GovStaffRoleDTO.class); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void save(GovStaffRoleDTO dto) { + GovStaffRoleEntity entity = ConvertUtils.sourceToTarget(dto, GovStaffRoleEntity.class); + insert(entity); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void update(GovStaffRoleDTO dto) { + GovStaffRoleEntity entity = ConvertUtils.sourceToTarget(dto, GovStaffRoleEntity.class); + updateById(entity); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void delete(String[] ids) { + // 逻辑删除(@TableLogic 注解) + baseDao.deleteBatchIds(Arrays.asList(ids)); + } + + /** + * 根据staffId查询具有的角色列表 + * @param staffId + * @return + */ + @Override + public List listRolesByStaffId(String staffId, String orgId) { + return baseDao.listRolesByStaffId(staffId, orgId); + } + +} \ 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 new file mode 100644 index 0000000000..bf717ba530 --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/StaffRoleServiceImpl.java @@ -0,0 +1,104 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

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

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

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; +import com.epmet.commons.tools.page.PageData; +import com.epmet.commons.tools.utils.ConvertUtils; +import com.epmet.commons.tools.constant.FieldConstant; +import com.epmet.dao.StaffRoleDao; +import com.epmet.dto.StaffRoleDTO; +import com.epmet.entity.StaffRoleEntity; +import com.epmet.redis.StaffRoleRedis; +import com.epmet.service.StaffRoleService; +import org.apache.commons.lang3.StringUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.util.Arrays; +import java.util.List; +import java.util.Map; + +/** + * 工作人员-角色关系表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-04-22 + */ +@Service +public class StaffRoleServiceImpl extends BaseServiceImpl implements StaffRoleService { + + @Autowired + private StaffRoleRedis staffRoleRedis; + + @Override + public PageData page(Map params) { + IPage page = baseDao.selectPage( + getPage(params, FieldConstant.CREATED_TIME, false), + getWrapper(params) + ); + return getPageData(page, StaffRoleDTO.class); + } + + @Override + public List list(Map params) { + List entityList = baseDao.selectList(getWrapper(params)); + + return ConvertUtils.sourceToTarget(entityList, StaffRoleDTO.class); + } + + private QueryWrapper getWrapper(Map params){ + String id = (String)params.get(FieldConstant.ID_HUMP); + + QueryWrapper wrapper = new QueryWrapper<>(); + wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id); + + return wrapper; + } + + @Override + public StaffRoleDTO get(String id) { + StaffRoleEntity entity = baseDao.selectById(id); + return ConvertUtils.sourceToTarget(entity, StaffRoleDTO.class); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void save(StaffRoleDTO dto) { + StaffRoleEntity entity = ConvertUtils.sourceToTarget(dto, StaffRoleEntity.class); + insert(entity); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void update(StaffRoleDTO dto) { + StaffRoleEntity entity = ConvertUtils.sourceToTarget(dto, StaffRoleEntity.class); + updateById(entity); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void delete(String[] ids) { + // 逻辑删除(@TableLogic 注解) + baseDao.deleteBatchIds(Arrays.asList(ids)); + } + +} \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/resources/mapper/GovStaffRoleDao.xml b/epmet-user/epmet-user-server/src/main/resources/mapper/GovStaffRoleDao.xml new file mode 100644 index 0000000000..95949edd10 --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/resources/mapper/GovStaffRoleDao.xml @@ -0,0 +1,32 @@ + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/resources/mapper/StaffRoleDao.xml b/epmet-user/epmet-user-server/src/main/resources/mapper/StaffRoleDao.xml new file mode 100644 index 0000000000..79ad9ca489 --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/resources/mapper/StaffRoleDao.xml @@ -0,0 +1,20 @@ + + + + + + + + + + + + + + + + + + + + \ No newline at end of file From c169baa59f12719081798946b6ff9753b7f4f6fd Mon Sep 17 00:00:00 2001 From: wangchao Date: Thu, 23 Apr 2020 11:51:16 +0800 Subject: [PATCH 40/85] =?UTF-8?q?=E6=94=BF=E5=BA=9C=E5=B7=A5=E4=BD=9C?= =?UTF-8?q?=E4=BA=BA=E5=91=98=E8=8E=B7=E5=8F=96=E4=B8=8A=E4=B8=80=E6=AC=A1?= =?UTF-8?q?=E7=99=BB=E5=BD=95=E7=9A=84=E7=BD=91=E6=A0=BC=E4=BF=A1=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../epmet/constant/StaffAgencyConstant.java | 12 ++++++ .../controller/StaffAgencyController.java | 18 +++++++++ .../com/epmet/feign/EpmetUserFeignClient.java | 13 +++++++ .../com/epmet/feign/GovOrgFeignClient.java | 14 +++++++ .../EpmetUserFeignClientFallback.java | 8 +++- .../fallback/GovOrgFeignClientFallBack.java | 12 ++++++ .../com/epmet/service/StaffAgencyService.java | 12 ++++++ .../service/impl/StaffAgencyServiceImpl.java | 26 +++++++++++++ .../com/epmet/dto/form/LatestGridFormDTO.java | 28 ++++++++++++++ .../CustomerStaffGridController.java | 18 ++++++++- .../com/epmet/dao/CustomerStaffGridDao.java | 13 ++++++- .../service/CustomerStaffGridService.java | 12 ++++++ .../impl/CustomerStaffGridServiceImpl.java | 14 +++++++ .../resources/mapper/CustomerStaffGridDao.xml | 24 ++++++++++++ .../StaffGridVisitedController.java | 20 +++++++++- .../com/epmet/dao/StaffGridVisitedDao.java | 13 ++++++- .../service/StaffGridVisitedService.java | 12 ++++++ .../impl/StaffGridVisitedServiceImpl.java | 38 +++++++++++++++++++ .../resources/mapper/StaffGridVisitedDao.xml | 16 ++++++++ 19 files changed, 317 insertions(+), 6 deletions(-) create mode 100644 epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/constant/StaffAgencyConstant.java create mode 100644 epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/LatestGridFormDTO.java diff --git a/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/constant/StaffAgencyConstant.java b/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/constant/StaffAgencyConstant.java new file mode 100644 index 0000000000..b6a2591152 --- /dev/null +++ b/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/constant/StaffAgencyConstant.java @@ -0,0 +1,12 @@ +package com.epmet.constant; + +/** + * @Description 机构员工的常量 + * @IntefaceName StaffAgencyConstant + * @Author wangc + * @date 2020.04.23 11:25 + */ +public interface StaffAgencyConstant { + + String QUERY_LATEST_GRID_INFO_FAILED = "查询上一次登录的网格信息失败"; +} 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 83b649e63a..a3856fa2eb 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 @@ -20,11 +20,14 @@ 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.LatestGridFormDTO; import com.epmet.dto.result.CustomerGridByUserIdResultDTO; import com.epmet.dto.result.LatestCustomerResultDTO; import com.epmet.service.StaffAgencyService; 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; @@ -64,4 +67,19 @@ public class StaffAgencyController { return staffAgencyService.getLatestCustomer(tokenDTO); } + /** + * @Description 得到工作人员最后一次登录的网格 + * @Param TokenDto -> userId/staffId + * @Param LatestGridFormDTO -> customerId + * @return Result + * @Author wangc + * @Date 2020.04.23 11:16 + **/ + @PostMapping("getlatestgrid") + public Result getLatestGrid(@LoginUser TokenDto tokenDto, @RequestBody LatestGridFormDTO latestGridFormDTO){ + latestGridFormDTO.setStaffId(tokenDto.getUserId()); + ValidatorUtils.validateEntity(latestGridFormDTO); + 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 af24c8b644..6d8914d357 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 @@ -2,11 +2,14 @@ package com.epmet.feign; import com.epmet.commons.tools.constant.ServiceConstant; import com.epmet.commons.tools.utils.Result; +import com.epmet.dto.form.LatestGridFormDTO; +import com.epmet.dto.result.CustomerGridByUserIdResultDTO; import com.epmet.dto.result.LatestCustomerResultDTO; import com.epmet.feign.fallback.EpmetUserFeignClientFallback; import org.springframework.cloud.openfeign.FeignClient; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.PostMapping; /** * @Description @@ -15,4 +18,14 @@ import org.springframework.web.bind.annotation.PathVariable; @FeignClient(name = ServiceConstant.EPMET_USER_SERVER, fallback = EpmetUserFeignClientFallback.class) public interface EpmetUserFeignClient { + /** + * @Description 查询工作人员上次登录的网格 + * @Param customerId ; staffId + * @return Result + * @Author wangc + * @Date 2020.04.23 10:44 + **/ + @PostMapping(value = "/epmetuser/staffgridvisited/getstafflatestgrid") + Result getStaffLatestGrid(LatestGridFormDTO latestGridFormDTO); + } diff --git a/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/feign/GovOrgFeignClient.java b/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/feign/GovOrgFeignClient.java index f87abc24e4..737988fd0b 100644 --- a/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/feign/GovOrgFeignClient.java +++ b/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/feign/GovOrgFeignClient.java @@ -2,12 +2,15 @@ package com.epmet.feign; import com.epmet.commons.tools.constant.ServiceConstant; import com.epmet.commons.tools.utils.Result; +import com.epmet.dto.form.LatestGridFormDTO; import com.epmet.dto.result.CustomerGridByUserIdResultDTO; import com.epmet.dto.result.LatestCustomerResultDTO; import com.epmet.feign.fallback.GovOrgFeignClientFallBack; import org.springframework.cloud.openfeign.FeignClient; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; import java.util.List; @@ -35,4 +38,15 @@ public interface GovOrgFeignClient { */ @GetMapping("/gov/org/customerstaffagency/getlatestcustomer/{userId}") Result getLatestCustomer(@PathVariable("userId") String userId); + + /** + * @Description 查询指定客户下一个用户所在的网格,调用gov-org + * @Param LatestGridFormDTO -> customerId ; staffId + * @return Result + * @Author wangc + * @Date 2020.04.23 10:53 + **/ + @PostMapping(value = "/gov/org/customerstaffgrid/getstaffgrid") + Result getStaffGrid(@RequestBody LatestGridFormDTO latestGridFormDTO); + } diff --git a/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/feign/fallback/EpmetUserFeignClientFallback.java b/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/feign/fallback/EpmetUserFeignClientFallback.java index 5f551bef80..e03528d079 100644 --- a/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/feign/fallback/EpmetUserFeignClientFallback.java +++ b/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/feign/fallback/EpmetUserFeignClientFallback.java @@ -1,9 +1,11 @@ package com.epmet.feign.fallback; + import com.epmet.commons.tools.constant.ServiceConstant; import com.epmet.commons.tools.utils.ModuleUtils; import com.epmet.commons.tools.utils.Result; -import com.epmet.dto.result.LatestCustomerResultDTO; +import com.epmet.dto.form.LatestGridFormDTO; +import com.epmet.dto.result.CustomerGridByUserIdResultDTO; import com.epmet.feign.EpmetUserFeignClient; import org.springframework.stereotype.Component; @@ -14,4 +16,8 @@ import org.springframework.stereotype.Component; @Component public class EpmetUserFeignClientFallback implements EpmetUserFeignClient { + @Override + public Result getStaffLatestGrid(LatestGridFormDTO latestGridFormDTO) { + return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "getStaffLatestGrid",latestGridFormDTO); + } } diff --git a/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/feign/fallback/GovOrgFeignClientFallBack.java b/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/feign/fallback/GovOrgFeignClientFallBack.java index 7e7b838d38..3afafce426 100644 --- a/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/feign/fallback/GovOrgFeignClientFallBack.java +++ b/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/feign/fallback/GovOrgFeignClientFallBack.java @@ -3,7 +3,9 @@ package com.epmet.feign.fallback; import com.epmet.commons.tools.constant.ServiceConstant; import com.epmet.commons.tools.utils.ModuleUtils; import com.epmet.commons.tools.utils.Result; +import com.epmet.dto.form.LatestGridFormDTO; import com.epmet.dto.result.CustomerGridByUserIdResultDTO; +import com.epmet.dto.result.LatestCustomerResultDTO; import com.epmet.feign.GovOrgFeignClient; import org.springframework.stereotype.Component; @@ -20,4 +22,14 @@ public class GovOrgFeignClientFallBack implements GovOrgFeignClient { public Result> getMyGrids(String userId) { return ModuleUtils.feignConError(ServiceConstant.GOV_ORG_SERVER, "getMyGrids", userId); } + + @Override + public Result getLatestCustomer(String userId) { + return null; + } + + @Override + public Result getStaffGrid(LatestGridFormDTO latestGridFormDTO) { + return ModuleUtils.feignConError(ServiceConstant.GOV_ORG_SERVER, "getStaffGrid",latestGridFormDTO); + } } \ No newline at end of file diff --git a/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/service/StaffAgencyService.java b/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/service/StaffAgencyService.java index 589a0ed64e..3b5f4f6b5c 100644 --- a/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/service/StaffAgencyService.java +++ b/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/service/StaffAgencyService.java @@ -17,10 +17,13 @@ package com.epmet.service; +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.LatestGridFormDTO; import com.epmet.dto.result.CustomerGridByUserIdResultDTO; import com.epmet.dto.result.LatestCustomerResultDTO; +import org.springframework.web.bind.annotation.RequestBody; import java.util.List; @@ -45,4 +48,13 @@ public interface StaffAgencyService { * @return */ Result getLatestCustomer(TokenDto tokenDTO); + + /** + * @Description 得到工作人员最后一次登录的网格 + * @Param LatestGridFormDTO -> staffId ; customerId + * @return Result + * @Author wangc + * @Date 2020.04.23 11:14 + **/ + Result getLatestGrid(LatestGridFormDTO latestGridFormDTO); } \ No newline at end of file diff --git a/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/service/impl/StaffAgencyServiceImpl.java b/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/service/impl/StaffAgencyServiceImpl.java index 1a7a56e39a..92855ecb8b 100644 --- a/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/service/impl/StaffAgencyServiceImpl.java +++ b/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/service/impl/StaffAgencyServiceImpl.java @@ -19,11 +19,14 @@ package com.epmet.service.impl; import com.epmet.commons.tools.security.dto.TokenDto; import com.epmet.commons.tools.utils.Result; +import com.epmet.constant.StaffAgencyConstant; +import com.epmet.dto.form.LatestGridFormDTO; import com.epmet.dto.result.CustomerGridByUserIdResultDTO; import com.epmet.dto.result.LatestCustomerResultDTO; import com.epmet.feign.EpmetUserFeignClient; import com.epmet.feign.GovOrgFeignClient; import com.epmet.service.StaffAgencyService; +import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -58,5 +61,28 @@ public class StaffAgencyServiceImpl implements StaffAgencyService { return govOrgFeignClient.getLatestCustomer(tokenDTO.getUserId()); } + /** + * @Description 得到工作人员最后一次登录的网格 + * @Param LatestGridFormDTO -> staffId ; customerId + * @return Result + * @Author wangc + * @Date 2020.04.23 11:14 + **/ + @Override + public Result getLatestGrid(LatestGridFormDTO latestGridFormDTO) { + Result latestGridResult = + epmetUserFeignClient.getStaffLatestGrid(latestGridFormDTO); + if(latestGridResult.success() && null != latestGridResult.getData() && StringUtils.isNotBlank(latestGridResult.getData().getGridId())){ + return latestGridResult; + }else{ + Result staffGridResult = + govOrgFeignClient.getStaffGrid(latestGridFormDTO); + if(staffGridResult.success() && null != staffGridResult.getData() && StringUtils.isNotBlank(staffGridResult.getData().getGridId())){ + return staffGridResult; + } + } + return new Result().error(StaffAgencyConstant.QUERY_LATEST_GRID_INFO_FAILED); + } + } \ No newline at end of file diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/LatestGridFormDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/LatestGridFormDTO.java new file mode 100644 index 0000000000..7642a7ae0b --- /dev/null +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/LatestGridFormDTO.java @@ -0,0 +1,28 @@ +package com.epmet.dto.form; + +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import java.io.Serializable; + +/** + * @author: wangc + * @description: + * @date: Created in 2020-04-22 18:19 + */ +@Data +public class LatestGridFormDTO implements Serializable { + private static final long serialVersionUID = 1L; + + /** + * 客户Id + * */ + @NotBlank(message = "客户Id不能为空") + private String customerId; + + /** + * 工作人员Id + * */ + @NotBlank(message = "工作人员Id不能为空") + private String staffId; +} diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/CustomerStaffGridController.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/CustomerStaffGridController.java index ec584efb56..757d7383a7 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/CustomerStaffGridController.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/CustomerStaffGridController.java @@ -26,6 +26,8 @@ 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.CustomerStaffGridDTO; +import com.epmet.dto.form.LatestGridFormDTO; +import com.epmet.dto.result.CustomerGridByUserIdResultDTO; import com.epmet.excel.CustomerStaffGridExcel; import com.epmet.service.CustomerStaffGridService; import org.springframework.beans.factory.annotation.Autowired; @@ -37,7 +39,7 @@ import java.util.Map; /** - * 网格人员关系表 + * 网格人员关系表 * * @author generator generator@elink-cn.com * @since v1.0.0 2020-04-20 @@ -45,7 +47,7 @@ import java.util.Map; @RestController @RequestMapping("customerstaffgrid") public class CustomerStaffGridController { - + @Autowired private CustomerStaffGridService customerStaffGridService; @@ -91,4 +93,16 @@ public class CustomerStaffGridController { ExcelUtils.exportExcelToTarget(response, null, list, CustomerStaffGridExcel.class); } + /** + * @Description 查询指定客户下一个用户所在的网格,调用gov-org + * @Param LatestGridFormDTO -> customerId ; staffId + * @return Result + * @Author wangc + * @Date 2020.04.23 10:53 + **/ + @PostMapping("getstaffgrid") + public Result getStaffGrid(@RequestBody LatestGridFormDTO latestGridFormDTO){ + ValidatorUtils.validateEntity(latestGridFormDTO); + return customerStaffGridService.getStaffGridOrderByGridName(latestGridFormDTO); + } } \ 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 01dc0c2721..dc61c9039f 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 @@ -18,6 +18,8 @@ package com.epmet.dao; import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.dto.CustomerGridDTO; +import com.epmet.dto.form.LatestGridFormDTO; import com.epmet.entity.CustomerStaffGridEntity; import org.apache.ibatis.annotations.Mapper; @@ -29,5 +31,14 @@ import org.apache.ibatis.annotations.Mapper; */ @Mapper public interface CustomerStaffGridDao extends BaseDao { - + + /** + * @Description 查询指定客户下一个用户所在的网格,按照网格名称升序排序,取第一个 + * @Param LatestGridFormDTO -> customerId ; userId + * @return CustomerGridDTO + * @Author wangc + * @Date 2020.04.23 01:09 + **/ + CustomerGridDTO selectStaffGridOrderByGridName(LatestGridFormDTO latestGridFormDTO); + } \ 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 a0b273fb76..5a085e3d1d 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 @@ -19,7 +19,10 @@ 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.CustomerStaffGridDTO; +import com.epmet.dto.form.LatestGridFormDTO; +import com.epmet.dto.result.CustomerGridByUserIdResultDTO; import com.epmet.entity.CustomerStaffGridEntity; import java.util.List; @@ -92,4 +95,13 @@ public interface CustomerStaffGridService extends BaseService customerId ; staffId + * @return CustomerGridDTO + * @Author wangc + * @Date 2020.04.23 09:11 + **/ + Result getStaffGridOrderByGridName(LatestGridFormDTO latestGridFormDTO); } \ 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 894bb6a888..074ac2f36a 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerStaffGridServiceImpl.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerStaffGridServiceImpl.java @@ -23,8 +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.CustomerStaffGridDao; +import com.epmet.dto.CustomerGridDTO; import com.epmet.dto.CustomerStaffGridDTO; +import com.epmet.dto.form.LatestGridFormDTO; +import com.epmet.dto.result.CustomerGridByUserIdResultDTO; import com.epmet.entity.CustomerStaffGridEntity; import com.epmet.redis.CustomerStaffGridRedis; import com.epmet.service.CustomerStaffGridService; @@ -101,4 +105,14 @@ public class CustomerStaffGridServiceImpl extends BaseServiceImpl getStaffGridOrderByGridName(LatestGridFormDTO latestGridFormDTO) { + CustomerGridDTO grid = baseDao.selectStaffGridOrderByGridName(latestGridFormDTO); + CustomerGridByUserIdResultDTO result = new CustomerGridByUserIdResultDTO(); + result.setGridName(grid.getGridName()); + result.setGridId(grid.getId()); + result.setAgencyId(grid.getPid()); + return new Result().ok(result); + } + } \ No newline at end of file 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 13dbdb25ce..47a9de4a33 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 @@ -17,4 +17,28 @@ + + + \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/StaffGridVisitedController.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/StaffGridVisitedController.java index ec34fb21fb..9aad22d45a 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/StaffGridVisitedController.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/StaffGridVisitedController.java @@ -17,8 +17,14 @@ package com.epmet.controller; +import com.epmet.commons.tools.utils.Result; +import com.epmet.commons.tools.validator.ValidatorUtils; +import com.epmet.dto.form.LatestGridFormDTO; +import com.epmet.dto.result.CustomerGridByUserIdResultDTO; import com.epmet.service.StaffGridVisitedService; 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; @@ -35,5 +41,17 @@ public class StaffGridVisitedController { @Autowired private StaffGridVisitedService staffGridVisitedService; - + + /** + * @Description 查询工作人员上次登录的网格 + * @Param LatestGridFormDTO -> customerId ; staffId + * @return Result + * @Author wangc + * @Date 2020.04.23 10:05 + **/ + @PostMapping("getstafflatestgrid") + Result getStaffLatestGrid(@RequestBody LatestGridFormDTO latestGridFormDTO){ + ValidatorUtils.validateEntity(latestGridFormDTO); + return staffGridVisitedService.getStaffLatestGrid(latestGridFormDTO); + } } \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/StaffGridVisitedDao.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/StaffGridVisitedDao.java index d905202603..6869f1a5bf 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/StaffGridVisitedDao.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/StaffGridVisitedDao.java @@ -18,6 +18,8 @@ package com.epmet.dao; import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.dto.StaffGridVisitedDTO; +import com.epmet.dto.form.LatestGridFormDTO; import com.epmet.entity.StaffGridVisitedEntity; import org.apache.ibatis.annotations.Mapper; @@ -29,5 +31,14 @@ import org.apache.ibatis.annotations.Mapper; */ @Mapper public interface StaffGridVisitedDao extends BaseDao { - + + /** + * @Description 通过staffId和customerId查询当前用户上一次登录的网格信息 + * @Param LatestGridFormDTO + * @return gridId + * @Author wangc + * @Date 2020.04.23 00:40 + **/ + String selectStaffLatestGrid(LatestGridFormDTO latestGridFormDTO); + } \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/StaffGridVisitedService.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/StaffGridVisitedService.java index ce181b1323..d07e4975a2 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/StaffGridVisitedService.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/StaffGridVisitedService.java @@ -19,7 +19,10 @@ 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.StaffGridVisitedDTO; +import com.epmet.dto.form.LatestGridFormDTO; +import com.epmet.dto.result.CustomerGridByUserIdResultDTO; import com.epmet.entity.StaffGridVisitedEntity; import java.util.List; @@ -92,4 +95,13 @@ public interface StaffGridVisitedService extends BaseService staffId ; customerId + * @return Result + * @Author wangc + * @Date 2020.04.23 00:28 + **/ + Result getStaffLatestGrid(LatestGridFormDTO latestGridFormDTO); } \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/StaffGridVisitedServiceImpl.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/StaffGridVisitedServiceImpl.java index 758eb2a840..d4e87cd8d9 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/StaffGridVisitedServiceImpl.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/StaffGridVisitedServiceImpl.java @@ -23,11 +23,21 @@ import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; import com.epmet.commons.tools.constant.FieldConstant; import com.epmet.commons.tools.page.PageData; import com.epmet.commons.tools.utils.ConvertUtils; +import com.epmet.commons.tools.utils.Result; +import com.epmet.constant.GridVisitedConstant; import com.epmet.dao.StaffGridVisitedDao; +import com.epmet.dto.CustomerGridDTO; import com.epmet.dto.StaffGridVisitedDTO; +import com.epmet.dto.form.CustomerGridFormDTO; +import com.epmet.dto.form.LatestGridFormDTO; +import com.epmet.dto.result.CustomerGridByUserIdResultDTO; import com.epmet.entity.StaffGridVisitedEntity; +import com.epmet.feign.GovOrgFeignClient; import com.epmet.service.StaffGridVisitedService; 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; @@ -44,6 +54,12 @@ import java.util.Map; @Service public class StaffGridVisitedServiceImpl extends BaseServiceImpl implements StaffGridVisitedService { + private static final Logger logger = LoggerFactory.getLogger(StaffGridVisitedServiceImpl.class); + + @Autowired + private GovOrgFeignClient govOrgFeignClient; + + @Override public PageData page(Map params) { IPage page = baseDao.selectPage( @@ -96,4 +112,26 @@ public class StaffGridVisitedServiceImpl extends BaseServiceImpl getStaffLatestGrid(LatestGridFormDTO latestGridFormDTO) { + + CustomerGridByUserIdResultDTO gridResult = new CustomerGridByUserIdResultDTO(); + String gridId = baseDao.selectStaffLatestGrid(latestGridFormDTO); + if(StringUtils.isNotBlank(gridId)){ + CustomerGridFormDTO param = new CustomerGridFormDTO(); + param.setGridId(gridId); + Result gridInfoResult = + govOrgFeignClient.getCustomerGridByGridId(param); + if(gridInfoResult.success() && null != gridInfoResult.getData() && StringUtils.isNotBlank(gridInfoResult.getData().getId())){ + gridResult.setAgencyId(gridInfoResult.getData().getPid()); + gridResult.setGridId(gridId); + gridResult.setGridName(gridInfoResult.getData().getGridName()); + }else{ + logger.warn(GridVisitedConstant.QUERY_EXCEPTION); + } + } + + return new Result().ok(gridResult); + } + } \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/resources/mapper/StaffGridVisitedDao.xml b/epmet-user/epmet-user-server/src/main/resources/mapper/StaffGridVisitedDao.xml index 38ce0bff3c..73978e23f3 100644 --- a/epmet-user/epmet-user-server/src/main/resources/mapper/StaffGridVisitedDao.xml +++ b/epmet-user/epmet-user-server/src/main/resources/mapper/StaffGridVisitedDao.xml @@ -16,5 +16,21 @@ + + \ No newline at end of file From 49018cbcc9d647b8e5893d7ab898e45ecd78c538 Mon Sep 17 00:00:00 2001 From: wxz Date: Thu, 23 Apr 2020 12:05:56 +0800 Subject: [PATCH 41/85] =?UTF-8?q?1.StaffRoleController=E5=86=85=E6=96=B9?= =?UTF-8?q?=E6=B3=95=20url=E5=A4=A7=E5=B0=8F=E5=86=99=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/epmet/feign/EpmetUserFeignClient.java | 2 +- .../src/main/java/com/epmet/controller/StaffRoleController.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) 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 f5eebb41b7..7c8e65c647 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 @@ -32,7 +32,7 @@ public interface EpmetUserFeignClient { * 查询工作人员的角色 * @return */ - @PostMapping("/epmetuser/staffrole/staffRoles") + @PostMapping("/epmetuser/staffrole/staffroles") Result> getRolesOfStaff(StaffRoleFormDTO staffRoleFormDTO); } 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 98aacba35d..8e6fcba4ac 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 @@ -35,7 +35,7 @@ public class StaffRoleController { * 根据工作人员查询工作人员具有的角色列表 * @return */ - @PostMapping("staffRoles") + @PostMapping("staffroles") public Result> getRolesOfStaff(@RequestBody StaffRoleFormDTO staffRoleFormDTO) { ValidatorUtils.validateEntity(staffRoleFormDTO); String staffId = staffRoleFormDTO.getStaffId(); From b76bbcde6aa0d570db2ad02093dfa726c61a32ef Mon Sep 17 00:00:00 2001 From: yinzuomei <576302893@qq.com> Date: Thu, 23 Apr 2020 13:34:44 +0800 Subject: [PATCH 42/85] =?UTF-8?q?=E5=88=87=E6=8D=A2=E7=BD=91=E6=A0=BCv1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/epmet/feign/EpmetUserFeignClient.java | 16 +++++++-- .../EpmetUserFeignClientFallback.java | 6 +++- .../service/impl/StaffAgencyServiceImpl.java | 15 +++++++- .../dto/form/StaffGridVisitedFormDTO.java | 34 +++++++++++++++++++ .../StaffGridVisitedController.java | 19 ++++++++++- .../service/StaffGridVisitedService.java | 11 ++++++ .../impl/StaffGridVisitedServiceImpl.java | 10 ++++++ 7 files changed, 105 insertions(+), 6 deletions(-) create mode 100644 epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/StaffGridVisitedFormDTO.java 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 af24c8b644..a4196b9f7d 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 @@ -2,11 +2,12 @@ package com.epmet.feign; import com.epmet.commons.tools.constant.ServiceConstant; import com.epmet.commons.tools.utils.Result; -import com.epmet.dto.result.LatestCustomerResultDTO; +import com.epmet.dto.form.StaffGridVisitedFormDTO; import com.epmet.feign.fallback.EpmetUserFeignClientFallback; import org.springframework.cloud.openfeign.FeignClient; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.http.MediaType; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; /** * @Description @@ -15,4 +16,13 @@ import org.springframework.web.bind.annotation.PathVariable; @FeignClient(name = ServiceConstant.EPMET_USER_SERVER, fallback = EpmetUserFeignClientFallback.class) public interface EpmetUserFeignClient { + /** + * @param staffGridVisitedFormDTO + * @return com.epmet.commons.tools.utils.Result + * @Author yinzuomei + * @Description 保存网格访问记录 + * @Date 2020/4/23 13:27 + **/ + @PostMapping(value = "/epmetuser/staffgridvisited/savestaffgridvisitedrecord", consumes = MediaType.APPLICATION_JSON_UTF8_VALUE) + Result saveStaffGridVisitedRecord(@RequestBody StaffGridVisitedFormDTO staffGridVisitedFormDTO); } diff --git a/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/feign/fallback/EpmetUserFeignClientFallback.java b/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/feign/fallback/EpmetUserFeignClientFallback.java index 5f551bef80..161de27c58 100644 --- a/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/feign/fallback/EpmetUserFeignClientFallback.java +++ b/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/feign/fallback/EpmetUserFeignClientFallback.java @@ -3,7 +3,7 @@ package com.epmet.feign.fallback; import com.epmet.commons.tools.constant.ServiceConstant; import com.epmet.commons.tools.utils.ModuleUtils; import com.epmet.commons.tools.utils.Result; -import com.epmet.dto.result.LatestCustomerResultDTO; +import com.epmet.dto.form.StaffGridVisitedFormDTO; import com.epmet.feign.EpmetUserFeignClient; import org.springframework.stereotype.Component; @@ -14,4 +14,8 @@ import org.springframework.stereotype.Component; @Component public class EpmetUserFeignClientFallback implements EpmetUserFeignClient { + @Override + public Result saveStaffGridVisitedRecord(StaffGridVisitedFormDTO staffGridVisitedFormDTO) { + return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "saveStaffGridVisitedRecord", staffGridVisitedFormDTO); + } } diff --git a/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/service/impl/StaffAgencyServiceImpl.java b/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/service/impl/StaffAgencyServiceImpl.java index 575ab2ef4d..dd2243920b 100644 --- a/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/service/impl/StaffAgencyServiceImpl.java +++ b/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/service/impl/StaffAgencyServiceImpl.java @@ -18,12 +18,17 @@ package com.epmet.service.impl; 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.dto.form.StaffGridVisitedFormDTO; import com.epmet.dto.form.SwitchGridFormDTO; import com.epmet.dto.result.CustomerGridByUserIdResultDTO; import com.epmet.dto.result.LatestCustomerResultDTO; +import com.epmet.feign.EpmetUserFeignClient; import com.epmet.feign.GovOrgFeignClient; import com.epmet.service.StaffAgencyService; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -36,9 +41,11 @@ import java.util.List; */ @Service public class StaffAgencyServiceImpl implements StaffAgencyService { - + private static Logger logger = LoggerFactory.getLogger(StaffAgencyServiceImpl.class); @Autowired private GovOrgFeignClient govOrgFeignClient; + @Autowired + private EpmetUserFeignClient epmetUserFeignClient; /** * @param tokenDTO @@ -60,6 +67,12 @@ public class StaffAgencyServiceImpl implements StaffAgencyService { @Override public Result> switchGrid(SwitchGridFormDTO switchGridFormDTO) { //记录网格访问记录 + StaffGridVisitedFormDTO staffGridVisitedFormDTO = ConvertUtils.sourceToTarget(switchGridFormDTO, StaffGridVisitedFormDTO.class); + Result saveStaffGridVisitedRecord = epmetUserFeignClient.saveStaffGridVisitedRecord(staffGridVisitedFormDTO); + if (!saveStaffGridVisitedRecord.success()) { + logger.error("保存网格访问记录失败"); + return new Result>().error(); + } //查询网格的权限 return new Result<>(); } diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/StaffGridVisitedFormDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/StaffGridVisitedFormDTO.java new file mode 100644 index 0000000000..bdf88528a1 --- /dev/null +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/StaffGridVisitedFormDTO.java @@ -0,0 +1,34 @@ +package com.epmet.dto.form; + +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import java.io.Serializable; + +/** + * @Description 保存网格访问记录入参 + * @Author yinzuomei + * @Date 2020/4/23 11:01 + */ +@Data +public class StaffGridVisitedFormDTO implements Serializable { + private static final long serialVersionUID = 4932900259489068815L; + /** + * 客户ID + */ + @NotBlank(message = "客户id") + private String customerId; + + /** + * 网格ID + */ + @NotBlank(message = "网格id不能为空") + private String gridId; + + /** + * customer_staff.userId + */ + @NotBlank(message = "staffId不能为空") + private String staffId; +} + diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/StaffGridVisitedController.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/StaffGridVisitedController.java index ec34fb21fb..ff4a8a00a9 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/StaffGridVisitedController.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/StaffGridVisitedController.java @@ -17,11 +17,17 @@ package com.epmet.controller; +import com.epmet.commons.tools.utils.Result; +import com.epmet.dto.form.StaffGridVisitedFormDTO; import com.epmet.service.StaffGridVisitedService; 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 javax.validation.Valid; + /** * 工作人员进入网格日志表 @@ -32,8 +38,19 @@ import org.springframework.web.bind.annotation.RestController; @RestController @RequestMapping("staffgridvisited") public class StaffGridVisitedController { - + @Autowired private StaffGridVisitedService staffGridVisitedService; + /** + * @param staffGridVisitedFormDTO + * @return com.epmet.commons.tools.utils.Result + * @Author yinzuomei + * @Description 保存网格访问记录 + * @Date 2020/4/23 11:19 + **/ + @PostMapping("savestaffgridvisitedrecord") + public Result saveStaffGridVisitedRecord(@RequestBody @Valid StaffGridVisitedFormDTO staffGridVisitedFormDTO) { + return staffGridVisitedService.saveStaffGridVisitedRecord(staffGridVisitedFormDTO); + } } \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/StaffGridVisitedService.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/StaffGridVisitedService.java index ce181b1323..86e31b2c3e 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/StaffGridVisitedService.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/StaffGridVisitedService.java @@ -19,7 +19,9 @@ 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.StaffGridVisitedDTO; +import com.epmet.dto.form.StaffGridVisitedFormDTO; import com.epmet.entity.StaffGridVisitedEntity; import java.util.List; @@ -92,4 +94,13 @@ public interface StaffGridVisitedService extends BaseService Date: Thu, 23 Apr 2020 13:39:50 +0800 Subject: [PATCH 43/85] =?UTF-8?q?=E5=86=B2=E7=AA=81=E8=A7=A3=E5=86=B3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/epmet/feign/EpmetUserFeignClient.java | 10 ++++++---- .../com/epmet/service/impl/StaffAgencyServiceImpl.java | 4 ++++ 2 files changed, 10 insertions(+), 4 deletions(-) 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 2e261727b2..287da51fec 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 @@ -2,19 +2,21 @@ package com.epmet.feign; import com.epmet.commons.tools.constant.ServiceConstant; import com.epmet.commons.tools.utils.Result; -import com.epmet.dto.form.StaffGridVisitedFormDTO; +import com.epmet.dto.GovStaffRoleDTO; import com.epmet.dto.form.LatestGridFormDTO; +import com.epmet.dto.form.StaffGridVisitedFormDTO; +import com.epmet.dto.form.StaffRoleFormDTO; import com.epmet.dto.result.CustomerGridByUserIdResultDTO; import com.epmet.dto.result.LatestCustomerResultDTO; import com.epmet.feign.fallback.EpmetUserFeignClientFallback; import org.springframework.cloud.openfeign.FeignClient; import org.springframework.http.MediaType; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PostMapping; -import com.epmet.dto.form.StaffRoleFormDTO; +import org.springframework.web.bind.annotation.RequestBody; + +import java.util.List; /** diff --git a/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/service/impl/StaffAgencyServiceImpl.java b/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/service/impl/StaffAgencyServiceImpl.java index 092debf3c6..c95283acbd 100644 --- a/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/service/impl/StaffAgencyServiceImpl.java +++ b/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/service/impl/StaffAgencyServiceImpl.java @@ -20,12 +20,16 @@ package com.epmet.service.impl; import com.epmet.commons.tools.security.dto.TokenDto; import com.epmet.commons.tools.utils.ConvertUtils; import com.epmet.commons.tools.utils.Result; +import com.epmet.constant.StaffAgencyConstant; +import com.epmet.dto.form.LatestGridFormDTO; import com.epmet.dto.form.StaffGridVisitedFormDTO; import com.epmet.dto.form.SwitchGridFormDTO; import com.epmet.dto.result.CustomerGridByUserIdResultDTO; import com.epmet.dto.result.LatestCustomerResultDTO; +import com.epmet.feign.EpmetUserFeignClient; import com.epmet.feign.GovOrgFeignClient; import com.epmet.service.StaffAgencyService; +import org.apache.commons.lang3.StringUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; From d257127e9c24b28bf46f19b79c7a348ea9725e41 Mon Sep 17 00:00:00 2001 From: yinzuomei <576302893@qq.com> Date: Thu, 23 Apr 2020 14:01:44 +0800 Subject: [PATCH 44/85] =?UTF-8?q?=E5=88=87=E6=8D=A2=E7=BD=91=E6=A0=BCv2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/epmet/dto/form/SwitchGridFormDTO.java | 12 ++++++++++-- .../com/epmet/controller/StaffAgencyController.java | 6 ++++-- .../feign/fallback/GovOrgFeignClientFallBack.java | 5 ----- .../java/com/epmet/service/StaffAgencyService.java | 7 +++---- .../epmet/service/impl/StaffAgencyServiceImpl.java | 12 ++++++++---- 5 files changed, 25 insertions(+), 17 deletions(-) diff --git a/epmet-module/gov-mine/gov-mine-client/src/main/java/com/epmet/dto/form/SwitchGridFormDTO.java b/epmet-module/gov-mine/gov-mine-client/src/main/java/com/epmet/dto/form/SwitchGridFormDTO.java index f9908e24dc..ab0a44d2e6 100644 --- a/epmet-module/gov-mine/gov-mine-client/src/main/java/com/epmet/dto/form/SwitchGridFormDTO.java +++ b/epmet-module/gov-mine/gov-mine-client/src/main/java/com/epmet/dto/form/SwitchGridFormDTO.java @@ -2,6 +2,7 @@ package com.epmet.dto.form; import lombok.Data; +import javax.validation.constraints.NotBlank; import java.io.Serializable; /** @@ -14,14 +15,21 @@ public class SwitchGridFormDTO implements Serializable { private static final long serialVersionUID = -2898130727929596798L; /** - * sessionKey + * customerId */ + @NotBlank(message = "customerId不能为空") private String customerId; /** - * sessionKey + * gridId */ + @NotBlank(message = "gridId不能为空") private String gridId; + /** + * staffId从tokenTto获取 + */ + @NotBlank(message = "staffId不能为空") + private String staffId; } 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 a947fa817b..6a9c00fe60 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 @@ -20,9 +20,9 @@ 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.SwitchGridFormDTO; import com.epmet.commons.tools.validator.ValidatorUtils; import com.epmet.dto.form.LatestGridFormDTO; +import com.epmet.dto.form.SwitchGridFormDTO; import com.epmet.dto.result.CustomerGridByUserIdResultDTO; import com.epmet.dto.result.LatestCustomerResultDTO; import com.epmet.service.StaffAgencyService; @@ -34,6 +34,7 @@ import org.springframework.web.bind.annotation.RestController; import javax.validation.Valid; import java.util.List; +import java.util.Set; /** * 机关单位信息表 @@ -77,7 +78,8 @@ public class StaffAgencyController { * @Date 2020/4/23 10:34 **/ @PostMapping("switchgrid") - public Result> switchGrid(@LoginUser TokenDto tokenDto, @RequestBody @Valid SwitchGridFormDTO switchGridFormDTO) { + public Result> switchGrid(@LoginUser TokenDto tokenDto, @RequestBody @Valid SwitchGridFormDTO switchGridFormDTO) { + switchGridFormDTO.setStaffId(tokenDto.getUserId()); return staffAgencyService.switchGrid(switchGridFormDTO); } /** diff --git a/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/feign/fallback/GovOrgFeignClientFallBack.java b/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/feign/fallback/GovOrgFeignClientFallBack.java index 832c538376..818a325666 100644 --- a/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/feign/fallback/GovOrgFeignClientFallBack.java +++ b/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/feign/fallback/GovOrgFeignClientFallBack.java @@ -23,11 +23,6 @@ public class GovOrgFeignClientFallBack implements GovOrgFeignClient { return ModuleUtils.feignConError(ServiceConstant.GOV_ORG_SERVER, "getMyGrids", userId); } - @Override - public Result getLatestCustomer(String userId) { - return null; - } - @Override public Result getStaffGrid(LatestGridFormDTO latestGridFormDTO) { return ModuleUtils.feignConError(ServiceConstant.GOV_ORG_SERVER, "getStaffGrid",latestGridFormDTO); diff --git a/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/service/StaffAgencyService.java b/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/service/StaffAgencyService.java index cc45335509..fb87fd96ec 100644 --- a/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/service/StaffAgencyService.java +++ b/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/service/StaffAgencyService.java @@ -17,16 +17,15 @@ package com.epmet.service; -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.SwitchGridFormDTO; import com.epmet.dto.form.LatestGridFormDTO; +import com.epmet.dto.form.SwitchGridFormDTO; import com.epmet.dto.result.CustomerGridByUserIdResultDTO; import com.epmet.dto.result.LatestCustomerResultDTO; -import org.springframework.web.bind.annotation.RequestBody; import java.util.List; +import java.util.Set; /** * 机关单位信息表 @@ -58,7 +57,7 @@ public interface StaffAgencyService { * @Description 切换网格 * @Date 2020/4/23 10:49 **/ - Result> switchGrid(SwitchGridFormDTO switchGridFormDTO); + Result> switchGrid(SwitchGridFormDTO switchGridFormDTO); /** * @Description 得到工作人员最后一次登录的网格 diff --git a/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/service/impl/StaffAgencyServiceImpl.java b/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/service/impl/StaffAgencyServiceImpl.java index c95283acbd..1be3e976c2 100644 --- a/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/service/impl/StaffAgencyServiceImpl.java +++ b/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/service/impl/StaffAgencyServiceImpl.java @@ -28,6 +28,7 @@ import com.epmet.dto.result.CustomerGridByUserIdResultDTO; import com.epmet.dto.result.LatestCustomerResultDTO; import com.epmet.feign.EpmetUserFeignClient; import com.epmet.feign.GovOrgFeignClient; +import com.epmet.service.AccessService; import com.epmet.service.StaffAgencyService; import org.apache.commons.lang3.StringUtils; import org.slf4j.Logger; @@ -36,6 +37,7 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import java.util.List; +import java.util.Set; /** * 机关单位信息表 @@ -49,7 +51,8 @@ public class StaffAgencyServiceImpl implements StaffAgencyService { private GovOrgFeignClient govOrgFeignClient; @Autowired private EpmetUserFeignClient epmetUserFeignClient; - + @Autowired + private AccessService accessService; /** * @param tokenDTO * @return @@ -91,16 +94,17 @@ public class StaffAgencyServiceImpl implements StaffAgencyService { @Override - public Result> switchGrid(SwitchGridFormDTO switchGridFormDTO) { + public Result> switchGrid(SwitchGridFormDTO switchGridFormDTO) { //记录网格访问记录 StaffGridVisitedFormDTO staffGridVisitedFormDTO = ConvertUtils.sourceToTarget(switchGridFormDTO, StaffGridVisitedFormDTO.class); Result saveStaffGridVisitedRecord = epmetUserFeignClient.saveStaffGridVisitedRecord(staffGridVisitedFormDTO); if (!saveStaffGridVisitedRecord.success()) { logger.error("保存网格访问记录失败"); - return new Result>().error(); + return new Result>().error(); } //查询网格的权限 - return new Result<>(); + Set opeKeys = accessService.listOpeKeysByStaffId(switchGridFormDTO.getStaffId(), null, switchGridFormDTO.getGridId()); + return new Result>().ok(opeKeys); } From 99c0d0e0cab48e7e30bca2256ebac43b96ca1e50 Mon Sep 17 00:00:00 2001 From: sunyuchao Date: Thu, 23 Apr 2020 15:04:03 +0800 Subject: [PATCH 45/85] =?UTF-8?q?=E6=94=BF=E5=BA=9C=E7=AB=AF-=E7=BB=84?= =?UTF-8?q?=E7=BB=87=E6=9C=BA=E6=9E=84=E6=A8=A1=E5=9D=97-=E9=83=A8?= =?UTF-8?q?=E9=97=A8=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/epmet/dto/form/AddAgencyFormDTO.java | 78 ++++++++++ .../epmet/dto/form/AgencydetailFormDTO.java | 43 ++++++ .../com/epmet/dto/form/EditAgencyFormDTO.java | 48 ++++++ .../epmet/dto/form/RemoveAgencyFormDTO.java | 42 ++++++ .../com/epmet/dto/form/SubAgencyFormDTO.java | 43 ++++++ .../epmet/dto/result/AddAgencyResultDTO.java | 40 +++++ .../dto/result/AgencydetailResultDTO.java | 82 +++++++++++ .../epmet/dto/result/ParentListResultDTO.java | 46 ++++++ .../epmet/dto/result/SubAgencyResultDTO.java | 48 ++++++ .../epmet/dto/result/SubListResultDTO.java | 45 ++++++ .../constant/CustomerAgencyConstant.java | 25 ++++ .../controller/CustomerAgencyController.java | 77 ++++++++-- .../java/com/epmet/dao/CustomerAgencyDao.java | 18 +++ .../epmet/service/CustomerAgencyService.java | 45 +++++- .../impl/CustomerAgencyServiceImpl.java | 138 +++++++++++++++++- .../resources/mapper/CustomerAgencyDao.xml | 22 +++ 16 files changed, 826 insertions(+), 14 deletions(-) create mode 100644 epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/AddAgencyFormDTO.java create mode 100644 epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/AgencydetailFormDTO.java create mode 100644 epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/EditAgencyFormDTO.java create mode 100644 epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/RemoveAgencyFormDTO.java create mode 100644 epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/SubAgencyFormDTO.java create mode 100644 epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/AddAgencyResultDTO.java create mode 100644 epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/AgencydetailResultDTO.java create mode 100644 epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/ParentListResultDTO.java create mode 100644 epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/SubAgencyResultDTO.java create mode 100644 epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/SubListResultDTO.java create mode 100644 epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/constant/CustomerAgencyConstant.java diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/AddAgencyFormDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/AddAgencyFormDTO.java new file mode 100644 index 0000000000..57c2e2939d --- /dev/null +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/AddAgencyFormDTO.java @@ -0,0 +1,78 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

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

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

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.dto.form; + +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import java.io.Serializable; + + +/** + * 添加组织-接口入参 + * + * @author sun + */ +@Data +public class AddAgencyFormDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 上级机关组织Id(当前机关组织添加下级组织) + */ + @NotBlank(message = "上级机关组织ID不能为空") + private String pid; + + /** + * 机构组织名称 + */ + @NotBlank(message = "组织名称不能为空") + private String agencyName; + + /** + * 机关级别(社区级:community, + * 乡(镇、街道)级:street, + * 区县级: district, + * 市级: city + * 省级:province) 机关级别(社区级:community,乡(镇、街道)级:street,区县级: district,市级: city省级:province) + */ + private String level; + + /** + * 地区编码 + */ + private Integer areaCode; + + /** + * 国家 + */ + private String country; + + /** + * 省份 + */ + private String province; + + /** + * 城市 + */ + private String city; + + +} \ No newline at end of file diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/AgencydetailFormDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/AgencydetailFormDTO.java new file mode 100644 index 0000000000..0f3b999026 --- /dev/null +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/AgencydetailFormDTO.java @@ -0,0 +1,43 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

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

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

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.dto.form; + +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import java.io.Serializable; + + +/** + * 组织首页-获取组织机构信息接口入参 + * + * @author sun + */ +@Data +public class AgencydetailFormDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 机关组织Id + */ + @NotBlank(message = "机关组织ID不能为空") + private String agencyId; + + +} \ No newline at end of file diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/EditAgencyFormDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/EditAgencyFormDTO.java new file mode 100644 index 0000000000..e4a410120e --- /dev/null +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/EditAgencyFormDTO.java @@ -0,0 +1,48 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

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

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

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.dto.form; + +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import java.io.Serializable; + + +/** + * 组织名称编辑-接口入参 + * + * @author sun + */ +@Data +public class EditAgencyFormDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 机关组织Id + */ + @NotBlank(message = "机关组织ID不能为空") + private String agencyId; + + /** + * 机关组织名称 + */ + @NotBlank(message = "机关组织名称不能为空") + private String agencyName; + +} \ No newline at end of file diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/RemoveAgencyFormDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/RemoveAgencyFormDTO.java new file mode 100644 index 0000000000..5caaec7ea5 --- /dev/null +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/RemoveAgencyFormDTO.java @@ -0,0 +1,42 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

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

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

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.dto.form; + +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import java.io.Serializable; + + +/** + * 删除组织机关-接口入参 + * + * @author sun + */ +@Data +public class RemoveAgencyFormDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 机关组织Id + */ + @NotBlank(message = "机关组织ID不能为空") + private String agencyId; + +} \ No newline at end of file diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/SubAgencyFormDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/SubAgencyFormDTO.java new file mode 100644 index 0000000000..6cdf21a193 --- /dev/null +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/SubAgencyFormDTO.java @@ -0,0 +1,43 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

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

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

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.dto.form; + +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import java.io.Serializable; + + +/** + * 组织首页-下级机关列表-接口入参 + * + * @author sun + */ +@Data +public class SubAgencyFormDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 机关组织Id + */ + @NotBlank(message = "机关组织ID不能为空") + private String agencyId; + + +} \ No newline at end of file diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/AddAgencyResultDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/AddAgencyResultDTO.java new file mode 100644 index 0000000000..01f072752a --- /dev/null +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/AddAgencyResultDTO.java @@ -0,0 +1,40 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

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

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

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.dto.result; + +import lombok.Data; + +import java.io.Serializable; + + +/** + * 添加组织-接口返参 + * + * @author sun + */ +@Data +public class AddAgencyResultDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 机关组织Id + */ + private String agencyId; + +} \ No newline at end of file diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/AgencydetailResultDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/AgencydetailResultDTO.java new file mode 100644 index 0000000000..4fed7005d9 --- /dev/null +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/AgencydetailResultDTO.java @@ -0,0 +1,82 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

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

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

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.dto.result; + +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import java.io.Serializable; +import java.util.List; + + +/** + * 组织首页-获取组织机构信息接口返参 + * + * @author sun + */ +@Data +public class AgencydetailResultDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 机关组织Id + */ + private String agencyId; + + /** + * 组织名称 + */ + private String agencyName; + + /** + * 机关级别(社区级:community, + * 乡(镇、街道)级:street, + * 区县级: district, + * 市级: city + * 省级:province) 机关级别(社区级:community,乡(镇、街道)级:street,区县级: district,市级: city省级:province) + */ + private String level; + + /** + * 地区编码 + */ + private Integer areaCode; + + /** + * 国家 + */ + private String country; + + /** + * 省份 + */ + private String province; + + /** + * 城市 + */ + private String city; + + /** + * 本机关的所有上级机关 + */ + private List parentList; + + +} \ No newline at end of file diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/ParentListResultDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/ParentListResultDTO.java new file mode 100644 index 0000000000..73608b1943 --- /dev/null +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/ParentListResultDTO.java @@ -0,0 +1,46 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

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

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

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.dto.result; + +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import java.io.Serializable; + + +/** + * 组织首页-获取组织机构信息接口-本机关的所有上级机关信息 + * + * @author sun + */ +@Data +public class ParentListResultDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 机关组织Id + */ + private String id; + /** + * 机关组织名称 + */ + private String name; + + +} \ No newline at end of file diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/SubAgencyResultDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/SubAgencyResultDTO.java new file mode 100644 index 0000000000..ea9810c94c --- /dev/null +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/SubAgencyResultDTO.java @@ -0,0 +1,48 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

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

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

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.dto.result; + +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import java.io.Serializable; +import java.util.List; + + +/** + * 组织首页-下级机关列表-接口返参 + * + * @author sun + */ +@Data +public class SubAgencyResultDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 下级机关总数 + */ + private Integer subAgencyCount; + + /** + * 下级机关总数 + */ + private List agencyList; + + +} \ No newline at end of file diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/SubListResultDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/SubListResultDTO.java new file mode 100644 index 0000000000..57ab12c3df --- /dev/null +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/SubListResultDTO.java @@ -0,0 +1,45 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

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

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

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.dto.result; + +import lombok.Data; + +import java.io.Serializable; + + +/** + * 组织首页-下级机关列表-查询本机关的直属下一级机关 + * + * @author sun + */ +@Data +public class SubListResultDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 机关组织Id + */ + private String agencyId; + /** + * 机关组织名称 + */ + private String agencyName; + + +} \ No newline at end of file diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/constant/CustomerAgencyConstant.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/constant/CustomerAgencyConstant.java new file mode 100644 index 0000000000..42d40b0199 --- /dev/null +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/constant/CustomerAgencyConstant.java @@ -0,0 +1,25 @@ +package com.epmet.constant; + +/** + * @author sun + * @dscription + */ +public interface CustomerAgencyConstant { + + /** + * 组织名称编辑修改失败 + */ + String UPDATE_EXCEPTION = "组织机构信息更新失败"; + /** + * 添加组织失败 + */ + String SAVE_EXCEPTION = "组织机构新增失败"; + /** + * 不允许删除组织 + */ + String NOT_DEL_AGENCY = "当前组织存在下级组织,不允许删除"; + /** + * 组织删除失败 + */ + String DEL_EXCEPTION = "组织删除失败"; +} diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/CustomerAgencyController.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/CustomerAgencyController.java index a1e5ea58fe..9caad715cc 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/CustomerAgencyController.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/CustomerAgencyController.java @@ -26,8 +26,11 @@ import com.epmet.commons.tools.validator.group.AddGroup; import com.epmet.commons.tools.validator.group.DefaultGroup; import com.epmet.commons.tools.validator.group.UpdateGroup; import com.epmet.dto.CustomerAgencyDTO; -import com.epmet.dto.form.StaffOrgFormDTO; +import com.epmet.dto.form.*; +import com.epmet.dto.result.AddAgencyResultDTO; +import com.epmet.dto.result.AgencydetailResultDTO; import com.epmet.dto.result.StaffOrgsResultDTO; +import com.epmet.dto.result.SubAgencyResultDTO; import com.epmet.excel.CustomerAgencyExcel; import com.epmet.service.CustomerAgencyService; import org.springframework.beans.factory.annotation.Autowired; @@ -47,24 +50,24 @@ import java.util.Map; @RestController @RequestMapping("customeragency") public class CustomerAgencyController { - + @Autowired private CustomerAgencyService customerAgencyService; @GetMapping("page") - public Result> page(@RequestParam Map params){ + public Result> page(@RequestParam Map params) { PageData page = customerAgencyService.page(params); return new Result>().ok(page); } @GetMapping("{id}") - public Result get(@PathVariable("id") String id){ + public Result get(@PathVariable("id") String id) { CustomerAgencyDTO data = customerAgencyService.get(id); return new Result().ok(data); } @PostMapping - public Result save(@RequestBody CustomerAgencyDTO dto){ + public Result save(@RequestBody CustomerAgencyDTO dto) { //效验数据 ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class); customerAgencyService.save(dto); @@ -72,7 +75,7 @@ public class CustomerAgencyController { } @PutMapping - public Result update(@RequestBody CustomerAgencyDTO dto){ + public Result update(@RequestBody CustomerAgencyDTO dto) { //效验数据 ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class); customerAgencyService.update(dto); @@ -80,7 +83,7 @@ public class CustomerAgencyController { } @DeleteMapping - public Result delete(@RequestBody String[] ids){ + public Result delete(@RequestBody String[] ids) { //效验数据 AssertUtils.isArrayEmpty(ids, "id"); customerAgencyService.delete(ids); @@ -94,14 +97,70 @@ public class CustomerAgencyController { } /** - * @return com.epmet.commons.tools.utils.Result> * @param staffOrgsFormDTO + * @return com.epmet.commons.tools.utils.Result> * @Author yinzuomei * @Description 登录-获取工作人员所有组织 * @Date 2020/4/20 21:59 **/ @PostMapping("getStaffOrgList") - public Result> getStaffOrgList(@RequestBody StaffOrgFormDTO staffOrgsFormDTO){ + public Result> getStaffOrgList(@RequestBody StaffOrgFormDTO staffOrgsFormDTO) { return customerAgencyService.getStaffOrgList(staffOrgsFormDTO); } + + /** + * @param formDTO + * @return + * @Author sun + * @Description 添加组织 + */ + @PostMapping("addagency") + public Result addAgency(@RequestBody AddAgencyFormDTO formDTO) { + return customerAgencyService.addAgency(formDTO); + } + + /** + * @param formDTO + * @return + * @Author sun + * @Description 组织名称编辑 + */ + @PostMapping("editagency") + public Result editAgency(@RequestBody EditAgencyFormDTO formDTO) { + return customerAgencyService.editAgency(formDTO); + } + + /** + * @param formDTO + * @return + * @Author sun + * @Description 删除组织机关 + */ + @PostMapping("removeagency") + public Result removeAgency(@RequestBody RemoveAgencyFormDTO formDTO) { + return customerAgencyService.removeAgency(formDTO); + } + + /** + * @param formDTO + * @return + * @Author sun + * @Description 组织首页-获取组织机构信息 + */ + @PostMapping("agencydetail") + public Result agencyDetail(@RequestBody AgencydetailFormDTO formDTO) { + return customerAgencyService.agencyDetail(formDTO); + } + + /** + * @param formDTO + * @return + * @Author sun + * @Description 组织首页-下级机关列表 + */ + @PostMapping("subagencylist") + public Result subAgencyList(@RequestBody SubAgencyFormDTO formDTO) { + return customerAgencyService.subAgencyList(formDTO); + } + } \ No newline at end of file diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerAgencyDao.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerAgencyDao.java index 4f85e09091..0dc66e7bdd 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerAgencyDao.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerAgencyDao.java @@ -18,7 +18,9 @@ package com.epmet.dao; import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.dto.result.ParentListResultDTO; import com.epmet.dto.result.StaffOrgsResultDTO; +import com.epmet.dto.result.SubListResultDTO; import com.epmet.entity.CustomerAgencyEntity; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; @@ -41,4 +43,20 @@ public interface CustomerAgencyDao extends BaseDao { * @Date 2020/4/20 21:48 **/ List selectStaffOrgList(@Param("customerIdList") List customerIdList); + + /** + * @param listStr + * @return + * @Author sun + * @Description 查询当前机关的所有上级组织信息 + **/ + List selectPAgencyById(@Param("listStr") List listStr); + + /** + * @param pId + * @return + * @Author sun + * @Description 组织首页-下级机关列表 + **/ + List selectSubAgencyById(@Param("pId") String pId); } \ No newline at end of file diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/CustomerAgencyService.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/CustomerAgencyService.java index 62892b4576..7076fe6d2d 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/CustomerAgencyService.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/CustomerAgencyService.java @@ -21,8 +21,11 @@ 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.CustomerAgencyDTO; -import com.epmet.dto.form.StaffOrgFormDTO; +import com.epmet.dto.form.*; +import com.epmet.dto.result.AddAgencyResultDTO; +import com.epmet.dto.result.AgencydetailResultDTO; import com.epmet.dto.result.StaffOrgsResultDTO; +import com.epmet.dto.result.SubAgencyResultDTO; import com.epmet.entity.CustomerAgencyEntity; import java.util.List; @@ -104,4 +107,44 @@ public interface CustomerAgencyService extends BaseService * @Date 2020/4/20 21:45 **/ Result> getStaffOrgList(StaffOrgFormDTO staffOrgsFormDTO); + + /** + * @param formDTO + * @return + * @Author sun + * @Description 添加组织 + */ + Result addAgency(AddAgencyFormDTO formDTO); + + /** + * @param formDTO + * @return + * @Author sun + * @Description 组织名称编辑 + */ + Result editAgency(EditAgencyFormDTO formDTO); + + /** + * @param formDTO + * @return + * @Author sun + * @Description 删除组织机关 + */ + Result removeAgency(RemoveAgencyFormDTO formDTO); + + /** + * @param formDTO + * @return + * @Author sun + * @Description 组织首页-获取组织机构信息 + */ + Result agencyDetail(AgencydetailFormDTO formDTO); + + /** + * @param formDTO + * @return + * @Author sun + * @Description 组织首页-下级机关列表 + */ + Result subAgencyList(SubAgencyFormDTO formDTO); } \ No newline at end of file diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerAgencyServiceImpl.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerAgencyServiceImpl.java index 2a2b79a024..4d17f1a674 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerAgencyServiceImpl.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerAgencyServiceImpl.java @@ -21,21 +21,27 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; import com.epmet.commons.tools.constant.FieldConstant; +import com.epmet.commons.tools.constant.NumConstant; +import com.epmet.commons.tools.exception.RenException; import com.epmet.commons.tools.page.PageData; import com.epmet.commons.tools.utils.ConvertUtils; import com.epmet.commons.tools.utils.Result; +import com.epmet.constant.CustomerAgencyConstant; import com.epmet.dao.CustomerAgencyDao; import com.epmet.dto.CustomerAgencyDTO; -import com.epmet.dto.form.StaffOrgFormDTO; -import com.epmet.dto.result.StaffOrgsResultDTO; +import com.epmet.dto.form.*; +import com.epmet.dto.result.*; import com.epmet.entity.CustomerAgencyEntity; import com.epmet.redis.CustomerAgencyRedis; import com.epmet.service.CustomerAgencyService; 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.ArrayList; import java.util.Arrays; import java.util.List; import java.util.Map; @@ -49,6 +55,7 @@ import java.util.Map; @Service public class CustomerAgencyServiceImpl extends BaseServiceImpl implements CustomerAgencyService { + private static final Logger log = LoggerFactory.getLogger(CustomerAgencyServiceImpl.class); @Autowired private CustomerAgencyRedis customerAgencyRedis; @@ -68,8 +75,8 @@ public class CustomerAgencyServiceImpl extends BaseServiceImpl getWrapper(Map params){ - String id = (String)params.get(FieldConstant.ID_HUMP); + private QueryWrapper getWrapper(Map params) { + String id = (String) params.get(FieldConstant.ID_HUMP); QueryWrapper wrapper = new QueryWrapper<>(); wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id); @@ -112,4 +119,127 @@ public class CustomerAgencyServiceImpl extends BaseServiceImpl list = baseDao.selectStaffOrgList(staffOrgsFormDTO.getCustomerIdList()); return new Result>().ok(list); } + + /** + * @param formDTO + * @return + * @Author sun + * @Description 添加组织 + */ + @Override + @Transactional(rollbackFor = Exception.class) + public Result addAgency(AddAgencyFormDTO formDTO) { + Result result = new Result(); + AddAgencyResultDTO addAgencyResultDTO = new AddAgencyResultDTO(); + //0:属性映射赋值 + CustomerAgencyEntity entity = ConvertUtils.sourceToTarget(formDTO, CustomerAgencyEntity.class); + entity.setOrganizationName(formDTO.getAgencyName()); + entity.setTotalUser(NumConstant.ZERO); + //1:查询上级机关信息 + CustomerAgencyEntity parentEntity = baseDao.selectById(formDTO.getPid()); + entity.setCustomerId(parentEntity.getCustomerId()); + if (null == parentEntity.getPid()) { + entity.setPids(parentEntity.getId()); + entity.setAllParentName(parentEntity.getOrganizationName()); + } else { + entity.setPids(":" + parentEntity.getId()); + entity.setAllParentName("-" + parentEntity.getOrganizationName()); + } + //2:保存组织信息 + if (baseDao.insert(entity) < NumConstant.ONE) { + log.error(CustomerAgencyConstant.SAVE_EXCEPTION); + throw new RenException(CustomerAgencyConstant.SAVE_EXCEPTION); + } + //3:返回新组织Id + addAgencyResultDTO.setAgencyId(entity.getId()); + return result.ok(addAgencyResultDTO); + } + + /** + * @param formDTO + * @return + * @Author sun + * @Description 组织名称编辑 + */ + @Override + @Transactional(rollbackFor = Exception.class) + public Result editAgency(EditAgencyFormDTO formDTO) { + Result result = new Result(); + CustomerAgencyEntity entity = new CustomerAgencyEntity(); + entity.setId(formDTO.getAgencyId()); + entity.setOrganizationName(formDTO.getAgencyName()); + if (baseDao.updateById(entity) < NumConstant.ONE) { + log.error(CustomerAgencyConstant.UPDATE_EXCEPTION); + throw new RenException(CustomerAgencyConstant.UPDATE_EXCEPTION); + } + return result; + } + + /** + * @param formDTO + * @return + * @Author sun + * @Description 删除组织机关 + */ + @Override + @Transactional(rollbackFor = Exception.class) + public Result removeAgency(RemoveAgencyFormDTO formDTO) { + Result result = new Result(); + //1:查询当前机关是否存在所属下级机关,存在下级的不能删除 + List agencyList = baseDao.selectSubAgencyById(formDTO.getAgencyId()); + if (null != agencyList && agencyList.size() > NumConstant.ZERO) { + result.setMsg(CustomerAgencyConstant.NOT_DEL_AGENCY); + return result; + } + //2:删除当前机关组织(逻辑删) + if (baseDao.deleteById(formDTO.getAgencyId()) < NumConstant.ONE) { + log.error(CustomerAgencyConstant.DEL_EXCEPTION); + throw new RenException(CustomerAgencyConstant.DEL_EXCEPTION); + } + return result; + } + + /** + * @param formDTO + * @return + * @Author sun + * @Description 组织首页-获取组织机构信息 + */ + @Override + public Result agencyDetail(AgencydetailFormDTO formDTO) { + AgencydetailResultDTO agencydetailResultDTO = new AgencydetailResultDTO(); + //1:查询本机关详细信息 + CustomerAgencyEntity entity = baseDao.selectById(formDTO.getAgencyId()); + if (null == entity) { + return new Result().ok(agencydetailResultDTO); + } + agencydetailResultDTO = ConvertUtils.sourceToTarget(entity, AgencydetailResultDTO.class); + agencydetailResultDTO.setAgencyId(entity.getId()); + agencydetailResultDTO.setAgencyName(entity.getOrganizationName()); + //2:查询本机关的所有上级机关,按自上而下层级顺序 + if (null == entity.getPids()) { + return new Result().ok(agencydetailResultDTO); + } + List listStr = Arrays.asList(entity.getPids().split(":")); + List parentList = baseDao.selectPAgencyById(listStr); + agencydetailResultDTO.setParentList(parentList); + return new Result().ok(agencydetailResultDTO); + } + + /** + * @param formDTO + * @return + * @Author sun + * @Description 组织首页-下级机关列表 + */ + @Override + public Result subAgencyList(SubAgencyFormDTO formDTO) { + SubAgencyResultDTO subAgencyResultDTO = new SubAgencyResultDTO(); + //1:根据当前机关Id查询直属下一级机关列表 + List agencyList = baseDao.selectSubAgencyById(formDTO.getAgencyId()); + subAgencyResultDTO.setAgencyList(agencyList); + //2:统计下一级机关数 + subAgencyResultDTO.setSubAgencyCount(agencyList.size()); + return new Result().ok(subAgencyResultDTO); + } } \ No newline at end of file diff --git a/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerAgencyDao.xml b/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerAgencyDao.xml index 03f2671806..a80b7334c4 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerAgencyDao.xml +++ b/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerAgencyDao.xml @@ -37,4 +37,26 @@ #{customerId} + + + + \ No newline at end of file From 61bec2dc5b250a221c8a23064d0c0b75d2a27d4b Mon Sep 17 00:00:00 2001 From: wxz Date: Thu, 23 Apr 2020 15:31:35 +0800 Subject: [PATCH 46/85] =?UTF-8?q?1.=20=E6=96=B0=E5=A2=9E=EF=BC=9A=E6=9F=A5?= =?UTF-8?q?=E8=AF=A2=E8=A7=92=E8=89=B2=E4=B8=8B=E7=9A=84=E7=94=A8=E6=88=B7?= =?UTF-8?q?=E5=88=97=E8=A1=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/epmet/dto/form/StaffRoleFormDTO.java | 22 ++++++++++++++++--- .../epmet/controller/StaffRoleController.java | 19 +++++++++++++--- .../java/com/epmet/dao/GovStaffRoleDao.java | 15 +++++++++++++ .../epmet/service/GovStaffRoleService.java | 8 +++++++ .../service/impl/GovStaffRoleServiceImpl.java | 11 ++++++++++ .../main/resources/mapper/GovStaffRoleDao.xml | 13 +++++++++++ 6 files changed, 82 insertions(+), 6 deletions(-) diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/StaffRoleFormDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/StaffRoleFormDTO.java index ac116b4a4f..02ffc22867 100644 --- a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/StaffRoleFormDTO.java +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/StaffRoleFormDTO.java @@ -7,12 +7,28 @@ import javax.validation.constraints.NotBlank; @Data public class StaffRoleFormDTO { - @NotBlank(message = "工作人员ID不能为空") + /**===========校验分组开始============*/ + + // 查询工作人员角色列表group + public interface GetRolesOfStaff {} + + // 查询某角色下的人员列表group + public interface GetStaffsInRole {} + + /**===========校验分组结束============*/ + + @NotBlank(message = "工作人员ID不能为空", groups = {GetRolesOfStaff.class}) private String staffId; /** - * 机构id,可以是agencyId,DeptId,GridId + * 组织id,可以是agencyId,DeptId,GridId */ - @NotBlank(message = "工作人员所属组织ID不能为空") + @NotBlank(message = "工作人员所属组织ID不能为空", groups = {GetRolesOfStaff.class, GetStaffsInRole.class}) private String orgId; + + /** + * 角色key + */ + @NotBlank(message = "角色Key不能为空", groups = {GetStaffsInRole.class}) + private String roleKey; } 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 8e6fcba4ac..73a94b7740 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,7 +3,6 @@ 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.StaffRoleDTO; import com.epmet.dto.form.StaffRoleFormDTO; import com.epmet.entity.GovStaffRoleEntity; import com.epmet.service.GovStaffRoleService; @@ -32,12 +31,12 @@ public class StaffRoleController { private GovStaffRoleService govStaffRoleService; /** - * 根据工作人员查询工作人员具有的角色列表 + * 查询工作人员具有的角色列表 * @return */ @PostMapping("staffroles") public Result> getRolesOfStaff(@RequestBody StaffRoleFormDTO staffRoleFormDTO) { - ValidatorUtils.validateEntity(staffRoleFormDTO); + ValidatorUtils.validateEntity(staffRoleFormDTO, StaffRoleFormDTO.GetRolesOfStaff.class); String staffId = staffRoleFormDTO.getStaffId(); String orgId = staffRoleFormDTO.getOrgId(); List staffRoleEntities = govStaffRoleService.listRolesByStaffId(staffId, orgId); @@ -50,4 +49,18 @@ public class StaffRoleController { return new Result>().ok(staffRoleDTOS); } + /** + * 查询拥有指定角色的用户列表 + * @param staffRoleFormDTO + * @return + */ + @PostMapping("staffsinrole") + public Result> getStaffsInRole(@RequestBody StaffRoleFormDTO staffRoleFormDTO) { + ValidatorUtils.validateEntity(staffRoleFormDTO, StaffRoleFormDTO.GetStaffsInRole.class); + String roleKey = staffRoleFormDTO.getRoleKey(); + String orgId = staffRoleFormDTO.getOrgId(); + List roleDTOS = govStaffRoleService.listStaffsInRole(roleKey, orgId); + return new Result>().ok(roleDTOS); + } + } diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/GovStaffRoleDao.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/GovStaffRoleDao.java index 8967f79733..fa244dce1c 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/GovStaffRoleDao.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/GovStaffRoleDao.java @@ -18,6 +18,7 @@ package com.epmet.dao; import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.dto.GovStaffRoleDTO; import com.epmet.entity.GovStaffRoleEntity; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; @@ -33,5 +34,19 @@ import java.util.List; @Mapper public interface GovStaffRoleDao extends BaseDao { + /** + * 根据staffId查询具有的角色列表 + * @param staffId + * @param orgId + * @return + */ List listRolesByStaffId(@Param("staffId") String staffId, @Param("orgId") String orgId); + + /** + * 查询具有某角色的staff列表 + * @param roleKey + * @param orgId + * @return + */ + List listStaffsByRoleKeyAndOrgId(@Param("roleKey") String roleKey, @Param("orgId") String orgId); } \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/GovStaffRoleService.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/GovStaffRoleService.java index 942a001921..8de688b50b 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/GovStaffRoleService.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/GovStaffRoleService.java @@ -99,4 +99,12 @@ public interface GovStaffRoleService extends BaseService { * @return */ List listRolesByStaffId(String staffId, String orgId); + + /** + * 查询具有某角色的staff列表 + * @param roleKey + * @param orgId + * @return + */ + List listStaffsInRole(String roleKey, String orgId); } \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/GovStaffRoleServiceImpl.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/GovStaffRoleServiceImpl.java index fac6d94901..b0249006aa 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/GovStaffRoleServiceImpl.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/GovStaffRoleServiceImpl.java @@ -111,4 +111,15 @@ public class GovStaffRoleServiceImpl extends BaseServiceImpl listStaffsInRole(String roleKey, String orgId) { + return baseDao.listStaffsByRoleKeyAndOrgId(roleKey, orgId); + } + } \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/resources/mapper/GovStaffRoleDao.xml b/epmet-user/epmet-user-server/src/main/resources/mapper/GovStaffRoleDao.xml index 95949edd10..e2b1d6fe7e 100644 --- a/epmet-user/epmet-user-server/src/main/resources/mapper/GovStaffRoleDao.xml +++ b/epmet-user/epmet-user-server/src/main/resources/mapper/GovStaffRoleDao.xml @@ -17,6 +17,7 @@ + + + + \ No newline at end of file From 66c36c29911ed71e53f17d963f3c15727de351fe Mon Sep 17 00:00:00 2001 From: zxc <954985705@qq.com> Date: Thu, 23 Apr 2020 15:34:04 +0800 Subject: [PATCH 47/85] =?UTF-8?q?=E8=8E=B7=E5=8F=96=E7=BD=91=E6=A0=BC?= =?UTF-8?q?=E8=AF=A6=E6=83=85=E6=8E=A5=E5=8F=A3=E6=B7=BB=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/epmet/dto/StaffGridListDTO.java | 34 ++++++++++ .../epmet/dto/result/GridDetailResultDTO.java | 68 +++++++++++++++++++ .../com/epmet/controller/GridController.java | 36 ++++++++++ .../java/com/epmet/dao/CustomerGridDao.java | 17 +++++ .../com/epmet/feign/EpmetUserFeignClient.java | 14 ++-- .../EpmetUserFeignClientFallBack.java | 23 +++++++ .../EpmetUserFeignClientFallback.java | 24 ++++--- .../epmet/service/CustomerGridService.java | 8 +++ .../service/impl/CustomerGridServiceImpl.java | 15 ++++ .../main/resources/mapper/CustomerGridDao.xml | 30 ++++++++ .../controller/CustomerStaffController.java | 14 ++++ .../java/com/epmet/dao/CustomerStaffDao.java | 9 +++ .../epmet/service/CustomerStaffService.java | 10 +++ .../impl/CustomerStaffServiceImpl.java | 9 +++ .../resources/mapper/CustomerStaffDao.xml | 18 +++++ 15 files changed, 316 insertions(+), 13 deletions(-) create mode 100644 epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/StaffGridListDTO.java create mode 100644 epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/GridDetailResultDTO.java create mode 100644 epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/GridController.java create mode 100644 epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/feign/fallback/EpmetUserFeignClientFallBack.java diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/StaffGridListDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/StaffGridListDTO.java new file mode 100644 index 0000000000..dc25ece228 --- /dev/null +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/StaffGridListDTO.java @@ -0,0 +1,34 @@ +package com.epmet.dto; + +import lombok.Data; + +/** + * @Auther zxc + * @Create 2020-04-23 10:38 + */ +@Data +public class StaffGridListDTO { + + private static final long serialVersionUID = 1L; + + /** + * 用户id + */ + private String staffId; + + /** + * 用户姓名 + */ + private String staffName; + + /** + * 用户头像 + */ + private String staffHeadPhoto; + + /** + * 角色名称 + */ + private String roleName; + +} diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/GridDetailResultDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/GridDetailResultDTO.java new file mode 100644 index 0000000000..f822ea7773 --- /dev/null +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/GridDetailResultDTO.java @@ -0,0 +1,68 @@ +package com.epmet.dto.result; + +import com.epmet.dto.StaffGridListDTO; +import lombok.Data; + +import java.io.Serializable; +import java.util.List; + +/** + * @Auther zxc + * @Create 2020-04-23 10:28 + */ +@Data +public class GridDetailResultDTO implements Serializable { + + private static final long serialVersionUID = -1L; + + /** + * 网格id + */ + private String grid; + + /** + * 网格名称 + */ + private String gridName; + + /** + * 中心位置经度 + */ + private String longitude; + + /** + * 中心位置维度 + */ + private String latitude; + + /** + * 所属地区码(所属组织地区码) + */ + private String areaCode; + + /** + * 管辖区域 + */ + private String manageDistrict; + + /** + * 当前网格总人数 + */ + private Integer totalUser; + + /** + * 所属组织机构ID(customer_agencys.id) + */ + private String agencyId; + + /** + * 所有上级组织ID + */ + private String pIds; + + /** + * 网格用户信息集合 + */ + private List staffGridList; + +} 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 new file mode 100644 index 0000000000..2f2b919b20 --- /dev/null +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/GridController.java @@ -0,0 +1,36 @@ +package com.epmet.controller; + +import com.epmet.commons.tools.utils.Result; +import com.epmet.dto.form.CustomerGridFormDTO; +import com.epmet.dto.result.GridDetailResultDTO; +import com.epmet.service.CustomerGridService; +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; + +/** + * @Auther zxc + * @Create 2020-04-23 9:50 + */ +@RestController +@RequestMapping("grid") +public class GridController { + + @Autowired + private CustomerGridService customerGridService; + + @PostMapping("griddetail") + public Result griddetail(@RequestBody CustomerGridFormDTO customerGridFormDTO){ + Result griddetail = customerGridService.griddetail(customerGridFormDTO); + return griddetail; + } + + /*@PostMapping("addgrid") + + @PostMapping("editgrid") + + @PostMapping("deletegrid")*/ + +} 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 edf49d86d1..d387278ec5 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 @@ -19,10 +19,12 @@ 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.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.entity.CustomerGridEntity; import org.apache.ibatis.annotations.Mapper; @@ -69,4 +71,19 @@ public interface CustomerGridDao extends BaseDao { * @Author sun */ List getMyGrids(String userId); + + /** + * 根据gridId获取网格详情 + * @param customerGridFormDTO + * @return + */ + GridDetailResultDTO griddetail(CustomerGridFormDTO customerGridFormDTO); + + /** + * 根据gridId查询uerId + * @param customerGridFormDTO + * @return + */ + List selectUserIdByGridId(CustomerGridFormDTO customerGridFormDTO); + } \ 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 27332bf916..1774a21c15 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,18 +3,21 @@ package com.epmet.feign; import com.epmet.commons.tools.constant.ServiceConstant; import com.epmet.commons.tools.utils.Result; import com.epmet.dto.CustomerStaffDTO; -import com.epmet.feign.fallback.EpmetUserFeignClientFallback; +import com.epmet.dto.CustomerStaffGridDTO; +import com.epmet.dto.StaffGridListDTO; +import com.epmet.feign.fallback.EpmetUserFeignClientFallBack; import org.springframework.cloud.openfeign.FeignClient; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; + +import java.util.List; /** * @author zhaoqifeng * @dscription * @date 2020/3/19 9:32 */ -@FeignClient(name = ServiceConstant.EPMET_USER_SERVER, fallback = EpmetUserFeignClientFallback.class) +@FeignClient(name = ServiceConstant.EPMET_USER_SERVER, fallback = EpmetUserFeignClientFallBack.class) public interface EpmetUserFeignClient { /** * 根据用户ID获取工作人员基本信息 @@ -27,4 +30,7 @@ public interface EpmetUserFeignClient { @PostMapping(value = "/epmetuser/customerstaff/getstaffinfobyuserid") Result getCustomerStaffInfoByUserId(CustomerStaffDTO formDTO); + @PostMapping("/epmetuser/customerstaff/selectstaffgridlistbyuserid") + Result> getStaffGridList(@RequestBody List customerStaffGridDTOS); + } 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 new file mode 100644 index 0000000000..029f1a968f --- /dev/null +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/feign/fallback/EpmetUserFeignClientFallBack.java @@ -0,0 +1,23 @@ +package com.epmet.feign.fallback; + +import com.epmet.commons.tools.constant.ServiceConstant; +import com.epmet.commons.tools.utils.ModuleUtils; +import com.epmet.commons.tools.utils.Result; +import com.epmet.dto.CustomerStaffGridDTO; +import com.epmet.dto.StaffGridListDTO; +import com.epmet.feign.EpmetUserFeignClient; +import org.springframework.stereotype.Component; + +import java.util.List; + +/** + * @Auther zxc + * @Create 2020-04-23 14:10 + */ +@Component +public class EpmetUserFeignClientFallBack implements EpmetUserFeignClient { + @Override + public Result> getStaffGridList(List customerStaffGridDTOS) { + return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "getStaffGridList", customerStaffGridDTOS); + } +} 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 df59c03f22..cb70ad18d3 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,20 +4,26 @@ 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.CustomerStaffDTO; -import com.epmet.dto.OperUserDTO; +import com.epmet.dto.CustomerStaffGridDTO; +import com.epmet.dto.StaffGridListDTO; import com.epmet.feign.EpmetUserFeignClient; import org.springframework.stereotype.Component; +import java.util.List; + /** - * 用户模块 - * @author zhaoqifeng - * @date 2020/3/19 9:34 + * @Auther zxc + * @Create 2020-04-23 14:10 */ @Component -public class EpmetUserFeignClientFallback implements EpmetUserFeignClient { +public class EpmetUserFeignClientFallBack implements EpmetUserFeignClient { + @Override + public Result getCustomerStaffInfoByUserId(CustomerStaffDTO formDTO) { + return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "getCustomerStaffInfoByUserId", formDTO); + } - @Override - public Result getCustomerStaffInfoByUserId(CustomerStaffDTO formDTO) { - return ModuleUtils.feignConError(ServiceConstant.OPER_CRM_SERVER, "getCustomerStaffInfoByUserId", formDTO); - } + @Override + public Result> getStaffGridList(List customerStaffGridDTOS) { + return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "getStaffGridList", customerStaffGridDTOS); + } } 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 44b206c7c5..5d427e434a 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 @@ -25,6 +25,7 @@ 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.entity.CustomerGridEntity; import java.util.List; @@ -122,4 +123,11 @@ public interface CustomerGridService extends BaseService { * @Author sun */ Result> getMyGrids(String userId); + + /** + * 根据gridId获取网格详情 + * @param customerGridFormDTO + * @return + */ + Result griddetail(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 f11352265f..da136fb56a 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 @@ -26,11 +26,15 @@ import com.epmet.commons.tools.utils.ConvertUtils; import com.epmet.commons.tools.utils.Result; 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.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.entity.CustomerGridEntity; +import com.epmet.feign.EpmetUserFeignClient; import com.epmet.redis.CustomerGridRedis; import com.epmet.service.CustomerGridService; import com.epmet.util.ModuleConstant; @@ -55,6 +59,8 @@ public class CustomerGridServiceImpl extends BaseServiceImpl page(Map params) { @@ -163,4 +169,13 @@ public class CustomerGridServiceImpl extends BaseServiceImpl>().ok(baseDao.getMyGrids(userId)); } + @Override + public Result griddetail(CustomerGridFormDTO customerGridFormDTO) { + GridDetailResultDTO griddetail = baseDao.griddetail(customerGridFormDTO); + List customerStaffGridDTOS = baseDao.selectUserIdByGridId(customerGridFormDTO); + Result> staffGridList = epmetUserFeignClient.getStaffGridList(customerStaffGridDTOS); + griddetail.setStaffGridList(staffGridList.getData()); + return new Result().ok(griddetail); + } + } 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 343558b7d7..f748ba157e 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 @@ -109,4 +109,34 @@ cg.created_time DESC + + + + + + \ No newline at end of file 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 6ae1285955..103d4163fc 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 @@ -26,6 +26,9 @@ import com.epmet.commons.tools.validator.group.AddGroup; import com.epmet.commons.tools.validator.group.DefaultGroup; import com.epmet.commons.tools.validator.group.UpdateGroup; import com.epmet.dto.CustomerStaffDTO; +import com.epmet.dto.CustomerStaffGridDTO; +import com.epmet.dto.StaffGridListDTO; +import com.epmet.dto.form.CustomerGridFormDTO; import com.epmet.dto.form.CustomerStaffFormDTO; import com.epmet.excel.CustomerStaffExcel; import com.epmet.service.CustomerStaffService; @@ -117,6 +120,17 @@ public class CustomerStaffController { return customerStaffService.getCustomerStaffInfo(formDTO); } + /** + * 根据userId查询网格下用户信息 + * @param customerStaffGridDTOS + * @return + */ + @PostMapping(value = "selectstaffgridlistbyuserid") + public Result> selectStaffGridListByUserId(@RequestBody List customerStaffGridDTOS){ + Result> listResult = customerStaffService.selectStaffGridListByUserId(customerStaffGridDTOS); + return listResult; + } + /** * 根据用户ID获取工作人员基本信息 * 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 689af6a49b..14d91f75e9 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 @@ -19,6 +19,8 @@ package com.epmet.dao; import com.epmet.commons.mybatis.dao.BaseDao; import com.epmet.dto.CustomerStaffDTO; +import com.epmet.dto.CustomerStaffGridDTO; +import com.epmet.dto.StaffGridListDTO; import com.epmet.dto.form.CustomerStaffFormDTO; import com.epmet.entity.CustomerStaffEntity; import org.apache.ibatis.annotations.Mapper; @@ -53,4 +55,11 @@ public interface CustomerStaffDao extends BaseDao { CustomerStaffDTO selectListCustomerStaffInfo(CustomerStaffFormDTO formDTO); CustomerStaffDTO selectStaffInfoByUserId(CustomerStaffDTO formDTO); + + /** + * 根据userId查询查询网格下的用户信息 + * @param customerStaffGridDTOS + * @return + */ + List selectStaffGridListByUserId(List customerStaffGridDTOS); } \ 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 12c2c04c52..3775510742 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 @@ -21,6 +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.CustomerStaffDTO; +import com.epmet.dto.CustomerStaffGridDTO; +import com.epmet.dto.StaffGridListDTO; +import com.epmet.dto.form.CustomerGridFormDTO; import com.epmet.dto.form.CustomerStaffFormDTO; import com.epmet.entity.CustomerStaffEntity; @@ -122,4 +125,11 @@ public interface CustomerStaffService extends BaseService { * @date 2020/4/22 10:05 **/ Result getCustomerStaffInfoByUserId(CustomerStaffDTO formDTO); + + /** + * 根据guidId查询网格下的用户信息 + * @param customerStaffGridDTOS + * @return + */ + Result> selectStaffGridListByUserId(List customerStaffGridDTOS); } \ 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 e0d2c3ac8f..4ac6f5a529 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 @@ -28,6 +28,9 @@ import com.epmet.commons.tools.utils.Result; import com.epmet.constant.UserConstant; 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.CustomerGridFormDTO; import com.epmet.dto.form.CustomerStaffFormDTO; import com.epmet.entity.CustomerStaffEntity; import com.epmet.redis.CustomerStaffRedis; @@ -140,4 +143,10 @@ public class CustomerStaffServiceImpl extends BaseServiceImpl().ok(customerStaffDTO); } + @Override + public Result> selectStaffGridListByUserId(List customerStaffGridDTOS) { + List staffGridListDTOS = baseDao.selectStaffGridListByUserId(customerStaffGridDTOS); + return new Result>().ok(staffGridListDTOS); + } + } \ 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 08b3afb984..5385e021db 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 @@ -23,4 +23,22 @@ where cs.USER_ID=#{userId} and cs.DEL_FLAG='0' + + + \ No newline at end of file From aea54666ef2ccb0a15b31c6c1a20cf81a43eb316 Mon Sep 17 00:00:00 2001 From: sunyuchao Date: Thu, 23 Apr 2020 15:47:38 +0800 Subject: [PATCH 48/85] =?UTF-8?q?=E6=94=BF=E5=BA=9C=E7=AB=AF-=E5=88=A0?= =?UTF-8?q?=E9=99=A4=E6=9C=BA=E5=85=B3=E7=BB=84=E7=BB=87=E6=8E=A5=E5=8F=A3?= =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/epmet/commons/tools/exception/EpmetErrorCode.java | 3 ++- .../main/java/com/epmet/constant/CustomerAgencyConstant.java | 4 ---- .../com/epmet/service/impl/CustomerAgencyServiceImpl.java | 5 +++-- 3 files changed, 5 insertions(+), 7 deletions(-) diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java index 0ddc89d09b..d07777427a 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java @@ -26,7 +26,8 @@ public enum EpmetErrorCode { MOBILE_GET_CODE_ERROR(8104,"获取验证码失败"), MESSAGE_SMS_SEND_ERROR(8105, "短信发送失败"), - CANNOT_AUDIT_WARM(8201, "请完善居民信息"); + CANNOT_AUDIT_WARM(8201, "请完善居民信息"), + NOT_DEL_AGENCY(8202, "该机关存在下级机关,不允许删除"); private int code; diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/constant/CustomerAgencyConstant.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/constant/CustomerAgencyConstant.java index 42d40b0199..3c28f465f9 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/constant/CustomerAgencyConstant.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/constant/CustomerAgencyConstant.java @@ -14,10 +14,6 @@ public interface CustomerAgencyConstant { * 添加组织失败 */ String SAVE_EXCEPTION = "组织机构新增失败"; - /** - * 不允许删除组织 - */ - String NOT_DEL_AGENCY = "当前组织存在下级组织,不允许删除"; /** * 组织删除失败 */ diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerAgencyServiceImpl.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerAgencyServiceImpl.java index 4d17f1a674..3bbd8631c0 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerAgencyServiceImpl.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerAgencyServiceImpl.java @@ -22,6 +22,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage; import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; import com.epmet.commons.tools.constant.FieldConstant; import com.epmet.commons.tools.constant.NumConstant; +import com.epmet.commons.tools.exception.EpmetErrorCode; import com.epmet.commons.tools.exception.RenException; import com.epmet.commons.tools.page.PageData; import com.epmet.commons.tools.utils.ConvertUtils; @@ -41,7 +42,6 @@ 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; @@ -188,7 +188,8 @@ public class CustomerAgencyServiceImpl extends BaseServiceImpl agencyList = baseDao.selectSubAgencyById(formDTO.getAgencyId()); if (null != agencyList && agencyList.size() > NumConstant.ZERO) { - result.setMsg(CustomerAgencyConstant.NOT_DEL_AGENCY); + result.setCode(EpmetErrorCode.NOT_DEL_AGENCY.getCode()); + result.setMsg(EpmetErrorCode.NOT_DEL_AGENCY.getMsg()); return result; } //2:删除当前机关组织(逻辑删) From 2b28fcd6a5fac1dd55ceaab76af9a6a66bfbb1ce Mon Sep 17 00:00:00 2001 From: zxc <954985705@qq.com> Date: Thu, 23 Apr 2020 15:55:05 +0800 Subject: [PATCH 49/85] =?UTF-8?q?FeignClientFallBack=E6=B7=BB=E5=8A=A0getC?= =?UTF-8?q?ustomerStaffInfoByUserId?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/epmet/feign/fallback/EpmetUserFeignClientFallback.java | 1 - .../gov-org/gov-org-server/src/main/resources/bootstrap.yml | 2 +- epmet-user/epmet-user-server/src/main/resources/bootstrap.yml | 2 +- 3 files changed, 2 insertions(+), 3 deletions(-) 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 cb70ad18d3..05b26449b3 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 @@ -21,7 +21,6 @@ public class EpmetUserFeignClientFallBack implements EpmetUserFeignClient { public Result getCustomerStaffInfoByUserId(CustomerStaffDTO formDTO) { return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "getCustomerStaffInfoByUserId", formDTO); } - @Override public Result> getStaffGridList(List customerStaffGridDTOS) { return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "getStaffGridList", customerStaffGridDTOS); diff --git a/epmet-module/gov-org/gov-org-server/src/main/resources/bootstrap.yml b/epmet-module/gov-org/gov-org-server/src/main/resources/bootstrap.yml index 3d1fddbaef..756bf6874f 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/resources/bootstrap.yml +++ b/epmet-module/gov-org/gov-org-server/src/main/resources/bootstrap.yml @@ -10,7 +10,7 @@ spring: name: gov-org-server #环境 dev|test|prod profiles: - active: dev + active: dev-local messages: encoding: UTF-8 basename: i18n/messages_common diff --git a/epmet-user/epmet-user-server/src/main/resources/bootstrap.yml b/epmet-user/epmet-user-server/src/main/resources/bootstrap.yml index 6674d13dfd..96d9187fb7 100644 --- a/epmet-user/epmet-user-server/src/main/resources/bootstrap.yml +++ b/epmet-user/epmet-user-server/src/main/resources/bootstrap.yml @@ -10,7 +10,7 @@ spring: name: epmet-user-server #环境 dev|test|prod profiles: - active: dev + active: dev-local messages: encoding: UTF-8 basename: i18n/messages_common From 31882331397e214b46af200b93d029dfd4219185 Mon Sep 17 00:00:00 2001 From: zxc <954985705@qq.com> Date: Thu, 23 Apr 2020 15:58:29 +0800 Subject: [PATCH 50/85] =?UTF-8?q?FeignClientFallBack=E6=B7=BB=E5=8A=A0getC?= =?UTF-8?q?ustomerStaffInfoByUserId?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../gov-org/gov-org-server/src/main/resources/bootstrap.yml | 2 +- epmet-user/epmet-user-server/src/main/resources/bootstrap.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/epmet-module/gov-org/gov-org-server/src/main/resources/bootstrap.yml b/epmet-module/gov-org/gov-org-server/src/main/resources/bootstrap.yml index 756bf6874f..3d1fddbaef 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/resources/bootstrap.yml +++ b/epmet-module/gov-org/gov-org-server/src/main/resources/bootstrap.yml @@ -10,7 +10,7 @@ spring: name: gov-org-server #环境 dev|test|prod profiles: - active: dev-local + active: dev messages: encoding: UTF-8 basename: i18n/messages_common diff --git a/epmet-user/epmet-user-server/src/main/resources/bootstrap.yml b/epmet-user/epmet-user-server/src/main/resources/bootstrap.yml index 96d9187fb7..6674d13dfd 100644 --- a/epmet-user/epmet-user-server/src/main/resources/bootstrap.yml +++ b/epmet-user/epmet-user-server/src/main/resources/bootstrap.yml @@ -10,7 +10,7 @@ spring: name: epmet-user-server #环境 dev|test|prod profiles: - active: dev-local + active: dev messages: encoding: UTF-8 basename: i18n/messages_common From 3a4bf0d93e0f56c3154b99dce3cf5f7c0b7ef968 Mon Sep 17 00:00:00 2001 From: wxz Date: Thu, 23 Apr 2020 16:08:03 +0800 Subject: [PATCH 51/85] =?UTF-8?q?1.=E4=BF=AE=E5=A4=8D=EF=BC=9A=E6=9F=A5?= =?UTF-8?q?=E8=AF=A2=E8=A7=92=E8=89=B2=E4=B8=8B=E7=9A=84=E7=94=A8=E6=88=B7?= =?UTF-8?q?=E5=88=97=E8=A1=A8=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../EpmetUserFeignClientFallBack.java | 5 ++++ .../EpmetUserFeignClientFallback.java | 28 ------------------- .../epmet/controller/StaffRoleController.java | 11 ++++++-- .../java/com/epmet/dao/GovStaffRoleDao.java | 8 ------ .../main/java/com/epmet/dao/StaffRoleDao.java | 12 +++++++- .../epmet/service/GovStaffRoleService.java | 8 ------ .../com/epmet/service/StaffRoleService.java | 8 ++++++ .../service/impl/GovStaffRoleServiceImpl.java | 12 -------- .../service/impl/StaffRoleServiceImpl.java | 11 ++++++++ .../main/resources/mapper/GovStaffRoleDao.xml | 14 ---------- .../main/resources/mapper/StaffRoleDao.xml | 11 ++++++++ 11 files changed, 54 insertions(+), 74 deletions(-) delete mode 100644 epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/feign/fallback/EpmetUserFeignClientFallback.java 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 029f1a968f..05b26449b3 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 @@ -3,6 +3,7 @@ package com.epmet.feign.fallback; import com.epmet.commons.tools.constant.ServiceConstant; import com.epmet.commons.tools.utils.ModuleUtils; import com.epmet.commons.tools.utils.Result; +import com.epmet.dto.CustomerStaffDTO; import com.epmet.dto.CustomerStaffGridDTO; import com.epmet.dto.StaffGridListDTO; import com.epmet.feign.EpmetUserFeignClient; @@ -16,6 +17,10 @@ import java.util.List; */ @Component public class EpmetUserFeignClientFallBack implements EpmetUserFeignClient { + @Override + public Result getCustomerStaffInfoByUserId(CustomerStaffDTO formDTO) { + return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "getCustomerStaffInfoByUserId", formDTO); + } @Override public Result> getStaffGridList(List customerStaffGridDTOS) { return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "getStaffGridList", customerStaffGridDTOS); 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 deleted file mode 100644 index 05b26449b3..0000000000 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/feign/fallback/EpmetUserFeignClientFallback.java +++ /dev/null @@ -1,28 +0,0 @@ -package com.epmet.feign.fallback; - -import com.epmet.commons.tools.constant.ServiceConstant; -import com.epmet.commons.tools.utils.ModuleUtils; -import com.epmet.commons.tools.utils.Result; -import com.epmet.dto.CustomerStaffDTO; -import com.epmet.dto.CustomerStaffGridDTO; -import com.epmet.dto.StaffGridListDTO; -import com.epmet.feign.EpmetUserFeignClient; -import org.springframework.stereotype.Component; - -import java.util.List; - -/** - * @Auther zxc - * @Create 2020-04-23 14:10 - */ -@Component -public class EpmetUserFeignClientFallBack implements EpmetUserFeignClient { - @Override - public Result getCustomerStaffInfoByUserId(CustomerStaffDTO formDTO) { - return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "getCustomerStaffInfoByUserId", formDTO); - } - @Override - public Result> getStaffGridList(List customerStaffGridDTOS) { - return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "getStaffGridList", customerStaffGridDTOS); - } -} 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 73a94b7740..1c13ea4518 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,9 +3,11 @@ 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.StaffRoleDTO; import com.epmet.dto.form.StaffRoleFormDTO; import com.epmet.entity.GovStaffRoleEntity; import com.epmet.service.GovStaffRoleService; +import com.epmet.service.StaffRoleService; import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.PostMapping; @@ -30,6 +32,9 @@ public class StaffRoleController { @Autowired private GovStaffRoleService govStaffRoleService; + @Autowired + private StaffRoleService staffRoleService; + /** * 查询工作人员具有的角色列表 * @return @@ -55,12 +60,12 @@ public class StaffRoleController { * @return */ @PostMapping("staffsinrole") - public Result> getStaffsInRole(@RequestBody StaffRoleFormDTO staffRoleFormDTO) { + public Result> getStaffsInRole(@RequestBody StaffRoleFormDTO staffRoleFormDTO) { ValidatorUtils.validateEntity(staffRoleFormDTO, StaffRoleFormDTO.GetStaffsInRole.class); String roleKey = staffRoleFormDTO.getRoleKey(); String orgId = staffRoleFormDTO.getOrgId(); - List roleDTOS = govStaffRoleService.listStaffsInRole(roleKey, orgId); - return new Result>().ok(roleDTOS); + List staffRoleDTOS = staffRoleService.listStaffsInRole(roleKey, orgId); + return new Result>().ok(staffRoleDTOS); } } diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/GovStaffRoleDao.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/GovStaffRoleDao.java index fa244dce1c..0e187c2252 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/GovStaffRoleDao.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/GovStaffRoleDao.java @@ -18,7 +18,6 @@ package com.epmet.dao; import com.epmet.commons.mybatis.dao.BaseDao; -import com.epmet.dto.GovStaffRoleDTO; import com.epmet.entity.GovStaffRoleEntity; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; @@ -42,11 +41,4 @@ public interface GovStaffRoleDao extends BaseDao { */ List listRolesByStaffId(@Param("staffId") String staffId, @Param("orgId") String orgId); - /** - * 查询具有某角色的staff列表 - * @param roleKey - * @param orgId - * @return - */ - List listStaffsByRoleKeyAndOrgId(@Param("roleKey") String roleKey, @Param("orgId") String orgId); } \ 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 1a69f5a6c2..40d4b47b00 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 @@ -18,8 +18,12 @@ package com.epmet.dao; import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.dto.StaffRoleDTO; import com.epmet.entity.StaffRoleEntity; import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +import java.util.List; /** * 工作人员-角色关系表 @@ -29,5 +33,11 @@ import org.apache.ibatis.annotations.Mapper; */ @Mapper public interface StaffRoleDao extends BaseDao { - + /** + * 查询具有某角色的staff列表 + * @param roleKey + * @param orgId + * @return + */ + List listStaffIdsByRoleKeyAndOrgId(@Param("roleKey") String roleKey, @Param("orgId") String orgId); } \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/GovStaffRoleService.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/GovStaffRoleService.java index 8de688b50b..942a001921 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/GovStaffRoleService.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/GovStaffRoleService.java @@ -99,12 +99,4 @@ public interface GovStaffRoleService extends BaseService { * @return */ List listRolesByStaffId(String staffId, String orgId); - - /** - * 查询具有某角色的staff列表 - * @param roleKey - * @param orgId - * @return - */ - List listStaffsInRole(String roleKey, String orgId); } \ 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 f5787beaa8..7ba2d5e83b 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 @@ -92,4 +92,12 @@ public interface StaffRoleService extends BaseService { * @date 2020-04-22 */ void delete(String[] ids); + + /** + * 查询具有某角色的staff列表 + * @param roleKey + * @param orgId + * @return + */ + List listStaffsInRole(String roleKey, String orgId); } \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/GovStaffRoleServiceImpl.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/GovStaffRoleServiceImpl.java index b0249006aa..28ae555889 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/GovStaffRoleServiceImpl.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/GovStaffRoleServiceImpl.java @@ -110,16 +110,4 @@ public class GovStaffRoleServiceImpl extends BaseServiceImpl listRolesByStaffId(String staffId, String orgId) { return baseDao.listRolesByStaffId(staffId, orgId); } - - /** - * 查询具有某角色的staff列表 - * @param roleKey - * @param orgId - * @return - */ - @Override - public List listStaffsInRole(String roleKey, String orgId) { - return baseDao.listStaffsByRoleKeyAndOrgId(roleKey, orgId); - } - } \ 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 bf717ba530..ddcd8abe3b 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 @@ -101,4 +101,15 @@ public class StaffRoleServiceImpl extends BaseServiceImpl listStaffsInRole(String roleKey, String orgId) { + return baseDao.listStaffIdsByRoleKeyAndOrgId(roleKey, orgId); + } + } \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/resources/mapper/GovStaffRoleDao.xml b/epmet-user/epmet-user-server/src/main/resources/mapper/GovStaffRoleDao.xml index e2b1d6fe7e..8259bfb9a8 100644 --- a/epmet-user/epmet-user-server/src/main/resources/mapper/GovStaffRoleDao.xml +++ b/epmet-user/epmet-user-server/src/main/resources/mapper/GovStaffRoleDao.xml @@ -28,18 +28,4 @@ sr.STAFF_ID = #{staffId} AND sr.ORG_ID = #{orgId} - - - - - \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/resources/mapper/StaffRoleDao.xml b/epmet-user/epmet-user-server/src/main/resources/mapper/StaffRoleDao.xml index 79ad9ca489..0cbdc611f6 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 @@ -17,4 +17,15 @@ + + \ No newline at end of file From 2aa917d4ad09fd7160505477d8d5c3ed7066f30c Mon Sep 17 00:00:00 2001 From: yinzuomei <576302893@qq.com> Date: Thu, 23 Apr 2020 16:19:52 +0800 Subject: [PATCH 52/85] =?UTF-8?q?gov=20wxcode=E7=99=BB=E5=BD=95=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/epmet/controller/GovLoginController.java | 6 +++--- .../java/com/epmet/dto/form/GovWxmpFormDTO.java | 3 ++- .../epmet/service/impl/GovLoginServiceImpl.java | 1 + .../java/com/epmet/utils/WxMaServiceUtils.java | 7 +++---- .../tools/exception/RenExceptionHandler.java | 15 ++++++++++++--- epmet-gateway/src/main/resources/bootstrap.yml | 4 ++-- .../main/resources/mapper/CustomerStaffDao.xml | 4 ++-- 7 files changed, 25 insertions(+), 15 deletions(-) diff --git a/epmet-auth/src/main/java/com/epmet/controller/GovLoginController.java b/epmet-auth/src/main/java/com/epmet/controller/GovLoginController.java index 886fb67bd0..fbc883c70f 100644 --- a/epmet-auth/src/main/java/com/epmet/controller/GovLoginController.java +++ b/epmet-auth/src/main/java/com/epmet/controller/GovLoginController.java @@ -38,7 +38,7 @@ public class GovLoginController { * @Date 2020/4/20 11:22 **/ @PostMapping(value = "/loginwxmp/loginbywxcode") - public Result loginByWxCode(GovWxmpFormDTO formDTO) { + public Result loginByWxCode(@RequestBody GovWxmpFormDTO formDTO) { ValidatorUtils.validateEntity(formDTO); return govLoginService.loginByWxCode(formDTO); } @@ -64,7 +64,7 @@ public class GovLoginController { * @Date 2020/4/18 21:14 **/ @PostMapping(value = "/loginwxmp/getmyorg") - public Result> getmyorg(StaffOrgsFormDTO formDTO) { + public Result> getmyorg(@RequestBody StaffOrgsFormDTO formDTO) { ValidatorUtils.validateEntity(formDTO); return govLoginService.getMyOrg(formDTO); } @@ -77,7 +77,7 @@ public class GovLoginController { * @Date 2020/4/20 13:07 **/ @PostMapping(value = "/loginwxmp/enterorg") - public Result enterOrg(GovWxmpEnteOrgFormDTO formDTO) { + public Result enterOrg(@RequestBody GovWxmpEnteOrgFormDTO formDTO) { ValidatorUtils.validateEntity(formDTO); return govLoginService.enterOrg(formDTO); } diff --git a/epmet-auth/src/main/java/com/epmet/dto/form/GovWxmpFormDTO.java b/epmet-auth/src/main/java/com/epmet/dto/form/GovWxmpFormDTO.java index 72c43cbfa7..4eb52a4bf7 100644 --- a/epmet-auth/src/main/java/com/epmet/dto/form/GovWxmpFormDTO.java +++ b/epmet-auth/src/main/java/com/epmet/dto/form/GovWxmpFormDTO.java @@ -3,6 +3,7 @@ package com.epmet.dto.form; import lombok.Data; import javax.validation.constraints.NotBlank; +import java.io.Serializable; /** * @Description 政府端小程序根据wxCode获取上一次登录信息,返回token @@ -10,7 +11,7 @@ import javax.validation.constraints.NotBlank; * @Date 2020/4/20 11:20 */ @Data -public class GovWxmpFormDTO extends LoginCommonFormDTO{ +public class GovWxmpFormDTO extends LoginCommonFormDTO implements Serializable { private static final long serialVersionUID = -207861963128774742L; /** * wxCode diff --git a/epmet-auth/src/main/java/com/epmet/service/impl/GovLoginServiceImpl.java b/epmet-auth/src/main/java/com/epmet/service/impl/GovLoginServiceImpl.java index 2c0300a947..1d06b689fa 100644 --- a/epmet-auth/src/main/java/com/epmet/service/impl/GovLoginServiceImpl.java +++ b/epmet-auth/src/main/java/com/epmet/service/impl/GovLoginServiceImpl.java @@ -109,6 +109,7 @@ public class GovLoginServiceImpl implements GovLoginService { //2、验证码是否正确 String rightSmsCode = captchaRedis.getSmsCode(formDTO.getMobile()); if (!formDTO.getSmsCode().equals(rightSmsCode)) { + logger.error(String.format("验证码错误code[%s],msg[%s]",EpmetErrorCode.MOBILE_CODE_ERROR.getCode(),EpmetErrorCode.MOBILE_CODE_ERROR.getMsg())); return new Result>().error(EpmetErrorCode.MOBILE_CODE_ERROR.getCode()); } //3、查询用户所有的组织信息 diff --git a/epmet-commons/epmet-commons-tools-wx-ma/src/main/java/com/epmet/utils/WxMaServiceUtils.java b/epmet-commons/epmet-commons-tools-wx-ma/src/main/java/com/epmet/utils/WxMaServiceUtils.java index 8d7aaa463d..5122fa505f 100644 --- a/epmet-commons/epmet-commons-tools-wx-ma/src/main/java/com/epmet/utils/WxMaServiceUtils.java +++ b/epmet-commons/epmet-commons-tools-wx-ma/src/main/java/com/epmet/utils/WxMaServiceUtils.java @@ -17,10 +17,10 @@ public class WxMaServiceUtils { @Value("${wx.ma.appId.resi}") private String APPID_RESI; - /*@Value("${wx.ma.appId.gov}") + @Value("${wx.ma.appId.gov}") private String APPID_GOV; - @Value("${wx.ma.appId.oper}") + /*@Value("${wx.ma.appId.oper}") private String APPID_OPER;*/ /** @@ -43,8 +43,7 @@ public class WxMaServiceUtils { * @date 2020/03/13 10:44 */ public final WxMaService govWxMaService() { -// final WxMaService wxMaService = WxMaConfig.getMaService(APPID_GOV); - final WxMaService wxMaService = WxMaConfig.getMaService(APPID_RESI); + final WxMaService wxMaService = WxMaConfig.getMaService(APPID_GOV); return wxMaService; } diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/RenExceptionHandler.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/RenExceptionHandler.java index b2936413d2..5a035ffa80 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/RenExceptionHandler.java +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/RenExceptionHandler.java @@ -53,7 +53,10 @@ public class RenExceptionHandler { @ExceptionHandler(RenException.class) public Result handleRRException(RenException ex){ logger.error(ExceptionUtils.getErrorStackTrace(ex)); - return new Result().error(); + Result result=new Result().error(); + result.setData(ex.getMsg()); + return result; +// return new Result().error(); } /** @@ -64,7 +67,10 @@ public class RenExceptionHandler { @ExceptionHandler(RuntimeException.class) public Result handleRuntimeException(RuntimeException ex){ logger.error(ExceptionUtils.getErrorStackTrace(ex)); - return new Result().error(); + Result result=new Result().error(); + result.setData(ex.getMessage()); + return result; +// return new Result().error(); } /** @@ -87,7 +93,10 @@ public class RenExceptionHandler { public Result handleException(Exception ex){ logger.error(ExceptionUtils.getErrorStackTrace(ex)); // saveLog(ex); - return new Result().error(); + Result result=new Result().error(); + result.setData(ex.getMessage()); + return result; +// return new Result().error(); } /** diff --git a/epmet-gateway/src/main/resources/bootstrap.yml b/epmet-gateway/src/main/resources/bootstrap.yml index d7f1d28a50..64cd74507d 100644 --- a/epmet-gateway/src/main/resources/bootstrap.yml +++ b/epmet-gateway/src/main/resources/bootstrap.yml @@ -293,8 +293,8 @@ epmet: - /resi/mine/** - /resi/group/** - /resi/partymember/** -# - /gov/mine/** -# - /gov/access/** + - /gov/mine/** + - /gov/access/** swaggerUrls: jwt: 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 08b3afb984..f3d3bad1da 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 @@ -7,7 +7,7 @@ @@ -16,7 +16,7 @@ select * from customer_staff cs where cs.MOBILE=#{mobile} and cs.CUSTOMER_ID=#{customerId} - and cs.DEL_FLAG='1' + and cs.DEL_FLAG='0' SELECT - cta.pid AS orgId, - cta.CUSTOMER_ID AS customerId, - cta.ORGANIZATION_NAME AS orgName + ca.pid AS orgId, + ca.CUSTOMER_ID AS customerId, + ca.ORGANIZATION_NAME AS orgName FROM - customer_staff_agency cta + customer_agency ca WHERE - cta.DEL_FLAG = '0' - AND co.PID = '0' - and cta.CUSTOMER_ID IN + ca.DEL_FLAG = '0' + AND ca.PID = '0' + and ca.CUSTOMER_ID IN #{customerId} 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..574084079e 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 @@ -105,8 +105,7 @@ cg.del_flag = '0' AND csg.del_flag = '0' AND csg.user_id = #{userId} - ORDER BY - cg.created_time DESC + ORDER BY cg.GRID_NAME ASC diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/constant/UserConstant.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/constant/UserConstant.java index 640d5079ea..16fb79e8fd 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/constant/UserConstant.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/constant/UserConstant.java @@ -57,4 +57,14 @@ public interface UserConstant { * 未禁用enable,已禁用diabled */ String DISABLED="disabled"; + + /** + * inactive未激活,active已激活 + */ + String INACTIVE="inactive"; + + /** + * inactive未激活,active已激活 + */ + String ACTIVE="active"; } 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..ef1a5955eb 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 @@ -62,4 +62,13 @@ public interface CustomerStaffDao extends BaseDao { * @return */ List selectStaffGridListByUserId(List customerStaffGridDTOS); + + /** + * @return com.epmet.entity.CustomerStaffEntity + * @param userId + * @Author yinzuomei + * @Description 根据staffid查询用户基本信息 + * @Date 2020/4/23 16:46 + **/ + CustomerStaffEntity selectByUserId(String userId); } \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/StaffWechatServiceImpl.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/StaffWechatServiceImpl.java index 04fe972274..b50daab444 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/StaffWechatServiceImpl.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/StaffWechatServiceImpl.java @@ -24,18 +24,23 @@ import com.epmet.commons.tools.constant.FieldConstant; import com.epmet.commons.tools.page.PageData; import com.epmet.commons.tools.utils.ConvertUtils; import com.epmet.commons.tools.utils.Result; +import com.epmet.constant.UserConstant; +import com.epmet.dao.CustomerStaffDao; import com.epmet.dao.StaffWechatDao; import com.epmet.dto.StaffWechatDTO; import com.epmet.dto.form.StaffWechatFormDTO; +import com.epmet.entity.CustomerStaffEntity; import com.epmet.entity.StaffWechatEntity; import com.epmet.service.StaffWechatService; import org.apache.commons.lang3.StringUtils; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import java.util.Arrays; +import java.util.Date; import java.util.List; import java.util.Map; @@ -48,7 +53,8 @@ import java.util.Map; @Service public class StaffWechatServiceImpl extends BaseServiceImpl implements StaffWechatService { private Logger logger = LogManager.getLogger(getClass()); - + @Autowired + private CustomerStaffDao customerStaffDao; @Override public PageData page(Map params) { IPage page = baseDao.selectPage( @@ -119,6 +125,14 @@ public class StaffWechatServiceImpl extends BaseServiceImpl AND cs.del_flag = 0 + + + \ No newline at end of file From 60435a2c8280b322bddb713eeb88db8589487e3e Mon Sep 17 00:00:00 2001 From: sunyuchao Date: Thu, 23 Apr 2020 18:00:55 +0800 Subject: [PATCH 58/85] =?UTF-8?q?=E6=94=BF=E5=BA=9C=E7=AB=AF-=E8=8E=B7?= =?UTF-8?q?=E5=8F=96=E7=BB=84=E7=BB=87=E6=9C=BA=E6=9E=84=E5=88=97=E8=A1=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/epmet/dto/form/AgencyListFormDTO.java | 43 ++++++++++++++++ .../epmet/dto/result/AgencyListResultDTO.java | 51 +++++++++++++++++++ .../epmet/controller/AgencyController.java | 13 +++++ .../java/com/epmet/dao/CustomerAgencyDao.java | 9 ++++ .../java/com/epmet/service/AgencyService.java | 13 +++-- .../epmet/service/impl/AgencyServiceImpl.java | 12 +++++ .../resources/mapper/CustomerAgencyDao.xml | 11 ++++ 7 files changed, 148 insertions(+), 4 deletions(-) create mode 100644 epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/AgencyListFormDTO.java create mode 100644 epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/AgencyListResultDTO.java diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/AgencyListFormDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/AgencyListFormDTO.java new file mode 100644 index 0000000000..1a05afb589 --- /dev/null +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/AgencyListFormDTO.java @@ -0,0 +1,43 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

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

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

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.dto.form; + +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import java.io.Serializable; + + +/** + * 获取组织列表-接口入参 + * + * @author sun + */ +@Data +public class AgencyListFormDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 机关组织Id + */ + @NotBlank(message = "组织机构ID不能为空") + private String agencyId; + + +} \ No newline at end of file diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/AgencyListResultDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/AgencyListResultDTO.java new file mode 100644 index 0000000000..9673700fcc --- /dev/null +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/AgencyListResultDTO.java @@ -0,0 +1,51 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

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

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

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.dto.result; + +import lombok.Data; + +import java.io.Serializable; + + +/** + * 获取组织列表-接口返参 + * + * @author sun + */ +@Data +public class AgencyListResultDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 机关组织Id + */ + private String agencyId; + + /** + * 机关组织名称 + */ + private String agencyName; + + /** + * 总人数 + */ + private Integer totalUser; + + +} \ No newline at end of file diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/AgencyController.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/AgencyController.java index 501e6c05bd..82cd76e7c3 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/AgencyController.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/AgencyController.java @@ -20,6 +20,7 @@ package com.epmet.controller; import com.epmet.commons.tools.utils.Result; import com.epmet.dto.form.*; import com.epmet.dto.result.AddAgencyResultDTO; +import com.epmet.dto.result.AgencyListResultDTO; import com.epmet.dto.result.AgencydetailResultDTO; import com.epmet.dto.result.SubAgencyResultDTO; import com.epmet.service.AgencyService; @@ -29,6 +30,8 @@ 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; + /** * 组织机构 @@ -97,4 +100,14 @@ public class AgencyController { return agencyService.subAgencyList(formDTO); } + /** + * @param formDTO + * @return + * @Author sun + * @Description 获取组织列表 + */ + @PostMapping("agencylist") + public Result> agencyList(@RequestBody AgencyListFormDTO formDTO) { + return agencyService.agencyList(formDTO); + } } \ No newline at end of file diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerAgencyDao.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerAgencyDao.java index 0dc66e7bdd..8a4c14548b 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerAgencyDao.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerAgencyDao.java @@ -18,6 +18,7 @@ package com.epmet.dao; import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.dto.result.AgencyListResultDTO; import com.epmet.dto.result.ParentListResultDTO; import com.epmet.dto.result.StaffOrgsResultDTO; import com.epmet.dto.result.SubListResultDTO; @@ -59,4 +60,12 @@ public interface CustomerAgencyDao extends BaseDao { * @Description 组织首页-下级机关列表 **/ List selectSubAgencyById(@Param("pId") String pId); + + /** + * @param pId + * @return + * @Author sun + * @Description 获取组织列表 + **/ + List selectAgencyList(@Param("pId") String pId); } \ No newline at end of file diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/AgencyService.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/AgencyService.java index 3df8e719d4..f811f71f80 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/AgencyService.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/AgencyService.java @@ -22,10 +22,7 @@ import com.epmet.commons.tools.page.PageData; import com.epmet.commons.tools.utils.Result; import com.epmet.dto.CustomerAgencyDTO; import com.epmet.dto.form.*; -import com.epmet.dto.result.AddAgencyResultDTO; -import com.epmet.dto.result.AgencydetailResultDTO; -import com.epmet.dto.result.StaffOrgsResultDTO; -import com.epmet.dto.result.SubAgencyResultDTO; +import com.epmet.dto.result.*; import com.epmet.entity.CustomerAgencyEntity; import java.util.List; @@ -77,4 +74,12 @@ public interface AgencyService { * @Description 组织首页-下级机关列表 */ Result subAgencyList(SubAgencyFormDTO formDTO); + + /** + * @param formDTO + * @return + * @Author sun + * @Description 获取组织列表 + */ + Result> agencyList(AgencyListFormDTO formDTO); } \ No newline at end of file diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/AgencyServiceImpl.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/AgencyServiceImpl.java index c03526f6cd..ae13436d6a 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/AgencyServiceImpl.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/AgencyServiceImpl.java @@ -182,4 +182,16 @@ public class AgencyServiceImpl implements AgencyService { subAgencyResultDTO.setSubAgencyCount(agencyList.size()); return new Result().ok(subAgencyResultDTO); } + + /** + * @param formDTO + * @return + * @Author sun + * @Description 获取组织列表 + */ + @Override + public Result> agencyList(AgencyListFormDTO formDTO) { + List agencyList = customerAgencyDao.selectAgencyList(formDTO.getAgencyId()); + return new Result>().ok(agencyList); + } } \ No newline at end of file diff --git a/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerAgencyDao.xml b/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerAgencyDao.xml index a80b7334c4..1740a0c0ea 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerAgencyDao.xml +++ b/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerAgencyDao.xml @@ -59,4 +59,15 @@ AND pid = #{pId} ORDER BY CREATED_TIME DESC + + \ No newline at end of file From 87f2b17d5a3d9295bb9fbc12725f48b3caa36be9 Mon Sep 17 00:00:00 2001 From: sunyuchao Date: Thu, 23 Apr 2020 18:04:26 +0800 Subject: [PATCH 59/85] =?UTF-8?q?=E5=88=A0=E9=99=A4gov-org=E4=B8=8B?= =?UTF-8?q?=E7=9A=84feign=E5=AE=9E=E7=8E=B0=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../EpmetUserFeignClientFallBack.java | 23 --------------- .../EpmetUserFeignClientFallback.java | 29 ------------------- .../fallback/OperCrmFeignClientFallBack.java | 21 -------------- 3 files changed, 73 deletions(-) delete mode 100644 epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/feign/fallback/EpmetUserFeignClientFallBack.java delete mode 100644 epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/feign/fallback/EpmetUserFeignClientFallback.java delete mode 100644 epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/feign/fallback/OperCrmFeignClientFallBack.java 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 deleted file mode 100644 index 029f1a968f..0000000000 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/feign/fallback/EpmetUserFeignClientFallBack.java +++ /dev/null @@ -1,23 +0,0 @@ -package com.epmet.feign.fallback; - -import com.epmet.commons.tools.constant.ServiceConstant; -import com.epmet.commons.tools.utils.ModuleUtils; -import com.epmet.commons.tools.utils.Result; -import com.epmet.dto.CustomerStaffGridDTO; -import com.epmet.dto.StaffGridListDTO; -import com.epmet.feign.EpmetUserFeignClient; -import org.springframework.stereotype.Component; - -import java.util.List; - -/** - * @Auther zxc - * @Create 2020-04-23 14:10 - */ -@Component -public class EpmetUserFeignClientFallBack implements EpmetUserFeignClient { - @Override - public Result> getStaffGridList(List customerStaffGridDTOS) { - return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "getStaffGridList", customerStaffGridDTOS); - } -} 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 deleted file mode 100644 index cb70ad18d3..0000000000 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/feign/fallback/EpmetUserFeignClientFallback.java +++ /dev/null @@ -1,29 +0,0 @@ -package com.epmet.feign.fallback; - -import com.epmet.commons.tools.constant.ServiceConstant; -import com.epmet.commons.tools.utils.ModuleUtils; -import com.epmet.commons.tools.utils.Result; -import com.epmet.dto.CustomerStaffDTO; -import com.epmet.dto.CustomerStaffGridDTO; -import com.epmet.dto.StaffGridListDTO; -import com.epmet.feign.EpmetUserFeignClient; -import org.springframework.stereotype.Component; - -import java.util.List; - -/** - * @Auther zxc - * @Create 2020-04-23 14:10 - */ -@Component -public class EpmetUserFeignClientFallBack implements EpmetUserFeignClient { - @Override - public Result getCustomerStaffInfoByUserId(CustomerStaffDTO formDTO) { - return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "getCustomerStaffInfoByUserId", formDTO); - } - - @Override - public Result> getStaffGridList(List customerStaffGridDTOS) { - return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "getStaffGridList", customerStaffGridDTOS); - } -} diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/feign/fallback/OperCrmFeignClientFallBack.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/feign/fallback/OperCrmFeignClientFallBack.java deleted file mode 100644 index d40619a04c..0000000000 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/feign/fallback/OperCrmFeignClientFallBack.java +++ /dev/null @@ -1,21 +0,0 @@ -package com.epmet.feign.fallback; - -import com.epmet.commons.tools.constant.ServiceConstant; -import com.epmet.commons.tools.utils.ModuleUtils; -import com.epmet.commons.tools.utils.Result; -import com.epmet.dto.CustomerDTO; -import com.epmet.feign.OperCrmFeignClient; -import org.springframework.stereotype.Component; - -/** - * @author zhaoqifeng - * @dscription - * @date 2020/4/22 10:43 - */ -@Component -public class OperCrmFeignClientFallBack implements OperCrmFeignClient { - @Override - public Result getCustomerInfo(CustomerDTO dto) { - return ModuleUtils.feignConError(ServiceConstant.OPER_CRM_SERVER, "getCustomerInfo", dto); - } -} From 5b7abe5da256a174d1f6f128ac208188cecb0cec Mon Sep 17 00:00:00 2001 From: sunyuchao Date: Thu, 23 Apr 2020 18:06:40 +0800 Subject: [PATCH 60/85] =?UTF-8?q?=E9=87=8D=E6=96=B0=E6=8F=90=E4=BA=A4gov-o?= =?UTF-8?q?rg=E4=B8=8B=E7=9A=84feign=E5=AE=9E=E7=8E=B0=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../EpmetUserFeignClientFallBack.java | 28 +++++++++++++++++++ .../fallback/OperCrmFeignClientFallBack.java | 21 ++++++++++++++ 2 files changed, 49 insertions(+) create mode 100644 epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/feign/fallback/OperCrmFeignClientFallBack.java 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 e69de29bb2..05b26449b3 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 @@ -0,0 +1,28 @@ +package com.epmet.feign.fallback; + +import com.epmet.commons.tools.constant.ServiceConstant; +import com.epmet.commons.tools.utils.ModuleUtils; +import com.epmet.commons.tools.utils.Result; +import com.epmet.dto.CustomerStaffDTO; +import com.epmet.dto.CustomerStaffGridDTO; +import com.epmet.dto.StaffGridListDTO; +import com.epmet.feign.EpmetUserFeignClient; +import org.springframework.stereotype.Component; + +import java.util.List; + +/** + * @Auther zxc + * @Create 2020-04-23 14:10 + */ +@Component +public class EpmetUserFeignClientFallBack implements EpmetUserFeignClient { + @Override + public Result getCustomerStaffInfoByUserId(CustomerStaffDTO formDTO) { + return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "getCustomerStaffInfoByUserId", formDTO); + } + @Override + public Result> getStaffGridList(List customerStaffGridDTOS) { + return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "getStaffGridList", customerStaffGridDTOS); + } +} diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/feign/fallback/OperCrmFeignClientFallBack.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/feign/fallback/OperCrmFeignClientFallBack.java new file mode 100644 index 0000000000..d40619a04c --- /dev/null +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/feign/fallback/OperCrmFeignClientFallBack.java @@ -0,0 +1,21 @@ +package com.epmet.feign.fallback; + +import com.epmet.commons.tools.constant.ServiceConstant; +import com.epmet.commons.tools.utils.ModuleUtils; +import com.epmet.commons.tools.utils.Result; +import com.epmet.dto.CustomerDTO; +import com.epmet.feign.OperCrmFeignClient; +import org.springframework.stereotype.Component; + +/** + * @author zhaoqifeng + * @dscription + * @date 2020/4/22 10:43 + */ +@Component +public class OperCrmFeignClientFallBack implements OperCrmFeignClient { + @Override + public Result getCustomerInfo(CustomerDTO dto) { + return ModuleUtils.feignConError(ServiceConstant.OPER_CRM_SERVER, "getCustomerInfo", dto); + } +} From fa0410e63335bf63450b1f6343a8f12617454575 Mon Sep 17 00:00:00 2001 From: zhaoqifeng Date: Thu, 23 Apr 2020 18:25:42 +0800 Subject: [PATCH 61/85] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=20=E7=BB=84=E7=BB=87-?= =?UTF-8?q?=E5=B7=A5=E4=BD=9C=E4=BA=BA=E5=91=98=E7=9B=B8=E5=85=B3=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../epmet/dto/form/StaffsInAgencyFromDTO.java | 28 ++++++++++ .../epmet/dto/result/StaffInfoResultDTO.java | 38 +++++++++++++ .../dto/result/StaffsInAgencyResultDTO.java | 27 ++++++++++ .../CustomerStaffAgencyController.java | 5 ++ .../com/epmet/controller/StaffController.java | 36 +++++++++++++ .../com/epmet/dao/CustomerStaffAgencyDao.java | 9 ++++ .../com/epmet/feign/EpmetUserFeignClient.java | 10 ++++ .../EpmetUserFeignClientFallBack.java | 7 +++ .../service/CustomerStaffAgencyService.java | 10 ++++ .../java/com/epmet/service/StaffService.java | 22 ++++++++ .../impl/CustomerStaffAgencyServiceImpl.java | 19 ++++++- .../epmet/service/impl/StaffServiceImpl.java | 54 +++++++++++++++++++ .../mapper/CustomerStaffAgencyDao.xml | 10 ++++ .../java/com/epmet/dto/CustomerStaffDTO.java | 5 ++ .../controller/CustomerStaffController.java | 12 +++++ .../java/com/epmet/dao/CustomerStaffDao.java | 19 ++++++- .../epmet/service/CustomerStaffService.java | 10 +++- .../impl/CustomerStaffServiceImpl.java | 9 +++- .../resources/mapper/CustomerStaffDao.xml | 27 ++++++++++ 19 files changed, 352 insertions(+), 5 deletions(-) create mode 100644 epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/StaffsInAgencyFromDTO.java create mode 100644 epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/StaffInfoResultDTO.java create mode 100644 epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/StaffsInAgencyResultDTO.java create mode 100644 epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/StaffController.java create mode 100644 epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/StaffService.java create mode 100644 epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/StaffServiceImpl.java diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/StaffsInAgencyFromDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/StaffsInAgencyFromDTO.java new file mode 100644 index 0000000000..dc0deddc9d --- /dev/null +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/StaffsInAgencyFromDTO.java @@ -0,0 +1,28 @@ +package com.epmet.dto.form; + +import lombok.Data; + +import java.io.Serializable; +import java.util.List; + +/** + * @author zhaoqifeng + * @dscription + * @date 2020/4/23 15:45 + */ +@Data +public class StaffsInAgencyFromDTO implements Serializable { + private static final long serialVersionUID = 1L; + /** + * 客户ID + */ + private String customerId; + /** + * 机关ID + */ + private String agencyId; + /** + * 用户ID + */ + private List staffList; +} diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/StaffInfoResultDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/StaffInfoResultDTO.java new file mode 100644 index 0000000000..2859c1171a --- /dev/null +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/StaffInfoResultDTO.java @@ -0,0 +1,38 @@ +package com.epmet.dto.result; + +import lombok.Data; + +import java.io.Serializable; + +/** + * @author zhaoqifeng + * @dscription + * @date 2020/4/23 16:08 + */ +@Data +public class StaffInfoResultDTO implements Serializable { + /** + * 用户ID + */ + private String staffId; + /** + * 用户姓名 + */ + private String staffName; + /** + * 头像 + */ + private String staffHeadPhoto; + /** + * 性别 + */ + private Integer gender; + /** + * 是否禁用(未禁用enable,已禁用disabled) + */ + private String enableFlag; + /** + * 权限名 + */ + private String roleName; +} diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/StaffsInAgencyResultDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/StaffsInAgencyResultDTO.java new file mode 100644 index 0000000000..4c9352466b --- /dev/null +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/StaffsInAgencyResultDTO.java @@ -0,0 +1,27 @@ +package com.epmet.dto.result; + +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.io.Serializable; +import java.util.List; + +/** + * @author zhaoqifeng + * @dscription + * @date 2020/4/23 15:58 + */ +@NoArgsConstructor +@Data +public class StaffsInAgencyResultDTO implements Serializable { + private static final long serialVersionUID = 1L; + /** + * 人员总数 + */ + private Integer staffCount; + /** + * 人员列表 + */ + private List staffList; + +} 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..3bfc887aec 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 @@ -26,7 +26,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.StaffsInAgencyFromDTO; import com.epmet.dto.result.LatestCustomerResultDTO; +import com.epmet.dto.result.StaffInfoResultDTO; import com.epmet.excel.CustomerStaffAgencyExcel; import com.epmet.service.CustomerStaffAgencyService; import org.springframework.beans.factory.annotation.Autowired; @@ -104,4 +106,7 @@ public class CustomerStaffAgencyController { 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/StaffController.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/StaffController.java new file mode 100644 index 0000000000..7d57bb3a71 --- /dev/null +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/StaffController.java @@ -0,0 +1,36 @@ +package com.epmet.controller; + + + +import com.epmet.commons.tools.utils.Result; +import com.epmet.dto.form.StaffsInAgencyFromDTO; +import com.epmet.dto.result.StaffInfoResultDTO; +import com.epmet.dto.result.StaffsInAgencyResultDTO; +import com.epmet.service.StaffService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import java.util.List; + +/** + * 组织结构-工作人员 + * @author zhaoqifeng + * @date 2020/4/23 17:59 + */ +@RestController +@RequestMapping("staff") +public class StaffController { + @Autowired + private StaffService staffService; + /** + * 组织首页-工作人员列表 + * @param fromDTO + * @return + */ + @PostMapping("staffsinagency") + public Result getStaffInfoForHome(StaffsInAgencyFromDTO fromDTO) { + return staffService.getStaffInfoForHome(fromDTO); + } +} 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..533c97b2a5 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 @@ -22,6 +22,8 @@ import com.epmet.dto.CustomerStaffAgencyDTO; import com.epmet.entity.CustomerStaffAgencyEntity; import org.apache.ibatis.annotations.Mapper; +import java.util.List; + /** * 人员-机关单位关系表 * @@ -37,5 +39,12 @@ public interface CustomerStaffAgencyDao extends BaseDao selectCustomerStaffAgencyList(String agencyId); } \ 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..217d37c0bb 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.StaffsInAgencyFromDTO; +import com.epmet.dto.result.StaffInfoResultDTO; import com.epmet.feign.fallback.EpmetUserFeignClientFallBack; import org.springframework.cloud.openfeign.FeignClient; import org.springframework.web.bind.annotation.PostMapping; @@ -33,4 +35,12 @@ public interface EpmetUserFeignClient { @PostMapping("/epmetuser/customerstaff/selectstaffgridlistbyuserid") Result> getStaffGridList(@RequestBody List customerStaffGridDTOS); + /** + * 组织首页-工作人员列表 + * @param fromDTO + * @return + */ + @PostMapping("/epmetuser/customerstaff/staffsinagency") + Result> getStaffInfoForHome(StaffsInAgencyFromDTO fromDTO); + } 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..a4cf20b805 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.StaffsInAgencyFromDTO; +import com.epmet.dto.result.StaffInfoResultDTO; 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> getStaffInfoForHome(StaffsInAgencyFromDTO fromDTO) { + return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "getStaffInfoForHome", fromDTO); + } } 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..c713dbde52 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.StaffsInAgencyFromDTO; import com.epmet.dto.result.LatestCustomerResultDTO; import com.epmet.entity.CustomerStaffAgencyEntity; @@ -102,4 +103,13 @@ public interface CustomerStaffAgencyService extends BaseService getLatestCustomer(String userId); + + /** + * 获取组织下关联人员 + * @param fromDTO + * @return + */ + Result> getCustomerStaffAgencyList(StaffsInAgencyFromDTO fromDTO); + + } \ No newline at end of file diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/StaffService.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/StaffService.java new file mode 100644 index 0000000000..6d5b37c11f --- /dev/null +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/StaffService.java @@ -0,0 +1,22 @@ +package com.epmet.service; + +import com.epmet.commons.tools.utils.Result; +import com.epmet.dto.form.StaffsInAgencyFromDTO; +import com.epmet.dto.result.StaffsInAgencyResultDTO; + +/** + * 组织结构-工作人员 + * + * @author zhaoqifeng + * @date 2020/4/23 18:00 + */ +public interface StaffService { + /** + * 组织首页-工作人员列表 + * + * @param fromDTO 参数 + * @return Result + * @author zhaoqifeng + */ + Result getStaffInfoForHome(StaffsInAgencyFromDTO fromDTO); +} diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerStaffAgencyServiceImpl.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerStaffAgencyServiceImpl.java index 212e5246a1..77292f2710 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 @@ -28,11 +28,16 @@ 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.StaffsInAgencyFromDTO; 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.CustomerStaffAgencyService; import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; @@ -42,6 +47,7 @@ import org.springframework.transaction.annotation.Transactional; import java.util.Arrays; import java.util.List; import java.util.Map; +import java.util.stream.Collectors; /** * 人员-机关单位关系表 @@ -58,6 +64,8 @@ public class CustomerStaffAgencyServiceImpl extends BaseServiceImpl page(Map params) { @@ -121,8 +129,7 @@ public class CustomerStaffAgencyServiceImpl extends BaseServiceImpl staffInfo = - epmetUserFeignClient.getCustomerStaffInfoByUserId(customerStaffParam); + Result staffInfo = epmetUserFeignClient.getCustomerStaffInfoByUserId(customerStaffParam); resultDTO.setStaffHeadPhoto(staffInfo.getData().getHeadPhoto()); resultDTO.setGender(staffInfo.getData().getGender()); //获取客户名称 @@ -133,4 +140,12 @@ public class CustomerStaffAgencyServiceImpl extends BaseServiceImpl().ok(resultDTO); } + @Override + public Result> getCustomerStaffAgencyList(StaffsInAgencyFromDTO fromDTO) { + + List customerStaffAgencyList = baseDao.selectCustomerStaffAgencyList(fromDTO.getAgencyId()); + + return new Result>().ok(customerStaffAgencyList); + } + } \ No newline at end of file diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/StaffServiceImpl.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/StaffServiceImpl.java new file mode 100644 index 0000000000..6f3108abd7 --- /dev/null +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/StaffServiceImpl.java @@ -0,0 +1,54 @@ +package com.epmet.service.impl; + +import com.epmet.commons.tools.utils.Result; +import com.epmet.dto.CustomerStaffAgencyDTO; +import com.epmet.dto.form.StaffsInAgencyFromDTO; +import com.epmet.dto.result.StaffInfoResultDTO; +import com.epmet.dto.result.StaffsInAgencyResultDTO; +import com.epmet.entity.CustomerAgencyEntity; +import com.epmet.feign.EpmetUserFeignClient; +import com.epmet.feign.OperCrmFeignClient; +import com.epmet.service.CustomerAgencyService; +import com.epmet.service.CustomerStaffAgencyService; +import com.epmet.service.StaffService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.List; +import java.util.stream.Collectors; + +/** + * @author zhaoqifeng + * @dscription + * @date 2020/4/23 18:05 + */ +@Service +public class StaffServiceImpl implements StaffService { + @Autowired + private EpmetUserFeignClient epmetUserFeignClient; + @Autowired + private OperCrmFeignClient operCrmFeignClient; + @Autowired + private CustomerAgencyService customerAgencyService; + @Autowired + private CustomerStaffAgencyService customerStaffAgencyService; + @Override + public Result getStaffInfoForHome(StaffsInAgencyFromDTO fromDTO) { + StaffsInAgencyResultDTO resultDTO = new StaffsInAgencyResultDTO(); + //获取机关所在客户ID和人员总数 + CustomerAgencyEntity customerAgencyEntity = customerAgencyService.selectById(fromDTO.getAgencyId()); + resultDTO.setStaffCount(customerAgencyEntity.getTotalUser()); + fromDTO.setCustomerId(customerAgencyEntity.getCustomerId()); + List customerStaffAgencyList = customerStaffAgencyService.getCustomerStaffAgencyList(fromDTO).getData(); + if (null == customerStaffAgencyList || customerStaffAgencyList.size() == 0) { + return new Result().ok(null); + } + //提取所有userID + List staffIds = customerStaffAgencyList.stream().map(CustomerStaffAgencyDTO::getUserId).collect(Collectors.toList()); + fromDTO.setStaffList(staffIds); + //获取用户信息 + Result> staffInfoListResult = epmetUserFeignClient.getStaffInfoForHome(fromDTO); + resultDTO.setStaffList(staffInfoListResult.getData()); + return new Result().ok(resultDTO); + } +} 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..a9b8baea0d 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 @@ -28,5 +28,15 @@ CREATED_TIME DESC LIMIT 1 + \ No newline at end of file diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/CustomerStaffDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/CustomerStaffDTO.java index 6fbd80dd49..a247d4e450 100644 --- a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/CustomerStaffDTO.java +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/CustomerStaffDTO.java @@ -128,4 +128,9 @@ public class CustomerStaffDTO implements Serializable { * 客户id */ private String customerId; + + /** + * 角色名称 + */ + private String roleName; } \ No newline at end of file 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..42c39a6022 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 @@ -30,6 +30,8 @@ import com.epmet.dto.CustomerStaffGridDTO; import com.epmet.dto.StaffGridListDTO; import com.epmet.dto.form.CustomerGridFormDTO; import com.epmet.dto.form.CustomerStaffFormDTO; +import com.epmet.dto.form.StaffsInAgencyFromDTO; +import com.epmet.dto.result.StaffInfoResultDTO; import com.epmet.excel.CustomerStaffExcel; import com.epmet.service.CustomerStaffService; import org.springframework.beans.factory.annotation.Autowired; @@ -143,4 +145,14 @@ public class CustomerStaffController { public Result getCustomerStaffInfoByUserId(CustomerStaffDTO formDTO) { return customerStaffService.getCustomerStaffInfoByUserId(formDTO); } + + /** + * 组织首页-工作人员列表 + * @param fromDTO + * @return + */ + @PostMapping("staffsinagency") + public Result> getStaffInfoForHome(StaffsInAgencyFromDTO fromDTO) { + return customerStaffService.getStaffInfoForHome(fromDTO); + } } \ 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 ef1a5955eb..ea050b7501 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,6 +22,8 @@ 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.form.StaffsInAgencyFromDTO; +import com.epmet.dto.result.StaffInfoResultDTO; import com.epmet.entity.CustomerStaffEntity; import org.apache.ibatis.annotations.Mapper; @@ -54,8 +56,23 @@ public interface CustomerStaffDao extends BaseDao { **/ CustomerStaffDTO selectListCustomerStaffInfo(CustomerStaffFormDTO formDTO); - CustomerStaffDTO selectStaffInfoByUserId(CustomerStaffDTO formDTO); + CustomerStaffDTO selectStaffInfoByUserId(CustomerStaffDTO formDTO); + /** + * 根据userId查询查询网格下的用户信息 + * + * @param customerStaffGridDTOS + * @return + */ + List selectStaffGridListByUserId(List customerStaffGridDTOS); + + /** + * 根据用户ID列表获取用户信息 + * + * @param fromDTO + * @return + */ + List selectCustomerStaffList(StaffsInAgencyFromDTO fromDTO); /** * 根据userId查询查询网格下的用户信息 * @param customerStaffGridDTOS 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..4a7ceb335f 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,9 @@ 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.CustomerGridFormDTO; import com.epmet.dto.form.CustomerStaffFormDTO; +import com.epmet.dto.form.StaffsInAgencyFromDTO; +import com.epmet.dto.result.StaffInfoResultDTO; import com.epmet.entity.CustomerStaffEntity; import java.util.List; @@ -132,4 +133,11 @@ public interface CustomerStaffService extends BaseService { * @return */ Result> selectStaffGridListByUserId(List customerStaffGridDTOS); + + /** + * 组织首页-工作人员列表 + * @param fromDTO + * @return + */ + Result> getStaffInfoForHome(StaffsInAgencyFromDTO fromDTO); } \ 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..560fe0008c 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,9 @@ 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.CustomerGridFormDTO; import com.epmet.dto.form.CustomerStaffFormDTO; +import com.epmet.dto.form.StaffsInAgencyFromDTO; +import com.epmet.dto.result.StaffInfoResultDTO; import com.epmet.entity.CustomerStaffEntity; import com.epmet.redis.CustomerStaffRedis; import com.epmet.service.CustomerStaffService; @@ -149,4 +150,10 @@ public class CustomerStaffServiceImpl extends BaseServiceImpl>().ok(staffGridListDTOS); } + @Override + public Result> getStaffInfoForHome(StaffsInAgencyFromDTO fromDTO) { + List list = baseDao.selectCustomerStaffList(fromDTO); + return new Result>().ok(list); + } + } \ 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 8528391aac..ab8ad974a5 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,6 +41,33 @@ AND cs.del_flag = 0 + SELECT - ca.pid AS orgId, - ca.CUSTOMER_ID AS customerId, - ca.ORGANIZATION_NAME AS orgName + ca.pid AS agencyId, + ca.ORGANIZATION_NAME AS agencyName, + ca.CUSTOMER_ID AS customerId FROM customer_agency ca WHERE diff --git a/epmet-module/oper-crm/oper-crm-client/src/main/java/com/epmet/dto/form/CustomerFormDTO.java b/epmet-module/oper-crm/oper-crm-client/src/main/java/com/epmet/dto/form/CustomerFormDTO.java new file mode 100644 index 0000000000..b4fbbeff49 --- /dev/null +++ b/epmet-module/oper-crm/oper-crm-client/src/main/java/com/epmet/dto/form/CustomerFormDTO.java @@ -0,0 +1,20 @@ +package com.epmet.dto.form; + +import lombok.Data; + +import java.io.Serializable; +import java.util.List; + +/** + * @Description 根据客户id查询客户信息 + * @Author yinzuomei + * @Date 2020/4/24 9:09 + */ +@Data +public class CustomerFormDTO implements Serializable { + /** + * 客户id集合 + * */ + private List customerIdList; +} + diff --git a/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/controller/CustomerController.java b/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/controller/CustomerController.java index 4e683e3ffc..1605fd6c80 100644 --- a/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/controller/CustomerController.java +++ b/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/controller/CustomerController.java @@ -26,6 +26,7 @@ import com.epmet.commons.tools.validator.group.AddGroup; import com.epmet.commons.tools.validator.group.DefaultGroup; import com.epmet.commons.tools.validator.group.UpdateGroup; import com.epmet.dto.CustomerDTO; +import com.epmet.dto.form.CustomerFormDTO; import com.epmet.dto.result.ValidCustomerResultDTO; import com.epmet.excel.CustomerExcel; import com.epmet.service.CustomerService; @@ -144,4 +145,15 @@ public class CustomerController { return customerService.getCustomerInfo(dto); } + /** + * @param formDTO + * @return com.epmet.commons.tools.utils.Result + * @Author yinzuomei + * @Description 根据客户id查询客户信息 + * @Date 2020/4/24 9:13 + **/ + @PostMapping("queryCustomerList") + public Result> queryCustomerList(@RequestBody CustomerFormDTO formDTO) { + return customerService.queryCustomerList(formDTO); + } } diff --git a/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/dao/CustomerDao.java b/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/dao/CustomerDao.java index 661cc151c4..6a958cc6d2 100644 --- a/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/dao/CustomerDao.java +++ b/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/dao/CustomerDao.java @@ -18,9 +18,11 @@ package com.epmet.dao; import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.dto.CustomerDTO; import com.epmet.dto.result.ValidCustomerResultDTO; import com.epmet.entity.CustomerEntity; import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; import java.util.List; @@ -40,4 +42,13 @@ public interface CustomerDao extends BaseDao { * @date 2020-03-11 */ List selectListValidCustomerResultDTO(); + + /** + * @return java.util.List + * @param customerIdList + * @Author yinzuomei + * @Description 根据客户id查询客户信息 + * @Date 2020/4/24 9:21 + **/ + List selectListByIds(@Param("customerIdList") List customerIdList); } diff --git a/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/service/CustomerService.java b/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/service/CustomerService.java index b36bd6f5b2..a50c87a138 100644 --- a/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/service/CustomerService.java +++ b/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/service/CustomerService.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.CustomerDTO; +import com.epmet.dto.form.CustomerFormDTO; import com.epmet.dto.result.ValidCustomerResultDTO; import com.epmet.entity.CustomerEntity; @@ -120,4 +121,13 @@ public interface CustomerService extends BaseService { * @return */ Result getCustomerInfo(CustomerDTO dto); + + /** + * @param formDTO + * @return com.epmet.commons.tools.utils.Result + * @Author yinzuomei + * @Description 根据客户id查询客户信息 + * @Date 2020/4/24 9:13 + **/ + Result> queryCustomerList(CustomerFormDTO formDTO); } diff --git a/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/service/impl/CustomerServiceImpl.java b/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/service/impl/CustomerServiceImpl.java index 5384193128..89bab2936a 100644 --- a/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/service/impl/CustomerServiceImpl.java +++ b/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/service/impl/CustomerServiceImpl.java @@ -26,6 +26,7 @@ import com.epmet.commons.tools.constant.FieldConstant; import com.epmet.commons.tools.utils.Result; import com.epmet.dao.CustomerDao; import com.epmet.dto.CustomerDTO; +import com.epmet.dto.form.CustomerFormDTO; import com.epmet.dto.result.ValidCustomerResultDTO; import com.epmet.entity.CustomerEntity; import com.epmet.redis.CustomerRedis; @@ -135,4 +136,10 @@ public class CustomerServiceImpl extends BaseServiceImpl().ok(ConvertUtils.sourceToTarget(entity, CustomerDTO.class)); } + @Override + public Result> queryCustomerList(CustomerFormDTO formDTO) { + List customerDTOList = baseDao.selectListByIds(formDTO.getCustomerIdList()); + return new Result>().ok(customerDTOList); + } + } diff --git a/epmet-module/oper-crm/oper-crm-server/src/main/resources/mapper/CustomerDao.xml b/epmet-module/oper-crm/oper-crm-server/src/main/resources/mapper/CustomerDao.xml index 2a7e3c22ab..340883f472 100644 --- a/epmet-module/oper-crm/oper-crm-server/src/main/resources/mapper/CustomerDao.xml +++ b/epmet-module/oper-crm/oper-crm-server/src/main/resources/mapper/CustomerDao.xml @@ -34,4 +34,18 @@ ORDER BY CONVERT ( c.CUSTOMER_NAME USING gbk ) ASC + + + diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/StaffAgencyVisitedServiceImpl.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/StaffAgencyVisitedServiceImpl.java index 126dfd728c..11fb4702ca 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/StaffAgencyVisitedServiceImpl.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/StaffAgencyVisitedServiceImpl.java @@ -112,7 +112,7 @@ public class StaffAgencyVisitedServiceImpl extends BaseServiceImpl getLatestStaffWechatLoginRecord(String openId) { - if (StringUtils.isNotBlank(openId)) { + if (StringUtils.isBlank(openId)) { logger.error("openId 不能为空"); return new Result(); } From 055520dd82718664b41904cc38dc90e08020ffe3 Mon Sep 17 00:00:00 2001 From: yinzuomei <576302893@qq.com> Date: Fri, 24 Apr 2020 10:07:23 +0800 Subject: [PATCH 64/85] =?UTF-8?q?=E5=86=B2=E7=AA=81=E8=A7=A3=E5=86=B3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../tools/security/dto/GovTokenDto.java | 6 +++ .../epmet/service/CustomerAgencyService.java | 40 +++++++++++++++++++ .../java/com/epmet/dao/CustomerStaffDao.java | 6 --- 3 files changed, 46 insertions(+), 6 deletions(-) diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/security/dto/GovTokenDto.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/security/dto/GovTokenDto.java index 2a8fd7c05b..bfb7e6dc67 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/security/dto/GovTokenDto.java +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/security/dto/GovTokenDto.java @@ -4,6 +4,7 @@ import lombok.Data; import java.io.Serializable; import java.util.List; +import java.util.Set; /** * @Description 政府端登录信息 @@ -62,5 +63,10 @@ public class GovTokenDto extends BaseTokenDto implements Serializable { * 最后一次更新时间 */ private long updateTime; + + /** + * 功能权限列表,实际上是gov_staff => staff_role => role_operation查询到的operationKey + */ + private List permissions; } diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/CustomerAgencyService.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/CustomerAgencyService.java index 24a4e17b35..7076fe6d2d 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/CustomerAgencyService.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/CustomerAgencyService.java @@ -107,4 +107,44 @@ public interface CustomerAgencyService extends BaseService * @Date 2020/4/20 21:45 **/ Result> getStaffOrgList(StaffOrgFormDTO staffOrgsFormDTO); + + /** + * @param formDTO + * @return + * @Author sun + * @Description 添加组织 + */ + Result addAgency(AddAgencyFormDTO formDTO); + + /** + * @param formDTO + * @return + * @Author sun + * @Description 组织名称编辑 + */ + Result editAgency(EditAgencyFormDTO formDTO); + + /** + * @param formDTO + * @return + * @Author sun + * @Description 删除组织机关 + */ + Result removeAgency(RemoveAgencyFormDTO formDTO); + + /** + * @param formDTO + * @return + * @Author sun + * @Description 组织首页-获取组织机构信息 + */ + Result agencyDetail(AgencydetailFormDTO formDTO); + + /** + * @param formDTO + * @return + * @Author sun + * @Description 组织首页-下级机关列表 + */ + Result subAgencyList(SubAgencyFormDTO formDTO); } \ 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 ea050b7501..b552832c2d 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 @@ -73,12 +73,6 @@ public interface CustomerStaffDao extends BaseDao { * @return */ List selectCustomerStaffList(StaffsInAgencyFromDTO fromDTO); - /** - * 根据userId查询查询网格下的用户信息 - * @param customerStaffGridDTOS - * @return - */ - List selectStaffGridListByUserId(List customerStaffGridDTOS); /** * @return com.epmet.entity.CustomerStaffEntity From 30849f12da06f80c9c6790b89b289d224880239d Mon Sep 17 00:00:00 2001 From: yinzuomei <576302893@qq.com> Date: Fri, 24 Apr 2020 10:24:29 +0800 Subject: [PATCH 65/85] =?UTF-8?q?gov=E7=AB=AF=E7=82=B9=E7=99=BB=E5=BD=95to?= =?UTF-8?q?ken=E5=AD=97=E7=AC=A6=E4=B8=B2=E7=94=9F=E6=88=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/com/epmet/service/impl/GovLoginServiceImpl.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/epmet-auth/src/main/java/com/epmet/service/impl/GovLoginServiceImpl.java b/epmet-auth/src/main/java/com/epmet/service/impl/GovLoginServiceImpl.java index 0928771668..35ce90b25c 100644 --- a/epmet-auth/src/main/java/com/epmet/service/impl/GovLoginServiceImpl.java +++ b/epmet-auth/src/main/java/com/epmet/service/impl/GovLoginServiceImpl.java @@ -255,9 +255,9 @@ public class GovLoginServiceImpl implements GovLoginService { Map map = new HashMap<>(); map.put("app", LoginConstant.APP_GOV); map.put("client", LoginConstant.CLIENT_WXMP); - map.put("staffId", staffId); + map.put("userId", staffId); String token = jwtTokenUtils.createToken(map); - logger.info("app:" + LoginConstant.APP_GOV + ";client:" + LoginConstant.CLIENT_WXMP + ";staffId:" + staffId + ";生成token[" + token + "]"); + logger.info("app:" + LoginConstant.APP_GOV + ";client:" + LoginConstant.CLIENT_WXMP + ";userId:" + staffId + ";生成token[" + token + "]"); return token; } From 167facfd7b8ef82e1ee8af42cb7d91e8a20c576b Mon Sep 17 00:00:00 2001 From: sunyuchao Date: Fri, 24 Apr 2020 10:38:01 +0800 Subject: [PATCH 66/85] =?UTF-8?q?=E7=BB=84=E7=BB=87=E6=9C=BA=E6=9E=84?= =?UTF-8?q?=E8=A1=A8=E5=AD=97=E6=AE=B5=E4=BF=AE=E6=94=B9=EF=BC=88=E5=9B=BD?= =?UTF-8?q?=E5=AE=B6=E6=94=B9=E4=B8=BA=E5=8C=BA=E5=8E=BF=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/epmet/dto/CustomerAgencyDTO.java | 10 +++++----- .../java/com/epmet/entity/CustomerAgencyEntity.java | 10 +++++----- .../main/java/com/epmet/excel/CustomerAgencyExcel.java | 6 ++---- .../src/main/resources/db/migration/epmet_gov_org.sql | 4 ++-- 4 files changed, 14 insertions(+), 16 deletions(-) diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/CustomerAgencyDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/CustomerAgencyDTO.java index d1e6c3f40a..7b9abc9de6 100644 --- a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/CustomerAgencyDTO.java +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/CustomerAgencyDTO.java @@ -112,11 +112,6 @@ public class CustomerAgencyDTO implements Serializable { */ private Integer totalUser; - /** - * 国家 - */ - private String country; - /** * 省份 */ @@ -126,5 +121,10 @@ public class CustomerAgencyDTO implements Serializable { * 城市 */ private String city; + + /** + * 区县 + */ + private String district; } \ No newline at end of file diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/entity/CustomerAgencyEntity.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/entity/CustomerAgencyEntity.java index 84f0e78f1c..5549845d66 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/entity/CustomerAgencyEntity.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/entity/CustomerAgencyEntity.java @@ -82,11 +82,6 @@ public class CustomerAgencyEntity extends BaseEpmetEntity { */ private Integer totalUser; - /** - * 国家 - */ - private String country; - /** * 省份 */ @@ -97,4 +92,9 @@ public class CustomerAgencyEntity extends BaseEpmetEntity { */ private String city; + /** + * 区县 + */ + private String district; + } diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/excel/CustomerAgencyExcel.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/excel/CustomerAgencyExcel.java index 61ea84eb40..346963be94 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/excel/CustomerAgencyExcel.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/excel/CustomerAgencyExcel.java @@ -76,14 +76,12 @@ public class CustomerAgencyExcel { @Excel(name = "总人数") private Integer totalUser; - @Excel(name = "国家") - private String country; - @Excel(name = "省份") private String province; @Excel(name = "城市") private String city; - + @Excel(name = "区县") + private String district; } \ No newline at end of file diff --git a/epmet-module/gov-org/gov-org-server/src/main/resources/db/migration/epmet_gov_org.sql b/epmet-module/gov-org/gov-org-server/src/main/resources/db/migration/epmet_gov_org.sql index 2dc0bba345..f4d0e47dc7 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/resources/db/migration/epmet_gov_org.sql +++ b/epmet-module/gov-org/gov-org-server/src/main/resources/db/migration/epmet_gov_org.sql @@ -107,7 +107,7 @@ alter table customer_grid add column ORG_ID varchar(64) NOT NULL COMMENT '所属 alter table customer_grid add column MANAGE_DISTRICT varchar(255) DEFAULT "" NOT NULL COMMENT '管辖区域'; alter table customer_grid add column TOTAL_USER INT(11) DEFAULT 0 NOT NULL COMMENT '当前网格总人数'; ALTER TABLE customer_agency ADD ( - COUNTRY VARCHAR (32) DEFAULT NULL COMMENT '国家', PROVINCE VARCHAR (32) DEFAULT NULL COMMENT '省份', - CITY VARCHAR (32) DEFAULT NULL COMMENT '城市' + CITY VARCHAR (32) DEFAULT NULL COMMENT '城市', + DISTRICT VARCHAR (32) DEFAULT NULL COMMENT '区县' ); \ No newline at end of file From 8320ac3028eae7685a95a97779f343dad5097bfa Mon Sep 17 00:00:00 2001 From: wxz Date: Fri, 24 Apr 2020 13:53:47 +0800 Subject: [PATCH 67/85] =?UTF-8?q?1.=E5=A2=9E=E5=8A=A0DataFilter=E7=9B=B8?= =?UTF-8?q?=E5=85=B3=E5=B7=A5=E5=85=B7=202.=E5=AE=9E=E7=8E=B0=E4=BA=86?= =?UTF-8?q?=E5=8A=9F=E8=83=BD=E7=BA=A7RBAC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../epmet/service/impl/NewsServiceImpl.java | 2 +- .../src/test/java/com/epmet/TokenGenTest.java | 63 +++++++ .../mybatis/annotation/DataFilter.java | 20 -- .../mybatis/aspect/DataFilterAspect.java | 172 ++++++++++++------ .../mybatis/aspect/DataFilterAspectBak.java | 106 +++++++++++ .../dto/form/StaffPermissionFormDTO.java | 26 +++ .../commons/mybatis/entity/DataScope.java | 9 +- .../mybatis/feign/GovAccessFeignClient.java | 26 +++ .../GovAccessFeignClientFallback.java | 25 +++ .../handler/FieldMetaObjectHandler.java | 8 +- .../interceptor/DataFilterInterceptor.java | 6 + .../interceptor/DataFilterInterceptorBak.java | 100 ++++++++++ .../tools/annotation/RequirePermission.java | 36 ++++ .../commons/tools/aspect/AccessOpeAspect.java | 46 +++++ .../tools/exception/EpmetErrorCode.java | 3 +- .../tools/exception/RenExceptionHandler.java | 4 +- .../tools/security/dto/GovTokenDto.java | 2 +- .../tools/security/user/LoginUserUtil.java | 61 ++++++- epmet-gateway/pom.xml | 8 +- .../com/epmet/filter/FeignRequestFilter.java | 3 +- .../epmet/dto/form/StaffPermCacheFormDTO.java | 15 +- .../epmet/controller/AccessController.java | 15 +- .../java/com/epmet/service/AccessService.java | 10 +- .../epmet/service/impl/AccessServiceImpl.java | 15 +- .../db.migration/epmet_gov_access.sql | 2 +- .../epmet/controller/AccessController.java | 11 +- .../com/epmet/feign/GovAccessFeignClient.java | 18 +- .../GovAccessFeignClientFallback.java | 17 +- .../java/com/epmet/service/AccessService.java | 3 +- .../epmet/service/impl/AccessServiceImpl.java | 16 +- .../epmet/controller/StaffRoleController.java | 1 + .../service/impl/StaffRoleServiceImpl.java | 1 + 32 files changed, 728 insertions(+), 122 deletions(-) create mode 100644 epmet-auth/src/test/java/com/epmet/TokenGenTest.java create mode 100644 epmet-commons/epmet-commons-mybatis/src/main/java/com/epmet/commons/mybatis/aspect/DataFilterAspectBak.java create mode 100644 epmet-commons/epmet-commons-mybatis/src/main/java/com/epmet/commons/mybatis/dto/form/StaffPermissionFormDTO.java create mode 100644 epmet-commons/epmet-commons-mybatis/src/main/java/com/epmet/commons/mybatis/feign/GovAccessFeignClient.java create mode 100644 epmet-commons/epmet-commons-mybatis/src/main/java/com/epmet/commons/mybatis/feign/fallback/GovAccessFeignClientFallback.java create mode 100644 epmet-commons/epmet-commons-mybatis/src/main/java/com/epmet/commons/mybatis/interceptor/DataFilterInterceptorBak.java create mode 100644 epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/annotation/RequirePermission.java create mode 100644 epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/aspect/AccessOpeAspect.java diff --git a/epmet-admin/epmet-admin-server/src/main/java/com/epmet/service/impl/NewsServiceImpl.java b/epmet-admin/epmet-admin-server/src/main/java/com/epmet/service/impl/NewsServiceImpl.java index 31d7c6c310..220cf7d171 100644 --- a/epmet-admin/epmet-admin-server/src/main/java/com/epmet/service/impl/NewsServiceImpl.java +++ b/epmet-admin/epmet-admin-server/src/main/java/com/epmet/service/impl/NewsServiceImpl.java @@ -31,7 +31,7 @@ public class NewsServiceImpl extends BaseServiceImpl implem * mybatis数据权限演示 */ @Override - @DataFilter(prefix = "AND", isPendingCreator = false) + //@DataFilter(prefix = "AND", isPendingCreator = false) public PageData page(Map params) { paramsToLike(params, "title"); diff --git a/epmet-auth/src/test/java/com/epmet/TokenGenTest.java b/epmet-auth/src/test/java/com/epmet/TokenGenTest.java new file mode 100644 index 0000000000..3368e2d1cf --- /dev/null +++ b/epmet-auth/src/test/java/com/epmet/TokenGenTest.java @@ -0,0 +1,63 @@ +package com.epmet; + +import com.epmet.common.token.constant.LoginConstant; +import com.epmet.commons.tools.security.dto.GovTokenDto; +import com.epmet.commons.tools.utils.CpUserDetailRedis; +import com.epmet.jwt.JwtTokenProperties; +import com.epmet.jwt.JwtTokenUtils; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.junit4.SpringRunner; + +import java.util.HashMap; +import java.util.Map; + +@RunWith(SpringRunner.class) +@SpringBootTest +public class TokenGenTest { + + @Autowired + private JwtTokenProperties jwtTokenProperties; + + @Autowired + private JwtTokenUtils jwtTokenUtils; + + @Autowired + private CpUserDetailRedis cpUserDetailRedis; + + @Test + public void genToken() { + String staffId = "wxz"; + String tokenStr = generateGovWxmpToken(staffId); + int expire = jwtTokenProperties.getExpire(); + GovTokenDto govTokenDto = new GovTokenDto(); + govTokenDto.setApp(LoginConstant.APP_GOV); + govTokenDto.setClient(LoginConstant.CLIENT_WXMP); + govTokenDto.setUserId(staffId); + govTokenDto.setOpenId(""); + govTokenDto.setSessionKey(""); + govTokenDto.setUnionId(""); + govTokenDto.setToken(tokenStr); + govTokenDto.setUpdateTime(System.currentTimeMillis()); + govTokenDto.setExpireTime(jwtTokenUtils.getExpiration(tokenStr).getTime()); + govTokenDto.setAgencyId("1"); + govTokenDto.setCustomerId("f76def116c9c2dc0269cc17867af122c"); + cpUserDetailRedis.set(govTokenDto, expire); + } + + /** + * @Description 生成token + * @Date 2020/4/18 23:04 + **/ + private String generateGovWxmpToken(String staffId) { + Map map = new HashMap<>(); + map.put("app", LoginConstant.APP_GOV); + map.put("client", LoginConstant.CLIENT_WXMP); + map.put("userId", staffId); + String token = jwtTokenUtils.createToken(map); + return token; + } + +} diff --git a/epmet-commons/epmet-commons-mybatis/src/main/java/com/epmet/commons/mybatis/annotation/DataFilter.java b/epmet-commons/epmet-commons-mybatis/src/main/java/com/epmet/commons/mybatis/annotation/DataFilter.java index dd1d3aee3b..96b7691f22 100644 --- a/epmet-commons/epmet-commons-mybatis/src/main/java/com/epmet/commons/mybatis/annotation/DataFilter.java +++ b/epmet-commons/epmet-commons-mybatis/src/main/java/com/epmet/commons/mybatis/annotation/DataFilter.java @@ -25,24 +25,4 @@ public @interface DataFilter { */ String tableAlias() default ""; - /** - * 查询条件前缀,可选值有:[where、and] - */ - String prefix() default ""; - - /** - * 用户ID - */ - String userId() default "creator"; - - /** - * 部门ID - */ - String deptId() default "dept_id"; - - /** - * 是否拼接用户ID - */ - boolean isPendingCreator() default true; - } diff --git a/epmet-commons/epmet-commons-mybatis/src/main/java/com/epmet/commons/mybatis/aspect/DataFilterAspect.java b/epmet-commons/epmet-commons-mybatis/src/main/java/com/epmet/commons/mybatis/aspect/DataFilterAspect.java index f322f631f9..14ce3af0a1 100644 --- a/epmet-commons/epmet-commons-mybatis/src/main/java/com/epmet/commons/mybatis/aspect/DataFilterAspect.java +++ b/epmet-commons/epmet-commons-mybatis/src/main/java/com/epmet/commons/mybatis/aspect/DataFilterAspect.java @@ -8,25 +8,28 @@ package com.epmet.commons.mybatis.aspect; -import cn.hutool.core.collection.CollUtil; -import com.epmet.commons.mybatis.annotation.DataFilter; +import com.epmet.commons.mybatis.dto.form.StaffPermissionFormDTO; import com.epmet.commons.mybatis.entity.DataScope; -import com.epmet.commons.tools.constant.Constant; -import com.epmet.commons.tools.enums.SuperAdminEnum; +import com.epmet.commons.mybatis.feign.GovAccessFeignClient; +import com.epmet.commons.tools.aspect.AccessOpeAspect; +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.security.user.SecurityUser; -import com.epmet.commons.tools.security.user.UserDetail; +import com.epmet.commons.tools.security.user.LoginUserUtil; +import com.epmet.commons.tools.utils.Result; import org.apache.commons.lang3.StringUtils; import org.aspectj.lang.JoinPoint; import org.aspectj.lang.annotation.Aspect; import org.aspectj.lang.annotation.Before; -import org.aspectj.lang.annotation.Pointcut; -import org.aspectj.lang.reflect.MethodSignature; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; +import org.springframework.util.CollectionUtils; +import java.util.Arrays; import java.util.List; -import java.util.Map; +import java.util.Set; /** * 数据过滤,切面处理类 @@ -37,69 +40,124 @@ import java.util.Map; @Aspect @Component public class DataFilterAspect { - @Pointcut("@annotation(com.epmet.commons.mybatis.annotation.DataFilter)") - public void dataFilterCut() { - } + private static final Logger log = LoggerFactory.getLogger(DataFilterAspect.class); + + @Autowired + private LoginUserUtil loginUserUtil; + + @Autowired + private GovAccessFeignClient govAccessFeignClient; - @Before("dataFilterCut()") + @Before("@annotation(com.epmet.commons.mybatis.annotation.DataFilter)") public void dataFilter(JoinPoint point) { - Object params = point.getArgs()[0]; - if(params != null && params instanceof Map){ - UserDetail user = SecurityUser.getUser(); - - //如果不是超级管理员,则进行数据过滤 - if(user.getSuperAdmin() == SuperAdminEnum.NO.value()){ - Map map = (Map)params; - String sqlFilter = getSqlFilter(user, point); - map.put(Constant.SQL_FILTER, new DataScope(sqlFilter)); - } + // 反射的方式 + //MethodSignature signature = (MethodSignature) point.getSignature(); + //Class[] parameterTypes = signature.getParameterTypes(); + //for (Class parameterType : parameterTypes) { + // if (parameterType == DataScope.class) { + // + // } + //} + + String reqiurePermission = AccessOpeAspect.requirePermissionTl.get(); + // 没有配置所需权限,不做操作,打印提示日志 + if (StringUtils.isBlank(reqiurePermission)) { + log.warn("Api编码需要指定所需权限,请在Api上使用@RequirePermission注解完成所需权限配置"); + return; + } - return ; + // 校验操作权限 + validateOpePermission(reqiurePermission); + + Object[] methodArgs = point.getArgs(); + for (Object methodArg : methodArgs) { + if (methodArg instanceof DataScope) { + ((DataScope) methodArg).setSqlFilter(getSqlFilterSegment()); + return; + } } - throw new RenException(ErrorCode.DATA_SCOPE_PARAMS_ERROR); + //throw new RenException(ErrorCode.DATA_SCOPE_PARAMS_ERROR); } /** - * 获取数据过滤的SQL + * 校验操作权限 */ - private String getSqlFilter(UserDetail user, JoinPoint point){ - MethodSignature signature = (MethodSignature) point.getSignature(); - DataFilter dataFilter = signature.getMethod().getAnnotation(DataFilter.class); - //获取表的别名 - String tableAlias = dataFilter.tableAlias(); - if(StringUtils.isNotBlank(tableAlias)){ - tableAlias += "."; + private void validateOpePermission(String requirePermission) { + StaffPermissionFormDTO staffPermissionFormDTO = new StaffPermissionFormDTO(); + staffPermissionFormDTO.setApp(loginUserUtil.getLoginUserApp()); + staffPermissionFormDTO.setClient(loginUserUtil.getLoginUserClient()); + staffPermissionFormDTO.setStaffId(loginUserUtil.getLoginUserId()); + Result> permissions = govAccessFeignClient.getStaffCurrPermissions(staffPermissionFormDTO); + if (permissions.getCode() != 0) { + // 查询不到权限,记录日志,抛出8000异常 + log.error("调用Access查询权限失败:{}", permissions.getMsg()); + throw new RenException(EpmetErrorCode.SERVER_ERROR.getCode()); } - StringBuilder sqlFilter = new StringBuilder(); - - //查询条件前缀 - String prefix = dataFilter.prefix(); - if(StringUtils.isNotBlank(prefix)){ - sqlFilter.append(" ").append(prefix); + if (!CollectionUtils.isEmpty(permissions.getData()) && StringUtils.isNotBlank(requirePermission) + && permissions.getData().contains(requirePermission)) { + // 权限允许,正常结束 + return; } + // 权限不足抛出异常 + throw new RenException(EpmetErrorCode.REQUIRE_PERMISSION.getCode()); + } - sqlFilter.append(" ("); - - //部门ID列表 - List deptIdList = user.getDeptIdList(); - if(CollUtil.isNotEmpty(deptIdList)){ - sqlFilter.append(tableAlias).append(dataFilter.deptId()); - - sqlFilter.append(" in(").append(StringUtils.join(deptIdList, ",")).append(")"); - } + /** + * 生成过滤sql片段 + * @return + */ + private String getSqlFilterSegment() { + // 根据角色列表查询操作范围列表 - //查询本人数据 - if (dataFilter.isPendingCreator()) { - if(CollUtil.isNotEmpty(deptIdList)){ - sqlFilter.append(" or "); - } - sqlFilter.append(tableAlias).append(dataFilter.userId()).append("=").append(user.getId()); - } - sqlFilter.append(")"); + // 拼接sql语句 - return sqlFilter.toString(); + // TODO + return "dept_id in (1,2,3)"; } + + ///** + // * 获取数据过滤的SQL + // */ + //@Deprecated + //private String getSqlFilter(UserDetail user, JoinPoint point){ + // MethodSignature signature = (MethodSignature) point.getSignature(); + // DataFilter dataFilter = signature.getMethod().getAnnotation(DataFilter.class); + // //获取表的别名 + // String tableAlias = dataFilter.tableAlias(); + // if(StringUtils.isNotBlank(tableAlias)){ + // tableAlias += "."; + // } + // + // StringBuilder sqlFilter = new StringBuilder(); + // + // //查询条件前缀 + // String prefix = dataFilter.prefix(); + // if(StringUtils.isNotBlank(prefix)){ + // sqlFilter.append(" ").append(prefix); + // } + // + // sqlFilter.append(" ("); + // + // //部门ID列表 + // List deptIdList = user.getDeptIdList(); + // if(CollUtil.isNotEmpty(deptIdList)){ + // sqlFilter.append(tableAlias).append(dataFilter.deptId()); + // + // sqlFilter.append(" in(").append(StringUtils.join(deptIdList, ",")).append(")"); + // } + // + // //查询本人数据 + // if (dataFilter.isPendingCreator()) { + // if(CollUtil.isNotEmpty(deptIdList)){ + // sqlFilter.append(" or "); + // } + // sqlFilter.append(tableAlias).append(dataFilter.userId()).append("=").append(user.getId()); + // } + // sqlFilter.append(")"); + // + // return sqlFilter.toString(); + //} } diff --git a/epmet-commons/epmet-commons-mybatis/src/main/java/com/epmet/commons/mybatis/aspect/DataFilterAspectBak.java b/epmet-commons/epmet-commons-mybatis/src/main/java/com/epmet/commons/mybatis/aspect/DataFilterAspectBak.java new file mode 100644 index 0000000000..2c4c532bda --- /dev/null +++ b/epmet-commons/epmet-commons-mybatis/src/main/java/com/epmet/commons/mybatis/aspect/DataFilterAspectBak.java @@ -0,0 +1,106 @@ +///** +// * Copyright (c) 2018 人人开源 All rights reserved. +// * +// * https://www.renren.io +// * +// * 版权所有,侵权必究! +// */ +// +//package com.epmet.commons.mybatis.aspect; +// +//import cn.hutool.core.collection.CollUtil; +//import com.epmet.commons.mybatis.annotation.DataFilter; +//import com.epmet.commons.mybatis.entity.DataScope; +//import com.epmet.commons.tools.constant.Constant; +//import com.epmet.commons.tools.enums.SuperAdminEnum; +//import com.epmet.commons.tools.exception.ErrorCode; +//import com.epmet.commons.tools.exception.RenException; +//import com.epmet.commons.tools.security.user.SecurityUser; +//import com.epmet.commons.tools.security.user.UserDetail; +//import org.apache.commons.lang3.StringUtils; +//import org.aspectj.lang.JoinPoint; +//import org.aspectj.lang.annotation.Aspect; +//import org.aspectj.lang.annotation.Before; +//import org.aspectj.lang.annotation.Pointcut; +//import org.aspectj.lang.reflect.MethodSignature; +//import org.springframework.stereotype.Component; +// +//import java.util.Arrays; +//import java.util.List; +//import java.util.Map; +// +///** +// * 数据过滤,切面处理类 +// * +// * @author Mark sunlightcs@gmail.com +// * @since 1.0.0 +// */ +//@Aspect +//@Component +//public class DataFilterAspectBak { +// @Pointcut("@annotation(com.epmet.commons.mybatis.annotation.DataFilter)") +// public void dataFilterCut() { +// +// } +// +// @Before("dataFilterCut()") +// public void dataFilter(JoinPoint point) { +// Object params = point.getArgs()[0]; +// if(params != null && params instanceof Map){ +// UserDetail user = SecurityUser.getUser(); +// +// //如果不是超级管理员,则进行数据过滤 +// if(user.getSuperAdmin() == SuperAdminEnum.NO.value()){ +// Map map = (Map)params; +// String sqlFilter = getSqlFilter(user, point); +// map.put(Constant.SQL_FILTER, new DataScope(sqlFilter)); +// } +// +// return ; +// } +// +// throw new RenException(ErrorCode.DATA_SCOPE_PARAMS_ERROR); +// } +// +// /** +// * 获取数据过滤的SQL +// */ +// private String getSqlFilter(UserDetail user, JoinPoint point){ +// MethodSignature signature = (MethodSignature) point.getSignature(); +// DataFilter dataFilter = signature.getMethod().getAnnotation(DataFilter.class); +// //获取表的别名 +// String tableAlias = dataFilter.tableAlias(); +// if(StringUtils.isNotBlank(tableAlias)){ +// tableAlias += "."; +// } +// +// StringBuilder sqlFilter = new StringBuilder(); +// +// //查询条件前缀 +// String prefix = dataFilter.prefix(); +// if(StringUtils.isNotBlank(prefix)){ +// sqlFilter.append(" ").append(prefix); +// } +// +// sqlFilter.append(" ("); +// +// //部门ID列表 +// List deptIdList = user.getDeptIdList(); +// if(CollUtil.isNotEmpty(deptIdList)){ +// sqlFilter.append(tableAlias).append(dataFilter.deptId()); +// +// sqlFilter.append(" in(").append(StringUtils.join(deptIdList, ",")).append(")"); +// } +// +// //查询本人数据 +// if (dataFilter.isPendingCreator()) { +// if(CollUtil.isNotEmpty(deptIdList)){ +// sqlFilter.append(" or "); +// } +// sqlFilter.append(tableAlias).append(dataFilter.userId()).append("=").append(user.getId()); +// } +// sqlFilter.append(")"); +// +// return sqlFilter.toString(); +// } +//} diff --git a/epmet-commons/epmet-commons-mybatis/src/main/java/com/epmet/commons/mybatis/dto/form/StaffPermissionFormDTO.java b/epmet-commons/epmet-commons-mybatis/src/main/java/com/epmet/commons/mybatis/dto/form/StaffPermissionFormDTO.java new file mode 100644 index 0000000000..3bc88d6fb1 --- /dev/null +++ b/epmet-commons/epmet-commons-mybatis/src/main/java/com/epmet/commons/mybatis/dto/form/StaffPermissionFormDTO.java @@ -0,0 +1,26 @@ +package com.epmet.commons.mybatis.dto.form; + +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import java.util.Set; + +@Data +public class StaffPermissionFormDTO { + + /** + * 工作人员 id + */ + private String staffId; + + /** + * 登录头信息app + */ + private String app; + + /** + * 登录头信息client + */ + private String client; + +} diff --git a/epmet-commons/epmet-commons-mybatis/src/main/java/com/epmet/commons/mybatis/entity/DataScope.java b/epmet-commons/epmet-commons-mybatis/src/main/java/com/epmet/commons/mybatis/entity/DataScope.java index 43d3ca1619..59dd035fac 100644 --- a/epmet-commons/epmet-commons-mybatis/src/main/java/com/epmet/commons/mybatis/entity/DataScope.java +++ b/epmet-commons/epmet-commons-mybatis/src/main/java/com/epmet/commons/mybatis/entity/DataScope.java @@ -1,8 +1,8 @@ /** * Copyright (c) 2018 人人开源 All rights reserved. - * + *

* https://www.renren.io - * + *

* 版权所有,侵权必究! */ @@ -15,8 +15,13 @@ package com.epmet.commons.mybatis.entity; * @since 1.0.0 */ public class DataScope { + private String sqlFilter; + public static DataScope getDefault() { + return new DataScope(""); + } + public DataScope(String sqlFilter) { this.sqlFilter = sqlFilter; } diff --git a/epmet-commons/epmet-commons-mybatis/src/main/java/com/epmet/commons/mybatis/feign/GovAccessFeignClient.java b/epmet-commons/epmet-commons-mybatis/src/main/java/com/epmet/commons/mybatis/feign/GovAccessFeignClient.java new file mode 100644 index 0000000000..198d996bc9 --- /dev/null +++ b/epmet-commons/epmet-commons-mybatis/src/main/java/com/epmet/commons/mybatis/feign/GovAccessFeignClient.java @@ -0,0 +1,26 @@ +package com.epmet.commons.mybatis.feign; + +import com.epmet.commons.mybatis.dto.form.StaffPermissionFormDTO; +import com.epmet.commons.mybatis.feign.fallback.GovAccessFeignClientFallback; +import com.epmet.commons.tools.constant.ServiceConstant; +import com.epmet.commons.tools.utils.Result; +import org.springframework.cloud.openfeign.FeignClient; +import org.springframework.web.bind.annotation.PostMapping; + +import java.util.Set; + +/** + * @Description + * @Author sun + */ +@FeignClient(name = ServiceConstant.GOV_ACCESS_SERVER, fallback = GovAccessFeignClientFallback.class) +public interface GovAccessFeignClient { + + /** + * 查询用户当前权限列表(DataFilterAspect中用到) + * @return + */ + @PostMapping("/gov/access/access/getcurrpermissions") + Result> getStaffCurrPermissions(StaffPermissionFormDTO dto); + +} diff --git a/epmet-commons/epmet-commons-mybatis/src/main/java/com/epmet/commons/mybatis/feign/fallback/GovAccessFeignClientFallback.java b/epmet-commons/epmet-commons-mybatis/src/main/java/com/epmet/commons/mybatis/feign/fallback/GovAccessFeignClientFallback.java new file mode 100644 index 0000000000..3c5ccd599b --- /dev/null +++ b/epmet-commons/epmet-commons-mybatis/src/main/java/com/epmet/commons/mybatis/feign/fallback/GovAccessFeignClientFallback.java @@ -0,0 +1,25 @@ +package com.epmet.commons.mybatis.feign.fallback; + +import com.epmet.commons.mybatis.dto.form.StaffPermissionFormDTO; +import com.epmet.commons.mybatis.feign.GovAccessFeignClient; +import com.epmet.commons.tools.constant.ServiceConstant; +import com.epmet.commons.tools.utils.ModuleUtils; +import com.epmet.commons.tools.utils.Result; +import org.springframework.stereotype.Component; + +import java.util.Set; + +/** + * 调用政府端权限 + * @Author wxz + * @Description + * @Date 2020/4/24 11:17 + **/ +@Component +public class GovAccessFeignClientFallback implements GovAccessFeignClient { + + @Override + public Result> getStaffCurrPermissions(StaffPermissionFormDTO dto) { + return ModuleUtils.feignConError(ServiceConstant.GOV_ACCESS_SERVER, "getStaffCurrPermissions", dto); + } +} diff --git a/epmet-commons/epmet-commons-mybatis/src/main/java/com/epmet/commons/mybatis/handler/FieldMetaObjectHandler.java b/epmet-commons/epmet-commons-mybatis/src/main/java/com/epmet/commons/mybatis/handler/FieldMetaObjectHandler.java index bd7d0619fd..fcd85b0c0e 100644 --- a/epmet-commons/epmet-commons-mybatis/src/main/java/com/epmet/commons/mybatis/handler/FieldMetaObjectHandler.java +++ b/epmet-commons/epmet-commons-mybatis/src/main/java/com/epmet/commons/mybatis/handler/FieldMetaObjectHandler.java @@ -22,6 +22,7 @@ import com.epmet.commons.tools.security.user.SecurityUser; import com.epmet.commons.tools.security.user.UserDetail; import org.apache.commons.lang3.StringUtils; import org.apache.ibatis.reflection.MetaObject; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; import java.util.Date; @@ -40,11 +41,14 @@ public class FieldMetaObjectHandler implements MetaObjectHandler { private final static String UPDATER = "updater"; private final static String DEPT_ID = "deptId"; + @Autowired + private LoginUserUtil loginUserUtil; + @Override public void insertFill(MetaObject metaObject) { Date date = new Date(); if (metaObject.getOriginalObject() instanceof BaseEpmetEntity) { - String loginUserId = LoginUserUtil.getLoginUserId(); + String loginUserId = loginUserUtil.getLoginUserId(); // epmet项目新增的 loginUserId = StringUtils.isBlank(loginUserId) ? Constant.APP_USER_FLAG : loginUserId; //Long deptId = user == null ? null : user.getDeptId(); @@ -107,7 +111,7 @@ public class FieldMetaObjectHandler implements MetaObjectHandler { //更新时间 setFieldValByName(UPDATE_DATE, new Date(), metaObject); } else if (fillEsuaEntity) { - String loginUserId = LoginUserUtil.getLoginUserId(); + String loginUserId = loginUserUtil.getLoginUserId(); String userId = StringUtils.isBlank(loginUserId) ? Constant.APP_USER_FLAG : loginUserId; setFieldValByName(FieldConstant.UPDATED_BY_HUMP, userId, metaObject); setFieldValByName(FieldConstant.UPDATED_TIME_HUMP, new Date(), metaObject); diff --git a/epmet-commons/epmet-commons-mybatis/src/main/java/com/epmet/commons/mybatis/interceptor/DataFilterInterceptor.java b/epmet-commons/epmet-commons-mybatis/src/main/java/com/epmet/commons/mybatis/interceptor/DataFilterInterceptor.java index eea6262cd4..046c012da4 100644 --- a/epmet-commons/epmet-commons-mybatis/src/main/java/com/epmet/commons/mybatis/interceptor/DataFilterInterceptor.java +++ b/epmet-commons/epmet-commons-mybatis/src/main/java/com/epmet/commons/mybatis/interceptor/DataFilterInterceptor.java @@ -8,6 +8,7 @@ package com.epmet.commons.mybatis.interceptor; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.toolkit.PluginUtils; import com.baomidou.mybatisplus.core.toolkit.StringUtils; import com.baomidou.mybatisplus.extension.handlers.AbstractSqlParserHandler; @@ -55,12 +56,17 @@ public class DataFilterInterceptor extends AbstractSqlParserHandler implements I // 判断参数里是否有DataScope对象 DataScope scope = null; if (paramObj instanceof DataScope) { + // 直接传入DataScope,不分页? scope = (DataScope) paramObj; } else if (paramObj instanceof Map) { + // 入参是一个Map for (Object arg : ((Map) paramObj).values()) { if (arg instanceof DataScope) { scope = (DataScope) arg; break; + } else if (arg instanceof QueryWrapper) { + // 通过Mybatis-plus封装的通用方法进行查询 + break; } } } diff --git a/epmet-commons/epmet-commons-mybatis/src/main/java/com/epmet/commons/mybatis/interceptor/DataFilterInterceptorBak.java b/epmet-commons/epmet-commons-mybatis/src/main/java/com/epmet/commons/mybatis/interceptor/DataFilterInterceptorBak.java new file mode 100644 index 0000000000..1a3445f0f5 --- /dev/null +++ b/epmet-commons/epmet-commons-mybatis/src/main/java/com/epmet/commons/mybatis/interceptor/DataFilterInterceptorBak.java @@ -0,0 +1,100 @@ +///** +// * Copyright (c) 2018 人人开源 All rights reserved. +// *

+// * https://www.renren.io +// *

+// * 版权所有,侵权必究! +// */ +// +//package com.epmet.commons.mybatis.interceptor; +// +//import com.baomidou.mybatisplus.core.toolkit.PluginUtils; +//import com.baomidou.mybatisplus.extension.handlers.AbstractSqlParserHandler; +//import com.epmet.commons.mybatis.entity.DataScope; +//import org.apache.ibatis.executor.statement.StatementHandler; +//import org.apache.ibatis.mapping.BoundSql; +//import org.apache.ibatis.mapping.MappedStatement; +//import org.apache.ibatis.mapping.SqlCommandType; +//import org.apache.ibatis.plugin.*; +//import org.apache.ibatis.reflection.MetaObject; +//import org.apache.ibatis.reflection.SystemMetaObject; +// +//import java.sql.Connection; +//import java.util.Map; +//import java.util.Properties; +// +///** +// * 数据过滤 +// * +// * @author Mark sunlightcs@gmail.com +// * @since 1.0.0 +// */ +//@Intercepts({@Signature(type = StatementHandler.class, method = "prepare", args = {Connection.class, Integer.class})}) +//public class DataFilterInterceptorBak extends AbstractSqlParserHandler implements Interceptor { +// +// @Override +// public Object intercept(Invocation invocation) throws Throwable { +// StatementHandler statementHandler = (StatementHandler) PluginUtils.realTarget(invocation.getTarget()); +// MetaObject metaObject = SystemMetaObject.forObject(statementHandler); +// +// // SQL解析 +// this.sqlParser(metaObject); +// +// // 先判断是不是SELECT操作 +// MappedStatement mappedStatement = (MappedStatement) metaObject.getValue("delegate.mappedStatement"); +// if (!SqlCommandType.SELECT.equals(mappedStatement.getSqlCommandType())) { +// return invocation.proceed(); +// } +// +// // 针对定义了rowBounds,做为mapper接口方法的参数 +// BoundSql boundSql = (BoundSql) metaObject.getValue("delegate.boundSql"); +// String originalSql = boundSql.getSql(); +// Object paramObj = boundSql.getParameterObject(); +// +// // 判断参数里是否有DataScope对象 +// DataScope scope = null; +// if (paramObj instanceof DataScope) { +// scope = (DataScope) paramObj; +// } else if (paramObj instanceof Map) { +// for (Object arg : ((Map) paramObj).values()) { +// if (arg instanceof DataScope) { +// scope = (DataScope) arg; +// break; +// } +// } +// } +// +// // 不用数据过滤 +// if (scope == null) { +// return invocation.proceed(); +// } +// +// // 拼接新SQL +// String orderBy = "ORDER BY"; +// String groupBy = "GROUP BY"; +// if (originalSql.indexOf(groupBy) > -1) { +// originalSql = originalSql.replace(groupBy, scope.getSqlFilter() + groupBy); +// } else if (originalSql.indexOf(orderBy) > -1) { +// originalSql = originalSql.replace(orderBy, scope.getSqlFilter() + orderBy); +// } else { +// originalSql = originalSql + scope.getSqlFilter(); +// } +// +// // 重写SQL +// metaObject.setValue("delegate.boundSql.sql", originalSql); +// return invocation.proceed(); +// } +// +// @Override +// public Object plugin(Object target) { +// if (target instanceof StatementHandler) { +// return Plugin.wrap(target, this); +// } +// return target; +// } +// +// @Override +// public void setProperties(Properties properties) { +// +// } +//} diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/annotation/RequirePermission.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/annotation/RequirePermission.java new file mode 100644 index 0000000000..3a5fe74459 --- /dev/null +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/annotation/RequirePermission.java @@ -0,0 +1,36 @@ +/** + * Copyright 2018 人人开源 http://www.renren.io + *

+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not + * use this file except in compliance with the License. You may obtain a copy of + * the License at + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

+ * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under + * the License. + */ + +package com.epmet.commons.tools.annotation; + +import java.lang.annotation.*; + +/** + * 权限注解 + * @Author wxz + * @Description + * @Date 2020/4/23 16:17 + **/ +@Target(ElementType.METHOD) +@Retention(RetentionPolicy.RUNTIME) +@Documented +public @interface RequirePermission { + + String key() default ""; + + String desc() default ""; + +} diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/aspect/AccessOpeAspect.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/aspect/AccessOpeAspect.java new file mode 100644 index 0000000000..eeeedc6508 --- /dev/null +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/aspect/AccessOpeAspect.java @@ -0,0 +1,46 @@ +/** + * Copyright (c) 2018 人人开源 All rights reserved. + * + * https://www.renren.io + * + * 版权所有,侵权必究! + */ + +package com.epmet.commons.tools.aspect; + +import com.epmet.commons.tools.annotation.RequirePermission; +import org.aspectj.lang.JoinPoint; +import org.aspectj.lang.annotation.Aspect; +import org.aspectj.lang.annotation.Before; +import org.aspectj.lang.reflect.MethodSignature; +import org.springframework.stereotype.Component; + +/** + * 每次请求,过滤Api中配置的权限key出来 + * @Author wxz + * @Description + * @Date 2020/4/23 16:16 + **/ +@Aspect +@Component +public class AccessOpeAspect { + + /** + * 存储所需操作权限的 ThreadLocal + */ + public static final ThreadLocal requirePermissionTl = new ThreadLocal<>(); + + @Before("@annotation(com.epmet.commons.tools.annotation.RequirePermission)") + public void before(JoinPoint point) throws Throwable { + // 取RequirePermission注解 + MethodSignature methodSignature = (MethodSignature) point.getSignature(); + RequirePermission requirePermissionAnno = methodSignature.getMethod().getAnnotation(RequirePermission.class); + String key = requirePermissionAnno.key(); + String desc = requirePermissionAnno.desc(); + System.out.println(key); + System.out.println(desc); + + // 放入ThreadLocal,供DataFilterAspect中使用 + requirePermissionTl.set(key); + } +} diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java index d07777427a..6fc0a1cbf5 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java @@ -27,7 +27,8 @@ public enum EpmetErrorCode { MESSAGE_SMS_SEND_ERROR(8105, "短信发送失败"), CANNOT_AUDIT_WARM(8201, "请完善居民信息"), - NOT_DEL_AGENCY(8202, "该机关存在下级机关,不允许删除"); + NOT_DEL_AGENCY(8202, "该机关存在下级机关,不允许删除"), + REQUIRE_PERMISSION(8203, "没有足够的操作权限"); private int code; diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/RenExceptionHandler.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/RenExceptionHandler.java index 5a035ffa80..e49e03d52d 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/RenExceptionHandler.java +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/RenExceptionHandler.java @@ -44,6 +44,8 @@ public class RenExceptionHandler { private ModuleConfig moduleConfig; @Autowired private LogProducer logProducer; + @Autowired + private LoginUserUtil loginUserUtil; /** * 处理自定义异常 @@ -120,7 +122,7 @@ public class RenExceptionHandler { //登录用户ID - log.setCreator(LoginUserUtil.getLoginUserId()); + log.setCreator(loginUserUtil.getLoginUserId()); //异常信息 log.setErrorInfo(ExceptionUtils.getErrorStackTrace(ex)); diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/security/dto/GovTokenDto.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/security/dto/GovTokenDto.java index bfb7e6dc67..7088bb10a3 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/security/dto/GovTokenDto.java +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/security/dto/GovTokenDto.java @@ -67,6 +67,6 @@ public class GovTokenDto extends BaseTokenDto implements Serializable { /** * 功能权限列表,实际上是gov_staff => staff_role => role_operation查询到的operationKey */ - private List permissions; + private Set permissions; } diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/security/user/LoginUserUtil.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/security/user/LoginUserUtil.java index 2b249bee22..088a26eb73 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/security/user/LoginUserUtil.java +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/security/user/LoginUserUtil.java @@ -1,33 +1,82 @@ package com.epmet.commons.tools.security.user; -import com.epmet.commons.tools.constant.Constant; +import com.epmet.commons.tools.constant.AppClientConstant; import com.epmet.commons.tools.utils.HttpContextUtils; import org.apache.commons.lang3.StringUtils; -import org.springframework.web.context.request.RequestAttributes; -import org.springframework.web.context.request.RequestContextHolder; -import org.springframework.web.context.request.ServletRequestAttributes; +import org.springframework.stereotype.Component; import javax.servlet.http.HttpServletRequest; +import java.util.List; /** * 登录用户相关工具 */ +@Component public class LoginUserUtil { + //@Autowired + //private + /** * 查询登录用户的id * @return */ - public static String getLoginUserId() { + public String getLoginUserId() { HttpServletRequest request = HttpContextUtils.getHttpServletRequest(); if (request == null) { return null; } - String userId = request.getHeader(Constant.USER_KEY); + String userId = request.getHeader(AppClientConstant.USER_ID); if (StringUtils.isBlank(userId)) { return null; } return userId; } + + /** + * 登录用户的App头信息 + * @return + */ + public String getLoginUserApp() { + HttpServletRequest request = HttpContextUtils.getHttpServletRequest(); + if (request == null) { + return null; + } + + String app = request.getHeader(AppClientConstant.APP); + if (StringUtils.isBlank(app)) { + return null; + } + return app; + } + + /** + * 获取登录用户client头信息 + * @return + */ + public String getLoginUserClient() { + HttpServletRequest request = HttpContextUtils.getHttpServletRequest(); + if (request == null) { + return null; + } + + String client = request.getHeader(AppClientConstant.CLIENT); + if (StringUtils.isBlank(client)) { + return null; + } + return client; + } + + /** + * 获取用户的部门ID列表 + * @return + */ + public List getLoginUserDepartments() { + String loginUserId = getLoginUserId(); + String loginUserApp = getLoginUserApp(); + String loginUserClient = getLoginUserClient(); + // todo + return null; + } } diff --git a/epmet-gateway/pom.xml b/epmet-gateway/pom.xml index 57d6203598..7ccab3e048 100644 --- a/epmet-gateway/pom.xml +++ b/epmet-gateway/pom.xml @@ -157,12 +157,12 @@ lb://resi-partymember-server - - lb://gov-access-server + http://127.0.0.1:8099 + - - lb://gov-mine-server + http://127.0.0.1:8098 + diff --git a/epmet-gateway/src/main/java/com/epmet/filter/FeignRequestFilter.java b/epmet-gateway/src/main/java/com/epmet/filter/FeignRequestFilter.java index 1b98025d7c..1da14ce7ef 100644 --- a/epmet-gateway/src/main/java/com/epmet/filter/FeignRequestFilter.java +++ b/epmet-gateway/src/main/java/com/epmet/filter/FeignRequestFilter.java @@ -1,5 +1,6 @@ package com.epmet.filter; +import com.epmet.commons.tools.constant.AppClientConstant; import com.epmet.commons.tools.constant.Constant; import com.epmet.commons.tools.security.dto.BaseTokenDto; import com.epmet.commons.tools.utils.CpUserDetailRedis; @@ -54,7 +55,7 @@ public class FeignRequestFilter implements GlobalFilter, UserTokenFilter { if (baseTokenDto != null) { ServerHttpRequest build = exchange.getRequest().mutate() - .header(Constant.USER_KEY, new String[]{baseTokenDto.getUserId()}).build(); + .header(AppClientConstant.USER_ID, new String[]{baseTokenDto.getUserId()}).build(); return chain.filter(exchange.mutate().request(build).build()); } diff --git a/epmet-module/gov-access/gov-access-client/src/main/java/com/epmet/dto/form/StaffPermCacheFormDTO.java b/epmet-module/gov-access/gov-access-client/src/main/java/com/epmet/dto/form/StaffPermCacheFormDTO.java index b800d6bc1a..56907e52af 100644 --- a/epmet-module/gov-access/gov-access-client/src/main/java/com/epmet/dto/form/StaffPermCacheFormDTO.java +++ b/epmet-module/gov-access/gov-access-client/src/main/java/com/epmet/dto/form/StaffPermCacheFormDTO.java @@ -3,7 +3,7 @@ package com.epmet.dto.form; import lombok.Data; import javax.validation.constraints.NotBlank; -import java.util.List; +import java.util.Set; @Data public class StaffPermCacheFormDTO { @@ -13,27 +13,32 @@ public class StaffPermCacheFormDTO { */ public interface UpdatePermissionCache {} + /** + * 查询当前权限列表 + */ + public interface GetStaffCurrPermissions {} + /** * 工作人员 id */ - @NotBlank(message = "工作人员ID不能为空", groups = {UpdatePermissionCache.class}) + @NotBlank(message = "工作人员ID不能为空", groups = {UpdatePermissionCache.class, GetStaffCurrPermissions.class}) private String staffId; /** * 登录头信息app */ - @NotBlank(message = "登录头信息app不能为空", groups = {UpdatePermissionCache.class}) + @NotBlank(message = "登录头信息app不能为空", groups = {UpdatePermissionCache.class, GetStaffCurrPermissions.class}) private String app; /** * 登录头信息client */ - @NotBlank(message = "登录头信息client不能为空", groups = {UpdatePermissionCache.class}) + @NotBlank(message = "登录头信息client不能为空", groups = {UpdatePermissionCache.class, GetStaffCurrPermissions.class}) private String client; /** * 权限列表 */ - private List permissions; + private Set permissions; } diff --git a/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/controller/AccessController.java b/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/controller/AccessController.java index 0f7eaf4920..aa954dc584 100644 --- a/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/controller/AccessController.java +++ b/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/controller/AccessController.java @@ -10,7 +10,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.List; +import java.util.Set; /** * 权限相关Api @@ -36,8 +36,19 @@ public class AccessController { String staffId = staffPermCacheFormDTO.getStaffId(); String app = staffPermCacheFormDTO.getApp(); String client = staffPermCacheFormDTO.getClient(); - List permissions = staffPermCacheFormDTO.getPermissions(); + Set permissions = staffPermCacheFormDTO.getPermissions(); accessService.updatePermissionCache(staffId, app, client, permissions); return new Result(); } + + /** + * 查询用户当前权限列表(DataFilterAspect中用到) + * @return + */ + @PostMapping("getcurrpermissions") + public Result> getStaffCurrPermissions(@RequestBody StaffPermCacheFormDTO dto) { + ValidatorUtils.validateEntity(dto, StaffPermCacheFormDTO.GetStaffCurrPermissions.class); + Set permissions = accessService.listStaffCurrPermissions(dto.getApp(), dto.getClient(), dto.getStaffId()); + return new Result>().ok(permissions); + } } diff --git a/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/service/AccessService.java b/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/service/AccessService.java index cbf51355d1..a9e5150db8 100644 --- a/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/service/AccessService.java +++ b/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/service/AccessService.java @@ -1,6 +1,6 @@ package com.epmet.service; -import java.util.List; +import java.util.Set; public interface AccessService { /** @@ -8,5 +8,11 @@ public interface AccessService { * @param staffId * @param permissions */ - void updatePermissionCache(String staffId, String app, String client, List permissions); + void updatePermissionCache(String staffId, String app, String client, Set permissions); + + /** + * 查询用户当前权限列表 + * @return + */ + Set listStaffCurrPermissions(String app, String client, String staffId); } diff --git a/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/service/impl/AccessServiceImpl.java b/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/service/impl/AccessServiceImpl.java index e391283e94..cd846aa3b8 100644 --- a/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/service/impl/AccessServiceImpl.java +++ b/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/service/impl/AccessServiceImpl.java @@ -7,8 +7,10 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; +import org.springframework.util.CollectionUtils; -import java.util.List; +import java.util.HashSet; +import java.util.Set; @Service public class AccessServiceImpl implements AccessService { @@ -24,7 +26,7 @@ public class AccessServiceImpl implements AccessService { * @param permissions */ @Override - public void updatePermissionCache(String staffId, String app, String client, List permissions) { + public void updatePermissionCache(String staffId, String app, String client, Set permissions) { GovTokenDto govTokenDto = cpUserDetailRedis.get(app, client, staffId, GovTokenDto.class); if (govTokenDto == null) { logger.warn("更新[{}]用户缓存:Redis中不存在该用户TokenDto缓存信息", staffId); @@ -37,4 +39,13 @@ public class AccessServiceImpl implements AccessService { cpUserDetailRedis.set(govTokenDto, expire); logger.warn("更新[{}]用户缓存成功。", staffId); } + + @Override + public Set listStaffCurrPermissions(String app, String client, String staffId) { + GovTokenDto govTokenDto = cpUserDetailRedis.get(app, client, staffId, GovTokenDto.class); + if (govTokenDto == null || CollectionUtils.isEmpty(govTokenDto.getPermissions())) { + return new HashSet<>(); + } + return new HashSet<>(govTokenDto.getPermissions()); + } } diff --git a/epmet-module/gov-access/gov-access-server/src/main/resources/db.migration/epmet_gov_access.sql b/epmet-module/gov-access/gov-access-server/src/main/resources/db.migration/epmet_gov_access.sql index 67e7a5c7b2..bcc1d74a5d 100644 --- a/epmet-module/gov-access/gov-access-server/src/main/resources/db.migration/epmet_gov_access.sql +++ b/epmet-module/gov-access/gov-access-server/src/main/resources/db.migration/epmet_gov_access.sql @@ -61,7 +61,7 @@ CREATE TABLE `role_operation` ( CREATE TABLE `role_scope` ( `ID` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, `ROLE_ID` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '角色ID', - `PERMISSION_KEY` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '权限key', + `SCOPE_KEY` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '范围Key', `DEL_FLAG` tinyint(1) NULL DEFAULT NULL COMMENT '是否删除,0:未删除,1:已删除', `REVISION` int(10) NULL DEFAULT NULL COMMENT '乐观锁', `CREATED_BY` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '创建者id', diff --git a/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/controller/AccessController.java b/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/controller/AccessController.java index 9cef45a3b4..173e19243a 100644 --- a/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/controller/AccessController.java +++ b/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/controller/AccessController.java @@ -29,14 +29,21 @@ public class AccessController { @Autowired private AccessService accessService; + /** + * 查询用户可操作功能列表(包含缓存) + * @param tokenDto + * @param staffOperationDTO + * @return + */ @PostMapping("getstaffoperations") public Result> getStaffOperations(@LoginUser TokenDto tokenDto, @RequestBody StaffOperationDTO staffOperationDTO) { //public Result> getStaffOperations(@RequestBody StaffOperationDTO staffOperationDTO) { String agencyId = staffOperationDTO.getAgencyId(); String gridId = staffOperationDTO.getGridId(); String staffId = tokenDto.getUserId(); - Set opeKeys = accessService.listOpeKeysByStaffId(staffId, agencyId, gridId); + String app = tokenDto.getApp(); + String client = tokenDto.getClient(); + Set opeKeys = accessService.listOpeKeysByStaffId(app, client, staffId,agencyId, gridId); return new Result>().ok(opeKeys); } - } diff --git a/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/feign/GovAccessFeignClient.java b/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/feign/GovAccessFeignClient.java index facacdb301..8cb514ad3f 100644 --- a/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/feign/GovAccessFeignClient.java +++ b/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/feign/GovAccessFeignClient.java @@ -2,14 +2,13 @@ package com.epmet.feign; import com.epmet.commons.tools.constant.ServiceConstant; import com.epmet.commons.tools.utils.Result; -import com.epmet.dto.result.CustomerGridByUserIdResultDTO; +import com.epmet.dto.form.StaffPermCacheFormDTO; import com.epmet.dto.result.RoleOperationResultDTO; import com.epmet.feign.fallback.GovAccessFeignClientFallback; -import com.epmet.feign.fallback.GovOrgFeignClientFallBack; import org.springframework.cloud.openfeign.FeignClient; -import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; import java.util.List; @@ -20,6 +19,19 @@ import java.util.List; @FeignClient(name = ServiceConstant.GOV_ACCESS_SERVER, fallback = GovAccessFeignClientFallback.class) public interface GovAccessFeignClient { + /** + * 根据角色ID查询角色权限列表 + * @param roleId + * @return + */ @PostMapping("/gov/access/role/operations/{roleId}") Result> listOperationsByRoleId(@PathVariable("roleId") String roleId); + + /** + * 刷新用户权限缓存 + * @param staffPermCacheFormDTO + * @return + */ + @PostMapping("/gov/access/access/updatepermissioncache") + Result updatePermissionCache(@RequestBody StaffPermCacheFormDTO staffPermCacheFormDTO); } diff --git a/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/feign/fallback/GovAccessFeignClientFallback.java b/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/feign/fallback/GovAccessFeignClientFallback.java index 0fc5df6a94..3e9fc8e415 100644 --- a/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/feign/fallback/GovAccessFeignClientFallback.java +++ b/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/feign/fallback/GovAccessFeignClientFallback.java @@ -3,14 +3,11 @@ package com.epmet.feign.fallback; import com.epmet.commons.tools.constant.ServiceConstant; import com.epmet.commons.tools.utils.ModuleUtils; import com.epmet.commons.tools.utils.Result; -import com.epmet.dto.StaffRoleDTO; -import com.epmet.dto.form.StaffRoleFormDTO; -import com.epmet.dto.result.CustomerGridByUserIdResultDTO; -import com.epmet.dto.result.LatestCustomerResultDTO; +import com.epmet.dto.form.StaffPermCacheFormDTO; import com.epmet.dto.result.RoleOperationResultDTO; -import com.epmet.feign.EpmetUserFeignClient; import com.epmet.feign.GovAccessFeignClient; import org.springframework.stereotype.Component; +import org.springframework.web.bind.annotation.RequestBody; import java.util.List; @@ -25,4 +22,14 @@ public class GovAccessFeignClientFallback implements GovAccessFeignClient { public Result> listOperationsByRoleId(String roleId) { return ModuleUtils.feignConError(ServiceConstant.GOV_ACCESS_SERVER, "listOperationsByRoleId"); } + + /** + * 刷新用户权限缓存 + * @param staffPermCacheFormDTO + * @return + */ + @Override + public Result updatePermissionCache(@RequestBody StaffPermCacheFormDTO staffPermCacheFormDTO) { + return ModuleUtils.feignConError(ServiceConstant.GOV_ACCESS_SERVER, "updatePermissionCache"); + } } diff --git a/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/service/AccessService.java b/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/service/AccessService.java index bb213bd94d..9866ea9ffd 100644 --- a/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/service/AccessService.java +++ b/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/service/AccessService.java @@ -12,8 +12,7 @@ import java.util.Set; public interface AccessService { /** * 根据staffId查询角色Key列表 - * @param staffId * @return */ - Set listOpeKeysByStaffId(String staffId, String agencyId, String gridId); + Set listOpeKeysByStaffId(String app, String client, String staffId, String agencyId, String gridId); } diff --git a/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/service/impl/AccessServiceImpl.java b/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/service/impl/AccessServiceImpl.java index c7823cd335..1da258978a 100644 --- a/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/service/impl/AccessServiceImpl.java +++ b/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/service/impl/AccessServiceImpl.java @@ -1,8 +1,9 @@ package com.epmet.service.impl; +import com.epmet.commons.tools.utils.CpUserDetailRedis; import com.epmet.commons.tools.utils.Result; import com.epmet.dto.GovStaffRoleDTO; -import com.epmet.dto.StaffRoleDTO; +import com.epmet.dto.form.StaffPermCacheFormDTO; import com.epmet.dto.form.StaffRoleFormDTO; import com.epmet.dto.result.RoleOperationResultDTO; import com.epmet.feign.EpmetUserFeignClient; @@ -26,8 +27,11 @@ public class AccessServiceImpl implements AccessService { @Autowired private GovAccessFeignClient govAccessFeignClient; + @Autowired + private CpUserDetailRedis cpUserDetailRedis; + @Override - public Set listOpeKeysByStaffId(String staffId, String agencyId, String gridId) { + public Set listOpeKeysByStaffId(String app, String client, String staffId, String agencyId, String gridId) { List roleDTOS = new ArrayList<>(); // 查询机关单位权限 StaffRoleFormDTO formDTO = new StaffRoleFormDTO(); @@ -56,6 +60,14 @@ public class AccessServiceImpl implements AccessService { } }); }); + + // 将最新权限缓存到redis,为了尽量统一操作入口,调用gov-access接口实现 + StaffPermCacheFormDTO staffPermCacheFormDTO = new StaffPermCacheFormDTO(); + staffPermCacheFormDTO.setApp(app); + staffPermCacheFormDTO.setClient(client); + staffPermCacheFormDTO.setStaffId(staffId); + staffPermCacheFormDTO.setPermissions(opeKeys); + govAccessFeignClient.updatePermissionCache(staffPermCacheFormDTO); return opeKeys; } } 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 1c13ea4518..884db53afd 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 @@ -60,6 +60,7 @@ public class StaffRoleController { * @return */ @PostMapping("staffsinrole") + //@RequirePermission(key = "org_staff_list") public Result> getStaffsInRole(@RequestBody StaffRoleFormDTO staffRoleFormDTO) { ValidatorUtils.validateEntity(staffRoleFormDTO, StaffRoleFormDTO.GetStaffsInRole.class); String roleKey = staffRoleFormDTO.getRoleKey(); 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 ddcd8abe3b..739d20e945 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 @@ -108,6 +108,7 @@ public class StaffRoleServiceImpl extends BaseServiceImpl listStaffsInRole(String roleKey, String orgId) { return baseDao.listStaffIdsByRoleKeyAndOrgId(roleKey, orgId); } From d5b49c215836dc9b2e38d855934d1d1f464db231 Mon Sep 17 00:00:00 2001 From: zxc <954985705@qq.com> Date: Fri, 24 Apr 2020 14:09:33 +0800 Subject: [PATCH 68/85] =?UTF-8?q?=E7=BD=91=E6=A0=BC=E5=88=A0=E9=99=A4?= =?UTF-8?q?=E3=80=81=E4=BF=AE=E6=94=B9=E3=80=81=E6=B7=BB=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../tools/exception/EpmetErrorCode.java | 1 + .../java/com/epmet/dto/GridStaffCountDTO.java | 21 ++++++ .../main/java/com/epmet/dto/UserIdDTO.java | 21 ++++++ .../com/epmet/dto/form/AddGridFormDTO.java | 31 ++++++++ .../com/epmet/dto/form/DeleteGridFormDTO.java | 30 ++++++++ .../com/epmet/dto/form/EditGridFormDTO.java | 31 ++++++++ .../epmet/dto/result/AddGridResultDTO.java | 21 ++++++ .../com/epmet/controller/GridController.java | 37 +++++++++- .../java/com/epmet/dao/CustomerGridDao.java | 38 ++++++++++ .../com/epmet/feign/EpmetUserFeignClient.java | 5 ++ .../EpmetUserFeignClientFallBack.java | 6 ++ .../epmet/service/CustomerGridService.java | 27 ++++++- .../service/impl/CustomerGridServiceImpl.java | 74 ++++++++++++++++--- .../main/resources/mapper/CustomerGridDao.xml | 56 ++++++++++++++ .../controller/CustomerStaffController.java | 9 ++- .../java/com/epmet/dao/CustomerStaffDao.java | 12 ++- .../epmet/service/CustomerStaffService.java | 9 +++ .../impl/CustomerStaffServiceImpl.java | 15 ++++ .../resources/mapper/CustomerStaffDao.xml | 12 +++ 19 files changed, 436 insertions(+), 20 deletions(-) create mode 100644 epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/GridStaffCountDTO.java create mode 100644 epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/UserIdDTO.java create mode 100644 epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/AddGridFormDTO.java create mode 100644 epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/DeleteGridFormDTO.java create mode 100644 epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/EditGridFormDTO.java create mode 100644 epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/AddGridResultDTO.java diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java index 6fc0a1cbf5..01d63ec781 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java @@ -25,6 +25,7 @@ public enum EpmetErrorCode { AUTO_CONFIRM_FAILED(8103, "党员注册失败"), MOBILE_GET_CODE_ERROR(8104,"获取验证码失败"), MESSAGE_SMS_SEND_ERROR(8105, "短信发送失败"), + NOT_DEL_GRID(8106,"该网格存在工作人员,不允许删除"), CANNOT_AUDIT_WARM(8201, "请完善居民信息"), NOT_DEL_AGENCY(8202, "该机关存在下级机关,不允许删除"), diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/GridStaffCountDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/GridStaffCountDTO.java new file mode 100644 index 0000000000..fcdbe3ed04 --- /dev/null +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/GridStaffCountDTO.java @@ -0,0 +1,21 @@ +package com.epmet.dto; + +import lombok.Data; + +import java.io.Serializable; + +/** + * @Auther zxc + * @Create 2020-04-24 9:13 + */ +@Data +public class GridStaffCountDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 网格下未被禁用的工作人员数量 + */ + private Integer enableCount; + +} diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/UserIdDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/UserIdDTO.java new file mode 100644 index 0000000000..65ed41cab6 --- /dev/null +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/UserIdDTO.java @@ -0,0 +1,21 @@ +package com.epmet.dto; + +import lombok.Data; + +import java.io.Serializable; + +/** + * @Auther zxc + * @Create 2020-04-24 9:06 + */ +@Data +public class UserIdDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * userId + */ + private String userId; + +} diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/AddGridFormDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/AddGridFormDTO.java new file mode 100644 index 0000000000..95df5fca15 --- /dev/null +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/AddGridFormDTO.java @@ -0,0 +1,31 @@ +package com.epmet.dto.form; + +import lombok.Data; + +import java.io.Serializable; + +/** + * @Auther zxc + * @Create 2020-04-23 16:42 + */ +@Data +public class AddGridFormDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 机构id + */ + private String agencyId; + + /** + * 新建网格名称 + */ + private String gridName; + + /** + * 管辖区域 + */ + private String manageDistrict; + +} diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/DeleteGridFormDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/DeleteGridFormDTO.java new file mode 100644 index 0000000000..ed266210ba --- /dev/null +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/DeleteGridFormDTO.java @@ -0,0 +1,30 @@ +package com.epmet.dto.form; + +import lombok.Data; + +import java.io.Serializable; + +/** + * @Auther zxc + * @Create 2020-04-23 19:18 + */ +@Data +public class DeleteGridFormDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 网格id + */ + private String gridId; + + /** + * 工作人员id + */ + private String staffId; + + /** + * userId + */ + private String userId; +} diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/EditGridFormDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/EditGridFormDTO.java new file mode 100644 index 0000000000..2c5556f7a3 --- /dev/null +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/EditGridFormDTO.java @@ -0,0 +1,31 @@ +package com.epmet.dto.form; + +import lombok.Data; + +import java.io.Serializable; + +/** + * @Auther zxc + * @Create 2020-04-23 19:12 + */ +@Data +public class EditGridFormDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * gridId 网格id + */ + private String gridId; + + /** + * 网格名称 + */ + private String gridName; + + /** + * 管理区域 + */ + private String manageDistrict; + +} diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/AddGridResultDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/AddGridResultDTO.java new file mode 100644 index 0000000000..eedf5c895a --- /dev/null +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/AddGridResultDTO.java @@ -0,0 +1,21 @@ +package com.epmet.dto.result; + +import lombok.Data; + +import java.io.Serializable; + +/** + * @Auther zxc + * @Create 2020-04-23 16:45 + */ +@Data +public class AddGridResultDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * gridId 网格id + */ + private String gridId; + +} 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..f3b19c5027 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,7 +1,13 @@ 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.CustomerGridFormDTO; +import com.epmet.dto.form.DeleteGridFormDTO; +import com.epmet.dto.form.EditGridFormDTO; +import com.epmet.dto.result.AddGridResultDTO; import com.epmet.dto.result.GridDetailResultDTO; import com.epmet.service.CustomerGridService; import org.springframework.beans.factory.annotation.Autowired; @@ -21,16 +27,41 @@ public class GridController { @Autowired private CustomerGridService customerGridService; + /** + * 获取网格详情 + * @param customerGridFormDTO + * @return + */ @PostMapping("griddetail") - public Result griddetail(@RequestBody CustomerGridFormDTO customerGridFormDTO){ + public Result gridDetail(@LoginUser TokenDto tokenDto,@RequestBody CustomerGridFormDTO customerGridFormDTO){ Result griddetail = customerGridService.griddetail(customerGridFormDTO); return griddetail; } - /*@PostMapping("addgrid") + /** + * 新建当前机关下的所属网格 + */ + @PostMapping("addgrid") + public Result addGrid(@LoginUser TokenDto tokenDto, @RequestBody AddGridFormDTO addGridFormDTO){ + return customerGridService.addGrid(tokenDto,addGridFormDTO); + } + + /** + * 管理员修改网格信息 + */ @PostMapping("editgrid") + public Result editGrid(@LoginUser TokenDto tokenDto, @RequestBody EditGridFormDTO editGridFormDTO){ + return customerGridService.editGrid(tokenDto,editGridFormDTO); - @PostMapping("deletegrid")*/ + } + + /** + * 删除网格 + */ + @PostMapping("deletegrid") + public Result deleteGrid(@LoginUser TokenDto tokenDto, @RequestBody DeleteGridFormDTO deleteGridFormDTO){ + return customerGridService.deleteGrid(tokenDto,deleteGridFormDTO); + } } 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..d15a7c7032 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 @@ -18,15 +18,19 @@ package com.epmet.dao; import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.commons.tools.utils.Result; import com.epmet.dto.CustomerGridDTO; import com.epmet.dto.CustomerStaffGridDTO; import com.epmet.dto.form.CustomerGridFormDTO; +import com.epmet.dto.form.DeleteGridFormDTO; import com.epmet.dto.form.ListCustomerGridFormDTO; +import com.epmet.dto.result.AddGridResultDTO; import com.epmet.dto.result.CustomerGridByUserIdResultDTO; import com.epmet.dto.result.CustomerGridForStrangerResultDTO; import com.epmet.dto.result.GridDetailResultDTO; 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 +90,38 @@ public interface CustomerGridDao extends BaseDao { */ List selectUserIdByGridId(CustomerGridFormDTO customerGridFormDTO); + /** + * 根据userId查询customerId + * @param userId + * @return + */ + String selectCustomerIdByUserId(@Param("userId") String userId); + + /** + * 根据pid查询pids + * @param pid + * @return + */ + String selectPidsByPid(@Param("pid")String pid); + + /** + * 根据gridName查询gridId + * @param gridName + * @return + */ + String selectGridIdByGridName(@Param("gridName")String gridName); + + /** + * 编辑网格信息 + * @param customerGridDTO + */ + void editGrid(CustomerGridDTO customerGridDTO); + + /** + * 删除网格 + * @param deleteGridFormDTO + */ + void deleteGrid(DeleteGridFormDTO deleteGridFormDTO); + + } \ 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 217d37c0bb..42465e7055 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 @@ -2,6 +2,7 @@ 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.CustomerStaffDTO; import com.epmet.dto.CustomerStaffGridDTO; import com.epmet.dto.StaffGridListDTO; @@ -9,6 +10,7 @@ import com.epmet.dto.form.StaffsInAgencyFromDTO; import com.epmet.dto.result.StaffInfoResultDTO; import com.epmet.feign.fallback.EpmetUserFeignClientFallBack; import org.springframework.cloud.openfeign.FeignClient; +import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; @@ -43,4 +45,7 @@ public interface EpmetUserFeignClient { @PostMapping("/epmetuser/customerstaff/staffsinagency") Result> getStaffInfoForHome(StaffsInAgencyFromDTO fromDTO); + @PostMapping(value = "/epmetuser/customerstaff/selectgridstaffcountbyuserid") + Result selectGridStaffCountByUserId(@RequestBody UserIdDTO userIdDTO); + } 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 a4cf20b805..aa0149a726 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 @@ -3,6 +3,7 @@ package com.epmet.feign.fallback; import com.epmet.commons.tools.constant.ServiceConstant; import com.epmet.commons.tools.utils.ModuleUtils; import com.epmet.commons.tools.utils.Result; +import com.epmet.dto.*; import com.epmet.dto.CustomerStaffDTO; import com.epmet.dto.CustomerStaffGridDTO; import com.epmet.dto.StaffGridListDTO; @@ -32,4 +33,9 @@ public class EpmetUserFeignClientFallBack implements EpmetUserFeignClient { public Result> getStaffInfoForHome(StaffsInAgencyFromDTO fromDTO) { return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "getStaffInfoForHome", fromDTO); } + + @Override + public Result selectGridStaffCountByUserId(UserIdDTO userIdDTO) { + return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "selectGridStaffCountByUserId", userIdDTO); + } } 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..41390fe5e5 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 @@ -18,15 +18,18 @@ package com.epmet.service; import com.epmet.commons.mybatis.service.BaseService; +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.Result; import com.epmet.dto.CustomerGridDTO; -import com.epmet.dto.form.CustomerGridFormDTO; -import com.epmet.dto.form.ListCustomerGridFormDTO; +import com.epmet.dto.form.*; +import com.epmet.dto.result.AddGridResultDTO; import com.epmet.dto.result.CustomerGridByUserIdResultDTO; import com.epmet.dto.result.CustomerGridForStrangerResultDTO; import com.epmet.dto.result.GridDetailResultDTO; import com.epmet.entity.CustomerGridEntity; +import org.springframework.web.bind.annotation.RequestBody; import java.util.List; import java.util.Map; @@ -130,4 +133,24 @@ public interface CustomerGridService extends BaseService { * @return */ Result griddetail(CustomerGridFormDTO customerGridFormDTO); + + /** + * 新建当前机关下的所属网格 + */ + Result addGrid(TokenDto tokenDto, AddGridFormDTO addGridFormDTO); + + /** + * 修改网格信息 + * @param tokenDto + * @param editGridFormDTO + */ + Result editGrid(TokenDto tokenDto,EditGridFormDTO editGridFormDTO); + + /** + * 删除网格 + * @param tokenDto + * @param deleteGridFormDTO + * @return + */ + Result deleteGrid(TokenDto tokenDto,DeleteGridFormDTO deleteGridFormDTO); } \ 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..a53a6bac1c 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 @@ -21,15 +21,17 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; import com.epmet.commons.tools.constant.FieldConstant; +import com.epmet.commons.tools.exception.EpmetErrorCode; +import com.epmet.commons.tools.exception.ErrorCode; +import com.epmet.commons.tools.exception.RenException; import com.epmet.commons.tools.page.PageData; +import com.epmet.commons.tools.security.dto.TokenDto; import com.epmet.commons.tools.utils.ConvertUtils; import com.epmet.commons.tools.utils.Result; 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.CustomerGridFormDTO; -import com.epmet.dto.form.ListCustomerGridFormDTO; +import com.epmet.dto.*; +import com.epmet.dto.form.*; +import com.epmet.dto.result.AddGridResultDTO; import com.epmet.dto.result.CustomerGridByUserIdResultDTO; import com.epmet.dto.result.CustomerGridForStrangerResultDTO; import com.epmet.dto.result.GridDetailResultDTO; @@ -43,10 +45,7 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; -import java.util.Arrays; -import java.util.HashMap; -import java.util.List; -import java.util.Map; +import java.util.*; /** * 客户网格表 @@ -169,6 +168,11 @@ public class CustomerGridServiceImpl extends BaseServiceImpl>().ok(baseDao.getMyGrids(userId)); } + /** + * 查询网格详情 + * @param customerGridFormDTO + * @return + */ @Override public Result griddetail(CustomerGridFormDTO customerGridFormDTO) { GridDetailResultDTO griddetail = baseDao.griddetail(customerGridFormDTO); @@ -178,4 +182,56 @@ public class CustomerGridServiceImpl extends BaseServiceImpl().ok(griddetail); } + @Override + @Transactional(rollbackFor = Exception.class) + public Result addGrid(TokenDto tokenDto, AddGridFormDTO addGridFormDTO) { + CustomerGridEntity customerGridEntity = new CustomerGridEntity(); + customerGridEntity.setCustomerId(baseDao.selectCustomerIdByUserId(tokenDto.getUserId())); + customerGridEntity.setGridName(addGridFormDTO.getGridName()); + customerGridEntity.setDelFlag("0"); + customerGridEntity.setCreatedBy(tokenDto.getUserId()); + customerGridEntity.setUpdatedBy(tokenDto.getUserId()); + customerGridEntity.setTotalUser(0); + customerGridEntity.setManageDistrict(addGridFormDTO.getManageDistrict()); + customerGridEntity.setPid(addGridFormDTO.getAgencyId()); + customerGridEntity.setPids(baseDao.selectPidsByPid(addGridFormDTO.getAgencyId())); + baseDao.insert(customerGridEntity); + String gridId = baseDao.selectGridIdByGridName(addGridFormDTO.getGridName()); + AddGridResultDTO addGridResultDTO = new AddGridResultDTO(); + addGridResultDTO.setGridId(gridId); + return new Result().ok(addGridResultDTO); + } + + /** + * 修改网格信息 + * @param tokenDto + * @param editGridFormDTO + */ + @Override + @Transactional(rollbackFor = Exception.class) + public Result editGrid(TokenDto tokenDto, EditGridFormDTO editGridFormDTO) { + CustomerGridDTO customerGridDTO = new CustomerGridDTO(); + customerGridDTO.setManageDistrict(editGridFormDTO.getManageDistrict()); + customerGridDTO.setGridName(editGridFormDTO.getGridName()); + customerGridDTO.setUpdatedBy(tokenDto.getUserId()); + customerGridDTO.setId(editGridFormDTO.getGridId()); + baseDao.editGrid(customerGridDTO); + return new Result(); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public Result deleteGrid(TokenDto tokenDto,DeleteGridFormDTO deleteGridFormDTO) { + UserIdDTO userIdDTO = new UserIdDTO(); + userIdDTO.setUserId(tokenDto.getUserId()); + deleteGridFormDTO.setUserId(tokenDto.getUserId()); + Result gridStaffCountDTOResult = epmetUserFeignClient.selectGridStaffCountByUserId(userIdDTO); + if (gridStaffCountDTOResult.getData().getEnableCount()==0){ + baseDao.deleteGrid(deleteGridFormDTO); + }else { + return new Result().error(EpmetErrorCode.NOT_DEL_GRID.getCode()); + } + return new Result(); + } + } 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 574084079e..c7a54db7b9 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 @@ -138,4 +138,60 @@ AND grid_id = #{gridId} + + + + + + + + + + + + update + customer_grid + set + grid_name = #{gridName}, + manage_district = #{manageDistrict}, + updated_by = #{updatedBy} + where + id = #{id} + + + + + update + customer_grid + set + updated_by = #{userId}, + del_flag = 1 + where + id = #{gridId} + + \ No newline at end of file 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 42c39a6022..b3aa12f74a 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 @@ -25,9 +25,7 @@ import com.epmet.commons.tools.validator.ValidatorUtils; import com.epmet.commons.tools.validator.group.AddGroup; import com.epmet.commons.tools.validator.group.DefaultGroup; import com.epmet.commons.tools.validator.group.UpdateGroup; -import com.epmet.dto.CustomerStaffDTO; -import com.epmet.dto.CustomerStaffGridDTO; -import com.epmet.dto.StaffGridListDTO; +import com.epmet.dto.*; import com.epmet.dto.form.CustomerGridFormDTO; import com.epmet.dto.form.CustomerStaffFormDTO; import com.epmet.dto.form.StaffsInAgencyFromDTO; @@ -155,4 +153,9 @@ public class CustomerStaffController { public Result> getStaffInfoForHome(StaffsInAgencyFromDTO fromDTO) { return customerStaffService.getStaffInfoForHome(fromDTO); } + + @PostMapping(value = "selectgridstaffcountbyuserid") + public Result selectGridStaffCountByUserId(@RequestBody UserIdDTO userIdDTO){ + return customerStaffService.selectGridStaffCountByUserId(userIdDTO); + } } \ 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 b552832c2d..3026894e00 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 @@ -18,14 +18,14 @@ package com.epmet.dao; import com.epmet.commons.mybatis.dao.BaseDao; -import com.epmet.dto.CustomerStaffDTO; -import com.epmet.dto.CustomerStaffGridDTO; -import com.epmet.dto.StaffGridListDTO; +import com.epmet.commons.tools.utils.Result; +import com.epmet.dto.*; import com.epmet.dto.form.CustomerStaffFormDTO; import com.epmet.dto.form.StaffsInAgencyFromDTO; import com.epmet.dto.result.StaffInfoResultDTO; import com.epmet.entity.CustomerStaffEntity; import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; import java.util.List; @@ -58,6 +58,12 @@ public interface CustomerStaffDao extends BaseDao { CustomerStaffDTO selectStaffInfoByUserId(CustomerStaffDTO formDTO); + /** + * 根据userId查询网格下未被禁用的人员数量 + * @param userIdDTO + * @return + */ + GridStaffCountDTO selectGridStaffCountByUserId(UserIdDTO userIdDTO); /** * 根据userId查询查询网格下的用户信息 * 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 4a7ceb335f..1fe7ce3442 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 @@ -20,6 +20,8 @@ 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.*; +import com.epmet.dto.form.CustomerGridFormDTO; import com.epmet.dto.CustomerStaffDTO; import com.epmet.dto.CustomerStaffGridDTO; import com.epmet.dto.StaffGridListDTO; @@ -140,4 +142,11 @@ public interface CustomerStaffService extends BaseService { * @return */ Result> getStaffInfoForHome(StaffsInAgencyFromDTO fromDTO); + + /** + * 根据userId查询网格下未被禁用的人员数量 + * @param userIdDTO + * @return + */ + Result selectGridStaffCountByUserId(UserIdDTO userIdDTO); } \ 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 560fe0008c..5756cb4fce 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 @@ -27,6 +27,8 @@ import com.epmet.commons.tools.utils.ConvertUtils; import com.epmet.commons.tools.utils.Result; import com.epmet.constant.UserConstant; import com.epmet.dao.CustomerStaffDao; +import com.epmet.dto.*; +import com.epmet.dto.form.CustomerGridFormDTO; import com.epmet.dto.CustomerStaffDTO; import com.epmet.dto.CustomerStaffGridDTO; import com.epmet.dto.StaffGridListDTO; @@ -156,4 +158,17 @@ public class CustomerStaffServiceImpl extends BaseServiceImpl>().ok(list); } + /** + * 根据userId查询网格下未被禁用的人员数量 + * @param userIdDTO + * @return + */ + @Override + public Result selectGridStaffCountByUserId(UserIdDTO userIdDTO) { + Result gridStaffCountDTOResult = new Result(); + GridStaffCountDTO gridStaffCountDTO = baseDao.selectGridStaffCountByUserId(userIdDTO); + gridStaffCountDTOResult.setData(gridStaffCountDTO); + return gridStaffCountDTOResult; + } + } \ 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 ab8ad974a5..a98e30cf86 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,6 +41,18 @@ AND cs.del_flag = 0 + + + + + \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/resources/mapper/GovStaffRoleDao.xml b/epmet-user/epmet-user-server/src/main/resources/mapper/GovStaffRoleDao.xml index 8259bfb9a8..14fe8a45ca 100644 --- a/epmet-user/epmet-user-server/src/main/resources/mapper/GovStaffRoleDao.xml +++ b/epmet-user/epmet-user-server/src/main/resources/mapper/GovStaffRoleDao.xml @@ -23,9 +23,20 @@ r.* FROM staff_role sr - INNER JOIN gov_staff_role r ON ( sr.ROLE_ID = r.ID ) + INNER JOIN gov_staff_role r ON ( sr.ROLE_ID = r.ID ) AND r.DEL_FLAG = '0' WHERE sr.STAFF_ID = #{staffId} AND sr.ORG_ID = #{orgId} + AND sr.DEL_FLAG = '0' + + \ No newline at end of file From 97a9c6f1f80ed09198a9157588d6d3a6b9059ccc Mon Sep 17 00:00:00 2001 From: zxc <954985705@qq.com> Date: Fri, 24 Apr 2020 15:34:19 +0800 Subject: [PATCH 70/85] =?UTF-8?q?=E7=BD=91=E6=A0=BC=E7=94=A8=E6=88=B7?= =?UTF-8?q?=E4=BF=A1=E6=81=AF=E6=B7=BB=E5=8A=A0=E6=80=A7=E5=88=AB=E5=AD=97?= =?UTF-8?q?=E6=AE=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/epmet/dto/StaffGridListDTO.java | 5 ++++ .../controller/DepartmentController.java | 30 +++++++++++++++++++ .../resources/mapper/CustomerStaffDao.xml | 3 +- 3 files changed, 37 insertions(+), 1 deletion(-) create mode 100644 epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/DepartmentController.java diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/StaffGridListDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/StaffGridListDTO.java index dc25ece228..263405df0c 100644 --- a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/StaffGridListDTO.java +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/StaffGridListDTO.java @@ -31,4 +31,9 @@ public class StaffGridListDTO { */ private String roleName; + /** + * 性别 + */ + private String gender; + } 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 new file mode 100644 index 0000000000..9a0a04187b --- /dev/null +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/DepartmentController.java @@ -0,0 +1,30 @@ +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.AddDepartmentFormDTO; +import com.epmet.service.CustomerStaffDepartmentService; +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; + +/** + * @Auther zxc + * @Create 2020-04-24 14:48 + */ +@RestController +@RequestMapping(value = "/department") +public class DepartmentController { + + @Autowired + private CustomerStaffDepartmentService customerStaffDepartmentService; + + @PostMapping(value = "adddepartmentstaff") + public Result addDepartmentStaff(@LoginUser TokenDto tokenDto, @RequestBody AddDepartmentFormDTO addDepartmentFormDTO){ + return null; + } + +} 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 0e596339f9..33c42ff406 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 @@ -30,7 +30,8 @@ cs.id AS staffId, cs.real_name AS staffName, cs.head_photo AS staffHeadPhoto, - gsr.role_name AS roleName + gsr.role_name AS roleName, + cs.gender FROM customer_staff cs LEFT JOIN gov_staff_role gsr ON cs.user_id = gsr.id From e359eafb8050097f320b92c7c614c5baf208e331 Mon Sep 17 00:00:00 2001 From: wxz Date: Fri, 24 Apr 2020 15:47:40 +0800 Subject: [PATCH 71/85] =?UTF-8?q?1.=E4=BF=AE=E6=94=B9=E6=A0=B9=E6=8D=AE?= =?UTF-8?q?=E8=A7=92=E8=89=B2=E5=92=8CorgId=E6=9F=A5=E8=AF=A2=E4=BA=BA?= =?UTF-8?q?=E5=91=98=E7=9A=84=E6=8E=A5=E5=8F=A3=EF=BC=8C=E5=A2=9E=E5=8A=A0?= =?UTF-8?q?=E8=A7=92=E8=89=B2=E5=90=8D=E7=A7=B0=EF=BC=8C=E8=A7=92=E8=89=B2?= =?UTF-8?q?key=E7=9A=84=E8=BF=94=E5=9B=9E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../dto/result/GovStaffRoleResultDTO.java | 56 +++++++++++++++++++ .../epmet/controller/StaffRoleController.java | 8 +-- .../main/java/com/epmet/dao/StaffRoleDao.java | 4 +- .../com/epmet/service/StaffRoleService.java | 3 +- .../service/impl/StaffRoleServiceImpl.java | 3 +- .../main/resources/mapper/StaffRoleDao.xml | 5 +- 6 files changed, 68 insertions(+), 11 deletions(-) create mode 100644 epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/GovStaffRoleResultDTO.java diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/GovStaffRoleResultDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/GovStaffRoleResultDTO.java new file mode 100644 index 0000000000..6123f16677 --- /dev/null +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/GovStaffRoleResultDTO.java @@ -0,0 +1,56 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

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

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

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.dto.result; + +import lombok.Data; + +import java.io.Serializable; +import java.util.Date; + + +/** + * 政府端角色表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-04-22 + */ +@Data +public class GovStaffRoleResultDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 角色ID + */ + private String roleId; + + /** + * 人员id + */ + private String staffId; + + /** + * 角色key + */ + private String roleKey; + + /** + * 角色名称 + */ + private String roleName; +} \ No newline at end of file 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 884db53afd..795b0a34d9 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,8 @@ 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.StaffRoleDTO; import com.epmet.dto.form.StaffRoleFormDTO; +import com.epmet.dto.result.GovStaffRoleResultDTO; import com.epmet.entity.GovStaffRoleEntity; import com.epmet.service.GovStaffRoleService; import com.epmet.service.StaffRoleService; @@ -61,12 +61,12 @@ public class StaffRoleController { */ @PostMapping("staffsinrole") //@RequirePermission(key = "org_staff_list") - public Result> getStaffsInRole(@RequestBody StaffRoleFormDTO staffRoleFormDTO) { + public Result> getStaffsInRole(@RequestBody StaffRoleFormDTO staffRoleFormDTO) { ValidatorUtils.validateEntity(staffRoleFormDTO, StaffRoleFormDTO.GetStaffsInRole.class); String roleKey = staffRoleFormDTO.getRoleKey(); String orgId = staffRoleFormDTO.getOrgId(); - List staffRoleDTOS = staffRoleService.listStaffsInRole(roleKey, orgId); - return new Result>().ok(staffRoleDTOS); + List staffRoleDTOS = staffRoleService.listStaffsInRole(roleKey, orgId); + return new Result>().ok(staffRoleDTOS); } } 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 40d4b47b00..309068b1c8 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 @@ -18,7 +18,7 @@ package com.epmet.dao; import com.epmet.commons.mybatis.dao.BaseDao; -import com.epmet.dto.StaffRoleDTO; +import com.epmet.dto.result.GovStaffRoleResultDTO; import com.epmet.entity.StaffRoleEntity; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; @@ -39,5 +39,5 @@ public interface StaffRoleDao extends BaseDao { * @param orgId * @return */ - List listStaffIdsByRoleKeyAndOrgId(@Param("roleKey") String roleKey, @Param("orgId") String orgId); + List listStaffIdsByRoleKeyAndOrgId(@Param("roleKey") String roleKey, @Param("orgId") String orgId); } \ 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 7ba2d5e83b..f4f15edf0c 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 @@ -20,6 +20,7 @@ package com.epmet.service; import com.epmet.commons.mybatis.service.BaseService; import com.epmet.commons.tools.page.PageData; import com.epmet.dto.StaffRoleDTO; +import com.epmet.dto.result.GovStaffRoleResultDTO; import com.epmet.entity.StaffRoleEntity; import java.util.List; @@ -99,5 +100,5 @@ public interface StaffRoleService extends BaseService { * @param orgId * @return */ - List listStaffsInRole(String roleKey, String orgId); + List listStaffsInRole(String roleKey, String orgId); } \ 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 739d20e945..db7d154b22 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 @@ -25,6 +25,7 @@ import com.epmet.commons.tools.utils.ConvertUtils; import com.epmet.commons.tools.constant.FieldConstant; import com.epmet.dao.StaffRoleDao; import com.epmet.dto.StaffRoleDTO; +import com.epmet.dto.result.GovStaffRoleResultDTO; import com.epmet.entity.StaffRoleEntity; import com.epmet.redis.StaffRoleRedis; import com.epmet.service.StaffRoleService; @@ -109,7 +110,7 @@ public class StaffRoleServiceImpl extends BaseServiceImpl listStaffsInRole(String roleKey, String orgId) { + public List listStaffsInRole(String roleKey, String orgId) { return baseDao.listStaffIdsByRoleKeyAndOrgId(roleKey, orgId); } 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 0cbdc611f6..45937ae7f1 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 @@ -18,9 +18,8 @@ - + SELECT sr.STAFF_ID, sr.ROLE_ID, r.ROLE_NAME, r.ROLE_KEY FROM staff_role sr INNER JOIN gov_staff_role r ON ( sr.ROLE_ID = r.ID ) From 2ee793e872b6243e8a5acf2092e89f755c3613f1 Mon Sep 17 00:00:00 2001 From: sunyuchao Date: Fri, 24 Apr 2020 16:02:39 +0800 Subject: [PATCH 72/85] =?UTF-8?q?=E6=94=BF=E5=BA=9C=E7=AB=AF-=E9=83=A8?= =?UTF-8?q?=E9=97=A8=E6=A8=A1=E5=9D=97=E9=83=A8=E5=88=86=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../tools/exception/EpmetErrorCode.java | 4 +- .../epmet/dto/form/AddDepartmentFormDTO.java | 53 +++++ .../dto/form/DepartmentInAgencyFormDTO.java | 43 ++++ .../epmet/dto/form/DepartmentListFormDTO.java | 43 ++++ .../dto/form/DepartmentdetailFormDTO.java | 43 ++++ .../epmet/dto/form/EditDepartmentFormDTO.java | 54 +++++ .../dto/form/RemoveDepartmentFormDTO.java | 42 ++++ .../dto/result/AddDepartmentResultDTO.java | 40 ++++ .../result/DepartInStaffListResultDTO.java | 60 ++++++ .../dto/result/DepartmentDetailResultDTO.java | 57 +++++ .../result/DepartmentInAgencyResultDTO.java | 47 ++++ .../dto/result/DepartmentListResultDTO.java | 49 +++++ .../constant/CustomerDepartmentConstant.java | 30 +++ .../controller/DepartmentController.java | 110 ++++++++++ .../com/epmet/dao/CustomerDepartmentDao.java | 21 +- .../epmet/dao/CustomerStaffDepartmentDao.java | 6 +- .../com/epmet/feign/EpmetUserFeignClient.java | 11 + .../EpmetUserFeignClientFallBack.java | 8 + .../com/epmet/service/DepartmentService.java | 80 +++++++ .../service/impl/DepartmentServiceImpl.java | 200 ++++++++++++++++++ .../resources/mapper/CustomerAgencyDao.xml | 5 +- .../mapper/CustomerStaffDepartmentDao.xml | 10 + .../dto/form/DepartmentInStaffFormDTO.java | 33 +++ .../com/epmet/constant/UserRoleConstant.java | 6 + .../controller/CustomerStaffController.java | 14 +- .../java/com/epmet/dao/CustomerStaffDao.java | 10 + .../epmet/service/CustomerStaffService.java | 10 + .../impl/CustomerStaffServiceImpl.java | 18 ++ .../resources/mapper/CustomerStaffDao.xml | 17 ++ 29 files changed, 1118 insertions(+), 6 deletions(-) create mode 100644 epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/AddDepartmentFormDTO.java create mode 100644 epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/DepartmentInAgencyFormDTO.java create mode 100644 epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/DepartmentListFormDTO.java create mode 100644 epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/DepartmentdetailFormDTO.java create mode 100644 epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/EditDepartmentFormDTO.java create mode 100644 epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/RemoveDepartmentFormDTO.java create mode 100644 epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/AddDepartmentResultDTO.java create mode 100644 epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/DepartInStaffListResultDTO.java create mode 100644 epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/DepartmentDetailResultDTO.java create mode 100644 epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/DepartmentInAgencyResultDTO.java create mode 100644 epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/DepartmentListResultDTO.java create mode 100644 epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/constant/CustomerDepartmentConstant.java create mode 100644 epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/DepartmentController.java create mode 100644 epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/DepartmentService.java create mode 100644 epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/DepartmentServiceImpl.java create mode 100644 epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/DepartmentInStaffFormDTO.java diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java index d07777427a..fab7dfae57 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java @@ -27,7 +27,9 @@ public enum EpmetErrorCode { MESSAGE_SMS_SEND_ERROR(8105, "短信发送失败"), CANNOT_AUDIT_WARM(8201, "请完善居民信息"), - NOT_DEL_AGENCY(8202, "该机关存在下级机关,不允许删除"); + NOT_DEL_AGENCY(8202, "该机关存在下级机关,不允许删除"), + NOT_DEL_AGENCY_PER(8203, "该机关存在工作人员,不允许删除"), + NOT_DEL_DEPARTMENT(8204, "该部门存在工作人员,不允许删除"); private int code; diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/AddDepartmentFormDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/AddDepartmentFormDTO.java new file mode 100644 index 0000000000..07e5b1f0f4 --- /dev/null +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/AddDepartmentFormDTO.java @@ -0,0 +1,53 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

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

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

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.dto.form; + +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import java.io.Serializable; + + +/** + * 添加部门-接口入参 + * + * @author sun + */ +@Data +public class AddDepartmentFormDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 所属组织机构ID(customer_agency.id) + */ + @NotBlank(message = "组织机构Id不能为空") + private String agencyId; + + /** + * 部门名称 + */ + private String departmentName; + + /** + * 部门职责 + */ + private String departmentDuty; + + +} \ No newline at end of file diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/DepartmentInAgencyFormDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/DepartmentInAgencyFormDTO.java new file mode 100644 index 0000000000..bb70330a2c --- /dev/null +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/DepartmentInAgencyFormDTO.java @@ -0,0 +1,43 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

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

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

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.dto.form; + +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import java.io.Serializable; + + +/** + * 组织首页-获取机关下部门列表-接口入参 + * + * @author sun + */ +@Data +public class DepartmentInAgencyFormDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 机关组织Id + */ + @NotBlank(message = "组织机构ID不能为空") + private String agencyId; + + +} \ No newline at end of file diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/DepartmentListFormDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/DepartmentListFormDTO.java new file mode 100644 index 0000000000..a651dad1c3 --- /dev/null +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/DepartmentListFormDTO.java @@ -0,0 +1,43 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

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

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

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.dto.form; + +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import java.io.Serializable; + + +/** + * 获取部门列表-接口入参 + * + * @author sun + */ +@Data +public class DepartmentListFormDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 机关组织Id + */ + @NotBlank(message = "组织机构ID不能为空") + private String agencyId; + + +} \ No newline at end of file diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/DepartmentdetailFormDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/DepartmentdetailFormDTO.java new file mode 100644 index 0000000000..8e01785bf2 --- /dev/null +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/DepartmentdetailFormDTO.java @@ -0,0 +1,43 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

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

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

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.dto.form; + +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import java.io.Serializable; + + +/** + * 获取部门详情-接口入参 + * + * @author sun + */ +@Data +public class DepartmentdetailFormDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 部门Id + */ + @NotBlank(message = "部门ID不能为空") + private String departmentId; + + +} \ No newline at end of file diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/EditDepartmentFormDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/EditDepartmentFormDTO.java new file mode 100644 index 0000000000..949ac45ace --- /dev/null +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/EditDepartmentFormDTO.java @@ -0,0 +1,54 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

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

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

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.dto.form; + +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import java.io.Serializable; + + +/** + * 部门信息修改-接口入参 + * + * @author sun + */ +@Data +public class EditDepartmentFormDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 部门Id + */ + @NotBlank(message = "部门ID不能为空") + private String departmentId; + + /** + * 部门名称 + */ + @NotBlank(message = "部门名称不能为空") + private String departmentName; + + /** + * 部门职责 + */ + @NotBlank(message = "部门职责不能为空") + private String departmentDuty; + +} \ No newline at end of file diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/RemoveDepartmentFormDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/RemoveDepartmentFormDTO.java new file mode 100644 index 0000000000..749a157deb --- /dev/null +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/RemoveDepartmentFormDTO.java @@ -0,0 +1,42 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

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

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

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.dto.form; + +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import java.io.Serializable; + + +/** + * 删除部门-接口入参 + * + * @author sun + */ +@Data +public class RemoveDepartmentFormDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 部门Id + */ + @NotBlank(message = "部门ID不能为空") + private String departmentId; + +} \ No newline at end of file diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/AddDepartmentResultDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/AddDepartmentResultDTO.java new file mode 100644 index 0000000000..b6206d0c6d --- /dev/null +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/AddDepartmentResultDTO.java @@ -0,0 +1,40 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

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

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

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.dto.result; + +import lombok.Data; + +import java.io.Serializable; + + +/** + * 添加部门-接口返参 + * + * @author sun + */ +@Data +public class AddDepartmentResultDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 新增部门Id + */ + private String departmentId; + +} \ No newline at end of file diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/DepartInStaffListResultDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/DepartInStaffListResultDTO.java new file mode 100644 index 0000000000..e63020a209 --- /dev/null +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/DepartInStaffListResultDTO.java @@ -0,0 +1,60 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

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

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

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.dto.result; + +import lombok.Data; + +import java.io.Serializable; + + +/** + * 获取部门详情-部门下工作人员列表 + * + * @author sun + */ +@Data +public class DepartInStaffListResultDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 用户ID + */ + private String staffId; + + /** + * 用户姓名 + */ + private String staffName; + + /** + * 用户头像 + */ + private String staffHeadPhoto; + + /** + * 性别 + */ + private Integer gender; + + /** + * 角色名称 + */ + private String roleName; + +} \ No newline at end of file diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/DepartmentDetailResultDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/DepartmentDetailResultDTO.java new file mode 100644 index 0000000000..d36a4222ee --- /dev/null +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/DepartmentDetailResultDTO.java @@ -0,0 +1,57 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

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

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

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.dto.result; + +import lombok.Data; + +import java.io.Serializable; +import java.util.List; + + +/** + * 获取部门详情-接口返参 + * + * @author sun + */ +@Data +public class DepartmentDetailResultDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 部门Id + */ + private String departmentId; + + /** + * 部门名称 + */ + private String departmentName; + + /** + * 部门职责 + */ + private String departmentDuty; + + /** + * 部门下工作人员列表 + */ + private List staffList; + + +} \ No newline at end of file diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/DepartmentInAgencyResultDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/DepartmentInAgencyResultDTO.java new file mode 100644 index 0000000000..33880e5c1b --- /dev/null +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/DepartmentInAgencyResultDTO.java @@ -0,0 +1,47 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

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

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

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.dto.result; + +import lombok.Data; + +import java.io.Serializable; +import java.util.List; + + +/** + * 组织首页-获取机关下部门列表-接口返参 + * + * @author sun + */ +@Data +public class DepartmentInAgencyResultDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 机关下总部门数 + */ + private Integer departmentCount; + + /** + * 机关下部门列表 + */ + private List departmentList; + + +} \ No newline at end of file diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/DepartmentListResultDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/DepartmentListResultDTO.java new file mode 100644 index 0000000000..7fafa0238d --- /dev/null +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/DepartmentListResultDTO.java @@ -0,0 +1,49 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

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

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

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.dto.result; + +import lombok.Data; + +import java.io.Serializable; + + +/** + * 组织首页-获取机关下部门列表-部门详情数据 + * + * @author sun + */ +@Data +public class DepartmentListResultDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 部门Id + */ + private String departmentId; + + /** + * 部门名称 + */ + private String departmentName; + + /** + * 部门下总人数 + */ + private Integer totalUser; +} \ No newline at end of file diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/constant/CustomerDepartmentConstant.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/constant/CustomerDepartmentConstant.java new file mode 100644 index 0000000000..2a530cba0b --- /dev/null +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/constant/CustomerDepartmentConstant.java @@ -0,0 +1,30 @@ +package com.epmet.constant; + +/** + * @author sun + * @dscription + */ +public interface CustomerDepartmentConstant { + + /** + * 部门信息编辑修改失败 + */ + String UPDATE_EXCEPTION = "部门信息更新失败"; + /** + * 添加部门失败 + */ + String SAVE_EXCEPTION = "添加部门失败"; + /** + * 部门删除失败 + */ + String DEL_EXCEPTION = "删除部门失败"; + /** + * 查询用户基本信息失败 + */ + String SELECT_STAFFINFO_EXCEPTION = "根据用户Id未查询到用户基本信息"; + + /** + * 查询部门人员角色 + */ + String SELECT_ROLE_EXCEPTION = "查询部门人员角色失败"; +} 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 new file mode 100644 index 0000000000..05189cdc57 --- /dev/null +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/DepartmentController.java @@ -0,0 +1,110 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

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

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

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.controller; + +import com.epmet.commons.tools.utils.Result; +import com.epmet.dto.form.*; +import com.epmet.dto.result.*; +import com.epmet.service.DepartmentService; +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; + + +/** + * 部门 + * + * @author sun + */ +@RestController +@RequestMapping("department") +public class DepartmentController { + + @Autowired + private DepartmentService departmentService; + + /** + * @param formDTO + * @return + * @Author sun + * @Description 添加部门 + */ + @PostMapping("adddepartment") + public Result addDepartment(@RequestBody AddDepartmentFormDTO formDTO) { + return departmentService.addDepartment(formDTO); + } + + /** + * @param formDTO + * @return + * @Author sun + * @Description 部门信息修改 + */ + @PostMapping("editdepartment") + public Result editDepartment(@RequestBody EditDepartmentFormDTO formDTO) { + return departmentService.editDepartment(formDTO); + } + + /** + * @param formDTO + * @return + * @Author sun + * @Description 删除部门 + */ + @PostMapping("removedepartment") + public Result removeDepartment(@RequestBody RemoveDepartmentFormDTO formDTO) { + return departmentService.removeDepartment(formDTO); + } + + /** + * @param formDTO + * @return + * @Author sun + * @Description 获取部门详情 + */ + @PostMapping("departmentdetail") + public Result departmentDetail(@RequestBody DepartmentdetailFormDTO formDTO) { + return departmentService.departmentDetail(formDTO); + } + + /** + * @param formDTO + * @return + * @Author sun + * @Description 组织首页-获取机关下部门列表 + */ + @PostMapping("departmentinagencylist") + public Result departmentInAgencyList(@RequestBody DepartmentInAgencyFormDTO formDTO) { + return departmentService.departmentInAgencyList(formDTO); + } + + /** + * @param formDTO + * @return + * @Author sun + * @Description 获取机构下部门列表 + */ + @PostMapping("departmentlist") + public Result> departmentList(@RequestBody DepartmentListFormDTO formDTO) { + return departmentService.departmentList(formDTO); + } +} \ No newline at end of file diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerDepartmentDao.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerDepartmentDao.java index bd188f8351..b7569a1396 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerDepartmentDao.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerDepartmentDao.java @@ -18,8 +18,13 @@ package com.epmet.dao; import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.dto.result.DepartmentListResultDTO; +import com.epmet.dto.result.SubListResultDTO; import com.epmet.entity.CustomerDepartmentEntity; import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +import java.util.List; /** * 客户部门表 @@ -29,5 +34,19 @@ import org.apache.ibatis.annotations.Mapper; */ @Mapper public interface CustomerDepartmentDao extends BaseDao { - + + /** + * @param agencyId + * @return + * @Author sun + * @Description 根据当前机关Id查询该机关下的直属部门列表,只查询前十条 + **/ + List selectDepartmentListByAgencyId(@Param("agencyId") String agencyId); + /** + * @param agencyId + * @return + * @Author sun + * @Description 根据当前机关Id查询该机关下的直属部门列表 + **/ + List selectDepartmentList(@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/dao/CustomerStaffDepartmentDao.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerStaffDepartmentDao.java index 8a79a0dd2e..dfdba500d7 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerStaffDepartmentDao.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerStaffDepartmentDao.java @@ -20,6 +20,9 @@ package com.epmet.dao; import com.epmet.commons.mybatis.dao.BaseDao; import com.epmet.entity.CustomerStaffDepartmentEntity; import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +import java.util.List; /** * 部门人员关系表 @@ -29,5 +32,6 @@ import org.apache.ibatis.annotations.Mapper; */ @Mapper public interface CustomerStaffDepartmentDao extends BaseDao { - + + List selectUserIdByDepartmentId(@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/feign/EpmetUserFeignClient.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/feign/EpmetUserFeignClient.java index 217d37c0bb..c9e67f87ff 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,7 +5,9 @@ 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.DepartmentInStaffFormDTO; import com.epmet.dto.form.StaffsInAgencyFromDTO; +import com.epmet.dto.result.DepartInStaffListResultDTO; import com.epmet.dto.result.StaffInfoResultDTO; import com.epmet.feign.fallback.EpmetUserFeignClientFallBack; import org.springframework.cloud.openfeign.FeignClient; @@ -43,4 +45,13 @@ public interface EpmetUserFeignClient { @PostMapping("/epmetuser/customerstaff/staffsinagency") Result> getStaffInfoForHome(StaffsInAgencyFromDTO fromDTO); + /** + * @param departmentInStaffFormDTO + * @return + * @Author sun + * @Description 根据客户Id及userId集合查询用户基本信息 + */ + @PostMapping("/epmetuser/customerstaff/getdepartmentstafflist") + Result> getDepartmentStaffList(DepartmentInStaffFormDTO departmentInStaffFormDTO); + } 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 a4cf20b805..dd508f6f12 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,7 +6,9 @@ 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.DepartmentInStaffFormDTO; import com.epmet.dto.form.StaffsInAgencyFromDTO; +import com.epmet.dto.result.DepartInStaffListResultDTO; import com.epmet.dto.result.StaffInfoResultDTO; import com.epmet.feign.EpmetUserFeignClient; import org.springframework.stereotype.Component; @@ -32,4 +34,10 @@ public class EpmetUserFeignClientFallBack implements EpmetUserFeignClient { public Result> getStaffInfoForHome(StaffsInAgencyFromDTO fromDTO) { return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "getStaffInfoForHome", fromDTO); } + + @Override + public Result> getDepartmentStaffList(DepartmentInStaffFormDTO departmentInStaffFormDTO) { + return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "getDepartmentStaffList", departmentInStaffFormDTO); + } + } 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 new file mode 100644 index 0000000000..48fe029fb0 --- /dev/null +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/DepartmentService.java @@ -0,0 +1,80 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

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

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

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.service; + +import com.epmet.commons.tools.utils.Result; +import com.epmet.dto.form.*; +import com.epmet.dto.result.*; + +import java.util.List; + +/** + * 机关单位信息 + * + * @author sun + */ +public interface DepartmentService { + + /** + * @param formDTO + * @return + * @Author sun + * @Description 添加部门 + */ + Result addDepartment(AddDepartmentFormDTO formDTO); + + /** + * @param formDTO + * @return + * @Author sun + * @Description 部门信息修改 + */ + Result editDepartment(EditDepartmentFormDTO formDTO); + + /** + * @param formDTO + * @return + * @Author sun + * @Description 删除部门 + */ + Result removeDepartment(RemoveDepartmentFormDTO formDTO); + + /** + * @param formDTO + * @return + * @Author sun + * @Description 获取部门详情 + */ + Result departmentDetail(DepartmentdetailFormDTO formDTO); + + /** + * @param formDTO + * @return + * @Author sun + * @Description 组织首页-获取机关下部门列表 + */ + Result departmentInAgencyList(DepartmentInAgencyFormDTO formDTO); + + /** + * @param formDTO + * @return + * @Author sun + * @Description 获取机构下部门列表 + */ + Result> departmentList(DepartmentListFormDTO formDTO); +} \ No newline at end of file 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 new file mode 100644 index 0000000000..263daff4ac --- /dev/null +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/DepartmentServiceImpl.java @@ -0,0 +1,200 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

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

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

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.service.impl; + +import com.epmet.commons.tools.constant.NumConstant; +import com.epmet.commons.tools.exception.EpmetErrorCode; +import com.epmet.commons.tools.exception.RenException; +import com.epmet.commons.tools.utils.ConvertUtils; +import com.epmet.commons.tools.utils.Result; +import com.epmet.constant.CustomerDepartmentConstant; +import com.epmet.dao.CustomerAgencyDao; +import com.epmet.dao.CustomerDepartmentDao; +import com.epmet.dao.CustomerStaffDepartmentDao; +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.DepartmentService; +import com.epmet.util.ModuleConstant; +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.Arrays; +import java.util.List; + +/** + * 机关单位信息 + * + * @author sun + */ +@Service +public class DepartmentServiceImpl implements DepartmentService { + + private static final Logger log = LoggerFactory.getLogger(DepartmentServiceImpl.class); + @Autowired + private CustomerAgencyDao customerAgencyDao; + @Autowired + private CustomerDepartmentDao customerDepartmentDao; + @Autowired + private CustomerStaffDepartmentDao customerStaffDepartmentDao; + @Autowired + private EpmetUserFeignClient epmetUserFeignClient; + + /** + * @param formDTO + * @return + * @Author sun + * @Description 添加部门 + */ + @Override + @Transactional(rollbackFor = Exception.class) + public Result addDepartment(AddDepartmentFormDTO formDTO) { + Result result = new Result(); + AddDepartmentResultDTO addDepartmentResultDTO = new AddDepartmentResultDTO(); + CustomerDepartmentEntity entity = ConvertUtils.sourceToTarget(formDTO, CustomerDepartmentEntity.class); + entity.setTotalUser(NumConstant.ZERO); + //1:查询当前组织机构信息,获取客户Id + CustomerAgencyEntity parentEntity = customerAgencyDao.selectById(formDTO.getAgencyId()); + entity.setCustomerId(parentEntity.getCustomerId()); + //2:保存部门信息 + if (customerDepartmentDao.insert(entity) < NumConstant.ONE) { + log.error(CustomerDepartmentConstant.SAVE_EXCEPTION); + throw new RenException(CustomerDepartmentConstant.SAVE_EXCEPTION); + } + //3:返回新部门Id + addDepartmentResultDTO.setDepartmentId(entity.getId()); + return result.ok(addDepartmentResultDTO); + } + + /** + * @param formDTO + * @return + * @Author sun + * @Description 部门信息修改 + */ + @Override + @Transactional(rollbackFor = Exception.class) + public Result editDepartment(EditDepartmentFormDTO formDTO) { + Result result = new Result(); + CustomerDepartmentEntity entity = new CustomerDepartmentEntity(); + entity.setId(formDTO.getDepartmentId()); + entity.setDepartmentName(formDTO.getDepartmentName()); + entity.setDepartmentDuty(formDTO.getDepartmentDuty()); + if (customerDepartmentDao.updateById(entity) < NumConstant.ONE) { + log.error(CustomerDepartmentConstant.UPDATE_EXCEPTION); + throw new RenException(CustomerDepartmentConstant.UPDATE_EXCEPTION); + } + return result; + } + + /** + * @param formDTO + * @return + * @Author sun + * @Description 删除部门 + */ + @Override + @Transactional(rollbackFor = Exception.class) + public Result removeDepartment(RemoveDepartmentFormDTO formDTO) { + Result result = new Result(); + //1:判断当前部门下是否存在工作人员,不存在的可以删除 + CustomerDepartmentEntity entity = customerDepartmentDao.selectById(formDTO.getDepartmentId()); + if (null != entity && entity.getTotalUser() > NumConstant.ZERO) { + result.setCode(EpmetErrorCode.NOT_DEL_DEPARTMENT.getCode()); + result.setMsg(EpmetErrorCode.NOT_DEL_DEPARTMENT.getMsg()); + return result; + } + //2:删除部门信息(逻辑删) + if (customerDepartmentDao.deleteById(formDTO.getDepartmentId()) < NumConstant.ONE) { + log.error(CustomerDepartmentConstant.DEL_EXCEPTION); + throw new RenException(CustomerDepartmentConstant.DEL_EXCEPTION); + } + return result; + } + + /** + * @param formDTO + * @return + * @Author sun + * @Description 获取部门详情 + */ + @Override + public Result departmentDetail(DepartmentdetailFormDTO formDTO) { + Result result = new Result(); + DepartmentDetailResultDTO departmentDetailResultDTO = new DepartmentDetailResultDTO(); + //1:根据部门Id查询部门详情信息 + CustomerDepartmentEntity entity = customerDepartmentDao.selectById(formDTO.getDepartmentId()); + departmentDetailResultDTO = ConvertUtils.sourceToTarget(entity, DepartmentDetailResultDTO.class); + departmentDetailResultDTO.setDepartmentId(entity.getId()); + //2:查询部门下工作人员的用户Id集合 + List userIdList = customerStaffDepartmentDao.selectUserIdByDepartmentId(formDTO.getDepartmentId()); + if (null == userIdList || userIdList.size() < NumConstant.ONE) { + return result.ok(departmentDetailResultDTO); + } + DepartmentInStaffFormDTO departmentInStaffFormDTO = new DepartmentInStaffFormDTO(); + //部门Id用于查询部门领导角色使用 + departmentInStaffFormDTO.setDepartmentId(formDTO.getDepartmentId()); + departmentInStaffFormDTO.setCustomerId(entity.getCustomerId()); + departmentInStaffFormDTO.setUserIdList(userIdList); + //3:调用epmet_user服务,查询人员基本信息,按姓名对应的拼音升序 + Result> resultList = epmetUserFeignClient.getDepartmentStaffList(departmentInStaffFormDTO); + if (!resultList.success() || null == resultList.getData()) { + log.error(CustomerDepartmentConstant.SELECT_STAFFINFO_EXCEPTION); + throw new RenException(CustomerDepartmentConstant.SELECT_STAFFINFO_EXCEPTION); + } + //部门下所有工作人员基本信息 + List staffList = resultList.getData(); + departmentDetailResultDTO.setStaffList(staffList); + return new Result().ok(departmentDetailResultDTO); + } + + /** + * @param formDTO + * @return + * @Author sun + * @Description 组织首页-获取机关下部门列表 + */ + @Override + public Result departmentInAgencyList(DepartmentInAgencyFormDTO formDTO) { + DepartmentInAgencyResultDTO departmentInAgencyResultDTO = new DepartmentInAgencyResultDTO(); + //1:根据当前机关Id查询该机关下的直属部门列表 + List departmentList = customerDepartmentDao.selectDepartmentListByAgencyId(formDTO.getAgencyId()); + departmentInAgencyResultDTO.setDepartmentList(departmentList); + //2:统计下一级机关数 + departmentInAgencyResultDTO.setDepartmentCount(departmentList.size()); + return new Result().ok(departmentInAgencyResultDTO); + } + + /** + * @param formDTO + * @return + * @Author sun + * @Description 获取机构下部门列表 + */ + @Override + public Result> departmentList(DepartmentListFormDTO formDTO) { + List departmentList = customerDepartmentDao.selectDepartmentList(formDTO.getAgencyId()); + return new Result>().ok(departmentList); + } +} \ No newline at end of file diff --git a/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerAgencyDao.xml b/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerAgencyDao.xml index 50ff491aa3..90b926b729 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerAgencyDao.xml +++ b/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerAgencyDao.xml @@ -57,7 +57,8 @@ FROM customer_agency WHERE del_flag = '0' AND pid = #{pId} - ORDER BY CREATED_TIME DESC + ORDER BY created_time DESC + LIMIT 10 \ No newline at end of file diff --git a/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerStaffDepartmentDao.xml b/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerStaffDepartmentDao.xml index 5ab8b90e9c..86c597d402 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerStaffDepartmentDao.xml +++ b/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerStaffDepartmentDao.xml @@ -15,6 +15,16 @@ + \ No newline at end of file diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/DepartmentInStaffFormDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/DepartmentInStaffFormDTO.java new file mode 100644 index 0000000000..5810659515 --- /dev/null +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/DepartmentInStaffFormDTO.java @@ -0,0 +1,33 @@ +package com.epmet.dto.form; + +import lombok.Data; + +import java.io.Serializable; +import java.util.List; + +/** + * @Description 根据客户Id和用户Id查询用户基本信息 + * @Author sun + */ +@Data +public class DepartmentInStaffFormDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 部门Id + */ + private String departmentId; + + /** + * 客户Id CUSTOMER.id + */ + private String customerId; + + /** + * 用户Id集合 + */ + private List userIdList; + +} + diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/constant/UserRoleConstant.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/constant/UserRoleConstant.java index ce710319bd..48b3e77940 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/constant/UserRoleConstant.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/constant/UserRoleConstant.java @@ -11,4 +11,10 @@ public interface UserRoleConstant { * 角色表对应的是居民角色时grid_id的默认值 */ String DEFAULT_GRID_ID = "all"; + + /** + * 部门领导角色值 + */ + String DEPT_LEADER = "dept_leader"; + } 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 42c39a6022..38fa2fcc45 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,9 +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.CustomerGridFormDTO; import com.epmet.dto.form.CustomerStaffFormDTO; +import com.epmet.dto.form.DepartmentInStaffFormDTO; import com.epmet.dto.form.StaffsInAgencyFromDTO; +import com.epmet.dto.result.DepartInStaffListResultDTO; import com.epmet.dto.result.StaffInfoResultDTO; import com.epmet.excel.CustomerStaffExcel; import com.epmet.service.CustomerStaffService; @@ -155,4 +156,15 @@ public class CustomerStaffController { public Result> getStaffInfoForHome(StaffsInAgencyFromDTO fromDTO) { return customerStaffService.getStaffInfoForHome(fromDTO); } + + /** + * @param fromDTO + * @return + * @Author sun + * @Description 根据客户Id及userId集合查询用户基本信息 + */ + @PostMapping("getdepartmentstafflist") + public Result> getDepartmentStaffList(DepartmentInStaffFormDTO fromDTO) { + return customerStaffService.getDepartmentStaffList(fromDTO); + } } \ 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 b552832c2d..c6c000bf3c 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,7 +22,9 @@ 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.form.DepartmentInStaffFormDTO; import com.epmet.dto.form.StaffsInAgencyFromDTO; +import com.epmet.dto.result.DepartInStaffListResultDTO; import com.epmet.dto.result.StaffInfoResultDTO; import com.epmet.entity.CustomerStaffEntity; import org.apache.ibatis.annotations.Mapper; @@ -82,4 +84,12 @@ public interface CustomerStaffDao extends BaseDao { * @Date 2020/4/23 16:46 **/ CustomerStaffEntity selectByUserId(String userId); + + /** + * @param fromDTO + * @return + * @Author sun + * @Description 根据客户Id及userId集合查询用户基本信息 + */ + List selectDepartmentStaffList(DepartmentInStaffFormDTO fromDTO); } \ 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 4a7ceb335f..1388b741b9 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 @@ -24,7 +24,9 @@ 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.form.DepartmentInStaffFormDTO; import com.epmet.dto.form.StaffsInAgencyFromDTO; +import com.epmet.dto.result.DepartInStaffListResultDTO; import com.epmet.dto.result.StaffInfoResultDTO; import com.epmet.entity.CustomerStaffEntity; @@ -140,4 +142,12 @@ public interface CustomerStaffService extends BaseService { * @return */ Result> getStaffInfoForHome(StaffsInAgencyFromDTO fromDTO); + + /** + * @param fromDTO + * @return + * @Author sun + * @Description 根据客户Id及userId集合查询用户基本信息 + */ + Result> getDepartmentStaffList(DepartmentInStaffFormDTO fromDTO); } \ 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 560fe0008c..5d8ef70ba5 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 @@ -22,16 +22,22 @@ 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.RenException; import com.epmet.commons.tools.page.PageData; import com.epmet.commons.tools.utils.ConvertUtils; import com.epmet.commons.tools.utils.Result; import com.epmet.constant.UserConstant; +import com.epmet.constant.UserRoleConstant; import com.epmet.dao.CustomerStaffDao; import com.epmet.dto.CustomerStaffDTO; import com.epmet.dto.CustomerStaffGridDTO; import com.epmet.dto.StaffGridListDTO; +import com.epmet.dto.StaffRoleDTO; import com.epmet.dto.form.CustomerStaffFormDTO; +import com.epmet.dto.form.DepartmentInStaffFormDTO; +import com.epmet.dto.form.StaffRoleFormDTO; import com.epmet.dto.form.StaffsInAgencyFromDTO; +import com.epmet.dto.result.DepartInStaffListResultDTO; import com.epmet.dto.result.StaffInfoResultDTO; import com.epmet.entity.CustomerStaffEntity; import com.epmet.redis.CustomerStaffRedis; @@ -156,4 +162,16 @@ public class CustomerStaffServiceImpl extends BaseServiceImpl>().ok(list); } + @Override + public Result> getDepartmentStaffList(DepartmentInStaffFormDTO formDTO) { + //1:根据userId集合查询人员基本信息 + List list = baseDao.selectDepartmentStaffList(formDTO); + //2:根据部门Id查询部门下是领导角色的用户 + StaffRoleFormDTO staffRoleFormDTO = new StaffRoleFormDTO(); + staffRoleFormDTO.setOrgId(formDTO.getDepartmentId()); + staffRoleFormDTO.setRoleKey(UserRoleConstant.DEPT_LEADER); + + return new Result>().ok(list); + } + } \ 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 ab8ad974a5..d8d149da1f 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 @@ -79,4 +79,21 @@ cs.DEL_FLAG = '0' AND CS.USER_ID =#{userId} + \ No newline at end of file From bfa6577b539ede7b267a689b35cc8aaff10820d9 Mon Sep 17 00:00:00 2001 From: sunyuchao Date: Fri, 24 Apr 2020 16:19:56 +0800 Subject: [PATCH 73/85] =?UTF-8?q?=E8=A7=A3=E5=86=B3=E4=BB=A3=E7=A0=81?= =?UTF-8?q?=E5=86=B2=E7=AA=81=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../tools/exception/EpmetErrorCode.java | 6 ++-- .../controller/DepartmentController.java | 33 +++++-------------- 2 files changed, 12 insertions(+), 27 deletions(-) diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java index e8c528e2ea..161c9cd9ef 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java @@ -29,10 +29,10 @@ public enum EpmetErrorCode { CANNOT_AUDIT_WARM(8201, "请完善居民信息"), NOT_DEL_AGENCY(8202, "该机关存在下级机关,不允许删除"), - REQUIRE_PERMISSION(8203, "没有足够的操作权限"), - NOT_DEL_AGENCY(8204, "该机关存在下级机关,不允许删除"), NOT_DEL_AGENCY_PER(8205, "该机关存在工作人员,不允许删除"), - NOT_DEL_DEPARTMENT(8206, "该部门存在工作人员,不允许删除"); + NOT_DEL_DEPARTMENT(8206, "该部门存在工作人员,不允许删除"), + + REQUIRE_PERMISSION(8301, "没有足够的操作权限"); private int code; 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 9a36b7399a..33a1d7fe87 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 @@ -2,13 +2,12 @@ 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.AddDepartmentFormDTO; -import com.epmet.service.CustomerStaffDepartmentService; - import com.epmet.commons.tools.utils.Result; import com.epmet.dto.form.*; -import com.epmet.dto.result.*; +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.service.DepartmentService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.PostMapping; @@ -16,27 +15,8 @@ import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; -/** - * @Auther zxc - * @Create 2020-04-24 14:48 - */ -@RestController -@RequestMapping(value = "/department") -public class DepartmentController { - - @Autowired - private CustomerStaffDepartmentService customerStaffDepartmentService; - - @PostMapping(value = "adddepartmentstaff") - public Result addDepartmentStaff(@LoginUser TokenDto tokenDto, @RequestBody AddDepartmentFormDTO addDepartmentFormDTO){ - return null; - } - -} - import java.util.List; - /** * 部门 * @@ -49,6 +29,11 @@ public class DepartmentController { @Autowired private DepartmentService departmentService; + @PostMapping(value = "adddepartmentstaff") + public Result addDepartmentStaff(@LoginUser TokenDto tokenDto, @RequestBody AddDepartmentFormDTO addDepartmentFormDTO){ + return null; + } + /** * @param formDTO * @return From 93ebde2984365eabe250414e9f016f2e43d30b05 Mon Sep 17 00:00:00 2001 From: zxc <954985705@qq.com> Date: Fri, 24 Apr 2020 16:27:14 +0800 Subject: [PATCH 74/85] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E9=83=A8=E9=97=A8?= =?UTF-8?q?=E4=BA=BA=E5=91=98dto?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../epmet/dto/form/AddDepartmentFormDTO.java | 20 ++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/AddDepartmentFormDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/AddDepartmentFormDTO.java index 07e5b1f0f4..1188979f4a 100644 --- a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/AddDepartmentFormDTO.java +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/AddDepartmentFormDTO.java @@ -1,3 +1,4 @@ +package com.epmet.dto.form; /** * Copyright 2018 人人开源 https://www.renren.io *

@@ -15,12 +16,19 @@ * along with this program. If not, see . */ -package com.epmet.dto.form; import lombok.Data; import javax.validation.constraints.NotBlank; import java.io.Serializable; +import java.util.List; + +/** + * 添加部门人员DTO + * @Auther zxc + * @Create 2020-04-24 14:51 +import javax.validation.constraints.NotBlank; +import java.io.Serializable; /** @@ -33,6 +41,16 @@ public class AddDepartmentFormDTO implements Serializable { private static final long serialVersionUID = 1L; + /** + *部门id + */ + private String departmentId; + + /** + * 选中人员id + */ + private List selectedList; + /** * 所属组织机构ID(customer_agency.id) */ From 71bb41f1da6f2079fa854a99ccd74a7126fd8ab3 Mon Sep 17 00:00:00 2001 From: sunyuchao Date: Fri, 24 Apr 2020 16:45:12 +0800 Subject: [PATCH 75/85] =?UTF-8?q?=E8=A7=A3=E5=86=B3=E4=BB=A3=E7=A0=81?= =?UTF-8?q?=E5=86=B2=E7=AA=81=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...ilResultDTO.java => AgencysResultDTO.java} | 7 +- .../epmet/controller/AgencyController.java | 4 +- .../java/com/epmet/service/AgencyService.java | 12 +- .../epmet/service/CustomerAgencyService.java | 45 +------ .../epmet/service/impl/AgencyServiceImpl.java | 28 ++-- .../impl/CustomerAgencyServiceImpl.java | 124 ------------------ 6 files changed, 19 insertions(+), 201 deletions(-) rename epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/{AgencydetailResultDTO.java => AgencysResultDTO.java} (91%) diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/AgencydetailResultDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/AgencysResultDTO.java similarity index 91% rename from epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/AgencydetailResultDTO.java rename to epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/AgencysResultDTO.java index 4fed7005d9..e372d86d8d 100644 --- a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/AgencydetailResultDTO.java +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/AgencysResultDTO.java @@ -19,18 +19,17 @@ package com.epmet.dto.result; import lombok.Data; -import javax.validation.constraints.NotBlank; import java.io.Serializable; import java.util.List; /** - * 组织首页-获取组织机构信息接口返参 + * 添加组织-接口返参 * * @author sun */ @Data -public class AgencydetailResultDTO implements Serializable { +public class AgencysResultDTO implements Serializable { private static final long serialVersionUID = 1L; @@ -77,6 +76,4 @@ public class AgencydetailResultDTO implements Serializable { * 本机关的所有上级机关 */ private List parentList; - - } \ No newline at end of file diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/AgencyController.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/AgencyController.java index 82cd76e7c3..b8b8300489 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/AgencyController.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/AgencyController.java @@ -21,7 +21,7 @@ import com.epmet.commons.tools.utils.Result; import com.epmet.dto.form.*; import com.epmet.dto.result.AddAgencyResultDTO; import com.epmet.dto.result.AgencyListResultDTO; -import com.epmet.dto.result.AgencydetailResultDTO; +import com.epmet.dto.result.AgencysResultDTO; import com.epmet.dto.result.SubAgencyResultDTO; import com.epmet.service.AgencyService; import org.springframework.beans.factory.annotation.Autowired; @@ -85,7 +85,7 @@ public class AgencyController { * @Description 组织首页-获取组织机构信息 */ @PostMapping("agencydetail") - public Result agencyDetail(@RequestBody AgencydetailFormDTO formDTO) { + public Result agencyDetail(@RequestBody AgencydetailFormDTO formDTO) { return agencyService.agencyDetail(formDTO); } diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/AgencyService.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/AgencyService.java index f811f71f80..f2edc0c462 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/AgencyService.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/AgencyService.java @@ -17,16 +17,14 @@ 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.CustomerAgencyDTO; import com.epmet.dto.form.*; -import com.epmet.dto.result.*; -import com.epmet.entity.CustomerAgencyEntity; +import com.epmet.dto.result.AddAgencyResultDTO; +import com.epmet.dto.result.AgencyListResultDTO; +import com.epmet.dto.result.AgencysResultDTO; +import com.epmet.dto.result.SubAgencyResultDTO; import java.util.List; -import java.util.Map; /** * 机关单位信息 @@ -65,7 +63,7 @@ public interface AgencyService { * @Author sun * @Description 组织首页-获取组织机构信息 */ - Result agencyDetail(AgencydetailFormDTO formDTO); + Result agencyDetail(AgencydetailFormDTO formDTO); /** * @param formDTO diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/CustomerAgencyService.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/CustomerAgencyService.java index 7076fe6d2d..62892b4576 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/CustomerAgencyService.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/CustomerAgencyService.java @@ -21,11 +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.CustomerAgencyDTO; -import com.epmet.dto.form.*; -import com.epmet.dto.result.AddAgencyResultDTO; -import com.epmet.dto.result.AgencydetailResultDTO; +import com.epmet.dto.form.StaffOrgFormDTO; import com.epmet.dto.result.StaffOrgsResultDTO; -import com.epmet.dto.result.SubAgencyResultDTO; import com.epmet.entity.CustomerAgencyEntity; import java.util.List; @@ -107,44 +104,4 @@ public interface CustomerAgencyService extends BaseService * @Date 2020/4/20 21:45 **/ Result> getStaffOrgList(StaffOrgFormDTO staffOrgsFormDTO); - - /** - * @param formDTO - * @return - * @Author sun - * @Description 添加组织 - */ - Result addAgency(AddAgencyFormDTO formDTO); - - /** - * @param formDTO - * @return - * @Author sun - * @Description 组织名称编辑 - */ - Result editAgency(EditAgencyFormDTO formDTO); - - /** - * @param formDTO - * @return - * @Author sun - * @Description 删除组织机关 - */ - Result removeAgency(RemoveAgencyFormDTO formDTO); - - /** - * @param formDTO - * @return - * @Author sun - * @Description 组织首页-获取组织机构信息 - */ - Result agencyDetail(AgencydetailFormDTO formDTO); - - /** - * @param formDTO - * @return - * @Author sun - * @Description 组织首页-下级机关列表 - */ - Result subAgencyList(SubAgencyFormDTO formDTO); } \ No newline at end of file diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/AgencyServiceImpl.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/AgencyServiceImpl.java index ae13436d6a..a71c53e80a 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/AgencyServiceImpl.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/AgencyServiceImpl.java @@ -17,26 +17,17 @@ package com.epmet.service.impl; -import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; -import com.baomidou.mybatisplus.core.metadata.IPage; -import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; -import com.epmet.commons.tools.constant.FieldConstant; import com.epmet.commons.tools.constant.NumConstant; import com.epmet.commons.tools.exception.EpmetErrorCode; import com.epmet.commons.tools.exception.RenException; -import com.epmet.commons.tools.page.PageData; import com.epmet.commons.tools.utils.ConvertUtils; import com.epmet.commons.tools.utils.Result; import com.epmet.constant.CustomerAgencyConstant; import com.epmet.dao.CustomerAgencyDao; -import com.epmet.dto.CustomerAgencyDTO; import com.epmet.dto.form.*; import com.epmet.dto.result.*; import com.epmet.entity.CustomerAgencyEntity; -import com.epmet.redis.CustomerAgencyRedis; import com.epmet.service.AgencyService; -import com.epmet.service.CustomerAgencyService; -import org.apache.commons.lang3.StringUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; @@ -45,7 +36,6 @@ import org.springframework.transaction.annotation.Transactional; import java.util.Arrays; import java.util.List; -import java.util.Map; /** * 机关单位信息 @@ -146,24 +136,24 @@ public class AgencyServiceImpl implements AgencyService { * @Description 组织首页-获取组织机构信息 */ @Override - public Result agencyDetail(AgencydetailFormDTO formDTO) { - AgencydetailResultDTO agencydetailResultDTO = new AgencydetailResultDTO(); + public Result agencyDetail(AgencydetailFormDTO formDTO) { + AgencysResultDTO agencysResultDTO = new AgencysResultDTO(); //1:查询本机关详细信息 CustomerAgencyEntity entity = customerAgencyDao.selectById(formDTO.getAgencyId()); if (null == entity) { - return new Result().ok(agencydetailResultDTO); + return new Result().ok(agencysResultDTO); } - agencydetailResultDTO = ConvertUtils.sourceToTarget(entity, AgencydetailResultDTO.class); - agencydetailResultDTO.setAgencyId(entity.getId()); - agencydetailResultDTO.setAgencyName(entity.getOrganizationName()); + agencysResultDTO = ConvertUtils.sourceToTarget(entity, AgencysResultDTO.class); + agencysResultDTO.setAgencyId(entity.getId()); + agencysResultDTO.setAgencyName(entity.getOrganizationName()); //2:查询本机关的所有上级机关,按自上而下层级顺序 if (null == entity.getPids()) { - return new Result().ok(agencydetailResultDTO); + return new Result().ok(agencysResultDTO); } List listStr = Arrays.asList(entity.getPids().split(":")); List parentList = customerAgencyDao.selectPAgencyById(listStr); - agencydetailResultDTO.setParentList(parentList); - return new Result().ok(agencydetailResultDTO); + agencysResultDTO.setParentList(parentList); + return new Result().ok(agencysResultDTO); } /** diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerAgencyServiceImpl.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerAgencyServiceImpl.java index eb1d83a8ae..06f83a0d25 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerAgencyServiceImpl.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerAgencyServiceImpl.java @@ -138,128 +138,4 @@ public class CustomerAgencyServiceImpl extends BaseServiceImpl>().ok(list); } - - /** - * @param formDTO - * @return - * @Author sun - * @Description 添加组织 - */ - @Override - @Transactional(rollbackFor = Exception.class) - public Result addAgency(AddAgencyFormDTO formDTO) { - Result result = new Result(); - AddAgencyResultDTO addAgencyResultDTO = new AddAgencyResultDTO(); - //0:属性映射赋值 - CustomerAgencyEntity entity = ConvertUtils.sourceToTarget(formDTO, CustomerAgencyEntity.class); - entity.setOrganizationName(formDTO.getAgencyName()); - entity.setTotalUser(NumConstant.ZERO); - //1:查询上级机关信息 - CustomerAgencyEntity parentEntity = baseDao.selectById(formDTO.getPid()); - entity.setCustomerId(parentEntity.getCustomerId()); - if (null == parentEntity.getPid()) { - entity.setPids(parentEntity.getId()); - entity.setAllParentName(parentEntity.getOrganizationName()); - } else { - entity.setPids(":" + parentEntity.getId()); - entity.setAllParentName("-" + parentEntity.getOrganizationName()); - } - //2:保存组织信息 - if (baseDao.insert(entity) < NumConstant.ONE) { - logger.error(CustomerAgencyConstant.SAVE_EXCEPTION); - throw new RenException(CustomerAgencyConstant.SAVE_EXCEPTION); - } - //3:返回新组织Id - addAgencyResultDTO.setAgencyId(entity.getId()); - return result.ok(addAgencyResultDTO); - } - - /** - * @param formDTO - * @return - * @Author sun - * @Description 组织名称编辑 - */ - @Override - @Transactional(rollbackFor = Exception.class) - public Result editAgency(EditAgencyFormDTO formDTO) { - Result result = new Result(); - CustomerAgencyEntity entity = new CustomerAgencyEntity(); - entity.setId(formDTO.getAgencyId()); - entity.setOrganizationName(formDTO.getAgencyName()); - if (baseDao.updateById(entity) < NumConstant.ONE) { - logger.error(CustomerAgencyConstant.UPDATE_EXCEPTION); - throw new RenException(CustomerAgencyConstant.UPDATE_EXCEPTION); - } - return result; - } - - /** - * @param formDTO - * @return - * @Author sun - * @Description 删除组织机关 - */ - @Override - @Transactional(rollbackFor = Exception.class) - public Result removeAgency(RemoveAgencyFormDTO formDTO) { - Result result = new Result(); - //1:查询当前机关是否存在所属下级机关,存在下级的不能删除 - List agencyList = baseDao.selectSubAgencyById(formDTO.getAgencyId()); - if (null != agencyList && agencyList.size() > NumConstant.ZERO) { - result.setCode(EpmetErrorCode.NOT_DEL_AGENCY.getCode()); - result.setMsg(EpmetErrorCode.NOT_DEL_AGENCY.getMsg()); - return result; - } - //2:删除当前机关组织(逻辑删) - if (baseDao.deleteById(formDTO.getAgencyId()) < NumConstant.ONE) { - logger.error(CustomerAgencyConstant.DEL_EXCEPTION); - throw new RenException(CustomerAgencyConstant.DEL_EXCEPTION); - } - return result; - } - - /** - * @param formDTO - * @return - * @Author sun - * @Description 组织首页-获取组织机构信息 - */ - @Override - public Result agencyDetail(AgencydetailFormDTO formDTO) { - AgencydetailResultDTO agencydetailResultDTO = new AgencydetailResultDTO(); - //1:查询本机关详细信息 - CustomerAgencyEntity entity = baseDao.selectById(formDTO.getAgencyId()); - if (null == entity) { - return new Result().ok(agencydetailResultDTO); - } - agencydetailResultDTO = ConvertUtils.sourceToTarget(entity, AgencydetailResultDTO.class); - agencydetailResultDTO.setAgencyId(entity.getId()); - agencydetailResultDTO.setAgencyName(entity.getOrganizationName()); - //2:查询本机关的所有上级机关,按自上而下层级顺序 - if (null == entity.getPids()) { - return new Result().ok(agencydetailResultDTO); - } - List listStr = Arrays.asList(entity.getPids().split(":")); - List parentList = baseDao.selectPAgencyById(listStr); - agencydetailResultDTO.setParentList(parentList); - return new Result().ok(agencydetailResultDTO); - } - - /** - * @param formDTO - * @return - * @Author sun - * @Description 组织首页-下级机关列表 - */ - @Override - public Result subAgencyList(SubAgencyFormDTO formDTO) { - SubAgencyResultDTO subAgencyResultDTO = new SubAgencyResultDTO(); - //1:根据当前机关Id查询直属下一级机关列表 - List agencyList = baseDao.selectSubAgencyById(formDTO.getAgencyId()); - subAgencyResultDTO.setAgencyList(agencyList); - //2:统计下一级机关数 - subAgencyResultDTO.setSubAgencyCount(agencyList.size()); - return new Result().ok(subAgencyResultDTO); - } } \ No newline at end of file From 75d662aabc233e3f0afa3a9f031e552edb354aa9 Mon Sep 17 00:00:00 2001 From: zhaoqifeng Date: Fri, 24 Apr 2020 16:51:22 +0800 Subject: [PATCH 76/85] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=20=E7=BB=84=E7=BB=87-?= =?UTF-8?q?=E5=B7=A5=E4=BD=9C=E4=BA=BA=E5=91=98=E7=9B=B8=E5=85=B3=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../epmet/dto/form/StaffSubmitFromDTO.java | 8 ++ .../dto/result/StaffDetailResultDTO.java | 3 +- .../com/epmet/controller/StaffController.java | 23 ++--- .../com/epmet/feign/EpmetUserFeignClient.java | 67 +++++++++++++- .../EpmetUserFeignClientFallBack.java | 39 ++++++++ .../java/com/epmet/service/StaffService.java | 5 +- .../epmet/service/impl/StaffServiceImpl.java | 39 +++++--- .../epmet/constant/CustomerStaffConstant.java | 34 +++++++ .../controller/CustomerStaffController.java | 88 +++++++++++++++--- .../main/java/com/epmet/dao/StaffRoleDao.java | 8 ++ .../com/epmet/service/StaffRoleService.java | 6 ++ .../impl/CustomerStaffServiceImpl.java | 89 +++++++++++++++++-- .../service/impl/StaffRoleServiceImpl.java | 6 ++ .../main/resources/mapper/StaffRoleDao.xml | 8 ++ 14 files changed, 381 insertions(+), 42 deletions(-) create mode 100644 epmet-user/epmet-user-server/src/main/java/com/epmet/constant/CustomerStaffConstant.java diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/StaffSubmitFromDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/StaffSubmitFromDTO.java index 2ac8a066b0..87ffa6f26b 100644 --- a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/StaffSubmitFromDTO.java +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/StaffSubmitFromDTO.java @@ -50,4 +50,12 @@ public class StaffSubmitFromDTO implements Serializable { */ @NotBlank(message = "角色不能为空") private List roles; + /** + * 来源app(政府端:gov、居民端:resi、运营端:oper) + */ + private String app; + /** + * 来源client(PC端:web、微信小程序:wxmp) + */ + private String client; } diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/StaffDetailResultDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/StaffDetailResultDTO.java index 34a6aa6fb3..c6cf9ea90e 100644 --- a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/StaffDetailResultDTO.java +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/StaffDetailResultDTO.java @@ -4,6 +4,7 @@ import lombok.Data; import lombok.NoArgsConstructor; import java.io.Serializable; +import java.util.Date; import java.util.List; /** @@ -38,7 +39,7 @@ public class StaffDetailResultDTO implements Serializable { /** * 激活时间 */ - private String activeTime; + private Date activeTime; /** * 性别 */ diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/StaffController.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/StaffController.java index b8450650aa..6964cffec3 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/StaffController.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/StaffController.java @@ -2,6 +2,8 @@ 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.StaffInfoFromDTO; import com.epmet.dto.form.StaffSubmitFromDTO; @@ -13,6 +15,7 @@ import com.epmet.dto.result.StaffsInAgencyResultDTO; import com.epmet.service.StaffService; 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; @@ -34,7 +37,7 @@ public class StaffController { * @return */ @PostMapping("staffsinagency") - public Result getStaffInfoForHome(StaffsInAgencyFromDTO fromDTO) { + public Result getStaffInfoForHome(@RequestBody StaffsInAgencyFromDTO fromDTO) { return staffService.getStaffInfoForHome(fromDTO); } @@ -46,7 +49,7 @@ public class StaffController { * @author zhaoqifeng */ @PostMapping("stafflist") - public Result> getStaffList(StaffsInAgencyFromDTO fromDTO){ + public Result> getStaffList(@RequestBody StaffsInAgencyFromDTO fromDTO){ return staffService.getStaffList(fromDTO); } @@ -58,7 +61,7 @@ public class StaffController { * @return Result */ @PostMapping("rolelist") - public Result addStaffInit(StaffInfoFromDTO fromDTO){ + public Result addStaffInit(@RequestBody StaffInfoFromDTO fromDTO){ return staffService.addStaffInit(fromDTO); } @@ -69,7 +72,7 @@ public class StaffController { * @return Result */ @PostMapping("editstaffinit") - public Result editStaffInit(StaffInfoFromDTO fromDTO){ + public Result editStaffInit(@RequestBody StaffInfoFromDTO fromDTO){ return staffService.editStaffInit(fromDTO); } @@ -80,8 +83,8 @@ public class StaffController { * @return Result */ @PostMapping("addstaff") - public Result addStaff(StaffSubmitFromDTO fromDTO){ - return staffService.addStaff(fromDTO); + public Result addStaff(@LoginUser TokenDto tokenDto, @RequestBody StaffSubmitFromDTO fromDTO){ + return staffService.addStaff(tokenDto, fromDTO); } /** @@ -91,8 +94,8 @@ public class StaffController { * @return Result */ @PostMapping("editstaff") - public Result editStaff(StaffSubmitFromDTO fromDTO){ - return staffService.editStaff(fromDTO); + public Result editStaff(@LoginUser TokenDto tokenDto, @RequestBody StaffSubmitFromDTO fromDTO){ + return staffService.editStaff(tokenDto, fromDTO); } /** @@ -102,7 +105,7 @@ public class StaffController { * @return Result */ @PostMapping("staffdetail") - public Result getStaffDetail(StaffInfoFromDTO fromDTO){ + public Result getStaffDetail(@RequestBody StaffInfoFromDTO fromDTO){ return staffService.getStaffDetail(fromDTO); } @@ -113,7 +116,7 @@ public class StaffController { * @return Result */ @PostMapping("disabledstaff") - public Result disabledStaff(StaffInfoFromDTO fromDTO){ + public Result disabledStaff(@RequestBody StaffInfoFromDTO fromDTO){ return staffService.disabledStaff(fromDTO); } } 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 5ba8ee81f1..98d20c5939 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 @@ -7,9 +7,13 @@ import com.epmet.dto.CustomerStaffDTO; import com.epmet.dto.CustomerStaffGridDTO; import com.epmet.dto.StaffGridListDTO; 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.feign.fallback.EpmetUserFeignClientFallBack; import org.springframework.cloud.openfeign.FeignClient; import org.springframework.web.bind.annotation.PathVariable; @@ -34,7 +38,7 @@ public interface EpmetUserFeignClient { * @date 2020/4/22 10:05 **/ @PostMapping(value = "/epmetuser/customerstaff/getstaffinfobyuserid") - Result getCustomerStaffInfoByUserId(CustomerStaffDTO formDTO); + Result getCustomerStaffInfoByUserId(@RequestBody CustomerStaffDTO formDTO); @PostMapping("/epmetuser/customerstaff/selectstaffgridlistbyuserid") Result> getStaffGridList(@RequestBody List customerStaffGridDTOS); @@ -50,6 +54,67 @@ public interface EpmetUserFeignClient { @PostMapping(value = "/epmetuser/customerstaff/selectgridstaffcountbyuserid") Result selectGridStaffCountByUserId(@RequestBody UserIdDTO userIdDTO); + /** + * 工作人员列表 + * @param fromDTO + * @return + */ + @PostMapping("/epmetuser/customerstaff/stafflist") + Result> getStaffList(@RequestBody StaffsInAgencyFromDTO fromDTO); + /** + * 人员添加页面初始化 + * + * @param fromDTO 参数 + * @return Result + */ + @PostMapping("/epmetuser/customerstaff/rolelist") + Result addStaffInit(@RequestBody StaffInfoFromDTO fromDTO); + + /** + * 人员编辑页面初始化 + * + * @param fromDTO 参数 + * @return Result + */ + @PostMapping("/epmetuser/customerstaff/editstaffinit") + Result editStaffInit(@RequestBody StaffInfoFromDTO fromDTO); + + /** + * 人员添加 + * + * @param fromDTO 参数 + * @return Result + */ + @PostMapping("/epmetuser/customerstaff/addstaff") + Result addStaff(@RequestBody StaffSubmitFromDTO fromDTO); + + /** + * 人员编辑 + * + * @param fromDTO 参数 + * @return Result + */ + @PostMapping("/epmetuser/customerstaff/editstaff") + Result editStaff(@RequestBody StaffSubmitFromDTO fromDTO); + + /** + * 人员详情 + * + * @param fromDTO 参数 + * @return Result + */ + @PostMapping("/epmetuser/customerstaff/staffdetail") + Result getStaffDetail(@RequestBody StaffInfoFromDTO fromDTO); + + /** + * 人员禁用 + * + * @param fromDTO 参数 + * @return Result + */ + @PostMapping("/epmetuser/customerstaff/disabledstaff") + Result disabledStaff(@RequestBody StaffInfoFromDTO fromDTO); + /** * @param departmentInStaffFormDTO * @return 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 e36abef073..0177e9a6bc 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 @@ -7,10 +7,14 @@ import com.epmet.dto.*; import com.epmet.dto.CustomerStaffDTO; import com.epmet.dto.CustomerStaffGridDTO; import com.epmet.dto.StaffGridListDTO; +import com.epmet.dto.form.StaffInfoFromDTO; +import com.epmet.dto.form.StaffSubmitFromDTO; import com.epmet.dto.form.DepartmentInStaffFormDTO; import com.epmet.dto.form.StaffsInAgencyFromDTO; +import com.epmet.dto.result.StaffDetailResultDTO; import com.epmet.dto.result.DepartInStaffListResultDTO; import com.epmet.dto.result.StaffInfoResultDTO; +import com.epmet.dto.result.StaffInitResultDTO; import com.epmet.feign.EpmetUserFeignClient; import org.springframework.stereotype.Component; @@ -46,4 +50,39 @@ public class EpmetUserFeignClientFallBack implements EpmetUserFeignClient { return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "getDepartmentStaffList", departmentInStaffFormDTO); } + + @Override + public Result> getStaffList(StaffsInAgencyFromDTO fromDTO) { + return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "StaffsInAgencyFromDTO", fromDTO); + } + + @Override + public Result addStaffInit(StaffInfoFromDTO fromDTO) { + return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "addStaffInit", fromDTO); + } + + @Override + public Result editStaffInit(StaffInfoFromDTO fromDTO) { + return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "editStaffInit", fromDTO); + } + + @Override + public Result addStaff(StaffSubmitFromDTO fromDTO) { + return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "addStaff", fromDTO); + } + + @Override + public Result editStaff(StaffSubmitFromDTO fromDTO) { + return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "editStaff", fromDTO); + } + + @Override + public Result getStaffDetail(StaffInfoFromDTO fromDTO) { + return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "getStaffDetail", fromDTO); + } + + @Override + public Result disabledStaff(StaffInfoFromDTO fromDTO) { + return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "disabledStaff", fromDTO); + } } diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/StaffService.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/StaffService.java index ba5f227b95..e11e8edecb 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/StaffService.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/StaffService.java @@ -1,5 +1,6 @@ package com.epmet.service; +import com.epmet.commons.tools.security.dto.TokenDto; import com.epmet.commons.tools.utils.Result; import com.epmet.dto.form.StaffInfoFromDTO; import com.epmet.dto.form.StaffSubmitFromDTO; @@ -58,7 +59,7 @@ public interface StaffService { * @param fromDTO 参数 * @return Result */ - Result addStaff(StaffSubmitFromDTO fromDTO); + Result addStaff(TokenDto tokenDto, StaffSubmitFromDTO fromDTO); /** * 人员编辑 @@ -66,7 +67,7 @@ public interface StaffService { * @param fromDTO 参数 * @return Result */ - Result editStaff(StaffSubmitFromDTO fromDTO); + Result editStaff(TokenDto tokenDto,StaffSubmitFromDTO fromDTO); /** * 人员详情 diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/StaffServiceImpl.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/StaffServiceImpl.java index 3ef22a3cf6..db4e263508 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/StaffServiceImpl.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/StaffServiceImpl.java @@ -1,5 +1,6 @@ package com.epmet.service.impl; +import com.epmet.commons.tools.security.dto.TokenDto; import com.epmet.commons.tools.utils.Result; import com.epmet.dto.CustomerStaffAgencyDTO; import com.epmet.dto.form.StaffInfoFromDTO; @@ -36,6 +37,7 @@ public class StaffServiceImpl implements StaffService { private CustomerAgencyService customerAgencyService; @Autowired private CustomerStaffAgencyService customerStaffAgencyService; + @Override public Result getStaffInfoForHome(StaffsInAgencyFromDTO fromDTO) { StaffsInAgencyResultDTO resultDTO = new StaffsInAgencyResultDTO(); @@ -51,7 +53,7 @@ public class StaffServiceImpl implements StaffService { List staffIds = customerStaffAgencyList.stream().map(CustomerStaffAgencyDTO::getUserId).collect(Collectors.toList()); fromDTO.setStaffList(staffIds); //获取用户信息 - Result> staffInfoListResult = epmetUserFeignClient.getStaffInfoForHome(fromDTO); + Result> staffInfoListResult = epmetUserFeignClient.getStaffInfoForHome(fromDTO); resultDTO.setStaffList(staffInfoListResult.getData()); return new Result().ok(resultDTO); } @@ -69,37 +71,54 @@ public class StaffServiceImpl implements StaffService { List staffIds = customerStaffAgencyList.stream().map(CustomerStaffAgencyDTO::getUserId).collect(Collectors.toList()); fromDTO.setStaffList(staffIds); //获取用户列表 - Result> staffInfoListResult = epmetUserFeignClient.getStaffInfoForHome(fromDTO); + Result> staffInfoListResult = epmetUserFeignClient.getStaffInfoForHome(fromDTO); return null; } @Override public Result addStaffInit(StaffInfoFromDTO fromDTO) { - return null; + CustomerAgencyEntity customerAgencyEntity = customerAgencyService.selectById(fromDTO.getAgencyId()); + fromDTO.setCustomerId(customerAgencyEntity.getCustomerId()); + return epmetUserFeignClient.addStaffInit(fromDTO); } @Override public Result editStaffInit(StaffInfoFromDTO fromDTO) { - return null; + CustomerAgencyEntity customerAgencyEntity = customerAgencyService.selectById(fromDTO.getAgencyId()); + fromDTO.setCustomerId(customerAgencyEntity.getCustomerId()); + return epmetUserFeignClient.editStaffInit(fromDTO); } @Override - public Result addStaff(StaffSubmitFromDTO fromDTO) { - return null; + public Result addStaff(TokenDto tokenDto, StaffSubmitFromDTO fromDTO) { + fromDTO.setApp(tokenDto.getApp()); + fromDTO.setClient(tokenDto.getClient()); + Result result = epmetUserFeignClient.addStaff(fromDTO); + //机关总人数加一 + if (result.success()) { + CustomerAgencyEntity customerAgencyEntity = customerAgencyService.selectById(fromDTO.getAgencyId()); + customerAgencyEntity.setTotalUser(customerAgencyEntity.getTotalUser() + 1); + customerAgencyService.updateById(customerAgencyEntity); + } + return new Result(); } @Override - public Result editStaff(StaffSubmitFromDTO fromDTO) { - return null; + public Result editStaff(TokenDto tokenDto, StaffSubmitFromDTO fromDTO) { + fromDTO.setApp(tokenDto.getApp()); + fromDTO.setClient(tokenDto.getClient()); + return epmetUserFeignClient.editStaff(fromDTO); } @Override public Result getStaffDetail(StaffInfoFromDTO fromDTO) { - return null; + CustomerAgencyEntity customerAgencyEntity = customerAgencyService.selectById(fromDTO.getAgencyId()); + fromDTO.setCustomerId(customerAgencyEntity.getCustomerId()); + return epmetUserFeignClient.getStaffDetail(fromDTO); } @Override public Result disabledStaff(StaffInfoFromDTO fromDTO) { - return null; + return epmetUserFeignClient.disabledStaff(fromDTO); } } diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/constant/CustomerStaffConstant.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/constant/CustomerStaffConstant.java new file mode 100644 index 0000000000..f823247843 --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/constant/CustomerStaffConstant.java @@ -0,0 +1,34 @@ +package com.epmet.constant; + +/** + * @author zhaoqifeng + * @dscription + * @date 2020/4/24 15:42 + */ +public interface CustomerStaffConstant { + + /** + * 专职 + */ + String FULL_TIME ="fulltime"; + /** + * 兼职 + */ + String PART_TIME ="parttime"; + /** + * 已激活 + */ + String INACTIVE ="inactive"; + /** + * 未激活 + */ + String ACTIVE ="active"; + /** + * 已禁用 + */ + String DISABLED ="disabled"; + /** + * 未禁用 + */ + String ENABLE ="enable"; +} 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 7daee8f457..f1ed7bd6ba 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 @@ -26,15 +26,11 @@ import com.epmet.commons.tools.validator.group.AddGroup; import com.epmet.commons.tools.validator.group.DefaultGroup; import com.epmet.commons.tools.validator.group.UpdateGroup; import com.epmet.dto.*; -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.CustomerStaffFormDTO; -import com.epmet.dto.form.DepartmentInStaffFormDTO; -import com.epmet.dto.form.StaffsInAgencyFromDTO; +import com.epmet.dto.form.*; 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.excel.CustomerStaffExcel; import com.epmet.service.CustomerStaffService; import org.springframework.beans.factory.annotation.Autowired; @@ -145,17 +141,22 @@ public class CustomerStaffController { * @date 2020/4/22 10:05 **/ @PostMapping(value = "getstaffinfobyuserid") - public Result getCustomerStaffInfoByUserId(CustomerStaffDTO formDTO) { + public Result getCustomerStaffInfoByUserId(@RequestBody CustomerStaffDTO formDTO) { return customerStaffService.getCustomerStaffInfoByUserId(formDTO); } + @PostMapping(value = "selectgridstaffcountbyuserid") + public Result selectGridStaffCountByUserId(@RequestBody UserIdDTO userIdDTO){ + return customerStaffService.selectGridStaffCountByUserId(userIdDTO); + } + /** * 组织首页-工作人员列表 * @param fromDTO * @return */ @PostMapping("staffsinagency") - public Result> getStaffInfoForHome(StaffsInAgencyFromDTO fromDTO) { + public Result> getStaffInfoForHome(@RequestBody StaffsInAgencyFromDTO fromDTO) { return customerStaffService.getStaffInfoForHome(fromDTO); } @@ -165,13 +166,74 @@ public class CustomerStaffController { * @return */ @PostMapping("stafflist") - public Result> getStaffList(StaffsInAgencyFromDTO fromDTO) { + public Result> getStaffList(@RequestBody StaffsInAgencyFromDTO fromDTO) { return customerStaffService.getStaffList(fromDTO); } - @PostMapping(value = "selectgridstaffcountbyuserid") - public Result selectGridStaffCountByUserId(@RequestBody UserIdDTO userIdDTO){ - return customerStaffService.selectGridStaffCountByUserId(userIdDTO); + /** + * 人员添加页面初始化 + * + * @param fromDTO 参数 + * @return Result + */ + @PostMapping("rolelist") + public Result addStaffInit(@RequestBody StaffInfoFromDTO fromDTO){ + return customerStaffService.addStaffInit(fromDTO); + } + + /** + * 人员编辑页面初始化 + * + * @param fromDTO 参数 + * @return Result + */ + @PostMapping("editstaffinit") + public Result editStaffInit(@RequestBody StaffInfoFromDTO fromDTO){ + return customerStaffService.editStaffInit(fromDTO); + } + + /** + * 人员添加 + * + * @param fromDTO 参数 + * @return Result + */ + @PostMapping("addstaff") + public Result addStaff(@RequestBody StaffSubmitFromDTO fromDTO){ + return customerStaffService.addStaff(fromDTO); + } + + /** + * 人员编辑 + * + * @param fromDTO 参数 + * @return Result + */ + @PostMapping("editstaff") + public Result editStaff(@RequestBody StaffSubmitFromDTO fromDTO){ + return customerStaffService.editStaff(fromDTO); + } + + /** + * 人员详情 + * + * @param fromDTO 参数 + * @return Result + */ + @PostMapping("staffdetail") + public Result getStaffDetail(@RequestBody StaffInfoFromDTO fromDTO){ + return customerStaffService.getStaffDetail(fromDTO); + } + + /** + * 人员禁用 + * + * @param fromDTO 参数 + * @return Result + */ + @PostMapping("disabledstaff") + public Result disabledStaff(@RequestBody StaffInfoFromDTO fromDTO){ + return customerStaffService.disabledStaff(fromDTO); } /** 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 309068b1c8..f1aaee18e7 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 @@ -39,5 +39,13 @@ public interface StaffRoleDao extends BaseDao { * @param orgId * @return */ + List listStaffIdsByRoleKeyAndOrgId(@Param("roleKey") String roleKey, @Param("orgId") String orgId); + + /** + * 删除工作人员权限 + * @param dto + * @return + */ + boolean delStaffRoles(StaffRoleDTO dto); List listStaffIdsByRoleKeyAndOrgId(@Param("roleKey") String roleKey, @Param("orgId") String orgId); } \ 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 f4f15edf0c..88742d7400 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 @@ -101,4 +101,10 @@ public interface StaffRoleService extends BaseService { * @return */ List listStaffsInRole(String roleKey, String orgId); + + /** + * 清空工作人员权限 + * @param dto + */ + void clearStaffRoles(StaffRoleDTO dto); } \ 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 baac7bcde8..7621320bb7 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 @@ -26,6 +26,7 @@ import com.epmet.commons.tools.exception.RenException; import com.epmet.commons.tools.page.PageData; import com.epmet.commons.tools.utils.ConvertUtils; import com.epmet.commons.tools.utils.Result; +import com.epmet.constant.CustomerStaffConstant; import com.epmet.constant.UserConstant; import com.epmet.constant.UserRoleConstant; import com.epmet.dao.CustomerStaffDao; @@ -49,9 +50,13 @@ import com.epmet.dto.result.StaffInitResultDTO; import com.epmet.dto.result.StaffRoleResultDTO; import com.epmet.entity.CustomerStaffEntity; import com.epmet.entity.GovStaffRoleEntity; +import com.epmet.entity.StaffRoleEntity; +import com.epmet.entity.UserEntity; import com.epmet.redis.CustomerStaffRedis; import com.epmet.service.CustomerStaffService; import com.epmet.service.GovStaffRoleService; +import com.epmet.service.StaffRoleService; +import com.epmet.service.UserService; import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang3.StringUtils; import org.apache.logging.log4j.LogManager; @@ -79,7 +84,10 @@ public class CustomerStaffServiceImpl extends BaseServiceImpl page(Map params) { IPage page = baseDao.selectPage( @@ -240,23 +248,94 @@ public class CustomerStaffServiceImpl extends BaseServiceImpl { + StaffRoleEntity staffRoleEntity = new StaffRoleEntity(); + staffRoleEntity.setStaffId(userEntity.getId()); + staffRoleEntity.setRoleId(role); + staffRoleEntity.setOrgId(fromDTO.getAgencyId()); + staffRoleService.insert(staffRoleEntity); + }); + + return new Result(); } @Override + @Transactional(rollbackFor = Exception.class) public Result editStaff(StaffSubmitFromDTO fromDTO) { - return null; + CustomerStaffEntity customerStaffEntity = baseDao.selectByUserId(fromDTO.getStaffId()); + //Customer_Staff表插入数据 + CustomerStaffEntity staffEntity = new CustomerStaffEntity(); + staffEntity.setId(customerStaffEntity.getId()); + staffEntity.setRealName(fromDTO.getName()); + staffEntity.setMobile(fromDTO.getMobile()); + staffEntity.setGender(fromDTO.getGender()); + staffEntity.setWorkType(fromDTO.getWorkType()); + baseDao.updateById(staffEntity); + + //清空权限关联 + StaffRoleDTO staffRoleDTO = new StaffRoleDTO(); + staffRoleDTO.setStaffId(fromDTO.getStaffId()); + staffRoleDTO.setOrgId(fromDTO.getAgencyId()); + staffRoleService.clearStaffRoles(staffRoleDTO); + //重新添加角色关联 + fromDTO.getRoles().forEach(role -> { + StaffRoleEntity staffRoleEntity = new StaffRoleEntity(); + staffRoleEntity.setStaffId(fromDTO.getStaffId()); + staffRoleEntity.setRoleId(role); + staffRoleEntity.setOrgId(fromDTO.getAgencyId()); + staffRoleService.insert(staffRoleEntity); + }); + return new Result(); } @Override public Result getStaffDetail(StaffInfoFromDTO fromDTO) { - return null; + StaffDetailResultDTO resultDTO = new StaffDetailResultDTO(); + //获取工作人员信息 + CustomerStaffDTO customerStaffDTO = baseDao.selectStaffInfo(fromDTO); + resultDTO.setStaffId(customerStaffDTO.getUserId()); + resultDTO.setName(customerStaffDTO.getRealName()); + resultDTO.setMobile(customerStaffDTO.getMobile()); + resultDTO.setHeadPhoto(customerStaffDTO.getHeadPhoto()); + resultDTO.setGender(customerStaffDTO.getGender()); + resultDTO.setActiveFlag(customerStaffDTO.getActiveFlag()); + resultDTO.setActiveTime(customerStaffDTO.getActiveTime()); + resultDTO.setEnableFlag(customerStaffDTO.getEnableFlag()); + + //获取工作人员角色 + List staffRoles = govStaffRoleService.listRolesByStaffId(fromDTO.getStaffId(), fromDTO.getAgencyId()); + List roles = staffRoles.stream().map(GovStaffRoleEntity::getRoleName).collect(Collectors.toList()); + resultDTO.setRoles(roles); + return new Result().ok(resultDTO); } @Override public Result disabledStaff(StaffInfoFromDTO fromDTO) { - return null; + CustomerStaffEntity customerStaffEntity = baseDao.selectByUserId(fromDTO.getStaffId()); + CustomerStaffEntity staffEntity = new CustomerStaffEntity(); + staffEntity.setId(customerStaffEntity.getId()); + staffEntity.setEnableFlag(CustomerStaffConstant.DISABLED); + baseDao.updateById(staffEntity); + return new Result(); } /** 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 db7d154b22..0a9d7ce90d 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 @@ -114,4 +114,10 @@ public class StaffRoleServiceImpl extends BaseServiceImpl + + update + staff_role + set DEL_FLAG = '1' + where STAFF_ID = #{staffId} + and ORG_ID = #{orgId} + and DEL_FLAG = '0' + From bc851c793f0476fd72c84578d87a27088012da5f Mon Sep 17 00:00:00 2001 From: yinzuomei <576302893@qq.com> Date: Fri, 24 Apr 2020 17:12:14 +0800 Subject: [PATCH 77/85] =?UTF-8?q?=E8=A7=A3=E5=86=B3=E5=86=B2=E7=AA=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/epmet/dao/StaffRoleDao.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) 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 f1aaee18e7..6d65865681 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 @@ -18,6 +18,7 @@ package com.epmet.dao; import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.dto.StaffRoleDTO; import com.epmet.dto.result.GovStaffRoleResultDTO; import com.epmet.entity.StaffRoleEntity; import org.apache.ibatis.annotations.Mapper; @@ -39,7 +40,7 @@ public interface StaffRoleDao extends BaseDao { * @param orgId * @return */ - List listStaffIdsByRoleKeyAndOrgId(@Param("roleKey") String roleKey, @Param("orgId") String orgId); + List listStaffIdsByRoleKeyAndOrgId(@Param("roleKey") String roleKey, @Param("orgId") String orgId); /** * 删除工作人员权限 @@ -47,5 +48,5 @@ public interface StaffRoleDao extends BaseDao { * @return */ boolean delStaffRoles(StaffRoleDTO dto); - List listStaffIdsByRoleKeyAndOrgId(@Param("roleKey") String roleKey, @Param("orgId") String orgId); + } \ No newline at end of file From c49f8d217c02e37b333ca79acaeb51813184bf9a Mon Sep 17 00:00:00 2001 From: sunyuchao Date: Fri, 24 Apr 2020 17:59:40 +0800 Subject: [PATCH 78/85] =?UTF-8?q?=E6=94=BF=E5=BA=9C=E7=AB=AF-=E9=83=A8?= =?UTF-8?q?=E9=97=A8=E6=A8=A1=E5=9D=97=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/epmet/feign/EpmetUserFeignClient.java | 4 -- .../EpmetUserFeignClientFallBack.java | 7 +-- .../impl/CustomerStaffServiceImpl.java | 47 +++++++------------ 3 files changed, 20 insertions(+), 38 deletions(-) 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 98d20c5939..96f51e83ec 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,9 +3,6 @@ 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.CustomerStaffDTO; -import com.epmet.dto.CustomerStaffGridDTO; -import com.epmet.dto.StaffGridListDTO; import com.epmet.dto.form.DepartmentInStaffFormDTO; import com.epmet.dto.form.StaffInfoFromDTO; import com.epmet.dto.form.StaffSubmitFromDTO; @@ -16,7 +13,6 @@ import com.epmet.dto.result.StaffInfoResultDTO; import com.epmet.dto.result.StaffInitResultDTO; import com.epmet.feign.fallback.EpmetUserFeignClientFallBack; import org.springframework.cloud.openfeign.FeignClient; -import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; 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 0177e9a6bc..273b6172d1 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,15 +4,12 @@ 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.CustomerStaffDTO; -import com.epmet.dto.CustomerStaffGridDTO; -import com.epmet.dto.StaffGridListDTO; +import com.epmet.dto.form.DepartmentInStaffFormDTO; import com.epmet.dto.form.StaffInfoFromDTO; import com.epmet.dto.form.StaffSubmitFromDTO; -import com.epmet.dto.form.DepartmentInStaffFormDTO; import com.epmet.dto.form.StaffsInAgencyFromDTO; -import com.epmet.dto.result.StaffDetailResultDTO; 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.feign.EpmetUserFeignClient; 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 7621320bb7..fdd47f560d 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 @@ -22,7 +22,6 @@ 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.RenException; import com.epmet.commons.tools.page.PageData; import com.epmet.commons.tools.utils.ConvertUtils; import com.epmet.commons.tools.utils.Result; @@ -31,23 +30,8 @@ import com.epmet.constant.UserConstant; import com.epmet.constant.UserRoleConstant; import com.epmet.dao.CustomerStaffDao; import com.epmet.dto.*; -import com.epmet.dto.form.CustomerGridFormDTO; -import com.epmet.dto.CustomerStaffDTO; -import com.epmet.dto.CustomerStaffGridDTO; -import com.epmet.dto.GovStaffRoleDTO; -import com.epmet.dto.StaffGridListDTO; -import com.epmet.dto.StaffRoleDTO; -import com.epmet.dto.form.CustomerStaffFormDTO; -import com.epmet.dto.form.StaffInfoFromDTO; -import com.epmet.dto.form.StaffSubmitFromDTO; -import com.epmet.dto.form.DepartmentInStaffFormDTO; -import com.epmet.dto.form.StaffRoleFormDTO; -import com.epmet.dto.form.StaffsInAgencyFromDTO; -import com.epmet.dto.result.StaffDetailResultDTO; -import com.epmet.dto.result.DepartInStaffListResultDTO; -import com.epmet.dto.result.StaffInfoResultDTO; -import com.epmet.dto.result.StaffInitResultDTO; -import com.epmet.dto.result.StaffRoleResultDTO; +import com.epmet.dto.form.*; +import com.epmet.dto.result.*; import com.epmet.entity.CustomerStaffEntity; import com.epmet.entity.GovStaffRoleEntity; import com.epmet.entity.StaffRoleEntity; @@ -351,16 +335,21 @@ public class CustomerStaffServiceImpl extends BaseServiceImpl> getDepartmentStaffList(DepartmentInStaffFormDTO formDTO) { - //1:根据userId集合查询人员基本信息 - List list = baseDao.selectDepartmentStaffList(formDTO); - //2:根据部门Id查询部门下是领导角色的用户 - StaffRoleFormDTO staffRoleFormDTO = new StaffRoleFormDTO(); - staffRoleFormDTO.setOrgId(formDTO.getDepartmentId()); - staffRoleFormDTO.setRoleKey(UserRoleConstant.DEPT_LEADER); - - return new Result>().ok(list); - } + @Override + public Result> getDepartmentStaffList(DepartmentInStaffFormDTO formDTO) { + //1:根据userId集合查询人员基本信息 + List staffList = baseDao.selectDepartmentStaffList(formDTO); + //2:根据部门Id查询部门下是领导角色的用户 + StaffRoleFormDTO staffRoleFormDTO = new StaffRoleFormDTO(); + staffRoleFormDTO.setOrgId(formDTO.getDepartmentId()); + staffRoleFormDTO.setRoleKey(UserRoleConstant.DEPT_LEADER); + List staffRoleDTOS = staffRoleService.listStaffsInRole(UserRoleConstant.DEPT_LEADER, formDTO.getDepartmentId()); + staffRoleDTOS.forEach(roleDto -> { + staffList.stream().filter(staffDto -> + roleDto.getStaffId().equals(staffDto.getStaffId())).findAny().ifPresent(result -> + result.setRoleName(roleDto.getRoleName())); + }); + return new Result>().ok(staffList); + } } \ No newline at end of file From 23939c2cd638cdf0f0c96403615c0f6520c6cc75 Mon Sep 17 00:00:00 2001 From: sunyuchao Date: Fri, 24 Apr 2020 18:04:50 +0800 Subject: [PATCH 79/85] =?UTF-8?q?=E6=95=B0=E6=8D=AE=E5=BA=93=E5=AD=97?= =?UTF-8?q?=E6=AE=B5=E5=8F=98=E5=8A=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/epmet/dto/form/AddAgencyFormDTO.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/AddAgencyFormDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/AddAgencyFormDTO.java index 57c2e2939d..7cb0a69b27 100644 --- a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/AddAgencyFormDTO.java +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/AddAgencyFormDTO.java @@ -62,7 +62,7 @@ public class AddAgencyFormDTO implements Serializable { /** * 国家 */ - private String country; + private String district; /** * 省份 From 15f005e0a7a1b5f349a3b1b3198078775f32bc42 Mon Sep 17 00:00:00 2001 From: zxc <954985705@qq.com> Date: Fri, 24 Apr 2020 19:35:50 +0800 Subject: [PATCH 80/85] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E9=83=A8=E9=97=A8?= =?UTF-8?q?=E4=BA=BA=E5=91=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/epmet/dto/CustomerIdDTO.java | 27 ++++++ .../epmet/dto/form/AddDepartmentFormDTO.java | 20 ----- .../dto/form/AddDepartmentStaffFormDTO.java | 31 +++++++ .../controller/DepartmentController.java | 10 ++- .../epmet/dao/CustomerStaffDepartmentDao.java | 7 ++ .../com/epmet/feign/EpmetUserFeignClient.java | 22 +++++ .../EpmetUserFeignClientFallBack.java | 9 ++ .../com/epmet/service/DepartmentService.java | 9 ++ .../service/impl/CustomerGridServiceImpl.java | 1 + .../service/impl/DepartmentServiceImpl.java | 29 +++++++ .../mapper/CustomerStaffDepartmentDao.xml | 10 +++ .../controller/CustomerStaffController.java | 86 ++++--------------- .../java/com/epmet/dao/CustomerStaffDao.java | 12 ++- .../epmet/service/CustomerStaffService.java | 14 +-- .../impl/CustomerStaffServiceImpl.java | 21 +++++ .../resources/mapper/CustomerStaffDao.xml | 16 ++++ 16 files changed, 223 insertions(+), 101 deletions(-) create mode 100644 epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/CustomerIdDTO.java create mode 100644 epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/AddDepartmentStaffFormDTO.java diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/CustomerIdDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/CustomerIdDTO.java new file mode 100644 index 0000000000..d18a182d1e --- /dev/null +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/CustomerIdDTO.java @@ -0,0 +1,27 @@ +package com.epmet.dto; + +import lombok.Data; + +import java.io.Serializable; + +/** + * 根据userId查询customerId 的DTO + * @Auther zxc + * @Create 2020-04-24 15:57 + */ +@Data +public class CustomerIdDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * userId 用户id + */ + private String userId; + + /** + * customerId 客户id + */ + private String customerId; + +} diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/AddDepartmentFormDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/AddDepartmentFormDTO.java index 1188979f4a..57680d2ecd 100644 --- a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/AddDepartmentFormDTO.java +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/AddDepartmentFormDTO.java @@ -16,20 +16,10 @@ package com.epmet.dto.form; * along with this program. If not, see . */ - import lombok.Data; import javax.validation.constraints.NotBlank; import java.io.Serializable; -import java.util.List; - -/** - * 添加部门人员DTO - * @Auther zxc - * @Create 2020-04-24 14:51 -import javax.validation.constraints.NotBlank; -import java.io.Serializable; - /** * 添加部门-接口入参 @@ -41,16 +31,6 @@ public class AddDepartmentFormDTO implements Serializable { private static final long serialVersionUID = 1L; - /** - *部门id - */ - private String departmentId; - - /** - * 选中人员id - */ - private List selectedList; - /** * 所属组织机构ID(customer_agency.id) */ diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/AddDepartmentStaffFormDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/AddDepartmentStaffFormDTO.java new file mode 100644 index 0000000000..96503be98e --- /dev/null +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/AddDepartmentStaffFormDTO.java @@ -0,0 +1,31 @@ +package com.epmet.dto.form; + +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import java.io.Serializable; +import java.util.List; + +/** + * 添加部门人员DTO + * @Auther zxc + * @Create 2020-04-24 14:51 + */ +@Data +public class AddDepartmentStaffFormDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + *部门id + */ + @NotBlank(message = "部门id不能为空") + private String departmentId; + + /** + * 选中人员id + */ + @NotBlank(message = "选中人员不能为空") + private List selectedList; + +} \ No newline at end of file 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..eba65e1372 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 @@ -29,9 +29,15 @@ public class DepartmentController { @Autowired private DepartmentService departmentService; + /** + * 添加部门人员 + * @param tokenDto + * @param addDepartmentStaffFormDTO + * @return + */ @PostMapping(value = "adddepartmentstaff") - public Result addDepartmentStaff(@LoginUser TokenDto tokenDto, @RequestBody AddDepartmentFormDTO addDepartmentFormDTO){ - return null; + public Result addDepartmentStaff(@LoginUser TokenDto tokenDto, @RequestBody AddDepartmentStaffFormDTO addDepartmentStaffFormDTO){ + return departmentService.addDepartmentStaff(tokenDto,addDepartmentStaffFormDTO); } /** diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerStaffDepartmentDao.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerStaffDepartmentDao.java index dfdba500d7..548684b5e0 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerStaffDepartmentDao.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerStaffDepartmentDao.java @@ -34,4 +34,11 @@ import java.util.List; public interface CustomerStaffDepartmentDao extends BaseDao { List selectUserIdByDepartmentId(@Param("departmentId") String departmentId); + + /** + * 修改部门人数 + * @param + * @auther zxc + */ + void updateDepartmentStaffCount(@Param("addCount")Integer addCount,@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/feign/EpmetUserFeignClient.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/feign/EpmetUserFeignClient.java index 96f51e83ec..8eb86517de 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,6 +3,10 @@ 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.CustomerStaffDTO; +import com.epmet.dto.CustomerStaffGridDTO; +import com.epmet.dto.StaffGridListDTO; +import com.epmet.dto.form.AddDepartmentStaffFormDTO; import com.epmet.dto.form.DepartmentInStaffFormDTO; import com.epmet.dto.form.StaffInfoFromDTO; import com.epmet.dto.form.StaffSubmitFromDTO; @@ -36,6 +40,11 @@ public interface EpmetUserFeignClient { @PostMapping(value = "/epmetuser/customerstaff/getstaffinfobyuserid") Result getCustomerStaffInfoByUserId(@RequestBody CustomerStaffDTO formDTO); + /** + * 获取网格下人员具体信息(头像、名字...) + * @param customerStaffGridDTOS + * @return + */ @PostMapping("/epmetuser/customerstaff/selectstaffgridlistbyuserid") Result> getStaffGridList(@RequestBody List customerStaffGridDTOS); @@ -47,6 +56,11 @@ public interface EpmetUserFeignClient { @PostMapping("/epmetuser/customerstaff/staffsinagency") Result> getStaffInfoForHome(StaffsInAgencyFromDTO fromDTO); + /** + * 获取网格下未禁用的人员数量 + * @param userIdDTO + * @return + */ @PostMapping(value = "/epmetuser/customerstaff/selectgridstaffcountbyuserid") Result selectGridStaffCountByUserId(@RequestBody UserIdDTO userIdDTO); @@ -120,4 +134,12 @@ public interface EpmetUserFeignClient { @PostMapping("/epmetuser/customerstaff/getdepartmentstafflist") Result> getDepartmentStaffList(DepartmentInStaffFormDTO departmentInStaffFormDTO); + /** + * 根据userId查询customerId + * @param addDepartmentStaffFormDTO + * @auther zxc + */ + @PostMapping("/epmetuser/customerstaff/selectcustomeridbyuserid") + Result> selectCustomerIdByUserId(AddDepartmentStaffFormDTO addDepartmentStaffFormDTO); + } 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 273b6172d1..1284fb622b 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,6 +4,10 @@ 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.CustomerStaffDTO; +import com.epmet.dto.CustomerStaffGridDTO; +import com.epmet.dto.StaffGridListDTO; +import com.epmet.dto.form.AddDepartmentStaffFormDTO; import com.epmet.dto.form.DepartmentInStaffFormDTO; import com.epmet.dto.form.StaffInfoFromDTO; import com.epmet.dto.form.StaffSubmitFromDTO; @@ -82,4 +86,9 @@ public class EpmetUserFeignClientFallBack implements EpmetUserFeignClient { public Result disabledStaff(StaffInfoFromDTO fromDTO) { return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "disabledStaff", fromDTO); } + @Override + public Result> selectCustomerIdByUserId(AddDepartmentStaffFormDTO addDepartmentStaffFormDTO) { + return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "selectCustomerIdByUserId", addDepartmentStaffFormDTO); + } + } 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..2d49860de2 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 @@ -17,7 +17,9 @@ package com.epmet.service; +import com.epmet.commons.tools.security.dto.TokenDto; import com.epmet.commons.tools.utils.Result; +import com.epmet.dto.CustomerIdDTO; import com.epmet.dto.form.*; import com.epmet.dto.result.*; @@ -77,4 +79,11 @@ public interface DepartmentService { * @Description 获取机构下部门列表 */ Result> departmentList(DepartmentListFormDTO formDTO); + + /** + * 添加部门人员 + * @param addDepartmentStaffFormDTO + * @return + */ + Result addDepartmentStaff(TokenDto tokenDto,AddDepartmentStaffFormDTO addDepartmentStaffFormDTO); } \ 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 a53a6bac1c..075799dfb8 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 @@ -177,6 +177,7 @@ public class CustomerGridServiceImpl extends BaseServiceImpl griddetail(CustomerGridFormDTO customerGridFormDTO) { GridDetailResultDTO griddetail = baseDao.griddetail(customerGridFormDTO); List customerStaffGridDTOS = baseDao.selectUserIdByGridId(customerGridFormDTO); + //获取人员具体信息(头像、名字...) Result> staffGridList = epmetUserFeignClient.getStaffGridList(customerStaffGridDTOS); griddetail.setStaffGridList(staffGridList.getData()); return new Result().ok(griddetail); 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..dda0d02ae7 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 @@ -20,17 +20,20 @@ package com.epmet.service.impl; import com.epmet.commons.tools.constant.NumConstant; import com.epmet.commons.tools.exception.EpmetErrorCode; import com.epmet.commons.tools.exception.RenException; +import com.epmet.commons.tools.security.dto.TokenDto; import com.epmet.commons.tools.utils.ConvertUtils; import com.epmet.commons.tools.utils.Result; import com.epmet.constant.CustomerDepartmentConstant; import com.epmet.dao.CustomerAgencyDao; import com.epmet.dao.CustomerDepartmentDao; import com.epmet.dao.CustomerStaffDepartmentDao; +import com.epmet.dto.CustomerIdDTO; 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.entity.CustomerStaffDepartmentEntity; import com.epmet.feign.EpmetUserFeignClient; import com.epmet.service.DepartmentService; import com.epmet.util.ModuleConstant; @@ -197,4 +200,30 @@ public class DepartmentServiceImpl implements DepartmentService { List departmentList = customerDepartmentDao.selectDepartmentList(formDTO.getAgencyId()); return new Result>().ok(departmentList); } + + /** + * 添加部门人员 + * @param tokenDto + * @param addDepartmentStaffFormDTO + * @return + */ + @Override + @Transactional(rollbackFor = Exception.class) + public Result addDepartmentStaff(TokenDto tokenDto,AddDepartmentStaffFormDTO addDepartmentStaffFormDTO) { + CustomerStaffDepartmentEntity customerStaffDepartmentEntity = new CustomerStaffDepartmentEntity(); + Result> listResult = epmetUserFeignClient.selectCustomerIdByUserId(addDepartmentStaffFormDTO); + List data = listResult.getData(); + customerStaffDepartmentEntity.setDepartmentId(addDepartmentStaffFormDTO.getDepartmentId()); + customerStaffDepartmentEntity.setCreatedBy(tokenDto.getUserId()); + customerStaffDepartmentEntity.setUpdatedBy(tokenDto.getUserId()); + customerStaffDepartmentEntity.setDelFlag("0"); + customerStaffDepartmentEntity.setRevision(0); + for (CustomerIdDTO customerIdDTO : data) { + customerStaffDepartmentEntity.setUserId(customerIdDTO.getUserId()); + customerStaffDepartmentEntity.setCustomerId(customerIdDTO.getCustomerId()); + customerStaffDepartmentDao.insert(customerStaffDepartmentEntity); + } + customerStaffDepartmentDao.updateDepartmentStaffCount(data.size(),addDepartmentStaffFormDTO.getDepartmentId()); + return new Result(); + } } \ No newline at end of file diff --git a/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerStaffDepartmentDao.xml b/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerStaffDepartmentDao.xml index 86c597d402..d0d80492b6 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerStaffDepartmentDao.xml +++ b/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerStaffDepartmentDao.xml @@ -26,5 +26,15 @@ + + + UPDATE + customer_department + SET + total_user = total_user + #{addCount} + WHERE + id = #{departmentId} + + \ No newline at end of file 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 f1ed7bd6ba..748252137b 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 @@ -27,6 +27,10 @@ import com.epmet.commons.tools.validator.group.DefaultGroup; import com.epmet.commons.tools.validator.group.UpdateGroup; import com.epmet.dto.*; import com.epmet.dto.form.*; +import com.epmet.dto.CustomerStaffDTO; +import com.epmet.dto.CustomerStaffGridDTO; +import com.epmet.dto.StaffGridListDTO; +import com.epmet.dto.form.*; import com.epmet.dto.result.DepartInStaffListResultDTO; import com.epmet.dto.result.StaffDetailResultDTO; import com.epmet.dto.result.StaffInfoResultDTO; @@ -145,18 +149,13 @@ public class CustomerStaffController { return customerStaffService.getCustomerStaffInfoByUserId(formDTO); } - @PostMapping(value = "selectgridstaffcountbyuserid") - public Result selectGridStaffCountByUserId(@RequestBody UserIdDTO userIdDTO){ - return customerStaffService.selectGridStaffCountByUserId(userIdDTO); - } - /** * 组织首页-工作人员列表 * @param fromDTO * @return */ @PostMapping("staffsinagency") - public Result> getStaffInfoForHome(@RequestBody StaffsInAgencyFromDTO fromDTO) { + public Result> getStaffInfoForHome(StaffsInAgencyFromDTO fromDTO) { return customerStaffService.getStaffInfoForHome(fromDTO); } @@ -166,74 +165,18 @@ public class CustomerStaffController { * @return */ @PostMapping("stafflist") - public Result> getStaffList(@RequestBody StaffsInAgencyFromDTO fromDTO) { + public Result> getStaffList(StaffsInAgencyFromDTO fromDTO) { return customerStaffService.getStaffList(fromDTO); } /** - * 人员添加页面初始化 - * - * @param fromDTO 参数 - * @return Result + * 查询网格下未被禁用人员 + * @param userIdDTO + * @auther zxc */ - @PostMapping("rolelist") - public Result addStaffInit(@RequestBody StaffInfoFromDTO fromDTO){ - return customerStaffService.addStaffInit(fromDTO); - } - - /** - * 人员编辑页面初始化 - * - * @param fromDTO 参数 - * @return Result - */ - @PostMapping("editstaffinit") - public Result editStaffInit(@RequestBody StaffInfoFromDTO fromDTO){ - return customerStaffService.editStaffInit(fromDTO); - } - - /** - * 人员添加 - * - * @param fromDTO 参数 - * @return Result - */ - @PostMapping("addstaff") - public Result addStaff(@RequestBody StaffSubmitFromDTO fromDTO){ - return customerStaffService.addStaff(fromDTO); - } - - /** - * 人员编辑 - * - * @param fromDTO 参数 - * @return Result - */ - @PostMapping("editstaff") - public Result editStaff(@RequestBody StaffSubmitFromDTO fromDTO){ - return customerStaffService.editStaff(fromDTO); - } - - /** - * 人员详情 - * - * @param fromDTO 参数 - * @return Result - */ - @PostMapping("staffdetail") - public Result getStaffDetail(@RequestBody StaffInfoFromDTO fromDTO){ - return customerStaffService.getStaffDetail(fromDTO); - } - - /** - * 人员禁用 - * - * @param fromDTO 参数 - * @return Result - */ - @PostMapping("disabledstaff") - public Result disabledStaff(@RequestBody StaffInfoFromDTO fromDTO){ - return customerStaffService.disabledStaff(fromDTO); + @PostMapping(value = "selectgridstaffcountbyuserid") + public Result selectGridStaffCountByUserId(@RequestBody UserIdDTO userIdDTO){ + return customerStaffService.selectGridStaffCountByUserId(userIdDTO); } /** @@ -246,4 +189,9 @@ public class CustomerStaffController { public Result> getDepartmentStaffList(DepartmentInStaffFormDTO fromDTO) { return customerStaffService.getDepartmentStaffList(fromDTO); } + + @PostMapping(value = "selectcustomeridbyuserid") + public Result> selectCustomerIdByUserId(@RequestBody AddDepartmentStaffFormDTO addDepartmentStaffFormDTO){ + return customerStaffService.selectCustomerIdByUserId(addDepartmentStaffFormDTO); + } } \ 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 e74e4b6ce5..6c4cab6dc7 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 @@ -20,10 +20,7 @@ package com.epmet.dao; import com.epmet.commons.mybatis.dao.BaseDao; import com.epmet.commons.tools.utils.Result; import com.epmet.dto.*; -import com.epmet.dto.form.CustomerStaffFormDTO; -import com.epmet.dto.form.StaffInfoFromDTO; -import com.epmet.dto.form.DepartmentInStaffFormDTO; -import com.epmet.dto.form.StaffsInAgencyFromDTO; +import com.epmet.dto.form.*; import com.epmet.dto.result.DepartInStaffListResultDTO; import com.epmet.dto.result.StaffInfoResultDTO; import com.epmet.entity.CustomerStaffEntity; @@ -115,4 +112,11 @@ public interface CustomerStaffDao extends BaseDao { * @Description 根据客户Id及userId集合查询用户基本信息 */ List selectDepartmentStaffList(DepartmentInStaffFormDTO fromDTO); + + /** + * + * @param departmentStaffFormDTO + * @auther zxc + */ + List selectCustomerIdByUserId(AddDepartmentStaffFormDTO departmentStaffFormDTO); } \ 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 a79bafba8b..abd130c21c 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 @@ -21,15 +21,10 @@ 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.*; -import com.epmet.dto.form.CustomerGridFormDTO; +import com.epmet.dto.form.*; 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.form.StaffInfoFromDTO; -import com.epmet.dto.form.StaffSubmitFromDTO; -import com.epmet.dto.form.DepartmentInStaffFormDTO; -import com.epmet.dto.form.StaffsInAgencyFromDTO; import com.epmet.dto.result.StaffDetailResultDTO; import com.epmet.dto.result.DepartInStaffListResultDTO; import com.epmet.dto.result.StaffInfoResultDTO; @@ -218,4 +213,11 @@ public interface CustomerStaffService extends BaseService { * @Description 根据客户Id及userId集合查询用户基本信息 */ Result> getDepartmentStaffList(DepartmentInStaffFormDTO fromDTO); + + /** + * 根据userId查询customerId + * @param: addDepartmentStaffFormDTO + * @auther: zxc + */ + Result> selectCustomerIdByUserId(AddDepartmentStaffFormDTO addDepartmentStaffFormDTO); } \ 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 fdd47f560d..d3a98772bd 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 @@ -32,6 +32,17 @@ import com.epmet.dao.CustomerStaffDao; import com.epmet.dto.*; import com.epmet.dto.form.*; import com.epmet.dto.result.*; +import com.epmet.dto.form.*; +import com.epmet.dto.CustomerStaffDTO; +import com.epmet.dto.CustomerStaffGridDTO; +import com.epmet.dto.GovStaffRoleDTO; +import com.epmet.dto.StaffGridListDTO; +import com.epmet.dto.StaffRoleDTO; +import com.epmet.dto.result.StaffDetailResultDTO; +import com.epmet.dto.result.DepartInStaffListResultDTO; +import com.epmet.dto.result.StaffInfoResultDTO; +import com.epmet.dto.result.StaffInitResultDTO; +import com.epmet.dto.result.StaffRoleResultDTO; import com.epmet.entity.CustomerStaffEntity; import com.epmet.entity.GovStaffRoleEntity; import com.epmet.entity.StaffRoleEntity; @@ -352,4 +363,14 @@ public class CustomerStaffServiceImpl extends BaseServiceImpl>().ok(staffList); } + /** + * + * @param: addDepartmentStaffFormDTO + * @auther: zxc + */ + @Override + public Result> selectCustomerIdByUserId(AddDepartmentStaffFormDTO addDepartmentStaffFormDTO) { + return new Result>().ok(baseDao.selectCustomerIdByUserId(addDepartmentStaffFormDTO)); + } + } \ 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 b2bd97dbd4..d1cfdd797d 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 @@ -145,4 +145,20 @@ ORDER BY CONVERT (real_name USING gbk) ASC + + + \ No newline at end of file From 9f1d40240fb1b59ee03c00fd6bee3e5acb7054bb Mon Sep 17 00:00:00 2001 From: wxz Date: Sat, 25 Apr 2020 14:28:26 +0800 Subject: [PATCH 81/85] =?UTF-8?q?1.=E6=9D=83=E9=99=90=E8=BF=87=E6=BB=A4-?= =?UTF-8?q?=E5=9F=BA=E6=9C=AC=E5=AE=8C=E6=88=90=E4=B8=8B=E7=BA=A7=E7=B3=BB?= =?UTF-8?q?=E5=88=97=EF=BC=8C=E9=98=B6=E6=AE=B5=E6=80=A7=E6=8F=90=E4=BA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mybatis/aspect/DataFilterAspect.java | 232 +++++++++++++++--- .../mybatis/constant/OpeScopeConstant.java | 17 ++ .../mybatis/dto/form/OperationScopeDTO.java | 87 +++++++ .../dto/form/OperationScopeFormDTO.java | 18 ++ .../dto/form/StaffPermCacheResultDTO.java | 25 ++ .../mybatis/feign/GovAccessFeignClient.java | 17 +- .../GovAccessFeignClientFallback.java | 12 +- .../commons/tools/aspect/AccessOpeAspect.java | 2 - .../tools/security/dto/GovTokenDto.java | 23 +- .../java/com/epmet/dto/OperationScopeDTO.java | 81 ++++++ .../main/java/com/epmet/dto/RoleScopeDTO.java | 86 +++++++ .../epmet/dto/form/OperationScopeFormDTO.java | 18 ++ .../epmet/dto/form/StaffPermCacheFormDTO.java | 10 + .../dto/result/StaffPermCacheResultDTO.java | 26 ++ .../epmet/controller/AccessController.java | 49 +++- .../java/com/epmet/dao/OperationScopeDao.java | 45 ++++ .../main/java/com/epmet/dao/RoleScopeDao.java | 33 +++ .../epmet/entity/OperationScopeEntity.java | 51 ++++ .../com/epmet/entity/RoleScopeEntity.java | 56 +++++ .../com/epmet/redis/OperationScopeRedis.java | 47 ++++ .../java/com/epmet/redis/RoleScopeRedis.java | 47 ++++ .../java/com/epmet/service/AccessService.java | 16 +- .../epmet/service/OperationScopeService.java | 95 +++++++ .../com/epmet/service/RoleScopeService.java | 95 +++++++ .../epmet/service/impl/AccessServiceImpl.java | 29 ++- .../impl/OperationScopeServiceImpl.java | 104 ++++++++ .../service/impl/RoleScopeServiceImpl.java | 104 ++++++++ .../db.migration/epmet_gov_access.sql | 3 +- .../resources/mapper/OperationScopeDao.xml | 29 +++ .../main/resources/mapper/RoleScopeDao.xml | 20 ++ .../epmet/controller/AccessController.java | 2 +- .../com/epmet/feign/GovOrgFeignClient.java | 8 + .../fallback/GovOrgFeignClientFallBack.java | 6 + .../epmet/service/impl/AccessServiceImpl.java | 47 +++- .../epmet/controller/AgencyController.java | 25 +- .../java/com/epmet/service/AgencyService.java | 8 + .../epmet/service/impl/AgencyServiceImpl.java | 5 + .../mapper/CustomerStaffDepartmentDao.xml | 2 +- .../java/com/epmet/dto/GovStaffRoleDTO.java | 2 +- .../epmet/controller/StaffRoleController.java | 4 +- .../com/epmet/service/StaffRoleService.java | 3 +- .../service/impl/StaffRoleServiceImpl.java | 4 +- 42 files changed, 1512 insertions(+), 81 deletions(-) create mode 100644 epmet-commons/epmet-commons-mybatis/src/main/java/com/epmet/commons/mybatis/constant/OpeScopeConstant.java create mode 100644 epmet-commons/epmet-commons-mybatis/src/main/java/com/epmet/commons/mybatis/dto/form/OperationScopeDTO.java create mode 100644 epmet-commons/epmet-commons-mybatis/src/main/java/com/epmet/commons/mybatis/dto/form/OperationScopeFormDTO.java create mode 100644 epmet-commons/epmet-commons-mybatis/src/main/java/com/epmet/commons/mybatis/dto/form/StaffPermCacheResultDTO.java create mode 100644 epmet-module/gov-access/gov-access-client/src/main/java/com/epmet/dto/OperationScopeDTO.java create mode 100644 epmet-module/gov-access/gov-access-client/src/main/java/com/epmet/dto/RoleScopeDTO.java create mode 100644 epmet-module/gov-access/gov-access-client/src/main/java/com/epmet/dto/form/OperationScopeFormDTO.java create mode 100644 epmet-module/gov-access/gov-access-client/src/main/java/com/epmet/dto/result/StaffPermCacheResultDTO.java create mode 100644 epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/dao/OperationScopeDao.java create mode 100644 epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/dao/RoleScopeDao.java create mode 100644 epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/entity/OperationScopeEntity.java create mode 100644 epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/entity/RoleScopeEntity.java create mode 100644 epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/redis/OperationScopeRedis.java create mode 100644 epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/redis/RoleScopeRedis.java create mode 100644 epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/service/OperationScopeService.java create mode 100644 epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/service/RoleScopeService.java create mode 100644 epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/service/impl/OperationScopeServiceImpl.java create mode 100644 epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/service/impl/RoleScopeServiceImpl.java create mode 100644 epmet-module/gov-access/gov-access-server/src/main/resources/mapper/OperationScopeDao.xml create mode 100644 epmet-module/gov-access/gov-access-server/src/main/resources/mapper/RoleScopeDao.xml diff --git a/epmet-commons/epmet-commons-mybatis/src/main/java/com/epmet/commons/mybatis/aspect/DataFilterAspect.java b/epmet-commons/epmet-commons-mybatis/src/main/java/com/epmet/commons/mybatis/aspect/DataFilterAspect.java index 14ce3af0a1..b9431a6c48 100644 --- a/epmet-commons/epmet-commons-mybatis/src/main/java/com/epmet/commons/mybatis/aspect/DataFilterAspect.java +++ b/epmet-commons/epmet-commons-mybatis/src/main/java/com/epmet/commons/mybatis/aspect/DataFilterAspect.java @@ -1,19 +1,21 @@ /** * Copyright (c) 2018 人人开源 All rights reserved. - * + *

* https://www.renren.io - * + *

* 版权所有,侵权必究! */ package com.epmet.commons.mybatis.aspect; +import com.epmet.commons.mybatis.constant.OpeScopeConstant; +import com.epmet.commons.mybatis.dto.form.OperationScopeDTO; +import com.epmet.commons.mybatis.dto.form.StaffPermCacheResultDTO; import com.epmet.commons.mybatis.dto.form.StaffPermissionFormDTO; import com.epmet.commons.mybatis.entity.DataScope; import com.epmet.commons.mybatis.feign.GovAccessFeignClient; import com.epmet.commons.tools.aspect.AccessOpeAspect; 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.security.user.LoginUserUtil; import com.epmet.commons.tools.utils.Result; @@ -27,9 +29,7 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; import org.springframework.util.CollectionUtils; -import java.util.Arrays; -import java.util.List; -import java.util.Set; +import java.util.*; /** * 数据过滤,切面处理类 @@ -49,6 +49,8 @@ public class DataFilterAspect { @Autowired private GovAccessFeignClient govAccessFeignClient; + public static final String orgIdPathSpliter = ":"; + @Before("@annotation(com.epmet.commons.mybatis.annotation.DataFilter)") public void dataFilter(JoinPoint point) { // 反射的方式 @@ -60,20 +62,39 @@ public class DataFilterAspect { // } //} - String reqiurePermission = AccessOpeAspect.requirePermissionTl.get(); + String requirePermission = AccessOpeAspect.requirePermissionTl.get(); // 没有配置所需权限,不做操作,打印提示日志 - if (StringUtils.isBlank(reqiurePermission)) { + if (StringUtils.isBlank(requirePermission)) { log.warn("Api编码需要指定所需权限,请在Api上使用@RequirePermission注解完成所需权限配置"); return; } + StaffPermissionFormDTO staffPermissionFormDTO = new StaffPermissionFormDTO(); + staffPermissionFormDTO.setApp(loginUserUtil.getLoginUserApp()); + staffPermissionFormDTO.setClient(loginUserUtil.getLoginUserClient()); + staffPermissionFormDTO.setStaffId(loginUserUtil.getLoginUserId()); + Result result = govAccessFeignClient.getStaffCurrPermissions(staffPermissionFormDTO); + + if (result.getCode() != 0) { + // 查询不到权限,记录日志,抛出8000异常 + log.error("调用Access查询权限失败:{}", result.getMsg()); + throw new RenException(EpmetErrorCode.SERVER_ERROR.getCode()); + } + + StaffPermCacheResultDTO permCacheResultDTO = result.getData(); + + if (permCacheResultDTO == null || CollectionUtils.isEmpty(permCacheResultDTO.getPermissions())) { + log.error("操作权限不足,查询不到权限"); + throw new RenException(EpmetErrorCode.REQUIRE_PERMISSION.getCode()); + } + // 校验操作权限 - validateOpePermission(reqiurePermission); + validateOpePermission(permCacheResultDTO.getPermissions(), requirePermission); Object[] methodArgs = point.getArgs(); for (Object methodArg : methodArgs) { if (methodArg instanceof DataScope) { - ((DataScope) methodArg).setSqlFilter(getSqlFilterSegment()); + ((DataScope) methodArg).setSqlFilter(getSqlFilterSegment(permCacheResultDTO.getRoleIdList(), requirePermission, permCacheResultDTO.getOrgIdPath())); return; } } @@ -84,38 +105,187 @@ public class DataFilterAspect { /** * 校验操作权限 */ - private void validateOpePermission(String requirePermission) { - StaffPermissionFormDTO staffPermissionFormDTO = new StaffPermissionFormDTO(); - staffPermissionFormDTO.setApp(loginUserUtil.getLoginUserApp()); - staffPermissionFormDTO.setClient(loginUserUtil.getLoginUserClient()); - staffPermissionFormDTO.setStaffId(loginUserUtil.getLoginUserId()); - Result> permissions = govAccessFeignClient.getStaffCurrPermissions(staffPermissionFormDTO); - if (permissions.getCode() != 0) { - // 查询不到权限,记录日志,抛出8000异常 - log.error("调用Access查询权限失败:{}", permissions.getMsg()); - throw new RenException(EpmetErrorCode.SERVER_ERROR.getCode()); + private void validateOpePermission(Set permissions, String reqiurePermission) { + if (!permissions.contains(reqiurePermission)) { + // 权限不足 + log.error("操作权限不足"); + throw new RenException(EpmetErrorCode.REQUIRE_PERMISSION.getCode()); } - - if (!CollectionUtils.isEmpty(permissions.getData()) && StringUtils.isNotBlank(requirePermission) - && permissions.getData().contains(requirePermission)) { - // 权限允许,正常结束 - return; - } - // 权限不足抛出异常 - throw new RenException(EpmetErrorCode.REQUIRE_PERMISSION.getCode()); } /** * 生成过滤sql片段 + * * @return */ - private String getSqlFilterSegment() { + private String getSqlFilterSegment(Set roleIds, String reqiurePermission, String orgIdPath) { // 根据角色列表查询操作范围列表 + // todo 暂停,先模拟数据 + //roleIds.forEach(roleId -> { + // OperationScopeFormDTO osformDto = new OperationScopeFormDTO(); + // osformDto.setRoleId(roleId); + // osformDto.setOperationKey(reqiurePermission); + // Result> result = govAccessFeignClient.getOperationScopesByRoleId(osformDto); + // List scopeDTOS = result.getData(); + //}); + Set scopeDTOS = genScopeDtos(); - // 拼接sql语句 + // 过滤有效范围 + HashSet scopes = filteScopes(scopeDTOS); + + // 取出父组织ID path 和当前组织ID + String pOrgPath = orgIdPath.substring(0, orgIdPath.lastIndexOf(orgIdPathSpliter)); + String currOrgPath = orgIdPath.substring(orgIdPath.lastIndexOf(orgIdPathSpliter) + 1); + StringBuilder sb = new StringBuilder(" AND ("); + getOrgScopeSql(sb, scopes, currOrgPath, pOrgPath); + sb.replace(sb.lastIndexOf("OR"), sb.lastIndexOf("OR") + 3, ""); + sb.append(") "); + // 拼接sql语句 + sb.replace(141,142,""); // TODO - return "dept_id in (1,2,3)"; + return ""; + } + + /** + * 计算范围过滤sql + * @param scopes + * @param currOrg + * @param pOrgPath + * @return + */ + private void getOrgScopeSql(StringBuilder sb,HashSet scopes, String currOrg, String pOrgPath) { + for (String scope : scopes) { + switch (scope) { + case OpeScopeConstant.ORG_CURR: + getAgencyCurrScopedSql(sb, currOrg); + sb.append(" OR "); + break; + case OpeScopeConstant.ORG_CURR_AND_SUB: + getAgencyCurrAndSubScopedSql(sb, pOrgPath); + sb.append(" OR "); + break; + case OpeScopeConstant.ORG_CURR_SUB: + getAgencyCurrSubScopedSql(sb, pOrgPath, currOrg); + sb.append(" OR "); + break; + case OpeScopeConstant.ORG_EQUAL: + // todo 同级 + //sb.append(" OR "); + break; + case OpeScopeConstant.ORG_EQUAL_AND_SUB: + // todo 同级及其子级 + //sb.append(" OR "); + break; + case OpeScopeConstant.ORG_EQUAL_SUB: + // todo 同级的子级 + //sb.append(" OR "); + break; + } + } + } + + /** + * 本身 + * @param sb + * @param orgId + */ + public void getAgencyCurrScopedSql(StringBuilder sb,String orgId) { + sb.append(" ORG_ID = ").append(orgId); + } + + /** + * 本身及子级 + * @param sb + * @param pOrgIdPath + */ + public void getAgencyCurrAndSubScopedSql(StringBuilder sb,String pOrgIdPath) { + sb.append(" ORG_ID_PATH like '").append(pOrgIdPath).append("%'"); + } + + /** + * 子级组织(不含本身) + * @param sb + */ + public void getAgencyCurrSubScopedSql(StringBuilder sb,String pOrgIdPath, String currOrgIdPath) { + sb.append("ORG_ID_PATH like '").append(pOrgIdPath).append(orgIdPathSpliter).append(currOrgIdPath).append("%'"); + } + + /** + * 过滤有效范围 + * + * @param scopeDTOS + * @return + */ + private HashSet filteScopes(Set scopeDTOS) { + HashMap filtedScopes = new HashMap<>(); + + for (OperationScopeDTO scope : scopeDTOS) { + String scopeIndex = scope.getScopeIndex(); + String[] currArr = scopeIndex.split("_"); + if ("0".equals(currArr[1])) { + // 为0,说明没有包含关系,直接放入 + filtedScopes.put(scopeIndex, scope); + continue; + } + + OperationScopeDTO tempScope = filtedScopes.get(currArr[0]); + if (tempScope != null) { + // 已经有ac开头的了 + String tempScopeIndex = tempScope.getScopeIndex(); + if (Integer.valueOf(currArr[1]) < Integer.valueOf(tempScopeIndex.split("_")[1])) { + filtedScopes.put(currArr[0], scope); + } + } else { + filtedScopes.put(currArr[0], scope); + } + } + HashSet scopeStrs = new HashSet<>(); + Set> entries = filtedScopes.entrySet(); + for (Map.Entry entry : entries) { + scopeStrs.add(entry.getValue().getScopeKey()); + } + return scopeStrs; + } + + /** + * 模拟范围数据 + * + * @return + */ + private Set genScopeDtos() { + OperationScopeDTO scopeDTO1 = new OperationScopeDTO(); + scopeDTO1.setScopeKey("org_curr"); + scopeDTO1.setScopeName("本机关"); + scopeDTO1.setScopeIndex("ac_0"); + + OperationScopeDTO scopeDTO2 = new OperationScopeDTO(); + scopeDTO2.setScopeKey("org_curr_and_sub"); + scopeDTO2.setScopeName("本机关及下级"); + scopeDTO2.setScopeIndex("ac_501"); + + OperationScopeDTO scopeDTO3 = new OperationScopeDTO(); + scopeDTO3.setScopeKey("org_curr_sub"); + scopeDTO3.setScopeName("本机关的下级"); + scopeDTO3.setScopeIndex("ac_502"); + + OperationScopeDTO scopeDTO4 = new OperationScopeDTO(); + scopeDTO4.setScopeKey("org_equal_and_sub"); + scopeDTO4.setScopeName("同级机关及下级"); + scopeDTO4.setScopeIndex("ae_601"); + + OperationScopeDTO scopeDTO5 = new OperationScopeDTO(); + scopeDTO5.setScopeKey("org_equal_sub"); + scopeDTO5.setScopeName("同级机关的下级"); + scopeDTO5.setScopeIndex("ae_602"); + + Set scopeDTOS = new HashSet<>(); + scopeDTOS.add(scopeDTO1); + scopeDTOS.add(scopeDTO2); + scopeDTOS.add(scopeDTO3); + scopeDTOS.add(scopeDTO4); + scopeDTOS.add(scopeDTO5); + return scopeDTOS; } ///** diff --git a/epmet-commons/epmet-commons-mybatis/src/main/java/com/epmet/commons/mybatis/constant/OpeScopeConstant.java b/epmet-commons/epmet-commons-mybatis/src/main/java/com/epmet/commons/mybatis/constant/OpeScopeConstant.java new file mode 100644 index 0000000000..3d415ffb30 --- /dev/null +++ b/epmet-commons/epmet-commons-mybatis/src/main/java/com/epmet/commons/mybatis/constant/OpeScopeConstant.java @@ -0,0 +1,17 @@ +package com.epmet.commons.mybatis.constant; + +public class OpeScopeConstant { + //"同级组织的下级" + public static final String ORG_EQUAL_SUB = "org_equal_sub"; + //"同级组织及下级" + public static final String ORG_EQUAL_AND_SUB = "org_equal_and_sub"; + //"同级组织" + public static final String ORG_EQUAL = "org_equal"; + //"本组织的下级" + public static final String ORG_CURR_SUB = "org_curr_sub"; + //"本组织及下级" + public static final String ORG_CURR_AND_SUB = "org_curr_and_sub"; + //"本组织" + public static final String ORG_CURR = "org_curr"; + +} diff --git a/epmet-commons/epmet-commons-mybatis/src/main/java/com/epmet/commons/mybatis/dto/form/OperationScopeDTO.java b/epmet-commons/epmet-commons-mybatis/src/main/java/com/epmet/commons/mybatis/dto/form/OperationScopeDTO.java new file mode 100644 index 0000000000..494cff66b9 --- /dev/null +++ b/epmet-commons/epmet-commons-mybatis/src/main/java/com/epmet/commons/mybatis/dto/form/OperationScopeDTO.java @@ -0,0 +1,87 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

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

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

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.commons.mybatis.dto.form; + +import lombok.Data; + +import java.io.Serializable; +import java.util.Date; + + +/** + * 权限范围表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-04-24 + */ +@Data +public class OperationScopeDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * id + */ + private String id; + + /** + * 范围key + */ + private String scopeKey; + + /** + * 范围名称 + */ + private String scopeName; + + /** + * 范围序号 + */ + private String scopeIndex; + + /** + * 是否删除,0:未删除,1:已删除 + */ + private Integer delFlag; + + /** + * 乐观锁 + */ + private Integer revision; + + /** + * 创建者id + */ + private String createdBy; + + /** + * 创建时间 + */ + private Date createdTime; + + /** + * 更新者id + */ + private String updatedBy; + + /** + * 更新时间 + */ + private Date updatedTime; + +} \ No newline at end of file diff --git a/epmet-commons/epmet-commons-mybatis/src/main/java/com/epmet/commons/mybatis/dto/form/OperationScopeFormDTO.java b/epmet-commons/epmet-commons-mybatis/src/main/java/com/epmet/commons/mybatis/dto/form/OperationScopeFormDTO.java new file mode 100644 index 0000000000..fe5aca825b --- /dev/null +++ b/epmet-commons/epmet-commons-mybatis/src/main/java/com/epmet/commons/mybatis/dto/form/OperationScopeFormDTO.java @@ -0,0 +1,18 @@ +package com.epmet.commons.mybatis.dto.form; + +import lombok.Data; + +import javax.validation.constraints.NotBlank; + +@Data +public class OperationScopeFormDTO { + + public interface ListOperationScopeGroup {} + + @NotBlank(message = "角色ID不能为空", groups = {ListOperationScopeGroup.class}) + private String roleId; + + @NotBlank(message = "操作的key不能为空", groups = {ListOperationScopeGroup.class}) + private String operationKey; + +} diff --git a/epmet-commons/epmet-commons-mybatis/src/main/java/com/epmet/commons/mybatis/dto/form/StaffPermCacheResultDTO.java b/epmet-commons/epmet-commons-mybatis/src/main/java/com/epmet/commons/mybatis/dto/form/StaffPermCacheResultDTO.java new file mode 100644 index 0000000000..6f37ef7033 --- /dev/null +++ b/epmet-commons/epmet-commons-mybatis/src/main/java/com/epmet/commons/mybatis/dto/form/StaffPermCacheResultDTO.java @@ -0,0 +1,25 @@ +package com.epmet.commons.mybatis.dto.form; + +import lombok.Data; + +import java.util.Set; + +@Data +public class StaffPermCacheResultDTO { + + /** + * 权限列表 + */ + private Set permissions; + + /** + * 角色列表 + */ + private Set roleIdList; + + /** + * 机构Id + */ + private String orgIdPath; + +} diff --git a/epmet-commons/epmet-commons-mybatis/src/main/java/com/epmet/commons/mybatis/feign/GovAccessFeignClient.java b/epmet-commons/epmet-commons-mybatis/src/main/java/com/epmet/commons/mybatis/feign/GovAccessFeignClient.java index 198d996bc9..4d04adc835 100644 --- a/epmet-commons/epmet-commons-mybatis/src/main/java/com/epmet/commons/mybatis/feign/GovAccessFeignClient.java +++ b/epmet-commons/epmet-commons-mybatis/src/main/java/com/epmet/commons/mybatis/feign/GovAccessFeignClient.java @@ -1,12 +1,17 @@ package com.epmet.commons.mybatis.feign; +import com.epmet.commons.mybatis.dto.form.OperationScopeDTO; +import com.epmet.commons.mybatis.dto.form.OperationScopeFormDTO; +import com.epmet.commons.mybatis.dto.form.StaffPermCacheResultDTO; import com.epmet.commons.mybatis.dto.form.StaffPermissionFormDTO; import com.epmet.commons.mybatis.feign.fallback.GovAccessFeignClientFallback; import com.epmet.commons.tools.constant.ServiceConstant; import com.epmet.commons.tools.utils.Result; import org.springframework.cloud.openfeign.FeignClient; import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import java.util.List; import java.util.Set; /** @@ -17,10 +22,18 @@ import java.util.Set; public interface GovAccessFeignClient { /** - * 查询用户当前权限列表(DataFilterAspect中用到) + * 查询用户当前权限列表 * @return */ @PostMapping("/gov/access/access/getcurrpermissions") - Result> getStaffCurrPermissions(StaffPermissionFormDTO dto); + Result getStaffCurrPermissions(StaffPermissionFormDTO dto); + + /** + * 查询角色的操作key对应操作范围列表 + * @param operationScopeFormDTO + * @return + */ + @PostMapping("/gov/access/access/operationscopes") + Result> getOperationScopesByRoleId(OperationScopeFormDTO operationScopeFormDTO); } diff --git a/epmet-commons/epmet-commons-mybatis/src/main/java/com/epmet/commons/mybatis/feign/fallback/GovAccessFeignClientFallback.java b/epmet-commons/epmet-commons-mybatis/src/main/java/com/epmet/commons/mybatis/feign/fallback/GovAccessFeignClientFallback.java index 3c5ccd599b..2f5b9287a1 100644 --- a/epmet-commons/epmet-commons-mybatis/src/main/java/com/epmet/commons/mybatis/feign/fallback/GovAccessFeignClientFallback.java +++ b/epmet-commons/epmet-commons-mybatis/src/main/java/com/epmet/commons/mybatis/feign/fallback/GovAccessFeignClientFallback.java @@ -1,5 +1,8 @@ package com.epmet.commons.mybatis.feign.fallback; +import com.epmet.commons.mybatis.dto.form.OperationScopeDTO; +import com.epmet.commons.mybatis.dto.form.OperationScopeFormDTO; +import com.epmet.commons.mybatis.dto.form.StaffPermCacheResultDTO; import com.epmet.commons.mybatis.dto.form.StaffPermissionFormDTO; import com.epmet.commons.mybatis.feign.GovAccessFeignClient; import com.epmet.commons.tools.constant.ServiceConstant; @@ -7,7 +10,7 @@ import com.epmet.commons.tools.utils.ModuleUtils; import com.epmet.commons.tools.utils.Result; import org.springframework.stereotype.Component; -import java.util.Set; +import java.util.List; /** * 调用政府端权限 @@ -19,7 +22,12 @@ import java.util.Set; public class GovAccessFeignClientFallback implements GovAccessFeignClient { @Override - public Result> getStaffCurrPermissions(StaffPermissionFormDTO dto) { + public Result getStaffCurrPermissions(StaffPermissionFormDTO dto) { return ModuleUtils.feignConError(ServiceConstant.GOV_ACCESS_SERVER, "getStaffCurrPermissions", dto); } + + @Override + public Result> getOperationScopesByRoleId(OperationScopeFormDTO operationScopeFormDTO) { + return ModuleUtils.feignConError(ServiceConstant.GOV_ACCESS_SERVER, "getOperationScopesByRoleId", operationScopeFormDTO); + } } diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/aspect/AccessOpeAspect.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/aspect/AccessOpeAspect.java index eeeedc6508..72070ee6e1 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/aspect/AccessOpeAspect.java +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/aspect/AccessOpeAspect.java @@ -37,8 +37,6 @@ public class AccessOpeAspect { RequirePermission requirePermissionAnno = methodSignature.getMethod().getAnnotation(RequirePermission.class); String key = requirePermissionAnno.key(); String desc = requirePermissionAnno.desc(); - System.out.println(key); - System.out.println(desc); // 放入ThreadLocal,供DataFilterAspect中使用 requirePermissionTl.set(key); diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/security/dto/GovTokenDto.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/security/dto/GovTokenDto.java index 7088bb10a3..49d6cb15a3 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/security/dto/GovTokenDto.java +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/security/dto/GovTokenDto.java @@ -34,6 +34,16 @@ public class GovTokenDto extends BaseTokenDto implements Serializable { */ private String customerId; + /** + * 过期时间戳 + */ + private Long expireTime; + + /** + * 最后一次更新时间 + */ + private long updateTime; + /** * 当前登录的组织id(顶级) */ @@ -55,18 +65,13 @@ public class GovTokenDto extends BaseTokenDto implements Serializable { private List deptIdList; /** - * 过期时间戳 - */ - private Long expireTime; - - /** - * 最后一次更新时间 + * 功能权限列表,实际上是gov_staff => staff_role => role_operation查询到的operationKey */ - private long updateTime; + private Set permissions; /** - * 功能权限列表,实际上是gov_staff => staff_role => role_operation查询到的operationKey + * 角色ID列表 */ - private Set permissions; + private Set roleIdList; } diff --git a/epmet-module/gov-access/gov-access-client/src/main/java/com/epmet/dto/OperationScopeDTO.java b/epmet-module/gov-access/gov-access-client/src/main/java/com/epmet/dto/OperationScopeDTO.java new file mode 100644 index 0000000000..19e1111e96 --- /dev/null +++ b/epmet-module/gov-access/gov-access-client/src/main/java/com/epmet/dto/OperationScopeDTO.java @@ -0,0 +1,81 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

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

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

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.dto; + +import java.io.Serializable; +import java.util.Date; +import lombok.Data; + + +/** + * 权限范围表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-04-24 + */ +@Data +public class OperationScopeDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * id + */ + private String id; + + /** + * 范围key + */ + private String scopeKey; + + /** + * 范围名称 + */ + private String scopeName; + + /** + * 是否删除,0:未删除,1:已删除 + */ + private Integer delFlag; + + /** + * 乐观锁 + */ + private Integer revision; + + /** + * 创建者id + */ + private String createdBy; + + /** + * 创建时间 + */ + private Date createdTime; + + /** + * 更新者id + */ + private String updatedBy; + + /** + * 更新时间 + */ + private Date updatedTime; + +} \ No newline at end of file diff --git a/epmet-module/gov-access/gov-access-client/src/main/java/com/epmet/dto/RoleScopeDTO.java b/epmet-module/gov-access/gov-access-client/src/main/java/com/epmet/dto/RoleScopeDTO.java new file mode 100644 index 0000000000..17f8866215 --- /dev/null +++ b/epmet-module/gov-access/gov-access-client/src/main/java/com/epmet/dto/RoleScopeDTO.java @@ -0,0 +1,86 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

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

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

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.dto; + +import java.io.Serializable; +import java.util.Date; +import lombok.Data; + + +/** + * 角色能操作哪些范围 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-04-24 + */ +@Data +public class RoleScopeDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * + */ + private String id; + + /** + * 角色ID + */ + private String roleId; + + /** + * 操作key + */ + private String operationKey; + + /** + * 范围Key + */ + private String scopeKey; + + /** + * 是否删除,0:未删除,1:已删除 + */ + private Integer delFlag; + + /** + * 乐观锁 + */ + private Integer revision; + + /** + * 创建者id + */ + private String createdBy; + + /** + * 创建时间 + */ + private Date createdTime; + + /** + * 更新者id + */ + private String updatedBy; + + /** + * 更新时间 + */ + private Date updatedTime; + +} \ No newline at end of file diff --git a/epmet-module/gov-access/gov-access-client/src/main/java/com/epmet/dto/form/OperationScopeFormDTO.java b/epmet-module/gov-access/gov-access-client/src/main/java/com/epmet/dto/form/OperationScopeFormDTO.java new file mode 100644 index 0000000000..af992b7d51 --- /dev/null +++ b/epmet-module/gov-access/gov-access-client/src/main/java/com/epmet/dto/form/OperationScopeFormDTO.java @@ -0,0 +1,18 @@ +package com.epmet.dto.form; + +import lombok.Data; + +import javax.validation.constraints.NotBlank; + +@Data +public class OperationScopeFormDTO { + + public interface ListOperationScopeGroup {} + + @NotBlank(message = "角色ID不能为空", groups = {ListOperationScopeGroup.class}) + private String roleId; + + @NotBlank(message = "操作的key不能为空", groups = {ListOperationScopeGroup.class}) + private String operationKey; + +} diff --git a/epmet-module/gov-access/gov-access-client/src/main/java/com/epmet/dto/form/StaffPermCacheFormDTO.java b/epmet-module/gov-access/gov-access-client/src/main/java/com/epmet/dto/form/StaffPermCacheFormDTO.java index 56907e52af..191314af0a 100644 --- a/epmet-module/gov-access/gov-access-client/src/main/java/com/epmet/dto/form/StaffPermCacheFormDTO.java +++ b/epmet-module/gov-access/gov-access-client/src/main/java/com/epmet/dto/form/StaffPermCacheFormDTO.java @@ -36,9 +36,19 @@ public class StaffPermCacheFormDTO { @NotBlank(message = "登录头信息client不能为空", groups = {UpdatePermissionCache.class, GetStaffCurrPermissions.class}) private String client; + /** + * 组织ID路径 + */ + private String orgIdPath; + /** * 权限列表 */ private Set permissions; + /** + * 角色列表 + */ + private Set roleIdList; + } diff --git a/epmet-module/gov-access/gov-access-client/src/main/java/com/epmet/dto/result/StaffPermCacheResultDTO.java b/epmet-module/gov-access/gov-access-client/src/main/java/com/epmet/dto/result/StaffPermCacheResultDTO.java new file mode 100644 index 0000000000..0f6be83e72 --- /dev/null +++ b/epmet-module/gov-access/gov-access-client/src/main/java/com/epmet/dto/result/StaffPermCacheResultDTO.java @@ -0,0 +1,26 @@ +package com.epmet.dto.result; + +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import java.util.Set; + +@Data +public class StaffPermCacheResultDTO { + + /** + * 权限列表 + */ + private Set permissions; + + /** + * 角色列表 + */ + private Set roleIdList; + + /** + * 组织ID + */ + private String orgIdPath; + +} diff --git a/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/controller/AccessController.java b/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/controller/AccessController.java index aa954dc584..d60f7cb528 100644 --- a/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/controller/AccessController.java +++ b/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/controller/AccessController.java @@ -1,15 +1,20 @@ package com.epmet.controller; +import com.epmet.commons.tools.security.dto.GovTokenDto; import com.epmet.commons.tools.utils.Result; import com.epmet.commons.tools.validator.ValidatorUtils; +import com.epmet.dto.OperationScopeDTO; +import com.epmet.dto.form.OperationScopeFormDTO; import com.epmet.dto.form.StaffPermCacheFormDTO; +import com.epmet.dto.result.StaffPermCacheResultDTO; +import com.epmet.entity.OperationScopeEntity; import com.epmet.service.AccessService; +import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; +import org.springframework.web.bind.annotation.*; +import java.util.ArrayList; +import java.util.List; import java.util.Set; /** @@ -37,7 +42,9 @@ public class AccessController { String app = staffPermCacheFormDTO.getApp(); String client = staffPermCacheFormDTO.getClient(); Set permissions = staffPermCacheFormDTO.getPermissions(); - accessService.updatePermissionCache(staffId, app, client, permissions); + Set roleIdList = staffPermCacheFormDTO.getRoleIdList(); + String orgId = staffPermCacheFormDTO.getOrgIdPath(); + accessService.updatePermissionCache(staffId, app, client, permissions, roleIdList, orgId); return new Result(); } @@ -46,9 +53,35 @@ public class AccessController { * @return */ @PostMapping("getcurrpermissions") - public Result> getStaffCurrPermissions(@RequestBody StaffPermCacheFormDTO dto) { + public Result getStaffCurrPermissions(@RequestBody StaffPermCacheFormDTO dto) { ValidatorUtils.validateEntity(dto, StaffPermCacheFormDTO.GetStaffCurrPermissions.class); - Set permissions = accessService.listStaffCurrPermissions(dto.getApp(), dto.getClient(), dto.getStaffId()); - return new Result>().ok(permissions); + GovTokenDto govTokenDto = accessService.listStaffCurrPermissions(dto.getApp(), dto.getClient(), dto.getStaffId()); + StaffPermCacheResultDTO resultDTO = null; + if (govTokenDto != null) { + resultDTO = new StaffPermCacheResultDTO(); + resultDTO.setPermissions(govTokenDto.getPermissions()); + resultDTO.setRoleIdList(govTokenDto.getRoleIdList()); + resultDTO.setOrgIdPath(govTokenDto.getOrgIdPath()); + } + return new Result().ok(resultDTO); + } + + /** + * 查询角色的操作key对应操作范围列表(需要入缓存) + * @return + */ + // todo 需要加缓存 + @PostMapping("operationscopes") + public Result> getOperationScopesByRoleId(@RequestBody OperationScopeFormDTO operationScopeFormDTO) { + ValidatorUtils.validateEntity(operationScopeFormDTO, OperationScopeFormDTO.ListOperationScopeGroup.class); + List scopes = accessService.listOperationScopesByRoleId(operationScopeFormDTO.getRoleId(), operationScopeFormDTO.getOperationKey()); + ArrayList scopeDtos = new ArrayList<>(); + scopes.forEach(scope -> { + OperationScopeDTO scopeDTO = new OperationScopeDTO(); + BeanUtils.copyProperties(scope, scopeDTO); + scopeDtos.add(scopeDTO); + }); + + return new Result>().ok(scopeDtos); } } diff --git a/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/dao/OperationScopeDao.java b/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/dao/OperationScopeDao.java new file mode 100644 index 0000000000..a944cdd628 --- /dev/null +++ b/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/dao/OperationScopeDao.java @@ -0,0 +1,45 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

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

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

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.dao; + +import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.entity.OperationScopeEntity; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; +import org.springframework.context.annotation.Scope; + +import java.util.List; + +/** + * 权限范围表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-04-24 + */ +@Mapper +public interface OperationScopeDao extends BaseDao { + + /** + * 查询角色的操作key对应操作范围列表 + * @param roleId 角色id + * @param operationKey 操作key + * @return + */ + List listOperationScopesByRoleId(@Param("roleId") String roleId, + @Param("operationKey") String operationKey); +} \ No newline at end of file diff --git a/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/dao/RoleScopeDao.java b/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/dao/RoleScopeDao.java new file mode 100644 index 0000000000..60982f5528 --- /dev/null +++ b/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/dao/RoleScopeDao.java @@ -0,0 +1,33 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

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

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

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.dao; + +import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.entity.RoleScopeEntity; +import org.apache.ibatis.annotations.Mapper; + +/** + * 角色能操作哪些范围 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-04-24 + */ +@Mapper +public interface RoleScopeDao extends BaseDao { + +} \ No newline at end of file diff --git a/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/entity/OperationScopeEntity.java b/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/entity/OperationScopeEntity.java new file mode 100644 index 0000000000..2fd6b18361 --- /dev/null +++ b/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/entity/OperationScopeEntity.java @@ -0,0 +1,51 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

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

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

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.entity; + +import com.baomidou.mybatisplus.annotation.TableName; + +import com.epmet.commons.mybatis.entity.BaseEpmetEntity; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.util.Date; + +/** + * 权限范围表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-04-24 + */ +@Data +@EqualsAndHashCode(callSuper=false) +@TableName("operation_scope") +public class OperationScopeEntity extends BaseEpmetEntity { + + private static final long serialVersionUID = 1L; + + /** + * 范围key + */ + private String scopeKey; + + /** + * 范围名称 + */ + private String scopeName; + +} diff --git a/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/entity/RoleScopeEntity.java b/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/entity/RoleScopeEntity.java new file mode 100644 index 0000000000..2c3c6f21dc --- /dev/null +++ b/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/entity/RoleScopeEntity.java @@ -0,0 +1,56 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

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

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

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.entity; + +import com.baomidou.mybatisplus.annotation.TableName; + +import com.epmet.commons.mybatis.entity.BaseEpmetEntity; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.util.Date; + +/** + * 角色能操作哪些范围 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-04-24 + */ +@Data +@EqualsAndHashCode(callSuper=false) +@TableName("role_scope") +public class RoleScopeEntity extends BaseEpmetEntity { + + private static final long serialVersionUID = 1L; + + /** + * 角色ID + */ + private String roleId; + + /** + * 操作key + */ + private String operationKey; + + /** + * 范围Key + */ + private String scopeKey; + +} diff --git a/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/redis/OperationScopeRedis.java b/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/redis/OperationScopeRedis.java new file mode 100644 index 0000000000..3f5a7c6562 --- /dev/null +++ b/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/redis/OperationScopeRedis.java @@ -0,0 +1,47 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

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

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

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.redis; + +import com.epmet.commons.tools.redis.RedisUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +/** + * 权限范围表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-04-24 + */ +@Component +public class OperationScopeRedis { + @Autowired + private RedisUtils redisUtils; + + public void delete(Object[] ids) { + + } + + public void set(){ + + } + + public String get(String id){ + return null; + } + +} \ No newline at end of file diff --git a/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/redis/RoleScopeRedis.java b/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/redis/RoleScopeRedis.java new file mode 100644 index 0000000000..1198f8651a --- /dev/null +++ b/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/redis/RoleScopeRedis.java @@ -0,0 +1,47 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

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

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

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.redis; + +import com.epmet.commons.tools.redis.RedisUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +/** + * 角色能操作哪些范围 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-04-24 + */ +@Component +public class RoleScopeRedis { + @Autowired + private RedisUtils redisUtils; + + public void delete(Object[] ids) { + + } + + public void set(){ + + } + + public String get(String id){ + return null; + } + +} \ No newline at end of file diff --git a/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/service/AccessService.java b/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/service/AccessService.java index a9e5150db8..4355b2714b 100644 --- a/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/service/AccessService.java +++ b/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/service/AccessService.java @@ -1,5 +1,9 @@ package com.epmet.service; +import com.epmet.commons.tools.security.dto.GovTokenDto; +import com.epmet.entity.OperationScopeEntity; + +import java.util.List; import java.util.Set; public interface AccessService { @@ -8,11 +12,19 @@ public interface AccessService { * @param staffId * @param permissions */ - void updatePermissionCache(String staffId, String app, String client, Set permissions); + void updatePermissionCache(String staffId, String app, String client, Set permissions, Set roleIdList, String orgIdPath); /** * 查询用户当前权限列表 * @return */ - Set listStaffCurrPermissions(String app, String client, String staffId); + GovTokenDto listStaffCurrPermissions(String app, String client, String staffId); + + /** + * 查询角色的操作key对应操作范围列表 + * @param roleId + * @param operationKey + * @return + */ + List listOperationScopesByRoleId(String roleId, String operationKey); } diff --git a/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/service/OperationScopeService.java b/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/service/OperationScopeService.java new file mode 100644 index 0000000000..cb24b913c0 --- /dev/null +++ b/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/service/OperationScopeService.java @@ -0,0 +1,95 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

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

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

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.service; + +import com.epmet.commons.mybatis.service.BaseService; +import com.epmet.commons.tools.page.PageData; +import com.epmet.dto.OperationScopeDTO; +import com.epmet.entity.OperationScopeEntity; + +import java.util.List; +import java.util.Map; + +/** + * 权限范围表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-04-24 + */ +public interface OperationScopeService extends BaseService { + + /** + * 默认分页 + * + * @param params + * @return PageData + * @author generator + * @date 2020-04-24 + */ + PageData page(Map params); + + /** + * 默认查询 + * + * @param params + * @return java.util.List + * @author generator + * @date 2020-04-24 + */ + List list(Map params); + + /** + * 单条查询 + * + * @param id + * @return OperationScopeDTO + * @author generator + * @date 2020-04-24 + */ + OperationScopeDTO get(String id); + + /** + * 默认保存 + * + * @param dto + * @return void + * @author generator + * @date 2020-04-24 + */ + void save(OperationScopeDTO dto); + + /** + * 默认更新 + * + * @param dto + * @return void + * @author generator + * @date 2020-04-24 + */ + void update(OperationScopeDTO dto); + + /** + * 批量删除 + * + * @param ids + * @return void + * @author generator + * @date 2020-04-24 + */ + void delete(String[] ids); +} \ No newline at end of file diff --git a/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/service/RoleScopeService.java b/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/service/RoleScopeService.java new file mode 100644 index 0000000000..34cdd6e07f --- /dev/null +++ b/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/service/RoleScopeService.java @@ -0,0 +1,95 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

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

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

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.service; + +import com.epmet.commons.mybatis.service.BaseService; +import com.epmet.commons.tools.page.PageData; +import com.epmet.dto.RoleScopeDTO; +import com.epmet.entity.RoleScopeEntity; + +import java.util.List; +import java.util.Map; + +/** + * 角色能操作哪些范围 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-04-24 + */ +public interface RoleScopeService extends BaseService { + + /** + * 默认分页 + * + * @param params + * @return PageData + * @author generator + * @date 2020-04-24 + */ + PageData page(Map params); + + /** + * 默认查询 + * + * @param params + * @return java.util.List + * @author generator + * @date 2020-04-24 + */ + List list(Map params); + + /** + * 单条查询 + * + * @param id + * @return RoleScopeDTO + * @author generator + * @date 2020-04-24 + */ + RoleScopeDTO get(String id); + + /** + * 默认保存 + * + * @param dto + * @return void + * @author generator + * @date 2020-04-24 + */ + void save(RoleScopeDTO dto); + + /** + * 默认更新 + * + * @param dto + * @return void + * @author generator + * @date 2020-04-24 + */ + void update(RoleScopeDTO dto); + + /** + * 批量删除 + * + * @param ids + * @return void + * @author generator + * @date 2020-04-24 + */ + void delete(String[] ids); +} \ No newline at end of file diff --git a/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/service/impl/AccessServiceImpl.java b/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/service/impl/AccessServiceImpl.java index cd846aa3b8..95b01a1f0c 100644 --- a/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/service/impl/AccessServiceImpl.java +++ b/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/service/impl/AccessServiceImpl.java @@ -2,6 +2,8 @@ package com.epmet.service.impl; import com.epmet.commons.tools.security.dto.GovTokenDto; import com.epmet.commons.tools.utils.CpUserDetailRedis; +import com.epmet.dao.OperationScopeDao; +import com.epmet.entity.OperationScopeEntity; import com.epmet.service.AccessService; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -10,6 +12,7 @@ import org.springframework.stereotype.Service; import org.springframework.util.CollectionUtils; import java.util.HashSet; +import java.util.List; import java.util.Set; @Service @@ -20,19 +23,25 @@ public class AccessServiceImpl implements AccessService { @Autowired private CpUserDetailRedis cpUserDetailRedis; + @Autowired + private OperationScopeDao operationScopeDao; + /** * 更新权限缓存 * @param staffId * @param permissions */ @Override - public void updatePermissionCache(String staffId, String app, String client, Set permissions) { + public void updatePermissionCache(String staffId, String app, String client, Set permissions, Set roleIdList, String orgIdPath) { GovTokenDto govTokenDto = cpUserDetailRedis.get(app, client, staffId, GovTokenDto.class); if (govTokenDto == null) { logger.warn("更新[{}]用户缓存:Redis中不存在该用户TokenDto缓存信息", staffId); return ; } + // 将权限,角色列表,和当前组织ID存入TokenDto govTokenDto.setPermissions(permissions); + govTokenDto.setRoleIdList(roleIdList); + govTokenDto.setOrgIdPath(orgIdPath); // 将新的TokenDto更新到redis中 long expire = cpUserDetailRedis.getExpire(app, client, staffId); @@ -41,11 +50,17 @@ public class AccessServiceImpl implements AccessService { } @Override - public Set listStaffCurrPermissions(String app, String client, String staffId) { - GovTokenDto govTokenDto = cpUserDetailRedis.get(app, client, staffId, GovTokenDto.class); - if (govTokenDto == null || CollectionUtils.isEmpty(govTokenDto.getPermissions())) { - return new HashSet<>(); - } - return new HashSet<>(govTokenDto.getPermissions()); + public GovTokenDto listStaffCurrPermissions(String app, String client, String staffId) { + return cpUserDetailRedis.get(app, client, staffId, GovTokenDto.class); + } + + /** + * 查询角色的操作key对应操作范围列表 + * @param roleId + * @param operationKey + * @return + */ + public List listOperationScopesByRoleId(String roleId, String operationKey) { + return operationScopeDao.listOperationScopesByRoleId(roleId, operationKey); } } diff --git a/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/service/impl/OperationScopeServiceImpl.java b/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/service/impl/OperationScopeServiceImpl.java new file mode 100644 index 0000000000..fe8f8b4079 --- /dev/null +++ b/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/service/impl/OperationScopeServiceImpl.java @@ -0,0 +1,104 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

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

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

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; +import com.epmet.commons.tools.page.PageData; +import com.epmet.commons.tools.utils.ConvertUtils; +import com.epmet.commons.tools.constant.FieldConstant; +import com.epmet.dao.OperationScopeDao; +import com.epmet.dto.OperationScopeDTO; +import com.epmet.entity.OperationScopeEntity; +import com.epmet.redis.OperationScopeRedis; +import com.epmet.service.OperationScopeService; +import org.apache.commons.lang3.StringUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.util.Arrays; +import java.util.List; +import java.util.Map; + +/** + * 权限范围表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-04-24 + */ +@Service +public class OperationScopeServiceImpl extends BaseServiceImpl implements OperationScopeService { + + @Autowired + private OperationScopeRedis operationScopeRedis; + + @Override + public PageData page(Map params) { + IPage page = baseDao.selectPage( + getPage(params, FieldConstant.CREATED_TIME, false), + getWrapper(params) + ); + return getPageData(page, OperationScopeDTO.class); + } + + @Override + public List list(Map params) { + List entityList = baseDao.selectList(getWrapper(params)); + + return ConvertUtils.sourceToTarget(entityList, OperationScopeDTO.class); + } + + private QueryWrapper getWrapper(Map params){ + String id = (String)params.get(FieldConstant.ID_HUMP); + + QueryWrapper wrapper = new QueryWrapper<>(); + wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id); + + return wrapper; + } + + @Override + public OperationScopeDTO get(String id) { + OperationScopeEntity entity = baseDao.selectById(id); + return ConvertUtils.sourceToTarget(entity, OperationScopeDTO.class); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void save(OperationScopeDTO dto) { + OperationScopeEntity entity = ConvertUtils.sourceToTarget(dto, OperationScopeEntity.class); + insert(entity); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void update(OperationScopeDTO dto) { + OperationScopeEntity entity = ConvertUtils.sourceToTarget(dto, OperationScopeEntity.class); + updateById(entity); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void delete(String[] ids) { + // 逻辑删除(@TableLogic 注解) + baseDao.deleteBatchIds(Arrays.asList(ids)); + } + +} \ No newline at end of file diff --git a/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/service/impl/RoleScopeServiceImpl.java b/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/service/impl/RoleScopeServiceImpl.java new file mode 100644 index 0000000000..4417549965 --- /dev/null +++ b/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/service/impl/RoleScopeServiceImpl.java @@ -0,0 +1,104 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

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

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

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; +import com.epmet.commons.tools.page.PageData; +import com.epmet.commons.tools.utils.ConvertUtils; +import com.epmet.commons.tools.constant.FieldConstant; +import com.epmet.dao.RoleScopeDao; +import com.epmet.dto.RoleScopeDTO; +import com.epmet.entity.RoleScopeEntity; +import com.epmet.redis.RoleScopeRedis; +import com.epmet.service.RoleScopeService; +import org.apache.commons.lang3.StringUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.util.Arrays; +import java.util.List; +import java.util.Map; + +/** + * 角色能操作哪些范围 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-04-24 + */ +@Service +public class RoleScopeServiceImpl extends BaseServiceImpl implements RoleScopeService { + + @Autowired + private RoleScopeRedis roleScopeRedis; + + @Override + public PageData page(Map params) { + IPage page = baseDao.selectPage( + getPage(params, FieldConstant.CREATED_TIME, false), + getWrapper(params) + ); + return getPageData(page, RoleScopeDTO.class); + } + + @Override + public List list(Map params) { + List entityList = baseDao.selectList(getWrapper(params)); + + return ConvertUtils.sourceToTarget(entityList, RoleScopeDTO.class); + } + + private QueryWrapper getWrapper(Map params){ + String id = (String)params.get(FieldConstant.ID_HUMP); + + QueryWrapper wrapper = new QueryWrapper<>(); + wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id); + + return wrapper; + } + + @Override + public RoleScopeDTO get(String id) { + RoleScopeEntity entity = baseDao.selectById(id); + return ConvertUtils.sourceToTarget(entity, RoleScopeDTO.class); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void save(RoleScopeDTO dto) { + RoleScopeEntity entity = ConvertUtils.sourceToTarget(dto, RoleScopeEntity.class); + insert(entity); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void update(RoleScopeDTO dto) { + RoleScopeEntity entity = ConvertUtils.sourceToTarget(dto, RoleScopeEntity.class); + updateById(entity); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void delete(String[] ids) { + // 逻辑删除(@TableLogic 注解) + baseDao.deleteBatchIds(Arrays.asList(ids)); + } + +} \ No newline at end of file diff --git a/epmet-module/gov-access/gov-access-server/src/main/resources/db.migration/epmet_gov_access.sql b/epmet-module/gov-access/gov-access-server/src/main/resources/db.migration/epmet_gov_access.sql index bcc1d74a5d..6bcbc33e76 100644 --- a/epmet-module/gov-access/gov-access-server/src/main/resources/db.migration/epmet_gov_access.sql +++ b/epmet-module/gov-access/gov-access-server/src/main/resources/db.migration/epmet_gov_access.sql @@ -61,7 +61,8 @@ CREATE TABLE `role_operation` ( CREATE TABLE `role_scope` ( `ID` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, `ROLE_ID` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '角色ID', - `SCOPE_KEY` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '范围Key', + `OPERATION_KEY` varchar(30) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '操作Key', + `SCOPE_KEY` varchar(30) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '范围Key', `DEL_FLAG` tinyint(1) NULL DEFAULT NULL COMMENT '是否删除,0:未删除,1:已删除', `REVISION` int(10) NULL DEFAULT NULL COMMENT '乐观锁', `CREATED_BY` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '创建者id', diff --git a/epmet-module/gov-access/gov-access-server/src/main/resources/mapper/OperationScopeDao.xml b/epmet-module/gov-access/gov-access-server/src/main/resources/mapper/OperationScopeDao.xml new file mode 100644 index 0000000000..dd4554f5d8 --- /dev/null +++ b/epmet-module/gov-access/gov-access-server/src/main/resources/mapper/OperationScopeDao.xml @@ -0,0 +1,29 @@ + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/epmet-module/gov-access/gov-access-server/src/main/resources/mapper/RoleScopeDao.xml b/epmet-module/gov-access/gov-access-server/src/main/resources/mapper/RoleScopeDao.xml new file mode 100644 index 0000000000..fdca928212 --- /dev/null +++ b/epmet-module/gov-access/gov-access-server/src/main/resources/mapper/RoleScopeDao.xml @@ -0,0 +1,20 @@ + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/controller/AccessController.java b/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/controller/AccessController.java index 173e19243a..61944d3939 100644 --- a/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/controller/AccessController.java +++ b/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/controller/AccessController.java @@ -30,7 +30,7 @@ public class AccessController { private AccessService accessService; /** - * 查询用户可操作功能列表(包含缓存) + * 查询用户可操作功能列表(同时更新缓存) * @param tokenDto * @param staffOperationDTO * @return diff --git a/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/feign/GovOrgFeignClient.java b/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/feign/GovOrgFeignClient.java index 737988fd0b..8c03d28764 100644 --- a/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/feign/GovOrgFeignClient.java +++ b/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/feign/GovOrgFeignClient.java @@ -2,6 +2,7 @@ package com.epmet.feign; import com.epmet.commons.tools.constant.ServiceConstant; import com.epmet.commons.tools.utils.Result; +import com.epmet.dto.CustomerAgencyDTO; import com.epmet.dto.form.LatestGridFormDTO; import com.epmet.dto.result.CustomerGridByUserIdResultDTO; import com.epmet.dto.result.LatestCustomerResultDTO; @@ -49,4 +50,11 @@ public interface GovOrgFeignClient { @PostMapping(value = "/gov/org/customerstaffgrid/getstaffgrid") Result getStaffGrid(@RequestBody LatestGridFormDTO latestGridFormDTO); + /** + * 根据Id查询agency + * @param agencyId + * @return + */ + @PostMapping("/gov/org/agency/{agencyId}") + Result getAgencyById(@PathVariable("agencyId") String agencyId); } diff --git a/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/feign/fallback/GovOrgFeignClientFallBack.java b/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/feign/fallback/GovOrgFeignClientFallBack.java index 818a325666..128f81bd50 100644 --- a/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/feign/fallback/GovOrgFeignClientFallBack.java +++ b/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/feign/fallback/GovOrgFeignClientFallBack.java @@ -3,6 +3,7 @@ package com.epmet.feign.fallback; import com.epmet.commons.tools.constant.ServiceConstant; import com.epmet.commons.tools.utils.ModuleUtils; import com.epmet.commons.tools.utils.Result; +import com.epmet.dto.CustomerAgencyDTO; import com.epmet.dto.form.LatestGridFormDTO; import com.epmet.dto.result.CustomerGridByUserIdResultDTO; import com.epmet.dto.result.LatestCustomerResultDTO; @@ -28,6 +29,11 @@ public class GovOrgFeignClientFallBack implements GovOrgFeignClient { return ModuleUtils.feignConError(ServiceConstant.GOV_ORG_SERVER, "getStaffGrid",latestGridFormDTO); } + @Override + public Result getAgencyById(String agencyId) { + return ModuleUtils.feignConError(ServiceConstant.GOV_ORG_SERVER, "getAgencyById", agencyId); + } + @Override public Result getLatestCustomer(String userId) { return ModuleUtils.feignConError(ServiceConstant.GOV_ORG_SERVER, "getLatestCustomer", userId); diff --git a/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/service/impl/AccessServiceImpl.java b/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/service/impl/AccessServiceImpl.java index 1da258978a..d76e2e2f34 100644 --- a/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/service/impl/AccessServiceImpl.java +++ b/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/service/impl/AccessServiceImpl.java @@ -1,14 +1,20 @@ package com.epmet.service.impl; +import com.epmet.commons.tools.exception.EpmetErrorCode; +import com.epmet.commons.tools.exception.RenException; import com.epmet.commons.tools.utils.CpUserDetailRedis; import com.epmet.commons.tools.utils.Result; +import com.epmet.dto.CustomerAgencyDTO; import com.epmet.dto.GovStaffRoleDTO; import com.epmet.dto.form.StaffPermCacheFormDTO; import com.epmet.dto.form.StaffRoleFormDTO; import com.epmet.dto.result.RoleOperationResultDTO; import com.epmet.feign.EpmetUserFeignClient; import com.epmet.feign.GovAccessFeignClient; +import com.epmet.feign.GovOrgFeignClient; import com.epmet.service.AccessService; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.util.CollectionUtils; @@ -21,12 +27,17 @@ import java.util.Set; @Service public class AccessServiceImpl implements AccessService { + private static Logger logger = LoggerFactory.getLogger(AccessServiceImpl.class); + @Autowired private EpmetUserFeignClient userFeignClient; @Autowired private GovAccessFeignClient govAccessFeignClient; + @Autowired + private GovOrgFeignClient govOrgFeignClient; + @Autowired private CpUserDetailRedis cpUserDetailRedis; @@ -49,24 +60,46 @@ public class AccessServiceImpl implements AccessService { roleDTOS.addAll(gridResult.getData()); } - // 拼装 + // 拼装操作key列表 Set opeKeys = new HashSet<>(); + // 角色ID列表 + Set roleIds = new HashSet<>(); roleDTOS.forEach(roleDto -> { String roleId = roleDto.getId(); - List roleOperations = govAccessFeignClient.listOperationsByRoleId(roleId).getData(); - roleOperations.forEach(roleOpe -> { - if (roleOpe != null) { - opeKeys.add(roleOpe.getOperationKey()); - } - }); + Result> result = govAccessFeignClient.listOperationsByRoleId(roleId); + if (result.getCode() != 0) { + // 获取operation异常 + logger.error("调用GovAccess,根据RoleId查询Operation列表失败:{}", result.getMsg()); + throw new RenException(EpmetErrorCode.SERVER_ERROR.getCode()); + } + List roleOperations = result.getData(); + // 角色id + roleIds.add(roleDto.getId()); + if (!CollectionUtils.isEmpty(roleOperations)) { + roleOperations.forEach(roleOpe -> { + if (roleOpe != null) { + opeKeys.add(roleOpe.getOperationKey()); + } + }); + } }); + // 查询该直属机关的orgIdPath + Result agencyById = govOrgFeignClient.getAgencyById(agencyId); + if (agencyById.getCode() != 0 || agencyById.getData() == null) { + logger.error("根据当前机构id[{}]查询pids失败:{}", agencyId, agencyById.getMsg()); + throw new RenException(EpmetErrorCode.SERVER_ERROR.getCode()); + } + // 将最新权限缓存到redis,为了尽量统一操作入口,调用gov-access接口实现 StaffPermCacheFormDTO staffPermCacheFormDTO = new StaffPermCacheFormDTO(); staffPermCacheFormDTO.setApp(app); staffPermCacheFormDTO.setClient(client); staffPermCacheFormDTO.setStaffId(staffId); staffPermCacheFormDTO.setPermissions(opeKeys); + staffPermCacheFormDTO.setRoleIdList(roleIds); + // 拼接orgIdPath + staffPermCacheFormDTO.setOrgIdPath(String.format("%s:%s", agencyById.getData().getPids(), agencyId)); govAccessFeignClient.updatePermissionCache(staffPermCacheFormDTO); return opeKeys; } diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/AgencyController.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/AgencyController.java index b8b8300489..728e6e03a8 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/AgencyController.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/AgencyController.java @@ -18,17 +18,17 @@ package com.epmet.controller; import com.epmet.commons.tools.utils.Result; +import com.epmet.dto.CustomerAgencyDTO; import com.epmet.dto.form.*; import com.epmet.dto.result.AddAgencyResultDTO; import com.epmet.dto.result.AgencyListResultDTO; import com.epmet.dto.result.AgencysResultDTO; import com.epmet.dto.result.SubAgencyResultDTO; +import com.epmet.entity.CustomerAgencyEntity; import com.epmet.service.AgencyService; +import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; +import org.springframework.web.bind.annotation.*; import java.util.List; @@ -110,4 +110,21 @@ public class AgencyController { public Result> agencyList(@RequestBody AgencyListFormDTO formDTO) { return agencyService.agencyList(formDTO); } + + /** + * 根据Id查询agency + * @param agencyId + * @return + */ + @PostMapping("{agencyId}") + public Result getAgencyById(@PathVariable("agencyId") String agencyId) { + CustomerAgencyEntity agency = agencyService.getAgencyById(agencyId); + CustomerAgencyDTO customerAgencyDTO = new CustomerAgencyDTO(); + if (agency != null) { + BeanUtils.copyProperties(agency, customerAgencyDTO); + return new Result().ok(customerAgencyDTO); + } + return new Result(); + } + } \ No newline at end of file diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/AgencyService.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/AgencyService.java index f2edc0c462..d09e56ba05 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/AgencyService.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/AgencyService.java @@ -23,6 +23,7 @@ import com.epmet.dto.result.AddAgencyResultDTO; import com.epmet.dto.result.AgencyListResultDTO; import com.epmet.dto.result.AgencysResultDTO; import com.epmet.dto.result.SubAgencyResultDTO; +import com.epmet.entity.CustomerAgencyEntity; import java.util.List; @@ -80,4 +81,11 @@ public interface AgencyService { * @Description 获取组织列表 */ Result> agencyList(AgencyListFormDTO formDTO); + + /** + * 根据Id查询 + * @param agencyId + * @return + */ + CustomerAgencyEntity getAgencyById(String agencyId); } \ No newline at end of file diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/AgencyServiceImpl.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/AgencyServiceImpl.java index a71c53e80a..7177d64d7e 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/AgencyServiceImpl.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/AgencyServiceImpl.java @@ -184,4 +184,9 @@ public class AgencyServiceImpl implements AgencyService { List agencyList = customerAgencyDao.selectAgencyList(formDTO.getAgencyId()); return new Result>().ok(agencyList); } + + @Override + public CustomerAgencyEntity getAgencyById(String agencyId) { + return customerAgencyDao.selectById(agencyId); + } } \ No newline at end of file diff --git a/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerStaffDepartmentDao.xml b/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerStaffDepartmentDao.xml index d0d80492b6..eaedaef1a6 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerStaffDepartmentDao.xml +++ b/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerStaffDepartmentDao.xml @@ -22,7 +22,7 @@ customer_staff_department WHERE del_flag = '0' - AND department_id = #{} + AND department_id = #{departmentId} diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/GovStaffRoleDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/GovStaffRoleDTO.java index 78905406ba..9bc2f4c4de 100644 --- a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/GovStaffRoleDTO.java +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/GovStaffRoleDTO.java @@ -23,7 +23,7 @@ import lombok.Data; /** - * 政府端角色表 + * 政府端角色字典表 * * @author generator generator@elink-cn.com * @since v1.0.0 2020-04-22 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..c3fc1b9f24 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 @@ -1,5 +1,7 @@ package com.epmet.controller; +import com.epmet.commons.mybatis.entity.DataScope; +import com.epmet.commons.tools.annotation.RequirePermission; import com.epmet.commons.tools.utils.Result; import com.epmet.commons.tools.validator.ValidatorUtils; import com.epmet.dto.GovStaffRoleDTO; @@ -65,7 +67,7 @@ public class StaffRoleController { ValidatorUtils.validateEntity(staffRoleFormDTO, StaffRoleFormDTO.GetStaffsInRole.class); String roleKey = staffRoleFormDTO.getRoleKey(); String orgId = staffRoleFormDTO.getOrgId(); - List staffRoleDTOS = staffRoleService.listStaffsInRole(roleKey, orgId); + List staffRoleDTOS = staffRoleService.listStaffsInRole(roleKey, orgId , DataScope.getDefault()); return new Result>().ok(staffRoleDTOS); } 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..9c6af5321e 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 @@ -17,6 +17,7 @@ package com.epmet.service; +import com.epmet.commons.mybatis.entity.DataScope; import com.epmet.commons.mybatis.service.BaseService; import com.epmet.commons.tools.page.PageData; import com.epmet.dto.StaffRoleDTO; @@ -100,7 +101,7 @@ public interface StaffRoleService extends BaseService { * @param orgId * @return */ - List listStaffsInRole(String roleKey, String orgId); + List listStaffsInRole(String roleKey, String orgId, DataScope dataScope); /** * 清空工作人员权限 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..180521ebe3 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 @@ -19,6 +19,8 @@ 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.annotation.DataFilter; +import com.epmet.commons.mybatis.entity.DataScope; import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; import com.epmet.commons.tools.page.PageData; import com.epmet.commons.tools.utils.ConvertUtils; @@ -110,7 +112,7 @@ public class StaffRoleServiceImpl extends BaseServiceImpl listStaffsInRole(String roleKey, String orgId) { + public List listStaffsInRole(String roleKey, String orgId, DataScope dataScope) { return baseDao.listStaffIdsByRoleKeyAndOrgId(roleKey, orgId); } From 4cd81531f8a89ef2d9222f44cd74b77bd4bebe42 Mon Sep 17 00:00:00 2001 From: wxz Date: Sat, 25 Apr 2020 22:30:40 +0800 Subject: [PATCH 82/85] =?UTF-8?q?1.=E5=AE=8C=E6=88=90=E7=BB=84=E7=BB=87?= =?UTF-8?q?=E8=8C=83=E5=9B=B4sql=E8=BF=87=E6=BB=A4=EF=BC=8C=E6=9C=AC?= =?UTF-8?q?=E7=BD=91=E6=A0=BCsql=E8=BF=87=E6=BB=A4=EF=BC=8C=E6=88=91?= =?UTF-8?q?=E5=88=9B=E5=BB=BA=E7=9A=84sql=E8=BF=87=E6=BB=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mybatis/aspect/DataFilterAspect.java | 171 +++++++++++------- .../mybatis/dto/form/OperationScopeDTO.java | 5 + .../dto/form/StaffPermCacheResultDTO.java | 5 + .../mybatis/feign/GovAccessFeignClient.java | 2 +- .../GovAccessFeignClientFallback.java | 4 +- .../interceptor/DataFilterInterceptor.java | 22 ++- .../epmet/commons/tools/redis/RedisKeys.java | 10 + .../dto/result/RoleOpeScopeResultDTO.java | 28 +++ .../dto/result/StaffPermCacheResultDTO.java | 5 + .../epmet/controller/AccessController.java | 18 +- .../java/com/epmet/dao/OperationScopeDao.java | 6 +- .../com/epmet/redis/OperationScopeRedis.java | 47 ----- .../com/epmet/redis/RoleOpeScopeRedis.java | 43 +++++ .../com/epmet/redis/RoleOperationRedis.java | 47 ----- .../java/com/epmet/redis/RoleScopeRedis.java | 47 ----- .../java/com/epmet/service/AccessService.java | 3 +- .../epmet/service/impl/AccessServiceImpl.java | 24 ++- .../impl/OperationScopeServiceImpl.java | 3 - .../impl/RoleOperationServiceImpl.java | 4 - .../service/impl/RoleScopeServiceImpl.java | 4 - .../db.migration/epmet_gov_access.sql | 1 + .../resources/mapper/OperationScopeDao.xml | 10 +- .../com/epmet/feign/GovAccessFeignClient.java | 2 +- 23 files changed, 256 insertions(+), 255 deletions(-) create mode 100644 epmet-module/gov-access/gov-access-client/src/main/java/com/epmet/dto/result/RoleOpeScopeResultDTO.java delete mode 100644 epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/redis/OperationScopeRedis.java create mode 100644 epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/redis/RoleOpeScopeRedis.java delete mode 100644 epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/redis/RoleOperationRedis.java delete mode 100644 epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/redis/RoleScopeRedis.java diff --git a/epmet-commons/epmet-commons-mybatis/src/main/java/com/epmet/commons/mybatis/aspect/DataFilterAspect.java b/epmet-commons/epmet-commons-mybatis/src/main/java/com/epmet/commons/mybatis/aspect/DataFilterAspect.java index b9431a6c48..13910a6f3a 100644 --- a/epmet-commons/epmet-commons-mybatis/src/main/java/com/epmet/commons/mybatis/aspect/DataFilterAspect.java +++ b/epmet-commons/epmet-commons-mybatis/src/main/java/com/epmet/commons/mybatis/aspect/DataFilterAspect.java @@ -8,8 +8,10 @@ package com.epmet.commons.mybatis.aspect; +import com.epmet.commons.mybatis.annotation.DataFilter; import com.epmet.commons.mybatis.constant.OpeScopeConstant; import com.epmet.commons.mybatis.dto.form.OperationScopeDTO; +import com.epmet.commons.mybatis.dto.form.OperationScopeFormDTO; import com.epmet.commons.mybatis.dto.form.StaffPermCacheResultDTO; import com.epmet.commons.mybatis.dto.form.StaffPermissionFormDTO; import com.epmet.commons.mybatis.entity.DataScope; @@ -23,6 +25,7 @@ import org.apache.commons.lang3.StringUtils; import org.aspectj.lang.JoinPoint; import org.aspectj.lang.annotation.Aspect; import org.aspectj.lang.annotation.Before; +import org.aspectj.lang.reflect.MethodSignature; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; @@ -53,15 +56,11 @@ public class DataFilterAspect { @Before("@annotation(com.epmet.commons.mybatis.annotation.DataFilter)") public void dataFilter(JoinPoint point) { - // 反射的方式 - //MethodSignature signature = (MethodSignature) point.getSignature(); - //Class[] parameterTypes = signature.getParameterTypes(); - //for (Class parameterType : parameterTypes) { - // if (parameterType == DataScope.class) { - // - // } - //} + // 通过反射,取到注解属性 + DataFilter dataFilterAnno = ((MethodSignature) point.getSignature()).getMethod().getAnnotation(DataFilter.class); + String tableAlias = dataFilterAnno.tableAlias(); + // 从ThreadLocal中取所需权限 String requirePermission = AccessOpeAspect.requirePermissionTl.get(); // 没有配置所需权限,不做操作,打印提示日志 if (StringUtils.isBlank(requirePermission)) { @@ -69,10 +68,14 @@ public class DataFilterAspect { return; } + String app = loginUserUtil.getLoginUserApp(); + String client = loginUserUtil.getLoginUserClient(); + String userId = loginUserUtil.getLoginUserId(); + StaffPermissionFormDTO staffPermissionFormDTO = new StaffPermissionFormDTO(); - staffPermissionFormDTO.setApp(loginUserUtil.getLoginUserApp()); - staffPermissionFormDTO.setClient(loginUserUtil.getLoginUserClient()); - staffPermissionFormDTO.setStaffId(loginUserUtil.getLoginUserId()); + staffPermissionFormDTO.setApp(app); + staffPermissionFormDTO.setClient(client); + staffPermissionFormDTO.setStaffId(userId); Result result = govAccessFeignClient.getStaffCurrPermissions(staffPermissionFormDTO); if (result.getCode() != 0) { @@ -91,10 +94,17 @@ public class DataFilterAspect { // 校验操作权限 validateOpePermission(permCacheResultDTO.getPermissions(), requirePermission); + // 生成过滤sql Object[] methodArgs = point.getArgs(); for (Object methodArg : methodArgs) { if (methodArg instanceof DataScope) { - ((DataScope) methodArg).setSqlFilter(getSqlFilterSegment(permCacheResultDTO.getRoleIdList(), requirePermission, permCacheResultDTO.getOrgIdPath())); + ((DataScope) methodArg).setSqlFilter(getSqlFilterSegment( + userId, + permCacheResultDTO.getRoleIdList(), + requirePermission, + permCacheResultDTO.getOrgIdPath(), + permCacheResultDTO.getGridId(), + tableAlias)); return; } } @@ -118,56 +128,111 @@ public class DataFilterAspect { * * @return */ - private String getSqlFilterSegment(Set roleIds, String reqiurePermission, String orgIdPath) { + private String getSqlFilterSegment(String userId,Set roleIds, String reqiurePermission, String orgIdPath, String gridId, String tableAlias) { // 根据角色列表查询操作范围列表 - // todo 暂停,先模拟数据 - //roleIds.forEach(roleId -> { - // OperationScopeFormDTO osformDto = new OperationScopeFormDTO(); - // osformDto.setRoleId(roleId); - // osformDto.setOperationKey(reqiurePermission); - // Result> result = govAccessFeignClient.getOperationScopesByRoleId(osformDto); - // List scopeDTOS = result.getData(); - //}); - Set scopeDTOS = genScopeDtos(); - - // 过滤有效范围 + Set scopeDTOS = new HashSet<>(); + roleIds.forEach(roleId -> { + OperationScopeFormDTO osformDto = new OperationScopeFormDTO(); + osformDto.setRoleId(roleId); + osformDto.setOperationKey(reqiurePermission); + Result> result = govAccessFeignClient.getOperationScopesByRoleId(osformDto); + if (result.success()) { + scopeDTOS.addAll(result.getData()); + } + }); + + // 过滤范围 HashSet scopes = filteScopes(scopeDTOS); + if (CollectionUtils.isEmpty(scopes)) { + // 没有范围限制 + return ""; + } + StringBuilder sb = new StringBuilder(); + + // 1.生成sql:组织范围过滤 + genOrgScopeSql(sb, orgIdPath, scopes, tableAlias); + + // 2.生成sql:我发起的 + genIStartedSql(sb, userId, tableAlias); + + // 3.生成sql:本网格的 + genInGrid(sb, gridId, tableAlias); + + //sb.append(")"); + System.out.println("生成的过滤sql:" + sb.toString()); + return sb.toString(); + } + + /** + * 网格sql + * @param sb + * @param gridId + * @param tableAlias + */ + private void genInGrid(StringBuilder sb, String gridId, String tableAlias) { + if (StringUtils.isBlank(tableAlias)) { + sb.append(" OR GRID_ID ='").append(gridId).append("'"); + } else { + sb.append(" OR ").append(tableAlias).append(".GRID_ID ='").append(gridId).append("'"); + } + } + + /** + * sql:我发起的 + * @param userId + */ + private void genIStartedSql(StringBuilder sb, String userId, String tableAlias) { + if (StringUtils.isBlank(tableAlias)) { + sb.append(" OR CREATED_BY ='").append(userId).append("'"); + } else { + sb.append(" OR ").append(tableAlias).append(".CREATED_BY ='").append(userId).append("'"); + } + } + /** + * 计算组织范围过滤sql,整体入口 + * @param sb + * @param orgIdPath + * @param scopes + */ + public void genOrgScopeSql(StringBuilder sb, String orgIdPath, HashSet scopes, String tableAlias) { // 取出父组织ID path 和当前组织ID String pOrgPath = orgIdPath.substring(0, orgIdPath.lastIndexOf(orgIdPathSpliter)); String currOrgPath = orgIdPath.substring(orgIdPath.lastIndexOf(orgIdPathSpliter) + 1); - - StringBuilder sb = new StringBuilder(" AND ("); - getOrgScopeSql(sb, scopes, currOrgPath, pOrgPath); + genOrgScopeSql(sb, scopes, currOrgPath, pOrgPath, tableAlias); sb.replace(sb.lastIndexOf("OR"), sb.lastIndexOf("OR") + 3, ""); - sb.append(") "); - // 拼接sql语句 - sb.replace(141,142,""); - // TODO - return ""; } /** - * 计算范围过滤sql + * 计算组织范围过滤sql * @param scopes * @param currOrg * @param pOrgPath * @return */ - private void getOrgScopeSql(StringBuilder sb,HashSet scopes, String currOrg, String pOrgPath) { + private void genOrgScopeSql(StringBuilder sb,HashSet scopes, String currOrg, String pOrgPath, String tableAlias) { for (String scope : scopes) { switch (scope) { case OpeScopeConstant.ORG_CURR: - getAgencyCurrScopedSql(sb, currOrg); - sb.append(" OR "); + if (StringUtils.isBlank(tableAlias)) { + sb.append(" ORG_ID = '").append(currOrg).append("' OR "); + } else { + sb.append(" ").append(tableAlias).append(".ORG_ID = '").append(currOrg).append("' OR "); + } break; case OpeScopeConstant.ORG_CURR_AND_SUB: - getAgencyCurrAndSubScopedSql(sb, pOrgPath); - sb.append(" OR "); + if (StringUtils.isBlank(tableAlias)) { + sb.append(" ORG_ID_PATH like '").append(pOrgPath).append("%' ").append(" OR "); + } else { + sb.append(" ").append(tableAlias).append(".ORG_ID_PATH like '").append(pOrgPath).append("%' ").append(" OR "); + } break; case OpeScopeConstant.ORG_CURR_SUB: - getAgencyCurrSubScopedSql(sb, pOrgPath, currOrg); - sb.append(" OR "); + if (StringUtils.isBlank(tableAlias)) { + sb.append(" ORG_ID_PATH like '").append(pOrgPath).append(orgIdPathSpliter).append(currOrg).append("%' ").append(" OR "); + } else { + sb.append(" ").append(tableAlias).append(".ORG_ID_PATH like '").append(pOrgPath).append(orgIdPathSpliter).append(currOrg).append("%' ").append(" OR "); + } break; case OpeScopeConstant.ORG_EQUAL: // todo 同级 @@ -185,32 +250,6 @@ public class DataFilterAspect { } } - /** - * 本身 - * @param sb - * @param orgId - */ - public void getAgencyCurrScopedSql(StringBuilder sb,String orgId) { - sb.append(" ORG_ID = ").append(orgId); - } - - /** - * 本身及子级 - * @param sb - * @param pOrgIdPath - */ - public void getAgencyCurrAndSubScopedSql(StringBuilder sb,String pOrgIdPath) { - sb.append(" ORG_ID_PATH like '").append(pOrgIdPath).append("%'"); - } - - /** - * 子级组织(不含本身) - * @param sb - */ - public void getAgencyCurrSubScopedSql(StringBuilder sb,String pOrgIdPath, String currOrgIdPath) { - sb.append("ORG_ID_PATH like '").append(pOrgIdPath).append(orgIdPathSpliter).append(currOrgIdPath).append("%'"); - } - /** * 过滤有效范围 * diff --git a/epmet-commons/epmet-commons-mybatis/src/main/java/com/epmet/commons/mybatis/dto/form/OperationScopeDTO.java b/epmet-commons/epmet-commons-mybatis/src/main/java/com/epmet/commons/mybatis/dto/form/OperationScopeDTO.java index 494cff66b9..3e65b753d7 100644 --- a/epmet-commons/epmet-commons-mybatis/src/main/java/com/epmet/commons/mybatis/dto/form/OperationScopeDTO.java +++ b/epmet-commons/epmet-commons-mybatis/src/main/java/com/epmet/commons/mybatis/dto/form/OperationScopeDTO.java @@ -39,6 +39,11 @@ public class OperationScopeDTO implements Serializable { */ private String id; + /** + * 角色id + */ + private String roleId; + /** * 范围key */ diff --git a/epmet-commons/epmet-commons-mybatis/src/main/java/com/epmet/commons/mybatis/dto/form/StaffPermCacheResultDTO.java b/epmet-commons/epmet-commons-mybatis/src/main/java/com/epmet/commons/mybatis/dto/form/StaffPermCacheResultDTO.java index 6f37ef7033..7775756b38 100644 --- a/epmet-commons/epmet-commons-mybatis/src/main/java/com/epmet/commons/mybatis/dto/form/StaffPermCacheResultDTO.java +++ b/epmet-commons/epmet-commons-mybatis/src/main/java/com/epmet/commons/mybatis/dto/form/StaffPermCacheResultDTO.java @@ -22,4 +22,9 @@ public class StaffPermCacheResultDTO { */ private String orgIdPath; + /** + * 网格ID + */ + private String gridId; + } diff --git a/epmet-commons/epmet-commons-mybatis/src/main/java/com/epmet/commons/mybatis/feign/GovAccessFeignClient.java b/epmet-commons/epmet-commons-mybatis/src/main/java/com/epmet/commons/mybatis/feign/GovAccessFeignClient.java index 4d04adc835..50b20890e7 100644 --- a/epmet-commons/epmet-commons-mybatis/src/main/java/com/epmet/commons/mybatis/feign/GovAccessFeignClient.java +++ b/epmet-commons/epmet-commons-mybatis/src/main/java/com/epmet/commons/mybatis/feign/GovAccessFeignClient.java @@ -34,6 +34,6 @@ public interface GovAccessFeignClient { * @return */ @PostMapping("/gov/access/access/operationscopes") - Result> getOperationScopesByRoleId(OperationScopeFormDTO operationScopeFormDTO); + Result> getOperationScopesByRoleId(OperationScopeFormDTO operationScopeFormDTO); } diff --git a/epmet-commons/epmet-commons-mybatis/src/main/java/com/epmet/commons/mybatis/feign/fallback/GovAccessFeignClientFallback.java b/epmet-commons/epmet-commons-mybatis/src/main/java/com/epmet/commons/mybatis/feign/fallback/GovAccessFeignClientFallback.java index 2f5b9287a1..6dfa1b89cc 100644 --- a/epmet-commons/epmet-commons-mybatis/src/main/java/com/epmet/commons/mybatis/feign/fallback/GovAccessFeignClientFallback.java +++ b/epmet-commons/epmet-commons-mybatis/src/main/java/com/epmet/commons/mybatis/feign/fallback/GovAccessFeignClientFallback.java @@ -10,7 +10,7 @@ import com.epmet.commons.tools.utils.ModuleUtils; import com.epmet.commons.tools.utils.Result; import org.springframework.stereotype.Component; -import java.util.List; +import java.util.Set; /** * 调用政府端权限 @@ -27,7 +27,7 @@ public class GovAccessFeignClientFallback implements GovAccessFeignClient { } @Override - public Result> getOperationScopesByRoleId(OperationScopeFormDTO operationScopeFormDTO) { + public Result> getOperationScopesByRoleId(OperationScopeFormDTO operationScopeFormDTO) { return ModuleUtils.feignConError(ServiceConstant.GOV_ACCESS_SERVER, "getOperationScopesByRoleId", operationScopeFormDTO); } } diff --git a/epmet-commons/epmet-commons-mybatis/src/main/java/com/epmet/commons/mybatis/interceptor/DataFilterInterceptor.java b/epmet-commons/epmet-commons-mybatis/src/main/java/com/epmet/commons/mybatis/interceptor/DataFilterInterceptor.java index 046c012da4..d26f7525a1 100644 --- a/epmet-commons/epmet-commons-mybatis/src/main/java/com/epmet/commons/mybatis/interceptor/DataFilterInterceptor.java +++ b/epmet-commons/epmet-commons-mybatis/src/main/java/com/epmet/commons/mybatis/interceptor/DataFilterInterceptor.java @@ -10,9 +10,9 @@ package com.epmet.commons.mybatis.interceptor; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.toolkit.PluginUtils; -import com.baomidou.mybatisplus.core.toolkit.StringUtils; import com.baomidou.mybatisplus.extension.handlers.AbstractSqlParserHandler; import com.epmet.commons.mybatis.entity.DataScope; +import org.apache.commons.lang3.StringUtils; import org.apache.ibatis.executor.statement.StatementHandler; import org.apache.ibatis.mapping.BoundSql; import org.apache.ibatis.mapping.MappedStatement; @@ -43,10 +43,10 @@ public class DataFilterInterceptor extends AbstractSqlParserHandler implements I this.sqlParser(metaObject); // 先判断是不是SELECT操作 - MappedStatement mappedStatement = (MappedStatement) metaObject.getValue("delegate.mappedStatement"); - if (!SqlCommandType.SELECT.equals(mappedStatement.getSqlCommandType())) { - return invocation.proceed(); - } + //MappedStatement mappedStatement = (MappedStatement) metaObject.getValue("delegate.mappedStatement"); + //if (!SqlCommandType.SELECT.equals(mappedStatement.getSqlCommandType())) { + // return invocation.proceed(); + //} // 针对定义了rowBounds,做为mapper接口方法的参数 BoundSql boundSql = (BoundSql) metaObject.getValue("delegate.boundSql"); @@ -79,12 +79,18 @@ public class DataFilterInterceptor extends AbstractSqlParserHandler implements I // 拼接新SQL String orderBy = "ORDER BY"; String groupBy = "GROUP BY"; + String sqlFilter = scope.getSqlFilter(); + if (originalSql.indexOf("WHERE") == 0) { + // 不包含where,需要手动拼接上 + sqlFilter = " WHERE ".concat(sqlFilter); + } + if (originalSql.indexOf(groupBy) > -1) { - originalSql = originalSql.replace(groupBy, scope.getSqlFilter() + groupBy); + originalSql = originalSql.replace(groupBy, sqlFilter + groupBy); } else if (originalSql.indexOf(orderBy) > -1) { - originalSql = originalSql.replace(orderBy, scope.getSqlFilter() + orderBy); + originalSql = originalSql.replace(orderBy, sqlFilter + orderBy); } else { - originalSql = originalSql + scope.getSqlFilter(); + originalSql = originalSql.concat(" AND (").concat(scope.getSqlFilter()).concat(")"); } // 重写SQL diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/RedisKeys.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/RedisKeys.java index 199e38e235..6598010561 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/RedisKeys.java +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/RedisKeys.java @@ -207,4 +207,14 @@ public class RedisKeys { public static String getLoginSmsCodeKey(String app, String client, String phone) { return String.format(rootPrefix+"smsCode:login:%s:%s:%s",app,client,phone); } + + /** + * 角色的操作权限对应的可操作范围 + * @param roleId 角色ID + * @param opeKey 操作Key + * @return + */ + public static String getRoleOpeScopesKey(String roleId, String opeKey) { + return rootPrefix.concat("gov:access:role:opescopes:").concat(roleId).concat(opeKey); + } } diff --git a/epmet-module/gov-access/gov-access-client/src/main/java/com/epmet/dto/result/RoleOpeScopeResultDTO.java b/epmet-module/gov-access/gov-access-client/src/main/java/com/epmet/dto/result/RoleOpeScopeResultDTO.java new file mode 100644 index 0000000000..fbafb374e7 --- /dev/null +++ b/epmet-module/gov-access/gov-access-client/src/main/java/com/epmet/dto/result/RoleOpeScopeResultDTO.java @@ -0,0 +1,28 @@ +package com.epmet.dto.result; + +import lombok.Data; + +@Data +public class RoleOpeScopeResultDTO { + + /** + * 角色ID + */ + private String roleId; + + /** + * 范围key + */ + private String scopeKey; + + /** + * 范围名称 + */ + private String scopeName; + + /** + * 范围序号 + */ + private String scopeIndex; + +} diff --git a/epmet-module/gov-access/gov-access-client/src/main/java/com/epmet/dto/result/StaffPermCacheResultDTO.java b/epmet-module/gov-access/gov-access-client/src/main/java/com/epmet/dto/result/StaffPermCacheResultDTO.java index 0f6be83e72..ce24cf9501 100644 --- a/epmet-module/gov-access/gov-access-client/src/main/java/com/epmet/dto/result/StaffPermCacheResultDTO.java +++ b/epmet-module/gov-access/gov-access-client/src/main/java/com/epmet/dto/result/StaffPermCacheResultDTO.java @@ -23,4 +23,9 @@ public class StaffPermCacheResultDTO { */ private String orgIdPath; + /** + * 网格ID + */ + private String gridId; + } diff --git a/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/controller/AccessController.java b/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/controller/AccessController.java index d60f7cb528..e34df14a06 100644 --- a/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/controller/AccessController.java +++ b/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/controller/AccessController.java @@ -6,6 +6,7 @@ import com.epmet.commons.tools.validator.ValidatorUtils; import com.epmet.dto.OperationScopeDTO; import com.epmet.dto.form.OperationScopeFormDTO; import com.epmet.dto.form.StaffPermCacheFormDTO; +import com.epmet.dto.result.RoleOpeScopeResultDTO; import com.epmet.dto.result.StaffPermCacheResultDTO; import com.epmet.entity.OperationScopeEntity; import com.epmet.service.AccessService; @@ -62,26 +63,19 @@ public class AccessController { resultDTO.setPermissions(govTokenDto.getPermissions()); resultDTO.setRoleIdList(govTokenDto.getRoleIdList()); resultDTO.setOrgIdPath(govTokenDto.getOrgIdPath()); + resultDTO.setGridId(govTokenDto.getGridId()); } return new Result().ok(resultDTO); } /** - * 查询角色的操作key对应操作范围列表(需要入缓存) + * 查询角色的操作key对应操作范围列表(缓存) * @return */ - // todo 需要加缓存 @PostMapping("operationscopes") - public Result> getOperationScopesByRoleId(@RequestBody OperationScopeFormDTO operationScopeFormDTO) { + public Result> getOperationScopesByRoleId(@RequestBody OperationScopeFormDTO operationScopeFormDTO) { ValidatorUtils.validateEntity(operationScopeFormDTO, OperationScopeFormDTO.ListOperationScopeGroup.class); - List scopes = accessService.listOperationScopesByRoleId(operationScopeFormDTO.getRoleId(), operationScopeFormDTO.getOperationKey()); - ArrayList scopeDtos = new ArrayList<>(); - scopes.forEach(scope -> { - OperationScopeDTO scopeDTO = new OperationScopeDTO(); - BeanUtils.copyProperties(scope, scopeDTO); - scopeDtos.add(scopeDTO); - }); - - return new Result>().ok(scopeDtos); + Set scopes = accessService.listOperationScopesByRoleId(operationScopeFormDTO.getRoleId(), operationScopeFormDTO.getOperationKey()); + return new Result>().ok(scopes); } } diff --git a/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/dao/OperationScopeDao.java b/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/dao/OperationScopeDao.java index a944cdd628..4ac02b7f91 100644 --- a/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/dao/OperationScopeDao.java +++ b/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/dao/OperationScopeDao.java @@ -18,12 +18,14 @@ package com.epmet.dao; import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.dto.result.RoleOpeScopeResultDTO; import com.epmet.entity.OperationScopeEntity; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; import org.springframework.context.annotation.Scope; import java.util.List; +import java.util.Set; /** * 权限范围表 @@ -40,6 +42,6 @@ public interface OperationScopeDao extends BaseDao { * @param operationKey 操作key * @return */ - List listOperationScopesByRoleId(@Param("roleId") String roleId, - @Param("operationKey") String operationKey); + Set listOperationScopesByRoleId(@Param("roleId") String roleId, + @Param("operationKey") String operationKey); } \ No newline at end of file diff --git a/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/redis/OperationScopeRedis.java b/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/redis/OperationScopeRedis.java deleted file mode 100644 index 3f5a7c6562..0000000000 --- a/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/redis/OperationScopeRedis.java +++ /dev/null @@ -1,47 +0,0 @@ -/** - * Copyright 2018 人人开源 https://www.renren.io - *

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

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

- * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -package com.epmet.redis; - -import com.epmet.commons.tools.redis.RedisUtils; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Component; - -/** - * 权限范围表 - * - * @author generator generator@elink-cn.com - * @since v1.0.0 2020-04-24 - */ -@Component -public class OperationScopeRedis { - @Autowired - private RedisUtils redisUtils; - - public void delete(Object[] ids) { - - } - - public void set(){ - - } - - public String get(String id){ - return null; - } - -} \ No newline at end of file diff --git a/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/redis/RoleOpeScopeRedis.java b/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/redis/RoleOpeScopeRedis.java new file mode 100644 index 0000000000..cd929c692d --- /dev/null +++ b/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/redis/RoleOpeScopeRedis.java @@ -0,0 +1,43 @@ +package com.epmet.redis; + +import cn.hutool.core.bean.BeanUtil; +import com.epmet.commons.tools.redis.RedisKeys; +import com.epmet.commons.tools.redis.RedisUtils; +import com.epmet.dto.result.RoleOpeScopeResultDTO; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +import java.util.Set; + +/** + * 角色的操作权限对应的操作范围Redis + */ +@Component +public class RoleOpeScopeRedis { + + @Autowired + private RedisUtils redisUtils; + + /** + * 缓存角色操作范围 + * @param roleId + * @param opeKey + * @param scopes + */ + public void setRoleOpeScopes(String roleId, String opeKey, Set scopes) { + String roleOpeScopesKey = RedisKeys.getRoleOpeScopesKey(roleId, opeKey); + redisUtils.set(roleOpeScopesKey, scopes); + } + + /** + * 查询角色操作范围 + * @param roleId + * @param opeKey + * @return + */ + public Set getRoleOpeScopes(String roleId, String opeKey) { + String roleOpeScopesKey = RedisKeys.getRoleOpeScopesKey(roleId, opeKey); + return (Set)redisUtils.get(roleOpeScopesKey); + } + +} diff --git a/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/redis/RoleOperationRedis.java b/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/redis/RoleOperationRedis.java deleted file mode 100644 index d57c02ebde..0000000000 --- a/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/redis/RoleOperationRedis.java +++ /dev/null @@ -1,47 +0,0 @@ -/** - * Copyright 2018 人人开源 https://www.renren.io - *

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

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

- * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -package com.epmet.redis; - -import com.epmet.commons.tools.redis.RedisUtils; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Component; - -/** - * 角色能进行那些操作 - * - * @author generator generator@elink-cn.com - * @since v1.0.0 2020-04-22 - */ -@Component -public class RoleOperationRedis { - @Autowired - private RedisUtils redisUtils; - - public void delete(Object[] ids) { - - } - - public void set(){ - - } - - public String get(String id){ - return null; - } - -} \ No newline at end of file diff --git a/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/redis/RoleScopeRedis.java b/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/redis/RoleScopeRedis.java deleted file mode 100644 index 1198f8651a..0000000000 --- a/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/redis/RoleScopeRedis.java +++ /dev/null @@ -1,47 +0,0 @@ -/** - * Copyright 2018 人人开源 https://www.renren.io - *

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

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

- * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -package com.epmet.redis; - -import com.epmet.commons.tools.redis.RedisUtils; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Component; - -/** - * 角色能操作哪些范围 - * - * @author generator generator@elink-cn.com - * @since v1.0.0 2020-04-24 - */ -@Component -public class RoleScopeRedis { - @Autowired - private RedisUtils redisUtils; - - public void delete(Object[] ids) { - - } - - public void set(){ - - } - - public String get(String id){ - return null; - } - -} \ No newline at end of file diff --git a/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/service/AccessService.java b/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/service/AccessService.java index 4355b2714b..df16e1e9df 100644 --- a/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/service/AccessService.java +++ b/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/service/AccessService.java @@ -1,6 +1,7 @@ package com.epmet.service; import com.epmet.commons.tools.security.dto.GovTokenDto; +import com.epmet.dto.result.RoleOpeScopeResultDTO; import com.epmet.entity.OperationScopeEntity; import java.util.List; @@ -26,5 +27,5 @@ public interface AccessService { * @param operationKey * @return */ - List listOperationScopesByRoleId(String roleId, String operationKey); + Set listOperationScopesByRoleId(String roleId, String operationKey); } diff --git a/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/service/impl/AccessServiceImpl.java b/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/service/impl/AccessServiceImpl.java index 95b01a1f0c..34e458ec6a 100644 --- a/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/service/impl/AccessServiceImpl.java +++ b/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/service/impl/AccessServiceImpl.java @@ -1,9 +1,11 @@ package com.epmet.service.impl; +import com.epmet.commons.tools.exception.ExceptionUtils; import com.epmet.commons.tools.security.dto.GovTokenDto; import com.epmet.commons.tools.utils.CpUserDetailRedis; import com.epmet.dao.OperationScopeDao; -import com.epmet.entity.OperationScopeEntity; +import com.epmet.dto.result.RoleOpeScopeResultDTO; +import com.epmet.redis.RoleOpeScopeRedis; import com.epmet.service.AccessService; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -11,8 +13,6 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.util.CollectionUtils; -import java.util.HashSet; -import java.util.List; import java.util.Set; @Service @@ -26,6 +26,9 @@ public class AccessServiceImpl implements AccessService { @Autowired private OperationScopeDao operationScopeDao; + @Autowired + private RoleOpeScopeRedis roleOpeScopeRedis; + /** * 更新权限缓存 * @param staffId @@ -60,7 +63,18 @@ public class AccessServiceImpl implements AccessService { * @param operationKey * @return */ - public List listOperationScopesByRoleId(String roleId, String operationKey) { - return operationScopeDao.listOperationScopesByRoleId(roleId, operationKey); + public Set listOperationScopesByRoleId(String roleId, String operationKey) { + Set roleOpeScopes = roleOpeScopeRedis.getRoleOpeScopes(roleId, operationKey); + if (roleOpeScopes != null) { + return roleOpeScopes; + } + Set scopes = operationScopeDao.listOperationScopesByRoleId(roleId, operationKey); + try { + roleOpeScopeRedis.setRoleOpeScopes(roleId, operationKey, scopes); + } catch (Exception e) { + String errorStackTrace = ExceptionUtils.getErrorStackTrace(e); + logger.error("GovAccess:查询角色的操作范围:缓存范围出错:{}", errorStackTrace); + } + return scopes; } } diff --git a/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/service/impl/OperationScopeServiceImpl.java b/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/service/impl/OperationScopeServiceImpl.java index fe8f8b4079..e582395fe2 100644 --- a/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/service/impl/OperationScopeServiceImpl.java +++ b/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/service/impl/OperationScopeServiceImpl.java @@ -26,7 +26,6 @@ import com.epmet.commons.tools.constant.FieldConstant; import com.epmet.dao.OperationScopeDao; import com.epmet.dto.OperationScopeDTO; import com.epmet.entity.OperationScopeEntity; -import com.epmet.redis.OperationScopeRedis; import com.epmet.service.OperationScopeService; import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; @@ -46,8 +45,6 @@ import java.util.Map; @Service public class OperationScopeServiceImpl extends BaseServiceImpl implements OperationScopeService { - @Autowired - private OperationScopeRedis operationScopeRedis; @Override public PageData page(Map params) { diff --git a/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/service/impl/RoleOperationServiceImpl.java b/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/service/impl/RoleOperationServiceImpl.java index bb6d914d2e..a690363b33 100644 --- a/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/service/impl/RoleOperationServiceImpl.java +++ b/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/service/impl/RoleOperationServiceImpl.java @@ -27,7 +27,6 @@ import com.epmet.dao.RoleOperationDao; import com.epmet.dto.RoleOperationDTO; import com.epmet.dto.result.RoleOperationResultDTO; import com.epmet.entity.RoleOperationEntity; -import com.epmet.redis.RoleOperationRedis; import com.epmet.service.RoleOperationService; import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; @@ -47,9 +46,6 @@ import java.util.Map; @Service public class RoleOperationServiceImpl extends BaseServiceImpl implements RoleOperationService { - @Autowired - private RoleOperationRedis roleOperationRedis; - @Override public PageData page(Map params) { IPage page = baseDao.selectPage( diff --git a/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/service/impl/RoleScopeServiceImpl.java b/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/service/impl/RoleScopeServiceImpl.java index 4417549965..bff52f8d64 100644 --- a/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/service/impl/RoleScopeServiceImpl.java +++ b/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/service/impl/RoleScopeServiceImpl.java @@ -26,7 +26,6 @@ import com.epmet.commons.tools.constant.FieldConstant; import com.epmet.dao.RoleScopeDao; import com.epmet.dto.RoleScopeDTO; import com.epmet.entity.RoleScopeEntity; -import com.epmet.redis.RoleScopeRedis; import com.epmet.service.RoleScopeService; import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; @@ -46,9 +45,6 @@ import java.util.Map; @Service public class RoleScopeServiceImpl extends BaseServiceImpl implements RoleScopeService { - @Autowired - private RoleScopeRedis roleScopeRedis; - @Override public PageData page(Map params) { IPage page = baseDao.selectPage( diff --git a/epmet-module/gov-access/gov-access-server/src/main/resources/db.migration/epmet_gov_access.sql b/epmet-module/gov-access/gov-access-server/src/main/resources/db.migration/epmet_gov_access.sql index 6bcbc33e76..93d8c2a148 100644 --- a/epmet-module/gov-access/gov-access-server/src/main/resources/db.migration/epmet_gov_access.sql +++ b/epmet-module/gov-access/gov-access-server/src/main/resources/db.migration/epmet_gov_access.sql @@ -10,6 +10,7 @@ CREATE TABLE `operation_scope` ( `ID` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT 'id', `SCOPE_KEY` varchar(30) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '范围key', `SCOPE_NAME` varchar(30) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '范围名称', + `SCOPE_INDEX` varchar(30) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '范围序号', `DEL_FLAG` tinyint(1) NULL DEFAULT NULL COMMENT '是否删除,0:未删除,1:已删除', `REVISION` int(10) NULL DEFAULT NULL COMMENT '乐观锁', `CREATED_BY` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '创建者id', diff --git a/epmet-module/gov-access/gov-access-server/src/main/resources/mapper/OperationScopeDao.xml b/epmet-module/gov-access/gov-access-server/src/main/resources/mapper/OperationScopeDao.xml index dd4554f5d8..ab6839e941 100644 --- a/epmet-module/gov-access/gov-access-server/src/main/resources/mapper/OperationScopeDao.xml +++ b/epmet-module/gov-access/gov-access-server/src/main/resources/mapper/OperationScopeDao.xml @@ -16,13 +16,13 @@ - + select os.SCOPE_KEY, os.SCOPE_NAME, rs.ROLE_ID, os.SCOPE_INDEX from role_scope rs - inner join operation_scope os - on (rs.SCOPE_KEY = os.SCOPE_KEY) + inner join operation_scope os + on (rs.SCOPE_KEY = os.SCOPE_KEY) where rs.ROLE_ID = #{roleId} - and rs.OPERATION_KEY = #{operationKey} + and rs.OPERATION_KEY = #{operationKey} diff --git a/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/feign/GovAccessFeignClient.java b/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/feign/GovAccessFeignClient.java index 8cb514ad3f..b41a5e59ca 100644 --- a/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/feign/GovAccessFeignClient.java +++ b/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/feign/GovAccessFeignClient.java @@ -16,7 +16,7 @@ import java.util.List; * @Description * @Author sun */ -@FeignClient(name = ServiceConstant.GOV_ACCESS_SERVER, fallback = GovAccessFeignClientFallback.class) +@FeignClient(name = ServiceConstant.GOV_ACCESS_SERVER, fallback = GovAccessFeignClientFallback.class, url = "localhost:8099") public interface GovAccessFeignClient { /** From 54294a9ed1fb421a45cd21a976914c61992f74f9 Mon Sep 17 00:00:00 2001 From: sunyuchao Date: Sun, 26 Apr 2020 09:00:30 +0800 Subject: [PATCH 83/85] =?UTF-8?q?=E6=94=BF=E5=BA=9C=E7=AB=AF-=E9=83=A8?= =?UTF-8?q?=E9=97=A8=E6=A8=A1=E5=9D=97=E4=BB=A3=E7=A0=81=E8=A1=A5=E6=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/epmet/dao/CustomerStaffDepartmentDao.java | 7 +++++++ .../mapper/CustomerStaffDepartmentDao.xml | 14 +------------- 2 files changed, 8 insertions(+), 13 deletions(-) diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerStaffDepartmentDao.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerStaffDepartmentDao.java index dfdba500d7..22ab90c4ba 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerStaffDepartmentDao.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerStaffDepartmentDao.java @@ -33,5 +33,12 @@ import java.util.List; @Mapper public interface CustomerStaffDepartmentDao extends BaseDao { + /** + * + * @param departmentId + * @return + * * @Author sun + * @Description 查询部门下工作人员的用户Id集合 + */ List selectUserIdByDepartmentId(@Param("departmentId") String departmentId); } \ No newline at end of file diff --git a/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerStaffDepartmentDao.xml b/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerStaffDepartmentDao.xml index 86c597d402..8df91287f1 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerStaffDepartmentDao.xml +++ b/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerStaffDepartmentDao.xml @@ -3,18 +3,6 @@ - - - - - - - - - - - - From c3ced082931fd17ba98cfad0d1ab425310acf295 Mon Sep 17 00:00:00 2001 From: sunyuchao Date: Sun, 26 Apr 2020 09:14:47 +0800 Subject: [PATCH 84/85] =?UTF-8?q?=E6=94=BF=E5=BA=9C=E7=AB=AF-=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3=E6=B7=BB=E5=8A=A0token=E5=8F=82=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/epmet/controller/AgencyController.java | 14 ++++++++------ .../com/epmet/controller/DepartmentController.java | 12 ++++++------ 2 files changed, 14 insertions(+), 12 deletions(-) diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/AgencyController.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/AgencyController.java index 728e6e03a8..2ddc8f3c98 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/AgencyController.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/AgencyController.java @@ -17,6 +17,8 @@ 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.CustomerAgencyDTO; import com.epmet.dto.form.*; @@ -52,7 +54,7 @@ public class AgencyController { * @Description 添加组织 */ @PostMapping("addagency") - public Result addAgency(@RequestBody AddAgencyFormDTO formDTO) { + public Result addAgency(@LoginUser TokenDto tokenDTO, @RequestBody AddAgencyFormDTO formDTO) { return agencyService.addAgency(formDTO); } @@ -63,7 +65,7 @@ public class AgencyController { * @Description 组织名称编辑 */ @PostMapping("editagency") - public Result editAgency(@RequestBody EditAgencyFormDTO formDTO) { + public Result editAgency(@LoginUser TokenDto tokenDTO, @RequestBody EditAgencyFormDTO formDTO) { return agencyService.editAgency(formDTO); } @@ -74,7 +76,7 @@ public class AgencyController { * @Description 删除组织机关 */ @PostMapping("removeagency") - public Result removeAgency(@RequestBody RemoveAgencyFormDTO formDTO) { + public Result removeAgency(@LoginUser TokenDto tokenDTO, @RequestBody RemoveAgencyFormDTO formDTO) { return agencyService.removeAgency(formDTO); } @@ -85,7 +87,7 @@ public class AgencyController { * @Description 组织首页-获取组织机构信息 */ @PostMapping("agencydetail") - public Result agencyDetail(@RequestBody AgencydetailFormDTO formDTO) { + public Result agencyDetail(@LoginUser TokenDto tokenDTO, @RequestBody AgencydetailFormDTO formDTO) { return agencyService.agencyDetail(formDTO); } @@ -96,7 +98,7 @@ public class AgencyController { * @Description 组织首页-下级机关列表 */ @PostMapping("subagencylist") - public Result subAgencyList(@RequestBody SubAgencyFormDTO formDTO) { + public Result subAgencyList(@LoginUser TokenDto tokenDTO, @RequestBody SubAgencyFormDTO formDTO) { return agencyService.subAgencyList(formDTO); } @@ -107,7 +109,7 @@ public class AgencyController { * @Description 获取组织列表 */ @PostMapping("agencylist") - public Result> agencyList(@RequestBody AgencyListFormDTO formDTO) { + public Result> agencyList(@LoginUser TokenDto tokenDTO, @RequestBody AgencyListFormDTO formDTO) { return agencyService.agencyList(formDTO); } 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 eba65e1372..4d627ebaac 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 @@ -47,7 +47,7 @@ public class DepartmentController { * @Description 添加部门 */ @PostMapping("adddepartment") - public Result addDepartment(@RequestBody AddDepartmentFormDTO formDTO) { + public Result addDepartment(@LoginUser TokenDto tokenDTO, @RequestBody AddDepartmentFormDTO formDTO) { return departmentService.addDepartment(formDTO); } @@ -58,7 +58,7 @@ public class DepartmentController { * @Description 部门信息修改 */ @PostMapping("editdepartment") - public Result editDepartment(@RequestBody EditDepartmentFormDTO formDTO) { + public Result editDepartment(@LoginUser TokenDto tokenDTO, @RequestBody EditDepartmentFormDTO formDTO) { return departmentService.editDepartment(formDTO); } @@ -69,7 +69,7 @@ public class DepartmentController { * @Description 删除部门 */ @PostMapping("removedepartment") - public Result removeDepartment(@RequestBody RemoveDepartmentFormDTO formDTO) { + public Result removeDepartment(@LoginUser TokenDto tokenDTO, @RequestBody RemoveDepartmentFormDTO formDTO) { return departmentService.removeDepartment(formDTO); } @@ -80,7 +80,7 @@ public class DepartmentController { * @Description 获取部门详情 */ @PostMapping("departmentdetail") - public Result departmentDetail(@RequestBody DepartmentdetailFormDTO formDTO) { + public Result departmentDetail(@LoginUser TokenDto tokenDTO, @RequestBody DepartmentdetailFormDTO formDTO) { return departmentService.departmentDetail(formDTO); } @@ -91,7 +91,7 @@ public class DepartmentController { * @Description 组织首页-获取机关下部门列表 */ @PostMapping("departmentinagencylist") - public Result departmentInAgencyList(@RequestBody DepartmentInAgencyFormDTO formDTO) { + public Result departmentInAgencyList(@LoginUser TokenDto tokenDTO, @RequestBody DepartmentInAgencyFormDTO formDTO) { return departmentService.departmentInAgencyList(formDTO); } @@ -102,7 +102,7 @@ public class DepartmentController { * @Description 获取机构下部门列表 */ @PostMapping("departmentlist") - public Result> departmentList(@RequestBody DepartmentListFormDTO formDTO) { + public Result> departmentList(@LoginUser TokenDto tokenDTO, @RequestBody DepartmentListFormDTO formDTO) { return departmentService.departmentList(formDTO); } } \ No newline at end of file From 4582b9f3647dc60220422b28c449a320e6aaae4f Mon Sep 17 00:00:00 2001 From: sunyuchao Date: Sun, 26 Apr 2020 09:26:29 +0800 Subject: [PATCH 85/85] =?UTF-8?q?=E8=B0=83=E7=94=A8=E6=9F=A5=E8=AF=A2?= =?UTF-8?q?=E8=A7=92=E8=89=B2=E6=96=B9=E6=B3=95=E6=B7=BB=E5=8A=A0=E5=8F=82?= =?UTF-8?q?=E6=95=B0=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/epmet/service/impl/CustomerStaffServiceImpl.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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 d3a98772bd..f5a2d154b1 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 @@ -19,6 +19,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.entity.DataScope; import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; import com.epmet.commons.tools.constant.FieldConstant; import com.epmet.commons.tools.exception.EpmetErrorCode; @@ -354,7 +355,7 @@ public class CustomerStaffServiceImpl extends BaseServiceImpl staffRoleDTOS = staffRoleService.listStaffsInRole(UserRoleConstant.DEPT_LEADER, formDTO.getDepartmentId()); + List staffRoleDTOS = staffRoleService.listStaffsInRole(UserRoleConstant.DEPT_LEADER, formDTO.getDepartmentId(), DataScope.getDefault()); staffRoleDTOS.forEach(roleDto -> { staffList.stream().filter(staffDto -> roleDto.getStaffId().equals(staffDto.getStaffId())).findAny().ifPresent(result ->