Browse Source

Merge branch 'dev_temp' of http://git.elinkit.com.cn:7070/r/epmet-cloud into dev_temp

master
wxz 5 years ago
parent
commit
37229e9df4
  1. 4
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/constant/AppClientConstant.java
  2. 5
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java
  3. 2
      epmet-gateway/src/main/resources/bootstrap.yml
  4. 7
      epmet-module/data-statistical/data-statistical-server/src/main/resources/logback-spring.xml
  5. 2
      epmet-module/epmet-ext/epmet-ext-server/src/main/java/com/epmet/constant/ModuleConstant.java
  6. 29
      epmet-module/epmet-ext/epmet-ext-server/src/main/java/com/epmet/controller/OpenUpController.java
  7. 20
      epmet-module/epmet-ext/epmet-ext-server/src/main/java/com/epmet/service/OpenUpService.java
  8. 30
      epmet-module/epmet-ext/epmet-ext-server/src/main/java/com/epmet/service/impl/OpenUpServiceImpl.java
  9. 7
      epmet-module/epmet-message/epmet-message-client/src/main/java/com/epmet/dto/UserMessageDTO.java
  10. 5
      epmet-module/epmet-message/epmet-message-client/src/main/java/com/epmet/dto/form/UserMessageFormDTO.java
  11. 17
      epmet-module/epmet-message/epmet-message-client/src/main/java/com/epmet/dto/form/WxmpMessagePushFormDTO.java
  12. 11
      epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/constant/ExtConstant.java
  13. 18
      epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/controller/WxmpMessageController.java
  14. 40
      epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/controller/WxmpMessageExtController.java
  15. 5
      epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/entity/UserMessageEntity.java
  16. 5
      epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/excel/UserMessageExcel.java
  17. 10
      epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/service/WxmpMessageExtService.java
  18. 8
      epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/service/WxmpMessageService.java
  19. 62
      epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/service/impl/WxmpMessageExtServiceImpl.java
  20. 23
      epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/service/impl/WxmpMessageServiceImpl.java
  21. 1
      epmet-module/epmet-message/epmet-message-server/src/main/resources/db/migration/V0.3.12.5__alter_user_message_add_column.sql
  22. 4
      epmet-module/epmet-oss/epmet-oss-server/pom.xml
  23. 7
      epmet-module/epmet-oss/epmet-oss-server/src/main/java/com/epmet/cloud/AbstractCloudStorageService.java
  24. 54
      epmet-module/epmet-oss/epmet-oss-server/src/main/java/com/epmet/cloud/AliyunCloudStorageService.java
  25. 6
      epmet-module/epmet-oss/epmet-oss-server/src/main/java/com/epmet/cloud/FastDFSCloudStorageService.java
  26. 5
      epmet-module/epmet-oss/epmet-oss-server/src/main/java/com/epmet/cloud/LocalCloudStorageService.java
  27. 5
      epmet-module/epmet-oss/epmet-oss-server/src/main/java/com/epmet/cloud/QcloudCloudStorageService.java
  28. 5
      epmet-module/epmet-oss/epmet-oss-server/src/main/java/com/epmet/cloud/QiniuCloudStorageService.java
  29. 53
      epmet-module/epmet-oss/epmet-oss-server/src/main/java/com/epmet/controller/OssController.java
  30. 2
      epmet-module/epmet-oss/epmet-oss-server/src/main/java/com/epmet/service/OssService.java
  31. 32
      epmet-module/epmet-oss/epmet-oss-server/src/main/java/com/epmet/service/impl/OssServiceImpl.java
  32. 32
      epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/AgencyInfoFormDTO.java
  33. 66
      epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/AgencyInfoResultDTO.java
  34. 31
      epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/OrganizeTreeDeptResultDTO.java
  35. 31
      epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/OrganizeTreeGridResultDTO.java
  36. 50
      epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/OrganizeTreeResultDTO.java
  37. 16
      epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/feign/GovOrgOpenFeignClient.java
  38. 10
      epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/feign/fallback/GovOrgOpenFeignClientFallback.java
  39. 18
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/CustomerAgencyController.java
  40. 21
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerAgencyDao.java
  41. 12
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/CustomerAgencyService.java
  42. 36
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerAgencyServiceImpl.java
  43. 81
      epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerAgencyDao.xml
  44. 2
      epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/impl/ArticleServiceImpl.java
  45. 29
      epmet-module/resi-mine/resi-mine-client/src/main/java/com/epmet/resi/mine/dto/from/BadgeListFormDTO.java
  46. 21
      epmet-module/resi-mine/resi-mine-client/src/main/java/com/epmet/resi/mine/dto/from/OperListFormDTO.java
  47. 32
      epmet-module/resi-mine/resi-mine-client/src/main/java/com/epmet/resi/mine/dto/result/BadgeListResultDTO.java
  48. 39
      epmet-module/resi-mine/resi-mine-client/src/main/java/com/epmet/resi/mine/dto/result/InitInfoResultDTO.java
  49. 51
      epmet-module/resi-mine/resi-mine-client/src/main/java/com/epmet/resi/mine/dto/result/OperListResultDTO.java
  50. 85
      epmet-module/resi-mine/resi-mine-server/src/main/java/com/epmet/modules/badege/controller/BadgeController.java
  51. 52
      epmet-module/resi-mine/resi-mine-server/src/main/java/com/epmet/modules/badege/service/BadgeService.java
  52. 111
      epmet-module/resi-mine/resi-mine-server/src/main/java/com/epmet/modules/badege/service/impl/BadgeServiceImpl.java
  53. 55
      epmet-module/resi-mine/resi-mine-server/src/main/java/com/epmet/modules/mine/controller/PersonalCenterController.java
  54. 17
      epmet-module/resi-mine/resi-mine-server/src/main/java/com/epmet/modules/mine/service/PersonalCenterService.java
  55. 51
      epmet-module/resi-mine/resi-mine-server/src/main/java/com/epmet/modules/mine/service/impl/PersonalCenterServiceImpl.java
  56. 27
      epmet-user/epmet-user-client/src/main/java/com/epmet/constant/BadgeConstant.java
  57. 86
      epmet-user/epmet-user-client/src/main/java/com/epmet/dto/BadgeCertificationConfigDTO.java
  58. 96
      epmet-user/epmet-user-client/src/main/java/com/epmet/dto/BadgeDTO.java
  59. 45
      epmet-user/epmet-user-client/src/main/java/com/epmet/dto/UserBadgeCertificateRecordDTO.java
  60. 42
      epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/AddBadgeFormDTO.java
  61. 24
      epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/AuthFieldFormDTO.java
  62. 16
      epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/BadgeFormDTO.java
  63. 22
      epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/BadgeSendCodeFormDTO.java
  64. 67
      epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/CertificationAddFormDTO.java
  65. 29
      epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/CertificationDetailFormDTO.java
  66. 40
      epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/EditBadgeFormDTO.java
  67. 52
      epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/EditInfoFormDTO.java
  68. 26
      epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/OpenedOrClosedFormDTO.java
  69. 21
      epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/OrganizeTreeFormDTO.java
  70. 33
      epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/UserBadgeListFormDTO.java
  71. 28
      epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/UserOperListFormDTO.java
  72. 40
      epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/AuthFieldResultDTO.java
  73. 26
      epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/BadgeDetailResultDTO.java
  74. 31
      epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/BadgeListResultDTO.java
  75. 60
      epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/CertificationDetailResultDTO.java
  76. 49
      epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/UserBadgeListResultDTO.java
  77. 67
      epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/UserOperListResultDTO.java
  78. 46
      epmet-user/epmet-user-client/src/main/java/com/epmet/feign/EpmetUserOpenFeignClient.java
  79. 25
      epmet-user/epmet-user-client/src/main/java/com/epmet/feign/fallback/EpmetUserOpenFeignClientFallback.java
  80. 104
      epmet-user/epmet-user-server/src/main/java/com/epmet/controller/BadgeController.java
  81. 116
      epmet-user/epmet-user-server/src/main/java/com/epmet/controller/UserBadgeController.java
  82. 18
      epmet-user/epmet-user-server/src/main/java/com/epmet/controller/UserResiInfoController.java
  83. 54
      epmet-user/epmet-user-server/src/main/java/com/epmet/dao/BadgeCertificationConfigDao.java
  84. 108
      epmet-user/epmet-user-server/src/main/java/com/epmet/dao/BadgeDao.java
  85. 95
      epmet-user/epmet-user-server/src/main/java/com/epmet/dao/UserBadgeDao.java
  86. 9
      epmet-user/epmet-user-server/src/main/java/com/epmet/dao/UserResiInfoDao.java
  87. 56
      epmet-user/epmet-user-server/src/main/java/com/epmet/entity/BadgeCertificationConfigEntity.java
  88. 66
      epmet-user/epmet-user-server/src/main/java/com/epmet/entity/BadgeEntity.java
  89. 69
      epmet-user/epmet-user-server/src/main/java/com/epmet/redis/UserBadgeRedis.java
  90. 127
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/BadgeCertificationConfigService.java
  91. 150
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/BadgeService.java
  92. 76
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/UserBadgeService.java
  93. 14
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/UserResiInfoService.java
  94. 149
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/BadgeCertificationConfigServiceImpl.java
  95. 248
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/BadgeServiceImpl.java
  96. 239
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/UserBadgeServiceImpl.java
  97. 18
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/UserResiInfoServiceImpl.java
  98. 199
      epmet-user/epmet-user-server/src/main/resources/db/migration/2020-11-03_badege.sql
  99. 42
      epmet-user/epmet-user-server/src/main/resources/mapper/BadgeCertificationConfigDao.xml
  100. 116
      epmet-user/epmet-user-server/src/main/resources/mapper/BadgeDao.xml

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

@ -50,4 +50,8 @@ public interface AppClientConstant {
* 事务流水号每次请求串起来的多个服务拥有相同的流水号,便于日志追踪
*/
String TRANSACTION_SERIAL_KEY = "Transaction-Serial";
/**
* app类型-工作端
*/
String APP_WORK = "work";
}

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

@ -95,6 +95,9 @@ public enum EpmetErrorCode {
SIGN_IN_TIME_NO(8513, "签到时间还未到~"),
SIGN_IN_TIME_END(8514, "签到时间已结束~"),
//徽章管理
DUPLICATE_BADGE_NAME(8515, "徽章名已存在"),
// 该错误不会提示给前端,只是后端传输错误信息用。
ACCESS_SQL_FILTER_MISSION_ARGS(8701, "缺少生成权限过滤SQL所需参数"),
OPER_ADD_CUSTOMER_ROOT_AGENCY_ERROR(8702, "添加客户根级组织失败"),
@ -110,6 +113,8 @@ public enum EpmetErrorCode {
OPER_CUSTOMER_FOOTBAR_EXISTS(8712, "footbar已存在"),
OPER_CUSTOMER_FOOTBAR_NOT_FOUND(8713, "footbar不存在"),
OPER_EXT_APP_SECRET_RESET_FAIL(8714, "秘钥更新失败"),
OPER_UPLOAD_IMG_TYPE_ERROR(8715, "请上传PNG格式的图片"),
OPER_UPLOAD_IMG_SIZE_ERROR(8716, "请上传200*200的图片"),
// 党建声音 前端提示 88段
DRAFT_CONTENT_IS_NULL(8801, "至少需要添加一个段落"),

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

@ -445,7 +445,7 @@ epmet:
- /data/stats/**
- /epmet/ext/**
- /epmetuser/customerstaff/customerlist
- /message/template/wxmpmsgpush
- /message/template/**
swaggerUrls:

7
epmet-module/data-statistical/data-statistical-server/src/main/resources/logback-spring.xml

@ -173,6 +173,13 @@
<appender-ref ref="WARN_FILE"/>
<appender-ref ref="ERROR_FILE"/>
</root>
<!-- 屏蔽logger -->
<logger name="org.springframework" level="INFO"/>
<logger name="org.apache" level="WARN"/>
<logger name="org.mybatis.spring" level="WARN"/>
<logger name="io.netty" level="WARN"/>
<logger name="org.redisson.connection" level="WARN"/>
<logger name="org.hibernate.validator" level="WARN"/>
</springProfile>
</configuration>

2
epmet-module/epmet-ext/epmet-ext-server/src/main/java/com/epmet/constant/ModuleConstant.java

@ -14,4 +14,6 @@ public interface ModuleConstant {
String ERROR_EPMET_USER = "调用epmet_user服务查询网格下的所有工作人员失败";
String ERROR_AGENCY = "调用gov_org服务查询组织基本信息失败";
}

29
epmet-module/epmet-ext/epmet-ext-server/src/main/java/com/epmet/controller/OpenUpController.java

@ -11,8 +11,10 @@ import com.epmet.feign.EpmetUserOpenFeignClient;
import com.epmet.feign.GovOrgOpenFeignClient;
import com.epmet.service.OpenUpService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
@ -100,5 +102,28 @@ public class OpenUpController {
return govOrgOpenFeignClient.staffPermissionExt(commonStaffIdFormDTO.getStaffId());
}
/**
* @Description 对外接口-根据组织Id获取组织信息
* @author sun
**/
@PostMapping("agencyinfo")
Result<AgencyInfoResultDTO> agencyInfo(@RequestBody AgencyInfoFormDTO formDTO) {
ValidatorUtils.validateEntity(formDTO, AgencyInfoFormDTO.StaffIdGroup.class);
if (!"agency".equals(formDTO.getOrgType()) && !"grid".equals(formDTO.getOrgType())) {
return new Result<AgencyInfoResultDTO>().error("参数错误,orgType值类型错误!");
}
return new Result<AgencyInfoResultDTO>().ok(openUpService.agencyInfo(formDTO));
}
/**
* @Description 外挂-获取当前组织及部门网格数据递归查询所有下级数据
* @author sun
**/
@PostMapping("organizetree")
Result<OrganizeTreeResultDTO> organizeTree(@RequestBody OrganizeTreeFormDTO formDTO){
ValidatorUtils.validateEntity(formDTO, OrganizeTreeFormDTO.StaffIdGroup.class);
return new Result<OrganizeTreeResultDTO>().ok(openUpService.organizeTree(formDTO));
}
}

20
epmet-module/epmet-ext/epmet-ext-server/src/main/java/com/epmet/service/OpenUpService.java

@ -1,11 +1,7 @@
package com.epmet.service;
import com.epmet.dto.form.StaffSinAgencyFormDTO;
import com.epmet.dto.form.StaffSinDeptFormDTO;
import com.epmet.dto.form.StaffSinGridFormDTO;
import com.epmet.dto.result.StaffSinAgencyResultDTO;
import com.epmet.dto.result.StaffSinDeptResultDTO;
import com.epmet.dto.result.StaffSinGridResultDTO;
import com.epmet.dto.form.*;
import com.epmet.dto.result.*;
import java.util.List;
@ -38,4 +34,16 @@ public interface OpenUpService {
* @date 2020/8/17 9:59 上午
*/
List<StaffSinAgencyResultDTO> staffSinAgency(StaffSinAgencyFormDTO formDTO);
/**
* @Description 对外接口-根据组织Id获取组织信息
* @author sun
**/
AgencyInfoResultDTO agencyInfo(AgencyInfoFormDTO formDTO);
/**
* @Description 外挂-获取当前组织及部门网格数据递归查询所有下级数据
* @author sun
**/
OrganizeTreeResultDTO organizeTree(OrganizeTreeFormDTO formDTO);
}

30
epmet-module/epmet-ext/epmet-ext-server/src/main/java/com/epmet/service/impl/OpenUpServiceImpl.java

@ -6,9 +6,7 @@ import com.epmet.commons.tools.exception.RenException;
import com.epmet.commons.tools.utils.Result;
import com.epmet.constant.ModuleConstant;
import com.epmet.dto.form.*;
import com.epmet.dto.result.StaffSinAgencyResultDTO;
import com.epmet.dto.result.StaffSinDeptResultDTO;
import com.epmet.dto.result.StaffSinGridResultDTO;
import com.epmet.dto.result.*;
import com.epmet.feign.EpmetUserOpenFeignClient;
import com.epmet.feign.GovOrgOpenFeignClient;
import com.epmet.service.OpenUpService;
@ -123,4 +121,30 @@ public class OpenUpServiceImpl implements OpenUpService {
return staffInfoList.getData();
}
/**
* @Description 对外接口-根据组织Id获取组织信息
* @author sun
**/
@Override
public AgencyInfoResultDTO agencyInfo(AgencyInfoFormDTO formDTO) {
Result<AgencyInfoResultDTO> result = govOrgOpenFeignClient.agencyInfo(formDTO);
if (!result.success()){
throw new RenException(result.getInternalMsg());
}
return result.getData();
}
/**
* @Description 外挂-获取当前组织及部门网格数据递归查询所有下级数据
* @author sun
**/
@Override
public OrganizeTreeResultDTO organizeTree(OrganizeTreeFormDTO formDTO) {
Result<OrganizeTreeResultDTO> result = govOrgOpenFeignClient.organizeTree(formDTO.getAgencyId());
if (!result.success()){
throw new RenException(result.getInternalMsg());
}
return result.getData();
}
}

7
epmet-module/epmet-message/epmet-message-client/src/main/java/com/epmet/dto/UserMessageDTO.java

@ -59,6 +59,11 @@ public class UserMessageDTO implements Serializable {
*/
private String app;
/**
* 调用者
*/
private String referer;
/**
* 消息标题
*/
@ -104,4 +109,4 @@ public class UserMessageDTO implements Serializable {
*/
private Date updatedTime;
}
}

5
epmet-module/epmet-message/epmet-message-client/src/main/java/com/epmet/dto/form/UserMessageFormDTO.java

@ -56,4 +56,9 @@ public class UserMessageFormDTO implements Serializable {
*/
@NotBlank(message = "readFlag不能为空")
private String readFlag;
/**
* 调用者
*/
private String referer;
}

17
epmet-module/epmet-message/epmet-message-client/src/main/java/com/epmet/dto/form/WxmpMessagePushFormDTO.java

@ -25,7 +25,7 @@ public class WxmpMessagePushFormDTO implements Serializable {
* 客户端类型 居民端:resi 工作端:work
*/
@NotBlank(message = "客户端类型不能为空")
private String clientType;
private String app;
/**
* 接收者用户 userId
@ -37,7 +37,7 @@ public class WxmpMessagePushFormDTO implements Serializable {
* 行为类型(存title字段的中间值) 入组申请党员认证等
*/
@NotBlank(message = "行为类型不能为空")
private String behaviorType;
private String title;
/**
* 消息内容
@ -48,12 +48,25 @@ public class WxmpMessagePushFormDTO implements Serializable {
/**
* 网格id-居民端用
*/
@NotBlank(message = "网格id不能为空")
private String gridId;
/**
* 已读标记
*/
@NotBlank(message = "已读标记不能为空")
private String readFlag;
/**
* 调用方
*/
@NotBlank(message = "调用方不能为空")
private String referer;
/**
* 推送微信订阅Flag
*/
@NotBlank(message = "是否推送订阅Flag不能为空")
private String pushWxmpFlag;
}

11
epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/constant/ExtConstant.java

@ -0,0 +1,11 @@
package com.epmet.constant;
public interface ExtConstant {
String APP_RESI = "resi";
String APP_WORK = "work";
String APP_GOV = "gov";
String PUSH_WXMP = "1";
}

18
epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/controller/WxmpMessageController.java

@ -24,15 +24,16 @@ import com.epmet.commons.tools.validator.ValidatorUtils;
import com.epmet.dto.form.GetTemplateListFormDTO;
import com.epmet.dto.form.WxMsgAuthInfoFormDTO;
import com.epmet.dto.form.WxSubscribeMessageFormDTO;
import com.epmet.dto.form.WxmpTemplateListFormDTO;
import com.epmet.dto.result.GetTemplateListResultDTO;
import com.epmet.dto.result.WxMsgAuthInfoResultDTO;
import com.epmet.dto.result.WxmpTemplateListResultDTO;
import com.epmet.service.WxmpMessageService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
import java.util.concurrent.ExecutorService;
@ -144,15 +145,4 @@ public class WxmpMessageController {
return new Result();
}
/**
* @return
* @Description (外挂)消息-获取订阅消息模板列表
* @author sun
*/
@PostMapping("wxmptemplatelist")
public Result<List<WxmpTemplateListResultDTO>> wxmpTemplateList(@RequestBody WxmpTemplateListFormDTO formDTO) {
ValidatorUtils.validateEntity(formDTO, WxmpTemplateListFormDTO.AddUserInternalGroup.class);
return new Result<List<WxmpTemplateListResultDTO>>().ok(wxmpMessageService.wxmpTemplateList(formDTO));
}
}

