فهرست منبع

故障数据查询

全业务考评 1 سال پیش
والد
کامیت
e5a8a95a94

+ 1 - 1
power-fitting-JN/src/main/java/com.gyee.power.fitting/mapper/AlarmTsXmlMapper.java

@@ -16,6 +16,6 @@ import java.util.List;
 @Mapper
 public interface AlarmTsXmlMapper extends BaseMapper<AlarmTsXml> {
 
-    List<AlarmVo> findTagsByDeviceidInDate(@Param("superTableName") String superTableName, @Param("deviceid")  List<String> deviceid, @Param("date")List<String> date);
+    List<AlarmVo> findTagsByDeviceidInDate(@Param("superTableName") String superTableName, @Param("deviceid")  List<String> deviceid, @Param("date")List<Long> date);
 
 }

+ 18 - 2
power-fitting-JN/src/main/java/com.gyee.power.fitting/service/custom/curve/DataFittingService.java

@@ -21,6 +21,7 @@ import com.gyee.power.fitting.service.auth.TokenService;
 import lombok.extern.slf4j.Slf4j;
 import lombok.val;
 import org.apache.commons.lang3.StringUtils;
+import org.apache.velocity.util.ArrayListWrapper;
 import org.springframework.stereotype.Service;
 
 import javax.annotation.Resource;
@@ -28,6 +29,8 @@ import javax.servlet.http.HttpServletRequest;
 import java.math.BigDecimal;
 import java.math.RoundingMode;
 import java.text.DecimalFormat;
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
 import java.util.*;
 import java.util.concurrent.atomic.AtomicReference;
 import java.util.stream.Collectors;
@@ -383,13 +386,26 @@ public class DataFittingService {
                 .distinct()
                 .collect(Collectors.toList());
 
-
+        List<Long> times = new ArrayList<>();
         List<String> uniqueTimes = pointData.stream()
                 .map(PowerPointData::getTime)
                 .distinct()
                 .collect(Collectors.toList());
 
-        List<AlarmVo> list = alarmTsXmlMapper.findTagsByDeviceidInDate(table,uniqueWtIds, uniqueTimes);
+        SimpleDateFormat srtFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+
+        uniqueTimes.forEach(t->{
+            Date date = null;
+            try {
+                date = srtFormat.parse(t);
+            } catch (ParseException e) {
+                e.printStackTrace();
+            }
+            long time = date.getTime()/ 1000;
+            times.add(time);
+        });
+
+        List<AlarmVo> list = alarmTsXmlMapper.findTagsByDeviceidInDate(table,uniqueWtIds, times);
 
         return list;
     }