1.国网上送
This commit is contained in:
@@ -1,6 +1,10 @@
|
|||||||
package com.njcn.web.enums;
|
package com.njcn.web.enums;
|
||||||
|
|
||||||
|
|
||||||
|
import com.njcn.web.utils.GwSendUtil;
|
||||||
|
|
||||||
|
import static com.njcn.web.utils.GwSendUtil.NEWGWURL;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Description: 上送枚举
|
* @Description: 上送枚举
|
||||||
* @Author: wr
|
* @Author: wr
|
||||||
@@ -39,13 +43,13 @@ public enum GWSendEnum {
|
|||||||
|
|
||||||
|
|
||||||
//调用总部下发工单的反馈单接口
|
//调用总部下发工单的反馈单接口
|
||||||
WORK_ORDER_FEEDBACK("workOrderFeedBack", "/pms-ghq-powerquality-start/powerQuality/workOrder/receiveFeedbackInfo"),
|
WORK_ORDER_FEEDBACK("workOrderFeedBack", "/powerQuality/workOrder/receiveFeedbackInfo"),
|
||||||
|
|
||||||
PARK_AND_STATION("parkAndStation", "/pms-ghq-powerquality-start/powerQuality/park/create"),
|
PARK_AND_STATION("parkAndStation", "/powerQuality/park/create"),
|
||||||
|
|
||||||
REPORT_CREATE("reportCreate", "/pms-ghq-powerquality-start/powerQuality/report/create"),
|
REPORT_CREATE("reportCreate", "/powerQuality/report/create"),
|
||||||
|
|
||||||
COMM_POINT("commPoint","/pms-ghq-powerquality-start/powerQuality/publicConnection/pqBusMonitorDataStatisticalCreate")
|
COMM_POINT("commPoint","/powerQuality/publicConnection/pqBusMonitorDataStatisticalCreate")
|
||||||
|
|
||||||
;
|
;
|
||||||
|
|
||||||
@@ -66,4 +70,8 @@ public enum GWSendEnum {
|
|||||||
public String getUrl() {
|
public String getUrl() {
|
||||||
return "http://dwzyywzt-pms3-proxy.com/CSB" + url;
|
return "http://dwzyywzt-pms3-proxy.com/CSB" + url;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getNewUrl(){
|
||||||
|
return GwSendUtil.NEWGWURL + url;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -29,6 +29,8 @@ public class GwSendUtil {
|
|||||||
private static final String GWURL = "dwzyywzt-pms3-proxy.com";
|
private static final String GWURL = "dwzyywzt-pms3-proxy.com";
|
||||||
private static final String CODE = "13B9B47F1E483324E05338297A0A0595";
|
private static final String CODE = "13B9B47F1E483324E05338297A0A0595";
|
||||||
|
|
||||||
|
public static final String NEWGWURL = "http://pms.pms30.com.cn/pms-tech-seval";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @param param 上报入参数据
|
* @param param 上报入参数据
|
||||||
@@ -112,6 +114,59 @@ public class GwSendUtil {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新的上送方式
|
||||||
|
* @param param
|
||||||
|
* @param sendEnum
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public static Map<String, String> newSend(SendParam param, GWSendEnum sendEnum) {
|
||||||
|
Map<String, String> map = new LinkedHashMap<>();
|
||||||
|
try {
|
||||||
|
ContentBody cb;
|
||||||
|
if (ObjectUtil.isNull(param)) {
|
||||||
|
cb = new ContentBody("");
|
||||||
|
} else {
|
||||||
|
String s = JSONObject.toJSONStringWithDateFormat(param, JSON.DEFFAULT_DATE_FORMAT);
|
||||||
|
log.info(Thread.currentThread().getName() + "1.信息:" + s);
|
||||||
|
cb = new ContentBody(s);
|
||||||
|
}
|
||||||
|
//ContentBody传递,要求使用post方式进行调用
|
||||||
|
//如果需要传递请求参数 可以拼接到请求URL中,或者设置paramsMap参数由SDK内部进行拼接
|
||||||
|
HttpParameters.Builder builder = HttpParameters.newBuilder();
|
||||||
|
|
||||||
|
builder.requestURL(sendEnum.getNewUrl()) // 设置请求的URL,可以拼接URL请求参数
|
||||||
|
.api("zongbuSync") // 设置服务名
|
||||||
|
.version("1.0.0") // 设置版本号
|
||||||
|
.method("post") // 设置调用方式, 必须为 post
|
||||||
|
.contentType("application/json; charset=UTF-8"); //设置请求content-type
|
||||||
|
|
||||||
|
builder.contentBody(cb);
|
||||||
|
|
||||||
|
//进行调用,返回结果
|
||||||
|
try {
|
||||||
|
HttpReturn ret = HttpCaller.invokeReturn(builder.build());
|
||||||
|
String responseStr = ret.getResponseStr();//获取响应的文本串
|
||||||
|
if (responseStr.indexOf("\\\"") != -1) {
|
||||||
|
responseStr = responseStr.replace("\\\"", "\"");
|
||||||
|
}
|
||||||
|
Map mapData = JSON.parseObject(responseStr, Map.class);
|
||||||
|
if(mapData.containsKey("error_msg")){
|
||||||
|
throw new BusinessException("国网上送接口超时,请重新上送");
|
||||||
|
}
|
||||||
|
map.put("succeed", responseStr);
|
||||||
|
} catch (HttpCallerException e) {
|
||||||
|
// error process
|
||||||
|
log.info(Thread.currentThread().getName() + "错误信息:" + e);
|
||||||
|
map.put("error", e.toString());
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
map.put("error", "当前时间段国网上送请求过多,请稍后再试");
|
||||||
|
}
|
||||||
|
return map;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 用于单次调用的返回
|
* 用于单次调用的返回
|
||||||
* @author cdf
|
* @author cdf
|
||||||
|
|||||||
@@ -237,8 +237,8 @@ whitelist:
|
|||||||
# - /harmonic-prepare/**
|
# - /harmonic-prepare/**
|
||||||
# - /process-boot/**
|
# - /process-boot/**
|
||||||
# - /bpm-boot/**
|
# - /bpm-boot/**
|
||||||
- /system-boot/**
|
# - /system-boot/**
|
||||||
- /supervision-boot/**
|
# - /supervision-boot/**
|
||||||
# - /user-boot/**
|
# - /user-boot/**
|
||||||
# - /harmonic-boot/**
|
# - /harmonic-boot/**
|
||||||
# - /cs-device-boot/**
|
# - /cs-device-boot/**
|
||||||
|
|||||||
@@ -97,8 +97,8 @@ public class RUploadCommPointBusServiceImpl extends ServiceImpl<RUploadCommPoint
|
|||||||
}
|
}
|
||||||
sendParam.setStatisticalDate(param.getSearchBeginTime());
|
sendParam.setStatisticalDate(param.getSearchBeginTime());
|
||||||
}
|
}
|
||||||
sendParam.setStats(list);
|
sendParam.setStats(list.get(i));
|
||||||
Map<String, String> sendRes = GwSendUtil.send(sendParam, GWSendEnum.COMM_POINT);
|
Map<String, String> sendRes = GwSendUtil.newSend(sendParam, GWSendEnum.COMM_POINT);
|
||||||
List<String> ids = list.get(i).stream().map(RUploadCommPointBus::getObjId).collect(Collectors.toList());
|
List<String> ids = list.get(i).stream().map(RUploadCommPointBus::getObjId).collect(Collectors.toList());
|
||||||
int count = GwSendUtil.returnInfoMsg(ids,sendRes);
|
int count = GwSendUtil.returnInfoMsg(ids,sendRes);
|
||||||
System.out.println("上送成功,上送成功返回"+count+"条");
|
System.out.println("上送成功,上送成功返回"+count+"条");
|
||||||
|
|||||||
@@ -86,6 +86,12 @@
|
|||||||
<version>${project.version}</version>
|
<version>${project.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.njcn</groupId>
|
||||||
|
<artifactId>cs-device-api</artifactId>
|
||||||
|
<version>1.0.0</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
<build>
|
<build>
|
||||||
|
|||||||
Reference in New Issue
Block a user