Commit 7bacfecd324c63728c9b7ae33fadb4b3ff549637

Authored by 潘钊
1 parent c03942f3

update

src/main/java/com/bsth/service/oil/impl/YlxxbServiceImpl.java
1 1 package com.bsth.service.oil.impl;
2 2  
3   -import java.sql.ResultSet;
4   -import java.sql.SQLException;
5   -import java.text.ParseException;
6   -import java.text.SimpleDateFormat;
7   -import java.util.ArrayList;
8   -import java.util.HashMap;
9   -import java.util.List;
10   -import java.util.Map;
11   -
12   -import javax.transaction.Transactional;
13   -
14   -import org.apache.commons.lang3.StringEscapeUtils;
15   -import org.slf4j.Logger;
16   -import org.slf4j.LoggerFactory;
17   -import org.springframework.beans.factory.annotation.Autowired;
18   -import org.springframework.jdbc.core.JdbcTemplate;
19   -import org.springframework.jdbc.core.RowMapper;
20   -import org.springframework.stereotype.Service;
21   -
22 3 import com.alibaba.fastjson.JSONArray;
23 4 import com.alibaba.fastjson.JSONObject;
24 5 import com.bsth.common.ResponseCode;
25   -import com.bsth.entity.excep.Offline;
26 6 import com.bsth.entity.oil.Ylb;
27 7 import com.bsth.entity.oil.Ylxxb;
28   -import com.bsth.entity.search.CustomerSpecs;
29 8 import com.bsth.repository.oil.YlbRepository;
30 9 import com.bsth.repository.oil.YlxxbRepository;
31 10 import com.bsth.service.impl.BaseServiceImpl;
32 11 import com.bsth.service.oil.YlxxbService;
33 12 import com.bsth.util.PageHelper;
34 13 import com.bsth.util.PageObject;
  14 +import org.apache.commons.lang3.StringEscapeUtils;
  15 +import org.slf4j.Logger;
  16 +import org.slf4j.LoggerFactory;
  17 +import org.springframework.beans.factory.annotation.Autowired;
  18 +import org.springframework.jdbc.core.JdbcTemplate;
  19 +import org.springframework.jdbc.core.RowMapper;
  20 +import org.springframework.stereotype.Service;
  21 +
  22 +import javax.transaction.Transactional;
  23 +import java.sql.ResultSet;
  24 +import java.sql.SQLException;
  25 +import java.util.HashMap;
  26 +import java.util.List;
  27 +import java.util.Map;
35 28  
36 29 @Service
37 30 public class YlxxbServiceImpl extends BaseServiceImpl<Ylxxb,Integer> implements YlxxbService
... ... @@ -45,23 +38,25 @@ public class YlxxbServiceImpl extends BaseServiceImpl&lt;Ylxxb,Integer&gt; implements
45 38 JdbcTemplate jdbcTemplate;
46 39 @Override
47 40 public PageObject<Ylxxb> Pagequery(Map<String, Object> map) {
48   -
  41 +
49 42 String rq=map.get("yyrq").toString();
50 43 String gsdm=map.get("gsdm_like").toString();
51 44 String fgsdm=map.get("fgsdm_like").toString();
52   -
53   - String sql=" select * from ("
54   - + "select *,CONCAT(nbbm,jsy) as nj "
55   - + " from bsth_c_ylxxb where yyrq='"+rq+"' "
56   - + " and gsdm ='"+gsdm+"') x where x.nj not in ("
57   - + " select CONCAT(nbbm,jsy) from bsth_c_ylb "
58   - + " where DATE_FORMAT(rq,'%Y-%m-%d')='"+rq+"'"
59   - + " and ssgsdm='"+gsdm+"' and fgsdm ='"+fgsdm+"')"
60   - + " and x.nbbm in (select nbbm from bsth_c_ylb "
61   - + " where DATE_FORMAT(rq,'%Y-%m-%d')='"+rq+"'"
62   - + " and ssgsdm='"+gsdm+"' and fgsdm ='"+fgsdm+"')";
63   -
64   -
  45 +
  46 + String sql=" select * from ("
  47 + + "select *,CONCAT(nbbm,jsy) as nj "
  48 + + " from bsth_c_ylxxb where yyrq='"+rq+"' "
  49 + + " and gsdm ='"+gsdm+"' and jylx ='0') x where x.nj not in ("
  50 + + " select CONCAT(nbbm,jsy) from bsth_c_ylb "
  51 + + " where rq='"+rq+"'"
  52 + + " and ssgsdm='"+gsdm+"' and fgsdm ='"+fgsdm+"')"
  53 + + " and x.nbbm in (select nbbm from bsth_c_ylb "
  54 + + " where rq='"+rq+"'"
  55 + + " and ssgsdm='"+gsdm+"' and fgsdm ='"+fgsdm+"') "
  56 + + " and x.nbbm not in (select nbbm from bsth_c_ylxxb"
  57 + + " where yyrq='"+rq+"' and gsdm ='"+gsdm+"' AND jylx ='1')";
  58 +
  59 +
65 60 /*String sql= "select v.*,u.jsy as ldgh from "
66 61 + " ( select * from bsth_c_ylxxb x where "
67 62 + " DATE_FORMAT(x.yyrq,'%Y-%m-%d')='"+rq+"' and x.gsdm='"+gsdm+"'"
... ... @@ -76,43 +71,43 @@ public class YlxxbServiceImpl extends BaseServiceImpl&lt;Ylxxb,Integer&gt; implements
76 71 + " where DATE_FORMAT(rq,'%Y-%m-%d')='"+rq+"'"
77 72 + " and ssgsdm='"+gsdm+"' and fgsdm='"+fgsdm+"' ) u "
78 73 + " on v.nbbm=u.nbbm ";*/
79   -
  74 +
80 75 //根具条件查询指定日期Ylxxb的数据
81 76 // List<Ylxxb> iterator=repository.checkYlxx(rq,gsdm);
82 77 /*if(map.get("gsdm_in")!=null){
83 78 map.put("ssgsdm_in", map.get("gsdm_in"));
84 79 map.remove("gsdm_in");
85   -
  80 +
86 81 }else{
87 82 map.put("ssgsdm_like", map.get("gsdm_like"));
88 83 map.remove("gsdm_like");
89 84 }*/
90   -
  85 +
91 86 //根具条件查询指定日期Ylb的数据
92 87 // List<Ylb> ylbIterator=ylbRepository.checkYl(rq,gsdm,fgsdm);
93   - List<Ylxxb> list=jdbcTemplate.query(sql,
94   - new RowMapper<Ylxxb>(){
95   - @Override
96   - public Ylxxb mapRow(ResultSet rs, int rowNum) throws SQLException {
97   - Ylxxb s = new Ylxxb();
98   - s.setId(rs.getInt("id"));
99   - s.setYyrq(rs.getDate("yyrq"));
100   - s.setNbbm(rs.getString("nbbm"));
101   - s.setGsdm(rs.getString("gsdm"));
102   - s.setFgsdm(rs.getString("fgsdm"));
103   - s.setJsy(rs.getString("jsy"));
104   - s.setJzl(rs.getDouble("jzl"));
105   - s.setStationid(rs.getString("stationid"));
106   - s.setNylx(rs.getInt("nylx"));
107   - s.setJyggh(rs.getString("jyggh"));
108   - s.setYj(rs.getDouble("yj"));
  88 + List<Ylxxb> list=jdbcTemplate.query(sql,
  89 + new RowMapper<Ylxxb>(){
  90 + @Override
  91 + public Ylxxb mapRow(ResultSet rs, int rowNum) throws SQLException {
  92 + Ylxxb s = new Ylxxb();
  93 + s.setId(rs.getInt("id"));
  94 + s.setYyrq(rs.getDate("yyrq"));
  95 + s.setNbbm(rs.getString("nbbm"));
  96 + s.setGsdm(rs.getString("gsdm"));
  97 + s.setFgsdm(rs.getString("fgsdm"));
  98 + s.setJsy(rs.getString("jsy"));
  99 + s.setJzl(rs.getDouble("jzl"));
  100 + s.setStationid(rs.getString("stationid"));
  101 + s.setNylx(rs.getInt("nylx"));
  102 + s.setJyggh(rs.getString("jyggh"));
  103 + s.setYj(rs.getDouble("yj"));
109 104 // s.setLdgh(rs.getString("ldgh"));
110   - s.setBz(rs.getString("bz"));
111   - return s;
112   - }
113   - });
114   -
115   -
  105 + s.setBz(rs.getString("bz"));
  106 + return s;
  107 + }
  108 + });
  109 +
  110 +
116 111 List<Ylb> listylb=ylbRepository.obtainYl(rq, gsdm, fgsdm, "", "", "nbbm");
117 112 for (int i = 0; i < list.size(); i++) {
118 113 String ldgh="";
... ... @@ -122,11 +117,11 @@ public class YlxxbServiceImpl extends BaseServiceImpl&lt;Ylxxb,Integer&gt; implements
122 117 if(ldgh.equals(""))
123 118 ldgh +=ylb.getJsy();
124 119 else
125   - ldgh += ","+ylb.getJsy();
  120 + ldgh += ","+ylb.getJsy();
126 121 }
127 122 }
128 123 list.get(i).setLdgh(ldgh);
129   -
  124 +
130 125 }
131 126 //正式使用用下面代码
132 127 // for (int i = 0; i < iterator.size(); i++) {
... ... @@ -147,16 +142,16 @@ public class YlxxbServiceImpl extends BaseServiceImpl&lt;Ylxxb,Integer&gt; implements
147 142 // list.add(y1);
148 143 // }
149 144 // }
150   -
151   -
152   -
  145 +
  146 +
  147 +
153 148 PageHelper pageHelper = new PageHelper(list.size(), map);
154 149 pageHelper.getMap();
155 150 PageObject<Ylxxb> pageObject = pageHelper.getPageObject();
156 151 pageObject.setDataList(list);
157 152 return pageObject;
158 153 }
159   - @Transactional
  154 + @Transactional
160 155 @Override
161 156 public Map<String, Object> checkJsy(Map<String, Object> map) throws Exception{
162 157 Map<String, Object> newMap=new HashMap<String,Object>();
... ... @@ -175,11 +170,13 @@ public class YlxxbServiceImpl extends BaseServiceImpl&lt;Ylxxb,Integer&gt; implements
175 170 Integer id =jsonObject.getInteger("id");
176 171 String jsy =jsonObject.getString("jsy");
177 172 Ylxxb ylxxb=repository.findOne(id);
178   - ylxxb.setJsy(jsy);
179   - ylxxb.setJylx(1);
180   - repository.save(ylxxb);
  173 + if(!ylxxb.getJsy().equals(jsy)){
  174 + ylxxb.setJsy(jsy);
  175 + ylxxb.setJylx(1);
  176 + repository.save(ylxxb);
  177 + }
181 178 }
182   - newMap.put("status", ResponseCode.SUCCESS);
  179 + newMap.put("status", ResponseCode.SUCCESS);
