Browse Source

活动报名-接口修改

dev_shibei_match
zhangyongzhangyong 5 years ago
parent
commit
0f93458d4f
  1. 1
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java
  2. 27
      epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/resi/ResiActRegistrationResultDTO.java
  3. 9
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/ResiActListController.java
  4. 7
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/ActUserRelationService.java
  5. 52
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/ActUserRelationServiceImpl.java
  6. 1
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/VolunteerInfoServiceImpl.java
  7. 10
      epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/ResiUserBaseInfoResultDTO.java
  8. 4
      epmet-user/epmet-user-server/src/main/resources/mapper/UserBaseInfoDao.xml

1
epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java

@ -85,6 +85,7 @@ public enum EpmetErrorCode {
NOT_IN_THE_SIGN_IN_RANGE(8510, "您还未进入指定的签到范围~"), NOT_IN_THE_SIGN_IN_RANGE(8510, "您还未进入指定的签到范围~"),
NON_CERTIFIED_VOLUNTEER(8511, "活动报名失败,请先认证志愿者"), NON_CERTIFIED_VOLUNTEER(8511, "活动报名失败,请先认证志愿者"),
ACT_TIME_CONFLICT(8512, "报名失败。您本次报名活动时间与已报名活动时间间隔较短,为了不影响您已报名的活动,请选择其他时间的活动,谢谢。"), ACT_TIME_CONFLICT(8512, "报名失败。您本次报名活动时间与已报名活动时间间隔较短,为了不影响您已报名的活动,请选择其他时间的活动,谢谢。"),
ACT_REGISTRATION_SUCCESS(8513, "报名成功。"),
// 该错误不会提示给前端,只是后端传输错误信息用。 // 该错误不会提示给前端,只是后端传输错误信息用。
ACCESS_SQL_FILTER_MISSION_ARGS(8701, "缺少生成权限过滤SQL所需参数"), ACCESS_SQL_FILTER_MISSION_ARGS(8701, "缺少生成权限过滤SQL所需参数"),

27
epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/resi/ResiActRegistrationResultDTO.java

@ -0,0 +1,27 @@
package com.epmet.dto.result.resi;
import lombok.Data;
import java.io.Serializable;
/**
* 活动报名 - 返回值
*
* @Auther: zhangyong
* @Date: 2020-07-28 16:22
*/
@Data
public class ResiActRegistrationResultDTO implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 异常编码
*/
private Integer flag;
/**
* 提示信息
*/
private String tip;
}

9
epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/ResiActListController.java

@ -293,17 +293,18 @@ public class ResiActListController {
return actSignInRecService.actSignIn(tokenDto, formDTO); return actSignInRecService.actSignIn(tokenDto, formDTO);
} }
/** /*
* 活动报名 * 活动报名
* *
* @param tokenDto * @param tokenDto
* @param formDTO * @param formDTO
* @return com.epmet.commons.tools.utils.Result *
* @return com.epmet.commons.tools.utils.Result<com.epmet.dto.result.resi.ResiActRegistrationResultDTO>
* @Author zhangyong * @Author zhangyong
* @Date 16:46 2020-07-23 * @Date 16:26 2020-07-28
**/ **/
@PostMapping("registration") @PostMapping("registration")
public Result registration(@LoginUser TokenDto tokenDto, @RequestBody ResiActRegistrationFormDTO formDTO) { public Result<ResiActRegistrationResultDTO> registration(@LoginUser TokenDto tokenDto, @RequestBody ResiActRegistrationFormDTO formDTO) {
ValidatorUtils.validateEntity(formDTO, ResiActRegistrationFormDTO.AddUserInternalGroup.class); ValidatorUtils.validateEntity(formDTO, ResiActRegistrationFormDTO.AddUserInternalGroup.class);
return actUserRelationService.registration(tokenDto, formDTO); return actUserRelationService.registration(tokenDto, formDTO);
} }

7
epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/ActUserRelationService.java

@ -24,6 +24,7 @@ import com.epmet.commons.tools.utils.Result;
import com.epmet.dto.ActUserRelationDTO; import com.epmet.dto.ActUserRelationDTO;
import com.epmet.dto.form.resi.ResiActRegistrationFormDTO; import com.epmet.dto.form.resi.ResiActRegistrationFormDTO;
import com.epmet.dto.form.resi.ResiActUserCancelSignUpFormDTO; import com.epmet.dto.form.resi.ResiActUserCancelSignUpFormDTO;
import com.epmet.dto.result.resi.ResiActRegistrationResultDTO;
import com.epmet.entity.ActUserRelationEntity; import com.epmet.entity.ActUserRelationEntity;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
@ -145,9 +146,9 @@ public interface ActUserRelationService extends BaseService<ActUserRelationEntit
* *
* @param tokenDto * @param tokenDto
* @param formDTO * @param formDTO
* @return com.epmet.commons.tools.utils.Result * @return com.epmet.commons.tools.utils.Result<java.util.Map<java.lang.Integer,java.lang.String>>
* @Author zhangyong * @Author zhangyong
* @Date 16:46 2020-07-23 * @Date 15:54 2020-07-28
**/ **/
Result registration(TokenDto tokenDto, ResiActRegistrationFormDTO formDTO); Result<ResiActRegistrationResultDTO> registration(TokenDto tokenDto, ResiActRegistrationFormDTO formDTO);
} }

