Browse Source

Merge branch 'master' of http://121.42.41.42:7070/r/epmet-cloud

feature/evaluate
zhangyuan 3 years ago
parent
commit
c6bdc4aa85
  1. 10
      epmet-auth/pom.xml
  2. 2
      epmet-auth/src/main/java/com/epmet/AuthApplication.java
  3. 28
      epmet-auth/src/main/java/com/epmet/controller/GovLoginController.java
  4. 96
      epmet-auth/src/main/java/com/epmet/controller/ThirdLoginController.java
  5. 73
      epmet-auth/src/main/java/com/epmet/dto/dingres/DingUserDetailDTO.java
  6. 54
      epmet-auth/src/main/java/com/epmet/dto/dingres/V2UserGetuserinfoResDTO.java
  7. 48
      epmet-auth/src/main/java/com/epmet/dto/form/GovWxmpEnteOrgByAccountFormDTO.java
  8. 41
      epmet-auth/src/main/java/com/epmet/dto/form/ResiDingAppLoginFormDTO.java
  9. 23
      epmet-auth/src/main/java/com/epmet/dto/form/ResiDingAppLoginMdFormDTO.java
  10. 43
      epmet-auth/src/main/java/com/epmet/dto/form/StaffOrgByAccountFormDTO.java
  11. 48
      epmet-auth/src/main/java/com/epmet/dto/form/ThirdStaffOrgByAccountFormDTO.java
  12. 47
      epmet-auth/src/main/java/com/epmet/dto/form/ThirdWxmpEnteOrgByAccountFormDTO.java
  13. 42
      epmet-auth/src/main/java/com/epmet/dto/result/ResiDingAppLoginResDTO.java
  14. 22
      epmet-auth/src/main/java/com/epmet/feign/EpmetUserFeignClient.java
  15. 9
      epmet-auth/src/main/java/com/epmet/feign/fallback/EpmetUserFeignClientFallback.java
  16. 23
      epmet-auth/src/main/java/com/epmet/service/GovLoginService.java
  17. 44
      epmet-auth/src/main/java/com/epmet/service/ThirdLoginService.java
  18. 87
      epmet-auth/src/main/java/com/epmet/service/impl/GovLoginServiceImpl.java
  19. 435
      epmet-auth/src/main/java/com/epmet/service/impl/ThirdLoginServiceImpl.java
  20. 5
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/constant/AppClientConstant.java
  21. 1
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/constant/NumConstant.java
  22. 26
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/dto/form/DingMiniInfoFormDTO.java
  23. 79
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/enums/DingMiniAppEnum.java
  24. 2
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java
  25. 24
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/feign/CommonThirdFeignClient.java
  26. 20
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/feign/fallback/CommonThirdFeignClientFallBackFactory.java
  27. 24
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/feign/fallback/CommonThirdFeignClientFallback.java
  28. 18
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/RedisKeys.java
  29. 58
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/common/CustomerDingDingRedis.java
  30. 52
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/common/bean/DingMiniInfoCache.java
  31. 9
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/CpUserDetailRedis.java
  32. 89
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/NameUtils.java
  33. 1
      epmet-gateway/src/main/resources/bootstrap.yml
  34. 8
      epmet-module/epmet-oss/epmet-oss-server/src/main/java/com/epmet/controller/OssController.java
  35. 89
      epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/DingMiniInfoDTO.java
  36. 99
      epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/OpenSyncBizDataDTO.java
  37. 28
      epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/ExemptLoginUserDetailFormDTO.java
  38. 13
      epmet-module/epmet-third/epmet-third-server/pom.xml
  39. 2
      epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/EpmetThirdApplication.java
  40. 155
      epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/controller/dingtalk/CallbackController.java
  41. 29
      epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/OpenSyncBizDataDao.java
  42. 70
      epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/entity/OpenSyncBizDataEntity.java
  43. 46
      epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/redis/DingDingCallbackRedis.java
  44. 24
      epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/DingTalkService.java
  45. 80
      epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/OpenSyncBizDataService.java
  46. 68
      epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/DingTalkServiceImpl.java
  47. 88
      epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/OpenSyncBizDataServiceImpl.java
  48. 3
      epmet-module/epmet-third/epmet-third-server/src/main/resources/bootstrap.yml
  49. 51
      epmet-module/epmet-third/epmet-third-server/src/main/resources/db/migration/V0.0.14__add_ding_table.sql
  50. 3
      epmet-module/epmet-third/epmet-third-server/src/main/resources/db/migration/V0.0.15__other3app.sql
  51. 4
      epmet-module/epmet-third/epmet-third-server/src/main/resources/db/migration/V0.0.16__shenli4app.sql
  52. 2
      epmet-module/epmet-third/epmet-third-server/src/main/resources/logback-spring.xml
  53. 30
      epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/OpenSyncBizDataDao.xml
  54. 30
      epmet-module/epmet-third/epmet-third-server/src/main/test/java/com/epmet/ThirdPlatformTest.java
  55. 4
      epmet-module/gov-access/gov-access-client/src/main/java/com/epmet/dto/GovMenuDTO.java
  56. 5
      epmet-module/gov-access/gov-access-client/src/main/java/com/epmet/dto/result/OftenUseFunctionListResultDTO.java
  57. 4
      epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/entity/GovMenuEntity.java
  58. 2
      epmet-module/gov-access/gov-access-server/src/main/resources/db/migration/V0.0.9__alter_menu_color.sql
  59. 5
      epmet-module/gov-access/gov-access-server/src/main/resources/mapper/IcOftenUseFunctionDao.xml
  60. 87
      epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/AddStaffPyFromDTO.java
  61. 82
      epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/StaffSubmitAccountFromDTO.java
  62. 4
      epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/IcBulidingDetailDTO.java
  63. 111
      epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/IcNeighborHoodDetailDTO.java
  64. 8
      epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/StaffInitResultDTO.java
  65. 3
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/HouseInformationController.java
  66. 27
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/StaffController.java
  67. 2
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/IcHouseDao.java
  68. 8
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/IcPropertyManagementDao.java
  69. 20
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/feign/EpmetUserFeignClient.java
  70. 10
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/feign/fallback/EpmetUserFeignClientFallBack.java
  71. 4
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/IcNeighborHoodService.java
  72. 15
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/StaffService.java
  73. 2
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/HouseServiceImpl.java
  74. 20
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/IcHouseServiceImpl.java
  75. 26
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/IcNeighborHoodServiceImpl.java
  76. 58
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/StaffServiceImpl.java
  77. 13
      epmet-module/gov-org/gov-org-server/src/main/resources/mapper/IcBuildingDao.xml
  78. 45
      epmet-module/gov-org/gov-org-server/src/main/resources/mapper/IcHouseDao.xml
  79. 17
      epmet-module/gov-org/gov-org-server/src/main/resources/mapper/IcPropertyManagementDao.xml
  80. 1
      epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/result/IcEventResultDTO.java
  81. 2
      epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/impl/IcEventServiceImpl.java
  82. 9
      epmet-module/gov-project/gov-project-server/src/main/resources/mapper/IcEventDao.xml
  83. 26
      epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/form/TopArticleFormDTO.java
  84. 11
      epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/controller/ArticleController.java
  85. 2
      epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/ArticleService.java
  86. 17
      epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/impl/ArticleServiceImpl.java
  87. 2
      epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/IcFormItemGroupDTO.java
  88. 2
      epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/entity/IcFormItemGroupEntity.java
  89. 2
      epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/impl/IcFormServiceImpl.java
  90. 9
      epmet-module/oper-customize/oper-customize-server/src/main/resources/db/migration/V0.0.39__itemgroup_child.sql
  91. 3
      epmet-module/oper-customize/oper-customize-server/src/main/resources/mapper/IcFormDao.xml
  92. 2
      epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/service/impl/ResiGroupServiceImpl.java
  93. 5
      epmet-user/epmet-user-client/src/main/java/com/epmet/dto/CustomerStaffDTO.java
  94. 15
      epmet-user/epmet-user-client/src/main/java/com/epmet/dto/IcBirthRecordDTO.java
  95. 19
      epmet-user/epmet-user-client/src/main/java/com/epmet/dto/IcEpidemicSpecialAttentionDTO.java
  96. 4
      epmet-user/epmet-user-client/src/main/java/com/epmet/dto/IcNoticeDTO.java
  97. 13
      epmet-user/epmet-user-client/src/main/java/com/epmet/dto/IcTripReportRecordDTO.java
  98. 36
      epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/CustomerStaffByAccountFormDTO.java
  99. 60
      epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/DingLoginResiFormDTO.java
  100. 3
      epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/SendNoticeFormDTO.java

10
epmet-auth/pom.xml

@ -138,6 +138,16 @@
<artifactId>epmet-auth-client</artifactId>
<version>2.0.0</version>
</dependency>
<dependency>
<artifactId>dingtalk-spring-boot-starter</artifactId>
<groupId>com.taobao</groupId>
<version>1.0.0</version>
</dependency>
<dependency>
<groupId>commons-codec</groupId>
<artifactId>commons-codec</artifactId>
<version>1.15</version>
</dependency>
</dependencies>
<build>

2
epmet-auth/src/main/java/com/epmet/AuthApplication.java

@ -8,6 +8,7 @@
package com.epmet;
import com.taobao.dingtalk.spring.annotations.EnableDingTalk;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.web.servlet.ServletComponentScan;
@ -20,6 +21,7 @@ import org.springframework.cloud.openfeign.EnableFeignClients;
* @author Mark sunlightcs@gmail.com
* @since 1.0.0
*/
@EnableDingTalk
@SpringBootApplication
@EnableDiscoveryClient
@EnableFeignClients

28
epmet-auth/src/main/java/com/epmet/controller/GovLoginController.java

@ -83,6 +83,20 @@ public class GovLoginController {
return new Result<UserTokenResultDTO>().ok(userTokenResultDTO);
}
/**
* @param formDTO
* @return com.epmet.commons.tools.utils.Result<com.epmet.dto.result.UserTokenResultDTO>
* @Author zhy
* @Description 4选择组织进入首页
* @Date 2020/4/20 13:07
**/
@PostMapping(value = "/loginwxmp/enterorgbyaccount")
public Result<UserTokenResultDTO> enterOrgByAccount(@RequestBody GovWxmpEnteOrgByAccountFormDTO formDTO) {
ValidatorUtils.validateEntity(formDTO,GovWxmpEnteOrgByAccountFormDTO.AddUserShowGroup.class,GovWxmpEnteOrgByAccountFormDTO.AddUserInternalGroup.class);
UserTokenResultDTO userTokenResultDTO=govLoginService.enterOrgByAccount(formDTO);
return new Result<UserTokenResultDTO>().ok(userTokenResultDTO);
}
/**
* @param tokenDto
* @return com.epmet.commons.tools.utils.Result
@ -121,5 +135,19 @@ public class GovLoginController {
List<StaffOrgsResultDTO> staffOrgs = govLoginService.getMyOrgByPassword(formDTO);
return new Result<List<StaffOrgsResultDTO>>().ok(staffOrgs);
}
/**
* @param formDTO
* @return com.epmet.commons.tools.utils.Result<java.util.List < com.epmet.dto.result.StaffOrgsResultDTO>>
* @author zhy
* @description 6账户密码获取组织
* @Date 2020/6/30 22:43
**/
@PostMapping(value = "/getmyorgbyaccount")
public Result<List<StaffOrgsResultDTO>> getMyOrgByAccount(@RequestBody StaffOrgByAccountFormDTO formDTO) {
ValidatorUtils.validateEntity(formDTO, StaffOrgByAccountFormDTO.AddUserShowGroup.class, StaffOrgByAccountFormDTO.GetMyOrgByPassWordGroup.class);
List<StaffOrgsResultDTO> staffOrgs = govLoginService.getMyOrgByAccount(formDTO);
return new Result<List<StaffOrgsResultDTO>>().ok(staffOrgs);
}
}

96
epmet-auth/src/main/java/com/epmet/controller/ThirdLoginController.java

@ -3,15 +3,13 @@ package com.epmet.controller;
import com.epmet.commons.tools.utils.Result;
import com.epmet.commons.tools.validator.ValidatorUtils;
import com.epmet.dto.form.*;
import com.epmet.dto.result.ResiDingAppLoginResDTO;
import com.epmet.dto.result.StaffOrgsResultDTO;
import com.epmet.dto.result.UserTokenResultDTO;
import com.epmet.service.ThirdLoginService;
import org.apache.commons.lang3.StringUtils;
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;
@ -63,6 +61,19 @@ public class ThirdLoginController {
return new Result<UserTokenResultDTO>().ok(userTokenResultDTO);
}
/**
* @param formDTO
* @return
* @Author zhy
* @Description 单客户-选择组织进入首页
**/
@PostMapping(value = "enterorgbyaccount")
public Result<UserTokenResultDTO> enterOrgByAccount(@RequestBody ThirdWxmpEnteOrgByAccountFormDTO formDTO) {
ValidatorUtils.validateEntity(formDTO,ThirdWxmpEnteOrgFormDTO.AddUserShowGroup.class,ThirdWxmpEnteOrgFormDTO.AddUserInternalGroup.class);
UserTokenResultDTO userTokenResultDTO=thirdLoginService.enterOrgByAccount(formDTO);
return new Result<UserTokenResultDTO>().ok(userTokenResultDTO);
}
/**
* @param formDTO
* @return
@ -89,6 +100,19 @@ public class ThirdLoginController {
return new Result<List<StaffOrgsResultDTO>>().ok(staffOrgs);
}
/**
* @param formDTO
* @return
* @author zhy
* @description 单客户-账号密码获取组织
**/
@PostMapping(value = "/getmyorgbyaccount")
public Result<List<StaffOrgsResultDTO>> getMyOrgByAccount(@RequestBody ThirdStaffOrgByAccountFormDTO formDTO) {
ValidatorUtils.validateEntity(formDTO, StaffOrgByAccountFormDTO.AddUserShowGroup.class, StaffOrgByAccountFormDTO.GetMyOrgByPassWordGroup.class);
List<StaffOrgsResultDTO> staffOrgs = thirdLoginService.getMyOrgByAccount(formDTO);
return new Result<List<StaffOrgsResultDTO>>().ok(staffOrgs);
}
/**
* @param formDTO
* @return
@ -116,4 +140,68 @@ public class ThirdLoginController {
return new Result();
}
/**
* 钉钉应用的登录-居民端
* 产品服务商建立第三方企业应用
* 参考文档https://open.dingtalk.com/document/isvapp-server/unified-authorization-suite-access-process
* @param formDTO
* @return
*/
/**
* 接入流程https://open.dingtalk.com/document/isvapp-server/unified-authorization-suite-access-process
* 1获取个人用户tokenhttps://open.dingtalk.com/document/isvapp-server/obtain-user-token
* 2获取用户通讯录个人信息https://open.dingtalk.com/document/isvapp-server/dingtalk-retrieve-user-information
* 接口逻辑
* 1根据clientId去XXX表找到customerId
* 2通过12拿到手机号之后,根据mobile+customerId去user_base_info表找userId
* 是否注册居民register_relation
* 3没有则生成useruser_Base_info表记录
* @param formDTO
* @return
*/
@PostMapping("resilogin-ding")
public Result<ResiDingAppLoginResDTO> resiLoginDing(@RequestBody ResiDingAppLoginFormDTO formDTO) {
ValidatorUtils.validateEntity(formDTO,ResiDingAppLoginFormDTO.InnerMiniApp.class);
return new Result<ResiDingAppLoginResDTO>().ok(thirdLoginService.resiLoginDing(formDTO));
}
/**
* 烟台建立应用授权给我们走企业免登
* 企业简历内部应用授权给第三方
* 可参考文档 获取第三方应用授权企业的accessToken https://open.dingtalk.com/document/orgapp-server/obtain-the-access_token-of-the-authorized-enterprise
* https://open.dingtalk.com/document/orgapp-server/enterprise-internal-application-logon-free
* @param formDTO
* @return
*/
@PostMapping("resilogin-ding-md")
public Result<ResiDingAppLoginResDTO> resiLoginDingMd(@RequestBody ResiDingAppLoginMdFormDTO formDTO) {
ValidatorUtils.validateEntity(formDTO);
return new Result<ResiDingAppLoginResDTO>().ok(thirdLoginService.resiLoginDingMd(formDTO));
}
/**
* 企业内部应用开发不授权了 文档地址https://open.dingtalk.com/document/orgapp-server/enterprise-internal-application-logon-free
* https://open.dingtalk.com/document/orgapp-server/enterprise-internal-application-logon-free
* 建议用户信息保存在前端缓存中dd.setStorage或者cookie中避免每次进入应用都调用钉钉接口进行免登
*
* 获取免登授权码
* 小程序免登
* 微应用免登
* 获取AccessToken
* 调用接口获取access_token详情请参考获取企业内部应用的access_token
*
* 获取userid
* 调用接口获取用户的userid详情请参考通过免登码获取用户信息
*
* 获取用户详情
* 调用接口获取用户详细信息详情请参考根据userId获取用户详情
*
* @param formDTO
* @return
*/
@PostMapping("resilogin-internalding")
public Result<ResiDingAppLoginResDTO> resiLoginInternalDing(@RequestBody ResiDingAppLoginMdFormDTO formDTO) {
ValidatorUtils.validateEntity(formDTO);
return new Result<ResiDingAppLoginResDTO>().ok(thirdLoginService.resiLoginInternalDing(formDTO));
}
}

73
epmet-auth/src/main/java/com/epmet/dto/dingres/DingUserDetailDTO.java

@ -0,0 +1,73 @@
package com.epmet.dto.dingres;
import lombok.Data;
/**
* @Description
* @Author yzm
* @Date 2022/9/22 14:16
*/
@Data
public class DingUserDetailDTO {
// 接口文档:https://open.dingtalk.com/document/isvapp-server/query-user-details
/**
* 员工的userId
*/
private String userid;
/**
* 员工在当前开发者企业账号范围内的唯一标识
*/
private String unionid;
/**
* 员工姓名
*/
private String name;
/**
* 头像
* <p>
* 说明 员工使用默认头像不返回该字段手动设置头像会返回
*/
private String avatar;
/**
* 国际电话区号
* <p>
* 说明 第三方企业应用不返回该字段如需获取state_code可以使用钉钉统一授权套件方式获取
*/
private String state_code;
/**
* 手机号码
* <p>
* 说明
* 企业内部应用只有应用开通通讯录邮箱等个人信息权限才会返回该字段
* 第三方企业应用不返回该字段如需获取mobile可以使用钉钉统一授权套件方式获取
*/
private String mobile;
/**
* 是否号码隐藏
* <p>
* true隐藏
* <p>
* false不隐藏
* <p>
* 说明 隐藏手机号后手机号在个人资料页隐藏但仍可对其发DING发起钉钉免费商务电话
*/
private String hide_mobile;
/**
* 分机号
* <p>
* 说明 第三方企业应用不返回该参数
*/
private String telephone;
/**
* 员工的企业邮箱
*
* 如果员工的企业邮箱没有开通返回信息中不包含该数据
*
* 说明 第三方企业应用不返回该参数
*/
private String org_email;
}

54
epmet-auth/src/main/java/com/epmet/dto/dingres/V2UserGetuserinfoResDTO.java

@ -0,0 +1,54 @@
package com.epmet.dto.dingres;
import lombok.Data;
/**
* @Description
* @Author yzm
* @Date 2022/9/22 14:08
*/
@Data
public class V2UserGetuserinfoResDTO {
// 接口返参:https://open.dingtalk.com/document/orgapp-server/obtain-the-userid-of-a-user-by-using-the-log-free
/**
* 用户的userid
*/
private String userid;
/**
* 设备ID
*/
private String device_id;
/**
* 是否是管理员
* <p>
* true
* <p>
* false不是
*/
private Boolean sys;
/**
* 级别
* <p>
* 1主管理员
* <p>
* 2子管理员
* <p>
* 100老板
* <p>
* 0其他如普通员工
*/
private Number sys_level;
/**
* 用户关联的unionId
*/
private String associated_unionid;
/**
* 用户unionId
*/
private String unionid;
/**
* 用户名字
*/
private String name;
}

48
epmet-auth/src/main/java/com/epmet/dto/form/GovWxmpEnteOrgByAccountFormDTO.java

@ -0,0 +1,48 @@
package com.epmet.dto.form;
import com.epmet.commons.tools.validator.group.CustomerClientShowGroup;
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 GovWxmpEnteOrgByAccountFormDTO implements Serializable {
public interface AddUserInternalGroup {}
public interface AddUserShowGroup extends CustomerClientShowGroup {}
/**
* wxCode
*/
@NotBlank(message = "wxCode不能为空",groups = {AddUserInternalGroup.class})
private String wxCode;
/**
* 手机号
*/
@NotBlank(message = "账号不能为空",groups = {AddUserShowGroup.class})
private String userAccount;
/**
* 选择的组织所属的id
*/
@NotBlank(message = "客户id不能为空",groups = {AddUserInternalGroup.class})
private String customerId;
/**
* 选择的要进入的组织(根组织id)
*/
@NotBlank(message = "组织id不能为空",groups = {AddUserInternalGroup.class})
private String rootAgencyId;
/**
* desc:小程序appId
*/
private String appId;
}

41
epmet-auth/src/main/java/com/epmet/dto/form/ResiDingAppLoginFormDTO.java

@ -0,0 +1,41 @@
package com.epmet.dto.form;
import lombok.Data;
import javax.validation.constraints.NotBlank;
/**
* @Description
* @Author yzm
* @Date 2022/9/14 17:11
*/
@Data
public class ResiDingAppLoginFormDTO {
public interface InnerMiniApp {}
public interface ThirdMiniApp {}
/**
* 授权统一后的authCode
*/
@NotBlank(message = "authCode不能为空",groups = InnerMiniApp.class)
private String authCode;
// /**
// * 第三方企业应用传应用的SuiteKey
// */
// @NotBlank(message = "clientId不能为空")
// private String clientId;
/**
* 第三方企业应用传应用的SuiteKey
*/
@NotBlank(message = "miniAppId不能为空",groups = InnerMiniApp.class)
private String miniAppId;
// @NotBlank(message = "当前访问用户的企业corpId不能为空")
// private String corpId;
/**
* third第三方应用
* company_customize:企业定制应用
*/
private String appType="company_customize";
}

23
epmet-auth/src/main/java/com/epmet/dto/form/ResiDingAppLoginMdFormDTO.java

@ -0,0 +1,23 @@
package com.epmet.dto.form;
import lombok.Data;
import javax.validation.constraints.NotBlank;
/**
* @Description
* @Author yzm
* @Date 2022/9/22 10:42
*/
@Data
public class ResiDingAppLoginMdFormDTO {
@NotBlank(message = "authCode不能为空")
private String authCode;
/**
* 第三方企业应用传应用的SuiteKey
*/
@NotBlank(message = "miniAppId不能为空")
private String miniAppId;
}

