From 878887bc02b5bcf47481219aadcc09dff5f5cf27 Mon Sep 17 00:00:00 2001 From: WendyYang Date: Mon, 7 Aug 2023 10:23:03 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E4=B8=93=E5=AE=B6=E5=85=A5?= =?UTF-8?q?=E5=BA=93=E5=AE=A1=E6=A0=B8=E7=9F=AD=E4=BF=A1=E9=80=9A=E7=9F=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../pmapi/expert/entity/ExpertMetaApply.java | 4 +-- .../pmapi/expert/manage/ExpertMetaApplyManage.java | 29 ----------------- .../expert/service/impl/ExpertInfoServiceImpl.java | 37 ++++++++++++++++------ .../pmapi/user/convert/UserInfoConvertor.java | 1 + .../user/security/auth/model/UserInfoDetails.java | 3 ++ pmapi/src/main/resources/application-dev.yml | 1 + pmapi/src/main/resources/application-pre.yml | 1 + pmapi/src/main/resources/application-prod.yml | 1 + 8 files changed, 37 insertions(+), 40 deletions(-) diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/expert/entity/ExpertMetaApply.java b/pmapi/src/main/java/com/ningdatech/pmapi/expert/entity/ExpertMetaApply.java index 46c6296..9e83a57 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/expert/entity/ExpertMetaApply.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/expert/entity/ExpertMetaApply.java @@ -17,9 +17,9 @@ import java.time.LocalDateTime; * @author Liuxinxin * @since 2023-03-01 */ -@TableName("expert_meta_apply") -@ApiModel(value = "ExpertMetaApply对象", description = "") @Data +@TableName("expert_meta_apply") +@ApiModel(value = "ExpertMetaApply对象") public class ExpertMetaApply implements Serializable { private static final long serialVersionUID = 1L; diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/expert/manage/ExpertMetaApplyManage.java b/pmapi/src/main/java/com/ningdatech/pmapi/expert/manage/ExpertMetaApplyManage.java index 9810f7a..9d9f11a 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/expert/manage/ExpertMetaApplyManage.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/expert/manage/ExpertMetaApplyManage.java @@ -74,7 +74,6 @@ public class ExpertMetaApplyManage { private final IExpertDictionaryService iExpertDictionaryService; public PageVo metaApplyListQuery(MetaApplyListQuery req) { - Long expertAdminUserId = LoginUserUtil.getUserId(); // 筛选符合专家类型的用户id List filterExpertTypeUserIdList = null; DictionaryFieldInfo expertType = req.getExpertType(); @@ -129,7 +128,6 @@ public class ExpertMetaApplyManage { Long applyId = req.getApplyId(); ExpertMetaApply expertMetaApply = iMetaApplyService.getById(applyId); Long userId = LoginUserUtil.getUserId(); - // 校验专家管理员区域权限,是否可以审核当前专家申请 // permissionCheckHelper.operationPermissionsCheck(userId, expertMetaApply.getUserId()); String applyStatus = expertMetaApply.getApplyStatus(); @@ -186,7 +184,6 @@ public class ExpertMetaApplyManage { break; } - Long expertUserId = expertMetaApply.getUserId(); String auditOpinion = req.getAuditOpinion(); // 发送审核结果短信 // sendApplyResultNotify(applyType, applyResult, auditOpinion, expertUserId); @@ -276,13 +273,11 @@ public class ExpertMetaApplyManage { private void buildIntentionApplyDisplayVO(MetaApplyResultVo metaApplyResultVo, ExpertMetaApply metaApply, ExpertApplyTypeEnum applyTypeEnum) { String regionCode = metaApply.getRegionCode(); Integer regionLevel = metaApply.getRegionLevel(); -// String unionPathStr = regionCache.getUnionPathStr(regionCode, regionLevel); MetaApplyResultVo.IntentionApplyDisplayVO intentionApplyDisplayVO = new MetaApplyResultVo.IntentionApplyDisplayVO(); intentionApplyDisplayVO.setExpertApplyId(metaApply.getId()); ExpertRegionInfo expertRegionInfo = new ExpertRegionInfo(); expertRegionInfo.setRegionCode(regionCode); expertRegionInfo.setRegionLevel(regionLevel); -// expertRegionInfo.setRegionName(unionPathStr); switch (applyTypeEnum) { case EXPERT_INTENTION_LEAVE: { intentionApplyDisplayVO.setReduceExpertRegion(expertRegionInfo); @@ -298,30 +293,6 @@ public class ExpertMetaApplyManage { metaApplyResultVo.setIntentionApplyDisplayVo(intentionApplyDisplayVO); } -// private void buildInfoModifyApplyDisplayVO(MetaApplyResultVo metaApplyResultVo, ExpertMetaApply infoModifyApply) { -// InfoModifyApplyDisplayVO infoModifyApplyDisplayVo = new InfoModifyApplyDisplayVO(); -// if (Objects.nonNull(infoModifyApply)) { -// Long metaApplyId = infoModifyApply.getId(); -// LambdaQueryWrapper eq = Wrappers.lambdaQuery(ExpertSensitiveInfoModifyDetailRecord.class) -// .eq(ExpertSensitiveInfoModifyDetailRecord::getMetaApplyId, metaApplyId); -// ExpertSensitiveInfoModifyDetailRecord one = iExpertSensitiveInfoModifyDetailRecordService.getOne(eq); -// String originalJson = null; -// if (StringUtils.isNotBlank(one.getOriginalJson())) { -// originalJson = GzipUtils.uncompress(one.getOriginalJson()); -// } -// List sensitiveModifySegments = JSONUtils.parseArray(originalJson, SensitiveModifySegment.class); -// -// infoModifyApplyDisplayVo.setExpertApplyId(metaApplyId); -// List displayValueList = new ArrayList<>(); -// for (SensitiveModifySegment segment : sensitiveModifySegments) { -// InfoModifyApplyDisplayVO.InfoModifyApplyDisplayValue displayValue = sensitiveModifySegmentParser.getDisplayValue(segment); -// displayValueList.add(displayValue); -// } -// infoModifyApplyDisplayVo.setInfoModifyApplyDisplayValueList(displayValueList); -// metaApplyResultVo.setInfoModifyApplyDisplayVo(infoModifyApplyDisplayVo); -// } -// } - private String applyTypeTrans(ExpertApplyTypeEnum applyTypeEnum) { switch (applyTypeEnum) { case EXPERT_INTENTION_JOIN: 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 4845abf..4000df0 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 @@ -1,6 +1,7 @@ package com.ningdatech.pmapi.expert.service.impl; import cn.hutool.core.collection.CollUtil; +import cn.hutool.core.util.PhoneUtil; import com.alibaba.fastjson.JSONObject; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; @@ -19,9 +20,11 @@ import com.ningdatech.pmapi.expert.model.SensitiveModifySegment; import com.ningdatech.pmapi.expert.model.TagFieldInfo; import com.ningdatech.pmapi.expert.model.bo.ExpertInfoSensitiveFieldCheckBO; import com.ningdatech.pmapi.expert.model.cmd.*; +import com.ningdatech.pmapi.expert.model.constant.ExpertAuditMsgTemplate; import com.ningdatech.pmapi.expert.model.dto.*; import com.ningdatech.pmapi.expert.service.*; import com.ningdatech.pmapi.expert.utils.SensitiveModifySegmentUtils; +import com.ningdatech.pmapi.meeting.helper.YxtCallOrSmsHelper; import com.ningdatech.pmapi.meta.constant.DictExpertInfoTypeEnum; import com.ningdatech.pmapi.meta.constant.ExpertTagEnum; import com.ningdatech.pmapi.meta.model.ExpertRegionInfo; @@ -33,16 +36,17 @@ import com.ningdatech.pmapi.sys.model.entity.Role; import com.ningdatech.pmapi.sys.model.entity.UserRole; import com.ningdatech.pmapi.sys.service.IRoleService; import com.ningdatech.pmapi.sys.service.IUserRoleService; -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.security.auth.model.UserInfoDetails; import com.ningdatech.pmapi.user.service.IUserInfoService; import com.ningdatech.pmapi.user.util.LoginUserUtil; import com.ningdatech.yxt.utils.JSONUtils; import lombok.RequiredArgsConstructor; import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.lang3.StringUtils; +import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Component; import org.springframework.transaction.annotation.Transactional; @@ -51,6 +55,8 @@ import java.util.*; import java.util.function.Function; import java.util.stream.Collectors; +import static com.ningdatech.yxt.model.cmd.SendSmsCmd.SendSmsContext; + /** * @author liuxinxin * @date 2022/7/22 下午4:39 @@ -69,7 +75,10 @@ public class ExpertInfoServiceImpl implements ExpertInfoService { private final IUserRoleService userRoleService; private final IExpertSensitiveInfoModifyDetailRecordService iExpertSensitiveInfoModifyDetailRecordService; private final IUserInfoService userInfoService; + private final YxtCallOrSmsHelper yxtCallOrSmsHelper; + @Value("${login.url:}") + private String loginUrl; /** * 用户第一次申请修改,仅在专家用户状态为applying 状态时调用 @@ -387,16 +396,18 @@ public class ExpertInfoServiceImpl implements ExpertInfoService { @Transactional(rollbackFor = Exception.class) public void expertStorageDeal(ExpertStorageDealCmd cmd) { Long expertUserId = cmd.getExpertUserId(); - ExpertUserFullInfo expertUserFullInfo = iExpertUserFullInfoService.getByUserId(expertUserId); + ExpertUserFullInfo expertInfo = iExpertUserFullInfoService.getByUserId(expertUserId); + UserInfoDetails userDetail = LoginUserUtil.loginUserDetail(); + String smsContent; if (cmd.getApplyResult()) { // 修改专家状态为可用 - expertUserFullInfo.setExpertAccountStatus(ExpertAccountStatusEnum.AVAILABLE.getKey()); - expertUserFullInfo.setRemark(cmd.getRemark()); - expertUserFullInfo.setRegionCode(cmd.getJoinRegionCode()); - expertUserFullInfo.setRegionLevel(cmd.getJoinRegionLevel()); + expertInfo.setExpertAccountStatus(ExpertAccountStatusEnum.AVAILABLE.getKey()); + expertInfo.setRemark(cmd.getRemark()); + expertInfo.setRegionCode(cmd.getJoinRegionCode()); + expertInfo.setRegionLevel(cmd.getJoinRegionLevel()); // 账号启用 LambdaUpdateWrapper userInfoUpdate = Wrappers.lambdaUpdate(UserInfo.class) - .eq(UserInfo::getId,expertUserId) + .eq(UserInfo::getId, expertUserId) .set(UserInfo::getAvailable, UserAvailableEnum.ENABLE); userInfoService.update(userInfoUpdate); @@ -421,10 +432,18 @@ public class ExpertInfoServiceImpl implements ExpertInfoService { userRoleService.save(saveUserRole); } } + smsContent = String.format(ExpertAuditMsgTemplate.EXPERT_AUDIT_PASS_MSG, expertInfo.getExpertName(), userDetail.getRealName(), userDetail.getMobile()); } else { - expertUserFullInfo.setUserInfoStep(ExpertUserInfoStepEnum.INFORMATION_TO_BE_SUBMITTED.getKey()); + expertInfo.setUserInfoStep(ExpertUserInfoStepEnum.INFORMATION_TO_BE_SUBMITTED.getKey()); + smsContent = String.format(ExpertAuditMsgTemplate.EXPERT_AUDIT_FAIL_MSG, expertInfo.getExpertName(), loginUrl, userDetail.getRealName(), userDetail.getMobile()); + } + iExpertUserFullInfoService.saveOrUpdate(expertInfo); + if (PhoneUtil.isMobile(expertInfo.getPhoneNo())) { + SendSmsContext smsCtx = new SendSmsContext(); + smsCtx.setContent(smsContent); + smsCtx.setReceiveNumber(expertInfo.getPhoneNo()); + yxtCallOrSmsHelper.sendSms(smsCtx); } - iExpertUserFullInfoService.saveOrUpdate(expertUserFullInfo); } diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/user/convert/UserInfoConvertor.java b/pmapi/src/main/java/com/ningdatech/pmapi/user/convert/UserInfoConvertor.java index 7fa0e38..4fc4e59 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/user/convert/UserInfoConvertor.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/user/convert/UserInfoConvertor.java @@ -32,6 +32,7 @@ public class UserInfoConvertor { userInfoDetails.setOrganizationName(userFullInfo.getOrganizationName()); userInfoDetails.setEmpPosUnitCode(userFullInfo.getEmpPosUnitCode()); userInfoDetails.setEmpPosUnitName(userFullInfo.getEmpPosUnitName()); + userInfoDetails.setMobile(userFullInfo.getMobile()); return userInfoDetails; } diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/user/security/auth/model/UserInfoDetails.java b/pmapi/src/main/java/com/ningdatech/pmapi/user/security/auth/model/UserInfoDetails.java index c477497..c237caa 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/user/security/auth/model/UserInfoDetails.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/user/security/auth/model/UserInfoDetails.java @@ -73,6 +73,9 @@ public class UserInfoDetails extends AbstractLoginUser implements UserDetails { private String empPosUnitName; + private String mobile; + + /** * 获取用户权限 * diff --git a/pmapi/src/main/resources/application-dev.yml b/pmapi/src/main/resources/application-dev.yml index 12506d8..99c66e3 100644 --- a/pmapi/src/main/resources/application-dev.yml +++ b/pmapi/src/main/resources/application-dev.yml @@ -253,5 +253,6 @@ hostname: iZbp13nwyvib53j4j1p2xoZ login: phone-verify-code: skip: true + url: http://lspm.ningdatech.com/login diff --git a/pmapi/src/main/resources/application-pre.yml b/pmapi/src/main/resources/application-pre.yml index 27b951d..203a5ec 100644 --- a/pmapi/src/main/resources/application-pre.yml +++ b/pmapi/src/main/resources/application-pre.yml @@ -255,3 +255,4 @@ hostname: iZ6mx01asxnsmennpzoxooZ login: phone-verify-code: skip: true + url: http://60.188.225.145:8080/login diff --git a/pmapi/src/main/resources/application-prod.yml b/pmapi/src/main/resources/application-prod.yml index 23da4c4..b2ab273 100644 --- a/pmapi/src/main/resources/application-prod.yml +++ b/pmapi/src/main/resources/application-prod.yml @@ -255,3 +255,4 @@ hostname: iZ6mx01gyeodd80imxd2gbZ login: phone-verify-code: skip: true + url: http://60.188.225.145/login