diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/external/model/dto/MhZwddWorkNoticeDTO.java b/hz-pm-api/src/main/java/com/hz/pm/api/external/model/dto/MhZwddWorkNoticeDTO.java index 9025475..f3d495f 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/external/model/dto/MhZwddWorkNoticeDTO.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/external/model/dto/MhZwddWorkNoticeDTO.java @@ -1,5 +1,6 @@ package com.hz.pm.api.external.model.dto; +import lombok.Builder; import lombok.Data; /** @@ -11,6 +12,7 @@ import lombok.Data; * @since 21:52 2024/3/12 */ @Data +@Builder public class MhZwddWorkNoticeDTO { private String clientId; diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/external/todo/MHTodoClient.java b/hz-pm-api/src/main/java/com/hz/pm/api/external/todo/MHTodoClient.java index d8b1cda..b63b278 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/external/todo/MHTodoClient.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/external/todo/MHTodoClient.java @@ -71,7 +71,7 @@ public class MHTodoClient { MhTodoRetDTO retData = JSON.parseObject(responseResult, new TypeReference() { }); if (retData.getCode() != 0 || StrUtil.isBlank(retData.getData())) { - log.warn("发送待办失败:{}", map); + log.warn("发送待办失败:{} {}", map, retData); throw BizException.wrap("发送待办失败"); } MhTodoRecord todo = new MhTodoRecord(); diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/external/todo/dto/MhTodoExtraParamDTO.java b/hz-pm-api/src/main/java/com/hz/pm/api/external/todo/dto/MhTodoExtraParamDTO.java new file mode 100644 index 0000000..20ee795 --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/external/todo/dto/MhTodoExtraParamDTO.java @@ -0,0 +1,34 @@ +package com.hz.pm.api.external.todo.dto; + +import lombok.Builder; +import lombok.Data; + +/** + *

+ * MhTodoExtraParamDTO + *

+ * + * @author WendyYang + * @since 11:09 2024/3/13 + */ +@Data +@Builder +public class MhTodoExtraParamDTO { + + private Long userId; + + private String userName; + + private String instanceId; + + private Long projectId; + + private String taskId; + + private Long bidId; + + private String nodeId; + + private String path; + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/scheduler/listener/TaskCreatedListener.java b/hz-pm-api/src/main/java/com/hz/pm/api/scheduler/listener/TaskCreatedListener.java index f4f9f0c..6f3b33a 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/scheduler/listener/TaskCreatedListener.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/scheduler/listener/TaskCreatedListener.java @@ -1,16 +1,17 @@ package com.hz.pm.api.scheduler.listener; import cn.hutool.core.text.CharSequenceUtil; -import cn.hutool.core.util.StrUtil; import cn.hutool.extra.spring.SpringUtil; -import cn.hutool.json.JSONObject; import com.hz.pm.api.common.enumeration.ProjectProcessStageEnum; import com.hz.pm.api.common.helper.UserInfoHelper; import com.hz.pm.api.common.helper.WflowHelper; 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.PurchaseInst; +import com.hz.pm.api.projectdeclared.service.IPurchaseInstService; import com.hz.pm.api.projectlib.model.entity.Project; import com.hz.pm.api.projectlib.model.entity.ProjectInst; import com.hz.pm.api.projectlib.service.IProjectInstService; @@ -53,6 +54,7 @@ public class TaskCreatedListener implements FlowableEventListener { private final MHTodoClient mhTodoClient; private final MhApiClient mhApiClient; private final UserInfoHelper userInfoHelper; + private final IPurchaseInstService purchaseInstService; @Override public void onEvent(FlowableEvent event) { @@ -75,25 +77,40 @@ public class TaskCreatedListener implements FlowableEventListener { if (!procType.isPresent()) { return; } - switch (procType.get()) { + ProjectProcessStageEnum processStage = procType.get(); + switch (processStage) { case XC_APPROVAL_PROCESS: case PROJECT_RECORD_APPROVAL_PROCESS: case ACCEPTANCE_DECLARATION_APPROVAL_PROCESS: // 发送信产平台待办 MHTodoTypeEnum todoType = getMhTodoTypeEnum(procType.get()); - JSONObject paramObj = new JSONObject(); - paramObj.set("projectId", projectInst.getProjectId()); - paramObj.set("instId", taskEntity.getProcessInstanceId()); - paramObj.set("taskId", taskEntity.getId()); String content = String.format("【%s】的【%s】需要您审核,请及时处理。", project.getProjectName(), procType.get().getDesc()); + MhTodoExtraParamDTO paramObj = MhTodoExtraParamDTO.builder() + .projectId(project.getId()) + .taskId(taskEntity.getId()) + .instanceId(taskEntity.getProcessInstanceId()) + .nodeId(taskEntity.getTaskDefinitionId()) + .userId(assignee.getUserId()) + .userName(assignee.getRealName()) + .path("/toDoCenter/handleDuringExamine") + .build(); + if (processStage.equals(ProjectProcessStageEnum.ACCEPTANCE_DECLARATION_APPROVAL_PROCESS) + || processStage.equals(ProjectProcessStageEnum.XC_APPROVAL_PROCESS)) { + PurchaseInst purchaseInst = purchaseInstService.getByProjectIdAndInstCode(paramObj.getProjectId(), procInstId); + if (purchaseInst == null) { + return; + } + paramObj.setBidId(purchaseInst.getBidId()); + } mhTodoClient.addTodo(paramObj, assignee, todoType, taskEntity.getId(), content); // 发送浙政钉工作通知 if (assignee.getAccountId() != null) { - MhZwddWorkNoticeDTO notice = new MhZwddWorkNoticeDTO(); - notice.setContent(content); - notice.setTitle(todoType.getVal()); - notice.setTargetUser(assignee.getMhUserId()); + MhZwddWorkNoticeDTO notice = MhZwddWorkNoticeDTO.builder() + .content(content) + .title(todoType.getVal()) + .targetUser(assignee.getMhUserId()) + .build(); mhApiClient.sendZwddWorkNotice(notice); } break; diff --git a/hz-pm-api/src/test/java/com/hz/pm/api/todocenter/MhApiClientTest.java b/hz-pm-api/src/test/java/com/hz/pm/api/todocenter/MhApiClientTest.java new file mode 100644 index 0000000..4b30726 --- /dev/null +++ b/hz-pm-api/src/test/java/com/hz/pm/api/todocenter/MhApiClientTest.java @@ -0,0 +1,39 @@ +package com.hz.pm.api.todocenter; + +import cn.hutool.json.JSONObject; +import com.hz.pm.api.AppTests; +import com.hz.pm.api.common.helper.UserInfoHelper; +import com.hz.pm.api.external.todo.MHTodoClient; +import com.hz.pm.api.external.todo.enumerization.MHTodoTypeEnum; +import com.hz.pm.api.user.security.model.UserFullInfoDTO; +import org.junit.Test; +import org.springframework.beans.factory.annotation.Autowired; + +/** + *

+ * MhApiClientTest + *

+ * + * @author WendyYang + * @since 10:06 2024/3/13 + */ +public class MhApiClientTest extends AppTests { + + @Autowired + private MHTodoClient mhTodoClient; + @Autowired + private UserInfoHelper userInfoHelper; + + @Test + public void sendTodo() { + UserFullInfoDTO assignee = userInfoHelper.getUserFullInfo("347873"); + JSONObject paramObj = new JSONObject(); + paramObj.set("projectId", 1213); + paramObj.set("instId", 1213); + paramObj.set("taskId", 1213); + String content = String.format("【%s】的【%s】需要您审核,请及时处理。", + "市住保房管局深化信创项目", "立项备案审批"); + mhTodoClient.addTodo(paramObj, assignee, MHTodoTypeEnum.XCFHX_INSPECT_AUDIT, "1212121", content); + } + +} diff --git a/hz-pm-api/src/test/resources/application-dev.yml b/hz-pm-api/src/test/resources/application-dev.yml index 2ed50c3..f1d970c 100644 --- a/hz-pm-api/src/test/resources/application-dev.yml +++ b/hz-pm-api/src/test/resources/application-dev.yml @@ -23,7 +23,7 @@ spring: max-active: 200 max-idle: 500 min-idle: 8 - max-wait: 60000 + max-wait: 10000 application: name: hzpm jackson: @@ -43,7 +43,7 @@ spring: datasource: type: com.zaxxer.hikari.HikariDataSource driverClassName: dm.jdbc.driver.DmDriver - url: jdbc:dm://47.98.125.47:5236/HZ_PROJECT_MANAGEMENT1?zeroDateTimeBehavior=convertToNull&useUnicode=true&characterEncoding=utf-8 + url: jdbc:dm://47.98.125.47:5236/HZ_PROJECT_MANAGEMENT1?nullToEmpty=true&zeroDateTimeBehavior=convertToNull&useUnicode=true&characterEncoding=utf-8 username: SYSDBA password: SYSDBA # 数据源 @@ -51,9 +51,9 @@ spring: # 是客户端等待连接池连接的最大毫秒数 connection-timeout: 30000 # 是允许连接在连接池中空闲的最长时间 - minimum-idle: 5 + minimum-idle: 10 # 配置最大池大小 - maximum-pool-size: 300 + maximum-pool-size: 20 # 是允许连接在连接池中空闲的最长时间(以毫秒为单位) idle-timeout: 60000 # 池中连接关闭后的最长生命周期(以毫秒为单位) @@ -118,7 +118,6 @@ log: swagger: enabled: true - flowable: async-executor-activate: true #关闭一些不需要的功能服务 @@ -247,16 +246,18 @@ sync-mh-user: sync-mh-company: open: false mh: - # sso: - # client-id: ningda-74a5e5da-3bc3-414a-b9e6-004b7d87e310 - # client-secret: ningda-df746ce4-0c79-4242-b3c7-90ff8630c9742c6727cd-3ae7-48ae-87ad-2b39188ebabd - # api-host: http://10.54.38.13:8081/mh-gateway/auth-single + sso: + client-id: ningda-74a5e5da-3bc3-414a-b9e6-004b7d87e310 + client-secret: ningda-df746ce4-0c79-4242-b3c7-90ff8630c9742c6727cd-3ae7-48ae-87ad-2b39188ebabd + api-host: https://hzszxc.hzswb.cn:8443/test/mh-gateway/auth-single expert-qr-code-url: https://jiema.wwei.cn/uploads/2023/12/28/658d7a3f15f06.jpg file: - down-url: https://weixin.hzszxc.hzswb.cn:8443/mh-gateway/oss/oss/previewFileLogin - detail-url: https://weixin.hzszxc.hzswb.cn:8443/mh-gateway/oss/ossfile/getFileInfoList + down-url: https://weixin.hzszxc.hzswb.cn:8443/test/mh-gateway/oss/oss/previewFileLogin + detail-url: https://weixin.hzszxc.hzswb.cn:8443/test/mh-gateway/oss/ossfile/getFileInfoList auth-code: secret-key: nqkmzqojg5j4eiypr3rb8s7nb4noa8b2 agent-login: proxy: - secret-key: nqkwiqojg7g4eiypr3rb8s7nb4noa8b2 \ No newline at end of file + secret-key: nqkwiqojg7g4eiypr3rb8s7nb4noa8b2 +sms: + client-url: http://10.54.38.13:8081/mh-gateway/auth-single \ No newline at end of file