|
|
@ -5,13 +5,25 @@ import com.elink.esua.epdc.activity.AppActUserCancelsignupDTO; |
|
|
|
import com.elink.esua.epdc.activity.AppActUserClockLogDTO; |
|
|
|
import com.elink.esua.epdc.activity.AppClockListDTO; |
|
|
|
import com.elink.esua.epdc.activity.result.AppActInfoDTO; |
|
|
|
import com.elink.esua.epdc.common.token.dto.TokenDto; |
|
|
|
import com.elink.esua.epdc.commons.tools.constant.NumConstant; |
|
|
|
import com.elink.esua.epdc.commons.tools.enums.UserTagEnum; |
|
|
|
import com.elink.esua.epdc.commons.tools.enums.YesOrNoEnum; |
|
|
|
import com.elink.esua.epdc.commons.tools.utils.IdentityNoUtils; |
|
|
|
import com.elink.esua.epdc.commons.tools.utils.Result; |
|
|
|
import com.elink.esua.epdc.dto.epdc.result.EpdcUserInfoResultDTO; |
|
|
|
import com.elink.esua.epdc.feign.AppActUserRelationFeignClient; |
|
|
|
import com.elink.esua.epdc.service.ActUserRelationService; |
|
|
|
import com.elink.esua.epdc.service.AppUserService; |
|
|
|
import com.elink.esua.epdc.utils.UserTagUtils; |
|
|
|
import io.netty.util.internal.StringUtil; |
|
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
|
import org.apache.commons.lang3.StringUtils; |
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
|
|
|
|
import java.util.Date; |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
* @author wanggongfeng |
|
|
@ -24,8 +36,55 @@ public class ActUserRelationServiceImpl implements ActUserRelationService { |
|
|
|
@Autowired |
|
|
|
private AppActUserRelationFeignClient actInfoFeignClient; |
|
|
|
|
|
|
|
@Autowired |
|
|
|
private AppUserService appUserService; |
|
|
|
|
|
|
|
@Override |
|
|
|
public Result activitySignUp(ActUserRelationDTO actUserRelationDTO) { |
|
|
|
public Result activitySignUp(TokenDto tokenDto, String actId) { |
|
|
|
|
|
|
|
// 判断活动是否指定志愿者,正常情况下对象必定存在,直接获取
|
|
|
|
String volunteerFlag = actInfoFeignClient.getVolunteerFlag(actId).getData().getVolunteerFlag(); |
|
|
|
// 1:指定志愿者参加
|
|
|
|
if (NumConstant.ONE_STR.equals(volunteerFlag)) { |
|
|
|
//验证是否为志愿者
|
|
|
|
Result isVolunteer = appUserService.getVolunteerCountById(tokenDto); |
|
|
|
int code = isVolunteer.getCode(); |
|
|
|
if (code != 0) { |
|
|
|
//不是志愿者
|
|
|
|
return isVolunteer; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
Result<EpdcUserInfoResultDTO> userInfo = appUserService.getInfoById(tokenDto); |
|
|
|
EpdcUserInfoResultDTO epdcUserInfoResultDTO = userInfo.getData(); |
|
|
|
|
|
|
|
ActUserRelationDTO actUserRelationDTO = new ActUserRelationDTO(); |
|
|
|
actUserRelationDTO.setActId(actId); |
|
|
|
actUserRelationDTO.setUserId(tokenDto.getUserId()); |
|
|
|
actUserRelationDTO.setNickname(tokenDto.getNickname()); |
|
|
|
actUserRelationDTO.setFaceImg(tokenDto.getFaceImg()); |
|
|
|
if (UserTagUtils.containIdentity(tokenDto.getUserTagInfos(), UserTagEnum.PARTY_MEMBER)) { |
|
|
|
actUserRelationDTO.setPartyFlag(YesOrNoEnum.YES.value()); |
|
|
|
} else { |
|
|
|
actUserRelationDTO.setPartyFlag(YesOrNoEnum.NO.value()); |
|
|
|
} |
|
|
|
|
|
|
|
// 获取身份证相关的字段,但参加者不一定是有身份证,有的时候在进行处理
|
|
|
|
String identityNo = epdcUserInfoResultDTO.getIdentityNo(); |
|
|
|
if (!StringUtil.isNullOrEmpty(identityNo)) { |
|
|
|
String identityNoVerification = IdentityNoUtils.IdentityNoVerification(identityNo); |
|
|
|
if (StringUtils.isNotBlank(identityNoVerification)) { |
|
|
|
return new Result().error(identityNoVerification); |
|
|
|
} |
|
|
|
actUserRelationDTO.setSex(IdentityNoUtils.getSex(identityNo)); |
|
|
|
actUserRelationDTO.setAge(IdentityNoUtils.getAge(identityNo)); |
|
|
|
actUserRelationDTO.setIdentityNo(identityNo); |
|
|
|
} |
|
|
|
|
|
|
|
actUserRelationDTO.setRealName(tokenDto.getRealName()); |
|
|
|
actUserRelationDTO.setMobile(tokenDto.getMobile()); |
|
|
|
actUserRelationDTO.setStatus("0"); |
|
|
|
actUserRelationDTO.setSignupTime(new Date()); |
|
|
|
Result<Integer> dataResult = actInfoFeignClient.activitySignUp(actUserRelationDTO); |
|
|
|
return dataResult; |
|
|
|
} |
|
|
|