From b4b2f872e839fb9cca9645c4e705e0c00c205920 Mon Sep 17 00:00:00 2001 From: zhaoqifeng Date: Fri, 6 Nov 2020 09:36:20 +0800 Subject: [PATCH] =?UTF-8?q?=E8=AE=A2=E9=98=85=E7=9B=B8=E5=90=8C=E6=A8=A1?= =?UTF-8?q?=E6=9D=BF=E6=97=B6=E6=B7=BB=E5=8A=A0=E5=85=B3=E9=94=AE=E5=AD=97?= =?UTF-8?q?=E9=99=90=E5=88=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../tools/exception/EpmetErrorCode.java | 1 + .../com/epmet/constant/BadgeConstant.java | 6 + .../dto/UserBadgeCertificateRecordDTO.java | 2 +- .../com/epmet/dto/form/BadgeAuditFormDTO.java | 20 +++ .../java/com/epmet/dto/form/BadgeFormDTO.java | 8 ++ .../dto/result/BadgeAuditRecordResultDTO.java | 43 +++++++ .../dto/result/BadgeAuditingResultDTO.java | 43 +++++++ .../com/epmet/controller/BadgeController.java | 44 +++++++ .../src/main/java/com/epmet/dao/BadgeDao.java | 27 ++++ .../dao/UserBadgeCertificateRecordDao.java | 33 +++++ .../UserBadgeCertificateRecordEntity.java | 116 ++++++++++++++++++ .../java/com/epmet/service/BadgeService.java | 33 +++++ .../UserBadgeCertificateRecordService.java | 95 ++++++++++++++ .../epmet/service/impl/BadgeServiceImpl.java | 88 ++++++++++++- ...UserBadgeCertificateRecordServiceImpl.java | 100 +++++++++++++++ .../src/main/resources/mapper/BadgeDao.xml | 72 ++++++++++- .../mapper/UserBadgeCertificateRecordDao.xml | 32 +++++ 17 files changed, 754 insertions(+), 9 deletions(-) create mode 100644 epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/BadgeAuditFormDTO.java create mode 100644 epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/BadgeAuditRecordResultDTO.java create mode 100644 epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/BadgeAuditingResultDTO.java create mode 100644 epmet-user/epmet-user-server/src/main/java/com/epmet/dao/UserBadgeCertificateRecordDao.java create mode 100644 epmet-user/epmet-user-server/src/main/java/com/epmet/entity/UserBadgeCertificateRecordEntity.java create mode 100644 epmet-user/epmet-user-server/src/main/java/com/epmet/service/UserBadgeCertificateRecordService.java create mode 100644 epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/UserBadgeCertificateRecordServiceImpl.java create mode 100644 epmet-user/epmet-user-server/src/main/resources/mapper/UserBadgeCertificateRecordDao.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 2242a9ef9c..e864c6b743 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 @@ -97,6 +97,7 @@ public enum EpmetErrorCode { //徽章管理 DUPLICATE_BADGE_NAME(8515, "徽章名已存在"), + DUPLICATE_PARTY_BADGE_NAME(8516, "不可删除党员徽章"), // 该错误不会提示给前端,只是后端传输错误信息用。 ACCESS_SQL_FILTER_MISSION_ARGS(8701, "缺少生成权限过滤SQL所需参数"), 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 315bf66a30..f8b6dcc2e5 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 @@ -24,4 +24,10 @@ public interface BadgeConstant { String SMS_CODE_KEY = "epmet:smsCode:badge:"; + String PARTY ="party"; + + String ONLINE ="online"; + + String OFFLINE ="offline"; + } 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 ffa2be3013..820f0fa45c 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 @@ -13,7 +13,7 @@ import java.util.Date; public class UserBadgeCertificateRecordDTO implements Serializable { private static final long serialVersionUID = 3207509834642386145L; - + private String id; private String customerId; private String gridId; private String userId; diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/BadgeAuditFormDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/BadgeAuditFormDTO.java new file mode 100644 index 0000000000..f7d3deac7d --- /dev/null +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/BadgeAuditFormDTO.java @@ -0,0 +1,20 @@ +package com.epmet.dto.form; + +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.io.Serializable; + +/** + * @author zhaoqifeng + * @dscription + * @date 2020/11/5 11:06 + */ +@NoArgsConstructor +@Data +public class BadgeAuditFormDTO implements Serializable { + private static final long serialVersionUID = 2209535364555130964L; + private String recordId; + private String auditStatus; + private String auditRemark; +} 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 index 4b35497e8b..e9702144f0 100644 --- 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 @@ -13,4 +13,12 @@ import java.io.Serializable; public class BadgeFormDTO implements Serializable { private static final long serialVersionUID = 9156247659994638103L; private String badgeId; + /** + * 页码 + */ + private Integer pageNo; + /** + * 每页显示数量 + */ + private Integer pageSize; } diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/BadgeAuditRecordResultDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/BadgeAuditRecordResultDTO.java new file mode 100644 index 0000000000..363441ad46 --- /dev/null +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/BadgeAuditRecordResultDTO.java @@ -0,0 +1,43 @@ +package com.epmet.dto.result; + +import lombok.Data; + +import java.io.Serializable; + +/** + * @author zhaoqifeng + * @dscription + * @date 2020/11/5 10:57 + */ +@Data +public class BadgeAuditRecordResultDTO implements Serializable { + private static final long serialVersionUID = 6004101838042628105L; + /** + * 徽章Id + */ + private String badgeId; + /** + * 徽章名称 + */ + private String badgeName; + /** + * 徽章图标url + */ + private String badgeIcon; + /** + * 用户Id + */ + private String userId; + /** + * 用户名 + */ + private String userName; + /** + * 创建时间 + */ + private Long createTime; + /** + * 用户名 + */ + private String auditStatus; +} diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/BadgeAuditingResultDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/BadgeAuditingResultDTO.java new file mode 100644 index 0000000000..bbf6381d82 --- /dev/null +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/BadgeAuditingResultDTO.java @@ -0,0 +1,43 @@ +package com.epmet.dto.result; + +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.io.Serializable; + +/** + * @author zhaoqifeng + * @dscription + * @date 2020/11/5 9:34 + */ +@NoArgsConstructor +@Data +public class BadgeAuditingResultDTO implements Serializable { + + private static final long serialVersionUID = -361914591952483084L; + /** + * 徽章Id + */ + private String badgeId; + /** + * 徽章名称 + */ + private String badgeName; + /** + * 徽章图标url + */ + private String badgeIcon; + /** + * 用户Id + */ + private String userId; + /** + * 用户名 + */ + private String userName; + /** + * 创建时间 + */ + private Long createTime; + +} 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 index 463fa4874a..12042c4fbd 100644 --- 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 @@ -5,8 +5,11 @@ 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.BadgeAuditFormDTO; import com.epmet.dto.form.BadgeFormDTO; import com.epmet.dto.form.EditBadgeFormDTO; +import com.epmet.dto.result.BadgeAuditRecordResultDTO; +import com.epmet.dto.result.BadgeAuditingResultDTO; import com.epmet.dto.result.BadgeDetailResultDTO; import com.epmet.dto.result.BadgeListResultDTO; import com.epmet.service.BadgeService; @@ -105,5 +108,46 @@ public class BadgeController { badgeService.testCache(); return new Result(); } + /** + * 待审核列表 + * @author zhaoqifeng + * @date 2020/11/5 9:51 + * @param tokenDto + * @param formDTO + * @return com.epmet.commons.tools.utils.Result> + */ + @PostMapping("auditinglist") + public Result> auditingList(@LoginUser TokenDto tokenDto, @RequestBody BadgeFormDTO formDTO) { + List result = badgeService.auditingList(tokenDto, formDTO); + return new Result>().ok(result); + } + + /** + * 审核历史列表 + * @author zhaoqifeng + * @date 2020/11/5 10:59 + * @param tokenDto + * @param formDTO + * @return com.epmet.commons.tools.utils.Result> + */ + @PostMapping("auditrecord") + public Result> auditRecord(@LoginUser TokenDto tokenDto, @RequestBody BadgeFormDTO formDTO) { + List result = badgeService.auditRecord(tokenDto, formDTO); + return new Result>().ok(result); + } + + /** + * 审核 + * @author zhaoqifeng + * @date 2020/11/5 11:09 + * @param tokenDto + * @param formDTO + * @return com.epmet.commons.tools.utils.Result + */ + @PostMapping("audit") + public Result audit(@LoginUser TokenDto tokenDto, @RequestBody BadgeAuditFormDTO formDTO) { + badgeService.audit(tokenDto, formDTO); + return new Result(); + } } 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 index 3b3fa6c596..a0c2fb42b6 100644 --- 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 @@ -18,6 +18,8 @@ package com.epmet.dao; import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.dto.result.BadgeAuditRecordResultDTO; +import com.epmet.dto.result.BadgeAuditingResultDTO; import com.epmet.dto.result.BadgeDetailResultDTO; import com.epmet.dto.result.BadgeListResultDTO; import com.epmet.dto.result.UserBadgeListResultDTO; @@ -107,6 +109,31 @@ public interface BadgeDao extends BaseDao { */ void deleteBadge(@Param("customerId") String customerId, @Param("badgeId") String badgeId); + + /** + * 待审核列表 + * @author zhaoqifeng + * @date 2020/11/5 10:01 + * @param customerId + * @param pageNo + * @param pageSize + * @return java.util.List + */ + List selectAuditingList(@Param("customerId") String customerId, @Param("pageNo") Integer pageNo, + @Param("pageSize") Integer pageSize); + + /** + * 审核历史列表 + * @author zhaoqifeng + * @date 2020/11/5 11:01 + * @param customerId + * @param pageNo + * @param pageSize + * @return java.util.List + */ + List selectAuditRecord(@Param("customerId") String customerId, @Param("pageNo") Integer pageNo, + @Param("pageSize") Integer pageSize); + /** * @Description 查询客户的徽章 * @param customerId diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/UserBadgeCertificateRecordDao.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/UserBadgeCertificateRecordDao.java new file mode 100644 index 0000000000..f7f4dba91c --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/UserBadgeCertificateRecordDao.java @@ -0,0 +1,33 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

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

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

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.dao; + +import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.entity.UserBadgeCertificateRecordEntity; +import org.apache.ibatis.annotations.Mapper; + +/** + * 用户认证徽章记录表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-11-05 + */ +@Mapper +public interface UserBadgeCertificateRecordDao extends BaseDao { + +} \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/UserBadgeCertificateRecordEntity.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/UserBadgeCertificateRecordEntity.java new file mode 100644 index 0000000000..867ae11bdb --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/UserBadgeCertificateRecordEntity.java @@ -0,0 +1,116 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

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

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

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.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-05 + */ +@Data +@EqualsAndHashCode(callSuper=false) +@TableName("user_badge_certificate_record") +public class UserBadgeCertificateRecordEntity extends BaseEpmetEntity { + + private static final long serialVersionUID = 1L; + + /** + * 客户Id + */ + private String customerId; + + /** + * 用户注册网格ID + */ + private String gridId; + + /** + * 用户ID + */ + private String userId; + + /** + * 徽章ID + */ + private String badgeId; + + /** + * 姓 + */ + private String surname; + + /** + * 名 + */ + private String name; + + /** + * 手机号 + */ + private String mobile; + + /** + * 身份证号 网格内去重 + */ + private String idNum; + + /** + * 认证证件图片 + */ + private String certificationImg; + + /** + * 认证说明(备注) + */ + private String remaek; + + /** + * 审核状态 approved:审核通过,rejected:审核驳回;auditing:审核中 + */ + private String auditStatus; + + /** + * 审核意见 + */ + private String auditRemark; + + /** + * 审核人 审核人Id + */ + private String staffId; + + /** + * 审核时间 + */ + private Date auditTime; + + /** + * 是否是最新纪录:yes:最新纪录,no:非最新纪录 + */ + private String isLast; + +} 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 index f041e19286..9b13682b6f 100644 --- 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 @@ -22,8 +22,11 @@ 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.BadgeAuditFormDTO; import com.epmet.dto.form.BadgeFormDTO; import com.epmet.dto.form.EditBadgeFormDTO; +import com.epmet.dto.result.BadgeAuditRecordResultDTO; +import com.epmet.dto.result.BadgeAuditingResultDTO; import com.epmet.dto.result.BadgeDetailResultDTO; import com.epmet.dto.result.BadgeListResultDTO; import com.epmet.entity.BadgeEntity; @@ -148,5 +151,35 @@ public interface BadgeService extends BaseService { */ void deleteBadge(TokenDto tokenDto, BadgeFormDTO formDTO); + /** + * 待审核列表 + * @author zhaoqifeng + * @date 2020/11/5 9:50 + * @param tokenDto + * @param formDTO + * @return java.util.List + */ + List auditingList(TokenDto tokenDto, BadgeFormDTO formDTO); + + /** + * 审核历史列表 + * @author zhaoqifeng + * @date 2020/11/5 10:59 + * @param tokenDto + * @param formDTO + * @return java.util.List + */ + List auditRecord(TokenDto tokenDto, BadgeFormDTO formDTO); + + /** + * 审核 + * @author zhaoqifeng + * @date 2020/11/5 11:08 + * @param tokenDto + * @param formDTO + * @return void + */ + void audit(TokenDto tokenDto, BadgeAuditFormDTO formDTO); + void testCache(); } \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/UserBadgeCertificateRecordService.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/UserBadgeCertificateRecordService.java new file mode 100644 index 0000000000..154c8685db --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/UserBadgeCertificateRecordService.java @@ -0,0 +1,95 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

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

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

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.service; + +import com.epmet.commons.mybatis.service.BaseService; +import com.epmet.commons.tools.page.PageData; +import com.epmet.dto.UserBadgeCertificateRecordDTO; +import com.epmet.entity.UserBadgeCertificateRecordEntity; + +import java.util.List; +import java.util.Map; + +/** + * 用户认证徽章记录表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-11-05 + */ +public interface UserBadgeCertificateRecordService extends BaseService { + + /** + * 默认分页 + * + * @param params + * @return PageData + * @author generator + * @date 2020-11-05 + */ + PageData page(Map params); + + /** + * 默认查询 + * + * @param params + * @return java.util.List + * @author generator + * @date 2020-11-05 + */ + List list(Map params); + + /** + * 单条查询 + * + * @param id + * @return UserBadgeCertificateRecordDTO + * @author generator + * @date 2020-11-05 + */ + UserBadgeCertificateRecordDTO get(String id); + + /** + * 默认保存 + * + * @param dto + * @return void + * @author generator + * @date 2020-11-05 + */ + void save(UserBadgeCertificateRecordDTO dto); + + /** + * 默认更新 + * + * @param dto + * @return void + * @author generator + * @date 2020-11-05 + */ + void update(UserBadgeCertificateRecordDTO dto); + + /** + * 批量删除 + * + * @param ids + * @return void + * @author generator + * @date 2020-11-05 + */ + void delete(String[] ids); +} \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/BadgeServiceImpl.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/BadgeServiceImpl.java index 21462c8b7d..4f461457f8 100644 --- 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 @@ -30,9 +30,13 @@ 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.UserBadgeCertificateRecordDTO; import com.epmet.dto.form.AddBadgeFormDTO; +import com.epmet.dto.form.BadgeAuditFormDTO; import com.epmet.dto.form.BadgeFormDTO; import com.epmet.dto.form.EditBadgeFormDTO; +import com.epmet.dto.result.BadgeAuditRecordResultDTO; +import com.epmet.dto.result.BadgeAuditingResultDTO; import com.epmet.dto.form.UserBadgeUnitFormDTO; import com.epmet.dto.result.BadgeDetailResultDTO; import com.epmet.dto.result.BadgeListResultDTO; @@ -41,6 +45,7 @@ import com.epmet.entity.BadgeEntity; import com.epmet.redis.UserBadgeRedis; import com.epmet.service.BadgeCertificationConfigService; import com.epmet.service.BadgeService; +import com.epmet.service.UserBadgeCertificateRecordService; import com.epmet.service.UserBadgeService; import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.lang3.StringUtils; @@ -48,10 +53,7 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; -import java.util.Map; +import java.util.*; /** * 徽章 @@ -65,6 +67,8 @@ public class BadgeServiceImpl extends BaseServiceImpl imp @Autowired private BadgeCertificationConfigService badgeCertificationConfigService; @Autowired + private UserBadgeCertificateRecordService userBadgeCertificateRecordService; + @Autowired private UserBadgeRedis badgeRedis; @@ -164,6 +168,9 @@ public class BadgeServiceImpl extends BaseServiceImpl imp badgeList.add(badge); }); badgeCertificationConfigService.insertBatch(badgeList); + if (BadgeConstant.ONLINE.equals(formDTO.getBadgeStatus())) { + //TODO 更新Redis + } } /** @@ -225,6 +232,9 @@ public class BadgeServiceImpl extends BaseServiceImpl imp badgeList.add(badge); }); badgeCertificationConfigService.saveConfig(tokenDto.getCustomerId(), formDTO.getBadgeId(), badgeList); + if (BadgeConstant.OFFLINE.equals(formDTO.getBadgeStatus())) { + //TODO 更新Redis + } } /** @@ -241,13 +251,83 @@ public class BadgeServiceImpl extends BaseServiceImpl imp BadgeEntity badgeEntity = baseDao.selectBadgeInfo(tokenDto.getCustomerId(), formDTO.getBadgeId()); if (null == badgeEntity) { badgeEntity = baseDao.selectBadgeInfo("default", formDTO.getBadgeId()); + if (BadgeConstant.PARTY.equals(badgeEntity.getFixationBadgeType())) { + throw new RenException(EpmetErrorCode.DUPLICATE_PARTY_BADGE_NAME.getCode()); + } badgeEntity.setCustomerId(tokenDto.getCustomerId()); badgeEntity.setDelFlag(NumConstant.ONE_STR); baseDao.insert(badgeEntity); } else { + if (BadgeConstant.PARTY.equals(badgeEntity.getFixationBadgeType())) { + throw new RenException(EpmetErrorCode.DUPLICATE_PARTY_BADGE_NAME.getCode()); + } baseDao.deleteBadge(tokenDto.getCustomerId(), formDTO.getBadgeId()); } badgeCertificationConfigService.deleteConfig(tokenDto.getCustomerId(), formDTO.getBadgeId()); + //TODO 更新Redis + } + + /** + * 待审核列表 + * + * @param tokenDto + * @param formDTO + * @return java.util.List + * @author zhaoqifeng + * @date 2020/11/5 9:50 + */ + @Override + public List auditingList(TokenDto tokenDto, BadgeFormDTO formDTO) { + int pageIndex = (formDTO.getPageNo() - NumConstant.ONE) * formDTO.getPageSize(); + List list = baseDao.selectAuditingList(tokenDto.getCustomerId(), pageIndex, formDTO.getPageSize()); + list.forEach(item -> { + item.setCreateTime(item.getCreateTime()/NumConstant.SIXTY); + }); + return list; + } + + /** + * 审核历史列表 + * + * @param tokenDto + * @param formDTO + * @return java.util.List + * @author zhaoqifeng + * @date 2020/11/5 10:59 + */ + @Override + public List auditRecord(TokenDto tokenDto, BadgeFormDTO formDTO) { + int pageIndex = (formDTO.getPageNo() - NumConstant.ONE) * formDTO.getPageSize(); + List list = baseDao.selectAuditRecord(tokenDto.getCustomerId(), pageIndex, formDTO.getPageSize()); + list.forEach(item -> { + item.setCreateTime(item.getCreateTime()/NumConstant.SIXTY); + }); + return list; + } + + /** + * 审核 + * + * @param tokenDto + * @param formDTO + * @return void + * @author zhaoqifeng + * @date 2020/11/5 11:08 + */ + @Override + public void audit(TokenDto tokenDto, BadgeAuditFormDTO formDTO) { + UserBadgeCertificateRecordDTO dto = new UserBadgeCertificateRecordDTO(); + dto.setId(formDTO.getRecordId()); + dto.setAuditStatus(formDTO.getAuditStatus()); + dto.setAuditRemark(formDTO.getAuditRemark()); + dto.setStaffId(tokenDto.getUserId()); + dto.setAuditTime(new Date()); + + userBadgeCertificateRecordService.update(dto); + + if(BadgeConstant.APPROVED.equals(formDTO.getAuditStatus())) { + //TODO 更新Redis + } } @Override diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/UserBadgeCertificateRecordServiceImpl.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/UserBadgeCertificateRecordServiceImpl.java new file mode 100644 index 0000000000..6f798abc79 --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/UserBadgeCertificateRecordServiceImpl.java @@ -0,0 +1,100 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

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

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

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; +import com.epmet.commons.tools.constant.FieldConstant; +import com.epmet.commons.tools.page.PageData; +import com.epmet.commons.tools.utils.ConvertUtils; +import com.epmet.dao.UserBadgeCertificateRecordDao; +import com.epmet.dto.UserBadgeCertificateRecordDTO; +import com.epmet.entity.UserBadgeCertificateRecordEntity; +import com.epmet.service.UserBadgeCertificateRecordService; +import org.apache.commons.lang3.StringUtils; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.util.Arrays; +import java.util.List; +import java.util.Map; + +/** + * 用户认证徽章记录表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-11-05 + */ +@Service +public class UserBadgeCertificateRecordServiceImpl extends BaseServiceImpl implements UserBadgeCertificateRecordService { + + + @Override + public PageData page(Map params) { + IPage page = baseDao.selectPage( + getPage(params, FieldConstant.CREATED_TIME, false), + getWrapper(params) + ); + return getPageData(page, UserBadgeCertificateRecordDTO.class); + } + + @Override + public List list(Map params) { + List entityList = baseDao.selectList(getWrapper(params)); + + return ConvertUtils.sourceToTarget(entityList, UserBadgeCertificateRecordDTO.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 UserBadgeCertificateRecordDTO get(String id) { + UserBadgeCertificateRecordEntity entity = baseDao.selectById(id); + return ConvertUtils.sourceToTarget(entity, UserBadgeCertificateRecordDTO.class); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void save(UserBadgeCertificateRecordDTO dto) { + UserBadgeCertificateRecordEntity entity = ConvertUtils.sourceToTarget(dto, UserBadgeCertificateRecordEntity.class); + insert(entity); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void update(UserBadgeCertificateRecordDTO dto) { + UserBadgeCertificateRecordEntity entity = ConvertUtils.sourceToTarget(dto, UserBadgeCertificateRecordEntity.class); + updateById(entity); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void delete(String[] ids) { + // 逻辑删除(@TableLogic 注解) + baseDao.deleteBatchIds(Arrays.asList(ids)); + } + +} \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/resources/mapper/BadgeDao.xml b/epmet-user/epmet-user-server/src/main/resources/mapper/BadgeDao.xml index d66bb7194a..978a9cf13b 100644 --- a/epmet-user/epmet-user-server/src/main/resources/mapper/BadgeDao.xml +++ b/epmet-user/epmet-user-server/src/main/resources/mapper/BadgeDao.xml @@ -44,7 +44,7 @@ SELECT * FROM badge a WHERE CUSTOMER_ID = 'default' AND a.DEL_FLAG = '0' AND NOT EXISTS - ( SELECT ID FROM badge b WHERE CUSTOMER_ID = #{customerId} AND a.BADGE_NAME = b.BADGE_NAME AND b.DEL_FLAG = '0')) t + ( SELECT ID FROM badge b WHERE CUSTOMER_ID = #{customerId} AND a.ID = b.ID)) t ORDER BY CREATED_TIME DESC @@ -65,7 +65,7 @@ SELECT * FROM badge a WHERE CUSTOMER_ID = 'default' AND a.DEL_FLAG = '0' AND NOT EXISTS - ( SELECT ID FROM badge b WHERE CUSTOMER_ID = #{customerId} AND a.BADGE_NAME = b.BADGE_NAME AND b.DEL_FLAG = '0' )) t) a + ( SELECT ID FROM badge b WHERE CUSTOMER_ID = #{customerId} AND a.BADGE_NAME = b.BADGE_NAME)) t) a WHERE BADGE_NAME = #{badgeName} + +