|
@@ -129,7 +129,7 @@ public class DeviceInfoServiceImpl extends ServiceImpl<DeviceInfoMapper, DeviceI
|
|
|
}
|
|
|
});
|
|
|
|
|
|
- //没有管理员的的设置默认值
|
|
|
+ // 没有管理员的的设置默认值
|
|
|
deviceInfoList.stream().filter(s -> s.getAdminName() == null).forEach(s -> s.setAdminName(noAdmin));
|
|
|
return R.ok(deviceInfoList);
|
|
|
}
|
|
@@ -149,7 +149,7 @@ public class DeviceInfoServiceImpl extends ServiceImpl<DeviceInfoMapper, DeviceI
|
|
|
}
|
|
|
});
|
|
|
|
|
|
- //没有管理员的的设置默认值
|
|
|
+ // 没有管理员的的设置默认值
|
|
|
deviceInfoList.getRecords().stream().filter(s -> s.getAdminName() == null).forEach(s -> s.setAdminName(noAdmin));
|
|
|
return R.ok(toPageBean(DeviceInfoDto.ListByAdminName.class, deviceInfoList));
|
|
|
}
|
|
@@ -159,10 +159,10 @@ public class DeviceInfoServiceImpl extends ServiceImpl<DeviceInfoMapper, DeviceI
|
|
|
public R<List<DeviceInfoDto.GroupByAdminNameVo>> groupByAdminName(@RequestBody @Validated DeviceInfoDto.GroupByAdminNameDto dto) {
|
|
|
String noAdmin = "未分配管理员";
|
|
|
List<DeviceInfoDto.ListByAdminName> deviceInfoList = listByAdminName(dto).getData();
|
|
|
- //根据管理员名字分组
|
|
|
+ // 根据管理员名字分组
|
|
|
Map<String, List<DeviceInfoDto.ListByAdminName>> deviceMap = deviceInfoList.stream().collect(Collectors.groupingBy(DeviceInfoDto.ListByAdminName::getAdminName));
|
|
|
List<DeviceInfoDto.GroupByAdminNameVo> list = new ArrayList<>();
|
|
|
- //不包含未分配管理员的
|
|
|
+ // 不包含未分配管理员的
|
|
|
deviceMap.forEach(
|
|
|
(k, i) -> {
|
|
|
DeviceInfoDto.GroupByAdminNameVo vo = new DeviceInfoDto.GroupByAdminNameVo();
|
|
@@ -174,7 +174,7 @@ public class DeviceInfoServiceImpl extends ServiceImpl<DeviceInfoMapper, DeviceI
|
|
|
}
|
|
|
}
|
|
|
);
|
|
|
- //包含分配管理员的
|
|
|
+ // 包含分配管理员的
|
|
|
List<DeviceInfoDto.ListByAdminName> noAdminNamesList = deviceMap.get(noAdmin);
|
|
|
if (Emptys.check(noAdminNamesList)) {
|
|
|
DeviceInfoDto.GroupByAdminNameVo vo = new DeviceInfoDto.GroupByAdminNameVo();
|
|
@@ -190,10 +190,10 @@ public class DeviceInfoServiceImpl extends ServiceImpl<DeviceInfoMapper, DeviceI
|
|
|
public R<List<DeviceInfoDto.GroupByAdminNameVo>> groupByAdminCount(@RequestBody @Validated DeviceInfoDto.GroupByAdminNameDto dto) {
|
|
|
String noAdmin = "未分配管理员";
|
|
|
List<DeviceInfoDto.ListByAdminName> deviceInfoList = listByAdminName(dto).getData();
|
|
|
- //根据管理员名字分组
|
|
|
+ // 根据管理员名字分组
|
|
|
Map<String, List<DeviceInfoDto.ListByAdminName>> deviceMap = deviceInfoList.stream().collect(Collectors.groupingBy(DeviceInfoDto.ListByAdminName::getAdminName));
|
|
|
List<DeviceInfoDto.GroupByAdminNameVo> list = new ArrayList<>();
|
|
|
- //不包含未分配管理员的
|
|
|
+ // 不包含未分配管理员的
|
|
|
deviceMap.forEach(
|
|
|
(k, i) -> {
|
|
|
DeviceInfoDto.GroupByAdminNameVo vo = new DeviceInfoDto.GroupByAdminNameVo();
|
|
@@ -205,7 +205,7 @@ public class DeviceInfoServiceImpl extends ServiceImpl<DeviceInfoMapper, DeviceI
|
|
|
}
|
|
|
}
|
|
|
);
|
|
|
- //包含分配管理员的
|
|
|
+ // 包含分配管理员的
|
|
|
List<DeviceInfoDto.ListByAdminName> noAdminNamesList = deviceMap.get(noAdmin);
|
|
|
if (Emptys.check(noAdminNamesList)) {
|
|
|
DeviceInfoDto.GroupByAdminNameVo vo = new DeviceInfoDto.GroupByAdminNameVo();
|
|
@@ -252,7 +252,7 @@ public class DeviceInfoServiceImpl extends ServiceImpl<DeviceInfoMapper, DeviceI
|
|
|
String searchKey = dto.getSearchKey();
|
|
|
Integer thirdStatus = dto.getThirdStatus();
|
|
|
List<String> statusList = new ArrayList<>();
|
|
|
- //1待审核,2已审核
|
|
|
+ // 1待审核,2已审核
|
|
|
if (thirdStatus != null && thirdStatus.intValue() == 1) {
|
|
|
statusList = CollUtil.newArrayList("1000", "2000", "3000", "5000");
|
|
|
}
|
|
@@ -283,8 +283,8 @@ public class DeviceInfoServiceImpl extends ServiceImpl<DeviceInfoMapper, DeviceI
|
|
|
*/
|
|
|
String tyStatus = deviceInfo.getThirdStatus();
|
|
|
if (!"4000".equals(tyStatus)) {
|
|
|
- //未登记成功的需要实时查询
|
|
|
- //查询登记设备
|
|
|
+ // 未登记成功的需要实时查询
|
|
|
+ // 查询登记设备
|
|
|
DeviceQueryVO deviceQueryVO = tyApiService.deviceQuery(new DeviceQueryDTO().setCpuId(String.valueOf(deviceId)));
|
|
|
Integer status = deviceQueryVO.getStatus();
|
|
|
String message = deviceQueryVO.getMessage();
|
|
@@ -320,7 +320,7 @@ public class DeviceInfoServiceImpl extends ServiceImpl<DeviceInfoMapper, DeviceI
|
|
|
}
|
|
|
List<GoodsDeviceDto.Vo> goodsDevices = R.feignCheckData(goodsDeviceService.list(selectList));
|
|
|
if (type == 2 && CollUtil.isEmpty(goodsDevices)) {
|
|
|
- //右侧已选的
|
|
|
+ // 右侧已选的
|
|
|
return R.ok(new PageBean<>());
|
|
|
}
|
|
|
List<Long> deviceIds = goodsDevices.stream().map(GoodsDeviceDto.Vo::getDeviceId).collect(Collectors.toList());
|
|
@@ -328,7 +328,7 @@ public class DeviceInfoServiceImpl extends ServiceImpl<DeviceInfoMapper, DeviceI
|
|
|
LambdaQueryWrapper<DeviceInfo> lqw = new MybatisPlusQuery().eqWrapper(dto, DeviceInfo.class)
|
|
|
.build();
|
|
|
lqw.in(type == 2 && CollUtil.isNotEmpty(deviceIds), DeviceInfo::getDeviceId, deviceIds);
|
|
|
- //左侧排除掉已关联的
|
|
|
+ // 左侧排除掉已关联的
|
|
|
lqw.notIn(type == 1 && CollUtil.isNotEmpty(deviceIds), DeviceInfo::getDeviceId, deviceIds);
|
|
|
lqw.and(StrUtil.isNotEmpty(searchKey), wrapper -> wrapper
|
|
|
.eq(DeviceInfo::getDeviceId, searchKey)
|
|
@@ -349,7 +349,7 @@ public class DeviceInfoServiceImpl extends ServiceImpl<DeviceInfoMapper, DeviceI
|
|
|
@ApiOperation("设备列表带卡包数")
|
|
|
public R<PageBean<DeviceInfoDto.AlgorithmChargingVo>> algorithmChargingDevice(@RequestBody @Validated DeviceInfoDto.AlgorithmCharging algorithmCharging) {
|
|
|
PageBean pageBean = algorithmCharging.getPage();
|
|
|
- //查询设备
|
|
|
+ // 查询设备
|
|
|
Integer value = SysDictUtils.getValue(EnumDeviceActiveStatus.Code.CODE.getCode(), EnumDeviceActiveStatus.N_1.getCode(), Integer.class);
|
|
|
LambdaUpdateWrapper<DeviceInfo> lambdaUpdateWrapper = new LambdaUpdateWrapper<DeviceInfo>()
|
|
|
.eq(DeviceInfo::getMercId, algorithmCharging.getMercId())
|
|
@@ -362,7 +362,7 @@ public class DeviceInfoServiceImpl extends ServiceImpl<DeviceInfoMapper, DeviceI
|
|
|
if (!Emptys.check(algorithmChargingVos)) {
|
|
|
return R.ok(algorithmChargingVoPageBean);
|
|
|
}
|
|
|
- //查询卡包数量
|
|
|
+ // 查询卡包数量
|
|
|
List<DeviceAlgorithmChargingDto.CountVo> data = deviceAlgorithmChargingService.count(new DeviceAlgorithmChargingDto.Count()
|
|
|
.setDeviceIds(new JArrayList<>(algorithmChargingVos).getProperty(DeviceInfoDto.AlgorithmChargingVo::getDeviceId))
|
|
|
.setMercId(algorithmCharging.getMercId())
|
|
@@ -423,7 +423,7 @@ public class DeviceInfoServiceImpl extends ServiceImpl<DeviceInfoMapper, DeviceI
|
|
|
List<Long> mercIds = new ArrayList<>();
|
|
|
Long chooseMercId = dto.getChooseMercId();
|
|
|
if (chooseMercId == null) {
|
|
|
- //未指定商户 查下级商户含自身
|
|
|
+ // 未指定商户 查下级商户含自身
|
|
|
mercIds = R.feignCheckData(mercService.getAllSubMercIds(new MercDto.QuerySubDTO().setParentMercID(curMercId)));
|
|
|
} else {
|
|
|
mercIds.add(chooseMercId);
|
|
@@ -450,7 +450,7 @@ public class DeviceInfoServiceImpl extends ServiceImpl<DeviceInfoMapper, DeviceI
|
|
|
if (placeId == null) {
|
|
|
continue;
|
|
|
}
|
|
|
- //点位 区域 反显
|
|
|
+ // 点位 区域 反显
|
|
|
MercPlaceDto.Vo placeVo = placeMap.get(placeId);
|
|
|
if (placeVo != null) {
|
|
|
record.setDistrictName(placeVo.getRegionName());
|
|
@@ -481,7 +481,7 @@ public class DeviceInfoServiceImpl extends ServiceImpl<DeviceInfoMapper, DeviceI
|
|
|
|
|
|
|
|
|
if (BooleanUtil.isFalse(choosed)) {
|
|
|
- //未选择 排除已选择
|
|
|
+ // 未选择 排除已选择
|
|
|
if (CollUtil.isNotEmpty(deviceIds)) {
|
|
|
lqw.notIn(DeviceInfo::getDeviceId, deviceIds);
|
|
|
} else {
|
|
@@ -491,8 +491,8 @@ public class DeviceInfoServiceImpl extends ServiceImpl<DeviceInfoMapper, DeviceI
|
|
|
lqw.in(DeviceInfo::getDeviceId, myDeviceIds);
|
|
|
}
|
|
|
} else {
|
|
|
- //已选择
|
|
|
- //指定设备 已选择
|
|
|
+ // 已选择
|
|
|
+ // 指定设备 已选择
|
|
|
if (CollUtil.isNotEmpty(deviceIds)) {
|
|
|
lqw.in(DeviceInfo::getDeviceId, deviceIds);
|
|
|
} else {
|
|
@@ -500,7 +500,7 @@ public class DeviceInfoServiceImpl extends ServiceImpl<DeviceInfoMapper, DeviceI
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- //设备搜索
|
|
|
+ // 设备搜索
|
|
|
lqw.and(StrUtil.isNotEmpty(deviceSearch),
|
|
|
wrapper -> wrapper
|
|
|
.likeRight(DeviceInfo::getDeviceName, deviceSearch)
|
|
@@ -514,7 +514,7 @@ public class DeviceInfoServiceImpl extends ServiceImpl<DeviceInfoMapper, DeviceI
|
|
|
@Override
|
|
|
@ApiOperation("对象查询")
|
|
|
public R<DeviceInfoDto.Vo> obj(DeviceInfoDto.Obj obj) {
|
|
|
- //设备信息
|
|
|
+ // 设备信息
|
|
|
LambdaQueryWrapper<DeviceInfo> lambdaQueryWrapper = new MybatisPlusQuery().eqWrapper(obj, DeviceInfo.class).build();
|
|
|
List<DeviceInfo> list = list(lambdaQueryWrapper);
|
|
|
if (!Emptys.check(list)) {
|
|
@@ -535,21 +535,21 @@ public class DeviceInfoServiceImpl extends ServiceImpl<DeviceInfoMapper, DeviceI
|
|
|
ThreadPoolUtils.Execute execute = ThreadPoolUtils.excPoll(DeviceThreadPoolConfig.DEVICE_COMMON_POLL, num);
|
|
|
if (obj.getIsSysinfo()) {
|
|
|
execute.execute(() -> {
|
|
|
- //系统信息
|
|
|
+ // 系统信息
|
|
|
DeviceSysinfoDto.Vo deviceSysinfo = deviceSysinfoService.get(new DeviceSysinfoDto.Vo().setDeviceId(deviceInfo.getDeviceId())).getData();
|
|
|
deviceInfo.setDeviceSysinfo(deviceSysinfo);
|
|
|
});
|
|
|
}
|
|
|
if (obj.getIsStatus()) {
|
|
|
execute.execute(() -> {
|
|
|
- //状态信息
|
|
|
+ // 状态信息
|
|
|
DeviceStatusDto.Vo deviceStatus = deviceStatusService.obj(new DeviceStatusDto.Vo().setDeviceId(deviceInfo.getDeviceId())).getData();
|
|
|
deviceInfo.setDeviceStatus(deviceStatus);
|
|
|
});
|
|
|
}
|
|
|
if (obj.getIsRegister()) {
|
|
|
execute.execute(() -> {
|
|
|
- //注册信息
|
|
|
+ // 注册信息
|
|
|
DeviceRegisterDto.Vo deviceRegister = deviceRegisterService.obj(new DeviceRegisterDto.Vo().setDeviceId(deviceInfo.getDeviceId())).getData();
|
|
|
deviceInfo.setDeviceRegister(deviceRegister);
|
|
|
});
|
|
@@ -579,14 +579,14 @@ public class DeviceInfoServiceImpl extends ServiceImpl<DeviceInfoMapper, DeviceI
|
|
|
@Override
|
|
|
@ApiOperation("设备访问历史添加")
|
|
|
public R history(DeviceInfoDto.Obj obj) {
|
|
|
- //获取字典
|
|
|
+ // 获取字典
|
|
|
SysDictRedis sysDictRedis = SysDictUtils.get(EnumDataClearSize.Code.CODE.getCode(), EnumDataClearSize.DEVICE_HISTORY_TWIG.getCode());
|
|
|
Integer value = Integer.valueOf(sysDictRedis.getValue());
|
|
|
- //获取redis
|
|
|
+ // 获取redis
|
|
|
String key = keyPrefix + AuthorizeUtils.getLoginId(Long.class);
|
|
|
List<String> list = redisService.getList(key);
|
|
|
list.add(0, String.valueOf(obj.getDeviceId()));
|
|
|
- //去重
|
|
|
+ // 去重
|
|
|
List<String> redisList = new ArrayList<>();
|
|
|
JList<String> comparing = new JArrayList<>(list).comparing();
|
|
|
if (comparing.size() > value) {
|
|
@@ -613,7 +613,7 @@ public class DeviceInfoServiceImpl extends ServiceImpl<DeviceInfoMapper, DeviceI
|
|
|
}
|
|
|
DeviceStatusDto.Vo deviceStatus = deviceInfo.getDeviceStatus();
|
|
|
SysDictRedis qualitySets = SysDictUtils.get(EnumQualityMercSets.Code.CODE.getCode(), EnumQualityMercSets.MERC_CODE.getCode());
|
|
|
- //设备当前商户是质检时不检查
|
|
|
+ // 设备当前商户是质检时不检查
|
|
|
if (!qualitySets.getValue().equals(deviceInfo.getMercCode())) {
|
|
|
check(deviceInfo.getActiveState(), 2, "设备未激活");
|
|
|
check(deviceInfo.getFreezeStatus(), 2, "设备已冻结");
|
|
@@ -631,13 +631,13 @@ public class DeviceInfoServiceImpl extends ServiceImpl<DeviceInfoMapper, DeviceI
|
|
|
@PostMapping("historyList")
|
|
|
@ApiOperation("设备访问历史查询")
|
|
|
public R<List<DeviceInfoDto.Vo>> historyList() {
|
|
|
- //获取redis
|
|
|
+ // 获取redis
|
|
|
String key = keyPrefix + AuthorizeUtils.getLoginId(Long.class);
|
|
|
List<String> deviceIds = redisService.getList(key);
|
|
|
if (!Emptys.check(deviceIds)) {
|
|
|
return R.ok();
|
|
|
}
|
|
|
- //查询数据库
|
|
|
+ // 查询数据库
|
|
|
List<DeviceInfo> list = list(new LambdaQueryWrapper<DeviceInfo>().in(DeviceInfo::getDeviceId, deviceIds));
|
|
|
return R.ok(copy(DeviceInfoDto.Vo.class, list));
|
|
|
}
|
|
@@ -656,15 +656,15 @@ public class DeviceInfoServiceImpl extends ServiceImpl<DeviceInfoMapper, DeviceI
|
|
|
@PostMapping("update")
|
|
|
public R update(@RequestBody @Validated DeviceInfoDto.Update update) {
|
|
|
DeviceInfo deviceInfo = getById(update.getDeviceId());
|
|
|
- //判断是否更新了点位
|
|
|
+ // 判断是否更新了点位
|
|
|
if (Emptys.check(update.getPlaceId()) && !Objects.equals(deviceInfo.getPlaceId(), update.getPlaceId())) {
|
|
|
- //把设备绑定给点位管理员
|
|
|
+ // 把设备绑定给点位管理员
|
|
|
MercUserBindDeviceDto.BindByDeviceUpdate bindByPlaceIdDTto = new MercUserBindDeviceDto.BindByDeviceUpdate();
|
|
|
bindByPlaceIdDTto.setDeviceId(update.getDeviceId())
|
|
|
.setPlaceId(update.getPlaceId())
|
|
|
.setMercId(deviceInfo.getMercId());
|
|
|
mercUserBindDeviceService.bindByDeviceUpdate(bindByPlaceIdDTto);
|
|
|
- //更新坐标为点位的坐标
|
|
|
+ // 更新坐标为点位的坐标
|
|
|
MercPlaceDto.ObjVo place = mercPlaceService.obj(new MercPlaceDto.Obj().setId(update.getPlaceId())).getData();
|
|
|
update.setLat(place.getLat()).setLon(place.getLon());
|
|
|
}
|
|
@@ -677,19 +677,19 @@ public class DeviceInfoServiceImpl extends ServiceImpl<DeviceInfoMapper, DeviceI
|
|
|
DeviceInfoDto.Vo device = R.feignCheckData(this.obj(new DeviceInfoDto.Obj().setDeviceId(deviceId).setIsSysinfo(true)));
|
|
|
Long algorithmId = update.getAlgorithmId();
|
|
|
if (algorithmId != null && AlgorithmTypeEnum.CLOUD.getId() == algorithmId) {
|
|
|
- //云从算法
|
|
|
+ // 云从算法
|
|
|
boolean b = cloudWalkApiService.checkDeviceExist(deviceId);
|
|
|
if (!b) {
|
|
|
- //货柜不存在,新增
|
|
|
+ // 货柜不存在,新增
|
|
|
cloudWalkApiService.containerAdd(new ContainerAddDTO().setContainerCode(String.valueOf(deviceId)));
|
|
|
}
|
|
|
} else if (algorithmId != null && AlgorithmTypeEnum.TY.getId() == algorithmId) {
|
|
|
- //拓元算法
|
|
|
- //查询登记设备
|
|
|
+ // 拓元算法
|
|
|
+ // 查询登记设备
|
|
|
DeviceQueryVO deviceQueryVO = tyApiService.deviceQuery(new DeviceQueryDTO().setCpuId(String.valueOf(deviceId)));
|
|
|
Integer status = deviceQueryVO.getStatus();
|
|
|
if (status != null && 1000 == status.intValue()) {
|
|
|
- //未知的设备CPUID,进行登记
|
|
|
+ // 未知的设备CPUID,进行登记
|
|
|
tyApiService.deviceReg(new DeviceRegDTO()
|
|
|
.setCpuId(String.valueOf(deviceId))
|
|
|
.setDeviceNumber(String.valueOf(deviceId))
|
|
@@ -739,20 +739,20 @@ public class DeviceInfoServiceImpl extends ServiceImpl<DeviceInfoMapper, DeviceI
|
|
|
@ApiOperation("更新商户线路")
|
|
|
public R updateLine(@RequestBody @Validated DeviceInfoDto.UpdateLine updateLine) {
|
|
|
LambdaUpdateWrapper<DeviceInfo> luw = new LambdaUpdateWrapper<DeviceInfo>().eq(DeviceInfo::getMercId, updateLine.getMercId());
|
|
|
- //绑定线路,更换线路
|
|
|
+ // 绑定线路,更换线路
|
|
|
if (DeviceInfoDto.UPDATE.equals(updateLine.getType())) {
|
|
|
DeviceInfo deviceInfo = new DeviceInfo();
|
|
|
deviceInfo.setPlaceLineId(updateLine.getPlaceLineId());
|
|
|
luw.in(DeviceInfo::getDeviceId, updateLine.getDeviceIds());
|
|
|
baseMapper.update(deviceInfo, luw);
|
|
|
}
|
|
|
- //删除线路
|
|
|
+ // 删除线路
|
|
|
if (DeviceInfoDto.DEL.equals(updateLine.getType())) {
|
|
|
luw.eq(DeviceInfo::getPlaceLineId, updateLine.getWherePlaceLineId());
|
|
|
luw.set(DeviceInfo::getPlaceLineId, null);
|
|
|
baseMapper.update(null, luw);
|
|
|
}
|
|
|
- //解绑线路 设置线路ID为null
|
|
|
+ // 解绑线路 设置线路ID为null
|
|
|
if (DeviceInfoDto.CLEAR.equals(updateLine.getType())) {
|
|
|
luw.in(DeviceInfo::getDeviceId, updateLine.getDeviceIds());
|
|
|
luw.set(DeviceInfo::getPlaceLineId, null);
|
|
@@ -766,20 +766,20 @@ public class DeviceInfoServiceImpl extends ServiceImpl<DeviceInfoMapper, DeviceI
|
|
|
@ApiOperation("更新商户点位")
|
|
|
public R updatePlace(@RequestBody @Validated DeviceInfoDto.UpdatePlace updatePlace) {
|
|
|
LambdaUpdateWrapper<DeviceInfo> luw = new LambdaUpdateWrapper<DeviceInfo>().eq(DeviceInfo::getMercId, updatePlace.getMercId());
|
|
|
- //绑定点位,更换点位
|
|
|
+ // 绑定点位,更换点位
|
|
|
if (DeviceInfoDto.UPDATE.equals(updatePlace.getType())) {
|
|
|
DeviceInfo deviceInfo = new DeviceInfo();
|
|
|
deviceInfo.setPlaceId(updatePlace.getPlaceId());
|
|
|
luw.in(DeviceInfo::getDeviceId, updatePlace.getDeviceIds());
|
|
|
baseMapper.update(deviceInfo, luw);
|
|
|
}
|
|
|
- //删除点位
|
|
|
+ // 删除点位
|
|
|
if (DeviceInfoDto.DEL.equals(updatePlace.getType())) {
|
|
|
luw.eq(DeviceInfo::getPlaceId, updatePlace.getWherePlaceId());
|
|
|
luw.set(DeviceInfo::getPlaceId, null);
|
|
|
baseMapper.update(null, luw);
|
|
|
}
|
|
|
- //解绑点位 设置点位ID为null
|
|
|
+ // 解绑点位 设置点位ID为null
|
|
|
if (DeviceInfoDto.CLEAR.equals(updatePlace.getType())) {
|
|
|
luw.in(DeviceInfo::getDeviceId, updatePlace.getDeviceIds());
|
|
|
luw.set(DeviceInfo::getPlaceId, null);
|
|
@@ -811,13 +811,13 @@ public class DeviceInfoServiceImpl extends ServiceImpl<DeviceInfoMapper, DeviceI
|
|
|
PageBean<DeviceInfoDto.Vo2> pageBean = queryPage(page);
|
|
|
List<DeviceInfoDto.Vo2> records = pageBean.getRecords();
|
|
|
List<DeviceInfoDto.DeviceExcelVO> deviceExcelVOS = BeanUtil.copyToList(records, DeviceInfoDto.DeviceExcelVO.class);
|
|
|
- //异步导出参数封装
|
|
|
+ // 异步导出参数封装
|
|
|
ExcelDTO<DeviceInfoDto.DeviceExcelVO> excelDTO = new ExcelDTO<>();
|
|
|
excelDTO.setData(deviceExcelVOS);
|
|
|
excelDTO.setHead(DeviceInfoDto.DeviceExcelVO.class);
|
|
|
excelDTO.setSheetName(FileExportType.DEVICE_INFO.getDescription());
|
|
|
excelDTO.setFileExportType(FileExportType.DEVICE_INFO);
|
|
|
- //执行导出
|
|
|
+ // 执行导出
|
|
|
fileExportService.exportExcelAsync(excelDTO);
|
|
|
}
|
|
|
|
|
@@ -838,16 +838,16 @@ public class DeviceInfoServiceImpl extends ServiceImpl<DeviceInfoMapper, DeviceI
|
|
|
String mercCode = auth.getMercCode();
|
|
|
Long algorithmId = auth.getAlgorithmId();
|
|
|
String mercName = auth.getMercName();
|
|
|
- //商户最终设备列表
|
|
|
+ // 商户最终设备列表
|
|
|
List<Long> deviceIds = auth.getDeviceIds();
|
|
|
List<DeviceInfo> devices = getDevicesByMercId(mercId);
|
|
|
- //取消商户设备授权
|
|
|
+ // 取消商户设备授权
|
|
|
if (CollUtil.isEmpty(deviceIds)) {
|
|
|
if (CollUtil.isEmpty(devices)) {
|
|
|
return R.ok(Boolean.TRUE);
|
|
|
}
|
|
|
}
|
|
|
- //更新商户设备授权
|
|
|
+ // 更新商户设备授权
|
|
|
List<DeviceInfo> deviceInfos = this.listByIds(deviceIds);
|
|
|
List<DeviceStatus> deviceStatuses = new ArrayList<>();
|
|
|
for (DeviceInfo deviceInfo : deviceInfos) {
|
|
@@ -855,24 +855,24 @@ public class DeviceInfoServiceImpl extends ServiceImpl<DeviceInfoMapper, DeviceI
|
|
|
Long deviceId = deviceInfo.getDeviceId();
|
|
|
|
|
|
if (ObjectUtil.equals(deviceType, DeviceTypeEnum.TYPE5.getCode())) {
|
|
|
- //支付宝设备算法
|
|
|
+ // 支付宝设备算法
|
|
|
algorithmId = AlgorithmTypeEnum.ALIPAY.getId();
|
|
|
} else {
|
|
|
- //非支付宝算法
|
|
|
+ // 非支付宝算法
|
|
|
if (AlgorithmTypeEnum.CLOUD.getId() == algorithmId) {
|
|
|
- //云从算法
|
|
|
+ // 云从算法
|
|
|
boolean b = cloudWalkApiService.checkDeviceExist(deviceId);
|
|
|
if (!b) {
|
|
|
- //货柜不存在,新增
|
|
|
+ // 货柜不存在,新增
|
|
|
cloudWalkApiService.containerAdd(new ContainerAddDTO().setContainerCode(String.valueOf(deviceId)));
|
|
|
}
|
|
|
} else if (AlgorithmTypeEnum.TY.getId() == algorithmId) {
|
|
|
- //拓元算法
|
|
|
- //查询登记设备
|
|
|
+ // 拓元算法
|
|
|
+ // 查询登记设备
|
|
|
DeviceQueryVO deviceQueryVO = tyApiService.deviceQuery(new DeviceQueryDTO().setCpuId(String.valueOf(deviceId)));
|
|
|
Integer status = deviceQueryVO.getStatus();
|
|
|
if (status != null && 1000 == status.intValue()) {
|
|
|
- //未知的设备CPUID,进行登记
|
|
|
+ // 未知的设备CPUID,进行登记
|
|
|
tyApiService.deviceReg(new DeviceRegDTO()
|
|
|
.setCpuId(String.valueOf(deviceId))
|
|
|
.setDeviceNumber(String.valueOf(deviceId))
|
|
@@ -884,7 +884,7 @@ public class DeviceInfoServiceImpl extends ServiceImpl<DeviceInfoMapper, DeviceI
|
|
|
String refMercCode = deviceInfo.getMercCode();
|
|
|
|
|
|
if (BooleanUtil.isFalse(auth.getMercOperate())) {
|
|
|
- //非商户操作
|
|
|
+ // 非商户操作
|
|
|
// 只有解绑后,才能给顶级商户授权
|
|
|
if (refMercId != -1 && refMercId != mercId.intValue()) {
|
|
|
StrBuilder sb = StrBuilder.create();
|
|
@@ -895,20 +895,20 @@ public class DeviceInfoServiceImpl extends ServiceImpl<DeviceInfoMapper, DeviceI
|
|
|
.append(deviceInfo.getMercName())
|
|
|
.append("]绑定,请先进行解绑!")
|
|
|
.toString();
|
|
|
- //非质检商户需要进行判断,质检商户跳过
|
|
|
+ // 非质检商户需要进行判断,质检商户跳过
|
|
|
if (!QA_MERC_CODE.equals(refMercCode)) {
|
|
|
- //已关联别商户
|
|
|
+ // 已关联别商户
|
|
|
return R.fail(errMsg, Boolean.FALSE);
|
|
|
}
|
|
|
|
|
|
}
|
|
|
} else {
|
|
|
- //商户操作直接转移给子商户
|
|
|
+ // 商户操作直接转移给子商户
|
|
|
}
|
|
|
|
|
|
- //绑定关系
|
|
|
+ // 绑定关系
|
|
|
deviceInfo.setMercId(mercId).setMercCode(mercCode).setAlgorithmId(algorithmId).setMercName(mercName);
|
|
|
- //标记机器可交易
|
|
|
+ // 标记机器可交易
|
|
|
DeviceStatus deviceStatus = new DeviceStatus()
|
|
|
.setDeviceId(deviceInfo.getDeviceId())
|
|
|
.setIsPay(true);
|
|
@@ -955,13 +955,13 @@ public class DeviceInfoServiceImpl extends ServiceImpl<DeviceInfoMapper, DeviceI
|
|
|
private Boolean removeMerDevicesByDeviceIds(DeviceInfoDto.MercDeviceUnBindDto dto, List<DeviceInfo> deviceInfos) {
|
|
|
if (CollUtil.isNotEmpty(deviceInfos)) {
|
|
|
deviceInfos.forEach(deviceInfo -> {
|
|
|
- //回收 到当前操作商户
|
|
|
+ // 回收 到当前操作商户
|
|
|
deviceInfo.setMercId(dto.getMercId());
|
|
|
deviceInfo.setMercDeviceCode(StrUtil.EMPTY);
|
|
|
deviceInfo.setMercName(dto.getMercName());
|
|
|
deviceInfo.setMercCode(dto.getMercCode());
|
|
|
});
|
|
|
- //批量更新
|
|
|
+ // 批量更新
|
|
|
return updateBatchById(deviceInfos);
|
|
|
}
|
|
|
|
|
@@ -979,13 +979,13 @@ public class DeviceInfoServiceImpl extends ServiceImpl<DeviceInfoMapper, DeviceI
|
|
|
MercDto.Vo mercCheck = R.feignCheckData(mercFeignService.obj(new MercDto.ListDTO().setMercCode(QA_MERC_CODE)));
|
|
|
if (CollUtil.isNotEmpty(deviceInfos)) {
|
|
|
deviceInfos.forEach(deviceInfo -> {
|
|
|
- //回收
|
|
|
+ // 回收
|
|
|
deviceInfo.setMercId(mercCheck.getId());
|
|
|
deviceInfo.setMercDeviceCode(StrUtil.EMPTY);
|
|
|
deviceInfo.setMercName(mercCheck.getName());
|
|
|
deviceInfo.setMercCode(QA_MERC_CODE);
|
|
|
});
|
|
|
- //批量更新
|
|
|
+ // 批量更新
|
|
|
return updateBatchById(deviceInfos);
|
|
|
}
|
|
|
|
|
@@ -1002,7 +1002,7 @@ public class DeviceInfoServiceImpl extends ServiceImpl<DeviceInfoMapper, DeviceI
|
|
|
private Boolean removeMerRefDevices(List<DeviceInfo> deviceInfos, Long parentId) {
|
|
|
if (CollUtil.isNotEmpty(deviceInfos) && parentId != null) {
|
|
|
deviceInfos.forEach(deviceInfo -> {
|
|
|
- //非顶级兴元商户,解绑后,机器归父商户
|
|
|
+ // 非顶级兴元商户,解绑后,机器归父商户
|
|
|
if (parentId != 1) {
|
|
|
MercDto.Vo mercParent = R.feignCheckData(mercFeignService.obj(new MercDto.ListDTO().setId(parentId)));
|
|
|
if (mercParent != null) {
|
|
@@ -1016,7 +1016,7 @@ public class DeviceInfoServiceImpl extends ServiceImpl<DeviceInfoMapper, DeviceI
|
|
|
}
|
|
|
|
|
|
}
|
|
|
- //一级商户,解绑后,直接释放
|
|
|
+ // 一级商户,解绑后,直接释放
|
|
|
if (parentId == 0) {
|
|
|
MercDto.Vo mercCheck = R.feignCheckData(mercFeignService.obj(new MercDto.ListDTO().setMercCode(QA_MERC_CODE)));
|
|
|
if (mercCheck != null) {
|
|
@@ -1032,7 +1032,7 @@ public class DeviceInfoServiceImpl extends ServiceImpl<DeviceInfoMapper, DeviceI
|
|
|
}
|
|
|
|
|
|
});
|
|
|
- //批量更新
|
|
|
+ // 批量更新
|
|
|
return updateBatchById(deviceInfos);
|
|
|
}
|
|
|
|
|
@@ -1065,7 +1065,7 @@ public class DeviceInfoServiceImpl extends ServiceImpl<DeviceInfoMapper, DeviceI
|
|
|
// queryWrapper.in(LambdaUtils.getUnderlineCaseName(DeviceInfo::getPlaceLineId), placeLineIds);
|
|
|
// }
|
|
|
|
|
|
- //fixed
|
|
|
+ // fixed
|
|
|
if (StrUtil.isNotEmpty(deviceSearch)) {
|
|
|
queryWrapper.and(wrapper -> wrapper.likeRight(LambdaUtils.getUnderlineCaseName(DeviceInfo::getDeviceName), deviceSearch).or()
|
|
|
.eq(LambdaUtils.getUnderlineCaseName(DeviceInfo::getDeviceId), deviceSearch));
|
|
@@ -1099,7 +1099,7 @@ public class DeviceInfoServiceImpl extends ServiceImpl<DeviceInfoMapper, DeviceI
|
|
|
public R<DeviceInfoDto.MercHomeStatisticalVO> mercHomeStatistical(DeviceInfoDto.MercHomeQueryDTO dto) {
|
|
|
Long mercId = dto.getMercId();
|
|
|
List<Long> myDeviceIds = dto.getMyDeviceIds();
|
|
|
- //初始化数据
|
|
|
+ // 初始化数据
|
|
|
DeviceInfoDto.MercHomeStatisticalVO mercHomeStatisticalVO = new DeviceInfoDto.MercHomeStatisticalVO()
|
|
|
.setClosedNum(0).setOfflineNum(0)
|
|
|
.setOnlineNum(0).setOperatingNum(0).setNeedToFillNum(0);
|
|
@@ -1113,9 +1113,9 @@ public class DeviceInfoServiceImpl extends ServiceImpl<DeviceInfoMapper, DeviceI
|
|
|
}
|
|
|
|
|
|
|
|
|
- //在线、离线
|
|
|
+ // 在线、离线
|
|
|
List<DeviceStatus> deviceStatuses = deviceStatusService.listByIds(myDeviceIds);
|
|
|
- //分组统计
|
|
|
+ // 分组统计
|
|
|
Map<Integer, Long> countNetstateMap = deviceStatuses.stream().collect(Collectors
|
|
|
.groupingBy(DeviceStatus::getNetState, Collectors.counting()));
|
|
|
Integer onlineDictValue = SysDictUtils.getValue(EnumDeviceOnlineStatus.Code.CODE.getCode(), EnumDeviceOnlineStatus.CONNECTED.getCode(), Integer.class);
|
|
@@ -1126,20 +1126,20 @@ public class DeviceInfoServiceImpl extends ServiceImpl<DeviceInfoMapper, DeviceI
|
|
|
mercHomeStatisticalVO.setOnlineNum(onlineNum);
|
|
|
mercHomeStatisticalVO.setOfflineNum(offlineNum);
|
|
|
|
|
|
- //锁机、未锁机
|
|
|
+ // 锁机、未锁机
|
|
|
// Map<Integer, Long> countLockLstateMap = deviceStatuses.stream().collect(Collectors
|
|
|
// .groupingBy(DeviceStatus::getLockStateL, Collectors.counting()));
|
|
|
// Long lockLStateNum = countLockLstateMap.get(DeviceLockState.LOCK.getCode());
|
|
|
// Long unLockLStateNum = countLockLstateMap.get(DeviceLockState.UN_LOCK.getCode());
|
|
|
Map<Integer, Long> countLockLstateMap = mercDevices.stream().collect(Collectors
|
|
|
.groupingBy(DeviceInfo::getBusyState, Collectors.counting()));
|
|
|
- //运营
|
|
|
+ // 运营
|
|
|
Long operatingNum = countLockLstateMap.get(DeviceBusySateType.OPERATING.getCode());
|
|
|
- //停运
|
|
|
+ // 停运
|
|
|
Long suspendedNum = countLockLstateMap.get(DeviceBusySateType.SUSPENDED.getCode());
|
|
|
mercHomeStatisticalVO.setOperatingNum(operatingNum == null ? 0 : operatingNum.intValue());
|
|
|
mercHomeStatisticalVO.setClosedNum(suspendedNum == null ? 0 : suspendedNum.intValue());
|
|
|
- //待补货
|
|
|
+ // 待补货
|
|
|
Integer deviceNum = R.feignCheckData(goodsDeviceService.countOutOfStockDevice(new GoodsDeviceDto.CountOutOfStockDevice().setMercId(mercId).setDeviceIds(myDeviceIds)));
|
|
|
mercHomeStatisticalVO.setNeedToFillNum(deviceNum);
|
|
|
return R.ok(mercHomeStatisticalVO);
|
|
@@ -1153,7 +1153,7 @@ public class DeviceInfoServiceImpl extends ServiceImpl<DeviceInfoMapper, DeviceI
|
|
|
String deviceName = dto.getDeviceName();
|
|
|
Long deviceId = dto.getDeviceId();
|
|
|
List<Long> searchPlaceIdList = new ArrayList<>();
|
|
|
- //根据管理员名字查询点位ID列表
|
|
|
+ // 根据管理员名字查询点位ID列表
|
|
|
if (Emptys.check(dto.getAdminName())) {
|
|
|
MercPlaceDto.ListDto placeDto = new MercPlaceDto.ListDto();
|
|
|
placeDto.setMercId(mercId).setAdminName(dto.getAdminName());
|
|
@@ -1173,7 +1173,7 @@ public class DeviceInfoServiceImpl extends ServiceImpl<DeviceInfoMapper, DeviceI
|
|
|
}
|
|
|
List<Long> searchDeviceIds = new ArrayList<>();
|
|
|
if (StrUtil.isNotEmpty(searchKey) || StrUtil.isNotEmpty(dto.getAdminName())) {
|
|
|
- //名称或者编号搜索设备
|
|
|
+ // 名称或者编号搜索设备
|
|
|
LambdaQueryWrapper<DeviceInfo> deviceLqw = Wrappers.<DeviceInfo>lambdaQuery()
|
|
|
.eq(DeviceInfo::getMercId, mercId)
|
|
|
.in(Emptys.check(searchPlaceIdList), DeviceInfo::getPlaceId, searchPlaceIdList);
|
|
@@ -1198,7 +1198,7 @@ public class DeviceInfoServiceImpl extends ServiceImpl<DeviceInfoMapper, DeviceI
|
|
|
Integer busyStatus = dto.getBusyStatus();
|
|
|
Integer onlineStatus = dto.getOnlineStatus();
|
|
|
Integer deviceType = dto.getDeviceType();
|
|
|
- //条件查询 在线状态,运营状态,设备类型,
|
|
|
+ // 条件查询 在线状态,运营状态,设备类型,
|
|
|
List<Long> deviceIdList = new ArrayList<>();
|
|
|
if (deviceId != null && myDeviceIds.indexOf(deviceId) > 0) {
|
|
|
deviceIdList.add(deviceId);
|
|
@@ -1219,7 +1219,7 @@ public class DeviceInfoServiceImpl extends ServiceImpl<DeviceInfoMapper, DeviceI
|
|
|
queryDeviceIds.add(id);
|
|
|
}
|
|
|
}
|
|
|
- //无符合权限的搜索设备,返空
|
|
|
+ // 无符合权限的搜索设备,返空
|
|
|
if (CollUtil.isEmpty(queryDeviceIds)) {
|
|
|
return R.ok(new ArrayList<>());
|
|
|
} else {
|
|
@@ -1253,7 +1253,7 @@ public class DeviceInfoServiceImpl extends ServiceImpl<DeviceInfoMapper, DeviceI
|
|
|
List<DeviceInfoDto.MercHomeListVO> dataList = new ArrayList<>(list.size());
|
|
|
|
|
|
LambdaQueryWrapper<DeviceInfo> lqw = new LambdaQueryWrapper<>();
|
|
|
- //非质检商户才需要激活
|
|
|
+ // 非质检商户才需要激活
|
|
|
lqw.eq(!isQa, DeviceInfo::getActiveState, DeviceActiveStateEnum.TRUE.getCode());
|
|
|
lqw.eq(mercId != null, DeviceInfo::getMercId, mercId);
|
|
|
lqw.eq(busyStatus != null, DeviceInfo::getBusyState, busyStatus);
|
|
@@ -1261,15 +1261,15 @@ public class DeviceInfoServiceImpl extends ServiceImpl<DeviceInfoMapper, DeviceI
|
|
|
lqw.in(CollUtil.isNotEmpty(deviceIdList), DeviceInfo::getDeviceId, deviceIdList);
|
|
|
lqw.like(StrUtil.isNotEmpty(deviceName), DeviceInfo::getDeviceName, deviceName).orderByAsc(true, DeviceInfo::getDeviceName, DeviceInfo::getDeviceId);
|
|
|
List<DeviceInfoDto.Vo> deviceInfoList = copy(DeviceInfoDto.Vo.class, this.list(lqw));
|
|
|
- //根据点位ID查询管理员名字
|
|
|
+ // 根据点位ID查询管理员名字
|
|
|
List<Long> placeIdList = deviceInfoList.stream().map(DeviceInfoDto.Vo::getPlaceId).distinct().filter(Objects::nonNull).collect(Collectors.toList());
|
|
|
List<MercPlaceDto.Vo> mercPlaceList = mercPlaceService.list(new MercPlaceDto.ListDto().setIds(placeIdList)).getData();
|
|
|
if (Emptys.check(mercPlaceList)) {
|
|
|
- //Map<Long, String> mercPlaceMap = mercPlaceList.stream().collect(Collectors.toMap(i -> i.getId(), i -> i.getAdminName()));
|
|
|
+ // Map<Long, String> mercPlaceMap = mercPlaceList.stream().collect(Collectors.toMap(i -> i.getId(), i -> i.getAdminName()));
|
|
|
Map<Long, String> mercPlaceMap = mercPlaceList.stream().collect(HashMap::new, (map, item) -> map.put(item.getId(), item.getAdminName()), HashMap::putAll);
|
|
|
deviceInfoList.forEach(i -> i.setAdminName(mercPlaceMap.get(i.getPlaceId())));
|
|
|
}
|
|
|
- //没有管理员的的设置默认值
|
|
|
+ // 没有管理员的的设置默认值
|
|
|
deviceInfoList.stream().filter(s -> s.getAdminName() == null).forEach(s -> s.setAdminName("未分配管理员"));
|
|
|
List<String> adminNameList = deviceInfoList.stream().map(DeviceInfoDto.Vo::getAdminName).distinct().collect(Collectors.toList());
|
|
|
List<Long> dIds = deviceInfoList.stream().map(DeviceInfoDto.Vo::getDeviceId).distinct().collect(Collectors.toList());
|
|
@@ -1279,7 +1279,7 @@ public class DeviceInfoServiceImpl extends ServiceImpl<DeviceInfoMapper, DeviceI
|
|
|
deviceSysInfoMap = deviceSysList.stream().collect(Collectors.toMap(DeviceSysinfoDto.Vo::getDeviceId, i -> i));
|
|
|
}
|
|
|
|
|
|
- //根据管理员名字分组
|
|
|
+ // 根据管理员名字分组
|
|
|
Map<String, List<DeviceInfoDto.Vo>> deviceMap = deviceInfoList.stream().collect(Collectors.groupingBy(DeviceInfoDto.Vo::getAdminName));
|
|
|
|
|
|
DateTime date = DateTime.now();
|
|
@@ -1288,18 +1288,18 @@ public class DeviceInfoServiceImpl extends ServiceImpl<DeviceInfoMapper, DeviceI
|
|
|
for (String adminName : adminNameList) {
|
|
|
DeviceInfoDto.MercHomeListVO vo = new DeviceInfoDto.MercHomeListVO();
|
|
|
vo.setAdminName(adminName);
|
|
|
- //区域下的设备列表
|
|
|
+ // 区域下的设备列表
|
|
|
List<DeviceInfoDto.MercHomeDeviceVo> deviceInfos = BeanUtil.copyToList(deviceMap.get(adminName), DeviceInfoDto.MercHomeDeviceVo.class);
|
|
|
vo.setDeviceNum(deviceInfos.size());
|
|
|
if (CollUtil.isEmpty(deviceInfos)) {
|
|
|
continue;
|
|
|
}
|
|
|
|
|
|
- //设备销售统计
|
|
|
+ // 设备销售统计
|
|
|
List<Long> deviceIds = deviceInfos.stream().map(DeviceInfoDto.MercHomeDeviceVo::getDeviceId).collect(Collectors.toList());
|
|
|
|
|
|
|
|
|
- //设备状态查询
|
|
|
+ // 设备状态查询
|
|
|
List<DeviceStatusDto.Vo> deviceStatusList = deviceStatusService.list(new DeviceStatusDto.SelectList().setDeviceIds(deviceIds)).getData();
|
|
|
Map<Long, DeviceStatusDto.Vo> datdeviceStatusMap = new HashMap<>();
|
|
|
if (CollUtil.isNotEmpty(deviceStatusList)) {
|
|
@@ -1313,10 +1313,10 @@ public class DeviceInfoServiceImpl extends ServiceImpl<DeviceInfoMapper, DeviceI
|
|
|
|
|
|
for (DeviceInfoDto.MercHomeDeviceVo device : deviceInfos) {
|
|
|
Long dId = device.getDeviceId();
|
|
|
- //设备类型 反显
|
|
|
+ // 设备类型 反显
|
|
|
SysDictRedis dictDeviceType = SysDictUtils.get(DictConsts.DEVICE_TYPE, String.valueOf(device.getDeviceType()));
|
|
|
device.setDeviceTypeName(dictDeviceType.getMsg());
|
|
|
- //运营状态 反显
|
|
|
+ // 运营状态 反显
|
|
|
SysDictRedis dictBusyState = SysDictUtils.get(DictConsts.DEVICE_BUSY_STATUS, String.valueOf(device.getBusyState()));
|
|
|
device.setBusyStateName(dictBusyState.getMsg());
|
|
|
|
|
@@ -1325,10 +1325,10 @@ public class DeviceInfoServiceImpl extends ServiceImpl<DeviceInfoMapper, DeviceI
|
|
|
CountDto.OrderByCreateTimeAndMercId orderByCreateTimeAndMercId = new CountDto.OrderByCreateTimeAndMercId()
|
|
|
.setMerdId(mercId).setBeginTime(start).setEndTime(end).setDeviceIds(CollUtil.newArrayList(dId));
|
|
|
log.info("设备订单统计:{}", JSONUtil.toJsonPrettyStr(orderByCreateTimeAndMercId));
|
|
|
- //完成订单
|
|
|
+ // 完成订单
|
|
|
CountDto.SuccessVo successVo = R.feignCheckData(countApiService.orderBySuccess(orderByCreateTimeAndMercId));
|
|
|
|
|
|
- //今日销售、库存情况 反显
|
|
|
+ // 今日销售、库存情况 反显
|
|
|
device.setDayOrderNum(successVo != null ? successVo.getOrdersSize() : zero);
|
|
|
device.setDaySalesPrice(successVo != null ? successVo.getOrderTotalMoney() : zero);
|
|
|
DeviceStatusDto.Vo deviceStatus = datdeviceStatusMap.get(device.getDeviceId());
|
|
@@ -1339,7 +1339,7 @@ public class DeviceInfoServiceImpl extends ServiceImpl<DeviceInfoMapper, DeviceI
|
|
|
device.setFillNum(goodsDevice.stream().mapToInt(GoodsDeviceDto.Vo::getFillCount).sum());
|
|
|
}
|
|
|
}
|
|
|
- //温控仪 反显
|
|
|
+ // 温控仪 反显
|
|
|
DeviceSysinfoDto.Vo dSysInfo = deviceSysInfoMap.get(dId);
|
|
|
if (dSysInfo == null) {
|
|
|
device.setIsHaveTemp(false);
|
|
@@ -1347,14 +1347,14 @@ public class DeviceInfoServiceImpl extends ServiceImpl<DeviceInfoMapper, DeviceI
|
|
|
device.setIsHaveTemp(BooleanUtil.isTrue(dSysInfo.getIsHaveTemp()));
|
|
|
}
|
|
|
|
|
|
- //算法類型
|
|
|
+ // 算法類型
|
|
|
Long algorithmId = device.getAlgorithmId();
|
|
|
if (algorithmId != null) {
|
|
|
String name = algorithmListMap.get(algorithmId);
|
|
|
device.setAlgorithmAlias(name);
|
|
|
}
|
|
|
|
|
|
- //联网状态
|
|
|
+ // 联网状态
|
|
|
Integer netState = deviceStatus == null ? DeviceNetSateType.DISCONNECT.getCode() : deviceStatus.getNetState();
|
|
|
device.setNetState(netState);
|
|
|
if (netState == null) {
|
|
@@ -1371,7 +1371,7 @@ public class DeviceInfoServiceImpl extends ServiceImpl<DeviceInfoMapper, DeviceI
|
|
|
device.setDeviceStateR(deviceStateR);
|
|
|
Boolean isUseBattery = deviceStatus.getIsUseBattery();
|
|
|
if (BooleanUtil.isTrue(isUseBattery)) {
|
|
|
- //使用电池。即断电状态
|
|
|
+ // 使用电池。即断电状态
|
|
|
device.setSysPower(2);
|
|
|
} else {
|
|
|
device.setSysPower(1);
|
|
@@ -1386,7 +1386,7 @@ public class DeviceInfoServiceImpl extends ServiceImpl<DeviceInfoMapper, DeviceI
|
|
|
|
|
|
}
|
|
|
|
|
|
- //名称排序
|
|
|
+ // 名称排序
|
|
|
if (CollUtil.isNotEmpty(deviceInfos)) {
|
|
|
deviceInfos = ListUtil.sortByProperty(deviceInfos, LambdaUtils.getProperty(DeviceInfoDto.MercHomeDeviceVo::getDeviceName));
|
|
|
deviceInfos = ListUtil.sortByProperty(deviceInfos, LambdaUtils.getProperty(DeviceInfoDto.MercHomeDeviceVo::getDeviceId));
|
|
@@ -1444,16 +1444,16 @@ public class DeviceInfoServiceImpl extends ServiceImpl<DeviceInfoMapper, DeviceI
|
|
|
@Override
|
|
|
public R<PageBean<DeviceInfoDto.MerHomeSearchVO>> mercDeviceSearchPage(@RequestBody DeviceInfoDto.Page page) {
|
|
|
PageBean<DeviceInfoDto.MerHomeSearchVO> pageData = new PageBean<>();
|
|
|
- //小程序独有查询字段 缺货状态:stockStatus ,是否查故障设备:fault
|
|
|
+ // 小程序独有查询字段 缺货状态:stockStatus ,是否查故障设备:fault
|
|
|
Boolean fault = page.getFault();
|
|
|
Long mercId = page.getMercId();
|
|
|
List<Long> myDeviceIds = page.getMyDeviceIds();
|
|
|
if (CollUtil.isEmpty(myDeviceIds)) {
|
|
|
- //无设备
|
|
|
+ // 无设备
|
|
|
return R.ok(pageData);
|
|
|
}
|
|
|
if (BooleanUtil.isTrue(fault)) {
|
|
|
- //查询故障设备
|
|
|
+ // 查询故障设备
|
|
|
List<DeviceEventMsg> deviceEventMsgs = deviceEventMsgService.list(Wrappers.<DeviceEventMsg>lambdaQuery()
|
|
|
.eq(mercId != null, DeviceEventMsg::getMercId, page.getMercId())
|
|
|
.in(DeviceEventMsg::getDeviceId, myDeviceIds));
|
|
@@ -1478,12 +1478,12 @@ public class DeviceInfoServiceImpl extends ServiceImpl<DeviceInfoMapper, DeviceI
|
|
|
List<Long> deviceIds = records.stream().map(DeviceInfoDto.Vo2::getDeviceId).collect(Collectors.toList());
|
|
|
String type = EnumDeviceDataType.DAY.getCode();
|
|
|
String todayDate = DateUtil.format(new Date(), DatePattern.PURE_DATE_PATTERN);
|
|
|
- //查询当天
|
|
|
+ // 查询当天
|
|
|
DeviceDataDto.ListDTO dto = new DeviceDataDto.ListDTO()
|
|
|
.setDeviceIds(deviceIds).setType(type).setDateValue(Integer.valueOf(todayDate)).setMercId(mercId);
|
|
|
List<DeviceDataDto.Vo> deviceDataList = deviceDataService.list(dto);
|
|
|
Map<Long, DeviceDataDto.Vo> dataMap = MapUtil.newHashMap();
|
|
|
- //统计数据反显
|
|
|
+ // 统计数据反显
|
|
|
if (CollUtil.isNotEmpty(deviceDataList)) {
|
|
|
dataMap = deviceDataList.stream().collect(Collectors.toMap(DeviceDataDto.Vo::getDeviceId, d -> d));
|
|
|
}
|
|
@@ -1492,7 +1492,7 @@ public class DeviceInfoServiceImpl extends ServiceImpl<DeviceInfoMapper, DeviceI
|
|
|
Long deviceId = v.getDeviceId();
|
|
|
DeviceDataDto.Vo vo = dataMap.get(deviceId);
|
|
|
if (vo != null) {
|
|
|
- //今日订单数
|
|
|
+ // 今日订单数
|
|
|
v.setDayOrderNum(vo != null ? vo.getSalesCount() : 0);
|
|
|
v.setDaySalesPrice(vo != null ? vo.getSalesMoney() : 0);
|
|
|
BeanUtil.copyProperties(vo, merHomeSearchVO);
|
|
@@ -1530,19 +1530,19 @@ public class DeviceInfoServiceImpl extends ServiceImpl<DeviceInfoMapper, DeviceI
|
|
|
Integer type = dto.getType();
|
|
|
switch (type) {
|
|
|
case 1:
|
|
|
- //经营数据
|
|
|
+ // 经营数据
|
|
|
return R.ok(dataCount1(dto));
|
|
|
case 2:
|
|
|
- //经营图表
|
|
|
+ // 经营图表
|
|
|
return R.ok(dataCount2(dto));
|
|
|
case 3:
|
|
|
- //温度图表
|
|
|
+ // 温度图表
|
|
|
return R.ok(dataCount3(dto));
|
|
|
case 4:
|
|
|
- //信号图表
|
|
|
+ // 信号图表
|
|
|
return R.ok(dataCount4(dto));
|
|
|
case 5:
|
|
|
- //商品管理
|
|
|
+ // 商品管理
|
|
|
return R.ok(dataCount5(dto));
|
|
|
default:
|
|
|
break;
|
|
@@ -1560,7 +1560,7 @@ public class DeviceInfoServiceImpl extends ServiceImpl<DeviceInfoMapper, DeviceI
|
|
|
Long deviceId = dto.getDeviceId();
|
|
|
Long mercId = dto.getMercId();
|
|
|
DeviceInfoDto.DeviceDataCountVO vo = new DeviceInfoDto.DeviceDataCountVO();
|
|
|
- //当天
|
|
|
+ // 当天
|
|
|
|
|
|
|
|
|
DateTime date = DateTime.now();
|
|
@@ -1570,7 +1570,7 @@ public class DeviceInfoServiceImpl extends ServiceImpl<DeviceInfoMapper, DeviceI
|
|
|
CountDto.OrderByCreateTimeAndMercId orderByCreateTimeAndMercId = new CountDto.OrderByCreateTimeAndMercId()
|
|
|
.setMerdId(mercId).setBeginTime(start).setEndTime(end).setDeviceIds(deviceIds);
|
|
|
|
|
|
- //完成订单
|
|
|
+ // 完成订单
|
|
|
CountDto.SuccessVo successVo = R.feignCheckData(countApiService.orderBySuccess(orderByCreateTimeAndMercId));
|
|
|
|
|
|
DeviceDataDto.Vo dayData = new DeviceDataDto.Vo();
|
|
@@ -1581,16 +1581,16 @@ public class DeviceInfoServiceImpl extends ServiceImpl<DeviceInfoMapper, DeviceI
|
|
|
}
|
|
|
|
|
|
|
|
|
- //当月
|
|
|
+ // 当月
|
|
|
DeviceDataDto.Vo monthData = new DeviceDataDto.Vo();
|
|
|
|
|
|
- //月度统计
|
|
|
+ // 月度统计
|
|
|
DateTime startM = DateUtil.beginOfMonth(date);
|
|
|
DateTime endM = DateUtil.endOfMonth(date);
|
|
|
|
|
|
CountDto.OrderByCreateTimeAndMercId monthOrder = new CountDto.OrderByCreateTimeAndMercId()
|
|
|
.setMerdId(mercId).setBeginTime(startM).setEndTime(endM).setDeviceIds(deviceIds);
|
|
|
- //完成订单
|
|
|
+ // 完成订单
|
|
|
CountDto.SuccessVo successVoM = R.feignCheckData(countApiService.orderBySuccess(monthOrder));
|
|
|
|
|
|
|
|
@@ -1612,7 +1612,7 @@ public class DeviceInfoServiceImpl extends ServiceImpl<DeviceInfoMapper, DeviceI
|
|
|
*/
|
|
|
private DeviceInfoDto.DeviceDataCountVO dataCount2(DeviceInfoDto.DeviceDataCountDTO dto) {
|
|
|
Long deviceId = dto.getDeviceId();
|
|
|
- //近一个月 (销售额,订单数,退款金额,退款数)
|
|
|
+ // 近一个月 (销售额,订单数,退款金额,退款数)
|
|
|
DeviceInfoDto.DeviceDataCountVO vo = new DeviceInfoDto.DeviceDataCountVO();
|
|
|
DeviceInfoDto.BusinessChart businessChart = new DeviceInfoDto.BusinessChart();
|
|
|
List<String> categories = DataTime.dayListByLastDay(30);
|
|
@@ -1630,7 +1630,7 @@ public class DeviceInfoServiceImpl extends ServiceImpl<DeviceInfoMapper, DeviceI
|
|
|
return vo;
|
|
|
}
|
|
|
|
|
|
- //每天的数据
|
|
|
+ // 每天的数据
|
|
|
Map<Integer, DeviceDataDto.Vo> dataDayMap = listByDay.stream().collect(Collectors.toMap(DeviceDataDto.Vo::getDateValue, i -> i));
|
|
|
|
|
|
List<DeviceInfoDto.MyChartSeries3> series = new ArrayList<>();
|
|
@@ -1638,12 +1638,12 @@ public class DeviceInfoServiceImpl extends ServiceImpl<DeviceInfoMapper, DeviceI
|
|
|
String[] names = {"销售额", "订单数", "退款金额", "退款数"};
|
|
|
for (int i = 0; i < names.length; i++) {
|
|
|
DeviceInfoDto.MyChartSeries3 myChartSeries = new DeviceInfoDto.MyChartSeries3();
|
|
|
- //某个类型每天的数据
|
|
|
+ // 某个类型每天的数据
|
|
|
List<String> data = new ArrayList<>();
|
|
|
if (i == 0) {
|
|
|
- //销售额
|
|
|
+ // 销售额
|
|
|
dateList.forEach(d -> {
|
|
|
- //每日数据填充
|
|
|
+ // 每日数据填充
|
|
|
DeviceDataDto.Vo deviceData = dataDayMap.get(d);
|
|
|
|
|
|
if (deviceData == null) {
|
|
@@ -1655,9 +1655,9 @@ public class DeviceInfoServiceImpl extends ServiceImpl<DeviceInfoMapper, DeviceI
|
|
|
}
|
|
|
});
|
|
|
} else if (i == 1) {
|
|
|
- //订单数
|
|
|
+ // 订单数
|
|
|
dateList.forEach(d -> {
|
|
|
- //每日数据填充
|
|
|
+ // 每日数据填充
|
|
|
DeviceDataDto.Vo deviceData = dataDayMap.get(d);
|
|
|
String value = "0";
|
|
|
if (deviceData == null) {
|
|
@@ -1669,9 +1669,9 @@ public class DeviceInfoServiceImpl extends ServiceImpl<DeviceInfoMapper, DeviceI
|
|
|
|
|
|
});
|
|
|
} else if (i == 2) {
|
|
|
- //退款金额
|
|
|
+ // 退款金额
|
|
|
dateList.forEach(d -> {
|
|
|
- //每日数据填充
|
|
|
+ // 每日数据填充
|
|
|
DeviceDataDto.Vo deviceData = dataDayMap.get(d);
|
|
|
if (deviceData == null) {
|
|
|
data.add(String.valueOf(BigDecimal.ZERO));
|
|
@@ -1683,9 +1683,9 @@ public class DeviceInfoServiceImpl extends ServiceImpl<DeviceInfoMapper, DeviceI
|
|
|
|
|
|
});
|
|
|
} else if (i == 3) {
|
|
|
- //退款数
|
|
|
+ // 退款数
|
|
|
dateList.forEach(d -> {
|
|
|
- //每日数据填充
|
|
|
+ // 每日数据填充
|
|
|
DeviceDataDto.Vo deviceData = dataDayMap.get(d);
|
|
|
if (deviceData == null) {
|
|
|
data.add("0");
|
|
@@ -1719,7 +1719,7 @@ public class DeviceInfoServiceImpl extends ServiceImpl<DeviceInfoMapper, DeviceI
|
|
|
}
|
|
|
String startTime = choosDate + " 00:00:00";
|
|
|
String endTime = choosDate + " 23:59:59";
|
|
|
- //查询选定日期的温度数据
|
|
|
+ // 查询选定日期的温度数据
|
|
|
List<DeviceTempRecords> deviceTempRecords = deviceTempRecordsService.list(Wrappers.<DeviceTempRecords>lambdaQuery()
|
|
|
.eq(DeviceTempRecords::getDeviceId, deviceId).between(DeviceTempRecords::getCreateTime, startTime, endTime)
|
|
|
.orderBy(true, true, DeviceTempRecords::getCreateTime));
|
|
@@ -1766,7 +1766,7 @@ public class DeviceInfoServiceImpl extends ServiceImpl<DeviceInfoMapper, DeviceI
|
|
|
}
|
|
|
String startTime = choosDate + " 00:00:00";
|
|
|
String endTime = choosDate + " 23:59:59";
|
|
|
- //查询选定日期的温度数据
|
|
|
+ // 查询选定日期的温度数据
|
|
|
List<DeviceNetRecord> deviceNetRecords = deviceNetRecordService.list(Wrappers.<DeviceNetRecord>lambdaQuery()
|
|
|
.eq(DeviceNetRecord::getDeviceId, deviceId).between(DeviceNetRecord::getCreateTime, startTime, endTime)
|
|
|
.orderBy(true, true, DeviceNetRecord::getCreateTime));
|
|
@@ -1809,8 +1809,8 @@ public class DeviceInfoServiceImpl extends ServiceImpl<DeviceInfoMapper, DeviceI
|
|
|
Long deviceId = dto.getDeviceId();
|
|
|
DeviceInfoDto.DeviceDataCountVO vo = new DeviceInfoDto.DeviceDataCountVO();
|
|
|
DeviceInfoDto.GoodsData goodsData = new DeviceInfoDto.GoodsData();
|
|
|
- //在售商品种类
|
|
|
- //根据设备ID查商品id
|
|
|
+ // 在售商品种类
|
|
|
+ // 根据设备ID查商品id
|
|
|
GoodsDeviceDto.SelectList selectList = new GoodsDeviceDto.SelectList();
|
|
|
selectList.setDeviceIds(CollUtil.newArrayList(deviceId));
|
|
|
selectList.setMercId(dto.getMercId());
|