I2代码优化

master
liuguijing 1 year ago
parent a6f8dda81b
commit 8ed582cf61

@ -87,6 +87,14 @@
</dependency>
<!-- pagehelper 分页插件 -->
<dependency>
<groupId>com.github.pagehelper</groupId>
<artifactId>pagehelper-spring-boot-starter</artifactId>
<version>${pagehelper.boot.version}</version>
</dependency>
<!--lombok-->
<dependency>
<groupId>org.projectlombok</groupId>

@ -4,11 +4,9 @@ import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.util.StrUtil;
import cn.hutool.json.JSONObject;
import cn.hutool.json.XML;
import com.shxy.i2.bean.SendDataBean;
import com.shxy.i2.constant.CommonStatus;
import com.shxy.i2.constant.Constant;
import com.shxy.i2.dao.*;
import com.shxy.i2.dto.Data_YxlDto;
import lombok.extern.slf4j.Slf4j;
import org.apache.cxf.endpoint.Client;
import org.springframework.beans.factory.annotation.Autowired;
@ -129,46 +127,6 @@ public class AsyncMethod {
}
}
// @Async(value = "asyncServiceExecutor")
// public void sendJBFDData(Client client, ArrayList<SendDataBean> idlist, String xml, String type) throws Exception {
// Object[] objects = client.invoke("uploadCACData", xml);
// String threadId = Thread.currentThread().getName();
// log.info("线程序号: " + threadId + "当前时间:" + new Date());
//// log.info("上传的数据: " + xml);
// 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("上传成功");
// log.info("修改的id: " + idlist.toString());
// if (CollectionUtil.isNotEmpty(idlist)) {
// if (StrUtil.equals(type, Constant.BYQ_JBFD)) {
// data_byq_jbfdDao.updateDataList(CommonStatus.UPLOAD.value(), idlist, new Date());
// } else if (StrUtil.equals(type, Constant.DLQJBFD)) {
// data_dlq_jbfdDao.updateDataList(CommonStatus.UPLOAD.value(), idlist, new Date());
// } else if (StrUtil.equals(type, Constant.YSP)) {
// data_yspDao.updateDataList(CommonStatus.UPLOAD.value(), idlist, new Date());
// }
//
//
// }
// } else {
// log.info("上传失败");
// }
// }
// }
// }
// }
// }
@Async(value = "asyncServiceExecutor")
public void sendJBFDData2(Client client, BigInteger maxid, ArrayList<Integer> list1, String xml, String type) throws Exception {
Object[] objects = client.invoke("uploadCACData", xml);
@ -196,8 +154,6 @@ public class AsyncMethod {
} else if (StrUtil.equals(type, Constant.YSP)) {
data_yspDao.updateDataList2(CommonStatus.UPLOAD.value(), maxid, list1, new Date());
}
}
} else {
log.info("上传失败");
@ -209,31 +165,62 @@ public class AsyncMethod {
}
@Async(value = "asyncServiceExecutor")
public void sendYxData(Client client, BigInteger maxid, String xml) throws Exception {
Object[] objects = client.invoke("uploadCACData", xml);
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("上传成功");
// 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("上传失败");
// }
// }
// }
// }
// }
}
@Async(value = "asyncServiceExecutor")
public void sendYxData(Client client, BigInteger maxid, String xml) throws Exception {
// Object[] objects = client.invoke("uploadCACData", xml);
// 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("上传成功");
if (maxid != null && maxid.longValue() > 0) {
upload_checkDao.updateByPrimaryKey(Constant.YXID, maxid, new Date());
}
} else {
log.info("上传失败");
}
}
}
// } else {
// log.info("上传失败");
// }
// }
// }
// }
// }
}
public void updateRecordId(BigInteger maxid,String type) {
if (maxid != null && maxid.longValue() > 0) {
upload_checkDao.updateByPrimaryKey(type, maxid, new Date());
}
}

@ -0,0 +1,449 @@
package com.shxy.i2.Tool;
import cn.hutool.core.text.StrFormatter;
import org.springframework.util.AntPathMatcher;
import java.util.*;
/**
*
*
* @author
*/
public class StringUtils extends org.apache.commons.lang3.StringUtils {
/**
*
*/
private static final String NULLSTR = "";
/**
* 线
*/
private static final char SEPARATOR = '_';
/**
*
*
* @param value defaultValue value
* @return value
*/
public static <T> T nvl(T value, T defaultValue) {
return value != null ? value : defaultValue;
}
/**
* * Collection ListSetQueue
*
* @param coll Collection
* @return true false
*/
public static boolean isEmpty(Collection<?> coll) {
return isNull(coll) || coll.isEmpty();
}
/**
* * CollectionListSetQueue
*
* @param coll Collection
* @return true false
*/
public static boolean isNotEmpty(Collection<?> coll) {
return !isEmpty(coll);
}
/**
* *
*
* @param objects
* * @return true false
*/
public static boolean isEmpty(Object[] objects) {
return isNull(objects) || (objects.length == 0);
}
/**
* *
*
* @param objects
* @return true false
*/
public static boolean isNotEmpty(Object[] objects) {
return !isEmpty(objects);
}
/**
* * Map
*
* @param map Map
* @return true false
*/
public static boolean isEmpty(Map<?, ?> map) {
return isNull(map) || map.isEmpty();
}
/**
* * Map
*
* @param map Map
* @return true false
*/
public static boolean isNotEmpty(Map<?, ?> map) {
return !isEmpty(map);
}
/**
* *
*
* @param str String
* @return true false
*/
public static boolean isEmpty(String str) {
return isNull(str) || NULLSTR.equals(str.trim());
}
/**
* *
*
* @param str String
* @return true false
*/
public static boolean isNotEmpty(String str) {
return !isEmpty(str);
}
/**
* *
*
* @param object Object
* @return true false
*/
public static boolean isNull(Object object) {
return object == null;
}
/**
* *
*
* @param object Object
* @return true false
*/
public static boolean isNotNull(Object object) {
return !isNull(object);
}
/**
* * Java
*
* @param object
* @return true false
*/
public static boolean isArray(Object object) {
return isNotNull(object) && object.getClass().isArray();
}
/**
*
*/
public static String trim(String str) {
return (str == null ? "" : str.trim());
}
/**
*
*
* @param str
* @param start
* @return
*/
public static String substring(final String str, int start) {
if (str == null) {
return NULLSTR;
}
if (start < 0) {
start = str.length() + start;
}
if (start < 0) {
start = 0;
}
if (start > str.length()) {
return NULLSTR;
}
return str.substring(start);
}
/**
*
*
* @param str
* @param start
* @param end
* @return
*/
public static String substring(final String str, int start, int end) {
if (str == null) {
return NULLSTR;
}
if (end < 0) {
end = str.length() + end;
}
if (start < 0) {
start = str.length() + start;
}
if (end > str.length()) {
end = str.length();
}
if (start > end) {
return NULLSTR;
}
if (start < 0) {
start = 0;
}
if (end < 0) {
end = 0;
}
return str.substring(start, end);
}
/**
* , {} <br>
* {} <br>
* {} 使 \\ { {} \ 使 \\\\ <br>
* <br>
* 使format("this is {} for {}", "a", "b") -> this is a for b<br>
* {} format("this is \\{} for {}", "a", "b") -> this is \{} for a<br>
* \ format("this is \\\\{} for {}", "a", "b") -> this is \a for b<br>
*
* @param template {}
* @param params
* @return
*/
public static String format(String template, Object... params) {
if (isEmpty(params) || isEmpty(template)) {
return template;
}
return StrFormatter.format(template, params);
}
/**
* set
*
* @param str
* @param sep
* @return set
*/
public static final Set<String> str2Set(String str, String sep) {
return new HashSet<String>(str2List(str, sep, true, false));
}
/**
* list
*
* @param str
* @param sep
* @param filterBlank
* @param trim
* @return list
*/
public static final List<String> str2List(String str, String sep, boolean filterBlank, boolean trim) {
List<String> list = new ArrayList<String>();
if (StringUtils.isEmpty(str)) {
return list;
}
// 过滤空白字符串
if (StringUtils.isBlank(str)) {
return list;
}
String[] split = str.split(sep);
for (String string : split) {
if (StringUtils.isBlank(string)) {
continue;
}
if (trim) {
string = string.trim();
}
list.add(string);
}
return list;
}
/**
*
*
* @param cs
* @param searchCharSequences
* @return
*/
public static boolean containsAnyIgnoreCase(CharSequence cs, CharSequence... searchCharSequences) {
if (isEmpty(cs) || isEmpty(searchCharSequences)) {
return false;
}
for (CharSequence testStr : searchCharSequences) {
if (containsIgnoreCase(cs, testStr)) {
return true;
}
}
return false;
}
/**
* 线
*/
public static String toUnderScoreCase(String str) {
if (str == null) {
return null;
}
StringBuilder sb = new StringBuilder();
// 前置字符是否大写
boolean preCharIsUpperCase = true;
// 当前字符是否大写
boolean curreCharIsUpperCase = true;
// 下一字符是否大写
boolean nexteCharIsUpperCase = true;
for (int i = 0; i < str.length(); i++) {
char c = str.charAt(i);
if (i > 0) {
preCharIsUpperCase = Character.isUpperCase(str.charAt(i - 1));
} else {
preCharIsUpperCase = false;
}
curreCharIsUpperCase = Character.isUpperCase(c);
if (i < (str.length() - 1)) {
nexteCharIsUpperCase = Character.isUpperCase(str.charAt(i + 1));
}
if (preCharIsUpperCase && curreCharIsUpperCase && !nexteCharIsUpperCase) {
sb.append(SEPARATOR);
} else if ((i != 0 && !preCharIsUpperCase) && curreCharIsUpperCase) {
sb.append(SEPARATOR);
}
sb.append(Character.toLowerCase(c));
}
return sb.toString();
}
/**
*
*
* @param str
* @param strs
* @return true
*/
public static boolean inStringIgnoreCase(String str, String... strs) {
if (str != null && strs != null) {
for (String s : strs) {
if (str.equalsIgnoreCase(trim(s))) {
return true;
}
}
}
return false;
}
/**
* 线线 HELLO_WORLD->HelloWorld
*
* @param name 线
* @return
*/
public static String convertToCamelCase(String name) {
StringBuilder result = new StringBuilder();
// 快速检查
if (name == null || name.isEmpty()) {
// 没必要转换
return "";
} else if (!name.contains("_")) {
// 不含下划线,仅将首字母大写
return name.substring(0, 1).toUpperCase() + name.substring(1);
}
// 用下划线将原始字符串分割
String[] camels = name.split("_");
for (String camel : camels) {
// 跳过原始字符串中开头、结尾的下换线或双重下划线
if (camel.isEmpty()) {
continue;
}
// 首字母大写
result.append(camel.substring(0, 1).toUpperCase());
result.append(camel.substring(1).toLowerCase());
}
return result.toString();
}
/**
* user_name->userName
*/
public static String toCamelCase(String s) {
if (s == null) {
return null;
}
s = s.toLowerCase();
StringBuilder sb = new StringBuilder(s.length());
boolean upperCase = false;
for (int i = 0; i < s.length(); i++) {
char c = s.charAt(i);
if (c == SEPARATOR) {
upperCase = true;
} else if (upperCase) {
sb.append(Character.toUpperCase(c));
upperCase = false;
} else {
sb.append(c);
}
}
return sb.toString();
}
/**
*
*
* @param str
* @param strs
* @return
*/
public static boolean matches(String str, List<String> strs) {
if (isEmpty(str) || isEmpty(strs)) {
return false;
}
for (String pattern : strs) {
if (isMatch(pattern, str)) {
return true;
}
}
return false;
}
/**
* url:
* ? ;
* * ;
* ** ;
*
* @param pattern
* @param url url
* @return
*/
public static boolean isMatch(String pattern, String url) {
AntPathMatcher matcher = new AntPathMatcher();
return matcher.match(pattern, url);
}
@SuppressWarnings("unchecked")
public static <T> T cast(Object obj) {
return (T) obj;
}
}

