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
033f1b47
Commit
033f1b47
authored
4 years ago
by
zzrdark
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1.增加删除统计设备渠道号
2.修复查询统计设备渠道号信息 3.修复适配配置
parent
ae27453c
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
160 additions
and
32 deletions
+160
-32
workspace.xml
.idea/workspace.xml
+0
-0
DeviceChannelStatisticsDto.java
.../com/mx/cneeds/common/dto/DeviceChannelStatisticsDto.java
+3
-0
StatisticsDeviceChannelDto.java
.../com/mx/cneeds/common/dto/StatisticsDeviceChannelDto.java
+19
-0
StatisticsDeviceChannelVo.java
...va/com/mx/cneeds/common/vo/StatisticsDeviceChannelVo.java
+19
-0
DatashowApplication.java
...va/com/mx/cneeds/server/datashow/DatashowApplication.java
+10
-1
DeviceClient.java
...va/com/mx/cneeds/server/datashow/client/DeviceClient.java
+3
-0
DeviceController.java
...x/cneeds/server/datashow/web/device/DeviceController.java
+12
-1
DeviceInfoChannelService.java
...needs/server/device/service/DeviceInfoChannelService.java
+4
-0
DeviceInfoService.java
...om/mx/cneeds/server/device/service/DeviceInfoService.java
+2
-0
DeviceInfoChannelServiceImpl.java
...ver/device/service/impl/DeviceInfoChannelServiceImpl.java
+16
-0
DeviceInfoServiceImpl.java
...eds/server/device/service/impl/DeviceInfoServiceImpl.java
+8
-0
DeviceChannelController.java
.../mx/cneeds/server/device/web/DeviceChannelController.java
+59
-28
DeviceInfoController.java
...com/mx/cneeds/server/device/web/DeviceInfoController.java
+5
-2
No files found.
.idea/workspace.xml
View file @
033f1b47
This diff is collapsed.
Click to expand it.
cneeds-common-pojo/src/main/java/com/mx/cneeds/common/dto/DeviceChannelStatisticsDto.java
View file @
033f1b47
...
...
@@ -13,6 +13,7 @@ import java.util.List;
@Data
public
class
DeviceChannelStatisticsDto
{
/**
* 渠道号
*/
...
...
@@ -32,6 +33,8 @@ public class DeviceChannelStatisticsDto {
private
Long
deptId
;
private
Long
channelId
;
private
List
<
DeviceInfoDto
>
deviceInfoDtos
;
}
This diff is collapsed.
Click to expand it.
cneeds-common-pojo/src/main/java/com/mx/cneeds/common/dto/StatisticsDeviceChannelDto.java
0 → 100644
View file @
033f1b47
package
com
.
mx
.
cneeds
.
common
.
dto
;
import
lombok.Data
;
import
java.io.Serializable
;
/**
* @ClassName StatisticsDeviceChannelVo
* @Author zzrdark
* @Date 2020-05-28 17:08
* @Description TODO
**/
@Data
public
class
StatisticsDeviceChannelDto
implements
Serializable
{
private
Long
channelId
;
private
Integer
channelRules
;
}
This diff is collapsed.
Click to expand it.
cneeds-common-pojo/src/main/java/com/mx/cneeds/common/vo/StatisticsDeviceChannelVo.java
0 → 100644
View file @
033f1b47
package
com
.
mx
.
cneeds
.
common
.
vo
;
import
lombok.Data
;
import
java.io.Serializable
;
/**
* @ClassName StatisticsDeviceChannelVo
* @Author zzrdark
* @Date 2020-05-28 17:08
* @Description TODO
**/
@Data
public
class
StatisticsDeviceChannelVo
implements
Serializable
{
private
Long
channelId
;
private
Integer
channelRules
;
}
This diff is collapsed.
Click to expand it.
cneeds-server-datashow/src/main/java/com/mx/cneeds/server/datashow/DatashowApplication.java
View file @
033f1b47
package
com
.
mx
.
cneeds
.
server
.
datashow
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.boot.SpringApplication
;
import
org.springframework.boot.autoconfigure.SpringBootApplication
;
import
org.springframework.cloud.netflix.eureka.EnableEurekaClient
;
...
...
@@ -16,9 +17,17 @@ import springfox.documentation.swagger2.annotations.EnableSwagger2;
@EnableEurekaClient
@EnableSwagger2
@EnableFeignClients
@Slf4j
public
class
DatashowApplication
{
public
static
void
main
(
String
[]
args
)
{
SpringApplication
.
run
(
DatashowApplication
.
class
);
try
{
SpringApplication
.
run
(
DatashowApplication
.
class
);
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
// (推荐)如果项目中存在日志框架,可以通过日志框架打印
log
.
debug
(
"the exception is {}"
,
e
.
getMessage
(),
e
);
}
}
}
This diff is collapsed.
Click to expand it.
cneeds-server-datashow/src/main/java/com/mx/cneeds/server/datashow/client/DeviceClient.java
View file @
033f1b47
...
...
@@ -102,6 +102,9 @@ public interface DeviceClient {
@PostMapping
(
"/device/devicechannel/queryTotalStatisticsDeviceChannel"
)
List
<
DeviceChannelStatisticsDto
>
queryTotalStatisticsDeviceChannel
(
@RequestBody
(
required
=
false
)
List
<
Long
>
channelIds
);
@PostMapping
(
"/device/devicechannel/deleteStatisticsDeviceChannel"
)
void
deleteStatisticsDeviceChannel
(
@RequestBody
StatisticsDeviceChannelDto
dto
);
@PostMapping
(
"/device/info/queryDeviceChannelSetting"
)
List
<
String
>
queryDeviceChannelSetting
(
List
<
String
>
imeis
);
}
This diff is collapsed.
Click to expand it.
cneeds-server-datashow/src/main/java/com/mx/cneeds/server/datashow/web/device/DeviceController.java
View file @
033f1b47
...
...
@@ -353,7 +353,7 @@ public class DeviceController {
}
@RequestMapping
(
"/device/queryDeviceChannelSetting"
)
public
R
queryDeviceChannelSetting
(
List
<
String
>
imeis
){
public
R
queryDeviceChannelSetting
(
@RequestBody
List
<
String
>
imeis
){
if
(
imeis
!=
null
||
imeis
.
size
()
!=
0
){
List
<
String
>
imeiList
=
deviceClient
.
queryDeviceChannelSetting
(
imeis
);
...
...
@@ -363,4 +363,15 @@ public class DeviceController {
return
R
.
error
(
ResultCode
.
PARAMERROR
,
"参数错误"
);
}
@RequestMapping
(
"/deviceChannel/deleteStatisticsDeviceChannel"
)
public
R
deleteStatisticsDeviceChannel
(
StatisticsDeviceChannelVo
vo
){
if
(
vo
==
null
){
return
R
.
error
(
ResultCode
.
PARAMERROR
,
"参数错误"
);
}
StatisticsDeviceChannelDto
dto
=
new
StatisticsDeviceChannelDto
();
BeanUtils
.
copyProperties
(
vo
,
dto
);
deviceClient
.
deleteStatisticsDeviceChannel
(
dto
);
return
R
.
ok
();
}
}
This diff is collapsed.
Click to expand it.
cneeds-server-device/src/main/java/com/mx/cneeds/server/device/service/DeviceInfoChannelService.java
View file @
033f1b47
...
...
@@ -17,8 +17,12 @@ public interface DeviceInfoChannelService extends IService<DeviceInfoChannelEnti
List
<
DeviceInfoChannelEntity
>
queryDeviceInfoChannelByDeviceId
(
Long
deviceId
);
List
<
DeviceInfoChannelEntity
>
queryDeviceInfoChannelByChannelId
(
Long
channelId
);
void
removeDeivceInfoChannelByChannelId
(
List
<
Long
>
channelIds
);
void
removeDeivceInfoChannelByDeviceIdAndChannelId
(
Long
channelId
,
List
<
Long
>
deviceIds
);
List
<
DeviceInfoChannelEntity
>
queryDeviceInfoChannelByChannelIds
(
List
<
Long
>
channelIds
);
List
<
DeviceInfoChannelEntity
>
queryDeviceInfoChannelByDeviceIds
(
List
<
Long
>
deviceIds
);
...
...
This diff is collapsed.
Click to expand it.
cneeds-server-device/src/main/java/com/mx/cneeds/server/device/service/DeviceInfoService.java
View file @
033f1b47
...
...
@@ -26,5 +26,7 @@ public interface DeviceInfoService extends IService<DeviceInfoEntity> {
List
<
DeviceInfoEntity
>
queryDeviceByImeis
(
List
<
String
>
imeis
);
List
<
DeviceInfoEntity
>
queryDeviceByIds
(
Set
<
Long
>
ids
);
List
<
DeviceInfoEntity
>
queryDeviceByDeviceIdAndChannelRules
(
Integer
channelRules
,
List
<
Long
>
deviceIds
);
}
This diff is collapsed.
Click to expand it.
cneeds-server-device/src/main/java/com/mx/cneeds/server/device/service/impl/DeviceInfoChannelServiceImpl.java
View file @
033f1b47
...
...
@@ -24,6 +24,14 @@ public class DeviceInfoChannelServiceImpl extends ServiceImpl<DeviceInfoChannelD
return
entities
;
}
@Override
public
List
<
DeviceInfoChannelEntity
>
queryDeviceInfoChannelByChannelId
(
Long
channelId
){
List
<
DeviceInfoChannelEntity
>
entities
=
getBaseMapper
().
selectList
(
new
QueryWrapper
<
DeviceInfoChannelEntity
>().
eq
(
"channel_id"
,
channelId
));
return
entities
;
}
@Override
public
void
removeDeivceInfoChannelByChannelId
(
List
<
Long
>
channelIds
){
...
...
@@ -33,6 +41,14 @@ public class DeviceInfoChannelServiceImpl extends ServiceImpl<DeviceInfoChannelD
}
@Override
public
void
removeDeivceInfoChannelByDeviceIdAndChannelId
(
Long
channelId
,
List
<
Long
>
deviceIds
){
getBaseMapper
().
delete
(
new
QueryWrapper
<
DeviceInfoChannelEntity
>()
.
eq
(
"channel_id"
,
channelId
)
.
in
(
"device_id"
,
deviceIds
));
}
@Override
public
List
<
DeviceInfoChannelEntity
>
queryDeviceInfoChannelByChannelIds
(
List
<
Long
>
channelIds
){
List
<
DeviceInfoChannelEntity
>
deviceInfoChannelEntities
=
getBaseMapper
().
selectList
(
new
QueryWrapper
<
DeviceInfoChannelEntity
>()
.
in
(
"channel_id"
,
channelIds
));
...
...
This diff is collapsed.
Click to expand it.
cneeds-server-device/src/main/java/com/mx/cneeds/server/device/service/impl/DeviceInfoServiceImpl.java
View file @
033f1b47
...
...
@@ -81,5 +81,13 @@ public class DeviceInfoServiceImpl extends ServiceImpl<DeviceInfoDao, DeviceInfo
return
deviceInfoEntities
;
}
@Override
public
List
<
DeviceInfoEntity
>
queryDeviceByDeviceIdAndChannelRules
(
Integer
channelRules
,
List
<
Long
>
deviceIds
){
List
<
DeviceInfoEntity
>
deviceInfoEntities
=
getBaseMapper
().
selectList
(
new
QueryWrapper
<
DeviceInfoEntity
>()
.
in
(
"device_id"
,
deviceIds
)
.
eq
(
"channel_rules"
,
channelRules
));
return
deviceInfoEntities
;
}
}
This diff is collapsed.
Click to expand it.
cneeds-server-device/src/main/java/com/mx/cneeds/server/device/web/DeviceChannelController.java
View file @
033f1b47
package
com
.
mx
.
cneeds
.
server
.
device
.
web
;
import
com.mx.cneeds.common.dto.DeviceChannelDto
;
import
com.mx.cneeds.common.dto.DeviceChannelStatisticsDto
;
import
com.mx.cneeds.common.dto.DeviceInfoDto
;
import
com.mx.cneeds.common.dto.SeriesDto
;
import
com.mx.cneeds.common.dto.*
;
import
com.mx.cneeds.common.pager.PageUtils
;
import
com.mx.cneeds.common.result.R
;
import
com.mx.cneeds.common.validator.ValidatorUtils
;
...
...
@@ -171,6 +168,15 @@ public class DeviceChannelController {
public
List
<
DeviceChannelStatisticsDto
>
queryTotalStatisticsDeviceChannel
(
@RequestBody
(
required
=
false
)
List
<
Long
>
channelIds
){
List
<
DeviceInfoChannelEntity
>
deviceInfoChannelEntities
=
null
;
if
(
channelIds
==
null
||
channelIds
.
size
()
==
0
)
{
channelIds
=
new
LinkedList
<>();
List
<
Long
>
finalChannelIds
=
channelIds
;
List
<
DeviceChannelEntity
>
list
=
deviceChannelService
.
list
();
list
.
forEach
(
deviceChannelEntity
->
{
finalChannelIds
.
add
(
deviceChannelEntity
.
getChannelId
());
});
deviceInfoChannelEntities
=
deviceInfoChannelService
.
list
();
}
else
{
deviceInfoChannelEntities
=
deviceInfoChannelService
.
queryDeviceInfoChannelByChannelIds
(
channelIds
);
...
...
@@ -178,7 +184,7 @@ public class DeviceChannelController {
Set
<
Long
>
deviceIds
=
new
HashSet
<>();
Map
<
Long
,
List
<
Long
>>
deviceIdChannelMap
=
new
HashMap
<
Long
,
List
<
Long
>>();
deviceInfoChannelEntities
.
forEach
(
deviceInfoChannel
->
{
deviceInfoChannelEntities
.
forEach
(
deviceInfoChannel
->
{
deviceIds
.
add
(
deviceInfoChannel
.
getDeviceId
());
if
(
deviceIdChannelMap
.
get
(
deviceInfoChannel
.
getChannelId
())
==
null
)
{
deviceIdChannelMap
.
put
(
deviceInfoChannel
.
getChannelId
(),
new
ArrayList
<
Long
>());
...
...
@@ -202,29 +208,30 @@ public class DeviceChannelController {
* 根据渠道号, 客户 ,渠道规则,禁用提示问题 进行统计
*/
// TODO 无参数的统计 无法筛选 channelIds 因为这个空
channelIds
.
forEach
(
channelId
->
{
List
<
Long
>
deviceIdList
=
deviceIdChannelMap
.
get
(
channelId
);
deviceIdList
.
forEach
(
deviceId
->
{
DeviceInfoEntity
deviceInfoEntity
=
deviceInfoEntityMapBykeyId
.
get
(
deviceId
);
DeviceInfoDto
dto
=
new
DeviceInfoDto
();
BeanUtils
.
copyProperties
(
deviceInfoEntity
,
dto
);
StringBuffer
sb
=
new
StringBuffer
();
sb
.
append
(
channelId
+
"__"
);
sb
.
append
(
dto
.
getDeptId
()+
"__"
);
sb
.
append
(
dto
.
getChannelRules
()+
"__"
);
sb
.
append
(
dto
.
getChannelNumsMessage
());
if
(
map
.
get
(
sb
.
toString
())
==
null
)
{
map
.
put
(
sb
.
toString
(),
new
ArrayList
<
DeviceInfoDto
>());
}
List
<
DeviceInfoDto
>
deviceInfoList
=
map
.
get
(
sb
.
toString
());
deviceInfoList
.
add
(
dto
);
map
.
put
(
sb
.
toString
(),
deviceInfoList
);
});
if
(
deviceIdList
!=
null
){
deviceIdList
.
forEach
(
deviceId
->
{
DeviceInfoEntity
deviceInfoEntity
=
deviceInfoEntityMapBykeyId
.
get
(
deviceId
);
DeviceInfoDto
dto
=
new
DeviceInfoDto
();
BeanUtils
.
copyProperties
(
deviceInfoEntity
,
dto
);
StringBuffer
sb
=
new
StringBuffer
();
sb
.
append
(
channelId
+
"__"
);
sb
.
append
(
dto
.
getDeptId
()+
"__"
);
sb
.
append
(
dto
.
getChannelRules
()+
"__"
);
sb
.
append
(
dto
.
getChannelNumsMessage
());
if
(
map
.
get
(
sb
.
toString
())
==
null
)
{
map
.
put
(
sb
.
toString
(),
new
ArrayList
<
DeviceInfoDto
>());
}
List
<
DeviceInfoDto
>
deviceInfoList
=
map
.
get
(
sb
.
toString
());
deviceInfoList
.
add
(
dto
);
map
.
put
(
sb
.
toString
(),
deviceInfoList
);
});
}
});
...
...
@@ -235,8 +242,9 @@ public class DeviceChannelController {
map
.
forEach
((
key
,
value
)
->
{
String
[]
s
=
key
.
split
(
"__"
);
DeviceChannelStatisticsDto
dto
=
new
DeviceChannelStatisticsDto
();
dto
.
setChannelNum
(
s
[
0
]);
dto
.
setChannelId
(
Long
.
valueOf
(
s
[
0
]));
DeviceChannelEntity
entity
=
deviceChannelService
.
getById
(
dto
.
getChannelId
());
dto
.
setChannelNum
(
entity
.
getChannelNum
());
dto
.
setDeptId
(
Long
.
valueOf
(
s
[
1
]));
dto
.
setChannelRules
(
Integer
.
valueOf
(
s
[
2
]));
dto
.
setChannelNumsMessage
(
s
[
3
]);
...
...
@@ -250,5 +258,28 @@ public class DeviceChannelController {
}
@RequestMapping
(
"/deleteStatisticsDeviceChannel"
)
public
void
deleteStatisticsDeviceChannel
(
@RequestBody
StatisticsDeviceChannelDto
dto
){
List
<
DeviceInfoChannelEntity
>
deviceInfoChannelEntities
=
deviceInfoChannelService
.
queryDeviceInfoChannelByChannelId
(
dto
.
getChannelId
());
List
<
Long
>
querydeviceIds
=
new
LinkedList
<>();
deviceInfoChannelEntities
.
forEach
(
deviceInfoChannelEntity
->
{
querydeviceIds
.
add
(
deviceInfoChannelEntity
.
getDeviceId
());
});
List
<
DeviceInfoEntity
>
deviceInfoEntities
=
deviceInfoService
.
queryDeviceByDeviceIdAndChannelRules
(
dto
.
getChannelRules
(),
querydeviceIds
);
List
<
Long
>
deviceIds
=
new
LinkedList
<>();
deviceInfoEntities
.
forEach
(
deviceInfoEntity
->
{
deviceIds
.
add
(
deviceInfoEntity
.
getDeviceId
());
});
deviceInfoChannelService
.
removeDeivceInfoChannelByDeviceIdAndChannelId
(
dto
.
getChannelId
(),
deviceIds
);
}
}
This diff is collapsed.
Click to expand it.
cneeds-server-device/src/main/java/com/mx/cneeds/server/device/web/DeviceInfoController.java
View file @
033f1b47
...
...
@@ -239,7 +239,7 @@ public class DeviceInfoController {
deviceInfoService
.
queryDeviceByImeis
(
imeis
);
entities
.
forEach
(
deviceInfoEntity
->
{
deviceIds
.
add
(
deviceInfoEntity
.
getDe
pt
Id
());
deviceIds
.
add
(
deviceInfoEntity
.
getDe
vice
Id
());
if
(
deviceInfoEntity
.
getChannelRules
()
==
null
||
deviceInfoEntity
.
getChannelRules
()
==
1
){
ChannelSettingImeis
.
add
(
deviceInfoEntity
.
getImei
());
}
...
...
@@ -250,7 +250,7 @@ public class DeviceInfoController {
deviceInfoChannelEntities
.
forEach
(
deviceInfoChannelEntity
->
{
entities
.
forEach
(
deviceInfoEntity
->
{
if
(
deviceInfoEntity
.
getDe
pt
Id
().
equals
(
deviceInfoChannelEntity
.
getDeviceId
())){
if
(
deviceInfoEntity
.
getDe
vice
Id
().
equals
(
deviceInfoChannelEntity
.
getDeviceId
())){
ChannelSettingImeis
.
add
(
deviceInfoEntity
.
getImei
());
}
});
...
...
@@ -293,7 +293,10 @@ public class DeviceInfoController {
});
}
deviceInfoService
.
updateBatchByImei
(
deviceInfoEntityList
);
// TODO 把已经增加过的删除
deviceInfoChannelService
.
saveBatch
(
deviceChannelEntities
);
return
R
.
ok
();
}
...
...
This diff is collapsed.
Click to expand it.
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