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
0e2e5b41
Commit
0e2e5b41
authored
Aug 21, 2019
by
李辅翼
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
v14
parent
4a56114c
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
18 additions
and
289 deletions
+18
-289
pom.xml
+0
-43
src/main/java/com/hikcreate/controller/PicController.java
+1
-22
src/main/java/com/hikcreate/drv_photo_pic/VioPic.java
+0
-9
src/main/java/com/hikcreate/drv_photo_pic/impl/DrvPhotoImpl.java
+13
-18
src/main/java/com/hikcreate/drv_photo_pic/impl/VehicleImpl.java
+0
-1
src/main/java/com/hikcreate/drv_photo_pic/impl/VioPicImpl.java
+0
-0
src/main/java/com/hikcreate/schedul/PicSchedule.java
+0
-11
src/main/java/com/hikcreate/service/fdfs/service/impl/FileServiceImpl.java
+4
-3
src/main/java/com/hikcreate/utils/redis/RedisBuilder.java
+0
-32
src/main/java/com/hikcreate/utils/redis/RedisClient.java
+0
-0
src/main/java/com/hikcreate/utils/redis/RedisClientUtil.java
+0
-32
src/main/java/com/hikcreate/utils/redis/RedisUtils.java
+0
-118
No files found.
pom.xml
View file @
0e2e5b41
...
...
@@ -59,13 +59,6 @@
<scope>
test
</scope>
</dependency>
<!--<dependency>-->
<!--<groupId>oracle</groupId>-->
<!--<artifactId>ojdbc6</artifactId>-->
<!--<version>11.2.0.3</version>-->
<!--<scope>system</scope>-->
<!--<systemPath>${project.basedir}/src/main/resources/lib/ojdbc6-11.2.0.3.jar</systemPath>-->
<!--</dependency>-->
<dependency>
<groupId>
com.oracle
</groupId>
...
...
@@ -74,29 +67,6 @@
</dependency>
<dependency>
<groupId>
org.apache.hive
</groupId>
<artifactId>
hive-jdbc
</artifactId>
<version>
1.1.0-cdh5.15.1
</version>
<exclusions>
<exclusion>
<artifactId>
slf4j-log4j12
</artifactId>
<groupId>
org.slf4j
</groupId>
</exclusion>
<exclusion>
<groupId>
javax.servlet
</groupId>
<artifactId>
servlet-api
</artifactId>
</exclusion>
<exclusion>
<groupId>
org.apache.geronimo.specs
</groupId>
<artifactId>
geronimo-annotation_1.0_spec
</artifactId>
</exclusion>
<exclusion>
<groupId>
org.apache.geronimo.specs
</groupId>
<artifactId>
geronimo-jaspic_1.0_spec
</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-starter-web
</artifactId>
</dependency>
...
...
@@ -109,19 +79,6 @@
<dependency>
<groupId>
redis.clients
</groupId>
<artifactId>
jedis
</artifactId>
<version>
2.9.0
</version>
<exclusions>
<exclusion>
<artifactId>
log4j-over-slf4j
</artifactId>
<groupId>
org.slf4j
</groupId>
</exclusion>
</exclusions>
<type>
jar
</type>
<scope>
compile
</scope>
</dependency>
<dependency>
<groupId>
com.alibaba
</groupId>
<artifactId>
fastjson
</artifactId>
<version>
1.2.51
</version>
...
...
src/main/java/com/hikcreate/controller/PicController.java
View file @
0e2e5b41
...
...
@@ -3,22 +3,18 @@ package com.hikcreate.controller;
import
com.alibaba.fastjson.JSONObject
;
import
com.hikcreate.drv_photo_pic.DrvPhoto
;
import
com.hikcreate.drv_photo_pic.Vehicle
;
import
com.hikcreate.drv_photo_pic.VioPic
;
import
com.hikcreate.entity.PicByte
;
import
com.hikcreate.service.fdfs.service.FileService
;
import
com.hikcreate.utils.DateUtil
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.util.LinkedMultiValueMap
;
import
org.springframework.util.MultiValueMap
;
import
org.springframework.validation.annotation.Validated
;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.client.RestTemplate
;
import
javax.imageio.stream.FileImageOutputStream
;
import
javax.servlet.http.HttpServletResponse
;
import
java.io.*
;
import
java.util.Date
;
import
java.util.Map
;
import
org.springframework.http.*
;
...
...
@@ -33,8 +29,6 @@ import org.springframework.http.*;
@RequestMapping
(
"/pic"
)
public
class
PicController
{
@Autowired
private
VioPic
vioPic
;
@Autowired
private
DrvPhoto
drvPhoto
;
...
...
@@ -114,10 +108,7 @@ public class PicController {
}
@GetMapping
(
"/testIncVioPic"
)
public
void
testIncVioPic
(
@RequestParam
(
"start"
)
String
start
,
@RequestParam
(
"end"
)
String
end
)
{
vioPic
.
getIncrementVioPic
(
start
,
end
);
}
...
...
@@ -197,18 +188,6 @@ public class PicController {
}
}
@GetMapping
(
"/testIncVio"
)
public
void
testFastDfs
(
@RequestParam
(
"past"
)
int
past
)
{
String
date
=
DateUtil
.
getDate
();
vioPic
.
getIncrementVioPic
(
DateUtil
.
formatDate
(
DateUtil
.
getPastDate
(
new
Date
(),-
past
)),
date
);
}
@GetMapping
(
"/delAllVioPic"
)
public
void
delAllVioPic
(
@RequestParam
(
"past"
)
int
past
){
vioPic
.
delAllVioPic
();
}
}
src/main/java/com/hikcreate/drv_photo_pic/VioPic.java
deleted
100644 → 0
View file @
4a56114c
package
com
.
hikcreate
.
drv_photo_pic
;
public
interface
VioPic
{
void
getIncrementVioPic
(
String
startDay
,
String
endDay
);
void
delAllVioPic
();
}
src/main/java/com/hikcreate/drv_photo_pic/impl/DrvPhotoImpl.java
View file @
0e2e5b41
...
...
@@ -6,11 +6,9 @@ import com.hikcreate.drv_photo_pic.DrvPhoto;
import
com.hikcreate.entity.PicResult
;
import
com.hikcreate.service.fdfs.service.FileService
;
import
com.hikcreate.utils.DateUtil
;
import
com.hikcreate.utils.redis.RedisClientUtil
;
import
oracle.sql.BLOB
;
import
org.apache.hadoop.conf.Configuration
;
import
org.apache.hadoop.hbase.HBaseConfiguration
;
import
org.apache.hadoop.hbase.KeyValue
;
import
org.apache.hadoop.hbase.TableName
;
import
org.apache.hadoop.hbase.client.*
;
import
org.slf4j.Logger
;
...
...
@@ -33,8 +31,6 @@ import java.util.zip.CRC32;
@Service
(
"drvPhotoImpl"
)
public
class
DrvPhotoImpl
implements
DrvPhoto
{
@Autowired
private
RedisClientUtil
redisClientUtil
;
private
static
Logger
logger
=
LoggerFactory
.
getLogger
(
DrvPhotoImpl
.
class
);
@Value
(
"${url}"
)
...
...
@@ -89,7 +85,7 @@ public class DrvPhotoImpl implements DrvPhoto {
try
{
hbaseConn
=
ConnectionFactory
.
createConnection
(
hbaseConf
);
endTime
=
time
;
startTime
=
SqlHelp
.
getStartTime
(
"select min(GXSJ) mtime from GYJG.DRV_PHOTO"
,
url
,
username
,
password
);
startTime
=
SqlHelp
.
getStartTime
(
"select min(GXSJ) mtime from GYJG.DRV_PHOTO"
,
url
,
username
,
password
);
//循环获取图片
String
sql
;
String
lastTime
;
...
...
@@ -214,23 +210,23 @@ public class DrvPhotoImpl implements DrvPhoto {
//判断图片是否已经存入fastdfs
colValue
=
new
String
[
2
];
String
rowkey
=
sfzmhm
;
PicResult
picResult
=
SqlHelp
.
getFlag
(
rowkey
,
driverPhototable
,
colValue
,
gxsj
);
if
(
picResult
.
getI
()
!=
0
)
{
if
(
picResult
.
getI
()==
2
)
{
PicResult
picResult
=
SqlHelp
.
getFlag
(
rowkey
,
driverPhototable
,
colValue
,
gxsj
);
if
(
picResult
.
getI
()
!=
0
)
{
if
(
picResult
.
getI
()
==
2
)
{
fileService
.
deleteFile
(
picResult
.
getUrl
());
}
Put
put
=
new
Put
(
rowkey
.
getBytes
());
put
.
addColumn
(
"info"
.
getBytes
(),
"sfzmhm"
.
getBytes
(),
sfzmhm
.
getBytes
());
byte
[]
bytes1
=
SqlHelp
.
blobToByteZp
(
zp
);
byte
[]
bytes1
=
SqlHelp
.
blobToByteZp
(
zp
);
String
picUrl
=
fileService
.
uploadFile
(
bytes1
,
sfzmhm
+
".jpeg"
);
put
.
addColumn
(
"info"
.
getBytes
(),
"sfzmhm"
.
getBytes
(),
(
sfzmhm
==
null
?
"null"
:
sfzmhm
).
getBytes
());
put
.
addColumn
(
"info"
.
getBytes
(),
"sfzmhm"
.
getBytes
(),
(
sfzmhm
==
null
?
"null"
:
sfzmhm
).
getBytes
());
put
.
addColumn
(
"info"
.
getBytes
(),
"picUrl"
.
getBytes
(),
picUrl
.
getBytes
());
put
.
addColumn
(
"info"
.
getBytes
(),
"gxsj"
.
getBytes
(),
(
gxsj
==
null
?
"null"
:
gxsj
).
getBytes
());
put
.
addColumn
(
"info"
.
getBytes
(),
"xzqh"
.
getBytes
(),
(
xzqh
==
null
?
"null"
:
xzqh
).
getBytes
());
put
.
addColumn
(
"info"
.
getBytes
(),
"flag"
.
getBytes
(),
(
flag
==
null
?
"null"
:
flag
).
getBytes
());
put
.
addColumn
(
"info"
.
getBytes
(),
"xh"
.
getBytes
(),
(
xh
==
null
?
"null"
:
xh
).
getBytes
());
put
.
addColumn
(
"info"
.
getBytes
(),
"rksj"
.
getBytes
(),
(
rksj
==
null
?
"null"
:
rksj
).
getBytes
());
put
.
addColumn
(
"info"
.
getBytes
(),
"fzjg"
.
getBytes
(),
(
fzjg
==
null
?
"null"
:
fzjg
).
getBytes
());
put
.
addColumn
(
"info"
.
getBytes
(),
"gxsj"
.
getBytes
(),
(
gxsj
==
null
?
"null"
:
gxsj
).
getBytes
());
put
.
addColumn
(
"info"
.
getBytes
(),
"xzqh"
.
getBytes
(),
(
xzqh
==
null
?
"null"
:
xzqh
).
getBytes
());
put
.
addColumn
(
"info"
.
getBytes
(),
"flag"
.
getBytes
(),
(
flag
==
null
?
"null"
:
flag
).
getBytes
());
put
.
addColumn
(
"info"
.
getBytes
(),
"xh"
.
getBytes
(),
(
xh
==
null
?
"null"
:
xh
).
getBytes
());
put
.
addColumn
(
"info"
.
getBytes
(),
"rksj"
.
getBytes
(),
(
rksj
==
null
?
"null"
:
rksj
).
getBytes
());
put
.
addColumn
(
"info"
.
getBytes
(),
"fzjg"
.
getBytes
(),
(
fzjg
==
null
?
"null"
:
fzjg
).
getBytes
());
driverPhototable
.
put
(
put
);
}
}
...
...
@@ -246,7 +242,7 @@ public class DrvPhotoImpl implements DrvPhoto {
}
}
private
void
closeTable
(){
private
void
closeTable
()
{
if
(
driverPhototable
!=
null
)
{
try
{
driverPhototable
.
close
();
...
...
@@ -275,7 +271,6 @@ public class DrvPhotoImpl implements DrvPhoto {
}
public
static
void
main
(
String
[]
args
)
{
// String url="http://193.5.103.124:8083/5251522281554187435986/2019/06/07/11/zhbrt193313019kk/11495774795494205.jpg?fid=156008-358BE80027-2E8B5C6-B190C";
String
url
=
"ftp://vion6:vion6@52.1.113.218:21/193.2.117.66/kk/2019-07-06/18/2019070618541777800022598.jpg"
;
String
[]
arr
=
url
.
split
(
"/"
);
System
.
out
.
println
(
arr
[
arr
.
length
-
1
].
split
(
"jpg"
)[
0
]
+
"jpg"
);
...
...
src/main/java/com/hikcreate/drv_photo_pic/impl/VehicleImpl.java
View file @
0e2e5b41
...
...
@@ -229,7 +229,6 @@ public class VehicleImpl implements Vehicle {
}
private
String
uploadFile
(
byte
[]
file
,
String
fileName
)
{
String
url
;
try
{
...
...
src/main/java/com/hikcreate/drv_photo_pic/impl/VioPicImpl.java
deleted
100644 → 0
View file @
4a56114c
This diff is collapsed.
Click to expand it.
src/main/java/com/hikcreate/schedul/PicSchedule.java
View file @
0e2e5b41
...
...
@@ -2,7 +2,6 @@ package com.hikcreate.schedul;
import
com.hikcreate.drv_photo_pic.DrvPhoto
;
import
com.hikcreate.drv_photo_pic.Vehicle
;
import
com.hikcreate.drv_photo_pic.VioPic
;
import
com.hikcreate.utils.DateUtil
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
...
...
@@ -17,8 +16,6 @@ public class PicSchedule {
@Autowired
private
DrvPhoto
drvPhoto
;
@Autowired
private
VioPic
vioPic
;
@Autowired
private
Vehicle
vehicle
;
@Value
(
"${pastDay}"
)
...
...
@@ -35,14 +32,6 @@ public class PicSchedule {
}
/**
* 每天早上10点同步违法增量数据
*/
// @Scheduled(cron = "0 0 11 * * *")
public
void
getIncrementVioPic
(){
String
date
=
DateUtil
.
getDate
();
vioPic
.
getIncrementVioPic
(
DateUtil
.
formatDate
(
DateUtil
.
getPastDate
(
new
Date
(),-
pastDay
)),
date
);
}
/**
* 每天早上9点同步机动车的增量数据
...
...
src/main/java/com/hikcreate/service/fdfs/service/impl/FileServiceImpl.java
View file @
0e2e5b41
...
...
@@ -30,7 +30,7 @@ public class FileServiceImpl implements FileService {
if
(!
StringUtils
.
hasText
(
path
))
{
logger
.
error
(
"Upload Img Error"
);
}
logger
.
info
(
"Upload Img Success. path {}"
,
(
"/group"
+
path
.
split
(
"group"
)[
1
]));
//
logger.info("Upload Img Success. path {}", ("/group" + path.split("group")[1]));
return
"/group"
+
path
.
split
(
"group"
)[
1
];
}
...
...
@@ -43,10 +43,11 @@ public class FileServiceImpl implements FileService {
@Override
public
void
deleteFile
(
String
path
)
{
try
{
logger
.
info
(
"删除图片:"
+
path
);
//
logger.info("删除图片:" + path);
fastDFSClient
.
deleteFile
(
path
);
}
catch
(
Exception
e
)
{
deleteFile
(
path
);
// e.printStackTrace();
logger
.
error
(
e
.
toString
());
}
}
...
...
src/main/java/com/hikcreate/utils/redis/RedisBuilder.java
deleted
100644 → 0
View file @
4a56114c
package
com
.
hikcreate
.
utils
.
redis
;
import
org.springframework.util.StringUtils
;
import
redis.clients.jedis.JedisCluster
;
/**
* Copyright (C)
* All rights reserved
* <p>
* 项目名称 : RTComputation
* 项目描述:
* <p>
* com.zcreator.bigdata.rtc.common.redis
* <p>
* created by guangzhong.wgz
* date time 2018/11/22
**/
public
class
RedisBuilder
{
/**
* @param hosts
* @return
*/
public
static
synchronized
RedisClient
getRedisClient
(
String
hosts
)
{
if
(
StringUtils
.
isEmpty
(
hosts
))
{
throw
new
RuntimeException
(
"hosts is empty"
);
}
JedisCluster
jedisCluster
=
RedisUtils
.
getClusterClient
(
hosts
);
return
new
RedisClient
(
jedisCluster
);
}
}
src/main/java/com/hikcreate/utils/redis/RedisClient.java
deleted
100644 → 0
View file @
4a56114c
This diff is collapsed.
Click to expand it.
src/main/java/com/hikcreate/utils/redis/RedisClientUtil.java
deleted
100644 → 0
View file @
4a56114c
package
com
.
hikcreate
.
utils
.
redis
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.stereotype.Component
;
/**
* @auther: lifuyi
* @date: 2019/1/31 10:53
* @description:
*/
@Component
public
class
RedisClientUtil
{
@Value
(
"${redis.server}"
)
private
static
String
redisServer
;
@Autowired
private
static
RedisClient
redisClient
;
public
static
RedisClient
getRedisClient
()
{
if
(
redisClient
==
null
)
{
synchronized
(
RedisClientUtil
.
class
)
{
redisClient
=
RedisBuilder
.
getRedisClient
(
redisServer
);
}
}
return
redisClient
;
}
}
src/main/java/com/hikcreate/utils/redis/RedisUtils.java
deleted
100644 → 0
View file @
4a56114c
package
com
.
hikcreate
.
utils
.
redis
;
import
org.springframework.util.StringUtils
;
import
redis.clients.jedis.*
;
import
java.util.ArrayList
;
import
java.util.HashSet
;
import
java.util.List
;
import
java.util.Set
;
import
java.util.stream.Stream
;
public
class
RedisUtils
{
// 非切片连接池
private
static
JedisPool
jedisPool
;
// 非切片连接池
private
static
JedisSentinelPool
jedisSentinelPool
;
// 切片连接池
private
static
ShardedJedisPool
shardedJedisPool
;
private
static
JedisPoolConfig
config
;
private
static
JedisCluster
jedisCluster
;
static
{
config
=
new
JedisPoolConfig
();
config
.
setMaxTotal
(
20
);
config
.
setMaxIdle
(
5
);
config
.
setMaxWaitMillis
(
1000
l
);
config
.
setTestOnBorrow
(
false
);
config
.
setJmxEnabled
(
true
);
}
public
static
Jedis
getJedisSentinelPool
()
{
if
(
jedisSentinelPool
==
null
)
{
synchronized
(
RedisUtils
.
class
)
{
if
(
jedisSentinelPool
==
null
)
{
// JedisSentinelPool 初始化
String
masterName
=
"cdh6"
;
//sentinel地址集合
Set
<
String
>
set
=
new
HashSet
<>();
set
.
add
(
"10.1.80.4:26379"
);
set
.
add
(
"10.1.80.5:26379"
);
set
.
add
(
"10.1.80.7:26379"
);
jedisSentinelPool
=
new
JedisSentinelPool
(
masterName
,
set
,
config
);
}
}
}
return
jedisSentinelPool
.
getResource
();
}
public
static
Jedis
getJedis
()
{
if
(
jedisPool
==
null
)
{
synchronized
(
RedisUtils
.
class
)
{
Set
<
HostAndPort
>
jedisClusterNodes
=
new
HashSet
<>();
jedisClusterNodes
.
add
(
new
HostAndPort
(
"10.1.80.8"
,
6379
));
JedisCluster
jc
=
new
JedisCluster
(
jedisClusterNodes
);
}
}
return
jedisPool
.
getResource
();
}
public
static
ShardedJedis
getShardedJedis
()
{
//初始化非切片池
List
<
JedisShardInfo
>
shards
=
new
ArrayList
<>();
shards
.
add
(
new
JedisShardInfo
(
"cd1"
,
6379
,
"master"
));
shards
.
add
(
new
JedisShardInfo
(
"cd2"
,
6379
,
"master"
));
shards
.
add
(
new
JedisShardInfo
(
"cd3"
,
6379
,
"master"
));
shards
.
add
(
new
JedisShardInfo
(
"cd4"
,
6379
,
"master"
));
shards
.
add
(
new
JedisShardInfo
(
"cd5"
,
6379
,
"master"
));
shards
.
add
(
new
JedisShardInfo
(
"cd6"
,
6379
,
"master"
));
shards
.
add
(
new
JedisShardInfo
(
"cd7"
,
6379
,
"master"
));
shards
.
add
(
new
JedisShardInfo
(
"cd8"
,
6379
,
"master"
));
shardedJedisPool
=
new
ShardedJedisPool
(
config
,
shards
);
ShardedJedis
shardedJedis
=
shardedJedisPool
.
getResource
();
return
shardedJedis
;
}
public
static
JedisCluster
getClusterClient
(
String
hosts
)
{
if
(
jedisCluster
==
null
)
{
synchronized
(
RedisUtils
.
class
)
{
if
(
jedisCluster
==
null
)
{
if
(
StringUtils
.
isEmpty
(
hosts
))
{
throw
new
RuntimeException
(
"hosts is empty"
);
}
Set
<
HostAndPort
>
jedisClusterNodes
=
new
HashSet
<>();
String
[]
hostStr
=
hosts
.
split
(
","
);
Stream
.
of
(
hostStr
).
forEach
(
host
->
{
String
args
[]
=
host
.
split
(
":"
);
if
(
args
.
length
!=
2
)
{
throw
new
RuntimeException
(
"host format error"
);
}
jedisClusterNodes
.
add
(
new
HostAndPort
(
args
[
0
],
Integer
.
parseInt
(
args
[
1
])));
});
jedisCluster
=
new
JedisCluster
(
jedisClusterNodes
);
}
}
}
return
jedisCluster
;
}
public
static
void
getOne
()
{
Jedis
jedis
=
new
Jedis
(
"cdh1"
);
jedis
.
set
(
"foo"
,
"bar"
);
String
value
=
jedis
.
get
(
"foo"
);
}
}
\ No newline at end of file
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