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 06cd0afafd..8ac75314f7 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 @@ -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 selectVolunteerInfoByUserId(TokenDto tokenDto) { ResiVolunteerInfoResultDTO resultDTO = new ResiVolunteerInfoResultDTO(); diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/bootstrap.yml b/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/bootstrap.yml index 72477fb20d..c6e70a0bc3 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/bootstrap.yml +++ b/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@ #发送消息路径 \ No newline at end of file + sendMsgPath: @elink.mq.sendMsgPath@ #发送消息路径 +dingTalk: + robot: + webHook: @dingTalk.robot.webHook@ + secret: @dingTalk.robot.secret@ diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/ActInfoDao.xml b/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/ActInfoDao.xml index a2b4d9ad62..caacebc94b 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/ActInfoDao.xml +++ b/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 ]]> NOW() -- 活动结束时间 > 当前时间, 活动未结束 ORDER BY i.CREATED_TIME DESC LIMIT #{pageNo}, #{pageSize} @@ -229,6 +230,7 @@ AND u.DEL_FLAG = '0' AND u.USER_ID = #{userId} AND u.`STATUS` = 'passed' + AND ]]> NOW() -- 活动结束时间 > 当前时间, 活动未结束 ORDER BY i.CREATED_TIME DESC LIMIT #{pageNo}, #{pageSize} @@ -253,6 +255,7 @@ AND u.DEL_FLAG = '0' AND u.USER_ID = #{userId} AND u.`STATUS` = 'refused' + AND ]]> NOW() -- 活动结束时间 > 当前时间, 活动未结束 ORDER BY i.CREATED_TIME DESC LIMIT #{pageNo}, #{pageSize} diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/ActLiveRecDao.xml b/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/ActLiveRecDao.xml index 6b3c8d92ea..f5ce7e4f29 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/ActLiveRecDao.xml +++ b/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 diff --git a/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/config/MqSubcribeConfig.java b/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/config/MqSubcribeConfig.java index d8e6ceac75..0a9c628604 100644 --- a/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/config/MqSubcribeConfig.java +++ b/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 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)); } } diff --git a/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/controller/MqPointCallbackController.java b/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/controller/MqPointCallbackController.java index 7f32946939..1de8982e48 100644 --- a/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/controller/MqPointCallbackController.java +++ b/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 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)); diff --git a/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/service/UserPointActionLogService.java b/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/service/UserPointActionLogService.java index 81873314f7..8498b04eb7 100644 --- a/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/service/UserPointActionLogService.java +++ b/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/service/UserPointActionLogService.java @@ -112,6 +112,6 @@ public interface UserPointActionLogService extends BaseService grantPointParam); } \ No newline at end of file diff --git a/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/service/impl/UserPointActionLogServiceImpl.java b/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/service/impl/UserPointActionLogServiceImpl.java index fd06cf41e0..fa05c63f37 100644 --- a/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/service/impl/UserPointActionLogServiceImpl.java +++ b/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 implements UserPointActionLogService { @@ -134,7 +137,7 @@ public class UserPointActionLogServiceImpl extends BaseServiceImpl> sortedMap = Maps.newLinkedHashMap(); map.entrySet().stream().sorted(Map.Entry.>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 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); } diff --git a/epmet-module/epmet-point/epmet-point-server/src/main/resources/bootstrap.yml b/epmet-module/epmet-point/epmet-point-server/src/main/resources/bootstrap.yml index 06e24d34cc..bf7eb31f91 100644 --- a/epmet-module/epmet-point/epmet-point-server/src/main/resources/bootstrap.yml +++ b/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 \ No newline at end of file + reasonable: false #分页合理化配置,例如输入页码为-1,则自动转化为最小页码1 + +dingTalk: + robot: + webHook: @dingTalk.robot.webHook@ + secret: @dingTalk.robot.secret@ \ No newline at end of file diff --git a/epmet-module/epmet-point/epmet-point-server/src/main/resources/mapper/PointAdjustmentLogDao.xml b/epmet-module/epmet-point/epmet-point-server/src/main/resources/mapper/PointAdjustmentLogDao.xml index 00eb03fc91..8e32e81668 100644 --- a/epmet-module/epmet-point/epmet-point-server/src/main/resources/mapper/PointAdjustmentLogDao.xml +++ b/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 diff --git a/epmet-module/epmet-point/epmet-point-server/src/main/resources/mapper/UserPointActionLogDao.xml b/epmet-module/epmet-point/epmet-point-server/src/main/resources/mapper/UserPointActionLogDao.xml index bd81ab9aff..b8baa6c47f 100644 --- a/epmet-module/epmet-point/epmet-point-server/src/main/resources/mapper/UserPointActionLogDao.xml +++ b/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 diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/ResiVolunteerAuthenticateFormDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/ResiVolunteerAuthenticateFormDTO.java new file mode 100644 index 0000000000..13789fa4cf --- /dev/null +++ b/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; +} 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 5aa0a5e9dd..857df537c1 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 @@ -239,4 +239,14 @@ public interface EpmetUserOpenFeignClient { **/ @PostMapping("/epmetuser/userbaseinfo/selectuserbaseinfo") Result 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); } 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 9c3fc1d0ba..0be4d08c3d 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 @@ -173,4 +173,9 @@ public class EpmetUserOpenFeignClientFallback implements EpmetUserOpenFeignClien public Result 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); + } } 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 26c6cf8c3c..c54a5248cf 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 @@ -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 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(); + } } diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/UserBaseInfoService.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/UserBaseInfoService.java index 03786a14a9..060f8385f1 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/UserBaseInfoService.java +++ b/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 { * @Date 15:20 2020-07-28 **/ Result selecUserBaseInfoByUserId(String userId); + + /** + * @Description 认证志愿者时保存/修改用户基础信息 + * @param param + * @return + * @author wangc + * @date 2020.07.31 09:38 + **/ + void saveUserBaseInfoWhenAuthVolunteer(ResiVolunteerAuthenticateFormDTO param); } diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/UserBaseInfoServiceImpl.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/UserBaseInfoServiceImpl.java index 3f2ffbdcea..019a790f73 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/UserBaseInfoServiceImpl.java +++ b/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 selecUserBaseInfoByUserId(String userId) { return new Result().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); + } } diff --git a/epmet-user/epmet-user-server/src/main/resources/mapper/UserBaseInfoDao.xml b/epmet-user/epmet-user-server/src/main/resources/mapper/UserBaseInfoDao.xml index 828d06aebd..cc86f83ccd 100644 --- a/epmet-user/epmet-user-server/src/main/resources/mapper/UserBaseInfoDao.xml +++ b/epmet-user/epmet-user-server/src/main/resources/mapper/UserBaseInfoDao.xml @@ -108,7 +108,7 @@ nickname = #{nickname}, head_img_url = #{headImgUrl}, del_flag = #{delFlag}, - updated_by = #{updatedBy}, + updated_by = #{userId}, updated_time = now() WHERE id = #{id}