diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/common/helper/impl/UserInfoHelperImpl.java b/pmapi/src/main/java/com/ningdatech/pmapi/common/helper/impl/UserInfoHelperImpl.java index 1551e98..4eb4bbe 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/common/helper/impl/UserInfoHelperImpl.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/common/helper/impl/UserInfoHelperImpl.java @@ -13,6 +13,7 @@ import com.ningdatech.pmapi.sys.mapper.RoleMapper; import com.ningdatech.pmapi.sys.model.entity.Role; import com.ningdatech.pmapi.sys.model.entity.UserRole; import com.ningdatech.pmapi.sys.service.IUserRoleService; +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.UserFullInfoDTO; @@ -118,6 +119,11 @@ public class UserInfoHelperImpl implements UserInfoHelper { userFullInfo.setUsername(userInfo.getRealName()); userFullInfo.setMobile(userInfo.getMobile()); userFullInfo.setAccountId(userInfo.getAccountId()); + + String available = userInfo.getAvailable(); + if (StringUtils.isNotBlank(available)) { + userFullInfo.setAvailable(UserAvailableEnum.valueOf(available)); + } return userFullInfo; } diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/expert/controller/ExpertController.java b/pmapi/src/main/java/com/ningdatech/pmapi/expert/controller/ExpertController.java index c20f006..43be4e3 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/expert/controller/ExpertController.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/expert/controller/ExpertController.java @@ -6,6 +6,7 @@ import com.ningdatech.pmapi.expert.manage.ExpertAdminManage; import com.ningdatech.pmapi.expert.manage.ExpertManage; import com.ningdatech.pmapi.expert.model.ExpertAdminExpertManageQuery; import com.ningdatech.pmapi.expert.model.req.AdminExpertBasicInfoModifyRequest; +import com.ningdatech.pmapi.expert.model.req.ExpertRegistrationRequest; import com.ningdatech.pmapi.expert.model.req.ExpertUserBasicInfoSubmitRequest; import com.ningdatech.pmapi.expert.model.req.GetZzdInfoRequest; import com.ningdatech.pmapi.expert.model.vo.ExpertAdminExpertManageListVO; @@ -37,11 +38,11 @@ public class ExpertController { private final ExpertManage expertManage; private final ExpertAdminManage expertAdminManage; -// @PostMapping("/basic-info-submit") -// @ApiOperation("专家管理员新增专家)") -// public void expertBasicInfoSubmit(@Valid @RequestBody ExpertUserBasicInfoSubmitRequest request) { -// expertManage.expertBasicInfoSubmit(request); -// } + @PostMapping("/registration") + @ApiOperation("社会专家报名") + public void expertRegistration(@Valid @RequestBody ExpertRegistrationRequest request) { + expertManage.expertRegistration(request); + } @PostMapping("/basic-info-submit") @ApiOperation("专家管理员新增专家)") 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 08ee800..3cfc16a 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 @@ -17,13 +17,15 @@ import com.ningdatech.pmapi.expert.model.cmd.ExpertFullInfoSaveCmd; import com.ningdatech.pmapi.expert.model.cmd.ExpertRecommendProofSaveCmd; import com.ningdatech.pmapi.expert.model.dto.ExpertDictionaryDTO; import com.ningdatech.pmapi.expert.model.dto.ExpertFullInfoAllDTO; +import com.ningdatech.pmapi.expert.model.req.ExpertRegistrationRequest; import com.ningdatech.pmapi.expert.model.req.ExpertUserBasicInfoSubmitRequest; -import com.ningdatech.pmapi.expert.model.req.MetaApplyResultRequest; import com.ningdatech.pmapi.expert.model.vo.ExpertFullInfoVO; import com.ningdatech.pmapi.expert.service.ExpertInfoService; import com.ningdatech.pmapi.expert.service.IExpertUserFullInfoService; import com.ningdatech.pmapi.meta.constant.DictExpertInfoTypeEnum; import com.ningdatech.pmapi.meta.model.ExpertRegionInfo; +import com.ningdatech.pmapi.sms.constant.VerificationCodeType; +import com.ningdatech.pmapi.sms.helper.VerifyCodeCheckHelper; import com.ningdatech.pmapi.sys.model.entity.Role; import com.ningdatech.pmapi.sys.model.entity.UserRole; import com.ningdatech.pmapi.sys.service.IRoleService; @@ -63,62 +65,20 @@ public class ExpertManage { private final ExpertMetaApplyManage expertMetaApplyManage; private final IUserRoleService iUserRoleService; private final IRoleService iRoleService; + private final VerifyCodeCheckHelper verifyCodeCheckHelper; /** - * 填写基本信息,只有专家自己可用 + * 专家管理员新增专家 * * @param req / */ @Transactional(rollbackFor = Exception.class) public void expertBasicInfoSubmit(ExpertUserBasicInfoSubmitRequest req) { // 用户id - ExpertBasicInfo basicInfo = req.getBasicInfo(); - Long userId = generateOrGetUserId(basicInfo); - - // 校验区域编码合法性 校验履职意向编码合法性 - ExpertRegionInfo expertRegionInfo = basicInfo.getExpertRegionInfo(); - expertManageHelper.expertRegionInfoCheck(expertRegionInfo); - List expertIntentionWorkRegions = basicInfo.getExpertIntentionWorkRegions(); - for (ExpertRegionInfo expertIntentionWorkRegion : expertIntentionWorkRegions) { - expertManageHelper.expertRegionInfoCheck(expertIntentionWorkRegion); - } - ExpertEduInfo eduInfo = req.getEduInfo(); - ExpertJobInfo jobInfo = req.getJobInfo(); - ExpertProfessionalInfo professionalInfo = req.getProfessionalInfo(); - // 校验标签字段 - expertManageHelper.tagFieldCheck(professionalInfo, basicInfo); - // 校验字典字段 - expertManageHelper.dictionaryFieldCheck(basicInfo, eduInfo, jobInfo); - // 判断专家提交状态,判断是否可以进行此操作 - ExpertUserFullInfo expertUserFullInfo = iExpertUserFullInfoService.getByUserId(userId); - - boolean submitBasicInfoStatusEnable = Objects.isNull(expertUserFullInfo) - || (ExpertAccountStatusEnum.APPLYING.getKey().equals(expertUserFullInfo.getExpertAccountStatus()) - && !ExpertUserInfoStepEnum.EVIDENCE_HAS_BEEN_SUBMITTED.getKey().equals(expertUserFullInfo.getUserInfoStep())); - if (submitBasicInfoStatusEnable) { - // 新建 保存 - ExpertFullInfoSaveCmd expertFullInfoSaveCmd = ExpertInfoCmdAssembler - .buildExpertFullInfoSaveCmd(userId, basicInfo, eduInfo, jobInfo, professionalInfo); - expertInfoService.saveExpertInfo(expertFullInfoSaveCmd); - } - - ExpertRecommendInfo recommendInfo = req.getRecommendInfo(); - // 推荐证明材料 - List recommendedWay = recommendInfo.getRecommendedWay(); - // 推荐方式 - List recommendProofFile = recommendInfo.getRecommendationProofFile(); - Long applyId = expertRecommendProofSubmit(recommendedWay, recommendProofFile, userId); - - // 批量通过专家管理员审核 - MetaApplyResultRequest applyResult = new MetaApplyResultRequest(); - applyResult.setApplyId(applyId); - applyResult.setAuditOpinion("同意"); - applyResult.setApplyResult(true); - expertMetaApplyManage.metaApplyResult(applyResult); - - // 批量通过专家履职意向审核 - expertMetaApplyManage.autoPassExpertIntentionApply(userId); + Long userId = assemblerAndGenerateExpert(req); + // 批量通过专家入库审核/专家履职意向审核 + expertMetaApplyManage.autoPassExpertApply(userId); // 增加用户专家角色 Role expertRole = iRoleService.getOne(Wrappers.lambdaQuery(Role.class).eq(Role::getCode, RoleEnum.EXPERT.name())); @@ -205,4 +165,63 @@ public class ExpertManage { } return userInfo.getId(); } + + /** + * 社会专家报名 需要校验手机号 + * + * @param request + */ + @Transactional(rollbackFor = Exception.class) + public void expertRegistration(ExpertRegistrationRequest request) { + String verificationCode = request.getVerificationCode(); + String phoneNo = request.getBasicInfo().getPhoneNo(); + //校验 专家验证码 + if (false) { + verifyCodeCheckHelper.verification(VerificationCodeType.EXPERT_REGISTER, phoneNo, verificationCode); + } + assemblerAndGenerateExpert(request); + } + + + @Transactional(rollbackFor = Exception.class) + public Long assemblerAndGenerateExpert(ExpertUserBasicInfoSubmitRequest req) { + ExpertBasicInfo basicInfo = req.getBasicInfo(); + Long userId = generateOrGetUserId(basicInfo); + + // 校验区域编码合法性 校验履职意向编码合法性 + ExpertRegionInfo expertRegionInfo = basicInfo.getExpertRegionInfo(); + expertManageHelper.expertRegionInfoCheck(expertRegionInfo); + List expertIntentionWorkRegions = basicInfo.getExpertIntentionWorkRegions(); + for (ExpertRegionInfo expertIntentionWorkRegion : expertIntentionWorkRegions) { + expertManageHelper.expertRegionInfoCheck(expertIntentionWorkRegion); + } + ExpertEduInfo eduInfo = req.getEduInfo(); + ExpertJobInfo jobInfo = req.getJobInfo(); + ExpertProfessionalInfo professionalInfo = req.getProfessionalInfo(); + // 校验标签字段 + expertManageHelper.tagFieldCheck(professionalInfo, basicInfo); + // 校验字典字段 + expertManageHelper.dictionaryFieldCheck(basicInfo, eduInfo, jobInfo); + // 判断专家提交状态,判断是否可以进行此操作 + ExpertUserFullInfo expertUserFullInfo = iExpertUserFullInfoService.getByUserId(userId); + + boolean submitBasicInfoStatusEnable = Objects.isNull(expertUserFullInfo) + || (ExpertAccountStatusEnum.APPLYING.getKey().equals(expertUserFullInfo.getExpertAccountStatus()) + && !ExpertUserInfoStepEnum.EVIDENCE_HAS_BEEN_SUBMITTED.getKey().equals(expertUserFullInfo.getUserInfoStep())); + if (submitBasicInfoStatusEnable) { + // 新建 保存 + ExpertFullInfoSaveCmd expertFullInfoSaveCmd = ExpertInfoCmdAssembler + .buildExpertFullInfoSaveCmd(userId, basicInfo, eduInfo, jobInfo, professionalInfo); + expertInfoService.saveExpertInfo(expertFullInfoSaveCmd); + } + + ExpertRecommendInfo recommendInfo = req.getRecommendInfo(); + // 推荐证明材料 + List recommendedWay = recommendInfo.getRecommendedWay(); + // 推荐方式 + List recommendProofFile = recommendInfo.getRecommendationProofFile(); + expertRecommendProofSubmit(recommendedWay, recommendProofFile, userId); + return userId; + } + } 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 bb7fd84..a2f301c 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 @@ -591,11 +591,16 @@ public class ExpertMetaApplyManage { return expertIntentionApplyDealCmd; } - public void autoPassExpertIntentionApply(Long expertUserId) { + /** + * 专家管理员 新增专家使用使用 + * @param expertUserId + */ + @Transactional(rollbackFor = Exception.class) + public void autoPassExpertApply(Long expertUserId) { List expertIntentionJoinApplyList = iMetaApplyService.list(Wrappers .lambdaQuery(ExpertMetaApply.class) .eq(ExpertMetaApply::getUserId, expertUserId) - .eq(ExpertMetaApply::getApplyType, ExpertApplyTypeEnum.EXPERT_INTENTION_JOIN.getKey()) + .in(ExpertMetaApply::getApplyType, ExpertApplyTypeEnum.EXPERT_INTENTION_JOIN.getKey(), ExpertApplyTypeEnum.EXPERT_STORAGE.getKey()) .eq(ExpertMetaApply::getApplyStatus, ExpertApplyStatusEnum.PENDING_REVIEW.getKey())); for (ExpertMetaApply expertMetaApply : expertIntentionJoinApplyList) { diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/expert/model/req/ExpertRegistrationRequest.java b/pmapi/src/main/java/com/ningdatech/pmapi/expert/model/req/ExpertRegistrationRequest.java new file mode 100644 index 0000000..67c4ba4 --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/expert/model/req/ExpertRegistrationRequest.java @@ -0,0 +1,21 @@ +package com.ningdatech.pmapi.expert.model.req; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import javax.validation.constraints.NotBlank; + +/** + * @author liuxinxin + * @date 2022/7/25 下午2:21 + */ +@Data +@ApiModel(value = "ExpertUserBasicInfoSubmitRequest", description = "社会专家报名接口") +public class ExpertRegistrationRequest extends ExpertUserBasicInfoSubmitRequest { + + @NotBlank(message = "手机验证码不能为空") + @ApiModelProperty("手机验证码") + private String verificationCode; + +} \ No newline at end of file diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/DefaultDeclaredProjectManage.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/DefaultDeclaredProjectManage.java index 0ce5555..87eba24 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/DefaultDeclaredProjectManage.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/DefaultDeclaredProjectManage.java @@ -17,6 +17,7 @@ import com.ningdatech.pmapi.projectlib.model.dto.ProjectDTO; import com.ningdatech.pmapi.projectlib.model.entity.Project; import com.ningdatech.pmapi.projectlib.service.IProjectService; import com.ningdatech.pmapi.user.security.auth.model.UserFullInfoDTO; +import com.ningdatech.pmapi.user.security.auth.model.UserInfoDetails; import com.ningdatech.pmapi.user.util.LoginUserUtil; import com.wflow.bean.entity.WflowModels; import com.wflow.bean.entity.WflowOrgModels; @@ -216,15 +217,13 @@ public class DefaultDeclaredProjectManage { } //根据提交者的单位 - public DeclaredProjectStatisticsPO declaredProjectOrgStatistics(Integer year){ - UserFullInfoDTO user = userInfoHelper.getUserFullInfo(LoginUserUtil.getUserId()); + public DeclaredProjectStatisticsPO declaredProjectOrgStatistics(Integer year, UserFullInfoDTO user){ //查此人建设单位的项目 return statisticsService.getOrgStatistics(user.getEmpPosUnitCode(),year); } //根据提交者的区域 他是区管或者超管 - public DeclaredProjectStatisticsPO declaredProjectRegionStatistics(Integer year){ - UserFullInfoDTO user = userInfoHelper.getUserFullInfo(LoginUserUtil.getUserId()); + public DeclaredProjectStatisticsPO declaredProjectRegionStatistics(Integer year, UserFullInfoDTO user){ //查此人建设单位的项目 return statisticsService.getRegionStatistics(user.getRegionCode(),year); } diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/controller/ProjectLibController.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/controller/ProjectLibController.java index 7e0b694..fa5b865 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/controller/ProjectLibController.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/controller/ProjectLibController.java @@ -1,10 +1,13 @@ package com.ningdatech.pmapi.projectlib.controller; import com.ningdatech.basic.model.PageVo; +import com.ningdatech.pmapi.common.helper.UserInfoHelper; import com.ningdatech.pmapi.projectlib.manage.ProjectLibManage; import com.ningdatech.pmapi.projectlib.model.req.ProjectListReq; import com.ningdatech.pmapi.projectlib.model.vo.ProjectDetailVO; import com.ningdatech.pmapi.projectlib.model.vo.ProjectLibListItemVO; +import com.ningdatech.pmapi.user.security.auth.model.UserFullInfoDTO; +import com.ningdatech.pmapi.user.util.LoginUserUtil; import com.wflow.workflow.bean.vo.ProcessDetailVO; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; @@ -31,10 +34,13 @@ public class ProjectLibController { private final ProjectLibManage projectLibManage; + private final UserInfoHelper userInfoHelper; + @GetMapping("/list") @ApiOperation("项目库列表") public PageVo projectLibList(ProjectListReq req) { - return projectLibManage.projectLibListWithPermission(req); + UserFullInfoDTO user = userInfoHelper.getUserFullInfo(LoginUserUtil.getUserId()); + return projectLibManage.projectLibListWithPermission(req,user); } @GetMapping("/{id}") diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/manage/ProjectLibManage.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/manage/ProjectLibManage.java index 5277eff..d18fdc0 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/manage/ProjectLibManage.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/manage/ProjectLibManage.java @@ -108,9 +108,9 @@ public class ProjectLibManage { return PageVo.of(records, total); } - public PageVo projectLibListWithPermission(ProjectListReq req) { + public PageVo projectLibListWithPermission(ProjectListReq req,UserFullInfoDTO user) { LambdaQueryWrapper query = ProjectHelper.projectQuery(req); - UserFullInfoDTO user = buildProjectLibPermission(query); + user = buildProjectLibPermission(query,user); //项目查最新 query.eq(Project::getNewest,Boolean.TRUE); Page page = projectService.page(req.page(), query); @@ -118,6 +118,7 @@ public class ProjectLibManage { if ((total = page.getTotal()) == 0) { return PageVo.empty(); } + UserFullInfoDTO finalUser = user; List records = CollUtils.convert(page.getRecords(), w -> { ProjectLibListItemVO item = new ProjectLibListItemVO(); item.setId(w.getId()); @@ -133,10 +134,10 @@ public class ProjectLibManage { item.setProcessStatus(w.getProcessStatus()); item.setInstCode(w.getInstCode()); item.setIsHigherSuperOrg(w.getIsHigherSuperOrg()); - if (user.getIsOrgAdmin() && + if (finalUser.getIsOrgAdmin() && ProjectStatusEnum.PENDING_PREQUALIFICATION.getCode().equals(item.getStatus()) - && StringUtils.isNotBlank(w.getSuperOrgCode()) && StringUtils.isNotBlank(user.getEmpPosUnitCode()) - && w.getSuperOrgCode().equals(user.getEmpPosUnitCode())) { + && StringUtils.isNotBlank(w.getSuperOrgCode()) && StringUtils.isNotBlank(finalUser.getEmpPosUnitCode()) + && w.getSuperOrgCode().equals(finalUser.getEmpPosUnitCode())) { item.setCanPreDeclared(Boolean.TRUE); } return item; @@ -522,8 +523,7 @@ public class ProjectLibManage { * * @param query */ - public UserFullInfoDTO buildProjectLibPermission(LambdaQueryWrapper query) { - UserFullInfoDTO user = userInfoHelper.getUserFullInfo(LoginUserUtil.getUserId()); + public UserFullInfoDTO buildProjectLibPermission(LambdaQueryWrapper query,UserFullInfoDTO user) { Optional currentUserDataScope = DataScopeUtil.getCurrentUserDataScope(user); if (!currentUserDataScope.isPresent()) { log.warn("没有取到权限信息 当前查询 没有权限条件"); diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/sms/constant/VerificationCodeType.java b/pmapi/src/main/java/com/ningdatech/pmapi/sms/constant/VerificationCodeType.java index 9761d18..4c4ac97 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/sms/constant/VerificationCodeType.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/sms/constant/VerificationCodeType.java @@ -20,9 +20,14 @@ import java.util.stream.Stream; public enum VerificationCodeType { /** - * 用户注册 + * 用户登陆 */ - LOGIN("用户登录", 1, 5, 10); + LOGIN("用户登录", 1, 5, 10), + + /** + * 社会专家注册 + */ + EXPERT_REGISTER("社会专家注册", 1, 5, 10); @ApiModelProperty(value = "描述") private String desc; diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/sms/constant/VoiceSmsTemplateConst.java b/pmapi/src/main/java/com/ningdatech/pmapi/sms/constant/VoiceSmsTemplateConst.java index 0fea8eb..030855d 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/sms/constant/VoiceSmsTemplateConst.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/sms/constant/VoiceSmsTemplateConst.java @@ -13,7 +13,12 @@ public interface VoiceSmsTemplateConst { /** * 短信登陆验证码 */ - String SMS_LOGIN_TEMPLATE = "验证码:%s(有效期为%s分钟),请勿泄露给他人,如非本人操作,请忽略此信息。"; + String SMS_COMMON_TEMPLATE = "验证码:%s(有效期为%s分钟),请勿泄露给他人,如非本人操作,请忽略此信息。"; + + /** + * 社会专家报名 + */ + String EXPERT_REGISTER = "专家报名验证码:%s(有效期为%s分钟),请勿泄露给他人,如非本人操作,请忽略此信息。"; /** * 专家电话通知语音模版 diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/sms/manage/SmsManage.java b/pmapi/src/main/java/com/ningdatech/pmapi/sms/manage/SmsManage.java index e65ce28..79717a1 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/sms/manage/SmsManage.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/sms/manage/SmsManage.java @@ -66,16 +66,26 @@ public class SmsManage { // 创建短信内容 SendSmsCmd sendSmsCmd = new SendSmsCmd(); switch (verificationCodeTypeEnum) { - case LOGIN: + case LOGIN: { SendSmsCmd.SendSmsContext sendSmsContext = new SendSmsCmd.SendSmsContext(); sendSmsContext.setReceiveNumber(request.getMobile()); - sendSmsContext.setContent(String.format(VoiceSmsTemplateConst.SMS_LOGIN_TEMPLATE, code, verificationCodeTypeEnum.getExpireTime())); + sendSmsContext.setContent(String.format(VoiceSmsTemplateConst.SMS_COMMON_TEMPLATE, code, verificationCodeTypeEnum.getExpireTime())); sendSmsCmd.setContextList(Collections.singletonList(sendSmsContext)); sendSmsCmd.setSmsSignEnum(YxtSmsSignEnum.ZJS_ELECTRONIC_EXPERT_LIB); - break; + } + break; + case EXPERT_REGISTER: { + SendSmsCmd.SendSmsContext sendSmsContext = new SendSmsCmd.SendSmsContext(); + sendSmsContext.setReceiveNumber(request.getMobile()); + sendSmsContext.setContent(String.format(VoiceSmsTemplateConst.EXPERT_REGISTER, code, verificationCodeTypeEnum.getExpireTime())); + sendSmsCmd.setContextList(Collections.singletonList(sendSmsContext)); + sendSmsCmd.setSmsSignEnum(YxtSmsSignEnum.ZJS_ELECTRONIC_EXPERT_LIB); + } + break; default: throw new IllegalArgumentException("非法的短信发送类型"); } + // 发送 短信 yxtClient.submitSmsTask(sendSmsCmd); log.info("send verificationCode mobile = {},code = {}", request.getMobile(), code); diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/staging/utils/WorkNoticeFlowMapUtil.java b/pmapi/src/main/java/com/ningdatech/pmapi/staging/utils/WorkNoticeFlowMapUtil.java index 072f0a7..762c3f5 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/staging/utils/WorkNoticeFlowMapUtil.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/staging/utils/WorkNoticeFlowMapUtil.java @@ -26,6 +26,7 @@ public class WorkNoticeFlowMapUtil { * 扫描的间隔越来越长 秒数 */ public WorkNoticeFlowMapUtil(){ + intervalTimeMap.put(0,60); intervalTimeMap.put(1,60 * 2); intervalTimeMap.put(2,60 * 6); intervalTimeMap.put(3,60 * 15); diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/manage/TodoCenterManage.java b/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/manage/TodoCenterManage.java index fce580b..b3708f3 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/manage/TodoCenterManage.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/manage/TodoCenterManage.java @@ -122,11 +122,7 @@ public class TodoCenterManage { private final RuntimeService runtimeService; private final IProjectService projectService; private final ProjectLibManage projectLibManage; - private final StateMachineUtils stateMachineUtils; - private final IDingEmployeeInfoService dingEmployeeInfoService; - private final IDingOrganizationService dingOrganizationService; private final ProcessInstanceService processInstanceService; - private final INdWorkNoticeStagingService workNoticeStagingService; private final DefaultDeclaredProjectManage defaultDeclaredProjectManage; private final IProjectApplicationService projectApplicationService; private final UserInfoHelper userInfoHelper; @@ -152,12 +148,15 @@ public class TodoCenterManage { * @since 2023/02/18 */ public PageVo todoProjectList(ToBeProcessedReq param) { - // 获取登录用户ID - Long userId = LoginUserUtil.getUserId(); - // 获取登录用户全量信息 - UserFullInfoDTO userFullInfo = userInfoHelper.getUserFullInfo(userId); - // 获取员工浙政钉code - String employeeCode = userFullInfo.getEmployeeCode(); + String employeeCode = param.getEmployeeCode(); + if(StringUtils.isBlank(employeeCode)){ + // 获取登录用户ID + Long userId = LoginUserUtil.getUserId(); + // 获取登录用户全量信息 + UserFullInfoDTO userFullInfo = userInfoHelper.getUserFullInfo(userId); + // 获取员工浙政钉code + employeeCode = userFullInfo.getEmployeeCode(); + } // 查出项目库项目 ProjectListReq projectListReq = new ProjectListReq(); @@ -184,7 +183,6 @@ public class TodoCenterManage { Integer pageNumber = param.getPageNumber(); Integer pageSize = param.getPageSize(); req.setProcessDefId(param.getProcessDefId()); - req.setUserId(String.valueOf(userId)); req.setEmployeeCode(employeeCode); //有待办节点的(不包含退回) List todoList = processTaskService.getUserTodoList(req); @@ -1136,13 +1134,7 @@ public class TodoCenterManage { } //获取当前登录人的 待办中心统计数据 - public TodoCenterStatisticsVO todoCenterStatistics(){ - Long userId = LoginUserUtil.getUserId(); - // 获取登录用户全量信息 - UserFullInfoDTO userFullInfo = userInfoHelper.getUserFullInfo(userId); - // 获取登录用户浙政钉code - String employeeCode = userFullInfo.getEmployeeCode(); - + public TodoCenterStatisticsVO todoCenterStatistics(String employeeCode){ //为了查询效率 还是自己去写统计接口 TodoCenterStatisticsPO statistics = statisticsService.getStatistics(employeeCode); TodoCenterStatisticsVO statisticsVO = BeanUtil.copyProperties(statistics,TodoCenterStatisticsVO.class); diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/model/req/ToBeProcessedReq.java b/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/model/req/ToBeProcessedReq.java index cb9a254..b0927a9 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/model/req/ToBeProcessedReq.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/model/req/ToBeProcessedReq.java @@ -45,4 +45,7 @@ public class ToBeProcessedReq extends PagePo implements Serializable { @ApiModelProperty("流程配置ID") private String processDefId; + + @ApiModelProperty("登录人员工号") + private String employeeCode; } diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/service/impl/StatisticsServiceImpl.java b/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/service/impl/StatisticsServiceImpl.java index 2bfb695..e2ce259 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/service/impl/StatisticsServiceImpl.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/service/impl/StatisticsServiceImpl.java @@ -3,7 +3,10 @@ package com.ningdatech.pmapi.todocenter.service.impl; import com.ningdatech.pmapi.todocenter.mapper.StatisticsMapper; import com.ningdatech.pmapi.todocenter.model.po.TodoCenterStatisticsPO; import com.ningdatech.pmapi.todocenter.service.StatisticsService; +import com.wflow.workflow.bean.dto.TodoCenterListReqDTO; +import com.wflow.workflow.service.ProcessTaskService; import lombok.AllArgsConstructor; +import org.flowable.engine.TaskService; import org.springframework.stereotype.Service; import java.util.Objects; @@ -20,18 +23,22 @@ public class StatisticsServiceImpl implements StatisticsService { private final StatisticsMapper mapper; + private final ProcessTaskService processTaskService; + + private final TaskService taskService; + @Override public TodoCenterStatisticsPO getStatistics(String employeeCode) { TodoCenterStatisticsPO res = new TodoCenterStatisticsPO(); - TodoCenterStatisticsPO todo = mapper.getTodoOrIdo(employeeCode); - if(Objects.nonNull(todo)){ - res.setTodoNum(todo.getTodoNum()); - } - TodoCenterStatisticsPO ido = mapper.getIdo(employeeCode); - if(Objects.nonNull(ido)){ - res.setIdoNum(ido.getIdoNum()); - } + TodoCenterListReqDTO req = new TodoCenterListReqDTO(); + req.setEmployeeCode(employeeCode); + Integer todoCount = processTaskService.getTodoCount(req); + res.setTodoNum(todoCount); + + Integer idoCount = processTaskService.getUserIdoCount(req); + res.setIdoNum(idoCount); + TodoCenterStatisticsPO submit = mapper.mysubmitNum(employeeCode); if(Objects.nonNull(submit)){ res.setMysubmitNum(submit.getMysubmitNum()); diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/user/security/auth/agent/AgentLoginUserDetailService.java b/pmapi/src/main/java/com/ningdatech/pmapi/user/security/auth/agent/AgentLoginUserDetailService.java index cce479d..d3234b2 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/user/security/auth/agent/AgentLoginUserDetailService.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/user/security/auth/agent/AgentLoginUserDetailService.java @@ -2,8 +2,10 @@ package com.ningdatech.pmapi.user.security.auth.agent; import com.ningdatech.pmapi.common.helper.UserInfoHelper; +import com.ningdatech.pmapi.user.constant.UserAvailableEnum; import com.ningdatech.pmapi.user.security.auth.model.UserFullInfoDTO; import com.ningdatech.pmapi.user.security.auth.model.UserInfoDetails; +import com.ningdatech.pmapi.user.security.auth.validate.CommonLoginException; import lombok.RequiredArgsConstructor; import org.springframework.security.core.userdetails.UserDetailsService; import org.springframework.security.core.userdetails.UsernameNotFoundException; @@ -32,6 +34,10 @@ public class AgentLoginUserDetailService implements UserDetailsService { if (Objects.isNull(userFullInfoDTO)) { throw new UsernameNotFoundException(String.format("%s user not exist", username)); } + if (UserAvailableEnum.DISABLE.equals(userFullInfoDTO.getAvailable())) { + throw new CommonLoginException("该账号已被禁用"); + } + UserInfoDetails userInfoDetails = new UserInfoDetails(); userInfoDetails.setUserId(userFullInfoDTO.getUserId()); userInfoDetails.setUsername(userFullInfoDTO.getUsername()); diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/user/security/auth/common/CommonLoginUserDetailService.java b/pmapi/src/main/java/com/ningdatech/pmapi/user/security/auth/common/CommonLoginUserDetailService.java index 9878d4a..6679760 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/user/security/auth/common/CommonLoginUserDetailService.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/user/security/auth/common/CommonLoginUserDetailService.java @@ -1,9 +1,11 @@ package com.ningdatech.pmapi.user.security.auth.common; +import com.ningdatech.pmapi.user.constant.UserAvailableEnum; import com.ningdatech.pmapi.user.manage.UserInfoManage; import com.ningdatech.pmapi.user.security.auth.model.UserFullInfoDTO; import com.ningdatech.pmapi.user.security.auth.model.UserInfoDetails; +import com.ningdatech.pmapi.user.security.auth.validate.CommonLoginException; import lombok.RequiredArgsConstructor; import org.springframework.security.core.userdetails.UserDetailsService; import org.springframework.security.core.userdetails.UsernameNotFoundException; @@ -30,6 +32,9 @@ public class CommonLoginUserDetailService implements UserDetailsService { if (Objects.isNull(userFullInfoDTO)) { throw new UsernameNotFoundException(String.format("%s user not exist", username)); } + if (UserAvailableEnum.DISABLE.equals(userFullInfoDTO.getAvailable())) { + throw new CommonLoginException("该账号已被禁用"); + } UserInfoDetails userInfoDetails = new UserInfoDetails(); userInfoDetails.setUserId(userFullInfoDTO.getUserId()); userInfoDetails.setUsername(userFullInfoDTO.getUsername()); diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/user/security/auth/credential/CredentialLoginUserDetailService.java b/pmapi/src/main/java/com/ningdatech/pmapi/user/security/auth/credential/CredentialLoginUserDetailService.java index fd1e859..20854a9 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/user/security/auth/credential/CredentialLoginUserDetailService.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/user/security/auth/credential/CredentialLoginUserDetailService.java @@ -2,6 +2,7 @@ package com.ningdatech.pmapi.user.security.auth.credential; import com.ningdatech.pmapi.user.constant.LoginTypeEnum; +import com.ningdatech.pmapi.user.constant.UserAvailableEnum; import com.ningdatech.pmapi.user.convert.UserInfoConvertor; import com.ningdatech.pmapi.user.manage.UserInfoManage; import com.ningdatech.pmapi.user.security.auth.constants.UserDeatilsServiceConstant; @@ -60,6 +61,10 @@ public class CredentialLoginUserDetailService implements UserDetailsService { throw new UsernameNotFoundException(String.format("%s user not exist", username)); } } + + if (UserAvailableEnum.DISABLE.equals(userFullInfo.getAvailable())) { + throw new CommonLoginException("该账号已被禁用"); + } return UserInfoConvertor.toUserInfoDetails(userFullInfo); } } diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/user/security/auth/model/UserFullInfoDTO.java b/pmapi/src/main/java/com/ningdatech/pmapi/user/security/auth/model/UserFullInfoDTO.java index f4291be..ae0261e 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/user/security/auth/model/UserFullInfoDTO.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/user/security/auth/model/UserFullInfoDTO.java @@ -2,6 +2,7 @@ package com.ningdatech.pmapi.user.security.auth.model; import cn.hutool.core.collection.CollUtil; import com.ningdatech.pmapi.sys.model.entity.Role; +import com.ningdatech.pmapi.user.constant.UserAvailableEnum; import com.ningdatech.pmapi.user.entity.enumeration.RoleEnum; import lombok.Data; @@ -74,6 +75,12 @@ public class UserFullInfoDTO { private Long accountId; /** + * 用户是否可用 + */ + private UserAvailableEnum available; + + + /** * 取最高的权限 * * @return diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/workbench/manage/WorkbenchManage.java b/pmapi/src/main/java/com/ningdatech/pmapi/workbench/manage/WorkbenchManage.java index 369349d..83172a6 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/workbench/manage/WorkbenchManage.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/workbench/manage/WorkbenchManage.java @@ -1,22 +1,15 @@ package com.ningdatech.pmapi.workbench.manage; -import cn.hutool.core.bean.BeanUtil; -import com.ningdatech.basic.model.PageVo; import com.ningdatech.pmapi.common.helper.UserInfoHelper; import com.ningdatech.pmapi.projectdeclared.manage.DeclaredProjectManage; import com.ningdatech.pmapi.projectdeclared.manage.DefaultDeclaredProjectManage; -import com.ningdatech.pmapi.projectdeclared.model.po.DeclaredProjectStatisticsPO; import com.ningdatech.pmapi.projectlib.manage.ProjectLibManage; import com.ningdatech.pmapi.projectlib.model.req.ProjectListReq; -import com.ningdatech.pmapi.sys.enumeration.NoticeTypeEnum; import com.ningdatech.pmapi.sys.manage.NoticeManage; import com.ningdatech.pmapi.sys.model.req.NoticeListReq; -import com.ningdatech.pmapi.sys.model.vo.NoticeListItemVO; import com.ningdatech.pmapi.todocenter.manage.TodoCenterManage; import com.ningdatech.pmapi.todocenter.model.req.ToBeProcessedReq; -import com.ningdatech.pmapi.todocenter.model.vo.ResToBeProcessedVO; import com.ningdatech.pmapi.todocenter.model.vo.TodoCenterStatisticsVO; -import com.ningdatech.pmapi.todocenter.model.vo.TodoVO; import com.ningdatech.pmapi.user.security.auth.model.UserFullInfoDTO; import com.ningdatech.pmapi.user.security.auth.model.UserInfoDetails; import com.ningdatech.pmapi.user.util.LoginUserUtil; @@ -24,7 +17,8 @@ import com.ningdatech.pmapi.workbench.converter.WorkbenchConverter; import com.ningdatech.pmapi.workbench.model.vo.WorkbenchVO; import lombok.AllArgsConstructor; import org.springframework.stereotype.Component; - +import java.util.concurrent.CompletableFuture; +import java.util.concurrent.ForkJoinPool; import java.util.stream.Collectors; /** @@ -51,34 +45,43 @@ public class WorkbenchManage { public WorkbenchVO getWorkbenchData(Integer year){ WorkbenchVO res = new WorkbenchVO(); - UserInfoDetails user = LoginUserUtil.loginUserDetail(); + UserFullInfoDTO user = userInfoHelper.getUserFullInfo(LoginUserUtil.getUserId()); - //1.待办中心数据 - TodoCenterStatisticsVO statisticsVO = todoCenterManage.todoCenterStatistics(); - ToBeProcessedReq toBeProcessedReq = new ToBeProcessedReq(); - toBeProcessedReq.setPageNumber(1); - toBeProcessedReq.setPageSize(5); - statisticsVO.setTodoList(todoCenterManage.todoProjectList(toBeProcessedReq).getRecords() - .stream().map(v -> WorkbenchConverter.convert(v)).collect(Collectors.toList())); - res.setTodoCerter(statisticsVO); + CompletableFuture.allOf( + CompletableFuture.runAsync(()-> { + //1.待办中心数据 + TodoCenterStatisticsVO statisticsVO = todoCenterManage.todoCenterStatistics(user.getEmployeeCode()); + ToBeProcessedReq toBeProcessedReq = new ToBeProcessedReq(); + toBeProcessedReq.setPageNumber(1); + toBeProcessedReq.setPageSize(5); + toBeProcessedReq.setEmployeeCode(user.getEmployeeCode()); + statisticsVO.setTodoList(todoCenterManage.todoProjectList(toBeProcessedReq).getRecords() + .stream().map(v -> WorkbenchConverter.convert(v)).collect(Collectors.toList())); + res.setTodoCerter(statisticsVO); + }, ForkJoinPool.commonPool()), + CompletableFuture.runAsync(()-> { + //2.项目统计数据 + res.setOrgDeclared(WorkbenchConverter.convert(defaultDeclaredProjectManage.declaredProjectOrgStatistics(year,user))); + if(userInfoHelper.isSuperOrRegionAdmin(user.getUserId())){ + res.setRegionDeclared(WorkbenchConverter.convert(defaultDeclaredProjectManage.declaredProjectRegionStatistics(year,user))); + } + }, ForkJoinPool.commonPool()), + CompletableFuture.runAsync(()-> { + //3.所有公告按类型分 + NoticeListReq noticeListReq = new NoticeListReq(); + noticeListReq.setPageNumber(1); + noticeListReq.setPageSize(1000); + res.setNoticeList(noticeManage.listToMapByManager(noticeListReq)); + }, ForkJoinPool.commonPool()) + ).join(); - //2.项目统计数据 - res.setOrgDeclared(WorkbenchConverter.convert(defaultDeclaredProjectManage.declaredProjectOrgStatistics(year))); - if(userInfoHelper.isSuperOrRegionAdmin(LoginUserUtil.getUserId())){ - res.setRegionDeclared(WorkbenchConverter.convert(defaultDeclaredProjectManage.declaredProjectRegionStatistics(year))); - } + //这个不能放入子线程 ProjectListReq projectListReq = new ProjectListReq(); projectListReq.setPageNumber(1); projectListReq.setPageSize(5); projectListReq.setProjectYear(year); projectListReq.setBuildOrgCode(user.getEmpPosUnitCode()); - res.setProjects(projectLibManage.projectLibListWithPermission(projectListReq).getRecords().stream().collect(Collectors.toList())); - - //3.所有公告按类型分 - NoticeListReq noticeListReq = new NoticeListReq(); - noticeListReq.setPageNumber(1); - noticeListReq.setPageSize(1000); - res.setNoticeList(noticeManage.listToMapByManager(noticeListReq)); + res.setProjects(projectLibManage.projectLibListWithPermission(projectListReq,user).getRecords().stream().collect(Collectors.toList())); return res; } diff --git a/pmapi/src/main/resources/security/auth-dev.yml b/pmapi/src/main/resources/security/auth-dev.yml index aaa4f21..d8f8181 100644 --- a/pmapi/src/main/resources/security/auth-dev.yml +++ b/pmapi/src/main/resources/security/auth-dev.yml @@ -25,6 +25,7 @@ security: - /wflow/** - /sys/** - /api/v1/verification/** + - /api/v1/expert/registration ignore-csrf-urls: - /api/v1/user/auth/** - /v2/api-docs @@ -42,6 +43,7 @@ security: - /wflow/** - /sys/** - /api/v1/verification/** + - /api/v1/expert/registration role-map: "engineer": "project_manager":