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();

@ -4,13 +4,13 @@ import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.date.DatePattern;
import cn.hutool.core.date.DateTime;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.NumberUtil;
import cn.hutool.core.util.StrUtil;
import com.shxy.i2.Tool.AsyncMethod;
import com.shxy.i2.Tool.GenerateI2Xml;
import com.shxy.i2.bean.AttrBean;
import com.shxy.i2.bean.SendDataBean;
import com.shxy.i2.bean.YxAttrBean;
import com.shxy.i2.constant.CommonStatus;
import com.shxy.i2.constant.Constant;
import com.shxy.i2.dao.*;
import com.shxy.i2.dto.Data_YxlDto;
@ -22,6 +22,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.Date;
@ -84,11 +85,15 @@ public class XydlI2ServiceImpl implements XydlI2Service {
@Autowired
AsyncMethod asyncMethod;
@Value("${webservice.receivetime}")
public int sendlimit;
// @Value("${webservice.sendlimit}")
// public int sendlimit;
public static int sendlimit = 1000;
@Override
public void upload_byq_jbfd(Client client, HashMap<Integer, Niec_Sensors> equipMap) {
Boolean iscontiue = true;
while (iscontiue) {
//查询目前上传的变压器局部放电的id 记录变压器局部放电上传的id大小
Upload_check upload_check = upload_checkDao.selectByPrimaryKey(Constant.BYQJBFDID);
BigInteger value = null;
@ -103,6 +108,10 @@ public class XydlI2ServiceImpl implements XydlI2Service {
List<Data_Byq_Jbfd> data_byq_jbfdlist = data_byq_jbfdDao.selectUploadById(value);
if (CollectionUtil.isNotEmpty(data_byq_jbfdlist)) {
log.info("查询byq_jbfd的数据量" + data_byq_jbfdlist.size());
log.info("查询byq_jbfd的数据量 sendlimit " + sendlimit);
if (data_byq_jbfdlist.size() < 1000) {
iscontiue = false;
}
ArrayList<String> cacdatalist = new ArrayList<>();
BigInteger maxid = null;
for (int index = 0; index < data_byq_jbfdlist.size(); index++) {
@ -175,12 +184,16 @@ public class XydlI2ServiceImpl implements XydlI2Service {
}
asyncMethod.updateRecordId(maxid, Constant.BYQJBFDID);
} else {
iscontiue = false;
log.info("没有查询byq_jbfd的数据量");
}
}
}
@Override
public void upload_cnj(Client client, HashMap<Integer, Niec_Sensors> equipMap) {
Boolean iscontiue = true;
while (iscontiue) {
Upload_check upload_check = upload_checkDao.selectByPrimaryKey(Constant.CNJID);
BigInteger value = null;
if (upload_check == null) {
@ -194,6 +207,10 @@ public class XydlI2ServiceImpl implements XydlI2Service {
List<Data_Cnj> list = data_cnjDao.selectUploadById(value);
if (CollectionUtil.isNotEmpty(list)) {
log.info("查询cnj的数据量" + list.size());
log.info("查询cnj的数据量 sendlimit " + sendlimit);
if (list.size() < 1000) {
iscontiue = false;
}
ArrayList<String> cacdatalist = new ArrayList<>();
BigInteger maxid = null;
for (int index = 0; index < list.size(); index++) {
@ -241,12 +258,16 @@ public class XydlI2ServiceImpl implements XydlI2Service {
}
asyncMethod.updateRecordId(maxid, Constant.CNJID);
} else {
iscontiue = false;
log.info("没有查询cnj的数据量");
}
}
}
@Override
public void upload_dcyw(Client client, HashMap<Integer, Niec_Sensors> equipMap) {
Boolean iscontiue = true;
while (iscontiue) {
Upload_check upload_check = upload_checkDao.selectByPrimaryKey(Constant.DCYWID);
BigInteger value = null;
if (upload_check == null) {
@ -260,6 +281,9 @@ public class XydlI2ServiceImpl implements XydlI2Service {
List<Data_Dcyw> list = data_dcywDao.selectUploadById(value);
if (CollectionUtil.isNotEmpty(list)) {
log.info("查询dcyw的数据量" + list.size());
if (list.size() < 1000) {
iscontiue = false;
}
ArrayList<String> cacdatalist = new ArrayList<>();
BigInteger maxid = null;
for (int index = 0; index < list.size(); index++) {
@ -307,12 +331,16 @@ public class XydlI2ServiceImpl implements XydlI2Service {
}
asyncMethod.updateRecordId(maxid, Constant.DCYWID);
} else {
iscontiue = false;
log.info("没有查询dcyw的数据量");
}
}
}
@Override
public void upload_dlq_jbfd(Client client, HashMap<Integer, Niec_Sensors> equipMap) {
Boolean iscontiue = true;
while (iscontiue) {
Upload_check upload_check = upload_checkDao.selectByPrimaryKey(Constant.DLQJBFDID);
BigInteger value = null;
if (upload_check == null) {
@ -326,6 +354,10 @@ public class XydlI2ServiceImpl implements XydlI2Service {
List<Data_Dlq_Jbfd> list = data_dlq_jbfdDao.selectUploadById(value);
if (CollectionUtil.isNotEmpty(list)) {
log.info("查询dlq_jbfd的数据量" + list.size());
log.info("查询dlq_jbfd的数据量 sendlimit " + sendlimit);
if (list.size() < 1000) {
iscontiue = false;
}
ArrayList<String> cacdatalist = new ArrayList<>();
BigInteger maxid = null;
for (int index = 0; index < list.size(); index++) {
@ -382,11 +414,9 @@ public class XydlI2ServiceImpl implements XydlI2Service {
}
String cacdata = GenerateI2Xml.generateCacXml(Constant.DLQJBFD, sensorid, equipmentid, timestamp, attrlist);
cacdatalist.add(cacdata);
BigInteger id = item.getId();
if ((index != 0 && index % sendlimit == 0) || index == (list.size() - 1)) {
String xml = GenerateI2Xml.generateEndCacXml(cacdatalist);
asyncMethod.sendData2(client, xml);
maxid = BigInteger.valueOf(0);
cacdatalist = new ArrayList<>();
}
} catch (Exception e) {
@ -396,12 +426,16 @@ public class XydlI2ServiceImpl implements XydlI2Service {
}
asyncMethod.updateRecordId(maxid, Constant.DLQJBFDID);
} else {
iscontiue = false;
log.info("没有查询到dlq的数据");
}
}
}
@Override
public void upload_dr_jyjc(Client client, HashMap<Integer, Niec_Sensors> equipMap) {
Boolean iscontiue = true;
while (iscontiue) {
Upload_check upload_check = upload_checkDao.selectByPrimaryKey(Constant.DRJYJCID);
BigInteger value = null;
if (upload_check == null) {
@ -415,6 +449,9 @@ public class XydlI2ServiceImpl implements XydlI2Service {
List<Data_Dr_Jyjc> list = data_dr_jyjcDao.selectUploadById(value);
if (CollectionUtil.isNotEmpty(list)) {
log.info("查询dr_jyjc的数据量" + list.size());
if (list.size() < 1000) {
iscontiue = false;
}
ArrayList<String> cacdatalist = new ArrayList<>();
BigInteger maxid = null;
for (int index = 0; index < list.size(); index++) {
@ -498,12 +535,16 @@ public class XydlI2ServiceImpl implements XydlI2Service {
}
asyncMethod.updateRecordId(maxid, Constant.DRJYJCID);
} else {
iscontiue = false;
log.info("没有查询dr_jyjc的数据量");
}
}
}
@Override
public void upload_fhdlbx(Client client, HashMap<Integer, Niec_Sensors> equipMap) {
Boolean iscontiue = true;
while (iscontiue) {
Upload_check upload_check = upload_checkDao.selectByPrimaryKey(Constant.FHDLBXID);
BigInteger value = null;
if (upload_check == null) {
@ -517,6 +558,9 @@ public class XydlI2ServiceImpl implements XydlI2Service {
List<Data_Fhdlbx> list = data_fhdlbxDao.selectUploadById(value);
if (CollectionUtil.isNotEmpty(list)) {
log.info("查询fhdlbx的数据量" + list.size());
if (list.size()<1000) {
iscontiue = false;
}
ArrayList<String> cacdatalist = new ArrayList<>();
BigInteger maxid = null;
for (int index = 0; index < list.size(); index++) {
@ -571,12 +615,16 @@ public class XydlI2ServiceImpl implements XydlI2Service {
}
asyncMethod.updateRecordId(maxid, Constant.FHDLBXID);
} else {
iscontiue = false;
log.info("没有查询fhdlbx的数据量");
}
}
}
@Override
public void upload_fhzxq(Client client, HashMap<Integer, Niec_Sensors> equipMap) {
Boolean iscontiue = true;
while (iscontiue) {
Upload_check upload_check = upload_checkDao.selectByPrimaryKey(Constant.FHZXQID);
BigInteger value = null;
if (upload_check == null) {
@ -587,9 +635,12 @@ public class XydlI2ServiceImpl implements XydlI2Service {
value = BigInteger.valueOf(0);
}
}
List<Data_Fhzxq> list = data_fhzxqDao.selectUpload(CommonStatus.UNUPLOAD.value());
List<Data_Fhzxq> list = data_fhzxqDao.selectUploadById(value);
if (CollectionUtil.isNotEmpty(list)) {
log.info("查询fhzxq的数据量" + list.size());
if (list.size()<1000) {
iscontiue = false;
}
ArrayList<String> cacdatalist = new ArrayList<>();
BigInteger maxid = null;
for (int index = 0; index < list.size(); index++) {
@ -644,12 +695,16 @@ public class XydlI2ServiceImpl implements XydlI2Service {
}
asyncMethod.updateRecordId(maxid, Constant.FHZXQID);
} else {
iscontiue = false;
log.info("没有查询fhzxq的数据量");
}
}
}
@Override
public void upload_jsyhw_jyjc(Client client, HashMap<Integer, Niec_Sensors> equipMap) {
Boolean iscontiue = true;
while (iscontiue) {
Upload_check upload_check = upload_checkDao.selectByPrimaryKey(Constant.JSYHWJYJCID);
BigInteger value = null;
if (upload_check == null) {
@ -663,6 +718,10 @@ public class XydlI2ServiceImpl implements XydlI2Service {
List<Data_Jsyhw_Jyjc> list = data_jsyhw_jyjcDao.selectUploadById(value);
if (CollectionUtil.isNotEmpty(list)) {
log.info("查询jsyhw_jyjc的数据量" + list.size());
log.info("查询jsyhw_jyjc的数据量 sendlimit " + sendlimit);
if (list.size()<1000) {
iscontiue = false;
}
ArrayList<String> cacdatalist = new ArrayList<>();
BigInteger maxid = null;
for (int index = 0; index < list.size(); index++) {
@ -738,12 +797,16 @@ public class XydlI2ServiceImpl implements XydlI2Service {
}
asyncMethod.updateRecordId(maxid, Constant.JSYHWJYJCID);
} else {
iscontiue = false;
log.info("没有查询jsyhw_jyjc的数据量");
}
}
}
@Override
public void upload_sf6_qtsf(Client client, HashMap<Integer, Niec_Sensors> equipMap) {
Boolean iscontiue = true;
while (iscontiue) {
Upload_check upload_check = upload_checkDao.selectByPrimaryKey(Constant.SF6QTSFID);
BigInteger value = null;
if (upload_check == null) {
@ -757,6 +820,9 @@ public class XydlI2ServiceImpl implements XydlI2Service {
List<Data_SF6_Qtsf> list = data_sf6_qtsfDao.selectUploadById(value);
if (CollectionUtil.isNotEmpty(list)) {
log.info("查询sf6_qtsf的数据量" + list.size());
if (list.size()<1000) {
iscontiue = false;
}
ArrayList<String> cacdatalist = new ArrayList<>();
BigInteger maxid = null;
for (int index = 0; index < list.size(); index++) {
@ -811,15 +877,14 @@ public class XydlI2ServiceImpl implements XydlI2Service {
}
asyncMethod.updateRecordId(maxid, Constant.SF6QTSFID);
} else {
iscontiue = false;
log.info("没有查询sf6_qtsf的数据量");
}
}
}
@Override
public void upload_sf6_qtyl(Client client, HashMap<Integer, Niec_Sensors> equipMap) {
Boolean iscontiue = true;
while (iscontiue) {
Upload_check upload_check = upload_checkDao.selectByPrimaryKey(Constant.SF6QTYLID);
BigInteger value = null;
if (upload_check == null) {
@ -830,14 +895,18 @@ public class XydlI2ServiceImpl implements XydlI2Service {
value = BigInteger.valueOf(0);
}
}
Boolean iscontiue = true;
while (iscontiue) {
List<Data_SF6_Qtyl> list = data_sf6_qtylDao.selectUploadById(value);
if (CollectionUtil.isNotEmpty(list)) {
log.info("查询sf6_qtyl的数据量" + list.size());
if (list.size()<1000) {
iscontiue = false;
}
if (CollectionUtil.isNotEmpty(list)) {
log.info("查询sf6_qtyl的数据量" + list.size());
ArrayList<String> cacdatalist = new ArrayList<>();
BigInteger maxid = null;
BigDecimal add = NumberUtil.add(value, list.size());
value = add.toBigInteger();
for (int index = 0; index < list.size(); index++) {
Data_SF6_Qtyl item = list.get(index);
maxid = item.getId();
@ -905,6 +974,7 @@ public class XydlI2ServiceImpl implements XydlI2Service {
}
asyncMethod.updateRecordId(maxid, Constant.SF6QTYLID);
} else {
iscontiue = false;
log.info("没有查询到sf6_qtyl的数据");
}
}
@ -912,6 +982,8 @@ public class XydlI2ServiceImpl implements XydlI2Service {
@Override
public void upload_tx(Client client, HashMap<Integer, Niec_Sensors> equipMap) {
Boolean iscontiue = true;
while (iscontiue) {
Upload_check upload_check = upload_checkDao.selectByPrimaryKey(Constant.TXID);
BigInteger value = null;
if (upload_check == null) {
@ -925,6 +997,9 @@ public class XydlI2ServiceImpl implements XydlI2Service {
List<Data_Tx> list = data_txDao.selectUploadById(value);
if (CollectionUtil.isNotEmpty(list)) {
log.info("查询tx的数据量" + list.size());
if (list.size()<1000) {
iscontiue = false;
}
ArrayList<String> cacdatalist = new ArrayList<>();
BigInteger maxid = null;
for (int index = 0; index < list.size(); index++) {
@ -972,12 +1047,16 @@ public class XydlI2ServiceImpl implements XydlI2Service {
}
asyncMethod.updateRecordId(maxid, Constant.TXID);
} else {
iscontiue = false;
log.info("没有查询到tx的数据");
}
}
}
@Override
public void upload_ws(Client client, HashMap<Integer, Niec_Sensors> equipMap) {
Boolean iscontiue = true;
while (iscontiue) {
Upload_check upload_check = upload_checkDao.selectByPrimaryKey(Constant.WSID);
BigInteger value = null;
if (upload_check == null) {
@ -991,6 +1070,9 @@ public class XydlI2ServiceImpl implements XydlI2Service {
List<Data_Ws> list = data_wsDao.selectUploadById(value);
if (CollectionUtil.isNotEmpty(list)) {
log.info("查询ws的数据量" + list.size());
if (list.size()<1000) {
iscontiue = false;
}
ArrayList<String> cacdatalist = new ArrayList<>();
BigInteger maxid = null;
for (int index = 0; index < list.size(); index++) {
@ -1038,12 +1120,16 @@ public class XydlI2ServiceImpl implements XydlI2Service {
}
asyncMethod.updateRecordId(maxid, Constant.WSID);
} else {
iscontiue = false;
log.info("没有查询到ws的数据");
}
}
}
@Override
public void upload_ysp(Client client, HashMap<Integer, Niec_Sensors> equipMap) {
Boolean iscontiue = true;
while (iscontiue) {
//查询目前上传的油色谱的id 记录油色谱上传的id大小
Upload_check upload_check = upload_checkDao.selectByPrimaryKey(Constant.YSPID);
BigInteger value = null;
@ -1055,13 +1141,16 @@ public class XydlI2ServiceImpl implements XydlI2Service {
value = BigInteger.valueOf(0);
}
}
List<Data_Ysp> dataYspList = data_yspDao.selectUploadById(value);
if (CollectionUtil.isNotEmpty(dataYspList)) {
log.info("查询ysp的数据量" + dataYspList.size());
List<Data_Ysp> list = data_yspDao.selectUploadById(value);
if (CollectionUtil.isNotEmpty(list)) {
log.info("查询ysp的数据量" + list.size());
if (list.size()<1000) {
iscontiue = false;
}
ArrayList<String> cacdatalist = new ArrayList<>();
BigInteger maxid = null;
for (int index = 0; index < dataYspList.size(); index++) {
Data_Ysp item = dataYspList.get(index);
for (int index = 0; index < list.size(); index++) {
Data_Ysp item = list.get(index);
maxid = item.getId();
Niec_Sensors sensors = equipMap.get(item.getEqmid());
if (sensors == null) {
@ -1157,7 +1246,7 @@ public class XydlI2ServiceImpl implements XydlI2Service {
String cacdata = GenerateI2Xml.generateCacXml(Constant.YSP, sensorid, equipmentid, timestamp, attrlist);
cacdatalist.add(cacdata);
log.info("测试断点3");
if ((index != 0 && index % sendlimit == 0) || index == (dataYspList.size() - 1)) {
if ((index != 0 && index % sendlimit == 0) || index == (list.size() - 1)) {
log.info("测试断点4");
ArrayList<BigInteger> list1 = new ArrayList<>();
String xml = GenerateI2Xml.generateEndCacXml(cacdatalist);
@ -1172,13 +1261,16 @@ public class XydlI2ServiceImpl implements XydlI2Service {
}
asyncMethod.updateRecordId(maxid, Constant.YSPID);
} else {
iscontiue = false;
log.info("没有查询到ysp的数据");
}
}
}
@Override
public void upload_microclimate(Client client, HashMap<Integer, Niec_Sensors> equipMap) {
Boolean iscontiue = true;
while (iscontiue) {
Upload_check upload_check = upload_checkDao.selectByPrimaryKey(Constant.MICROCLIMATEID);
BigInteger value = null;
if (upload_check == null) {
@ -1192,6 +1284,9 @@ public class XydlI2ServiceImpl implements XydlI2Service {
List<Data_Microclimate> list = data_microclimateDao.selectUploadById(value);
if (CollectionUtil.isNotEmpty(list)) {
log.info("查询microclimate的数据量" + list.size());
if (list.size()<1000) {
iscontiue = false;
}
ArrayList<String> cacdatalist = new ArrayList<>();
BigInteger maxid = null;
for (int index = 0; index < list.size(); index++) {
@ -1274,15 +1369,14 @@ public class XydlI2ServiceImpl implements XydlI2Service {
}
asyncMethod.updateRecordId(maxid, Constant.MICROCLIMATEID);
} else {
iscontiue = false;
log.info("没有查询到microcimate的数据");
}
}
}
@Override
public void upload_yx(Client client) {
Boolean iscontiue = true;
while (iscontiue) {
Upload_check upload_check = upload_checkDao.selectByPrimaryKey(Constant.YXID);
@ -1296,11 +1390,11 @@ public class XydlI2ServiceImpl implements XydlI2Service {
}
}
List<Data_YxlDto> list = data_yxDao.selectByPrimaryKey(value);
if (CollectionUtil.isNotEmpty(list)) {
log.info("查询yx的数据量" + list.size());
if (list.size() < 1000) {
iscontiue = false;
}
if (CollectionUtil.isNotEmpty(list)) {
log.info("查询yx的数据量" + list.size());
BigInteger maxid = null;
for (int index = 0; index < list.size(); index++) {
Data_YxlDto data_yxlDto = list.get(index);
@ -1366,6 +1460,9 @@ public class XydlI2ServiceImpl implements XydlI2Service {
}
asyncMethod.updateRecordId(maxid, Constant.YXID);
} else {
iscontiue = false;
log.info("没有查询到yx的数据");
}
}
}
@ -1373,7 +1470,7 @@ public class XydlI2ServiceImpl implements XydlI2Service {
@Override
public void clear_history() {
log.info("开启定时删除");
DateTime dateTime = DateUtil.offsetDay(new Date(), -7);
DateTime dateTime = DateUtil.offsetDay(new Date(), -3);
data_byq_jbfdDao.deleteData(dateTime);
data_cnjDao.deleteData(dateTime);
data_dcywDao.deleteData(dateTime);

@ -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