43
epmet-auth/src/main/java/com/epmet/dto/form/StaffOrgByAccountFormDTO.java

@ -0,0 +1,43 @@
package com.epmet.dto.form;
import com.epmet.commons.tools.validator.group.CustomerClientShowGroup;
import lombok.Data;
import javax.validation.constraints.NotBlank;
import java.io.Serializable;
/**
* @Description 手机验证码获取组织接口入参
* @Author zhy
* @Date 2020/4/18 10:38
*/
@Data
public class StaffOrgByAccountFormDTO implements Serializable {
private static final long serialVersionUID = 4193133227120225342L;
/**
* 添加用户操作的用户可见异常分组
* 该分组用于校验需要返回给前端错误信息提示的列需要继承CustomerClientShowGroup
* 返回错误码为8999提示信息为DTO中具体的列的校验注解message的内容
*/
public interface AddUserShowGroup extends CustomerClientShowGroup {
}
public interface GetMyOrgByPassWordGroup extends CustomerClientShowGroup {
}
public interface GetMyOrgByLoginWxmp extends CustomerClientShowGroup{}
/**
* 手机号
*/
@NotBlank(message = "手机号不能为空", groups = {AddUserShowGroup.class})
private String userAccount;
/**
* 验证码
*/
@NotBlank(message="验证码不能为空", groups = {GetMyOrgByLoginWxmp.class})
private String smsCode;
@NotBlank(message = "密码不能为空",groups ={GetMyOrgByPassWordGroup.class})
private String password;
}

48
epmet-auth/src/main/java/com/epmet/dto/form/ThirdStaffOrgByAccountFormDTO.java

@ -0,0 +1,48 @@
package com.epmet.dto.form;
import com.epmet.commons.tools.validator.group.CustomerClientShowGroup;
import lombok.Data;
import javax.validation.constraints.NotBlank;
import java.io.Serializable;
/**
* @Description appId账号验证码获取组织-接口入参
* @Author zhy
*/
@Data
public class ThirdStaffOrgByAccountFormDTO implements Serializable {
private static final long serialVersionUID = 4193133227120225342L;
/**
* 添加用户操作的用户可见异常分组
* 该分组用于校验需要返回给前端错误信息提示的列需要继承CustomerClientShowGroup
* 返回错误码为8999提示信息为DTO中具体的列的校验注解message的内容
*/
public interface AddUserShowGroup extends CustomerClientShowGroup {
}
public interface GetMyOrgByPassWordGroup extends CustomerClientShowGroup {
}
public interface GetMyOrgByLoginWxmp extends CustomerClientShowGroup{}
/**
* 小程序appId
*/
@NotBlank(message = "appId不能为空", groups = {AddUserShowGroup.class})
private String appId;
/**
* 手机号
*/
@NotBlank(message = "账号不能为空", groups = {AddUserShowGroup.class})
private String userAccount;
/**
* 验证码
*/
@NotBlank(message="验证码不能为空", groups = {GetMyOrgByLoginWxmp.class})
private String smsCode;
@NotBlank(message = "密码不能为空",groups ={GetMyOrgByPassWordGroup.class})
private String password;
}

47
epmet-auth/src/main/java/com/epmet/dto/form/ThirdWxmpEnteOrgByAccountFormDTO.java

@ -0,0 +1,47 @@
package com.epmet.dto.form;
import com.epmet.commons.tools.validator.group.CustomerClientShowGroup;
import lombok.Data;
import javax.validation.constraints.NotBlank;
import java.io.Serializable;
/**
* @Description 单客户-选择组织进入首页入参Dto
* @Author sun
*/
@Data
public class ThirdWxmpEnteOrgByAccountFormDTO implements Serializable {
public interface AddUserInternalGroup {}
public interface AddUserShowGroup extends CustomerClientShowGroup {}
/**
* wxCode
*/
@NotBlank(message = "wxCode不能为空",groups = {AddUserInternalGroup.class})
private String wxCode;
/**
* 手机号
*/
@NotBlank(message = "账号不能为空",groups = {AddUserShowGroup.class})
private String userAccount;
/**
* 选择的组织所属的id
*/
@NotBlank(message = "客户id不能为空",groups = {AddUserInternalGroup.class})
private String customerId;
/**
* 选择的要进入的组织(根组织id)
*/
@NotBlank(message = "组织id不能为空",groups = {AddUserInternalGroup.class})
private String rootAgencyId;
/**
* 客户appIdexJson文件中获取
*/
@NotBlank(message = "appId不能为空",groups = {AddUserInternalGroup.class})
private String appId;
}

42
epmet-auth/src/main/java/com/epmet/dto/result/ResiDingAppLoginResDTO.java

@ -0,0 +1,42 @@
package com.epmet.dto.result;
import lombok.Data;
/**
* @Description
* @Author yzm
* @Date 2022/9/14 17:20
*/
@Data
public class ResiDingAppLoginResDTO {
private String authorization;
private String customerId;
private String gridId;
/**
* 网格名
*/
private String gridName;
/**
* 网格所属的组织id
*/
private String agencyId;
/**
* 居民端用户id
*/
private String epmetUserId;
/**
* 5.获取用户手机号使用用户个人access_token调用获取用户通讯录个人信息接口获取
* 返参信息
* 接口文档https://open.dingtalk.com/document/isvapp-server/dingtalk-retrieve-user-information
*/
private String extInfo;
/**
* 是否注册居民
* true:已注册
* false:未注册
*/
private Boolean regFlag;
}

22
epmet-auth/src/main/java/com/epmet/feign/EpmetUserFeignClient.java

@ -70,6 +70,17 @@ public interface EpmetUserFeignClient {
@GetMapping(value = "epmetuser/customerstaff/getcustsomerstaffbyphone/{mobile}")
Result<List<CustomerStaffDTO>> checkCustomerStaff(@PathVariable("mobile") String mobile);
/**
* @param account
* @return com.epmet.commons.tools.utils.Result
* @Author zhy
* @Description 根据账户查询政府端工作人员基本信息校验用户是否存在
* @Date 2020/4/18 14:03
**/
@GetMapping(value = "epmetuser/customerstaff/getcustsomerstaffbyaccount/{account}")
Result<List<CustomerStaffDTO>> checkCustomerStaffByAccount(@PathVariable("account") String account);
/**
* @param staffWechatFormDTO
* @return com.epmet.commons.tools.utils.Result
@ -100,6 +111,17 @@ public interface EpmetUserFeignClient {
@PostMapping(value = "epmetuser/customerstaff/getcustomerstaffinfo", consumes = MediaType.APPLICATION_JSON_VALUE)
Result<CustomerStaffDTO> getCustomerStaffInfo(@RequestBody CustomerStaffFormDTO customerStaffFormDTO);
/**
* @param customerStaffFormDTO
* @return com.epmet.commons.tools.utils.Result<com.epmet.dto.CustomerStaffDTO>
* @Author zhy
* @Description 根据手机号+客户id获取工作人员基本信息
* @Date 2020/4/20 14:16
**/
@PostMapping(value = "epmetuser/customerstaff/getcustomerstaffinfobyaccount", consumes = MediaType.APPLICATION_JSON_VALUE)
Result<CustomerStaffDTO> getCustomerStaffInfoByAccount(@RequestBody CustomerStaffByAccountFormDTO customerStaffFormDTO);
/**
* @param staffLoginHistoryFormDTO
* @return com.epmet.commons.tools.utils.Result

9
epmet-auth/src/main/java/com/epmet/feign/fallback/EpmetUserFeignClientFallback.java

@ -44,6 +44,10 @@ public class EpmetUserFeignClientFallback implements EpmetUserFeignClient {
return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "getCustsomerStaffByPhone", phone);
}
@Override
public Result<List<CustomerStaffDTO>> checkCustomerStaffByAccount(String account) {
return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "getCustsomerStaffByAccount", account);
}
@Override
public Result saveStaffWechat(StaffWechatFormDTO staffWechatFormDTO) {
return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "saveStaffWechat", staffWechatFormDTO);
@ -59,6 +63,11 @@ public class EpmetUserFeignClientFallback implements EpmetUserFeignClient {
return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "getCustomerStaffInfo", customerStaffFormDTO);
}
@Override
public Result<CustomerStaffDTO> getCustomerStaffInfoByAccount(CustomerStaffByAccountFormDTO customerStaffFormDTO) {
return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "getCustomerStaffInfoByAccount", customerStaffFormDTO);
}
@Override
public Result saveStaffLoginRecord(StaffLoginAgencyRecordFormDTO staffLoginHistoryFormDTO) {
return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "saveStaffLoginRecord", staffLoginHistoryFormDTO);

23
epmet-auth/src/main/java/com/epmet/service/GovLoginService.java

@ -1,10 +1,7 @@
package com.epmet.service;
import com.epmet.commons.tools.security.dto.TokenDto;
import com.epmet.dto.form.GovWxmpEnteOrgFormDTO;
import com.epmet.dto.form.GovWxmpFormDTO;
import com.epmet.dto.form.SendSmsCodeFormDTO;
import com.epmet.dto.form.StaffOrgsFormDTO;
import com.epmet.dto.form.*;
import com.epmet.dto.result.StaffOrgsResultDTO;
import com.epmet.dto.result.UserTokenResultDTO;
@ -52,6 +49,15 @@ public interface GovLoginService {
**/
UserTokenResultDTO enterOrg(GovWxmpEnteOrgFormDTO formDTO);
/**
* @param formDTO
* @return com.epmet.commons.tools.utils.Result<com.epmet.dto.result.UserTokenResultDTO>
* @Author zhy
* @Description 4选择组织进入首页
* @Date 2020/4/20 13:08
**/
UserTokenResultDTO enterOrgByAccount(GovWxmpEnteOrgByAccountFormDTO formDTO);
/**
* @return com.epmet.commons.tools.utils.Result
* @param tokenDto
@ -76,4 +82,13 @@ public interface GovLoginService {
* @Date 2020/6/30 22:43
**/
List<StaffOrgsResultDTO> getMyOrgByPassword(StaffOrgsFormDTO formDTO);
/**
* @return java.util.List<com.epmet.dto.result.StaffOrgsResultDTO>
* @param formDTO
* @author zhy
* @description 6账户密码获取组织
* @Date 2020/6/30 22:43
**/
List<StaffOrgsResultDTO> getMyOrgByAccount(StaffOrgByAccountFormDTO formDTO);
}

44
epmet-auth/src/main/java/com/epmet/service/ThirdLoginService.java

@ -1,6 +1,7 @@
package com.epmet.service;
import com.epmet.dto.form.*;
import com.epmet.dto.result.ResiDingAppLoginResDTO;
import com.epmet.dto.result.StaffOrgsResultDTO;
import com.epmet.dto.result.UserTokenResultDTO;
@ -36,6 +37,15 @@ public interface ThirdLoginService {
**/
UserTokenResultDTO enterOrg(ThirdWxmpEnteOrgFormDTO formDTO);
/**
* @param formDTO
* @return
* @Author zhy
* @Description 单客户-选择组织进入首页
**/
UserTokenResultDTO enterOrgByAccount(ThirdWxmpEnteOrgByAccountFormDTO formDTO);
/**
* @param formDTO
* @return
@ -52,6 +62,15 @@ public interface ThirdLoginService {
**/
List<StaffOrgsResultDTO> getMyOrgByPassword(ThirdStaffOrgsFormDTO formDTO);
/**
* @param formDTO
* @return
* @author zhy
* @description 单客户-手机号密码获取组织
**/
List<StaffOrgsResultDTO> getMyOrgByAccount(ThirdStaffOrgByAccountFormDTO formDTO);
/**
* @param formDTO
* @return
@ -66,4 +85,29 @@ public interface ThirdLoginService {
* @description 单客户-工作端微信小程序登录-发送验证码
**/
void sendSmsCode(ThirdSendSmsCodeFormDTO formDTO);
/**
* 钉钉应用的登录-居民端
* 产品服务商建立第三方企业应用
* 参考文档https://open.dingtalk.com/document/isvapp-server/unified-authorization-suite-access-process
* @param formDTO
* @return
*/
ResiDingAppLoginResDTO resiLoginDing(ResiDingAppLoginFormDTO formDTO);
/**
* 企业简历内部应用授权给第三方
* 可参考文档 获取第三方应用授权企业的accessToken https://open.dingtalk.com/document/orgapp-server/obtain-the-access_token-of-the-authorized-enterprise
* https://open.dingtalk.com/document/orgapp-server/enterprise-internal-application-logon-free
* @param formDTO
* @return
*/
ResiDingAppLoginResDTO resiLoginDingMd(ResiDingAppLoginMdFormDTO formDTO);
/**
* 企业内部应用免登 文档地址https://open.dingtalk.com/document/orgapp-server/enterprise-internal-application-logon-free
* @param formDTO
* @return
*/
ResiDingAppLoginResDTO resiLoginInternalDing(ResiDingAppLoginMdFormDTO formDTO);
}

87
epmet-auth/src/main/java/com/epmet/service/impl/GovLoginServiceImpl.java

@ -289,6 +289,36 @@ public class GovLoginServiceImpl implements GovLoginService, ResultDataResolver
return userTokenResultDTO;
}
@Override
public UserTokenResultDTO enterOrgByAccount(GovWxmpEnteOrgByAccountFormDTO formDTO) {
//1、需要校验要登录的客户,是否被禁用
CustomerStaffByAccountFormDTO customerStaffFormDTO = new CustomerStaffByAccountFormDTO();
customerStaffFormDTO.setCustomerId(formDTO.getCustomerId());
customerStaffFormDTO.setUserAccount(formDTO.getUserAccount());
Result<CustomerStaffDTO> customerStaffDTOResult = epmetUserFeignClient.getCustomerStaffInfoByAccount(customerStaffFormDTO);
if (!customerStaffDTOResult.success() || null == customerStaffDTOResult.getData()) {
logger.warn(String.format("获取工作人员信息失败,账户[%s],客户id:[%s],code[%s],msg[%s]", formDTO.getUserAccount(), formDTO.getCustomerId(), customerStaffDTOResult.getCode(), customerStaffDTOResult.getMsg()));
throw new RenException(customerStaffDTOResult.getCode());
}
CustomerStaffDTO customerStaff = customerStaffDTOResult.getData();
//2、解析微信用户
WxMaJscode2SessionResult wxMaJscode2SessionResult = loginService.getWxMaUser(LoginConstant.APP_GOV, formDTO.getWxCode(), formDTO.getAppId());
//3、记录staff_wechat,并记录用户激活状态,激活时间
this.savestaffwechat(customerStaff.getUserId(), wxMaJscode2SessionResult.getOpenid(), formDTO.getCustomerId());
//4、记录登录日志
GovWxmpEnteOrgFormDTO orgDTO = ConvertUtils.sourceToTarget(formDTO, GovWxmpEnteOrgFormDTO.class);
orgDTO.setMobile(customerStaff.getMobile());
this.saveStaffLoginRecord(orgDTO, customerStaff.getUserId(), wxMaJscode2SessionResult.getOpenid());
//5.1、获取用户token
String token = this.generateGovWxmpToken(customerStaff.getUserId());
//5.2、保存到redis
this.saveGovTokenDto(formDTO.getRootAgencyId(), formDTO.getCustomerId(), customerStaff.getUserId(), wxMaJscode2SessionResult, token);
UserTokenResultDTO userTokenResultDTO = new UserTokenResultDTO();
userTokenResultDTO.setToken(token);
return userTokenResultDTO;
}
@Override
public void loginOut(TokenDto tokenDto) {
if(null == tokenDto){
@ -381,6 +411,63 @@ public class GovLoginServiceImpl implements GovLoginService, ResultDataResolver
return new ArrayList<>();
}
@Override
public List<StaffOrgsResultDTO> getMyOrgByAccount(StaffOrgByAccountFormDTO formDTO) {
//1、根据手机号查询到用户信息
Result<List<CustomerStaffDTO>> customerStaffResult = epmetUserFeignClient.checkCustomerStaffByAccount(formDTO.getUserAccount());
if (!customerStaffResult.success()) {
logger.warn(String.format("账户密码登录异常,手机号[%s],code[%s],msg[%s]", formDTO.getUserAccount(), customerStaffResult.getCode(), customerStaffResult.getMsg()));
throw new RenException(customerStaffResult.getCode());
}
//2、密码是否正确
List<CustomerStaffDTO> customerStaffList=customerStaffResult.getData();
//3、查询用户所有的组织信息
List<String> customerIdList = new ArrayList<>();
//是否设置过密码
boolean havePasswordFlag=false;
//密码是否正确
boolean passwordRightFlag=false;
for (CustomerStaffDTO customerStaffDTO : customerStaffList) {
if(StringUtils.isNotBlank(customerStaffDTO.getPassword())){
havePasswordFlag=true;
}else{
logger.warn(String.format("当前用户:账户%s,客户Id%s下未设置密码.",formDTO.getUserAccount(),customerStaffDTO.getCustomerId()));
continue;
}
if (!PasswordUtils.matches(formDTO.getPassword(), customerStaffDTO.getPassword())) {
logger.warn(String.format("当前用户:账户%s,客户Id%s密码匹配错误.",formDTO.getUserAccount(),customerStaffDTO.getCustomerId()));
}else{
logger.warn(String.format("当前用户:账户%s,客户Id%s密码匹配正确.",formDTO.getUserAccount(),customerStaffDTO.getCustomerId()));
passwordRightFlag=true;
customerIdList.add(customerStaffDTO.getCustomerId());
}
}
//根据手机号查出来所有用户,密码都为空,表明用户未激活账户,未设置密码
if(!havePasswordFlag){
logger.warn(String.format("当前账户(%s)下所有账户都未设置密码,请先使用验证码登录激活账户",formDTO.getUserAccount()));
throw new RenException(EpmetErrorCode.PASSWORD_ERROR.getCode());
}
//密码错误
if(!passwordRightFlag){
logger.warn(String.format("根据当前账户(%s)密码未找到所属组织,密码错误",formDTO.getUserAccount()));
throw new RenException(EpmetErrorCode.PASSWORD_ERROR.getCode());
}
StaffOrgFormDTO staffOrgFormDTO = new StaffOrgFormDTO();
staffOrgFormDTO.setCustomerIdList(customerIdList);
Result<List<StaffOrgsResultDTO>> result = govOrgFeignClient.getStaffOrgList(staffOrgFormDTO);
if(result.success()&&null!=result.getData()){
return result.getData();
}
logger.warn(String .format("手机验证码获取组织,调用%s服务失败,入参账户%s,密码%s,返回错误码%s,错误提示信息%s",
ServiceConstant.GOV_ORG_SERVER,
formDTO.getUserAccount(),
formDTO.getPassword(),
result.getCode(),
result.getMsg()));
return new ArrayList<>();
}
//保存登录日志
private Result saveStaffLoginRecord(GovWxmpEnteOrgFormDTO formDTO, String staffId, String openId) {
StaffLoginAgencyRecordFormDTO staffLoginAgencyRecordFormDTO = new StaffLoginAgencyRecordFormDTO();

435
epmet-auth/src/main/java/com/epmet/service/impl/ThirdLoginServiceImpl.java

@ -5,15 +5,21 @@ import cn.binarywang.wx.miniapp.bean.WxMaPhoneNumberInfo;
import cn.binarywang.wx.miniapp.util.crypt.WxMaCryptUtils;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.aliyun.dingtalk.module.DingTalkResult;
import com.epmet.auth.constants.AuthOperationConstants;
import com.epmet.common.token.constant.LoginConstant;
import com.epmet.commons.rocketmq.messages.LoginMQMsg;
import com.epmet.commons.tools.constant.AppClientConstant;
import com.epmet.commons.tools.constant.ServiceConstant;
import com.epmet.commons.tools.constant.StrConstant;
import com.epmet.commons.tools.enums.EnvEnum;
import com.epmet.commons.tools.exception.EpmetErrorCode;
import com.epmet.commons.tools.exception.EpmetException;
import com.epmet.commons.tools.exception.ExceptionUtils;
import com.epmet.commons.tools.exception.RenException;
import com.epmet.commons.tools.feign.ResultDataResolver;
import com.epmet.commons.tools.redis.common.CustomerDingDingRedis;
import com.epmet.commons.tools.redis.common.bean.DingMiniInfoCache;
import com.epmet.commons.tools.security.dto.GovTokenDto;
import com.epmet.commons.tools.security.dto.TokenDto;
import com.epmet.commons.tools.security.password.PasswordUtils;
@ -23,6 +29,8 @@ import com.epmet.commons.tools.validator.PhoneValidatorUtils;
import com.epmet.constant.AuthHttpUrlConstant;
import com.epmet.constant.SmsTemplateConstant;
import com.epmet.dto.*;
import com.epmet.dto.dingres.DingUserDetailDTO;
import com.epmet.dto.dingres.V2UserGetuserinfoResDTO;
import com.epmet.dto.form.*;
import com.epmet.dto.result.*;
import com.epmet.feign.EpmetMessageOpenFeignClient;
@ -32,6 +40,11 @@ import com.epmet.jwt.JwtTokenProperties;
import com.epmet.jwt.JwtTokenUtils;
import com.epmet.redis.CaptchaRedis;
import com.epmet.service.ThirdLoginService;
import com.taobao.api.ApiException;
import com.taobao.dingtalk.client.DingTalkClientToken;
import com.taobao.dingtalk.client.DingTalkClientUser;
import com.taobao.dingtalk.vo.result.AccessTokenResult;
import com.taobao.dingtalk.vo.result.UserBaseInfo;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
@ -73,6 +86,10 @@ public class ThirdLoginServiceImpl implements ThirdLoginService, ResultDataResol
private EpmetMessageOpenFeignClient messageOpenFeignClient;
@Autowired
private LoginUserUtil loginUserUtil;
@Autowired
private DingTalkClientToken dingTalkClientToken;
@Autowired
private DingTalkClientUser dingTalkClientUser;
/**
* @param formDTO
@ -425,6 +442,68 @@ public class ThirdLoginServiceImpl implements ThirdLoginService, ResultDataResol
return userTokenResultDTO;
}
/**
* @param formDTO
* @return
* @Author sun
* @Description 单客户-选择组织进入首页
**/
@Override
public UserTokenResultDTO enterOrgByAccount(ThirdWxmpEnteOrgByAccountFormDTO formDTO) {
//1、需要校验要登录的客户,是否被禁用
CustomerStaffByAccountFormDTO customerStaffFormDTO = new CustomerStaffByAccountFormDTO();
customerStaffFormDTO.setCustomerId(formDTO.getCustomerId());
customerStaffFormDTO.setUserAccount(formDTO.getUserAccount());
Result<CustomerStaffDTO> customerStaffDTOResult = epmetUserOpenFeignClient.getCustomerStaffInfoByAccount(customerStaffFormDTO);
if (!customerStaffDTOResult.success() || null == customerStaffDTOResult.getData()) {
logger.error(String.format("获取工作人员信息失败,账户[%s],客户id:[%s],code[%s],msg[%s]", formDTO.getUserAccount(), formDTO.getCustomerId(), customerStaffDTOResult.getCode(), customerStaffDTOResult.getMsg()));
throw new RenException(customerStaffDTOResult.getCode());
}
CustomerStaffDTO customerStaff = customerStaffDTOResult.getData();
//2020.7.24 获取微信信息接口调整,改调用微信api的方式 sun start
//2.调用epmet_third服务,校验appId是否有效以及是否授权,校验通过的调用微信API获取用户基本信息
WxLoginFormDTO resiLoginFormDTO = new WxLoginFormDTO();
resiLoginFormDTO.setAppId(formDTO.getAppId());
resiLoginFormDTO.setWxCode(formDTO.getWxCode());
UserWechatDTO userWechatDTO = this.getUserWeChat(resiLoginFormDTO);
WxMaJscode2SessionResult wxMaJscode2SessionResult = new WxMaJscode2SessionResult();
wxMaJscode2SessionResult.setOpenid(userWechatDTO.getWxOpenId());
wxMaJscode2SessionResult.setSessionKey(userWechatDTO.getSessionKey());
wxMaJscode2SessionResult.setUnionid("");
// end
//3、记录staff_wechat,并记录用户激活状态,激活时间
this.savestaffwechat(customerStaff.getUserId(), userWechatDTO.getWxOpenId(), formDTO.getCustomerId());
//4、记录登录日志
StaffLatestAgencyResultDTO staffLatestAgencyResultDTO = new StaffLatestAgencyResultDTO();
staffLatestAgencyResultDTO.setCustomerId(formDTO.getCustomerId());
staffLatestAgencyResultDTO.setStaffId(customerStaff.getUserId());
staffLatestAgencyResultDTO.setWxOpenId(userWechatDTO.getWxOpenId());
staffLatestAgencyResultDTO.setMobile(customerStaff.getMobile());
staffLatestAgencyResultDTO.setAgencyId(formDTO.getRootAgencyId());
this.saveStaffLoginRecord(staffLatestAgencyResultDTO);
//5.1、获取用户token
String token = this.generateGovWxmpToken(customerStaff.getUserId());
//5.2、保存到redis
StaffLatestAgencyResultDTO staffLatestAgency = new StaffLatestAgencyResultDTO();
staffLatestAgency.setAgencyId(formDTO.getRootAgencyId());
staffLatestAgency.setCustomerId(formDTO.getCustomerId());
staffLatestAgency.setStaffId(customerStaff.getUserId());
this.saveLatestGovTokenDto(staffLatestAgency, userWechatDTO, token);
UserTokenResultDTO userTokenResultDTO = new UserTokenResultDTO();
userTokenResultDTO.setToken(token);
//6.发送登录事件
try {
sendLoginEvent(customerStaff.getUserId(), formDTO.getAppId(), AppClientConstant.APP_GOV, AppClientConstant.CLIENT_WXMP);
} catch (RenException e) {
log.error(e.getInternalMsg());
} catch (Exception e) {
log.error("【工作端enterOrg登录】发送登录事件失败,程序继续执行。错误信息");
}
return userTokenResultDTO;
}
/**
* @param formDTO
* @return
@ -538,6 +617,69 @@ public class ThirdLoginServiceImpl implements ThirdLoginService, ResultDataResol
return new ArrayList<>();
}
@Override
public List<StaffOrgsResultDTO> getMyOrgByAccount(ThirdStaffOrgByAccountFormDTO formDTO) {
//0.根据appId查询对应客户Id
PaCustomerDTO customer = this.getCustomerInfo(formDTO.getAppId());
//7.28 上边根据appId只能锁定一条客户id,后边的批量循环操作暂不做调整,还是使用之前的代码 sun
//1、根据手机号查询到用户信息
ThirdCustomerStaffByAccountFormDTO dto = new ThirdCustomerStaffByAccountFormDTO();
dto.setCustomerId(customer.getId());
dto.setUserAccount(formDTO.getUserAccount());
Result<List<CustomerStaffDTO>> customerStaffResult = epmetUserOpenFeignClient.getCustsomerStaffByIdAndAccount(dto);
if (!customerStaffResult.success()) {
logger.warn(String.format("账户密码登录异常,账户[%s],code[%s],msg[%s]", formDTO.getUserAccount(), customerStaffResult.getCode(), customerStaffResult.getMsg()));
throw new RenException(customerStaffResult.getCode());
}
//2、密码是否正确
List<CustomerStaffDTO> customerStaffList=customerStaffResult.getData();
//3、查询用户所有的组织信息
List<String> customerIdList = new ArrayList<>();
//是否设置过密码
boolean havePasswordFlag=false;
//密码是否正确
boolean passwordRightFlag=false;
for (CustomerStaffDTO customerStaffDTO : customerStaffList) {
if(StringUtils.isNotBlank(customerStaffDTO.getPassword())){
havePasswordFlag=true;
}else{
logger.warn(String.format("当前用户:账户%s,客户Id%s下未设置密码.",formDTO.getUserAccount(),customerStaffDTO.getCustomerId()));
continue;
}
if (!PasswordUtils.matches(formDTO.getPassword(), customerStaffDTO.getPassword())) {
logger.warn(String.format("当前用户:账户%s,客户Id%s密码匹配错误.",formDTO.getUserAccount(),customerStaffDTO.getCustomerId()));
}else{
logger.warn(String.format("当前用户:账户%s,客户Id%s密码匹配正确.",formDTO.getUserAccount(),customerStaffDTO.getCustomerId()));
passwordRightFlag=true;
customerIdList.add(customerStaffDTO.getCustomerId());
}
}
//根据手机号查出来所有用户,密码都为空,表明用户未激活账户,未设置密码
if(!havePasswordFlag){
logger.warn(String.format("当前账户(%s)下所有账户都未设置密码,请先使用验证码登录激活账户",formDTO.getUserAccount()));
throw new RenException(EpmetErrorCode.PASSWORD_ERROR.getCode());
}
//密码错误
if(!passwordRightFlag){
logger.warn(String.format("根据当前账户(%s)密码未找到所属组织,密码错误",formDTO.getUserAccount()));
throw new RenException(EpmetErrorCode.PASSWORD_ERROR.getCode());
}
StaffOrgFormDTO staffOrgFormDTO = new StaffOrgFormDTO();
staffOrgFormDTO.setCustomerIdList(customerIdList);
Result<List<StaffOrgsResultDTO>> result = govOrgOpenFeignClient.getStaffOrgList(staffOrgFormDTO);
if(result.success()&&null!=result.getData()){
return result.getData();
}
logger.warn(String .format("手机验证码获取组织,调用%s服务失败,入参账户%s,密码%s,返回错误码%s,错误提示信息%s",
ServiceConstant.GOV_ORG_SERVER,
formDTO.getUserAccount(),
formDTO.getPassword(),
result.getCode(),
result.getMsg()));
return new ArrayList<>();
}
/**
* @Description 获取客户信息
* @param appId
@ -690,4 +832,297 @@ public class ThirdLoginServiceImpl implements ThirdLoginService, ResultDataResol
//getResultDataOrThrowsException(result, ServiceConstant.EPMET_MESSAGE_SERVER, EpmetErrorCode.SERVER_ERROR.getCode(), "调用Message服务,发送登录事件到MQ失败");
}
// 接入流程:https://open.dingtalk.com/document/isvapp-server/unified-authorization-suite-access-process
// 1、获取个人用户token:https://open.dingtalk.com/document/isvapp-server/obtain-user-token
// 2、获取用户通讯录个人信息:https://open.dingtalk.com/document/isvapp-server/dingtalk-retrieve-user-information
// 接口逻辑:
// (1)根据clientId去XXX表找到customerId
// (2)通过1、2拿到手机号之后,根据mobile+customerId去user_base_info表找userId,
// 是否注册居民:register_relation
// (3)没有则生成user、user_Base_info表记录
/**
* 钉钉应用的登录-居民端
*
* @param formDTO
* @return
*/
@Override
public ResiDingAppLoginResDTO resiLoginDing(ResiDingAppLoginFormDTO formDTO) {
//获取用户手机号
log.info("1、钉钉居民端应用登录入参:"+ JSON.toJSONString(formDTO));
ResiDingAppLoginResDTO resDTO= null;
try {
resDTO = new ResiDingAppLoginResDTO();
resDTO.setCustomerId(getCurrentCustomerId());
//1、获取用户手机号
String miniAppId = formDTO.getMiniAppId();
DingMiniInfoCache dingMiniInfo = CustomerDingDingRedis.getDingMiniInfo(miniAppId);
DingTalkResult<AccessTokenResult> userAccessToken = dingTalkClientToken.getUserAccessToken(formDTO.getAuthCode(), dingMiniInfo.getSuiteKey(), dingMiniInfo.getSuiteSecret());
log.info("2、resiLoginDing userAccessToken:{}",JSON.toJSONString(userAccessToken));
if (!userAccessToken.success() || null == userAccessToken.getData()) {
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "调用微信api异常:" + JSON.toJSONString(userAccessToken), EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getMsg());
}
DingTalkResult<UserBaseInfo> me = dingTalkClientUser.getUserInfo("me", userAccessToken.getData().getAccessToken());
log.info("3、resiLoginDing me:{}",JSON.toJSONString(me));
resDTO.setExtInfo(JSON.toJSONString(me.getData()));
if (!me.success() || StringUtils.isBlank(me.getData().getMobile())) {
log.error("resilogin-ding登录接口报错,入参:" + JSON.toJSONString(formDTO) + ";获取手机号为空, userAccessToken.getData().getAccessToken()=" + userAccessToken.getData().getAccessToken());
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "获取手机号为空", "获取手机号为空");
}
// 2、调用userfeign接口获取userId、注册网格相关信息 todo
DingLoginResiFormDTO dingLoginResiFormDTO=ConvertUtils.sourceToTarget(me.getData(),DingLoginResiFormDTO.class);
dingLoginResiFormDTO.setCustomerId(resDTO.getCustomerId());
Result<DingLoginResiResDTO> loginResiResDTOResult = epmetUserOpenFeignClient.dingResiLogin(dingLoginResiFormDTO);
if (!loginResiResDTOResult.success() || null == loginResiResDTOResult.getData()) {
//临时打个日志
log.error(String.format("resilogin-ding获取epmetUserId异常,入参:%s,user服务返参:%s", JSON.toJSONString(formDTO), JSON.toJSONString(loginResiResDTOResult)));
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "获取epmetUserId异常:" + JSON.toJSONString(loginResiResDTOResult), EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getMsg());
}
DingLoginResiResDTO resiResDTO=loginResiResDTOResult.getData();
resDTO.setGridId(resiResDTO.getGridId());
resDTO.setGridName(resiResDTO.getGridName());
resDTO.setAgencyId(resiResDTO.getAgencyId());
resDTO.setEpmetUserId(resiResDTO.getEpmetUserId());
resDTO.setRegFlag(resiResDTO.getRegFlag());
//3.生成token,并且存放Redis
String token=this.saveTokenDtoDing(formDTO.getMiniAppId(),AppClientConstant.APP_RESI,AppClientConstant.MINI_DING, resDTO.getEpmetUserId(), resDTO.getCustomerId());
resDTO.setAuthorization(token);
} catch (ApiException e) {
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), e.getErrMsg(), EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getMsg());
}
return resDTO;
}
private String saveTokenDtoDing(String miniAppId,String app,String client, String userId,String customerId) {
//生成token串
Map<String, Object> map = new HashMap<>();
map.put(AppClientConstant.APP, app);
// map.put(AppClientConstant.CLIENT, client);
// 第三方企业应用传应用的SuiteKey 作为client
map.put(AppClientConstant.CLIENT, client.concat(miniAppId));
map.put("userId", userId);
String token = jwtTokenUtils.createToken(map);
int expire = jwtTokenProperties.getExpire();
TokenDto tokenDto = new TokenDto();
tokenDto.setCustomerId(customerId);
tokenDto.setApp(app);
tokenDto.setClient(client.concat(miniAppId));
tokenDto.setUserId(userId);
tokenDto.setToken(token);
tokenDto.setUpdateTime(System.currentTimeMillis());
tokenDto.setExpireTime(jwtTokenUtils.getExpiration(token).getTime());
cpUserDetailRedis.set(tokenDto, expire);
// cpUserDetailRedis.setForDingApp(miniAppId,tokenDto, expire);
logger.info("截止时间:" + DateUtils.format(jwtTokenUtils.getExpiration(token), "yyyy-MM-dd HH:mm:ss"));
return token;
}
@Override
public ResiDingAppLoginResDTO resiLoginDingMd(ResiDingAppLoginMdFormDTO formDTO) {
// 获取用户手机号
log.info("1、钉钉居民端应用登录入参:" + JSON.toJSONString(formDTO));
ResiDingAppLoginResDTO resDTO = null;
resDTO = new ResiDingAppLoginResDTO();
resDTO.setCustomerId(getCurrentCustomerId());
// 1、获取用户手机号
DingLoginResiFormDTO dingLoginResiFormDTO = getDingLoginResiFormDTOMd(formDTO.getMiniAppId(), formDTO.getAuthCode());
dingLoginResiFormDTO.setCustomerId(resDTO.getCustomerId());
// 2、调用userfeign接口获取userId、注册网格相关信息
Result<DingLoginResiResDTO> loginResiResDTOResult = epmetUserOpenFeignClient.dingResiLogin(dingLoginResiFormDTO);
if (!loginResiResDTOResult.success() || null == loginResiResDTOResult.getData()) {
// 临时打个日志
log.error(String.format("resiLoginDingMd获取epmetUserId异常,入参:%s,user服务返参:%s", JSON.toJSONString(formDTO), JSON.toJSONString(loginResiResDTOResult)));
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "获取epmetUserId异常:" + JSON.toJSONString(loginResiResDTOResult), EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getMsg());
}
DingLoginResiResDTO resiResDTO = loginResiResDTOResult.getData();
resDTO.setGridId(resiResDTO.getGridId());
resDTO.setGridName(resiResDTO.getGridName());
resDTO.setAgencyId(resiResDTO.getAgencyId());
resDTO.setEpmetUserId(resiResDTO.getEpmetUserId());
resDTO.setRegFlag(resiResDTO.getRegFlag());
// 3.生成token,并且存放Redis
String token = this.saveTokenDtoDing(formDTO.getMiniAppId(), AppClientConstant.APP_RESI, AppClientConstant.MINI_DING, resDTO.getEpmetUserId(), resDTO.getCustomerId());
resDTO.setAuthorization(token);
return resDTO;
}
private DingLoginResiFormDTO getDingLoginResiFormDTOMd(String miniAppId, String authCode) {
DingMiniInfoCache dingMiniInfo = CustomerDingDingRedis.getDingMiniInfo(miniAppId);
// 1、服务商获取第三方应用授权企业的access_token,文档地址:https://open.dingtalk.com/document/orgapp-server/obtains-the-enterprise-authorized-credential
// 烟台的CorpId: dingaae55cbc47a96845f5bf40eda33b7ba0
String yantaiCorpId = "dingaae55cbc47a96845f5bf40eda33b7ba0";
DingTalkResult<String> res = dingTalkClientToken.getThirdAuthCorpAccessToken(dingMiniInfo.getSuiteKey(), dingMiniInfo.getSuiteSecret(), "abc", yantaiCorpId);
if (!res.success() || StringUtils.isBlank(res.getData())) {
log.error(String.format("企业内部应用免登服务商获取第三方应用授权企业的access_token失败,customKey:%s,customSecret:%s,corpId:%s", dingMiniInfo.getSuiteSecret(), dingMiniInfo.getSuiteSecret(), yantaiCorpId));
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "服务商获取第三方应用授权企业的access_token", "服务商获取第三方应用授权企业的access_token");
}
String accessToken = res.getData();
log.info(String.format("1、服务商获取第三方应用授权企业的access_token返参:%s", accessToken));
// 2、通过免登码获取用户信息,文档地址:https://open.dingtalk.com/document/orgapp-server/obtain-the-userid-of-a-user-by-using-the-log-free
DingTalkResult<String> v2UserGetuserinfoRes = dingTalkClientToken.getUserInfo(accessToken, authCode);
if (!v2UserGetuserinfoRes.success() || StringUtils.isBlank(v2UserGetuserinfoRes.getData())) {
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "通过免登码获取用户信息异常", "通过免登码获取用户信息异常");
}
log.info(String.format("2、通过免登码获取用户信息返参:%s", v2UserGetuserinfoRes.getData()));
V2UserGetuserinfoResDTO v2UserGetuserinfoResDTO = JSON.parseObject(v2UserGetuserinfoRes.getData(), V2UserGetuserinfoResDTO.class);
if (null == v2UserGetuserinfoResDTO || StringUtils.isBlank(v2UserGetuserinfoResDTO.getUserid())) {
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "获取钉钉用户userid为空", "获取钉钉用户userid为空");
}
// 3、查询用户详情,文档地址:https://open.dingtalk.com/document/isvapp-server/query-user-details
DingTalkResult<String> v2UserGetRes = dingTalkClientToken.getUserDetail(v2UserGetuserinfoResDTO.getUserid(), accessToken);
if (!v2UserGetRes.success() || StringUtils.isBlank(v2UserGetRes.getData())) {
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "根据userId查询用户详情失败", "根据userId查询用户详情失败");
}
log.info(String.format("3、查询用户详情:%s", v2UserGetRes.getData()));
DingUserDetailDTO dingUserDetailDTO = JSON.parseObject(v2UserGetRes.getData(), DingUserDetailDTO.class);
if (null == dingUserDetailDTO || StringUtils.isBlank(dingUserDetailDTO.getMobile())) {
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "获取手机号为空", "获取手机号为空");
}
DingLoginResiFormDTO dingLoginResiFormDTO = new DingLoginResiFormDTO();
dingLoginResiFormDTO.setAvatarUrl(dingUserDetailDTO.getAvatar());
dingLoginResiFormDTO.setEmail(dingUserDetailDTO.getOrg_email());
dingLoginResiFormDTO.setMobile(dingUserDetailDTO.getMobile());
dingLoginResiFormDTO.setNick(dingUserDetailDTO.getName());
dingLoginResiFormDTO.setOpenId(StrConstant.EPMETY_STR);
dingLoginResiFormDTO.setStateCode(dingUserDetailDTO.getState_code());
dingLoginResiFormDTO.setUnionId(dingUserDetailDTO.getUnionid());
return dingLoginResiFormDTO;
}
/**
* 企业内部应用开发不授权了
* https://open.dingtalk.com/document/orgapp-server/enterprise-internal-application-logon-free
* 建议用户信息保存在前端缓存中dd.setStorage或者cookie中避免每次进入应用都调用钉钉接口进行免登
*
* 获取免登授权码
* 小程序免登
* 微应用免登
* 获取AccessToken
* 调用接口获取access_token详情请参考获取企业内部应用的access_token
*
* 获取userid
* 调用接口获取用户的userid详情请参考通过免登码获取用户信息
*
* 获取用户详情
* 调用接口获取用户详细信息详情请参考根据userId获取用户详情
*
* @param formDTO
* @return
*/
@Override
public ResiDingAppLoginResDTO resiLoginInternalDing(ResiDingAppLoginMdFormDTO formDTO) {
// 获取用户手机号
log.info("1、钉钉居民端应用登录入参:" + JSON.toJSONString(formDTO));
ResiDingAppLoginResDTO resDTO = null;
resDTO = new ResiDingAppLoginResDTO();
resDTO.setCustomerId(getCurrentCustomerId());
// 1、获取用户手机号
DingLoginResiFormDTO dingLoginResiFormDTO = getDingLoginResiFormDTOInternal(formDTO.getMiniAppId(), formDTO.getAuthCode());
dingLoginResiFormDTO.setCustomerId(resDTO.getCustomerId());
// 2、调用userfeign接口获取userId、注册网格相关信息
Result<DingLoginResiResDTO> loginResiResDTOResult = epmetUserOpenFeignClient.dingResiLogin(dingLoginResiFormDTO);
if (!loginResiResDTOResult.success() || null == loginResiResDTOResult.getData()) {
// 临时打个日志
log.error(String.format("resiLoginInternalDing获取epmetUserId异常,入参:%s", JSON.toJSONString(dingLoginResiFormDTO)));
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "获取epmetUserId异常:"+ JSON.toJSONString(loginResiResDTOResult), "获取epmetUserId异常");
}
DingLoginResiResDTO resiResDTO = loginResiResDTOResult.getData();
resDTO.setGridId(resiResDTO.getGridId());
resDTO.setGridName(resiResDTO.getGridName());
resDTO.setAgencyId(resiResDTO.getAgencyId());
resDTO.setEpmetUserId(resiResDTO.getEpmetUserId());
resDTO.setRegFlag(resiResDTO.getRegFlag());
// 3.生成token,并且存放Redis
String token = this.saveTokenDtoDing(formDTO.getMiniAppId(), AppClientConstant.APP_RESI, AppClientConstant.MINI_DING, resDTO.getEpmetUserId(), resDTO.getCustomerId());
resDTO.setAuthorization(token);
return resDTO;
}
/**
* 最原始的企业内部应用开发不授权给产品服务商
* @param miniAppId
* @param authCode
* @return
*/
private DingLoginResiFormDTO getDingLoginResiFormDTOInternal(String miniAppId, String authCode) {
DingMiniInfoCache dingMiniInfo = CustomerDingDingRedis.getDingMiniInfo(miniAppId);
// 1、获取企业内部应用的accessToken文档地址:https://open.dingtalk.com/document/orgapp-server/obtain-the-access_token-of-an-internal-app
String accessToken = "";
DingTalkResult<String> dingTalkResult = dingTalkClientToken.getAppAccessTokenToken(dingMiniInfo.getSuiteKey(), dingMiniInfo.getSuiteSecret());
if (!dingTalkResult.success() || StringUtils.isBlank(dingTalkResult.getData())) {
log.error(String.format("获取企业内部应用的accessToken失败,customKey:%s,customSecret:%s", dingMiniInfo.getSuiteSecret(), dingMiniInfo.getSuiteSecret()));
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "获取企业内部应用的accessToken异常", "获取企业内部应用的accessToken");
}
accessToken = dingTalkResult.getData();
log.info(String.format("1、获取企业内部应用的accessToken返参:%s", accessToken));
// 2、通过免登码获取用户信息,文档地址:https://open.dingtalk.com/document/orgapp-server/obtain-the-userid-of-a-user-by-using-the-log-free
DingTalkResult<String> v2UserGetuserinfoRes = dingTalkClientToken.getUserInfo(accessToken, authCode);
if (!v2UserGetuserinfoRes.success() || StringUtils.isBlank(v2UserGetuserinfoRes.getData())) {
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "通过免登码获取用户信息异常", "通过免登码获取用户信息异常");
}
log.info(String.format("2、通过免登码获取用户信息返参:%s", v2UserGetuserinfoRes.getData()));
V2UserGetuserinfoResDTO v2UserGetuserinfoResDTO = JSON.parseObject(v2UserGetuserinfoRes.getData(), V2UserGetuserinfoResDTO.class);
if (null == v2UserGetuserinfoResDTO || StringUtils.isBlank(v2UserGetuserinfoResDTO.getUserid())) {
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "获取钉钉用户userid为空", "获取钉钉用户userid为空");
}
// 3、查询用户详情,文档地址:https://open.dingtalk.com/document/isvapp-server/query-user-details
DingTalkResult<String> v2UserGetRes = dingTalkClientToken.getUserDetail(v2UserGetuserinfoResDTO.getUserid(), accessToken);
if (!v2UserGetRes.success() || StringUtils.isBlank(v2UserGetRes.getData())) {
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "根据userId查询用户详情失败", "根据userId查询用户详情失败");
}
log.info(String.format("3、查询用户详情:%s", v2UserGetRes.getData()));
DingUserDetailDTO dingUserDetailDTO = JSON.parseObject(v2UserGetRes.getData(), DingUserDetailDTO.class);
if (null == dingUserDetailDTO || StringUtils.isBlank(dingUserDetailDTO.getMobile())) {
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "获取手机号为空", "获取手机号为空");
}
DingLoginResiFormDTO dingLoginResiFormDTO = new DingLoginResiFormDTO();
dingLoginResiFormDTO.setAvatarUrl(dingUserDetailDTO.getAvatar());
dingLoginResiFormDTO.setEmail(dingUserDetailDTO.getOrg_email());
dingLoginResiFormDTO.setMobile(dingUserDetailDTO.getMobile());
dingLoginResiFormDTO.setNick(dingUserDetailDTO.getName());
dingLoginResiFormDTO.setOpenId(StrConstant.EPMETY_STR);
dingLoginResiFormDTO.setStateCode(dingUserDetailDTO.getState_code());
dingLoginResiFormDTO.setUnionId(dingUserDetailDTO.getUnionid());
return dingLoginResiFormDTO;
}
/**
* 客户写死吧
* @return
*/
private String getCurrentCustomerId() {
String customerId="";
EnvEnum currentEnv = EnvEnum.getCurrentEnv();
if (EnvEnum.PROD.getCode().equals(currentEnv.getCode())) {
// 烟台的客户id
customerId="1535072605621841922";
} else if (EnvEnum.TEST.getCode().equals(currentEnv.getCode())) {
// 最美琴岛
customerId="0c41b272ee9ee95ac6f184ad548a30eb";
} else {
// 其余统一走开发环境
customerId="45687aa479955f9d06204d415238f7cc";
}
return customerId;
}
}

