Browse Source

Merge remote-tracking branch 'remotes/origin/dev_heart' into dev

dev_shibei_match
jianjun 5 years ago
parent
commit
43201802cd
  1. 25
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/VolunteerInfoServiceImpl.java
  2. 6
      epmet-module/epmet-heart/epmet-heart-server/src/main/resources/bootstrap.yml
  3. 3
      epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/ActInfoDao.xml
  4. 1
      epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/ActLiveRecDao.xml
  5. 2
      epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/config/MqSubcribeConfig.java
  6. 10
      epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/controller/MqPointCallbackController.java
  7. 2
      epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/service/UserPointActionLogService.java
  8. 75
      epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/service/impl/UserPointActionLogServiceImpl.java
  9. 7
      epmet-module/epmet-point/epmet-point-server/src/main/resources/bootstrap.yml
  10. 5
      epmet-module/epmet-point/epmet-point-server/src/main/resources/mapper/PointAdjustmentLogDao.xml
  11. 2
      epmet-module/epmet-point/epmet-point-server/src/main/resources/mapper/UserPointActionLogDao.xml
  12. 116
      epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/ResiVolunteerAuthenticateFormDTO.java
  13. 10
      epmet-user/epmet-user-client/src/main/java/com/epmet/feign/EpmetUserOpenFeignClient.java
  14. 5
      epmet-user/epmet-user-client/src/main/java/com/epmet/feign/fallback/EpmetUserOpenFeignClientFallback.java
  15. 14
      epmet-user/epmet-user-server/src/main/java/com/epmet/controller/UserBaseInfoController.java
  16. 10
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/UserBaseInfoService.java
  17. 30
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/UserBaseInfoServiceImpl.java
  18. 2
      epmet-user/epmet-user-server/src/main/resources/mapper/UserBaseInfoDao.xml

25
epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/VolunteerInfoServiceImpl.java

