|
@@ -343,6 +343,18 @@ public class BasePigpenServiceImpl extends ServiceImpl<BasePigpenMapper, BasePig
|
|
jsonObject.put("value", envDeviceRecentlyData.get(i).getChipValue());
|
|
jsonObject.put("value", envDeviceRecentlyData.get(i).getChipValue());
|
|
jsonObject.put("unit", "RH");
|
|
jsonObject.put("unit", "RH");
|
|
jsonArray3.add(jsonObject);
|
|
jsonArray3.add(jsonObject);
|
|
|
|
+ } else if (i < 15) {
|
|
|
|
+ JSONObject jsonObject = new JSONObject();
|
|
|
|
+ jsonObject.put("name", envDeviceRecentlyData.get(i).getChipName());
|
|
|
|
+ jsonObject.put("value", envDeviceRecentlyData.get(i).getChipValue());
|
|
|
|
+ jsonObject.put("unit", "ppm");
|
|
|
|
+ jsonArray3.add(jsonObject);
|
|
|
|
+ } else if (i < 16) {
|
|
|
|
+ JSONObject jsonObject = new JSONObject();
|
|
|
|
+ jsonObject.put("name", envDeviceRecentlyData.get(i).getChipName());
|
|
|
|
+ jsonObject.put("value", envDeviceRecentlyData.get(i).getChipValue());
|
|
|
|
+ jsonObject.put("unit", "pa");
|
|
|
|
+ jsonArray3.add(jsonObject);
|
|
} else {
|
|
} else {
|
|
JSONObject jsonObject = new JSONObject();
|
|
JSONObject jsonObject = new JSONObject();
|
|
jsonObject.put("name", envDeviceRecentlyData.get(i).getChipName());
|
|
jsonObject.put("name", envDeviceRecentlyData.get(i).getChipName());
|
|
@@ -358,17 +370,17 @@ public class BasePigpenServiceImpl extends ServiceImpl<BasePigpenMapper, BasePig
|
|
unitDetailVo.setAvgTemp(envDeviceRecentlyData.get(10).getChipValue());
|
|
unitDetailVo.setAvgTemp(envDeviceRecentlyData.get(10).getChipValue());
|
|
unitDetailVo.setTargetTemp(envDeviceRecentlyData.get(9).getChipValue());
|
|
unitDetailVo.setTargetTemp(envDeviceRecentlyData.get(9).getChipValue());
|
|
unitDetailVo.setOutsideTemp(envDeviceRecentlyData.get(8).getChipValue());
|
|
unitDetailVo.setOutsideTemp(envDeviceRecentlyData.get(8).getChipValue());
|
|
- List<BigDecimal> pressureList =new ArrayList<>();
|
|
|
|
- BigDecimal hum1 =BigDecimal.ZERO;
|
|
|
|
- if (!ObjectUtil.isNull(envDeviceRecentlyData.get(11).getChipValue())){
|
|
|
|
|
|
+ List<BigDecimal> pressureList = new ArrayList<>();
|
|
|
|
+ BigDecimal hum1 = BigDecimal.ZERO;
|
|
|
|
+ if (!ObjectUtil.isNull(envDeviceRecentlyData.get(11).getChipValue())) {
|
|
hum1 = new BigDecimal(envDeviceRecentlyData.get(11).getChipValue());
|
|
hum1 = new BigDecimal(envDeviceRecentlyData.get(11).getChipValue());
|
|
}
|
|
}
|
|
- BigDecimal hum2 =BigDecimal.ZERO;
|
|
|
|
- if (!ObjectUtil.isNull(envDeviceRecentlyData.get(12).getChipValue())){
|
|
|
|
- hum2 = new BigDecimal(envDeviceRecentlyData.get(12).getChipValue());
|
|
|
|
|
|
+ BigDecimal hum2 = BigDecimal.ZERO;
|
|
|
|
+ if (!ObjectUtil.isNull(envDeviceRecentlyData.get(12).getChipValue())) {
|
|
|
|
+ hum2 = new BigDecimal(envDeviceRecentlyData.get(12).getChipValue());
|
|
}
|
|
}
|
|
- BigDecimal hum3 =BigDecimal.ZERO;
|
|
|
|
- if (!ObjectUtil.isNull(envDeviceRecentlyData.get(13).getChipValue())){
|
|
|
|
|
|
+ BigDecimal hum3 = BigDecimal.ZERO;
|
|
|
|
+ if (!ObjectUtil.isNull(envDeviceRecentlyData.get(13).getChipValue())) {
|
|
hum3 = new BigDecimal(envDeviceRecentlyData.get(13).getChipValue());
|
|
hum3 = new BigDecimal(envDeviceRecentlyData.get(13).getChipValue());
|
|
}
|
|
}
|
|
pressureList.add(hum1);
|
|
pressureList.add(hum1);
|
|
@@ -379,7 +391,7 @@ public class BasePigpenServiceImpl extends ServiceImpl<BasePigpenMapper, BasePig
|
|
unitDetailVo.setAvgHum(totalHum.divide(new BigDecimal(pressureList.size()), 1, BigDecimal.ROUND_HALF_UP).toString());
|
|
unitDetailVo.setAvgHum(totalHum.divide(new BigDecimal(pressureList.size()), 1, BigDecimal.ROUND_HALF_UP).toString());
|
|
unitDetailVo.setPressure(envDeviceRecentlyData.get(15).getChipValue());
|
|
unitDetailVo.setPressure(envDeviceRecentlyData.get(15).getChipValue());
|
|
unitDetailVo.setVentilate(envDeviceRecentlyData.get(18).getChipValue());
|
|
unitDetailVo.setVentilate(envDeviceRecentlyData.get(18).getChipValue());
|
|
- BigDecimal dayWater = envWaterMapper.getWater(new QueryWrapper<EnvWater>().ge("update_time", timesmorning).eq("farm_id", farmId).eq("unit_id",unitId));
|
|
|
|
|
|
+ BigDecimal dayWater = envWaterMapper.getWater(new QueryWrapper<EnvWater>().ge("update_time", timesmorning).eq("farm_id", farmId).eq("unit_id", unitId));
|
|
if (ObjectUtil.isNull(dayWater)) {
|
|
if (ObjectUtil.isNull(dayWater)) {
|
|
dayWater = BigDecimal.ZERO;
|
|
dayWater = BigDecimal.ZERO;
|
|
}
|
|
}
|
|
@@ -387,7 +399,7 @@ public class BasePigpenServiceImpl extends ServiceImpl<BasePigpenMapper, BasePig
|
|
BigDecimal dayElectricity = envElectricityMapper.getElectricity(new QueryWrapper<EnvElectricity>()
|
|
BigDecimal dayElectricity = envElectricityMapper.getElectricity(new QueryWrapper<EnvElectricity>()
|
|
.ge("update_time", timesmorning)
|
|
.ge("update_time", timesmorning)
|
|
.eq("farm_id", farmId)
|
|
.eq("farm_id", farmId)
|
|
- .eq("unit_id",unitId));
|
|
|
|
|
|
+ .eq("unit_id", unitId));
|
|
if (ObjectUtil.isNull(dayElectricity)) {
|
|
if (ObjectUtil.isNull(dayElectricity)) {
|
|
dayElectricity = BigDecimal.ZERO;
|
|
dayElectricity = BigDecimal.ZERO;
|
|
}
|
|
}
|
|
@@ -395,15 +407,15 @@ public class BasePigpenServiceImpl extends ServiceImpl<BasePigpenMapper, BasePig
|
|
BigDecimal dayFeed = envFeedMapper.getFeed(new QueryWrapper<EnvFeed>()
|
|
BigDecimal dayFeed = envFeedMapper.getFeed(new QueryWrapper<EnvFeed>()
|
|
.ge("update_time", timesmorning)
|
|
.ge("update_time", timesmorning)
|
|
.eq("farm_id", farmId)
|
|
.eq("farm_id", farmId)
|
|
- .eq("unit_id",unitId));
|
|
|
|
|
|
+ .eq("unit_id", unitId));
|
|
if (ObjectUtil.isNull(dayFeed)) {
|
|
if (ObjectUtil.isNull(dayFeed)) {
|
|
dayFeed = BigDecimal.ZERO;
|
|
dayFeed = BigDecimal.ZERO;
|
|
}
|
|
}
|
|
unitDetailVo.setFeed(dayFeed.toString());
|
|
unitDetailVo.setFeed(dayFeed.toString());
|
|
Integer on = envDeviceMapper.selectCount(new QueryWrapper<EnvDevice>().eq("farm_id", farmId).eq("unit_id", unitId).eq("device_status", 1));
|
|
Integer on = envDeviceMapper.selectCount(new QueryWrapper<EnvDevice>().eq("farm_id", farmId).eq("unit_id", unitId).eq("device_status", 1));
|
|
Integer total = envDeviceMapper.selectCount(new QueryWrapper<EnvDevice>().eq("farm_id", farmId).eq("unit_id", unitId));
|
|
Integer total = envDeviceMapper.selectCount(new QueryWrapper<EnvDevice>().eq("farm_id", farmId).eq("unit_id", unitId));
|
|
- unitDetailVo.setDeviceStatus(on.toString()+"/"+total.toString());
|
|
|
|
- map.put("unitDetail",unitDetailVo);
|
|
|
|
|
|
+ unitDetailVo.setDeviceStatus(on.toString() + "/" + total.toString());
|
|
|
|
+ map.put("unitDetail", unitDetailVo);
|
|
return new Result(ResultCode.SUCCESS, map);
|
|
return new Result(ResultCode.SUCCESS, map);
|
|
}
|
|
}
|
|
|
|
|
|
@@ -468,18 +480,18 @@ public class BasePigpenServiceImpl extends ServiceImpl<BasePigpenMapper, BasePig
|
|
Date timesmorning = DataUill.getTimesmorning();
|
|
Date timesmorning = DataUill.getTimesmorning();
|
|
if ("1".equals(dataType)) {
|
|
if ("1".equals(dataType)) {
|
|
QueryWrapper<EnvDevice> deviceQueryWrapper = new QueryWrapper<>();
|
|
QueryWrapper<EnvDevice> deviceQueryWrapper = new QueryWrapper<>();
|
|
- deviceQueryWrapper.eq("unit_id",unitId).eq("farm_id",farmId);
|
|
|
|
|
|
+ deviceQueryWrapper.eq("unit_id", unitId).eq("farm_id", farmId);
|
|
EnvDevice envDevice = envDeviceMapper.selectOne(deviceQueryWrapper);
|
|
EnvDevice envDevice = envDeviceMapper.selectOne(deviceQueryWrapper);
|
|
- if (ObjectUtil.isEmpty(envDevice)){
|
|
|
|
- return new Result(ResultCode.FAIL,"栋舍内无设备");
|
|
|
|
|
|
+ if (ObjectUtil.isEmpty(envDevice)) {
|
|
|
|
+ return new Result(ResultCode.FAIL, "栋舍内无设备");
|
|
}
|
|
}
|
|
List<String> deviceCodeList = new ArrayList<>();
|
|
List<String> deviceCodeList = new ArrayList<>();
|
|
for (int i = 1; i <= 8; i++) {
|
|
for (int i = 1; i <= 8; i++) {
|
|
- deviceCodeList.add(envDevice.getDeviceSortCode()+"140"+i);
|
|
|
|
|
|
+ deviceCodeList.add(envDevice.getDeviceSortCode() + "140" + i);
|
|
}
|
|
}
|
|
String deviceCodes = String.join(",", deviceCodeList);
|
|
String deviceCodes = String.join(",", deviceCodeList);
|
|
deviceCodes = "(" + deviceCodes + ")";
|
|
deviceCodes = "(" + deviceCodes + ")";
|
|
- List<EnvTempVo> envTempVoList = tempMapper.listTempDayDeatil(deviceCodeList,deviceCodes,timesmorning);
|
|
|
|
|
|
+ List<EnvTempVo> envTempVoList = tempMapper.listTempDayDeatil(deviceCodeList, deviceCodes, timesmorning);
|
|
map.put("value", envTempVoList);
|
|
map.put("value", envTempVoList);
|
|
map.put("name", "temp");
|
|
map.put("name", "temp");
|
|
|
|
|
|
@@ -531,18 +543,18 @@ public class BasePigpenServiceImpl extends ServiceImpl<BasePigpenMapper, BasePig
|
|
endTime = endTime + " 23:59:59";
|
|
endTime = endTime + " 23:59:59";
|
|
if ("1".equals(dataType)) {
|
|
if ("1".equals(dataType)) {
|
|
QueryWrapper<EnvDevice> deviceQueryWrapper = new QueryWrapper<>();
|
|
QueryWrapper<EnvDevice> deviceQueryWrapper = new QueryWrapper<>();
|
|
- deviceQueryWrapper.eq("unit_id",unitId).eq("farm_id",farmId);
|
|
|
|
|
|
+ deviceQueryWrapper.eq("unit_id", unitId).eq("farm_id", farmId);
|
|
EnvDevice envDevice = envDeviceMapper.selectOne(deviceQueryWrapper);
|
|
EnvDevice envDevice = envDeviceMapper.selectOne(deviceQueryWrapper);
|
|
- if (ObjectUtil.isEmpty(envDevice)){
|
|
|
|
- return new Result(ResultCode.FAIL,"栋舍内无设备");
|
|
|
|
|
|
+ if (ObjectUtil.isEmpty(envDevice)) {
|
|
|
|
+ return new Result(ResultCode.FAIL, "栋舍内无设备");
|
|
}
|
|
}
|
|
List<String> deviceCodeList = new ArrayList<>();
|
|
List<String> deviceCodeList = new ArrayList<>();
|
|
for (int i = 1; i <= 8; i++) {
|
|
for (int i = 1; i <= 8; i++) {
|
|
- deviceCodeList.add(envDevice.getDeviceSortCode()+"140"+i);
|
|
|
|
|
|
+ deviceCodeList.add(envDevice.getDeviceSortCode() + "140" + i);
|
|
}
|
|
}
|
|
String deviceCodes = String.join(",", deviceCodeList);
|
|
String deviceCodes = String.join(",", deviceCodeList);
|
|
deviceCodes = "(" + deviceCodes + ")";
|
|
deviceCodes = "(" + deviceCodes + ")";
|
|
- List<EnvTempVo> envTempVoList = tempMapper.listTempCustomDeatil(deviceCodeList,deviceCodes,startTime,endTime);
|
|
|
|
|
|
+ List<EnvTempVo> envTempVoList = tempMapper.listTempCustomDeatil(deviceCodeList, deviceCodes, startTime, endTime);
|
|
map.put("value", envTempVoList);
|
|
map.put("value", envTempVoList);
|
|
map.put("name", "temp");
|
|
map.put("name", "temp");
|
|
|
|
|
|
@@ -556,7 +568,7 @@ public class BasePigpenServiceImpl extends ServiceImpl<BasePigpenMapper, BasePig
|
|
// map.put("value", envHumis);
|
|
// map.put("value", envHumis);
|
|
// }
|
|
// }
|
|
if ("2".equals(dataType)) {
|
|
if ("2".equals(dataType)) {
|
|
- List<EnvHumi> envHumis = humiMapper.list(farmId,unitId,startTime,endTime);
|
|
|
|
|
|
+ List<EnvHumi> envHumis = humiMapper.list(farmId, unitId, startTime, endTime);
|
|
map.put("name", "humi");
|
|
map.put("name", "humi");
|
|
map.put("value", envHumis);
|
|
map.put("value", envHumis);
|
|
}
|
|
}
|
|
@@ -827,7 +839,7 @@ public class BasePigpenServiceImpl extends ServiceImpl<BasePigpenMapper, BasePig
|
|
unitDetailVo.setAvgTemp(envDeviceRecentlyData.get(10).getChipValue());
|
|
unitDetailVo.setAvgTemp(envDeviceRecentlyData.get(10).getChipValue());
|
|
unitDetailVo.setTargetTemp(envDeviceRecentlyData.get(9).getChipValue());
|
|
unitDetailVo.setTargetTemp(envDeviceRecentlyData.get(9).getChipValue());
|
|
unitDetailVo.setVentilate(envDeviceRecentlyData.get(18).getChipValue());
|
|
unitDetailVo.setVentilate(envDeviceRecentlyData.get(18).getChipValue());
|
|
- BigDecimal dayWater = envWaterMapper.getWater(new QueryWrapper<EnvWater>().ge("update_time", timesmorning).eq("farm_id", farmId).eq("unit_id",farm.getUnitId()));
|
|
|
|
|
|
+ BigDecimal dayWater = envWaterMapper.getWater(new QueryWrapper<EnvWater>().ge("update_time", timesmorning).eq("farm_id", farmId).eq("unit_id", farm.getUnitId()));
|
|
if (ObjectUtil.isNull(dayWater)) {
|
|
if (ObjectUtil.isNull(dayWater)) {
|
|
dayWater = BigDecimal.ZERO;
|
|
dayWater = BigDecimal.ZERO;
|
|
}
|
|
}
|
|
@@ -835,20 +847,20 @@ public class BasePigpenServiceImpl extends ServiceImpl<BasePigpenMapper, BasePig
|
|
BigDecimal dayElectricity = envElectricityMapper.getElectricity(new QueryWrapper<EnvElectricity>()
|
|
BigDecimal dayElectricity = envElectricityMapper.getElectricity(new QueryWrapper<EnvElectricity>()
|
|
.ge("update_time", timesmorning)
|
|
.ge("update_time", timesmorning)
|
|
.eq("farm_id", farmId)
|
|
.eq("farm_id", farmId)
|
|
- .eq("unit_id",farm.getUnitId()));
|
|
|
|
|
|
+ .eq("unit_id", farm.getUnitId()));
|
|
if (ObjectUtil.isNull(dayElectricity)) {
|
|
if (ObjectUtil.isNull(dayElectricity)) {
|
|
dayElectricity = BigDecimal.ZERO;
|
|
dayElectricity = BigDecimal.ZERO;
|
|
}
|
|
}
|
|
unitDetailVo.setElectricity(dayElectricity.toString());
|
|
unitDetailVo.setElectricity(dayElectricity.toString());
|
|
Integer on = fanMapper.selectCount(new QueryWrapper<EnvDeviceFan>().eq("farm_id", farmId).eq("device_code", deviceSortCode).eq("chip_status", 2));
|
|
Integer on = fanMapper.selectCount(new QueryWrapper<EnvDeviceFan>().eq("farm_id", farmId).eq("device_code", deviceSortCode).eq("chip_status", 2));
|
|
Integer total = fanMapper.selectCount(new QueryWrapper<EnvDeviceFan>().eq("farm_id", farmId).eq("device_code", deviceSortCode));
|
|
Integer total = fanMapper.selectCount(new QueryWrapper<EnvDeviceFan>().eq("farm_id", farmId).eq("device_code", deviceSortCode));
|
|
- unitDetailVo.setDeviceStatus(on.toString()+"/"+total.toString());
|
|
|
|
|
|
+ unitDetailVo.setDeviceStatus(on.toString() + "/" + total.toString());
|
|
unitDetailVo.setCurrentDayAge(farm.getDayAge());
|
|
unitDetailVo.setCurrentDayAge(farm.getDayAge());
|
|
- map.put("unitDetail",unitDetailVo);
|
|
|
|
- map.put("unitName",farm.getBuildLocation());
|
|
|
|
|
|
+ map.put("unitDetail", unitDetailVo);
|
|
|
|
+ map.put("unitName", farm.getBuildLocation());
|
|
resultList.add(map);
|
|
resultList.add(map);
|
|
}
|
|
}
|
|
- return new Result(ResultCode.SUCCESS,resultList);
|
|
|
|
|
|
+ return new Result(ResultCode.SUCCESS, resultList);
|
|
}
|
|
}
|
|
|
|
|
|
@Override
|
|
@Override
|