diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/expert/manage/ExpertManage.java b/pmapi/src/main/java/com/ningdatech/pmapi/expert/manage/ExpertManage.java index 0860431..f884ae3 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/expert/manage/ExpertManage.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/expert/manage/ExpertManage.java @@ -44,6 +44,7 @@ import com.ningdatech.pmapi.user.util.LoginUserUtil; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.apache.commons.collections4.CollectionUtils; +import org.springframework.beans.factory.annotation.Value; import org.springframework.http.MediaType; import org.springframework.stereotype.Component; import org.springframework.transaction.annotation.Transactional; @@ -80,6 +81,9 @@ public class ExpertManage { private final VerifyCodeCheckHelper verifyCodeCheckHelper; private final CachePlusOps cachePlusOps; + @Value("${expert-registration.verify-code.check:true}") + private Boolean expertRegistrationVerifyCodeCheck; + private static final Duration REGISTER_EXPIRED_DURATION = Duration.ofDays(3); private static final Duration REGISTER_GEN_DURATION = Duration.ofMinutes(30); @@ -209,7 +213,7 @@ public class ExpertManage { } ExpertUserFullInfo one = iExpertUserFullInfoService.getOne(Wrappers.lambdaQuery(ExpertUserFullInfo.class) .eq(ExpertUserFullInfo::getPhoneNo, phoneNo)); - if (Objects.nonNull(one)) { + if (Objects.nonNull(one) && !one.getUserId().equals(userInfo.getId())) { throw new BizException("该手机号已被专家注册,请确认后再填写"); } return userInfo.getId(); @@ -225,7 +229,7 @@ public class ExpertManage { String verificationCode = request.getVerificationCode(); String phoneNo = request.getBasicInfo().getPhoneNo(); //校验 专家验证码 - if (false) { + if (expertRegistrationVerifyCodeCheck) { verifyCodeCheckHelper.verification(VerificationCodeType.EXPERT_REGISTER, phoneNo, verificationCode); } assemblerAndGenerateExpert(request, null); diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/expert/model/constant/ExpertAuditMsgTemplate.java b/pmapi/src/main/java/com/ningdatech/pmapi/expert/model/constant/ExpertAuditMsgTemplate.java index 6a242ac..84c1b62 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/expert/model/constant/ExpertAuditMsgTemplate.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/expert/model/constant/ExpertAuditMsgTemplate.java @@ -13,11 +13,11 @@ public interface ExpertAuditMsgTemplate { /** * 【丽水市大数据局】尊敬的xxx专家您好,您提交的专家入库申请未通过,如有疑问请联系xxx确认。 */ - String EXPERT_AUDIT_PASS_MSG = "尊敬的%s专家您好,您提交的专家入库申请未通过,如有疑问请联系%s「%s」确认。"; + String EXPERT_AUDIT_FAIL = "尊敬的%s专家您好,您提交的专家入库申请未通过,如有疑问请联系%s「%s」确认。"; /** * 【丽水市大数据局】尊敬的xxx专家您好,您提交的专家入库申请已通过,请登录http://60.188.225.145/login查看,如有疑问请联系xxx。 */ - String EXPERT_AUDIT_FAIL_MSG = "尊敬的%s专家您好,您提交的专家入库申请已通过,请登录%s查看,如有疑问请联系%s「%s」。"; + String EXPERT_AUDIT_PASS = "尊敬的%s专家您好,您提交的专家入库申请已通过,请登录%s查看,如有疑问请联系%s「%s」。"; } diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/expert/service/IExpertAvoidCompanyService.java b/pmapi/src/main/java/com/ningdatech/pmapi/expert/service/IExpertAvoidCompanyService.java index 18b3a5a..5bb31b9 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/expert/service/IExpertAvoidCompanyService.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/expert/service/IExpertAvoidCompanyService.java @@ -1,11 +1,13 @@ package com.ningdatech.pmapi.expert.service; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.ningdatech.pmapi.expert.entity.ExpertAvoidCompany; import com.baomidou.mybatisplus.extension.service.IService; /** *

- * 服务类 + * 服务类 *

* * @author Liuxinxin @@ -13,4 +15,8 @@ import com.baomidou.mybatisplus.extension.service.IService; */ public interface IExpertAvoidCompanyService extends IService { + default void removeByUserId(Long userId) { + remove(Wrappers.lambdaQuery(ExpertAvoidCompany.class).eq(ExpertAvoidCompany::getUserId, userId)); + } + } diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/expert/service/impl/ExpertInfoServiceImpl.java b/pmapi/src/main/java/com/ningdatech/pmapi/expert/service/impl/ExpertInfoServiceImpl.java index feffb1d..3f0b807 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/expert/service/impl/ExpertInfoServiceImpl.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/expert/service/impl/ExpertInfoServiceImpl.java @@ -56,6 +56,8 @@ import java.util.*; import java.util.function.Function; import java.util.stream.Collectors; +import static com.ningdatech.pmapi.expert.model.constant.ExpertAuditMsgTemplate.EXPERT_AUDIT_FAIL; +import static com.ningdatech.pmapi.expert.model.constant.ExpertAuditMsgTemplate.EXPERT_AUDIT_PASS; import static com.ningdatech.yxt.model.cmd.SendSmsCmd.SendSmsContext; /** @@ -104,13 +106,9 @@ public class ExpertInfoServiceImpl implements ExpertInfoService { // 专家信息审核通过之前,所有信息无需备份 iExpertUserFullInfoService.removeById(expertUserFullInfo.getId()); // 删除所有专家标签字段 - LambdaQueryWrapper expertTagRemove = Wrappers.lambdaQuery(ExpertTag.class) - .eq(ExpertTag::getUserId, userId); - iExpertTagService.remove(expertTagRemove); + iExpertTagService.removeByUserId(userId); // 删除所有专家字典字段 - LambdaQueryWrapper expertDictionaryRemove = Wrappers.lambdaQuery(ExpertDictionary.class) - .eq(ExpertDictionary::getUserId, userId); - iExpertDictionaryService.remove(expertDictionaryRemove); + iExpertDictionaryService.removeByUserId(userId); // 删除所有专家履职意向申请 // 补充审核逻辑 LambdaQueryWrapper expertMetaApplyRemove = Wrappers.lambdaQuery(ExpertMetaApply.class) @@ -119,9 +117,7 @@ public class ExpertInfoServiceImpl implements ExpertInfoService { .eq(ExpertMetaApply::getDisplayEnable, BoolDisplayEnum.N.name()); iExpertMetaApplyService.remove(expertMetaApplyRemove); // 删除回避单位 - LambdaQueryWrapper expertAvoidCompanyRemove = Wrappers.lambdaQuery(ExpertAvoidCompany.class) - .eq(ExpertAvoidCompany::getUserId, userId); - iExpertAvoidCompanyService.remove(expertAvoidCompanyRemove); + iExpertAvoidCompanyService.removeByUserId(userId); } saveExpertUserFullInfo.setUserId(userId); saveExpertUserFullInfo.setExpertAccountStatus(ExpertAccountStatusEnum.APPLYING.getKey()); @@ -402,7 +398,7 @@ public class ExpertInfoServiceImpl implements ExpertInfoService { Long expertUserId = cmd.getExpertUserId(); ExpertUserFullInfo expertInfo = iExpertUserFullInfoService.getByUserId(expertUserId); UserInfoDetails userDetail = LoginUserUtil.loginUserDetail(); - String smsContent; + String content; if (cmd.getApplyResult()) { // 修改专家状态为可用 expertInfo.setExpertAccountStatus(ExpertAccountStatusEnum.AVAILABLE.getKey()); @@ -436,15 +432,15 @@ public class ExpertInfoServiceImpl implements ExpertInfoService { userRoleService.save(saveUserRole); } } - smsContent = String.format(ExpertAuditMsgTemplate.EXPERT_AUDIT_PASS_MSG, expertInfo.getExpertName(), userDetail.getRealName(), userDetail.getMobile()); + content = String.format(EXPERT_AUDIT_PASS, expertInfo.getExpertName(), loginUrl, userDetail.getRealName(), userDetail.getMobile()); } else { expertInfo.setUserInfoStep(ExpertUserInfoStepEnum.INFORMATION_TO_BE_SUBMITTED.getKey()); - smsContent = String.format(ExpertAuditMsgTemplate.EXPERT_AUDIT_FAIL_MSG, expertInfo.getExpertName(), loginUrl, userDetail.getRealName(), userDetail.getMobile()); + content = String.format(EXPERT_AUDIT_FAIL, expertInfo.getExpertName(), userDetail.getRealName(), userDetail.getMobile()); } iExpertUserFullInfoService.saveOrUpdate(expertInfo); if (PhoneUtil.isMobile(expertInfo.getPhoneNo())) { SendSmsContext smsCtx = new SendSmsContext(); - smsCtx.setContent(smsContent); + smsCtx.setContent(content); smsCtx.setReceiveNumber(expertInfo.getPhoneNo()); yxtCallOrSmsHelper.sendSms(smsCtx); } diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/meta/service/IExpertDictionaryService.java b/pmapi/src/main/java/com/ningdatech/pmapi/meta/service/IExpertDictionaryService.java index cfb9ed0..18e2de6 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/meta/service/IExpertDictionaryService.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/meta/service/IExpertDictionaryService.java @@ -1,15 +1,16 @@ package com.ningdatech.pmapi.meta.service; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.baomidou.mybatisplus.extension.service.IService; import com.ningdatech.pmapi.meta.constant.DictExpertInfoTypeEnum; import com.ningdatech.pmapi.meta.model.entity.ExpertDictionary; -import com.baomidou.mybatisplus.extension.service.IService; import java.util.Collection; import java.util.List; /** *

- * 服务类 + * 服务类 *

* * @author Liuxinxin @@ -28,4 +29,8 @@ public interface IExpertDictionaryService extends IService { **/ List listByUserId(Collection userIds, DictExpertInfoTypeEnum dictType); + default void removeByUserId(Long userId) { + this.remove(Wrappers.lambdaQuery(ExpertDictionary.class).eq(ExpertDictionary::getUserId, userId)); + } + } diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/meta/service/IExpertTagService.java b/pmapi/src/main/java/com/ningdatech/pmapi/meta/service/IExpertTagService.java index 74e2e8a..bd91a77 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/meta/service/IExpertTagService.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/meta/service/IExpertTagService.java @@ -1,11 +1,12 @@ package com.ningdatech.pmapi.meta.service; -import com.ningdatech.pmapi.meta.model.entity.ExpertTag; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.extension.service.IService; +import com.ningdatech.pmapi.meta.model.entity.ExpertTag; /** *

- * 服务类 + * 服务类 *

* * @author Liuxinxin @@ -13,4 +14,8 @@ import com.baomidou.mybatisplus.extension.service.IService; */ public interface IExpertTagService extends IService { + default void removeByUserId(Long userId) { + remove(Wrappers.lambdaQuery(ExpertTag.class).eq(ExpertTag::getUserId, userId)); + } + } diff --git a/pmapi/src/main/resources/application-dev.yml b/pmapi/src/main/resources/application-dev.yml index 4c5f27b..df8b278 100644 --- a/pmapi/src/main/resources/application-dev.yml +++ b/pmapi/src/main/resources/application-dev.yml @@ -240,5 +240,9 @@ login: url: http://lspm.ningdatech.com/login web: url: http://lspm.ningdatech.com +# 专家报名验证码校验 +expert-registration: + verify-code: + check: false