183 180 }catch(Exception e){
184 181 newMap.put("status", ResponseCode.ERROR);
185 182 logger.error("save erro.", e);
... ...
src/main/java/com/bsth/service/report/impl/ReportServiceImpl.java
... ... @@ -4,7 +4,6 @@ import com.bsth.entity.Line;
4 4 import com.bsth.entity.Personnel;
5 5 import com.bsth.entity.StationRoute;
6 6 import com.bsth.entity.excep.ArrivalInfo;
7   -import com.bsth.entity.mcy_forms.Daily;
8 7 import com.bsth.entity.oil.Dlb;
9 8 import com.bsth.entity.oil.Ylb;
10 9 import com.bsth.entity.realcontrol.ChildTaskPlan;
... ... @@ -20,8 +19,6 @@ import com.bsth.util.ComparableChild;
20 19 import com.bsth.util.ComparableJob;
21 20 import com.bsth.util.ReportUtils;
22 21 import com.bsth.util.db.DBUtils_MS;
23   -import com.google.protobuf.StringValue;
24   -
25 22 import org.apache.commons.lang.StringUtils;
26 23 import org.slf4j.Logger;
27 24 import org.slf4j.LoggerFactory;
... ... @@ -39,21 +36,19 @@ import java.text.ParseException;
39 36 import java.text.SimpleDateFormat;
40 37 import java.util.*;
41 38  
42   -import javax.persistence.criteria.CriteriaBuilder.In;
43   -
44 39 @Service
45 40 public class ReportServiceImpl implements ReportService{
46   -
  41 +
47 42 private static long zgf1 = 6 * 60 + 31,
48 43 zgf2 = 8 * 60 + 30,
49   - wgf1 = 16 * 60 + 1,
  44 + wgf1 = 16 * 60 + 1,
50 45 wgf2 = 18 * 60;
51   -
  46 +
52 47 private Logger logger = LoggerFactory.getLogger(this.getClass());
53   -
  48 +
54 49 @Autowired
55 50 JdbcTemplate jdbcTemplate;
56   -
  51 +
57 52 @Autowired
58 53 ScheduleRealInfoRepository scheduleRealInfoRepository;
59 54 @Autowired
... ... @@ -64,12 +59,12 @@ public class ReportServiceImpl implements ReportService{
64 59 LineRepository lineRepository;
65 60 @Autowired
66 61 StationRouteRepository stationRouteRepository;
67   -
  62 +
68 63 @Override
69 64 public List<ScheduleRealInfo> queryListBczx(String line, String date,String clzbh) {
70 65 // TODO Auto-generated method stub
71 66 List<ScheduleRealInfo> list=scheduleRealInfoRepository.findByDate2(line,date,clzbh);
72   -
  67 +
73 68 // jdbcTemplate.query("select * from bsth_c_s_sp_info_real where line=?1 "
74 69 // + "and DATE_FORMAT(schedule_date,'%Y-%m-%d')=?2 and cl_zbl=?3",
75 70 // new Object[]{line,date,clzbh},
... ... @@ -81,7 +76,7 @@ public class ReportServiceImpl implements ReportService{
81 76 // return s;
82 77 // }
83 78 // });
84   -
  79 +
85 80 return list;
86 81 }
87 82 @Override
... ... @@ -96,7 +91,7 @@ public class ReportServiceImpl implements ReportService{
96 91 Long date2=simpleDateFormat.parse(date+" "+sjdd+":00").getTime();
97 92 Date dates=simpleDateFormat.parse(date+" 00:00:00");
98 93 List<ArrivalInfo> lists=load(line,sbbb,date1,date2,dates);
99   -
  94 +
100 95 for(int i=0;i<lists.size();i++){
101 96 ArrivalInfo t1=lists.get(i);
102 97 if(t1.getInOut()==0){
... ... @@ -109,53 +104,53 @@ public class ReportServiceImpl implements ReportService{
109 104 }
110 105 list.add(t1);
111 106 }
112   -
  107 +
113 108 }
114   -
115   -
  109 +
  110 +
116 111 } catch (ParseException e) {
117 112 // TODO Auto-generated catch block
118 113 e.printStackTrace();
119 114 }
120   -
  115 +
121 116 return list;
122 117 }
123 118  
124   -
  119 +
125 120 public List<ArrivalInfo> load(String line,String sbbb,Long date1,Long date2,Date dates){
126 121 List<ArrivalInfo> list = null;
127   - Calendar cal = Calendar.getInstance();
128   - cal.setTime(dates);
129   - //周数,表分区字段
130   - int weeks_year = cal.get(Calendar.WEEK_OF_YEAR);
131   -
132   - Connection conn = null;
133   - PreparedStatement ps = null;
134   - ResultSet rs = null;
135   -
136   - String sql = "select * from bsth_c_arrival_info where device_id=? AND line_id=? AND weeks_year=? AND ts > ? AND ts <=? order by ts";
137   - try{
138   - conn = DBUtils_MS.getConnection();
139   - ps = conn.prepareStatement(sql);
140   - ps.setString(1, sbbb);
141   - ps.setString(2,line);
142   - ps.setInt(3, weeks_year);
143   - ps.setLong(4, date1);
144   - ps.setLong(5, date2);
145   - rs = ps.executeQuery();
146   -
147   - list = resultSet2Set(rs);
148   - }catch(Exception e){
149   - logger.error("", e);
150   - }finally {
151   - DBUtils_MS.close(rs, ps, conn);
152   - }
  122 + Calendar cal = Calendar.getInstance();
  123 + cal.setTime(dates);
  124 + //周数,表分区字段
  125 + int weeks_year = cal.get(Calendar.WEEK_OF_YEAR);
  126 +
  127 + Connection conn = null;
  128 + PreparedStatement ps = null;
  129 + ResultSet rs = null;
  130 +
  131 + String sql = "select * from bsth_c_arrival_info where device_id=? AND line_id=? AND weeks_year=? AND ts > ? AND ts <=? order by ts";
  132 + try{
  133 + conn = DBUtils_MS.getConnection();
  134 + ps = conn.prepareStatement(sql);
  135 + ps.setString(1, sbbb);
  136 + ps.setString(2,line);
  137 + ps.setInt(3, weeks_year);
  138 + ps.setLong(4, date1);
  139 + ps.setLong(5, date2);
  140 + rs = ps.executeQuery();
  141 +
  142 + list = resultSet2Set(rs);
  143 + }catch(Exception e){
  144 + logger.error("", e);
  145 + }finally {
  146 + DBUtils_MS.close(rs, ps, conn);
  147 + }
153 148 return list;
154 149 }
155   -
  150 +
156 151 public List<ArrivalInfo> resultSet2Set(ResultSet rs) throws SQLException{
157 152 List<ArrivalInfo> list = new ArrayList<>();
158   -
  153 +
159 154 ArrivalInfo arr;
160 155 while(rs.next()){
161 156 arr = new ArrivalInfo();
... ... @@ -167,7 +162,7 @@ public class ReportServiceImpl implements ReportService{
167 162 logger.warn("未注册的设备号," + arr.getDeviceId());
168 163 continue;
169 164 }
170   -
  165 +
171 166 arr.setTs(rs.getLong("ts"));
172 167 arr.setLineCode(rs.getString("line_id"));
173 168 arr.setUpDown(rs.getInt("up_down"));
... ... @@ -177,7 +172,7 @@ public class ReportServiceImpl implements ReportService{
177 172 arr.setCreateDate(rs.getLong("create_timestamp"));
178 173 arr.setWeeksYear(rs.getInt("weeks_year"));
179 174 arr.setEnable(true);
180   -
  175 +
181 176 list.add(arr);
182 177 }
183 178 return list;
... ... @@ -185,76 +180,76 @@ public class ReportServiceImpl implements ReportService{
185 180 @Override
186 181 public List<ArrivalInfo> queryListClzd(String line, String zd, String zdlx, String fcsj, String ddsj) {
187 182 // TODO Auto-generated method stub
188   - List<ArrivalInfo> list=new ArrayList<ArrivalInfo>();
189   - try {
190   - SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
191   - SimpleDateFormat sdf = new SimpleDateFormat("HH:mm:ss");
192   - Long date1=simpleDateFormat.parse(fcsj+":00").getTime();
193   - Long date2=simpleDateFormat.parse(ddsj+":00").getTime();
194   - Date dates1=simpleDateFormat.parse(fcsj+":00");
195   - Date dates2=simpleDateFormat.parse(ddsj+":00");
196   - List<ArrivalInfo> lists=load2(line,date1,date2,dates1,dates2,zd,zdlx);
197   -
198   - for(int i=0;i<lists.size();i++){
199   - ArrivalInfo t1=lists.get(i);
200   - if(t1.getInOut()==0){
201   - t1.setJzsj(sdf.format(new Date(t1.getTs())));
202   - for(int j=0;j<lists.size();j++){
203   - ArrivalInfo t2=lists.get(j);
204   - if(t2.getInOut()==1 && t2.getDeviceId().equals(t1.getDeviceId())
205   - && t2.getStopNo().equals(t1.getStopNo())
206   - && t2.getTs()>t1.getTs()){
207   - t1.setCzsj(sdf.format(new Date(t2.getTs())));
208   - break;
209   - }
210   - }
211   - list.add(t1);
  183 + List<ArrivalInfo> list=new ArrayList<ArrivalInfo>();
  184 + try {
  185 + SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
  186 + SimpleDateFormat sdf = new SimpleDateFormat("HH:mm:ss");
  187 + Long date1=simpleDateFormat.parse(fcsj+":00").getTime();
  188 + Long date2=simpleDateFormat.parse(ddsj+":00").getTime();
  189 + Date dates1=simpleDateFormat.parse(fcsj+":00");
  190 + Date dates2=simpleDateFormat.parse(ddsj+":00");
  191 + List<ArrivalInfo> lists=load2(line,date1,date2,dates1,dates2,zd,zdlx);
  192 +
  193 + for(int i=0;i<lists.size();i++){
  194 + ArrivalInfo t1=lists.get(i);
  195 + if(t1.getInOut()==0){
  196 + t1.setJzsj(sdf.format(new Date(t1.getTs())));
  197 + for(int j=0;j<lists.size();j++){
  198 + ArrivalInfo t2=lists.get(j);
  199 + if(t2.getInOut()==1 && t2.getDeviceId().equals(t1.getDeviceId())
  200 + && t2.getStopNo().equals(t1.getStopNo())
  201 + && t2.getTs()>t1.getTs()){
  202 + t1.setCzsj(sdf.format(new Date(t2.getTs())));
  203 + break;
212 204 }
213   -
214 205 }
215   -
216   -
217   - } catch (ParseException e) {
218   - // TODO Auto-generated catch block
219   - e.printStackTrace();
  206 + list.add(t1);
220 207 }
221   -
222   - return list;
  208 +
  209 + }
  210 +
  211 +
  212 + } catch (ParseException e) {
  213 + // TODO Auto-generated catch block
  214 + e.printStackTrace();
  215 + }
  216 +
  217 + return list;
223 218 }
224   -
225   -
  219 +
  220 +
226 221 public List<ArrivalInfo> load2(String line,Long date1,Long date2,Date dates1,Date dates2,String zd,String zdlx){
227 222 List<ArrivalInfo> list = null;
228   - Calendar cal = Calendar.getInstance();
229   - cal.setTime(dates1);
230   - //周数,表分区字段
231   - int weeks_year1 = cal.get(Calendar.WEEK_OF_YEAR);
232   - cal.setTime(dates2);
233   - int weeks_year2 = cal.get(Calendar.WEEK_OF_YEAR);
234   - Connection conn = null;
235   - PreparedStatement ps = null;
236   - ResultSet rs = null;
237   -
238   - String sql = "select * from bsth_c_arrival_info where line_id=? AND weeks_year>=? "
239   - + " AND weeks_year<=? AND ts > ? AND ts <=? AND up_down=? AND stop_no like ? order by ts";
240   - try{
241   - conn = DBUtils_MS.getConnection();
242   - ps = conn.prepareStatement(sql);
243   - ps.setString(1, line);
244   - ps.setInt(2, weeks_year1);
245   - ps.setInt(3, weeks_year2);
246   - ps.setLong(4, date1);
247   - ps.setLong(5, date2);
248   - ps.setString(6, zdlx);
249   - ps.setString(7, "%"+zd+"%");
250   - rs = ps.executeQuery();
251   -
252   - list = resultSet2Set(rs);
253   - }catch(Exception e){
254   - logger.error("", e);
255   - }finally {
256   - DBUtils_MS.close(rs, ps, conn);
257   - }
  223 + Calendar cal = Calendar.getInstance();
  224 + cal.setTime(dates1);
  225 + //周数,表分区字段
  226 + int weeks_year1 = cal.get(Calendar.WEEK_OF_YEAR);
  227 + cal.setTime(dates2);
  228 + int weeks_year2 = cal.get(Calendar.WEEK_OF_YEAR);
  229 + Connection conn = null;
  230 + PreparedStatement ps = null;
  231 + ResultSet rs = null;
  232 +
  233 + String sql = "select * from bsth_c_arrival_info where line_id=? AND weeks_year>=? "
  234 + + " AND weeks_year<=? AND ts > ? AND ts <=? AND up_down=? AND stop_no like ? order by ts";
  235 + try{
  236 + conn = DBUtils_MS.getConnection();
  237 + ps = conn.prepareStatement(sql);
  238 + ps.setString(1, line);
  239 + ps.setInt(2, weeks_year1);
  240 + ps.setInt(3, weeks_year2);
  241 + ps.setLong(4, date1);
  242 + ps.setLong(5, date2);
  243 + ps.setString(6, zdlx);
  244 + ps.setString(7, "%"+zd+"%");
  245 + rs = ps.executeQuery();
  246 +
  247 + list = resultSet2Set(rs);
  248 + }catch(Exception e){
  249 + logger.error("", e);
  250 + }finally {
  251 + DBUtils_MS.close(rs, ps, conn);
  252 + }
258 253 return list;
259 254 }
260 255 @Override
... ... @@ -285,8 +280,8 @@ public class ReportServiceImpl implements ReportService{
285 280 String sqlPc=" select count(*) from bsth_c_cars where id in("
286 281 + " select cl from bsth_c_s_ccinfo where xl in ( "
287 282 + " select id from bsth_c_line where line_code='"+line+"' )"
288   - + " group by equipment_code ) ";
289   -
  283 + + " group by equipment_code ) ";
  284 +
290 285 Map<String, Object> map=new HashMap<String,Object>();
291 286  
292 287 /*List<Map<String, Object>> listPc= jdbcTemplate.query(sqlPc,
... ... @@ -300,61 +295,61 @@ public class ReportServiceImpl implements ReportService{
300 295 });*/
301 296 //配车
302 297 int pcs=jdbcTemplate.queryForObject(sqlPc, Integer.class);
303   -
  298 +
304 299 String sqlPlan=" SELECT jhlc,bc_type,fcsj FROM bsth_c_s_ttinfo_detail "
305 300 +" where ttinfo ='"+ttinfo+"' ";
306   -
  301 +
307 302 //班次
308 303 int zgf_0 = 6*60+31,zgf_1 = 8*60+30,wgf_0 = 16*60+1,wgf_1 = 18*60;
309 304 int qcBc=0,qjBc=0,zqcBc=0,zqjBc=0,wqcBc=0,wqjBc=0;
310 305 double zlc = 0 , yylc = 0,kslc=0;
311 306 //查询班次
312   - List<Map<String, Object>> listPlan= jdbcTemplate.query(sqlPlan,
  307 + List<Map<String, Object>> listPlan= jdbcTemplate.query(sqlPlan,
313 308 new RowMapper<Map<String, Object>>(){
314   - @Override
315   - public Map<String, Object> mapRow(ResultSet rs, int rowNum) throws SQLException {
316   - Map<String, Object> m2=new HashMap<String,Object>();
317   - m2.put("jhlc", rs.getDouble("jhlc"));
318   - m2.put("bcType", rs.getString("bc_type"));
319   - m2.put("fcsj", rs.getString("fcsj"));
320   - return m2;
321   - }
322   - });
323   -
  309 + @Override
  310 + public Map<String, Object> mapRow(ResultSet rs, int rowNum) throws SQLException {
  311 + Map<String, Object> m2=new HashMap<String,Object>();
  312 + m2.put("jhlc", rs.getDouble("jhlc"));
  313 + m2.put("bcType", rs.getString("bc_type"));
  314 + m2.put("fcsj", rs.getString("fcsj"));
  315 + return m2;
  316 + }
  317 + });
  318 +
324 319 for (int i = 0; i < listPlan.size(); i++) {
325 320 Map<String, Object> m=listPlan.get(i);
326   - double jhlc=Double.parseDouble(m.get("jhlc").toString());
  321 + double jhlc=Double.parseDouble(m.get("jhlc").toString());
327 322 String bcType=m.get("bcType").toString();
328 323 String fcsjs[]=m.get("fcsj").toString().split(":");
329   -
  324 +
330 325 zlc +=jhlc;
331 326 if(bcType.equals("in") || bcType.equals("out")){
332 327 kslc+=jhlc;
333 328 }
334 329 else if(bcType.equals("region")){
335 330 qjBc++;
336   - if((Integer.parseInt(fcsjs[0])*60+Integer.parseInt(fcsjs[1])) > zgf_0
  331 + if((Integer.parseInt(fcsjs[0])*60+Integer.parseInt(fcsjs[1])) > zgf_0
337 332 && (Integer.parseInt(fcsjs[0])*60+Integer.parseInt(fcsjs[1])) < zgf_1){
338 333 zqjBc++;
339   - }else if((Integer.parseInt(fcsjs[0])*60+Integer.parseInt(fcsjs[1])) > wgf_0
340   - && (Integer.parseInt(fcsjs[0])*60+Integer.parseInt(fcsjs[1])) < wgf_1){
  334 + }else if((Integer.parseInt(fcsjs[0])*60+Integer.parseInt(fcsjs[1])) > wgf_0
  335 + && (Integer.parseInt(fcsjs[0])*60+Integer.parseInt(fcsjs[1])) < wgf_1){
341 336 wqjBc++;
342 337 }
343   -
  338 +
344 339 yylc+=jhlc;
345 340 }else{
346 341 qcBc ++;
347   - if((Integer.parseInt(fcsjs[0])*60+Integer.parseInt(fcsjs[1])) > zgf_0
  342 + if((Integer.parseInt(fcsjs[0])*60+Integer.parseInt(fcsjs[1])) > zgf_0
348 343 && (Integer.parseInt(fcsjs[0])*60+Integer.parseInt(fcsjs[1])) < zgf_1){
349 344 zqcBc++;
350   - }else if((Integer.parseInt(fcsjs[0])*60+Integer.parseInt(fcsjs[1])) > wgf_0
351   - && (Integer.parseInt(fcsjs[0])*60+Integer.parseInt(fcsjs[1])) < wgf_1){
  345 + }else if((Integer.parseInt(fcsjs[0])*60+Integer.parseInt(fcsjs[1])) > wgf_0
  346 + && (Integer.parseInt(fcsjs[0])*60+Integer.parseInt(fcsjs[1])) < wgf_1){
352 347 wqcBc++;
353 348 }
354 349 yylc +=jhlc;
355 350 }
356 351 }
357   -
  352 +
358 353 map.put("pcs", pcs);
359 354 map.put("qcbc", qcBc);
360 355 map.put("qjbc", qjBc);
... ... @@ -373,39 +368,39 @@ public class ReportServiceImpl implements ReportService{
373 368 DecimalFormat df = new DecimalFormat("#0.00");
374 369 // TODO Auto-generated method stub
375 370 //最早营运时间 区分夜宵线
376   - String sqlMinYysj="select start_opt from bsth_c_line_config where "
377   - + " id = ("
378   - + "select max(id) from bsth_c_line_config where line ='"+BasicData.lineId2CodeMap.inverse().get(line) +"'"
379   - + ")";
380   - String minfcsj=jdbcTemplate.queryForObject(sqlMinYysj, String.class);
  371 + String sqlMinYysj="select start_opt from bsth_c_line_config where "
  372 + + " id = ("
  373 + + "select max(id) from bsth_c_line_config where line ='"+BasicData.lineId2CodeMap.inverse().get(line) +"'"
  374 + + ")";
  375 + String minfcsj=jdbcTemplate.queryForObject(sqlMinYysj, String.class);
381 376 String[] minSjs = minfcsj.split(":");
382 377 int minSj=Integer.parseInt(minSjs[0])*60+Integer.parseInt(minSjs[1]);
383 378 //查询时间里程
384 379 String sqlPc=" (SELECT jhlc,fcsj,bc_type,lp,2 as xh, ists FROM bsth_c_s_ttinfo_detail "
385   - + " where ttinfo ='"+ttinfo+"' and fcsj <='"+minfcsj+"' ) "
386   - + " union "
387   - + " (SELECT jhlc,fcsj,bc_type,lp,1 as xh, ists FROM bsth_c_s_ttinfo_detail "
388   - + " where ttinfo ='"+ttinfo+"' and fcsj > '"+minfcsj+"') order by lp,xh,fcsj";
389   -
  380 + + " where ttinfo ='"+ttinfo+"' and fcsj <='"+minfcsj+"' ) "
  381 + + " union "
  382 + + " (SELECT jhlc,fcsj,bc_type,lp,1 as xh, ists FROM bsth_c_s_ttinfo_detail "
  383 + + " where ttinfo ='"+ttinfo+"' and fcsj > '"+minfcsj+"') order by lp,xh,fcsj";
  384 +
390 385 Map<String, Object> map=new HashMap<String,Object>();
391 386 List<Map<String, Object>> list= jdbcTemplate.query(sqlPc,
392   - new RowMapper<Map<String, Object>>(){
393   - @Override
394   - public Map<String, Object> mapRow(ResultSet rs, int rowNum) throws SQLException {
395   - Map<String, Object> m=new HashMap<String,Object>();
396   - m.put("fcsj", rs.getString("fcsj"));
397   - m.put("yygl", rs.getString("jhlc")==null?"0":rs.getString("jhlc"));
398   - m.put("bcType", rs.getString("bc_type"));
399   - m.put("lp", rs.getString("lp"));
400   - m.put("ists", rs.getObject("ists")==null?"0":rs.getString("ists"));
401   - return m;
402   - }
403   - });
  387 + new RowMapper<Map<String, Object>>(){
  388 + @Override
  389 + public Map<String, Object> mapRow(ResultSet rs, int rowNum) throws SQLException {
  390 + Map<String, Object> m=new HashMap<String,Object>();
  391 + m.put("fcsj", rs.getString("fcsj"));
  392 + m.put("yygl", rs.getString("jhlc")==null?"0":rs.getString("jhlc"));
  393 + m.put("bcType", rs.getString("bc_type"));
  394 + m.put("lp", rs.getString("lp"));
  395 + m.put("ists", rs.getObject("ists")==null?"0":rs.getString("ists"));
  396 + return m;
  397 + }
  398 + });
404 399 int yysj=0 ;
405 400 double yycs=0 ,yygl=0;
406 401 String lp ="0";
407 402 int sj=0;
408   -
  403 +
409 404 for(int i=0;i<list.size();i++){
410 405 Map<String, Object> m=list.get(i);
411 406 String time=m.get("fcsj").toString();
... ... @@ -421,7 +416,7 @@ public class ReportServiceImpl implements ReportService{
421 416 }
422 417 }else{
423 418 yygl += Double.parseDouble(m.get("yygl").toString());
424   -
  419 +
425 420 if(sj==0){
426 421 sj=(Integer.parseInt(times[0])+24)*60+Integer.parseInt(times[1]);
427 422 }else{
... ... @@ -439,7 +434,7 @@ public class ReportServiceImpl implements ReportService{
439 434 }
440 435 }else{
441 436 yygl += Double.parseDouble(m.get("yygl").toString());
442   -
  437 +
443 438 if(sj==0){
444 439 sj=Integer.parseInt(times[0])*60+Integer.parseInt(times[1]);
445 440 }else{
... ... @@ -456,7 +451,7 @@ public class ReportServiceImpl implements ReportService{
456 451 sj=0;
457 452 }
458 453 lp=m.get("lp").toString();
459   -
  454 +
460 455 }
461 456 if(m.containsKey("ists") && m.get("ists").equals("1")){
462 457 sj = 0;
... ... @@ -467,105 +462,105 @@ public class ReportServiceImpl implements ReportService{
467 462 }
468 463 int hh=yysj/60;
469 464 int mm=yysj%60;
470   -
  465 +
471 466 map.put("yysj", hh+":"+mm);
472 467 map.put("yycs", df.format(yycs)+"公里/小时");
473 468 // map.put(key, value)
474 469 return map;
475 470 }
476   -
  471 +
477 472 public static void main(String[] args) {
478 473 System.out.println(609360/60);
479 474 System.out.println(609360%60);
480 475 }
481   -/* @Override
482   - public List<Map<String, Object>> tbodyTime3(String line, String ttinfo) {
483   - // TODO Auto-generated method stub
484   - List<Map<String, Object>> list=new ArrayList<Map<String,Object>>();
485   -
  476 + /* @Override
  477 + public List<Map<String, Object>> tbodyTime3(String line, String ttinfo) {
  478 + // TODO Auto-generated method stub
  479 + List<Map<String, Object>> list=new ArrayList<Map<String,Object>>();
486 480  
487 481  
488   - String sqlZd="select a.qdz_name,COUNT(a.cl_zbh) as cls,'zqc' AS lx from ("
489   - + " select cl_zbh,qdz_name from bsth_c_s_sp_info where tt_info ='"+ttinfo+"' "
490   - + " and bc_type ='normal'"
491   - + " and ((fcsj >'06:31' and fcsj<'08:30') or ( fcsj>'6:31' and fcsj<'8:30'))"
492   - + " group by cl_zbh,qdz_name) a group by a.qdz_name"
493   - + " union "
494   - + " select a.qdz_name,COUNT(a.cl_zbh) as cls,'wqc' AS lx from ("
495   - + " select cl_zbh,qdz_name from bsth_c_s_sp_info where tt_info ='"+ttinfo+"'"
496   - + " and bc_type ='normal' "
497   - + " and fcsj >'16:01' and fcsj<'18:00' group by cl_zbh,qdz_name "
498   - + " ) a group by a.qdz_name "
499   - + " union "
500   - + " select a.qdz_name,COUNT(a.cl_zbh) as cls,'zqj' AS lx from ("
501   - + " select cl_zbh,qdz_name from bsth_c_s_sp_info where tt_info ='"+ttinfo+"'"
502   - + " and bc_type ='region' "
503   - + " and ((fcsj >'06:31' and fcsj<'08:30') or ( fcsj>'6:31' and fcsj<'8:30'))"
504   - + " group by cl_zbh,qdz_name) a group by a.qdz_name"
505   - + " union "
506   - + " select a.qdz_name,COUNT(a.cl_zbh) as cls,'wqj' AS lx from ("
507   - + " select cl_zbh,qdz_name from bsth_c_s_sp_info where tt_info ='"+ttinfo+"'"
508   - + " and bc_type ='region' and fcsj >'16:01' and fcsj<'18:00'"
509   - + " group by cl_zbh,qdz_name) a group by a.qdz_name";
510   - List<Map<String, Object>> lists= jdbcTemplate.query(sqlZd,
511   - new RowMapper<Map<String, Object>>(){
512   - @Override
513   - public Map<String, Object> mapRow(ResultSet rs, int rowNum) throws SQLException {
514   - Map<String, Object> m=new HashMap<String,Object>();
515   - m.put("zdm", rs.getString("qdz_name"));
516   - m.put("cls", rs.getString("cls"));
517   - m.put("lx", rs.getString("lx"));
518   - return m;
519   - }
520   - });
521   - int a=0;
522   - int b=0;
523   - int c=0;
524   - int d=0;
525   - for(int i=0;i<lists.size();i++){
526   - boolean fage=true;
527   - Map<String, Object> newMap= new HashMap<String, Object>();
528   - list.add(newMap);
529   - Map<String, Object> maps=lists.get(i);
530   - if(maps.get("lx").equals("zqc")){
531   - list.get(a).put("zqcZm", maps.get("zdm"));
532   - list.get(a).put("zqcCls", maps.get("cls"));
533   - a++;
534   - fage=false;
535   - }else if(maps.get("lx").equals("wqc")){
536   - list.get(b).put("wqcZm", maps.get("zdm"));
537   - list.get(b).put("wqcCls", maps.get("cls"));
538   - b++;
539   - fage=false;
540   - }else if(maps.get("lx").equals("zqj")){
541   - list.get(c).put("zqjZm", maps.get("zdm"));
542   - list.get(c).put("zqjCls", maps.get("cls"));
543   - c++;
544   - fage=false;
545   - }else if(maps.get("lx").equals("wqj")){
546   - list.get(d).put("wqjZm", maps.get("zdm"));
547   - list.get(d).put("wqjCls", maps.get("cls"));
548   - d++;
549   - fage=false;
550   - }
551   - if(fage){
552   - break;
553   - }
554   - }
555   - boolean status=true;
556   - while (status) {
557   - for (int i = 0; i < list.size(); i++) {
558   - if(list.get(i).isEmpty()){
559   - list.remove(i);
560   - status=true;
561   - }else{
562   - status=false;
563   - }
564   - }
565   -
566   - }
567   - return list;
568   - }*/
  482 +
  483 + String sqlZd="select a.qdz_name,COUNT(a.cl_zbh) as cls,'zqc' AS lx from ("
  484 + + " select cl_zbh,qdz_name from bsth_c_s_sp_info where tt_info ='"+ttinfo+"' "
  485 + + " and bc_type ='normal'"
  486 + + " and ((fcsj >'06:31' and fcsj<'08:30') or ( fcsj>'6:31' and fcsj<'8:30'))"
  487 + + " group by cl_zbh,qdz_name) a group by a.qdz_name"
  488 + + " union "
  489 + + " select a.qdz_name,COUNT(a.cl_zbh) as cls,'wqc' AS lx from ("
  490 + + " select cl_zbh,qdz_name from bsth_c_s_sp_info where tt_info ='"+ttinfo+"'"
  491 + + " and bc_type ='normal' "
  492 + + " and fcsj >'16:01' and fcsj<'18:00' group by cl_zbh,qdz_name "
  493 + + " ) a group by a.qdz_name "
  494 + + " union "
  495 + + " select a.qdz_name,COUNT(a.cl_zbh) as cls,'zqj' AS lx from ("
  496 + + " select cl_zbh,qdz_name from bsth_c_s_sp_info where tt_info ='"+ttinfo+"'"
  497 + + " and bc_type ='region' "
  498 + + " and ((fcsj >'06:31' and fcsj<'08:30') or ( fcsj>'6:31' and fcsj<'8:30'))"
  499 + + " group by cl_zbh,qdz_name) a group by a.qdz_name"
  500 + + " union "
  501 + + " select a.qdz_name,COUNT(a.cl_zbh) as cls,'wqj' AS lx from ("
  502 + + " select cl_zbh,qdz_name from bsth_c_s_sp_info where tt_info ='"+ttinfo+"'"
  503 + + " and bc_type ='region' and fcsj >'16:01' and fcsj<'18:00'"
  504 + + " group by cl_zbh,qdz_name) a group by a.qdz_name";
  505 + List<Map<String, Object>> lists= jdbcTemplate.query(sqlZd,
  506 + new RowMapper<Map<String, Object>>(){
  507 + @Override
  508 + public Map<String, Object> mapRow(ResultSet rs, int rowNum) throws SQLException {
  509 + Map<String, Object> m=new HashMap<String,Object>();
  510 + m.put("zdm", rs.getString("qdz_name"));
  511 + m.put("cls", rs.getString("cls"));
  512 + m.put("lx", rs.getString("lx"));
  513 + return m;
  514 + }
  515 + });
  516 + int a=0;
  517 + int b=0;
  518 + int c=0;
  519 + int d=0;
  520 + for(int i=0;i<lists.size();i++){
  521 + boolean fage=true;
  522 + Map<String, Object> newMap= new HashMap<String, Object>();
  523 + list.add(newMap);
  524 + Map<String, Object> maps=lists.get(i);
  525 + if(maps.get("lx").equals("zqc")){
  526 + list.get(a).put("zqcZm", maps.get("zdm"));
  527 + list.get(a).put("zqcCls", maps.get("cls"));
  528 + a++;
  529 + fage=false;
  530 + }else if(maps.get("lx").equals("wqc")){
  531 + list.get(b).put("wqcZm", maps.get("zdm"));
  532 + list.get(b).put("wqcCls", maps.get("cls"));
  533 + b++;
  534 + fage=false;
  535 + }else if(maps.get("lx").equals("zqj")){
  536 + list.get(c).put("zqjZm", maps.get("zdm"));
  537 + list.get(c).put("zqjCls", maps.get("cls"));
  538 + c++;
  539 + fage=false;
  540 + }else if(maps.get("lx").equals("wqj")){
  541 + list.get(d).put("wqjZm", maps.get("zdm"));
  542 + list.get(d).put("wqjCls", maps.get("cls"));
  543 + d++;
  544 + fage=false;
  545 + }
  546 + if(fage){
  547 + break;
  548 + }
  549 + }
  550 + boolean status=true;
  551 + while (status) {
  552 + for (int i = 0; i < list.size(); i++) {
  553 + if(list.get(i).isEmpty()){
  554 + list.remove(i);
  555 + status=true;
  556 + }else{
  557 + status=false;
  558 + }
  559 + }
  560 +
  561 + }
  562 + return list;
  563 + }*/
569 564 @Override
570 565 public List<Map<String, Object>> tbodyTime3(String line, String ttinfo) {
571 566 // TODO Auto-generated method stub
... ... @@ -595,39 +590,39 @@ public class ReportServiceImpl implements ReportService{
595 590 + " select cl_zbh,qdz_name from bsth_c_s_sp_info where tt_info ='"+ttinfo+"'"
596 591 + " and bc_type ='region' and fcsj >'16:01' and fcsj<'18:00'"
597 592 + " group by cl_zbh,qdz_name) a group by a.qdz_name";*/
598   -
599   - String sqlCl="SELECT cl_zbh,qdz_name,bc_type,fcsj,bcsj FROM"
600   - + " bsth_c_s_sp_info WHERE tt_info = '"+ttinfo+"' "
601   - + " AND (bc_type = 'normal' or bc_type='region') order by qdz_name";
602   -
603   - List<Map<String, Object>> listj= jdbcTemplate.query(sqlCl,
604   - new RowMapper<Map<String, Object>>(){
605   - @Override
606   - public Map<String, Object> mapRow(ResultSet rs, int rowNum) throws SQLException {
607   - Map<String, Object> m=new HashMap<String,Object>();
608   - m.put("cl_zbh", rs.getString("cl_zbh"));
609   - m.put("qdz_name", rs.getString("qdz_name"));
610   - m.put("bcType", rs.getString("bc_type"));
611   - m.put("fcsj", rs.getString("fcsj"));
612   - m.put("bcsj", rs.getString("bcsj"));
613   - return m;
614   - }
615   - });
616   -
617   - String sqlZd="select qdz_name ,bc_type from bsth_c_s_sp_info WHERE tt_info = '"+ttinfo+"' "
618   - + " AND (bc_type = 'normal' or bc_type='region') group by qdz_name ,bc_type "
619   - + " order by qdz_name";
  593 +
  594 + String sqlCl="SELECT cl_zbh,qdz_name,bc_type,fcsj,bcsj FROM"
  595 + + " bsth_c_s_sp_info WHERE tt_info = '"+ttinfo+"' "
  596 + + " AND (bc_type = 'normal' or bc_type='region') order by qdz_name";
  597 +
  598 + List<Map<String, Object>> listj= jdbcTemplate.query(sqlCl,
  599 + new RowMapper<Map<String, Object>>(){
  600 + @Override
  601 + public Map<String, Object> mapRow(ResultSet rs, int rowNum) throws SQLException {
  602 + Map<String, Object> m=new HashMap<String,Object>();
  603 + m.put("cl_zbh", rs.getString("cl_zbh"));
  604 + m.put("qdz_name", rs.getString("qdz_name"));
  605 + m.put("bcType", rs.getString("bc_type"));
  606 + m.put("fcsj", rs.getString("fcsj"));
  607 + m.put("bcsj", rs.getString("bcsj"));
  608 + return m;
  609 + }
  610 + });
  611 +
  612 + String sqlZd="select qdz_name ,bc_type from bsth_c_s_sp_info WHERE tt_info = '"+ttinfo+"' "
  613 + + " AND (bc_type = 'normal' or bc_type='region') group by qdz_name ,bc_type "
  614 + + " order by qdz_name";
620 615 List<Map<String, Object>> lists= jdbcTemplate.query(sqlZd,
621   - new RowMapper<Map<String, Object>>(){
622   - @Override
623   - public Map<String, Object> mapRow(ResultSet rs, int rowNum) throws SQLException {
624   - Map<String, Object> m=new HashMap<String,Object>();
625   - m.put("zdm", rs.getString("qdz_name"));
626   - m.put("bcType", rs.getString("bc_type"));
627   - return m;
628   - }
629   - });
630   -
  616 + new RowMapper<Map<String, Object>>(){
  617 + @Override
  618 + public Map<String, Object> mapRow(ResultSet rs, int rowNum) throws SQLException {
  619 + Map<String, Object> m=new HashMap<String,Object>();
  620 + m.put("zdm", rs.getString("qdz_name"));
  621 + m.put("bcType", rs.getString("bc_type"));
  622 + return m;
  623 + }
  624 + });
  625 +
631 626 for (int i = 0; i < lists.size(); i++) {
632 627 Map<String, Object> z=new HashMap<String,Object>();
633 628 Map<String, Object> w=new HashMap<String,Object>();
... ... @@ -636,7 +631,7 @@ public class ReportServiceImpl implements ReportService{
636 631 int wbcs=0;
637 632 if(p.get("bcType").toString().equals("normal")){
638 633 for (int j = 0; j < listj.size(); j++) {
639   - if(listj.get(j).get("qdz_name").toString().equals(p.get("zdm").toString()) &&
  634 + if(listj.get(j).get("qdz_name").toString().equals(p.get("zdm").toString()) &&
640 635 listj.get(j).get("bcType").toString().equals("normal")){
641 636 String time=listj.get(j).get("fcsj").toString();
642 637 long bcsj= Long.parseLong(listj.get(j).get("bcsj").toString());
... ... @@ -644,15 +639,15 @@ public class ReportServiceImpl implements ReportService{
644 639 String[] fcsjStr = time.split(":");
645 640 long fcsj= Long.parseLong(fcsjStr[0])*60+Long.parseLong(fcsjStr[1]);
646 641 long ddsj=fcsj+bcsj;
647   - if((fcsj>=zgf1 && fcsj<=zgf2) || (ddsj>=zgf1&&ddsj<=zgf2)
  642 + if((fcsj>=zgf1 && fcsj<=zgf2) || (ddsj>=zgf1&&ddsj<=zgf2)
648 643 || (fcsj<zgf1&&ddsj>zgf2)){
649 644 if(p.get("z"+clZbh)==null){
650 645 zbcs++;
651 646 p.put("z"+clZbh, clZbh);
652 647 }
653 648 }
654   -
655   - if((fcsj>=wgf1 && fcsj<=wgf2) || (ddsj>=wgf1&&ddsj<=wgf2)
  649 +
  650 + if((fcsj>=wgf1 && fcsj<=wgf2) || (ddsj>=wgf1&&ddsj<=wgf2)
656 651 || (fcsj<wgf1&&ddsj>wgf2)){
657 652 if(p.get("w"+clZbh)==null){
658 653 wbcs++;
... ... @@ -660,26 +655,26 @@ public class ReportServiceImpl implements ReportService{
660 655 }
661 656 }
662 657 }
663   -
  658 +
664 659 }
665 660 if(zbcs>0){
666   - z.put("zdm", p.get("zdm"));
667   - z.put("cls", zbcs);
668   - z.put("lx", "zqc");
669   - list_s.add(z);
  661 + z.put("zdm", p.get("zdm"));
  662 + z.put("cls", zbcs);
  663 + z.put("lx", "zqc");
  664 + list_s.add(z);
670 665 }
671 666 if(wbcs>0){
672 667 w.put("zdm", p.get("zdm"));
673   - w.put("cls", zbcs);
674   - w.put("lx", "wqc");
675   - list_s.add(w);
  668 + w.put("cls", zbcs);
  669 + w.put("lx", "wqc");
  670 + list_s.add(w);
676 671 }
677   -
  672 +
678 673 }
679   -
  674 +
680 675 if(p.get("bcType").equals("region")){
681 676 for (int j = 0; j < listj.size(); j++) {
682   - if(listj.get(j).get("qdz_name").toString().equals(p.get("zdm").toString()) &&
  677 + if(listj.get(j).get("qdz_name").toString().equals(p.get("zdm").toString()) &&
683 678 listj.get(j).get("bcType").toString().equals("region")){
684 679 String time=listj.get(j).get("fcsj").toString();
685 680 long bcsj= Long.parseLong(listj.get(j).get("bcsj").toString());
... ... @@ -687,15 +682,15 @@ public class ReportServiceImpl implements ReportService{
687 682 String[] fcsjStr = time.split(":");
688 683 long fcsj= Long.parseLong(fcsjStr[0])*60+Long.parseLong(fcsjStr[1]);
689 684 long ddsj=fcsj+bcsj;
690   - if((fcsj>=zgf1 && fcsj<=zgf2) || (ddsj>=zgf1&&ddsj<=zgf2)
  685 + if((fcsj>=zgf1 && fcsj<=zgf2) || (ddsj>=zgf1&&ddsj<=zgf2)
691 686 || (fcsj<zgf1&&ddsj>zgf2)){
692 687 if(p.get("z"+clZbh)==null){
693 688 zbcs++;
694 689 p.put("z"+clZbh, clZbh);
695 690 }
696 691 }
697   -
698   - if((fcsj>=wgf1 && fcsj<=wgf2) || (ddsj>=wgf1&&ddsj<=wgf2)
  692 +
  693 + if((fcsj>=wgf1 && fcsj<=wgf2) || (ddsj>=wgf1&&ddsj<=wgf2)
699 694 || (fcsj<wgf1&&ddsj>wgf2)){
700 695 if(p.get("w"+clZbh)==null){
701 696 wbcs++;
... ... @@ -703,22 +698,22 @@ public class ReportServiceImpl implements ReportService{
703 698 }
704 699 }
705 700 }
706   -
  701 +
707 702 }
708 703 if(zbcs>0){
709   - z.put("zdm", p.get("zdm"));
710   - z.put("cls", zbcs);
711   - z.put("lx", "zqj");
712   - list_s.add(z);
  704 + z.put("zdm", p.get("zdm"));
  705 + z.put("cls", zbcs);
  706 + z.put("lx", "zqj");
  707 + list_s.add(z);
713 708 }
714 709 if(wbcs>0){
715   - w.put("zdm", p.get("zdm"));
716   - w.put("cls", zbcs);
717   - w.put("lx", "wqj");
718   - list_s.add(w);
  710 + w.put("zdm", p.get("zdm"));
  711 + w.put("cls", zbcs);
  712 + w.put("lx", "wqj");
  713 + list_s.add(w);
719 714 }
720 715 }
721   -
  716 +
722 717 }
723 718 int a=0;
724 719 int b=0;
... ... @@ -764,47 +759,47 @@ public class ReportServiceImpl implements ReportService{
764 759 status=false;
765 760 }
766 761 }
767   -
  762 +
768 763 }
769 764 return list;
770 765 }
771   -
  766 +
772 767 @Override
773 768 public List<Map<String, Object>> tbodyTime4(String line, String ttinfo) {
774 769 List<Map<String, Object>> list =new ArrayList<>();
775 770 // TODO Auto-generated method stub
776 771 //最早营运时间 区分夜宵线
777   - String sqlMinYysj="select start_opt from bsth_c_line_config where "
778   - + " id = ("
779   - + "select max(id) from bsth_c_line_config where line ='"+BasicData.lineId2CodeMap.inverse().get(line) +"'"
780   - + ")";
781   - String minfcsj=jdbcTemplate.queryForObject(sqlMinYysj, String.class);
782   -
  772 + String sqlMinYysj="select start_opt from bsth_c_line_config where "
  773 + + " id = ("
  774 + + "select max(id) from bsth_c_line_config where line ='"+BasicData.lineId2CodeMap.inverse().get(line) +"'"
  775 + + ")";
  776 + String minfcsj=jdbcTemplate.queryForObject(sqlMinYysj, String.class);
  777 +
783 778 //查询全程
784 779 String sqlqc="select t.* from ( "
785   - + " (SELECT bc_type, fcsj,qdz,2 as xh,xl_dir,qdz_name FROM bsth_c_s_ttinfo_detail "
786   - + " where ttinfo ='"+ttinfo+"' and (bc_type='normal' || bc_type='region') "
787   - + " and fcsj <='"+minfcsj+"') "
788   - + " union "
789   - + " (SELECT bc_type, fcsj,qdz,1 as xh,xl_dir,qdz_name FROM bsth_c_s_ttinfo_detail "
790   - + " where ttinfo ='"+ttinfo+"' and (bc_type='normal' || bc_type='region') "
791   - + " and fcsj > '"+minfcsj+"') "
792   - + "order by xl_dir,xh,fcsj ) t ";
  780 + + " (SELECT bc_type, fcsj,qdz,2 as xh,xl_dir,qdz_name FROM bsth_c_s_ttinfo_detail "
  781 + + " where ttinfo ='"+ttinfo+"' and (bc_type='normal' || bc_type='region') "
  782 + + " and fcsj <='"+minfcsj+"') "
  783 + + " union "
  784 + + " (SELECT bc_type, fcsj,qdz,1 as xh,xl_dir,qdz_name FROM bsth_c_s_ttinfo_detail "
  785 + + " where ttinfo ='"+ttinfo+"' and (bc_type='normal' || bc_type='region') "
  786 + + " and fcsj > '"+minfcsj+"') "
  787 + + "order by xl_dir,xh,fcsj ) t ";
793 788 List<Map<String, String>> qclist= jdbcTemplate.query(sqlqc,
794   - new RowMapper<Map<String, String>>(){
795   - @Override
796   - public Map<String, String> mapRow(ResultSet rs, int rowNum) throws SQLException {
797   - Map<String, String> m=new HashMap<String,String>();
798   - m.put("qdz_name", rs.getString("qdz_name"));
799   - m.put("bcType", rs.getString("bc_type"));
800   - m.put("fcsj", rs.getString("fcsj"));
801   - m.put("xl", rs.getString("xl_dir"));
802   - m.put("xh", rs.getString("xh"));
803   - return m;
804   - }
805   -
806   - });
807   -
  789 + new RowMapper<Map<String, String>>(){
  790 + @Override
  791 + public Map<String, String> mapRow(ResultSet rs, int rowNum) throws SQLException {
  792 + Map<String, String> m=new HashMap<String,String>();
  793 + m.put("qdz_name", rs.getString("qdz_name"));
  794 + m.put("bcType", rs.getString("bc_type"));
  795 + m.put("fcsj", rs.getString("fcsj"));
  796 + m.put("xl", rs.getString("xl_dir"));
  797 + m.put("xh", rs.getString("xh"));
  798 + return m;
  799 + }
  800 +
  801 + });
  802 +
808 803 List<List<Map<String, String>>> mapList = new ArrayList<List<Map<String,String>>>();
809 804 mapList.add(new ArrayList<Map<String, String>>());
810 805 mapList.add(new ArrayList<Map<String, String>>());
... ... @@ -816,7 +811,7 @@ public class ReportServiceImpl implements ReportService{
816 811 mapList.get(1).add(m);
817 812 }
818 813 }
819   -
  814 +
820 815 for(int i = 0; i < mapList.size(); i++){
821 816 List<Map<String, String>> l = mapList.get(i);
822 817 Map<String, Object> tempMap = new HashMap<String, Object>();
... ... @@ -852,33 +847,33 @@ public class ReportServiceImpl implements ReportService{
852 847 if(sxqdz.length()!=0 || xxqdz.length()!=0)
853 848 list.add(tempMap);
854 849 }
855   -
  850 +
856 851 return list;
857 852 }
858 853 @Override
859 854 public List<Map<String, Object>> tbodyTime5(String line, String ttinfo) {
860 855 // TODO Auto-generated method stub
861 856 //最早营运时间 区分夜宵线
862   - String sqlMinYysj="select start_opt from bsth_c_line_config where line = '"+BasicData.lineId2CodeMap.inverse().get(line) +"'";
863   - String minfcsj=jdbcTemplate.queryForObject(sqlMinYysj, String.class);
864   - String[] minSjs = minfcsj.split(":");
865   - int minSj=Integer.parseInt(minSjs[0])*60+Integer.parseInt(minSjs[1]);
866   - //查询时间里程
867   - String sqlPc=" (SELECT jhlc,fcsj,bcsj,bc_type,lp,xl_dir,ists,2 as xh FROM "
868   - + " bsth_c_s_ttinfo_detail where ttinfo ='"+ttinfo+"' and "
869   - + " fcsj <='"+minfcsj+"' and bc_type!='ldks'"
870   - + " and bc_type !='region') "
871   - + " union "
872   - + " (SELECT jhlc,fcsj,bcsj,bc_type,lp,xl_dir,ists,1 as xh FROM "
873   - + " bsth_c_s_ttinfo_detail where ttinfo ='"+ttinfo+"' and "
874   - + " fcsj > '"+minfcsj+"' and bc_type!='ldks' "
875   - + " and bc_type !='region') "
876   - + " order by xh, lp,fcsj";
877   - Map<String, Object> map=new HashMap<String,Object>();
878   - List<Map<String, Object>> list= jdbcTemplate.query(sqlPc,
879   - new RowMapper<Map<String, Object>>(){
  857 + String sqlMinYysj="select start_opt from bsth_c_line_config where line = '"+BasicData.lineId2CodeMap.inverse().get(line) +"'";
  858 + String minfcsj=jdbcTemplate.queryForObject(sqlMinYysj, String.class);
  859 + String[] minSjs = minfcsj.split(":");
  860 + int minSj=Integer.parseInt(minSjs[0])*60+Integer.parseInt(minSjs[1]);
  861 + //查询时间里程
  862 + String sqlPc=" (SELECT jhlc,fcsj,bcsj,bc_type,lp,xl_dir,ists,2 as xh FROM "
  863 + + " bsth_c_s_ttinfo_detail where ttinfo ='"+ttinfo+"' and "
  864 + + " fcsj <='"+minfcsj+"' and bc_type!='ldks'"
  865 + + " and bc_type !='region') "
  866 + + " union "
  867 + + " (SELECT jhlc,fcsj,bcsj,bc_type,lp,xl_dir,ists,1 as xh FROM "
  868 + + " bsth_c_s_ttinfo_detail where ttinfo ='"+ttinfo+"' and "
  869 + + " fcsj > '"+minfcsj+"' and bc_type!='ldks' "
  870 + + " and bc_type !='region') "
  871 + + " order by xh, lp,fcsj";
  872 + Map<String, Object> map=new HashMap<String,Object>();
  873 + List<Map<String, Object>> list= jdbcTemplate.query(sqlPc,
  874 + new RowMapper<Map<String, Object>>(){
880 875 @Override
881   - public Map<String, Object> mapRow(ResultSet rs, int rowNum) throws SQLException {
  876 + public Map<String, Object> mapRow(ResultSet rs, int rowNum) throws SQLException {
882 877 Map<String, Object> m=new HashMap<String,Object>();
883 878 m.put("fcsj", rs.getString("fcsj"));
884 879 m.put("yygl", rs.getString("jhlc")==null?"0":rs.getString("jhlc"));
... ... @@ -891,11 +886,11 @@ public class ReportServiceImpl implements ReportService{
891 886 if(rs.getString("xh").equals("2")){
892 887 m.put("fcsj", (Integer.valueOf(split[0]) + 24) + ":"+split[1]);
893 888 }
894   -
  889 +
895 890 return m;
896 891 }
897 892 });
898   - List<Map<String, Object>> newList=new ArrayList<Map<String,Object>>();
  893 + List<Map<String, Object>> newList=new ArrayList<Map<String,Object>>();
899 894 int yysxZq=0,yyxxZq=0,tzsxZq=0,tzxxZq=0,minZqcj=0,maxZqcj=0,sxcountZqbc=0,xxcountZqbc=0; //早前
900 895 int yysxZgf=0,yyxxZgf=0,tzsxZgf=0,tzxxZgf=0,minZgfcj=0,maxZgfcj=0,sxcountZgfbc=0,xxcountZgfbc=0;//早高峰
901 896 int yysxZw=0,yyxxZw=0,tzsxZw=0,tzxxZw=0,minZwcj=0,maxZwcj=0,sxcountZwbc=0,xxcountZwbc=0;//中午
... ... @@ -906,7 +901,7 @@ public class ReportServiceImpl implements ReportService{
906 901 List<Integer> zwFcsj0=new ArrayList<Integer>();
907 902 List<Integer> wgfFcsj0=new ArrayList<Integer>();
908 903 List<Integer> whFcsj0=new ArrayList<Integer>();
909   -
  904 +
910 905 List<Integer> zqFcsj1=new ArrayList<Integer>();
911 906 List<Integer> zgfFcsj1=new ArrayList<Integer>();
912 907 List<Integer> zwFcsj1=new ArrayList<Integer>();
... ... @@ -934,9 +929,9 @@ public class ReportServiceImpl implements ReportService{
934 929 ists=false;
935 930 }
936 931 }else{
937   - if(temp>fcsjT){
938   - temp=fcsjT+bcsj;
939   - }
  932 +// if(temp>fcsjT){
  933 +// temp=fcsjT;
  934 +// }
940 935 if(bcType.equals("in") || bcType.equals("out")){
941 936 temp = fcsjT+bcsj;
942 937 lpname=m.get("lp").toString();
... ... @@ -944,141 +939,141 @@ public class ReportServiceImpl implements ReportService{
944 939 ists=false;
945 940 }else{
946 941 // if(xlDir==0){
947   - //上行数据
948   - if(fcsjT>= minSj && fcsjT <= 6*60+30){
949   - //早高峰前
950   - if(xlDir==0){
951   - yysxZq +=bcsj;
952   - sxcountZqbc ++;
953   - zqFcsj0.add(fcsjT);
954   - }else{
955   - yyxxZq +=bcsj;
956   - xxcountZqbc ++;
957   - zqFcsj1.add(fcsjT);
958   - }
959   - if(ists){
960   - if(lpname.equals(m.get("lp").toString())){
961   - if(dir==0)
962   - tzsxZq +=fcsjT-temp;
963   - else
964   - tzxxZq +=fcsjT-temp;
965   - }
966   - }
967   - temp = fcsjT+bcsj;
968   -
969   - }else if(fcsjT > 6*60+30 && fcsjT <= 8*60+30){
970   - //早高峰
971   - if(xlDir==0){
972   - yysxZgf +=bcsj;
973   - sxcountZgfbc ++;
974   - zgfFcsj0.add(fcsjT);
  942 + //上行数据
  943 + if(fcsjT>= minSj && fcsjT <= 6*60+30){
  944 + //早高峰前
  945 + if(xlDir==0){
  946 + yysxZq +=bcsj;
  947 + sxcountZqbc ++;
  948 + zqFcsj0.add(fcsjT);
  949 + }else{
  950 + yyxxZq +=bcsj;
  951 + xxcountZqbc ++;
  952 + zqFcsj1.add(fcsjT);
  953 + }
  954 + if(ists){
  955 + if(lpname.equals(m.get("lp").toString())){
  956 + if(dir==0)
  957 + tzsxZq +=fcsjT-temp;
  958 + else
  959 + tzxxZq +=fcsjT-temp;
  960 + }
  961 + }
  962 + temp = fcsjT+bcsj;
  963 +
  964 + }else if(fcsjT > 6*60+30 && fcsjT <= 8*60+30){
  965 + //早高峰
  966 + if(xlDir==0){
  967 + yysxZgf +=bcsj;
  968 + sxcountZgfbc ++;
  969 + zgfFcsj0.add(fcsjT);
  970 + }else{
  971 + yyxxZgf +=bcsj;
  972 + xxcountZgfbc ++;
  973 + zgfFcsj1.add(fcsjT);
  974 + }
  975 +
  976 + if(ists){
  977 + if(lpname.equals(m.get("lp").toString())){
  978 + if(dir==0){
  979 + if(fcsjT_>= minSj && fcsjT_ <= 6*60+30)
  980 + tzsxZq +=fcsjT-temp;
  981 + else
  982 + tzsxZgf +=fcsjT-temp;
975 983 }else{
976   - yyxxZgf +=bcsj;
977   - xxcountZgfbc ++;
978   - zgfFcsj1.add(fcsjT);
979   - }
980   -
981   - if(ists){
982   - if(lpname.equals(m.get("lp").toString())){
983   - if(dir==0){
984   - if(fcsjT>= minSj && fcsjT <= 6*60+30)
985   - tzsxZq +=fcsjT-temp;
986   - else
987   - tzsxZgf +=fcsjT-temp;
988   - }else{
989   - if(fcsjT_>= minSj && fcsjT_ <= 6*60+30)
990   - tzxxZq +=fcsjT-temp;
991   - else
992   - tzxxZgf +=fcsjT-temp;
993   - }
994   - }
  984 + if(fcsjT_>= minSj && fcsjT_ <= 6*60+30)
  985 + tzxxZq +=fcsjT-temp;
  986 + else
  987 + tzxxZgf +=fcsjT-temp;
995 988 }
996   - temp =fcsjT+bcsj;
997   -
998   - }else if(fcsjT > 8*60+30 && fcsjT <= 16*60){
999   - //中午
1000   - if(xlDir==0){
1001   - yysxZw +=bcsj;
1002   - sxcountZwbc ++;
1003   - zwFcsj0.add(fcsjT);
  989 + }
  990 + }
  991 + temp =fcsjT+bcsj;
  992 +
  993 + }else if(fcsjT > 8*60+30 && fcsjT <= 16*60){
  994 + //中午
  995 + if(xlDir==0){
  996 + yysxZw +=bcsj;
  997 + sxcountZwbc ++;
  998 + zwFcsj0.add(fcsjT);
  999 + }else{
  1000 + yyxxZw +=bcsj;
  1001 + xxcountZwbc ++;
  1002 + zwFcsj1.add(fcsjT);
  1003 + }
  1004 + if(ists){
  1005 + if(lpname.equals(m.get("lp").toString())){
  1006 + if(dir==0){
  1007 + if(fcsjT_ > 6*60+30 && fcsjT_ <= 8*60+30)
  1008 + tzsxZgf +=fcsjT-temp;
  1009 + else
  1010 + tzsxZw +=fcsjT-temp;
1004 1011 }else{
1005   - yyxxZw +=bcsj;
1006   - xxcountZwbc ++;
1007   - zwFcsj1.add(fcsjT);
1008   - }
1009   - if(ists){
1010   - if(lpname.equals(m.get("lp").toString())){
1011   - if(dir==0){
1012   - if(fcsjT_ > 6*60+30 && fcsjT_ <= 8*60+30)
1013   - tzsxZgf +=fcsjT-temp;
1014   - else
1015   - tzsxZw +=fcsjT-temp;
1016   - }else{
1017   - if(fcsjT_ > 6*60+30 && fcsjT_ <= 8*60+30)
1018   - tzxxZgf +=fcsjT-temp;
1019   - else
1020   - tzxxZw +=fcsjT-temp;
1021   - }
1022   - }
  1012 + if(fcsjT_ > 6*60+30 && fcsjT_ <= 8*60+30)
  1013 + tzxxZgf +=fcsjT-temp;
  1014 + else
  1015 + tzxxZw +=fcsjT-temp;
1023 1016 }
1024   - temp =fcsjT+bcsj;
1025   - }else if(fcsjT > 16*60 && fcsjT <= 18*60){
1026   - //晚高峰
1027   - if(xlDir==0){
1028   - yysxWgf +=bcsj;
1029   - sxcountWgfbc ++;
1030   - wgfFcsj0.add(fcsjT);
  1017 + }
  1018 + }
  1019 + temp =fcsjT+bcsj;
  1020 + }else if(fcsjT > 16*60 && fcsjT <= 18*60){
  1021 + //晚高峰
  1022 + if(xlDir==0){
  1023 + yysxWgf +=bcsj;
  1024 + sxcountWgfbc ++;
  1025 + wgfFcsj0.add(fcsjT);
  1026 + }else{
  1027 + yyxxWgf +=bcsj;
  1028 + xxcountWgfbc ++;
  1029 + wgfFcsj1.add(fcsjT);
  1030 + }
  1031 +
  1032 + if(ists){
  1033 + if(lpname.equals(m.get("lp").toString())){
  1034 + if(dir==0){
  1035 + if(fcsjT_ > 8*60+30 && fcsjT_ <= 16*60)
  1036 + tzsxZw +=fcsjT-temp;
  1037 + else
  1038 + tzsxWgf +=fcsjT-temp;
1031 1039 }else{
1032   - yyxxWgf +=bcsj;
1033   - xxcountWgfbc ++;
1034   - wgfFcsj1.add(fcsjT);
1035   - }
1036   -
1037   - if(ists){
1038   - if(lpname.equals(m.get("lp").toString())){
1039   - if(dir==0){
1040   - if(fcsjT_ > 8*60+30 && fcsjT_ <= 16*60)
1041   - tzsxZw +=fcsjT-temp;
1042   - else
1043   - tzsxWgf +=fcsjT-temp;
1044   - }else{
1045   - if(fcsjT_ > 8*60+30 && fcsjT_ <= 16*60)
1046   - tzxxZw +=fcsjT-temp;
1047   - else
1048   - tzxxWgf +=fcsjT-temp;
1049   - }
1050   - }
  1040 + if(fcsjT_ > 8*60+30 && fcsjT_ <= 16*60)
  1041 + tzxxZw +=fcsjT-temp;
  1042 + else
  1043 + tzxxWgf +=fcsjT-temp;
1051 1044 }
1052   - temp =fcsjT+bcsj;
1053   - }else{
1054   - //晚高峰后
1055   - if(xlDir==0){
1056   - yysxWh +=bcsj;
1057   - sxcountWhbc ++;
1058   - whFcsj0.add(fcsjT);
  1045 + }
  1046 + }
  1047 + temp =fcsjT+bcsj;
  1048 + }else{
  1049 + //晚高峰后
  1050 + if(xlDir==0){
  1051 + yysxWh +=bcsj;
  1052 + sxcountWhbc ++;
  1053 + whFcsj0.add(fcsjT);
  1054 + }else{
  1055 + yyxxWh +=bcsj;
  1056 + xxcountWhbc ++;
  1057 + whFcsj1.add(fcsjT);
  1058 + }
  1059 + if(ists){
  1060 + if(lpname.equals(m.get("lp").toString())){
  1061 + if(dir==0){
  1062 + if(fcsjT_ > 16*60 && fcsjT_ <= 18*60)
  1063 + tzsxWgf +=fcsjT-temp;
  1064 + else
  1065 + tzsxWh +=fcsjT-temp;
1059 1066 }else{
1060   - yyxxWh +=bcsj;
1061   - xxcountWhbc ++;
1062   - whFcsj1.add(fcsjT);
  1067 + if(fcsjT_ > 16*60 && fcsjT_ <= 18*60)
  1068 + tzxxWgf +=fcsjT-temp;
  1069 + else
  1070 + tzxxWh +=fcsjT-temp;
1063 1071 }
1064   - if(ists){
1065   - if(lpname.equals(m.get("lp").toString())){
1066   - if(dir==0){
1067   - if(fcsjT_ > 16*60 && fcsjT_ <= 18*60)
1068   - tzsxWgf +=fcsjT-temp;
1069   - else
1070   - tzsxWh +=fcsjT-temp;
1071   - }else{
1072   - if(fcsjT_ > 16*60 && fcsjT_ <= 18*60)
1073   - tzxxWgf +=fcsjT-temp;
1074   - else
1075   - tzxxWh +=fcsjT-temp;
1076   - }
1077   - }
1078   - }
1079   - temp =fcsjT+bcsj;
1080 1072 }
1081   -
  1073 + }
  1074 + temp =fcsjT+bcsj;
  1075 + }
  1076 +
1082 1077 /*}else{
1083 1078 //下行数据
1084 1079 if(fcsjT>= minSj && fcsjT <= 6*60+30){
... ... @@ -1151,19 +1146,19 @@ public class ReportServiceImpl implements ReportService{
1151 1146 }
1152 1147 // }
1153 1148 }*/
1154   - lpname=m.get("lp").toString();
1155   - fcsjT_=fcsjT;
1156   - dir =xlDir;
1157   - if(m.get("ists").toString().trim().equals("1")){
1158   - ists=false;
1159   - }else{
1160   - ists = true;
1161   - }
1162   - }
  1149 + lpname=m.get("lp").toString();
  1150 + fcsjT_=fcsjT;
  1151 + dir =xlDir;
  1152 + if(m.get("ists").toString().trim().equals("1")){
  1153 + ists=false;
  1154 + }else{
  1155 + ists = true;
  1156 + }
  1157 + }
1163 1158 }
1164   -
  1159 +
1165 1160 }
1166   -
  1161 +
1167 1162 //---------------------------------------早前
1168 1163 List<Integer> cjs = new ArrayList<Integer>();
1169 1164 Collections.sort(zqFcsj0);
... ... @@ -1175,7 +1170,7 @@ public class ReportServiceImpl implements ReportService{
1175 1170 cjs.add(zqFcsj0.get(i)-fcsjs);
1176 1171 fcsjs=zqFcsj0.get(i);
1177 1172 }
1178   -
  1173 +
1179 1174 }
1180 1175 Collections.sort(zqFcsj1);
1181 1176 int fcsjx=0;
... ... @@ -1186,30 +1181,42 @@ public class ReportServiceImpl implements ReportService{
1186 1181 cjs.add(zqFcsj1.get(i)-fcsjx);
1187 1182 fcsjx =zqFcsj1.get(i);
1188 1183 }
1189   -
  1184 +
1190 1185 }
1191 1186 Collections.sort(cjs);
1192 1187 for(int i : cjs){
1193 1188 zcj += i;
1194 1189 }
1195 1190 Map<String, Object> tempMap = new HashMap<String, Object>();
  1191 + double sxtszq=0.0;
  1192 + double sxsjzq=0.0;
  1193 + if(sxcountZqbc>0){
  1194 + sxtszq=Arith.div(tzsxZq, sxcountZqbc, 1);
  1195 + sxsjzq=Arith.div(yysxZq, sxcountZqbc,1);
  1196 + }
  1197 +
  1198 + double xxtszq=0.0;
  1199 + double xxsjzq=0.0;
  1200 + if(xxcountZqbc>0){
  1201 + xxtszq=Arith.div(tzxxZq, xxcountZqbc, 1);
  1202 + xxsjzq=Arith.div(yyxxZq, xxcountZqbc,1);
  1203 + }
1196 1204 tempMap.put("sjd", "(首)——6:30");
1197   - tempMap.put("sxsj", sxcountZqbc != 0 ? yysxZq / sxcountZqbc : "0");
1198   - tempMap.put("xxsj", xxcountZqbc != 0 ? yyxxZq / xxcountZqbc : "0");
1199   - tempMap.put("sxtssj", sxcountZqbc!= 0 ? tzsxZq / sxcountZqbc : "0");
1200   - tempMap.put("xxtssj", xxcountZqbc != 0 ? tzxxZq / xxcountZqbc : "0");
1201   - tempMap.put("fqsj", Integer.valueOf(tempMap.get("sxsj").toString()) + Integer.valueOf(tempMap.get("xxsj").toString())
1202   - + Integer.valueOf(tempMap.get("sxtssj").toString()) + Integer.valueOf(tempMap.get("xxtssj").toString()));
  1205 + tempMap.put("sxsj", sxsjzq);
  1206 + tempMap.put("xxsj", xxsjzq);
  1207 + tempMap.put("sxtssj", sxtszq);
  1208 + tempMap.put("xxtssj", xxtszq);
  1209 + tempMap.put("fqsj", Arith.add(Arith.add(sxtszq, sxsjzq), Arith.add(xxtszq, xxsjzq)));
1203 1210 tempMap.put("cjqj", cjs.size()>0?cjs.get(0)+"——"+cjs.get(cjs.size()-1):"——");
1204 1211 tempMap.put("pjcj", cjs.size()>0?zcj/cjs.size():"/");
1205 1212 newList.add(tempMap);
1206   -
  1213 +
1207 1214 //----------------------------------早高峰
1208 1215 cjs = new ArrayList<Integer>();
1209 1216 zcj =0;
1210   -
  1217 +
1211 1218 Collections.sort(zgfFcsj0);
1212   - fcsjs=0;
  1219 + fcsjs=0;
1213 1220 for (int i = 0; i < zgfFcsj0.size(); i++) {
1214 1221 if(i==0){
1215 1222 fcsjs =zgfFcsj0.get(i);
... ... @@ -1217,10 +1224,10 @@ public class ReportServiceImpl implements ReportService{
1217 1224 cjs.add(zgfFcsj0.get(i)-fcsjs);
1218 1225 fcsjs=zgfFcsj0.get(i);
1219 1226 }
1220   -
  1227 +
1221 1228 }
1222 1229 Collections.sort(zgfFcsj1);
1223   - fcsjx=0;
  1230 + fcsjx=0;
1224 1231 for (int i = 0; i < zgfFcsj1.size(); i++) {
1225 1232 if(i==0){
1226 1233 fcsjx =zgfFcsj1.get(i);
... ... @@ -1228,30 +1235,43 @@ public class ReportServiceImpl implements ReportService{
1228 1235 cjs.add(zgfFcsj1.get(i)-fcsjx);
1229 1236 fcsjx =zgfFcsj1.get(i);
1230 1237 }
1231   -
  1238 +
1232 1239 }
1233 1240 Collections.sort(cjs);
1234 1241 for(int i : cjs){
1235 1242 zcj += i;
1236 1243 }
1237   -
  1244 + double sxtszgf=0.0;
  1245 + double sxsjzgf=0.0;
  1246 + if(sxcountZgfbc>0){
  1247 + sxtszgf=Arith.div(tzsxZgf, sxcountZgfbc, 1);
  1248 + sxsjzgf =Arith.div(yysxZgf, sxcountZgfbc, 1);
  1249 + }
  1250 +
  1251 + double xxtszgf=0.0;
  1252 + double xxsjzgf=0.0;
  1253 + if(xxcountZgfbc>0){
  1254 + xxtszgf=Arith.div(tzxxZgf, xxcountZgfbc, 1);
  1255 + xxsjzgf=Arith.div(yyxxZgf, xxcountZgfbc,1);
  1256 + }
  1257 +
  1258 +
1238 1259 tempMap = new HashMap<String, Object>();
1239 1260 tempMap.put("sjd", "6:31——8:30");
1240   - tempMap.put("sxsj", sxcountZgfbc != 0 ? yysxZgf / sxcountZgfbc : "0");
1241   - tempMap.put("xxsj", xxcountZgfbc != 0 ? yyxxZgf / xxcountZgfbc : "0");
1242   - tempMap.put("sxtssj", sxcountZgfbc!= 0 ? tzsxZgf / sxcountZgfbc : "0");
1243   - tempMap.put("xxtssj", xxcountZgfbc != 0 ? tzxxZgf / xxcountZgfbc : "0");
1244   - tempMap.put("fqsj", Integer.valueOf(tempMap.get("sxsj").toString()) + Integer.valueOf(tempMap.get("xxsj").toString())
1245   - + Integer.valueOf(tempMap.get("sxtssj").toString()) + Integer.valueOf(tempMap.get("xxtssj").toString()));
  1261 + tempMap.put("sxsj", sxsjzgf);
  1262 + tempMap.put("xxsj", xxsjzgf);
  1263 + tempMap.put("sxtssj", sxtszgf);
  1264 + tempMap.put("xxtssj", xxtszgf);
  1265 + tempMap.put("fqsj", Arith.add(Arith.add(sxtszgf, sxsjzgf), Arith.add(xxtszgf, xxsjzgf)));
1246 1266 tempMap.put("cjqj", cjs.size()>0?cjs.get(0)+"——"+cjs.get(cjs.size()-1):"——");
1247 1267 tempMap.put("pjcj", cjs.size()>0?zcj/cjs.size():"/");
1248 1268 newList.add(tempMap);
1249 1269 //----------------------------------------------中午
1250 1270 cjs = new ArrayList<Integer>();
1251 1271 zcj =0;
1252   -
  1272 +
1253 1273 Collections.sort(zwFcsj0);
1254   - fcsjs=0;
  1274 + fcsjs=0;
1255 1275 for (int i = 0; i < zwFcsj0.size(); i++) {
1256 1276 if(i==0){
1257 1277 fcsjs =zwFcsj0.get(i);
... ... @@ -1259,10 +1279,10 @@ public class ReportServiceImpl implements ReportService{
1259 1279 cjs.add(zwFcsj0.get(i)-fcsjs);
1260 1280 fcsjs=zwFcsj0.get(i);
1261 1281 }
1262   -
  1282 +
1263 1283 }
1264 1284 Collections.sort(zwFcsj1);
1265   - fcsjx=0;
  1285 + fcsjx=0;
1266 1286 for (int i = 0; i < zwFcsj1.size(); i++) {
1267 1287 if(i==0){
1268 1288 fcsjx =zwFcsj1.get(i);
... ... @@ -1270,30 +1290,41 @@ public class ReportServiceImpl implements ReportService{
1270 1290 cjs.add(zwFcsj1.get(i)-fcsjx);
1271 1291 fcsjx =zwFcsj1.get(i);
1272 1292 }
1273   -
  1293 +
1274 1294 }
1275 1295 Collections.sort(cjs);
1276 1296 for(int i : cjs){
1277 1297 zcj += i;
1278 1298 }
1279   -
  1299 + double sxtzsjzw=0.0;
  1300 + double sxsjsjzw=0.0;
  1301 + if(sxcountZwbc>0){
  1302 + sxtzsjzw=Arith.div(tzsxZw, sxcountZwbc, 1);
  1303 + sxsjsjzw=Arith.div(yysxZw, sxcountZwbc,1);
  1304 + }
  1305 +
  1306 + double xxtzsjzw=0.0;
  1307 + double xxsjsjzw=0.0;
  1308 + if(xxcountZwbc>0){
  1309 + xxtzsjzw=Arith.div(tzxxZw, xxcountZwbc,1);
  1310 + xxsjsjzw=Arith.div(yyxxZw, xxcountZwbc, 1);
  1311 + }
1280 1312 tempMap = new HashMap<String, Object>();
1281 1313 tempMap.put("sjd", "8:31——16:00");
1282   - tempMap.put("sxsj", sxcountZwbc != 0 ? yysxZw / sxcountZwbc : "0");
1283   - tempMap.put("xxsj", xxcountZwbc != 0 ? yyxxZw / xxcountZwbc : "0");
1284   - tempMap.put("sxtssj", sxcountZwbc!= 0 ? tzsxZw / sxcountZwbc : "0");
1285   - tempMap.put("xxtssj", xxcountZwbc != 0 ? tzxxZw / xxcountZwbc : "0");
1286   - tempMap.put("fqsj", Integer.valueOf(tempMap.get("sxsj").toString()) + Integer.valueOf(tempMap.get("xxsj").toString())
1287   - + Integer.valueOf(tempMap.get("sxtssj").toString()) + Integer.valueOf(tempMap.get("xxtssj").toString()));
  1314 + tempMap.put("sxsj", sxsjsjzw);
  1315 + tempMap.put("xxsj", xxsjsjzw);
  1316 + tempMap.put("sxtssj", sxtzsjzw);
  1317 + tempMap.put("xxtssj", xxtzsjzw);
  1318 + tempMap.put("fqsj", Arith.add(Arith.add(sxtzsjzw, sxsjsjzw), Arith.add(xxtzsjzw, xxsjsjzw)));
1288 1319 tempMap.put("cjqj", cjs.size()>0?cjs.get(0)+"——"+cjs.get(cjs.size()-1):"——");
1289 1320 tempMap.put("pjcj", cjs.size()>0?zcj/cjs.size():"/");
1290 1321 newList.add(tempMap);
1291 1322 //-------------------------------------------------晚高峰
1292 1323 cjs = new ArrayList<Integer>();
1293 1324 zcj =0;
1294   -
  1325 +
1295 1326 Collections.sort(wgfFcsj0);
1296   - fcsjs=0;
  1327 + fcsjs=0;
1297 1328 for (int i = 0; i < wgfFcsj0.size(); i++) {
1298 1329 if(i==0){
1299 1330 fcsjs =wgfFcsj0.get(i);
... ... @@ -1301,10 +1332,10 @@ public class ReportServiceImpl implements ReportService{
1301 1332 cjs.add(wgfFcsj0.get(i)-fcsjs);
1302 1333 fcsjs=wgfFcsj0.get(i);
1303 1334 }
1304   -
  1335 +
1305 1336 }
1306 1337 Collections.sort(wgfFcsj1);
1307   - fcsjx=0;
  1338 + fcsjx=0;
1308 1339 for (int i = 0; i < wgfFcsj1.size(); i++) {
1309 1340 if(i==0){
1310 1341 fcsjx =wgfFcsj1.get(i);
... ... @@ -1312,31 +1343,44 @@ public class ReportServiceImpl implements ReportService{
1312 1343 cjs.add(wgfFcsj1.get(i)-fcsjx);
1313 1344 fcsjx =wgfFcsj1.get(i);
1314 1345 }
1315   -
  1346 +
1316 1347 }
1317 1348 Collections.sort(cjs);
1318 1349 for(int i : cjs){
1319 1350 zcj += i;
1320 1351 }
1321   -
  1352 +
  1353 + double sxtzsjwgf=0.0;
  1354 + double sxsjsjwgf=0.0;
  1355 + if(sxcountWgfbc>0){
  1356 + sxtzsjwgf=Arith.div(tzsxWgf, sxcountWgfbc, 1);
  1357 + sxsjsjwgf=Arith.div(yysxWgf, sxcountWgfbc,1);
  1358 + }
  1359 +
  1360 + double xxtzsjwgf=0.0;
  1361 + double xxsjsjwgf=0.0;
  1362 + if(xxcountWgfbc>0){
  1363 + xxtzsjwgf=Arith.div(tzxxWgf, xxcountWgfbc, 1);
  1364 + xxsjsjwgf=Arith.div(yyxxWgf, xxcountWgfbc,1);
  1365 + }
  1366 +
1322 1367 tempMap = new HashMap<String, Object>();
1323 1368 tempMap.put("sjd", "16:01——18:00");
1324   - tempMap.put("sxsj", sxcountWgfbc != 0 ? yysxWgf / sxcountWgfbc : "0");
1325   - tempMap.put("xxsj", xxcountWgfbc != 0 ? yyxxWgf / xxcountWgfbc : "0");
1326   - tempMap.put("sxtssj", sxcountWgfbc!= 0 ? tzsxWgf / sxcountWgfbc : "0");
1327   - tempMap.put("xxtssj", xxcountWgfbc != 0 ? tzxxWgf / xxcountWgfbc : "0");
1328   - tempMap.put("fqsj", Integer.valueOf(tempMap.get("sxsj").toString()) + Integer.valueOf(tempMap.get("xxsj").toString())
1329   - + Integer.valueOf(tempMap.get("sxtssj").toString()) + Integer.valueOf(tempMap.get("xxtssj").toString()));
  1369 + tempMap.put("sxsj", sxsjsjwgf);
  1370 + tempMap.put("xxsj", xxsjsjwgf);
  1371 + tempMap.put("sxtssj", sxtzsjwgf);
  1372 + tempMap.put("xxtssj", xxtzsjwgf);
  1373 + tempMap.put("fqsj", Arith.add(Arith.add(sxsjsjwgf, sxtzsjwgf), Arith.add(xxsjsjwgf, xxtzsjwgf)));
1330 1374 tempMap.put("cjqj", cjs.size()>0?cjs.get(0)+"——"+cjs.get(cjs.size()-1):"——");
1331 1375 tempMap.put("pjcj", cjs.size()>0?zcj/cjs.size():"/");
1332 1376 newList.add(tempMap);
1333   -
  1377 +
1334 1378 //----------------------------------晚后
1335 1379 cjs = new ArrayList<Integer>();
1336 1380 zcj =0;
1337   -
  1381 +
1338 1382 Collections.sort(whFcsj0);
1339   - fcsjs=0;
  1383 + fcsjs=0;
1340 1384 for (int i = 0; i < whFcsj0.size(); i++) {
1341 1385 if(i==0){
1342 1386 fcsjs =whFcsj0.get(i);
... ... @@ -1344,10 +1388,10 @@ public class ReportServiceImpl implements ReportService{
1344 1388 cjs.add(whFcsj0.get(i)-fcsjs);
1345 1389 fcsjs=whFcsj0.get(i);
1346 1390 }
1347   -
  1391 +
1348 1392 }
1349 1393 Collections.sort(whFcsj1);
1350   - fcsjx=0;
  1394 + fcsjx=0;
1351 1395 for (int i = 0; i < whFcsj1.size(); i++) {
1352 1396 if(i==0){
1353 1397 fcsjx =whFcsj1.get(i);
... ... @@ -1355,21 +1399,32 @@ public class ReportServiceImpl implements ReportService{
1355 1399 cjs.add(whFcsj1.get(i)-fcsjx);
1356 1400 fcsjx =whFcsj1.get(i);
1357 1401 }
1358   -
  1402 +
1359 1403 }
1360 1404 Collections.sort(cjs);
1361 1405 for(int i : cjs){
1362 1406 zcj += i;
1363 1407 }
1364   -
  1408 + double sxtzsjwh=0.0;
  1409 + double sxsjsjwh=0.0;
  1410 + if(sxcountWhbc>0){
  1411 + sxtzsjwh=Arith.div(tzsxWh,sxcountWhbc,1);
  1412 + sxsjsjwh=Arith.div(yysxWh, sxcountWhbc,1);
  1413 + }
  1414 +
  1415 + double xxtzsjwh=0.0;
  1416 + double xxsjsjwh=0.0;
  1417 + if(xxcountWhbc>0){
  1418 + xxtzsjwh=Arith.div(tzxxWh, xxcountWhbc,1);
  1419 + xxsjsjwh=Arith.div(yyxxWh, xxcountWhbc, 1);
  1420 + }
1365 1421 tempMap = new HashMap<String, Object>();
1366 1422 tempMap.put("sjd", "18:01——(末)");
1367   - tempMap.put("sxsj", sxcountWhbc != 0 ? yysxWh / sxcountWhbc : "0");
1368   - tempMap.put("xxsj", xxcountWhbc != 0 ? yyxxWh / xxcountWhbc : "0");
1369   - tempMap.put("sxtssj", sxcountWhbc!= 0 ? tzsxWh / sxcountWhbc : "0");
1370   - tempMap.put("xxtssj", xxcountWhbc != 0 ? tzxxWh / xxcountWhbc : "0");
1371   - tempMap.put("fqsj", Integer.valueOf(tempMap.get("sxsj").toString()) + Integer.valueOf(tempMap.get("xxsj").toString())
1372   - + Integer.valueOf(tempMap.get("sxtssj").toString()) + Integer.valueOf(tempMap.get("xxtssj").toString()));
  1423 + tempMap.put("sxsj", sxsjsjwh);
  1424 + tempMap.put("xxsj", xxsjsjwh);
  1425 + tempMap.put("sxtssj", sxtzsjwh);
  1426 + tempMap.put("xxtssj", xxtzsjwh);
  1427 + tempMap.put("fqsj", Arith.add(Arith.add(sxsjsjwh, sxtzsjwh), Arith.add(xxsjsjwh,xxtzsjwh)));
1373 1428 tempMap.put("cjqj", cjs.size()>0?cjs.get(0)+"——"+cjs.get(cjs.size()-1):"——");
1374 1429 tempMap.put("pjcj", cjs.size()>0?zcj/cjs.size():"/");
1375 1430 newList.add(tempMap);
... ... @@ -1517,7 +1572,7 @@ public class ReportServiceImpl implements ReportService{
1517 1572 newList.add(maps.get("8:31——16:00"));
1518 1573 newList.add(maps.get("16:01——18:00"));
1519 1574 newList.add(maps.get("18:01——(末)"));*/
1520   -
  1575 +
1521 1576 return newList;
1522 1577 }
1523 1578 @Override
... ... @@ -1533,27 +1588,27 @@ public class ReportServiceImpl implements ReportService{
1533 1588 sql += " and cl.line_code = '"+line+"'";
1534 1589 }
1535 1590 sql += " order by tt.create_date desc";
1536   -
  1591 +
1537 1592 list = jdbcTemplate.query(sql,
1538 1593 new RowMapper<Map<String, Object>>(){
1539   - @Override
1540   - public Map<String, Object> mapRow(ResultSet rs, int rowNum) throws SQLException {
1541   - Map<String, Object> map = new HashMap<String, Object>();
1542   - map.put("id", rs.getString("id"));
1543   - map.put("name", rs.getString("name"));
1544   - return map;
1545   - }
1546   - });
  1594 + @Override
  1595 + public Map<String, Object> mapRow(ResultSet rs, int rowNum) throws SQLException {
  1596 + Map<String, Object> map = new HashMap<String, Object>();
  1597 + map.put("id", rs.getString("id"));
  1598 + map.put("name", rs.getString("name"));
  1599 + return map;
  1600 + }
  1601 + });
1547 1602 }catch (Exception e) {
1548 1603 // TODO Auto-generated catch block
1549 1604 e.printStackTrace();
1550 1605 }
1551 1606 return list;
1552 1607 }
1553   -
  1608 +
1554 1609 private List<ScheduleRealInfo> getListSinfo(Map<String, Object> map){
1555 1610 List<ScheduleRealInfo> list =new ArrayList<ScheduleRealInfo>();
1556   -
  1611 +
1557 1612 String sql="select DISTINCT a.* from (select * from bsth_c_s_sp_info_real where 1=1 ";
1558 1613 if(map.get("date")!=null){
1559 1614 sql += " and schedule_date_str='"+map.get("date").toString()+"'";
... ... @@ -1562,70 +1617,70 @@ public class ReportServiceImpl implements ReportService{
1562 1617 if(map.get("line").toString()!=""){
1563 1618 sql += " and xl_bm='"+map.get("line").toString()+"'";
1564 1619 }
1565   -
  1620 +
1566 1621 }
1567 1622 if(map.get("bcType")!=null){
1568 1623 if(map.get("bcType").toString().equals("inout")){
1569 1624 sql += " and bc_type in ('in','out')";
1570 1625 }
1571   -
  1626 +
1572 1627 if(map.get("bcType").toString().equals("normal")){
1573 1628 sql += " and bc_type not in ('in','out')";
1574 1629 }
1575 1630 }
1576   -
  1631 +
1577 1632 sql += " )a left join bsth_c_s_child_task b on a.id=b.schedule";
1578 1633 list= jdbcTemplate.query(sql,
1579   - new RowMapper<ScheduleRealInfo>(){
1580   - @Override
1581   - public ScheduleRealInfo mapRow(ResultSet rs, int rowNum) throws SQLException {
1582   - ScheduleRealInfo m=new ScheduleRealInfo();
1583   - m.setId(rs.getLong("id"));
  1634 + new RowMapper<ScheduleRealInfo>(){
  1635 + @Override
  1636 + public ScheduleRealInfo mapRow(ResultSet rs, int rowNum) throws SQLException {
  1637 + ScheduleRealInfo m=new ScheduleRealInfo();
  1638 + m.setId(rs.getLong("id"));
1584 1639 // m.setBcs();
1585 1640 // m.setBcsj();
1586   - m.setClZbh(rs.getString("cl_zbh"));
1587   - m.setFcsj(rs.getString("fcsj"));
1588   - m.setFcsjActual(rs.getString("fcsj_actual"));
1589   - m.setjGh(rs.getString("j_gh"));
1590   - m.setjName(rs.getString("j_name"));
1591   - m.setJhlc(rs.getDouble("jhlc"));
1592   - m.setLpName(rs.getString("lp_name"));
1593   - m.setQdzCode(rs.getString("qdz_code"));
1594   - m.setQdzName(rs.getString("qdz_name"));
1595   - m.setRealExecDate(rs.getString("real_exec_date"));
1596   - m.setRealMileage(rs.getDouble("real_mileage"));
1597   - m.setRemarks(rs.getString("remarks"));
1598   - m.setsGh(rs.getString("s_gh"));
1599   - m.setsName(rs.getString("s_name"));
1600   - m.setScheduleDate(rs.getDate("schedule_date"));
1601   - m.setScheduleDateStr(rs.getString("schedule_date_str"));
1602   - m.setSflj(rs.getBoolean("sflj"));
1603   - m.setSpId(rs.getLong("sp_id"));
1604   - m.setStatus(rs.getInt("status"));
1605   - m.setXlBm(rs.getString("xl_bm"));
1606   - m.setXlDir(rs.getString("xl_dir"));
1607   - m.setXlName(rs.getString("xl_name"));
1608   - m.setZdsj(rs.getString("zdsj"));
1609   - m.setZdsjActual(rs.getString("zdsj_actual"));
1610   - m.setZdzCode(rs.getString("zdz_code"));
1611   - m.setZdzName(rs.getString("zdz_name"));
1612   - m.setCcno(rs.getInt("ccno"));
1613   - m.setDfAuto(rs.getBoolean("df_auto"));
1614   - m.setFgsBm(rs.getString("fgs_bm"));
1615   - m.setFgsName(rs.getString("fgs_name"));
1616   - m.setGsBm(rs.getString("gs_bm"));
1617   - m.setGsName(rs.getString("gs_name"));
1618   - m.setOnline(rs.getBoolean("online"));
1619   - m.setAdjustExps(rs.getString("adjust_exps"));
1620   - m.setReissue(rs.getBoolean("reissue"));
1621   - m.setJhlcOrig(rs.getDouble("jhlc_orig"));
1622   - return m;
1623   - }
1624   - });
1625   -
  1641 + m.setClZbh(rs.getString("cl_zbh"));
  1642 + m.setFcsj(rs.getString("fcsj"));
  1643 + m.setFcsjActual(rs.getString("fcsj_actual"));
  1644 + m.setjGh(rs.getString("j_gh"));
  1645 + m.setjName(rs.getString("j_name"));
  1646 + m.setJhlc(rs.getDouble("jhlc"));
  1647 + m.setLpName(rs.getString("lp_name"));
  1648 + m.setQdzCode(rs.getString("qdz_code"));
  1649 + m.setQdzName(rs.getString("qdz_name"));
  1650 + m.setRealExecDate(rs.getString("real_exec_date"));
  1651 + m.setRealMileage(rs.getDouble("real_mileage"));
  1652 + m.setRemarks(rs.getString("remarks"));
  1653 + m.setsGh(rs.getString("s_gh"));
  1654 + m.setsName(rs.getString("s_name"));
  1655 + m.setScheduleDate(rs.getDate("schedule_date"));
  1656 + m.setScheduleDateStr(rs.getString("schedule_date_str"));
  1657 + m.setSflj(rs.getBoolean("sflj"));
  1658 + m.setSpId(rs.getLong("sp_id"));
  1659 + m.setStatus(rs.getInt("status"));
  1660 + m.setXlBm(rs.getString("xl_bm"));
  1661 + m.setXlDir(rs.getString("xl_dir"));
  1662 + m.setXlName(rs.getString("xl_name"));
  1663 + m.setZdsj(rs.getString("zdsj"));
  1664 + m.setZdsjActual(rs.getString("zdsj_actual"));
  1665 + m.setZdzCode(rs.getString("zdz_code"));
  1666 + m.setZdzName(rs.getString("zdz_name"));
  1667 + m.setCcno(rs.getInt("ccno"));
  1668 + m.setDfAuto(rs.getBoolean("df_auto"));
  1669 + m.setFgsBm(rs.getString("fgs_bm"));
  1670 + m.setFgsName(rs.getString("fgs_name"));
  1671 + m.setGsBm(rs.getString("gs_bm"));
  1672 + m.setGsName(rs.getString("gs_name"));
  1673 + m.setOnline(rs.getBoolean("online"));
  1674 + m.setAdjustExps(rs.getString("adjust_exps"));
  1675 + m.setReissue(rs.getBoolean("reissue"));
  1676 + m.setJhlcOrig(rs.getDouble("jhlc_orig"));
  1677 + return m;
  1678 + }
  1679 + });
  1680 +
1626 1681 return list;
1627 1682 }
1628   -
  1683 +
1629 1684 @Override
1630 1685 public List<Map<String, Object>> jobFwqk(Map<String, Object> map) {
1631 1686 // TODO Auto-generated method stub
... ... @@ -1637,7 +1692,7 @@ public class ReportServiceImpl implements ReportService{
1637 1692 List<ScheduleRealInfo> sList=scheduleRealInfoRepository.scheduleByDateAndLineTjrb(line, date);
1638 1693 for (int i = 0; i < sList.size(); i++) {
1639 1694 ScheduleRealInfo scheduleRealInfo = sList.get(i);
1640   - if (!(scheduleRealInfo.getBcType().equals("in")
  1695 + if (!(scheduleRealInfo.getBcType().equals("in")
1641 1696 || scheduleRealInfo.getBcType().equals("out")
1642 1697 ||scheduleRealInfo.getBcType().equals("ldks"))) {
1643 1698 Set<ChildTaskPlan> childTaskPlans = scheduleRealInfo.getcTasks();
... ... @@ -1695,43 +1750,43 @@ public class ReportServiceImpl implements ReportService{
1695 1750 }
1696 1751 }
1697 1752 }else{*/
1698   - while (it.hasNext()) {
1699   - ChildTaskPlan childTaskPlan = it.next();
1700   - if (childTaskPlan.isDestroy()) {
1701   - String destroyReason = "";
1702   - if ( childTaskPlan.getDestroyReason() == null) {
1703   - destroyReason = "其他";
1704   - }else if(childTaskPlan.getDestroyReason().equals("")){
1705   - destroyReason = "其他";
1706   - } else {
1707   - destroyReason = childTaskPlan.getDestroyReason();
1708   - }
1709   - Map<String, Object> newMap = new HashMap<String, Object>();
1710   - newMap.put("nr", destroyReason);
1711   - newMap.put("lp", scheduleRealInfo.getLpName());
1712   - newMap.put("nbbm", scheduleRealInfo.getClZbh());
1713   - newMap.put("jgh", scheduleRealInfo.getjGh());
1714   - newMap.put("dz", childTaskPlan.getStartStationName());
1715   - newMap.put("sj", childTaskPlan.getStartDate());
1716   - newMap.put("gzf", " ");
1717   - newMap.put("lbbc", 0);
1718   - newMap.put("lblc", childTaskPlan.getMileage());
1719   - newMap.put("jyqp", childTaskPlan.getRemarks());
1720   - list.add(newMap);
1721   -
  1753 + while (it.hasNext()) {
  1754 + ChildTaskPlan childTaskPlan = it.next();
  1755 + if (childTaskPlan.isDestroy()) {
  1756 + String destroyReason = "";
  1757 + if ( childTaskPlan.getDestroyReason() == null) {
  1758 + destroyReason = "其他";
  1759 + }else if(childTaskPlan.getDestroyReason().equals("")){
  1760 + destroyReason = "其他";
  1761 + } else {
  1762 + destroyReason = childTaskPlan.getDestroyReason();
1722 1763 }
  1764 + Map<String, Object> newMap = new HashMap<String, Object>();
  1765 + newMap.put("nr", destroyReason);
  1766 + newMap.put("lp", scheduleRealInfo.getLpName());
  1767 + newMap.put("nbbm", scheduleRealInfo.getClZbh());
  1768 + newMap.put("jgh", scheduleRealInfo.getjGh());
  1769 + newMap.put("dz", childTaskPlan.getStartStationName());
  1770 + newMap.put("sj", childTaskPlan.getStartDate());
  1771 + newMap.put("gzf", " ");
  1772 + newMap.put("lbbc", 0);
  1773 + newMap.put("lblc", childTaskPlan.getMileage());
  1774 + newMap.put("jyqp", childTaskPlan.getRemarks());
  1775 + list.add(newMap);
  1776 +
1723 1777 }
  1778 + }
1724 1779 // }
1725   -
  1780 +
1726 1781 }
1727 1782 }
1728 1783 }
1729   - List<Map<String, Object>> listNew=new ArrayList<Map<String,Object>>();
  1784 + List<Map<String, Object>> listNew=new ArrayList<Map<String,Object>>();
1730 1785 for (int i = 0; i < lblxs.length; i++) {
1731   - String lx=lblxs[i];
1732   - double lblc=0.0;
1733   - int lbbc=0;
1734   - for (int j = 0; j < list.size(); j++) {
  1786 + String lx=lblxs[i];
  1787 + double lblc=0.0;
  1788 + int lbbc=0;
  1789 + for (int j = 0; j < list.size(); j++) {
1735 1790 Map<String, Object> m1=list.get(j);
1736 1791 if(lx.equals(m1.get("nr").toString())){
1737 1792 m1.put("lx", 0);
... ... @@ -1740,55 +1795,55 @@ public class ReportServiceImpl implements ReportService{
1740 1795 lbbc += Integer.parseInt(m1.get("lbbc").toString());
1741 1796 }
1742 1797 }
1743   - if(lblc>0){
1744   - Map<String, Object> newMap = new HashMap<String, Object>();
1745   - newMap.put("lx", 1);
1746   - newMap.put("nr", lx);
1747   - newMap.put("lp", "小计");
1748   - newMap.put("nbbm", "少驶班次");
1749   - newMap.put("jgh", lbbc);
1750   - newMap.put("lbbc", "少驶公里");
1751   - newMap.put("lblc", lblc);
1752   - newMap.put("dz", " ");
1753   - newMap.put("sj", " ");
1754   - newMap.put("gzf", " ");
1755   - newMap.put("jyqp"," ");
1756   - listNew.add(newMap);
1757   - }
1758   -
1759   -
  1798 + if(lblc>0){
  1799 + Map<String, Object> newMap = new HashMap<String, Object>();
  1800 + newMap.put("lx", 1);
  1801 + newMap.put("nr", lx);
  1802 + newMap.put("lp", "小计");
  1803 + newMap.put("nbbm", "少驶班次");
  1804 + newMap.put("jgh", lbbc);
  1805 + newMap.put("lbbc", "少驶公里");
  1806 + newMap.put("lblc", lblc);
  1807 + newMap.put("dz", " ");
  1808 + newMap.put("sj", " ");
  1809 + newMap.put("gzf", " ");
  1810 + newMap.put("jyqp"," ");
  1811 + listNew.add(newMap);
  1812 + }
  1813 +
  1814 +
1760 1815 }
1761 1816 Collections.sort(listNew, new ComparableJob());
1762 1817 return listNew;
1763 1818 }
1764   -
1765   - //统计临加班次详细信息
1766   - @Override
1767   - public List<Map<String, Object>> jobLjqk(Map<String, Object> map) {
1768   - // TODO Auto-generated method stub
1769   - String line=map.get("line").toString();
1770   - String date=map.get("date").toString();
1771   - map.put("bcType", "normal");
1772   - List<Map<String, Object>> list=new ArrayList<Map<String,Object>>();
1773   - List<ScheduleRealInfo> sList=scheduleRealInfoRepository.scheduleByDateAndLineTjrb(line, date);
1774   - for (int i = 0; i < sList.size(); i++) {
1775   - ScheduleRealInfo scheduleRealInfo=sList.get(i);
1776   - if (!(scheduleRealInfo.getBcType().equals("in")
1777   - || scheduleRealInfo.getBcType().equals("out")
1778   - || scheduleRealInfo.getBcType().equals("ldks"))) {
  1819 +
  1820 + //统计临加班次详细信息
  1821 + @Override
  1822 + public List<Map<String, Object>> jobLjqk(Map<String, Object> map) {
  1823 + // TODO Auto-generated method stub
  1824 + String line=map.get("line").toString();
  1825 + String date=map.get("date").toString();
  1826 + map.put("bcType", "normal");
  1827 + List<Map<String, Object>> list=new ArrayList<Map<String,Object>>();
  1828 + List<ScheduleRealInfo> sList=scheduleRealInfoRepository.scheduleByDateAndLineTjrb(line, date);
  1829 + for (int i = 0; i < sList.size(); i++) {
  1830 + ScheduleRealInfo scheduleRealInfo=sList.get(i);
  1831 + if (!(scheduleRealInfo.getBcType().equals("in")
  1832 + || scheduleRealInfo.getBcType().equals("out")
  1833 + || scheduleRealInfo.getBcType().equals("ldks"))) {
1779 1834 // Set<ChildTaskPlan> childTaskPlans = scheduleRealInfo.getcTasks();
1780 1835 // if(childTaskPlans.isEmpty()){
1781   - if(scheduleRealInfo.isSflj()){
1782   - Map<String, Object> newMap=new HashMap<String,Object>();
1783   - newMap.put("lp", scheduleRealInfo.getLpName());
1784   - newMap.put("nbbm", scheduleRealInfo.getClZbh());
1785   - newMap.put("jgh", scheduleRealInfo.getjGh());
1786   - newMap.put("dz", scheduleRealInfo.getQdzName());
1787   - newMap.put("sj", scheduleRealInfo.getFcsj());
1788   - newMap.put("ljlc", scheduleRealInfo.getJhlc()==null?0:scheduleRealInfo.getJhlc());
1789   - newMap.put("jyqp", scheduleRealInfo.getRealMileage()==null?"":scheduleRealInfo.getRealMileage());
1790   - list.add(newMap);
1791   - }
  1836 + if(scheduleRealInfo.isSflj()){
  1837 + Map<String, Object> newMap=new HashMap<String,Object>();
  1838 + newMap.put("lp", scheduleRealInfo.getLpName());
  1839 + newMap.put("nbbm", scheduleRealInfo.getClZbh());
  1840 + newMap.put("jgh", scheduleRealInfo.getjGh());
  1841 + newMap.put("dz", scheduleRealInfo.getQdzName());
  1842 + newMap.put("sj", scheduleRealInfo.getFcsj());
  1843 + newMap.put("ljlc", scheduleRealInfo.getJhlc()==null?0:scheduleRealInfo.getJhlc());
  1844 + newMap.put("jyqp", scheduleRealInfo.getRealMileage()==null?"":scheduleRealInfo.getRealMileage());
  1845 + list.add(newMap);
  1846 + }
1792 1847 // }else{
1793 1848 // Iterator<ChildTaskPlan> it = childTaskPlans.iterator();
1794 1849 // while (it.hasNext()) {
... ... @@ -1797,372 +1852,372 @@ public class ReportServiceImpl implements ReportService{
1797 1852 // }
1798 1853 // }
1799 1854 // }
1800   - }
1801 1855 }
1802   - return list;
1803 1856 }
1804   -
1805   - public static double culateCJLC2(List<ScheduleRealInfo> list, String item) {
1806   - // TODO Auto-generated method stub
1807   - double sum = 0;
1808   - Set<ChildTaskPlan> cts;
1809   - for(ScheduleRealInfo sch : list){
1810   - if (sch.isSflj())
1811   - continue;
1812   - cts = sch.getcTasks();
1813   - //有子任务
1814   - if (cts != null && cts.size() > 0) {
1815   - for(ChildTaskPlan c : cts){
1816   - if(c.isDestroy() && c.getDestroyReason().equals(item))
1817   - sum = Arith.add(sum, c.getMileage());
1818   - }
1819   - }
  1857 + return list;
  1858 + }
  1859 +
  1860 + public static double culateCJLC2(List<ScheduleRealInfo> list, String item) {
  1861 + // TODO Auto-generated method stub
  1862 + double sum = 0;
  1863 + Set<ChildTaskPlan> cts;
  1864 + for(ScheduleRealInfo sch : list){
  1865 + if (sch.isSflj())
  1866 + continue;
  1867 + cts = sch.getcTasks();
  1868 + //有子任务
  1869 + if (cts != null && cts.size() > 0) {
  1870 + for(ChildTaskPlan c : cts){
  1871 + if(c.isDestroy() && c.getDestroyReason().equals(item))
  1872 + sum = Arith.add(sum, c.getMileage());
  1873 + }
  1874 + }
1820 1875 // else if(isInOut(sch))
1821 1876 // continue;
1822   - //主任务烂班
1823   - else if(sch.getStatus() == -1){
1824   - if(sch.getAdjustExps().equals(item) ||
1825   - (StringUtils.isEmpty(sch.getAdjustExps()) && item.equals("其他"))){
1826   - sum = Arith.add(sum, sch.getJhlcOrig());
1827   - }
1828   - }
1829   - else if(item.equals("其他")){
1830   - double diff = Arith.sub(sch.getJhlcOrig(), sch.getJhlc());
1831   - if(diff > 0){
1832   - sum = Arith.add(sum, diff);
1833   - }
1834   - }
1835   - }
1836   - return sum;
1837   -
1838   - }
1839   - @Override
1840   - public Map<String, Object> jobHzxx(Map<String, Object> map) {
1841   - // TODO Auto-generated method stub
1842   - String line="";
1843   - if(map.get("line")!=null){
1844   - line=map.get("line").toString();
1845   - }
1846   - String date="";
1847   - if(map.get("date")!=null){
1848   - date=map.get("date").toString();
1849   - }
1850   -
1851   - List<ScheduleRealInfo> sList=scheduleRealInfoRepository.scheduleByDateAndLineTjrb(line, date);
1852   - Map<String, Object> newMap=new HashMap<String,Object>();
1853   - newMap.put("jhbc", culateService.culateJhbc(sList,""));
1854   - newMap.put("jhgl", culateService.culateJhgl(sList));
1855   - newMap.put("sjbc", culateService.culateSjbc(sList,""));
1856   - newMap.put("sjgl", culateService.culateSjgl(sList));
1857   - newMap.put("lbgl", culateService.culateLbgl(sList));
1858   - newMap.put("lbbc", culateService.culateLbbc(sList));
1859   - newMap.put("ljgl", culateService.culateLjgl(sList));
1860   - newMap.put("ljbc", culateService.culateLjbc(sList,""));
1861   - newMap.put("ksgl", culateService.culateKsgl(sList));
1862   - return newMap;
1863   - }
1864   - @Override
1865   - public List<Map<String, Object>> lineList() {
1866   - // TODO Auto-generated method stub
1867   - List<Map<String, Object>> list=new ArrayList<Map<String,Object>>();
1868   - Iterator<Line> iterator = lineRepository.findAll().iterator();
1869   - Line line;
1870   - while (iterator.hasNext()) {
1871   - line = iterator.next();
1872   - Map<String, Object> map=new HashMap<String,Object>();
1873   - map.put("gsbm", line.getCompany());
1874   - map.put("fgsbm", line.getBrancheCompany());
1875   - map.put("xlbm", line.getLineCode());
1876   - map.put("xlname", line.getName());
1877   - list.add(map);
1878   - }
1879   - return list;
1880   - }
1881   - @Override
1882   - public List<Map<String, String>> carList(Map<String, Object> maps) {
1883   - // TODO Auto-generated method stub
1884   - // 转大写
1885   - String nbbm =maps.get("nbbm").toString().toUpperCase();
1886   - String gsbm="";
1887   -
1888   - if(maps.get("gsbm")!=null)
1889   - gsbm= maps.get("gsbm").toString().trim();
1890   -// String fgsbm=maps.get("fgsbm").toString().trim();
1891   - String xlbm=maps.get("xlbm").toString().trim();
1892   - List<Map<String, String>> list = new ArrayList<Map<String, String>>();
1893   - Map<String, String> map;
1894   - Set<String> allSet = BasicData.nbbm2CompanyCodeMap.keySet();
1895   -
1896   - Line line;
1897   - for (String k : allSet) {
1898   - if (k.indexOf(nbbm) != -1) {
1899   - // 所属线路
1900   - boolean fage=true;
1901   - map = new HashMap<>();
1902   - line = BasicData.nbbm2LineMap.get(k);
1903   - String clgsdm= BasicData.nbbm2CompanyCodeMap.get(k);
1904   -
1905   - map.put("id", k);
1906   - map.put("text", k);
1907   - if (null != line) {
1908   - map.put("lineName", line.getName());
1909   - map.put("lineCode", line.getLineCode());
1910   - }
1911   -
1912   - if(!xlbm.equals("")){
1913   - if(null!=line){
1914   - if(!line.getLineCode().equals(xlbm)){
1915   - fage=false;
1916   - }
1917   - }
1918   -
1919   - }
1920   -
1921   - if(!gsbm.equals("")){
1922   - if(!clgsdm.equals(gsbm)){
1923   - fage=false;
1924   - }
1925   - }
1926   -
1927   - if(fage){
1928   - list.add(map);
1929   - }
1930   -
1931   - }
1932   -
1933   - if (list.size() > 20)
1934   - break;
1935   - }
1936   - return list;
  1877 + //主任务烂班
  1878 + else if(sch.getStatus() == -1){
  1879 + if(sch.getAdjustExps().equals(item) ||
  1880 + (StringUtils.isEmpty(sch.getAdjustExps()) && item.equals("其他"))){
  1881 + sum = Arith.add(sum, sch.getJhlcOrig());
  1882 + }
  1883 + }
  1884 + else if(item.equals("其他")){
  1885 + double diff = Arith.sub(sch.getJhlcOrig(), sch.getJhlc());
  1886 + if(diff > 0){
  1887 + sum = Arith.add(sum, diff);
  1888 + }
  1889 + }
1937 1890 }
1938   -
1939   -
1940   - @Override
1941   - public List<Map<String, String>> userList(Map<String, Object> maps) {
1942   - // TODO Auto-generated method stub
1943   - // 转大写
1944   - String jsy =maps.get("jsy").toString().toUpperCase();
1945   - String gsbm="";
1946   - if(maps.get("gsbm")!=null)
1947   - gsbm=maps.get("gsbm").toString().trim();
1948   -// String fgsbm=maps.get("fgsbm").toString().trim();
1949   - List<Map<String, String>> list = new ArrayList<Map<String, String>>();
1950   - Map<String, String> map;
1951   -// Set<String> allSet = BasicData.nbbm2CompanyCodeMap.keySet();
1952   - Set<String> allJsy = BasicData.perMap.keySet();
1953   -
1954   - Personnel per;
1955   - for (String k : allJsy) {
1956   - if (k.indexOf(jsy) != -1) {
1957   - map = new HashMap<>();
1958   - // 通过人员查找公司
1959   - per = BasicData.perMap.get(k);
1960   - String rygsdm="";
1961   - if(null != per){
1962   - if(per.getCompanyCode()!=null){
1963   - rygsdm = per.getCompanyCode();
1964   - }
1965   - String jboCode=per.getJobCode().substring(per.getJobCode().indexOf("-")+1);
1966   - map.put("id", jboCode);
1967   - map.put("text", jboCode+"/"+per.getPersonnelName());
1968   - if(!gsbm.equals("")){
1969   - if(rygsdm.equals(gsbm)){
1970   - list.add(map);
1971   - }
1972   - }
1973   - }
1974   - }
1975   -
1976   - if (list.size() > 20)
1977   - break;
1978   - }
1979   - return list;
  1891 + return sum;
  1892 +
  1893 + }
  1894 + @Override
  1895 + public Map<String, Object> jobHzxx(Map<String, Object> map) {
  1896 + // TODO Auto-generated method stub
  1897 + String line="";
  1898 + if(map.get("line")!=null){
  1899 + line=map.get("line").toString();
1980 1900 }
1981   -
1982   - public List<ArrivalInfo> load4(String line, String date, int zd,String minfcsj){
1983   - SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
1984   - SimpleDateFormat sdf = new SimpleDateFormat("HH:mm:ss");
1985   - Long date1=0L;
1986   - Long date2=0L;
1987   - Calendar cal = Calendar.getInstance();
1988   - List<ArrivalInfo> list=null;
1989   - try {
1990   - Date dates1 = simpleDateFormat.parse(date+" "+minfcsj+":01");
1991   - String d1=date+" "+minfcsj+":01";
1992   -// Date dates2=simpleDateFormat.parse(date+" 23:59:59");
1993   - date1=dates1.getTime();
1994   -// date2=dates2.getTime();
1995   - cal.setTime(dates1);
1996   - int weeks_year1 = cal.get(Calendar.WEEK_OF_YEAR);
1997   - cal.add(cal.DATE,1);//把日期往后增加一天.整数往后推,负数往前移动
1998   - int weeks_year2 = cal.get(Calendar.WEEK_OF_YEAR);
1999   - Date dates2=cal.getTime();
2000   - String d2=simpleDateFormat.format(dates2);
2001   - String sql="select *,UNIX_TIMESTAMP(times) as ts from bsth_c_arrival_info where times >= '"+d1 +"'and "
2002   - + " times <='"+d2+"' and line_id = '"+line+"' and up_down = '"+zd+"'"
2003   - + " order by device_id,times";
2004   -
2005   - list =jdbcTemplate.query(sql, new RowMapper<ArrivalInfo>() {
2006   - @Override
2007   - public ArrivalInfo mapRow(ResultSet arg0, int arg1) throws SQLException {
2008   - ArrivalInfo ai=new ArrivalInfo();
2009   - ai.setInOut(arg0.getInt("in_out"));
2010   - ai.setDeviceId(arg0.getString("device_id"));
2011   - ai.setStopNo(arg0.getString("stop_no"));
2012   - ai.setDates(arg0.getDate("times"));
2013   - ai.setTs(arg0.getLong("ts")*1000);
2014   - return ai;
  1901 + String date="";
  1902 + if(map.get("date")!=null){
  1903 + date=map.get("date").toString();
  1904 + }
  1905 +
  1906 + List<ScheduleRealInfo> sList=scheduleRealInfoRepository.scheduleByDateAndLineTjrb(line, date);
  1907 + Map<String, Object> newMap=new HashMap<String,Object>();
  1908 + newMap.put("jhbc", culateService.culateJhbc(sList,""));
  1909 + newMap.put("jhgl", culateService.culateJhgl(sList));
  1910 + newMap.put("sjbc", culateService.culateSjbc(sList,""));
  1911 + newMap.put("sjgl", culateService.culateSjgl(sList));
  1912 + newMap.put("lbgl", culateService.culateLbgl(sList));
  1913 + newMap.put("lbbc", culateService.culateLbbc(sList));
  1914 + newMap.put("ljgl", culateService.culateLjgl(sList));
  1915 + newMap.put("ljbc", culateService.culateLjbc(sList,""));
  1916 + newMap.put("ksgl", culateService.culateKsgl(sList));
  1917 + return newMap;
  1918 + }
  1919 + @Override
  1920 + public List<Map<String, Object>> lineList() {
  1921 + // TODO Auto-generated method stub
  1922 + List<Map<String, Object>> list=new ArrayList<Map<String,Object>>();
  1923 + Iterator<Line> iterator = lineRepository.findAll().iterator();
  1924 + Line line;
  1925 + while (iterator.hasNext()) {
  1926 + line = iterator.next();
  1927 + Map<String, Object> map=new HashMap<String,Object>();
  1928 + map.put("gsbm", line.getCompany());
  1929 + map.put("fgsbm", line.getBrancheCompany());
  1930 + map.put("xlbm", line.getLineCode());
  1931 + map.put("xlname", line.getName());
  1932 + list.add(map);
  1933 + }
  1934 + return list;
  1935 + }
  1936 + @Override
  1937 + public List<Map<String, String>> carList(Map<String, Object> maps) {
  1938 + // TODO Auto-generated method stub
  1939 + // 转大写
  1940 + String nbbm =maps.get("nbbm").toString().toUpperCase();
  1941 + String gsbm="";
  1942 +
  1943 + if(maps.get("gsbm")!=null)
  1944 + gsbm= maps.get("gsbm").toString().trim();
  1945 +// String fgsbm=maps.get("fgsbm").toString().trim();
  1946 + String xlbm=maps.get("xlbm").toString().trim();
  1947 + List<Map<String, String>> list = new ArrayList<Map<String, String>>();
  1948 + Map<String, String> map;
  1949 + Set<String> allSet = BasicData.nbbm2CompanyCodeMap.keySet();
  1950 +
  1951 + Line line;
  1952 + for (String k : allSet) {
  1953 + if (k.indexOf(nbbm) != -1) {
  1954 + // 所属线路
  1955 + boolean fage=true;
  1956 + map = new HashMap<>();
  1957 + line = BasicData.nbbm2LineMap.get(k);
  1958 + String clgsdm= BasicData.nbbm2CompanyCodeMap.get(k);
  1959 +
  1960 + map.put("id", k);
  1961 + map.put("text", k);
  1962 + if (null != line) {
  1963 + map.put("lineName", line.getName());
  1964 + map.put("lineCode", line.getLineCode());
  1965 + }
  1966 +
  1967 + if(!xlbm.equals("")){
  1968 + if(null!=line){
  1969 + if(!line.getLineCode().equals(xlbm)){
  1970 + fage=false;
2015 1971 }
2016   - });
  1972 + }
  1973 +
  1974 + }
  1975 +
  1976 + if(!gsbm.equals("")){
  1977 + if(!clgsdm.equals(gsbm)){
  1978 + fage=false;
  1979 + }
  1980 + }
  1981 +
  1982 + if(fage){
  1983 + list.add(map);
  1984 + }
2017 1985  
2018   - } catch (ParseException e1) {
2019   - // TODO Auto-generated catch block
2020   - e1.printStackTrace();
2021 1986 }
2022   - return list;
2023   -
  1987 +
  1988 + if (list.size() > 20)
  1989 + break;
2024 1990 }
2025   -
2026   - public List<ArrivalInfo> load3(String line, String date, int zd){
2027   - SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
2028   - SimpleDateFormat sdf = new SimpleDateFormat("HH:mm:ss");
2029   - Long date1=0L;
2030   - Long date2=0L;
2031   - Calendar cal = Calendar.getInstance();
2032   - try {
2033   - Date dates1 = simpleDateFormat.parse(date+" 00:00:01");
2034   - Date dates2=simpleDateFormat.parse(date+" 23:59:59");
2035   - date1=dates1.getTime();
2036   - date2=dates2.getTime();
2037   - cal.setTime(dates1);
2038   - } catch (ParseException e1) {
2039   - // TODO Auto-generated catch block
2040   - e1.printStackTrace();
  1991 + return list;
  1992 + }
  1993 +
  1994 +
  1995 + @Override
  1996 + public List<Map<String, String>> userList(Map<String, Object> maps) {
  1997 + // TODO Auto-generated method stub
  1998 + // 转大写
  1999 + String jsy =maps.get("jsy").toString().toUpperCase();
  2000 + String gsbm="";
  2001 + if(maps.get("gsbm")!=null)
  2002 + gsbm=maps.get("gsbm").toString().trim();
  2003 +// String fgsbm=maps.get("fgsbm").toString().trim();
  2004 + List<Map<String, String>> list = new ArrayList<Map<String, String>>();
  2005 + Map<String, String> map;
  2006 +// Set<String> allSet = BasicData.nbbm2CompanyCodeMap.keySet();
  2007 + Set<String> allJsy = BasicData.perMap.keySet();
  2008 +
  2009 + Personnel per;
  2010 + for (String k : allJsy) {
  2011 + if (k.indexOf(jsy) != -1) {
  2012 + map = new HashMap<>();
  2013 + // 通过人员查找公司
  2014 + per = BasicData.perMap.get(k);
  2015 + String rygsdm="";
  2016 + if(null != per){
  2017 + if(per.getCompanyCode()!=null){
  2018 + rygsdm = per.getCompanyCode();
  2019 + }
  2020 + String jboCode=per.getJobCode().substring(per.getJobCode().indexOf("-")+1);
  2021 + map.put("id", jboCode);
  2022 + map.put("text", jboCode+"/"+per.getPersonnelName());
  2023 + if(!gsbm.equals("")){
  2024 + if(rygsdm.equals(gsbm)){
  2025 + list.add(map);
  2026 + }
2041 2027 }
2042   - //周数,表分区字段
2043   - int weeks_year1 = cal.get(Calendar.WEEK_OF_YEAR);
2044   - List<ArrivalInfo> list = null;
2045   - Connection conn = null;
2046   - PreparedStatement ps = null;
2047   - ResultSet rs = null;
2048   -
2049   - String sql = "select * from bsth_c_arrival_info where line_id=? AND weeks_year=? "
2050   - + " AND ts >= ? AND ts <=? AND up_down=? order by device_id,ts";
2051   - try{
2052   - conn = DBUtils_MS.getConnection();
2053   - ps = conn.prepareStatement(sql);
2054   - ps.setString(1, line);
2055   - ps.setInt(2, weeks_year1);
2056   - ps.setLong(3, date1);
2057   - ps.setLong(4, date2);
2058   - ps.setInt(5, zd);
2059   - rs = ps.executeQuery();
2060   -
2061   - list = resultSet2Set(rs);
2062   - }catch(Exception e){
2063   - logger.error("", e);
2064   - }finally {
2065   - DBUtils_MS.close(rs, ps, conn);
2066 2028 }
2067   - return list;
  2029 + }
  2030 +
  2031 + if (list.size() > 20)
  2032 + break;
2068 2033 }
2069   -
2070   - //根据排班查到离站
2071   - @Override
2072   - public List<Map<String, Object>> queryInOutStrtion(String line, String date, int zd,String lzsj) {
2073   - SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
2074   - //查询线路所有的站点
2075   - List<ArrivalInfo> arrInfoList=this.load3(line, date, zd);
2076   - List<StationRoute> listStation= stationRouteRepository.findByLine(line,zd);
2077   - List<Map<String, Object>> inoutList=new ArrayList<Map<String,Object>>();
2078   - //保存的所以的站点信息
2079   - Map<String, Object> map1=new HashMap<String,Object>();
2080   - map1.put("bc", "");
2081   - map1.put("nbbm", "");
2082   -
2083   - //所有的班次信息(实际排班排序)
2084   - List<ScheduleRealInfo> realList= scheduleRealInfoRepository.scheduleByDateAndLineInOut(line, date,zd+"");
2085   - for (int i = 0; i < listStation.size(); i++) {
2086   - map1.put(listStation.get(i).getStationCode()+"in"
2087   - , listStation.get(i).getStationName());
2088   - map1.put(listStation.get(i).getStationCode()+"out"
2089   - , (i+1));
2090   - }
2091   - inoutList.add(map1);
2092   -
2093   - for (int i = 0; i < realList.size(); i++) {
2094   - ScheduleRealInfo sinfo=realList.get(i);
2095   - String devuceId=BasicData.deviceId2NbbmMap.inverse().get(sinfo.getClZbh());
2096   - String sjfcsj=sinfo.getRealExecDate()+" "+sinfo.getFcsjActual()+":00";
2097   - String sjddsj=sinfo.getRealExecDate()+" "+sinfo.getZdsjActual()+":59";
2098   -
2099   - try {
2100   - Date dates1 = simpleDateFormat.parse(sjfcsj);
2101   - Date dates2=simpleDateFormat.parse(sjddsj);
2102   - Long date1=dates1.getTime();
2103   - Long date2=dates2.getTime();
2104   - List<ArrivalInfo> arrList=new ArrayList<ArrivalInfo>();
2105   - for (int j = 0; j < arrInfoList.size(); j++) {
2106   - ArrivalInfo a=arrInfoList.get(j);
2107   - if(a.getDeviceId().equals(devuceId) && a.getTs()>=date1 && a.getTs()<=date2){
2108   - arrList.add(a);
2109   - }
  2034 + return list;
  2035 + }
  2036 +
  2037 + public List<ArrivalInfo> load4(String line, String date, int zd,String minfcsj){
  2038 + SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
  2039 + SimpleDateFormat sdf = new SimpleDateFormat("HH:mm:ss");
  2040 + Long date1=0L;
  2041 + Long date2=0L;
  2042 + Calendar cal = Calendar.getInstance();
  2043 + List<ArrivalInfo> list=null;
  2044 + try {
  2045 + Date dates1 = simpleDateFormat.parse(date+" "+minfcsj+":01");
  2046 + String d1=date+" "+minfcsj+":01";
  2047 +// Date dates2=simpleDateFormat.parse(date+" 23:59:59");
  2048 + date1=dates1.getTime();
  2049 +// date2=dates2.getTime();
  2050 + cal.setTime(dates1);
  2051 + int weeks_year1 = cal.get(Calendar.WEEK_OF_YEAR);
  2052 + cal.add(cal.DATE,1);//把日期往后增加一天.整数往后推,负数往前移动
  2053 + int weeks_year2 = cal.get(Calendar.WEEK_OF_YEAR);
  2054 + Date dates2=cal.getTime();
  2055 + String d2=simpleDateFormat.format(dates2);
  2056 + String sql="select *,UNIX_TIMESTAMP(times) as ts from bsth_c_arrival_info where times >= '"+d1 +"'and "
  2057 + + " times <='"+d2+"' and line_id = '"+line+"' and up_down = '"+zd+"'"
  2058 + + " order by device_id,times";
  2059 +
  2060 + list =jdbcTemplate.query(sql, new RowMapper<ArrivalInfo>() {
  2061 + @Override
  2062 + public ArrivalInfo mapRow(ResultSet arg0, int arg1) throws SQLException {
  2063 + ArrivalInfo ai=new ArrivalInfo();
  2064 + ai.setInOut(arg0.getInt("in_out"));
  2065 + ai.setDeviceId(arg0.getString("device_id"));
  2066 + ai.setStopNo(arg0.getString("stop_no"));
  2067 + ai.setDates(arg0.getDate("times"));
  2068 + ai.setTs(arg0.getLong("ts")*1000);
  2069 + return ai;
  2070 + }
  2071 + });
  2072 +
  2073 + } catch (ParseException e1) {
  2074 + // TODO Auto-generated catch block
  2075 + e1.printStackTrace();
  2076 + }
  2077 + return list;
  2078 +
  2079 + }
  2080 +
  2081 + public List<ArrivalInfo> load3(String line, String date, int zd){
  2082 + SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
  2083 + SimpleDateFormat sdf = new SimpleDateFormat("HH:mm:ss");
  2084 + Long date1=0L;
  2085 + Long date2=0L;
  2086 + Calendar cal = Calendar.getInstance();
  2087 + try {
  2088 + Date dates1 = simpleDateFormat.parse(date+" 00:00:01");
  2089 + Date dates2=simpleDateFormat.parse(date+" 23:59:59");
  2090 + date1=dates1.getTime();
  2091 + date2=dates2.getTime();
  2092 + cal.setTime(dates1);
  2093 + } catch (ParseException e1) {
  2094 + // TODO Auto-generated catch block
  2095 + e1.printStackTrace();
  2096 + }
  2097 + //周数,表分区字段
  2098 + int weeks_year1 = cal.get(Calendar.WEEK_OF_YEAR);
  2099 + List<ArrivalInfo> list = null;
  2100 + Connection conn = null;
  2101 + PreparedStatement ps = null;
  2102 + ResultSet rs = null;
  2103 +
  2104 + String sql = "select * from bsth_c_arrival_info where line_id=? AND weeks_year=? "
  2105 + + " AND ts >= ? AND ts <=? AND up_down=? order by device_id,ts";
  2106 + try{
  2107 + conn = DBUtils_MS.getConnection();
  2108 + ps = conn.prepareStatement(sql);
  2109 + ps.setString(1, line);
  2110 + ps.setInt(2, weeks_year1);
  2111 + ps.setLong(3, date1);
  2112 + ps.setLong(4, date2);
  2113 + ps.setInt(5, zd);
  2114 + rs = ps.executeQuery();
  2115 +
  2116 + list = resultSet2Set(rs);
  2117 + }catch(Exception e){
  2118 + logger.error("", e);
  2119 + }finally {
  2120 + DBUtils_MS.close(rs, ps, conn);
  2121 + }
  2122 + return list;
  2123 + }
  2124 +
  2125 + //根据排班查到离站
  2126 + @Override
  2127 + public List<Map<String, Object>> queryInOutStrtion(String line, String date, int zd,String lzsj) {
  2128 + SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
  2129 + //查询线路所有的站点
  2130 + List<ArrivalInfo> arrInfoList=this.load3(line, date, zd);
  2131 + List<StationRoute> listStation= stationRouteRepository.findByLine(line,zd);
  2132 + List<Map<String, Object>> inoutList=new ArrayList<Map<String,Object>>();
  2133 + //保存的所以的站点信息
  2134 + Map<String, Object> map1=new HashMap<String,Object>();
  2135 + map1.put("bc", "");
  2136 + map1.put("nbbm", "");
  2137 +
  2138 + //所有的班次信息(实际排班排序)
  2139 + List<ScheduleRealInfo> realList= scheduleRealInfoRepository.scheduleByDateAndLineInOut(line, date,zd+"");
  2140 + for (int i = 0; i < listStation.size(); i++) {
  2141 + map1.put(listStation.get(i).getStationCode()+"in"
  2142 + , listStation.get(i).getStationName());
  2143 + map1.put(listStation.get(i).getStationCode()+"out"
  2144 + , (i+1));
  2145 + }
  2146 + inoutList.add(map1);
  2147 +
  2148 + for (int i = 0; i < realList.size(); i++) {
  2149 + ScheduleRealInfo sinfo=realList.get(i);
  2150 + String devuceId=BasicData.deviceId2NbbmMap.inverse().get(sinfo.getClZbh());
  2151 + String sjfcsj=sinfo.getRealExecDate()+" "+sinfo.getFcsjActual()+":00";
  2152 + String sjddsj=sinfo.getRealExecDate()+" "+sinfo.getZdsjActual()+":59";
  2153 +
  2154 + try {
  2155 + Date dates1 = simpleDateFormat.parse(sjfcsj);
  2156 + Date dates2=simpleDateFormat.parse(sjddsj);
  2157 + Long date1=dates1.getTime();
  2158 + Long date2=dates2.getTime();
  2159 + List<ArrivalInfo> arrList=new ArrayList<ArrivalInfo>();
  2160 + for (int j = 0; j < arrInfoList.size(); j++) {
  2161 + ArrivalInfo a=arrInfoList.get(j);
  2162 + if(a.getDeviceId().equals(devuceId) && a.getTs()>=date1 && a.getTs()<=date2){
  2163 + arrList.add(a);
2110 2164 }
2111   -
2112   - Map<String, Object> map2=new HashMap<String,Object>();
2113   - map2.put("bc", (i+1));
2114   - map2.put("nbbm", sinfo.getClZbh());
2115   -
2116   - for (int j = 0; j < listStation.size(); j++) {
2117   - StationRoute s=listStation.get(j);
2118   - List<ArrivalInfo> arrivalList=new ArrayList<ArrivalInfo>();
2119   - for (int j2 = 0; j2 < arrList.size(); j2++) {
2120   - ArrivalInfo a=arrList.get(j2);
2121   - if(s.getStationCode().equals(a.getStopNo())){
2122   - arrivalList.add(a);
2123   - }
  2165 + }
  2166 +
  2167 + Map<String, Object> map2=new HashMap<String,Object>();
  2168 + map2.put("bc", (i+1));
  2169 + map2.put("nbbm", sinfo.getClZbh());
  2170 +
  2171 + for (int j = 0; j < listStation.size(); j++) {
  2172 + StationRoute s=listStation.get(j);
  2173 + List<ArrivalInfo> arrivalList=new ArrayList<ArrivalInfo>();
  2174 + for (int j2 = 0; j2 < arrList.size(); j2++) {
  2175 + ArrivalInfo a=arrList.get(j2);
  2176 + if(s.getStationCode().equals(a.getStopNo())){
  2177 + arrivalList.add(a);
2124 2178 }
2125   - Map<String, String> m=this.strInOut(arrivalList,lzsj);
2126   -
2127   - map2.put(s.getStationCode()+"in", m.get("in"));
2128   - map2.put(s.getStationCode()+"out", m.get("out"));
2129   - map2.put(s.getStationCode(), m.get("type"));
2130 2179 }
2131   - inoutList.add(map2);
2132   - } catch (ParseException e) {
2133   - // TODO Auto-generated catch block
2134   - e.printStackTrace();
  2180 + Map<String, String> m=this.strInOut(arrivalList,lzsj);
  2181 +
  2182 + map2.put(s.getStationCode()+"in", m.get("in"));
  2183 + map2.put(s.getStationCode()+"out", m.get("out"));
  2184 + map2.put(s.getStationCode(), m.get("type"));
2135 2185 }
  2186 + inoutList.add(map2);
  2187 + } catch (ParseException e) {
  2188 + // TODO Auto-generated catch block
  2189 + e.printStackTrace();
2136 2190 }
2137   - return inoutList;
2138 2191 }
2139   -
2140   - //根据GPS查到离站
2141   - @Override
2142   - public List<Map<String, Object>> queryInOutStrtions(String line, String date, int zd,String lzsj) {
2143   - SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
2144   - String sqlMinYysj="select start_opt from bsth_c_line_config where "
2145   - + " id = ("
2146   - + "select max(id) from bsth_c_line_config where line ='"+BasicData.lineId2CodeMap.inverse().get(line) +"'"
2147   - + ")";
2148   - String minfcsj=jdbcTemplate.queryForObject(sqlMinYysj, String.class);
2149   - List<ArrivalInfo> arrInfoList=this.load4(line, date, zd,minfcsj);
2150   -
2151   - //查询线路所有的站点
2152   - List<StationRoute> listStation= stationRouteRepository.findByLine(line,zd);
2153   - List<Map<String, Object>> inoutList=new ArrayList<Map<String,Object>>();
2154   - //保存的所以的站点信息
2155   - Map<String, Object> map1=new HashMap<String,Object>();
2156   - map1.put("bc", "");
2157   - map1.put("nbbm", "");
2158   -
2159   - for (int i = 0; i < listStation.size(); i++) {
2160   - map1.put(listStation.get(i).getStationCode()+"in"
2161   - , listStation.get(i).getStationName());
2162   - map1.put(listStation.get(i).getStationCode()+"out"
2163   - , (i+1));
2164   - }
2165   - inoutList.add(map1);
  2192 + return inoutList;
  2193 + }
  2194 +
  2195 + //根据GPS查到离站
  2196 + @Override
  2197 + public List<Map<String, Object>> queryInOutStrtions(String line, String date, int zd,String lzsj) {
  2198 + SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
  2199 + String sqlMinYysj="select start_opt from bsth_c_line_config where "
  2200 + + " id = ("
  2201 + + "select max(id) from bsth_c_line_config where line ='"+BasicData.lineId2CodeMap.inverse().get(line) +"'"
  2202 + + ")";
  2203 + String minfcsj=jdbcTemplate.queryForObject(sqlMinYysj, String.class);
  2204 + List<ArrivalInfo> arrInfoList=this.load4(line, date, zd,minfcsj);
  2205 +
  2206 + //查询线路所有的站点
  2207 + List<StationRoute> listStation= stationRouteRepository.findByLine(line,zd);
  2208 + List<Map<String, Object>> inoutList=new ArrayList<Map<String,Object>>();
  2209 + //保存的所以的站点信息
  2210 + Map<String, Object> map1=new HashMap<String,Object>();
  2211 + map1.put("bc", "");
  2212 + map1.put("nbbm", "");
  2213 +
  2214 + for (int i = 0; i < listStation.size(); i++) {
  2215 + map1.put(listStation.get(i).getStationCode()+"in"
  2216 + , listStation.get(i).getStationName());
  2217 + map1.put(listStation.get(i).getStationCode()+"out"
  2218 + , (i+1));
  2219 + }
  2220 + inoutList.add(map1);
2166 2221  
2167 2222 /*for (int j = 0; j < listStation.size(); j++) {
2168 2223 map2=new HashMap<String,Object>();
... ... @@ -2180,994 +2235,994 @@ public class ReportServiceImpl implements ReportService{
2180 2235 map2.put(s.getStationCode()+"out", m.get("out"));
2181 2236 map2.put(s.getStationCode(), m.get("type"));
2182 2237 }*/
2183   - List<String> list_nbbm=new ArrayList<String>();
2184   - Map<String, Object> m=new HashMap<String,Object>();
2185   - for (int i = 0; i < arrInfoList.size(); i++) {
2186   - arrInfoList.get(i).setRoute(-1);
2187   - for (int j = 0; j < listStation.size(); j++) {
2188   - if(arrInfoList.get(i).getStopNo().equals(listStation.get(j).getStationCode())){
2189   - arrInfoList.get(i).setRoute(listStation.get(j).getStationRouteCode());
2190   -
2191   - }
2192   - }
2193   - if(m.get(arrInfoList.get(i).getDeviceId())==null){
2194   - m.put(arrInfoList.get(i).getDeviceId(), arrInfoList.get(i).getDeviceId());
2195   - list_nbbm.add(arrInfoList.get(i).getDeviceId());
  2238 + List<String> list_nbbm=new ArrayList<String>();
  2239 + Map<String, Object> m=new HashMap<String,Object>();
  2240 + for (int i = 0; i < arrInfoList.size(); i++) {
  2241 + arrInfoList.get(i).setRoute(-1);
  2242 + for (int j = 0; j < listStation.size(); j++) {
  2243 + if(arrInfoList.get(i).getStopNo().equals(listStation.get(j).getStationCode())){
  2244 + arrInfoList.get(i).setRoute(listStation.get(j).getStationRouteCode());
  2245 +
2196 2246 }
2197 2247 }
  2248 + if(m.get(arrInfoList.get(i).getDeviceId())==null){
  2249 + m.put(arrInfoList.get(i).getDeviceId(), arrInfoList.get(i).getDeviceId());
  2250 + list_nbbm.add(arrInfoList.get(i).getDeviceId());
  2251 + }
  2252 + }
2198 2253  
2199   - Map<String, Object> map2=new HashMap<String, Object>();
2200   - for (int i = 0; i < list_nbbm.size(); i++) {
2201   - String nbbm=list_nbbm.get(i);
2202   -
2203   - int zdbm =0;
2204   - int inout=-1;
2205   - List<ArrivalInfo> arrivalList=new ArrayList<ArrivalInfo>();
2206   - for (int j = 0; j < arrInfoList.size(); j++) {
2207   - ArrivalInfo aif=arrInfoList.get(j);
2208   -
2209   - if(aif.getDeviceId().equals(nbbm)){
2210   - map2.put("nbbm", BasicData.deviceId2NbbmMap.get(nbbm));
2211   - if(aif.getRoute()>-1){
2212   - if(((inout==aif.getInOut() && zdbm==aif.getRoute()) || !(zdbm ==aif.getRoute()))){
2213   - if(aif.getRoute()<=zdbm ){
2214   - inoutList.add(map2);
2215   - map2=new HashMap<String, Object>();
2216   - arrivalList=new ArrayList<ArrivalInfo>();
2217   - }
  2254 + Map<String, Object> map2=new HashMap<String, Object>();
  2255 + for (int i = 0; i < list_nbbm.size(); i++) {
  2256 + String nbbm=list_nbbm.get(i);
  2257 +
  2258 + int zdbm =0;
  2259 + int inout=-1;
  2260 + List<ArrivalInfo> arrivalList=new ArrayList<ArrivalInfo>();
  2261 + for (int j = 0; j < arrInfoList.size(); j++) {
  2262 + ArrivalInfo aif=arrInfoList.get(j);
  2263 +
  2264 + if(aif.getDeviceId().equals(nbbm)){
  2265 + map2.put("nbbm", BasicData.deviceId2NbbmMap.get(nbbm));
  2266 + if(aif.getRoute()>-1){
  2267 + if(((inout==aif.getInOut() && zdbm==aif.getRoute()) || !(zdbm ==aif.getRoute()))){
  2268 + if(aif.getRoute()<=zdbm ){
  2269 + inoutList.add(map2);
  2270 + map2=new HashMap<String, Object>();
  2271 + arrivalList=new ArrayList<ArrivalInfo>();
2218 2272 }
2219   - arrivalList.add(aif);
  2273 + }
  2274 + arrivalList.add(aif);
2220 2275 // if(!(zdbm ==aif.getRoute())){
2221   - Map<String, String> m_=this.strInOut(arrivalList,lzsj);
2222   - map2.put(aif.getStopNo()+"in", m_.get("in"));
2223   - map2.put(aif.getStopNo()+"out", m_.get("out"));
2224   - map2.put(aif.getStopNo(), m_.get("type"));
  2276 + Map<String, String> m_=this.strInOut(arrivalList,lzsj);
  2277 + map2.put(aif.getStopNo()+"in", m_.get("in"));
  2278 + map2.put(aif.getStopNo()+"out", m_.get("out"));
  2279 + map2.put(aif.getStopNo(), m_.get("type"));
2225 2280 // arrivalList=new ArrayList<ArrivalInfo>();
2226 2281 // }
2227   - zdbm =aif.getRoute();
2228   - inout=aif.getInOut();
2229   -
2230   - }
2231   -
  2282 + zdbm =aif.getRoute();
  2283 + inout=aif.getInOut();
  2284 +
2232 2285 }
2233   -
  2286 +
2234 2287 }
  2288 +
2235 2289 }
2236   -
2237   - return inoutList;
2238 2290 }
2239   -
2240   - public Map<String, String> strInOut(List<ArrivalInfo> lists,String lzsj){
2241   - String inout="";
2242   - SimpleDateFormat sdf = new SimpleDateFormat("HH:mm:ss");
2243   - Long in=0L;
2244   - Long out=0L;
2245   - for(int i=0;i<lists.size();i++){
2246   - ArrivalInfo t1=lists.get(i);
2247   - if(t1.getInOut()==0){
2248   - in=t1.getTs();
2249   - t1.setJzsj(sdf.format(new Date(t1.getTs())));
2250   - for(int j=0;j<lists.size();j++){
2251   - ArrivalInfo t2=lists.get(j);
2252   - if(t2.getInOut()==1 && t2.getDeviceId().equals(t1.getDeviceId())
2253   - && t2.getStopNo().equals(t1.getStopNo())
2254   - && t2.getTs()>t1.getTs()){
2255   - t1.setCzsj(sdf.format(new Date(t2.getTs())));
2256   - out =t2.getTs();
2257   - break;
2258   - }else{
2259   - t1.setCzsj("");
2260   - out =0l;
2261   - }
  2291 +
  2292 + return inoutList;
  2293 + }
  2294 +
  2295 + public Map<String, String> strInOut(List<ArrivalInfo> lists,String lzsj){
  2296 + String inout="";
  2297 + SimpleDateFormat sdf = new SimpleDateFormat("HH:mm:ss");
  2298 + Long in=0L;
  2299 + Long out=0L;
  2300 + for(int i=0;i<lists.size();i++){
  2301 + ArrivalInfo t1=lists.get(i);
  2302 + if(t1.getInOut()==0){
  2303 + in=t1.getTs();
  2304 + t1.setJzsj(sdf.format(new Date(t1.getTs())));
  2305 + for(int j=0;j<lists.size();j++){
  2306 + ArrivalInfo t2=lists.get(j);
  2307 + if(t2.getInOut()==1 && t2.getDeviceId().equals(t1.getDeviceId())
  2308 + && t2.getStopNo().equals(t1.getStopNo())
  2309 + && t2.getTs()>t1.getTs()){
  2310 + t1.setCzsj(sdf.format(new Date(t2.getTs())));
  2311 + out =t2.getTs();
  2312 + break;
  2313 + }else{
  2314 + t1.setCzsj("");
  2315 + out =0l;
2262 2316 }
2263   -
2264   - }else{
2265   - out =t1.getTs();
2266   - t1.setCzsj(sdf.format(new Date(t1.getTs())));
2267   - for(int j=0;j<lists.size();j++){
2268   - ArrivalInfo t2=lists.get(j);
2269   - if(t2.getInOut()==0 && t2.getDeviceId().equals(t1.getDeviceId())
2270   - && t2.getStopNo().equals(t1.getStopNo())
2271   - && t2.getTs()>t1.getTs()){
2272   - in =t2.getTs();
2273   - t1.setJzsj(sdf.format(new Date(t2.getTs())));
2274   - break;
2275   - }
  2317 + }
  2318 +
  2319 + }else{
  2320 + out =t1.getTs();
  2321 + t1.setCzsj(sdf.format(new Date(t1.getTs())));
  2322 + for(int j=0;j<lists.size();j++){
  2323 + ArrivalInfo t2=lists.get(j);
  2324 + if(t2.getInOut()==0 && t2.getDeviceId().equals(t1.getDeviceId())
  2325 + && t2.getStopNo().equals(t1.getStopNo())
  2326 + && t2.getTs()>t1.getTs()){
  2327 + in =t2.getTs();
  2328 + t1.setJzsj(sdf.format(new Date(t2.getTs())));
  2329 + break;
2276 2330 }
2277 2331 }
2278 2332 }
2279   -
2280   - Map<String, String> map=new HashMap<String,String>();
2281   - if(in>0 ){
2282   - map.put("in",sdf.format(new Date(in)));
2283   -
  2333 + }
  2334 +
  2335 + Map<String, String> map=new HashMap<String,String>();
  2336 + if(in>0 ){
  2337 + map.put("in",sdf.format(new Date(in)));
  2338 +
  2339 + }else{
  2340 + map.put("in", "");
  2341 + }
  2342 + if(out>0){
  2343 + map.put("out", sdf.format(new Date(out)));
  2344 + }else{
  2345 + map.put("out", "");
  2346 + }
  2347 + Long sj=1000000000L;
  2348 + if(!lzsj.trim().equals("")){
  2349 + sj =Long.parseLong(lzsj);
  2350 + }
  2351 + if(in>0 && out >0){
  2352 + if((out-in)/1000>sj){
  2353 + map.put("type", "y");
2284 2354 }else{
2285   - map.put("in", "");
  2355 + map.put("type", "n");
  2356 + }
  2357 + }
  2358 + return map;
  2359 + }
  2360 + @Override
  2361 + public List<StationRoute> queryStrinon(String line, int zd) {
  2362 + // TODO Auto-generated method stub
  2363 + List<StationRoute> listStation= stationRouteRepository.findByLine(line,zd);
  2364 + return listStation;
  2365 + }
  2366 + @Override
  2367 + public List<Map<String, Object>> countByList(Map<String, Object> map) {
  2368 + // TODO Auto-generated method stub
  2369 +
  2370 + List<Map<String, Object>> lMap = new ArrayList<Map<String, Object>>();
  2371 + String gsdm="";
  2372 + if(map.get("gsdm")!=null){
  2373 + gsdm=map.get("gsdm").toString();
  2374 + }
  2375 + String fgsdm="";
  2376 + if(map.get("fgsdm")!=null){
  2377 + fgsdm=map.get("fgsdm").toString();
  2378 + }
  2379 + String line="";
  2380 + if(map.get("line")!=null){
  2381 + line=map.get("line").toString();
  2382 + }
  2383 + String date="";
  2384 + if(map.get("date")!=null){
  2385 + date=map.get("date").toString();
  2386 + }
  2387 + String date2="";
  2388 + if(map.get("date2")!=null){
  2389 + date2=map.get("date2").toString();
  2390 + }
  2391 + String xlName="";
  2392 + if(map.get("xlName")!=null){
  2393 + xlName=map.get("xlName").toString();
  2394 + }
  2395 + String type="";
  2396 + if(map.get("type")!=null){
  2397 + type=map.get("type").toString();
  2398 + }
  2399 + //所有班次信息
  2400 + List<ScheduleRealInfo> list = new ArrayList<ScheduleRealInfo>();
  2401 + line =line.trim();
  2402 + if(line.equals("")){
  2403 + //查询所有线路
  2404 + list = scheduleRealInfoRepository.scheduleByDateAndLineTj(line, date,date2,gsdm,fgsdm);
  2405 + }else{
  2406 + //查询单条线路
  2407 + list = scheduleRealInfoRepository.scheduleByDateAndLineTj2(line, date,date2);
  2408 + }
  2409 +
  2410 + String sql="select r.xl_bm"
  2411 + + " from bsth_c_s_sp_info_real r where"
  2412 + + " r.schedule_date_str BETWEEN '"+date+"' and '"+date2+"'";
  2413 +
  2414 +
  2415 + if(line.equals("")){
  2416 + sql +="and r.gs_bm='"+gsdm+"' "
  2417 + + " and r.fgs_bm='"+fgsdm+"'";
  2418 + }else{
  2419 + sql += " and r.xl_bm = '"+line+"'";
  2420 + }
  2421 + sql += " group by r.xl_bm";
  2422 +
  2423 + List<String> listLine=jdbcTemplate.query(sql, new RowMapper<String>() {
  2424 + @Override
  2425 + public String mapRow(ResultSet arg0, int arg1) throws SQLException {
  2426 + String ve = arg0.getString("xl_bm");
  2427 + return ve;
2286 2428 }
2287   - if(out>0){
2288   - map.put("out", sdf.format(new Date(out)));
  2429 + });
  2430 + for (int i = 0; i < listLine.size(); i++) {
  2431 + List<ScheduleRealInfo> lists = new ArrayList<ScheduleRealInfo>();
  2432 + String lineStr=listLine.get(i);
  2433 + for (int j = 0; j < list.size(); j++) {
  2434 + ScheduleRealInfo s=list.get(j);
  2435 + if(s.getXlBm().equals(lineStr)){
  2436 + lists.add(s);
  2437 + }
  2438 + }
  2439 +
  2440 + //计算线路的各项公里
  2441 + if(lists.size()>0){
  2442 + Map<String, Object> newMap=staticTj(lists,"z");
  2443 + lMap.add(newMap);
  2444 + }
  2445 + }
  2446 + if(list.size()>0){
  2447 + Map<String, Object> newMap=staticTj(list,"f");
  2448 + lMap.add(newMap);
  2449 + }
  2450 + if(type.equals("export")){
  2451 + List<Iterator<?>> listI = new ArrayList<Iterator<?>>();
  2452 + Map<String, Object> m = new HashMap<String, Object>();
  2453 + m.put("date", date);
  2454 + m.put("date1", date2);
  2455 + String by=map.get("by").toString();
  2456 + String xls="";
  2457 + if(by.equals("sj")){
  2458 + xls="countByLine.xls";
2289 2459 }else{
2290   - map.put("out", "");
  2460 + xls="countByLines.xls";
2291 2461 }
2292   - Long sj=1000000000L;
2293   - if(!lzsj.trim().equals("")){
2294   - sj =Long.parseLong(lzsj);
  2462 + ReportUtils ee = new ReportUtils();
  2463 + try {
  2464 + listI.add(lMap.iterator());
  2465 + String path = this.getClass().getResource("/").getPath() + "static/pages/forms/";
  2466 + ee.excelReplace(listI, new Object[]{m}, path + "mould/"+xls,
  2467 + path + "export/线路公里统计表.xls");
  2468 + } catch (Exception e) {
  2469 + // TODO: handle exception
  2470 + e.printStackTrace();
2295 2471 }
2296   - if(in>0 && out >0){
2297   - if((out-in)/1000>sj){
2298   - map.put("type", "y");
2299   - }else{
2300   - map.put("type", "n");
  2472 + }
  2473 + return lMap;
  2474 + }
  2475 +
  2476 +
  2477 + public final Map<String, Object> staticTj(List<ScheduleRealInfo> list,String status){
  2478 +
  2479 + List<ScheduleRealInfo> lists=new ArrayList<ScheduleRealInfo>();
  2480 + for(int i=0;i<list.size();i++){
  2481 + ScheduleRealInfo s=list.get(i);
  2482 + Set<ChildTaskPlan> cts = s.getcTasks();
  2483 + if(cts != null && cts.size() > 0){
  2484 + lists.add(s);
  2485 + }else{
  2486 + if(s.getZdsjActual()!=null){
  2487 + lists.add(s);
2301 2488 }
2302 2489 }
2303   - return map;
2304   - }
2305   - @Override
2306   - public List<StationRoute> queryStrinon(String line, int zd) {
2307   - // TODO Auto-generated method stub
2308   - List<StationRoute> listStation= stationRouteRepository.findByLine(line,zd);
2309   - return listStation;
2310   - }
2311   - @Override
2312   - public List<Map<String, Object>> countByList(Map<String, Object> map) {
2313   - // TODO Auto-generated method stub
2314   -
2315   - List<Map<String, Object>> lMap = new ArrayList<Map<String, Object>>();
2316   - String gsdm="";
2317   - if(map.get("gsdm")!=null){
2318   - gsdm=map.get("gsdm").toString();
2319   - }
2320   - String fgsdm="";
2321   - if(map.get("fgsdm")!=null){
2322   - fgsdm=map.get("fgsdm").toString();
2323   - }
2324   - String line="";
2325   - if(map.get("line")!=null){
2326   - line=map.get("line").toString();
2327   - }
2328   - String date="";
2329   - if(map.get("date")!=null){
2330   - date=map.get("date").toString();
2331   - }
2332   - String date2="";
2333   - if(map.get("date2")!=null){
2334   - date2=map.get("date2").toString();
2335   - }
2336   - String xlName="";
2337   - if(map.get("xlName")!=null){
2338   - xlName=map.get("xlName").toString();
2339   - }
2340   - String type="";
2341   - if(map.get("type")!=null){
2342   - type=map.get("type").toString();
2343   - }
2344   - //所有班次信息
2345   - List<ScheduleRealInfo> list = new ArrayList<ScheduleRealInfo>();
2346   - line =line.trim();
2347   - if(line.equals("")){
2348   - //查询所有线路
2349   - list = scheduleRealInfoRepository.scheduleByDateAndLineTj(line, date,date2,gsdm,fgsdm);
2350   - }else{
2351   - //查询单条线路
2352   - list = scheduleRealInfoRepository.scheduleByDateAndLineTj2(line, date,date2);
2353   - }
2354   -
2355   - String sql="select r.xl_bm"
2356   - + " from bsth_c_s_sp_info_real r where"
2357   - + " r.schedule_date_str BETWEEN '"+date+"' and '"+date2+"'";
2358   -
2359   -
2360   - if(line.equals("")){
2361   - sql +="and r.gs_bm='"+gsdm+"' "
2362   - + " and r.fgs_bm='"+fgsdm+"'";
  2490 + }
  2491 + Map<String, Object> map = new HashMap<String, Object>();
  2492 + if(list.size()>0){
  2493 + if(status.equals("f")){
  2494 + map.put("xlName","合计");
  2495 + map.put("gs", "");
  2496 + map.put("fgs", "");
2363 2497 }else{
2364   - sql += " and r.xl_bm = '"+line+"'";
  2498 + map.put("xlName", list.get(0).getXlName());
  2499 + map.put("gs", list.get(0).getGsName());
  2500 + map.put("fgs", list.get(0).getFgsName());
  2501 + map.put("jGh", list.get(0).getjGh());
  2502 + map.put("sGh", list.get(0).getsGh()==null?"":list.get(0).getsGh());
  2503 + map.put("nbbm",list.get(0).getClZbh());
  2504 + map.put("line", list.get(0).getXlBm());
2365 2505 }
2366   - sql += " group by r.xl_bm";
2367   -
2368   - List<String> listLine=jdbcTemplate.query(sql, new RowMapper<String>() {
2369   - @Override
2370   - public String mapRow(ResultSet arg0, int arg1) throws SQLException {
2371   - String ve = arg0.getString("xl_bm");
2372   - return ve;
2373   - }
2374   - });
2375   - for (int i = 0; i < listLine.size(); i++) {
2376   - List<ScheduleRealInfo> lists = new ArrayList<ScheduleRealInfo>();
2377   - String lineStr=listLine.get(i);
2378   - for (int j = 0; j < list.size(); j++) {
2379   - ScheduleRealInfo s=list.get(j);
2380   - if(s.getXlBm().equals(lineStr)){
2381   - lists.add(s);
2382   - }
2383   - }
2384   -
2385   - //计算线路的各项公里
2386   - if(lists.size()>0){
2387   - Map<String, Object> newMap=staticTj(lists,"z");
2388   - lMap.add(newMap);
2389   - }
2390   - }
2391   - if(list.size()>0){
2392   - Map<String, Object> newMap=staticTj(list,"f");
2393   - lMap.add(newMap);
2394   - }
2395   - if(type.equals("export")){
2396   - List<Iterator<?>> listI = new ArrayList<Iterator<?>>();
2397   - Map<String, Object> m = new HashMap<String, Object>();
2398   - m.put("date", date);
2399   - m.put("date1", date2);
2400   - String by=map.get("by").toString();
2401   - String xls="";
2402   - if(by.equals("sj")){
2403   - xls="countByLine.xls";
2404   - }else{
2405   - xls="countByLines.xls";
2406   - }
2407   - ReportUtils ee = new ReportUtils();
2408   - try {
2409   - listI.add(lMap.iterator());
2410   - String path = this.getClass().getResource("/").getPath() + "static/pages/forms/";
2411   - ee.excelReplace(listI, new Object[]{m}, path + "mould/"+xls,
2412   - path + "export/线路公里统计表.xls");
2413   - } catch (Exception e) {
2414   - // TODO: handle exception
2415   - e.printStackTrace();
2416   - }
2417   - }
2418   - return lMap;
  2506 +
  2507 + double jhyygl=culateService.culateJhgl(list);//计划营运公里
  2508 + double jhjcclc= culateService.culateJhJccgl(list);//计划进出场公里(计划空驶公里)
  2509 + map.put("jhlc", jhyygl);
  2510 + map.put("jcclc", jhjcclc);
  2511 + map.put("jhzlc", Arith.add(jhyygl, jhjcclc));//计划总里程
  2512 +
  2513 + //计划内外营运
  2514 + Map<String, Double> culateSjlcMap=culateService.culateSjlcMap(lists);
  2515 + double jhnlc=culateSjlcMap.get("jhnlc");
  2516 + double jhwlc=culateSjlcMap.get("jhwlc");
  2517 + map.put("jhnlc", jhnlc);
  2518 + map.put("jhwlc", jhwlc);
  2519 + double zyylc=Arith.add(jhnlc, jhwlc);
  2520 +
  2521 + //计划内外进出场
  2522 + Map<String, Double> culateSjJcclcMap=culateService.culateSjJcclcMap(lists);
  2523 + double jhwjcclc=culateSjJcclcMap.get("jhwlc");
  2524 + double jhnjcclc=culateSjJcclcMap.get("jhnlc");
  2525 + map.put("jhwjcclc", jhwjcclc);
  2526 + map.put("jhnjcclc", jhnjcclc);
  2527 + double zjcclc=Arith.add(jhwjcclc, jhnjcclc);
  2528 +
  2529 + //临加公里
  2530 + Map<String, Double> culateLjMile=culateService.culateLjMile(lists);
  2531 + double ljyy=culateLjMile.get("ljyy");
  2532 + double ljjcc=culateLjMile.get("ljjcc");
  2533 + double ljkfks=culateLjMile.get("ljkfks");
  2534 + map.put("ljyy", ljyy);
  2535 + map.put("ljjcc", ljjcc);
  2536 + map.put("ljkfks", ljkfks);
  2537 +
  2538 + double ljlc=Arith.add(Arith.add(ljyy, ljjcc),ljkfks);
  2539 +
  2540 + double lbss=culateService.culateSsMile(list);//烂班少驶
  2541 + map.put("lbss", lbss);
  2542 + map.put("ssgl_lz", culateService.culateSsMileXx(list, "路阻"));
  2543 + map.put("ssgl_dm", culateService.culateSsMileXx(list, "吊慢"));
  2544 + map.put("ssgl_gz", culateService.culateSsMileXx(list, "故障"));
  2545 + map.put("ssgl_jf", culateService.culateSsMileXx(list, "纠纷"));
  2546 + map.put("ssgl_zs", culateService.culateSsMileXx(list, "肇事"));
  2547 + map.put("ssgl_qr", culateService.culateSsMileXx(list, "缺人"));
  2548 + map.put("ssgl_qc", culateService.culateSsMileXx(list, "缺车"));
  2549 + map.put("ssgl_kx", culateService.culateSsMileXx(list, "客稀"));
  2550 + map.put("ssgl_qh", culateService.culateSsMileXx(list, "气候"));
  2551 + map.put("ssgl_yw", culateService.culateSsMileXx(list, "援外"));
  2552 + map.put("ssgl_other", culateService.culateSsMileXx(list, "其他"));
  2553 +
  2554 +
  2555 + double zrwjcclc=culateService.culateZrwJccLc(list, "故障");
  2556 + double zrwjcclc1=culateService.culateZrwJccLc(list, "肇事");
  2557 + double zrwjcclc2=culateService.culateZrwJccLc(list, "纠纷");
  2558 + double zrwjcclcqt=culateService.culateZrwJccLc(list, "其他");
  2559 + map.put("jhwjcclc_z", Arith.add(jhwjcclc,zrwjcclcqt));
  2560 + map.put("zrwjcclc", zrwjcclc);
  2561 + map.put("zrwjcclc1", zrwjcclc1);
  2562 + map.put("zrwjcclc2", zrwjcclc2);
  2563 + map.put("zrwjcclcqt", zrwjcclcqt);
  2564 + double zrwjcc=Arith.add(Arith.add(Arith.add(zrwjcclc, zrwjcclc1), zrwjcclc2),zrwjcclcqt);
  2565 + double kfks=Arith.add(culateService.culateKfksLc(lists),culateService.culateZrwJccLc(list, "空放"));
  2566 + map.put("kfks", kfks);
  2567 + double zlc=Arith.add(Arith.add(Arith.add(zrwjcc, ljlc),
  2568 + Arith.add(zjcclc, zyylc)),kfks);
  2569 + map.put("zlc", zlc);
2419 2570 }
2420   -
2421   -
2422   - public final Map<String, Object> staticTj(List<ScheduleRealInfo> list,String status){
2423   -
2424   - List<ScheduleRealInfo> lists=new ArrayList<ScheduleRealInfo>();
2425   - for(int i=0;i<list.size();i++){
2426   - ScheduleRealInfo s=list.get(i);
2427   - Set<ChildTaskPlan> cts = s.getcTasks();
2428   - if(cts != null && cts.size() > 0){
2429   - lists.add(s);
2430   - }else{
2431   - if(s.getZdsjActual()!=null){
2432   - lists.add(s);
2433   - }
2434   - }
2435   - }
2436   - Map<String, Object> map = new HashMap<String, Object>();
2437   - if(list.size()>0){
2438   - if(status.equals("f")){
2439   - map.put("xlName","合计");
2440   - map.put("gs", "");
2441   - map.put("fgs", "");
2442   - }else{
2443   - map.put("xlName", list.get(0).getXlName());
2444   - map.put("gs", list.get(0).getGsName());
2445   - map.put("fgs", list.get(0).getFgsName());
2446   - map.put("jGh", list.get(0).getjGh());
2447   - map.put("sGh", list.get(0).getsGh()==null?"":list.get(0).getsGh());
2448   - map.put("nbbm",list.get(0).getClZbh());
2449   - map.put("line", list.get(0).getXlBm());
2450   - }
2451   -
2452   - double jhyygl=culateService.culateJhgl(list);//计划营运公里
2453   - double jhjcclc= culateService.culateJhJccgl(list);//计划进出场公里(计划空驶公里)
2454   - map.put("jhlc", jhyygl);
2455   - map.put("jcclc", jhjcclc);
2456   - map.put("jhzlc", Arith.add(jhyygl, jhjcclc));//计划总里程
2457   -
2458   - //计划内外营运
2459   - Map<String, Double> culateSjlcMap=culateService.culateSjlcMap(lists);
2460   - double jhnlc=culateSjlcMap.get("jhnlc");
2461   - double jhwlc=culateSjlcMap.get("jhwlc");
2462   - map.put("jhnlc", jhnlc);
2463   - map.put("jhwlc", jhwlc);
2464   - double zyylc=Arith.add(jhnlc, jhwlc);
2465   -
2466   - //计划内外进出场
2467   - Map<String, Double> culateSjJcclcMap=culateService.culateSjJcclcMap(lists);
2468   - double jhwjcclc=culateSjJcclcMap.get("jhwlc");
2469   - double jhnjcclc=culateSjJcclcMap.get("jhnlc");
2470   - map.put("jhwjcclc", jhwjcclc);
2471   - map.put("jhnjcclc", jhnjcclc);
2472   - double zjcclc=Arith.add(jhwjcclc, jhnjcclc);
2473   -
2474   - //临加公里
2475   - Map<String, Double> culateLjMile=culateService.culateLjMile(lists);
2476   - double ljyy=culateLjMile.get("ljyy");
2477   - double ljjcc=culateLjMile.get("ljjcc");
2478   - double ljkfks=culateLjMile.get("ljkfks");
2479   - map.put("ljyy", ljyy);
2480   - map.put("ljjcc", ljjcc);
2481   - map.put("ljkfks", ljkfks);
2482   -
2483   - double ljlc=Arith.add(Arith.add(ljyy, ljjcc),ljkfks);
2484   -
2485   - double lbss=culateService.culateSsMile(list);//烂班少驶
2486   - map.put("lbss", lbss);
2487   - map.put("ssgl_lz", culateService.culateSsMileXx(list, "路阻"));
2488   - map.put("ssgl_dm", culateService.culateSsMileXx(list, "吊慢"));
2489   - map.put("ssgl_gz", culateService.culateSsMileXx(list, "故障"));
2490   - map.put("ssgl_jf", culateService.culateSsMileXx(list, "纠纷"));
2491   - map.put("ssgl_zs", culateService.culateSsMileXx(list, "肇事"));
2492   - map.put("ssgl_qr", culateService.culateSsMileXx(list, "缺人"));
2493   - map.put("ssgl_qc", culateService.culateSsMileXx(list, "缺车"));
2494   - map.put("ssgl_kx", culateService.culateSsMileXx(list, "客稀"));
2495   - map.put("ssgl_qh", culateService.culateSsMileXx(list, "气候"));
2496   - map.put("ssgl_yw", culateService.culateSsMileXx(list, "援外"));
2497   - map.put("ssgl_other", culateService.culateSsMileXx(list, "其他"));
2498   -
2499   -
2500   - double zrwjcclc=culateService.culateZrwJccLc(list, "故障");
2501   - double zrwjcclc1=culateService.culateZrwJccLc(list, "肇事");
2502   - double zrwjcclc2=culateService.culateZrwJccLc(list, "纠纷");
2503   - double zrwjcclcqt=culateService.culateZrwJccLc(list, "其他");
2504   - map.put("jhwjcclc_z", Arith.add(jhwjcclc,zrwjcclcqt));
2505   - map.put("zrwjcclc", zrwjcclc);
2506   - map.put("zrwjcclc1", zrwjcclc1);
2507   - map.put("zrwjcclc2", zrwjcclc2);
2508   - map.put("zrwjcclcqt", zrwjcclcqt);
2509   - double zrwjcc=Arith.add(Arith.add(Arith.add(zrwjcclc, zrwjcclc1), zrwjcclc2),zrwjcclcqt);
2510   - double kfks=Arith.add(culateService.culateKfksLc(lists),culateService.culateZrwJccLc(list, "空放"));
2511   - map.put("kfks", kfks);
2512   - double zlc=Arith.add(Arith.add(Arith.add(zrwjcc, ljlc),
2513   - Arith.add(zjcclc, zyylc)),kfks);
2514   - map.put("zlc", zlc);
2515   - }
2516   - return map;
2517   - }
2518   - @Override
2519   - public List<Map<String, Object>> countByBusList(Map<String, Object> map) {
2520   - // TODO Auto-generated method stub
2521   - SimpleDateFormat sdf =new SimpleDateFormat("yyyy-MM-dd");
2522   - List<Map<String, Object>> lMap = new ArrayList<Map<String, Object>>();
2523   - List<Map<String, Object>> lMaps = new ArrayList<Map<String, Object>>();
2524   - String gsdm="";
2525   - if(map.get("gsdm")!=null){
2526   - gsdm=map.get("gsdm").toString();
2527   - }
2528   - String fgsdm="";
2529   - if(map.get("fgsdm")!=null){
2530   - fgsdm=map.get("fgsdm").toString();
2531   - }
2532   - String line="";
2533   - if(map.get("line")!=null){
2534   - line=map.get("line").toString();
2535   - }
2536   - String date="";
2537   - if(map.get("date")!=null){
2538   - date=map.get("date").toString();
2539   - }
2540   - String date2="";
2541   - if(map.get("date2")!=null){
2542   - date2=map.get("date2").toString();
2543   - }
2544   - String xlName="";
2545   - if(map.get("xlName")!=null){
2546   - xlName=map.get("xlName").toString();
2547   - }
2548   - String zt="";
2549   - if(map.get("zt")!=null){
2550   - zt=map.get("zt").toString();
2551   - }
2552   - String type="";
2553   - if(map.get("type")!=null){
2554   - type=map.get("type").toString();
2555   - }
2556   - //所有班次信息
2557   - List<ScheduleRealInfo> list = new ArrayList<ScheduleRealInfo>();
2558   - line =line.trim();
2559   - if(line.equals("")){
2560   - //查询所有线路
2561   - list = scheduleRealInfoRepository.scheduleByDateAndLineTj(line, date,date2,gsdm,fgsdm);
2562   - }else{
2563   - //查询单条线路
2564   - list = scheduleRealInfoRepository.scheduleByDateAndLineTj2(line, date,date2);
2565   - }
2566   - String ylbSql=" select * from bsth_c_ylb where rq BETWEEN '"+date+"' and '"+date2+"'";
2567   - if(line.equals("")){
2568   - ylbSql +="and ssgsdm='"+gsdm+"' "
2569   - + " and fgsdm='"+fgsdm+"'";
  2571 + return map;
  2572 + }
  2573 + @Override
  2574 + public List<Map<String, Object>> countByBusList(Map<String, Object> map) {
  2575 + // TODO Auto-generated method stub
  2576 + SimpleDateFormat sdf =new SimpleDateFormat("yyyy-MM-dd");
  2577 + List<Map<String, Object>> lMap = new ArrayList<Map<String, Object>>();
  2578 + List<Map<String, Object>> lMaps = new ArrayList<Map<String, Object>>();
  2579 + String gsdm="";
  2580 + if(map.get("gsdm")!=null){
  2581 + gsdm=map.get("gsdm").toString();
  2582 + }
  2583 + String fgsdm="";
  2584 + if(map.get("fgsdm")!=null){
  2585 + fgsdm=map.get("fgsdm").toString();
  2586 + }
  2587 + String line="";
  2588 + if(map.get("line")!=null){
  2589 + line=map.get("line").toString();
  2590 + }
  2591 + String date="";
  2592 + if(map.get("date")!=null){
  2593 + date=map.get("date").toString();
  2594 + }
  2595 + String date2="";
  2596 + if(map.get("date2")!=null){
  2597 + date2=map.get("date2").toString();
  2598 + }
  2599 + String xlName="";
  2600 + if(map.get("xlName")!=null){
  2601 + xlName=map.get("xlName").toString();
  2602 + }
  2603 + String zt="";
  2604 + if(map.get("zt")!=null){
  2605 + zt=map.get("zt").toString();
  2606 + }
  2607 + String type="";
  2608 + if(map.get("type")!=null){
  2609 + type=map.get("type").toString();
  2610 + }
  2611 + //所有班次信息
  2612 + List<ScheduleRealInfo> list = new ArrayList<ScheduleRealInfo>();
  2613 + line =line.trim();
  2614 + if(line.equals("")){
  2615 + //查询所有线路
  2616 + list = scheduleRealInfoRepository.scheduleByDateAndLineTj(line, date,date2,gsdm,fgsdm);
  2617 + }else{
  2618 + //查询单条线路
  2619 + list = scheduleRealInfoRepository.scheduleByDateAndLineTj2(line, date,date2);
  2620 + }
  2621 + String ylbSql=" select * from bsth_c_ylb where rq BETWEEN '"+date+"' and '"+date2+"'";
  2622 + if(line.equals("")){
  2623 + ylbSql +="and ssgsdm='"+gsdm+"' "
  2624 + + " and fgsdm='"+fgsdm+"'";
  2625 + }else{
  2626 + ylbSql += " and xlbm = '"+line+"'";
  2627 + }
  2628 + List<Ylb> ylbList=ylbList(ylbSql);
  2629 + String dlbSql=" select * from bsth_c_dlb where rq BETWEEN '"+date+"' and '"+date2+"'";
  2630 + if(line.equals("")){
  2631 + dlbSql +="and ssgsdm='"+gsdm+"' "
  2632 + + " and fgsdm='"+fgsdm+"'";
  2633 + }else{
  2634 + dlbSql += " and xlbm = '"+line+"'";
  2635 + }
  2636 + List<Dlb> dlbList=dlbList(dlbSql);
  2637 + String sql="select r.xl_bm,r.schedule_date_str,r.cl_zbh,r.j_gh,r.s_gh"
  2638 + + " from bsth_c_s_sp_info_real r where"
  2639 + + " r.schedule_date_str BETWEEN '"+date+"' and '"+date2+"'";
  2640 + if(line.equals("")){
  2641 + sql +="and r.gs_bm='"+gsdm+"' "
  2642 + + " and r.fgs_bm='"+fgsdm+"'";
  2643 + }else{
  2644 + sql += " and r.xl_bm = '"+line+"'";
  2645 + }
  2646 + sql += " group by r.xl_bm,r.cl_zbh,r.schedule_date_str,r.j_gh,r.s_gh";
  2647 +
  2648 + List<Map<String, Object>> listGroupBy=jdbcTemplate.query(sql, new RowMapper<Map<String, Object>>() {
  2649 + @Override
  2650 + public Map<String, Object> mapRow(ResultSet arg0, int arg1) throws SQLException {
  2651 + Map<String, Object> map=new HashMap<String,Object>();
  2652 + map.put("line",arg0.getString("xl_bm"));
  2653 + map.put("date", arg0.getString("schedule_date_str"));
  2654 + map.put("nbbm", arg0.getString("cl_zbh"));
  2655 + map.put("jGh", arg0.getString("j_gh"));
  2656 + map.put("sGh", arg0.getString("s_gh"));
  2657 + return map;
  2658 + }
  2659 + });
  2660 + for (int i = 0; i < listGroupBy.size(); i++) {
  2661 + Map<String, Object> m=listGroupBy.get(i);
  2662 + String xl_bm=m.get("line")==null?"":m.get("line").toString();
  2663 + String dateStr=m.get("date")==null?"":m.get("date").toString();
  2664 + String nbbm =m.get("nbbm")==null?"":m.get("nbbm").toString();
  2665 + String jGh= m.get("jGh")==null?"":m.get("jGh").toString();
  2666 + String sGh= m.get("sGh")==null?"":m.get("sGh").toString();
  2667 + List<ScheduleRealInfo> lists=new ArrayList<ScheduleRealInfo>();
  2668 + for (int j = 0; j < list.size(); j++) {
  2669 + ScheduleRealInfo s=list.get(j);
  2670 + if(zt.equals("zbh")){
  2671 + if(xl_bm.equals(s.getXlBm()) && nbbm.equals(s.getClZbh())){
  2672 + lists.add(s);
  2673 + }
2570 2674 }else{
2571   - ylbSql += " and xlbm = '"+line+"'";
  2675 + if(xl_bm.equals(s.getXlBm()) && nbbm.equals(s.getClZbh())
  2676 + && dateStr.equals(s.getScheduleDateStr())
  2677 + && jGh.equals(s.getjGh()) && sGh.equals(s.getsGh())){
  2678 + lists.add(s);
  2679 + }
  2680 + }
  2681 + }
  2682 +
  2683 + if(zt.equals("zbh")){
  2684 + Map<String, Object> newMap=staticTj(lists, "");
  2685 + double yhl=0.0;
  2686 + double jzl=0.0;
  2687 + double hyl=0.0;
  2688 + double dhl=0.0;
  2689 + double cdl=0.0;
  2690 + for (int j = 0; j < ylbList.size(); j++) {
  2691 + Ylb y=ylbList.get(j);
  2692 + if(nbbm.equals(y.getNbbm()) && xl_bm.equals(y.getXlbm())){
  2693 + yhl=Arith.add(yhl, y.getYh());
  2694 + jzl=Arith.add(jzl, y.getJzl());
  2695 + hyl=Arith.add(hyl, y.getYh());
  2696 + }
  2697 +
2572 2698 }
2573   - List<Ylb> ylbList=ylbList(ylbSql);
2574   - String dlbSql=" select * from bsth_c_dlb where rq BETWEEN '"+date+"' and '"+date2+"'";
2575   - if(line.equals("")){
2576   - dlbSql +="and ssgsdm='"+gsdm+"' "
2577   - + " and fgsdm='"+fgsdm+"'";
  2699 + for (int j = 0; j < dlbList.size(); j++) {
  2700 + Dlb d=dlbList.get(j);
  2701 + if(nbbm.equals(d.getNbbm())&&xl_bm.equals(d.getXlbm())){
  2702 + dhl=Arith.add(dhl, d.getHd());
  2703 + cdl=Arith.add(cdl, d.getCdl());
  2704 + }
  2705 + }
  2706 + if(date.equals(date2)){
  2707 + newMap.put("rq",date);
2578 2708 }else{
2579   - dlbSql += " and xlbm = '"+line+"'";
  2709 + newMap.put("rq",date+"至"+date2);
2580 2710 }
2581   - List<Dlb> dlbList=dlbList(dlbSql);
2582   - String sql="select r.xl_bm,r.schedule_date_str,r.cl_zbh,r.j_gh,r.s_gh"
2583   - + " from bsth_c_s_sp_info_real r where"
2584   - + " r.schedule_date_str BETWEEN '"+date+"' and '"+date2+"'";
  2711 + newMap.put("yhl", yhl);
  2712 + newMap.put("jzl", jzl);
  2713 + newMap.put("hyl", hyl);
  2714 + newMap.put("dhl", dhl);
  2715 + newMap.put("cdl", cdl);
  2716 + lMap.add(newMap);
  2717 + }else{
  2718 + Map<String, Object> newMap=staticTj(lists, "");
  2719 + double lc=Double.parseDouble(newMap.get("zlc").toString());
  2720 + double yhl=0.0;
  2721 + double jzl=0.0;
  2722 + double hyl=0.0;
  2723 + double dhl=0.0;
  2724 + double cdl=0.0;
  2725 + double zlc=0.0;
  2726 + for (int j = 0; j < ylbList.size(); j++) {
  2727 + Ylb y=ylbList.get(j);
  2728 + if(nbbm.equals(y.getNbbm()) && xl_bm.equals(y.getXlbm())
  2729 + &&dateStr.equals(sdf.format(y.getRq()))
  2730 + &&jGh.equals(y.getName())){
  2731 + yhl=Arith.add(yhl, y.getYh());
  2732 + jzl=Arith.add(jzl, y.getJzl());
  2733 + hyl=Arith.add(hyl, y.getYh());
  2734 + zlc=Arith.add(zlc, y.getZlc());
  2735 + }
  2736 +
  2737 + }
  2738 +
  2739 + for (int j = 0; j < dlbList.size(); j++) {
  2740 + Dlb d=dlbList.get(j);
  2741 + if(nbbm.equals(d.getNbbm())&&xl_bm.equals(d.getXlbm())
  2742 + &&dateStr.equals(sdf.format(d.getRq()))
  2743 + &&jGh.equals(d.getName())){
  2744 + dhl=Arith.add(dhl, d.getHd());
  2745 + cdl=Arith.add(cdl, d.getCdl());
  2746 + zlc=Arith.add(zlc, d.getZlc());
  2747 + }
  2748 + }
  2749 + double div=0.0;
  2750 + if(lc>0){
  2751 + div=Arith.div(zlc, lc,2);
  2752 + }
  2753 + newMap.put("yhl", yhl*div);
  2754 + newMap.put("jzl", jzl*div);
  2755 + newMap.put("hyl", hyl*div);
  2756 + newMap.put("dhl", dhl*div);
  2757 + newMap.put("cdl", cdl*div);
  2758 + lMaps.add(newMap);
  2759 + }
  2760 +
  2761 + }
  2762 + if(!zt.equals("zbh")){
  2763 + String sqls="select r.xl_bm,r.cl_zbh,r.j_gh,r.s_gh"
  2764 + + " from bsth_c_s_sp_info_real r where"
  2765 + + " r.schedule_date_str BETWEEN '"+date+"' and '"+date2+"'";
2585 2766 if(line.equals("")){
2586   - sql +="and r.gs_bm='"+gsdm+"' "
  2767 + sqls +="and r.gs_bm='"+gsdm+"' "
2587 2768 + " and r.fgs_bm='"+fgsdm+"'";
2588 2769 }else{
2589   - sql += " and r.xl_bm = '"+line+"'";
  2770 + sqls += " and r.xl_bm = '"+line+"'";
2590 2771 }
2591   - sql += " group by r.xl_bm,r.cl_zbh,r.schedule_date_str,r.j_gh,r.s_gh";
2592   -
2593   - List<Map<String, Object>> listGroupBy=jdbcTemplate.query(sql, new RowMapper<Map<String, Object>>() {
  2772 + sqls += " group by r.xl_bm,r.cl_zbh,r.j_gh,r.s_gh";
  2773 +
  2774 + List<Map<String, Object>> listGroupBys=jdbcTemplate.query(sqls, new RowMapper<Map<String, Object>>() {
2594 2775 @Override
2595 2776 public Map<String, Object> mapRow(ResultSet arg0, int arg1) throws SQLException {
2596 2777 Map<String, Object> map=new HashMap<String,Object>();
2597 2778 map.put("line",arg0.getString("xl_bm"));
2598   - map.put("date", arg0.getString("schedule_date_str"));
2599 2779 map.put("nbbm", arg0.getString("cl_zbh"));
2600 2780 map.put("jGh", arg0.getString("j_gh"));
2601 2781 map.put("sGh", arg0.getString("s_gh"));
2602 2782 return map;
2603 2783 }
2604 2784 });
2605   - for (int i = 0; i < listGroupBy.size(); i++) {
2606   - Map<String, Object> m=listGroupBy.get(i);
2607   - String xl_bm=m.get("line")==null?"":m.get("line").toString();
2608   - String dateStr=m.get("date")==null?"":m.get("date").toString();
2609   - String nbbm =m.get("nbbm")==null?"":m.get("nbbm").toString();
2610   - String jGh= m.get("jGh")==null?"":m.get("jGh").toString();
2611   - String sGh= m.get("sGh")==null?"":m.get("sGh").toString();
2612   - List<ScheduleRealInfo> lists=new ArrayList<ScheduleRealInfo>();
2613   - for (int j = 0; j < list.size(); j++) {
2614   - ScheduleRealInfo s=list.get(j);
2615   - if(zt.equals("zbh")){
2616   - if(xl_bm.equals(s.getXlBm()) && nbbm.equals(s.getClZbh())){
2617   - lists.add(s);
2618   - }
2619   - }else{
2620   - if(xl_bm.equals(s.getXlBm()) && nbbm.equals(s.getClZbh())
2621   - && dateStr.equals(s.getScheduleDateStr())
2622   - && jGh.equals(s.getjGh()) && sGh.equals(s.getsGh())){
2623   - lists.add(s);
2624   - }
2625   - }
  2785 + lMap=lists(listGroupBys, lMaps, gsdm, fgsdm, date, date2);
  2786 +
  2787 + }
  2788 + if(type.equals("export")){
  2789 + List<Iterator<?>> listI = new ArrayList<Iterator<?>>();
  2790 + Map<String, Object> m = new HashMap<String, Object>();
  2791 + m.put("date", date);
  2792 + m.put("date1", date2);
  2793 + String xls="";
  2794 + String by=map.get("by").toString();
  2795 +
  2796 +
  2797 + if(zt.equals("zbh")){
  2798 + if(by.equals("sj")){
  2799 + xls="countByBus1.xls";
  2800 + }else{
  2801 + xls="countByBus1s.xls";
2626 2802 }
2627   -
2628   - if(zt.equals("zbh")){
2629   - Map<String, Object> newMap=staticTj(lists, "");
2630   - double yhl=0.0;
2631   - double jzl=0.0;
2632   - double hyl=0.0;
2633   - double dhl=0.0;
2634   - double cdl=0.0;
2635   - for (int j = 0; j < ylbList.size(); j++) {
2636   - Ylb y=ylbList.get(j);
2637   - if(nbbm.equals(y.getNbbm()) && xl_bm.equals(y.getXlbm())){
2638   - yhl=Arith.add(yhl, y.getYh());
2639   - jzl=Arith.add(jzl, y.getJzl());
2640   - hyl=Arith.add(hyl, y.getYh());
2641   - }
2642   -
2643   - }
2644   - for (int j = 0; j < dlbList.size(); j++) {
2645   - Dlb d=dlbList.get(j);
2646   - if(nbbm.equals(d.getNbbm())&&xl_bm.equals(d.getXlbm())){
2647   - dhl=Arith.add(dhl, d.getHd());
2648   - cdl=Arith.add(cdl, d.getCdl());
2649   - }
2650   - }
2651   - if(date.equals(date2)){
2652   - newMap.put("rq",date);
2653   - }else{
2654   - newMap.put("rq",date+"至"+date2);
2655   - }
2656   - newMap.put("yhl", yhl);
2657   - newMap.put("jzl", jzl);
2658   - newMap.put("hyl", hyl);
2659   - newMap.put("dhl", dhl);
2660   - newMap.put("cdl", cdl);
2661   - lMap.add(newMap);
  2803 + }else{
  2804 +
  2805 + if(by.equals("sj")){
  2806 + xls="countByBus2.xls";
2662 2807 }else{
2663   - Map<String, Object> newMap=staticTj(lists, "");
2664   - double lc=Double.parseDouble(newMap.get("zlc").toString());
2665   - double yhl=0.0;
2666   - double jzl=0.0;
2667   - double hyl=0.0;
2668   - double dhl=0.0;
2669   - double cdl=0.0;
2670   - double zlc=0.0;
2671   - for (int j = 0; j < ylbList.size(); j++) {
2672   - Ylb y=ylbList.get(j);
2673   - if(nbbm.equals(y.getNbbm()) && xl_bm.equals(y.getXlbm())
2674   - &&dateStr.equals(sdf.format(y.getRq()))
2675   - &&jGh.equals(y.getName())){
2676   - yhl=Arith.add(yhl, y.getYh());
2677   - jzl=Arith.add(jzl, y.getJzl());
2678   - hyl=Arith.add(hyl, y.getYh());
2679   - zlc=Arith.add(zlc, y.getZlc());
2680   - }
2681   -
2682   - }
2683   -
2684   - for (int j = 0; j < dlbList.size(); j++) {
2685   - Dlb d=dlbList.get(j);
2686   - if(nbbm.equals(d.getNbbm())&&xl_bm.equals(d.getXlbm())
2687   - &&dateStr.equals(sdf.format(d.getRq()))
2688   - &&jGh.equals(d.getName())){
2689   - dhl=Arith.add(dhl, d.getHd());
2690   - cdl=Arith.add(cdl, d.getCdl());
2691   - zlc=Arith.add(zlc, d.getZlc());
2692   - }
2693   - }
2694   - double div=0.0;
2695   - if(lc>0){
2696   - div=Arith.div(zlc, lc,2);
2697   - }
2698   - newMap.put("yhl", yhl*div);
2699   - newMap.put("jzl", jzl*div);
2700   - newMap.put("hyl", hyl*div);
2701   - newMap.put("dhl", dhl*div);
2702   - newMap.put("cdl", cdl*div);
2703   - lMaps.add(newMap);
  2808 + xls="countByBus2s.xls";
2704 2809 }
2705   -
2706 2810 }
2707   - if(!zt.equals("zbh")){
2708   - String sqls="select r.xl_bm,r.cl_zbh,r.j_gh,r.s_gh"
2709   - + " from bsth_c_s_sp_info_real r where"
2710   - + " r.schedule_date_str BETWEEN '"+date+"' and '"+date2+"'";
2711   - if(line.equals("")){
2712   - sqls +="and r.gs_bm='"+gsdm+"' "
2713   - + " and r.fgs_bm='"+fgsdm+"'";
2714   - }else{
2715   - sqls += " and r.xl_bm = '"+line+"'";
2716   - }
2717   - sqls += " group by r.xl_bm,r.cl_zbh,r.j_gh,r.s_gh";
2718   -
2719   - List<Map<String, Object>> listGroupBys=jdbcTemplate.query(sqls, new RowMapper<Map<String, Object>>() {
2720   - @Override
2721   - public Map<String, Object> mapRow(ResultSet arg0, int arg1) throws SQLException {
2722   - Map<String, Object> map=new HashMap<String,Object>();
2723   - map.put("line",arg0.getString("xl_bm"));
2724   - map.put("nbbm", arg0.getString("cl_zbh"));
2725   - map.put("jGh", arg0.getString("j_gh"));
2726   - map.put("sGh", arg0.getString("s_gh"));
2727   - return map;
2728   - }
2729   - });
2730   - lMap=lists(listGroupBys, lMaps, gsdm, fgsdm, date, date2);
2731   -
2732   - }
2733   - if(type.equals("export")){
2734   - List<Iterator<?>> listI = new ArrayList<Iterator<?>>();
2735   - Map<String, Object> m = new HashMap<String, Object>();
2736   - m.put("date", date);
2737   - m.put("date1", date2);
2738   - String xls="";
2739   - String by=map.get("by").toString();
2740   -
2741   -
2742   - if(zt.equals("zbh")){
2743   - if(by.equals("sj")){
2744   - xls="countByBus1.xls";
2745   - }else{
2746   - xls="countByBus1s.xls";
2747   - }
2748   - }else{
2749   -
2750   - if(by.equals("sj")){
2751   - xls="countByBus2.xls";
2752   - }else{
2753   - xls="countByBus2s.xls";
2754   - }
2755   - }
2756   - ReportUtils ee = new ReportUtils();
2757   - try {
2758   - listI.add(lMap.iterator());
2759   - String path = this.getClass().getResource("/").getPath() + "static/pages/forms/";
2760   - ee.excelReplace(listI, new Object[]{m}, path + "mould/"+xls,
2761   - path + "export/路单数据统计表.xls");
2762   - } catch (Exception e) {
2763   - // TODO: handle exception
2764   - e.printStackTrace();
2765   - }
2766   - }
2767   -
2768   - return lMap;
  2811 + ReportUtils ee = new ReportUtils();
  2812 + try {
  2813 + listI.add(lMap.iterator());
  2814 + String path = this.getClass().getResource("/").getPath() + "static/pages/forms/";
  2815 + ee.excelReplace(listI, new Object[]{m}, path + "mould/"+xls,
  2816 + path + "export/路单数据统计表.xls");
  2817 + } catch (Exception e) {
  2818 + // TODO: handle exception
  2819 + e.printStackTrace();
  2820 + }
2769 2821 }
2770   -
2771   - public final List<Ylb> ylbList(String sql){
2772   - List<Ylb> ylbList= jdbcTemplate.query(sql, new RowMapper<Ylb>() {
2773   - @Override
2774   - public Ylb mapRow(ResultSet arg0, int arg1) throws SQLException {
2775   - Ylb y = new Ylb();
2776   - y.setRq(arg0.getDate("rq"));
2777   - y.setXlbm(arg0.getString("xlbm"));
2778   - y.setNbbm(arg0.getString("nbbm"));
2779   - y.setJzl(arg0.getDouble("jzl"));
2780   - y.setYh(arg0.getDouble("yh"));
2781   - y.setSh(arg0.getDouble("sh"));
2782   - return y;
2783   - }
2784   - });
2785   - return ylbList;
2786   - }
2787   -
2788   - public final List<Dlb> dlbList(String sql){
2789   - List<Dlb> dlbList= jdbcTemplate.query(sql, new RowMapper<Dlb>() {
2790   - @Override
2791   - public Dlb mapRow(ResultSet arg0, int arg1) throws SQLException {
2792   - Dlb y = new Dlb();
2793   - y.setRq(arg0.getDate("rq"));
2794   - y.setXlbm(arg0.getString("xlbm"));
2795   - y.setNbbm(arg0.getString("nbbm"));
2796   - y.setCdl(arg0.getDouble("cdl"));
2797   - y.setHd(arg0.getDouble("hd"));
2798   - y.setSh(arg0.getDouble("sh"));
2799   - return y;
2800   - }
2801   - });
2802   - return dlbList;
2803   - }
2804   -
2805   - public final List<Map<String, Object>> lists(List<Map<String, Object>> listGb,
2806   - List<Map<String, Object>> listLc,
2807   - String gsdm,String fgsdm,
2808   - String date,String date2){
2809   - List<Map<String, Object>> lMap=new ArrayList<Map<String,Object>>();
2810   - for (int i = 0; i < listGb.size(); i++) {
2811   - Map<String, Object> m=listGb.get(i);
2812   - String xl_bm=m.get("line")==null?"":m.get("line").toString();
2813   - String nbbm =m.get("nbbm")==null?"":m.get("nbbm").toString();
2814   - String jGh= m.get("jGh")==null?"":m.get("jGh").toString();
2815   - String sGh= m.get("sGh")==null?"":m.get("sGh").toString();
2816   - double jhzlc = 0.0,jhlc= 0.0,jcclc= 0.0,zlc= 0.0,jhnlc= 0.0,jhwlc= 0.0,
2817   - jhnjcclc= 0.0,jhwjcclc= 0.0,jhwjcclc_z=0.0,zrwjcclc= 0.0,zrwjcclc1= 0.0,zrwjcclc2= 0.0,
2818   - zrwjcclcqt=0.0,lbss= 0.0,ssgl_lz= 0.0,
2819   - ssgl_dm= 0.0,ssgl_gz= 0.0,ssgl_jf= 0.0,ssgl_zs= 0.0,ssgl_qr= 0.0,ssgl_qc= 0.0,
2820   - ssgl_kx= 0.0,ssgl_qh= 0.0,ssgl_yw= 0.0,ssgl_other= 0.0,ljyy=0.0,ljjcc=0.0,
  2822 +
  2823 + return lMap;
  2824 + }
  2825 +
  2826 + public final List<Ylb> ylbList(String sql){
  2827 + List<Ylb> ylbList= jdbcTemplate.query(sql, new RowMapper<Ylb>() {
  2828 + @Override
  2829 + public Ylb mapRow(ResultSet arg0, int arg1) throws SQLException {
  2830 + Ylb y = new Ylb();
  2831 + y.setRq(arg0.getDate("rq"));
  2832 + y.setXlbm(arg0.getString("xlbm"));
  2833 + y.setNbbm(arg0.getString("nbbm"));
  2834 + y.setJzl(arg0.getDouble("jzl"));
  2835 + y.setYh(arg0.getDouble("yh"));
  2836 + y.setSh(arg0.getDouble("sh"));
  2837 + return y;
  2838 + }
  2839 + });
  2840 + return ylbList;
  2841 + }
  2842 +
  2843 + public final List<Dlb> dlbList(String sql){
  2844 + List<Dlb> dlbList= jdbcTemplate.query(sql, new RowMapper<Dlb>() {
  2845 + @Override
  2846 + public Dlb mapRow(ResultSet arg0, int arg1) throws SQLException {
  2847 + Dlb y = new Dlb();
  2848 + y.setRq(arg0.getDate("rq"));
  2849 + y.setXlbm(arg0.getString("xlbm"));
  2850 + y.setNbbm(arg0.getString("nbbm"));
  2851 + y.setCdl(arg0.getDouble("cdl"));
  2852 + y.setHd(arg0.getDouble("hd"));
  2853 + y.setSh(arg0.getDouble("sh"));
  2854 + return y;
  2855 + }
  2856 + });
  2857 + return dlbList;
  2858 + }
  2859 +
  2860 + public final List<Map<String, Object>> lists(List<Map<String, Object>> listGb,
  2861 + List<Map<String, Object>> listLc,
  2862 + String gsdm,String fgsdm,
  2863 + String date,String date2){
  2864 + List<Map<String, Object>> lMap=new ArrayList<Map<String,Object>>();
  2865 + for (int i = 0; i < listGb.size(); i++) {
  2866 + Map<String, Object> m=listGb.get(i);
  2867 + String xl_bm=m.get("line")==null?"":m.get("line").toString();
  2868 + String nbbm =m.get("nbbm")==null?"":m.get("nbbm").toString();
  2869 + String jGh= m.get("jGh")==null?"":m.get("jGh").toString();
  2870 + String sGh= m.get("sGh")==null?"":m.get("sGh").toString();
  2871 + double jhzlc = 0.0,jhlc= 0.0,jcclc= 0.0,zlc= 0.0,jhnlc= 0.0,jhwlc= 0.0,
  2872 + jhnjcclc= 0.0,jhwjcclc= 0.0,jhwjcclc_z=0.0,zrwjcclc= 0.0,zrwjcclc1= 0.0,zrwjcclc2= 0.0,
  2873 + zrwjcclcqt=0.0,lbss= 0.0,ssgl_lz= 0.0,
  2874 + ssgl_dm= 0.0,ssgl_gz= 0.0,ssgl_jf= 0.0,ssgl_zs= 0.0,ssgl_qr= 0.0,ssgl_qc= 0.0,
  2875 + ssgl_kx= 0.0,ssgl_qh= 0.0,ssgl_yw= 0.0,ssgl_other= 0.0,ljyy=0.0,ljjcc=0.0,
2821 2876 kfks=0.0,yhl=0.0,jzl=0.0,hyl=0.0,dhl=0.0,cdl=0.0;
2822   -
2823   - for (int j = 0; j < listLc.size(); j++) {
2824   - Map<String, Object> map=listLc.get(j);
2825   - if(xl_bm.equals(map.get("line").toString())
2826   - && nbbm.equals(map.get("nbbm").toString())
2827   - && sGh.equals(map.get("sGh")==null?"":map.get("sGh").toString())
2828   - && jGh.equals(map.get("jGh").toString())){
2829   - jhzlc=Arith.add(jhzlc, map.get("jhzlc"));
2830   - jhlc =Arith.add(jhlc, map.get("jhlc"));
2831   - jcclc=Arith.add(jcclc, map.get("jcclc"));
2832   - zlc=Arith.add(zlc, map.get("zlc"));
2833   - jhnlc=Arith.add(jhnlc, map.get("jhnlc"));
2834   - jhwlc=Arith.add(jhwlc, map.get("jhwlc"));
2835   - jhnjcclc=Arith.add(jhnjcclc, map.get("jhnjcclc"));
2836   - jhwjcclc=Arith.add(jhwjcclc, map.get("jhwjcclc"));
2837   - jhwjcclc_z=Arith.add(jhwjcclc_z, map.get("jhwjcclc_z"));
2838   - zrwjcclc=Arith.add(zrwjcclc, map.get("zrwjcclc"));
2839   - zrwjcclc1=Arith.add(zrwjcclc1, map.get("zrwjcclc1"));
2840   - zrwjcclc2=Arith.add(zrwjcclc2, map.get("zrwjcclc2"));
2841   - zrwjcclcqt=Arith.add(zrwjcclcqt, map.get("zrwjcclcqt"));
2842   - lbss=Arith.add(lbss, map.get("lbss"));
2843   - ssgl_lz=Arith.add(ssgl_lz, map.get("ssgl_lz"));
2844   - ssgl_dm=Arith.add(ssgl_dm, map.get("ssgl_dm"));
2845   - ssgl_gz=Arith.add(ssgl_gz, map.get("ssgl_gz"));
2846   - ssgl_jf=Arith.add(ssgl_jf, map.get("ssgl_jf"));
2847   - ssgl_zs=Arith.add(ssgl_zs, map.get("ssgl_zs"));
2848   - ssgl_qr=Arith.add(ssgl_qr, map.get("ssgl_qr"));
2849   - ssgl_qc=Arith.add(ssgl_qc, map.get("ssgl_qc"));
2850   - ssgl_kx=Arith.add(ssgl_kx, map.get("ssgl_kx"));
2851   - ssgl_qh=Arith.add(ssgl_qh, map.get("ssgl_qh"));
2852   - ssgl_yw=Arith.add(ssgl_yw, map.get("ssgl_yw"));
2853   - ssgl_other=Arith.add(ssgl_other, map.get("ssgl_other"));
2854   - kfks=Arith.add(kfks, map.get("kfks"));
2855   - ljyy=Arith.add(ljyy, map.get("ljyy"));
2856   - ljjcc=Arith.add(ljjcc, map.get("ljjcc"));
2857   - yhl=Arith.add(yhl, map.get("yhl"));
2858   - jzl=Arith.add(jzl, map.get("jzl"));
2859   - hyl=Arith.add(hyl, map.get("hyl"));
2860   - dhl=Arith.add(dhl, map.get("dhl"));
2861   - cdl=Arith.add(cdl, map.get("cdl"));
2862   -
2863   -
2864   - }
2865   - }
2866   -
2867   - Map<String, Object> newMap=new HashMap<String,Object>();
2868   - if(date.equals(date2)){
2869   - newMap.put("rq", date);
2870   - }else{
2871   - newMap.put("rq", date+"至"+date2);
2872   - }
2873   - newMap.put("fgs", BasicData.businessFgsCodeNameMap.get(fgsdm+"_"+gsdm));
2874   - newMap.put("xlName", BasicData.lineCode2NameMap.get(xl_bm));
2875   - newMap.put("jGh", jGh);
2876   - newMap.put("jName", jGh);
2877   - newMap.put("sGh",sGh);
2878   - newMap.put("sName", sGh);
2879   - newMap.put("nbbm", nbbm);
2880   - newMap.put("jhzlc", jhzlc);
2881   - newMap.put("jhlc", jhlc);
2882   - newMap.put("jcclc", jcclc);
2883   - newMap.put("zlc", zlc);
2884   - newMap.put("jhnlc", jhnlc);
2885   - newMap.put("jhwlc", jhwlc);
2886   - newMap.put("jhnjcclc", jhnjcclc);
2887   - newMap.put("jhwjcclc", jhwjcclc);
2888   - newMap.put("jhwjcclc_z", jhwjcclc_z);
2889   - newMap.put("zrwjcclc", zrwjcclc);
2890   - newMap.put("zrwjcclc1", zrwjcclc1);
2891   - newMap.put("zrwjcclc2", zrwjcclc2);
2892   - newMap.put("zrwjcclcqt", zrwjcclcqt);
2893   - newMap.put("lbss", lbss);
2894   - newMap.put("ssgl_lz", ssgl_lz);
2895   - newMap.put("ssgl_dm",ssgl_dm);
2896   - newMap.put("ssgl_gz", ssgl_gz);
2897   - newMap.put("ssgl_jf", ssgl_jf);
2898   - newMap.put("ssgl_zs", ssgl_zs);
2899   - newMap.put("ssgl_qr", ssgl_qr);
2900   - newMap.put("ssgl_qc", ssgl_qc);
2901   - newMap.put("ssgl_kx", ssgl_kx);
2902   - newMap.put("ssgl_qh", ssgl_qh);
2903   - newMap.put("ssgl_yw", ssgl_yw);
2904   - newMap.put("ssgl_other", ssgl_other);
2905   - newMap.put("kfks", kfks);
2906   - newMap.put("ljyy", ljyy);
2907   - newMap.put("ljjcc", ljjcc);
2908   - newMap.put("yhl", yhl);
2909   - newMap.put("jzl", jzl);
2910   - newMap.put("hyl", hyl);
2911   - newMap.put("dhl", dhl);
2912   - newMap.put("cdl", cdl);
2913   - lMap.add(newMap);
2914   - }
2915   - return lMap;
2916   - }
2917   - @Override
2918   - public List<Map<String, Object>> countDjg(Map<String, Object> map) {
2919   - // TODO Auto-generated method stub
2920   - List<Map<String, Object>> lMap=new ArrayList<Map<String,Object>>();
2921   - String line=map.get("line").toString().trim();
2922   - String date=map.get("date").toString();
2923   - String gsbm=map.get("gsbm").toString();
2924   - String fgsbm=map.get("fgsbm").toString();
2925   - String type=map.get("type").toString();
2926   - List<ScheduleRealInfo> list=new ArrayList<ScheduleRealInfo>();
2927   - if(line.equals("")){
2928   - list=scheduleRealInfoRepository.scheduleByDateAndLineByGs(gsbm, fgsbm, date);
2929   -
2930   - }else{
2931   - list=scheduleRealInfoRepository.scheduleByDateAndLine2(line, date);
  2877 +
  2878 + for (int j = 0; j < listLc.size(); j++) {
  2879 + Map<String, Object> map=listLc.get(j);
  2880 + if(xl_bm.equals(map.get("line").toString())
  2881 + && nbbm.equals(map.get("nbbm").toString())
  2882 + && sGh.equals(map.get("sGh")==null?"":map.get("sGh").toString())
  2883 + && jGh.equals(map.get("jGh").toString())){
  2884 + jhzlc=Arith.add(jhzlc, map.get("jhzlc"));
  2885 + jhlc =Arith.add(jhlc, map.get("jhlc"));
  2886 + jcclc=Arith.add(jcclc, map.get("jcclc"));
  2887 + zlc=Arith.add(zlc, map.get("zlc"));
  2888 + jhnlc=Arith.add(jhnlc, map.get("jhnlc"));
  2889 + jhwlc=Arith.add(jhwlc, map.get("jhwlc"));
  2890 + jhnjcclc=Arith.add(jhnjcclc, map.get("jhnjcclc"));
  2891 + jhwjcclc=Arith.add(jhwjcclc, map.get("jhwjcclc"));
  2892 + jhwjcclc_z=Arith.add(jhwjcclc_z, map.get("jhwjcclc_z"));
  2893 + zrwjcclc=Arith.add(zrwjcclc, map.get("zrwjcclc"));
  2894 + zrwjcclc1=Arith.add(zrwjcclc1, map.get("zrwjcclc1"));
  2895 + zrwjcclc2=Arith.add(zrwjcclc2, map.get("zrwjcclc2"));
  2896 + zrwjcclcqt=Arith.add(zrwjcclcqt, map.get("zrwjcclcqt"));
  2897 + lbss=Arith.add(lbss, map.get("lbss"));
  2898 + ssgl_lz=Arith.add(ssgl_lz, map.get("ssgl_lz"));
  2899 + ssgl_dm=Arith.add(ssgl_dm, map.get("ssgl_dm"));
  2900 + ssgl_gz=Arith.add(ssgl_gz, map.get("ssgl_gz"));
  2901 + ssgl_jf=Arith.add(ssgl_jf, map.get("ssgl_jf"));
  2902 + ssgl_zs=Arith.add(ssgl_zs, map.get("ssgl_zs"));
  2903 + ssgl_qr=Arith.add(ssgl_qr, map.get("ssgl_qr"));
  2904 + ssgl_qc=Arith.add(ssgl_qc, map.get("ssgl_qc"));
  2905 + ssgl_kx=Arith.add(ssgl_kx, map.get("ssgl_kx"));
  2906 + ssgl_qh=Arith.add(ssgl_qh, map.get("ssgl_qh"));
  2907 + ssgl_yw=Arith.add(ssgl_yw, map.get("ssgl_yw"));
  2908 + ssgl_other=Arith.add(ssgl_other, map.get("ssgl_other"));
  2909 + kfks=Arith.add(kfks, map.get("kfks"));
  2910 + ljyy=Arith.add(ljyy, map.get("ljyy"));
  2911 + ljjcc=Arith.add(ljjcc, map.get("ljjcc"));
  2912 + yhl=Arith.add(yhl, map.get("yhl"));
  2913 + jzl=Arith.add(jzl, map.get("jzl"));
  2914 + hyl=Arith.add(hyl, map.get("hyl"));
  2915 + dhl=Arith.add(dhl, map.get("dhl"));
  2916 + cdl=Arith.add(cdl, map.get("cdl"));
  2917 +
  2918 +
  2919 + }
2932 2920 }
2933   - SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd HH:mm");
  2921 +
  2922 + Map<String, Object> newMap=new HashMap<String,Object>();
  2923 + if(date.equals(date2)){
  2924 + newMap.put("rq", date);
  2925 + }else{
  2926 + newMap.put("rq", date+"至"+date2);
  2927 + }
  2928 + newMap.put("fgs", BasicData.businessFgsCodeNameMap.get(fgsdm+"_"+gsdm));
  2929 + newMap.put("xlName", BasicData.lineCode2NameMap.get(xl_bm));
  2930 + newMap.put("jGh", jGh);
  2931 + newMap.put("jName", jGh);
  2932 + newMap.put("sGh",sGh);
  2933 + newMap.put("sName", sGh);
  2934 + newMap.put("nbbm", nbbm);
  2935 + newMap.put("jhzlc", jhzlc);
  2936 + newMap.put("jhlc", jhlc);
  2937 + newMap.put("jcclc", jcclc);
  2938 + newMap.put("zlc", zlc);
  2939 + newMap.put("jhnlc", jhnlc);
  2940 + newMap.put("jhwlc", jhwlc);
  2941 + newMap.put("jhnjcclc", jhnjcclc);
  2942 + newMap.put("jhwjcclc", jhwjcclc);
  2943 + newMap.put("jhwjcclc_z", jhwjcclc_z);
  2944 + newMap.put("zrwjcclc", zrwjcclc);
  2945 + newMap.put("zrwjcclc1", zrwjcclc1);
  2946 + newMap.put("zrwjcclc2", zrwjcclc2);
  2947 + newMap.put("zrwjcclcqt", zrwjcclcqt);
  2948 + newMap.put("lbss", lbss);
  2949 + newMap.put("ssgl_lz", ssgl_lz);
  2950 + newMap.put("ssgl_dm",ssgl_dm);
  2951 + newMap.put("ssgl_gz", ssgl_gz);
  2952 + newMap.put("ssgl_jf", ssgl_jf);
  2953 + newMap.put("ssgl_zs", ssgl_zs);
  2954 + newMap.put("ssgl_qr", ssgl_qr);
  2955 + newMap.put("ssgl_qc", ssgl_qc);
  2956 + newMap.put("ssgl_kx", ssgl_kx);
  2957 + newMap.put("ssgl_qh", ssgl_qh);
  2958 + newMap.put("ssgl_yw", ssgl_yw);
  2959 + newMap.put("ssgl_other", ssgl_other);
  2960 + newMap.put("kfks", kfks);
  2961 + newMap.put("ljyy", ljyy);
  2962 + newMap.put("ljjcc", ljjcc);
  2963 + newMap.put("yhl", yhl);
  2964 + newMap.put("jzl", jzl);
  2965 + newMap.put("hyl", hyl);
  2966 + newMap.put("dhl", dhl);
  2967 + newMap.put("cdl", cdl);
  2968 + lMap.add(newMap);
  2969 + }
  2970 + return lMap;
  2971 + }
  2972 + @Override
  2973 + public List<Map<String, Object>> countDjg(Map<String, Object> map) {
  2974 + // TODO Auto-generated method stub
  2975 + List<Map<String, Object>> lMap=new ArrayList<Map<String,Object>>();
  2976 + String line=map.get("line").toString().trim();
  2977 + String date=map.get("date").toString();
  2978 + String gsbm=map.get("gsbm").toString();
  2979 + String fgsbm=map.get("fgsbm").toString();
  2980 + String type=map.get("type").toString();
  2981 + List<ScheduleRealInfo> list=new ArrayList<ScheduleRealInfo>();
  2982 + if(line.equals("")){
  2983 + list=scheduleRealInfoRepository.scheduleByDateAndLineByGs(gsbm, fgsbm, date);
  2984 +
  2985 + }else{
  2986 + list=scheduleRealInfoRepository.scheduleByDateAndLine2(line, date);
  2987 + }
  2988 + SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd HH:mm");
2934 2989 // Collections.sort(listInfo,new ComparableAcuals());
2935   - //查询所有线路
2936   - String xlSql="select line_code,spac_grade from bsth_c_line ";
2937   - if(line.equals("")){
2938   - xlSql +=" where company ='"+gsbm+"'";
2939   - }else{
2940   - xlSql +=" where line_code ='"+line+"'";
2941   - }
2942   -
2943   - List<Map<String, Object>> xlList=jdbcTemplate.query(xlSql, new RowMapper<Map<String, Object>>() {
2944   - @Override
2945   - public Map<String, Object> mapRow(ResultSet arg0, int arg1) throws SQLException {
2946   - Map<String, Object> map=new HashMap<String,Object>();
2947   - map.put("line",arg0.getString("line_code"));
2948   - map.put("grade", arg0.getString("spac_grade"));
2949   - return map;
2950   - }
2951   - });
2952   - //查询大间隔时间
2953   - String djgSql="select * from bsth_c_interval";
2954   - List<Interval> djgList=jdbcTemplate.query(djgSql, new RowMapper<Interval>() {
2955   - @Override
2956   - public Interval mapRow(ResultSet arg0, int arg1) throws SQLException {
2957   - Interval m=new Interval();
2958   - m.setLevel(arg0.getString("level"));
2959   - m.setPeak(arg0.getInt("peak"));
2960   - m.setTrough(arg0.getInt("trough"));
2961   - return m;
  2990 + //查询所有线路
  2991 + String xlSql="select line_code,spac_grade from bsth_c_line ";
  2992 + if(line.equals("")){
  2993 + xlSql +=" where company ='"+gsbm+"'";
  2994 + }else{
  2995 + xlSql +=" where line_code ='"+line+"'";
  2996 + }
  2997 +
  2998 + List<Map<String, Object>> xlList=jdbcTemplate.query(xlSql, new RowMapper<Map<String, Object>>() {
  2999 + @Override
  3000 + public Map<String, Object> mapRow(ResultSet arg0, int arg1) throws SQLException {
  3001 + Map<String, Object> map=new HashMap<String,Object>();
  3002 + map.put("line",arg0.getString("line_code"));
  3003 + map.put("grade", arg0.getString("spac_grade"));
  3004 + return map;
  3005 + }
  3006 + });
  3007 + //查询大间隔时间
  3008 + String djgSql="select * from bsth_c_interval";
  3009 + List<Interval> djgList=jdbcTemplate.query(djgSql, new RowMapper<Interval>() {
  3010 + @Override
  3011 + public Interval mapRow(ResultSet arg0, int arg1) throws SQLException {
  3012 + Interval m=new Interval();
  3013 + m.setLevel(arg0.getString("level"));
  3014 + m.setPeak(arg0.getInt("peak"));
  3015 + m.setTrough(arg0.getInt("trough"));
  3016 + return m;
  3017 + }
  3018 + });
  3019 +
  3020 + for (int i = 0; i < xlList.size(); i++) {
  3021 + String lineCode=xlList.get(i).get("line").toString();
  3022 + String grade =xlList.get(i).get("grade")==null?"1":xlList.get(i).get("grade").toString();
  3023 + int peak=0;
  3024 + int trough=0;
  3025 + for (int j = 0; j < djgList.size(); j++) {
  3026 + Interval il=djgList.get(j);
  3027 + if(il.getLevel().equals(grade)){
  3028 + peak=il.getPeak();
  3029 + trough=il.getTrough();
  3030 + continue;
2962 3031 }
2963   - });
2964   -
2965   - for (int i = 0; i < xlList.size(); i++) {
2966   - String lineCode=xlList.get(i).get("line").toString();
2967   - String grade =xlList.get(i).get("grade")==null?"1":xlList.get(i).get("grade").toString();
2968   - int peak=0;
2969   - int trough=0;
2970   - for (int j = 0; j < djgList.size(); j++) {
2971   - Interval il=djgList.get(j);
2972   - if(il.getLevel().equals(grade)){
2973   - peak=il.getPeak();
2974   - trough=il.getTrough();
2975   - continue;
2976   - }
2977   - }
2978   - List<ScheduleRealInfo> list_=new ArrayList<ScheduleRealInfo>();
2979   - List<ScheduleRealInfo> listInfo=new ArrayList<ScheduleRealInfo>();
2980   - for (int j = 0; j < list.size(); j++) {
2981   - ScheduleRealInfo sinfo=list.get(j);
2982   - try {
2983   - if(sinfo.getXlBm().equals(lineCode)){
2984   - list_.add(sinfo);
2985   - ScheduleRealInfo s=checkBc(sinfo);
2986   - String fcsj=s.getFcsjActual()==null?"":s.getFcsjActual();
2987   - if(!fcsj.equals("")){
2988   - Long fcsjAcual = sdf.parse(s.getRealExecDate() + " " + s.getFcsjActual()).getTime();
2989   - s.setFcsjActualTime(fcsjAcual);
2990   - s.setFcsjActual(fcsj);
2991   - listInfo.add(s);
2992   - }
2993   -
  3032 + }
  3033 + List<ScheduleRealInfo> list_=new ArrayList<ScheduleRealInfo>();
  3034 + List<ScheduleRealInfo> listInfo=new ArrayList<ScheduleRealInfo>();
  3035 + for (int j = 0; j < list.size(); j++) {
  3036 + ScheduleRealInfo sinfo=list.get(j);
  3037 + try {
  3038 + if(sinfo.getXlBm().equals(lineCode)){
  3039 + list_.add(sinfo);
  3040 + ScheduleRealInfo s=checkBc(sinfo);
  3041 + String fcsj=s.getFcsjActual()==null?"":s.getFcsjActual();
  3042 + if(!fcsj.equals("")){
  3043 + Long fcsjAcual = sdf.parse(s.getRealExecDate() + " " + s.getFcsjActual()).getTime();
  3044 + s.setFcsjActualTime(fcsjAcual);
  3045 + s.setFcsjActual(fcsj);
  3046 + listInfo.add(s);
2994 3047 }
2995   - } catch (ParseException e) {
2996   - // TODO Auto-generated catch block
2997   - e.printStackTrace();
  3048 +
2998 3049 }
2999   - }
3000   -
3001   - if(listInfo.size()>0){
3002   - int sjbcs=culateService.culateSjbc(list_, "")+culateService.culateLjbc(list_, "");
3003   - Map<String, Object> m=listDjg(gsbm,fgsbm,lineCode,sjbcs,peak,trough,listInfo,grade);
3004   - lMap.add(m);
3005   - }
3006   -
3007   - }
3008   - if(type.equals("export")){
3009   - List<Iterator<?>> listI = new ArrayList<Iterator<?>>();
3010   - Map<String, Object> m = new HashMap<String, Object>();
3011   - m.put("date", date);
3012   - ReportUtils ee = new ReportUtils();
3013   - try {
3014   - listI.add(lMap.iterator());
3015   - String path = this.getClass().getResource("/").getPath() + "static/pages/forms/";
3016   - ee.excelReplace(listI, new Object[]{m}, path + "mould/countInterval.xls",
3017   - path + "export/大间隔统计表.xls");
3018   - } catch (Exception e) {
3019   - // TODO: handle exception
3020   - e.printStackTrace();
3021   - }
3022   - }
3023   - return lMap;
3024   - }
3025   -
3026   - public ScheduleRealInfo checkBc(ScheduleRealInfo s){
3027   - //如果班次有子任务 且 子任务中有属于营运的。把该子任务的发车时间设置成班次的发车时间
3028   - String fcsj=s.getFcsjActual()==null?"":s.getFcsjActual();
3029   - if(fcsj.equals("")){
3030   - Set<ChildTaskPlan> childTaskPlans = s.getcTasks();
3031   - if(!childTaskPlans.isEmpty()){
3032   - List<ChildTaskPlan> listit=new ArrayList<ChildTaskPlan>(childTaskPlans);
3033   - Collections.sort(listit, new ComparableChild());
3034   - for (int i = 0; i < listit.size(); i++) {
3035   - ChildTaskPlan c=listit.get(i);
3036   - if(!c.isDestroy()){
3037   - if(c.getMileageType().equals("service")){
3038   - s.setFcsjActual(c.getStartDate());
3039   - break;
3040   - }
3041   -
3042   - }
3043   - }
  3050 + } catch (ParseException e) {
  3051 + // TODO Auto-generated catch block
  3052 + e.printStackTrace();
3044 3053 }
3045 3054 }
3046   - return s;
  3055 +
  3056 + if(listInfo.size()>0){
  3057 + int sjbcs=culateService.culateSjbc(list_, "")+culateService.culateLjbc(list_, "");
  3058 + Map<String, Object> m=listDjg(gsbm,fgsbm,lineCode,sjbcs,peak,trough,listInfo,grade);
  3059 + lMap.add(m);
  3060 + }
  3061 +
3047 3062 }
3048   -
3049   - public Map<String, Object> listDjg(String gsdm,String fgsdm,String line,int sjbcs,int peak,int trough,List<ScheduleRealInfo> listInfo,String grade){
3050   - DecimalFormat df = new DecimalFormat("#0.00");
3051   - Collections.sort(listInfo,new ComparableAcuals());
3052   - List<ScheduleRealInfo> listInfo0=new ArrayList<ScheduleRealInfo>();
3053   - List<ScheduleRealInfo> listInfo1=new ArrayList<ScheduleRealInfo>();
3054   - for (int i = 0; i < listInfo.size(); i++) {
3055   - ScheduleRealInfo s=listInfo.get(i);
3056   - if(s.getXlDir().equals("0")){
3057   - listInfo0.add(s);
3058   - }else{
3059   - listInfo0.add(s);
3060   - }
3061   -
  3063 + if(type.equals("export")){
  3064 + List<Iterator<?>> listI = new ArrayList<Iterator<?>>();
  3065 + Map<String, Object> m = new HashMap<String, Object>();
  3066 + m.put("date", date);
  3067 + ReportUtils ee = new ReportUtils();
  3068 + try {
  3069 + listI.add(lMap.iterator());
  3070 + String path = this.getClass().getResource("/").getPath() + "static/pages/forms/";
  3071 + ee.excelReplace(listI, new Object[]{m}, path + "mould/countInterval.xls",
  3072 + path + "export/大间隔统计表.xls");
  3073 + } catch (Exception e) {
  3074 + // TODO: handle exception
  3075 + e.printStackTrace();
3062 3076 }
3063   - Map<String, Object> map=new HashMap<String, Object>();
3064   - map.put("line", line);
3065   - map.put("xlName", BasicData.lineCode2NameMap.get(line));
3066   - map.put("fgsname", BasicData.businessFgsCodeNameMap.get(fgsdm+"_"+gsdm));
3067   - map.put("bcs", sjbcs);
3068   - map.put("djgde", grade);
3069   - int djgcs=0;
3070   - List<Map<String, Object>> mapList=new ArrayList<Map<String, Object>>();
3071   - for (int i = 0; i < listInfo0.size(); i++) {
3072   - ScheduleRealInfo s=listInfo.get(i);
3073   - Long fcsjTime=s.getFcsjActualTime();
3074   - String time=s.getFcsjActual();
3075   - String[] fcsjStr = time.split(":");
3076   - long fcsj= Long.parseLong(fcsjStr[0])*60+Long.parseLong(fcsjStr[1]);
3077   - if(i<listInfo.size()-1){
3078   - Long djg=0l;
3079   - Long fscjNext=listInfo.get(i+1).getFcsjActualTime();
3080   - if((fcsj>=zgf1&&fcsj<=zgf2)||(fcsj>=wgf1&&fcsj<=wgf2)){
3081   - djg = (long) (peak*60*1000);
3082   - if(fscjNext-fcsjTime>djg){
3083   - djgcs ++;
3084   - Map<String, Object> m=new HashMap<String,Object>();
3085   - m.put("xlName", BasicData.lineCode2NameMap.get(line));
3086   - m.put("fgsname", BasicData.businessFgsCodeNameMap.get(fgsdm+"_"+gsdm));
3087   - m.put("djgde", grade);
3088   - m.put("qJh", s.getFcsj());
3089   - m.put("qSj", time);
3090   - m.put("hJh", listInfo.get(i+1).getFcsj());
3091   - m.put("hSj", listInfo.get(i+1).getFcsjActual());
3092   - m.put("djgsj", peak);
3093   - m.put("bcjgsj", (fscjNext-fcsjTime)/60000);
3094   - mapList.add(m);
3095   - }
3096   - }else{
3097   - djg = (long) (trough*60*1000);
3098   - if(fscjNext-fcsjTime>djg){
3099   - djgcs ++;
3100   - Map<String, Object> m=new HashMap<String,Object>();
3101   - m.put("xlName", BasicData.lineCode2NameMap.get(line));
3102   - m.put("fgsname", BasicData.businessFgsCodeNameMap.get(fgsdm+"_"+gsdm));
3103   - m.put("djgde", grade);
3104   - m.put("qJh", s.getFcsj());
3105   - m.put("qSj", time);
3106   - m.put("hJh", listInfo.get(i+1).getFcsj());
3107   - m.put("hSj", listInfo.get(i+1).getFcsjActual());
3108   - m.put("djgsj", trough);
3109   - m.put("bcjgsj", (fscjNext-fcsjTime)/60000);
3110   - mapList.add(m);
  3077 + }
  3078 + return lMap;
  3079 + }
  3080 +
  3081 + public ScheduleRealInfo checkBc(ScheduleRealInfo s){
  3082 + //如果班次有子任务 且 子任务中有属于营运的。把该子任务的发车时间设置成班次的发车时间
  3083 + String fcsj=s.getFcsjActual()==null?"":s.getFcsjActual();
  3084 + if(fcsj.equals("")){
  3085 + Set<ChildTaskPlan> childTaskPlans = s.getcTasks();
  3086 + if(!childTaskPlans.isEmpty()){
  3087 + List<ChildTaskPlan> listit=new ArrayList<ChildTaskPlan>(childTaskPlans);
  3088 + Collections.sort(listit, new ComparableChild());
  3089 + for (int i = 0; i < listit.size(); i++) {
  3090 + ChildTaskPlan c=listit.get(i);
  3091 + if(!c.isDestroy()){
  3092 + if(c.getMileageType().equals("service")){
  3093 + s.setFcsjActual(c.getStartDate());
  3094 + break;
3111 3095 }
  3096 +
3112 3097 }
3113 3098 }
3114 3099 }
3115   -
3116   - for (int i = 0; i < listInfo1.size(); i++) {
3117   - ScheduleRealInfo s=listInfo.get(i);
3118   - Long fcsjTime=s.getFcsjActualTime();
3119   - String time=s.getFcsjActual();
3120   - String[] fcsjStr = time.split(":");
3121   - long fcsj= Long.parseLong(fcsjStr[0])*60+Long.parseLong(fcsjStr[1]);
3122   - if(i<listInfo.size()-1){
3123   - Long djg=0l;
3124   - Long fscjNext=listInfo.get(i+1).getFcsjActualTime();
3125   - if((fcsj>=zgf1&&fcsj<=zgf2)||(fcsj>=wgf1&&fcsj<=wgf2)){
3126   - djg = (long) (peak*60*1000);
3127   - if(fscjNext-fcsjTime>djg){
3128   - djgcs ++;
3129   - Map<String, Object> m=new HashMap<String,Object>();
3130   - m.put("xlName", BasicData.lineCode2NameMap.get(line));
3131   - m.put("fgsname", BasicData.businessFgsCodeNameMap.get(fgsdm+"_"+gsdm));
3132   - m.put("djgde", grade);
3133   - m.put("qJh", s.getFcsj());
3134   - m.put("qSj", time);
3135   - m.put("hJh", listInfo.get(i+1).getFcsj());
3136   - m.put("hSj", listInfo.get(i+1).getFcsjActual());
3137   - m.put("djgsj", peak);
3138   - m.put("bcjgsj", (fscjNext-fcsjTime)/60000);
3139   - mapList.add(m);
3140   - }
3141   - }else{
3142   - djg = (long) (trough*60*1000);
3143   - if(fscjNext-fcsjTime>djg){
3144   - djgcs ++;
3145   - Map<String, Object> m=new HashMap<String,Object>();
3146   - m.put("xlName", BasicData.lineCode2NameMap.get(line));
3147   - m.put("fgsname", BasicData.businessFgsCodeNameMap.get(fgsdm+"_"+gsdm));
3148   - m.put("djgde", grade);
3149   - m.put("qJh", s.getFcsj());
3150   - m.put("qSj", time);
3151   - m.put("hJh", listInfo.get(i+1).getFcsj());
3152   - m.put("hSj", listInfo.get(i+1).getFcsjActual());
3153   - m.put("djgsj", trough);
3154   - m.put("bcjgsj", (fscjNext-fcsjTime)/60000);
3155   - mapList.add(m);
3156   - }
  3100 + }
  3101 + return s;
  3102 + }
  3103 +
  3104 + public Map<String, Object> listDjg(String gsdm,String fgsdm,String line,int sjbcs,int peak,int trough,List<ScheduleRealInfo> listInfo,String grade){
  3105 + DecimalFormat df = new DecimalFormat("#0.00");
  3106 + Collections.sort(listInfo,new ComparableAcuals());
  3107 + List<ScheduleRealInfo> listInfo0=new ArrayList<ScheduleRealInfo>();
  3108 + List<ScheduleRealInfo> listInfo1=new ArrayList<ScheduleRealInfo>();
  3109 + for (int i = 0; i < listInfo.size(); i++) {
  3110 + ScheduleRealInfo s=listInfo.get(i);
  3111 + if(s.getXlDir().equals("0")){
  3112 + listInfo0.add(s);
  3113 + }else{
  3114 + listInfo0.add(s);
  3115 + }
  3116 +
  3117 + }
  3118 + Map<String, Object> map=new HashMap<String, Object>();
  3119 + map.put("line", line);
  3120 + map.put("xlName", BasicData.lineCode2NameMap.get(line));
  3121 + map.put("fgsname", BasicData.businessFgsCodeNameMap.get(fgsdm+"_"+gsdm));
  3122 + map.put("bcs", sjbcs);
  3123 + map.put("djgde", grade);
  3124 + int djgcs=0;
  3125 + List<Map<String, Object>> mapList=new ArrayList<Map<String, Object>>();
  3126 + for (int i = 0; i < listInfo0.size(); i++) {
  3127 + ScheduleRealInfo s=listInfo.get(i);
  3128 + Long fcsjTime=s.getFcsjActualTime();
  3129 + String time=s.getFcsjActual();
  3130 + String[] fcsjStr = time.split(":");
  3131 + long fcsj= Long.parseLong(fcsjStr[0])*60+Long.parseLong(fcsjStr[1]);
  3132 + if(i<listInfo.size()-1){
  3133 + Long djg=0l;
  3134 + Long fscjNext=listInfo.get(i+1).getFcsjActualTime();
  3135 + if((fcsj>=zgf1&&fcsj<=zgf2)||(fcsj>=wgf1&&fcsj<=wgf2)){
  3136 + djg = (long) (peak*60*1000);
  3137 + if(fscjNext-fcsjTime>djg){
  3138 + djgcs ++;
  3139 + Map<String, Object> m=new HashMap<String,Object>();
  3140 + m.put("xlName", BasicData.lineCode2NameMap.get(line));
  3141 + m.put("fgsname", BasicData.businessFgsCodeNameMap.get(fgsdm+"_"+gsdm));
  3142 + m.put("djgde", grade);
  3143 + m.put("qJh", s.getFcsj());
  3144 + m.put("qSj", time);
  3145 + m.put("hJh", listInfo.get(i+1).getFcsj());
  3146 + m.put("hSj", listInfo.get(i+1).getFcsjActual());
  3147 + m.put("djgsj", peak);
  3148 + m.put("bcjgsj", (fscjNext-fcsjTime)/60000);
  3149 + mapList.add(m);
  3150 + }
  3151 + }else{
  3152 + djg = (long) (trough*60*1000);
  3153 + if(fscjNext-fcsjTime>djg){
  3154 + djgcs ++;
  3155 + Map<String, Object> m=new HashMap<String,Object>();
  3156 + m.put("xlName", BasicData.lineCode2NameMap.get(line));
  3157 + m.put("fgsname", BasicData.businessFgsCodeNameMap.get(fgsdm+"_"+gsdm));
  3158 + m.put("djgde", grade);
  3159 + m.put("qJh", s.getFcsj());
  3160 + m.put("qSj", time);
  3161 + m.put("hJh", listInfo.get(i+1).getFcsj());
  3162 + m.put("hSj", listInfo.get(i+1).getFcsjActual());
  3163 + m.put("djgsj", trough);
  3164 + m.put("bcjgsj", (fscjNext-fcsjTime)/60000);
  3165 + mapList.add(m);
3157 3166 }
3158 3167 }
3159 3168 }
3160   - double fsl=0.0;
3161   - if(sjbcs>0){
3162   - fsl=Arith.div(djgcs,sjbcs, 2)*100;
  3169 + }
  3170 +
  3171 + for (int i = 0; i < listInfo1.size(); i++) {
  3172 + ScheduleRealInfo s=listInfo.get(i);
  3173 + Long fcsjTime=s.getFcsjActualTime();
  3174 + String time=s.getFcsjActual();
  3175 + String[] fcsjStr = time.split(":");
  3176 + long fcsj= Long.parseLong(fcsjStr[0])*60+Long.parseLong(fcsjStr[1]);
  3177 + if(i<listInfo.size()-1){
  3178 + Long djg=0l;
  3179 + Long fscjNext=listInfo.get(i+1).getFcsjActualTime();
  3180 + if((fcsj>=zgf1&&fcsj<=zgf2)||(fcsj>=wgf1&&fcsj<=wgf2)){
  3181 + djg = (long) (peak*60*1000);
  3182 + if(fscjNext-fcsjTime>djg){
  3183 + djgcs ++;
  3184 + Map<String, Object> m=new HashMap<String,Object>();
  3185 + m.put("xlName", BasicData.lineCode2NameMap.get(line));
  3186 + m.put("fgsname", BasicData.businessFgsCodeNameMap.get(fgsdm+"_"+gsdm));
  3187 + m.put("djgde", grade);
  3188 + m.put("qJh", s.getFcsj());
  3189 + m.put("qSj", time);
  3190 + m.put("hJh", listInfo.get(i+1).getFcsj());
  3191 + m.put("hSj", listInfo.get(i+1).getFcsjActual());
  3192 + m.put("djgsj", peak);
  3193 + m.put("bcjgsj", (fscjNext-fcsjTime)/60000);
  3194 + mapList.add(m);
  3195 + }
  3196 + }else{
  3197 + djg = (long) (trough*60*1000);
  3198 + if(fscjNext-fcsjTime>djg){
  3199 + djgcs ++;
  3200 + Map<String, Object> m=new HashMap<String,Object>();
  3201 + m.put("xlName", BasicData.lineCode2NameMap.get(line));
  3202 + m.put("fgsname", BasicData.businessFgsCodeNameMap.get(fgsdm+"_"+gsdm));
  3203 + m.put("djgde", grade);
  3204 + m.put("qJh", s.getFcsj());
  3205 + m.put("qSj", time);
  3206 + m.put("hJh", listInfo.get(i+1).getFcsj());
  3207 + m.put("hSj", listInfo.get(i+1).getFcsjActual());
  3208 + m.put("djgsj", trough);
  3209 + m.put("bcjgsj", (fscjNext-fcsjTime)/60000);
  3210 + mapList.add(m);
  3211 + }
  3212 + }
3163 3213 }
3164   -
3165   - map.put("djgcs", djgcs);
3166   - map.put("fsl", df.format(fsl)+"%");
3167   - map.put("djgxx", mapList);
3168   - return map;
3169 3214 }
3170   -
  3215 + double fsl=0.0;
  3216 + if(sjbcs>0){
  3217 + fsl=Arith.div(djgcs,sjbcs, 2)*100;
  3218 + }
  3219 +
  3220 + map.put("djgcs", djgcs);
  3221 + map.put("fsl", df.format(fsl)+"%");
  3222 + map.put("djgxx", mapList);
  3223 + return map;
  3224 + }
  3225 +
3171 3226 }
3172 3227  
3173 3228 class ComparableAcuals implements Comparator<ScheduleRealInfo>{
... ...