@ -33,7 +33,7 @@ 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.PasswordLoginUserInfoFormDTO;
import com.epmet.dto.form.resi.ResiVolunteerAuthenticateFormDTO;
import com.epmet.dto.result.ResiUserBaseInfoResultDTO;
import com.epmet.dto.result.resi.ResiVolunteerInfoResultDTO;
@ -93,9 +93,9 @@ public class VolunteerInfoServiceImpl extends BaseServiceImpl<VolunteerInfoDao,
// 发送消息 由积分系统消费消息(需要使用规则)
this.grantActPoints(formDTO);
}
// 更新用户基础信息表 并 更新用户微信表
WxUserInfoFormDTO wxUserInfoFormDTO = this.packageWxUserInfo(formDTO);
return epmetUserOpenFeignClient.updateUserBaseAndWxUserInfo(wxUserInfoFormDTO);
// 志愿者认证,更新用户基础信息
com.epmet.dto.form.ResiVolunteerAuthenticateFormDTO param = ConvertUtils.sourceToTarget(formDTO, com.epmet.dto.form.ResiVolunteerAuthenticateFormDTO.class);
return epmetUserOpenFeignClient.volunteerBaseInfo(param);
}
private void grantActPoints(ResiVolunteerAuthenticateFormDTO formDTO){
@ -122,23 +122,6 @@ public class VolunteerInfoServiceImpl extends BaseServiceImpl<VolunteerInfoDao,
}
}
/**
* 根据志愿者认证参数组装微信基本信息
*
* @param formDTO
* @return com.epmet.dto.form.WxUserInfoFormDTO
* @Author zhangyong
* @Date 13:54 2020-07-28
**/
private WxUserInfoFormDTO packageWxUserInfo(ResiVolunteerAuthenticateFormDTO formDTO){
WxUserInfoFormDTO wxUserInfoFormDTO = new WxUserInfoFormDTO();
wxUserInfoFormDTO.setUserId(formDTO.getUserId());
wxUserInfoFormDTO.setNickName(formDTO.getNickname());
wxUserInfoFormDTO.setAvatarUrl(formDTO.getAvatarUrl());
wxUserInfoFormDTO.setGender(formDTO.getGender());
return wxUserInfoFormDTO;
}
@Override
public Result<ResiVolunteerInfoResultDTO> selectVolunteerInfoByUserId(TokenDto tokenDto) {
ResiVolunteerInfoResultDTO resultDTO = new ResiVolunteerInfoResultDTO();

6
epmet-module/epmet-heart/epmet-heart-server/src/main/resources/bootstrap.yml

@ -133,4 +133,8 @@ elink:
appId: @elink.mq.appId@ #项目接入亿联云的应用Id
token: @elink.mq.token@ #项目接入亿联云的应用token 相当于secret
host: @elink.mq.host@ #亿联云消息网关服务地址
sendMsgPath: @elink.mq.sendMsgPath@ #发送消息路径
sendMsgPath: @elink.mq.sendMsgPath@ #发送消息路径
dingTalk:
robot:
webHook: @dingTalk.robot.webHook@
secret: @dingTalk.robot.secret@

3
epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/ActInfoDao.xml

@ -205,6 +205,7 @@
AND u.DEL_FLAG = '0'
AND u.USER_ID = #{userId}
AND u.`STATUS` = 'auditing'
AND <![CDATA[ DATE_FORMAT(i.ACT_END_TIME,'%Y-%m-%d %H:%i:%s') > ]]> NOW() -- 活动结束时间 > 当前时间, 活动未结束
ORDER BY i.CREATED_TIME DESC
LIMIT #{pageNo}, #{pageSize}
</select>
@ -229,6 +230,7 @@
AND u.DEL_FLAG = '0'
AND u.USER_ID = #{userId}
AND u.`STATUS` = 'passed'
AND <![CDATA[ DATE_FORMAT(i.ACT_END_TIME,'%Y-%m-%d %H:%i:%s') > ]]> NOW() -- 活动结束时间 > 当前时间, 活动未结束
ORDER BY i.CREATED_TIME DESC
LIMIT #{pageNo}, #{pageSize}
</select>
@ -253,6 +255,7 @@
AND u.DEL_FLAG = '0'
AND u.USER_ID = #{userId}
AND u.`STATUS` = 'refused'
AND <![CDATA[ DATE_FORMAT(i.ACT_END_TIME,'%Y-%m-%d %H:%i:%s') > ]]> NOW() -- 活动结束时间 > 当前时间, 活动未结束
ORDER BY i.CREATED_TIME DESC
LIMIT #{pageNo}, #{pageSize}
</select>

1
epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/ActLiveRecDao.xml

@ -32,6 +32,7 @@
FROM act_live_rec r
WHERE r.DEL_FLAG = '0'
AND r.ACT_ID = #{actId}
ORDER BY CREATED_TIME DESC
</select>
<!--根据实况id,查询每条实况对应的多张图片-->

2
epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/config/MqSubcribeConfig.java

@ -40,6 +40,6 @@ public class MqSubcribeConfig {
param.put("mqSubscribeList", subscribeFormDTOList);
String jsonStrParam = JSON.toJSONString(param);
Result<String> result = HttpClientManager.getInstance().sendPostByHttps(mqServer, JSON.toJSONString(param));
logger.error("subscriber==jsonStrParam:{}=====result:{}" ,jsonStrParam, JSON.toJSONString(result));
logger.info("subscriber==jsonStrParam:{}=====result:{}" ,jsonStrParam, JSON.toJSONString(result));
}
}

10
epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/controller/MqPointCallbackController.java