40
epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/controller/WxmpMessageExtController.java

@ -1,9 +1,15 @@
package com.epmet.controller;
import com.epmet.commons.tools.constant.AppClientConstant;
import com.epmet.commons.tools.exception.ExceptionUtils;
import com.epmet.commons.tools.utils.Result;
import com.epmet.commons.tools.validator.ValidatorUtils;
import com.epmet.dto.form.WxmpMessagePushFormDTO;
import com.epmet.dto.form.WxmpTemplateListFormDTO;
import com.epmet.dto.result.WxmpTemplateListResultDTO;
import com.epmet.service.WxmpMessageExtService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
@ -11,6 +17,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
import java.util.concurrent.ExecutorService;
/**
* @description: 外部调用微信订阅controller
@ -20,14 +27,43 @@ import java.util.List;
@RestController
@RequestMapping("template")
public class WxmpMessageExtController {
private Logger logger = LoggerFactory.getLogger(getClass());
@Autowired
private WxmpMessageExtService wxmpMessageExtService;
@PostMapping("wxmpmsgpush")
@Autowired
private ExecutorService executorService;
@PostMapping("msgpush")
public Result wxmpMsgPush(@RequestBody List<WxmpMessagePushFormDTO> dtos){
for (WxmpMessagePushFormDTO dto : dtos) {
ValidatorUtils.validateEntity(dto);
}
return wxmpMessageExtService.pushWxmpMessage(dtos);
executorService.execute(() -> {
try {
long startTs = System.currentTimeMillis();
wxmpMessageExtService.pushWxmpMessage(dtos);
long endTs = System.currentTimeMillis();
logger.info("异步发送消息成功,执行时长:{}", endTs - startTs);
} catch (Exception e) {
logger.error("异步发送消息失败,错误信息:{}", ExceptionUtils.getErrorStackTrace(e));
}
});
return new Result();
}
/**
* @return
* @Description (外挂)消息-获取订阅消息模板列表
* @author sun
*/
@PostMapping("wxmptemplatelist")
public Result<List<WxmpTemplateListResultDTO>> wxmpTemplateList(@RequestBody WxmpTemplateListFormDTO formDTO) {
ValidatorUtils.validateEntity(formDTO, WxmpTemplateListFormDTO.AddUserInternalGroup.class);
if (!AppClientConstant.APP_RESI.equals(formDTO.getClientType()) && !AppClientConstant.APP_WORK.equals(formDTO.getClientType())) {
return new Result<List<WxmpTemplateListResultDTO>>().error("参数错误,clientType值类型错误!");
}
return new Result<List<WxmpTemplateListResultDTO>>().ok(wxmpMessageExtService.wxmpTemplateList(formDTO));
}
}

5
epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/entity/UserMessageEntity.java

@ -70,4 +70,9 @@ public class UserMessageEntity extends BaseEpmetEntity {
*/
private String readFlag;
/**
* 调用者
*/
private String referer;
}

5
epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/excel/UserMessageExcel.java

@ -49,6 +49,9 @@ public class UserMessageExcel {
@Excel(name = "消息标题")
private String title;
@Excel(name = "调用者")
private String referer;
@Excel(name = "消息通知内容")
private String messageContent;
@ -74,4 +77,4 @@ public class UserMessageExcel {
private Date updatedTime;
}
}

10
epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/service/WxmpMessageExtService.java

@ -2,9 +2,19 @@ package com.epmet.service;
import com.epmet.commons.tools.utils.Result;
import com.epmet.dto.form.WxmpMessagePushFormDTO;
import com.epmet.dto.form.WxmpTemplateListFormDTO;
import com.epmet.dto.result.WxmpTemplateListResultDTO;
import java.util.List;
public interface WxmpMessageExtService {
Result pushWxmpMessage(List<WxmpMessagePushFormDTO> dto);
/**
* @return
* @Description 消息-获取订阅消息模板列表
* @author sun
*/
List<WxmpTemplateListResultDTO> wxmpTemplateList(WxmpTemplateListFormDTO formDTO);
}

8
epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/service/WxmpMessageService.java

@ -19,10 +19,8 @@ package com.epmet.service;
import com.epmet.dto.form.GetTemplateListFormDTO;
import com.epmet.dto.form.WxSubscribeMessageFormDTO;
import com.epmet.dto.form.WxmpTemplateListFormDTO;
import com.epmet.dto.result.GetTemplateListResultDTO;
import com.epmet.dto.result.WxMsgAuthInfoResultDTO;
import com.epmet.dto.result.WxmpTemplateListResultDTO;
import java.util.List;
@ -57,10 +55,4 @@ public interface WxmpMessageService {
*/
List<GetTemplateListResultDTO> templateList(GetTemplateListFormDTO formDTO);
/**
* @return
* @Description 消息-获取订阅消息模板列表
* @author sun
*/
List<WxmpTemplateListResultDTO> wxmpTemplateList(WxmpTemplateListFormDTO formDTO);
}

62
epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/service/impl/WxmpMessageExtServiceImpl.java

@ -1,9 +1,12 @@
package com.epmet.service.impl;
import com.epmet.commons.tools.exception.RenException;
import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.commons.tools.utils.Result;
import com.epmet.dto.form.WxSubscribeMessageFormDTO;
import com.epmet.dto.form.WxmpMessagePushFormDTO;
import com.epmet.constant.ExtConstant;
import com.epmet.dto.form.*;
import com.epmet.dto.result.CustomerTemplateListResultDTO;
import com.epmet.dto.result.WxmpTemplateListResultDTO;
import com.epmet.service.UserMessageService;
import com.epmet.service.WxmpMessageExtService;
import com.epmet.service.WxmpMessageService;
import org.springframework.beans.BeanUtils;
@ -23,21 +26,58 @@ import java.util.List;
public class WxmpMessageExtServiceImpl implements WxmpMessageExtService {
@Autowired
private WxmpMessageService wxmpMessageService;
@Autowired
private UserMessageService userMessageService;
@Autowired
private WxmpMessageServiceImpl wxmpMessageServiceImpl;
@Override
public Result pushWxmpMessage(List<WxmpMessagePushFormDTO> dtos) {
List<WxSubscribeMessageFormDTO> msgList = new ArrayList<>();
List<WxSubscribeMessageFormDTO> wxmpMsgList = new ArrayList<>();
List<UserMessageFormDTO> userMsgList = new ArrayList<>();
for (WxmpMessagePushFormDTO dto : dtos) {
WxSubscribeMessageFormDTO wxSubscribeMessageFormDTO = new WxSubscribeMessageFormDTO();
try{
//站内信
UserMessageFormDTO userMessageFormDTO = new UserMessageFormDTO();
BeanUtils.copyProperties(dto,userMessageFormDTO);
userMessageFormDTO.setTitle("您有一条"+dto.getTitle());
userMsgList.add(userMessageFormDTO);
//如果推送微信订阅flag为"1",推送微信订阅
if (ExtConstant.PUSH_WXMP.equals(dto.getPushWxmpFlag())){
WxSubscribeMessageFormDTO wxSubscribeMessageFormDTO = new WxSubscribeMessageFormDTO();
BeanUtils.copyProperties(dto,wxSubscribeMessageFormDTO);
//设置ClientType
if (ExtConstant.APP_RESI.equals(dto.getApp())){
wxSubscribeMessageFormDTO.setClientType(ExtConstant.APP_RESI);
}
if (ExtConstant.APP_GOV.equals(dto.getApp())){
wxSubscribeMessageFormDTO.setClientType(ExtConstant.APP_WORK);
}
wxSubscribeMessageFormDTO.setBehaviorType(dto.getTitle());
wxSubscribeMessageFormDTO.setMessageTime(new Date());
msgList.add(wxSubscribeMessageFormDTO);
}catch (Exception e){
throw new RenException("转换bean失败");
wxmpMsgList.add(wxSubscribeMessageFormDTO);
}
}
wxmpMessageService.sendWxSubscribeMessage(msgList);
return new Result();
wxmpMessageService.sendWxSubscribeMessage(wxmpMsgList);
return userMessageService.saveUserMessageList(userMsgList);
}
/**
* @return
* @Description 消息-获取订阅消息模板列表
* @author sun
*/
@Override
public List<WxmpTemplateListResultDTO> wxmpTemplateList(WxmpTemplateListFormDTO formDTO) {
List<WxmpTemplateListResultDTO> resultList = new ArrayList<>();
CustomerTemplateListFormDTO dto = ConvertUtils.sourceToTarget(formDTO, CustomerTemplateListFormDTO.class);
List<CustomerTemplateListResultDTO> list = wxmpMessageServiceImpl.customerTemplateList(dto);
list.forEach(l->{
if(formDTO.getClientType().equals(l.getClientType())){
WxmpTemplateListResultDTO result = ConvertUtils.sourceToTarget(l, WxmpTemplateListResultDTO.class);
resultList.add(result);
}
});
return resultList;
}
}

23
epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/service/impl/WxmpMessageServiceImpl.java

@ -330,7 +330,7 @@ public class WxmpMessageServiceImpl implements WxmpMessageService {
wxmpMsgSendRecordEntity.setMessageContent(msg.getMessageContent());
wxmpMsgSendRecordEntity.setMessageTime(msg.getMessageTime());
wxmpMsgSendRecordEntity.setResult(status);
wxmpMsgSendRecordEntity.setReferer(StringUtils.isBlank(msg.getReferer())?"epmet":msg.getReferer());
wxmpMsgSendRecordEntity.setReferer(msg.getReferer());
return wxmpMsgSendRecordEntity;
}
@ -424,7 +424,7 @@ public class WxmpMessageServiceImpl implements WxmpMessageService {
* @Description 查询客户两个端小程序对应的站内信模板Id
* @author sun
*/
private List<CustomerTemplateListResultDTO> customerTemplateList(CustomerTemplateListFormDTO formDTO) {
public List<CustomerTemplateListResultDTO> customerTemplateList(CustomerTemplateListFormDTO formDTO) {
String url = "https://epmet-cloud.elinkservice.cn/api/third/personaltemplate/customertemplatelist";
String data = HttpClientManager.getInstance().sendPostByJSON(url, JSON.toJSONString(formDTO)).getData();
logger.info("ThirdLoginServiceImpl.customerTemplateList:httpclient->url:" + url + ",结果->" + data);
@ -619,23 +619,4 @@ public class WxmpMessageServiceImpl implements WxmpMessageService {
return staffBasicInfo.getOpenId();
}
/**
* @return
* @Description 消息-获取订阅消息模板列表
* @author sun
*/
@Override
public List<WxmpTemplateListResultDTO> wxmpTemplateList(WxmpTemplateListFormDTO formDTO) {
List<WxmpTemplateListResultDTO> resultList = new ArrayList<>();
CustomerTemplateListFormDTO dto = ConvertUtils.sourceToTarget(formDTO, CustomerTemplateListFormDTO.class);
List<CustomerTemplateListResultDTO> list = customerTemplateList(dto);
list.forEach(l->{
if(formDTO.getClientType().equals(l.getClientType())){
WxmpTemplateListResultDTO result = ConvertUtils.sourceToTarget(l, WxmpTemplateListResultDTO.class);
resultList.add(result);
}
});
return resultList;
}
}

1
epmet-module/epmet-message/epmet-message-server/src/main/resources/db/migration/V0.3.12.5__alter_user_message_add_column.sql

@ -0,0 +1 @@
ALTER TABLE user_message ADD REFERER VARCHAR(20) COMMENT '调用者';

4
epmet-module/epmet-oss/epmet-oss-server/pom.xml

@ -92,6 +92,10 @@
<artifactId>fastdfs-client</artifactId>
<version>${fastdfs.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-test</artifactId>
</dependency>
</dependencies>
<build>

7
epmet-module/epmet-oss/epmet-oss-server/src/main/java/com/epmet/cloud/AbstractCloudStorageService.java

@ -11,6 +11,7 @@ package com.epmet.cloud;
import com.epmet.commons.tools.utils.DateUtils;
import org.apache.commons.lang3.StringUtils;
import java.io.IOException;
import java.io.InputStream;
import java.util.Date;
import java.util.UUID;
@ -75,4 +76,10 @@ public abstract class AbstractCloudStorageService {
*/
public abstract String uploadSuffix(InputStream inputStream, String suffix);
/**
* 文件下载
* sun
*/
public abstract void down() throws IOException;
}

54
epmet-module/epmet-oss/epmet-oss-server/src/main/java/com/epmet/cloud/AliyunCloudStorageService.java

@ -9,10 +9,13 @@
package com.epmet.cloud;
import com.aliyun.oss.OSSClient;
import com.aliyun.oss.model.DownloadFileRequest;
import com.aliyun.oss.model.DownloadFileResult;
import com.epmet.commons.tools.exception.RenException;
import com.epmet.exception.ModuleErrorCode;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
/**
@ -54,4 +57,55 @@ public class AliyunCloudStorageService extends AbstractCloudStorageService {
public String uploadSuffix(InputStream inputStream, String suffix) {
return upload(inputStream, getPath(config.getAliyunPrefix(), suffix));
}
@Override
public void down() throws IOException {
OSSClient client = new OSSClient(config.getAliyunEndPoint(), config.getAliyunAccessKeyId(),
config.getAliyunAccessKeySecret());
try {
/*
//方式一
File file = new File("C:/Users/Administrator/Desktop/dd/df.jpg");
client.getObject(new GetObjectRequest(config.getAliyunBucketName(), "epmet/test/20201103/198f3c11490a44eb964c5c8e9989a507.jpg"), file);*/
/*
//方式二
OSSObject oo = client.getObject(config.getAliyunBucketName(), path);
InputStream is = oo.getObjectContent();
OutputStream os = null;
File file = new File("C:/Users/Administrator/Desktop/dd/aa.jpg");
try {
os = new FileOutputStream(file);
int len = 0;
byte[] buffer = new byte[8192];
while ((len = is.read(buffer)) != -1) {
os.write(buffer, 0, len);
}
} finally {
os.close();
is.close();
}*/
//方式三
DownloadFileRequest downloadFileRequest = new DownloadFileRequest(config.getAliyunBucketName(), "epmet/test/20201103/198f3c11490a44eb964c5c8e9989a507.jpg");
downloadFileRequest.setDownloadFile("C:/Users/Administrator/Desktop/dd/4.jpg");// 本地下载文件名称
downloadFileRequest.setPartSize(1 * 1024 * 1024);// 分片大小,取值范围为1B~5GB。
downloadFileRequest.setTaskNum(10);//10个任务并发下载,默认值为1
downloadFileRequest.setEnableCheckpoint(true);// 启动断点续传
// 下载文件
DownloadFileResult downloadRes = client.downloadFile(downloadFileRequest);
// 下载成功时,会返回文件元信息。
downloadRes.getObjectMetadata();
// 关闭OSSClient。
client.shutdown();
} catch (Exception e){
throw new RenException(ModuleErrorCode.OSS_UPLOAD_FILE_ERROR, e, "");
} catch (Throwable throwable) {
throwable.printStackTrace();
}
}
}

6
epmet-module/epmet-oss/epmet-oss-server/src/main/java/com/epmet/cloud/FastDFSCloudStorageService.java

@ -15,6 +15,7 @@ import com.epmet.commons.tools.utils.SpringContextUtils;
import com.epmet.exception.ModuleErrorCode;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
/**
@ -59,4 +60,9 @@ public class FastDFSCloudStorageService extends AbstractCloudStorageService {
public String uploadSuffix(InputStream inputStream, String suffix) {
return upload(inputStream, suffix);
}
@Override
public void down() throws IOException {
}
}

5
epmet-module/epmet-oss/epmet-oss-server/src/main/java/com/epmet/cloud/LocalCloudStorageService.java

@ -53,4 +53,9 @@ public class LocalCloudStorageService extends AbstractCloudStorageService {
public String uploadSuffix(InputStream inputStream, String suffix) {
return upload(inputStream, getPath(config.getLocalPrefix(), suffix));
}
@Override
public void down() throws IOException {
}
}

5
epmet-module/epmet-oss/epmet-oss-server/src/main/java/com/epmet/cloud/QcloudCloudStorageService.java

@ -83,4 +83,9 @@ public class QcloudCloudStorageService extends AbstractCloudStorageService {
public String uploadSuffix(InputStream inputStream, String suffix) {
return upload(inputStream, getPath(config.getQcloudPrefix(), suffix));
}
@Override
public void down() throws IOException {
}
}

5
epmet-module/epmet-oss/epmet-oss-server/src/main/java/com/epmet/cloud/QiniuCloudStorageService.java

@ -77,4 +77,9 @@ public class QiniuCloudStorageService extends AbstractCloudStorageService {
public String uploadSuffix(InputStream inputStream, String suffix) {
return upload(inputStream, getPath(config.getQiniuPrefix(), suffix));
}
@Override
public void down() throws IOException {
}
}

53
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.constant.NumConstant;
import com.epmet.commons.tools.exception.EpmetErrorCode;
import com.epmet.commons.tools.exception.RenException;
import com.epmet.commons.tools.page.PageData;
@ -31,12 +32,20 @@ import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.io.FilenameUtils;
import org.apache.http.entity.ContentType;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.mock.web.MockMultipartFile;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import springfox.documentation.annotations.ApiIgnore;
import javax.imageio.ImageIO;
import java.awt.image.BufferedImage;
import java.io.IOException;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.Arrays;
import java.util.Map;
@ -218,4 +227,48 @@ public class OssController {
return ossService.uploadImg(file);
}
@PostMapping("uploadimg/badgeicon")
public Result<UploadImgResultDTO> badgeIcon(@RequestParam("file") MultipartFile file) throws IOException {
// 校验文件类型
if (!MediaType.IMAGE_PNG_VALUE.equals(file.getContentType())) {
log.error("uploadArticleImg file type:{} is not support 2 upload", file.getContentType());
throw new RenException(EpmetErrorCode.OPER_UPLOAD_IMG_TYPE_ERROR.getCode()
, EpmetErrorCode.OPER_UPLOAD_IMG_TYPE_ERROR.getMsg());
}
// 校验文件体积,不超过2m
long maxSize = 2 * 1024 * 1024;
long size = file.getSize();
if (size > maxSize) {
throw new RenException(EpmetErrorCode.OPER_UPLOAD_FILE_OVER_SIZE.getCode()
, EpmetErrorCode.OPER_UPLOAD_FILE_OVER_SIZE.getMsg());
}
BufferedImage bufferedImage = ImageIO.read(file.getInputStream());
int width = bufferedImage.getWidth();
int height = bufferedImage.getHeight();
if (width != 200 || height != 200) {
throw new RenException(EpmetErrorCode.OPER_UPLOAD_IMG_SIZE_ERROR.getCode()
, EpmetErrorCode.OPER_UPLOAD_IMG_SIZE_ERROR.getMsg());
}
return ossService.uploadImg(file);
}
/**
* @param byteFile fileName
* @Description 外挂-文件上传
* @Author sun
**/
@PostMapping("ext/upload")
public Result<UploadImgResultDTO> extUpload(@RequestParam("byteFile") byte[] byteFile, @RequestParam("fileName") String fileName) throws IOException {
//public Result<UploadImgResultDTO> extUpload(@RequestParam("file") MultipartFile file, @RequestParam("fileName") String fileName) throws IOException {
//byte[] byteFile = file.getBytes();
InputStream inputStream = new ByteArrayInputStream(byteFile);
MultipartFile filse = new MockMultipartFile(ContentType.APPLICATION_OCTET_STREAM.toString(), inputStream);
return ossService.extUpload(filse,fileName);
}
}

2
epmet-module/epmet-oss/epmet-oss-server/src/main/java/com/epmet/service/OssService.java

@ -29,4 +29,6 @@ public interface OssService extends BaseService<OssEntity> {
int insertOssEntity(OssEntity ossEntity);
Result<UploadImgResultDTO> uploadImg(MultipartFile file);
Result<UploadImgResultDTO> extUpload(MultipartFile file, String fileName);
}

32
epmet-module/epmet-oss/epmet-oss-server/src/main/java/com/epmet/service/impl/OssServiceImpl.java

