123456789101112131415161718192021222324252627282930313233343536 |
- package com.jiayue.biz.service.impl;
- import cn.hutool.db.Entity;
- import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
- import com.jiayue.biz.domain.ProphaseWeatherData;
- import com.jiayue.biz.mapper.ProphaseWeatherDataMapper;
- import com.jiayue.biz.service.ProphaseWeatherDataService;
- import lombok.AllArgsConstructor;
- import org.springframework.stereotype.Service;
- import java.sql.Timestamp;
- import java.util.Date;
- import java.util.HashMap;
- import java.util.List;
- import java.util.Map;
- @Service
- @AllArgsConstructor
- public class ProphaseWeatherDataServiceImpl extends ServiceImpl<ProphaseWeatherDataMapper, ProphaseWeatherData> implements ProphaseWeatherDataService {
- //获取测风塔起止时间
- public Map<String, Long> getDataTimeStartAndEnd(String equipmentNo) {
- HashMap<String, Long> hashMap = new HashMap<>();
- List<Entity> lastData = baseMapper.getLastData(equipmentNo);
- List<Entity> firstData = baseMapper.getFirstData(equipmentNo);
- if(!lastData.isEmpty() && !firstData.isEmpty()){
- Timestamp timeEnd = (Timestamp) lastData.get(0).get("last (ts)");
- Timestamp timeStart = (Timestamp) firstData.get(0).get("first (ts)");
- hashMap.put("startTime",timeStart.getTime());
- hashMap.put("endTime",timeEnd.getTime());
- }
- return hashMap;
- }
- }
|