@@ -57,8 +57,8 @@ public class MeetingStatisticsManage { | |||
List<Meeting> meetings = meetingService.list(Wrappers.lambdaQuery(Meeting.class)); | |||
//查出 年份的 会议数据 | |||
meetings = meetings.stream().filter(m -> { | |||
if(Objects.nonNull(m.getStartTime()) && | |||
(Objects.isNull(year) || year.equals(m.getStartTime().getYear()))){ | |||
if (Objects.nonNull(m.getStartTime()) && | |||
(Objects.isNull(year) || year.equals(m.getStartTime().getYear()))) { | |||
return Boolean.TRUE; | |||
} | |||
return Boolean.FALSE; | |||
@@ -72,10 +72,10 @@ public class MeetingStatisticsManage { | |||
//评审数 | |||
List<ExpertReview> expertReviews = Lists.newArrayList(); | |||
Integer reviewsTotal = 0; | |||
if(CollUtil.isNotEmpty(meetingIds)){ | |||
if (CollUtil.isNotEmpty(meetingIds)) { | |||
expertReviews = expertReviewService.list(Wrappers.lambdaQuery(ExpertReview.class) | |||
.eq(ExpertReview::getIsFinal, Boolean.TRUE) | |||
.in(ExpertReview::getMeetingId,meetingIds)); | |||
.in(ExpertReview::getMeetingId, meetingIds)); | |||
reviewsTotal = expertReviews.size(); | |||
} | |||
//通过的评审 | |||
@@ -91,18 +91,15 @@ public class MeetingStatisticsManage { | |||
res.setPassReview(passExpertReviews.size()); | |||
res.setNotPassRate(reviewsTotal.compareTo(0) == 0 ? BigDecimal.ZERO : | |||
BigDecimal.valueOf(notpassExpertReviews.size()).multiply(BigDecimal.valueOf(100) | |||
.divide(BigDecimal.valueOf(reviewsTotal), RoundingMode.HALF_UP))); | |||
.divide(BigDecimal.valueOf(reviewsTotal), RoundingMode.HALF_UP))); | |||
//各区域 | |||
List<RegionDTO> regions = regionCacheHelper.listChildren(RegionConst.RC_HZ, RegionConst.RL_CITY) | |||
.stream().filter(r -> r.getRegionLevel().equals(RegionConst.RL_COUNTY)) | |||
.sorted(Comparator.comparing(RegionDTO::getRegionCode)).collect(Collectors.toList()); | |||
List<DataDTO> regionMeetngs = Lists.newArrayList(); | |||
for(RegionDTO region : regions){ | |||
regionMeetngs.add(DataDTO.of(region.getRegionName(),region.getRegionCode(),meetings.stream().filter(m -> { | |||
return Boolean.FALSE; | |||
}).collect(Collectors.toList()).size())); | |||
for (RegionDTO region : regions) { | |||
regionMeetngs.add(DataDTO.of(region.getRegionName(), region.getRegionCode(), meetings.size())); | |||
} | |||
res.setRegionMeetings(regionMeetngs); | |||
@@ -110,14 +107,14 @@ public class MeetingStatisticsManage { | |||
List<DataDTO> meetingTypes = Lists.newArrayList(); | |||
meetingTypes.add(DataDTO.of("预审会议", ReviewTemplateTypeEnum.PRELIMINARY_SCHEME_REVIEW.getCode().toString(), | |||
meetings.stream().filter(m -> { | |||
if(StringUtils.isNotBlank(m.getType()) && | |||
if (StringUtils.isNotBlank(m.getType()) && | |||
m.getType().equals(ReviewTemplateTypeEnum.PRELIMINARY_SCHEME_REVIEW.getCode() | |||
.toString())){ | |||
.toString())) { | |||
return Boolean.TRUE; | |||
} | |||
return Boolean.FALSE; | |||
}).collect(Collectors.toList()).size())); | |||
Long yanshouCount = meetings.stream().filter(m -> { | |||
long yanshouCount = meetings.stream().filter(m -> { | |||
if (StringUtils.isNotBlank(m.getType()) && | |||
m.getType().equals(ReviewTemplateTypeEnum.ACCEPTANCE_SCHEME_REVIEW.getCode() | |||
.toString())) { | |||
@@ -125,13 +122,13 @@ public class MeetingStatisticsManage { | |||
} | |||
return Boolean.FALSE; | |||
}).count(); | |||
meetingTypes.add(DataDTO.of("验收会议",ReviewTemplateTypeEnum.ACCEPTANCE_SCHEME_REVIEW.getCode().toString(), | |||
yanshouCount.intValue())); | |||
meetingTypes.add(DataDTO.of("验收会议", ReviewTemplateTypeEnum.ACCEPTANCE_SCHEME_REVIEW.getCode().toString(), | |||
(int) yanshouCount)); | |||
res.setMeetingTypes(meetingTypes); | |||
//各区县评审 不通过率 | |||
List<DataDTO> regionNotpassReview = Lists.newArrayList(); | |||
for(RegionDTO region : regions){ | |||
for (RegionDTO region : regions) { | |||
DataDTO data = new DataDTO(); | |||
data.setCode(region.getRegionCode()); | |||
data.setName(region.getRegionName()); | |||
@@ -151,7 +148,7 @@ public class MeetingStatisticsManage { | |||
data.setRate(CollUtil.isEmpty(regionReviews) ? BigDecimal.ZERO : | |||
BigDecimal.valueOf(regionNotpass).multiply(BigDecimal.valueOf(100)) | |||
.divide(BigDecimal.valueOf(regionReviews.size()),BigDecimal.ROUND_CEILING,RoundingMode.HALF_UP)); | |||
.divide(BigDecimal.valueOf(regionReviews.size()), BigDecimal.ROUND_CEILING, RoundingMode.HALF_UP)); | |||
regionNotpassReview.add(data); | |||
} | |||
@@ -176,7 +173,7 @@ public class MeetingStatisticsManage { | |||
.collect(Collectors.toList()); | |||
List<String> projectCodes = orgProjects.stream().map(Project::getProjectCode) | |||
.collect(Collectors.toList()); | |||
if(CollUtil.isEmpty(projectCodes)){ | |||
if (CollUtil.isEmpty(projectCodes)) { | |||
return data; | |||
} | |||
List<ExpertReview> reviews = finalExpertReviews.stream().filter(r -> Objects.nonNull(r.getProjectCode()) && | |||
@@ -186,7 +183,7 @@ public class MeetingStatisticsManage { | |||
.count(); | |||
data.setRate(CollUtil.isEmpty(reviews) ? BigDecimal.ZERO : | |||
BigDecimal.valueOf(orgNotpass).multiply(BigDecimal.valueOf(100)) | |||
.divide(BigDecimal.valueOf(reviews.size()),BigDecimal.ROUND_CEILING,RoundingMode.HALF_UP)); | |||
.divide(BigDecimal.valueOf(reviews.size()), BigDecimal.ROUND_CEILING, RoundingMode.HALF_UP)); | |||
return data; | |||
}) | |||
.filter(d -> Objects.nonNull(d.getRate())) | |||
@@ -4,8 +4,6 @@ import lombok.AllArgsConstructor; | |||
import lombok.Data; | |||
import lombok.NoArgsConstructor; | |||
import java.io.Serializable; | |||
/** | |||
* @author 王仁康 | |||
* @date 2024-01-02 16:55:51 | |||
@@ -2,6 +2,7 @@ package com.hz.pm.api.filemanage.manage; | |||
import cn.hutool.core.bean.BeanUtil; | |||
import cn.hutool.core.collection.CollUtil; | |||
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.filemanage.model.dto.DocumentationGroupSaveDTO; | |||
@@ -106,7 +107,7 @@ public class DocumentationManage { | |||
* @param id | |||
* @return | |||
*/ | |||
@Transactional | |||
@Transactional(rollbackFor = Exception.class) | |||
public String deleteGroup(Long id) { | |||
DocumentationGroup group = documentationGroupService.getById(id); | |||
VUtils.isTrue(Objects.isNull(group)).throwMessage("该分组不存在!"); | |||
@@ -125,22 +126,21 @@ public class DocumentationManage { | |||
* @param dto | |||
* @return | |||
*/ | |||
@Transactional(rollbackFor = Exception.class) | |||
public String addDoc(DocumentationSaveDTO dto) { | |||
UserInfoDetails user = LoginUserUtil.loginUserDetail(); | |||
Long fileId = dto.getFileId(); | |||
File file = fileService.getById(fileId); | |||
VUtils.isTrue(Objects.isNull(file)).throwMessage("该文件不存在!"); | |||
Assert.notNull(file, "该文件不存在!"); | |||
DocumentationGroup group = documentationGroupService.getById(dto.getGroupId()); | |||
VUtils.isTrue(Objects.isNull(group)).throwMessage("分组不存在!"); | |||
Assert.notNull(group, "分组不存在!"); | |||
Documentation documentation = new Documentation(); | |||
documentation.setCreateBy(user.getRealName()); | |||
documentation.setCreateOn(LocalDateTime.now()); | |||
documentation.setSize(Objects.nonNull(file.getSize()) ? file.getSize() / 1000L : 0L); | |||
documentation.setSize(file.getSize() / 1000L); | |||
documentation.setFileId(fileId); | |||
documentation.setGroupId(dto.getGroupId()); | |||
documentation.setFileName(file.getOriginalFileName()); | |||
@@ -62,10 +62,10 @@ public class LeaveCreateReq { | |||
if (!this.getStartTime().isBefore(this.getEndTime())) { | |||
throw new BizException("无效的请假时间"); | |||
} | |||
if (leaveTypeEnum.equals(LeaveTypeEnum.FIXED_TERM)) { | |||
if (this.getFixedType() == null || this.getFixedType().isEmpty()) { | |||
if (leaveTypeEnum.equals(LeaveTypeEnum.FIXED_TERM) | |||
&& (this.getFixedType() == null || this.getFixedType().isEmpty())) { | |||
throw new BizException("固定时段不能为空"); | |||
} | |||
} | |||
} | |||
} | |||
@@ -7,15 +7,11 @@ 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.hz.pm.api.common.util.BizUtils; | |||
import com.hz.pm.api.common.util.StrUtils; | |||
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.model.constant.BizConst; | |||
import com.hz.pm.api.common.model.constant.CommonConst; | |||
import com.hz.pm.api.common.enumeration.CommonEnum; | |||
import com.hz.pm.api.common.util.BizUtils; | |||
import com.hz.pm.api.common.util.StrUtils; | |||
import com.hz.pm.api.performance.enumration.PerformanceTemplateTypeEnum; | |||
import com.hz.pm.api.performance.helper.TemplateDetailBuildHelper; | |||
import com.hz.pm.api.performance.model.dto.PerformanceIndicatorAppIndexSaveDTO; | |||
@@ -37,6 +33,10 @@ import com.hz.pm.api.performance.service.IPerformanceIndicatorProjectTemplateDet | |||
import com.hz.pm.api.performance.service.IPerformanceIndicatorProjectTemplateService; | |||
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; | |||
@@ -46,7 +46,6 @@ import org.springframework.transaction.annotation.Transactional; | |||
import java.math.BigDecimal; | |||
import java.time.LocalDateTime; | |||
import java.util.Arrays; | |||
import java.util.List; | |||
import java.util.Map; | |||
import java.util.Objects; | |||
@@ -148,7 +147,7 @@ public class IndicatorConfigManage { | |||
} | |||
if (Objects.nonNull(dto.getId())) { | |||
PerformanceIndicatorProjectTemplate old = indicatorProjectTemplateService.getById(dto.getId()); | |||
VUtils.isTrue(Objects.isNull(old)).throwMessage("该模板不存在!"); | |||
Assert.notNull(old, "该模板不存在!"); | |||
template.setId(old.getId()); | |||
} else { | |||
template.setId(null); | |||
@@ -4,30 +4,26 @@ 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.CollUtils; | |||
import com.ningdatech.basic.util.NdDateUtils; | |||
import com.hz.pm.api.common.model.constant.BizConst; | |||
import com.hz.pm.api.common.enumeration.ProjectProcessStageEnum; | |||
import com.hz.pm.api.common.helper.UserInfoHelper; | |||
import com.hz.pm.api.common.model.constant.BizConst; | |||
import com.hz.pm.api.common.util.ExcelDownUtil; | |||
import com.hz.pm.api.common.util.ExcelExportStyle; | |||
import com.hz.pm.api.projectdeclared.model.dto.DeclaredProjectExportDTO; | |||
import com.hz.pm.api.projectdeclared.model.dto.DelayedApplyDTO; | |||
import com.hz.pm.api.projectdeclared.model.vo.DelayedApplyVO; | |||
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.entity.Project; | |||
import com.hz.pm.api.projectlib.model.entity.ProjectDelayApply; | |||
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.INdProjectDelayApplyService; | |||
@@ -37,7 +33,13 @@ import com.hz.pm.api.staging.enums.MsgTypeEnum; | |||
import com.hz.pm.api.sys.manage.NoticeManage; | |||
import com.hz.pm.api.todocenter.constant.WorkNoticeConstant; | |||
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.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.wflow.bean.entity.WflowModels; | |||
import com.wflow.contants.HisProInsEndActId; | |||
import com.wflow.exception.BusinessException; | |||
@@ -94,12 +96,11 @@ public class DelayedApplyManage { | |||
* @return | |||
*/ | |||
public PageVo<ProjectLibListItemVO> projectLibList(ProjectListReq req) { | |||
UserFullInfoDTO user = userInfoHelper.getUserFullInfo(LoginUserUtil.getUserId()); | |||
VUtils.isTrue(Objects.isNull(user)).throwMessage("获取登录用户失败!"); | |||
UserInfoDetails user = LoginUserUtil.loginUserDetail(); | |||
LambdaQueryWrapper<Project> query = ProjectHelper.projectQuery(req); | |||
// 待终验 并且已经过期 | |||
// 只能看自己单位的 | |||
query.eq(Project::getBuildOrgCode, user.getMhUnitId()); | |||
query.eq(Project::getBuildOrgCode, user.getMhUnitIdStr()); | |||
query.eq(Project::getStatus, ProjectStatusEnum.TO_BE_FINALLY_INSPECTED.getCode()); | |||
query.eq(Project::getStage, ProjectStatusEnum.PROJECT_APPROVED.getCode()); | |||
query.lt(Project::getPlanAcceptanceTime, LocalDateTime.now()); | |||
@@ -148,12 +149,12 @@ public class DelayedApplyManage { | |||
.eq(ProjectInst::getInstCode, instCode)); | |||
Integer instType = projectInst.getInstType(); | |||
// 延期申请流程还未审核结束 | |||
if (InstTypeEnum.APPLY_DELAY.getCode().equals(instType) && | |||
if (InstTypeEnum.APPLY_DELAY.eq(instType) && | |||
Objects.isNull(newInstance.getEndActivityId())) { | |||
item.setCanDelayApply(Boolean.FALSE); | |||
} | |||
// 如果是延期申请审核被驳回,设置项目可以申请延期申报 | |||
else if (InstTypeEnum.APPLY_DELAY.getCode().equals(instType) && | |||
else if (InstTypeEnum.APPLY_DELAY.eq(instType) && | |||
HisProInsEndActId.REJECT.equals(newInstance.getEndActivityId())) { | |||
item.setCanDelayApply(Boolean.TRUE); | |||
} | |||
@@ -217,14 +218,13 @@ public class DelayedApplyManage { | |||
* @return | |||
*/ | |||
public String delayedApply(DelayedApplyDTO dto) { | |||
UserFullInfoDTO user = userInfoHelper.getUserFullInfo(LoginUserUtil.getUserId()); | |||
Long projectId = dto.getProjectId(); | |||
Project project = projectService.getNewProject(projectId); | |||
VUtils.isTrue(Objects.isNull(project)).throwMessage("提交失败 此项目不存在!"); | |||
Assert.notNull(project, "提交失败 此项目不存在!"); | |||
//首先要判断 项目当前状态 是不是 以终验 | |||
VUtils.isTrue(!ProjectStatusEnum.TO_BE_FINALLY_INSPECTED.getCode().equals(project.getStatus()) || | |||
!ProjectStatusEnum.PROJECT_APPROVED.getCode().equals(project.getStage())) | |||
VUtils.isTrue(!ProjectStatusEnum.TO_BE_FINALLY_INSPECTED.eq(project.getStatus()) || | |||
!ProjectStatusEnum.PROJECT_APPROVED.eq(project.getStage())) | |||
.throwMessage("提交失败 该项目不是 已立项|待终验"); | |||
VUtils.isTrue(Objects.isNull(project.getPlanAcceptanceTime()) | |||
@@ -242,14 +242,14 @@ public class DelayedApplyManage { | |||
*/ | |||
@Transactional(rollbackFor = Exception.class) | |||
public String startDelayedApplyProcess(DelayedApplyDTO dto) { | |||
UserFullInfoDTO user = userInfoHelper.getUserFullInfo(LoginUserUtil.getUserId()); | |||
UserInfoDetails user = LoginUserUtil.loginUserDetail(); | |||
Long projectId = dto.getProjectId(); | |||
Project project = projectService.getNewProject(projectId); | |||
VUtils.isTrue(Objects.isNull(project)).throwMessage("提交失败 此项目不存在!"); | |||
//首先要判断 项目当前状态 是不是 以终验 | |||
VUtils.isTrue(!ProjectStatusEnum.TO_BE_FINALLY_INSPECTED.getCode().equals(project.getStatus()) || | |||
!ProjectStatusEnum.PROJECT_APPROVED.getCode().equals(project.getStage())) | |||
VUtils.isTrue(!ProjectStatusEnum.TO_BE_FINALLY_INSPECTED.eq(project.getStatus()) || | |||
!ProjectStatusEnum.PROJECT_APPROVED.eq(project.getStage())) | |||
.throwMessage("提交失败 该项目不是 已立项|待终验"); | |||
VUtils.isTrue(Objects.isNull(project.getPlanAcceptanceTime()) | |||
@@ -1,19 +1,20 @@ | |||
package com.hz.pm.api.projectdeclared.manage; | |||
import cn.hutool.core.bean.BeanUtil; | |||
import com.baomidou.mybatisplus.core.toolkit.Assert; | |||
import com.baomidou.mybatisplus.core.toolkit.Wrappers; | |||
import com.ningdatech.basic.function.VUtils; | |||
import com.hz.pm.api.common.model.constant.BizConst; | |||
import com.hz.pm.api.common.statemachine.util.StateMachineUtil; | |||
import com.hz.pm.api.projectdeclared.model.dto.OperationDTO; | |||
import com.hz.pm.api.projectdeclared.model.entity.Operation; | |||
import com.hz.pm.api.projectdeclared.model.vo.OperationVO; | |||
import com.hz.pm.api.projectdeclared.service.IOperationService; | |||
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.enumeration.ProjectStatusEnum; | |||
import com.hz.pm.api.projectlib.service.IProjectService; | |||
import com.hz.pm.api.user.security.model.UserInfoDetails; | |||
import com.hz.pm.api.user.util.LoginUserUtil; | |||
import com.ningdatech.basic.function.VUtils; | |||
import lombok.RequiredArgsConstructor; | |||
import lombok.extern.slf4j.Slf4j; | |||
import org.springframework.stereotype.Component; | |||
@@ -40,31 +41,30 @@ public class OperationManage { | |||
/** | |||
* 获取实施详情 | |||
* | |||
* @param projectId | |||
* @return | |||
*/ | |||
public OperationVO detail(Long projectId) { | |||
Project project = projectService.getNewProject(projectId); | |||
VUtils.isTrue(Objects.isNull(project)) | |||
.throwMessage("项目不存在!"); | |||
Assert.notNull(project, "项目不存在!"); | |||
Operation operation = operationService.getOne(Wrappers.lambdaQuery(Operation.class) | |||
.eq(Operation::getProjectCode, project.getProjectCode()) | |||
.last(BizConst.LIMIT_1)); | |||
return BeanUtil.copyProperties(operation,OperationVO.class); | |||
return BeanUtil.copyProperties(operation, OperationVO.class); | |||
} | |||
public String pushOperation(OperationDTO operation) { | |||
UserInfoDetails user = LoginUserUtil.loginUserDetail(); | |||
Project project = projectService.getNewProject(operation.getProjectId()); | |||
VUtils.isTrue(Objects.isNull(project)) | |||
.throwMessage("项目不存在!"); | |||
Assert.notNull(project, "项目不存在!"); | |||
//首先要判断 项目当前状态 是不是 待开工状态 | |||
VUtils.isTrue(!ProjectStatusEnum.OPERATION.getCode().equals(project.getStatus()) || | |||
!ProjectStatusEnum.PROJECT_APPROVED.getCode().equals(project.getStage())) | |||
VUtils.isTrue(!ProjectStatusEnum.OPERATION.eq(project.getStatus()) || | |||
!ProjectStatusEnum.PROJECT_APPROVED.eq(project.getStage())) | |||
.throwMessage("提交失败 该项目不是 待开工或者已立项阶段"); | |||
Operation old = operationService.getOne(Wrappers.lambdaQuery(Operation.class) | |||
@@ -72,9 +72,9 @@ public class OperationManage { | |||
.last(BizConst.LIMIT_1)); | |||
Operation entity = BeanUtil.copyProperties(operation, Operation.class); | |||
if(Objects.nonNull(old)){ | |||
if (Objects.nonNull(old)) { | |||
entity.setId(old.getId()); | |||
}else{ | |||
} else { | |||
entity.setCreateOn(LocalDateTime.now()); | |||
entity.setCreateBy(user.getUsername()); | |||
} | |||
@@ -83,7 +83,7 @@ public class OperationManage { | |||
entity.setUpdateBy(user.getUsername()); | |||
//强制放入 计划终验时间 | |||
entity.setFinalInspectionDate(project.getPlanAcceptanceTime()); | |||
if(operationService.saveOrUpdate(entity)){ | |||
if (operationService.saveOrUpdate(entity)) { | |||
stateMachineUtil.pass(project); | |||
project.setUpdateOn(LocalDateTime.now()); | |||
projectService.updateById(project); | |||
@@ -2,6 +2,7 @@ package com.hz.pm.api.projectlib.manage; | |||
import cn.hutool.core.bean.BeanUtil; | |||
import cn.hutool.core.collection.CollUtil; | |||
import cn.hutool.core.lang.Assert; | |||
import com.alibaba.fastjson.JSON; | |||
import com.alibaba.fastjson.JSONArray; | |||
import com.alibaba.fastjson.JSONObject; | |||
@@ -75,8 +76,7 @@ public class ApplicationManage { | |||
public String saveAppCode(ApplicationAppCodeSaveDTO dto) { | |||
Long userId = LoginUserUtil.getUserId(); | |||
ProjectApplication app = applicationService.getById(dto.getId()); | |||
VUtils.isTrue(Objects.isNull(app)).throwMessage("该应用不存在"); | |||
Assert.notNull(app, "该应用不存在"); | |||
app.setAppCode(dto.getAppCode()); | |||
app.setUpdateOn(LocalDateTime.now()); | |||
app.setUpdateBy(userId); | |||
@@ -28,6 +28,7 @@ import org.springframework.http.ResponseEntity; | |||
import org.springframework.http.client.HttpComponentsClientHttpRequestFactory; | |||
import org.springframework.stereotype.Service; | |||
import org.springframework.web.client.RestTemplate; | |||
import javax.annotation.Resource; | |||
import java.util.Collections; | |||
import java.util.List; | |||
@@ -72,25 +73,25 @@ public class JoinReviewProvincialBureauServiceImpl implements IJoinReviewProvinc | |||
/** | |||
* 推送/保存 重大接口到 省局联审 | |||
* | |||
* @return | |||
*/ | |||
@Override | |||
public Boolean pushImportProject(ProvincialProjectDTO project){ | |||
Long timeStamp = System.currentTimeMillis()/1000; | |||
String url = provincialProperties.getHost() + provincialProperties.getPushUrl() | |||
+ "?timestamp=" + timeStamp; | |||
log.info("省局推送联审url {}",url); | |||
ResponseEntity<ProvinceApiResponse> responseEntity = null; | |||
public Boolean pushImportProject(ProvincialProjectDTO project) { | |||
Long timeStamp = System.currentTimeMillis() / 1000; | |||
String url = provincialProperties.getHost() + provincialProperties.getPushUrl() + "?timestamp=" + timeStamp; | |||
log.info("省局推送联审url {}", url); | |||
ResponseEntity<ProvinceApiResponse> responseEntity; | |||
String signature = getSha256(timeStamp,provincialProperties.getPushUrl(), | |||
HttpMethod.POST.name(),provincialProperties.getKey(),provincialProperties.getSecret()); | |||
String signature = getSha256(timeStamp, provincialProperties.getPushUrl(), | |||
HttpMethod.POST.name(), provincialProperties.getKey(), provincialProperties.getSecret()); | |||
//发送post请求 | |||
RequestEntity<ProvincialProjectDTO> requestEntity = RequestEntity | |||
.post(url) | |||
.header("Accept", MediaType.APPLICATION_JSON.toString()) | |||
.header("X-Hmac-Auth-Key",provincialProperties.getKey()) | |||
.header("X-Hmac-Auth-Signature",signature) | |||
.header("X-Hmac-Auth-Key", provincialProperties.getKey()) | |||
.header("X-Hmac-Auth-Signature", signature) | |||
.contentType(MediaType.APPLICATION_JSON) | |||
.accept(MediaType.APPLICATION_JSON) | |||
.body(project); | |||
@@ -99,8 +100,8 @@ public class JoinReviewProvincialBureauServiceImpl implements IJoinReviewProvinc | |||
log.info("省局联审 提交body :{}", JSON.toJSONString(requestEntity.getBody())); | |||
try { | |||
responseEntity = restTemplate.exchange(requestEntity, ProvinceApiResponse.class); | |||
log.info("省局联审 响应 :{}",responseEntity); | |||
if(responseEntity.getBody().getCode().equals(200)){ | |||
log.info("省局联审 响应 :{}", responseEntity); | |||
if (responseEntity.getBody().getCode().equals(200)) { | |||
return Boolean.TRUE; | |||
} | |||
} catch (Exception e) { | |||
@@ -112,37 +113,38 @@ public class JoinReviewProvincialBureauServiceImpl implements IJoinReviewProvinc | |||
/** | |||
* 获取流程审批详情 | |||
* | |||
* @param projectId | |||
* @return | |||
*/ | |||
@Override | |||
public SjApiResponse processInfo(String projectId) { | |||
Long timeStamp = System.currentTimeMillis()/1000; | |||
Long timeStamp = System.currentTimeMillis() / 1000; | |||
String url = provincialProperties.getHost() + provincialProperties.getDetailUrl() | |||
+ "?timestamp=" + timeStamp; | |||
log.info("省局获取审核详情 url {}",url); | |||
log.info("省局获取审核详情 url {}", url); | |||
ResponseEntity<SjApiResponse> responseEntity = null; | |||
String signature = getSha256(timeStamp,provincialProperties.getDetailUrl(), | |||
HttpMethod.POST.name(),provincialProperties.getKey(),provincialProperties.getSecret()); | |||
String signature = getSha256(timeStamp, provincialProperties.getDetailUrl(), | |||
HttpMethod.POST.name(), provincialProperties.getKey(), provincialProperties.getSecret()); | |||
JSONObject jsonBaby = new JSONObject(); | |||
jsonBaby.put("projectId",projectId); | |||
log.info("请求体 :{}",jsonBaby); | |||
jsonBaby.put("projectId", projectId); | |||
log.info("请求体 :{}", jsonBaby); | |||
//发送post请求 | |||
RequestEntity<JSONObject> requestEntity = RequestEntity | |||
.post(url) | |||
.header("Accept", MediaType.APPLICATION_JSON.toString()) | |||
.header("X-Hmac-Auth-Key",provincialProperties.getKey()) | |||
.header("X-Hmac-Auth-Signature",signature) | |||
.header("X-Hmac-Auth-Key", provincialProperties.getKey()) | |||
.header("X-Hmac-Auth-Signature", signature) | |||
.contentType(MediaType.APPLICATION_JSON) | |||
.accept(MediaType.APPLICATION_JSON) | |||
.body(jsonBaby); //也可以是DTO | |||
try { | |||
responseEntity = restTemplate.exchange(requestEntity,SjApiResponse.class); | |||
log.info("获取审批详情 响应 :{}",responseEntity); | |||
responseEntity = restTemplate.exchange(requestEntity, SjApiResponse.class); | |||
log.info("获取审批详情 响应 :{}", responseEntity); | |||
} catch (Exception e) { | |||
log.error("[省局获取审核详情] http request error", e); | |||
} | |||
@@ -153,42 +155,42 @@ public class JoinReviewProvincialBureauServiceImpl implements IJoinReviewProvinc | |||
@Override | |||
public List<ProvincialGovBusinessStripVO> searchGovUnits() { | |||
long timeStamp = System.currentTimeMillis(); | |||
Long timeSeconds = System.currentTimeMillis()/1000; | |||
Long timeSeconds = System.currentTimeMillis() / 1000; | |||
String appSecret = govAppSecret; | |||
String appKey = govAppKey; | |||
String method = HttpMethod.POST.name(); | |||
String secret = refreshTokenService.refreshToken(appKey,appSecret,govRequestTokenUrl,govRefreshTokenUrl,method); | |||
String secret = refreshTokenService.refreshToken(appKey, appSecret, govRequestTokenUrl, govRefreshTokenUrl, method); | |||
String sign = MD5.create().digestHex(appKey + secret + timeStamp); | |||
HttpComponentsClientHttpRequestFactory factory = HttpUtil.generateHttpRequestFactory(); | |||
RestTemplate restTemplate; | |||
if(Objects.nonNull(factory)){ | |||
if (Objects.nonNull(factory)) { | |||
restTemplate = new RestTemplate(factory); | |||
}else{ | |||
} else { | |||
restTemplate = new RestTemplate(); | |||
} | |||
String authSignature = getSha256(timeSeconds,provincialProperties.getDomainUrl(), HttpMethod.POST.name(), | |||
provincialProperties.getKey(),provincialProperties.getSecret()); | |||
String authSignature = getSha256(timeSeconds, provincialProperties.getDomainUrl(), HttpMethod.POST.name(), | |||
provincialProperties.getKey(), provincialProperties.getSecret()); | |||
String url = govUrl + "?appKey=" + appKey + | |||
"×tamp=" + timeSeconds + "&sign=" + sign + | |||
"&authKey=" + provincialProperties.getKey() + "&authSignature=" + authSignature + | |||
"&requestTime=" + timeStamp; | |||
log.info("gov search url :{}",url); | |||
ResponseEntity<JSONObject> forEntity = restTemplate.postForEntity(url,null, JSONObject.class, Maps.newHashMap()); | |||
log.info("gov search url :{}", url); | |||
ResponseEntity<JSONObject> forEntity = restTemplate.postForEntity(url, null, JSONObject.class, Maps.newHashMap()); | |||
JSONObject body = forEntity.getBody(); | |||
log.info("seach response :{}",body); | |||
if(Objects.isNull(body)){ | |||
log.info("seach response :{}", body); | |||
if (Objects.isNull(body)) { | |||
return Collections.emptyList(); | |||
} | |||
String code = body.getString(IrsContant.RefreshToken.RESPONSE_KEY_CODE); | |||
if(IrsContant.RefreshToken.SUCESS_CODE.equals(code)){ | |||
if (IrsContant.RefreshToken.SUCESS_CODE.equals(code)) { | |||
JSONObject datas = body.getJSONObject(IrsContant.RefreshToken.RESPONSE_KEY_DATAS); | |||
if(Objects.isNull(datas)){ | |||
if (Objects.isNull(datas)) { | |||
return Collections.emptyList(); | |||
} | |||
JSONArray jsonArray = datas.getJSONArray(BizConst.RESPONSE_KEY_DATA); | |||
if(CollUtil.isEmpty(jsonArray)){ | |||
if (CollUtil.isEmpty(jsonArray)) { | |||
return Collections.emptyList(); | |||
} | |||
return jsonArray.stream().map(j -> { | |||
@@ -203,11 +205,11 @@ public class JoinReviewProvincialBureauServiceImpl implements IJoinReviewProvinc | |||
return Collections.emptyList(); | |||
} | |||
private static String getSha256(Long timeStamp,String url,String method,String key,String secret){ | |||
private static String getSha256(Long timeStamp, String url, String method, String key, String secret) { | |||
String bytesToSign = method + StrUtil.LF + url + StrUtil.LF + timeStamp + StrUtil.LF + key; | |||
log.info("加密message :{}",bytesToSign); | |||
String res = SecureUtil.hmacSha256(secret).digestBase64(bytesToSign,false); | |||
log.info("加密结果 :{}",res); | |||
log.info("加密message :{}", bytesToSign); | |||
String res = SecureUtil.hmacSha256(secret).digestBase64(bytesToSign, false); | |||
log.info("加密结果 :{}", res); | |||
return res; | |||
} | |||
} |
@@ -8,7 +8,6 @@ import com.hz.pm.api.projectlib.model.enumeration.InstTypeEnum; | |||
import com.hz.pm.api.projectlib.model.enumeration.WarningFlowTypeEnum; | |||
import com.hz.pm.api.projectlib.model.enumeration.WarningOperationTypeEnum; | |||
import com.hz.pm.api.staging.enums.MsgTypeEnum; | |||
import com.hz.pm.api.staging.service.INdWorkNoticeStagingService; | |||
import com.hz.pm.api.sys.model.entity.Notify; | |||
import com.hz.pm.api.sys.model.entity.WflowEarlyWarningRecords; | |||
import com.hz.pm.api.sys.service.IEarlyWarningRecordsService; | |||
@@ -44,8 +43,6 @@ public class EarlyWarningManage { | |||
private final YxtCallOrSmsHelper yxtCallOrSmsHelper; | |||
private final INdWorkNoticeStagingService workNoticeStagingService; | |||
private final INotifyService notifyService; | |||
/** | |||
@@ -157,15 +154,6 @@ public class EarlyWarningManage { | |||
context.setContent(content); | |||
yxtCallOrSmsHelper.sendSms(context); | |||
} | |||
//4.浙政钉 | |||
/*if (noticeMethod.contains(String.valueOf(CommonEnum.ZWDD.getCode()))) { | |||
// 获取发送浙政钉工作通知必要信息 | |||
WorkNoticeInfo passWorkNoticeInfo = noticeManage.getSendWorkNoticeInfo(userId); | |||
passWorkNoticeInfo.setMsg(content); | |||
// 放入工作通知暂存表中,通过扫表异步发送 | |||
workNoticeStagingService.addByWorkNotice(passWorkNoticeInfo, MsgTypeEnum.PROJECT_REVIEW); | |||
}*/ | |||
} | |||
/** | |||
@@ -276,15 +264,6 @@ public class EarlyWarningManage { | |||
context.setContent(content); | |||
yxtCallOrSmsHelper.sendSms(context); | |||
} | |||
/*//4.浙政钉 | |||
if (noticeMethod.contains(String.valueOf(CommonEnum.ZWDD.getCode()))) { | |||
// 获取发送浙政钉工作通知必要信息 | |||
WorkNoticeInfo passWorkNoticeInfo = noticeManage.getSendWorkNoticeInfo(employeeCode); | |||
passWorkNoticeInfo.setMsg(content); | |||
// 放入工作通知暂存表中,通过扫表异步发送 | |||
workNoticeStagingService.addByWorkNotice(passWorkNoticeInfo, MsgTypeEnum.PROJECT_REVIEW); | |||
}*/ | |||
} | |||
/** | |||
@@ -217,10 +217,6 @@ public class NoticeManage { | |||
Notify notify = assemblyAuditNotify(userId, project, passMsg); | |||
notify.setType(msgTypeEnum.name()); | |||
notifyService.save(notify); | |||
// 放入工作通知暂存表中,通过扫表异步发送 | |||
// WorkNoticeInfo passWorkNoticeInfo = getSendWorkNoticeInfo(employeeCode); | |||
// passWorkNoticeInfo.setMsg(passMsg); | |||
// workNoticeStagingService.addByWorkNotice(passWorkNoticeInfo, msgTypeEnum); | |||
} | |||
/** | |||
@@ -4,6 +4,7 @@ import cn.hutool.core.bean.BeanUtil; | |||
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.core.toolkit.Wrappers; | |||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; | |||
import com.ningdatech.basic.function.VUtils; | |||
@@ -76,7 +77,7 @@ public class NotifyManage { | |||
public Boolean read(Long id) { | |||
Notify one = notifyService.getById(id); | |||
VUtils.isTrue(Objects.isNull(one)).throwMessage("该通知不存在"); | |||
Assert.notNull(one, "该通知不存在"); | |||
one.setReaded(Boolean.TRUE); | |||
return notifyService.updateById(one); | |||
} | |||