@@ -1,26 +0,0 @@ | |||
package com.hz.pm.api.common.config; | |||
import lombok.Data; | |||
import org.springframework.boot.context.properties.ConfigurationProperties; | |||
import org.springframework.context.annotation.Configuration; | |||
/** | |||
* @author zpf | |||
* @date 2023/3/2 下午5:37 | |||
*/ | |||
@Data | |||
@Configuration | |||
@ConfigurationProperties(prefix = "provincial") | |||
public class ProvincialProperties { | |||
private String host; | |||
private String pushUrl; | |||
private String detailUrl; | |||
private String domainUrl; | |||
private String key; | |||
private String secret; | |||
} |
@@ -50,5 +50,5 @@ public interface UserInfoHelper { | |||
List<UserFullInfoDTO> listUserFullInfoByUnitIdsAndRole(Collection<Long> unitIds, RoleEnum role); | |||
List<UserInfo> getEmployeeCodesByRoleEnum(RoleEnum roleEnum); | |||
List<UserInfo> listUsersByRole(RoleEnum roleEnum); | |||
} |
@@ -6,6 +6,7 @@ import com.baomidou.mybatisplus.core.toolkit.StringUtils; | |||
import com.baomidou.mybatisplus.core.toolkit.Wrappers; | |||
import com.hz.pm.api.common.helper.UserInfoHelper; | |||
import com.hz.pm.api.common.model.constant.BizConst; | |||
import com.hz.pm.api.common.model.constant.ExistsSqlConst; | |||
import com.hz.pm.api.common.model.constant.MhUnitConst; | |||
import com.hz.pm.api.common.util.StrUtils; | |||
import com.hz.pm.api.sys.mapper.RoleMapper; | |||
@@ -39,7 +40,7 @@ public class UserInfoHelperImpl implements UserInfoHelper { | |||
private final IUserInfoService userInfoService; | |||
private final IUserRoleService iUserRoleService; | |||
private final IUserRoleService userRoleService; | |||
private final RoleMapper roleMapper; | |||
private final MhUnitCache mhUnitCache; | |||
@@ -70,7 +71,7 @@ public class UserInfoHelperImpl implements UserInfoHelper { | |||
public UserFullInfoDTO getUserFullInfo(UserInfo userInfo) { | |||
UserFullInfoDTO userFullInfo = new UserFullInfoDTO(); | |||
// 获取用户角色列表信息 | |||
List<UserRole> userRoleList = iUserRoleService.listByUserId(userInfo.getId()); | |||
List<UserRole> userRoleList = userRoleService.listByUserId(userInfo.getId()); | |||
if (CollUtil.isNotEmpty(userRoleList)) { | |||
List<Long> roleIdList = userRoleList.stream() | |||
.map(UserRole::getRoleId).distinct() | |||
@@ -189,24 +190,22 @@ public class UserInfoHelperImpl implements UserInfoHelper { | |||
} | |||
LambdaQueryWrapper<UserInfo> query = Wrappers.lambdaQuery(UserInfo.class) | |||
.in(UserInfo::getMhUnitId, unitIds) | |||
.exists("select 1 from nd_user_role nur where nur.user_id = nd_user_info.id" + | |||
" and nur.role_id = {0}", role.getId()); | |||
.exists(ExistsSqlConst.USER_EXISTS_ROLE + " and nur.role_id = {0}", role.getId()); | |||
List<UserInfo> userInfos = userInfoService.list(query); | |||
return CollUtils.convert(userInfos, this::convert); | |||
} | |||
@Override | |||
public List<UserInfo> getEmployeeCodesByRoleEnum(RoleEnum roleEnum) { | |||
public List<UserInfo> listUsersByRole(RoleEnum roleEnum) { | |||
LambdaQueryWrapper<Role> rQuery = Wrappers.lambdaQuery(Role.class) | |||
.eq(Role::getCode, roleEnum.name()) | |||
.last(BizConst.LIMIT_1); | |||
Role role = roleMapper.selectOne(rQuery); | |||
if (role != null) { | |||
LambdaQueryWrapper<UserRole> query = Wrappers.lambdaQuery(UserRole.class) | |||
.eq(UserRole::getRoleId, role.getId()); | |||
List<UserRole> userRoles = iUserRoleService.list(query); | |||
List<Long> userIdList = userRoles.stream().map(UserRole::getUserId).collect(Collectors.toList()); | |||
return userInfoService.listByIds(userIdList); | |||
List<Long> userIds = userRoleService.listUserIdByRoleId(role.getId()); | |||
if (CollUtil.isNotEmpty(userIds)) { | |||
return userInfoService.listByIds(userIds); | |||
} | |||
} | |||
return Collections.emptyList(); | |||
} | |||
@@ -25,4 +25,6 @@ public class ExistsSqlConst { | |||
public static final String PURCHASE_EXISTS_STATUS_CHANGE = "select 1 from nd_purchase_status_change npsc where npsc.bid_id = nd_purchase.id "; | |||
public static final String USER_EXISTS_ROLE = "select 1 from nd_user_role nur where nur.user_id = nd_user_info.id " | |||
} |
@@ -14,7 +14,6 @@ import com.hz.pm.api.sys.model.entity.ProjectEarlyWarning; | |||
import com.hz.pm.api.sys.model.entity.WflowEarlyWarningRecords; | |||
import com.hz.pm.api.sys.service.IEarlyWarningRecordsService; | |||
import org.apache.commons.lang3.StringUtils; | |||
import org.checkerframework.checker.nullness.qual.Nullable; | |||
import org.springframework.boot.autoconfigure.condition.ConditionalOnExpression; | |||
import org.springframework.scheduling.annotation.Scheduled; | |||
import org.springframework.stereotype.Component; | |||
@@ -30,18 +29,15 @@ import com.hz.pm.api.common.helper.UserInfoHelper; | |||
import com.hz.pm.api.common.statemachine.event.ProjectStateChangeEvent; | |||
import com.hz.pm.api.common.util.EnvironmentUtil; | |||
import com.hz.pm.api.common.util.StrUtils; | |||
import com.hz.pm.api.projectdeclared.service.IOperationService; | |||
import com.hz.pm.api.projectlib.model.entity.Project; | |||
import com.hz.pm.api.projectlib.model.entity.ProjectStatusChange; | |||
import com.hz.pm.api.projectlib.model.enumeration.WarningFlowTypeEnum; | |||
import com.hz.pm.api.projectlib.model.enumeration.WarningNoticeTypeEnum; | |||
import com.hz.pm.api.projectlib.service.IProjectRenewalFundDeclarationService; | |||
import com.hz.pm.api.projectlib.service.IProjectService; | |||
import com.hz.pm.api.projectlib.service.IProjectStatusChangeService; | |||
import com.hz.pm.api.scheduler.contants.TaskConstant; | |||
import com.hz.pm.api.sys.enumeration.ProjectEarlyWarningStatusEnum; | |||
import com.hz.pm.api.sys.manage.EarlyWarningManage; | |||
import com.hz.pm.api.sys.manage.RoleManage; | |||
import com.hz.pm.api.sys.service.IProjectEarlyWarningService; | |||
import com.hz.pm.api.user.helper.MhUnitCache; | |||
import com.hz.pm.api.user.model.entity.UserInfo; | |||
@@ -253,13 +249,13 @@ public class EarlyWarningWithoutSubmitTask { | |||
List<String> batchEmployees = Lists.newArrayList(); | |||
if (StringUtils.isNotBlank(notice) && notice.contains(WarningNoticeTypeEnum.SUPER_ADMIN.getCode().toString())) { | |||
// 获取超级管理员用户信息 | |||
List<UserInfo> superAdminUsers = userInfoHelper.getEmployeeCodesByRoleEnum(RoleEnum.SUPER_ADMIN); | |||
List<UserInfo> superAdminUsers = userInfoHelper.listUsersByRole(RoleEnum.SUPER_ADMIN); | |||
List<String> superAdminEmployeeCodes = superAdminUsers.stream().map(UserInfo::getEmployeeCode).collect(Collectors.toList()); | |||
batchEmployees.addAll(superAdminEmployeeCodes); | |||
} | |||
if (StringUtils.isNotBlank(notice) && notice.contains(WarningNoticeTypeEnum.UNIT_ADMIN.getCode().toString())) { | |||
// 获取单位管理员用户信息 | |||
List<UserInfo> unitAdminUsers = userInfoHelper.getEmployeeCodesByRoleEnum(RoleEnum.COMPANY_MANAGER); | |||
List<UserInfo> unitAdminUsers = userInfoHelper.listUsersByRole(RoleEnum.COMPANY_MANAGER); | |||
// 过滤出当前项目所属单位的单位管理员 | |||
List<String> unitAdminEmployeeCodes = unitAdminUsers.stream().filter(user -> Objects.equals(user.getMhUnitId().toString(), project.getBuildOrgCode())) | |||
.map(UserInfo::getEmployeeCode).collect(Collectors.toList()); | |||
@@ -1,7 +1,5 @@ | |||
package com.hz.pm.api.warning; | |||
import javax.annotation.Resource; | |||
import cn.hutool.core.collection.CollUtil; | |||
import cn.hutool.core.date.StopWatch; | |||
import cn.hutool.core.map.MapUtil; | |||
@@ -38,7 +36,6 @@ import com.hz.pm.api.sys.service.IProjectEarlyWarningService; | |||
import com.hz.pm.api.user.helper.MhUnitCache; | |||
import com.hz.pm.api.user.model.entity.UserInfo; | |||
import com.hz.pm.api.user.model.enumeration.RoleEnum; | |||
import com.hz.pm.api.user.service.IUserInfoService; | |||
import com.ningdatech.basic.util.CollUtils; | |||
import com.ningdatech.basic.util.StrPool; | |||
import com.wflow.bean.entity.WflowEarlyWarning; | |||
@@ -46,21 +43,16 @@ import com.wflow.bean.entity.WflowModels; | |||
import com.wflow.enums.WarningRuleTypeEnum; | |||
import com.wflow.service.IEarlyWarningService; | |||
import com.wflow.workflow.service.ProcessModelService; | |||
import lombok.RequiredArgsConstructor; | |||
import lombok.extern.slf4j.Slf4j; | |||
import org.apache.commons.lang3.StringUtils; | |||
import org.checkerframework.checker.nullness.qual.Nullable; | |||
import org.flowable.engine.TaskService; | |||
import org.flowable.task.api.Task; | |||
import org.junit.Test; | |||
import com.alibaba.fastjson.JSON; | |||
import com.hz.pm.api.AppTests; | |||
import com.hz.pm.api.projectdeclared.model.entity.ProjectDraft; | |||
import com.hz.pm.api.projectdeclared.service.IProjectDraftService; | |||
import org.springframework.beans.factory.annotation.Autowired; | |||
import java.time.Duration; | |||
import java.time.LocalDateTime; | |||
import java.time.temporal.ChronoUnit; | |||
import java.util.*; | |||
@@ -269,13 +261,13 @@ public class DelayWarningTest extends AppTests { | |||
List<String> batchEmployees = Lists.newArrayList(); | |||
if (StringUtils.isNotBlank(notice) && notice.contains(WarningNoticeTypeEnum.SUPER_ADMIN.getCode().toString())) { | |||
// 获取超级管理员用户信息 | |||
List<UserInfo> superAdminUsers = userInfoHelper.getEmployeeCodesByRoleEnum(RoleEnum.SUPER_ADMIN); | |||
List<UserInfo> superAdminUsers = userInfoHelper.listUsersByRole(RoleEnum.SUPER_ADMIN); | |||
List<String> superAdminEmployeeCodes = superAdminUsers.stream().map(UserInfo::getEmployeeCode).collect(Collectors.toList()); | |||
batchEmployees.addAll(superAdminEmployeeCodes); | |||
} | |||
if (StringUtils.isNotBlank(notice) && notice.contains(WarningNoticeTypeEnum.UNIT_ADMIN.getCode().toString())) { | |||
// 获取单位管理员用户信息 | |||
List<UserInfo> unitAdminUsers = userInfoHelper.getEmployeeCodesByRoleEnum(RoleEnum.COMPANY_MANAGER); | |||
List<UserInfo> unitAdminUsers = userInfoHelper.listUsersByRole(RoleEnum.COMPANY_MANAGER); | |||
// 过滤出当前项目所属单位的单位管理员 | |||
List<String> unitAdminEmployeeCodes = unitAdminUsers.stream().filter(user -> Objects.equals(user.getMhUnitId().toString(), project.getBuildOrgCode())) | |||
.map(UserInfo::getEmployeeCode).collect(Collectors.toList()); | |||