liyg 2 jaren geleden
bovenliggende
commit
38d4af14df

+ 1 - 1
src/main/java/com/steerinfo/dil/service/IShipDynamicsService.java

@@ -24,5 +24,5 @@ public interface IShipDynamicsService {
 
     int updateControlLine(TmsshipControlLine result);
 
-    List<List<Map<String,Object>>> getControlLinesTable(Map<String, Object> map);
+    List<Map<String,Object>> getControlLinesTable(Map<String, Object> map);
 }

+ 65 - 9
src/main/java/com/steerinfo/dil/service/impl/ShipDynamicsServiceImpl.java

@@ -34,9 +34,33 @@ public class ShipDynamicsServiceImpl implements IShipDynamicsService {
 
     @Override
     public List<Map<String, Object>> getLoadData(Map<String,Object> map){
-        String startTime=map.get("startTime")+"";
-        String endTime=map.get("endTime")+"";
-        DataChange.queryDataByDateTime(startTime, endTime, map, sdfDateTime);//根据时间段查询数据
+        String startTime;
+        String endTime;
+        if(map.get("startTime")!=null&&map.get("endTime")!=null){
+            startTime=map.get("startTime")+"";
+            endTime=map.get("endTime")+"";
+            DataChange.queryDataByDateTime(startTime, endTime, map, sdfDateTime);//根据时间段查询数据
+        }else{
+            Date endDate=new Date();
+            endDate.setHours(8);
+            endDate.setMinutes(0);
+            endDate.setSeconds(0);
+            Calendar calendar=Calendar.getInstance();
+            calendar.setTime(endDate);
+            calendar.add(Calendar.DATE, -1);
+            Date startDate=calendar.getTime();
+            startDate.setHours(8);
+            startDate.setMinutes(0);
+            startDate.setSeconds(0);
+            startTime = startDate.getTime()+"";
+            endTime = endDate.getTime()+"";
+            String time="" +(startDate.getMonth()+1)+"月"+startDate.getDate()+"日"+startDate.getHours()+"时至"
+            +"" +(endDate.getMonth()+1)+"月"+endDate.getDate()+"日"+endDate.getHours()+"时";
+            DataChange.queryDataByDateTime(startTime, endTime, map, sdfDateTime);//根据时间段查询数据
+            List<Map<String, Object>> list = shipDynamicsMapper.getLoadData(map);
+            list.get(0).put("time",time);
+            return list;
+        }
         return shipDynamicsMapper.getLoadData(map);
     }
 
@@ -154,10 +178,10 @@ public class ShipDynamicsServiceImpl implements IShipDynamicsService {
     }
 
     @Override
-    public List<List<Map<String, Object>>> getControlLinesTable(Map<String, Object> map) {
+    public List<Map<String, Object>> getControlLinesTable(Map<String, Object> map) {
         int year=Integer.parseInt(map.get("year").toString());
         int month=Integer.parseInt(map.get("month").toString());
-        List<List<Map<String, Object>>> result=new ArrayList<>();
+        List<Map<String, Object>> result=new ArrayList<>();
         map.put("time",previousMonth(year,month,0));//当月
         List<Map<String,Object>> list1 = tmsshipControlLineMapper.getControlLines(map);
         map.put("time",previousMonth(year,month,1));//上一个月
@@ -166,10 +190,42 @@ public class ShipDynamicsServiceImpl implements IShipDynamicsService {
         List<Map<String,Object>> list3 = tmsshipControlLineMapper.getControlLines(map);
         map.put("time",previousMonth(year,month,3));//上上上月
         List<Map<String,Object>> list4 = tmsshipControlLineMapper.getControlLines(map);
-        result.add(list4);
-        result.add(list3);
-        result.add(list2);
-        result.add(list1);
+        for(int i=0;i<31;i++){
+            Map<String,Object> temp=new HashMap<>();
+            try{
+                temp.put("lineDate1",list1.get(i).get("lineDate"));
+                temp.put("up1",list1.get(i).get("up"));
+                temp.put("down1",list1.get(i).get("down"));
+                temp.put("count1",list1.get(i).get("count"));
+            }catch (Exception e){
+
+            }
+            try{
+                temp.put("lineDate2",list2.get(i).get("lineDate"));
+                temp.put("up2",list2.get(i).get("up"));
+                temp.put("down2",list2.get(i).get("down"));
+                temp.put("count2",list2.get(i).get("count"));
+            }catch (Exception e){
+
+            }
+            try{
+                temp.put("lineDate3",list3.get(i).get("lineDate"));
+                temp.put("up3",list3.get(i).get("up"));
+                temp.put("down3",list3.get(i).get("down"));
+                temp.put("count3",list3.get(i).get("count"));
+            }catch (Exception e){
+
+            }
+            try{
+                temp.put("lineDate4",list4.get(i).get("lineDate"));
+                temp.put("up4",list4.get(i).get("up"));
+                temp.put("down4",list4.get(i).get("down"));
+                temp.put("count4",list4.get(i).get("count"));
+            }catch (Exception e){
+
+            }
+            result.add(temp);
+        }
         return result;
     }