Commit 033f1b47 by zzrdark

1.增加删除统计设备渠道号

2.修复查询统计设备渠道号信息
3.修复适配配置
parent ae27453c
......@@ -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;
}
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;
}
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;
}
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) {
try {
SpringApplication.run(DatashowApplication.class);
} catch (Exception e) {
e.printStackTrace();
// (推荐)如果项目中存在日志框架,可以通过日志框架打印
log.debug("the exception is {}", e.getMessage(), e);
}
}
}
......@@ -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);
}
......@@ -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();
}
}
......@@ -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);
......
......@@ -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);
}
......@@ -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));
......
......@@ -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;
}
}
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);
......@@ -202,9 +208,9 @@ public class DeviceChannelController {
* 根据渠道号, 客户 ,渠道规则,禁用提示问题 进行统计
*/
// TODO 无参数的统计 无法筛选 channelIds 因为这个空
channelIds.forEach(channelId -> {
List<Long> deviceIdList = deviceIdChannelMap.get(channelId);
if (deviceIdList != null){
deviceIdList.forEach(deviceId -> {
DeviceInfoEntity deviceInfoEntity = deviceInfoEntityMapBykeyId.get(deviceId);
DeviceInfoDto dto = new DeviceInfoDto();
......@@ -225,6 +231,7 @@ public class DeviceChannelController {
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);
}
}
......@@ -239,7 +239,7 @@ public class DeviceInfoController {
deviceInfoService.queryDeviceByImeis(imeis);
entities.forEach(deviceInfoEntity -> {
deviceIds.add(deviceInfoEntity.getDeptId());
deviceIds.add(deviceInfoEntity.getDeviceId());
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.getDeptId().equals(deviceInfoChannelEntity.getDeviceId())){
if (deviceInfoEntity.getDeviceId().equals(deviceInfoChannelEntity.getDeviceId())){
ChannelSettingImeis.add(deviceInfoEntity.getImei());
}
});
......@@ -293,7 +293,10 @@ public class DeviceInfoController {
});
}
deviceInfoService.updateBatchByImei(deviceInfoEntityList);
// TODO 把已经增加过的删除
deviceInfoChannelService.saveBatch(deviceChannelEntities);
return R.ok();
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment