ProphaseWeatherDataServiceImpl.java 1.3 KB

123456789101112131415161718192021222324252627282930313233343536
  1. package com.jiayue.biz.service.impl;
  2. import cn.hutool.db.Entity;
  3. import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
  4. import com.jiayue.biz.domain.ProphaseWeatherData;
  5. import com.jiayue.biz.mapper.ProphaseWeatherDataMapper;
  6. import com.jiayue.biz.service.ProphaseWeatherDataService;
  7. import lombok.AllArgsConstructor;
  8. import org.springframework.stereotype.Service;
  9. import java.sql.Timestamp;
  10. import java.util.Date;
  11. import java.util.HashMap;
  12. import java.util.List;
  13. import java.util.Map;
  14. @Service
  15. @AllArgsConstructor
  16. public class ProphaseWeatherDataServiceImpl extends ServiceImpl<ProphaseWeatherDataMapper, ProphaseWeatherData> implements ProphaseWeatherDataService {
  17. //获取测风塔起止时间
  18. public Map<String, Long> getDataTimeStartAndEnd(String equipmentNo) {
  19. HashMap<String, Long> hashMap = new HashMap<>();
  20. List<Entity> lastData = baseMapper.getLastData(equipmentNo);
  21. List<Entity> firstData = baseMapper.getFirstData(equipmentNo);
  22. if(!lastData.isEmpty() && !firstData.isEmpty()){
  23. Timestamp timeEnd = (Timestamp) lastData.get(0).get("last (ts)");
  24. Timestamp timeStart = (Timestamp) firstData.get(0).get("first (ts)");
  25. hashMap.put("startTime",timeStart.getTime());
  26. hashMap.put("endTime",timeEnd.getTime());
  27. }
  28. return hashMap;
  29. }
  30. }