@ -0,0 +1,62 @@
package com.shxy.i2.Tool.sql;
import cn.hutool.core.exceptions.UtilException;
import com.shxy.i2.Tool.StringUtils;
/**
* sql
*
* @author ruoyi
*/
public class SqlUtils extends cn.hutool.db.sql.SqlUtil
{
/**
* sql
*/
public static String SQL_REGEX = "select |insert |delete |update |drop |count |exec |chr |mid |master |truncate |char |and |declare ";
/**
* 线
*/
public static String SQL_PATTERN = "[a-zA-Z0-9_\\ \\,\\.]+";
/**
*
*/
public static String escapeOrderBySql(String value)
{
if (StringUtils.isNotEmpty(value) && !isValidOrderBySql(value))
{
throw new UtilException("参数不符合规范,不能进行查询");
}
return value;
}
/**
* order by
*/
public static boolean isValidOrderBySql(String value)
{
return value.matches(SQL_PATTERN);
}
/**
* SQL
*/
public static void filterKeyword(String value)
{
if (StringUtils.isEmpty(value))
{
return;
}
String[] sqlKeywords = StringUtils.split(SQL_REGEX, "\\|");
for (String sqlKeyword : sqlKeywords)
{
if (StringUtils.indexOfIgnoreCase(value, sqlKeyword) > -1)
{
throw new UtilException("参数存在SQL注入风险");
}
}
}
}

