Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
shandong_datapush
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
shiyubin
shandong_datapush
Commits
791352d8
Commit
791352d8
authored
Oct 30, 2020
by
史余彬
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
添加外部输出日志
parent
1bbaa06c
Changes
5
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
301 additions
and
6 deletions
+301
-6
config.go
config/config.go
+8
-4
realTimeDataDao.go
dao/realTimeDataDao.go
+24
-0
main.go
main.go
+1
-0
realTimeDataProcess.go
service/realTimeDataProcess.go
+2
-2
test.txt
test.txt
+266
-0
No files found.
config/config.go
View file @
791352d8
...
...
@@ -5,6 +5,7 @@ import (
"fmt"
"gopkg.in/ini.v1"
"log"
"os"
"shandong_datapush/common"
_
"github.com/denisenkom/go-mssqldb"
_
"github.com/lib/pq"
...
...
@@ -26,14 +27,17 @@ func init() {
common
.
ErrorPrintln
(
"读取配置文件异常"
,
err
)
DBType
=
file
.
Section
(
"databaseType"
)
.
Key
(
"type"
)
.
String
()
DBConnInfo
=
new
(
common
.
DBConnectInfo
)
err
=
file
.
Section
(
"databaseConnection"
)
.
MapTo
(
DBConnInfo
)
_
=
file
.
Section
(
"databaseConnection"
)
.
MapTo
(
DBConnInfo
)
TailPond
=
new
(
common
.
TailPondInfor
)
err
=
file
.
Section
(
"wkkBasicInfo"
)
.
MapTo
(
TailPond
)
_
=
file
.
Section
(
"wkkBasicInfo"
)
.
MapTo
(
TailPond
)
StaticSql
=
new
(
common
.
StaticSqlLanguage
)
file
.
Section
(
"StaticSqlLanguage"
)
.
MapTo
(
StaticSql
)
_
=
file
.
Section
(
"StaticSqlLanguage"
)
.
MapTo
(
StaticSql
)
RealTimeSql
=
new
(
common
.
RealTimeSqlLanguage
)
file
.
Section
(
"RealTimeSqlLanguage"
)
.
MapTo
(
RealTimeSql
)
_
=
file
.
Section
(
"RealTimeSqlLanguage"
)
.
MapTo
(
RealTimeSql
)
common
.
ErrorPrintln
(
"数据库连接信息映射异常"
,
err
)
f
,
err
:=
os
.
OpenFile
(
"test.txt"
,
os
.
O_CREATE
|
os
.
O_APPEND
|
os
.
O_WRONLY
,
0666
)
common
.
ErrorPrintln
(
"日志文件创建失败"
,
err
)
log
.
SetOutput
(
f
)
}
func
DBConnection
()
{
...
...
dao/realTimeDataDao.go
View file @
791352d8
...
...
@@ -11,6 +11,9 @@ import (
func
GtRealDataProcess
()
[]
*
common
.
DryBeachData
{
row
,
err
:=
config
.
DB
.
Query
(
config
.
RealTimeSql
.
GtRealTimeSql
)
common
.
ErrorPrintln
(
"干滩实时数据查询异常"
,
err
)
defer
func
()
{
common
.
ErrorPrintln
(
"干滩实时数据关闭异常"
,
row
.
Close
())
}()
Arrs
:=
make
([]
*
common
.
DryBeachData
,
0
)
for
row
.
Next
()
{
dryBeach
:=
new
(
common
.
DryBeachData
)
...
...
@@ -27,6 +30,9 @@ func GtRealDataProcess() []*common.DryBeachData {
func
KswRealDataProcess
()
[]
*
common
.
ReserWaterLevelData
{
row
,
err
:=
config
.
DB
.
Query
(
config
.
RealTimeSql
.
KswRealTimeSql
)
common
.
ErrorPrintln
(
"库水位实时数据查询异常"
,
err
)
defer
func
()
{
common
.
ErrorPrintln
(
"库水位实时数据关闭异常"
,
row
.
Close
())
}()
Arrs
:=
make
([]
*
common
.
ReserWaterLevelData
,
0
)
for
row
.
Next
()
{
reserWater
:=
new
(
common
.
ReserWaterLevelData
)
...
...
@@ -43,6 +49,9 @@ func KswRealDataProcess() []*common.ReserWaterLevelData {
func
JrxRealDataProcess
()
[]
*
common
.
SaturationLineData
{
row
,
err
:=
config
.
DB
.
Query
(
config
.
RealTimeSql
.
JrxRealTimeSql
)
common
.
ErrorPrintln
(
"浸润线实时数据查询异常"
,
err
)
defer
func
()
{
common
.
ErrorPrintln
(
"浸润线实时数据关闭异常"
,
row
.
Close
())
}()
Arrs
:=
make
([]
*
common
.
SaturationLineData
,
0
)
for
row
.
Next
()
{
saturation
:=
new
(
common
.
SaturationLineData
)
...
...
@@ -59,6 +68,9 @@ func JrxRealDataProcess() []*common.SaturationLineData {
func
JylRealDataProcess
()
[]
*
common
.
RainfallData
{
row
,
err
:=
config
.
DB
.
Query
(
config
.
RealTimeSql
.
JylRealTimeSql
)
common
.
ErrorPrintln
(
"降雨量实时数据查询异常"
,
err
)
defer
func
()
{
common
.
ErrorPrintln
(
"降雨量实时数据关闭异常"
,
row
.
Close
())
}()
Arrs
:=
make
([]
*
common
.
RainfallData
,
0
)
for
row
.
Next
()
{
rainfall
:=
new
(
common
.
RainfallData
)
...
...
@@ -76,6 +88,9 @@ func JylRealDataProcess() []*common.RainfallData {
func
NbwyRealDataProcess
()
[]
*
common
.
InclinometerData
{
row
,
err
:=
config
.
DB
.
Query
(
config
.
RealTimeSql
.
NbwyRealTimeSql
)
common
.
ErrorPrintln
(
"内部位移实时数据查询异常"
,
err
)
defer
func
()
{
common
.
ErrorPrintln
(
"内部位移实时数据关闭异常"
,
row
.
Close
())
}()
Arrs
:=
make
([]
*
common
.
InclinometerData
,
0
)
for
row
.
Next
()
{
inclinometer
:=
new
(
common
.
InclinometerData
)
...
...
@@ -94,6 +109,9 @@ func NbwyRealDataProcess() []*common.InclinometerData {
func
BmwyRealDataProcess
()
[]
*
common
.
DisplacementData
{
row
,
err
:=
config
.
DB
.
Query
(
config
.
RealTimeSql
.
BmwyRealTimeSql
)
common
.
ErrorPrintln
(
"表面位移实时数据查询异常"
,
err
)
defer
func
()
{
common
.
ErrorPrintln
(
"表面位移实时数据关闭异常"
,
row
.
Close
())
}()
Arrs
:=
make
([]
*
common
.
DisplacementData
,
0
)
for
row
.
Next
()
{
displacement
:=
new
(
common
.
DisplacementData
)
...
...
@@ -111,6 +129,9 @@ func BmwyRealDataProcess() []*common.DisplacementData {
func
DeviceOffLineRealDataProcess
()
[]
*
common
.
DeviceOffLineData
{
row
,
err
:=
config
.
DB
.
Query
(
config
.
RealTimeSql
.
DeviceOffLineDataRealTimeSql
)
common
.
ErrorPrintln
(
"设备离线实时数据查询异常"
,
err
)
defer
func
()
{
common
.
ErrorPrintln
(
"设备离线实时数据关闭异常"
,
row
.
Close
())
}()
Arrs
:=
make
([]
*
common
.
DeviceOffLineData
,
0
)
for
row
.
Next
()
{
deviceOffLine
:=
new
(
common
.
DeviceOffLineData
)
...
...
@@ -129,6 +150,9 @@ func DeviceOffLineRealDataProcess() []*common.DeviceOffLineData {
func
AlarmDataRealDataProcess
()
[]
*
common
.
AlarmMessData
{
row
,
err
:=
config
.
DB
.
Query
(
config
.
RealTimeSql
.
AlarmMessDataRealTimeSql
)
common
.
ErrorPrintln
(
"报警实时数据查询异常"
,
err
)
defer
func
()
{
common
.
ErrorPrintln
(
"报警实时数据关闭异常"
,
row
.
Close
())
}()
Arrs
:=
make
([]
*
common
.
AlarmMessData
,
0
)
for
row
.
Next
()
{
alarmMess
:=
new
(
common
.
AlarmMessData
)
...
...
main.go
View file @
791352d8
...
...
@@ -40,6 +40,7 @@ func realTimeDataPush() {
service
.
JrxRealTimeDataProcess
()
service
.
JylRealTimeDataProcess
()
service
.
NbwyRealTimeDataProcess
()
service
.
BmwyRealTimeDataProcess
()
service
.
DOLRealTimeDataProcess
()
service
.
AMSRealTimeDataProcess
()
}
...
...
service/realTimeDataProcess.go
View file @
791352d8
...
...
@@ -73,8 +73,8 @@ func BmwyRealTimeDataProcess() {
离线设备实时数据
*/
func
DOLRealTimeDataProcess
()
{
Ams
Arrs
:=
dao
.
DeviceOffLineRealDataProcess
()
by
,
err
:=
xml
.
Marshal
(
Ams
Arrs
)
DOL
Arrs
:=
dao
.
DeviceOffLineRealDataProcess
()
by
,
err
:=
xml
.
Marshal
(
DOL
Arrs
)
common
.
ErrorPrintln
(
"设备离线实时数据xml序列化"
,
err
)
log
.
Println
(
"设备离线实时数据>>>>>>>>>>>>>>>>>>>>>>>>"
,
string
(
by
))
}
...
...
test.txt
0 → 100644
View file @
791352d8
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment