From 9547cad3fda57a5db6b9f7a5cbcd75db35db1615 Mon Sep 17 00:00:00 2001 From: liushaowen <565850092@qq.com> Date: Mon, 2 Nov 2020 18:21:00 +0800 Subject: [PATCH 01/23] =?UTF-8?q?=E5=A4=96=E9=83=A8=E8=B0=83=E7=94=A8?= =?UTF-8?q?=E7=AB=99=E5=86=85=E4=BF=A1=E6=95=B4=E5=90=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/epmet/dto/UserMessageDTO.java | 7 +++- .../epmet/dto/form/UserMessageFormDTO.java | 5 +++ .../dto/form/WxmpMessagePushFormDTO.java | 17 ++++++++- .../java/com/epmet/constant/ExtConstant.java | 11 ++++++ .../controller/WxmpMessageExtController.java | 23 +++++++++++- .../com/epmet/entity/UserMessageEntity.java | 5 +++ .../com/epmet/excel/UserMessageExcel.java | 5 ++- .../impl/WxmpMessageExtServiceImpl.java | 37 +++++++++++++++---- .../service/impl/WxmpMessageServiceImpl.java | 2 +- ....3.12.5__alter_user_message_add_column.sql | 1 + 10 files changed, 98 insertions(+), 15 deletions(-) create mode 100644 epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/constant/ExtConstant.java create mode 100644 epmet-module/epmet-message/epmet-message-server/src/main/resources/db/migration/V0.3.12.5__alter_user_message_add_column.sql diff --git a/epmet-module/epmet-message/epmet-message-client/src/main/java/com/epmet/dto/UserMessageDTO.java b/epmet-module/epmet-message/epmet-message-client/src/main/java/com/epmet/dto/UserMessageDTO.java index f8b887c240..d44c80ae47 100644 --- a/epmet-module/epmet-message/epmet-message-client/src/main/java/com/epmet/dto/UserMessageDTO.java +++ b/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; -} \ No newline at end of file +} diff --git a/epmet-module/epmet-message/epmet-message-client/src/main/java/com/epmet/dto/form/UserMessageFormDTO.java b/epmet-module/epmet-message/epmet-message-client/src/main/java/com/epmet/dto/form/UserMessageFormDTO.java index f8934cc167..f3298183d6 100644 --- a/epmet-module/epmet-message/epmet-message-client/src/main/java/com/epmet/dto/form/UserMessageFormDTO.java +++ b/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; } diff --git a/epmet-module/epmet-message/epmet-message-client/src/main/java/com/epmet/dto/form/WxmpMessagePushFormDTO.java b/epmet-module/epmet-message/epmet-message-client/src/main/java/com/epmet/dto/form/WxmpMessagePushFormDTO.java index fbd2732581..067ea3b3bb 100644 --- a/epmet-module/epmet-message/epmet-message-client/src/main/java/com/epmet/dto/form/WxmpMessagePushFormDTO.java +++ b/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; + } diff --git a/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/constant/ExtConstant.java b/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/constant/ExtConstant.java new file mode 100644 index 0000000000..f8b9564e7a --- /dev/null +++ b/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"; +} diff --git a/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/controller/WxmpMessageExtController.java b/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/controller/WxmpMessageExtController.java index b6ffa1fc2f..242dfe3cb9 100644 --- a/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/controller/WxmpMessageExtController.java +++ b/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/controller/WxmpMessageExtController.java @@ -1,9 +1,12 @@ package com.epmet.controller; +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.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 +14,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 +24,29 @@ 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 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(); } } diff --git a/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/entity/UserMessageEntity.java b/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/entity/UserMessageEntity.java index db267d9fd7..dcdd460cde 100644 --- a/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/entity/UserMessageEntity.java +++ b/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; + } diff --git a/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/excel/UserMessageExcel.java b/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/excel/UserMessageExcel.java index 8dbbf8249c..760e390274 100644 --- a/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/excel/UserMessageExcel.java +++ b/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; -} \ No newline at end of file +} diff --git a/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/service/impl/WxmpMessageExtServiceImpl.java b/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/service/impl/WxmpMessageExtServiceImpl.java index 368235246a..21204730c5 100644 --- a/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/service/impl/WxmpMessageExtServiceImpl.java +++ b/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/service/impl/WxmpMessageExtServiceImpl.java @@ -2,8 +2,12 @@ package com.epmet.service.impl; import com.epmet.commons.tools.exception.RenException; import com.epmet.commons.tools.utils.Result; +import com.epmet.constant.ExtConstant; +import com.epmet.dto.form.UserMessageFormDTO; import com.epmet.dto.form.WxSubscribeMessageFormDTO; import com.epmet.dto.form.WxmpMessagePushFormDTO; +import com.epmet.feign.EpmetMessageOpenFeignClient; +import com.epmet.service.UserMessageService; import com.epmet.service.WxmpMessageExtService; import com.epmet.service.WxmpMessageService; import org.springframework.beans.BeanUtils; @@ -24,20 +28,37 @@ public class WxmpMessageExtServiceImpl implements WxmpMessageExtService { @Autowired private WxmpMessageService wxmpMessageService; + @Autowired + private UserMessageService userMessageService; + @Override public Result pushWxmpMessage(List dtos) { - List msgList = new ArrayList<>(); + List wxmpMsgList = new ArrayList<>(); + List 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); } } diff --git a/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/service/impl/WxmpMessageServiceImpl.java b/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/service/impl/WxmpMessageServiceImpl.java index 3e834efdf1..7d7d68af77 100644 --- a/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/service/impl/WxmpMessageServiceImpl.java +++ b/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; } diff --git a/epmet-module/epmet-message/epmet-message-server/src/main/resources/db/migration/V0.3.12.5__alter_user_message_add_column.sql b/epmet-module/epmet-message/epmet-message-server/src/main/resources/db/migration/V0.3.12.5__alter_user_message_add_column.sql new file mode 100644 index 0000000000..cd2bf71d81 --- /dev/null +++ b/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 '调用者'; From 654039601fc5d07b4e34d52db764d8f533aec030 Mon Sep 17 00:00:00 2001 From: jianjun Date: Tue, 3 Nov 2020 10:37:57 +0800 Subject: [PATCH 02/23] =?UTF-8?q?=E5=BE=BD=E7=AB=A0=E5=88=9D=E5=A7=8B?= =?UTF-8?q?=E5=8C=96=E8=84=9A=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../db/migration/2020-11-03_badege.sql | 199 ++++++++++++++++++ 1 file changed, 199 insertions(+) create mode 100644 epmet-user/epmet-user-server/src/main/resources/db/migration/2020-11-03_badege.sql diff --git a/epmet-user/epmet-user-server/src/main/resources/db/migration/2020-11-03_badege.sql b/epmet-user/epmet-user-server/src/main/resources/db/migration/2020-11-03_badege.sql new file mode 100644 index 0000000000..0e605aa9ab --- /dev/null +++ b/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; From 800cc1ffe0fc8272902789ddafd02f4c9b6d9b64 Mon Sep 17 00:00:00 2001 From: sunyuchao Date: Tue, 3 Nov 2020 10:54:47 +0800 Subject: [PATCH 03/23] =?UTF-8?q?=E5=AF=B9=E5=A4=96=E6=8E=A5=E5=8F=A3-?= =?UTF-8?q?=E6=9F=A5=E8=AF=A2=E7=BB=84=E7=BB=87=E5=9F=BA=E6=9C=AC=E4=BF=A1?= =?UTF-8?q?=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/epmet/constant/ModuleConstant.java | 2 + .../epmet/controller/OpenUpController.java | 16 ++++- .../java/com/epmet/service/OpenUpService.java | 8 +++ .../epmet/service/impl/OpenUpServiceImpl.java | 14 ++++ .../com/epmet/dto/form/AgencyInfoFormDTO.java | 21 ++++++ .../epmet/dto/result/AgencyInfoResultDTO.java | 66 +++++++++++++++++++ .../epmet/feign/GovOrgOpenFeignClient.java | 9 +++ .../GovOrgOpenFeignClientFallback.java | 5 ++ .../controller/CustomerAgencyController.java | 9 +++ .../epmet/service/CustomerAgencyService.java | 6 ++ .../impl/CustomerAgencyServiceImpl.java | 16 +++++ 11 files changed, 170 insertions(+), 2 deletions(-) create mode 100644 epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/AgencyInfoFormDTO.java create mode 100644 epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/AgencyInfoResultDTO.java diff --git a/epmet-module/epmet-ext/epmet-ext-server/src/main/java/com/epmet/constant/ModuleConstant.java b/epmet-module/epmet-ext/epmet-ext-server/src/main/java/com/epmet/constant/ModuleConstant.java index d8b34dc284..1bc1cc935a 100644 --- a/epmet-module/epmet-ext/epmet-ext-server/src/main/java/com/epmet/constant/ModuleConstant.java +++ b/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服务查询组织基本信息失败"; + } diff --git a/epmet-module/epmet-ext/epmet-ext-server/src/main/java/com/epmet/controller/OpenUpController.java b/epmet-module/epmet-ext/epmet-ext-server/src/main/java/com/epmet/controller/OpenUpController.java index 81ccddbdff..9884efe1b2 100644 --- a/epmet-module/epmet-ext/epmet-ext-server/src/main/java/com/epmet/controller/OpenUpController.java +++ b/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,15 @@ public class OpenUpController { return govOrgOpenFeignClient.staffPermissionExt(commonStaffIdFormDTO.getStaffId()); } + /** + * @Description 对外接口-根据组织Id获取组织信息 + * @author sun + **/ + @PostMapping("agencyinfo") + Result agencyInfo(@RequestBody AgencyInfoFormDTO formDTO) { + ValidatorUtils.validateEntity(formDTO, AgencyInfoFormDTO.StaffIdGroup.class); + return new Result().ok(openUpService.agencyInfo(formDTO)); + } + } diff --git a/epmet-module/epmet-ext/epmet-ext-server/src/main/java/com/epmet/service/OpenUpService.java b/epmet-module/epmet-ext/epmet-ext-server/src/main/java/com/epmet/service/OpenUpService.java index 5ecbf7aedb..d42e164f7e 100644 --- a/epmet-module/epmet-ext/epmet-ext-server/src/main/java/com/epmet/service/OpenUpService.java +++ b/epmet-module/epmet-ext/epmet-ext-server/src/main/java/com/epmet/service/OpenUpService.java @@ -1,8 +1,10 @@ package com.epmet.service; +import com.epmet.dto.form.AgencyInfoFormDTO; import com.epmet.dto.form.StaffSinAgencyFormDTO; import com.epmet.dto.form.StaffSinDeptFormDTO; import com.epmet.dto.form.StaffSinGridFormDTO; +import com.epmet.dto.result.AgencyInfoResultDTO; import com.epmet.dto.result.StaffSinAgencyResultDTO; import com.epmet.dto.result.StaffSinDeptResultDTO; import com.epmet.dto.result.StaffSinGridResultDTO; @@ -38,4 +40,10 @@ public interface OpenUpService { * @date 2020/8/17 9:59 上午 */ List staffSinAgency(StaffSinAgencyFormDTO formDTO); + + /** + * @Description 对外接口-根据组织Id获取组织信息 + * @author sun + **/ + AgencyInfoResultDTO agencyInfo(AgencyInfoFormDTO formDTO); } diff --git a/epmet-module/epmet-ext/epmet-ext-server/src/main/java/com/epmet/service/impl/OpenUpServiceImpl.java b/epmet-module/epmet-ext/epmet-ext-server/src/main/java/com/epmet/service/impl/OpenUpServiceImpl.java index 38120535b9..2290c84f59 100644 --- a/epmet-module/epmet-ext/epmet-ext-server/src/main/java/com/epmet/service/impl/OpenUpServiceImpl.java +++ b/epmet-module/epmet-ext/epmet-ext-server/src/main/java/com/epmet/service/impl/OpenUpServiceImpl.java @@ -6,6 +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.AgencyInfoResultDTO; import com.epmet.dto.result.StaffSinAgencyResultDTO; import com.epmet.dto.result.StaffSinDeptResultDTO; import com.epmet.dto.result.StaffSinGridResultDTO; @@ -123,4 +124,17 @@ public class OpenUpServiceImpl implements OpenUpService { return staffInfoList.getData(); } + /** + * @Description 对外接口-根据组织Id获取组织信息 + * @author sun + **/ + @Override + public AgencyInfoResultDTO agencyInfo(AgencyInfoFormDTO formDTO) { + Result result = govOrgOpenFeignClient.agencyInfo(formDTO); + if (!result.success()){ + throw new RenException(ModuleConstant.ERROR_AGENCY); + } + return result.getData(); + } + } diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/AgencyInfoFormDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/AgencyInfoFormDTO.java new file mode 100644 index 0000000000..0288dd339e --- /dev/null +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/AgencyInfoFormDTO.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; + +/** + * @Author zxc + * @DateTime 2020/8/17 10:37 上午 + */ +@Data +public class AgencyInfoFormDTO implements Serializable { + + private static final long serialVersionUID = -1719033407335647411L; + @NotBlank(message = "组织Id不能为空" , groups = StaffIdGroup.class) + private String agencyId; + + public interface StaffIdGroup extends CustomerClientShowGroup {} +} diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/AgencyInfoResultDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/AgencyInfoResultDTO.java new file mode 100644 index 0000000000..7b753259e4 --- /dev/null +++ b/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 + *

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

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

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.dto.result; + +import lombok.Data; + +import java.io.Serializable; + +/** + * 组织信息 + * + * @author sun + */ +@Data +public class 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; +} \ No newline at end of file diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/feign/GovOrgOpenFeignClient.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/feign/GovOrgOpenFeignClient.java index 2856183dd3..3fa6739d94 100644 --- a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/feign/GovOrgOpenFeignClient.java +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/feign/GovOrgOpenFeignClient.java @@ -259,4 +259,13 @@ public interface GovOrgOpenFeignClient { */ @PostMapping("/gov/org/agency/subagencylist") Result subAgencyList(@RequestBody SubAgencyFormDTO formDTO); + + /** + * @param formDTO + * @return + * @Author sun + * @Description 根据组织Id获取组织信息 + */ + @PostMapping("/gov/org/customeragency/agencyinfo") + Result agencyInfo(@RequestBody AgencyInfoFormDTO formDTO); } diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/feign/fallback/GovOrgOpenFeignClientFallback.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/feign/fallback/GovOrgOpenFeignClientFallback.java index b132ebec6a..4e03cbdc2a 100644 --- a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/feign/fallback/GovOrgOpenFeignClientFallback.java +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/feign/fallback/GovOrgOpenFeignClientFallback.java @@ -151,4 +151,9 @@ public class GovOrgOpenFeignClientFallback implements GovOrgOpenFeignClient { public Result subAgencyList(SubAgencyFormDTO formDTO) { return ModuleUtils.feignConError(ServiceConstant.GOV_ORG_SERVER, "subAgencyList", formDTO); } + + @Override + public Result agencyInfo(AgencyInfoFormDTO formDTO) { + return ModuleUtils.feignConError(ServiceConstant.GOV_ORG_SERVER, "agencyInfo", formDTO); + } } diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/CustomerAgencyController.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/CustomerAgencyController.java index c8b2350e16..a052f79c8f 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/CustomerAgencyController.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/CustomerAgencyController.java @@ -242,4 +242,13 @@ public class CustomerAgencyController { public Result staffInAgencyList(@LoginUser TokenDto tokenDTO) { return new Result().ok(customerAgencyService.staffInAgencyList(tokenDTO.getUserId())); } + + /** + * @Description 对外接口-根据组织Id获取组织信息 + * @author sun + **/ + @PostMapping("agencyinfo") + Result agencyInfo(@RequestBody AgencyInfoFormDTO formDTO) { + return new Result().ok(customerAgencyService.agencyInfo(formDTO)); + } } \ No newline at end of file diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/CustomerAgencyService.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/CustomerAgencyService.java index b7a556c5b0..8430acdf88 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/CustomerAgencyService.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/CustomerAgencyService.java @@ -213,4 +213,10 @@ public interface CustomerAgencyService extends BaseService * @Description 工作端-查询当前人员所属组织及所有下级组织 **/ StaffInAgencyListResultDTO staffInAgencyList(String staffId); + + /** + * @Description 对外接口-根据组织Id获取组织信息 + * @author sun + **/ + AgencyInfoResultDTO agencyInfo(AgencyInfoFormDTO formDTO); } \ No newline at end of file diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerAgencyServiceImpl.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerAgencyServiceImpl.java index db160cba61..65206f51a2 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerAgencyServiceImpl.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerAgencyServiceImpl.java @@ -994,4 +994,20 @@ public class CustomerAgencyServiceImpl extends BaseServiceImpl Date: Tue, 3 Nov 2020 11:01:19 +0800 Subject: [PATCH 04/23] =?UTF-8?q?=E5=BE=BD=E7=AB=A0controller=EF=BC=8Cserv?= =?UTF-8?q?ice?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../modules/badege/controller/BadgeController.java | 13 +++++++++++++ .../epmet/modules/badege/service/BadgeService.java | 8 ++++++++ .../badege/service/impl/BadgeServiceImpl.java | 14 ++++++++++++++ 3 files changed, 35 insertions(+) create mode 100644 epmet-module/resi-mine/resi-mine-server/src/main/java/com/epmet/modules/badege/controller/BadgeController.java create mode 100644 epmet-module/resi-mine/resi-mine-server/src/main/java/com/epmet/modules/badege/service/BadgeService.java create mode 100644 epmet-module/resi-mine/resi-mine-server/src/main/java/com/epmet/modules/badege/service/impl/BadgeServiceImpl.java diff --git a/epmet-module/resi-mine/resi-mine-server/src/main/java/com/epmet/modules/badege/controller/BadgeController.java b/epmet-module/resi-mine/resi-mine-server/src/main/java/com/epmet/modules/badege/controller/BadgeController.java new file mode 100644 index 0000000000..9d98bfa74a --- /dev/null +++ b/epmet-module/resi-mine/resi-mine-server/src/main/java/com/epmet/modules/badege/controller/BadgeController.java @@ -0,0 +1,13 @@ +package com.epmet.modules.badege.controller; + +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +/** + * @Author zxc + * @DateTime 2020/11/3 10:42 上午 + */ +@RestController +@RequestMapping("badge") +public class BadgeController { +} diff --git a/epmet-module/resi-mine/resi-mine-server/src/main/java/com/epmet/modules/badege/service/BadgeService.java b/epmet-module/resi-mine/resi-mine-server/src/main/java/com/epmet/modules/badege/service/BadgeService.java new file mode 100644 index 0000000000..18c5f38926 --- /dev/null +++ b/epmet-module/resi-mine/resi-mine-server/src/main/java/com/epmet/modules/badege/service/BadgeService.java @@ -0,0 +1,8 @@ +package com.epmet.modules.badege.service; + +/** + * @Author zxc + * @DateTime 2020/11/3 10:52 上午 + */ +public interface BadgeService { +} diff --git a/epmet-module/resi-mine/resi-mine-server/src/main/java/com/epmet/modules/badege/service/impl/BadgeServiceImpl.java b/epmet-module/resi-mine/resi-mine-server/src/main/java/com/epmet/modules/badege/service/impl/BadgeServiceImpl.java new file mode 100644 index 0000000000..6a848eb868 --- /dev/null +++ b/epmet-module/resi-mine/resi-mine-server/src/main/java/com/epmet/modules/badege/service/impl/BadgeServiceImpl.java @@ -0,0 +1,14 @@ +package com.epmet.modules.badege.service.impl; + +import com.epmet.modules.badege.service.BadgeService; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Service; + +/** + * @Author zxc + * @DateTime 2020/11/3 10:53 上午 + */ +@Service +@Slf4j +public class BadgeServiceImpl implements BadgeService { +} From 854e23d32c8a38802b7648176a870aa802a23a1e Mon Sep 17 00:00:00 2001 From: zhaoqifeng Date: Tue, 3 Nov 2020 14:35:51 +0800 Subject: [PATCH 05/23] =?UTF-8?q?=E4=B8=AA=E4=BA=BA=E4=B8=AD=E5=BF=83-?= =?UTF-8?q?=E4=BF=A1=E6=81=AF=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mine/dto/result/InitInfoResultDTO.java | 39 +++++++++++++ .../controller/PersonalCenterController.java | 55 +++++++++++++++++++ .../mine/service/PersonalCenterService.java | 17 ++++++ .../impl/PersonalCenterServiceImpl.java | 51 +++++++++++++++++ .../com/epmet/dto/form/EditInfoFormDTO.java | 52 ++++++++++++++++++ .../epmet/feign/EpmetUserOpenFeignClient.java | 10 ++++ .../EpmetUserOpenFeignClientFallback.java | 5 ++ .../controller/UserResiInfoController.java | 18 ++++-- .../java/com/epmet/dao/UserResiInfoDao.java | 9 +++ .../epmet/service/UserResiInfoService.java | 14 +++-- .../service/impl/UserResiInfoServiceImpl.java | 18 ++++++ .../main/resources/mapper/UserResiInfoDao.xml | 10 ++++ 12 files changed, 290 insertions(+), 8 deletions(-) create mode 100644 epmet-module/resi-mine/resi-mine-client/src/main/java/com/epmet/resi/mine/dto/result/InitInfoResultDTO.java create mode 100644 epmet-module/resi-mine/resi-mine-server/src/main/java/com/epmet/modules/mine/controller/PersonalCenterController.java create mode 100644 epmet-module/resi-mine/resi-mine-server/src/main/java/com/epmet/modules/mine/service/PersonalCenterService.java create mode 100644 epmet-module/resi-mine/resi-mine-server/src/main/java/com/epmet/modules/mine/service/impl/PersonalCenterServiceImpl.java create mode 100644 epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/EditInfoFormDTO.java diff --git a/epmet-module/resi-mine/resi-mine-client/src/main/java/com/epmet/resi/mine/dto/result/InitInfoResultDTO.java b/epmet-module/resi-mine/resi-mine-client/src/main/java/com/epmet/resi/mine/dto/result/InitInfoResultDTO.java new file mode 100644 index 0000000000..f89028a9dd --- /dev/null +++ b/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; +} diff --git a/epmet-module/resi-mine/resi-mine-server/src/main/java/com/epmet/modules/mine/controller/PersonalCenterController.java b/epmet-module/resi-mine/resi-mine-server/src/main/java/com/epmet/modules/mine/controller/PersonalCenterController.java new file mode 100644 index 0000000000..61c538fbdc --- /dev/null +++ b/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 + */ + @PostMapping("initinfo") + public Result initInfo(@LoginUser TokenDto tokenDto) { + InitInfoResultDTO resultDTO = personalCenterService.initInfo(tokenDto); + return new Result().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(); + } +} diff --git a/epmet-module/resi-mine/resi-mine-server/src/main/java/com/epmet/modules/mine/service/PersonalCenterService.java b/epmet-module/resi-mine/resi-mine-server/src/main/java/com/epmet/modules/mine/service/PersonalCenterService.java new file mode 100644 index 0000000000..219edb8c86 --- /dev/null +++ b/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); +} diff --git a/epmet-module/resi-mine/resi-mine-server/src/main/java/com/epmet/modules/mine/service/impl/PersonalCenterServiceImpl.java b/epmet-module/resi-mine/resi-mine-server/src/main/java/com/epmet/modules/mine/service/impl/PersonalCenterServiceImpl.java new file mode 100644 index 0000000000..142d82d6dd --- /dev/null +++ b/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 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()); + } + } +} diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/EditInfoFormDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/EditInfoFormDTO.java new file mode 100644 index 0000000000..d6d9655b88 --- /dev/null +++ b/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; +} diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/feign/EpmetUserOpenFeignClient.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/feign/EpmetUserOpenFeignClient.java index 5f7c301ad0..2c7d2555cd 100644 --- a/epmet-user/epmet-user-client/src/main/java/com/epmet/feign/EpmetUserOpenFeignClient.java +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/feign/EpmetUserOpenFeignClient.java @@ -327,4 +327,14 @@ public interface EpmetUserOpenFeignClient { **/ @PostMapping(value = "epmetuser/staffagencyvisited/getstaffbasicinfo") Result getStaffBasicInfo(@RequestBody StaffBasicInfoFormDTO formDTO); + + /** + * 修改个人信息 + * @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); } diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/feign/fallback/EpmetUserOpenFeignClientFallback.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/feign/fallback/EpmetUserOpenFeignClientFallback.java index 64985eab15..a2de76e587 100644 --- a/epmet-user/epmet-user-client/src/main/java/com/epmet/feign/fallback/EpmetUserOpenFeignClientFallback.java +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/feign/fallback/EpmetUserOpenFeignClientFallback.java @@ -220,4 +220,9 @@ public class EpmetUserOpenFeignClientFallback implements EpmetUserOpenFeignClien public Result getStaffBasicInfo(StaffBasicInfoFormDTO formDTO) { return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "getStaffBasicInfo", formDTO); } + + @Override + public Result editUserInfo(EditInfoFormDTO formDTO) { + return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "editUserInfo", formDTO); + } } diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/UserResiInfoController.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/UserResiInfoController.java index 56a75d64cc..68aea3d580 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/UserResiInfoController.java +++ b/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().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(); + } + } diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/UserResiInfoDao.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/UserResiInfoDao.java index fee5c2730b..59d42dfc6e 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/UserResiInfoDao.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/UserResiInfoDao.java @@ -87,4 +87,13 @@ public interface UserResiInfoDao extends BaseDao { * @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); } diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/UserResiInfoService.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/UserResiInfoService.java index d01c706fd5..11fff3816b 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/UserResiInfoService.java +++ b/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 { * @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); } diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/UserResiInfoServiceImpl.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/UserResiInfoServiceImpl.java index e8148b7418..c86ed47eaf 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/UserResiInfoServiceImpl.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/UserResiInfoServiceImpl.java @@ -325,4 +325,22 @@ public class UserResiInfoServiceImpl extends BaseServiceImpl + + update user_resi_info set + SURNAME = #{surname}, + NAME = #{name}, + STREET = #{street}, + DISTRICT = #{district}, + BUILDING_ADDRESS = #{buildingAddress} + where USER_ID = #{userId} + and DEL_FLAG = '0' + + SELECT + ub.BADGE_ID, + ub.IS_OPENED + FROM + resi_user_badge ub + WHERE + ub.DEL_FLAG = 0 + AND ub.CERTIFICATION_AUTID_STATUS = 'pass' + AND ub.IS_OPENED = 1 + AND ub.CUSTOMER_ID = #{customerId} + AND ub.USER_ID = #{userId} + ORDER BY ub.UPDATED_TIME DESC + + + + + + + From c5dadab50bfeace1bdde0e85601256d064f1b08e Mon Sep 17 00:00:00 2001 From: zxc <1272811460@qq.com> Date: Tue, 3 Nov 2020 16:03:57 +0800 Subject: [PATCH 07/23] =?UTF-8?q?=E5=BE=BD=E7=AB=A0=E5=88=97=E8=A1=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../badege/service/impl/BadgeServiceImpl.java | 17 ++++++++++++++++- .../epmet/feign/EpmetUserOpenFeignClient.java | 10 ++++++++++ .../EpmetUserOpenFeignClientFallback.java | 5 +++++ 3 files changed, 31 insertions(+), 1 deletion(-) diff --git a/epmet-module/resi-mine/resi-mine-server/src/main/java/com/epmet/modules/badege/service/impl/BadgeServiceImpl.java b/epmet-module/resi-mine/resi-mine-server/src/main/java/com/epmet/modules/badege/service/impl/BadgeServiceImpl.java index 3d6c5f02d2..e78f745c40 100644 --- a/epmet-module/resi-mine/resi-mine-server/src/main/java/com/epmet/modules/badege/service/impl/BadgeServiceImpl.java +++ b/epmet-module/resi-mine/resi-mine-server/src/main/java/com/epmet/modules/badege/service/impl/BadgeServiceImpl.java @@ -1,5 +1,10 @@ package com.epmet.modules.badege.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.UserBadgeListFormDTO; +import com.epmet.dto.result.UserBadgeListResultDTO; import com.epmet.feign.EpmetUserOpenFeignClient; import com.epmet.modules.badege.service.BadgeService; import com.epmet.resi.mine.dto.from.BadgeListFormDTO; @@ -8,6 +13,7 @@ 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; /** @@ -23,6 +29,15 @@ public class BadgeServiceImpl implements BadgeService { @Override public List getBadgeList(BadgeListFormDTO badgeListFormDTO) { - return null; + UserBadgeListFormDTO form = ConvertUtils.sourceToTarget(badgeListFormDTO, UserBadgeListFormDTO.class); + Result> listResult = epmetUserOpenFeignClient.selectBadgeList(form); + if (!listResult.success()){ + throw new RenException("获取徽章点亮列表失败......"); + } + if (null == listResult.getData()){ + return new ArrayList<>(); + } + List result = ConvertUtils.sourceToTarget(listResult.getData(), BadgeListResultDTO.class); + return result; } } diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/feign/EpmetUserOpenFeignClient.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/feign/EpmetUserOpenFeignClient.java index 2c7d2555cd..e56d27287c 100644 --- a/epmet-user/epmet-user-client/src/main/java/com/epmet/feign/EpmetUserOpenFeignClient.java +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/feign/EpmetUserOpenFeignClient.java @@ -337,4 +337,14 @@ public interface EpmetUserOpenFeignClient { */ @PostMapping("/epmetuser/userresiinfo/edituserinfo") Result editUserInfo(@RequestBody EditInfoFormDTO formDTO); + + /** + * @Description 查询已经点亮的徽章 + * @Param userBadgeListFormDTO + * @author zxc + * @date 2020/11/3 1:33 下午 + */ + @PostMapping("/epmetuser/badge/badgelist") + Result> selectBadgeList(@RequestBody UserBadgeListFormDTO userBadgeListFormDTO); + } diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/feign/fallback/EpmetUserOpenFeignClientFallback.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/feign/fallback/EpmetUserOpenFeignClientFallback.java index a2de76e587..46fad76aa3 100644 --- a/epmet-user/epmet-user-client/src/main/java/com/epmet/feign/fallback/EpmetUserOpenFeignClientFallback.java +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/feign/fallback/EpmetUserOpenFeignClientFallback.java @@ -225,4 +225,9 @@ public class EpmetUserOpenFeignClientFallback implements EpmetUserOpenFeignClien public Result editUserInfo(EditInfoFormDTO formDTO) { return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "editUserInfo", formDTO); } + + @Override + public Result> selectBadgeList(UserBadgeListFormDTO userBadgeListFormDTO) { + return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "selectBadgeList", userBadgeListFormDTO); + } } From 9e88e922b770484e2f2a29fd571e40a99bedc30e Mon Sep 17 00:00:00 2001 From: sunyuchao Date: Tue, 3 Nov 2020 17:55:56 +0800 Subject: [PATCH 08/23] =?UTF-8?q?=E5=AF=B9=E5=A4=96=E6=8E=A5=E5=8F=A3-?= =?UTF-8?q?=E6=96=87=E4=BB=B6=E4=B8=8A=E4=BC=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../epmet-oss/epmet-oss-server/pom.xml | 4 ++ .../cloud/AbstractCloudStorageService.java | 7 +++ .../cloud/AliyunCloudStorageService.java | 54 +++++++++++++++++++ .../cloud/FastDFSCloudStorageService.java | 6 +++ .../epmet/cloud/LocalCloudStorageService.java | 5 ++ .../cloud/QcloudCloudStorageService.java | 5 ++ .../epmet/cloud/QiniuCloudStorageService.java | 5 ++ .../com/epmet/controller/OssController.java | 19 +++++++ .../java/com/epmet/service/OssService.java | 2 + .../epmet/service/impl/OssServiceImpl.java | 32 +++++++++++ 10 files changed, 139 insertions(+) diff --git a/epmet-module/epmet-oss/epmet-oss-server/pom.xml b/epmet-module/epmet-oss/epmet-oss-server/pom.xml index b73264233b..ffb777fe7c 100644 --- a/epmet-module/epmet-oss/epmet-oss-server/pom.xml +++ b/epmet-module/epmet-oss/epmet-oss-server/pom.xml @@ -92,6 +92,10 @@ fastdfs-client ${fastdfs.version} + + org.springframework + spring-test + diff --git a/epmet-module/epmet-oss/epmet-oss-server/src/main/java/com/epmet/cloud/AbstractCloudStorageService.java b/epmet-module/epmet-oss/epmet-oss-server/src/main/java/com/epmet/cloud/AbstractCloudStorageService.java index 8eb6fb6eba..fd4002d57b 100644 --- a/epmet-module/epmet-oss/epmet-oss-server/src/main/java/com/epmet/cloud/AbstractCloudStorageService.java +++ b/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; + } diff --git a/epmet-module/epmet-oss/epmet-oss-server/src/main/java/com/epmet/cloud/AliyunCloudStorageService.java b/epmet-module/epmet-oss/epmet-oss-server/src/main/java/com/epmet/cloud/AliyunCloudStorageService.java index e3c3850bff..e55449ad0f 100644 --- a/epmet-module/epmet-oss/epmet-oss-server/src/main/java/com/epmet/cloud/AliyunCloudStorageService.java +++ b/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(); + } + + } + } diff --git a/epmet-module/epmet-oss/epmet-oss-server/src/main/java/com/epmet/cloud/FastDFSCloudStorageService.java b/epmet-module/epmet-oss/epmet-oss-server/src/main/java/com/epmet/cloud/FastDFSCloudStorageService.java index eef3d53171..9661e5f054 100644 --- a/epmet-module/epmet-oss/epmet-oss-server/src/main/java/com/epmet/cloud/FastDFSCloudStorageService.java +++ b/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 { + + } } diff --git a/epmet-module/epmet-oss/epmet-oss-server/src/main/java/com/epmet/cloud/LocalCloudStorageService.java b/epmet-module/epmet-oss/epmet-oss-server/src/main/java/com/epmet/cloud/LocalCloudStorageService.java index 211736c173..71c17580c5 100644 --- a/epmet-module/epmet-oss/epmet-oss-server/src/main/java/com/epmet/cloud/LocalCloudStorageService.java +++ b/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 { + + } } diff --git a/epmet-module/epmet-oss/epmet-oss-server/src/main/java/com/epmet/cloud/QcloudCloudStorageService.java b/epmet-module/epmet-oss/epmet-oss-server/src/main/java/com/epmet/cloud/QcloudCloudStorageService.java index 03376f75eb..22d7da2219 100644 --- a/epmet-module/epmet-oss/epmet-oss-server/src/main/java/com/epmet/cloud/QcloudCloudStorageService.java +++ b/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 { + + } } diff --git a/epmet-module/epmet-oss/epmet-oss-server/src/main/java/com/epmet/cloud/QiniuCloudStorageService.java b/epmet-module/epmet-oss/epmet-oss-server/src/main/java/com/epmet/cloud/QiniuCloudStorageService.java index 3c51425619..0fa9ee9f7e 100644 --- a/epmet-module/epmet-oss/epmet-oss-server/src/main/java/com/epmet/cloud/QiniuCloudStorageService.java +++ b/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 { + + } } diff --git a/epmet-module/epmet-oss/epmet-oss-server/src/main/java/com/epmet/controller/OssController.java b/epmet-module/epmet-oss/epmet-oss-server/src/main/java/com/epmet/controller/OssController.java index 5b3e3bee6b..65cf6b2d2d 100644 --- a/epmet-module/epmet-oss/epmet-oss-server/src/main/java/com/epmet/controller/OssController.java +++ b/epmet-module/epmet-oss/epmet-oss-server/src/main/java/com/epmet/controller/OssController.java @@ -31,12 +31,17 @@ 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 java.io.ByteArrayInputStream; +import java.io.IOException; +import java.io.InputStream; import java.util.Arrays; import java.util.Map; @@ -218,4 +223,18 @@ public class OssController { return ossService.uploadImg(file); } + /** + * @param byteFile fileName + * @Description 外挂-文件上传 + * @Author sun + **/ + @PostMapping("ext/upload") + public Result extUpload(@RequestParam("byteFile") byte[] byteFile, @RequestParam("fileName") String fileName) throws IOException { + //public Result 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); + } + } diff --git a/epmet-module/epmet-oss/epmet-oss-server/src/main/java/com/epmet/service/OssService.java b/epmet-module/epmet-oss/epmet-oss-server/src/main/java/com/epmet/service/OssService.java index 2195e4f0f1..c67fec06f2 100644 --- a/epmet-module/epmet-oss/epmet-oss-server/src/main/java/com/epmet/service/OssService.java +++ b/epmet-module/epmet-oss/epmet-oss-server/src/main/java/com/epmet/service/OssService.java @@ -29,4 +29,6 @@ public interface OssService extends BaseService { int insertOssEntity(OssEntity ossEntity); Result uploadImg(MultipartFile file); + + Result extUpload(MultipartFile file, String fileName); } diff --git a/epmet-module/epmet-oss/epmet-oss-server/src/main/java/com/epmet/service/impl/OssServiceImpl.java b/epmet-module/epmet-oss/epmet-oss-server/src/main/java/com/epmet/service/impl/OssServiceImpl.java index 6ca5626490..cc44456c7e 100644 --- a/epmet-module/epmet-oss/epmet-oss-server/src/main/java/com/epmet/service/impl/OssServiceImpl.java +++ b/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 implement dto.setUrl(url); return new Result().ok(dto); } + + @Override + public Result extUpload(MultipartFile file, String fileName) { + try { + OssFactory.build().down(); + } catch (IOException e) { + e.printStackTrace(); + } + + if (file.isEmpty()) { + return new Result().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().ok(dto); + } } From 54219febb49dcc0b219f68a4b51be7769e772323 Mon Sep 17 00:00:00 2001 From: zxc <1272811460@qq.com> Date: Wed, 4 Nov 2020 11:02:10 +0800 Subject: [PATCH 09/23] =?UTF-8?q?=E5=BE=BD=E7=AB=A0=E5=88=97=E8=A1=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../resi/mine/dto/from/BadgeListFormDTO.java | 1 - .../resi/mine/dto/from/OperListFormDTO.java | 21 +++++++ .../mine/dto/result/BadgeListResultDTO.java | 2 + .../mine/dto/result/OperListResultDTO.java | 46 ++++++++++++++ .../badege/controller/BadgeController.java | 26 +++++++- .../modules/badege/service/BadgeService.java | 19 +++++- .../badege/service/impl/BadgeServiceImpl.java | 39 +++++++++++- .../com/epmet/constant/BadgeConstant.java | 8 +++ .../epmet/dto/form/UserBadgeListFormDTO.java | 11 +++- .../epmet/dto/form/UserOperListFormDTO.java | 28 +++++++++ .../dto/result/UserBadgeListResultDTO.java | 3 + .../dto/result/UserOperListResultDTO.java | 62 +++++++++++++++++++ .../epmet/feign/EpmetUserOpenFeignClient.java | 8 +++ .../EpmetUserOpenFeignClientFallback.java | 5 ++ .../epmet/controller/UserBadgeController.java | 13 ++++ .../main/java/com/epmet/dao/UserBadgeDao.java | 18 ++++++ .../java/com/epmet/redis/UserBadgeRedis.java | 7 +-- .../com/epmet/service/UserBadgeService.java | 10 +++ .../service/impl/UserBadgeServiceImpl.java | 59 ++++++++++++++++-- .../main/resources/mapper/UserBadgeDao.xml | 41 +++++++++--- 20 files changed, 400 insertions(+), 27 deletions(-) create mode 100644 epmet-module/resi-mine/resi-mine-client/src/main/java/com/epmet/resi/mine/dto/from/OperListFormDTO.java create mode 100644 epmet-module/resi-mine/resi-mine-client/src/main/java/com/epmet/resi/mine/dto/result/OperListResultDTO.java create mode 100644 epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/UserOperListFormDTO.java create mode 100644 epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/UserOperListResultDTO.java diff --git a/epmet-module/resi-mine/resi-mine-client/src/main/java/com/epmet/resi/mine/dto/from/BadgeListFormDTO.java b/epmet-module/resi-mine/resi-mine-client/src/main/java/com/epmet/resi/mine/dto/from/BadgeListFormDTO.java index ef8ef67308..c5ace2985f 100644 --- a/epmet-module/resi-mine/resi-mine-client/src/main/java/com/epmet/resi/mine/dto/from/BadgeListFormDTO.java +++ b/epmet-module/resi-mine/resi-mine-client/src/main/java/com/epmet/resi/mine/dto/from/BadgeListFormDTO.java @@ -19,7 +19,6 @@ public class BadgeListFormDTO implements Serializable { /** * 用户ID */ - @NotBlank(message = "用户ID不能为空",groups = {BadgeList.class}) private String userId; /** diff --git a/epmet-module/resi-mine/resi-mine-client/src/main/java/com/epmet/resi/mine/dto/from/OperListFormDTO.java b/epmet-module/resi-mine/resi-mine-client/src/main/java/com/epmet/resi/mine/dto/from/OperListFormDTO.java new file mode 100644 index 0000000000..a0f7b7f919 --- /dev/null +++ b/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; +} diff --git a/epmet-module/resi-mine/resi-mine-client/src/main/java/com/epmet/resi/mine/dto/result/BadgeListResultDTO.java b/epmet-module/resi-mine/resi-mine-client/src/main/java/com/epmet/resi/mine/dto/result/BadgeListResultDTO.java index 41f82feed4..d32230501e 100644 --- a/epmet-module/resi-mine/resi-mine-client/src/main/java/com/epmet/resi/mine/dto/result/BadgeListResultDTO.java +++ b/epmet-module/resi-mine/resi-mine-client/src/main/java/com/epmet/resi/mine/dto/result/BadgeListResultDTO.java @@ -27,4 +27,6 @@ public class BadgeListResultDTO implements Serializable { * 徽章是否点亮 */ private String isOpened; + + private String badgeType; } diff --git a/epmet-module/resi-mine/resi-mine-client/src/main/java/com/epmet/resi/mine/dto/result/OperListResultDTO.java b/epmet-module/resi-mine/resi-mine-client/src/main/java/com/epmet/resi/mine/dto/result/OperListResultDTO.java new file mode 100644 index 0000000000..044d118a0f --- /dev/null +++ b/epmet-module/resi-mine/resi-mine-client/src/main/java/com/epmet/resi/mine/dto/result/OperListResultDTO.java @@ -0,0 +1,46 @@ +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; + +} diff --git a/epmet-module/resi-mine/resi-mine-server/src/main/java/com/epmet/modules/badege/controller/BadgeController.java b/epmet-module/resi-mine/resi-mine-server/src/main/java/com/epmet/modules/badege/controller/BadgeController.java index 059f37972f..fe519e7cbb 100644 --- a/epmet-module/resi-mine/resi-mine-server/src/main/java/com/epmet/modules/badege/controller/BadgeController.java +++ b/epmet-module/resi-mine/resi-mine-server/src/main/java/com/epmet/modules/badege/controller/BadgeController.java @@ -1,10 +1,14 @@ 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.modules.badege.service.BadgeService; import com.epmet.resi.mine.dto.from.BadgeListFormDTO; +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; @@ -24,10 +28,28 @@ public class BadgeController { @Autowired private BadgeService badgeService; + /** + * @Description 个人中心-获取个人徽章点亮列表 + * @Param badgeListFormDTO + * @author zxc + * @date 2020/11/3 4:11 下午 + */ @PostMapping("list") - public Result> getBadgeList(@RequestBody BadgeListFormDTO badgeListFormDTO){ + public Result> getBadgeList(@LoginUser TokenDto tokenDto,@RequestBody BadgeListFormDTO badgeListFormDTO){ ValidatorUtils.validateEntity(badgeListFormDTO, BadgeListFormDTO.BadgeList.class); - return new Result>().ok(badgeService.getBadgeList(badgeListFormDTO)); + return new Result>().ok(badgeService.getBadgeList(tokenDto,badgeListFormDTO)); + } + + /** + * @Description 个人中心-获取徽章可操作列表(点亮,取消,认证) + * @Param operListFormDTO + * @author zxc + * @date 2020/11/3 4:28 下午 + */ + @PostMapping("operlist") + public Result> getOperList(@LoginUser TokenDto tokenDto,@RequestBody OperListFormDTO operListFormDTO){ + ValidatorUtils.validateEntity(operListFormDTO, OperListFormDTO.OperList.class); + return new Result>().ok(badgeService.getOperList(tokenDto,operListFormDTO)); } } diff --git a/epmet-module/resi-mine/resi-mine-server/src/main/java/com/epmet/modules/badege/service/BadgeService.java b/epmet-module/resi-mine/resi-mine-server/src/main/java/com/epmet/modules/badege/service/BadgeService.java index 1aa44135c9..fe1d1c140e 100644 --- a/epmet-module/resi-mine/resi-mine-server/src/main/java/com/epmet/modules/badege/service/BadgeService.java +++ b/epmet-module/resi-mine/resi-mine-server/src/main/java/com/epmet/modules/badege/service/BadgeService.java @@ -1,7 +1,10 @@ package com.epmet.modules.badege.service; +import com.epmet.commons.tools.security.dto.TokenDto; import com.epmet.resi.mine.dto.from.BadgeListFormDTO; +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; @@ -11,6 +14,20 @@ import java.util.List; */ public interface BadgeService { - List getBadgeList(BadgeListFormDTO badgeListFormDTO); + /** + * @Description 个人中心-获取个人徽章点亮列表 + * @Param badgeListFormDTO + * @author zxc + * @date 2020/11/3 4:11 下午 + */ + List getBadgeList(TokenDto tokenDto,BadgeListFormDTO badgeListFormDTO); + + /** + * @Description 个人中心-获取徽章可操作列表(点亮,取消,认证) + * @Param operListFormDTO + * @author zxc + * @date 2020/11/3 4:28 下午 + */ + List getOperList(TokenDto tokenDto,OperListFormDTO operListFormDTO); } diff --git a/epmet-module/resi-mine/resi-mine-server/src/main/java/com/epmet/modules/badege/service/impl/BadgeServiceImpl.java b/epmet-module/resi-mine/resi-mine-server/src/main/java/com/epmet/modules/badege/service/impl/BadgeServiceImpl.java index e78f745c40..6e1d3ae1e9 100644 --- a/epmet-module/resi-mine/resi-mine-server/src/main/java/com/epmet/modules/badege/service/impl/BadgeServiceImpl.java +++ b/epmet-module/resi-mine/resi-mine-server/src/main/java/com/epmet/modules/badege/service/impl/BadgeServiceImpl.java @@ -1,14 +1,19 @@ 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.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.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; @@ -27,9 +32,17 @@ public class BadgeServiceImpl implements BadgeService { @Autowired private EpmetUserOpenFeignClient epmetUserOpenFeignClient; + /** + * @Description 个人中心-获取个人徽章点亮列表 + * @Param badgeListFormDTO + * @author zxc + * @date 2020/11/3 4:11 下午 + */ @Override - public List getBadgeList(BadgeListFormDTO badgeListFormDTO) { - UserBadgeListFormDTO form = ConvertUtils.sourceToTarget(badgeListFormDTO, UserBadgeListFormDTO.class); + public List getBadgeList(TokenDto tokenDto,BadgeListFormDTO badgeListFormDTO) { + UserBadgeListFormDTO form = new UserBadgeListFormDTO(); + form.setCustomerId(badgeListFormDTO.getCustomerId()); + form.setUserId(tokenDto.getUserId()); Result> listResult = epmetUserOpenFeignClient.selectBadgeList(form); if (!listResult.success()){ throw new RenException("获取徽章点亮列表失败......"); @@ -40,4 +53,26 @@ public class BadgeServiceImpl implements BadgeService { List result = ConvertUtils.sourceToTarget(listResult.getData(), BadgeListResultDTO.class); return result; } + + /** + * @Description 个人中心-获取徽章可操作列表(点亮,取消,认证) + * @Param operListFormDTO + * @author zxc + * @date 2020/11/3 4:28 下午 + */ + @Override + public List getOperList(TokenDto tokenDto,OperListFormDTO operListFormDTO) { + UserOperListFormDTO userOperListFormDTO = new UserOperListFormDTO(); + userOperListFormDTO.setCustomerId(operListFormDTO.getCustomerId()); + userOperListFormDTO.setUserId(tokenDto.getUserId()); + Result> listResult = epmetUserOpenFeignClient.selectOperList(userOperListFormDTO); + if (!listResult.success()){ + throw new RenException("获取徽章列表失败......"); + } + if (null == listResult.getData()){ + return new ArrayList<>(); + } + List result = ConvertUtils.sourceToTarget(listResult.getData(), OperListResultDTO.class); + return result; + } } diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/constant/BadgeConstant.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/constant/BadgeConstant.java index e95fc2a5c0..7c2a6313c2 100644 --- a/epmet-user/epmet-user-client/src/main/java/com/epmet/constant/BadgeConstant.java +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/constant/BadgeConstant.java @@ -12,4 +12,12 @@ public interface BadgeConstant { String DEFAULT_CUSTOMER = "default"; + String YES = "yes"; + + String NO = "no"; + + String REJECTED = "rejected"; + + String APPROVED = "approved"; + } diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/UserBadgeListFormDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/UserBadgeListFormDTO.java index c77cee2d1f..2cb7f728dc 100644 --- a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/UserBadgeListFormDTO.java +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/UserBadgeListFormDTO.java @@ -2,7 +2,6 @@ package com.epmet.dto.form; import lombok.Data; -import javax.validation.constraints.NotBlank; import java.io.Serializable; /** @@ -12,7 +11,7 @@ import java.io.Serializable; @Data public class UserBadgeListFormDTO implements Serializable { - private static final long serialVersionUID = 9082922684993474574L; + private static final long serialVersionUID = 9002922684993474574L; /** * 用户ID @@ -23,4 +22,12 @@ public class UserBadgeListFormDTO implements Serializable { * 客户ID */ private String customerId; + + public UserBadgeListFormDTO(String userId, String customerId) { + this.userId = userId; + this.customerId = customerId; + } + + public UserBadgeListFormDTO() { + } } diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/UserOperListFormDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/UserOperListFormDTO.java new file mode 100644 index 0000000000..84578f7abb --- /dev/null +++ b/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() { + } +} diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/UserBadgeListResultDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/UserBadgeListResultDTO.java index a9db8612a2..19fce3bb3c 100644 --- a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/UserBadgeListResultDTO.java +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/UserBadgeListResultDTO.java @@ -28,6 +28,9 @@ public class UserBadgeListResultDTO implements Serializable { * 徽章是否点亮 */ private String isOpened; + + private String badgeType; + @JsonIgnore private String customerId; @JsonIgnore diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/UserOperListResultDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/UserOperListResultDTO.java new file mode 100644 index 0000000000..4e587fa5cd --- /dev/null +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/UserOperListResultDTO.java @@ -0,0 +1,62 @@ +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; + + @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; + } +} diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/feign/EpmetUserOpenFeignClient.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/feign/EpmetUserOpenFeignClient.java index e56d27287c..8ab0fd12b2 100644 --- a/epmet-user/epmet-user-client/src/main/java/com/epmet/feign/EpmetUserOpenFeignClient.java +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/feign/EpmetUserOpenFeignClient.java @@ -347,4 +347,12 @@ public interface EpmetUserOpenFeignClient { @PostMapping("/epmetuser/badge/badgelist") Result> selectBadgeList(@RequestBody UserBadgeListFormDTO userBadgeListFormDTO); + /** + * @Description 个人中心-获取徽章可操作列表(点亮,取消,认证) + * @Param operListFormDTO + * @author zxc + * @date 2020/11/3 4:28 下午 + */ + @PostMapping("/epmetuser/badge/badgeoperlist") + Result> selectOperList(@RequestBody UserOperListFormDTO userOperListFormDTO); } diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/feign/fallback/EpmetUserOpenFeignClientFallback.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/feign/fallback/EpmetUserOpenFeignClientFallback.java index 46fad76aa3..aa5db5968a 100644 --- a/epmet-user/epmet-user-client/src/main/java/com/epmet/feign/fallback/EpmetUserOpenFeignClientFallback.java +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/feign/fallback/EpmetUserOpenFeignClientFallback.java @@ -230,4 +230,9 @@ public class EpmetUserOpenFeignClientFallback implements EpmetUserOpenFeignClien public Result> selectBadgeList(UserBadgeListFormDTO userBadgeListFormDTO) { return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "selectBadgeList", userBadgeListFormDTO); } + + @Override + public Result> selectOperList(UserOperListFormDTO userOperListFormDTO) { + return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "selectOperList", userOperListFormDTO); + } } diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/UserBadgeController.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/UserBadgeController.java index a11fc74409..5b8f9d46e6 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/UserBadgeController.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/UserBadgeController.java @@ -2,7 +2,9 @@ package com.epmet.controller; import com.epmet.commons.tools.utils.Result; 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.service.UserBadgeService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.PostMapping; @@ -34,4 +36,15 @@ public class UserBadgeController { return new Result>().ok(userBadgeService.selectBadgeList(userBadgeListFormDTO)); } + /** + * @Description 个人中心-获取徽章可操作列表(点亮,取消,认证) + * @Param userOperListFormDTO + * @author zxc + * @date 2020/11/3 4:42 下午 + */ + @PostMapping("badgeoperlist") + public Result> selectOperList(@RequestBody UserOperListFormDTO userOperListFormDTO){ + return new Result>().ok(userBadgeService.selectOperList(userOperListFormDTO)); + } + } diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/UserBadgeDao.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/UserBadgeDao.java index d836a2e510..65eec9d1ac 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/UserBadgeDao.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/UserBadgeDao.java @@ -2,7 +2,9 @@ package com.epmet.dao; import com.epmet.dto.form.UserBadgeListFormDTO; 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; @@ -29,4 +31,20 @@ public interface UserBadgeDao { */ List selectAllBadge(UserBadgeListFormDTO userBadgeListFormDTO); + /** + * @Description 查询徽章认证记录 + * @Param userId + * @author zxc + * @date 2020/11/3 5:25 下午 + */ + List selectAuthRecord(@Param("userId")String userId); + + /** + * @Description 根据UserId查询个人徽章点亮信息 + * @Param userId + * @author zxc + * @date 2020/11/4 9:32 上午 + */ + List selectBadgeByUserId(@Param("userId")String userId); + } diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/redis/UserBadgeRedis.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/redis/UserBadgeRedis.java index 56492844b1..727c467e12 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/redis/UserBadgeRedis.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/redis/UserBadgeRedis.java @@ -28,12 +28,9 @@ public class UserBadgeRedis { * @author zxc * @date 2020/11/3 2:50 下午 */ - public List getUserBadge(String customerId){ + public Object getUserBadge(String customerId){ Object userBadge = redisUtils.hGet(BadgeConstant.BADGE_KEY + customerId, BadgeConstant.BADGE); - if (null == userBadge){ - return new ArrayList<>(); - } - return JSON.parseArray(userBadge.toString(), UserBadgeListResultDTO.class); + return userBadge; } /** diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/UserBadgeService.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/UserBadgeService.java index 367f16993b..fe5737a2d3 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/UserBadgeService.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/UserBadgeService.java @@ -1,7 +1,9 @@ package com.epmet.service; 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 java.util.List; @@ -19,4 +21,12 @@ public interface UserBadgeService { */ List selectBadgeList(UserBadgeListFormDTO userBadgeListFormDTO); + /** + * @Description 个人中心-获取徽章可操作列表(点亮,取消,认证) + * @Param userOperListFormDTO + * @author zxc + * @date 2020/11/3 4:42 下午 + */ + List selectOperList(UserOperListFormDTO userOperListFormDTO); + } diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/UserBadgeServiceImpl.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/UserBadgeServiceImpl.java index 7ee534b2f6..261f7e7bdc 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/UserBadgeServiceImpl.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/UserBadgeServiceImpl.java @@ -1,9 +1,14 @@ package com.epmet.service.impl; +import com.alibaba.fastjson.JSON; +import com.epmet.commons.tools.constant.NumConstant; +import com.epmet.commons.tools.utils.ConvertUtils; import com.epmet.constant.BadgeConstant; import com.epmet.dao.UserBadgeDao; 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.redis.UserBadgeRedis; import com.epmet.service.UserBadgeService; import lombok.extern.slf4j.Slf4j; @@ -38,8 +43,8 @@ public class UserBadgeServiceImpl implements UserBadgeService { */ @Override public List selectBadgeList(UserBadgeListFormDTO userBadgeListFormDTO) { - List userBadge = userBadgeRedis.getUserBadge(userBadgeListFormDTO.getCustomerId()); - if (CollectionUtils.isEmpty(userBadge)){ + Object userBadge = userBadgeRedis.getUserBadge(userBadgeListFormDTO.getCustomerId()); + if (null == userBadge){ List resultUserBadge = new ArrayList<>(); List userBadgeListResultDTOS = userBadgeDao.selectAllBadge(userBadgeListFormDTO); if (!CollectionUtils.isEmpty(userBadgeListResultDTOS)){ @@ -54,14 +59,15 @@ public class UserBadgeServiceImpl implements UserBadgeService { }); }); userBadgeRedis.setUserBadge(resultUserBadge,userBadgeListFormDTO.getCustomerId()); + userBadge = userBadgeRedis.getUserBadge(userBadgeListFormDTO.getCustomerId()); } } - userBadge = userBadgeRedis.getUserBadge(userBadgeListFormDTO.getCustomerId()); + List redisUserBadgeList = JSON.parseArray(userBadge.toString(), UserBadgeListResultDTO.class); List userBadgeListResultDTOS = userBadgeDao.selectBadgeList(userBadgeListFormDTO); if (CollectionUtils.isEmpty(userBadgeListResultDTOS)){ - return userBadge; + return redisUserBadgeList; } - userBadge.forEach(u -> { + redisUserBadgeList.forEach(u -> { userBadgeListResultDTOS.forEach(badge -> { if (u.getBadgeId().equals(badge.getBadgeId())){ badge.setBadgeIcon(u.getBadgeIcon()); @@ -69,11 +75,52 @@ public class UserBadgeServiceImpl implements UserBadgeService { } }); }); - userBadge.forEach(u -> { + 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 selectOperList(UserOperListFormDTO userOperListFormDTO) { + List userAuthBadgeList = userBadgeDao.selectAuthRecord(userOperListFormDTO.getUserId()); + Object userBadge = userBadgeRedis.getUserBadge(userOperListFormDTO.getCustomerId()); + List 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 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; + } } diff --git a/epmet-user/epmet-user-server/src/main/resources/mapper/UserBadgeDao.xml b/epmet-user/epmet-user-server/src/main/resources/mapper/UserBadgeDao.xml index b709353ce5..b9bcbad998 100644 --- a/epmet-user/epmet-user-server/src/main/resources/mapper/UserBadgeDao.xml +++ b/epmet-user/epmet-user-server/src/main/resources/mapper/UserBadgeDao.xml @@ -7,14 +7,14 @@ @@ -26,12 +26,37 @@ CUSTOMER_ID, BADGE_NAME, BADGE_ICON, - FIXATION_BADGE_TYPE + FIXATION_BADGE_TYPE AS badgeType FROM badge WHERE DEL_FLAG = '0' AND (CUSTOMER_ID = 'default' OR CUSTOMER_ID = 'zxc') + + + + + + From 1c8eca02dd3f6e46526beb03abfaa827077f16b0 Mon Sep 17 00:00:00 2001 From: zxc <1272811460@qq.com> Date: Wed, 4 Nov 2020 15:38:45 +0800 Subject: [PATCH 10/23] =?UTF-8?q?=E6=8F=90=E4=BA=A4=E5=BE=BD=E7=AB=A0?= =?UTF-8?q?=E8=AE=A4=E8=AF=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../badege/controller/BadgeController.java | 16 ++++ .../modules/badege/service/BadgeService.java | 10 +++ .../badege/service/impl/BadgeServiceImpl.java | 17 ++++ .../dto/UserBadgeCertificateRecordDTO.java | 44 +++++++++++ .../epmet/dto/form/BadgeSendCodeFormDTO.java | 22 ++++++ .../dto/form/CertificationAddFormDTO.java | 67 ++++++++++++++++ .../epmet/feign/EpmetUserOpenFeignClient.java | 3 + .../EpmetUserOpenFeignClientFallback.java | 5 ++ .../epmet/controller/UserBadgeController.java | 28 +++++++ .../main/java/com/epmet/dao/UserBadgeDao.java | 18 +++++ .../java/com/epmet/redis/UserBadgeRedis.java | 15 ++++ .../com/epmet/service/UserBadgeService.java | 20 +++++ .../service/impl/UserBadgeServiceImpl.java | 79 ++++++++++++++++++- .../main/resources/mapper/UserBadgeDao.xml | 59 ++++++++++++++ 14 files changed, 401 insertions(+), 2 deletions(-) create mode 100644 epmet-user/epmet-user-client/src/main/java/com/epmet/dto/UserBadgeCertificateRecordDTO.java create mode 100644 epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/BadgeSendCodeFormDTO.java create mode 100644 epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/CertificationAddFormDTO.java diff --git a/epmet-module/resi-mine/resi-mine-server/src/main/java/com/epmet/modules/badege/controller/BadgeController.java b/epmet-module/resi-mine/resi-mine-server/src/main/java/com/epmet/modules/badege/controller/BadgeController.java index fe519e7cbb..8d70e5d097 100644 --- a/epmet-module/resi-mine/resi-mine-server/src/main/java/com/epmet/modules/badege/controller/BadgeController.java +++ b/epmet-module/resi-mine/resi-mine-server/src/main/java/com/epmet/modules/badege/controller/BadgeController.java @@ -6,6 +6,7 @@ import com.epmet.commons.tools.utils.Result; import com.epmet.commons.tools.validator.ValidatorUtils; 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; @@ -52,4 +53,19 @@ public class BadgeController { return new Result>().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(); + } + + } diff --git a/epmet-module/resi-mine/resi-mine-server/src/main/java/com/epmet/modules/badege/service/BadgeService.java b/epmet-module/resi-mine/resi-mine-server/src/main/java/com/epmet/modules/badege/service/BadgeService.java index fe1d1c140e..6d020bc286 100644 --- a/epmet-module/resi-mine/resi-mine-server/src/main/java/com/epmet/modules/badege/service/BadgeService.java +++ b/epmet-module/resi-mine/resi-mine-server/src/main/java/com/epmet/modules/badege/service/BadgeService.java @@ -2,6 +2,7 @@ package com.epmet.modules.badege.service; import com.epmet.commons.tools.security.dto.TokenDto; 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; @@ -30,4 +31,13 @@ public interface BadgeService { */ List getOperList(TokenDto tokenDto,OperListFormDTO operListFormDTO); + /** + * @Description 个人中心-提交徽章认证 + * @Param tokenDto + * @Param certificationAddFormDTO + * @author zxc + * @date 2020/11/4 11:16 上午 + */ + void certificationAdd(TokenDto tokenDto, CertificationAddFormDTO certificationAddFormDTO); + } diff --git a/epmet-module/resi-mine/resi-mine-server/src/main/java/com/epmet/modules/badege/service/impl/BadgeServiceImpl.java b/epmet-module/resi-mine/resi-mine-server/src/main/java/com/epmet/modules/badege/service/impl/BadgeServiceImpl.java index 6e1d3ae1e9..259ffc23ae 100644 --- a/epmet-module/resi-mine/resi-mine-server/src/main/java/com/epmet/modules/badege/service/impl/BadgeServiceImpl.java +++ b/epmet-module/resi-mine/resi-mine-server/src/main/java/com/epmet/modules/badege/service/impl/BadgeServiceImpl.java @@ -11,6 +11,7 @@ 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; @@ -75,4 +76,20 @@ public class BadgeServiceImpl implements BadgeService { List 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("提交徽章认证失败......"); + } + } } diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/UserBadgeCertificateRecordDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/UserBadgeCertificateRecordDTO.java new file mode 100644 index 0000000000..a398d6f2cc --- /dev/null +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/UserBadgeCertificateRecordDTO.java @@ -0,0 +1,44 @@ +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 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"; + } +} diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/BadgeSendCodeFormDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/BadgeSendCodeFormDTO.java new file mode 100644 index 0000000000..14cb3c3333 --- /dev/null +++ b/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; + +} diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/CertificationAddFormDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/CertificationAddFormDTO.java new file mode 100644 index 0000000000..76583e9559 --- /dev/null +++ b/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; + +} diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/feign/EpmetUserOpenFeignClient.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/feign/EpmetUserOpenFeignClient.java index 8ab0fd12b2..f356eb8b1a 100644 --- a/epmet-user/epmet-user-client/src/main/java/com/epmet/feign/EpmetUserOpenFeignClient.java +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/feign/EpmetUserOpenFeignClient.java @@ -355,4 +355,7 @@ public interface EpmetUserOpenFeignClient { */ @PostMapping("/epmetuser/badge/badgeoperlist") Result> selectOperList(@RequestBody UserOperListFormDTO userOperListFormDTO); + + @PostMapping("/epmetuser/badge/authbadgerecord") + Result authBadgeRecord(@RequestBody CertificationAddFormDTO certificationAddFormDTO); } diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/feign/fallback/EpmetUserOpenFeignClientFallback.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/feign/fallback/EpmetUserOpenFeignClientFallback.java index aa5db5968a..789acb75f4 100644 --- a/epmet-user/epmet-user-client/src/main/java/com/epmet/feign/fallback/EpmetUserOpenFeignClientFallback.java +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/feign/fallback/EpmetUserOpenFeignClientFallback.java @@ -235,4 +235,9 @@ public class EpmetUserOpenFeignClientFallback implements EpmetUserOpenFeignClien public Result> 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); + } } diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/UserBadgeController.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/UserBadgeController.java index 5b8f9d46e6..f29179b551 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/UserBadgeController.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/UserBadgeController.java @@ -1,6 +1,9 @@ package com.epmet.controller; import com.epmet.commons.tools.utils.Result; +import com.epmet.commons.tools.validator.ValidatorUtils; +import com.epmet.dto.form.BadgeSendCodeFormDTO; +import com.epmet.dto.form.CertificationAddFormDTO; import com.epmet.dto.form.UserBadgeListFormDTO; import com.epmet.dto.form.UserOperListFormDTO; import com.epmet.dto.result.UserBadgeListResultDTO; @@ -47,4 +50,29 @@ public class UserBadgeController { return new Result>().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(); + } + } diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/UserBadgeDao.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/UserBadgeDao.java index 65eec9d1ac..fececff9d8 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/UserBadgeDao.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/UserBadgeDao.java @@ -1,5 +1,6 @@ package com.epmet.dao; +import com.epmet.dto.UserBadgeCertificateRecordDTO; import com.epmet.dto.form.UserBadgeListFormDTO; import com.epmet.dto.result.UserBadgeListResultDTO; import com.epmet.dto.result.UserOperListResultDTO; @@ -47,4 +48,21 @@ public interface UserBadgeDao { */ List 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); + } diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/redis/UserBadgeRedis.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/redis/UserBadgeRedis.java index 727c467e12..1b209e7dee 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/redis/UserBadgeRedis.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/redis/UserBadgeRedis.java @@ -1,6 +1,8 @@ package com.epmet.redis; import com.alibaba.fastjson.JSON; +import com.epmet.common.token.constant.LoginConstant; +import com.epmet.commons.tools.redis.RedisKeys; import com.epmet.commons.tools.redis.RedisUtils; import com.epmet.commons.tools.utils.ConvertUtils; import com.epmet.constant.BadgeConstant; @@ -12,6 +14,8 @@ import java.util.ArrayList; import java.util.List; import java.util.Map; +import static com.epmet.commons.tools.redis.RedisUtils.MINUTE_THIRTY_EXPIRE; + /** * @Author zxc * @DateTime 2020/11/3 2:21 下午 @@ -44,4 +48,15 @@ public class UserBadgeRedis { redisUtils.hSet(BadgeConstant.BADGE_KEY+customerId,BadgeConstant.BADGE, JSON.toJSON(userBadge).toString(),-1); } + public void saveBadgeSmsCode(String mobile, String smsCode) { + String smsCodeKey = "epmet:smsCode:badge:" + mobile; + redisUtils.set(smsCodeKey, smsCode, MINUTE_THIRTY_EXPIRE); + } + + public String getBadgeSmsCode(String mobile) { + String smsCodeKey = "epmet:smsCode:badge:" + mobile; + String smsCode = (String) redisUtils.get(smsCodeKey); + return smsCode; + } + } diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/UserBadgeService.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/UserBadgeService.java index fe5737a2d3..79334d2960 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/UserBadgeService.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/UserBadgeService.java @@ -1,9 +1,13 @@ package com.epmet.service; +import com.epmet.commons.tools.utils.Result; +import com.epmet.dto.form.BadgeSendCodeFormDTO; +import com.epmet.dto.form.CertificationAddFormDTO; 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 org.springframework.web.bind.annotation.RequestBody; import java.util.List; @@ -29,4 +33,20 @@ public interface UserBadgeService { */ List 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); + } diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/UserBadgeServiceImpl.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/UserBadgeServiceImpl.java index 261f7e7bdc..33ddb19b00 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/UserBadgeServiceImpl.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/UserBadgeServiceImpl.java @@ -2,16 +2,27 @@ 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.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.form.UserBadgeListFormDTO; -import com.epmet.dto.form.UserOperListFormDTO; +import com.epmet.dto.UserBadgeCertificateRecordDTO; +import com.epmet.dto.form.*; +import com.epmet.dto.result.SendVerificationCodeResultDTO; import com.epmet.dto.result.UserBadgeListResultDTO; +import com.epmet.dto.result.UserBaseInfoResultDTO; import com.epmet.dto.result.UserOperListResultDTO; +import com.epmet.feign.EpmetMessageOpenFeignClient; import com.epmet.redis.UserBadgeRedis; +import com.epmet.service.CustomerStaffService; 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; @@ -34,6 +45,12 @@ public class UserBadgeServiceImpl implements UserBadgeService { private UserBadgeDao userBadgeDao; @Autowired private UserBadgeRedis userBadgeRedis; + @Autowired + private UserBaseInfoService userBaseInfoService; + @Autowired + private CustomerStaffService customerStaffService; + @Autowired + private EpmetMessageOpenFeignClient epmetMessageOpenFeignClient; /** * @Description 查询已经点亮的徽章 @@ -123,4 +140,62 @@ public class UserBadgeServiceImpl implements UserBadgeService { }); return userOperListResultDTOS; } + + /** + * @Description 个人中心-提交徽章认证 + * @Param certificationAddFormDTO + * @author zxc + * @date 2020/11/4 1:36 下午 + */ + @Override + 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 userIds = new ArrayList<>(); + userIds.add(certificationAddFormDTO.getUserId()); + List 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 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())); + } + } diff --git a/epmet-user/epmet-user-server/src/main/resources/mapper/UserBadgeDao.xml b/epmet-user/epmet-user-server/src/main/resources/mapper/UserBadgeDao.xml index b9bcbad998..b6c688b331 100644 --- a/epmet-user/epmet-user-server/src/main/resources/mapper/UserBadgeDao.xml +++ b/epmet-user/epmet-user-server/src/main/resources/mapper/UserBadgeDao.xml @@ -3,6 +3,15 @@ + + + UPDATE user_badge_certificate_record + SET is_last = 'no' + WHERE DEL_FLAG = '0' + AND BADGE_ID = #{badgeId} + AND USER_ID = #{userId} + + + + + INSERT INTO user_badge_certificate_record ( + ID, + CUSTOMER_ID, + GRID_ID, + USER_ID, + BADGE_ID, + SURNAME, + NAME, + ID_NUM, + CERTIFICATION_IMG, + REMAEK, + AUDIT_STATUS, + AUDIT_REMARK, + STAFF_ID, + AUDIT_TIME, + IS_LAST, + DEL_FLAG, + REVISION, + CREATED_BY, + CREATED_TIME, + UPDATED_BY, + UPDATED_TIME + ) + VALUES + ( + REPLACE ( UUID(), '-', '' ), + #{customerId}, + #{gridId}, + #{userId}, + #{badgeId}, + #{surname}, + #{name}, + #{idNum}, + #{certificationImg}, + #{remark}, + #{auditStatus}, + #{auditRemark}, + #{staffId}, + #{auditTime}, + #{isLast}, + #{delFlag}, + #{revision}, + #{createdBy}, + NOW(), + #{updatedBy}, + NOW() + ) + From 67baaefff06e77e86fbbdee1ae15791441155177 Mon Sep 17 00:00:00 2001 From: zxc <1272811460@qq.com> Date: Wed, 4 Nov 2020 16:50:40 +0800 Subject: [PATCH 11/23] =?UTF-8?q?=E5=BE=BD=E7=AB=A0=E8=AE=A4=E8=AF=81?= =?UTF-8?q?=E8=AF=A6=E6=83=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../dto/UserBadgeCertificateRecordDTO.java | 1 + .../dto/form/CertificationDetailFormDTO.java | 29 +++++++++ .../result/CertificationDetailResultDTO.java | 60 +++++++++++++++++++ .../epmet/feign/EpmetUserOpenFeignClient.java | 12 +++- .../epmet/controller/UserBadgeController.java | 23 +++++-- .../main/java/com/epmet/dao/UserBadgeDao.java | 9 +++ .../com/epmet/service/UserBadgeService.java | 17 ++++-- .../service/impl/UserBadgeServiceImpl.java | 19 ++++-- .../main/resources/mapper/UserBadgeDao.xml | 27 +++++++++ 9 files changed, 181 insertions(+), 16 deletions(-) create mode 100644 epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/CertificationDetailFormDTO.java create mode 100644 epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/CertificationDetailResultDTO.java diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/UserBadgeCertificateRecordDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/UserBadgeCertificateRecordDTO.java index a398d6f2cc..ffa2be3013 100644 --- a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/UserBadgeCertificateRecordDTO.java +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/UserBadgeCertificateRecordDTO.java @@ -20,6 +20,7 @@ public class UserBadgeCertificateRecordDTO implements Serializable { private String badgeId; private String surname; private String name; + private String mobile; private String idNum; private String certificationImg; private String remark; diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/CertificationDetailFormDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/CertificationDetailFormDTO.java new file mode 100644 index 0000000000..1eea42f575 --- /dev/null +++ b/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; +} diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/CertificationDetailResultDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/CertificationDetailResultDTO.java new file mode 100644 index 0000000000..4e7298c1b9 --- /dev/null +++ b/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; +} diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/feign/EpmetUserOpenFeignClient.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/feign/EpmetUserOpenFeignClient.java index f356eb8b1a..f5f531b656 100644 --- a/epmet-user/epmet-user-client/src/main/java/com/epmet/feign/EpmetUserOpenFeignClient.java +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/feign/EpmetUserOpenFeignClient.java @@ -344,7 +344,7 @@ public interface EpmetUserOpenFeignClient { * @author zxc * @date 2020/11/3 1:33 下午 */ - @PostMapping("/epmetuser/badge/badgelist") + @PostMapping("/epmetuser/more/badge/badgelist") Result> selectBadgeList(@RequestBody UserBadgeListFormDTO userBadgeListFormDTO); /** @@ -353,9 +353,15 @@ public interface EpmetUserOpenFeignClient { * @author zxc * @date 2020/11/3 4:28 下午 */ - @PostMapping("/epmetuser/badge/badgeoperlist") + @PostMapping("/epmetuser/more/badge/badgeoperlist") Result> selectOperList(@RequestBody UserOperListFormDTO userOperListFormDTO); - @PostMapping("/epmetuser/badge/authbadgerecord") + /** + * @Description 徽章认证提交 + * @Param certificationAddFormDTO + * @author zxc + * @date 2020/11/4 4:30 下午 + */ + @PostMapping("/epmetuser/more/badge/authbadgerecord") Result authBadgeRecord(@RequestBody CertificationAddFormDTO certificationAddFormDTO); } diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/UserBadgeController.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/UserBadgeController.java index f29179b551..ff5767867e 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/UserBadgeController.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/UserBadgeController.java @@ -1,11 +1,11 @@ package com.epmet.controller; +import com.epmet.commons.tools.annotation.LoginUser; +import com.epmet.commons.tools.security.dto.TokenDto; import com.epmet.commons.tools.utils.Result; import com.epmet.commons.tools.validator.ValidatorUtils; -import com.epmet.dto.form.BadgeSendCodeFormDTO; -import com.epmet.dto.form.CertificationAddFormDTO; -import com.epmet.dto.form.UserBadgeListFormDTO; -import com.epmet.dto.form.UserOperListFormDTO; +import com.epmet.dto.form.*; +import com.epmet.dto.result.CertificationDetailResultDTO; import com.epmet.dto.result.UserBadgeListResultDTO; import com.epmet.dto.result.UserOperListResultDTO; import com.epmet.service.UserBadgeService; @@ -22,7 +22,7 @@ import java.util.List; * @DateTime 2020/11/3 11:16 上午 */ @RestController -@RequestMapping("badge") +@RequestMapping("more/badge") public class UserBadgeController { @Autowired @@ -75,4 +75,17 @@ public class UserBadgeController { return new Result(); } + /** + * @Description 个人中心-获取徽章认证页面详情 + * @Param tokenDto + * @Param certificationDetailFormDTO + * @author zxc + * @date 2020/11/4 4:03 下午 + */ + @PostMapping("certification/detail") + public Result certificationDetail(@LoginUser TokenDto tokenDto,@RequestBody CertificationDetailFormDTO certificationDetailFormDTO){ + ValidatorUtils.validateEntity(certificationDetailFormDTO); + return new Result().ok(userBadgeService.certificationDetail(tokenDto,certificationDetailFormDTO)); + } + } diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/UserBadgeDao.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/UserBadgeDao.java index fececff9d8..7025c1870c 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/UserBadgeDao.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/UserBadgeDao.java @@ -2,6 +2,7 @@ package com.epmet.dao; import com.epmet.dto.UserBadgeCertificateRecordDTO; import com.epmet.dto.form.UserBadgeListFormDTO; +import com.epmet.dto.result.CertificationDetailResultDTO; import com.epmet.dto.result.UserBadgeListResultDTO; import com.epmet.dto.result.UserOperListResultDTO; import org.apache.ibatis.annotations.Mapper; @@ -65,4 +66,12 @@ public interface UserBadgeDao { */ 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); } diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/UserBadgeService.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/UserBadgeService.java index 79334d2960..e9cc979c91 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/UserBadgeService.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/UserBadgeService.java @@ -1,10 +1,10 @@ package com.epmet.service; +import com.epmet.commons.tools.annotation.LoginUser; +import com.epmet.commons.tools.security.dto.TokenDto; import com.epmet.commons.tools.utils.Result; -import com.epmet.dto.form.BadgeSendCodeFormDTO; -import com.epmet.dto.form.CertificationAddFormDTO; -import com.epmet.dto.form.UserBadgeListFormDTO; -import com.epmet.dto.form.UserOperListFormDTO; +import com.epmet.dto.form.*; +import com.epmet.dto.result.CertificationDetailResultDTO; import com.epmet.dto.result.UserBadgeListResultDTO; import com.epmet.dto.result.UserOperListResultDTO; import org.springframework.web.bind.annotation.RequestBody; @@ -49,4 +49,13 @@ public interface UserBadgeService { */ void badgeSendCode(BadgeSendCodeFormDTO badgeSendCodeFormDTO); + /** + * @Description 个人中心-获取徽章认证页面详情 + * @Param tokenDto + * @Param certificationDetailFormDTO + * @author zxc + * @date 2020/11/4 4:03 下午 + */ + CertificationDetailResultDTO certificationDetail(TokenDto tokenDto, CertificationDetailFormDTO certificationDetailFormDTO); + } diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/UserBadgeServiceImpl.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/UserBadgeServiceImpl.java index 33ddb19b00..2d96216eaa 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/UserBadgeServiceImpl.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/UserBadgeServiceImpl.java @@ -4,6 +4,7 @@ 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; @@ -12,10 +13,7 @@ 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.SendVerificationCodeResultDTO; -import com.epmet.dto.result.UserBadgeListResultDTO; -import com.epmet.dto.result.UserBaseInfoResultDTO; -import com.epmet.dto.result.UserOperListResultDTO; +import com.epmet.dto.result.*; import com.epmet.feign.EpmetMessageOpenFeignClient; import com.epmet.redis.UserBadgeRedis; import com.epmet.service.CustomerStaffService; @@ -198,4 +196,17 @@ public class UserBadgeServiceImpl implements UserBadgeService { 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()); + } + } diff --git a/epmet-user/epmet-user-server/src/main/resources/mapper/UserBadgeDao.xml b/epmet-user/epmet-user-server/src/main/resources/mapper/UserBadgeDao.xml index b6c688b331..5d46734499 100644 --- a/epmet-user/epmet-user-server/src/main/resources/mapper/UserBadgeDao.xml +++ b/epmet-user/epmet-user-server/src/main/resources/mapper/UserBadgeDao.xml @@ -67,6 +67,31 @@ AND USER_ID = #{userId} + + + INSERT INTO user_badge_certificate_record ( @@ -77,6 +102,7 @@ BADGE_ID, SURNAME, NAME, + MOBILE, ID_NUM, CERTIFICATION_IMG, REMAEK, @@ -101,6 +127,7 @@ #{badgeId}, #{surname}, #{name}, + #{mobile}, #{idNum}, #{certificationImg}, #{remark}, From 8084fce2b4695806f11e269314b70f3da2b8ae62 Mon Sep 17 00:00:00 2001 From: zhaoqifeng Date: Wed, 4 Nov 2020 17:03:20 +0800 Subject: [PATCH 12/23] =?UTF-8?q?=E5=B7=A5=E4=BD=9C=E7=AB=AF-=E5=BE=BD?= =?UTF-8?q?=E7=AB=A0=E7=AE=A1=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../tools/exception/EpmetErrorCode.java | 5 + .../com/epmet/controller/OssController.java | 34 +++ .../com/epmet/constant/BadgeConstant.java | 2 + .../dto/BadgeCertificationConfigDTO.java | 86 ++++++ .../src/main/java/com/epmet/dto/BadgeDTO.java | 96 +++++++ .../com/epmet/dto/form/AddBadgeFormDTO.java | 42 +++ .../java/com/epmet/dto/form/BadgeFormDTO.java | 16 ++ .../com/epmet/dto/form/EditBadgeFormDTO.java | 40 +++ .../dto/result/BadgeDetailResultDTO.java | 26 ++ .../epmet/dto/result/BadgeListResultDTO.java | 31 +++ .../com/epmet/controller/BadgeController.java | 104 ++++++++ .../dao/BadgeCertificationConfigDao.java | 54 ++++ .../src/main/java/com/epmet/dao/BadgeDao.java | 108 ++++++++ .../BadgeCertificationConfigEntity.java | 56 ++++ .../java/com/epmet/entity/BadgeEntity.java | 66 +++++ .../java/com/epmet/redis/UserBadgeRedis.java | 5 - .../BadgeCertificationConfigService.java | 127 +++++++++ .../java/com/epmet/service/BadgeService.java | 150 +++++++++++ .../BadgeCertificationConfigServiceImpl.java | 149 +++++++++++ .../epmet/service/impl/BadgeServiceImpl.java | 248 ++++++++++++++++++ .../mapper/BadgeCertificationConfigDao.xml | 42 +++ .../src/main/resources/mapper/BadgeDao.xml | 116 ++++++++ 22 files changed, 1598 insertions(+), 5 deletions(-) create mode 100644 epmet-user/epmet-user-client/src/main/java/com/epmet/dto/BadgeCertificationConfigDTO.java create mode 100644 epmet-user/epmet-user-client/src/main/java/com/epmet/dto/BadgeDTO.java create mode 100644 epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/AddBadgeFormDTO.java create mode 100644 epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/BadgeFormDTO.java create mode 100644 epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/EditBadgeFormDTO.java create mode 100644 epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/BadgeDetailResultDTO.java create mode 100644 epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/BadgeListResultDTO.java create mode 100644 epmet-user/epmet-user-server/src/main/java/com/epmet/controller/BadgeController.java create mode 100644 epmet-user/epmet-user-server/src/main/java/com/epmet/dao/BadgeCertificationConfigDao.java create mode 100644 epmet-user/epmet-user-server/src/main/java/com/epmet/dao/BadgeDao.java create mode 100644 epmet-user/epmet-user-server/src/main/java/com/epmet/entity/BadgeCertificationConfigEntity.java create mode 100644 epmet-user/epmet-user-server/src/main/java/com/epmet/entity/BadgeEntity.java create mode 100644 epmet-user/epmet-user-server/src/main/java/com/epmet/service/BadgeCertificationConfigService.java create mode 100644 epmet-user/epmet-user-server/src/main/java/com/epmet/service/BadgeService.java create mode 100644 epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/BadgeCertificationConfigServiceImpl.java create mode 100644 epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/BadgeServiceImpl.java create mode 100644 epmet-user/epmet-user-server/src/main/resources/mapper/BadgeCertificationConfigDao.xml create mode 100644 epmet-user/epmet-user-server/src/main/resources/mapper/BadgeDao.xml diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java index e4832a1c8b..2242a9ef9c 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java @@ -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, "至少需要添加一个段落"), diff --git a/epmet-module/epmet-oss/epmet-oss-server/src/main/java/com/epmet/controller/OssController.java b/epmet-module/epmet-oss/epmet-oss-server/src/main/java/com/epmet/controller/OssController.java index 5b3e3bee6b..a7f37ab6e9 100644 --- a/epmet-module/epmet-oss/epmet-oss-server/src/main/java/com/epmet/controller/OssController.java +++ b/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; @@ -37,6 +38,9 @@ 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.util.Arrays; import java.util.Map; @@ -218,4 +222,34 @@ public class OssController { return ossService.uploadImg(file); } + + @PostMapping("uploadimg/badgeicon") + public Result 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); + } + } diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/constant/BadgeConstant.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/constant/BadgeConstant.java index 7c2a6313c2..57661b4871 100644 --- a/epmet-user/epmet-user-client/src/main/java/com/epmet/constant/BadgeConstant.java +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/constant/BadgeConstant.java @@ -20,4 +20,6 @@ public interface BadgeConstant { String APPROVED = "approved"; + String NONE ="none"; + } diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/BadgeCertificationConfigDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/BadgeCertificationConfigDTO.java new file mode 100644 index 0000000000..5eb6e95749 --- /dev/null +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/BadgeCertificationConfigDTO.java @@ -0,0 +1,86 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

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

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

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.dto; + +import java.io.Serializable; +import java.util.Date; +import lombok.Data; + + +/** + * 徽章认证配置 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-11-03 + */ +@Data +public class BadgeCertificationConfigDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 主键ID + */ + private String id; + + /** + * 客户Id 默认配置id:default + */ + 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; + +} \ No newline at end of file diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/BadgeDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/BadgeDTO.java new file mode 100644 index 0000000000..dfeb6f055b --- /dev/null +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/BadgeDTO.java @@ -0,0 +1,96 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

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

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

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.dto; + +import java.io.Serializable; +import java.util.Date; +import lombok.Data; + + +/** + * 徽章 + * + * @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 默认配置id:default + */ + 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; + +} \ No newline at end of file diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/AddBadgeFormDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/AddBadgeFormDTO.java new file mode 100644 index 0000000000..ceb07d1651 --- /dev/null +++ b/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 certificationTypes; +} diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/BadgeFormDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/BadgeFormDTO.java new file mode 100644 index 0000000000..4b35497e8b --- /dev/null +++ b/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; +} diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/EditBadgeFormDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/EditBadgeFormDTO.java new file mode 100644 index 0000000000..e11d2e107c --- /dev/null +++ b/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 certificationTypes; +} diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/BadgeDetailResultDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/BadgeDetailResultDTO.java new file mode 100644 index 0000000000..311c78f460 --- /dev/null +++ b/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 certificationTypes; + +} diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/BadgeListResultDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/BadgeListResultDTO.java new file mode 100644 index 0000000000..8d5d7c28ec --- /dev/null +++ b/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; +} diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/BadgeController.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/BadgeController.java new file mode 100644 index 0000000000..92a2621013 --- /dev/null +++ b/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> + */ + @PostMapping("list") + public Result> list(@LoginUser TokenDto tokenDto) { + List result = badgeService.getList(tokenDto.getCustomerId()); + return new Result>().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 + */ + @PostMapping("detail") + public Result detail(@LoginUser TokenDto tokenDto, @RequestBody BadgeFormDTO formDTO) { + BadgeDetailResultDTO result = badgeService.detail(tokenDto, formDTO); + return new Result().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(); + } + + +} diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/BadgeCertificationConfigDao.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/BadgeCertificationConfigDao.java new file mode 100644 index 0000000000..e60ac24fc5 --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/BadgeCertificationConfigDao.java @@ -0,0 +1,54 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

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

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

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.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 { + /** + * 获取认证信息类型 + * @author zhaoqifeng + * @date 2020/11/4 14:42 + * @param customerId + * @param badgeId + * @return java.util.List + */ + List 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); +} \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/BadgeDao.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/BadgeDao.java new file mode 100644 index 0000000000..965f753b6e --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/BadgeDao.java @@ -0,0 +1,108 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

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

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

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.dao; + +import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.dto.result.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 { + + /** + * 获取徽章列表 + * @author zhaoqifeng + * @date 2020/11/3 17:30 + * @param customerId + * @return java.util.List + */ + List selectList(@Param("customerId") String customerId); + + /** + * 重名校验 + * @author zhaoqifeng + * @date 2020/11/4 10:40 + * @param customerId + * @param badgeName + * @return java.util.List + */ + List 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 + */ + List 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); +} \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/BadgeCertificationConfigEntity.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/BadgeCertificationConfigEntity.java new file mode 100644 index 0000000000..90a6001940 --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/BadgeCertificationConfigEntity.java @@ -0,0 +1,56 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

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

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

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.entity; + +import com.baomidou.mybatisplus.annotation.TableName; + +import com.epmet.commons.mybatis.entity.BaseEpmetEntity; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.util.Date; + +/** + * 徽章认证配置 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-11-03 + */ +@Data +@EqualsAndHashCode(callSuper=false) +@TableName("badge_certification_config") +public class BadgeCertificationConfigEntity extends BaseEpmetEntity { + + private static final long serialVersionUID = 1L; + + /** + * 客户Id 默认配置id:default + */ + private String customerId; + + /** + * 徽章ID + */ + private String badgeId; + + /** + * 认证信息类型 手机号:mobile;全名:fullname;身份证:idcard;认证证件: certificate;认证说明(备注):remark + */ + private String certificationType; + +} diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/BadgeEntity.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/BadgeEntity.java new file mode 100644 index 0000000000..c6aec0b820 --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/BadgeEntity.java @@ -0,0 +1,66 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

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

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

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.entity; + +import com.baomidou.mybatisplus.annotation.TableName; + +import com.epmet.commons.mybatis.entity.BaseEpmetEntity; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.util.Date; + +/** + * 徽章 + * + * @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 默认配置id:default + */ + private String customerId; + + /** + * 徽章名称 + */ + private String badgeName; + + /** + * 徽章图标url + */ + private String badgeIcon; + + /** + * 固有徽章类型 前端页面跳转标识,党员徽章:party;无:none + */ + private String fixationBadgeType; + + /** + * 状态 上线:online;下线:offline; + */ + private String badgeStatus; + +} diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/redis/UserBadgeRedis.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/redis/UserBadgeRedis.java index 1b209e7dee..cf1a34f871 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/redis/UserBadgeRedis.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/redis/UserBadgeRedis.java @@ -1,18 +1,13 @@ package com.epmet.redis; import com.alibaba.fastjson.JSON; -import com.epmet.common.token.constant.LoginConstant; -import com.epmet.commons.tools.redis.RedisKeys; import com.epmet.commons.tools.redis.RedisUtils; -import com.epmet.commons.tools.utils.ConvertUtils; 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.ArrayList; import java.util.List; -import java.util.Map; import static com.epmet.commons.tools.redis.RedisUtils.MINUTE_THIRTY_EXPIRE; diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/BadgeCertificationConfigService.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/BadgeCertificationConfigService.java new file mode 100644 index 0000000000..5c14ca740a --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/BadgeCertificationConfigService.java @@ -0,0 +1,127 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

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

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

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.service; + +import com.epmet.commons.mybatis.service.BaseService; +import com.epmet.commons.tools.page.PageData; +import com.epmet.dto.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 { + + /** + * 默认分页 + * + * @param params + * @return PageData + * @author generator + * @date 2020-11-03 + */ + PageData page(Map params); + + /** + * 默认查询 + * + * @param params + * @return java.util.List + * @author generator + * @date 2020-11-03 + */ + List list(Map 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 + */ + List 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 list); + + /** + * 删除配置 + * @author zhaoqifeng + * @date 2020/11/4 15:41 + * @param customerId + * @param badgeId + * @return void + */ + void deleteConfig(String customerId, String badgeId); + +} \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/BadgeService.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/BadgeService.java new file mode 100644 index 0000000000..7b73e28561 --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/BadgeService.java @@ -0,0 +1,150 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

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

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

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.service; + +import com.epmet.commons.mybatis.service.BaseService; +import com.epmet.commons.tools.page.PageData; +import com.epmet.commons.tools.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 { + + /** + * 默认分页 + * + * @param params + * @return PageData + * @author generator + * @date 2020-11-03 + */ + PageData page(Map params); + + /** + * 默认查询 + * + * @param params + * @return java.util.List + * @author generator + * @date 2020-11-03 + */ + List list(Map 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 + */ + List 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); +} \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/BadgeCertificationConfigServiceImpl.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/BadgeCertificationConfigServiceImpl.java new file mode 100644 index 0000000000..2af4587368 --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/BadgeCertificationConfigServiceImpl.java @@ -0,0 +1,149 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

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

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

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; +import com.epmet.commons.tools.page.PageData; +import com.epmet.commons.tools.utils.ConvertUtils; +import com.epmet.commons.tools.constant.FieldConstant; +import com.epmet.dao.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 implements BadgeCertificationConfigService { + + + @Override + public PageData page(Map params) { + IPage page = baseDao.selectPage( + getPage(params, FieldConstant.CREATED_TIME, false), + getWrapper(params) + ); + return getPageData(page, BadgeCertificationConfigDTO.class); + } + + @Override + public List list(Map params) { + List entityList = baseDao.selectList(getWrapper(params)); + + return ConvertUtils.sourceToTarget(entityList, BadgeCertificationConfigDTO.class); + } + + private QueryWrapper getWrapper(Map params){ + String id = (String)params.get(FieldConstant.ID_HUMP); + + QueryWrapper wrapper = new QueryWrapper<>(); + wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id); + + return wrapper; + } + + @Override + public 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 + * @author zhaoqifeng + * @date 2020/11/4 14:39 + */ + @Override + public List getCertificationType(String customerId, String badgeId) { + List 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 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); + } + +} \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/BadgeServiceImpl.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/BadgeServiceImpl.java new file mode 100644 index 0000000000..021b0c734a --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/BadgeServiceImpl.java @@ -0,0 +1,248 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

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

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

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; +import com.epmet.commons.tools.constant.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 implements BadgeService { + + @Autowired + private BadgeCertificationConfigService badgeCertificationConfigService; + + + @Override + public PageData page(Map params) { + IPage page = baseDao.selectPage( + getPage(params, FieldConstant.CREATED_TIME, false), + getWrapper(params) + ); + return getPageData(page, BadgeDTO.class); + } + + @Override + public List list(Map params) { + List entityList = baseDao.selectList(getWrapper(params)); + + return ConvertUtils.sourceToTarget(entityList, BadgeDTO.class); + } + + private QueryWrapper getWrapper(Map params){ + String id = (String)params.get(FieldConstant.ID_HUMP); + + QueryWrapper wrapper = new QueryWrapper<>(); + wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id); + + return wrapper; + } + + @Override + public 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 + * @author zhaoqifeng + * @date 2020/11/3 17:04 + */ + @Override + public List 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 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 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 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 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 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()); + } + +} \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/resources/mapper/BadgeCertificationConfigDao.xml b/epmet-user/epmet-user-server/src/main/resources/mapper/BadgeCertificationConfigDao.xml new file mode 100644 index 0000000000..251523c8d3 --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/resources/mapper/BadgeCertificationConfigDao.xml @@ -0,0 +1,42 @@ + + + + + + + + + + + + + + + + + + + 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) + + + + + \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/resources/mapper/BadgeDao.xml b/epmet-user/epmet-user-server/src/main/resources/mapper/BadgeDao.xml new file mode 100644 index 0000000000..322604bc70 --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/resources/mapper/BadgeDao.xml @@ -0,0 +1,116 @@ + + + + + + + + + + + + + + + + + + + + + update badge set + BADGE_NAME = #{badgeName}, + BADGE_ICON = #{badgeIcon}, + BADGE_STATUS = #{badgeStatus} + where ID = #{id} AND CUSTOMER_ID = #{customerId} + + + + update badge set + DEL_FLAG = '1' + where ID = #{badgeId} AND CUSTOMER_ID = #{customerId} + + + + + + + + + \ No newline at end of file From 27268ab2b69c29cb6467027a43237c7788200301 Mon Sep 17 00:00:00 2001 From: jianjun Date: Wed, 4 Nov 2020 17:27:55 +0800 Subject: [PATCH 13/23] =?UTF-8?q?=E5=B1=8F=E8=94=BD=E9=83=A8=E5=88=86?= =?UTF-8?q?=E6=97=A5=E5=BF=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/resources/logback-spring.xml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/logback-spring.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/logback-spring.xml index f099678400..b2e0b7a9da 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/logback-spring.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/logback-spring.xml @@ -173,6 +173,13 @@ + + + + + + + From b34751518dba1d35de4473bffa6aa46fe42df0c3 Mon Sep 17 00:00:00 2001 From: zxc <1272811460@qq.com> Date: Wed, 4 Nov 2020 17:36:43 +0800 Subject: [PATCH 14/23] =?UTF-8?q?=E4=B8=AA=E4=BA=BA=E4=B8=AD=E5=BF=83-?= =?UTF-8?q?=E6=9F=A5=E8=AF=A2=E5=BE=BD=E7=AB=A0=E8=A6=81=E6=98=BE=E7=A4=BA?= =?UTF-8?q?=E7=9A=84=E8=AE=A4=E8=AF=81=E4=BF=A1=E6=81=AF=E5=AD=97=E6=AE=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/epmet/dto/form/AuthFieldFormDTO.java | 24 +++++++++++ .../epmet/dto/result/AuthFieldResultDTO.java | 40 +++++++++++++++++++ .../epmet/controller/UserBadgeController.java | 13 ++++++ .../main/java/com/epmet/dao/UserBadgeDao.java | 10 +++++ .../com/epmet/service/UserBadgeService.java | 11 ++++- .../service/impl/UserBadgeServiceImpl.java | 18 ++++++++- .../main/resources/mapper/UserBadgeDao.xml | 17 ++++++++ 7 files changed, 129 insertions(+), 4 deletions(-) create mode 100644 epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/AuthFieldFormDTO.java create mode 100644 epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/AuthFieldResultDTO.java diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/AuthFieldFormDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/AuthFieldFormDTO.java new file mode 100644 index 0000000000..b5c716470f --- /dev/null +++ b/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; +} diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/AuthFieldResultDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/AuthFieldResultDTO.java new file mode 100644 index 0000000000..9c68bf19af --- /dev/null +++ b/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; +} diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/UserBadgeController.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/UserBadgeController.java index ff5767867e..3a4a590a81 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/UserBadgeController.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/UserBadgeController.java @@ -5,6 +5,7 @@ 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; @@ -88,4 +89,16 @@ public class UserBadgeController { return new Result().ok(userBadgeService.certificationDetail(tokenDto,certificationDetailFormDTO)); } + /** + * @Description 个人中心-查询徽章要显示的认证信息字段 + * @Param authFieldFormDTO + * @author zxc + * @date 2020/11/4 5:05 下午 + */ + @PostMapping("authfield") + public Result> authField(@RequestBody AuthFieldFormDTO authFieldFormDTO){ + ValidatorUtils.validateEntity(authFieldFormDTO, AuthFieldFormDTO.AuthField.class); + return new Result>().ok(userBadgeService.authField(authFieldFormDTO)); + } + } diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/UserBadgeDao.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/UserBadgeDao.java index 7025c1870c..6db7752cfd 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/UserBadgeDao.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/UserBadgeDao.java @@ -1,7 +1,9 @@ package com.epmet.dao; import com.epmet.dto.UserBadgeCertificateRecordDTO; +import com.epmet.dto.form.AuthFieldFormDTO; 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; @@ -74,4 +76,12 @@ public interface UserBadgeDao { * @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 selectAuthField(AuthFieldFormDTO authFieldFormDTO); } diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/UserBadgeService.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/UserBadgeService.java index e9cc979c91..b8bf156046 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/UserBadgeService.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/UserBadgeService.java @@ -1,13 +1,12 @@ package com.epmet.service; -import com.epmet.commons.tools.annotation.LoginUser; import com.epmet.commons.tools.security.dto.TokenDto; import com.epmet.commons.tools.utils.Result; import com.epmet.dto.form.*; +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.springframework.web.bind.annotation.RequestBody; import java.util.List; @@ -58,4 +57,12 @@ public interface UserBadgeService { */ CertificationDetailResultDTO certificationDetail(TokenDto tokenDto, CertificationDetailFormDTO certificationDetailFormDTO); + /** + * @Description 个人中心-查询徽章要显示的认证信息字段 + * @Param authFieldFormDTO + * @author zxc + * @date 2020/11/4 5:05 下午 + */ + List authField(AuthFieldFormDTO authFieldFormDTO); + } diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/UserBadgeServiceImpl.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/UserBadgeServiceImpl.java index 2d96216eaa..d1d8d1266f 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/UserBadgeServiceImpl.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/UserBadgeServiceImpl.java @@ -46,8 +46,6 @@ public class UserBadgeServiceImpl implements UserBadgeService { @Autowired private UserBaseInfoService userBaseInfoService; @Autowired - private CustomerStaffService customerStaffService; - @Autowired private EpmetMessageOpenFeignClient epmetMessageOpenFeignClient; /** @@ -209,4 +207,20 @@ public class UserBadgeServiceImpl implements UserBadgeService { return userBadgeDao.selectBadgeAuthRecord(certificationDetailFormDTO.getUserId(), certificationDetailFormDTO.getBadgeId()); } + + /** + * @Description 个人中心-查询徽章要显示的认证信息字段 + * @Param authFieldFormDTO + * @author zxc + * @date 2020/11/4 5:05 下午 + */ + @Override + public List authField(AuthFieldFormDTO authFieldFormDTO) { + List authFieldResultDTOS = userBadgeDao.selectAuthField(authFieldFormDTO); + if (CollectionUtils.isEmpty(authFieldResultDTOS)){ + return new ArrayList<>(); + } + return authFieldResultDTOS; + } + } diff --git a/epmet-user/epmet-user-server/src/main/resources/mapper/UserBadgeDao.xml b/epmet-user/epmet-user-server/src/main/resources/mapper/UserBadgeDao.xml index 5d46734499..bbecca58ec 100644 --- a/epmet-user/epmet-user-server/src/main/resources/mapper/UserBadgeDao.xml +++ b/epmet-user/epmet-user-server/src/main/resources/mapper/UserBadgeDao.xml @@ -92,6 +92,23 @@ AND USER_ID = #{userId} + + + INSERT INTO user_badge_certificate_record ( From 16c6c23caa0a5b6bc99986e8a87218186309ef2c Mon Sep 17 00:00:00 2001 From: sunyuchao Date: Wed, 4 Nov 2020 17:55:22 +0800 Subject: [PATCH 15/23] =?UTF-8?q?=E5=A4=96=E6=8C=82=E6=8E=A5=E5=8F=A3-?= =?UTF-8?q?=E6=9F=A5=E8=AF=A2=E7=BB=84=E7=BB=87=E9=83=A8=E9=97=A8=E7=BD=91?= =?UTF-8?q?=E6=A0=BC=E6=A0=91=E3=80=81=E6=9F=A5=E8=AF=A2=E7=BB=84=E7=BB=87?= =?UTF-8?q?=E6=88=96=E7=BD=91=E6=A0=BC=E5=AF=B9=E5=BA=94=E7=BB=84=E7=BB=87?= =?UTF-8?q?=E4=BF=A1=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../epmet/controller/OpenUpController.java | 10 +++ .../java/com/epmet/service/OpenUpService.java | 16 ++-- .../epmet/service/impl/OpenUpServiceImpl.java | 18 ++++- .../com/epmet/dto/form/AgencyInfoFormDTO.java | 21 +++-- .../dto/result/OrganizeTreeDeptResultDTO.java | 31 +++++++ .../dto/result/OrganizeTreeGridResultDTO.java | 31 +++++++ .../dto/result/OrganizeTreeResultDTO.java | 50 ++++++++++++ .../epmet/feign/GovOrgOpenFeignClient.java | 9 ++- .../GovOrgOpenFeignClientFallback.java | 5 ++ .../controller/CustomerAgencyController.java | 9 +++ .../java/com/epmet/dao/CustomerAgencyDao.java | 21 +++++ .../epmet/service/CustomerAgencyService.java | 6 ++ .../impl/CustomerAgencyServiceImpl.java | 22 ++++- .../resources/mapper/CustomerAgencyDao.xml | 81 +++++++++++++++++++ .../epmet/dto/form/OrganizeTreeFormDTO.java | 21 +++++ 15 files changed, 332 insertions(+), 19 deletions(-) create mode 100644 epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/OrganizeTreeDeptResultDTO.java create mode 100644 epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/OrganizeTreeGridResultDTO.java create mode 100644 epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/OrganizeTreeResultDTO.java create mode 100644 epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/OrganizeTreeFormDTO.java diff --git a/epmet-module/epmet-ext/epmet-ext-server/src/main/java/com/epmet/controller/OpenUpController.java b/epmet-module/epmet-ext/epmet-ext-server/src/main/java/com/epmet/controller/OpenUpController.java index 9884efe1b2..eecf737391 100644 --- a/epmet-module/epmet-ext/epmet-ext-server/src/main/java/com/epmet/controller/OpenUpController.java +++ b/epmet-module/epmet-ext/epmet-ext-server/src/main/java/com/epmet/controller/OpenUpController.java @@ -112,5 +112,15 @@ public class OpenUpController { return new Result().ok(openUpService.agencyInfo(formDTO)); } + /** + * @Description 外挂-获取当前组织及部门、网格数据,递归查询所有下级数据 + * @author sun + **/ + @PostMapping("organizetree") + Result organizeTree(@RequestBody OrganizeTreeFormDTO formDTO){ + ValidatorUtils.validateEntity(formDTO, OrganizeTreeFormDTO.StaffIdGroup.class); + return new Result().ok(openUpService.organizeTree(formDTO)); + } + } diff --git a/epmet-module/epmet-ext/epmet-ext-server/src/main/java/com/epmet/service/OpenUpService.java b/epmet-module/epmet-ext/epmet-ext-server/src/main/java/com/epmet/service/OpenUpService.java index d42e164f7e..ceecebc6c5 100644 --- a/epmet-module/epmet-ext/epmet-ext-server/src/main/java/com/epmet/service/OpenUpService.java +++ b/epmet-module/epmet-ext/epmet-ext-server/src/main/java/com/epmet/service/OpenUpService.java @@ -1,13 +1,7 @@ package com.epmet.service; -import com.epmet.dto.form.AgencyInfoFormDTO; -import com.epmet.dto.form.StaffSinAgencyFormDTO; -import com.epmet.dto.form.StaffSinDeptFormDTO; -import com.epmet.dto.form.StaffSinGridFormDTO; -import com.epmet.dto.result.AgencyInfoResultDTO; -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; @@ -46,4 +40,10 @@ public interface OpenUpService { * @author sun **/ AgencyInfoResultDTO agencyInfo(AgencyInfoFormDTO formDTO); + + /** + * @Description 外挂-获取当前组织及部门、网格数据,递归查询所有下级数据 + * @author sun + **/ + OrganizeTreeResultDTO organizeTree(OrganizeTreeFormDTO formDTO); } diff --git a/epmet-module/epmet-ext/epmet-ext-server/src/main/java/com/epmet/service/impl/OpenUpServiceImpl.java b/epmet-module/epmet-ext/epmet-ext-server/src/main/java/com/epmet/service/impl/OpenUpServiceImpl.java index 2290c84f59..8c497a9c69 100644 --- a/epmet-module/epmet-ext/epmet-ext-server/src/main/java/com/epmet/service/impl/OpenUpServiceImpl.java +++ b/epmet-module/epmet-ext/epmet-ext-server/src/main/java/com/epmet/service/impl/OpenUpServiceImpl.java @@ -6,10 +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.AgencyInfoResultDTO; -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; @@ -137,4 +134,17 @@ public class OpenUpServiceImpl implements OpenUpService { return result.getData(); } + /** + * @Description 外挂-获取当前组织及部门、网格数据,递归查询所有下级数据 + * @author sun + **/ + @Override + public OrganizeTreeResultDTO organizeTree(OrganizeTreeFormDTO formDTO) { + Result result = govOrgOpenFeignClient.organizeTree(formDTO.getAgencyId()); + if (!result.success()){ + throw new RenException(ModuleConstant.ERROR_AGENCY); + } + return result.getData(); + } + } diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/AgencyInfoFormDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/AgencyInfoFormDTO.java index 0288dd339e..2d751240cb 100644 --- a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/AgencyInfoFormDTO.java +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/AgencyInfoFormDTO.java @@ -7,15 +7,26 @@ import javax.validation.constraints.NotBlank; import java.io.Serializable; /** - * @Author zxc - * @DateTime 2020/8/17 10:37 上午 + * 对外接口-根据组织Id获取组织信息-接口入参 + * @Author sun */ @Data public class AgencyInfoFormDTO implements Serializable { private static final long serialVersionUID = -1719033407335647411L; - @NotBlank(message = "组织Id不能为空" , groups = StaffIdGroup.class) - private String agencyId; - public interface StaffIdGroup extends CustomerClientShowGroup {} + /** + * 组织或网格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 { + } + + } diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/OrganizeTreeDeptResultDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/OrganizeTreeDeptResultDTO.java new file mode 100644 index 0000000000..8249d17991 --- /dev/null +++ b/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; +} diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/OrganizeTreeGridResultDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/OrganizeTreeGridResultDTO.java new file mode 100644 index 0000000000..4c855f6956 --- /dev/null +++ b/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; +} diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/OrganizeTreeResultDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/OrganizeTreeResultDTO.java new file mode 100644 index 0000000000..ee06600de6 --- /dev/null +++ b/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 gridList = new ArrayList<>(); + /** + * 直属机关直属部门列表 + * */ + private List departmentList = new ArrayList<>(); + /** + * 子集机关列表 + * */ + private List subAgencyList = new ArrayList<>(); +} diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/feign/GovOrgOpenFeignClient.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/feign/GovOrgOpenFeignClient.java index 3fa6739d94..82c64c24eb 100644 --- a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/feign/GovOrgOpenFeignClient.java +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/feign/GovOrgOpenFeignClient.java @@ -262,10 +262,17 @@ public interface GovOrgOpenFeignClient { /** * @param formDTO - * @return * @Author sun * @Description 根据组织Id获取组织信息 */ @PostMapping("/gov/org/customeragency/agencyinfo") Result agencyInfo(@RequestBody AgencyInfoFormDTO formDTO); + + /** + * @param agencyId + * @Author sun + * @Description 获取当前组织及部门、网格数据,递归查询所有下级数据 + */ + @PostMapping("/gov/org/customeragency/organizetree/{agencyId}") + Result organizeTree(@PathVariable("agencyId") String agencyId); } diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/feign/fallback/GovOrgOpenFeignClientFallback.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/feign/fallback/GovOrgOpenFeignClientFallback.java index 4e03cbdc2a..c3811eb323 100644 --- a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/feign/fallback/GovOrgOpenFeignClientFallback.java +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/feign/fallback/GovOrgOpenFeignClientFallback.java @@ -156,4 +156,9 @@ public class GovOrgOpenFeignClientFallback implements GovOrgOpenFeignClient { public Result agencyInfo(AgencyInfoFormDTO formDTO) { return ModuleUtils.feignConError(ServiceConstant.GOV_ORG_SERVER, "agencyInfo", formDTO); } + + @Override + public Result organizeTree(String agencyId) { + return ModuleUtils.feignConError(ServiceConstant.GOV_ORG_SERVER, "organizeTree", agencyId); + } } diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/CustomerAgencyController.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/CustomerAgencyController.java index a052f79c8f..80acd68b46 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/CustomerAgencyController.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/CustomerAgencyController.java @@ -251,4 +251,13 @@ public class CustomerAgencyController { Result agencyInfo(@RequestBody AgencyInfoFormDTO formDTO) { return new Result().ok(customerAgencyService.agencyInfo(formDTO)); } + + /** + * @Description 外挂-获取当前组织及部门、网格数据,递归查询所有下级数据 + * @author sun + **/ + @PostMapping("organizetree/{agencyId}") + Result organizeTree(@PathVariable("agencyId") String agencyId) { + return new Result().ok(customerAgencyService.organizeTree(agencyId)); + } } \ No newline at end of file diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerAgencyDao.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerAgencyDao.java index 8c404a53c2..1c6f42456c 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerAgencyDao.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerAgencyDao.java @@ -175,4 +175,25 @@ public interface CustomerAgencyDao extends BaseDao { * @Description 查询工作人员所属组织信息 **/ AgencyResultDTO selectAgencyByStaffId(@Param("staffId") String staffId); + + /** + * @Description 外挂-获取当前组织及部门、网格数据,递归查询所有下级数据 + * @author sun + **/ + OrganizeTreeResultDTO selectorganizeTree(@Param("agencyId") String agencyId); + /** + * @Description 外挂-获取当前组织及部门、网格数据,递归查询所有下级数据 + * @author sun + **/ + List selectAgencyGridList(@Param("agencyId") String agencyId); + /** + * @Description 外挂-获取当前组织及部门、网格数据,递归查询所有下级数据 + * @author sun + **/ + List selectAgencyDeptList(@Param("agencyId") String agencyId); + /** + * @Description 外挂-获取当前组织及部门、网格数据,递归查询所有下级数据 + * @author sun + **/ + List selectAllSub(@Param("agencyId") String agencyId); } \ No newline at end of file diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/CustomerAgencyService.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/CustomerAgencyService.java index 8430acdf88..9297e8f5f1 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/CustomerAgencyService.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/CustomerAgencyService.java @@ -219,4 +219,10 @@ public interface CustomerAgencyService extends BaseService * @author sun **/ AgencyInfoResultDTO agencyInfo(AgencyInfoFormDTO formDTO); + + /** + * @Description 外挂-获取当前组织及部门、网格数据,递归查询所有下级数据 + * @author sun + **/ + OrganizeTreeResultDTO organizeTree(String agencyId); } \ No newline at end of file diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerAgencyServiceImpl.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerAgencyServiceImpl.java index 65206f51a2..e02cb72ddc 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerAgencyServiceImpl.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerAgencyServiceImpl.java @@ -1001,7 +1001,18 @@ public class CustomerAgencyServiceImpl extends BaseServiceImpl + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/OrganizeTreeFormDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/OrganizeTreeFormDTO.java new file mode 100644 index 0000000000..5f7c6b4e4f --- /dev/null +++ b/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{} +} From 711da11747135d8616d3d621ba2f080af9406873 Mon Sep 17 00:00:00 2001 From: sunyuchao Date: Thu, 5 Nov 2020 09:30:11 +0800 Subject: [PATCH 16/23] =?UTF-8?q?=E7=A8=8B=E5=BA=8F=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/com/epmet/service/impl/OpenUpServiceImpl.java | 4 ++-- .../com/epmet/service/impl/CustomerAgencyServiceImpl.java | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/epmet-module/epmet-ext/epmet-ext-server/src/main/java/com/epmet/service/impl/OpenUpServiceImpl.java b/epmet-module/epmet-ext/epmet-ext-server/src/main/java/com/epmet/service/impl/OpenUpServiceImpl.java index 8c497a9c69..170c3e32c4 100644 --- a/epmet-module/epmet-ext/epmet-ext-server/src/main/java/com/epmet/service/impl/OpenUpServiceImpl.java +++ b/epmet-module/epmet-ext/epmet-ext-server/src/main/java/com/epmet/service/impl/OpenUpServiceImpl.java @@ -129,7 +129,7 @@ public class OpenUpServiceImpl implements OpenUpService { public AgencyInfoResultDTO agencyInfo(AgencyInfoFormDTO formDTO) { Result result = govOrgOpenFeignClient.agencyInfo(formDTO); if (!result.success()){ - throw new RenException(ModuleConstant.ERROR_AGENCY); + throw new RenException(result.getInternalMsg()); } return result.getData(); } @@ -142,7 +142,7 @@ public class OpenUpServiceImpl implements OpenUpService { public OrganizeTreeResultDTO organizeTree(OrganizeTreeFormDTO formDTO) { Result result = govOrgOpenFeignClient.organizeTree(formDTO.getAgencyId()); if (!result.success()){ - throw new RenException(ModuleConstant.ERROR_AGENCY); + throw new RenException(result.getInternalMsg()); } return result.getData(); } diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerAgencyServiceImpl.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerAgencyServiceImpl.java index e02cb72ddc..dd3360a781 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerAgencyServiceImpl.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerAgencyServiceImpl.java @@ -1007,7 +1007,7 @@ public class CustomerAgencyServiceImpl extends BaseServiceImpl Date: Thu, 5 Nov 2020 09:49:43 +0800 Subject: [PATCH 17/23] =?UTF-8?q?=E5=BE=BD=E7=AB=A0=E7=82=B9=E4=BA=AE/?= =?UTF-8?q?=E5=8F=96=E6=B6=88=E7=82=B9=E4=BA=AE=F0=9F=9B=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../badege/controller/BadgeController.java | 14 ++++++++++ .../modules/badege/service/BadgeService.java | 9 +++++++ .../badege/service/impl/BadgeServiceImpl.java | 16 ++++++++++++ .../epmet/dto/form/OpenedOrClosedFormDTO.java | 26 +++++++++++++++++++ .../epmet/feign/EpmetUserOpenFeignClient.java | 9 +++++++ .../EpmetUserOpenFeignClientFallback.java | 5 ++++ .../epmet/controller/UserBadgeController.java | 12 +++++++++ .../main/java/com/epmet/dao/UserBadgeDao.java | 8 ++++++ .../com/epmet/service/UserBadgeService.java | 8 ++++++ .../service/impl/UserBadgeServiceImpl.java | 12 ++++++++- .../main/resources/mapper/UserBadgeDao.xml | 10 +++++++ 11 files changed, 128 insertions(+), 1 deletion(-) create mode 100644 epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/OpenedOrClosedFormDTO.java diff --git a/epmet-module/resi-mine/resi-mine-server/src/main/java/com/epmet/modules/badege/controller/BadgeController.java b/epmet-module/resi-mine/resi-mine-server/src/main/java/com/epmet/modules/badege/controller/BadgeController.java index 8d70e5d097..da3bfca3d2 100644 --- a/epmet-module/resi-mine/resi-mine-server/src/main/java/com/epmet/modules/badege/controller/BadgeController.java +++ b/epmet-module/resi-mine/resi-mine-server/src/main/java/com/epmet/modules/badege/controller/BadgeController.java @@ -4,6 +4,7 @@ import com.epmet.commons.tools.annotation.LoginUser; import com.epmet.commons.tools.security.dto.TokenDto; import com.epmet.commons.tools.utils.Result; import com.epmet.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; @@ -67,5 +68,18 @@ public class BadgeController { 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(); + } + } diff --git a/epmet-module/resi-mine/resi-mine-server/src/main/java/com/epmet/modules/badege/service/BadgeService.java b/epmet-module/resi-mine/resi-mine-server/src/main/java/com/epmet/modules/badege/service/BadgeService.java index 6d020bc286..1b67df51f8 100644 --- a/epmet-module/resi-mine/resi-mine-server/src/main/java/com/epmet/modules/badege/service/BadgeService.java +++ b/epmet-module/resi-mine/resi-mine-server/src/main/java/com/epmet/modules/badege/service/BadgeService.java @@ -1,6 +1,7 @@ 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; @@ -40,4 +41,12 @@ public interface BadgeService { */ void certificationAdd(TokenDto tokenDto, CertificationAddFormDTO certificationAddFormDTO); + /** + * @Description 个人中心-取消/点亮徽章 + * @Param openedOrClosedFormDTO + * @author zxc + * @date 2020/11/5 9:23 上午 + */ + void openedOrClosed(TokenDto tokenDto,OpenedOrClosedFormDTO openedOrClosedFormDTO); + } diff --git a/epmet-module/resi-mine/resi-mine-server/src/main/java/com/epmet/modules/badege/service/impl/BadgeServiceImpl.java b/epmet-module/resi-mine/resi-mine-server/src/main/java/com/epmet/modules/badege/service/impl/BadgeServiceImpl.java index 259ffc23ae..4abc5853b6 100644 --- a/epmet-module/resi-mine/resi-mine-server/src/main/java/com/epmet/modules/badege/service/impl/BadgeServiceImpl.java +++ b/epmet-module/resi-mine/resi-mine-server/src/main/java/com/epmet/modules/badege/service/impl/BadgeServiceImpl.java @@ -4,6 +4,7 @@ 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; @@ -92,4 +93,19 @@ public class BadgeServiceImpl implements BadgeService { 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("取消/点亮徽章失败了......"); + } + } } diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/OpenedOrClosedFormDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/OpenedOrClosedFormDTO.java new file mode 100644 index 0000000000..15353d9685 --- /dev/null +++ b/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; +} diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/feign/EpmetUserOpenFeignClient.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/feign/EpmetUserOpenFeignClient.java index f5f531b656..00397c89e1 100644 --- a/epmet-user/epmet-user-client/src/main/java/com/epmet/feign/EpmetUserOpenFeignClient.java +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/feign/EpmetUserOpenFeignClient.java @@ -364,4 +364,13 @@ public interface EpmetUserOpenFeignClient { */ @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); } diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/feign/fallback/EpmetUserOpenFeignClientFallback.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/feign/fallback/EpmetUserOpenFeignClientFallback.java index 789acb75f4..6091c24821 100644 --- a/epmet-user/epmet-user-client/src/main/java/com/epmet/feign/fallback/EpmetUserOpenFeignClientFallback.java +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/feign/fallback/EpmetUserOpenFeignClientFallback.java @@ -240,4 +240,9 @@ public class EpmetUserOpenFeignClientFallback implements EpmetUserOpenFeignClien 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); + } } diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/UserBadgeController.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/UserBadgeController.java index 3a4a590a81..c0aa74d53e 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/UserBadgeController.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/UserBadgeController.java @@ -101,4 +101,16 @@ public class UserBadgeController { return new Result>().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(); + } + } diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/UserBadgeDao.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/UserBadgeDao.java index 6db7752cfd..a100a80ec2 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/UserBadgeDao.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/UserBadgeDao.java @@ -2,6 +2,7 @@ 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; @@ -84,4 +85,11 @@ public interface UserBadgeDao { * @date 2020/11/4 5:05 下午 */ List selectAuthField(AuthFieldFormDTO authFieldFormDTO); + /** + * @Description 个人中心-取消/点亮徽章 + * @Param openedOrClosedFormDTO + * @author zxc + * @date 2020/11/4 6:04 下午 + */ + void updateIsOpen(OpenedOrClosedFormDTO openedOrClosedFormDTO); } diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/UserBadgeService.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/UserBadgeService.java index b8bf156046..227584a101 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/UserBadgeService.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/UserBadgeService.java @@ -65,4 +65,12 @@ public interface UserBadgeService { */ List authField(AuthFieldFormDTO authFieldFormDTO); + /** + * @Description 个人中心-取消/点亮徽章 + * @Param openedOrClosedFormDTO + * @author zxc + * @date 2020/11/4 5:47 下午 + */ + void openedOrClosed(OpenedOrClosedFormDTO openedOrClosedFormDTO); + } diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/UserBadgeServiceImpl.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/UserBadgeServiceImpl.java index d1d8d1266f..24af3d436b 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/UserBadgeServiceImpl.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/UserBadgeServiceImpl.java @@ -16,7 +16,6 @@ import com.epmet.dto.form.*; import com.epmet.dto.result.*; import com.epmet.feign.EpmetMessageOpenFeignClient; import com.epmet.redis.UserBadgeRedis; -import com.epmet.service.CustomerStaffService; import com.epmet.service.UserBadgeService; import com.epmet.service.UserBaseInfoService; import lombok.extern.slf4j.Slf4j; @@ -223,4 +222,15 @@ public class UserBadgeServiceImpl implements UserBadgeService { return authFieldResultDTOS; } + /** + * @Description 个人中心-取消/点亮徽章 + * @Param openedOrClosedFormDTO + * @author zxc + * @date 2020/11/4 5:47 下午 + */ + @Override + public void openedOrClosed(OpenedOrClosedFormDTO openedOrClosedFormDTO) { + userBadgeDao.updateIsOpen(openedOrClosedFormDTO); + } + } diff --git a/epmet-user/epmet-user-server/src/main/resources/mapper/UserBadgeDao.xml b/epmet-user/epmet-user-server/src/main/resources/mapper/UserBadgeDao.xml index bbecca58ec..436898cc61 100644 --- a/epmet-user/epmet-user-server/src/main/resources/mapper/UserBadgeDao.xml +++ b/epmet-user/epmet-user-server/src/main/resources/mapper/UserBadgeDao.xml @@ -12,6 +12,16 @@ AND USER_ID = #{userId} + + + UPDATE resi_user_badge + SET IS_OPENED = (case when IS_OPENED = 1 THEN 0 ELSE 1 END), + UPDATED_TIME = NOW() + WHERE DEL_FLAG = '0' + AND USER_ID = #{userId} + AND BADGE_ID = #{badgeId} + +