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 5a261b93bf..daa42dc9eb 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java @@ -95,6 +95,9 @@ public enum EpmetErrorCode { SIGN_IN_TIME_NO(8513, "签到时间还未到~"), SIGN_IN_TIME_END(8514, "签到时间已结束~"), + //徽章管理 + DUPLICATE_BADGE_NAME(8515, "徽章名已存在"), + // 该错误不会提示给前端,只是后端传输错误信息用。 ACCESS_SQL_FILTER_MISSION_ARGS(8701, "缺少生成权限过滤SQL所需参数"), OPER_ADD_CUSTOMER_ROOT_AGENCY_ERROR(8702, "添加客户根级组织失败"), @@ -110,6 +113,8 @@ public enum EpmetErrorCode { OPER_CUSTOMER_FOOTBAR_EXISTS(8712, "footbar已存在"), OPER_CUSTOMER_FOOTBAR_NOT_FOUND(8713, "footbar不存在"), OPER_EXT_APP_SECRET_RESET_FAIL(8714, "秘钥更新失败"), + OPER_UPLOAD_IMG_TYPE_ERROR(8715, "请上传PNG格式的图片"), + OPER_UPLOAD_IMG_SIZE_ERROR(8716, "请上传200*200的图片"), // 党建声音 前端提示 88段 DRAFT_CONTENT_IS_NULL(8801, "至少需要添加一个段落"), diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/logback-spring.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/logback-spring.xml index f099678400..b2e0b7a9da 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/logback-spring.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/logback-spring.xml @@ -173,6 +173,13 @@ + + + + + + + diff --git a/epmet-module/epmet-oss/epmet-oss-server/src/main/java/com/epmet/controller/OssController.java b/epmet-module/epmet-oss/epmet-oss-server/src/main/java/com/epmet/controller/OssController.java index 65cf6b2d2d..ff52e99ce4 100644 --- a/epmet-module/epmet-oss/epmet-oss-server/src/main/java/com/epmet/controller/OssController.java +++ b/epmet-module/epmet-oss/epmet-oss-server/src/main/java/com/epmet/controller/OssController.java @@ -10,6 +10,7 @@ package com.epmet.controller; import com.epmet.cloud.CloudStorageConfig; import com.epmet.cloud.OssFactory; +import com.epmet.commons.tools.constant.NumConstant; import com.epmet.commons.tools.exception.EpmetErrorCode; import com.epmet.commons.tools.exception.RenException; import com.epmet.commons.tools.page.PageData; @@ -39,6 +40,9 @@ import org.springframework.web.bind.annotation.*; import org.springframework.web.multipart.MultipartFile; import springfox.documentation.annotations.ApiIgnore; +import javax.imageio.ImageIO; +import java.awt.image.BufferedImage; +import java.io.IOException; import java.io.ByteArrayInputStream; import java.io.IOException; import java.io.InputStream; @@ -223,6 +227,36 @@ public class OssController { return ossService.uploadImg(file); } + + @PostMapping("uploadimg/badgeicon") + public Result badgeIcon(@RequestParam("file") MultipartFile file) throws IOException { + + // 校验文件类型 + if (!MediaType.IMAGE_PNG_VALUE.equals(file.getContentType())) { + log.error("uploadArticleImg file type:{} is not support 2 upload", file.getContentType()); + throw new RenException(EpmetErrorCode.OPER_UPLOAD_IMG_TYPE_ERROR.getCode() + , EpmetErrorCode.OPER_UPLOAD_IMG_TYPE_ERROR.getMsg()); + } + + // 校验文件体积,不超过2m + long maxSize = 2 * 1024 * 1024; + long size = file.getSize(); + if (size > maxSize) { + throw new RenException(EpmetErrorCode.OPER_UPLOAD_FILE_OVER_SIZE.getCode() + , EpmetErrorCode.OPER_UPLOAD_FILE_OVER_SIZE.getMsg()); + } + + BufferedImage bufferedImage = ImageIO.read(file.getInputStream()); + int width = bufferedImage.getWidth(); + int height = bufferedImage.getHeight(); + if (width != 200 || height != 200) { + throw new RenException(EpmetErrorCode.OPER_UPLOAD_IMG_SIZE_ERROR.getCode() + , EpmetErrorCode.OPER_UPLOAD_IMG_SIZE_ERROR.getMsg()); + + } + return ossService.uploadImg(file); + } + /** * @param byteFile fileName * @Description 外挂-文件上传 diff --git a/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/CustomerTemplateListFormDTO.java b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/CustomerTemplateListFormDTO.java index 9dbabbfdbe..2fb11064f0 100644 --- a/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/CustomerTemplateListFormDTO.java +++ b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/CustomerTemplateListFormDTO.java @@ -22,6 +22,10 @@ public class CustomerTemplateListFormDTO implements Serializable { */ @NotBlank(message="公共模板Id不能为空", groups = {AddUserInternalGroup.class}) private String publicId; + /** + * 模板关键词Id + */ + private String keyIds; public interface AddUserInternalGroup {} } diff --git a/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/GetTemplateListFormDTO.java b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/GetTemplateListFormDTO.java index 09fb259376..8bde81adf2 100644 --- a/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/GetTemplateListFormDTO.java +++ b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/GetTemplateListFormDTO.java @@ -26,6 +26,10 @@ public class GetTemplateListFormDTO implements Serializable { * 模板类型(站内信提醒) */ private String templateType; + /** + * 模板关键词Id + */ + private String keyIds; public interface AddUserInternalGroup {} } diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/PersonalTemplateDao.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/PersonalTemplateDao.java index 6e229dc052..c89ed2aeba 100644 --- a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/PersonalTemplateDao.java +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/PersonalTemplateDao.java @@ -94,4 +94,15 @@ public interface PersonalTemplateDao extends BaseDao { * @author sun */ List selectCustomerTemplateList(CustomerTemplateListFormDTO formDTO); + + /** + * 根据tid和keyIds查询是否已存在该模板类型数据 + * @author zhaoqifeng + * @date 2020/11/2 10:31 + * @param appId + * @param tid + * @param keyIds + * @return java.util.List + */ + List selectListByKey(@Param("appId") String appId, @Param("tid") String tid, @Param("keyIds") String keyIds); } \ No newline at end of file diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/PersonalTemplateService.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/PersonalTemplateService.java index f3f0da9b49..1d69a7b16a 100644 --- a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/PersonalTemplateService.java +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/PersonalTemplateService.java @@ -141,4 +141,15 @@ public interface PersonalTemplateService extends BaseService customerTemplateList(CustomerTemplateListFormDTO formDTO); + + /** + * 根据tid和keyIds查询是否已存在该模板类型数据 + * @author zhaoqifeng + * @date 2020/11/2 10:29 + * @param appId + * @param tid + * @param keyIds + * @return java.util.List + */ + List getListByKey(String appId, String tid, String keyIds); } \ No newline at end of file diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/PersonalTemplateServiceImpl.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/PersonalTemplateServiceImpl.java index 154cca9082..6aac8fdc8f 100644 --- a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/PersonalTemplateServiceImpl.java +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/PersonalTemplateServiceImpl.java @@ -127,6 +127,7 @@ public class PersonalTemplateServiceImpl extends BaseServiceImpl templateList(GetTemplateListFormDTO formDTO) { + formDTO.setKeyIds("5,4,2"); //根据客户Id、appId、模板类型查询小程序订阅消息模板列表 return baseDao.selectTemplateList(formDTO); } @@ -138,7 +139,23 @@ public class PersonalTemplateServiceImpl extends BaseServiceImpl customerTemplateList(CustomerTemplateListFormDTO formDTO) { + formDTO.setKeyIds("5,4,2"); return baseDao.selectCustomerTemplateList(formDTO); } + /** + * 根据tid和keyIds查询是否已存在该模板类型数据 + * + * @param appId + * @param tid + * @param keyIds + * @return java.util.List + * @author zhaoqifeng + * @date 2020/11/2 10:29 + */ + @Override + public List getListByKey(String appId, String tid, String keyIds) { + return baseDao.selectListByKey(appId, tid, keyIds); + } + } \ No newline at end of file diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/SubscribeServiceImpl.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/SubscribeServiceImpl.java index 1521aa508a..4596bcf589 100644 --- a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/SubscribeServiceImpl.java +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/SubscribeServiceImpl.java @@ -180,6 +180,11 @@ public class SubscribeServiceImpl implements SubscribeService { String keywords = String.join(",", formDTO.getNameList()); List keyIdList = formDTO.getKidList().stream().map(Object::toString).collect(Collectors.toList()); String keyIds = String.join(",", keyIdList); + //根据tid和keyIds查询是否已存在该模板类型数据 + List list = personalTemplateService.getListByKey(formDTO.getAppId(), formDTO.getTid(), keyIds); + if (null != list && list.size() > NumConstant.ZERO) { + throw new RenException(formDTO.getTitle() + "已存在所选关键词[" + keywords + "]的模板"); + } //将公共模板存入数据库 PersonalTemplateDTO personalTemplateDTO = new PersonalTemplateDTO(); personalTemplateDTO.setCustomerId(authInfo.getCustomerId()); diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/PersonalTemplateDao.xml b/epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/PersonalTemplateDao.xml index 7eab9a2e63..97452fa3b9 100644 --- a/epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/PersonalTemplateDao.xml +++ b/epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/PersonalTemplateDao.xml @@ -86,7 +86,8 @@ AND customer_id = #{customerId} AND app_id = #{appId} AND title = #{templateType} - ORDER BY CREATED_TIME DESC + AND key_ids = '5,4,2' + ORDER BY created_time ASC + \ No newline at end of file diff --git a/epmet-module/resi-mine/resi-mine-client/src/main/java/com/epmet/resi/mine/dto/from/BadgeListFormDTO.java b/epmet-module/resi-mine/resi-mine-client/src/main/java/com/epmet/resi/mine/dto/from/BadgeListFormDTO.java new file mode 100644 index 0000000000..c5ace2985f --- /dev/null +++ b/epmet-module/resi-mine/resi-mine-client/src/main/java/com/epmet/resi/mine/dto/from/BadgeListFormDTO.java @@ -0,0 +1,29 @@ +package com.epmet.resi.mine.dto.from; + +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import java.io.Serializable; + +/** + * @Author zxc + * @DateTime 2020/11/3 11:07 上午 + */ +@Data +public class BadgeListFormDTO implements Serializable { + + private static final long serialVersionUID = 9082922684993474574L; + + public interface BadgeList{} + + /** + * 用户ID + */ + private String userId; + + /** + * 客户ID + */ + @NotBlank(message = "客户ID不能为空",groups = {BadgeList.class}) + private String customerId; +} diff --git a/epmet-module/resi-mine/resi-mine-client/src/main/java/com/epmet/resi/mine/dto/from/OperListFormDTO.java b/epmet-module/resi-mine/resi-mine-client/src/main/java/com/epmet/resi/mine/dto/from/OperListFormDTO.java new file mode 100644 index 0000000000..a0f7b7f919 --- /dev/null +++ b/epmet-module/resi-mine/resi-mine-client/src/main/java/com/epmet/resi/mine/dto/from/OperListFormDTO.java @@ -0,0 +1,21 @@ +package com.epmet.resi.mine.dto.from; + +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import java.io.Serializable; + +/** + * @Author zxc + * @DateTime 2020/11/3 4:18 下午 + */ +@Data +public class OperListFormDTO implements Serializable { + + private static final long serialVersionUID = -1872129597916414752L; + + public interface OperList{} + + @NotBlank(message = "客户ID不能为空",groups = {OperList.class}) + private String customerId; +} diff --git a/epmet-module/resi-mine/resi-mine-client/src/main/java/com/epmet/resi/mine/dto/result/BadgeListResultDTO.java b/epmet-module/resi-mine/resi-mine-client/src/main/java/com/epmet/resi/mine/dto/result/BadgeListResultDTO.java new file mode 100644 index 0000000000..d32230501e --- /dev/null +++ b/epmet-module/resi-mine/resi-mine-client/src/main/java/com/epmet/resi/mine/dto/result/BadgeListResultDTO.java @@ -0,0 +1,32 @@ +package com.epmet.resi.mine.dto.result; + +import lombok.Data; + +import java.io.Serializable; + +/** + * @Author zxc + * @DateTime 2020/11/3 11:08 上午 + */ +@Data +public class BadgeListResultDTO implements Serializable { + + private static final long serialVersionUID = -6542233940679158922L; + + /** + * 徽章ID + */ + private String badgeId; + + /** + * 徽章图片地址 + */ + private String badgeIcon; + + /** + * 徽章是否点亮 + */ + private String isOpened; + + private String badgeType; +} diff --git a/epmet-module/resi-mine/resi-mine-client/src/main/java/com/epmet/resi/mine/dto/result/InitInfoResultDTO.java b/epmet-module/resi-mine/resi-mine-client/src/main/java/com/epmet/resi/mine/dto/result/InitInfoResultDTO.java new file mode 100644 index 0000000000..f89028a9dd --- /dev/null +++ b/epmet-module/resi-mine/resi-mine-client/src/main/java/com/epmet/resi/mine/dto/result/InitInfoResultDTO.java @@ -0,0 +1,39 @@ +package com.epmet.resi.mine.dto.result; + +import lombok.Data; + +import java.io.Serializable; + +/** + * @author zhaoqifeng + * @dscription + * @date 2020/11/3 9:58 + */ +@Data +public class InitInfoResultDTO implements Serializable { + private static final long serialVersionUID = 144944007101324497L; + /** + * 头像 + */ + private String headImgUrl; + /** + * 姓 + */ + private String surname; + /** + * 名 + */ + private String name; + /** + * 路牌号 + */ + private String street; + /** + * 小区名称 + */ + private String district; + /** + * 详细地址 + */ + private String buildingAddress; +} diff --git a/epmet-module/resi-mine/resi-mine-client/src/main/java/com/epmet/resi/mine/dto/result/OperListResultDTO.java b/epmet-module/resi-mine/resi-mine-client/src/main/java/com/epmet/resi/mine/dto/result/OperListResultDTO.java new file mode 100644 index 0000000000..d202918818 --- /dev/null +++ b/epmet-module/resi-mine/resi-mine-client/src/main/java/com/epmet/resi/mine/dto/result/OperListResultDTO.java @@ -0,0 +1,51 @@ +package com.epmet.resi.mine.dto.result; + +import lombok.Data; + +import java.io.Serializable; + +/** + * @Author zxc + * @DateTime 2020/11/3 4:20 下午 + */ +@Data +public class OperListResultDTO implements Serializable { + + private static final long serialVersionUID = -6185696177370545937L; + + /** + * 徽章ID + */ + private String badgeId; + + /** + * 徽章名字 + */ + private String badgeName; + + /** + * 点亮状态 yes:已点亮,no:未点亮 + */ + private String isLighted; + + /** + * 是否认证 yes 认证 no 已认证 + */ + private String isCertificated; + + /** + * 徽章图片地址 + */ + private String badgeIcon; + + /** + * 是否被驳回 true:已驳回,false:未驳回 + */ + private Boolean isReject; + + /** + * 徽章类型:党员徽章;party,无:none + */ + private String badgeType; + +} diff --git a/epmet-module/resi-mine/resi-mine-server/src/main/java/com/epmet/modules/badege/controller/BadgeController.java b/epmet-module/resi-mine/resi-mine-server/src/main/java/com/epmet/modules/badege/controller/BadgeController.java new file mode 100644 index 0000000000..da3bfca3d2 --- /dev/null +++ b/epmet-module/resi-mine/resi-mine-server/src/main/java/com/epmet/modules/badege/controller/BadgeController.java @@ -0,0 +1,85 @@ +package com.epmet.modules.badege.controller; + +import com.epmet.commons.tools.annotation.LoginUser; +import com.epmet.commons.tools.security.dto.TokenDto; +import com.epmet.commons.tools.utils.Result; +import com.epmet.commons.tools.validator.ValidatorUtils; +import com.epmet.dto.form.OpenedOrClosedFormDTO; +import com.epmet.modules.badege.service.BadgeService; +import com.epmet.resi.mine.dto.from.BadgeListFormDTO; +import com.epmet.dto.form.CertificationAddFormDTO; +import com.epmet.resi.mine.dto.from.OperListFormDTO; +import com.epmet.resi.mine.dto.result.BadgeListResultDTO; +import com.epmet.resi.mine.dto.result.OperListResultDTO; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import java.util.List; + +/** + * @Author zxc + * @DateTime 2020/11/3 10:42 上午 + */ +@RestController +@RequestMapping("badge") +public class BadgeController { + + @Autowired + private BadgeService badgeService; + + /** + * @Description 个人中心-获取个人徽章点亮列表 + * @Param badgeListFormDTO + * @author zxc + * @date 2020/11/3 4:11 下午 + */ + @PostMapping("list") + public Result> getBadgeList(@LoginUser TokenDto tokenDto,@RequestBody BadgeListFormDTO badgeListFormDTO){ + ValidatorUtils.validateEntity(badgeListFormDTO, BadgeListFormDTO.BadgeList.class); + return new Result>().ok(badgeService.getBadgeList(tokenDto,badgeListFormDTO)); + } + + /** + * @Description 个人中心-获取徽章可操作列表(点亮,取消,认证) + * @Param operListFormDTO + * @author zxc + * @date 2020/11/3 4:28 下午 + */ + @PostMapping("operlist") + public Result> getOperList(@LoginUser TokenDto tokenDto,@RequestBody OperListFormDTO operListFormDTO){ + ValidatorUtils.validateEntity(operListFormDTO, OperListFormDTO.OperList.class); + return new Result>().ok(badgeService.getOperList(tokenDto,operListFormDTO)); + } + + /** + * @Description 个人中心-提交徽章认证 + * @Param tokenDto + * @Param certificationAddFormDTO + * @author zxc + * @date 2020/11/4 11:16 上午 + */ + @PostMapping("certification/add") + public Result certificationAdd(@LoginUser TokenDto tokenDto,@RequestBody CertificationAddFormDTO certificationAddFormDTO){ + ValidatorUtils.validateEntity(certificationAddFormDTO, CertificationAddFormDTO.CertificationAdd.class); + badgeService.certificationAdd(tokenDto,certificationAddFormDTO); + return new Result(); + } + + /** + * @Description 个人中心-取消/点亮徽章 + * @Param openedOrClosedFormDTO + * @author zxc + * @date 2020/11/5 9:23 上午 + */ + @PostMapping("openedorclosed") + public Result openedOrClosed(@LoginUser TokenDto tokenDto,@RequestBody OpenedOrClosedFormDTO openedOrClosedFormDTO){ + ValidatorUtils.validateEntity(openedOrClosedFormDTO, OpenedOrClosedFormDTO.OpenedOrClosed.class); + badgeService.openedOrClosed(tokenDto,openedOrClosedFormDTO); + return new Result(); + } + + +} diff --git a/epmet-module/resi-mine/resi-mine-server/src/main/java/com/epmet/modules/badege/service/BadgeService.java b/epmet-module/resi-mine/resi-mine-server/src/main/java/com/epmet/modules/badege/service/BadgeService.java new file mode 100644 index 0000000000..1b67df51f8 --- /dev/null +++ b/epmet-module/resi-mine/resi-mine-server/src/main/java/com/epmet/modules/badege/service/BadgeService.java @@ -0,0 +1,52 @@ +package com.epmet.modules.badege.service; + +import com.epmet.commons.tools.security.dto.TokenDto; +import com.epmet.dto.form.OpenedOrClosedFormDTO; +import com.epmet.resi.mine.dto.from.BadgeListFormDTO; +import com.epmet.dto.form.CertificationAddFormDTO; +import com.epmet.resi.mine.dto.from.OperListFormDTO; +import com.epmet.resi.mine.dto.result.BadgeListResultDTO; +import com.epmet.resi.mine.dto.result.OperListResultDTO; + +import java.util.List; + +/** + * @Author zxc + * @DateTime 2020/11/3 10:52 上午 + */ +public interface BadgeService { + + /** + * @Description 个人中心-获取个人徽章点亮列表 + * @Param badgeListFormDTO + * @author zxc + * @date 2020/11/3 4:11 下午 + */ + List getBadgeList(TokenDto tokenDto,BadgeListFormDTO badgeListFormDTO); + + /** + * @Description 个人中心-获取徽章可操作列表(点亮,取消,认证) + * @Param operListFormDTO + * @author zxc + * @date 2020/11/3 4:28 下午 + */ + List getOperList(TokenDto tokenDto,OperListFormDTO operListFormDTO); + + /** + * @Description 个人中心-提交徽章认证 + * @Param tokenDto + * @Param certificationAddFormDTO + * @author zxc + * @date 2020/11/4 11:16 上午 + */ + void certificationAdd(TokenDto tokenDto, CertificationAddFormDTO certificationAddFormDTO); + + /** + * @Description 个人中心-取消/点亮徽章 + * @Param openedOrClosedFormDTO + * @author zxc + * @date 2020/11/5 9:23 上午 + */ + void openedOrClosed(TokenDto tokenDto,OpenedOrClosedFormDTO openedOrClosedFormDTO); + +} diff --git a/epmet-module/resi-mine/resi-mine-server/src/main/java/com/epmet/modules/badege/service/impl/BadgeServiceImpl.java b/epmet-module/resi-mine/resi-mine-server/src/main/java/com/epmet/modules/badege/service/impl/BadgeServiceImpl.java new file mode 100644 index 0000000000..4abc5853b6 --- /dev/null +++ b/epmet-module/resi-mine/resi-mine-server/src/main/java/com/epmet/modules/badege/service/impl/BadgeServiceImpl.java @@ -0,0 +1,111 @@ +package com.epmet.modules.badege.service.impl; + +import com.epmet.commons.tools.exception.RenException; +import com.epmet.commons.tools.security.dto.TokenDto; +import com.epmet.commons.tools.utils.ConvertUtils; +import com.epmet.commons.tools.utils.Result; +import com.epmet.dto.form.OpenedOrClosedFormDTO; +import com.epmet.dto.form.UserBadgeListFormDTO; +import com.epmet.dto.form.UserOperListFormDTO; +import com.epmet.dto.result.UserBadgeListResultDTO; +import com.epmet.dto.result.UserOperListResultDTO; +import com.epmet.feign.EpmetUserOpenFeignClient; +import com.epmet.modules.badege.service.BadgeService; +import com.epmet.resi.mine.dto.from.BadgeListFormDTO; +import com.epmet.dto.form.CertificationAddFormDTO; +import com.epmet.resi.mine.dto.from.OperListFormDTO; +import com.epmet.resi.mine.dto.result.BadgeListResultDTO; +import com.epmet.resi.mine.dto.result.OperListResultDTO; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.ArrayList; +import java.util.List; + +/** + * @Author zxc + * @DateTime 2020/11/3 10:53 上午 + */ +@Service +@Slf4j +public class BadgeServiceImpl implements BadgeService { + + @Autowired + private EpmetUserOpenFeignClient epmetUserOpenFeignClient; + + /** + * @Description 个人中心-获取个人徽章点亮列表 + * @Param badgeListFormDTO + * @author zxc + * @date 2020/11/3 4:11 下午 + */ + @Override + public List getBadgeList(TokenDto tokenDto,BadgeListFormDTO badgeListFormDTO) { + UserBadgeListFormDTO form = new UserBadgeListFormDTO(); + form.setCustomerId(badgeListFormDTO.getCustomerId()); + form.setUserId(tokenDto.getUserId()); + Result> listResult = epmetUserOpenFeignClient.selectBadgeList(form); + if (!listResult.success()){ + throw new RenException("获取徽章点亮列表失败......"); + } + if (null == listResult.getData()){ + return new ArrayList<>(); + } + List result = ConvertUtils.sourceToTarget(listResult.getData(), BadgeListResultDTO.class); + return result; + } + + /** + * @Description 个人中心-获取徽章可操作列表(点亮,取消,认证) + * @Param operListFormDTO + * @author zxc + * @date 2020/11/3 4:28 下午 + */ + @Override + public List getOperList(TokenDto tokenDto,OperListFormDTO operListFormDTO) { + UserOperListFormDTO userOperListFormDTO = new UserOperListFormDTO(); + userOperListFormDTO.setCustomerId(operListFormDTO.getCustomerId()); + userOperListFormDTO.setUserId(tokenDto.getUserId()); + Result> listResult = epmetUserOpenFeignClient.selectOperList(userOperListFormDTO); + if (!listResult.success()){ + throw new RenException("获取徽章列表失败......"); + } + if (null == listResult.getData()){ + return new ArrayList<>(); + } + List result = ConvertUtils.sourceToTarget(listResult.getData(), OperListResultDTO.class); + return result; + } + + /** + * @Description 个人中心-提交徽章认证 + * @Param tokenDto + * @Param certificationAddFormDTO + * @author zxc + * @date 2020/11/4 11:16 上午 + */ + @Override + public void certificationAdd(TokenDto tokenDto, CertificationAddFormDTO certificationAddFormDTO) { + certificationAddFormDTO.setUserId(tokenDto.getUserId()); + Result result = epmetUserOpenFeignClient.authBadgeRecord(certificationAddFormDTO); + if (!result.success()){ + throw new RenException("提交徽章认证失败......"); + } + } + + /** + * @Description 个人中心-取消/点亮徽章 + * @Param openedOrClosedFormDTO + * @author zxc + * @date 2020/11/5 9:23 上午 + */ + @Override + public void openedOrClosed(TokenDto tokenDto,OpenedOrClosedFormDTO openedOrClosedFormDTO) { + openedOrClosedFormDTO.setUserId(tokenDto.getUserId()); + Result result = epmetUserOpenFeignClient.openedOrClosed(openedOrClosedFormDTO); + if (!result.success()){ + throw new RenException("取消/点亮徽章失败了......"); + } + } +} diff --git a/epmet-module/resi-mine/resi-mine-server/src/main/java/com/epmet/modules/mine/controller/PersonalCenterController.java b/epmet-module/resi-mine/resi-mine-server/src/main/java/com/epmet/modules/mine/controller/PersonalCenterController.java new file mode 100644 index 0000000000..61c538fbdc --- /dev/null +++ b/epmet-module/resi-mine/resi-mine-server/src/main/java/com/epmet/modules/mine/controller/PersonalCenterController.java @@ -0,0 +1,55 @@ +package com.epmet.modules.mine.controller; + +import com.epmet.commons.tools.annotation.LoginUser; +import com.epmet.commons.tools.security.dto.TokenDto; +import com.epmet.commons.tools.utils.Result; +import com.epmet.dto.form.EditInfoFormDTO; +import com.epmet.modules.mine.service.PersonalCenterService; +import com.epmet.resi.mine.dto.result.InitInfoResultDTO; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +/** + * 个人中心 + * @author zhaoqifeng + * @date 2020/11/3 9:48 + */ +@Slf4j +@RestController +@RequestMapping("personalcenter") +public class PersonalCenterController { + @Autowired + private PersonalCenterService personalCenterService; + + /** + * 修改信息页面初始化 + * @author zhaoqifeng + * @date 2020/11/3 10:03 + * @param tokenDto + * @return com.epmet.commons.tools.utils.Result + */ + @PostMapping("initinfo") + public Result initInfo(@LoginUser TokenDto tokenDto) { + InitInfoResultDTO resultDTO = personalCenterService.initInfo(tokenDto); + return new Result().ok(resultDTO); + + } + + /** + * 修改信息 + * @author zhaoqifeng + * @date 2020/11/3 10:03 + * @param tokenDto + * @param formDTO + * @return com.epmet.commons.tools.utils.Result + */ + @PostMapping("editinfo") + public Result editInfo(@LoginUser TokenDto tokenDto, @RequestBody EditInfoFormDTO formDTO) { + personalCenterService.editInfo(tokenDto, formDTO); + return new Result(); + } +} diff --git a/epmet-module/resi-mine/resi-mine-server/src/main/java/com/epmet/modules/mine/service/PersonalCenterService.java b/epmet-module/resi-mine/resi-mine-server/src/main/java/com/epmet/modules/mine/service/PersonalCenterService.java new file mode 100644 index 0000000000..219edb8c86 --- /dev/null +++ b/epmet-module/resi-mine/resi-mine-server/src/main/java/com/epmet/modules/mine/service/PersonalCenterService.java @@ -0,0 +1,17 @@ +package com.epmet.modules.mine.service; + +import com.epmet.commons.tools.security.dto.TokenDto; +import com.epmet.dto.form.EditInfoFormDTO; +import com.epmet.resi.mine.dto.result.InitInfoResultDTO; + +/** + * @author zhaoqifeng + * @dscription + * @date 2020/11/3 9:50 + */ +public interface PersonalCenterService { + + InitInfoResultDTO initInfo(TokenDto tokenDto); + + void editInfo(TokenDto tokenDto, EditInfoFormDTO formDTO); +} diff --git a/epmet-module/resi-mine/resi-mine-server/src/main/java/com/epmet/modules/mine/service/impl/PersonalCenterServiceImpl.java b/epmet-module/resi-mine/resi-mine-server/src/main/java/com/epmet/modules/mine/service/impl/PersonalCenterServiceImpl.java new file mode 100644 index 0000000000..142d82d6dd --- /dev/null +++ b/epmet-module/resi-mine/resi-mine-server/src/main/java/com/epmet/modules/mine/service/impl/PersonalCenterServiceImpl.java @@ -0,0 +1,51 @@ +package com.epmet.modules.mine.service.impl; + +import com.epmet.commons.tools.exception.RenException; +import com.epmet.commons.tools.security.dto.TokenDto; +import com.epmet.commons.tools.utils.Result; +import com.epmet.dto.form.EditInfoFormDTO; +import com.epmet.dto.result.ResiUserBaseInfoResultDTO; +import com.epmet.feign.EpmetUserOpenFeignClient; +import com.epmet.modules.mine.service.PersonalCenterService; +import com.epmet.resi.mine.dto.result.InitInfoResultDTO; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +/** + * @author zhaoqifeng + * @dscription + * @date 2020/11/3 9:50 + */ +@Slf4j +@Service +public class PersonalCenterServiceImpl implements PersonalCenterService { + + @Autowired + private EpmetUserOpenFeignClient epmetUserOpenFeignClient; + + @Override + public InitInfoResultDTO initInfo(TokenDto tokenDto) { + Result baseInfoResult = epmetUserOpenFeignClient.selectUserBaseInfo(tokenDto); + if (!baseInfoResult.success()) { + throw new RenException(baseInfoResult.getCode(), baseInfoResult.getMsg()); + } + InitInfoResultDTO resultDTO = new InitInfoResultDTO(); + resultDTO.setHeadImgUrl(baseInfoResult.getData().getHeadImgUrl()); + resultDTO.setSurname(baseInfoResult.getData().getSurname()); + resultDTO.setName(baseInfoResult.getData().getName()); + resultDTO.setStreet(baseInfoResult.getData().getStreet()); + resultDTO.setDistrict(baseInfoResult.getData().getDistrict()); + resultDTO.setBuildingAddress(baseInfoResult.getData().getBuildingAddress()); + return resultDTO; + } + + @Override + public void editInfo(TokenDto tokenDto, EditInfoFormDTO formDTO) { + formDTO.setUserId(tokenDto.getUserId()); + Result result = epmetUserOpenFeignClient.editUserInfo(formDTO); + if (!result.success()) { + throw new RenException(result.getCode(), result.getMsg()); + } + } +} diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/constant/BadgeConstant.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/constant/BadgeConstant.java new file mode 100644 index 0000000000..73c82eaa00 --- /dev/null +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/constant/BadgeConstant.java @@ -0,0 +1,27 @@ +package com.epmet.constant; + +/** + * @Author zxc + * @DateTime 2020/11/3 2:45 下午 + */ +public interface BadgeConstant { + + String BADGE_KEY = "epmet:badge:"; + + String BADGE = "badge"; + + String DEFAULT_CUSTOMER = "default"; + + String YES = "yes"; + + String NO = "no"; + + String REJECTED = "rejected"; + + String APPROVED = "approved"; + + String NONE ="none"; + + String SMS_CODE_KEY = "epmet:smsCode:badge:"; + +} diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/BadgeCertificationConfigDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/BadgeCertificationConfigDTO.java new file mode 100644 index 0000000000..5eb6e95749 --- /dev/null +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/BadgeCertificationConfigDTO.java @@ -0,0 +1,86 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

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

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

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.dto; + +import java.io.Serializable; +import java.util.Date; +import lombok.Data; + + +/** + * 徽章认证配置 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-11-03 + */ +@Data +public class BadgeCertificationConfigDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 主键ID + */ + private String id; + + /** + * 客户Id 默认配置id:default + */ + private String customerId; + + /** + * 徽章ID + */ + private String badgeId; + + /** + * 认证信息类型 手机号:mobile;全名:fullname;身份证:idcard;认证证件: certificate;认证说明(备注):remark + */ + private String certificationType; + + /** + * 删除标识 1删除;0未删除 + */ + private String delFlag; + + /** + * 乐观锁 + */ + private Integer revision; + + /** + * 创建人 + */ + private String createdBy; + + /** + * 创建时间 + */ + private Date createdTime; + + /** + * 更新人 + */ + private String updatedBy; + + /** + * 更新时间 + */ + private Date updatedTime; + +} \ No newline at end of file diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/BadgeDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/BadgeDTO.java new file mode 100644 index 0000000000..dfeb6f055b --- /dev/null +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/BadgeDTO.java @@ -0,0 +1,96 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

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

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

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.dto; + +import java.io.Serializable; +import java.util.Date; +import lombok.Data; + + +/** + * 徽章 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-11-03 + */ +@Data +public class BadgeDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 主键ID + */ + private String id; + + /** + * 客户Id 默认配置id:default + */ + private String customerId; + + /** + * 徽章名称 + */ + private String badgeName; + + /** + * 徽章图标url + */ + private String badgeIcon; + + /** + * 固有徽章类型 前端页面跳转标识,党员徽章:party;无:none + */ + private String fixationBadgeType; + + /** + * 状态 上线:online;下线:offline; + */ + private String badgeStatus; + + /** + * 删除标识 1删除;0未删除 + */ + private String delFlag; + + /** + * 乐观锁 + */ + private Integer revision; + + /** + * 创建人 + */ + private String createdBy; + + /** + * 创建时间 + */ + private Date createdTime; + + /** + * 更新人 + */ + private String updatedBy; + + /** + * 更新时间 + */ + private Date updatedTime; + +} \ No newline at end of file diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/UserBadgeCertificateRecordDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/UserBadgeCertificateRecordDTO.java new file mode 100644 index 0000000000..ffa2be3013 --- /dev/null +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/UserBadgeCertificateRecordDTO.java @@ -0,0 +1,45 @@ +package com.epmet.dto; + +import lombok.Data; + +import java.io.Serializable; +import java.util.Date; + +/** + * @Author zxc + * @DateTime 2020/11/4 1:46 下午 + */ +@Data +public class UserBadgeCertificateRecordDTO implements Serializable { + + private static final long serialVersionUID = 3207509834642386145L; + + private String customerId; + private String gridId; + private String userId; + private String badgeId; + private String surname; + private String name; + private String mobile; + private String idNum; + private String certificationImg; + private String remark; + private String auditStatus; + private String auditRemark; + private String staffId; + private Date auditTime; + private String isLast; + private String delFlag; + private Integer revision; + private String createdBy; + private String updatedBy; + + public UserBadgeCertificateRecordDTO() { + this.auditStatus = "auditing"; + this.isLast = "yes"; + this.delFlag = "0"; + this.revision = 0; + this.createdBy = "APP_USER"; + this.updatedBy = "APP_USER"; + } +} diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/AddBadgeFormDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/AddBadgeFormDTO.java new file mode 100644 index 0000000000..ceb07d1651 --- /dev/null +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/AddBadgeFormDTO.java @@ -0,0 +1,42 @@ +package com.epmet.dto.form; + +import lombok.Data; +import lombok.NoArgsConstructor; + +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotEmpty; +import javax.validation.constraints.NotNull; +import java.io.Serializable; +import java.util.List; + +/** + * @author zhaoqifeng + * @dscription + * @date 2020/11/4 9:47 + */ +@NoArgsConstructor +@Data +public class AddBadgeFormDTO implements Serializable { + + private static final long serialVersionUID = -5220529162950147825L; + /** + * 徽章名称 + */ + @NotBlank(message = "徽章名称不能为空") + private String badgeName; + /** + * 徽章图标 + */ + @NotBlank(message = "徽章图标不能为空") + private String badgeIcon; + /** + * 徽章状态 上线:online;下线:offline; + */ + @NotBlank(message = "徽章状态不能为空") + private String badgeStatus; + /** + * 认证信息类型数组 手机号:mobile;姓名:fullname;身份证:idcard;认证证件: certificate;认证说明(备注):remark + */ + @NotEmpty(message = "认证信息类型不能为空") + private List certificationTypes; +} diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/AuthFieldFormDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/AuthFieldFormDTO.java new file mode 100644 index 0000000000..b5c716470f --- /dev/null +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/AuthFieldFormDTO.java @@ -0,0 +1,24 @@ +package com.epmet.dto.form; + +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import java.io.Serializable; + +/** + * @Author zxc + * @DateTime 2020/11/4 4:54 下午 + */ +@Data +public class AuthFieldFormDTO implements Serializable { + + private static final long serialVersionUID = 1976515427065841752L; + + public interface AuthField{} + + @NotBlank(message = "客户ID不能为空",groups = {AuthField.class}) + private String customerId; + + @NotBlank(message = "徽章ID不能为空",groups = {AuthField.class}) + private String badgeId; +} diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/BadgeFormDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/BadgeFormDTO.java new file mode 100644 index 0000000000..4b35497e8b --- /dev/null +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/BadgeFormDTO.java @@ -0,0 +1,16 @@ +package com.epmet.dto.form; + +import lombok.Data; + +import java.io.Serializable; + +/** + * @author zhaoqifeng + * @dscription + * @date 2020/11/4 14:22 + */ +@Data +public class BadgeFormDTO implements Serializable { + private static final long serialVersionUID = 9156247659994638103L; + private String badgeId; +} diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/BadgeSendCodeFormDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/BadgeSendCodeFormDTO.java new file mode 100644 index 0000000000..14cb3c3333 --- /dev/null +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/BadgeSendCodeFormDTO.java @@ -0,0 +1,22 @@ +package com.epmet.dto.form; + +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import java.io.Serializable; + +/** + * @Author zxc + * @DateTime 2020/11/4 3:11 下午 + */ +@Data +public class BadgeSendCodeFormDTO implements Serializable { + + private static final long serialVersionUID = -3926070129364657241L; + + public interface BadgeSendCode{} + + @NotBlank(message = "手机号不能为空", groups = {BadgeSendCode.class}) + private String mobile; + +} diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/CertificationAddFormDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/CertificationAddFormDTO.java new file mode 100644 index 0000000000..76583e9559 --- /dev/null +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/CertificationAddFormDTO.java @@ -0,0 +1,67 @@ +package com.epmet.dto.form; + +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import java.io.Serializable; + +/** + * @Author zxc + * @DateTime 2020/11/4 11:05 上午 + */ +@Data +public class CertificationAddFormDTO implements Serializable { + + private static final long serialVersionUID = 1330773325803513330L; + + public interface CertificationAdd{} + + private String userId; + + /** + * 客户ID + */ + @NotBlank(message = "客户ID不能为空",groups = {CertificationAdd.class}) + private String customerId; + + /** + * 徽章ID + */ + private String badgeId; + + /** + * 手机号 + */ + private String mobile; + + /** + * 姓 + */ + private String subName; + + /** + * 名 + */ + private String name; + + /** + * 身份证号 + */ + private String idCard; + + /** + * 认证证件图片url + */ + private String certificate; + + /** + * 认证说明 + */ + private String remark; + + /** + * 验证码 + */ + private String code; + +} diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/CertificationDetailFormDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/CertificationDetailFormDTO.java new file mode 100644 index 0000000000..1eea42f575 --- /dev/null +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/CertificationDetailFormDTO.java @@ -0,0 +1,29 @@ +package com.epmet.dto.form; + +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import java.io.Serializable; + +/** + * @Author zxc + * @DateTime 2020/11/4 3:51 下午 + */ +@Data +public class CertificationDetailFormDTO implements Serializable { + + private static final long serialVersionUID = -398879254354767770L; + + public interface CertificationDetail{} + + @NotBlank(message = "客户ID不能为空",groups = {CertificationDetail.class}) + private String customerId; + + @NotBlank(message = "徽章ID不能为空",groups = {CertificationDetail.class}) + private String badgeId; + + /** + * 客户ID + */ + private String userId; +} diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/EditBadgeFormDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/EditBadgeFormDTO.java new file mode 100644 index 0000000000..e11d2e107c --- /dev/null +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/EditBadgeFormDTO.java @@ -0,0 +1,40 @@ +package com.epmet.dto.form; + +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotEmpty; +import javax.validation.constraints.NotNull; +import java.io.Serializable; +import java.util.List; + +/** + * @author zhaoqifeng + * @dscription + * @date 2020/11/4 14:23 + */ +@Data +public class EditBadgeFormDTO implements Serializable { + private static final long serialVersionUID = 1578890423002035200L; + private String badgeId; + /** + * 徽章名称 + */ + @NotBlank(message = "徽章名称不能为空") + private String badgeName; + /** + * 徽章图标 + */ + @NotBlank(message = "徽章图标不能为空") + private String badgeIcon; + /** + * 徽章状态 上线:online;下线:offline; + */ + @NotBlank(message = "徽章状态不能为空") + private String badgeStatus; + /** + * 认证信息类型数组 手机号:mobile;姓名:fullname;身份证:idcard;认证证件: certificate;认证说明(备注):remark + */ + @NotEmpty(message = "认证信息类型不能为空") + private List certificationTypes; +} diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/EditInfoFormDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/EditInfoFormDTO.java new file mode 100644 index 0000000000..d6d9655b88 --- /dev/null +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/EditInfoFormDTO.java @@ -0,0 +1,52 @@ +package com.epmet.dto.form; + +import lombok.Data; +import lombok.NoArgsConstructor; + +import javax.validation.constraints.NotBlank; +import java.io.Serializable; + +/** + * @author zhaoqifeng + * @dscription + * @date 2020/11/3 9:55 + */ +@NoArgsConstructor +@Data +public class EditInfoFormDTO implements Serializable { + + private static final long serialVersionUID = 1280489016677129419L; + /** + * 头像 + */ + @NotBlank(message = "头像不能为空") + private String userId; + /** + * 头像 + */ + @NotBlank(message = "头像不能为空") + private String headImgUrl; + /** + * 姓 + */ + @NotBlank(message = "姓不能为空") + private String surname; + /** + * 名 + */ + @NotBlank(message = "名不能为空") + private String name; + /** + * 路牌号 + */ + @NotBlank(message = "路牌号不能为空") + private String street; + /** + * 小区名称 + */ + private String district; + /** + * 详细地址 + */ + private String buildingAddress; +} diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/OpenedOrClosedFormDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/OpenedOrClosedFormDTO.java new file mode 100644 index 0000000000..15353d9685 --- /dev/null +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/OpenedOrClosedFormDTO.java @@ -0,0 +1,26 @@ +package com.epmet.dto.form; + +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import java.io.Serializable; + +/** + * @Author zxc + * @DateTime 2020/11/4 5:43 下午 + */ +@Data +public class OpenedOrClosedFormDTO implements Serializable { + + private static final long serialVersionUID = 483466676158603066L; + + public interface OpenedOrClosed{} + + @NotBlank(message = "客户ID不能为空",groups = {OpenedOrClosed.class}) + private String customerId; + + private String userId; + + @NotBlank(message = "徽章ID不能为空",groups = {OpenedOrClosed.class}) + private String badgeId; +} diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/UserBadgeListFormDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/UserBadgeListFormDTO.java new file mode 100644 index 0000000000..2cb7f728dc --- /dev/null +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/UserBadgeListFormDTO.java @@ -0,0 +1,33 @@ +package com.epmet.dto.form; + +import lombok.Data; + +import java.io.Serializable; + +/** + * @Author zxc + * @DateTime 2020/11/3 11:07 上午 + */ +@Data +public class UserBadgeListFormDTO implements Serializable { + + private static final long serialVersionUID = 9002922684993474574L; + + /** + * 用户ID + */ + private String userId; + + /** + * 客户ID + */ + private String customerId; + + public UserBadgeListFormDTO(String userId, String customerId) { + this.userId = userId; + this.customerId = customerId; + } + + public UserBadgeListFormDTO() { + } +} diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/UserOperListFormDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/UserOperListFormDTO.java new file mode 100644 index 0000000000..84578f7abb --- /dev/null +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/UserOperListFormDTO.java @@ -0,0 +1,28 @@ +package com.epmet.dto.form; + +import lombok.AllArgsConstructor; +import lombok.Data; + +import java.io.Serializable; + +/** + * @Author zxc + * @DateTime 2020/11/3 4:18 下午 + */ +@Data +public class UserOperListFormDTO implements Serializable { + + private static final long serialVersionUID = -1872129597916414712L; + + private String userId; + + private String customerId; + + public UserOperListFormDTO(String userId, String customerId) { + this.userId = userId; + this.customerId = customerId; + } + + public UserOperListFormDTO() { + } +} diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/AuthFieldResultDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/AuthFieldResultDTO.java new file mode 100644 index 0000000000..9c68bf19af --- /dev/null +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/AuthFieldResultDTO.java @@ -0,0 +1,40 @@ +package com.epmet.dto.result; + +import lombok.Data; + +import java.io.Serializable; + +/** + * @Author zxc + * @DateTime 2020/11/4 4:54 下午 + */ +@Data +public class AuthFieldResultDTO implements Serializable { + + private static final long serialVersionUID = 1856490232343125419L; + + /** + * 中文名 + */ + private String cnName; + + /** + * 英文名【字段】 + */ + private String enName; + + /** + * 字段类型,text:文本,img:图片 + */ + private String fieldType; + + /** + * 是否必填 + */ + private String isRequired; + + /** + * 排序 + */ + private Integer sort; +} diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/BadgeDetailResultDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/BadgeDetailResultDTO.java new file mode 100644 index 0000000000..311c78f460 --- /dev/null +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/BadgeDetailResultDTO.java @@ -0,0 +1,26 @@ +package com.epmet.dto.result; + +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.io.Serializable; +import java.util.List; + +/** + * @author zhaoqifeng + * @dscription + * @date 2020/11/4 14:17 + */ +@NoArgsConstructor +@Data +public class BadgeDetailResultDTO implements Serializable { + + private static final long serialVersionUID = 7698898330565297328L; + + private String badgeId; + private String badgeName; + private String badgeIcon; + private String badgeStatus; + private List certificationTypes; + +} diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/BadgeListResultDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/BadgeListResultDTO.java new file mode 100644 index 0000000000..8d5d7c28ec --- /dev/null +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/BadgeListResultDTO.java @@ -0,0 +1,31 @@ +package com.epmet.dto.result; + +import lombok.Data; +import lombok.NoArgsConstructor; + +/** + * @author zhaoqifeng + * @dscription + * @date 2020/11/3 16:58 + */ +@NoArgsConstructor +@Data +public class BadgeListResultDTO { + + /** + * 徽章Id + */ + private String badgeId; + /** + * 徽章名称 + */ + private String badgeName; + /** + * 徽章图标url + */ + private String badgeIcon; + /** + * 徽章状态 上线:online;下线:offline; + */ + private String badgeStatus; +} diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/CertificationDetailResultDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/CertificationDetailResultDTO.java new file mode 100644 index 0000000000..4e7298c1b9 --- /dev/null +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/CertificationDetailResultDTO.java @@ -0,0 +1,60 @@ +package com.epmet.dto.result; + +import lombok.Data; + +import java.io.Serializable; + +/** + * @Author zxc + * @DateTime 2020/11/4 3:51 下午 + */ +@Data +public class CertificationDetailResultDTO implements Serializable { + + private static final long serialVersionUID = 6538150132908927308L; + + /** + * 姓 + */ + private String surname; + + /** + * 名 + */ + private String name; + + /** + * 身份证号 + */ + private String idNum; + + /** + * 是否认证 yes 认证 no 已认证 + */ + private String isCertificated; + + /** + * 手机号 + */ + private String mobile; + + /** + * 认证图片地址 + */ + private String certificationImg; + + /** + * 备注 + */ + private String remark; + + /** + * 审核结果 + */ + private String authResult; + + /** + * 驳回原因 + */ + private String authReason; +} diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/UserBadgeListResultDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/UserBadgeListResultDTO.java new file mode 100644 index 0000000000..19fce3bb3c --- /dev/null +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/UserBadgeListResultDTO.java @@ -0,0 +1,49 @@ +package com.epmet.dto.result; + +import com.fasterxml.jackson.annotation.JsonIgnore; +import lombok.Data; + +import java.io.Serializable; + +/** + * @Author zxc + * @DateTime 2020/11/3 11:08 上午 + */ +@Data +public class UserBadgeListResultDTO implements Serializable { + + private static final long serialVersionUID = -6542233940679158922L; + + /** + * 徽章ID + */ + private String badgeId; + + /** + * 徽章图片地址 + */ + private String badgeIcon; + + /** + * 徽章是否点亮 + */ + private String isOpened; + + private String badgeType; + + @JsonIgnore + private String customerId; + @JsonIgnore + private String badgeName; + @JsonIgnore + private String fixationBadgeType; + @JsonIgnore + private Boolean status; + + public UserBadgeListResultDTO() { + this.badgeId = ""; + this.badgeIcon = ""; + this.isOpened = "0"; + this.status = false; + } +} diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/UserOperListResultDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/UserOperListResultDTO.java new file mode 100644 index 0000000000..89f3f98aba --- /dev/null +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/UserOperListResultDTO.java @@ -0,0 +1,67 @@ +package com.epmet.dto.result; + +import com.fasterxml.jackson.annotation.JsonIgnore; +import lombok.Data; + +import java.io.Serializable; + +/** + * @Author zxc + * @DateTime 2020/11/3 4:20 下午 + */ +@Data +public class UserOperListResultDTO implements Serializable { + + private static final long serialVersionUID = -6185696177370545937L; + + /** + * 徽章ID + */ + private String badgeId; + + /** + * 徽章名字 + */ + private String badgeName; + + /** + * 点亮状态 yes:已点亮,no:未点亮 + */ + private String isLighted; + + /** + * 是否认证 yes 认证 no 已认证 + */ + private String isCertificated; + + /** + * 徽章图片地址 + */ + private String badgeIcon; + + /** + * 是否被驳回 true:已驳回,false:未驳回 + */ + private Boolean isReject; + + /** + * 徽章类型:党员徽章;party,无:none + */ + private String badgeType; + + @JsonIgnore + private String customerId; + @JsonIgnore + private String isOpened; + @JsonIgnore + private String auditStatus; + + public UserOperListResultDTO() { + this.badgeId = ""; + this.badgeName = ""; + this.isLighted = "no"; + this.isCertificated = "no"; + this.badgeIcon = ""; + this.isReject = false; + } +} diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/feign/EpmetUserOpenFeignClient.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/feign/EpmetUserOpenFeignClient.java index e7fda8ad3e..7894956294 100644 --- a/epmet-user/epmet-user-client/src/main/java/com/epmet/feign/EpmetUserOpenFeignClient.java +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/feign/EpmetUserOpenFeignClient.java @@ -334,4 +334,50 @@ public interface EpmetUserOpenFeignClient { */ @PostMapping("/epmetuser/customerstaff/getstaffbasicinfo") Result getStaffBasicInfo(@RequestBody StaffBasicInfoFromDTO fromDTO); + + /** + * 修改个人信息 + * @author zhaoqifeng + * @date 2020/11/3 10:28 + * @param formDTO + * @return com.epmet.commons.tools.utils.Result + */ + @PostMapping("/epmetuser/userresiinfo/edituserinfo") + Result editUserInfo(@RequestBody EditInfoFormDTO formDTO); + + /** + * @Description 查询已经点亮的徽章 + * @Param userBadgeListFormDTO + * @author zxc + * @date 2020/11/3 1:33 下午 + */ + @PostMapping("/epmetuser/more/badge/badgelist") + Result> selectBadgeList(@RequestBody UserBadgeListFormDTO userBadgeListFormDTO); + + /** + * @Description 个人中心-获取徽章可操作列表(点亮,取消,认证) + * @Param operListFormDTO + * @author zxc + * @date 2020/11/3 4:28 下午 + */ + @PostMapping("/epmetuser/more/badge/badgeoperlist") + Result> selectOperList(@RequestBody UserOperListFormDTO userOperListFormDTO); + + /** + * @Description 徽章认证提交 + * @Param certificationAddFormDTO + * @author zxc + * @date 2020/11/4 4:30 下午 + */ + @PostMapping("/epmetuser/more/badge/authbadgerecord") + Result authBadgeRecord(@RequestBody CertificationAddFormDTO certificationAddFormDTO); + + /** + * @Description 个人中心-取消/点亮徽章 + * @Param openedOrClosedFormDTO + * @author zxc + * @date 2020/11/5 9:23 上午 + */ + @PostMapping("/epmetuser/more/badge/openedorclosed") + Result openedOrClosed(@RequestBody OpenedOrClosedFormDTO openedOrClosedFormDTO); } diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/feign/fallback/EpmetUserOpenFeignClientFallback.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/feign/fallback/EpmetUserOpenFeignClientFallback.java index 9e0c973463..14117402a9 100644 --- a/epmet-user/epmet-user-client/src/main/java/com/epmet/feign/fallback/EpmetUserOpenFeignClientFallback.java +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/feign/fallback/EpmetUserOpenFeignClientFallback.java @@ -225,4 +225,29 @@ public class EpmetUserOpenFeignClientFallback implements EpmetUserOpenFeignClien public Result getStaffBasicInfo(StaffBasicInfoFromDTO fromDTO) { return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "getStaffBasicInfo", fromDTO); } + + @Override + public Result editUserInfo(EditInfoFormDTO formDTO) { + return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "editUserInfo", formDTO); + } + + @Override + public Result> selectBadgeList(UserBadgeListFormDTO userBadgeListFormDTO) { + return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "selectBadgeList", userBadgeListFormDTO); + } + + @Override + public Result> selectOperList(UserOperListFormDTO userOperListFormDTO) { + return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "selectOperList", userOperListFormDTO); + } + + @Override + public Result authBadgeRecord(CertificationAddFormDTO certificationAddFormDTO) { + return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "authBadgeRecord", certificationAddFormDTO); + } + + @Override + public Result openedOrClosed(OpenedOrClosedFormDTO openedOrClosedFormDTO) { + return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "openedOrClosed", openedOrClosedFormDTO); + } } diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/BadgeController.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/BadgeController.java new file mode 100644 index 0000000000..92a2621013 --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/BadgeController.java @@ -0,0 +1,104 @@ +package com.epmet.controller; + +import com.epmet.commons.tools.annotation.LoginUser; +import com.epmet.commons.tools.security.dto.TokenDto; +import com.epmet.commons.tools.utils.Result; +import com.epmet.commons.tools.validator.ValidatorUtils; +import com.epmet.dto.form.AddBadgeFormDTO; +import com.epmet.dto.form.BadgeFormDTO; +import com.epmet.dto.form.EditBadgeFormDTO; +import com.epmet.dto.result.BadgeDetailResultDTO; +import com.epmet.dto.result.BadgeListResultDTO; +import com.epmet.service.BadgeService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import java.util.List; + +/** + * @author zhaoqifeng + * @dscription + * @date 2020/11/3 16:09 + */ +@RestController +@RequestMapping("badge") +public class BadgeController { + @Autowired + private BadgeService badgeService; + + /** + * 徽章列表 + * @author zhaoqifeng + * @date 2020/11/4 14:27 + * @param tokenDto + * @return com.epmet.commons.tools.utils.Result> + */ + @PostMapping("list") + public Result> list(@LoginUser TokenDto tokenDto) { + List result = badgeService.getList(tokenDto.getCustomerId()); + return new Result>().ok(result); + } + + /** + * 添加徽章 + * @author zhaoqifeng + * @date 2020/11/4 14:27 + * @param tokenDto + * @param formDTO + * @return com.epmet.commons.tools.utils.Result + */ + @PostMapping("add") + public Result add(@LoginUser TokenDto tokenDto, @RequestBody AddBadgeFormDTO formDTO) { + ValidatorUtils.validateEntity(formDTO); + badgeService.add(tokenDto, formDTO); + return new Result(); + } + + /** + * 徽章详情 + * @author zhaoqifeng + * @date 2020/11/4 14:27 + * @param tokenDto + * @param formDTO + * @return com.epmet.commons.tools.utils.Result + */ + @PostMapping("detail") + public Result detail(@LoginUser TokenDto tokenDto, @RequestBody BadgeFormDTO formDTO) { + BadgeDetailResultDTO result = badgeService.detail(tokenDto, formDTO); + return new Result().ok(result); + } + + /** + * 修改 + * @author zhaoqifeng + * @date 2020/11/4 15:32 + * @param tokenDto + * @param formDTO + * @return com.epmet.commons.tools.utils.Result + */ + @PostMapping("edit") + public Result edit(@LoginUser TokenDto tokenDto, @RequestBody EditBadgeFormDTO formDTO) { + ValidatorUtils.validateEntity(formDTO); + badgeService.edit(tokenDto, formDTO); + return new Result(); + } + + /** + * 删除徽章 + * @author zhaoqifeng + * @date 2020/11/4 15:34 + * @param tokenDto + * @param formDTO + * @return com.epmet.commons.tools.utils.Result + */ + @PostMapping("delete") + public Result delete(@LoginUser TokenDto tokenDto, @RequestBody BadgeFormDTO formDTO) { + badgeService.deleteBadge(tokenDto, formDTO); + return new Result(); + } + + +} diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/UserBadgeController.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/UserBadgeController.java new file mode 100644 index 0000000000..c0aa74d53e --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/UserBadgeController.java @@ -0,0 +1,116 @@ +package com.epmet.controller; + +import com.epmet.commons.tools.annotation.LoginUser; +import com.epmet.commons.tools.security.dto.TokenDto; +import com.epmet.commons.tools.utils.Result; +import com.epmet.commons.tools.validator.ValidatorUtils; +import com.epmet.dto.form.*; +import com.epmet.dto.result.AuthFieldResultDTO; +import com.epmet.dto.result.CertificationDetailResultDTO; +import com.epmet.dto.result.UserBadgeListResultDTO; +import com.epmet.dto.result.UserOperListResultDTO; +import com.epmet.service.UserBadgeService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import java.util.List; + +/** + * @Author zxc + * @DateTime 2020/11/3 11:16 上午 + */ +@RestController +@RequestMapping("more/badge") +public class UserBadgeController { + + @Autowired + private UserBadgeService userBadgeService; + + /** + * @Description 查询已经点亮的徽章 + * @Param userBadgeListFormDTO + * @author zxc + * @date 2020/11/3 1:33 下午 + */ + @PostMapping("badgelist") + public Result> selectBadgeList(@RequestBody UserBadgeListFormDTO userBadgeListFormDTO){ + return new Result>().ok(userBadgeService.selectBadgeList(userBadgeListFormDTO)); + } + + /** + * @Description 个人中心-获取徽章可操作列表(点亮,取消,认证) + * @Param userOperListFormDTO + * @author zxc + * @date 2020/11/3 4:42 下午 + */ + @PostMapping("badgeoperlist") + public Result> selectOperList(@RequestBody UserOperListFormDTO userOperListFormDTO){ + return new Result>().ok(userBadgeService.selectOperList(userOperListFormDTO)); + } + + /** + * @Description 个人中心-提交徽章认证 + * @Param certificationAddFormDTO + * @author zxc + * @date 2020/11/4 1:36 下午 + */ + @PostMapping("authbadgerecord") + public Result authBadgeRecord(@RequestBody CertificationAddFormDTO certificationAddFormDTO){ + userBadgeService.authBadgeRecord(certificationAddFormDTO); + return new Result(); + } + + /** + * @Description 发送验证码 + * @Param badgeSendCodeFormDTO + * @author zxc + * @date 2020/11/4 3:14 下午 + */ + @PostMapping("badgesendcode") + public Result badgeSendCode(@RequestBody BadgeSendCodeFormDTO badgeSendCodeFormDTO){ + ValidatorUtils.validateEntity(badgeSendCodeFormDTO, BadgeSendCodeFormDTO.BadgeSendCode.class); + userBadgeService.badgeSendCode(badgeSendCodeFormDTO); + return new Result(); + } + + /** + * @Description 个人中心-获取徽章认证页面详情 + * @Param tokenDto + * @Param certificationDetailFormDTO + * @author zxc + * @date 2020/11/4 4:03 下午 + */ + @PostMapping("certification/detail") + public Result certificationDetail(@LoginUser TokenDto tokenDto,@RequestBody CertificationDetailFormDTO certificationDetailFormDTO){ + ValidatorUtils.validateEntity(certificationDetailFormDTO); + return new Result().ok(userBadgeService.certificationDetail(tokenDto,certificationDetailFormDTO)); + } + + /** + * @Description 个人中心-查询徽章要显示的认证信息字段 + * @Param authFieldFormDTO + * @author zxc + * @date 2020/11/4 5:05 下午 + */ + @PostMapping("authfield") + public Result> authField(@RequestBody AuthFieldFormDTO authFieldFormDTO){ + ValidatorUtils.validateEntity(authFieldFormDTO, AuthFieldFormDTO.AuthField.class); + return new Result>().ok(userBadgeService.authField(authFieldFormDTO)); + } + + /** + * @Description 个人中心-取消/点亮徽章 + * @Param openedOrClosedFormDTO + * @author zxc + * @date 2020/11/4 5:47 下午 + */ + @PostMapping("openedorclosed") + public Result openedOrClosed(@RequestBody OpenedOrClosedFormDTO openedOrClosedFormDTO){ + userBadgeService.openedOrClosed(openedOrClosedFormDTO); + return new Result(); + } + +} diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/UserResiInfoController.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/UserResiInfoController.java index 56a75d64cc..68aea3d580 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/UserResiInfoController.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/UserResiInfoController.java @@ -26,10 +26,7 @@ import com.epmet.commons.tools.validator.group.AddGroup; import com.epmet.commons.tools.validator.group.DefaultGroup; import com.epmet.commons.tools.validator.group.UpdateGroup; import com.epmet.dto.UserResiInfoDTO; -import com.epmet.dto.form.IssueInitiatorFormDTO; -import com.epmet.dto.form.UserResiInfoFormDTO; -import com.epmet.dto.form.UserResiInfoListFormDTO; -import com.epmet.dto.form.VerificationCodeFormDTO; +import com.epmet.dto.form.*; import com.epmet.dto.result.IssueInitiatorResultDTO; import com.epmet.dto.result.UserResiInfoResultDTO; import com.epmet.excel.UserResiInfoExcel; @@ -163,4 +160,17 @@ public class UserResiInfoController { return new Result().ok(userResiInfoService.selectIssueInitiator(formDTO)); } + /** + * 修改个人信息 + * @author zhaoqifeng + * @date 2020/11/3 10:28 + * @param formDTO + * @return com.epmet.commons.tools.utils.Result + */ + @PostMapping("edituserinfo") + public Result editUserInfo(@RequestBody EditInfoFormDTO formDTO) { + userResiInfoService.editUserInfo(formDTO); + return new Result(); + } + } diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/BadgeCertificationConfigDao.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/BadgeCertificationConfigDao.java new file mode 100644 index 0000000000..e60ac24fc5 --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/BadgeCertificationConfigDao.java @@ -0,0 +1,54 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

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

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

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.dao; + +import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.entity.BadgeCertificationConfigEntity; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + * 徽章认证配置 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-11-03 + */ +@Mapper +public interface BadgeCertificationConfigDao extends BaseDao { + /** + * 获取认证信息类型 + * @author zhaoqifeng + * @date 2020/11/4 14:42 + * @param customerId + * @param badgeId + * @return java.util.List + */ + List getCertificationType(@Param("customerId") String customerId, @Param("badgeId") String badgeId); + + /** + * 删除认证信息 + * @author zhaoqifeng + * @date 2020/11/4 14:43 + * @param customerId + * @param badgeId + * @return int + */ + int deleteConfig(@Param("customerId") String customerId, @Param("badgeId") String badgeId); +} \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/BadgeDao.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/BadgeDao.java new file mode 100644 index 0000000000..965f753b6e --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/BadgeDao.java @@ -0,0 +1,108 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

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

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

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.dao; + +import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.dto.result.BadgeDetailResultDTO; +import com.epmet.dto.result.BadgeListResultDTO; +import com.epmet.entity.BadgeEntity; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; +import org.omg.PortableInterceptor.ORBInitInfoPackage.DuplicateName; + +import java.util.List; + +/** + * 徽章 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-11-03 + */ +@Mapper +public interface BadgeDao extends BaseDao { + + /** + * 获取徽章列表 + * @author zhaoqifeng + * @date 2020/11/3 17:30 + * @param customerId + * @return java.util.List + */ + List selectList(@Param("customerId") String customerId); + + /** + * 重名校验 + * @author zhaoqifeng + * @date 2020/11/4 10:40 + * @param customerId + * @param badgeName + * @return java.util.List + */ + List getDuplicateName(@Param("customerId") String customerId, @Param("badgeName") String badgeName); + + /** + * 编辑重名校验 + * @author zhaoqifeng + * @date 2020/11/4 15:09 + * @param customerId + * @param badgeId + * @param badgeName + * @return java.util.List + */ + List getDuplicateNameForEdit(@Param("customerId") String customerId, @Param("badgeId") String badgeId, + @Param("badgeName") String badgeName); + + /** + * 获取徽章详情 + * @author zhaoqifeng + * @date 2020/11/4 14:30 + * @param customerId + * @param badgeId + * @return com.epmet.dto.result.BadgeDetailResultDTO + */ + BadgeDetailResultDTO selectDetail(@Param("customerId") String customerId, @Param("badgeId") String badgeId); + + /** + * 获取徽章信息 + * @author zhaoqifeng + * @date 2020/11/4 15:16 + * @param customerId + * @param badgeId + * @return com.epmet.entity.BadgeEntity + */ + BadgeEntity selectBadgeInfo(@Param("customerId") String customerId, @Param("badgeId") String badgeId); + + /** + * 更新徽章信息 + * @author zhaoqifeng + * @date 2020/11/4 15:38 + * @param entity + * @return void + */ + void updateBadge(BadgeEntity entity); + + /** + * 删除徽章信息 + * @author zhaoqifeng + * @date 2020/11/4 15:39 + * @param customerId + * @param badgeId + * @return void + */ + void deleteBadge(@Param("customerId") String customerId, @Param("badgeId") String badgeId); +} \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/UserBadgeDao.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/UserBadgeDao.java new file mode 100644 index 0000000000..a100a80ec2 --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/UserBadgeDao.java @@ -0,0 +1,95 @@ +package com.epmet.dao; + +import com.epmet.dto.UserBadgeCertificateRecordDTO; +import com.epmet.dto.form.AuthFieldFormDTO; +import com.epmet.dto.form.OpenedOrClosedFormDTO; +import com.epmet.dto.form.UserBadgeListFormDTO; +import com.epmet.dto.result.AuthFieldResultDTO; +import com.epmet.dto.result.CertificationDetailResultDTO; +import com.epmet.dto.result.UserBadgeListResultDTO; +import com.epmet.dto.result.UserOperListResultDTO; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + * @Author zxc + * @DateTime 2020/11/3 1:22 下午 + */ +@Mapper +public interface UserBadgeDao { + + /** + * @Description 查询已经点亮的徽章 + * @Param userBadgeListFormDTO + * @author zxc + * @date 2020/11/3 1:33 下午 + */ + List selectBadgeList(UserBadgeListFormDTO userBadgeListFormDTO); + + /** + * @Description 查询默认徽章和改名后的徽章 + * @Param userBadgeListFormDTO + * @author zxc + * @date 2020/11/3 3:11 下午 + */ + List selectAllBadge(UserBadgeListFormDTO userBadgeListFormDTO); + + /** + * @Description 查询徽章认证记录 + * @Param userId + * @author zxc + * @date 2020/11/3 5:25 下午 + */ + List selectAuthRecord(@Param("userId")String userId); + + /** + * @Description 根据UserId查询个人徽章点亮信息 + * @Param userId + * @author zxc + * @date 2020/11/4 9:32 上午 + */ + List selectBadgeByUserId(@Param("userId")String userId); + + /** + * @Description 用户认证徽章记录表插入 + * @Param userBadgeCertificateRecordDTO + * @author zxc + * @date 2020/11/4 2:13 下午 + */ + void insertUserBadgeCertificateRecord(UserBadgeCertificateRecordDTO userBadgeCertificateRecordDTO); + + /** + * @Description 更新认证徽章记录最新 + * @Param badgeId + * @Param userId + * @author zxc + * @date 2020/11/4 2:16 下午 + */ + void updateCertificateRecordIsLast(@Param("badgeId")String badgeId,@Param("userId")String userId); + + /** + * @Description 查询单个徽章的认证记录 + * @Param userId + * @Param badgeId + * @author zxc + * @date 2020/11/4 4:09 下午 + */ + CertificationDetailResultDTO selectBadgeAuthRecord(@Param("userId")String userId, @Param("badgeId")String badgeId); + + /** + * @Description 个人中心-查询徽章要显示的认证信息字段 + * @Param authFieldFormDTO + * @author zxc + * @date 2020/11/4 5:05 下午 + */ + List selectAuthField(AuthFieldFormDTO authFieldFormDTO); + /** + * @Description 个人中心-取消/点亮徽章 + * @Param openedOrClosedFormDTO + * @author zxc + * @date 2020/11/4 6:04 下午 + */ + void updateIsOpen(OpenedOrClosedFormDTO openedOrClosedFormDTO); +} diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/UserResiInfoDao.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/UserResiInfoDao.java index fee5c2730b..59d42dfc6e 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/UserResiInfoDao.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/UserResiInfoDao.java @@ -87,4 +87,13 @@ public interface UserResiInfoDao extends BaseDao { * @Date 2020/7/22 10:58 **/ UserResiInfoDTO selectByUserId(String userId); + + /** + * 根据用户ID更新 + * @author zhaoqifeng + * @date 2020/11/3 14:16 + * @param entity + * @return void + */ + void updateByUserId(UserResiInfoEntity entity); } diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/BadgeCertificationConfigEntity.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/BadgeCertificationConfigEntity.java new file mode 100644 index 0000000000..90a6001940 --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/BadgeCertificationConfigEntity.java @@ -0,0 +1,56 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

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

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

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

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

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

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.entity; + +import com.baomidou.mybatisplus.annotation.TableName; + +import com.epmet.commons.mybatis.entity.BaseEpmetEntity; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.util.Date; + +/** + * 徽章 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-11-03 + */ +@Data +@EqualsAndHashCode(callSuper=false) +@TableName("badge") +public class BadgeEntity extends BaseEpmetEntity { + + private static final long serialVersionUID = 1L; + + /** + * 客户Id 默认配置id:default + */ + private String customerId; + + /** + * 徽章名称 + */ + private String badgeName; + + /** + * 徽章图标url + */ + private String badgeIcon; + + /** + * 固有徽章类型 前端页面跳转标识,党员徽章:party;无:none + */ + private String fixationBadgeType; + + /** + * 状态 上线:online;下线:offline; + */ + private String badgeStatus; + +} diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/redis/UserBadgeRedis.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/redis/UserBadgeRedis.java new file mode 100644 index 0000000000..5bc394a6ec --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/redis/UserBadgeRedis.java @@ -0,0 +1,69 @@ +package com.epmet.redis; + +import com.alibaba.fastjson.JSON; +import com.epmet.commons.tools.redis.RedisUtils; +import com.epmet.constant.BadgeConstant; +import com.epmet.dto.result.UserBadgeListResultDTO; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +import java.util.List; + +import static com.epmet.commons.tools.redis.RedisUtils.MINUTE_THIRTY_EXPIRE; + +/** + * @Author zxc + * @DateTime 2020/11/3 2:21 下午 + */ +@Component +public class UserBadgeRedis { + + @Autowired + private RedisUtils redisUtils; + + /** + * @Description 获取徽章信息 + * @Param customerId + * @author zxc + * @date 2020/11/3 2:50 下午 + */ + public Object getCustomerBadge(String customerId){ + Object userBadge = redisUtils.hGet(BadgeConstant.BADGE_KEY + customerId, BadgeConstant.BADGE); + return userBadge; + } + + /** + * @Description 存放徽章信息 + * @Param userBadge + * @Param customerId + * @author zxc + * @date 2020/11/3 2:51 下午 + */ + public void setCustomerBadge(List userBadge, String customerId){ + redisUtils.hSet(BadgeConstant.BADGE_KEY+customerId,BadgeConstant.BADGE, JSON.toJSON(userBadge).toString(),-1); + } + + /** + * @Description 存放徽章审核 手机验证码 + * @Param mobile + * @author zxc + * @date 2020/11/5 10:30 上午 + */ + public void saveBadgeSmsCode(String mobile, String smsCode) { + String smsCodeKey = BadgeConstant.SMS_CODE_KEY + mobile; + redisUtils.set(smsCodeKey, smsCode, MINUTE_THIRTY_EXPIRE); + } + + /** + * @Description 获取徽章审核 手机验证码 + * @Param mobile + * @author zxc + * @date 2020/11/5 10:30 上午 + */ + public String getBadgeSmsCode(String mobile) { + String smsCodeKey = BadgeConstant.SMS_CODE_KEY + mobile; + String smsCode = (String) redisUtils.get(smsCodeKey); + return smsCode; + } + +} diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/BadgeCertificationConfigService.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/BadgeCertificationConfigService.java new file mode 100644 index 0000000000..5c14ca740a --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/BadgeCertificationConfigService.java @@ -0,0 +1,127 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

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

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

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.service; + +import com.epmet.commons.mybatis.service.BaseService; +import com.epmet.commons.tools.page.PageData; +import com.epmet.dto.BadgeCertificationConfigDTO; +import com.epmet.entity.BadgeCertificationConfigEntity; + +import java.util.List; +import java.util.Map; + +/** + * 徽章认证配置 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-11-03 + */ +public interface BadgeCertificationConfigService extends BaseService { + + /** + * 默认分页 + * + * @param params + * @return PageData + * @author generator + * @date 2020-11-03 + */ + PageData page(Map params); + + /** + * 默认查询 + * + * @param params + * @return java.util.List + * @author generator + * @date 2020-11-03 + */ + List list(Map params); + + /** + * 单条查询 + * + * @param id + * @return BadgeCertificationConfigDTO + * @author generator + * @date 2020-11-03 + */ + BadgeCertificationConfigDTO get(String id); + + /** + * 默认保存 + * + * @param dto + * @return void + * @author generator + * @date 2020-11-03 + */ + void save(BadgeCertificationConfigDTO dto); + + /** + * 默认更新 + * + * @param dto + * @return void + * @author generator + * @date 2020-11-03 + */ + void update(BadgeCertificationConfigDTO dto); + + /** + * 批量删除 + * + * @param ids + * @return void + * @author generator + * @date 2020-11-03 + */ + void delete(String[] ids); + + /** + * 获取认证信息类型 + * @author zhaoqifeng + * @date 2020/11/4 14:39 + * @param customerId + * @param badgeId + * @return java.util.List + */ + List getCertificationType(String customerId, String badgeId); + + /** + * 保存认证信息配置 + * @author zhaoqifeng + * @date 2020/11/4 15:29 + * @param customerId + * @param badgeId + * @param list + * @return void + */ + void saveConfig(String customerId, String badgeId, List list); + + /** + * 删除配置 + * @author zhaoqifeng + * @date 2020/11/4 15:41 + * @param customerId + * @param badgeId + * @return void + */ + void deleteConfig(String customerId, String badgeId); + +} \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/BadgeService.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/BadgeService.java new file mode 100644 index 0000000000..7b73e28561 --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/BadgeService.java @@ -0,0 +1,150 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

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

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

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.service; + +import com.epmet.commons.mybatis.service.BaseService; +import com.epmet.commons.tools.page.PageData; +import com.epmet.commons.tools.security.dto.TokenDto; +import com.epmet.dto.BadgeDTO; +import com.epmet.dto.form.AddBadgeFormDTO; +import com.epmet.dto.form.BadgeFormDTO; +import com.epmet.dto.form.EditBadgeFormDTO; +import com.epmet.dto.result.BadgeDetailResultDTO; +import com.epmet.dto.result.BadgeListResultDTO; +import com.epmet.entity.BadgeEntity; + +import java.util.List; +import java.util.Map; + +/** + * 徽章 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-11-03 + */ +public interface BadgeService extends BaseService { + + /** + * 默认分页 + * + * @param params + * @return PageData + * @author generator + * @date 2020-11-03 + */ + PageData page(Map params); + + /** + * 默认查询 + * + * @param params + * @return java.util.List + * @author generator + * @date 2020-11-03 + */ + List list(Map params); + + /** + * 单条查询 + * + * @param id + * @return BadgeDTO + * @author generator + * @date 2020-11-03 + */ + BadgeDTO get(String id); + + /** + * 默认保存 + * + * @param dto + * @return void + * @author generator + * @date 2020-11-03 + */ + void save(BadgeDTO dto); + + /** + * 默认更新 + * + * @param dto + * @return void + * @author generator + * @date 2020-11-03 + */ + void update(BadgeDTO dto); + + /** + * 批量删除 + * + * @param ids + * @return void + * @author generator + * @date 2020-11-03 + */ + void delete(String[] ids); + + /** + * 获取徽章列表 + * @author zhaoqifeng + * @date 2020/11/3 17:04 + * @param customerId + * @return java.util.List + */ + List getList(String customerId); + + /** + * 添加徽章 + * @author zhaoqifeng + * @date 2020/11/4 10:09 + * @param tokenDto + * @param formDTO + * @return void + */ + void add(TokenDto tokenDto, AddBadgeFormDTO formDTO); + + /** + * 徽章详情 + * @author zhaoqifeng + * @date 2020/11/4 14:25 + * @param tokenDto + * @param formDTO + * @return com.epmet.dto.result.BadgeDetailResultDTO + */ + BadgeDetailResultDTO detail(TokenDto tokenDto, BadgeFormDTO formDTO); + + /** + * 编辑徽章 + * @author zhaoqifeng + * @date 2020/11/4 14:28 + * @param tokenDto + * @param formDTO + * @return void + */ + void edit(TokenDto tokenDto, EditBadgeFormDTO formDTO); + + /** + * 删除徽章 + * @author zhaoqifeng + * @date 2020/11/4 15:34 + * @param tokenDto + * @param formDTO + * @return void + */ + void deleteBadge(TokenDto tokenDto, BadgeFormDTO formDTO); +} \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/UserBadgeService.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/UserBadgeService.java new file mode 100644 index 0000000000..227584a101 --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/UserBadgeService.java @@ -0,0 +1,76 @@ +package com.epmet.service; + +import com.epmet.commons.tools.security.dto.TokenDto; +import com.epmet.commons.tools.utils.Result; +import com.epmet.dto.form.*; +import com.epmet.dto.result.AuthFieldResultDTO; +import com.epmet.dto.result.CertificationDetailResultDTO; +import com.epmet.dto.result.UserBadgeListResultDTO; +import com.epmet.dto.result.UserOperListResultDTO; + +import java.util.List; + +/** + * @Author zxc + * @DateTime 2020/11/3 11:18 上午 + */ +public interface UserBadgeService { + + /** + * @Description 查询已经点亮的徽章 + * @Param userBadgeListFormDTO + * @author zxc + * @date 2020/11/3 1:33 下午 + */ + List selectBadgeList(UserBadgeListFormDTO userBadgeListFormDTO); + + /** + * @Description 个人中心-获取徽章可操作列表(点亮,取消,认证) + * @Param userOperListFormDTO + * @author zxc + * @date 2020/11/3 4:42 下午 + */ + List selectOperList(UserOperListFormDTO userOperListFormDTO); + + /** + * @Description 个人中心-提交徽章认证 + * @Param certificationAddFormDTO + * @author zxc + * @date 2020/11/4 1:36 下午 + */ + Result authBadgeRecord(CertificationAddFormDTO certificationAddFormDTO); + + /** + * @Description 发送验证码 + * @Param badgeSendCodeFormDTO + * @author zxc + * @date 2020/11/4 3:14 下午 + */ + void badgeSendCode(BadgeSendCodeFormDTO badgeSendCodeFormDTO); + + /** + * @Description 个人中心-获取徽章认证页面详情 + * @Param tokenDto + * @Param certificationDetailFormDTO + * @author zxc + * @date 2020/11/4 4:03 下午 + */ + CertificationDetailResultDTO certificationDetail(TokenDto tokenDto, CertificationDetailFormDTO certificationDetailFormDTO); + + /** + * @Description 个人中心-查询徽章要显示的认证信息字段 + * @Param authFieldFormDTO + * @author zxc + * @date 2020/11/4 5:05 下午 + */ + List authField(AuthFieldFormDTO authFieldFormDTO); + + /** + * @Description 个人中心-取消/点亮徽章 + * @Param openedOrClosedFormDTO + * @author zxc + * @date 2020/11/4 5:47 下午 + */ + void openedOrClosed(OpenedOrClosedFormDTO openedOrClosedFormDTO); + +} diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/UserResiInfoService.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/UserResiInfoService.java index d01c706fd5..11fff3816b 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/UserResiInfoService.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/UserResiInfoService.java @@ -21,10 +21,7 @@ import com.epmet.commons.mybatis.service.BaseService; import com.epmet.commons.tools.page.PageData; import com.epmet.commons.tools.utils.Result; import com.epmet.dto.UserResiInfoDTO; -import com.epmet.dto.form.IssueInitiatorFormDTO; -import com.epmet.dto.form.UserResiInfoFormDTO; -import com.epmet.dto.form.UserResiInfoListFormDTO; -import com.epmet.dto.form.VerificationCodeFormDTO; +import com.epmet.dto.form.*; import com.epmet.dto.result.IssueInitiatorResultDTO; import com.epmet.dto.result.UserResiInfoResultDTO; import com.epmet.entity.UserResiInfoEntity; @@ -151,4 +148,13 @@ public interface UserResiInfoService extends BaseService { * @date 2020/5/11 10:59 */ IssueInitiatorResultDTO selectIssueInitiator(IssueInitiatorFormDTO formDTO); + + /** + * 修改个人信息 + * @author zhaoqifeng + * @date 2020/11/3 10:29 + * @param formDTO + * @return void + */ + void editUserInfo(EditInfoFormDTO formDTO); } diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/BadgeCertificationConfigServiceImpl.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/BadgeCertificationConfigServiceImpl.java new file mode 100644 index 0000000000..2af4587368 --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/BadgeCertificationConfigServiceImpl.java @@ -0,0 +1,149 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

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

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

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; +import com.epmet.commons.tools.page.PageData; +import com.epmet.commons.tools.utils.ConvertUtils; +import com.epmet.commons.tools.constant.FieldConstant; +import com.epmet.dao.BadgeCertificationConfigDao; +import com.epmet.dto.BadgeCertificationConfigDTO; +import com.epmet.entity.BadgeCertificationConfigEntity; +import com.epmet.service.BadgeCertificationConfigService; +import org.apache.commons.collections4.CollectionUtils; +import org.apache.commons.lang3.StringUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.util.Arrays; +import java.util.List; +import java.util.Map; + +/** + * 徽章认证配置 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-11-03 + */ +@Service +public class BadgeCertificationConfigServiceImpl extends BaseServiceImpl implements BadgeCertificationConfigService { + + + @Override + public PageData page(Map params) { + IPage page = baseDao.selectPage( + getPage(params, FieldConstant.CREATED_TIME, false), + getWrapper(params) + ); + return getPageData(page, BadgeCertificationConfigDTO.class); + } + + @Override + public List list(Map params) { + List entityList = baseDao.selectList(getWrapper(params)); + + return ConvertUtils.sourceToTarget(entityList, BadgeCertificationConfigDTO.class); + } + + private QueryWrapper getWrapper(Map params){ + String id = (String)params.get(FieldConstant.ID_HUMP); + + QueryWrapper wrapper = new QueryWrapper<>(); + wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id); + + return wrapper; + } + + @Override + public BadgeCertificationConfigDTO get(String id) { + BadgeCertificationConfigEntity entity = baseDao.selectById(id); + return ConvertUtils.sourceToTarget(entity, BadgeCertificationConfigDTO.class); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void save(BadgeCertificationConfigDTO dto) { + BadgeCertificationConfigEntity entity = ConvertUtils.sourceToTarget(dto, BadgeCertificationConfigEntity.class); + insert(entity); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void update(BadgeCertificationConfigDTO dto) { + BadgeCertificationConfigEntity entity = ConvertUtils.sourceToTarget(dto, BadgeCertificationConfigEntity.class); + updateById(entity); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void delete(String[] ids) { + // 逻辑删除(@TableLogic 注解) + baseDao.deleteBatchIds(Arrays.asList(ids)); + } + + /** + * 获取认证信息类型 + * + * @param customerId + * @param badgeId + * @return java.util.List + * @author zhaoqifeng + * @date 2020/11/4 14:39 + */ + @Override + public List getCertificationType(String customerId, String badgeId) { + List list = baseDao.getCertificationType(customerId, badgeId); + if (CollectionUtils.isEmpty(list)) { + list = baseDao.getCertificationType("default", badgeId); + } + return list; + } + + /** + * 保存认证信息配置 + * + * @param list + * @return void + * @author zhaoqifeng + * @date 2020/11/4 15:28 + */ + @Override + @Transactional(rollbackFor = Exception.class) + public void saveConfig(String customerId, String badgeId, List list) { + baseDao.deleteConfig(customerId, badgeId); + insertBatch(list); + } + + /** + * 删除配置 + * + * @param customerId + * @param badgeId + * @return void + * @author zhaoqifeng + * @date 2020/11/4 15:41 + */ + @Override + public void deleteConfig(String customerId, String badgeId) { + baseDao.deleteConfig(customerId, badgeId); + } + +} \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/BadgeServiceImpl.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/BadgeServiceImpl.java new file mode 100644 index 0000000000..021b0c734a --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/BadgeServiceImpl.java @@ -0,0 +1,248 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

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

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

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; +import com.epmet.commons.tools.constant.NumConstant; +import com.epmet.commons.tools.exception.EpmetErrorCode; +import com.epmet.commons.tools.exception.RenException; +import com.epmet.commons.tools.page.PageData; +import com.epmet.commons.tools.security.dto.TokenDto; +import com.epmet.commons.tools.utils.ConvertUtils; +import com.epmet.commons.tools.constant.FieldConstant; +import com.epmet.constant.BadgeConstant; +import com.epmet.dao.BadgeDao; +import com.epmet.dto.BadgeDTO; +import com.epmet.dto.form.AddBadgeFormDTO; +import com.epmet.dto.form.BadgeFormDTO; +import com.epmet.dto.form.EditBadgeFormDTO; +import com.epmet.dto.result.BadgeDetailResultDTO; +import com.epmet.dto.result.BadgeListResultDTO; +import com.epmet.entity.BadgeCertificationConfigEntity; +import com.epmet.entity.BadgeEntity; +import com.epmet.service.BadgeCertificationConfigService; +import com.epmet.service.BadgeService; +import org.apache.commons.collections4.CollectionUtils; +import org.apache.commons.lang3.StringUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import java.util.Map; + +/** + * 徽章 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-11-03 + */ +@Service +public class BadgeServiceImpl extends BaseServiceImpl implements BadgeService { + + @Autowired + private BadgeCertificationConfigService badgeCertificationConfigService; + + + @Override + public PageData page(Map params) { + IPage page = baseDao.selectPage( + getPage(params, FieldConstant.CREATED_TIME, false), + getWrapper(params) + ); + return getPageData(page, BadgeDTO.class); + } + + @Override + public List list(Map params) { + List entityList = baseDao.selectList(getWrapper(params)); + + return ConvertUtils.sourceToTarget(entityList, BadgeDTO.class); + } + + private QueryWrapper getWrapper(Map params){ + String id = (String)params.get(FieldConstant.ID_HUMP); + + QueryWrapper wrapper = new QueryWrapper<>(); + wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id); + + return wrapper; + } + + @Override + public BadgeDTO get(String id) { + BadgeEntity entity = baseDao.selectById(id); + return ConvertUtils.sourceToTarget(entity, BadgeDTO.class); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void save(BadgeDTO dto) { + BadgeEntity entity = ConvertUtils.sourceToTarget(dto, BadgeEntity.class); + insert(entity); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void update(BadgeDTO dto) { + BadgeEntity entity = ConvertUtils.sourceToTarget(dto, BadgeEntity.class); + updateById(entity); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void delete(String[] ids) { + // 逻辑删除(@TableLogic 注解) + baseDao.deleteBatchIds(Arrays.asList(ids)); + } + + /** + * 获取徽章列表 + * + * @param customerId + * @return java.util.List + * @author zhaoqifeng + * @date 2020/11/3 17:04 + */ + @Override + public List getList(String customerId) { + return baseDao.selectList(customerId); + } + + /** + * 添加徽章 + * + * @param tokenDto + * @param formDTO + * @return void + * @author zhaoqifeng + * @date 2020/11/4 10:09 + */ + @Override + @Transactional(rollbackFor = Exception.class) + public void add(TokenDto tokenDto, AddBadgeFormDTO formDTO) { + //重名校验 + List list = baseDao.getDuplicateName(tokenDto.getCustomerId(), formDTO.getBadgeName()); + if (CollectionUtils.isNotEmpty(list)) { + throw new RenException(EpmetErrorCode.DUPLICATE_BADGE_NAME.getCode()); + } + BadgeEntity entity = ConvertUtils.sourceToTarget(formDTO, BadgeEntity.class); + entity.setCustomerId(tokenDto.getCustomerId()); + entity.setFixationBadgeType(BadgeConstant.NONE); + insert(entity); + //保存徽章认证配置 + List badgeList = new ArrayList<>(); + formDTO.getCertificationTypes().forEach(item -> { + BadgeCertificationConfigEntity badge = new BadgeCertificationConfigEntity(); + badge.setBadgeId(entity.getId()); + badge.setCertificationType(item); + badge.setCustomerId(tokenDto.getCustomerId()); + badgeList.add(badge); + }); + badgeCertificationConfigService.insertBatch(badgeList); + } + + /** + * 徽章详情 + * + * @param tokenDto + * @param formDTO + * @return com.epmet.dto.result.BadgeDetailResultDTO + * @author zhaoqifeng + * @date 2020/11/4 14:25 + */ + @Override + public BadgeDetailResultDTO detail(TokenDto tokenDto, BadgeFormDTO formDTO) { + BadgeDetailResultDTO result = baseDao.selectDetail(tokenDto.getCustomerId(), formDTO.getBadgeId()); + List types = badgeCertificationConfigService.getCertificationType(tokenDto.getCustomerId(), formDTO.getBadgeId()); + result.setCertificationTypes(types); + return result; + } + + /** + * 编辑徽章 + * + * @param tokenDto + * @param formDTO + * @return void + * @author zhaoqifeng + * @date 2020/11/4 14:28 + */ + @Override + @Transactional(rollbackFor = Exception.class) + public void edit(TokenDto tokenDto, EditBadgeFormDTO formDTO) { + //重名校验 + List list = baseDao.getDuplicateNameForEdit(tokenDto.getCustomerId(), formDTO.getBadgeId(), formDTO.getBadgeName()); + if (CollectionUtils.isNotEmpty(list)) { + throw new RenException(EpmetErrorCode.DUPLICATE_BADGE_NAME.getCode()); + } + + BadgeEntity badgeEntity = baseDao.selectBadgeInfo(tokenDto.getCustomerId(), formDTO.getBadgeId()); + if (null == badgeEntity) { + badgeEntity = baseDao.selectBadgeInfo("default", formDTO.getBadgeId()); + badgeEntity.setCustomerId(tokenDto.getCustomerId()); + badgeEntity.setBadgeName(formDTO.getBadgeName()); + badgeEntity.setBadgeIcon(formDTO.getBadgeIcon()); + badgeEntity.setBadgeStatus(formDTO.getBadgeStatus()); + baseDao.insert(badgeEntity); + } else { + badgeEntity.setBadgeName(formDTO.getBadgeName()); + badgeEntity.setBadgeIcon(formDTO.getBadgeIcon()); + badgeEntity.setBadgeStatus(formDTO.getBadgeStatus()); + baseDao.updateBadge(badgeEntity); + } + //保存徽章认证配置 + List badgeList = new ArrayList<>(); + formDTO.getCertificationTypes().forEach(item -> { + BadgeCertificationConfigEntity badge = new BadgeCertificationConfigEntity(); + badge.setBadgeId(formDTO.getBadgeId()); + badge.setCertificationType(item); + badge.setCustomerId(tokenDto.getCustomerId()); + badgeList.add(badge); + }); + badgeCertificationConfigService.saveConfig(tokenDto.getCustomerId(), formDTO.getBadgeId(), badgeList); + } + + /** + * 删除徽章 + * + * @param tokenDto + * @param formDTO + * @return void + * @author zhaoqifeng + * @date 2020/11/4 15:34 + */ + @Override + public void deleteBadge(TokenDto tokenDto, BadgeFormDTO formDTO) { + BadgeEntity badgeEntity = baseDao.selectBadgeInfo(tokenDto.getCustomerId(), formDTO.getBadgeId()); + if (null == badgeEntity) { + badgeEntity = baseDao.selectBadgeInfo("default", formDTO.getBadgeId()); + badgeEntity.setCustomerId(tokenDto.getCustomerId()); + badgeEntity.setDelFlag(NumConstant.ONE_STR); + baseDao.insert(badgeEntity); + } else { + baseDao.deleteBadge(tokenDto.getCustomerId(), formDTO.getBadgeId()); + } + badgeCertificationConfigService.deleteConfig(tokenDto.getCustomerId(), formDTO.getBadgeId()); + } + +} \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/UserBadgeServiceImpl.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/UserBadgeServiceImpl.java new file mode 100644 index 0000000000..33a4d0a922 --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/UserBadgeServiceImpl.java @@ -0,0 +1,239 @@ +package com.epmet.service.impl; + +import com.alibaba.fastjson.JSON; +import com.epmet.commons.tools.constant.NumConstant; +import com.epmet.commons.tools.exception.EpmetErrorCode; +import com.epmet.commons.tools.exception.RenException; +import com.epmet.commons.tools.security.dto.TokenDto; +import com.epmet.commons.tools.utils.ConvertUtils; +import com.epmet.commons.tools.utils.Result; +import com.epmet.commons.tools.validator.PhoneValidatorUtils; +import com.epmet.constant.BadgeConstant; +import com.epmet.constant.SmsTemplateConstant; +import com.epmet.dao.UserBadgeDao; +import com.epmet.dto.UserBadgeCertificateRecordDTO; +import com.epmet.dto.form.*; +import com.epmet.dto.result.*; +import com.epmet.feign.EpmetMessageOpenFeignClient; +import com.epmet.redis.UserBadgeRedis; +import com.epmet.service.UserBadgeService; +import com.epmet.service.UserBaseInfoService; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang3.StringUtils; +import org.springframework.beans.BeanUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; +import org.springframework.util.CollectionUtils; + +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; + +/** + * @Author zxc + * @DateTime 2020/11/3 11:18 上午 + */ +@Service +@Slf4j +public class UserBadgeServiceImpl implements UserBadgeService { + + @Autowired + private UserBadgeDao userBadgeDao; + @Autowired + private UserBadgeRedis userBadgeRedis; + @Autowired + private UserBaseInfoService userBaseInfoService; + @Autowired + private EpmetMessageOpenFeignClient epmetMessageOpenFeignClient; + + /** + * @Description 查询已经点亮的徽章 + * @Param userBadgeListFormDTO + * @author zxc + * @date 2020/11/3 1:33 下午 + */ + @Override + public List selectBadgeList(UserBadgeListFormDTO userBadgeListFormDTO) { + Object userBadge = userBadgeRedis.getCustomerBadge(userBadgeListFormDTO.getCustomerId()); + if (null == userBadge){ + List resultUserBadge = new ArrayList<>(); + List userBadgeListResultDTOS = userBadgeDao.selectAllBadge(userBadgeListFormDTO); + if (!CollectionUtils.isEmpty(userBadgeListResultDTOS)){ + Map> groupByCustomer = userBadgeListResultDTOS.stream().collect(Collectors.groupingBy(UserBadgeListResultDTO::getCustomerId)); + resultUserBadge.addAll(groupByCustomer.get(BadgeConstant.DEFAULT_CUSTOMER)); + List badgeByCustomer = groupByCustomer.get(userBadgeListFormDTO.getCustomerId()); + resultUserBadge.forEach(r -> { + badgeByCustomer.forEach(b -> { + if (r.getBadgeId().equals(b.getBadgeId())){ + BeanUtils.copyProperties(b,r); + } + }); + }); + userBadgeRedis.setCustomerBadge(resultUserBadge,userBadgeListFormDTO.getCustomerId()); + userBadge = userBadgeRedis.getCustomerBadge(userBadgeListFormDTO.getCustomerId()); + } + } + List redisUserBadgeList = JSON.parseArray(userBadge.toString(), UserBadgeListResultDTO.class); + List userBadgeListResultDTOS = userBadgeDao.selectBadgeList(userBadgeListFormDTO); + if (CollectionUtils.isEmpty(userBadgeListResultDTOS)){ + return redisUserBadgeList; + } + redisUserBadgeList.forEach(u -> { + userBadgeListResultDTOS.forEach(badge -> { + if (u.getBadgeId().equals(badge.getBadgeId())){ + badge.setBadgeIcon(u.getBadgeIcon()); + u.setStatus(true); + } + }); + }); + redisUserBadgeList.forEach(u -> { + if (!u.getStatus()){ + userBadgeListResultDTOS.add(u); + } + }); + return userBadgeListResultDTOS; + } + + /** + * @Description 个人中心-获取徽章可操作列表(点亮,取消,认证) + * @Param userOperListFormDTO + * @author zxc + * @date 2020/11/3 4:42 下午 + */ + @Override + public List selectOperList(UserOperListFormDTO userOperListFormDTO) { + List userAuthBadgeList = userBadgeDao.selectAuthRecord(userOperListFormDTO.getUserId()); + Object userBadge = userBadgeRedis.getCustomerBadge(userOperListFormDTO.getCustomerId()); + List userOperListResultDTOS = JSON.parseArray(userBadge.toString(), UserOperListResultDTO.class); + // 没有任何记录 + if (CollectionUtils.isEmpty(userAuthBadgeList)){ + userOperListResultDTOS.forEach(u -> { + u.setIsLighted(u.getIsOpened().equals(NumConstant.ZERO_STR) ? BadgeConstant.NO : BadgeConstant.YES); + u.setIsCertificated(BadgeConstant.NO); + u.setIsReject(false); + }); + return userOperListResultDTOS; + } + List badgeIsOpenedList = userBadgeDao.selectBadgeByUserId(userOperListFormDTO.getUserId()); + userOperListResultDTOS.forEach(ub -> { + userAuthBadgeList.forEach(u -> { + if (ub.getBadgeId().equals(u.getBadgeId())){ + ub.setIsReject(u.getAuditStatus().equals(BadgeConstant.REJECTED) ? true : false); + ub.setIsCertificated(u.getAuditStatus().equals(BadgeConstant.APPROVED) ? BadgeConstant.YES : BadgeConstant.NO); + } + }); + if (CollectionUtils.isEmpty(badgeIsOpenedList)){ + ub.setIsLighted(BadgeConstant.NO); + }else { + badgeIsOpenedList.forEach(b -> { + if (ub.getBadgeId().equals(b.getBadgeId())){ + ub.setIsLighted(b.getIsOpened().equals(NumConstant.ZERO_STR) ? BadgeConstant.NO : BadgeConstant.YES); + } + }); + } + }); + return userOperListResultDTOS; + } + + /** + * @Description 个人中心-提交徽章认证 + * @Param certificationAddFormDTO + * @author zxc + * @date 2020/11/4 1:36 下午 + */ + @Override + @Transactional(rollbackFor = Exception.class) + public Result authBadgeRecord(CertificationAddFormDTO certificationAddFormDTO) { + if (StringUtils.isNotBlank(certificationAddFormDTO.getMobile())){ + String smsCode = userBadgeRedis.getBadgeSmsCode(certificationAddFormDTO.getMobile()); + if (!StringUtils.isNotBlank(smsCode)){ + return new Result().error(EpmetErrorCode.MOBILE_CODE_ERROR.getCode()); + } + } + UserBadgeCertificateRecordDTO form = ConvertUtils.sourceToTarget(certificationAddFormDTO, UserBadgeCertificateRecordDTO.class); + List userIds = new ArrayList<>(); + userIds.add(certificationAddFormDTO.getUserId()); + List userBaseInfoResultDTOS = userBaseInfoService.queryUserBaseInfo(userIds); + if (CollectionUtils.isEmpty(userBaseInfoResultDTOS)){ + throw new RenException("查询用户基本信息集合为空......"); + } + userBadgeDao.updateCertificateRecordIsLast(form.getBadgeId(),form.getUserId()); + form.setGridId(userBaseInfoResultDTOS.get(NumConstant.ZERO).getRegisteredGridId()); + form.setIdNum(certificationAddFormDTO.getIdCard()); + form.setCertificationImg(certificationAddFormDTO.getCertificate()); + form.setSurname(certificationAddFormDTO.getSubName()); + userBadgeDao.insertUserBadgeCertificateRecord(form); + return new Result(); + } + + /** + * @Description 发送验证码 + * @Param badgeSendCodeFormDTO + * @author zxc + * @date 2020/11/4 3:14 下午 + */ + @Override + public void badgeSendCode(BadgeSendCodeFormDTO badgeSendCodeFormDTO) { + //1、校验手机号是否符合规范 + if (!PhoneValidatorUtils.isMobile(badgeSendCodeFormDTO.getMobile())) { + log.error(String.format("发送短信验证码异常,手机号[%s],code[%s],msg[%s]", badgeSendCodeFormDTO.getMobile(), EpmetErrorCode.ERROR_PHONE.getCode(), EpmetErrorCode.ERROR_PHONE.getMsg())); + throw new RenException(EpmetErrorCode.ERROR_PHONE.getCode()); + } + //3、发送短信验证码 + SendVerificationCodeFormDTO sendVerificationCodeFormDTO=new SendVerificationCodeFormDTO(); + sendVerificationCodeFormDTO.setMobile(badgeSendCodeFormDTO.getMobile()); + sendVerificationCodeFormDTO.setAliyunTemplateCode(SmsTemplateConstant.LGOIN_CONFIRM); + Result smsCodeResult=epmetMessageOpenFeignClient.sendVerificationCode(sendVerificationCodeFormDTO); + if (!smsCodeResult.success()) { + log.error(String.format("发送短信验证码异常,手机号[%s],code[%s],msg[%s]", badgeSendCodeFormDTO.getMobile(), smsCodeResult.getCode(), smsCodeResult.getMsg())); + throw new RenException(smsCodeResult.getCode()); + } + //4、保存短信验证码(删除现有短信验证码、将新的短信验证码存入Redis) + userBadgeRedis.saveBadgeSmsCode(badgeSendCodeFormDTO.getMobile(),smsCodeResult.getData().getCode()); + log.info(String.format("发送短信验证码成功,手机号[%s]", badgeSendCodeFormDTO.getMobile())); + } + + /** + * @Description 个人中心-获取徽章认证页面详情 + * @Param tokenDto + * @Param certificationDetailFormDTO + * @author zxc + * @date 2020/11/4 4:03 下午 + */ + @Override + public CertificationDetailResultDTO certificationDetail(TokenDto tokenDto, CertificationDetailFormDTO certificationDetailFormDTO) { + certificationDetailFormDTO.setUserId(tokenDto.getUserId()); + return userBadgeDao.selectBadgeAuthRecord(certificationDetailFormDTO.getUserId(), certificationDetailFormDTO.getBadgeId()); + } + + + /** + * @Description 个人中心-查询徽章要显示的认证信息字段 + * @Param authFieldFormDTO + * @author zxc + * @date 2020/11/4 5:05 下午 + */ + @Override + public List authField(AuthFieldFormDTO authFieldFormDTO) { + List authFieldResultDTOS = userBadgeDao.selectAuthField(authFieldFormDTO); + if (CollectionUtils.isEmpty(authFieldResultDTOS)){ + return new ArrayList<>(); + } + return authFieldResultDTOS; + } + + /** + * @Description 个人中心-取消/点亮徽章 + * @Param openedOrClosedFormDTO + * @author zxc + * @date 2020/11/4 5:47 下午 + */ + @Override + @Transactional(rollbackFor = Exception.class) + public void openedOrClosed(OpenedOrClosedFormDTO openedOrClosedFormDTO) { + userBadgeDao.updateIsOpen(openedOrClosedFormDTO); + } + +} diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/UserResiInfoServiceImpl.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/UserResiInfoServiceImpl.java index e8148b7418..c86ed47eaf 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/UserResiInfoServiceImpl.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/UserResiInfoServiceImpl.java @@ -325,4 +325,22 @@ public class UserResiInfoServiceImpl extends BaseServiceImpl + + + + + + + + + + + + + + + + + + DELETE a + FROM + badge_certification_config a + WHERE + EXISTS ( + SELECT + * + FROM + ( SELECT ID FROM badge_certification_config + WHERE CUSTOMER_ID = #{customerId} + AND BADGE_ID = #{badgeId} + AND DEL_FLAG = '0' ) b + WHERE + a.ID = b.ID) + + + + + \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/resources/mapper/BadgeDao.xml b/epmet-user/epmet-user-server/src/main/resources/mapper/BadgeDao.xml new file mode 100644 index 0000000000..322604bc70 --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/resources/mapper/BadgeDao.xml @@ -0,0 +1,116 @@ + + + + + + + + + + + + + + + + + + + + + update badge set + BADGE_NAME = #{badgeName}, + BADGE_ICON = #{badgeIcon}, + BADGE_STATUS = #{badgeStatus} + where ID = #{id} AND CUSTOMER_ID = #{customerId} + + + + update badge set + DEL_FLAG = '1' + where ID = #{badgeId} AND CUSTOMER_ID = #{customerId} + + + + + + + + + \ No newline at end of file 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 new file mode 100644 index 0000000000..436898cc61 --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/resources/mapper/UserBadgeDao.xml @@ -0,0 +1,175 @@ + + + + + + + + UPDATE user_badge_certificate_record + SET is_last = 'no' + WHERE DEL_FLAG = '0' + AND BADGE_ID = #{badgeId} + AND USER_ID = #{userId} + + + + + UPDATE resi_user_badge + SET IS_OPENED = (case when IS_OPENED = 1 THEN 0 ELSE 1 END), + UPDATED_TIME = NOW() + WHERE DEL_FLAG = '0' + AND USER_ID = #{userId} + AND BADGE_ID = #{badgeId} + + + + + + + + + + + + + + + + + + + + + + + INSERT INTO user_badge_certificate_record ( + ID, + CUSTOMER_ID, + GRID_ID, + USER_ID, + BADGE_ID, + SURNAME, + NAME, + MOBILE, + ID_NUM, + CERTIFICATION_IMG, + REMAEK, + AUDIT_STATUS, + AUDIT_REMARK, + STAFF_ID, + AUDIT_TIME, + IS_LAST, + DEL_FLAG, + REVISION, + CREATED_BY, + CREATED_TIME, + UPDATED_BY, + UPDATED_TIME + ) + VALUES + ( + REPLACE ( UUID(), '-', '' ), + #{customerId}, + #{gridId}, + #{userId}, + #{badgeId}, + #{surname}, + #{name}, + #{mobile}, + #{idNum}, + #{certificationImg}, + #{remark}, + #{auditStatus}, + #{auditRemark}, + #{staffId}, + #{auditTime}, + #{isLast}, + #{delFlag}, + #{revision}, + #{createdBy}, + NOW(), + #{updatedBy}, + NOW() + ) + + + diff --git a/epmet-user/epmet-user-server/src/main/resources/mapper/UserResiInfoDao.xml b/epmet-user/epmet-user-server/src/main/resources/mapper/UserResiInfoDao.xml index fc345f9fd2..0dddb3b46c 100644 --- a/epmet-user/epmet-user-server/src/main/resources/mapper/UserResiInfoDao.xml +++ b/epmet-user/epmet-user-server/src/main/resources/mapper/UserResiInfoDao.xml @@ -37,6 +37,16 @@ uri.updated_by AS "updatedby", uri.updated_time AS "updatedtime" + + update user_resi_info set + SURNAME = #{surname}, + NAME = #{name}, + STREET = #{street}, + DISTRICT = #{district}, + BUILDING_ADDRESS = #{buildingAddress} + where USER_ID = #{userId} + and DEL_FLAG = '0' +