@ -72,4 +72,36 @@ public class OssServiceImpl extends BaseServiceImpl<OssDao, OssEntity> implement
dto.setUrl(url);
return new Result<UploadImgResultDTO>().ok(dto);
}
@Override
public Result<UploadImgResultDTO> extUpload(MultipartFile file, String fileName) {
try {
OssFactory.build().down();
} catch (IOException e) {
e.printStackTrace();
}
if (file.isEmpty()) {
return new Result<UploadImgResultDTO>().error(ModuleErrorCode.UPLOAD_FILE_EMPTY);
}
//上传文件
String extension = FilenameUtils.getExtension(fileName);
String url = null;
try {
url = OssFactory.build().uploadSuffix(file.getBytes(), extension);
} catch (IOException e) {
e.printStackTrace();
logger.error("图片上传异常");
throw new RenException("图片上传异常");
}
//保存文件信息
OssEntity ossEntity = new OssEntity();
ossEntity.setUrl(url);
baseDao.insert(ossEntity);
//文件信息
UploadImgResultDTO dto = new UploadImgResultDTO();
dto.setUrl(url);
return new Result<UploadImgResultDTO>().ok(dto);
}
}

32
epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/AgencyInfoFormDTO.java

@ -0,0 +1,32 @@
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;
/**
* 对外接口-根据组织Id获取组织信息-接口入参
* @Author sun
*/
@Data
public class AgencyInfoFormDTO implements Serializable {
private static final long serialVersionUID = -1719033407335647411L;
/**
* 组织或网格Id
*/
@NotBlank(message = "组织或网格Id不能为空", groups = StaffIdGroup.class)
private String orgId;
/**
* 组织或网格类型agency/grid
*/
@NotBlank(message = "组织或网格类型不能为空", groups = StaffIdGroup.class)
private String orgType;
public interface StaffIdGroup extends CustomerClientShowGroup {
}
}

66
epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/AgencyInfoResultDTO.java

@ -0,0 +1,66 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.epmet.dto.result;
import lombok.Data;
import java.io.Serializable;
/**
* 组织信息
*
* @author sun
*/
@Data
public class AgencyInfoResultDTO implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 客户ID
*/
private String customerId;
/**
* 机关组织Id
*/
private String agencyId;
/**
* 机关组织名称
*/
private String agencyName;
/**
* 所有上级名称,-连接
*/
private String allParentName;
/**
* 上级组织机构ID
*/
private String pid;
/**
* 所有上级组织机构ID(以英文:隔开)
*/
private String pids;
/**
* 机关级别社区级community街道:street,区县级: district,市级: city省级:province
*/
private String level;
/**
* 地区编码
*/
private String areaCode;
}

31
epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/OrganizeTreeDeptResultDTO.java

@ -0,0 +1,31 @@
package com.epmet.dto.result;
import lombok.Data;
import java.io.Serializable;
/**
* @Description 外挂-部门信息
* @Auth sun
*/
@Data
public class OrganizeTreeDeptResultDTO implements Serializable {
private static final long serialVersionUID = 1792371558965832432L;
/**
* 部门Id
* */
private String deptId;
/**
* 部门名称
* */
private String deptName;
/**
* 所有上级组织机构ID(以英文:隔开)
*/
private String pids;
/**
* 所有上级名称,-连接
*/
private String allParentName;
}

31
epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/OrganizeTreeGridResultDTO.java

@ -0,0 +1,31 @@
package com.epmet.dto.result;
import lombok.Data;
import java.io.Serializable;
/**
* @Description 外挂-网格信息
* @Auth sun
*/
@Data
public class OrganizeTreeGridResultDTO implements Serializable {
private static final long serialVersionUID = -4531574240525562587L;
/**
* 网格Id
* */
private String gridId;
/**
* 网格名称
* */
private String gridName;
/**
* 所有上级组织机构ID(以英文:隔开)
*/
private String pids;
/**
* 所有上级名称,-连接
*/
private String allParentName;
}

50
epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/OrganizeTreeResultDTO.java

@ -0,0 +1,50 @@
package com.epmet.dto.result;
import lombok.Data;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
/**
* @Description 外挂-获取当前组织及部门网格数据递归查询所有下级数据-接口返参
* @Auth sun
*/
@Data
public class OrganizeTreeResultDTO implements Serializable {
private static final long serialVersionUID = 2513553862809278219L;
/**
* 直属机关Id
* */
private String agencyId;
/**
* 直属机关名称
* */
private String agencyName;
/**
* 机关级别社区级community 街道:street, 区县级: district, 市级: city 省级:province
* */
private String level;
/**
* 所有上级组织机构ID(以英文:隔开)
*/
private String pids;
/**
* 所有上级名称,-连接
*/
private String allParentName;
/**
* 直属机关直属网格列表
* */
private List<OrganizeTreeGridResultDTO> gridList = new ArrayList<>();
/**
* 直属机关直属部门列表
* */
private List<OrganizeTreeDeptResultDTO> departmentList = new ArrayList<>();
/**
* 子集机关列表
* */
private List<OrganizeTreeResultDTO> subAgencyList = new ArrayList<>();
}

16
epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/feign/GovOrgOpenFeignClient.java

@ -259,4 +259,20 @@ public interface GovOrgOpenFeignClient {
*/
@PostMapping("/gov/org/agency/subagencylist")
Result<SubAgencyResultDTO> subAgencyList(@RequestBody SubAgencyFormDTO formDTO);
/**
* @param formDTO
* @Author sun
* @Description 根据组织Id获取组织信息
*/
@PostMapping("/gov/org/customeragency/agencyinfo")
Result<AgencyInfoResultDTO> agencyInfo(@RequestBody AgencyInfoFormDTO formDTO);
/**
* @param agencyId
* @Author sun
* @Description 获取当前组织及部门网格数据递归查询所有下级数据
*/
@PostMapping("/gov/org/customeragency/organizetree/{agencyId}")
Result<OrganizeTreeResultDTO> organizeTree(@PathVariable("agencyId") String agencyId);
}

10
epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/feign/fallback/GovOrgOpenFeignClientFallback.java

@ -151,4 +151,14 @@ public class GovOrgOpenFeignClientFallback implements GovOrgOpenFeignClient {
public Result<SubAgencyResultDTO> subAgencyList(SubAgencyFormDTO formDTO) {
return ModuleUtils.feignConError(ServiceConstant.GOV_ORG_SERVER, "subAgencyList", formDTO);
}
@Override
public Result<AgencyInfoResultDTO> agencyInfo(AgencyInfoFormDTO formDTO) {
return ModuleUtils.feignConError(ServiceConstant.GOV_ORG_SERVER, "agencyInfo", formDTO);
}
@Override
public Result<OrganizeTreeResultDTO> organizeTree(String agencyId) {
return ModuleUtils.feignConError(ServiceConstant.GOV_ORG_SERVER, "organizeTree", agencyId);
}
}

18
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/CustomerAgencyController.java

@ -242,4 +242,22 @@ public class CustomerAgencyController {
public Result<StaffInAgencyListResultDTO> staffInAgencyList(@LoginUser TokenDto tokenDTO) {
return new Result<StaffInAgencyListResultDTO>().ok(customerAgencyService.staffInAgencyList(tokenDTO.getUserId()));
}
/**
* @Description 对外接口-根据组织Id获取组织信息
* @author sun
**/
@PostMapping("agencyinfo")
Result<AgencyInfoResultDTO> agencyInfo(@RequestBody AgencyInfoFormDTO formDTO) {
return new Result<AgencyInfoResultDTO>().ok(customerAgencyService.agencyInfo(formDTO));
}
/**
* @Description 外挂-获取当前组织及部门网格数据递归查询所有下级数据
* @author sun
**/
@PostMapping("organizetree/{agencyId}")
Result<OrganizeTreeResultDTO> organizeTree(@PathVariable("agencyId") String agencyId) {
return new Result<OrganizeTreeResultDTO>().ok(customerAgencyService.organizeTree(agencyId));
}
}

21
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerAgencyDao.java

@ -175,4 +175,25 @@ public interface CustomerAgencyDao extends BaseDao<CustomerAgencyEntity> {
* @Description 查询工作人员所属组织信息
**/
AgencyResultDTO selectAgencyByStaffId(@Param("staffId") String staffId);
/**
* @Description 外挂-获取当前组织及部门网格数据递归查询所有下级数据
* @author sun
**/
OrganizeTreeResultDTO selectorganizeTree(@Param("agencyId") String agencyId);
/**
* @Description 外挂-获取当前组织及部门网格数据递归查询所有下级数据
* @author sun
**/
List<OrganizeTreeGridResultDTO> selectAgencyGridList(@Param("agencyId") String agencyId);
/**
* @Description 外挂-获取当前组织及部门网格数据递归查询所有下级数据
* @author sun
**/
List<OrganizeTreeDeptResultDTO> selectAgencyDeptList(@Param("agencyId") String agencyId);
/**
* @Description 外挂-获取当前组织及部门网格数据递归查询所有下级数据
* @author sun
**/
List<OrganizeTreeResultDTO> selectAllSub(@Param("agencyId") String agencyId);
}

12
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/CustomerAgencyService.java

@ -213,4 +213,16 @@ public interface CustomerAgencyService extends BaseService<CustomerAgencyEntity>
* @Description 工作端-查询当前人员所属组织及所有下级组织
**/
StaffInAgencyListResultDTO staffInAgencyList(String staffId);
/**
* @Description 对外接口-根据组织Id获取组织信息
* @author sun
**/
AgencyInfoResultDTO agencyInfo(AgencyInfoFormDTO formDTO);
/**
* @Description 外挂-获取当前组织及部门网格数据递归查询所有下级数据
* @author sun
**/
OrganizeTreeResultDTO organizeTree(String agencyId);
}

36
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerAgencyServiceImpl.java

@ -994,4 +994,40 @@ public class CustomerAgencyServiceImpl extends BaseServiceImpl<CustomerAgencyDao
return resultDTO;
}
/**
* @Description 对外接口-根据组织Id获取组织信息
* @author sun
**/
@Override
public AgencyInfoResultDTO agencyInfo(AgencyInfoFormDTO formDTO) {
AgencyInfoResultDTO resultDTO = new AgencyInfoResultDTO();
String agencyId = formDTO.getOrgId();
//1.判断是否为网格类型,是网格则查询网格基本信息
if("grid".equals(formDTO.getOrgType())){
CustomerGridEntity gridEntity = customerGridDao.selectById(formDTO.getOrgId());
if(null == gridEntity){
logger.error(String.format("根据网格Id未查询到网格数据,网格Id:%s", formDTO.getOrgId()));
throw new RenException("获取网格数据失败,根据网格Id未查询到网格数据");
}
agencyId = gridEntity.getPid();
}
//2.查询组织基本信息
CustomerAgencyEntity entity = baseDao.selectById(agencyId);
if(entity!=null){
resultDTO = ConvertUtils.sourceToTarget(entity, AgencyInfoResultDTO.class);
resultDTO.setAgencyId(entity.getId());
resultDTO.setAgencyName(entity.getOrganizationName());
}
return resultDTO;
}
/**
* @Description 外挂-获取当前组织及部门网格数据递归查询所有下级数据
* @author sun
**/
@Override
public OrganizeTreeResultDTO organizeTree(String agencyId) {
return baseDao.selectorganizeTree(agencyId);
}
}

81
epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerAgencyDao.xml

@ -292,4 +292,85 @@
AND csa.user_id = #{staffId}
</select>
<!-- sql递归 查询组织、组织下部门、组织下网格基本信息及递归查询下级信息 start-->
<resultMap id="organizeTree" type="com.epmet.dto.result.OrganizeTreeResultDTO">
<id column="agencyId" property="agencyId"/>
<result column="agencyName" property="agencyName"/>
<result column="level" property="level"/>
<result column="pids" property="pids"/>
<result column="allParentName" property="allParentName"/>
<collection property="gridList" column="agencyId" ofType="com.epmet.dto.result.OrganizeTreeGridResultDTO" select="selectAgencyGridList">
<id column="gridId" property="gridId"/>
<result column="gridName" property="gridName"/>
<result column="pids" property="pids"/>
<result column="allParentName" property="allParentName"/>
</collection>
<collection property="departmentList" column="agencyId" ofType="com.epmet.dto.result.OrganizeTreeDeptResultDTO" select="selectAgencyDeptList">
<id column="deptId" property="deptId"/>
<result column="deptName" property="deptName"/>
<result column="pids" property="pids"/>
<result column="allParentName" property="allParentName"/>
</collection>
<collection property="subAgencyList" column="agencyId" ofType="com.epmet.dto.result.ExtStaffPermissionResultDTO" select="selectAllSub">
</collection>
</resultMap>
<select id="selectorganizeTree" resultMap="organizeTree">
SELECT
ca.id AS agencyId,
ca.organization_name AS agencyName,
ca.level AS level,
ca.pids AS pids,
ca.all_parent_name AS allParentName
FROM
customer_agency ca
WHERE
ca.del_flag = '0'
AND ca.id = #{agencyId}
</select>
<select id="selectAgencyGridList" resultType="com.epmet.dto.result.OrganizeTreeGridResultDTO">
SELECT
cg.id AS gridId,
cg.grid_name AS gridName,
CONCAT(ca.pids,if(ca.pids="","",":"),ca.id) AS pids,
CONCAT(ca.all_parent_name,if(ca.all_parent_name="","","-"),ca.organization_name) AS allParentName
FROM
customer_grid cg
LEFT JOIN customer_agency ca ON cg.pid = ca.id
WHERE
cg.del_flag = '0'
AND ca.del_flag = '0'
AND cg.pid = #{agencyId}
</select>
<select id="selectAgencyDeptList" resultType="com.epmet.dto.result.OrganizeTreeDeptResultDTO">
SELECT
cd.id AS deptId,
cd.department_name AS deptName,
CONCAT(ca.pids,if(ca.pids="","",":"),ca.id) AS pids,
CONCAT(ca.all_parent_name,if(ca.all_parent_name="","","-"),ca.organization_name) AS allParentName
FROM
customer_department cd
LEFT JOIN customer_agency ca ON cd.agency_id = ca.id
WHERE
cd.del_flag = '0'
AND ca.del_flag = '0'
AND cd.agency_id = #{agencyId}
</select>
<select id="selectAllSub" resultMap="organizeTree">
SELECT
ca.id AS agencyId,
ca.organization_name AS agencyName,
ca.level AS level,
ca.pids AS pids,
ca.all_parent_name AS allParentName
FROM
customer_agency ca
WHERE
ca.del_flag = '0'
AND ca.pid = #{agencyId}
</select>
<!-- sql递归 查询组织、组织下部门、组织下网格基本信息及递归查询下级信息 end-->
</mapper>

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

@ -1187,7 +1187,7 @@ public class ArticleServiceImpl extends BaseServiceImpl<ArticleDao, ArticleEntit
List<WxSubscribeMessageFormDTO> msgList = new ArrayList<>();
WxSubscribeMessageFormDTO formDTO = new WxSubscribeMessageFormDTO();
formDTO.setCustomerId(customerId);
formDTO.setClientType(AppClientConstant.APP_RESI);
formDTO.setClientType(AppClientConstant.APP_GOV);
formDTO.setUserId(loginUserUtil.getLoginUserId());
formDTO.setBehaviorType(String.format(ModuleConstant.WXMP_MSG_TITLE, title));
formDTO.setMessageContent(content);

29
epmet-module/resi-mine/resi-mine-client/src/main/java/com/epmet/resi/mine/dto/from/BadgeListFormDTO.java

@ -0,0 +1,29 @@
package com.epmet.resi.mine.dto.from;
import lombok.Data;
import javax.validation.constraints.NotBlank;
import java.io.Serializable;
/**
* @Author zxc
* @DateTime 2020/11/3 11:07 上午
*/
@Data
public class BadgeListFormDTO implements Serializable {
private static final long serialVersionUID = 9082922684993474574L;
public interface BadgeList{}
/**
* 用户ID
*/
private String userId;
/**
* 客户ID
*/
@NotBlank(message = "客户ID不能为空",groups = {BadgeList.class})
private String customerId;
}

21
epmet-module/resi-mine/resi-mine-client/src/main/java/com/epmet/resi/mine/dto/from/OperListFormDTO.java

@ -0,0 +1,21 @@
package com.epmet.resi.mine.dto.from;
import lombok.Data;
import javax.validation.constraints.NotBlank;
import java.io.Serializable;
/**
* @Author zxc
* @DateTime 2020/11/3 4:18 下午
*/
@Data
public class OperListFormDTO implements Serializable {
private static final long serialVersionUID = -1872129597916414752L;
public interface OperList{}
@NotBlank(message = "客户ID不能为空",groups = {OperList.class})
private String customerId;
}

32
epmet-module/resi-mine/resi-mine-client/src/main/java/com/epmet/resi/mine/dto/result/BadgeListResultDTO.java

@ -0,0 +1,32 @@
package com.epmet.resi.mine.dto.result;
import lombok.Data;
import java.io.Serializable;
/**
* @Author zxc
* @DateTime 2020/11/3 11:08 上午
*/
@Data
public class BadgeListResultDTO implements Serializable {
private static final long serialVersionUID = -6542233940679158922L;
/**
* 徽章ID
*/
private String badgeId;
/**
* 徽章图片地址
*/
private String badgeIcon;
/**
* 徽章是否点亮
*/
private String isOpened;
private String badgeType;
}

39
epmet-module/resi-mine/resi-mine-client/src/main/java/com/epmet/resi/mine/dto/result/InitInfoResultDTO.java

@ -0,0 +1,39 @@
package com.epmet.resi.mine.dto.result;
import lombok.Data;
import java.io.Serializable;
/**
* @author zhaoqifeng
* @dscription
* @date 2020/11/3 9:58
*/
@Data
public class InitInfoResultDTO implements Serializable {
private static final long serialVersionUID = 144944007101324497L;
/**
* 头像
*/
private String headImgUrl;
/**
*
*/
private String surname;
/**
*
*/
private String name;
/**
* 路牌号
*/
private String street;
/**
* 小区名称
*/
private String district;
/**
* 详细地址
*/
private String buildingAddress;
}

51
epmet-module/resi-mine/resi-mine-client/src/main/java/com/epmet/resi/mine/dto/result/OperListResultDTO.java

@ -0,0 +1,51 @@
package com.epmet.resi.mine.dto.result;
import lombok.Data;
import java.io.Serializable;
/**
* @Author zxc
* @DateTime 2020/11/3 4:20 下午
*/
@Data
public class OperListResultDTO implements Serializable {
private static final long serialVersionUID = -6185696177370545937L;
/**
* 徽章ID
*/
private String badgeId;
/**
* 徽章名字
*/
private String badgeName;
/**
* 点亮状态 yes已点亮no未点亮
*/
private String isLighted;
/**
* 是否认证 yes 认证 no 已认证
*/
private String isCertificated;
/**
* 徽章图片地址
*/
private String badgeIcon;
/**
* 是否被驳回 true已驳回false未驳回
*/
private Boolean isReject;
/**
* 徽章类型党员徽章partynone
*/
private String badgeType;
}

85
epmet-module/resi-mine/resi-mine-server/src/main/java/com/epmet/modules/badege/controller/BadgeController.java

