|
@@ -57,6 +57,34 @@ public class DeviceServiceImpl implements IDeviceService {
|
|
|
@Autowired
|
|
|
private EartagHeartbeatRepo heartbeatRepo;
|
|
|
|
|
|
+
|
|
|
+ /**
|
|
|
+ * @Method : listEartagOnlineAllStatus
|
|
|
+ * @Description :
|
|
|
+ * @Params : [farmId, days]
|
|
|
+ * @Return : com.huimv.eartag2.common.utils.Result
|
|
|
+ *
|
|
|
+ * @Author : ZhuoNing
|
|
|
+ * @Date : 2022/3/10
|
|
|
+ * @Time : 20:52
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ public Result listEartagOnlineAllStatus(String farmId, Integer days) throws ParseException {
|
|
|
+ DateUtil dateUtil = new DateUtil();
|
|
|
+ String pastDate = dateUtil.getPastDate(days);
|
|
|
+ String todayDate = dateUtil.getTodayDateText();
|
|
|
+ List<EartarFarmAllStatusEntity> FarmAllStatusEntityList = farmAllStatusRepo.getOneByFarmIdAndCreateDateAndPastDate(farmId, pastDate, todayDate);
|
|
|
+ JSONArray dataJa = new JSONArray();
|
|
|
+ for (EartarFarmAllStatusEntity farmAllStatusEntity : FarmAllStatusEntityList) {
|
|
|
+ JSONObject newJo = new JSONObject();
|
|
|
+ dataJa.add(newJo);
|
|
|
+ newJo.put("time", dateUtil.formatDateText(farmAllStatusEntity.getCreateDate()));
|
|
|
+ newJo.put("value", farmAllStatusEntity.getEartagOnline());
|
|
|
+ newJo.put("total", farmAllStatusEntity.getEartagTotal());
|
|
|
+ }
|
|
|
+ return new Result(ResultCode.SUCCESS, dataJa.toJSONString());
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* @Method : listDeviceEnvtempByDeviceCode
|
|
|
* @Description :
|