|
@@ -100,15 +100,17 @@ public class DeviceService {
|
|
|
if (Objects.isNull(device)) {
|
|
if (Objects.isNull(device)) {
|
|
|
throw new SystemException(HttpStatus.QUERY_FAIL_CODE, HttpStatus.DEVICE_NOT_EXISTS);
|
|
throw new SystemException(HttpStatus.QUERY_FAIL_CODE, HttpStatus.DEVICE_NOT_EXISTS);
|
|
|
}
|
|
}
|
|
|
|
|
+ HeaderData headerData = commonService.getHeaderData(response);
|
|
|
//List<Long> list = StringUtils.splitStrToList(ids, Long.class);
|
|
//List<Long> list = StringUtils.splitStrToList(ids, Long.class);
|
|
|
int update = deviceMapper.update(null, new LambdaUpdateWrapper<KwsDevice>()
|
|
int update = deviceMapper.update(null, new LambdaUpdateWrapper<KwsDevice>()
|
|
|
.in(KwsDevice::getId, ids)
|
|
.in(KwsDevice::getId, ids)
|
|
|
|
|
+ .eq(KwsDevice::getMountainId, headerData.getMountainId())
|
|
|
.set(KwsDevice::getDelFlag, NumberConstant.ONE));
|
|
.set(KwsDevice::getDelFlag, NumberConstant.ONE));
|
|
|
if (update < 1) {
|
|
if (update < 1) {
|
|
|
throw new BusinessException("删除设备异常");
|
|
throw new BusinessException("删除设备异常");
|
|
|
}
|
|
}
|
|
|
//获取新增设备的型号
|
|
//获取新增设备的型号
|
|
|
- HeaderData headerData = commonService.getHeaderData(response);
|
|
|
|
|
|
|
+
|
|
|
KwsDeviceModel model = deviceModelMapper.selectOne(new LambdaQueryWrapper<KwsDeviceModel>()
|
|
KwsDeviceModel model = deviceModelMapper.selectOne(new LambdaQueryWrapper<KwsDeviceModel>()
|
|
|
.eq(KwsDeviceModel::getId, device.getModelId()));
|
|
.eq(KwsDeviceModel::getId, device.getModelId()));
|
|
|
Map<String, Object> logMap = new HashMap<>(NumberConstant.SIXTEEN);
|
|
Map<String, Object> logMap = new HashMap<>(NumberConstant.SIXTEEN);
|
|
@@ -134,7 +136,7 @@ public class DeviceService {
|
|
|
public PageRes select(DeviceQuery deviceQuery, HttpServletRequest response) {
|
|
public PageRes select(DeviceQuery deviceQuery, HttpServletRequest response) {
|
|
|
PageHelper.startPage(deviceQuery.getPage(), deviceQuery.getPageSize());
|
|
PageHelper.startPage(deviceQuery.getPage(), deviceQuery.getPageSize());
|
|
|
HeaderData headerData = commonService.getHeaderData(response);
|
|
HeaderData headerData = commonService.getHeaderData(response);
|
|
|
- deviceQuery.setMountainId(headerData.getCompanyId());
|
|
|
|
|
|
|
+ deviceQuery.setMountainId(headerData.getMountainId());
|
|
|
List<DeviceVo> list = deviceMapper.selectByDeviceParam(deviceQuery);
|
|
List<DeviceVo> list = deviceMapper.selectByDeviceParam(deviceQuery);
|
|
|
PageInfo<DeviceVo> pageInfo = new PageInfo<>(list);
|
|
PageInfo<DeviceVo> pageInfo = new PageInfo<>(list);
|
|
|
if (CollectionUtils.isEmpty(list)) {
|
|
if (CollectionUtils.isEmpty(list)) {
|
|
@@ -208,13 +210,15 @@ public class DeviceService {
|
|
|
LocalDateTime now = LocalDateTime.now();
|
|
LocalDateTime now = LocalDateTime.now();
|
|
|
long id = new IdWorker(NumberConstant.ONE).nextId();
|
|
long id = new IdWorker(NumberConstant.ONE).nextId();
|
|
|
device.setId(id);
|
|
device.setId(id);
|
|
|
|
|
+ String newStr = deviceAdd.getSnCodeFullname().replace("-", "").toLowerCase();
|
|
|
|
|
+ device.setSnCode(newStr);
|
|
|
device.setCreateBy(Long.parseLong(headerData.getCreateBy()));
|
|
device.setCreateBy(Long.parseLong(headerData.getCreateBy()));
|
|
|
device.setCreateTime(now);
|
|
device.setCreateTime(now);
|
|
|
device.setStatus(DeviceEnum.IDENTIFYING.getCode());
|
|
device.setStatus(DeviceEnum.IDENTIFYING.getCode());
|
|
|
device.setOnline(NumberConstant.ZERO);
|
|
device.setOnline(NumberConstant.ZERO);
|
|
|
device.setUpdateBy(Long.parseLong(headerData.getUpdateBy()));
|
|
device.setUpdateBy(Long.parseLong(headerData.getUpdateBy()));
|
|
|
device.setUpdateTime(now);
|
|
device.setUpdateTime(now);
|
|
|
- device.setMountainId(headerData.getCompanyId());
|
|
|
|
|
|
|
+ device.setMountainId(headerData.getMountainId());
|
|
|
deviceMapper.insert(device);
|
|
deviceMapper.insert(device);
|
|
|
//新增到数据表kws_device_Integration
|
|
//新增到数据表kws_device_Integration
|
|
|
KwsDeviceIntegration deIntergration = new KwsDeviceIntegration();
|
|
KwsDeviceIntegration deIntergration = new KwsDeviceIntegration();
|
|
@@ -224,7 +228,7 @@ public class DeviceService {
|
|
|
long interId = new IdWorker(NumberConstant.ONE).nextId();
|
|
long interId = new IdWorker(NumberConstant.ONE).nextId();
|
|
|
deIntergration.setId(interId);
|
|
deIntergration.setId(interId);
|
|
|
deIntergration.setDeviceId(id);
|
|
deIntergration.setDeviceId(id);
|
|
|
- deIntergration.setMountainId(headerData.getCompanyId());
|
|
|
|
|
|
|
+ deIntergration.setMountainId(headerData.getMountainId());
|
|
|
deIntergration.setIntegrationId(Long.parseLong(temp[i]));
|
|
deIntergration.setIntegrationId(Long.parseLong(temp[i]));
|
|
|
deIntergration.setCreateBy(Long.parseLong(headerData.getCreateBy()));
|
|
deIntergration.setCreateBy(Long.parseLong(headerData.getCreateBy()));
|
|
|
deIntergration.setCreateTime(now);
|
|
deIntergration.setCreateTime(now);
|