From 979a7eeb135cf2d719cd25b9efcf9261669c310b Mon Sep 17 00:00:00 2001 From: wxyclub Date: Mon, 22 Apr 2024 15:24:46 +0800 Subject: [PATCH 1/3] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8DOA=E6=B6=88?= =?UTF-8?q?=E6=81=AF=E5=8F=91=E9=80=81=E6=96=B9=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/ydw/bat/wkflow/business_oa/config/OkHttpConfig.java | 4 ++-- .../com/ydw/bat/wkflow/business_oa/utils/OkHttpUtil.java | 6 +----- 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/src/main/java/com/ydw/bat/wkflow/business_oa/config/OkHttpConfig.java b/src/main/java/com/ydw/bat/wkflow/business_oa/config/OkHttpConfig.java index cd3db618..979e548c 100644 --- a/src/main/java/com/ydw/bat/wkflow/business_oa/config/OkHttpConfig.java +++ b/src/main/java/com/ydw/bat/wkflow/business_oa/config/OkHttpConfig.java @@ -62,8 +62,8 @@ public class OkHttpConfig { .sslSocketFactory(sslSocketFactory(), x509TrustManager()) .retryOnConnectionFailure(false)//是否开启缓存 .connectionPool(pool())//连接池 - .connectTimeout(10L, TimeUnit.SECONDS) - .readTimeout(10L, TimeUnit.SECONDS) + .connectTimeout(2L, TimeUnit.MINUTES) + .readTimeout(2L, TimeUnit.MINUTES) .build(); } } diff --git a/src/main/java/com/ydw/bat/wkflow/business_oa/utils/OkHttpUtil.java b/src/main/java/com/ydw/bat/wkflow/business_oa/utils/OkHttpUtil.java index 557f0647..5f73fa81 100644 --- a/src/main/java/com/ydw/bat/wkflow/business_oa/utils/OkHttpUtil.java +++ b/src/main/java/com/ydw/bat/wkflow/business_oa/utils/OkHttpUtil.java @@ -251,10 +251,6 @@ public class OkHttpUtil { * @return */ public String postForJson(String url, String json, Map headerParams){ - OkHttpClient client = new OkHttpClient.Builder() - .connectTimeout(2, TimeUnit.MINUTES)//设置连接超时时间 - .readTimeout(2, TimeUnit.MINUTES)//设置读取超时时间 - .build(); RequestBody requestBody = FormBody.create(MediaType.parse("application/json; charset=utf-8"), json); String responseBody = ""; Request.Builder requestBuilder = new Request.Builder().url(url); @@ -262,7 +258,7 @@ public class OkHttpUtil { requestBuilder.addHeader(entry.getKey(), entry.getValue()); } Request request = requestBuilder.post(requestBody).build(); - try (Response response = client.newCall(request).execute()) { + try (Response response = okHttpClient.newCall(request).execute()) { int status = response.code(); if (status == 200) { return response.body().string(); From 581610e750a5d12e122f2d67a335a6c50a2c12ca Mon Sep 17 00:00:00 2001 From: wxyclub Date: Mon, 22 Apr 2024 17:11:53 +0800 Subject: [PATCH 2/3] =?UTF-8?q?fix:=20OA=E5=8F=91=E9=80=81=E5=A4=B1?= =?UTF-8?q?=E8=B4=A5=E7=9A=84=E8=A1=A5=E5=8F=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/WebServiceOAController.java | 37 +++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/src/main/java/com/ydw/bat/wkflow/business_oa/webService/controller/WebServiceOAController.java b/src/main/java/com/ydw/bat/wkflow/business_oa/webService/controller/WebServiceOAController.java index 7410a96d..ac47b970 100644 --- a/src/main/java/com/ydw/bat/wkflow/business_oa/webService/controller/WebServiceOAController.java +++ b/src/main/java/com/ydw/bat/wkflow/business_oa/webService/controller/WebServiceOAController.java @@ -5,6 +5,7 @@ import java.util.*; import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.serializer.SerializerFeature; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.tmsps.fk.common.util.JsonUtil; import com.ydw.bat.wkflow.business_activiti.dto.*; @@ -22,6 +23,8 @@ import com.alibaba.fastjson.JSONObject; import com.ydw.bat.wkflow.business_main.datas.service.IBusProcessEntrustService; import com.ydw.bat.wkflow.business_main.datas.service.IBusProcessNameService; import com.ydw.bat.wkflow.business_main.datas.service.IBusProcessNewService; +import com.ydw.bat.wkflow.business_main.datas.service.ISendTodoLogService; +import com.ydw.bat.wkflow.business_main.datas.service.impl.SendTodoLogServiceImpl; import com.ydw.bat.wkflow.business_oa.webService.service.WebServiceOAService; import com.ydw.bat.wkflow.business_oa.webService.todoContent.NotifyTodoSendContext; import com.ydw.bat.wkflow.business_oa.webService.todoContent.SendOAContent; @@ -83,4 +86,38 @@ public class WebServiceOAController extends BaseAction { return WrapMapper.ok(result); } + @Autowired + private ISendTodoLogService sendTodoLogService; + @ApiOperation(value = "OA发送失败的补发") + @GetMapping("/reissueSendOA") + public String reissueSendOA() throws Exception { + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper.eq(SendTodoLog::getOperMesg,"okhttp post error >> ex = {} sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target"); + wrapper.gt(SendTodoLog::getCreateTime,"2024-04-19 18:00:00"); + wrapper.orderByAsc(SendTodoLog::getCreateTime); + List sendTodoLogList = sendTodoLogService.list(wrapper); + for (SendTodoLog sendTodoLog : sendTodoLogList) { + String msgType = sendTodoLog.getMsgType(); + String mesg = sendTodoLog.getMesg(); + JSONObject jsonObject = JSONObject.parseObject(mesg); + if ("0".equals(msgType)) { + // 待办 + JSONObject processNewJsonObject = jsonObject.getJSONObject("mesg"); + BusProcessNew busProcessNew = JSONObject.toJavaObject(processNewJsonObject, BusProcessNew.class); + webServiceOAService.sendTodo(busProcessNew); + } else if ("1".equals(msgType)) { + // 已办 + JSONObject notifyTodoSendContextJsonObject = JSONObject.parseObject(mesg); + NotifyTodoSendContext notifyTodoSendContext = JSONObject.toJavaObject(notifyTodoSendContextJsonObject, NotifyTodoSendContext.class); + webServiceOAService.setTodoDone(notifyTodoSendContext); + } else if ("3".equals(msgType)) { + // 删除 + String todoId = sendTodoLog.getTodoId(); + String userId = sendTodoLog.getUserId(); + webServiceOAService.deleteOAByMandatory(todoId,userId); + } + } + return "ok"; + } + } From b307e999197f4338934364dd3ab1bb139e913425 Mon Sep 17 00:00:00 2001 From: wxyclub Date: Mon, 22 Apr 2024 17:46:26 +0800 Subject: [PATCH 3/3] =?UTF-8?q?fix:=20OA=E5=8F=91=E9=80=81=E5=A4=B1?= =?UTF-8?q?=E8=B4=A5=E7=9A=84=E8=A1=A5=E5=8F=91=EF=BC=8C=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=E7=AD=89=E5=BE=85=E6=97=B6=E9=97=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../webService/controller/WebServiceOAController.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/main/java/com/ydw/bat/wkflow/business_oa/webService/controller/WebServiceOAController.java b/src/main/java/com/ydw/bat/wkflow/business_oa/webService/controller/WebServiceOAController.java index ac47b970..eef23dd5 100644 --- a/src/main/java/com/ydw/bat/wkflow/business_oa/webService/controller/WebServiceOAController.java +++ b/src/main/java/com/ydw/bat/wkflow/business_oa/webService/controller/WebServiceOAController.java @@ -105,16 +105,19 @@ public class WebServiceOAController extends BaseAction { JSONObject processNewJsonObject = jsonObject.getJSONObject("mesg"); BusProcessNew busProcessNew = JSONObject.toJavaObject(processNewJsonObject, BusProcessNew.class); webServiceOAService.sendTodo(busProcessNew); + Thread.sleep(3000); } else if ("1".equals(msgType)) { // 已办 JSONObject notifyTodoSendContextJsonObject = JSONObject.parseObject(mesg); NotifyTodoSendContext notifyTodoSendContext = JSONObject.toJavaObject(notifyTodoSendContextJsonObject, NotifyTodoSendContext.class); webServiceOAService.setTodoDone(notifyTodoSendContext); + Thread.sleep(3000); } else if ("3".equals(msgType)) { // 删除 String todoId = sendTodoLog.getTodoId(); String userId = sendTodoLog.getUserId(); webServiceOAService.deleteOAByMandatory(todoId,userId); + Thread.sleep(3000); } } return "ok";