I2代码优化ceshi

master
liuguijing 1 year ago
parent 4a2096b570
commit 82f307293f

@ -11,6 +11,7 @@ import lombok.extern.slf4j.Slf4j;
import org.apache.cxf.endpoint.Client;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Async;
import org.springframework.scheduling.annotation.EnableAsync;
import org.springframework.stereotype.Component;
import java.math.BigInteger;
@ -20,6 +21,7 @@ import java.util.List;
@Slf4j
@Component
@EnableAsync
public class AsyncMethod {
@Autowired
private Data_Dlq_JbfdDao data_dlq_jbfdDao;
@ -164,7 +166,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();

@ -20,6 +20,7 @@ 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.scheduling.annotation.EnableAsync;
import org.springframework.stereotype.Service;
import java.math.BigDecimal;
@ -31,6 +32,7 @@ import java.util.List;
@Service
@Slf4j
@EnableAsync
public class XydlI2ServiceImpl implements XydlI2Service {
@Autowired
@ -88,7 +90,7 @@ public class XydlI2ServiceImpl implements XydlI2Service {
// @Value("${webservice.sendlimit}")
// public int sendlimit;
public static int sendlimit = 500;
public static int sendlimit = 1000;
@Override
public void upload_byq_jbfd(Client client, HashMap<Integer, Niec_Sensors> equipMap) {
@ -558,7 +560,6 @@ public class XydlI2ServiceImpl implements XydlI2Service {
String cacdata = GenerateI2Xml.generateCacXml(Constant.DRJYJC, sensorid, equipmentid, timestamp, attrlist);
cacdatalist.add(cacdata);
if ((index != 0 && index % sendlimit == 0) || index == (list.size() - 1)) {
ArrayList<BigInteger> list1 = new ArrayList<>();
String xml = GenerateI2Xml.generateEndCacXml(cacdatalist);
asyncMethod.sendData2(client, xml);
cacdatalist = new ArrayList<>();
@ -1499,7 +1500,6 @@ public class XydlI2ServiceImpl implements XydlI2Service {
maxid = ids;
}
}
YxAttrBean<Integer> attr = new YxAttrBean<>();
attr.setSensorid(sensorid);
attr.setEquipmentid(equipmentid);

@ -17,7 +17,7 @@ import org.springframework.stereotype.Component;
@Component
@EnableScheduling
@Slf4j
@EnableAsync
//@EnableAsync
public class ScheduledTask {
@Autowired
@ -33,7 +33,7 @@ public class ScheduledTask {
webservcies.uploadyspData();
}
@Scheduled(fixedDelay = 10 * 60 * 1000)
@Scheduled(fixedDelay = 5 * 60 * 1000)
public void cacjfjcupload() {
log.info("cacjfjcupload执行" );
webservcies.uploadjfjcData();

@ -22,30 +22,19 @@ spring:
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:
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
# 初始连接数
initialSize: 20
initialSize: 10
# 最小连接池数量
minIdle: 20
# 最大连接池数量
maxActive: 40
maxActive: 50
# 配置获取连接等待超时的时间
maxWait: 60000
# 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒
timeBetweenEvictionRunsMillis: 60000
timeBetweenEvictionRunsMillis: 30000
# 配置一个连接在池中最小生存的时间,单位是毫秒
minEvictableIdleTimeMillis: 300000
# 配置一个连接在池中最大生存的时间,单位是毫秒

Loading…
Cancel
Save