@ -17,6 +17,8 @@ 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;
/**
* desc: 积分相关消息回调controller
*
@ -45,11 +47,11 @@ public class MqPointCallbackController {
log.warn("activeSendPoint mqMsg is empty");
return "success";
}
SendPointFormDTO formDTO = ConvertUtils.sourceToTarget(mqMsg.getMsg(), SendPointFormDTO.class);
List<SendPointFormDTO> formDTO = JSON.parseArray(mqMsg.getMsg(), SendPointFormDTO.class);
try {
userPointActionLogService.grantPoint(formDTO);
} catch (Exception e) {
logger.error("activeSendPoint consume fail,msg:{}",JSON.toJSONString(mqMsg.getMsg()));
logger.error("activeSendPoint consume fail", e);
throw new RenException(EpmetErrorCode.SERVER_ERROR.getMsg());
}
log.info("activeSendPoint consumer success,formDTO:{}", JSON.toJSONString(formDTO));
@ -73,7 +75,7 @@ public class MqPointCallbackController {
try {
//TODO 调用调整积分方法去给用户加减积分 userPointActionLogService.
} catch (Exception e) {
logger.error("registerVolunteer consume fail,msg:{}",JSON.toJSONString(mqMsg.getMsg()));
logger.error("registerVolunteer consume fail", e);
throw new RenException(EpmetErrorCode.SERVER_ERROR.getMsg());
}
log.info("registerVolunteer consumer success,formDTO:{}", JSON.toJSONString(formDTO));
@ -97,7 +99,7 @@ public class MqPointCallbackController {
try {
//TODO 调用调整积分方法去给用户加减积分 userPointActionLogService.
} catch (Exception e) {
logger.error("pubActiveLive consume fail,msg:{}",JSON.toJSONString(mqMsg.getMsg()));
logger.error("pubActiveLive consume fail", e);
throw new RenException(EpmetErrorCode.SERVER_ERROR.getMsg());
}
log.info("pubActiveLive consumer success,formDTO:{}", JSON.toJSONString(formDTO));

2
epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/service/UserPointActionLogService.java

@ -112,6 +112,6 @@ public interface UserPointActionLogService extends BaseService<UserPointActionLo
* @author wangc
* @date 2020.07.29 09:11
**/
void grantPoint(SendPointFormDTO grantPointParam);
void grantPoint(List<SendPointFormDTO> grantPointParam);
}

75
epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/service/impl/UserPointActionLogServiceImpl.java

