@@ -39,14 +39,4 @@ public interface RegionLimitHelper { | |||
*/ | |||
RegionContainsBO getContainsRegionBo(Integer regionLevel, String regionCode); | |||
/** | |||
* 根据专家管理员用户id 获取专家管理员管辖区域列表 | |||
* | |||
* @param expertAdminUserId 专家管理员用户id | |||
* @return | |||
*/ | |||
List<RegionContainsBO> getExpertAdminContainsRegion(Long expertAdminUserId); | |||
} |
@@ -1,7 +1,9 @@ | |||
package com.hz.pm.api.common.helper; | |||
import cn.hutool.core.util.NumberUtil; | |||
import com.hz.pm.api.user.model.entity.UserInfo; | |||
import com.hz.pm.api.user.security.model.UserFullInfoDTO; | |||
import com.ningdatech.basic.util.CollUtils; | |||
import java.util.Collection; | |||
import java.util.List; | |||
@@ -14,18 +16,17 @@ import java.util.List; | |||
public interface UserInfoHelper { | |||
/** | |||
* 根据用户id 获取 用户所属组织code organizationCode | |||
* | |||
* @param userId \ | |||
* @return \ | |||
*/ | |||
String getOrganizationCode(Long userId); | |||
UserFullInfoDTO getUserFullInfoByMhUserIdOrOpenId(String mhUserId); | |||
UserFullInfoDTO getUserFullInfo(Long userId); | |||
default UserFullInfoDTO getUserFullInfo(String userId) { | |||
if (NumberUtil.isLong(userId)) { | |||
return getUserFullInfo(Long.parseLong(userId)); | |||
} | |||
return null; | |||
} | |||
UserFullInfoDTO getUserFullInfo(UserInfo userInfo); | |||
List<UserFullInfoDTO> getUserFullInfos(List<UserInfo> userInfos); | |||
@@ -39,16 +40,11 @@ public interface UserInfoHelper { | |||
*/ | |||
boolean isSuperOrRegionAdmin(Long userId); | |||
UserFullInfoDTO getUserFullInfoByEmployeeCode(String employeeCode); | |||
List<UserFullInfoDTO> listUserFullInfoByUserIds(Collection<Long> userIds); | |||
List<UserFullInfoDTO> getUserFullInfoByEmployeeCodes(Collection<String> employeeCodes); | |||
/** | |||
* 获取用户任职所在单位code \ | |||
* | |||
* @return \ | |||
*/ | |||
String getUserEmpPosUnitCode(Long userId); | |||
default List<UserFullInfoDTO> listUserFullInfoByUserIds(List<String> userIds){ | |||
List<Long> userIdsLong = CollUtils.convert(userIds, Long::parseLong); | |||
return listUserFullInfoByUserIds(userIdsLong); | |||
} | |||
String getMainOrgCode(String empPosUnitCode); | |||
} |
@@ -1,15 +1,10 @@ | |||
package com.hz.pm.api.common.helper.impl; | |||
import cn.hutool.core.collection.CollectionUtil; | |||
import com.baomidou.mybatisplus.core.toolkit.StringUtils; | |||
import com.baomidou.mybatisplus.core.toolkit.Wrappers; | |||
import com.hz.pm.api.common.helper.RegionCacheHelper; | |||
import com.hz.pm.api.common.helper.basic.AbstractRegionLimitHelper; | |||
import com.hz.pm.api.expert.service.IExpertUserFullInfoService; | |||
import com.hz.pm.api.meta.model.bo.RegionContainsBO; | |||
import com.hz.pm.api.sys.model.entity.Region; | |||
import com.hz.pm.api.sys.service.IRegionService; | |||
import com.hz.pm.api.user.model.entity.UserInfo; | |||
import com.hz.pm.api.user.service.IUserInfoService; | |||
import org.apache.commons.collections4.CollectionUtils; | |||
import org.slf4j.Logger; | |||
@@ -28,8 +23,6 @@ import java.util.Objects; | |||
@Component | |||
public class RegionLimitHelperImpl extends AbstractRegionLimitHelper { | |||
private static final Logger logger = LoggerFactory.getLogger(RegionLimitHelperImpl.class); | |||
public RegionLimitHelperImpl(RegionCacheHelper regionCache, IExpertUserFullInfoService expertUserFullInfoService | |||
, IUserInfoService iUserInfoService, IRegionService regionService) { | |||
super(regionCache, expertUserFullInfoService, iUserInfoService, regionService); | |||
@@ -91,29 +84,4 @@ public class RegionLimitHelperImpl extends AbstractRegionLimitHelper { | |||
return regionContains; | |||
} | |||
@Override | |||
public List<RegionContainsBO> getExpertAdminContainsRegion(Long expertAdminUserId) { | |||
if (Objects.isNull(expertAdminUserId)) { | |||
logger.error("getExpertAdminContainsRegion expertAdminUserId is null"); | |||
return new ArrayList<>(); | |||
} | |||
UserInfo userInfo = iUserInfoService.getById(expertAdminUserId); | |||
if (Objects.isNull(userInfo) || StringUtils.isBlank(userInfo.getRegionCode())) { | |||
logger.error("getExpertAdminContainsRegion userInfo is null Or regionCode is null"); | |||
return new ArrayList<>(); | |||
} | |||
String regionCode = userInfo.getRegionCode(); | |||
List<Region> regionList = regionService.list(Wrappers.lambdaQuery(Region.class) | |||
.eq(Region::getRegionCode, regionCode) | |||
.orderByDesc(Region::getRegionLevel)); | |||
Region region = regionList.get(0); | |||
Collection<String> regionCodes = regionCache | |||
.listChildRegionCodeList(region.getRegionCode(), region.getRegionLevel()); | |||
RegionContainsBO regionContainsBO = new RegionContainsBO(); | |||
regionContainsBO.setContainsRegionCodeList(new ArrayList<>(regionCodes)); | |||
regionContainsBO.setParentRegionTreeLevel(region.getRegionLevel()); | |||
return CollectionUtil.toList(regionContainsBO); | |||
} | |||
} |
@@ -1,31 +1,28 @@ | |||
package com.hz.pm.api.common.helper.impl; | |||
import cn.hutool.core.collection.CollUtil; | |||
import cn.hutool.core.collection.CollectionUtil; | |||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | |||
import com.baomidou.mybatisplus.core.toolkit.StringUtils; | |||
import com.baomidou.mybatisplus.core.toolkit.Wrappers; | |||
import com.hz.pm.api.common.model.constant.BizConst; | |||
import com.hz.pm.api.common.helper.UserInfoHelper; | |||
import com.hz.pm.api.organization.model.entity.DingEmployeeInfo; | |||
import com.hz.pm.api.organization.model.entity.DingOrganization; | |||
import com.hz.pm.api.organization.service.IDingEmployeeInfoService; | |||
import com.hz.pm.api.organization.service.IDingOrganizationService; | |||
import com.hz.pm.api.common.util.StrUtils; | |||
import com.hz.pm.api.sys.mapper.RoleMapper; | |||
import com.hz.pm.api.sys.model.entity.Role; | |||
import com.hz.pm.api.sys.model.entity.UserRole; | |||
import com.hz.pm.api.sys.service.IUserRoleService; | |||
import com.hz.pm.api.user.model.enumeration.UserAvailableEnum; | |||
import com.hz.pm.api.user.model.entity.UserInfo; | |||
import com.hz.pm.api.user.model.enumeration.RoleEnum; | |||
import com.hz.pm.api.user.model.enumeration.UserAvailableEnum; | |||
import com.hz.pm.api.user.security.model.UserFullInfoDTO; | |||
import com.hz.pm.api.user.service.IUserInfoService; | |||
import lombok.RequiredArgsConstructor; | |||
import org.springframework.stereotype.Component; | |||
import java.util.*; | |||
import java.util.Collection; | |||
import java.util.Collections; | |||
import java.util.List; | |||
import java.util.Objects; | |||
import java.util.stream.Collectors; | |||
import java.util.stream.Stream; | |||
/** | |||
* @author liuxinxin | |||
@@ -37,22 +34,14 @@ public class UserInfoHelperImpl implements UserInfoHelper { | |||
private final IUserInfoService userInfoService; | |||
private final IDingEmployeeInfoService iDingEmployeeInfoService; | |||
private final IDingOrganizationService iDingOrganizationService; | |||
private final IUserRoleService iUserRoleService; | |||
private final RoleMapper roleMapper; | |||
@Override | |||
public String getOrganizationCode(Long userId) { | |||
UserFullInfoDTO userFullInfo = getUserFullInfo(userId); | |||
return userFullInfo.getOrganizationCode(); | |||
} | |||
@Override | |||
public UserFullInfoDTO getUserFullInfoByMhUserIdOrOpenId(String mhUserId) { | |||
LambdaQueryWrapper<UserInfo> query = Wrappers.lambdaQuery(UserInfo.class) | |||
.eq(UserInfo::getMhUserId, mhUserId) | |||
.or(q1 -> q1.eq(UserInfo::getWechatOpenId,mhUserId)); | |||
.or(q1 -> q1.eq(UserInfo::getWechatOpenId, mhUserId)); | |||
UserInfo userInfo = userInfoService.getOne(query); | |||
if (Objects.isNull(userInfo)) { | |||
return null; | |||
@@ -74,61 +63,22 @@ public class UserInfoHelperImpl implements UserInfoHelper { | |||
@Override | |||
public UserFullInfoDTO getUserFullInfo(UserInfo userInfo) { | |||
UserFullInfoDTO userFullInfo = new UserFullInfoDTO(); | |||
// 获取浙政钉雇员信息 组织信息 | |||
String employeeCode = userInfo.getEmployeeCode(); | |||
if (StringUtils.isNotBlank(employeeCode)) { | |||
List<DingEmployeeInfo> dingEmployeeInfoList = iDingEmployeeInfoService | |||
.list(Wrappers.lambdaQuery(DingEmployeeInfo.class) | |||
.eq(DingEmployeeInfo::getEmployeeCode, employeeCode) | |||
.eq(DingEmployeeInfo::getMainJob, "true")); | |||
DingEmployeeInfo dingEmployeeInfo = dingEmployeeInfoList.get(0); | |||
// 装配用户任职所在单位 | |||
String empPosUnitCode = dingEmployeeInfo.getEmpPosUnitCode(); | |||
if (StringUtils.isNotBlank(empPosUnitCode)) { | |||
DingOrganization dingOrganization = iDingOrganizationService.getByOrgCode(empPosUnitCode); | |||
if (Objects.nonNull(dingOrganization)) { | |||
userFullInfo.setEmpPosUnitCode(empPosUnitCode); | |||
userFullInfo.setEmpPosUnitName(dingOrganization.getOrganizationName()); | |||
userFullInfo.setRegionCode(dingOrganization.getDivisionCode()); | |||
} | |||
} | |||
// 装配用户所在orgCode | |||
String organizationCode = dingEmployeeInfo.getOrganizationCode(); | |||
List<DingOrganization> dingOrganizationList = iDingOrganizationService.list(Wrappers | |||
.lambdaQuery(DingOrganization.class) | |||
.eq(DingOrganization::getOrganizationCode, organizationCode)); | |||
if (CollectionUtil.isNotEmpty(dingOrganizationList)) { | |||
DingOrganization dingOrganization = dingOrganizationList.get(0); | |||
userFullInfo.setOrganizationCode(dingOrganization.getOrganizationCode()); | |||
userFullInfo.setOrganizationName(dingOrganization.getOrganizationName()); | |||
// 测试使用 | |||
userFullInfo.setRegionLevel(3); | |||
} | |||
} | |||
List<Role> roleList = new ArrayList<>(); | |||
// 获取用户角色列表信息 | |||
List<UserRole> userRoleList = iUserRoleService | |||
.list(Wrappers.lambdaQuery(UserRole.class) | |||
.eq(UserRole::getUserId, userInfo.getId())); | |||
if (CollectionUtil.isNotEmpty(userRoleList)) { | |||
List<UserRole> userRoleList = iUserRoleService.listByUserId(userInfo.getId()); | |||
if (CollUtil.isNotEmpty(userRoleList)) { | |||
List<Long> roleIdList = userRoleList.stream() | |||
.map(UserRole::getRoleId).distinct() | |||
.collect(Collectors.toList()); | |||
roleList = roleMapper.selectBatchIds(roleIdList); | |||
userFullInfo.setUserRoleList(roleMapper.selectBatchIds(roleIdList)); | |||
} | |||
userFullInfo.setUserRoleList(roleList); | |||
// 装配用户任职所在单位 | |||
// 装配返回 | |||
userFullInfo.setUserId(userInfo.getId()); | |||
userFullInfo.setMhUserId(userInfo.getMhUserId()); | |||
userFullInfo.setIdentifier(userInfo.getRealName()); | |||
userFullInfo.setRealName(userInfo.getRealName()); | |||
userFullInfo.setEmployeeCode(employeeCode); | |||
userFullInfo.setMhUnitId(userFullInfo.getMhUnitId()); | |||
userFullInfo.setMhUnitName(userFullInfo.getMhUnitName()); | |||
userFullInfo.setUsername(userInfo.getRealName()); | |||
userFullInfo.setMobile(userInfo.getMobile()); | |||
userFullInfo.setAccountId(userInfo.getAccountId()); | |||
@@ -151,60 +101,20 @@ public class UserInfoHelperImpl implements UserInfoHelper { | |||
if (CollUtil.isEmpty(userInfos)) { | |||
return Collections.emptyList(); | |||
} | |||
Map<String, UserInfo> userMap = userInfos.stream().collect(Collectors.toMap(UserInfo::getEmployeeCode, e -> e)); | |||
// 获取浙政钉雇员信息 组织信息 | |||
List<String> employeeCodes = userInfos.stream().map(UserInfo::getEmployeeCode).collect(Collectors.toList()); | |||
List<DingEmployeeInfo> dingEmployeeInfoList = iDingEmployeeInfoService | |||
.list(Wrappers.lambdaQuery(DingEmployeeInfo.class) | |||
.in(DingEmployeeInfo::getEmployeeCode, employeeCodes) | |||
.eq(DingEmployeeInfo::getMainJob, "true")); | |||
if (CollUtil.isEmpty(dingEmployeeInfoList)) { | |||
return Collections.emptyList(); | |||
} | |||
// 装配用户任职所在单位 | |||
List<String> empPosUnitCodes = dingEmployeeInfoList.stream().map(DingEmployeeInfo::getEmpPosUnitCode).collect(Collectors.toList()); | |||
List<String> orgCodes = dingEmployeeInfoList.stream().map(DingEmployeeInfo::getOrganizationCode).collect(Collectors.toList()); | |||
List<String> allOrgCodes = Stream.concat(empPosUnitCodes.stream(), orgCodes.stream()).collect(Collectors.toList()); | |||
if (CollUtil.isEmpty(allOrgCodes)) { | |||
return Collections.emptyList(); | |||
} | |||
List<DingOrganization> dingOrganizations = iDingOrganizationService.listByCodes(allOrgCodes); | |||
if (CollUtil.isEmpty(dingOrganizations)) { | |||
return Collections.emptyList(); | |||
} | |||
Map<String, DingOrganization> orgMap = dingOrganizations.stream().collect(Collectors.toMap(DingOrganization::getOrganizationCode, d -> d)); | |||
return dingEmployeeInfoList.stream().map(e -> { | |||
return userInfos.stream().map(userInfo -> { | |||
UserFullInfoDTO userFullInfo = new UserFullInfoDTO(); | |||
if (orgMap.containsKey(e.getEmpPosUnitCode())) { | |||
DingOrganization organization = orgMap.get(e.getEmpPosUnitCode()); | |||
userFullInfo.setEmpPosUnitCode(e.getEmpPosUnitCode()); | |||
userFullInfo.setEmpPosUnitName(organization.getOrganizationName()); | |||
userFullInfo.setRegionCode(organization.getDivisionCode()); | |||
} | |||
if (orgMap.containsKey(e.getOrganizationCode())) { | |||
DingOrganization organization = orgMap.get(e.getOrganizationCode()); | |||
userFullInfo.setOrganizationCode(organization.getOrganizationCode()); | |||
userFullInfo.setOrganizationName(organization.getOrganizationName()); | |||
// 测试使用 | |||
userFullInfo.setRegionLevel(3); | |||
} | |||
if (userMap.containsKey(e.getEmployeeCode())) { | |||
UserInfo userInfo = userMap.get(e.getEmployeeCode()); | |||
// 装配返回 | |||
userFullInfo.setUserId(userInfo.getId()); | |||
userFullInfo.setIdentifier(userInfo.getRealName()); | |||
userFullInfo.setRealName(userInfo.getRealName()); | |||
userFullInfo.setEmployeeCode(e.getEmployeeCode()); | |||
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)); | |||
} | |||
// 装配返回 | |||
userFullInfo.setMhUnitName(userInfo.getMhUnitName()); | |||
userFullInfo.setMhUnitId(userInfo.getMhUnitId()); | |||
userFullInfo.setUserId(userInfo.getId()); | |||
userFullInfo.setIdentifier(userInfo.getRealName()); | |||
userFullInfo.setRealName(userInfo.getRealName()); | |||
userFullInfo.setUsername(userInfo.getRealName()); | |||
userFullInfo.setMobile(userInfo.getMobile()); | |||
userFullInfo.setAccountId(userInfo.getAccountId()); | |||
String available = userInfo.getAvailable(); | |||
if (StrUtils.isNotBlank(available)) { | |||
userFullInfo.setAvailable(UserAvailableEnum.valueOf(available)); | |||
} | |||
return userFullInfo; | |||
}).collect(Collectors.toList()); | |||
@@ -231,31 +141,9 @@ public class UserInfoHelperImpl implements UserInfoHelper { | |||
} | |||
@Override | |||
public UserFullInfoDTO getUserFullInfoByEmployeeCode(String employeeCode) { | |||
UserInfo userInfo = userInfoService.getUserInfoByEmployeeCode(employeeCode); | |||
return getUserFullInfo(userInfo); | |||
} | |||
@Override | |||
public List<UserFullInfoDTO> getUserFullInfoByEmployeeCodes(Collection<String> employeeCodes) { | |||
List<UserInfo> userInfos = userInfoService.getUserInfoByEmployeeCodes(employeeCodes); | |||
public List<UserFullInfoDTO> listUserFullInfoByUserIds(Collection<Long> userIds) { | |||
List<UserInfo> userInfos = userInfoService.listByIds(userIds); | |||
return getUserFullInfos(userInfos); | |||
} | |||
@Override | |||
public String getUserEmpPosUnitCode(Long userId) { | |||
UserFullInfoDTO userFullInfo = getUserFullInfo(userId); | |||
return userFullInfo.getEmpPosUnitCode(); | |||
} | |||
@Override | |||
public String getMainOrgCode(String empPosUnitCode) { | |||
DingOrganization org = iDingOrganizationService.getOne(Wrappers.lambdaQuery(DingOrganization.class) | |||
.eq(DingOrganization::getOrganizationCode, empPosUnitCode) | |||
.last(BizConst.LIMIT_1)); | |||
if(Objects.isNull(org)){ | |||
return null; | |||
} | |||
return org.getParentCode(); | |||
} | |||
} |
@@ -7,8 +7,10 @@ package com.hz.pm.api.common.model.constant; | |||
public class StateMachineConst { | |||
private StateMachineConst() { | |||
} | |||
public static final String PROJECT_DECLARE = "projectDeclare"; | |||
public static final String APPLICATION_DECLARE = "applicationDeclare"; | |||
public static final String LI_SHUI_CITY_AREA_CODE = "331100"; | |||
} |
@@ -264,16 +264,16 @@ public class ProjectDeclareStateMachineLQBuilder implements ProjectDeclareStateM | |||
@Bean(name = "projectDeclareStateMachineLQPersister") | |||
@Override | |||
public StateMachinePersister<ProjectStatusEnum, ProjectStatusChangeEvent, Project> getProjectPersister() { | |||
StateMachinePersister sp = new DefaultStateMachinePersister<>(new StateMachinePersist<ProjectStatusEnum, ProjectStatusChangeEvent, Project>() { | |||
StateMachinePersister<ProjectStatusEnum, ProjectStatusChangeEvent, Project> sp = new DefaultStateMachinePersister<>(new StateMachinePersist<ProjectStatusEnum, ProjectStatusChangeEvent, Project>() { | |||
@Override | |||
public void write(StateMachineContext<ProjectStatusEnum, ProjectStatusChangeEvent> context, Project contextObj) { | |||
logger.info(contextObj.toString()); | |||
} | |||
@Override | |||
public StateMachineContext<ProjectStatusEnum, ProjectStatusChangeEvent> read(Project contextObj) { | |||
StateMachineContext<ProjectStatusEnum, ProjectStatusChangeEvent> result = new DefaultStateMachineContext(ProjectStatusEnum.match(contextObj.getStatus()), | |||
return new DefaultStateMachineContext<>(ProjectStatusEnum.match(contextObj.getStatus()), | |||
null, null, null, null, RegionContant.LS_LQ_CODE); | |||
return result; | |||
} | |||
}); | |||
stateMachinePersister = sp; | |||
@@ -7,6 +7,10 @@ package com.hz.pm.api.common.statemachine.contant; | |||
* @Author PoffyZhang | |||
*/ | |||
public class RegionContant { | |||
private RegionContant() { | |||
} | |||
//市本级 | |||
public static final String LS_SBJ_CODE = "330100"; | |||
//莲都区 | |||
@@ -1,15 +1,16 @@ | |||
package com.hz.pm.api.common.util; | |||
import com.ningdatech.basic.exception.BizException; | |||
import com.ningdatech.basic.model.GenericResult; | |||
import com.hz.pm.api.todocenter.bean.entity.WorkNoticeInfo; | |||
import com.ningdatech.basic.model.GenericResult; | |||
import com.ningdatech.zwdd.client.ZwddClient; | |||
import lombok.RequiredArgsConstructor; | |||
import lombok.extern.slf4j.Slf4j; | |||
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor; | |||
import org.springframework.stereotype.Component; | |||
import java.util.List; | |||
import java.util.concurrent.*; | |||
import java.util.concurrent.CompletableFuture; | |||
import java.util.concurrent.ExecutionException; | |||
import java.util.concurrent.ThreadPoolExecutor; | |||
/** | |||
* 异步发送工作通知工具类 | |||
@@ -18,8 +19,8 @@ import java.util.concurrent.*; | |||
* @since 2023/02/23 13:50 | |||
*/ | |||
@Slf4j | |||
@RequiredArgsConstructor | |||
@Component | |||
@RequiredArgsConstructor | |||
public class SendWorkNoticeUtil { | |||
private final ZwddClient zwddClient; | |||
@@ -27,10 +28,21 @@ public class SendWorkNoticeUtil { | |||
/** | |||
* 初始化线程池 | |||
*/ | |||
public static ThreadPoolExecutor threadPool = new ThreadPoolExecutor(2, 10, | |||
60, TimeUnit.SECONDS, new ArrayBlockingQueue(10), new ThreadPoolExecutor.AbortPolicy()); | |||
public static final ThreadPoolTaskExecutor EXECUTOR; | |||
public Boolean sendWorkNotice(WorkNoticeInfo workNoticeInfo){ | |||
static { | |||
EXECUTOR = new ThreadPoolTaskExecutor(); | |||
EXECUTOR.setCorePoolSize(2); | |||
EXECUTOR.setMaxPoolSize(4); | |||
EXECUTOR.setQueueCapacity(200); | |||
EXECUTOR.setKeepAliveSeconds(120); | |||
EXECUTOR.setThreadNamePrefix("sendWorkNotice-"); | |||
EXECUTOR.setWaitForTasksToCompleteOnShutdown(true); | |||
EXECUTOR.setRejectedExecutionHandler(new ThreadPoolExecutor.AbortPolicy()); | |||
EXECUTOR.initialize(); | |||
} | |||
public Boolean sendWorkNotice(WorkNoticeInfo workNoticeInfo) { | |||
// 将发送工作通知交给异步任务Future | |||
String msg = workNoticeInfo.getMsg(); | |||
@@ -44,23 +56,18 @@ public class SendWorkNoticeUtil { | |||
log.info("异步任务执行完成, " + workNoticeInfo.getBizMsgId() + " 当前线程:" + Thread.currentThread().getName()); | |||
long endTime = System.currentTimeMillis(); | |||
log.info("方法执行完成返回,耗时:" + (endTime - startTime)); | |||
}else { | |||
} else { | |||
return "发送工作通知失败!"; | |||
} | |||
return "发送工作通知成功!"; | |||
}, threadPool); | |||
String s; | |||
try { | |||
s = future.get(); | |||
} catch (Exception e) { | |||
throw new BizException("获取异步线程处理结果失败!"); | |||
} | |||
threadPool.shutdown(); | |||
while (!threadPool.isTerminated()) { | |||
log.info(s); | |||
return Boolean.FALSE; | |||
} | |||
log.info(s); | |||
return Boolean.TRUE; | |||
}, EXECUTOR); | |||
try { | |||
future.get(); | |||
} catch (InterruptedException | ExecutionException e) { | |||
log.error("获取异步线程处理结果失败!", e); | |||
Thread.currentThread().interrupt(); | |||
} | |||
return Boolean.TRUE; | |||
} | |||
} |
@@ -7,6 +7,8 @@ package com.hz.pm.api.dashboard.constant; | |||
public class AnalysisBasicConstant { | |||
private AnalysisBasicConstant() { | |||
} | |||
/** | |||
* 丽水市区域编码 | |||
@@ -5,13 +5,13 @@ import cn.hutool.core.collection.CollUtil; | |||
import com.baomidou.mybatisplus.core.toolkit.Wrappers; | |||
import com.google.common.collect.Lists; | |||
import com.google.common.collect.Maps; | |||
import com.hz.pm.api.common.model.constant.RegionConst; | |||
import com.hz.pm.api.common.helper.RegionCacheHelper; | |||
import com.hz.pm.api.dashboard.constant.DashboardConstant; | |||
import com.hz.pm.api.common.model.constant.RegionConst; | |||
import com.hz.pm.api.dashboard.enums.CockpitAppcationTypeEnum; | |||
import com.hz.pm.api.dashboard.model.entity.CockpitApplication; | |||
import com.hz.pm.api.dashboard.model.entity.CockpitStats; | |||
import com.hz.pm.api.dashboard.model.vo.CockpitStatsVO; | |||
import com.hz.pm.api.dashboard.model.vo.CockpitStatsVO.*; | |||
import com.hz.pm.api.dashboard.service.ICockpitStatsService; | |||
import com.hz.pm.api.sys.model.dto.RegionDTO; | |||
import lombok.RequiredArgsConstructor; | |||
@@ -24,6 +24,8 @@ import java.math.RoundingMode; | |||
import java.util.*; | |||
import java.util.stream.Collectors; | |||
import static com.hz.pm.api.dashboard.constant.DashboardConstant.CockpitStats.*; | |||
/** | |||
* @Classname CockpitStatsHandler | |||
* @Description | |||
@@ -39,23 +41,23 @@ public class CockpitStatsHandler { | |||
private final ICockpitStatsService cockpitStatsService; | |||
private static final List<Integer> years = Lists.newArrayList(2021,2022,2023,2024,2025); | |||
private static final List<Integer> years = Lists.newArrayList(2021, 2022, 2023, 2024, 2025); | |||
public CockpitStatsVO convertCockpitStats(CockpitStats cockpitStats, String regionCode, Integer year | |||
, List<CockpitApplication> appDatas) { | |||
CockpitStatsVO res = BeanUtil.copyProperties(cockpitStats,CockpitStatsVO.class); | |||
CockpitStatsVO res = BeanUtil.copyProperties(cockpitStats, CockpitStatsVO.class); | |||
if(Objects.isNull(cockpitStats)){ | |||
if (Objects.isNull(cockpitStats)) { | |||
return res; | |||
} | |||
//监测数据 | |||
res.setMonitorData(convertMonitor(cockpitStats,regionCode)); | |||
res.setMonitorData(convertMonitor(cockpitStats, regionCode)); | |||
//专家数据 | |||
res.setExpertData(convertExpertData(cockpitStats)); | |||
//顶部数据 | |||
res.setTopData(convertTopData(cockpitStats)); | |||
//地图数据 | |||
res.setMapProjectData(convertMapProjectsData(cockpitStats,year)); | |||
res.setMapProjectData(convertMapProjectsData(cockpitStats, year)); | |||
//项目项目数据 | |||
res.setStatusProjectsData(convertStatusProjectsData(cockpitStats)); | |||
//项目效益 优秀项目 | |||
@@ -69,23 +71,23 @@ public class CockpitStatsHandler { | |||
//最佳/重大应用 | |||
res.setAppDatas(convertCockpitApps(appDatas)); | |||
//数据质量分数 | |||
res.setQualityDatas(convertQualityDatas(year)); | |||
res.setQualityDatas(convertQualityData(year)); | |||
return res; | |||
} | |||
private List<CockpitStatsVO.QualityData> convertQualityDatas(Integer year) { | |||
List<CockpitStats> datas = cockpitStatsService.list(Wrappers.lambdaQuery(CockpitStats.class) | |||
private List<QualityData> convertQualityData(Integer year) { | |||
List<CockpitStats> dataList = cockpitStatsService.list(Wrappers.lambdaQuery(CockpitStats.class) | |||
.eq(Objects.nonNull(year), CockpitStats::getYear, year) | |||
.eq(Objects.isNull(year), CockpitStats::getYear, DashboardConstant.CockpitStats.NONE_YEAR) | |||
.ne(CockpitStats::getRegionCode,DashboardConstant.CockpitStats.TOTAL) | |||
.eq(Objects.isNull(year), CockpitStats::getYear, NONE_YEAR) | |||
.ne(CockpitStats::getRegionCode, TOTAL) | |||
.orderByAsc(CockpitStats::getRegionCode)); | |||
if(CollUtil.isEmpty(datas)){ | |||
if (CollUtil.isEmpty(dataList)) { | |||
return Collections.emptyList(); | |||
} | |||
return datas.stream().map(d -> { | |||
CockpitStatsVO.QualityData data = new CockpitStatsVO.QualityData(); | |||
return dataList.stream().map(d -> { | |||
QualityData data = new QualityData(); | |||
data.setRegionCode(d.getRegionCode()); | |||
data.setRegionName(d.getRegionName()); | |||
data.setQuality(d.getDataQuality()); | |||
@@ -105,150 +107,144 @@ public class CockpitStatsHandler { | |||
} | |||
private CockpitStatsVO.PerformanceData convertPerformanceData(CockpitStats cockpitStats) { | |||
CockpitStatsVO.PerformanceData data = BeanUtil.copyProperties(cockpitStats,CockpitStatsVO.PerformanceData.class); | |||
CockpitStatsVO.PerformanceData data = BeanUtil.copyProperties(cockpitStats, CockpitStatsVO.PerformanceData.class); | |||
data.setPerformanceTops(convertTops(cockpitStats)); | |||
return data; | |||
} | |||
private List<CockpitStatsVO.PerformanceTop> convertTops(CockpitStats cockpitStats) { | |||
List<CockpitStatsVO.PerformanceTop> tops = Lists.newArrayList(); | |||
tops.add(new CockpitStatsVO.PerformanceTop("一星",cockpitStats.getPerformanceTop1Score(),cockpitStats.getPerformanceTop1Name())); | |||
tops.add(new CockpitStatsVO.PerformanceTop("二星",cockpitStats.getPerformanceTop2Score(),cockpitStats.getPerformanceTop2Name())); | |||
tops.add(new CockpitStatsVO.PerformanceTop("三星",cockpitStats.getPerformanceTop3Score(),cockpitStats.getPerformanceTop3Name())); | |||
tops.add(new CockpitStatsVO.PerformanceTop("四星",cockpitStats.getPerformanceTop4Score(),cockpitStats.getPerformanceTop4Name())); | |||
tops.add(new CockpitStatsVO.PerformanceTop("五星",cockpitStats.getPerformanceTop5Score(),cockpitStats.getPerformanceTop5Name())); | |||
private List<PerformanceTop> convertTops(CockpitStats cockpitStats) { | |||
List<PerformanceTop> tops = Lists.newArrayList(); | |||
tops.add(new PerformanceTop("一星", cockpitStats.getPerformanceTop1Score(), cockpitStats.getPerformanceTop1Name())); | |||
tops.add(new PerformanceTop("二星", cockpitStats.getPerformanceTop2Score(), cockpitStats.getPerformanceTop2Name())); | |||
tops.add(new PerformanceTop("三星", cockpitStats.getPerformanceTop3Score(), cockpitStats.getPerformanceTop3Name())); | |||
tops.add(new PerformanceTop("四星", cockpitStats.getPerformanceTop4Score(), cockpitStats.getPerformanceTop4Name())); | |||
tops.add(new PerformanceTop("五星", cockpitStats.getPerformanceTop5Score(), cockpitStats.getPerformanceTop5Name())); | |||
return tops; | |||
} | |||
private CockpitStatsVO.ProduceData convertProduceData(CockpitStats cockpitStats) { | |||
return BeanUtil.copyProperties(cockpitStats,CockpitStatsVO.ProduceData.class); | |||
return BeanUtil.copyProperties(cockpitStats, CockpitStatsVO.ProduceData.class); | |||
} | |||
private CockpitStatsVO.ReduceData convertReduceData(CockpitStats cockpitStats) { | |||
CockpitStatsVO.ReduceData data = BeanUtil.copyProperties(cockpitStats,CockpitStatsVO.ReduceData.class); | |||
CockpitStatsVO.ReduceData data = BeanUtil.copyProperties(cockpitStats, CockpitStatsVO.ReduceData.class); | |||
data.setAmountComparisonCharts(convertAmountComparisonChart(cockpitStats)); | |||
return data; | |||
} | |||
private List<CockpitStatsVO.AmountComparisonChart> convertAmountComparisonChart(CockpitStats cockpitStats) { | |||
List<CockpitStatsVO.AmountComparisonChart> res = Lists.newArrayList(); | |||
res.add(new CockpitStatsVO.AmountComparisonChart("申报", cockpitStats.getDeclaredAmountApprove(),cockpitStats.getApprovalAmountApprove(),cockpitStats.getDifferenceApprove())); | |||
res.add(new CockpitStatsVO.AmountComparisonChart("批复", cockpitStats.getDeclaredAmountApproval(),cockpitStats.getApprovalAmountApproval(),cockpitStats.getDifferenceApproval())); | |||
res.add(new CockpitStatsVO.AmountComparisonChart("合同", cockpitStats.getDeclaredAmountContract(),cockpitStats.getApprovalAmountContract(),cockpitStats.getDifferenceContract())); | |||
private List<AmountComparisonChart> convertAmountComparisonChart(CockpitStats cockpitStats) { | |||
List<AmountComparisonChart> res = Lists.newArrayList(); | |||
res.add(new AmountComparisonChart("申报", cockpitStats.getDeclaredAmountApprove(), cockpitStats.getApprovalAmountApprove(), cockpitStats.getDifferenceApprove())); | |||
res.add(new AmountComparisonChart("批复", cockpitStats.getDeclaredAmountApproval(), cockpitStats.getApprovalAmountApproval(), cockpitStats.getDifferenceApproval())); | |||
res.add(new AmountComparisonChart("合同", cockpitStats.getDeclaredAmountContract(), cockpitStats.getApprovalAmountContract(), cockpitStats.getDifferenceContract())); | |||
return res; | |||
} | |||
private CockpitStatsVO.ExcellentData convertExcellentData(CockpitStats cockpitStats) { | |||
CockpitStatsVO.ExcellentData data = BeanUtil.copyProperties(cockpitStats,CockpitStatsVO.ExcellentData.class); | |||
CockpitStatsVO.ExcellentData data = BeanUtil.copyProperties(cockpitStats, CockpitStatsVO.ExcellentData.class); | |||
data.setExcellentProjects(Lists.newArrayList()); | |||
return data; | |||
} | |||
private CockpitStatsVO.StatusProjectsData convertStatusProjectsData(CockpitStats cockpitStats) { | |||
return BeanUtil.copyProperties(cockpitStats,CockpitStatsVO.StatusProjectsData.class); | |||
return BeanUtil.copyProperties(cockpitStats, CockpitStatsVO.StatusProjectsData.class); | |||
} | |||
private List<CockpitStatsVO.MapProjectsData> convertMapProjectsData(CockpitStats cockpitStats,Integer year) { | |||
private List<CockpitStatsVO.MapProjectsData> convertMapProjectsData(CockpitStats cockpitStats, Integer year) { | |||
List<CockpitStatsVO.MapProjectsData> mapProjectsDatas = Lists.newArrayList(); | |||
List<RegionDTO> regions = regionCacheHelper.listChildren(RegionConst.RC_HZ, RegionConst.RL_CITY); | |||
regions = regions.stream().filter(r -> r.getRegionLevel() != 2).sorted(Comparator.comparing(RegionDTO::getRegionCode)).collect(Collectors.toList()); | |||
List<CockpitStats> cockpitStatsAll = cockpitStatsService.list(Wrappers.lambdaQuery(CockpitStats.class) | |||
.eq(Objects.nonNull(year), CockpitStats::getYear, year) | |||
.eq(Objects.isNull(year), CockpitStats::getYear, DashboardConstant.CockpitStats.NONE_YEAR)); | |||
Map<String, Integer> totalMap = cockpitStatsAll.stream().filter(c -> Objects.nonNull(c.getRegionCode()) && Objects.nonNull(c.getProjectsTotal())) | |||
.collect(Collectors.toMap(c -> c.getRegionCode(), c -> c.getProjectsTotal())); | |||
.eq(Objects.isNull(year), CockpitStats::getYear, NONE_YEAR)); | |||
Map<String, Integer> totalMap = cockpitStatsAll.stream() | |||
.filter(c -> Objects.nonNull(c.getRegionCode()) && Objects.nonNull(c.getProjectsTotal())) | |||
.collect(Collectors.toMap(CockpitStats::getRegionCode, CockpitStats::getProjectsTotal)); | |||
for(RegionDTO region : regions){ | |||
for (RegionDTO region : regions) { | |||
CockpitStatsVO.MapProjectsData mapProjectsData = new CockpitStatsVO.MapProjectsData(); | |||
mapProjectsData.setRegionCode(region.getRegionCode()); | |||
mapProjectsData.setRegionName(region.getRegionName()); | |||
if(totalMap.containsKey(mapProjectsData.getRegionCode())){ | |||
mapProjectsData.setProjectsNum(totalMap.get(mapProjectsData.getRegionCode())); | |||
}else{ | |||
mapProjectsData.setProjectsNum(0); | |||
} | |||
mapProjectsData.setProjectsNum(totalMap.getOrDefault(mapProjectsData.getRegionCode(), 0)); | |||
mapProjectsDatas.add(mapProjectsData); | |||
} | |||
return mapProjectsDatas; | |||
} | |||
private CockpitStatsVO.TopData convertTopData(CockpitStats cockpitStats) { | |||
return BeanUtil.copyProperties(cockpitStats,CockpitStatsVO.TopData.class); | |||
return BeanUtil.copyProperties(cockpitStats, CockpitStatsVO.TopData.class); | |||
} | |||
private CockpitStatsVO.Expert convertExpertData(CockpitStats cockpitStats) { | |||
CockpitStatsVO.Expert expert = BeanUtil.copyProperties(cockpitStats,CockpitStatsVO.Expert.class); | |||
expert.setExpertRegionData(buidExpertRegionData(cockpitStats)); | |||
CockpitStatsVO.Expert expert = BeanUtil.copyProperties(cockpitStats, CockpitStatsVO.Expert.class); | |||
expert.setExpertRegionData(buildExpertRegionData(cockpitStats)); | |||
return expert; | |||
} | |||
private List<CockpitStatsVO.ExpertRegion> buidExpertRegionData(CockpitStats cockpitStats) { | |||
private List<CockpitStatsVO.ExpertRegion> buildExpertRegionData(CockpitStats cockpitStats) { | |||
List<CockpitStatsVO.ExpertRegion> regionData = Lists.newArrayList(); | |||
List<RegionDTO> regions = regionCacheHelper.listChildren(RegionConst.RC_HZ, RegionConst.RL_CITY); | |||
regions = regions.stream().filter(r -> r.getRegionLevel() != 2).sorted(Comparator.comparing(RegionDTO::getRegionCode)).collect(Collectors.toList()); | |||
List<CockpitStats> cs = cockpitStatsService.list(); | |||
Map<String, Integer> csMap = cs.stream().collect(Collectors.toMap(c -> c.getRegionCode() + c.getYear(), CockpitStats::getExpertTotalNum)); | |||
for(RegionDTO region : regions){ | |||
for (RegionDTO region : regions) { | |||
CockpitStatsVO.ExpertRegion expertRegion = new CockpitStatsVO.ExpertRegion(); | |||
expertRegion.setRegionCode(region.getRegionCode()); | |||
expertRegion.setRegionName(region.getRegionName()); | |||
if(csMap.containsKey(region.getRegionCode() + 0)){ | |||
expertRegion.setExpertNum(csMap.get(region.getRegionCode() + 0)); | |||
}else{ | |||
expertRegion.setExpertNum(0); | |||
} | |||
expertRegion.setExpertNum(csMap.getOrDefault(region.getRegionCode() + 0, 0)); | |||
regionData.add(expertRegion); | |||
} | |||
return regionData; | |||
} | |||
private CockpitStatsVO.Monitor convertMonitor(CockpitStats cockpitStats,String regionCode) { | |||
CockpitStatsVO.Monitor monitor = BeanUtil.copyProperties(cockpitStats,CockpitStatsVO.Monitor.class); | |||
monitor.setPasswordGradeCharts(buidPasswordGradeCharts(cockpitStats)); | |||
monitor.setSecrecyGradeCharts(buidSecrecyGradeCharts(cockpitStats)); | |||
private CockpitStatsVO.Monitor convertMonitor(CockpitStats cockpitStats, String regionCode) { | |||
CockpitStatsVO.Monitor monitor = BeanUtil.copyProperties(cockpitStats, CockpitStatsVO.Monitor.class); | |||
monitor.setPasswordGradeCharts(buildPasswordGradeCharts(cockpitStats)); | |||
monitor.setSecrecyGradeCharts(buildSecrecyGradeCharts(cockpitStats)); | |||
monitor.setMonitorSafetyInputRate(computeSafetyRate(regionCode)); | |||
return monitor; | |||
} | |||
/** | |||
* 安全投入 比 图 | |||
* | |||
* @param regionCode | |||
* @return | |||
*/ | |||
private List<CockpitStatsVO.SafetyInput> computeSafetyRate(String regionCode) { | |||
List<CockpitStats> cocks = cockpitStatsService.list(Wrappers.lambdaQuery(CockpitStats.class) | |||
.eq(StringUtils.isNotBlank(regionCode), CockpitStats::getRegionCode, regionCode) | |||
.eq(StringUtils.isBlank(regionCode), CockpitStats::getRegionCode, DashboardConstant.CockpitStats.TOTAL) | |||
.eq(StringUtils.isBlank(regionCode), CockpitStats::getRegionCode, TOTAL) | |||
.in(CockpitStats::getYear, years) | |||
.orderByAsc(CockpitStats::getYear)); | |||
return cocks.stream().map(c -> { | |||
CockpitStatsVO.SafetyInput safetyInput = new CockpitStatsVO.SafetyInput(); | |||
safetyInput.setYear(c.getYear()); | |||
safetyInput.setRate(Objects.nonNull(c.getMonitorDeclaredAmount()) && c.getMonitorDeclaredAmount().compareTo(BigDecimal.ZERO) > 0 ? | |||
c.getMonitorSafetyInputAmount().multiply(BigDecimal.valueOf(100)).divide(c.getMonitorDeclaredAmount(),2, RoundingMode.CEILING): BigDecimal.ZERO); | |||
c.getMonitorSafetyInputAmount().multiply(BigDecimal.valueOf(100)).divide(c.getMonitorDeclaredAmount(), 2, RoundingMode.CEILING) : BigDecimal.ZERO); | |||
return safetyInput; | |||
}).collect(Collectors.toList()); | |||
} | |||
private List<CockpitStatsVO.SecrecyGradeChart> buidSecrecyGradeCharts(CockpitStats cockpitStats) { | |||
List<CockpitStatsVO.SecrecyGradeChart> chars = Lists.newArrayList(); | |||
chars.add(new CockpitStatsVO.SecrecyGradeChart(1,cockpitStats.getMonitorSecrecyGrade1Num())); | |||
chars.add(new CockpitStatsVO.SecrecyGradeChart(2,cockpitStats.getMonitorSecrecyGrade2Num())); | |||
chars.add(new CockpitStatsVO.SecrecyGradeChart(3,cockpitStats.getMonitorSecrecyGrade3Num())); | |||
chars.add(new CockpitStatsVO.SecrecyGradeChart(4,cockpitStats.getMonitorSecrecyGrade4Num())); | |||
chars.add(new CockpitStatsVO.SecrecyGradeChart(5,cockpitStats.getMonitorSecrecyGrade5Num())); | |||
private List<SecrecyGradeChart> buildSecrecyGradeCharts(CockpitStats cockpitStats) { | |||
List<SecrecyGradeChart> chars = Lists.newArrayList(); | |||
chars.add(new SecrecyGradeChart(1, cockpitStats.getMonitorSecrecyGrade1Num())); | |||
chars.add(new SecrecyGradeChart(2, cockpitStats.getMonitorSecrecyGrade2Num())); | |||
chars.add(new SecrecyGradeChart(3, cockpitStats.getMonitorSecrecyGrade3Num())); | |||
chars.add(new SecrecyGradeChart(4, cockpitStats.getMonitorSecrecyGrade4Num())); | |||
chars.add(new SecrecyGradeChart(5, cockpitStats.getMonitorSecrecyGrade5Num())); | |||
return chars; | |||
} | |||
private List<CockpitStatsVO.PasswordGradeChart> buidPasswordGradeCharts(CockpitStats cockpitStats) { | |||
List<CockpitStatsVO.PasswordGradeChart> chars = Lists.newArrayList(); | |||
chars.add(new CockpitStatsVO.PasswordGradeChart(1,cockpitStats.getMonitorPasswordGrade1Num())); | |||
chars.add(new CockpitStatsVO.PasswordGradeChart(2,cockpitStats.getMonitorPasswordGrade2Num())); | |||
chars.add(new CockpitStatsVO.PasswordGradeChart(3,cockpitStats.getMonitorPasswordGrade3Num())); | |||
chars.add(new CockpitStatsVO.PasswordGradeChart(4,cockpitStats.getMonitorPasswordGrade4Num())); | |||
chars.add(new CockpitStatsVO.PasswordGradeChart(5,cockpitStats.getMonitorPasswordGrade5Num())); | |||
private List<PasswordGradeChart> buildPasswordGradeCharts(CockpitStats cockpitStats) { | |||
List<PasswordGradeChart> chars = Lists.newArrayList(); | |||
chars.add(new PasswordGradeChart(1, cockpitStats.getMonitorPasswordGrade1Num())); | |||
chars.add(new PasswordGradeChart(2, cockpitStats.getMonitorPasswordGrade2Num())); | |||
chars.add(new PasswordGradeChart(3, cockpitStats.getMonitorPasswordGrade3Num())); | |||
chars.add(new PasswordGradeChart(4, cockpitStats.getMonitorPasswordGrade4Num())); | |||
chars.add(new PasswordGradeChart(5, cockpitStats.getMonitorPasswordGrade5Num())); | |||
return chars; | |||
} | |||
} |
@@ -71,7 +71,7 @@ public class EarlyWarningStatisticsManage { | |||
EarlyWarningStatisticsVO res = new EarlyWarningStatisticsVO(); | |||
LambdaQueryWrapper<WflowEarlyWarningRecords> wrapper = Wrappers.lambdaQuery(WflowEarlyWarningRecords.class); | |||
EarlyWarningUtil.buildPermissonWrapper(wrapper,user); | |||
EarlyWarningUtil.buildPermissionWrapper(wrapper,user); | |||
List<WflowEarlyWarningRecords> records = earlyWarningRecordsService.list(wrapper); | |||
//累积总告警数 | |||
res.setAccumulatedAlarmsTotal(records.size()); | |||
@@ -5,13 +5,11 @@ import io.swagger.annotations.ApiModel; | |||
import io.swagger.annotations.ApiModelProperty; | |||
import lombok.Data; | |||
import java.io.Serializable; | |||
import java.util.List; | |||
@Data | |||
@ApiModel(value = "项目统计") | |||
public class ProjectStatisticsVO implements Serializable { | |||
private static final long serialVersionUID = 1L; | |||
public class ProjectStatisticsVO { | |||
@ApiModelProperty("项目计划数") | |||
private Integer planTotal = 0; | |||
@@ -7,7 +7,7 @@ import java.util.List; | |||
/** | |||
* <p> | |||
* DataScopeDto | |||
* DataScopeDTO | |||
* </p> | |||
* | |||
* @author WendyYang | |||
@@ -18,14 +18,8 @@ public class DataScopeDTO { | |||
private RoleEnum role; | |||
private List<Long> regionIds; | |||
private List<String> regionCodes; | |||
private String orgCode; | |||
private String employeeCode; | |||
private Long userId; | |||
} |
@@ -1,6 +1,5 @@ | |||
package com.hz.pm.api.datascope.provider.impl; | |||
import com.google.common.collect.Lists; | |||
import com.hz.pm.api.common.helper.UserInfoHelper; | |||
import com.hz.pm.api.datascope.model.DataScopeDTO; | |||
import com.hz.pm.api.datascope.provider.DataScopeProvider; | |||
@@ -30,23 +29,19 @@ public class DashboardUserDataScopeProviderImpl implements DataScopeProvider { | |||
@Override | |||
public Optional<DataScopeDTO> findDataFieldProperty() { | |||
UserFullInfoDTO userFullInfo = userInfoHelper.getUserFullInfo(LoginUserUtil.getUserId()); | |||
UserFullInfoDTO user = userInfoHelper.getUserFullInfo(LoginUserUtil.getUserId()); | |||
DataScopeDTO ds = new DataScopeDTO(); | |||
ds.setEmployeeCode(userFullInfo.getEmployeeCode()); | |||
ds.setRegionCodes(Lists.newArrayList(userFullInfo.getRegionCode())); | |||
ds.setUserId(userFullInfo.getUserId()); | |||
ds.setUserId(user.getUserId()); | |||
ds.setRole(RoleEnum.DASHBOARD); | |||
return Optional.ofNullable(ds); | |||
return Optional.of(ds); | |||
} | |||
@Override | |||
public Optional<DataScopeDTO> findDataFieldProperty(Long userId) { | |||
UserFullInfoDTO userFullInfo = userInfoHelper.getUserFullInfo(userId); | |||
UserFullInfoDTO user = userInfoHelper.getUserFullInfo(userId); | |||
DataScopeDTO ds = new DataScopeDTO(); | |||
ds.setEmployeeCode(userFullInfo.getEmployeeCode()); | |||
ds.setRegionCodes(Lists.newArrayList(userFullInfo.getRegionCode())); | |||
ds.setUserId(userFullInfo.getUserId()); | |||
ds.setUserId(user.getUserId()); | |||
ds.setRole(RoleEnum.DASHBOARD); | |||
return Optional.ofNullable(ds); | |||
return Optional.of(ds); | |||
} | |||
} |
@@ -1,11 +1,8 @@ | |||
package com.hz.pm.api.datascope.provider.impl; | |||
import com.ningdatech.basic.util.CollUtils; | |||
import com.hz.pm.api.common.helper.RegionCacheHelper; | |||
import com.hz.pm.api.common.helper.UserInfoHelper; | |||
import com.hz.pm.api.datascope.model.DataScopeDTO; | |||
import com.hz.pm.api.datascope.provider.DataScopeProvider; | |||
import com.hz.pm.api.sys.model.dto.RegionDTO; | |||
import com.hz.pm.api.user.model.enumeration.RoleEnum; | |||
import com.hz.pm.api.user.security.model.UserFullInfoDTO; | |||
import com.hz.pm.api.user.security.model.UserInfoDetails; | |||
@@ -13,9 +10,6 @@ import com.hz.pm.api.user.util.LoginUserUtil; | |||
import lombok.RequiredArgsConstructor; | |||
import org.springframework.stereotype.Component; | |||
import java.util.Collections; | |||
import java.util.List; | |||
import java.util.Objects; | |||
import java.util.Optional; | |||
/** | |||
@@ -30,25 +24,15 @@ import java.util.Optional; | |||
@RequiredArgsConstructor | |||
public class ExpertAdminDataScopeProviderImpl implements DataScopeProvider { | |||
private final RegionCacheHelper regionCacheHelper; | |||
private final UserInfoHelper userInfoHelper; | |||
@Override | |||
public Optional<DataScopeDTO> findDataFieldProperty() { | |||
UserInfoDetails user = LoginUserUtil.loginUserDetail(); | |||
DataScopeDTO ds = new DataScopeDTO(); | |||
if (Objects.isNull(user.getRegionLevel())) { | |||
ds.setRegionIds(Collections.emptyList()); | |||
ds.setRegionCodes(Collections.emptyList()); | |||
} else { | |||
List<RegionDTO> regions = regionCacheHelper.listChildren(user.getRegionCode(), user.getRegionLevel()); | |||
ds.setRegionCodes(CollUtils.fieldList(regions, RegionDTO::getRegionCode)); | |||
ds.setRegionIds(CollUtils.fieldList(regions, RegionDTO::getId)); | |||
} | |||
ds.setRole(RoleEnum.EXPERT_ADMIN); | |||
ds.setUserId(user.getUserId()); | |||
ds.setEmployeeCode(user.getEmployeeCode()); | |||
ds.setOrgCode(user.getOrganizationCode()); | |||
ds.setOrgCode(user.getMhUnitIdStr()); | |||
return Optional.of(ds); | |||
} | |||
@@ -56,18 +40,9 @@ public class ExpertAdminDataScopeProviderImpl implements DataScopeProvider { | |||
public Optional<DataScopeDTO> findDataFieldProperty(Long userId) { | |||
UserFullInfoDTO user = userInfoHelper.getUserFullInfo(userId); | |||
DataScopeDTO ds = new DataScopeDTO(); | |||
if (Objects.isNull(user.getRegionLevel())) { | |||
ds.setRegionIds(Collections.emptyList()); | |||
ds.setRegionCodes(Collections.emptyList()); | |||
} else { | |||
List<RegionDTO> regions = regionCacheHelper.listChildren(user.getRegionCode(), user.getRegionLevel()); | |||
ds.setRegionCodes(CollUtils.fieldList(regions, RegionDTO::getRegionCode)); | |||
ds.setRegionIds(CollUtils.fieldList(regions, RegionDTO::getId)); | |||
} | |||
ds.setRole(RoleEnum.EXPERT_ADMIN); | |||
ds.setUserId(user.getUserId()); | |||
ds.setEmployeeCode(user.getEmployeeCode()); | |||
ds.setOrgCode(user.getOrganizationCode()); | |||
ds.setOrgCode(user.getMhUnitIdStr()); | |||
return Optional.of(ds); | |||
} | |||
@@ -1,6 +1,5 @@ | |||
package com.hz.pm.api.datascope.provider.impl; | |||
import com.hz.pm.api.common.model.constant.RegionConst; | |||
import com.hz.pm.api.common.helper.RegionCacheHelper; | |||
import com.hz.pm.api.common.helper.UserInfoHelper; | |||
import com.hz.pm.api.datascope.model.DataScopeDTO; | |||
@@ -12,9 +11,7 @@ import lombok.RequiredArgsConstructor; | |||
import lombok.extern.slf4j.Slf4j; | |||
import org.springframework.stereotype.Component; | |||
import java.util.Collection; | |||
import java.util.Optional; | |||
import java.util.stream.Collectors; | |||
/** | |||
* <p> | |||
@@ -36,30 +33,18 @@ public class ExpertDataScopeProviderImpl implements DataScopeProvider { | |||
@Override | |||
public Optional<DataScopeDTO> findDataFieldProperty() { | |||
UserFullInfoDTO userFullInfo = userInfoHelper.getUserFullInfo(LoginUserUtil.getUserId()); | |||
//所有 丽水市的code | |||
Collection<String> regionCodes = regionCacheHelper.listChildRegionCodeList(RegionConst.RC_HZ, | |||
RegionConst.RL_CITY); | |||
DataScopeDTO ds = new DataScopeDTO(); | |||
ds.setRegionCodes(regionCodes.stream().collect(Collectors.toList())); | |||
ds.setUserId(userFullInfo.getUserId()); | |||
ds.setEmployeeCode(userFullInfo.getEmployeeCode()); | |||
ds.setRole(RoleEnum.EXPERT); | |||
return Optional.ofNullable(ds); | |||
return Optional.of(ds); | |||
} | |||
@Override | |||
public Optional<DataScopeDTO> findDataFieldProperty(Long userId) { | |||
UserFullInfoDTO userFullInfo = userInfoHelper.getUserFullInfo(userId); | |||
//所有 丽水市的code | |||
Collection<String> regionCodes = regionCacheHelper.listChildRegionCodeList(RegionConst.RC_HZ, | |||
RegionConst.RL_CITY); | |||
DataScopeDTO ds = new DataScopeDTO(); | |||
ds.setRegionCodes(regionCodes.stream().collect(Collectors.toList())); | |||
ds.setUserId(userFullInfo.getUserId()); | |||
ds.setEmployeeCode(userFullInfo.getEmployeeCode()); | |||
ds.setRole(RoleEnum.EXPERT); | |||
return Optional.ofNullable(ds); | |||
return Optional.of(ds); | |||
} | |||
} |
@@ -1,9 +1,5 @@ | |||
package com.hz.pm.api.datascope.provider.impl; | |||
import cn.hutool.core.collection.CollUtil; | |||
import com.google.common.collect.Lists; | |||
import com.hz.pm.api.common.model.constant.RegionConst; | |||
import com.hz.pm.api.common.helper.RegionCacheHelper; | |||
import com.hz.pm.api.common.helper.UserInfoHelper; | |||
import com.hz.pm.api.datascope.model.DataScopeDTO; | |||
import com.hz.pm.api.datascope.provider.DataScopeProvider; | |||
@@ -14,8 +10,6 @@ import lombok.RequiredArgsConstructor; | |||
import lombok.extern.slf4j.Slf4j; | |||
import org.springframework.stereotype.Component; | |||
import java.util.ArrayList; | |||
import java.util.Collection; | |||
import java.util.Optional; | |||
/** | |||
@@ -31,26 +25,14 @@ import java.util.Optional; | |||
@Component("HIGH_MEMBER") | |||
public class HigherUserDataScopeProviderImpl implements DataScopeProvider { | |||
private final RegionCacheHelper regionCacheHelper; | |||
private final UserInfoHelper userInfoHelper; | |||
//和区域管理员一样 | |||
@Override | |||
public Optional<DataScopeDTO> findDataFieldProperty() { | |||
UserFullInfoDTO userFullInfo = userInfoHelper.getUserFullInfo(LoginUserUtil.getUserId()); | |||
//借由 丽水市的code 来映射市本级的regionCode | |||
Collection<String> regionCodes = regionCacheHelper.listChildRegionCodeList(userFullInfo.getRegionCode(), | |||
RegionConst.RL_CITY); | |||
//如果不是市本级的话 就直接放入本区域的县就好了 | |||
if(CollUtil.isEmpty(regionCodes)){ | |||
regionCodes = Lists.newArrayList(); | |||
regionCodes.add(userFullInfo.getRegionCode()); | |||
} | |||
DataScopeDTO ds = new DataScopeDTO(); | |||
ds.setRegionCodes(new ArrayList<>(regionCodes)); | |||
ds.setUserId(userFullInfo.getUserId()); | |||
ds.setEmployeeCode(userFullInfo.getEmployeeCode()); | |||
ds.setRole(RoleEnum.REGION_MANAGER); | |||
return Optional.of(ds); | |||
} | |||
@@ -59,18 +41,9 @@ public class HigherUserDataScopeProviderImpl implements DataScopeProvider { | |||
public Optional<DataScopeDTO> findDataFieldProperty(Long userId) { | |||
UserFullInfoDTO userFullInfo = userInfoHelper.getUserFullInfo(userId); | |||
//借由 丽水市的code 来映射市本级的regionCode | |||
Collection<String> regionCodes = regionCacheHelper.listChildRegionCodeList(userFullInfo.getRegionCode(), | |||
RegionConst.RL_CITY); | |||
//如果不是市本级的话 就直接放入本区域的县就好了 | |||
if(CollUtil.isEmpty(regionCodes)){ | |||
regionCodes = Lists.newArrayList(); | |||
regionCodes.add(userFullInfo.getRegionCode()); | |||
} | |||
DataScopeDTO ds = new DataScopeDTO(); | |||
ds.setRegionCodes(new ArrayList<>(regionCodes)); | |||
ds.setUserId(userFullInfo.getUserId()); | |||
ds.setEmployeeCode(userFullInfo.getEmployeeCode()); | |||
ds.setRole(RoleEnum.REGION_MANAGER); | |||
return Optional.of(ds); | |||
} | |||
@@ -1,6 +1,5 @@ | |||
package com.hz.pm.api.datascope.provider.impl; | |||
import com.google.common.collect.Lists; | |||
import com.hz.pm.api.common.helper.UserInfoHelper; | |||
import com.hz.pm.api.datascope.model.DataScopeDTO; | |||
import com.hz.pm.api.datascope.provider.DataScopeProvider; | |||
@@ -10,6 +9,7 @@ import com.hz.pm.api.user.util.LoginUserUtil; | |||
import lombok.RequiredArgsConstructor; | |||
import lombok.extern.slf4j.Slf4j; | |||
import org.springframework.stereotype.Component; | |||
import java.util.Optional; | |||
/** | |||
@@ -31,21 +31,18 @@ public class OrdinaryUserDataScopeProviderImpl implements DataScopeProvider { | |||
public Optional<DataScopeDTO> findDataFieldProperty() { | |||
UserFullInfoDTO userFullInfo = userInfoHelper.getUserFullInfo(LoginUserUtil.getUserId()); | |||
DataScopeDTO ds = new DataScopeDTO(); | |||
ds.setEmployeeCode(userFullInfo.getEmployeeCode()); | |||
ds.setRegionCodes(Lists.newArrayList(userFullInfo.getRegionCode())); | |||
ds.setUserId(userFullInfo.getUserId()); | |||
ds.setRole(RoleEnum.NORMAL_MEMBER); | |||
return Optional.ofNullable(ds); | |||
return Optional.of(ds); | |||
} | |||
@Override | |||
public Optional<DataScopeDTO> findDataFieldProperty(Long userId) { | |||
UserFullInfoDTO userFullInfo = userInfoHelper.getUserFullInfo(userId); | |||
DataScopeDTO ds = new DataScopeDTO(); | |||
ds.setEmployeeCode(userFullInfo.getEmployeeCode()); | |||
ds.setRegionCodes(Lists.newArrayList(userFullInfo.getRegionCode())); | |||
ds.setUserId(userFullInfo.getUserId()); | |||
ds.setRole(RoleEnum.NORMAL_MEMBER); | |||
return Optional.ofNullable(ds); | |||
return Optional.of(ds); | |||
} | |||
} |
@@ -9,6 +9,7 @@ import com.hz.pm.api.user.util.LoginUserUtil; | |||
import lombok.RequiredArgsConstructor; | |||
import lombok.extern.slf4j.Slf4j; | |||
import org.springframework.stereotype.Component; | |||
import java.util.Optional; | |||
/** | |||
@@ -30,9 +31,8 @@ public class OrgAdminDataScopeProviderImpl implements DataScopeProvider { | |||
public Optional<DataScopeDTO> findDataFieldProperty() { | |||
UserFullInfoDTO userFullInfo = userInfoHelper.getUserFullInfo(LoginUserUtil.getUserId()); | |||
DataScopeDTO ds = new DataScopeDTO(); | |||
ds.setOrgCode(userFullInfo.getEmpPosUnitCode()); | |||
ds.setOrgCode(String.valueOf(userFullInfo.getMhUnitId())); | |||
ds.setUserId(userFullInfo.getUserId()); | |||
ds.setEmployeeCode(userFullInfo.getEmployeeCode()); | |||
ds.setRole(RoleEnum.COMPANY_MANAGER); | |||
return Optional.of(ds); | |||
} | |||
@@ -41,9 +41,8 @@ public class OrgAdminDataScopeProviderImpl implements DataScopeProvider { | |||
public Optional<DataScopeDTO> findDataFieldProperty(Long userId) { | |||
UserFullInfoDTO userFullInfo = userInfoHelper.getUserFullInfo(userId); | |||
DataScopeDTO ds = new DataScopeDTO(); | |||
ds.setOrgCode(userFullInfo.getEmpPosUnitCode()); | |||
ds.setOrgCode(String.valueOf(userFullInfo.getMhUnitId())); | |||
ds.setUserId(userFullInfo.getUserId()); | |||
ds.setEmployeeCode(userFullInfo.getEmployeeCode()); | |||
ds.setRole(RoleEnum.COMPANY_MANAGER); | |||
return Optional.of(ds); | |||
} | |||
@@ -1,8 +1,5 @@ | |||
package com.hz.pm.api.datascope.provider.impl; | |||
import cn.hutool.core.collection.CollUtil; | |||
import com.google.common.collect.Lists; | |||
import com.hz.pm.api.common.model.constant.RegionConst; | |||
import com.hz.pm.api.common.helper.RegionCacheHelper; | |||
import com.hz.pm.api.common.helper.UserInfoHelper; | |||
import com.hz.pm.api.datascope.model.DataScopeDTO; | |||
@@ -14,8 +11,6 @@ import lombok.RequiredArgsConstructor; | |||
import lombok.extern.slf4j.Slf4j; | |||
import org.springframework.stereotype.Component; | |||
import java.util.ArrayList; | |||
import java.util.Collection; | |||
import java.util.Optional; | |||
/** | |||
@@ -37,19 +32,8 @@ public class RegionAdminDataScopeProviderImpl implements DataScopeProvider { | |||
@Override | |||
public Optional<DataScopeDTO> findDataFieldProperty() { | |||
UserFullInfoDTO userFullInfo = userInfoHelper.getUserFullInfo(LoginUserUtil.getUserId()); | |||
//借由 丽水市的code 来映射市本级的regionCode | |||
Collection<String> regionCodes = regionCacheHelper.listChildRegionCodeList(userFullInfo.getRegionCode(), | |||
RegionConst.RL_CITY); | |||
//如果不是市本级的话 就直接放入本区域的县就好了 | |||
if(CollUtil.isEmpty(regionCodes)){ | |||
regionCodes = Lists.newArrayList(); | |||
regionCodes.add(userFullInfo.getRegionCode()); | |||
} | |||
DataScopeDTO ds = new DataScopeDTO(); | |||
ds.setRegionCodes(new ArrayList<>(regionCodes)); | |||
ds.setUserId(userFullInfo.getUserId()); | |||
ds.setEmployeeCode(userFullInfo.getEmployeeCode()); | |||
ds.setRole(RoleEnum.REGION_MANAGER); | |||
return Optional.of(ds); | |||
} | |||
@@ -57,19 +41,8 @@ public class RegionAdminDataScopeProviderImpl implements DataScopeProvider { | |||
@Override | |||
public Optional<DataScopeDTO> findDataFieldProperty(Long userId) { | |||
UserFullInfoDTO userFullInfo = userInfoHelper.getUserFullInfo(userId); | |||
//借由 丽水市的code 来映射市本级的regionCode | |||
Collection<String> regionCodes = regionCacheHelper.listChildRegionCodeList(userFullInfo.getRegionCode(), | |||
RegionConst.RL_CITY); | |||
//如果不是市本级的话 就直接放入本区域的县就好了 | |||
if(CollUtil.isEmpty(regionCodes)){ | |||
regionCodes = Lists.newArrayList(); | |||
regionCodes.add(userFullInfo.getRegionCode()); | |||
} | |||
DataScopeDTO ds = new DataScopeDTO(); | |||
ds.setRegionCodes(new ArrayList<>(regionCodes)); | |||
ds.setUserId(userFullInfo.getUserId()); | |||
ds.setEmployeeCode(userFullInfo.getEmployeeCode()); | |||
ds.setRole(RoleEnum.REGION_MANAGER); | |||
return Optional.of(ds); | |||
} | |||
@@ -1,6 +1,5 @@ | |||
package com.hz.pm.api.datascope.provider.impl; | |||
import com.hz.pm.api.common.model.constant.RegionConst; | |||
import com.hz.pm.api.common.helper.RegionCacheHelper; | |||
import com.hz.pm.api.common.helper.UserInfoHelper; | |||
import com.hz.pm.api.datascope.model.DataScopeDTO; | |||
@@ -12,8 +11,6 @@ import lombok.RequiredArgsConstructor; | |||
import lombok.extern.slf4j.Slf4j; | |||
import org.springframework.stereotype.Component; | |||
import java.util.ArrayList; | |||
import java.util.Collection; | |||
import java.util.Optional; | |||
/** | |||
@@ -37,13 +34,8 @@ public class SuperAdminDataScopeProviderImpl implements DataScopeProvider { | |||
public Optional<DataScopeDTO> findDataFieldProperty() { | |||
UserFullInfoDTO userFullInfo = userInfoHelper.getUserFullInfo(LoginUserUtil.getUserId()); | |||
//所有 丽水市的code | |||
Collection<String> regionCodes = regionCacheHelper.listChildRegionCodeList(RegionConst.RC_HZ, | |||
RegionConst.RL_CITY); | |||
DataScopeDTO ds = new DataScopeDTO(); | |||
ds.setRegionCodes(new ArrayList<>(regionCodes)); | |||
ds.setUserId(userFullInfo.getUserId()); | |||
ds.setEmployeeCode(userFullInfo.getEmployeeCode()); | |||
ds.setRole(RoleEnum.SUPER_ADMIN); | |||
return Optional.of(ds); | |||
} | |||
@@ -51,14 +43,8 @@ public class SuperAdminDataScopeProviderImpl implements DataScopeProvider { | |||
@Override | |||
public Optional<DataScopeDTO> findDataFieldProperty(Long userId) { | |||
UserFullInfoDTO userFullInfo = userInfoHelper.getUserFullInfo(userId); | |||
//所有 丽水市的code | |||
Collection<String> regionCodes = regionCacheHelper.listChildRegionCodeList(RegionConst.RC_HZ, | |||
RegionConst.RL_CITY); | |||
DataScopeDTO ds = new DataScopeDTO(); | |||
ds.setRegionCodes(new ArrayList<>(regionCodes)); | |||
ds.setUserId(userFullInfo.getUserId()); | |||
ds.setEmployeeCode(userFullInfo.getEmployeeCode()); | |||
ds.setRole(RoleEnum.SUPER_ADMIN); | |||
return Optional.of(ds); | |||
} | |||
@@ -1,14 +1,12 @@ | |||
package com.hz.pm.api.datascope.provider.impl; | |||
import com.hz.pm.api.common.helper.UserInfoHelper; | |||
import com.hz.pm.api.datascope.model.DataScopeDTO; | |||
import com.hz.pm.api.datascope.provider.DataScopeProvider; | |||
import com.hz.pm.api.user.model.enumeration.RoleEnum; | |||
import com.hz.pm.api.user.security.model.UserFullInfoDTO; | |||
import com.hz.pm.api.user.util.LoginUserUtil; | |||
import lombok.RequiredArgsConstructor; | |||
import lombok.extern.slf4j.Slf4j; | |||
import org.springframework.stereotype.Component; | |||
import java.util.Optional; | |||
/** | |||
@@ -22,24 +20,19 @@ import java.util.Optional; | |||
@Slf4j | |||
@RequiredArgsConstructor | |||
@Component("VISITOR") | |||
public class VisitoyDataScopeProviderImpl implements DataScopeProvider { | |||
private final UserInfoHelper userInfoHelper; | |||
public class VisitorDataScopeProviderImpl implements DataScopeProvider { | |||
@Override | |||
public Optional<DataScopeDTO> findDataFieldProperty() { | |||
UserFullInfoDTO userFullInfo = userInfoHelper.getUserFullInfo(LoginUserUtil.getUserId()); | |||
DataScopeDTO ds = new DataScopeDTO(); | |||
ds.setEmployeeCode(userFullInfo.getEmployeeCode()); | |||
ds.setRole(RoleEnum.SUPER_ADMIN); | |||
return Optional.ofNullable(ds); | |||
return Optional.of(ds); | |||
} | |||
@Override | |||
public Optional<DataScopeDTO> findDataFieldProperty(Long userId) { | |||
UserFullInfoDTO userFullInfo = userInfoHelper.getUserFullInfo(userId); | |||
DataScopeDTO ds = new DataScopeDTO(); | |||
ds.setEmployeeCode(userFullInfo.getEmployeeCode()); | |||
ds.setRole(RoleEnum.SUPER_ADMIN); | |||
return Optional.ofNullable(ds); | |||
return Optional.of(ds); | |||
} | |||
} |
@@ -5,17 +5,16 @@ import com.alibaba.fastjson.JSON; | |||
import com.baomidou.mybatisplus.core.toolkit.StringUtils; | |||
import com.baomidou.mybatisplus.core.toolkit.Wrappers; | |||
import com.google.common.collect.Lists; | |||
import com.ningdatech.basic.function.VUtils; | |||
import com.ningdatech.basic.model.GenericResult; | |||
import com.hz.pm.api.common.model.constant.BizConst; | |||
import com.hz.pm.api.ding.constants.DingOrganizationContant; | |||
import com.hz.pm.api.organization.model.entity.DingEmployeeInfo; | |||
import com.hz.pm.api.organization.model.entity.DingOrganization; | |||
import com.hz.pm.api.organization.service.IDingEmployeeInfoService; | |||
import com.hz.pm.api.organization.service.IDingOrganizationService; | |||
import com.hz.pm.api.user.model.enumeration.UserAvailableEnum; | |||
import com.hz.pm.api.user.model.entity.UserInfo; | |||
import com.hz.pm.api.user.service.IUserInfoService; | |||
import com.ningdatech.basic.function.VUtils; | |||
import com.ningdatech.basic.model.GenericResult; | |||
import com.ningdatech.zwdd.ZwddIntegrationProperties; | |||
import com.ningdatech.zwdd.client.ZwddAuthClient; | |||
import com.ningdatech.zwdd.client.ZwddClient; | |||
@@ -25,9 +24,9 @@ import com.ningdatech.zwdd.model.dto.EmployeeInfoDTO; | |||
import com.ningdatech.zwdd.model.query.PageOrganizationEmployeePositionsQuery; | |||
import com.ningdatech.zwdd.model.response.OrganizationEmployeePosition; | |||
import com.ningdatech.zwdd.model.response.OrganizationEmployeePosition.GovEmployeePosition; | |||
import lombok.RequiredArgsConstructor; | |||
import lombok.extern.slf4j.Slf4j; | |||
import org.springframework.beans.BeanUtils; | |||
import org.springframework.beans.factory.annotation.Autowired; | |||
import org.springframework.stereotype.Component; | |||
import org.springframework.transaction.annotation.Transactional; | |||
@@ -40,49 +39,42 @@ import java.util.stream.Collectors; | |||
* @date 2023/2/10 上午9:52 | |||
*/ | |||
@Component | |||
@Slf4j | |||
@Component | |||
@RequiredArgsConstructor | |||
public class EmployeeBatchGetTask { | |||
private final static Integer PAGE_SIZE = 20; | |||
private static final int PAGE_SIZE = 20; | |||
private static final int GROUP_SIZE = 100; | |||
private static final long MAX_SIZE = 10000; | |||
private final static Integer GROUP_SIZE = 100; | |||
//================================================================================================================== | |||
private final static Integer MAX_SIZE = 10000; | |||
private final ZwddClient zwddClient; | |||
private final ZwddAuthClient zwddAuthClient; | |||
private final IDingOrganizationService dingOrganizationService; | |||
private final IDingEmployeeInfoService dingEmployeeInfoService; | |||
private final ZwddIntegrationProperties zwddIntegrationProperties; | |||
private final IUserInfoService userInfoService; | |||
@Autowired | |||
private ZwddClient zwddClient; | |||
@Autowired | |||
private ZwddAuthClient zwddAuthClient; | |||
@Autowired | |||
private IDingOrganizationService iDingOrganizationService; | |||
@Autowired | |||
private IDingEmployeeInfoService iDingEmployeeInfoService; | |||
@Autowired | |||
private ZwddIntegrationProperties zwddIntegrationProperties; | |||
@Autowired | |||
private IUserInfoService iUserInfoService; | |||
//================================================================================================================== | |||
@Transactional(rollbackFor = Exception.class) | |||
// @Scheduled(cron = "0 0 1 * * ?") | |||
public void batchGetEmployeeTask() { | |||
// 获取所有的组织列表用户获取组织下的 用户信息(暂时 只查 单位的类型) | |||
List<DingOrganization> dingOrganizationList = iDingOrganizationService.list(Wrappers.lambdaQuery(DingOrganization.class) | |||
.eq(DingOrganization::getTypeCode, DingOrganizationContant.UNIT_TYPE)); | |||
// 获取所有的组织列表用户获取组织下的 用户信息(暂时只查单位的类型) | |||
List<DingOrganization> dingOrganizationList = dingOrganizationService.list( | |||
Wrappers.lambdaQuery(DingOrganization.class) | |||
.eq(DingOrganization::getTypeCode, DingOrganizationContant.UNIT_TYPE)); | |||
log.info("所有待更新员工的单位数:{}", dingOrganizationList.size()); | |||
if (CollUtil.isNotEmpty(dingOrganizationList)) { | |||
//记录任务 单位数 | |||
Integer index = 0; | |||
for (DingOrganization dingOrganization : dingOrganizationList) { | |||
log.info("当前单位:{},下标数,{}", dingOrganization.getOrganizationName(), index); | |||
for (DingOrganization dingOrg : dingOrganizationList) { | |||
log.info("当前单位:{},下标数,{}", dingOrg.getOrganizationName(), index); | |||
index++; | |||
List<OrganizationEmployeePosition> allOrganizationEmployeePositionList = new ArrayList<>(); | |||
String organizationCode = dingOrganization.getOrganizationCode(); | |||
String organizationCode = dingOrg.getOrganizationCode(); | |||
PageOrganizationEmployeePositionsQuery query = new PageOrganizationEmployeePositionsQuery(); | |||
query.setEmployeeStatus("A"); | |||
query.setOrganizationCode(organizationCode); | |||
@@ -104,13 +96,13 @@ public class EmployeeBatchGetTask { | |||
} | |||
Long totalSize = data.getTotalSize(); | |||
log.info("dingOrganization :{}", JSON.toJSONString(dingOrganization)); | |||
log.info("dingOrg :{}", JSON.toJSONString(dingOrg)); | |||
log.info("totalSize :{},{}", totalSize, dingOrganization.getOrganizationName()); | |||
log.info("totalSize :{},{}", totalSize, dingOrg.getOrganizationName()); | |||
if (totalSize > PAGE_SIZE) { | |||
if (totalSize > MAX_SIZE) { | |||
//超过1万 按1万的处理 | |||
totalSize = MAX_SIZE.longValue(); | |||
totalSize = MAX_SIZE; | |||
} | |||
int restPageNo = totalSize % PAGE_SIZE > 0 ? 1 : 0; | |||
@@ -118,7 +110,6 @@ public class EmployeeBatchGetTask { | |||
for (pageNo = 2; pageNo <= maxPageNo; pageNo++) { | |||
query.setPageNo(pageNo); | |||
GenericResult<Page<OrganizationEmployeePosition>> pageGenericResult = zwddClient.pageOrganizationEmployeePositions(query); | |||
// log.info("pageGenericResult :{}", JSON.toJSONString(pageGenericResult)); | |||
if (pageGenericResult.isSuccess()) { | |||
allOrganizationEmployeePositionList.addAll(pageGenericResult.getData().getData()); | |||
} else { | |||
@@ -216,57 +207,21 @@ public class EmployeeBatchGetTask { | |||
} | |||
} | |||
List<DingOrganization> organizations = iDingOrganizationService.list(); | |||
List<DingOrganization> organizations = dingOrganizationService.list(); | |||
Map<String, DingOrganization> organizationMap = organizations.stream().collect(Collectors.toMap(DingOrganization::getOrganizationCode, o -> o)); | |||
for (DingEmployeeInfo dingEmployeeInfo : saveList) { | |||
String employeeCode = dingEmployeeInfo.getEmployeeCode(); | |||
DingEmployeeInfo employeeInfo = iDingEmployeeInfoService.getOne(Wrappers.lambdaQuery(DingEmployeeInfo.class) | |||
DingEmployeeInfo employeeInfo = dingEmployeeInfoService.getOne(Wrappers.lambdaQuery(DingEmployeeInfo.class) | |||
.eq(DingEmployeeInfo::getEmployeeCode, employeeCode) | |||
.last(BizConst.LIMIT_1)); | |||
if (Objects.isNull(employeeInfo)) { | |||
iDingEmployeeInfoService.save(dingEmployeeInfo); | |||
dingEmployeeInfoService.save(dingEmployeeInfo); | |||
} else { | |||
dingEmployeeInfo.setId(employeeInfo.getId()); | |||
iDingEmployeeInfoService.saveOrUpdate(dingEmployeeInfo); | |||
dingEmployeeInfoService.saveOrUpdate(dingEmployeeInfo); | |||
} | |||
generateOrUpdateUserInfo(dingEmployeeInfo, organizationMap); | |||
} | |||
} | |||
public void generateOrUpdateUserInfo(DingEmployeeInfo dingEmployeeInfo, Map<String, DingOrganization> organizationMap) { | |||
String employeeCode = dingEmployeeInfo.getEmployeeCode(); | |||
UserInfo userInfo = iUserInfoService.getOne(Wrappers.lambdaQuery(UserInfo.class) | |||
.eq(UserInfo::getEmployeeCode, employeeCode)); | |||
if (Objects.isNull(userInfo)) { | |||
userInfo = new UserInfo(); | |||
userInfo.setAccountId(dingEmployeeInfo.getAccountId()); | |||
userInfo.setUsername(dingEmployeeInfo.getEmployeeName()); | |||
userInfo.setRealName(dingEmployeeInfo.getEmployeeName()); | |||
userInfo.setEmployeeCode(dingEmployeeInfo.getEmployeeCode()); | |||
userInfo.setAvailable(UserAvailableEnum.DISABLE.name()); | |||
userInfo.setCreateBy(-1L); | |||
userInfo.setUpdateBy(-1L); | |||
userInfo.setCreateOn(LocalDateTime.now()); | |||
userInfo.setUpdateOn(LocalDateTime.now()); | |||
userInfo.setEmpPosUnitCode(dingEmployeeInfo.getEmpPosUnitCode()); | |||
userInfo.setAvatar(dingEmployeeInfo.getAvatar()); | |||
if (StringUtils.isNotBlank(userInfo.getEmpPosUnitCode()) && organizationMap.containsKey(userInfo.getEmpPosUnitCode())) { | |||
DingOrganization dingOrganization = organizationMap.get(userInfo.getEmpPosUnitCode()); | |||
userInfo.setEmpPosUnitName(dingOrganization.getOrganizationName()); | |||
userInfo.setRegionCode(dingOrganization.getDivisionCode()); | |||
} | |||
iUserInfoService.save(userInfo); | |||
} else { | |||
userInfo.setAvatar(dingEmployeeInfo.getAvatar()); | |||
userInfo.setEmpPosUnitCode(dingEmployeeInfo.getEmpPosUnitCode()); | |||
if (StringUtils.isNotBlank(userInfo.getEmpPosUnitCode()) && organizationMap.containsKey(userInfo.getEmpPosUnitCode())) { | |||
DingOrganization dingOrganization = organizationMap.get(userInfo.getEmpPosUnitCode()); | |||
userInfo.setEmpPosUnitName(dingOrganization.getOrganizationName()); | |||
userInfo.setRegionCode(dingOrganization.getDivisionCode()); | |||
} | |||
iUserInfoService.updateById(userInfo); | |||
} | |||
} | |||
@@ -276,7 +231,7 @@ public class EmployeeBatchGetTask { | |||
* @param regionCode | |||
*/ | |||
public void batchGetEmployeeTaskByRegionCode(String regionCode) { | |||
List<DingOrganization> units = iDingOrganizationService.list(Wrappers.lambdaQuery(DingOrganization.class) | |||
List<DingOrganization> units = dingOrganizationService.list(Wrappers.lambdaQuery(DingOrganization.class) | |||
.eq(DingOrganization::getTypeCode, DingOrganizationContant.UNIT_TYPE) | |||
.eq(DingOrganization::getDivisionCode, regionCode)); | |||
@@ -317,7 +272,7 @@ public class EmployeeBatchGetTask { | |||
if (totalSize > PAGE_SIZE) { | |||
if (totalSize > MAX_SIZE) { | |||
//超过1万 按1万的处理 | |||
totalSize = MAX_SIZE.longValue(); | |||
totalSize = MAX_SIZE; | |||
} | |||
int restPageNo = totalSize % PAGE_SIZE > 0 ? 1 : 0; | |||
@@ -325,7 +280,6 @@ public class EmployeeBatchGetTask { | |||
for (pageNo = 2; pageNo <= maxPageNo; pageNo++) { | |||
query.setPageNo(pageNo); | |||
GenericResult<Page<OrganizationEmployeePosition>> pageGenericResult = zwddClient.pageOrganizationEmployeePositions(query); | |||
// log.info("pageGenericResult :{}", JSON.toJSONString(pageGenericResult)); | |||
if (pageGenericResult.isSuccess()) { | |||
allOrganizationEmployeePositionList.addAll(pageGenericResult.getData().getData()); | |||
} else { | |||
@@ -354,17 +308,16 @@ public class EmployeeBatchGetTask { | |||
} | |||
public void batchGetEmployeeTaskByOrdCode(String orgCode) { | |||
DingOrganization org = iDingOrganizationService.getOne(Wrappers.lambdaQuery(DingOrganization.class) | |||
DingOrganization org = dingOrganizationService.getOne(Wrappers.lambdaQuery(DingOrganization.class) | |||
.eq(DingOrganization::getOrganizationCode, orgCode) | |||
.last(BizConst.LIMIT_1)); | |||
VUtils.isTrue(Objects.isNull(org)).throwMessage("单位不存在"); | |||
log.info("所属单位 {} 要更新员工信息了", org.getOrganizationName()); | |||
List<OrganizationEmployeePosition> allOrganizationEmployeePositionList = new ArrayList<>(); | |||
String organizationCode = orgCode; | |||
PageOrganizationEmployeePositionsQuery query = new PageOrganizationEmployeePositionsQuery(); | |||
query.setEmployeeStatus("A"); | |||
query.setOrganizationCode(organizationCode); | |||
query.setOrganizationCode(orgCode); | |||
query.setReturnTotalSize(true); | |||
query.setTenantId(zwddIntegrationProperties.getTenantId()); | |||
int pageNo = 1; | |||
@@ -375,7 +328,7 @@ public class EmployeeBatchGetTask { | |||
GenericResult<Page<OrganizationEmployeePosition>> firstPageGenericResult = zwddClient.pageOrganizationEmployeePositions(query); | |||
Page<OrganizationEmployeePosition> data = firstPageGenericResult.getData(); | |||
if (Objects.isNull(data)) { | |||
log.info("响应为空:{}", organizationCode); | |||
log.info("响应为空:{}", orgCode); | |||
return; | |||
} | |||
if (CollUtil.isNotEmpty(data.getData())) { | |||
@@ -389,7 +342,7 @@ public class EmployeeBatchGetTask { | |||
if (totalSize > PAGE_SIZE) { | |||
if (totalSize > MAX_SIZE) { | |||
//超过1万 按1万的处理 | |||
totalSize = MAX_SIZE.longValue(); | |||
totalSize = MAX_SIZE; | |||
} | |||
int restPageNo = totalSize % PAGE_SIZE > 0 ? 1 : 0; | |||
@@ -444,22 +397,22 @@ public class EmployeeBatchGetTask { | |||
return; | |||
} | |||
DingEmployeeInfo emp = iDingEmployeeInfoService.getOne(Wrappers.lambdaQuery(DingEmployeeInfo.class) | |||
DingEmployeeInfo emp = dingEmployeeInfoService.getOne(Wrappers.lambdaQuery(DingEmployeeInfo.class) | |||
.eq(DingEmployeeInfo::getEmployeeCode, empCode) | |||
.last(BizConst.LIMIT_1)); | |||
if (Objects.nonNull(emp)) { | |||
emp.setAvatar(data.getGovEmpAvatar()); | |||
iDingEmployeeInfoService.updateById(emp); | |||
dingEmployeeInfoService.updateById(emp); | |||
} | |||
UserInfo user = iUserInfoService.getOne(Wrappers.lambdaQuery(UserInfo.class) | |||
UserInfo user = userInfoService.getOne(Wrappers.lambdaQuery(UserInfo.class) | |||
.eq(UserInfo::getEmployeeCode, empCode) | |||
.last(BizConst.LIMIT_1)); | |||
if (Objects.nonNull(user)) { | |||
user.setAvatar(data.getGovEmpAvatar()); | |||
iUserInfoService.updateById(user); | |||
userInfoService.updateById(user); | |||
} | |||
} | |||
@@ -470,7 +423,7 @@ public class EmployeeBatchGetTask { | |||
*/ | |||
public void getBatchEmployeeByCode(String orgCode) { | |||
List<DingEmployeeInfo> employees = iDingEmployeeInfoService.list(Wrappers.lambdaQuery(DingEmployeeInfo.class) | |||
List<DingEmployeeInfo> employees = dingEmployeeInfoService.list(Wrappers.lambdaQuery(DingEmployeeInfo.class) | |||
.eq(DingEmployeeInfo::getEmpPosUnitCode, orgCode)); | |||
for (DingEmployeeInfo employee : employees) { | |||
@@ -78,7 +78,7 @@ public class SensitiveModifySegment { | |||
return false; | |||
} | |||
for (SensitiveModifySegment segment : segmentList) { | |||
if (!segment.isValueEquals()) { | |||
if (Boolean.FALSE.equals(segment.isValueEquals())) { | |||
return true; | |||
} | |||
} | |||
@@ -56,7 +56,7 @@ public class SmsServiceClient { | |||
* @return | |||
*/ | |||
public SmsDto<SmsSendResponse> smsSend(String content, List<String> phones) { | |||
String phonesSplit = String.join(",", phones);; | |||
String phonesSplit = String.join(",", phones); | |||
String refreshUrl = smsUrl + SMS_SEND; | |||
Map<String,Object> map = new HashMap<>(); | |||
map.put("content",content); | |||
@@ -54,11 +54,8 @@ public class TodoServiceClient { | |||
map.put("wkType",addSingleWkHandleDTO.getWkType()); | |||
map.put("wkUser",addSingleWkHandleDTO.getWkUser()); | |||
String responseResult = HttpUtil.post(url, JSON.toJSONString(map)); | |||
TodoDto todoDto = JSON.parseObject(responseResult, new TypeReference<TodoDto>() { | |||
return JSON.parseObject(responseResult, new TypeReference<TodoDto>() { | |||
}); | |||
// return JSON.parseObject(responseResult, new TypeReference<HashMap<String, String>>() { | |||
// }).get("data"); | |||
return todoDto; | |||
} | |||
/** | |||
@@ -74,9 +71,8 @@ public class TodoServiceClient { | |||
.form("wkhandleId",wkhandleId); | |||
HttpResponse response = request.execute(); | |||
String responseBody = response.body(); | |||
TodoDto todoDto = JSON.parseObject(responseBody, new TypeReference<TodoDto>() { | |||
return JSON.parseObject(responseBody, new TypeReference<TodoDto>() { | |||
}); | |||
return todoDto; | |||
} | |||
@@ -13,9 +13,7 @@ import java.io.Serializable; | |||
@Data | |||
@AllArgsConstructor | |||
@NoArgsConstructor | |||
public class AddSingleWkHandleDTO implements Serializable { | |||
private static final long serialVersionUID = -2067546352159912820L; | |||
public class AddSingleWkHandleDTO { | |||
// 待办参数,ObjectJson字符串 | |||
private Object params; | |||
@@ -5,9 +5,13 @@ import cn.hutool.core.collection.CollUtil; | |||
import com.alibaba.fastjson.JSON; | |||
import com.alibaba.fastjson.JSONArray; | |||
import com.alibaba.fastjson.JSONObject; | |||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | |||
import com.baomidou.mybatisplus.core.toolkit.Wrappers; | |||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; | |||
import com.google.common.collect.Lists; | |||
import com.hz.pm.api.common.util.StrUtils; | |||
import com.hz.pm.api.user.helper.MhUnitCache; | |||
import com.hz.pm.api.user.model.dto.MhUnitDTO; | |||
import com.ningdatech.basic.exception.BizException; | |||
import com.ningdatech.basic.function.VUtils; | |||
import com.ningdatech.basic.model.PageVo; | |||
@@ -106,7 +110,6 @@ public class ProjectFileManage { | |||
private final IProjectInstService projectInstService; | |||
private final HistoryService historyService; | |||
private final INdProjectApplyBorrowService projectApplyBorrowService; | |||
private final IDingOrganizationService dingOrganizationService; | |||
private final IProjectApplicationService projectApplicationService; | |||
private final TaskService taskService; | |||
private final IPurchaseService purchaseService; | |||
@@ -116,69 +119,70 @@ public class ProjectFileManage { | |||
private final PurchaseManage purchaseManage; | |||
private final ConstructionManage constructionManage; | |||
private final FinalAcceptanceManage finalAcceptanceManage; | |||
private final MhUnitCache mhUnitCache; | |||
public PageVo<ProjectFileListVO> list(ProjectFileListParam param) { | |||
UserFullInfoDTO userFullInfo = userInfoHelper.getUserFullInfo(LoginUserUtil.getUserId()); | |||
String employeeCode = userFullInfo.getEmployeeCode(); | |||
String empPosUnitCode = userFullInfo.getEmpPosUnitCode(); | |||
public PageVo<ProjectFileListVO> list(ProjectFileListParam req) { | |||
UserFullInfoDTO user = userInfoHelper.getUserFullInfo(LoginUserUtil.getUserId()); | |||
Page<Project> page = param.page(); | |||
projectService.page(page, Wrappers.lambdaQuery(Project.class) | |||
.like(StringUtils.isNotBlank(param.getProjectName()), Project::getProjectName, param.getProjectName()) | |||
.like(StringUtils.isNotBlank(param.getBuildOrgName()), Project::getBuildOrgName, param.getBuildOrgName()) | |||
LambdaQueryWrapper<Project> query = Wrappers.lambdaQuery(Project.class) | |||
.like(StrUtils.isNotBlank(req.getProjectName()), Project::getProjectName, req.getProjectName()) | |||
.like(StrUtils.isNotBlank(req.getBuildOrgName()), Project::getBuildOrgName, req.getBuildOrgName()) | |||
.eq(Project::getStatus, ProjectStatusEnum.ACCEPTED.getCode()) | |||
.orderByDesc(Project::getUpdateOn)); | |||
.orderByDesc(Project::getUpdateOn); | |||
Page<Project> page = projectService.page(req.page(), query); | |||
if (CollUtil.isEmpty(page.getRecords())) { | |||
return PageVo.empty(); | |||
} | |||
// 获取本单位及下属单位的单位code | |||
Set<String> subOrgSet = getSubOrgList(empPosUnitCode); | |||
List<Long> subOrgSet = getSubOrgList(user.getMhUnitId()); | |||
List<ProjectFileListVO> vos = page.getRecords().stream().map(p -> { | |||
ProjectFileListVO vo = new ProjectFileListVO(); | |||
vo.setId(p.getId()); | |||
// 用户只可查阅自己及下属单位的项目档案和已经申请借阅通过的项目档案 | |||
if (subOrgSet.contains(p.getBuildOrgCode()) || checkCanRead(subOrgSet, p)) { | |||
if (StrUtils.isBlank(p.getBuildOrgCode()) | |||
|| subOrgSet.contains(Long.parseLong(p.getBuildOrgCode())) | |||
|| checkCanRead(subOrgSet, p)) { | |||
vo.setCanRead(Boolean.TRUE); | |||
} | |||
vo.setBuildOrgName(p.getBuildOrgName()); | |||
vo.setPojectCode(p.getProjectCode()); | |||
vo.setProjectName(p.getProjectName()); | |||
// 判断当前项目,当前登录用户是否已经开启了申请借阅并且没有审批完成 | |||
ProjectApplyBorrow projectApplyBorrow = projectApplyBorrowService.getOne(Wrappers.lambdaQuery(ProjectApplyBorrow.class) | |||
.eq(ProjectApplyBorrow::getApplyBorrowEmployeeCode, employeeCode) | |||
ProjectApplyBorrow projectApplyBorrow = projectApplyBorrowService.getOne(Wrappers | |||
.lambdaQuery(ProjectApplyBorrow.class) | |||
.eq(ProjectApplyBorrow::getApplyBorrowUserId, user.getUserId()) | |||
.eq(ProjectApplyBorrow::getProjectId, p.getId()) | |||
.orderByDesc(ProjectApplyBorrow::getCreateOn) | |||
.last("limit 1")); | |||
if (Objects.nonNull(projectApplyBorrow)) { | |||
String instCode = projectApplyBorrow.getInstanceId(); | |||
// 获取流程实例 | |||
HistoricProcessInstance newInstance = | |||
historyService.createHistoricProcessInstanceQuery().processInstanceId(instCode).singleResult(); | |||
HistoricProcessInstance newInstance = historyService.createHistoricProcessInstanceQuery() | |||
.processInstanceId(instCode) | |||
.singleResult(); | |||
if (newInstance == null) { | |||
vo.setCanApplyBorrow(Boolean.FALSE); | |||
return vo; | |||
} | |||
ProjectInst projectInst = projectInstService | |||
.getOne(Wrappers.lambdaQuery(ProjectInst.class).eq(ProjectInst::getInstCode, instCode)); | |||
ProjectInst projectInst = projectInstService.getOne(Wrappers.lambdaQuery(ProjectInst.class) | |||
.eq(ProjectInst::getInstCode, instCode)); | |||
// 推送省局联审的项目流程实例为EMPTY | |||
if (Objects.nonNull(projectInst)) { | |||
Integer instType = projectInst.getInstType(); | |||
// 从申请借阅信息表中查询当前项目是否有当前登录用户发起的申请借阅审批流程 | |||
ProjectApplyBorrow applyBorrow = projectApplyBorrowService.getOne(Wrappers | |||
.lambdaQuery(ProjectApplyBorrow.class).eq(ProjectApplyBorrow::getApplyBorrowEmployeeCode, employeeCode) | |||
.eq(ProjectApplyBorrow::getProjectId, p.getId()).eq(ProjectApplyBorrow::getInstanceId, instCode)); | |||
.lambdaQuery(ProjectApplyBorrow.class) | |||
.eq(ProjectApplyBorrow::getApplyBorrowUserId, user.getUserId()) | |||
.eq(ProjectApplyBorrow::getProjectId, p.getId()) | |||
.eq(ProjectApplyBorrow::getInstanceId, instCode)); | |||
// 延期申请流程还未审核结束 | |||
if (Objects.nonNull(applyBorrow) && InstTypeEnum.APPLY_BORROW.getCode().equals(instType) | |||
&& Objects.isNull(newInstance.getEndActivityId())) { | |||
vo.setCanApplyBorrow(Boolean.FALSE); | |||
} | |||
// 如果是延期申请审核被驳回,设置项目可以申请延期申报 | |||
else if (InstTypeEnum.APPLY_BORROW.getCode().equals(instType) && | |||
} else if (InstTypeEnum.APPLY_BORROW.getCode().equals(instType) && | |||
HisProInsEndActId.REJECT.equals(newInstance.getEndActivityId())) { | |||
// 如果是延期申请审核被驳回,设置项目可以申请延期申报 | |||
vo.setCanApplyBorrow(Boolean.TRUE); | |||
} | |||
} | |||
@@ -189,39 +193,30 @@ public class ProjectFileManage { | |||
return PageVo.of(vos, page.getTotal()); | |||
} | |||
private boolean checkCanRead(Set<String> subOrgSet, Project project) { | |||
private boolean checkCanRead(List<Long> subOrgSet, Project project) { | |||
// 从申请借阅信息表中查出本单位及下属单位审批通过的项目 | |||
HashSet<Long> borrowProjectIdSet = new HashSet<>(); | |||
List<Long> applyBorrowProjectIdList = projectApplyBorrowService | |||
.list(Wrappers.lambdaQuery(ProjectApplyBorrow.class) | |||
.in(ProjectApplyBorrow::getApplyBorrowEmpPosUnitCode, subOrgSet) | |||
.in(ProjectApplyBorrow::getApplyBorrowOrgCode, subOrgSet) | |||
.eq(ProjectApplyBorrow::getIsSuccess, Boolean.TRUE)) | |||
.stream().map(ProjectApplyBorrow::getProjectId).filter(borrowProjectIdSet::add).collect(Collectors.toList()); | |||
.stream().map(ProjectApplyBorrow::getProjectId) | |||
.filter(borrowProjectIdSet::add) | |||
.collect(Collectors.toList()); | |||
return applyBorrowProjectIdList.contains(project.getId()); | |||
} | |||
private Set<String> getSubOrgList(String empPosUnitCode) { | |||
HashSet<String> orgSet = new HashSet<>(); | |||
// 先将自己加入子集 | |||
orgSet.add(empPosUnitCode); | |||
Set<String> subOrgList = dingOrganizationService | |||
.list(Wrappers.lambdaQuery(DingOrganization.class).eq(DingOrganization::getParentCode, empPosUnitCode)) | |||
.stream().map(DingOrganization::getOrganizationCode).collect(Collectors.toSet()); | |||
// 遍历子集 | |||
for (String orgCode : subOrgList) { | |||
orgSet.addAll(getSubOrgList(orgCode)); | |||
} | |||
return orgSet; | |||
private List<Long> getSubOrgList(Long mhUnitId) { | |||
List<Long> childIds = mhUnitCache.getChildrenIdsRecursion(mhUnitId); | |||
childIds.add(mhUnitId); | |||
return childIds; | |||
} | |||
public ProjectFileVO file(Long projectId) { | |||
UserFullInfoDTO userFullInfo = userInfoHelper.getUserFullInfo(LoginUserUtil.getUserId()); | |||
String empPosUnitCode = userFullInfo.getEmpPosUnitCode(); | |||
UserFullInfoDTO user = userInfoHelper.getUserFullInfo(LoginUserUtil.getUserId()); | |||
// 判断该项目是否为本单位或下属单位的项目或者已经申请借阅成功的项目 | |||
Project project = projectService.getById(projectId); | |||
Set<String> subOrgList = getSubOrgList(empPosUnitCode); | |||
List<Long> subOrgList = getSubOrgList(user.getMhUnitId()); | |||
if (!checkCanRead(subOrgList, project)) { | |||
throw new BizException("您没有权限查看此项目档案!"); | |||
@@ -253,28 +248,22 @@ public class ProjectFileManage { | |||
public String startApplyBorrowProcess(Long projectId) { | |||
UserFullInfoDTO user = userInfoHelper.getUserFullInfo(LoginUserUtil.getUserId()); | |||
String employeeCode = user.getEmployeeCode(); | |||
VUtils.isTrue(StringUtils.isBlank(employeeCode)).throwMessage("获取登录用户 员工号 失败!"); | |||
Project project = projectService.getNewProject(projectId); | |||
VUtils.isTrue(Objects.isNull(project)).throwMessage("提交失败 此项目不存在!"); | |||
// 首先要判断 项目当前状态 是不是 已归档 | |||
VUtils.isTrue(!ProjectStatusEnum.ACCEPTED.getCode().equals(project.getStatus())).throwMessage("提交失败 该项目不是 已归档"); | |||
String regionCode = user.getRegionCode(); | |||
WflowModels model = processModelService.getOne(Wrappers.lambdaQuery(WflowModels.class) | |||
.eq(WflowModels::getRegionCode, regionCode) | |||
.eq(WflowModels::getProcessType, ProjectProcessStageEnum.APPLY_BORROW.getCode()).last(BizConst.LIMIT_1)); | |||
.eq(WflowModels::getProcessType, ProjectProcessStageEnum.APPLY_BORROW.getCode()) | |||
.last(BizConst.LIMIT_1)); | |||
if (Objects.isNull(model)) { | |||
log.error("此 【{}】区域找不到申请借阅流程配置", regionCode); | |||
throw new BusinessException(String.format("此 【%s】区域找不到申请借阅流程配置", regionCode)); | |||
throw new BusinessException("找不到申请借阅流程配置"); | |||
} | |||
ProcessStartParamsVo params = new ProcessStartParamsVo(); | |||
params.setUser(defaultDeclaredProjectManage.buildUser(employeeCode)); | |||
params.setUser(defaultDeclaredProjectManage.buildUser(user.getUserId())); | |||
params.setProcessUsers(Collections.emptyMap()); | |||
// 放入条件判断的项目字段 | |||
// 把条件值给放入工作流 | |||
@@ -544,19 +533,15 @@ public class ProjectFileManage { | |||
} | |||
ProjectApplyBorrowVO vo = BeanUtil.copyProperties(apply, ProjectApplyBorrowVO.class); | |||
if (StringUtils.isNotBlank(vo.getApplyBorrowEmployeeCode())) { | |||
UserFullInfoDTO user = userInfoHelper.getUserFullInfoByEmployeeCode(vo.getApplyBorrowEmployeeCode()); | |||
if (StrUtils.isNotBlank(vo.getApplyBorrowUserId())) { | |||
UserFullInfoDTO user = userInfoHelper.getUserFullInfo(Long.valueOf(vo.getApplyBorrowUserId())); | |||
if (Objects.nonNull(user)) { | |||
vo.setApplyBorrowEmployeeName(user.getUsername()); | |||
vo.setApplyBorrowUserName(user.getUsername()); | |||
} | |||
} | |||
if (StringUtils.isNotBlank(vo.getApplyBorrowEmpPosUnitCode())) { | |||
DingOrganization organization = dingOrganizationService.getOne(Wrappers.lambdaQuery(DingOrganization.class) | |||
.eq(DingOrganization::getOrganizationCode, vo.getApplyBorrowEmpPosUnitCode()) | |||
.last(BizConst.LIMIT_1)); | |||
if (Objects.nonNull(organization)) { | |||
vo.setApplyBorrowEmpPosUnitName(organization.getOrganizationName()); | |||
} | |||
if (StrUtils.isNotBlank(vo.getApplyBorrowOrgCode())) { | |||
MhUnitDTO mhUnit = mhUnitCache.getById(Long.parseLong(vo.getApplyBorrowOrgCode())); | |||
vo.setApplyBorrowOrgName(mhUnit.getName()); | |||
} | |||
if (Objects.nonNull(vo.getProjectId())) { | |||
Project project = projectService.getById(vo.getProjectId()); | |||
@@ -32,10 +32,10 @@ public class ProjectApplyBorrow implements Serializable { | |||
private Long projectId; | |||
@ApiModelProperty("申请借阅员工code") | |||
private String applyBorrowEmployeeCode; | |||
private String applyBorrowUserId; | |||
@ApiModelProperty("申请借阅用户任职单位code") | |||
private String applyBorrowEmpPosUnitCode; | |||
private String applyBorrowOrgCode; | |||
@ApiModelProperty("申请借阅审批流程ID") | |||
private String instanceId; | |||
@@ -31,16 +31,16 @@ public class ProjectApplyBorrowVO implements Serializable { | |||
private String projectName; | |||
@ApiModelProperty("申请借阅员工code") | |||
private String applyBorrowEmployeeCode; | |||
private String applyBorrowUserId; | |||
@ApiModelProperty("申请借阅员工名字") | |||
private String applyBorrowEmployeeName; | |||
private String applyBorrowUserName; | |||
@ApiModelProperty("申请借阅用户任职单位code") | |||
private String applyBorrowEmpPosUnitCode; | |||
private String applyBorrowOrgCode; | |||
@ApiModelProperty("申请借阅用户任职单位") | |||
private String applyBorrowEmpPosUnitName; | |||
private String applyBorrowOrgName; | |||
@ApiModelProperty("申请借阅审批流程ID") | |||
private String instanceId; | |||
@@ -3,9 +3,9 @@ package com.hz.pm.api.fiscal.controller; | |||
import com.ningdatech.log.annotation.WebLog; | |||
import com.hz.pm.api.fiscal.manage.CompanyFiscalCodeManage; | |||
import com.hz.pm.api.fiscal.model.po.ReqCompanyFiscalCodeAndSealSnPO; | |||
import com.hz.pm.api.fiscal.model.po.CompanyFiscalCodeAndSealSnReq; | |||
import com.hz.pm.api.fiscal.model.po.ReqGetCompanyFiscalCodeAndSealSnPO; | |||
import com.hz.pm.api.fiscal.model.vo.ResCompanyFiscalCodeAndSealSnVO; | |||
import com.hz.pm.api.fiscal.model.vo.CompanyFiscalCodeAndSealSnVO; | |||
import io.swagger.annotations.Api; | |||
import io.swagger.annotations.ApiOperation; | |||
import lombok.RequiredArgsConstructor; | |||
@@ -35,13 +35,13 @@ public class CompanyFiscalCodeController { | |||
@ApiOperation(value = "财政编码-配置", notes = "财政编码配置") | |||
@PostMapping("/fiscal-and-seal/configure") | |||
@WebLog("财政编码-配置") | |||
public void fiscalAndSealCodeConfigure(@Valid @RequestBody ReqCompanyFiscalCodeAndSealSnPO reqCompanyFiscalCodeAndSealSnPO) { | |||
companyFiscalCodeManage.fiscalCodeConfigure(reqCompanyFiscalCodeAndSealSnPO); | |||
public void fiscalAndSealCodeConfigure(@Valid @RequestBody CompanyFiscalCodeAndSealSnReq companyFiscalCodeAndSealSnReq) { | |||
companyFiscalCodeManage.fiscalCodeConfigure(companyFiscalCodeAndSealSnReq); | |||
} | |||
@ApiOperation(value = "获取财政编码-配置", notes = "获取财政编码配置") | |||
@PostMapping("/fiscal-and-seal/get-configure") | |||
public ResCompanyFiscalCodeAndSealSnVO getFiscalAndSealCodeConfigure(@Valid @RequestBody ReqGetCompanyFiscalCodeAndSealSnPO request) { | |||
public CompanyFiscalCodeAndSealSnVO getFiscalAndSealCodeConfigure(@Valid @RequestBody ReqGetCompanyFiscalCodeAndSealSnPO request) { | |||
return companyFiscalCodeManage.getFiscalCodeConfigure(request); | |||
} | |||
@@ -1,16 +1,17 @@ | |||
package com.hz.pm.api.fiscal.manage; | |||
import com.hz.pm.api.common.helper.UserInfoHelper; | |||
import com.hz.pm.api.common.util.StrUtils; | |||
import com.hz.pm.api.fiscal.entity.CompanyFiscalCode; | |||
import com.hz.pm.api.fiscal.model.po.ReqCompanyFiscalCodeAndSealSnPO; | |||
import com.hz.pm.api.fiscal.model.po.CompanyFiscalCodeAndSealSnReq; | |||
import com.hz.pm.api.fiscal.model.po.ReqGetCompanyFiscalCodeAndSealSnPO; | |||
import com.hz.pm.api.fiscal.model.vo.ResCompanyFiscalCodeAndSealSnVO; | |||
import com.hz.pm.api.fiscal.model.vo.CompanyFiscalCodeAndSealSnVO; | |||
import com.hz.pm.api.fiscal.service.ICompanyFiscalCodeService; | |||
import com.hz.pm.api.signature.entity.CompanySignature; | |||
import com.hz.pm.api.signature.service.ICompanySignatureService; | |||
import com.hz.pm.api.user.security.model.UserInfoDetails; | |||
import com.hz.pm.api.user.util.LoginUserUtil; | |||
import lombok.RequiredArgsConstructor; | |||
import org.apache.commons.lang3.StringUtils; | |||
import org.springframework.stereotype.Component; | |||
import java.time.LocalDateTime; | |||
@@ -30,58 +31,59 @@ public class CompanyFiscalCodeManage { | |||
private final ICompanySignatureService iCompanySignatureService; | |||
public void fiscalCodeConfigure(ReqCompanyFiscalCodeAndSealSnPO reqCompanyFiscalCodeAndSealSnPO) { | |||
Long userId = LoginUserUtil.getUserId(); | |||
String organizationCode = reqCompanyFiscalCodeAndSealSnPO.getOrganizationCode(); | |||
if (StringUtils.isBlank(organizationCode)) { | |||
organizationCode = userInfoHelper.getUserEmpPosUnitCode(userId); | |||
public void fiscalCodeConfigure(CompanyFiscalCodeAndSealSnReq req) { | |||
UserInfoDetails userDetail = LoginUserUtil.loginUserDetail(); | |||
String temOrgCode; | |||
if (StrUtils.isBlank(req.getOrganizationCode())) { | |||
temOrgCode = String.valueOf(userDetail.getMhUnitId()); | |||
} else { | |||
temOrgCode = req.getOrganizationCode(); | |||
} | |||
// TODO 校验用户权限 | |||
// 保存财政编码配置 | |||
CompanyFiscalCode companyFiscalCode = iCompanyFiscalCodeService.getByOrganizationCode(organizationCode); | |||
CompanyFiscalCode companyFiscalCode = iCompanyFiscalCodeService.getByOrganizationCode(temOrgCode); | |||
if (Objects.isNull(companyFiscalCode)) { | |||
companyFiscalCode = new CompanyFiscalCode(); | |||
companyFiscalCode.setOrganizationCode(organizationCode); | |||
companyFiscalCode.setOrganizationCode(temOrgCode); | |||
companyFiscalCode.setCreateOn(LocalDateTime.now()); | |||
companyFiscalCode.setCreateBy(userId); | |||
companyFiscalCode.setCreateBy(userDetail.getUserId()); | |||
} | |||
String fiscalCode = reqCompanyFiscalCodeAndSealSnPO.getFiscalCode(); | |||
String fiscalCode = req.getFiscalCode(); | |||
companyFiscalCode.setFiscalCode(fiscalCode); | |||
companyFiscalCode.setUpdateOn(LocalDateTime.now()); | |||
companyFiscalCode.setUpdateBy(userId); | |||
companyFiscalCode.setUpdateBy(userDetail.getUserId()); | |||
iCompanyFiscalCodeService.saveOrUpdate(companyFiscalCode); | |||
// 保存印章配置 | |||
CompanySignature companySignature = iCompanySignatureService.getByOrganizationCode(organizationCode); | |||
if (Objects.isNull(companySignature)) { | |||
companySignature = new CompanySignature(); | |||
companySignature.setOrganizationCode(organizationCode); | |||
companySignature.setCreateOn(LocalDateTime.now()); | |||
CompanySignature signature = iCompanySignatureService.getByOrganizationCode(temOrgCode); | |||
if (Objects.isNull(signature)) { | |||
signature = new CompanySignature(); | |||
signature.setOrganizationCode(temOrgCode); | |||
signature.setCreateOn(LocalDateTime.now()); | |||
} | |||
String sealSn = reqCompanyFiscalCodeAndSealSnPO.getSealSn(); | |||
companySignature.setSealSn(sealSn); | |||
companySignature.setUpdateOn(LocalDateTime.now()); | |||
companySignature.setCreateBy(userId); | |||
companySignature.setUpdateBy(userId); | |||
iCompanySignatureService.saveOrUpdate(companySignature); | |||
String sealSn = req.getSealSn(); | |||
signature.setSealSn(sealSn); | |||
signature.setUpdateOn(LocalDateTime.now()); | |||
signature.setCreateBy(userDetail.getUserId()); | |||
signature.setUpdateBy(userDetail.getUserId()); | |||
iCompanySignatureService.saveOrUpdate(signature); | |||
} | |||
public ResCompanyFiscalCodeAndSealSnVO getFiscalCodeConfigure(ReqGetCompanyFiscalCodeAndSealSnPO request) { | |||
Long userId = LoginUserUtil.getUserId(); | |||
String organizationCode = request.getOrganizationCode(); | |||
if (StringUtils.isBlank(organizationCode)) { | |||
organizationCode = userInfoHelper.getUserEmpPosUnitCode(userId); | |||
public CompanyFiscalCodeAndSealSnVO getFiscalCodeConfigure(ReqGetCompanyFiscalCodeAndSealSnPO request) { | |||
UserInfoDetails userDetail = LoginUserUtil.loginUserDetail(); | |||
String temOrgCode; | |||
if (StrUtils.isBlank(request.getOrganizationCode())) { | |||
temOrgCode = String.valueOf(userDetail.getMhUnitId()); | |||
} else { | |||
temOrgCode = request.getOrganizationCode(); | |||
} | |||
CompanySignature companySignature = iCompanySignatureService.getByOrganizationCode(organizationCode); | |||
CompanyFiscalCode companyFiscalCode = iCompanyFiscalCodeService.getByOrganizationCode(organizationCode); | |||
ResCompanyFiscalCodeAndSealSnVO returnVO = new ResCompanyFiscalCodeAndSealSnVO(); | |||
CompanySignature companySignature = iCompanySignatureService.getByOrganizationCode(temOrgCode); | |||
if (Objects.isNull(companySignature)) { | |||
return null; | |||
} | |||
CompanyFiscalCode companyFiscalCode = iCompanyFiscalCodeService.getByOrganizationCode(temOrgCode); | |||
CompanyFiscalCodeAndSealSnVO returnVO = new CompanyFiscalCodeAndSealSnVO(); | |||
returnVO.setCreateTime(companySignature.getCreateOn()); | |||
returnVO.setUpdateTime(companySignature.getUpdateOn()); | |||
returnVO.setFiscalCode(companyFiscalCode.getFiscalCode()); | |||
@@ -12,9 +12,8 @@ import javax.validation.constraints.NotBlank; | |||
*/ | |||
@Data | |||
@ApiModel("财政编码配置") | |||
public class ReqCompanyFiscalCodeAndSealSnPO { | |||
public class CompanyFiscalCodeAndSealSnReq { | |||
// @NotBlank(message = "组织编码 不能为空") | |||
@ApiModelProperty("组织编码(需传入用户任职单位code)") | |||
private String organizationCode; | |||
@@ -13,7 +13,7 @@ import java.time.LocalDateTime; | |||
@Data | |||
@ApiModel("财政编码配置VO") | |||
public class ResCompanyFiscalCodeAndSealSnVO { | |||
public class CompanyFiscalCodeAndSealSnVO { | |||
@ApiModelProperty("组织编码") | |||
private String organizationCode; |
@@ -3,15 +3,16 @@ package com.hz.pm.api.gov.manage; | |||
import cn.hutool.core.bean.BeanUtil; | |||
import cn.hutool.core.bean.copier.CopyOptions; | |||
import cn.hutool.core.collection.CollUtil; | |||
import cn.hutool.core.util.StrUtil; | |||
import com.alibaba.fastjson.JSON; | |||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | |||
import com.baomidou.mybatisplus.core.toolkit.Wrappers; | |||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; | |||
import com.google.common.collect.Lists; | |||
import com.google.common.collect.Maps; | |||
import com.hz.pm.api.common.helper.RegionCacheHelper; | |||
import com.hz.pm.api.common.model.constant.BizConst; | |||
import com.hz.pm.api.common.model.constant.RegionConst; | |||
import com.hz.pm.api.common.helper.RegionCacheHelper; | |||
import com.hz.pm.api.gov.contants.BizProjectContant; | |||
import com.hz.pm.api.gov.convert.ProjectConvert; | |||
import com.hz.pm.api.gov.model.dto.*; | |||
@@ -29,9 +30,9 @@ import com.hz.pm.api.projectdeclared.service.IOperationService; | |||
import com.hz.pm.api.projectdeclared.service.IPreInsAcceptancePersonService; | |||
import com.hz.pm.api.projectdeclared.service.IPurchaseService; | |||
import com.hz.pm.api.projectdeclared.utils.GenerateProjectCodeUtil; | |||
import com.hz.pm.api.projectlib.model.entity.*; | |||
import com.hz.pm.api.projectlib.model.enumeration.ProjectTypeEnum; | |||
import com.hz.pm.api.projectlib.model.enumeration.ProjectTypeNewEnum; | |||
import com.hz.pm.api.projectlib.model.entity.*; | |||
import com.hz.pm.api.projectlib.model.req.ProjectListReq; | |||
import com.hz.pm.api.projectlib.service.*; | |||
import com.hz.pm.api.safety.model.entity.PersonSafetyInfo; | |||
@@ -79,7 +80,7 @@ import java.util.stream.Collectors; | |||
/** | |||
* @author zpf | |||
* @date 2023/8/21 下午2:27 | |||
* @since 2023/8/21 下午2:27 | |||
*/ | |||
@Component | |||
@@ -173,8 +174,8 @@ public class GovProjectCollectionManage { | |||
/** | |||
* 分页查 项目归集 | |||
* | |||
* @param req | |||
* @return | |||
* @param req \ | |||
* @return \ | |||
*/ | |||
public PageVo<GovBizProjectListVO> list(ProjectListReq req) { | |||
Page<GovBizProjectBaseinfo> page = req.page(); | |||
@@ -195,7 +196,6 @@ public class GovProjectCollectionManage { | |||
ProjectTypeNewEnum.XU_OPERA.getCode())) | |||
.eq(GovBizProjectBaseinfo::getDeleted, Boolean.FALSE) | |||
.orderByDesc(GovBizProjectBaseinfo::getBizTime); | |||
// permissions(wrapper); | |||
baseinfoService.page(page, wrapper); | |||
if (CollUtil.isEmpty(page.getRecords())) { | |||
@@ -381,22 +381,6 @@ public class GovProjectCollectionManage { | |||
return PageVo.of(res, page.getTotal()); | |||
} | |||
/** | |||
* 数据权限 | |||
* | |||
* @param wrapper | |||
*/ | |||
private void permissions(LambdaQueryWrapper<GovBizProjectBaseinfo> wrapper) { | |||
UserInfoDetails user = LoginUserUtil.loginUserDetail(); | |||
//超管和区域管理员 | |||
if (user.getSuperAdmin() || user.getRegionAdmin()) { | |||
log.info("超管和区管 可以看所有"); | |||
return; | |||
} | |||
wrapper.eq(GovBizProjectBaseinfo::getBaseBuildDeprtDing, user.getEmpPosUnitCode()); | |||
} | |||
public Long count(ProjectListReq req) { | |||
LambdaQueryWrapper<GovBizProjectBaseinfo> wrapper = Wrappers.lambdaQuery(GovBizProjectBaseinfo.class) | |||
.like(StringUtils.isNotBlank(req.getProjectName()), GovBizProjectBaseinfo::getBaseProjName, req.getProjectName()) | |||
@@ -692,14 +676,12 @@ public class GovProjectCollectionManage { | |||
GovBizProjectBaseinfoDTO base = saveDTO.getBaseinfo(); | |||
String baseProjId = saveDTO.getBaseProjId(); | |||
String baseAreaCode = user.getRegionCode() + BizConst.NINE_AREA_CODE_LAST; | |||
String baseProjName = base.getBaseProjName(); | |||
//1.保存基本信息 | |||
GovBizProjectBaseinfoDTO baseinfo = saveDTO.getBaseinfo(); | |||
baseinfo.setBaseProjId(baseProjId); | |||
baseinfo.setBaseProjName(baseProjName); | |||
baseinfo.setBaseAreaCode(baseAreaCode); | |||
baseinfo.setIsEffective(BizProjectContant.ProjectCollection.IS_EFFECTIVE); | |||
GovBizProjectBaseinfo oldBaseInfo = baseinfoService.getOne(Wrappers.lambdaQuery(GovBizProjectBaseinfo.class) | |||
.eq(GovBizProjectBaseinfo::getBaseProjId, baseProjId) | |||
@@ -715,8 +697,6 @@ public class GovProjectCollectionManage { | |||
saveBase.setBaseAreaCode(null); | |||
} else { | |||
saveBase.setTongTime(LocalDateTime.now()); | |||
saveBase.setBaseAreaCode(baseAreaCode); | |||
saveBase.setBaseAreaName(regionCacheHelper.getRegionName(user.getRegionCode(), RegionConst.RL_COUNTY)); | |||
} | |||
saveBase.setAreaCode(RegionConst.RC_HZ); | |||
saveBase.setBizTime(LocalDateTime.now()); | |||
@@ -854,21 +834,18 @@ public class GovProjectCollectionManage { | |||
procureService.remove(Wrappers.lambdaQuery(GovBizProjectProcure.class) | |||
.eq(GovBizProjectProcure::getBaseProjId, baseProjId)); | |||
String finalBaseProjId = baseProjId; | |||
UserInfoDetails finalUser = user; | |||
Integer index = 1; | |||
for (GovBizProjectProcureDTO procure : procures) { | |||
procure.setBaseProjId(finalBaseProjId); | |||
procure.setBaseProjId(baseProjId); | |||
procure.setBaseProjName(baseProjName); | |||
procure.setBaseBidCode(finalBaseProjId + StrPool.DASH + String.format(StrPool.FORMAT_DATE_SINGLE_DIGITS, index)); | |||
procure.setBaseBidCode(baseProjId + StrPool.DASH + String.format(StrPool.FORMAT_DATE_SINGLE_DIGITS, index)); | |||
GovBizProjectProcure saveProcure = BeanUtil.copyProperties(procure, GovBizProjectProcure.class); | |||
saveProcure.setBaseProjId(finalBaseProjId); | |||
saveProcure.setBaseProjId(baseProjId); | |||
saveProcure.setId(null); | |||
saveProcure.setAreaCode(RegionConst.RC_HZ); | |||
saveProcure.setTongTime(LocalDateTime.now()); | |||
saveProcure.setBizTime(LocalDateTime.now()); | |||
saveProcure.setUpdateBy(finalUser.getUsername()); | |||
saveProcure.setUpdateBy(user.getUsername()); | |||
saveProcure.setUpdateOn(LocalDateTime.now()); | |||
if (procureService.save(saveProcure)) { | |||
threadPoolTaskScheduler.execute(() -> uploadFileToProvincialOssProcure(procure, null, saveProcure)); | |||
@@ -878,9 +855,6 @@ public class GovProjectCollectionManage { | |||
} | |||
//7. 推送数据(改为定时推送了) | |||
// pushProject(saveDTO); | |||
//如果是草稿箱来的 就要删除 | |||
if (Objects.nonNull(saveDTO.getDraftId())) { | |||
draftService.removeById(saveDTO.getDraftId()); | |||
} | |||
@@ -895,6 +869,7 @@ public class GovProjectCollectionManage { | |||
* @param user | |||
* @return | |||
*/ | |||
@Transactional(rollbackFor = Exception.class) | |||
public String operationSave(GovOperationProjectSaveDTO saveDTO, UserInfoDetails user) { | |||
if (Objects.isNull(user)) { | |||
user = LoginUserUtil.loginUserDetail(); | |||
@@ -902,14 +877,12 @@ public class GovProjectCollectionManage { | |||
GovOperationProjectBaseinfoDTO base = saveDTO.getBaseinfo(); | |||
String baseProjId = saveDTO.getBaseProjId(); | |||
String baseAreaCode = user.getRegionCode() + BizConst.NINE_AREA_CODE_LAST; | |||
String baseProjName = base.getBaseProjName(); | |||
//1.保存基本信息 | |||
GovOperationProjectBaseinfoDTO baseinfo = saveDTO.getBaseinfo(); | |||
baseinfo.setBaseProjId(baseProjId); | |||
baseinfo.setBaseProjName(baseProjName); | |||
baseinfo.setBaseAreaCode(baseAreaCode); | |||
baseinfo.setIsEffective(BizProjectContant.ProjectCollection.IS_EFFECTIVE); | |||
GovOperationProjectBaseinfo oldBaseInfo = operationProjectBaseinfoService.getOne(Wrappers.lambdaQuery(GovOperationProjectBaseinfo.class) | |||
.eq(GovOperationProjectBaseinfo::getBaseProjId, baseProjId) | |||
@@ -924,11 +897,8 @@ public class GovProjectCollectionManage { | |||
saveBase.setId(oldBaseInfo.getId()); | |||
saveBase.setBaseAreaCode(null); | |||
} else { | |||
saveBase.setBaseAreaCode(baseAreaCode); | |||
saveBase.setTongTime(LocalDateTime.now()); | |||
saveBase.setBaseAreaName(regionCacheHelper.getRegionName(user.getRegionCode(), RegionConst.RL_COUNTY)); | |||
} | |||
saveBase.setAreaCode(RegionConst.RC_HZ); | |||
saveBase.setBizTime(LocalDateTime.now()); | |||
saveBase.setUpdateBy(user.getUsername()); | |||
saveBase.setUpdateOn(LocalDateTime.now()); | |||
@@ -1064,21 +1034,18 @@ public class GovProjectCollectionManage { | |||
procureService.remove(Wrappers.lambdaQuery(GovBizProjectProcure.class) | |||
.eq(GovBizProjectProcure::getBaseProjId, baseProjId)); | |||
String finalBaseProjId = baseProjId; | |||
UserInfoDetails finalUser = user; | |||
Integer index = 1; | |||
for (GovBizProjectProcureDTO procure : procures) { | |||
procure.setBaseProjId(finalBaseProjId); | |||
procure.setBaseProjId(baseProjId); | |||
procure.setBaseProjName(baseProjName); | |||
procure.setBaseBidCode(finalBaseProjId + StrPool.DASH + String.format(StrPool.FORMAT_DATE_SINGLE_DIGITS, index)); | |||
procure.setBaseBidCode(baseProjId + StrPool.DASH + String.format(StrPool.FORMAT_DATE_SINGLE_DIGITS, index)); | |||
GovBizProjectProcure saveProcure = BeanUtil.copyProperties(procure, GovBizProjectProcure.class); | |||
saveProcure.setBaseProjId(finalBaseProjId); | |||
saveProcure.setBaseProjId(baseProjId); | |||
saveProcure.setId(null); | |||
saveProcure.setAreaCode(RegionConst.RC_HZ); | |||
saveProcure.setTongTime(LocalDateTime.now()); | |||
saveProcure.setBizTime(LocalDateTime.now()); | |||
saveProcure.setUpdateBy(finalUser.getUsername()); | |||
saveProcure.setUpdateBy(user.getUsername()); | |||
saveProcure.setUpdateOn(LocalDateTime.now()); | |||
if (procureService.save(saveProcure)) { | |||
threadPoolTaskScheduler.execute(() -> uploadFileToProvincialOssProcure(procure, null, saveProcure)); | |||
@@ -1088,8 +1055,6 @@ public class GovProjectCollectionManage { | |||
} | |||
//7. 推送数据(改为定时推送了) | |||
// pushProject(saveDTO); | |||
//如果是草稿箱来的 就要删除 | |||
if (Objects.nonNull(saveDTO.getDraftId())) { | |||
operationProjectDraftService.removeById(saveDTO.getDraftId()); | |||
@@ -1130,14 +1095,12 @@ public class GovProjectCollectionManage { | |||
GovBizProjectDraft draft = new GovBizProjectDraft(); | |||
//草稿id | |||
Long draftId = saveDTO.getDraftId(); | |||
String baseAreaCode = user.getRegionCode() + BizConst.NINE_AREA_CODE_LAST; | |||
if (Objects.nonNull(draftId)) { | |||
GovBizProjectDraft oldDraft = draftService.getById(draftId); | |||
VUtils.isTrue(Objects.isNull(oldDraft)).throwMessage("该草稿不存在!"); | |||
draft.setId(draftId); | |||
} else { | |||
draft.setTongTime(LocalDateTime.now()); | |||
draft.setBaseAreaCode(baseAreaCode); | |||
draft.setCreateId(user.getUserId()); | |||
draft.setTongTime(LocalDateTime.now()); | |||
} | |||
@@ -1227,14 +1190,12 @@ public class GovProjectCollectionManage { | |||
GovOperationProjectDraft draft = new GovOperationProjectDraft(); | |||
//草稿id | |||
Long draftId = saveDTO.getDraftId(); | |||
String baseAreaCode = user.getRegionCode() + BizConst.NINE_AREA_CODE_LAST; | |||
if (Objects.nonNull(draftId)) { | |||
GovOperationProjectDraft oldDraft = operationProjectDraftService.getById(draftId); | |||
VUtils.isTrue(Objects.isNull(oldDraft)).throwMessage("该草稿不存在!"); | |||
draft.setId(draftId); | |||
} else { | |||
draft.setTongTime(LocalDateTime.now()); | |||
draft.setBaseAreaCode(baseAreaCode); | |||
draft.setCreateId(user.getUserId()); | |||
draft.setTongTime(LocalDateTime.now()); | |||
} | |||
@@ -1722,26 +1683,23 @@ public class GovProjectCollectionManage { | |||
throw BizException.wrap("pdf转换无效"); | |||
} | |||
private Boolean checkFieldNotPdf(String field, Object record, String fieldName) { | |||
if (StringUtils.isBlank(field)) { | |||
private boolean checkFieldNotPdf(String field, Object record, String fieldName) { | |||
if (StrUtil.isBlank(field)) { | |||
return Boolean.FALSE; | |||
} | |||
//如果没有老值 | |||
// 如果没有老值 | |||
if (Objects.isNull(record)) { | |||
return Boolean.TRUE; | |||
} | |||
//和老值做个对比 不一样则true | |||
// 和老值做个对比 不一样则true | |||
Class<?> clazz = record.getClass(); | |||
String oldFiled = StringUtils.EMPTY; | |||
try { | |||
Field fieldDeclared = clazz.getDeclaredField(fieldName); | |||
fieldDeclared.setAccessible(Boolean.TRUE); | |||
oldFiled = Objects.nonNull(fieldDeclared.get(record)) ? String.valueOf(fieldDeclared.get(record)) : null; | |||
} catch (NoSuchFieldException e) { | |||
log.error("转换PDF文件出错" + e); | |||
} catch (IllegalAccessException e) { | |||
} catch (NoSuchFieldException | IllegalAccessException e) { | |||
log.error("转换PDF文件出错" + e); | |||
} | |||
@@ -18,6 +18,7 @@ import lombok.RequiredArgsConstructor; | |||
import lombok.extern.slf4j.Slf4j; | |||
import org.apache.commons.lang3.StringUtils; | |||
import org.springframework.stereotype.Component; | |||
import java.util.List; | |||
import java.util.Objects; | |||
import java.util.stream.Collectors; | |||
@@ -37,6 +38,7 @@ public class IrsProjectManage { | |||
/** | |||
* IRS档案 项目列表 | |||
* | |||
* @param req | |||
* @return | |||
*/ | |||
@@ -44,39 +46,39 @@ public class IrsProjectManage { | |||
Page<Project> page = req.page(); | |||
UserInfoDetails user = LoginUserUtil.loginUserDetail(); | |||
LambdaQueryWrapper<Project> wrapper = Wrappers.lambdaQuery(Project.class) | |||
.eq(StringUtils.isNotBlank(req.getAreaCode()),Project::getAreaCode,req.getAreaCode()) | |||
.eq(StringUtils.isNotBlank(req.getRegionCode()),Project::getAreaCode,req.getRegionCode()) | |||
.eq(StringUtils.isNotBlank(req.getProjectType()),Project::getProjectType,req.getProjectType()) | |||
.eq(Objects.nonNull(req.getStatus()),Project::getStatus,req.getStatus()) | |||
.eq(Objects.nonNull(req.getStage()),Project::getStage,req.getStage()) | |||
.ge(Objects.nonNull(req.getApproveAmountMin()),Project::getApprovalAmount,req.getApproveAmountMin()) | |||
.le(Objects.nonNull(req.getApproveAmountMax()),Project::getApprovalAmount,req.getApproveAmountMax()) | |||
.eq(Objects.nonNull(req.getProjectYear()),Project::getProjectYear,req.getProjectYear()) | |||
.ge(Objects.nonNull(req.getCreateOnMin()),Project::getCreateOn,req.getCreateOnMin()) | |||
.le(Objects.nonNull(req.getCreateOnMax()),Project::getCreateOn,req.getCreateOnMax()) | |||
.like(StringUtils.isNotBlank(req.getProjectName()),Project::getProjectName,req.getProjectName()) | |||
.like(StringUtils.isNotBlank(req.getBuildOrgName()),Project::getBuildOrgName,req.getBuildOrgName()) | |||
.eq(StringUtils.isNotBlank(req.getAreaCode()), Project::getAreaCode, req.getAreaCode()) | |||
.eq(StringUtils.isNotBlank(req.getRegionCode()), Project::getAreaCode, req.getRegionCode()) | |||
.eq(StringUtils.isNotBlank(req.getProjectType()), Project::getProjectType, req.getProjectType()) | |||
.eq(Objects.nonNull(req.getStatus()), Project::getStatus, req.getStatus()) | |||
.eq(Objects.nonNull(req.getStage()), Project::getStage, req.getStage()) | |||
.ge(Objects.nonNull(req.getApproveAmountMin()), Project::getApprovalAmount, req.getApproveAmountMin()) | |||
.le(Objects.nonNull(req.getApproveAmountMax()), Project::getApprovalAmount, req.getApproveAmountMax()) | |||
.eq(Objects.nonNull(req.getProjectYear()), Project::getProjectYear, req.getProjectYear()) | |||
.ge(Objects.nonNull(req.getCreateOnMin()), Project::getCreateOn, req.getCreateOnMin()) | |||
.le(Objects.nonNull(req.getCreateOnMax()), Project::getCreateOn, req.getCreateOnMax()) | |||
.like(StringUtils.isNotBlank(req.getProjectName()), Project::getProjectName, req.getProjectName()) | |||
.like(StringUtils.isNotBlank(req.getBuildOrgName()), Project::getBuildOrgName, req.getBuildOrgName()) | |||
.gt(Project::getStatus, ProjectStatusEnum.UNDER_CONSTRUCTION.getCode()) | |||
.eq(Project::getNewest,Boolean.TRUE) | |||
.eq(Project::getNewest, Boolean.TRUE) | |||
.eq(Project::getIncludeApplication, CommonEnum.YES.getCode()) | |||
.orderByDesc(Project::getUpdateOn); | |||
buildPermission(wrapper,user); | |||
projectService.page(page,wrapper); | |||
buildPermission(wrapper, user); | |||
projectService.page(page, wrapper); | |||
if(CollUtil.isEmpty(page.getRecords())){ | |||
if (CollUtil.isEmpty(page.getRecords())) { | |||
return PageVo.empty(); | |||
} | |||
List<ProjectLibListItemVO> res = page.getRecords().stream().map(p -> BeanUtil.copyProperties(p,ProjectLibListItemVO.class)).collect(Collectors.toList()); | |||
return PageVo.of(res,page.getTotal()); | |||
List<ProjectLibListItemVO> res = page.getRecords().stream() | |||
.map(p -> BeanUtil.copyProperties(p, ProjectLibListItemVO.class)) | |||
.collect(Collectors.toList()); | |||
return PageVo.of(res, page.getTotal()); | |||
} | |||
private void buildPermission(LambdaQueryWrapper<Project> wrapper, UserInfoDetails user) { | |||
if(user.getSuperAdmin()){ | |||
if (user.getSuperAdmin() || user.getRegionAdmin()) { | |||
log.info("超管 都可看 项目档案列表"); | |||
}else if(user.getRegionAdmin()){ | |||
wrapper.eq(Project::getAreaCode,user.getRegionCode()); | |||
}else{ | |||
wrapper.eq(Project::getBuildOrgCode,user.getEmpPosUnitCode()); | |||
} else { | |||
wrapper.eq(Project::getBuildOrgCode, user.getMhUnitId()); | |||
} | |||
} | |||
} |
@@ -1,66 +0,0 @@ | |||
package com.hz.pm.api.meeting.helper; | |||
import com.ningdatech.basic.util.CollUtils; | |||
import com.hz.pm.api.common.helper.RegionCacheHelper; | |||
import com.hz.pm.api.common.model.entity.ViewRegionDTO; | |||
import com.hz.pm.api.sys.model.entity.Role; | |||
import com.hz.pm.api.user.model.enumeration.RoleEnum; | |||
import com.hz.pm.api.user.security.model.UserInfoDetails; | |||
import com.hz.pm.api.user.util.LoginUserUtil; | |||
import lombok.AllArgsConstructor; | |||
import org.springframework.stereotype.Component; | |||
import java.util.Collection; | |||
import java.util.Collections; | |||
import java.util.List; | |||
/** | |||
* <p> | |||
* MeetingDataScopeHelper | |||
* </p> | |||
* | |||
* @author WendyYang | |||
* @since 2023/4/27 | |||
**/ | |||
@Component | |||
@AllArgsConstructor | |||
public class MeetingDataScopeHelper { | |||
private final RegionCacheHelper regionCacheHelper; | |||
private static RoleEnum getRolePriorityMax() { | |||
List<Role> roleList = LoginUserUtil.loginUserDetail().getUserRoleList(); | |||
List<String> roleCodeList = CollUtils.fieldList(roleList, Role::getCode); | |||
if (roleCodeList.contains(RoleEnum.SUPER_ADMIN.name())) { | |||
return RoleEnum.SUPER_ADMIN; | |||
} | |||
if (roleCodeList.contains(RoleEnum.REGION_MANAGER.name())) { | |||
return RoleEnum.REGION_MANAGER; | |||
} | |||
return RoleEnum.EXPERT_ADMIN; | |||
} | |||
public ViewRegionDTO meetingListViewRegions() { | |||
RoleEnum role = getRolePriorityMax(); | |||
UserInfoDetails user = LoginUserUtil.loginUserDetail(); | |||
String regionCode = user.getRegionCode(); | |||
Integer regionLevel = user.getRegionLevel(); | |||
Collection<String> regions; | |||
switch (role) { | |||
case SUPER_ADMIN: | |||
regions = null; | |||
break; | |||
case REGION_MANAGER: | |||
regions = regionCacheHelper.listChildRegionCodeList(regionCode, regionLevel); | |||
break; | |||
case EXPERT_ADMIN: | |||
regions = Collections.singletonList(regionCode); | |||
break; | |||
default: | |||
regions = Collections.emptyList(); | |||
break; | |||
} | |||
return new ViewRegionDTO(regions, regionLevel); | |||
} | |||
} |
@@ -30,7 +30,6 @@ import com.hz.pm.api.meeting.entity.req.*; | |||
import com.hz.pm.api.meeting.entity.vo.*; | |||
import com.hz.pm.api.meeting.helper.ExpertInviteHelper; | |||
import com.hz.pm.api.meeting.helper.MeetingCallOrMsgHelper; | |||
import com.hz.pm.api.meeting.helper.MeetingDataScopeHelper; | |||
import com.hz.pm.api.meeting.helper.MeetingManageHelper; | |||
import com.hz.pm.api.meeting.service.*; | |||
import com.hz.pm.api.meeting.task.ExpertRandomInviteTask; | |||
@@ -89,13 +88,10 @@ public class MeetingManage { | |||
private final DistributedLock distributedLock; | |||
private final IProjectService projectService; | |||
private final IMeetingInnerProjectService meetingInnerProjectService; | |||
private final IMeetingOuterProjectService meetingOuterProjectService; | |||
private final IBelongOrgService belongOrgService; | |||
private final IDingOrganizationService dingOrganizationService; | |||
private final IExpertReviewService expertReviewService; | |||
private final ExpertInviteHelper expertInviteHelper; | |||
private final MeetingCallOrMsgHelper meetingCallOrMsgHelper; | |||
private final MeetingDataScopeHelper meetingDataScopeHelper; | |||
private final IMeetingExpertJudgeService expertJudgeService; | |||
private final IMeetingExpertJudgeService meetingExpertJudgeService; | |||
@@ -130,8 +126,8 @@ public class MeetingManage { | |||
// 保存会议基本信息 | |||
Meeting meeting = BeanUtil.copyProperties(meetingBasic, Meeting.class); | |||
meeting.setStatus(MeetingStatusEnum.NORMAL.getCode()); | |||
meeting.setHoldOrg(userDetail.getOrganizationName()); | |||
meeting.setHoldOrgCode(userDetail.getOrganizationCode()); | |||
meeting.setHoldOrg(String.valueOf(userDetail.getMhUnitId())); | |||
meeting.setHoldOrgCode(userDetail.getMhUnitName()); | |||
meeting.setCreator(userDetail.getUsername()); | |||
meeting.setInviteStatus(Boolean.FALSE); | |||
meeting.setConfirmedRoster(Boolean.FALSE); | |||
@@ -73,7 +73,8 @@ public class TemplateDetailBuildHelperImpl implements TemplateDetailBuildHelper | |||
.eq(PerformanceAppraisalScoreInfo::getAppraisalProjectCode,projectCode) | |||
.eq(PerformanceAppraisalScoreInfo::getAppraisalType, AppraisalTypeEnum.RE_APPRAISAL.getCode())); | |||
if (CollUtil.isNotEmpty(reAppraisalScoreInfo)) { | |||
Map<String, List<PerformanceAppraisalScoreInfo>> reAppScoreInfoMap = reAppraisalScoreInfo.stream().collect(Collectors.groupingBy(PerformanceAppraisalScoreInfo::getAppraisalEmployeeName)); | |||
Map<String, List<PerformanceAppraisalScoreInfo>> reAppScoreInfoMap = reAppraisalScoreInfo.stream() | |||
.collect(Collectors.groupingBy(PerformanceAppraisalScoreInfo::getAppraisalUserName)); | |||
HashMap<String, BigDecimal> scoreMap = MapUtil.newHashMap(); | |||
for (String name : reAppScoreInfoMap.keySet()) { | |||
List<PerformanceAppraisalScoreInfo> scoreInfos = reAppScoreInfoMap.get(name); | |||
@@ -97,13 +98,13 @@ public class TemplateDetailBuildHelperImpl implements TemplateDetailBuildHelper | |||
.eq(PerformanceAppraisalScoreInfo::getAppraisalProjectCode,projectCode) | |||
.eq(PerformanceAppraisalScoreInfo::getAppraisalType, AppraisalTypeEnum.EXPERT_VERIFY.getCode())); | |||
if (CollUtil.isNotEmpty(verifyScoreInfo)) { | |||
Map<String, List<PerformanceAppraisalScoreInfo>> verifyScoreInfoMap = verifyScoreInfo.stream().collect(Collectors.groupingBy(PerformanceAppraisalScoreInfo::getAppraisalEmployeeName)); | |||
Map<String, List<PerformanceAppraisalScoreInfo>> verifyScoreInfoMap = verifyScoreInfo.stream() | |||
.collect(Collectors.groupingBy(PerformanceAppraisalScoreInfo::getAppraisalUserName)); | |||
HashMap<String, BigDecimal> scoreMap = MapUtil.newHashMap(); | |||
for (String name : verifyScoreInfoMap.keySet()) { | |||
List<PerformanceAppraisalScoreInfo> scoreInfos = verifyScoreInfoMap.get(name); | |||
BigDecimal totalScore = scoreInfos.stream().map(PerformanceAppraisalScoreInfo::getAppraisalScore) | |||
.filter(Objects::nonNull) | |||
.reduce(BigDecimal.ZERO, BigDecimal::add); | |||
.filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add); | |||
scoreMap.put(name, totalScore); | |||
} | |||
detailThirdVo.setVerifyTotalScoreInfo(scoreMap); | |||
@@ -1,47 +1,49 @@ | |||
package com.hz.pm.api.performance.manage; | |||
import java.math.BigDecimal; | |||
import java.time.LocalDateTime; | |||
import java.util.*; | |||
import java.util.stream.Collectors; | |||
import cn.hutool.core.bean.BeanUtil; | |||
import cn.hutool.core.collection.CollUtil; | |||
import cn.hutool.core.lang.Assert; | |||
import cn.hutool.core.map.MapUtil; | |||
import com.hz.pm.api.performance.enumration.AppIndexTypeEnum; | |||
import com.hz.pm.api.performance.model.dto.AppAppraisalInfoDTO; | |||
import com.hz.pm.api.performance.model.vo.*; | |||
import com.hz.pm.api.projectlib.model.entity.ProjectApplication; | |||
import com.hz.pm.api.projectlib.service.IProjectApplicationService; | |||
import org.apache.commons.lang3.StringUtils; | |||
import org.springframework.beans.BeanUtils; | |||
import org.springframework.stereotype.Component; | |||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | |||
import com.baomidou.mybatisplus.core.toolkit.Wrappers; | |||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; | |||
import com.google.common.collect.Lists; | |||
import com.ningdatech.basic.exception.BizException; | |||
import com.ningdatech.basic.function.VUtils; | |||
import com.ningdatech.basic.model.PageVo; | |||
import com.ningdatech.basic.util.StrPool; | |||
import com.hz.pm.api.performance.constant.ProjectBizConst; | |||
import com.hz.pm.api.performance.enumration.AppIndexTypeEnum; | |||
import com.hz.pm.api.performance.model.dto.AppAppraisalInfoDTO; | |||
import com.hz.pm.api.performance.model.dto.ProjectAppraisalDTO; | |||
import com.hz.pm.api.performance.model.entity.*; | |||
import com.hz.pm.api.performance.model.req.PerformanceAppraisalListReq; | |||
import com.hz.pm.api.performance.model.vo.*; | |||
import com.hz.pm.api.performance.service.*; | |||
import com.hz.pm.api.projectlib.model.entity.ProjectApplication; | |||
import com.hz.pm.api.projectlib.service.IProjectApplicationService; | |||
import com.hz.pm.api.sys.model.entity.Role; | |||
import com.hz.pm.api.sys.service.IRoleService; | |||
import com.hz.pm.api.user.security.model.UserInfoDetails; | |||
import com.hz.pm.api.user.util.LoginUserUtil; | |||
import cn.hutool.core.bean.BeanUtil; | |||
import cn.hutool.core.collection.CollUtil; | |||
import com.ningdatech.basic.exception.BizException; | |||
import com.ningdatech.basic.function.VUtils; | |||
import com.ningdatech.basic.model.PageVo; | |||
import lombok.AllArgsConstructor; | |||
import lombok.extern.slf4j.Slf4j; | |||
import org.apache.commons.lang3.StringUtils; | |||
import org.springframework.beans.BeanUtils; | |||
import org.springframework.stereotype.Component; | |||
import java.math.BigDecimal; | |||
import java.time.LocalDateTime; | |||
import java.util.List; | |||
import java.util.Map; | |||
import java.util.Objects; | |||
import java.util.Set; | |||
import java.util.stream.Collectors; | |||
/** | |||
* AppAppraisalManage | |||
* @return | |||
* | |||
* @author CMM | |||
* @return | |||
* @since 2023/08/10 8:55 | |||
*/ | |||
@Component | |||
@@ -56,8 +58,10 @@ public class AppAppraisalManage { | |||
private final IPerformanceAppraisalApplicationService performanceAppraisalApplicationService; | |||
private final IPerformanceAppraisalAppIndicatorService performanceAppraisalAppIndicatorService; | |||
private final IProjectCoreBusinessIndicatorsService projectCoreBusinessIndicatorsService; | |||
/** | |||
* 应用评价-评价计划列表 | |||
* | |||
* @param req | |||
* @return | |||
*/ | |||
@@ -68,31 +72,31 @@ public class AppAppraisalManage { | |||
List<Long> roleIdList = userRoleList.stream().map(Role::getId).collect(Collectors.toList()); | |||
Role role = roleService.getOne(Wrappers.lambdaQuery(Role.class) | |||
.eq(Role::getName, ProjectBizConst.REAPPRAISAL_ROLE)); | |||
if (Objects.isNull(role)){ | |||
if (Objects.isNull(role)) { | |||
throw new BizException("登录用户没有复评员角色!"); | |||
} | |||
// 登录用户不是复评员,不能查看复评计划列表 | |||
if (!roleIdList.contains(role.getId())){ | |||
if (!roleIdList.contains(role.getId())) { | |||
return PageVo.empty(); | |||
} | |||
// 获取所有已添加到评价计划中的应用信息 | |||
List<PerformanceAppraisalApplication> paas = performanceAppraisalApplicationService.list(); | |||
// 没有包含应用的评价计划 | |||
if (CollUtil.isEmpty(paas)){ | |||
if (CollUtil.isEmpty(paas)) { | |||
return PageVo.empty(); | |||
} | |||
Set<Long> paIds = paas.stream().map(PerformanceAppraisalApplication::getAppraisalId).collect(Collectors.toSet()); | |||
Page<PerformanceAppraisal> page = req.page(); | |||
LambdaQueryWrapper<PerformanceAppraisal> wrapper = Wrappers.lambdaQuery(PerformanceAppraisal.class) | |||
.in(PerformanceAppraisal::getId,paIds) | |||
.in(PerformanceAppraisal::getId, paIds) | |||
.orderByDesc(PerformanceAppraisal::getUpdateOn); | |||
performanceAppraisalService.page(page,wrapper); | |||
performanceAppraisalService.page(page, wrapper); | |||
List<PerformanceAppraisalVO> res = page.getRecords().stream() | |||
.map(p -> BeanUtil.copyProperties(p, PerformanceAppraisalVO.class)) | |||
.collect(Collectors.toList()); | |||
return PageVo.of(res,page.getTotal()); | |||
return PageVo.of(res, page.getTotal()); | |||
} | |||
@@ -108,7 +112,7 @@ public class AppAppraisalManage { | |||
.eq(PerformanceAppraisalApplication::getAppraisalId, planId) | |||
.eq(PerformanceAppraisalApplication::getIsCompleteAppraisal, Boolean.FALSE)); | |||
// 没有当前用户待评价的应用信息 | |||
if (CollUtil.isEmpty(paas)){ | |||
if (CollUtil.isEmpty(paas)) { | |||
return PageVo.empty(); | |||
} | |||
List<Long> ids = paas.stream().map(PerformanceAppraisalApplication::getApplicationId).collect(Collectors.toList()); | |||
@@ -126,36 +130,36 @@ public class AppAppraisalManage { | |||
} | |||
appIds = ids; | |||
// 没有当前用户待评价的应用信息 | |||
if(CollUtil.isEmpty(appIds)){ | |||
if (CollUtil.isEmpty(appIds)) { | |||
return PageVo.empty(); | |||
} | |||
Page<ProjectApplication> page = req.page(); | |||
LambdaQueryWrapper<ProjectApplication> wrapper = Wrappers.lambdaQuery(ProjectApplication.class) | |||
.in(ProjectApplication::getId, appIds) | |||
.like(StringUtils.isNotBlank(req.getApplicationName()),ProjectApplication::getApplicationName,req.getApplicationName()); | |||
projectApplicationService.page(page,wrapper); | |||
.like(StringUtils.isNotBlank(req.getApplicationName()), ProjectApplication::getApplicationName, req.getApplicationName()); | |||
projectApplicationService.page(page, wrapper); | |||
if(CollUtil.isEmpty(page.getRecords())){ | |||
if (CollUtil.isEmpty(page.getRecords())) { | |||
return PageVo.empty(); | |||
} | |||
List<PerformanceAppraisalAppVO> res = page.getRecords().stream() | |||
.map(p -> { | |||
PerformanceAppraisalAppVO vo = BeanUtil.copyProperties(p, PerformanceAppraisalAppVO.class); | |||
vo.setCanAppraisal(checkCanAppraisal(employeeCode,p.getId(),planId)); | |||
vo.setCanAppraisal(checkCanAppraisal(employeeCode, p.getId(), planId)); | |||
vo.setApplicationName(StringUtils.isNotBlank(p.getApplicationName()) ? p.getApplicationName() : p.getRelatedExistsApplication()); | |||
vo.setAppraisalId(planId); | |||
return vo; | |||
}) | |||
.collect(Collectors.toList()); | |||
return PageVo.of(res,page.getTotal()); | |||
return PageVo.of(res, page.getTotal()); | |||
} | |||
public PageVo<PerformanceAppraisalAppVO> evaluatedList(Long planId, PerformanceAppraisalListReq req) { | |||
UserInfoDetails user = LoginUserUtil.loginUserDetail(); | |||
String employeeCode = user.getEmployeeCode(); | |||
String employeeCode = user.getUserIdStr(); | |||
PerformanceAppraisal plan = performanceAppraisalService.getById(planId); | |||
VUtils.isTrue(Objects.isNull(plan)).throwMessage("该评价计划不存在!"); | |||
@@ -164,7 +168,7 @@ public class AppAppraisalManage { | |||
List<PerformanceAppraisalApplication> paas = performanceAppraisalApplicationService.list(Wrappers.lambdaQuery(PerformanceAppraisalApplication.class) | |||
.eq(PerformanceAppraisalApplication::getAppraisalId, planId) | |||
.eq(PerformanceAppraisalApplication::getIsCompleteAppraisal, Boolean.TRUE)); | |||
if (CollUtil.isEmpty(paas)){ | |||
if (CollUtil.isEmpty(paas)) { | |||
return PageVo.empty(); | |||
} | |||
// 从绩效评价打分信息表中获取上述绩效评价计划应用的打分信息 | |||
@@ -173,39 +177,38 @@ public class AppAppraisalManage { | |||
List<Long> appIds = Lists.newArrayList(); | |||
if (CollUtil.isNotEmpty(appraisalScoreInfos)) { | |||
// 筛选出当前登录用户已进行打分的应用信息 | |||
List<Long> scoredAppIds = appraisalScoreInfos.stream() | |||
appIds = appraisalScoreInfos.stream() | |||
.filter(a -> employeeCode.equals(a.getAppraisalEmployeeCode())) | |||
.map(PerformanceAppraisalAppScoreInfo::getApplicationId) | |||
.collect(Collectors.toList()); | |||
appIds = scoredAppIds; | |||
} | |||
// 没有当前用户已评价的应用信息 | |||
if(CollUtil.isEmpty(appIds)){ | |||
if (CollUtil.isEmpty(appIds)) { | |||
return PageVo.empty(); | |||
} | |||
Page<ProjectApplication> page = req.page(); | |||
LambdaQueryWrapper<ProjectApplication> wrapper = Wrappers.lambdaQuery(ProjectApplication.class) | |||
.in(ProjectApplication::getId, appIds) | |||
.like(StringUtils.isNotBlank(req.getApplicationName()),ProjectApplication::getApplicationName,req.getApplicationName()); | |||
projectApplicationService.page(page,wrapper); | |||
.like(StringUtils.isNotBlank(req.getApplicationName()), ProjectApplication::getApplicationName, req.getApplicationName()); | |||
projectApplicationService.page(page, wrapper); | |||
if(CollUtil.isEmpty(page.getRecords())){ | |||
if (CollUtil.isEmpty(page.getRecords())) { | |||
return PageVo.empty(); | |||
} | |||
List<PerformanceAppraisalAppVO> res = page.getRecords().stream() | |||
.map(p -> { | |||
PerformanceAppraisalAppVO vo = BeanUtil.copyProperties(p, PerformanceAppraisalAppVO.class); | |||
vo.setCanAppraisal(checkCanAppraisal(employeeCode,p.getId(),planId)); | |||
vo.setCanAppraisal(checkCanAppraisal(employeeCode, p.getId(), planId)); | |||
vo.setApplicationName(StringUtils.isNotBlank(p.getApplicationName()) ? p.getApplicationName() : p.getRelatedExistsApplication()); | |||
vo.setAppraisalId(planId); | |||
return vo; | |||
}) | |||
.collect(Collectors.toList()); | |||
return PageVo.of(res,page.getTotal()); | |||
return PageVo.of(res, page.getTotal()); | |||
} | |||
/** | |||
@@ -216,14 +219,14 @@ public class AppAppraisalManage { | |||
* @param appraisalId | |||
* @return | |||
*/ | |||
private Boolean checkCanAppraisal(String employeeCode, Long appId, Long appraisalId) { | |||
private Boolean checkCanAppraisal(String employeeCode, Long appId, Long appraisalId) { | |||
// 从绩效评价应用打分信息表中查询打分人员为当前登录复评用户的打分信息 | |||
// 如果没有相关的打分信息,说明是当前登录复评用户是首次评价 | |||
List<PerformanceAppraisalAppScoreInfo> scoreInfos = performanceAppraisalAppScoreInfoService.list(Wrappers.lambdaQuery(PerformanceAppraisalAppScoreInfo.class) | |||
.eq(PerformanceAppraisalAppScoreInfo::getApplicationId,appId) | |||
.eq(PerformanceAppraisalAppScoreInfo::getAppraisalId,appraisalId) | |||
.eq(PerformanceAppraisalAppScoreInfo::getApplicationId, appId) | |||
.eq(PerformanceAppraisalAppScoreInfo::getAppraisalId, appraisalId) | |||
.eq(PerformanceAppraisalAppScoreInfo::getAppraisalEmployeeCode, employeeCode)); | |||
if (CollUtil.isEmpty(scoreInfos)){ | |||
if (CollUtil.isEmpty(scoreInfos)) { | |||
return true; | |||
} | |||
return Boolean.FALSE; | |||
@@ -233,28 +236,26 @@ public class AppAppraisalManage { | |||
public AppAppraisalIndexDetailVO detail(Long planId, Long appId) { | |||
ProjectApplication projectApplication = projectApplicationService.getById(appId); | |||
VUtils.isTrue(Objects.isNull(projectApplication)).throwMessage("应用不存在!"); | |||
Assert.notNull(projectApplication, "应用不存在!"); | |||
AppAppraisalIndexDetailVO resVo = new AppAppraisalIndexDetailVO(); | |||
if (StringUtils.isNotBlank(projectApplication.getApplicationName())) { | |||
resVo.setApplicationName(projectApplication.getApplicationName()); | |||
}else { | |||
} else { | |||
resVo.setApplicationName(projectApplication.getRelatedExistsApplication()); | |||
} | |||
if (Objects.nonNull(projectApplication)){ | |||
resVo.setBuildOrgName(projectApplication.getBuildOrgName()); | |||
// todo 应用状态 需通过appCode通过IRS接口获取,这里暂时写死 已验收 | |||
resVo.setApplicationStatus("已验收"); | |||
} | |||
resVo.setBuildOrgName(projectApplication.getBuildOrgName()); | |||
// todo 应用状态 需通过appCode通过IRS接口获取,这里暂时写死 已验收 | |||
resVo.setApplicationStatus("已验收"); | |||
// 获取指标配置的应用指标信息 | |||
// 通用指标 | |||
List<PerformanceAppraisalAppIndicator> commonIndexList = performanceAppraisalAppIndicatorService.list(Wrappers.lambdaQuery(PerformanceAppraisalAppIndicator.class) | |||
.eq(PerformanceAppraisalAppIndicator::getIndexType, AppIndexTypeEnum.COMMON.getCode()) | |||
.eq(PerformanceAppraisalAppIndicator::getIsDisplay,Boolean.TRUE) | |||
.orderBy(Boolean.TRUE,Boolean.TRUE,PerformanceAppraisalAppIndicator::getSort)); | |||
.eq(PerformanceAppraisalAppIndicator::getIsDisplay, Boolean.TRUE) | |||
.orderBy(Boolean.TRUE, Boolean.TRUE, PerformanceAppraisalAppIndicator::getSort)); | |||
// 获取当前应用通用指标的的打分信息 | |||
Map<Long, PerformanceAppraisalAppScoreInfo> commonScoreInfoMap = performanceAppraisalAppScoreInfoService.list(Wrappers.lambdaQuery(PerformanceAppraisalAppScoreInfo.class) | |||
.eq(PerformanceAppraisalAppScoreInfo::getAppraisalId,planId) | |||
.eq(PerformanceAppraisalAppScoreInfo::getAppraisalId, planId) | |||
.eq(PerformanceAppraisalAppScoreInfo::getApplicationId, appId) | |||
.eq(PerformanceAppraisalAppScoreInfo::getIndexType, AppIndexTypeEnum.COMMON.getCode())) | |||
.stream().collect(Collectors.toMap(PerformanceAppraisalAppScoreInfo::getIndexId, p -> p)); | |||
@@ -274,11 +275,11 @@ public class AppAppraisalManage { | |||
// 辅助指标 | |||
List<PerformanceAppraisalAppIndicator> auxIndexList = performanceAppraisalAppIndicatorService.list(Wrappers.lambdaQuery(PerformanceAppraisalAppIndicator.class) | |||
.eq(PerformanceAppraisalAppIndicator::getIndexType, AppIndexTypeEnum.AUX.getCode()) | |||
.eq(PerformanceAppraisalAppIndicator::getIsDisplay,Boolean.TRUE) | |||
.orderBy(Boolean.TRUE,Boolean.TRUE,PerformanceAppraisalAppIndicator::getSort)); | |||
.eq(PerformanceAppraisalAppIndicator::getIsDisplay, Boolean.TRUE) | |||
.orderBy(Boolean.TRUE, Boolean.TRUE, PerformanceAppraisalAppIndicator::getSort)); | |||
// 获取当前应用辅助指标的的打分信息 | |||
Map<Long, PerformanceAppraisalAppScoreInfo> auxScoreInfoMap = performanceAppraisalAppScoreInfoService.list(Wrappers.lambdaQuery(PerformanceAppraisalAppScoreInfo.class) | |||
.eq(PerformanceAppraisalAppScoreInfo::getAppraisalId,planId) | |||
.eq(PerformanceAppraisalAppScoreInfo::getAppraisalId, planId) | |||
.eq(PerformanceAppraisalAppScoreInfo::getApplicationId, appId) | |||
.eq(PerformanceAppraisalAppScoreInfo::getIndexType, AppIndexTypeEnum.AUX.getCode())) | |||
.stream().collect(Collectors.toMap(PerformanceAppraisalAppScoreInfo::getIndexId, p -> p)); | |||
@@ -299,7 +300,7 @@ public class AppAppraisalManage { | |||
.eq(ProjectCoreBusinessIndicators::getApplicationId, appId)); | |||
// 获取当前应用业务指标的的打分信息 | |||
Map<Long, PerformanceAppraisalAppScoreInfo> businessScoreInfoMap = performanceAppraisalAppScoreInfoService.list(Wrappers.lambdaQuery(PerformanceAppraisalAppScoreInfo.class) | |||
.eq(PerformanceAppraisalAppScoreInfo::getAppraisalId,planId) | |||
.eq(PerformanceAppraisalAppScoreInfo::getAppraisalId, planId) | |||
.eq(PerformanceAppraisalAppScoreInfo::getApplicationId, appId) | |||
.eq(PerformanceAppraisalAppScoreInfo::getIndexType, AppIndexTypeEnum.BUSINESS.getCode())) | |||
.stream().collect(Collectors.toMap(PerformanceAppraisalAppScoreInfo::getIndexId, p -> p)); | |||
@@ -333,7 +334,7 @@ public class AppAppraisalManage { | |||
.eq(PerformanceAppraisalApplication::getApplicationId, applicationId)); | |||
List<Long> indexIds = appAppraisalInfoList.stream().filter(a -> AppIndexTypeEnum.COMMON.getCode().equals(a.getIndexType()) || | |||
AppIndexTypeEnum.AUX.getCode().equals(a.getIndexType())) | |||
AppIndexTypeEnum.AUX.getCode().equals(a.getIndexType())) | |||
.map(AppAppraisalInfoDTO::getIndexId) | |||
.collect(Collectors.toList()); | |||
List<Long> businessIndexIds = appAppraisalInfoList.stream() | |||
@@ -366,18 +367,18 @@ public class AppAppraisalManage { | |||
Map<Long, ProjectCoreBusinessIndicators> finalBusinessIndexMap = businessIndexMap; | |||
List<PerformanceAppraisalAppScoreInfo> scoreInfos = appAppraisalInfoList.stream().map(a -> { | |||
if (AppIndexTypeEnum.COMMON.getCode().equals(a.getIndexType()) || | |||
AppIndexTypeEnum.AUX.getCode().equals(a.getIndexType())){ | |||
AppIndexTypeEnum.AUX.getCode().equals(a.getIndexType())) { | |||
PerformanceAppraisalAppIndicator appIndicator = finalIndexMap.get(a.getIndexId()); | |||
BigDecimal score = a.getScore(); | |||
BigDecimal indexScore = appIndicator.getIndexScore(); | |||
if (score.compareTo(indexScore) > 0 || score.compareTo(BigDecimal.ZERO) < 0){ | |||
if (score.compareTo(indexScore) > 0 || score.compareTo(BigDecimal.ZERO) < 0) { | |||
throw new BizException("评价得分必须大于等于0且小于等于指标分值!"); | |||
} | |||
} else if (AppIndexTypeEnum.BUSINESS.getCode().equals(a.getIndexType())) { | |||
ProjectCoreBusinessIndicators coreBusinessIndicators = finalBusinessIndexMap.get(a.getIndexId()); | |||
BigDecimal score = a.getScore(); | |||
BigDecimal indexScore = coreBusinessIndicators.getScore(); | |||
if (score.compareTo(indexScore) > 0 || score.compareTo(BigDecimal.ZERO) < 0){ | |||
if (score.compareTo(indexScore) > 0 || score.compareTo(BigDecimal.ZERO) < 0) { | |||
throw new BizException("评价得分必须大于等于0且小于等于指标分值!"); | |||
} | |||
} | |||
@@ -396,7 +397,7 @@ public class AppAppraisalManage { | |||
scoreInfo.setUpdateBy(username); | |||
return scoreInfo; | |||
}).collect(Collectors.toList()); | |||
if (performanceAppraisalAppScoreInfoService.saveBatch(scoreInfos)){ | |||
if (performanceAppraisalAppScoreInfoService.saveBatch(scoreInfos)) { | |||
// 计算评价总分并保存 | |||
BigDecimal appraisalTotalScore = appAppraisalInfoList.stream() | |||
.map(AppAppraisalInfoDTO::getScore) | |||
@@ -412,18 +413,5 @@ public class AppAppraisalManage { | |||
} | |||
return "提交失败"; | |||
} | |||
private void judgeCompleteAppraisal(PerformanceAppraisalProjectGroup group, PerformanceAppraisalApplication appraisalApplication) { | |||
// 获取该评价应用的复评打分信息 | |||
List<PerformanceAppraisalAppScoreInfo> scoreInfos = performanceAppraisalAppScoreInfoService.list(Wrappers.lambdaQuery(PerformanceAppraisalAppScoreInfo.class) | |||
.eq(PerformanceAppraisalAppScoreInfo::getAppraisalId, group.getAppraisalId()) | |||
.eq(PerformanceAppraisalAppScoreInfo::getApplicationId, appraisalApplication.getApplicationId())); | |||
String reAppraisalUsers = group.getReAppraisalUsers(); | |||
List<String> users = scoreInfos.stream().map(PerformanceAppraisalAppScoreInfo::getAppraisalEmployeeCode).collect(Collectors.toList()); | |||
if (CollUtil.isNotEmpty(users)){ | |||
String join = String.join(StrPool.COMMA, users); | |||
if (join.equals(reAppraisalUsers)) { | |||
appraisalApplication.setIsCompleteAppraisal(Boolean.TRUE); | |||
} | |||
} | |||
} | |||
} |
@@ -4,40 +4,44 @@ import cn.hutool.core.bean.BeanUtil; | |||
import cn.hutool.core.collection.CollUtil; | |||
import com.alibaba.excel.EasyExcel; | |||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | |||
import com.baomidou.mybatisplus.core.toolkit.Assert; | |||
import com.baomidou.mybatisplus.core.toolkit.Wrappers; | |||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; | |||
import com.google.common.collect.Lists; | |||
import com.ningdatech.basic.exception.BizException; | |||
import com.ningdatech.basic.function.VUtils; | |||
import com.ningdatech.basic.model.PageVo; | |||
import com.ningdatech.basic.util.StrPool; | |||
import com.hz.pm.api.common.enumeration.CommonEnum; | |||
import com.hz.pm.api.common.util.ExcelDownUtil; | |||
import com.hz.pm.api.common.util.ExcelExportStyle; | |||
import com.hz.pm.api.performance.constant.ProjectBizConst; | |||
import com.hz.pm.api.performance.enumration.AppraisalTypeEnum; | |||
import com.hz.pm.api.performance.helper.TemplateDetailBuildHelper; | |||
import com.hz.pm.api.performance.model.dto.SelfAppraisalScoreExportDTO; | |||
import com.hz.pm.api.performance.model.dto.ProjectAppraisalDTO; | |||
import com.hz.pm.api.performance.model.dto.ProjectAppraisalInfoDTO; | |||
import com.hz.pm.api.performance.model.dto.SelfAppraisalScoreExportDTO; | |||
import com.hz.pm.api.performance.model.entity.*; | |||
import com.hz.pm.api.performance.model.req.PerformanceAppraisalExportReq; | |||
import com.hz.pm.api.performance.model.req.PerformanceAppraisalListReq; | |||
import com.hz.pm.api.performance.model.vo.*; | |||
import com.hz.pm.api.performance.model.vo.PerformanceAppraisalProjectVO; | |||
import com.hz.pm.api.performance.model.vo.PerformanceAppraisalVO; | |||
import com.hz.pm.api.performance.model.vo.ProjectAppraisalIndexDetailVO; | |||
import com.hz.pm.api.performance.model.vo.ProjectTemplateDetailVO; | |||
import com.hz.pm.api.performance.service.*; | |||
import com.hz.pm.api.performance.util.ExcelFillCellMergeStrategy; | |||
import com.hz.pm.api.performance.util.MultiColumnMergeStrategy; | |||
import com.hz.pm.api.portrait.model.entity.ProjectTag; | |||
import com.hz.pm.api.portrait.service.IProjectTagService; | |||
import com.hz.pm.api.projectlib.model.entity.Project; | |||
import com.hz.pm.api.projectlib.model.enumeration.ProjectStatusEnum; | |||
import com.hz.pm.api.projectlib.model.enumeration.ProjectTypeNewEnum; | |||
import com.hz.pm.api.projectlib.model.entity.Project; | |||
import com.hz.pm.api.projectlib.service.IProjectService; | |||
import com.hz.pm.api.sys.model.entity.Role; | |||
import com.hz.pm.api.sys.service.IRoleService; | |||
import com.hz.pm.api.user.model.enumeration.RoleEnum; | |||
import com.hz.pm.api.user.security.model.UserInfoDetails; | |||
import com.hz.pm.api.user.util.LoginUserUtil; | |||
import com.ningdatech.basic.exception.BizException; | |||
import com.ningdatech.basic.function.VUtils; | |||
import com.ningdatech.basic.model.PageVo; | |||
import com.ningdatech.basic.util.StrPool; | |||
import lombok.AllArgsConstructor; | |||
import lombok.extern.slf4j.Slf4j; | |||
import org.apache.commons.lang3.StringUtils; | |||
@@ -48,7 +52,10 @@ import javax.servlet.http.HttpServletResponse; | |||
import java.io.IOException; | |||
import java.math.BigDecimal; | |||
import java.time.LocalDateTime; | |||
import java.util.*; | |||
import java.util.List; | |||
import java.util.Map; | |||
import java.util.Objects; | |||
import java.util.Set; | |||
import java.util.stream.Collectors; | |||
/** | |||
@@ -71,8 +78,10 @@ public class OrgSelfAppraisalManage { | |||
private final IPerformanceIndicatorProjectTemplateDetailService indicatorProjectTemplateDetailService; | |||
private final IProjectTagService projectTagService; | |||
private final IPerformanceAppraisalScoreInfoService performanceAppraisalScoreInfoService; | |||
/** | |||
* 绩效列表 | |||
* | |||
* @param req | |||
* @return | |||
*/ | |||
@@ -80,51 +89,51 @@ public class OrgSelfAppraisalManage { | |||
UserInfoDetails user = LoginUserUtil.loginUserDetail(); | |||
//当前登录用户 单位code | |||
String empPosUnitCode = user.getEmpPosUnitCode(); | |||
String mhUnitId = user.getMhUnitIdStr(); | |||
// 获取当前登录用户的角色列表,只有单位管理员才能查看该列表 | |||
List<Role> userRoleList = user.getUserRoleList(); | |||
List<Long> roleIdList = userRoleList.stream().map(Role::getId).collect(Collectors.toList()); | |||
Role role = roleService.getOne(Wrappers.lambdaQuery(Role.class) | |||
.eq(Role::getName, RoleEnum.COMPANY_MANAGER.getDesc())); | |||
if (Objects.isNull(role)){ | |||
if (Objects.isNull(role)) { | |||
throw new BizException("登录用户没有单位管理员角色!"); | |||
} | |||
// 登录用户不是单位管理员,不能查看本单位的自评计划列表 | |||
if (!roleIdList.contains(role.getId())){ | |||
if (!roleIdList.contains(role.getId())) { | |||
return PageVo.empty(); | |||
} | |||
// 获取登录用户所在单位的所有已终验项目信息 | |||
List<Project> projectLists = projectService.list(Wrappers.lambdaQuery(Project.class) | |||
.eq(Project::getStatus, ProjectStatusEnum.ACCEPTED.getCode()) | |||
.eq(Project::getBuildOrgCode, empPosUnitCode)); | |||
.eq(Project::getBuildOrgCode, mhUnitId)); | |||
if(CollUtil.isEmpty(projectLists)){ | |||
if (CollUtil.isEmpty(projectLists)) { | |||
return PageVo.empty(); | |||
} | |||
List<Long> projectIds = projectLists.stream().map(Project::getId).collect(Collectors.toList()); | |||
// 获取添加过该单位项目的所有评价计划信息 | |||
List<PerformanceAppraisalProject> paps = performanceAppraisalProjectService.list(Wrappers.lambdaQuery(PerformanceAppraisalProject.class) | |||
.in(PerformanceAppraisalProject::getProjectId, projectIds)); | |||
if(CollUtil.isEmpty(paps)){ | |||
if (CollUtil.isEmpty(paps)) { | |||
return PageVo.empty(); | |||
} | |||
Set<Long> paIds = paps.stream().map(PerformanceAppraisalProject::getAppraisalId).collect(Collectors.toSet()); | |||
// 获取评价计划列表 | |||
Page<PerformanceAppraisal> page = req.page(); | |||
LambdaQueryWrapper<PerformanceAppraisal> wrapper = Wrappers.lambdaQuery(PerformanceAppraisal.class) | |||
.in(PerformanceAppraisal::getId,paIds) | |||
.in(PerformanceAppraisal::getId, paIds) | |||
.orderByDesc(PerformanceAppraisal::getUpdateOn); | |||
performanceAppraisalService.page(page,wrapper); | |||
if(CollUtil.isEmpty(page.getRecords())){ | |||
performanceAppraisalService.page(page, wrapper); | |||
if (CollUtil.isEmpty(page.getRecords())) { | |||
return PageVo.empty(); | |||
} | |||
List<PerformanceAppraisalVO> res = page.getRecords().stream() | |||
.map(p -> BeanUtil.copyProperties(p, PerformanceAppraisalVO.class)) | |||
.collect(Collectors.toList()); | |||
return PageVo.of(res,page.getTotal()); | |||
return PageVo.of(res, page.getTotal()); | |||
} | |||
public PageVo<PerformanceAppraisalProjectVO> pendingList(Long planId, PerformanceAppraisalListReq req) { | |||
@@ -135,11 +144,11 @@ public class OrgSelfAppraisalManage { | |||
// 获取评价计划内已添加的待评价项目信息 | |||
List<PerformanceAppraisalProject> paps = performanceAppraisalProjectService.list(Wrappers.lambdaQuery(PerformanceAppraisalProject.class) | |||
.eq(PerformanceAppraisalProject::getAppraisalId, plan.getId())).stream() | |||
.eq(PerformanceAppraisalProject::getAppraisalId, plan.getId())).stream() | |||
.filter(p -> Objects.isNull(p.getSelfAppraisalScoreTime())).collect(Collectors.toList()); | |||
Map<Long, PerformanceAppraisalProject> papsMap = paps.stream().collect(Collectors.toMap(PerformanceAppraisalProject::getProjectId, p -> p)); | |||
if(CollUtil.isEmpty(paps)){ | |||
if (CollUtil.isEmpty(paps)) { | |||
return PageVo.empty(); | |||
} | |||
@@ -149,19 +158,19 @@ public class OrgSelfAppraisalManage { | |||
LambdaQueryWrapper<Project> wrapper = Wrappers.lambdaQuery(Project.class) | |||
.in(Project::getProjectCode, projectCodes) | |||
.eq(Project::getNewest, Boolean.TRUE) | |||
.eq(Project::getBuildOrgCode, user.getEmpPosUnitCode()) | |||
.like(StringUtils.isNotBlank(req.getProjectName()),Project::getProjectName,req.getProjectName()); | |||
projectService.page(page,wrapper); | |||
.eq(Project::getBuildOrgCode, user.getMhUnitId()) | |||
.like(StringUtils.isNotBlank(req.getProjectName()), Project::getProjectName, req.getProjectName()); | |||
projectService.page(page, wrapper); | |||
if(CollUtil.isEmpty(page.getRecords())){ | |||
if (CollUtil.isEmpty(page.getRecords())) { | |||
return PageVo.empty(); | |||
} | |||
List<PerformanceAppraisalProjectVO> res = page.getRecords().stream() | |||
.map(p -> { | |||
PerformanceAppraisalProjectVO vo = BeanUtil.copyProperties(p, PerformanceAppraisalProjectVO.class); | |||
List<PerformanceAppraisalProjectVO> res = page.getRecords().stream().map(p -> { | |||
PerformanceAppraisalProjectVO vo = new PerformanceAppraisalProjectVO(); | |||
BeanUtil.copyProperties(p, vo); | |||
PerformanceAppraisalProject appraisalProject = papsMap.get(p.getId()); | |||
BeanUtil.copyProperties(appraisalProject,vo); | |||
BeanUtil.copyProperties(appraisalProject, vo); | |||
vo.setProjectId(appraisalProject.getProjectId()); | |||
vo.setProjectTypeName(ProjectTypeNewEnum.getDesc(p.getProjectType())); | |||
vo.setCanSelfAppraisal(checkCanSelfAppraisal(appraisalProject)); | |||
@@ -170,7 +179,7 @@ public class OrgSelfAppraisalManage { | |||
}) | |||
.collect(Collectors.toList()); | |||
return PageVo.of(res,page.getTotal()); | |||
return PageVo.of(res, page.getTotal()); | |||
} | |||
/** | |||
@@ -188,11 +197,11 @@ public class OrgSelfAppraisalManage { | |||
// 获取评价计划内已添加的已评价项目信息 | |||
List<PerformanceAppraisalProject> paps = performanceAppraisalProjectService.list(Wrappers.lambdaQuery(PerformanceAppraisalProject.class) | |||
.eq(PerformanceAppraisalProject::getAppraisalId, plan.getId())).stream() | |||
.eq(PerformanceAppraisalProject::getAppraisalId, plan.getId())).stream() | |||
.filter(p -> Objects.nonNull(p.getSelfAppraisalScoreTime())).collect(Collectors.toList()); | |||
Map<Long, PerformanceAppraisalProject> papsMap = paps.stream().collect(Collectors.toMap(PerformanceAppraisalProject::getProjectId, p -> p)); | |||
if(CollUtil.isEmpty(paps)){ | |||
if (CollUtil.isEmpty(paps)) { | |||
return PageVo.empty(); | |||
} | |||
@@ -202,18 +211,18 @@ public class OrgSelfAppraisalManage { | |||
LambdaQueryWrapper<Project> wrapper = Wrappers.lambdaQuery(Project.class) | |||
.in(Project::getProjectCode, projectCodes) | |||
.eq(Project::getNewest, Boolean.TRUE) | |||
.eq(Project::getBuildOrgCode, user.getEmpPosUnitCode()) | |||
.like(StringUtils.isNotBlank(req.getProjectName()),Project::getProjectName,req.getProjectName()); | |||
projectService.page(page,wrapper); | |||
.eq(Project::getBuildOrgCode, user.getMhUnitId()) | |||
.like(StringUtils.isNotBlank(req.getProjectName()), Project::getProjectName, req.getProjectName()); | |||
projectService.page(page, wrapper); | |||
if(CollUtil.isEmpty(page.getRecords())){ | |||
if (CollUtil.isEmpty(page.getRecords())) { | |||
return PageVo.empty(); | |||
} | |||
List<PerformanceAppraisalProjectVO> res = page.getRecords().stream() | |||
.map(p -> { | |||
PerformanceAppraisalProjectVO vo = BeanUtil.copyProperties(p, PerformanceAppraisalProjectVO.class); | |||
PerformanceAppraisalProject appraisalProject = papsMap.get(p.getId()); | |||
BeanUtil.copyProperties(appraisalProject,vo); | |||
BeanUtil.copyProperties(appraisalProject, vo); | |||
vo.setProjectId(appraisalProject.getProjectId()); | |||
vo.setProjectTypeName(ProjectTypeNewEnum.getDesc(p.getProjectType())); | |||
vo.setCanSelfAppraisal(checkCanSelfAppraisal(appraisalProject)); | |||
@@ -222,30 +231,27 @@ public class OrgSelfAppraisalManage { | |||
}) | |||
.collect(Collectors.toList()); | |||
return PageVo.of(res,page.getTotal()); | |||
return PageVo.of(res, page.getTotal()); | |||
} | |||
/** | |||
* 是否可以自评 | |||
* | |||
* @param appraisalProject | |||
* @return | |||
*/ | |||
private Boolean checkCanSelfAppraisal(PerformanceAppraisalProject appraisalProject) { | |||
// 在自评时间段内,且是首次自评(打分时间为空) | |||
if(LocalDateTime.now().compareTo(appraisalProject.getSelfAppraisalStart()) > 0 && | |||
if (LocalDateTime.now().compareTo(appraisalProject.getSelfAppraisalStart()) > 0 && | |||
LocalDateTime.now().compareTo(appraisalProject.getSelfAppraisalEnd()) < 0 && | |||
Objects.isNull(appraisalProject.getSelfAppraisalScoreTime())){ | |||
Objects.isNull(appraisalProject.getSelfAppraisalScoreTime())) { | |||
return Boolean.TRUE; | |||
} | |||
return Boolean.FALSE; | |||
} | |||
public ProjectAppraisalIndexDetailVO getAppraisalTemplateDetail(String projectCode) { | |||
UserInfoDetails user = LoginUserUtil.loginUserDetail(); | |||
String regionCode = user.getRegionCode(); | |||
ProjectAppraisalIndexDetailVO vo = new ProjectAppraisalIndexDetailVO(); | |||
// 根据项目编码获取最新版本的项目信息 | |||
Project project = projectService.getProjectByCode(projectCode); | |||
VUtils.isTrue(Objects.isNull(project)).throwMessage("项目不存在!"); | |||
@@ -256,7 +262,7 @@ public class OrgSelfAppraisalManage { | |||
VUtils.isTrue(Objects.isNull(approvalAmount)).throwMessage("未获取到该项目的立项批复金额"); | |||
// 根据项目code获取项目标签ID列表 | |||
List<Long> tagIdList = projectTagService.list(Wrappers.lambdaQuery(ProjectTag.class) | |||
.eq(ProjectTag::getProjectCode, projectCode)).stream() | |||
.eq(ProjectTag::getProjectCode, projectCode)).stream() | |||
.map(ProjectTag::getTagId).collect(Collectors.toList()); | |||
VUtils.isTrue(CollUtil.isEmpty(tagIdList)).throwMessage("当前项目未设置标签,匹配不到指标模板,请至项目库或评价计划编辑页面设置标签!"); | |||
@@ -264,25 +270,24 @@ public class OrgSelfAppraisalManage { | |||
String projectTagIds = String.join(StrPool.COMMA, strIdList); | |||
Integer amountRange = null; | |||
if (approvalAmount.compareTo(BigDecimal.valueOf(ProjectBizConst.FIVE_MILLION)) < 0){ | |||
if (approvalAmount.compareTo(BigDecimal.valueOf(ProjectBizConst.FIVE_MILLION)) < 0) { | |||
amountRange = ProjectBizConst.AMOUNT_RANGE_ONE; | |||
} else if (approvalAmount.compareTo(BigDecimal.valueOf(ProjectBizConst.FIVE_MILLION)) >= 0 && | |||
approvalAmount.compareTo(BigDecimal.valueOf(ProjectBizConst.TWENTY_MILLION)) < 0) { | |||
amountRange = ProjectBizConst.AMOUNT_RANGE_TWO; | |||
}else if (approvalAmount.compareTo(BigDecimal.valueOf(ProjectBizConst.TWENTY_MILLION)) >= 0){ | |||
} else if (approvalAmount.compareTo(BigDecimal.valueOf(ProjectBizConst.TWENTY_MILLION)) >= 0) { | |||
amountRange = ProjectBizConst.AMOUNT_RANGE_THREE; | |||
} | |||
LambdaQueryWrapper<PerformanceIndicatorProjectTemplate> wrapper = Wrappers.lambdaQuery(PerformanceIndicatorProjectTemplate.class) | |||
.eq(PerformanceIndicatorProjectTemplate::getRegionCode, regionCode) | |||
.eq(PerformanceIndicatorProjectTemplate::getProjectType, projectType) | |||
.eq(PerformanceIndicatorProjectTemplate::getProjectYear, projectYear) | |||
.eq(PerformanceIndicatorProjectTemplate::getAmountRange, amountRange) | |||
.eq(PerformanceIndicatorProjectTemplate::getProjectTagIds,projectTagIds) | |||
.eq(PerformanceIndicatorProjectTemplate::getStatus,CommonEnum.YES.getCode()) | |||
.eq(PerformanceIndicatorProjectTemplate::getProjectTagIds, projectTagIds) | |||
.eq(PerformanceIndicatorProjectTemplate::getStatus, CommonEnum.YES.getCode()) | |||
.orderByDesc(PerformanceIndicatorProjectTemplate::getUpdateOn); | |||
List<PerformanceIndicatorProjectTemplate> templates = indicatorProjectTemplateService.list(wrapper); | |||
VUtils.isTrue(CollUtil.isEmpty(templates)).throwMessage("该项目匹配不到指标模板,请返回上一页或者刷新重试。"); | |||
if (templates.size() > 1){ | |||
if (templates.size() > 1) { | |||
throw new BizException("当前项目匹配到多个模板,请返回模板库检查模板配置!"); | |||
} | |||
PerformanceIndicatorProjectTemplate projectTemplate = templates.get(0); | |||
@@ -290,13 +295,13 @@ public class OrgSelfAppraisalManage { | |||
// 获取模版绩效指标详情 | |||
List<PerformanceIndicatorProjectTemplateDetail> templateDetails = indicatorProjectTemplateDetailService.list(Wrappers.lambdaQuery(PerformanceIndicatorProjectTemplateDetail.class) | |||
.eq(PerformanceIndicatorProjectTemplateDetail::getTemplateId, projectTemplate.getId()) | |||
.eq(PerformanceIndicatorProjectTemplateDetail::getIsAdditional,Boolean.FALSE)); | |||
.eq(PerformanceIndicatorProjectTemplateDetail::getIsAdditional, Boolean.FALSE)); | |||
// 获取模版附加绩效指标详情 | |||
List<PerformanceIndicatorProjectTemplateDetail> additionalTemplateDetails = indicatorProjectTemplateDetailService.list(Wrappers.lambdaQuery(PerformanceIndicatorProjectTemplateDetail.class) | |||
.eq(PerformanceIndicatorProjectTemplateDetail::getTemplateId, projectTemplate.getId()) | |||
.eq(PerformanceIndicatorProjectTemplateDetail::getIsAdditional,Boolean.TRUE)); | |||
List<ProjectTemplateDetailVO> templateDetailVos = templateDetailBuildHelper.buildTemplateDetail(templateDetails,projectCode,vo); | |||
List<ProjectTemplateDetailVO> additionalTemplateDetailVos = templateDetailBuildHelper.buildTemplateDetail(additionalTemplateDetails,projectCode,vo); | |||
.eq(PerformanceIndicatorProjectTemplateDetail::getIsAdditional, Boolean.TRUE)); | |||
List<ProjectTemplateDetailVO> templateDetailVos = templateDetailBuildHelper.buildTemplateDetail(templateDetails, projectCode, vo); | |||
List<ProjectTemplateDetailVO> additionalTemplateDetailVos = templateDetailBuildHelper.buildTemplateDetail(additionalTemplateDetails, projectCode, vo); | |||
vo.setProjectName(project.getProjectName()); | |||
vo.setBuildOrgName(project.getBuildOrgName()); | |||
vo.setProjectStatus(project.getStatus()); | |||
@@ -310,8 +315,6 @@ public class OrgSelfAppraisalManage { | |||
@Transactional(rollbackFor = Exception.class) | |||
public String submitSelfAppraisal(ProjectAppraisalDTO param) { | |||
UserInfoDetails userDetail = LoginUserUtil.loginUserDetail(); | |||
String employeeCode = userDetail.getEmployeeCode(); | |||
String username = userDetail.getUsername(); | |||
Long appraisalId = param.getAppraisalId(); | |||
Long appraisalProjectId = param.getAppraisalProjectId(); | |||
String appraisalProjectCode = param.getAppraisalProjectCode(); | |||
@@ -320,12 +323,12 @@ public class OrgSelfAppraisalManage { | |||
PerformanceAppraisalProject appraisalProject = performanceAppraisalProjectService.getOne(Wrappers.lambdaQuery(PerformanceAppraisalProject.class) | |||
.eq(PerformanceAppraisalProject::getAppraisalId, appraisalId) | |||
.eq(PerformanceAppraisalProject::getProjectId, appraisalProjectId) | |||
.eq(PerformanceAppraisalProject::getProjectCode,appraisalProjectCode)); | |||
if (Objects.isNull(appraisalProject)){ | |||
.eq(PerformanceAppraisalProject::getProjectCode, appraisalProjectCode)); | |||
if (Objects.isNull(appraisalProject)) { | |||
throw new BizException("该项目已被移除评价计划,请返回上一页或者刷新重试!"); | |||
} | |||
// 根据项目模板详情ID保存自评得分、打分时间 | |||
if (CollUtil.isEmpty(appraisalInfoList)){ | |||
if (CollUtil.isEmpty(appraisalInfoList)) { | |||
throw new BizException("填写所有自评得分后才能提交!"); | |||
} | |||
List<Long> ids = appraisalInfoList.stream() | |||
@@ -334,7 +337,7 @@ public class OrgSelfAppraisalManage { | |||
// 查出项目模版详情信息 | |||
List<PerformanceIndicatorProjectTemplateDetail> detailList = indicatorProjectTemplateDetailService.list(Wrappers.lambdaQuery(PerformanceIndicatorProjectTemplateDetail.class) | |||
.in(PerformanceIndicatorProjectTemplateDetail::getId, ids)); | |||
if (CollUtil.isEmpty(detailList)){ | |||
if (CollUtil.isEmpty(detailList)) { | |||
throw new BizException("评价指标不存在!"); | |||
} | |||
Map<Long, PerformanceIndicatorProjectTemplateDetail> detailMap = detailList.stream().collect(Collectors.toMap(PerformanceIndicatorProjectTemplateDetail::getId, d -> d)); | |||
@@ -342,7 +345,7 @@ public class OrgSelfAppraisalManage { | |||
PerformanceIndicatorProjectTemplateDetail templateDetail = detailMap.get(a.getProjectTemplateDetailId()); | |||
BigDecimal score = a.getScore(); | |||
BigDecimal indexScore = templateDetail.getIndexScore(); | |||
if (score.compareTo(indexScore) > 0 || score.compareTo(BigDecimal.ZERO) < 0){ | |||
if (score.compareTo(indexScore) > 0 || score.compareTo(BigDecimal.ZERO) < 0) { | |||
throw new BizException("自评得分必须大于等于0且小于等于指标分值!"); | |||
} | |||
// 保存自评分数信息 | |||
@@ -353,17 +356,17 @@ public class OrgSelfAppraisalManage { | |||
scoreInfo.setAppraisalType(AppraisalTypeEnum.SELF_APPRAISAL.getCode()); | |||
scoreInfo.setTemplateDetailId(templateDetail.getId()); | |||
scoreInfo.setTemplateId(templateDetail.getTemplateId()); | |||
scoreInfo.setAppraisalEmployeeCode(employeeCode); | |||
scoreInfo.setAppraisalEmployeeName(username); | |||
scoreInfo.setAppraisalUserId(String.valueOf(userDetail.getUserId())); | |||
scoreInfo.setAppraisalUserName(userDetail.getRealName()); | |||
scoreInfo.setAppraisalId(appraisalId); | |||
scoreInfo.setAppraisalProjectId(appraisalProjectId); | |||
scoreInfo.setAppraisalProjectCode(appraisalProjectCode); | |||
scoreInfo.setCreateOn(LocalDateTime.now()); | |||
scoreInfo.setCreateBy(username); | |||
scoreInfo.setCreateBy(userDetail.getRealName()); | |||
return scoreInfo; | |||
}).collect(Collectors.toList()); | |||
if (performanceAppraisalScoreInfoService.saveBatch(scoreInfos)){ | |||
if (performanceAppraisalScoreInfoService.saveBatch(scoreInfos)) { | |||
// 计算自评总分并保存 | |||
BigDecimal selfAppraisalTotalScore = appraisalInfoList.stream() | |||
.map(ProjectAppraisalInfoDTO::getScore) | |||
@@ -373,7 +376,7 @@ public class OrgSelfAppraisalManage { | |||
appraisalProject.setSelfAppraisalScoreTime(LocalDateTime.now()); | |||
appraisalProject.setIsCompleteSelfAppraisal(Boolean.TRUE); | |||
appraisalProject.setUpdateOn(LocalDateTime.now()); | |||
appraisalProject.setUpdateBy(username); | |||
appraisalProject.setUpdateBy(userDetail.getRealName()); | |||
performanceAppraisalProjectService.updateById(appraisalProject); | |||
return "提交成功"; | |||
} | |||
@@ -381,48 +384,41 @@ public class OrgSelfAppraisalManage { | |||
} | |||
public void exportScore(HttpServletResponse response, PerformanceAppraisalExportReq param) { | |||
UserInfoDetails user = LoginUserUtil.loginUserDetail(); | |||
String regionCode = user.getRegionCode(); | |||
String projectCode = param.getProjectCode(); | |||
Long appraisalId = param.getAppraisalId(); | |||
// 根据项目编码获取最新版本的项目信息 | |||
Project project = projectService.getProjectByCode(projectCode); | |||
VUtils.isTrue(Objects.isNull(project)).throwMessage("项目不存在!"); | |||
Assert.notNull(project, "项目不存在!"); | |||
// 根据项目类型、预算年度、批复金额、项目标签匹配本区域指标模版 | |||
String projectType = project.getProjectType(); | |||
Integer projectYear = project.getProjectYear(); | |||
BigDecimal approvalAmount = project.getApprovalAmount(); | |||
VUtils.isTrue(Objects.isNull(approvalAmount)).throwMessage("未获取到该项目的立项批复金额"); | |||
Assert.notNull(approvalAmount, "未获取到该项目的立项批复金额"); | |||
// 根据项目code获取项目标签ID列表 | |||
List<Long> tagIdList = projectTagService.list(Wrappers.lambdaQuery(ProjectTag.class) | |||
String tagIdStr = projectTagService.list(Wrappers.lambdaQuery(ProjectTag.class) | |||
.eq(ProjectTag::getProjectCode, projectCode)).stream() | |||
.map(ProjectTag::getTagId).collect(Collectors.toList()); | |||
VUtils.isTrue(CollUtil.isEmpty(tagIdList)).throwMessage("当前项目未设置标签,匹配不到指标模板,请至项目库或评价计划编辑页面设置标签!"); | |||
List<String> strIdList = tagIdList.stream().map(String::valueOf).collect(Collectors.toList()); | |||
String projectTagIds = String.join(StrPool.COMMA, strIdList); | |||
.map(w -> w.getTagId().toString()).collect(Collectors.joining(",")); | |||
Assert.notEmpty(tagIdStr, "当前项目未设置标签,匹配不到指标模板,请至项目库或评价计划编辑页面设置标签!"); | |||
Integer amountRange = null; | |||
if (approvalAmount.compareTo(BigDecimal.valueOf(ProjectBizConst.FIVE_MILLION)) < 0){ | |||
if (approvalAmount.compareTo(BigDecimal.valueOf(ProjectBizConst.FIVE_MILLION)) < 0) { | |||
amountRange = ProjectBizConst.AMOUNT_RANGE_ONE; | |||
} else if (approvalAmount.compareTo(BigDecimal.valueOf(ProjectBizConst.FIVE_MILLION)) >= 0 && | |||
approvalAmount.compareTo(BigDecimal.valueOf(ProjectBizConst.TWENTY_MILLION)) < 0) { | |||
amountRange = ProjectBizConst.AMOUNT_RANGE_TWO; | |||
}else if (approvalAmount.compareTo(BigDecimal.valueOf(ProjectBizConst.TWENTY_MILLION)) >= 0){ | |||
} else if (approvalAmount.compareTo(BigDecimal.valueOf(ProjectBizConst.TWENTY_MILLION)) >= 0) { | |||
amountRange = ProjectBizConst.AMOUNT_RANGE_THREE; | |||
} | |||
LambdaQueryWrapper<PerformanceIndicatorProjectTemplate> wrapper = Wrappers.lambdaQuery(PerformanceIndicatorProjectTemplate.class) | |||
.eq(PerformanceIndicatorProjectTemplate::getRegionCode, regionCode) | |||
.eq(PerformanceIndicatorProjectTemplate::getProjectType, projectType) | |||
.eq(PerformanceIndicatorProjectTemplate::getProjectYear, projectYear) | |||
.eq(PerformanceIndicatorProjectTemplate::getAmountRange, amountRange) | |||
.eq(PerformanceIndicatorProjectTemplate::getProjectTagIds,projectTagIds) | |||
.eq(PerformanceIndicatorProjectTemplate::getStatus,CommonEnum.YES.getCode()) | |||
.eq(PerformanceIndicatorProjectTemplate::getProjectTagIds, tagIdStr) | |||
.eq(PerformanceIndicatorProjectTemplate::getStatus, CommonEnum.YES.getCode()) | |||
.orderByDesc(PerformanceIndicatorProjectTemplate::getUpdateOn); | |||
List<PerformanceIndicatorProjectTemplate> templates = indicatorProjectTemplateService.list(wrapper); | |||
VUtils.isTrue(CollUtil.isEmpty(templates)).throwMessage("该项目匹配不到指标模板,请返回上一页或者刷新重试。"); | |||
if (templates.size() > 1){ | |||
if (templates.size() > 1) { | |||
throw new BizException("当前项目匹配到多个模板,请返回模板库检查模板配置!"); | |||
} | |||
PerformanceIndicatorProjectTemplate projectTemplate = templates.get(0); | |||
@@ -442,7 +438,7 @@ public class OrgSelfAppraisalManage { | |||
.orderBy(Boolean.TRUE, Boolean.TRUE, PerformanceAppraisalScoreInfo::getTemplateDetailId)); | |||
Map<Long, PerformanceAppraisalScoreInfo> scoreInfoMap = scoreInfoList.stream() | |||
.collect(Collectors.toMap(PerformanceAppraisalScoreInfo::getTemplateDetailId, p -> p)); | |||
// 筛选出所有打分的三级指标模板详情ID | |||
for (PerformanceAppraisalScoreInfo scoreInfo : scoreInfoList) { | |||
SelfAppraisalScoreExportDTO thirdDto = new SelfAppraisalScoreExportDTO(); | |||
@@ -471,7 +467,7 @@ public class OrgSelfAppraisalManage { | |||
thirdDto.setSecondIndexName(secondTemplateDetail.getName()); | |||
// 一级指标名称 | |||
Long firstId = secondTemplateDetail.getParentId(); | |||
if (Objects.nonNull(firstId)){ | |||
if (Objects.nonNull(firstId)) { | |||
PerformanceIndicatorProjectTemplateDetail firstTemplateDetail = templateDetailMap.get(firstId); | |||
if (Objects.nonNull(firstTemplateDetail)) { | |||
thirdDto.setFirstIndexName(firstTemplateDetail.getName()); | |||
@@ -481,7 +477,7 @@ public class OrgSelfAppraisalManage { | |||
} | |||
if (Boolean.FALSE.equals(thirdTemplateDetail.getIsAdditional())) { | |||
exportDataList.add(thirdDto); | |||
}else { | |||
} else { | |||
exportAdditionalDataList.add(thirdDto); | |||
} | |||
} | |||
@@ -496,14 +492,13 @@ public class OrgSelfAppraisalManage { | |||
try { | |||
EasyExcel.write(response.getOutputStream(), SelfAppraisalScoreExportDTO.class) | |||
.autoCloseStream(false) | |||
.registerWriteHandler(new MultiColumnMergeStrategy(exportDataList.size(),0,1)) | |||
.registerWriteHandler(new ExcelFillCellMergeStrategy(mergeRowIndex,mergeColumnIndex)) | |||
.registerWriteHandler(new MultiColumnMergeStrategy(exportDataList.size(), 0, 1)) | |||
.registerWriteHandler(new ExcelFillCellMergeStrategy(mergeRowIndex, mergeColumnIndex)) | |||
.registerWriteHandler(ExcelExportStyle.formalStyle()) | |||
.sheet(fileName) | |||
.doWrite(exportDataList); | |||
} catch (IOException e) { | |||
throw new BizException(e); | |||
} | |||
} | |||
} |
@@ -7,6 +7,7 @@ import cn.hutool.core.util.CharsetUtil; | |||
import com.alibaba.excel.EasyExcel; | |||
import com.alibaba.excel.write.builder.ExcelWriterBuilder; | |||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | |||
import com.baomidou.mybatisplus.core.toolkit.Assert; | |||
import com.baomidou.mybatisplus.core.toolkit.Wrappers; | |||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; | |||
import com.google.common.collect.Lists; | |||
@@ -25,8 +26,8 @@ import com.hz.pm.api.performance.service.*; | |||
import com.hz.pm.api.performance.util.*; | |||
import com.hz.pm.api.portrait.model.entity.ProjectTag; | |||
import com.hz.pm.api.portrait.service.IProjectTagService; | |||
import com.hz.pm.api.projectlib.model.enumeration.ProjectTypeNewEnum; | |||
import com.hz.pm.api.projectlib.model.entity.Project; | |||
import com.hz.pm.api.projectlib.model.enumeration.ProjectTypeNewEnum; | |||
import com.hz.pm.api.projectlib.service.IProjectService; | |||
import com.hz.pm.api.sys.model.entity.Role; | |||
import com.hz.pm.api.sys.service.IRoleService; | |||
@@ -115,10 +116,7 @@ public class ReAppraisalManage { | |||
} else { | |||
empCodeList.add(reAppraisalUsers); | |||
} | |||
if (empCodeList.contains(employeeCode)) { | |||
return true; | |||
} | |||
return false; | |||
return empCodeList.contains(employeeCode); | |||
}).collect(Collectors.toList()); | |||
// 当前登录复评员用户,没有参加评价计划 | |||
if (CollUtil.isEmpty(groupList)) { | |||
@@ -150,12 +148,12 @@ public class ReAppraisalManage { | |||
/** | |||
* 是否可以复评 | |||
* | |||
* @param employeeCode | |||
* @param projectCode | |||
* @param appraisalId | |||
* @return | |||
* @param userId \ | |||
* @param projectCode \ | |||
* @param appraisalId \ | |||
* @return \ | |||
*/ | |||
private Boolean checkCanReAppraisal(String employeeCode, String projectCode, Long appraisalId) { | |||
private Boolean checkCanReAppraisal(String userId, String projectCode, Long appraisalId) { | |||
// 首次复评(复评打分时间为空) | |||
// 从绩效评价打分信息表中查询打分类型为复评、打分人员为当前登录复评用户的打分信息 | |||
// 如果没有相关的打分信息,说明是当前登录复评用户是首次复评 | |||
@@ -163,7 +161,7 @@ public class ReAppraisalManage { | |||
.eq(PerformanceAppraisalScoreInfo::getAppraisalType, AppraisalTypeEnum.RE_APPRAISAL.getCode()) | |||
.eq(PerformanceAppraisalScoreInfo::getAppraisalProjectCode, projectCode) | |||
.eq(PerformanceAppraisalScoreInfo::getAppraisalId, appraisalId) | |||
.eq(PerformanceAppraisalScoreInfo::getAppraisalEmployeeCode, employeeCode)); | |||
.eq(PerformanceAppraisalScoreInfo::getAppraisalUserId, userId)); | |||
if (CollUtil.isEmpty(scoreInfos)) { | |||
return true; | |||
} | |||
@@ -230,7 +228,7 @@ public class ReAppraisalManage { | |||
@Transactional(rollbackFor = Exception.class) | |||
public String submitReAppraisal(ProjectAppraisalDTO param) { | |||
UserInfoDetails userDetail = LoginUserUtil.loginUserDetail(); | |||
String employeeCode = userDetail.getEmployeeCode(); | |||
String userIdStr = String.valueOf(userDetail.getMhUserId()); | |||
String username = userDetail.getUsername(); | |||
Long appraisalId = param.getAppraisalId(); | |||
Long appraisalProjectId = param.getAppraisalProjectId(); | |||
@@ -270,8 +268,8 @@ public class ReAppraisalManage { | |||
scoreInfo.setAppraisalType(AppraisalTypeEnum.RE_APPRAISAL.getCode()); | |||
scoreInfo.setTemplateDetailId(templateDetail.getId()); | |||
scoreInfo.setTemplateId(templateDetail.getTemplateId()); | |||
scoreInfo.setAppraisalEmployeeCode(employeeCode); | |||
scoreInfo.setAppraisalEmployeeName(username); | |||
scoreInfo.setAppraisalUserId(userIdStr); | |||
scoreInfo.setAppraisalUserName(username); | |||
scoreInfo.setAppraisalId(appraisalId); | |||
scoreInfo.setAppraisalProjectId(appraisalProjectId); | |||
scoreInfo.setAppraisalProjectCode(appraisalProjectCode); | |||
@@ -317,7 +315,7 @@ public class ReAppraisalManage { | |||
.eq(PerformanceAppraisalScoreInfo::getAppraisalType, AppraisalTypeEnum.RE_APPRAISAL.getCode())); | |||
// 判断打分人员是否为分组内的复评人员 | |||
if (CollUtil.isNotEmpty(scoreInfoList)) { | |||
Set<String> users = scoreInfoList.stream().map(PerformanceAppraisalScoreInfo::getAppraisalEmployeeCode).collect(Collectors.toSet()); | |||
Set<String> users = scoreInfoList.stream().map(PerformanceAppraisalScoreInfo::getAppraisalUserId).collect(Collectors.toSet()); | |||
if (CollUtil.isNotEmpty(users)) { | |||
String reAppraisalUsers = group.getReAppraisalUsers(); | |||
String join = String.join(StrPool.COMMA, users); | |||
@@ -330,27 +328,22 @@ public class ReAppraisalManage { | |||
} | |||
public void exportScore(HttpServletResponse response, PerformanceAppraisalExportReq param) { | |||
UserInfoDetails user = LoginUserUtil.loginUserDetail(); | |||
String regionCode = user.getRegionCode(); | |||
String projectCode = param.getProjectCode(); | |||
Long appraisalId = param.getAppraisalId(); | |||
// 根据项目编码获取最新版本的项目信息 | |||
Project project = projectService.getProjectByCode(projectCode); | |||
VUtils.isTrue(Objects.isNull(project)).throwMessage("项目不存在!"); | |||
Assert.notNull(project, "项目不存在!"); | |||
// 根据项目类型、预算年度、批复金额、项目标签匹配本区域指标模版 | |||
String projectType = project.getProjectType(); | |||
Integer projectYear = project.getProjectYear(); | |||
BigDecimal approvalAmount = project.getApprovalAmount(); | |||
VUtils.isTrue(Objects.isNull(approvalAmount)).throwMessage("未获取到该项目的立项批复金额"); | |||
Assert.notNull(approvalAmount, "未获取到该项目的立项批复金额"); | |||
// 根据项目code获取项目标签ID列表 | |||
List<Long> tagIdList = projectTagService.list(Wrappers.lambdaQuery(ProjectTag.class) | |||
String tagIdStr = projectTagService.list(Wrappers.lambdaQuery(ProjectTag.class) | |||
.eq(ProjectTag::getProjectCode, projectCode)).stream() | |||
.map(ProjectTag::getTagId).collect(Collectors.toList()); | |||
VUtils.isTrue(CollUtil.isEmpty(tagIdList)).throwMessage("当前项目未设置标签,匹配不到指标模板,请至项目库或评价计划编辑页面设置标签!"); | |||
List<String> strIdList = tagIdList.stream().map(String::valueOf).collect(Collectors.toList()); | |||
String projectTagIds = String.join(StrPool.COMMA, strIdList); | |||
.map(w -> w.getTagId().toString()).collect(Collectors.joining(",")); | |||
Assert.notEmpty(tagIdStr, "当前项目未设置标签,匹配不到指标模板,请至项目库或评价计划编辑页面设置标签!"); | |||
Integer amountRange = null; | |||
if (approvalAmount.compareTo(BigDecimal.valueOf(ProjectBizConst.FIVE_MILLION)) < 0) { | |||
@@ -362,15 +355,14 @@ public class ReAppraisalManage { | |||
amountRange = ProjectBizConst.AMOUNT_RANGE_THREE; | |||
} | |||
LambdaQueryWrapper<PerformanceIndicatorProjectTemplate> wrapper = Wrappers.lambdaQuery(PerformanceIndicatorProjectTemplate.class) | |||
.eq(PerformanceIndicatorProjectTemplate::getRegionCode, regionCode) | |||
.eq(PerformanceIndicatorProjectTemplate::getProjectType, projectType) | |||
.eq(PerformanceIndicatorProjectTemplate::getProjectYear, projectYear) | |||
.eq(PerformanceIndicatorProjectTemplate::getAmountRange, amountRange) | |||
.eq(PerformanceIndicatorProjectTemplate::getProjectTagIds, projectTagIds) | |||
.eq(PerformanceIndicatorProjectTemplate::getProjectTagIds, tagIdStr) | |||
.eq(PerformanceIndicatorProjectTemplate::getStatus, CommonEnum.YES.getCode()) | |||
.orderByDesc(PerformanceIndicatorProjectTemplate::getUpdateOn); | |||
List<PerformanceIndicatorProjectTemplate> templates = indicatorProjectTemplateService.list(wrapper); | |||
VUtils.isTrue(CollUtil.isEmpty(templates)).throwMessage("该项目匹配不到指标模板,请返回上一页或者刷新重试。"); | |||
Assert.notEmpty(templates, "该项目匹配不到指标模板,请返回上一页或者刷新重试。"); | |||
if (templates.size() > 1) { | |||
throw new BizException("当前项目匹配到多个模板,请返回模板库检查模板配置!"); | |||
} | |||
@@ -398,7 +390,7 @@ public class ReAppraisalManage { | |||
.filter(s -> AppraisalTypeEnum.RE_APPRAISAL.getCode().equals(s.getAppraisalType())) | |||
.collect(Collectors.toList()); | |||
List<String> reUserList = reScoreInfoList.stream() | |||
.map(PerformanceAppraisalScoreInfo::getAppraisalEmployeeName) | |||
.map(PerformanceAppraisalScoreInfo::getAppraisalUserName) | |||
.collect(Collectors.toList()); | |||
// 筛选出所有打分的三级指标模板详情ID | |||
@@ -434,8 +426,8 @@ public class ReAppraisalManage { | |||
scoreMap.put(ProjectBizConst.SELF_APPRAISAL_BASIS, appraisalScoreInfo.getAppraisalBasis()); | |||
scoreMap.put(ProjectBizConst.SELF_APPRAISAL_SCORE, appraisalScoreInfo.getAppraisalScore()); | |||
} else if (AppraisalTypeEnum.RE_APPRAISAL.getCode().equals(appraisalScoreInfo.getAppraisalType())) { | |||
scoreMap.put(appraisalScoreInfo.getAppraisalEmployeeName() + ProjectBizConst.RE_APPRAISAL_BASIS, appraisalScoreInfo.getAppraisalBasis()); | |||
scoreMap.put(appraisalScoreInfo.getAppraisalEmployeeName() + ProjectBizConst.RE_APPRAISAL_SCORE, appraisalScoreInfo.getAppraisalScore()); | |||
scoreMap.put(appraisalScoreInfo.getAppraisalUserName() + ProjectBizConst.RE_APPRAISAL_BASIS, appraisalScoreInfo.getAppraisalBasis()); | |||
scoreMap.put(appraisalScoreInfo.getAppraisalUserName() + ProjectBizConst.RE_APPRAISAL_SCORE, appraisalScoreInfo.getAppraisalScore()); | |||
} | |||
if (Boolean.TRUE.equals(thirdTemplateDetail.getIsAdditional())) { | |||
@@ -456,21 +448,21 @@ public class ReAppraisalManage { | |||
// 需要从第几行开始合并 | |||
int mergeRowIndex = 2; | |||
List<ExcelHead> headList = Lists.newArrayList(); | |||
headList.add(new ExcelHead(ProjectBizConst.FIRST_INDEX_NAME, ProjectBizConst.FIRST_INDEX_TITLE, StrPool.EMPTY)); | |||
headList.add(new ExcelHead(ProjectBizConst.SECOND_INDEX_NAME, ProjectBizConst.SECOND_INDEX_TITLE, StrPool.EMPTY)); | |||
headList.add(new ExcelHead(ProjectBizConst.THIRD_INDEX_NAME, ProjectBizConst.THIRD_INDEX_TITLE, StrPool.EMPTY)); | |||
headList.add(new ExcelHead(ProjectBizConst.INDEX_SCORE, ProjectBizConst.INDEX_SCORE_TITLE, StrPool.EMPTY)); | |||
headList.add(new ExcelHead(ProjectBizConst.INDEX_DETAIL, ProjectBizConst.INDEX_DETAIL_TITLE, StrPool.EMPTY)); | |||
headList.add(new ExcelHead(ProjectBizConst.GRADE_DETAIL, ProjectBizConst.GRADE_DETAIL_TITLE, StrPool.EMPTY)); | |||
headList.add(new ExcelHead(ProjectBizConst.SUPPORT_MATERIAL, ProjectBizConst.SUPPORT_MATERIAL_TITLE, StrPool.EMPTY)); | |||
headList.add(new ExcelHead(ProjectBizConst.SELF_APPRAISAL_BASIS, ProjectBizConst.SELF_APPRAISAL_BASIS_TITLE, StrPool.EMPTY)); | |||
headList.add(new ExcelHead(ProjectBizConst.SELF_APPRAISAL_SCORE, ProjectBizConst.SELF_APPRAISAL_SCORE_TITLE, StrPool.EMPTY)); | |||
List<ExcelHead<Object>> headList = Lists.newArrayList(); | |||
headList.add(new ExcelHead<>(ProjectBizConst.FIRST_INDEX_NAME, ProjectBizConst.FIRST_INDEX_TITLE, StrPool.EMPTY)); | |||
headList.add(new ExcelHead<>(ProjectBizConst.SECOND_INDEX_NAME, ProjectBizConst.SECOND_INDEX_TITLE, StrPool.EMPTY)); | |||
headList.add(new ExcelHead<>(ProjectBizConst.THIRD_INDEX_NAME, ProjectBizConst.THIRD_INDEX_TITLE, StrPool.EMPTY)); | |||
headList.add(new ExcelHead<>(ProjectBizConst.INDEX_SCORE, ProjectBizConst.INDEX_SCORE_TITLE, StrPool.EMPTY)); | |||
headList.add(new ExcelHead<>(ProjectBizConst.INDEX_DETAIL, ProjectBizConst.INDEX_DETAIL_TITLE, StrPool.EMPTY)); | |||
headList.add(new ExcelHead<>(ProjectBizConst.GRADE_DETAIL, ProjectBizConst.GRADE_DETAIL_TITLE, StrPool.EMPTY)); | |||
headList.add(new ExcelHead<>(ProjectBizConst.SUPPORT_MATERIAL, ProjectBizConst.SUPPORT_MATERIAL_TITLE, StrPool.EMPTY)); | |||
headList.add(new ExcelHead<>(ProjectBizConst.SELF_APPRAISAL_BASIS, ProjectBizConst.SELF_APPRAISAL_BASIS_TITLE, StrPool.EMPTY)); | |||
headList.add(new ExcelHead<>(ProjectBizConst.SELF_APPRAISAL_SCORE, ProjectBizConst.SELF_APPRAISAL_SCORE_TITLE, StrPool.EMPTY)); | |||
for (String reUser : reUserList) { | |||
headList.add(new ExcelHead(reUser + ProjectBizConst.RE_APPRAISAL_BASIS, ProjectBizConst.RE_APPRAISAL_BASIS_TITLE, StrPool.EMPTY)); | |||
headList.add(new ExcelHead(reUser + ProjectBizConst.RE_APPRAISAL_SCORE, ProjectBizConst.RE_APPRAISAL_SCORE_TITLE, StrPool.EMPTY)); | |||
headList.add(new ExcelHead<>(reUser + ProjectBizConst.RE_APPRAISAL_BASIS, ProjectBizConst.RE_APPRAISAL_BASIS_TITLE, StrPool.EMPTY)); | |||
headList.add(new ExcelHead<>(reUser + ProjectBizConst.RE_APPRAISAL_SCORE, ProjectBizConst.RE_APPRAISAL_SCORE_TITLE, StrPool.EMPTY)); | |||
} | |||
headList.add(new ExcelHead(ProjectBizConst.IS_ADDITIONAL, ProjectBizConst.IS_ADDITIONAL_TITLE, StrPool.EMPTY)); | |||
headList.add(new ExcelHead<>(ProjectBizConst.IS_ADDITIONAL, ProjectBizConst.IS_ADDITIONAL_TITLE, StrPool.EMPTY)); | |||
// 数据导出处理函数 | |||
try { | |||
@@ -1,52 +1,50 @@ | |||
package com.hz.pm.api.performance.manage; | |||
import java.math.BigDecimal; | |||
import java.time.LocalDateTime; | |||
import java.util.*; | |||
import java.util.stream.Collectors; | |||
import cn.hutool.core.bean.BeanUtil; | |||
import cn.hutool.core.collection.CollUtil; | |||
import cn.hutool.core.text.StrPool; | |||
import com.google.common.collect.Lists; | |||
import com.hz.pm.api.performance.enumration.AppraisalTypeEnum; | |||
import com.hz.pm.api.performance.enumration.RectifyAuditEnum; | |||
import com.hz.pm.api.performance.model.dto.ProjectAppraisalInfoDTO; | |||
import com.hz.pm.api.performance.model.entity.*; | |||
import com.hz.pm.api.performance.service.*; | |||
import com.hz.pm.api.projectlib.model.enumeration.ProjectTypeNewEnum; | |||
import org.apache.commons.lang3.StringUtils; | |||
import org.springframework.stereotype.Component; | |||
import org.springframework.transaction.annotation.Transactional; | |||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | |||
import com.baomidou.mybatisplus.core.toolkit.Wrappers; | |||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; | |||
import com.ningdatech.basic.exception.BizException; | |||
import com.ningdatech.basic.function.VUtils; | |||
import com.ningdatech.basic.model.PageVo; | |||
import com.google.common.collect.Lists; | |||
import com.hz.pm.api.common.helper.UserInfoHelper; | |||
import com.hz.pm.api.performance.enumration.AppraisalTypeEnum; | |||
import com.hz.pm.api.performance.enumration.RectifyAuditEnum; | |||
import com.hz.pm.api.performance.enumration.RectifyStatusEnum; | |||
import com.hz.pm.api.performance.model.dto.ProjectAppraisalDTO; | |||
import com.hz.pm.api.performance.model.dto.ProjectAppraisalInfoDTO; | |||
import com.hz.pm.api.performance.model.entity.*; | |||
import com.hz.pm.api.performance.model.req.PerformanceAppraisalListReq; | |||
import com.hz.pm.api.performance.model.vo.PerformanceAppraisalProjectVO; | |||
import com.hz.pm.api.performance.model.vo.PerformanceAppraisalVO; | |||
import com.hz.pm.api.performance.service.*; | |||
import com.hz.pm.api.projectlib.model.entity.Project; | |||
import com.hz.pm.api.projectlib.model.enumeration.ProjectTypeNewEnum; | |||
import com.hz.pm.api.projectlib.service.IProjectService; | |||
import com.hz.pm.api.sys.model.entity.Role; | |||
import com.hz.pm.api.sys.service.IRoleService; | |||
import com.hz.pm.api.user.model.enumeration.RoleEnum; | |||
import com.hz.pm.api.user.security.model.UserInfoDetails; | |||
import com.hz.pm.api.user.util.LoginUserUtil; | |||
import cn.hutool.core.bean.BeanUtil; | |||
import cn.hutool.core.collection.CollUtil; | |||
import com.ningdatech.basic.exception.BizException; | |||
import com.ningdatech.basic.function.VUtils; | |||
import com.ningdatech.basic.model.PageVo; | |||
import lombok.AllArgsConstructor; | |||
import lombok.extern.slf4j.Slf4j; | |||
import org.apache.commons.lang3.StringUtils; | |||
import org.springframework.stereotype.Component; | |||
import org.springframework.transaction.annotation.Transactional; | |||
import java.math.BigDecimal; | |||
import java.time.LocalDateTime; | |||
import java.util.*; | |||
import java.util.stream.Collectors; | |||
/** | |||
* RectifyAuditManage | |||
* | |||
* @return | |||
* | |||
* @author CMM | |||
* @return | |||
* @since 2023/08/12 17:36 | |||
*/ | |||
@Component | |||
@@ -62,9 +60,10 @@ public class RectifyAuditManage { | |||
private final IPerformanceAppraisalProjectGroupService groupService; | |||
private final IPerformanceIndicatorProjectTemplateDetailService indicatorProjectTemplateDetailService; | |||
private final IPerformanceAppraisalScoreInfoService performanceAppraisalScoreInfoService; | |||
/** | |||
* 绩效列表 | |||
* | |||
* | |||
* @param req | |||
* @return | |||
*/ | |||
@@ -163,9 +162,9 @@ public class RectifyAuditManage { | |||
// 因为一个核查用户只能出现在一个评价计划中的一个分组中,所以根据评价计划ID和核查组长信息可以确定分组内项目信息 | |||
PerformanceAppraisalProjectGroup projectGroup = | |||
groupService.getOne(Wrappers.lambdaQuery(PerformanceAppraisalProjectGroup.class) | |||
.eq(PerformanceAppraisalProjectGroup::getAppraisalId, planId) | |||
.eq(PerformanceAppraisalProjectGroup::getVerifyLeader, employeeCode)); | |||
groupService.getOne(Wrappers.lambdaQuery(PerformanceAppraisalProjectGroup.class) | |||
.eq(PerformanceAppraisalProjectGroup::getAppraisalId, planId) | |||
.eq(PerformanceAppraisalProjectGroup::getVerifyLeader, employeeCode)); | |||
// 当前登录专家没有为核查组长的绩效分组信息 | |||
if (Objects.isNull(projectGroup)) { | |||
return PageVo.empty(); | |||
@@ -180,25 +179,25 @@ public class RectifyAuditManage { | |||
} | |||
// 获取评价计划内已添加的核查组长为当前登录专家用户的待整改审核项目信息 | |||
List<PerformanceAppraisalProject> paps = | |||
performanceAppraisalProjectService.list(Wrappers.lambdaQuery(PerformanceAppraisalProject.class) | |||
.eq(PerformanceAppraisalProject::getAppraisalId, plan.getId()) | |||
.in(PerformanceAppraisalProject::getProjectCode, codes) | |||
.eq(PerformanceAppraisalProject::getIsRectify, Boolean.TRUE) | |||
.eq(PerformanceAppraisalProject::getRectifyStatus, RectifyStatusEnum.TO_BE_REVIEWED.getCode())); | |||
performanceAppraisalProjectService.list(Wrappers.lambdaQuery(PerformanceAppraisalProject.class) | |||
.eq(PerformanceAppraisalProject::getAppraisalId, plan.getId()) | |||
.in(PerformanceAppraisalProject::getProjectCode, codes) | |||
.eq(PerformanceAppraisalProject::getIsRectify, Boolean.TRUE) | |||
.eq(PerformanceAppraisalProject::getRectifyStatus, RectifyStatusEnum.TO_BE_REVIEWED.getCode())); | |||
if (CollUtil.isEmpty(paps)) { | |||
return PageVo.empty(); | |||
} | |||
Map<Long, PerformanceAppraisalProject> papsMap = | |||
paps.stream().collect(Collectors.toMap(PerformanceAppraisalProject::getProjectId, p -> p)); | |||
paps.stream().collect(Collectors.toMap(PerformanceAppraisalProject::getProjectId, p -> p)); | |||
// 获取本单位在当前评价计划内的项目 | |||
Set<String> projectCodes = | |||
paps.stream().map(PerformanceAppraisalProject::getProjectCode).collect(Collectors.toSet()); | |||
paps.stream().map(PerformanceAppraisalProject::getProjectCode).collect(Collectors.toSet()); | |||
Page<Project> page = req.page(); | |||
LambdaQueryWrapper<Project> wrapper = Wrappers.lambdaQuery(Project.class) | |||
.in(Project::getProjectCode, projectCodes).eq(Project::getNewest, Boolean.TRUE) | |||
.like(StringUtils.isNotBlank(req.getBuildOrgName()), Project::getBuildOrgName, req.getBuildOrgName()) | |||
.like(StringUtils.isNotBlank(req.getProjectName()), Project::getProjectName, req.getProjectName()); | |||
.in(Project::getProjectCode, projectCodes).eq(Project::getNewest, Boolean.TRUE) | |||
.like(StringUtils.isNotBlank(req.getBuildOrgName()), Project::getBuildOrgName, req.getBuildOrgName()) | |||
.like(StringUtils.isNotBlank(req.getProjectName()), Project::getProjectName, req.getProjectName()); | |||
projectService.page(page, wrapper); | |||
if (CollUtil.isEmpty(page.getRecords())) { | |||
@@ -231,9 +230,9 @@ public class RectifyAuditManage { | |||
// 因为一个核查用户只能出现在一个评价计划中的一个分组中,所以根据评价计划ID和核查组长信息可以确定分组内项目信息 | |||
PerformanceAppraisalProjectGroup projectGroup = | |||
groupService.getOne(Wrappers.lambdaQuery(PerformanceAppraisalProjectGroup.class) | |||
.eq(PerformanceAppraisalProjectGroup::getAppraisalId, planId) | |||
.eq(PerformanceAppraisalProjectGroup::getVerifyLeader, employeeCode)); | |||
groupService.getOne(Wrappers.lambdaQuery(PerformanceAppraisalProjectGroup.class) | |||
.eq(PerformanceAppraisalProjectGroup::getAppraisalId, planId) | |||
.eq(PerformanceAppraisalProjectGroup::getVerifyLeader, employeeCode)); | |||
// 当前登录专家没有为核查组长的绩效分组信息 | |||
if (Objects.isNull(projectGroup)) { | |||
return PageVo.empty(); | |||
@@ -248,28 +247,28 @@ public class RectifyAuditManage { | |||
} | |||
// 获取评价计划内已添加的核查组长为当前登录专家用户的已整改审核项目信息 | |||
List< | |||
PerformanceAppraisalProject> paps = | |||
PerformanceAppraisalProject> paps = | |||
performanceAppraisalProjectService.list(Wrappers.lambdaQuery(PerformanceAppraisalProject.class) | |||
.eq(PerformanceAppraisalProject::getAppraisalId, plan.getId()) | |||
.in(PerformanceAppraisalProject::getProjectCode, codes) | |||
.eq(PerformanceAppraisalProject::getIsRectify, Boolean.TRUE) | |||
.and(wp -> wp | |||
.eq(PerformanceAppraisalProject::getRectifyStatus, RectifyStatusEnum.NOT_APPROVED.getCode()) | |||
.or().eq(PerformanceAppraisalProject::getRectifyStatus, RectifyStatusEnum.APPROVED.getCode()))); | |||
.eq(PerformanceAppraisalProject::getAppraisalId, plan.getId()) | |||
.in(PerformanceAppraisalProject::getProjectCode, codes) | |||
.eq(PerformanceAppraisalProject::getIsRectify, Boolean.TRUE) | |||
.and(wp -> wp | |||
.eq(PerformanceAppraisalProject::getRectifyStatus, RectifyStatusEnum.NOT_APPROVED.getCode()) | |||
.or().eq(PerformanceAppraisalProject::getRectifyStatus, RectifyStatusEnum.APPROVED.getCode()))); | |||
if (CollUtil.isEmpty(paps)) { | |||
return PageVo.empty(); | |||
} | |||
Map<Long, PerformanceAppraisalProject> papsMap = | |||
paps.stream().collect(Collectors.toMap(PerformanceAppraisalProject::getProjectId, p -> p)); | |||
paps.stream().collect(Collectors.toMap(PerformanceAppraisalProject::getProjectId, p -> p)); | |||
// 获取评价计划内的项目 | |||
Set<String> projectCodes = | |||
paps.stream().map(PerformanceAppraisalProject::getProjectCode).collect(Collectors.toSet()); | |||
paps.stream().map(PerformanceAppraisalProject::getProjectCode).collect(Collectors.toSet()); | |||
Page<Project> page = req.page(); | |||
LambdaQueryWrapper<Project> wrapper = Wrappers.lambdaQuery(Project.class) | |||
.in(Project::getProjectCode, projectCodes).eq(Project::getNewest, Boolean.TRUE) | |||
.like(StringUtils.isNotBlank(req.getBuildOrgName()), Project::getBuildOrgName, req.getBuildOrgName()) | |||
.like(StringUtils.isNotBlank(req.getProjectName()), Project::getProjectName, req.getProjectName()); | |||
.in(Project::getProjectCode, projectCodes).eq(Project::getNewest, Boolean.TRUE) | |||
.like(StringUtils.isNotBlank(req.getBuildOrgName()), Project::getBuildOrgName, req.getBuildOrgName()) | |||
.like(StringUtils.isNotBlank(req.getProjectName()), Project::getProjectName, req.getProjectName()); | |||
projectService.page(page, wrapper); | |||
if (CollUtil.isEmpty(page.getRecords())) { | |||
@@ -296,7 +295,7 @@ public class RectifyAuditManage { | |||
@Transactional(rollbackFor = Exception.class) | |||
public String submit(ProjectAppraisalDTO param) { | |||
UserInfoDetails userDetail = LoginUserUtil.loginUserDetail(); | |||
String employeeCode = userDetail.getEmployeeCode(); | |||
String userIdStr = String.valueOf(userDetail.getUserId()); | |||
String username = userDetail.getUsername(); | |||
Long appraisalId = param.getAppraisalId(); | |||
Long appraisalProjectId = param.getAppraisalProjectId(); | |||
@@ -305,13 +304,11 @@ public class RectifyAuditManage { | |||
String rectifyAuditOpinion = param.getRectifyAuditOpinion(); | |||
String rectifyAuditAppendix = param.getRectifyAuditAppendix(); | |||
List<ProjectAppraisalInfoDTO> appraisalInfoList = param.getAppraisalInfoList(); | |||
Long groupId = param.getGroupId(); | |||
PerformanceAppraisalProjectGroup group = groupService.getById(groupId); | |||
// 获取评价项目 | |||
PerformanceAppraisalProject appraisalProject = performanceAppraisalProjectService.getOne(Wrappers.lambdaQuery(PerformanceAppraisalProject.class) | |||
.eq(PerformanceAppraisalProject::getAppraisalId, appraisalId) | |||
.eq(PerformanceAppraisalProject::getProjectCode,appraisalProjectCode) | |||
.eq(PerformanceAppraisalProject::getProjectCode, appraisalProjectCode) | |||
.eq(PerformanceAppraisalProject::getProjectId, appraisalProjectId)); | |||
List<Long> ids = appraisalInfoList.stream() | |||
@@ -320,7 +317,7 @@ public class RectifyAuditManage { | |||
// 查出项目模版详情信息 | |||
List<PerformanceIndicatorProjectTemplateDetail> detailList = indicatorProjectTemplateDetailService.list(Wrappers.lambdaQuery(PerformanceIndicatorProjectTemplateDetail.class) | |||
.in(PerformanceIndicatorProjectTemplateDetail::getId, ids)); | |||
if (CollUtil.isEmpty(detailList)){ | |||
if (CollUtil.isEmpty(detailList)) { | |||
throw new BizException("评价指标不存在!"); | |||
} | |||
Map<Long, PerformanceIndicatorProjectTemplateDetail> detailMap = detailList.stream().collect(Collectors.toMap(PerformanceIndicatorProjectTemplateDetail::getId, d -> d)); | |||
@@ -328,7 +325,7 @@ public class RectifyAuditManage { | |||
PerformanceIndicatorProjectTemplateDetail templateDetail = detailMap.get(a.getProjectTemplateDetailId()); | |||
BigDecimal score = a.getScore(); | |||
BigDecimal indexScore = templateDetail.getIndexScore(); | |||
if (score.compareTo(indexScore) > 0 || score.compareTo(BigDecimal.ZERO) < 0){ | |||
if (score.compareTo(indexScore) > 0 || score.compareTo(BigDecimal.ZERO) < 0) { | |||
throw new BizException("核查审核得分必须大于等于0且小于等于指标分值!"); | |||
} | |||
// 保存核查分数信息 | |||
@@ -339,8 +336,8 @@ public class RectifyAuditManage { | |||
scoreInfo.setAppraisalType(AppraisalTypeEnum.EXPERT_RECTIFY_AUDIT.getCode()); | |||
scoreInfo.setTemplateDetailId(templateDetail.getId()); | |||
scoreInfo.setTemplateId(templateDetail.getTemplateId()); | |||
scoreInfo.setAppraisalEmployeeCode(employeeCode); | |||
scoreInfo.setAppraisalEmployeeName(username); | |||
scoreInfo.setAppraisalUserId(userIdStr); | |||
scoreInfo.setAppraisalUserName(username); | |||
scoreInfo.setAppraisalId(appraisalId); | |||
scoreInfo.setAppraisalProjectId(appraisalProjectId); | |||
scoreInfo.setAppraisalProjectCode(appraisalProjectCode); | |||
@@ -349,7 +346,7 @@ public class RectifyAuditManage { | |||
return scoreInfo; | |||
}).collect(Collectors.toList()); | |||
if (performanceAppraisalScoreInfoService.saveBatch(scoreInfos)){ | |||
if (performanceAppraisalScoreInfoService.saveBatch(scoreInfos)) { | |||
// 计算核查总分并保存 | |||
BigDecimal rectifyTotalScore = appraisalInfoList.stream() | |||
.map(ProjectAppraisalInfoDTO::getScore) | |||
@@ -2,10 +2,13 @@ package com.hz.pm.api.performance.manage; | |||
import cn.hutool.core.bean.BeanUtil; | |||
import cn.hutool.core.collection.CollUtil; | |||
import com.baomidou.mybatisplus.core.conditions.Wrapper; | |||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | |||
import com.baomidou.mybatisplus.core.toolkit.Assert; | |||
import com.baomidou.mybatisplus.core.toolkit.Wrappers; | |||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; | |||
import com.hz.pm.api.common.helper.UserInfoHelper; | |||
import com.hz.pm.api.common.util.StrUtils; | |||
import com.hz.pm.api.performance.enumration.RectifyStatusEnum; | |||
import com.hz.pm.api.performance.model.dto.ProjectAppraisalDTO; | |||
import com.hz.pm.api.performance.model.entity.PerformanceAppraisal; | |||
@@ -70,12 +73,12 @@ public class RectifyManage { | |||
UserInfoDetails user = LoginUserUtil.loginUserDetail(); | |||
// 当前登录用户 单位code | |||
String empPosUnitCode = user.getEmpPosUnitCode(); | |||
String mhUnitId = user.getMhUnitIdStr(); | |||
// 获取当前登录用户的角色列表,只有单位管理员才能查看该列表 | |||
List<Role> userRoleList = user.getUserRoleList(); | |||
List<Long> roleIdList = userRoleList.stream().map(Role::getId).collect(Collectors.toList()); | |||
Role role = | |||
roleService.getOne(Wrappers.lambdaQuery(Role.class).eq(Role::getName, RoleEnum.COMPANY_MANAGER.getDesc())); | |||
Role role = roleService.getOne(Wrappers.lambdaQuery(Role.class) | |||
.eq(Role::getName, RoleEnum.COMPANY_MANAGER.getDesc())); | |||
if (Objects.isNull(role)) { | |||
throw new BizException("登录用户没有单位管理员角色!"); | |||
} | |||
@@ -87,7 +90,7 @@ public class RectifyManage { | |||
// 获取登录用户所在单位的所有已终验项目信息 | |||
List<Project> projectLists = projectService.list(Wrappers.lambdaQuery(Project.class) | |||
.eq(Project::getStatus, ProjectStatusEnum.ACCEPTED.getCode()).eq(Project::getBuildOrgCode, empPosUnitCode)); | |||
.eq(Project::getStatus, ProjectStatusEnum.ACCEPTED.getCode()).eq(Project::getBuildOrgCode, mhUnitId)); | |||
if (CollUtil.isEmpty(projectLists)) { | |||
return PageVo.empty(); | |||
@@ -161,7 +164,7 @@ public class RectifyManage { | |||
Page<Project> page = req.page(); | |||
LambdaQueryWrapper<Project> wrapper = | |||
Wrappers.lambdaQuery(Project.class).in(Project::getProjectCode, projectCodes) | |||
.eq(Project::getNewest, Boolean.TRUE).eq(Project::getBuildOrgCode, user.getEmpPosUnitCode()) | |||
.eq(Project::getNewest, Boolean.TRUE).eq(Project::getBuildOrgCode, user.getMhUnitId()) | |||
.like(StringUtils.isNotBlank(req.getProjectName()), Project::getProjectName, req.getProjectName()); | |||
projectService.page(page, wrapper); | |||
@@ -189,7 +192,7 @@ public class RectifyManage { | |||
UserInfoDetails user = LoginUserUtil.loginUserDetail(); | |||
PerformanceAppraisal plan = performanceAppraisalService.getById(planId); | |||
VUtils.isTrue(Objects.isNull(plan)).throwMessage("该评价计划不存在!"); | |||
Assert.notNull(plan, "该评价计划不存在!"); | |||
// 获取评价计划内已添加的已整改项目信息 | |||
List<PerformanceAppraisalProject> paps = | |||
@@ -199,8 +202,6 @@ public class RectifyManage { | |||
.and(wp -> wp | |||
.eq(PerformanceAppraisalProject::getRectifyStatus, RectifyStatusEnum.TO_BE_REVIEWED.getCode()).or() | |||
.eq(PerformanceAppraisalProject::getRectifyStatus, RectifyStatusEnum.APPROVED.getCode()))); | |||
Map<Long, PerformanceAppraisalProject> papsMap = | |||
paps.stream().collect(Collectors.toMap(PerformanceAppraisalProject::getProjectId, p -> p)); | |||
if (CollUtil.isEmpty(paps)) { | |||
return PageVo.empty(); | |||
@@ -210,15 +211,19 @@ public class RectifyManage { | |||
Set<String> projectCodes = | |||
paps.stream().map(PerformanceAppraisalProject::getProjectCode).collect(Collectors.toSet()); | |||
Page<Project> page = req.page(); | |||
LambdaQueryWrapper<Project> wrapper = | |||
Wrappers.lambdaQuery(Project.class).in(Project::getProjectCode, projectCodes) | |||
.eq(Project::getNewest, Boolean.TRUE).eq(Project::getBuildOrgCode, user.getEmpPosUnitCode()) | |||
.like(StringUtils.isNotBlank(req.getProjectName()), Project::getProjectName, req.getProjectName()); | |||
LambdaQueryWrapper<Project> wrapper = Wrappers.lambdaQuery(Project.class) | |||
.in(Project::getProjectCode, projectCodes) | |||
.eq(Project::getNewest, Boolean.TRUE) | |||
.eq(Project::getBuildOrgCode, user.getMhUnitId()) | |||
.like(StrUtils.isNotBlank(req.getProjectName()), Project::getProjectName, req.getProjectName()); | |||
projectService.page(page, wrapper); | |||
if (CollUtil.isEmpty(page.getRecords())) { | |||
return PageVo.empty(); | |||
} | |||
Map<Long, PerformanceAppraisalProject> papsMap = paps.stream() | |||
.collect(Collectors.toMap(PerformanceAppraisalProject::getProjectId, p -> p)); | |||
List<PerformanceAppraisalProjectVO> res = page.getRecords().stream().map(p -> { | |||
PerformanceAppraisalProjectVO vo = BeanUtil.copyProperties(p, PerformanceAppraisalProjectVO.class); | |||
PerformanceAppraisalProject appraisalProject = papsMap.get(p.getId()); | |||
@@ -239,19 +244,20 @@ public class RectifyManage { | |||
RectifyDetailVO vo = new RectifyDetailVO(); | |||
// 根据评价计划ID和项目编号获取评价项目信息 | |||
PerformanceAppraisalProject appraisalProject = performanceAppraisalProjectService.getOne(Wrappers | |||
.lambdaQuery(PerformanceAppraisalProject.class).eq(PerformanceAppraisalProject::getAppraisalId, planId) | |||
.lambdaQuery(PerformanceAppraisalProject.class) | |||
.eq(PerformanceAppraisalProject::getAppraisalId, planId) | |||
.eq(PerformanceAppraisalProject::getProjectCode, projectCode)); | |||
VUtils.isTrue(Objects.isNull(appraisalProject)).throwMessage("该项目已被移除评价计划,请返回上一页或者刷新重试!!"); | |||
Assert.notNull(appraisalProject, "该项目已被移除评价计划,请返回上一页或者刷新重试!"); | |||
BeanUtils.copyProperties(appraisalProject, vo); | |||
String rectifySubmitEmployeeCode = appraisalProject.getRectifySubmitEmployeeCode(); | |||
if (StringUtils.isNotBlank(rectifySubmitEmployeeCode)) { | |||
UserFullInfoDTO userFullInfoDto = userInfoHelper.getUserFullInfoByEmployeeCode(rectifySubmitEmployeeCode); | |||
vo.setRectifySubmitEmployee(userFullInfoDto); | |||
String rectifySubmitUserId = appraisalProject.getRectifySubmitUserId(); | |||
if (StrUtils.isNotBlank(rectifySubmitUserId)) { | |||
UserFullInfoDTO userFullInfoDto = userInfoHelper.getUserFullInfo(rectifySubmitUserId); | |||
vo.setRectifySubmitUser(userFullInfoDto); | |||
} | |||
String rectifyResSubEmpCode = appraisalProject.getRectifyResSubEmpCode(); | |||
if (StringUtils.isNotBlank(rectifyResSubEmpCode)) { | |||
UserFullInfoDTO userFullInfoDto = userInfoHelper.getUserFullInfoByEmployeeCode(rectifyResSubEmpCode); | |||
vo.setRectifyResSubEmployee(userFullInfoDto); | |||
String rectifyResSubUserId = appraisalProject.getRectifyResSubUserId(); | |||
if (StrUtils.isNotBlank(rectifyResSubUserId)) { | |||
UserFullInfoDTO userFullInfoDto = userInfoHelper.getUserFullInfo(rectifyResSubUserId); | |||
vo.setRectifyResSubUser(userFullInfoDto); | |||
} | |||
vo.setRectifyStatusName(RectifyStatusEnum.getDesc(appraisalProject.getRectifyStatus())); | |||
return vo; | |||
@@ -260,7 +266,7 @@ public class RectifyManage { | |||
@Transactional(rollbackFor = Exception.class) | |||
public String fillOutResult(ProjectAppraisalDTO param) { | |||
UserInfoDetails userDetail = LoginUserUtil.loginUserDetail(); | |||
String employeeCode = userDetail.getEmployeeCode(); | |||
String userIdStr = String.valueOf(userDetail.getUserId()); | |||
String username = userDetail.getUsername(); | |||
Long appraisalId = param.getAppraisalId(); | |||
@@ -270,16 +276,17 @@ public class RectifyManage { | |||
String rectifyResultAppendix = param.getRectifyResultAppendix(); | |||
// 判断该项目是否还存在于计划或分组中 | |||
PerformanceAppraisalProject appraisalProject = performanceAppraisalProjectService.getOne(Wrappers | |||
.lambdaQuery(PerformanceAppraisalProject.class).eq(PerformanceAppraisalProject::getAppraisalId, appraisalId) | |||
Wrapper<PerformanceAppraisalProject> query = Wrappers.lambdaQuery(PerformanceAppraisalProject.class) | |||
.eq(PerformanceAppraisalProject::getAppraisalId, appraisalId) | |||
.eq(PerformanceAppraisalProject::getProjectId, appraisalProjectId) | |||
.eq(PerformanceAppraisalProject::getProjectCode, appraisalProjectCode)); | |||
.eq(PerformanceAppraisalProject::getProjectCode, appraisalProjectCode); | |||
PerformanceAppraisalProject appraisalProject = performanceAppraisalProjectService.getOne(query); | |||
if (Objects.isNull(appraisalProject)) { | |||
throw new BizException("该项目已被移除评价计划,请返回上一页或者刷新重试!"); | |||
} | |||
appraisalProject.setRectifyResult(rectifyResult); | |||
appraisalProject.setRectifyResultAppendix(rectifyResultAppendix); | |||
appraisalProject.setRectifyResSubEmpCode(employeeCode); | |||
appraisalProject.setRectifyResSubUserId(userIdStr); | |||
appraisalProject.setRectifyResSubTime(LocalDateTime.now()); | |||
// 更新整改状态为整改待审核 | |||
appraisalProject.setRectifyStatus(RectifyStatusEnum.TO_BE_REVIEWED.getCode()); | |||
@@ -2,15 +2,19 @@ package com.hz.pm.api.performance.manage; | |||
import cn.hutool.core.bean.BeanUtil; | |||
import cn.hutool.core.collection.CollUtil; | |||
import cn.hutool.core.lang.Assert; | |||
import cn.hutool.core.map.MapUtil; | |||
import cn.hutool.core.util.CharsetUtil; | |||
import cn.hutool.core.util.NumberUtil; | |||
import com.alibaba.excel.EasyExcel; | |||
import com.alibaba.excel.write.builder.ExcelWriterBuilder; | |||
import com.baomidou.mybatisplus.core.conditions.Wrapper; | |||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | |||
import com.baomidou.mybatisplus.core.toolkit.Wrappers; | |||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; | |||
import com.google.common.collect.Lists; | |||
import com.hz.pm.api.common.enumeration.CommonEnum; | |||
import com.hz.pm.api.common.model.constant.BizConst; | |||
import com.hz.pm.api.common.util.ExcelDownUtil; | |||
import com.hz.pm.api.performance.constant.ProjectBizConst; | |||
import com.hz.pm.api.performance.enumration.AppraisalTypeEnum; | |||
@@ -26,8 +30,8 @@ import com.hz.pm.api.performance.service.*; | |||
import com.hz.pm.api.performance.util.*; | |||
import com.hz.pm.api.portrait.model.entity.ProjectTag; | |||
import com.hz.pm.api.portrait.service.IProjectTagService; | |||
import com.hz.pm.api.projectlib.model.enumeration.ProjectTypeNewEnum; | |||
import com.hz.pm.api.projectlib.model.entity.Project; | |||
import com.hz.pm.api.projectlib.model.enumeration.ProjectTypeNewEnum; | |||
import com.hz.pm.api.projectlib.service.IProjectService; | |||
import com.hz.pm.api.sys.model.entity.Role; | |||
import com.hz.pm.api.sys.service.IRoleService; | |||
@@ -47,6 +51,7 @@ import org.springframework.transaction.annotation.Transactional; | |||
import javax.servlet.http.HttpServletResponse; | |||
import java.io.IOException; | |||
import java.math.BigDecimal; | |||
import java.math.RoundingMode; | |||
import java.time.LocalDateTime; | |||
import java.util.*; | |||
import java.util.stream.Collectors; | |||
@@ -139,31 +144,28 @@ public class VerifyManage { | |||
/** | |||
* 是否可以核查 | |||
* | |||
* @param employeeCode | |||
* @param projectCode | |||
* @param appraisalId | |||
* @return | |||
* @param userId \ | |||
* @param projectCode \ | |||
* @param appraisalId \ | |||
* @return \ | |||
*/ | |||
private Boolean checkCanVerify(String employeeCode, String projectCode, Long appraisalId) { | |||
private Boolean checkCanVerify(String userId, String projectCode, Long appraisalId) { | |||
// 首次核查(核查打分信息为空) | |||
// 从绩效评价打分信息表中查询打分类型为专家核查、打分人员为当前登录专家用户的打分信息 | |||
// 如果没有相关的打分信息,说明是当前登录复评用户是首次核查 | |||
List<PerformanceAppraisalScoreInfo> scoreInfos = performanceAppraisalScoreInfoService.list(Wrappers.lambdaQuery(PerformanceAppraisalScoreInfo.class) | |||
Wrapper<PerformanceAppraisalScoreInfo> query = Wrappers.lambdaQuery(PerformanceAppraisalScoreInfo.class) | |||
.eq(PerformanceAppraisalScoreInfo::getAppraisalType, AppraisalTypeEnum.EXPERT_VERIFY.getCode()) | |||
.eq(PerformanceAppraisalScoreInfo::getAppraisalId, appraisalId) | |||
.eq(PerformanceAppraisalScoreInfo::getAppraisalProjectCode, projectCode) | |||
.eq(PerformanceAppraisalScoreInfo::getAppraisalEmployeeCode, employeeCode)); | |||
if (CollUtil.isEmpty(scoreInfos)) { | |||
return true; | |||
} | |||
return Boolean.FALSE; | |||
.eq(PerformanceAppraisalScoreInfo::getAppraisalUserId, userId) | |||
.last(BizConst.LIMIT_1); | |||
return performanceAppraisalScoreInfoService.count(query) == 0; | |||
} | |||
public PageVo<PerformanceAppraisalProjectVO> groupProjectList(Long groupId, PerformanceAppraisalListReq req) { | |||
UserInfoDetails userDetail = LoginUserUtil.loginUserDetail(); | |||
String employeeCode = userDetail.getEmployeeCode(); | |||
String userIdStr = String.valueOf(userDetail.getUserId()); | |||
// 获取分组内的项目信息 | |||
PerformanceAppraisalProjectGroup projectGroup = groupService.getById(groupId); | |||
@@ -204,10 +206,10 @@ public class VerifyManage { | |||
BeanUtil.copyProperties(appraisalProject, vo); | |||
vo.setProjectId(appraisalProject.getProjectId()); | |||
vo.setProjectTypeName(ProjectTypeNewEnum.getDesc(p.getProjectType())); | |||
vo.setCanVerify(checkCanVerify(employeeCode, appraisalProject.getProjectCode(), appraisalId)); | |||
vo.setCanVerify(checkCanVerify(userIdStr, appraisalProject.getProjectCode(), appraisalId)); | |||
// 如果登录用户是核查组长,该项目可填写整改意见 | |||
String verifyLeader = projectGroup.getVerifyLeader(); | |||
if (employeeCode.equals(verifyLeader)) { | |||
if (userIdStr.equals(verifyLeader)) { | |||
vo.setCanRectify(Boolean.TRUE); | |||
} | |||
vo.setGroupId(groupId); | |||
@@ -220,7 +222,7 @@ public class VerifyManage { | |||
@Transactional(rollbackFor = Exception.class) | |||
public String submitVerify(ProjectAppraisalDTO param) { | |||
UserInfoDetails userDetail = LoginUserUtil.loginUserDetail(); | |||
String employeeCode = userDetail.getEmployeeCode(); | |||
String userIdStr = String.valueOf(userDetail.getUserId()); | |||
String username = userDetail.getUsername(); | |||
Long appraisalId = param.getAppraisalId(); | |||
Long appraisalProjectId = param.getAppraisalProjectId(); | |||
@@ -260,8 +262,8 @@ public class VerifyManage { | |||
scoreInfo.setAppraisalType(AppraisalTypeEnum.EXPERT_VERIFY.getCode()); | |||
scoreInfo.setTemplateDetailId(templateDetail.getId()); | |||
scoreInfo.setTemplateId(templateDetail.getTemplateId()); | |||
scoreInfo.setAppraisalEmployeeCode(employeeCode); | |||
scoreInfo.setAppraisalEmployeeName(username); | |||
scoreInfo.setAppraisalUserName(username); | |||
scoreInfo.setAppraisalUserId(userIdStr); | |||
scoreInfo.setAppraisalId(appraisalId); | |||
scoreInfo.setAppraisalProjectId(appraisalProjectId); | |||
scoreInfo.setAppraisalProjectCode(appraisalProjectCode); | |||
@@ -281,7 +283,7 @@ public class VerifyManage { | |||
if (Objects.nonNull(appraisalProject.getVerifyTotalScore())) { | |||
// 已经进行了核查,计算两个分值的平均分 | |||
BigDecimal add = verifyTotalScore.add(appraisalProject.getReAppraisalTotalScore()); | |||
lastVerifyTotalScore = add.divide(BigDecimal.valueOf(2)); | |||
lastVerifyTotalScore = add.divide(BigDecimal.valueOf(2), RoundingMode.HALF_UP); | |||
} else { | |||
// 还没有进行过复评 | |||
lastVerifyTotalScore = verifyTotalScore; | |||
@@ -298,7 +300,7 @@ public class VerifyManage { | |||
StringUtils.isNotBlank(param.getRectifyOpinion())) { | |||
appraisalProject.setIsRectify(param.getIsRectify()); | |||
appraisalProject.setRectifyOpinion(param.getRectifyOpinion()); | |||
appraisalProject.setRectifySubmitEmployeeCode(employeeCode); | |||
appraisalProject.setRectifySubmitUserId(userIdStr); | |||
appraisalProject.setRectifySubmitTime(LocalDateTime.now()); | |||
appraisalProject.setRectifyStatus(RectifyStatusEnum.TO_BE_SUBMITTED.getCode()); | |||
} | |||
@@ -317,7 +319,9 @@ public class VerifyManage { | |||
// 判断打分人员是否为分组内的核查人员 | |||
if (CollUtil.isNotEmpty(scoreInfoList)) { | |||
Set<String> users = scoreInfoList.stream().map(PerformanceAppraisalScoreInfo::getAppraisalEmployeeCode).collect(Collectors.toSet()); | |||
Set<String> users = scoreInfoList.stream() | |||
.map(PerformanceAppraisalScoreInfo::getAppraisalUserId) | |||
.collect(Collectors.toSet()); | |||
if (CollUtil.isNotEmpty(users)) { | |||
String verificationUsers = group.getVerificationUsers(); | |||
String join = String.join(StrPool.COMMA, users); | |||
@@ -330,29 +334,24 @@ public class VerifyManage { | |||
} | |||
public void exportScore(HttpServletResponse response, PerformanceAppraisalExportReq param) { | |||
UserInfoDetails user = LoginUserUtil.loginUserDetail(); | |||
String regionCode = user.getRegionCode(); | |||
String projectCode = param.getProjectCode(); | |||
Long appraisalId = param.getAppraisalId(); | |||
// 根据项目编码获取最新版本的项目信息 | |||
Project project = projectService.getProjectByCode(projectCode); | |||
VUtils.isTrue(Objects.isNull(project)).throwMessage("项目不存在!"); | |||
Assert.notNull(project, "项目不存在!"); | |||
// 根据项目类型、预算年度、批复金额、项目标签匹配本区域指标模版 | |||
String projectType = project.getProjectType(); | |||
Integer projectYear = project.getProjectYear(); | |||
BigDecimal approvalAmount = project.getApprovalAmount(); | |||
VUtils.isTrue(Objects.isNull(approvalAmount)).throwMessage("未获取到该项目的立项批复金额"); | |||
Assert.notNull(approvalAmount, "未获取到该项目的立项批复金额"); | |||
// 根据项目code获取项目标签ID列表 | |||
List<Long> tagIdList = projectTagService.list(Wrappers.lambdaQuery(ProjectTag.class) | |||
String tagIdStr = projectTagService.list(Wrappers.lambdaQuery(ProjectTag.class) | |||
.eq(ProjectTag::getProjectCode, projectCode)).stream() | |||
.map(ProjectTag::getTagId).collect(Collectors.toList()); | |||
VUtils.isTrue(CollUtil.isEmpty(tagIdList)).throwMessage("当前项目未设置标签,匹配不到指标模板,请至项目库或评价计划编辑页面设置标签!"); | |||
.map(w -> w.getTagId().toString()).collect(Collectors.joining(",")); | |||
Assert.notEmpty(tagIdStr, "当前项目未设置标签,请至项目库或评价计划编辑页面设置标签!"); | |||
List<String> strIdList = tagIdList.stream().map(String::valueOf).collect(Collectors.toList()); | |||
String projectTagIds = String.join(StrPool.COMMA, strIdList); | |||
Integer amountRange = null; | |||
Integer amountRange; | |||
if (approvalAmount.compareTo(BigDecimal.valueOf(ProjectBizConst.FIVE_MILLION)) < 0) { | |||
amountRange = ProjectBizConst.AMOUNT_RANGE_ONE; | |||
} else if (approvalAmount.compareTo(BigDecimal.valueOf(ProjectBizConst.FIVE_MILLION)) >= 0 && | |||
@@ -360,19 +359,20 @@ public class VerifyManage { | |||
amountRange = ProjectBizConst.AMOUNT_RANGE_TWO; | |||
} else if (approvalAmount.compareTo(BigDecimal.valueOf(ProjectBizConst.TWENTY_MILLION)) >= 0) { | |||
amountRange = ProjectBizConst.AMOUNT_RANGE_THREE; | |||
} else { | |||
amountRange = null; | |||
} | |||
LambdaQueryWrapper<PerformanceIndicatorProjectTemplate> wrapper = Wrappers.lambdaQuery(PerformanceIndicatorProjectTemplate.class) | |||
.eq(PerformanceIndicatorProjectTemplate::getRegionCode, regionCode) | |||
LambdaQueryWrapper<PerformanceIndicatorProjectTemplate> wrapper = Wrappers | |||
.lambdaQuery(PerformanceIndicatorProjectTemplate.class) | |||
.eq(PerformanceIndicatorProjectTemplate::getProjectType, projectType) | |||
.eq(PerformanceIndicatorProjectTemplate::getProjectYear, projectYear) | |||
.eq(PerformanceIndicatorProjectTemplate::getAmountRange, amountRange) | |||
.eq(PerformanceIndicatorProjectTemplate::getProjectTagIds, projectTagIds) | |||
.eq(PerformanceIndicatorProjectTemplate::getProjectTagIds, tagIdStr) | |||
.eq(PerformanceIndicatorProjectTemplate::getStatus, CommonEnum.YES.getCode()) | |||
.orderByDesc(PerformanceIndicatorProjectTemplate::getUpdateOn); | |||
List<PerformanceIndicatorProjectTemplate> templates = indicatorProjectTemplateService.list(wrapper); | |||
VUtils.isTrue(CollUtil.isEmpty(templates)).throwMessage("该项目匹配不到指标模板,请返回上一页或者刷新重试。"); | |||
if (templates.size() > 1) { | |||
throw new BizException("当前项目匹配到多个模板,请返回模板库检查模板配置!"); | |||
if (templates.size() != 1) { | |||
throw BizException.wrap("当前项目模版配置错误!"); | |||
} | |||
PerformanceIndicatorProjectTemplate projectTemplate = templates.get(0); | |||
// 装配项目指标详情及分数信息 | |||
@@ -384,11 +384,12 @@ public class VerifyManage { | |||
List<Map<String, Object>> exportDataList = Lists.newArrayList(); | |||
List<Map<String, Object>> exportAdditionalDataList = Lists.newArrayList(); | |||
// 构建指标和打分详情 | |||
List<PerformanceAppraisalScoreInfo> scoreInfoList = performanceAppraisalScoreInfoService.list(Wrappers.lambdaQuery(PerformanceAppraisalScoreInfo.class) | |||
List<PerformanceAppraisalScoreInfo> scoreInfoList = performanceAppraisalScoreInfoService.list(Wrappers | |||
.lambdaQuery(PerformanceAppraisalScoreInfo.class) | |||
.eq(PerformanceAppraisalScoreInfo::getAppraisalId, appraisalId) | |||
.and(wp -> wp.eq(PerformanceAppraisalScoreInfo::getAppraisalType, AppraisalTypeEnum.SELF_APPRAISAL.getCode()).or() | |||
.eq(PerformanceAppraisalScoreInfo::getAppraisalType, AppraisalTypeEnum.RE_APPRAISAL.getCode()).or() | |||
.eq(PerformanceAppraisalScoreInfo::getAppraisalType, AppraisalTypeEnum.EXPERT_VERIFY.getCode())) | |||
.and(wp -> wp.eq(PerformanceAppraisalScoreInfo::getAppraisalType, AppraisalTypeEnum.SELF_APPRAISAL.getCode()) | |||
.or().eq(PerformanceAppraisalScoreInfo::getAppraisalType, AppraisalTypeEnum.RE_APPRAISAL.getCode()) | |||
.or().eq(PerformanceAppraisalScoreInfo::getAppraisalType, AppraisalTypeEnum.EXPERT_VERIFY.getCode())) | |||
.eq(PerformanceAppraisalScoreInfo::getAppraisalProjectCode, projectCode) | |||
.orderBy(Boolean.TRUE, Boolean.TRUE, PerformanceAppraisalScoreInfo::getTemplateDetailId)); | |||
Map<Long, PerformanceAppraisalScoreInfo> scoreInfoMap = scoreInfoList.stream() | |||
@@ -399,7 +400,7 @@ public class VerifyManage { | |||
.filter(s -> AppraisalTypeEnum.RE_APPRAISAL.getCode().equals(s.getAppraisalType())) | |||
.collect(Collectors.toList()); | |||
List<String> reUserList = reScoreInfoList.stream() | |||
.map(PerformanceAppraisalScoreInfo::getAppraisalEmployeeName) | |||
.map(PerformanceAppraisalScoreInfo::getAppraisalUserName) | |||
.collect(Collectors.toList()); | |||
// 获取核查打分人员信息 | |||
@@ -407,12 +408,12 @@ public class VerifyManage { | |||
.filter(s -> AppraisalTypeEnum.EXPERT_VERIFY.getCode().equals(s.getAppraisalType())) | |||
.collect(Collectors.toList()); | |||
List<String> verifyUserList = verifyScoreInfoList.stream() | |||
.map(PerformanceAppraisalScoreInfo::getAppraisalEmployeeName) | |||
.map(PerformanceAppraisalScoreInfo::getAppraisalUserName) | |||
.collect(Collectors.toList()); | |||
// 筛选出所有打分的三级指标模板详情ID | |||
for (PerformanceAppraisalScoreInfo scoreInfo : scoreInfoList) { | |||
HashMap<String, Object> scoreMap = MapUtil.newHashMap(); | |||
Map<String, Object> scoreMap = MapUtil.newHashMap(); | |||
Long detailId = scoreInfo.getTemplateDetailId(); | |||
PerformanceIndicatorProjectTemplateDetail thirdTemplateDetail = templateDetailMap.get(detailId); | |||
@@ -444,11 +445,11 @@ public class VerifyManage { | |||
scoreMap.put(ProjectBizConst.SELF_APPRAISAL_BASIS, appraisalScoreInfo.getAppraisalBasis()); | |||
scoreMap.put(ProjectBizConst.SELF_APPRAISAL_SCORE, appraisalScoreInfo.getAppraisalScore()); | |||
} else if (AppraisalTypeEnum.RE_APPRAISAL.getCode().equals(appraisalScoreInfo.getAppraisalType())) { | |||
scoreMap.put(appraisalScoreInfo.getAppraisalEmployeeName() + ProjectBizConst.RE_APPRAISAL_BASIS, appraisalScoreInfo.getAppraisalBasis()); | |||
scoreMap.put(appraisalScoreInfo.getAppraisalEmployeeName() + ProjectBizConst.RE_APPRAISAL_SCORE, appraisalScoreInfo.getAppraisalScore()); | |||
scoreMap.put(appraisalScoreInfo.getAppraisalUserName() + ProjectBizConst.RE_APPRAISAL_BASIS, appraisalScoreInfo.getAppraisalBasis()); | |||
scoreMap.put(appraisalScoreInfo.getAppraisalUserName() + ProjectBizConst.RE_APPRAISAL_SCORE, appraisalScoreInfo.getAppraisalScore()); | |||
} else if (AppraisalTypeEnum.EXPERT_VERIFY.getCode().equals(appraisalScoreInfo.getAppraisalType())) { | |||
scoreMap.put(appraisalScoreInfo.getAppraisalEmployeeName() + ProjectBizConst.VERIFY_BASIS, appraisalScoreInfo.getAppraisalBasis()); | |||
scoreMap.put(appraisalScoreInfo.getAppraisalEmployeeName() + ProjectBizConst.VERIFY_SCORE, appraisalScoreInfo.getAppraisalScore()); | |||
scoreMap.put(appraisalScoreInfo.getAppraisalUserName() + ProjectBizConst.VERIFY_BASIS, appraisalScoreInfo.getAppraisalBasis()); | |||
scoreMap.put(appraisalScoreInfo.getAppraisalUserName() + ProjectBizConst.VERIFY_SCORE, appraisalScoreInfo.getAppraisalScore()); | |||
} | |||
if (Boolean.TRUE.equals(thirdTemplateDetail.getIsAdditional())) { | |||
@@ -469,26 +470,26 @@ public class VerifyManage { | |||
// 需要从第几行开始合并 | |||
int mergeRowIndex = 2; | |||
List<ExcelHead> headList = Lists.newArrayList(); | |||
headList.add(new ExcelHead(ProjectBizConst.FIRST_INDEX_NAME, ProjectBizConst.FIRST_INDEX_TITLE, StrPool.EMPTY)); | |||
headList.add(new ExcelHead(ProjectBizConst.SECOND_INDEX_NAME, ProjectBizConst.SECOND_INDEX_TITLE, StrPool.EMPTY)); | |||
headList.add(new ExcelHead(ProjectBizConst.THIRD_INDEX_NAME, ProjectBizConst.THIRD_INDEX_TITLE, StrPool.EMPTY)); | |||
headList.add(new ExcelHead(ProjectBizConst.INDEX_SCORE, ProjectBizConst.INDEX_SCORE_TITLE, StrPool.EMPTY)); | |||
headList.add(new ExcelHead(ProjectBizConst.INDEX_DETAIL, ProjectBizConst.INDEX_DETAIL_TITLE, StrPool.EMPTY)); | |||
headList.add(new ExcelHead(ProjectBizConst.GRADE_DETAIL, ProjectBizConst.GRADE_DETAIL_TITLE, StrPool.EMPTY)); | |||
headList.add(new ExcelHead(ProjectBizConst.SUPPORT_MATERIAL, ProjectBizConst.SUPPORT_MATERIAL_TITLE, StrPool.EMPTY)); | |||
headList.add(new ExcelHead(ProjectBizConst.SELF_APPRAISAL_BASIS, ProjectBizConst.SELF_APPRAISAL_BASIS_TITLE, StrPool.EMPTY)); | |||
headList.add(new ExcelHead(ProjectBizConst.SELF_APPRAISAL_SCORE, ProjectBizConst.SELF_APPRAISAL_SCORE_TITLE, StrPool.EMPTY)); | |||
List<ExcelHead<Object>> headList = Lists.newArrayList(); | |||
headList.add(new ExcelHead<>(ProjectBizConst.FIRST_INDEX_NAME, ProjectBizConst.FIRST_INDEX_TITLE, StrPool.EMPTY)); | |||
headList.add(new ExcelHead<>(ProjectBizConst.SECOND_INDEX_NAME, ProjectBizConst.SECOND_INDEX_TITLE, StrPool.EMPTY)); | |||
headList.add(new ExcelHead<>(ProjectBizConst.THIRD_INDEX_NAME, ProjectBizConst.THIRD_INDEX_TITLE, StrPool.EMPTY)); | |||
headList.add(new ExcelHead<>(ProjectBizConst.INDEX_SCORE, ProjectBizConst.INDEX_SCORE_TITLE, StrPool.EMPTY)); | |||
headList.add(new ExcelHead<>(ProjectBizConst.INDEX_DETAIL, ProjectBizConst.INDEX_DETAIL_TITLE, StrPool.EMPTY)); | |||
headList.add(new ExcelHead<>(ProjectBizConst.GRADE_DETAIL, ProjectBizConst.GRADE_DETAIL_TITLE, StrPool.EMPTY)); | |||
headList.add(new ExcelHead<>(ProjectBizConst.SUPPORT_MATERIAL, ProjectBizConst.SUPPORT_MATERIAL_TITLE, StrPool.EMPTY)); | |||
headList.add(new ExcelHead<>(ProjectBizConst.SELF_APPRAISAL_BASIS, ProjectBizConst.SELF_APPRAISAL_BASIS_TITLE, StrPool.EMPTY)); | |||
headList.add(new ExcelHead<>(ProjectBizConst.SELF_APPRAISAL_SCORE, ProjectBizConst.SELF_APPRAISAL_SCORE_TITLE, StrPool.EMPTY)); | |||
for (String reUser : reUserList) { | |||
headList.add(new ExcelHead(reUser + ProjectBizConst.RE_APPRAISAL_BASIS, ProjectBizConst.RE_APPRAISAL_BASIS_TITLE, StrPool.EMPTY)); | |||
headList.add(new ExcelHead(reUser + ProjectBizConst.RE_APPRAISAL_SCORE, ProjectBizConst.RE_APPRAISAL_SCORE_TITLE, StrPool.EMPTY)); | |||
headList.add(new ExcelHead<>(reUser + ProjectBizConst.RE_APPRAISAL_BASIS, ProjectBizConst.RE_APPRAISAL_BASIS_TITLE, StrPool.EMPTY)); | |||
headList.add(new ExcelHead<>(reUser + ProjectBizConst.RE_APPRAISAL_SCORE, ProjectBizConst.RE_APPRAISAL_SCORE_TITLE, StrPool.EMPTY)); | |||
} | |||
for (String verifyUser : verifyUserList) { | |||
headList.add(new ExcelHead(verifyUser + ProjectBizConst.VERIFY_BASIS, ProjectBizConst.VERIFY_BASIS_TITLE, StrPool.EMPTY)); | |||
headList.add(new ExcelHead(verifyUser + ProjectBizConst.VERIFY_SCORE, ProjectBizConst.VERIFY_SCORE_TITLE, StrPool.EMPTY)); | |||
headList.add(new ExcelHead<>(verifyUser + ProjectBizConst.VERIFY_BASIS, ProjectBizConst.VERIFY_BASIS_TITLE, StrPool.EMPTY)); | |||
headList.add(new ExcelHead<>(verifyUser + ProjectBizConst.VERIFY_SCORE, ProjectBizConst.VERIFY_SCORE_TITLE, StrPool.EMPTY)); | |||
} | |||
headList.add(new ExcelHead(ProjectBizConst.IS_ADDITIONAL, ProjectBizConst.IS_ADDITIONAL_TITLE, StrPool.EMPTY)); | |||
headList.add(new ExcelHead<>(ProjectBizConst.IS_ADDITIONAL, ProjectBizConst.IS_ADDITIONAL_TITLE, StrPool.EMPTY)); | |||
// 数据导出处理函数 | |||
try { | |||
@@ -82,7 +82,7 @@ public class PerformanceAppraisalProject implements Serializable { | |||
private String rectifyOpinion; | |||
@ApiModelProperty("整改提交人员工code") | |||
private String rectifySubmitEmployeeCode; | |||
private String rectifySubmitUserId; | |||
@ApiModelProperty("整改提交时间") | |||
private LocalDateTime rectifySubmitTime; | |||
@@ -106,7 +106,7 @@ public class PerformanceAppraisalProject implements Serializable { | |||
private String rectifyResultAppendix; | |||
@ApiModelProperty("整改结果提交人员工code") | |||
private String rectifyResSubEmpCode; | |||
private String rectifyResSubUserId; | |||
@ApiModelProperty("整改结果提交时间") | |||
private LocalDateTime rectifyResSubTime; | |||
@@ -54,10 +54,10 @@ public class PerformanceAppraisalScoreInfo implements Serializable { | |||
private String appraisalBasisAppendix; | |||
@ApiModelProperty("评价人员code") | |||
private String appraisalEmployeeCode; | |||
private String appraisalUserId; | |||
@ApiModelProperty("评价人员姓名") | |||
private String appraisalEmployeeName; | |||
private String appraisalUserName; | |||
@ApiModelProperty("评价类型 1 单位自评、2 复评人员复评、3 专家核查、4 专家整改审核、5 应用评价") | |||
private Integer appraisalType; | |||
@@ -5,7 +5,6 @@ import io.swagger.annotations.ApiModel; | |||
import io.swagger.annotations.ApiModelProperty; | |||
import lombok.Data; | |||
import java.io.Serializable; | |||
import java.time.LocalDateTime; | |||
/** | |||
@@ -16,15 +15,13 @@ import java.time.LocalDateTime; | |||
*/ | |||
@Data | |||
@ApiModel(value = "整改详情", description = "整改详情") | |||
public class RectifyDetailVO implements Serializable { | |||
private static final long serialVersionUID = 1L; | |||
public class RectifyDetailVO { | |||
@ApiModelProperty("整改意见") | |||
private String rectifyOpinion; | |||
@ApiModelProperty("整改提交人") | |||
private UserFullInfoDTO rectifySubmitEmployee; | |||
private UserFullInfoDTO rectifySubmitUser; | |||
@ApiModelProperty("整改提交时间") | |||
private LocalDateTime rectifySubmitTime; | |||
@@ -36,7 +33,7 @@ public class RectifyDetailVO implements Serializable { | |||
private String rectifyResultAppendix; | |||
@ApiModelProperty("整改结果提交人") | |||
private UserFullInfoDTO rectifyResSubEmployee; | |||
private UserFullInfoDTO rectifyResSubUser; | |||
@ApiModelProperty("整改结果提交时间") | |||
private LocalDateTime rectifyResSubTime; | |||
@@ -50,12 +50,12 @@ public class ExcelUtils { | |||
* @param dataList 表内容数据转换 | |||
* @return List<List<Object>> | |||
*/ | |||
public static List<List<Object>> convertData(List<ExcelHead> headList, List<Map<String, Object>> dataList) { | |||
public static List<List<Object>> convertData(List<ExcelHead<Object>> headList, List<Map<String, Object>> dataList) { | |||
List<List<Object>> result = Lists.newArrayList(); | |||
//对 dataList 转为 easyExcel 的数据格式 | |||
for (Map<String, Object> data : dataList) { | |||
List<Object> row = Lists.newArrayList(); | |||
for (ExcelHead<T> h : headList) { | |||
for (ExcelHead<Object> h : headList) { | |||
Object o = data.get(h.getFieldName()); | |||
//需要对null的处理,转换为空字符串 | |||
row.add(handler(o, h.getNullValue())); | |||
@@ -59,6 +59,7 @@ public class TagManage { | |||
/** | |||
* 标签分页 | |||
* | |||
* @param areaCode | |||
* @param req | |||
* @return | |||
@@ -67,57 +68,51 @@ public class TagManage { | |||
RegionDTO regionDto = regionCacheHelper.getByCodeAndLevel(areaCode, RegionConst.RL_COUNTY); | |||
String regionCode = Objects.nonNull(regionDto) ? regionDto.getRegionCode() : null; | |||
LambdaQueryWrapper<Tag> query = Wrappers.lambdaQuery(Tag.class) | |||
.eq(Objects.nonNull(regionCode),Tag::getAreaCode, regionCode) | |||
.like(StringUtils.isNotBlank(req.getName()),Tag::getName,req.getName()) | |||
.eq(Objects.nonNull(regionCode), Tag::getAreaCode, regionCode) | |||
.like(StringUtils.isNotBlank(req.getName()), Tag::getName, req.getName()) | |||
.orderByDesc(Tag::getUpdateOn); | |||
checkAuth(query,LoginUserUtil.loginUserDetail()); | |||
checkAuth(query, LoginUserUtil.loginUserDetail()); | |||
Page<Tag> page = tagService.page(req.page(), query); | |||
long total; | |||
if ((total = page.getTotal()) == 0) { | |||
return PageVo.empty(); | |||
} | |||
List<TagVO> records = CollUtils.convert(page.getRecords(), | |||
t -> BeanUtil.copyProperties(t,TagVO.class)); | |||
t -> BeanUtil.copyProperties(t, TagVO.class)); | |||
return PageVo.of(records, total); | |||
} | |||
/** | |||
* 权限控制 | |||
* @param query | |||
* @param user | |||
* | |||
* @param query \ | |||
* @param user \ | |||
*/ | |||
private void checkAuth(LambdaQueryWrapper<Tag> query, UserInfoDetails user) { | |||
//如果是超管 | |||
if(user.getSuperAdmin()){ | |||
if (user.getSuperAdmin() || user.getRegionAdmin()) { | |||
log.info(user.getUsername() + " 是超管,可以看所有标签"); | |||
}else if(user.getRegionAdmin()){ | |||
//如果是区域管理员 | |||
log.info(user.getUsername() + " 是区管,可以看本区域" + user.getRegionCode() + "标签"); | |||
if(!RegionConst.RC_HZ.equals(user.getRegionCode())){ | |||
//非市本级的区管 只可以看自己区域的 | |||
query.eq(Tag::getAreaCode,user.getRegionCode()); | |||
} | |||
//市本级 能看所有区域 | |||
}else{ | |||
} else { | |||
//其它角色全都看不见 | |||
query.eq(Tag::getId,0L); | |||
query.eq(Tag::getId, 0L); | |||
} | |||
} | |||
/** | |||
* 保存标签 | |||
* @param dto | |||
* @return | |||
* | |||
* @param dto \ | |||
* @return \ | |||
*/ | |||
public String save(TagDTO dto) { | |||
deduplicationName(dto); | |||
UserInfoDetails user = LoginUserUtil.loginUserDetail(); | |||
Tag entity = BeanUtil.copyProperties(dto,Tag.class); | |||
if(Objects.nonNull(dto.getId())){ | |||
Tag entity = BeanUtil.copyProperties(dto, Tag.class); | |||
if (Objects.nonNull(dto.getId())) { | |||
Tag old = tagService.getById(dto.getId()); | |||
VUtils.isTrue(Objects.isNull(old)).throwMessage("此id标签不存在!"); | |||
entity.setId(old.getId()); | |||
}else{ | |||
} else { | |||
entity.setId(null); | |||
entity.setCreateOn(LocalDateTime.now()); | |||
entity.setCreateBy(user.getUsername()); | |||
@@ -131,10 +126,11 @@ public class TagManage { | |||
/** | |||
* 标签名 去重 | |||
* | |||
* @param dto | |||
*/ | |||
private void deduplicationName(TagDTO dto) { | |||
if(StringUtils.isNotBlank(dto.getName())){ | |||
if (StringUtils.isNotBlank(dto.getName())) { | |||
long count = tagService.count(Wrappers.lambdaQuery(Tag.class) | |||
.eq(Tag::getAreaCode, dto.getAreaCode()) | |||
.eq(Tag::getName, dto.getName()) | |||
@@ -144,7 +140,7 @@ public class TagManage { | |||
} | |||
public String saveToProject(List<TagToProjectDTO> dtos) { | |||
if(CollUtil.isEmpty(dtos)){ | |||
if (CollUtil.isEmpty(dtos)) { | |||
return "参入的标签为空"; | |||
} | |||
UserInfoDetails user = LoginUserUtil.loginUserDetail(); | |||
@@ -155,10 +151,10 @@ public class TagManage { | |||
.last(BizConst.LIMIT_1)); | |||
VUtils.isTrue(Objects.isNull(project) && Objects.isNull(baseinfo)).throwMessage("项目不存在!"); | |||
projectTagService.remove(Wrappers.lambdaQuery(ProjectTag.class) | |||
.eq(ProjectTag::getProjectCode,projectCode)); | |||
.eq(ProjectTag::getProjectCode, projectCode)); | |||
//去重 | |||
dtos = dtos.stream().distinct().collect(Collectors.toList()); | |||
for(TagToProjectDTO dto : dtos){ | |||
for (TagToProjectDTO dto : dtos) { | |||
Long tagId = dto.getTagId(); | |||
Tag tag = tagService.getById(tagId); | |||
VUtils.isTrue(Objects.isNull(tag)).throwMessage("标签不存在!"); | |||
@@ -178,7 +174,8 @@ public class TagManage { | |||
public String removeTagToProject(TagToProjectDTO dto) { | |||
String projectCode = dto.getProjectCode(); | |||
Project project = projectService.getProjectByCode(projectCode); | |||
GovBizProjectBaseinfo baseinfo = baseinfoService.getOne(Wrappers.lambdaQuery(GovBizProjectBaseinfo.class) | |||
GovBizProjectBaseinfo baseinfo = baseinfoService.getOne(Wrappers | |||
.lambdaQuery(GovBizProjectBaseinfo.class) | |||
.eq(GovBizProjectBaseinfo::getBaseProjId, projectCode) | |||
.last(BizConst.LIMIT_1)); | |||
VUtils.isTrue(Objects.isNull(project) && Objects.isNull(baseinfo)).throwMessage("项目不存在!"); | |||
@@ -202,6 +199,7 @@ public class TagManage { | |||
/** | |||
* 删除标签 | |||
* | |||
* @param id | |||
* @return | |||
*/ | |||
@@ -210,10 +208,10 @@ public class TagManage { | |||
VUtils.isTrue(Objects.isNull(tag)) | |||
.throwMessage("删除失败 此标签ID不存在!"); | |||
if(tagService.removeById(id)){ | |||
if (tagService.removeById(id)) { | |||
//关联关系 也要删 | |||
projectTagService.remove(Wrappers.lambdaQuery(ProjectTag.class) | |||
.eq(ProjectTag::getTagId,id)); | |||
.eq(ProjectTag::getTagId, id)); | |||
return "删除成功"; | |||
} | |||
return "删除失败"; | |||
@@ -66,7 +66,7 @@ public class DeclaredProjectController { | |||
@ApiOperation(value = "申报项目草稿箱详情", notes = "申报项目草稿箱详情") | |||
@GetMapping("/draft/{id}") | |||
public ProjectDraftVO draft(@PathVariable(value = "id") Long id) { | |||
return declaredProjectManage.draftDatail(id); | |||
return declaredProjectManage.draftDetail(id); | |||
} | |||
@ApiOperation(value = "申报项目保存至草稿箱", notes = "申报项目保存至草稿箱") | |||
@@ -7,8 +7,8 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | |||
import com.baomidou.mybatisplus.core.toolkit.Wrappers; | |||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; | |||
import com.google.common.collect.Lists; | |||
import com.hz.pm.api.common.model.constant.BizConst; | |||
import com.hz.pm.api.common.helper.UserInfoHelper; | |||
import com.hz.pm.api.common.model.constant.BizConst; | |||
import com.hz.pm.api.common.statemachine.util.StateMachineUtil; | |||
import com.hz.pm.api.common.util.ExcelDownUtil; | |||
import com.hz.pm.api.common.util.ExcelExportStyle; | |||
@@ -25,10 +25,10 @@ import com.hz.pm.api.projectdeclared.service.IContractService; | |||
import com.hz.pm.api.projectdeclared.service.IPaymentPlanService; | |||
import com.hz.pm.api.projectdeclared.service.IPreInsAcceptancePersonService; | |||
import com.hz.pm.api.projectdeclared.service.IPurchaseService; | |||
import com.hz.pm.api.projectlib.model.enumeration.ProjectStatusEnum; | |||
import com.hz.pm.api.projectlib.model.enumeration.ProjectTypeNewEnum; | |||
import com.hz.pm.api.projectlib.helper.ProjectHelper; | |||
import com.hz.pm.api.projectlib.model.entity.Project; | |||
import com.hz.pm.api.projectlib.model.enumeration.ProjectStatusEnum; | |||
import com.hz.pm.api.projectlib.model.enumeration.ProjectTypeNewEnum; | |||
import com.hz.pm.api.projectlib.model.req.ProjectListReq; | |||
import com.hz.pm.api.projectlib.model.vo.ProjectLibListItemVO; | |||
import com.hz.pm.api.projectlib.service.IProjectService; | |||
@@ -89,7 +89,6 @@ public class ConstructionManage { | |||
*/ | |||
public PageVo<ProjectLibListItemVO> projectLibList(ProjectListReq req) { | |||
UserFullInfoDTO user = userInfoHelper.getUserFullInfo(LoginUserUtil.getUserId()); | |||
VUtils.isTrue(Objects.isNull(user)).throwMessage("获取登录用户失败!"); | |||
LambdaQueryWrapper<Project> query = ProjectHelper.projectQuery(req); | |||
//建设中状态 | |||
query.eq(Project::getStatus, ProjectStatusEnum.UNDER_CONSTRUCTION.getCode()); | |||
@@ -97,7 +96,7 @@ public class ConstructionManage { | |||
query.eq(Project::getStage, ProjectStatusEnum.PROJECT_APPROVED.getCode()); | |||
query.eq(Project::getNewest, Boolean.TRUE); | |||
//只能看自己单位的 | |||
query.eq(Project::getBuildOrgCode, user.getEmpPosUnitCode()); | |||
query.eq(Project::getBuildOrgCode, user.getMhUnitId()); | |||
query.orderByAsc(Project::getTransactionTime); | |||
Page<Project> page = projectService.page(req.page(), query); | |||
long total; | |||
@@ -136,7 +135,6 @@ public class ConstructionManage { | |||
*/ | |||
public PageVo<ProjectContractListVO> projectlistPerfect(ProjectListReq req) { | |||
UserFullInfoDTO user = userInfoHelper.getUserFullInfo(LoginUserUtil.getUserId()); | |||
VUtils.isTrue(Objects.isNull(user)).throwMessage("获取登录用户失败!"); | |||
LambdaQueryWrapper<Project> query = ProjectHelper.projectQuery(req); | |||
//建设中状态以后的 都是 | |||
query.and(q1 -> q1.gt(Project::getStatus, ProjectStatusEnum.UNDER_CONSTRUCTION.getCode()) | |||
@@ -144,7 +142,7 @@ public class ConstructionManage { | |||
.isNotNull(Project::getContractAmount))); | |||
query.eq(Project::getNewest, Boolean.TRUE); | |||
//只能看自己单位的 | |||
query.eq(Project::getBuildOrgCode, user.getEmpPosUnitCode()); | |||
query.eq(Project::getBuildOrgCode, user.getMhUnitId()); | |||
query.orderByAsc(Project::getUpdateOn); | |||
Page<Project> page = projectService.page(req.page(), query); | |||
@@ -172,9 +170,9 @@ public class ConstructionManage { | |||
/** | |||
* 判断 是否需要补充 | |||
* | |||
* @param w | |||
* @param paymentMap | |||
* @return | |||
* @param w \ | |||
* @param paymentMap \ | |||
* @return \ | |||
*/ | |||
private Boolean checkIsSupplement(Project w, Map<String, List<PaymentPlan>> paymentMap) { | |||
if (paymentMap.containsKey(w.getProjectCode())) { | |||
@@ -194,7 +192,6 @@ public class ConstructionManage { | |||
public void exportList(HttpServletResponse response, ProjectListReq param) { | |||
UserFullInfoDTO user = userInfoHelper.getUserFullInfo(LoginUserUtil.getUserId()); | |||
VUtils.isTrue(Objects.isNull(user)).throwMessage("获取登录用户失败!"); | |||
LambdaQueryWrapper<Project> query = ProjectHelper.projectQuery(param); | |||
//待采购状态 | |||
query.eq(Project::getStatus, ProjectStatusEnum.UNDER_CONSTRUCTION.getCode()); | |||
@@ -296,9 +293,6 @@ public class ConstructionManage { | |||
*/ | |||
public String submitContract(ContractSaveDTO dto) { | |||
UserFullInfoDTO user = userInfoHelper.getUserFullInfo(LoginUserUtil.getUserId()); | |||
String employeeCode = user.getEmployeeCode(); | |||
VUtils.isTrue(StringUtils.isBlank(employeeCode)).throwMessage("获取登录用户 员工号 失败!"); | |||
Long projectId = dto.getProjectId(); | |||
VUtils.isTrue(Objects.isNull(projectId)).throwMessage("提交失败 缺少项目ID!"); | |||
Project project = projectService.getNewProject(dto.getProjectId()); | |||
@@ -317,7 +311,7 @@ public class ConstructionManage { | |||
BeanUtil.copyProperties(dto, contractEntity); | |||
if (Objects.isNull(contract)) { | |||
contractEntity.setCreateOn(LocalDateTime.now()); | |||
contractEntity.setCreateBy(employeeCode); | |||
contractEntity.setCreateBy(user.getUserIdStr()); | |||
} else { | |||
contractEntity.setId(contract.getId()); | |||
} | |||
@@ -336,8 +330,8 @@ public class ConstructionManage { | |||
plan.setProjectCode(project.getProjectCode()); | |||
plan.setCreateOn(LocalDateTime.now()); | |||
plan.setUpdateOn(LocalDateTime.now()); | |||
plan.setCreateBy(employeeCode); | |||
plan.setUpdateBy(employeeCode); | |||
plan.setCreateBy(user.getUserIdStr()); | |||
plan.setUpdateBy(user.getUserIdStr()); | |||
return plan; | |||
}).collect(Collectors.toList()); | |||
@@ -378,7 +372,7 @@ public class ConstructionManage { | |||
query.eq(Project::getStage, ProjectStatusEnum.PROJECT_APPROVED.getCode()); | |||
query.eq(Project::getNewest, Boolean.TRUE); | |||
//只能看自己单位的 | |||
query.eq(Project::getBuildOrgCode, user.getEmpPosUnitCode()); | |||
query.eq(Project::getBuildOrgCode, user.getMhUnitId()); | |||
//交货时间 排序 | |||
query.isNotNull(Project::getDeliveryTime); | |||
query.orderByAsc(Project::getDeliveryTime); | |||
@@ -420,7 +414,7 @@ public class ConstructionManage { | |||
LambdaQueryWrapper<Project> query = ProjectHelper.projectQuery(param); | |||
//待采购状态 | |||
//只能看自己单位的 | |||
query.eq(Project::getBuildOrgCode, user.getEmpPosUnitCode()); | |||
query.eq(Project::getBuildOrgCode, user.getMhUnitId()); | |||
query.eq(Project::getStatus, ProjectStatusEnum.UNDER_CONSTRUCTION.getCode()); | |||
query.eq(Project::getStage, ProjectStatusEnum.PROJECT_APPROVED.getCode()); | |||
query.eq(Project::getNewest, Boolean.TRUE); | |||
@@ -503,9 +497,6 @@ public class ConstructionManage { | |||
*/ | |||
public String submitPreIns(PreInsSaveDTO dto) { | |||
UserFullInfoDTO user = userInfoHelper.getUserFullInfo(LoginUserUtil.getUserId()); | |||
String employeeCode = user.getEmployeeCode(); | |||
VUtils.isTrue(StringUtils.isBlank(employeeCode)).throwMessage("获取登录用户 员工号 失败!"); | |||
Long projectId = dto.getProjectId(); | |||
VUtils.isTrue(Objects.isNull(projectId)).throwMessage("提交失败 缺少项目ID!"); | |||
Project project = projectService.getNewProject(dto.getProjectId()); | |||
@@ -527,8 +518,8 @@ public class ConstructionManage { | |||
person.setProjectId(projectId); | |||
person.setCreateOn(LocalDateTime.now()); | |||
person.setUpdateOn(LocalDateTime.now()); | |||
person.setCreateBy(employeeCode); | |||
person.setUpdateBy(employeeCode); | |||
person.setCreateBy(user.getUserIdStr()); | |||
person.setUpdateBy(user.getMhUnitIdStr()); | |||
return person; | |||
}).collect(Collectors.toList()); | |||
@@ -5,13 +5,12 @@ import com.alibaba.excel.EasyExcel; | |||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | |||
import com.baomidou.mybatisplus.core.toolkit.Wrappers; | |||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; | |||
import com.hz.pm.api.common.model.constant.BizConst; | |||
import com.hz.pm.api.common.model.constant.CommonConst; | |||
import com.hz.pm.api.common.model.constant.RegionConst; | |||
import com.hz.pm.api.common.enumeration.CommonEnum; | |||
import com.hz.pm.api.common.enumeration.ProjectProcessStageEnum; | |||
import com.hz.pm.api.common.helper.RegionCacheHelper; | |||
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.CommonConst; | |||
import com.hz.pm.api.common.statemachine.util.StateMachineUtil; | |||
import com.hz.pm.api.common.util.ExcelDownUtil; | |||
import com.hz.pm.api.common.util.ExcelExportStyle; | |||
@@ -21,14 +20,14 @@ import com.hz.pm.api.projectdeclared.model.dto.DefaultDeclaredDTO; | |||
import com.hz.pm.api.projectdeclared.model.entity.ProjectConstructionSuggestions; | |||
import com.hz.pm.api.projectdeclared.model.req.ConstrctionPlanListReq; | |||
import com.hz.pm.api.projectdeclared.service.IConstrctionSuggestionsService; | |||
import com.hz.pm.api.projectlib.model.enumeration.InstTypeEnum; | |||
import com.hz.pm.api.projectlib.model.enumeration.ProjectStatusEnum; | |||
import com.hz.pm.api.projectlib.model.enumeration.ProjectTypeNewEnum; | |||
import com.hz.pm.api.projectlib.helper.ProjectHelper; | |||
import com.hz.pm.api.projectlib.manage.ProjectLibManage; | |||
import com.hz.pm.api.projectlib.model.dto.ProjectDTO; | |||
import com.hz.pm.api.projectlib.model.entity.Project; | |||
import com.hz.pm.api.projectlib.model.entity.ProjectInst; | |||
import com.hz.pm.api.projectlib.model.enumeration.InstTypeEnum; | |||
import com.hz.pm.api.projectlib.model.enumeration.ProjectStatusEnum; | |||
import com.hz.pm.api.projectlib.model.enumeration.ProjectTypeNewEnum; | |||
import com.hz.pm.api.projectlib.model.req.ProjectListReq; | |||
import com.hz.pm.api.projectlib.model.vo.ProjectLibListItemVO; | |||
import com.hz.pm.api.projectlib.service.IProjectInstService; | |||
@@ -100,29 +99,20 @@ public class ConstructionPlanManage { | |||
@Transactional(rollbackFor = Exception.class) | |||
public String startTheProcess(DefaultDeclaredDTO dto) { | |||
UserFullInfoDTO user = userInfoHelper.getUserFullInfo(LoginUserUtil.getUserId()); | |||
String employeeCode = user.getEmployeeCode(); | |||
VUtils.isTrue(Objects.isNull(user) || Objects.isNull(employeeCode)) | |||
.throwMessage("获取登录用户失败!"); | |||
Long userId = user.getUserId(); | |||
ProjectDTO projectInfo = dto.getProjectInfo(); | |||
Long projectInfoId = projectInfo.getId(); | |||
VUtils.isTrue(Objects.isNull(projectInfoId)).throwMessage("提交失败 缺少项目ID!"); | |||
VUtils.isTrue(Objects.isNull(projectInfoId)).throwMessage("提交失败,缺少项目ID!"); | |||
Project oldProject = projectService.getById(projectInfoId); | |||
VUtils.isTrue(Objects.isNull(projectInfo)).throwMessage("提交失败 此项目不存在!"); | |||
VUtils.isTrue(StringUtils.isBlank(projectInfo.getConstructionPlanFile())).throwMessage("提交失败 请提交建设方案!"); | |||
VUtils.isTrue(StringUtils.isBlank(projectInfo.getConstructionPlanFile())).throwMessage("提交失败,请提交建设方案!"); | |||
// 判断 项目当前状态 是不是 方案待申报 | |||
VUtils.isTrue(!ProjectStatusEnum.PLAN_TO_BE_DECLARED.getCode().equals(oldProject.getStatus()) || | |||
!ProjectStatusEnum.NOT_APPROVED.getCode().equals(oldProject.getStage())) | |||
.throwMessage("提交失败 该项目不是 方案待申报状态或者未立项阶段"); | |||
if (StringUtils.isNotBlank(user.getRegionCode())) { | |||
projectInfo.setAreaCode(user.getRegionCode()); | |||
projectInfo.setArea(regionCacheHelper.getRegionName(user.getRegionCode(), RegionConst.RL_COUNTY)); | |||
} | |||
projectInfo.setBuildOrgCode(user.getEmpPosUnitCode()); | |||
projectInfo.setBuildOrgName(user.getEmpPosUnitName()); | |||
projectInfo.setBuildOrgCode(user.getMhUnitIdStr()); | |||
projectInfo.setBuildOrgName(user.getMhUnitName()); | |||
// 项目名称去重 | |||
if (StringUtils.isNotBlank(projectInfo.getProjectName()) && !projectInfo.getProjectName() | |||
@@ -135,8 +125,8 @@ public class ConstructionPlanManage { | |||
//如果主管单位没有 那么主管单位就是自己 | |||
if (CommonEnum.NO.getCode().equals(projectInfo.getIsSuperOrg())) { | |||
projectInfo.setSuperOrgCode(user.getEmpPosUnitCode()); | |||
projectInfo.setSuperOrg(user.getEmpPosUnitName()); | |||
projectInfo.setSuperOrgCode(user.getMhUnitIdStr()); | |||
projectInfo.setSuperOrg(user.getMhUnitName()); | |||
} | |||
Project constructProject = new Project(); | |||
@@ -144,16 +134,12 @@ public class ConstructionPlanManage { | |||
constructProject.setStatus(oldProject.getStatus()); | |||
constructProject.setStage(oldProject.getStage()); | |||
String regionCode = user.getRegionCode(); | |||
WflowModels model = processModelService.getOne(Wrappers.lambdaQuery(WflowModels.class) | |||
.eq(WflowModels::getRegionCode, regionCode) | |||
.eq(WflowModels::getProcessType, ProjectProcessStageEnum.CONSTRUCTION_PROJECT_APPROVAL_PROCESS.getCode()) | |||
.last(BizConst.LIMIT_1)); | |||
if (Objects.isNull(model)) { | |||
log.error("此 【{}】区域找不到 建设申报流程配置", regionCode); | |||
throw new BusinessException(String.format("此 【%s】区域找不到 建设申报流程配置", regionCode)); | |||
throw new BusinessException("找不到建设申报流程配置"); | |||
} | |||
//如果被禁用了的话 直接跳过 进入到下一个状态 | |||
@@ -167,13 +153,13 @@ public class ConstructionPlanManage { | |||
} | |||
ProcessStartParamsVo params = new ProcessStartParamsVo(); | |||
params.setUser(declaredProjectManage.buildUser(employeeCode)); | |||
params.setUser(declaredProjectManage.buildUser(userId)); | |||
params.setProcessUsers(Collections.emptyMap()); | |||
//放入条件判断的项目字段 | |||
//把条件值给放入工作流 | |||
defaultDeclaredProjectManage.buildCondition(params, oldProject, dto); | |||
// 获取发起单位、发起单位主管单位、发起单位上级条线主管单位信息 | |||
Map<String, OrgInfoDTO> orgModelMap = defaultDeclaredProjectManage.buildOrgModelMap(employeeCode, constructProject); | |||
Map<String, OrgInfoDTO> orgModelMap = defaultDeclaredProjectManage.buildOrgModelMap(userId, constructProject); | |||
String instanceId = processService.startProcessLs(model, params, orgModelMap); | |||
log.info("建设方案项目申报成功 【{}】", instanceId); | |||
@@ -183,7 +169,7 @@ public class ConstructionPlanManage { | |||
//如果是重新提交 不用生成新版本 前面已经生成过了 | |||
buildProject = contructionPlanModifyProject(oldProject, instanceId); | |||
} else { | |||
buildProject = projectLibManage.saveConstructProjectInDeclared(projectInfo, instanceId, employeeCode, oldProject); | |||
buildProject = projectLibManage.saveConstructProjectInDeclared(projectInfo, instanceId, userId, oldProject); | |||
} | |||
//发送给第一个审批人消息 | |||
@@ -219,10 +205,6 @@ public class ConstructionPlanManage { | |||
*/ | |||
@Transactional(rollbackFor = Exception.class) | |||
public String restartTheProcess(DefaultDeclaredDTO dto) { | |||
UserFullInfoDTO user = userInfoHelper.getUserFullInfo(LoginUserUtil.getUserId()); | |||
VUtils.isTrue(Objects.isNull(user) || Objects.isNull(user.getEmployeeCode())) | |||
.throwMessage("获取登录用户失败!"); | |||
ProjectDTO projectDto = dto.getProjectInfo(); | |||
VUtils.isTrue(Objects.isNull(projectDto.getId())).throwMessage("提交失败 缺少项目ID!"); | |||
Project projectInfo = projectService.getById(projectDto.getId()); | |||
@@ -282,7 +264,7 @@ public class ConstructionPlanManage { | |||
UserFullInfoDTO user = userInfoHelper.getUserFullInfo(LoginUserUtil.getUserId()); | |||
VUtils.isTrue(Objects.isNull(user)).throwMessage("获取登录用户失败!"); | |||
//放入用户的单位 | |||
req.setBuildOrgCode(user.getEmpPosUnitCode()); | |||
req.setBuildOrgCode(user.getMhUnitIdStr()); | |||
return projectLibManage.projectLibList(req); | |||
} | |||
@@ -296,7 +278,7 @@ public class ConstructionPlanManage { | |||
UserFullInfoDTO user = userInfoHelper.getUserFullInfo(LoginUserUtil.getUserId()); | |||
VUtils.isTrue(Objects.isNull(user)).throwMessage("获取登录用户失败!"); | |||
//放入用户的单位 | |||
req.setBuildOrgCode(user.getEmpPosUnitCode()); | |||
req.setBuildOrgCode(user.getMhUnitIdStr()); | |||
req.setPageNumber(CommonConst.EXPORT_PAGE_NUMBER); | |||
req.setPageSize(CommonConst.EXPORT_PAGE_SIZE); | |||
LambdaQueryWrapper<Project> query = ProjectHelper.projectQuery(req); | |||
@@ -8,16 +8,17 @@ import com.alibaba.fastjson.JSONArray; | |||
import com.alibaba.fastjson.JSONObject; | |||
import com.alibaba.fastjson.TypeReference; | |||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | |||
import com.baomidou.mybatisplus.core.toolkit.Assert; | |||
import com.baomidou.mybatisplus.core.toolkit.Wrappers; | |||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; | |||
import com.google.common.collect.Lists; | |||
import com.ningdatech.basic.exception.BizException; | |||
import com.ningdatech.basic.function.VUtils; | |||
import com.ningdatech.basic.model.PageVo; | |||
import com.ningdatech.basic.util.CollUtils; | |||
import com.ningdatech.basic.util.NdDateUtils; | |||
import com.ningdatech.basic.util.StrPool; | |||
import com.hz.pm.api.common.model.constant.BizConst; | |||
import com.hz.pm.api.common.model.constant.RegionConst; | |||
import com.hz.pm.api.common.enumeration.CommonEnum; | |||
import com.hz.pm.api.common.enumeration.ProjectProcessStageEnum; | |||
import com.hz.pm.api.common.helper.RegionCacheHelper; | |||
@@ -92,7 +93,7 @@ public class DeclaredProjectManage { | |||
private final DefaultDeclaredProjectManage defaultDeclaredProjectManage; | |||
private final NoticeManage noticeManage; | |||
private final UserInfoHelper userInfoHelper; | |||
private final RegionCacheHelper regionCacheHelper; | |||
@@ -113,18 +114,10 @@ public class DeclaredProjectManage { | |||
@Transactional(rollbackFor = Exception.class) | |||
public String startTheProcess(DefaultDeclaredDTO dto) { | |||
UserFullInfoDTO user = userInfoHelper.getUserFullInfo(LoginUserUtil.getUserId()); | |||
String employeeCode = user.getEmployeeCode(); | |||
VUtils.isTrue(StringUtils.isBlank(employeeCode)).throwMessage("获取登录用户 员工号 失败!"); | |||
ProjectDTO projectInfo = dto.getProjectInfo(); | |||
if(StringUtils.isNotBlank(user.getRegionCode())){ | |||
projectInfo.setAreaCode(user.getRegionCode()); | |||
projectInfo.setArea(regionCacheHelper.getRegionName(user.getRegionCode(), RegionConst.RL_COUNTY)); | |||
} | |||
projectInfo.setBuildOrgCode(user.getEmpPosUnitCode()); | |||
projectInfo.setBuildOrgName(user.getEmpPosUnitName()); | |||
projectInfo.setBuildOrgCode(user.getMhUnitIdStr()); | |||
projectInfo.setBuildOrgName(user.getMhUnitName()); | |||
//项目名称去重 | |||
defaultDeclaredProjectManage.checkDuplication(projectInfo); | |||
@@ -136,31 +129,27 @@ public class DeclaredProjectManage { | |||
projectInfo.setIsSuperOrg(CommonEnum.YES.getCode()); | |||
//如果主管单位没有 那么主管单位就是自己 | |||
if(CommonEnum.NO.getCode().equals(projectInfo.getIsSuperOrg())){ | |||
projectInfo.setSuperOrgCode(user.getEmpPosUnitCode()); | |||
projectInfo.setSuperOrg(user.getEmpPosUnitName()); | |||
if (CommonEnum.NO.getCode().equals(projectInfo.getIsSuperOrg())) { | |||
projectInfo.setSuperOrgCode(user.getMhUnitIdStr()); | |||
projectInfo.setSuperOrg(user.getMhUnitName()); | |||
} | |||
//如果是重新提交的话 判断下 项目是否存在 | |||
if(Objects.nonNull(projectInfo.getId())){ | |||
if (Objects.nonNull(projectInfo.getId())) { | |||
//新申报的项目不允许带项目id | |||
projectInfo.setId(null); | |||
} | |||
String regionCode = user.getRegionCode(); | |||
WflowModels model = processModelService.getOne(Wrappers.lambdaQuery(WflowModels.class) | |||
.eq(WflowModels::getRegionCode, regionCode) | |||
.eq(WflowModels::getProcessType, ProjectProcessStageEnum.ORG_INTERNAL_APPROVAL_PROCESS.getCode()) | |||
.last(BizConst.LIMIT_1)); | |||
if (Objects.isNull(model)) { | |||
log.error("此 【{}】区域找不到单位流程配置", regionCode); | |||
throw new BusinessException(String.format("此 【%s】区域找不到单位流程配置", regionCode)); | |||
throw new BusinessException("找不到单位流程配置"); | |||
} | |||
ProcessStartParamsVo params = new ProcessStartParamsVo(); | |||
params.setUser(defaultDeclaredProjectManage.buildUser(employeeCode)); | |||
params.setUser(defaultDeclaredProjectManage.buildUser(user.getUserId())); | |||
params.setProcessUsers(Collections.emptyMap()); | |||
//放入条件判断的项目字段 | |||
ProjectConditionDTO conditionDto = new ProjectConditionDTO(); | |||
@@ -173,21 +162,21 @@ public class DeclaredProjectManage { | |||
//开始申报 | |||
// 获取发起单位、发起单位主管单位、发起单位上级主管条线单位信息 | |||
Project project = new Project(); | |||
BeanUtils.copyProperties(projectInfo,project); | |||
Map<String, OrgInfoDTO> orgModelMap = defaultDeclaredProjectManage.buildOrgModelMap(employeeCode,project); | |||
String instanceId = processService.startProcessLs(model, params,orgModelMap); | |||
BeanUtils.copyProperties(projectInfo, project); | |||
Map<String, OrgInfoDTO> orgModelMap = defaultDeclaredProjectManage.buildOrgModelMap(user.getUserId(), project); | |||
String instanceId = processService.startProcessLs(model, params, orgModelMap); | |||
log.info("申报项目成功 【{}】", instanceId); | |||
//如果是重新提交的话 判断下 项目是否存在 | |||
//保存项目相关 | |||
Project buildProject = projectLibManage.saveProjectInDeclared(projectInfo,instanceId,employeeCode); | |||
if(Objects.nonNull(projectInfo.getDraftId())){ | |||
Project buildProject = projectLibManage.saveProjectInDeclared(projectInfo, instanceId, user.getUserId()); | |||
if (Objects.nonNull(projectInfo.getDraftId())) { | |||
//如果是草稿箱提交 删除对应的草稿箱 | |||
projectDraftService.removeById(projectInfo.getDraftId()); | |||
} | |||
//发送给第一个审批人消息 | |||
noticeManage.sendFirtUser(buildProject,model.getFormName(),instanceId, | |||
noticeManage.sendFirtUser(buildProject, model.getFormName(), instanceId, | |||
WorkNoticeConstant.PASS_MSG_TEMPLATE, MsgTypeEnum.PROJECT_REVIEW); | |||
return instanceId; | |||
@@ -203,22 +192,17 @@ public class DeclaredProjectManage { | |||
@Transactional(rollbackFor = Exception.class) | |||
public String reStartTheProcess(DefaultDeclaredDTO dto) { | |||
UserFullInfoDTO user = userInfoHelper.getUserFullInfo(LoginUserUtil.getUserId()); | |||
VUtils.isTrue(Objects.isNull(user) || Objects.isNull(user.getEmployeeCode())) | |||
.throwMessage("获取登录用户失败!"); | |||
String employeeCode = user.getEmployeeCode(); | |||
ProjectDTO projectDto = dto.getProjectInfo(); | |||
projectDto.setAreaCode(user.getRegionCode()); | |||
projectDto.setArea(regionCacheHelper.getRegionName(user.getRegionCode(), RegionConst.RL_COUNTY)); | |||
projectDto.setBuildOrgCode(user.getEmpPosUnitCode()); | |||
projectDto.setBuildOrgName(user.getEmpPosUnitName()); | |||
projectDto.setBuildOrgCode(user.getMhUnitIdStr()); | |||
projectDto.setBuildOrgName(user.getMhUnitName()); | |||
VUtils.isTrue(Objects.isNull(projectDto.getId())).throwMessage("提交失败 缺少项目ID!"); | |||
Project projectInfo = projectService.getById(projectDto.getId()); | |||
VUtils.isTrue(Objects.isNull(projectInfo)).throwMessage("提交失败 此项目不存在!"); | |||
//项目名称去重 | |||
if(StringUtils.isNotBlank(projectDto.getProjectName()) && | |||
!projectDto.getProjectName().equals(projectInfo.getProjectName())){ | |||
if (StringUtils.isNotBlank(projectDto.getProjectName()) && | |||
!projectDto.getProjectName().equals(projectInfo.getProjectName())) { | |||
projectDto.setProjectCode(projectInfo.getProjectCode()); | |||
defaultDeclaredProjectManage.checkDuplication(projectDto); | |||
} | |||
@@ -228,25 +212,22 @@ public class DeclaredProjectManage { | |||
projectInfo.setIsSuperOrg(CommonEnum.YES.getCode()); | |||
//如果主管单位没有 那么主管单位就是自己 | |||
if(CommonEnum.NO.getCode().equals(projectDto.getIsSuperOrg())){ | |||
projectInfo.setSuperOrgCode(user.getEmpPosUnitCode()); | |||
projectInfo.setSuperOrg(user.getEmpPosUnitName()); | |||
projectDto.setSuperOrgCode(user.getEmpPosUnitCode()); | |||
projectDto.setSuperOrg(user.getEmpPosUnitName()); | |||
if (CommonEnum.NO.getCode().equals(projectDto.getIsSuperOrg())) { | |||
projectInfo.setSuperOrgCode(user.getMhUnitIdStr()); | |||
projectInfo.setSuperOrg(user.getMhUnitName()); | |||
projectDto.setSuperOrgCode(user.getMhUnitIdStr()); | |||
projectDto.setSuperOrg(user.getMhUnitName()); | |||
} | |||
//判断申报金额 是否等于总的 判断年度支付金额 是否等于总金额 | |||
defaultDeclaredProjectManage.checkAmount(projectDto); | |||
String regionCode = projectInfo.getAreaCode(); | |||
WflowModels model = processModelService.getOne(Wrappers.lambdaQuery(WflowModels.class) | |||
.eq(WflowModels::getRegionCode, regionCode) | |||
.eq(WflowModels::getProcessType, ProjectProcessStageEnum.ORG_INTERNAL_APPROVAL_PROCESS.getCode()) | |||
.last(BizConst.LIMIT_1)); | |||
if (Objects.isNull(model)) { | |||
log.error("此 【{}】区域找不到单位流程配置", regionCode); | |||
throw new BusinessException(String.format("此 【%s】区域找不到单位流程配置", regionCode)); | |||
throw new BusinessException("找不到单位流程配置"); | |||
} | |||
//首先要判断 项目当前状态 是不是 单位内部拒绝 | |||
@@ -255,24 +236,24 @@ public class DeclaredProjectManage { | |||
.throwMessage("提交失败 该项目不是 单位内部拒绝审核状态或者未立项阶段"); | |||
ProcessStartParamsVo params = new ProcessStartParamsVo(); | |||
params.setUser(defaultDeclaredProjectManage.buildUser(employeeCode)); | |||
params.setUser(defaultDeclaredProjectManage.buildUser(user.getUserId())); | |||
params.setProcessUsers(Collections.emptyMap()); | |||
//把条件值给放入工作流 | |||
defaultDeclaredProjectManage.buildCondition(params,dto); | |||
defaultDeclaredProjectManage.buildCondition(params, dto); | |||
// 获取发起单位、发起单位主管单位、发起单位上级主管条线单位信息 | |||
Project project = new Project(); | |||
BeanUtils.copyProperties(projectDto,project); | |||
Map<String, OrgInfoDTO> orgModelMap = defaultDeclaredProjectManage.buildOrgModelMap(employeeCode,project); | |||
String instanceId = processService.startProcessLs(model, params,orgModelMap); | |||
BeanUtils.copyProperties(projectDto, project); | |||
Map<String, OrgInfoDTO> orgModelMap = defaultDeclaredProjectManage.buildOrgModelMap(user.getUserId(), project); | |||
String instanceId = processService.startProcessLs(model, params, orgModelMap); | |||
log.info("重新申报项目成功 【{}】", instanceId); | |||
//保存项目相关 | |||
Project buildProject = projectLibManage.saveProjectInDeclared(projectDto,instanceId,employeeCode); | |||
Project buildProject = projectLibManage.saveProjectInDeclared(projectDto, instanceId, user.getUserId()); | |||
//发送给第一个审批人消息 | |||
noticeManage.sendFirtUser(buildProject,model.getFormName(),instanceId, | |||
noticeManage.sendFirtUser(buildProject, model.getFormName(), instanceId, | |||
WorkNoticeConstant.PASS_MSG_TEMPLATE, MsgTypeEnum.PROJECT_REVIEW); | |||
return instanceId; | |||
@@ -282,7 +263,7 @@ public class DeclaredProjectManage { | |||
Long userId = LoginUserUtil.getUserId(); | |||
Page<ProjectDraft> page = params.page(); | |||
LambdaQueryWrapper<ProjectDraft> wrapper = Wrappers.lambdaQuery(ProjectDraft.class) | |||
.eq(ProjectDraft::getUserId,userId) | |||
.eq(ProjectDraft::getUserId, userId) | |||
.ge(Objects.nonNull(params.getStartTime()), ProjectDraft::getCreateOn, params.getStartTime()) | |||
.le(Objects.nonNull(params.getEndTime()), ProjectDraft::getCreateOn, params.getEndTime()) | |||
.eq(Objects.nonNull(params.getProjectType()), ProjectDraft::getProjectType, params.getProjectType()) | |||
@@ -304,16 +285,16 @@ public class DeclaredProjectManage { | |||
return PageVo.of(res, page.getTotal()); | |||
} | |||
public ProjectDraftVO draftDatail(Long id) { | |||
public ProjectDraftVO draftDetail(Long id) { | |||
ProjectDraft draft = projectDraftService.getById(id); | |||
ProjectDraftVO vo = new ProjectDraftVO(); | |||
BeanUtils.copyProperties(draft, vo); | |||
vo.setBizDomain(Objects.nonNull(draft.getBizDomain()) ? String.valueOf(draft.getBizDomain()) : StringUtils.EMPTY); | |||
if(StringUtils.isNotBlank(draft.getProjectApplicationList())){ | |||
vo.setApplicationList(JSON.parseArray(draft.getProjectApplicationList(),ProjectApplication.class)); | |||
if (StringUtils.isNotBlank(draft.getProjectApplicationList())) { | |||
vo.setApplicationList(JSON.parseArray(draft.getProjectApplicationList(), ProjectApplication.class)); | |||
} | |||
if(StringUtils.isNotBlank(draft.getDynamicForm())){ | |||
vo.setDynamicForm(JSON.parseObject(draft.getDynamicForm(),Map.class)); | |||
if (StringUtils.isNotBlank(draft.getDynamicForm())) { | |||
vo.setDynamicForm(JSON.parseObject(draft.getDynamicForm(), Map.class)); | |||
} | |||
return vo; | |||
} | |||
@@ -335,21 +316,20 @@ public class DeclaredProjectManage { | |||
draft.setIsHigherSuperOrg(CommonEnum.YES.getCode()); | |||
draft.setIsSuperOrg(CommonEnum.YES.getCode()); | |||
draft.setUserId(String.valueOf(userId)); | |||
draft.setBuildOrgCode(user.getEmpPosUnitCode()); | |||
draft.setBuildOrgName(user.getEmpPosUnitName()); | |||
draft.setAreaCode(user.getRegionCode()); | |||
draft.setBuildOrgCode(user.getMhUnitIdStr()); | |||
draft.setBuildOrgName(user.getMhUnitName()); | |||
if(CollUtil.isNotEmpty(projectInfo.getDynamicForm())){ | |||
if (CollUtil.isNotEmpty(projectInfo.getDynamicForm())) { | |||
draft.setDynamicForm(JSON.toJSONString(projectInfo.getDynamicForm())); | |||
} | |||
if(CollUtil.isNotEmpty(projectInfo.getApplicationList())){ | |||
if (CollUtil.isNotEmpty(projectInfo.getApplicationList())) { | |||
draft.setProjectApplicationList(JSON.toJSONString(projectInfo.getApplicationList())); | |||
} | |||
if (Objects.isNull(draft.getId())) { | |||
draft.setCreateOn(LocalDateTime.now()); | |||
}else{ | |||
} else { | |||
ProjectDraft old = projectDraftService.getById(draft.getId()); | |||
if(Objects.isNull(old)){ | |||
if (Objects.isNull(old)) { | |||
draft.setCreateOn(LocalDateTime.now()); | |||
} | |||
} | |||
@@ -361,45 +341,44 @@ public class DeclaredProjectManage { | |||
/** | |||
* 项目列表 | |||
* | |||
* @param req | |||
* @return | |||
*/ | |||
public PageVo<ProjectLibListItemVO> projectLibList(ProjectListReq req) { | |||
UserFullInfoDTO user = userInfoHelper.getUserFullInfo(LoginUserUtil.getUserId()); | |||
VUtils.isTrue(Objects.isNull(user)).throwMessage("获取登录用户失败!"); | |||
LambdaQueryWrapper<Project> query = ProjectHelper.projectQuery(req); | |||
//当非预审申报的时候 是自己单位 当是预审申报的时候 要主管单位 | |||
preQuery(query,user); | |||
query.eq(Project::getNewest,Boolean.TRUE); | |||
// 当非预审申报的时候 是自己单位 当是预审申报的时候 要主管单位 | |||
preQuery(query, user); | |||
query.eq(Project::getNewest, Boolean.TRUE); | |||
Page<Project> page = projectService.page(req.page(), query); | |||
long total; | |||
if ((total = page.getTotal()) == 0) { | |||
return PageVo.empty(); | |||
} | |||
List<ProjectLibListItemVO> records = CollUtils.convert(page.getRecords(), w -> BeanUtil.copyProperties(w,ProjectLibListItemVO.class)); | |||
List<ProjectLibListItemVO> records = CollUtils.convert(page.getRecords(), w -> BeanUtil.copyProperties(w, ProjectLibListItemVO.class)); | |||
return PageVo.of(records, total); | |||
} | |||
//当非预审申报的时候 是自己单位 当是预审申报的时候 要主管单位 并且他是单位管理员 | |||
private void preQuery(LambdaQueryWrapper<Project> query,UserFullInfoDTO user) { | |||
private void preQuery(LambdaQueryWrapper<Project> query, UserFullInfoDTO user) { | |||
//如果当前登录是单位管理员 | |||
if(user.getIsOrgAdmin()){ | |||
query.and(s1 -> s1.eq(Project::getStatus,ProjectStatusEnum.PREQUALIFICATION_FAILED.getCode()) | |||
.eq(Project::getSuperOrgCode,user.getEmpPosUnitCode()) | |||
.or(q2 -> q2.eq(Project::getBuildOrgCode,user.getEmpPosUnitCode()))); | |||
}else{ | |||
if (user.getIsOrgAdmin()) { | |||
query.and(s1 -> s1.eq(Project::getStatus, ProjectStatusEnum.PREQUALIFICATION_FAILED.getCode()) | |||
.eq(Project::getSuperOrgCode, user.getMhUnitId()) | |||
.or(q2 -> q2.eq(Project::getBuildOrgCode, user.getMhUnitId()))); | |||
} else { | |||
//否则 只能看到 非预审 并且 | |||
query.and(q2 -> q2.eq(Project::getBuildOrgCode,user.getEmpPosUnitCode())); | |||
query.and(q2 -> q2.eq(Project::getBuildOrgCode, user.getMhUnitId())); | |||
} | |||
} | |||
public void exportList(HttpServletResponse response, ProjectListReq param) { | |||
UserFullInfoDTO user = userInfoHelper.getUserFullInfo(LoginUserUtil.getUserId()); | |||
VUtils.isTrue(Objects.isNull(user)).throwMessage("获取登录用户失败!"); | |||
LambdaQueryWrapper<Project> query = ProjectHelper.projectQuery(param); | |||
//当非预审申报的时候 是自己单位 当是预审申报的时候 要主管单位 | |||
preQuery(query,user); | |||
query.eq(Project::getNewest,Boolean.TRUE); | |||
preQuery(query, user); | |||
query.eq(Project::getNewest, Boolean.TRUE); | |||
List<Project> records = projectService.list(query); | |||
AtomicInteger serialNumber = new AtomicInteger(0); | |||
@@ -414,7 +393,7 @@ public class DeclaredProjectManage { | |||
return exportDTO; | |||
}).collect(Collectors.toList()); | |||
String fileName = "项目申报列表"; | |||
ExcelDownUtil.setFileName(fileName,response); | |||
ExcelDownUtil.setFileName(fileName, response); | |||
//数据导出处理函数 | |||
try { | |||
EasyExcel.write(response.getOutputStream(), DeclaredProjectExportDTO.class) | |||
@@ -423,58 +402,59 @@ public class DeclaredProjectManage { | |||
.sheet(fileName) | |||
.doWrite(collect); | |||
} catch (IOException e) { | |||
throw new RuntimeException(e); | |||
throw new BizException(e); | |||
} | |||
} | |||
/** | |||
* 查询 核心业务 | |||
* @param businessName | |||
* @return | |||
* | |||
* @param businessName \ | |||
* @return \ | |||
*/ | |||
public JSONObject bizList(String businessName,Integer limit, Integer page,String orgCode) { | |||
public JSONObject bizList(String businessName, Integer limit, Integer page, String orgCode) { | |||
JSONObject jsonObject = new JSONObject(); | |||
UserInfoDetails user = LoginUserUtil.loginUserDetail(); | |||
if(BizConst.DEV.equals(active)){ | |||
if (BizConst.DEV.equals(active)) { | |||
jsonObject = JSONObject.parseObject(DeclaredProjectConst.Biz.CORE_BIZ); | |||
if(CollUtil.isEmpty(jsonObject)){ | |||
if (CollUtil.isEmpty(jsonObject)) { | |||
return jsonObject; | |||
} | |||
if(StringUtils.isNotBlank(businessName)){ | |||
if (StringUtils.isNotBlank(businessName)) { | |||
JSONArray dataArray = jsonObject.getJSONArray(BizConst.RESPONSE_KEY_DATA); | |||
if(CollUtil.isEmpty(dataArray)){ | |||
if (CollUtil.isEmpty(dataArray)) { | |||
return new JSONObject(); | |||
} | |||
Iterator iter = dataArray.stream().iterator(); | |||
Iterator<Object> iter = dataArray.stream().iterator(); | |||
JSONArray dataArrayRes = new JSONArray(); | |||
while (iter.hasNext()) { | |||
JSONObject value = (JSONObject) iter.next(); | |||
String businessValue = value.getString("matterName"); | |||
if(StringUtils.isNotBlank(businessValue) && businessValue.contains(businessName)){ | |||
if (StringUtils.isNotBlank(businessValue) && businessValue.contains(businessName)) { | |||
dataArrayRes.add(value); | |||
} | |||
} | |||
jsonObject.put("data",dataArrayRes); | |||
jsonObject.put("total",dataArrayRes.size()); | |||
jsonObject.put("data", dataArrayRes); | |||
jsonObject.put("total", dataArrayRes.size()); | |||
} | |||
}else if(BizConst.PRE.equals(active) || | |||
BizConst.PROD.equals(active)){ | |||
if(StringUtils.isNotBlank(orgCode)){ | |||
} else if (BizConst.PRE.equals(active) || | |||
BizConst.PROD.equals(active)) { | |||
if (StringUtils.isNotBlank(orgCode)) { | |||
String[] orgCodes = orgCode.split(StrPool.COMMA); | |||
JSONArray finalArray = new JSONArray(); | |||
for(String og : orgCodes){ | |||
JSONObject res = projectIrsManage.searchCoreBiz(businessName,og,limit,page); | |||
if(Objects.nonNull(res)){ | |||
for (String og : orgCodes) { | |||
JSONObject res = projectIrsManage.searchCoreBiz(businessName, og, limit, page); | |||
if (Objects.nonNull(res)) { | |||
JSONArray dataArray = res.getJSONArray(BizConst.RESPONSE_KEY_DATA); | |||
if(CollUtil.isNotEmpty(dataArray)){ | |||
if (CollUtil.isNotEmpty(dataArray)) { | |||
finalArray.addAll(dataArray); | |||
} | |||
} | |||
} | |||
jsonObject.put("data",finalArray); | |||
jsonObject.put("total",finalArray.size()); | |||
}else{ | |||
jsonObject = projectIrsManage.searchCoreBiz(businessName,user.getEmpPosUnitCode(),limit,page); | |||
jsonObject.put("data", finalArray); | |||
jsonObject.put("total", finalArray.size()); | |||
} else { | |||
jsonObject = projectIrsManage.searchCoreBiz(businessName, user.getMhUnitIdStr(), limit, page); | |||
} | |||
} | |||
return jsonObject; | |||
@@ -482,13 +462,13 @@ public class DeclaredProjectManage { | |||
/** | |||
* 预审失败的时候 可以删除项目 | |||
* @param projectCode | |||
* | |||
* @param projectCode \ | |||
*/ | |||
@Transactional | |||
public String removeProject(String projectCode) { | |||
Project project = projectService.getProjectByCode(projectCode); | |||
VUtils.isTrue(Objects.isNull(project)) | |||
.throwMessage("该项目不存在"); | |||
Assert.notNull(project, "该项目不存在"); | |||
VUtils.isTrue(Objects.isNull(project.getStatus()) || | |||
!ProjectStatusEnum.PREQUALIFICATION_FAILED.getCode().equals(project.getStatus())) | |||
.throwMessage("不是预审不通过 状态 不能删除!"); | |||
@@ -4,11 +4,10 @@ import com.alibaba.fastjson.JSON; | |||
import com.alibaba.fastjson.TypeReference; | |||
import com.baomidou.mybatisplus.core.toolkit.Wrappers; | |||
import com.google.common.collect.Maps; | |||
import com.ningdatech.basic.function.VUtils; | |||
import com.hz.pm.api.common.model.constant.BizConst; | |||
import com.hz.pm.api.common.model.constant.RegionConst; | |||
import com.hz.pm.api.common.enumeration.CommonEnum; | |||
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.RegionConst; | |||
import com.hz.pm.api.projectdeclared.model.dto.DefaultDeclaredDTO; | |||
import com.hz.pm.api.projectdeclared.model.dto.ProjectConditionDTO; | |||
import com.hz.pm.api.projectdeclared.model.po.DeclaredProjectStatisticsPO; | |||
@@ -17,6 +16,7 @@ import com.hz.pm.api.projectlib.model.dto.ProjectDTO; | |||
import com.hz.pm.api.projectlib.model.entity.Project; | |||
import com.hz.pm.api.projectlib.service.IProjectService; | |||
import com.hz.pm.api.user.security.model.UserFullInfoDTO; | |||
import com.ningdatech.basic.function.VUtils; | |||
import com.wflow.bean.entity.WflowModels; | |||
import com.wflow.bean.entity.WflowOrgModels; | |||
import com.wflow.enums.OrgTypeEnum; | |||
@@ -31,13 +31,13 @@ import lombok.RequiredArgsConstructor; | |||
import lombok.extern.slf4j.Slf4j; | |||
import org.springframework.beans.BeanUtils; | |||
import org.springframework.stereotype.Component; | |||
import java.math.BigDecimal; | |||
import java.util.*; | |||
import java.util.stream.Collectors; | |||
/** | |||
* @Classname DefaultDeclaredProjectManage | |||
* | |||
* @Description | |||
* @Date 2023/2/14 17:12 | |||
* @Author PoffyZhang | |||
@@ -59,24 +59,22 @@ public class DefaultDeclaredProjectManage { | |||
/** | |||
* 公共的发起流程方法 | |||
*/ | |||
public void startProcess(ProjectDTO projectDTO,UserFullInfoDTO user,Integer processType){ | |||
public void startProcess(ProjectDTO projectDTO, UserFullInfoDTO user, Integer processType) { | |||
WflowModels model = processModelService.getOne(Wrappers.lambdaQuery(WflowModels.class) | |||
.eq(WflowModels::getRegionCode, user.getRegionCode()) | |||
.eq(WflowModels::getProcessType, processType) | |||
.last(BizConst.LIMIT_1)); | |||
if (Objects.isNull(model)) { | |||
log.error("此 【{}】区域找不到对应流程配置", user.getRegionCode()); | |||
throw new BusinessException(String.format("此 【%s】区域找不到对应流程配置", user.getRegionCode())); | |||
throw new BusinessException("找不到对应流程配置"); | |||
} | |||
ProcessStartParamsVo params = new ProcessStartParamsVo(); | |||
params.setUser(buildUser(user.getEmployeeCode())); | |||
params.setUser(buildUser(user.getUserId())); | |||
params.setProcessUsers(Collections.emptyMap()); | |||
//放入条件判断的项目字段 | |||
ProjectConditionDTO conditionDto = new ProjectConditionDTO(); | |||
BeanUtils.copyProperties(projectDTO, conditionDto); | |||
Map<String,Object> formData = Maps.newHashMap(); | |||
Map<String, Object> formData = Maps.newHashMap(); | |||
formData.putAll( | |||
JSON.parseObject(JSON.toJSONString(conditionDto), new TypeReference<Map<String, Object>>() { | |||
}) | |||
@@ -86,16 +84,16 @@ public class DefaultDeclaredProjectManage { | |||
} | |||
//项目名称去重 | |||
public void checkDuplication(ProjectDTO project){ | |||
public void checkDuplication(ProjectDTO project) { | |||
VUtils.isTrue(projectService.count(Wrappers.lambdaQuery(Project.class) | |||
.eq(Project::getProjectName,project.getProjectName()) | |||
.eq(Project::getNewest,Boolean.TRUE) | |||
.ne(Objects.nonNull(project.getProjectCode()),Project::getProjectCode,project.getProjectCode())) > 0) | |||
.throwMessage(String.format("修改失败 此项目名 【%s】 已存在!",project.getProjectName())); | |||
.eq(Project::getProjectName, project.getProjectName()) | |||
.eq(Project::getNewest, Boolean.TRUE) | |||
.ne(Objects.nonNull(project.getProjectCode()), Project::getProjectCode, project.getProjectCode())) > 0) | |||
.throwMessage(String.format("修改失败 此项目名 【%s】 已存在!", project.getProjectName())); | |||
} | |||
public void checkAmount(ProjectDTO projectInfo) { | |||
if(Objects.nonNull(projectInfo.getDeclareAmount())){ | |||
if (Objects.nonNull(projectInfo.getDeclareAmount())) { | |||
BigDecimal declareAmount = projectInfo.getDeclareAmount(); | |||
BigDecimal govSuperFinanceAmount = projectInfo.getDeclareGovSuperiorFinanceAmount(); | |||
BigDecimal govOwnFinanceAmount = projectInfo.getDeclareGovOwnFinanceAmount(); | |||
@@ -105,16 +103,16 @@ public class DefaultDeclaredProjectManage { | |||
BigDecimal totalAmount = govSuperFinanceAmount | |||
.add(govOwnFinanceAmount).add(bankLendingAmount).add(haveAmount).add(otherAmount); | |||
VUtils.isTrue(declareAmount.compareTo(totalAmount) != 0) | |||
.throwMessage(String.format("申报失败! 申报总金额【%s】 不等于其它申报金额 【%s】",declareAmount,totalAmount)); | |||
.throwMessage(String.format("申报失败! 申报总金额【%s】 不等于其它申报金额 【%s】", declareAmount, totalAmount)); | |||
//判断 年度计划金额 如果开着的话 | |||
if(Objects.nonNull(projectInfo.getAnnualPlanAmount())){ | |||
if (Objects.nonNull(projectInfo.getAnnualPlanAmount())) { | |||
BigDecimal annualPlanAmount = projectInfo.getAnnualPlanAmount(); | |||
VUtils.isTrue(annualPlanAmount.compareTo(BigDecimal.ZERO) <= 0) | |||
.throwMessage(String.format("申报失败! 年度支付总金额【%s】 不能小于等于0",annualPlanAmount)); | |||
.throwMessage(String.format("申报失败! 年度支付总金额【%s】 不能小于等于0", annualPlanAmount)); | |||
VUtils.isTrue(annualPlanAmount.compareTo(declareAmount) > 0) | |||
.throwMessage(String.format("申报失败! 年度支付总金额【%s】 不能大于申报金额 【%s】",annualPlanAmount,declareAmount)); | |||
.throwMessage(String.format("申报失败! 年度支付总金额【%s】 不能大于申报金额 【%s】", annualPlanAmount, declareAmount)); | |||
BigDecimal annualGovSuperAmount = projectInfo.getAnnualPlanGovSuperiorFinanceAmount(); | |||
BigDecimal annualOwnSuperAmount = projectInfo.getAnnualPlanGovOwnFinanceAmount(); | |||
@@ -124,46 +122,46 @@ public class DefaultDeclaredProjectManage { | |||
BigDecimal totalAnnual = annualGovSuperAmount | |||
.add(annualOwnSuperAmount).add(annualBankLendingAmount).add(annualHaveAmount).add(anualOtherAmount); | |||
VUtils.isTrue(annualPlanAmount.compareTo(totalAnnual) != 0) | |||
.throwMessage(String.format("申报失败! 年度支付总金额【%s】 不等于其它年度支付金额 【%s】",annualPlanAmount,totalAnnual)); | |||
.throwMessage(String.format("申报失败! 年度支付总金额【%s】 不等于其它年度支付金额 【%s】", annualPlanAmount, totalAnnual)); | |||
} | |||
} | |||
} | |||
public ProcessInstanceUserDto buildUser(String employeeCode){ | |||
UserFullInfoDTO userInfoDetail = userInfoHelper.getUserFullInfoByEmployeeCode(employeeCode); | |||
public ProcessInstanceUserDto buildUser(Long userId) { | |||
UserFullInfoDTO userInfoDetail = userInfoHelper.getUserFullInfo(userId); | |||
VUtils.isTrue(Objects.isNull(userInfoDetail)) | |||
.throwMessage(String.format("【%s】获取不到用户!",employeeCode)); | |||
.throwMessage(String.format("【%s】获取不到用户!", userId)); | |||
return ProcessInstanceUserDto.builder() | |||
.userId(String.valueOf(userInfoDetail.getEmployeeCode())) | |||
.userId(String.valueOf(userInfoDetail.getUserId())) | |||
.userName(userInfoDetail.getRealName()) | |||
.orgCode(userInfoDetail.getEmpPosUnitCode()) | |||
.orgName(userInfoDetail.getEmpPosUnitName()) | |||
.orgCode(String.valueOf(userInfoDetail.getMhUnitId())) | |||
.orgName(userInfoDetail.getMhUnitName()) | |||
.build(); | |||
} | |||
public Map<String, OrgInfoDTO> buildOrgModelMap(String employeeCode,Project project) { | |||
public Map<String, OrgInfoDTO> buildOrgModelMap(Long userId, Project project) { | |||
Map<String, OrgInfoDTO> orgMap = new HashMap<>(); | |||
// 查出所有的单位流程配置 | |||
List<WflowOrgModels> orgModelsList = orgProcdefService.list(); | |||
UserFullInfoDTO userFullInfo = userInfoHelper.getUserFullInfoByEmployeeCode(employeeCode); | |||
if(Objects.isNull(userFullInfo)){ | |||
UserFullInfoDTO userFullInfo = userInfoHelper.getUserFullInfo(userId); | |||
if (Objects.isNull(userFullInfo)) { | |||
log.warn("取不到员工 返回空map"); | |||
return Collections.emptyMap(); | |||
} | |||
String startOrgCode = userFullInfo.getEmpPosUnitCode(); | |||
String startOrgName = userFullInfo.getEmpPosUnitName(); | |||
String startOrgCode = String.valueOf(userFullInfo.getMhUnitId()); | |||
String startOrgName = userFullInfo.getMhUnitName(); | |||
String startOrgParentCode; | |||
String startOrgParentName; | |||
// 如果申报时 上级主管单位,由该单位自己审核 | |||
if (CommonEnum.NO.getCode().equals(project.getIsSuperOrg())){ | |||
if (CommonEnum.NO.getCode().equals(project.getIsSuperOrg())) { | |||
startOrgParentCode = startOrgCode; | |||
startOrgParentName = startOrgName; | |||
}else { | |||
} else { | |||
startOrgParentCode = project.getSuperOrgCode(); | |||
startOrgParentName = project.getSuperOrg(); | |||
} | |||
@@ -175,7 +173,7 @@ public class DefaultDeclaredProjectManage { | |||
startOrgInfoDto.setOrgModelMap(orgModelsList.stream() | |||
.filter(v -> v.getOrgCode().equals(startOrgCode) | |||
&& Boolean.FALSE.equals(v.getIsDelete()) | |||
&& (ProcessDefTypeEnum.SEAL.name().equals(v.getType())|| | |||
&& (ProcessDefTypeEnum.SEAL.name().equals(v.getType()) || | |||
ProcessDefTypeEnum.JOINT_REVIEW.name().equals(v.getType()) || | |||
ProcessDefTypeEnum.DEFAULT.name().equals(v.getType()))) | |||
.collect(Collectors.toMap(WflowOrgModels::getType, v -> v))); | |||
@@ -191,18 +189,18 @@ public class DefaultDeclaredProjectManage { | |||
ProcessDefTypeEnum.DEFAULT.name().equals(v.getType()))) | |||
.collect(Collectors.toMap(WflowOrgModels::getType, v -> v))); | |||
orgMap.put(OrgTypeEnum.TARGET_OWNER.name(),startOrgInfoDto); | |||
orgMap.put(OrgTypeEnum.TARGET_MANAGEMENT.name(),parentOrgInfoDto); | |||
orgMap.put(OrgTypeEnum.TARGET_OWNER.name(), startOrgInfoDto); | |||
orgMap.put(OrgTypeEnum.TARGET_MANAGEMENT.name(), parentOrgInfoDto); | |||
// 如果是指定单位,直接根据流程定义ID放入map | |||
OrgInfoDTO orgInfoDTO = new OrgInfoDTO(); | |||
orgInfoDTO.setOrgModelMap(orgModelsList.stream() | |||
.collect(Collectors.toMap(WflowOrgModels::getProcessDefId, v -> v))); | |||
orgMap.put(OrgTypeEnum.TARGET_LABEL.name(),orgInfoDTO); | |||
orgMap.put(OrgTypeEnum.TARGET_LABEL.name(), orgInfoDTO); | |||
//如果有上级条线主管单位 并且 不是市本级 | |||
if(!RegionConst.RC_HZ.equals(project.getAreaCode()) && | |||
CommonEnum.YES.getCode().equals(project.getIsHigherSuperOrg())){ | |||
if (!RegionConst.RC_HZ.equals(project.getAreaCode()) && | |||
CommonEnum.YES.getCode().equals(project.getIsHigherSuperOrg())) { | |||
OrgInfoDTO parentLineOrgInfoDto = new OrgInfoDTO(); | |||
parentLineOrgInfoDto.setOrganizationCode(project.getHigherSuperOrgCode()); | |||
parentLineOrgInfoDto.setOrganizationName(project.getHigherSuperOrg()); | |||
@@ -214,7 +212,7 @@ public class DefaultDeclaredProjectManage { | |||
ProcessDefTypeEnum.DEFAULT.name().equals(v.getType()))) | |||
.collect(Collectors.toMap(WflowOrgModels::getType, v -> v))); | |||
orgMap.put(OrgTypeEnum.TARGET_LINE_MANAGEMENT.name(),parentLineOrgInfoDto); | |||
orgMap.put(OrgTypeEnum.TARGET_LINE_MANAGEMENT.name(), parentLineOrgInfoDto); | |||
} | |||
return orgMap; | |||
} | |||
@@ -230,10 +228,10 @@ public class DefaultDeclaredProjectManage { | |||
String startOrgParentCode; | |||
String startOrgParentName; | |||
// 如果申报时 上级主管单位,由该单位自己审核 | |||
if (CommonEnum.NO.getCode().equals(project.getIsSuperOrg())){ | |||
if (CommonEnum.NO.getCode().equals(project.getIsSuperOrg())) { | |||
startOrgParentCode = startOrgCode; | |||
startOrgParentName = startOrgName; | |||
}else { | |||
} else { | |||
startOrgParentCode = project.getSuperOrgCode(); | |||
startOrgParentName = project.getSuperOrg(); | |||
} | |||
@@ -261,18 +259,18 @@ public class DefaultDeclaredProjectManage { | |||
ProcessDefTypeEnum.DEFAULT.name().equals(v.getType()))) | |||
.collect(Collectors.toMap(WflowOrgModels::getType, v -> v))); | |||
orgMap.put(OrgTypeEnum.TARGET_OWNER.name(),startOrgInfoDto); | |||
orgMap.put(OrgTypeEnum.TARGET_MANAGEMENT.name(),parentOrgInfoDto); | |||
orgMap.put(OrgTypeEnum.TARGET_OWNER.name(), startOrgInfoDto); | |||
orgMap.put(OrgTypeEnum.TARGET_MANAGEMENT.name(), parentOrgInfoDto); | |||
// 如果是指定单位,直接根据流程定义ID放入map | |||
OrgInfoDTO orgInfoDTO = new OrgInfoDTO(); | |||
orgInfoDTO.setOrgModelMap(orgModelsList.stream() | |||
.collect(Collectors.toMap(WflowOrgModels::getProcessDefId, v -> v))); | |||
orgMap.put(OrgTypeEnum.TARGET_LABEL.name(),orgInfoDTO); | |||
orgMap.put(OrgTypeEnum.TARGET_LABEL.name(), orgInfoDTO); | |||
//如果有上级条线主管单位 并且 不是市本级 | |||
if(!RegionConst.RC_HZ.equals(project.getAreaCode()) && | |||
CommonEnum.YES.getCode().equals(project.getIsHigherSuperOrg())){ | |||
if (!RegionConst.RC_HZ.equals(project.getAreaCode()) && | |||
CommonEnum.YES.getCode().equals(project.getIsHigherSuperOrg())) { | |||
OrgInfoDTO parentLineOrgInfoDto = new OrgInfoDTO(); | |||
parentLineOrgInfoDto.setOrganizationCode(project.getHigherSuperOrgCode()); | |||
parentLineOrgInfoDto.setOrganizationName(project.getHigherSuperOrg()); | |||
@@ -284,25 +282,26 @@ public class DefaultDeclaredProjectManage { | |||
ProcessDefTypeEnum.DEFAULT.name().equals(v.getType()))) | |||
.collect(Collectors.toMap(WflowOrgModels::getType, v -> v))); | |||
orgMap.put(OrgTypeEnum.TARGET_LINE_MANAGEMENT.name(),parentLineOrgInfoDto); | |||
orgMap.put(OrgTypeEnum.TARGET_LINE_MANAGEMENT.name(), parentLineOrgInfoDto); | |||
} | |||
return orgMap; | |||
} | |||
//根据提交者的单位 | |||
public DeclaredProjectStatisticsPO declaredProjectOrgStatistics(Integer year, UserFullInfoDTO user){ | |||
public DeclaredProjectStatisticsPO declaredProjectOrgStatistics(Integer year, UserFullInfoDTO user) { | |||
//查此人建设单位的项目 | |||
return statisticsService.getOrgStatistics(user.getEmpPosUnitCode(),year); | |||
return statisticsService.getOrgStatistics(user.getMhUnitIdStr(), year); | |||
} | |||
//根据提交者的区域 他是区管或者超管 | |||
public DeclaredProjectStatisticsPO declaredProjectRegionStatistics(Integer year, UserFullInfoDTO user){ | |||
public DeclaredProjectStatisticsPO declaredProjectRegionStatistics(Integer year, UserFullInfoDTO user) { | |||
//查此人建设单位的项目 | |||
return statisticsService.getRegionStatistics(user.getRegionCode(),year); | |||
return statisticsService.getRegionStatistics(null, year); | |||
} | |||
/** | |||
* 把条件值放入工作流 用于判断条件 根据dto | |||
* | |||
* @param params | |||
* @param dto | |||
*/ | |||
@@ -319,6 +318,7 @@ public class DefaultDeclaredProjectManage { | |||
/** | |||
* 把条件值放入工作流 用于判断条件 根据d项目实体 | |||
* | |||
* @param params | |||
* @param projectInfo | |||
*/ | |||
@@ -330,19 +330,19 @@ public class DefaultDeclaredProjectManage { | |||
})); | |||
} | |||
public void buildCondition(ProcessStartParamsVo params, Project projectInfo,DefaultDeclaredDTO dto) { | |||
public void buildCondition(ProcessStartParamsVo params, Project projectInfo, DefaultDeclaredDTO dto) { | |||
//放入条件判断的项目字段 优先取dto的 再取项目的 | |||
ProjectDTO pdto = dto.getProjectInfo(); | |||
ProjectConditionDTO conditionDto = new ProjectConditionDTO(); | |||
conditionDto.setProjectId(projectInfo.getId()); | |||
conditionDto.setDeclareAmount(Objects.nonNull(pdto) && Objects.nonNull(pdto.getDeclareAmount()) | |||
?pdto.getDeclareAmount() : projectInfo.getDeclareAmount()); | |||
? pdto.getDeclareAmount() : projectInfo.getDeclareAmount()); | |||
conditionDto.setIsDigitalReform(Objects.nonNull(pdto) && Objects.nonNull(pdto.getIsDigitalReform()) | |||
?pdto.getIsDigitalReform() : projectInfo.getIsDigitalReform()); | |||
? pdto.getIsDigitalReform() : projectInfo.getIsDigitalReform()); | |||
conditionDto.setIsTemporaryAugment(Objects.nonNull(pdto) && Objects.nonNull(pdto.getIsTemporaryAugment()) | |||
?pdto.getIsTemporaryAugment() : projectInfo.getIsTemporaryAugment()); | |||
? pdto.getIsTemporaryAugment() : projectInfo.getIsTemporaryAugment()); | |||
conditionDto.setBizDomain(Objects.nonNull(pdto) && Objects.nonNull(pdto.getBizDomain()) | |||
?pdto.getBizDomain() : projectInfo.getBizDomain()); | |||
? pdto.getBizDomain() : projectInfo.getBizDomain()); | |||
params.setFormData(JSON.parseObject(JSON.toJSONString(conditionDto), new TypeReference<Map<String, Object>>() { | |||
})); | |||
} | |||
@@ -97,9 +97,9 @@ public class DelayedApplyManage { | |||
UserFullInfoDTO user = userInfoHelper.getUserFullInfo(LoginUserUtil.getUserId()); | |||
VUtils.isTrue(Objects.isNull(user)).throwMessage("获取登录用户失败!"); | |||
LambdaQueryWrapper<Project> query = ProjectHelper.projectQuery(req); | |||
//待终验 并且已经过期 | |||
//只能看自己单位的 | |||
query.eq(Project::getBuildOrgCode, user.getEmpPosUnitCode()); | |||
// 待终验 并且已经过期 | |||
// 只能看自己单位的 | |||
query.eq(Project::getBuildOrgCode, user.getMhUnitId()); | |||
query.eq(Project::getStatus, ProjectStatusEnum.TO_BE_FINALLY_INSPECTED.getCode()); | |||
query.eq(Project::getStage, ProjectStatusEnum.PROJECT_APPROVED.getCode()); | |||
query.lt(Project::getPlanAcceptanceTime, LocalDateTime.now()); | |||
@@ -167,9 +167,9 @@ public class DelayedApplyManage { | |||
UserFullInfoDTO user = userInfoHelper.getUserFullInfo(LoginUserUtil.getUserId()); | |||
VUtils.isTrue(Objects.isNull(user)).throwMessage("获取登录用户失败!"); | |||
LambdaQueryWrapper<Project> query = ProjectHelper.projectQuery(param); | |||
//待终验 | |||
//只能看自己单位的 | |||
query.eq(Project::getBuildOrgCode, user.getEmpPosUnitCode()); | |||
// 待终验 | |||
// 只能看自己单位的 | |||
query.eq(Project::getBuildOrgCode, user.getMhUnitId()); | |||
query.eq(Project::getStatus, ProjectStatusEnum.TO_BE_FINALLY_INSPECTED.getCode()); | |||
query.eq(Project::getStage, ProjectStatusEnum.PROJECT_APPROVED.getCode()); | |||
query.eq(Project::getNewest, Boolean.TRUE); | |||
@@ -197,7 +197,7 @@ public class DelayedApplyManage { | |||
String fileName = "待终验申请项目列表"; | |||
ExcelDownUtil.setFileName(fileName, response); | |||
//数据导出处理函数 | |||
// 数据导出处理函数 | |||
try { | |||
EasyExcel.write(response.getOutputStream(), DeclaredProjectExportDTO.class) | |||
.autoCloseStream(false) | |||
@@ -218,9 +218,6 @@ public class DelayedApplyManage { | |||
*/ | |||
public String delayedApply(DelayedApplyDTO dto) { | |||
UserFullInfoDTO user = userInfoHelper.getUserFullInfo(LoginUserUtil.getUserId()); | |||
String employeeCode = user.getEmployeeCode(); | |||
VUtils.isTrue(StringUtils.isBlank(employeeCode)).throwMessage("获取登录用户 员工号 失败!"); | |||
Long projectId = dto.getProjectId(); | |||
Project project = projectService.getNewProject(projectId); | |||
VUtils.isTrue(Objects.isNull(project)).throwMessage("提交失败 此项目不存在!"); | |||
@@ -246,9 +243,6 @@ public class DelayedApplyManage { | |||
@Transactional(rollbackFor = Exception.class) | |||
public String startDelayedApplyProcess(DelayedApplyDTO dto) { | |||
UserFullInfoDTO user = userInfoHelper.getUserFullInfo(LoginUserUtil.getUserId()); | |||
String employeeCode = user.getEmployeeCode(); | |||
VUtils.isTrue(StringUtils.isBlank(employeeCode)).throwMessage("获取登录用户 员工号 失败!"); | |||
Long projectId = dto.getProjectId(); | |||
Project project = projectService.getNewProject(projectId); | |||
VUtils.isTrue(Objects.isNull(project)).throwMessage("提交失败 此项目不存在!"); | |||
@@ -275,7 +269,7 @@ public class DelayedApplyManage { | |||
} | |||
ProcessStartParamsVo params = new ProcessStartParamsVo(); | |||
params.setUser(defaultDeclaredProjectManage.buildUser(employeeCode)); | |||
params.setUser(defaultDeclaredProjectManage.buildUser(user.getUserId())); | |||
params.setProcessUsers(Collections.emptyMap()); | |||
//放入条件判断的项目字段 | |||
//把条件值给放入工作流 | |||
@@ -87,11 +87,10 @@ public class FinalAcceptanceManage { | |||
*/ | |||
public PageVo<ProjectLibListItemVO> projectLibList(ProjectListReq req) { | |||
UserFullInfoDTO user = userInfoHelper.getUserFullInfo(LoginUserUtil.getUserId()); | |||
VUtils.isTrue(Objects.isNull(user)).throwMessage("获取登录用户失败!"); | |||
LambdaQueryWrapper<Project> query = ProjectHelper.projectQuery(req); | |||
//待终验 并且还未过期 | |||
//只能看自己单位的 | |||
query.eq(Project::getBuildOrgCode, user.getEmpPosUnitCode()); | |||
query.eq(Project::getBuildOrgCode, user.getMhUnitId()); | |||
query.eq(Project::getStatus, ProjectStatusEnum.TO_BE_FINALLY_INSPECTED.getCode()); | |||
query.eq(Project::getStage, ProjectStatusEnum.PROJECT_APPROVED.getCode()); | |||
query.ge(Project::getPlanAcceptanceTime, LocalDateTime.now()); | |||
@@ -132,11 +131,10 @@ public class FinalAcceptanceManage { | |||
public void exportList(HttpServletResponse response, ProjectListReq param) { | |||
UserFullInfoDTO user = userInfoHelper.getUserFullInfo(LoginUserUtil.getUserId()); | |||
VUtils.isTrue(Objects.isNull(user)).throwMessage("获取登录用户失败!"); | |||
LambdaQueryWrapper<Project> query = ProjectHelper.projectQuery(param); | |||
//待终验 | |||
//只能看自己单位的 | |||
query.eq(Project::getBuildOrgCode, user.getEmpPosUnitCode()); | |||
query.eq(Project::getBuildOrgCode, user.getMhUnitId()); | |||
query.eq(Project::getStatus, ProjectStatusEnum.TO_BE_FINALLY_INSPECTED.getCode()); | |||
query.eq(Project::getStage, ProjectStatusEnum.PROJECT_APPROVED.getCode()); | |||
query.eq(Project::getNewest, Boolean.TRUE); | |||
@@ -199,10 +197,6 @@ public class FinalAcceptanceManage { | |||
*/ | |||
public String startProcess(DefaultDeclaredDTO dto) { | |||
UserFullInfoDTO user = userInfoHelper.getUserFullInfo(LoginUserUtil.getUserId()); | |||
String employeeCode = user.getEmployeeCode(); | |||
VUtils.isTrue(Objects.isNull(user) || Objects.isNull(employeeCode)) | |||
.throwMessage("获取登录用户失败!"); | |||
ProjectDTO projectDto = dto.getProjectInfo(); | |||
VUtils.isTrue(Objects.isNull(projectDto.getId())).throwMessage("提交失败 缺少项目ID!"); | |||
Project projectInfo = projectService.getNewProject(projectDto.getId()); | |||
@@ -228,13 +222,13 @@ public class FinalAcceptanceManage { | |||
.throwMessage("提交失败 该项目不是 待终验状态|不通过或者已立项阶段"); | |||
ProcessStartParamsVo params = new ProcessStartParamsVo(); | |||
params.setUser(declaredProjectManage.buildUser(employeeCode)); | |||
params.setUser(declaredProjectManage.buildUser(user.getUserId())); | |||
params.setProcessUsers(Collections.emptyMap()); | |||
//放入条件判断的项目字段 | |||
//把条件值给放入工作流 | |||
declaredProjectManage.buildCondition(params, projectInfo); | |||
// 获取发起单位、发起单位主管单位、发起单位上级条线主管单位信息 | |||
Map<String, OrgInfoDTO> orgModelMap = declaredProjectManage.buildOrgModelMap(employeeCode, projectInfo); | |||
Map<String, OrgInfoDTO> orgModelMap = declaredProjectManage.buildOrgModelMap(user.getUserId(), projectInfo); | |||
String instanceId = processInstanceService.startProcessLs(model, params, orgModelMap); | |||
log.info("终验方案项目申报成功 【{}】", instanceId); | |||
@@ -258,10 +252,6 @@ public class FinalAcceptanceManage { | |||
*/ | |||
public String restartProcess(DefaultDeclaredDTO dto) { | |||
UserFullInfoDTO user = userInfoHelper.getUserFullInfo(LoginUserUtil.getUserId()); | |||
String employeeCode = user.getEmployeeCode(); | |||
VUtils.isTrue(Objects.isNull(user) || Objects.isNull(employeeCode)) | |||
.throwMessage("获取登录用户失败!"); | |||
ProjectDTO projectDto = dto.getProjectInfo(); | |||
VUtils.isTrue(Objects.isNull(projectDto.getId())).throwMessage("重新提交失败 缺少项目ID!"); | |||
Project projectInfo = projectService.getNewProject(projectDto.getId()); | |||
@@ -287,13 +277,13 @@ public class FinalAcceptanceManage { | |||
.throwMessage("提交失败 该项目不是 待终验状态|不通过或者已立项阶段"); | |||
ProcessStartParamsVo params = new ProcessStartParamsVo(); | |||
params.setUser(declaredProjectManage.buildUser(employeeCode)); | |||
params.setUser(declaredProjectManage.buildUser(user.getUserId())); | |||
params.setProcessUsers(Collections.emptyMap()); | |||
//放入条件判断的项目字段 | |||
//把条件值给放入工作流 | |||
declaredProjectManage.buildCondition(params, projectInfo, dto); | |||
// 获取发起单位、发起单位主管单位、发起单位上级条线主管单位信息 | |||
Map<String, OrgInfoDTO> orgModelMap = declaredProjectManage.buildOrgModelMap(employeeCode, projectInfo); | |||
Map<String, OrgInfoDTO> orgModelMap = declaredProjectManage.buildOrgModelMap(user.getUserId(), projectInfo); | |||
String instanceId = processInstanceService.startProcessLs(model, params, orgModelMap); | |||
log.info("终验方案项目重新申报成功 【{}】", instanceId); | |||
@@ -28,7 +28,7 @@ import com.hz.pm.api.projectlib.service.IProjectService; | |||
import com.hz.pm.api.staging.enums.MsgTypeEnum; | |||
import com.hz.pm.api.staging.service.IProjectStagingService; | |||
import com.hz.pm.api.sys.manage.NoticeManage; | |||
import com.hz.pm.api.todocenter.constant.TodoCenterConstant; | |||
import com.hz.pm.api.todocenter.constant.TodoCenterConst; | |||
import com.hz.pm.api.todocenter.constant.WorkNoticeConstant; | |||
import com.hz.pm.api.user.security.model.UserFullInfoDTO; | |||
import com.hz.pm.api.user.util.LoginUserUtil; | |||
@@ -98,18 +98,15 @@ public class PrequalificationDeclaredProjectManage { | |||
@Transactional(rollbackFor = Exception.class) | |||
public String startTheProcess(DefaultDeclaredDTO dto) { | |||
UserFullInfoDTO user = userInfoHelper.getUserFullInfo(LoginUserUtil.getUserId()); | |||
String employeeCode = user.getEmployeeCode(); | |||
VUtils.isTrue(Objects.isNull(employeeCode)).throwMessage("获取登录用户失败!"); | |||
ProjectDTO projectDto = dto.getProjectInfo(); | |||
VUtils.isTrue(Objects.isNull(projectDto.getId())).throwMessage("提交失败 缺少项目ID!"); | |||
Project projectInfo = projectService.getNewProject(projectDto.getId()); | |||
VUtils.isTrue(Objects.isNull(projectInfo)).throwMessage("提交失败 此项目不存在!"); | |||
//要判断 当前操作人 是不是项目主管单位的人 | |||
VUtils.isTrue(Objects.isNull(user.getEmpPosUnitCode())) | |||
VUtils.isTrue(Objects.isNull(user.getMhUnitId())) | |||
.throwMessage(String.format("当前登录人没有单位 【%s】", user.getRealName())); | |||
VUtils.isTrue(!user.getEmpPosUnitCode().equals(projectInfo.getSuperOrgCode())) | |||
VUtils.isTrue(!user.getMhUnitIdStr().equals(projectInfo.getSuperOrgCode())) | |||
.throwMessage(String.format("只有主管单位 【%s】的人 才能够提交", projectInfo.getSuperOrg())); | |||
//首先要判断 项目当前状态 是不是 待预审 | |||
@@ -130,10 +127,10 @@ public class PrequalificationDeclaredProjectManage { | |||
//入库暂存表 后续处理 对接外部接口 | |||
projectInfo.setUpdateOn(LocalDateTime.now()); | |||
//保存一下 当前的主管单位发起人 | |||
projectInfo.setPreStartUserId(employeeCode); | |||
projectInfo.setPreStartUserId(user.getUserIdStr()); | |||
//当前实例置为空 | |||
projectInfo.setInstCode(TodoCenterConstant.Declared.NULL_INST_CODE); | |||
if (projectStagingService.addByProject(projectInfo, "省级部门联审") | |||
projectInfo.setInstCode(TodoCenterConst.Declared.NULL_INST_CODE); | |||
if (Boolean.TRUE.equals(projectStagingService.addByProject(projectInfo, "省级部门联审")) | |||
&& projectService.updateById(projectInfo)) { | |||
return "提交省级部门联审成功"; | |||
} | |||
@@ -141,7 +138,7 @@ public class PrequalificationDeclaredProjectManage { | |||
} else if (ProjectStatusEnum.PRE_APPLYING | |||
.getCode().equals(projectInfo.getStatus())) { | |||
//如果是非省级联审的项目 直接提交 预审 | |||
instanceId = directStartProcess(projectInfo, employeeCode, dto.getRestart()); | |||
instanceId = directStartProcess(projectInfo, user.getUserId(), dto.getRestart()); | |||
} else { | |||
throw new BusinessException("项目状态 错误 project :" + projectInfo.getId() + "," + projectInfo.getStatus()); | |||
} | |||
@@ -157,10 +154,6 @@ public class PrequalificationDeclaredProjectManage { | |||
*/ | |||
@Transactional(rollbackFor = Exception.class) | |||
public String restartTheProcess(DefaultDeclaredDTO dto) { | |||
UserFullInfoDTO user = userInfoHelper.getUserFullInfo(LoginUserUtil.getUserId()); | |||
String employeeCode = user.getEmployeeCode(); | |||
VUtils.isTrue(Objects.isNull(employeeCode)).throwMessage("获取登录用户失败!"); | |||
ProjectDTO projectDto = dto.getProjectInfo(); | |||
VUtils.isTrue(Objects.isNull(projectDto.getId())).throwMessage("提交失败 缺少项目ID!"); | |||
Project projectInfo = projectService.getById(projectDto.getId()); | |||
@@ -174,12 +167,12 @@ public class PrequalificationDeclaredProjectManage { | |||
} | |||
//直接提交预审方法 提取 在省级联审通过的时候 也可以用 | |||
public String directStartProcess(Project projectInfo, String employeeCode, Boolean restart) { | |||
VUtils.isTrue(Objects.isNull(employeeCode)) | |||
public String directStartProcess(Project projectInfo, Long userId, Boolean restart) { | |||
VUtils.isTrue(Objects.isNull(userId)) | |||
.throwMessage("发起人 员工code 不能为空!"); | |||
ProcessStartParamsVo params = new ProcessStartParamsVo(); | |||
params.setUser(defaultDeclaredProjectManage.buildUser(employeeCode)); | |||
params.setUser(defaultDeclaredProjectManage.buildUser(userId)); | |||
params.setProcessUsers(Collections.emptyMap()); | |||
//把条件值给放入工作流 | |||
@@ -198,7 +191,7 @@ public class PrequalificationDeclaredProjectManage { | |||
} | |||
// 获取发起单位、发起单位主管单位、发起单位上级主管条线单位信息 | |||
Map<String, OrgInfoDTO> orgModelMap = defaultDeclaredProjectManage.buildOrgModelMap(employeeCode, projectInfo); | |||
Map<String, OrgInfoDTO> orgModelMap = defaultDeclaredProjectManage.buildOrgModelMap(userId, projectInfo); | |||
String instanceId = processInstanceService.startProcessLs(model, params, orgModelMap); | |||
log.info("提交预审项目成功 【{}】", instanceId); | |||
@@ -288,8 +281,8 @@ public class PrequalificationDeclaredProjectManage { | |||
if (user.getIsOrgAdmin() && | |||
(ProjectStatusEnum.PENDING_PREQUALIFICATION.getCode().equals(item.getStatus()) || | |||
ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS.getCode().equals(item.getStatus())) | |||
&& StringUtils.isNotBlank(w.getSuperOrgCode()) && StringUtils.isNotBlank(user.getEmpPosUnitCode()) | |||
&& w.getSuperOrgCode().equals(user.getEmpPosUnitCode())) { | |||
&& StringUtils.isNotBlank(w.getSuperOrgCode()) | |||
&& w.getSuperOrgCode().equals(user.getMhUnitIdStr())) { | |||
item.setCanPreDeclared(Boolean.TRUE); | |||
} | |||
return item; | |||
@@ -305,13 +298,13 @@ public class PrequalificationDeclaredProjectManage { | |||
public UserFullInfoDTO buildPermission(LambdaQueryWrapper<Project> query, UserFullInfoDTO user) { | |||
if (user.getIsOrgAdmin()) { | |||
//单位管理员 看到自己单位去申报的 + 待预审的主管单位是自己单位的项目 | |||
query.and(q1 -> q1.eq(Project::getBuildOrgCode, user.getEmpPosUnitCode()) | |||
query.and(q1 -> q1.eq(Project::getBuildOrgCode, user.getMhUnitId()) | |||
.or(q2 -> q2.eq(Project::getStage, ProjectStatusEnum.NOT_APPROVED.getCode()) | |||
.and(s1 -> s1.eq(Project::getStatus, ProjectStatusEnum.PENDING_PREQUALIFICATION.getCode()) | |||
.or(s2 -> s2.eq(Project::getStatus, ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_SUCCESS.getCode()))) | |||
.eq(Project::getSuperOrgCode, user.getEmpPosUnitCode()))); | |||
.eq(Project::getSuperOrgCode, user.getMhUnitId()))); | |||
} else { | |||
query.eq(Project::getBuildOrgCode, user.getEmpPosUnitCode()); | |||
query.eq(Project::getBuildOrgCode, user.getMhUnitId()); | |||
} | |||
return user; | |||
} | |||
@@ -152,7 +152,7 @@ public class ProjectAdjustmentManage { | |||
UserFullInfoDTO user = userInfoHelper.getUserFullInfo(LoginUserUtil.getUserId()); | |||
VUtils.isTrue(Objects.isNull(user)).throwMessage("获取登录用户失败!"); | |||
//放入用户的单位 | |||
req.setBuildOrgCode(user.getEmpPosUnitCode()); | |||
req.setBuildOrgCode(user.getMhUnitIdStr()); | |||
return projectLibManage.projectLibList(req); | |||
} | |||
@@ -167,7 +167,7 @@ public class ProjectAdjustmentManage { | |||
UserFullInfoDTO user = userInfoHelper.getUserFullInfo(LoginUserUtil.getUserId()); | |||
VUtils.isTrue(Objects.isNull(user)).throwMessage("获取登录用户失败!"); | |||
//放入用户的单位 | |||
req.setBuildOrgCode(user.getEmpPosUnitCode()); | |||
req.setBuildOrgCode(user.getMhUnitIdStr()); | |||
LambdaQueryWrapper<Project> query = ProjectHelper.projectQuery(req); | |||
List<Project> records = projectService.list(query); | |||
@@ -6,11 +6,6 @@ import com.alibaba.excel.EasyExcel; | |||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | |||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; | |||
import com.google.common.collect.Lists; | |||
import com.ningdatech.basic.exception.BizException; | |||
import com.ningdatech.basic.function.VUtils; | |||
import com.ningdatech.basic.model.PageVo; | |||
import com.ningdatech.basic.util.CollUtils; | |||
import com.ningdatech.basic.util.NdDateUtils; | |||
import com.hz.pm.api.common.helper.UserInfoHelper; | |||
import com.hz.pm.api.common.statemachine.util.StateMachineUtil; | |||
import com.hz.pm.api.common.util.ExcelDownUtil; | |||
@@ -20,18 +15,22 @@ import com.hz.pm.api.projectdeclared.model.dto.PurchaseSaveDTO; | |||
import com.hz.pm.api.projectdeclared.model.entity.Purchase; | |||
import com.hz.pm.api.projectdeclared.model.vo.PurchaseVO; | |||
import com.hz.pm.api.projectdeclared.service.IPurchaseService; | |||
import com.hz.pm.api.projectlib.model.enumeration.ProjectStatusEnum; | |||
import com.hz.pm.api.projectlib.model.enumeration.ProjectTypeNewEnum; | |||
import com.hz.pm.api.projectlib.helper.ProjectHelper; | |||
import com.hz.pm.api.projectlib.model.entity.Project; | |||
import com.hz.pm.api.projectlib.model.enumeration.ProjectStatusEnum; | |||
import com.hz.pm.api.projectlib.model.enumeration.ProjectTypeNewEnum; | |||
import com.hz.pm.api.projectlib.model.req.ProjectListReq; | |||
import com.hz.pm.api.projectlib.model.vo.ProjectLibListItemVO; | |||
import com.hz.pm.api.projectlib.service.IProjectService; | |||
import com.hz.pm.api.user.security.model.UserFullInfoDTO; | |||
import com.hz.pm.api.user.util.LoginUserUtil; | |||
import com.ningdatech.basic.exception.BizException; | |||
import com.ningdatech.basic.function.VUtils; | |||
import com.ningdatech.basic.model.PageVo; | |||
import com.ningdatech.basic.util.CollUtils; | |||
import com.ningdatech.basic.util.NdDateUtils; | |||
import lombok.RequiredArgsConstructor; | |||
import lombok.extern.slf4j.Slf4j; | |||
import org.apache.commons.lang3.StringUtils; | |||
import org.springframework.beans.BeanUtils; | |||
import org.springframework.stereotype.Component; | |||
@@ -74,7 +73,7 @@ public class PurchaseManage { | |||
VUtils.isTrue(Objects.isNull(user)).throwMessage("获取登录用户失败!"); | |||
LambdaQueryWrapper<Project> query = ProjectHelper.projectQuery(req); | |||
//只能看自己单位的 | |||
query.eq(Project::getBuildOrgCode,user.getEmpPosUnitCode()); | |||
query.eq(Project::getBuildOrgCode, user.getMhUnitId()); | |||
//待采购状态 | |||
query.in(Project::getStatus, Lists.newArrayList(ProjectStatusEnum.TO_BE_PURCHASED.getCode(), | |||
ProjectStatusEnum.OPERATION.getCode())); | |||
@@ -114,7 +113,7 @@ public class PurchaseManage { | |||
LambdaQueryWrapper<Project> query = ProjectHelper.projectQuery(param); | |||
//待采购状态 | |||
//只能看自己单位的 | |||
query.eq(Project::getBuildOrgCode,user.getEmpPosUnitCode()); | |||
query.eq(Project::getBuildOrgCode, user.getMhUnitId()); | |||
query.eq(Project::getStatus, ProjectStatusEnum.TO_BE_PURCHASED.getCode()); | |||
query.eq(Project::getStage, ProjectStatusEnum.PROJECT_APPROVED.getCode()); | |||
query.eq(Project::getNewest, Boolean.TRUE); | |||
@@ -171,9 +170,6 @@ public class PurchaseManage { | |||
*/ | |||
public String submitResult(PurchaseSaveDTO dto) { | |||
UserFullInfoDTO user = userInfoHelper.getUserFullInfo(LoginUserUtil.getUserId()); | |||
String employeeCode = user.getEmployeeCode(); | |||
VUtils.isTrue(StringUtils.isBlank(employeeCode)).throwMessage("获取登录用户 员工号 失败!"); | |||
Long projectId = dto.getProjectId(); | |||
VUtils.isTrue(Objects.isNull(projectId)).throwMessage("提交失败 缺少项目ID!"); | |||
Project project = projectService.getNewProject(dto.getProjectId()); | |||
@@ -190,23 +186,12 @@ public class PurchaseManage { | |||
Purchase purchase = BeanUtil.copyProperties(w, Purchase.class); | |||
purchase.setProjectId(projectId); | |||
if (!purchaseMap.containsKey(w.getId())) { | |||
purchase.setCreateBy(employeeCode); | |||
purchase.setCreateBy(user.getUserIdStr()); | |||
} | |||
return purchase; | |||
}); | |||
if (purchaseService.saveOrUpdateBatch(purchaseEntities)) { | |||
// 如果 需要推送项目和应用管理的话 只有遂昌县才有 | |||
// String areaCode = project.getAreaCode(); | |||
// String appCode = dto.getAppCode(); | |||
// if(RegionConst.RC_SC.equals(areaCode) && StringUtils.isNotBlank(appCode)){ | |||
// try{ | |||
// | |||
// }catch (Exception e){ | |||
// log.info("绑定以及推送项目和应用关系 失败! {}" + e.getMessage()); | |||
// } | |||
// } | |||
//进入到下一状态 | |||
stateMachineUtil.pass(project); | |||
project.setUpdateOn(LocalDateTime.now()); | |||
@@ -214,9 +199,7 @@ public class PurchaseManage { | |||
LocalDateTime lastTransactionTime = null; | |||
BigDecimal transactionAmountTotal = BigDecimal.ZERO; | |||
for (Purchase purchase : purchaseEntities) { | |||
if (lastTransactionTime == null) { | |||
lastTransactionTime = purchase.getTransactionTime(); | |||
} else if (purchase.getTransactionTime().isAfter(lastTransactionTime)) { | |||
if (lastTransactionTime == null || purchase.getTransactionTime().isAfter(lastTransactionTime)) { | |||
lastTransactionTime = purchase.getTransactionTime(); | |||
} | |||
transactionAmountTotal = transactionAmountTotal.add(purchase.getTransactionAmount()); | |||
@@ -23,6 +23,7 @@ import lombok.RequiredArgsConstructor; | |||
import lombok.extern.slf4j.Slf4j; | |||
import org.springframework.stereotype.Component; | |||
import org.springframework.transaction.annotation.Transactional; | |||
import java.time.LocalDateTime; | |||
import java.util.Collections; | |||
import java.util.Map; | |||
@@ -54,13 +55,14 @@ public class ReviewByDeptJointManage { | |||
/** | |||
* 部门联审 | |||
* | |||
* @param project | |||
* @return | |||
*/ | |||
@Transactional(rollbackFor = Exception.class) | |||
public Boolean startTheProcess(Project project) { | |||
//这里是任务发起的 所以用项目发起人 | |||
String startUserCode = project.getSponsor(); | |||
Long startUserCode = Long.parseLong(project.getSponsor()); | |||
VUtils.isTrue(Objects.isNull(project.getId())).throwMessage("提交失败 缺少项目ID!"); | |||
Project projectInfo = projectService.getNewProject(project.getId()); | |||
@@ -87,47 +89,24 @@ public class ReviewByDeptJointManage { | |||
ProcessStartParamsVo params = new ProcessStartParamsVo(); | |||
//发起人的信息 | |||
params.setUser(declaredProjectManage.buildUser(projectInfo.getSponsor())); | |||
params.setUser(declaredProjectManage.buildUser(Long.valueOf(projectInfo.getSponsor()))); | |||
params.setProcessUsers(Collections.emptyMap()); | |||
Map<String, Object> formData = Maps.newHashMap(); | |||
//放入条件判断的项目字段 | |||
//把条件值给放入工作流 | |||
defaultDeclaredProjectManage.buildCondition(params,projectInfo); | |||
defaultDeclaredProjectManage.buildCondition(params, projectInfo); | |||
// 获取发起单位、发起单位主管单位、发起单位上级主管条线单位信息 | |||
Map<String, OrgInfoDTO> orgModelMap = defaultDeclaredProjectManage.buildOrgModelMap(startUserCode,project); | |||
String instanceId = processService.startProcessLs(model, params,orgModelMap); | |||
Map<String, OrgInfoDTO> orgModelMap = defaultDeclaredProjectManage.buildOrgModelMap(startUserCode, project); | |||
String instanceId = processService.startProcessLs(model, params, orgModelMap); | |||
log.info("部门联审申报成功 【{}】", instanceId); | |||
//保存项目信息 | |||
projectInfo = projectLibManage.saveProjectWithVersion(projectInfo,instanceId,ProjectProcessStageEnum.DEPARTMENT_JOINT_APPROVAL_PROCESS.getCode()); | |||
projectInfo = projectLibManage.saveProjectWithVersion(projectInfo, instanceId, ProjectProcessStageEnum.DEPARTMENT_JOINT_APPROVAL_PROCESS.getCode()); | |||
//发送给第一个审批人消息 | |||
noticeManage.sendFirtUser(projectInfo,model.getFormName(),instanceId, | |||
noticeManage.sendFirtUser(projectInfo, model.getFormName(), instanceId, | |||
WorkNoticeConstant.PASS_MSG_TEMPLATE, MsgTypeEnum.PROJECT_REVIEW); | |||
return Boolean.TRUE; | |||
} | |||
private Boolean modifyProject(Project project, String instanceId) { | |||
//流程启动之后 入库项目 重要业务信息 用于列表查询 展示 | |||
try { | |||
project.setUpdateOn(LocalDateTime.now()); | |||
project.setInstCode(instanceId); | |||
projectService.updateById(project); | |||
//保存项目和实例的关系 | |||
ProjectInst projectInst = new ProjectInst(); | |||
projectInst.setProjectId(project.getId()); | |||
projectInst.setInstCode(instanceId); | |||
projectInst.setCreatOn(LocalDateTime.now()); | |||
projectInst.setUpdateOn(LocalDateTime.now()); | |||
projectInst.setInstType(ProjectProcessStageEnum.DEPARTMENT_JOINT_APPROVAL_PROCESS.getCode()); | |||
projectInstService.save(projectInst); | |||
} catch (Exception e) { | |||
log.error("部门联审 修改项目信息 错误 ", e); | |||
throw new BusinessException("部门联审 修改项目信息 错误 :" + e.getMessage()); | |||
} | |||
return Boolean.TRUE; | |||
} | |||
} |
@@ -11,7 +11,7 @@ import com.hz.pm.api.projectlib.model.entity.ProjectApplication; | |||
import com.hz.pm.api.projectlib.service.IProjectApplicationService; | |||
import com.hz.pm.api.projectlib.service.IProjectService; | |||
import com.hz.pm.api.provincial.service.IJoinReviewProvincialBureauService; | |||
import com.hz.pm.api.todocenter.constant.TodoCenterConstant; | |||
import com.hz.pm.api.todocenter.constant.TodoCenterConst; | |||
import com.ningdatech.basic.function.VUtils; | |||
import com.ningdatech.file.service.FileService; | |||
import com.wflow.exception.BusinessException; | |||
@@ -105,7 +105,7 @@ public class ReviewByProvincialDeptManage { | |||
//保存一下 当前的主管单位发起人 | |||
p.setPreStartUserId(p.getSponsor()); | |||
//当前实例置为空 | |||
p.setInstCode(TodoCenterConstant.Declared.NULL_INST_CODE); | |||
p.setInstCode(TodoCenterConst.Declared.NULL_INST_CODE); | |||
declaringDTO.getProjectInfo().setId(p.getId()); | |||
projectService.updateById(p); | |||
if (!joinReviewProvincialBureauService.pushImportProject( | |||
@@ -2,6 +2,7 @@ package com.hz.pm.api.projectdeclared.manage; | |||
import cn.hutool.core.bean.BeanUtil; | |||
import cn.hutool.core.collection.CollUtil; | |||
import cn.hutool.core.util.NumberUtil; | |||
import com.alibaba.fastjson.JSON; | |||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | |||
import com.baomidou.mybatisplus.core.toolkit.Wrappers; | |||
@@ -90,16 +91,15 @@ public class ReviewChecklistManage { | |||
Map<String, List<ReviewChecklistApprove>> approveMap = | |||
approves.stream().collect(Collectors.groupingBy(ReviewChecklistApprove::getProjectCode)); | |||
List<String> reviewHumans; | |||
List<Long> reviewHumans; | |||
// TODO | |||
if (BizConst.DEV.equals(active)) { | |||
reviewHumans = DeclaredProjectConst.ReviewChecklist.REVIEW_HUMANS_ZYD; | |||
reviewHumans = new ArrayList<>(); | |||
} else { | |||
reviewHumans = DeclaredProjectConst.ReviewChecklist.REVIEW_HUMANS_ZZD; | |||
reviewHumans = new ArrayList<>(); | |||
} | |||
List<UserFullInfoDTO> users = userInfoHelper.getUserFullInfoByEmployeeCodes(reviewHumans); | |||
Set<String> userSet = Sets.newHashSet(); | |||
Map<String, String> userMap = users.stream().filter(u -> userSet.add(u.getEmployeeCode())) | |||
.collect(Collectors.toMap(UserFullInfoDTO::getEmployeeCode, UserFullInfoDTO::getUsername)); | |||
List<UserFullInfoDTO> users = userInfoHelper.listUserFullInfoByUserIds(reviewHumans); | |||
Map<Long, String> userMap = CollUtils.listToMap(users, UserFullInfoDTO::getUserId, UserFullInfoDTO::getUsername); | |||
List<ProjectReviewCheckListItemVO> records = CollUtils.convert(page.getRecords(), w -> { | |||
ProjectReviewCheckListItemVO item = new ProjectReviewCheckListItemVO(); | |||
item.setId(w.getId()); | |||
@@ -128,7 +128,7 @@ public class ReviewChecklistManage { | |||
} | |||
private String computeVerify(ProjectReviewCheckListItemVO item, List<ReviewChecklistApprove> reviewChecklistApproves, | |||
Map<String, String> userMap, UserInfoDetails user) { | |||
Map<Long, String> userMap, UserInfoDetails user) { | |||
List<String> reviewHumans; | |||
if (BizConst.DEV.equals(active)) { | |||
reviewHumans = DeclaredProjectConst.ReviewChecklist.REVIEW_HUMANS_ZYD; | |||
@@ -161,38 +161,18 @@ public class ReviewChecklistManage { | |||
return finishNums + StrPool.SLASH + maxNums; | |||
} | |||
private String convertUser(Map<String, String> userMap, Set<String> computeHumanSet) { | |||
private String convertUser(Map<Long, String> userMap, Set<String> computeHumanSet) { | |||
if (CollUtil.isEmpty(userMap) || CollUtil.isEmpty(computeHumanSet)) { | |||
return StringUtils.EMPTY; | |||
} | |||
return computeHumanSet.stream().filter(s -> StringUtils.isNotBlank(s) && userMap.containsKey(s)) | |||
.map(userMap::get).collect(Collectors.joining(StrPool.COMMA)); | |||
return computeHumanSet.stream() | |||
.filter(NumberUtil::isNumber) | |||
.map(w -> userMap.get(Long.parseLong(w))) | |||
.collect(Collectors.joining(StrPool.COMMA)); | |||
} | |||
public UserFullInfoDTO buildReviewCheckPermission(LambdaQueryWrapper<Project> query, UserInfoDetails user) { | |||
UserFullInfoDTO userDto = BeanUtil.copyProperties(user, UserFullInfoDTO.class); | |||
//1.只有 市本级能看到 | |||
String regionCode = user.getRegionCode(); | |||
String employeeCode = user.getEmployeeCode(); | |||
//如果是七大审查之一 就可以看 | |||
List<String> reviewHumans; | |||
if (BizConst.DEV.equals(active)) { | |||
reviewHumans = DeclaredProjectConst.ReviewChecklist.REVIEW_HUMANS_ZYD; | |||
} else { | |||
reviewHumans = DeclaredProjectConst.ReviewChecklist.REVIEW_HUMANS_ZZD; | |||
} | |||
if (reviewHumans.contains(employeeCode)) { | |||
log.warn("为七大审查人之一 可以查看"); | |||
return userDto; | |||
} | |||
if (!regionCode.equals(RegionConst.RC_HZ) || StringUtils.isBlank(employeeCode)) { | |||
log.info("当前操作人 不是市本级 或者没有钉钉工号 :{},{},{}", user.getUsername(), | |||
user.getRegionCode(), user.getEmployeeCode()); | |||
query.eq(Project::getId, 0L); | |||
return userDto; | |||
} | |||
Optional<DataScopeDTO> currentUserDataScope = DataScopeUtil.getCurrentUserDataScope(userDto); | |||
if (!currentUserDataScope.isPresent()) { | |||
log.warn("没有取到权限信息 当前查询 没有权限条件"); | |||
@@ -228,8 +208,8 @@ public class ReviewChecklistManage { | |||
/** | |||
* 去审批 | |||
* | |||
* @param dtos | |||
* @return | |||
* @param dtos \ | |||
* @return \ | |||
*/ | |||
public String approve(List<ReviewChecklistApproveDTO> dtos) { | |||
if (CollUtil.isEmpty(dtos)) { | |||
@@ -6,7 +6,7 @@ import org.apache.ibatis.annotations.Param; | |||
/** | |||
* <p> | |||
* Mapper 接口 | |||
* Mapper 接口 | |||
* </p> | |||
* | |||
* @author zpf | |||
@@ -14,7 +14,7 @@ import org.apache.ibatis.annotations.Param; | |||
*/ | |||
public interface DeclaredStatisticsMapper extends BaseMapper { | |||
DeclaredProjectStatisticsPO getOrgStatistics(@Param("orgCode") String orgCode,@Param("year") Integer year); | |||
DeclaredProjectStatisticsPO getOrgStatistics(@Param("orgCode") String orgCode, @Param("year") Integer year); | |||
DeclaredProjectStatisticsPO getRegionStatistics(@Param("regionCode") String regionCode,@Param("year") Integer year); | |||
DeclaredProjectStatisticsPO getRegionStatistics(@Param("year") Integer year); | |||
} |
@@ -33,6 +33,6 @@ | |||
sum(p.approval_amount) approvalAmount | |||
FROM | |||
nd_project p | |||
WHERE area_code = #{regionCode} and project_year = #{year} and newest = 1 | |||
WHERE project_year = #{year} and newest = 1 | |||
</select> | |||
</mapper> |
@@ -8,7 +8,7 @@ import org.springframework.stereotype.Service; | |||
/** | |||
* <p> | |||
* 服务实现类 | |||
* 服务实现类 | |||
* </p> | |||
* | |||
* @author zpf | |||
@@ -22,21 +22,23 @@ public class DeclaredStatisticsServiceImpl implements IDeclaredStatisticsService | |||
/** | |||
* 根据userId 去查询 申报项目统计 根据单位 | |||
* | |||
* @param orgCode | |||
* @return | |||
*/ | |||
@Override | |||
public DeclaredProjectStatisticsPO getOrgStatistics(String orgCode,Integer year) { | |||
return declaredStatisticsMapper.getOrgStatistics(orgCode,year); | |||
public DeclaredProjectStatisticsPO getOrgStatistics(String orgCode, Integer year) { | |||
return declaredStatisticsMapper.getOrgStatistics(orgCode, year); | |||
} | |||
/** | |||
* 根据userId 去查询 申报项目统计 根据区域 | |||
* | |||
* @param regionCode | |||
* @return | |||
*/ | |||
@Override | |||
public DeclaredProjectStatisticsPO getRegionStatistics(String regionCode,Integer year) { | |||
return declaredStatisticsMapper.getRegionStatistics(regionCode,year); | |||
public DeclaredProjectStatisticsPO getRegionStatistics(String regionCode, Integer year) { | |||
return declaredStatisticsMapper.getRegionStatistics(year); | |||
} | |||
} |
@@ -49,7 +49,7 @@ public class ProjectRenewalFundDeclarationController { | |||
@ApiOperation("项目续建资金库能关联的项目列表") | |||
public PageVo<ProjectLibListItemVO> projectlist(ProjectRenewalListReq req) { | |||
UserFullInfoDTO user = userInfoHelper.getUserFullInfo(LoginUserUtil.getUserId()); | |||
return projectRenewalFundManage.projectlist(req,user); | |||
return projectRenewalFundManage.projectList(req,user); | |||
} | |||
@GetMapping("/{id}") | |||
@@ -15,7 +15,9 @@ public abstract class AbstractProcessBusinessHandle { | |||
/** | |||
* 构造,子类必须实现 | |||
*/ | |||
public AbstractProcessBusinessHandle(){} | |||
protected AbstractProcessBusinessHandle(){ | |||
} | |||
/** | |||
* 抽象的,所有具体处理者应该实现的处理逻辑 | |||
@@ -11,7 +11,7 @@ import com.hz.pm.api.projectlib.model.entity.ProjectInst; | |||
import com.hz.pm.api.projectlib.service.IProjectInstService; | |||
import com.hz.pm.api.projectlib.service.IProjectService; | |||
import com.hz.pm.api.projectlib.utils.ProjectVersionUtil; | |||
import com.hz.pm.api.todocenter.constant.TodoCenterConstant; | |||
import com.hz.pm.api.todocenter.constant.TodoCenterConst; | |||
import com.hz.pm.api.todocenter.utils.BuildUserUtils; | |||
import com.ningdatech.basic.util.NdDateUtils; | |||
import com.wflow.workflow.bean.process.ProgressNode; | |||
@@ -63,7 +63,7 @@ public class ConstructionPlanReviewHandle extends AbstractProcessBusinessHandle | |||
ProjectInst projectInst = projectInstService.getOne(Wrappers.lambdaQuery(ProjectInst.class) | |||
.in(ProjectInst::getProjectId, allVersionProjectIds) | |||
.eq(ProjectInst::getInstType, InstTypeEnum.CONSTRUCTION_PLAN_REVIEW.getCode()) | |||
.ne(ProjectInst::getInstCode, TodoCenterConstant.Declared.NULL_INST_CODE) | |||
.ne(ProjectInst::getInstCode, TodoCenterConst.Declared.NULL_INST_CODE) | |||
.orderByDesc(ProjectInst::getCreatOn) | |||
.last(BizConst.LIMIT_1)); | |||
ProcessProgressVo instanceDetail = null; | |||
@@ -9,7 +9,7 @@ import com.hz.pm.api.projectlib.model.enumeration.InstTypeEnum; | |||
import com.hz.pm.api.projectlib.model.entity.ProjectInst; | |||
import com.hz.pm.api.projectlib.service.IProjectInstService; | |||
import com.hz.pm.api.projectlib.service.IProjectService; | |||
import com.hz.pm.api.todocenter.constant.TodoCenterConstant; | |||
import com.hz.pm.api.todocenter.constant.TodoCenterConst; | |||
import com.hz.pm.api.todocenter.utils.BuildUserUtils; | |||
import com.ningdatech.basic.util.NdDateUtils; | |||
import com.wflow.workflow.bean.process.ProgressNode; | |||
@@ -64,7 +64,7 @@ public class DeptUnitedReviewHandle extends AbstractProcessBusinessHandle { | |||
ProjectInst projectInst = projectInstService.getOne(Wrappers.lambdaQuery(ProjectInst.class) | |||
.in(ProjectInst::getProjectId, allVersionProjectIds) | |||
.eq(ProjectInst::getInstType, InstTypeEnum.DEPT_UNITED_REVIEW.getCode()) | |||
.ne(ProjectInst::getInstCode, TodoCenterConstant.Declared.NULL_INST_CODE) | |||
.ne(ProjectInst::getInstCode, TodoCenterConst.Declared.NULL_INST_CODE) | |||
.orderByDesc(ProjectInst::getCreatOn) | |||
.last(BizConst.LIMIT_1)); | |||
if (Objects.isNull(projectInst)) { | |||
@@ -12,7 +12,7 @@ import com.hz.pm.api.projectlib.model.entity.ProjectInst; | |||
import com.hz.pm.api.projectlib.service.IProjectInstService; | |||
import com.hz.pm.api.projectlib.service.IProjectService; | |||
import com.hz.pm.api.projectlib.utils.ProjectVersionUtil; | |||
import com.hz.pm.api.todocenter.constant.TodoCenterConstant; | |||
import com.hz.pm.api.todocenter.constant.TodoCenterConst; | |||
import com.hz.pm.api.todocenter.utils.BuildUserUtils; | |||
import com.wflow.workflow.bean.process.ProgressNode; | |||
import com.wflow.workflow.bean.vo.ProcessDetailVO; | |||
@@ -67,7 +67,7 @@ public class PreliminaryPreviewHandle extends AbstractProcessBusinessHandle { | |||
ProjectInst projectInst = projectInstService.getOne(Wrappers.lambdaQuery(ProjectInst.class) | |||
.in(ProjectInst::getProjectId, allVersionProjectIds) | |||
.eq(ProjectInst::getInstType, InstTypeEnum.PRELIMINARY_PREVIEW.getCode()) | |||
.ne(ProjectInst::getInstCode, TodoCenterConstant.Declared.NULL_INST_CODE) | |||
.ne(ProjectInst::getInstCode, TodoCenterConst.Declared.NULL_INST_CODE) | |||
.orderByDesc(ProjectInst::getCreatOn) | |||
.last("limit 1")); | |||
ProcessProgressVo instanceDetail = null; | |||
@@ -13,7 +13,7 @@ import com.hz.pm.api.projectlib.model.entity.Project; | |||
import com.hz.pm.api.projectlib.model.entity.ProjectInst; | |||
import com.hz.pm.api.projectlib.service.IProjectInstService; | |||
import com.hz.pm.api.projectlib.service.IProjectService; | |||
import com.hz.pm.api.todocenter.constant.TodoCenterConstant; | |||
import com.hz.pm.api.todocenter.constant.TodoCenterConst; | |||
import com.hz.pm.api.todocenter.utils.BuildUserUtils; | |||
import com.wflow.workflow.bean.process.ProgressNode; | |||
import com.wflow.workflow.bean.vo.ProcessDetailVO; | |||
@@ -61,7 +61,7 @@ public class ProjectFinalInspectionHandle extends AbstractProcessBusinessHandle | |||
ProjectInst projectInst = projectInstService.getOne(Wrappers.lambdaQuery(ProjectInst.class) | |||
.in(ProjectInst::getProjectId, allVersionProjectIds) | |||
.eq(ProjectInst::getInstType, InstTypeEnum.PROJECT_FINAL_INSPECTION.getCode()) | |||
.ne(ProjectInst::getInstCode, TodoCenterConstant.Declared.NULL_INST_CODE) | |||
.ne(ProjectInst::getInstCode, TodoCenterConst.Declared.NULL_INST_CODE) | |||
.orderByDesc(ProjectInst::getCreatOn) | |||
.last(BizConst.LIMIT_1)); | |||
@@ -92,7 +92,6 @@ public class ProvinceUnitedReviewHandle extends AbstractProcessBusinessHandle { | |||
processSchedule.add(processDetailVO); | |||
return; | |||
} | |||
// processDetailVO.setProcessProgressVo(project.getSjlsResult()); | |||
processDetailVO.setContent(project.getSjlsResult()); | |||
processDetailVO.setProcessName(CommonConst.PROVINCE_UNITED_REVIEW); | |||
processSchedule.add(processDetailVO); | |||
@@ -11,7 +11,7 @@ import com.hz.pm.api.projectlib.model.entity.ProjectInst; | |||
import com.hz.pm.api.projectlib.service.IProjectInstService; | |||
import com.hz.pm.api.projectlib.service.IProjectService; | |||
import com.hz.pm.api.projectlib.utils.ProjectVersionUtil; | |||
import com.hz.pm.api.todocenter.constant.TodoCenterConstant; | |||
import com.hz.pm.api.todocenter.constant.TodoCenterConst; | |||
import com.hz.pm.api.todocenter.utils.BuildUserUtils; | |||
import com.ningdatech.basic.exception.BizException; | |||
import com.ningdatech.basic.util.NdDateUtils; | |||
@@ -66,7 +66,7 @@ public class UnitInnerAuditHandle extends AbstractProcessBusinessHandle { | |||
ProjectInst projectInst = projectInstService.getOne(Wrappers.lambdaQuery(ProjectInst.class) | |||
.in(ProjectInst::getProjectId, allVersionProjectIds) | |||
.eq(ProjectInst::getInstType, InstTypeEnum.UNIT_INNER_AUDIT.getCode()) | |||
.ne(ProjectInst::getInstCode, TodoCenterConstant.Declared.NULL_INST_CODE) | |||
.ne(ProjectInst::getInstCode, TodoCenterConst.Declared.NULL_INST_CODE) | |||
.orderByDesc(ProjectInst::getCreatOn) | |||
.last(BizConst.LIMIT_1)); | |||
ProcessProgressVo instanceDetail = null; | |||
@@ -10,6 +10,7 @@ import cn.hutool.poi.excel.ExcelUtil; | |||
import com.alibaba.fastjson.JSON; | |||
import com.alibaba.fastjson.JSONObject; | |||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | |||
import com.baomidou.mybatisplus.core.toolkit.Assert; | |||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; | |||
import com.google.common.collect.Lists; | |||
import com.hz.pm.api.common.model.constant.CommonConst; | |||
@@ -38,7 +39,7 @@ import com.hz.pm.api.projectlib.model.vo.AnnualPlanListItemVO; | |||
import com.hz.pm.api.projectlib.service.IProjectApplicationService; | |||
import com.hz.pm.api.projectlib.service.IProjectRenewalFundDeclarationService; | |||
import com.hz.pm.api.projectlib.service.IProjectService; | |||
import com.hz.pm.api.todocenter.constant.TodoCenterConstant; | |||
import com.hz.pm.api.todocenter.constant.TodoCenterConst; | |||
import com.hz.pm.api.user.security.model.UserFullInfoDTO; | |||
import com.hz.pm.api.user.util.LoginUserUtil; | |||
import com.ningdatech.basic.exception.BizException; | |||
@@ -171,7 +172,7 @@ public class AnnualPlanLibManage { | |||
// 项目编号不变,版本号加1 | |||
project.setProjectCode(oldProject.getProjectCode()); | |||
project.setVersion(oldProject.getVersion() + 1); | |||
project.setInstCode(TodoCenterConstant.Declared.NULL_INST_CODE); | |||
project.setInstCode(TodoCenterConst.Declared.NULL_INST_CODE); | |||
project.setId(null); | |||
if (projectService.save(project)) { | |||
applicationService.saveApplication(project, oldProject, Boolean.TRUE); | |||
@@ -251,19 +252,15 @@ public class AnnualPlanLibManage { | |||
switch (currentUserDataScope.get().getRole()) { | |||
case NORMAL_MEMBER: | |||
// 普通用户 只能看到自己单位去申报的 | |||
query.eq(Project::getBuildOrgCode, user.getEmpPosUnitCode()); | |||
query.eq(Project::getBuildOrgCode, user.getMhUnitId()); | |||
break; | |||
case COMPANY_MANAGER: | |||
// 单位管理员 看到自己单位去申报的 + 待预审的主管单位是自己单位的项目 | |||
query.eq(Project::getBuildOrgCode, user.getEmpPosUnitCode()); | |||
query.eq(Project::getBuildOrgCode, user.getMhUnitId()); | |||
break; | |||
case SUPER_ADMIN: | |||
// 超级管理员 看到丽水全市的 并且也要判断他 同时是不是单位管理员 | |||
break; | |||
case REGION_MANAGER: | |||
// 区域管理员 看到自己区域的项目 | |||
query.eq(Project::getAreaCode, user.getRegionCode()); | |||
break; | |||
default: | |||
// 没有权限的话 就让它查不到 | |||
query.eq(Project::getId, "NULL"); | |||
@@ -367,16 +364,16 @@ public class AnnualPlanLibManage { | |||
public void exportModifyList(ProjectListReq param, HttpServletResponse response) { | |||
int year = LocalDateTime.now().getYear(); | |||
Integer isTemporaryAugment = param.getIsTemporaryAugment(); | |||
if (Objects.isNull(isTemporaryAugment)) { | |||
throw new BizException("请传入是否临时增补标志!"); | |||
} | |||
Assert.notNull(isTemporaryAugment, "请传入是否临时增补标志"); | |||
param.setIsTemporaryAugment(isTemporaryAugment); | |||
String fileName = null; | |||
String fileName; | |||
// 设置excel的文件名称和是否增补 | |||
if (CommonEnum.NO.getCode().equals(isTemporaryAugment)) { | |||
fileName = "丽水市" + year + "年数字化项目年度计划库编辑表"; | |||
fileName = "杭州市" + year + "年数字化项目年度计划库编辑表"; | |||
} else if (CommonEnum.YES.getCode().equals(isTemporaryAugment)) { | |||
fileName = "丽水市" + year + "年数字化项目年度计划增补库编辑表"; | |||
fileName = "杭州市" + year + "年数字化项目年度计划增补库编辑表"; | |||
} else { | |||
throw BizException.wrap("是否临时增补标志无效"); | |||
} | |||
LambdaQueryWrapper<Project> query = ProjectHelper.projectQuery(param); | |||
query.eq(Project::getNewest, Boolean.TRUE); | |||
@@ -68,6 +68,7 @@ public class ApplicationManage { | |||
/** | |||
* 保存 appCode | |||
* | |||
* @param dto | |||
* @return | |||
*/ | |||
@@ -79,7 +80,7 @@ public class ApplicationManage { | |||
app.setAppCode(dto.getAppCode()); | |||
app.setUpdateOn(LocalDateTime.now()); | |||
app.setUpdateBy(userId); | |||
if(applicationService.updateById(app)){ | |||
if (applicationService.updateById(app)) { | |||
return BizConst.SAVE_SUCCESS; | |||
} | |||
return BizConst.SAVE_FAIL; | |||
@@ -87,6 +88,7 @@ public class ApplicationManage { | |||
/** | |||
* 获取试运行报告 | |||
* | |||
* @param appCode | |||
* @return | |||
*/ | |||
@@ -98,33 +100,33 @@ public class ApplicationManage { | |||
//请求头 | |||
HttpHeaders headers = new HttpHeaders(); | |||
for(Map.Entry<String, String> entry : header.entrySet()){ | |||
for (Map.Entry<String, String> entry : header.entrySet()) { | |||
headers.add(entry.getKey(), entry.getValue()); | |||
} | |||
//封装请求头 | |||
HttpEntity<MultiValueMap<String, Object>> formEntity = new HttpEntity<>(headers); | |||
RestTemplate restTemplate = new RestTemplate(); | |||
ResponseEntity<ApiResponse> forEntity = restTemplate.exchange(appUrl, HttpMethod.GET,formEntity, ApiResponse.class); | |||
ResponseEntity<ApiResponse> forEntity = restTemplate.exchange(appUrl, HttpMethod.GET, formEntity, ApiResponse.class); | |||
log.info("forEntity:",JSON.toJSONString(forEntity)); | |||
log.info("body:",forEntity.getBody()); | |||
log.info("forEntity:", JSON.toJSONString(forEntity)); | |||
log.info("body:", forEntity.getBody()); | |||
ApiResponse body = forEntity.getBody(); | |||
if(!body.getCode().equals(HttpStatus.OK.value())){ | |||
if (!body.getCode().equals(HttpStatus.OK.value())) { | |||
throw new BizException(body.getMessage()); | |||
} | |||
Object data = body.getData(); | |||
if(Objects.nonNull(data)){ | |||
if (Objects.nonNull(data)) { | |||
JSONObject dataJson = JSON.parseObject(JSON.toJSONString(data)); | |||
JSONArray resourceList = dataJson.getJSONArray("resourceList"); | |||
if(CollUtil.isNotEmpty(resourceList)){ | |||
if (CollUtil.isNotEmpty(resourceList)) { | |||
JSONObject resource = JSON.parseObject(JSON.toJSONString(resourceList.get(0))); | |||
if(StringUtils.isBlank(resource.getString("reportOss"))){ | |||
if (StringUtils.isBlank(resource.getString("reportOss"))) { | |||
//暂时没有 appCode 所以先返回测试数据 | |||
return "https://irs-yyyw.oss-cn-hangzhou-zwynet-d01-a.internet.cloud.zj.gov.cn/tmp/%E6%B8%A9%E5%B7%9E%E5%B8%82%E4%B9%90%E6%B8%85%E5%B8%82%E5%8C%BA%E5%9F%9F%E4%BD%93%E6%A3%80%E4%BF%A1%E6%81%AF%E7%B3%BB%E7%BB%9F_9cf0b901f2ca4fbf8ff274da359ad219.html?Expires=1687833685&OSSAccessKeyId=wMhEw2BhpIDc1xwO&Signature=UPAbMdDy23FI1sNemszg5WH%2BG40%3D"; | |||
}else{ | |||
} else { | |||
return resource.getString("reportOss"); | |||
} | |||
} | |||
@@ -134,19 +136,19 @@ public class ApplicationManage { | |||
/** | |||
* 查询 待注册的 | |||
* | |||
* @param req | |||
* @return | |||
*/ | |||
public PageVo<ProjectDetailVO> toRegisterAppProjectLibList(ProjectListReq req) { | |||
UserInfoDetails user = LoginUserUtil.loginUserDetail(); | |||
//建设单位 就是当前人的单位 | |||
String orgCode = user.getEmpPosUnitCode(); | |||
Page<Project> page = req.page(); | |||
projectService.page(page,Wrappers.lambdaQuery(Project.class) | |||
projectService.page(page, Wrappers.lambdaQuery(Project.class) | |||
.eq(Project::getStage, ProjectStatusEnum.NOT_APPROVED.getCode()) | |||
.eq(Project::getStatus, ProjectStatusEnum.TO_BE_APP_REGISTER.getCode()) | |||
.eq(Project::getBuildOrgCode,orgCode)); | |||
if(CollUtil.isEmpty(page.getRecords())){ | |||
.eq(Project::getBuildOrgCode, user.getMhUnitId())); | |||
if (CollUtil.isEmpty(page.getRecords())) { | |||
return PageVo.empty(); | |||
} | |||
@@ -154,24 +156,24 @@ public class ApplicationManage { | |||
//要去查询应用 此阶段 必定是 建设方案后的 所以直接查 建设方案的应用 | |||
List<ProjectApplication> apps = applicationService.list(Wrappers.lambdaQuery(ProjectApplication.class) | |||
.in(ProjectApplication::getProjectCode, projectCodes) | |||
.eq(ProjectApplication::getIsConstruct,Boolean.TRUE)); | |||
.eq(ProjectApplication::getIsConstruct, Boolean.TRUE)); | |||
Map<String, List<ProjectApplication>> appMap = apps.stream().collect(Collectors.groupingBy(ProjectApplication::getProjectCode)); | |||
List<ProjectDetailVO> res = page.getRecords().stream().map(p -> { | |||
ProjectDetailVO vo = BeanUtil.copyProperties(p,ProjectDetailVO.class); | |||
if(appMap.containsKey(p.getProjectCode())){ | |||
ProjectDetailVO vo = BeanUtil.copyProperties(p, ProjectDetailVO.class); | |||
if (appMap.containsKey(p.getProjectCode())) { | |||
List<ProjectApplication> projectApplications = appMap.get(p.getProjectCode()); | |||
vo.setProjectApplications(convert(projectApplications)); | |||
} | |||
return vo; | |||
}).collect(Collectors.toList()); | |||
return PageVo.of(res,page.getTotal()); | |||
return PageVo.of(res, page.getTotal()); | |||
} | |||
private List<ProjectApplicationVO> convert(List<ProjectApplication> projectApplications) { | |||
if(CollUtil.isNotEmpty(projectApplications)){ | |||
if (CollUtil.isNotEmpty(projectApplications)) { | |||
return projectApplications.stream() | |||
.map(a -> BeanUtil.copyProperties(a,ProjectApplicationVO.class)) | |||
.map(a -> BeanUtil.copyProperties(a, ProjectApplicationVO.class)) | |||
.collect(Collectors.toList()); | |||
} | |||
return Collections.emptyList(); | |||
@@ -3,6 +3,7 @@ package com.hz.pm.api.projectlib.manage; | |||
import cn.hutool.core.bean.BeanUtil; | |||
import cn.hutool.core.bean.copier.CopyOptions; | |||
import cn.hutool.core.collection.CollUtil; | |||
import cn.hutool.core.lang.Assert; | |||
import com.alibaba.fastjson.JSONObject; | |||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | |||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; | |||
@@ -10,20 +11,13 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers; | |||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; | |||
import com.google.common.collect.Lists; | |||
import com.google.common.collect.Maps; | |||
import com.google.common.collect.Sets; | |||
import com.ningdatech.basic.function.VUtils; | |||
import com.ningdatech.basic.model.PageVo; | |||
import com.ningdatech.basic.util.CollUtils; | |||
import com.ningdatech.file.entity.File; | |||
import com.ningdatech.file.service.FileService; | |||
import com.hz.pm.api.common.compare.CompareUtils; | |||
import com.hz.pm.api.common.model.constant.BizConst; | |||
import com.hz.pm.api.common.model.constant.CommonConst; | |||
import com.hz.pm.api.common.model.constant.RegionConst; | |||
import com.hz.pm.api.common.enumeration.CommonEnum; | |||
import com.hz.pm.api.common.enumeration.ProjectProcessStageEnum; | |||
import com.hz.pm.api.common.helper.RegionCacheHelper; | |||
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.CommonConst; | |||
import com.hz.pm.api.common.model.entity.ExcelExportWriter; | |||
import com.hz.pm.api.common.statemachine.util.StateMachineUtil; | |||
import com.hz.pm.api.common.util.BizUtils; | |||
@@ -38,7 +32,6 @@ import com.hz.pm.api.filemanage.model.entity.ProjectApplyBorrow; | |||
import com.hz.pm.api.filemanage.service.INdProjectApplyBorrowService; | |||
import com.hz.pm.api.gov.model.vo.GovBizProjectDetailVO; | |||
import com.hz.pm.api.gov.utils.ProjectConvertUtil; | |||
import com.hz.pm.api.organization.model.entity.DingOrganization; | |||
import com.hz.pm.api.organization.service.IDingOrganizationService; | |||
import com.hz.pm.api.performance.model.dto.ProjectCoreBusinessDTO; | |||
import com.hz.pm.api.performance.model.entity.ProjectCoreBusinessIndicators; | |||
@@ -53,14 +46,14 @@ import com.hz.pm.api.projectdeclared.model.entity.*; | |||
import com.hz.pm.api.projectdeclared.model.vo.*; | |||
import com.hz.pm.api.projectdeclared.service.*; | |||
import com.hz.pm.api.projectdeclared.utils.GenerateProjectCodeUtil; | |||
import com.hz.pm.api.projectlib.model.constant.ProjectConstant; | |||
import com.hz.pm.api.projectlib.model.enumeration.InstTypeEnum; | |||
import com.hz.pm.api.projectlib.model.enumeration.ProjectRenewalApprovalStatusEnum; | |||
import com.hz.pm.api.projectlib.model.enumeration.ProjectStatusEnum; | |||
import com.hz.pm.api.projectlib.handle.ProcessExecuteChainHandle; | |||
import com.hz.pm.api.projectlib.helper.ProjectHelper; | |||
import com.hz.pm.api.projectlib.model.constant.ProjectConstant; | |||
import com.hz.pm.api.projectlib.model.dto.ProjectDTO; | |||
import com.hz.pm.api.projectlib.model.entity.*; | |||
import com.hz.pm.api.projectlib.model.enumeration.InstTypeEnum; | |||
import com.hz.pm.api.projectlib.model.enumeration.ProjectRenewalApprovalStatusEnum; | |||
import com.hz.pm.api.projectlib.model.enumeration.ProjectStatusEnum; | |||
import com.hz.pm.api.projectlib.model.po.ProjectPO; | |||
import com.hz.pm.api.projectlib.model.req.ProjectApplicationListReq; | |||
import com.hz.pm.api.projectlib.model.req.ProjectListReq; | |||
@@ -81,6 +74,11 @@ import com.hz.pm.api.todocenter.service.ITodoService; | |||
import com.hz.pm.api.user.security.model.UserFullInfoDTO; | |||
import com.hz.pm.api.user.security.model.UserInfoDetails; | |||
import com.hz.pm.api.user.util.LoginUserUtil; | |||
import com.ningdatech.basic.function.VUtils; | |||
import com.ningdatech.basic.model.PageVo; | |||
import com.ningdatech.basic.util.CollUtils; | |||
import com.ningdatech.file.entity.File; | |||
import com.ningdatech.file.service.FileService; | |||
import com.wflow.exception.BusinessException; | |||
import com.wflow.workflow.bean.vo.ProcessDetailVO; | |||
import lombok.RequiredArgsConstructor; | |||
@@ -264,8 +262,8 @@ public class ProjectLibManage { | |||
item.setIsHigherSuperOrg(w.getIsHigherSuperOrg()); | |||
if (finalUser.getIsOrgAdmin() && | |||
ProjectStatusEnum.PENDING_PREQUALIFICATION.getCode().equals(item.getStatus()) | |||
&& StringUtils.isNotBlank(w.getSuperOrgCode()) && StringUtils.isNotBlank(finalUser.getEmpPosUnitCode()) | |||
&& w.getSuperOrgCode().equals(finalUser.getEmpPosUnitCode())) { | |||
&& StringUtils.isNotBlank(w.getSuperOrgCode()) | |||
&& w.getSuperOrgCode().equals(finalUser.getMhUnitIdStr())) { | |||
item.setCanPreDeclared(Boolean.TRUE); | |||
} | |||
item.setApprovedAmount(w.getApprovalAmount()); | |||
@@ -312,7 +310,7 @@ public class ProjectLibManage { | |||
.asc() | |||
.list(); | |||
Map<String, List<Task>> map = Maps.newHashMap(); | |||
Map<String, UserFullInfoDTO> userMap = Maps.newHashMap(); | |||
Map<Long, UserFullInfoDTO> userMap = Maps.newHashMap(); | |||
if (CollUtil.isNotEmpty(tasks)) { | |||
map = tasks.stream() | |||
.collect(Collectors.groupingBy(Task::getProcessInstanceId)); | |||
@@ -341,8 +339,8 @@ public class ProjectLibManage { | |||
item.setApproveUsers(buildApproveUsers(w.getInstCode(), map, userMap)); | |||
if (finalUser.getIsOrgAdmin() && | |||
ProjectStatusEnum.PENDING_PREQUALIFICATION.getCode().equals(item.getStatus()) | |||
&& StringUtils.isNotBlank(w.getSuperOrgCode()) && StringUtils.isNotBlank(finalUser.getEmpPosUnitCode()) | |||
&& w.getSuperOrgCode().equals(finalUser.getEmpPosUnitCode())) { | |||
&& StringUtils.isNotBlank(w.getSuperOrgCode()) | |||
&& w.getSuperOrgCode().equals(finalUser.getMhUnitIdStr())) { | |||
item.setCanPreDeclared(Boolean.TRUE); | |||
} | |||
item.setApprovedAmount(w.getApprovalAmount()); | |||
@@ -354,27 +352,23 @@ public class ProjectLibManage { | |||
} | |||
private List<UserFullInfoDTO> buildApproveUsers(String instCode, Map<String, List<Task>> map, | |||
Map<String, UserFullInfoDTO> userMap) { | |||
Map<Long, UserFullInfoDTO> userMap) { | |||
if (map.containsKey(instCode)) { | |||
List<Task> tasks = map.get(instCode); | |||
return tasks.stream().map(task -> userMap.get(task.getAssignee())) | |||
return tasks.stream().map(task -> userMap.get(Long.parseLong(task.getAssignee()))) | |||
.filter(Objects::nonNull).collect(Collectors.toList()); | |||
} | |||
return Collections.emptyList(); | |||
} | |||
private Map<String, UserFullInfoDTO> searchUser(List<Task> tasks, UserInfoHelper userInfoHelper) { | |||
private Map<Long, UserFullInfoDTO> searchUser(List<Task> tasks, UserInfoHelper userInfoHelper) { | |||
if (CollUtil.isEmpty(tasks)) { | |||
return Collections.emptyMap(); | |||
} | |||
List<UserFullInfoDTO> users = userInfoHelper.getUserFullInfoByEmployeeCodes( | |||
tasks.stream().map(Task::getAssignee).collect(Collectors.toSet())); | |||
if (CollUtil.isNotEmpty(users)) { | |||
Set<String> employeeSet = Sets.newHashSet(); | |||
return users.stream().filter(u -> employeeSet.add(u.getEmployeeCode())).collect(Collectors | |||
.toMap(UserFullInfoDTO::getEmployeeCode, u -> u)); | |||
} | |||
return Collections.emptyMap(); | |||
List<UserFullInfoDTO> users = userInfoHelper.listUserFullInfoByUserIds( | |||
tasks.stream().map(w -> Long.parseLong(w.getAssignee())) | |||
.collect(Collectors.toSet())); | |||
return users.stream().collect(Collectors.toMap(UserFullInfoDTO::getUserId, u -> u)); | |||
} | |||
/** | |||
@@ -444,8 +438,8 @@ public class ProjectLibManage { | |||
item.setIsHigherSuperOrg(w.getIsHigherSuperOrg()); | |||
if (user.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()) | |||
&& w.getSuperOrgCode().equals(user.getMhUnitIdStr())) { | |||
item.setCanPreDeclared(Boolean.TRUE); | |||
} | |||
item.setApprovedAmount(w.getApprovalAmount()); | |||
@@ -525,8 +519,8 @@ public class ProjectLibManage { | |||
item.setIsHigherSuperOrg(w.getIsHigherSuperOrg()); | |||
if (user.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()) | |||
&& w.getSuperOrgCode().equals(user.getMhUnitIdStr())) { | |||
item.setCanPreDeclared(Boolean.TRUE); | |||
} | |||
item.setApprovedAmount(w.getApprovalAmount()); | |||
@@ -564,7 +558,7 @@ public class ProjectLibManage { | |||
.asc() | |||
.list(); | |||
Map<String, List<Task>> map = Maps.newHashMap(); | |||
Map<String, UserFullInfoDTO> userMap = Maps.newHashMap(); | |||
Map<Long, UserFullInfoDTO> userMap = Maps.newHashMap(); | |||
if (CollUtil.isNotEmpty(tasks)) { | |||
map = tasks.stream() | |||
.collect(Collectors.groupingBy(Task::getProcessInstanceId)); | |||
@@ -593,8 +587,8 @@ public class ProjectLibManage { | |||
item.setApproveUsers(buildApproveUsers(w.getInstCode(), map, userMap)); | |||
if (user.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()) | |||
&& w.getSuperOrgCode().equals(user.getMhUserId())) { | |||
item.setCanPreDeclared(Boolean.TRUE); | |||
} | |||
item.setApprovedAmount(w.getApprovalAmount()); | |||
@@ -841,12 +835,11 @@ public class ProjectLibManage { | |||
* | |||
* @param projectDto | |||
* @param instanceId | |||
* @param employeeCode | |||
* @return | |||
*/ | |||
public Project saveProjectInDeclared(ProjectDTO projectDto, String instanceId, | |||
String employeeCode) { | |||
Project project = saveProjectNewVersion(projectDto, instanceId, employeeCode, Boolean.FALSE); | |||
Long userId) { | |||
Project project = saveProjectNewVersion(projectDto, instanceId, userId, Boolean.FALSE); | |||
//保存项目和实例的关系 | |||
ProjectInst projectInst = new ProjectInst(); | |||
projectInst.setProjectId(project.getId()); | |||
@@ -862,16 +855,16 @@ public class ProjectLibManage { | |||
/** | |||
* 建设方案申报项目时 保存项目信息和其它相关联的信息 | |||
* | |||
* @param projectDto | |||
* @param instanceId | |||
* @param employeeCode | |||
* @param oldProject | |||
* @return | |||
* @param projectDto \ | |||
* @param instanceId \ | |||
* @param userId \ | |||
* @param oldProject \ | |||
* @return \ | |||
*/ | |||
public Project saveConstructProjectInDeclared(ProjectDTO projectDto, String instanceId, | |||
String employeeCode, Project oldProject) { | |||
Long userId, Project oldProject) { | |||
Project project = saveConstructProjectNewVersion(projectDto, instanceId, employeeCode, oldProject); | |||
Project project = saveConstructProjectNewVersion(projectDto, instanceId, userId, oldProject); | |||
// 将旧的项目状态、阶段置为null,防止项目还会出现在待申报列表 | |||
LambdaUpdateWrapper<Project> updateWrapper = Wrappers.lambdaUpdate(Project.class); | |||
updateWrapper.set(Project::getStage, null) | |||
@@ -894,11 +887,10 @@ public class ProjectLibManage { | |||
* | |||
* @param projectDto | |||
* @param instanceId | |||
* @param employeeCode | |||
* @return | |||
*/ | |||
public Project saveProjectNewVersion(ProjectDTO projectDto, String instanceId, | |||
String employeeCode, Boolean isContruct) { | |||
Long userId, Boolean isContruct) { | |||
//流程启动之后 入库项目 重要业务信息 用于列表查询 展示 | |||
try { | |||
Project project = new Project(); | |||
@@ -910,7 +902,7 @@ public class ProjectLibManage { | |||
project.setStage(ProjectStatusEnum.NOT_APPROVED.getCode()); | |||
project.setStatus(ProjectStatusEnum.UNDER_INTERNAL_AUDIT.getCode()); | |||
project.setInstCode(instanceId); | |||
project.setSponsor(employeeCode); | |||
project.setSponsor(String.valueOf(userId)); | |||
String projectCode = generateProjectCodeUtil.generateProjectCode(projectDto); | |||
project.setProjectCode(projectCode); | |||
if (projectService.save(project)) { | |||
@@ -921,7 +913,7 @@ public class ProjectLibManage { | |||
project = newProjectWithVersion(projectDto, isContruct); | |||
if (Objects.nonNull(project)) { | |||
project.setInstCode(instanceId); | |||
project.setSponsor(employeeCode); | |||
project.setSponsor(String.valueOf(userId)); | |||
projectService.updateById(project); | |||
} | |||
} | |||
@@ -935,14 +927,14 @@ public class ProjectLibManage { | |||
/** | |||
* 建设方案申报项目时 保存项目信息和其它相关联的信息 | |||
* | |||
* @param projectDto | |||
* @param instanceId | |||
* @param employeeCode | |||
* @param oldProject | |||
* @return | |||
* @param projectDto \ | |||
* @param instanceId \ | |||
* @param userId \ | |||
* @param oldProject \ | |||
* @return \ | |||
*/ | |||
public Project saveConstructProjectNewVersion(ProjectDTO projectDto, String instanceId, | |||
String employeeCode, Project oldProject) { | |||
Long userId, Project oldProject) { | |||
//流程启动之后 入库项目 重要业务信息 用于列表查询 展示 | |||
try { | |||
Project project = new Project(); | |||
@@ -956,7 +948,7 @@ public class ProjectLibManage { | |||
project.setStage(ProjectStatusEnum.NOT_APPROVED.getCode()); | |||
project.setStatus(ProjectStatusEnum.SCHEME_UNDER_REVIEW.getCode()); | |||
project.setInstCode(instanceId); | |||
project.setSponsor(employeeCode); | |||
project.setSponsor(String.valueOf(userId)); | |||
// 项目编号不变,版本号加1 | |||
project.setProjectCode(oldProject.getProjectCode()); | |||
project.setVersion(oldProject.getVersion() + 1); | |||
@@ -981,7 +973,7 @@ public class ProjectLibManage { | |||
project = newProjectWithVersion(projectDto, Boolean.TRUE); | |||
if (Objects.nonNull(project)) { | |||
project.setInstCode(instanceId); | |||
project.setSponsor(employeeCode); | |||
project.setSponsor(String.valueOf(userId)); | |||
projectService.updateById(project); | |||
} | |||
} | |||
@@ -1038,14 +1030,13 @@ public class ProjectLibManage { | |||
return project; | |||
} | |||
public Project saveProjectWithVersionAndStatus(ProjectDTO projecDto, Integer stageCode, Integer statusCode, Boolean isConstruct) { | |||
Project oldProject = projectService.getById(projecDto.getId()); | |||
public Project saveProjectWithVersionAndStatus(ProjectDTO projectDto, Integer stageCode, Integer statusCode, Boolean isConstruct) { | |||
Project oldProject = projectService.getById(projectDto.getId()); | |||
Project project = new Project(); | |||
VUtils.isTrue(Objects.isNull(oldProject)) | |||
.throwMessage("项目不存在!"); | |||
Assert.notNull(oldProject, "项目不存在"); | |||
BeanUtil.copyProperties(oldProject, project, CopyOptions.create() | |||
.setIgnoreError(Boolean.TRUE).setIgnoreNullValue(Boolean.TRUE)); | |||
BeanUtil.copyProperties(projecDto, project, CopyOptions.create() | |||
BeanUtil.copyProperties(projectDto, project, CopyOptions.create() | |||
.setIgnoreError(Boolean.TRUE).setIgnoreNullValue(Boolean.TRUE)); | |||
project.setVersion(oldProject.getVersion() + 1); | |||
project.setId(null); | |||
@@ -1065,20 +1056,20 @@ public class ProjectLibManage { | |||
if (projectService.save(project)) { | |||
projectService.reverseNewest(project.getProjectCode(), project.getId()); | |||
saveApplication(projecDto, project, isConstruct); | |||
saveApplication(projectDto, project, isConstruct); | |||
} | |||
return project; | |||
} | |||
public Project saveProjectWithVersion(ProjectDTO projecDto, String instanceId, Integer instType, Boolean isConstruct) { | |||
Project oldProject = projectService.getById(projecDto.getId()); | |||
public Project saveProjectWithVersion(ProjectDTO projectDto, String instanceId, Integer instType, Boolean isConstruct) { | |||
Project oldProject = projectService.getById(projectDto.getId()); | |||
Project project = new Project(); | |||
VUtils.isTrue(Objects.isNull(oldProject)) | |||
.throwMessage("项目不存在!"); | |||
BeanUtil.copyProperties(oldProject, project, CopyOptions.create() | |||
.setIgnoreError(Boolean.TRUE).setIgnoreNullValue(Boolean.TRUE)); | |||
BeanUtil.copyProperties(projecDto, project, CopyOptions.create() | |||
BeanUtil.copyProperties(projectDto, project, CopyOptions.create() | |||
.setIgnoreError(Boolean.TRUE).setIgnoreNullValue(Boolean.TRUE)); | |||
project.setVersion(oldProject.getVersion() + 1); | |||
project.setId(null); | |||
@@ -1099,7 +1090,7 @@ public class ProjectLibManage { | |||
projectService.reverseNewest(project.getProjectCode(), project.getId()); | |||
//app | |||
saveApplication(projecDto, project, isConstruct); | |||
saveApplication(projectDto, project, isConstruct); | |||
} | |||
return project; | |||
@@ -1107,8 +1098,7 @@ public class ProjectLibManage { | |||
public Project saveProjectWithVersion(Project oldProject, String instanceId, Integer instType) { | |||
Project project = new Project(); | |||
VUtils.isTrue(Objects.isNull(oldProject)) | |||
.throwMessage("项目不存在!"); | |||
Assert.notNull(oldProject, "项目不存在"); | |||
BeanUtil.copyProperties(oldProject, project, CopyOptions.create() | |||
.setIgnoreError(Boolean.TRUE).setIgnoreNullValue(Boolean.TRUE)); | |||
project.setVersion(oldProject.getVersion() + 1); | |||
@@ -1250,27 +1240,12 @@ public class ProjectLibManage { | |||
// 从申请借阅信息表中查出本单位及下属单位审批通过的项目 | |||
LambdaQueryWrapper<ProjectApplyBorrow> query = Wrappers.lambdaQuery(ProjectApplyBorrow.class) | |||
.select(ProjectApplyBorrow::getProjectId) | |||
.in(ProjectApplyBorrow::getApplyBorrowEmpPosUnitCode, subOrgSet) | |||
.in(ProjectApplyBorrow::getApplyBorrowOrgCode, subOrgSet) | |||
.eq(ProjectApplyBorrow::getIsSuccess, Boolean.TRUE); | |||
List<Long> applyBorrowProjectIdList = CollUtils.fieldList(projectApplyBorrowService.list(query), ProjectApplyBorrow::getProjectId); | |||
return applyBorrowProjectIdList.contains(project.getId()); | |||
} | |||
private Set<String> getSubOrgList(String empPosUnitCode) { | |||
Set<String> orgSet = new HashSet<>(); | |||
// 先将自己加入子集 | |||
orgSet.add(empPosUnitCode); | |||
Set<String> subOrgList = dingOrganizationService | |||
.list(Wrappers.lambdaQuery(DingOrganization.class).eq(DingOrganization::getParentCode, empPosUnitCode)) | |||
.stream().map(DingOrganization::getOrganizationCode).collect(Collectors.toSet()); | |||
// 遍历子集 | |||
for (String orgCode : subOrgList) { | |||
orgSet.addAll(getSubOrgList(orgCode)); | |||
} | |||
return orgSet; | |||
} | |||
public void exportList(ProjectListReq param, HttpServletResponse response) { | |||
param.setPageNumber(CommonConst.EXPORT_PAGE_NUMBER); | |||
param.setPageSize(CommonConst.EXPORT_PAGE_SIZE); | |||
@@ -1313,28 +1288,18 @@ public class ProjectLibManage { | |||
switch (currentUserDataScope.get().getRole()) { | |||
case NORMAL_MEMBER: | |||
//普通用户 只能看到自己单位去申报的 | |||
query.eq(Project::getBuildOrgCode, user.getEmpPosUnitCode()); | |||
query.eq(Project::getBuildOrgCode, user.getMhUnitId()); | |||
break; | |||
case COMPANY_MANAGER: | |||
//单位管理员 看到自己单位去申报的 + 待预审的主管单位是自己单位的项目 | |||
query.and(q1 -> q1.eq(Project::getBuildOrgCode, user.getEmpPosUnitCode()).or(q2 -> | |||
query.and(q1 -> q1.eq(Project::getBuildOrgCode, user.getMhUnitId()).or(q2 -> | |||
q2.eq(Project::getStage, ProjectStatusEnum.NOT_APPROVED.getCode()) | |||
.eq(Project::getStatus, ProjectStatusEnum.PENDING_PREQUALIFICATION.getCode()) | |||
.eq(Project::getSuperOrgCode, user.getEmpPosUnitCode()))); | |||
.eq(Project::getSuperOrgCode, user.getMhUnitId()))); | |||
break; | |||
case SUPER_ADMIN: | |||
//超级管理员 看到丽水全市的 并且也要判断他 同时是不是单位管理员 | |||
break; | |||
case REGION_MANAGER: | |||
//区域管理员 看到自己区域的项目 如果是市本级 就看全市的 | |||
if (RegionConst.RC_HZ.equals(user.getRegionCode())) { | |||
Collection<String> regionCodes = regionCacheHelper.listChildRegionCodeList(user.getRegionCode(), | |||
RegionConst.RL_CITY); | |||
query.in(Project::getAreaCode, regionCodes); | |||
} else { | |||
query.eq(Project::getAreaCode, user.getRegionCode()); | |||
} | |||
break; | |||
case VISITOR: | |||
//访客可以看全市的 | |||
break; | |||
@@ -1359,27 +1324,16 @@ public class ProjectLibManage { | |||
case NORMAL_MEMBER: | |||
//普通用户 只能看到自己单位去申报的 | |||
req.setUserType("normal"); | |||
req.setUserValue(user.getEmpPosUnitCode()); | |||
req.setUserValue(user.getMhUnitIdStr()); | |||
break; | |||
case COMPANY_MANAGER: | |||
//单位管理员 看到自己单位去申报的 + 待预审的主管单位是自己单位的项目 | |||
req.setUserType("org"); | |||
req.setUserValue(user.getEmpPosUnitCode()); | |||
req.setUserValue(user.getMhUnitIdStr()); | |||
break; | |||
case SUPER_ADMIN: | |||
//超级管理员 看到丽水全市的 并且也要判断他 同时是不是单位管理员 | |||
break; | |||
case REGION_MANAGER: | |||
//区域管理员 看到自己区域的项目 如果是市本级 就看全市的 | |||
if (RegionConst.RC_HZ.equals(user.getRegionCode())) { | |||
Collection<String> regionCodes = regionCacheHelper.listChildRegionCodeList(user.getRegionCode(), | |||
RegionConst.RL_CITY); | |||
req.setRegionCodes(regionCodes); | |||
} else { | |||
req.setUserRegionCode(user.getRegionCode()); | |||
} | |||
req.setUserType("region"); | |||
break; | |||
case VISITOR: | |||
//访客可以看全市的 | |||
break; | |||
@@ -1434,8 +1388,8 @@ public class ProjectLibManage { | |||
// 保存项目借阅信息 | |||
ProjectApplyBorrow projectApplyBorrow = new ProjectApplyBorrow(); | |||
projectApplyBorrow.setProjectId(project.getId()); | |||
projectApplyBorrow.setApplyBorrowEmployeeCode(user.getEmployeeCode()); | |||
projectApplyBorrow.setApplyBorrowEmpPosUnitCode(user.getEmpPosUnitCode()); | |||
projectApplyBorrow.setApplyBorrowUserId(user.getUserIdStr()); | |||
projectApplyBorrow.setApplyBorrowOrgCode(user.getMhUnitIdStr()); | |||
projectApplyBorrow.setInstanceId(instanceId); | |||
projectApplyBorrow.setCreateOn(LocalDateTime.now()); | |||
projectApplyBorrow.setCreateBy(LoginUserUtil.getUserId()); | |||
@@ -114,12 +114,12 @@ public class ProjectRenewalFundManage { | |||
return PageVo.of(records, total); | |||
} | |||
public PageVo<ProjectLibListItemVO> projectlist(ProjectRenewalListReq req, UserFullInfoDTO user) { | |||
public PageVo<ProjectLibListItemVO> projectList(ProjectRenewalListReq req, UserFullInfoDTO user) { | |||
LambdaQueryWrapper<Project> query = ProjectRenewFundHelper.projectQuery(req); | |||
//项目查最新 | |||
query.eq(Project::getNewest, Boolean.TRUE); | |||
//自己单位 | |||
query.eq(Project::getBuildOrgCode, user.getEmpPosUnitCode()); | |||
query.eq(Project::getBuildOrgCode, user.getMhUnitId()); | |||
//立项批复后 都可以 | |||
query.gt(Project::getStatus, ProjectStatusEnum.APPROVED_AFTER_CHOICE.getCode()); | |||
Page<Project> page = projectService.page(req.page(), query); | |||
@@ -162,8 +162,8 @@ public class ProjectRenewalFundManage { | |||
item.setIsHigherSuperOrg(w.getIsHigherSuperOrg()); | |||
if (finalUser.getIsOrgAdmin() && | |||
ProjectStatusEnum.PENDING_PREQUALIFICATION.getCode().equals(item.getStatus()) | |||
&& StringUtils.isNotBlank(w.getSuperOrgCode()) && StringUtils.isNotBlank(finalUser.getEmpPosUnitCode()) | |||
&& w.getSuperOrgCode().equals(finalUser.getEmpPosUnitCode())) { | |||
&& StringUtils.isNotBlank(w.getSuperOrgCode()) | |||
&& w.getSuperOrgCode().equals(finalUser.getMhUnitIdStr())) { | |||
item.setCanPreDeclared(Boolean.TRUE); | |||
} | |||
item.setApprovedAmount(w.getApprovalAmount()); | |||
@@ -601,25 +601,15 @@ public class ProjectRenewalFundManage { | |||
case NORMAL_MEMBER: | |||
//普通用户 只能看到自己单位去申报的 | |||
req.setUserType("normal"); | |||
req.setUserValue(user.getEmpPosUnitCode()); | |||
req.setUserValue(user.getMhUnitIdStr()); | |||
break; | |||
case COMPANY_MANAGER: | |||
case SUPER_ADMIN: | |||
case REGION_MANAGER: | |||
//单位管理员 看到自己单位去申报的 + 待预审的主管单位是自己单位的项目 | |||
//超级管理员 也只能看本单位的 | |||
req.setUserType("org"); | |||
req.setUserValue(user.getEmpPosUnitCode()); | |||
break; | |||
case REGION_MANAGER: | |||
//区域管理员 看到自己区域的项目 如果是市本级 就看全市的 | |||
if (RegionConst.RC_HZ.equals(user.getRegionCode())) { | |||
Collection<String> regionCodes = regionCacheHelper.listChildRegionCodeList(user.getRegionCode(), | |||
RegionConst.RL_CITY); | |||
req.setRegionCodes(regionCodes); | |||
} else { | |||
req.setUserRegionCode(user.getRegionCode()); | |||
} | |||
req.setUserType("region"); | |||
req.setUserValue(user.getMhUnitIdStr()); | |||
break; | |||
case VISITOR: | |||
//访客可以看全市的 | |||
@@ -1,87 +0,0 @@ | |||
package com.hz.pm.api.projectlib.model.entity; | |||
import com.alibaba.excel.context.AnalysisContext; | |||
import com.alibaba.excel.event.AnalysisEventListener; | |||
import com.ningdatech.basic.exception.BizException; | |||
import lombok.Data; | |||
import lombok.EqualsAndHashCode; | |||
import java.util.*; | |||
/** | |||
* @author CMM | |||
* @since 2023/04/17 18:26 | |||
*/ | |||
@Data | |||
@EqualsAndHashCode(callSuper = true) | |||
public class AnalysisEventMonitor extends AnalysisEventListener<Map<Integer, String>> { | |||
private final List<Project> records = new ArrayList<>(); | |||
/** | |||
* 存储Key | |||
*/ | |||
Map<Integer, String> key = new HashMap<>(); | |||
/** | |||
* keyList | |||
*/ | |||
List<String> keyList = new ArrayList<>(); | |||
@Override | |||
public void onException(Exception exception, AnalysisContext context) throws Exception { | |||
super.onException(exception, context); | |||
throw BizException.wrap("导入年度计划解析失败"); | |||
} | |||
@Override | |||
public void invokeHeadMap(Map<Integer, String> headMap, AnalysisContext context) { | |||
Set<Integer> integerSet = headMap.keySet(); | |||
for (Integer integer : integerSet) { | |||
keyList.add(headMap.get(integer)); | |||
} | |||
key.putAll(headMap); | |||
} | |||
@Override | |||
public void invoke(Map<Integer, String> integerStringMap, AnalysisContext context) { | |||
//Project project = new Project(); | |||
//project.setId(data.getProjectId()); | |||
//project.setProjectName(data.getProjectName()); | |||
//project.setProjectIntroduction(data.getProjectIntroduction()); | |||
//// 建设依据忽略 | |||
//project.setIsFirst(CommonConst.NEW_CONSTRUCTION.equals(data.getIsFirst()) ? 1 : 0); | |||
//String[] dataArr = data.getBuildCycle().split(CommonConst.ZHI); | |||
//project.setBeginTime(dataArr[0].trim()); | |||
//project.setEndTime(dataArr[1].trim()); | |||
//project.setDeclareAmount(data.getDeclaredAmount()); | |||
//project.setAnnualPlanAmount(data.getAnnualPlanAmount()); | |||
//project.setDeclareHaveAmount(data.getDeclareHaveAmount()); | |||
//project.setDeclareGovOwnFinanceAmount(data.getDeclareGovOwnFinanceAmount()); | |||
//project.setDeclareGovSuperiorFinanceAmount(data.getDeclareGovSuperiorFinanceAmount()); | |||
//project.setDeclareBankLendingAmount(data.getDeclareBankLendingAmount()); | |||
//project.setDeclareOtherAmount(data.getDeclareOtherAmount()); | |||
//project.setEngineeringSpeedOne(data.getFirstQuarter()); | |||
//project.setEngineeringSpeedTwo(data.getSecondQuarter()); | |||
//project.setEngineeringSpeedThree(data.getThirdQuarter()); | |||
//project.setEngineeringSpeedFour(data.getFourthQuarter()); | |||
//project.setBuildOrgName(data.getBuildUnitName()); | |||
//project.setContactName(data.getContactName()); | |||
//project.setResponsibleMan(data.getResponsibleMan()); | |||
//project.setProjectRemarks(data.getProjectRemarks()); | |||
//records.add(project); | |||
} | |||
@Override | |||
public void doAfterAllAnalysed(AnalysisContext context) { | |||
//if (records.isEmpty()) { | |||
// throw BizException.wrap("导入年度计划为空"); | |||
//} | |||
//List<Long> projectIds = CollUtils.fieldList(records, Project::getId); | |||
//long count = projectService.count(Wrappers.lambdaQuery(Project.class) | |||
// .in(Project::getId, projectIds)); | |||
//if (count != records.size()) { | |||
// throw BizException.wrap("请确保所有项目都存在"); | |||
//} | |||
//projectService.updateBatchById(records); | |||
} | |||
} |
@@ -19,7 +19,7 @@ import lombok.Data; | |||
*/ | |||
@TableName("nd_project_inst") | |||
@Data | |||
@ApiModel(value = "NdProjectInst对象", description = "") | |||
@ApiModel(value = "NdProjectInst对象") | |||
public class ProjectInst implements Serializable { | |||
private static final long serialVersionUID = 1L; | |||
@@ -19,7 +19,7 @@ import java.time.LocalDateTime; | |||
* @since 2023-09-26 | |||
*/ | |||
@Data | |||
@ApiModel(value = "NdProject对象", description = "") | |||
@ApiModel(value = "NdProject对象") | |||
public class ProjectPO implements Serializable { | |||
private static final long serialVersionUID = 1L; | |||
@@ -3,13 +3,9 @@ package com.hz.pm.api.projectlib.model.vo; | |||
import com.alibaba.fastjson.annotation.JSONField; | |||
import com.fasterxml.jackson.annotation.JsonFormat; | |||
import com.hz.pm.api.common.compare.Compare; | |||
import com.hz.pm.api.common.enumeration.CommonEnum; | |||
import com.hz.pm.api.portrait.model.vo.TagVO; | |||
import com.hz.pm.api.projectlib.model.enumeration.ProjectStatusEnum; | |||
import com.hz.pm.api.projectlib.model.enumeration.ProjectTypeNewEnum; | |||
import com.hz.pm.api.user.security.model.UserFullInfoDTO; | |||
import com.hz.pm.api.user.security.model.UserInfoDetails; | |||
import com.hz.pm.api.user.util.LoginUserUtil; | |||
import io.swagger.annotations.ApiModel; | |||
import io.swagger.annotations.ApiModelProperty; | |||
import lombok.Builder; | |||
@@ -167,17 +163,5 @@ public class ProjectLibListItemVO { | |||
@ApiModelProperty("年度投资金额总额") | |||
private BigDecimal annualAccumulateAmount; | |||
private List<AnnualAmountVO> annualAccumulateAmountList; | |||
public Boolean getNeedUploadSuperLineFile() { | |||
UserInfoDetails userInfoDetail = LoginUserUtil.loginUserDetail(); | |||
//要满足条件 1.当前登录人是市本级单位 2.有上级条线单位 3.项目状态是待预审 | |||
if (Objects.nonNull(userInfoDetail) && userInfoDetail.getIsMunicipalOrg() | |||
&& Objects.nonNull(this.isHigherSuperOrg) | |||
&& ProjectStatusEnum.PENDING_PREQUALIFICATION.getCode().equals(this.status) | |||
&& CommonEnum.YES.getCode().equals(this.isHigherSuperOrg)) { | |||
this.needUploadSuperLineFile = Boolean.TRUE; | |||
return this.needUploadSuperLineFile; | |||
} | |||
this.needUploadSuperLineFile = null; | |||
return this.needUploadSuperLineFile; | |||
} | |||
} |
@@ -6,7 +6,6 @@ import io.swagger.annotations.ApiModelProperty; | |||
import lombok.Data; | |||
import org.apache.commons.lang3.StringUtils; | |||
import java.io.Serializable; | |||
import java.math.BigDecimal; | |||
import java.time.LocalDateTime; | |||
import java.util.List; | |||
@@ -22,7 +21,7 @@ import java.util.Objects; | |||
*/ | |||
@ApiModel(value = "NdProjectRenewalFundDeclarationVO", description = "续建项目资金申请表") | |||
@Data | |||
public class ProjectRenewalFundDeclarationVO implements Serializable { | |||
public class ProjectRenewalFundDeclarationVO { | |||
private static final long serialVersionUID = 1L; | |||
@@ -97,8 +96,8 @@ public class ProjectRenewalFundDeclarationVO implements Serializable { | |||
@ApiModelProperty("年度投资金额详情") | |||
private List<AnnualAmountVO> annualAccumulateAmountList; | |||
public String getProjectTypeName(){ | |||
if(Objects.nonNull(this.projectType)){ | |||
public String getProjectTypeName() { | |||
if (Objects.nonNull(this.projectType)) { | |||
return ProjectTypeNewEnum.getDesc(this.projectType); | |||
} | |||
return StringUtils.EMPTY; | |||
@@ -6,6 +6,7 @@ import com.hz.pm.api.provincial.model.res.SjApiResponse; | |||
import com.hz.pm.api.provincial.service.IJoinReviewProvincialBureauService; | |||
import io.swagger.annotations.Api; | |||
import io.swagger.annotations.ApiOperation; | |||
import lombok.RequiredArgsConstructor; | |||
import lombok.extern.slf4j.Slf4j; | |||
import org.springframework.beans.factory.annotation.Autowired; | |||
import org.springframework.web.bind.annotation.GetMapping; | |||
@@ -25,15 +26,13 @@ import java.io.InputStream; | |||
*/ | |||
@Slf4j | |||
@RestController | |||
@RequiredArgsConstructor | |||
@RequestMapping("/api/v1/test") | |||
@Api(tags = "测试省局接口") | |||
public class TestController { | |||
@Autowired | |||
private IJoinReviewProvincialBureauService joinReviewProvincialBureauService; | |||
@Autowired | |||
private ReviewByProvincialDeptManage provincialDeptManage; | |||
private final IJoinReviewProvincialBureauService joinReviewProvincialBureauService; | |||
private final ReviewByProvincialDeptManage provincialDeptManage; | |||
@GetMapping("/push") | |||
@ApiOperation("测试推送") | |||
@@ -52,9 +51,6 @@ public class TestController { | |||
@GetMapping("/path") | |||
@ApiOperation("测试获取详情") | |||
public String path() throws IOException { | |||
// String template = ResourceUtil.getResource("template").getPath(); | |||
// return template; | |||
InputStream in = this.getClass().getResourceAsStream("/template/simsun.ttc"); | |||
StringBuilder sb = new StringBuilder(); | |||
int n; | |||
@@ -7,7 +7,6 @@ import lombok.Builder; | |||
import lombok.Data; | |||
import lombok.NoArgsConstructor; | |||
import java.io.Serializable; | |||
import java.math.BigDecimal; | |||
import java.util.List; | |||
@@ -21,8 +20,8 @@ import java.util.List; | |||
@Builder | |||
@AllArgsConstructor | |||
@NoArgsConstructor | |||
@ApiModel(value = "ProvincialProjectDTO", description = "") | |||
public class ProvincialProjectRes implements Serializable { | |||
@ApiModel(value = "ProvincialProjectDTO") | |||
public class ProvincialProjectRes { | |||
@ApiModelProperty("项目审核结果 1审核中 2审核通过 3审核不通过") | |||
private Integer projectStatus; | |||
@@ -65,7 +65,7 @@ public class SjApiResponse<T> implements Serializable { | |||
* @return ApiResponse | |||
*/ | |||
public static <T> SjApiResponse<T> of(Integer code, String msg, T data) { | |||
return new SjApiResponse<T>(code, msg, data); | |||
return new SjApiResponse<>(code, msg, data); | |||
} | |||
/** | |||
@@ -4,6 +4,7 @@ import cn.hutool.core.bean.BeanUtil; | |||
import cn.hutool.core.collection.CollUtil; | |||
import com.alibaba.fastjson.JSONObject; | |||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | |||
import com.baomidou.mybatisplus.core.toolkit.Assert; | |||
import com.baomidou.mybatisplus.core.toolkit.Wrappers; | |||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; | |||
import com.hz.pm.api.common.model.constant.BizConst; | |||
@@ -87,20 +88,12 @@ public class SafetyRiskManage { | |||
*/ | |||
private void checkAuth(LambdaQueryWrapper<Project> query, UserInfoDetails user) { | |||
//如果是超管 | |||
if (user.getSuperAdmin()) { | |||
if (user.getSuperAdmin() || user.getRegionAdmin()) { | |||
log.info(user.getUsername() + " 是超管,可以看所有项目"); | |||
} else if (user.getRegionAdmin()) { | |||
//如果是区域管理员 | |||
log.info(user.getUsername() + " 是区管,可以看本区域" + user.getRegionCode() + "项目"); | |||
if (!RegionConst.RC_HZ.equals(user.getRegionCode())) { | |||
//不是丽水市本级的话 就只看 自己区域的 | |||
query.eq(Project::getAreaCode, user.getRegionCode()); | |||
} | |||
//如果是市本级 就能看所有的 | |||
} else if (user.getIsOrgAdmin()) { | |||
//单位管理员 | |||
log.info(user.getUsername() + " 是单位管理员,可以看单位 " + user.getEmpPosUnitName() + " 项目"); | |||
query.eq(Project::getBuildOrgCode, user.getEmpPosUnitCode()); | |||
log.info(user.getUsername() + " 是单位管理员,可以看单位 " + user.getMhUnitId() + " 项目"); | |||
query.eq(Project::getBuildOrgCode, user.getMhUnitId()); | |||
} else { | |||
//其它角色全都看不见 | |||
query.eq(Project::getId, 0L); | |||
@@ -186,7 +179,7 @@ public class SafetyRiskManage { | |||
.eq(Project::getProjectCode, projectCode) | |||
.last(BizConst.LIMIT_1)); | |||
VUtils.isTrue(Objects.isNull(project)).throwMessage("此项目并不存在!"); | |||
Assert.notNull(project, "此项目并不存在!"); | |||
SupplierSafetyQualification entity = BeanUtil.copyProperties(dto, SupplierSafetyQualification.class); | |||
entity.setCreateBy(user.getUsername()); | |||
@@ -111,7 +111,7 @@ public class CcTaskListener { | |||
Long projectId = projectInst.getProjectId(); | |||
Project project = projectService.getNewProject(projectId); | |||
UserFullInfoDTO user = userInfoHelper.getUserFullInfoByEmployeeCode(task.getUserId()); | |||
UserFullInfoDTO user = userInfoHelper.getUserFullInfo(Long.valueOf(task.getUserId())); | |||
//发送消息 | |||
noticeManage.sendNotice(task.getUserId(), Objects.nonNull(user) ? user.getUserId() : 93L, project, instance.getProcessDefinitionName(), | |||
@@ -23,6 +23,7 @@ import org.flowable.engine.history.HistoricProcessInstance; | |||
import org.springframework.context.event.EventListener; | |||
import org.springframework.scheduling.annotation.Async; | |||
import org.springframework.stereotype.Component; | |||
import java.time.ZoneId; | |||
import java.util.List; | |||
import java.util.Objects; | |||
@@ -106,11 +107,11 @@ public class EarlyWarningListener { | |||
//项目 预警信息 | |||
projectEarlyWarningService.earlyWarning(project, | |||
WarningRuleTypeEnum.PROCESS_WARNING.getCode(),noticeType); | |||
WarningRuleTypeEnum.PROCESS_WARNING.getCode(), noticeType); | |||
if(StringUtils.isBlank(noticeMethod) || | |||
if (StringUtils.isBlank(noticeMethod) || | |||
(!noticeMethod.contains(String.valueOf(CommonEnum.ZWDD.getCode())) && | |||
!noticeMethod.contains(String.valueOf(CommonEnum.MOBILE.getCode())))){ | |||
!noticeMethod.contains(String.valueOf(CommonEnum.MOBILE.getCode())))) { | |||
log.info("通知方式为空或者错误!"); | |||
return; | |||
} | |||
@@ -118,15 +119,15 @@ public class EarlyWarningListener { | |||
//这一批员工要通知的员工号 | |||
String batchEmployees = hais.stream().map(HistoricActivityInstance::getAssignee) | |||
.collect(Collectors.joining(StrPool.COMMA)); | |||
for(HistoricActivityInstance hai : hais){ | |||
for (HistoricActivityInstance hai : hais) { | |||
String employeeCode = hai.getAssignee(); | |||
String taskId = hai.getTaskId(); | |||
String path = "toDoCenter/handleDuringExamine?instanceId=" + | |||
String path = "toDoCenter/handleDuringExamine?instanceId=" + | |||
instanceId + "&projectId=" + projectId + "&nodeId=" + nodeId + "&taskId=" + taskId; | |||
earlyWarningManage.doEarlyWarning(noticeMethod,noticeContent,timeout,overTimeout, pi.getInstType(), | |||
earlyWarningManage.doEarlyWarning(noticeMethod, noticeContent, timeout, overTimeout, pi.getInstType(), | |||
hai.getStartTime().toInstant().atZone(ZoneId.systemDefault()).toLocalDateTime() | |||
,employeeCode,project,WarningRuleTypeEnum.PROCESS_WARNING.getCode(),noticeType, | |||
path,batchEmployees,nodeId); | |||
, Long.valueOf(employeeCode), project, WarningRuleTypeEnum.PROCESS_WARNING.getCode(), noticeType, | |||
path, batchEmployees, nodeId); | |||
} | |||
} | |||
} |
@@ -39,6 +39,7 @@ import org.springframework.beans.factory.annotation.Value; | |||
import org.springframework.context.event.EventListener; | |||
import org.springframework.scheduling.annotation.Async; | |||
import org.springframework.stereotype.Component; | |||
import java.util.List; | |||
import java.util.Objects; | |||
import java.util.stream.Collectors; | |||
@@ -92,7 +93,7 @@ public class ProcessEndListener { | |||
try { | |||
Thread.sleep(3000); | |||
} catch (InterruptedException e) { | |||
throw new RuntimeException(e); | |||
throw new BizException(e); | |||
} | |||
//1.去查找 项目实例关系表 | |||
@@ -116,26 +117,22 @@ public class ProcessEndListener { | |||
//已经没有任务了 | |||
if (CollUtil.isEmpty(tasks) && CollUtil.isEmpty(historyTasks)) { | |||
List<HistoricTaskInstance> historyTasksFinished = historyService.createHistoricTaskInstanceQuery() | |||
.processInstanceId(instCode) | |||
.finished() | |||
.list(); | |||
Long projectId = projectInst.getProjectId(); | |||
Project project = projectService.getNewProject(projectId); | |||
HistoricProcessInstance instance = historyService.createHistoricProcessInstanceQuery() | |||
.processInstanceId(instCode).singleResult(); | |||
//通过审核后 所处理的逻辑 | |||
afterPassTodo(project,instance); | |||
afterPassTodo(project, instance); | |||
} | |||
} | |||
/** | |||
* 审核通过后 所处理的逻辑 | |||
* @param declaredProject | |||
* @param instance | |||
* | |||
* @param declaredProject \ | |||
* @param instance \ | |||
*/ | |||
public void afterPassTodo(Project declaredProject, HistoricProcessInstance instance){ | |||
public void afterPassTodo(Project declaredProject, HistoricProcessInstance instance) { | |||
Long userId = 110L; | |||
// 获取流程通过后的流程实例 | |||
HistoricProcessInstance newInstance = historyService.createHistoricProcessInstanceQuery() | |||
@@ -148,7 +145,7 @@ public class ProcessEndListener { | |||
.last(BizConst.LIMIT_1)); | |||
Integer instType = projectInst.getInstType(); | |||
InstTypeEnum instTypeEnum = InstTypeEnum.getByCode(instType); | |||
if (Objects.isNull(instTypeEnum)){ | |||
if (Objects.isNull(instTypeEnum)) { | |||
throw new BizException("当前审批流类型不存在,流程类型code:" + instType); | |||
} | |||
@@ -184,20 +181,20 @@ public class ProcessEndListener { | |||
// 并向流程发起人发送浙政钉工作通知:【项目名称】已通过【流程名称】,请及时开始下一步操作。 | |||
if (HisProInsEndActId.END.equals(newInstance.getEndActivityId())) { | |||
// 如果是申请延期和申请借阅审批流程,不走状态机 | |||
if (InstTypeEnum.APPLY_DELAY.getCode().equals(instType) || InstTypeEnum.APPLY_BORROW.getCode().equals(instType)){ | |||
if (InstTypeEnum.APPLY_DELAY.getCode().equals(instType) || InstTypeEnum.APPLY_BORROW.getCode().equals(instType)) { | |||
switch (instTypeEnum) { | |||
case APPLY_DELAY: | |||
// 保存延期申请记录,更新项目建设周期和计划验收时间 | |||
handlerManage.updateProjectDelayApplyInfo(declaredProject,instanceId); | |||
handlerManage.updateProjectDelayApplyInfo(declaredProject, instanceId); | |||
break; | |||
case APPLY_BORROW: | |||
// 更新申请借阅状态为成功 | |||
handlerManage.updateProjectApplyBorrowInfo(declaredProject,instanceId); | |||
handlerManage.updateProjectApplyBorrowInfo(declaredProject, instanceId); | |||
break; | |||
default: | |||
throw new BizException("传入实例类型错误: " + instTypeEnum); | |||
} | |||
}else { | |||
} else { | |||
switch (Objects.requireNonNull(ProjectStatusEnum.match(declaredProject.getStatus()))) { | |||
// 当前项目状态是预审中 | |||
case PRE_APPLYING: | |||
@@ -219,7 +216,7 @@ public class ProcessEndListener { | |||
.list(Wrappers.lambdaQuery(ProjectApplication.class) | |||
.eq(ProjectApplication::getProjectId, declaredProject.getId())); | |||
joinReviewProvincialBureauService.pushImportProject( | |||
ApplicationConverter.convertProject(declaredProject, applications, fileService,active)); | |||
ApplicationConverter.convertProject(declaredProject, applications, fileService, active)); | |||
handlerManage.updatePassProjectStatus(userId, declaredProject); | |||
break; | |||
} catch (Exception e) { | |||
@@ -238,7 +235,7 @@ public class ProcessEndListener { | |||
} | |||
} | |||
//发送消息 | |||
noticeManage.sendNotice(instance.getStartUserId(),userId,declaredProject,instance.getProcessDefinitionName(), | |||
noticeManage.sendNotice(instance.getStartUserId(), userId, declaredProject, instance.getProcessDefinitionName(), | |||
PASS_MSG_TEMPLATE2, MsgTypeEnum.PROJECT_REVIEW_PASS); | |||
} else { | |||
// 若有下一个审核人(当前节点的用户),会签/或签会有多个 | |||
@@ -249,8 +246,8 @@ public class ProcessEndListener { | |||
throw new BizException("审核人信息不存在!"); | |||
} | |||
//发送消息 | |||
noticeManage.sendNotice(currentEmployeeCode,userId,declaredProject,instance.getProcessDefinitionName(), | |||
PASS_MSG_TEMPLATE,MsgTypeEnum.PROJECT_REVIEW); | |||
noticeManage.sendNotice(currentEmployeeCode, userId, declaredProject, instance.getProcessDefinitionName(), | |||
PASS_MSG_TEMPLATE, MsgTypeEnum.PROJECT_REVIEW); | |||
} | |||
} | |||
} |
@@ -2,14 +2,15 @@ package com.hz.pm.api.scheduler.task; | |||
import cn.hutool.core.collection.CollUtil; | |||
import cn.hutool.core.date.StopWatch; | |||
import cn.hutool.core.util.ObjectUtil; | |||
import com.alibaba.fastjson.JSON; | |||
import com.alibaba.fastjson.JSONArray; | |||
import com.alibaba.fastjson.JSONObject; | |||
import com.baomidou.mybatisplus.core.toolkit.Wrappers; | |||
import com.google.common.collect.Lists; | |||
import com.hz.pm.api.common.helper.RegionCacheHelper; | |||
import com.hz.pm.api.common.model.constant.BizConst; | |||
import com.hz.pm.api.common.model.constant.RegionConst; | |||
import com.hz.pm.api.common.helper.RegionCacheHelper; | |||
import com.hz.pm.api.common.statemachine.contant.RegionContant; | |||
import com.hz.pm.api.common.util.BizUtils; | |||
import com.hz.pm.api.dashboard.constant.DashboardConstant; | |||
@@ -27,10 +28,10 @@ import com.hz.pm.api.meta.model.entity.ExpertTag; | |||
import com.hz.pm.api.meta.service.IExpertTagService; | |||
import com.hz.pm.api.performance.model.entity.PerformanceAppraisalProject; | |||
import com.hz.pm.api.performance.service.IPerformanceAppraisalProjectService; | |||
import com.hz.pm.api.projectlib.model.enumeration.InstTypeEnum; | |||
import com.hz.pm.api.projectlib.model.enumeration.ProjectStatusEnum; | |||
import com.hz.pm.api.projectlib.model.entity.Project; | |||
import com.hz.pm.api.projectlib.model.entity.ProjectInst; | |||
import com.hz.pm.api.projectlib.model.enumeration.InstTypeEnum; | |||
import com.hz.pm.api.projectlib.model.enumeration.ProjectStatusEnum; | |||
import com.hz.pm.api.projectlib.service.IProjectInstService; | |||
import com.hz.pm.api.projectlib.service.IProjectService; | |||
import com.hz.pm.api.sys.model.dto.RegionDTO; | |||
@@ -44,6 +45,7 @@ import org.flowable.engine.history.HistoricActivityInstance; | |||
import org.springframework.beans.factory.annotation.Value; | |||
import org.springframework.scheduling.annotation.Scheduled; | |||
import org.springframework.stereotype.Component; | |||
import java.math.BigDecimal; | |||
import java.net.InetAddress; | |||
import java.net.UnknownHostException; | |||
@@ -85,22 +87,20 @@ public class CockpitStatsStatisticsTask { | |||
private final IExpertIntentionWorkRegionService expertIntentionWorkRegionService; | |||
private final IExpertTagService expertTagService; | |||
private List<Integer> years = Lists.newArrayList(2021,2022,2023,2024,2025); | |||
private List<Integer> years = Lists.newArrayList(2021, 2022, 2023, 2024, 2025); | |||
/** | |||
* 定义统计 驾驶舱数据 每天3点开始执行一次 | |||
* | |||
*/ | |||
@Scheduled(cron = "0 0 3 * * ?") | |||
public void doTask() throws UnknownHostException { | |||
if (!HOST.equals(InetAddress.getLocalHost().getHostName())) { | |||
log.info("定时器没开启或者host不对! {}:{}", | |||
HOST,InetAddress.getLocalHost().getHostName()); | |||
HOST, InetAddress.getLocalHost().getHostName()); | |||
return; | |||
} | |||
if(BizConst.PRE.equals(active)){ | |||
if (BizConst.PRE.equals(active)) { | |||
log.info("预发环境不用同步!"); | |||
return; | |||
} | |||
@@ -114,24 +114,24 @@ public class CockpitStatsStatisticsTask { | |||
//1.根据2个维度来统计 区域和分年 | |||
//1.总的 | |||
res.add(statisticsData(DashboardConstant.CockpitStats.TOTAL, | |||
DashboardConstant.CockpitStats.TOTAL,DashboardConstant.CockpitStats.NONE_YEAR)); | |||
for(Integer year : years){ | |||
DashboardConstant.CockpitStats.TOTAL, DashboardConstant.CockpitStats.NONE_YEAR)); | |||
for (Integer year : years) { | |||
res.add(statisticsData(DashboardConstant.CockpitStats.TOTAL, | |||
DashboardConstant.CockpitStats.TOTAL,year)); | |||
DashboardConstant.CockpitStats.TOTAL, year)); | |||
} | |||
List<RegionDTO> regions = regionCacheHelper.listChildren(RegionConst.RC_HZ, RegionConst.RL_CITY); | |||
regions = regions.stream().filter(r -> r.getRegionLevel() != RegionConst.RL_CITY).collect(Collectors.toList()); | |||
for(RegionDTO regionDto : regions){ | |||
res.add(statisticsData(regionDto.getRegionCode(),regionDto.getRegionName(), | |||
for (RegionDTO regionDto : regions) { | |||
res.add(statisticsData(regionDto.getRegionCode(), regionDto.getRegionName(), | |||
DashboardConstant.CockpitStats.NONE_YEAR)); | |||
for(Integer year : years){ | |||
res.add(statisticsData(regionDto.getRegionCode(),regionDto.getRegionName(),year)); | |||
for (Integer year : years) { | |||
res.add(statisticsData(regionDto.getRegionCode(), regionDto.getRegionName(), year)); | |||
} | |||
} | |||
//如果结果不为空 就删除之前的 插入最新的数据 | |||
if(CollUtil.isNotEmpty(res)){ | |||
if (CollUtil.isNotEmpty(res)) { | |||
//计算增长率 | |||
computeRates(res); | |||
List<CockpitStats> list = cockpitStatsService.list(); | |||
@@ -141,25 +141,25 @@ public class CockpitStatsStatisticsTask { | |||
} | |||
stopWatch.stop(); | |||
log.info("驾驶舱数据统计任务结束====={}s",stopWatch.getTotalTimeSeconds()); | |||
log.info("驾驶舱数据统计任务结束====={}s", stopWatch.getTotalTimeSeconds()); | |||
} | |||
private void computeRates(List<CockpitStats> res) { | |||
Map<String, CockpitStats> map = res.stream().collect(Collectors.toMap(r -> r.getRegionCode() + r.getYear(), r -> r)); | |||
for(CockpitStats cockpitStats : res){ | |||
if(Objects.isNull(cockpitStats.getYear())){ | |||
for (CockpitStats cockpitStats : res) { | |||
if (Objects.isNull(cockpitStats.getYear())) { | |||
continue; | |||
} | |||
//算增长率 | |||
//去年的数据 用于算 增长比例 | |||
if(cockpitStats.getYear().equals(DashboardConstant.CockpitStats.NONE_YEAR)){ | |||
Integer thisYear = LocalDateTime.now().getYear(); | |||
if (cockpitStats.getYear().equals(DashboardConstant.CockpitStats.NONE_YEAR)) { | |||
int thisYear = LocalDateTime.now().getYear(); | |||
CockpitStats thisYearData = map.get(cockpitStats.getRegionCode() + thisYear); | |||
CockpitStats lastYearData = map.get(cockpitStats.getRegionCode() + (thisYear - 1)); | |||
buildMonitorRise(cockpitStats,thisYearData,lastYearData); | |||
}else{ | |||
buildMonitorRise(cockpitStats, thisYearData, lastYearData); | |||
} else { | |||
CockpitStats lastYearData = map.get(cockpitStats.getRegionCode() + (cockpitStats.getYear() - 1)); | |||
buildMonitorRise(cockpitStats,cockpitStats,lastYearData); | |||
buildMonitorRise(cockpitStats, cockpitStats, lastYearData); | |||
} | |||
} | |||
@@ -167,6 +167,7 @@ public class CockpitStatsStatisticsTask { | |||
/** | |||
* 统计的具体逻辑 | |||
* | |||
* @param regionCode | |||
* @param regionName | |||
* @param year | |||
@@ -179,38 +180,38 @@ public class CockpitStatsStatisticsTask { | |||
cockpitStats.setYear(year); | |||
//申报项目 | |||
boolean condition = Objects.nonNull(year) && !year.equals(DashboardConstant.CockpitStats.NONE_YEAR); | |||
boolean condition1 = Objects.isNull(year) || year.equals(DashboardConstant.CockpitStats.NONE_YEAR); | |||
List<Project> projects = projectService.list(Wrappers.lambdaQuery(Project.class) | |||
.eq(Project::getNewest, Boolean.TRUE) | |||
.eq(StringUtils.isNotBlank(regionCode) && !DashboardConstant.CockpitStats.TOTAL.equals(regionCode), | |||
Project::getAreaCode, regionCode) | |||
.eq(Objects.nonNull(year) && !year.equals(DashboardConstant.CockpitStats.NONE_YEAR), | |||
Project::getProjectYear, year) | |||
.in(Objects.isNull(year) || year.equals(DashboardConstant.CockpitStats.NONE_YEAR), | |||
Project::getProjectYear, years)); | |||
.eq(condition, Project::getProjectYear, year) | |||
.in(condition1, Project::getProjectYear, years)); | |||
//项目归集 | |||
List<GovBizProjectApply> applieYears = applyService.list(Wrappers.lambdaQuery(GovBizProjectApply.class) | |||
.eq(Objects.nonNull(year) && !year.equals(DashboardConstant.CockpitStats.NONE_YEAR), | |||
.eq(condition, | |||
GovBizProjectApply::getBaseProjSetYear, year) | |||
.in(Objects.isNull(year) || year.equals(DashboardConstant.CockpitStats.NONE_YEAR), | |||
.in(condition1, | |||
GovBizProjectApply::getBaseProjSetYear, years)); | |||
List<String> yearProjIds = applieYears.stream().map(GovBizProjectApply::getBaseProjId) | |||
.collect(Collectors.toList()); | |||
List<GovBizProjectBaseinfo> baseInfos = Lists.newArrayList(); | |||
if(CollUtil.isNotEmpty(yearProjIds)){ | |||
if (CollUtil.isNotEmpty(yearProjIds)) { | |||
baseInfos = baseinfoService.list(Wrappers.lambdaQuery(GovBizProjectBaseinfo.class) | |||
.eq(GovBizProjectBaseinfo::getDeleted, Boolean.FALSE) | |||
.eq(StringUtils.isNotBlank(regionCode) && !DashboardConstant.CockpitStats.TOTAL.equals(regionCode), | |||
GovBizProjectBaseinfo::getBaseAreaCode, regionCode + RegionContant.MORE_CODE) | |||
.in(GovBizProjectBaseinfo::getBaseProjId,yearProjIds)); | |||
.in(GovBizProjectBaseinfo::getBaseProjId, yearProjIds)); | |||
} | |||
List<GovBizProjectApprove> approves = Lists.newArrayList(); | |||
List<GovBizProjectApply> applies = Lists.newArrayList(); | |||
List<GovBizProjectProcure> procures = Lists.newArrayList(); | |||
List<GovBizProjectCimplement> cimplements = Lists.newArrayList(); | |||
if(CollUtil.isNotEmpty(baseInfos)){ | |||
if (CollUtil.isNotEmpty(baseInfos)) { | |||
List<String> baseProjIds = baseInfos.stream().map(GovBizProjectBaseinfo::getBaseProjId).collect(Collectors.toList()); | |||
approves = approveService.list(Wrappers.lambdaQuery(GovBizProjectApprove.class) | |||
.in(GovBizProjectApprove::getBaseProjId, baseProjIds)); | |||
@@ -227,35 +228,35 @@ public class CockpitStatsStatisticsTask { | |||
//1.项目监测 | |||
//1.1 超期在建项目 | |||
Integer overdueConstructionProjectsNum = projects.stream().filter(p -> { | |||
if(Objects.nonNull(p.getPlanAcceptanceTime()) && | |||
Integer overdueConstructionProjectsNum = (int) projects.stream().filter(p -> { | |||
if (Objects.nonNull(p.getPlanAcceptanceTime()) && | |||
p.getPlanAcceptanceTime().compareTo(LocalDateTime.now()) < 0 && | |||
Objects.nonNull(p.getStatus()) && p.getStatus().compareTo(ProjectStatusEnum.ACCEPTED.getCode()) < 0){ | |||
Objects.nonNull(p.getStatus()) && p.getStatus().compareTo(ProjectStatusEnum.ACCEPTED.getCode()) < 0) { | |||
return Boolean.TRUE; | |||
} | |||
return Boolean.FALSE; | |||
}).collect(Collectors.toList()).size(); | |||
}).count(); | |||
cockpitStats.setMonitorOverdueConstructionProjectsNum(overdueConstructionProjectsNum); | |||
//1.2 环节滞后项目 | |||
cockpitStats.setMonitorLaggingProjectsNum(computeLagging(projects)); | |||
//1.3预审驳回项目 | |||
Integer preFailed = projects.stream().filter(p -> { | |||
if(Objects.nonNull(p.getStatus()) && | |||
p.getStatus().equals(ProjectStatusEnum.PREQUALIFICATION_FAILED.getCode())){ | |||
Integer preFailed = (int) projects.stream().filter(p -> { | |||
if (Objects.nonNull(p.getStatus()) && | |||
p.getStatus().equals(ProjectStatusEnum.PREQUALIFICATION_FAILED.getCode())) { | |||
return Boolean.TRUE; | |||
} | |||
return Boolean.FALSE; | |||
}).collect(Collectors.toList()).size(); | |||
}).count(); | |||
cockpitStats.setMonitorRejectedPreReviewProjectsNum(preFailed); | |||
//1.4 建设方案评审失败 | |||
Integer constructionFailed = projects.stream().filter(p -> { | |||
if(Objects.nonNull(p.getStatus()) && p.getStatus().equals(ProjectStatusEnum.SCHEME_REVIEW_FAILED.getCode())){ | |||
Integer constructionFailed = (int) projects.stream().filter(p -> { | |||
if (Objects.nonNull(p.getStatus()) && p.getStatus().equals(ProjectStatusEnum.SCHEME_REVIEW_FAILED.getCode())) { | |||
return Boolean.TRUE; | |||
} | |||
return Boolean.FALSE; | |||
}).collect(Collectors.toList()).size(); | |||
}).count(); | |||
cockpitStats.setMonitorRejectedApproveProjectsNum(constructionFailed); | |||
//1.5 验收不达标 | |||
cockpitStats.setMonitorAcceptConditionsNotStandardsNum(0); | |||
@@ -265,16 +266,16 @@ public class CockpitStatsStatisticsTask { | |||
cockpitStats.setMonitorDeclaredAmount(BigDecimal.valueOf(totalDeclaredAmount)); | |||
//1.7 总安全投入 | |||
double totalSafetyAmount = projects.stream().mapToDouble(p -> { | |||
if(Objects.nonNull(p.getSafetyInputDescribe())){ | |||
if (Objects.nonNull(p.getSafetyInputDescribe())) { | |||
final Double[] total = {0.0}; | |||
try{ | |||
try { | |||
JSONArray array = JSON.parseArray(p.getSafetyInputDescribe()); | |||
array.forEach(j -> { | |||
JSONObject json = JSON.parseObject(JSON.toJSONString(j)); | |||
Double safetyInputAmount = json.getDouble(DashboardConstant.Protrait.FEILD_SAFETYMONEY); | |||
total[0] += safetyInputAmount; | |||
}); | |||
}catch (Exception e){ | |||
} catch (Exception e) { | |||
} | |||
return total[0]; | |||
@@ -292,10 +293,10 @@ public class CockpitStatsStatisticsTask { | |||
Integer guijiSecerecyGrade4 = 0; | |||
Integer guijiSecerecyGrade5 = 0; | |||
//项目归集 评审信息 | |||
for (GovBizProjectApprove approve : approves){ | |||
for (GovBizProjectApprove approve : approves) { | |||
String equalProtectionLevel = approve.getEqualProtectionLevel(); | |||
if(StringUtils.isNotBlank(equalProtectionLevel)){ | |||
switch (equalProtectionLevel){ | |||
if (StringUtils.isNotBlank(equalProtectionLevel)) { | |||
switch (equalProtectionLevel) { | |||
case "01": | |||
guijiSecerecyGrade1++; | |||
break; | |||
@@ -318,13 +319,13 @@ public class CockpitStatsStatisticsTask { | |||
} | |||
Integer passwordGradeNumGov = 0; | |||
for (GovBizProjectCimplement cimplement : cimplements){ | |||
if(StringUtils.isNotBlank(cimplement.getBaseInforLevelFile())){ | |||
passwordGradeNumGov ++; | |||
for (GovBizProjectCimplement cimplement : cimplements) { | |||
if (StringUtils.isNotBlank(cimplement.getBaseInforLevelFile())) { | |||
passwordGradeNumGov++; | |||
} | |||
} | |||
if(Objects.nonNull(secrecyPasswordGradePo)){ | |||
if (Objects.nonNull(secrecyPasswordGradePo)) { | |||
cockpitStats.setMonitorSecrecyGrade1Num(secrecyPasswordGradePo.getMonitorSecrecyGrade1Num() + guijiSecerecyGrade1); | |||
cockpitStats.setMonitorSecrecyGrade2Num(secrecyPasswordGradePo.getMonitorSecrecyGrade2Num() + guijiSecerecyGrade2); | |||
cockpitStats.setMonitorSecrecyGrade3Num(secrecyPasswordGradePo.getMonitorSecrecyGrade3Num() + guijiSecerecyGrade3); | |||
@@ -335,7 +336,7 @@ public class CockpitStatsStatisticsTask { | |||
cockpitStats.setMonitorPasswordGrade3Num(secrecyPasswordGradePo.getMonitorPasswordGrade3Num()); | |||
cockpitStats.setMonitorPasswordGrade4Num(secrecyPasswordGradePo.getMonitorPasswordGrade4Num()); | |||
cockpitStats.setMonitorPasswordGrade5Num(secrecyPasswordGradePo.getMonitorPasswordGrade5Num()); | |||
}else{ | |||
} else { | |||
cockpitStats.setMonitorSecrecyGrade1Num(guijiSecerecyGrade1); | |||
cockpitStats.setMonitorSecrecyGrade2Num(guijiSecerecyGrade2); | |||
cockpitStats.setMonitorSecrecyGrade3Num(guijiSecerecyGrade3); | |||
@@ -345,7 +346,7 @@ public class CockpitStatsStatisticsTask { | |||
} | |||
//2.专家统计 | |||
List<String> lsRegionCodes = RegionConst.LS_ARR; | |||
List<String> lsRegionCodes = RegionConst.LS_ARR; | |||
List<ExpertIntentionWorkRegion> intentions = expertIntentionWorkRegionService.list(Wrappers.lambdaQuery(ExpertIntentionWorkRegion.class) | |||
.eq(StringUtils.isNotBlank(regionCode) && !DashboardConstant.CockpitStats.TOTAL.equals(regionCode), | |||
ExpertIntentionWorkRegion::getRegionCode, regionCode) | |||
@@ -353,7 +354,7 @@ public class CockpitStatsStatisticsTask { | |||
ExpertIntentionWorkRegion::getRegionCode, lsRegionCodes)); | |||
List<ExpertUserFullInfo> experts = Lists.newArrayList(); | |||
if(CollUtil.isNotEmpty(intentions)){ | |||
if (CollUtil.isNotEmpty(intentions)) { | |||
List<Long> userIds = intentions.stream().map(ExpertIntentionWorkRegion::getUserId) | |||
.collect(Collectors.toList()); | |||
experts = expertUserFullInfoService.list(Wrappers.lambdaQuery(ExpertUserFullInfo.class) | |||
@@ -371,8 +372,8 @@ public class CockpitStatsStatisticsTask { | |||
String dangzhengCode = DashboardConstant.Expert.DANGZHENG_CODE; | |||
String ruanyingCode = DashboardConstant.Expert.RUANYING_CODE; | |||
String caiwuCode = DashboardConstant.Expert.CAIWU_CODE; | |||
List<String> specialTags = Lists.newArrayList(networkCode,xinchuangCode,fanganCode,jishuCode, | |||
dangzhengCode,ruanyingCode,caiwuCode); | |||
List<String> specialTags = Lists.newArrayList(networkCode, xinchuangCode, fanganCode, jishuCode, | |||
dangzhengCode, ruanyingCode, caiwuCode); | |||
cockpitStats.setExpertTotalNum(experts.size()); | |||
Integer financialNum = 0; | |||
@@ -384,38 +385,38 @@ public class CockpitStatsStatisticsTask { | |||
Integer softHardPricingNum = 0; | |||
Integer technicalFeasibilityAssessmentNum = 0; | |||
Integer specialExpertNum = 0; | |||
for(ExpertUserFullInfo e : experts){ | |||
if(tagMap.containsKey(e.getUserId())){ | |||
for (ExpertUserFullInfo e : experts) { | |||
if (tagMap.containsKey(e.getUserId())) { | |||
List<ExpertTag> expertTags = tagMap.get(e.getUserId()); | |||
Boolean isContain = Boolean.FALSE; | |||
for(ExpertTag expertTag : expertTags){ | |||
if(expertTag.getTagCode().equals(networkCode)){ | |||
boolean isContain = Boolean.FALSE; | |||
for (ExpertTag expertTag : expertTags) { | |||
if (expertTag.getTagCode().equals(networkCode)) { | |||
networkSecurityNum++; | |||
} | |||
if(expertTag.getTagCode().equals(caiwuCode)){ | |||
financialNum ++; | |||
if (expertTag.getTagCode().equals(caiwuCode)) { | |||
financialNum++; | |||
} | |||
if(expertTag.getTagCode().equals(xinchuangCode)){ | |||
xinchuangNum ++; | |||
if (expertTag.getTagCode().equals(xinchuangCode)) { | |||
xinchuangNum++; | |||
} | |||
if(expertTag.getTagCode().equals(fanganCode)){ | |||
if (expertTag.getTagCode().equals(fanganCode)) { | |||
planRationalityNum++; | |||
} | |||
if(expertTag.getTagCode().equals(jishuCode)){ | |||
technicalFeasibilityAssessmentNum ++; | |||
if (expertTag.getTagCode().equals(jishuCode)) { | |||
technicalFeasibilityAssessmentNum++; | |||
} | |||
if(expertTag.getTagCode().equals(dangzhengCode)){ | |||
partyGovInfoNum ++; | |||
if (expertTag.getTagCode().equals(dangzhengCode)) { | |||
partyGovInfoNum++; | |||
} | |||
if(expertTag.getTagCode().equals(ruanyingCode)){ | |||
softHardPricingNum ++; | |||
if (expertTag.getTagCode().equals(ruanyingCode)) { | |||
softHardPricingNum++; | |||
} | |||
if(specialTags.contains(expertTag.getTagCode())){ | |||
if (specialTags.contains(expertTag.getTagCode())) { | |||
isContain = Boolean.TRUE; | |||
} | |||
} | |||
if(isContain){ | |||
specialExpertNum ++; | |||
if (isContain) { | |||
specialExpertNum++; | |||
} | |||
} | |||
} | |||
@@ -434,53 +435,52 @@ public class CockpitStatsStatisticsTask { | |||
//3.顶部数据 | |||
//3.1 计划项目数(申报项目:完成年度计划的项目总数 | |||
// 项目归集:评审中、待立项、已立项、已采购、已初验、已终验项目总和) | |||
Integer planProjectNum = projects.stream().filter(p -> { | |||
if(Objects.nonNull(p.getStatus()) && | |||
p.getStatus().compareTo(ProjectStatusEnum.PENDING_PREQUALIFICATION.getCode()) >= 0){ | |||
return Boolean.TRUE; | |||
} | |||
return Boolean.FALSE; | |||
}).collect(Collectors.toList()).size(); | |||
Integer planProjectNumGov = baseInfos.stream().filter(p -> { | |||
if(Objects.nonNull(p.getBaseProjSetProg()) && | |||
Integer planProjectNum = (int) projects.stream().filter(p -> { | |||
if (Objects.nonNull(p.getStatus()) && | |||
p.getStatus().compareTo(ProjectStatusEnum.PENDING_PREQUALIFICATION.getCode()) >= 0) { | |||
return Boolean.TRUE; | |||
} | |||
return Boolean.FALSE; | |||
}).count(); | |||
Integer planProjectNumGov = (int) baseInfos.stream().filter(p -> { | |||
if (Objects.nonNull(p.getBaseProjSetProg()) && | |||
//排除 已驳回 已终止 | |||
(!Lists.newArrayList(GovProjectStatusEnum.REJECTED.getCode(), | |||
GovProjectStatusEnum.TERMINATED.getCode()).contains(p.getBaseProjSetProg()))){ | |||
GovProjectStatusEnum.TERMINATED.getCode()).contains(p.getBaseProjSetProg()))) { | |||
return Boolean.TRUE; | |||
} | |||
return Boolean.FALSE; | |||
}).collect(Collectors.toList()).size(); | |||
}).count(); | |||
cockpitStats.setTopPlanProjectsNum(planProjectNum + planProjectNumGov); | |||
//3.2 批复项目数(申报项目:完成立项批复流程项目总数 项目归集:已立项、已采购、已初验、已终验项目总和) | |||
Integer approvalNumDeclared = projects.stream().filter(p -> { | |||
if(Objects.nonNull(p.getApprovalAmount())){ | |||
Integer approvalNumDeclared = (int) projects.stream().filter(p -> { | |||
if (Objects.nonNull(p.getApprovalAmount())) { | |||
return Boolean.TRUE; | |||
} | |||
return Boolean.FALSE; | |||
}).collect(Collectors.toList()).size(); | |||
Integer approvalNumGov = baseInfos.stream().filter(p -> { | |||
if(Objects.nonNull(p.getBaseProjSetProg()) && Lists.newArrayList(GovProjectStatusEnum.APPROVED.getCode(), | |||
GovProjectStatusEnum.PURCHASED.getCode(),GovProjectStatusEnum.HAS_PRE_INS.getCode(), | |||
GovProjectStatusEnum.HAS_FINAL_INS.getCode()).contains(p.getBaseProjSetProg())){ | |||
}).count(); | |||
Integer approvalNumGov = (int) baseInfos.stream().filter(p -> { | |||
if (Objects.nonNull(p.getBaseProjSetProg()) && Lists.newArrayList(GovProjectStatusEnum.APPROVED.getCode(), | |||
GovProjectStatusEnum.PURCHASED.getCode(), GovProjectStatusEnum.HAS_PRE_INS.getCode(), | |||
GovProjectStatusEnum.HAS_FINAL_INS.getCode()).contains(p.getBaseProjSetProg())) { | |||
return Boolean.TRUE; | |||
} | |||
return Boolean.FALSE; | |||
}).collect(Collectors.toList()).size(); | |||
}).count(); | |||
BigDecimal approvalAmount = projects.stream().filter(p -> { | |||
if(Objects.nonNull(p.getApprovalAmount())){ | |||
if (Objects.nonNull(p.getApprovalAmount())) { | |||
return Boolean.TRUE; | |||
} | |||
return Boolean.FALSE; | |||
}).map(Project::getApprovalAmount).reduce(BigDecimal::add).get(); | |||
}).map(Project::getApprovalAmount).reduce(BigDecimal::add).orElse(BigDecimal.ZERO); | |||
BigDecimal approvalAmountGov = approves.stream().filter(a -> { | |||
if(Objects.nonNull(a.getBaseInitialReviewTotalMoney())){ | |||
return Boolean.TRUE; | |||
} | |||
return Boolean.FALSE; | |||
}).map(GovBizProjectApprove::getBaseInitialReviewTotalMoney).reduce(BigDecimal::add).get(); | |||
BigDecimal approvalAmountGov = approves.stream() | |||
.map(GovBizProjectApprove::getBaseInitialReviewTotalMoney) | |||
.filter(Objects::nonNull) | |||
.reduce(BigDecimal::add) | |||
.orElse(BigDecimal.ZERO); | |||
cockpitStats.setTopApprovalProjectsNum(approvalNumDeclared + approvalNumGov); | |||
cockpitStats.setTopApprovalProjectsAmount(approvalAmount.add(approvalAmountGov)); | |||
@@ -488,158 +488,157 @@ public class CockpitStatsStatisticsTask { | |||
OptionalDouble od = Stream.concat(projects.stream().map(Project::getBuildCycle), | |||
applies.stream().map(GovBizProjectApply::getBaseProjDuration)).mapToInt(c -> { | |||
try { | |||
Integer buildCycle = Integer.valueOf(c); | |||
return buildCycle; | |||
return Integer.parseInt(c); | |||
} catch (Exception e) { | |||
return 0; | |||
} | |||
}).average(); | |||
Double average = od.isPresent() ? od.getAsDouble() : 0.0; | |||
cockpitStats.setTopAverageConstructionPeriod(average.intValue()); | |||
double average = od.isPresent() ? od.getAsDouble() : 0.0; | |||
cockpitStats.setTopAverageConstructionPeriod((int) average); | |||
//3.4 在建项目数 采购备案后的项目 | |||
Integer contructionNum = projects.stream().filter(p -> { | |||
if(Objects.nonNull(p.getStatus()) && | |||
Integer constructionNum = (int) projects.stream().filter(p -> { | |||
if (Objects.nonNull(p.getStatus()) && | |||
p.getStatus().compareTo(ProjectStatusEnum.TO_BE_PURCHASED.getCode()) >= 0 | |||
&& p.getStatus().compareTo(ProjectStatusEnum.ACCEPTED.getCode()) < 0){ | |||
&& p.getStatus().compareTo(ProjectStatusEnum.ACCEPTED.getCode()) < 0) { | |||
return Boolean.TRUE; | |||
} | |||
return Boolean.FALSE; | |||
}).collect(Collectors.toList()).size(); | |||
Integer contructionNumGov = baseInfos.stream().filter(b -> { | |||
if(Objects.nonNull(b.getBaseProjSetProg()) && | |||
Lists.newArrayList(GovProjectStatusEnum.PURCHASED.getCode(),GovProjectStatusEnum.HAS_PRE_INS.getCode()).contains(b.getBaseProjSetProg())){ | |||
}).count(); | |||
Integer constructionNumGov = (int) baseInfos.stream().filter(b -> { | |||
if (Objects.nonNull(b.getBaseProjSetProg()) && | |||
Lists.newArrayList(GovProjectStatusEnum.PURCHASED.getCode(), GovProjectStatusEnum.HAS_PRE_INS.getCode()).contains(b.getBaseProjSetProg())) { | |||
return Boolean.TRUE; | |||
} | |||
return Boolean.FALSE; | |||
}).collect(Collectors.toList()).size(); | |||
cockpitStats.setTopOngoingProjectsNum(contructionNum + contructionNumGov); | |||
}).count(); | |||
cockpitStats.setTopOngoingProjectsNum(constructionNum + constructionNumGov); | |||
//4.地图 只要放总数 取的时候 会有逻辑(也要取项目归集) | |||
cockpitStats.setProjectsTotal(projects.size() + baseInfos.size()); | |||
//5.下面项目状态数 | |||
//5.1 计划(申报项目:项目预审完成到年度计划未完成 项目归集:评审中) | |||
Integer inPlanNum = projects.stream().filter(p -> { | |||
if(Objects.nonNull(p.getStatus()) && | |||
Integer inPlanNum = (int) projects.stream().filter(p -> { | |||
if (Objects.nonNull(p.getStatus()) && | |||
p.getStatus().compareTo(ProjectStatusEnum.PREQUALIFICATION_FAILED.getCode()) > 0 && | |||
p.getStatus().compareTo(ProjectStatusEnum.IN_THE_ANNUAL_PLAN.getCode()) <= 0){ | |||
p.getStatus().compareTo(ProjectStatusEnum.IN_THE_ANNUAL_PLAN.getCode()) <= 0) { | |||
return Boolean.TRUE; | |||
} | |||
return Boolean.FALSE; | |||
}).collect(Collectors.toList()).size(); | |||
Integer inPlanNumGov = baseInfos.stream().filter(p -> { | |||
if(Objects.nonNull(p.getBaseProjSetProg()) && | |||
p.getBaseProjSetProg().equals(GovProjectStatusEnum.APPROVAL.getCode())){ | |||
}).count(); | |||
Integer inPlanNumGov = (int) baseInfos.stream().filter(p -> { | |||
if (Objects.nonNull(p.getBaseProjSetProg()) && | |||
p.getBaseProjSetProg().equals(GovProjectStatusEnum.APPROVAL.getCode())) { | |||
return Boolean.TRUE; | |||
} | |||
return Boolean.FALSE; | |||
}).collect(Collectors.toList()).size(); | |||
}).count(); | |||
cockpitStats.setProjectsTotalPlan(inPlanNum + inPlanNumGov); | |||
//5.2 处于申报(申报项目:年度计划完成到建设方案审批第一个节点审批未通过前 项目归集:待立项) | |||
Integer inApplyNum = projects.stream().filter(p -> { | |||
if(Objects.nonNull(p.getStatus()) && | |||
Integer inApplyNum = (int) projects.stream().filter(p -> { | |||
if (Objects.nonNull(p.getStatus()) && | |||
(ProjectStatusEnum.PLAN_TO_BE_DECLARED.getCode().equals(p.getStatus()) || | |||
(ProjectStatusEnum.SCHEME_UNDER_REVIEW.getCode().equals(p.getStatus()) && | |||
searchSchemaReviewFlow(p.getProjectCode())))){ | |||
searchSchemaReviewFlow(p.getProjectCode())))) { | |||
return Boolean.TRUE; | |||
} | |||
return Boolean.FALSE; | |||
}).collect(Collectors.toList()).size(); | |||
Integer inApplyNumGov = baseInfos.stream().filter(p -> { | |||
if(Objects.nonNull(p.getBaseProjSetProg()) && | |||
p.getBaseProjSetProg().equals(GovProjectStatusEnum.PENDING.getCode())){ | |||
}).count(); | |||
Integer inApplyNumGov = (int) baseInfos.stream().filter(p -> { | |||
if (Objects.nonNull(p.getBaseProjSetProg()) && | |||
p.getBaseProjSetProg().equals(GovProjectStatusEnum.PENDING.getCode())) { | |||
return Boolean.TRUE; | |||
} | |||
return Boolean.FALSE; | |||
}).collect(Collectors.toList()).size(); | |||
}).count(); | |||
cockpitStats.setProjectsTotalApply(inApplyNum + inApplyNumGov); | |||
//5.3 处于审批 (申报项目:建设方案审批第一个节点审批通过到立项批复未完成 项目归集:已立项) | |||
Integer inApproveNum = projects.stream().filter(p -> { | |||
if(Objects.nonNull(p.getStatus()) && | |||
Integer inApproveNum = (int) projects.stream().filter(p -> { | |||
if (Objects.nonNull(p.getStatus()) && | |||
(ProjectStatusEnum.TO_BE_APPROVED.getCode().equals(p.getStatus()) || | |||
p.getStatus().compareTo(ProjectStatusEnum.APPROVED_AFTER_CHOICE.getCode()) > 0 || | |||
(ProjectStatusEnum.SCHEME_UNDER_REVIEW.getCode().equals(p.getStatus()) && | |||
searchSchemaReviewedFlow(p.getProjectCode())))){ | |||
searchSchemaReviewedFlow(p.getProjectCode())))) { | |||
return Boolean.TRUE; | |||
} | |||
return Boolean.FALSE; | |||
}).collect(Collectors.toList()).size(); | |||
Integer inApproveNumGov = baseInfos.stream().filter(p -> { | |||
if(Objects.nonNull(p.getBaseProjSetProg()) && | |||
p.getBaseProjSetProg().equals(GovProjectStatusEnum.APPROVED.getCode())){ | |||
}).count(); | |||
Integer inApproveNumGov = (int) baseInfos.stream().filter(p -> { | |||
if (Objects.nonNull(p.getBaseProjSetProg()) && | |||
p.getBaseProjSetProg().equals(GovProjectStatusEnum.APPROVED.getCode())) { | |||
return Boolean.TRUE; | |||
} | |||
return Boolean.FALSE; | |||
}).collect(Collectors.toList()).size(); | |||
}).count(); | |||
cockpitStats.setProjectsTotalApprove(inApproveNum + inApproveNumGov); | |||
//5.4 建设 (申报项目:立项批复完成到项目初验未完成 项目归集:已采购) | |||
Integer inConstructionNum = projects.stream().filter(p -> { | |||
if(Objects.nonNull(p.getStatus()) && | |||
Integer inConstructionNum = (int) projects.stream().filter(p -> { | |||
if (Objects.nonNull(p.getStatus()) && | |||
(p.getStatus().compareTo(ProjectStatusEnum.APPROVED_AFTER_CHOICE.getCode()) > 0 && | |||
p.getStatus().compareTo(ProjectStatusEnum.UNDER_CONSTRUCTION.getCode()) < 0) || | |||
//如果在建设中 那么初验材料为空代表 初验未完成 | |||
(p.getStatus().equals(ProjectStatusEnum.UNDER_CONSTRUCTION.getCode()) && | |||
StringUtils.isBlank(p.getPreliminaryInspectionMaterials()))){ | |||
StringUtils.isBlank(p.getPreliminaryInspectionMaterials()))) { | |||
return Boolean.TRUE; | |||
} | |||
return Boolean.FALSE; | |||
}).collect(Collectors.toList()).size(); | |||
Integer inConstructionNumGov = baseInfos.stream().filter(p -> { | |||
if(Objects.nonNull(p.getBaseProjSetProg()) && | |||
p.getBaseProjSetProg().equals(GovProjectStatusEnum.PURCHASED.getCode())){ | |||
}).count(); | |||
Integer inConstructionNumGov = (int) baseInfos.stream().filter(p -> { | |||
if (Objects.nonNull(p.getBaseProjSetProg()) && | |||
p.getBaseProjSetProg().equals(GovProjectStatusEnum.PURCHASED.getCode())) { | |||
return Boolean.TRUE; | |||
} | |||
return Boolean.FALSE; | |||
}).collect(Collectors.toList()).size(); | |||
}).count(); | |||
cockpitStats.setProjectsTotalConstruction(inConstructionNum + inConstructionNumGov); | |||
//5.5 验收 (申报项目:项目初验完成到项目终验未完成 项目归集:已初验) | |||
List<Project> inAccpetProjects = projects.stream().filter(p -> { | |||
if(Objects.nonNull(p.getStatus()) && | |||
List<Project> inAcceptProjects = projects.stream().filter(p -> { | |||
if (Objects.nonNull(p.getStatus()) && | |||
p.getStatus().compareTo(ProjectStatusEnum.UNDER_CONSTRUCTION.getCode()) > 0 && | |||
p.getStatus().compareTo(ProjectStatusEnum.ACCEPTED.getCode()) < 0 || | |||
//如果在建设中 那么初验材料不为空代表 初验完成 | |||
(p.getStatus().equals(ProjectStatusEnum.UNDER_CONSTRUCTION.getCode()) && | |||
StringUtils.isNotBlank(p.getPreliminaryInspectionMaterials()))){ | |||
StringUtils.isNotBlank(p.getPreliminaryInspectionMaterials()))) { | |||
return Boolean.TRUE; | |||
} | |||
return Boolean.FALSE; | |||
}).collect(Collectors.toList()); | |||
List<GovBizProjectBaseinfo> inAccpetProjectsGov = baseInfos.stream().filter(b -> { | |||
if(Objects.nonNull(b.getBaseProjSetProg()) && | |||
b.getBaseProjSetProg().equals(GovProjectStatusEnum.HAS_PRE_INS.getCode())){ | |||
List<GovBizProjectBaseinfo> inAcceptProjectsGov = baseInfos.stream().filter(b -> { | |||
if (Objects.nonNull(b.getBaseProjSetProg()) && | |||
b.getBaseProjSetProg().equals(GovProjectStatusEnum.HAS_PRE_INS.getCode())) { | |||
return Boolean.TRUE; | |||
} | |||
return Boolean.FALSE; | |||
}).collect(Collectors.toList()); | |||
cockpitStats.setProjectsTotalAccept(inAccpetProjects.size() + inAccpetProjectsGov.size()); | |||
cockpitStats.setProjectsTotalAccept(inAcceptProjects.size() + inAcceptProjectsGov.size()); | |||
//5.6 运维(申报项目:项目验收完成后且项目未注销 项目归集:已终验) | |||
List<Project> inOperationProjects = projects.stream().filter(p -> { | |||
if(Objects.nonNull(p.getStatus()) && | |||
p.getStatus().equals(ProjectStatusEnum.ACCEPTED.getCode())){ | |||
if (Objects.nonNull(p.getStatus()) && | |||
p.getStatus().equals(ProjectStatusEnum.ACCEPTED.getCode())) { | |||
return Boolean.TRUE; | |||
} | |||
return Boolean.FALSE; | |||
}).collect(Collectors.toList()); | |||
Integer inOperationProjectsGov = baseInfos.stream().filter(b -> { | |||
if(Objects.nonNull(b.getBaseProjSetProg()) && | |||
b.getBaseProjSetProg().equals(GovProjectStatusEnum.HAS_FINAL_INS.getCode())){ | |||
int inOperationProjectsGov = (int) baseInfos.stream().filter(b -> { | |||
if (Objects.nonNull(b.getBaseProjSetProg()) && | |||
b.getBaseProjSetProg().equals(GovProjectStatusEnum.HAS_FINAL_INS.getCode())) { | |||
return Boolean.TRUE; | |||
} | |||
return Boolean.FALSE; | |||
}).collect(Collectors.toList()).size(); | |||
}).count(); | |||
cockpitStats.setProjectsTotalOperation(inOperationProjects.size() + inOperationProjectsGov); | |||
//5.7 绩效(申报项目:项目验收完成后且未完成绩效自评 项目归集:无) | |||
List<String> inAccpetCodes = inOperationProjects.stream().map(Project::getProjectCode).collect(Collectors.toList()); | |||
List<String> inAcceptCodes = inOperationProjects.stream().map(Project::getProjectCode).collect(Collectors.toList()); | |||
List<PerformanceAppraisalProject> performances = performanceAppraisalProjectService.list(Wrappers.lambdaQuery(PerformanceAppraisalProject.class) | |||
.in(CollUtil.isNotEmpty(inAccpetCodes),PerformanceAppraisalProject::getProjectCode, inAccpetCodes) | |||
.in(CollUtil.isEmpty(inAccpetCodes),PerformanceAppraisalProject::getProjectCode, Lists.newArrayList("NONE")) | |||
.eq(PerformanceAppraisalProject::getIsReAppraisal,Boolean.TRUE) | |||
.in(CollUtil.isNotEmpty(inAcceptCodes), PerformanceAppraisalProject::getProjectCode, inAcceptCodes) | |||
.in(CollUtil.isEmpty(inAcceptCodes), PerformanceAppraisalProject::getProjectCode, Lists.newArrayList("NONE")) | |||
.eq(PerformanceAppraisalProject::getIsReAppraisal, Boolean.TRUE) | |||
.isNull(PerformanceAppraisalProject::getReAppraisalTotalScore) | |||
); | |||
cockpitStats.setProjectsTotalPerformance(performances.size()); | |||
@@ -664,7 +663,7 @@ public class CockpitStatsStatisticsTask { | |||
return p.getDeclareAmount(); | |||
} | |||
return BigDecimal.ZERO; | |||
}).reduce(BigDecimal::add).get(); | |||
}).reduce(BigDecimal::add).orElse(BigDecimal.ZERO); | |||
cockpitStats.setRejectSavingsFunds(rejectPreSum); | |||
//7.3 柱状图 | |||
@@ -681,30 +680,21 @@ public class CockpitStatsStatisticsTask { | |||
//申报的申报金额(申报项目:初步方案申报金额 项目归集:项目总投资) | |||
final BigDecimal[] declaredAmountApprove = {BigDecimal.ZERO}; | |||
normalProjects.stream().map(p -> { | |||
BigDecimal declareAmount = Objects.nonNull(p.getDeclareAmount()) ? | |||
p.getDeclareAmount() : BigDecimal.ZERO; | |||
return declareAmount; | |||
}).reduce(BigDecimal::add).ifPresent(b -> declaredAmountApprove[0] = b); | |||
normalProjects.stream().map(p -> ObjectUtil.defaultIfNull(p.getDeclareAmount(), BigDecimal.ZERO)) | |||
.reduce(BigDecimal::add).ifPresent(b -> declaredAmountApprove[0] = b); | |||
final BigDecimal[] declaredAmountApproveGov = {BigDecimal.ZERO}; | |||
applies.stream().map(g -> { | |||
BigDecimal totalAmount = Objects.nonNull(g.getBaseProjTotalAmount()) ? g.getBaseProjTotalAmount() : BigDecimal.ZERO; | |||
return totalAmount; | |||
}).reduce(BigDecimal::add).ifPresent(b -> declaredAmountApproveGov[0] = b); | |||
applies.stream().map(g -> ObjectUtil.defaultIfNull(g.getBaseProjTotalAmount(), BigDecimal.ZERO)) | |||
.reduce(BigDecimal::add).ifPresent(b -> declaredAmountApproveGov[0] = b); | |||
BigDecimal declaredAmountApproveTotal = declaredAmountApprove[0].add(declaredAmountApproveGov[0]); | |||
cockpitStats.setDeclaredAmountApprove(declaredAmountApproveTotal); | |||
//申报的批复金额(申报项目:建设方案申报金额 项目归集:建议总投资) | |||
final BigDecimal[] approvalAmountApprove = {BigDecimal.ZERO}; | |||
normalProjects.stream().map(p -> { | |||
BigDecimal declareAmount = Objects.nonNull(p.getApprovalAmount()) ? p.getApprovalAmount() : BigDecimal.ZERO; | |||
return declareAmount; | |||
}).reduce(BigDecimal::add).ifPresent(b -> approvalAmountApprove[0] = b); | |||
normalProjects.stream().map(p -> ObjectUtil.defaultIfNull(p.getApprovalAmount(), BigDecimal.ZERO)) | |||
.reduce(BigDecimal::add).ifPresent(b -> approvalAmountApprove[0] = b); | |||
final BigDecimal[] approvalAmountApproveGov = {BigDecimal.ZERO}; | |||
approves.stream().map(p -> { | |||
BigDecimal expertTotalMoney = Objects.nonNull(p.getBaseExpertTotalMoney()) ? p.getBaseExpertTotalMoney() : BigDecimal.ZERO; | |||
return expertTotalMoney; | |||
}).reduce(BigDecimal::add).ifPresent(b -> approvalAmountApproveGov[0] = b); | |||
approves.stream().map(p -> ObjectUtil.defaultIfNull(p.getBaseExpertTotalMoney(), BigDecimal.ZERO)) | |||
.reduce(BigDecimal::add).ifPresent(b -> approvalAmountApproveGov[0] = b); | |||
BigDecimal approvalAmountApproveTotal = approvalAmountApprove[0].add(approvalAmountApproveGov[0]); | |||
cockpitStats.setApprovalAmountApprove(approvalAmountApproveTotal); | |||
//申报的差额 | |||
@@ -716,15 +706,11 @@ public class CockpitStatsStatisticsTask { | |||
//批复的批复金额(申报项目:归集信息建议批复总投资 项目归集:建议批复总投资) | |||
final BigDecimal[] approvalAmountApproval = {BigDecimal.ZERO}; | |||
normalProjects.stream().map(p -> { | |||
BigDecimal proposeTotalInvest = Objects.nonNull(p.getProposeTotalInvest()) ? p.getProposeTotalInvest() : BigDecimal.ZERO; | |||
return proposeTotalInvest; | |||
}).reduce(BigDecimal::add).ifPresent(b -> approvalAmountApproval[0] = b); | |||
normalProjects.stream().map(p -> ObjectUtil.defaultIfNull(p.getProposeTotalInvest(), BigDecimal.ZERO)) | |||
.reduce(BigDecimal::add).ifPresent(b -> approvalAmountApproval[0] = b); | |||
final BigDecimal[] approvalAmountApprovalGov = {BigDecimal.ZERO}; | |||
approves.stream().map(p -> { | |||
BigDecimal reviewTotalMoney = Objects.nonNull(p.getBaseInitialReviewTotalMoney()) ? p.getBaseInitialReviewTotalMoney() : BigDecimal.ZERO; | |||
return reviewTotalMoney; | |||
}).reduce(BigDecimal::add).ifPresent(b -> approvalAmountApprovalGov[0] = b); | |||
approves.stream().map(p -> ObjectUtil.defaultIfNull(p.getBaseInitialReviewTotalMoney(), BigDecimal.ZERO)) | |||
.reduce(BigDecimal::add).ifPresent(b -> approvalAmountApprovalGov[0] = b); | |||
BigDecimal approvalAmountApprovalTotal = approvalAmountApproval[0].add(approvalAmountApprovalGov[0]); | |||
cockpitStats.setApprovalAmountApproval(approvalAmountApprovalTotal); | |||
@@ -737,16 +723,12 @@ public class CockpitStatsStatisticsTask { | |||
//合同的批复金额(申报项目:成交金额 项目归集:成交金额) | |||
final BigDecimal[] approvalAmountContract = {BigDecimal.ZERO}; | |||
normalProjects.stream().map(p -> { | |||
BigDecimal transactionAmount = Objects.nonNull(p.getTransactionAmount()) ? p.getTransactionAmount() : BigDecimal.ZERO; | |||
return transactionAmount; | |||
}).reduce(BigDecimal::add).ifPresent(b -> approvalAmountContract[0] = b); | |||
normalProjects.stream().map(p -> Objects.nonNull(p.getTransactionAmount()) ? p.getTransactionAmount() : BigDecimal.ZERO) | |||
.reduce(BigDecimal::add).ifPresent(b -> approvalAmountContract[0] = b); | |||
final BigDecimal[] approvalAmountContractGov = {BigDecimal.ZERO}; | |||
procures.stream().map(p -> { | |||
BigDecimal purchaseAmount = Objects.nonNull(p.getBaseProjPurchaseAmount()) ? | |||
p.getBaseProjPurchaseAmount() : BigDecimal.ZERO; | |||
return purchaseAmount; | |||
}).reduce(BigDecimal::add).ifPresent(b -> approvalAmountContractGov[0] = b); | |||
procures.stream().map(p -> Objects.nonNull(p.getBaseProjPurchaseAmount()) ? | |||
p.getBaseProjPurchaseAmount() : BigDecimal.ZERO).reduce(BigDecimal::add) | |||
.ifPresent(b -> approvalAmountContractGov[0] = b); | |||
BigDecimal approvalAmountContractTotal = approvalAmountContract[0].add(approvalAmountContractGov[0]); | |||
cockpitStats.setApprovalAmountContract(approvalAmountContractTotal); | |||
@@ -765,7 +747,7 @@ public class CockpitStatsStatisticsTask { | |||
//9.绩效 | |||
List<String> projectCodes = projects.stream().map(Project::getProjectCode).collect(Collectors.toList()); | |||
if(CollUtil.isNotEmpty(projectCodes)){ | |||
if (CollUtil.isNotEmpty(projectCodes)) { | |||
List<PerformanceAppraisalProject> performanceAll = performanceAppraisalProjectService.list(Wrappers.lambdaQuery(PerformanceAppraisalProject.class) | |||
.in(PerformanceAppraisalProject::getProjectCode, projectCodes)); | |||
List<PerformanceAppraisalProject> verified = performanceAll.stream().filter(p -> { | |||
@@ -836,12 +818,13 @@ public class CockpitStatsStatisticsTask { | |||
/** | |||
* 建设方案申报了 但未开始审核的项目 | |||
* | |||
* @param projectCode | |||
* @return | |||
*/ | |||
private boolean searchSchemaReviewFlow(String projectCode) { | |||
Project project = projectService.getProjectByCode(projectCode); | |||
if(Objects.isNull(project)){ | |||
if (Objects.isNull(project)) { | |||
return Boolean.FALSE; | |||
} | |||
List<Long> allVersionProjectId = projectService.getAllVersionProjectId(project); | |||
@@ -849,7 +832,7 @@ public class CockpitStatsStatisticsTask { | |||
.in(ProjectInst::getProjectId, allVersionProjectId) | |||
.eq(ProjectInst::getInstType, InstTypeEnum.CONSTRUCTION_PLAN_REVIEW.getCode()) | |||
.last(BizConst.LIMIT_1)); | |||
if(Objects.isNull(pi)){ | |||
if (Objects.isNull(pi)) { | |||
return Boolean.FALSE; | |||
} | |||
String instCode = pi.getInstCode(); | |||
@@ -866,15 +849,16 @@ public class CockpitStatsStatisticsTask { | |||
.asc() | |||
.list(); | |||
//已经完成的没有 未完成的有 则可计算 | |||
if(CollUtil.isNotEmpty(unfinished) && CollUtil.isEmpty(finished)){ | |||
if (CollUtil.isNotEmpty(unfinished) && CollUtil.isEmpty(finished)) { | |||
return Boolean.TRUE; | |||
} | |||
return Boolean.FALSE; | |||
} | |||
//已经开始审批 | |||
private boolean searchSchemaReviewedFlow(String projectCode) { | |||
Project project = projectService.getProjectByCode(projectCode); | |||
if(Objects.isNull(project)){ | |||
if (Objects.isNull(project)) { | |||
return Boolean.FALSE; | |||
} | |||
List<Long> allVersionProjectId = projectService.getAllVersionProjectId(project); | |||
@@ -882,7 +866,7 @@ public class CockpitStatsStatisticsTask { | |||
.in(ProjectInst::getProjectId, allVersionProjectId) | |||
.eq(ProjectInst::getInstType, InstTypeEnum.CONSTRUCTION_PLAN_REVIEW.getCode()) | |||
.last(BizConst.LIMIT_1)); | |||
if(Objects.isNull(pi)){ | |||
if (Objects.isNull(pi)) { | |||
return Boolean.FALSE; | |||
} | |||
String instCode = pi.getInstCode(); | |||
@@ -893,7 +877,7 @@ public class CockpitStatsStatisticsTask { | |||
.asc() | |||
.list(); | |||
//已经完成的 则可计算 | |||
if(CollUtil.isNotEmpty(finished)){ | |||
if (CollUtil.isNotEmpty(finished)) { | |||
return Boolean.TRUE; | |||
} | |||
return Boolean.FALSE; | |||
@@ -901,6 +885,7 @@ public class CockpitStatsStatisticsTask { | |||
/** | |||
* 计算环节滞后项目 | |||
* | |||
* @param projects | |||
* @return | |||
*/ | |||
@@ -908,18 +893,18 @@ public class CockpitStatsStatisticsTask { | |||
List<String> projectCodes = projects.stream().map(Project::getProjectCode).collect(Collectors.toList()); | |||
Map<String, Project> map = projects.stream().collect(Collectors.toMap(Project::getProjectCode, p -> p)); | |||
List<WflowEarlyWarningRecords> records = Lists.newArrayList(); | |||
if(CollUtil.isNotEmpty(projectCodes)){ | |||
if (CollUtil.isNotEmpty(projectCodes)) { | |||
records = earlyWarningRecordsService.list(Wrappers.lambdaQuery(WflowEarlyWarningRecords.class) | |||
.in(WflowEarlyWarningRecords::getProjectCode, projectCodes)); | |||
} | |||
return records.stream().mapToInt(r -> { | |||
if(!map.containsKey(r.getProjectCode())){ | |||
if (!map.containsKey(r.getProjectCode())) { | |||
return 0; | |||
} | |||
Project project = map.get(r.getProjectCode()); | |||
//如果状态 相等 说明预警了 但是没处理 +1 | |||
if(Objects.nonNull(project.getStatus()) && Objects.nonNull(r.getProjectStatus()) && | |||
project.getStatus().equals(r.getProjectStatus())){ | |||
if (Objects.nonNull(project.getStatus()) && Objects.nonNull(r.getProjectStatus()) && | |||
project.getStatus().equals(r.getProjectStatus())) { | |||
return 1; | |||
} | |||
return 0; | |||
@@ -927,7 +912,7 @@ public class CockpitStatsStatisticsTask { | |||
} | |||
private void buildMonitorRise(CockpitStats cockpitStats, CockpitStats thisYearData, CockpitStats lastYearData) { | |||
if(Objects.isNull(thisYearData) || Objects.isNull(lastYearData)){ | |||
if (Objects.isNull(thisYearData) || Objects.isNull(lastYearData)) { | |||
return; | |||
} | |||
cockpitStats.setMonitorOverdueConstructionProjectsRise(BizUtils.computeRise(thisYearData.getMonitorOverdueConstructionProjectsNum(), | |||
@@ -1,133 +0,0 @@ | |||
package com.hz.pm.api.scheduler.task; | |||
import cn.hutool.core.bean.BeanUtil; | |||
import cn.hutool.core.collection.CollectionUtil; | |||
import cn.hutool.core.io.FileUtil; | |||
import cn.hutool.core.io.file.FileReader; | |||
import cn.hutool.core.io.file.FileWriter; | |||
import cn.hutool.core.lang.UUID; | |||
import cn.hutool.json.JSONUtil; | |||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | |||
import com.baomidou.mybatisplus.core.toolkit.Wrappers; | |||
import com.ningdatech.log.mapper.OptLogMapper; | |||
import com.ningdatech.log.model.domain.OptLog; | |||
import com.hz.pm.api.common.model.constant.BizConst; | |||
import com.hz.pm.api.common.model.constant.RegionConst; | |||
import com.hz.pm.api.organization.mapper.DingEmployeeInfoMapper; | |||
import com.hz.pm.api.organization.model.entity.DingEmployeeInfo; | |||
import com.hz.pm.api.scheduler.task.model.CommonLog; | |||
import com.hz.pm.api.user.model.entity.UserInfo; | |||
import com.hz.pm.api.user.service.IUserInfoService; | |||
import lombok.RequiredArgsConstructor; | |||
import org.apache.commons.lang3.StringUtils; | |||
import org.springframework.beans.factory.annotation.Value; | |||
import org.springframework.scheduling.annotation.Scheduled; | |||
import org.springframework.stereotype.Component; | |||
import java.net.InetAddress; | |||
import java.net.UnknownHostException; | |||
import java.time.LocalDateTime; | |||
import java.time.format.DateTimeFormatter; | |||
import java.util.List; | |||
/** | |||
* 通用日志写入任务 | |||
* @author liushuai | |||
*/ | |||
@Component | |||
@RequiredArgsConstructor | |||
public class CommonLogTask { | |||
private final OptLogMapper optLogMapper; | |||
private final IUserInfoService userInfoService; | |||
private final DingEmployeeInfoMapper dingEmployeeInfoMapper; | |||
/** | |||
* 日志记录文件位置 | |||
*/ | |||
private final static String LOG_RECORD_ADDRESS = "/opt/log/"; | |||
private final static String LOG_ID_FILE = "logId.txt"; | |||
private final static String LOG_FILE = "common_log_"; | |||
@Value("${hostname}") | |||
private String HOST_NAME; | |||
@Scheduled(fixedDelay = 120000) | |||
public void writeLog() throws UnknownHostException { | |||
// | |||
if (!HOST_NAME.equals(InetAddress.getLocalHost().getHostName())) { | |||
return; | |||
} | |||
//获取记录ID文件 | |||
boolean idFileExist = FileUtil.exist(LOG_RECORD_ADDRESS + LOG_ID_FILE); | |||
if (!idFileExist){ | |||
FileUtil.touch(LOG_RECORD_ADDRESS + LOG_ID_FILE); | |||
} | |||
FileReader fileReader = new FileReader(LOG_RECORD_ADDRESS + LOG_ID_FILE); | |||
String result = fileReader.readString(); | |||
long startLogId = 0L; | |||
if (StringUtils.isNotBlank(result)){ | |||
startLogId = Long.parseLong(result); | |||
} | |||
LambdaQueryWrapper<OptLog> query = Wrappers.lambdaQuery(OptLog.class).gt(OptLog::getId,startLogId); | |||
//查询日志 | |||
List<OptLog> logList = optLogMapper.selectList(query); | |||
DateTimeFormatter df = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"); | |||
if (CollectionUtil.isNotEmpty(logList)){ | |||
for (OptLog optLog : logList){ | |||
CommonLog commonLog = new CommonLog(); | |||
UserInfo userInfo = userInfoService.getById(optLog.getCreateBy()); | |||
if (userInfo == null){ | |||
continue; | |||
} | |||
String employeeCode = userInfo.getEmployeeCode(); | |||
if (StringUtils.isNotBlank(employeeCode)){ | |||
DingEmployeeInfo dingEmployeeInfo = dingEmployeeInfoMapper.selectOne(new LambdaQueryWrapper<DingEmployeeInfo>() | |||
.eq(DingEmployeeInfo::getEmployeeCode,employeeCode) | |||
.last(BizConst.LIMIT_1)); | |||
if (dingEmployeeInfo != null){ | |||
commonLog.setUserId(String.valueOf(dingEmployeeInfo.getAccountId())); | |||
} | |||
}else { | |||
commonLog.setUserId(String.valueOf(userInfo.getId())); | |||
} | |||
commonLog.setUserRole("政府工作人员"); | |||
commonLog.setAreaCode(userInfo.getRegionCode() + RegionConst.NINE_CODE_LAST); | |||
String description = optLog.getDescription(); | |||
if ("用户登录".equals(description)){ | |||
commonLog.setActionType(1); | |||
}else if (description.contains("退出登录")){ | |||
commonLog.setActionType(2); | |||
}else { | |||
commonLog.setActionType(3); | |||
} | |||
String actionId = UUID.randomUUID().toString(); | |||
commonLog.setActionId(actionId); | |||
commonLog.setActionTime(df.format(optLog.getStartTime())); | |||
commonLog.setActionDuration(optLog.getConsumingTime()); | |||
commonLog.setActionStatus(0); | |||
commonLog.setAppCode("A331101453557202109017383"); | |||
//判断当天日志文件是否存在 | |||
DateTimeFormatter dfNow = DateTimeFormatter.ofPattern("yyyyMMdd"); | |||
String fileName = LOG_RECORD_ADDRESS + LOG_FILE + dfNow.format(LocalDateTime.now()) + ".log"; | |||
boolean fileExist = FileUtil.exist(fileName); | |||
if (!fileExist){ | |||
//不存在则创建当天日志文件 | |||
FileUtil.touch(fileName); | |||
} | |||
//写入通用规则 | |||
FileWriter writer = new FileWriter(fileName); | |||
writer.append(JSONUtil.toJsonStr(commonLog)); | |||
writer.append("\n"); | |||
if (commonLog.getActionType() == 3){ | |||
CommonLog commonLogEnd = new CommonLog(); | |||
BeanUtil.copyProperties(commonLog,commonLogEnd); | |||
commonLogEnd.setActionType(4); | |||
writer.append(JSONUtil.toJsonStr(commonLogEnd)); | |||
writer.append("\n"); | |||
} | |||
} | |||
//记录最后一个节点位置 | |||
FileWriter writer = new FileWriter(LOG_RECORD_ADDRESS + LOG_ID_FILE); | |||
writer.write(String.valueOf(logList.get(logList.size() - 1).getId())); | |||
} | |||
} | |||
} |
@@ -8,16 +8,15 @@ import com.alibaba.fastjson.JSONObject; | |||
import com.baomidou.mybatisplus.core.toolkit.Wrappers; | |||
import com.google.common.collect.Lists; | |||
import com.google.common.collect.Maps; | |||
import com.hz.pm.api.projectlib.model.enumeration.*; | |||
import com.ningdatech.basic.util.StrPool; | |||
import com.hz.pm.api.common.model.constant.BizConst; | |||
import com.hz.pm.api.common.enumeration.CommonEnum; | |||
import com.hz.pm.api.common.model.constant.BizConst; | |||
import com.hz.pm.api.projectdeclared.model.entity.Contract; | |||
import com.hz.pm.api.projectdeclared.model.entity.Operation; | |||
import com.hz.pm.api.projectdeclared.service.IContractService; | |||
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.ProjectRenewalFundDeclaration; | |||
import com.hz.pm.api.projectlib.model.enumeration.*; | |||
import com.hz.pm.api.projectlib.service.IProjectRenewalFundDeclarationService; | |||
import com.hz.pm.api.projectlib.service.IProjectService; | |||
import com.hz.pm.api.sys.manage.EarlyWarningManage; | |||
@@ -26,6 +25,7 @@ import com.hz.pm.api.sys.service.IProjectEarlyWarningService; | |||
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.StrPool; | |||
import com.wflow.bean.entity.WflowEarlyWarning; | |||
import com.wflow.enums.WarningRuleTypeEnum; | |||
import com.wflow.service.IEarlyWarningService; | |||
@@ -35,9 +35,11 @@ import org.apache.commons.lang3.StringUtils; | |||
import org.springframework.beans.factory.annotation.Value; | |||
import org.springframework.scheduling.annotation.Scheduled; | |||
import org.springframework.stereotype.Component; | |||
import java.net.InetAddress; | |||
import java.net.UnknownHostException; | |||
import java.time.*; | |||
import java.time.Duration; | |||
import java.time.LocalDateTime; | |||
import java.util.List; | |||
import java.util.Map; | |||
import java.util.Objects; | |||
@@ -87,17 +89,17 @@ public class EarlyWarningInstanceNotStartTask { | |||
// 1.查询 填报的 预警规则 填报类型的 每个区域 每个规则 | |||
List<WflowEarlyWarning> warnings = earlyWarningService.list(Wrappers.lambdaQuery(WflowEarlyWarning.class) | |||
.eq(WflowEarlyWarning::getRuleType, WarningRuleTypeEnum.DECLARED_WARNING.getCode())); | |||
for(WflowEarlyWarning warning : warnings){ | |||
for (WflowEarlyWarning warning : warnings) { | |||
//2. 取出rule的数据 | |||
if(!warning.getIsOpen()){ | |||
if (!warning.getIsOpen()) { | |||
log.info(warning.getId() + " 此规则关闭了"); | |||
continue; | |||
} | |||
String noticeMethod = warning.getNoticeMethod(); | |||
if(StringUtils.isBlank(noticeMethod) || | |||
if (StringUtils.isBlank(noticeMethod) || | |||
(!noticeMethod.contains(String.valueOf(CommonEnum.ZWDD.getCode())) && | |||
!noticeMethod.contains(String.valueOf(CommonEnum.MOBILE.getCode())))){ | |||
!noticeMethod.contains(String.valueOf(CommonEnum.MOBILE.getCode())))) { | |||
log.info("通知方式为空或者错误!"); | |||
return; | |||
} | |||
@@ -105,27 +107,27 @@ public class EarlyWarningInstanceNotStartTask { | |||
String noticeContent = warning.getNoticeContent(); | |||
String adventContent = warning.getAdventContent(); | |||
String rule = warning.getRule(); | |||
if(StringUtils.isNotBlank(rule)){ | |||
if (StringUtils.isNotBlank(rule)) { | |||
JSONArray ruleArray = JSON.parseArray(rule); | |||
if(CollUtil.isNotEmpty(ruleArray)){ | |||
if (CollUtil.isNotEmpty(ruleArray)) { | |||
ruleArray.forEach(r -> { | |||
JSONObject rJson = JSON.parseObject(JSON.toJSONString(r)); | |||
Integer time = rJson.getInteger("time"); | |||
Integer biz = rJson.getInteger("biz"); | |||
String notice = rJson.getString("notice"); | |||
Integer adventTime = rJson.getInteger("adventTime"); | |||
if((Objects.isNull(time) && Objects.isNull(adventTime)) || Objects.isNull(biz)){ | |||
log.info("规则数据 错误 :{}",rJson); | |||
if ((Objects.isNull(time) && Objects.isNull(adventTime)) || Objects.isNull(biz)) { | |||
log.info("规则数据 错误 :{}", rJson); | |||
return; | |||
} | |||
if(StringUtils.isBlank(notice)){ | |||
if (StringUtils.isBlank(notice)) { | |||
log.info("取不到提醒人配置 : " + rJson); | |||
return; | |||
} | |||
WarningFlowTypeEnum flowTypeEnum = WarningFlowTypeEnum.getByCode(biz); | |||
if(Objects.isNull(flowTypeEnum)){ | |||
if (Objects.isNull(flowTypeEnum)) { | |||
log.info("匹配不到 业务类型"); | |||
return; | |||
} | |||
@@ -139,99 +141,99 @@ public class EarlyWarningInstanceNotStartTask { | |||
List<Project> needNextProjects = projectService.list(Wrappers.lambdaQuery(Project.class) | |||
.eq(Project::getAreaCode, areaCode) | |||
.eq(Project::getNewest, Boolean.TRUE) | |||
.eq(Project::getStatus,projectStutas)); | |||
.eq(Project::getStatus, projectStutas)); | |||
Map<String,List<Integer>> noticeMap = Maps.newHashMap(); | |||
Map<String, List<Integer>> noticeMap = Maps.newHashMap(); | |||
//需要发通知的项目 | |||
List<Project> needToWaringProjects = needNextProjects.stream() | |||
.filter(p -> { | |||
//判断 当状态在 建设中的时候 是不是要初验了 | |||
if(ProjectStatusEnum.UNDER_CONSTRUCTION.getCode().equals(projectStutas)){ | |||
if (ProjectStatusEnum.UNDER_CONSTRUCTION.getCode().equals(projectStutas)) { | |||
List<Long> allVersionProjectId = projectService.getAllVersionProjectId(p); | |||
//如果合同信息提交过了 才是 待初验状态 | |||
if(StringUtils.isNotBlank(p.getPreliminaryInspectionMaterials())){ | |||
if(0L == contractService.count(Wrappers.lambdaQuery(Contract.class) | |||
.in(Contract::getProjectId, allVersionProjectId))){ | |||
if (StringUtils.isNotBlank(p.getPreliminaryInspectionMaterials())) { | |||
if (0L == contractService.count(Wrappers.lambdaQuery(Contract.class) | |||
.in(Contract::getProjectId, allVersionProjectId))) { | |||
return Boolean.FALSE; | |||
} | |||
} | |||
} | |||
List<Integer> noticeTypes = Lists.newArrayList(); | |||
if(Objects.nonNull(time) && Duration.between(p.getUpdateOn(),LocalDateTime.now()).toMinutes() >= time * 60 && //time * 60 | |||
Duration.between(p.getUpdateOn(),LocalDateTime.now()).toMinutes() <= time * 60 + 1){ //time * 60 | |||
if (Objects.nonNull(time) && Duration.between(p.getUpdateOn(), LocalDateTime.now()).toMinutes() >= time * 60 && //time * 60 | |||
Duration.between(p.getUpdateOn(), LocalDateTime.now()).toMinutes() <= time * 60 + 1) { //time * 60 | |||
noticeTypes.add(com.wflow.enums.WarningNoticeTypeEnum.OVER.getCode()); | |||
} | |||
if(Objects.nonNull(adventTime) && Duration.between(p.getUpdateOn(),LocalDateTime.now()).toMinutes() >= adventTime * 60 && //time * 60 | |||
Duration.between(p.getUpdateOn(),LocalDateTime.now()).toMinutes() <= adventTime * 60 + 1){ | |||
if (Objects.nonNull(adventTime) && Duration.between(p.getUpdateOn(), LocalDateTime.now()).toMinutes() >= adventTime * 60 && //time * 60 | |||
Duration.between(p.getUpdateOn(), LocalDateTime.now()).toMinutes() <= adventTime * 60 + 1) { | |||
noticeTypes.add(com.wflow.enums.WarningNoticeTypeEnum.ADVENT.getCode()); | |||
} | |||
if(CollUtil.isNotEmpty(noticeTypes)){ | |||
noticeMap.put(p.getProjectCode(),noticeTypes); | |||
if (CollUtil.isNotEmpty(noticeTypes)) { | |||
noticeMap.put(p.getProjectCode(), noticeTypes); | |||
//项目 填报预警 | |||
projectEarlyWarningService.earlyWarning(p, | |||
WarningRuleTypeEnum.DECLARED_WARNING.getCode(),noticeTypes); | |||
WarningRuleTypeEnum.DECLARED_WARNING.getCode(), noticeTypes); | |||
return Boolean.TRUE; | |||
} | |||
return Boolean.FALSE; | |||
}) | |||
.collect(Collectors.toList()); | |||
if(StringUtils.isBlank(noticeMethod) || | |||
if (StringUtils.isBlank(noticeMethod) || | |||
(!noticeMethod.contains(String.valueOf(CommonEnum.ZWDD.getCode())) && | |||
!noticeMethod.contains(String.valueOf(CommonEnum.MOBILE.getCode())))){ | |||
!noticeMethod.contains(String.valueOf(CommonEnum.MOBILE.getCode())))) { | |||
log.info("通知方式为空或者错误!"); | |||
return; | |||
} | |||
for(Project needToWaringProject : needToWaringProjects){ | |||
for (Project needToWaringProject : needToWaringProjects) { | |||
String username = null; | |||
String mobile = null; | |||
//去预警通知人 1.项目联系人 2.项目负责人 如果都包含 都要发 | |||
List<String> batchEmployees = Lists.newArrayList(); | |||
if(notice.contains(WarningNoticeTypeEnum.CONTACT.getCode().toString())){ | |||
if (notice.contains(WarningNoticeTypeEnum.CONTACT.getCode().toString())) { | |||
String employeeCode = null; | |||
username = needToWaringProject.getContactName(); | |||
mobile = needToWaringProject.getContactPhone(); | |||
if(StringUtils.isNotBlank(username) && StringUtils.isNotBlank(mobile)){ | |||
if (StringUtils.isNotBlank(username) && StringUtils.isNotBlank(mobile)) { | |||
UserInfo user = userInfoService.getOne(Wrappers.lambdaQuery(UserInfo.class) | |||
.eq(UserInfo::getUsername, username) | |||
.eq(UserInfo::getMobile, mobile) | |||
.last(BizConst.LIMIT_1)); | |||
if(Objects.nonNull(user)){ | |||
if (Objects.nonNull(user)) { | |||
employeeCode = user.getEmployeeCode(); | |||
} | |||
if(Objects.nonNull(employeeCode)){ | |||
if (Objects.nonNull(employeeCode)) { | |||
batchEmployees.add(employeeCode); | |||
} | |||
} | |||
} | |||
if(notice.contains(WarningNoticeTypeEnum.RESPONSIBLE.getCode().toString())){ | |||
if (notice.contains(WarningNoticeTypeEnum.RESPONSIBLE.getCode().toString())) { | |||
String employeeCode = null; | |||
username = needToWaringProject.getResponsibleMan(); | |||
mobile = needToWaringProject.getResponsibleManMobile(); | |||
if(StringUtils.isNotBlank(username) && StringUtils.isNotBlank(mobile)){ | |||
if (StringUtils.isNotBlank(username) && StringUtils.isNotBlank(mobile)) { | |||
UserInfo user = userInfoService.getOne(Wrappers.lambdaQuery(UserInfo.class) | |||
.eq(UserInfo::getUsername, username) | |||
.eq(UserInfo::getMobile, mobile) | |||
.last(BizConst.LIMIT_1)); | |||
if(Objects.nonNull(user)){ | |||
if (Objects.nonNull(user)) { | |||
employeeCode = user.getEmployeeCode(); | |||
} | |||
if(Objects.nonNull(employeeCode)){ | |||
if (Objects.nonNull(employeeCode)) { | |||
batchEmployees.add(employeeCode); | |||
} | |||
} | |||
} | |||
if(CollUtil.isNotEmpty(batchEmployees)){ | |||
String batchEmployeesStr = batchEmployees.stream().collect(Collectors.joining(StrPool.COMMA)); | |||
if(noticeMap.containsKey(needToWaringProject.getProjectCode())){ | |||
if (CollUtil.isNotEmpty(batchEmployees)) { | |||
String batchEmployeesStr = String.join(StrPool.COMMA, batchEmployees); | |||
if (noticeMap.containsKey(needToWaringProject.getProjectCode())) { | |||
List<Integer> noticeTypes = noticeMap.get(needToWaringProject.getProjectCode()); | |||
for(Integer noticeType : noticeTypes) { | |||
for (Integer noticeType : noticeTypes) { | |||
for (String employeeCode : batchEmployees) { | |||
earlyWarningManage.doEarlyWarning(noticeMethod, Objects.nonNull(noticeType) && noticeType.equals(1) ? noticeContent : adventContent, | |||
adventTime,time, biz, | |||
needToWaringProject.getUpdateOn(),employeeCode, needToWaringProject, | |||
adventTime, time, biz, | |||
needToWaringProject.getUpdateOn(), Long.valueOf(employeeCode), needToWaringProject, | |||
WarningRuleTypeEnum.DECLARED_WARNING.getCode(), noticeType, path, batchEmployeesStr, | |||
null); | |||
} | |||
@@ -261,17 +263,17 @@ public class EarlyWarningInstanceNotStartTask { | |||
// 1.查询 填报的 预警规则 填报类型的 每个区域 每个规则 | |||
List<WflowEarlyWarning> warnings = earlyWarningService.list(Wrappers.lambdaQuery(WflowEarlyWarning.class) | |||
.eq(WflowEarlyWarning::getRuleType, WarningRuleTypeEnum.OPERATION_WARNING.getCode())); | |||
for(WflowEarlyWarning warning : warnings){ | |||
for (WflowEarlyWarning warning : warnings) { | |||
//2. 取出rule的数据 | |||
if(!warning.getIsOpen()){ | |||
if (!warning.getIsOpen()) { | |||
log.info(warning.getId() + " 此规则关闭了"); | |||
continue; | |||
} | |||
String noticeMethod = warning.getNoticeMethod(); | |||
if(StringUtils.isBlank(noticeMethod) || | |||
if (StringUtils.isBlank(noticeMethod) || | |||
(!noticeMethod.contains(String.valueOf(CommonEnum.ZWDD.getCode())) && | |||
!noticeMethod.contains(String.valueOf(CommonEnum.MOBILE.getCode())))){ | |||
!noticeMethod.contains(String.valueOf(CommonEnum.MOBILE.getCode())))) { | |||
log.info("通知方式为空或者错误!"); | |||
return; | |||
} | |||
@@ -279,22 +281,22 @@ public class EarlyWarningInstanceNotStartTask { | |||
String noticeContent = warning.getNoticeContent(); | |||
String adventContent = warning.getAdventContent(); | |||
String rule = warning.getRule(); | |||
if(StringUtils.isNotBlank(rule)){ | |||
if (StringUtils.isNotBlank(rule)) { | |||
JSONArray ruleArray = JSON.parseArray(rule); | |||
if(CollUtil.isNotEmpty(ruleArray)){ | |||
if (CollUtil.isNotEmpty(ruleArray)) { | |||
ruleArray.forEach(r -> { | |||
JSONObject rJson = JSON.parseObject(JSON.toJSONString(r)); | |||
Integer time = rJson.getInteger("time"); | |||
Integer adventTime = rJson.getInteger("adventTime"); | |||
Integer biz = rJson.getInteger("biz"); | |||
String notice = rJson.getString("notice"); | |||
if((Objects.isNull(time) && Objects.isNull(adventTime)) || Objects.isNull(biz)){ | |||
log.info("规则数据 错误 :{}",rJson); | |||
if ((Objects.isNull(time) && Objects.isNull(adventTime)) || Objects.isNull(biz)) { | |||
log.info("规则数据 错误 :{}", rJson); | |||
return; | |||
} | |||
WarningOperationTypeEnum operationTypeEnum = WarningOperationTypeEnum.getByCode(biz); | |||
if(Objects.isNull(operationTypeEnum)){ | |||
if (Objects.isNull(operationTypeEnum)) { | |||
log.info("匹配不到 业务类型"); | |||
return; | |||
} | |||
@@ -308,131 +310,131 @@ public class EarlyWarningInstanceNotStartTask { | |||
List<Project> needNextProjects = projectService.list(Wrappers.lambdaQuery(Project.class) | |||
.eq(Project::getAreaCode, areaCode) | |||
.eq(Project::getNewest, Boolean.TRUE) | |||
.eq(Project::getStatus,projectStutas)); | |||
.eq(Project::getStatus, projectStutas)); | |||
List<String> projectCodes = needNextProjects.stream().map(Project::getProjectCode).collect(Collectors.toList()); | |||
List<Operation> operations = operationService.list(Wrappers.lambdaQuery(Operation.class) | |||
.in(Operation::getProjectCode, projectCodes)); | |||
Map<String,Operation> operationMap = operations.stream().collect(Collectors.toMap(Operation::getProjectCode,o -> o)); | |||
Map<String,List<Integer>> noticeMap = Maps.newHashMap(); | |||
Map<String, Operation> operationMap = operations.stream().collect(Collectors.toMap(Operation::getProjectCode, o -> o)); | |||
Map<String, List<Integer>> noticeMap = Maps.newHashMap(); | |||
//需要发通知的项目 | |||
List<Project> needToWaringProjects = needNextProjects.stream() | |||
.filter(p -> { | |||
//判断 当状态在 建设中的时候 是不是要初验了 | |||
if(ProjectStatusEnum.UNDER_CONSTRUCTION.getCode().equals(projectStutas)){ | |||
if (ProjectStatusEnum.UNDER_CONSTRUCTION.getCode().equals(projectStutas)) { | |||
List<Long> allVersionProjectId = projectService.getAllVersionProjectId(p); | |||
//如果合同信息提交过了 才是 待初验状态 | |||
if(StringUtils.isNotBlank(p.getPreliminaryInspectionMaterials())){ | |||
if(0L == contractService.count(Wrappers.lambdaQuery(Contract.class) | |||
.in(Contract::getProjectId, allVersionProjectId))){ | |||
if (StringUtils.isNotBlank(p.getPreliminaryInspectionMaterials())) { | |||
if (0L == contractService.count(Wrappers.lambdaQuery(Contract.class) | |||
.in(Contract::getProjectId, allVersionProjectId))) { | |||
return Boolean.FALSE; | |||
} | |||
} | |||
} | |||
//判断 实施信息中 初验和终验的时间 | |||
if(!operationMap.containsKey(p.getProjectCode())){ | |||
if (!operationMap.containsKey(p.getProjectCode())) { | |||
return Boolean.FALSE; | |||
} | |||
Operation operation = operationMap.get(p.getProjectCode()); | |||
List<Integer> noticeTypes = Lists.newArrayList(); | |||
if(WarningOperationTypeEnum.CHUYAN.getCode().equals(biz)){ | |||
if (WarningOperationTypeEnum.CHUYAN.getCode().equals(biz)) { | |||
//初验 | |||
if(Objects.nonNull(time) && Duration.between(operation.getInitialInspectionDate(),LocalDateTime.now()).toMinutes() >= time * 60 && //time * 60 | |||
Duration.between(operation.getInitialInspectionDate(),LocalDateTime.now()).toMinutes() <= time * 60 + 1){ //time * 60 | |||
if (Objects.nonNull(time) && Duration.between(operation.getInitialInspectionDate(), LocalDateTime.now()).toMinutes() >= time * 60 && //time * 60 | |||
Duration.between(operation.getInitialInspectionDate(), LocalDateTime.now()).toMinutes() <= time * 60 + 1) { //time * 60 | |||
noticeTypes.add(com.wflow.enums.WarningNoticeTypeEnum.OVER.getCode()); | |||
} | |||
if(Objects.nonNull(adventTime) && Duration.between(operation.getInitialInspectionDate(),LocalDateTime.now()).toMinutes() >= adventTime * 60 && //time * 60 | |||
Duration.between(operation.getInitialInspectionDate(),LocalDateTime.now()).toMinutes() <= adventTime * 60 + 1){ | |||
if (Objects.nonNull(adventTime) && Duration.between(operation.getInitialInspectionDate(), LocalDateTime.now()).toMinutes() >= adventTime * 60 && //time * 60 | |||
Duration.between(operation.getInitialInspectionDate(), LocalDateTime.now()).toMinutes() <= adventTime * 60 + 1) { | |||
noticeTypes.add(com.wflow.enums.WarningNoticeTypeEnum.ADVENT.getCode()); | |||
} | |||
}else if(WarningOperationTypeEnum.ZHONGYAN.getCode().equals(biz)){ | |||
} else if (WarningOperationTypeEnum.ZHONGYAN.getCode().equals(biz)) { | |||
//终验 | |||
if(Objects.nonNull(time) && Duration.between(operation.getFinalInspectionDate(),LocalDateTime.now()).toMinutes() >= time * 60 && //time * 60 | |||
Duration.between(operation.getFinalInspectionDate(),LocalDateTime.now()).toMinutes() <= time * 60 + 1){ //time * 60 | |||
if (Objects.nonNull(time) && Duration.between(operation.getFinalInspectionDate(), LocalDateTime.now()).toMinutes() >= time * 60 && //time * 60 | |||
Duration.between(operation.getFinalInspectionDate(), LocalDateTime.now()).toMinutes() <= time * 60 + 1) { //time * 60 | |||
noticeTypes.add(com.wflow.enums.WarningNoticeTypeEnum.OVER.getCode()); | |||
} | |||
if(Objects.nonNull(adventTime) && Duration.between(operation.getFinalInspectionDate(),LocalDateTime.now()).toMinutes() >= adventTime * 60 && //time * 60 | |||
Duration.between(operation.getFinalInspectionDate(),LocalDateTime.now()).toMinutes() <= adventTime * 60 + 1){ //time * 60 | |||
if (Objects.nonNull(adventTime) && Duration.between(operation.getFinalInspectionDate(), LocalDateTime.now()).toMinutes() >= adventTime * 60 && //time * 60 | |||
Duration.between(operation.getFinalInspectionDate(), LocalDateTime.now()).toMinutes() <= adventTime * 60 + 1) { //time * 60 | |||
noticeTypes.add(com.wflow.enums.WarningNoticeTypeEnum.ADVENT.getCode()); | |||
} | |||
} | |||
if(CollUtil.isNotEmpty(noticeTypes)){ | |||
noticeMap.put(p.getProjectCode(),noticeTypes); | |||
if (CollUtil.isNotEmpty(noticeTypes)) { | |||
noticeMap.put(p.getProjectCode(), noticeTypes); | |||
//项目 运维预警 | |||
projectEarlyWarningService.earlyWarning(p, | |||
WarningRuleTypeEnum.OPERATION_WARNING.getCode(),noticeTypes); | |||
WarningRuleTypeEnum.OPERATION_WARNING.getCode(), noticeTypes); | |||
return Boolean.TRUE; | |||
} | |||
return Boolean.FALSE; | |||
}) | |||
.collect(Collectors.toList()); | |||
if(StringUtils.isBlank(noticeMethod) || | |||
if (StringUtils.isBlank(noticeMethod) || | |||
(!noticeMethod.contains(String.valueOf(CommonEnum.ZWDD.getCode())) && | |||
!noticeMethod.contains(String.valueOf(CommonEnum.MOBILE.getCode())))){ | |||
!noticeMethod.contains(String.valueOf(CommonEnum.MOBILE.getCode())))) { | |||
log.info("通知方式为空或者错误!"); | |||
return; | |||
} | |||
for(Project needToWaringProject : needToWaringProjects){ | |||
for (Project needToWaringProject : needToWaringProjects) { | |||
//去预警通知 | |||
List<String> batchEmployees = Lists.newArrayList(); | |||
if(StringUtils.isBlank(notice)){ | |||
if (StringUtils.isBlank(notice)) { | |||
String sponsor = needToWaringProject.getSponsor(); | |||
batchEmployees.add(sponsor); | |||
}else{ | |||
} else { | |||
//去预警通知人 1.项目联系人 2.项目负责人 如果都包含 都要发 | |||
if(notice.contains(WarningNoticeTypeEnum.CONTACT.getCode().toString())){ | |||
if (notice.contains(WarningNoticeTypeEnum.CONTACT.getCode().toString())) { | |||
String employeeCode = null; | |||
String username = needToWaringProject.getContactName(); | |||
String mobile = needToWaringProject.getContactPhone(); | |||
if(StringUtils.isNotBlank(username) && StringUtils.isNotBlank(mobile)){ | |||
if (StringUtils.isNotBlank(username) && StringUtils.isNotBlank(mobile)) { | |||
UserInfo user = userInfoService.getOne(Wrappers.lambdaQuery(UserInfo.class) | |||
.eq(UserInfo::getUsername, username) | |||
.eq(UserInfo::getMobile, mobile) | |||
.last(BizConst.LIMIT_1)); | |||
if(Objects.nonNull(user)){ | |||
if (Objects.nonNull(user)) { | |||
employeeCode = user.getEmployeeCode(); | |||
} | |||
if(Objects.nonNull(employeeCode)){ | |||
if (Objects.nonNull(employeeCode)) { | |||
batchEmployees.add(employeeCode); | |||
} | |||
} | |||
} | |||
if(notice.contains(WarningNoticeTypeEnum.RESPONSIBLE.getCode().toString())){ | |||
if (notice.contains(WarningNoticeTypeEnum.RESPONSIBLE.getCode().toString())) { | |||
String employeeCode = null; | |||
String username = needToWaringProject.getResponsibleMan(); | |||
String mobile = needToWaringProject.getResponsibleManMobile(); | |||
if(StringUtils.isNotBlank(username) && StringUtils.isNotBlank(mobile)){ | |||
if (StringUtils.isNotBlank(username) && StringUtils.isNotBlank(mobile)) { | |||
UserInfo user = userInfoService.getOne(Wrappers.lambdaQuery(UserInfo.class) | |||
.eq(UserInfo::getUsername, username) | |||
.eq(UserInfo::getMobile, mobile) | |||
.last(BizConst.LIMIT_1)); | |||
if(Objects.nonNull(user)){ | |||
if (Objects.nonNull(user)) { | |||
employeeCode = user.getEmployeeCode(); | |||
} | |||
if(Objects.nonNull(employeeCode)){ | |||
if (Objects.nonNull(employeeCode)) { | |||
batchEmployees.add(employeeCode); | |||
} | |||
} | |||
} | |||
} | |||
if(noticeMap.containsKey(needToWaringProject.getProjectCode())){ | |||
if (noticeMap.containsKey(needToWaringProject.getProjectCode())) { | |||
List<Integer> noticeTypes = noticeMap.get(needToWaringProject.getProjectCode()); | |||
for(Integer noticeType : noticeTypes){ | |||
for (Integer noticeType : noticeTypes) { | |||
for (String employeeCode : batchEmployees) { | |||
earlyWarningManage.doEarlyWarning(noticeMethod,Objects.nonNull(noticeType)&¬iceType.equals(1) ? noticeContent : adventContent, | |||
adventTime,time,biz, | |||
needToWaringProject.getUpdateOn(),employeeCode,needToWaringProject, | |||
WarningRuleTypeEnum.OPERATION_WARNING.getCode(),noticeType,path, | |||
batchEmployees.stream().collect(Collectors.joining(StrPool.COMMA)),null); | |||
earlyWarningManage.doEarlyWarning(noticeMethod, Objects.nonNull(noticeType) && noticeType.equals(1) ? noticeContent : adventContent, | |||
adventTime, time, biz, | |||
needToWaringProject.getUpdateOn(), Long.valueOf(employeeCode), needToWaringProject, | |||
WarningRuleTypeEnum.OPERATION_WARNING.getCode(), noticeType, path, | |||
batchEmployees.stream().collect(Collectors.joining(StrPool.COMMA)), null); | |||
} | |||
} | |||
} | |||
@@ -449,6 +451,7 @@ public class EarlyWarningInstanceNotStartTask { | |||
/** | |||
* 续建项目资金 超时未审批定时器 | |||
* | |||
* @throws UnknownHostException | |||
*/ | |||
@Scheduled(cron = "20 0/2 * * * ?") | |||
@@ -464,9 +467,9 @@ public class EarlyWarningInstanceNotStartTask { | |||
// 1.查询 填报的 预警规则 填报类型的 每个区域 续建项目资金审批 | |||
List<WflowEarlyWarning> warnings = earlyWarningService.list(Wrappers.lambdaQuery(WflowEarlyWarning.class) | |||
.eq(WflowEarlyWarning::getRuleType, WarningRuleTypeEnum.RENEWAL_FUND.getCode())); | |||
for(WflowEarlyWarning warning : warnings){ | |||
for (WflowEarlyWarning warning : warnings) { | |||
//2. 取出rule的数据 | |||
if(!warning.getIsOpen()){ | |||
if (!warning.getIsOpen()) { | |||
log.info(warning.getId() + " 此规则关闭了"); | |||
continue; | |||
} | |||
@@ -474,23 +477,23 @@ public class EarlyWarningInstanceNotStartTask { | |||
String noticeMethod = warning.getNoticeMethod(); | |||
String noticeContent = warning.getNoticeContent(); | |||
String adventContent = warning.getAdventContent(); | |||
if(StringUtils.isBlank(noticeMethod) || | |||
if (StringUtils.isBlank(noticeMethod) || | |||
(!noticeMethod.contains(String.valueOf(CommonEnum.ZWDD.getCode())) && | |||
!noticeMethod.contains(String.valueOf(CommonEnum.MOBILE.getCode())))){ | |||
!noticeMethod.contains(String.valueOf(CommonEnum.MOBILE.getCode())))) { | |||
log.info("通知方式为空或者错误!"); | |||
return; | |||
} | |||
String rule = warning.getRule(); | |||
if(StringUtils.isNotBlank(rule)){ | |||
if (StringUtils.isNotBlank(rule)) { | |||
JSONArray ruleArray = JSON.parseArray(rule); | |||
if(CollUtil.isNotEmpty(ruleArray)){ | |||
if (CollUtil.isNotEmpty(ruleArray)) { | |||
ruleArray.forEach(r -> { | |||
JSONObject rJson = JSON.parseObject(JSON.toJSONString(r)); | |||
Integer time = rJson.getInteger("time"); | |||
Integer adventTime = rJson.getInteger("adventTime"); | |||
if((Objects.isNull(time) && Objects.isNull(adventTime)) && Objects.isNull(adventTime)){ | |||
log.info("规则数据 错误 :{}",rJson); | |||
if ((Objects.isNull(time) && Objects.isNull(adventTime)) && Objects.isNull(adventTime)) { | |||
log.info("规则数据 错误 :{}", rJson); | |||
return; | |||
} | |||
@@ -500,56 +503,56 @@ public class EarlyWarningInstanceNotStartTask { | |||
//查询 所有这个区域的项目 未提交的项目 | |||
List<ProjectRenewalFundDeclaration> needNextProjects = renewalFundDeclarationService.list(Wrappers.lambdaQuery(ProjectRenewalFundDeclaration.class) | |||
.eq(ProjectRenewalFundDeclaration::getRegionCode, areaCode) | |||
.eq(ProjectRenewalFundDeclaration::getDeleted,Boolean.FALSE) | |||
.eq(ProjectRenewalFundDeclaration::getDeleted, Boolean.FALSE) | |||
.eq(ProjectRenewalFundDeclaration::getApprovalStatus, ProjectRenewalApprovalStatusEnum.PENDING.name())); | |||
Map<String,List<Integer>> noticeTypeMap = Maps.newHashMap(); | |||
Map<String, List<Integer>> noticeTypeMap = Maps.newHashMap(); | |||
//需要发通知的项目 | |||
List<ProjectRenewalFundDeclaration> needToWaringProjects = needNextProjects.stream() | |||
.filter(p -> { | |||
//超时未审批 | |||
List<Integer> noticeTypes = Lists.newArrayList(); | |||
if(Objects.nonNull(time) && Duration.between(p.getCreateOn(),LocalDateTime.now()).toMinutes() >= time * 60 && //time * 60 | |||
Duration.between(p.getCreateOn(),LocalDateTime.now()).toMinutes() <= time * 60 + 1){ //time * 60 | |||
if (Objects.nonNull(time) && Duration.between(p.getCreateOn(), LocalDateTime.now()).toMinutes() >= time * 60 && //time * 60 | |||
Duration.between(p.getCreateOn(), LocalDateTime.now()).toMinutes() <= time * 60 + 1) { //time * 60 | |||
noticeTypes.add(com.wflow.enums.WarningNoticeTypeEnum.OVER.getCode()); | |||
} | |||
if(Objects.nonNull(adventTime) && Duration.between(p.getCreateOn(),LocalDateTime.now()).toMinutes() >= adventTime * 60 && //time * 60 | |||
Duration.between(p.getCreateOn(),LocalDateTime.now()).toMinutes() <= adventTime * 60 + 1){ //time * 60 | |||
if (Objects.nonNull(adventTime) && Duration.between(p.getCreateOn(), LocalDateTime.now()).toMinutes() >= adventTime * 60 && //time * 60 | |||
Duration.between(p.getCreateOn(), LocalDateTime.now()).toMinutes() <= adventTime * 60 + 1) { //time * 60 | |||
noticeTypes.add(com.wflow.enums.WarningNoticeTypeEnum.ADVENT.getCode()); | |||
} | |||
if(CollUtil.isNotEmpty(noticeTypes)){ | |||
noticeTypeMap.put(p.getProjectCode(),noticeTypes); | |||
if (CollUtil.isNotEmpty(noticeTypes)) { | |||
noticeTypeMap.put(p.getProjectCode(), noticeTypes); | |||
//项目 运维预警 | |||
projectEarlyWarningService.earlyWarning(p.getProjectCode(), | |||
WarningRuleTypeEnum.OPERATION_WARNING.getCode(),noticeTypes); | |||
WarningRuleTypeEnum.OPERATION_WARNING.getCode(), noticeTypes); | |||
return Boolean.TRUE; | |||
} | |||
return Boolean.FALSE; | |||
}) | |||
.collect(Collectors.toList()); | |||
if(StringUtils.isBlank(noticeMethod) || | |||
if (StringUtils.isBlank(noticeMethod) || | |||
(!noticeMethod.contains(String.valueOf(CommonEnum.ZWDD.getCode())) && | |||
!noticeMethod.contains(String.valueOf(CommonEnum.MOBILE.getCode())))){ | |||
!noticeMethod.contains(String.valueOf(CommonEnum.MOBILE.getCode())))) { | |||
log.info("通知方式为空或者错误!"); | |||
return; | |||
} | |||
for(ProjectRenewalFundDeclaration needToWaringProject : needToWaringProjects){ | |||
for (ProjectRenewalFundDeclaration needToWaringProject : needToWaringProjects) { | |||
String path = "projectStoreManage/renewalProjectAsscess?projectRenewalId=" + needToWaringProject.getId(); | |||
Project project = projectService.getProjectByCode(needToWaringProject.getProjectCode()); | |||
//去预警通知 发给区管 | |||
List<UserInfo> users = roleManage.getUsersByRoleType(RoleEnum.REGION_MANAGER.name(),needToWaringProject.getRegionCode()); | |||
List<UserInfo> users = roleManage.getUsersByRoleType(RoleEnum.REGION_MANAGER.name()); | |||
String employeesStr = users.stream().map(UserInfo::getEmployeeCode) | |||
.collect(Collectors.joining(StrPool.COMMA)); | |||
for(UserInfo user : users){ | |||
if(noticeTypeMap.containsKey(needToWaringProject.getProjectCode())){ | |||
for (UserInfo user : users) { | |||
if (noticeTypeMap.containsKey(needToWaringProject.getProjectCode())) { | |||
List<Integer> noticeTypes = noticeTypeMap.get(needToWaringProject.getProjectCode()); | |||
for(Integer noticeType : noticeTypes){ | |||
earlyWarningManage.doEarlyWarning(noticeMethod,Objects.nonNull(noticeType)&¬iceType.equals(1) ? noticeContent : adventContent, | |||
adventTime,time,null, | |||
needToWaringProject.getUpdateOn(),user.getEmployeeCode(),project, | |||
WarningRuleTypeEnum.RENEWAL_FUND.getCode(),noticeType,path,employeesStr,needToWaringProject.getId().toString()); | |||
for (Integer noticeType : noticeTypes) { | |||
earlyWarningManage.doEarlyWarning(noticeMethod, Objects.nonNull(noticeType) && noticeType.equals(1) ? noticeContent : adventContent, | |||
adventTime, time, null, | |||
needToWaringProject.getUpdateOn(), Long.valueOf(user.getEmployeeCode()), project, | |||
WarningRuleTypeEnum.RENEWAL_FUND.getCode(), noticeType, path, employeesStr, needToWaringProject.getId().toString()); | |||
} | |||
} | |||
@@ -37,8 +37,8 @@ import java.util.StringJoiner; | |||
* @author ZPF | |||
* @since 2023/08/31 18:16 | |||
*/ | |||
@Component | |||
@Slf4j | |||
@Component | |||
@RequiredArgsConstructor | |||
public class SynProjectCollectionTask { | |||
@@ -48,35 +48,21 @@ public class SynProjectCollectionTask { | |||
@Value("${spring.profiles.active}") | |||
public String active; | |||
@Autowired | |||
private GovProjectCollectionManage collectionManage; | |||
@Autowired | |||
private IGovBizProjectBaseinfoService baseinfoService; | |||
@Autowired | |||
private IGovBizProjectApplyService applyService; | |||
@Autowired | |||
private IGovBizProjectApproveService approveService; | |||
@Autowired | |||
private IGovBizProjectCimplementService cimplementService; | |||
@Autowired | |||
private IGovBizProjectMimplementService mimplementService; | |||
@Autowired | |||
private IGovBizProjectProcureService procureService; | |||
@Autowired | |||
private IProjectService projectService; | |||
@Autowired | |||
private ProjectLibManage projectLibManage; | |||
private final GovProjectCollectionManage collectionManage; | |||
private final IGovBizProjectBaseinfoService baseinfoService; | |||
private final IGovBizProjectApplyService applyService; | |||
private final IGovBizProjectApproveService approveService; | |||
private final IGovBizProjectCimplementService cimplementService; | |||
private final IGovBizProjectMimplementService mimplementService; | |||
private final IGovBizProjectProcureService procureService; | |||
private final IProjectService projectService; | |||
private final ProjectLibManage projectLibManage; | |||
private final FileService fileService; | |||
@Autowired | |||
private FileService fileService; | |||
private static final Integer PAGE_NUMBER = 1; | |||
private final Integer PAGE_NUMBER = 1; | |||
/** | |||
* 前置机每天晚上10点自动清空,第二天早上6点获取数据 | |||
@@ -6,6 +6,10 @@ package com.hz.pm.api.staging.contants; | |||
public interface StagingContant { | |||
class Retry { | |||
private Retry() { | |||
} | |||
public static final Integer MAX_RETRY_TIMES = 10; | |||
} | |||
@@ -1,11 +1,11 @@ | |||
package com.hz.pm.api.staging.service.impl; | |||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; | |||
import com.hz.pm.api.staging.contants.StagingContant; | |||
import com.hz.pm.api.staging.enums.MsgTypeEnum; | |||
import com.hz.pm.api.staging.model.entity.WorkNoticeStaging; | |||
import com.hz.pm.api.staging.mapper.NdWorkNoticeStagingMapper; | |||
import com.hz.pm.api.staging.model.entity.WorkNoticeStaging; | |||
import com.hz.pm.api.staging.service.INdWorkNoticeStagingService; | |||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; | |||
import com.hz.pm.api.staging.utils.WorkNoticeFlowMapUtil; | |||
import com.hz.pm.api.todocenter.bean.entity.WorkNoticeInfo; | |||
import lombok.RequiredArgsConstructor; | |||
@@ -31,7 +31,6 @@ public class NdWorkNoticeStagingServiceImpl extends ServiceImpl<NdWorkNoticeStag | |||
private final NdWorkNoticeStagingMapper mapper; | |||
private final WorkNoticeFlowMapUtil workNoticeFlowMapUtil; | |||
/** | |||
* 增加 重试次数 和下次扫描时间 | |||
@@ -43,13 +42,13 @@ public class NdWorkNoticeStagingServiceImpl extends ServiceImpl<NdWorkNoticeStag | |||
*/ | |||
@Override | |||
public Boolean addRetryTimes(WorkNoticeStaging workNoticeStaging) { | |||
Integer retryTimes = workNoticeStaging.getRetryTimes() + 1; | |||
if (!workNoticeFlowMapUtil.intervalTimeMap.containsKey(workNoticeStaging.getRetryTimes())) { | |||
Integer addSeconds = WorkNoticeFlowMapUtil.get(workNoticeStaging.getRetryTimes()); | |||
if (addSeconds == null) { | |||
log.info("没有对应重试间隔时间 添加重试信息失败"); | |||
return Boolean.FALSE; | |||
} | |||
Integer addSeconds = workNoticeFlowMapUtil.intervalTimeMap.get(workNoticeStaging.getRetryTimes()); | |||
Boolean dead = Boolean.FALSE; | |||
boolean dead = Boolean.FALSE; | |||
Integer retryTimes = workNoticeStaging.getRetryTimes() + 1; | |||
//超过重试最大次数 dead置为 true | |||
if (retryTimes.compareTo(StagingContant.Retry.MAX_RETRY_TIMES) > 0) { | |||
dead = Boolean.TRUE; | |||
@@ -69,6 +68,7 @@ public class NdWorkNoticeStagingServiceImpl extends ServiceImpl<NdWorkNoticeStag | |||
*/ | |||
@Override | |||
public Boolean addByWorkNotice(WorkNoticeInfo workNoticeInfo, MsgTypeEnum msgType) { | |||
LocalDateTime now = LocalDateTime.now(); | |||
WorkNoticeStaging workNoticeStaging = WorkNoticeStaging.builder() | |||
.accountId(workNoticeInfo.getAccountId()) | |||
.msg(workNoticeInfo.getMsg()) | |||
@@ -77,9 +77,9 @@ public class NdWorkNoticeStagingServiceImpl extends ServiceImpl<NdWorkNoticeStag | |||
.organizationName(workNoticeInfo.getOrganizationName()) | |||
.receiverUserId(workNoticeInfo.getReceiverUserId()) | |||
.msgType(msgType) | |||
.createOn(LocalDateTime.now()) | |||
.updateOn(LocalDateTime.now()) | |||
.nextTime(LocalDateTime.now()) | |||
.createOn(now) | |||
.updateOn(now) | |||
.nextTime(now) | |||
.retryTimes(0) | |||
.build(); | |||
return this.save(workNoticeStaging); | |||
@@ -1,12 +1,10 @@ | |||
package com.hz.pm.api.staging.utils; | |||
import cn.hutool.core.lang.func.Func; | |||
import com.google.common.collect.Maps; | |||
import com.hz.pm.api.projectdeclared.manage.ReviewByDeptJointManage; | |||
import com.hz.pm.api.projectdeclared.manage.ReviewByProvincialDeptManage; | |||
import com.hz.pm.api.projectlib.model.enumeration.ProjectStatusEnum; | |||
import com.hz.pm.api.projectlib.model.entity.Project; | |||
import org.springframework.beans.factory.annotation.Autowired; | |||
import com.hz.pm.api.projectlib.model.enumeration.ProjectStatusEnum; | |||
import org.springframework.stereotype.Component; | |||
import java.util.Map; | |||
@@ -12,6 +12,10 @@ import java.util.Map; | |||
* @Author PoffyZhang | |||
*/ | |||
public class ProjectStatusFlowUtil { | |||
private ProjectStatusFlowUtil() { | |||
} | |||
/** | |||
* key 重试的次数 , value 是增加是描述 | |||
*/ | |||
@@ -1,6 +1,7 @@ | |||
package com.hz.pm.api.staging.utils; | |||
import com.google.common.collect.Maps; | |||
import io.swagger.models.auth.In; | |||
import lombok.AllArgsConstructor; | |||
import org.springframework.stereotype.Component; | |||
@@ -8,33 +9,39 @@ import java.util.Map; | |||
/** | |||
* 工作通知流转 事件函数MAP | |||
* @return | |||
* | |||
* @author CMM | |||
* @return | |||
* @since 2023/02/28 17:03 | |||
*/ | |||
@Component | |||
@AllArgsConstructor | |||
public class WorkNoticeFlowMapUtil { | |||
private WorkNoticeFlowMapUtil() { | |||
} | |||
/** | |||
* key 重试的次数 , value 是增加是描述 | |||
*/ | |||
public Map<Integer, Integer> intervalTimeMap = Maps.newHashMap(); | |||
private static final Map<Integer, Integer> INTERVAL_TIME_MAP = Maps.newHashMap(); | |||
/** | |||
* 扫描的间隔越来越长 秒数 | |||
*/ | |||
public WorkNoticeFlowMapUtil(){ | |||
intervalTimeMap.put(0,60); | |||
intervalTimeMap.put(1,60 * 2); | |||
intervalTimeMap.put(2,60 * 6); | |||
intervalTimeMap.put(3,60 * 15); | |||
intervalTimeMap.put(4,60 * 30); | |||
intervalTimeMap.put(5,60 * 60); | |||
intervalTimeMap.put(6,60 * 60 * 2); | |||
intervalTimeMap.put(7,60 * 60 * 5); | |||
intervalTimeMap.put(8,60 * 60 * 12); | |||
intervalTimeMap.put(9,60 * 60 * 24); | |||
intervalTimeMap.put(10,60 * 60 * 72); | |||
intervalTimeMap.put(11,60 * 60 * 216); | |||
static { | |||
INTERVAL_TIME_MAP.put(0, 60); | |||
INTERVAL_TIME_MAP.put(1, 60 * 2); | |||
INTERVAL_TIME_MAP.put(2, 60 * 6); | |||
INTERVAL_TIME_MAP.put(3, 60 * 15); | |||
INTERVAL_TIME_MAP.put(4, 60 * 30); | |||
INTERVAL_TIME_MAP.put(5, 60 * 60); | |||
INTERVAL_TIME_MAP.put(6, 60 * 60 * 2); | |||
INTERVAL_TIME_MAP.put(7, 60 * 60 * 5); | |||
INTERVAL_TIME_MAP.put(8, 60 * 60 * 12); | |||
INTERVAL_TIME_MAP.put(9, 60 * 60 * 24); | |||
INTERVAL_TIME_MAP.put(10, 60 * 60 * 72); | |||
INTERVAL_TIME_MAP.put(11, 60 * 60 * 216); | |||
} | |||
public static Integer get(Integer times) { | |||
return INTERVAL_TIME_MAP.get(times); | |||
} | |||
} |