52
epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/ActUserRelationServiceImpl.java

@ -39,6 +39,7 @@ import com.epmet.dto.ActUserRelationDTO;
import com.epmet.dto.form.resi.ResiActRegistrationFormDTO; import com.epmet.dto.form.resi.ResiActRegistrationFormDTO;
import com.epmet.dto.form.resi.ResiActUserCancelSignUpFormDTO; import com.epmet.dto.form.resi.ResiActUserCancelSignUpFormDTO;
import com.epmet.dto.result.UserRoleResultDTO; import com.epmet.dto.result.UserRoleResultDTO;
import com.epmet.dto.result.resi.ResiActRegistrationResultDTO;
import com.epmet.entity.ActUserLogEntity; import com.epmet.entity.ActUserLogEntity;
import com.epmet.entity.ActUserRelationEntity; import com.epmet.entity.ActUserRelationEntity;
import com.epmet.entity.HeartUserInfoEntity; import com.epmet.entity.HeartUserInfoEntity;
@ -54,10 +55,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import java.util.Arrays; import java.util.*;
import java.util.Date;
import java.util.List;
import java.util.Map;
/** /**
* 用户活动关系表 * 用户活动关系表
@ -197,9 +195,10 @@ public class ActUserRelationServiceImpl extends BaseServiceImpl<ActUserRelationD
@Override @Override
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public Result registration(TokenDto tokenDto, ResiActRegistrationFormDTO formDTO) { public Result<ResiActRegistrationResultDTO> registration(TokenDto tokenDto, ResiActRegistrationFormDTO formDTO) {
formDTO.setUserId(tokenDto.getUserId()); formDTO.setUserId(tokenDto.getUserId());
boolean satisfy = false; boolean satisfy = false;
ResiActRegistrationResultDTO resultDTO = new ResiActRegistrationResultDTO();
// 查询活动信息 // 查询活动信息
ActInfoDTO actInfoDTO = actInfoService.get(formDTO.getActId()); ActInfoDTO actInfoDTO = actInfoService.get(formDTO.getActId());
// >0 当前用户是志愿者 // >0 当前用户是志愿者
@ -207,15 +206,35 @@ public class ActUserRelationServiceImpl extends BaseServiceImpl<ActUserRelationD
if (actInfoDTO.getVolunteerLimit()){ if (actInfoDTO.getVolunteerLimit()){
// 活动只能志愿者参加, 当前用户是否满足条件 // 活动只能志愿者参加, 当前用户是否满足条件
satisfy = this.volunteerParticipationAct(volunteerFlag); satisfy = this.volunteerParticipationAct(volunteerFlag);
if (!satisfy){
logger.info("活动报名失败,请先认证志愿者");
resultDTO.setFlag(EpmetErrorCode.NON_CERTIFIED_VOLUNTEER.getCode());
resultDTO.setTip(EpmetErrorCode.NON_CERTIFIED_VOLUNTEER.getMsg());
return new Result<ResiActRegistrationResultDTO>().ok(resultDTO);
}
} else { } else {
// 活动不限制志愿者身份,但要求是 居民身份, 当前用户是否满足条件 // 活动不限制志愿者身份,但要求是 居民身份, 当前用户是否满足条件
satisfy = this.resiParticipationAct(formDTO.getUserId()); satisfy = this.resiParticipationAct(formDTO.getUserId());
if (!satisfy){
logger.info("活动报名失败,请完善居民信息");
resultDTO.setFlag(EpmetErrorCode.CANNOT_AUDIT_WARM.getCode());
resultDTO.setTip(EpmetErrorCode.CANNOT_AUDIT_WARM.getMsg());
return new Result<ResiActRegistrationResultDTO>().ok(resultDTO);
}
} }
if (satisfy){ if (satisfy){
// 开始报名 // 开始报名
this.actStartSignUp(actInfoDTO, formDTO, volunteerFlag); boolean actTimeConflict = this.actStartSignUp(actInfoDTO, formDTO, volunteerFlag);
if (!actTimeConflict){
logger.info("报名失败。您本次报名活动时间与已报名活动时间间隔较短,为了不影响您已报名的活动,请选择其他时间的活动,谢谢。");
resultDTO.setFlag(EpmetErrorCode.ACT_TIME_CONFLICT.getCode());
resultDTO.setTip(EpmetErrorCode.ACT_TIME_CONFLICT.getMsg());
return new Result<ResiActRegistrationResultDTO>().ok(resultDTO);
}
} }
return new Result(); resultDTO.setFlag(EpmetErrorCode.ACT_REGISTRATION_SUCCESS.getCode());
resultDTO.setTip(EpmetErrorCode.ACT_REGISTRATION_SUCCESS.getMsg());
return new Result<ResiActRegistrationResultDTO>().ok(resultDTO);
} }
/** /**
@ -228,7 +247,7 @@ public class ActUserRelationServiceImpl extends BaseServiceImpl<ActUserRelationD
* @Author zhangyong * @Author zhangyong
* @Date 15:31 2020-07-24 * @Date 15:31 2020-07-24
**/ **/
private void actStartSignUp(ActInfoDTO actInfoDTO, ResiActRegistrationFormDTO formDTO, Integer volunteerFlag){ private boolean actStartSignUp(ActInfoDTO actInfoDTO, ResiActRegistrationFormDTO formDTO, Integer volunteerFlag){
boolean signUp = true; boolean signUp = true;
Integer auditingNum = actUserLogService.countActTimesOfParticipation(formDTO.getUserId()); Integer auditingNum = actUserLogService.countActTimesOfParticipation(formDTO.getUserId());
if (auditingNum > NumConstant.ZERO){ if (auditingNum > NumConstant.ZERO){
@ -237,8 +256,7 @@ public class ActUserRelationServiceImpl extends BaseServiceImpl<ActUserRelationD
Integer actTimeFlag = actInfoService.checkActTime(actInfoDTO); Integer actTimeFlag = actInfoService.checkActTime(actInfoDTO);
if (actTimeFlag > NumConstant.ZERO){ if (actTimeFlag > NumConstant.ZERO){
signUp = false; signUp = false;
logger.info("报名失败。您本次报名活动时间与已报名活动时间间隔较短,为了不影响您已报名的活动,请选择其他时间的活动,谢谢。"); return signUp;
throw new RenException(EpmetErrorCode.ACT_TIME_CONFLICT.getCode());
} }
} else { } else {
// 3.第一次报名 // 3.第一次报名
@ -249,7 +267,8 @@ public class ActUserRelationServiceImpl extends BaseServiceImpl<ActUserRelationD
this.insertActUserLog(formDTO); this.insertActUserLog(formDTO);
} }
// 5.插入 用户活动关系表 // 5.插入 用户活动关系表
this.insertActUserRelation(formDTO, actInfoDTO); this.insertActUserRelation(formDTO, actInfoDTO);
return signUp;
} }
/** /**
@ -265,10 +284,8 @@ public class ActUserRelationServiceImpl extends BaseServiceImpl<ActUserRelationD
if (volunteerFlag > NumConstant.ZERO){ if (volunteerFlag > NumConstant.ZERO){
satisfy = true; satisfy = true;
return satisfy; return satisfy;
} else {
logger.info("活动报名失败,请先认证志愿者");
throw new RenException(EpmetErrorCode.NON_CERTIFIED_VOLUNTEER.getCode());
} }
return satisfy;
} }
/** /**
@ -289,12 +306,7 @@ public class ActUserRelationServiceImpl extends BaseServiceImpl<ActUserRelationD
} }
} }
} }
if (!satisfy){ return satisfy;
logger.info("活动报名失败,请完善居民信息");
throw new RenException(EpmetErrorCode.CANNOT_AUDIT_WARM.getCode());
} else {
return satisfy;
}
} }
/** /**

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

@ -33,7 +33,6 @@ import com.epmet.dao.VolunteerInfoDao;
import com.epmet.dto.HeartUserInfoDTO; import com.epmet.dto.HeartUserInfoDTO;
import com.epmet.dto.form.WxUserInfoFormDTO; import com.epmet.dto.form.WxUserInfoFormDTO;
import com.epmet.dto.form.resi.ResiVolunteerAuthenticateFormDTO; import com.epmet.dto.form.resi.ResiVolunteerAuthenticateFormDTO;
import com.epmet.entity.ActUserRelationEntity;
import com.epmet.entity.VolunteerInfoEntity; import com.epmet.entity.VolunteerInfoEntity;
import com.epmet.feign.EpmetUserOpenFeignClient; import com.epmet.feign.EpmetUserOpenFeignClient;
import com.epmet.redis.VolunteerInfoRedis; import com.epmet.redis.VolunteerInfoRedis;

10
epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/ResiUserBaseInfoResultDTO.java

@ -63,4 +63,14 @@ public class ResiUserBaseInfoResultDTO implements Serializable {
* 楼栋单元 * 楼栋单元
*/ */
private String buildingAddress; private String buildingAddress;
/**
* 昵称(目前来源于微信昵称后续系统可支持用户有昵称)
*/
private String nickname;
/**
* 头像目前来源于微信后续系统顾客支持上传头像
*/
private String headImgUrl;
} }

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

@ -81,7 +81,9 @@
MOBILE mobile, MOBILE mobile,
STREET street, STREET street,
DISTRICT district, DISTRICT district,
BUILDING_ADDRESS buildingAddress BUILDING_ADDRESS buildingAddress,
NICKNAME nickname,
HEAD_IMG_URL headImgUrl
FROM user_base_info FROM user_base_info
WHERE DEL_FLAG = '0' WHERE DEL_FLAG = '0'
AND USER_ID = #{userId} AND USER_ID = #{userId}

Loading…
Cancel
Save