@@ -38,14 +38,16 @@ public class ExpertReviewController { | |||||
expertReviewManage.expertReview(req); | expertReviewManage.expertReview(req); | ||||
} | } | ||||
@GetMapping("/detail/{projectId}/{userId}") | |||||
@GetMapping("/detail/{meetingId}/{projectId}/{userId}") | |||||
@ApiOperation("获取专家评审详情") | @ApiOperation("获取专家评审详情") | ||||
@ApiImplicitParams({ | @ApiImplicitParams({ | ||||
@ApiImplicitParam(name = "userId", value = "专家ID"), | @ApiImplicitParam(name = "userId", value = "专家ID"), | ||||
@ApiImplicitParam(name = "projectId", value = "项目ID") | @ApiImplicitParam(name = "projectId", value = "项目ID") | ||||
}) | }) | ||||
public ExpertReviewDetailVO getExpertReviewDetail(@PathVariable Long userId, @PathVariable Long projectId) { | |||||
return expertReviewManage.getExpertReviewDetail(userId, projectId); | |||||
public ExpertReviewDetailVO getExpertReviewDetail(@PathVariable Long userId, | |||||
@PathVariable Long projectId, | |||||
@PathVariable Long meetingId) { | |||||
return expertReviewManage.getExpertReviewDetail(userId, projectId, meetingId); | |||||
} | } | ||||
@GetMapping("/listForGroupLeader/{projectId}/{meetingId}") | @GetMapping("/listForGroupLeader/{projectId}/{meetingId}") | ||||
@@ -65,12 +65,13 @@ public class ExpertReviewManage { | |||||
public void expertReview(ExpertReviewDetailReq req) { | public void expertReview(ExpertReviewDetailReq req) { | ||||
Long userId = LoginUserUtil.getUserId(); | Long userId = LoginUserUtil.getUserId(); | ||||
Long projectId = req.getProjectId(); | Long projectId = req.getProjectId(); | ||||
Long meetingId = req.getMeetingId(); | |||||
String expertReviewKey = buildExpertReviewKey(projectId, userId); | String expertReviewKey = buildExpertReviewKey(projectId, userId); | ||||
if (!distributedLock.lock(expertReviewKey)) { | if (!distributedLock.lock(expertReviewKey)) { | ||||
throw BizException.wrap("保存评审意见失败,请重试"); | throw BizException.wrap("保存评审意见失败,请重试"); | ||||
} | } | ||||
try { | try { | ||||
List<ExpertReview> reviews = expertReviewService.listByProjectIdAndExpertId(projectId, userId); | |||||
List<ExpertReview> reviews = expertReviewService.listByProjectIdAndExpertId(projectId, userId, meetingId); | |||||
if (req.getIsFinal()) { | if (req.getIsFinal()) { | ||||
if (reviews.isEmpty()) { | if (reviews.isEmpty()) { | ||||
throw BizException.wrap("请先填写个人评审意见"); | throw BizException.wrap("请先填写个人评审意见"); | ||||
@@ -109,8 +110,8 @@ public class ExpertReviewManage { | |||||
} | } | ||||
} | } | ||||
public ExpertReviewDetailVO getExpertReviewDetail(Long projectId, Long userId) { | |||||
List<ExpertReview> reviews = expertReviewService.listByProjectIdAndExpertId(projectId, userId); | |||||
public ExpertReviewDetailVO getExpertReviewDetail(Long projectId, Long userId, Long meetingId) { | |||||
List<ExpertReview> reviews = expertReviewService.listByProjectIdAndExpertId(projectId, userId, meetingId); | |||||
reviews.removeIf(ExpertReview::getIsFinal); | reviews.removeIf(ExpertReview::getIsFinal); | ||||
if (reviews.isEmpty()) { | if (reviews.isEmpty()) { | ||||
throw BizException.wrap("评审记录不存在"); | throw BizException.wrap("评审记录不存在"); | ||||
@@ -21,10 +21,11 @@ public interface IExpertReviewService extends IService<ExpertReview> { | |||||
* | * | ||||
* @param projectId 项目ID | * @param projectId 项目ID | ||||
* @param expertId 专家ID | * @param expertId 专家ID | ||||
* @param meetingId 会议ID | |||||
* @return 评审记录 | * @return 评审记录 | ||||
* @author WendyYang | * @author WendyYang | ||||
**/ | **/ | ||||
List<ExpertReview> listByProjectIdAndExpertId(Long projectId, Long expertId); | |||||
List<ExpertReview> listByProjectIdAndExpertId(Long projectId, Long expertId, Long meetingId); | |||||
/** | /** | ||||
* 获取最终评审结果 | * 获取最终评审结果 | ||||
@@ -25,10 +25,11 @@ import java.util.Map; | |||||
public class ExpertReviewServiceImpl extends ServiceImpl<ExpertReviewMapper, ExpertReview> implements IExpertReviewService { | public class ExpertReviewServiceImpl extends ServiceImpl<ExpertReviewMapper, ExpertReview> implements IExpertReviewService { | ||||
@Override | @Override | ||||
public List<ExpertReview> listByProjectIdAndExpertId(Long projectId, Long expertId) { | |||||
public List<ExpertReview> listByProjectIdAndExpertId(Long projectId, Long expertId, Long meetingId) { | |||||
LambdaQueryWrapper<ExpertReview> query = Wrappers.lambdaQuery(ExpertReview.class); | LambdaQueryWrapper<ExpertReview> query = Wrappers.lambdaQuery(ExpertReview.class); | ||||
query.eq(ExpertReview::getProjectId, projectId); | query.eq(ExpertReview::getProjectId, projectId); | ||||
query.eq(ExpertReview::getCreateBy, expertId); | query.eq(ExpertReview::getCreateBy, expertId); | ||||
query.eq(ExpertReview::getMeetingId, meetingId); | |||||
query.orderByAsc(ExpertReview::getCreateOn); | query.orderByAsc(ExpertReview::getCreateOn); | ||||
return list(query); | return list(query); | ||||
} | } | ||||
@@ -153,6 +153,13 @@ public class MeetingController { | |||||
meetingManage.confirmAttendByManager(req); | meetingManage.confirmAttendByManager(req); | ||||
} | } | ||||
@ApiOperation("专家移除") | |||||
@PostMapping("/expertRemove") | |||||
@WebLog(value = "专家移除") | |||||
public void expertRemove(@Valid @RequestBody ExpertRemoveReq req) { | |||||
meetingManage.expertRemove(req); | |||||
} | |||||
@ApiOperation("释放专家") | @ApiOperation("释放专家") | ||||
@PostMapping("/expert/release") | @PostMapping("/expert/release") | ||||
@WebLog(value = "释放专家") | @WebLog(value = "释放专家") | ||||
@@ -4,6 +4,8 @@ import io.swagger.annotations.ApiModel; | |||||
import io.swagger.annotations.ApiModelProperty; | import io.swagger.annotations.ApiModelProperty; | ||||
import lombok.Data; | import lombok.Data; | ||||
import javax.validation.constraints.NotNull; | |||||
/** | /** | ||||
* <p> | * <p> | ||||
* ExpertRemovePo | * ExpertRemovePo | ||||
@@ -13,15 +15,14 @@ import lombok.Data; | |||||
* @since 08:59 2022/8/10 | * @since 08:59 2022/8/10 | ||||
*/ | */ | ||||
@Data | @Data | ||||
@ApiModel("专家(移除/替换)实体") | |||||
@ApiModel("专家移除实体") | |||||
public class ExpertRemoveReq { | public class ExpertRemoveReq { | ||||
@NotNull(message = "会议ID不能为空") | |||||
@ApiModelProperty("会议ID") | @ApiModelProperty("会议ID") | ||||
private Long meetingId; | private Long meetingId; | ||||
@ApiModelProperty("专家ID") | |||||
private Long expertId; | |||||
@NotNull(message = "专家会议ID不能为空") | |||||
@ApiModelProperty("专家会议ID") | @ApiModelProperty("专家会议ID") | ||||
private Long expertMeetingId; | private Long expertMeetingId; | ||||
@@ -0,0 +1,28 @@ | |||||
package com.ningdatech.pmapi.meeting.entity.req; | |||||
import io.swagger.annotations.ApiModel; | |||||
import io.swagger.annotations.ApiModelProperty; | |||||
import lombok.Data; | |||||
/** | |||||
* <p> | |||||
* ExpertRemovePo | |||||
* </p> | |||||
* | |||||
* @author WendyYang | |||||
* @since 08:59 2022/8/10 | |||||
*/ | |||||
@Data | |||||
@ApiModel("专家替换实体") | |||||
public class ExpertReplaceReq { | |||||
@ApiModelProperty("会议ID") | |||||
private Long meetingId; | |||||
@ApiModelProperty("专家ID") | |||||
private Long expertId; | |||||
@ApiModelProperty("专家会议ID") | |||||
private Long expertMeetingId; | |||||
} |
@@ -36,6 +36,8 @@ public class MeetingDetailBasicVO { | |||||
@ApiModelProperty("会议类型名称") | @ApiModelProperty("会议类型名称") | ||||
private String typeName; | private String typeName; | ||||
private String regionCode; | |||||
@ApiModelProperty("会议类型代码") | @ApiModelProperty("会议类型代码") | ||||
private String meetingType; | private String meetingType; | ||||
@@ -450,7 +450,11 @@ public class ExpertInviteManage { | |||||
List<String> tmpUniqCompanyCodes = CollUtils.fieldList(agreeOrNoticingUserInfos, ExpertUserFullInfo::getCompanyUniqCode); | List<String> tmpUniqCompanyCodes = CollUtils.fieldList(agreeOrNoticingUserInfos, ExpertUserFullInfo::getCompanyUniqCode); | ||||
notInCompanyUniqCodeList.addAll(tmpUniqCompanyCodes); | notInCompanyUniqCodeList.addAll(tmpUniqCompanyCodes); | ||||
} | } | ||||
// 已请假的专家不再抽取 | |||||
List<MeetingExpert> expertsOnLeave = expertGroupByStatus.get(ON_LEAVE); | |||||
if (CollUtil.isNotEmpty(expertsOnLeave)) { | |||||
expertIdsNotIn.addAll(CollUtils.fieldList(expertsOnLeave, MeetingExpert::getExpertId)); | |||||
} | |||||
// 处理已拒绝专家与重复抽取 | // 处理已拒绝专家与重复抽取 | ||||
BizUtils.notEmpty(expertGroupByStatus.get(REFUSED), refuseExperts -> { | BizUtils.notEmpty(expertGroupByStatus.get(REFUSED), refuseExperts -> { | ||||
List<Long> tmpExpertIdsNotIn; | List<Long> tmpExpertIdsNotIn; | ||||
@@ -60,6 +60,7 @@ import java.util.function.BiFunction; | |||||
import java.util.stream.Collectors; | import java.util.stream.Collectors; | ||||
import static com.ningdatech.pmapi.meeting.entity.enumeration.ExpertAttendStatusEnum.*; | import static com.ningdatech.pmapi.meeting.entity.enumeration.ExpertAttendStatusEnum.*; | ||||
import static com.ningdatech.pmapi.meeting.entity.enumeration.ExpertInviteTypeEnum.APPOINT; | |||||
import static com.ningdatech.pmapi.meeting.helper.ExpertInviteHelper.getExpertInviteRule; | import static com.ningdatech.pmapi.meeting.helper.ExpertInviteHelper.getExpertInviteRule; | ||||
/** | /** | ||||
@@ -199,7 +200,7 @@ public class MeetingManage { | |||||
} | } | ||||
expertInviteTask.cancelByMeetingId(meetingId); | expertInviteTask.cancelByMeetingId(meetingId); | ||||
LambdaUpdateWrapper<Meeting> meetingUpdate = Wrappers.lambdaUpdate(Meeting.class) | LambdaUpdateWrapper<Meeting> meetingUpdate = Wrappers.lambdaUpdate(Meeting.class) | ||||
.set(Meeting::getInviteType, ExpertInviteTypeEnum.APPOINT.getCode()) | |||||
.set(Meeting::getInviteType, APPOINT.getCode()) | |||||
.eq(Meeting::getId, meetingId); | .eq(Meeting::getId, meetingId); | ||||
meetingService.update(meetingUpdate); | meetingService.update(meetingUpdate); | ||||
saveAppointRuleByConvertFromRandomRule(meetingId); | saveAppointRuleByConvertFromRandomRule(meetingId); | ||||
@@ -212,7 +213,7 @@ public class MeetingManage { | |||||
AppointInviteRuleDTO rule = new AppointInviteRuleDTO(); | AppointInviteRuleDTO rule = new AppointInviteRuleDTO(); | ||||
rule.setInviteDesc("转为指定抽取"); | rule.setInviteDesc("转为指定抽取"); | ||||
rule.setExpertIdList(Collections.emptyList()); | rule.setExpertIdList(Collections.emptyList()); | ||||
rule.setInviteType(ExpertInviteTypeEnum.APPOINT.getCode()); | |||||
rule.setInviteType(APPOINT.getCode()); | |||||
rule.setCount(0); | rule.setCount(0); | ||||
ExpertInviteRule inviteRule = new ExpertInviteRule(); | ExpertInviteRule inviteRule = new ExpertInviteRule(); | ||||
inviteRule.setMeetingId(meetingId); | inviteRule.setMeetingId(meetingId); | ||||
@@ -410,6 +411,7 @@ public class MeetingManage { | |||||
Assert.notNull(meeting, "会议不存在"); | Assert.notNull(meeting, "会议不存在"); | ||||
MeetingDetailBasicVO detail = MeetingDetailBasicVO.builder() | MeetingDetailBasicVO detail = MeetingDetailBasicVO.builder() | ||||
.meetingId(meeting.getId()) | .meetingId(meeting.getId()) | ||||
.regionCode(meeting.getRegionCode()) | |||||
.meetingName(meeting.getName()) | .meetingName(meeting.getName()) | ||||
.meetingType(meeting.getType()) | .meetingType(meeting.getType()) | ||||
.meetingAddress(meeting.getMeetingAddress()) | .meetingAddress(meeting.getMeetingAddress()) | ||||
@@ -481,7 +483,7 @@ public class MeetingManage { | |||||
item.setRuleId(me.getRuleId()); | item.setRuleId(me.getRuleId()); | ||||
item.setIsHeadman(me.getIsHeadman()); | item.setIsHeadman(me.getIsHeadman()); | ||||
ExpertInviteRule rule = ruleMap.get(me.getRuleId()); | ExpertInviteRule rule = ruleMap.get(me.getRuleId()); | ||||
item.setInviteType(rule == null ? ExpertInviteTypeEnum.APPOINT.getCode() : rule.getInviteType()); | |||||
item.setInviteType(rule == null ? APPOINT.getCode() : rule.getInviteType()); | |||||
if (NOTICING.eq(me.getStatus())) { | if (NOTICING.eq(me.getStatus())) { | ||||
item.setNoticeStatus("通知中"); | item.setNoticeStatus("通知中"); | ||||
} else { | } else { | ||||
@@ -577,6 +579,7 @@ public class MeetingManage { | |||||
}); | }); | ||||
AvoidRuleDTO avoidInfo = inviteAvoidRuleService.getAvoidInfoDto(meetingId); | AvoidRuleDTO avoidInfo = inviteAvoidRuleService.getAvoidInfoDto(meetingId); | ||||
AvoidInfoVO vo = new AvoidInfoVO(); | AvoidInfoVO vo = new AvoidInfoVO(); | ||||
vo.setWeekInviteCount(avoidInfo.getWeekInviteCount()); | |||||
vo.setAvoidOrgIds(avoidInfo.getAvoidOrgIdList()); | vo.setAvoidOrgIds(avoidInfo.getAvoidOrgIdList()); | ||||
vo.setAvoidUnitIds(avoidInfo.getAvoidUnitIdList()); | vo.setAvoidUnitIds(avoidInfo.getAvoidUnitIdList()); | ||||
if (CollUtil.isNotEmpty(vo.getAvoidOrgIds())) { | if (CollUtil.isNotEmpty(vo.getAvoidOrgIds())) { | ||||
@@ -590,7 +593,7 @@ public class MeetingManage { | |||||
} | } | ||||
result.setAvoidInfo(vo); | result.setAvoidInfo(vo); | ||||
} else { | } else { | ||||
List<ExpertInviteRule> appoints = groupByType.get(ExpertInviteTypeEnum.APPOINT); | |||||
List<ExpertInviteRule> appoints = groupByType.get(APPOINT); | |||||
ExpertInviteRule appoint = appoints.get(0); | ExpertInviteRule appoint = appoints.get(0); | ||||
AppointInviteRuleDTO appointRule = JSON.parseObject(appoint.getInviteRule(), AppointInviteRuleDTO.class); | AppointInviteRuleDTO appointRule = JSON.parseObject(appoint.getInviteRule(), AppointInviteRuleDTO.class); | ||||
appointRule.setId(appoint.getId()); | appointRule.setId(appoint.getId()); | ||||
@@ -610,7 +613,7 @@ public class MeetingManage { | |||||
} | } | ||||
try { | try { | ||||
Meeting meeting = meetingService.getById(meetingId); | Meeting meeting = meetingService.getById(meetingId); | ||||
if (!ExpertInviteTypeEnum.APPOINT.eq(meeting.getInviteType())) { | |||||
if (!APPOINT.eq(meeting.getInviteType())) { | |||||
throw BizException.wrap("该会议不能指定邀请专家"); | throw BizException.wrap("该会议不能指定邀请专家"); | ||||
} | } | ||||
if (meeting.getConfirmedRoster()) { | if (meeting.getConfirmedRoster()) { | ||||
@@ -713,6 +716,32 @@ public class MeetingManage { | |||||
} | } | ||||
} | } | ||||
public void expertRemove(ExpertRemoveReq req) { | |||||
String key = "EXPERT_REMOVE:" + req.getExpertMeetingId(); | |||||
if (!distributedLock.lock(key, RETRY_TIMES)) { | |||||
throw BizException.wrap("删除专家失败,请重试!"); | |||||
} | |||||
try { | |||||
Meeting meeting = meetingService.getById(req.getMeetingId()); | |||||
if (MeetingStatusEnum.CANCELED.eq(meeting.getStatus())) { | |||||
throw BizException.wrap("会议已取消!"); | |||||
} | |||||
if (LocalDateTime.now().isAfter(meeting.getStartTime())) { | |||||
throw BizException.wrap("会议已开始,不允许移除专家!"); | |||||
} | |||||
MeetingExpert expert = meetingExpertService.getById(req.getExpertMeetingId()); | |||||
if (!APPOINT.eq(expert.getInviteType())) { | |||||
throw BizException.wrap("随机抽取的专家不允许移除!"); | |||||
} | |||||
if (!NOTICING.eq(expert.getStatus())) { | |||||
throw BizException.wrap("已确认过的专家不允许移除!"); | |||||
} | |||||
meetingExpertService.removeById(req.getExpertMeetingId()); | |||||
} finally { | |||||
distributedLock.releaseLock(key); | |||||
} | |||||
} | |||||
public void releaseExperts(MeetingCancelReq req) { | public void releaseExperts(MeetingCancelReq req) { | ||||
String key = "EXPERT_RELEASE:" + req.getMeetingId(); | String key = "EXPERT_RELEASE:" + req.getMeetingId(); | ||||
if (!distributedLock.lock(key, RETRY_TIMES)) { | if (!distributedLock.lock(key, RETRY_TIMES)) { | ||||
@@ -39,7 +39,7 @@ public class ExpertInviteAvoidRuleServiceImpl extends ServiceImpl<ExpertInviteAv | |||||
avoidInfo.setAvoidOrgIdList(StrUtils.split(avoidRule.getAvoidOrgIds())); | avoidInfo.setAvoidOrgIdList(StrUtils.split(avoidRule.getAvoidOrgIds())); | ||||
avoidInfo.setAvoidUnitIdList(StrUtils.split(avoidRule.getAvoidUnitIds())); | avoidInfo.setAvoidUnitIdList(StrUtils.split(avoidRule.getAvoidUnitIds())); | ||||
avoidInfo.setExpertIds(BizUtils.splitToLong(avoidRule.getAvoidExpertIds())); | avoidInfo.setExpertIds(BizUtils.splitToLong(avoidRule.getAvoidExpertIds())); | ||||
avoidInfo.setWeekInviteCount(avoidInfo.getWeekInviteCount()); | |||||
avoidInfo.setWeekInviteCount(avoidRule.getWeekInviteCount()); | |||||
return avoidInfo; | return avoidInfo; | ||||
} | } | ||||
@@ -163,8 +163,9 @@ public class ConstructionPlanManage { | |||||
VUtils.isTrue(Objects.isNull(projectInfo)).throwMessage("提交失败 此项目不存在!"); | VUtils.isTrue(Objects.isNull(projectInfo)).throwMessage("提交失败 此项目不存在!"); | ||||
VUtils.isTrue(StringUtils.isBlank(projectDto.getConstructionPlanFile())).throwMessage("提交失败 请提交建设方案!"); | VUtils.isTrue(StringUtils.isBlank(projectDto.getConstructionPlanFile())).throwMessage("提交失败 请提交建设方案!"); | ||||
//直接先到待方案审批 | //直接先到待方案审批 | ||||
projectInfo.setStatus(ProjectStatusEnum.PLAN_TO_BE_DECLARED.getCode()); | |||||
projectService.updateById(projectInfo); | |||||
Project project = projectLibManage.saveProjectWithVersionAndStatus(projectDto,null, | |||||
ProjectStatusEnum.PLAN_TO_BE_DECLARED.getCode()); | |||||
dto.getProjectInfo().setId(project.getId()); | |||||
return startTheProcess(dto); | return startTheProcess(dto); | ||||
} | } | ||||
@@ -26,6 +26,7 @@ import com.ningdatech.pmapi.projectdeclared.utils.GenerateProjectCodeUtil; | |||||
import com.ningdatech.pmapi.projectlib.enumeration.ProjectStatusEnum; | import com.ningdatech.pmapi.projectlib.enumeration.ProjectStatusEnum; | ||||
import com.ningdatech.pmapi.projectlib.enumeration.ProjectTypeEnum; | import com.ningdatech.pmapi.projectlib.enumeration.ProjectTypeEnum; | ||||
import com.ningdatech.pmapi.projectlib.helper.ProjectHelper; | import com.ningdatech.pmapi.projectlib.helper.ProjectHelper; | ||||
import com.ningdatech.pmapi.projectlib.manage.ProjectLibManage; | |||||
import com.ningdatech.pmapi.projectlib.model.dto.ProjectDTO; | import com.ningdatech.pmapi.projectlib.model.dto.ProjectDTO; | ||||
import com.ningdatech.pmapi.projectlib.model.entity.Project; | import com.ningdatech.pmapi.projectlib.model.entity.Project; | ||||
import com.ningdatech.pmapi.projectlib.model.entity.ProjectApplication; | import com.ningdatech.pmapi.projectlib.model.entity.ProjectApplication; | ||||
@@ -73,7 +74,7 @@ public class DeclaredProjectManage { | |||||
private final IProjectService projectService; | private final IProjectService projectService; | ||||
private final IProjectApplicationService projectApplicationService; | |||||
private final ProjectLibManage projectLibManage; | |||||
private final IProjectDraftService projectDraftService; | private final IProjectDraftService projectDraftService; | ||||
@@ -81,8 +82,6 @@ public class DeclaredProjectManage { | |||||
private final ProcessModelService processModelService; | private final ProcessModelService processModelService; | ||||
private final IProjectInstService projectInstService; | |||||
private final DefaultDeclaredProjectManage defaultDeclaredProjectManage; | private final DefaultDeclaredProjectManage defaultDeclaredProjectManage; | ||||
private final NoticeManage noticeManage; | private final NoticeManage noticeManage; | ||||
@@ -90,7 +89,6 @@ public class DeclaredProjectManage { | |||||
private final UserInfoHelper userInfoHelper; | private final UserInfoHelper userInfoHelper; | ||||
private final RegionCacheHelper regionCacheHelper; | private final RegionCacheHelper regionCacheHelper; | ||||
private final GenerateProjectCodeUtil generateProjectCodeUtil; | |||||
/** | /** | ||||
* 新项目 启动实例 | * 新项目 启动实例 | ||||
@@ -131,6 +129,8 @@ public class DeclaredProjectManage { | |||||
projectInfo.setId(null); | projectInfo.setId(null); | ||||
} | } | ||||
// defaultDeclaredProjectManage.startProcess(projectInfo,user,ProjectProcessStageEnum.ORG_INTERNAL_APPROVAL_PROCESS.getCode()); | |||||
String regionCode = user.getRegionCode(); | String regionCode = user.getRegionCode(); | ||||
WflowModels model = processModelService.getOne(Wrappers.lambdaQuery(WflowModels.class) | WflowModels model = processModelService.getOne(Wrappers.lambdaQuery(WflowModels.class) | ||||
@@ -163,13 +163,15 @@ public class DeclaredProjectManage { | |||||
log.info("申报项目成功 【{}】", instanceId); | log.info("申报项目成功 【{}】", instanceId); | ||||
//如果是重新提交的话 判断下 项目是否存在 | //如果是重新提交的话 判断下 项目是否存在 | ||||
if(saveOrUpdateProject(projectInfo, instanceId,employeeCode) && Objects.nonNull(projectInfo.getDraftId())){ | |||||
//保存项目相关 | |||||
Project buildProject = projectLibManage.saveProjectInDeclared(projectInfo,instanceId,employeeCode); | |||||
if(Objects.nonNull(projectInfo.getDraftId())){ | |||||
//如果是草稿箱提交 删除对应的草稿箱 | //如果是草稿箱提交 删除对应的草稿箱 | ||||
projectDraftService.removeById(projectInfo.getDraftId()); | projectDraftService.removeById(projectInfo.getDraftId()); | ||||
} | } | ||||
//发送给第一个审批人消息 | //发送给第一个审批人消息 | ||||
noticeManage.sendFirtUser(project,model.getFormName(),instanceId, | |||||
noticeManage.sendFirtUser(buildProject,model.getFormName(),instanceId, | |||||
WorkNoticeContant.PASS_MSG_TEMPLATE, MsgTypeEnum.PROJECT_REVIEW); | WorkNoticeContant.PASS_MSG_TEMPLATE, MsgTypeEnum.PROJECT_REVIEW); | ||||
return instanceId; | return instanceId; | ||||
@@ -199,7 +201,10 @@ public class DeclaredProjectManage { | |||||
VUtils.isTrue(Objects.isNull(projectInfo)).throwMessage("提交失败 此项目不存在!"); | VUtils.isTrue(Objects.isNull(projectInfo)).throwMessage("提交失败 此项目不存在!"); | ||||
//项目名称去重 | //项目名称去重 | ||||
defaultDeclaredProjectManage.checkDuplication(projectDto); | |||||
if(StringUtils.isNotBlank(projectDto.getProjectName()) && | |||||
!projectDto.getProjectName().equals(projectInfo.getProjectName())){ | |||||
defaultDeclaredProjectManage.checkDuplication(projectDto); | |||||
} | |||||
//判断申报金额 是否等于总的 判断年度支付金额 是否等于总金额 | //判断申报金额 是否等于总的 判断年度支付金额 是否等于总金额 | ||||
defaultDeclaredProjectManage.checkAmount(projectDto); | defaultDeclaredProjectManage.checkAmount(projectDto); | ||||
@@ -233,68 +238,16 @@ public class DeclaredProjectManage { | |||||
String instanceId = processService.newStartProcess(model.getProcessDefId(),model.getFormId(), params,orgModelMap); | String instanceId = processService.newStartProcess(model.getProcessDefId(),model.getFormId(), params,orgModelMap); | ||||
log.info("重新申报项目成功 【{}】", instanceId); | log.info("重新申报项目成功 【{}】", instanceId); | ||||
//保存项目 | |||||
saveOrUpdateProject(projectDto,instanceId,employeeCode); | |||||
//保存项目相关 | |||||
Project buildProject = projectLibManage.saveProjectInDeclared(projectDto,instanceId,employeeCode); | |||||
//发送给第一个审批人消息 | //发送给第一个审批人消息 | ||||
noticeManage.sendFirtUser(project,model.getFormName(),instanceId, | |||||
noticeManage.sendFirtUser(buildProject,model.getFormName(),instanceId, | |||||
WorkNoticeContant.PASS_MSG_TEMPLATE, MsgTypeEnum.PROJECT_REVIEW); | WorkNoticeContant.PASS_MSG_TEMPLATE, MsgTypeEnum.PROJECT_REVIEW); | ||||
return instanceId; | return instanceId; | ||||
} | } | ||||
/** | |||||
* 申报项目 时 新增项目到项目库 | |||||
* | |||||
* @param projectDto | |||||
* @param instanceId | |||||
*/ | |||||
private Boolean saveOrUpdateProject(ProjectDTO projectDto, String instanceId, | |||||
String employeeCode) { | |||||
//流程启动之后 入库项目 重要业务信息 用于列表查询 展示 | |||||
try { | |||||
//保存项目表信息 | |||||
Project project = new Project(); | |||||
BeanUtils.copyProperties(projectDto, project); | |||||
project.setCreateOn(LocalDateTime.now()); | |||||
project.setUpdateOn(LocalDateTime.now()); | |||||
project.setStage(ProjectStatusEnum.NOT_APPROVED.getCode()); | |||||
project.setStatus(ProjectStatusEnum.UNDER_INTERNAL_AUDIT.getCode()); | |||||
project.setInstCode(instanceId); | |||||
project.setSponsor(employeeCode); | |||||
String projectCode = generateProjectCodeUtil.generateProjectCode(projectDto); | |||||
project.setProjectCode(projectCode); | |||||
projectService.saveOrUpdate(project); | |||||
//保存项目应用 | |||||
Boolean isApp = Objects.nonNull(projectDto.getIncludeApplication()) && 1 == projectDto.getIncludeApplication() | |||||
? Boolean.TRUE : Boolean.FALSE; | |||||
//采取批量删除 批量添加的方式 | |||||
projectApplicationService.remove(Wrappers.lambdaQuery(ProjectApplication.class) | |||||
.eq(ProjectApplication::getProjectId,project.getId())); | |||||
if (isApp && CollUtil.isNotEmpty(projectDto.getApplicationList())) { | |||||
List<ProjectApplication> applications = projectDto.getApplicationList().stream().map(application -> { | |||||
ProjectApplication projectApplication = new ProjectApplication(); | |||||
BeanUtils.copyProperties(application, projectApplication); | |||||
projectApplication.setProjectId(project.getId()); | |||||
return projectApplication; | |||||
}).collect(Collectors.toList()); | |||||
projectApplicationService.saveOrUpdateBatch(applications); | |||||
} | |||||
//保存项目和实例的关系 | |||||
ProjectInst projectInst = new ProjectInst(); | |||||
projectInst.setProjectId(project.getId()); | |||||
projectInst.setInstCode(instanceId); | |||||
projectInst.setCreatOn(LocalDateTime.now()); | |||||
projectInst.setUpdateOn(LocalDateTime.now()); | |||||
projectInst.setInstType(ProjectProcessStageEnum.ORG_INTERNAL_APPROVAL_PROCESS.getCode()); | |||||
projectInstService.save(projectInst); | |||||
} catch (Exception e) { | |||||
log.error("项目信息入库错误 " + e); | |||||
throw new BusinessException("项目信息入库错误 :" + e); | |||||
} | |||||
return Boolean.TRUE; | |||||
} | |||||
public PageVo<ProjectDraftVO> pageDraft(DeclaredProjectListParamDTO params) { | public PageVo<ProjectDraftVO> pageDraft(DeclaredProjectListParamDTO params) { | ||||
Long userId = LoginUserUtil.getUserId(); | Long userId = LoginUserUtil.getUserId(); | ||||
Page<ProjectDraft> page = params.page(); | Page<ProjectDraft> page = params.page(); | ||||
@@ -3,11 +3,12 @@ package com.ningdatech.pmapi.projectdeclared.manage; | |||||
import com.alibaba.fastjson.JSON; | import com.alibaba.fastjson.JSON; | ||||
import com.alibaba.fastjson.TypeReference; | import com.alibaba.fastjson.TypeReference; | ||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers; | import com.baomidou.mybatisplus.core.toolkit.Wrappers; | ||||
import com.google.common.collect.Maps; | |||||
import com.ningdatech.basic.function.VUtils; | import com.ningdatech.basic.function.VUtils; | ||||
import com.ningdatech.pmapi.common.constant.BizConst; | |||||
import com.ningdatech.pmapi.common.constant.RegionConst; | import com.ningdatech.pmapi.common.constant.RegionConst; | ||||
import com.ningdatech.pmapi.common.enumeration.ProjectProcessStageEnum; | |||||
import com.ningdatech.pmapi.common.helper.UserInfoHelper; | import com.ningdatech.pmapi.common.helper.UserInfoHelper; | ||||
import com.ningdatech.pmapi.organization.model.entity.DingOrganization; | |||||
import com.ningdatech.pmapi.organization.service.IDingOrganizationService; | |||||
import com.ningdatech.pmapi.projectdeclared.model.dto.DefaultDeclaredDTO; | import com.ningdatech.pmapi.projectdeclared.model.dto.DefaultDeclaredDTO; | ||||
import com.ningdatech.pmapi.projectdeclared.model.dto.ProjectConditionDTO; | import com.ningdatech.pmapi.projectdeclared.model.dto.ProjectConditionDTO; | ||||
import com.ningdatech.pmapi.projectdeclared.model.po.DeclaredProjectStatisticsPO; | import com.ningdatech.pmapi.projectdeclared.model.po.DeclaredProjectStatisticsPO; | ||||
@@ -17,13 +18,16 @@ import com.ningdatech.pmapi.projectlib.model.entity.Project; | |||||
import com.ningdatech.pmapi.projectlib.service.IProjectService; | import com.ningdatech.pmapi.projectlib.service.IProjectService; | ||||
import com.ningdatech.pmapi.user.security.auth.model.UserFullInfoDTO; | import com.ningdatech.pmapi.user.security.auth.model.UserFullInfoDTO; | ||||
import com.ningdatech.pmapi.user.util.LoginUserUtil; | import com.ningdatech.pmapi.user.util.LoginUserUtil; | ||||
import com.wflow.bean.entity.WflowModels; | |||||
import com.wflow.bean.entity.WflowOrgModels; | import com.wflow.bean.entity.WflowOrgModels; | ||||
import com.wflow.enums.OrgTypeEnum; | import com.wflow.enums.OrgTypeEnum; | ||||
import com.wflow.enums.ProcessDefTypeEnum; | import com.wflow.enums.ProcessDefTypeEnum; | ||||
import com.wflow.exception.BusinessException; | |||||
import com.wflow.service.OrgProcdefService; | import com.wflow.service.OrgProcdefService; | ||||
import com.wflow.workflow.bean.dto.OrgInfoDTO; | import com.wflow.workflow.bean.dto.OrgInfoDTO; | ||||
import com.wflow.workflow.bean.dto.ProcessInstanceUserDto; | import com.wflow.workflow.bean.dto.ProcessInstanceUserDto; | ||||
import com.wflow.workflow.bean.vo.ProcessStartParamsVo; | import com.wflow.workflow.bean.vo.ProcessStartParamsVo; | ||||
import com.wflow.workflow.service.ProcessModelService; | |||||
import lombok.RequiredArgsConstructor; | import lombok.RequiredArgsConstructor; | ||||
import lombok.extern.slf4j.Slf4j; | import lombok.extern.slf4j.Slf4j; | ||||
import org.springframework.beans.BeanUtils; | import org.springframework.beans.BeanUtils; | ||||
@@ -48,11 +52,40 @@ public class DefaultDeclaredProjectManage { | |||||
private final UserInfoHelper userInfoHelper; | private final UserInfoHelper userInfoHelper; | ||||
private final IDingOrganizationService dingOrganizationService; | |||||
private final ProcessModelService processModelService; | |||||
private final OrgProcdefService orgProcdefService; | private final OrgProcdefService orgProcdefService; | ||||
private final IDeclaredStatisticsService statisticsService; | private final IDeclaredStatisticsService statisticsService; | ||||
/** | |||||
* 公共的发起流程方法 | |||||
*/ | |||||
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())); | |||||
} | |||||
ProcessStartParamsVo params = new ProcessStartParamsVo(); | |||||
params.setUser(buildUser(user.getEmployeeCode())); | |||||
params.setProcessUsers(Collections.emptyMap()); | |||||
//放入条件判断的项目字段 | |||||
ProjectConditionDTO conditionDto = new ProjectConditionDTO(); | |||||
BeanUtils.copyProperties(projectDTO, conditionDto); | |||||
Map<String,Object> formData = Maps.newHashMap(); | |||||
formData.putAll( | |||||
JSON.parseObject(JSON.toJSONString(conditionDto), new TypeReference<Map<String, Object>>() { | |||||
}) | |||||
); | |||||
params.setFormData(formData); | |||||
} | |||||
//项目名称去重 | //项目名称去重 | ||||
public void checkDuplication(ProjectDTO project){ | public void checkDuplication(ProjectDTO project){ | ||||
VUtils.isTrue(projectService.count(Wrappers.lambdaQuery(Project.class) | VUtils.isTrue(projectService.count(Wrappers.lambdaQuery(Project.class) | ||||
@@ -9,6 +9,7 @@ import com.ningdatech.basic.function.VUtils; | |||||
import com.ningdatech.basic.model.PageVo; | import com.ningdatech.basic.model.PageVo; | ||||
import com.ningdatech.basic.util.CollUtils; | import com.ningdatech.basic.util.CollUtils; | ||||
import com.ningdatech.basic.util.NdDateUtils; | import com.ningdatech.basic.util.NdDateUtils; | ||||
import com.ningdatech.pmapi.common.constant.BizConst; | |||||
import com.ningdatech.pmapi.common.enumeration.ProjectProcessStageEnum; | import com.ningdatech.pmapi.common.enumeration.ProjectProcessStageEnum; | ||||
import com.ningdatech.pmapi.common.helper.UserInfoHelper; | import com.ningdatech.pmapi.common.helper.UserInfoHelper; | ||||
import com.ningdatech.pmapi.common.statemachine.util.StateMachineUtils; | import com.ningdatech.pmapi.common.statemachine.util.StateMachineUtils; | ||||
@@ -20,6 +21,7 @@ import com.ningdatech.pmapi.projectdeclared.model.req.PrequalificationDeclaredLi | |||||
import com.ningdatech.pmapi.projectlib.enumeration.ProjectStatusEnum; | import com.ningdatech.pmapi.projectlib.enumeration.ProjectStatusEnum; | ||||
import com.ningdatech.pmapi.projectlib.enumeration.ProjectTypeEnum; | import com.ningdatech.pmapi.projectlib.enumeration.ProjectTypeEnum; | ||||
import com.ningdatech.pmapi.projectlib.helper.ProjectHelper; | import com.ningdatech.pmapi.projectlib.helper.ProjectHelper; | ||||
import com.ningdatech.pmapi.projectlib.manage.ProjectLibManage; | |||||
import com.ningdatech.pmapi.projectlib.model.dto.ProjectDTO; | import com.ningdatech.pmapi.projectlib.model.dto.ProjectDTO; | ||||
import com.ningdatech.pmapi.projectlib.model.entity.Project; | import com.ningdatech.pmapi.projectlib.model.entity.Project; | ||||
import com.ningdatech.pmapi.projectlib.model.entity.ProjectInst; | import com.ningdatech.pmapi.projectlib.model.entity.ProjectInst; | ||||
@@ -65,6 +67,8 @@ public class PrequalificationDeclaredProjectManage { | |||||
private final IProjectService projectService; | private final IProjectService projectService; | ||||
private final ProjectLibManage projectLibManage; | |||||
private final StateMachineUtils stateMachineUtils; | private final StateMachineUtils stateMachineUtils; | ||||
private final IProjectStagingService projectStagingService; | private final IProjectStagingService projectStagingService; | ||||
@@ -156,9 +160,10 @@ public class PrequalificationDeclaredProjectManage { | |||||
VUtils.isTrue(Objects.isNull(projectDto.getId())).throwMessage("提交失败 缺少项目ID!"); | VUtils.isTrue(Objects.isNull(projectDto.getId())).throwMessage("提交失败 缺少项目ID!"); | ||||
Project projectInfo = projectService.getById(projectDto.getId()); | Project projectInfo = projectService.getById(projectDto.getId()); | ||||
VUtils.isTrue(Objects.isNull(projectInfo)).throwMessage("提交失败 此项目不存在!"); | VUtils.isTrue(Objects.isNull(projectInfo)).throwMessage("提交失败 此项目不存在!"); | ||||
//先回到 待预审状态 | |||||
projectInfo.setStatus(ProjectStatusEnum.PENDING_PREQUALIFICATION.getCode()); | |||||
projectService.updateById(projectInfo); | |||||
//重新提交 生成新版本号 回到 待预审状态 | |||||
Project project = projectLibManage.saveProjectWithVersionAndStatus(projectDto,null, | |||||
ProjectStatusEnum.PENDING_PREQUALIFICATION.getCode()); | |||||
dto.getProjectInfo().setId(project.getId()); | |||||
return startTheProcess(dto); | return startTheProcess(dto); | ||||
} | } | ||||
@@ -179,7 +184,7 @@ public class PrequalificationDeclaredProjectManage { | |||||
WflowModels model = processModelService.getOne(Wrappers.lambdaQuery(WflowModels.class) | WflowModels model = processModelService.getOne(Wrappers.lambdaQuery(WflowModels.class) | ||||
.eq(WflowModels::getRegionCode, regionCode) | .eq(WflowModels::getRegionCode, regionCode) | ||||
.eq(WflowModels::getProcessType, ProjectProcessStageEnum.PROJECT_PREQUALIFICATION_APPROVAL_PROCESS.getCode()) | .eq(WflowModels::getProcessType, ProjectProcessStageEnum.PROJECT_PREQUALIFICATION_APPROVAL_PROCESS.getCode()) | ||||
.last("limit 1")); | |||||
.last(BizConst.LIMIT_1)); | |||||
if (Objects.isNull(model)) { | if (Objects.isNull(model)) { | ||||
log.error("此 【{}】区域找不到 预审流程配置", regionCode); | log.error("此 【{}】区域找不到 预审流程配置", regionCode); | ||||
@@ -87,7 +87,8 @@ public class ProjectAdjustmentManage { | |||||
VUtils.isTrue(Objects.isNull(projectInfo)).throwMessage("调整失败 此项目不存在!"); | VUtils.isTrue(Objects.isNull(projectInfo)).throwMessage("调整失败 此项目不存在!"); | ||||
//项目名称去重 | //项目名称去重 | ||||
if(StringUtils.isNotBlank(projectDto.getProjectName())){ | |||||
if(StringUtils.isNotBlank(projectDto.getProjectName()) && | |||||
!projectDto.getProjectName().equals(projectInfo.getProjectName())){ | |||||
defaultDeclaredProjectManage.checkDuplication(projectDto); | defaultDeclaredProjectManage.checkDuplication(projectDto); | ||||
} | } | ||||
@@ -6,6 +6,7 @@ import com.ningdatech.file.service.FileService; | |||||
import com.ningdatech.pmapi.projectdeclared.converter.ApplicationConverter; | import com.ningdatech.pmapi.projectdeclared.converter.ApplicationConverter; | ||||
import com.ningdatech.pmapi.projectdeclared.model.dto.DefaultDeclaredDTO; | import com.ningdatech.pmapi.projectdeclared.model.dto.DefaultDeclaredDTO; | ||||
import com.ningdatech.pmapi.projectlib.enumeration.ProjectStatusEnum; | import com.ningdatech.pmapi.projectlib.enumeration.ProjectStatusEnum; | ||||
import com.ningdatech.pmapi.projectlib.manage.ProjectLibManage; | |||||
import com.ningdatech.pmapi.projectlib.model.dto.ProjectDTO; | import com.ningdatech.pmapi.projectlib.model.dto.ProjectDTO; | ||||
import com.ningdatech.pmapi.projectlib.model.entity.Project; | import com.ningdatech.pmapi.projectlib.model.entity.Project; | ||||
import com.ningdatech.pmapi.projectlib.model.entity.ProjectApplication; | import com.ningdatech.pmapi.projectlib.model.entity.ProjectApplication; | ||||
@@ -39,6 +40,8 @@ public class ReviewByProvincialDeptManage { | |||||
private final IProjectApplicationService applicationService; | private final IProjectApplicationService applicationService; | ||||
private final ProjectLibManage projectLibManage; | |||||
/** | /** | ||||
* 省级部门联审 | * 省级部门联审 | ||||
* @param project | * @param project | ||||
@@ -92,8 +95,8 @@ public class ReviewByProvincialDeptManage { | |||||
ApplicationConverter.convertProject(projectInfo,applications,fileService))){ | ApplicationConverter.convertProject(projectInfo,applications,fileService))){ | ||||
throw new BusinessException("提交省级部门联审失败"); | throw new BusinessException("提交省级部门联审失败"); | ||||
} | } | ||||
projectInfo.setStatus(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS.getCode()); | |||||
projectService.updateById(projectInfo); | |||||
projectInfo = projectLibManage.saveProjectWithVersionAndStatus(project,null, | |||||
ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS.getCode()); | |||||
return String.valueOf(projectInfo.getId()); | return String.valueOf(projectInfo.getId()); | ||||
} | } | ||||
} | } |
@@ -31,15 +31,15 @@ public class GenerateProjectCodeUtil { | |||||
@Autowired | @Autowired | ||||
private IProjectService projectService; | private IProjectService projectService; | ||||
public String generateProjectCode(ProjectDTO projectInfo){ | |||||
public String generateProjectCode(ProjectDTO project){ | |||||
// 获取所属行政区划代码(6位) | // 获取所属行政区划代码(6位) | ||||
String areaCode = projectInfo.getAreaCode(); | |||||
String areaCode = project.getAreaCode(); | |||||
// 获取建设年度后两位 | // 获取建设年度后两位 | ||||
String year = String.valueOf(projectInfo.getProjectYear() % DeclaredProjectContant.Project.YEAR_DRAW_SURPLUS); | |||||
String year = String.valueOf(project.getProjectYear() % DeclaredProjectContant.Project.YEAR_DRAW_SURPLUS); | |||||
// 9-12位固定 | // 9-12位固定 | ||||
String fixedNumber = DeclaredProjectContant.Project.FIXED_NUMBER; | String fixedNumber = DeclaredProjectContant.Project.FIXED_NUMBER; | ||||
// 获取公司的财政编码 | // 获取公司的财政编码 | ||||
CompanyFiscalCode companyFiscalCode = companyFiscalCodeService.getByOrganizationCode(projectInfo.getBuildOrgCode()); | |||||
CompanyFiscalCode companyFiscalCode = companyFiscalCodeService.getByOrganizationCode(project.getBuildOrgCode()); | |||||
// 从表中查出单位配置的财政编码 | // 从表中查出单位配置的财政编码 | ||||
if (Objects.isNull(companyFiscalCode)){ | if (Objects.isNull(companyFiscalCode)){ | ||||
@@ -51,8 +51,8 @@ public class GenerateProjectCodeUtil { | |||||
String projectIdStr; | String projectIdStr; | ||||
// 获取项目库当前最大项目序号 | // 获取项目库当前最大项目序号 | ||||
List<Project> projectList = projectService.list(Wrappers.lambdaQuery(Project.class).orderByDesc(Project::getId)); | List<Project> projectList = projectService.list(Wrappers.lambdaQuery(Project.class).orderByDesc(Project::getId)); | ||||
Project project = CollUtil.isEmpty(projectList) ? null : projectList.get(0); | |||||
Long projectId = Objects.isNull(project) ? DeclaredProjectContant.Project.MIN_PROJECT_ID : project.getId() + 1; | |||||
Project maxProject = CollUtil.isEmpty(projectList) ? null : projectList.get(0); | |||||
Long projectId = Objects.isNull(maxProject) ? DeclaredProjectContant.Project.MIN_PROJECT_ID : maxProject.getId() + 1; | |||||
if (projectId > DeclaredProjectContant.Project.MAX_PROJECT_ID){ | if (projectId > DeclaredProjectContant.Project.MAX_PROJECT_ID){ | ||||
// 超过999的项目号从1开始 1 | // 超过999的项目号从1开始 1 | ||||
Long newProjectId = projectId % DeclaredProjectContant.Project.MAX_PROJECT_ID; | Long newProjectId = projectId % DeclaredProjectContant.Project.MAX_PROJECT_ID; | ||||
@@ -111,6 +111,7 @@ public class AnnualPlanLibManage { | |||||
throw new BizException("请传入是否临时增补标志!"); | throw new BizException("请传入是否临时增补标志!"); | ||||
} | } | ||||
query.eq(Project::getIsTemporaryAugment, isTemporaryAugment); | query.eq(Project::getIsTemporaryAugment, isTemporaryAugment); | ||||
query.eq(Project::getNewest,Boolean.TRUE); | |||||
query.orderByDesc(Project::getAnnualPlanAddTime); | query.orderByDesc(Project::getAnnualPlanAddTime); | ||||
query.in(Project::getStatus, CollUtils.fieldList(ANNUAL_PLAN_LIST_STATUS, ProjectStatusEnum::getCode)); | query.in(Project::getStatus, CollUtils.fieldList(ANNUAL_PLAN_LIST_STATUS, ProjectStatusEnum::getCode)); | ||||
//数据权限 | //数据权限 | ||||
@@ -195,6 +196,7 @@ public class AnnualPlanLibManage { | |||||
param.setIsTemporaryAugment(isTemporaryAugment); | param.setIsTemporaryAugment(isTemporaryAugment); | ||||
param.setStatusList(CollUtils.fieldList(ANNUAL_PLAN_LIST_STATUS, ProjectStatusEnum::getCode)); | param.setStatusList(CollUtils.fieldList(ANNUAL_PLAN_LIST_STATUS, ProjectStatusEnum::getCode)); | ||||
LambdaQueryWrapper<Project> query = ProjectHelper.projectQuery(param); | LambdaQueryWrapper<Project> query = ProjectHelper.projectQuery(param); | ||||
query.eq(Project::getNewest,Boolean.TRUE); | |||||
query.orderByDesc(Project::getAnnualPlanAddTime); | query.orderByDesc(Project::getAnnualPlanAddTime); | ||||
List<Project> projects = projectService.list(query); | List<Project> projects = projectService.list(query); | ||||
@@ -1,38 +1,44 @@ | |||||
package com.ningdatech.pmapi.projectlib.manage; | package com.ningdatech.pmapi.projectlib.manage; | ||||
import cn.hutool.core.collection.CollUtil; | |||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | ||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers; | import com.baomidou.mybatisplus.core.toolkit.Wrappers; | ||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; | ||||
import com.google.common.collect.Lists; | import com.google.common.collect.Lists; | ||||
import com.ningdatech.basic.function.VUtils; | |||||
import com.ningdatech.basic.model.PageVo; | import com.ningdatech.basic.model.PageVo; | ||||
import com.ningdatech.basic.util.CollUtils; | import com.ningdatech.basic.util.CollUtils; | ||||
import com.ningdatech.file.entity.File; | import com.ningdatech.file.entity.File; | ||||
import com.ningdatech.file.service.FileService; | import com.ningdatech.file.service.FileService; | ||||
import com.ningdatech.pmapi.common.constant.CommonConst; | import com.ningdatech.pmapi.common.constant.CommonConst; | ||||
import com.ningdatech.pmapi.common.constant.RegionConst; | import com.ningdatech.pmapi.common.constant.RegionConst; | ||||
import com.ningdatech.pmapi.common.enumeration.CommonEnum; | |||||
import com.ningdatech.pmapi.common.enumeration.ProjectProcessStageEnum; | |||||
import com.ningdatech.pmapi.common.helper.RegionCacheHelper; | import com.ningdatech.pmapi.common.helper.RegionCacheHelper; | ||||
import com.ningdatech.pmapi.common.helper.UserInfoHelper; | import com.ningdatech.pmapi.common.helper.UserInfoHelper; | ||||
import com.ningdatech.pmapi.common.model.entity.ExcelExportWriter; | import com.ningdatech.pmapi.common.model.entity.ExcelExportWriter; | ||||
import com.ningdatech.pmapi.common.statemachine.util.StateMachineUtils; | |||||
import com.ningdatech.pmapi.common.util.BizUtils; | import com.ningdatech.pmapi.common.util.BizUtils; | ||||
import com.ningdatech.pmapi.common.util.ExcelDownUtil; | import com.ningdatech.pmapi.common.util.ExcelDownUtil; | ||||
import com.ningdatech.pmapi.datascope.model.DataScopeDTO; | import com.ningdatech.pmapi.datascope.model.DataScopeDTO; | ||||
import com.ningdatech.pmapi.datascope.utils.DataScopeUtil; | import com.ningdatech.pmapi.datascope.utils.DataScopeUtil; | ||||
import com.ningdatech.pmapi.projectdeclared.utils.GenerateProjectCodeUtil; | |||||
import com.ningdatech.pmapi.projectlib.enumeration.ProjectStatusEnum; | import com.ningdatech.pmapi.projectlib.enumeration.ProjectStatusEnum; | ||||
import com.ningdatech.pmapi.projectlib.handle.ProcessExecuteChainHandle; | import com.ningdatech.pmapi.projectlib.handle.ProcessExecuteChainHandle; | ||||
import com.ningdatech.pmapi.projectlib.helper.ProjectHelper; | import com.ningdatech.pmapi.projectlib.helper.ProjectHelper; | ||||
import com.ningdatech.pmapi.projectlib.model.dto.ProjectDTO; | |||||
import com.ningdatech.pmapi.projectlib.model.entity.Project; | import com.ningdatech.pmapi.projectlib.model.entity.Project; | ||||
import com.ningdatech.pmapi.projectlib.model.entity.ProjectApplication; | import com.ningdatech.pmapi.projectlib.model.entity.ProjectApplication; | ||||
import com.ningdatech.pmapi.projectlib.model.entity.ProjectInst; | |||||
import com.ningdatech.pmapi.projectlib.model.entity.ProjectRenewalFundDeclaration; | import com.ningdatech.pmapi.projectlib.model.entity.ProjectRenewalFundDeclaration; | ||||
import com.ningdatech.pmapi.projectlib.model.req.ProjectListReq; | import com.ningdatech.pmapi.projectlib.model.req.ProjectListReq; | ||||
import com.ningdatech.pmapi.projectlib.model.vo.AnnualAmountVO; | import com.ningdatech.pmapi.projectlib.model.vo.AnnualAmountVO; | ||||
import com.ningdatech.pmapi.projectlib.model.vo.ProjectDetailVO; | import com.ningdatech.pmapi.projectlib.model.vo.ProjectDetailVO; | ||||
import com.ningdatech.pmapi.projectlib.model.vo.ProjectLibListItemVO; | import com.ningdatech.pmapi.projectlib.model.vo.ProjectLibListItemVO; | ||||
import com.ningdatech.pmapi.projectlib.service.INdProjectStatusChangeService; | |||||
import com.ningdatech.pmapi.projectlib.service.IProjectApplicationService; | |||||
import com.ningdatech.pmapi.projectlib.service.IProjectRenewalFundDeclarationService; | |||||
import com.ningdatech.pmapi.projectlib.service.IProjectService; | |||||
import com.ningdatech.pmapi.projectlib.service.*; | |||||
import com.ningdatech.pmapi.user.security.auth.model.UserFullInfoDTO; | import com.ningdatech.pmapi.user.security.auth.model.UserFullInfoDTO; | ||||
import com.ningdatech.pmapi.user.util.LoginUserUtil; | import com.ningdatech.pmapi.user.util.LoginUserUtil; | ||||
import com.wflow.exception.BusinessException; | |||||
import com.wflow.workflow.bean.vo.ProcessDetailVO; | import com.wflow.workflow.bean.vo.ProcessDetailVO; | ||||
import lombok.RequiredArgsConstructor; | import lombok.RequiredArgsConstructor; | ||||
import lombok.extern.slf4j.Slf4j; | import lombok.extern.slf4j.Slf4j; | ||||
@@ -41,7 +47,9 @@ import org.springframework.beans.BeanUtils; | |||||
import org.springframework.stereotype.Component; | import org.springframework.stereotype.Component; | ||||
import javax.servlet.http.HttpServletResponse; | import javax.servlet.http.HttpServletResponse; | ||||
import java.time.LocalDateTime; | |||||
import java.util.*; | import java.util.*; | ||||
import java.util.stream.Collectors; | |||||
/** | /** | ||||
* <p> | * <p> | ||||
@@ -60,11 +68,14 @@ public class ProjectLibManage { | |||||
private final IProjectApplicationService applicationService; | private final IProjectApplicationService applicationService; | ||||
private final IProjectRenewalFundDeclarationService renewalFundDeclarationService; | private final IProjectRenewalFundDeclarationService renewalFundDeclarationService; | ||||
private final ProcessExecuteChainHandle processExecuteHandle; | private final ProcessExecuteChainHandle processExecuteHandle; | ||||
private final INdProjectStatusChangeService projectStatusChangeService; | |||||
private final RegionCacheHelper regionCacheHelper; | private final RegionCacheHelper regionCacheHelper; | ||||
private final FileService fileService; | private final FileService fileService; | ||||
private final UserInfoHelper userInfoHelper; | private final UserInfoHelper userInfoHelper; | ||||
private final IProjectApplicationService projectApplicationService; | |||||
private final GenerateProjectCodeUtil generateProjectCodeUtil; | |||||
private final IProjectInstService projectInstService; | |||||
private final StateMachineUtils stateMachineUtils; | |||||
public PageVo<ProjectLibListItemVO> projectLibList(ProjectListReq req) { | public PageVo<ProjectLibListItemVO> projectLibList(ProjectListReq req) { | ||||
LambdaQueryWrapper<Project> query = ProjectHelper.projectQuery(req); | LambdaQueryWrapper<Project> query = ProjectHelper.projectQuery(req); | ||||
@@ -96,6 +107,8 @@ public class ProjectLibManage { | |||||
public PageVo<ProjectLibListItemVO> projectLibListWithPermission(ProjectListReq req) { | public PageVo<ProjectLibListItemVO> projectLibListWithPermission(ProjectListReq req) { | ||||
LambdaQueryWrapper<Project> query = ProjectHelper.projectQuery(req); | LambdaQueryWrapper<Project> query = ProjectHelper.projectQuery(req); | ||||
UserFullInfoDTO user = buildProjectLibPermission(query); | UserFullInfoDTO user = buildProjectLibPermission(query); | ||||
//项目查最新 | |||||
query.eq(Project::getNewest,Boolean.TRUE); | |||||
Page<Project> page = projectService.page(req.page(), query); | Page<Project> page = projectService.page(req.page(), query); | ||||
long total; | long total; | ||||
if ((total = page.getTotal()) == 0) { | if ((total = page.getTotal()) == 0) { | ||||
@@ -133,6 +146,166 @@ 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); | |||||
//保存项目和实例的关系 | |||||
ProjectInst projectInst = new ProjectInst(); | |||||
projectInst.setProjectId(project.getId()); | |||||
projectInst.setInstCode(instanceId); | |||||
projectInst.setCreatOn(LocalDateTime.now()); | |||||
projectInst.setUpdateOn(LocalDateTime.now()); | |||||
projectInst.setInstType(ProjectProcessStageEnum.ORG_INTERNAL_APPROVAL_PROCESS.getCode()); | |||||
projectInstService.save(projectInst); | |||||
return project; | |||||
} | |||||
/** | |||||
* 申报新项目时 保存项目信息和其它相关联的信息 | |||||
* @param projectDto | |||||
* @param instanceId | |||||
* @param employeeCode | |||||
* @return | |||||
*/ | |||||
public Project saveProjectNewVersion(ProjectDTO projectDto, String instanceId, | |||||
String employeeCode) { | |||||
//流程启动之后 入库项目 重要业务信息 用于列表查询 展示 | |||||
try { | |||||
Project project = new Project(); | |||||
//为空 代表是新申报的 | |||||
if(Objects.isNull(projectDto.getId())){ | |||||
BeanUtils.copyProperties(projectDto, project); | |||||
project.setCreateOn(LocalDateTime.now()); | |||||
project.setUpdateOn(LocalDateTime.now()); | |||||
project.setStage(ProjectStatusEnum.NOT_APPROVED.getCode()); | |||||
project.setStatus(ProjectStatusEnum.UNDER_INTERNAL_AUDIT.getCode()); | |||||
project.setInstCode(instanceId); | |||||
project.setSponsor(employeeCode); | |||||
String projectCode = generateProjectCodeUtil.generateProjectCode(projectDto); | |||||
project.setProjectCode(projectCode); | |||||
projectService.save(project); | |||||
}else{ | |||||
//否则是重新提交的 新生成一个新版本的项目 | |||||
projectDto.setSponsor(employeeCode); | |||||
project = newProjectWithVersion(projectDto); | |||||
} | |||||
//保存项目应用 | |||||
Boolean isApp = Objects.nonNull(projectDto.getIncludeApplication()) && CommonEnum.YES.getCode().equals(projectDto.getIncludeApplication()) | |||||
? Boolean.TRUE : Boolean.FALSE; | |||||
//采取批量删除 批量添加的方式 | |||||
projectApplicationService.remove(Wrappers.lambdaQuery(ProjectApplication.class) | |||||
.eq(ProjectApplication::getProjectId,project.getId())); | |||||
if (isApp && CollUtil.isNotEmpty(projectDto.getApplicationList())) { | |||||
Project finalProject = project; | |||||
List<ProjectApplication> applications = projectDto.getApplicationList().stream().map(application -> { | |||||
ProjectApplication projectApplication = new ProjectApplication(); | |||||
BeanUtils.copyProperties(application, projectApplication); | |||||
projectApplication.setProjectId(finalProject.getId()); | |||||
return projectApplication; | |||||
}).collect(Collectors.toList()); | |||||
projectApplicationService.saveOrUpdateBatch(applications); | |||||
} | |||||
return project; | |||||
} catch (Exception e) { | |||||
log.error("项目信息入库错误 " + e); | |||||
throw new BusinessException("项目信息入库错误 :" + e); | |||||
} | |||||
} | |||||
/** | |||||
* 在其它项目阶段 保存项目信息和其它相关联的信息 | |||||
* @param projectDto | |||||
* @return | |||||
*/ | |||||
public Project reSaveProjectNewVersion(ProjectDTO projectDto) { | |||||
//流程启动之后 入库项目 重要业务信息 用于列表查询 展示 | |||||
try { | |||||
Project project = newProjectWithVersion(projectDto); | |||||
//保存项目应用 | |||||
Boolean isApp = Objects.nonNull(projectDto.getIncludeApplication()) && CommonEnum.YES.getCode().equals(projectDto.getIncludeApplication()) | |||||
? Boolean.TRUE : Boolean.FALSE; | |||||
//采取批量删除 批量添加的方式 | |||||
projectApplicationService.remove(Wrappers.lambdaQuery(ProjectApplication.class) | |||||
.eq(ProjectApplication::getProjectId,project.getId())); | |||||
if (isApp && CollUtil.isNotEmpty(projectDto.getApplicationList())) { | |||||
Project finalProject = project; | |||||
List<ProjectApplication> applications = projectDto.getApplicationList().stream().map(application -> { | |||||
ProjectApplication projectApplication = new ProjectApplication(); | |||||
BeanUtils.copyProperties(application, projectApplication); | |||||
projectApplication.setProjectId(finalProject.getId()); | |||||
return projectApplication; | |||||
}).collect(Collectors.toList()); | |||||
projectApplicationService.saveOrUpdateBatch(applications); | |||||
} | |||||
return project; | |||||
} catch (Exception e) { | |||||
log.error("项目信息入库错误 " + e); | |||||
throw new BusinessException("项目信息入库错误 :" + e); | |||||
} | |||||
} | |||||
/** | |||||
* 重新提交工作流时 舍弃在原有项目修改 | |||||
* 新增一个新的项目 新的版本号 | |||||
*/ | |||||
public Project newProjectWithVersion(ProjectDTO projecDto){ | |||||
Project project = projectService.getById(projecDto.getId()); | |||||
VUtils.isTrue(Objects.isNull(project)) | |||||
.throwMessage("项目不存在!"); | |||||
project.setVersion(project.getVersion() + 1); | |||||
BeanUtils.copyProperties(projecDto,project); | |||||
project.setId(null); | |||||
project.setCreateOn(LocalDateTime.now()); | |||||
project.setUpdateOn(LocalDateTime.now()); | |||||
stateMachineUtils.pass(project); | |||||
projectService.save(project); | |||||
projectService.update(Wrappers.lambdaUpdate(Project.class) | |||||
.set(Project::getNewest,Boolean.FALSE) | |||||
.ne(Project::getId,project.getId()) | |||||
.eq(Project::getProjectCode,project.getProjectCode())); | |||||
return project; | |||||
} | |||||
public Project saveProjectWithVersionAndStatus(ProjectDTO projecDto,Integer stageCode,Integer statusCode){ | |||||
Project project = projectService.getById(projecDto.getId()); | |||||
VUtils.isTrue(Objects.isNull(project)) | |||||
.throwMessage("项目不存在!"); | |||||
project.setVersion(project.getVersion() + 1); | |||||
BeanUtils.copyProperties(projecDto,project); | |||||
project.setId(null); | |||||
project.setCreateOn(LocalDateTime.now()); | |||||
project.setUpdateOn(LocalDateTime.now()); | |||||
if(Objects.nonNull(stageCode)){ | |||||
project.setStage(stageCode); | |||||
} | |||||
if(Objects.nonNull(statusCode)){ | |||||
project.setStatus(statusCode); | |||||
} | |||||
projectService.save(project); | |||||
projectService.update(Wrappers.lambdaUpdate(Project.class) | |||||
.set(Project::getNewest,Boolean.FALSE) | |||||
.ne(Project::getId,project.getId()) | |||||
.eq(Project::getProjectCode,project.getProjectCode())); | |||||
return project; | |||||
} | |||||
/** | |||||
* @param projectId 项目详情 | * @param projectId 项目详情 | ||||
* @return com.ningdatech.pmapi.projectlib.model.entity.vo.ProjectDetailVO | * @return com.ningdatech.pmapi.projectlib.model.entity.vo.ProjectDetailVO | ||||
* @author ZPF | * @author ZPF | ||||
@@ -199,6 +372,7 @@ public class ProjectLibManage { | |||||
param.setPageNumber(CommonConst.EXPORT_PAGE_NUMBER); | param.setPageNumber(CommonConst.EXPORT_PAGE_NUMBER); | ||||
param.setPageSize(CommonConst.EXPORT_PAGE_SIZE); | param.setPageSize(CommonConst.EXPORT_PAGE_SIZE); | ||||
LambdaQueryWrapper<Project> query = ProjectHelper.projectQuery(param); | LambdaQueryWrapper<Project> query = ProjectHelper.projectQuery(param); | ||||
query.eq(Project::getNewest,Boolean.TRUE); | |||||
List<Project> projects = projectService.list(query); | List<Project> projects = projectService.list(query); | ||||
ExcelExportWriter excelExportWriter = new ExcelExportWriter(); | ExcelExportWriter excelExportWriter = new ExcelExportWriter(); | ||||
@@ -282,6 +282,9 @@ public class ProjectDTO implements Serializable { | |||||
@ApiModelProperty("项目发起人 员工code") | @ApiModelProperty("项目发起人 员工code") | ||||
private String sponsor; | private String sponsor; | ||||
@ApiModelProperty("预审发起人 员工code") | |||||
private String preStartUserId; | |||||
@ApiModelProperty("上级条线单位审核意见") | @ApiModelProperty("上级条线单位审核意见") | ||||
private String higherLineSuperOrgReviewComments; | private String higherLineSuperOrgReviewComments; | ||||
@@ -324,4 +324,9 @@ public class Project implements Serializable { | |||||
@ApiModelProperty("省级联审 审批结果") | @ApiModelProperty("省级联审 审批结果") | ||||
private String sjlsResult; | private String sjlsResult; | ||||
@ApiModelProperty("版本号") | |||||
private Integer version; | |||||
@ApiModelProperty("是否是最新版本") | |||||
private Boolean newest; | |||||
} | } |
@@ -322,6 +322,12 @@ public class ProjectDetailVO { | |||||
@ApiModelProperty("省级联审 审批结果") | @ApiModelProperty("省级联审 审批结果") | ||||
private String sjlsResult; | private String sjlsResult; | ||||
@ApiModelProperty("版本号") | |||||
private Integer version; | |||||
@ApiModelProperty("是否是最新版本") | |||||
private Boolean newest; | |||||
private LocalDateTime createOn; | private LocalDateTime createOn; | ||||
private LocalDateTime updateOn; | private LocalDateTime updateOn; | ||||