I2代码优化ceshi

master
liuguijing 1 year ago
parent 8ed582cf61
commit 9d08b1aaf8

@ -166,28 +166,28 @@ public class AsyncMethod {
@Async(value = "asyncServiceExecutor")
public void sendData2(Client client, String xml) throws Exception {
// Object[] objects = client.invoke("uploadCACData", xml);
// String threadId = Thread.currentThread().getName();
// log.info("线程序号: " + threadId + "当前时间:" + new Date());
// if (objects != null && objects.length > 0) {
// String string = String.valueOf(objects[0]);
// log.info("返回的长度 " + objects.length + " 返回的对象 " + string);
// JSONObject jsonObject = XML.toJSONObject(string);
// if (jsonObject != null) {
// JSONObject response = (JSONObject) jsonObject.get("response");
// if (response != null) {
// JSONObject result = (JSONObject) response.get("result");
// if (result != null) {
// Integer code = (Integer) result.get("code");
// if (code != null && code.intValue() == 0) {
// log.info("上传成功");
// } else {
// log.info("上传失败");
// }
// }
// }
// }
// }
Object[] objects = client.invoke("uploadCACData", xml);
String threadId = Thread.currentThread().getName();
log.info("线程序号: " + threadId + "当前时间:" + new Date());
if (objects != null && objects.length > 0) {
String string = String.valueOf(objects[0]);
log.info("返回的长度 " + objects.length + " 返回的对象 " + string);
JSONObject jsonObject = XML.toJSONObject(string);
if (jsonObject != null) {
JSONObject response = (JSONObject) jsonObject.get("response");
if (response != null) {
JSONObject result = (JSONObject) response.get("result");
if (result != null) {
Integer code = (Integer) result.get("code");
if (code != null && code.intValue() == 0) {
log.info("上传成功");
} else {
log.info("上传失败");
}
}
}
}
}
}
@ -218,6 +218,7 @@ public class AsyncMethod {
// }
}
// @Async(value = "asyncServiceExecutor")
public void updateRecordId(BigInteger maxid,String type) {
if (maxid != null && maxid.longValue() > 0) {
upload_checkDao.updateByPrimaryKey(type, maxid, new Date());

@ -35,36 +35,38 @@ public class WebServiceImpl implements Webservcies {
@Value("${webservice.address}")
public String address;
//
@Value("${webservice.connecttime}")
public Integer connecttime;
public int connecttime;
@Value("${webservice.receivetime}")
public Integer receivetime;
public int receivetime;
// private static String address = "http://10.238.71.98:18096/ppa/webservice/CAGAccessService?wsdl";
//
// public static int receivetime = 60;
//
// public static int connecttime = 60;
/**
* cac
*/
@Override
public void uploadData() {
// log.info("实时数据定时任务启动");
// // 动态客户端
// JaxWsDynamicClientFactory clientFactory = JaxWsDynamicClientFactory.newInstance();
// log.info("实时数据 publicsecurity webService url : {}", address);
// //根据WebServices接口地址创建client
// Client client = clientFactory.createClient(address);
// HTTPConduit conduit = (HTTPConduit) client.getConduit();
// HTTPClientPolicy policy = new HTTPClientPolicy();
// policy.setAllowChunking(false);
// // 连接服务器超时时间 60秒
// policy.setConnectionTimeout(connecttime);
// // 等待服务器响应超时时间 60秒
// policy.setReceiveTimeout(receivetime);
// conduit.setClient(policy);
Client client = null;
log.info("实时数据定时任务启动");
// 动态客户端
JaxWsDynamicClientFactory clientFactory = JaxWsDynamicClientFactory.newInstance();
log.info("实时数据 publicsecurity webService url : {}", address);
//根据WebServices接口地址创建client
Client client = clientFactory.createClient(address);
HTTPConduit conduit = (HTTPConduit) client.getConduit();
HTTPClientPolicy policy = new HTTPClientPolicy();
policy.setAllowChunking(false);
// 连接服务器超时时间 60秒
policy.setConnectionTimeout(connecttime);
// 等待服务器响应超时时间 60秒
policy.setReceiveTimeout(receivetime);
conduit.setClient(policy);
log.info("开始执行定时任务-查询数据库");
HashMap<Integer, Niec_Sensors> equipMap = new HashMap();
List<Niec_Sensors> niec_sensors = niec_sensorsDao.selectAll();
@ -88,21 +90,20 @@ public class WebServiceImpl implements Webservcies {
//放到配置文件
@Override
public void uploadyspData() {
// log.info("油色谱数据定时任务启动");
// // 动态客户端
// JaxWsDynamicClientFactory clientFactory = JaxWsDynamicClientFactory.newInstance();
// log.info("油色谱数据 publicsecurity webService url : {}", address);
// //根据WebServices接口地址创建client
// Client client = clientFactory.createClient(address);
// HTTPConduit conduit = (HTTPConduit) client.getConduit();
// HTTPClientPolicy policy = new HTTPClientPolicy();
// policy.setAllowChunking(false);
// // 连接服务器超时时间 60秒
// policy.setConnectionTimeout(connecttime);
// // 等待服务器响应超时时间 60秒
// policy.setReceiveTimeout(receivetime);
// conduit.setClient(policy);
Client client = null;
log.info("油色谱数据定时任务启动");
// 动态客户端
JaxWsDynamicClientFactory clientFactory = JaxWsDynamicClientFactory.newInstance();
log.info("油色谱数据 publicsecurity webService url : {}", address);
//根据WebServices接口地址创建client
Client client = clientFactory.createClient(address);
HTTPConduit conduit = (HTTPConduit) client.getConduit();
HTTPClientPolicy policy = new HTTPClientPolicy();
policy.setAllowChunking(false);
// 连接服务器超时时间 60秒
policy.setConnectionTimeout(connecttime);
// 等待服务器响应超时时间 60秒
policy.setReceiveTimeout(receivetime);
conduit.setClient(policy);
log.info("开始执行定时任务-查询数据库");
HashMap<Integer, Niec_Sensors> equipMap = new HashMap();
List<Niec_Sensors> niec_sensors = niec_sensorsDao.selectAll();
@ -115,21 +116,20 @@ public class WebServiceImpl implements Webservcies {
@Override
public void uploadjfjcData() {
// log.info("局放监测数据定时任务启动");
// // 动态客户端
// JaxWsDynamicClientFactory clientFactory = JaxWsDynamicClientFactory.newInstance();
// log.info("局放监测数据 publicsecurity webService url : {}", address);
// //根据WebServices接口地址创建client
// Client client = clientFactory.createClient(address);
// HTTPConduit conduit = (HTTPConduit) client.getConduit();
// HTTPClientPolicy policy = new HTTPClientPolicy();
// policy.setAllowChunking(false);
// // 连接服务器超时时间 60秒
// policy.setConnectionTimeout(connecttime);
// // 等待服务器响应超时时间 60秒
// policy.setReceiveTimeout(receivetime);
// conduit.setClient(policy);
Client client = null;
log.info("局放监测数据定时任务启动");
// 动态客户端
JaxWsDynamicClientFactory clientFactory = JaxWsDynamicClientFactory.newInstance();
log.info("局放监测数据 publicsecurity webService url : {}", address);
//根据WebServices接口地址创建client
Client client = clientFactory.createClient(address);
HTTPConduit conduit = (HTTPConduit) client.getConduit();
HTTPClientPolicy policy = new HTTPClientPolicy();
policy.setAllowChunking(false);
// 连接服务器超时时间 60秒
policy.setConnectionTimeout(connecttime);
// 等待服务器响应超时时间 60秒
policy.setReceiveTimeout(receivetime);
conduit.setClient(policy);
HashMap<Integer, Niec_Sensors> equipMap = new HashMap();
List<Niec_Sensors> niec_sensors = niec_sensorsDao.selectAll();
for (Niec_Sensors item : niec_sensors) {
@ -142,21 +142,20 @@ public class WebServiceImpl implements Webservcies {
@Override
public void uploadyxData() {
// log.info("实时数据定时任务启动");
// // 动态客户端
// JaxWsDynamicClientFactory clientFactory = JaxWsDynamicClientFactory.newInstance();
// log.info("实时数据 publicsecurity webService url : {}", address);
// //根据WebServices接口地址创建client
// Client client = clientFactory.createClient(address);
// HTTPConduit conduit = (HTTPConduit) client.getConduit();
// HTTPClientPolicy policy = new HTTPClientPolicy();
// policy.setAllowChunking(false);
// // 连接服务器超时时间 60秒
// policy.setConnectionTimeout(connecttime);
// // 等待服务器响应超时时间 60秒
// policy.setReceiveTimeout(receivetime);
// conduit.setClient(policy);
Client client = null;
log.info("实时数据定时任务启动");
// 动态客户端
JaxWsDynamicClientFactory clientFactory = JaxWsDynamicClientFactory.newInstance();
log.info("实时数据 publicsecurity webService url : {}", address);
//根据WebServices接口地址创建client
Client client = clientFactory.createClient(address);
HTTPConduit conduit = (HTTPConduit) client.getConduit();
HTTPClientPolicy policy = new HTTPClientPolicy();
policy.setAllowChunking(false);
// 连接服务器超时时间 60秒
policy.setConnectionTimeout(connecttime);
// 等待服务器响应超时时间 60秒
policy.setReceiveTimeout(receivetime);
conduit.setClient(policy);
log.info("开始执行定时任务-查询数据库");
HashMap<Integer, Niec_Sensors> equipMap = new HashMap();
List<Niec_Sensors> niec_sensors = niec_sensorsDao.selectAll();
@ -169,21 +168,20 @@ public class WebServiceImpl implements Webservcies {
@Override
public void uploaddcywData() {
// log.info("实时数据定时任务启动");
// // 动态客户端
// JaxWsDynamicClientFactory clientFactory = JaxWsDynamicClientFactory.newInstance();
// log.info("实时数据 publicsecurity webService url : {}", address);
// //根据WebServices接口地址创建client
// Client client = clientFactory.createClient(address);
// HTTPConduit conduit = (HTTPConduit) client.getConduit();
// HTTPClientPolicy policy = new HTTPClientPolicy();
// policy.setAllowChunking(false);
// // 连接服务器超时时间 60秒
// policy.setConnectionTimeout(connecttime);
// // 等待服务器响应超时时间 60秒
// policy.setReceiveTimeout(receivetime);
// conduit.setClient(policy);
Client client = null;
log.info("实时数据定时任务启动");
// 动态客户端
JaxWsDynamicClientFactory clientFactory = JaxWsDynamicClientFactory.newInstance();
log.info("实时数据 publicsecurity webService url : {}", address);
//根据WebServices接口地址创建client
Client client = clientFactory.createClient(address);
HTTPConduit conduit = (HTTPConduit) client.getConduit();
HTTPClientPolicy policy = new HTTPClientPolicy();
policy.setAllowChunking(false);
// 连接服务器超时时间 60秒
policy.setConnectionTimeout(connecttime);
// 等待服务器响应超时时间 60秒
policy.setReceiveTimeout(receivetime);
conduit.setClient(policy);
log.info("开始执行定时任务-查询数据库");
HashMap<Integer, Niec_Sensors> equipMap = new HashMap();
List<Niec_Sensors> niec_sensors = niec_sensorsDao.selectAll();
@ -196,21 +194,20 @@ public class WebServiceImpl implements Webservcies {
@Override
public void uploadjsyhwjyjcData() {
// log.info("实时数据定时任务启动");
// // 动态客户端
// JaxWsDynamicClientFactory clientFactory = JaxWsDynamicClientFactory.newInstance();
// log.info("实时数据 publicsecurity webService url : {}", address);
// //根据WebServices接口地址创建client
// Client client = clientFactory.createClient(address);
// HTTPConduit conduit = (HTTPConduit) client.getConduit();
// HTTPClientPolicy policy = new HTTPClientPolicy();
// policy.setAllowChunking(false);
// // 连接服务器超时时间 60秒
// policy.setConnectionTimeout(connecttime);
// // 等待服务器响应超时时间 60秒
// policy.setReceiveTimeout(receivetime);
// conduit.setClient(policy);
Client client = null;
log.info("实时数据定时任务启动");
// 动态客户端
JaxWsDynamicClientFactory clientFactory = JaxWsDynamicClientFactory.newInstance();
log.info("实时数据 publicsecurity webService url : {}", address);
//根据WebServices接口地址创建client
Client client = clientFactory.createClient(address);
HTTPConduit conduit = (HTTPConduit) client.getConduit();
HTTPClientPolicy policy = new HTTPClientPolicy();
policy.setAllowChunking(false);
// 连接服务器超时时间 60秒
policy.setConnectionTimeout(connecttime);
// 等待服务器响应超时时间 60秒
policy.setReceiveTimeout(receivetime);
conduit.setClient(policy);
log.info("开始执行定时任务-查询数据库");
HashMap<Integer, Niec_Sensors> equipMap = new HashMap();
List<Niec_Sensors> niec_sensors = niec_sensorsDao.selectAll();

File diff suppressed because it is too large Load Diff

@ -26,56 +26,48 @@ public class ScheduledTask {
@Autowired
XydlI2Service xydlI2Service;
private int i1 = 0;
private int i2 = 0;
private int i3 = 0;
private int i4 = 0;
private int i5 = 0;
private int i6 = 0;
private int i7 = 0;
private int i8 = 0;
private int i9 = 0;
@Scheduled(fixedDelay = 60 * 60 * 1000)
public void cacyspupload() {
log.error("cacyspupload执行" + (i1++) );
log.info("cacyspupload执行" );
webservcies.uploadyspData();
}
@Scheduled(fixedDelay = 1 * 60 * 1000)
@Scheduled(fixedDelay = 10 * 60 * 1000)
public void cacjfjcupload() {
log.error("cacjfjcupload执行" + (i2++) );
log.info("cacjfjcupload执行" );
webservcies.uploadjfjcData();
}
@Scheduled(fixedDelay = 1 * 30 * 1000)
public void cacupload() {
log.error("cacupload执行" + (i3++) );
log.info("cacupload执行" );
webservcies.uploadData();
}
@Scheduled(fixedDelay = 1 * 30 * 1000)
public void cacyxupload() {
log.error("cacyxupload执行" + (i4++) );
log.info("cacyxupload执行" );
webservcies.uploadyxData();
}
@Scheduled(fixedDelay = 1 * 30 * 1000)
public void cacdcywupload() {
log.error("cacdcywupload执行" + (i5++) );
log.info("cacdcywupload执行" );
webservcies.uploaddcywData();
}
@Scheduled(fixedDelay = 1 * 30 * 1000)
public void cacjsyhwjyjcupload() {
log.error("cacjsyhwjyjcupload执行" + (i6++) );
log.info("cacjsyhwjyjcupload执行" );
webservcies.uploadjsyhwjyjcData();
}
// @Scheduled(cron = "0 0 13 * * ?")
// public void clear() {
// xydlI2Service.clear_history();
// }
@Scheduled(cron = "0 0 13 * * ?")
public void clear() {
log.info("clear" );
xydlI2Service.clear_history();
}
}

@ -9,7 +9,7 @@ spring:
task:
scheduling:
pool:
size: 8
size: 20
# 开发环境配置
server:
@ -36,6 +36,6 @@ mybatis:
webservice:
# 超高压中心地址
address: http://10.238.71.98:18096/ppa/webservice/CAGAccessService?wsdl
connecttime: 30
receivetime: 30
connecttime: 60000
receivetime: 60000
sendlimit: 100

@ -23,7 +23,7 @@
t1.id, t1.eqmid, t1.acquisitionTime, t1.dischargeCapacity, t1.dischargePosition, t1.pulseCount, t1.isupload,
t1.dischargeWaveform,t1.create_time, t1.update_time
FROM
data_byq_jbfd t1 where t1.id <![CDATA[>]]> #{maxid}
data_byq_jbfd t1 where t1.id <![CDATA[>]]> #{maxid} limit 1000
</select>
<select id="selectUpload" resultMap="BaseResultMap">

@ -18,7 +18,7 @@
select
<include refid="Base_Column_List"/>
from data_cnj
where id <![CDATA[>]]> #{maxid}
where id <![CDATA[>]]> #{maxid} limit 1000
</select>
<select id="selectUpload" resultMap="BaseResultMap">

@ -18,7 +18,7 @@
select
<include refid="Base_Column_List"/>
from data_dcyw
where id <![CDATA[>]]> #{maxid}
where id <![CDATA[>]]> #{maxid} limit 1000
</select>
<select id="selectUpload" resultMap="BaseResultMap">

@ -26,7 +26,7 @@
t1.isupload,t1.dischargeWaveform,t1.create_time, t1.update_time
FROM
data_dlq_jbfd t1
where t1.id <![CDATA[>]]> #{maxid}
where t1.id <![CDATA[>]]> #{maxid} limit 1000
</select>
<select id="selectUpload" resultMap="BaseResultMap">

@ -24,7 +24,7 @@
select
<include refid="Base_Column_List"/>
from data_dr_jyjc
where id <![CDATA[>]]> #{maxid}
where id <![CDATA[>]]> #{maxid} limit 1000
</select>
<select id="selectUpload" resultMap="BaseResultMap">

@ -19,7 +19,7 @@
select
<include refid="Base_Column_List"/>
from data_fhdlbx
where id <![CDATA[>]]> #{maxid}
where id <![CDATA[>]]> #{maxid} limit 1000
</select>
<select id="selectUpload" resultMap="BaseResultMap">

@ -23,7 +23,7 @@
select
<include refid="Base_Column_List"/>
from data_jsyhw_jyjc
where id <![CDATA[>]]> #{maxid}
where id <![CDATA[>]]> #{maxid} limit 1000
</select>
<select id="selectUpload" resultMap="BaseResultMap">

@ -26,7 +26,7 @@
select
<include refid="Base_Column_List"/>
from data_microclimate
where id <![CDATA[>]]> #{maxid}
where id <![CDATA[>]]> #{maxid} limit 1000
</select>
<select id="selectUpload" resultMap="BaseResultMap">

@ -19,7 +19,7 @@
select
<include refid="Base_Column_List"/>
from data_sf6_qtsf
where id <![CDATA[>]]> #{maxid}
where id <![CDATA[>]]> #{maxid} limit 1000
</select>
<select id="selectUpload" resultMap="BaseResultMap">

@ -17,7 +17,7 @@
select
<include refid="Base_Column_List"/>
from data_tx
where id <![CDATA[>]]> #{maxid}
where id <![CDATA[>]]> #{maxid} limit 1000
</select>
<select id="selectUpload" resultMap="BaseResultMap">

@ -17,7 +17,7 @@
select
<include refid="Base_Column_List"/>
from data_ws
where id <![CDATA[>]]> #{maxid}
where id <![CDATA[>]]> #{maxid} limit 1000
</select>
<select id="selectUpload" resultMap="BaseResultMap">

@ -29,7 +29,7 @@
t1.id, t1.eqmid, t1.acquisitionTime, t1.H2, t1.CH4, t1.C2H6, t1.C2H4, t1.C2H2,t1.CO, t1.CO2, t1.O2, t1.N2,
t1.TotalHydrocarbon,t1.isupload, t1.create_time, t1.update_time
FROM
data_ysp t1 where t1.id <![CDATA[>]]> #{maxid}
data_ysp t1 where t1.id <![CDATA[>]]> #{maxid} limit 1000
</select>

@ -18,7 +18,7 @@
select
<include refid="Base_Column_List"/>
from data_fhzxq
where id <![CDATA[>]]> #{maxid}
where id <![CDATA[>]]> #{maxid} limit 1000
</select>
<select id="selectUpload" resultMap="BaseResultMap">

Loading…
Cancel
Save