Merge branch 'fix_foton_20240408' into 'master'
Fix foton 20240408 See merge request laws-foton-slrs/foton-wkflow-rest!88
This commit is contained in:
@@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -251,10 +251,6 @@ public class OkHttpUtil {
|
||||
* @return
|
||||
*/
|
||||
public String postForJson(String url, String json, Map<String, String> 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();
|
||||
|
||||
+40
@@ -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,41 @@ public class WebServiceOAController extends BaseAction {
|
||||
return WrapMapper.ok(result);
|
||||
}
|
||||
|
||||
@Autowired
|
||||
private ISendTodoLogService sendTodoLogService;
|
||||
@ApiOperation(value = "OA发送失败的补发")
|
||||
@GetMapping("/reissueSendOA")
|
||||
public String reissueSendOA() throws Exception {
|
||||
LambdaQueryWrapper<SendTodoLog> 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<SendTodoLog> 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);
|
||||
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";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user