@ -5,6 +5,20 @@ public class Constant {
public static String YXID = "yxid";
public static String YSPID = "yspid";
public static String BYQJBFDID = "byqjbfdid";
public static String DLQJBFDID = "dlqjbfdid";
public static String CNJID = "cnjid";
public static String DCYWID = "dcywid";
public static String DRJYJCID = "drjyjcid";
public static String FHDLBXID = "fhdlbxid";
public static String FHZXQID = "fhzxqid";
public static String JSYHWJYJCID = "jsyhwjyjcid";
public static String SF6QTSFID = "sf6qtsfid";
public static String SF6QTYLID = "sf6qtylid";
public static String TXID = "txid";
public static String WSID = "wsid";
public static String MICROCLIMATEID = "microclimateid";
public static String BYQ_JBFD = "021001";
public static String YSP = "021002";

@ -11,6 +11,8 @@ import java.util.List;
public interface Data_Byq_JbfdDao {
List<Data_Byq_Jbfd> selectUploadById(@Param("maxid") BigInteger maxid);
List<Data_Byq_Jbfd> selectUpload(@Param("isupload") Integer isupload);
int updateByPrimaryKey(@Param("isupload") Integer isupload, @Param("maxid") BigInteger maxid, @Param("idlist") List<BigInteger> id, @Param("updateTime") Date updateTime);
@ -21,6 +23,6 @@ public interface Data_Byq_JbfdDao {
int updateDataList2(@Param("isupload") Integer isupload, @Param("maxid") BigInteger maxid, @Param("idlist") ArrayList<Integer> id, @Param("updateTime") Date updateTime);
int deleteData(@Param("time") Date time);
}

@ -1,6 +1,5 @@
package com.shxy.i2.dao;
import cn.hutool.core.date.DateTime;
import com.shxy.i2.entity.Data_Cnj;
import org.apache.ibatis.annotations.Param;
@ -10,6 +9,8 @@ import java.util.List;
public interface Data_CnjDao {
List<Data_Cnj> selectUploadById(@Param("maxid") BigInteger maxid);
List<Data_Cnj> selectUpload(@Param("isupload") Integer isupload);
int updateByPrimaryKey(@Param("isupload") Integer isupload, @Param("maxid") BigInteger maxid, @Param("idlist") List<BigInteger> id, @Param("updateTime") Date updateTime);
@ -17,4 +18,5 @@ public interface Data_CnjDao {
int updateList(@Param("isupload") Integer isupload, @Param("idlist") List<BigInteger> id, @Param("updateTime") Date updateTime);
int deleteData(@Param("time") Date time);
}

@ -1,6 +1,5 @@
package com.shxy.i2.dao;
import cn.hutool.core.date.DateTime;
import com.shxy.i2.entity.Data_Dcyw;
import org.apache.ibatis.annotations.Param;
@ -10,6 +9,8 @@ import java.util.List;
public interface Data_DcywDao {
List<Data_Dcyw> selectUploadById(@Param("maxid") BigInteger maxid);
List<Data_Dcyw> selectUpload(@Param("isupload") Integer isupload);
int updateByPrimaryKey(@Param("isupload") Integer isupload, @Param("maxid") BigInteger maxid, @Param("idlist") List<BigInteger> id, @Param("updateTime") Date updateTime);
@ -17,4 +18,5 @@ public interface Data_DcywDao {
int updateList(@Param("isupload") Integer isupload, @Param("idlist") List<BigInteger> id, @Param("updateTime") Date updateTime);
int deleteData(@Param("time") Date time);
}

@ -1,6 +1,5 @@
package com.shxy.i2.dao;
import cn.hutool.core.date.DateTime;
import com.shxy.i2.bean.SendDataBean;
import com.shxy.i2.entity.Data_Dlq_Jbfd;
import org.apache.ibatis.annotations.Param;
@ -14,6 +13,8 @@ public interface Data_Dlq_JbfdDao {
List<Data_Dlq_Jbfd> selectUpload(@Param("isupload") Integer isupload);
List<Data_Dlq_Jbfd> selectUploadById(@Param("maxid") BigInteger maxid);
int updateByPrimaryKey(@Param("isupload") Integer isupload, @Param("maxid") BigInteger maxid, @Param("idlist") List<BigInteger> id, @Param("updateTime") Date updateTime);
int updateList(@Param("isupload") Integer isupload, @Param("idlist") List<BigInteger> id, @Param("updateTime") Date updateTime);

@ -1,6 +1,5 @@
package com.shxy.i2.dao;
import cn.hutool.core.date.DateTime;
import com.shxy.i2.entity.Data_Dr_Jyjc;
import org.apache.ibatis.annotations.Param;
@ -10,6 +9,8 @@ import java.util.List;
public interface Data_Dr_JyjcDao {
List<Data_Dr_Jyjc> selectUploadById(@Param("maxid") BigInteger maxid);
List<Data_Dr_Jyjc> selectUpload(@Param("isupload") Integer isupload);
int updateByPrimaryKey(@Param("isupload") Integer isupload, @Param("maxid") BigInteger maxid, @Param("idlist") List<BigInteger> id, @Param("updateTime") Date updateTime);

@ -1,6 +1,5 @@
package com.shxy.i2.dao;
import cn.hutool.core.date.DateTime;
import com.shxy.i2.entity.Data_Fhdlbx;
import org.apache.ibatis.annotations.Param;
@ -10,6 +9,8 @@ import java.util.List;
public interface Data_FhdlbxDao {
List<Data_Fhdlbx> selectUploadById(@Param("maxid") BigInteger maxid);
List<Data_Fhdlbx> selectUpload(@Param("isupload") Integer isupload);
int updateByPrimaryKey(@Param("isupload") Integer isupload, @Param("maxid") BigInteger maxid, @Param("idlist") List<BigInteger> id, @Param("updateTime") Date updateTime);

@ -1,6 +1,5 @@
package com.shxy.i2.dao;
import cn.hutool.core.date.DateTime;
import com.shxy.i2.entity.Data_Fhzxq;
import org.apache.ibatis.annotations.Param;
@ -10,6 +9,8 @@ import java.util.List;
public interface Data_FhzxqDao {
List<Data_Fhzxq> selectUploadById(@Param("maxid") BigInteger maxid);
List<Data_Fhzxq> selectUpload(@Param("isupload") Integer isupload);
int updateByPrimaryKey(@Param("isupload") Integer isupload, @Param("maxid") BigInteger maxid, @Param("idlist") List<BigInteger> id, @Param("updateTime") Date updateTime);

@ -1,6 +1,5 @@
package com.shxy.i2.dao;
import cn.hutool.core.date.DateTime;
import com.shxy.i2.entity.Data_Jsyhw_Jyjc;
import org.apache.ibatis.annotations.Param;
@ -10,6 +9,8 @@ import java.util.List;
public interface Data_Jsyhw_JyjcDao {
List<Data_Jsyhw_Jyjc> selectUploadById(@Param("maxid") BigInteger maxid);
List<Data_Jsyhw_Jyjc> selectUpload(@Param("isupload") Integer isupload);
int updateByPrimaryKey(@Param("isupload") Integer isupload, @Param("maxid") BigInteger maxid, @Param("idlist") List<BigInteger> id, @Param("updateTime") Date updateTime);

@ -1,6 +1,5 @@
package com.shxy.i2.dao;
import cn.hutool.core.date.DateTime;
import com.shxy.i2.entity.Data_Microclimate;
import org.apache.ibatis.annotations.Param;
@ -10,6 +9,8 @@ import java.util.List;
public interface Data_MicroclimateDao {
List<Data_Microclimate> selectUploadById(@Param("maxid") BigInteger maxid);
List<Data_Microclimate> selectUpload(@Param("isupload") Integer isupload);
int updateByPrimaryKey(@Param("isupload") Integer isupload, @Param("maxid") BigInteger maxid, @Param("idlist") List<BigInteger> id, @Param("updateTime") Date updateTime);

@ -1,6 +1,5 @@
package com.shxy.i2.dao;
import cn.hutool.core.date.DateTime;
import com.shxy.i2.entity.Data_SF6_Qtsf;
import org.apache.ibatis.annotations.Param;
@ -10,6 +9,8 @@ import java.util.List;
public interface Data_SF6_QtsfDao {
List<Data_SF6_Qtsf> selectUploadById(@Param("maxid") BigInteger maxid);
List<Data_SF6_Qtsf> selectUpload(@Param("isupload") Integer isupload);
int updateByPrimaryKey(@Param("isupload") Integer isupload, @Param("maxid") BigInteger maxid, @Param("idlist") List<BigInteger> id, @Param("updateTime") Date updateTime);

@ -1,6 +1,5 @@
package com.shxy.i2.dao;
import cn.hutool.core.date.DateTime;
import com.shxy.i2.entity.Data_SF6_Qtyl;
import org.apache.ibatis.annotations.Param;
@ -10,6 +9,8 @@ import java.util.List;
public interface Data_SF6_QtylDao {
List<Data_SF6_Qtyl> selectUploadById(@Param("maxid") BigInteger maxid);
List<Data_SF6_Qtyl> selectUpload(@Param("isupload") Integer isupload);
int updateByPrimaryKey(@Param("isupload") Integer isupload, @Param("maxid") BigInteger maxid, @Param("idlist") List<BigInteger> id, @Param("updateTime") Date updateTime);

@ -1,6 +1,5 @@
package com.shxy.i2.dao;
import cn.hutool.core.date.DateTime;
import com.shxy.i2.entity.Data_Tx;
import org.apache.ibatis.annotations.Param;
@ -10,6 +9,8 @@ import java.util.List;
public interface Data_TxDao {
List<Data_Tx> selectUploadById(@Param("maxid") BigInteger maxid);
List<Data_Tx> selectUpload(@Param("isupload") Integer isupload);
int updateByPrimaryKey(@Param("isupload") Integer isupload, @Param("maxid") BigInteger maxid, @Param("idlist") List<BigInteger> id, @Param("updateTime") Date updateTime);

@ -1,6 +1,5 @@
package com.shxy.i2.dao;
import cn.hutool.core.date.DateTime;
import com.shxy.i2.entity.Data_Ws;
import org.apache.ibatis.annotations.Param;
@ -10,6 +9,8 @@ import java.util.List;
public interface Data_WsDao {
List<Data_Ws> selectUploadById(@Param("maxid") BigInteger maxid);
List<Data_Ws> selectUpload(@Param("isupload") Integer isupload);
int updateByPrimaryKey(@Param("isupload") Integer isupload, @Param("maxid") BigInteger maxid, @Param("idlist") List<BigInteger> id, @Param("updateTime") Date updateTime);

@ -1,6 +1,5 @@
package com.shxy.i2.dao;
import cn.hutool.core.date.DateTime;
import com.shxy.i2.bean.SendDataBean;
import com.shxy.i2.entity.Data_Ysp;
import org.apache.ibatis.annotations.Param;
@ -12,6 +11,8 @@ import java.util.List;
public interface Data_YspDao {
List<Data_Ysp> selectUploadById(@Param("maxid") BigInteger maxid);
List<Data_Ysp> selectUpload(@Param("isupload") Integer isupload);
int updateByPrimaryKey(@Param("isupload") Integer isupload, @Param("maxid") BigInteger maxid, @Param("idlist") List<BigInteger> id, @Param("updateTime") Date updateTime);

@ -1,7 +1,6 @@
package com.shxy.i2.dao;
import com.shxy.i2.dto.Data_YxlDto;
import com.shxy.i2.entity.Data_Yx;
import org.apache.ibatis.annotations.Param;
import java.math.BigInteger;
@ -12,7 +11,5 @@ public interface Data_YxDao {
List<Data_YxlDto> selectByPrimaryKey(@Param("maxid") BigInteger maxid);
int updateByPrimaryKey(Data_Yx record);
int deleteData(@Param("time") Date time);
}

@ -8,6 +8,9 @@ public interface Webservcies {
void uploadyspData();
void uploadjfjcData();
void uploadyxData();
// void test(String str);
void uploaddcywData();
void uploadjsyhwjyjcData();
}

@ -11,6 +11,7 @@ import org.apache.cxf.jaxws.endpoint.dynamic.JaxWsDynamicClientFactory;
import org.apache.cxf.transport.http.HTTPConduit;
import org.apache.cxf.transports.http.configuration.HTTPClientPolicy;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.scheduling.annotation.EnableAsync;
import org.springframework.stereotype.Service;
@ -31,28 +32,39 @@ public class WebServiceImpl implements Webservcies {
@Autowired
private Niec_SensorsDao niec_sensorsDao;
private static String address = "http://10.238.71.98:18096/ppa/webservice/CAGAccessService?wsdl";
@Value("${webservice.address}")
public String address;
@Value("${webservice.connecttime}")
public Integer connecttime;
@Value("${webservice.receivetime}")
public Integer receivetime;
/**
* 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(60000);
// 等待服务器响应超时时间 60秒
policy.setReceiveTimeout(30000);
conduit.setClient(policy);
// 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("开始执行定时任务-查询数据库");
HashMap<Integer, Niec_Sensors> equipMap = new HashMap();
List<Niec_Sensors> niec_sensors = niec_sensorsDao.selectAll();
@ -60,65 +72,37 @@ public class WebServiceImpl implements Webservcies {
equipMap.put(item.getId(), item);
}
xydlI2Service.upload_sf6_qtyl(client, equipMap);
xydlI2Service.upload_dcyw(client, equipMap);
xydlI2Service.upload_fhdlbx(client, equipMap);
xydlI2Service.upload_fhzxq(client, equipMap);
xydlI2Service.upload_sf6_qtsf(client, equipMap);
xydlI2Service.upload_tx(client, equipMap);
xydlI2Service.upload_ws(client, equipMap);
xydlI2Service.upload_dr_jyjc(client, equipMap);
xydlI2Service.upload_jsyhw_jyjc(client, equipMap);
xydlI2Service.upload_microclimate(client, equipMap);
xydlI2Service.upload_cnj(client, equipMap);
xydlI2Service.upload_yx(client);
log.info("实时数据定时任务结束");
}
// /**
// * 上传cac数据
// */
// @Override
// public void uploadYxData() {
// log.info("实时数据遥信定时任务启动");
//// 动态客户端
//放到配置文件
@Override
public void uploadyspData() {
// log.info("油色谱数据定时任务启动");
// // 动态客户端
// JaxWsDynamicClientFactory clientFactory = JaxWsDynamicClientFactory.newInstance();
// log.info("实时数据 publicsecurity webService url : {}", address);
// 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(60000);
// policy.setConnectionTimeout(connecttime);
// // 等待服务器响应超时时间 60秒
// policy.setReceiveTimeout(30000);
// policy.setReceiveTimeout(receivetime);
// conduit.setClient(policy);
// log.info("开始执行定时遥信任务-查询数据库");
// xydlI2Service.upload_yx(client);
//
// log.info("实时数据定时遥信任务结束");
//
// }
@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(60000);
// 等待服务器响应超时时间 60秒
policy.setReceiveTimeout(60000);
conduit.setClient(policy);
Client client = null;
log.info("开始执行定时任务-查询数据库");
HashMap<Integer, Niec_Sensors> equipMap = new HashMap();
List<Niec_Sensors> niec_sensors = niec_sensorsDao.selectAll();
@ -131,21 +115,21 @@ 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(60000);
// 等待服务器响应超时时间 60秒
policy.setReceiveTimeout(60000);
conduit.setClient(policy);
// 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;
HashMap<Integer, Niec_Sensors> equipMap = new HashMap();
List<Niec_Sensors> niec_sensors = niec_sensorsDao.selectAll();
for (Niec_Sensors item : niec_sensors) {
@ -156,4 +140,85 @@ public class WebServiceImpl implements Webservcies {
log.info("局放监测数据定时任务结束");
}
@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("开始执行定时任务-查询数据库");
HashMap<Integer, Niec_Sensors> equipMap = new HashMap();
List<Niec_Sensors> niec_sensors = niec_sensorsDao.selectAll();
for (Niec_Sensors item : niec_sensors) {
equipMap.put(item.getId(), item);
}
xydlI2Service.upload_yx(client);
log.info("实时数据定时任务结束");
}
@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("开始执行定时任务-查询数据库");
HashMap<Integer, Niec_Sensors> equipMap = new HashMap();
List<Niec_Sensors> niec_sensors = niec_sensorsDao.selectAll();
for (Niec_Sensors item : niec_sensors) {
equipMap.put(item.getId(), item);
}
xydlI2Service.upload_dcyw(client, equipMap);
log.info("实时数据定时任务结束");
}
@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("开始执行定时任务-查询数据库");
HashMap<Integer, Niec_Sensors> equipMap = new HashMap();
List<Niec_Sensors> niec_sensors = niec_sensorsDao.selectAll();
for (Niec_Sensors item : niec_sensors) {
equipMap.put(item.getId(), item);
}
xydlI2Service.upload_jsyhw_jyjc(client, equipMap);
log.info("实时数据定时任务结束");
}
}

@ -19,6 +19,7 @@ import com.shxy.i2.service.XydlI2Service;
import lombok.extern.slf4j.Slf4j;
import org.apache.cxf.endpoint.Client;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import java.math.BigInteger;
@ -31,7 +32,6 @@ import java.util.List;
@Slf4j
public class XydlI2ServiceImpl implements XydlI2Service {
@Autowired
private Data_SF6_QtylDao data_sf6_qtylDao;
@ -84,19 +84,30 @@ public class XydlI2ServiceImpl implements XydlI2Service {
@Autowired
AsyncMethod asyncMethod;
@Value("${webservice.receivetime}")
public int sendlimit;
@Override
public void upload_byq_jbfd(Client client, HashMap<Integer, Niec_Sensors> equipMap) {
List<Data_Byq_Jbfd> list = data_byq_jbfdDao.selectUpload(CommonStatus.UNUPLOAD.value());
if (CollectionUtil.isNotEmpty(list)) {
log.info("查询byq_jbfd的数据量" + list.size());
//查询目前上传的变压器局部放电的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);
}
}
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());
ArrayList<String> cacdatalist = new ArrayList<>();
ArrayList<BigInteger> idlist = new ArrayList<>();
ArrayList<SendDataBean> list2 = new ArrayList<>();
ArrayList<Integer> eqmidlist = new ArrayList<>();
BigInteger maxid = BigInteger.valueOf(0);
for (int index = 0; index < list.size(); index++) {
Data_Byq_Jbfd item = list.get(index);
BigInteger maxid = null;
for (int index = 0; index < data_byq_jbfdlist.size(); index++) {
Data_Byq_Jbfd item = data_byq_jbfdlist.get(index);
maxid = item.getId();
Niec_Sensors sensors = equipMap.get(item.getEqmid());
if (sensors == null) {
continue;
@ -104,7 +115,6 @@ public class XydlI2ServiceImpl implements XydlI2Service {
String sensorid = sensors.getSensorCode();
String equipmentid = sensors.getEquipmentId();
String phase = sensors.getPhase();
if (StrUtil.isNotEmpty(sensorid) && StrUtil.isNotEmpty(equipmentid)) {
ArrayList<AttrBean> attrlist = new ArrayList<>();
try {
@ -150,27 +160,12 @@ public class XydlI2ServiceImpl implements XydlI2Service {
String cacdata = GenerateI2Xml.generateCacXml(Constant.BYQ_JBFD, sensorid, equipmentid, timestamp, attrlist);
cacdatalist.add(cacdata);
BigInteger id = item.getId();
idlist.add(id);
SendDataBean sendDataBean = new SendDataBean();
sendDataBean.setEqmid(item.getEqmid());
sendDataBean.setMaxid(id);
list2.add(sendDataBean);
eqmidlist.add(item.getEqmid());
if (id != null) {
int i = id.compareTo(maxid);
if (i == 1) {
maxid = id;
}
}
if ((index != 0 && index % 79 == 0) || index == (list.size() - 1)) {
ArrayList<BigInteger> list1 = new ArrayList<>();
if ((index != 0 && index % sendlimit == 0) || index == (data_byq_jbfdlist.size() - 1)) {
String xml = GenerateI2Xml.generateEndCacXml(cacdatalist);
list1.addAll(idlist);
// asyncMethod.sendJBFDData(client, list2, xml, Constant.BYQ_JBFD);
asyncMethod.sendJBFDData2(client, maxid, eqmidlist, xml, Constant.BYQ_JBFD);
idlist = new ArrayList<>();
maxid = BigInteger.valueOf(0);
eqmidlist = new ArrayList<>();
asyncMethod.sendData2(client, xml);
cacdatalist = new ArrayList<>();
}
} catch (Exception e) {
@ -178,6 +173,7 @@ public class XydlI2ServiceImpl implements XydlI2Service {
}
}
}
asyncMethod.updateRecordId(maxid,Constant.BYQJBFDID);
} else {
log.info("没有查询byq_jbfd的数据量");
}
@ -185,13 +181,24 @@ public class XydlI2ServiceImpl implements XydlI2Service {
@Override
public void upload_cnj(Client client, HashMap<Integer, Niec_Sensors> equipMap) {
List<Data_Cnj> list = data_cnjDao.selectUpload(CommonStatus.UNUPLOAD.value());
Upload_check upload_check = upload_checkDao.selectByPrimaryKey(Constant.CNJID);
BigInteger value = null;
if (upload_check == null) {
value = BigInteger.valueOf(0);
}else {
value = upload_check.getValue();
if (value == null) {
value = BigInteger.valueOf(0);
}
}
List<Data_Cnj> list = data_cnjDao.selectUploadById(value);
if (CollectionUtil.isNotEmpty(list)) {
log.info("查询byq_jbfd的数据量" + list.size());
log.info("查询cnj的数据量:" + list.size());
ArrayList<String> cacdatalist = new ArrayList<>();
ArrayList<BigInteger> idlist = new ArrayList<>();
BigInteger maxid = null;
for (int index = 0; index < list.size(); index++) {
Data_Cnj item = list.get(index);
maxid = item.getId();
Niec_Sensors sensors = equipMap.get(item.getEqmid());
if (sensors == null) {
continue;
@ -222,13 +229,9 @@ public class XydlI2ServiceImpl implements XydlI2Service {
}
String cacdata = GenerateI2Xml.generateCacXml(Constant.CNJ, sensorid, equipmentid, timestamp, attrlist);
cacdatalist.add(cacdata);
idlist.add(item.getId());
if ((index != 0 && index % 79 == 0) || index == (list.size() - 1)) {
ArrayList<BigInteger> list1 = new ArrayList<>();
if ((index != 0 && index % sendlimit == 0) || index == (list.size() - 1)) {
String xml = GenerateI2Xml.generateEndCacXml(cacdatalist);
list1.addAll(idlist);
asyncMethod.sendData(client, list1, xml, Constant.CNJ);
idlist = new ArrayList<>();
asyncMethod.sendData2(client, xml);
cacdatalist = new ArrayList<>();
}
} catch (Exception e) {
@ -236,6 +239,7 @@ public class XydlI2ServiceImpl implements XydlI2Service {
}
}
}
asyncMethod.updateRecordId(maxid,Constant.CNJID);
} else {
log.info("没有查询cnj的数据量");
}
@ -243,20 +247,32 @@ public class XydlI2ServiceImpl implements XydlI2Service {
@Override
public void upload_dcyw(Client client, HashMap<Integer, Niec_Sensors> equipMap) {
List<Data_Dcyw> list = data_dcywDao.selectUpload(CommonStatus.UNUPLOAD.value());
Upload_check upload_check = upload_checkDao.selectByPrimaryKey(Constant.DCYWID);
BigInteger value = null;
if (upload_check == null) {
value = BigInteger.valueOf(0);
}else {
value = upload_check.getValue();
if (value == null) {
value = BigInteger.valueOf(0);
}
}
List<Data_Dcyw> list = data_dcywDao.selectUploadById(value);
if (CollectionUtil.isNotEmpty(list)) {
log.info("查询dcyw的数据量" + list.size());
ArrayList<String> cacdatalist = new ArrayList<>();
ArrayList<BigInteger> idlist = new ArrayList<>();
BigInteger maxid = null;
for (int index = 0; index < list.size(); index++) {
Data_Dcyw item = list.get(index);
maxid = item.getId();
Niec_Sensors sensors = equipMap.get(item.getEqmid());
if (sensors == null) {
continue;
}
String sensorid = sensors.getSensorCode();
String equipmentid = sensors.getEquipmentId();
String phase = sensors.getPhase();
if (StrUtil.isNotEmpty(sensorid) && StrUtil.isNotEmpty(equipmentid)) {
ArrayList<AttrBean> attrlist = new ArrayList<>();
try {
String timestamp = "";
@ -279,13 +295,9 @@ public class XydlI2ServiceImpl implements XydlI2Service {
}
String cacdata = GenerateI2Xml.generateCacXml(Constant.DCYW, sensorid, equipmentid, timestamp, attrlist);
cacdatalist.add(cacdata);
idlist.add(item.getId());
if ((index != 0 && index % 79 == 0) || index == (list.size() - 1)) {
ArrayList<BigInteger> list1 = new ArrayList<>();
if ((index != 0 && index % sendlimit == 0) || index == (list.size() - 1)) {
String xml = GenerateI2Xml.generateEndCacXml(cacdatalist);
list1.addAll(idlist);
asyncMethod.sendData(client, list1, xml, Constant.DCYW);
idlist = new ArrayList<>();
asyncMethod.sendData2(client, xml);
cacdatalist = new ArrayList<>();
}
} catch (Exception e) {
@ -293,6 +305,7 @@ public class XydlI2ServiceImpl implements XydlI2Service {
}
}
}
asyncMethod.updateRecordId(maxid,Constant.DCYWID);
} else {
log.info("没有查询dcyw的数据量");
}
@ -300,17 +313,24 @@ public class XydlI2ServiceImpl implements XydlI2Service {
@Override
public void upload_dlq_jbfd(Client client, HashMap<Integer, Niec_Sensors> equipMap) {
List<Data_Dlq_Jbfd> list = data_dlq_jbfdDao.selectUpload(CommonStatus.UNUPLOAD.value());
Upload_check upload_check = upload_checkDao.selectByPrimaryKey(Constant.DLQJBFDID);
BigInteger value = null;
if (upload_check == null) {
value = BigInteger.valueOf(0);
}else {
value = upload_check.getValue();
if (value == null) {
value = BigInteger.valueOf(0);
}
}
List<Data_Dlq_Jbfd> list = data_dlq_jbfdDao.selectUploadById(value);
if (CollectionUtil.isNotEmpty(list)) {
log.info("查询dlq_jbfd的数据量" + list.size());
ArrayList<String> cacdatalist = new ArrayList<>();
ArrayList<BigInteger> idlist = new ArrayList<>();
ArrayList<SendDataBean> list2 = new ArrayList<>();
ArrayList<Integer> eqmidlist = new ArrayList<>();
BigInteger maxid = BigInteger.valueOf(0);
BigInteger maxid = null;
for (int index = 0; index < list.size(); index++) {
Data_Dlq_Jbfd item = list.get(index);
maxid = item.getId();
Niec_Sensors sensors = equipMap.get(item.getEqmid());
if (sensors == null) {
continue;
@ -363,27 +383,10 @@ public class XydlI2ServiceImpl implements XydlI2Service {
String cacdata = GenerateI2Xml.generateCacXml(Constant.DLQJBFD, sensorid, equipmentid, timestamp, attrlist);
cacdatalist.add(cacdata);
BigInteger id = item.getId();
idlist.add(id);
SendDataBean sendDataBean = new SendDataBean();
sendDataBean.setEqmid(item.getEqmid());
sendDataBean.setMaxid(id);
list2.add(sendDataBean);
eqmidlist.add(item.getEqmid());
if (id != null) {
int i = id.compareTo(maxid);
if (i == 1) {
maxid = id;
}
}
if ((index != 0 && index % 79 == 0) || index == (list.size() - 1)) {
ArrayList<BigInteger> list1 = new ArrayList<>();
if ((index != 0 && index % sendlimit == 0) || index == (list.size() - 1)) {
String xml = GenerateI2Xml.generateEndCacXml(cacdatalist);
list1.addAll(idlist);
// asyncMethod.sendJBFDData(client, list2, xml, Constant.DLQJBFD);
asyncMethod.sendJBFDData2(client, maxid, eqmidlist, xml, Constant.DLQJBFD);
asyncMethod.sendData2(client,xml);
maxid = BigInteger.valueOf(0);
eqmidlist = new ArrayList<>();
idlist = new ArrayList<>();
cacdatalist = new ArrayList<>();
}
} catch (Exception e) {
@ -391,6 +394,7 @@ public class XydlI2ServiceImpl implements XydlI2Service {
}
}
}
asyncMethod.updateRecordId(maxid,Constant.DLQJBFDID);
} else {
log.info("没有查询到dlq的数据");
}
@ -398,13 +402,24 @@ public class XydlI2ServiceImpl implements XydlI2Service {
@Override
public void upload_dr_jyjc(Client client, HashMap<Integer, Niec_Sensors> equipMap) {
List<Data_Dr_Jyjc> list = data_dr_jyjcDao.selectUpload(CommonStatus.UNUPLOAD.value());
Upload_check upload_check = upload_checkDao.selectByPrimaryKey(Constant.DRJYJCID);
BigInteger value = null;
if (upload_check == null) {
value = BigInteger.valueOf(0);
}else {
value = upload_check.getValue();
if (value == null) {
value = BigInteger.valueOf(0);
}
}
List<Data_Dr_Jyjc> list = data_dr_jyjcDao.selectUploadById(value);
if (CollectionUtil.isNotEmpty(list)) {
log.info("查询dr_jyjc的数据量" + list.size());
ArrayList<String> cacdatalist = new ArrayList<>();
ArrayList<BigInteger> idlist = new ArrayList<>();
BigInteger maxid = null;
for (int index = 0; index < list.size(); index++) {
Data_Dr_Jyjc item = list.get(index);
maxid = item.getId();
Niec_Sensors sensors = equipMap.get(item.getEqmid());
if (sensors == null) {
continue;
@ -470,13 +485,10 @@ public class XydlI2ServiceImpl implements XydlI2Service {
}
String cacdata = GenerateI2Xml.generateCacXml(Constant.DRJYJC, sensorid, equipmentid, timestamp, attrlist);
cacdatalist.add(cacdata);
idlist.add(item.getId());
if ((index != 0 && index % 79 == 0) || index == (list.size() - 1)) {
if ((index != 0 && index % sendlimit == 0) || index == (list.size() - 1)) {
ArrayList<BigInteger> list1 = new ArrayList<>();
String xml = GenerateI2Xml.generateEndCacXml(cacdatalist);
list1.addAll(idlist);
asyncMethod.sendData(client, list1, xml, Constant.DRJYJC);
idlist = new ArrayList<>();
asyncMethod.sendData2(client, xml);
cacdatalist = new ArrayList<>();
}
} catch (Exception e) {
@ -484,6 +496,7 @@ public class XydlI2ServiceImpl implements XydlI2Service {
}
}
}
asyncMethod.updateRecordId(maxid,Constant.DRJYJCID);
} else {
log.info("没有查询dr_jyjc的数据量");
}
@ -491,13 +504,24 @@ public class XydlI2ServiceImpl implements XydlI2Service {
@Override
public void upload_fhdlbx(Client client, HashMap<Integer, Niec_Sensors> equipMap) {
List<Data_Fhdlbx> list = data_fhdlbxDao.selectUpload(CommonStatus.UNUPLOAD.value());
Upload_check upload_check = upload_checkDao.selectByPrimaryKey(Constant.FHDLBXID);
BigInteger value = null;
if (upload_check == null) {
value = BigInteger.valueOf(0);
}else {
value = upload_check.getValue();
if (value == null) {
value = BigInteger.valueOf(0);
}
}
List<Data_Fhdlbx> list = data_fhdlbxDao.selectUploadById(value);
if (CollectionUtil.isNotEmpty(list)) {
log.info("查询fhdlbx的数据量" + list.size());
ArrayList<String> cacdatalist = new ArrayList<>();
ArrayList<BigInteger> idlist = new ArrayList<>();
BigInteger maxid = null;
for (int index = 0; index < list.size(); index++) {
Data_Fhdlbx item = list.get(index);
maxid = item.getId();
Niec_Sensors sensors = equipMap.get(item.getEqmid());
if (sensors == null) {
continue;
@ -535,13 +559,9 @@ public class XydlI2ServiceImpl implements XydlI2Service {
}
String cacdata = GenerateI2Xml.generateCacXml(Constant.FHDLBX, sensorid, equipmentid, timestamp, attrlist);
cacdatalist.add(cacdata);
idlist.add(item.getId());
if ((index != 0 && index % 79 == 0) || index == (list.size() - 1)) {
ArrayList<BigInteger> list1 = new ArrayList<>();
if ((index != 0 && index % sendlimit == 0) || index == (list.size() - 1)) {
String xml = GenerateI2Xml.generateEndCacXml(cacdatalist);
list1.addAll(idlist);
asyncMethod.sendData(client, list1, xml, Constant.FHDLBX);
idlist = new ArrayList<>();
asyncMethod.sendData2(client,xml);
cacdatalist = new ArrayList<>();
}
} catch (Exception e) {
@ -549,6 +569,7 @@ public class XydlI2ServiceImpl implements XydlI2Service {
}
}
}
asyncMethod.updateRecordId(maxid,Constant.FHDLBXID);
} else {
log.info("没有查询fhdlbx的数据量");
}
@ -556,13 +577,24 @@ public class XydlI2ServiceImpl implements XydlI2Service {
@Override
public void upload_fhzxq(Client client, HashMap<Integer, Niec_Sensors> equipMap) {
Upload_check upload_check = upload_checkDao.selectByPrimaryKey(Constant.FHZXQID);
BigInteger value = null;
if (upload_check == null) {
value = BigInteger.valueOf(0);
}else {
value = upload_check.getValue();
if (value == null) {
value = BigInteger.valueOf(0);
}
}
List<Data_Fhzxq> list = data_fhzxqDao.selectUpload(CommonStatus.UNUPLOAD.value());
if (CollectionUtil.isNotEmpty(list)) {
log.info("查询fhzxq的数据量" + list.size());
ArrayList<BigInteger> idlist = new ArrayList<>();
ArrayList<String> cacdatalist = new ArrayList<>();
BigInteger maxid = null;
for (int index = 0; index < list.size(); index++) {
Data_Fhzxq item = list.get(index);
maxid = item.getId();
Niec_Sensors sensors = equipMap.get(item.getEqmid());
if (sensors == null) {
continue;
@ -600,13 +632,9 @@ public class XydlI2ServiceImpl implements XydlI2Service {
}
String cacdata = GenerateI2Xml.generateCacXml(Constant.FHZXQ, sensorid, equipmentid, timestamp, attrlist);
cacdatalist.add(cacdata);
idlist.add(item.getId());
if ((index != 0 && index % 79 == 0) || index == (list.size() - 1)) {
ArrayList<BigInteger> list1 = new ArrayList<>();
if ((index != 0 && index % sendlimit == 0) || index == (list.size() - 1)) {
String xml = GenerateI2Xml.generateEndCacXml(cacdatalist);
list1.addAll(idlist);
asyncMethod.sendData(client, list1, xml, Constant.FHZXQ);
idlist = new ArrayList<>();
asyncMethod.sendData2(client, xml);
cacdatalist = new ArrayList<>();
}
} catch (Exception e) {
@ -614,6 +642,7 @@ public class XydlI2ServiceImpl implements XydlI2Service {
}
}
}
asyncMethod.updateRecordId(maxid,Constant.FHZXQID);
} else {
log.info("没有查询fhzxq的数据量");
}
@ -621,13 +650,24 @@ public class XydlI2ServiceImpl implements XydlI2Service {
@Override
public void upload_jsyhw_jyjc(Client client, HashMap<Integer, Niec_Sensors> equipMap) {
List<Data_Jsyhw_Jyjc> list = data_jsyhw_jyjcDao.selectUpload(CommonStatus.UNUPLOAD.value());
Upload_check upload_check = upload_checkDao.selectByPrimaryKey(Constant.JSYHWJYJCID);
BigInteger value = null;
if (upload_check == null) {
value = BigInteger.valueOf(0);
}else {
value = upload_check.getValue();
if (value == null) {
value = BigInteger.valueOf(0);
}
}
List<Data_Jsyhw_Jyjc> list = data_jsyhw_jyjcDao.selectUploadById(value);
if (CollectionUtil.isNotEmpty(list)) {
log.info("查询jsyhw_jyjc的数据量" + list.size());
ArrayList<String> cacdatalist = new ArrayList<>();
ArrayList<BigInteger> idlist = new ArrayList<>();
BigInteger maxid = null;
for (int index = 0; index < list.size(); index++) {
Data_Jsyhw_Jyjc item = list.get(index);
maxid = item.getId();
Niec_Sensors sensors = equipMap.get(item.getEqmid());
if (sensors == null) {
continue;
@ -686,13 +726,9 @@ public class XydlI2ServiceImpl implements XydlI2Service {
}
String cacdata = GenerateI2Xml.generateCacXml(Constant.JSYHW, sensorid, equipmentid, timestamp, attrlist);
cacdatalist.add(cacdata);
idlist.add(item.getId());
if ((index != 0 && index % 79 == 0) || index == (list.size() - 1)) {
ArrayList<BigInteger> list1 = new ArrayList<>();
if ((index != 0 && index % sendlimit == 0) || index == (list.size() - 1)) {
String xml = GenerateI2Xml.generateEndCacXml(cacdatalist);
list1.addAll(idlist);
asyncMethod.sendData(client, list1, xml, Constant.JSYHW);
idlist = new ArrayList<>();
asyncMethod.sendData2(client, xml);
cacdatalist = new ArrayList<>();
}
} catch (Exception e) {
@ -700,6 +736,7 @@ public class XydlI2ServiceImpl implements XydlI2Service {
}
}
}
asyncMethod.updateRecordId(maxid,Constant.JSYHWJYJCID);
} else {
log.info("没有查询jsyhw_jyjc的数据量");
}
@ -707,13 +744,24 @@ public class XydlI2ServiceImpl implements XydlI2Service {
@Override
public void upload_sf6_qtsf(Client client, HashMap<Integer, Niec_Sensors> equipMap) {
List<Data_SF6_Qtsf> list = data_sf6_qtsfDao.selectUpload(CommonStatus.UNUPLOAD.value());
Upload_check upload_check = upload_checkDao.selectByPrimaryKey(Constant.SF6QTSFID);
BigInteger value = null;
if (upload_check == null) {
value = BigInteger.valueOf(0);
}else {
value = upload_check.getValue();
if (value == null) {
value = BigInteger.valueOf(0);
}
}
List<Data_SF6_Qtsf> list = data_sf6_qtsfDao.selectUploadById(value);
if (CollectionUtil.isNotEmpty(list)) {
log.info("查询sf6_qtsf的数据量" + list.size());
ArrayList<String> cacdatalist = new ArrayList<>();
ArrayList<BigInteger> idlist = new ArrayList<>();
BigInteger maxid = null;
for (int index = 0; index < list.size(); index++) {
Data_SF6_Qtsf item = list.get(index);
maxid = item.getId();
Niec_Sensors sensors = equipMap.get(item.getEqmid());
if (sensors == null) {
continue;
@ -751,13 +799,9 @@ public class XydlI2ServiceImpl implements XydlI2Service {
}
String cacdata = GenerateI2Xml.generateCacXml(Constant.SF6_QTSF, sensorid, equipmentid, timestamp, attrlist);
cacdatalist.add(cacdata);
idlist.add(item.getId());
if ((index != 0 && index % 79 == 0) || index == (list.size() - 1)) {
ArrayList<BigInteger> list1 = new ArrayList<>();
if ((index != 0 && index % sendlimit == 0) || index == (list.size() - 1)) {
String xml = GenerateI2Xml.generateEndCacXml(cacdatalist);
list1.addAll(idlist);
asyncMethod.sendData(client, list1, xml, Constant.SF6_QTSF);
idlist = new ArrayList<>();
asyncMethod.sendData2(client, xml);
cacdatalist = new ArrayList<>();
}
} catch (Exception e) {
@ -765,6 +809,7 @@ public class XydlI2ServiceImpl implements XydlI2Service {
}
}
}
asyncMethod.updateRecordId(maxid,Constant.SF6QTSFID);
} else {
log.info("没有查询sf6_qtsf的数据量");
}
@ -772,13 +817,30 @@ public class XydlI2ServiceImpl implements XydlI2Service {
@Override
public void upload_sf6_qtyl(Client client, HashMap<Integer, Niec_Sensors> equipMap) {
List<Data_SF6_Qtyl> list = data_sf6_qtylDao.selectUpload(CommonStatus.UNUPLOAD.value());
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);
}
}
List<Data_SF6_Qtyl> list = data_sf6_qtylDao.selectUploadById(value);
if (list.size()<1000) {
iscontiue = false;
}
if (CollectionUtil.isNotEmpty(list)) {
log.info("查询sf6_qtyl的数据量" + list.size());
ArrayList<String> cacdatalist = new ArrayList<>();
ArrayList<BigInteger> idlist = new ArrayList<>();
BigInteger maxid = null;
for (int index = 0; index < list.size(); index++) {
Data_SF6_Qtyl item = list.get(index);
maxid = item.getId();
Niec_Sensors sensors = equipMap.get(item.getEqmid());
if (sensors == null) {
continue;
@ -830,13 +892,10 @@ public class XydlI2ServiceImpl implements XydlI2Service {
}
String cacdata = GenerateI2Xml.generateCacXml(Constant.SF6_QTYL, sensorid, equipmentid, timestamp, attrlist);
cacdatalist.add(cacdata);
idlist.add(item.getId());
if ((index != 0 && index % 79 == 0) || index == (list.size() - 1)) {
ArrayList<BigInteger> list1 = new ArrayList<>();
if ((index != 0 && index % sendlimit == 0) || index == (list.size() - 1)) {
log.info("开始传输");
String xml = GenerateI2Xml.generateEndCacXml(cacdatalist);
list1.addAll(idlist);
asyncMethod.sendData(client, list1, xml, Constant.SF6_QTYL);
idlist = new ArrayList<>();
asyncMethod.sendData2(client, xml);
cacdatalist = new ArrayList<>();
}
} catch (Exception e) {
@ -844,20 +903,33 @@ public class XydlI2ServiceImpl implements XydlI2Service {
}
}
}
asyncMethod.updateRecordId(maxid, Constant.SF6QTYLID);
} else {
log.info("没有查询到sf6_qtyl的数据");
}
}
}
@Override
public void upload_tx(Client client, HashMap<Integer, Niec_Sensors> equipMap) {
List<Data_Tx> list = data_txDao.selectUpload(CommonStatus.UNUPLOAD.value());
Upload_check upload_check = upload_checkDao.selectByPrimaryKey(Constant.TXID);
BigInteger value = null;
if (upload_check == null) {
value = BigInteger.valueOf(0);
}else {
value = upload_check.getValue();
if (value == null) {
value = BigInteger.valueOf(0);
}
}
List<Data_Tx> list = data_txDao.selectUploadById(value);
if (CollectionUtil.isNotEmpty(list)) {
log.info("查询tx的数据量" + list.size());
ArrayList<String> cacdatalist = new ArrayList<>();
ArrayList<BigInteger> idlist = new ArrayList<>();
BigInteger maxid = null;
for (int index = 0; index < list.size(); index++) {
Data_Tx item = list.get(index);
maxid = item.getId();
Niec_Sensors sensors = equipMap.get(item.getEqmid());
if (sensors == null) {
continue;
@ -888,13 +960,9 @@ public class XydlI2ServiceImpl implements XydlI2Service {
}
String cacdata = GenerateI2Xml.generateCacXml(Constant.TX, sensorid, equipmentid, timestamp, attrlist);
cacdatalist.add(cacdata);
idlist.add(item.getId());
if ((index != 0 && index % 79 == 0) || index == (list.size() - 1)) {
ArrayList<BigInteger> list1 = new ArrayList<>();
if ((index != 0 && index % sendlimit == 0) || index == (list.size() - 1)) {
String xml = GenerateI2Xml.generateEndCacXml(cacdatalist);
list1.addAll(idlist);
asyncMethod.sendData(client, list1, xml, Constant.TX);
idlist = new ArrayList<>();
asyncMethod.sendData2(client, xml);
cacdatalist = new ArrayList<>();
}
} catch (Exception e) {
@ -902,6 +970,7 @@ public class XydlI2ServiceImpl implements XydlI2Service {
}
}
}
asyncMethod.updateRecordId(maxid,Constant.TXID);
} else {
log.info("没有查询到tx的数据");
}
@ -909,13 +978,24 @@ public class XydlI2ServiceImpl implements XydlI2Service {
@Override
public void upload_ws(Client client, HashMap<Integer, Niec_Sensors> equipMap) {
List<Data_Ws> list = data_wsDao.selectUpload(CommonStatus.UNUPLOAD.value());
Upload_check upload_check = upload_checkDao.selectByPrimaryKey(Constant.WSID);
BigInteger value = null;
if (upload_check == null) {
value = BigInteger.valueOf(0);
}else {
value = upload_check.getValue();
if (value == null) {
value = BigInteger.valueOf(0);
}
}
List<Data_Ws> list = data_wsDao.selectUploadById(value);
if (CollectionUtil.isNotEmpty(list)) {
log.info("查询ws的数据量" + list.size());
ArrayList<String> cacdatalist = new ArrayList<>();
ArrayList<BigInteger> idlist = new ArrayList<>();
BigInteger maxid = null;
for (int index = 0; index < list.size(); index++) {
Data_Ws item = list.get(index);
maxid = item.getId();
Niec_Sensors sensors = equipMap.get(item.getEqmid());
if (sensors == null) {
continue;
@ -946,13 +1026,9 @@ public class XydlI2ServiceImpl implements XydlI2Service {
}
String cacdata = GenerateI2Xml.generateCacXml(Constant.WS, sensorid, equipmentid, timestamp, attrlist);
cacdatalist.add(cacdata);
idlist.add(item.getId());
if ((index != 0 && index % 79 == 0) || index == (list.size() - 1)) {
ArrayList<BigInteger> list1 = new ArrayList<>();
if ((index != 0 && index % sendlimit == 0) || index == (list.size() - 1)) {
String xml = GenerateI2Xml.generateEndCacXml(cacdatalist);
list1.addAll(idlist);
asyncMethod.sendData(client, list1, xml, Constant.WS);
idlist = new ArrayList<>();
asyncMethod.sendData2(client, xml);
cacdatalist = new ArrayList<>();
}
} catch (Exception e) {
@ -960,6 +1036,7 @@ public class XydlI2ServiceImpl implements XydlI2Service {
}
}
}
asyncMethod.updateRecordId(maxid,Constant.WSID);
} else {
log.info("没有查询到ws的数据");
}
@ -967,19 +1044,25 @@ public class XydlI2ServiceImpl implements XydlI2Service {
@Override
public void upload_ysp(Client client, HashMap<Integer, Niec_Sensors> equipMap) {
List<Data_Ysp> list = data_yspDao.selectUpload(CommonStatus.UNUPLOAD.value());
if (CollectionUtil.isNotEmpty(list)) {
log.info("查询ysp的数据量" + list.size());
//查询目前上传的油色谱的id 记录油色谱上传的id大小
Upload_check upload_check = upload_checkDao.selectByPrimaryKey(Constant.YSPID);
BigInteger value = null;
if (upload_check == null) {
value = BigInteger.valueOf(0);
}else {
value = upload_check.getValue();
if (value == null) {
value = BigInteger.valueOf(0);
}
}
List<Data_Ysp> dataYspList = data_yspDao.selectUploadById(value);
if (CollectionUtil.isNotEmpty(dataYspList)) {
log.info("查询ysp的数据量" + dataYspList.size());
ArrayList<String> cacdatalist = new ArrayList<>();
ArrayList<BigInteger> idlist = new ArrayList<>();
ArrayList<SendDataBean> list2 = new ArrayList<>();
ArrayList<Integer> eqmidlist = new ArrayList<>();
BigInteger maxid = BigInteger.valueOf(0);
log.info("测试断点1");
for (int index = 0; index < list.size(); index++) {
log.info("测试断点2");
Data_Ysp item = list.get(index);
BigInteger maxid = null;
for (int index = 0; index < dataYspList.size(); index++) {
Data_Ysp item = dataYspList.get(index);
maxid = item.getId();
Niec_Sensors sensors = equipMap.get(item.getEqmid());
if (sensors == null) {
continue;
@ -1073,32 +1156,13 @@ public class XydlI2ServiceImpl implements XydlI2Service {
}
String cacdata = GenerateI2Xml.generateCacXml(Constant.YSP, sensorid, equipmentid, timestamp, attrlist);
cacdatalist.add(cacdata);
BigInteger id = item.getId();
idlist.add(id);
SendDataBean sendDataBean = new SendDataBean();
sendDataBean.setEqmid(item.getEqmid());
sendDataBean.setMaxid(id);
list2.add(sendDataBean);
eqmidlist.add(item.getEqmid());
if (id != null) {
int i = id.compareTo(maxid);
if (i == 1) {
maxid = id;
}
}
log.info("测试断点3");
if ((index != 0 && index % 79 == 0) || index == (list.size() - 1)) {
if ((index != 0 && index % sendlimit == 0) || index == (dataYspList.size() - 1)) {
log.info("测试断点4");
ArrayList<BigInteger> list1 = new ArrayList<>();
String xml = GenerateI2Xml.generateEndCacXml(cacdatalist);
list1.addAll(idlist);
log.info("ysp组装完成开始上传");
// asyncMethod.sendJBFDData(client, list2, xml, Constant.YSP);
asyncMethod.sendJBFDData2(client, maxid, eqmidlist, xml, Constant.YSP);
maxid = BigInteger.valueOf(0);
eqmidlist = new ArrayList<>();
idlist = new ArrayList<>();
asyncMethod.sendData2(client, xml);
cacdatalist = new ArrayList<>();
}
} catch (Exception e) {
@ -1106,20 +1170,33 @@ public class XydlI2ServiceImpl implements XydlI2Service {
}
}
}
asyncMethod.updateRecordId(maxid,Constant.YSPID);
} else {
log.info("没有查询到ysp的数据");
}
}
@Override
public void upload_microclimate(Client client, HashMap<Integer, Niec_Sensors> equipMap) {
List<Data_Microclimate> list = data_microclimateDao.selectUpload(CommonStatus.UNUPLOAD.value());
Upload_check upload_check = upload_checkDao.selectByPrimaryKey(Constant.MICROCLIMATEID);
BigInteger value = null;
if (upload_check == null) {
value = BigInteger.valueOf(0);
}else {
value = upload_check.getValue();
if (value == null) {
value = BigInteger.valueOf(0);
}
}
List<Data_Microclimate> list = data_microclimateDao.selectUploadById(value);
if (CollectionUtil.isNotEmpty(list)) {
log.info("查询microclimate的数据量" + list.size());
ArrayList<String> cacdatalist = new ArrayList<>();
ArrayList<BigInteger> idlist = new ArrayList<>();
BigInteger maxid = null;
for (int index = 0; index < list.size(); index++) {
Data_Microclimate item = list.get(index);
maxid = item.getId();
Niec_Sensors sensors = equipMap.get(item.getEqmid());
if (sensors == null) {
continue;
@ -1185,13 +1262,9 @@ public class XydlI2ServiceImpl implements XydlI2Service {
}
String cacdata = GenerateI2Xml.generateCacXml(Constant.WQX, sensorid, equipmentid, timestamp, attrlist);
cacdatalist.add(cacdata);
idlist.add(item.getId());
if ((index != 0 && index % 79 == 0) || index == (list.size() - 1)) {
ArrayList<BigInteger> list1 = new ArrayList<>();
if ((index != 0 && index % sendlimit == 0) || index == (list.size() - 1)) {
String xml = GenerateI2Xml.generateEndCacXml(cacdatalist);
list1.addAll(idlist);
asyncMethod.sendData(client, list1, xml, Constant.WQX);
idlist = new ArrayList<>();
asyncMethod.sendData2(client, xml);
cacdatalist = new ArrayList<>();
}
} catch (Exception e) {
@ -1199,6 +1272,7 @@ public class XydlI2ServiceImpl implements XydlI2Service {
}
}
}
asyncMethod.updateRecordId(maxid,Constant.MICROCLIMATEID);
} else {
log.info("没有查询到microcimate的数据");
}
@ -1206,14 +1280,28 @@ public class XydlI2ServiceImpl implements XydlI2Service {
@Override
public void upload_yx(Client client) {
Boolean iscontiue = true;
while (iscontiue) {
Upload_check upload_check = upload_checkDao.selectByPrimaryKey(Constant.YXID);
BigInteger value = upload_check.getValue();
BigInteger value = null;
if (upload_check == null) {
value = BigInteger.valueOf(0);
} else {
value = upload_check.getValue();
if (value == null) {
value = BigInteger.valueOf(0);
}
}
List<Data_YxlDto> list = data_yxDao.selectByPrimaryKey(value);
if (list.size()<1000) {
iscontiue = false;
}
if (CollectionUtil.isNotEmpty(list)) {
log.info("查询microclimate的数据量" + list.size());
log.info("查询yx的数据量" + list.size());
BigInteger maxid =null;
for (int index = 0; index < list.size(); index++) {
Data_YxlDto data_yxlDto = list.get(index);
Date dtime = data_yxlDto.getDtime();
@ -1224,7 +1312,7 @@ public class XydlI2ServiceImpl implements XydlI2Service {
Integer ival = data_yxlDto.getIval();
Integer sadr = data_yxlDto.getSadr();
String phase = data_yxlDto.getPhase();
BigInteger id = data_yxlDto.getId();
maxid = data_yxlDto.getId();
YxAttrBean<Integer> attr = new YxAttrBean<>();
attr.setSensorid(sensorid);
@ -1268,23 +1356,18 @@ public class XydlI2ServiceImpl implements XydlI2Service {
attr.setDevicetype(Constant.YSP);
}
try {
BigInteger maxid = BigInteger.valueOf(0);
String xml = GenerateI2Xml.generateYxCacXml(attr);
if (xml != null && !xml.equals("")) {
if (index == (list.size() - 1)) {
maxid = id;
asyncMethod.sendYxData(client, maxid, xml);
} else {
asyncMethod.sendYxData(client, maxid, xml);
}
asyncMethod.sendData2(client, xml);
}
} catch (Exception e) {
e.printStackTrace();
}
}
asyncMethod.updateRecordId(maxid,Constant.YXID);
}
}
}
@Override

@ -20,54 +20,62 @@ import org.springframework.stereotype.Component;
@EnableAsync
public class ScheduledTask {
@Autowired
Webservcies webservcies;
@Autowired
XydlI2Service xydlI2Service;
@Async(value = "asyncServiceExecutor")
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++) );
webservcies.uploadyspData();
}
@Async(value = "asyncServiceExecutor")
@Scheduled(fixedDelay = 10 * 60 * 1000)
@Scheduled(fixedDelay = 1 * 60 * 1000)
public void cacjfjcupload() {
log.error("cacjfjcupload执行" + (i2++) );
webservcies.uploadjfjcData();
}
// @Scheduled(cron = "0 0/1 * * * ?")
@Scheduled(fixedDelay = 5 * 30 * 1000)
@Scheduled(fixedDelay = 1 * 30 * 1000)
public void cacupload() {
log.error("cacupload执行" + (i3++) );
webservcies.uploadData();
}
@Scheduled(cron = "0 0 13 * * ?")
public void clear() {
xydlI2Service.clear_history();
@Scheduled(fixedDelay = 1 * 30 * 1000)
public void cacyxupload() {
log.error("cacyxupload执行" + (i4++) );
webservcies.uploadyxData();
}
// @Scheduled(cron = "0 0/1 * * * ?")
// @Scheduled(fixedDelay = 5 * 30 * 1000)
// public void cacyxupload() {
// webservcies.uploadYxData();
// String str = "aaaa";
// webservcies.test(str);
// }
//
// @Scheduled(cron = "0 * * * * ?")
// @Async(value = "asyncServiceExecutor")
@Scheduled(fixedDelay = 1 * 30 * 1000)
public void cacdcywupload() {
log.error("cacdcywupload执行" + (i5++) );
webservcies.uploaddcywData();
}
@Scheduled(fixedDelay = 1 * 30 * 1000)
public void cacjsyhwjyjcupload() {
log.error("cacjsyhwjyjcupload执行" + (i6++) );
webservcies.uploadjsyhwjyjcData();
}
// @Async(value = "asyncServiceExecutor")
// @Scheduled(fixedDelay = 10 * 60 * 1000)
// public void cacjfjcupload() {
// webservcies.uploadjfjcData();
// @Scheduled(cron = "0 0 13 * * ?")
// public void clear() {
// xydlI2Service.clear_history();
// }
}

@ -6,31 +6,21 @@ spring:
username: root
password: 123456
type: com.alibaba.druid.pool.DruidDataSource
task:
scheduling:
pool:
size: 8
# 开发环境配置
server:
# 服务器的HTTP端口默认为8080
port: 8094
servlet:
# 应用的访问路径
context-path: /api
tomcat:
# tomcat的URI编码
uri-encoding: UTF-8
# 连接数满后的排队数默认为100
accept-count: 1000
max-swallow-size: -1 # tomcat默认大小2M超过2M的文件不会被捕获需要调整此处大小为100MB或者-1即可
threads:
# tomcat最大线程数默认为200
max: 800
# Tomcat启动初始化的线程数默认值10
min-spare: 100
# 日志配置
logging:
config: classpath:log4j2.xml
level:
com.shxy: trace
com.shxy: info
org.springframework: warn
# MyBatis配置
@ -41,3 +31,11 @@ mybatis:
mapper-locations: classpath*:mappers/**/*Dao.xml
# 加载全局的配置文件
configLocation: classpath:mybatis/mybatis-config.xml
# webservice
webservice:
# 超高压中心地址
address: http://10.238.71.98:18096/ppa/webservice/CAGAccessService?wsdl
connecttime: 30
receivetime: 30
sendlimit: 100

@ -18,12 +18,15 @@
create_time, update_time
</sql>
<select id="selectUpload" resultMap="BaseResultMap">
<!-- select-->
<!-- <include refid="Base_Column_List"/>-->
<!-- from data_byq_jbfd-->
<!-- where isupload is null or isupload = #{isupload}-->
<select id="selectUploadById" resultMap="BaseResultMap">
SELECT
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}
</select>
<select id="selectUpload" resultMap="BaseResultMap">
SELECT
t1.id, t1.eqmid, t1.acquisitionTime, t1.dischargeCapacity, t1.dischargePosition, t1.pulseCount, t1.isupload,
t1.dischargeWaveform,

@ -13,6 +13,14 @@
<sql id="Base_Column_List">
id, eqmid, acquisitionTime, chargeTime, isupload, create_time, update_time
</sql>
<select id="selectUploadById" resultMap="BaseResultMap">
select
<include refid="Base_Column_List"/>
from data_cnj
where id <![CDATA[>]]> #{maxid}
</select>
<select id="selectUpload" resultMap="BaseResultMap">
select
<include refid="Base_Column_List"/>

@ -13,6 +13,14 @@
<sql id="Base_Column_List">
id, eqmid, acquisitionTime, oilTemperature, isupload, create_time, update_time
</sql>
<select id="selectUploadById" resultMap="BaseResultMap">
select
<include refid="Base_Column_List"/>
from data_dcyw
where id <![CDATA[>]]> #{maxid}
</select>
<select id="selectUpload" resultMap="BaseResultMap">
select
<include refid="Base_Column_List"/>
@ -63,4 +71,5 @@
where acquisitionTime <![CDATA[<]]> #{time}
</delete>
</mapper>

@ -14,16 +14,22 @@
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime"/>
<result column="dischargeWaveform" jdbcType="LONGVARBINARY" property="dischargewaveform"/>
</resultMap>
<sql id="Base_Column_List">
id, eqmid, acquisitionTime, phase, dischargeCapacity, dischargePosition, pulseCount, dischargeWaveform,
isupload, create_time, update_time
</sql>
<select id="selectUpload" resultMap="BaseResultMap">
<!-- select-->
<!-- <include refid="Base_Column_List"/>-->
<!-- from data_dlq_jbfd-->
<!-- where isupload is null or isupload = #{isupload}-->
<select id="selectUploadById" resultMap="BaseResultMap">
SELECT
t1.id, t1.eqmid, t1.acquisitionTime,t1.phase, t1.dischargeCapacity, t1.dischargePosition, t1.pulseCount,
t1.isupload,t1.dischargeWaveform,t1.create_time, t1.update_time
FROM
data_dlq_jbfd t1
where t1.id <![CDATA[>]]> #{maxid}
</select>
<select id="selectUpload" resultMap="BaseResultMap">
SELECT
t1.id, t1.eqmid, t1.acquisitionTime,t1.phase, t1.dischargeCapacity, t1.dischargePosition, t1.pulseCount,
t1.isupload,

@ -19,6 +19,14 @@
id, eqmid, acquisitionTime, capacitance, lossFactor, unbalanceCurrent, unbalanceVoltage,
totalCurrent, systemVoltage, isupload, create_time, update_time
</sql>
<select id="selectUploadById" resultMap="BaseResultMap">
select
<include refid="Base_Column_List"/>
from data_dr_jyjc
where id <![CDATA[>]]> #{maxid}
</select>
<select id="selectUpload" resultMap="BaseResultMap">
select
<include refid="Base_Column_List"/>

@ -14,12 +14,21 @@
<sql id="Base_Column_List">
id, eqmid, acquisitionTime, action, isupload, loadWaveform, create_time, update_time
</sql>
<select id="selectUploadById" resultMap="BaseResultMap">
select
<include refid="Base_Column_List"/>
from data_fhdlbx
where id <![CDATA[>]]> #{maxid}
</select>
<select id="selectUpload" resultMap="BaseResultMap">
select
<include refid="Base_Column_List"/>
from data_fhdlbx
where isupload is null or isupload = #{isupload}
</select>
<update id="updateByPrimaryKey" parameterType="com.shxy.i2.entity.Data_Fhdlbx">
update data_fhdlbx
<set>

@ -19,6 +19,13 @@
lastActionTime, isupload, create_time, update_time
</sql>
<select id="selectUploadById" resultMap="BaseResultMap">
select
<include refid="Base_Column_List"/>
from data_jsyhw_jyjc
where id <![CDATA[>]]> #{maxid}
</select>
<select id="selectUpload" resultMap="BaseResultMap">
select
<include refid="Base_Column_List"/>

@ -22,6 +22,13 @@
wddir, precipitationIntensity, radiationIntensity, isupload, create_time, update_time
</sql>
<select id="selectUploadById" resultMap="BaseResultMap">
select
<include refid="Base_Column_List"/>
from data_microclimate
where id <![CDATA[>]]> #{maxid}
</select>
<select id="selectUpload" resultMap="BaseResultMap">
select
<include refid="Base_Column_List"/>

@ -15,6 +15,13 @@
id, eqmid, acquisitionTime, temperature, moisture, isupload, create_time, update_time
</sql>
<select id="selectUploadById" resultMap="BaseResultMap">
select
<include refid="Base_Column_List"/>
from data_sf6_qtsf
where id <![CDATA[>]]> #{maxid}
</select>
<select id="selectUpload" resultMap="BaseResultMap">
select
<include refid="Base_Column_List"/>

@ -32,6 +32,13 @@
id, eqmid, acquisitionTime, temperature, absolutePressure, density, pressure20C,
isupload, create_time, update_time
</sql>
<select id="selectUploadById" resultMap="BaseResultMap">
select
<include refid="Base_Column_List"/>
from data_sf6_qtyl
where id <![CDATA[>]]> #{maxid} limit 1000
</select>
<select id="selectUpload" resultMap="BaseResultMap">
select
<include refid="Base_Column_List"/>

@ -13,6 +13,13 @@
<sql id="Base_Column_List">
id, eqmid, acquisitionTime, totalCoreCurrent, isupload, create_time, update_time
</sql>
<select id="selectUploadById" resultMap="BaseResultMap">
select
<include refid="Base_Column_List"/>
from data_tx
where id <![CDATA[>]]> #{maxid}
</select>
<select id="selectUpload" resultMap="BaseResultMap">
select
<include refid="Base_Column_List"/>

@ -13,6 +13,13 @@
<sql id="Base_Column_List">
id, eqmid, acquisitionTime, moisture, isupload, create_time, update_time
</sql>
<select id="selectUploadById" resultMap="BaseResultMap">
select
<include refid="Base_Column_List"/>
from data_ws
where id <![CDATA[>]]> #{maxid}
</select>
<select id="selectUpload" resultMap="BaseResultMap">
select
<include refid="Base_Column_List"/>

@ -23,6 +23,16 @@
id, eqmid, acquisitionTime, H2, CH4, C2H6, C2H4, C2H2, CO, CO2, O2, N2, TotalHydrocarbon,
isupload, create_time, update_time
</sql>
<!--//每组只查最大的-->
<select id="selectUploadById" resultMap="BaseResultMap">
SELECT
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}
</select>
<select id="selectUpload" resultMap="BaseResultMap">
<!-- select-->
<!-- <include refid="Base_Column_List"/>-->

@ -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 <![CDATA[>]]> #{maxid}
where a.id <![CDATA[>]]> #{maxid} limit 1000
</select>
<delete id="deleteData" >

@ -14,12 +14,21 @@
<sql id="Base_Column_List">
id, eqmid, acquisitionTime, action, isupload,coilWaveform, create_time, update_time
</sql>
<select id="selectUploadById" resultMap="BaseResultMap">
select
<include refid="Base_Column_List"/>
from data_fhzxq
where id <![CDATA[>]]> #{maxid}
</select>
<select id="selectUpload" resultMap="BaseResultMap">
select
<include refid="Base_Column_List"/>
from data_fhzxq
where isupload is null or isupload = #{isupload}
</select>
<update id="updateByPrimaryKey" parameterType="com.shxy.i2.entity.Data_Fhzxq">
update data_fhzxq
<set>

@ -1,13 +1,16 @@
//package com.shxy.i2;
//
//import cn.hutool.core.util.XmlUtil;
//import cn.hutool.json.JSONObject;
//import cn.hutool.json.XML;
//
//import java.util.Map;
//
//public class test {
// public static void main(String[] args){
package com.shxy.i2;
import cn.hutool.core.date.DateTime;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.XmlUtil;
import cn.hutool.json.JSONObject;
import cn.hutool.json.XML;
import java.util.Date;
import java.util.Map;
public class test {
public static void main(String[] args){
// JSONObject jsonObject = XML.toJSONObject("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" +
// "<response>\n" +
// "<result code=\"0\" />\n" +
@ -27,5 +30,8 @@
// JSONObject result = (JSONObject) response.get("result");
// Integer code = (Integer) result.get("code");
// System.out.println(jsonObject.toString());
// }
//}
DateTime dateTime = DateUtil.offsetDay(new Date(), -7);
System.out.println(dateTime);
}
}

Loading…
Cancel
Save