|
@@ -1,11 +1,15 @@ |
|
|
package com.ningdatech.pmapi.expert.manage; |
|
|
package com.ningdatech.pmapi.expert.manage; |
|
|
|
|
|
|
|
|
import cn.hutool.core.collection.CollUtil; |
|
|
import cn.hutool.core.collection.CollUtil; |
|
|
|
|
|
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.cache.model.cache.CacheKey; |
|
|
|
|
|
import com.ningdatech.cache.repository.CachePlusOps; |
|
|
import com.ningdatech.file.entity.vo.result.AttachFileVo; |
|
|
import com.ningdatech.file.entity.vo.result.AttachFileVo; |
|
|
import com.ningdatech.file.service.FileService; |
|
|
import com.ningdatech.file.service.FileService; |
|
|
import com.ningdatech.pmapi.common.model.FileBasicInfo; |
|
|
import com.ningdatech.pmapi.common.model.FileBasicInfo; |
|
|
|
|
|
import com.ningdatech.pmapi.common.util.BizUtils; |
|
|
import com.ningdatech.pmapi.expert.assembler.ExpertInfoCmdAssembler; |
|
|
import com.ningdatech.pmapi.expert.assembler.ExpertInfoCmdAssembler; |
|
|
import com.ningdatech.pmapi.expert.assembler.ExpertUserInfoAssembler; |
|
|
import com.ningdatech.pmapi.expert.assembler.ExpertUserInfoAssembler; |
|
|
import com.ningdatech.pmapi.expert.constant.ExpertAccountStatusEnum; |
|
|
import com.ningdatech.pmapi.expert.constant.ExpertAccountStatusEnum; |
|
@@ -23,6 +27,7 @@ import com.ningdatech.pmapi.expert.model.req.ExpertUserBasicInfoSubmitRequest; |
|
|
import com.ningdatech.pmapi.expert.model.vo.ExpertFullInfoVO; |
|
|
import com.ningdatech.pmapi.expert.model.vo.ExpertFullInfoVO; |
|
|
import com.ningdatech.pmapi.expert.service.ExpertInfoService; |
|
|
import com.ningdatech.pmapi.expert.service.ExpertInfoService; |
|
|
import com.ningdatech.pmapi.expert.service.IExpertUserFullInfoService; |
|
|
import com.ningdatech.pmapi.expert.service.IExpertUserFullInfoService; |
|
|
|
|
|
import com.ningdatech.pmapi.meeting.entity.config.WebProperties; |
|
|
import com.ningdatech.pmapi.meta.constant.DictExpertInfoTypeEnum; |
|
|
import com.ningdatech.pmapi.meta.constant.DictExpertInfoTypeEnum; |
|
|
import com.ningdatech.pmapi.meta.model.ExpertRegionInfo; |
|
|
import com.ningdatech.pmapi.meta.model.ExpertRegionInfo; |
|
|
import com.ningdatech.pmapi.sms.constant.VerificationCodeType; |
|
|
import com.ningdatech.pmapi.sms.constant.VerificationCodeType; |
|
@@ -37,10 +42,16 @@ 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 lombok.RequiredArgsConstructor; |
|
|
import lombok.RequiredArgsConstructor; |
|
|
|
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
import org.apache.commons.collections4.CollectionUtils; |
|
|
import org.apache.commons.collections4.CollectionUtils; |
|
|
|
|
|
import org.springframework.http.MediaType; |
|
|
import org.springframework.stereotype.Component; |
|
|
import org.springframework.stereotype.Component; |
|
|
import org.springframework.transaction.annotation.Transactional; |
|
|
import org.springframework.transaction.annotation.Transactional; |
|
|
|
|
|
|
|
|
|
|
|
import javax.servlet.http.HttpServletResponse; |
|
|
|
|
|
import java.io.IOException; |
|
|
|
|
|
import java.nio.charset.StandardCharsets; |
|
|
|
|
|
import java.time.Duration; |
|
|
import java.time.LocalDateTime; |
|
|
import java.time.LocalDateTime; |
|
|
import java.util.ArrayList; |
|
|
import java.util.ArrayList; |
|
|
import java.util.List; |
|
|
import java.util.List; |
|
@@ -51,7 +62,7 @@ import java.util.stream.Collectors; |
|
|
* @author liuxinxin |
|
|
* @author liuxinxin |
|
|
* @date 2023/2/23 上午8:55 |
|
|
* @date 2023/2/23 上午8:55 |
|
|
*/ |
|
|
*/ |
|
|
|
|
|
|
|
|
|
|
|
@Slf4j |
|
|
@Component |
|
|
@Component |
|
|
@RequiredArgsConstructor |
|
|
@RequiredArgsConstructor |
|
|
public class ExpertManage { |
|
|
public class ExpertManage { |
|
@@ -67,6 +78,44 @@ public class ExpertManage { |
|
|
private final IUserRoleService iUserRoleService; |
|
|
private final IUserRoleService iUserRoleService; |
|
|
private final IRoleService iRoleService; |
|
|
private final IRoleService iRoleService; |
|
|
private final VerifyCodeCheckHelper verifyCodeCheckHelper; |
|
|
private final VerifyCodeCheckHelper verifyCodeCheckHelper; |
|
|
|
|
|
private final CachePlusOps cachePlusOps; |
|
|
|
|
|
|
|
|
|
|
|
private static final Duration REGISTER_EXPIRED_DURATION = Duration.ofDays(3); |
|
|
|
|
|
private static final Duration REGISTER_GEN_DURATION = Duration.ofMinutes(30); |
|
|
|
|
|
|
|
|
|
|
|
private static final String RK_REGISTER_UNIQUE_ID = "expert_registration_id:"; |
|
|
|
|
|
private static final String RK_REGISTER_UNIQUE_ID_LAST = RK_REGISTER_UNIQUE_ID + "last"; |
|
|
|
|
|
|
|
|
|
|
|
public synchronized String getRegistrationUrl() { |
|
|
|
|
|
CacheKey lastKey = new CacheKey(RK_REGISTER_UNIQUE_ID_LAST, REGISTER_GEN_DURATION); |
|
|
|
|
|
String lastUniqueId = cachePlusOps.get(lastKey); |
|
|
|
|
|
if (StrUtil.isBlank(lastUniqueId)) { |
|
|
|
|
|
lastUniqueId = BizUtils.uuid32(); |
|
|
|
|
|
CacheKey key = new CacheKey(); |
|
|
|
|
|
key.setKey(RK_REGISTER_UNIQUE_ID + lastUniqueId); |
|
|
|
|
|
key.setExpire(REGISTER_EXPIRED_DURATION); |
|
|
|
|
|
cachePlusOps.set(lastKey, lastUniqueId); |
|
|
|
|
|
String gmtUserTime = LoginUserUtil.getUserId() + "#" + System.currentTimeMillis(); |
|
|
|
|
|
cachePlusOps.set(key, gmtUserTime); |
|
|
|
|
|
} |
|
|
|
|
|
return WebProperties.webUrl + "/pm/expert/ephemeral/" + lastUniqueId + "/registration"; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public void redirectToRegistrationUrl(String uniqueId, HttpServletResponse response) throws IOException { |
|
|
|
|
|
CacheKey cacheKey = new CacheKey(RK_REGISTER_UNIQUE_ID + uniqueId); |
|
|
|
|
|
response.setContentType(MediaType.TEXT_PLAIN_VALUE); |
|
|
|
|
|
response.setCharacterEncoding(StandardCharsets.UTF_8.name()); |
|
|
|
|
|
try { |
|
|
|
|
|
if (cachePlusOps.exists(cacheKey)) { |
|
|
|
|
|
response.sendRedirect(WebProperties.webUrl + WebProperties.expertRegistrationUrl); |
|
|
|
|
|
} else { |
|
|
|
|
|
response.getWriter().write("专家报名链接已失效"); |
|
|
|
|
|
} |
|
|
|
|
|
} catch (Exception e) { |
|
|
|
|
|
log.error("专家报名链接重定向异常:", e); |
|
|
|
|
|
response.getWriter().write("专家报名链接访问异常"); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
@@ -95,7 +144,8 @@ public class ExpertManage { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
public Long expertRecommendProofSubmit(List<DictionaryFieldInfo> recommendedWay, List<FileBasicInfo> recommendProofFile, Long expertUserId) { |
|
|
|
|
|
|
|
|
public Long expertRecommendProofSubmit |
|
|
|
|
|
(List<DictionaryFieldInfo> recommendedWay, List<FileBasicInfo> recommendProofFile, Long expertUserId) { |
|
|
// 用户id |
|
|
// 用户id |
|
|
ExpertUserFullInfo expertUserFullInfo = iExpertUserFullInfoService.getByUserId(expertUserId); |
|
|
ExpertUserFullInfo expertUserFullInfo = iExpertUserFullInfoService.getByUserId(expertUserId); |
|
|
// 判断专家状态,是否可以进行证明材料提交 |
|
|
// 判断专家状态,是否可以进行证明材料提交 |
|
|