@ -0,0 +1,85 @@
package com.epmet.modules.badege.controller;
import com.epmet.commons.tools.annotation.LoginUser;
import com.epmet.commons.tools.security.dto.TokenDto;
import com.epmet.commons.tools.utils.Result;
import com.epmet.commons.tools.validator.ValidatorUtils;
import com.epmet.dto.form.OpenedOrClosedFormDTO;
import com.epmet.modules.badege.service.BadgeService;
import com.epmet.resi.mine.dto.from.BadgeListFormDTO;
import com.epmet.dto.form.CertificationAddFormDTO;
import com.epmet.resi.mine.dto.from.OperListFormDTO;
import com.epmet.resi.mine.dto.result.BadgeListResultDTO;
import com.epmet.resi.mine.dto.result.OperListResultDTO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
/**
* @Author zxc
* @DateTime 2020/11/3 10:42 上午
*/
@RestController
@RequestMapping("badge")
public class BadgeController {
@Autowired
private BadgeService badgeService;
/**
* @Description 个人中心-获取个人徽章点亮列表
* @Param badgeListFormDTO
* @author zxc
* @date 2020/11/3 4:11 下午
*/
@PostMapping("list")
public Result<List<BadgeListResultDTO>> getBadgeList(@LoginUser TokenDto tokenDto,@RequestBody BadgeListFormDTO badgeListFormDTO){
ValidatorUtils.validateEntity(badgeListFormDTO, BadgeListFormDTO.BadgeList.class);
return new Result<List<BadgeListResultDTO>>().ok(badgeService.getBadgeList(tokenDto,badgeListFormDTO));
}
/**
* @Description 个人中心-获取徽章可操作列表点亮取消认证
* @Param operListFormDTO
* @author zxc
* @date 2020/11/3 4:28 下午
*/
@PostMapping("operlist")
public Result<List<OperListResultDTO>> getOperList(@LoginUser TokenDto tokenDto,@RequestBody OperListFormDTO operListFormDTO){
ValidatorUtils.validateEntity(operListFormDTO, OperListFormDTO.OperList.class);
return new Result<List<OperListResultDTO>>().ok(badgeService.getOperList(tokenDto,operListFormDTO));
}
/**
* @Description 个人中心-提交徽章认证
* @Param tokenDto
* @Param certificationAddFormDTO
* @author zxc
* @date 2020/11/4 11:16 上午
*/
@PostMapping("certification/add")
public Result certificationAdd(@LoginUser TokenDto tokenDto,@RequestBody CertificationAddFormDTO certificationAddFormDTO){
ValidatorUtils.validateEntity(certificationAddFormDTO, CertificationAddFormDTO.CertificationAdd.class);
badgeService.certificationAdd(tokenDto,certificationAddFormDTO);
return new Result();
}
/**
* @Description 个人中心-取消/点亮徽章
* @Param openedOrClosedFormDTO
* @author zxc
* @date 2020/11/5 9:23 上午
*/
@PostMapping("openedorclosed")
public Result openedOrClosed(@LoginUser TokenDto tokenDto,@RequestBody OpenedOrClosedFormDTO openedOrClosedFormDTO){
ValidatorUtils.validateEntity(openedOrClosedFormDTO, OpenedOrClosedFormDTO.OpenedOrClosed.class);
badgeService.openedOrClosed(tokenDto,openedOrClosedFormDTO);
return new Result();
}
}

52
epmet-module/resi-mine/resi-mine-server/src/main/java/com/epmet/modules/badege/service/BadgeService.java

@ -0,0 +1,52 @@
package com.epmet.modules.badege.service;
import com.epmet.commons.tools.security.dto.TokenDto;
import com.epmet.dto.form.OpenedOrClosedFormDTO;
import com.epmet.resi.mine.dto.from.BadgeListFormDTO;
import com.epmet.dto.form.CertificationAddFormDTO;
import com.epmet.resi.mine.dto.from.OperListFormDTO;
import com.epmet.resi.mine.dto.result.BadgeListResultDTO;
import com.epmet.resi.mine.dto.result.OperListResultDTO;
import java.util.List;
/**
* @Author zxc
* @DateTime 2020/11/3 10:52 上午
*/
public interface BadgeService {
/**
* @Description 个人中心-获取个人徽章点亮列表
* @Param badgeListFormDTO
* @author zxc
* @date 2020/11/3 4:11 下午
*/
List<BadgeListResultDTO> getBadgeList(TokenDto tokenDto,BadgeListFormDTO badgeListFormDTO);
/**
* @Description 个人中心-获取徽章可操作列表点亮取消认证
* @Param operListFormDTO
* @author zxc
* @date 2020/11/3 4:28 下午
*/
List<OperListResultDTO> getOperList(TokenDto tokenDto,OperListFormDTO operListFormDTO);
/**
* @Description 个人中心-提交徽章认证
* @Param tokenDto
* @Param certificationAddFormDTO
* @author zxc
* @date 2020/11/4 11:16 上午
*/
void certificationAdd(TokenDto tokenDto, CertificationAddFormDTO certificationAddFormDTO);
/**
* @Description 个人中心-取消/点亮徽章
* @Param openedOrClosedFormDTO
* @author zxc
* @date 2020/11/5 9:23 上午
*/
void openedOrClosed(TokenDto tokenDto,OpenedOrClosedFormDTO openedOrClosedFormDTO);
}

111
epmet-module/resi-mine/resi-mine-server/src/main/java/com/epmet/modules/badege/service/impl/BadgeServiceImpl.java

@ -0,0 +1,111 @@
package com.epmet.modules.badege.service.impl;
import com.epmet.commons.tools.exception.RenException;
import com.epmet.commons.tools.security.dto.TokenDto;
import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.commons.tools.utils.Result;
import com.epmet.dto.form.OpenedOrClosedFormDTO;
import com.epmet.dto.form.UserBadgeListFormDTO;
import com.epmet.dto.form.UserOperListFormDTO;
import com.epmet.dto.result.UserBadgeListResultDTO;
import com.epmet.dto.result.UserOperListResultDTO;
import com.epmet.feign.EpmetUserOpenFeignClient;
import com.epmet.modules.badege.service.BadgeService;
import com.epmet.resi.mine.dto.from.BadgeListFormDTO;
import com.epmet.dto.form.CertificationAddFormDTO;
import com.epmet.resi.mine.dto.from.OperListFormDTO;
import com.epmet.resi.mine.dto.result.BadgeListResultDTO;
import com.epmet.resi.mine.dto.result.OperListResultDTO;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.List;
/**
* @Author zxc
* @DateTime 2020/11/3 10:53 上午
*/
@Service
@Slf4j
public class BadgeServiceImpl implements BadgeService {
@Autowired
private EpmetUserOpenFeignClient epmetUserOpenFeignClient;
/**
* @Description 个人中心-获取个人徽章点亮列表
* @Param badgeListFormDTO
* @author zxc
* @date 2020/11/3 4:11 下午
*/
@Override
public List<BadgeListResultDTO> getBadgeList(TokenDto tokenDto,BadgeListFormDTO badgeListFormDTO) {
UserBadgeListFormDTO form = new UserBadgeListFormDTO();
form.setCustomerId(badgeListFormDTO.getCustomerId());
form.setUserId(tokenDto.getUserId());
Result<List<UserBadgeListResultDTO>> listResult = epmetUserOpenFeignClient.selectBadgeList(form);
if (!listResult.success()){
throw new RenException("获取徽章点亮列表失败......");
}
if (null == listResult.getData()){
return new ArrayList<>();
}
List<BadgeListResultDTO> result = ConvertUtils.sourceToTarget(listResult.getData(), BadgeListResultDTO.class);
return result;
}
/**
* @Description 个人中心-获取徽章可操作列表点亮取消认证
* @Param operListFormDTO
* @author zxc
* @date 2020/11/3 4:28 下午
*/
@Override
public List<OperListResultDTO> getOperList(TokenDto tokenDto,OperListFormDTO operListFormDTO) {
UserOperListFormDTO userOperListFormDTO = new UserOperListFormDTO();
userOperListFormDTO.setCustomerId(operListFormDTO.getCustomerId());
userOperListFormDTO.setUserId(tokenDto.getUserId());
Result<List<UserOperListResultDTO>> listResult = epmetUserOpenFeignClient.selectOperList(userOperListFormDTO);
if (!listResult.success()){
throw new RenException("获取徽章列表失败......");
}
if (null == listResult.getData()){
return new ArrayList<>();
}
List<OperListResultDTO> result = ConvertUtils.sourceToTarget(listResult.getData(), OperListResultDTO.class);
return result;
}
/**
* @Description 个人中心-提交徽章认证
* @Param tokenDto
* @Param certificationAddFormDTO
* @author zxc
* @date 2020/11/4 11:16 上午
*/
@Override
public void certificationAdd(TokenDto tokenDto, CertificationAddFormDTO certificationAddFormDTO) {
certificationAddFormDTO.setUserId(tokenDto.getUserId());
Result result = epmetUserOpenFeignClient.authBadgeRecord(certificationAddFormDTO);
if (!result.success()){
throw new RenException("提交徽章认证失败......");
}
}
/**
* @Description 个人中心-取消/点亮徽章
* @Param openedOrClosedFormDTO
* @author zxc
* @date 2020/11/5 9:23 上午
*/
@Override
public void openedOrClosed(TokenDto tokenDto,OpenedOrClosedFormDTO openedOrClosedFormDTO) {
openedOrClosedFormDTO.setUserId(tokenDto.getUserId());
Result result = epmetUserOpenFeignClient.openedOrClosed(openedOrClosedFormDTO);
if (!result.success()){
throw new RenException("取消/点亮徽章失败了......");
}
}
}

55
epmet-module/resi-mine/resi-mine-server/src/main/java/com/epmet/modules/mine/controller/PersonalCenterController.java

@ -0,0 +1,55 @@
package com.epmet.modules.mine.controller;
import com.epmet.commons.tools.annotation.LoginUser;
import com.epmet.commons.tools.security.dto.TokenDto;
import com.epmet.commons.tools.utils.Result;
import com.epmet.dto.form.EditInfoFormDTO;
import com.epmet.modules.mine.service.PersonalCenterService;
import com.epmet.resi.mine.dto.result.InitInfoResultDTO;
import lombok.extern.slf4j.Slf4j;
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;
/**
* 个人中心
* @author zhaoqifeng
* @date 2020/11/3 9:48
*/
@Slf4j
@RestController
@RequestMapping("personalcenter")
public class PersonalCenterController {
@Autowired
private PersonalCenterService personalCenterService;
/**
* 修改信息页面初始化
* @author zhaoqifeng
* @date 2020/11/3 10:03
* @param tokenDto
* @return com.epmet.commons.tools.utils.Result<com.epmet.resi.mine.dto.result.InitInfoResultDTO>
*/
@PostMapping("initinfo")
public Result<InitInfoResultDTO> initInfo(@LoginUser TokenDto tokenDto) {
InitInfoResultDTO resultDTO = personalCenterService.initInfo(tokenDto);
return new Result<InitInfoResultDTO>().ok(resultDTO);
}
/**
* 修改信息
* @author zhaoqifeng
* @date 2020/11/3 10:03
* @param tokenDto
* @param formDTO
* @return com.epmet.commons.tools.utils.Result
*/
@PostMapping("editinfo")
public Result editInfo(@LoginUser TokenDto tokenDto, @RequestBody EditInfoFormDTO formDTO) {
personalCenterService.editInfo(tokenDto, formDTO);
return new Result();
}
}

17
epmet-module/resi-mine/resi-mine-server/src/main/java/com/epmet/modules/mine/service/PersonalCenterService.java

@ -0,0 +1,17 @@
package com.epmet.modules.mine.service;
import com.epmet.commons.tools.security.dto.TokenDto;
import com.epmet.dto.form.EditInfoFormDTO;
import com.epmet.resi.mine.dto.result.InitInfoResultDTO;
/**
* @author zhaoqifeng
* @dscription
* @date 2020/11/3 9:50
*/
public interface PersonalCenterService {
InitInfoResultDTO initInfo(TokenDto tokenDto);
void editInfo(TokenDto tokenDto, EditInfoFormDTO formDTO);
}

51
epmet-module/resi-mine/resi-mine-server/src/main/java/com/epmet/modules/mine/service/impl/PersonalCenterServiceImpl.java

@ -0,0 +1,51 @@
package com.epmet.modules.mine.service.impl;
import com.epmet.commons.tools.exception.RenException;
import com.epmet.commons.tools.security.dto.TokenDto;
import com.epmet.commons.tools.utils.Result;
import com.epmet.dto.form.EditInfoFormDTO;
import com.epmet.dto.result.ResiUserBaseInfoResultDTO;
import com.epmet.feign.EpmetUserOpenFeignClient;
import com.epmet.modules.mine.service.PersonalCenterService;
import com.epmet.resi.mine.dto.result.InitInfoResultDTO;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
/**
* @author zhaoqifeng
* @dscription
* @date 2020/11/3 9:50
*/
@Slf4j
@Service
public class PersonalCenterServiceImpl implements PersonalCenterService {
@Autowired
private EpmetUserOpenFeignClient epmetUserOpenFeignClient;
@Override
public InitInfoResultDTO initInfo(TokenDto tokenDto) {
Result<ResiUserBaseInfoResultDTO> baseInfoResult = epmetUserOpenFeignClient.selectUserBaseInfo(tokenDto);
if (!baseInfoResult.success()) {
throw new RenException(baseInfoResult.getCode(), baseInfoResult.getMsg());
}
InitInfoResultDTO resultDTO = new InitInfoResultDTO();
resultDTO.setHeadImgUrl(baseInfoResult.getData().getHeadImgUrl());
resultDTO.setSurname(baseInfoResult.getData().getSurname());
resultDTO.setName(baseInfoResult.getData().getName());
resultDTO.setStreet(baseInfoResult.getData().getStreet());
resultDTO.setDistrict(baseInfoResult.getData().getDistrict());
resultDTO.setBuildingAddress(baseInfoResult.getData().getBuildingAddress());
return resultDTO;
}
@Override
public void editInfo(TokenDto tokenDto, EditInfoFormDTO formDTO) {
formDTO.setUserId(tokenDto.getUserId());
Result result = epmetUserOpenFeignClient.editUserInfo(formDTO);
if (!result.success()) {
throw new RenException(result.getCode(), result.getMsg());
}
}
}

27
epmet-user/epmet-user-client/src/main/java/com/epmet/constant/BadgeConstant.java

@ -0,0 +1,27 @@
package com.epmet.constant;
/**
* @Author zxc
* @DateTime 2020/11/3 2:45 下午
*/
public interface BadgeConstant {
String BADGE_KEY = "epmet:badge:";
String BADGE = "badge";
String DEFAULT_CUSTOMER = "default";
String YES = "yes";
String NO = "no";
String REJECTED = "rejected";
String APPROVED = "approved";
String NONE ="none";
String SMS_CODE_KEY = "epmet:smsCode:badge:";
}

86
epmet-user/epmet-user-client/src/main/java/com/epmet/dto/BadgeCertificationConfigDTO.java

@ -0,0 +1,86 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.epmet.dto;
import java.io.Serializable;
import java.util.Date;
import lombok.Data;
/**
* 徽章认证配置
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2020-11-03
*/
@Data
public class BadgeCertificationConfigDTO implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 主键ID
*/
private String id;
/**
* 客户Id 默认配置iddefault
*/
private String customerId;
/**
* 徽章ID
*/
private String badgeId;
/**
* 认证信息类型 手机号:mobile全名:fullname;身份证:idcard;认证证件: certificate;认证说明(备注):remark
*/
private String certificationType;
/**
* 删除标识 1删除0未删除
*/
private String delFlag;
/**
* 乐观锁
*/
private Integer revision;
/**
* 创建人
*/
private String createdBy;
/**
* 创建时间
*/
private Date createdTime;
/**
* 更新人
*/
private String updatedBy;
/**
* 更新时间
*/
private Date updatedTime;
}

96
epmet-user/epmet-user-client/src/main/java/com/epmet/dto/BadgeDTO.java

@ -0,0 +1,96 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.epmet.dto;
import java.io.Serializable;
import java.util.Date;
import lombok.Data;
/**
* 徽章
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2020-11-03
*/
@Data
public class BadgeDTO implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 主键ID
*/
private String id;
/**
* 客户Id 默认配置iddefault
*/
private String customerId;
/**
* 徽章名称
*/
private String badgeName;
/**
* 徽章图标url
*/
private String badgeIcon;
/**
* 固有徽章类型 前端页面跳转标识党员徽章party;none
*/
private String fixationBadgeType;
/**
* 状态 上线:online;下线:offline;
*/
private String badgeStatus;
/**
* 删除标识 1删除0未删除
*/
private String delFlag;
/**
* 乐观锁
*/
private Integer revision;
/**
* 创建人
*/
private String createdBy;
/**
* 创建时间
*/
private Date createdTime;
/**
* 更新人
*/
private String updatedBy;
/**
* 更新时间
*/
private Date updatedTime;
}

45
epmet-user/epmet-user-client/src/main/java/com/epmet/dto/UserBadgeCertificateRecordDTO.java

@ -0,0 +1,45 @@
package com.epmet.dto;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
/**
* @Author zxc
* @DateTime 2020/11/4 1:46 下午
*/
@Data
public class UserBadgeCertificateRecordDTO implements Serializable {
private static final long serialVersionUID = 3207509834642386145L;
private String customerId;
private String gridId;
private String userId;
private String badgeId;
private String surname;
private String name;
private String mobile;
private String idNum;
private String certificationImg;
private String remark;
private String auditStatus;
private String auditRemark;
private String staffId;
private Date auditTime;
private String isLast;
private String delFlag;
private Integer revision;
private String createdBy;
private String updatedBy;
public UserBadgeCertificateRecordDTO() {
this.auditStatus = "auditing";
this.isLast = "yes";
this.delFlag = "0";
this.revision = 0;
this.createdBy = "APP_USER";
this.updatedBy = "APP_USER";
}
}

42
epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/AddBadgeFormDTO.java

@ -0,0 +1,42 @@
package com.epmet.dto.form;
import lombok.Data;
import lombok.NoArgsConstructor;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.util.List;
/**
* @author zhaoqifeng
* @dscription
* @date 2020/11/4 9:47
*/
@NoArgsConstructor
@Data
public class AddBadgeFormDTO implements Serializable {
private static final long serialVersionUID = -5220529162950147825L;
/**
* 徽章名称
*/
@NotBlank(message = "徽章名称不能为空")
private String badgeName;
/**
* 徽章图标
*/
@NotBlank(message = "徽章图标不能为空")
private String badgeIcon;
/**
* 徽章状态 上线:online;下线:offline;
*/
@NotBlank(message = "徽章状态不能为空")
private String badgeStatus;
/**
* 认证信息类型数组 手机号:mobile姓名:fullname;身份证:idcard;认证证件: certificate;认证说明(备注):remark
*/
@NotEmpty(message = "认证信息类型不能为空")
private List<String> certificationTypes;
}

24
epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/AuthFieldFormDTO.java

@ -0,0 +1,24 @@
package com.epmet.dto.form;
import lombok.Data;
import javax.validation.constraints.NotBlank;
import java.io.Serializable;
/**
* @Author zxc
* @DateTime 2020/11/4 4:54 下午
*/
@Data
public class AuthFieldFormDTO implements Serializable {
private static final long serialVersionUID = 1976515427065841752L;
public interface AuthField{}
@NotBlank(message = "客户ID不能为空",groups = {AuthField.class})
private String customerId;
@NotBlank(message = "徽章ID不能为空",groups = {AuthField.class})
private String badgeId;
}

16
epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/BadgeFormDTO.java

@ -0,0 +1,16 @@
package com.epmet.dto.form;
import lombok.Data;
import java.io.Serializable;
/**
* @author zhaoqifeng
* @dscription
* @date 2020/11/4 14:22
*/
@Data
public class BadgeFormDTO implements Serializable {
private static final long serialVersionUID = 9156247659994638103L;
private String badgeId;
}

22
epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/BadgeSendCodeFormDTO.java

@ -0,0 +1,22 @@
package com.epmet.dto.form;
import lombok.Data;
import javax.validation.constraints.NotBlank;
import java.io.Serializable;
/**
* @Author zxc
* @DateTime 2020/11/4 3:11 下午
*/
@Data
public class BadgeSendCodeFormDTO implements Serializable {
private static final long serialVersionUID = -3926070129364657241L;
public interface BadgeSendCode{}
@NotBlank(message = "手机号不能为空", groups = {BadgeSendCode.class})
private String mobile;
}

67
epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/CertificationAddFormDTO.java

@ -0,0 +1,67 @@
package com.epmet.dto.form;
import lombok.Data;
import javax.validation.constraints.NotBlank;
import java.io.Serializable;
/**
* @Author zxc
* @DateTime 2020/11/4 11:05 上午
*/
@Data
public class CertificationAddFormDTO implements Serializable {
private static final long serialVersionUID = 1330773325803513330L;
public interface CertificationAdd{}
private String userId;
/**
* 客户ID
*/
@NotBlank(message = "客户ID不能为空",groups = {CertificationAdd.class})
private String customerId;
/**
* 徽章ID
*/
private String badgeId;
/**
* 手机号
*/
private String mobile;
/**
*
*/
private String subName;
/**
*
*/
private String name;
/**
* 身份证号
*/
private String idCard;
/**
* 认证证件图片url
*/
private String certificate;
/**
* 认证说明
*/
private String remark;
/**
* 验证码
*/
private String code;
}

29
epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/CertificationDetailFormDTO.java

@ -0,0 +1,29 @@
package com.epmet.dto.form;
import lombok.Data;
import javax.validation.constraints.NotBlank;
import java.io.Serializable;
/**
* @Author zxc
* @DateTime 2020/11/4 3:51 下午
*/
@Data
public class CertificationDetailFormDTO implements Serializable {
private static final long serialVersionUID = -398879254354767770L;
public interface CertificationDetail{}
@NotBlank(message = "客户ID不能为空",groups = {CertificationDetail.class})
private String customerId;
@NotBlank(message = "徽章ID不能为空",groups = {CertificationDetail.class})
private String badgeId;
/**
* 客户ID
*/
private String userId;
}

40
epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/EditBadgeFormDTO.java

@ -0,0 +1,40 @@
package com.epmet.dto.form;
import lombok.Data;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.util.List;
/**
* @author zhaoqifeng
* @dscription
* @date 2020/11/4 14:23
*/
@Data
public class EditBadgeFormDTO implements Serializable {
private static final long serialVersionUID = 1578890423002035200L;
private String badgeId;
/**
* 徽章名称
*/
@NotBlank(message = "徽章名称不能为空")
private String badgeName;
/**
* 徽章图标
*/
@NotBlank(message = "徽章图标不能为空")
private String badgeIcon;
/**
* 徽章状态 上线:online;下线:offline;
*/
@NotBlank(message = "徽章状态不能为空")
private String badgeStatus;
/**
* 认证信息类型数组 手机号:mobile姓名:fullname;身份证:idcard;认证证件: certificate;认证说明(备注):remark
*/
@NotEmpty(message = "认证信息类型不能为空")
private List<String> certificationTypes;
}

52
epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/EditInfoFormDTO.java

@ -0,0 +1,52 @@
package com.epmet.dto.form;
import lombok.Data;
import lombok.NoArgsConstructor;
import javax.validation.constraints.NotBlank;
import java.io.Serializable;
/**
* @author zhaoqifeng
* @dscription
* @date 2020/11/3 9:55
*/
@NoArgsConstructor
@Data
public class EditInfoFormDTO implements Serializable {
private static final long serialVersionUID = 1280489016677129419L;
/**
* 头像
*/
@NotBlank(message = "头像不能为空")
private String userId;
/**
* 头像
*/
@NotBlank(message = "头像不能为空")
private String headImgUrl;
/**
*
*/
@NotBlank(message = "姓不能为空")
private String surname;
/**
*
*/
@NotBlank(message = "名不能为空")
private String name;
/**
* 路牌号
*/
@NotBlank(message = "路牌号不能为空")
private String street;
/**
* 小区名称
*/
private String district;
/**
* 详细地址
*/
private String buildingAddress;
}

26
epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/OpenedOrClosedFormDTO.java

@ -0,0 +1,26 @@
package com.epmet.dto.form;
import lombok.Data;
import javax.validation.constraints.NotBlank;
import java.io.Serializable;
/**
* @Author zxc
* @DateTime 2020/11/4 5:43 下午
*/
@Data
public class OpenedOrClosedFormDTO implements Serializable {
private static final long serialVersionUID = 483466676158603066L;
public interface OpenedOrClosed{}
@NotBlank(message = "客户ID不能为空",groups = {OpenedOrClosed.class})
private String customerId;
private String userId;
@NotBlank(message = "徽章ID不能为空",groups = {OpenedOrClosed.class})
private String badgeId;
}

21
epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/OrganizeTreeFormDTO.java

@ -0,0 +1,21 @@
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 外挂-获取当前组织及部门网格数据递归查询所有下级数据-接口入参
* @Auth sun
*/
@Data
public class OrganizeTreeFormDTO implements Serializable {
private static final long serialVersionUID = -5093758817860808310L;
@NotBlank(message = "组织Id不能为空" , groups = StaffIdGroup.class)
private String agencyId;
public interface StaffIdGroup extends CustomerClientShowGroup{}
}

33
epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/UserBadgeListFormDTO.java

@ -0,0 +1,33 @@
package com.epmet.dto.form;
import lombok.Data;
import java.io.Serializable;
/**
* @Author zxc
* @DateTime 2020/11/3 11:07 上午
*/
@Data
public class UserBadgeListFormDTO implements Serializable {
private static final long serialVersionUID = 9002922684993474574L;
/**
* 用户ID
*/
private String userId;
/**
* 客户ID
*/
private String customerId;
public UserBadgeListFormDTO(String userId, String customerId) {
this.userId = userId;
this.customerId = customerId;
}
public UserBadgeListFormDTO() {
}
}

28
epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/UserOperListFormDTO.java

@ -0,0 +1,28 @@
package com.epmet.dto.form;
import lombok.AllArgsConstructor;
import lombok.Data;
import java.io.Serializable;
/**
* @Author zxc
* @DateTime 2020/11/3 4:18 下午
*/
@Data
public class UserOperListFormDTO implements Serializable {
private static final long serialVersionUID = -1872129597916414712L;
private String userId;
private String customerId;
public UserOperListFormDTO(String userId, String customerId) {
this.userId = userId;
this.customerId = customerId;
}
public UserOperListFormDTO() {
}
}

40
epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/AuthFieldResultDTO.java

@ -0,0 +1,40 @@
package com.epmet.dto.result;
import lombok.Data;
import java.io.Serializable;
/**
* @Author zxc
* @DateTime 2020/11/4 4:54 下午
*/
@Data
public class AuthFieldResultDTO implements Serializable {
private static final long serialVersionUID = 1856490232343125419L;
/**
* 中文名
*/
private String cnName;
/**
* 英文名字段
*/
private String enName;
/**
* 字段类型text文本img图片
*/
private String fieldType;
/**
* 是否必填
*/
private String isRequired;
/**
* 排序
*/
private Integer sort;
}

26
epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/BadgeDetailResultDTO.java

@ -0,0 +1,26 @@
package com.epmet.dto.result;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.io.Serializable;
import java.util.List;
/**
* @author zhaoqifeng
* @dscription
* @date 2020/11/4 14:17
*/
@NoArgsConstructor
@Data
public class BadgeDetailResultDTO implements Serializable {
private static final long serialVersionUID = 7698898330565297328L;
private String badgeId;
private String badgeName;
private String badgeIcon;
private String badgeStatus;
private List<String> certificationTypes;
}

31
epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/BadgeListResultDTO.java

@ -0,0 +1,31 @@
package com.epmet.dto.result;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* @author zhaoqifeng
* @dscription
* @date 2020/11/3 16:58
*/
@NoArgsConstructor
@Data
public class BadgeListResultDTO {
/**
* 徽章Id
*/
private String badgeId;
/**
* 徽章名称
*/
private String badgeName;
/**
* 徽章图标url
*/
private String badgeIcon;
/**
* 徽章状态 上线:online;下线:offline;
*/
private String badgeStatus;
}

60
epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/CertificationDetailResultDTO.java

@ -0,0 +1,60 @@
package com.epmet.dto.result;
import lombok.Data;
import java.io.Serializable;
/**
* @Author zxc
* @DateTime 2020/11/4 3:51 下午
*/
@Data
public class CertificationDetailResultDTO implements Serializable {
private static final long serialVersionUID = 6538150132908927308L;
/**
*
*/
private String surname;
/**
*
*/
private String name;
/**
* 身份证号
*/
private String idNum;
/**
* 是否认证 yes 认证 no 已认证
*/
private String isCertificated;
/**
* 手机号
*/
private String mobile;
/**
* 认证图片地址
*/
private String certificationImg;
/**
* 备注
*/
private String remark;
/**
* 审核结果
*/
private String authResult;
/**
* 驳回原因
*/
private String authReason;
}

49
epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/UserBadgeListResultDTO.java

@ -0,0 +1,49 @@
package com.epmet.dto.result;
import com.fasterxml.jackson.annotation.JsonIgnore;
import lombok.Data;
import java.io.Serializable;
/**
* @Author zxc
* @DateTime 2020/11/3 11:08 上午
*/
@Data
public class UserBadgeListResultDTO implements Serializable {
private static final long serialVersionUID = -6542233940679158922L;
/**
* 徽章ID
*/
private String badgeId;
/**
* 徽章图片地址
*/
private String badgeIcon;
/**
* 徽章是否点亮
*/
private String isOpened;
private String badgeType;
@JsonIgnore
private String customerId;
@JsonIgnore
private String badgeName;
@JsonIgnore
private String fixationBadgeType;
@JsonIgnore
private Boolean status;
public UserBadgeListResultDTO() {
this.badgeId = "";
this.badgeIcon = "";
this.isOpened = "0";
this.status = false;
}
}

67
epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/UserOperListResultDTO.java

@ -0,0 +1,67 @@
package com.epmet.dto.result;
import com.fasterxml.jackson.annotation.JsonIgnore;
import lombok.Data;
import java.io.Serializable;
/**
* @Author zxc
* @DateTime 2020/11/3 4:20 下午
*/
@Data
public class UserOperListResultDTO implements Serializable {
private static final long serialVersionUID = -6185696177370545937L;
/**
* 徽章ID
*/
private String badgeId;
/**
* 徽章名字
*/
private String badgeName;
/**
* 点亮状态 yes已点亮no未点亮
*/
private String isLighted;
/**
* 是否认证 yes 认证 no 已认证
*/
private String isCertificated;
/**
* 徽章图片地址
*/
private String badgeIcon;
/**
* 是否被驳回 true已驳回false未驳回
*/
private Boolean isReject;
/**
* 徽章类型党员徽章partynone
*/
private String badgeType;
@JsonIgnore
private String customerId;
@JsonIgnore
private String isOpened;
@JsonIgnore
private String auditStatus;
public UserOperListResultDTO() {
this.badgeId = "";
this.badgeName = "";
this.isLighted = "no";
this.isCertificated = "no";
this.badgeIcon = "";
this.isReject = false;
}
}

46
epmet-user/epmet-user-client/src/main/java/com/epmet/feign/EpmetUserOpenFeignClient.java

@ -334,4 +334,50 @@ public interface EpmetUserOpenFeignClient {
*/
@PostMapping("/epmetuser/customerstaff/getstaffbasicinfo")
Result<BasicInfoResultDTO> getStaffBasicInfo(@RequestBody StaffBasicInfoFromDTO fromDTO);
/**
* 修改个人信息
* @author zhaoqifeng
* @date 2020/11/3 10:28
* @param formDTO
* @return com.epmet.commons.tools.utils.Result
*/
@PostMapping("/epmetuser/userresiinfo/edituserinfo")
Result editUserInfo(@RequestBody EditInfoFormDTO formDTO);
/**
* @Description 查询已经点亮的徽章
* @Param userBadgeListFormDTO
* @author zxc
* @date 2020/11/3 1:33 下午
*/
@PostMapping("/epmetuser/more/badge/badgelist")
Result<List<UserBadgeListResultDTO>> selectBadgeList(@RequestBody UserBadgeListFormDTO userBadgeListFormDTO);
/**
* @Description 个人中心-获取徽章可操作列表点亮取消认证
* @Param operListFormDTO
* @author zxc
* @date 2020/11/3 4:28 下午
*/
@PostMapping("/epmetuser/more/badge/badgeoperlist")
Result<List<UserOperListResultDTO>> selectOperList(@RequestBody UserOperListFormDTO userOperListFormDTO);
/**
* @Description 徽章认证提交
* @Param certificationAddFormDTO
* @author zxc
* @date 2020/11/4 4:30 下午
*/
@PostMapping("/epmetuser/more/badge/authbadgerecord")
Result authBadgeRecord(@RequestBody CertificationAddFormDTO certificationAddFormDTO);
/**
* @Description 个人中心-取消/点亮徽章
* @Param openedOrClosedFormDTO
* @author zxc
* @date 2020/11/5 9:23 上午
*/
@PostMapping("/epmetuser/more/badge/openedorclosed")
Result openedOrClosed(@RequestBody OpenedOrClosedFormDTO openedOrClosedFormDTO);
}

25
epmet-user/epmet-user-client/src/main/java/com/epmet/feign/fallback/EpmetUserOpenFeignClientFallback.java

@ -225,4 +225,29 @@ public class EpmetUserOpenFeignClientFallback implements EpmetUserOpenFeignClien
public Result<BasicInfoResultDTO> getStaffBasicInfo(StaffBasicInfoFromDTO fromDTO) {
return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "getStaffBasicInfo", fromDTO);
}
@Override
public Result editUserInfo(EditInfoFormDTO formDTO) {
return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "editUserInfo", formDTO);
}
@Override
public Result<List<UserBadgeListResultDTO>> selectBadgeList(UserBadgeListFormDTO userBadgeListFormDTO) {
return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "selectBadgeList", userBadgeListFormDTO);
}
@Override
public Result<List<UserOperListResultDTO>> selectOperList(UserOperListFormDTO userOperListFormDTO) {
return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "selectOperList", userOperListFormDTO);
}
@Override
public Result authBadgeRecord(CertificationAddFormDTO certificationAddFormDTO) {
return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "authBadgeRecord", certificationAddFormDTO);
}
@Override
public Result openedOrClosed(OpenedOrClosedFormDTO openedOrClosedFormDTO) {
return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "openedOrClosed", openedOrClosedFormDTO);
}
}

104
epmet-user/epmet-user-server/src/main/java/com/epmet/controller/BadgeController.java

@ -0,0 +1,104 @@
package com.epmet.controller;
import com.epmet.commons.tools.annotation.LoginUser;
import com.epmet.commons.tools.security.dto.TokenDto;
import com.epmet.commons.tools.utils.Result;
import com.epmet.commons.tools.validator.ValidatorUtils;
import com.epmet.dto.form.AddBadgeFormDTO;
import com.epmet.dto.form.BadgeFormDTO;
import com.epmet.dto.form.EditBadgeFormDTO;
import com.epmet.dto.result.BadgeDetailResultDTO;
import com.epmet.dto.result.BadgeListResultDTO;
import com.epmet.service.BadgeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
/**
* @author zhaoqifeng
* @dscription
* @date 2020/11/3 16:09
*/
@RestController
@RequestMapping("badge")
public class BadgeController {
@Autowired
private BadgeService badgeService;
/**
* 徽章列表
* @author zhaoqifeng
* @date 2020/11/4 14:27
* @param tokenDto
* @return com.epmet.commons.tools.utils.Result<java.util.List<com.epmet.dto.result.BadgeListResultDTO>>
*/
@PostMapping("list")
public Result<List<BadgeListResultDTO>> list(@LoginUser TokenDto tokenDto) {
List<BadgeListResultDTO> result = badgeService.getList(tokenDto.getCustomerId());
return new Result<List<BadgeListResultDTO>>().ok(result);
}
/**
* 添加徽章
* @author zhaoqifeng
* @date 2020/11/4 14:27
* @param tokenDto
* @param formDTO
* @return com.epmet.commons.tools.utils.Result
*/
@PostMapping("add")
public Result add(@LoginUser TokenDto tokenDto, @RequestBody AddBadgeFormDTO formDTO) {
ValidatorUtils.validateEntity(formDTO);
badgeService.add(tokenDto, formDTO);
return new Result();
}
/**
* 徽章详情
* @author zhaoqifeng
* @date 2020/11/4 14:27
* @param tokenDto
* @param formDTO
* @return com.epmet.commons.tools.utils.Result<com.epmet.dto.result.BadgeDetailResultDTO>
*/
@PostMapping("detail")
public Result<BadgeDetailResultDTO> detail(@LoginUser TokenDto tokenDto, @RequestBody BadgeFormDTO formDTO) {
BadgeDetailResultDTO result = badgeService.detail(tokenDto, formDTO);
return new Result<BadgeDetailResultDTO>().ok(result);
}
/**
* 修改
* @author zhaoqifeng
* @date 2020/11/4 15:32
* @param tokenDto
* @param formDTO
* @return com.epmet.commons.tools.utils.Result
*/
@PostMapping("edit")
public Result edit(@LoginUser TokenDto tokenDto, @RequestBody EditBadgeFormDTO formDTO) {
ValidatorUtils.validateEntity(formDTO);
badgeService.edit(tokenDto, formDTO);
return new Result();
}
/**
* 删除徽章
* @author zhaoqifeng
* @date 2020/11/4 15:34
* @param tokenDto
* @param formDTO
* @return com.epmet.commons.tools.utils.Result
*/
@PostMapping("delete")
public Result delete(@LoginUser TokenDto tokenDto, @RequestBody BadgeFormDTO formDTO) {
badgeService.deleteBadge(tokenDto, formDTO);
return new Result();
}
}

116
epmet-user/epmet-user-server/src/main/java/com/epmet/controller/UserBadgeController.java

@ -0,0 +1,116 @@
package com.epmet.controller;
import com.epmet.commons.tools.annotation.LoginUser;
import com.epmet.commons.tools.security.dto.TokenDto;
import com.epmet.commons.tools.utils.Result;
import com.epmet.commons.tools.validator.ValidatorUtils;
import com.epmet.dto.form.*;
import com.epmet.dto.result.AuthFieldResultDTO;
import com.epmet.dto.result.CertificationDetailResultDTO;
import com.epmet.dto.result.UserBadgeListResultDTO;
import com.epmet.dto.result.UserOperListResultDTO;
import com.epmet.service.UserBadgeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
/**
* @Author zxc
* @DateTime 2020/11/3 11:16 上午
*/
@RestController
@RequestMapping("more/badge")
public class UserBadgeController {
@Autowired
private UserBadgeService userBadgeService;
/**
* @Description 查询已经点亮的徽章
* @Param userBadgeListFormDTO
* @author zxc
* @date 2020/11/3 1:33 下午
*/
@PostMapping("badgelist")
public Result<List<UserBadgeListResultDTO>> selectBadgeList(@RequestBody UserBadgeListFormDTO userBadgeListFormDTO){
return new Result<List<UserBadgeListResultDTO>>().ok(userBadgeService.selectBadgeList(userBadgeListFormDTO));
}
/**
* @Description 个人中心-获取徽章可操作列表点亮取消认证
* @Param userOperListFormDTO
* @author zxc
* @date 2020/11/3 4:42 下午
*/
@PostMapping("badgeoperlist")
public Result<List<UserOperListResultDTO>> selectOperList(@RequestBody UserOperListFormDTO userOperListFormDTO){
return new Result<List<UserOperListResultDTO>>().ok(userBadgeService.selectOperList(userOperListFormDTO));
}
/**
* @Description 个人中心-提交徽章认证
* @Param certificationAddFormDTO
* @author zxc
* @date 2020/11/4 1:36 下午
*/
@PostMapping("authbadgerecord")
public Result authBadgeRecord(@RequestBody CertificationAddFormDTO certificationAddFormDTO){
userBadgeService.authBadgeRecord(certificationAddFormDTO);
return new Result();
}
/**
* @Description 发送验证码
* @Param badgeSendCodeFormDTO
* @author zxc
* @date 2020/11/4 3:14 下午
*/
@PostMapping("badgesendcode")
public Result badgeSendCode(@RequestBody BadgeSendCodeFormDTO badgeSendCodeFormDTO){
ValidatorUtils.validateEntity(badgeSendCodeFormDTO, BadgeSendCodeFormDTO.BadgeSendCode.class);
userBadgeService.badgeSendCode(badgeSendCodeFormDTO);
return new Result();
}
/**
* @Description 个人中心-获取徽章认证页面详情
* @Param tokenDto
* @Param certificationDetailFormDTO
* @author zxc
* @date 2020/11/4 4:03 下午
*/
@PostMapping("certification/detail")
public Result<CertificationDetailResultDTO> certificationDetail(@LoginUser TokenDto tokenDto,@RequestBody CertificationDetailFormDTO certificationDetailFormDTO){
ValidatorUtils.validateEntity(certificationDetailFormDTO);
return new Result<CertificationDetailResultDTO>().ok(userBadgeService.certificationDetail(tokenDto,certificationDetailFormDTO));
}
/**
* @Description 个人中心-查询徽章要显示的认证信息字段
* @Param authFieldFormDTO
* @author zxc
* @date 2020/11/4 5:05 下午
*/
@PostMapping("authfield")
public Result<List<AuthFieldResultDTO>> authField(@RequestBody AuthFieldFormDTO authFieldFormDTO){
ValidatorUtils.validateEntity(authFieldFormDTO, AuthFieldFormDTO.AuthField.class);
return new Result<List<AuthFieldResultDTO>>().ok(userBadgeService.authField(authFieldFormDTO));
}
/**
* @Description 个人中心-取消/点亮徽章
* @Param openedOrClosedFormDTO
* @author zxc
* @date 2020/11/4 5:47 下午
*/
@PostMapping("openedorclosed")
public Result openedOrClosed(@RequestBody OpenedOrClosedFormDTO openedOrClosedFormDTO){
userBadgeService.openedOrClosed(openedOrClosedFormDTO);
return new Result();
}
}

18
epmet-user/epmet-user-server/src/main/java/com/epmet/controller/UserResiInfoController.java

