瀏覽代碼

专家审核通过的时候保存角色

tags/24080901
WendyYang 1 年之前
父節點
當前提交
09b3c4ff8a
共有 2 個檔案被更改,包括 19 行新增31 行删除
  1. +12
    -14
      pmapi/src/main/java/com/ningdatech/pmapi/expert/manage/ExpertManage.java
  2. +7
    -17
      pmapi/src/main/java/com/ningdatech/pmapi/expert/manage/ExpertMetaApplyManage.java

+ 12
- 14
pmapi/src/main/java/com/ningdatech/pmapi/expert/manage/ExpertManage.java 查看文件

@@ -1,5 +1,6 @@
package com.ningdatech.pmapi.expert.manage;

import cn.hutool.core.collection.CollUtil;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.ningdatech.basic.exception.BizException;
import com.ningdatech.file.entity.vo.result.AttachFileVo;
@@ -82,16 +83,13 @@ public class ExpertManage {
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()));
}
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.setDictionaryCode(r.getDictionaryCode());
expertDictionaryDTO.setExpertInfoField(DictExpertInfoTypeEnum.RECOMMENDED_WAY.getKey());
return expertDictionaryDTO;
}).collect(Collectors.toList());
recommendedWayDictionaryDTOList.add(expertDictionaryDTO);
});
}
expertRecommendProofSaveCmd.setRecommendedWay(recommendedWayDictionaryDTOList);
expertRecommendProofSaveCmd.setUserId(expertUserId);


+ 7
- 17
pmapi/src/main/java/com/ningdatech/pmapi/expert/manage/ExpertMetaApplyManage.java 查看文件

@@ -49,10 +49,7 @@ import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;

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;

/**
@@ -66,25 +63,16 @@ public class ExpertMetaApplyManage {

private final IExpertMetaApplyService iMetaApplyService;
private final IExpertDictionaryService expertDictionaryService;

// private final IExpertAdminManageService ExpertAdminManageService;
private final RegionCacheHelper regionCacheHelper;
private final IExpertUserFullInfoService userFullInfoService;
private final DictionaryCache dictionaryCache;

private final ExpertInfoService expertInfoService;

private final UserInfoHelper userInfoHelper;

private final RegionLimitHelper regionLimitHelper;

private final ExpertUserInfoHelper expertUserInfoHelper;

private final ExpertAdminManageService expertAdminManageService;

private final IExpertDictionaryService iExpertDictionaryService;


public PageVo<ExpertApplyMetaVO> metaApplyListQuery(MetaApplyListQuery req) {
Long expertAdminUserId = LoginUserUtil.getUserId();
// 筛选符合专家类型的用户id
@@ -596,11 +584,13 @@ public class ExpertMetaApplyManage {
*/
@Transactional(rollbackFor = Exception.class)
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)
.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) {
MetaApplyResultRequest applyResult = new MetaApplyResultRequest();
applyResult.setApplyId(expertMetaApply.getId());


Loading…
取消
儲存