@@ -1,5 +1,6 @@ | |||||
package com.ningdatech.pmapi.expert.manage; | package com.ningdatech.pmapi.expert.manage; | ||||
import cn.hutool.core.collection.CollUtil; | |||||
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.file.entity.vo.result.AttachFileVo; | import com.ningdatech.file.entity.vo.result.AttachFileVo; | ||||
@@ -82,16 +83,13 @@ public class ExpertManage { | |||||
expertMetaApplyManage.autoPassExpertApply(userId); | expertMetaApplyManage.autoPassExpertApply(userId); | ||||
// 增加用户专家角色 | // 增加用户专家角色 | ||||
Role expertRole = iRoleService.getOne(Wrappers.lambdaQuery(Role.class).eq(Role::getCode, RoleEnum.EXPERT.name())); | |||||
UserRole expertUserRole = iUserRoleService.getOne(Wrappers.lambdaQuery(UserRole.class) | |||||
.eq(UserRole::getRoleId, expertRole.getId()).eq(UserRole::getUserId, userId)); | |||||
if (Objects.isNull(expertUserRole)) { | |||||
expertUserRole = new UserRole(); | |||||
expertUserRole.setUserId(userId); | |||||
expertUserRole.setRoleId(expertRole.getId()); | |||||
expertUserRole.setCreateBy(-1L); | |||||
expertUserRole.setCreateOn(LocalDateTime.now()); | |||||
iUserRoleService.save(expertUserRole); | |||||
Role role = iRoleService.getOne(Wrappers.lambdaQuery(Role.class).eq(Role::getCode, RoleEnum.EXPERT.name())); | |||||
UserRole expertRole = iUserRoleService.getOne(userId, role.getId()); | |||||
if (Objects.isNull(expertRole)) { | |||||
expertRole = new UserRole(); | |||||
expertRole.setUserId(userId); | |||||
expertRole.setRoleId(role.getId()); | |||||
iUserRoleService.save(expertRole); | |||||
} | } | ||||
} | } | ||||
@@ -113,13 +111,13 @@ public class ExpertManage { | |||||
expertRecommendProofSaveCmd.setRecommendationProofFileIdList(recommendProofFile.stream().map(FileBasicInfo::getFileId).collect(Collectors.toList())); | expertRecommendProofSaveCmd.setRecommendationProofFileIdList(recommendProofFile.stream().map(FileBasicInfo::getFileId).collect(Collectors.toList())); | ||||
} | } | ||||
List<ExpertDictionaryDTO> recommendedWayDictionaryDTOList = new ArrayList<>(); | List<ExpertDictionaryDTO> recommendedWayDictionaryDTOList = new ArrayList<>(); | ||||
if (CollectionUtils.isNotEmpty(recommendedWay)) { | |||||
recommendedWayDictionaryDTOList = recommendedWay.stream().map(r -> { | |||||
if (CollUtil.isNotEmpty(recommendedWay)) { | |||||
recommendedWay.forEach(r -> { | |||||
ExpertDictionaryDTO expertDictionaryDTO = new ExpertDictionaryDTO(); | ExpertDictionaryDTO expertDictionaryDTO = new ExpertDictionaryDTO(); | ||||
expertDictionaryDTO.setDictionaryCode(r.getDictionaryCode()); | expertDictionaryDTO.setDictionaryCode(r.getDictionaryCode()); | ||||
expertDictionaryDTO.setExpertInfoField(DictExpertInfoTypeEnum.RECOMMENDED_WAY.getKey()); | expertDictionaryDTO.setExpertInfoField(DictExpertInfoTypeEnum.RECOMMENDED_WAY.getKey()); | ||||
return expertDictionaryDTO; | |||||
}).collect(Collectors.toList()); | |||||
recommendedWayDictionaryDTOList.add(expertDictionaryDTO); | |||||
}); | |||||
} | } | ||||
expertRecommendProofSaveCmd.setRecommendedWay(recommendedWayDictionaryDTOList); | expertRecommendProofSaveCmd.setRecommendedWay(recommendedWayDictionaryDTOList); | ||||
expertRecommendProofSaveCmd.setUserId(expertUserId); | expertRecommendProofSaveCmd.setUserId(expertUserId); | ||||
@@ -146,10 +144,10 @@ public class ExpertManage { | |||||
UserInfo userInfo = iUserInfoService.getUserInfoByPhoneNo(phoneNo); | UserInfo userInfo = iUserInfoService.getUserInfoByPhoneNo(phoneNo); | ||||
if (Objects.isNull(userInfo)) { | if (Objects.isNull(userInfo)) { | ||||
userInfo = UserInfo.builder() | userInfo = UserInfo.builder() | ||||
// .accountId(dingEmployeeInfo.getAccountId()) | |||||
//.accountId(dingEmployeeInfo.getAccountId()) | |||||
.username(basicInfo.getName()) | .username(basicInfo.getName()) | ||||
.realName(basicInfo.getName()) | .realName(basicInfo.getName()) | ||||
// .employeeCode(dingEmployeeInfo.getEmployeeCode()) | |||||
//.employeeCode(dingEmployeeInfo.getEmployeeCode()) | |||||
.available(UserAvailableEnum.DISABLE.name()) | .available(UserAvailableEnum.DISABLE.name()) | ||||
.mobile(phoneNo) | .mobile(phoneNo) | ||||
.createBy(operatorId) | .createBy(operatorId) | ||||
@@ -49,10 +49,7 @@ import org.springframework.stereotype.Component; | |||||
import org.springframework.transaction.annotation.Transactional; | import org.springframework.transaction.annotation.Transactional; | ||||
import java.time.LocalDateTime; | import java.time.LocalDateTime; | ||||
import java.util.ArrayList; | |||||
import java.util.List; | |||||
import java.util.Map; | |||||
import java.util.Objects; | |||||
import java.util.*; | |||||
import java.util.stream.Collectors; | import java.util.stream.Collectors; | ||||
/** | /** | ||||
@@ -66,25 +63,16 @@ public class ExpertMetaApplyManage { | |||||
private final IExpertMetaApplyService iMetaApplyService; | private final IExpertMetaApplyService iMetaApplyService; | ||||
private final IExpertDictionaryService expertDictionaryService; | private final IExpertDictionaryService expertDictionaryService; | ||||
// private final IExpertAdminManageService ExpertAdminManageService; | |||||
private final RegionCacheHelper regionCacheHelper; | private final RegionCacheHelper regionCacheHelper; | ||||
private final IExpertUserFullInfoService userFullInfoService; | private final IExpertUserFullInfoService userFullInfoService; | ||||
private final DictionaryCache dictionaryCache; | private final DictionaryCache dictionaryCache; | ||||
private final ExpertInfoService expertInfoService; | private final ExpertInfoService expertInfoService; | ||||
private final UserInfoHelper userInfoHelper; | private final UserInfoHelper userInfoHelper; | ||||
private final RegionLimitHelper regionLimitHelper; | private final RegionLimitHelper regionLimitHelper; | ||||
private final ExpertUserInfoHelper expertUserInfoHelper; | private final ExpertUserInfoHelper expertUserInfoHelper; | ||||
private final ExpertAdminManageService expertAdminManageService; | private final ExpertAdminManageService expertAdminManageService; | ||||
private final IExpertDictionaryService iExpertDictionaryService; | private final IExpertDictionaryService iExpertDictionaryService; | ||||
public PageVo<ExpertApplyMetaVO> metaApplyListQuery(MetaApplyListQuery req) { | public PageVo<ExpertApplyMetaVO> metaApplyListQuery(MetaApplyListQuery req) { | ||||
Long expertAdminUserId = LoginUserUtil.getUserId(); | Long expertAdminUserId = LoginUserUtil.getUserId(); | ||||
// 筛选符合专家类型的用户id | // 筛选符合专家类型的用户id | ||||
@@ -596,11 +584,13 @@ public class ExpertMetaApplyManage { | |||||
*/ | */ | ||||
@Transactional(rollbackFor = Exception.class) | @Transactional(rollbackFor = Exception.class) | ||||
public void autoPassExpertApply(Long expertUserId) { | public void autoPassExpertApply(Long expertUserId) { | ||||
List<ExpertMetaApply> expertIntentionJoinApplyList = iMetaApplyService.list(Wrappers.lambdaQuery(ExpertMetaApply.class) | |||||
final List<String> applyTypes = Arrays.asList(ExpertApplyTypeEnum.EXPERT_INTENTION_JOIN.getKey(), | |||||
ExpertApplyTypeEnum.EXPERT_STORAGE.getKey()); | |||||
LambdaQueryWrapper<ExpertMetaApply> query = Wrappers.lambdaQuery(ExpertMetaApply.class) | |||||
.eq(ExpertMetaApply::getUserId, expertUserId) | .eq(ExpertMetaApply::getUserId, expertUserId) | ||||
.in(ExpertMetaApply::getApplyType, ExpertApplyTypeEnum.EXPERT_INTENTION_JOIN.getKey(), ExpertApplyTypeEnum.EXPERT_STORAGE.getKey()) | |||||
.eq(ExpertMetaApply::getApplyStatus, ExpertApplyStatusEnum.PENDING_REVIEW.getKey())); | |||||
.in(ExpertMetaApply::getApplyType, applyTypes) | |||||
.eq(ExpertMetaApply::getApplyStatus, ExpertApplyStatusEnum.PENDING_REVIEW.getKey()); | |||||
List<ExpertMetaApply> expertIntentionJoinApplyList = iMetaApplyService.list(query); | |||||
for (ExpertMetaApply expertMetaApply : expertIntentionJoinApplyList) { | for (ExpertMetaApply expertMetaApply : expertIntentionJoinApplyList) { | ||||
MetaApplyResultRequest applyResult = new MetaApplyResultRequest(); | MetaApplyResultRequest applyResult = new MetaApplyResultRequest(); | ||||
applyResult.setApplyId(expertMetaApply.getId()); | applyResult.setApplyId(expertMetaApply.getId()); | ||||
@@ -34,7 +34,10 @@ import com.ningdatech.pmapi.sys.model.entity.UserRole; | |||||
import com.ningdatech.pmapi.sys.service.IRoleService; | import com.ningdatech.pmapi.sys.service.IRoleService; | ||||
import com.ningdatech.pmapi.sys.service.IUserRoleService; | import com.ningdatech.pmapi.sys.service.IUserRoleService; | ||||
import com.ningdatech.pmapi.sys.service.impl.UserRoleServiceImpl; | import com.ningdatech.pmapi.sys.service.impl.UserRoleServiceImpl; | ||||
import com.ningdatech.pmapi.user.constant.UserAvailableEnum; | |||||
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.util.LoginUserUtil; | import com.ningdatech.pmapi.user.util.LoginUserUtil; | ||||
import com.ningdatech.yxt.utils.JSONUtils; | import com.ningdatech.yxt.utils.JSONUtils; | ||||
import lombok.RequiredArgsConstructor; | import lombok.RequiredArgsConstructor; | ||||
@@ -65,6 +68,7 @@ public class ExpertInfoServiceImpl implements ExpertInfoService { | |||||
private final IRoleService roleService; | private final IRoleService roleService; | ||||
private final IUserRoleService userRoleService; | private final IUserRoleService userRoleService; | ||||
private final IExpertSensitiveInfoModifyDetailRecordService iExpertSensitiveInfoModifyDetailRecordService; | private final IExpertSensitiveInfoModifyDetailRecordService iExpertSensitiveInfoModifyDetailRecordService; | ||||
private final IUserInfoService userInfoService; | |||||
/** | /** | ||||
@@ -390,6 +394,11 @@ public class ExpertInfoServiceImpl implements ExpertInfoService { | |||||
expertUserFullInfo.setRemark(cmd.getRemark()); | expertUserFullInfo.setRemark(cmd.getRemark()); | ||||
expertUserFullInfo.setRegionCode(cmd.getJoinRegionCode()); | expertUserFullInfo.setRegionCode(cmd.getJoinRegionCode()); | ||||
expertUserFullInfo.setRegionLevel(cmd.getJoinRegionLevel()); | expertUserFullInfo.setRegionLevel(cmd.getJoinRegionLevel()); | ||||
// 账号启用 | |||||
LambdaUpdateWrapper<UserInfo> userInfoUpdate = Wrappers.lambdaUpdate(UserInfo.class) | |||||
.eq(UserInfo::getId,expertUserId) | |||||
.set(UserInfo::getAvailable, UserAvailableEnum.ENABLE); | |||||
userInfoService.update(userInfoUpdate); | |||||
// 保存所有专家标签字段 | // 保存所有专家标签字段 | ||||
List<ExpertTag> saveExpertTagList = buildSaveExpertTagList(expertUserId, cmd.getOther()); | List<ExpertTag> saveExpertTagList = buildSaveExpertTagList(expertUserId, cmd.getOther()); | ||||