|
@@ -14,6 +14,7 @@ import com.xy.entity.SysDictRedis;
|
|
|
import com.xy.mapper.DeviceDataMapper;
|
|
|
import com.xy.utils.*;
|
|
|
import com.xy.utils.enums.DictEnum;
|
|
|
+import com.xy.utils.enums.DictSonEnum;
|
|
|
import io.swagger.annotations.Api;
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
|
import lombok.AllArgsConstructor;
|
|
@@ -126,4 +127,63 @@ public class DeviceDataServiceImpl extends ServiceImpl<DeviceDataMapper, DeviceD
|
|
|
}
|
|
|
|
|
|
|
|
|
+ /**
|
|
|
+ * 指定查询商户某设备某天数据
|
|
|
+ *
|
|
|
+ * @param deviceId
|
|
|
+ * @param mercId
|
|
|
+ * @param dateValue
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ public DeviceDataDto.Vo getByDay(Long deviceId, Long mercId, String dateValue) {
|
|
|
+ String type = SysDictUtils.getValue(DictEnum.DEVICE_DATA_TYPE.getKey(), DictSonEnum.DEVICE_DATA_TYPE_DAY.getKey(), String.class);
|
|
|
+ return getOneData(type, deviceId, mercId, dateValue);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 指定查询商户某设备某月数据
|
|
|
+ *
|
|
|
+ * @param deviceId
|
|
|
+ * @param mercId
|
|
|
+ * @param dateValue
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ public DeviceDataDto.Vo getByMonth(Long deviceId, Long mercId, String dateValue) {
|
|
|
+ String type = SysDictUtils.getValue(DictEnum.DEVICE_DATA_TYPE.getKey(), DictSonEnum.DEVICE_DATA_TYPE_MONTH.getKey(), String.class);
|
|
|
+ return getOneData(type, deviceId, mercId, dateValue);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 指定查询商户某设备某年数据
|
|
|
+ *
|
|
|
+ * @param deviceId
|
|
|
+ * @param mercId
|
|
|
+ * @param dateValue
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ public DeviceDataDto.Vo getByYear(Long deviceId, Long mercId, String dateValue) {
|
|
|
+ String type = SysDictUtils.getValue(DictEnum.DEVICE_DATA_TYPE.getKey(), DictSonEnum.DEVICE_DATA_TYPE_YEAR.getKey(), String.class);
|
|
|
+ return getOneData(type, deviceId, mercId, dateValue);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 指定查询商户某设备某年、月、日数据
|
|
|
+ *
|
|
|
+ * @param type
|
|
|
+ * @param deviceId
|
|
|
+ * @param mercId
|
|
|
+ * @param dateValue
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ public DeviceDataDto.Vo getOneData(String type, Long deviceId, Long mercId, String dateValue) {
|
|
|
+ LambdaQueryWrapper<DeviceData> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
|
|
+ lambdaQueryWrapper.eq(DeviceData::getType, type);
|
|
|
+ lambdaQueryWrapper.eq(DeviceData::getDeviceId, deviceId);
|
|
|
+ lambdaQueryWrapper.eq(DeviceData::getMercId, mercId);
|
|
|
+ lambdaQueryWrapper.eq(DeviceData::getDateValue, Integer.valueOf(dateValue));
|
|
|
+ DeviceData data = getOne(lambdaQueryWrapper);
|
|
|
+ return copy(DeviceDataDto.Vo.class, data);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
}
|