|
|
@@ -12,9 +12,14 @@ import com.sckw.contract.model.entity.KwcContractLogistics;
|
|
|
import com.sckw.contract.model.entity.KwcContractTrade;
|
|
|
import com.sckw.contract.model.vo.req.ESignCallBackReqVo;
|
|
|
import com.sckw.core.exception.SystemException;
|
|
|
+import com.sckw.core.utils.AsyncThreadUtils;
|
|
|
import com.sckw.core.utils.BeanUtils;
|
|
|
+import lombok.RequiredArgsConstructor;
|
|
|
+import org.springframework.cloud.stream.function.StreamBridge;
|
|
|
import com.sckw.core.utils.OkHttpUtils;
|
|
|
+import com.sckw.core.utils.UUIDUtils;
|
|
|
import com.sckw.core.web.constant.HttpStatus;
|
|
|
+import com.sckw.core.web.context.LoginUserHolder;
|
|
|
import com.sckw.order.api.dubbo.TradeOrderInfoService;
|
|
|
import com.sckw.order.api.model.ContractSignCompletedParam;
|
|
|
import com.sckw.system.api.RemoteSystemService;
|
|
|
@@ -28,7 +33,9 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
-
|
|
|
+import com.sckw.stream.enums.MessageEnum;
|
|
|
+import com.sckw.stream.model.SckwMessage;
|
|
|
+import com.sckw.stream.model.UserInfo;
|
|
|
import java.io.*;
|
|
|
import java.net.URL;
|
|
|
import java.nio.charset.StandardCharsets;
|
|
|
@@ -37,8 +44,10 @@ import java.util.List;
|
|
|
import java.util.Map;
|
|
|
import java.util.Objects;
|
|
|
|
|
|
+
|
|
|
@Slf4j
|
|
|
@Service
|
|
|
+@RequiredArgsConstructor
|
|
|
public class CommonBusinessService {
|
|
|
|
|
|
@DubboReference(version = "1.0.0", group = "design", check = false)
|
|
|
@@ -68,6 +77,8 @@ public class CommonBusinessService {
|
|
|
@Autowired
|
|
|
private KwcContractTradeTrackService kwcContractTradeTrackService;
|
|
|
|
|
|
+ private final StreamBridge streamBridge;
|
|
|
+
|
|
|
@Value("${eSignUrl}")
|
|
|
private String eSignUrl;
|
|
|
|
|
|
@@ -149,26 +160,34 @@ public class CommonBusinessService {
|
|
|
}
|
|
|
|
|
|
|
|
|
- public static void main(String[] args) throws Exception {
|
|
|
-// String fileName = "车企合同.docx";
|
|
|
-// System.out.println(new String(fileName.getBytes(), StandardCharsets.UTF_8));
|
|
|
-// String url = "https://kaiwu-saas.oss-cn-chengdu.aliyuncs.com/kll/uploads/20230823/67189e3e9284951c9cf434cacef7c4c4.docx";
|
|
|
-// File file = getFileByHttpURL(url, fileName);
|
|
|
-// List<Long> entIds = new ArrayList<>(2);
|
|
|
-// entIds.add(123123L);
|
|
|
-// entIds.add(512414L);
|
|
|
-// EsignGetFlowReqDto esignGetFlowReqDto = new EsignGetFlowReqDto();
|
|
|
-// esignGetFlowReqDto.setFile(file);
|
|
|
-// esignGetFlowReqDto.setSeqId(String.valueOf(11234125L));
|
|
|
-// esignGetFlowReqDto.setSignFlowTitle("测试Title");
|
|
|
-// esignGetFlowReqDto.setOrgFirstName("测试企业2");
|
|
|
-// esignGetFlowReqDto.setPsnFirstAccount("13900001112");
|
|
|
-// esignGetFlowReqDto.setOrgSecondName("测试企业1");
|
|
|
-// esignGetFlowReqDto.setPsnSecondAccount("13900001111");
|
|
|
-// Map<String, Object> map = BeanUtils.convertToMap(esignGetFlowReqDto);
|
|
|
-// String res = OkHttpUtils.doPostUploadFile("http://10.10.10.224:8840/v1/sign/getFlow", map);
|
|
|
-//// String res = OkHttpUtils.doPostUploadFile("http://10.10.10.70:27802/openapi/vehicleLocate/fileUpload", map);
|
|
|
-// log.info("E签宝返参:{}", res);
|
|
|
+
|
|
|
+
|
|
|
+ public void sendSystemMessage(List<UserInfo> userInfos, MessageEnum messageEnum, Map<String, Object> map, String msgUrl) {
|
|
|
+ SckwMessage msg = new SckwMessage();
|
|
|
+ msg.setRequestId(UUIDUtils.get32UUID())
|
|
|
+ .setMessageEnum(messageEnum)
|
|
|
+ .setParams(map)
|
|
|
+ .setMsgUrl(msgUrl)
|
|
|
+ .setUserInfos(userInfos)
|
|
|
+ .setCreateBy(LoginUserHolder.getUserId());
|
|
|
+ AsyncThreadUtils.submit(new AsyncProcessMessage(msg, streamBridge));
|
|
|
+ }
|
|
|
+
|
|
|
+ static class AsyncProcessMessage implements Runnable {
|
|
|
+
|
|
|
+ private SckwMessage sckwMessage;
|
|
|
+
|
|
|
+ private StreamBridge streamBridge;
|
|
|
+
|
|
|
+ AsyncProcessMessage(SckwMessage sckwMessage, StreamBridge streamBridge) {
|
|
|
+ this.sckwMessage = sckwMessage;
|
|
|
+ this.streamBridge = streamBridge;
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void run() {
|
|
|
+ streamBridge.send("sckw-message", JSON.toJSONString(sckwMessage));
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
static class AsyncProcess implements Runnable {
|