diff --git a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/resi/ResiVolunteerInfoResultDTO.java b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/resi/ResiVolunteerInfoResultDTO.java new file mode 100644 index 0000000000..20995ac5a4 --- /dev/null +++ b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/resi/ResiVolunteerInfoResultDTO.java @@ -0,0 +1,86 @@ +package com.epmet.dto.result.resi; +import lombok.Data; + +import java.io.Serializable; + +/** + * 志愿者信息+用户基础信息 返回值 + * @Auther: zhangyong + * @Date: 2020-07-28 14:40 + */ + +@Data +public class ResiVolunteerInfoResultDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 用户id + */ + private String userId; + + /** + * 手机号(注册手机号) + */ + private String mobile; + + /** + * 姓氏 + */ + private String surname; + + /** + * 名 + */ + private String name; + + /** + * 姓名 + */ + private String realName; + + /** + * 身份证号 + */ + private String idNum; + + /** + * 性别(1男2女0未知) + */ + private String gender; + + /** + * 街道 + */ + private String street; + + /** + * 小区名称 + */ + private String district; + + /** + * 楼栋单元 + */ + private String buildingAddress; + + /** + * 昵称(目前来源于微信昵称,后续系统可支持用户有昵称) + */ + private String nickname; + + /** + * 头像(目前来源于微信,后续系统顾客支持上传头像) + */ + private String headImgUrl; + + /** + * 志愿者签名 + */ + private String volunteerSignature; + + /** + * 志愿者自我介绍 + */ + private String volunteerIntroduce; +} diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/ResiVolunteerController.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/ResiVolunteerController.java index a2768b99bd..4125f45f5f 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/ResiVolunteerController.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/ResiVolunteerController.java @@ -23,6 +23,8 @@ import com.epmet.commons.tools.utils.Result; import com.epmet.commons.tools.validator.ValidatorUtils; import com.epmet.dto.form.resi.ResiActUserCancelSignUpFormDTO; import com.epmet.dto.form.resi.ResiVolunteerAuthenticateFormDTO; +import com.epmet.dto.result.ResiUserBaseInfoResultDTO; +import com.epmet.dto.result.resi.ResiVolunteerInfoResultDTO; import com.epmet.service.VolunteerInfoService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.PostMapping; @@ -44,9 +46,30 @@ public class ResiVolunteerController { @Autowired private VolunteerInfoService volunteerInfoService; + /** + * 志愿者认证 + * @param tokenDto + * @param formDTO + * @return com.epmet.commons.tools.utils.Result + * @Author zhangyong + * @Date 13:59 2020-07-30 + **/ @PostMapping("authenticate") public Result authenticate(@LoginUser TokenDto tokenDto, @RequestBody ResiVolunteerAuthenticateFormDTO formDTO) { ValidatorUtils.validateEntity(formDTO, ResiVolunteerAuthenticateFormDTO.AddUserInternalGroup.class, ResiVolunteerAuthenticateFormDTO.AddUserShowGroup.class); return volunteerInfoService.authenticate(tokenDto, formDTO); } + + /** + * 志愿者认证界面,获取用户基础信息+志愿者信息 + * + * @param tokenDTO + * @return com.epmet.commons.tools.utils.Result + * @Author zhangyong + * @Date 15:20 2020-07-28 + **/ + @PostMapping("selectvolunteerinfo") + public Result selectVolunteerInfo(@LoginUser TokenDto tokenDTO){ + return volunteerInfoService.selecVolunteerInfoByUserId(tokenDTO); + } } diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/VolunteerInfoDao.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/VolunteerInfoDao.java index 5ceec37857..7b557dbaa1 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/VolunteerInfoDao.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/VolunteerInfoDao.java @@ -18,6 +18,7 @@ package com.epmet.dao; import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.dto.VolunteerInfoDTO; import com.epmet.entity.VolunteerInfoEntity; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; @@ -52,4 +53,14 @@ public interface VolunteerInfoDao extends BaseDao { * @Date 15:05 2020-07-23 **/ void updateVolunteerInfoByUserId(VolunteerInfoEntity entity); + + /** + * 根据用户id,查询志愿者信息 + * + * @param userId + * @return java.lang.String + * @Author zhangyong + * @Date 14:33 2020-07-23l + **/ + VolunteerInfoDTO selectVolunteerInfoByUserId(@Param("userId") String userId); } diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/VolunteerInfoService.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/VolunteerInfoService.java index 6938871d5b..0ca916c51d 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/VolunteerInfoService.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/VolunteerInfoService.java @@ -23,6 +23,7 @@ import com.epmet.commons.tools.security.dto.TokenDto; import com.epmet.commons.tools.utils.Result; import com.epmet.dto.VolunteerInfoDTO; import com.epmet.dto.form.resi.ResiVolunteerAuthenticateFormDTO; +import com.epmet.dto.result.resi.ResiVolunteerInfoResultDTO; import com.epmet.entity.VolunteerInfoEntity; import java.util.List; @@ -47,4 +48,13 @@ public interface VolunteerInfoService extends BaseService { **/ Result authenticate(TokenDto tokenDto, ResiVolunteerAuthenticateFormDTO formDTO); + /** + * 志愿者认证界面,获取用户基础信息+志愿者信息 + * + * @param tokenDto + * @return com.epmet.commons.tools.utils.Result + * @Author zhangyong + * @Date 14:05 2020-07-30 + **/ + Result selecVolunteerInfoByUserId(TokenDto tokenDto); } diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/VolunteerInfoServiceImpl.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/VolunteerInfoServiceImpl.java index 7d219aca27..15b2519c4d 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/VolunteerInfoServiceImpl.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/VolunteerInfoServiceImpl.java @@ -24,6 +24,7 @@ import com.epmet.commons.tools.constant.NumConstant; import com.epmet.commons.tools.dto.form.mq.MqBaseMsgDTO; import com.epmet.commons.tools.dto.form.mq.eventmsg.BasePointEventMsg; import com.epmet.commons.tools.enums.EventEnum; +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; @@ -31,8 +32,11 @@ import com.epmet.commons.tools.utils.SendMqMsgUtils; import com.epmet.constant.ActMessageConstant; import com.epmet.dao.VolunteerInfoDao; import com.epmet.dto.HeartUserInfoDTO; +import com.epmet.dto.VolunteerInfoDTO; import com.epmet.dto.form.WxUserInfoFormDTO; import com.epmet.dto.form.resi.ResiVolunteerAuthenticateFormDTO; +import com.epmet.dto.result.ResiUserBaseInfoResultDTO; +import com.epmet.dto.result.resi.ResiVolunteerInfoResultDTO; import com.epmet.entity.VolunteerInfoEntity; import com.epmet.feign.EpmetUserOpenFeignClient; import com.epmet.redis.VolunteerInfoRedis; @@ -134,4 +138,26 @@ public class VolunteerInfoServiceImpl extends BaseServiceImpl selecVolunteerInfoByUserId(TokenDto tokenDto) { + ResiVolunteerInfoResultDTO resultDTO = new ResiVolunteerInfoResultDTO(); + // 获取用户基本信息 + Result userBaseInfo = epmetUserOpenFeignClient.selectUserBaseInfo(tokenDto); + if (userBaseInfo.success()){ + resultDTO = ConvertUtils.sourceToTarget(userBaseInfo.getData(), ResiVolunteerInfoResultDTO.class); + // 判断是不是志愿者 + Integer volunteerFlag = baseDao.queryVolunteerFlagByUserId(tokenDto.getUserId()); + if (volunteerFlag > NumConstant.ZERO){ + // 获取志愿者信息 + VolunteerInfoDTO dto = baseDao.selectVolunteerInfoByUserId(tokenDto.getUserId()); + resultDTO.setVolunteerIntroduce(dto.getVolunteerIntroduce()); + resultDTO.setVolunteerSignature(dto.getVolunteerSignature()); + } + } else { + logger.error("获取用户基本信息失败"); + throw new RenException("获取用户基本信息失败!"); + } + return new Result().ok(resultDTO); + } } diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/VolunteerInfoDao.xml b/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/VolunteerInfoDao.xml index 3555334a07..13d1cb7660 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/VolunteerInfoDao.xml +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/VolunteerInfoDao.xml @@ -44,4 +44,14 @@ WHERE DEL_FLAG = '0' AND USER_ID = #{userId} + + 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 67c3a83204..5aa0a5e9dd 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 @@ -1,6 +1,8 @@ package com.epmet.feign; +import com.epmet.commons.tools.annotation.LoginUser; import com.epmet.commons.tools.constant.ServiceConstant; +import com.epmet.commons.tools.security.dto.TokenDto; import com.epmet.commons.tools.utils.Result; import com.epmet.dto.CustomerStaffDTO; import com.epmet.dto.GovStaffRoleDTO; @@ -11,10 +13,7 @@ import com.epmet.dto.result.*; import com.epmet.feign.fallback.EpmetUserOpenFeignClientFallback; import org.springframework.cloud.openfeign.FeignClient; import org.springframework.http.MediaType; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.PathVariable; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.*; import java.util.List; @@ -229,4 +228,15 @@ public interface EpmetUserOpenFeignClient { **/ @GetMapping(value = "epmetuser/customerstaff/getCustsomerStaffByIdAndPhone") Result> getCustsomerStaffByIdAndPhone(@RequestBody ThirdCustomerStaffFormDTO formDTO); + + /** + * 获取用户基础信息 + * + * @param tokenDTO + * @return com.epmet.commons.tools.utils.Result + * @Author zhangyong + * @Date 14:10 2020-07-30 + **/ + @PostMapping("/epmetuser/userbaseinfo/selectuserbaseinfo") + Result selectUserBaseInfo(@RequestBody TokenDto tokenDTO); } 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 0637ffc307..9c3fc1d0ba 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 @@ -1,6 +1,7 @@ package com.epmet.feign.fallback; import com.epmet.commons.tools.constant.ServiceConstant; +import com.epmet.commons.tools.security.dto.TokenDto; import com.epmet.commons.tools.utils.ModuleUtils; import com.epmet.commons.tools.utils.Result; import com.epmet.dto.CustomerStaffDTO; @@ -167,4 +168,9 @@ public class EpmetUserOpenFeignClientFallback implements EpmetUserOpenFeignClien public Result> getCustsomerStaffByIdAndPhone(ThirdCustomerStaffFormDTO formDTO) { return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "getCustsomerStaffByIdAndPhone", formDTO); } + + @Override + public Result selectUserBaseInfo(TokenDto tokenDTO) { + return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "selectUserBaseInfo", tokenDTO); + } } diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/UserBaseInfoController.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/UserBaseInfoController.java index 2273048c93..26c6cf8c3c 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/UserBaseInfoController.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/UserBaseInfoController.java @@ -158,8 +158,8 @@ public class UserBaseInfoController { * @Author zhangyong * @Date 15:20 2020-07-28 **/ - @PostMapping("selecuserbaseinfo") - public Result selecUserBaseInfo(@LoginUser TokenDto tokenDTO){ + @PostMapping("selectuserbaseinfo") + public Result selectUserBaseInfo(@LoginUser TokenDto tokenDTO){ return userBaseInfoService.selecUserBaseInfoByUserId(tokenDTO.getUserId()); } }