|
|
@@ -10,6 +10,7 @@ import com.ningdatech.basic.exception.BizException; |
|
|
|
import com.ningdatech.basic.model.PageVo; |
|
|
|
import com.ningdatech.basic.util.CollUtils; |
|
|
|
import com.ningdatech.pmapi.common.constant.BoolDisplayEnum; |
|
|
|
import com.ningdatech.pmapi.common.helper.UserInfoHelper; |
|
|
|
import com.ningdatech.pmapi.common.util.BizUtils; |
|
|
|
import com.ningdatech.pmapi.expert.constant.ExpertApplyStatusEnum; |
|
|
|
import com.ningdatech.pmapi.expert.constant.ExpertApplyTypeEnum; |
|
|
@@ -17,12 +18,17 @@ import com.ningdatech.pmapi.expert.constant.ExpertApplyTypeQueryEnum; |
|
|
|
import com.ningdatech.pmapi.expert.entity.ExpertMetaApply; |
|
|
|
import com.ningdatech.pmapi.expert.entity.ExpertUserFullInfo; |
|
|
|
import com.ningdatech.pmapi.expert.model.DictionaryFieldInfo; |
|
|
|
import com.ningdatech.pmapi.expert.model.TagFieldInfo; |
|
|
|
import com.ningdatech.pmapi.expert.model.cmd.ExpertAdminExpertManageQueryCmd; |
|
|
|
import com.ningdatech.pmapi.expert.model.cmd.ExpertStorageDealCmd; |
|
|
|
import com.ningdatech.pmapi.expert.model.cmd.MetaApplyListQuery; |
|
|
|
import com.ningdatech.pmapi.expert.model.dto.ExpertDictionaryDTO; |
|
|
|
import com.ningdatech.pmapi.expert.model.dto.ExpertTagDTO; |
|
|
|
import com.ningdatech.pmapi.expert.model.query.ExpertDictionaryQuery; |
|
|
|
import com.ningdatech.pmapi.expert.model.req.MetaApplyResultRequest; |
|
|
|
import com.ningdatech.pmapi.expert.model.vo.ExpertApplyMetaVO; |
|
|
|
import com.ningdatech.pmapi.expert.model.vo.MetaApplyResultVo; |
|
|
|
import com.ningdatech.pmapi.expert.service.ExpertInfoService; |
|
|
|
import com.ningdatech.pmapi.expert.service.IExpertMetaApplyService; |
|
|
|
import com.ningdatech.pmapi.expert.service.IExpertUserFullInfoService; |
|
|
|
import com.ningdatech.pmapi.meta.constant.DictExpertInfoTypeEnum; |
|
|
@@ -36,6 +42,7 @@ import com.ningdatech.pmapi.user.util.LoginUserUtil; |
|
|
|
import lombok.RequiredArgsConstructor; |
|
|
|
import org.apache.commons.lang3.StringUtils; |
|
|
|
import org.springframework.stereotype.Component; |
|
|
|
import org.springframework.transaction.annotation.Transactional; |
|
|
|
|
|
|
|
import java.time.LocalDateTime; |
|
|
|
import java.util.ArrayList; |
|
|
@@ -60,6 +67,10 @@ public class ExpertMetaApplyManage { |
|
|
|
private final IExpertUserFullInfoService userFullInfoService; |
|
|
|
private final DictionaryCache dictionaryCache; |
|
|
|
|
|
|
|
private final ExpertInfoService expertInfoService; |
|
|
|
|
|
|
|
private final UserInfoHelper userInfoHelper; |
|
|
|
|
|
|
|
|
|
|
|
public PageVo<ExpertApplyMetaVO> metaApplyListQuery(MetaApplyListQuery req) { |
|
|
|
Long expertAdminUserId = LoginUserUtil.getUserId(); |
|
|
@@ -94,10 +105,88 @@ public class ExpertMetaApplyManage { |
|
|
|
return result; |
|
|
|
} |
|
|
|
|
|
|
|
public void metaApplyResult(MetaApplyResultRequest applyResultRequest) { |
|
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
|
public void metaApplyResult(MetaApplyResultRequest req) { |
|
|
|
Long applyId = req.getApplyId(); |
|
|
|
ExpertMetaApply expertMetaApply = iMetaApplyService.getById(applyId); |
|
|
|
Long userId = LoginUserUtil.getUserId(); |
|
|
|
|
|
|
|
// 校验专家管理员区域权限,是否可以审核当前专家申请 |
|
|
|
// permissionCheckHelper.operationPermissionsCheck(userId, expertMetaApply.getUserId()); |
|
|
|
String applyStatus = expertMetaApply.getApplyStatus(); |
|
|
|
if (!ExpertApplyStatusEnum.PENDING_REVIEW.getKey().equals(applyStatus)) { |
|
|
|
throw BizException.wrap("apply is already processed"); |
|
|
|
} |
|
|
|
ExpertApplyTypeEnum applyType = ExpertApplyTypeEnum.of(expertMetaApply.getApplyType()); |
|
|
|
boolean applyResult = req.getApplyResult(); |
|
|
|
|
|
|
|
} |
|
|
|
switch (applyType) { |
|
|
|
// 专家入库 |
|
|
|
case EXPERT_STORAGE: { |
|
|
|
ExpertStorageDealCmd expertStorageDealCmd = buildExpertStorageDealCmd(req, expertMetaApply.getUserId(), expertMetaApply); |
|
|
|
expertInfoService.expertStorageDeal(expertStorageDealCmd); |
|
|
|
// 专家入库时,需要先审核专家入库,入库成功后,再履职意向审核,如果履职意向跟专家层级是同一层级的,就直接同意不需要审核 |
|
|
|
if (applyResult) { |
|
|
|
Long expertUserId = expertMetaApply.getUserId(); |
|
|
|
// ExpertRegionInfo expertRegionInfo = expertUserInfoHelper.getExpertRegionInfo(expertUserId); |
|
|
|
// Integer regionLevel = expertRegionInfo.getRegionLevel(); |
|
|
|
// String regionCode = expertRegionInfo.getRegionCode(); |
|
|
|
|
|
|
|
List<ExpertMetaApply> expertJoinApplyList = iMetaApplyService.list(Wrappers.lambdaQuery(ExpertMetaApply.class) |
|
|
|
.eq(ExpertMetaApply::getUserId, expertUserId) |
|
|
|
.eq(ExpertMetaApply::getApplyStatus, ExpertApplyStatusEnum.PENDING_REVIEW.getKey()) |
|
|
|
.eq(ExpertMetaApply::getApplyType, ExpertApplyTypeEnum.EXPERT_INTENTION_JOIN.getKey()) |
|
|
|
.eq(ExpertMetaApply::getDisplayEnable, BoolDisplayEnum.Y.name())); |
|
|
|
// .eq(ExpertMetaApply::getRegionLevel, regionLevel) |
|
|
|
// .eq(ExpertMetaApply::getRegionCode, regionCode)); |
|
|
|
BizUtils.notEmpty(expertJoinApplyList, list -> list.forEach(r -> { |
|
|
|
MetaApplyResultRequest resultRequest = new MetaApplyResultRequest(); |
|
|
|
resultRequest.setApplyId(r.getId()); |
|
|
|
resultRequest.setApplyResult(true); |
|
|
|
resultRequest.setAuditOpinion("同意"); |
|
|
|
metaApplyResult(resultRequest); |
|
|
|
})); |
|
|
|
} |
|
|
|
} |
|
|
|
break; |
|
|
|
// 专家出库 |
|
|
|
case EXPERT_DELIVERY: |
|
|
|
// ExpertDeliveryDealCmd expertDeliveryDealCmd = buildExpertDeliveryDealCmd(req, expertMetaApply.getUserId()); |
|
|
|
// expertInfoService.expertDeliveryDeal(expertDeliveryDealCmd); |
|
|
|
break; |
|
|
|
// 长期请假 |
|
|
|
case LONG_TERM_LEAVE: |
|
|
|
// leaveManage.leaveAuditCallback(req.getApplyResult(), applyId); |
|
|
|
break; |
|
|
|
// 专家信息审核 |
|
|
|
case EXPERT_INFO_MODIFY: |
|
|
|
// ExpertInfoModifyApplyDealCmd applyDealCmd = buildExpertInfoModifyApplyDealCmd(req, expertMetaApply.getUserId(), applyId); |
|
|
|
// expertInfoService.expertInfoModifyDeal(applyDealCmd); |
|
|
|
break; |
|
|
|
// 专家履职意向加入/离开 |
|
|
|
case EXPERT_INTENTION_JOIN: |
|
|
|
case EXPERT_INTENTION_LEAVE: |
|
|
|
// ExpertIntentionApplyDealCmd expertIntentionApplyDealCmd = buildExpertIntentionApplyDealCmd(req, expertMetaApply); |
|
|
|
// expertInfoService.expertIntentionApplyDeal(expertIntentionApplyDealCmd); |
|
|
|
break; |
|
|
|
default: |
|
|
|
break; |
|
|
|
} |
|
|
|
|
|
|
|
Long expertUserId = expertMetaApply.getUserId(); |
|
|
|
String auditOpinion = req.getAuditOpinion(); |
|
|
|
// 发送审核结果短信 |
|
|
|
// sendApplyResultNotify(applyType, applyResult, auditOpinion, expertUserId); |
|
|
|
// 更新申请结果 |
|
|
|
expertMetaApply.setApproverUserId(userId); |
|
|
|
String adminUserName = userInfoHelper.getUserName(userId); |
|
|
|
expertMetaApply.setApprover(adminUserName); |
|
|
|
expertMetaApply.setAuditOpinion(auditOpinion); |
|
|
|
expertMetaApply.setApplyStatus(applyResult ? ExpertApplyStatusEnum.PASSED.getKey() : ExpertApplyStatusEnum.REFUSED.getKey()); |
|
|
|
expertMetaApply.setReviewTime(LocalDateTime.now()); |
|
|
|
expertMetaApply.setUpdateOn(LocalDateTime.now()); |
|
|
|
iMetaApplyService.saveOrUpdate(expertMetaApply); |
|
|
|
} |
|
|
|
|
|
|
|
public MetaApplyResultVo metaApplyResult(Long applyId) { |
|
|
|
ExpertMetaApply metaApply = iMetaApplyService.getById(applyId); |
|
|
@@ -383,5 +472,38 @@ public class ExpertMetaApplyManage { |
|
|
|
return expertMetaApplyListQuery; |
|
|
|
} |
|
|
|
|
|
|
|
private ExpertStorageDealCmd buildExpertStorageDealCmd( |
|
|
|
MetaApplyResultRequest applyResultRequest, Long expertUserId, ExpertMetaApply expertMetaApply) { |
|
|
|
MetaApplyResultRequest.StorageApplyResultExtraInfo extraInfo = applyResultRequest.getStorageApplyResultExtraInfo(); |
|
|
|
ExpertStorageDealCmd expertStorageDealCmd = new ExpertStorageDealCmd(); |
|
|
|
Boolean applyResult = applyResultRequest.getApplyResult(); |
|
|
|
expertStorageDealCmd.setApplyResult(applyResult); |
|
|
|
|
|
|
|
if (Objects.nonNull(extraInfo)) { |
|
|
|
List<DictionaryFieldInfo> expertType = extraInfo.getExpertType(); |
|
|
|
if (CollectionUtils.isNotEmpty(expertType)) { |
|
|
|
expertStorageDealCmd.setExpertType(extraInfo.getExpertType().stream().map(r -> { |
|
|
|
ExpertDictionaryDTO expertDictionaryDTO = new ExpertDictionaryDTO(); |
|
|
|
expertDictionaryDTO.setExpertInfoField(r.getDictionaryFieldName()); |
|
|
|
expertDictionaryDTO.setDictionaryCode(r.getDictionaryCode()); |
|
|
|
return expertDictionaryDTO; |
|
|
|
}).collect(Collectors.toList())); |
|
|
|
} |
|
|
|
List<TagFieldInfo> other = extraInfo.getOther(); |
|
|
|
if (CollectionUtils.isNotEmpty(other)) { |
|
|
|
expertStorageDealCmd.setOther(extraInfo.getOther().stream().map(r -> { |
|
|
|
ExpertTagDTO expertTagDTO = new ExpertTagDTO(); |
|
|
|
expertTagDTO.setExpertInfoField(r.getTagFieldName()); |
|
|
|
expertTagDTO.setTagCode(r.getTagCode()); |
|
|
|
return expertTagDTO; |
|
|
|
}).collect(Collectors.toList())); |
|
|
|
} |
|
|
|
expertStorageDealCmd.setRemark(extraInfo.getRemark()); |
|
|
|
} |
|
|
|
expertStorageDealCmd.setExpertUserId(expertUserId); |
|
|
|
expertStorageDealCmd.setJoinRegionCode(expertMetaApply.getRegionCode()); |
|
|
|
expertStorageDealCmd.setJoinRegionLevel(expertMetaApply.getRegionLevel()); |
|
|
|
return expertStorageDealCmd; |
|
|
|
} |
|
|
|
|
|
|
|
} |