Browse Source

优化采集结构

prod_202403
mh 1 year ago
parent
commit
19dbbb5c81
  1. 7
      user-service/pom.xml
  2. 59
      user-service/src/main/java/com/mh/user/config/CaffeineCacheConfig.java
  3. 3
      user-service/src/main/java/com/mh/user/entity/DeviceCodeParamEntity.java
  4. 27
      user-service/src/main/java/com/mh/user/job/CollectionLoopRunner.java
  5. 89
      user-service/src/main/java/com/mh/user/job/DealDataJob.java
  6. 24
      user-service/src/main/java/com/mh/user/mapper/DeviceCodeParamMapper.java
  7. 27
      user-service/src/main/java/com/mh/user/serialport/SerialPortSendReceive.java
  8. 144
      user-service/src/main/java/com/mh/user/serialport/SerialPortSendReceive2.java
  9. 79
      user-service/src/main/java/com/mh/user/utils/CacheUtil.java
  10. 27
      user-service/src/main/java/com/mh/user/utils/GetReadOrder485.java
  11. 76
      user-service/src/main/java/com/mh/user/utils/SendOrderUtils.java
  12. 35
      user-service/src/main/resources/application-dev.yml

7
user-service/pom.xml

@ -135,6 +135,13 @@
<artifactId>commons-pool2</artifactId> <artifactId>commons-pool2</artifactId>
</dependency> </dependency>
<!-- https://mvnrepository.com/artifact/com.github.ben-manes.caffeine/caffeine -->
<dependency>
<groupId>com.github.ben-manes.caffeine</groupId>
<artifactId>caffeine</artifactId>
<version>2.8.8</version>
</dependency>
</dependencies> </dependencies>
<dependencyManagement> <dependencyManagement>
<dependencies> <dependencies>

59
user-service/src/main/java/com/mh/user/config/CaffeineCacheConfig.java

@ -0,0 +1,59 @@
package com.mh.user.config;
import com.github.benmanes.caffeine.cache.*;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import java.util.concurrent.TimeUnit;
/**
* @author LJF
* @title
* @description 使用caffeine缓存技术
* @updateTime 2020-12-15
* @throws
*/
@Configuration
public class CaffeineCacheConfig {
// 软引用: 如果一个对象只具有软引用,则内存空间足够,垃圾回收器就不会回收它;如果内存空间不足了,就会回收这些对象的内存。
// 弱引用: 弱引用的对象拥有更短暂的生命周期。在垃圾回收器线程扫描它所管辖的内存区域的过程中,一旦发现了只具有弱引用的对象,
// 不管当前内存空间足够与否,都会回收它的内存
@Bean(name = "caffeineCache")
public Cache<String, Object> caffeineCache() {
return Caffeine.newBuilder()
// 软引用
.softValues()
// 弱引用
// .weakValues()
// 设置最后一次写入或访问后经过固定时间过期
.expireAfterWrite(8*60*60, TimeUnit.SECONDS)
// 初始的缓存空间大小
.initialCapacity(100)
// 缓存的最大条数
.maximumSize(1000)
.build();
}
//定义缓存,可直接使用
@Bean
public LoadingCache expiryCache(){
LoadingCache<String, Object> loadingCache = Caffeine.newBuilder()
.initialCapacity(100)
.maximumSize(1000)
//缓存写入/删除监控
.writer(new CacheWriter<Object, Object>() {
@Override
public void write(Object key, Object value) { //此方法是同步阻塞的
System.out.println("--缓存写入--:key=" + key + ", value=" + value);
}
@Override
public void delete(Object key, Object value, RemovalCause cause) { System.out.println("--缓存删除--:key=" + key); }
})
.expireAfterAccess(6, TimeUnit.HOURS) //过期时间
.build((String key)->"刷新的数据"); //cacheload实现类,刷新时候调用
// loadingCache.put("name","侯征");
return loadingCache;
}
}

3
user-service/src/main/java/com/mh/user/entity/DeviceCodeParamEntity.java

@ -19,5 +19,8 @@ public class DeviceCodeParamEntity {
private String dataValue; //传入值 private String dataValue; //传入值
private Date createTime; private Date createTime;
private String buildingId; private String buildingId;
private String thread;
private Integer isuse;
} }

27
user-service/src/main/java/com/mh/user/job/CollectionLoopRunner.java

