|
|
@ -2,6 +2,7 @@ package com.elink.esua.epdc.gird.shibei.api.impl; |
|
|
|
|
|
|
|
import cn.hutool.http.HttpRequest; |
|
|
|
import cn.hutool.http.HttpResponse; |
|
|
|
import com.alibaba.fastjson.JSONArray; |
|
|
|
import com.alibaba.fastjson.JSONObject; |
|
|
|
import com.elink.esua.epdc.gird.shibei.api.ShiBeiCityGridApi; |
|
|
|
import com.elink.esua.epdc.gird.shibei.contants.ApiConstants; |
|
|
@ -12,6 +13,7 @@ import com.elink.esua.epdc.gird.shibei.dto.form.EventRejectReDoFormDto; |
|
|
|
import com.elink.esua.epdc.gird.shibei.dto.form.SendEventFormDto; |
|
|
|
import com.elink.esua.epdc.gird.shibei.dto.form.SendInputInfoFormDto; |
|
|
|
import com.elink.esua.epdc.gird.shibei.dto.form.SendWenXinEvaluateInfoFormDto; |
|
|
|
import com.elink.esua.epdc.gird.shibei.dto.result.EventProcessBatchHisResultDto; |
|
|
|
import com.elink.esua.epdc.gird.shibei.dto.result.EventProcessHisResultDto; |
|
|
|
import com.elink.esua.epdc.gird.shibei.dto.result.EventRejectDoResultDto; |
|
|
|
import com.elink.esua.epdc.gird.shibei.dto.result.SendEventResultDto; |
|
|
@ -26,6 +28,8 @@ import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
import org.springframework.stereotype.Component; |
|
|
|
|
|
|
|
import java.io.IOException; |
|
|
|
import java.util.ArrayList; |
|
|
|
import java.util.List; |
|
|
|
import java.util.Map; |
|
|
|
|
|
|
|
/** |
|
|
@ -73,9 +77,9 @@ public class ShiBeiCityGridApiImpl implements ShiBeiCityGridApi { |
|
|
|
public SendEventResultDto sendEvent(SendEventFormDto sendEventFormDto) { |
|
|
|
String json = JSONObject.toJSONString(sendEventFormDto); |
|
|
|
// 百分号解析问题
|
|
|
|
json.replace("%","%"); |
|
|
|
String data = "content="+ json; |
|
|
|
LOGGER.info("发送地址:"+ApiConstants.sendEventUrl + "||发送参数:" + data); |
|
|
|
json.replace("%", "%"); |
|
|
|
String data = "content=" + json; |
|
|
|
LOGGER.info("发送地址:" + ApiConstants.sendEventUrl + "||发送参数:" + data); |
|
|
|
HttpResponse response = null; |
|
|
|
try { |
|
|
|
response = HttpRequest.post(ApiConstants.sendEventUrl).body(data) |
|
|
@ -88,18 +92,18 @@ public class ShiBeiCityGridApiImpl implements ShiBeiCityGridApi { |
|
|
|
LOGGER.info("事件上报返回数据:" + response.body()); |
|
|
|
JSONObject res = JSONObject.parseObject(response.body()); |
|
|
|
SendEventResultDto result = null; |
|
|
|
if(0 == Integer.parseInt(res.get("code").toString())){ |
|
|
|
if (0 == Integer.parseInt(res.get("code").toString())) { |
|
|
|
try { |
|
|
|
result = JSONObject.toJavaObject((JSONObject) res.get("data"), SendEventResultDto.class); |
|
|
|
result.setCode("0"); |
|
|
|
}catch (Exception e){ |
|
|
|
} catch (Exception e) { |
|
|
|
e.printStackTrace(); |
|
|
|
LOGGER.error("事件上报返回结果处理错误:" + e.getMessage()); |
|
|
|
} |
|
|
|
}else{ |
|
|
|
} else { |
|
|
|
try { |
|
|
|
result = JSONObject.toJavaObject(res, SendEventResultDto.class); |
|
|
|
}catch (Exception e){ |
|
|
|
} catch (Exception e) { |
|
|
|
e.printStackTrace(); |
|
|
|
LOGGER.error("事件上报返回结果处理错误:" + e.getMessage()); |
|
|
|
} |
|
|
@ -109,8 +113,8 @@ public class ShiBeiCityGridApiImpl implements ShiBeiCityGridApi { |
|
|
|
|
|
|
|
@Override |
|
|
|
public SendEventResultDto sendEventManual(String data) { |
|
|
|
data = "content="+ data; |
|
|
|
LOGGER.info("发送地址:"+ApiConstants.sendEventUrl + "||发送参数:" + data); |
|
|
|
data = "content=" + data; |
|
|
|
LOGGER.info("发送地址:" + ApiConstants.sendEventUrl + "||发送参数:" + data); |
|
|
|
HttpResponse response = null; |
|
|
|
try { |
|
|
|
response = HttpRequest.post(ApiConstants.sendEventUrl).body(data) |
|
|
@ -123,18 +127,18 @@ public class ShiBeiCityGridApiImpl implements ShiBeiCityGridApi { |
|
|
|
LOGGER.info("事件上报返回数据:" + response.body()); |
|
|
|
JSONObject res = JSONObject.parseObject(response.body()); |
|
|
|
SendEventResultDto result = null; |
|
|
|
if(0 == Integer.parseInt(res.get("code").toString())){ |
|
|
|
if (0 == Integer.parseInt(res.get("code").toString())) { |
|
|
|
try { |
|
|
|
result = JSONObject.toJavaObject((JSONObject) res.get("data"), SendEventResultDto.class); |
|
|
|
result.setCode("0"); |
|
|
|
}catch (Exception e){ |
|
|
|
} catch (Exception e) { |
|
|
|
e.printStackTrace(); |
|
|
|
LOGGER.error("事件上报返回结果处理错误:" + e.getMessage()); |
|
|
|
} |
|
|
|
}else{ |
|
|
|
} else { |
|
|
|
try { |
|
|
|
result = JSONObject.toJavaObject(res, SendEventResultDto.class); |
|
|
|
}catch (Exception e){ |
|
|
|
} catch (Exception e) { |
|
|
|
e.printStackTrace(); |
|
|
|
LOGGER.error("事件上报返回结果处理错误:" + e.getMessage()); |
|
|
|
} |
|
|
@ -186,7 +190,7 @@ public class ShiBeiCityGridApiImpl implements ShiBeiCityGridApi { |
|
|
|
|
|
|
|
@Override |
|
|
|
public EventProcessHisResultDto getHistoryByRecId(String recId) { |
|
|
|
String url = ApiConstants.historyUrl +"?recId="+recId; |
|
|
|
String url = ApiConstants.historyUrl + "?recId=" + recId; |
|
|
|
LOGGER.info("获取事件处理进度请求地址:" + url); |
|
|
|
HttpResponse response = null; |
|
|
|
try { |
|
|
@ -202,18 +206,44 @@ public class ShiBeiCityGridApiImpl implements ShiBeiCityGridApi { |
|
|
|
EventProcessHisResultDto result = null; |
|
|
|
try { |
|
|
|
result = JSONObject.toJavaObject(res, EventProcessHisResultDto.class); |
|
|
|
}catch (Exception e){ |
|
|
|
} catch (Exception e) { |
|
|
|
e.printStackTrace(); |
|
|
|
LOGGER.error("获取事件处理结果异常:" + e.getMessage()); |
|
|
|
} |
|
|
|
return result; |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public List<EventProcessBatchHisResultDto> getBatchHistoryByRecIds(String recIds) { |
|
|
|
String url = ApiConstants.batchHistoryUrl + "?recIds=" + recIds; |
|
|
|
LOGGER.info("获取事件处理进度请求地址:" + url); |
|
|
|
HttpResponse response = null; |
|
|
|
try { |
|
|
|
response = HttpRequest.get(url) |
|
|
|
.header("lan", "zh") |
|
|
|
.header("Content-type", "application/x-www-form-urlencoded;charset=UTF-8").execute(); |
|
|
|
} catch (Exception e) { |
|
|
|
e.printStackTrace(); |
|
|
|
LOGGER.error("获取事件处理进度异常:" + e.getMessage()); |
|
|
|
} |
|
|
|
LOGGER.info("获取事件处理进度返回数据:" + response.body()); |
|
|
|
JSONObject res = JSONObject.parseObject(response.body()); |
|
|
|
JSONArray dataList = JSONObject.parseArray(res.get("data").toString()); |
|
|
|
List<EventProcessBatchHisResultDto> results = new ArrayList<>(); |
|
|
|
try { |
|
|
|
results = dataList.toJavaList(EventProcessBatchHisResultDto.class); |
|
|
|
} catch (Exception e) { |
|
|
|
e.printStackTrace(); |
|
|
|
LOGGER.error("获取事件处理结果异常:" + e.getMessage()); |
|
|
|
} |
|
|
|
return results; |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public EventRejectDoResultDto sendReDoEvent(EventRejectReDoFormDto rejectReDoDTO) { |
|
|
|
String json = JSONObject.toJSONString(rejectReDoDTO); |
|
|
|
String data = "content="+ json; |
|
|
|
LOGGER.info("发送地址:"+ApiConstants.sendEventUrl + "||发送参数:" + data); |
|
|
|
String data = "content=" + json; |
|
|
|
LOGGER.info("发送地址:" + ApiConstants.sendEventUrl + "||发送参数:" + data); |
|
|
|
HttpResponse response = null; |
|
|
|
try { |
|
|
|
response = HttpRequest.post(ApiConstants.sendEventUrl).body(data) |
|
|
@ -226,18 +256,18 @@ public class ShiBeiCityGridApiImpl implements ShiBeiCityGridApi { |
|
|
|
LOGGER.info("事件驳回上报返回数据:" + response.body()); |
|
|
|
JSONObject res = JSONObject.parseObject(response.body()); |
|
|
|
EventRejectDoResultDto result = null; |
|
|
|
if(0 == Integer.parseInt(res.get("code").toString())){ |
|
|
|
if (0 == Integer.parseInt(res.get("code").toString())) { |
|
|
|
try { |
|
|
|
result = JSONObject.toJavaObject(res, EventRejectDoResultDto.class); |
|
|
|
result.setCode("0"); |
|
|
|
}catch (Exception e){ |
|
|
|
} catch (Exception e) { |
|
|
|
e.printStackTrace(); |
|
|
|
LOGGER.error("事件驳回上报返回结果处理错误:" + e.getMessage()); |
|
|
|
} |
|
|
|
}else{ |
|
|
|
} else { |
|
|
|
try { |
|
|
|
result = JSONObject.toJavaObject(res, EventRejectDoResultDto.class); |
|
|
|
}catch (Exception e){ |
|
|
|
} catch (Exception e) { |
|
|
|
e.printStackTrace(); |
|
|
|
LOGGER.error("事件驳回上报返回结果处理错误:" + e.getMessage()); |
|
|
|
} |
|
|
|