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 daa42dc9eb..de2af9b1f1 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-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/RedisUtils.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/RedisUtils.java index 27a081dacc..19d8e73374 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/RedisUtils.java +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/RedisUtils.java @@ -9,16 +9,23 @@ package com.epmet.commons.tools.redis; import com.epmet.commons.tools.constant.NumConstant; +import com.epmet.commons.tools.exception.RenException; +import com.epmet.commons.tools.utils.ConvertUtils; +import org.apache.poi.ss.formula.functions.T; +import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.data.redis.connection.lettuce.LettuceConnectionFactory; import org.springframework.data.redis.core.*; import org.springframework.data.redis.support.atomic.RedisAtomicLong; import org.springframework.stereotype.Component; +import org.springframework.util.CollectionUtils; import java.util.Collection; +import java.util.List; import java.util.Map; import java.util.Set; import java.util.concurrent.TimeUnit; +import java.util.stream.Collectors; /** * Redis工具类 @@ -171,10 +178,40 @@ public class RedisUtils { } } - public Object lindex(String key,Long index){ - return redisTemplate.opsForList().index(key,index); + public Object lindex(String key,Long index){ return redisTemplate.opsForList().index(key,index); } + public List lrange(String key,long start,long end,Class clazz){ + List content = redisTemplate.opsForList().range(key,start,end); + if(CollectionUtils.isEmpty(content)) return null; + return content.stream().map( o -> { + try { + T target = clazz.newInstance(); + BeanUtils.copyProperties(o, target); + return target; + }catch (Exception e){throw new RenException("convert error");} + }).collect(Collectors.toList()); + } + + /** + * @Description Redis lrem : + * 根据参数 count 的值,移除列表中与参数 value 相等的元素 + * COUNT 的值可以是以下几种 : + * count > 0 : 从表头开始向表尾搜索,移除与 value 相等的元素,数量为 count + * count < 0 : 从表尾开始向表头搜索,移除与 value 相等的元素,数量为 count 的绝对值 + * count = 0 : 移除表中所有与 value 相等的值 + * 返回值 : + * 被移除元素的数量 + * 列表不存在时返回 0 + * @param key + * @param count + * @param o 这里的Object需要重写equals(FIXME 注意序列化) + * @return long + * @author wangc + * @date 2020.11.05 10:22 + */ + public long lrem(String key,long count,Object o){ return redisTemplate.opsForList().remove(key,count,o);} + public Object rightPop(String key) { return redisTemplate.opsForList().rightPop(key); } diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/AgencyElementTreeResultDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/AgencyElementTreeResultDTO.java new file mode 100644 index 0000000000..90ee4f6f29 --- /dev/null +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/AgencyElementTreeResultDTO.java @@ -0,0 +1,33 @@ +package com.epmet.dto.result; + +import com.fasterxml.jackson.annotation.JsonInclude; +import lombok.Data; + +import java.io.Serializable; +import java.util.List; +import java.util.Set; + +/** + * @description: + * @author: liushaowen + * @date: 2020/11/6 13:54 + */ +@Data +public class AgencyElementTreeResultDTO implements Serializable { + private static final long serialVersionUID = 1L; + + private Set defaultKeys; + + private List list; + + @Data + public static class Agency{ + private String id; + + private String label; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + private List children; + } + +} 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 80acd68b46..b6b8f4d722 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 @@ -17,7 +17,9 @@ package com.epmet.controller; +import com.baomidou.mybatisplus.extension.api.R; import com.epmet.commons.tools.annotation.LoginUser; +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.ExcelUtils; @@ -32,12 +34,16 @@ import com.epmet.dto.form.*; import com.epmet.dto.result.*; import com.epmet.excel.CustomerAgencyExcel; import com.epmet.service.CustomerAgencyService; +import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.*; import javax.servlet.http.HttpServletResponse; +import javax.validation.constraints.NotBlank; import java.util.List; import java.util.Map; +import java.util.Set; /** @@ -243,6 +249,35 @@ public class CustomerAgencyController { return new Result().ok(customerAgencyService.staffInAgencyList(tokenDTO.getUserId())); } + /** + * @Description 对外接口,根据customerId返回Element UI中Tree结构的agency列表 + * @param customerId + * @return com.epmet.commons.tools.utils.Result + * @Author liushaowen + * @Date 2020/11/6 13:51 + */ + @PostMapping("getagencyelementtreelist") + public Result> getAgencyElementTreeList(String customerId){ + if (StringUtils.isBlank(customerId)){ + throw new RenException("customerId不能为空"); + } + return new Result>().ok(customerAgencyService.getAgencyElementTree(customerId).getList()); + } + /** + * @Description 对外接口,根据customerId返回Element UI中Tree结构的agency keys + * @param customerId + * @return com.epmet.commons.tools.utils.Result + * @Author liushaowen + * @Date 2020/11/6 13:51 + */ + @PostMapping("getagencyelementtreekeys") + public Result> getAgencyElementTreeKeys(String customerId){ + if (StringUtils.isBlank(customerId)){ + throw new RenException("customerId不能为空"); + } + return new Result>().ok(customerAgencyService.getAgencyElementTree(customerId).getDefaultKeys()); + } + /** * @Description 对外接口-根据组织Id获取组织信息 * @author sun @@ -260,4 +295,4 @@ public class CustomerAgencyController { 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 1c6f42456c..c9fbce4c09 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 @@ -176,6 +176,16 @@ public interface CustomerAgencyDao extends BaseDao { **/ AgencyResultDTO selectAgencyByStaffId(@Param("staffId") String staffId); + /** + * @Description 返回elementTree结构的agency树 + * @param customerId + * @param pid + * @return java.util.List + * @Author liushaowen + * @Date 2020/11/6 14:57 + */ + List getAgencyElementTree(@Param("customerId") String customerId,@Param("pid") String pid); + /** * @Description 外挂-获取当前组织及部门、网格数据,递归查询所有下级数据 * @author sun @@ -196,4 +206,4 @@ public interface CustomerAgencyDao extends BaseDao { * @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 9297e8f5f1..bc3e24dcfa 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 @@ -225,4 +225,13 @@ public interface CustomerAgencyService extends BaseService * @author sun **/ OrganizeTreeResultDTO organizeTree(String agencyId); -} \ No newline at end of file + + /** + * @Description 运营端-返回element ui - tree 结构agency列表 + * @param customerId + * @return com.epmet.dto.result.AgencyElementTreeResultDTO + * @Author liushaowen + * @Date 2020/11/6 14:02 + */ + AgencyElementTreeResultDTO getAgencyElementTree(String customerId); +} 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 dd3360a781..a930a7e3ef 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 @@ -1030,4 +1030,31 @@ public class CustomerAgencyServiceImpl extends BaseServiceImpl agencyList = baseDao.getAgencyElementTree(customerId, "0"); + Set defaultKeys = new HashSet<>(); + traversalAgencyList(agencyList,0,defaultKeys); + AgencyElementTreeResultDTO dto = new AgencyElementTreeResultDTO(); + dto.setList(agencyList); + dto.setDefaultKeys(defaultKeys); + return dto; + } + private void traversalAgencyList(List agencyList,int times,Set set){ + if (agencyList.size() > 0 && times < 2){ + for (AgencyElementTreeResultDTO.Agency list : agencyList) { + set.add(list.getId()); + times++; + traversalAgencyList(list.getChildren(),times,set); + } + } + } + +} diff --git a/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerAgencyDao.xml b/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerAgencyDao.xml index 300f559468..8ad4498f73 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerAgencyDao.xml +++ b/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerAgencyDao.xml @@ -373,4 +373,12 @@ - \ No newline at end of file + + + + + + + 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 da3bfca3d2..727e1ee1ae 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 @@ -64,8 +64,7 @@ public class BadgeController { @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(); + return badgeService.certificationAdd(tokenDto,certificationAddFormDTO); } /** 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 1b67df51f8..c9da1f12ed 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.commons.tools.utils.Result; import com.epmet.dto.form.OpenedOrClosedFormDTO; import com.epmet.resi.mine.dto.from.BadgeListFormDTO; import com.epmet.dto.form.CertificationAddFormDTO; @@ -39,7 +40,7 @@ public interface BadgeService { * @author zxc * @date 2020/11/4 11:16 上午 */ - void certificationAdd(TokenDto tokenDto, CertificationAddFormDTO certificationAddFormDTO); + Result certificationAdd(TokenDto tokenDto, CertificationAddFormDTO certificationAddFormDTO); /** * @Description 个人中心-取消/点亮徽章 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 4abc5853b6..53057f9492 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 @@ -86,12 +86,10 @@ public class BadgeServiceImpl implements BadgeService { * @date 2020/11/4 11:16 上午 */ @Override - public void certificationAdd(TokenDto tokenDto, CertificationAddFormDTO certificationAddFormDTO) { + public Result certificationAdd(TokenDto tokenDto, CertificationAddFormDTO certificationAddFormDTO) { certificationAddFormDTO.setUserId(tokenDto.getUserId()); Result result = epmetUserOpenFeignClient.authBadgeRecord(certificationAddFormDTO); - if (!result.success()){ - throw new RenException("提交徽章认证失败......"); - } + 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 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/ResiUserBadgeDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/ResiUserBadgeDTO.java new file mode 100644 index 0000000000..21e910101f --- /dev/null +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/ResiUserBadgeDTO.java @@ -0,0 +1,101 @@ +/** + * 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-06 + */ +@Data +public class ResiUserBadgeDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 主键ID + */ + private String id; + + /** + * 客户Id 默认配置id:default + */ + private String customerId; + + /** + * 用户注册网格ID + */ + private String gridId; + + /** + * 用户ID + */ + private String userId; + + /** + * 徽章ID + */ + private String badgeId; + + /** + * 是否开启(点亮) 1:点亮;0:未点亮 + */ + private Integer isOpened; + + /** + * 认证(审核)状态 待审核:auditing;审核通过:pass;驳回:rejected; + */ + private String certificationAutidStatus; + + /** + * 删除标识 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/UserAdviceDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/UserAdviceDTO.java index 5521fa02c4..77e6494ee6 100644 --- a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/UserAdviceDTO.java +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/UserAdviceDTO.java @@ -23,10 +23,10 @@ import lombok.Data; /** - * 用户建议 + * user_advice * * @author qu qu@elink-cn.com - * @since v1.0.0 2020-11-04 + * @since v1.0.0 2020-11-06 */ @Data public class UserAdviceDTO implements Serializable { @@ -43,18 +43,53 @@ public class UserAdviceDTO implements Serializable { */ private String customerId; + /** + * 客户名 + */ + private String customerName; + + /** + * 组织ID + */ + private String agencyId; + + /** + * 组织名 + */ + private String agencyName; + + /** + * 网格ID + */ + private String gridId; + + /** + * 网格名 + */ + private String gridName; + /** * userid */ private String userId; + /** + * 用户姓名 + */ + private String userName; + + /** + * 用户注册手机号 + */ + private String regPhone; + /** * 建议描述 */ private String adviceContent; /** - * 手机号 + * 填写手机号 */ private String phone; @@ -69,15 +104,25 @@ public class UserAdviceDTO implements Serializable { private String replyContent; /** - * 回复人 + * 回复人id */ - private String replyUser; + private String replyUserId; + + /** + * 回复人姓名 + */ + private String replyUserName; /** * 回复时间 */ private Date replyTime; + /** + * 政府存证文字 + */ + private String govContent; + /** * 删除标志 */ 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/form/CertificationAddFormDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/CertificationAddFormDTO.java index 76583e9559..ee9a71d7fc 100644 --- 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 @@ -37,7 +37,7 @@ public class CertificationAddFormDTO implements Serializable { /** * 姓 */ - private String subName; + private String surname; /** * 名 @@ -52,7 +52,7 @@ public class CertificationAddFormDTO implements Serializable { /** * 认证证件图片url */ - private String certificate; + private String certificationImg; /** * 认证说明 diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/OperAdviceListFormDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/OperAdviceListFormDTO.java new file mode 100644 index 0000000000..e4c046e53c --- /dev/null +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/OperAdviceListFormDTO.java @@ -0,0 +1,33 @@ +package com.epmet.dto.form; + +import lombok.Data; + +import javax.validation.constraints.Min; +import java.io.Serializable; + +/** + * @description: + * @author: liushaowen + * @date: 2020/11/5 17:25 + */ +@Data +public class OperAdviceListFormDTO implements Serializable { + private static final long serialVersionUID = 1L; + + private String customerId; + + private String isReply; + + private String adviceType; + + private String startTime; + + private String endTime; + + @Min(1) + private Integer pageNo; + + @Min(1) + private Integer pageSize; + +} diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/ReplyAdviceFormDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/ReplyAdviceFormDTO.java new file mode 100644 index 0000000000..f353919247 --- /dev/null +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/ReplyAdviceFormDTO.java @@ -0,0 +1,27 @@ +package com.epmet.dto.form; + +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import java.io.Serializable; +import java.util.List; + +/** + * @description:回复建议FormDTO + * @author: liushaowen + * @date: 2020/11/6 10:37 + */ +@Data +public class ReplyAdviceFormDTO implements Serializable { + private static final long serialVersionUID = 1L; + + @NotBlank(message = "adviceId不能为空") + private String adviceId; + + @NotBlank(message = "回复内容不能为空") + private String replyContent; + + private List govImgList; + + private String govContent; +} diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/UserBadgeUnitFormDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/UserBadgeUnitFormDTO.java new file mode 100644 index 0000000000..406f527bb9 --- /dev/null +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/UserBadgeUnitFormDTO.java @@ -0,0 +1,48 @@ +package com.epmet.dto.form; + +import lombok.Data; + +import java.io.Serializable; +import java.util.Objects; + +/** + * @Description 用户-徽章缓存单元 + * @ClassName UserBadgeUnitFormDTO + * @Auth wangc + * @Date 2020-11-05 10:00 + */ +@Data +public class UserBadgeUnitFormDTO implements Serializable { + private static final long serialVersionUID = -4497394865738168850L; + + /** + * 徽章Id + */ + private String badgeId; + + /** + * 徽章图标 url + */ + private String badgeIcon; + + /** + * 徽章名称 + */ + private String badgeName; + + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + UserBadgeUnitFormDTO that = (UserBadgeUnitFormDTO) o; + return badgeId.equals(that.badgeId) && + badgeIcon.equals(that.badgeIcon) && + badgeName.equals(that.badgeName); + } + + @Override + public int hashCode() { + return Objects.hash(badgeId, badgeIcon, badgeName); + } +} diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/AdviceDetailResultDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/AdviceDetailResultDTO.java new file mode 100644 index 0000000000..462f053373 --- /dev/null +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/AdviceDetailResultDTO.java @@ -0,0 +1,55 @@ +package com.epmet.dto.result; + +import lombok.Data; + +import java.io.Serializable; +import java.util.List; + +/** + * @description: + * @author: liushaowen + * @date: 2020/11/5 17:37 + */ +@Data +public class AdviceDetailResultDTO implements Serializable { + private static final long serialVersionUID = 1L; + /** + * 建议id + */ + private String adviceId; + + /** + * 建议内容 + */ + private String adviceContent; + + /** + * 电话 + */ + private String phone; + + /** + * 建议时间 + */ + private String adviceTime; + + /** + * 回复内容 + */ + private String replyContent; + + /** + * 回复时间 + */ + private String replyTime; + + /** + * 回复人 + */ + private String replyUser; + + /** + * 建议图片列表 + */ + private List imgList; +} 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-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 index 2120fe7fb0..cc17374704 100644 --- 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 @@ -26,7 +26,7 @@ public class CertificationDetailResultDTO implements Serializable { /** * 身份证号 */ - private String idNum; + private String idCard; /** * 是否认证 yes 认证 no 已认证 diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/OperAdviceListResultDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/OperAdviceListResultDTO.java new file mode 100644 index 0000000000..82f5aba850 --- /dev/null +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/OperAdviceListResultDTO.java @@ -0,0 +1,44 @@ +package com.epmet.dto.result; + +import lombok.Data; + +import java.io.Serializable; + +/** + * @description: + * @author: liushaowen + * @date: 2020/11/5 17:26 + */ +@Data +public class OperAdviceListResultDTO implements Serializable { + private static final long serialVersionUID = 1L; + /** + * 客户名 + */ + private String customerName; + + /** + * 建议id + */ + private String adviceId; + + /** + * 是否回复 0否1是 + */ + private String isReply; + + /** + * 回复内容 + */ + private String adviceContent; + + /** + * 手机 空为* + */ + private String phone; + + /** + * 建议类型 空为* + */ + private String adviceType; +} diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/constant/UserRedisKeys.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/constant/UserRedisKeys.java index f4fffb6975..46f5ad1fa2 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/constant/UserRedisKeys.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/constant/UserRedisKeys.java @@ -23,4 +23,14 @@ public class UserRedisKeys { public static String getResiUserKey(String userId){ return rootPrefix.concat("resi:user:").concat(userId); } + + /** + * @Description 用户勋章缓存 epmet:badge:user:[customerId]:[userId] + * @param userId + * @return epmet:badge:user:[customerId]:[userId] + * @author wangc + * @date 2020.11.05 13:34 + */ + public static String getResiUserBadgeKey(String customerId,String userId){ + return rootPrefix.concat("badge:user:").concat(customerId).concat(":").concat(userId);} } 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 92a2621013..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; @@ -100,5 +103,51 @@ public class BadgeController { return new Result(); } + @PostMapping("test-cache") + public Result testCache(){ + 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/controller/UserAdviceController.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/UserAdviceController.java index 8237057e85..de9e8b00c6 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/UserAdviceController.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/UserAdviceController.java @@ -18,6 +18,7 @@ package com.epmet.controller; import com.epmet.commons.tools.page.PageData; +import com.epmet.commons.tools.security.user.LoginUserUtil; import com.epmet.commons.tools.utils.ExcelUtils; import com.epmet.commons.tools.utils.Result; import com.epmet.commons.tools.validator.AssertUtils; @@ -26,6 +27,7 @@ import com.epmet.commons.tools.validator.group.AddGroup; import com.epmet.commons.tools.validator.group.UpdateGroup; import com.epmet.commons.tools.validator.group.DefaultGroup; import com.epmet.dto.UserAdviceDTO; +import com.epmet.dto.form.ReplyAdviceFormDTO; import com.epmet.excel.UserAdviceExcel; import com.epmet.service.UserAdviceService; import org.springframework.beans.factory.annotation.Autowired; @@ -37,18 +39,21 @@ import java.util.Map; /** - * 用户建议 + * user_advice * * @author qu qu@elink-cn.com - * @since v1.0.0 2020-11-04 + * @since v1.0.0 2020-11-06 */ @RestController @RequestMapping("useradvice") public class UserAdviceController { - + @Autowired private UserAdviceService userAdviceService; + @Autowired + private LoginUserUtil loginUserUtil; + @GetMapping("page") public Result> page(@RequestParam Map params){ PageData page = userAdviceService.page(params); @@ -91,4 +96,10 @@ public class UserAdviceController { ExcelUtils.exportExcelToTarget(response, null, list, UserAdviceExcel.class); } -} \ No newline at end of file + @PostMapping("replyadvice") + public Result replyAdvice(ReplyAdviceFormDTO dto){ + ValidatorUtils.validateEntity(dto); + userAdviceService.replyAdvice(dto,loginUserUtil.getLoginUserId()); + return new Result(); + } +} 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 c0aa74d53e..a901d9202f 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 @@ -59,8 +59,7 @@ public class UserBadgeController { */ @PostMapping("authbadgerecord") public Result authBadgeRecord(@RequestBody CertificationAddFormDTO certificationAddFormDTO){ - userBadgeService.authBadgeRecord(certificationAddFormDTO); - return new Result(); + return userBadgeService.authBadgeRecord(certificationAddFormDTO); } /** 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 965f753b6e..e20fd8a523 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,8 +18,12 @@ package com.epmet.dao; import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.dto.BadgeDTO; +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; import com.epmet.entity.BadgeEntity; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; @@ -105,4 +109,47 @@ public interface BadgeDao extends BaseDao { * @return void */ 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 + * @return java.util.List + * @author wangc + * @date 2020.11.05 15:50 + */ + List selectCustomerBadgePool(@Param("customerId") String customerId); + + /** + * 插入数据 + * @author zhaoqifeng + * @date 2020/11/6 14:46 + * @param entity + * @return void + */ + void insertBadge(BadgeDTO dto); } \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/ResiUserBadgeDao.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/ResiUserBadgeDao.java new file mode 100644 index 0000000000..0448b16cee --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/ResiUserBadgeDao.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.ResiUserBadgeEntity; +import org.apache.ibatis.annotations.Mapper; + +/** + * 用户徽章关系表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-11-06 + */ +@Mapper +public interface ResiUserBadgeDao extends BaseDao { + +} \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/UserAdviceDao.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/UserAdviceDao.java index 6ee2c40017..e198ef4b82 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/UserAdviceDao.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/UserAdviceDao.java @@ -20,14 +20,18 @@ package com.epmet.dao; import com.epmet.commons.mybatis.dao.BaseDao; import com.epmet.entity.UserAdviceEntity; import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; /** - * 用户建议 + * user_advice * * @author qu qu@elink-cn.com - * @since v1.0.0 2020-11-04 + * @since v1.0.0 2020-11-06 */ @Mapper public interface UserAdviceDao extends BaseDao { - -} \ No newline at end of file + void replyAdvice(@Param("adviceId") String adviceId, + @Param("replyContent") String replyContent, + @Param("govContent") String govContent, + @Param("replyUserId") String loginUserId); +} 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/ResiUserBadgeEntity.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/ResiUserBadgeEntity.java new file mode 100644 index 0000000000..4087df8fc6 --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/ResiUserBadgeEntity.java @@ -0,0 +1,71 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

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

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

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.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-06 + */ +@Data +@EqualsAndHashCode(callSuper=false) +@TableName("resi_user_badge") +public class ResiUserBadgeEntity extends BaseEpmetEntity { + + private static final long serialVersionUID = 1L; + + /** + * 客户Id 默认配置id:default + */ + private String customerId; + + /** + * 用户注册网格ID + */ + private String gridId; + + /** + * 用户ID + */ + private String userId; + + /** + * 徽章ID + */ + private String badgeId; + + /** + * 是否开启(点亮) 1:点亮;0:未点亮 + */ + private Integer isOpened; + + /** + * 认证(审核)状态 待审核:auditing;审核通过:pass;驳回:rejected; + */ + private String certificationAutidStatus; + +} diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/UserAdviceEntity.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/UserAdviceEntity.java index dcf168cc2d..78c246fa15 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/UserAdviceEntity.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/UserAdviceEntity.java @@ -19,7 +19,6 @@ package com.epmet.entity; import com.baomidou.mybatisplus.annotation.TableName; - import com.epmet.commons.mybatis.entity.BaseEpmetEntity; import lombok.Data; import lombok.EqualsAndHashCode; @@ -27,10 +26,10 @@ import lombok.EqualsAndHashCode; import java.util.Date; /** - * 用户建议 + * user_advice * * @author qu qu@elink-cn.com - * @since v1.0.0 2020-11-04 + * @since v1.0.0 2020-11-06 */ @Data @EqualsAndHashCode(callSuper=false) @@ -44,18 +43,53 @@ public class UserAdviceEntity extends BaseEpmetEntity { */ private String customerId; + /** + * 客户名 + */ + private String customerName; + + /** + * 组织ID + */ + private String agencyId; + + /** + * 组织名 + */ + private String agencyName; + + /** + * 网格ID + */ + private String gridId; + + /** + * 网格名 + */ + private String gridName; + /** * userid */ private String userId; + /** + * 用户姓名 + */ + private String userName; + + /** + * 用户注册手机号 + */ + private String regPhone; + /** * 建议描述 */ private String adviceContent; /** - * 手机号 + * 填写手机号 */ private String phone; @@ -70,13 +104,23 @@ public class UserAdviceEntity extends BaseEpmetEntity { private String replyContent; /** - * 回复人 + * 回复人id + */ + private String replyUserId; + + /** + * 回复人姓名 */ - private String replyUser; + private String replyUserName; /** * 回复时间 */ private Date replyTime; + /** + * 政府存证文字 + */ + private String govContent; + } 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/excel/UserAdviceExcel.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/excel/UserAdviceExcel.java index 31581f4373..9e93cb6bfc 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/excel/UserAdviceExcel.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/excel/UserAdviceExcel.java @@ -23,10 +23,10 @@ import lombok.Data; import java.util.Date; /** - * 用户建议 + * user_advice * * @author qu qu@elink-cn.com - * @since v1.0.0 2020-11-04 + * @since v1.0.0 2020-11-06 */ @Data public class UserAdviceExcel { @@ -37,13 +37,34 @@ public class UserAdviceExcel { @Excel(name = "客户ID") private String customerId; + @Excel(name = "客户名") + private String customerName; + + @Excel(name = "组织ID") + private String agencyId; + + @Excel(name = "组织名") + private String agencyName; + + @Excel(name = "网格ID") + private String gridId; + + @Excel(name = "网格名") + private String gridName; + @Excel(name = "userid") private String userId; + @Excel(name = "用户姓名") + private String userName; + + @Excel(name = "用户注册手机号") + private String regPhone; + @Excel(name = "建议描述") private String adviceContent; - @Excel(name = "手机号") + @Excel(name = "填写手机号") private String phone; @Excel(name = "问题分类(gov政府software软件,逗号分隔)") @@ -52,12 +73,18 @@ public class UserAdviceExcel { @Excel(name = "回复内容") private String replyContent; - @Excel(name = "回复人") - private String replyUser; + @Excel(name = "回复人id") + private String replyUserId; + + @Excel(name = "回复人姓名") + private String replyUserName; @Excel(name = "回复时间") private Date replyTime; + @Excel(name = "政府存证文字") + private String govContent; + @Excel(name = "删除标志") private String delFlag; diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/redis/UserAdviceRedis.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/redis/UserAdviceRedis.java index ab047022e7..d35e8427b9 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/redis/UserAdviceRedis.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/redis/UserAdviceRedis.java @@ -22,10 +22,10 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; /** - * 用户建议 + * user_advice * * @author qu qu@elink-cn.com - * @since v1.0.0 2020-11-04 + * @since v1.0.0 2020-11-06 */ @Component public class UserAdviceRedis { 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 c9eaee4367..0b57fcbb9f 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,13 +1,25 @@ package com.epmet.redis; + + import com.alibaba.fastjson.JSON; +import com.epmet.commons.tools.constant.NumConstant; import com.epmet.commons.tools.redis.RedisUtils; +import com.epmet.commons.tools.utils.ConvertUtils; import com.epmet.constant.BadgeConstant; +import com.epmet.constant.UserRedisKeys; +import com.epmet.dao.BadgeDao; +import com.epmet.dto.form.UserBadgeUnitFormDTO; import com.epmet.dto.result.UserBadgeListResultDTO; +import com.epmet.service.UserBadgeService; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.collections4.CollectionUtils; +import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; import java.util.List; +import java.util.Optional; import static com.epmet.commons.tools.redis.RedisUtils.MINUTE_THIRTY_EXPIRE; @@ -16,45 +28,50 @@ import static com.epmet.commons.tools.redis.RedisUtils.MINUTE_THIRTY_EXPIRE; * @DateTime 2020/11/3 2:21 下午 */ @Component +@Slf4j public class UserBadgeRedis { @Autowired private RedisUtils redisUtils; + @Autowired + private BadgeDao badgeDao; + @Autowired + private UserBadgeService badgeService; /** - * @Description 获取客户徽章信息 + * @Description 获取客户徽章信息 * @Param customerId * @author zxc * @date 2020/11/3 2:50 下午 */ - public Object getCustomerBadge(String customerId){ + public Object getCustomerBadge(String customerId) { Object userBadge = redisUtils.hGet(BadgeConstant.BADGE_KEY + customerId, BadgeConstant.BADGE); return userBadge; } /** - * @Description 存放客户徽章信息 + * @Description 存放客户徽章信息 * @Param userBadge * @Param customerId * @author zxc * @date 2020/11/3 2:51 下午 */ - public void setCustomerBadge(List userBadge, String customerId){ - redisUtils.hSet(BadgeConstant.BADGE_KEY+customerId,BadgeConstant.BADGE, JSON.toJSON(userBadge).toString(),-1); + public void setCustomerBadge(List userBadge, String customerId) { + redisUtils.hSet(BadgeConstant.BADGE_KEY + customerId, BadgeConstant.BADGE, JSON.toJSON(userBadge).toString(), -1); } /** - * @Description 删除客户徽章信息 + * @Description 删除客户徽章信息 * @Param customerId * @author zxc * @date 2020/11/5 3:06 下午 */ - public void delCustomerBadge(String customerId){ - redisUtils.hDel(BadgeConstant.BADGE_KEY+customerId,BadgeConstant.BADGE); + public void delCustomerBadge(String customerId) { + redisUtils.hDel(BadgeConstant.BADGE_KEY + customerId, BadgeConstant.BADGE); } /** - * @Description 存放徽章审核 手机验证码 + * @Description 存放徽章审核 手机验证码 * @Param mobile * @author zxc * @date 2020/11/5 10:30 上午 @@ -65,7 +82,7 @@ public class UserBadgeRedis { } /** - * @Description 获取徽章审核 手机验证码 + * @Description 获取徽章审核 手机验证码 * @Param mobile * @author zxc * @date 2020/11/5 10:30 上午 @@ -76,4 +93,58 @@ public class UserBadgeRedis { return smsCode; } -} + /** + * @param userId + * @return java.util.List + * @Description 获取用户的全部勋章信息(点亮的 、 排序从前到后) + * @author wangc + * @date 2020.11.05 13:26 + */ + public List obtainUserBadge2List(String userId,String customerId) { + //TODO 补偿 + return redisUtils.lrange(UserRedisKeys.getResiUserBadgeKey(customerId,userId), NumConstant.ZERO, NumConstant.ONE_NEG, UserBadgeUnitFormDTO.class); + } + + /** + * 用户点亮或取消徽章 + * @param + * @return int + * @Description 入栈时使用lpush 出栈时使用lrem + * @author wangc + * @date 2020.11.05 13:37 + */ + public long pushOrRemoveUserBadge4List(String userId, String badgeId, String customerId) { + List orient = obtainUserBadge2List(userId,customerId); + UserBadgeUnitFormDTO unit = null; + + if (!CollectionUtils.isEmpty(orient)) { + Optional opt = orient.stream().filter(badge -> StringUtils.equals(badgeId, badge.getBadgeId())).findFirst(); + if (opt.isPresent()) { + unit = opt.get(); + return redisUtils.lrem(UserRedisKeys.getResiUserBadgeKey(customerId, userId), NumConstant.ONE, unit); + } + } + + //徽章池 + Object badgeObj = getCustomerBadge(customerId); + + List badgePool = + null == badgeObj ? badgeDao.selectCustomerBadgePool(customerId) : JSON.parseArray(badgeObj.toString(), UserBadgeListResultDTO.class); + + if (CollectionUtils.isEmpty(badgePool)) { + log.error("com.epmet.redis.UserBadgeRedis.pushOrRemoveUserBadge4List,缓存中客户{}下的徽章池为空", customerId); + return NumConstant.ZERO; + } + + if (null == unit) { + Optional poolOpt = + badgePool.stream().filter(badge -> StringUtils.equals(badge.getBadgeId(), badgeId)).findFirst(); + if (poolOpt.isPresent()) unit = ConvertUtils.sourceToTarget(poolOpt.get(), UserBadgeUnitFormDTO.class); + else return NumConstant.ZERO; + } + redisUtils.leftPush(UserRedisKeys.getResiUserBadgeKey(customerId, userId), unit); + return NumConstant.ONE; + } + + } + 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 7b73e28561..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; @@ -147,4 +150,36 @@ public interface BadgeService extends BaseService { * @return void */ 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/ResiUserBadgeService.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/ResiUserBadgeService.java new file mode 100644 index 0000000000..b858776d51 --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/ResiUserBadgeService.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.ResiUserBadgeDTO; +import com.epmet.entity.ResiUserBadgeEntity; + +import java.util.List; +import java.util.Map; + +/** + * 用户徽章关系表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-11-06 + */ +public interface ResiUserBadgeService extends BaseService { + + /** + * 默认分页 + * + * @param params + * @return PageData + * @author generator + * @date 2020-11-06 + */ + PageData page(Map params); + + /** + * 默认查询 + * + * @param params + * @return java.util.List + * @author generator + * @date 2020-11-06 + */ + List list(Map params); + + /** + * 单条查询 + * + * @param id + * @return ResiUserBadgeDTO + * @author generator + * @date 2020-11-06 + */ + ResiUserBadgeDTO get(String id); + + /** + * 默认保存 + * + * @param dto + * @return void + * @author generator + * @date 2020-11-06 + */ + void save(ResiUserBadgeDTO dto); + + /** + * 默认更新 + * + * @param dto + * @return void + * @author generator + * @date 2020-11-06 + */ + void update(ResiUserBadgeDTO dto); + + /** + * 批量删除 + * + * @param ids + * @return void + * @author generator + * @date 2020-11-06 + */ + void delete(String[] ids); +} \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/UserAdviceService.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/UserAdviceService.java index 4e42bc095e..f13d6f9eda 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/UserAdviceService.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/UserAdviceService.java @@ -20,16 +20,17 @@ package com.epmet.service; import com.epmet.commons.mybatis.service.BaseService; import com.epmet.commons.tools.page.PageData; import com.epmet.dto.UserAdviceDTO; +import com.epmet.dto.form.ReplyAdviceFormDTO; import com.epmet.entity.UserAdviceEntity; import java.util.List; import java.util.Map; /** - * 用户建议 + * user_advice * * @author qu qu@elink-cn.com - * @since v1.0.0 2020-11-04 + * @since v1.0.0 2020-11-06 */ public interface UserAdviceService extends BaseService { @@ -39,7 +40,7 @@ public interface UserAdviceService extends BaseService { * @param params * @return PageData * @author generator - * @date 2020-11-04 + * @date 2020-11-06 */ PageData page(Map params); @@ -49,7 +50,7 @@ public interface UserAdviceService extends BaseService { * @param params * @return java.util.List * @author generator - * @date 2020-11-04 + * @date 2020-11-06 */ List list(Map params); @@ -59,7 +60,7 @@ public interface UserAdviceService extends BaseService { * @param id * @return UserAdviceDTO * @author generator - * @date 2020-11-04 + * @date 2020-11-06 */ UserAdviceDTO get(String id); @@ -69,7 +70,7 @@ public interface UserAdviceService extends BaseService { * @param dto * @return void * @author generator - * @date 2020-11-04 + * @date 2020-11-06 */ void save(UserAdviceDTO dto); @@ -79,7 +80,7 @@ public interface UserAdviceService extends BaseService { * @param dto * @return void * @author generator - * @date 2020-11-04 + * @date 2020-11-06 */ void update(UserAdviceDTO dto); @@ -89,7 +90,17 @@ public interface UserAdviceService extends BaseService { * @param ids * @return void * @author generator - * @date 2020-11-04 + * @date 2020-11-06 */ void delete(String[] ids); -} \ No newline at end of file + + /** + * @Description 回复建议 + * @param dto + * @param loginUserId + * @return void + * @Author liushaowen + * @Date 2020/11/6 16:44 + */ + void replyAdvice(ReplyAdviceFormDTO dto, String loginUserId); +} 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 021b0c734a..89c6b72a75 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,25 +30,24 @@ 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.ResiUserBadgeDTO; +import com.epmet.dto.UserBadgeCertificateRecordDTO; +import com.epmet.dto.form.*; +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.BadgeCertificationConfigEntity; import com.epmet.entity.BadgeEntity; -import com.epmet.service.BadgeCertificationConfigService; -import com.epmet.service.BadgeService; +import com.epmet.redis.UserBadgeRedis; +import com.epmet.service.*; 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; +import java.util.*; /** * 徽章 @@ -61,6 +60,14 @@ public class BadgeServiceImpl extends BaseServiceImpl imp @Autowired private BadgeCertificationConfigService badgeCertificationConfigService; + @Autowired + private UserBadgeCertificateRecordService userBadgeCertificateRecordService; + @Autowired + private UserBadgeRedis badgeRedis; + @Autowired + private UserBadgeService userBadgeService; + @Autowired + private ResiUserBadgeService resiUserBadgeService; @Override @@ -118,7 +125,7 @@ public class BadgeServiceImpl extends BaseServiceImpl imp /** * 获取徽章列表 * - * @param customerId + * @param customerId 客户ID * @return java.util.List * @author zhaoqifeng * @date 2020/11/3 17:04 @@ -131,8 +138,8 @@ public class BadgeServiceImpl extends BaseServiceImpl imp /** * 添加徽章 * - * @param tokenDto - * @param formDTO + * @param tokenDto token + * @param formDTO 入参 * @return void * @author zhaoqifeng * @date 2020/11/4 10:09 @@ -159,13 +166,17 @@ public class BadgeServiceImpl extends BaseServiceImpl imp badgeList.add(badge); }); badgeCertificationConfigService.insertBatch(badgeList); + //更新Redis + if (BadgeConstant.ONLINE.equals(formDTO.getBadgeStatus())) { + userBadgeService.reloadCustomerBadge(tokenDto.getCustomerId()); + } } /** * 徽章详情 * - * @param tokenDto - * @param formDTO + * @param tokenDto token + * @param formDTO 入参 * @return com.epmet.dto.result.BadgeDetailResultDTO * @author zhaoqifeng * @date 2020/11/4 14:25 @@ -181,8 +192,8 @@ public class BadgeServiceImpl extends BaseServiceImpl imp /** * 编辑徽章 * - * @param tokenDto - * @param formDTO + * @param tokenDto token + * @param formDTO 入参 * @return void * @author zhaoqifeng * @date 2020/11/4 14:28 @@ -220,13 +231,15 @@ public class BadgeServiceImpl extends BaseServiceImpl imp badgeList.add(badge); }); badgeCertificationConfigService.saveConfig(tokenDto.getCustomerId(), formDTO.getBadgeId(), badgeList); + //更新Redis + userBadgeService.reloadCustomerBadge(tokenDto.getCustomerId()); } /** * 删除徽章 * - * @param tokenDto - * @param formDTO + * @param tokenDto token + * @param formDTO 入参 * @return void * @author zhaoqifeng * @date 2020/11/4 15:34 @@ -236,13 +249,105 @@ public class BadgeServiceImpl extends BaseServiceImpl imp 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); + if (BadgeConstant.PARTY.equals(badgeEntity.getFixationBadgeType())) { + throw new RenException(EpmetErrorCode.DUPLICATE_PARTY_BADGE_NAME.getCode()); + } + BadgeDTO badgeDTO = ConvertUtils.sourceToTarget(badgeEntity, BadgeDTO.class); + badgeDTO.setCustomerId(tokenDto.getCustomerId()); + badgeDTO.setDelFlag(NumConstant.ONE_STR); + badgeDTO.setCreatedBy(tokenDto.getUserId()); + badgeDTO.setCreatedTime(new Date()); + badgeDTO.setUpdatedBy(tokenDto.getUserId()); + badgeDTO.setUpdatedTime(new Date()); + baseDao.insertBadge(badgeDTO); } 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()); + //更新Redis + userBadgeService.reloadCustomerBadge(tokenDto.getCustomerId()); + } + + /** + * 待审核列表 + * + * @param tokenDto token + * @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 token + * @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 token + * @param formDTO 入参 + * @return void + * @author zhaoqifeng + * @date 2020/11/5 11:08 + */ + @Override + public void audit(TokenDto tokenDto, BadgeAuditFormDTO formDTO) { + UserBadgeCertificateRecordDTO dto = userBadgeCertificateRecordService.get(formDTO.getRecordId()); + dto.setAuditStatus(formDTO.getAuditStatus()); + dto.setAuditRemark(formDTO.getAuditRemark()); + dto.setStaffId(tokenDto.getUserId()); + dto.setAuditTime(new Date()); + + userBadgeCertificateRecordService.update(dto); + + ResiUserBadgeDTO resiUserBadgeDTO = new ResiUserBadgeDTO(); + resiUserBadgeDTO.setCustomerId(dto.getCustomerId()); + resiUserBadgeDTO.setBadgeId(dto.getBadgeId()); + resiUserBadgeDTO.setGridId(dto.getGridId()); + resiUserBadgeDTO.setUserId(dto.getUserId()); + resiUserBadgeDTO.setIsOpened(NumConstant.ZERO); + resiUserBadgeDTO.setCertificationAutidStatus(dto.getAuditStatus()); + resiUserBadgeService.save(resiUserBadgeDTO); + + if(BadgeConstant.APPROVED.equals(formDTO.getAuditStatus())) { + //更新Redis + OpenedOrClosedFormDTO openedOrClosedFormDTO = new OpenedOrClosedFormDTO(); + openedOrClosedFormDTO.setCustomerId(dto.getCustomerId()); + openedOrClosedFormDTO.setUserId(dto.getUserId()); + openedOrClosedFormDTO.setBadgeId(dto.getBadgeId()); + userBadgeService.openedOrClosed(openedOrClosedFormDTO); + } + } + + @Override + public void testCache() { + badgeRedis.pushOrRemoveUserBadge4List("test-wc","1","45687aa479955f9d06204d415238f7cc"); + List cache = badgeRedis.obtainUserBadge2List("test-wc","45687aa479955f9d06204d415238f7cc"); + System.out.println(cache); } } \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/ResiUserBadgeServiceImpl.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/ResiUserBadgeServiceImpl.java new file mode 100644 index 0000000000..7c0730af71 --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/ResiUserBadgeServiceImpl.java @@ -0,0 +1,101 @@ +/** + * 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.ResiUserBadgeDao; +import com.epmet.dto.ResiUserBadgeDTO; +import com.epmet.entity.ResiUserBadgeEntity; +import com.epmet.service.ResiUserBadgeService; +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-06 + */ +@Service +public class ResiUserBadgeServiceImpl extends BaseServiceImpl implements ResiUserBadgeService { + + + @Override + public PageData page(Map params) { + IPage page = baseDao.selectPage( + getPage(params, FieldConstant.CREATED_TIME, false), + getWrapper(params) + ); + return getPageData(page, ResiUserBadgeDTO.class); + } + + @Override + public List list(Map params) { + List entityList = baseDao.selectList(getWrapper(params)); + + return ConvertUtils.sourceToTarget(entityList, ResiUserBadgeDTO.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 ResiUserBadgeDTO get(String id) { + ResiUserBadgeEntity entity = baseDao.selectById(id); + return ConvertUtils.sourceToTarget(entity, ResiUserBadgeDTO.class); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void save(ResiUserBadgeDTO dto) { + ResiUserBadgeEntity entity = ConvertUtils.sourceToTarget(dto, ResiUserBadgeEntity.class); + insert(entity); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void update(ResiUserBadgeDTO dto) { + ResiUserBadgeEntity entity = ConvertUtils.sourceToTarget(dto, ResiUserBadgeEntity.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/java/com/epmet/service/impl/UserAdviceServiceImpl.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/UserAdviceServiceImpl.java index 41e1465a41..ceae0d177c 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/UserAdviceServiceImpl.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/UserAdviceServiceImpl.java @@ -25,6 +25,7 @@ import com.epmet.commons.tools.utils.ConvertUtils; import com.epmet.commons.tools.constant.FieldConstant; import com.epmet.dao.UserAdviceDao; import com.epmet.dto.UserAdviceDTO; +import com.epmet.dto.form.ReplyAdviceFormDTO; import com.epmet.entity.UserAdviceEntity; import com.epmet.redis.UserAdviceRedis; import com.epmet.service.UserAdviceService; @@ -38,10 +39,10 @@ import java.util.List; import java.util.Map; /** - * 用户建议 + * user_advice * * @author qu qu@elink-cn.com - * @since v1.0.0 2020-11-04 + * @since v1.0.0 2020-11-06 */ @Service public class UserAdviceServiceImpl extends BaseServiceImpl implements UserAdviceService { @@ -101,4 +102,16 @@ public class UserAdviceServiceImpl extends BaseServiceImpl + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

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

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; +import com.epmet.commons.tools.constant.FieldConstant; +import com.epmet.commons.tools.page.PageData; +import com.epmet.commons.tools.utils.ConvertUtils; +import com.epmet.dao.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/java/com/epmet/service/impl/UserBadgeServiceImpl.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/UserBadgeServiceImpl.java index 986d9eed7f..2f3f51ed86 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 @@ -148,8 +148,8 @@ public class UserBadgeServiceImpl implements UserBadgeService { 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()); + form.setCertificationImg(certificationAddFormDTO.getCertificationImg()); + form.setSurname(certificationAddFormDTO.getSurname()); userBadgeDao.insertUserBadgeCertificateRecord(form); return new Result(); } @@ -218,8 +218,9 @@ public class UserBadgeServiceImpl implements UserBadgeService { */ @Override @Transactional(rollbackFor = Exception.class) - public void openedOrClosed(OpenedOrClosedFormDTO openedOrClosedFormDTO) { - userBadgeDao.updateIsOpen(openedOrClosedFormDTO); + public void openedOrClosed(OpenedOrClosedFormDTO form) { + userBadgeDao.updateIsOpen(form); + userBadgeRedis.pushOrRemoveUserBadge4List(form.getUserId(),form.getBadgeId(),form.getCustomerId()); } /** @@ -239,15 +240,18 @@ public class UserBadgeServiceImpl implements UserBadgeService { List badgeByCustomer = groupByCustomer.get(customerId); if (!CollectionUtils.isEmpty(badgeByCustomer)) { resultUserBadge.forEach(r -> { - badgeByCustomer.forEach(b -> { - if (r.getBadgeId().equals(b.getBadgeId())) { - BeanUtils.copyProperties(b, r); + for (int i = NumConstant.ZERO; i < badgeByCustomer.size(); i++) { + if (r.getBadgeId().equals(badgeByCustomer.get(i).getBadgeId())) { + BeanUtils.copyProperties(badgeByCustomer.get(i), r); + badgeByCustomer.remove(badgeByCustomer.get(i)); } - }); + } }); + resultUserBadge.addAll(badgeByCustomer); } userBadgeRedis.setCustomerBadge(resultUserBadge, customerId); } + userBadgeRedis.setCustomerBadge(userBadgeListResultDTOS, customerId); } } 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 322604bc70..91267d3a5b 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 @@ -17,6 +17,35 @@ + + INSERT INTO badge + (`ID`, + `CUSTOMER_ID`, + `BADGE_NAME`, + `BADGE_ICON`, + `FIXATION_BADGE_TYPE`, + `BADGE_STATUS`, + `DEL_FLAG`, + `REVISION`, + `CREATED_BY`, + `CREATED_TIME`, + `UPDATED_BY`, + `UPDATED_TIME`) + VALUES + (#{id}, + #{customerId}, + #{badgeName}, + #{badgeIcon}, + #{fixationBadgeType}, + #{badgeStatus}, + #{delFlag}, + #{revision}, + #{createdBy}, + #{createdTime}, + #{updatedBy}, + #{updatedTime}); + + update badge set BADGE_NAME = #{badgeName}, @@ -44,7 +73,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 +94,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} + + + + + \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/resources/mapper/ResiUserBadgeDao.xml b/epmet-user/epmet-user-server/src/main/resources/mapper/ResiUserBadgeDao.xml new file mode 100644 index 0000000000..221c9c3d3f --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/resources/mapper/ResiUserBadgeDao.xml @@ -0,0 +1,23 @@ + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/resources/mapper/UserAdviceDao.xml b/epmet-user/epmet-user-server/src/main/resources/mapper/UserAdviceDao.xml index 87d8addf9b..0f7d01cd50 100644 --- a/epmet-user/epmet-user-server/src/main/resources/mapper/UserAdviceDao.xml +++ b/epmet-user/epmet-user-server/src/main/resources/mapper/UserAdviceDao.xml @@ -6,13 +6,22 @@ + + + + + + + - + + + @@ -21,5 +30,17 @@ + + update user_advice + set + reply_content = #{replyContent}, + reply_user_id = #{replyUserId}, + reply_time = now(), + gov_content = #{govContent}, + reply_user_name = (select real_name from oper_user where user_id = #{replyUserId} and del_flag = 0), + updated_by = #{replyUserId}, + updated_time = now() + where id = #{adviceId} and del_flag = 0 + - \ No newline at end of file + diff --git a/epmet-user/epmet-user-server/src/main/resources/mapper/UserBadgeCertificateRecordDao.xml b/epmet-user/epmet-user-server/src/main/resources/mapper/UserBadgeCertificateRecordDao.xml new file mode 100644 index 0000000000..a2f59e8b8e --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/resources/mapper/UserBadgeCertificateRecordDao.xml @@ -0,0 +1,32 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file 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 022d95e7f8..a20a9c0e61 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 @@ -47,11 +47,16 @@ BADGE_NAME, BADGE_ICON, FIXATION_BADGE_TYPE AS badgeType - FROM badge - WHERE - DEL_FLAG = '0' - AND (CUSTOMER_ID = 'default' OR CUSTOMER_ID = #{customerId}) - AND BADGE_STATUS = 'online' + FROM ( + SELECT * FROM badge + WHERE CUSTOMER_ID = #{customerId} AND DEL_FLAG = '0' + UNION ALL + SELECT * FROM badge a + WHERE CUSTOMER_ID = 'default' AND a.DEL_FLAG = '0' AND BADGE_STATUS = 'online' + AND NOT EXISTS + ( SELECT ID FROM badge b WHERE CUSTOMER_ID = #{customerId} AND a.ID = b.ID)) t + ORDER BY + CREATED_TIME DESC @@ -84,7 +89,7 @@ SELECT SURNAME, NAME, - ID_NUM, + ID_NUM AS idCard, ( CASE WHEN AUDIT_STATUS = 'approved' THEN 'yes' ELSE 'no' END ) AS isCertificated, MOBILE, CERTIFICATION_IMG,