|
@@ -4,6 +4,7 @@ import cn.hutool.core.collection.CollUtil; |
|
|
import cn.hutool.core.util.StrUtil; |
|
|
import cn.hutool.core.util.StrUtil; |
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
|
|
import com.ningdatech.basic.exception.BizException; |
|
|
import com.ningdatech.basic.exception.BizException; |
|
|
|
|
|
import com.ningdatech.basic.model.GenericResult; |
|
|
import com.ningdatech.cache.model.cache.CacheKey; |
|
|
import com.ningdatech.cache.model.cache.CacheKey; |
|
|
import com.ningdatech.cache.repository.CachePlusOps; |
|
|
import com.ningdatech.cache.repository.CachePlusOps; |
|
|
import com.ningdatech.file.entity.vo.result.AttachFileVo; |
|
|
import com.ningdatech.file.entity.vo.result.AttachFileVo; |
|
@@ -41,6 +42,8 @@ import com.ningdatech.pmapi.user.entity.UserInfo; |
|
|
import com.ningdatech.pmapi.user.entity.enumeration.RoleEnum; |
|
|
import com.ningdatech.pmapi.user.entity.enumeration.RoleEnum; |
|
|
import com.ningdatech.pmapi.user.service.IUserInfoService; |
|
|
import com.ningdatech.pmapi.user.service.IUserInfoService; |
|
|
import com.ningdatech.pmapi.user.util.LoginUserUtil; |
|
|
import com.ningdatech.pmapi.user.util.LoginUserUtil; |
|
|
|
|
|
import com.ningdatech.zwdd.client.ZwddClient; |
|
|
|
|
|
import com.ningdatech.zwdd.model.dto.DingInfoByMobileDTO; |
|
|
import lombok.RequiredArgsConstructor; |
|
|
import lombok.RequiredArgsConstructor; |
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
import org.apache.commons.collections4.CollectionUtils; |
|
|
import org.apache.commons.collections4.CollectionUtils; |
|
@@ -69,17 +72,18 @@ import java.util.stream.Collectors; |
|
|
public class ExpertManage { |
|
|
public class ExpertManage { |
|
|
|
|
|
|
|
|
private final ExpertManageHelper expertManageHelper; |
|
|
private final ExpertManageHelper expertManageHelper; |
|
|
private final IExpertUserFullInfoService iExpertUserFullInfoService; |
|
|
|
|
|
|
|
|
private final IExpertUserFullInfoService expertUserFullInfoService; |
|
|
private final ExpertInfoService expertInfoService; |
|
|
private final ExpertInfoService expertInfoService; |
|
|
private final ExpertInfoCommonHelper expertInfoCommonHelper; |
|
|
private final ExpertInfoCommonHelper expertInfoCommonHelper; |
|
|
private final FileService fileService; |
|
|
private final FileService fileService; |
|
|
private final ExpertUserInfoAssembler expertUserInfoAssembler; |
|
|
private final ExpertUserInfoAssembler expertUserInfoAssembler; |
|
|
private final IUserInfoService iUserInfoService; |
|
|
|
|
|
|
|
|
private final IUserInfoService userInfoService; |
|
|
private final ExpertMetaApplyManage expertMetaApplyManage; |
|
|
private final ExpertMetaApplyManage expertMetaApplyManage; |
|
|
private final IUserRoleService iUserRoleService; |
|
|
|
|
|
private final IRoleService iRoleService; |
|
|
|
|
|
|
|
|
private final IUserRoleService userRoleService; |
|
|
|
|
|
private final IRoleService roleService; |
|
|
private final VerifyCodeCheckHelper verifyCodeCheckHelper; |
|
|
private final VerifyCodeCheckHelper verifyCodeCheckHelper; |
|
|
private final CachePlusOps cachePlusOps; |
|
|
private final CachePlusOps cachePlusOps; |
|
|
|
|
|
private final ZwddClient zwddClient; |
|
|
|
|
|
|
|
|
@Value("${expert-registration.verify-code.check:true}") |
|
|
@Value("${expert-registration.verify-code.check:true}") |
|
|
private Boolean expertRegistrationVerifyCodeCheck; |
|
|
private Boolean expertRegistrationVerifyCodeCheck; |
|
@@ -136,13 +140,13 @@ public class ExpertManage { |
|
|
expertMetaApplyManage.autoPassExpertApply(userId); |
|
|
expertMetaApplyManage.autoPassExpertApply(userId); |
|
|
|
|
|
|
|
|
// 增加用户专家角色 |
|
|
// 增加用户专家角色 |
|
|
Role role = iRoleService.getOne(Wrappers.lambdaQuery(Role.class).eq(Role::getCode, RoleEnum.EXPERT.name())); |
|
|
|
|
|
UserRole expertRole = iUserRoleService.getOne(userId, role.getId()); |
|
|
|
|
|
|
|
|
Role role = roleService.getOne(Wrappers.lambdaQuery(Role.class).eq(Role::getCode, RoleEnum.EXPERT.name())); |
|
|
|
|
|
UserRole expertRole = userRoleService.getOne(userId, role.getId()); |
|
|
if (Objects.isNull(expertRole)) { |
|
|
if (Objects.isNull(expertRole)) { |
|
|
expertRole = new UserRole(); |
|
|
expertRole = new UserRole(); |
|
|
expertRole.setUserId(userId); |
|
|
expertRole.setUserId(userId); |
|
|
expertRole.setRoleId(role.getId()); |
|
|
expertRole.setRoleId(role.getId()); |
|
|
iUserRoleService.save(expertRole); |
|
|
|
|
|
|
|
|
userRoleService.save(expertRole); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
@@ -151,7 +155,7 @@ public class ExpertManage { |
|
|
public Long expertRecommendProofSubmit |
|
|
public Long expertRecommendProofSubmit |
|
|
(List<DictionaryFieldInfo> recommendedWay, List<FileBasicInfo> recommendProofFile, Long expertUserId) { |
|
|
(List<DictionaryFieldInfo> recommendedWay, List<FileBasicInfo> recommendProofFile, Long expertUserId) { |
|
|
// 用户id |
|
|
// 用户id |
|
|
ExpertUserFullInfo expertUserFullInfo = iExpertUserFullInfoService.getByUserId(expertUserId); |
|
|
|
|
|
|
|
|
ExpertUserFullInfo expertUserFullInfo = expertUserFullInfoService.getByUserId(expertUserId); |
|
|
// 判断专家状态,是否可以进行证明材料提交 |
|
|
// 判断专家状态,是否可以进行证明材料提交 |
|
|
if (Objects.isNull(expertUserFullInfo) |
|
|
if (Objects.isNull(expertUserFullInfo) |
|
|
|| !ExpertAccountStatusEnum.APPLYING.getKey().equals(expertUserFullInfo.getExpertAccountStatus()) |
|
|
|| !ExpertAccountStatusEnum.APPLYING.getKey().equals(expertUserFullInfo.getExpertAccountStatus()) |
|
@@ -195,23 +199,35 @@ public class ExpertManage { |
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
public Long generateOrGetUserId(ExpertBasicInfo basicInfo, Long operatorId) { |
|
|
public Long generateOrGetUserId(ExpertBasicInfo basicInfo, Long operatorId) { |
|
|
String phoneNo = basicInfo.getPhoneNo(); |
|
|
String phoneNo = basicInfo.getPhoneNo(); |
|
|
UserInfo userInfo = iUserInfoService.getUserInfoByPhoneNo(phoneNo); |
|
|
|
|
|
|
|
|
UserInfo userInfo = userInfoService.getUserInfoByPhoneNo(phoneNo); |
|
|
if (Objects.isNull(userInfo)) { |
|
|
if (Objects.isNull(userInfo)) { |
|
|
userInfo = UserInfo.builder() |
|
|
|
|
|
//.accountId(dingEmployeeInfo.getAccountId()) |
|
|
|
|
|
.username(basicInfo.getName()) |
|
|
|
|
|
.realName(basicInfo.getName()) |
|
|
|
|
|
//.employeeCode(dingEmployeeInfo.getEmployeeCode()) |
|
|
|
|
|
.available(UserAvailableEnum.DISABLE.name()) |
|
|
|
|
|
.mobile(phoneNo) |
|
|
|
|
|
.createBy(operatorId) |
|
|
|
|
|
.updateBy(operatorId) |
|
|
|
|
|
.createOn(LocalDateTime.now()) |
|
|
|
|
|
.updateOn(LocalDateTime.now()) |
|
|
|
|
|
.build(); |
|
|
|
|
|
iUserInfoService.save(userInfo); |
|
|
|
|
|
|
|
|
GenericResult<DingInfoByMobileDTO> dingInfoByMobile = zwddClient.getDingInfoByMobile(basicInfo.getPhoneNo()); |
|
|
|
|
|
if (dingInfoByMobile.isSuccess()) { |
|
|
|
|
|
DingInfoByMobileDTO data = dingInfoByMobile.getData(); |
|
|
|
|
|
String accountId = data.getAccountId(); |
|
|
|
|
|
userInfo = userInfoService.getUserInfoByAccountId(Long.parseLong(accountId)); |
|
|
|
|
|
} |
|
|
|
|
|
if (userInfo == null) { |
|
|
|
|
|
userInfo = UserInfo.builder() |
|
|
|
|
|
.username(basicInfo.getName()) |
|
|
|
|
|
.realName(basicInfo.getName()) |
|
|
|
|
|
.available(UserAvailableEnum.DISABLE.name()) |
|
|
|
|
|
.mobile(phoneNo) |
|
|
|
|
|
.createBy(operatorId) |
|
|
|
|
|
.updateBy(operatorId) |
|
|
|
|
|
.createOn(LocalDateTime.now()) |
|
|
|
|
|
.updateOn(LocalDateTime.now()) |
|
|
|
|
|
.build(); |
|
|
|
|
|
userInfoService.save(userInfo); |
|
|
|
|
|
} else if (!StrUtil.equals(userInfo.getRealName(), basicInfo.getName())) { |
|
|
|
|
|
log.warn("相似账户为:{} ==> {}", basicInfo.getPhoneNo(), userInfo); |
|
|
|
|
|
throw BizException.wrap("已存在同手机号,但不同名的账号"); |
|
|
|
|
|
} else if (StrUtil.isBlank(userInfo.getMobile())) { |
|
|
|
|
|
userInfo.setMobile(basicInfo.getPhoneNo()); |
|
|
|
|
|
userInfoService.updateById(userInfo); |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
ExpertUserFullInfo one = iExpertUserFullInfoService.getOne(Wrappers.lambdaQuery(ExpertUserFullInfo.class) |
|
|
|
|
|
|
|
|
ExpertUserFullInfo one = expertUserFullInfoService.getOne(Wrappers.lambdaQuery(ExpertUserFullInfo.class) |
|
|
.eq(ExpertUserFullInfo::getPhoneNo, phoneNo)); |
|
|
.eq(ExpertUserFullInfo::getPhoneNo, phoneNo)); |
|
|
if (Objects.nonNull(one) && !one.getUserId().equals(userInfo.getId())) { |
|
|
if (Objects.nonNull(one) && !one.getUserId().equals(userInfo.getId())) { |
|
|
throw new BizException("该手机号已被专家注册,请确认后再填写"); |
|
|
throw new BizException("该手机号已被专家注册,请确认后再填写"); |
|
@@ -259,7 +275,7 @@ public class ExpertManage { |
|
|
// 校验字典字段 |
|
|
// 校验字典字段 |
|
|
expertManageHelper.dictionaryFieldCheck(basicInfo, eduInfo, jobInfo); |
|
|
expertManageHelper.dictionaryFieldCheck(basicInfo, eduInfo, jobInfo); |
|
|
// 判断专家提交状态,判断是否可以进行此操作 |
|
|
// 判断专家提交状态,判断是否可以进行此操作 |
|
|
ExpertUserFullInfo expertUserFullInfo = iExpertUserFullInfoService.getByUserId(userId); |
|
|
|
|
|
|
|
|
ExpertUserFullInfo expertUserFullInfo = expertUserFullInfoService.getByUserId(userId); |
|
|
|
|
|
|
|
|
boolean submitBasicInfoStatusEnable = Objects.isNull(expertUserFullInfo) |
|
|
boolean submitBasicInfoStatusEnable = Objects.isNull(expertUserFullInfo) |
|
|
|| (ExpertAccountStatusEnum.APPLYING.getKey().equals(expertUserFullInfo.getExpertAccountStatus()) |
|
|
|| (ExpertAccountStatusEnum.APPLYING.getKey().equals(expertUserFullInfo.getExpertAccountStatus()) |
|
|