Browse Source

modify:

1. 全流程提醒;
tags/24102401
WendyYang 2 months ago
parent
commit
8443e3a274
18 changed files with 519 additions and 58 deletions
  1. +4
    -0
      hz-pm-api/src/main/java/com/hz/pm/api/external/MhApiClient.java
  2. +9
    -9
      hz-pm-api/src/main/java/com/hz/pm/api/external/todo/MHTodoClient.java
  3. +63
    -11
      hz-pm-api/src/main/java/com/hz/pm/api/external/todo/enumerization/MHTodoTypeEnum.java
  4. +4
    -0
      hz-pm-api/src/main/java/com/hz/pm/api/meeting/manage/MeetingManage.java
  5. +7
    -1
      hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/ConstructionManage.java
  6. +4
    -0
      hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/FinalAcceptanceManage.java
  7. +6
    -0
      hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/OperationManage.java
  8. +5
    -0
      hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/ProjectReviewManage.java
  9. +23
    -8
      hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/PurchaseManage.java
  10. +6
    -0
      hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/service/IPurchaseInstService.java
  11. +7
    -8
      hz-pm-api/src/main/java/com/hz/pm/api/projectlib/manage/AmountApprovalManage.java
  12. +44
    -0
      hz-pm-api/src/main/java/com/hz/pm/api/scheduler/listener/MhTodoHandedListener.java
  13. +88
    -0
      hz-pm-api/src/main/java/com/hz/pm/api/scheduler/listener/MhTodoSendListener.java
  14. +85
    -21
      hz-pm-api/src/main/java/com/hz/pm/api/scheduler/listener/UserTaskCreateOrFinishListener.java
  15. +52
    -0
      hz-pm-api/src/main/java/com/hz/pm/api/scheduler/listener/event/MhTodoHandedEvent.java
  16. +58
    -0
      hz-pm-api/src/main/java/com/hz/pm/api/scheduler/listener/event/MhTodoSendEvent.java
  17. +53
    -0
      hz-pm-api/src/main/java/com/hz/pm/api/scheduler/task/MhTodoCloseTask.java
  18. +1
    -0
      hz-pm-api/src/main/java/com/hz/pm/api/sys/model/entity/MhTodoRecord.java

+ 4
- 0
hz-pm-api/src/main/java/com/hz/pm/api/external/MhApiClient.java View File

@@ -132,6 +132,10 @@ public class MhApiClient {
}

