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
39cc95e8
Commit
39cc95e8
authored
Apr 07, 2020
by
zzrdark
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1.日志上传文件上传
parent
07ddf46d
Hide whitespace changes
Inline
Side-by-side
Showing
17 changed files
with
304 additions
and
28 deletions
+304
-28
cneeds_server.sql
cneeds-common-data/db/cneeds_server.sql
+1
-0
DeviceLogEntity.java
...ain/java/com/mx/cneeds/server/entity/DeviceLogEntity.java
+9
-0
DeviceLogmediaEntity.java
...ava/com/mx/cneeds/server/entity/DeviceLogmediaEntity.java
+3
-0
DeviceLogDao.xml
...ds-common-data/src/main/resources/mapper/DeviceLogDao.xml
+2
-0
DeviceLogDto.java
.../src/main/java/com/mx/cneeds/common/dto/DeviceLogDto.java
+10
-0
DeviceLogFileDto.java
.../main/java/com/mx/cneeds/common/dto/DeviceLogFileDto.java
+25
-0
WechatDeviceLogDto.java
...ain/java/com/mx/cneeds/common/dto/WechatDeviceLogDto.java
+46
-0
DeviceLogFileVo.java
...rc/main/java/com/mx/cneeds/common/vo/DeviceLogFileVo.java
+22
-0
WechatDeviceLogVo.java
.../main/java/com/mx/cneeds/common/vo/WechatDeviceLogVo.java
+46
-0
application-dev.yml
...rver-authorization/src/main/resources/application-dev.yml
+2
-2
LogFileClient.java
...a/com/mx/cneeds/server/datashow/client/LogFileClient.java
+13
-0
LogController.java
...m/mx/cneeds/server/datashow/web/device/LogController.java
+28
-12
LogFlieController.java
.../cneeds/server/datashow/web/device/LogFlieController.java
+57
-0
application-dev.yml
cneeds-server-device/src/main/resources/application-dev.yml
+1
-1
FileTemplate.java
...m/mx/cneeds/server/logupload/filesystem/FileTemplate.java
+29
-0
DeviceLogServiceImpl.java
...s/server/logupload/service/impl/DeviceLogServiceImpl.java
+5
-1
LogUploadController.java
...m/mx/cneeds/server/logupload/web/LogUploadController.java
+5
-12
No files found.
cneeds-common-data/db/cneeds_server.sql
View file @
39cc95e8
...
...
@@ -55,6 +55,7 @@ CREATE TABLE `device_log` (
`logfile_url`
varchar
(
50
)
CHARACTER
SET
utf8
COLLATE
utf8_general_ci
DEFAULT
NULL
COMMENT
'日志文件存放路径'
,
`logfile_size`
bigint
(
20
)
DEFAULT
NULL
COMMENT
'日志文件大小'
,
`logfile_status`
int
(
11
)
DEFAULT
NULL
COMMENT
'日志文件上传状态,-1,失败,0上传中,1完成'
,
`log_accept_id`
varchar
(
255
)
DEFAULT
NULL
COMMENT
'移动端日志标识符'
,
PRIMARY
KEY
(
`log_id`
)
USING
BTREE
)
ENGINE
=
InnoDB
AUTO_INCREMENT
=
1
CHARACTER
SET
=
utf8
COLLATE
=
utf8_general_ci
COMMENT
=
'测试上传的日志表'
ROW_FORMAT
=
Dynamic
;
...
...
cneeds-common-data/src/main/java/com/mx/cneeds/server/entity/DeviceLogEntity.java
View file @
39cc95e8
...
...
@@ -52,6 +52,11 @@ public class DeviceLogEntity implements Serializable {
* 复现步骤
*/
private
String
repetitionSteps
;
/**
* 复现概率
*/
private
Integer
repetitionProbability
;
/**
* 日志文件存放路径
*/
...
...
@@ -65,4 +70,8 @@ public class DeviceLogEntity implements Serializable {
*/
private
Integer
logfileStatus
;
/**
* 移动端日志文件标识符
*/
private
String
logAcceptId
;
}
cneeds-common-data/src/main/java/com/mx/cneeds/server/entity/DeviceLogmediaEntity.java
View file @
39cc95e8
...
...
@@ -24,14 +24,17 @@ public class DeviceLogmediaEntity implements Serializable {
*/
@TableId
private
Long
logmediaId
;
/**
* 音频路径
*/
private
String
locationUrl
;
/**
*
*/
private
Long
logId
;
/**
* 格式
*/
...
...
cneeds-common-data/src/main/resources/mapper/DeviceLogDao.xml
View file @
39cc95e8
...
...
@@ -16,6 +16,8 @@
<result
property=
"logfileUrl"
column=
"logfile_url"
/>
<result
property=
"logfileSize"
column=
"logfile_size"
/>
<result
property=
"logfileStatus"
column=
"logfile_status"
/>
<result
property=
"repetitionProbability"
column=
"repetition_probability"
/>
<result
property=
"logAcceptId"
column=
"log_accept_id"
/>
</resultMap>
...
...
cneeds-common-pojo/src/main/java/com/mx/cneeds/common/dto/DeviceLogDto.java
View file @
39cc95e8
...
...
@@ -54,6 +54,11 @@ public class DeviceLogDto {
private
String
repetitionSteps
;
/**
* 复现概率
*/
private
Integer
repetitionProbability
;
/**
* 日志文件存放路径
*/
private
String
logfileUrl
;
...
...
@@ -77,4 +82,9 @@ public class DeviceLogDto {
* 产品系列号
*/
private
String
seriesNum
;
/**
* 移动端日志文件标识符
*/
private
String
logAcceptId
;
}
cneeds-common-pojo/src/main/java/com/mx/cneeds/common/dto/DeviceLogFileDto.java
0 → 100644
View file @
39cc95e8
package
com
.
mx
.
cneeds
.
common
.
dto
;
import
lombok.Data
;
import
java.io.File
;
/**
* @ClassName DeviceLogFileDto
* @Author zzrdark
* @Date 2020-04-07 16:08
* @Description TODO
**/
@Data
public
class
DeviceLogFileDto
{
String
imei
;
/**
* 移动端日志唯一标识符
*/
String
logAcceptId
;
/**
* log日志文件
*/
File
logFile
;
}
cneeds-common-pojo/src/main/java/com/mx/cneeds/common/dto/WechatDeviceLogDto.java
0 → 100644
View file @
39cc95e8
package
com
.
mx
.
cneeds
.
common
.
dto
;
import
lombok.Data
;
import
java.io.File
;
import
java.util.List
;
/**
* @ClassName WechatDeviceLogVo
* @Author zzrdark
* @Date 2020-04-07 15:42
* @Description TODO
**/
@Data
public
class
WechatDeviceLogDto
{
String
imei
;
/**
* 移动端日志唯一标识符
*/
String
logAcceptId
;
/**
* 视频 图片文件
*/
List
<
File
>
files
;
/**
* bug名字
*/
String
bugTitle
;
/**
* 复现步骤
*/
String
steps
;
/**
* 复现概率
*/
Integer
probability
;
}
cneeds-common-pojo/src/main/java/com/mx/cneeds/common/vo/DeviceLogFileVo.java
0 → 100644
View file @
39cc95e8
package
com
.
mx
.
cneeds
.
common
.
vo
;
import
lombok.Data
;
import
java.io.File
;
/**
* @ClassName DeviceLogFileDto
* @Author zzrdark
* @Date 2020-04-07 16:08
* @Description TODO
**/
@Data
public
class
DeviceLogFileVo
{
String
imei
;
/**
* 移动端日志唯一标识符
*/
String
logAcceptId
;
}
cneeds-common-pojo/src/main/java/com/mx/cneeds/common/vo/WechatDeviceLogVo.java
0 → 100644
View file @
39cc95e8
package
com
.
mx
.
cneeds
.
common
.
vo
;
import
lombok.Data
;
import
java.io.File
;
import
java.util.List
;
/**
* @ClassName WechatDeviceLogVo
* @Author zzrdark
* @Date 2020-04-07 15:42
* @Description TODO
**/
@Data
public
class
WechatDeviceLogVo
{
String
imei
;
/**
* 移动端日志唯一标识符
*/
String
logAcceptId
;
/**
* 视频 图片文件
*/
List
<
File
>
files
;
/**
* bug名字
*/
String
bugTitle
;
/**
* 复现步骤
*/
String
steps
;
/**
* 复现概率
*/
Integer
probability
;
}
cneeds-server-authorization/src/main/resources/application-dev.yml
View file @
39cc95e8
...
...
@@ -12,4 +12,4 @@ eureka:
defaultZone
:
http://192.168.2.244:8761/eureka/
instance
:
prefer-ip-address
:
true
ip-address
:
192.168.2.244
\ No newline at end of file
# ip-address: 192.168.2.244
\ No newline at end of file
cneeds-server-datashow/src/main/java/com/mx/cneeds/server/datashow/client/LogFileClient.java
View file @
39cc95e8
package
com
.
mx
.
cneeds
.
server
.
datashow
.
client
;
import
com.mx.cneeds.common.dto.DeviceLogFileDto
;
import
com.mx.cneeds.common.dto.PageDto
;
import
com.mx.cneeds.common.dto.WechatDeviceLogDto
;
import
org.springframework.cloud.openfeign.FeignClient
;
import
org.springframework.http.MediaType
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestParam
;
...
...
@@ -25,4 +28,14 @@ public interface LogFileClient {
@PostMapping
(
"/log/upload/delete"
)
void
deleteLogFile
(
@RequestBody
List
<
Long
>
ids
);
@PostMapping
(
"/log/upload/finishLog"
)
void
finishLog
(
@RequestBody
Long
logId
);
@PostMapping
(
value
=
""
,
consumes
=
MediaType
.
MULTIPART_FORM_DATA_VALUE
)
void
wechatUploadLog
(
@RequestBody
WechatDeviceLogDto
dto
);
@PostMapping
(
value
=
""
,
consumes
=
MediaType
.
MULTIPART_FORM_DATA_VALUE
)
void
uploadLogFile
(
@RequestBody
DeviceLogFileDto
dto
);
}
cneeds-server-datashow/src/main/java/com/mx/cneeds/server/datashow/web/device/Log
File
Controller.java
→
cneeds-server-datashow/src/main/java/com/mx/cneeds/server/datashow/web/device/LogController.java
View file @
39cc95e8
...
...
@@ -3,10 +3,10 @@ package com.mx.cneeds.server.datashow.web.device;
import
com.google.gson.Gson
;
import
com.google.gson.GsonBuilder
;
import
com.mx.cneeds.common.converter.RequestParamterConverter
;
import
com.mx.cneeds.common.dto.DeviceInfoDto
;
import
com.mx.cneeds.common.dto.DeviceLogDto
;
import
com.mx.cneeds.common.dto.PageDto
;
import
com.mx.cneeds.common.dto.*
;
import
com.mx.cneeds.common.result.R
;
import
com.mx.cneeds.common.vo.DeviceLogFileVo
;
import
com.mx.cneeds.common.vo.WechatDeviceLogVo
;
import
com.mx.cneeds.server.datashow.client.DeviceClient
;
import
com.mx.cneeds.server.datashow.client.LogFileClient
;
import
lombok.extern.slf4j.Slf4j
;
...
...
@@ -18,7 +18,9 @@ import org.springframework.web.bind.annotation.PostMapping;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestParam
;
import
org.springframework.web.bind.annotation.RestController
;
import
org.springframework.web.multipart.MultipartFile
;
import
java.io.File
;
import
java.util.ArrayList
;
import
java.util.HashSet
;
import
java.util.List
;
...
...
@@ -33,7 +35,7 @@ import java.util.Set;
@RestController
@Slf4j
@RequestMapping
(
"/remotelog"
)
public
class
Log
File
Controller
{
public
class
LogController
{
@Autowired
private
LogFileClient
logFileClient
;
...
...
@@ -73,6 +75,7 @@ public class LogFileController {
Gson
gson
=
RequestParamterConverter
.
getGson
();
List
<
DeviceLogDto
>
deviceLogDtos
=
new
ArrayList
<>();
// LinkedHashMap 转换成List
for
(
Object
deviceLogDto:
pageDto
.
getList
()
)
{
String
deviceLogDtoStr
=
gson
.
toJson
(
deviceLogDto
);
DeviceLogDto
dto
=
gson
.
fromJson
(
deviceLogDtoStr
,
DeviceLogDto
.
class
);
...
...
@@ -84,16 +87,18 @@ public class LogFileController {
deviceSet
.
add
(
deviceLogDto
.
getDeviceId
());
});
List
<
DeviceInfoDto
>
deviceInfoDtos
=
deviceClient
.
queryDeviceByIds
(
deviceSet
);
if
(
deviceLogDtos
!=
null
&&
deviceLogDtos
.
size
()
!=
0
){
List
<
DeviceInfoDto
>
deviceInfoDtos
=
deviceClient
.
queryDeviceByIds
(
deviceSet
);
deviceLogDtos
.
forEach
(
deviceLogDto
->
{
deviceInfoDtos
.
forEach
(
deviceInfoDto
->
{
if
(
deviceLogDto
.
getDeviceId
().
equals
(
deviceInfoDto
.
getDeviceId
())
){
deviceLogDto
.
setSeriesNum
(
deviceInfoDto
.
getSeriesNum
());
deviceLogDto
.
setDeviceVersion
(
deviceInfoDto
.
getDeviceVersion
());
}
deviceLogDtos
.
forEach
(
deviceLogDto
->
{
deviceInfoDtos
.
forEach
(
deviceInfoDto
->
{
if
(
deviceLogDto
.
getDeviceId
().
equals
(
deviceInfoDto
.
getDeviceId
())
){
deviceLogDto
.
setSeriesNum
(
deviceInfoDto
.
getSeriesNum
());
deviceLogDto
.
setDeviceVersion
(
deviceInfoDto
.
getDeviceVersion
());
}
});
});
}
);
}
pageDto
.
setList
(
deviceLogDtos
);
...
...
@@ -105,4 +110,15 @@ public class LogFileController {
logFileClient
.
deleteLogFile
(
ids
);
return
R
.
ok
();
}
/**
* 处理完成日志
* @return
*/
@PostMapping
(
"/logfile/finish"
)
public
R
finishLog
(
@RequestParam
(
value
=
"logId"
)
Long
logId
){
logFileClient
.
finishLog
(
logId
);
return
R
.
ok
();
}
}
cneeds-server-datashow/src/main/java/com/mx/cneeds/server/datashow/web/device/LogFlieController.java
0 → 100644
View file @
39cc95e8
package
com
.
mx
.
cneeds
.
server
.
datashow
.
web
.
device
;
import
com.google.gson.Gson
;
import
com.mx.cneeds.common.converter.RequestParamterConverter
;
import
com.mx.cneeds.common.dto.*
;
import
com.mx.cneeds.common.result.R
;
import
com.mx.cneeds.common.vo.DeviceLogFileVo
;
import
com.mx.cneeds.common.vo.WechatDeviceLogVo
;
import
com.mx.cneeds.server.datashow.client.DeviceClient
;
import
com.mx.cneeds.server.datashow.client.LogFileClient
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.lang.StringUtils
;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Controller
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestParam
;
import
org.springframework.web.bind.annotation.RestController
;
import
org.springframework.web.multipart.MultipartFile
;
import
java.util.ArrayList
;
import
java.util.HashSet
;
import
java.util.List
;
import
java.util.Set
;
/**
* @ClassName LogFileController
* @Author zzrdark
* @Date 2020-04-01 15:14
* @Description TODO
**/
@Controller
@Slf4j
@RequestMapping
(
"/logFile"
)
public
class
LogFlieController
{
@Autowired
private
LogFileClient
logFileClient
;
@PostMapping
(
"/logfile/wechatDeviceLogUpload"
)
public
R
wechatUploadLog
(
WechatDeviceLogVo
vo
){
WechatDeviceLogDto
dto
=
new
WechatDeviceLogDto
();
BeanUtils
.
copyProperties
(
vo
,
dto
);
logFileClient
.
wechatUploadLog
(
dto
);
return
R
.
ok
();
}
@PostMapping
(
"/logfile/DeviceLogFileUpload"
)
public
R
uploadLogFile
(
DeviceLogFileVo
vo
,
MultipartFile
file
){
DeviceLogFileDto
dto
=
new
DeviceLogFileDto
();
BeanUtils
.
copyProperties
(
vo
,
dto
);
logFileClient
.
uploadLogFile
(
dto
);
return
R
.
ok
();
}
}
cneeds-server-device/src/main/resources/application-dev.yml
View file @
39cc95e8
...
...
@@ -50,7 +50,7 @@ eureka:
defaultZone
:
http://192.168.2.244:8761/eureka/
instance
:
prefer-ip-address
:
true
#
ip-address: 192.168.2.244
ip-address
:
192.168.2.244
mybatis-plus
:
...
...
cneeds-server-logupload/src/main/java/com/mx/cneeds/server/logupload/filesystem/FileTemplate.java
0 → 100644
View file @
39cc95e8
package
com
.
mx
.
cneeds
.
server
.
logupload
.
filesystem
;
import
java.io.InputStream
;
import
java.io.OutputStream
;
/**
* @ClassName FileTemplate
* @Author zzrdark
* @Date 2020-04-07 15:09
* @Description TODO
**/
public
interface
FileTemplate
{
/**
* 存储文件
* @param pathName
* @param ops
* @return
*/
Boolean
saveFile
(
String
pathName
,
OutputStream
ops
);
/**
* 获取文件
* @param pathName
* @return
*/
InputStream
getFile
(
String
pathName
);
}
cneeds-server-logupload/src/main/java/com/mx/cneeds/server/logupload/service/impl/DeviceLogServiceImpl.java
View file @
39cc95e8
...
...
@@ -41,10 +41,14 @@ public class DeviceLogServiceImpl extends ServiceImpl<DeviceLogDao, DeviceLogEnt
this
.
removeByIds
(
Arrays
.
asList
(
deviceLogIds
));
}
/**
* 设置状态
* @param logId
*/
@Override
public
void
changeStatus
(
Long
logId
){
DeviceLogEntity
deviceLogEntity
=
new
DeviceLogEntity
();
deviceLogEntity
.
setStatus
(
1
);
getBaseMapper
().
update
(
deviceLogEntity
,
new
UpdateWrapper
<
DeviceLogEntity
>().
eq
(
"log
I
d"
,
logId
));
getBaseMapper
().
update
(
deviceLogEntity
,
new
UpdateWrapper
<
DeviceLogEntity
>().
eq
(
"log
_i
d"
,
logId
));
}
}
cneeds-server-logupload/src/main/java/com/mx/cneeds/server/logupload/web/LogUploadController.java
View file @
39cc95e8
package
com
.
mx
.
cneeds
.
server
.
logupload
.
web
;
import
com.mx.cneeds.common.dto.DeviceLogDto
;
import
com.mx.cneeds.common.dto.DeviceLogFileDto
;
import
com.mx.cneeds.common.dto.WechatDeviceLogDto
;
import
com.mx.cneeds.common.pager.PageUtils
;
import
com.mx.cneeds.common.result.R
;
import
com.mx.cneeds.server.logupload.service.DeviceLogService
;
...
...
@@ -29,22 +31,13 @@ public class LogUploadController {
@RequestMapping
(
"/addLogInfo"
)
public
void
wechatUploadLog
(
String
imei
,
String
logId
,
List
<
File
>
files
,
String
bugTitle
,
String
steps
,
Integer
probability
){
public
void
wechatUploadLog
(
WechatDeviceLogDto
dto
){
}
@RequestMapping
(
"/addLogFile"
)
public
void
uploadLogFile
(
String
imei
,
String
logId
,
File
logFile
){
public
void
uploadLogFile
(
DeviceLogFileDto
dto
){
}
...
...
@@ -80,7 +73,7 @@ public class LogUploadController {
}
@RequestMapping
(
"/finishLog"
)
public
R
finishLog
(
Long
logId
){
public
R
finishLog
(
@RequestBody
Long
logId
){
deviceLogService
.
changeStatus
(
logId
);
return
R
.
ok
();
}
...
...
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