|
|
@ -18,6 +18,7 @@ import springfox.documentation.spring.web.json.Json; |
|
|
|
|
|
|
|
import javax.annotation.Resource; |
|
|
|
import java.io.IOException; |
|
|
|
import java.math.BigDecimal; |
|
|
|
import java.security.KeyManagementException; |
|
|
|
import java.security.KeyStoreException; |
|
|
|
import java.security.NoSuchAlgorithmException; |
|
|
@ -74,6 +75,29 @@ public class YDeviceService extends ServiceImpl<YDeviceMapper, Device> { |
|
|
|
return athleteBOIPage; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public List<Device> getStatusList() { |
|
|
|
QueryWrapper<Device> queryWrapper = new QueryWrapper<>(); |
|
|
|
|
|
|
|
queryWrapper.select("maintenance", "count(maintenance) as maintenanceCount"); //1 摄像头
|
|
|
|
queryWrapper.groupBy("maintenance"); |
|
|
|
|
|
|
|
List<Device> athleteBOIPage = null; |
|
|
|
try { |
|
|
|
athleteBOIPage = this.list(queryWrapper); |
|
|
|
} catch (Exception e) { |
|
|
|
System.out.println(e); |
|
|
|
athleteBOIPage = null; |
|
|
|
} |
|
|
|
int allCount = this.count(); |
|
|
|
for (Device device : athleteBOIPage) { |
|
|
|
BigDecimal tempCount = new BigDecimal(device.getMaintenance()).divide(new BigDecimal(allCount), 2, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100")).setScale(0, BigDecimal.ROUND_HALF_UP); |
|
|
|
String temp = tempCount.toString(); |
|
|
|
device.setMaintenanceCount(temp); |
|
|
|
} |
|
|
|
return athleteBOIPage; |
|
|
|
} |
|
|
|
|
|
|
|
public IPage<Device> getDeviceStatusPage(Map<String, String> searchVo, PageVo pageVo) { |
|
|
|
String url = "https://api2.hik-cloud.com/api/v1/open/basic/devices/list?groupNo=A1181&pageNo=" + pageVo.getCurrent() + "&pageSize=" + pageVo.getSize(); |
|
|
|
String result = ""; |
|
|
@ -112,7 +136,7 @@ public class YDeviceService extends ServiceImpl<YDeviceMapper, Device> { |
|
|
|
|
|
|
|
public ResultBean createDevice(Device device) { |
|
|
|
ResultBean rb = ResultBean.fireSuccess(); |
|
|
|
if("1".equals(device.getType())){ //摄像头
|
|
|
|
if ("1".equals(device.getType())) { //摄像头
|
|
|
|
Device nvrDevice = this.getById(device.getNvrId()); |
|
|
|
device.setNvrCode(nvrDevice.getVCode()); |
|
|
|
device.setNvrSerial(nvrDevice.getSerialNumber()); |
|
|
|