@ -26,10 +26,7 @@ import com.epmet.commons.tools.validator.group.AddGroup;
import com.epmet.commons.tools.validator.group.DefaultGroup;
import com.epmet.commons.tools.validator.group.UpdateGroup;
import com.epmet.dto.UserResiInfoDTO;
import com.epmet.dto.form.IssueInitiatorFormDTO;
import com.epmet.dto.form.UserResiInfoFormDTO;
import com.epmet.dto.form.UserResiInfoListFormDTO;
import com.epmet.dto.form.VerificationCodeFormDTO;
import com.epmet.dto.form.*;
import com.epmet.dto.result.IssueInitiatorResultDTO;
import com.epmet.dto.result.UserResiInfoResultDTO;
import com.epmet.excel.UserResiInfoExcel;
@ -163,4 +160,17 @@ public class UserResiInfoController {
return new Result<IssueInitiatorResultDTO>().ok(userResiInfoService.selectIssueInitiator(formDTO));
}
/**
* 修改个人信息
* @author zhaoqifeng
* @date 2020/11/3 10:28
* @param formDTO
* @return com.epmet.commons.tools.utils.Result
*/
@PostMapping("edituserinfo")
public Result editUserInfo(@RequestBody EditInfoFormDTO formDTO) {
userResiInfoService.editUserInfo(formDTO);
return new Result();
}
}

54
epmet-user/epmet-user-server/src/main/java/com/epmet/dao/BadgeCertificationConfigDao.java

@ -0,0 +1,54 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.epmet.dao;
import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.entity.BadgeCertificationConfigEntity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* 徽章认证配置
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2020-11-03
*/
@Mapper
public interface BadgeCertificationConfigDao extends BaseDao<BadgeCertificationConfigEntity> {
/**
* 获取认证信息类型
* @author zhaoqifeng
* @date 2020/11/4 14:42
* @param customerId
* @param badgeId
* @return java.util.List<java.lang.String>
*/
List<String> getCertificationType(@Param("customerId") String customerId, @Param("badgeId") String badgeId);
/**
* 删除认证信息
* @author zhaoqifeng
* @date 2020/11/4 14:43
* @param customerId
* @param badgeId
* @return int
*/
int deleteConfig(@Param("customerId") String customerId, @Param("badgeId") String badgeId);
}

108
epmet-user/epmet-user-server/src/main/java/com/epmet/dao/BadgeDao.java

@ -0,0 +1,108 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.epmet.dao;
import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.dto.result.BadgeDetailResultDTO;
import com.epmet.dto.result.BadgeListResultDTO;
import com.epmet.entity.BadgeEntity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.omg.PortableInterceptor.ORBInitInfoPackage.DuplicateName;
import java.util.List;
/**
* 徽章
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2020-11-03
*/
@Mapper
public interface BadgeDao extends BaseDao<BadgeEntity> {
/**
* 获取徽章列表
* @author zhaoqifeng
* @date 2020/11/3 17:30
* @param customerId
* @return java.util.List<com.epmet.dto.result.BadgeListResultDTO>
*/
List<BadgeListResultDTO> selectList(@Param("customerId") String customerId);
/**
* 重名校验
* @author zhaoqifeng
* @date 2020/11/4 10:40
* @param customerId
* @param badgeName
* @return java.util.List<com.epmet.dto.result.BadgeListResultDTO>
*/
List<BadgeListResultDTO> getDuplicateName(@Param("customerId") String customerId, @Param("badgeName") String badgeName);
/**
* 编辑重名校验
* @author zhaoqifeng
* @date 2020/11/4 15:09
* @param customerId
* @param badgeId
* @param badgeName
* @return java.util.List<com.epmet.dto.result.BadgeListResultDTO>
*/
List<BadgeListResultDTO> getDuplicateNameForEdit(@Param("customerId") String customerId, @Param("badgeId") String badgeId,
@Param("badgeName") String badgeName);
/**
* 获取徽章详情
* @author zhaoqifeng
* @date 2020/11/4 14:30
* @param customerId
* @param badgeId
* @return com.epmet.dto.result.BadgeDetailResultDTO
*/
BadgeDetailResultDTO selectDetail(@Param("customerId") String customerId, @Param("badgeId") String badgeId);
/**
* 获取徽章信息
* @author zhaoqifeng
* @date 2020/11/4 15:16
* @param customerId
* @param badgeId
* @return com.epmet.entity.BadgeEntity
*/
BadgeEntity selectBadgeInfo(@Param("customerId") String customerId, @Param("badgeId") String badgeId);
/**
* 更新徽章信息
* @author zhaoqifeng
* @date 2020/11/4 15:38
* @param entity
* @return void
*/
void updateBadge(BadgeEntity entity);
/**
* 删除徽章信息
* @author zhaoqifeng
* @date 2020/11/4 15:39
* @param customerId
* @param badgeId
* @return void
*/
void deleteBadge(@Param("customerId") String customerId, @Param("badgeId") String badgeId);
}

95
epmet-user/epmet-user-server/src/main/java/com/epmet/dao/UserBadgeDao.java

@ -0,0 +1,95 @@
package com.epmet.dao;
import com.epmet.dto.UserBadgeCertificateRecordDTO;
import com.epmet.dto.form.AuthFieldFormDTO;
import com.epmet.dto.form.OpenedOrClosedFormDTO;
import com.epmet.dto.form.UserBadgeListFormDTO;
import com.epmet.dto.result.AuthFieldResultDTO;
import com.epmet.dto.result.CertificationDetailResultDTO;
import com.epmet.dto.result.UserBadgeListResultDTO;
import com.epmet.dto.result.UserOperListResultDTO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* @Author zxc
* @DateTime 2020/11/3 1:22 下午
*/
@Mapper
public interface UserBadgeDao {
/**
* @Description 查询已经点亮的徽章
* @Param userBadgeListFormDTO
* @author zxc
* @date 2020/11/3 1:33 下午
*/
List<UserBadgeListResultDTO> selectBadgeList(UserBadgeListFormDTO userBadgeListFormDTO);
/**
* @Description 查询默认徽章和改名后的徽章
* @Param userBadgeListFormDTO
* @author zxc
* @date 2020/11/3 3:11 下午
*/
List<UserBadgeListResultDTO> selectAllBadge(UserBadgeListFormDTO userBadgeListFormDTO);
/**
* @Description 查询徽章认证记录
* @Param userId
* @author zxc
* @date 2020/11/3 5:25 下午
*/
List<UserOperListResultDTO> selectAuthRecord(@Param("userId")String userId);
/**
* @Description 根据UserId查询个人徽章点亮信息
* @Param userId
* @author zxc
* @date 2020/11/4 9:32 上午
*/
List<UserOperListResultDTO> selectBadgeByUserId(@Param("userId")String userId);
/**
* @Description 用户认证徽章记录表插入
* @Param userBadgeCertificateRecordDTO
* @author zxc
* @date 2020/11/4 2:13 下午
*/
void insertUserBadgeCertificateRecord(UserBadgeCertificateRecordDTO userBadgeCertificateRecordDTO);
/**
* @Description 更新认证徽章记录最新
* @Param badgeId
* @Param userId
* @author zxc
* @date 2020/11/4 2:16 下午
*/
void updateCertificateRecordIsLast(@Param("badgeId")String badgeId,@Param("userId")String userId);
/**
* @Description 查询单个徽章的认证记录
* @Param userId
* @Param badgeId
* @author zxc
* @date 2020/11/4 4:09 下午
*/
CertificationDetailResultDTO selectBadgeAuthRecord(@Param("userId")String userId, @Param("badgeId")String badgeId);
/**
* @Description 个人中心-查询徽章要显示的认证信息字段
* @Param authFieldFormDTO
* @author zxc
* @date 2020/11/4 5:05 下午
*/
List<AuthFieldResultDTO> selectAuthField(AuthFieldFormDTO authFieldFormDTO);
/**
* @Description 个人中心-取消/点亮徽章
* @Param openedOrClosedFormDTO
* @author zxc
* @date 2020/11/4 6:04 下午
*/
void updateIsOpen(OpenedOrClosedFormDTO openedOrClosedFormDTO);
}

9
epmet-user/epmet-user-server/src/main/java/com/epmet/dao/UserResiInfoDao.java

@ -87,4 +87,13 @@ public interface UserResiInfoDao extends BaseDao<UserResiInfoEntity> {
* @Date 2020/7/22 10:58
**/
UserResiInfoDTO selectByUserId(String userId);
/**
* 根据用户ID更新
* @author zhaoqifeng
* @date 2020/11/3 14:16
* @param entity
* @return void
*/
void updateByUserId(UserResiInfoEntity entity);
}

56
epmet-user/epmet-user-server/src/main/java/com/epmet/entity/BadgeCertificationConfigEntity.java

@ -0,0 +1,56 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.epmet.entity;
import com.baomidou.mybatisplus.annotation.TableName;
import com.epmet.commons.mybatis.entity.BaseEpmetEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.util.Date;
/**
* 徽章认证配置
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2020-11-03
*/
@Data
@EqualsAndHashCode(callSuper=false)
@TableName("badge_certification_config")
public class BadgeCertificationConfigEntity extends BaseEpmetEntity {
private static final long serialVersionUID = 1L;
/**
* 客户Id 默认配置iddefault
*/
private String customerId;
/**
* 徽章ID
*/
private String badgeId;
/**
* 认证信息类型 手机号:mobile全名:fullname;身份证:idcard;认证证件: certificate;认证说明(备注):remark
*/
private String certificationType;
}

66
epmet-user/epmet-user-server/src/main/java/com/epmet/entity/BadgeEntity.java

@ -0,0 +1,66 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.epmet.entity;
import com.baomidou.mybatisplus.annotation.TableName;
import com.epmet.commons.mybatis.entity.BaseEpmetEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.util.Date;
/**
* 徽章
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2020-11-03
*/
@Data
@EqualsAndHashCode(callSuper=false)
@TableName("badge")
public class BadgeEntity extends BaseEpmetEntity {
private static final long serialVersionUID = 1L;
/**
* 客户Id 默认配置iddefault
*/
private String customerId;
/**
* 徽章名称
*/
private String badgeName;
/**
* 徽章图标url
*/
private String badgeIcon;
/**
* 固有徽章类型 前端页面跳转标识党员徽章party;none
*/
private String fixationBadgeType;
/**
* 状态 上线:online;下线:offline;
*/
private String badgeStatus;
}

69
epmet-user/epmet-user-server/src/main/java/com/epmet/redis/UserBadgeRedis.java

@ -0,0 +1,69 @@
package com.epmet.redis;
import com.alibaba.fastjson.JSON;
import com.epmet.commons.tools.redis.RedisUtils;
import com.epmet.constant.BadgeConstant;
import com.epmet.dto.result.UserBadgeListResultDTO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.util.List;
import static com.epmet.commons.tools.redis.RedisUtils.MINUTE_THIRTY_EXPIRE;
/**
* @Author zxc
* @DateTime 2020/11/3 2:21 下午
*/
@Component
public class UserBadgeRedis {
@Autowired
private RedisUtils redisUtils;
/**
* @Description 获取徽章信息
* @Param customerId
* @author zxc
* @date 2020/11/3 2:50 下午
*/
public Object getCustomerBadge(String customerId){
Object userBadge = redisUtils.hGet(BadgeConstant.BADGE_KEY + customerId, BadgeConstant.BADGE);
return userBadge;
}
/**
* @Description 存放徽章信息
* @Param userBadge
* @Param customerId
* @author zxc
* @date 2020/11/3 2:51 下午
*/
public void setCustomerBadge(List<UserBadgeListResultDTO> userBadge, String customerId){
redisUtils.hSet(BadgeConstant.BADGE_KEY+customerId,BadgeConstant.BADGE, JSON.toJSON(userBadge).toString(),-1);
}
/**
* @Description 存放徽章审核 手机验证码
* @Param mobile
* @author zxc
* @date 2020/11/5 10:30 上午
*/
public void saveBadgeSmsCode(String mobile, String smsCode) {
String smsCodeKey = BadgeConstant.SMS_CODE_KEY + mobile;
redisUtils.set(smsCodeKey, smsCode, MINUTE_THIRTY_EXPIRE);
}
/**
* @Description 获取徽章审核 手机验证码
* @Param mobile
* @author zxc
* @date 2020/11/5 10:30 上午
*/
public String getBadgeSmsCode(String mobile) {
String smsCodeKey = BadgeConstant.SMS_CODE_KEY + mobile;
String smsCode = (String) redisUtils.get(smsCodeKey);
return smsCode;
}
}

127
epmet-user/epmet-user-server/src/main/java/com/epmet/service/BadgeCertificationConfigService.java

@ -0,0 +1,127 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.epmet.service;
import com.epmet.commons.mybatis.service.BaseService;
import com.epmet.commons.tools.page.PageData;
import com.epmet.dto.BadgeCertificationConfigDTO;
import com.epmet.entity.BadgeCertificationConfigEntity;
import java.util.List;
import java.util.Map;
/**
* 徽章认证配置
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2020-11-03
*/
public interface BadgeCertificationConfigService extends BaseService<BadgeCertificationConfigEntity> {
/**
* 默认分页
*
* @param params
* @return PageData<BadgeCertificationConfigDTO>
* @author generator
* @date 2020-11-03
*/
PageData<BadgeCertificationConfigDTO> page(Map<String, Object> params);
/**
* 默认查询
*
* @param params
* @return java.util.List<BadgeCertificationConfigDTO>
* @author generator
* @date 2020-11-03
*/
List<BadgeCertificationConfigDTO> list(Map<String, Object> params);
/**
* 单条查询
*
* @param id
* @return BadgeCertificationConfigDTO
* @author generator
* @date 2020-11-03
*/
BadgeCertificationConfigDTO get(String id);
/**
* 默认保存
*
* @param dto
* @return void
* @author generator
* @date 2020-11-03
*/
void save(BadgeCertificationConfigDTO dto);
/**
* 默认更新
*
* @param dto
* @return void
* @author generator
* @date 2020-11-03
*/
void update(BadgeCertificationConfigDTO dto);
/**
* 批量删除
*
* @param ids
* @return void
* @author generator
* @date 2020-11-03
*/
void delete(String[] ids);
/**
* 获取认证信息类型
* @author zhaoqifeng
* @date 2020/11/4 14:39
* @param customerId
* @param badgeId
* @return java.util.List<java.lang.String>
*/
List<String> getCertificationType(String customerId, String badgeId);
/**
* 保存认证信息配置
* @author zhaoqifeng
* @date 2020/11/4 15:29
* @param customerId
* @param badgeId
* @param list
* @return void
*/
void saveConfig(String customerId, String badgeId, List<BadgeCertificationConfigEntity> list);
/**
* 删除配置
* @author zhaoqifeng
* @date 2020/11/4 15:41
* @param customerId
* @param badgeId
* @return void
*/
void deleteConfig(String customerId, String badgeId);
}

150
epmet-user/epmet-user-server/src/main/java/com/epmet/service/BadgeService.java

@ -0,0 +1,150 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.epmet.service;
import com.epmet.commons.mybatis.service.BaseService;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.security.dto.TokenDto;
import com.epmet.dto.BadgeDTO;
import com.epmet.dto.form.AddBadgeFormDTO;
import com.epmet.dto.form.BadgeFormDTO;
import com.epmet.dto.form.EditBadgeFormDTO;
import com.epmet.dto.result.BadgeDetailResultDTO;
import com.epmet.dto.result.BadgeListResultDTO;
import com.epmet.entity.BadgeEntity;
import java.util.List;
import java.util.Map;
/**
* 徽章
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2020-11-03
*/
public interface BadgeService extends BaseService<BadgeEntity> {
/**
* 默认分页
*
* @param params
* @return PageData<BadgeDTO>
* @author generator
* @date 2020-11-03
*/
PageData<BadgeDTO> page(Map<String, Object> params);
/**
* 默认查询
*
* @param params
* @return java.util.List<BadgeDTO>
* @author generator
* @date 2020-11-03
*/
List<BadgeDTO> list(Map<String, Object> params);
/**
* 单条查询
*
* @param id
* @return BadgeDTO
* @author generator
* @date 2020-11-03
*/
BadgeDTO get(String id);
/**
* 默认保存
*
* @param dto
* @return void
* @author generator
* @date 2020-11-03
*/
void save(BadgeDTO dto);
/**
* 默认更新
*
* @param dto
* @return void
* @author generator
* @date 2020-11-03
*/
void update(BadgeDTO dto);
/**
* 批量删除
*
* @param ids
* @return void
* @author generator
* @date 2020-11-03
*/
void delete(String[] ids);
/**
* 获取徽章列表
* @author zhaoqifeng
* @date 2020/11/3 17:04
* @param customerId
* @return java.util.List<com.epmet.dto.result.BadgeListResultDTO>
*/
List<BadgeListResultDTO> getList(String customerId);
/**
* 添加徽章
* @author zhaoqifeng
* @date 2020/11/4 10:09
* @param tokenDto
* @param formDTO
* @return void
*/
void add(TokenDto tokenDto, AddBadgeFormDTO formDTO);
/**
* 徽章详情
* @author zhaoqifeng
* @date 2020/11/4 14:25
* @param tokenDto
* @param formDTO
* @return com.epmet.dto.result.BadgeDetailResultDTO
*/
BadgeDetailResultDTO detail(TokenDto tokenDto, BadgeFormDTO formDTO);
/**
* 编辑徽章
* @author zhaoqifeng
* @date 2020/11/4 14:28
* @param tokenDto
* @param formDTO
* @return void
*/
void edit(TokenDto tokenDto, EditBadgeFormDTO formDTO);
/**
* 删除徽章
* @author zhaoqifeng
* @date 2020/11/4 15:34
* @param tokenDto
* @param formDTO
* @return void
*/
void deleteBadge(TokenDto tokenDto, BadgeFormDTO formDTO);
}

76
epmet-user/epmet-user-server/src/main/java/com/epmet/service/UserBadgeService.java

@ -0,0 +1,76 @@
package com.epmet.service;
import com.epmet.commons.tools.security.dto.TokenDto;
import com.epmet.commons.tools.utils.Result;
import com.epmet.dto.form.*;
import com.epmet.dto.result.AuthFieldResultDTO;
import com.epmet.dto.result.CertificationDetailResultDTO;
import com.epmet.dto.result.UserBadgeListResultDTO;
import com.epmet.dto.result.UserOperListResultDTO;
import java.util.List;
/**
* @Author zxc
* @DateTime 2020/11/3 11:18 上午
*/
public interface UserBadgeService {
/**
* @Description 查询已经点亮的徽章
* @Param userBadgeListFormDTO
* @author zxc
* @date 2020/11/3 1:33 下午
*/
List<UserBadgeListResultDTO> selectBadgeList(UserBadgeListFormDTO userBadgeListFormDTO);
/**
* @Description 个人中心-获取徽章可操作列表点亮取消认证
* @Param userOperListFormDTO
* @author zxc
* @date 2020/11/3 4:42 下午
*/
List<UserOperListResultDTO> selectOperList(UserOperListFormDTO userOperListFormDTO);
/**
* @Description 个人中心-提交徽章认证
* @Param certificationAddFormDTO
* @author zxc
* @date 2020/11/4 1:36 下午
*/
Result authBadgeRecord(CertificationAddFormDTO certificationAddFormDTO);
/**
* @Description 发送验证码
* @Param badgeSendCodeFormDTO
* @author zxc
* @date 2020/11/4 3:14 下午
*/
void badgeSendCode(BadgeSendCodeFormDTO badgeSendCodeFormDTO);
/**
* @Description 个人中心-获取徽章认证页面详情
* @Param tokenDto
* @Param certificationDetailFormDTO
* @author zxc
* @date 2020/11/4 4:03 下午
*/
CertificationDetailResultDTO certificationDetail(TokenDto tokenDto, CertificationDetailFormDTO certificationDetailFormDTO);
/**
* @Description 个人中心-查询徽章要显示的认证信息字段
* @Param authFieldFormDTO
* @author zxc
* @date 2020/11/4 5:05 下午
*/
List<AuthFieldResultDTO> authField(AuthFieldFormDTO authFieldFormDTO);
/**
* @Description 个人中心-取消/点亮徽章
* @Param openedOrClosedFormDTO
* @author zxc
* @date 2020/11/4 5:47 下午
*/
void openedOrClosed(OpenedOrClosedFormDTO openedOrClosedFormDTO);
}

14
epmet-user/epmet-user-server/src/main/java/com/epmet/service/UserResiInfoService.java