@ -20,11 +20,11 @@ package com.epmet.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl;
import com.epmet.commons.tools.constant.FieldConstant;
import com.epmet.commons.tools.constant.NumConstant;
import com.epmet.commons.tools.enums.EventEnum;
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.UserPointActionLogDao;
import com.epmet.dto.UserPointActionLogDTO;
import com.epmet.dto.form.CommonPageUserFormDTO;
@ -41,10 +41,12 @@ import com.epmet.utils.ModuleConstant;
import com.github.pagehelper.PageHelper;
import com.google.common.collect.Maps;
import dto.form.SendPointFormDTO;
import lombok.extern.slf4j.Slf4j;
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 org.springframework.util.CollectionUtils;
import java.util.*;
import java.util.stream.Collectors;
@ -55,6 +57,7 @@ import java.util.stream.Collectors;
* @author generator generator@elink-cn.com
* @since v1.0.0 2020-07-20
*/
@Slf4j
@Service
public class UserPointActionLogServiceImpl extends BaseServiceImpl<UserPointActionLogDao, UserPointActionLogEntity> implements UserPointActionLogService {
@ -134,7 +137,7 @@ public class UserPointActionLogServiceImpl extends BaseServiceImpl<UserPointActi
Map<String, List<ResiPointLogPeriodResultDTO>> sortedMap = Maps.newLinkedHashMap();
map.entrySet().stream().sorted(Map.Entry.<String, List<ResiPointLogPeriodResultDTO>>comparingByKey().reversed())
.forEachOrdered(e -> sortedMap.put(e.getKey(), e.getValue()));
map.entrySet().forEach(e -> {
sortedMap.entrySet().forEach(e -> {
ResiPointLogListResultDTO o = new ResiPointLogListResultDTO();
o.setDate(e.getKey());
o.setDailyList(e.getValue());
@ -147,59 +150,71 @@ public class UserPointActionLogServiceImpl extends BaseServiceImpl<UserPointActi
/**
* @Description 消息网关回调进行积分发放
* @param grantPointParam
* @param grantPointList
* @return
* @author wangc
* @date 2020.07.29 09:11
**/
@Override
public void grantPoint(SendPointFormDTO grantPointParam){
if(StringUtils.equals(ModuleConstant.OPERATION_TYPE_MINUS,grantPointParam.getActionFlag())){
@Transactional(rollbackFor = Exception.class)
public void grantPoint(List<SendPointFormDTO> grantPointList){
if (CollectionUtils.isEmpty(grantPointList)){
log.warn("grantPoint param is empty");
return;
}
grantPointList.forEach(grantPoint->{
plusPoint(grantPoint);
});
}
private void plusPoint(SendPointFormDTO grantPoint) {
if(StringUtils.equals(ModuleConstant.OPERATION_TYPE_MINUS,grantPoint.getActionFlag())){
//减
if(grantPointParam.getPoint() > NumConstant.ZERO){
if(grantPoint.getPoint() > NumConstant.ZERO){
//保证负数
grantPointParam.setPoint(grantPointParam.getPoint() * NumConstant.ONE_NEG);
grantPoint.setPoint(grantPoint.getPoint() * NumConstant.ONE_NEG);
}
}else{
//加
if(grantPointParam.getPoint() < NumConstant.ZERO){
if(grantPoint.getPoint() < NumConstant.ZERO){
//保证正数
grantPointParam.setPoint(grantPointParam.getPoint() * NumConstant.ONE_NEG);
grantPoint.setPoint(grantPoint.getPoint() * NumConstant.ONE_NEG);
}
}
//1.新增用户积分行为记录
UserPointActionLogEntity action = new UserPointActionLogEntity();
action.setCustomerId(grantPointParam.getCustomerId());
action.setPoint(grantPointParam.getPoint());
action.setEventStatement(grantPointParam.getPointDesc());
action.setCustomerId(grantPoint.getCustomerId());
action.setPoint(grantPoint.getPoint());
action.setEventStatement(grantPoint.getPointDesc());
action.setEventName(EventEnum.ACTIVE_SEND_POINT.getEventDesc());
action.setEventId(EventEnum.ACTIVE_INSERT_LIVE.getEventTag());
action.setActionFlag(grantPointParam.getActionFlag());
action.setUserId(grantPointParam.getUserId());
action.setCreatedBy(grantPointParam.getOperatorId());
action.setUpdatedBy(grantPointParam.getOperatorId());
action.setSourceId(grantPointParam.getSourceId());
action.setOperatorAgencyId(grantPointParam.getOpAgencyId());
action.setActionFlag(grantPoint.getActionFlag());
action.setUserId(grantPoint.getUserId());
action.setCreatedBy(grantPoint.getOperatorId());
action.setUpdatedBy(grantPoint.getOperatorId());
action.setSourceId(grantPoint.getSourceId());
action.setOperatorAgencyId(grantPoint.getOpAgencyId());
baseDao.insert(action);
//2.新增/修改用户积分日统计
DimIdGenerator.DimIdBean dimVal = DimIdGenerator.getDimIdBean(new Date());
UserPointStatisticalDailyEntity statistical = ConvertUtils.sourceToTarget(dimVal,UserPointStatisticalDailyEntity.class);
statistical.setPointChange(grantPointParam.getPoint());
statistical.setActionFlag(grantPointParam.getActionFlag());
statistical.setCustomerId(grantPointParam.getCustomerId());
statistical.setUserId(grantPointParam.getUserId());
statistical.setCreatedBy(grantPointParam.getOperatorId());
statistical.setUpdatedBy(grantPointParam.getOperatorId());
statistical.setPointChange(grantPoint.getPoint());
statistical.setActionFlag(grantPoint.getActionFlag());
statistical.setCustomerId(grantPoint.getCustomerId());
statistical.setUserId(grantPoint.getUserId());
statistical.setCreatedBy(grantPoint.getOperatorId());
statistical.setUpdatedBy(grantPoint.getOperatorId());
userPointStatisticalDailyService.insertOrUpdate(statistical);
//3.新增/修改用户总积分
UserPointTotalEntity point = new UserPointTotalEntity();
point.setCustomerId(grantPointParam.getCustomerId());
point.setUserId(grantPointParam.getUserId());
point.setTotalPoint(grantPointParam.getPoint());
point.setUsablePoint(grantPointParam.getPoint());
point.setCustomerId(grantPoint.getCustomerId());
point.setUserId(grantPoint.getUserId());
point.setTotalPoint(grantPoint.getPoint());
point.setUsablePoint(grantPoint.getPoint());
point.setUsedPoint(NumConstant.ZERO);
point.setCreatedBy(grantPointParam.getOperatorId());
point.setUpdatedBy(grantPointParam.getOperatorId());
point.setCreatedBy(grantPoint.getOperatorId());
point.setUpdatedBy(grantPoint.getOperatorId());
userPointTotalService.insertOrUpdate(point);
}

7
epmet-module/epmet-point/epmet-point-server/src/main/resources/bootstrap.yml

@ -116,4 +116,9 @@ ribbon:
#pageHelper分页插件
pagehelper:
helper-dialect: mysql
reasonable: false #分页合理化配置,例如输入页码为-1,则自动转化为最小页码1
reasonable: false #分页合理化配置,例如输入页码为-1,则自动转化为最小页码1
dingTalk:
robot:
webHook: @dingTalk.robot.webHook@
secret: @dingTalk.robot.secret@

5
epmet-module/epmet-point/epmet-point-server/src/main/resources/mapper/PointAdjustmentLogDao.xml

@ -26,11 +26,10 @@
operator_name AS staffNickname,
adjust_reason AS reason,
DATE_FORMAT( created_time, '%Y-%m-%d %H:%i:%s' ) AS date,
CASE
CASE
ADJUSTMENT_TYPE
WHEN 'plus' THEN
CONCAT( '+', POINT ) ELSE CONCAT( '-', POINT )
END AS POINT
CONCAT( '+', POINT ) ELSE POINT END AS POINT
FROM
point_adjustment_log
WHERE

2
epmet-module/epmet-point/epmet-point-server/src/main/resources/mapper/UserPointActionLogDao.xml

@ -27,7 +27,7 @@
SELECT
EVENT_NAME AS TITLE,
EVENT_STATEMENT AS REMARK,
CASE ACTION_FLAG WHEN 'plus' THEN concat('+',POINT) WHEN 'minus' THEN concat('-',POINT) END AS point,
CASE ACTION_FLAG WHEN 'plus' THEN concat('+',POINT) ELSE POINT END AS point,
DATE_FORMAT(CREATED_TIME,'%Y-%m-%d') AS DATE,
DATE_FORMAT(CREATED_TIME,'%H:%i') AS TIME
FROM

116
epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/ResiVolunteerAuthenticateFormDTO.java

@ -0,0 +1,116 @@
package com.epmet.dto.form;
import com.epmet.commons.tools.validator.group.CustomerClientShowGroup;
import lombok.Data;
import javax.validation.constraints.NotBlank;
import java.io.Serializable;
/**
* 志愿者认证 入参
*
* @Auther: zhangyong
* @Date: 2020-07-23 09:57
*/
@Data
public class ResiVolunteerAuthenticateFormDTO implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 添加用户操作的内部异常分组
* 出现错误会提示给前端7000错误码返回信息为服务器开小差...
*/
/**
* 添加用户操作的用户可见异常分组
* 该分组用于校验需要返回给前端错误信息提示的列需要继承CustomerClientShowGroup
* 返回错误码为8999提示信息为DTO中具体的列的校验注解message的内容
*/
/**
* 用户id
*/
private String userId;
/**
* 客户id
*/
@NotBlank(message = "客户id不能为空")
private String customerId;
/**
*
*/
@NotBlank(message = "姓不能为空")
private String surname;
/**
*
*/
@NotBlank(message = "名不能为空")
private String name;
/**
* 性别1男2女0未知
*/
@NotBlank(message = "性别不能为空")
private String gender;
/**
* 手机号
*/
@NotBlank(message = "手机号不能为空")
private String mobile;
/**
* 身份证号码
*/
@NotBlank(message = "身份证号码不能为空")
private String idNum;
/**
* 街道
*/
@NotBlank(message = "街道不能为空")
private String street;
/**
* 小区名
*/
@NotBlank(message = "小区名不能为空")
private String district;
/**
* 楼栋单元
*/
@NotBlank(message = "楼栋单元不能为空")
private String buildingAddress;
/**
* 志愿者自我介绍
*/
private String volunteerIntroduce;
/**
* 昵称
*/
@NotBlank(message = "昵称不能为空")
private String nickname;
/**
* 头像
*/
@NotBlank(message = "头像不能为空")
private String avatarUrl;
/**
* 志愿者签名
*/
private String volunteerSignature;
}

10
epmet-user/epmet-user-client/src/main/java/com/epmet/feign/EpmetUserOpenFeignClient.java

@ -239,4 +239,14 @@ public interface EpmetUserOpenFeignClient {
**/
@PostMapping("/epmetuser/userbaseinfo/selectuserbaseinfo")
Result<ResiUserBaseInfoResultDTO> selectUserBaseInfo(@RequestBody TokenDto tokenDTO);
/**
* @Description 认证志愿者时保存/修改用户基础信息
* @param param
* @return
* @author wangc
* @date 2020.07.31 09:38
**/
@PostMapping("/epmetuser/userbaseinfo/volunteerbaseinfo")
Result volunteerBaseInfo(@RequestBody ResiVolunteerAuthenticateFormDTO param);
}

5
epmet-user/epmet-user-client/src/main/java/com/epmet/feign/fallback/EpmetUserOpenFeignClientFallback.java

@ -173,4 +173,9 @@ public class EpmetUserOpenFeignClientFallback implements EpmetUserOpenFeignClien
public Result<ResiUserBaseInfoResultDTO> selectUserBaseInfo(TokenDto tokenDTO) {
return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "selectUserBaseInfo", tokenDTO);
}
@Override
public Result volunteerBaseInfo(ResiVolunteerAuthenticateFormDTO param) {
return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "volunteerBaseInfo", param);
}
}

14
epmet-user/epmet-user-server/src/main/java/com/epmet/controller/UserBaseInfoController.java

@ -29,6 +29,7 @@ import com.epmet.commons.tools.validator.group.DefaultGroup;
import com.epmet.commons.tools.validator.group.UpdateGroup;
import com.epmet.dto.UserBaseInfoDTO;
import com.epmet.dto.form.IssueInitiatorFormDTO;
import com.epmet.dto.form.ResiVolunteerAuthenticateFormDTO;
import com.epmet.dto.result.CustomerUserDetailResultDTO;
import com.epmet.dto.result.ResiUserBaseInfoResultDTO;
import com.epmet.dto.result.UserBaseInfoResultDTO;
@ -162,4 +163,17 @@ public class UserBaseInfoController {
public Result<ResiUserBaseInfoResultDTO> selectUserBaseInfo(@LoginUser TokenDto tokenDTO){
return userBaseInfoService.selecUserBaseInfoByUserId(tokenDTO.getUserId());
}
/**
* @Description 认证志愿者时保存/修改用户基础信息
* @param param
* @return
* @author wangc
* @date 2020.07.31 09:38
**/
@PostMapping("volunteerbaseinfo")
public Result volunteerBaseInfo(@RequestBody ResiVolunteerAuthenticateFormDTO param){
userBaseInfoService.saveUserBaseInfoWhenAuthVolunteer(param);
return new Result();
}
}

10
epmet-user/epmet-user-server/src/main/java/com/epmet/service/UserBaseInfoService.java

@ -21,6 +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.UserBaseInfoDTO;
import com.epmet.dto.form.ResiVolunteerAuthenticateFormDTO;
import com.epmet.dto.result.CustomerUserDetailResultDTO;
import com.epmet.dto.result.ResiUserBaseInfoResultDTO;
import com.epmet.dto.result.UserBaseInfoResultDTO;
@ -142,4 +143,13 @@ public interface UserBaseInfoService extends BaseService<UserBaseInfoEntity> {
* @Date 15:20 2020-07-28
**/
Result<ResiUserBaseInfoResultDTO> selecUserBaseInfoByUserId(String userId);
/**
* @Description 认证志愿者时保存/修改用户基础信息
* @param param
* @return
* @author wangc
* @date 2020.07.31 09:38
**/
void saveUserBaseInfoWhenAuthVolunteer(ResiVolunteerAuthenticateFormDTO param);
}

30
epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/UserBaseInfoServiceImpl.java

@ -31,6 +31,7 @@ import com.epmet.dao.UserWechatDao;
import com.epmet.dto.UserBaseInfoDTO;
import com.epmet.dto.UserResiInfoDTO;
import com.epmet.dto.UserWechatDTO;
import com.epmet.dto.form.ResiVolunteerAuthenticateFormDTO;
import com.epmet.dto.result.CustomerUserDetailResultDTO;
import com.epmet.dto.result.ResiUserBaseInfoResultDTO;
import com.epmet.dto.result.UserBaseInfoResultDTO;
@ -45,10 +46,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.*;
/**
* 用户基础信息
@ -261,4 +259,28 @@ public class UserBaseInfoServiceImpl extends BaseServiceImpl<UserBaseInfoDao, Us
public Result<ResiUserBaseInfoResultDTO> selecUserBaseInfoByUserId(String userId) {
return new Result<ResiUserBaseInfoResultDTO>().ok(baseDao.selecUserBaseInfoByUserId(userId));
}
/**
* @Description 认证志愿者时保存/修改用户基础信息
* @param param
* @return
* @author wangc
* @date 2020.07.31 09:38
**/
@Override
public void saveUserBaseInfoWhenAuthVolunteer(ResiVolunteerAuthenticateFormDTO param) {
UserWechatDTO userWechatDTO = new UserWechatDTO();
userWechatDTO.setUserId(param.getUserId());
userWechatDTO.setNickname(StringUtils.isBlank(param.getNickname()) ? ModuleConstant.EMPTY_STR : param.getNickname());
if(StringUtils.isBlank(param.getGender())) param.setGender(NumConstant.ZERO_STR);
userWechatDTO.setSex(Integer.parseInt(param.getGender()));
userWechatDTO.setHeadImgUrl(param.getAvatarUrl());
userWechatDTO.setUpdatedTime(new Date());
userWechatDTO.setUpdatedBy(param.getUserId());
userWechatDao.updateByUserId(userWechatDTO);
UserBaseInfoEntity baseInfo = ConvertUtils.sourceToTarget(param,UserBaseInfoEntity.class);
baseInfo.setHeadImgUrl(param.getAvatarUrl());
insertOrUpdate(baseInfo);
}
}

2
epmet-user/epmet-user-server/src/main/resources/mapper/UserBaseInfoDao.xml

@ -108,7 +108,7 @@
<if test ='null != nickname and "" != nickname'>nickname = #{nickname},</if>
<if test ='null != headImgUrl and "" != headImgUrl'>head_img_url = #{headImgUrl},</if>
<if test ='null != delFlag and "" != delFlag'>del_flag = #{delFlag},</if>
updated_by = #{updatedBy},
updated_by = #{userId},
updated_time = now()
</set>
WHERE id = #{id}

Loading…
Cancel
Save