Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
F
ftp_pic
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
李辅翼
ftp_pic
Commits
bc49983b
Commit
bc49983b
authored
Aug 05, 2019
by
李辅翼
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
v9
parent
75807a9b
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
79 additions
and
13 deletions
+79
-13
src/main/java/com/hikcreate/controller/PicController.java
+10
-0
src/main/java/com/hikcreate/drv_photo_pic/DrvPhoto.java
+1
-0
src/main/java/com/hikcreate/drv_photo_pic/impl/DrvPhotoImpl.java
+28
-1
src/main/java/com/hikcreate/drv_photo_pic/impl/SqlHelp.java
+19
-7
src/main/java/com/hikcreate/drv_photo_pic/impl/VehicleImpl.java
+19
-4
src/main/java/com/hikcreate/service/fdfs/service/impl/FileServiceImpl.java
+2
-1
No files found.
src/main/java/com/hikcreate/controller/PicController.java
View file @
bc49983b
...
@@ -82,6 +82,16 @@ public class PicController {
...
@@ -82,6 +82,16 @@ public class PicController {
vehicle
.
insertVehPicByCar
(
hphm
,
hpzl
);
vehicle
.
insertVehPicByCar
(
hphm
,
hpzl
);
}
}
/**
* 指定时间段驾驶人头像同步
* @param start
* @param end
*/
@GetMapping
(
"/increDrvPic"
)
public
void
increDrvPic
(
@RequestParam
(
"start"
)
String
start
,
@RequestParam
(
"end"
)
String
end
){
drvPhoto
.
increDrvPic
(
start
,
end
);
}
@GetMapping
(
"/testIncVioPic"
)
@GetMapping
(
"/testIncVioPic"
)
public
void
testIncVioPic
(
@RequestParam
(
"start"
)
String
start
,
@RequestParam
(
"end"
)
String
end
)
{
public
void
testIncVioPic
(
@RequestParam
(
"start"
)
String
start
,
@RequestParam
(
"end"
)
String
end
)
{
...
...
src/main/java/com/hikcreate/drv_photo_pic/DrvPhoto.java
View file @
bc49983b
...
@@ -18,4 +18,5 @@ public interface DrvPhoto {
...
@@ -18,4 +18,5 @@ public interface DrvPhoto {
void
insertDrvPhotoById
(
String
sfzmhm
);
void
insertDrvPhotoById
(
String
sfzmhm
);
void
increDrvPic
(
String
start
,
String
end
);
}
}
src/main/java/com/hikcreate/drv_photo_pic/impl/DrvPhotoImpl.java
View file @
bc49983b
...
@@ -184,13 +184,40 @@ public class DrvPhotoImpl implements DrvPhoto {
...
@@ -184,13 +184,40 @@ public class DrvPhotoImpl implements DrvPhoto {
}
}
}
}
@Override
public
void
increDrvPic
(
String
start
,
String
end
)
{
hbaseConf
=
HBaseConfiguration
.
create
();
hbaseConf
.
set
(
"hbase.zookeeper.property.clientPort"
,
hbaseAddress
);
hbaseConf
.
set
(
"hbase.zookeeper.quorum"
,
hbaseZkQuorum
);
try
{
hbaseConn
=
ConnectionFactory
.
createConnection
(
hbaseConf
);
driverPhotoTablename
=
TableName
.
valueOf
(
driverPhotoTableStr
);
driverPhototable
=
hbaseConn
.
getTable
(
driverPhotoTablename
);
String
sql
=
"select * from GYJG.DRV_PHOTO where ZP is not null and fzjg is not null and sfzmhm is not null "
+
"and to_char(GXSJ,'yyyy-mm-dd')>='"
+
start
+
"' and to_char(GXSJ,'yyyy-mm-dd')<'"
+
end
+
"'"
;
Connection
connection
=
DriverManager
.
getConnection
(
url
,
username
,
password
);
PreparedStatement
pstm
=
connection
.
prepareStatement
(
sql
);
ResultSet
resultSet
=
pstm
.
executeQuery
();
while
(
resultSet
.
next
())
{
saveToHbase
(
resultSet
,
fileService
);
}
resultSet
.
close
();
pstm
.
close
();
connection
.
close
();
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
finally
{
closeTable
();
}
}
private
static
void
saveToHbase
(
ResultSet
resultSet
,
FileService
fileService
)
throws
Exception
{
private
static
void
saveToHbase
(
ResultSet
resultSet
,
FileService
fileService
)
throws
Exception
{
paramResultSet
(
resultSet
);
paramResultSet
(
resultSet
);
//判断图片是否已经存入fastdfs
//判断图片是否已经存入fastdfs
colValue
=
new
String
[
2
];
colValue
=
new
String
[
2
];
String
rowkey
=
sfzmhm
;
String
rowkey
=
sfzmhm
;
boolean
flag1
=
SqlHelp
.
getFlag
(
rowkey
,
driverPhototable
,
colValue
,
gxsj
);
boolean
flag1
=
SqlHelp
.
getFlag
(
rowkey
,
driverPhototable
,
colValue
,
gxsj
);
logger
.
info
(
flag1
+
"================"
);
if
(
flag1
)
{
if
(
flag1
)
{
Put
put
=
new
Put
(
rowkey
.
getBytes
());
Put
put
=
new
Put
(
rowkey
.
getBytes
());
put
.
addColumn
(
"info"
.
getBytes
(),
"sfzmhm"
.
getBytes
(),
sfzmhm
.
getBytes
());
put
.
addColumn
(
"info"
.
getBytes
(),
"sfzmhm"
.
getBytes
(),
sfzmhm
.
getBytes
());
...
...
src/main/java/com/hikcreate/drv_photo_pic/impl/SqlHelp.java
View file @
bc49983b
package
com
.
hikcreate
.
drv_photo_pic
.
impl
;
package
com
.
hikcreate
.
drv_photo_pic
.
impl
;
import
oracle.sql.BLOB
;
import
oracle.sql.BLOB
;
import
org.apache.hadoop.hbase.Cell
;
import
org.apache.hadoop.hbase.KeyValue
;
import
org.apache.hadoop.hbase.KeyValue
;
import
org.apache.hadoop.hbase.client.Get
;
import
org.apache.hadoop.hbase.client.Get
;
import
org.apache.hadoop.hbase.client.Result
;
import
org.apache.hadoop.hbase.client.Result
;
import
org.apache.hadoop.hbase.client.Table
;
import
org.apache.hadoop.hbase.client.Table
;
import
org.apache.hadoop.hbase.util.Bytes
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
java.io.BufferedInputStream
;
import
java.io.BufferedInputStream
;
import
java.io.IOException
;
import
java.io.IOException
;
...
@@ -12,7 +16,7 @@ import java.io.InputStream;
...
@@ -12,7 +16,7 @@ import java.io.InputStream;
import
java.sql.*
;
import
java.sql.*
;
public
class
SqlHelp
{
public
class
SqlHelp
{
private
static
Logger
logger
=
LoggerFactory
.
getLogger
(
SqlHelp
.
class
);
public
static
String
getStartTime
(
String
sql
,
String
url
,
String
username
,
String
password
)
{
public
static
String
getStartTime
(
String
sql
,
String
url
,
String
username
,
String
password
)
{
String
startTime
=
null
;
String
startTime
=
null
;
try
{
try
{
...
@@ -41,16 +45,24 @@ public class SqlHelp {
...
@@ -41,16 +45,24 @@ public class SqlHelp {
get
.
addColumn
(
"info"
.
getBytes
(),
"picUrl"
.
getBytes
());
get
.
addColumn
(
"info"
.
getBytes
(),
"picUrl"
.
getBytes
());
get
.
addColumn
(
"info"
.
getBytes
(),
"gxsj"
.
getBytes
());
get
.
addColumn
(
"info"
.
getBytes
(),
"gxsj"
.
getBytes
());
Result
result
=
table
.
get
(
get
);
Result
result
=
table
.
get
(
get
);
for
(
KeyValue
value
:
result
.
raw
())
{
for
(
Cell
cell
:
result
.
rawCells
())
{
if
(
"picUrl"
.
equals
(
new
String
(
value
.
getQualifierArray
())))
{
String
colName
=
Bytes
.
toString
(
cell
.
getQualifierArray
(),
cell
.
getQualifierOffset
(),
cell
.
getQualifierLength
());
colValue
[
0
]
=
new
String
(
value
.
getValue
());
String
value
=
Bytes
.
toString
(
cell
.
getValueArray
(),
cell
.
getValueOffset
(),
cell
.
getValueLength
());
if
(
"picUrl"
.
equals
(
colName
))
{
colValue
[
0
]
=
value
;
}
}
if
(
"gxsj"
.
equals
(
value
.
getQualifierArray
()
))
{
if
(
"gxsj"
.
equals
(
colName
))
{
colValue
[
1
]
=
new
String
(
value
.
getValue
())
;
colValue
[
1
]
=
value
;
}
}
}
}
if
(
colValue
[
0
]
!=
null
&&
!(
gxsj
.
substring
(
0
,
19
).
compareTo
(
colValue
[
1
].
substring
(
0
,
19
))
>
0
))
{
if
(
colValue
[
0
]
==
null
){
flag1
=
true
;
}
else
if
(
colValue
[
0
]
!=
null
&&
(
gxsj
.
substring
(
0
,
19
).
compareTo
(
colValue
[
1
].
substring
(
0
,
19
))
<
0
||
gxsj
.
substring
(
0
,
19
).
compareTo
(
colValue
[
1
].
substring
(
0
,
19
))
==
0
))
{
flag1
=
false
;
flag1
=
false
;
}
else
{
logger
.
info
(
gxsj
+
"---------------"
+
colValue
[
1
]);
flag1
=
true
;
}
}
return
flag1
;
return
flag1
;
}
catch
(
IOException
e
)
{
}
catch
(
IOException
e
)
{
...
...
src/main/java/com/hikcreate/drv_photo_pic/impl/VehicleImpl.java
View file @
bc49983b
...
@@ -7,11 +7,9 @@ import javafx.scene.control.Tab;
...
@@ -7,11 +7,9 @@ import javafx.scene.control.Tab;
import
oracle.sql.BLOB
;
import
oracle.sql.BLOB
;
import
org.apache.hadoop.conf.Configuration
;
import
org.apache.hadoop.conf.Configuration
;
import
org.apache.hadoop.hbase.HBaseConfiguration
;
import
org.apache.hadoop.hbase.HBaseConfiguration
;
import
org.apache.hadoop.hbase.KeyValue
;
import
org.apache.hadoop.hbase.TableName
;
import
org.apache.hadoop.hbase.TableName
;
import
org.apache.hadoop.hbase.client.ConnectionFactory
;
import
org.apache.hadoop.hbase.client.*
;
import
org.apache.hadoop.hbase.client.Get
;
import
org.apache.hadoop.hbase.client.Put
;
import
org.apache.hadoop.hbase.client.Table
;
import
org.slf4j.Logger
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
...
@@ -21,6 +19,7 @@ import redis.clients.jedis.ZParams;
...
@@ -21,6 +19,7 @@ import redis.clients.jedis.ZParams;
import
java.io.IOException
;
import
java.io.IOException
;
import
java.sql.*
;
import
java.sql.*
;
import
java.sql.Connection
;
@Service
(
"vehicleImpl"
)
@Service
(
"vehicleImpl"
)
public
class
VehicleImpl
implements
Vehicle
{
public
class
VehicleImpl
implements
Vehicle
{
...
@@ -171,6 +170,22 @@ public class VehicleImpl implements Vehicle {
...
@@ -171,6 +170,22 @@ public class VehicleImpl implements Vehicle {
String
rowkey
=
hphm
+
"#"
+
hpzl
;
String
rowkey
=
hphm
+
"#"
+
hpzl
;
colValue
=
new
String
[
2
];
colValue
=
new
String
[
2
];
boolean
flag
=
SqlHelp
.
getFlag
(
rowkey
,
vehPicTable
,
colValue
,
gxsj
);
boolean
flag
=
SqlHelp
.
getFlag
(
rowkey
,
vehPicTable
,
colValue
,
gxsj
);
// boolean flag1 = true;
// Get get = new Get(rowkey.getBytes());
// get.addColumn("info".getBytes(), "picUrl".getBytes());
// get.addColumn("info".getBytes(), "gxsj".getBytes());
// Result result = vehPicTable.get(get);
// for (KeyValue value : result.raw()) {
// if ("picUrl".equals(new String(value.getQualifierArray()))) {
// colValue[0] = new String(value.getValue());
// }
// if ("gxsj".equals(value.getQualifierArray())) {
// colValue[1] = new String(value.getValue());
// }
// }
// if (colValue[0] != null && gxsj.substring(0, 19).compareTo(colValue[1].substring(0, 19)) < 0) {
// flag1 = false;
// }
if
(
flag
)
{
if
(
flag
)
{
Put
put
=
new
Put
(
rowkey
.
getBytes
());
Put
put
=
new
Put
(
rowkey
.
getBytes
());
put
.
addColumn
(
"info"
.
getBytes
(),
"xh"
.
getBytes
(),
(
xh
==
null
?
"null"
:
xh
).
getBytes
());
put
.
addColumn
(
"info"
.
getBytes
(),
"xh"
.
getBytes
(),
(
xh
==
null
?
"null"
:
xh
).
getBytes
());
...
...
src/main/java/com/hikcreate/service/fdfs/service/impl/FileServiceImpl.java
View file @
bc49983b
...
@@ -25,8 +25,9 @@ public class FileServiceImpl implements FileService {
...
@@ -25,8 +25,9 @@ public class FileServiceImpl implements FileService {
private
FastFileStorageClient
storageClient
;
private
FastFileStorageClient
storageClient
;
@Override
@Override
public
String
uploadFile
(
byte
[]
file
,
String
fileName
)
{
public
synchronized
String
uploadFile
(
byte
[]
file
,
String
fileName
)
{
try
{
try
{
Thread
.
sleep
(
200
);
//将文件上装到fast文件服务器上,成功则返回文件保存的路径
//将文件上装到fast文件服务器上,成功则返回文件保存的路径
String
path
=
fastDFSClient
.
uploadFile
(
file
,
fileName
);
String
path
=
fastDFSClient
.
uploadFile
(
file
,
fileName
);
if
(!
StringUtils
.
hasText
(
path
))
{
if
(!
StringUtils
.
hasText
(
path
))
{
...
...
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