5
epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/constant/AppClientConstant.java

@ -32,6 +32,11 @@ public interface AppClientConstant {
*/
String CLIENT_WXMP = "wxmp";
/**
* 钉钉小程序
*/
String MINI_DING = "mini_ding";
/**
* 客户来源App
* */

1
epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/constant/NumConstant.java

@ -85,6 +85,7 @@ public interface NumConstant {
String POSITIVE_EIGHT_STR = "+8";
String EMPTY_STR = "";
String ONE_NEG_STR = "-1";
String ONE_HUNDRED_STR = "100";
String FIFTY_STR="50";
}

26
epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/dto/form/DingMiniInfoFormDTO.java

@ -0,0 +1,26 @@
package com.epmet.commons.tools.dto.form;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import javax.validation.constraints.NotBlank;
import java.io.Serializable;
/**
* @Author zxc
* @DateTime 2022/9/15 10:25
* @DESC
*/
@Data
@NoArgsConstructor
@AllArgsConstructor
public class DingMiniInfoFormDTO implements Serializable {
private static final long serialVersionUID = 2661531490851265637L;
public interface DingMiniInfoForm{}
@NotBlank(message = "miniAppId不能为空",groups = DingMiniInfoForm.class)
private String miniAppId;
}

79
epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/enums/DingMiniAppEnum.java

@ -0,0 +1,79 @@
package com.epmet.commons.tools.enums;
/**
* @Description
* @Author yzm
* @Date 2022/9/14 19:11
*/
public enum DingMiniAppEnum {
// 亿联云盘CorpId:dingd1e19e397c754c7735c2f4657eb6378f
//
// //各应用秘钥
// 随手拍
// SuiteId:27501006
// AppId:119450
// MiniAppId:5000000002934668
// SuiteKey:suitew6ccvkquinmrghqy
// SuiteSecret:TooAxiegdsE5BPP6xo1AxK1LdmaUoMpPMyomOcGcBSXtnsxRc8dEfyOlG56oSmEB
//
// 随时讲
// SuiteId:27564007
// AppId:119451
// MiniAppId:5000000002934374
// SuiteKey:suitezhyj12glsrp8em0f
// SuiteSecret:-z5Q_lvMP6l7fTzlArEzUT8D_-5pvqBQaJMuTGHoXnz0nuiqGQMZ8aeya_cxTsN-
//
// 我的报事
// SuiteId:27569006
// AppId:119452
// MiniAppId:5000000002934456
// SuiteKey:suite5yxliro6wawv514w
// SuiteSecret:aQxiPi7DwJSUa9HlbUU_L7Q4wGCLEDmgf__Ffx75cTn3jZwuHy9vdl-9Iv5FeyJU
//
// 实时动态
// SuiteId:27458011
// AppId:119453
// MiniAppId:5000000002934488
// SuiteKey:suitemcestnonr6y0xigc
// SuiteSecret:kKCNCkfDhmLoVnl_wuAiScyDG4776mkTevuSBuiYhHg-Bvz1-vhb_4IA-Km7nK2I
SSP("suitew6ccvkquinmrghqy", "随手拍", "TooAxiegdsE5BPP6xo1AxK1LdmaUoMpPMyomOcGcBSXtnsxRc8dEfyOlG56oSmEB"),
SSJ("suitezhyj12glsrp8em0f", "随时讲", "-z5Q_lvMP6l7fTzlArEzUT8D_-5pvqBQaJMuTGHoXnz0nuiqGQMZ8aeya_cxTsN-"),
MY_REPORT_EVENT("suite5yxliro6wawv514w", "我的报事", "aQxiPi7DwJSUa9HlbUU_L7Q4wGCLEDmgf__Ffx75cTn3jZwuHy9vdl-9Iv5FeyJU"),
SSDT("suitemcestnonr6y0xigc", "实时动态", "kKCNCkfDhmLoVnl_wuAiScyDG4776mkTevuSBuiYhHg-Bvz1-vhb_4IA-Km7nK2I");
private String suiteKey;
private String name;
private String suiteSecret;
DingMiniAppEnum(String suiteKey, String name, String suiteSecret) {
this.suiteKey = suiteKey;
this.name = name;
this.suiteSecret = suiteSecret;
}
public static DingMiniAppEnum getEnum(String suiteKey) {
DingMiniAppEnum[] values = DingMiniAppEnum.values();
for (DingMiniAppEnum value : values) {
if (value.getSuiteKey().equals(suiteKey)) {
return value;
}
}
return null;
}
public String getSuiteKey() {
return suiteKey;
}
public String getName() {
return name;
}
public String getSuiteSecret() {
return suiteSecret;
}
}

2
epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java

@ -40,6 +40,7 @@ public enum EpmetErrorCode {
PASSWORD_NOT_FIT(8010,"两次填写的密码不一致"),
PASSWORD_OUT_OF_ORDER(8011,"密码必须8-20个字符,而且同时包含大小写字母和数字"),
PASSWORD_UPDATE_FAILED(8012,"密码修改失败"),
GOV_STAFF_ACCOUNT_NOT_EXISTS(8013,"账户未注册,请联系贵单位管理员"),
MOBILE_HAS_BEEN_USED(8101, "该手机号已注册,请更换手机号或使用原绑定的微信账号登录"),
MOBILE_CODE_ERROR(8102, "验证码错误"),
AUTO_CONFIRM_FAILED(8103, "党员注册失败"),
@ -100,6 +101,7 @@ public enum EpmetErrorCode {
EXIT_PEND_PROJECT(8408,"该工作人员有项目尚在处理,处理完毕方可操作"),
EXIT_PUBLISHED_ACTIVITY(8409,"该工作人员有活动尚在进行,等活动完成方可操作"),
CAN_NOT_SELF(8410,"无法对自己进行操作"),
ACCOUNT_USED(8411,"该账号已注册"),
PATROL_IS_NOT_OVER(8520,"巡查尚未结束"),
ALREADY_EVALUATE(8501,"您已评价"),

24
epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/feign/CommonThirdFeignClient.java

@ -0,0 +1,24 @@
package com.epmet.commons.tools.feign;
import com.epmet.commons.tools.constant.ServiceConstant;
import com.epmet.commons.tools.dto.form.DingMiniInfoFormDTO;
import com.epmet.commons.tools.feign.fallback.CommonThirdFeignClientFallBackFactory;
import com.epmet.commons.tools.redis.common.bean.DingMiniInfoCache;
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;
/**
* @Description
* @Author zxc
*/
@FeignClient(name = ServiceConstant.EPMET_THIRD_SERVER, fallbackFactory = CommonThirdFeignClientFallBackFactory.class)
// @FeignClient(name = ServiceConstant.EPMET_THIRD_SERVER, fallbackFactory = CommonAggFeignClientFallBackFactory.class,url = "localhost:8110")
public interface CommonThirdFeignClient {
@PostMapping("/third/dingTalk/getDingMiniInfo")
Result<DingMiniInfoCache> getDingMiniInfo(@RequestBody DingMiniInfoFormDTO formDTO);
}

20
epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/feign/fallback/CommonThirdFeignClientFallBackFactory.java

@ -0,0 +1,20 @@
package com.epmet.commons.tools.feign.fallback;
import com.epmet.commons.tools.exception.ExceptionUtils;
import com.epmet.commons.tools.feign.CommonThirdFeignClient;
import feign.hystrix.FallbackFactory;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
@Component
@Slf4j
public class CommonThirdFeignClientFallBackFactory implements FallbackFactory<CommonThirdFeignClient> {
private CommonThirdFeignClientFallback fallback = new CommonThirdFeignClientFallback();
@Override
public CommonThirdFeignClient create(Throwable cause) {
log.error(String.format("FeignClient调用发生异常,异常信息:%s", ExceptionUtils.getThrowableErrorStackTrace(cause)));
return fallback;
}
}

24
epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/feign/fallback/CommonThirdFeignClientFallback.java

@ -0,0 +1,24 @@
package com.epmet.commons.tools.feign.fallback;
import com.epmet.commons.tools.constant.ServiceConstant;
import com.epmet.commons.tools.dto.form.DingMiniInfoFormDTO;
import com.epmet.commons.tools.feign.CommonThirdFeignClient;
import com.epmet.commons.tools.redis.common.bean.DingMiniInfoCache;
import com.epmet.commons.tools.utils.ModuleUtils;
import com.epmet.commons.tools.utils.Result;
import org.springframework.stereotype.Component;
/**
*
* @Author zxc
* @Description
* @Date
**/
@Component
public class CommonThirdFeignClientFallback implements CommonThirdFeignClient {
@Override
public Result<DingMiniInfoCache> getDingMiniInfo(DingMiniInfoFormDTO formDTO) {
return ModuleUtils.feignConError(ServiceConstant.EPMET_THIRD_SERVER, "getDingMiniInfo", formDTO);
}
}

18
epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/RedisKeys.java

@ -104,6 +104,10 @@ public class RedisKeys {
return rootPrefix.concat("sys:security:user:").concat(app).concat(StrConstant.COLON).concat(client).concat(StrConstant.COLON).concat(userId);
}
public static String getCpUserKeyForDingApp(String suiteKey,String app, String client, String userId) {
return rootPrefix.concat("sys:security:user:").concat(app).concat(StrConstant.COLON).concat(client).concat(StrConstant.COLON).concat(suiteKey).concat(StrConstant.COLON).concat(userId);
}
/**
* 拼接手机验证码key---后面需要改
*
@ -871,4 +875,18 @@ public class RedisKeys {
public static String getDhToken() {
return rootPrefix.concat("dh:token");
}
/**
* Desc: 票据
* @param suiteKey
* @author zxc
* @date 2022/9/14 10:46
*/
public static String getSuiteTicketKey(String suiteKey) {
return rootPrefix.concat("ding:suiteTicket:" + suiteKey);
}
public static String getDingMiniInfoKey(String suiteKey) {
return rootPrefix.concat("ding:miniInfo:" + suiteKey);
}
}

58
epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/common/CustomerDingDingRedis.java

@ -0,0 +1,58 @@
package com.epmet.commons.tools.redis.common;
import com.epmet.commons.tools.dto.form.DingMiniInfoFormDTO;
import com.epmet.commons.tools.exception.EpmetException;
import com.epmet.commons.tools.feign.CommonThirdFeignClient;
import com.epmet.commons.tools.redis.RedisKeys;
import com.epmet.commons.tools.redis.RedisUtils;
import com.epmet.commons.tools.redis.common.bean.DingMiniInfoCache;
import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.commons.tools.utils.Result;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.util.CollectionUtils;
import javax.annotation.PostConstruct;
import java.util.Map;
/**
* @Author zxc
* @DateTime 2022/9/15 10:01
* @DESC
*/
@Slf4j
@Component
public class CustomerDingDingRedis {
@Autowired
private CommonThirdFeignClient thirdFeignClient;
@Autowired
private RedisUtils redisUtils;
private static CustomerDingDingRedis customerDingDingRedis;
@PostConstruct
public void init() {
customerDingDingRedis = this;
customerDingDingRedis.thirdFeignClient = this.thirdFeignClient;
customerDingDingRedis.redisUtils = this.redisUtils;
}
public static DingMiniInfoCache getDingMiniInfo(String miniAppId){
String key = RedisKeys.getDingMiniInfoKey(miniAppId);
Map<String, Object> miniInfoMap = customerDingDingRedis.redisUtils.hGetAll(key);
if (!CollectionUtils.isEmpty(miniInfoMap)){
return ConvertUtils.mapToEntity(miniInfoMap,DingMiniInfoCache.class);
}
Result<DingMiniInfoCache> dingMiniInfoResult = customerDingDingRedis.thirdFeignClient.getDingMiniInfo(new DingMiniInfoFormDTO(miniAppId));
if (!dingMiniInfoResult.success()){
throw new EpmetException("查询dingMiniInfo失败...");
}
if (null == dingMiniInfoResult.getData()){
return null;
}
return dingMiniInfoResult.getData();
}
}

52
epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/common/bean/DingMiniInfoCache.java

@ -0,0 +1,52 @@
package com.epmet.commons.tools.redis.common.bean;
import lombok.Data;
import java.io.Serializable;
/**
* @Author zxc
* @DateTime 2022/9/15 10:11
* @DESC
*/
@Data
public class DingMiniInfoCache implements Serializable {
private static final long serialVersionUID = -6956910978074595334L;
private String id;
/**
*
*/
private String suiteId;
/**
*
*/
private String appId;
/**
*
*/
private String miniAppId;
/**
*
*/
private String suiteName;
/**
*
*/
private String suiteKey;
/**
*
*/
private String suiteSecret;
private String token;
private String aesKey;
}

9
epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/CpUserDetailRedis.java

@ -41,6 +41,15 @@ public class CpUserDetailRedis {
redisUtils.hMSet(key, map, expire);
}
public void setForDingApp(String suiteKey,TokenDto user, long expire) {
if (user == null) {
return;
}
String key = RedisKeys.getCpUserKeyForDingApp(suiteKey,user.getApp(), user.getClient(), user.getUserId());
//bean to map
Map<String, Object> map = BeanUtil.beanToMap(user, false, true);
redisUtils.hMSet(key, map, expire);
}
/**
* 获取token信息
*

89
epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/NameUtils.java

@ -0,0 +1,89 @@
package com.epmet.commons.tools.utils;
import com.epmet.commons.tools.constant.NumConstant;
import java.util.HashMap;
import java.util.Map;
/**
* @Description
* @Author zhaoqifeng
* @Date 2022/9/14 14:40
*/
public class NameUtils {
/**
* 复姓两字,国内现存81个末尾添加三字以上的部分满姓
*/
private static final String[] SURNAME_NOW = {"百里", "北堂", "北野", "北宫", "辟闾", "孛尔", "淳于", "成公", "陈生", "褚师",
"端木", "东方", "东郭", "东野", "东门", "第五", "大狐", "段干", "段阳", "带曰", "第二", "东宫", "公孙", "公冶", "公羊",
"公良", "公西", "公孟", "高堂", "高阳", "公析", "公肩", "公坚", "郭公", "谷梁", "毌将", "公乘", "毌丘", "公户", "公广",
"公仪", "公祖", "皇甫", "黄龙", "胡母", "何阳", "夹谷", "九方", "即墨", "梁丘", "闾丘", "洛阳", "陵尹", "冷富", "龙丘",
"令狐", "林彭", "南宫", "南郭", "女娲", "南伯", "南容", "南门", "南野", "欧阳", "欧侯", "濮阳", "青阳", "漆雕", "亓官",
"渠丘", "壤驷", "上官", "少室", "少叔", "司徒", "司马", "司空", "司寇", "士孙", "申屠", "申徒", "申鲜", "申叔", "夙沙",
"叔先", "叔仲", "侍其", "叔孙", "澹台", "太史", "太叔", "太公", "屠岸", "唐古", "闻人", "巫马", "微生", "王孙", "无庸",
"夏侯", "西门", "信平", "鲜于", "轩辕", "相里", "新垣", "徐离", "羊舌", "羊角", "延陵", "於陵", "伊祁", "吾丘", "乐正",
"只斤", "诸葛", "颛孙", "仲孙", "仲长", "钟离", "宗政", "主父", "中叔", "左人", "左丘", "宰父", "长儿", "仉督", "单于",
"叱干", "叱利", "车非", "车公", "车侯", "车长", "车绵", "独孤", "大野", "独吉", "达奚", "达官", "达仲", "达品", "哥舒",
"哥夜", "哥翰", "哥汗", "赫连", "呼延", "贺兰", "黑齿", "斛律", "斛粟", "贺若", "贺奴", "贺远", "贺元", "夹谷", "吉胡",
"吉利", "吉家", "可频", "慕容", "万俟", "万红", "万中", "抹捻", "纳兰", "纳西", "纳吉", "纳罕", "纳塞", "纳博", "纳称",
"纳勉", "普周", "仆固", "仆散", "蒲察", "屈突", "屈卢", "钳耳", "是云", "索卢", "厍狄", "拓跋", "同蹄", "秃发", "完颜",
"完明", "完忠", "宇文", "尉迟", "耶律", "耶红", "也先", "耶鲜", "耶闻", "长孙", "长南", "长北", "长西", "长红", "长元",
"长秋", "长寸", "长李", "长云", "萨嘛喇","赫舍里","萨克达","钮祜禄","他塔喇","喜塔腊","库雅喇","瓜尔佳","舒穆禄","索绰络",
"叶赫那拉","依尔觉罗","额尔德特","讷殷富察","叶赫那兰","爱新觉罗","依尔根觉罗"};
/**
* 获取复姓非单字姓氏未匹配上则依旧返回单字姓氏
* @param name
* @return
*/
public static String getSurNameComplex(String name){
for (String s : SURNAME_NOW) {
if (name.startsWith(s)) {
return name.substring(0, s.length());
}
}
return name.substring(0,1);
}
/**
* 获取复姓名去除姓氏后名
* @param name
* @return
*/
public static String getNameComplex(String name){
for (String s : SURNAME_NOW) {
if (name.startsWith(s)) {
return name.substring(s.length());
}
}
return name.substring(1);
}
/**
* 获取姓氏与姓名<br>
* 姓名在两字时首字为姓<br>
* 姓名大于两字时优先匹配复姓<br>
* 姓氏未匹配且姓名多于5字时姓与名均在姓氏中,名为空少于5字时则采用第一个字为姓<br>
* @param name 姓名
* @return map类型数据姓氏为key值X名字为value值M
*/
public static Map<String, String> getSurName(String name) {
Map<String,String> mapData = new HashMap<>(NumConstant.TWO);
if (name.length() > NumConstant.ZERO && name.length() <= NumConstant.TWO){
mapData.put("X", name.substring(NumConstant.ZERO, NumConstant.ONE));
mapData.put("M", name.substring(NumConstant.ONE));
} else if (name.length() > NumConstant.TWO) {
for (String s : SURNAME_NOW) {//遍历复姓数组
if (name.startsWith(s)) {
mapData.put("X", s);
mapData.put("M", name.substring(s.length()));
return mapData;
}
}
//姓氏没有匹配时采用第一个字为姓
mapData.put("X", name.substring(NumConstant.ZERO, NumConstant.ONE));
mapData.put("M", name.substring(NumConstant.ONE));
}
return mapData;
}
}

1
epmet-gateway/src/main/resources/bootstrap.yml

@ -498,6 +498,7 @@ epmet:
- /resi/voice/**
- /point/**
- /heart/**
- /oss/**
# 内部认证url白名单(在白名单中的,就不会再校验登录了)
internalAuthUrlsWhiteList:

8
epmet-module/epmet-oss/epmet-oss-server/src/main/java/com/epmet/controller/OssController.java

@ -10,6 +10,7 @@ package com.epmet.controller;
import com.epmet.cloud.CloudStorageConfig;
import com.epmet.cloud.OssFactory;
import com.epmet.commons.tools.annotation.LoginUser;
import com.epmet.commons.tools.constant.NumConstant;
import com.epmet.commons.tools.constant.StrConstant;
import com.epmet.commons.tools.exception.EpmetErrorCode;
@ -17,6 +18,7 @@ import com.epmet.commons.tools.exception.RenException;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.redis.RedisKeys;
import com.epmet.commons.tools.redis.RedisUtils;
import com.epmet.commons.tools.security.dto.TokenDto;
import com.epmet.commons.tools.utils.Result;
import com.epmet.commons.tools.validator.ValidatorUtils;
import com.epmet.commons.tools.validator.group.AliyunGroup;
@ -404,8 +406,10 @@ public class OssController {
* @date 2021.08.03 16:23
*/
@PostMapping("upload-resi-event-file")
public Result<UploadImgResultDTO> uploadResiEventFile(@RequestPart(value = "file") MultipartFile file, @RequestParam("customerId") String customerId) {
public Result<UploadImgResultDTO> uploadResiEventFile(@LoginUser TokenDto tokenDto, @RequestPart(value = "file") MultipartFile file, @RequestParam(value = "customerId",required = false) String customerId) {
if (StringUtils.isBlank(customerId)){
customerId = tokenDto.getCustomerId();
}
// 体积限制
int sizeMb = 10;
int sizeThreshold = sizeMb * 1024 * 1024; // 大小限制10m

89
epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/DingMiniInfoDTO.java

@ -0,0 +1,89 @@
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 2022-09-14
*/
@Data
public class DingMiniInfoDTO implements Serializable {
private static final long serialVersionUID = 1L;
/**
* ID
*/
private String id;
/**
*
*/
private String suiteId;
/**
*
*/
private String appId;
/**
*
*/
private String miniAppId;
/**
*
*/
private String suiteName;
/**
*
*/
private String suiteKey;
/**
*
*/
private String suiteSecret;
private String token;
private String aesKey;
/**
*
*/
private Integer delFlag;
/**
* 乐观锁
*/
private Integer revision;
/**
* 创建人
*/
private String createdBy;
/**
* 创建时间
*/
private Date createdTime;
/**
* 更新人
*/
private String updatedBy;
/**
* 更新时间
*/
private Date updatedTime;
}

99
epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/OpenSyncBizDataDTO.java

@ -0,0 +1,99 @@
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 2022-09-14
*/
@Data
public class OpenSyncBizDataDTO implements Serializable {
private static final long serialVersionUID = 1L;
/**
*
*/
private String id;
/**
* 第三方企业应用的suiteid加下划线0
*/
private String subscribeId;
private String suiteKey;
/**
* 第三方企业应用的corpid
*/
private String corpId;
/**
* 第三方企业应用的suiteid
*/
private String bizId;
/**
* 数据为Json格式
*/
private String bizData;
/**
* 2第三方企业应用票据
4企业授权变更包含授权解除授权授权变更
7第三方企业应用变更包含停用启用删除(删除保留授权)
13企业用户变更包含用户添加修改删除
14企业部门变更包含部门添加修改删除
15企业角色变更包含角色添加修改删除
16企业变更包含企业修改删除
17市场订单
20企业外部联系人变更包含添加修改删除
22ISV自定义审批
25家校通讯录1.0(Deprecated)信息变更家校通讯录升级请查看家校通讯录2.0数据推送
32智能硬件绑定类型
37因订单到期或者用户退款等导致的服务关闭目前仅推送因退款等导致的服务关闭
50家校通讯录2.0部门信息变更
51家校通讯录2.0人员信息变更
63应用试用记录回调信息
66工作台组件变更回调事件
67钉钉假期相关回调事件
133CRM客户动态相关数据回调事件
137人事平台员工异动V2相关数据回调事件
139异步转译通讯录id任务完成通知
165人事平台员工档案变动事件相关数据的回调事件
175人事解决方案变更事件
*/
private String bizType;
/**
*
*/
private Integer delFlag;
/**
*
*/
private Date createdTime;
/**
*
*/
private String createdBy;
/**
*
*/
private Date updatedTime;
/**
*
*/
private String updatedBy;
}

28
epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/ExemptLoginUserDetailFormDTO.java

@ -0,0 +1,28 @@
package com.epmet.dto.form;
import lombok.Data;
import javax.validation.constraints.NotBlank;
import java.io.Serializable;
/**
* @Author zxc
* @DateTime 2022/9/14 14:52
* @DESC
*/
@Data
public class ExemptLoginUserDetailFormDTO implements Serializable {
private static final long serialVersionUID = -4333806195203619201L;
public interface ExemptLoginUserDetailForm{}
@NotBlank(message = "code不能为空",groups = ExemptLoginUserDetailForm.class)
private String code;
@NotBlank(message = "corpId不能为空",groups = ExemptLoginUserDetailForm.class)
private String corpId;
@NotBlank(message = "miniAppId不能为空",groups = ExemptLoginUserDetailForm.class)
private String miniAppId;
}

13
epmet-module/epmet-third/epmet-third-server/pom.xml

@ -157,7 +157,16 @@
<artifactId>rocketmq-acl</artifactId>
<version>4.9.2</version>
</dependency>
<dependency>
<artifactId>dingtalk-spring-boot-starter</artifactId>
<groupId>com.taobao</groupId>
<version>1.0.0</version>
</dependency>
<dependency>
<groupId>commons-codec</groupId>
<artifactId>commons-codec</artifactId>
<version>1.15</version>
</dependency>
</dependencies>
<build>
@ -229,7 +238,7 @@
</dingTalk.robot.webHook>
<dingTalk.robot.secret>SECfcc020bdc83bb17a2c00f39977b1fbc409ef4188c7beaea11c5caa90eeaf87fd
</dingTalk.robot.secret>
<!-- epmet-cloud内部用的rocketmq配置 -->
<!--<rocketmq.epmet-cloud-inner.enable>true</rocketmq.epmet-cloud-inner.enable>
<rocketmq.epmet-cloud-inner.name-server>192.168.1.140:9876;192.168.1.141:9876</rocketmq.epmet-cloud-inner.name-server>-->

2
epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/EpmetThirdApplication.java

@ -1,6 +1,7 @@
package com.epmet;
import com.epmet.mq.properties.RocketMQProperties;
import com.taobao.dingtalk.spring.annotations.EnableDingTalk;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
@ -8,6 +9,7 @@ import org.springframework.boot.web.servlet.ServletComponentScan;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.cloud.openfeign.EnableFeignClients;
@EnableDingTalk
@EnableConfigurationProperties(RocketMQProperties.class)
@SpringBootApplication
@EnableDiscoveryClient

155
epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/controller/dingtalk/CallbackController.java

@ -0,0 +1,155 @@
package com.epmet.controller.dingtalk;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.aliyun.dingtalk.util.DingCallbackCrypto;
import com.epmet.commons.tools.constant.NumConstant;
import com.epmet.commons.tools.dto.form.DingMiniInfoFormDTO;
import com.epmet.commons.tools.redis.common.bean.DingMiniInfoCache;
import com.epmet.commons.tools.utils.Result;
import com.epmet.commons.tools.validator.ValidatorUtils;
import com.epmet.dao.OpenSyncBizDataDao;
import com.epmet.dto.DingMiniInfoDTO;
import com.epmet.dto.form.ExemptLoginUserDetailFormDTO;
import com.epmet.entity.OpenSyncBizDataEntity;
import com.epmet.redis.DingDingCallbackRedis;
import com.epmet.service.DingTalkService;
import com.epmet.service.OpenSyncBizDataService;
import org.apache.commons.collections4.CollectionUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
/**
* ISV 小程序回调信息处理
*/
@RestController
@RequestMapping("/dingTalk")
public class CallbackController {
private final Logger log = LoggerFactory.getLogger(getClass());
/**
* 创建应用验证回调URL创建有效事件第一次保存回调URL之前
*/
private static final String EVENT_CHECK_CREATE_SUITE_URL = "check_create_suite_url";
/**
* 创建应用验证回调URL变更有效事件第一次保存回调URL之后
*/
private static final String EVENT_CHECK_UPADTE_SUITE_URL = "check_update_suite_url";
/**
* suite_ticket推送事件
*/
private static final String EVENT_SUITE_TICKET = "suite_ticket";
/**
* 企业授权开通应用事件
*/
private static final String EVENT_TMP_AUTH_CODE = "tmp_auth_code";
private static final String EVENT_SYNC_HTTP_PUSH_HIGH = "SYNC_HTTP_PUSH_HIGH";
@Autowired
private OpenSyncBizDataService openSyncBizDataService;
@Autowired
private OpenSyncBizDataDao openSyncBizDataDao;
@Autowired
private DingDingCallbackRedis dingCallbackRedis;
@Autowired
private DingTalkService dingTalkService;
@PostMapping(value = "dingCallback")
public Object dingCallback(
@RequestParam(value = "signature") String signature,
@RequestParam(value = "timestamp") Long timestamp,
@RequestParam(value = "nonce") String nonce,
@RequestParam(value = "suiteKey") String suiteKey,
@RequestBody(required = false) JSONObject body
) {
String params = "signature:" + signature + " timestamp:" + timestamp + " nonce:" + nonce + " body:" + body + "suiteKey::"+suiteKey;
try {
log.info("begin callback:" + params);
DingMiniInfoDTO dingMiniInfo = openSyncBizDataDao.getDingMiniInfo(suiteKey);
DingCallbackCrypto dingTalkEncryptor = new DingCallbackCrypto(dingMiniInfo.getToken(), dingMiniInfo.getAesKey(), suiteKey);
// 从post请求的body中获取回调信息的加密数据进行解密处理
String encrypt = body.getString("encrypt");
String plainText = dingTalkEncryptor.getDecryptMsg(signature, timestamp.toString(), nonce, encrypt);
JSONObject callBackContent = JSON.parseObject(plainText);
log.info("推来的消息体:"+plainText);
// 根据回调事件类型做不同的业务处理
String eventType = callBackContent.getString("EventType");
if (EVENT_CHECK_CREATE_SUITE_URL.equals(eventType)) {
log.info("验证新创建的回调URL有效性: " + plainText);
} else if (EVENT_CHECK_UPADTE_SUITE_URL.equals(eventType)) {
log.info("验证更新回调URL有效性: " + plainText);
} else if (EVENT_SUITE_TICKET.equals(eventType)) {
// suite_ticket用于用签名形式生成accessToken(访问钉钉服务端的凭证),需要保存到应用的db。
// 钉钉会定期向本callback url推送suite_ticket新值用以提升安全性。
// 应用在获取到新的时值时,保存db成功后,返回给钉钉success加密串(如本demo的return)
log.info("应用suite_ticket数据推送: " + plainText);
} else if (EVENT_TMP_AUTH_CODE.equals(eventType)) {
// 本事件应用应该异步进行授权开通企业的初始化,目的是尽最大努力快速返回给钉钉服务端。用以提升企业管理员开通应用体验
// 即使本接口没有收到数据或者收到事件后处理初始化失败都可以后续再用户试用应用时从前端获取到corpId并拉取授权企业信息,进而初始化开通及企业。
log.info("企业授权开通应用事件: " + plainText);
} else if (EVENT_SYNC_HTTP_PUSH_HIGH.equals(eventType)){
List<Map<String, Object>> bizData = (List<Map<String, Object>>) callBackContent.get("bizData");
if (CollectionUtils.isNotEmpty(bizData)){
List<OpenSyncBizDataEntity> list = new ArrayList<>();
bizData.forEach(b -> {
OpenSyncBizDataEntity e = new OpenSyncBizDataEntity();
e.setSuiteKey(suiteKey);
e.setSubscribeId(b.get("subscribe_id").toString());
e.setCorpId(b.get("corp_id").toString());
e.setBizId(b.get("biz_id").toString());
e.setBizData(b.get("biz_data").toString());
e.setBizType(b.get("biz_type").toString());
list.add(e);
openSyncBizDataService.delete(e);
if (e.getBizType().equals(NumConstant.TWO_STR)){
Map<String,String> ticketMap = JSON.parseObject(e.getBizData(), Map.class);
dingCallbackRedis.set(suiteKey,ticketMap.get("suiteTicket"));
}
});
openSyncBizDataService.insertBatch(list);
}
} else{
// 其他类型事件处理
}
// 返回success的加密信息表示回调处理成功
return dingTalkEncryptor.getEncryptedMap("success", timestamp, nonce);
} catch (Exception e) {
//失败的情况,应用的开发者应该通过告警感知,并干预修复
log.error("process callback fail." + params, e);
return "fail";
}
}
@PostMapping("getExemptLoginUserDetail")
public Result<Object> getExemptLoginUserDetail(@RequestBody ExemptLoginUserDetailFormDTO formDTO){
ValidatorUtils.validateEntity(formDTO, ExemptLoginUserDetailFormDTO.ExemptLoginUserDetailForm.class);
return new Result<Object>().ok(dingTalkService.getExemptLoginUserDetail(formDTO));
}
/**
* Desc: 获取钉钉小程序信息
* @param formDTO
* @author zxc
* @date 2022/9/15 10:46
*/
@PostMapping("getDingMiniInfo")
public Result<DingMiniInfoCache> getDingMiniInfo(@RequestBody DingMiniInfoFormDTO formDTO){
ValidatorUtils.validateEntity(formDTO, DingMiniInfoFormDTO.DingMiniInfoForm.class);
return new Result<DingMiniInfoCache>().ok(dingTalkService.getDingMiniInfo(formDTO));
}
}

29
epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/OpenSyncBizDataDao.java

@ -0,0 +1,29 @@
package com.epmet.dao;
import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.dto.DingMiniInfoDTO;
import com.epmet.dto.OpenSyncBizDataDTO;
import com.epmet.entity.OpenSyncBizDataEntity;
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 2022-09-14
*/
@Mapper
public interface OpenSyncBizDataDao extends BaseDao<OpenSyncBizDataEntity> {
DingMiniInfoDTO getDingMiniInfo(@Param("suiteKey")String suiteKey);
DingMiniInfoDTO getDingMiniInfoByAppId(@Param("miniAppId")String miniAppId);
Integer delOpenSyncData(OpenSyncBizDataEntity e);
List<OpenSyncBizDataDTO> getOpenSyncData(@Param("suiteKey")String suiteKey, @Param("bizType")String bizType,@Param("corpId")String corpId);
}

70
epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/entity/OpenSyncBizDataEntity.java

@ -0,0 +1,70 @@
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 2022-09-14
*/
@Data
@EqualsAndHashCode(callSuper=false)
@TableName("open_sync_biz_data")
public class OpenSyncBizDataEntity extends BaseEpmetEntity {
private static final long serialVersionUID = 1L;
/**
* 第三方企业应用的suiteid加下划线0
*/
private String subscribeId;
private String suiteKey;
/**
* 第三方企业应用的corpid
*/
private String corpId;
/**
* 第三方企业应用的suiteid
*/
private String bizId;
/**
* 数据为Json格式
*/
private String bizData;
/**
* 2第三方企业应用票据
4企业授权变更包含授权解除授权授权变更
7第三方企业应用变更包含停用启用删除(删除保留授权)
13企业用户变更包含用户添加修改删除
14企业部门变更包含部门添加修改删除
15企业角色变更包含角色添加修改删除
16企业变更包含企业修改删除
17市场订单
20企业外部联系人变更包含添加修改删除
22ISV自定义审批
25家校通讯录1.0(Deprecated)信息变更家校通讯录升级请查看家校通讯录2.0数据推送
32智能硬件绑定类型
37因订单到期或者用户退款等导致的服务关闭目前仅推送因退款等导致的服务关闭
50家校通讯录2.0部门信息变更
51家校通讯录2.0人员信息变更
63应用试用记录回调信息
66工作台组件变更回调事件
67钉钉假期相关回调事件
133CRM客户动态相关数据回调事件
137人事平台员工异动V2相关数据回调事件
139异步转译通讯录id任务完成通知
165人事平台员工档案变动事件相关数据的回调事件
175人事解决方案变更事件
*/
private String bizType;
}

46
epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/redis/DingDingCallbackRedis.java

@ -0,0 +1,46 @@
package com.epmet.redis;
import com.alibaba.fastjson.JSON;
import com.epmet.commons.tools.constant.NumConstant;
import com.epmet.commons.tools.exception.EpmetException;
import com.epmet.commons.tools.redis.RedisKeys;
import com.epmet.commons.tools.redis.RedisUtils;
import com.epmet.dao.OpenSyncBizDataDao;
import com.epmet.dto.OpenSyncBizDataDTO;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.util.List;
import java.util.Map;
/**
* @Author zxc
* @DateTime 2022/9/14 10:32
* @DESC
*/
@Component
public class DingDingCallbackRedis {
@Autowired
private RedisUtils redisUtils;
@Autowired
private OpenSyncBizDataDao openSyncBizDataDao;
public void set(String suiteKey,String suiteTicket){
String key = RedisKeys.getSuiteTicketKey(suiteKey);
redisUtils.set(key,suiteTicket,-1);
}
public String get(String suiteKey){
String ticket = redisUtils.getString(RedisKeys.getSuiteTicketKey(suiteKey));
if (StringUtils.isNotBlank(ticket)){
return ticket;
}
List<OpenSyncBizDataDTO> openSyncData = openSyncBizDataDao.getOpenSyncData(suiteKey, NumConstant.TWO_STR, null);
if (null == openSyncData){
throw new EpmetException("未查询到"+suiteKey+"的ticket");
}
Map map = JSON.parseObject(openSyncData.get(NumConstant.ZERO).getBizData(), Map.class);
return map.get("suiteTicket").toString();
}
}

24
epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/DingTalkService.java

@ -0,0 +1,24 @@
package com.epmet.service;
import com.epmet.commons.tools.dto.form.DingMiniInfoFormDTO;
import com.epmet.commons.tools.redis.common.bean.DingMiniInfoCache;
import com.epmet.dto.form.ExemptLoginUserDetailFormDTO;
/**
* @Author zxc
* @DateTime 2022/9/14 14:56
* @DESC
*/
public interface DingTalkService {
Object getExemptLoginUserDetail(ExemptLoginUserDetailFormDTO formDTO);
/**
* Desc: 获取钉钉小程序信息
* @param formDTO
* @author zxc
* @date 2022/9/15 10:46
*/
DingMiniInfoCache getDingMiniInfo(DingMiniInfoFormDTO formDTO);
}

80
epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/OpenSyncBizDataService.java

@ -0,0 +1,80 @@
package com.epmet.service;
import com.epmet.commons.mybatis.service.BaseService;
import com.epmet.commons.tools.page.PageData;
import com.epmet.dto.OpenSyncBizDataDTO;
import com.epmet.entity.OpenSyncBizDataEntity;
import java.util.List;
import java.util.Map;
/**
*
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2022-09-14
*/
public interface OpenSyncBizDataService extends BaseService<OpenSyncBizDataEntity> {
/**
* 默认分页
*
* @param params
* @return PageData<OpenSyncBizDataDTO>
* @author generator
* @date 2022-09-14
*/
PageData<OpenSyncBizDataDTO> page(Map<String, Object> params);
/**
* 默认查询
*
* @param params
* @return java.util.List<OpenSyncBizDataDTO>
* @author generator
* @date 2022-09-14
*/
List<OpenSyncBizDataDTO> list(Map<String, Object> params);
/**
* 单条查询
*
* @param id
* @return OpenSyncBizDataDTO
* @author generator
* @date 2022-09-14
*/
OpenSyncBizDataDTO get(String id);
/**
* 默认保存
*
* @param dto
* @return void
* @author generator
* @date 2022-09-14
*/
void save(OpenSyncBizDataDTO dto);
/**
* 默认更新
*
* @param dto
* @return void
* @author generator
* @date 2022-09-14
*/
void update(OpenSyncBizDataDTO dto);
/**
* 批量删除
*
* @param ids
* @return void
* @author generator
* @date 2022-09-14
*/
void delete(String[] ids);
void delete(OpenSyncBizDataEntity condition);
}

68
epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/DingTalkServiceImpl.java

@ -0,0 +1,68 @@
package com.epmet.service.impl;
import cn.hutool.core.bean.BeanUtil;
import com.aliyun.dingtalk.module.DingTalkResult;
import com.epmet.commons.tools.dto.form.DingMiniInfoFormDTO;
import com.epmet.commons.tools.redis.RedisKeys;
import com.epmet.commons.tools.redis.RedisUtils;
import com.epmet.commons.tools.redis.common.bean.DingMiniInfoCache;
import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.dao.OpenSyncBizDataDao;
import com.epmet.dto.DingMiniInfoDTO;
import com.epmet.dto.form.ExemptLoginUserDetailFormDTO;
import com.epmet.redis.DingDingCallbackRedis;
import com.epmet.service.DingTalkService;
import com.taobao.dingtalk.client.DingTalkClientToken;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import java.util.Map;
/**
* @Author zxc
* @DateTime 2022/9/14 14:57
* @DESC
*/
@Service
@Slf4j
public class DingTalkServiceImpl implements DingTalkService {
@Autowired
private DingTalkClientToken dingTalkClientToken;
@Autowired
private OpenSyncBizDataDao openSyncBizDataDao;
@Autowired
private DingDingCallbackRedis dingCallbackRedis;
@Autowired
private RedisUtils redisUtils;
@Override
public Object getExemptLoginUserDetail(ExemptLoginUserDetailFormDTO formDTO) {
DingMiniInfoDTO dingMiniInfo = openSyncBizDataDao.getDingMiniInfoByAppId(formDTO.getMiniAppId());
DingTalkResult<String> exemptLoginUserDetail = dingTalkClientToken.getExemptLoginUserDetail(formDTO.getCorpId(), dingMiniInfo.getSuiteKey(), dingMiniInfo.getSuiteSecret(), dingCallbackRedis.get(dingMiniInfo.getSuiteKey()), formDTO.getCode());
return exemptLoginUserDetail.getData();
}
/**
* Desc: 获取钉钉小程序信息
* @param formDTO
* @author zxc
* @date 2022/9/15 10:46
*/
@Override
public DingMiniInfoCache getDingMiniInfo(DingMiniInfoFormDTO formDTO) {
String key = RedisKeys.getDingMiniInfoKey(formDTO.getMiniAppId());
Map<String, Object> dingMiniInfoMap = redisUtils.hGetAll(key);
if (!CollectionUtils.isEmpty(dingMiniInfoMap)) {
return ConvertUtils.mapToEntity(dingMiniInfoMap,DingMiniInfoCache.class);
}
DingMiniInfoDTO dingMiniInfo = openSyncBizDataDao.getDingMiniInfoByAppId(formDTO.getMiniAppId());
if (null != dingMiniInfo){
redisUtils.hMSet(key, BeanUtil.beanToMap(dingMiniInfo));
return ConvertUtils.sourceToTarget(dingMiniInfo,DingMiniInfoCache.class);
}
return null;
}
}

88
epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/OpenSyncBizDataServiceImpl.java

@ -0,0 +1,88 @@
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.OpenSyncBizDataDao;
import com.epmet.dto.OpenSyncBizDataDTO;
import com.epmet.entity.OpenSyncBizDataEntity;
import com.epmet.service.OpenSyncBizDataService;
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 2022-09-14
*/
@Service
public class OpenSyncBizDataServiceImpl extends BaseServiceImpl<OpenSyncBizDataDao, OpenSyncBizDataEntity> implements OpenSyncBizDataService {
@Override
public PageData<OpenSyncBizDataDTO> page(Map<String, Object> params) {
IPage<OpenSyncBizDataEntity> page = baseDao.selectPage(
getPage(params, FieldConstant.CREATED_TIME, false),
getWrapper(params)
);
return getPageData(page, OpenSyncBizDataDTO.class);
}
@Override
public List<OpenSyncBizDataDTO> list(Map<String, Object> params) {
List<OpenSyncBizDataEntity> entityList = baseDao.selectList(getWrapper(params));
return ConvertUtils.sourceToTarget(entityList, OpenSyncBizDataDTO.class);
}
private QueryWrapper<OpenSyncBizDataEntity> getWrapper(Map<String, Object> params){
String id = (String)params.get(FieldConstant.ID_HUMP);
QueryWrapper<OpenSyncBizDataEntity> wrapper = new QueryWrapper<>();
wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id);
return wrapper;
}
@Override
public OpenSyncBizDataDTO get(String id) {
OpenSyncBizDataEntity entity = baseDao.selectById(id);
return ConvertUtils.sourceToTarget(entity, OpenSyncBizDataDTO.class);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void save(OpenSyncBizDataDTO dto) {
OpenSyncBizDataEntity entity = ConvertUtils.sourceToTarget(dto, OpenSyncBizDataEntity.class);
insert(entity);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void update(OpenSyncBizDataDTO dto) {
OpenSyncBizDataEntity entity = ConvertUtils.sourceToTarget(dto, OpenSyncBizDataEntity.class);
updateById(entity);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void delete(String[] ids) {
// 逻辑删除(@TableLogic 注解)
baseDao.deleteBatchIds(Arrays.asList(ids));
}
@Override
@Transactional(rollbackFor = Exception.class)
public void delete(OpenSyncBizDataEntity condition) {
baseDao.delOpenSyncData(condition);
}
}

3
epmet-module/epmet-third/epmet-third-server/src/main/resources/bootstrap.yml

@ -146,6 +146,9 @@ third:
- https://epmet-ext10.elinkservice.cn
dingTalk:
appKey: dingo53zvltapzrstzbo
appsecret: o1hjFvWKwLG1GIuivX0nbynqFvFDZiI3CoqLyhdZXhghXMEsr34LKCud0Rz2Hd16
agentid: 1880131092
robot:
webHook: @dingTalk.robot.webHook@
secret: @dingTalk.robot.secret@

51
epmet-module/epmet-third/epmet-third-server/src/main/resources/db/migration/V0.0.14__add_ding_table.sql

@ -0,0 +1,51 @@
CREATE TABLE `ding_mini_info` (
`ID` varchar(64) NOT NULL COMMENT 'ID',
`SUITE_ID` varchar(255) NOT NULL,
`APP_ID` varchar(255) NOT NULL,
`MINI_APP_ID` varchar(255) NOT NULL,
`SUITE_NAME` varchar(255) NOT NULL,
`SUITE_KEY` varchar(255) NOT NULL,
`SUITE_SECRET` varchar(255) NOT NULL,
`TOKEN` varchar(255) NOT NULL,
`AES_KEY` varchar(255) DEFAULT NULL,
`DEL_FLAG` int(11) NOT NULL,
`REVISION` int(11) NOT NULL COMMENT '乐观锁',
`CREATED_BY` varchar(32) NOT NULL COMMENT '创建人',
`CREATED_TIME` datetime NOT NULL COMMENT '创建时间',
`UPDATED_BY` varchar(32) NOT NULL COMMENT '更新人',
`UPDATED_TIME` datetime NOT NULL COMMENT '更新时间',
PRIMARY KEY (`ID`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='钉钉小程序信息';
INSERT INTO `epmet_third`.`ding_mini_info` (`ID`, `SUITE_ID`, `APP_ID`, `MINI_APP_ID`, `SUITE_NAME`, `SUITE_KEY`, `SUITE_SECRET`, `TOKEN`, `AES_KEY`, `DEL_FLAG`, `REVISION`, `CREATED_BY`, `CREATED_TIME`, `UPDATED_BY`, `UPDATED_TIME`) VALUES ('1', '1903117866', '119453', '5000000003010492', '随时讲', 'suiter5nqmiwzwq4lodee', 'hHKnno_nGouRjB5LVFn0k11O20CCEhf9gaiErLNN0lKUExe5VzZrB8tN9hdRrhPA', '', '', 0, 0, '授权给亿联科技', '2022-09-14 11:11:13', '授权给亿联科技', '2022-09-14 11:11:13');
INSERT INTO `epmet_third`.`ding_mini_info` (`ID`, `SUITE_ID`, `APP_ID`, `MINI_APP_ID`, `SUITE_NAME`, `SUITE_KEY`, `SUITE_SECRET`, `TOKEN`, `AES_KEY`, `DEL_FLAG`, `REVISION`, `CREATED_BY`, `CREATED_TIME`, `UPDATED_BY`, `UPDATED_TIME`) VALUES ('1001', '1905492491', '', '5000000003022462', '随手拍', 'dingu6fdnlcqbyr1fdxu', 'r-Fi8awDyD5rBCPS1NnoBEqkrq0InheNMkc0xAOKvkD0-47oDFiClbJRiFQy-JO1', '', NULL, 0, 0, '烟台企业内部应用', '2022-09-22 16:54:09', '烟台企业内部应用', '2022-09-22 16:54:16');
INSERT INTO `epmet_third`.`ding_mini_info` (`ID`, `SUITE_ID`, `APP_ID`, `MINI_APP_ID`, `SUITE_NAME`, `SUITE_KEY`, `SUITE_SECRET`, `TOKEN`, `AES_KEY`, `DEL_FLAG`, `REVISION`, `CREATED_BY`, `CREATED_TIME`, `UPDATED_BY`, `UPDATED_TIME`) VALUES ('1002', '1905441943', '', '5000000003021766', '随时讲', 'dinguizzwnfnvjs6nntz', 'uUqJYGyoOjOBcc1bC5jCD2lipOaUxbrdZyeXSWKq1JfX7tWQYNz6ZfvvybWBENKS', '', NULL, 0, 0, '烟台企业内部应用', '2022-09-22 16:55:25', '烟台企业内部应用', '2022-09-22 16:55:28');
INSERT INTO `epmet_third`.`ding_mini_info` (`ID`, `SUITE_ID`, `APP_ID`, `MINI_APP_ID`, `SUITE_NAME`, `SUITE_KEY`, `SUITE_SECRET`, `TOKEN`, `AES_KEY`, `DEL_FLAG`, `REVISION`, `CREATED_BY`, `CREATED_TIME`, `UPDATED_BY`, `UPDATED_TIME`) VALUES ('1003', '1905455843', '', '5000000003022737', '我的报事', 'dingllzzs6g8u7htteg5', 'fjTJe31Ot4FylmO_hWY-aRckikdPKA2u640GjiW68R4JItFG8picnwFd8d9gLFm_', '', NULL, 0, 0, '烟台企业内部应用', '2022-09-22 16:56:29', '烟台企业内部应用', '2022-09-22 16:56:37');
INSERT INTO `epmet_third`.`ding_mini_info` (`ID`, `SUITE_ID`, `APP_ID`, `MINI_APP_ID`, `SUITE_NAME`, `SUITE_KEY`, `SUITE_SECRET`, `TOKEN`, `AES_KEY`, `DEL_FLAG`, `REVISION`, `CREATED_BY`, `CREATED_TIME`, `UPDATED_BY`, `UPDATED_TIME`) VALUES ('1004', '1905486539', '', '5000000003022522', '实时动态', 'dingf8hpd485mlgaov7c', 'CmUSLH-M-tDgpwRTmiAXf9p3v-hLZ27J1kscxUg3118EKX4mV-JLJ073PMxC6We1', '', NULL, 0, 0, '烟台企业内部应用', '2022-09-22 16:57:21', '烟台企业内部应用', '2022-09-22 16:57:24');
INSERT INTO `epmet_third`.`ding_mini_info` (`ID`, `SUITE_ID`, `APP_ID`, `MINI_APP_ID`, `SUITE_NAME`, `SUITE_KEY`, `SUITE_SECRET`, `TOKEN`, `AES_KEY`, `DEL_FLAG`, `REVISION`, `CREATED_BY`, `CREATED_TIME`, `UPDATED_BY`, `UPDATED_TIME`) VALUES ('2', '1903003033', '', '5000000003009021', '随手拍', 'suite44k7hacfbfx4zazi', 'EtamucmdHdQMe5nM7YW0qwn2b3m6UJXEk3JAr3ICoisZdZdcIBXsFI1uUHf9xUrl', '', '', 0, 0, '授权给亿联科技', '2022-09-14 11:11:13', '授权给亿联科技', '2022-09-14 11:11:13');
INSERT INTO `epmet_third`.`ding_mini_info` (`ID`, `SUITE_ID`, `APP_ID`, `MINI_APP_ID`, `SUITE_NAME`, `SUITE_KEY`, `SUITE_SECRET`, `TOKEN`, `AES_KEY`, `DEL_FLAG`, `REVISION`, `CREATED_BY`, `CREATED_TIME`, `UPDATED_BY`, `UPDATED_TIME`) VALUES ('27805834197073948', '27501006', '119450', '5000000002934668', '随手拍', 'suitew6ccvkquinmrghqy', 'TooAxiegdsE5BPP6xo1AxK1LdmaUoMpPMyomOcGcBSXtnsxRc8dEfyOlG56oSmEB', 'qN6Mg1XljdeHzVg2KeZGmBgY5', 'CzBxlN3uVCo6S3AzB8gfkUMBQxYsrRUdXRqX4XcYcyw', 0, 0, '亿联第三方企业应用', '2022-09-14 11:09:15', '亿联第三方企业应用', '2022-09-14 11:09:15');
INSERT INTO `epmet_third`.`ding_mini_info` (`ID`, `SUITE_ID`, `APP_ID`, `MINI_APP_ID`, `SUITE_NAME`, `SUITE_KEY`, `SUITE_SECRET`, `TOKEN`, `AES_KEY`, `DEL_FLAG`, `REVISION`, `CREATED_BY`, `CREATED_TIME`, `UPDATED_BY`, `UPDATED_TIME`) VALUES ('27805834197073949', '27501007', '119451', '5000000002934374', '随时讲', 'suitezhyj12glsrp8em0f', '-z5Q_lvMP6l7fTzlArEzUT8D_-5pvqBQaJMuTGHoXnz0nuiqGQMZ8aeya_cxTsN-', 'rKs2lIN1Oe6K34AtASGOQDh', 'a7hsIIHVTiIB7SQwOiGNgxVo7zAigGUk4InTUNIikWy', 0, 0, '亿联第三方企业应用', '2022-09-14 11:11:13', '亿联第三方企业应用', '2022-09-14 11:11:13');
INSERT INTO `epmet_third`.`ding_mini_info` (`ID`, `SUITE_ID`, `APP_ID`, `MINI_APP_ID`, `SUITE_NAME`, `SUITE_KEY`, `SUITE_SECRET`, `TOKEN`, `AES_KEY`, `DEL_FLAG`, `REVISION`, `CREATED_BY`, `CREATED_TIME`, `UPDATED_BY`, `UPDATED_TIME`) VALUES ('27805834197073950', '27501008', '119452', '5000000002934456', '我的报事', 'suite5yxliro6wawv514w', 'aQxiPi7DwJSUa9HlbUU_L7Q4wGCLEDmgf__Ffx75cTn3jZwuHy9vdl-9Iv5FeyJU', 'vTUvaf6QtOJZsa1h7Wkoteo', 'csRpvVFGL7Cf1N9ubajix8tDWhCllROhaxCHKFnbuAz', 0, 0, '亿联第三方企业应用', '2022-09-14 11:11:13', '亿联第三方企业应用', '2022-09-14 11:11:13');
INSERT INTO `epmet_third`.`ding_mini_info` (`ID`, `SUITE_ID`, `APP_ID`, `MINI_APP_ID`, `SUITE_NAME`, `SUITE_KEY`, `SUITE_SECRET`, `TOKEN`, `AES_KEY`, `DEL_FLAG`, `REVISION`, `CREATED_BY`, `CREATED_TIME`, `UPDATED_BY`, `UPDATED_TIME`) VALUES ('27805834197073951', '27501009', '119453', '5000000002934488', '实时动态', 'suitemcestnonr6y0xigc', 'kKCNCkfDhmLoVnl_wuAiScyDG4776mkTevuSBuiYhHg-Bvz1-vhb_4IA-Km7nK2I', 'MvWLkZGbC', 'iSVLw69AeNXS8jgGefTG2ulkKWDQjcSsMBgkFMgfPuB', 0, 0, '亿联第三方企业应用', '2022-09-14 11:11:13', '亿联第三方企业应用', '2022-09-14 11:11:13');
INSERT INTO `epmet_third`.`ding_mini_info` (`ID`, `SUITE_ID`, `APP_ID`, `MINI_APP_ID`, `SUITE_NAME`, `SUITE_KEY`, `SUITE_SECRET`, `TOKEN`, `AES_KEY`, `DEL_FLAG`, `REVISION`, `CREATED_BY`, `CREATED_TIME`, `UPDATED_BY`, `UPDATED_TIME`) VALUES ('3', '1903155647', '', '5000000003010470', '我的报事', 'suitedwccu2wbepxvdebi', 'OHbAMPBzPWnTL-VqPuJ4ngnwBGLVoxKkkl12uY1CPvIhfX0NqcNJMGl21gQqNpd2', '', '', 0, 0, '授权给亿联科技', '2022-09-14 11:11:13', '授权给亿联科技', '2022-09-14 11:11:13');
INSERT INTO `epmet_third`.`ding_mini_info` (`ID`, `SUITE_ID`, `APP_ID`, `MINI_APP_ID`, `SUITE_NAME`, `SUITE_KEY`, `SUITE_SECRET`, `TOKEN`, `AES_KEY`, `DEL_FLAG`, `REVISION`, `CREATED_BY`, `CREATED_TIME`, `UPDATED_BY`, `UPDATED_TIME`) VALUES ('4', '1903147702', '', '5000000003010661', '实时动态', 'suitekcbekxzjnlrlgft2', 'fMKaF1UsORAftH7LdqR-CpHOCLzA56Q8S5WN6fRAOAI7E7T-p-96SspOyc-8CdnO', '', '', 0, 0, '授权给亿联科技', '2022-09-14 11:11:13', '授权给亿联科技', '2022-09-14 11:11:13');
CREATE TABLE `open_sync_biz_data`
(
`ID` varchar(255) NOT NULL,
`SUITE_KEY` varchar(255) DEFAULT NULL,
`SUBSCRIBE_ID` varchar(255) NOT NULL COMMENT '第三方企业应用的suiteid加下划线0',
`CORP_ID` varchar(255) NOT NULL COMMENT '第三方企业应用的corpid',
`BIZ_ID` varchar(255) NOT NULL COMMENT '第三方企业应用的suiteid',
`BIZ_DATA` json NOT NULL COMMENT '数据为Json格式',
`BIZ_TYPE` varchar(10) NOT NULL COMMENT '2:第三方企业应用票据;\n4:企业授权变更,包含授权、解除授权、授权变更;\n7:第三方企业应用变更,包含停用、启用、删除(删除保留授权);\n13:企业用户变更,包含用户添加、修改、删除;\n14:企业部门变更,包含部门添加、修改、删除;\n15:企业角色变更,包含角色添加、修改、删除;\n16:企业变更,包含企业修改、删除;\n17:市场订单;\n20:企业外部联系人变更,包含添加、修改、删除;\n22:ISV自定义审批;\n25:家校通讯录1.0(Deprecated)信息变更。家校通讯录升级,请查看家校通讯录2.0数据推送;\n32:智能硬件绑定类型;\n37:因订单到期或者用户退款等导致的服务关闭,目前仅推送因退款等导致的服务关闭;\n50:家校通讯录2.0,部门信息变更;\n51:家校通讯录2.0,人员信息变更;\n63:应用试用记录回调信息;\n66:工作台组件变更回调事件;\n67:钉钉假期相关回调事件;\n133:CRM客户动态相关数据回调事件;\n137:人事平台员工异动V2相关数据回调事件;\n139:异步转译通讯录id任务完成通知;\n165:人事平台员工档案变动事件相关数据的回调事件;\n175:人事解决方案变更事件;',
`DEL_FLAG` int(1) NOT NULL,
`REVISION` int(1) NOT NULL,
`CREATED_TIME` datetime NOT NULL,
`CREATED_BY` varchar(255) NOT NULL,
`UPDATED_TIME` datetime NOT NULL,
`UPDATED_BY` varchar(255) NOT NULL,
PRIMARY KEY (`ID`) USING BTREE
) ENGINE = InnoDB
DEFAULT CHARSET = utf8mb4;

3
epmet-module/epmet-third/epmet-third-server/src/main/resources/db/migration/V0.0.15__other3app.sql

@ -0,0 +1,3 @@
INSERT INTO `epmet_third`.`ding_mini_info` (`ID`, `SUITE_ID`, `APP_ID`, `MINI_APP_ID`, `SUITE_NAME`, `SUITE_KEY`, `SUITE_SECRET`, `TOKEN`, `AES_KEY`, `DEL_FLAG`, `REVISION`, `CREATED_BY`, `CREATED_TIME`, `UPDATED_BY`, `UPDATED_TIME`) VALUES ('1005', '1912268145', '', '5000000003054196', '信息登记', 'dingtbmsztg41nmbclzi', '6mdIbt8xWkKOkGasxqQt44uNEri-KQWSmMX1u7weTMEuoGWwQsoYSyc0hBeoQGEj', '', NULL, 0, 0, '烟台企业内部应用', '2022-09-26 14:03:32', '烟台企业内部应用', '2022-09-26 14:03:40');
INSERT INTO `epmet_third`.`ding_mini_info` (`ID`, `SUITE_ID`, `APP_ID`, `MINI_APP_ID`, `SUITE_NAME`, `SUITE_KEY`, `SUITE_SECRET`, `TOKEN`, `AES_KEY`, `DEL_FLAG`, `REVISION`, `CREATED_BY`, `CREATED_TIME`, `UPDATED_BY`, `UPDATED_TIME`) VALUES ('1006', '1912172899', '', '5000000003054651', '疫情防控', 'dingye4npkwn5l8gate0', 'iOqq_5nURdTr-69DKukTfpzmkJIN5UBCQNlOdB-g6PucCC2UG-wrXmyC2XEylkuE', '', NULL, 0, 0, '烟台企业内部应用', '2022-09-26 14:04:39', '烟台企业内部应用', '2022-09-26 14:04:46');
INSERT INTO `epmet_third`.`ding_mini_info` (`ID`, `SUITE_ID`, `APP_ID`, `MINI_APP_ID`, `SUITE_NAME`, `SUITE_KEY`, `SUITE_SECRET`, `TOKEN`, `AES_KEY`, `DEL_FLAG`, `REVISION`, `CREATED_BY`, `CREATED_TIME`, `UPDATED_BY`, `UPDATED_TIME`) VALUES ('1007', '1912176853', '', '5000000003054757', '议事厅', 'ding56hee9xi5kxlmpbp', 'Y16WoB0qD0k8N7NY2J7HLyHGGAkhlBj9Bxkpa1cFuUUrTZlH2SfLvP4ZYnsvxC7f', '', NULL, 0, 0, '烟台企业内部应用', '2022-09-26 14:05:40', '烟台企业内部应用', '2022-09-26 14:05:43');

4
epmet-module/epmet-third/epmet-third-server/src/main/resources/db/migration/V0.0.16__shenli4app.sql

@ -0,0 +1,4 @@
INSERT INTO `epmet_third`.`ding_mini_info` (`ID`, `SUITE_ID`, `APP_ID`, `MINI_APP_ID`, `SUITE_NAME`, `SUITE_KEY`, `SUITE_SECRET`, `TOKEN`, `AES_KEY`, `DEL_FLAG`, `REVISION`, `CREATED_BY`, `CREATED_TIME`, `UPDATED_BY`, `UPDATED_TIME`) VALUES ('1008', '1914273833', '', '5000000003069546', '随手拍', 'dingpvk106h0eca7btlm', 'zLF8ld6pF40NLUxC2aRKP7yfXreRpSRJTCN48_kyAQtretSLBfSpFMX6prUOaH_Z', '', NULL, 0, 0, '烟台企业内部应用_慎礼社区', '2022-09-27 13:03:32', '烟台企业内部应用_慎礼社区', '2022-09-27 13:03:40');
INSERT INTO `epmet_third`.`ding_mini_info` (`ID`, `SUITE_ID`, `APP_ID`, `MINI_APP_ID`, `SUITE_NAME`, `SUITE_KEY`, `SUITE_SECRET`, `TOKEN`, `AES_KEY`, `DEL_FLAG`, `REVISION`, `CREATED_BY`, `CREATED_TIME`, `UPDATED_BY`, `UPDATED_TIME`) VALUES ('1009', '1914301613', '', '5000000003069487', '随时讲', 'ding1ept2iaynjxu2w6o', 'xSXSennTbJG8nc-IjjsrG1zEugNoCp2rLhT7pS0vInT7OnPZ5FgY3974aR9D-xd2', '', NULL, 0, 0, '烟台企业内部应用_慎礼社区', '2022-09-27 13:03:32', '烟台企业内部应用_慎礼社区', '2022-09-27 13:03:40');
INSERT INTO `epmet_third`.`ding_mini_info` (`ID`, `SUITE_ID`, `APP_ID`, `MINI_APP_ID`, `SUITE_NAME`, `SUITE_KEY`, `SUITE_SECRET`, `TOKEN`, `AES_KEY`, `DEL_FLAG`, `REVISION`, `CREATED_BY`, `CREATED_TIME`, `UPDATED_BY`, `UPDATED_TIME`) VALUES ('1010', '1914266905', '', '5000000003069391', '我的报事', 'dingpzsyljcsbu3fbac5', 'fWRzS2W59fwx__istOF23mHq1S0hAs64nZhcmljrSLLMYrceZVsz7GhgG4izZvhy', '', NULL, 0, 0, '烟台企业内部应用_慎礼社区', '2022-09-27 13:03:32', '烟台企业内部应用_慎礼社区', '2022-09-27 13:03:40');
INSERT INTO `epmet_third`.`ding_mini_info` (`ID`, `SUITE_ID`, `APP_ID`, `MINI_APP_ID`, `SUITE_NAME`, `SUITE_KEY`, `SUITE_SECRET`, `TOKEN`, `AES_KEY`, `DEL_FLAG`, `REVISION`, `CREATED_BY`, `CREATED_TIME`, `UPDATED_BY`, `UPDATED_TIME`) VALUES ('1011', '1914338340', '', '5000000003069669', '实时动态', 'dingflbhlrd1epy11irl', '47OE8jNuSj-JoOPBx7ZCqEii4fycnWtY2x97ndu3Mk2BOh9ElKMNuOGNU0zzshVn', '', NULL, 0, 0, '烟台企业内部应用_慎礼社区', '2022-09-27 13:03:32', '烟台企业内部应用_慎礼社区', '2022-09-27 13:03:40');

2
epmet-module/epmet-third/epmet-third-server/src/main/resources/logback-spring.xml

@ -145,6 +145,7 @@
<logger name="org.springboot.sample" level="INFO"/>
<logger name="com.epmet.dao" level="INFO"/>
<logger name="com.epmet.dao" level="DEBUG"/>
<logger name="com.taobao" level="DEBUG"/>
<root level="INFO">
<appender-ref ref="DEBUG_FILE"/>
<appender-ref ref="INFO_FILE"/>
@ -158,6 +159,7 @@
<logger name="org.springframework.web" level="INFO"/>
<logger name="org.springboot.sample" level="INFO"/>
<logger name="com.epmet.dao" level="INFO"/>
<logger name="com.taobao" level="DEBUG"/>
<root level="INFO">
<appender-ref ref="CONSOLE"/>
<appender-ref ref="DEBUG_FILE"/>

30
epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/OpenSyncBizDataDao.xml

@ -0,0 +1,30 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.epmet.dao.OpenSyncBizDataDao">
<delete id="delOpenSyncData">
DELETE
FROM open_sync_biz_data
WHERE biz_id = #{bizId}
AND biz_type = #{bizType}
AND subscribe_id = #{subscribeId}
AND corp_id = #{corpId}
AND DEL_FLAG = 0
</delete>
<select id="getDingMiniInfo" resultType="com.epmet.dto.DingMiniInfoDTO">
select * from ding_mini_info where del_flag = 0 and suite_key = #{suiteKey}
</select>
<select id="getDingMiniInfoByAppId" resultType="com.epmet.dto.DingMiniInfoDTO">
select * from ding_mini_info where del_flag = 0 and mini_app_id = #{miniAppId}
</select>
<select id="getOpenSyncData" resultType="com.epmet.dto.OpenSyncBizDataDTO">
select * FROM open_sync_biz_data
where del_flag = 0
and biz_type = #{bizType}
and suite_key = #{suiteKey}
<if test='null != corpId and corpId != "" '>
and corp_id = #{corpId}
</if>
</select>
</mapper>

30
epmet-module/epmet-third/epmet-third-server/src/main/test/java/com/epmet/ThirdPlatformTest.java

@ -0,0 +1,30 @@
package com.epmet;
import com.alibaba.fastjson.JSON;
import com.aliyun.dingtalk.module.DingTalkResult;
import com.taobao.dingtalk.client.DingTalkClientToken;
import lombok.extern.slf4j.Slf4j;
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;
/**
* descredisson测试类
*/
@Slf4j
@RunWith(value = SpringRunner.class)
@SpringBootTest(classes = {EpmetThirdApplication.class})
public class ThirdPlatformTest {
@Autowired
DingTalkClientToken dingTalkClientToken;
@Test
public void sendText(){
DingTalkResult<String> appAccessTokenToken = dingTalkClientToken.getAppAccessTokenToken();
System.out.println("=======:"+JSON.toJSONString(appAccessTokenToken));
}
}

4
epmet-module/gov-access/gov-access-client/src/main/java/com/epmet/dto/GovMenuDTO.java

@ -65,6 +65,10 @@ public class GovMenuDTO extends TreeStringNode<GovMenuDTO> implements Serializab
* 菜单图标
*/
private String icon;
/**
* 菜单颜色
*/
private String color;
/**
* 权限标识sys:menu:save

5
epmet-module/gov-access/gov-access-client/src/main/java/com/epmet/dto/result/OftenUseFunctionListResultDTO.java

@ -38,4 +38,9 @@ public class OftenUseFunctionListResultDTO implements Serializable {
* 排序
*/
private String sort;
/**
* 菜单颜色
*/
private String color;
}

4
epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/entity/GovMenuEntity.java

@ -47,6 +47,10 @@ public class GovMenuEntity extends BaseEpmetEntity {
* 菜单图标
*/
private String icon;
/**
* 菜单颜色
*/
private String color;
/**
* 权限标识sys:menu:save
*/

2
epmet-module/gov-access/gov-access-server/src/main/resources/db/migration/V0.0.9__alter_menu_color.sql

@ -0,0 +1,2 @@
ALTER TABLE `epmet_gov_access`.`gov_menu`
ADD COLUMN `color` varchar(16) DEFAULT '' COMMENT '菜单颜色' AFTER `icon`;

5
epmet-module/gov-access/gov-access-server/src/main/resources/mapper/IcOftenUseFunctionDao.xml

@ -15,7 +15,8 @@
ic.MENU_ID,
gm.url,
gm.icon,
gl.field_value AS menuName
gl.field_value AS menuName,
gm.color
FROM ic_often_use_function ic
INNER JOIN gov_customer_menu gc ON (gc.TABLE_ID = ic.MENU_ID AND gc.DEL_FLAG = '0' AND ic.CUSTOMER_ID = gc.CUSTOMER_ID)
INNER JOIN gov_menu gm ON (gc.TABLE_ID = gm.id AND gm.DEL_FLAG = 0 AND gm.SHOW_FLAG = 1)
@ -24,4 +25,4 @@
AND ic.USER_ID = #{userId}
ORDER BY ic.SORT
</select>
</mapper>
</mapper>

87
epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/AddStaffPyFromDTO.java

@ -0,0 +1,87 @@
package com.epmet.dto.form;
import com.epmet.commons.tools.validator.group.CustomerClientShowGroup;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.hibernate.validator.constraints.Length;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Pattern;
import java.io.Serializable;
import java.util.List;
/**
* @author sun
* @dscription
*/
@NoArgsConstructor
@Data
public class AddStaffPyFromDTO implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 新增人员所属类型Id
*/
private String orgId;
/**
* 客户ID
*/
private String customerId;
/**
* 新增人员所属类型组织:agency;部门:dept;网格:grid
*/
private String orgType;
/**
* 姓名
*/
@NotBlank(message = "姓名不能为空", groups = AddStaffPyFromDTO.AddStaff.class)
@Length(max = 15, message = "姓名仅允许输入15个字符", groups = AddStaffPyFromDTO.AddStaff.class)
private String name;
/**
* 人员ID
*/
private String staffId;
/**
* 手机
*/
@NotBlank(message = "手机号不能为空", groups = AddStaffPyFromDTO.AddStaff.class)
@Pattern(regexp = "^[1][3,4,5,6,7,8,9][0-9]{9}$", message = "请输入正确的手机号", groups = AddStaffPyFromDTO.AddStaff.class)
private String mobile;
/**
* 性别
*/
@NotNull(message = "性别不能为空", groups = AddStaffPyFromDTO.AddStaff.class)
private Integer gender;
/**
* 专兼职
*/
@NotBlank(message = "专兼职不能为空", groups = AddStaffPyFromDTO.AddStaff.class)
private String workType;
/**
* 账户
*/
@NotBlank(message = "账号不能为空", groups = AddStaffPyFromDTO.AddStaff.class)
private String userAccount;
/**
* 密码
*/
@NotBlank(message = "密码不能为空", groups = AddStaffPyFromDTO.AddStaff.class)
private String pwd;
/**
* 角色id列表
*/
@NotNull(message = "角色不能为空", groups = AddStaffPyFromDTO.AddStaff.class)
private List<String> roles;
public interface AddStaff extends CustomerClientShowGroup {}
/**
* 来源app(政府端:gov居民端:resi运营端:oper)
*/
private String app;
/**
* 来源client(PC端:web微信小程序:wxmp)
*/
private String client;
}

82
epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/StaffSubmitAccountFromDTO.java

@ -0,0 +1,82 @@
package com.epmet.dto.form;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.hibernate.validator.constraints.Length;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Pattern;
import java.io.Serializable;
import java.util.List;
/**
* @author zhy
* @dscription
* @date 2020/4/24 10:43
*/
@NoArgsConstructor
@Data
public class StaffSubmitAccountFromDTO implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 客户ID
*/
private String customerId;
/**
* 机关ID
*/
private String agencyId;
/**
* 人员ID
*/
private String staffId;
/**
* 姓名
*/
@NotBlank(message = "姓名不能为空")
@Length(max = 15, message = "姓名仅允许输入15个字符")
private String name;
/**
* 手机
*/
@NotBlank(message = "手机号不能为空")
@Pattern(regexp = "^[1][3,4,5,6,7,8,9][0-9]{9}$", message = "请输入正确的手机号")
private String mobile;
/**
* 性别
*/
@NotNull(message = "性别不能为空")
private Integer gender;
/**
* 性别
*/
@NotNull(message = "账号不能为空")
private String userAccount;
/**
* 密码
*/
private String pwd;
/**
* 专兼职
*/
@NotBlank(message = "专兼职不能为空")
private String workType;
/**
* 角色id列表
*/
@NotNull(message = "角色不能为空")
private List<String> roles;
/**
* 来源app(政府端:gov居民端:resi运营端:oper)
*/
private String app;
/**
* 来源client(PC端:web微信小程序:wxmp)
*/
private String client;
/**
* 身份证号
*/
private String idCard;
}

4
epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/IcBulidingDetailDTO.java

@ -57,6 +57,10 @@ public class IcBulidingDetailDTO implements Serializable {
*/
private String type;
/**
* --楼栋类型1商品房2自建房3别墅
*/
private String typeName;
/**
* 排序

111
epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/IcNeighborHoodDetailDTO.java

@ -0,0 +1,111 @@
package com.epmet.dto.result;
import com.epmet.dto.IcPropertyManagementDTO;
import lombok.Data;
import java.util.List;
/**
* @Description
* @Author yzm
* @Date 2022/9/21 9:19
*/
@Data
public class IcNeighborHoodDetailDTO {
private String id;
/**
* 客户id
*/
private String customerId;
/**
* 小区名称
*/
private String neighborHoodName;
/**
* 组织id
*/
private String agencyId;
/**
* 组织名称--新版详情页面用于显示
*/
private String agencyName;
/**
* 上级组织id
*/
private String parentAgencyId;
/**
* 组织的所有上级组织id
*/
private String agencyPids;
/**
* 网格id
*/
private String gridId;
/**
* 详细地址
*/
private String address;
/**
* 备注
*/
private String remark;
/**
* 中心点位经度
*/
private String longitude;
/**
* 中心点位纬度
*/
private String latitude;
/**
* 坐标区域
*/
private String coordinates;
/**
* 坐标位置
*/
private String location;
/**
* 网格名称--新版详情页面用于显示
*/
private String gridName;
/**
* 物业名称--新版详情页面用于显示
*/
private List<IcPropertyManagementDTO> propertyList;
/**
* 小区编码
*/
private String coding;
/**
* 小区系统编码
*/
private String sysCoding;
/**
* 实有楼栋数
*/
private Integer realBuilding;
/**
* 二维码地址
*/
private String qrcodeUrl;
}

8
epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/StaffInitResultDTO.java

@ -25,6 +25,10 @@ public class StaffInitResultDTO implements Serializable {
* 手机号
*/
private String mobile;
/**
* 手机号
*/
private String userAccount;
/**
* 性别
*/
@ -33,6 +37,10 @@ public class StaffInitResultDTO implements Serializable {
* 专兼职
*/
private String workType;
/**
* 身份证号
*/
private String idCard;
/**
* 职责列表
*/

3
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/HouseInformationController.java

@ -23,7 +23,6 @@ import com.epmet.commons.tools.security.dto.TokenDto;
import com.epmet.commons.tools.utils.Result;
import com.epmet.dto.form.HouseInformationFormDTO;
import com.epmet.dto.result.*;
import com.epmet.entity.IcNeighborHoodEntity;
import com.epmet.service.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
@ -64,7 +63,7 @@ public class HouseInformationController {
* @return com.epmet.commons.tools.utils.Result<com.epmet.dto.IcNeighborHoodDTO>
*/
@PostMapping("neighborhoodDetail/{neighborhoodId}")
public Result<IcNeighborHoodEntity> neighborhoodDetail(@PathVariable("neighborhoodId") String neighborhoodId){
public Result<IcNeighborHoodDetailDTO> neighborhoodDetail(@PathVariable("neighborhoodId") String neighborhoodId){
return icNeighborHoodService.neighborhoodDetail(neighborhoodId);
}

27
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/StaffController.java

@ -101,6 +101,19 @@ public class StaffController {
return staffService.editStaff(tokenDto, fromDTO);
}
/**
* 人员编辑
*
* @param fromDTO 参数
* @return Result
*/
@PostMapping("editstaffpy")
@RequirePermission(requirePermission = RequirePermissionEnum.ORG_STAFF_UPDATE)
public Result editStaffPy(@LoginUser TokenDto tokenDto, @RequestBody StaffSubmitAccountFromDTO fromDTO){
ValidatorUtils.validateEntity(fromDTO);
return staffService.editStaffByAccount(tokenDto, fromDTO);
}
/**
* 人员详情
*
@ -195,6 +208,20 @@ public class StaffController {
return staffService.addStaffV2(fromDTO);
}
/**
* 通讯录人员添加-平阴
* @author zhy
*/
@PostMapping("addstaffpy")
@RequirePermission(requirePermission = RequirePermissionEnum.ORG_STAFF_CREATE)
public Result addStaffPy(@RequestBody StaffSubmitAccountFromDTO fromDTO){
fromDTO.setApp("gov");
fromDTO.setClient("wxmp");
ValidatorUtils.validateEntity(fromDTO);
return staffService.addStaffByAccount(fromDTO);
}
/**
* @Description 用户所属组织
* @Param tokenDto

2
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/IcHouseDao.java

@ -211,4 +211,6 @@ public interface IcHouseDao extends BaseDao<IcHouseEntity> {
IcHouseEntity getHouseInfoByName(CheckHouseInfoFormDTO formDTO);
List<IcHouseListResultDTO> houseStatisListDetail(HouseChartFormDTO formDTO);
List<IcHouseEntity> selectListForRenFangStats(@Param("buildingId") String buildingId);
}

8
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/IcPropertyManagementDao.java

@ -18,6 +18,7 @@
package com.epmet.dao;
import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.dto.IcPropertyManagementDTO;
import com.epmet.entity.IcPropertyManagementEntity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
@ -50,4 +51,11 @@ public interface IcPropertyManagementDao extends BaseDao<IcPropertyManagementEnt
* @date 2022/2/13 9:59 上午
*/
List<IcPropertyManagementEntity> selectIdByName(@Param("names")List<String> names);
/**
* 查询小区关联物业id,name
* @param neighborhoodId
* @return
*/
List<IcPropertyManagementDTO> selectPropertyNameList(String neighborhoodId);
}

20
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/feign/EpmetUserFeignClient.java

@ -91,6 +91,16 @@ public interface EpmetUserFeignClient {
@PostMapping("/epmetuser/customerstaff/addstaff")
Result<CustomerStaffDTO> addStaff(@RequestBody StaffSubmitFromDTO fromDTO);
/**
* 人员添加
*
* @param fromDTO 参数
* @return Result
*/
@PostMapping("/epmetuser/customerstaff/addstaffaccount")
Result<CustomerStaffDTO> addStaffByAccount(@RequestBody StaffSubmitAccountFromDTO fromDTO);
/**
* 人员编辑
*
@ -100,6 +110,16 @@ public interface EpmetUserFeignClient {
@PostMapping("/epmetuser/customerstaff/editstaff")
Result editStaff(@RequestBody StaffSubmitFromDTO fromDTO);
/**
* 人员编辑
*
* @param fromDTO 参数
* @return Result
*/
@PostMapping("/epmetuser/customerstaff/editstaffaccount")
Result editStaffByAccount(@RequestBody StaffSubmitAccountFromDTO fromDTO);
/**
* 人员详情
*

10
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/feign/fallback/EpmetUserFeignClientFallBack.java

@ -62,11 +62,21 @@ public class EpmetUserFeignClientFallBack implements EpmetUserFeignClient {
return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "addStaff", fromDTO);
}
@Override
public Result<CustomerStaffDTO> addStaffByAccount(StaffSubmitAccountFromDTO fromDTO) {
return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "addStaffByAccount", fromDTO);
}
@Override
public Result editStaff(StaffSubmitFromDTO fromDTO) {
return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "editStaff", fromDTO);
}
@Override
public Result editStaffByAccount(StaffSubmitAccountFromDTO fromDTO) {
return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "editStaffByAccount", fromDTO);
}
@Override
public Result<StaffDetailResultDTO> getStaffDetail(StaffInfoFromDTO fromDTO) {
return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "getStaffDetail", fromDTO);

4
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/IcNeighborHoodService.java

@ -28,11 +28,11 @@ import com.epmet.dto.NeighborHoodAndManagementDTO;
import com.epmet.dto.form.IcNeighborHoodAddFormDTO;
import com.epmet.dto.form.ImportInfoFormDTO;
import com.epmet.dto.result.BuildingResultDTO;
import com.epmet.dto.result.IcNeighborHoodDetailDTO;
import com.epmet.dto.result.ImportTaskCommonResultDTO;
import com.epmet.entity.IcNeighborHoodEntity;
import com.epmet.entity.IcNeighborHoodPropertyEntity;
import com.epmet.entity.IcPropertyManagementEntity;
import org.springframework.web.bind.annotation.RequestBody;
import java.io.IOException;
import java.io.InputStream;
@ -194,5 +194,5 @@ public interface IcNeighborHoodService extends BaseService<IcNeighborHoodEntity>
* @params [neighborhoodId]
* @return com.epmet.commons.tools.utils.Result<com.epmet.dto.IcNeighborHoodDTO>
*/
Result<IcNeighborHoodEntity> neighborhoodDetail(String neighborhoodId);
Result<IcNeighborHoodDetailDTO> neighborhoodDetail(String neighborhoodId);
}

15
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/StaffService.java

@ -64,6 +64,14 @@ public interface StaffService {
*/
Result editStaff(TokenDto tokenDto,StaffSubmitFromDTO fromDTO);
/**
* 人员编辑
*
* @param fromDTO 参数
* @return Result
*/
Result editStaffByAccount(TokenDto tokenDto, StaffSubmitAccountFromDTO fromDTO);
/**
* 人员详情
*
@ -130,6 +138,13 @@ public interface StaffService {
*/
Result addStaffV2(AddStaffV2FromDTO fromDTO);
/**
* 通讯录人员添加-平阴
* @author zhy
*/
Result addStaffByAccount(StaffSubmitAccountFromDTO fromDTO);
/**
* @Description 工作人员所属组织
* @Param tokenDto

2
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/HouseServiceImpl.java

@ -210,7 +210,7 @@ public class HouseServiceImpl implements HouseService, ResultDataResolver {
IcBuildingUnitDTO icBuildingUnit = icBuildingUnitService.get(formDTO.getBuildingUnitId());
String doorName = formDTO.getDoorName();
String buildingName = Optional.ofNullable(icBuilding).map(u -> u.getBuildingName()).orElse("");
String unitName = Optional.ofNullable(icBuildingUnit).map(u -> u.getUnitNum()).orElse("");
String unitName = Optional.ofNullable(icBuildingUnit).map(u -> u.getUnitName()).orElse("");
return new StringBuilder().append(buildingName).append("-").append(unitName).append("-").append(doorName).toString();
}

20
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/IcHouseServiceImpl.java

@ -9,6 +9,8 @@ import com.epmet.commons.tools.dto.result.OptionResultDTO;
import com.epmet.commons.tools.exception.EpmetErrorCode;
import com.epmet.commons.tools.exception.EpmetException;
import com.epmet.commons.tools.exception.RenException;
import com.epmet.commons.tools.redis.common.CustomerIcHouseRedis;
import com.epmet.commons.tools.redis.common.bean.HouseInfoCache;
import com.epmet.commons.tools.security.dto.TokenDto;
import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.commons.tools.utils.Result;
@ -160,10 +162,13 @@ public class IcHouseServiceImpl extends BaseServiceImpl<IcHouseDao, IcHouseEntit
@Override
public List<HouseListResultDTO> getHouseList(TokenDto tokenDto, HouseFormDTO formDTO) {
//查询楼栋下房屋列表
LambdaQueryWrapper<IcHouseEntity> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(IcHouseEntity::getBuildingId, formDTO.getBuildingId());
wrapper.last("ORDER BY CONVERT ( HOUSE_NAME USING gbk ) ASC");
List<IcHouseEntity> list = baseDao.selectList(wrapper);
// LambdaQueryWrapper<IcHouseEntity> wrapper = new LambdaQueryWrapper<>();
// wrapper.eq(IcHouseEntity::getBuildingId, formDTO.getBuildingId());
// wrapper.last("ORDER BY CONVERT ( HOUSE_NAME USING gbk ) ASC");
// List<IcHouseEntity> list = baseDao.selectList(wrapper);
List<IcHouseEntity> list = baseDao.selectListForRenFangStats(formDTO.getBuildingId());
if (CollectionUtils.isEmpty(list)) {
return Collections.emptyList();
}
@ -220,6 +225,13 @@ public class IcHouseServiceImpl extends BaseServiceImpl<IcHouseDao, IcHouseEntit
categories.add(NumConstant.ZERO, categories.remove(a));
}
dto.setCategoryList(categories);
HouseInfoCache houseInfo = CustomerIcHouseRedis.getHouseInfo(item.getCustomerId(), item.getId());
if (null != houseInfo){
StringBuffer str = new StringBuffer();
str.append(houseInfo.getBuildingName()).append(houseInfo.getUnitName()).append(houseInfo.getDoorName());
dto.setHouseName(str.toString());
}
return dto;
}).collect(Collectors.toList());
}

26
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/IcNeighborHoodServiceImpl.java

@ -30,6 +30,7 @@ import com.baomidou.mybatisplus.core.toolkit.IdWorker;
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl;
import com.epmet.commons.tools.constant.FieldConstant;
import com.epmet.commons.tools.constant.NumConstant;
import com.epmet.commons.tools.constant.StrConstant;
import com.epmet.commons.tools.dto.result.CustomerStaffInfoCacheResult;
import com.epmet.commons.tools.dto.result.OptionResultDTO;
import com.epmet.commons.tools.exception.EpmetErrorCode;
@ -50,10 +51,7 @@ import com.epmet.dto.*;
import com.epmet.dto.form.IcNeighborHoodAddFormDTO;
import com.epmet.dto.form.ImportInfoFormDTO;
import com.epmet.dto.form.ImportTaskCommonFormDTO;
import com.epmet.dto.result.BuildingResultDTO;
import com.epmet.dto.result.ImportTaskCommonResultDTO;
import com.epmet.dto.result.InfoByNamesResultDTO;
import com.epmet.dto.result.UploadImgResultDTO;
import com.epmet.dto.result.*;
import com.epmet.entity.*;
import com.epmet.excel.IcNeighborHoodExcel;
import com.epmet.feign.EpmetCommonServiceOpenFeignClient;
@ -808,12 +806,22 @@ public class IcNeighborHoodServiceImpl extends BaseServiceImpl<IcNeighborHoodDao
}
@Override
public Result<IcNeighborHoodEntity> neighborhoodDetail(String neighborhoodId) {
IcNeighborHoodEntity result = baseDao.selectById(neighborhoodId);
if(null != result && null == result.getRemark()){
result.setRemark("");
public Result<IcNeighborHoodDetailDTO> neighborhoodDetail(String neighborhoodId) {
IcNeighborHoodEntity icNeighborHoodEntity = baseDao.selectById(neighborhoodId);
if (null == icNeighborHoodEntity) {
return new Result<>();
}
return new Result<IcNeighborHoodEntity>().ok(result);
IcNeighborHoodDetailDTO result = ConvertUtils.sourceToTarget(icNeighborHoodEntity, IcNeighborHoodDetailDTO.class);
if(null == result.getRemark()){
result.setRemark(StrConstant.EPMETY_STR);
}
GridInfoCache gridInfoCache=CustomerOrgRedis.getGridInfo(result.getGridId());
if (null != gridInfoCache) {
result.setAgencyName(gridInfoCache.getAgencyName());
result.setGridName(gridInfoCache.getGridName());
}
result.setPropertyList(propertyManagementDao.selectPropertyNameList(neighborhoodId));
return new Result<IcNeighborHoodDetailDTO>().ok(result);
}
}

58
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/StaffServiceImpl.java

@ -204,6 +204,25 @@ public class StaffServiceImpl implements StaffService {
return result;
}
@Override
public Result editStaffByAccount(TokenDto tokenDto, StaffSubmitAccountFromDTO fromDTO) {
CustomerAgencyEntity customerAgencyEntity = customerAgencyService.selectById(fromDTO.getAgencyId());
fromDTO.setCustomerId(customerAgencyEntity.getCustomerId());
fromDTO.setApp(tokenDto.getApp());
fromDTO.setClient(tokenDto.getClient());
Result result = epmetUserFeignClient.editStaffByAccount(fromDTO);
if (!result.success()) {
if (result.getCode() != EpmetErrorCode.SERVER_ERROR.getCode()) {
return new Result().error(result.getCode(), result.getMsg());
}
return new Result().error(EpmetErrorCode.STAFF_EDIT_FAILED.getCode(), EpmetErrorCode.STAFF_EDIT_FAILED.getMsg());
}
//2021.8.24 sun 人员信息编辑时删除工作人员的缓存信息
CustomerStaffRedis.delStaffInfoFormCache(fromDTO.getCustomerId(), fromDTO.getStaffId());
return result;
}
@Override
public Result<StaffDetailResultDTO> getStaffDetail(StaffInfoFromDTO fromDTO) {
CustomerAgencyEntity customerAgencyEntity = customerAgencyService.selectById(fromDTO.getAgencyId());
@ -597,6 +616,45 @@ public class StaffServiceImpl implements StaffService {
return new Result();
}
@Override
@Transactional(rollbackFor = Exception.class)
public Result addStaffByAccount(StaffSubmitAccountFromDTO fromDTO) {
CustomerAgencyEntity customerAgencyEntity = customerAgencyService.selectById(fromDTO.getAgencyId());
//fromDTO.setApp(tokenDto.getApp());
//fromDTO.setClient(tokenDto.getClient());
fromDTO.setCustomerId(customerAgencyEntity.getCustomerId());
Result<CustomerStaffDTO> result = epmetUserFeignClient.addStaffByAccount(fromDTO);
if (!result.success()) {
if (result.getCode() != EpmetErrorCode.SERVER_ERROR.getCode()) {
return new Result().error(result.getCode(), result.getMsg());
}
return new Result().error(EpmetErrorCode.STAFF_ADD_FAILED.getCode(), EpmetErrorCode.STAFF_ADD_FAILED.getMsg());
}
//人员机关关系表
CustomerStaffAgencyEntity customerStaffAgencyEntity = new CustomerStaffAgencyEntity();
customerStaffAgencyEntity.setCustomerId(customerAgencyEntity.getCustomerId());
customerStaffAgencyEntity.setUserId(result.getData().getUserId());
customerStaffAgencyEntity.setAgencyId(customerAgencyEntity.getId());
customerStaffAgencyService.insert(customerStaffAgencyEntity);
//机关总人数加一
customerAgencyEntity.setTotalUser(customerAgencyEntity.getTotalUser() + 1);
customerAgencyService.updateById(customerAgencyEntity);
//2021.8.25 sun 新增一张工作人员注册组织关系表,所以旧接口新增人员时关系表赋值关系数据
//工作人员注册组织关系表新增数据
StaffOrgRelationEntity staffOrgRelationEntity = new StaffOrgRelationEntity();
staffOrgRelationEntity.setCustomerId(fromDTO.getCustomerId());
staffOrgRelationEntity.setPids(("".equals(customerAgencyEntity.getPids()) ? "" : customerAgencyEntity.getPids()));
staffOrgRelationEntity.setStaffId(result.getData().getUserId());
staffOrgRelationEntity.setOrgId(customerAgencyEntity.getId());
staffOrgRelationEntity.setOrgType("agency");
staffOrgRelationService.insert(staffOrgRelationEntity);
return new Result();
}
/**
* @param tokenDto
* @Description 工作人员所属组织

13
epmet-module/gov-org/gov-org-server/src/main/resources/mapper/IcBuildingDao.xml

@ -235,6 +235,12 @@
LEFT JOIN ic_neighbor_hood nh ON (nh.ID = b.NEIGHBOR_HOOD_ID AND nh.DEL_FLAG = '0')
WHERE b.DEL_FLAG = '0'
AND b.NEIGHBOR_HOOD_ID = #{neighborHoodId}
ORDER BY
b.SORT ASC,
CAST( nh.NEIGHBOR_HOOD_NAME AS SIGNED ),
CONVERT ( nh.NEIGHBOR_HOOD_NAME USING gbk ),
CAST( b.BUILDING_NAME AS SIGNED ),
CONVERT ( b.BUILDING_NAME USING gbk)
</select>
<select id="checkBuildName" parameterType="map" resultType="java.lang.Integer">
@ -452,6 +458,13 @@
b.LONGITUDE,
b.COORDINATE_POSITION,
b.TYPE,
(
case when b.TYPE='1' then '商品房'
when b.TYPE='2' then '自建房'
when b.TYPE='3' then '别墅'
else ''
end
) as typeName,
h.GRID_ID,
h.AGENCY_ID,
b.BUILDING_LEADER_NAME,

45
epmet-module/gov-org/gov-org-server/src/main/resources/mapper/IcHouseDao.xml

@ -638,5 +638,48 @@
CONVERT(a.DOOR_NAME using gbk)
</select>
<select id="selectListForRenFangStats" resultMap="icHouseMap">
select a.id,
a.customer_id,
a.org_id_path,
a.neighbor_hood_id,
a.part_id,
a.building_id,
a.building_unit_id,
a.house_name,
a.door_name,
a.full_name,
a.house_type,
a.purpose,
a.rent_flag,
a.owner_name,
a.owner_phone,
a.owner_id_card,
a.resi_number,
a.avg_ysr,
a.sort,
a.del_flag,
a.revision,
a.created_by,
a.created_time,
a.updated_by,
a.updated_time,
a.remark,
a.house_code,
a.house_qrcode_url,
a.coding
FROM ic_house a
LEFT JOIN ic_building b on a.building_id = b.id and b.del_flag = '0'
LEFT JOIN ic_neighbor_hood c on a.neighbor_hood_id = c.id and c.del_flag = '0'
LEFT JOIN ic_building_unit d on a.building_unit_id = d.id and d.del_flag = '0'
where a.BUILDING_ID = #{buildingId}
and a.DEL_FLAG = '0'
order by
a.sort,
CONVERT(c.NEIGHBOR_HOOD_NAME using gbk),
CONVERT(b.BUILDING_NAME USING gbk),
CONVERT(d.UNIT_NAME USING gbk),
CAST(a.DOOR_NAME AS SIGNED),
CONVERT(a.DOOR_NAME using gbk)
</select>
</mapper>

17
epmet-module/gov-org/gov-org-server/src/main/resources/mapper/IcPropertyManagementDao.xml

@ -48,4 +48,21 @@
)
</select>
<select id="selectPropertyNameList" parameterType="java.lang.String" resultType="com.epmet.dto.IcPropertyManagementDTO">
SELECT
p.id,
p.NAME
FROM
ic_property_management p
WHERE
p.id IN (
SELECT DISTINCT
p.PROPERTY_ID
FROM
ic_neighbor_hood_property p
WHERE
p.NEIGHBOR_HOOD_ID = #{neighborhoodId}
AND p.DEL_FLAG = '0'
)
</select>
</mapper>

1
epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/result/IcEventResultDTO.java

@ -16,4 +16,5 @@ public class IcEventResultDTO {
private String reportUserName;
private String mobile;
private String address;
private String happenTime;
}

2
epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/impl/IcEventServiceImpl.java

@ -940,7 +940,7 @@ public class IcEventServiceImpl extends BaseServiceImpl<IcEventDao, IcEventEntit
}
//5.新增操作记录
IcEventOperationLogEntity logEntity = logEntity(formDTO.getCustomerId(), formDTO.getIcEventId(), formDTO.getDemandUserId(), new Date(), "shift_demand", "shift_demand");
IcEventOperationLogEntity logEntity = logEntity(formDTO.getCustomerId(), formDTO.getIcEventId(), formDTO.getDemandUserId(), formDTO.getWantServiceTime(), "shift_demand", "shift_demand");
icEventOperationLogService.insert(logEntity);
//6.判断来源居民端的事件,转了项目给居民推送站内信

9
epmet-module/gov-project/gov-project-server/src/main/resources/mapper/IcEventDao.xml

@ -43,7 +43,8 @@
e.REPORT_USER_ID reportUserId,
e.NAME reportUserName,
e.MOBILE mobile,
e.STATUS processStatus
e.STATUS processStatus,
e.happen_time happenTime
from ic_event e
<choose>
<!-- 如果是事件分类分析,那么用inner join;如果是处理分析,那么leftjoin查询所有事件 -->
@ -71,7 +72,7 @@
and c.CATEGORY_CODE like CONCAT(#{categoryCode},'%')
</if>
</where>
order by e.CREATED_TIME desc
order by e.happen_time desc
</select>
<select id="listMonthlyEventCount" resultType="com.epmet.dto.result.IcEventMonthlyCountResultDTO">
select t.monthName, count(1) eventCount
@ -210,10 +211,10 @@
AND ie.mobile = #{mobile}
</if>
<if test="startTime != null and startTime != '' ">
AND DATE_FORMAT(ie.created_time,"%Y-%m-%d %H:%i") <![CDATA[>=]]> #{startTime}
AND DATE_FORMAT(ie.happen_time,"%Y-%m-%d %H:%i") <![CDATA[>=]]> #{startTime}
</if>
<if test="endTime != null and endTime != '' ">
AND DATE_FORMAT(ie.created_time,"%Y-%m-%d %H:%i") <![CDATA[<=]]> #{endTime}
AND DATE_FORMAT(ie.happen_time,"%Y-%m-%d %H:%i") <![CDATA[<=]]> #{endTime}
</if>
<if test="status != null and status != '' ">
AND ie.`status` = #{status}

26
epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/form/TopArticleFormDTO.java

@ -0,0 +1,26 @@
package com.epmet.dto.form;
import lombok.Data;
import javax.validation.constraints.NotBlank;
/**
* @Description
* @Author yzm
* @Date 2022/9/21 15:13
*/
@Data
public class TopArticleFormDTO {
/**
* 文章id
*/
@NotBlank(message = "文章id不能为空")
private String articleId;
/**
* top
* cancel_top
*/
@NotBlank(message = "type不能为空,置顶:top,取消置顶:cancel_top")
private String type;
}

11
epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/controller/ArticleController.java

@ -424,6 +424,17 @@ public class ArticleController {
return new Result<PageData<PublishedListResultDTO>>().ok(articleService.articleListV2(formDTO));
}
/**
* 文章置顶取消置顶
* @param formDTO
* @return
*/
@PostMapping("topArticle")
public Result topArticle(@RequestBody TopArticleFormDTO formDTO){
ValidatorUtils.validateEntity(formDTO);
articleService.topArticle(formDTO.getArticleId(),formDTO.getType());
return new Result();
}
/**
* @param tokenDTO
* @return

2
epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/ArticleService.java

@ -255,4 +255,6 @@ public interface ArticleService extends BaseService<ArticleEntity> {
PageData<PublishedListResultDTO> articleListV2(ArticleListFormDTO formDTO);
PublishedListResultDTO detailV2(ArticleListFormDTO formDTO);
void topArticle(String articleId, String type);
}

17
epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/impl/ArticleServiceImpl.java

@ -1775,4 +1775,21 @@ public class ArticleServiceImpl extends BaseServiceImpl<ArticleDao, ArticleEntit
return resultDTO;
}
@Override
public void topArticle(String articleId, String type) {
ArticleEntity articleEntity = baseDao.selectById(articleId);
if (null != articleEntity) {
/**
* top
* cancel_top
*/
if ("top".equals(type)) {
articleEntity.setIsTop(NumConstant.ONE);
} else if ("cancel_top".equals(type)) {
articleEntity.setIsTop(NumConstant.ZERO);
}
baseDao.updateById(articleEntity);
}
}
}

2
epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/IcFormItemGroupDTO.java

@ -74,7 +74,7 @@ public class IcFormItemGroupDTO implements Serializable {
private Integer sort;
/**
* 1展示0不展示默认1
* 1展示0不展示默认1像党员点击是追加党员信息这种分组默认0不展示
*/
private Boolean display;

2
epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/entity/IcFormItemGroupEntity.java

@ -71,7 +71,7 @@ public class IcFormItemGroupEntity extends BaseEpmetEntity {
private Integer sort;
/**
* 1展示0不展示默认1
* 1展示0不展示默认1像党员点击是追加党员信息这种分组默认0不展示
*/
private Boolean display;

2
epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/impl/IcFormServiceImpl.java

@ -105,7 +105,9 @@ public class IcFormServiceImpl extends BaseServiceImpl<IcFormDao, IcFormEntity>
if (null == resultDTO) {
throw new RenException(EpmetErrorCode.CUSTOMER_FORM_NOT_EXITS.getCode(), EpmetErrorCode.CUSTOMER_FORM_NOT_EXITS.getMsg());
}
//基础信息这个分组对应的id:客户id_0
String itemGroupId=formDto.getCustomerId().concat(StrConstant.UNDER_LINE).concat(NumConstant.ZERO_STR);
//查询的是基础信息这个分组下的组件
List<FormItemResult> itemList = baseDao.selectItemList(itemGroupId,resultDTO.getFormId(), formDto.getDynamic());
List<FormGroupDTO> groupList = baseDao.selectListGroup(resultDTO.getFormId());
resultDTO.setItemList(itemList);

9
epmet-module/oper-customize/oper-customize-server/src/main/resources/db/migration/V0.0.39__itemgroup_child.sql

@ -0,0 +1,9 @@
ALTER TABLE ic_form_item_group MODIFY COLUMN `DISPLAY` TINYINT ( 1 ) NOT NULL DEFAULT '1' COMMENT '1展示,0不展示,默认1;像党员点击是,追加党员信息这种分组,默认0不展示';
ALTER TABLE ic_form_item_group ADD COLUMN `CHILD_SHOW_FLAG`
TINYINT ( 1 ) NOT NULL DEFAULT '0' COMMENT '1展示,0不展示,默认0' AFTER POLICY_FLAG;
UPDATE ic_form_item_group g
set g.CHILD_SHOW_FLAG='1'
where g.DISPLAY='0' and g.LABEL !='基础信息';

3
epmet-module/oper-customize/oper-customize-server/src/main/resources/mapper/IcFormDao.xml

@ -71,6 +71,7 @@
ic_form_item_group g
WHERE
g.DEL_FLAG = '0'
and g.CHILD_SHOW_FLAG='1'
AND g.id =(
SELECT DISTINCT
i.ITEM_GROUP_ID
@ -237,7 +238,7 @@
FROM ic_form_item fi
left join ic_form_item_group g on (fi.ITEM_GROUP_ID = g.ID and fi.DEL_FLAG = 0 and g.DEL_FLAG = 0)
left join ic_form_item pitem on (pitem.DEL_FLAG = 0 and fi.PARENT_ITEM_ID = pitem.ID)
WHERE fi.FORM_ID = #{formId}
WHERE fi.FORM_ID = #{formId} and fi.DEL_FLAG = '0'
ORDER BY fi.SORT ASC
</select>
</mapper>

2
epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/service/impl/ResiGroupServiceImpl.java

@ -1171,7 +1171,7 @@ public class ResiGroupServiceImpl extends BaseServiceImpl<ResiGroupDao, ResiGrou
if (groupLeaderUserInfo.success() && null != groupLeaderUserInfo.getData()) {
dto.setLeaderName(groupLeaderUserInfo.getData().getShowName());
} else {
logger.error("组长注册信息查询失败,msg:{},groupId:{}", groupLeaderUserInfo.getMsg(), dto.getGroupId());
logger.warn("组长注册信息查询失败,msg:{},groupId:{}", groupLeaderUserInfo.getMsg(), dto.getGroupId());
}
});
return recommendGroupList;

5
epmet-user/epmet-user-client/src/main/java/com/epmet/dto/CustomerStaffDTO.java

@ -44,6 +44,11 @@ public class CustomerStaffDTO implements Serializable {
*/
private String userId;
/**
* 账户
*/
private String userAccount;
/**
* 真实姓名
*/

15
epmet-user/epmet-user-client/src/main/java/com/epmet/dto/IcBirthRecordDTO.java

@ -71,7 +71,11 @@ public class IcBirthRecordDTO implements Serializable {
@NotBlank(message = "所属家庭不能为空", groups = {AddGroup.class})
private String homeId;
private String home;
/**
* 所属房屋全路径名称
* 详情回显
*/
private String homeAllName;
/**
* 姓名
*/
@ -84,10 +88,9 @@ public class IcBirthRecordDTO implements Serializable {
private String mobile;
/**
* 性别
* 性别 1男2女
*/
private String gender;
/**
* 身份证号
*/
@ -139,6 +142,12 @@ public class IcBirthRecordDTO implements Serializable {
*/
private String householderRelation;
/**
* 与户主关系字典表
* 详情回显
*/
private String householderRelationName;
/**
* 是否勾选补充居民信息0否 1是
*/

19
epmet-user/epmet-user-client/src/main/java/com/epmet/dto/IcEpidemicSpecialAttentionDTO.java

@ -28,7 +28,8 @@ public class IcEpidemicSpecialAttentionDTO implements Serializable {
/**
* ID
*/
private String id;
@NotBlank(message = "id不能为空",groups = {IcEpidemicSpecialAttentionUpdate.class})
private String id;
/**
* 客户ID
@ -56,7 +57,21 @@ public class IcEpidemicSpecialAttentionDTO implements Serializable {
private Integer isAttention;
/**
* 关注类型核酸检测2疫苗接种1行程上报0
* 是否历史关注1是0否
*/
private String isHistory;
/**
* 隔离类型,来自字典表;集中隔离0;居家隔离1;居家健康监测2;已出隔离期3
*/
// @NotBlank(message = "isolatedState不能为空",groups = {IcEpidemicSpecialAttentionAdd.class,IcEpidemicSpecialAttentionUpdate.class})
private String isolatedState;
/**
* 关注类型
* 核酸检测2
* 疫苗接种1
* 行程上报0
*/
@NotNull(message = "attentionType不能为空",groups = {IcEpidemicSpecialAttentionAdd.class,IcEpidemicSpecialAttentionUpdate.class})
private Integer attentionType;

4
epmet-user/epmet-user-client/src/main/java/com/epmet/dto/IcNoticeDTO.java

@ -106,4 +106,8 @@ public class IcNoticeDTO implements Serializable {
@JsonIgnore
private Date updatedTime;
/**
* 发送结果1成功,0失败
*/
private String sendRes;
}

13
epmet-user/epmet-user-client/src/main/java/com/epmet/dto/IcTripReportRecordDTO.java

@ -35,6 +35,9 @@ public class IcTripReportRecordDTO implements Serializable {
@ExcelIgnore
private String id;
@ExcelIgnore
private String epidemicId;
/**
* 居民端用户所在网格id,数字社区居民所属网格id
*/
@ -73,6 +76,11 @@ public class IcTripReportRecordDTO implements Serializable {
@ExcelProperty("手机号")
private String mobile;
/**
* 真实手机号不打码
*/
private String realMobile;
/**
* 身份证号
*/
@ -80,6 +88,11 @@ public class IcTripReportRecordDTO implements Serializable {
@ExcelProperty("身份证号")
private String idCard;
/**
* 真实身份证号
*/
private String realIdCard;
/**
* 用户id
*/

36
epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/CustomerStaffByAccountFormDTO.java

@ -0,0 +1,36 @@
package com.epmet.dto.form;
import lombok.Data;
import javax.validation.constraints.NotBlank;
import java.io.Serializable;
import java.util.List;
/**
* @Description 根据手机号+客户id获取工作人员基本信息
* @Author yinzuomei
* @Date 2020/4/20 14:02
*/
@Data
public class CustomerStaffByAccountFormDTO implements Serializable {
private static final long serialVersionUID = 7619815083427853431L;
// 根据手机号+客户id获取工作人员基本信息
public interface GetCustomerStaffInfo {}
@NotBlank(message = "账号不能为空", groups = { GetCustomerStaffInfo.class })
private String userAccount;
@NotBlank(message = "客户id不能为空", groups = { GetCustomerStaffInfo.class })
private String customerId;
/**
* 姓名
*/
private String realName;
/**
* 用户id集合
*/
private List<String> userIds;
}

60
epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/DingLoginResiFormDTO.java

@ -0,0 +1,60 @@
package com.epmet.dto.form;
import com.epmet.commons.tools.validator.group.CustomerClientShowGroup;
import lombok.Data;
import javax.validation.constraints.NotBlank;
/**
* @Description 钉钉居民端应用注册 // 接口逻辑:
* // (1)根据clientId去XXX表找到customerId
* // (2)通过1、2拿到手机号之后,根据mobile+customerId去user_base_info表找userId,
* // 是否注册居民:register_relation
* // (3)没有则生成user、user_Base_info表记录
* @Author yzm
* @Date 2022/9/15 9:28
*/
@Data
public class DingLoginResiFormDTO {
public interface AddUserInternalGroup {
}
public interface AddUserShowGroup extends CustomerClientShowGroup {
}
@NotBlank(message = "customerId不能为空", groups = AddUserShowGroup.class)
private String customerId;
// 以下参数是微信返回的
/**
* 头像URL
*/
public String avatarUrl;
/**
* 用户的个人邮箱
*/
public String email;
/**
* 用户的手机号
* 说明 如果要获取用户手机号需要在开发者后台申请个人手机号信息权限如下图
*/
@NotBlank(message = "手机号不能为空", groups = AddUserShowGroup.class)
public String mobile;
/**
* 用户的钉钉昵称
*/
public String nick;
/**
*
*/
public String openId;
/**
* 手机号对应的国家号
*/
public String stateCode;
/**
*
*/
public String unionId;
}

3
epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/SendNoticeFormDTO.java

@ -60,5 +60,8 @@ public class SendNoticeFormDTO implements Serializable {
* 身份证
*/
private String idCard;
private String realIdCard;
}
}

Some files were not shown because too many files changed in this diff

Loading…
Cancel
Save