I2代码优化ceshi

master
liuguijing 1 year ago
parent 8ed582cf61
commit 9d08b1aaf8

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

@ -35,36 +35,38 @@ public class WebServiceImpl implements Webservcies {
@Value("${webservice.address}") @Value("${webservice.address}")
public String address; public String address;
//
@Value("${webservice.connecttime}") @Value("${webservice.connecttime}")
public Integer connecttime; public int connecttime;
@Value("${webservice.receivetime}") @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 * cac
*/ */
@Override @Override
public void uploadData() { public void uploadData() {
// log.info("实时数据定时任务启动"); log.info("实时数据定时任务启动");
// // 动态客户端 // 动态客户端
// JaxWsDynamicClientFactory clientFactory = JaxWsDynamicClientFactory.newInstance(); JaxWsDynamicClientFactory clientFactory = JaxWsDynamicClientFactory.newInstance();
// log.info("实时数据 publicsecurity webService url : {}", address); log.info("实时数据 publicsecurity webService url : {}", address);
// //根据WebServices接口地址创建client //根据WebServices接口地址创建client
// Client client = clientFactory.createClient(address); Client client = clientFactory.createClient(address);
// HTTPConduit conduit = (HTTPConduit) client.getConduit(); HTTPConduit conduit = (HTTPConduit) client.getConduit();
// HTTPClientPolicy policy = new HTTPClientPolicy(); HTTPClientPolicy policy = new HTTPClientPolicy();
// policy.setAllowChunking(false); policy.setAllowChunking(false);
// // 连接服务器超时时间 60秒 // 连接服务器超时时间 60秒
// policy.setConnectionTimeout(connecttime); policy.setConnectionTimeout(connecttime);
// // 等待服务器响应超时时间 60秒 // 等待服务器响应超时时间 60秒
// policy.setReceiveTimeout(receivetime); policy.setReceiveTimeout(receivetime);
// conduit.setClient(policy); conduit.setClient(policy);
Client client = null;
log.info("开始执行定时任务-查询数据库"); log.info("开始执行定时任务-查询数据库");
HashMap<Integer, Niec_Sensors> equipMap = new HashMap(); HashMap<Integer, Niec_Sensors> equipMap = new HashMap();
List<Niec_Sensors> niec_sensors = niec_sensorsDao.selectAll(); List<Niec_Sensors> niec_sensors = niec_sensorsDao.selectAll();
@ -88,21 +90,20 @@ public class WebServiceImpl implements Webservcies {
//放到配置文件 //放到配置文件
@Override @Override
public void uploadyspData() { public void uploadyspData() {
// log.info("油色谱数据定时任务启动"); log.info("油色谱数据定时任务启动");
// // 动态客户端 // 动态客户端
// JaxWsDynamicClientFactory clientFactory = JaxWsDynamicClientFactory.newInstance(); JaxWsDynamicClientFactory clientFactory = JaxWsDynamicClientFactory.newInstance();
// log.info("油色谱数据 publicsecurity webService url : {}", address); log.info("油色谱数据 publicsecurity webService url : {}", address);
// //根据WebServices接口地址创建client //根据WebServices接口地址创建client
// Client client = clientFactory.createClient(address); Client client = clientFactory.createClient(address);
// HTTPConduit conduit = (HTTPConduit) client.getConduit(); HTTPConduit conduit = (HTTPConduit) client.getConduit();
// HTTPClientPolicy policy = new HTTPClientPolicy(); HTTPClientPolicy policy = new HTTPClientPolicy();
// policy.setAllowChunking(false); policy.setAllowChunking(false);
// // 连接服务器超时时间 60秒 // 连接服务器超时时间 60秒
// policy.setConnectionTimeout(connecttime); policy.setConnectionTimeout(connecttime);
// // 等待服务器响应超时时间 60秒 // 等待服务器响应超时时间 60秒
// policy.setReceiveTimeout(receivetime); policy.setReceiveTimeout(receivetime);
// conduit.setClient(policy); conduit.setClient(policy);
Client client = null;
log.info("开始执行定时任务-查询数据库"); log.info("开始执行定时任务-查询数据库");
HashMap<Integer, Niec_Sensors> equipMap = new HashMap(); HashMap<Integer, Niec_Sensors> equipMap = new HashMap();
List<Niec_Sensors> niec_sensors = niec_sensorsDao.selectAll(); List<Niec_Sensors> niec_sensors = niec_sensorsDao.selectAll();
@ -115,21 +116,20 @@ public class WebServiceImpl implements Webservcies {
@Override @Override
public void uploadjfjcData() { public void uploadjfjcData() {
// log.info("局放监测数据定时任务启动"); log.info("局放监测数据定时任务启动");
// // 动态客户端 // 动态客户端
// JaxWsDynamicClientFactory clientFactory = JaxWsDynamicClientFactory.newInstance(); JaxWsDynamicClientFactory clientFactory = JaxWsDynamicClientFactory.newInstance();
// log.info("局放监测数据 publicsecurity webService url : {}", address); log.info("局放监测数据 publicsecurity webService url : {}", address);
// //根据WebServices接口地址创建client //根据WebServices接口地址创建client
// Client client = clientFactory.createClient(address); Client client = clientFactory.createClient(address);
// HTTPConduit conduit = (HTTPConduit) client.getConduit(); HTTPConduit conduit = (HTTPConduit) client.getConduit();
// HTTPClientPolicy policy = new HTTPClientPolicy(); HTTPClientPolicy policy = new HTTPClientPolicy();
// policy.setAllowChunking(false); policy.setAllowChunking(false);
// // 连接服务器超时时间 60秒 // 连接服务器超时时间 60秒
// policy.setConnectionTimeout(connecttime); policy.setConnectionTimeout(connecttime);
// // 等待服务器响应超时时间 60秒 // 等待服务器响应超时时间 60秒
// policy.setReceiveTimeout(receivetime); policy.setReceiveTimeout(receivetime);
// conduit.setClient(policy); conduit.setClient(policy);
Client client = null;
HashMap<Integer, Niec_Sensors> equipMap = new HashMap(); HashMap<Integer, Niec_Sensors> equipMap = new HashMap();
List<Niec_Sensors> niec_sensors = niec_sensorsDao.selectAll(); List<Niec_Sensors> niec_sensors = niec_sensorsDao.selectAll();
for (Niec_Sensors item : niec_sensors) { for (Niec_Sensors item : niec_sensors) {
@ -142,21 +142,20 @@ public class WebServiceImpl implements Webservcies {
@Override @Override
public void uploadyxData() { public void uploadyxData() {
// log.info("实时数据定时任务启动"); log.info("实时数据定时任务启动");
// // 动态客户端 // 动态客户端
// JaxWsDynamicClientFactory clientFactory = JaxWsDynamicClientFactory.newInstance(); JaxWsDynamicClientFactory clientFactory = JaxWsDynamicClientFactory.newInstance();
// log.info("实时数据 publicsecurity webService url : {}", address); log.info("实时数据 publicsecurity webService url : {}", address);
// //根据WebServices接口地址创建client //根据WebServices接口地址创建client
// Client client = clientFactory.createClient(address); Client client = clientFactory.createClient(address);
// HTTPConduit conduit = (HTTPConduit) client.getConduit(); HTTPConduit conduit = (HTTPConduit) client.getConduit();
// HTTPClientPolicy policy = new HTTPClientPolicy(); HTTPClientPolicy policy = new HTTPClientPolicy();
// policy.setAllowChunking(false); policy.setAllowChunking(false);
// // 连接服务器超时时间 60秒 // 连接服务器超时时间 60秒
// policy.setConnectionTimeout(connecttime); policy.setConnectionTimeout(connecttime);
// // 等待服务器响应超时时间 60秒 // 等待服务器响应超时时间 60秒
// policy.setReceiveTimeout(receivetime); policy.setReceiveTimeout(receivetime);
// conduit.setClient(policy); conduit.setClient(policy);
Client client = null;
log.info("开始执行定时任务-查询数据库"); log.info("开始执行定时任务-查询数据库");
HashMap<Integer, Niec_Sensors> equipMap = new HashMap(); HashMap<Integer, Niec_Sensors> equipMap = new HashMap();
List<Niec_Sensors> niec_sensors = niec_sensorsDao.selectAll(); List<Niec_Sensors> niec_sensors = niec_sensorsDao.selectAll();
@ -169,21 +168,20 @@ public class WebServiceImpl implements Webservcies {
@Override @Override
public void uploaddcywData() { public void uploaddcywData() {
// log.info("实时数据定时任务启动"); log.info("实时数据定时任务启动");
// // 动态客户端 // 动态客户端
// JaxWsDynamicClientFactory clientFactory = JaxWsDynamicClientFactory.newInstance(); JaxWsDynamicClientFactory clientFactory = JaxWsDynamicClientFactory.newInstance();
// log.info("实时数据 publicsecurity webService url : {}", address); log.info("实时数据 publicsecurity webService url : {}", address);
// //根据WebServices接口地址创建client //根据WebServices接口地址创建client
// Client client = clientFactory.createClient(address); Client client = clientFactory.createClient(address);
// HTTPConduit conduit = (HTTPConduit) client.getConduit(); HTTPConduit conduit = (HTTPConduit) client.getConduit();
// HTTPClientPolicy policy = new HTTPClientPolicy(); HTTPClientPolicy policy = new HTTPClientPolicy();
// policy.setAllowChunking(false); policy.setAllowChunking(false);
// // 连接服务器超时时间 60秒 // 连接服务器超时时间 60秒
// policy.setConnectionTimeout(connecttime); policy.setConnectionTimeout(connecttime);
// // 等待服务器响应超时时间 60秒 // 等待服务器响应超时时间 60秒
// policy.setReceiveTimeout(receivetime); policy.setReceiveTimeout(receivetime);
// conduit.setClient(policy); conduit.setClient(policy);
Client client = null;
log.info("开始执行定时任务-查询数据库"); log.info("开始执行定时任务-查询数据库");
HashMap<Integer, Niec_Sensors> equipMap = new HashMap(); HashMap<Integer, Niec_Sensors> equipMap = new HashMap();
List<Niec_Sensors> niec_sensors = niec_sensorsDao.selectAll(); List<Niec_Sensors> niec_sensors = niec_sensorsDao.selectAll();
@ -196,21 +194,20 @@ public class WebServiceImpl implements Webservcies {
@Override @Override
public void uploadjsyhwjyjcData() { public void uploadjsyhwjyjcData() {
// log.info("实时数据定时任务启动"); log.info("实时数据定时任务启动");
// // 动态客户端 // 动态客户端
// JaxWsDynamicClientFactory clientFactory = JaxWsDynamicClientFactory.newInstance(); JaxWsDynamicClientFactory clientFactory = JaxWsDynamicClientFactory.newInstance();
// log.info("实时数据 publicsecurity webService url : {}", address); log.info("实时数据 publicsecurity webService url : {}", address);
// //根据WebServices接口地址创建client //根据WebServices接口地址创建client
// Client client = clientFactory.createClient(address); Client client = clientFactory.createClient(address);
// HTTPConduit conduit = (HTTPConduit) client.getConduit(); HTTPConduit conduit = (HTTPConduit) client.getConduit();
// HTTPClientPolicy policy = new HTTPClientPolicy(); HTTPClientPolicy policy = new HTTPClientPolicy();
// policy.setAllowChunking(false); policy.setAllowChunking(false);
// // 连接服务器超时时间 60秒 // 连接服务器超时时间 60秒
// policy.setConnectionTimeout(connecttime); policy.setConnectionTimeout(connecttime);
// // 等待服务器响应超时时间 60秒 // 等待服务器响应超时时间 60秒
// policy.setReceiveTimeout(receivetime); policy.setReceiveTimeout(receivetime);
// conduit.setClient(policy); conduit.setClient(policy);
Client client = null;
log.info("开始执行定时任务-查询数据库"); log.info("开始执行定时任务-查询数据库");
HashMap<Integer, Niec_Sensors> equipMap = new HashMap(); HashMap<Integer, Niec_Sensors> equipMap = new HashMap();
List<Niec_Sensors> niec_sensors = niec_sensorsDao.selectAll(); 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 @Autowired
XydlI2Service xydlI2Service; 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) @Scheduled(fixedDelay = 60 * 60 * 1000)
public void cacyspupload() { public void cacyspupload() {
log.error("cacyspupload执行" + (i1++) ); log.info("cacyspupload执行" );
webservcies.uploadyspData(); webservcies.uploadyspData();
} }
@Scheduled(fixedDelay = 1 * 60 * 1000) @Scheduled(fixedDelay = 10 * 60 * 1000)
public void cacjfjcupload() { public void cacjfjcupload() {
log.error("cacjfjcupload执行" + (i2++) ); log.info("cacjfjcupload执行" );
webservcies.uploadjfjcData(); webservcies.uploadjfjcData();
} }
@Scheduled(fixedDelay = 1 * 30 * 1000) @Scheduled(fixedDelay = 1 * 30 * 1000)
public void cacupload() { public void cacupload() {
log.error("cacupload执行" + (i3++) ); log.info("cacupload执行" );
webservcies.uploadData(); webservcies.uploadData();
} }
@Scheduled(fixedDelay = 1 * 30 * 1000) @Scheduled(fixedDelay = 1 * 30 * 1000)
public void cacyxupload() { public void cacyxupload() {
log.error("cacyxupload执行" + (i4++) ); log.info("cacyxupload执行" );
webservcies.uploadyxData(); webservcies.uploadyxData();
} }
@Scheduled(fixedDelay = 1 * 30 * 1000) @Scheduled(fixedDelay = 1 * 30 * 1000)
public void cacdcywupload() { public void cacdcywupload() {
log.error("cacdcywupload执行" + (i5++) ); log.info("cacdcywupload执行" );
webservcies.uploaddcywData(); webservcies.uploaddcywData();
} }
@Scheduled(fixedDelay = 1 * 30 * 1000) @Scheduled(fixedDelay = 1 * 30 * 1000)
public void cacjsyhwjyjcupload() { public void cacjsyhwjyjcupload() {
log.error("cacjsyhwjyjcupload执行" + (i6++) ); log.info("cacjsyhwjyjcupload执行" );
webservcies.uploadjsyhwjyjcData(); webservcies.uploadjsyhwjyjcData();
} }
// @Scheduled(cron = "0 0 13 * * ?") @Scheduled(cron = "0 0 13 * * ?")
// public void clear() { public void clear() {
// xydlI2Service.clear_history(); log.info("clear" );
// } xydlI2Service.clear_history();
}
} }

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

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

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

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

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

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

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

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

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

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

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

@ -17,7 +17,7 @@
select select
<include refid="Base_Column_List"/> <include refid="Base_Column_List"/>
from data_ws from data_ws
where id <![CDATA[>]]> #{maxid} where id <![CDATA[>]]> #{maxid} limit 1000
</select> </select>
<select id="selectUpload" resultMap="BaseResultMap"> <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.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 t1.TotalHydrocarbon,t1.isupload, t1.create_time, t1.update_time
FROM FROM
data_ysp t1 where t1.id <![CDATA[>]]> #{maxid} data_ysp t1 where t1.id <![CDATA[>]]> #{maxid} limit 1000
</select> </select>

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

Loading…
Cancel
Save