Browse Source

Merge branch 'master' of http://code.jing-tong.com:3000/jie.zhang/srm-bpm-service

dashan.fan 2 years ago
parent
commit
162e521512

+ 24 - 0
bpm-core/src/main/java/com/srm/bpm/logic/service/PushMsgLogic.java

@@ -0,0 +1,24 @@
1
+
2
+package com.srm.bpm.logic.service;
3
+
4
+import java.util.List;
5
+
6
+import com.srm.bpm.logic.dto.FlowMsgDTO;
7
+
8
+/**
9
+ * <p>
10
+ * </p>
11
+ *
12
+ * @author BOGON
13
+ * @version 1.0
14
+ * @since JDK 1.8
15
+ */
16
+public interface PushMsgLogic {
17
+	/**
18
+	 * 推送消息
19
+	 * 
20
+	 * @param allMsg
21
+	 */
22
+
23
+	void push(List<FlowMsgDTO> allMsg);
24
+}

+ 1 - 0
bpm-core/src/main/java/com/srm/bpm/logic/service/impl/BillLogicImpl.java

@@ -677,6 +677,7 @@ public class BillLogicImpl implements BillLogic {
677 677
                 taskOpt = billBpmnLogic.findTaskBybillAndEmployeeAndTaskId(billId, taskId, userCode);
678 678
                 if (taskOpt.isPresent()) {
679 679
                     BillTaskEntity billTask = taskOpt.get();
680
+                    billTask.setOpinion(opinion);
680 681
                     final int nodeStatus = billTask.getNodeStatus();
681 682
                     BillTaskStatus billTaskStatus = BillTaskStatus.valueTo(nodeStatus);
682 683
                     final Integer taskType = billTask.getTaskType();

+ 4 - 0
bpm-core/src/main/java/com/srm/bpm/logic/service/impl/FlowMsgLogicImpl.java

@@ -13,6 +13,7 @@ import com.srm.bpm.logic.constant.BillTaskType;
13 13
 import com.srm.bpm.logic.constant.StringPool;
14 14
 import com.srm.bpm.logic.dto.FlowMsgDTO;
15 15
 import com.srm.bpm.logic.service.FlowMsgLogic;
16
+import com.srm.bpm.logic.service.PushMsgLogic;
16 17
 
17 18
 import org.jetbrains.annotations.NotNull;
18 19
 import org.springframework.stereotype.Service;
@@ -37,6 +38,7 @@ import lombok.extern.slf4j.Slf4j;
37 38
 @Slf4j
38 39
 public class FlowMsgLogicImpl implements FlowMsgLogic {
39 40
     private final ToaBillService billService;
41
+    private final PushMsgLogic pushMsgLogic;
40 42
 
41 43
     @Override
42 44
     public void sendMsg(List<BillTaskEntity> billTaskEntities) {
@@ -73,6 +75,8 @@ public class FlowMsgLogicImpl implements FlowMsgLogic {
73 75
                     allMsg.addAll(flowMsgDTOS);
74 76
                 }
75 77
                 log.debug("推送的消息是:{}", allMsg);
78
+//                TODO 注释消息
79
+//                pushMsgLogic.push(allMsg);
76 80
             }
77 81
         }
78 82
     }

+ 47 - 0
bpm-core/src/main/java/com/srm/bpm/logic/service/impl/PushMsgLogicImpl.java

@@ -0,0 +1,47 @@
1
+/*
2
+ * The Hefei JingTong RDC(Research and Development Centre) Group.
3
+ * __________________
4
+ *
5
+ *    Copyright 2015-2021
6
+ *    All Rights Reserved.
7
+ *
8
+ *    NOTICE:  All information contained herein is, and remains
9
+ *    the property of JingTong Company and its suppliers,
10
+ *    if any.
11
+ */
12
+
13
+package com.srm.bpm.logic.service.impl;
14
+
15
+import java.util.List;
16
+
17
+import org.springframework.http.ResponseEntity;
18
+import org.springframework.stereotype.Service;
19
+
20
+import com.alibaba.fastjson.JSON;
21
+import com.alibaba.fastjson.JSONObject;
22
+import com.srm.bpm.facde.RestTemplateUtil;
23
+import com.srm.bpm.logic.dto.FlowMsgDTO;
24
+import com.srm.bpm.logic.service.PushMsgLogic;
25
+import com.srm.common.data.rest.R;
26
+import com.srm.config.BpmConfig;
27
+
28
+import lombok.RequiredArgsConstructor;
29
+import lombok.extern.slf4j.Slf4j;
30
+
31
+@Service
32
+@RequiredArgsConstructor
33
+@Slf4j
34
+public class PushMsgLogicImpl implements PushMsgLogic {
35
+    private final RestTemplateUtil restTemplateUtil;
36
+    private final BpmConfig bpmConfig;
37
+
38
+	@Override
39
+	public void push(List<FlowMsgDTO> allMsg) {
40
+		JSONObject data = new JSONObject();
41
+		data.put("msg", JSON.toJSON(allMsg));
42
+		log.info("回调返回的数据:{}", allMsg);
43
+		final ResponseEntity<R> post = restTemplateUtil.post(bpmConfig.getPushmsgUrl(), data, "1");
44
+		log.info("回调返回的数据:{}", post);
45
+	}
46
+}
47
+

+ 2 - 0
bpm-core/src/main/java/com/srm/config/BpmConfig.java

@@ -29,4 +29,6 @@ public class BpmConfig {
29 29
     private Integer type;
30 30
 
31 31
     private String callbackUrl;
32
+    
33
+    private String pushmsgUrl;
32 34
 }

+ 1 - 0
bpm-server/src/main/resources/application-dev.yml

@@ -4,6 +4,7 @@ bpm:
4 4
   target-url: http://127.0.0.1:8778
5 5
   type: 1
6 6
   callback-url: http://127.0.0.1:8778/bill/rest/callback
7
+  pushmsg-url: http://127.0.0.1:8778/bill/rest/pushmsg
7 8
 spring:
8 9
   jackson:
9 10
     time-zone: GMT+8

+ 1 - 0
bpm-server/src/main/resources/application-prod.yml

@@ -4,6 +4,7 @@ bpm:
4 4
   target-url: http://127.0.0.1:9888
5 5
   type: 1
6 6
   callback-url: http://127.0.0.1:9888/bill/rest/callback
7
+  pushmsg-url: http://127.0.0.1:9888/bill/rest/pushmsg
7 8
 spring:
8 9
   jackson:
9 10
     time-zone: GMT+8

+ 1 - 0
bpm-server/src/main/resources/application-test.yml

@@ -4,6 +4,7 @@ bpm:
4 4
   target-url: http://218.92.35.106:9888
5 5
   type: 1
6 6
   callback-url: http://192.168.23.165:9888/bill/rest/callback
7
+  pushmsg-url: http://192.168.23.165:9888/bill/rest/pushmsg
7 8
 spring:
8 9
   jackson:
9 10
     time-zone: GMT+8