From 4a2096b570587387d51cad6df967d9ed2922e6ab Mon Sep 17 00:00:00 2001 From: liuguijing <123456> Date: Wed, 17 Jan 2024 14:29:17 +0800 Subject: [PATCH] =?UTF-8?q?I2=E4=BB=A3=E7=A0=81=E4=BC=98=E5=8C=96ceshi?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/shxy/i2/Tool/AsyncMethod.java | 2 +- .../i2/serviceimpl/XydlI2ServiceImpl.java | 406 +++++++++++------- src/main/resources/application-test.yml | 79 +++- .../resources/mappers/Data_Byq_JbfdDao.xml | 2 +- src/main/resources/mappers/Data_CnjDao.xml | 2 +- src/main/resources/mappers/Data_DcywDao.xml | 2 +- .../resources/mappers/Data_Dlq_JbfdDao.xml | 2 +- .../resources/mappers/Data_Dr_JyjcDao.xml | 2 +- src/main/resources/mappers/Data_FhdlbxDao.xml | 2 +- .../resources/mappers/Data_Jsyhw_JyjcDao.xml | 2 +- .../mappers/Data_MicroclimateDao.xml | 2 +- .../resources/mappers/Data_SF6_QtsfDao.xml | 2 +- .../resources/mappers/Data_SF6_QtylDao.xml | 2 +- src/main/resources/mappers/Data_TxDao.xml | 2 +- src/main/resources/mappers/Data_WsDao.xml | 2 +- src/main/resources/mappers/Data_YspDao.xml | 2 +- src/main/resources/mappers/Data_YxDao.xml | 2 +- src/main/resources/mappers/data_FhzxqDao.xml | 2 +- 18 files changed, 337 insertions(+), 180 deletions(-) diff --git a/src/main/java/com/shxy/i2/Tool/AsyncMethod.java b/src/main/java/com/shxy/i2/Tool/AsyncMethod.java index 19a9845..1a1e071 100644 --- a/src/main/java/com/shxy/i2/Tool/AsyncMethod.java +++ b/src/main/java/com/shxy/i2/Tool/AsyncMethod.java @@ -164,7 +164,7 @@ public class AsyncMethod { } } - @Async(value = "asyncServiceExecutor") +// @Async(value = "asyncServiceExecutor") public void sendData2(Client client, String xml) throws Exception { Object[] objects = client.invoke("uploadCACData", xml); String threadId = Thread.currentThread().getName(); diff --git a/src/main/java/com/shxy/i2/serviceimpl/XydlI2ServiceImpl.java b/src/main/java/com/shxy/i2/serviceimpl/XydlI2ServiceImpl.java index fe75a3e..24f1572 100644 --- a/src/main/java/com/shxy/i2/serviceimpl/XydlI2ServiceImpl.java +++ b/src/main/java/com/shxy/i2/serviceimpl/XydlI2ServiceImpl.java @@ -88,35 +88,44 @@ public class XydlI2ServiceImpl implements XydlI2Service { // @Value("${webservice.sendlimit}") // public int sendlimit; - public static int sendlimit = 1000; + public static int sendlimit = 500; @Override public void upload_byq_jbfd(Client client, HashMap equipMap) { - Boolean iscontiue = true; - while (iscontiue) { - //查询目前上传的变压器局部放电的id 记录变压器局部放电上传的id大小 - Upload_check upload_check = upload_checkDao.selectByPrimaryKey(Constant.BYQJBFDID); - BigInteger value = null; - if (upload_check == null) { + //查询目前上传的变压器局部放电的id 记录变压器局部放电上传的id大小 + Upload_check upload_check = upload_checkDao.selectByPrimaryKey(Constant.BYQJBFDID); + BigInteger value = null; + if (upload_check == null) { + value = BigInteger.valueOf(0); + } else { + value = upload_check.getValue(); + if (value == null) { value = BigInteger.valueOf(0); - } else { - value = upload_check.getValue(); - if (value == null) { - value = BigInteger.valueOf(0); - } } + } +// Boolean iscontiue = true; +// while (iscontiue) { List 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; - } +// if (data_byq_jbfdlist.size() < 1000) { +// iscontiue = false; +// } +// BigDecimal add = NumberUtil.add(value, data_byq_jbfdlist.size()); +// value = add.toBigInteger(); ArrayList cacdatalist = new ArrayList<>(); - BigInteger maxid = null; + BigInteger maxid = value; + for (int index = 0; index < data_byq_jbfdlist.size(); index++) { Data_Byq_Jbfd item = data_byq_jbfdlist.get(index); - maxid = item.getId(); + BigInteger ids = item.getId(); + if (ids != null) { + int i = ids.compareTo(maxid); + if (i == 1) { + maxid = ids; + } + } Niec_Sensors sensors = equipMap.get(item.getEqmid()); if (sensors == null) { continue; @@ -182,18 +191,18 @@ public class XydlI2ServiceImpl implements XydlI2Service { } } } - asyncMethod.updateRecordId(maxid, Constant.BYQJBFDID); + asyncMethod.updateRecordId(maxid, Constant.BYQJBFDID); } else { - iscontiue = false; +// iscontiue = false; log.info("没有查询byq_jbfd的数据量"); } - } +// } } @Override public void upload_cnj(Client client, HashMap equipMap) { - Boolean iscontiue = true; - while (iscontiue) { +// Boolean iscontiue = true; +// while (iscontiue) { Upload_check upload_check = upload_checkDao.selectByPrimaryKey(Constant.CNJID); BigInteger value = null; if (upload_check == null) { @@ -208,14 +217,20 @@ public class XydlI2ServiceImpl implements XydlI2Service { if (CollectionUtil.isNotEmpty(list)) { log.info("查询cnj的数据量:" + list.size()); log.info("查询cnj的数据量 sendlimit :" + sendlimit); - if (list.size() < 1000) { - iscontiue = false; - } +// if (list.size() < 1000) { +// iscontiue = false; +// } ArrayList cacdatalist = new ArrayList<>(); - BigInteger maxid = null; + BigInteger maxid = value; for (int index = 0; index < list.size(); index++) { Data_Cnj item = list.get(index); - maxid = item.getId(); + BigInteger ids = item.getId(); + if (ids != null) { + int i = ids.compareTo(maxid); + if (i == 1) { + maxid = ids; + } + } Niec_Sensors sensors = equipMap.get(item.getEqmid()); if (sensors == null) { continue; @@ -258,16 +273,16 @@ public class XydlI2ServiceImpl implements XydlI2Service { } asyncMethod.updateRecordId(maxid, Constant.CNJID); } else { - iscontiue = false; +// iscontiue = false; log.info("没有查询cnj的数据量"); } - } +// } } @Override public void upload_dcyw(Client client, HashMap equipMap) { - Boolean iscontiue = true; - while (iscontiue) { +// Boolean iscontiue = true; +// while (iscontiue) { Upload_check upload_check = upload_checkDao.selectByPrimaryKey(Constant.DCYWID); BigInteger value = null; if (upload_check == null) { @@ -281,14 +296,20 @@ public class XydlI2ServiceImpl implements XydlI2Service { List list = data_dcywDao.selectUploadById(value); if (CollectionUtil.isNotEmpty(list)) { log.info("查询dcyw的数据量:" + list.size()); - if (list.size() < 1000) { - iscontiue = false; - } +// if (list.size() < 1000) { +// iscontiue = false; +// } ArrayList cacdatalist = new ArrayList<>(); - BigInteger maxid = null; + BigInteger maxid = value; for (int index = 0; index < list.size(); index++) { Data_Dcyw item = list.get(index); - maxid = item.getId(); + BigInteger ids = item.getId(); + if (ids != null) { + int i = ids.compareTo(maxid); + if (i == 1) { + maxid = ids; + } + } Niec_Sensors sensors = equipMap.get(item.getEqmid()); if (sensors == null) { continue; @@ -331,16 +352,16 @@ public class XydlI2ServiceImpl implements XydlI2Service { } asyncMethod.updateRecordId(maxid, Constant.DCYWID); } else { - iscontiue = false; +// iscontiue = false; log.info("没有查询dcyw的数据量"); } - } +// } } @Override public void upload_dlq_jbfd(Client client, HashMap equipMap) { - Boolean iscontiue = true; - while (iscontiue) { +// Boolean iscontiue = true; +// while (iscontiue) { Upload_check upload_check = upload_checkDao.selectByPrimaryKey(Constant.DLQJBFDID); BigInteger value = null; if (upload_check == null) { @@ -355,14 +376,20 @@ public class XydlI2ServiceImpl implements XydlI2Service { if (CollectionUtil.isNotEmpty(list)) { log.info("查询dlq_jbfd的数据量:" + list.size()); log.info("查询dlq_jbfd的数据量 sendlimit :" + sendlimit); - if (list.size() < 1000) { - iscontiue = false; - } +// if (list.size() < 1000) { +// iscontiue = false; +// } ArrayList cacdatalist = new ArrayList<>(); - BigInteger maxid = null; + BigInteger maxid = value; for (int index = 0; index < list.size(); index++) { Data_Dlq_Jbfd item = list.get(index); - maxid = item.getId(); + BigInteger ids = item.getId(); + if (ids != null) { + int i = ids.compareTo(maxid); + if (i == 1) { + maxid = ids; + } + } Niec_Sensors sensors = equipMap.get(item.getEqmid()); if (sensors == null) { continue; @@ -426,16 +453,16 @@ public class XydlI2ServiceImpl implements XydlI2Service { } asyncMethod.updateRecordId(maxid, Constant.DLQJBFDID); } else { - iscontiue = false; +// iscontiue = false; log.info("没有查询到dlq的数据"); } - } +// } } @Override public void upload_dr_jyjc(Client client, HashMap equipMap) { - Boolean iscontiue = true; - while (iscontiue) { +// Boolean iscontiue = true; +// while (iscontiue) { Upload_check upload_check = upload_checkDao.selectByPrimaryKey(Constant.DRJYJCID); BigInteger value = null; if (upload_check == null) { @@ -449,14 +476,22 @@ public class XydlI2ServiceImpl implements XydlI2Service { List list = data_dr_jyjcDao.selectUploadById(value); if (CollectionUtil.isNotEmpty(list)) { log.info("查询dr_jyjc的数据量:" + list.size()); - if (list.size() < 1000) { - iscontiue = false; - } +// if (list.size() < 1000) { +// iscontiue = false; +// } ArrayList cacdatalist = new ArrayList<>(); - BigInteger maxid = null; + BigInteger maxid = value; + + for (int index = 0; index < list.size(); index++) { Data_Dr_Jyjc item = list.get(index); - maxid = item.getId(); + BigInteger ids = item.getId(); + if (ids != null) { + int i = ids.compareTo(maxid); + if (i == 1) { + maxid = ids; + } + } Niec_Sensors sensors = equipMap.get(item.getEqmid()); if (sensors == null) { continue; @@ -535,16 +570,16 @@ public class XydlI2ServiceImpl implements XydlI2Service { } asyncMethod.updateRecordId(maxid, Constant.DRJYJCID); } else { - iscontiue = false; +// iscontiue = false; log.info("没有查询dr_jyjc的数据量"); } - } +// } } @Override public void upload_fhdlbx(Client client, HashMap equipMap) { - Boolean iscontiue = true; - while (iscontiue) { +// Boolean iscontiue = true; +// while (iscontiue) { Upload_check upload_check = upload_checkDao.selectByPrimaryKey(Constant.FHDLBXID); BigInteger value = null; if (upload_check == null) { @@ -558,14 +593,20 @@ public class XydlI2ServiceImpl implements XydlI2Service { List list = data_fhdlbxDao.selectUploadById(value); if (CollectionUtil.isNotEmpty(list)) { log.info("查询fhdlbx的数据量:" + list.size()); - if (list.size()<1000) { - iscontiue = false; - } +// if (list.size()<1000) { +// iscontiue = false; +// } ArrayList cacdatalist = new ArrayList<>(); - BigInteger maxid = null; + BigInteger maxid = value; for (int index = 0; index < list.size(); index++) { Data_Fhdlbx item = list.get(index); - maxid = item.getId(); + BigInteger ids = item.getId(); + if (ids != null) { + int i = ids.compareTo(maxid); + if (i == 1) { + maxid = ids; + } + } Niec_Sensors sensors = equipMap.get(item.getEqmid()); if (sensors == null) { continue; @@ -615,16 +656,16 @@ public class XydlI2ServiceImpl implements XydlI2Service { } asyncMethod.updateRecordId(maxid, Constant.FHDLBXID); } else { - iscontiue = false; +// iscontiue = false; log.info("没有查询fhdlbx的数据量"); } - } +// } } @Override public void upload_fhzxq(Client client, HashMap equipMap) { - Boolean iscontiue = true; - while (iscontiue) { +// Boolean iscontiue = true; +// while (iscontiue) { Upload_check upload_check = upload_checkDao.selectByPrimaryKey(Constant.FHZXQID); BigInteger value = null; if (upload_check == null) { @@ -638,14 +679,20 @@ public class XydlI2ServiceImpl implements XydlI2Service { List list = data_fhzxqDao.selectUploadById(value); if (CollectionUtil.isNotEmpty(list)) { log.info("查询fhzxq的数据量:" + list.size()); - if (list.size()<1000) { - iscontiue = false; - } +// if (list.size()<1000) { +// iscontiue = false; +// } ArrayList cacdatalist = new ArrayList<>(); - BigInteger maxid = null; + BigInteger maxid = value; for (int index = 0; index < list.size(); index++) { Data_Fhzxq item = list.get(index); - maxid = item.getId(); + BigInteger ids = item.getId(); + if (ids != null) { + int i = ids.compareTo(maxid); + if (i == 1) { + maxid = ids; + } + } Niec_Sensors sensors = equipMap.get(item.getEqmid()); if (sensors == null) { continue; @@ -695,16 +742,16 @@ public class XydlI2ServiceImpl implements XydlI2Service { } asyncMethod.updateRecordId(maxid, Constant.FHZXQID); } else { - iscontiue = false; +// iscontiue = false; log.info("没有查询fhzxq的数据量"); } - } +// } } @Override public void upload_jsyhw_jyjc(Client client, HashMap equipMap) { - Boolean iscontiue = true; - while (iscontiue) { +// Boolean iscontiue = true; +// while (iscontiue) { Upload_check upload_check = upload_checkDao.selectByPrimaryKey(Constant.JSYHWJYJCID); BigInteger value = null; if (upload_check == null) { @@ -719,14 +766,20 @@ public class XydlI2ServiceImpl implements XydlI2Service { if (CollectionUtil.isNotEmpty(list)) { log.info("查询jsyhw_jyjc的数据量:" + list.size()); log.info("查询jsyhw_jyjc的数据量 sendlimit :" + sendlimit); - if (list.size()<1000) { - iscontiue = false; - } +// if (list.size()<1000) { +// iscontiue = false; +// } ArrayList cacdatalist = new ArrayList<>(); - BigInteger maxid = null; + BigInteger maxid = value; for (int index = 0; index < list.size(); index++) { Data_Jsyhw_Jyjc item = list.get(index); - maxid = item.getId(); + BigInteger ids = item.getId(); + if (ids != null) { + int i = ids.compareTo(maxid); + if (i == 1) { + maxid = ids; + } + } Niec_Sensors sensors = equipMap.get(item.getEqmid()); if (sensors == null) { continue; @@ -797,16 +850,16 @@ public class XydlI2ServiceImpl implements XydlI2Service { } asyncMethod.updateRecordId(maxid, Constant.JSYHWJYJCID); } else { - iscontiue = false; +// iscontiue = false; log.info("没有查询jsyhw_jyjc的数据量"); } - } +// } } @Override public void upload_sf6_qtsf(Client client, HashMap equipMap) { - Boolean iscontiue = true; - while (iscontiue) { +// Boolean iscontiue = true; +// while (iscontiue) { Upload_check upload_check = upload_checkDao.selectByPrimaryKey(Constant.SF6QTSFID); BigInteger value = null; if (upload_check == null) { @@ -820,14 +873,20 @@ public class XydlI2ServiceImpl implements XydlI2Service { List list = data_sf6_qtsfDao.selectUploadById(value); if (CollectionUtil.isNotEmpty(list)) { log.info("查询sf6_qtsf的数据量:" + list.size()); - if (list.size()<1000) { - iscontiue = false; - } +// if (list.size()<1000) { +// iscontiue = false; +// } ArrayList cacdatalist = new ArrayList<>(); - BigInteger maxid = null; + BigInteger maxid = value; for (int index = 0; index < list.size(); index++) { Data_SF6_Qtsf item = list.get(index); - maxid = item.getId(); + BigInteger ids = item.getId(); + if (ids != null) { + int i = ids.compareTo(maxid); + if (i == 1) { + maxid = ids; + } + } Niec_Sensors sensors = equipMap.get(item.getEqmid()); if (sensors == null) { continue; @@ -877,39 +936,43 @@ public class XydlI2ServiceImpl implements XydlI2Service { } asyncMethod.updateRecordId(maxid, Constant.SF6QTSFID); } else { - iscontiue = false; +// iscontiue = false; log.info("没有查询sf6_qtsf的数据量"); } - } +// } } @Override public void upload_sf6_qtyl(Client client, HashMap equipMap) { - Upload_check upload_check = upload_checkDao.selectByPrimaryKey(Constant.SF6QTYLID); - BigInteger value = null; - if (upload_check == null) { - value = BigInteger.valueOf(0); - }else { - value = upload_check.getValue(); - if (value == null) { +// Boolean iscontiue = true; +// while (iscontiue) { + Upload_check upload_check = upload_checkDao.selectByPrimaryKey(Constant.SF6QTYLID); + BigInteger value = null; + if (upload_check == null) { value = BigInteger.valueOf(0); + }else { + value = upload_check.getValue(); + if (value == null) { + value = BigInteger.valueOf(0); + } } - } - Boolean iscontiue = true; - while (iscontiue) { List list = data_sf6_qtylDao.selectUploadById(value); if (CollectionUtil.isNotEmpty(list)) { log.info("查询sf6_qtyl的数据量:" + list.size()); - if (list.size()<1000) { - iscontiue = false; - } +// if (list.size()<1000) { +// iscontiue = false; +// } ArrayList cacdatalist = new ArrayList<>(); - BigInteger maxid = null; - BigDecimal add = NumberUtil.add(value, list.size()); - value = add.toBigInteger(); + BigInteger maxid = value; for (int index = 0; index < list.size(); index++) { Data_SF6_Qtyl item = list.get(index); - maxid = item.getId(); + BigInteger ids = item.getId(); + if (ids != null) { + int i = ids.compareTo(maxid); + if (i == 1) { + maxid = ids; + } + } Niec_Sensors sensors = equipMap.get(item.getEqmid()); if (sensors == null) { continue; @@ -974,16 +1037,16 @@ public class XydlI2ServiceImpl implements XydlI2Service { } asyncMethod.updateRecordId(maxid, Constant.SF6QTYLID); } else { - iscontiue = false; +// iscontiue = false; log.info("没有查询到sf6_qtyl的数据"); } - } +// } } @Override public void upload_tx(Client client, HashMap equipMap) { - Boolean iscontiue = true; - while (iscontiue) { +// Boolean iscontiue = true; +// while (iscontiue) { Upload_check upload_check = upload_checkDao.selectByPrimaryKey(Constant.TXID); BigInteger value = null; if (upload_check == null) { @@ -997,14 +1060,20 @@ public class XydlI2ServiceImpl implements XydlI2Service { List list = data_txDao.selectUploadById(value); if (CollectionUtil.isNotEmpty(list)) { log.info("查询tx的数据量:" + list.size()); - if (list.size()<1000) { - iscontiue = false; - } +// if (list.size()<1000) { +// iscontiue = false; +// } ArrayList cacdatalist = new ArrayList<>(); - BigInteger maxid = null; + BigInteger maxid = value; for (int index = 0; index < list.size(); index++) { Data_Tx item = list.get(index); - maxid = item.getId(); + BigInteger ids = item.getId(); + if (ids != null) { + int i = ids.compareTo(maxid); + if (i == 1) { + maxid = ids; + } + } Niec_Sensors sensors = equipMap.get(item.getEqmid()); if (sensors == null) { continue; @@ -1047,16 +1116,16 @@ public class XydlI2ServiceImpl implements XydlI2Service { } asyncMethod.updateRecordId(maxid, Constant.TXID); } else { - iscontiue = false; +// iscontiue = false; log.info("没有查询到tx的数据"); } - } +// } } @Override public void upload_ws(Client client, HashMap equipMap) { - Boolean iscontiue = true; - while (iscontiue) { +// Boolean iscontiue = true; +// while (iscontiue) { Upload_check upload_check = upload_checkDao.selectByPrimaryKey(Constant.WSID); BigInteger value = null; if (upload_check == null) { @@ -1070,14 +1139,20 @@ public class XydlI2ServiceImpl implements XydlI2Service { List list = data_wsDao.selectUploadById(value); if (CollectionUtil.isNotEmpty(list)) { log.info("查询ws的数据量:" + list.size()); - if (list.size()<1000) { - iscontiue = false; - } +// if (list.size()<1000) { +// iscontiue = false; +// } ArrayList cacdatalist = new ArrayList<>(); - BigInteger maxid = null; + BigInteger maxid = value; for (int index = 0; index < list.size(); index++) { Data_Ws item = list.get(index); - maxid = item.getId(); + BigInteger ids = item.getId(); + if (ids != null) { + int i = ids.compareTo(maxid); + if (i == 1) { + maxid = ids; + } + } Niec_Sensors sensors = equipMap.get(item.getEqmid()); if (sensors == null) { continue; @@ -1120,16 +1195,16 @@ public class XydlI2ServiceImpl implements XydlI2Service { } asyncMethod.updateRecordId(maxid, Constant.WSID); } else { - iscontiue = false; +// iscontiue = false; log.info("没有查询到ws的数据"); } - } +// } } @Override public void upload_ysp(Client client, HashMap equipMap) { - Boolean iscontiue = true; - while (iscontiue) { +// Boolean iscontiue = true; +// while (iscontiue) { //查询目前上传的油色谱的id 记录油色谱上传的id大小 Upload_check upload_check = upload_checkDao.selectByPrimaryKey(Constant.YSPID); BigInteger value = null; @@ -1144,14 +1219,20 @@ public class XydlI2ServiceImpl implements XydlI2Service { List list = data_yspDao.selectUploadById(value); if (CollectionUtil.isNotEmpty(list)) { log.info("查询ysp的数据量:" + list.size()); - if (list.size()<1000) { - iscontiue = false; - } +// if (list.size()<1000) { +// iscontiue = false; +// } ArrayList cacdatalist = new ArrayList<>(); - BigInteger maxid = null; + BigInteger maxid = value; for (int index = 0; index < list.size(); index++) { Data_Ysp item = list.get(index); - maxid = item.getId(); + BigInteger ids = item.getId(); + if (ids != null) { + int i = ids.compareTo(maxid); + if (i == 1) { + maxid = ids; + } + } Niec_Sensors sensors = equipMap.get(item.getEqmid()); if (sensors == null) { continue; @@ -1248,7 +1329,6 @@ public class XydlI2ServiceImpl implements XydlI2Service { log.info("测试断点3"); if ((index != 0 && index % sendlimit == 0) || index == (list.size() - 1)) { log.info("测试断点4"); - ArrayList list1 = new ArrayList<>(); String xml = GenerateI2Xml.generateEndCacXml(cacdatalist); log.info("ysp组装完成,开始上传"); asyncMethod.sendData2(client, xml); @@ -1261,16 +1341,16 @@ public class XydlI2ServiceImpl implements XydlI2Service { } asyncMethod.updateRecordId(maxid, Constant.YSPID); } else { - iscontiue = false; +// iscontiue = false; log.info("没有查询到ysp的数据"); } - } +// } } @Override public void upload_microclimate(Client client, HashMap equipMap) { - Boolean iscontiue = true; - while (iscontiue) { +// Boolean iscontiue = true; +// while (iscontiue) { Upload_check upload_check = upload_checkDao.selectByPrimaryKey(Constant.MICROCLIMATEID); BigInteger value = null; if (upload_check == null) { @@ -1284,14 +1364,20 @@ public class XydlI2ServiceImpl implements XydlI2Service { List list = data_microclimateDao.selectUploadById(value); if (CollectionUtil.isNotEmpty(list)) { log.info("查询microclimate的数据量:" + list.size()); - if (list.size()<1000) { - iscontiue = false; - } +// if (list.size()<1000) { +// iscontiue = false; +// } ArrayList cacdatalist = new ArrayList<>(); - BigInteger maxid = null; + BigInteger maxid = value; for (int index = 0; index < list.size(); index++) { Data_Microclimate item = list.get(index); - maxid = item.getId(); + BigInteger ids = item.getId(); + if (ids != null) { + int i = ids.compareTo(maxid); + if (i == 1) { + maxid = ids; + } + } Niec_Sensors sensors = equipMap.get(item.getEqmid()); if (sensors == null) { continue; @@ -1369,16 +1455,16 @@ public class XydlI2ServiceImpl implements XydlI2Service { } asyncMethod.updateRecordId(maxid, Constant.MICROCLIMATEID); } else { - iscontiue = false; +// iscontiue = false; log.info("没有查询到microcimate的数据"); } - } +// } } @Override public void upload_yx(Client client) { - Boolean iscontiue = true; - while (iscontiue) { +// Boolean iscontiue = true; +// while (iscontiue) { Upload_check upload_check = upload_checkDao.selectByPrimaryKey(Constant.YXID); BigInteger value = null; if (upload_check == null) { @@ -1392,10 +1478,10 @@ public class XydlI2ServiceImpl implements XydlI2Service { List list = data_yxDao.selectByPrimaryKey(value); if (CollectionUtil.isNotEmpty(list)) { log.info("查询yx的数据量:" + list.size()); - if (list.size() < 1000) { - iscontiue = false; - } - BigInteger maxid = null; +// if (list.size() < 1000) { +// iscontiue = false; +// } + BigInteger maxid = value; for (int index = 0; index < list.size(); index++) { Data_YxlDto data_yxlDto = list.get(index); Date dtime = data_yxlDto.getDtime(); @@ -1406,7 +1492,13 @@ public class XydlI2ServiceImpl implements XydlI2Service { Integer ival = data_yxlDto.getIval(); Integer sadr = data_yxlDto.getSadr(); String phase = data_yxlDto.getPhase(); - maxid = data_yxlDto.getId(); + BigInteger ids = data_yxlDto.getId(); + if (ids != null) { + int i = ids.compareTo(maxid); + if (i == 1) { + maxid = ids; + } + } YxAttrBean attr = new YxAttrBean<>(); attr.setSensorid(sensorid); @@ -1461,10 +1553,10 @@ public class XydlI2ServiceImpl implements XydlI2Service { } asyncMethod.updateRecordId(maxid, Constant.YXID); } else { - iscontiue = false; +// iscontiue = false; log.info("没有查询到yx的数据"); } - } +// } } @Override diff --git a/src/main/resources/application-test.yml b/src/main/resources/application-test.yml index 652edde..e299a01 100644 --- a/src/main/resources/application-test.yml +++ b/src/main/resources/application-test.yml @@ -1,15 +1,80 @@ # Spring配置 +#spring: +# datasource: +# driver-class-name: com.mysql.cj.jdbc.Driver +# url: jdbc:mysql://127.0.0.1:3306/iec104?allowMultiQueries=true&useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8 +# username: root +# password: 123456 +# type: com.alibaba.druid.pool.DruidDataSource +# task: +# scheduling: +# pool: +# size: 20 + spring: - datasource: - driver-class-name: com.mysql.cj.jdbc.Driver - url: jdbc:mysql://127.0.0.1:3306/iec104?allowMultiQueries=true&useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8 - username: root - password: 123456 - type: com.alibaba.druid.pool.DruidDataSource task: scheduling: pool: size: 20 + # 数据源配置 + datasource: + type: com.alibaba.druid.pool.DruidDataSource + driverClassName: com.mysql.cj.jdbc.Driver + druid: + # 主库数据源 + master: +# url: jdbc:mysql://192.168.200.63:3306/xymp?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8 +# username: xymp +# password: xymp@123 + url: jdbc:mysql://127.0.0.1:3306/iec104?allowMultiQueries=true&useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8 + username: root + password: 123456 + # 从库数据源 + slave: + # 从数据源开关/默认关闭 + enabled: false + url: + username: + password: + # 初始连接数 + initialSize: 20 + # 最小连接池数量 + minIdle: 20 + # 最大连接池数量 + maxActive: 40 + # 配置获取连接等待超时的时间 + maxWait: 60000 + # 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒 + timeBetweenEvictionRunsMillis: 60000 + # 配置一个连接在池中最小生存的时间,单位是毫秒 + minEvictableIdleTimeMillis: 300000 + # 配置一个连接在池中最大生存的时间,单位是毫秒 + maxEvictableIdleTimeMillis: 900000 + # 配置检测连接是否有效 + validationQuery: SELECT 1 FROM DUAL + testWhileIdle: true + testOnBorrow: false + testOnReturn: false + webStatFilter: + enabled: true + statViewServlet: + enabled: true + # 设置白名单,不填则允许所有访问 + allow: + url-pattern: /druid/* + # 控制台管理用户名和密码 + login-username: root + login-password: 123456 + filter: + stat: + enabled: true + # 慢SQL记录 + log-slow-sql: true + slow-sql-millis: 1000 + merge-sql: true + wall: + config: + multi-statement-allow: true # 开发环境配置 server: @@ -20,7 +85,7 @@ server: logging: config: classpath:log4j2.xml level: - com.shxy: info + com.shxy: trace org.springframework: warn # MyBatis配置 diff --git a/src/main/resources/mappers/Data_Byq_JbfdDao.xml b/src/main/resources/mappers/Data_Byq_JbfdDao.xml index 16c98c8..a76fcc1 100644 --- a/src/main/resources/mappers/Data_Byq_JbfdDao.xml +++ b/src/main/resources/mappers/Data_Byq_JbfdDao.xml @@ -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 ]]> #{maxid} limit 1000 + data_byq_jbfd t1 where t1.id ]]> #{maxid} diff --git a/src/main/resources/mappers/Data_YxDao.xml b/src/main/resources/mappers/Data_YxDao.xml index 21366d0..da0d833 100644 --- a/src/main/resources/mappers/Data_YxDao.xml +++ b/src/main/resources/mappers/Data_YxDao.xml @@ -26,7 +26,7 @@ c.table_name as table_name, c.phase as phase from data_yx a left join niec_points b on a.sadr = b.sadr left join niec_sensors c on b.sensor_id = c.id - where a.id ]]> #{maxid} limit 1000 + where a.id ]]> #{maxid} diff --git a/src/main/resources/mappers/data_FhzxqDao.xml b/src/main/resources/mappers/data_FhzxqDao.xml index f0026be..b079a63 100644 --- a/src/main/resources/mappers/data_FhzxqDao.xml +++ b/src/main/resources/mappers/data_FhzxqDao.xml @@ -18,7 +18,7 @@ select from data_fhzxq - where id ]]> #{maxid} limit 1000 + where id ]]> #{maxid}