@ -5,9 +5,13 @@ import com.mh.user.entity.AddCronJobReq;
import com.mh.user.manage.QuartzManager; import com.mh.user.manage.QuartzManager;
import com.mh.user.serialport.SerialPortListener; import com.mh.user.serialport.SerialPortListener;
import com.mh.user.serialport.SerialPortUtil; import com.mh.user.serialport.SerialPortUtil;
import com.mh.user.service.DeviceCodeParamService;
import com.mh.user.utils.CacheUtil;
import com.mh.user.utils.GetReadOrder485;
import com.mh.user.utils.TimedTask2; import com.mh.user.utils.TimedTask2;
import gnu.io.SerialPort; import gnu.io.SerialPort;
import gnu.io.SerialPortEvent; import gnu.io.SerialPortEvent;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.ApplicationArguments; import org.springframework.boot.ApplicationArguments;
import org.springframework.boot.ApplicationRunner; import org.springframework.boot.ApplicationRunner;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
@ -31,10 +35,33 @@ public class CollectionLoopRunner implements ApplicationRunner {
public static SerialPort serialPort = null; public static SerialPort serialPort = null;
@Resource
private DeviceCodeParamService deviceCodeParamService;
@Override @Override
public void run(ApplicationArguments args) throws Exception { public void run(ApplicationArguments args) throws Exception {
// collectionMeterAndCloud();//采集 // collectionMeterAndCloud();//采集
// Constant.WEB_FLAG=false; //恢复采集 // Constant.WEB_FLAG=false; //恢复采集
// 初始化指令设备参数
initialDeviceCodeParams();
}
private void initialDeviceCodeParams() {
GetReadOrder485 getReadOrder485 = new GetReadOrder485();
int r=deviceCodeParamService.queryCount(); //查询记录数
if (r==0){
getReadOrder485.createOrderParam(); //生成采集参数
}
int r1 = deviceCodeParamService.queryCount2(); //查询记录数
if (r1 == 0) {
getReadOrder485.createOrderParam2(); //生成采集参数
}
int r2=deviceCodeParamService.queryCount3();//查询记录数
if (r2==0){
getReadOrder485.createOrderParam3(); //生成采集参数
}
// 生成指令缓存
//CacheUtil instance = CacheUtil.getInstance();
} }
public void test() throws Exception { public void test() throws Exception {

89
user-service/src/main/java/com/mh/user/job/DealDataJob.java

@ -30,8 +30,6 @@ public class DealDataJob {
@Autowired @Autowired
private DeviceCodeParamService deviceCodeParamService; private DeviceCodeParamService deviceCodeParamService;
private GetReadOrder485 getReadOrder485;
private static int taskTimes = 1; private static int taskTimes = 1;
public DealDataJob(DealDataService dealDataService) public DealDataJob(DealDataService dealDataService)
@ -71,63 +69,64 @@ public class DealDataJob {
public void collect() { public void collect() {
try { try {
log.info("------定时采集开始>>>>Constant.FLAG=="+Constant.FLAG+"------"); log.info("------定时采集开始>>>>Constant.FLAG=="+Constant.FLAG+"------");
SerialPortSendReceive sendReceive=new SerialPortSendReceive(); if(!Constant.FLAG){
if(Constant.FLAG==false){ if(!Constant.WEB_FLAG){
if(Constant.WEB_FLAG==false){
log.info("------taskTimes=="+taskTimes+"------"); log.info("------taskTimes=="+taskTimes+"------");
if (taskTimes<=4) {
Constant.FLAG=true; Constant.FLAG=true;
log.info("------Constant.WEB_FLAG=="+Constant.WEB_FLAG+"------"); log.info("------Constant.WEB_FLAG=="+Constant.WEB_FLAG+"------");
if (taskTimes == 2) {//2 for (int i = 1; i <= 4; i++) {
int r = deviceCodeParamService.queryCount2(); //查询记录数 String threadName = String.valueOf(i);
if (r == 0) { if (i == 1 || i == 3) {
getReadOrder485.createOrderParam2(); //生成采集参数 threadName = "1";
}
for(int i=1;i<11;i++){
SerialPortThread myThread = new SerialPortThread();
Thread thread = new Thread(myThread);
myThread.setName("2", String.valueOf(i));
thread.start();
}
log.info("------采集水、电、运行状态!"+taskTimes+"------");
}else if (taskTimes == 3){//3
for(int i=1;i<11;i++){
SerialPortThread myThread = new SerialPortThread();
Thread thread = new Thread(myThread);
myThread.setName("1", String.valueOf(i));
thread.start();
} }
log.info("------采集水位、水温!"+taskTimes+"------"); for(int j=1;i<11;i++){
}else if (taskTimes == 4) {//4
for(int i=1;i<11;i++){
SerialPortThread myThread = new SerialPortThread(); SerialPortThread myThread = new SerialPortThread();
Thread thread = new Thread(myThread); Thread thread = new Thread(myThread);
myThread.setName("3", String.valueOf(i)); myThread.setName(threadName, String.valueOf(j));
thread.start(); thread.start();
} }
log.info("------采集设定温度、设定水位、故障状态!"+taskTimes+"------");
}else {
for(int i=1;i<11;i++){
SerialPortThread myThread = new SerialPortThread();
Thread thread = new Thread(myThread);
myThread.setName("1", String.valueOf(i));
thread.start();
}
log.info("------采集水位、水温!"+taskTimes+"------");
}
if(taskTimes<4){
taskTimes++;
}else{
taskTimes=1;
}
} }
// if (taskTimes<=4) {
// Constant.FLAG=true; // Constant.FLAG=true;
// for(int i=1;i<4;i++){ // log.info("------Constant.WEB_FLAG=="+Constant.WEB_FLAG+"------");
// if (taskTimes == 2) {//2
// for(int i=1;i<11;i++){
// SerialPortThread myThread = new SerialPortThread();
// Thread thread = new Thread(myThread);
// myThread.setName("2", String.valueOf(i));
// thread.start();
// }
// log.info("------采集水、电、运行状态!"+taskTimes+"------");
// }else if (taskTimes == 3){//3
// for(int i=1;i<11;i++){
// SerialPortThread myThread = new SerialPortThread();
// Thread thread = new Thread(myThread);
// myThread.setName("1", String.valueOf(i));
// thread.start();
// }
// log.info("------采集水位、水温!"+taskTimes+"------");
// }else if (taskTimes == 4) {//4
// for(int i=1;i<11;i++){
// SerialPortThread myThread = new SerialPortThread();
// Thread thread = new Thread(myThread);
// myThread.setName("3", String.valueOf(i));
// thread.start();
// }
// log.info("------采集设定温度、设定水位、故障状态!"+taskTimes+"------");
// }else {
// for(int i=1;i<11;i++){
// SerialPortThread myThread = new SerialPortThread(); // SerialPortThread myThread = new SerialPortThread();
// Thread thread = new Thread(myThread); // Thread thread = new Thread(myThread);
// myThread.setName("1", String.valueOf(i)); // myThread.setName("1", String.valueOf(i));
// thread.start(); // thread.start();
// log.info("-------------采集水位、水温!线程"+String.valueOf(i)+"-------------"); // }
// log.info("------采集水位、水温!"+taskTimes+"------");
// }
// if(taskTimes<4){
// taskTimes++;
// }else{
// taskTimes=1;
// }
// } // }
} }
} }

24
user-service/src/main/java/com/mh/user/mapper/DeviceCodeParamMapper.java

@ -38,21 +38,39 @@ public interface DeviceCodeParamMapper {
//查询所有指令参数 //查询所有指令参数
@ResultMap("rs") @ResultMap("rs")
@Select("select * from device_code_param where thread=#{thread} order by data_com,device_type") @Select("select * from device_code_param " +
// "<where>" +
// "<if test='thread != null and thread != \"\"'>" +
// " and thread=#{thread} " +
// "</if>" +
// "</where>" +
"order by data_com,device_type")
//@Select("select * from device_code_param order by data_com,device_type ") //@Select("select * from device_code_param order by data_com,device_type ")
// @Select("select * from device_code_param order by device_type ") // @Select("select * from device_code_param order by device_type ")
List<DeviceCodeParamEntity> queryCodeParam3(@Param("thread") String thread); List<DeviceCodeParamEntity> queryCodeParam3(@Param("thread") String thread);
//查询所有指令参数 //查询所有指令参数
@ResultMap("rs") @ResultMap("rs")
@Select("select * from device_code_param2 where thread=#{thread} order by data_com,device_type") @Select("select * from device_code_param2 " +
// "<where>" +
// "<if test='thread != null and thread != \"\"'>" +
// " and thread=#{thread} " +
// "</if>" +
// "</where>" +
"order by data_com,device_type")
//@Select("select * from device_code_param2 order by data_com,device_type ") //@Select("select * from device_code_param2 order by data_com,device_type ")
// @Select("select * from device_code_param2 order by device_type ") // @Select("select * from device_code_param2 order by device_type ")
List<DeviceCodeParamEntity> queryCodeParam4(@Param("thread") String thread); List<DeviceCodeParamEntity> queryCodeParam4(@Param("thread") String thread);
//查询所有指令参数 //查询所有指令参数
@ResultMap("rs") @ResultMap("rs")
@Select("select * from device_code_param3 where thread=#{thread} order by data_com,device_type") @Select("select * from device_code_param3 " +
// "<where>" +
// "<if test='thread != null and thread != \"\"'>" +
// " and thread=#{thread} " +
// "</if>" +
// "</where>" +
" order by data_com,device_type")
//@Select("select * from device_code_param3 order by data_com,device_type") //@Select("select * from device_code_param3 order by data_com,device_type")
// @Select("select * from device_code_param3 order by device_type ") // @Select("select * from device_code_param3 order by device_type ")
List<DeviceCodeParamEntity> queryCodeParam5(@Param("thread") String thread); List<DeviceCodeParamEntity> queryCodeParam5(@Param("thread") String thread);

27
user-service/src/main/java/com/mh/user/serialport/SerialPortSendReceive.java

@ -178,32 +178,7 @@ public class SerialPortSendReceive {
} }
} }
try{ try{
if ((dataStr.length() == 36 || dataStr.length() == 44 || dataStr.length()==40 || dataStr.length()==50) && deviceType.equals("电表")) { SerialPortSendReceive2.analysisReceiveData(dateStr, deviceType, registerAddr, brand, buildingId, dataStr, analysisReceiveOrder485, nowDataService);
analysisReceiveOrder485.analysisMeterOrder485(dataStr,registerAddr,brand,buildingId);
nowDataService.proWaterLevel(dateStr,buildingId); //保存时间点楼栋水位
}else if ((dataStr.length() == 18 || dataStr.length() == 70 || dataStr.length() == 44) && deviceType.equals("水表")) {
analysisReceiveOrder485.analysisWtMeterOrder485(dataStr,registerAddr,brand,buildingId);
}else if (deviceType.equals("压变")) {
analysisReceiveOrder485.analysisPressureOrder485(dataStr,registerAddr,brand,buildingId);
}else if (deviceType.equals("热泵")) {
analysisReceiveOrder485.analysisPumpOrder485(dataStr,registerAddr,brand,buildingId);
}else if (deviceType.equals("温控")) {
analysisReceiveOrder485.analysisTempOrder485(dataStr,registerAddr,brand,buildingId);
}else if (deviceType.equals("时控")) {
analysisReceiveOrder485.analysisTimeSetOrder485(dataStr,registerAddr,brand,buildingId);
}else if (deviceType.equals("水位开关") && (registerAddr.equals("0018") || registerAddr.equals("0017"))){
analysisReceiveOrder485.analysisRelayOrder485(dataStr,registerAddr,brand,buildingId);
}else if (dataStr.length() == 30 && deviceType.equals("状态检测")) {//五路状态读取,兼容旧版系统
analysisReceiveOrder485.analysisStateOrder485(dataStr,registerAddr,brand,buildingId);
}else if (deviceType.equals("水位开关") && registerAddr.equals("0010")){
analysisReceiveOrder485.analysisPumpStateOrder(dataStr,registerAddr,brand,buildingId); //创新,热泵状态与水位共用一个8路设备
// analysisReceiveOrder485.analysisRelayOrder485(dataStr,registerAddr,brand,buildingId); //华厦
nowDataService.proWaterLevel(dateStr,buildingId); //保存时间点楼栋水位
}else if (deviceType.equals("温度变送器")){
analysisReceiveOrder485.analysisMulTempOrder485(dataStr,registerAddr,brand,buildingId);
}else if (deviceType.equals("热泵状态")){
analysisReceiveOrder485.analysisPumpStateOrder(dataStr,registerAddr,brand,buildingId);
}
}catch (Exception e){ }catch (Exception e){
// e.printStackTrace(); // e.printStackTrace();
Constant.WEB_FLAG=false;//可以采集的状态 Constant.WEB_FLAG=false;//可以采集的状态

144
user-service/src/main/java/com/mh/user/serialport/SerialPortSendReceive2.java

@ -1,23 +1,24 @@
package com.mh.user.serialport; package com.mh.user.serialport;
import com.mh.common.utils.StringUtils;
import com.mh.user.constants.Constant; import com.mh.user.constants.Constant;
import com.mh.user.entity.DeviceCodeParamEntity; import com.mh.user.entity.DeviceCodeParamEntity;
import com.mh.user.service.BuildingService; import com.mh.user.service.BuildingService;
import com.mh.user.service.DeviceCodeParamService; import com.mh.user.service.DeviceCodeParamService;
import com.mh.user.service.DeviceInstallService; import com.mh.user.service.DeviceInstallService;
import com.mh.user.service.NowDataService; import com.mh.user.service.NowDataService;
import com.mh.user.utils.AnalysisReceiveOrder485; import com.mh.user.utils.*;
import com.mh.user.utils.ExchangeStringUtil;
import com.mh.user.utils.SendOrderUtils;
import com.mh.user.utils.SpringBeanUtil;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.context.ApplicationContext; import org.springframework.context.ApplicationContext;
import purejavacomm.SerialPort; import purejavacomm.SerialPort;
import java.nio.ByteBuffer; import java.nio.ByteBuffer;
import java.nio.charset.StandardCharsets; import java.nio.charset.StandardCharsets;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.Comparator;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
import java.util.stream.Collectors;
/** /**
* @author nxr * @author nxr
@ -48,27 +49,33 @@ public class SerialPortSendReceive2 {
Date date = new Date(); Date date = new Date();
String dateStr = df.format(date); String dateStr = df.format(date);
SerialPort serialPort = null; SerialPort serialPort = null;
CacheUtil cacheUtil = CacheUtil.getInstance();
// if (port.contains(comName)){ // if (port.contains(comName)){
try { try {
//生成对应的采集指令 //生成对应的采集指令
if (sort.equals("1")){ //水温、水位 // switch (sort) {
deviceManageEntityList = deviceCodeParamService.queryCodeParam3(thread); // case "2": //采集水、电、运行状态!
}else if (sort.equals("2")){ //采集水、电、运行状态! // deviceManageEntityList = deviceCodeParamService.queryCodeParam4(thread);
deviceManageEntityList = deviceCodeParamService.queryCodeParam4(thread); // break;
}else if (sort.equals("3")){ //采集设定温度、设定水位、故障状态! // case "3": //采集设定温度、设定水位、故障状态!
deviceManageEntityList = deviceCodeParamService.queryCodeParam5(thread); // deviceManageEntityList = deviceCodeParamService.queryCodeParam5(thread);
}else{ // break;
deviceManageEntityList = deviceCodeParamService.queryCodeParam3(thread); // default:
} // deviceManageEntityList = deviceCodeParamService.queryCodeParam3(thread);
// break;
// }
List<DeviceCodeParamEntity> deviceParamsByType = cacheUtil.getDeviceParamsByType(sort);
deviceManageEntityList = deviceParamsByType
.parallelStream()
.filter(value -> value.getThread().equals(thread))
.sorted(Comparator.comparing(DeviceCodeParamEntity::getDataCom))
.collect(Collectors.toList());
size = deviceManageEntityList.size(); size = deviceManageEntityList.size();
for (int i = 0; i < size; i++) { for (int i = 0; i < size; i++) {
//判断网页端是否有操作设备的 //判断网页端是否有操作设备的
if (Constant.WEB_FLAG) { if (Constant.WEB_FLAG) {
Constant.FLAG = false; Constant.FLAG = false;
// serialPortUtil.closePort(serialPort);
SerialTool.closePort(serialPort); SerialTool.closePort(serialPort);
// Thread.sleep(2000);
log.info("有指令下发退出定时采集"); log.info("有指令下发退出定时采集");
break; break;
} }
@ -78,7 +85,11 @@ public class SerialPortSendReceive2 {
parity = deviceManageEntityList.get(i).getParity(); parity = deviceManageEntityList.get(i).getParity();
String comName = deviceManageEntityList.get(i).getDataCom(); String comName = deviceManageEntityList.get(i).getDataCom();
if (comName!=null && !comName.equals("")){ if (StringUtils.isBlank(comName)) {
Constant.WEB_FLAG = false;//可以采集的状态
log.info("-------------串口:" + comName + "不存在!-------------");
continue;
}
String deviceAddr = deviceManageEntityList.get(i).getDeviceAddr(); String deviceAddr = deviceManageEntityList.get(i).getDeviceAddr();
String deviceType = deviceManageEntityList.get(i).getDeviceType(); String deviceType = deviceManageEntityList.get(i).getDeviceType();
String registerAddr = deviceManageEntityList.get(i).getRegisterAddr(); String registerAddr = deviceManageEntityList.get(i).getRegisterAddr();
@ -103,21 +114,16 @@ public class SerialPortSendReceive2 {
Thread.sleep(2000); Thread.sleep(2000);
} }
} else { } else {
continue; //continue时,跳出本次循环,继续执行下次循环。Break时,跳出循环(结束循环),执行下面的语句。 continue;
} }
} catch (Exception e) { } catch (Exception e) {
// e.printStackTrace();
Constant.WEB_FLAG = false;//可以采集的状态 Constant.WEB_FLAG = false;//可以采集的状态
if(i==size-1){ log.error("发送窗口数据异常==>", e);
Constant.FLAG=false;
} }
}
receiveStr="";
//从串口读取数据 //从串口读取数据
byte[] bytes = SerialTool.readFromPort(serialPort); byte[] bytes = SerialTool.readFromPort(serialPort);
try { if (bytes == null) {
String byteStr = new String(bytes, 0, bytes.length).trim();
} catch (NullPointerException e) {
SerialTool.closePort(serialPort); SerialTool.closePort(serialPort);
Thread.sleep(2000); Thread.sleep(2000);
log.info("串口" + serialPort + "没有数据返回!" + i); log.info("串口" + serialPort + "没有数据返回!" + i);
@ -141,7 +147,44 @@ public class SerialPortSendReceive2 {
} }
continue; continue;
} }
receiveStr = receiveStr + printHexString(bytes); // 处理返回来的数据报文
dealReceiveData(dateStr, serialPort, i, deviceAddr, deviceType, registerAddr, brand, buildingId, buildingName, bytes);
}
Constant.FLAG = false;
log.info("-------------一轮采集完,采集标志Constant.Flag=false-------------");
} catch (Exception e) {
e.printStackTrace();
Constant.WEB_FLAG = false;//可以采集的状态
Constant.FLAG = false;
log.error("-------------串口采集异常!-------------");
}
}
/**
* 处理返回来的数据
* @param dateStr
* @param serialPort
* @param i
* @param deviceAddr
* @param deviceType
* @param registerAddr
* @param brand
* @param buildingId
* @param buildingName
* @param bytes
* @throws InterruptedException
*/
private void dealReceiveData(String dateStr,
SerialPort serialPort,
int i,
String deviceAddr,
String deviceType,
String registerAddr,
String brand,
String buildingId,
String buildingName, byte[] bytes) throws InterruptedException {
receiveStr = "";
receiveStr = printHexString(bytes);
//去掉空格和null //去掉空格和null
receiveStr = receiveStr.replace("null", ""); receiveStr = receiveStr.replace("null", "");
receiveStr = receiveStr.replace(" ", ""); receiveStr = receiveStr.replace(" ", "");
@ -150,12 +193,11 @@ public class SerialPortSendReceive2 {
SerialTool.closePort(serialPort); SerialTool.closePort(serialPort);
log.info("关闭" + serialPort); log.info("关闭" + serialPort);
} catch (Exception e) { } catch (Exception e) {
// e.printStackTrace();
Constant.WEB_FLAG = false;//可以采集的状态 Constant.WEB_FLAG = false;//可以采集的状态
if (i == size - 1) { if (i == size - 1) {
Constant.FLAG = false; Constant.FLAG = false;
} }
log.error("关闭"+serialPort+"失败!"); log.error("关闭" + serialPort + "失败!", e);
} }
//返回值全部变成大写 //返回值全部变成大写
String receiveData = receiveStr.toUpperCase(); String receiveData = receiveStr.toUpperCase();
@ -177,6 +219,16 @@ public class SerialPortSendReceive2 {
} }
} }
try { try {
// 解析返回来的数据
analysisReceiveData(dateStr, deviceType, registerAddr, brand, buildingId, dataStr, analysisReceiveOrder485, nowDataService);
} catch (Exception e) {
Constant.WEB_FLAG = false;//可以采集的状态
log.error(deviceManageEntityList.get(i).getDeviceType() + "保存数据库失败!" + i,e);
}
Thread.sleep(1000);
}
static void analysisReceiveData(String dateStr, String deviceType, String registerAddr, String brand, String buildingId, String dataStr, AnalysisReceiveOrder485 analysisReceiveOrder485, NowDataService nowDataService) {
if ((dataStr.length() == 36 || dataStr.length() == 44 || dataStr.length() == 40 || dataStr.length() == 50) && deviceType.equals("电表")) { if ((dataStr.length() == 36 || dataStr.length() == 44 || dataStr.length() == 40 || dataStr.length() == 50) && deviceType.equals("电表")) {
analysisReceiveOrder485.analysisMeterOrder485(dataStr, registerAddr, brand, buildingId); analysisReceiveOrder485.analysisMeterOrder485(dataStr, registerAddr, brand, buildingId);
nowDataService.proWaterLevel(dateStr, buildingId); //保存时间点楼栋水位 nowDataService.proWaterLevel(dateStr, buildingId); //保存时间点楼栋水位
@ -203,39 +255,11 @@ public class SerialPortSendReceive2 {
} else if (deviceType.equals("热泵状态")) { } else if (deviceType.equals("热泵状态")) {
analysisReceiveOrder485.analysisPumpStateOrder(dataStr, registerAddr, brand, buildingId); analysisReceiveOrder485.analysisPumpStateOrder(dataStr, registerAddr, brand, buildingId);
} }
}catch (Exception e){
// e.printStackTrace();
Constant.WEB_FLAG=false;//可以采集的状态
if(i==size-1){
Constant.FLAG=false;
}
log.error(deviceManageEntityList.get(i).getDeviceType()+"保存数据库失败!"+i);
}
Thread.sleep(1000);
}else{
Constant.WEB_FLAG=false;//可以采集的状态
if(i==size-1){
Constant.FLAG=false;
}
log.info("-------------串口:"+comName+"不存在!-------------");
}
if(i==size-1){
Constant.FLAG=false;
log.info("-------------一轮采集完,采集标志Constant.Flag="+Constant.FLAG+"-------------");
}
}
}catch (Exception e){
e.printStackTrace();
Constant.WEB_FLAG=false;//可以采集的状态
Constant.FLAG=false;
log.error("-------------串口采集异常!-------------");
}
// }else {
// log.info("串口:"+comName+"不存在!");
// }
} }
/** /**
* 字节数组转16进制字符串 * 字节数组转16进制字符串
*
* @param b 字节数组 * @param b 字节数组
* @return 16进制字符串 * @return 16进制字符串
*/ */
@ -253,6 +277,7 @@ public class SerialPortSendReceive2 {
/** /**
* 十六进制字符串转byte[] * 十六进制字符串转byte[]
*
* @param hex 十六进制字符串 * @param hex 十六进制字符串
* @return byte[] * @return byte[]
*/ */
@ -280,6 +305,7 @@ public class SerialPortSendReceive2 {
/** /**
* 16进制转换成为string类型字符串 * 16进制转换成为string类型字符串
*
* @param s 待转换字符串 * @param s 待转换字符串
*/ */
public static String hexStringToString(String s) { public static String hexStringToString(String s) {

79
user-service/src/main/java/com/mh/user/utils/CacheUtil.java

@ -0,0 +1,79 @@
package com.mh.user.utils;
import com.alibaba.fastjson2.JSONArray;
import com.alibaba.fastjson2.JSONObject;
import com.github.benmanes.caffeine.cache.Cache;
import com.mh.user.constants.Constant;
import com.mh.user.entity.ChillersEntity;
import com.mh.user.entity.DeviceCodeParamEntity;
import com.mh.user.service.DeviceCodeParamService;
import org.springframework.context.ApplicationContext;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* @Classname CacheUtil
* Todo: 缓存工具类
* @Date 2021-11-21 10:03
* @Created by LJF
*/
public class CacheUtil {
// 调用service
ApplicationContext context = SpringBeanUtil.getApplicationContext();
Cache caffeineCache = (Cache) context.getBean("caffeineCache");
DeviceCodeParamService deviceCodeParamService = context.getBean(DeviceCodeParamService.class);
private static class SingletonHolder{
private static final CacheUtil instance=new CacheUtil();
}
private CacheUtil(){
createDeviceParams();
}
public static CacheUtil getInstance(){
return SingletonHolder.instance;
}
/**
* 把采集ddc设置的报文存入到缓存中
*/
private void createDeviceParams() {
// 缓存压变、温控
if (caffeineCache.getIfPresent("1") == null) {
List<DeviceCodeParamEntity> deviceCodeParamEntities = deviceCodeParamService.queryCodeParam3(null);
caffeineCache.put("1", deviceCodeParamEntities);
}
// 缓存水、电表、状态检测
if (caffeineCache.getIfPresent("2") == null) {
List<DeviceCodeParamEntity> deviceCodeParam2Entities = deviceCodeParamService.queryCodeParam4(null);
caffeineCache.put("2", deviceCodeParam2Entities);
}
// 水位开关
if (caffeineCache.getIfPresent("3") == null) {
List<DeviceCodeParamEntity> deviceCodeParam3Entities = deviceCodeParamService.queryCodeParam5(null);
caffeineCache.put("3", deviceCodeParam3Entities);
}
}
/**
* 通过发生类型获取发生的报文集合(返回List类型)
* @param type
* @return
*/
public List<DeviceCodeParamEntity> getDeviceParamsByType(String type) {
Object cacheObject = caffeineCache.getIfPresent(type);
// 如果为空,重新添加
if (cacheObject == null) {
createDeviceParams();
// 在重新获取数据
cacheObject = caffeineCache.getIfPresent(type);
}
return JSONArray.parseArray(JSONObject.toJSONString(cacheObject), DeviceCodeParamEntity.class);
}
}

27
user-service/src/main/java/com/mh/user/utils/GetReadOrder485.java

@ -1,22 +1,15 @@
package com.mh.user.utils; package com.mh.user.utils;
import com.mh.user.entity.*; import com.mh.user.entity.*;
import com.mh.user.model.OrderParamModel;
import com.mh.user.serialport.SerialPortThread;
import com.mh.user.service.DeviceCodeParamService; import com.mh.user.service.DeviceCodeParamService;
import com.mh.user.service.DeviceInstallService; import com.mh.user.service.DeviceInstallService;
import com.mh.user.service.impl.DeviceDisplayServiceImpl; import com.mh.user.service.impl.DeviceDisplayServiceImpl;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.context.ApplicationContext; import org.springframework.context.ApplicationContext;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Date;
import java.util.List; import java.util.List;
import static com.mh.user.utils.ExchangeStringUtil.doubleTrans1;
/** /**
* @author ljf * @author ljf
* @title * @title
@ -34,7 +27,7 @@ public class GetReadOrder485 {
DeviceCodeParamService deviceCodeParamService=context.getBean(DeviceCodeParamService.class); DeviceCodeParamService deviceCodeParamService=context.getBean(DeviceCodeParamService.class);
// 电表 // 电表
public static String createMeterOrder(OrderParamModel orderParamModel){ public static String createMeterOrder(DeviceCodeParamEntity orderParamModel){
String str=null; String str=null;
String deviceAddr=orderParamModel.getDeviceAddr(); String deviceAddr=orderParamModel.getDeviceAddr();
if (deviceAddr!=null && deviceAddr.length()>0){ if (deviceAddr!=null && deviceAddr.length()>0){
@ -60,7 +53,7 @@ public class GetReadOrder485 {
} }
// 水表 // 水表
public static String createWtMeterOrder(OrderParamModel orderParamModel){ public static String createWtMeterOrder(DeviceCodeParamEntity orderParamModel){
String deviceAddr=orderParamModel.getDeviceAddr(); String deviceAddr=orderParamModel.getDeviceAddr();
String brand=orderParamModel.getBrand(); String brand=orderParamModel.getBrand();
String str=null; String str=null;
@ -92,7 +85,7 @@ public class GetReadOrder485 {
} }
// 热泵,参数:功能码、品牌、数据、通讯表号、寄存器地址 // 热泵,参数:功能码、品牌、数据、通讯表号、寄存器地址
public static String createPumpOrder(OrderParamModel orderParamModel){ public static String createPumpOrder(DeviceCodeParamEntity orderParamModel){
String deviceAddr=orderParamModel.getDeviceAddr(); String deviceAddr=orderParamModel.getDeviceAddr();
String brand=orderParamModel.getBrand(); String brand=orderParamModel.getBrand();
String funCode=orderParamModel.getFunCode(); String funCode=orderParamModel.getFunCode();
@ -179,7 +172,7 @@ public class GetReadOrder485 {
} }
// 水位开关(水位设定) // 水位开关(水位设定)
public static String createRelayOrder(OrderParamModel orderParamModel){ public static String createRelayOrder(DeviceCodeParamEntity orderParamModel){
String deviceAddr=orderParamModel.getDeviceAddr(); String deviceAddr=orderParamModel.getDeviceAddr();
String brand=orderParamModel.getBrand(); String brand=orderParamModel.getBrand();
String funCode=orderParamModel.getFunCode(); String funCode=orderParamModel.getFunCode();
@ -321,7 +314,7 @@ public class GetReadOrder485 {
} }
// 热泵状态(8路开关) // 热泵状态(8路开关)
public static String createPumpStateOrder(OrderParamModel orderParamModel){ public static String createPumpStateOrder(DeviceCodeParamEntity orderParamModel){
String deviceAddr=orderParamModel.getDeviceAddr(); String deviceAddr=orderParamModel.getDeviceAddr();
String brand=orderParamModel.getBrand(); String brand=orderParamModel.getBrand();
String funCode=orderParamModel.getFunCode(); String funCode=orderParamModel.getFunCode();
@ -376,7 +369,7 @@ public class GetReadOrder485 {
} }
//状态检测 //状态检测
public static String createStateOrder(OrderParamModel orderParamModel){ public static String createStateOrder(DeviceCodeParamEntity orderParamModel){
String deviceAddr=orderParamModel.getDeviceAddr(); String deviceAddr=orderParamModel.getDeviceAddr();
String brand=orderParamModel.getBrand(); String brand=orderParamModel.getBrand();
String str=null; String str=null;
@ -405,7 +398,7 @@ public class GetReadOrder485 {
} }
// 压变 // 压变
public static String createPressureOrder(OrderParamModel orderParamModel){ public static String createPressureOrder(DeviceCodeParamEntity orderParamModel){
String deviceAddr=orderParamModel.getDeviceAddr(); String deviceAddr=orderParamModel.getDeviceAddr();
String brand=orderParamModel.getBrand(); String brand=orderParamModel.getBrand();
String str=null; String str=null;
@ -432,7 +425,7 @@ public class GetReadOrder485 {
} }
// 温控 // 温控
public static String createTempOrder(OrderParamModel orderParamModel){ public static String createTempOrder(DeviceCodeParamEntity orderParamModel){
String deviceAddr=orderParamModel.getDeviceAddr(); String deviceAddr=orderParamModel.getDeviceAddr();
String registerAddr=orderParamModel.getRegisterAddr(); String registerAddr=orderParamModel.getRegisterAddr();
String str=null; String str=null;
@ -459,7 +452,7 @@ public class GetReadOrder485 {
} }
// 温度变送器 // 温度变送器
public static String createMulTempOrder(OrderParamModel orderParamModel){ public static String createMulTempOrder(DeviceCodeParamEntity orderParamModel){
String deviceAddr=orderParamModel.getDeviceAddr(); String deviceAddr=orderParamModel.getDeviceAddr();
String registerAddr=orderParamModel.getRegisterAddr(); String registerAddr=orderParamModel.getRegisterAddr();
String str=null; String str=null;
@ -480,7 +473,7 @@ public class GetReadOrder485 {
} }
//时控设置,registerAddr 0009(L1)、000D(L2)、0011(L3) 读:010300090004、写:01100009000408+dataValue //时控设置,registerAddr 0009(L1)、000D(L2)、0011(L3) 读:010300090004、写:01100009000408+dataValue
public static String createTimeSetOrder(OrderParamModel orderParamModel){ public static String createTimeSetOrder(DeviceCodeParamEntity orderParamModel){
String deviceAddr=orderParamModel.getDeviceAddr(); String deviceAddr=orderParamModel.getDeviceAddr();
String brand=orderParamModel.getBrand(); String brand=orderParamModel.getBrand();
String funCode=orderParamModel.getFunCode(); String funCode=orderParamModel.getFunCode();

76
user-service/src/main/java/com/mh/user/utils/SendOrderUtils.java

@ -101,39 +101,39 @@ public class SendOrderUtils {
//向串口发指令数据 //向串口发指令数据
public static void sendSerialPort(DeviceCodeParamEntity deviceCodeParamEntity,SerialPort serialPort ) { public static void sendSerialPort(DeviceCodeParamEntity deviceCodeParamEntity,SerialPort serialPort ) {
//创建将要写出的数据 //创建将要写出的数据
OrderParamModel orderParamModel=new OrderParamModel(); // OrderParamModel orderParamModel=new OrderParamModel();
orderParamModel.setDeviceAddr(deviceCodeParamEntity.getDeviceAddr());//通讯地址 // orderParamModel.setDeviceAddr(deviceCodeParamEntity.getDeviceAddr());//通讯地址
orderParamModel.setDeviceType(deviceCodeParamEntity.getDeviceType());//设备类型 // orderParamModel.setDeviceType(deviceCodeParamEntity.getDeviceType());//设备类型
orderParamModel.setBaudrate(deviceCodeParamEntity.getBaudrate());//波特率 // orderParamModel.setBaudrate(deviceCodeParamEntity.getBaudrate());//波特率
orderParamModel.setBrand(deviceCodeParamEntity.getBrand());//品牌 // orderParamModel.setBrand(deviceCodeParamEntity.getBrand());//品牌
orderParamModel.setFunCode(deviceCodeParamEntity.getFunCode());//功能码 // orderParamModel.setFunCode(deviceCodeParamEntity.getFunCode());//功能码
orderParamModel.setRegisterAddr(deviceCodeParamEntity.getRegisterAddr());//寄存器地址 // orderParamModel.setRegisterAddr(deviceCodeParamEntity.getRegisterAddr());//寄存器地址
orderParamModel.setComName(deviceCodeParamEntity.getDataCom()); //串口 // orderParamModel.setComName(deviceCodeParamEntity.getDataCom()); //串口
orderParamModel.setDataValue(deviceCodeParamEntity.getDataValue());//传入数据 // orderParamModel.setDataValue(deviceCodeParamEntity.getDataValue());//传入数据
String deviceType=deviceCodeParamEntity.getDeviceType(); String deviceType=deviceCodeParamEntity.getDeviceType();
String registerAddr=deviceCodeParamEntity.getRegisterAddr(); String registerAddr=deviceCodeParamEntity.getRegisterAddr();
String sendStr=null; String sendStr=null;
if (deviceType.equals("电表")){ if (deviceType.equals("电表")){
sendStr = GetReadOrder485.createMeterOrder(orderParamModel); sendStr = GetReadOrder485.createMeterOrder(deviceCodeParamEntity);
}else if (deviceType.equals("水表")){ }else if (deviceType.equals("水表")){
sendStr = GetReadOrder485.createWtMeterOrder(orderParamModel); sendStr = GetReadOrder485.createWtMeterOrder(deviceCodeParamEntity);
}else if (deviceType.equals("压变")){ }else if (deviceType.equals("压变")){
sendStr = GetReadOrder485.createPressureOrder(orderParamModel); sendStr = GetReadOrder485.createPressureOrder(deviceCodeParamEntity);
}else if (deviceType.equals("热泵")){ }else if (deviceType.equals("热泵")){
sendStr = GetReadOrder485.createPumpOrder(orderParamModel); sendStr = GetReadOrder485.createPumpOrder(deviceCodeParamEntity);
}else if (deviceType.equals("温控")){ }else if (deviceType.equals("温控")){
sendStr = GetReadOrder485.createTempOrder(orderParamModel); sendStr = GetReadOrder485.createTempOrder(deviceCodeParamEntity);
}else if (deviceType.equals("时控")){ }else if (deviceType.equals("时控")){
sendStr = GetReadOrder485.createTimeSetOrder(orderParamModel); sendStr = GetReadOrder485.createTimeSetOrder(deviceCodeParamEntity);
}else if (deviceType.equals("水位开关")){ }else if (deviceType.equals("水位开关")){
sendStr = GetReadOrder485.createRelayOrder(orderParamModel); sendStr = GetReadOrder485.createRelayOrder(deviceCodeParamEntity);
}else if (deviceType.equals("状态检测")){ }else if (deviceType.equals("状态检测")){
sendStr = GetReadOrder485.createStateOrder(orderParamModel); sendStr = GetReadOrder485.createStateOrder(deviceCodeParamEntity);
}else if (deviceType.equals("温度变送器")){ }else if (deviceType.equals("温度变送器")){
sendStr = GetReadOrder485.createMulTempOrder(orderParamModel); sendStr = GetReadOrder485.createMulTempOrder(deviceCodeParamEntity);
}else if (deviceType.equals("热泵状态")){ }else if (deviceType.equals("热泵状态")){
sendStr = GetReadOrder485.createPumpStateOrder(orderParamModel); sendStr = GetReadOrder485.createPumpStateOrder(deviceCodeParamEntity);
} }
String str=sendStr; String str=sendStr;
@ -154,39 +154,39 @@ public class SendOrderUtils {
//向串口发指令数据 //向串口发指令数据
public static String getSendStr(DeviceCodeParamEntity deviceCodeParamEntity) { public static String getSendStr(DeviceCodeParamEntity deviceCodeParamEntity) {
//创建将要写出的数据 //创建将要写出的数据
OrderParamModel orderParamModel=new OrderParamModel(); // OrderParamModel orderParamModel=new OrderParamModel();
orderParamModel.setDeviceAddr(deviceCodeParamEntity.getDeviceAddr());//通讯地址 // orderParamModel.setDeviceAddr(deviceCodeParamEntity.getDeviceAddr());//通讯地址
orderParamModel.setDeviceType(deviceCodeParamEntity.getDeviceType());//设备类型 // orderParamModel.setDeviceType(deviceCodeParamEntity.getDeviceType());//设备类型
orderParamModel.setBaudrate(deviceCodeParamEntity.getBaudrate());//波特率 // orderParamModel.setBaudrate(deviceCodeParamEntity.getBaudrate());//波特率
orderParamModel.setBrand(deviceCodeParamEntity.getBrand());//品牌 // orderParamModel.setBrand(deviceCodeParamEntity.getBrand());//品牌
orderParamModel.setFunCode(deviceCodeParamEntity.getFunCode());//功能码 // orderParamModel.setFunCode(deviceCodeParamEntity.getFunCode());//功能码
orderParamModel.setRegisterAddr(deviceCodeParamEntity.getRegisterAddr());//寄存器地址 // orderParamModel.setRegisterAddr(deviceCodeParamEntity.getRegisterAddr());//寄存器地址
orderParamModel.setComName(deviceCodeParamEntity.getDataCom()); //串口 // orderParamModel.setComName(deviceCodeParamEntity.getDataCom()); //串口
orderParamModel.setDataValue(deviceCodeParamEntity.getDataValue());//传入数据 // orderParamModel.setDataValue(deviceCodeParamEntity.getDataValue());//传入数据
String deviceType=deviceCodeParamEntity.getDeviceType(); String deviceType=deviceCodeParamEntity.getDeviceType();
String registerAddr=deviceCodeParamEntity.getRegisterAddr(); String registerAddr=deviceCodeParamEntity.getRegisterAddr();
String sendStr=null; String sendStr=null;
if (deviceType.equals("电表")){ if (deviceType.equals("电表")){
sendStr = GetReadOrder485.createMeterOrder(orderParamModel); sendStr = GetReadOrder485.createMeterOrder(deviceCodeParamEntity);
}else if (deviceType.equals("水表")){ }else if (deviceType.equals("水表")){
sendStr = GetReadOrder485.createWtMeterOrder(orderParamModel); sendStr = GetReadOrder485.createWtMeterOrder(deviceCodeParamEntity);
}else if (deviceType.equals("压变")){ }else if (deviceType.equals("压变")){
sendStr = GetReadOrder485.createPressureOrder(orderParamModel); sendStr = GetReadOrder485.createPressureOrder(deviceCodeParamEntity);
}else if (deviceType.equals("热泵")){ }else if (deviceType.equals("热泵")){
sendStr = GetReadOrder485.createPumpOrder(orderParamModel); sendStr = GetReadOrder485.createPumpOrder(deviceCodeParamEntity);
}else if (deviceType.equals("温控")){ }else if (deviceType.equals("温控")){
sendStr = GetReadOrder485.createTempOrder(orderParamModel); sendStr = GetReadOrder485.createTempOrder(deviceCodeParamEntity);
}else if (deviceType.equals("时控")){ }else if (deviceType.equals("时控")){
sendStr = GetReadOrder485.createTimeSetOrder(orderParamModel); sendStr = GetReadOrder485.createTimeSetOrder(deviceCodeParamEntity);
}else if (deviceType.equals("水位开关")){ }else if (deviceType.equals("水位开关")){
sendStr = GetReadOrder485.createRelayOrder(orderParamModel); sendStr = GetReadOrder485.createRelayOrder(deviceCodeParamEntity);
}else if (deviceType.equals("状态检测")){ }else if (deviceType.equals("状态检测")){
sendStr = GetReadOrder485.createStateOrder(orderParamModel); sendStr = GetReadOrder485.createStateOrder(deviceCodeParamEntity);
}else if (deviceType.equals("温度变送器")){ }else if (deviceType.equals("温度变送器")){
sendStr = GetReadOrder485.createMulTempOrder(orderParamModel); sendStr = GetReadOrder485.createMulTempOrder(deviceCodeParamEntity);
}else if (deviceType.equals("热泵状态")){ }else if (deviceType.equals("热泵状态")){
sendStr = GetReadOrder485.createPumpStateOrder(orderParamModel); sendStr = GetReadOrder485.createPumpStateOrder(deviceCodeParamEntity);
} }
return sendStr; return sendStr;

35
user-service/src/main/resources/application-dev.yml

@ -8,41 +8,10 @@ spring:
type: com.alibaba.druid.pool.DruidDataSource type: com.alibaba.druid.pool.DruidDataSource
druid: druid:
#添加allowMultiQueries=true 在批量更新时才不会出错 #添加allowMultiQueries=true 在批量更新时才不会出错
# url: jdbc:sqlserver://192.168.1.108:2012;DatabaseName=FSBG;allowMultiQueries=true url: jdbc:sqlserver://127.0.0.1:1433;DatabaseName=chws_chx;allowMultiQueries=true
# driver-class-name: com.microsoft.sqlserver.jdbc.SQLServerDriver
# username: sa
# password: mh@803
## url: jdbc:sqlserver://120.25.220.177:32012;DatabaseName=M_CHWS;allowMultiQueries=true
#阿里云服务器-广州理工
# url: jdbc:sqlserver://120.25.220.177:32012;DatabaseName=CHWS;allowMultiQueries=true
# driver-class-name: com.microsoft.sqlserver.jdbc.SQLServerDriver
# username: test
# password: minghan123456@
#华厦云服务器
# url: jdbc:sqlserver://127.0.0.1:1433;DatabaseName=CHWS;allowMultiQueries=true
# driver-class-name: com.microsoft.sqlserver.jdbc.SQLServerDriver
# username: chws
# password: minghan123456@
#创新服务器
url: jdbc:sqlserver://119.29.33.133:2008;DatabaseName=chws_chx;allowMultiQueries=true
driver-class-name: com.microsoft.sqlserver.jdbc.SQLServerDriver driver-class-name: com.microsoft.sqlserver.jdbc.SQLServerDriver
username: chws username: sa
password: mh@803 password: mh@803
#广商服务器
# url: jdbc:sqlserver://119.29.33.133:2008;DatabaseName=chws_gsh;allowMultiQueries=true
# driver-class-name: com.microsoft.sqlserver.jdbc.SQLServerDriver
# username: chws
# password: mh@803
#本机
# url: jdbc:sqlserver://127.0.0.1:9956;DatabaseName=CHWS;allowMultiQueries=true
# driver-class-name: com.microsoft.sqlserver.jdbc.SQLServerDriver
# username: sa
# password: mh@803
#家里电脑
# url: jdbc:sqlserver://127.0.0.1:1433;DatabaseName=CHWS;allowMultiQueries=true
# driver-class-name: com.microsoft.sqlserver.jdbc.SQLServerDriver
# username: sa
# password: mh@803
filters: stat,wall,config filters: stat,wall,config
max-active: 100 max-active: 100

Loading…
Cancel
Save