Browse Source

志愿者信息查询

master
zhangyongzhangyong 5 years ago
parent
commit
ee039c628b
  1. 86
      epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/resi/ResiVolunteerInfoResultDTO.java
  2. 23
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/ResiVolunteerController.java
  3. 11
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/VolunteerInfoDao.java
  4. 10
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/VolunteerInfoService.java
  5. 26
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/VolunteerInfoServiceImpl.java
  6. 10
      epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/VolunteerInfoDao.xml
  7. 18
      epmet-user/epmet-user-client/src/main/java/com/epmet/feign/EpmetUserOpenFeignClient.java
  8. 6
      epmet-user/epmet-user-client/src/main/java/com/epmet/feign/fallback/EpmetUserOpenFeignClientFallback.java
  9. 4
      epmet-user/epmet-user-server/src/main/java/com/epmet/controller/UserBaseInfoController.java

86
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;
}

23
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<com.epmet.dto.result.resi.ResiVolunteerInfoResultDTO>
* @Author zhangyong
* @Date 15:20 2020-07-28
**/
@PostMapping("selectvolunteerinfo")
public Result<ResiVolunteerInfoResultDTO> selectVolunteerInfo(@LoginUser TokenDto tokenDTO){
return volunteerInfoService.selecVolunteerInfoByUserId(tokenDTO);
}
}

11
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<VolunteerInfoEntity> {
* @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);
}

10
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<VolunteerInfoEntity> {
**/
Result authenticate(TokenDto tokenDto, ResiVolunteerAuthenticateFormDTO formDTO);
/**
* 志愿者认证界面获取用户基础信息+志愿者信息
*
* @param tokenDto
* @return com.epmet.commons.tools.utils.Result<com.epmet.dto.result.resi.ResiVolunteerInfoResultDTO>
* @Author zhangyong
* @Date 14:05 2020-07-30
**/
Result<ResiVolunteerInfoResultDTO> selecVolunteerInfoByUserId(TokenDto tokenDto);
}

26
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<VolunteerInfoDao,
wxUserInfoFormDTO.setGender(formDTO.getGender());
return wxUserInfoFormDTO;
}
@Override
public Result<ResiVolunteerInfoResultDTO> selecVolunteerInfoByUserId(TokenDto tokenDto) {
ResiVolunteerInfoResultDTO resultDTO = new ResiVolunteerInfoResultDTO();
// 获取用户基本信息
Result<ResiUserBaseInfoResultDTO> 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<ResiVolunteerInfoResultDTO>().ok(resultDTO);
}
}

10
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}
</update>
<select id="selectVolunteerInfoByUserId" parameterType="java.lang.String" resultType="com.epmet.dto.VolunteerInfoDTO">
SELECT
CUSTOMER_ID customerId,
VOLUNTEER_INTRODUCE volunteerIntroduce,
VOLUNTEER_SIGNATURE volunteerSignature
FROM volunteer_info
WHERE DEL_FLAG = '0'
AND USER_ID = #{userId}
</select>
</mapper>

18
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<List<CustomerStaffDTO>> getCustsomerStaffByIdAndPhone(@RequestBody ThirdCustomerStaffFormDTO formDTO);
/**
* 获取用户基础信息
*
* @param tokenDTO
* @return com.epmet.commons.tools.utils.Result<com.epmet.dto.result.ResiUserBaseInfoResultDTO>
* @Author zhangyong
* @Date 14:10 2020-07-30
**/
@PostMapping("/epmetuser/userbaseinfo/selectuserbaseinfo")
Result<ResiUserBaseInfoResultDTO> selectUserBaseInfo(@RequestBody TokenDto tokenDTO);
}

6
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<List<CustomerStaffDTO>> getCustsomerStaffByIdAndPhone(ThirdCustomerStaffFormDTO formDTO) {
return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "getCustsomerStaffByIdAndPhone", formDTO);
}
@Override
public Result<ResiUserBaseInfoResultDTO> selectUserBaseInfo(TokenDto tokenDTO) {
return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "selectUserBaseInfo", tokenDTO);
}
}

4
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<ResiUserBaseInfoResultDTO> selecUserBaseInfo(@LoginUser TokenDto tokenDTO){
@PostMapping("selectuserbaseinfo")
public Result<ResiUserBaseInfoResultDTO> selectUserBaseInfo(@LoginUser TokenDto tokenDTO){
return userBaseInfoService.selecUserBaseInfoByUserId(tokenDTO.getUserId());
}
}

Loading…
Cancel
Save