@ -21,10 +21,7 @@ import com.epmet.commons.mybatis.service.BaseService;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.utils.Result;
import com.epmet.dto.UserResiInfoDTO;
import com.epmet.dto.form.IssueInitiatorFormDTO;
import com.epmet.dto.form.UserResiInfoFormDTO;
import com.epmet.dto.form.UserResiInfoListFormDTO;
import com.epmet.dto.form.VerificationCodeFormDTO;
import com.epmet.dto.form.*;
import com.epmet.dto.result.IssueInitiatorResultDTO;
import com.epmet.dto.result.UserResiInfoResultDTO;
import com.epmet.entity.UserResiInfoEntity;
@ -151,4 +148,13 @@ public interface UserResiInfoService extends BaseService<UserResiInfoEntity> {
* @date 2020/5/11 10:59
*/
IssueInitiatorResultDTO selectIssueInitiator(IssueInitiatorFormDTO formDTO);
/**
* 修改个人信息
* @author zhaoqifeng
* @date 2020/11/3 10:29
* @param formDTO
* @return void
*/
void editUserInfo(EditInfoFormDTO formDTO);
}

149
epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/BadgeCertificationConfigServiceImpl.java

@ -0,0 +1,149 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.epmet.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.commons.tools.constant.FieldConstant;
import com.epmet.dao.BadgeCertificationConfigDao;
import com.epmet.dto.BadgeCertificationConfigDTO;
import com.epmet.entity.BadgeCertificationConfigEntity;
import com.epmet.service.BadgeCertificationConfigService;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
/**
* 徽章认证配置
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2020-11-03
*/
@Service
public class BadgeCertificationConfigServiceImpl extends BaseServiceImpl<BadgeCertificationConfigDao, BadgeCertificationConfigEntity> implements BadgeCertificationConfigService {
@Override
public PageData<BadgeCertificationConfigDTO> page(Map<String, Object> params) {
IPage<BadgeCertificationConfigEntity> page = baseDao.selectPage(
getPage(params, FieldConstant.CREATED_TIME, false),
getWrapper(params)
);
return getPageData(page, BadgeCertificationConfigDTO.class);
}
@Override
public List<BadgeCertificationConfigDTO> list(Map<String, Object> params) {
List<BadgeCertificationConfigEntity> entityList = baseDao.selectList(getWrapper(params));
return ConvertUtils.sourceToTarget(entityList, BadgeCertificationConfigDTO.class);
}
private QueryWrapper<BadgeCertificationConfigEntity> getWrapper(Map<String, Object> params){
String id = (String)params.get(FieldConstant.ID_HUMP);
QueryWrapper<BadgeCertificationConfigEntity> wrapper = new QueryWrapper<>();
wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id);
return wrapper;
}
@Override
public BadgeCertificationConfigDTO get(String id) {
BadgeCertificationConfigEntity entity = baseDao.selectById(id);
return ConvertUtils.sourceToTarget(entity, BadgeCertificationConfigDTO.class);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void save(BadgeCertificationConfigDTO dto) {
BadgeCertificationConfigEntity entity = ConvertUtils.sourceToTarget(dto, BadgeCertificationConfigEntity.class);
insert(entity);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void update(BadgeCertificationConfigDTO dto) {
BadgeCertificationConfigEntity entity = ConvertUtils.sourceToTarget(dto, BadgeCertificationConfigEntity.class);
updateById(entity);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void delete(String[] ids) {
// 逻辑删除(@TableLogic 注解)
baseDao.deleteBatchIds(Arrays.asList(ids));
}
/**
* 获取认证信息类型
*
* @param customerId
* @param badgeId
* @return java.util.List<java.lang.String>
* @author zhaoqifeng
* @date 2020/11/4 14:39
*/
@Override
public List<String> getCertificationType(String customerId, String badgeId) {
List<String> list = baseDao.getCertificationType(customerId, badgeId);
if (CollectionUtils.isEmpty(list)) {
list = baseDao.getCertificationType("default", badgeId);
}
return list;
}
/**
* 保存认证信息配置
*
* @param list
* @return void
* @author zhaoqifeng
* @date 2020/11/4 15:28
*/
@Override
@Transactional(rollbackFor = Exception.class)
public void saveConfig(String customerId, String badgeId, List<BadgeCertificationConfigEntity> list) {
baseDao.deleteConfig(customerId, badgeId);
insertBatch(list);
}
/**
* 删除配置
*
* @param customerId
* @param badgeId
* @return void
* @author zhaoqifeng
* @date 2020/11/4 15:41
*/
@Override
public void deleteConfig(String customerId, String badgeId) {
baseDao.deleteConfig(customerId, badgeId);
}
}

248
epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/BadgeServiceImpl.java

@ -0,0 +1,248 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.epmet.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl;
import com.epmet.commons.tools.constant.NumConstant;
import com.epmet.commons.tools.exception.EpmetErrorCode;
import com.epmet.commons.tools.exception.RenException;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.security.dto.TokenDto;
import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.commons.tools.constant.FieldConstant;
import com.epmet.constant.BadgeConstant;
import com.epmet.dao.BadgeDao;
import com.epmet.dto.BadgeDTO;
import com.epmet.dto.form.AddBadgeFormDTO;
import com.epmet.dto.form.BadgeFormDTO;
import com.epmet.dto.form.EditBadgeFormDTO;
import com.epmet.dto.result.BadgeDetailResultDTO;
import com.epmet.dto.result.BadgeListResultDTO;
import com.epmet.entity.BadgeCertificationConfigEntity;
import com.epmet.entity.BadgeEntity;
import com.epmet.service.BadgeCertificationConfigService;
import com.epmet.service.BadgeService;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
/**
* 徽章
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2020-11-03
*/
@Service
public class BadgeServiceImpl extends BaseServiceImpl<BadgeDao, BadgeEntity> implements BadgeService {
@Autowired
private BadgeCertificationConfigService badgeCertificationConfigService;
@Override
public PageData<BadgeDTO> page(Map<String, Object> params) {
IPage<BadgeEntity> page = baseDao.selectPage(
getPage(params, FieldConstant.CREATED_TIME, false),
getWrapper(params)
);
return getPageData(page, BadgeDTO.class);
}
@Override
public List<BadgeDTO> list(Map<String, Object> params) {
List<BadgeEntity> entityList = baseDao.selectList(getWrapper(params));
return ConvertUtils.sourceToTarget(entityList, BadgeDTO.class);
}
private QueryWrapper<BadgeEntity> getWrapper(Map<String, Object> params){
String id = (String)params.get(FieldConstant.ID_HUMP);
QueryWrapper<BadgeEntity> wrapper = new QueryWrapper<>();
wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id);
return wrapper;
}
@Override
public BadgeDTO get(String id) {
BadgeEntity entity = baseDao.selectById(id);
return ConvertUtils.sourceToTarget(entity, BadgeDTO.class);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void save(BadgeDTO dto) {
BadgeEntity entity = ConvertUtils.sourceToTarget(dto, BadgeEntity.class);
insert(entity);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void update(BadgeDTO dto) {
BadgeEntity entity = ConvertUtils.sourceToTarget(dto, BadgeEntity.class);
updateById(entity);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void delete(String[] ids) {
// 逻辑删除(@TableLogic 注解)
baseDao.deleteBatchIds(Arrays.asList(ids));
}
/**
* 获取徽章列表
*
* @param customerId
* @return java.util.List<com.epmet.dto.result.BadgeListResultDTO>
* @author zhaoqifeng
* @date 2020/11/3 17:04
*/
@Override
public List<BadgeListResultDTO> getList(String customerId) {
return baseDao.selectList(customerId);
}
/**
* 添加徽章
*
* @param tokenDto
* @param formDTO
* @return void
* @author zhaoqifeng
* @date 2020/11/4 10:09
*/
@Override
@Transactional(rollbackFor = Exception.class)
public void add(TokenDto tokenDto, AddBadgeFormDTO formDTO) {
//重名校验
List<BadgeListResultDTO> list = baseDao.getDuplicateName(tokenDto.getCustomerId(), formDTO.getBadgeName());
if (CollectionUtils.isNotEmpty(list)) {
throw new RenException(EpmetErrorCode.DUPLICATE_BADGE_NAME.getCode());
}
BadgeEntity entity = ConvertUtils.sourceToTarget(formDTO, BadgeEntity.class);
entity.setCustomerId(tokenDto.getCustomerId());
entity.setFixationBadgeType(BadgeConstant.NONE);
insert(entity);
//保存徽章认证配置
List<BadgeCertificationConfigEntity> badgeList = new ArrayList<>();
formDTO.getCertificationTypes().forEach(item -> {
BadgeCertificationConfigEntity badge = new BadgeCertificationConfigEntity();
badge.setBadgeId(entity.getId());
badge.setCertificationType(item);
badge.setCustomerId(tokenDto.getCustomerId());
badgeList.add(badge);
});
badgeCertificationConfigService.insertBatch(badgeList);
}
/**
* 徽章详情
*
* @param tokenDto
* @param formDTO
* @return com.epmet.dto.result.BadgeDetailResultDTO
* @author zhaoqifeng
* @date 2020/11/4 14:25
*/
@Override
public BadgeDetailResultDTO detail(TokenDto tokenDto, BadgeFormDTO formDTO) {
BadgeDetailResultDTO result = baseDao.selectDetail(tokenDto.getCustomerId(), formDTO.getBadgeId());
List<String> types = badgeCertificationConfigService.getCertificationType(tokenDto.getCustomerId(), formDTO.getBadgeId());
result.setCertificationTypes(types);
return result;
}
/**
* 编辑徽章
*
* @param tokenDto
* @param formDTO
* @return void
* @author zhaoqifeng
* @date 2020/11/4 14:28
*/
@Override
@Transactional(rollbackFor = Exception.class)
public void edit(TokenDto tokenDto, EditBadgeFormDTO formDTO) {
//重名校验
List<BadgeListResultDTO> list = baseDao.getDuplicateNameForEdit(tokenDto.getCustomerId(), formDTO.getBadgeId(), formDTO.getBadgeName());
if (CollectionUtils.isNotEmpty(list)) {
throw new RenException(EpmetErrorCode.DUPLICATE_BADGE_NAME.getCode());
}
BadgeEntity badgeEntity = baseDao.selectBadgeInfo(tokenDto.getCustomerId(), formDTO.getBadgeId());
if (null == badgeEntity) {
badgeEntity = baseDao.selectBadgeInfo("default", formDTO.getBadgeId());
badgeEntity.setCustomerId(tokenDto.getCustomerId());
badgeEntity.setBadgeName(formDTO.getBadgeName());
badgeEntity.setBadgeIcon(formDTO.getBadgeIcon());
badgeEntity.setBadgeStatus(formDTO.getBadgeStatus());
baseDao.insert(badgeEntity);
} else {
badgeEntity.setBadgeName(formDTO.getBadgeName());
badgeEntity.setBadgeIcon(formDTO.getBadgeIcon());
badgeEntity.setBadgeStatus(formDTO.getBadgeStatus());
baseDao.updateBadge(badgeEntity);
}
//保存徽章认证配置
List<BadgeCertificationConfigEntity> badgeList = new ArrayList<>();
formDTO.getCertificationTypes().forEach(item -> {
BadgeCertificationConfigEntity badge = new BadgeCertificationConfigEntity();
badge.setBadgeId(formDTO.getBadgeId());
badge.setCertificationType(item);
badge.setCustomerId(tokenDto.getCustomerId());
badgeList.add(badge);
});
badgeCertificationConfigService.saveConfig(tokenDto.getCustomerId(), formDTO.getBadgeId(), badgeList);
}
/**
* 删除徽章
*
* @param tokenDto
* @param formDTO
* @return void
* @author zhaoqifeng
* @date 2020/11/4 15:34
*/
@Override
public void deleteBadge(TokenDto tokenDto, BadgeFormDTO formDTO) {
BadgeEntity badgeEntity = baseDao.selectBadgeInfo(tokenDto.getCustomerId(), formDTO.getBadgeId());
if (null == badgeEntity) {
badgeEntity = baseDao.selectBadgeInfo("default", formDTO.getBadgeId());
badgeEntity.setCustomerId(tokenDto.getCustomerId());
badgeEntity.setDelFlag(NumConstant.ONE_STR);
baseDao.insert(badgeEntity);
} else {
baseDao.deleteBadge(tokenDto.getCustomerId(), formDTO.getBadgeId());
}
badgeCertificationConfigService.deleteConfig(tokenDto.getCustomerId(), formDTO.getBadgeId());
}
}

239
epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/UserBadgeServiceImpl.java

@ -0,0 +1,239 @@
package com.epmet.service.impl;
import com.alibaba.fastjson.JSON;
import com.epmet.commons.tools.constant.NumConstant;
import com.epmet.commons.tools.exception.EpmetErrorCode;
import com.epmet.commons.tools.exception.RenException;
import com.epmet.commons.tools.security.dto.TokenDto;
import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.commons.tools.utils.Result;
import com.epmet.commons.tools.validator.PhoneValidatorUtils;
import com.epmet.constant.BadgeConstant;
import com.epmet.constant.SmsTemplateConstant;
import com.epmet.dao.UserBadgeDao;
import com.epmet.dto.UserBadgeCertificateRecordDTO;
import com.epmet.dto.form.*;
import com.epmet.dto.result.*;
import com.epmet.feign.EpmetMessageOpenFeignClient;
import com.epmet.redis.UserBadgeRedis;
import com.epmet.service.UserBadgeService;
import com.epmet.service.UserBaseInfoService;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
* @Author zxc
* @DateTime 2020/11/3 11:18 上午
*/
@Service
@Slf4j
public class UserBadgeServiceImpl implements UserBadgeService {
@Autowired
private UserBadgeDao userBadgeDao;
@Autowired
private UserBadgeRedis userBadgeRedis;
@Autowired
private UserBaseInfoService userBaseInfoService;
@Autowired
private EpmetMessageOpenFeignClient epmetMessageOpenFeignClient;
/**
* @Description 查询已经点亮的徽章
* @Param userBadgeListFormDTO
* @author zxc
* @date 2020/11/3 1:33 下午
*/
@Override
public List<UserBadgeListResultDTO> selectBadgeList(UserBadgeListFormDTO userBadgeListFormDTO) {
Object userBadge = userBadgeRedis.getCustomerBadge(userBadgeListFormDTO.getCustomerId());
if (null == userBadge){
List<UserBadgeListResultDTO> resultUserBadge = new ArrayList<>();
List<UserBadgeListResultDTO> userBadgeListResultDTOS = userBadgeDao.selectAllBadge(userBadgeListFormDTO);
if (!CollectionUtils.isEmpty(userBadgeListResultDTOS)){
Map<String, List<UserBadgeListResultDTO>> groupByCustomer = userBadgeListResultDTOS.stream().collect(Collectors.groupingBy(UserBadgeListResultDTO::getCustomerId));
resultUserBadge.addAll(groupByCustomer.get(BadgeConstant.DEFAULT_CUSTOMER));
List<UserBadgeListResultDTO> badgeByCustomer = groupByCustomer.get(userBadgeListFormDTO.getCustomerId());
resultUserBadge.forEach(r -> {
badgeByCustomer.forEach(b -> {
if (r.getBadgeId().equals(b.getBadgeId())){
BeanUtils.copyProperties(b,r);
}
});
});
userBadgeRedis.setCustomerBadge(resultUserBadge,userBadgeListFormDTO.getCustomerId());
userBadge = userBadgeRedis.getCustomerBadge(userBadgeListFormDTO.getCustomerId());
}
}
List<UserBadgeListResultDTO> redisUserBadgeList = JSON.parseArray(userBadge.toString(), UserBadgeListResultDTO.class);
List<UserBadgeListResultDTO> userBadgeListResultDTOS = userBadgeDao.selectBadgeList(userBadgeListFormDTO);
if (CollectionUtils.isEmpty(userBadgeListResultDTOS)){
return redisUserBadgeList;
}
redisUserBadgeList.forEach(u -> {
userBadgeListResultDTOS.forEach(badge -> {
if (u.getBadgeId().equals(badge.getBadgeId())){
badge.setBadgeIcon(u.getBadgeIcon());
u.setStatus(true);
}
});
});
redisUserBadgeList.forEach(u -> {
if (!u.getStatus()){
userBadgeListResultDTOS.add(u);
}
});
return userBadgeListResultDTOS;
}
/**
* @Description 个人中心-获取徽章可操作列表点亮取消认证
* @Param userOperListFormDTO
* @author zxc
* @date 2020/11/3 4:42 下午
*/
@Override
public List<UserOperListResultDTO> selectOperList(UserOperListFormDTO userOperListFormDTO) {
List<UserOperListResultDTO> userAuthBadgeList = userBadgeDao.selectAuthRecord(userOperListFormDTO.getUserId());
Object userBadge = userBadgeRedis.getCustomerBadge(userOperListFormDTO.getCustomerId());
List<UserOperListResultDTO> userOperListResultDTOS = JSON.parseArray(userBadge.toString(), UserOperListResultDTO.class);
// 没有任何记录
if (CollectionUtils.isEmpty(userAuthBadgeList)){
userOperListResultDTOS.forEach(u -> {
u.setIsLighted(u.getIsOpened().equals(NumConstant.ZERO_STR) ? BadgeConstant.NO : BadgeConstant.YES);
u.setIsCertificated(BadgeConstant.NO);
u.setIsReject(false);
});
return userOperListResultDTOS;
}
List<UserOperListResultDTO> badgeIsOpenedList = userBadgeDao.selectBadgeByUserId(userOperListFormDTO.getUserId());
userOperListResultDTOS.forEach(ub -> {
userAuthBadgeList.forEach(u -> {
if (ub.getBadgeId().equals(u.getBadgeId())){
ub.setIsReject(u.getAuditStatus().equals(BadgeConstant.REJECTED) ? true : false);
ub.setIsCertificated(u.getAuditStatus().equals(BadgeConstant.APPROVED) ? BadgeConstant.YES : BadgeConstant.NO);
}
});
if (CollectionUtils.isEmpty(badgeIsOpenedList)){
ub.setIsLighted(BadgeConstant.NO);
}else {
badgeIsOpenedList.forEach(b -> {
if (ub.getBadgeId().equals(b.getBadgeId())){
ub.setIsLighted(b.getIsOpened().equals(NumConstant.ZERO_STR) ? BadgeConstant.NO : BadgeConstant.YES);
}
});
}
});
return userOperListResultDTOS;
}
/**
* @Description 个人中心-提交徽章认证
* @Param certificationAddFormDTO
* @author zxc
* @date 2020/11/4 1:36 下午
*/
@Override
@Transactional(rollbackFor = Exception.class)
public Result authBadgeRecord(CertificationAddFormDTO certificationAddFormDTO) {
if (StringUtils.isNotBlank(certificationAddFormDTO.getMobile())){
String smsCode = userBadgeRedis.getBadgeSmsCode(certificationAddFormDTO.getMobile());
if (!StringUtils.isNotBlank(smsCode)){
return new Result().error(EpmetErrorCode.MOBILE_CODE_ERROR.getCode());
}
}
UserBadgeCertificateRecordDTO form = ConvertUtils.sourceToTarget(certificationAddFormDTO, UserBadgeCertificateRecordDTO.class);
List<String> userIds = new ArrayList<>();
userIds.add(certificationAddFormDTO.getUserId());
List<UserBaseInfoResultDTO> userBaseInfoResultDTOS = userBaseInfoService.queryUserBaseInfo(userIds);
if (CollectionUtils.isEmpty(userBaseInfoResultDTOS)){
throw new RenException("查询用户基本信息集合为空......");
}
userBadgeDao.updateCertificateRecordIsLast(form.getBadgeId(),form.getUserId());
form.setGridId(userBaseInfoResultDTOS.get(NumConstant.ZERO).getRegisteredGridId());
form.setIdNum(certificationAddFormDTO.getIdCard());
form.setCertificationImg(certificationAddFormDTO.getCertificate());
form.setSurname(certificationAddFormDTO.getSubName());
userBadgeDao.insertUserBadgeCertificateRecord(form);
return new Result();
}
/**
* @Description 发送验证码
* @Param badgeSendCodeFormDTO
* @author zxc
* @date 2020/11/4 3:14 下午
*/
@Override
public void badgeSendCode(BadgeSendCodeFormDTO badgeSendCodeFormDTO) {
//1、校验手机号是否符合规范
if (!PhoneValidatorUtils.isMobile(badgeSendCodeFormDTO.getMobile())) {
log.error(String.format("发送短信验证码异常,手机号[%s],code[%s],msg[%s]", badgeSendCodeFormDTO.getMobile(), EpmetErrorCode.ERROR_PHONE.getCode(), EpmetErrorCode.ERROR_PHONE.getMsg()));
throw new RenException(EpmetErrorCode.ERROR_PHONE.getCode());
}
//3、发送短信验证码
SendVerificationCodeFormDTO sendVerificationCodeFormDTO=new SendVerificationCodeFormDTO();
sendVerificationCodeFormDTO.setMobile(badgeSendCodeFormDTO.getMobile());
sendVerificationCodeFormDTO.setAliyunTemplateCode(SmsTemplateConstant.LGOIN_CONFIRM);
Result<SendVerificationCodeResultDTO> smsCodeResult=epmetMessageOpenFeignClient.sendVerificationCode(sendVerificationCodeFormDTO);
if (!smsCodeResult.success()) {
log.error(String.format("发送短信验证码异常,手机号[%s],code[%s],msg[%s]", badgeSendCodeFormDTO.getMobile(), smsCodeResult.getCode(), smsCodeResult.getMsg()));
throw new RenException(smsCodeResult.getCode());
}
//4、保存短信验证码(删除现有短信验证码、将新的短信验证码存入Redis)
userBadgeRedis.saveBadgeSmsCode(badgeSendCodeFormDTO.getMobile(),smsCodeResult.getData().getCode());
log.info(String.format("发送短信验证码成功,手机号[%s]", badgeSendCodeFormDTO.getMobile()));
}
/**
* @Description 个人中心-获取徽章认证页面详情
* @Param tokenDto
* @Param certificationDetailFormDTO
* @author zxc
* @date 2020/11/4 4:03 下午
*/
@Override
public CertificationDetailResultDTO certificationDetail(TokenDto tokenDto, CertificationDetailFormDTO certificationDetailFormDTO) {
certificationDetailFormDTO.setUserId(tokenDto.getUserId());
return userBadgeDao.selectBadgeAuthRecord(certificationDetailFormDTO.getUserId(), certificationDetailFormDTO.getBadgeId());
}
/**
* @Description 个人中心-查询徽章要显示的认证信息字段
* @Param authFieldFormDTO
* @author zxc
* @date 2020/11/4 5:05 下午
*/
@Override
public List<AuthFieldResultDTO> authField(AuthFieldFormDTO authFieldFormDTO) {
List<AuthFieldResultDTO> authFieldResultDTOS = userBadgeDao.selectAuthField(authFieldFormDTO);
if (CollectionUtils.isEmpty(authFieldResultDTOS)){
return new ArrayList<>();
}
return authFieldResultDTOS;
}
/**
* @Description 个人中心-取消/点亮徽章
* @Param openedOrClosedFormDTO
* @author zxc
* @date 2020/11/4 5:47 下午
*/
@Override
@Transactional(rollbackFor = Exception.class)
public void openedOrClosed(OpenedOrClosedFormDTO openedOrClosedFormDTO) {
userBadgeDao.updateIsOpen(openedOrClosedFormDTO);
}
}

18
epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/UserResiInfoServiceImpl.java

@ -325,4 +325,22 @@ public class UserResiInfoServiceImpl extends BaseServiceImpl<UserResiInfoDao, Us
return userResiInfoDao.selectIssueInitiator(formDTO);
}
/**
* 修改个人信息
*
* @param formDTO
* @return void
* @author zhaoqifeng
* @date 2020/11/3 10:29
*/
@Override
public void editUserInfo(EditInfoFormDTO formDTO) {
//更新居民注册信息表
baseDao.updateByUserId(ConvertUtils.sourceToTarget(formDTO, UserResiInfoEntity.class));
//更新baseInfo
UserBaseInfoEntity baseInfo = ConvertUtils.sourceToTarget(formDTO, UserBaseInfoEntity.class);
baseInfo.setRealName(formDTO.getSurname() + formDTO.getName());
userBaseInfoService.insertOrUpdate(baseInfo);
}
}

199
epmet-user/epmet-user-server/src/main/resources/db/migration/2020-11-03_badege.sql

@ -0,0 +1,199 @@
/*
Navicat Premium Data Transfer
Source Server : 亿
Source Server Type : MySQL
Source Server Version : 50728
Source Host : 192.168.1.130:3306
Source Schema : epmet_user
Target Server Type : MySQL
Target Server Version : 50728
File Encoding : 65001
Date: 03/11/2020 10:36:00
*/
SET NAMES utf8mb4;
SET FOREIGN_KEY_CHECKS = 0;
-- ----------------------------
-- Table structure for badege
-- ----------------------------
DROP TABLE IF EXISTS `badege`;
CREATE TABLE `badege`
(
`ID` varchar(64) NOT NULL COMMENT '主键ID',
`CUSTOMER_ID` varchar(64) NOT NULL COMMENT '客户Id 默认配置id:default',
`BADEGE_NAME` varchar(32) NOT NULL COMMENT '徽章名称',
`BADEGE_ICON` varchar(256) NOT NULL COMMENT '徽章图标url',
`FIXATION_BADEGE_TYPE` varchar(32) NOT NULL DEFAULT 'none' COMMENT '固有徽章类型 前端页面跳转标识,党员徽章:party;无:none',
`BADEGE_STATUS` varchar(16) NOT NULL COMMENT '状态 上线:online;下线:offline;',
`DEL_FLAG` varchar(1) NOT NULL DEFAULT '0' COMMENT '删除标识 1删除;0未删除',
`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`, `CUSTOMER_ID`) USING BTREE
) ENGINE = InnoDB
DEFAULT CHARSET = utf8mb4 COMMENT ='徽章';
-- ----------------------------
-- Records of badege
-- ----------------------------
BEGIN;
INSERT INTO `badege`
VALUES ('1', 'default', '党员徽章',
'https://elink-esua-epdc.oss-cn-qingdao.aliyuncs.com/epmet/test/20200909/e4935b1f790b4d4e91ac9190a47120bb.jpg',
'party', 'online', '0', 0, 'APP_USER', '2020-11-03 10:33:52', 'APP_USER', '2020-11-03 10:34:00');
INSERT INTO `badege`
VALUES ('2', 'default', '人大代表徽章',
'https://elink-esua-epdc.oss-cn-qingdao.aliyuncs.com/epmet/test/20200909/e4935b1f790b4d4e91ac9190a47120bb.jpg',
'none', 'online', '0', 0, 'APP_USER', '2020-11-03 10:33:52', 'APP_USER', '2020-11-03 10:34:00');
INSERT INTO `badege`
VALUES ('3', 'default', '政协委员徽章',
'https://elink-esua-epdc.oss-cn-qingdao.aliyuncs.com/epmet/test/20200909/e4935b1f790b4d4e91ac9190a47120bb.jpg',
'none', 'online', '0', 0, 'APP_USER', '2020-11-03 10:33:52', 'APP_USER', '2020-11-03 10:34:00');
COMMIT;
-- ----------------------------
-- Table structure for badege_certification_config
-- ----------------------------
DROP TABLE IF EXISTS `badege_certification_config`;
CREATE TABLE `badege_certification_config`
(
`ID` varchar(64) NOT NULL COMMENT '主键ID',
`CUSTOMER_ID` varchar(64) NOT NULL COMMENT '客户Id 默认配置id:default',
`BADEGE_ID` varchar(64) NOT NULL COMMENT '徽章ID',
`CERTIFICATION_TYPE` varchar(16) NOT NULL COMMENT '认证信息类型 手机号:mobile;全名:fullname;身份证:idcard;认证证件: certificate;认证说明(备注):remark',
`DEL_FLAG` varchar(1) NOT NULL DEFAULT '0' COMMENT '删除标识 1删除;0未删除',
`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 ='徽章认证配置';
-- ----------------------------
-- Records of badege_certification_config
-- ----------------------------
BEGIN;
COMMIT;
-- ----------------------------
-- Table structure for badege_certification_config_field
-- ----------------------------
DROP TABLE IF EXISTS `badege_certification_config_field`;
CREATE TABLE `badege_certification_config_field`
(
`ID` varchar(64) NOT NULL,
`CN_NAME` varchar(64) NOT NULL COMMENT '中文名',
`EN_NAME` varchar(64) NOT NULL COMMENT '英文名(字段名)',
`FIELD_TYPE` varchar(32) NOT NULL COMMENT '字段类型 img:图片,text:文本',
`IS_REQUIRED` tinyint(1) NOT NULL COMMENT '是否必填',
`CERTIFICATION_TYPE` varchar(255) NOT NULL COMMENT '认证信息类型',
`SORT` int(10) NOT NULL COMMENT '字段排序',
`DEL_FLAG` int(11) DEFAULT NULL COMMENT '删除标识 1删除0未删除',
`REVISION` int(11) DEFAULT NULL COMMENT '乐观锁',
`CREATED_BY` varchar(32) DEFAULT NULL COMMENT '创建人',
`CREATED_TIME` datetime DEFAULT NULL COMMENT '创建时间',
`UPDATED_BY` varchar(32) DEFAULT NULL COMMENT '更新人',
`UPDATED_TIME` datetime DEFAULT NULL COMMENT '更新时间',
PRIMARY KEY (`ID`)
) ENGINE = InnoDB
DEFAULT CHARSET = utf8mb4 COMMENT =' 徽章认证配置字段表\n';
-- ----------------------------
-- Records of badege_certification_config_field
-- ----------------------------
BEGIN;
INSERT INTO `badege_certification_config_field`
VALUES ('a5be5d931cf411eb8dcfc03fd56f7847', '手机号', 'mobile', 'text', 1, 'mobile', 3, 0, 0, 'APP_USER',
'2020-11-02 18:14:02', 'APP_USER', '2020-11-02 18:14:06');
INSERT INTO `badege_certification_config_field`
VALUES ('a5c01dd81cf411eb8dcfc03fd56f7847', '', 'subName', 'text', 1, 'fullName', 0, 0, 0, 'APP_USER',
'2020-11-02 18:14:02', 'APP_USER', '2020-11-02 18:14:06');
INSERT INTO `badege_certification_config_field`
VALUES ('a5c01de81cf411eb8dcfc03fd56f7847', '', 'name', 'text', 1, 'fullName', 1, 0, 0, 'APP_USER',
'2020-11-02 18:14:02', 'APP_USER', '2020-11-02 18:14:06');
INSERT INTO `badege_certification_config_field`
VALUES ('a5c22e511cf411eb8dcfc03fd56f7847', '身份证', 'idcard', 'text', 1, 'idcard', 2, 0, 0, 'APP_USER',
'2020-11-02 18:14:02', 'APP_USER', '2020-11-02 18:14:06');
INSERT INTO `badege_certification_config_field`
VALUES ('a5c4c2c11cf411eb8dcfc03fd56f7847', '认证证件', 'certificate', 'img', 1, 'certificate', 4, 0, 0, 'APP_USER',
'2020-11-02 18:14:02', 'APP_USER', '2020-11-02 18:14:06');
INSERT INTO `badege_certification_config_field`
VALUES ('a5c608301cf411eb8dcfc03fd56f7847', '认证说明(备注)', 'remark', 'text', 1, 'remark', 5, 0, 0, 'APP_USER',
'2020-11-02 18:14:02', 'APP_USER', '2020-11-02 18:14:06');
COMMIT;
-- ----------------------------
-- Table structure for resi_user_badege
-- ----------------------------
DROP TABLE IF EXISTS `resi_user_badege`;
CREATE TABLE `resi_user_badege`
(
`ID` varchar(64) NOT NULL COMMENT '主键ID',
`CUSTOMER_ID` varchar(64) NOT NULL COMMENT '客户Id 默认配置id:default',
`GRID_ID` varchar(64) NOT NULL COMMENT '用户注册网格ID',
`USER_ID` varchar(64) NOT NULL COMMENT '用户ID',
`BADEGE_ID` varchar(64) NOT NULL COMMENT '徽章ID',
`IS_OPENED` tinyint(1) NOT NULL DEFAULT '0' COMMENT '是否开启(点亮) 1:点亮;0:未点亮',
`CERTIFICATION_AUTID_STATUS` varchar(16) NOT NULL DEFAULT 'auditing' COMMENT '认证(审核)状态 待审核:auditing;审核通过:pass;驳回:rejected;',
`DEL_FLAG` varchar(1) NOT NULL DEFAULT '0' COMMENT '删除标识 1删除;0未删除',
`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 ='用户徽章关系表';
-- ----------------------------
-- Records of resi_user_badege
-- ----------------------------
BEGIN;
COMMIT;
-- ----------------------------
-- Table structure for user_badege_certificate_record
-- ----------------------------
DROP TABLE IF EXISTS `user_badege_certificate_record`;
CREATE TABLE `user_badege_certificate_record`
(
`ID` varchar(64) NOT NULL COMMENT '主键ID',
`CUSTOMER_ID` varchar(64) NOT NULL COMMENT '客户Id ',
`GRID_ID` varchar(64) NOT NULL COMMENT '用户注册网格ID',
`USER_ID` varchar(64) NOT NULL COMMENT '用户ID',
`BADEGE_ID` varchar(64) NOT NULL COMMENT '徽章ID',
`SURNAME` varchar(8) DEFAULT NULL COMMENT '',
`NAME` varchar(16) DEFAULT NULL COMMENT '',
`ID_NUM` varchar(32) DEFAULT NULL COMMENT '身份证号 网格内去重',
`CERTIFICATION_IMG` varchar(512) DEFAULT NULL COMMENT '认证证件图片',
`REMAEK` varchar(128) DEFAULT NULL COMMENT '认证说明(备注)',
`AUDIT_STATUS` varchar(32) NOT NULL DEFAULT 'auditing' COMMENT '审核状态 approved:审核通过,rejected:审核驳回;auditing:审核中',
`AUDIT_REMARK` varchar(128) DEFAULT NULL COMMENT '审核意见',
`STAFF_ID` varchar(32) DEFAULT NULL COMMENT '审核人 审核人Id',
`AUDIT_TIME` datetime DEFAULT NULL COMMENT '审核时间',
`DEL_FLAG` varchar(32) NOT NULL DEFAULT '0' COMMENT '删除标识 1删除;0未删除',
`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`),
KEY `IDX_USER_ID` (`USER_ID`)
) ENGINE = InnoDB
DEFAULT CHARSET = utf8mb4 COMMENT ='用户认证徽章记录表';
-- ----------------------------
-- Records of user_badege_certificate_record
-- ----------------------------
BEGIN;
COMMIT;
SET FOREIGN_KEY_CHECKS = 1;

42
epmet-user/epmet-user-server/src/main/resources/mapper/BadgeCertificationConfigDao.xml

@ -0,0 +1,42 @@
<?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.BadgeCertificationConfigDao">
<resultMap type="com.epmet.entity.BadgeCertificationConfigEntity" id="badgeCertificationConfigMap">
<result property="id" column="ID"/>
<result property="customerId" column="CUSTOMER_ID"/>
<result property="badgeId" column="BADGE_ID"/>
<result property="certificationType" column="CERTIFICATION_TYPE"/>
<result property="delFlag" column="DEL_FLAG"/>
<result property="revision" column="REVISION"/>
<result property="createdBy" column="CREATED_BY"/>
<result property="createdTime" column="CREATED_TIME"/>
<result property="updatedBy" column="UPDATED_BY"/>
<result property="updatedTime" column="UPDATED_TIME"/>
</resultMap>
<delete id="deleteConfig">
DELETE a
FROM
badge_certification_config a
WHERE
EXISTS (
SELECT
*
FROM
( SELECT ID FROM badge_certification_config
WHERE CUSTOMER_ID = #{customerId}
AND BADGE_ID = #{badgeId}
AND DEL_FLAG = '0' ) b
WHERE
a.ID = b.ID)
</delete>
<select id="getCertificationType" resultType="java.lang.String">
select CERTIFICATION_TYPE from badge_certification_config
where CUSTOMER_ID = #{customerId}
and BADGE_ID = #{badgeId}
and DEL_FLAG = '0'
</select>
</mapper>

116
epmet-user/epmet-user-server/src/main/resources/mapper/BadgeDao.xml

@ -0,0 +1,116 @@
<?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.BadgeDao">
<resultMap type="com.epmet.entity.BadgeEntity" id="badgeMap">
<result property="id" column="ID"/>
<result property="customerId" column="CUSTOMER_ID"/>
<result property="badgeName" column="BADGE_NAME"/>
<result property="badgeIcon" column="BADGE_ICON"/>
<result property="fixationBadgeType" column="FIXATION_BADGE_TYPE"/>
<result property="badgeStatus" column="BADGE_STATUS"/>
<result property="delFlag" column="DEL_FLAG"/>
<result property="revision" column="REVISION"/>
<result property="createdBy" column="CREATED_BY"/>
<result property="createdTime" column="CREATED_TIME"/>
<result property="updatedBy" column="UPDATED_BY"/>
<result property="updatedTime" column="UPDATED_TIME"/>
</resultMap>
<update id="updateBadge" parameterType="com.epmet.entity.BadgeEntity">
update badge set
BADGE_NAME = #{badgeName},
BADGE_ICON = #{badgeIcon},
BADGE_STATUS = #{badgeStatus}
where ID = #{id} AND CUSTOMER_ID = #{customerId}
</update>
<update id="deleteBadge">
update badge set
DEL_FLAG = '1'
where ID = #{badgeId} AND CUSTOMER_ID = #{customerId}
</update>
<select id="selectList" resultType="com.epmet.dto.result.BadgeListResultDTO">
SELECT
ID AS "badgeId",
BADGE_NAME,
BADGE_ICON,
BADGE_STATUS
FROM
(
SELECT * FROM badge
WHERE CUSTOMER_ID = #{customerId} AND DEL_FLAG = '0'
UNION ALL
SELECT * FROM badge a
WHERE CUSTOMER_ID = 'default' AND a.DEL_FLAG = '0'
AND NOT EXISTS
( SELECT ID FROM badge b WHERE CUSTOMER_ID = #{customerId} AND a.BADGE_NAME = b.BADGE_NAME AND b.DEL_FLAG = '0')) t
ORDER BY
CREATED_TIME DESC
</select>
<select id="getDuplicateName" resultType="com.epmet.dto.result.BadgeListResultDTO">
SELECT
*
FROM
(SELECT
ID AS "badgeId",
BADGE_NAME,
BADGE_ICON,
BADGE_STATUS
FROM
(
SELECT * FROM badge
WHERE CUSTOMER_ID = #{customerId} AND DEL_FLAG = '0'
UNION ALL
SELECT * FROM badge a
WHERE CUSTOMER_ID = 'default' AND a.DEL_FLAG = '0'
AND NOT EXISTS
( SELECT ID FROM badge b WHERE CUSTOMER_ID = #{customerId} AND a.BADGE_NAME = b.BADGE_NAME AND b.DEL_FLAG = '0' )) t) a
WHERE BADGE_NAME = #{badgeName}
</select>
<select id="selectDetail" resultType="com.epmet.dto.result.BadgeDetailResultDTO">
SELECT
*
FROM
(SELECT
ID AS "badgeId",
BADGE_NAME,
BADGE_ICON,
BADGE_STATUS
FROM
(
SELECT * FROM badge
WHERE CUSTOMER_ID = #{customerId} AND DEL_FLAG = '0'
UNION ALL
SELECT * FROM badge a
WHERE CUSTOMER_ID = 'default' AND a.DEL_FLAG = '0'
AND NOT EXISTS
( SELECT ID FROM badge b WHERE CUSTOMER_ID = #{customerId} AND a.BADGE_NAME = b.BADGE_NAME AND b.DEL_FLAG = '0' )) t) a
WHERE badgeId = #{badgeId}
</select>
<select id="getDuplicateNameForEdit" resultType="com.epmet.dto.result.BadgeListResultDTO">
SELECT
*
FROM
(SELECT
ID AS "badgeId",
BADGE_NAME,
BADGE_ICON,
BADGE_STATUS
FROM
(
SELECT * FROM badge
WHERE CUSTOMER_ID = #{customerId} AND DEL_FLAG = '0'
UNION ALL
SELECT * FROM badge a
WHERE CUSTOMER_ID = 'default' AND a.DEL_FLAG = '0'
AND NOT EXISTS
( SELECT ID FROM badge b WHERE CUSTOMER_ID = #{customerId} AND a.BADGE_NAME = b.BADGE_NAME AND b.DEL_FLAG = '0' )) t) a
WHERE BADGE_NAME = #{badgeName} AND badgeId != #{badgeId}
</select>
<select id="selectBadgeInfo" resultType="com.epmet.entity.BadgeEntity">
select * from badge where DEL_FLAG = '0' AND CUSTOMER_ID = #{customerId} AND ID = #{badgeId}
</select>
</mapper>

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

Loading…
Cancel
Save