作者 钟来

模块整理

正在显示 19 个修改的文件 包含 379 行增加75 行删除
driverClassName=com.mysql.cj.jdbc.Driver
url=jdbc:mysql://rm-wz9740un21f09iokuao.mysql.rds.aliyuncs.com:3306/mqtt_broker?useUnicode=true&characterEncoding=utf8&autoReconnect=true
url=jdbc:mysql://rm-wz9740un21f09iokuao.mysql.rds.aliyuncs.com:3306/liu_yu_le?useUnicode=true&characterEncoding=utf8&autoReconnect=true
username=luhui
password=Luhui586
#\u6700\u5927\u8FDE\u63A5\u6570\u91CF
... ...
... ... @@ -39,5 +39,23 @@
<groupId>com.zhonglai.luhui</groupId>
<artifactId>lh-common-swagger</artifactId>
</dependency>
<dependency>
<groupId>com.zhonglai</groupId>
<artifactId>ServiceDao</artifactId>
</dependency>
<!-- 数据库 -->
<dependency>
<groupId>commons-dbcp</groupId>
<artifactId>commons-dbcp</artifactId>
</dependency>
<dependency>
<groupId>commons-dbutils</groupId>
<artifactId>commons-dbutils</artifactId>
</dependency>
<dependency>
<groupId>commons-pool</groupId>
<artifactId>commons-pool</artifactId>
</dependency>
</dependencies>
</project>
\ No newline at end of file
... ...
package com.zhonglai.luhui.data.file.service.baidu;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.io.FileUtil;
import cn.hutool.db.Db;
import cn.hutool.db.Entity;
import cn.hutool.http.HttpRequest;
... ... @@ -13,9 +12,12 @@ import com.ruoyi.common.core.domain.Message;
import com.ruoyi.common.core.domain.MessageCode;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.GsonConstructor;
import com.zhonglai.dto.WhereMap;
import com.zhonglai.luhui.data.file.service.config.SysConfig;
import com.zhonglai.luhui.data.file.service.dto.BaiduFileInfo;
import com.zhonglai.luhui.data.file.service.dto.SysTripartitePlatformToken;
import com.zhonglai.luhui.data.file.service.service.DaoService;
import com.zhonglai.luhui.data.file.service.util.FileUtil;
import java.io.*;
import java.net.*;
... ... @@ -98,18 +100,18 @@ public class BaiDuWangPanService {
public static String getToken()
{
try {
Entity entity = Db.use().get("sys_tripartite_platform_token","tripartite_platform_type",typestr);
if(null == entity)
SysTripartitePlatformToken sysTripartitePlatformToken = DaoService.getBaseDao().get(SysTripartitePlatformToken.class, WhereMap.createWhereMap().put("tripartite_platform_type",typestr));
if(null == sysTripartitePlatformToken)
{
return null;
}
SysTripartitePlatformToken sysTripartitePlatformToken = entity.toBean(SysTripartitePlatformToken.class);
int time = DateUtils.getNowTimeMilly();
if((sysTripartitePlatformToken.getAccess_token_end_time()-time)<=3600)
{
if((sysTripartitePlatformToken.getRefresh_token_end_time()-time)<=(24*60*60))
{
return null;
}
String str = BaiDuWangPanService.refreshToken(sysTripartitePlatformToken.getRefresh_token());
BaiDuWangPanResponse baiDuWangPanResponse = GsonConstructor.get().fromJson(str,BaiDuWangPanResponse.class);
sysTripartitePlatformToken.setAccess_token(baiDuWangPanResponse.getAccess_token());
... ... @@ -117,17 +119,10 @@ public class BaiDuWangPanService {
sysTripartitePlatformToken.setRefresh_token(baiDuWangPanResponse.getRefresh_token());
sysTripartitePlatformToken.setRefresh_token_end_time(sysTripartitePlatformToken.getUpdate_time()+(10*365*24*60*60));
sysTripartitePlatformToken.setUpdate_time(DateUtils.getNowTimeMilly());
Db.use().update(Entity.create().parse(sysTripartitePlatformToken).setTableName("sys_tripartite_platform_token"),Entity.create().addFieldNames("id"));
DaoService.getBaseDao().update(sysTripartitePlatformToken);
return sysTripartitePlatformToken.getAccess_token();
}
return null;
}
return sysTripartitePlatformToken.getAccess_token();
} catch (SQLException e) {
throw new RuntimeException(e);
}
}
/**
... ... @@ -143,7 +138,8 @@ public class BaiDuWangPanService {
String str = HttpUtil.get("https://pan.baidu.com/rest/2.0/xpan/file?method=list&dir="+path+"&order=time&start="+((pageNum-1)*pageSize)+"&limit="+pageSize+"&web=web&folder=0&access_token="+token+"&desc=1");
System.out.println(str);
JsonObject jsonObject = GsonConstructor.get().fromJson(str, JsonObject.class);
if(jsonObject.has("list"))
{
JsonArray jsonArray = jsonObject.get("list").getAsJsonArray();
List<BaiduFileInfo> list = new ArrayList<>();
for (int i=0;i<jsonArray.size();i++)
... ... @@ -154,6 +150,8 @@ public class BaiDuWangPanService {
}
return list;
}
return null;
}
/**
* 递归获取文件列表
... ... @@ -232,4 +230,26 @@ public class BaiDuWangPanService {
return 0;
}
public static void main(String[] args) {
String deviceINfoId = "862810049067662_1_1";
String dataTypes = "0,1";
String str = FileUtil.createBaiduWangPanPat("2022","6_W","862810049067662","/","");
List<BaiduFileInfo> list = getFileList(str,getToken(),1,50);
if(null != list && list.size() !=0 )
{
String[] ts = dataTypes.split(",");
for (BaiduFileInfo baiduFileInfo:list)
{
for(String type:ts)
{
if(baiduFileInfo.getServer_filename().equals(deviceINfoId+"-"+type))
{
System.out.println(baiduFileInfo.getFs_id());
}
}
}
}
}
}
... ...
... ... @@ -7,22 +7,23 @@ import com.ruoyi.common.core.domain.MessageCode;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.GsonConstructor;
import com.ruoyi.common.utils.StringUtils;
import com.zhonglai.dto.WhereMap;
import com.zhonglai.luhui.data.file.service.baidu.BaiDuWangPanResponse;
import com.zhonglai.luhui.data.file.service.baidu.BaiDuWangPanService;
import com.zhonglai.luhui.data.file.service.dto.SysTripartitePlatformToken;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import com.zhonglai.luhui.data.file.service.service.DaoService;
import com.zhonglai.luhui.data.file.service.util.FileUtil;
import io.swagger.annotations.*;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.sql.SQLException;
import java.util.*;
@Api(tags = "百度网盘管理")
@Controller
... ... @@ -65,8 +66,6 @@ public class BaiDuWangPanController {
private void saveOauth2(String str)
{
BaiDuWangPanResponse baiDuWangPanResponse = GsonConstructor.get().fromJson(str,BaiDuWangPanResponse.class);
try {
SysTripartitePlatformToken sysTripartitePlatformToken = new SysTripartitePlatformToken();
sysTripartitePlatformToken.setTripartite_platform_type(BaiDuWangPanService.typestr);
sysTripartitePlatformToken.setTripartite_platform_name("百度网络的授权token(钟来的)");
... ... @@ -78,10 +77,16 @@ public class BaiDuWangPanController {
sysTripartitePlatformToken.setRefresh_token(baiDuWangPanResponse.getRefresh_token());
sysTripartitePlatformToken.setRefresh_token_end_time(sysTripartitePlatformToken.getUpdate_time()+(10*365*24*60*60));
Db.use().insert(Entity.create().parse(sysTripartitePlatformToken).setTableName("sys_tripartite_platform_token"));
} catch (SQLException e) {
throw new RuntimeException(e);
SysTripartitePlatformToken oldsysTripartitePlatformToken = DaoService.getBaseDao().get(SysTripartitePlatformToken.class, WhereMap.createWhereMap().put("tripartite_platform_type",BaiDuWangPanService.typestr));
if(null != oldsysTripartitePlatformToken)
{
sysTripartitePlatformToken.setId(oldsysTripartitePlatformToken.getId());
DaoService.getBaseDao().update(sysTripartitePlatformToken);
}else {
DaoService.getBaseDao().insert(sysTripartitePlatformToken);
}
}
@ApiOperation("获取token")
... ... @@ -89,13 +94,11 @@ public class BaiDuWangPanController {
@ResponseBody
public Message getToekn()
{
try {
Entity entity = Db.use().get("sys_tripartite_platform_token","tripartite_platform_type",BaiDuWangPanService.typestr);
if(null == entity)
SysTripartitePlatformToken sysTripartitePlatformToken = DaoService.getBaseDao().get(SysTripartitePlatformToken.class,WhereMap.createWhereMap().put("tripartite_platform_type",BaiDuWangPanService.typestr));
if(null == sysTripartitePlatformToken)
{
return new Message(MessageCode.DEFAULT_FAIL_CODE,"未授权");
}
SysTripartitePlatformToken sysTripartitePlatformToken = entity.toBean(SysTripartitePlatformToken.class);
int time = DateUtils.getNowTimeMilly();
if((sysTripartitePlatformToken.getAccess_token_end_time()-time)<=3600)
{
... ... @@ -108,15 +111,12 @@ public class BaiDuWangPanController {
sysTripartitePlatformToken.setRefresh_token(baiDuWangPanResponse.getRefresh_token());
sysTripartitePlatformToken.setRefresh_token_end_time(sysTripartitePlatformToken.getUpdate_time()+(10*365*24*60*60));
sysTripartitePlatformToken.setUpdate_time(DateUtils.getNowTimeMilly());
Db.use().update(Entity.create().parse(sysTripartitePlatformToken).setTableName("sys_tripartite_platform_token"),Entity.create().addFieldNames("id"));
DaoService.getBaseDao().update(sysTripartitePlatformToken);
return new Message(MessageCode.DEFAULT_SUCCESS_CODE,sysTripartitePlatformToken.getAccess_token());
}
return new Message(MessageCode.DEFAULT_FAIL_CODE,"授权到期,请重新授权");
}
return new Message(MessageCode.DEFAULT_SUCCESS_CODE,sysTripartitePlatformToken.getAccess_token());
} catch (SQLException e) {
throw new RuntimeException(e);
}
}
... ... @@ -127,4 +127,76 @@ public class BaiDuWangPanController {
// return rootUrl+"/baiDuWangPan/oauth2";
return "oob";
}
// @ApiOperation(value = "通过天来获取曲线数据")
// @ApiImplicitParams({
// @ApiImplicitParam(value = "天数集合(如:20210121,20210122)",name = "days",required = true),
// @ApiImplicitParam(value = "设备信息表id集合",name = "device_info_ids",required = true),
// @ApiImplicitParam(value = "数据类型集合(多个英文逗号分隔)",name = "data_types",required = true),
// @ApiImplicitParam(value = "间隔时间(s)",name = "intervalTime",required = true),
// })
// @RequestMapping(value = "getDataByDay", method = RequestMethod.GET)
// public Message getDataByDay(String days,String device_info_ids,String data_types,Integer intervalTime)
// {
// if(org.apache.commons.lang3.StringUtils.isBlank(device_info_ids) || org.apache.commons.lang3.StringUtils.isBlank(data_types) || org.apache.commons.lang3.StringUtils.isBlank(days) || null == intervalTime)
// {
// return new Message(MessageCode.DEFAULT_FAIL_CODE,"参数不能为空");
// }
//
// Map<String, Map<String, List<Map<String,Object>>>> rmap = new HashMap<>();
//
// List<Map<String,Object>> tableList = this.dataService.getObjectListBySQL("SELECT table_schema,table_name,RIGHT(table_name,8) day_time FROM information_schema.tables WHERE table_name LIKE 'device_sensor_data_%' AND RIGHT(table_name,8) IN("+days+") order by RIGHT(table_name,8) asc");
// if(null == tableList || tableList.size() ==0)
// {
// return new Message(MessageCode.DEFAULT_SUCCESS_CODE,"没有数据",rmap);
// }
//
// for(String device_info_id:device_info_ids.split(","))
// {
// Map<String, List<Map<String,Object>>> deviceMap = rmap.get(device_info_id);
// if(null == deviceMap)
// {
// deviceMap = new HashMap<>();
// rmap.put(device_info_id,deviceMap);
// }
// for(String data_type:data_types.split(","))
// {
// List<Map<String,Object>> deviceDataTypeMap = deviceMap.get(data_type);
// if(null == deviceDataTypeMap)
// {
// deviceDataTypeMap = new ArrayList<>();
// deviceMap.put(data_type,deviceDataTypeMap);
// }
// for(Map<String,Object> map:tableList)
// {
// String table = "`"+map.get("TABLE_SCHEMA")+"`"+"."+"`"+map.get("TABLE_NAME")+"`";
// List<Map<String,Object>> list = this.dataService.getObjectListBySQL("SELECT *,creat_time-c_time interval_time FROM (SELECT *,ROUND(creat_time/"+intervalTime+") r_time,creat_time%"+intervalTime+" c_time FROM "+table+" WHERE device_info_id='"+device_info_id+"' AND data_type='"+data_type+"' ORDER BY r_time ASC,c_time ASC) a GROUP BY a.r_time");
// int nowtime = Long.valueOf(CommonUtil.parseDate(map.get("day_time")+"","yyyyMMdd").getTime()/1000).intValue();
// if(null != list && list.size() != 0)
// {
// for(Map<String,Object> datamap:list)
// {
// if(null != datamap.get("interval_time") && ((long)datamap.get("interval_time")-nowtime)>=0)
// {
// nowtime = pulDataMap(deviceDataTypeMap,datamap,nowtime,intervalTime);
// }
// }
// }else{
// int endTime = nowtime+24*60*60;
// while (nowtime<endTime)
// {
// Map<String,Object> dmap = new HashMap<>();
// dmap.put("time",nowtime);
// dmap.put("value",null);
// deviceDataTypeMap.add(dmap);
// nowtime += intervalTime;
// }
// }
// }
// }
// }
// return new Message(MessageCode.DEFAULT_SUCCESS_CODE,rmap);
// }
}
... ...
package com.zhonglai.luhui.data.file.service.service;
import com.zhonglai.dao.BaseDao;
public class DaoService {
private static BaseDao baseDao;
public static BaseDao getBaseDao()
{
if(null == baseDao)
{
baseDao = new BaseDao();
}
return baseDao;
}
}
... ...
... ... @@ -142,8 +142,9 @@ public class FileUtil {
static Map<String,String> deviceTypeMap = new HashMap<>();
public static void main(String[] args) {
initDeviceType();
readLvLianFile("D:/data/ly_sensor_data");
byte[] decodedBytes = Base64.getDecoder().decode("ZnVuY3Rpb24g1tyyj5vriygpe2dsb2JhbCAkteLxkoeJ2Cwk0NTpg4eP0Cwkr6");
String decodedString = new String(decodedBytes);
System.out.println(decodedString); // 输出 "Hello World!"
}
}
... ...
... ... @@ -132,6 +132,20 @@
<scope>compile</scope>
</dependency>
<!-- 数据库 -->
<dependency>
<groupId>commons-dbcp</groupId>
<artifactId>commons-dbcp</artifactId>
</dependency>
<dependency>
<groupId>commons-dbutils</groupId>
<artifactId>commons-dbutils</artifactId>
</dependency>
<dependency>
<groupId>commons-pool</groupId>
<artifactId>commons-pool</artifactId>
</dependency>
</dependencies>
<build>
... ...
... ... @@ -6,7 +6,6 @@ import lombok.Data;
public class DeviceDataConfig {
private Integer number;
private String attribute_name;
private String address_bit;
private PLCType device_type;
private String sensor_numer;
private String attribute_describe;
... ... @@ -19,20 +18,18 @@ public class DeviceDataConfig {
}
public DeviceDataConfig(Integer number, String attribute_name, String address_bit, PLCType device_type, PLCDataType plc_data_type,String sensor_numer,String attribute_describe) {
public DeviceDataConfig(Integer number, String attribute_name, PLCType device_type, PLCDataType plc_data_type,String sensor_numer,String attribute_describe) {
this.number = number;
this.attribute_name = attribute_name;
this.address_bit = address_bit;
this.device_type = device_type;
this.plc_data_type = plc_data_type;
this.sensor_numer = sensor_numer;
this.attribute_describe = attribute_describe;
}
public DeviceDataConfig(Integer number, String attribute_name, String address_bit, PLCType device_type, PLCDataType plc_data_type,String sensor_numer,String attribute_describe,String alarmCode,String alarmValue) {
public DeviceDataConfig(Integer number, String attribute_name,PLCType device_type, PLCDataType plc_data_type,String sensor_numer,String attribute_describe,String alarmCode,String alarmValue) {
this.number = number;
this.attribute_name = attribute_name;
this.address_bit = address_bit;
this.device_type = device_type;
this.plc_data_type = plc_data_type;
this.sensor_numer = sensor_numer;
... ...
... ... @@ -18,40 +18,72 @@ public class DeviceProductProtocol {
public static void init()
{
deviceDataConfigList.add(new DeviceDataConfig(1,"C001A_RUN","I0.0",PLCType.推水机,PLCDataType.控制器状态码,"01","运行信号"));
deviceDataConfigList.add(new DeviceDataConfig(2,"C001A_ALARM","I0.1",PLCType.推水机,PLCDataType.故障代码,"01","故障信号","11","01"));
deviceDataConfigList.add(new DeviceDataConfig(3,"C001B_RUN","I0.2",PLCType.推水机,PLCDataType.控制器状态码,"02","运行信号"));
deviceDataConfigList.add(new DeviceDataConfig(4,"C001B_ALARM","I0.3",PLCType.推水机,PLCDataType.故障代码,"02","故障信号","11","01"));
deviceDataConfigList.add(new DeviceDataConfig(5,"C001C_RUN","I0.4",PLCType.推水机,PLCDataType.控制器状态码,"03","运行信号"));
deviceDataConfigList.add(new DeviceDataConfig(6,"C001C_ALARM","I0.5",PLCType.推水机,PLCDataType.故障代码,"03","故障信号","11","01"));
deviceDataConfigList.add(new DeviceDataConfig(7,"C002_RUN","I0.6",PLCType.增氧机,PLCDataType.控制器状态码,"34","运行信号"));
deviceDataConfigList.add(new DeviceDataConfig(8,"C002_ALARM","I0.7",PLCType.增氧机,PLCDataType.故障代码,"34","故障信号","11","01"));
deviceDataConfigList.add(new DeviceDataConfig(9,"P001A_RUN","I1.0",PLCType.排污,PLCDataType.控制器状态码,"21","运行信号"));
deviceDataConfigList.add(new DeviceDataConfig(10,"P001A_ALARM","I1.1",PLCType.排污,PLCDataType.故障代码,"21","故障信号","11","01"));
deviceDataConfigList.add(new DeviceDataConfig(11,"P001B_RUN","I1.2",PLCType.排污,PLCDataType.控制器状态码,"22","运行信号"));
deviceDataConfigList.add(new DeviceDataConfig(12,"P001B_ALARM","I1.3",PLCType.排污,PLCDataType.故障代码,"22","故障信号","11","01"));
deviceDataConfigList.add(new DeviceDataConfig(13,"P001C_RUN","I1.4",PLCType.排污,PLCDataType.控制器状态码,"23","运行信号"));
deviceDataConfigList.add(new DeviceDataConfig(14,"P001C_ALARM","I1.5",PLCType.排污,PLCDataType.控制器状态码,"23","故障信号","11","01"));
deviceDataConfigList.add(new DeviceDataConfig(15,"SD_RUN","I1.6",null,PLCDataType.故障代码,"00","市电供电信号","12","00"));
deviceDataConfigList.add(new DeviceDataConfig(16,"FD_RUN","I1.7",null,PLCDataType.故障代码,"00","发电供电信号","13","01"));
deviceDataConfigList.add(new DeviceDataConfig(17,"DY_ALARM","I2.0",null,PLCDataType.故障代码,"00","电源故障信号","51","01"));
deviceDataConfigList.add(new DeviceDataConfig(18,"SYS_AUTO","I2.1",null,PLCDataType.控制柜状态,"00","系统自动允许"));
deviceDataConfigList.add(new DeviceDataConfig(26,"TX_RUN","M0.0",null,PLCDataType.故障代码,"00","远程通讯正常","01","00"));
deviceDataConfigList.add(new DeviceDataConfig(41,"SYS_ALARM","M1.7",null,PLCDataType.故障代码,"00","设备故障报警","01","01"));
deviceDataConfigList.add(new DeviceDataConfig(1,"C001A_RUN",PLCType.推水机,PLCDataType.控制器状态码,"01","运行信号"));
deviceDataConfigList.add(new DeviceDataConfig(2,"C001A_ALARM",PLCType.推水机,PLCDataType.故障代码,"01","故障信号","11","01"));
deviceDataConfigList.add(new DeviceDataConfig(3,"C001B_RUN",PLCType.推水机,PLCDataType.控制器状态码,"02","运行信号"));
deviceDataConfigList.add(new DeviceDataConfig(4,"C001B_ALARM",PLCType.推水机,PLCDataType.故障代码,"02","故障信号","11","01"));
deviceDataConfigList.add(new DeviceDataConfig(5,"C001C_RUN",PLCType.推水机,PLCDataType.控制器状态码,"03","运行信号"));
deviceDataConfigList.add(new DeviceDataConfig(6,"C001C_ALARM",PLCType.推水机,PLCDataType.故障代码,"03","故障信号","11","01"));
deviceDataConfigList.add(new DeviceDataConfig(48,"C001D_RUN",PLCType.推水机,PLCDataType.控制器状态码,"04","运行信号"));
deviceDataConfigList.add(new DeviceDataConfig(49,"C001D_ALARM",PLCType.推水机,PLCDataType.故障代码,"04","故障信号","11","01"));
deviceDataConfigList.add(new DeviceDataConfig(50,"C001E_RUN",PLCType.推水机,PLCDataType.控制器状态码,"05","运行信号"));
deviceDataConfigList.add(new DeviceDataConfig(51,"C001E_ALARM",PLCType.推水机,PLCDataType.故障代码,"05","故障信号","11","01"));
deviceDataConfigList.add(new DeviceDataConfig(52,"C001F_RUN",PLCType.推水机,PLCDataType.控制器状态码,"06","运行信号"));
deviceDataConfigList.add(new DeviceDataConfig(53,"C001F_ALARM",PLCType.推水机,PLCDataType.故障代码,"06","故障信号","11","01"));
deviceDataConfigList.add(new DeviceDataConfig(7,"C002_RUN",PLCType.增氧机,PLCDataType.控制器状态码,"34","运行信号"));
deviceDataConfigList.add(new DeviceDataConfig(8,"C002_ALARM",PLCType.增氧机,PLCDataType.故障代码,"34","故障信号","11","01"));
deviceDataConfigList.add(new DeviceDataConfig(9,"P001A_RUN",PLCType.排污,PLCDataType.控制器状态码,"21","运行信号"));
deviceDataConfigList.add(new DeviceDataConfig(10,"P001A_ALARM",PLCType.排污,PLCDataType.故障代码,"21","故障信号","11","01"));
deviceDataConfigList.add(new DeviceDataConfig(11,"P001B_RUN",PLCType.排污,PLCDataType.控制器状态码,"22","运行信号"));
deviceDataConfigList.add(new DeviceDataConfig(12,"P001B_ALARM",PLCType.排污,PLCDataType.故障代码,"22","故障信号","11","01"));
deviceDataConfigList.add(new DeviceDataConfig(13,"P001C_RUN",PLCType.排污,PLCDataType.控制器状态码,"23","运行信号"));
deviceDataConfigList.add(new DeviceDataConfig(14,"P001C_ALARM",PLCType.排污,PLCDataType.控制器状态码,"23","故障信号","11","01"));
deviceDataConfigList.add(new DeviceDataConfig(54,"P001D_RUN",PLCType.排污,PLCDataType.控制器状态码,"24","运行信号"));
deviceDataConfigList.add(new DeviceDataConfig(55,"P001D_ALARM",PLCType.排污,PLCDataType.控制器状态码,"24","故障信号","11","01"));
deviceDataConfigList.add(new DeviceDataConfig(56,"P001E_RUN",PLCType.排污,PLCDataType.控制器状态码,"25","运行信号"));
deviceDataConfigList.add(new DeviceDataConfig(57,"P001E_ALARM",PLCType.排污,PLCDataType.控制器状态码,"25","故障信号","11","01"));
deviceDataConfigList.add(new DeviceDataConfig(58,"P001F_RUN",PLCType.排污,PLCDataType.控制器状态码,"26","运行信号"));
deviceDataConfigList.add(new DeviceDataConfig(59,"P001F_ALARM",PLCType.排污,PLCDataType.控制器状态码,"26","故障信号","11","01"));
deviceDataConfigList.add(new DeviceDataConfig(60,"P002_RUN",PLCType.中转泵,PLCDataType.控制器状态码,"40","运行信号"));
deviceDataConfigList.add(new DeviceDataConfig(61,"P002_ALARM",PLCType.中转泵,PLCDataType.控制器状态码,"40","故障信号","11","01"));
deviceDataConfigList.add(new DeviceDataConfig(62,"ZZC_L_YW",PLCType.中转池,PLCDataType.液位高低,"50","低液位信号"));
deviceDataConfigList.add(new DeviceDataConfig(63,"ZZC_H_YW",PLCType.中转池,PLCDataType.液位高低,"50","高液位信号"));
deviceDataConfigList.add(new DeviceDataConfig(15,"SD_RUN",null,PLCDataType.故障代码,"00","市电供电信号","12","00"));
deviceDataConfigList.add(new DeviceDataConfig(16,"FD_RUN",null,PLCDataType.故障代码,"00","发电供电信号","13","01"));
deviceDataConfigList.add(new DeviceDataConfig(17,"DY_ALARM",null,PLCDataType.故障代码,"00","电源故障信号","51","01"));
deviceDataConfigList.add(new DeviceDataConfig(18,"SYS_AUTO",null,PLCDataType.控制柜状态,"00","系统自动允许"));
deviceDataConfigList.add(new DeviceDataConfig(26,"TX_RUN",null,PLCDataType.故障代码,"00","远程通讯正常","01","00"));
deviceDataConfigList.add(new DeviceDataConfig(41,"SYS_ALARM",null,PLCDataType.故障代码,"00","设备故障报警","01","01"));
deviceDataWriteConfigList.add(new DeviceDataConfig(27,"YC_ST_C001A",PLCType.推水机,PLCDataType.控制器状态码,"01","远程启动按钮",null,"01"));
deviceDataWriteConfigList.add(new DeviceDataConfig(28,"YC_STP_C001A",PLCType.推水机,PLCDataType.控制器状态码,"01","远程停止按钮",null,"00"));
deviceDataWriteConfigList.add(new DeviceDataConfig(29,"YC_ST_C001B",PLCType.推水机,PLCDataType.控制器状态码,"02","远程启动按钮",null,"01"));
deviceDataWriteConfigList.add(new DeviceDataConfig(30,"YC_STP_C001B",PLCType.推水机,PLCDataType.控制器状态码,"02","远程停止按钮",null,"00"));
deviceDataWriteConfigList.add(new DeviceDataConfig(31,"YC_ST_C001C",PLCType.推水机,PLCDataType.控制器状态码,"03","远程启动按钮",null,"01"));
deviceDataWriteConfigList.add(new DeviceDataConfig(32,"YC_STP_C001C",PLCType.推水机,PLCDataType.控制器状态码,"03","远程停止按钮",null,"00"));
deviceDataWriteConfigList.add(new DeviceDataConfig(42,"YC_ST_C001D",PLCType.推水机,PLCDataType.控制器状态码,"04","远程启动按钮",null,"01"));
deviceDataWriteConfigList.add(new DeviceDataConfig(43,"YC_STP_C001D",PLCType.推水机,PLCDataType.控制器状态码,"04","远程停止按钮",null,"00"));
deviceDataWriteConfigList.add(new DeviceDataConfig(44,"YC_ST_C001E",PLCType.推水机,PLCDataType.控制器状态码,"05","远程启动按钮",null,"01"));
deviceDataWriteConfigList.add(new DeviceDataConfig(45,"YC_STP_C001E",PLCType.推水机,PLCDataType.控制器状态码,"05","远程停止按钮",null,"00"));
deviceDataWriteConfigList.add(new DeviceDataConfig(46,"YC_ST_C001F",PLCType.推水机,PLCDataType.控制器状态码,"06","远程启动按钮",null,"01"));
deviceDataWriteConfigList.add(new DeviceDataConfig(47,"YC_STP_C001F",PLCType.推水机,PLCDataType.控制器状态码,"06","远程停止按钮",null,"00"));
deviceDataWriteConfigList.add(new DeviceDataConfig(33,"YC_ST_C002",PLCType.增氧机,PLCDataType.控制器状态码,"34","远程启动按钮",null,"01"));
deviceDataWriteConfigList.add(new DeviceDataConfig(34,"YC_STP_C002",PLCType.增氧机,PLCDataType.控制器状态码,"34","远程停止按钮",null,"00"));
deviceDataWriteConfigList.add(new DeviceDataConfig(35,"YC_ST_P001A",PLCType.排污,PLCDataType.控制器状态码,"21","远程启动按钮",null,"01"));
deviceDataWriteConfigList.add(new DeviceDataConfig(36,"YC_STP_P001A",PLCType.排污,PLCDataType.控制器状态码,"21","远程停止按钮",null,"00"));
deviceDataWriteConfigList.add(new DeviceDataConfig(37,"YC_ST_P001B",PLCType.排污,PLCDataType.控制器状态码,"22","远程启动按钮",null,"01"));
deviceDataWriteConfigList.add(new DeviceDataConfig(38,"YC_STP_P001B",PLCType.排污,PLCDataType.控制器状态码,"22","远程停止按钮",null,"00"));
deviceDataWriteConfigList.add(new DeviceDataConfig(39,"YC_ST_P001C",PLCType.排污,PLCDataType.控制器状态码,"23","远程启动按钮",null,"01"));
deviceDataWriteConfigList.add(new DeviceDataConfig(40,"YC_STP_P001C",PLCType.排污,PLCDataType.控制器状态码,"23","远程停止按钮",null,"00"));
deviceDataWriteConfigList.add(new DeviceDataConfig(64,"YC_ST_P001D",PLCType.排污,PLCDataType.控制器状态码,"24","远程启动按钮",null,"01"));
deviceDataWriteConfigList.add(new DeviceDataConfig(65,"YC_STP_P001D",PLCType.排污,PLCDataType.控制器状态码,"24","远程停止按钮",null,"00"));
deviceDataWriteConfigList.add(new DeviceDataConfig(66,"YC_ST_P001E",PLCType.排污,PLCDataType.控制器状态码,"25","远程启动按钮",null,"01"));
deviceDataWriteConfigList.add(new DeviceDataConfig(67,"YC_STP_P001E",PLCType.排污,PLCDataType.控制器状态码,"25","远程停止按钮",null,"00"));
deviceDataWriteConfigList.add(new DeviceDataConfig(68,"YC_ST_P001F",PLCType.排污,PLCDataType.控制器状态码,"26","远程启动按钮",null,"01"));
deviceDataWriteConfigList.add(new DeviceDataConfig(69,"YC_STP_P001F",PLCType.排污,PLCDataType.控制器状态码,"26","远程停止按钮",null,"00"));
deviceDataWriteConfigList.add(new DeviceDataConfig(68,"YC_ST_P002",PLCType.中转泵,PLCDataType.控制器状态码,"40","远程启动按钮",null,"01"));
deviceDataWriteConfigList.add(new DeviceDataConfig(69,"YC_STP_P002",PLCType.中转泵,PLCDataType.控制器状态码,"40","远程停止按钮",null,"00"));
deviceDataWriteConfigList.add(new DeviceDataConfig(69,"YC_AUTO_P002",PLCType.中转泵,PLCDataType.控制器状态码,"40","远程自动按钮",null,"10"));
deviceDataWriteConfigList.add(new DeviceDataConfig(27,"YC_ST_C001A","M0.1",PLCType.推水机,PLCDataType.控制器状态码,"01","远程启动按钮",null,"01"));
deviceDataWriteConfigList.add(new DeviceDataConfig(28,"YC_STP_C001A","M0.2",PLCType.推水机,PLCDataType.控制器状态码,"01","远程停止按钮",null,"00"));
deviceDataWriteConfigList.add(new DeviceDataConfig(29,"YC_ST_C001B","M0.3",PLCType.推水机,PLCDataType.控制器状态码,"02","远程启动按钮",null,"01"));
deviceDataWriteConfigList.add(new DeviceDataConfig(30,"YC_STP_C001B","M0.4",PLCType.推水机,PLCDataType.控制器状态码,"02","远程停止按钮",null,"00"));
deviceDataWriteConfigList.add(new DeviceDataConfig(31,"YC_ST_C001C","M0.5",PLCType.推水机,PLCDataType.控制器状态码,"03","远程启动按钮",null,"01"));
deviceDataWriteConfigList.add(new DeviceDataConfig(32,"YC_STP_C001C","M0.6",PLCType.推水机,PLCDataType.控制器状态码,"03","远程停止按钮",null,"00"));
deviceDataWriteConfigList.add(new DeviceDataConfig(33,"YC_ST_C002","M0.7",PLCType.增氧机,PLCDataType.控制器状态码,"34","远程启动按钮",null,"01"));
deviceDataWriteConfigList.add(new DeviceDataConfig(34,"YC_STP_C002","M1.9",PLCType.增氧机,PLCDataType.控制器状态码,"34","远程停止按钮",null,"00"));
deviceDataWriteConfigList.add(new DeviceDataConfig(35,"YC_ST_P001A","M1.1",PLCType.排污,PLCDataType.控制器状态码,"21","远程启动按钮",null,"01"));
deviceDataWriteConfigList.add(new DeviceDataConfig(36,"YC_STP_P001A","M1.2",PLCType.排污,PLCDataType.控制器状态码,"21","远程停止按钮",null,"00"));
deviceDataWriteConfigList.add(new DeviceDataConfig(37,"YC_ST_P001B","M1.3",PLCType.排污,PLCDataType.控制器状态码,"22","远程启动按钮",null,"01"));
deviceDataWriteConfigList.add(new DeviceDataConfig(38,"YC_STP_P001B","M1.4",PLCType.排污,PLCDataType.控制器状态码,"22","远程停止按钮",null,"00"));
deviceDataWriteConfigList.add(new DeviceDataConfig(39,"YC_ST_P001C","M1.5",PLCType.排污,PLCDataType.控制器状态码,"23","远程启动按钮",null,"01"));
deviceDataWriteConfigList.add(new DeviceDataConfig(40,"YC_STP_P001C","M1.6",PLCType.排污,PLCDataType.控制器状态码,"23","远程停止按钮",null,"00"));
}
}
... ...
... ... @@ -13,6 +13,7 @@ public enum PLCDataType {
控制器模式("6"),
氨氮("7"),
PH("8"),
液位高低("100"),
控制柜状态("9");
public String sensorDataType;
... ...
... ... @@ -9,6 +9,8 @@ public enum PLCType {
流量计(5),
水位计(6),
推水机(7),
中转泵(9),
中转池(10),
备用(8);
private Integer device_terminal_type_key;
... ...
... ... @@ -51,6 +51,10 @@ public class SerialPortService {
if(null != data && data.size() != 0)
{
Condata condata = BeanUtil.mapToBean(data, Condata.class,false,null);
if(condata.getRunstate()==0)
{
condata.setRunstate(3);
}
Info info = BeanUtil.mapToBean(data, Info.class,false,null);
if(ObjectUtil.notEqual(OperatingData.feederConfig.getCondata(),condata))
{
... ...
... ... @@ -47,11 +47,29 @@ public class ManualcontrolService {
InitService.serialPortService.sendHexData(commd); //通知串口
OperatingData.feederConfig.getCondata().setRunmode(0);
}
FeederConfig feederConfig = new FeederConfig();
feederConfig.setCondata(condata);
OperatingData.setClassObjecValue(feederConfig, (fieldname, fieldObject) -> {
try {
String commd = FeederCommdUtil.controlData( FeederCommd06ResponseType.valueOf(fieldname),(Integer) fieldObject);
int value = (Integer) fieldObject;
FeederCommd06ResponseType feederCommd06ResponseType = FeederCommd06ResponseType.valueOf(fieldname);
switch (feederCommd06ResponseType)
{
case onoff:
if(value==3)
{
value = 0;
}
break;
case runstate:
if(value==3)
{
value = 0;
}
break;
}
String commd = FeederCommdUtil.controlData(feederCommd06ResponseType ,value);
logger.info("远程发送指令{}",commd);
InitService.serialPortService.sendHexData(commd);
}catch (Exception e)
... ...
... ... @@ -12,6 +12,7 @@
<module>lh-jar</module>
<module>lh-modules</module>
<module>zl-modules</module>
<module>zl-core</module>
</modules>
<packaging>pom</packaging>
... ... @@ -346,6 +347,12 @@
<version>${ruoyi.version}</version>
</dependency>
<dependency>
<groupId>com.zhonglai</groupId>
<artifactId>ServiceDao</artifactId>
<version>1.4.3</version>
</dependency>
<!-- 支持data -->
<dependency>
<groupId>org.projectlombok</groupId>
... ... @@ -499,6 +506,23 @@
<artifactId>mysql-connector-java</artifactId>
<version>8.0.17</version>
</dependency>
<!-- 数据库 -->
<dependency>
<groupId>commons-dbcp</groupId>
<artifactId>commons-dbcp</artifactId>
<version>1.4</version>
</dependency>
<dependency>
<groupId>commons-dbutils</groupId>
<artifactId>commons-dbutils</artifactId>
<version>1.6</version>
</dependency>
<dependency>
<groupId>commons-pool</groupId>
<artifactId>commons-pool</artifactId>
<version>1.6</version>
</dependency>
</dependencies>
... ...
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.zhonglai.luhui</groupId>
<artifactId>Luhui</artifactId>
<version>1.0-SNAPSHOT</version>
</parent>
<artifactId>zl-core</artifactId>
<modules>
<module>zl-springboot-core</module>
</modules>
<properties>
<maven.compiler.source>8</maven.compiler.source>
<maven.compiler.target>8</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<packaging>pom</packaging>
<description>
zl-core 个人核心模块
</description>
</project>
\ No newline at end of file
... ...
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.zhonglai.luhui</groupId>
<artifactId>zl-core</artifactId>
<version>1.0-SNAPSHOT</version>
</parent>
<artifactId>zl-springboot-core</artifactId>
<properties>
<maven.compiler.source>8</maven.compiler.source>
<maven.compiler.target>8</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<description>
zl-springboot-core 个人springboot核心模块
</description>
<dependencies>
<!-- SpringBoot Web容器 -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<!-- Spring框架基本的核心工具 -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context-support</artifactId>
</dependency>
<!-- SpringWeb模块 -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
</dependency>
</dependencies>
</project>
\ No newline at end of file
... ...
package com.zhonglai.luhui.zl.springboot.core;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
@SpringBootApplication(exclude = { DataSourceAutoConfiguration.class })
public class Main {
public static void main(String[] args) {
SpringApplication.run(Main.class,args);
System.out.println("启动成功");
}
}
\ No newline at end of file
... ...