作者 钟来

模块整理

正在显示 19 个修改的文件 包含 428 行增加124 行删除
1 driverClassName=com.mysql.cj.jdbc.Driver 1 driverClassName=com.mysql.cj.jdbc.Driver
2 -url=jdbc:mysql://rm-wz9740un21f09iokuao.mysql.rds.aliyuncs.com:3306/mqtt_broker?useUnicode=true&characterEncoding=utf8&autoReconnect=true 2 +url=jdbc:mysql://rm-wz9740un21f09iokuao.mysql.rds.aliyuncs.com:3306/liu_yu_le?useUnicode=true&characterEncoding=utf8&autoReconnect=true
3 username=luhui 3 username=luhui
4 password=Luhui586 4 password=Luhui586
5 #\u6700\u5927\u8FDE\u63A5\u6570\u91CF 5 #\u6700\u5927\u8FDE\u63A5\u6570\u91CF
@@ -35,7 +35,7 @@ public interface PublicMapper { @@ -35,7 +35,7 @@ public interface PublicMapper {
35 * 指定表名添加对象集合 35 * 指定表名添加对象集合
36 */ 36 */
37 @InsertProvider(type = PublicSQL.class, method = "insertAllToTable") 37 @InsertProvider(type = PublicSQL.class, method = "insertAllToTable")
38 - int insertAllToTable(@Param("list")List<?> list,@Param("tableName")String tableName); 38 + int insertAllToTable(@Param("list")List<?> list,@Param("tableName")String tableName);
39 39
40 /** 40 /**
41 * 更新对象不为空的属性 41 * 更新对象不为空的属性
@@ -39,5 +39,23 @@ @@ -39,5 +39,23 @@
39 <groupId>com.zhonglai.luhui</groupId> 39 <groupId>com.zhonglai.luhui</groupId>
40 <artifactId>lh-common-swagger</artifactId> 40 <artifactId>lh-common-swagger</artifactId>
41 </dependency> 41 </dependency>
  42 + <dependency>
  43 + <groupId>com.zhonglai</groupId>
  44 + <artifactId>ServiceDao</artifactId>
  45 + </dependency>
  46 +
  47 + <!-- 数据库 -->
  48 + <dependency>
  49 + <groupId>commons-dbcp</groupId>
  50 + <artifactId>commons-dbcp</artifactId>
  51 + </dependency>
  52 + <dependency>
  53 + <groupId>commons-dbutils</groupId>
  54 + <artifactId>commons-dbutils</artifactId>
  55 + </dependency>
  56 + <dependency>
  57 + <groupId>commons-pool</groupId>
  58 + <artifactId>commons-pool</artifactId>
  59 + </dependency>
42 </dependencies> 60 </dependencies>
43 </project> 61 </project>
1 package com.zhonglai.luhui.data.file.service.baidu; 1 package com.zhonglai.luhui.data.file.service.baidu;
2 2
3 import cn.hutool.core.bean.BeanUtil; 3 import cn.hutool.core.bean.BeanUtil;
4 -import cn.hutool.core.io.FileUtil;  
5 import cn.hutool.db.Db; 4 import cn.hutool.db.Db;
6 import cn.hutool.db.Entity; 5 import cn.hutool.db.Entity;
7 import cn.hutool.http.HttpRequest; 6 import cn.hutool.http.HttpRequest;
@@ -13,9 +12,12 @@ import com.ruoyi.common.core.domain.Message; @@ -13,9 +12,12 @@ import com.ruoyi.common.core.domain.Message;
13 import com.ruoyi.common.core.domain.MessageCode; 12 import com.ruoyi.common.core.domain.MessageCode;
14 import com.ruoyi.common.utils.DateUtils; 13 import com.ruoyi.common.utils.DateUtils;
15 import com.ruoyi.common.utils.GsonConstructor; 14 import com.ruoyi.common.utils.GsonConstructor;
  15 +import com.zhonglai.dto.WhereMap;
16 import com.zhonglai.luhui.data.file.service.config.SysConfig; 16 import com.zhonglai.luhui.data.file.service.config.SysConfig;
17 import com.zhonglai.luhui.data.file.service.dto.BaiduFileInfo; 17 import com.zhonglai.luhui.data.file.service.dto.BaiduFileInfo;
18 import com.zhonglai.luhui.data.file.service.dto.SysTripartitePlatformToken; 18 import com.zhonglai.luhui.data.file.service.dto.SysTripartitePlatformToken;
  19 +import com.zhonglai.luhui.data.file.service.service.DaoService;
  20 +import com.zhonglai.luhui.data.file.service.util.FileUtil;
19 21
20 import java.io.*; 22 import java.io.*;
21 import java.net.*; 23 import java.net.*;
@@ -98,36 +100,29 @@ public class BaiDuWangPanService { @@ -98,36 +100,29 @@ public class BaiDuWangPanService {
98 100
99 public static String getToken() 101 public static String getToken()
100 { 102 {
101 - try {  
102 - Entity entity = Db.use().get("sys_tripartite_platform_token","tripartite_platform_type",typestr);  
103 - if(null == entity)  
104 - {  
105 - return null;  
106 - }  
107 - SysTripartitePlatformToken sysTripartitePlatformToken = entity.toBean(SysTripartitePlatformToken.class);  
108 - int time = DateUtils.getNowTimeMilly();  
109 - if((sysTripartitePlatformToken.getAccess_token_end_time()-time)<=3600) 103 + SysTripartitePlatformToken sysTripartitePlatformToken = DaoService.getBaseDao().get(SysTripartitePlatformToken.class, WhereMap.createWhereMap().put("tripartite_platform_type",typestr));
  104 + if(null == sysTripartitePlatformToken)
  105 + {
  106 + return null;
  107 + }
  108 + int time = DateUtils.getNowTimeMilly();
  109 + if((sysTripartitePlatformToken.getAccess_token_end_time()-time)<=3600)
  110 + {
  111 + if((sysTripartitePlatformToken.getRefresh_token_end_time()-time)<=(24*60*60))
110 { 112 {
111 - if((sysTripartitePlatformToken.getRefresh_token_end_time()-time)<=(24*60*60))  
112 - {  
113 - String str = BaiDuWangPanService.refreshToken(sysTripartitePlatformToken.getRefresh_token());  
114 - BaiDuWangPanResponse baiDuWangPanResponse = GsonConstructor.get().fromJson(str,BaiDuWangPanResponse.class);  
115 - sysTripartitePlatformToken.setAccess_token(baiDuWangPanResponse.getAccess_token());  
116 - sysTripartitePlatformToken.setAccess_token_end_time(sysTripartitePlatformToken.getUpdate_time()+baiDuWangPanResponse.getExpires_in());  
117 - sysTripartitePlatformToken.setRefresh_token(baiDuWangPanResponse.getRefresh_token());  
118 - sysTripartitePlatformToken.setRefresh_token_end_time(sysTripartitePlatformToken.getUpdate_time()+(10*365*24*60*60));  
119 - sysTripartitePlatformToken.setUpdate_time(DateUtils.getNowTimeMilly());  
120 - Db.use().update(Entity.create().parse(sysTripartitePlatformToken).setTableName("sys_tripartite_platform_token"),Entity.create().addFieldNames("id"));  
121 - return sysTripartitePlatformToken.getAccess_token();  
122 - }  
123 return null; 113 return null;
124 } 114 }
  115 + String str = BaiDuWangPanService.refreshToken(sysTripartitePlatformToken.getRefresh_token());
  116 + BaiDuWangPanResponse baiDuWangPanResponse = GsonConstructor.get().fromJson(str,BaiDuWangPanResponse.class);
  117 + sysTripartitePlatformToken.setAccess_token(baiDuWangPanResponse.getAccess_token());
  118 + sysTripartitePlatformToken.setAccess_token_end_time(sysTripartitePlatformToken.getUpdate_time()+baiDuWangPanResponse.getExpires_in());
  119 + sysTripartitePlatformToken.setRefresh_token(baiDuWangPanResponse.getRefresh_token());
  120 + sysTripartitePlatformToken.setRefresh_token_end_time(sysTripartitePlatformToken.getUpdate_time()+(10*365*24*60*60));
  121 + sysTripartitePlatformToken.setUpdate_time(DateUtils.getNowTimeMilly());
  122 + DaoService.getBaseDao().update(sysTripartitePlatformToken);
125 return sysTripartitePlatformToken.getAccess_token(); 123 return sysTripartitePlatformToken.getAccess_token();
126 - } catch (SQLException e) {  
127 - throw new RuntimeException(e);  
128 } 124 }
129 -  
130 - 125 + return sysTripartitePlatformToken.getAccess_token();
131 } 126 }
132 127
133 /** 128 /**
@@ -143,16 +138,19 @@ public class BaiDuWangPanService { @@ -143,16 +138,19 @@ public class BaiDuWangPanService {
143 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"); 138 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");
144 System.out.println(str); 139 System.out.println(str);
145 JsonObject jsonObject = GsonConstructor.get().fromJson(str, JsonObject.class); 140 JsonObject jsonObject = GsonConstructor.get().fromJson(str, JsonObject.class);
146 -  
147 - JsonArray jsonArray = jsonObject.get("list").getAsJsonArray();  
148 - List<BaiduFileInfo> list = new ArrayList<>();  
149 - for (int i=0;i<jsonArray.size();i++) 141 + if(jsonObject.has("list"))
150 { 142 {
151 - JsonObject file = jsonArray.get(i).getAsJsonObject();  
152 - BaiduFileInfo baiduFileInfo = GsonConstructor.get().fromJson(file.toString(),BaiduFileInfo.class);  
153 - list.add(baiduFileInfo); 143 + JsonArray jsonArray = jsonObject.get("list").getAsJsonArray();
  144 + List<BaiduFileInfo> list = new ArrayList<>();
  145 + for (int i=0;i<jsonArray.size();i++)
  146 + {
  147 + JsonObject file = jsonArray.get(i).getAsJsonObject();
  148 + BaiduFileInfo baiduFileInfo = GsonConstructor.get().fromJson(file.toString(),BaiduFileInfo.class);
  149 + list.add(baiduFileInfo);
  150 + }
  151 + return list;
154 } 152 }
155 - return list; 153 + return null;
156 } 154 }
157 155
158 /** 156 /**
@@ -232,4 +230,26 @@ public class BaiDuWangPanService { @@ -232,4 +230,26 @@ public class BaiDuWangPanService {
232 return 0; 230 return 0;
233 } 231 }
234 232
  233 + public static void main(String[] args) {
  234 + String deviceINfoId = "862810049067662_1_1";
  235 + String dataTypes = "0,1";
  236 + String str = FileUtil.createBaiduWangPanPat("2022","6_W","862810049067662","/","");
  237 + List<BaiduFileInfo> list = getFileList(str,getToken(),1,50);
  238 + if(null != list && list.size() !=0 )
  239 + {
  240 + String[] ts = dataTypes.split(",");
  241 + for (BaiduFileInfo baiduFileInfo:list)
  242 + {
  243 + for(String type:ts)
  244 + {
  245 + if(baiduFileInfo.getServer_filename().equals(deviceINfoId+"-"+type))
  246 + {
  247 + System.out.println(baiduFileInfo.getFs_id());
  248 + }
  249 + }
  250 + }
  251 + }
  252 +
  253 + }
  254 +
235 } 255 }
@@ -7,22 +7,23 @@ import com.ruoyi.common.core.domain.MessageCode; @@ -7,22 +7,23 @@ import com.ruoyi.common.core.domain.MessageCode;
7 import com.ruoyi.common.utils.DateUtils; 7 import com.ruoyi.common.utils.DateUtils;
8 import com.ruoyi.common.utils.GsonConstructor; 8 import com.ruoyi.common.utils.GsonConstructor;
9 import com.ruoyi.common.utils.StringUtils; 9 import com.ruoyi.common.utils.StringUtils;
  10 +import com.zhonglai.dto.WhereMap;
10 import com.zhonglai.luhui.data.file.service.baidu.BaiDuWangPanResponse; 11 import com.zhonglai.luhui.data.file.service.baidu.BaiDuWangPanResponse;
11 import com.zhonglai.luhui.data.file.service.baidu.BaiDuWangPanService; 12 import com.zhonglai.luhui.data.file.service.baidu.BaiDuWangPanService;
12 import com.zhonglai.luhui.data.file.service.dto.SysTripartitePlatformToken; 13 import com.zhonglai.luhui.data.file.service.dto.SysTripartitePlatformToken;
13 -import io.swagger.annotations.Api;  
14 -import io.swagger.annotations.ApiOperation; 14 +import com.zhonglai.luhui.data.file.service.service.DaoService;
  15 +import com.zhonglai.luhui.data.file.service.util.FileUtil;
  16 +import io.swagger.annotations.*;
15 import org.slf4j.Logger; 17 import org.slf4j.Logger;
16 import org.slf4j.LoggerFactory; 18 import org.slf4j.LoggerFactory;
17 import org.springframework.stereotype.Controller; 19 import org.springframework.stereotype.Controller;
18 -import org.springframework.web.bind.annotation.GetMapping;  
19 -import org.springframework.web.bind.annotation.RequestMapping;  
20 -import org.springframework.web.bind.annotation.ResponseBody; 20 +import org.springframework.web.bind.annotation.*;
21 21
22 import javax.servlet.http.HttpServletRequest; 22 import javax.servlet.http.HttpServletRequest;
23 import javax.servlet.http.HttpServletResponse; 23 import javax.servlet.http.HttpServletResponse;
24 import java.io.IOException; 24 import java.io.IOException;
25 import java.sql.SQLException; 25 import java.sql.SQLException;
  26 +import java.util.*;
26 27
27 @Api(tags = "百度网盘管理") 28 @Api(tags = "百度网盘管理")
28 @Controller 29 @Controller
@@ -65,23 +66,27 @@ public class BaiDuWangPanController { @@ -65,23 +66,27 @@ public class BaiDuWangPanController {
65 private void saveOauth2(String str) 66 private void saveOauth2(String str)
66 { 67 {
67 BaiDuWangPanResponse baiDuWangPanResponse = GsonConstructor.get().fromJson(str,BaiDuWangPanResponse.class); 68 BaiDuWangPanResponse baiDuWangPanResponse = GsonConstructor.get().fromJson(str,BaiDuWangPanResponse.class);
  69 + SysTripartitePlatformToken sysTripartitePlatformToken = new SysTripartitePlatformToken();
  70 + sysTripartitePlatformToken.setTripartite_platform_type(BaiDuWangPanService.typestr);
  71 + sysTripartitePlatformToken.setTripartite_platform_name("百度网络的授权token(钟来的)");
  72 + sysTripartitePlatformToken.setCreate_time(DateUtils.getNowTimeMilly());
  73 + sysTripartitePlatformToken.setUpdate_time(DateUtils.getNowTimeMilly());
68 74
69 - try {  
70 - SysTripartitePlatformToken sysTripartitePlatformToken = new SysTripartitePlatformToken();  
71 - sysTripartitePlatformToken.setTripartite_platform_type(BaiDuWangPanService.typestr);  
72 - sysTripartitePlatformToken.setTripartite_platform_name("百度网络的授权token(钟来的)");  
73 - sysTripartitePlatformToken.setCreate_time(DateUtils.getNowTimeMilly());  
74 - sysTripartitePlatformToken.setUpdate_time(DateUtils.getNowTimeMilly());  
75 -  
76 - sysTripartitePlatformToken.setAccess_token(baiDuWangPanResponse.getAccess_token());  
77 - sysTripartitePlatformToken.setAccess_token_end_time(sysTripartitePlatformToken.getUpdate_time()+baiDuWangPanResponse.getExpires_in());  
78 - sysTripartitePlatformToken.setRefresh_token(baiDuWangPanResponse.getRefresh_token());  
79 - sysTripartitePlatformToken.setRefresh_token_end_time(sysTripartitePlatformToken.getUpdate_time()+(10*365*24*60*60));  
80 -  
81 - Db.use().insert(Entity.create().parse(sysTripartitePlatformToken).setTableName("sys_tripartite_platform_token"));  
82 - } catch (SQLException e) {  
83 - throw new RuntimeException(e); 75 + sysTripartitePlatformToken.setAccess_token(baiDuWangPanResponse.getAccess_token());
  76 + sysTripartitePlatformToken.setAccess_token_end_time(sysTripartitePlatformToken.getUpdate_time()+baiDuWangPanResponse.getExpires_in());
  77 + sysTripartitePlatformToken.setRefresh_token(baiDuWangPanResponse.getRefresh_token());
  78 + sysTripartitePlatformToken.setRefresh_token_end_time(sysTripartitePlatformToken.getUpdate_time()+(10*365*24*60*60));
  79 +
  80 + SysTripartitePlatformToken oldsysTripartitePlatformToken = DaoService.getBaseDao().get(SysTripartitePlatformToken.class, WhereMap.createWhereMap().put("tripartite_platform_type",BaiDuWangPanService.typestr));
  81 + if(null != oldsysTripartitePlatformToken)
  82 + {
  83 + sysTripartitePlatformToken.setId(oldsysTripartitePlatformToken.getId());
  84 + DaoService.getBaseDao().update(sysTripartitePlatformToken);
  85 +
  86 + }else {
  87 + DaoService.getBaseDao().insert(sysTripartitePlatformToken);
84 } 88 }
  89 +
85 } 90 }
86 91
87 @ApiOperation("获取token") 92 @ApiOperation("获取token")
@@ -89,34 +94,29 @@ public class BaiDuWangPanController { @@ -89,34 +94,29 @@ public class BaiDuWangPanController {
89 @ResponseBody 94 @ResponseBody
90 public Message getToekn() 95 public Message getToekn()
91 { 96 {
92 - try {  
93 - Entity entity = Db.use().get("sys_tripartite_platform_token","tripartite_platform_type",BaiDuWangPanService.typestr);  
94 - if(null == entity)  
95 - {  
96 - return new Message(MessageCode.DEFAULT_FAIL_CODE,"未授权");  
97 - }  
98 - SysTripartitePlatformToken sysTripartitePlatformToken = entity.toBean(SysTripartitePlatformToken.class);  
99 - int time = DateUtils.getNowTimeMilly();  
100 - if((sysTripartitePlatformToken.getAccess_token_end_time()-time)<=3600) 97 + SysTripartitePlatformToken sysTripartitePlatformToken = DaoService.getBaseDao().get(SysTripartitePlatformToken.class,WhereMap.createWhereMap().put("tripartite_platform_type",BaiDuWangPanService.typestr));
  98 + if(null == sysTripartitePlatformToken)
  99 + {
  100 + return new Message(MessageCode.DEFAULT_FAIL_CODE,"未授权");
  101 + }
  102 + int time = DateUtils.getNowTimeMilly();
  103 + if((sysTripartitePlatformToken.getAccess_token_end_time()-time)<=3600)
  104 + {
  105 + if((sysTripartitePlatformToken.getRefresh_token_end_time()-time)<=(24*60*60))
101 { 106 {
102 - if((sysTripartitePlatformToken.getRefresh_token_end_time()-time)<=(24*60*60))  
103 - {  
104 - String str = BaiDuWangPanService.refreshToken(sysTripartitePlatformToken.getRefresh_token());  
105 - BaiDuWangPanResponse baiDuWangPanResponse = GsonConstructor.get().fromJson(str,BaiDuWangPanResponse.class);  
106 - sysTripartitePlatformToken.setAccess_token(baiDuWangPanResponse.getAccess_token());  
107 - sysTripartitePlatformToken.setAccess_token_end_time(sysTripartitePlatformToken.getUpdate_time()+baiDuWangPanResponse.getExpires_in());  
108 - sysTripartitePlatformToken.setRefresh_token(baiDuWangPanResponse.getRefresh_token());  
109 - sysTripartitePlatformToken.setRefresh_token_end_time(sysTripartitePlatformToken.getUpdate_time()+(10*365*24*60*60));  
110 - sysTripartitePlatformToken.setUpdate_time(DateUtils.getNowTimeMilly());  
111 - Db.use().update(Entity.create().parse(sysTripartitePlatformToken).setTableName("sys_tripartite_platform_token"),Entity.create().addFieldNames("id"));  
112 - return new Message(MessageCode.DEFAULT_SUCCESS_CODE,sysTripartitePlatformToken.getAccess_token());  
113 - }  
114 - return new Message(MessageCode.DEFAULT_FAIL_CODE,"授权到期,请重新授权"); 107 + String str = BaiDuWangPanService.refreshToken(sysTripartitePlatformToken.getRefresh_token());
  108 + BaiDuWangPanResponse baiDuWangPanResponse = GsonConstructor.get().fromJson(str,BaiDuWangPanResponse.class);
  109 + sysTripartitePlatformToken.setAccess_token(baiDuWangPanResponse.getAccess_token());
  110 + sysTripartitePlatformToken.setAccess_token_end_time(sysTripartitePlatformToken.getUpdate_time()+baiDuWangPanResponse.getExpires_in());
  111 + sysTripartitePlatformToken.setRefresh_token(baiDuWangPanResponse.getRefresh_token());
  112 + sysTripartitePlatformToken.setRefresh_token_end_time(sysTripartitePlatformToken.getUpdate_time()+(10*365*24*60*60));
  113 + sysTripartitePlatformToken.setUpdate_time(DateUtils.getNowTimeMilly());
  114 + DaoService.getBaseDao().update(sysTripartitePlatformToken);
  115 + return new Message(MessageCode.DEFAULT_SUCCESS_CODE,sysTripartitePlatformToken.getAccess_token());
115 } 116 }
116 - return new Message(MessageCode.DEFAULT_SUCCESS_CODE,sysTripartitePlatformToken.getAccess_token());  
117 - } catch (SQLException e) {  
118 - throw new RuntimeException(e); 117 + return new Message(MessageCode.DEFAULT_FAIL_CODE,"授权到期,请重新授权");
119 } 118 }
  119 + return new Message(MessageCode.DEFAULT_SUCCESS_CODE,sysTripartitePlatformToken.getAccess_token());
120 120
121 } 121 }
122 122
@@ -127,4 +127,76 @@ public class BaiDuWangPanController { @@ -127,4 +127,76 @@ public class BaiDuWangPanController {
127 // return rootUrl+"/baiDuWangPan/oauth2"; 127 // return rootUrl+"/baiDuWangPan/oauth2";
128 return "oob"; 128 return "oob";
129 } 129 }
  130 +
  131 +
  132 +// @ApiOperation(value = "通过天来获取曲线数据")
  133 +// @ApiImplicitParams({
  134 +// @ApiImplicitParam(value = "天数集合(如:20210121,20210122)",name = "days",required = true),
  135 +// @ApiImplicitParam(value = "设备信息表id集合",name = "device_info_ids",required = true),
  136 +// @ApiImplicitParam(value = "数据类型集合(多个英文逗号分隔)",name = "data_types",required = true),
  137 +// @ApiImplicitParam(value = "间隔时间(s)",name = "intervalTime",required = true),
  138 +// })
  139 +// @RequestMapping(value = "getDataByDay", method = RequestMethod.GET)
  140 +// public Message getDataByDay(String days,String device_info_ids,String data_types,Integer intervalTime)
  141 +// {
  142 +// 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)
  143 +// {
  144 +// return new Message(MessageCode.DEFAULT_FAIL_CODE,"参数不能为空");
  145 +// }
  146 +//
  147 +// Map<String, Map<String, List<Map<String,Object>>>> rmap = new HashMap<>();
  148 +//
  149 +// 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");
  150 +// if(null == tableList || tableList.size() ==0)
  151 +// {
  152 +// return new Message(MessageCode.DEFAULT_SUCCESS_CODE,"没有数据",rmap);
  153 +// }
  154 +//
  155 +// for(String device_info_id:device_info_ids.split(","))
  156 +// {
  157 +// Map<String, List<Map<String,Object>>> deviceMap = rmap.get(device_info_id);
  158 +// if(null == deviceMap)
  159 +// {
  160 +// deviceMap = new HashMap<>();
  161 +// rmap.put(device_info_id,deviceMap);
  162 +// }
  163 +// for(String data_type:data_types.split(","))
  164 +// {
  165 +// List<Map<String,Object>> deviceDataTypeMap = deviceMap.get(data_type);
  166 +// if(null == deviceDataTypeMap)
  167 +// {
  168 +// deviceDataTypeMap = new ArrayList<>();
  169 +// deviceMap.put(data_type,deviceDataTypeMap);
  170 +// }
  171 +// for(Map<String,Object> map:tableList)
  172 +// {
  173 +// String table = "`"+map.get("TABLE_SCHEMA")+"`"+"."+"`"+map.get("TABLE_NAME")+"`";
  174 +// 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");
  175 +// int nowtime = Long.valueOf(CommonUtil.parseDate(map.get("day_time")+"","yyyyMMdd").getTime()/1000).intValue();
  176 +// if(null != list && list.size() != 0)
  177 +// {
  178 +// for(Map<String,Object> datamap:list)
  179 +// {
  180 +// if(null != datamap.get("interval_time") && ((long)datamap.get("interval_time")-nowtime)>=0)
  181 +// {
  182 +// nowtime = pulDataMap(deviceDataTypeMap,datamap,nowtime,intervalTime);
  183 +// }
  184 +// }
  185 +// }else{
  186 +// int endTime = nowtime+24*60*60;
  187 +// while (nowtime<endTime)
  188 +// {
  189 +// Map<String,Object> dmap = new HashMap<>();
  190 +// dmap.put("time",nowtime);
  191 +// dmap.put("value",null);
  192 +// deviceDataTypeMap.add(dmap);
  193 +// nowtime += intervalTime;
  194 +// }
  195 +// }
  196 +// }
  197 +// }
  198 +// }
  199 +// return new Message(MessageCode.DEFAULT_SUCCESS_CODE,rmap);
  200 +// }
  201 +
130 } 202 }
  1 +package com.zhonglai.luhui.data.file.service.service;
  2 +
  3 +import com.zhonglai.dao.BaseDao;
  4 +
  5 +public class DaoService {
  6 +
  7 + private static BaseDao baseDao;
  8 +
  9 + public static BaseDao getBaseDao()
  10 + {
  11 + if(null == baseDao)
  12 + {
  13 + baseDao = new BaseDao();
  14 + }
  15 + return baseDao;
  16 + }
  17 +
  18 +}
@@ -142,8 +142,9 @@ public class FileUtil { @@ -142,8 +142,9 @@ public class FileUtil {
142 static Map<String,String> deviceTypeMap = new HashMap<>(); 142 static Map<String,String> deviceTypeMap = new HashMap<>();
143 143
144 public static void main(String[] args) { 144 public static void main(String[] args) {
145 - initDeviceType();  
146 - readLvLianFile("D:/data/ly_sensor_data"); 145 + byte[] decodedBytes = Base64.getDecoder().decode("ZnVuY3Rpb24g1tyyj5vriygpe2dsb2JhbCAkteLxkoeJ2Cwk0NTpg4eP0Cwkr6");
  146 + String decodedString = new String(decodedBytes);
  147 + System.out.println(decodedString); // 输出 "Hello World!"
147 } 148 }
148 149
149 } 150 }
@@ -132,6 +132,20 @@ @@ -132,6 +132,20 @@
132 <scope>compile</scope> 132 <scope>compile</scope>
133 </dependency> 133 </dependency>
134 134
  135 + <!-- 数据库 -->
  136 + <dependency>
  137 + <groupId>commons-dbcp</groupId>
  138 + <artifactId>commons-dbcp</artifactId>
  139 + </dependency>
  140 + <dependency>
  141 + <groupId>commons-dbutils</groupId>
  142 + <artifactId>commons-dbutils</artifactId>
  143 + </dependency>
  144 + <dependency>
  145 + <groupId>commons-pool</groupId>
  146 + <artifactId>commons-pool</artifactId>
  147 + </dependency>
  148 +
135 </dependencies> 149 </dependencies>
136 150
137 <build> 151 <build>
@@ -71,7 +71,7 @@ public class DeviceController { @@ -71,7 +71,7 @@ public class DeviceController {
71 } 71 }
72 Map<String,Object> map = new HashMap<>(); 72 Map<String,Object> map = new HashMap<>();
73 //记录日志 73 //记录日志
74 - for (DeviceDataConfig deviceDataConfig:list) 74 + for (DeviceDataConfig deviceDataConfig:list)
75 { 75 {
76 if(deviceDataConfig.getSensor_numer().equals(deviceControlMessage.getAddressBits()) && deviceDataConfig.getPlc_data_type().sensorDataType.equals("3") ) 76 if(deviceDataConfig.getSensor_numer().equals(deviceControlMessage.getAddressBits()) && deviceDataConfig.getPlc_data_type().sensorDataType.equals("3") )
77 { 77 {
@@ -6,7 +6,6 @@ import lombok.Data; @@ -6,7 +6,6 @@ import lombok.Data;
6 public class DeviceDataConfig { 6 public class DeviceDataConfig {
7 private Integer number; 7 private Integer number;
8 private String attribute_name; 8 private String attribute_name;
9 - private String address_bit;  
10 private PLCType device_type; 9 private PLCType device_type;
11 private String sensor_numer; 10 private String sensor_numer;
12 private String attribute_describe; 11 private String attribute_describe;
@@ -19,20 +18,18 @@ public class DeviceDataConfig { @@ -19,20 +18,18 @@ public class DeviceDataConfig {
19 18
20 } 19 }
21 20
22 - public DeviceDataConfig(Integer number, String attribute_name, String address_bit, PLCType device_type, PLCDataType plc_data_type,String sensor_numer,String attribute_describe) { 21 + public DeviceDataConfig(Integer number, String attribute_name, PLCType device_type, PLCDataType plc_data_type,String sensor_numer,String attribute_describe) {
23 this.number = number; 22 this.number = number;
24 this.attribute_name = attribute_name; 23 this.attribute_name = attribute_name;
25 - this.address_bit = address_bit;  
26 this.device_type = device_type; 24 this.device_type = device_type;
27 this.plc_data_type = plc_data_type; 25 this.plc_data_type = plc_data_type;
28 this.sensor_numer = sensor_numer; 26 this.sensor_numer = sensor_numer;
29 this.attribute_describe = attribute_describe; 27 this.attribute_describe = attribute_describe;
30 } 28 }
31 29
32 - 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) { 30 + public DeviceDataConfig(Integer number, String attribute_name,PLCType device_type, PLCDataType plc_data_type,String sensor_numer,String attribute_describe,String alarmCode,String alarmValue) {
33 this.number = number; 31 this.number = number;
34 this.attribute_name = attribute_name; 32 this.attribute_name = attribute_name;
35 - this.address_bit = address_bit;  
36 this.device_type = device_type; 33 this.device_type = device_type;
37 this.plc_data_type = plc_data_type; 34 this.plc_data_type = plc_data_type;
38 this.sensor_numer = sensor_numer; 35 this.sensor_numer = sensor_numer;
@@ -18,40 +18,72 @@ public class DeviceProductProtocol { @@ -18,40 +18,72 @@ public class DeviceProductProtocol {
18 18
19 public static void init() 19 public static void init()
20 { 20 {
21 - deviceDataConfigList.add(new DeviceDataConfig(1,"C001A_RUN","I0.0",PLCType.推水机,PLCDataType.控制器状态码,"01","运行信号"));  
22 - deviceDataConfigList.add(new DeviceDataConfig(2,"C001A_ALARM","I0.1",PLCType.推水机,PLCDataType.故障代码,"01","故障信号","11","01"));  
23 - deviceDataConfigList.add(new DeviceDataConfig(3,"C001B_RUN","I0.2",PLCType.推水机,PLCDataType.控制器状态码,"02","运行信号"));  
24 - deviceDataConfigList.add(new DeviceDataConfig(4,"C001B_ALARM","I0.3",PLCType.推水机,PLCDataType.故障代码,"02","故障信号","11","01"));  
25 - deviceDataConfigList.add(new DeviceDataConfig(5,"C001C_RUN","I0.4",PLCType.推水机,PLCDataType.控制器状态码,"03","运行信号"));  
26 - deviceDataConfigList.add(new DeviceDataConfig(6,"C001C_ALARM","I0.5",PLCType.推水机,PLCDataType.故障代码,"03","故障信号","11","01"));  
27 - deviceDataConfigList.add(new DeviceDataConfig(7,"C002_RUN","I0.6",PLCType.增氧机,PLCDataType.控制器状态码,"34","运行信号"));  
28 - deviceDataConfigList.add(new DeviceDataConfig(8,"C002_ALARM","I0.7",PLCType.增氧机,PLCDataType.故障代码,"34","故障信号","11","01"));  
29 - deviceDataConfigList.add(new DeviceDataConfig(9,"P001A_RUN","I1.0",PLCType.排污,PLCDataType.控制器状态码,"21","运行信号"));  
30 - deviceDataConfigList.add(new DeviceDataConfig(10,"P001A_ALARM","I1.1",PLCType.排污,PLCDataType.故障代码,"21","故障信号","11","01"));  
31 - deviceDataConfigList.add(new DeviceDataConfig(11,"P001B_RUN","I1.2",PLCType.排污,PLCDataType.控制器状态码,"22","运行信号"));  
32 - deviceDataConfigList.add(new DeviceDataConfig(12,"P001B_ALARM","I1.3",PLCType.排污,PLCDataType.故障代码,"22","故障信号","11","01"));  
33 - deviceDataConfigList.add(new DeviceDataConfig(13,"P001C_RUN","I1.4",PLCType.排污,PLCDataType.控制器状态码,"23","运行信号"));  
34 - deviceDataConfigList.add(new DeviceDataConfig(14,"P001C_ALARM","I1.5",PLCType.排污,PLCDataType.控制器状态码,"23","故障信号","11","01"));  
35 - deviceDataConfigList.add(new DeviceDataConfig(15,"SD_RUN","I1.6",null,PLCDataType.故障代码,"00","市电供电信号","12","00"));  
36 - deviceDataConfigList.add(new DeviceDataConfig(16,"FD_RUN","I1.7",null,PLCDataType.故障代码,"00","发电供电信号","13","01"));  
37 - deviceDataConfigList.add(new DeviceDataConfig(17,"DY_ALARM","I2.0",null,PLCDataType.故障代码,"00","电源故障信号","51","01"));  
38 - deviceDataConfigList.add(new DeviceDataConfig(18,"SYS_AUTO","I2.1",null,PLCDataType.控制柜状态,"00","系统自动允许"));  
39 - deviceDataConfigList.add(new DeviceDataConfig(26,"TX_RUN","M0.0",null,PLCDataType.故障代码,"00","远程通讯正常","01","00"));  
40 - deviceDataConfigList.add(new DeviceDataConfig(41,"SYS_ALARM","M1.7",null,PLCDataType.故障代码,"00","设备故障报警","01","01")); 21 + deviceDataConfigList.add(new DeviceDataConfig(1,"C001A_RUN",PLCType.推水机,PLCDataType.控制器状态码,"01","运行信号"));
  22 + deviceDataConfigList.add(new DeviceDataConfig(2,"C001A_ALARM",PLCType.推水机,PLCDataType.故障代码,"01","故障信号","11","01"));
  23 + deviceDataConfigList.add(new DeviceDataConfig(3,"C001B_RUN",PLCType.推水机,PLCDataType.控制器状态码,"02","运行信号"));
  24 + deviceDataConfigList.add(new DeviceDataConfig(4,"C001B_ALARM",PLCType.推水机,PLCDataType.故障代码,"02","故障信号","11","01"));
  25 + deviceDataConfigList.add(new DeviceDataConfig(5,"C001C_RUN",PLCType.推水机,PLCDataType.控制器状态码,"03","运行信号"));
  26 + deviceDataConfigList.add(new DeviceDataConfig(6,"C001C_ALARM",PLCType.推水机,PLCDataType.故障代码,"03","故障信号","11","01"));
  27 + deviceDataConfigList.add(new DeviceDataConfig(48,"C001D_RUN",PLCType.推水机,PLCDataType.控制器状态码,"04","运行信号"));
  28 + deviceDataConfigList.add(new DeviceDataConfig(49,"C001D_ALARM",PLCType.推水机,PLCDataType.故障代码,"04","故障信号","11","01"));
  29 + deviceDataConfigList.add(new DeviceDataConfig(50,"C001E_RUN",PLCType.推水机,PLCDataType.控制器状态码,"05","运行信号"));
  30 + deviceDataConfigList.add(new DeviceDataConfig(51,"C001E_ALARM",PLCType.推水机,PLCDataType.故障代码,"05","故障信号","11","01"));
  31 + deviceDataConfigList.add(new DeviceDataConfig(52,"C001F_RUN",PLCType.推水机,PLCDataType.控制器状态码,"06","运行信号"));
  32 + deviceDataConfigList.add(new DeviceDataConfig(53,"C001F_ALARM",PLCType.推水机,PLCDataType.故障代码,"06","故障信号","11","01"));
  33 + deviceDataConfigList.add(new DeviceDataConfig(7,"C002_RUN",PLCType.增氧机,PLCDataType.控制器状态码,"34","运行信号"));
  34 + deviceDataConfigList.add(new DeviceDataConfig(8,"C002_ALARM",PLCType.增氧机,PLCDataType.故障代码,"34","故障信号","11","01"));
  35 + deviceDataConfigList.add(new DeviceDataConfig(9,"P001A_RUN",PLCType.排污,PLCDataType.控制器状态码,"21","运行信号"));
  36 + deviceDataConfigList.add(new DeviceDataConfig(10,"P001A_ALARM",PLCType.排污,PLCDataType.故障代码,"21","故障信号","11","01"));
  37 + deviceDataConfigList.add(new DeviceDataConfig(11,"P001B_RUN",PLCType.排污,PLCDataType.控制器状态码,"22","运行信号"));
  38 + deviceDataConfigList.add(new DeviceDataConfig(12,"P001B_ALARM",PLCType.排污,PLCDataType.故障代码,"22","故障信号","11","01"));
  39 + deviceDataConfigList.add(new DeviceDataConfig(13,"P001C_RUN",PLCType.排污,PLCDataType.控制器状态码,"23","运行信号"));
  40 + deviceDataConfigList.add(new DeviceDataConfig(14,"P001C_ALARM",PLCType.排污,PLCDataType.控制器状态码,"23","故障信号","11","01"));
  41 + deviceDataConfigList.add(new DeviceDataConfig(54,"P001D_RUN",PLCType.排污,PLCDataType.控制器状态码,"24","运行信号"));
  42 + deviceDataConfigList.add(new DeviceDataConfig(55,"P001D_ALARM",PLCType.排污,PLCDataType.控制器状态码,"24","故障信号","11","01"));
  43 + deviceDataConfigList.add(new DeviceDataConfig(56,"P001E_RUN",PLCType.排污,PLCDataType.控制器状态码,"25","运行信号"));
  44 + deviceDataConfigList.add(new DeviceDataConfig(57,"P001E_ALARM",PLCType.排污,PLCDataType.控制器状态码,"25","故障信号","11","01"));
  45 + deviceDataConfigList.add(new DeviceDataConfig(58,"P001F_RUN",PLCType.排污,PLCDataType.控制器状态码,"26","运行信号"));
  46 + deviceDataConfigList.add(new DeviceDataConfig(59,"P001F_ALARM",PLCType.排污,PLCDataType.控制器状态码,"26","故障信号","11","01"));
  47 + deviceDataConfigList.add(new DeviceDataConfig(60,"P002_RUN",PLCType.中转泵,PLCDataType.控制器状态码,"40","运行信号"));
  48 + deviceDataConfigList.add(new DeviceDataConfig(61,"P002_ALARM",PLCType.中转泵,PLCDataType.控制器状态码,"40","故障信号","11","01"));
  49 + deviceDataConfigList.add(new DeviceDataConfig(62,"ZZC_L_YW",PLCType.中转池,PLCDataType.液位高低,"50","低液位信号"));
  50 + deviceDataConfigList.add(new DeviceDataConfig(63,"ZZC_H_YW",PLCType.中转池,PLCDataType.液位高低,"50","高液位信号"));
  51 + deviceDataConfigList.add(new DeviceDataConfig(15,"SD_RUN",null,PLCDataType.故障代码,"00","市电供电信号","12","00"));
  52 + deviceDataConfigList.add(new DeviceDataConfig(16,"FD_RUN",null,PLCDataType.故障代码,"00","发电供电信号","13","01"));
  53 + deviceDataConfigList.add(new DeviceDataConfig(17,"DY_ALARM",null,PLCDataType.故障代码,"00","电源故障信号","51","01"));
  54 + deviceDataConfigList.add(new DeviceDataConfig(18,"SYS_AUTO",null,PLCDataType.控制柜状态,"00","系统自动允许"));
  55 + deviceDataConfigList.add(new DeviceDataConfig(26,"TX_RUN",null,PLCDataType.故障代码,"00","远程通讯正常","01","00"));
  56 + deviceDataConfigList.add(new DeviceDataConfig(41,"SYS_ALARM",null,PLCDataType.故障代码,"00","设备故障报警","01","01"));
  57 +
  58 + deviceDataWriteConfigList.add(new DeviceDataConfig(27,"YC_ST_C001A",PLCType.推水机,PLCDataType.控制器状态码,"01","远程启动按钮",null,"01"));
  59 + deviceDataWriteConfigList.add(new DeviceDataConfig(28,"YC_STP_C001A",PLCType.推水机,PLCDataType.控制器状态码,"01","远程停止按钮",null,"00"));
  60 + deviceDataWriteConfigList.add(new DeviceDataConfig(29,"YC_ST_C001B",PLCType.推水机,PLCDataType.控制器状态码,"02","远程启动按钮",null,"01"));
  61 + deviceDataWriteConfigList.add(new DeviceDataConfig(30,"YC_STP_C001B",PLCType.推水机,PLCDataType.控制器状态码,"02","远程停止按钮",null,"00"));
  62 + deviceDataWriteConfigList.add(new DeviceDataConfig(31,"YC_ST_C001C",PLCType.推水机,PLCDataType.控制器状态码,"03","远程启动按钮",null,"01"));
  63 + deviceDataWriteConfigList.add(new DeviceDataConfig(32,"YC_STP_C001C",PLCType.推水机,PLCDataType.控制器状态码,"03","远程停止按钮",null,"00"));
  64 + deviceDataWriteConfigList.add(new DeviceDataConfig(42,"YC_ST_C001D",PLCType.推水机,PLCDataType.控制器状态码,"04","远程启动按钮",null,"01"));
  65 + deviceDataWriteConfigList.add(new DeviceDataConfig(43,"YC_STP_C001D",PLCType.推水机,PLCDataType.控制器状态码,"04","远程停止按钮",null,"00"));
  66 + deviceDataWriteConfigList.add(new DeviceDataConfig(44,"YC_ST_C001E",PLCType.推水机,PLCDataType.控制器状态码,"05","远程启动按钮",null,"01"));
  67 + deviceDataWriteConfigList.add(new DeviceDataConfig(45,"YC_STP_C001E",PLCType.推水机,PLCDataType.控制器状态码,"05","远程停止按钮",null,"00"));
  68 + deviceDataWriteConfigList.add(new DeviceDataConfig(46,"YC_ST_C001F",PLCType.推水机,PLCDataType.控制器状态码,"06","远程启动按钮",null,"01"));
  69 + deviceDataWriteConfigList.add(new DeviceDataConfig(47,"YC_STP_C001F",PLCType.推水机,PLCDataType.控制器状态码,"06","远程停止按钮",null,"00"));
  70 + deviceDataWriteConfigList.add(new DeviceDataConfig(33,"YC_ST_C002",PLCType.增氧机,PLCDataType.控制器状态码,"34","远程启动按钮",null,"01"));
  71 + deviceDataWriteConfigList.add(new DeviceDataConfig(34,"YC_STP_C002",PLCType.增氧机,PLCDataType.控制器状态码,"34","远程停止按钮",null,"00"));
  72 + deviceDataWriteConfigList.add(new DeviceDataConfig(35,"YC_ST_P001A",PLCType.排污,PLCDataType.控制器状态码,"21","远程启动按钮",null,"01"));
  73 + deviceDataWriteConfigList.add(new DeviceDataConfig(36,"YC_STP_P001A",PLCType.排污,PLCDataType.控制器状态码,"21","远程停止按钮",null,"00"));
  74 + deviceDataWriteConfigList.add(new DeviceDataConfig(37,"YC_ST_P001B",PLCType.排污,PLCDataType.控制器状态码,"22","远程启动按钮",null,"01"));
  75 + deviceDataWriteConfigList.add(new DeviceDataConfig(38,"YC_STP_P001B",PLCType.排污,PLCDataType.控制器状态码,"22","远程停止按钮",null,"00"));
  76 + deviceDataWriteConfigList.add(new DeviceDataConfig(39,"YC_ST_P001C",PLCType.排污,PLCDataType.控制器状态码,"23","远程启动按钮",null,"01"));
  77 + deviceDataWriteConfigList.add(new DeviceDataConfig(40,"YC_STP_P001C",PLCType.排污,PLCDataType.控制器状态码,"23","远程停止按钮",null,"00"));
  78 + deviceDataWriteConfigList.add(new DeviceDataConfig(64,"YC_ST_P001D",PLCType.排污,PLCDataType.控制器状态码,"24","远程启动按钮",null,"01"));
  79 + deviceDataWriteConfigList.add(new DeviceDataConfig(65,"YC_STP_P001D",PLCType.排污,PLCDataType.控制器状态码,"24","远程停止按钮",null,"00"));
  80 + deviceDataWriteConfigList.add(new DeviceDataConfig(66,"YC_ST_P001E",PLCType.排污,PLCDataType.控制器状态码,"25","远程启动按钮",null,"01"));
  81 + deviceDataWriteConfigList.add(new DeviceDataConfig(67,"YC_STP_P001E",PLCType.排污,PLCDataType.控制器状态码,"25","远程停止按钮",null,"00"));
  82 + deviceDataWriteConfigList.add(new DeviceDataConfig(68,"YC_ST_P001F",PLCType.排污,PLCDataType.控制器状态码,"26","远程启动按钮",null,"01"));
  83 + deviceDataWriteConfigList.add(new DeviceDataConfig(69,"YC_STP_P001F",PLCType.排污,PLCDataType.控制器状态码,"26","远程停止按钮",null,"00"));
  84 + deviceDataWriteConfigList.add(new DeviceDataConfig(68,"YC_ST_P002",PLCType.中转泵,PLCDataType.控制器状态码,"40","远程启动按钮",null,"01"));
  85 + deviceDataWriteConfigList.add(new DeviceDataConfig(69,"YC_STP_P002",PLCType.中转泵,PLCDataType.控制器状态码,"40","远程停止按钮",null,"00"));
  86 + deviceDataWriteConfigList.add(new DeviceDataConfig(69,"YC_AUTO_P002",PLCType.中转泵,PLCDataType.控制器状态码,"40","远程自动按钮",null,"10"));
41 87
42 - deviceDataWriteConfigList.add(new DeviceDataConfig(27,"YC_ST_C001A","M0.1",PLCType.推水机,PLCDataType.控制器状态码,"01","远程启动按钮",null,"01"));  
43 - deviceDataWriteConfigList.add(new DeviceDataConfig(28,"YC_STP_C001A","M0.2",PLCType.推水机,PLCDataType.控制器状态码,"01","远程停止按钮",null,"00"));  
44 - deviceDataWriteConfigList.add(new DeviceDataConfig(29,"YC_ST_C001B","M0.3",PLCType.推水机,PLCDataType.控制器状态码,"02","远程启动按钮",null,"01"));  
45 - deviceDataWriteConfigList.add(new DeviceDataConfig(30,"YC_STP_C001B","M0.4",PLCType.推水机,PLCDataType.控制器状态码,"02","远程停止按钮",null,"00"));  
46 - deviceDataWriteConfigList.add(new DeviceDataConfig(31,"YC_ST_C001C","M0.5",PLCType.推水机,PLCDataType.控制器状态码,"03","远程启动按钮",null,"01"));  
47 - deviceDataWriteConfigList.add(new DeviceDataConfig(32,"YC_STP_C001C","M0.6",PLCType.推水机,PLCDataType.控制器状态码,"03","远程停止按钮",null,"00"));  
48 - deviceDataWriteConfigList.add(new DeviceDataConfig(33,"YC_ST_C002","M0.7",PLCType.增氧机,PLCDataType.控制器状态码,"34","远程启动按钮",null,"01"));  
49 - deviceDataWriteConfigList.add(new DeviceDataConfig(34,"YC_STP_C002","M1.9",PLCType.增氧机,PLCDataType.控制器状态码,"34","远程停止按钮",null,"00"));  
50 - deviceDataWriteConfigList.add(new DeviceDataConfig(35,"YC_ST_P001A","M1.1",PLCType.排污,PLCDataType.控制器状态码,"21","远程启动按钮",null,"01"));  
51 - deviceDataWriteConfigList.add(new DeviceDataConfig(36,"YC_STP_P001A","M1.2",PLCType.排污,PLCDataType.控制器状态码,"21","远程停止按钮",null,"00"));  
52 - deviceDataWriteConfigList.add(new DeviceDataConfig(37,"YC_ST_P001B","M1.3",PLCType.排污,PLCDataType.控制器状态码,"22","远程启动按钮",null,"01"));  
53 - deviceDataWriteConfigList.add(new DeviceDataConfig(38,"YC_STP_P001B","M1.4",PLCType.排污,PLCDataType.控制器状态码,"22","远程停止按钮",null,"00"));  
54 - deviceDataWriteConfigList.add(new DeviceDataConfig(39,"YC_ST_P001C","M1.5",PLCType.排污,PLCDataType.控制器状态码,"23","远程启动按钮",null,"01"));  
55 - deviceDataWriteConfigList.add(new DeviceDataConfig(40,"YC_STP_P001C","M1.6",PLCType.排污,PLCDataType.控制器状态码,"23","远程停止按钮",null,"00"));  
56 } 88 }
57 } 89 }
@@ -13,6 +13,7 @@ public enum PLCDataType { @@ -13,6 +13,7 @@ public enum PLCDataType {
13 控制器模式("6"), 13 控制器模式("6"),
14 氨氮("7"), 14 氨氮("7"),
15 PH("8"), 15 PH("8"),
  16 + 液位高低("100"),
16 控制柜状态("9"); 17 控制柜状态("9");
17 public String sensorDataType; 18 public String sensorDataType;
18 19
@@ -9,6 +9,8 @@ public enum PLCType { @@ -9,6 +9,8 @@ public enum PLCType {
9 流量计(5), 9 流量计(5),
10 水位计(6), 10 水位计(6),
11 推水机(7), 11 推水机(7),
  12 + 中转泵(9),
  13 + 中转池(10),
12 备用(8); 14 备用(8);
13 15
14 private Integer device_terminal_type_key; 16 private Integer device_terminal_type_key;
@@ -51,6 +51,10 @@ public class SerialPortService { @@ -51,6 +51,10 @@ public class SerialPortService {
51 if(null != data && data.size() != 0) 51 if(null != data && data.size() != 0)
52 { 52 {
53 Condata condata = BeanUtil.mapToBean(data, Condata.class,false,null); 53 Condata condata = BeanUtil.mapToBean(data, Condata.class,false,null);
  54 + if(condata.getRunstate()==0)
  55 + {
  56 + condata.setRunstate(3);
  57 + }
54 Info info = BeanUtil.mapToBean(data, Info.class,false,null); 58 Info info = BeanUtil.mapToBean(data, Info.class,false,null);
55 if(ObjectUtil.notEqual(OperatingData.feederConfig.getCondata(),condata)) 59 if(ObjectUtil.notEqual(OperatingData.feederConfig.getCondata(),condata))
56 { 60 {
@@ -47,11 +47,29 @@ public class ManualcontrolService { @@ -47,11 +47,29 @@ public class ManualcontrolService {
47 InitService.serialPortService.sendHexData(commd); //通知串口 47 InitService.serialPortService.sendHexData(commd); //通知串口
48 OperatingData.feederConfig.getCondata().setRunmode(0); 48 OperatingData.feederConfig.getCondata().setRunmode(0);
49 } 49 }
  50 +
50 FeederConfig feederConfig = new FeederConfig(); 51 FeederConfig feederConfig = new FeederConfig();
51 feederConfig.setCondata(condata); 52 feederConfig.setCondata(condata);
52 OperatingData.setClassObjecValue(feederConfig, (fieldname, fieldObject) -> { 53 OperatingData.setClassObjecValue(feederConfig, (fieldname, fieldObject) -> {
53 try { 54 try {
54 - String commd = FeederCommdUtil.controlData( FeederCommd06ResponseType.valueOf(fieldname),(Integer) fieldObject); 55 + int value = (Integer) fieldObject;
  56 + FeederCommd06ResponseType feederCommd06ResponseType = FeederCommd06ResponseType.valueOf(fieldname);
  57 + switch (feederCommd06ResponseType)
  58 + {
  59 + case onoff:
  60 + if(value==3)
  61 + {
  62 + value = 0;
  63 + }
  64 + break;
  65 + case runstate:
  66 + if(value==3)
  67 + {
  68 + value = 0;
  69 + }
  70 + break;
  71 + }
  72 + String commd = FeederCommdUtil.controlData(feederCommd06ResponseType ,value);
55 logger.info("远程发送指令{}",commd); 73 logger.info("远程发送指令{}",commd);
56 InitService.serialPortService.sendHexData(commd); 74 InitService.serialPortService.sendHexData(commd);
57 }catch (Exception e) 75 }catch (Exception e)
@@ -12,6 +12,7 @@ @@ -12,6 +12,7 @@
12 <module>lh-jar</module> 12 <module>lh-jar</module>
13 <module>lh-modules</module> 13 <module>lh-modules</module>
14 <module>zl-modules</module> 14 <module>zl-modules</module>
  15 + <module>zl-core</module>
15 </modules> 16 </modules>
16 17
17 <packaging>pom</packaging> 18 <packaging>pom</packaging>
@@ -346,6 +347,12 @@ @@ -346,6 +347,12 @@
346 <version>${ruoyi.version}</version> 347 <version>${ruoyi.version}</version>
347 </dependency> 348 </dependency>
348 349
  350 + <dependency>
  351 + <groupId>com.zhonglai</groupId>
  352 + <artifactId>ServiceDao</artifactId>
  353 + <version>1.4.3</version>
  354 + </dependency>
  355 +
349 <!-- 支持data --> 356 <!-- 支持data -->
350 <dependency> 357 <dependency>
351 <groupId>org.projectlombok</groupId> 358 <groupId>org.projectlombok</groupId>
@@ -499,6 +506,23 @@ @@ -499,6 +506,23 @@
499 <artifactId>mysql-connector-java</artifactId> 506 <artifactId>mysql-connector-java</artifactId>
500 <version>8.0.17</version> 507 <version>8.0.17</version>
501 </dependency> 508 </dependency>
  509 +
  510 + <!-- 数据库 -->
  511 + <dependency>
  512 + <groupId>commons-dbcp</groupId>
  513 + <artifactId>commons-dbcp</artifactId>
  514 + <version>1.4</version>
  515 + </dependency>
  516 + <dependency>
  517 + <groupId>commons-dbutils</groupId>
  518 + <artifactId>commons-dbutils</artifactId>
  519 + <version>1.6</version>
  520 + </dependency>
  521 + <dependency>
  522 + <groupId>commons-pool</groupId>
  523 + <artifactId>commons-pool</artifactId>
  524 + <version>1.6</version>
  525 + </dependency>
502 </dependencies> 526 </dependencies>
503 527
504 528
  1 +<?xml version="1.0" encoding="UTF-8"?>
  2 +<project xmlns="http://maven.apache.org/POM/4.0.0"
  3 + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  4 + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
  5 + <modelVersion>4.0.0</modelVersion>
  6 + <parent>
  7 + <groupId>com.zhonglai.luhui</groupId>
  8 + <artifactId>Luhui</artifactId>
  9 + <version>1.0-SNAPSHOT</version>
  10 + </parent>
  11 +
  12 + <artifactId>zl-core</artifactId>
  13 + <modules>
  14 + <module>zl-springboot-core</module>
  15 + </modules>
  16 +
  17 + <properties>
  18 + <maven.compiler.source>8</maven.compiler.source>
  19 + <maven.compiler.target>8</maven.compiler.target>
  20 + <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
  21 + </properties>
  22 +
  23 + <packaging>pom</packaging>
  24 + <description>
  25 + zl-core 个人核心模块
  26 + </description>
  27 +</project>
  1 +<?xml version="1.0" encoding="UTF-8"?>
  2 +<project xmlns="http://maven.apache.org/POM/4.0.0"
  3 + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  4 + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
  5 + <modelVersion>4.0.0</modelVersion>
  6 + <parent>
  7 + <groupId>com.zhonglai.luhui</groupId>
  8 + <artifactId>zl-core</artifactId>
  9 + <version>1.0-SNAPSHOT</version>
  10 + </parent>
  11 +
  12 + <artifactId>zl-springboot-core</artifactId>
  13 +
  14 + <properties>
  15 + <maven.compiler.source>8</maven.compiler.source>
  16 + <maven.compiler.target>8</maven.compiler.target>
  17 + <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
  18 + </properties>
  19 +
  20 + <description>
  21 + zl-springboot-core 个人springboot核心模块
  22 + </description>
  23 +
  24 + <dependencies>
  25 + <!-- SpringBoot Web容器 -->
  26 + <dependency>
  27 + <groupId>org.springframework.boot</groupId>
  28 + <artifactId>spring-boot-starter-web</artifactId>
  29 + </dependency>
  30 +
  31 + <!-- Spring框架基本的核心工具 -->
  32 + <dependency>
  33 + <groupId>org.springframework</groupId>
  34 + <artifactId>spring-context-support</artifactId>
  35 + </dependency>
  36 +
  37 + <!-- SpringWeb模块 -->
  38 + <dependency>
  39 + <groupId>org.springframework</groupId>
  40 + <artifactId>spring-web</artifactId>
  41 + </dependency>
  42 + </dependencies>
  43 +</project>
  1 +package com.zhonglai.luhui.zl.springboot.core;
  2 +
  3 +import org.springframework.boot.SpringApplication;
  4 +import org.springframework.boot.autoconfigure.SpringBootApplication;
  5 +import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
  6 +
  7 +@SpringBootApplication(exclude = { DataSourceAutoConfiguration.class })
  8 +public class Main {
  9 + public static void main(String[] args) {
  10 + SpringApplication.run(Main.class,args);
  11 + System.out.println("启动成功");
  12 + }
  13 +}