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
329175e5
Commit
329175e5
authored
May 22, 2020
by
zzrdark
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1.设备批量增加
parent
0c3416ec
Show whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
281 additions
and
5 deletions
+281
-5
DeviceChannelStatisticsDto.java
.../com/mx/cneeds/common/dto/DeviceChannelStatisticsDto.java
+37
-0
UploadDeviceChannelExcelDto.java
...com/mx/cneeds/common/dto/UploadDeviceChannelExcelDto.java
+47
-0
UploadDeviceChannelExcelVo.java
...a/com/mx/cneeds/common/vo/UploadDeviceChannelExcelVo.java
+42
-0
DeviceClient.java
...va/com/mx/cneeds/server/datashow/client/DeviceClient.java
+5
-0
UserClient.java
...java/com/mx/cneeds/server/datashow/client/UserClient.java
+3
-0
DeviceController.java
...x/cneeds/server/datashow/web/device/DeviceController.java
+29
-0
application-dev.yml
...ds-server-datashow/src/main/resources/application-dev.yml
+6
-0
DeviceInfoChannelService.java
...needs/server/device/service/DeviceInfoChannelService.java
+2
-0
DeviceInfoChannelServiceImpl.java
...ver/device/service/impl/DeviceInfoChannelServiceImpl.java
+9
-0
DeviceChannelController.java
.../mx/cneeds/server/device/web/DeviceChannelController.java
+86
-0
DeviceInfoController.java
...com/mx/cneeds/server/device/web/DeviceInfoController.java
+6
-0
SysDeptController.java
...java/com/mx/cneeds/server/user/web/SysDeptController.java
+8
-4
application.yml
cneeds-server-user/src/main/resources/application.yml
+1
-1
No files found.
cneeds-common-pojo/src/main/java/com/mx/cneeds/common/dto/DeviceChannelStatisticsDto.java
0 → 100644
View file @
329175e5
package
com
.
mx
.
cneeds
.
common
.
dto
;
import
lombok.Data
;
import
java.util.List
;
/**
* @ClassName DeviceChannelStatisticsDto
* @Author zzrdark
* @Date 2020-05-20 15:27
* @Description TODO
**/
@Data
public
class
DeviceChannelStatisticsDto
{
/**
* 渠道号
*/
private
String
channelNum
;
/**
* 0:白名单,1:黑名单
*/
private
Integer
channelRules
;
/**
* 渠道号提示信息
*/
private
String
channelNumsMessage
;
private
String
deptName
;
private
Long
deptId
;
private
List
<
DeviceInfoDto
>
deviceInfoDtos
;
}
cneeds-common-pojo/src/main/java/com/mx/cneeds/common/dto/UploadDeviceChannelExcelDto.java
0 → 100644
View file @
329175e5
package
com
.
mx
.
cneeds
.
common
.
dto
;
import
lombok.Data
;
import
java.io.Serializable
;
import
java.util.List
;
/**
* @ClassName UploadDeviceChannelExcelDto
* @Author zzrdark
* @Date 2020-05-22 18:27
* @Description TODO
**/
@Data
public
class
UploadDeviceChannelExcelDto
implements
Serializable
{
/**
* 系列id
*/
private
Long
seriesId
;
private
Long
deptId
;
private
List
<
UploadDeviceChannelExcelInfoDto
>
infos
;
/**
* 渠道号提示信息
*/
private
String
channelNumsMessage
;
/**
* 0:白名单,1:黑名单
*/
private
Integer
channelRules
;
/**
* 渠道号Ids
*/
private
List
<
Long
>
channelIds
;
@Data
static
class
UploadDeviceChannelExcelInfoDto
implements
Serializable
{
private
String
imei
;
private
String
iccid
;
}
}
cneeds-common-pojo/src/main/java/com/mx/cneeds/common/vo/UploadDeviceChannelExcelVo.java
0 → 100644
View file @
329175e5
package
com
.
mx
.
cneeds
.
common
.
vo
;
import
lombok.Data
;
import
java.io.Serializable
;
import
java.util.List
;
@Data
public
class
UploadDeviceChannelExcelVo
implements
Serializable
{
/**
* 系列id
*/
private
Long
seriesId
;
private
Long
deptId
;
private
List
<
UploadDeviceChannelExcelInfoVo
>
infos
;
/**
* 渠道号提示信息
*/
private
String
channelNumsMessage
;
/**
* 0:白名单,1:黑名单
*/
private
Integer
channelRules
;
/**
* 渠道号Ids
*/
private
List
<
Long
>
channelNums
;
@Data
static
class
UploadDeviceChannelExcelInfoVo
implements
Serializable
{
private
String
imei
;
private
String
iccid
;
}
}
\ No newline at end of file
cneeds-server-datashow/src/main/java/com/mx/cneeds/server/datashow/client/DeviceClient.java
View file @
329175e5
...
...
@@ -96,4 +96,9 @@ public interface DeviceClient {
@PostMapping
(
"/device/devicechannel/updateSettingDeviceChannel"
)
void
updateSettingDeviceChannel
(
@RequestBody
DeviceInfoDto
dto
);
@PostMapping
(
"/device/devicechannel/queryTotalStatisticsDeviceChannel"
)
List
<
DeviceChannelStatisticsDto
>
queryTotalStatisticsDeviceChannel
(
@RequestBody
(
required
=
false
)
List
<
Long
>
channelIds
);
@PostMapping
(
"/device/info/uploadDeivceChannelExcel"
)
void
uploadDeivceChannelExcel
(
@RequestBody
UploadDeviceChannelExcelDto
dto
);
}
cneeds-server-datashow/src/main/java/com/mx/cneeds/server/datashow/client/UserClient.java
View file @
329175e5
...
...
@@ -61,6 +61,9 @@ public interface UserClient {
@PostMapping
(
"/sys/dept/delete"
)
void
deleteDept
(
@RequestBody
List
<
Long
>
ids
);
@PostMapping
(
"/sys/dept/info"
)
DepartmentDto
deptInfo
(
@RequestBody
Long
deptId
);
/**
*
* @param page
...
...
cneeds-server-datashow/src/main/java/com/mx/cneeds/server/datashow/web/device/DeviceController.java
View file @
329175e5
...
...
@@ -6,6 +6,7 @@ import com.mx.cneeds.common.dto.*;
import
com.mx.cneeds.common.result.R
;
import
com.mx.cneeds.common.vo.*
;
import
com.mx.cneeds.server.datashow.client.DeviceClient
;
import
com.mx.cneeds.server.datashow.client.UserClient
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.lang.StringUtils
;
import
org.slf4j.Logger
;
...
...
@@ -14,6 +15,7 @@ import org.springframework.beans.BeanUtils;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.*
;
import
java.util.LinkedList
;
import
java.util.List
;
/**
...
...
@@ -31,6 +33,9 @@ public class DeviceController {
@Autowired
private
DeviceClient
deviceClient
;
@Autowired
private
UserClient
userClient
;
@GetMapping
(
"/device/getChannel_nums"
)
public
R
getChannel_nums
(
String
imei
){
...
...
@@ -288,4 +293,28 @@ public class DeviceController {
return
R
.
ok
();
}
@PostMapping
(
"/deviceChannel/queryTotalStatisticsDeviceChannel"
)
public
R
queryTotalStatisticsDeviceChannel
(
@RequestParam
(
value
=
"channelIds"
,
required
=
false
)
List
<
Long
>
channelIds
){
if
(
channelIds
==
null
){
channelIds
=
new
LinkedList
<>();
}
List
<
DeviceChannelStatisticsDto
>
list
=
deviceClient
.
queryTotalStatisticsDeviceChannel
(
channelIds
);
list
.
forEach
(
dto
->
{
DepartmentDto
departmentDto
=
userClient
.
deptInfo
(
dto
.
getDeptId
());
dto
.
setDeptName
(
departmentDto
.
getName
());
});
return
R
.
ok
().
put
(
"data"
,
list
);
}
@PostMapping
(
"/device/uploadDeivceChannelExcel"
)
public
R
uploadDeivceChannelExcel
(
@RequestBody
UploadDeviceChannelExcelVo
vo
){
UploadDeviceChannelExcelDto
dto
=
new
UploadDeviceChannelExcelDto
();
BeanUtils
.
copyProperties
(
vo
,
dto
);
return
R
.
ok
();
}
}
cneeds-server-datashow/src/main/resources/application-dev.yml
View file @
329175e5
...
...
@@ -21,3 +21,9 @@ spring:
logging
:
config
:
classpath:logback-spring-dev.xml
feign
:
client
:
config
:
CNEEDS-SERVER-DEVICE
:
connectTimeout
:
10000
readTimeout
:
10000
cneeds-server-device/src/main/java/com/mx/cneeds/server/device/service/DeviceInfoChannelService.java
View file @
329175e5
...
...
@@ -18,5 +18,7 @@ public interface DeviceInfoChannelService extends IService<DeviceInfoChannelEnti
List
<
DeviceInfoChannelEntity
>
queryDeviceInfoChannelByDeviceId
(
Long
deviceId
);
void
removeDeivceInfoChannelByChannelId
(
List
<
Long
>
channelIds
);
List
<
DeviceInfoChannelEntity
>
queryDeviceInfoChannelByChannelIds
(
List
<
Long
>
channelIds
);
}
cneeds-server-device/src/main/java/com/mx/cneeds/server/device/service/impl/DeviceInfoChannelServiceImpl.java
View file @
329175e5
...
...
@@ -7,7 +7,9 @@ import com.mx.cneeds.server.device.service.DeviceInfoChannelService;
import
com.mx.cneeds.server.entity.DeviceInfoChannelEntity
;
import
org.springframework.stereotype.Service
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
@Service
(
"deviceInfoChannelService"
)
...
...
@@ -30,4 +32,11 @@ public class DeviceInfoChannelServiceImpl extends ServiceImpl<DeviceInfoChannelD
.
in
(
"channel_id"
,
channelIds
));
}
@Override
public
List
<
DeviceInfoChannelEntity
>
queryDeviceInfoChannelByChannelIds
(
List
<
Long
>
channelIds
){
List
<
DeviceInfoChannelEntity
>
deviceInfoChannelEntities
=
getBaseMapper
().
selectList
(
new
QueryWrapper
<
DeviceInfoChannelEntity
>()
.
in
(
"channel_id"
,
channelIds
));
return
deviceInfoChannelEntities
;
}
}
cneeds-server-device/src/main/java/com/mx/cneeds/server/device/web/DeviceChannelController.java
View file @
329175e5
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.pager.PageUtils
;
...
...
@@ -165,4 +166,89 @@ public class DeviceChannelController {
deviceInfoEntity
.
setChannelNumsMessage
(
deviceInfoDto
.
getChannelNumsMessage
());
deviceInfoService
.
updateById
(
deviceInfoEntity
);
}
@RequestMapping
(
"/queryTotalStatisticsDeviceChannel"
)
public
List
<
DeviceChannelStatisticsDto
>
queryTotalStatisticsDeviceChannel
(
@RequestBody
(
required
=
false
)
List
<
Long
>
channelIds
){
List
<
DeviceInfoChannelEntity
>
deviceInfoChannelEntities
=
null
;
if
(
channelIds
==
null
||
channelIds
.
size
()
==
0
)
{
deviceInfoChannelEntities
=
deviceInfoChannelService
.
list
();
}
else
{
deviceInfoChannelEntities
=
deviceInfoChannelService
.
queryDeviceInfoChannelByChannelIds
(
channelIds
);
}
Set
<
Long
>
deviceIds
=
new
HashSet
<>();
Map
<
Long
,
List
<
Long
>>
deviceIdChannelMap
=
new
HashMap
<
Long
,
List
<
Long
>>();
deviceInfoChannelEntities
.
forEach
(
deviceInfoChannel
->
{
deviceIds
.
add
(
deviceInfoChannel
.
getDeviceId
());
if
(
deviceIdChannelMap
.
get
(
deviceInfoChannel
.
getChannelId
())
==
null
)
{
deviceIdChannelMap
.
put
(
deviceInfoChannel
.
getChannelId
(),
new
ArrayList
<
Long
>());
}
List
<
Long
>
deviceList
=
deviceIdChannelMap
.
get
(
deviceInfoChannel
.
getChannelId
());
deviceList
.
add
(
deviceInfoChannel
.
getDeviceId
());
deviceIdChannelMap
.
put
(
deviceInfoChannel
.
getChannelId
(),
deviceList
);
});
List
<
DeviceInfoEntity
>
deviceInfoEntities
=
deviceInfoService
.
queryDeviceByIds
(
deviceIds
);
Map
<
Long
,
DeviceInfoEntity
>
deviceInfoEntityMapBykeyId
=
new
HashMap
<>();
deviceInfoEntities
.
forEach
(
deviceInfoEntity
->
{
deviceInfoEntityMapBykeyId
.
put
(
deviceInfoEntity
.
getDeviceId
(),
deviceInfoEntity
);
});
Map
<
String
,
List
<
DeviceInfoDto
>>
map
=
new
HashMap
<
String
,
List
<
DeviceInfoDto
>>();
/**
* 根据渠道号, 客户 ,渠道规则,禁用提示问题 进行统计
*/
// 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
);
});
});
List
<
DeviceChannelStatisticsDto
>
list
=
new
LinkedList
<>();
map
.
forEach
((
key
,
value
)
->
{
String
[]
s
=
key
.
split
(
"__"
);
DeviceChannelStatisticsDto
dto
=
new
DeviceChannelStatisticsDto
();
dto
.
setChannelNum
(
s
[
0
]);
dto
.
setDeptId
(
Long
.
valueOf
(
s
[
1
]));
dto
.
setChannelRules
(
Integer
.
valueOf
(
s
[
2
]));
dto
.
setChannelNumsMessage
(
s
[
3
]);
dto
.
setDeviceInfoDtos
(
value
);
list
.
add
(
dto
);
});
return
list
;
}
}
cneeds-server-device/src/main/java/com/mx/cneeds/server/device/web/DeviceInfoController.java
View file @
329175e5
...
...
@@ -5,6 +5,7 @@ import java.util.*;
import
com.mx.cneeds.common.dto.DeviceChannelDto
;
import
com.mx.cneeds.common.dto.DeviceInfoDto
;
import
com.mx.cneeds.common.dto.DevicesDto
;
import
com.mx.cneeds.common.dto.UploadDeviceChannelExcelDto
;
import
com.mx.cneeds.common.pager.PageUtils
;
import
com.mx.cneeds.common.result.R
;
import
com.mx.cneeds.common.validator.ValidatorUtils
;
...
...
@@ -267,4 +268,9 @@ public class DeviceInfoController {
deviceInfoChannelService
.
saveBatch
(
deviceChannelEntities
);
return
R
.
ok
();
}
@RequestMapping
(
"/uploadDeivceChannelExcel"
)
public
void
uploadDeivceChannelExcel
(
@RequestBody
UploadDeviceChannelExcelDto
dto
){
}
}
cneeds-server-user/src/main/java/com/mx/cneeds/server/user/web/SysDeptController.java
View file @
329175e5
...
...
@@ -62,12 +62,16 @@ public class SysDeptController {
/**
* 信息
*/
@RequestMapping
(
"/info
/{deptId}
"
)
@RequestMapping
(
"/info"
)
// @RequiresPermissions("sys:sysdept:info")
public
R
info
(
@PathVariable
(
"deptId"
)
Long
deptId
){
public
DepartmentDto
info
(
@RequestBody
Long
deptId
){
SysDeptEntity
sysDept
=
sysDeptService
.
getById
(
deptId
);
return
R
.
ok
().
put
(
"sysDept"
,
sysDept
);
DepartmentDto
dto
=
new
DepartmentDto
();
if
(
sysDept
==
null
){
return
null
;
}
BeanUtils
.
copyProperties
(
sysDept
,
dto
);
return
dto
;
}
/**
...
...
cneeds-server-user/src/main/resources/application.yml
View file @
329175e5
spring
:
profiles
:
active
:
prod
active
:
test
application
:
name
:
cneeds-server-user
...
...
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