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
c070b6b0
Commit
c070b6b0
authored
Apr 08, 2020
by
zzrdark
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1.add日志上传模块
parent
39cc95e8
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
93 additions
and
17 deletions
+93
-17
DeviceLogFileDto.java
.../main/java/com/mx/cneeds/common/dto/DeviceLogFileDto.java
+8
-2
WechatDeviceLogDto.java
...ain/java/com/mx/cneeds/common/dto/WechatDeviceLogDto.java
+8
-2
WechatDeviceLogVo.java
.../main/java/com/mx/cneeds/common/vo/WechatDeviceLogVo.java
+2
-2
DeviceClient.java
...va/com/mx/cneeds/server/datashow/client/DeviceClient.java
+0
-3
LogFileClient.java
...a/com/mx/cneeds/server/datashow/client/LogFileClient.java
+2
-2
LogFlieController.java
.../cneeds/server/datashow/web/device/LogFlieController.java
+17
-2
DeviceLogService.java
.../mx/cneeds/server/logupload/service/DeviceLogService.java
+7
-0
DeviceLogServiceImpl.java
...s/server/logupload/service/impl/DeviceLogServiceImpl.java
+31
-0
LogUploadController.java
...m/mx/cneeds/server/logupload/web/LogUploadController.java
+18
-4
No files found.
cneeds-common-pojo/src/main/java/com/mx/cneeds/common/dto/DeviceLogFileDto.java
View file @
c070b6b0
...
...
@@ -18,8 +18,14 @@ public class DeviceLogFileDto {
* 移动端日志唯一标识符
*/
String
logAcceptId
;
/**
*
*/
String
logfileUrl
;
/**
*
log日志文件
*
设备Id
*/
File
logFile
;
Long
deviceId
;
}
cneeds-common-pojo/src/main/java/com/mx/cneeds/common/dto/WechatDeviceLogDto.java
View file @
c070b6b0
...
...
@@ -24,9 +24,9 @@ public class WechatDeviceLogDto {
String
logAcceptId
;
/**
* 视频 图片文件
* 视频 图片文件
路径
*/
List
<
File
>
file
s
;
List
<
String
>
locationUrl
s
;
/**
* bug名字
...
...
@@ -43,4 +43,10 @@ public class WechatDeviceLogDto {
*/
Integer
probability
;
/**
* 设备ID
*/
Long
deviceId
;
}
cneeds-common-pojo/src/main/java/com/mx/cneeds/common/vo/WechatDeviceLogVo.java
View file @
c070b6b0
...
...
@@ -24,9 +24,9 @@ public class WechatDeviceLogVo {
String
logAcceptId
;
/**
* 视频 图片文件
* 视频 图片文件
路径
*/
List
<
File
>
file
s
;
List
<
String
>
locationUrl
s
;
/**
* bug名字
...
...
cneeds-server-datashow/src/main/java/com/mx/cneeds/server/datashow/client/DeviceClient.java
View file @
c070b6b0
...
...
@@ -40,9 +40,6 @@ public interface DeviceClient {
void
deleteSeries
(
@RequestBody
List
<
Long
>
ids
);
@PostMapping
(
"device/info/list"
)
PageDto
deviceList
(
@RequestParam
Integer
page
,
@RequestParam
(
"limit"
)
Integer
pageSize
,
...
...
cneeds-server-datashow/src/main/java/com/mx/cneeds/server/datashow/client/LogFileClient.java
View file @
c070b6b0
...
...
@@ -32,10 +32,10 @@ public interface LogFileClient {
@PostMapping
(
"/log/upload/finishLog"
)
void
finishLog
(
@RequestBody
Long
logId
);
@PostMapping
(
value
=
"
"
,
consumes
=
MediaType
.
MULTIPART_FORM_DATA_VALUE
)
@PostMapping
(
value
=
"
/log/upload/wechatUploadLog"
)
void
wechatUploadLog
(
@RequestBody
WechatDeviceLogDto
dto
);
@PostMapping
(
value
=
"
"
,
consumes
=
MediaType
.
MULTIPART_FORM_DATA_VALUE
)
@PostMapping
(
value
=
"
/log/upload/uploadLogFile"
)
void
uploadLogFile
(
@RequestBody
DeviceLogFileDto
dto
);
}
cneeds-server-datashow/src/main/java/com/mx/cneeds/server/datashow/web/device/LogFlieController.java
View file @
c070b6b0
...
...
@@ -19,6 +19,9 @@ 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.io.FileInputStream
;
import
java.io.IOException
;
import
java.util.ArrayList
;
import
java.util.HashSet
;
import
java.util.List
;
...
...
@@ -38,19 +41,31 @@ public class LogFlieController {
@Autowired
private
LogFileClient
logFileClient
;
@Autowired
private
DeviceClient
deviceClient
;
@PostMapping
(
"/logfile/wechatDeviceLogUpload"
)
public
R
wechatUploadLog
(
WechatDeviceLogVo
vo
){
public
R
wechatUploadLog
(
WechatDeviceLogVo
vo
,
MultipartFile
[]
file
){
WechatDeviceLogDto
dto
=
new
WechatDeviceLogDto
();
BeanUtils
.
copyProperties
(
vo
,
dto
);
// 把图片存入oos 返回路径
// dto.setLogfileUrl()
DeviceInfoDto
deviceInfoDto
=
deviceClient
.
queryDeviceByImei
(
dto
.
getImei
());
dto
.
setDeviceId
(
deviceInfoDto
.
getDeviceId
());
logFileClient
.
wechatUploadLog
(
dto
);
return
R
.
ok
();
}
@PostMapping
(
"/logfile/DeviceLogFileUpload"
)
public
R
uploadLogFile
(
DeviceLogFileVo
vo
,
MultipartFile
file
){
public
R
uploadLogFile
(
DeviceLogFileVo
vo
,
MultipartFile
file
)
throws
IOException
{
DeviceLogFileDto
dto
=
new
DeviceLogFileDto
();
BeanUtils
.
copyProperties
(
vo
,
dto
);
// 把图片存入oos 返回路径
// dto.setLogfileUrl()
DeviceInfoDto
deviceInfoDto
=
deviceClient
.
queryDeviceByImei
(
dto
.
getImei
());
dto
.
setDeviceId
(
deviceInfoDto
.
getDeviceId
());
logFileClient
.
uploadLogFile
(
dto
);
return
R
.
ok
();
}
...
...
cneeds-server-logupload/src/main/java/com/mx/cneeds/server/logupload/service/DeviceLogService.java
View file @
c070b6b0
...
...
@@ -14,4 +14,10 @@ public interface DeviceLogService extends IService<DeviceLogEntity> {
void
deleteBatch
(
Long
[]
deviceLogIds
);
void
changeStatus
(
Long
logId
);
void
wechatUploadLog
(
DeviceLogEntity
deviceLogEntity
);
void
deviceUploadLogFile
(
DeviceLogEntity
deviceLogEntity
);
DeviceLogEntity
queryOneBylogAcceptId
(
String
logAcceptId
);
}
\ No newline at end of file
cneeds-server-logupload/src/main/java/com/mx/cneeds/server/logupload/service/impl/DeviceLogServiceImpl.java
View file @
c070b6b0
...
...
@@ -9,6 +9,7 @@ import com.mx.cneeds.common.pager.Query;
import
com.mx.cneeds.server.dao.DeviceLogDao
;
import
com.mx.cneeds.server.entity.DeviceLogEntity
;
import
com.mx.cneeds.server.logupload.service.DeviceLogService
;
import
org.apache.commons.lang.StringUtils
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
...
...
@@ -51,4 +52,34 @@ public class DeviceLogServiceImpl extends ServiceImpl<DeviceLogDao, DeviceLogEnt
deviceLogEntity
.
setStatus
(
1
);
getBaseMapper
().
update
(
deviceLogEntity
,
new
UpdateWrapper
<
DeviceLogEntity
>().
eq
(
"log_id"
,
logId
));
}
@Override
public
void
wechatUploadLog
(
DeviceLogEntity
deviceLogEntity
){
DeviceLogEntity
logEntity
=
queryOneBylogAcceptId
(
deviceLogEntity
.
getLogAcceptId
());
if
(
logEntity
!=
null
){
getBaseMapper
().
update
(
deviceLogEntity
,
new
UpdateWrapper
<
DeviceLogEntity
>()
.
eq
(
"log_accept_id"
,
deviceLogEntity
.
getLogAcceptId
()));
}
else
{
getBaseMapper
().
insert
(
deviceLogEntity
);
}
}
@Override
public
void
deviceUploadLogFile
(
DeviceLogEntity
deviceLogEntity
){
DeviceLogEntity
logEntity
=
queryOneBylogAcceptId
(
deviceLogEntity
.
getLogAcceptId
());
if
(
logEntity
!=
null
){
getBaseMapper
().
update
(
deviceLogEntity
,
new
UpdateWrapper
<
DeviceLogEntity
>()
.
eq
(
"log_accept_id"
,
deviceLogEntity
.
getLogAcceptId
()));
}
else
{
getBaseMapper
().
insert
(
deviceLogEntity
);
}
}
@Override
public
DeviceLogEntity
queryOneBylogAcceptId
(
String
logAcceptId
){
return
getBaseMapper
().
selectOne
(
new
QueryWrapper
<
DeviceLogEntity
>()
.
eq
(
"log_accept_id"
,
logAcceptId
));
}
}
cneeds-server-logupload/src/main/java/com/mx/cneeds/server/logupload/web/LogUploadController.java
View file @
c070b6b0
...
...
@@ -5,6 +5,7 @@ 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.entity.DeviceLogEntity
;
import
com.mx.cneeds.server.logupload.service.DeviceLogService
;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
...
...
@@ -30,15 +31,28 @@ public class LogUploadController {
private
DeviceLogService
deviceLogService
;
@RequestMapping
(
"/
addLogInfo
"
)
@RequestMapping
(
"/
wechatUploadLog
"
)
public
void
wechatUploadLog
(
WechatDeviceLogDto
dto
){
DeviceLogEntity
deviceLogEntity
=
new
DeviceLogEntity
();
}
deviceLogEntity
.
setLogAcceptId
(
dto
.
getLogAcceptId
());
deviceLogEntity
.
setDeviceId
(
dto
.
getDeviceId
());
deviceLogEntity
.
setLogName
(
dto
.
getBugTitle
());
deviceLogEntity
.
setRepetitionProbability
(
dto
.
getProbability
());
deviceLogEntity
.
setRepetitionSteps
(
dto
.
getSteps
());
deviceLogService
.
wechatUploadLog
(
deviceLogEntity
);
}
@RequestMapping
(
"/addLogFile"
)
public
void
uploadLogFile
(
DeviceLogFileDto
dto
){
@RequestMapping
(
"/uploadLogFile"
)
public
void
uploadLogFile
(
@RequestBody
DeviceLogFileDto
dto
){
DeviceLogEntity
deviceLogEntity
=
new
DeviceLogEntity
();
deviceLogEntity
.
setDeviceId
(
dto
.
getDeviceId
());
deviceLogEntity
.
setLogfileUrl
(
dto
.
getLogfileUrl
());
deviceLogEntity
.
setLogAcceptId
(
dto
.
getLogAcceptId
());
deviceLogService
.
deviceUploadLogFile
(
deviceLogEntity
);
}
/**
...
...
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