Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
C
cneeds-server
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
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
zhangzr
cneeds-server
Commits
87ce018e
Commit
87ce018e
authored
Apr 22, 2020
by
zzrdark
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1.fix
parent
acead85a
Hide whitespace changes
Inline
Side-by-side
Showing
15 changed files
with
173 additions
and
46 deletions
+173
-46
application-prod.yml
...ver-authorization/src/main/resources/application-prod.yml
+0
-2
application.yml
...s-server-authorization/src/main/resources/application.yml
+1
-1
pom.xml
cneeds-server-datashow/pom.xml
+5
-0
FilePath.java
...src/main/java/com/mx/cneeds/common/constant/FilePath.java
+13
-0
OAuth2ResourceServer.java
...x/cneeds/server/datashow/config/OAuth2ResourceServer.java
+2
-0
LogFlieController.java
.../cneeds/server/datashow/web/device/LogFlieController.java
+20
-4
WechatController.java
...x/cneeds/server/datashow/web/wechat/WechatController.java
+81
-0
application-dev.yml
...ds-server-datashow/src/main/resources/application-dev.yml
+13
-0
application-prod.yml
...s-server-datashow/src/main/resources/application-prod.yml
+15
-2
application.yml
cneeds-server-datashow/src/main/resources/application.yml
+3
-4
application-prod.yml
cneeds-server-device/src/main/resources/application-prod.yml
+2
-28
application.yml
cneeds-server-eureka/src/main/resources/application.yml
+1
-1
application-prod.yml
...-server-logupload/src/main/resources/application-prod.yml
+14
-0
application.yml
cneeds-server-logupload/src/main/resources/application.yml
+1
-1
application-prod.yml
cneeds-server-user/src/main/resources/application-prod.yml
+2
-3
No files found.
cneeds-server-authorization/src/main/resources/application-prod.yml
View file @
87ce018e
...
@@ -12,4 +12,3 @@ eureka:
...
@@ -12,4 +12,3 @@ eureka:
defaultZone
:
http://127.0.0.1:8761/eureka/
defaultZone
:
http://127.0.0.1:8761/eureka/
instance
:
instance
:
prefer-ip-address
:
true
prefer-ip-address
:
true
ip-address
:
192.168.2.244
\ No newline at end of file
cneeds-server-authorization/src/main/resources/application.yml
View file @
87ce018e
spring
:
spring
:
profiles
:
profiles
:
active
:
dev
active
:
prod
application
:
application
:
name
:
cneeds-server-authorization
name
:
cneeds-server-authorization
server
:
server
:
...
...
cneeds-server-datashow/pom.xml
View file @
87ce018e
...
@@ -32,6 +32,11 @@
...
@@ -32,6 +32,11 @@
<artifactId>
cneeds-common-pojo
</artifactId>
<artifactId>
cneeds-common-pojo
</artifactId>
<version>
1.0-SNAPSHOT
</version>
<version>
1.0-SNAPSHOT
</version>
</dependency>
</dependency>
<dependency>
<groupId>
com.mx.cneeds
</groupId>
<artifactId>
cneeds-common-hadoop-dfs
</artifactId>
<version>
1.0-SNAPSHOT
</version>
</dependency>
<!-- for Spring Security -->
<!-- for Spring Security -->
<dependency>
<dependency>
...
...
cneeds-server-datashow/src/main/java/com/mx/cneeds/common/constant/FilePath.java
0 → 100644
View file @
87ce018e
package
com
.
mx
.
cneeds
.
common
.
constant
;
/**
* @ClassName FilePath
* @Author zzrdark
* @Date 2020-04-22 14:29
* @Description TODO
**/
public
class
FilePath
{
public
static
String
LogFilePath
=
"/cneedsFile/LogFilePath/"
;
public
static
String
wechatFilePath
=
"/cneedsFile/wechatPath/"
;
}
cneeds-server-datashow/src/main/java/com/mx/cneeds/server/datashow/config/OAuth2ResourceServer.java
View file @
87ce018e
...
@@ -21,6 +21,8 @@ public class OAuth2ResourceServer extends ResourceServerConfigurerAdapter {
...
@@ -21,6 +21,8 @@ public class OAuth2ResourceServer extends ResourceServerConfigurerAdapter {
http
.
authorizeRequests
()
http
.
authorizeRequests
()
.
antMatchers
(
"/user/login"
,
.
antMatchers
(
"/user/login"
,
"/device/device/getChannel_nums"
,
"/device/device/getChannel_nums"
,
"/wechat/wechatFileUpload"
,
"/wechat/wechatDownload/**"
,
// "/user/info",
// "/user/info",
"/statics/**"
)
"/statics/**"
)
.
permitAll
()
.
permitAll
()
...
...
cneeds-server-datashow/src/main/java/com/mx/cneeds/server/datashow/web/device/LogFlieController.java
View file @
87ce018e
package
com
.
mx
.
cneeds
.
server
.
datashow
.
web
.
device
;
package
com
.
mx
.
cneeds
.
server
.
datashow
.
web
.
device
;
import
com.google.gson.Gson
;
import
com.google.gson.Gson
;
import
com.mx.cneeds.common.constant.FilePath
;
import
com.mx.cneeds.common.converter.RequestParamterConverter
;
import
com.mx.cneeds.common.converter.RequestParamterConverter
;
import
com.mx.cneeds.common.dto.*
;
import
com.mx.cneeds.common.dto.*
;
import
com.mx.cneeds.common.result.R
;
import
com.mx.cneeds.common.result.R
;
...
@@ -8,6 +9,7 @@ import com.mx.cneeds.common.vo.DeviceLogFileVo;
...
@@ -8,6 +9,7 @@ import com.mx.cneeds.common.vo.DeviceLogFileVo;
import
com.mx.cneeds.common.vo.WechatDeviceLogVo
;
import
com.mx.cneeds.common.vo.WechatDeviceLogVo
;
import
com.mx.cneeds.server.datashow.client.DeviceClient
;
import
com.mx.cneeds.server.datashow.client.DeviceClient
;
import
com.mx.cneeds.server.datashow.client.LogFileClient
;
import
com.mx.cneeds.server.datashow.client.LogFileClient
;
import
com.mx.hbasefile.hadoop.hdfs.api.HdfsTemplate
;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.lang.StringUtils
;
import
org.apache.commons.lang.StringUtils
;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.beans.BeanUtils
;
...
@@ -22,10 +24,8 @@ import org.springframework.web.multipart.MultipartFile;
...
@@ -22,10 +24,8 @@ import org.springframework.web.multipart.MultipartFile;
import
java.io.File
;
import
java.io.File
;
import
java.io.FileInputStream
;
import
java.io.FileInputStream
;
import
java.io.IOException
;
import
java.io.IOException
;
import
java.util.ArrayList
;
import
java.text.SimpleDateFormat
;
import
java.util.HashSet
;
import
java.util.*
;
import
java.util.List
;
import
java.util.Set
;
/**
/**
* @ClassName LogFileController
* @ClassName LogFileController
...
@@ -44,6 +44,9 @@ public class LogFlieController {
...
@@ -44,6 +44,9 @@ public class LogFlieController {
@Autowired
@Autowired
private
DeviceClient
deviceClient
;
private
DeviceClient
deviceClient
;
@Autowired
private
HdfsTemplate
hdfsTemplate
;
@PostMapping
(
"/logfile/wechatDeviceLogUpload"
)
@PostMapping
(
"/logfile/wechatDeviceLogUpload"
)
public
R
wechatUploadLog
(
WechatDeviceLogVo
vo
,
MultipartFile
[]
file
){
public
R
wechatUploadLog
(
WechatDeviceLogVo
vo
,
MultipartFile
[]
file
){
WechatDeviceLogDto
dto
=
new
WechatDeviceLogDto
();
WechatDeviceLogDto
dto
=
new
WechatDeviceLogDto
();
...
@@ -51,6 +54,7 @@ public class LogFlieController {
...
@@ -51,6 +54,7 @@ public class LogFlieController {
// 把图片存入oos 返回路径
// 把图片存入oos 返回路径
// dto.setLogfileUrl()
// dto.setLogfileUrl()
DeviceInfoDto
deviceInfoDto
=
deviceClient
.
queryDeviceByImei
(
dto
.
getImei
());
DeviceInfoDto
deviceInfoDto
=
deviceClient
.
queryDeviceByImei
(
dto
.
getImei
());
dto
.
setDeviceId
(
deviceInfoDto
.
getDeviceId
());
dto
.
setDeviceId
(
deviceInfoDto
.
getDeviceId
());
logFileClient
.
wechatUploadLog
(
dto
);
logFileClient
.
wechatUploadLog
(
dto
);
...
@@ -64,6 +68,18 @@ public class LogFlieController {
...
@@ -64,6 +68,18 @@ public class LogFlieController {
// 把图片存入oos 返回路径
// 把图片存入oos 返回路径
// dto.setLogfileUrl()
// dto.setLogfileUrl()
StringBuffer
dir
=
new
StringBuffer
(
FilePath
.
LogFilePath
);
// 1. 读取系统时间
Calendar
calendar
=
Calendar
.
getInstance
();
Date
time
=
calendar
.
getTime
();
// 2. 格式化系统时间
SimpleDateFormat
format
=
new
SimpleDateFormat
(
"yyyy-MM-dd-HH-mm-ss"
);
String
fileName
=
format
.
format
(
time
);
dir
.
append
(
fileName
);
hdfsTemplate
.
saveFile
(
dir
.
toString
(),
file
.
getName
(),
file
.
getInputStream
(),
file
.
getSize
(),
(
short
)
2
);
DeviceInfoDto
deviceInfoDto
=
deviceClient
.
queryDeviceByImei
(
dto
.
getImei
());
DeviceInfoDto
deviceInfoDto
=
deviceClient
.
queryDeviceByImei
(
dto
.
getImei
());
dto
.
setDeviceId
(
deviceInfoDto
.
getDeviceId
());
dto
.
setDeviceId
(
deviceInfoDto
.
getDeviceId
());
logFileClient
.
uploadLogFile
(
dto
);
logFileClient
.
uploadLogFile
(
dto
);
...
...
cneeds-server-datashow/src/main/java/com/mx/cneeds/server/datashow/web/wechat/WechatController.java
0 → 100644
View file @
87ce018e
package
com
.
mx
.
cneeds
.
server
.
datashow
.
web
.
wechat
;
import
com.mx.cneeds.common.constant.FilePath
;
import
com.mx.cneeds.common.result.R
;
import
com.mx.hbasefile.hadoop.hdfs.api.HdfsTemplate
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Controller
;
import
org.springframework.web.bind.annotation.PathVariable
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.ResponseBody
;
import
org.springframework.web.multipart.MultipartFile
;
import
javax.servlet.ServletOutputStream
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletResponse
;
import
java.io.IOException
;
import
java.io.InputStream
;
import
java.text.SimpleDateFormat
;
import
java.util.Calendar
;
import
java.util.Date
;
/**
* @ClassName WechatController
* @Author zzrdark
* @Date 2020-04-22 16:29
* @Description TODO
**/
@Controller
@RequestMapping
(
"/wechat"
)
public
class
WechatController
{
@Autowired
private
HdfsTemplate
hdfsTemplate
;
@RequestMapping
(
"/wechatFileUpload"
)
@ResponseBody
public
R
upload
(
HttpServletRequest
httpServletRequest
,
MultipartFile
file
)
throws
IOException
{
StringBuffer
dir
=
new
StringBuffer
(
FilePath
.
wechatFilePath
);
// 1. 读取系统时间
Calendar
calendar
=
Calendar
.
getInstance
();
Date
time
=
calendar
.
getTime
();
// 2. 格式化系统时间
SimpleDateFormat
format
=
new
SimpleDateFormat
(
"yyyy-MM-dd-HH-mm-ss"
);
String
fileName
=
format
.
format
(
time
);
dir
.
append
(
fileName
);
hdfsTemplate
.
saveFile
(
dir
.
toString
(),
file
.
getOriginalFilename
(),
file
.
getInputStream
(),
file
.
getSize
(),
(
short
)
2
);
String
sufUrl
=
httpServletRequest
.
getScheme
()
+
"://"
+
httpServletRequest
.
getServerName
()
+
":"
+
httpServletRequest
.
getServerPort
()+
"/wechat/wechatDownload/"
+
fileName
+
"/"
+
file
.
getOriginalFilename
();
return
R
.
ok
().
put
(
"data"
,
sufUrl
);
}
@RequestMapping
(
"/wechatDownload/{dir}/{fileName}"
)
public
void
download
(
@PathVariable
(
"dir"
)
String
dir
,
@PathVariable
(
"fileName"
)
String
fileName
,
HttpServletResponse
response
)
throws
IOException
{
StringBuffer
dirPath
=
new
StringBuffer
(
FilePath
.
wechatFilePath
);
dirPath
.
append
(
dir
);
InputStream
inputStream
=
hdfsTemplate
.
openFile
(
dirPath
.
toString
(),
fileName
);
ServletOutputStream
outputStream
=
response
.
getOutputStream
();
String
mediaType
=
fileName
.
substring
(
fileName
.
indexOf
(
"."
));
response
.
setContentType
(
mediaType
);
response
.
addHeader
(
"Content-Disposition"
,
"attachment; filename"
+
"testfilename"
);
byte
[]
bytes
=
new
byte
[
1024
];
int
i
=
0
;
while
((
i
=
inputStream
.
read
(
bytes
))
!=
-
1
)
{
outputStream
.
write
(
bytes
,
0
,
i
);
outputStream
.
flush
();
}
outputStream
.
close
();
}
}
cneeds-server-datashow/src/main/resources/application-dev.yml
View file @
87ce018e
...
@@ -6,3 +6,15 @@ eureka:
...
@@ -6,3 +6,15 @@ eureka:
prefer-ip-address
:
true
prefer-ip-address
:
true
spring
:
hadoop
:
hdfs
:
hadoopConfigDir
:
D:\hadoop2.6_Win_x64\etc\hadoop
# hadoopConfigDir: /home/fengte/hadoop/etc/hadoop/
hdfsUrl
:
hdfs://192.168.2.244:9100
defaultBlockSize
:
128000000
bufferSize
:
512000
servlet
:
multipart
:
max-file-size
:
100000MB
max-request-size
:
100000MB
\ No newline at end of file
cneeds-server-datashow/src/main/resources/application-prod.yml
View file @
87ce018e
eureka
:
eureka
:
client
:
client
:
service-url
:
service-url
:
defaultZone
:
http://
192.168.2.244
:8761/eureka/
defaultZone
:
http://
localhost
:8761/eureka/
instance
:
instance
:
prefer-ip-address
:
true
prefer-ip-address
:
true
ip-address
:
192.168.2.244
spring
:
hadoop
:
hdfs
:
hadoopConfigDir
:
/root/hadoop-2.7.1/etc/hadoop/
hdfsUrl
:
hdfs://localhost:9100
defaultBlockSize
:
128000000
bufferSize
:
512000
servlet
:
multipart
:
max-file-size
:
100000MB
max-request-size
:
100000MB
\ No newline at end of file
cneeds-server-datashow/src/main/resources/application.yml
View file @
87ce018e
spring
:
spring
:
profiles
:
profiles
:
active
:
dev
active
:
prod
application
:
application
:
name
:
cneeds-server-datashow
name
:
cneeds-server-datashow
server
:
server
:
port
:
9000
port
:
9000
servlet
:
servlet
:
context-path
:
/
context-path
:
/
\ No newline at end of file
cneeds-server-device/src/main/resources/application-prod.yml
View file @
87ce018e
spring
:
spring
:
datasource
:
datasource
:
driver-class-name
:
com.mysql.cj.jdbc.Driver
driver-class-name
:
com.mysql.cj.jdbc.Driver
url
:
jdbc:mysql://
192.168.2.244
:3306/cneeds_server?useUnicode=true&characterEncoding=UTF-8&useSSL=false
url
:
jdbc:mysql://
localhost
:3306/cneeds_server?useUnicode=true&characterEncoding=UTF-8&useSSL=false
password
:
cneeds!QAZ1qaz
password
:
cneeds!QAZ1qaz
username
:
root
username
:
root
...
@@ -9,31 +9,6 @@ spring:
...
@@ -9,31 +9,6 @@ spring:
eureka
:
eureka
:
client
:
client
:
service-url
:
service-url
:
defaultZone
:
http://
192.168.2.244
:8761/eureka/
defaultZone
:
http://
localhost
:8761/eureka/
instance
:
instance
:
prefer-ip-address
:
true
prefer-ip-address
:
true
ip-address
:
192.168.2.244
mybatis-plus
:
mapper-locations
:
classpath:mapper/*.xml
#实体扫描,多个package用逗号或者分号分隔
typeAliasesPackage
:
com.mx.cneeds.server.entity
global-config
:
#数据库相关配置
db-config
:
#主键类型 AUTO:"数据库ID自增", INPUT:"用户输入ID", ID_WORKER:"全局唯一ID (数字类型唯一ID)", UUID:"全局唯一ID UUID";
id-type
:
AUTO
#字段策略 IGNORED:"忽略判断",NOT_NULL:"非 NULL 判断"),NOT_EMPTY:"非空判断"
field-strategy
:
NOT_NULL
#驼峰下划线转换
column-underline
:
true
logic-delete-value
:
-1
logic-not-delete-value
:
0
banner
:
false
#原生配置
configuration
:
map-underscore-to-camel-case
:
true
cache-enabled
:
false
call-setters-on-nulls
:
true
jdbc-type-for-null
:
'
null'
\ No newline at end of file
cneeds-server-eureka/src/main/resources/application.yml
View file @
87ce018e
spring
:
spring
:
profiles
:
profiles
:
active
:
dev
active
:
prod
application
:
application
:
name
:
cneeds-server-eureka
name
:
cneeds-server-eureka
server
:
server
:
...
...
cneeds-server-logupload/src/main/resources/application-prod.yml
0 → 100644
View file @
87ce018e
spring
:
datasource
:
driver-class-name
:
com.mysql.cj.jdbc.Driver
url
:
jdbc:mysql://localhost:3306/cneeds_server?useUnicode=true&characterEncoding=UTF-8&useSSL=false
password
:
cneeds!QAZ1qaz
username
:
root
eureka
:
client
:
service-url
:
defaultZone
:
http://localhost:8761/eureka/
instance
:
prefer-ip-address
:
true
cneeds-server-logupload/src/main/resources/application.yml
View file @
87ce018e
spring
:
spring
:
profiles
:
profiles
:
active
:
dev
active
:
prod
application
:
application
:
name
:
cneeds-server-logupload
name
:
cneeds-server-logupload
...
...
cneeds-server-user/src/main/resources/application-prod.yml
View file @
87ce018e
spring
:
spring
:
datasource
:
datasource
:
driver-class-name
:
com.mysql.cj.jdbc.Driver
driver-class-name
:
com.mysql.cj.jdbc.Driver
url
:
jdbc:mysql://1
92.168.2.244
:3306/cneeds_server?useUnicode=true&characterEncoding=UTF-8&useSSL=false
url
:
jdbc:mysql://1
27.0.0.1
:3306/cneeds_server?useUnicode=true&characterEncoding=UTF-8&useSSL=false
password
:
cneeds!QAZ1qaz
password
:
cneeds!QAZ1qaz
username
:
root
username
:
root
mqtt
:
mqtt
:
...
@@ -22,9 +22,8 @@ spring:
...
@@ -22,9 +22,8 @@ spring:
eureka
:
eureka
:
client
:
client
:
service-url
:
service-url
:
defaultZone
:
http://
192.168.2.244
:8761/eureka/
defaultZone
:
http://
localhost
:8761/eureka/
instance
:
instance
:
prefer-ip-address
:
true
prefer-ip-address
:
true
ip-address
:
192.168.2.244
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