|
|
|
@ -1,11 +1,13 @@
|
|
|
|
|
package com.xydl.cac.service.impl;
|
|
|
|
|
|
|
|
|
|
import com.xydl.cac.entity.*;
|
|
|
|
|
import com.xydl.cac.entity.constants.Constants;
|
|
|
|
|
import com.xydl.cac.exception.BusinessException;
|
|
|
|
|
import com.xydl.cac.model.ConditionModel;
|
|
|
|
|
import com.xydl.cac.model.OnePage;
|
|
|
|
|
import com.xydl.cac.model.SensorDetail;
|
|
|
|
|
import com.xydl.cac.model.SensorUpdateModel;
|
|
|
|
|
import com.xydl.cac.repository.ModevRepository;
|
|
|
|
|
import com.xydl.cac.repository.NSensorRepository;
|
|
|
|
|
import com.xydl.cac.service.*;
|
|
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
|
@ -34,6 +36,8 @@ public class NSensorServiceImpl implements NSensorService {
|
|
|
|
|
ModevTypeService modevTypeService;
|
|
|
|
|
@Resource
|
|
|
|
|
ModevTypePointService modevTypePointService;
|
|
|
|
|
@Resource
|
|
|
|
|
ModevRepository modevRepository;
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public List<NSensor> listAll(Integer zsbid) throws Exception {
|
|
|
|
@ -88,6 +92,7 @@ public class NSensorServiceImpl implements NSensorService {
|
|
|
|
|
@Override
|
|
|
|
|
public NSensor add(NSensor item) throws Exception {
|
|
|
|
|
item.setId(null);
|
|
|
|
|
item.setStatus(Constants.NORMAL);
|
|
|
|
|
return repository.save(item);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -185,4 +190,22 @@ public class NSensorServiceImpl implements NSensorService {
|
|
|
|
|
repository.save(item);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public String importFromModev() throws Exception {
|
|
|
|
|
int success = 0;
|
|
|
|
|
int skip = 0;
|
|
|
|
|
List<Modev> list = modevRepository.findAll();
|
|
|
|
|
for (Modev item : list) {
|
|
|
|
|
NSensor sensor = item.transform();
|
|
|
|
|
List<NSensor> slist = repository.findByDevId(sensor.getDevId());
|
|
|
|
|
if (CollectionUtils.isEmpty(list)) {
|
|
|
|
|
this.add(sensor);
|
|
|
|
|
success++;
|
|
|
|
|
} else {
|
|
|
|
|
skip++;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return "成功导入" + success + "个,跳过" + skip + "个";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|