public boolean sendZwddWorkNotice(MhZwddWorkNoticeDTO notice) {
log.info("发送浙政钉工作通知:{}", notice);
if (environmentUtil.isDevEnv()) {
return Boolean.TRUE;
}
notice.setClientId(zwddWorkNoticeClientId);
notice.setClientSecret(zwddWorkNoticeClientSecret);
String retBody = HttpUtil.post(mhApiHost + ZWDD_MSG_URL, JSONUtil.toJsonStr(notice));


+ 9
- 9
hz-pm-api/src/main/java/com/hz/pm/api/external/todo/MHTodoClient.java View File

@@ -68,11 +68,6 @@ public class MHTodoClient {

@Transactional(rollbackFor = Exception.class)
public void addTodo(Object paramObj, UserFullInfoDTO receiver, MHTodoTypeEnum type, String bizId, String content) {
log.info("发送信产待办:【{}({})】类型:{} 内容:{}", receiver.getRealName(), receiver.getMhUserId(), type, content);
if (environmentUtil.isDevEnv()) {
return;
}
String url = mhApiHost + TODO_ADD;
String paramObjs = JSON.toJSONString(paramObj);
MhTodoRequestDTO todoReq = MhTodoRequestDTO.builder()
.wkContent(content)
@@ -80,7 +75,11 @@ public class MHTodoClient {
.params(paramObjs)
.wkUser(receiver.getMhUserId())
.build();
log.info("添加新创待办:{}", todoReq);
log.info("发送信产待办:{}", todoReq);
if (environmentUtil.isDevEnv()) {
return;
}
String url = mhApiHost + TODO_ADD;
String responseResult = HttpUtil.post(url, JSON.toJSONString(todoReq));
MhTodoRetDTO retData = JSON.parseObject(responseResult, TYPE_REF);
if (retData.getCode() != 200 || StrUtil.isBlank(retData.getData())) {
@@ -104,9 +103,9 @@ public class MHTodoClient {
*
* @param wkhandleId 待办ID
*/
private void complete(String wkhandleId) {
public boolean complete(String wkhandleId) {
if (environmentUtil.isDevEnv()) {
return;
return Boolean.TRUE;
}
String url = mhApiHost + TODO_COMPLETE;
// 发送PUT请求
@@ -117,9 +116,10 @@ public class MHTodoClient {
boolean state = Boolean.parseBoolean(retData.getData());
if (!state) {
log.error("待办完成失败:{} {}", wkhandleId, retData);
return Boolean.FALSE;
}
}
return Boolean.TRUE;
}




+ 63
- 11
hz-pm-api/src/main/java/com/hz/pm/api/external/todo/enumerization/MHTodoTypeEnum.java View File

@@ -16,19 +16,71 @@ import lombok.Getter;
@SuppressWarnings("all")
public enum MHTodoTypeEnum {

SELF_TEST_AUDIT("系统自测审批", "instanceId=${instanceId}&projectId=${projectId}&nodeId=${nodeId}&taskId=${taskId}&bidId=${bizId}&userId=${userId}&userName=${userName}&path=${path}"),
ADAPTION_AUDIT("开工文件审批", "instanceId=${instanceId}&projectId=${projectId}&nodeId=${nodeId}&taskId=${taskId}&bidId=${bizId}&userId=${userId}&userName=${userName}&path=${path}"),
TEST_VALID_AUDIT("监理核实验证审批", "instanceId=${instanceId}&projectId=${projectId}&nodeId=${nodeId}&taskId=${taskId}&bidId=${bizId}&userId=${userId}&userName=${userName}&path=${path}"),
COMPLIANCE_REVIEW_AUDIT("合规性审查审批", "instanceId=${instanceId}&projectId=${projectId}&nodeId=${nodeId}&taskId=${taskId}&bidId=${bizId}&userId=${userId}&userName=${userName}&path=${path}"),
PROJECT_REVIEW_AUDIT("项目评审审批", "instanceId=${instanceId}&projectId=${projectId}&nodeId=${nodeId}&taskId=${taskId}&bidId=${bizId}&userId=${userId}&userName=${userName}&path=${path}"),
PROJECT_STOPPED_AUDIT("项目终止审批", "instanceId=${instanceId}&projectId=${projectId}&nodeId=${nodeId}&taskId=${taskId}&bidId=${bizId}&userId=${userId}&userName=${userName}&path=${path}"),
PROJECT_CHANGE_AUDIT("项目变更审批", "instanceId=${instanceId}&projectId=${projectId}&nodeId=${nodeId}&taskId=${taskId}&bidId=${bizId}&userId=${userId}&userName=${userName}&path=${path}"),
FINAL_INSPECT_AUDIT("终验审批", "instanceId=${instanceId}&projectId=${projectId}&nodeId=${nodeId}&taskId=${taskId}&bidId=${bizId}&userId=${userId}&userName=${userName}&path=${path}"),
XCFHX_INSPECT_AUDIT("信创符合性审查审批", "instanceId=${instanceId}&projectId=${projectId}&nodeId=${nodeId}&taskId=${taskId}&bidId=${bizId}&userId=${userId}&userName=${userName}&path=${path}&xinchuangId={xinchuangId}"),
DECLARED_RECORD_APPLY("立项备案申请", "mhProjectId=${mhProjectId}&status=${status}&projectCode=${projectCode}&projectId=${projectId}&userId=${userId}&userName=${userName}&path=${path}"),
DECLARED_RECORD_AUDIT("立项备案审批", "instanceId=${instanceId}&projectId=${projectId}&nodeId=${nodeId}&taskId=${taskId}&bidId=${bizId}&userId=${userId}&userName=${userName}&path=${path}");
SELF_TEST_APPLY("系统自测", null,
"您单位的【%s】开工文件备案已通过,可在过程管理-适配改造中进行提交系统自测信息的操作。",
"【%s】系统自测信息需要您处理,请及时处理", null, null),
TEST_VALID_APPLY("监理核实验证", null, "您单位的【%s】系统自测备案已通过,可在过程管理-适配改造中进行填写监理核实验证信息的操作。",
"【%s】监理核实验证需要您处理,请及时处理", null, null),
FINAL_INSPECT_APPLY("终验申请", null, "您单位的【%s】已完成初验备案,可在过程管理-终验申请中进行终验申请的操作。",
"【%s】终验申请需要您处理,请及时处理", null, null),
ADAPTION_APPLY("上传开工文件", null, "您单位的【%s】已完成实施计划填写,可在过程管理-适配改造中进行上传开工文件的操作。",
"【%s】上传开工文件需要您处理,请及时处理", null, null),
PROJECT_REVIEW_APPLY("项目复核", null, "您单位的【%s】的专家评审已通过,可在过程管理-项目评审-项目复核中进行提交复核的操作。",
"【%s】项目复核需要您处理,请及时处理", null, null),
WITHOUT_BUILD_SCHEME("上传建设方案盖章件", null, "您单位的【%s】的合规性审査已通过,可在过程管理-项目评审-专家评审中进行上传建设方案盖章件的操作。",
"【%s】上传建设方案盖章件需要您处理,请及时处理", null, null),
WITHOUT_PURCHASE_NOTICE("发布采购公告", null, "您单位的【%s】立项备案已通过,可在过程管理-招标采购中进行发布采购公告的操作。",
"【%s】发布采购公告需要您处理,请及时处理", null, null),
WITHOUT_PURCHASE_CONTRACT("采购&合同信息备案", null, "您单位的【%s】已完成发布采购公告,可在过程管理-招标采购中进行采购&合同信息备案的操作。",
"【%s】采购&合同信息备案需要您处理,请及时处理", null, null),
WITHOUT_OPERATION_PLAN("实施计划填写", null, "您单位的【%s】已完成采购&合同信息备案,可在过程管理-适配改造中进行填写实施计划的操作。",
"【%s】实施计划需要您处理,请及时处理", null, null),
WITHOUT_FIRST_ACCEPT_RECORD("初验备案", null, "您单位的【%s】已完成适配改造,可在过程管理-初验申请中进行初验备案的操作。",
"【%s】初验备案需要您处理,请及时处理", null, null),
WITHOUT_ORG_CONFIRM("单位确认", null, "您单位的【%s】监理核实验证备案已通过,可在过程管理-适配改造中进行单位确认的操作。",
"【%s】单位确认需要您处理,请及时处理", null, null),
DECLARED_RECORD_APPLY("立项备案申请", null, "您单位的【%s】已下达资金,可在过程管理-项目立项中进行立项备案的操作。",
"【%s】立项备案需要您处理,请及时处理", null,
"mhProjectId=${mhProjectId}&status=${status}&projectCode=${projectCode}&projectId=${projectId}&userId=${userId}&userName=${userName}&path=${path}"),
/**
* 流程审批待办
*/

SELF_TEST_AUDIT("系统自测审批", TEST_VALID_APPLY, null, null, null,
"instanceId=${instanceId}&projectId=${projectId}&nodeId=${nodeId}&taskId=${taskId}&bidId=${bizId}&userId=${userId}&userName=${userName}&path=${path}"),
ADAPTION_AUDIT("开工文件审批", SELF_TEST_APPLY, null, null, null,
"instanceId=${instanceId}&projectId=${projectId}&nodeId=${nodeId}&taskId=${taskId}&bidId=${bizId}&userId=${userId}&userName=${userName}&path=${path}"),
TEST_VALID_AUDIT("监理核实验证审批", WITHOUT_ORG_CONFIRM, null, null, null,
"instanceId=${instanceId}&projectId=${projectId}&nodeId=${nodeId}&taskId=${taskId}&bidId=${bizId}&userId=${userId}&userName=${userName}&path=${path}"),
COMPLIANCE_REVIEW_AUDIT("合规性审查审批", WITHOUT_BUILD_SCHEME, null, null, null,
"instanceId=${instanceId}&projectId=${projectId}&nodeId=${nodeId}&taskId=${taskId}&bidId=${bizId}&userId=${userId}&userName=${userName}&path=${path}"),
PROJECT_REVIEW_AUDIT("项目复核审批", null, null, null, null,
"instanceId=${instanceId}&projectId=${projectId}&nodeId=${nodeId}&taskId=${taskId}&bidId=${bizId}&userId=${userId}&userName=${userName}&path=${path}"),
PROJECT_STOPPED_AUDIT("项目终止审批", null, "您单位的【%s】已通过项目终止审核。", null, null,
"instanceId=${instanceId}&projectId=${projectId}&nodeId=${nodeId}&taskId=${taskId}&bidId=${bizId}&userId=${userId}&userName=${userName}&path=${path}"),
PROJECT_CHANGE_AUDIT("项目变更审批", null, "您单位的【%s】已通过项目变更审核。", null, null,
"instanceId=${instanceId}&projectId=${projectId}&nodeId=${nodeId}&taskId=${taskId}&bidId=${bizId}&userId=${userId}&userName=${userName}&path=${path}"),
FINAL_INSPECT_AUDIT("终验审批", null, "您单位的【%s】已通过终验审核。", null, null,
"instanceId=${instanceId}&projectId=${projectId}&nodeId=${nodeId}&taskId=${taskId}&bidId=${bizId}&userId=${userId}&userName=${userName}&path=${path}"),
XCFHX_INSPECT_AUDIT("信创符合性审查审批", WITHOUT_BUILD_SCHEME, null, null, null,
"instanceId=${instanceId}&projectId=${projectId}&nodeId=${nodeId}&taskId=${taskId}&bidId=${bizId}&userId=${userId}&userName=${userName}&path=${path}&xinchuangId={xinchuangId}"),
DECLARED_RECORD_AUDIT("立项备案审批", WITHOUT_PURCHASE_NOTICE, null, null, null,
"instanceId=${instanceId}&projectId=${projectId}&nodeId=${nodeId}&taskId=${taskId}&bidId=${bizId}&userId=${userId}&userName=${userName}&path=${path}");

private final String val;


private final MHTodoTypeEnum nextStep;

private final String zwddMsg;

private final String todoMsg;

/**
* 当前环节发页路径
*/
private final String pagePath;

private final String referLinkParam;

}

+ 4
- 0
hz-pm-api/src/main/java/com/hz/pm/api/meeting/manage/MeetingManage.java View File

@@ -5,6 +5,7 @@ import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import cn.hutool.crypto.SecureUtil;
import cn.hutool.extra.spring.SpringUtil;
import cn.hutool.json.JSONUtil;
import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
@@ -22,6 +23,7 @@ import com.hz.pm.api.common.util.EnvironmentUtil;
import com.hz.pm.api.expert.entity.ExpertUserFullInfo;
import com.hz.pm.api.expert.service.IExpertUserFullInfoService;
import com.hz.pm.api.external.MhApiClient;
import com.hz.pm.api.external.todo.enumerization.MHTodoTypeEnum;
import com.hz.pm.api.gov.service.IBelongOrgService;
import com.hz.pm.api.meeting.builder.ExpertInviteBuilder;
import com.hz.pm.api.meeting.builder.MeetingReviewProjectBuilder;
@@ -48,6 +50,7 @@ import com.hz.pm.api.projectlib.helper.ProjectManageUtil;
import com.hz.pm.api.projectlib.model.entity.Project;
import com.hz.pm.api.projectlib.model.enumeration.status.ProjectStatus;
import com.hz.pm.api.projectlib.service.IProjectService;
import com.hz.pm.api.scheduler.listener.event.MhTodoSendEvent;
import com.hz.pm.api.sys.model.dto.RegionDTO;
import com.hz.pm.api.sys.model.entity.MsgCallRecord;
import com.hz.pm.api.sys.model.enumeration.SubmitTypeEnum;
@@ -1162,6 +1165,7 @@ public class MeetingManage {
Project project = projectService.getById(mip.getProjectId());
if (req.getReviewResult() == 1) {
projectStateMachineUtil.pass(project);
SpringUtil.publishEvent(MhTodoSendEvent.of(MHTodoTypeEnum.PROJECT_REVIEW_APPLY, project));
} else {
projectStateMachineUtil.reject(project);
}


+ 7
- 1
hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/ConstructionManage.java View File

@@ -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.extra.spring.SpringUtil;
import com.alibaba.excel.EasyExcel;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
@@ -19,6 +20,7 @@ import com.hz.pm.api.common.statemachine.util.XcfhxStateMachineUtil;
import com.hz.pm.api.common.util.ExcelDownUtil;
import com.hz.pm.api.common.util.ExcelExportStyle;
import com.hz.pm.api.common.util.StrUtils;
import com.hz.pm.api.external.todo.enumerization.MHTodoTypeEnum;
import com.hz.pm.api.projectdeclared.helper.MhXchxFileHelper;
import com.hz.pm.api.projectdeclared.model.dto.DeclaredProjectExportDTO;
import com.hz.pm.api.projectdeclared.model.dto.PaymentPlanSupplementDTO;
@@ -43,6 +45,8 @@ import com.hz.pm.api.projectlib.model.vo.TenderListInfoVO;
import com.hz.pm.api.projectlib.service.IProjectAnnualPaymentPlanService;
import com.hz.pm.api.projectlib.service.IProjectInstService;
import com.hz.pm.api.projectlib.service.IProjectService;
import com.hz.pm.api.scheduler.listener.event.MhTodoHandedEvent;
import com.hz.pm.api.scheduler.listener.event.MhTodoSendEvent;
import com.hz.pm.api.sys.manage.ProcessModelManage;
import com.hz.pm.api.user.helper.MhUnitQueryAuthHelper;
import com.hz.pm.api.user.helper.MhUnitQueryAuthHelper.UnitQueryState;
@@ -590,11 +594,13 @@ public class ConstructionManage {
.eq(Purchase::getBidType, BidTypeEnum.BUILD_APP.getCode())
.apply("LENGTH(NVL(preliminary_inspection_materials,'')) = 0")
.last(BizConst.LIMIT_1);
Project project = projectService.getById(req.getProjectId());
if (purchaseService.count(purchaseQuery) == 0) {
Project project = projectService.getById(req.getProjectId());
projectStateMachineUtil.pass(project);
projectService.updateById(project);
}
SpringUtil.publishEvent(MhTodoSendEvent.of(MHTodoTypeEnum.FINAL_INSPECT_APPLY, project, purchase));
SpringUtil.publishEvent(MhTodoHandedEvent.of(MHTodoTypeEnum.WITHOUT_FIRST_ACCEPT_RECORD, req.getBidId()));
}

@Transactional(rollbackFor = Exception.class)


+ 4
- 0
hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/FinalAcceptanceManage.java View File

@@ -2,6 +2,7 @@ package com.hz.pm.api.projectdeclared.manage;

import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.util.NumberUtil;
import cn.hutool.extra.spring.SpringUtil;
import com.alibaba.excel.EasyExcel;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Assert;
@@ -16,6 +17,7 @@ import com.hz.pm.api.common.util.BizDateUtil;
import com.hz.pm.api.common.util.BizUtils;
import com.hz.pm.api.common.util.ExcelDownUtil;
import com.hz.pm.api.common.util.ExcelExportStyle;
import com.hz.pm.api.external.todo.enumerization.MHTodoTypeEnum;
import com.hz.pm.api.projectdeclared.model.dto.DeclaredProjectExportDTO;
import com.hz.pm.api.projectdeclared.model.entity.Contract;
import com.hz.pm.api.projectdeclared.model.entity.Purchase;
@@ -38,6 +40,7 @@ import com.hz.pm.api.projectlib.model.vo.ProjectLibListItemVO;
import com.hz.pm.api.projectlib.model.vo.TenderListInfoVO;
import com.hz.pm.api.projectlib.service.IProjectInstService;
import com.hz.pm.api.projectlib.service.IProjectService;
import com.hz.pm.api.scheduler.listener.event.MhTodoHandedEvent;
import com.hz.pm.api.sys.manage.ProcessModelManage;
import com.hz.pm.api.user.helper.MhUnitQueryAuthHelper;
import com.hz.pm.api.user.security.model.UserFullInfoDTO;
@@ -356,6 +359,7 @@ public class FinalAcceptanceManage {
}
}
//发送给第一个审批人消息
SpringUtil.publishEvent(MhTodoHandedEvent.of(MHTodoTypeEnum.FINAL_INSPECT_APPLY, req.getBidId()));
return instanceId;
}



+ 6
- 0
hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/OperationManage.java View File

@@ -1,9 +1,11 @@
package com.hz.pm.api.projectdeclared.manage;

import cn.hutool.core.bean.BeanUtil;
import cn.hutool.extra.spring.SpringUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.hz.pm.api.common.statemachine.util.TenderStateMachineUtil;
import com.hz.pm.api.external.todo.enumerization.MHTodoTypeEnum;
import com.hz.pm.api.projectdeclared.model.dto.OperationReq;
import com.hz.pm.api.projectdeclared.model.entity.Operation;
import com.hz.pm.api.projectdeclared.model.entity.Purchase;
@@ -13,6 +15,8 @@ import com.hz.pm.api.projectdeclared.service.IPurchaseService;
import com.hz.pm.api.projectlib.model.entity.Project;
import com.hz.pm.api.projectlib.model.enumeration.status.TenderMainStatus;
import com.hz.pm.api.projectlib.service.IProjectService;
import com.hz.pm.api.scheduler.listener.event.MhTodoHandedEvent;
import com.hz.pm.api.scheduler.listener.event.MhTodoSendEvent;
import com.hz.pm.api.user.security.model.UserInfoDetails;
import com.hz.pm.api.user.util.LoginUserUtil;
import com.ningdatech.basic.exception.BizException;
@@ -91,6 +95,8 @@ public class OperationManage {
// 修改标段状态
tenderStateMachineUtil.pass(purchase);
purchaseService.updateById(purchase);
SpringUtil.publishEvent(MhTodoHandedEvent.of(MHTodoTypeEnum.WITHOUT_OPERATION_PLAN, purchase.getId()));
SpringUtil.publishEvent(MhTodoSendEvent.of(MHTodoTypeEnum.ADAPTION_APPLY, project, purchase));
return operation.getProjectCode();
}
}

+ 5
- 0
hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/ProjectReviewManage.java View File

@@ -1,6 +1,7 @@
package com.hz.pm.api.projectdeclared.manage;

import cn.hutool.core.bean.BeanUtil;
import cn.hutool.extra.spring.SpringUtil;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
@@ -16,6 +17,7 @@ import com.hz.pm.api.common.statemachine.util.ProjectStateMachineUtil;
import com.hz.pm.api.common.util.BizUtils;
import com.hz.pm.api.datascope.model.DataScopeDTO;
import com.hz.pm.api.datascope.utils.DataScopeUtil;
import com.hz.pm.api.external.todo.enumerization.MHTodoTypeEnum;
import com.hz.pm.api.meeting.entity.domain.MeetingInnerProject;
import com.hz.pm.api.meeting.entity.dto.ProjectReviewResultDTO;
import com.hz.pm.api.meeting.service.IMeetingInnerProjectService;
@@ -34,6 +36,7 @@ import com.hz.pm.api.projectlib.model.req.UploadConstructionPlanSealFileReq;
import com.hz.pm.api.projectlib.model.vo.ProjectLibListItemVO;
import com.hz.pm.api.projectlib.service.IProjectInstService;
import com.hz.pm.api.projectlib.service.IProjectService;
import com.hz.pm.api.scheduler.listener.event.MhTodoHandedEvent;
import com.hz.pm.api.sys.manage.ProcessModelManage;
import com.hz.pm.api.user.helper.MhUnitCache;
import com.hz.pm.api.user.security.model.UserFullInfoDTO;
@@ -116,6 +119,7 @@ public class ProjectReviewManage {
projectInstService.save(projectInst);
projectStateMachineUtil.pass(project);
projectService.updateById(project);
SpringUtil.publishEvent(MhTodoHandedEvent.of(MHTodoTypeEnum.PROJECT_REVIEW_APPLY, project.getId()));
log.info("项目评审提交成功 【{}】", instanceId);
}

@@ -367,6 +371,7 @@ public class ProjectReviewManage {
.set(Project::getUpdateBy, LoginUserUtil.getUserId())
.eq(Project::getId, req.getProjectId());
projectService.update(wrapper);
SpringUtil.publishEvent(MhTodoHandedEvent.of(MHTodoTypeEnum.WITHOUT_BUILD_SCHEME, project.getId()));
}

}

+ 23
- 8
hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/PurchaseManage.java View File

@@ -7,6 +7,7 @@ import cn.hutool.core.date.LocalDateTimeUtil;
import cn.hutool.core.io.FileUtil;
import cn.hutool.core.lang.Assert;
import cn.hutool.core.util.StrUtil;
import cn.hutool.extra.spring.SpringUtil;
import cn.hutool.http.HttpUtil;
import cn.hutool.json.JSONUtil;
import com.alibaba.excel.EasyExcel;
@@ -27,6 +28,7 @@ import com.hz.pm.api.external.MhFileClient;
import com.hz.pm.api.external.model.dto.MhPurchaseIntentionDTO;
import com.hz.pm.api.external.model.dto.MhPurchaseNoticeDTO;
import com.hz.pm.api.external.model.enumeration.MhUnitStripEnum;
import com.hz.pm.api.external.todo.enumerization.MHTodoTypeEnum;
import com.hz.pm.api.projectdeclared.helper.MhXchxFileHelper;
import com.hz.pm.api.projectdeclared.model.dto.DeclaredProjectExportDTO;
import com.hz.pm.api.projectdeclared.model.dto.PurchaseSaveDTO;
@@ -54,6 +56,8 @@ import com.hz.pm.api.projectlib.service.IProjectGovSystemReplaceInfosService;
import com.hz.pm.api.projectlib.service.IProjectInstService;
import com.hz.pm.api.projectlib.service.IProjectService;
import com.hz.pm.api.projectlib.service.IPurchaseStatusChangeService;
import com.hz.pm.api.scheduler.listener.event.MhTodoHandedEvent;
import com.hz.pm.api.scheduler.listener.event.MhTodoSendEvent;
import com.hz.pm.api.sys.manage.ProcessModelManage;
import com.hz.pm.api.user.helper.MhUnitCache;
import com.hz.pm.api.user.helper.MhUnitQueryAuthHelper;
@@ -458,6 +462,10 @@ public class PurchaseManage {
projectGovSystemReplaceInfosService.updateBatchById(projectGovSystemReplaceInfos);
projectStateMachineUtil.pass(project);
projectService.updateById(project);
SpringUtil.publishEvent(MhTodoHandedEvent.of(MHTodoTypeEnum.WITHOUT_PURCHASE_NOTICE, project.getId()));
for (Purchase purchase : purchases) {
SpringUtil.publishEvent(MhTodoSendEvent.of(MHTodoTypeEnum.WITHOUT_PURCHASE_CONTRACT, project, purchase));
}
// 发布采购公告
if (!notices.isEmpty()) {
mhApiClient.publishPurchaseNotice(notices);
@@ -565,6 +573,8 @@ public class PurchaseManage {
project.setUpdateOn(now);
project.setContractAmount(totalAmount);
projectService.updateById(project);
SpringUtil.publishEvent(MhTodoHandedEvent.of(MHTodoTypeEnum.WITHOUT_PURCHASE_CONTRACT, purchase.getId()));
SpringUtil.publishEvent(MhTodoSendEvent.of(MHTodoTypeEnum.WITHOUT_OPERATION_PLAN, project, purchase));
}

public AdaptionProgressStatVO adaptionProgressStatistics(PurchaseAdaptionListReq req) {
@@ -756,9 +766,9 @@ public class PurchaseManage {
ProjectProcessType instType = ProjectProcessType.TEST_VALID;
WflowModels model = processModelManage.getWflowModelsNoNull(instType, user.getMhUnitId());
LocalDateTime now = LocalDateTime.now();
Long projectId = purchases.get(0).getProjectId();
Project project = projectService.getNewProject(projectId);
for (Purchase purchase : purchases) {
Long projectId = purchase.getProjectId();
Project project = projectService.getNewProject(projectId);
ProcessStartParamsVo instParam = new ProcessStartParamsVo();
instParam.setUser(declaredProjectManage.buildUser(user));
instParam.setProcessUsers(Collections.emptyMap());
@@ -786,6 +796,7 @@ public class PurchaseManage {
operationService.saveOrUpdate(operation);
saveProjectPurchaseInstCode(purchase.getId(), instanceId, project.getId(), instType);
}
SpringUtil.publishEvent(MhTodoHandedEvent.of(MHTodoTypeEnum.TEST_VALID_APPLY, purchases.get(0).getId()));
}

private void saveProjectPurchaseInstCode(Long bidId,
@@ -821,9 +832,10 @@ public class PurchaseManage {
WflowModels model = processModelManage.getWflowModelsNoNull(instType, user.getMhUnitId());

LocalDateTime now = LocalDateTime.now();
Long projectId = purchases.get(0).getProjectId();
Project project = projectService.getNewProject(projectId);
for (Purchase purchase : purchases) {
Long projectId = purchase.getProjectId();
Project project = projectService.getNewProject(projectId);

ProcessStartParamsVo instParam = new ProcessStartParamsVo();
instParam.setUser(declaredProjectManage.buildUser(user));
instParam.setProcessUsers(Collections.emptyMap());
@@ -851,6 +863,7 @@ public class PurchaseManage {
operationService.saveOrUpdate(operation);
saveProjectPurchaseInstCode(purchase.getId(), instanceId, project.getId(), instType);
}
SpringUtil.publishEvent(MhTodoHandedEvent.of(MHTodoTypeEnum.SELF_TEST_APPLY, purchases.get(0).getId()));
}

@Transactional(rollbackFor = Exception.class)
@@ -865,11 +878,10 @@ public class PurchaseManage {
UserInfoDetails user = LoginUserUtil.loginUserDetail();
ProjectProcessType instType = ProjectProcessType.ADAPTION;
WflowModels model = processModelManage.getWflowModelsNoNull(instType, user.getMhUnitId());

Long projectId = purchases.get(0).getProjectId();
Project project = projectService.getNewProject(projectId);
LocalDateTime now = LocalDateTime.now();
for (Purchase purchase : purchases) {
Long projectId = purchase.getProjectId();
Project project = projectService.getNewProject(projectId);
ProcessStartParamsVo instParam = new ProcessStartParamsVo();
instParam.setUser(declaredProjectManage.buildUser(user));
instParam.setProcessUsers(Collections.emptyMap());
@@ -897,6 +909,7 @@ public class PurchaseManage {
operationService.saveOrUpdate(operation);
saveProjectPurchaseInstCode(purchase.getId(), instanceId, project.getId(), instType);
}
SpringUtil.publishEvent(MhTodoHandedEvent.of(MHTodoTypeEnum.ADAPTION_APPLY, purchases.get(0).getId()));
}

public PageVo<XcfhxApplyListVO> pageXcfhxApply(XcfhxListReq req) {
@@ -1018,11 +1031,13 @@ public class PurchaseManage {
}
return TenderMainStatus.TO_BE_SUBMIT_FIRST_INSPECTED_INFO.eq(w.getStatus());
});
Project project = projectService.getNewestNoNull(purchase.getProjectId());
if (changeProjectStatus) {
Project project = projectService.getNewestNoNull(purchase.getProjectId());
projectStateMachineUtil.pass(project);
projectService.updateById(project);
}
SpringUtil.publishEvent(MhTodoHandedEvent.of(MHTodoTypeEnum.WITHOUT_ORG_CONFIRM, req.getBidId()));
SpringUtil.publishEvent(MhTodoSendEvent.of(MHTodoTypeEnum.WITHOUT_FIRST_ACCEPT_RECORD, project, purchase));
}

}

+ 6
- 0
hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/service/IPurchaseInstService.java View File

@@ -35,6 +35,12 @@ public interface IPurchaseInstService extends IService<PurchaseInst> {
return list(query);
}

default PurchaseInst getByInstCode(String instCode) {
Wrapper<PurchaseInst> query = Wrappers.lambdaQuery(PurchaseInst.class)
.eq(PurchaseInst::getInstCode, instCode);
return getOne(query);
}

default List<PurchaseInst> listByProjectId(Long projectId) {
Wrapper<PurchaseInst> query = Wrappers.lambdaQuery(PurchaseInst.class)
.eq(PurchaseInst::getProjectId, projectId);


+ 7
- 8
hz-pm-api/src/main/java/com/hz/pm/api/projectlib/manage/AmountApprovalManage.java View File

@@ -5,6 +5,7 @@ import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.util.NumberUtil;
import cn.hutool.core.util.ObjUtil;
import cn.hutool.core.util.StrUtil;
import cn.hutool.extra.spring.SpringUtil;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
@@ -16,6 +17,7 @@ import com.hz.pm.api.common.util.DecimalUtil;
import com.hz.pm.api.datascope.model.DataScopeDTO;
import com.hz.pm.api.datascope.utils.DataScopeUtil;
import com.hz.pm.api.external.model.enumeration.MhUnitStripEnum;
import com.hz.pm.api.external.todo.enumerization.MHTodoTypeEnum;
import com.hz.pm.api.projectlib.entity.ProjectApprovalAmount;
import com.hz.pm.api.projectlib.helper.ProjectManageUtil;
import com.hz.pm.api.projectlib.model.dto.ProjectApprovalAmountDTO;
@@ -27,6 +29,7 @@ import com.hz.pm.api.projectlib.model.vo.AmountApprovalProgressStatisticsVO;
import com.hz.pm.api.projectlib.model.vo.ProjectLibListItemVO;
import com.hz.pm.api.projectlib.service.IProjectApprovalAmountService;
import com.hz.pm.api.projectlib.service.IProjectService;
import com.hz.pm.api.scheduler.listener.event.MhTodoSendEvent;
import com.hz.pm.api.user.helper.MhUnitCache;
import com.hz.pm.api.user.security.model.UserFullInfoDTO;
import com.hz.pm.api.user.util.LoginUserUtil;
@@ -217,6 +220,9 @@ public class AmountApprovalManage {
projectApprovalAmount.setProjectCode(project.getProjectCode());
projectApprovalAmount.setCarryOverAmount(req.getCarryOverAmount());
projectApprovalAmountService.save(projectApprovalAmount);
if (!approved) {
SpringUtil.publishEvent(MhTodoSendEvent.of(MHTodoTypeEnum.DECLARED_RECORD_APPLY, project));
}
}

private Integer getLastApprovalYear(Project project) {
@@ -250,14 +256,7 @@ public class AmountApprovalManage {

public List<ProjectApprovalAmountDTO> listApprovalAmounts(String projectCode) {
List<ProjectApprovalAmount> approvalAmounts = projectApprovalAmountService.listAsc(projectCode);
List<ProjectApprovalAmountDTO> retData = BeanUtil.copyToList(approvalAmounts, ProjectApprovalAmountDTO.class);
for (int i = 0; i < retData.size() - 1; i++) {
ProjectApprovalAmountDTO curr = retData.get(i);
ProjectApprovalAmountDTO next = retData.get(i + 1);
curr.setCarryOverAmount(next.getCarryOverAmount());
next.setCarryOverAmount(null);
}
return retData;
return BeanUtil.copyToList(approvalAmounts, ProjectApprovalAmountDTO.class);
}

}

+ 44
- 0
hz-pm-api/src/main/java/com/hz/pm/api/scheduler/listener/MhTodoHandedListener.java View File

@@ -0,0 +1,44 @@
package com.hz.pm.api.scheduler.listener;

import cn.hutool.core.collection.CollUtil;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.hz.pm.api.scheduler.listener.event.MhTodoHandedEvent;
import com.hz.pm.api.sys.model.entity.MhTodoRecord;
import com.hz.pm.api.sys.model.entity.MhTodoRecord.TodoStatusEnum;
import com.hz.pm.api.sys.service.IMhTodoRecordService;
import com.ningdatech.basic.util.CollUtils;
import lombok.RequiredArgsConstructor;
import org.springframework.context.event.EventListener;
import org.springframework.stereotype.Component;

/**
* <p>
* MhTodoHandedListener
* </p>
*
* @author WendyYang
* @since 14:11 2024/10/19
*/
@Component
@RequiredArgsConstructor
public class MhTodoHandedListener {

private final IMhTodoRecordService mhTodoRecordService;

@EventListener(MhTodoHandedEvent.class)
public void handleEvent(MhTodoHandedEvent event) {
LambdaUpdateWrapper<MhTodoRecord> wrapper = Wrappers.lambdaUpdate(MhTodoRecord.class)
.set(MhTodoRecord::getStatus, TodoStatusEnum.HANDING.getCode())
.eq(MhTodoRecord::getStatus, TodoStatusEnum.PENDING.getCode())
.eq(MhTodoRecord::getType, event.getMhTodoType());
if (CollUtil.isNotEmpty(event.getBizIds())) {
wrapper.in(MhTodoRecord::getBizId, CollUtils.convert(event.getBizIds(), String::valueOf));
} else {
wrapper.eq(MhTodoRecord::getBizId, event.getBizId().toString());
}
mhTodoRecordService.update(wrapper);
}

}

+ 88
- 0
hz-pm-api/src/main/java/com/hz/pm/api/scheduler/listener/MhTodoSendListener.java View File

@@ -0,0 +1,88 @@
package com.hz.pm.api.scheduler.listener;

import cn.hutool.core.util.ObjUtil;
import cn.hutool.core.util.StrUtil;
import com.hz.pm.api.common.helper.UserInfoHelper;
import com.hz.pm.api.external.MhApiClient;
import com.hz.pm.api.external.model.dto.MhZwddWorkNoticeDTO;
import com.hz.pm.api.external.todo.MHTodoClient;
import com.hz.pm.api.external.todo.dto.MhTodoExtraParamDTO;
import com.hz.pm.api.external.todo.enumerization.MHTodoTypeEnum;
import com.hz.pm.api.projectdeclared.model.entity.Purchase;
import com.hz.pm.api.projectdeclared.model.entity.Xinchuang;
import com.hz.pm.api.projectlib.model.entity.Project;
import com.hz.pm.api.scheduler.listener.event.MhTodoSendEvent;
import com.hz.pm.api.user.security.model.UserFullInfoDTO;
import lombok.RequiredArgsConstructor;
import org.springframework.context.event.EventListener;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Component;

/**
* <p>
* MhTodoSendListener
* </p>
*
* @author WendyYang
* @since 14:47 2024/10/19
*/
@Component
@RequiredArgsConstructor
public class MhTodoSendListener {

private final MhApiClient mhApiClient;
private final MHTodoClient mhTodoClient;
private final UserInfoHelper userInfoHelper;

@Async
@EventListener(classes = MhTodoSendEvent.class)
public void handleEvent(MhTodoSendEvent event) {
MHTodoTypeEnum todoType = event.getMhTodoType();
MHTodoTypeEnum nextStep = ObjUtil.defaultIfNull(todoType.getNextStep(), todoType);
Purchase purchase = event.getPurchase();
Project project = event.getProject();
Xinchuang xinchuang = event.getXinchuang();
boolean isBidTodo = purchase != null;
String tmpName;
Long createBy;
Long bizId;
if (isBidTodo) {
tmpName = purchase.getBidName();
createBy = Long.valueOf(purchase.getCreateBy());
bizId = purchase.getId();
} else if (project != null) {
tmpName = project.getProjectName();
createBy = project.getCreateBy();
bizId = project.getId();
} else if (xinchuang != null) {
tmpName = xinchuang.getProjectName();
createBy = Long.parseLong(xinchuang.getCreateBy());
bizId = xinchuang.getId();
} else {
return;
}
UserFullInfoDTO user = userInfoHelper.getUserFullInfo(createBy);
if (user == null || user.getMhUserId() == null) {
return;
}
if (StrUtil.isNotBlank(nextStep.getZwddMsg())) {
String zwddMsg = String.format(nextStep.getZwddMsg(), tmpName);
MhZwddWorkNoticeDTO notice = MhZwddWorkNoticeDTO.builder()
.content(zwddMsg)
.title(nextStep.getVal())
.targetUser(user.getMhUserId())
.build();
mhApiClient.sendZwddWorkNotice(notice);
}
if (StrUtil.isNotBlank(nextStep.getTodoMsg())) {
String todoMsg = String.format(nextStep.getTodoMsg(), tmpName);
MhTodoExtraParamDTO paramObj = MhTodoExtraParamDTO.builder()
.path(nextStep.getPagePath())
.userName(user.getRealName())
.userId(createBy)
.build();
mhTodoClient.addTodo(paramObj, user, nextStep, bizId.toString(), todoMsg);
}
}

}

+ 85
- 21
hz-pm-api/src/main/java/com/hz/pm/api/scheduler/listener/UserTaskCreateOrFinishListener.java View File

@@ -1,5 +1,6 @@
package com.hz.pm.api.scheduler.listener;

import cn.hutool.core.util.ObjUtil;
import cn.hutool.core.util.StrUtil;
import cn.hutool.extra.spring.SpringUtil;
import com.hz.pm.api.common.enumeration.ProjectProcessType;
@@ -10,10 +11,12 @@ import com.hz.pm.api.external.model.dto.MhZwddWorkNoticeDTO;
import com.hz.pm.api.external.todo.MHTodoClient;
import com.hz.pm.api.external.todo.dto.MhTodoExtraParamDTO;
import com.hz.pm.api.external.todo.enumerization.MHTodoTypeEnum;
import com.hz.pm.api.projectdeclared.model.entity.Purchase;
import com.hz.pm.api.projectdeclared.model.entity.PurchaseInst;
import com.hz.pm.api.projectdeclared.model.entity.Xinchuang;
import com.hz.pm.api.projectdeclared.model.entity.XinchuangInst;
import com.hz.pm.api.projectdeclared.service.IPurchaseInstService;
import com.hz.pm.api.projectdeclared.service.IPurchaseService;
import com.hz.pm.api.projectdeclared.service.IXinchuangInstService;
import com.hz.pm.api.projectdeclared.service.IXinchuangService;
import com.hz.pm.api.projectlib.model.entity.Project;
@@ -57,6 +60,7 @@ import static com.hz.pm.api.common.util.ThreadPoolUtil.SCHEDULER;
public class UserTaskCreateOrFinishListener {

private final HistoryService historyService;
private final IPurchaseService purchaseService;
private final IProjectService projectService;
private final IProjectInstService projectInstService;
private final ProcessModelHistorysService processModelHistorysService;
@@ -216,29 +220,32 @@ public class UserTaskCreateOrFinishListener {
} else {
mhTodoClient.completeTodo(todoType, task.getId());
}
if (!event.getAction().equals(ProcessHandlerEnum.PASS)
&& !event.getAction().equals(ProcessHandlerEnum.SEAL_PASS)) {
String projectName;
Long createBy;
ProjectInst projectInst = projectInstService.getByInstCode(event.getInstCode());
if (projectInst != null) {
Project project = projectService.getNewestNoNull(projectInst.getProjectId());
projectName = project.getProjectName();
createBy = project.getCreateBy();
} else {
XinchuangInst xinchuangInst = xinchuangInstService.getByInstCode(event.getInstCode());
if (xinchuangInst == null) {
return;
}
Xinchuang xinchuang = xinchuangService.getById(xinchuangInst.getXinchuangId());
projectName = xinchuang.getProjectName();
createBy = Long.parseLong(xinchuang.getCreateBy());
}
UserFullInfoDTO userFullInfo = userInfoHelper.getUserFullInfo(createBy);
if (userFullInfo == null || StrUtil.isBlank(userFullInfo.getMhUserId())) {
String projectName;
Long projectId;
Long createBy;
ProjectInst projectInst = projectInstService.getByInstCode(event.getInstCode());
if (projectInst != null) {
Project project = projectService.getNewestNoNull(projectInst.getProjectId());
projectId = project.getId();
projectName = project.getProjectName();
createBy = project.getCreateBy();
} else {
XinchuangInst xinchuangInst = xinchuangInstService.getByInstCode(event.getInstCode());
if (xinchuangInst == null) {
return;
}
String zzdContent = String.format("您单位的【%s】的%s已被驳回,请按时完成提交!",
Xinchuang xinchuang = xinchuangService.getById(xinchuangInst.getXinchuangId());
projectName = xinchuang.getProjectName();
projectId = xinchuang.getId();
createBy = Long.parseLong(xinchuang.getCreateBy());
}
UserFullInfoDTO userFullInfo = userInfoHelper.getUserFullInfo(createBy);
if (userFullInfo == null || StrUtil.isBlank(userFullInfo.getMhUserId())) {
return;
}
if (event.getAction().equals(ProcessHandlerEnum.REJECT)
&& !event.getAction().equals(ProcessHandlerEnum.SEAL_PASS)) {
String zzdContent = String.format("您单位的【%s】的%s已被驳回,请及时处理!",
projectName, getProcessTypeName(procType));
MhZwddWorkNoticeDTO notice = MhZwddWorkNoticeDTO.builder()
.content(zzdContent)
@@ -246,6 +253,43 @@ public class UserTaskCreateOrFinishListener {
.targetUser(userFullInfo.getMhUserId())
.build();
mhApiClient.sendZwddWorkNotice(notice);
} else if (event.getAction().equals(ProcessHandlerEnum.PASS)) {
Purchase purchase = null;
boolean isBidAudit = isBidAudit(procType);
if (isBidAudit) {
purchase = getPurchase(event.getInstCode());
if (purchase == null) {
log.warn("未找到采购信息,无法发送信产待办:{}", event.getInstCode());
return;
}
}
String bidName = purchase == null ? null : purchase.getBidName();
MHTodoTypeEnum nextStep = ObjUtil.defaultIfNull(todoType.getNextStep(), todoType);
String tmpName = isBidAudit ? bidName : projectName;
if (StrUtil.isNotBlank(nextStep.getZwddMsg())) {
String zwddMsg = String.format(nextStep.getZwddMsg(), tmpName);
MhZwddWorkNoticeDTO notice = MhZwddWorkNoticeDTO.builder()
.content(zwddMsg)
.title(nextStep.getVal())
.targetUser(userFullInfo.getMhUserId())
.build();
mhApiClient.sendZwddWorkNotice(notice);
}
if (StrUtil.isNotBlank(nextStep.getTodoMsg())) {
String todoMsg = String.format(nextStep.getTodoMsg(), tmpName);
MhTodoExtraParamDTO paramObj = MhTodoExtraParamDTO.builder()
.path(nextStep.getPagePath())
.userName(userFullInfo.getRealName())
.userId(createBy)
.build();
String bizId;
if (isBidAudit) {
bizId = purchase.getId().toString();
} else {
bizId = projectId.toString();
}
mhTodoClient.addTodo(paramObj, userFullInfo, nextStep, bizId, todoMsg);
}
}
break;
default:
@@ -253,6 +297,14 @@ public class UserTaskCreateOrFinishListener {
}
}

private Purchase getPurchase(String instCode) {
PurchaseInst purchaseInst = purchaseInstService.getByInstCode(instCode);
if (purchaseInst != null) {
return purchaseService.getById(purchaseInst.getBidId());
}
return null;
}

private MHTodoTypeEnum getMhTodoTypeEnum(ProjectProcessType procType) {
MHTodoTypeEnum todoType;
switch (procType) {
@@ -292,4 +344,16 @@ public class UserTaskCreateOrFinishListener {
return todoType;
}

private boolean isBidAudit(ProjectProcessType processType) {
switch (processType) {
case TEST_VALID:
case ADAPTION:
case ACCEPTANCE_DECLARATION_APPROVAL_PROCESS:
case SELF_TEST:
return Boolean.TRUE;
default:
}
return false;
}

}

+ 52
- 0
hz-pm-api/src/main/java/com/hz/pm/api/scheduler/listener/event/MhTodoHandedEvent.java View File

@@ -0,0 +1,52 @@
package com.hz.pm.api.scheduler.listener.event;

import com.hz.pm.api.external.todo.enumerization.MHTodoTypeEnum;
import lombok.Getter;
import lombok.Setter;
import org.springframework.context.ApplicationEvent;

import java.io.Serializable;
import java.time.LocalDateTime;
import java.util.List;

/**
* <p>
* MhTodoHandedEvent
* </p>
*
* @author WendyYang
* @since 14:33 2024/10/19
*/
@Getter
@Setter
public class MhTodoHandedEvent extends ApplicationEvent {

public MhTodoHandedEvent(Object source) {
super(source);
}

public static MhTodoHandedEvent of(MHTodoTypeEnum mhTodoType, Long bizId) {
return of(mhTodoType, String.valueOf(bizId));
}

private static MhTodoHandedEvent of(MHTodoTypeEnum mhTodoType, String bizId) {
MhTodoHandedEvent event = new MhTodoHandedEvent(LocalDateTime.now());
event.setMhTodoType(mhTodoType);
event.setBizId(bizId);
return event;
}

public static MhTodoHandedEvent of(MHTodoTypeEnum mhTodoType, List<String> bizIds) {
MhTodoHandedEvent event = new MhTodoHandedEvent(LocalDateTime.now());
event.setMhTodoType(mhTodoType);
event.setBizIds(bizIds);
return event;
}

private MHTodoTypeEnum mhTodoType;

private String bizId;

private List<String> bizIds;

}

+ 58
- 0
hz-pm-api/src/main/java/com/hz/pm/api/scheduler/listener/event/MhTodoSendEvent.java View File

@@ -0,0 +1,58 @@
package com.hz.pm.api.scheduler.listener.event;

import com.hz.pm.api.external.todo.enumerization.MHTodoTypeEnum;
import com.hz.pm.api.projectdeclared.model.entity.Purchase;
import com.hz.pm.api.projectdeclared.model.entity.Xinchuang;
import com.hz.pm.api.projectlib.model.entity.Project;
import lombok.Getter;
import lombok.Setter;
import org.springframework.context.ApplicationEvent;

import java.time.LocalDateTime;

/**
* <p>
* MhTodoSendEvent
* </p>
*
* @author WendyYang
* @since 14:48 2024/10/19
*/
@Getter
@Setter
public class MhTodoSendEvent extends ApplicationEvent {

public MhTodoSendEvent(Object source) {
super(source);
}


public static MhTodoSendEvent of(MHTodoTypeEnum mhTodoType, Project project){
MhTodoSendEvent event = new MhTodoSendEvent(LocalDateTime.now());
event.setProject(project);
event.setMhTodoType(mhTodoType);
return event;
}

public static MhTodoSendEvent of(MHTodoTypeEnum mhTodoType, Project project,Purchase purchase){
MhTodoSendEvent event = of(mhTodoType, project);
event.setPurchase(purchase);
return event;
}

public static MhTodoSendEvent of(MHTodoTypeEnum mhTodoType, Xinchuang xinchuang) {
MhTodoSendEvent event = new MhTodoSendEvent(LocalDateTime.now());
event.setXinchuang(xinchuang);
event.setMhTodoType(mhTodoType);
return event;
}

private MHTodoTypeEnum mhTodoType;

private Project project;

private Purchase purchase;

private Xinchuang xinchuang;

}

+ 53
- 0
hz-pm-api/src/main/java/com/hz/pm/api/scheduler/task/MhTodoCloseTask.java View File

@@ -0,0 +1,53 @@
package com.hz.pm.api.scheduler.task;

import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.hz.pm.api.external.todo.MHTodoClient;
import com.hz.pm.api.sys.model.entity.MhTodoRecord;
import com.hz.pm.api.sys.service.IMhTodoRecordService;
import lombok.RequiredArgsConstructor;
import org.springframework.context.annotation.Profile;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

import java.util.List;
import java.util.concurrent.TimeUnit;

import static com.hz.pm.api.sys.model.entity.MhTodoRecord.TodoStatusEnum.HANDED;
import static com.hz.pm.api.sys.model.entity.MhTodoRecord.TodoStatusEnum.HANDING;

/**
* <p>
* MhTodoCloseTask
* </p>
*
* @author WendyYang
* @since 13:49 2024/10/19
*/
@Component
@Profile("prod")
@RequiredArgsConstructor
public class MhTodoCloseTask {

private final IMhTodoRecordService mhTodoRecordService;
private final MHTodoClient mhTodoClient;

@Scheduled(fixedRate = 2, timeUnit = TimeUnit.MINUTES)
public void closeMhTodo() {
Wrapper<MhTodoRecord> query = Wrappers.lambdaQuery(MhTodoRecord.class)
.eq(MhTodoRecord::getStatus, HANDING.getCode());
List<MhTodoRecord> mhTodoList = mhTodoRecordService.list(query);
if (mhTodoList.isEmpty()) {
return;
}
for (MhTodoRecord mhTodo : mhTodoList) {
if (mhTodoClient.complete(mhTodo.getMhTodoId())) {
Wrapper<MhTodoRecord> update = Wrappers.lambdaUpdate(MhTodoRecord.class)
.set(MhTodoRecord::getStatus, HANDED.getCode())
.eq(MhTodoRecord::getId, mhTodo.getId());
mhTodoRecordService.update(update);
}
}
}

}

+ 1
- 0
hz-pm-api/src/main/java/com/hz/pm/api/sys/model/entity/MhTodoRecord.java View File

@@ -64,6 +64,7 @@ public class MhTodoRecord implements Serializable {
public enum TodoStatusEnum {

PENDING(1, "待处理"),
HANDING(4, "处理中"),
HANDED(2, "已处理"),
DELETED(3, "已删除");



Loading…
Cancel
Save