Commit f16d9decd4419b74960cc8b4af29fad03de7ea53

Authored by 徐烜
2 parents 04e74994 dc0d588d

Update

Showing 21 changed files with 2749 additions and 2095 deletions
src/main/java/com/bsth/controller/realcontrol/RealMapController.java
1 1 package com.bsth.controller.realcontrol;
2 2  
  3 +import com.bsth.data.gpsdata.arrival.GeoCacheData;
  4 +import com.bsth.data.gpsdata.arrival.entity.TimedEnableStationRoute;
3 5 import com.bsth.service.realcontrol.RealMapService;
4 6 import org.springframework.beans.factory.annotation.Autowired;
5 7 import org.springframework.web.bind.annotation.RequestMapping;
  8 +import org.springframework.web.bind.annotation.RequestMethod;
6 9 import org.springframework.web.bind.annotation.RequestParam;
7 10 import org.springframework.web.bind.annotation.RestController;
8 11  
... ... @@ -74,4 +77,9 @@ public class RealMapController {
74 77 public Map<String, Object> multiSectionRoute(@RequestParam String codeIdx){
75 78 return realMapService.multiSectionRoute(codeIdx);
76 79 }
  80 +
  81 + @RequestMapping(value = "/lockAndFlxedTimeEnabled", method = RequestMethod.POST)
  82 + public void lockAndFlxedTimeEnabled(TimedEnableStationRoute tes){
  83 + GeoCacheData.tesMap.put(tes.getLineCode(), tes);
  84 + }
77 85 }
... ...
src/main/java/com/bsth/controller/realcontrol/anomalyCheckController.java
... ... @@ -102,7 +102,7 @@ public class anomalyCheckController {
102 102 }
103 103  
104 104 @RequestMapping(value = "/findSchByLpName")
105   - public List<ScheduleRealInfo> findSchByLpName(String lpName){
  105 + public List<ScheduleRealInfo> findSchByLpName(@RequestParam String lpName){
106 106 return dayOfSchedule.getLpScheduleMap().get(lpName);
107 107 }
108 108 }
... ...
src/main/java/com/bsth/data/gpsdata/arrival/GeoCacheData.java
... ... @@ -2,6 +2,7 @@ package com.bsth.data.gpsdata.arrival;
2 2  
3 3 import com.bsth.data.gpsdata.GpsEntity;
4 4 import com.bsth.data.gpsdata.arrival.entity.StationRoute;
  5 +import com.bsth.data.gpsdata.arrival.entity.TimedEnableStationRoute;
5 6 import com.bsth.data.gpsdata.arrival.utils.CircleQueue;
6 7 import com.bsth.data.gpsdata.arrival.utils.StationRouteComp;
7 8 import com.google.common.collect.ArrayListMultimap;
... ... @@ -53,6 +54,10 @@ public class GeoCacheData {
53 54 //线路限速信息
54 55 private static Map<String, Double> speedLimitMap;
55 56  
  57 + //需要定时刷新的站点路由
  58 + public static Map<String, TimedEnableStationRoute> tesMap = new HashMap<>();
  59 + //TimedEnableStationRoute
  60 +
56 61 @Autowired
57 62 JdbcTemplate jdbcTemplate;
58 63  
... ... @@ -282,6 +287,28 @@ public class GeoCacheData {
282 287 connectStationRoute(tempMap.get(key));
283 288 }
284 289  
  290 + //定时启用的站点走向
  291 + if(tesMap.size() > 0){
  292 + List<String> rems = new ArrayList<>();
  293 + long t = System.currentTimeMillis();
  294 + for(TimedEnableStationRoute tes : tesMap.values()){
  295 + if(tes.getEnableTime() > t){
  296 + logger.info("锁住站点路由," + tes.getLineCode());
  297 + tempMap.replaceValues(tes.getLineCode() + "_0", stationCacheMap.get(tes.getLineCode() + "_0"));
  298 + tempMap.replaceValues(tes.getLineCode() + "_1", stationCacheMap.get(tes.getLineCode() + "_1"));
  299 + }
  300 + else
  301 + rems.add(tes.getLineCode());
  302 + }
  303 +
  304 + //remove
  305 + if(rems.size() > 0){
  306 + for(String lineCode : rems){
  307 + logger.info("启用路由," + lineCode);
  308 + tesMap.remove(lineCode);
  309 + }
  310 + }
  311 + }
285 312 stationCacheMap = tempMap;
286 313 routeCodeMap = codeMap;
287 314 }
... ...
src/main/java/com/bsth/data/gpsdata/arrival/entity/TimedEnableStationRoute.java 0 → 100644
  1 +package com.bsth.data.gpsdata.arrival.entity;
  2 +
  3 +/**
  4 + * 定时启用站点路由
  5 + * Created by panzhao on 2017/8/28.
  6 + */
  7 +public class TimedEnableStationRoute {
  8 +
  9 + private String lineCode;
  10 +
  11 + private Long enableTime;
  12 +
  13 + public String getLineCode() {
  14 + return lineCode;
  15 + }
  16 +
  17 + public void setLineCode(String lineCode) {
  18 + this.lineCode = lineCode;
  19 + }
  20 +
  21 + public Long getEnableTime() {
  22 + return enableTime;
  23 + }
  24 +
  25 + public void setEnableTime(Long enableTime) {
  26 + this.enableTime = enableTime;
  27 + }
  28 +}
... ...
src/main/java/com/bsth/data/schedule/DayOfSchedule.java
... ... @@ -278,12 +278,14 @@ public class DayOfSchedule {
278 278 List<String> lprms = new ArrayList<>();
279 279 Set<String> lps = lpScheduleMap.keySet();
280 280 for (String lp : lps) {
281   - if (lp.indexOf(lineCode + "_") != -1)
  281 + if (lp.startsWith(lineCode + "_"))
282 282 lprms.add(lp);
283 283 }
284 284  
285   - for (String lp : lprms)
  285 + for (String lp : lprms){
  286 + logger.info("清理路牌映射 " + lp);
286 287 lpScheduleMap.removeAll(lp);
  288 + }
287 289  
288 290 logger.info(lineCode + "排班清理 " + count);
289 291 }
... ...
src/main/java/com/bsth/data/schedule/SchAttrCalculator.java
... ... @@ -117,8 +117,7 @@ public class SchAttrCalculator {
117 117 for(int i = 1; i < len; i ++){
118 118 curr = list.get(i);
119 119  
120   - if(prve.getZdzName().equals(curr.getQdzName())
121   - || prve.getZdzCode().equals(curr.getQdzCode())){
  120 + if(isJoin(prve, curr)){
122 121 curr.setQdzArrDatejh(prve.getZdsj());
123 122 if(StringUtils.isNotEmpty(prve.getZdsjActual()))
124 123 curr.setQdzArrDatesj(prve.getZdsjActual());
... ... @@ -126,6 +125,13 @@ public class SchAttrCalculator {
126 125 prve = curr;
127 126 }
128 127 }
  128 +
  129 + private boolean isJoin(ScheduleRealInfo prve, ScheduleRealInfo curr) {
  130 + return prve.getZdzName().equals(curr.getQdzName())//名称相等
  131 + || prve.getZdzCode().equals(curr.getQdzCode())//编码相等
  132 + || prve.getZdzName().startsWith(curr.getQdzName())//起始包括
  133 + || curr.getQdzName().startsWith(prve.getZdzName());//起始包括
  134 + }
129 135  
130 136 /**
131 137 *
... ...
src/main/java/com/bsth/repository/realcontrol/ScheduleRealInfoRepository.java
... ... @@ -139,19 +139,19 @@ public interface ScheduleRealInfoRepository extends BaseRepository&lt;ScheduleRealI
139 139  
140 140 //去掉了 xlBm is not null
141 141 @EntityGraph(value = "scheduleRealInfo_cTasks", type = EntityGraph.EntityGraphType.FETCH)
142   - @Query(value="select DISTINCT s from ScheduleRealInfo s where s.xlBm like %?1% and DATE_FORMAT(s.scheduleDate,'%Y-%m-%d') = ?2 order by s.xlDir,s.realExecDate,s.dfsj, (s.lpName+1)")
  142 + @Query(value="select DISTINCT s from ScheduleRealInfo s where s.xlBm like %?1% and DATE_FORMAT(s.scheduleDate,'%Y-%m-%d') = ?2 order by s.xlDir,s.realExecDate,s.fcsj, lpName")
143 143 List<ScheduleRealInfo> scheduleByDateAndLine(String line,String date);
144 144  
145 145 @EntityGraph(value = "scheduleRealInfo_cTasks", type = EntityGraph.EntityGraphType.FETCH)
146   - @Query(value="select DISTINCT s from ScheduleRealInfo s where s.xlBm =?1 and DATE_FORMAT(s.scheduleDate,'%Y-%m-%d') = ?2 order by (s.lpName+1), s.realExecDate,s.dfsj")
  146 + @Query(value="select DISTINCT s from ScheduleRealInfo s where s.xlBm =?1 and DATE_FORMAT(s.scheduleDate,'%Y-%m-%d') = ?2 order by s.lpName, s.realExecDate,s.fcsj")
147 147 List<ScheduleRealInfo> scheduleByDateAndLineQp(String line,String date);
148 148  
149 149 @EntityGraph(value = "scheduleRealInfo_cTasks", type = EntityGraph.EntityGraphType.FETCH)
150   - @Query(value="select DISTINCT s from ScheduleRealInfo s where gsBm like %?1% and fgsBm like %?2% and DATE_FORMAT(s.scheduleDate,'%Y-%m-%d') = ?3 and s.bcType not in ('in','out','ldks') order by s.xlDir,s.realExecDate,s.dfsj, (s.lpName+1)")
  150 + @Query(value="select DISTINCT s from ScheduleRealInfo s where gsBm like %?1% and fgsBm like %?2% and DATE_FORMAT(s.scheduleDate,'%Y-%m-%d') = ?3 and s.bcType not in ('in','out','ldks') order by s.xlDir,s.realExecDate,s.fcsj, s.lpName")
151 151 List<ScheduleRealInfo> scheduleByDateAndLineByGs(String gsdm,String fgsdm,String date);
152 152  
153 153 @EntityGraph(value = "scheduleRealInfo_cTasks", type = EntityGraph.EntityGraphType.FETCH)
154   - @Query(value="select DISTINCT s from ScheduleRealInfo s where s.xlBm = ?1 and DATE_FORMAT(s.scheduleDate,'%Y-%m-%d') = ?2 order by s.xlDir,s.realExecDate,s.dfsj, (s.lpName+1)")
  154 + @Query(value="select DISTINCT s from ScheduleRealInfo s where s.xlBm = ?1 and DATE_FORMAT(s.scheduleDate,'%Y-%m-%d') = ?2 order by s.xlDir,s.realExecDate,s.fcsj, s.lpName")
155 155 List<ScheduleRealInfo> scheduleByDateAndLineQp2(String line,String date);
156 156  
157 157 @EntityGraph(value = "scheduleRealInfo_cTasks", type = EntityGraph.EntityGraphType.FETCH)
... ...
src/main/java/com/bsth/service/oil/impl/YlxxbServiceImpl.java
... ... @@ -45,23 +45,25 @@ public class YlxxbServiceImpl extends BaseServiceImpl&lt;Ylxxb,Integer&gt; implements
45 45 JdbcTemplate jdbcTemplate;
46 46 @Override
47 47 public PageObject<Ylxxb> Pagequery(Map<String, Object> map) {
48   -
  48 +
49 49 String rq=map.get("yyrq").toString();
50 50 String gsdm=map.get("gsdm_like").toString();
51 51 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   -
  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+"' and jylx ='0') x where x.nj not in ("
  57 + + " select CONCAT(nbbm,jsy) from bsth_c_ylb "
  58 + + " where rq='"+rq+"'"
  59 + + " and ssgsdm='"+gsdm+"' and fgsdm ='"+fgsdm+"')"
  60 + + " and x.nbbm in (select nbbm from bsth_c_ylb "
  61 + + " where rq='"+rq+"'"
  62 + + " and ssgsdm='"+gsdm+"' and fgsdm ='"+fgsdm+"') "
  63 + + " and x.nbbm not in (select nbbm from bsth_c_ylxxb"
  64 + + " where yyrq='"+rq+"' and gsdm ='"+gsdm+"' AND jylx ='1')";
  65 +
  66 +
65 67 /*String sql= "select v.*,u.jsy as ldgh from "
66 68 + " ( select * from bsth_c_ylxxb x where "
67 69 + " DATE_FORMAT(x.yyrq,'%Y-%m-%d')='"+rq+"' and x.gsdm='"+gsdm+"'"
... ... @@ -76,43 +78,43 @@ public class YlxxbServiceImpl extends BaseServiceImpl&lt;Ylxxb,Integer&gt; implements
76 78 + " where DATE_FORMAT(rq,'%Y-%m-%d')='"+rq+"'"
77 79 + " and ssgsdm='"+gsdm+"' and fgsdm='"+fgsdm+"' ) u "
78 80 + " on v.nbbm=u.nbbm ";*/
79   -
  81 +
80 82 //根具条件查询指定日期Ylxxb的数据
81 83 // List<Ylxxb> iterator=repository.checkYlxx(rq,gsdm);
82 84 /*if(map.get("gsdm_in")!=null){
83 85 map.put("ssgsdm_in", map.get("gsdm_in"));
84 86 map.remove("gsdm_in");
85   -
  87 +
86 88 }else{
87 89 map.put("ssgsdm_like", map.get("gsdm_like"));
88 90 map.remove("gsdm_like");
89 91 }*/
90   -
  92 +
91 93 //根具条件查询指定日期Ylb的数据
92 94 // 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"));
  95 + List<Ylxxb> list=jdbcTemplate.query(sql,
  96 + new RowMapper<Ylxxb>(){
  97 + @Override
  98 + public Ylxxb mapRow(ResultSet rs, int rowNum) throws SQLException {
  99 + Ylxxb s = new Ylxxb();
  100 + s.setId(rs.getInt("id"));
  101 + s.setYyrq(rs.getDate("yyrq"));
  102 + s.setNbbm(rs.getString("nbbm"));
  103 + s.setGsdm(rs.getString("gsdm"));
  104 + s.setFgsdm(rs.getString("fgsdm"));
  105 + s.setJsy(rs.getString("jsy"));
  106 + s.setJzl(rs.getDouble("jzl"));
  107 + s.setStationid(rs.getString("stationid"));
  108 + s.setNylx(rs.getInt("nylx"));
  109 + s.setJyggh(rs.getString("jyggh"));
  110 + s.setYj(rs.getDouble("yj"));
109 111 // s.setLdgh(rs.getString("ldgh"));
110   - s.setBz(rs.getString("bz"));
111   - return s;
112   - }
113   - });
114   -
115   -
  112 + s.setBz(rs.getString("bz"));
  113 + return s;
  114 + }
  115 + });
  116 +
  117 +
116 118 List<Ylb> listylb=ylbRepository.obtainYl(rq, gsdm, fgsdm, "", "", "nbbm");
117 119 for (int i = 0; i < list.size(); i++) {
118 120 String ldgh="";
... ... @@ -122,11 +124,11 @@ public class YlxxbServiceImpl extends BaseServiceImpl&lt;Ylxxb,Integer&gt; implements
122 124 if(ldgh.equals(""))
123 125 ldgh +=ylb.getJsy();
124 126 else
125   - ldgh += ","+ylb.getJsy();
  127 + ldgh += ","+ylb.getJsy();
126 128 }
127 129 }
128 130 list.get(i).setLdgh(ldgh);
129   -
  131 +
130 132 }
131 133 //正式使用用下面代码
132 134 // for (int i = 0; i < iterator.size(); i++) {
... ... @@ -147,16 +149,16 @@ public class YlxxbServiceImpl extends BaseServiceImpl&lt;Ylxxb,Integer&gt; implements
147 149 // list.add(y1);
148 150 // }
149 151 // }
150   -
151   -
152   -
  152 +
  153 +
  154 +
153 155 PageHelper pageHelper = new PageHelper(list.size(), map);
154 156 pageHelper.getMap();
155 157 PageObject<Ylxxb> pageObject = pageHelper.getPageObject();
156 158 pageObject.setDataList(list);
157 159 return pageObject;
158 160 }
159   - @Transactional
  161 + @Transactional
160 162 @Override
161 163 public Map<String, Object> checkJsy(Map<String, Object> map) throws Exception{
162 164 Map<String, Object> newMap=new HashMap<String,Object>();
... ... @@ -175,11 +177,13 @@ public class YlxxbServiceImpl extends BaseServiceImpl&lt;Ylxxb,Integer&gt; implements
175 177 Integer id =jsonObject.getInteger("id");
176 178 String jsy =jsonObject.getString("jsy");
177 179 Ylxxb ylxxb=repository.findOne(id);
178   - ylxxb.setJsy(jsy);
179   - ylxxb.setJylx(1);
180   - repository.save(ylxxb);
  180 + if(!ylxxb.getJsy().equals(jsy)){
  181 + ylxxb.setJsy(jsy);
  182 + ylxxb.setJylx(1);
  183 + repository.save(ylxxb);
  184 + }
181 185 }
182   - newMap.put("status", ResponseCode.SUCCESS);
  186 + newMap.put("status", ResponseCode.SUCCESS);
183 187 }catch(Exception e){
184 188 newMap.put("status", ResponseCode.ERROR);
185 189 logger.error("save erro.", e);
... ... @@ -188,4 +192,4 @@ public class YlxxbServiceImpl extends BaseServiceImpl&lt;Ylxxb,Integer&gt; implements
188 192 return newMap;
189 193 }
190 194  
191   -}
  195 +}
192 196 \ No newline at end of file
... ...
src/main/java/com/bsth/service/realcontrol/impl/ScheduleRealInfoServiceImpl.java
... ... @@ -4669,8 +4669,8 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
4669 4669 mr.setSjyygl(rs.getDouble("sjyygl"));
4670 4670 mr.setSjksgl(rs.getDouble("sjksgl"));
4671 4671 mr.setZgl(rs.getDouble("zyygl"));
4672   - mr.setZddfgl(rs.getDouble("sddfgl"));
4673   - mr.setSddfgl(rs.getDouble("zddfgl"));
  4672 + mr.setZddfgl(rs.getDouble("zddfgl"));
  4673 + mr.setSddfgl(rs.getDouble("sddfgl"));
4674 4674 mr.setWqwxhgl(rs.getDouble("wqwxhgl"));
4675 4675 mr.setBfwxhgl(rs.getDouble("bfwxhgl"));
4676 4676 mr.setPygl(rs.getDouble("pygl"));
... ... @@ -4763,8 +4763,8 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
4763 4763 sReport.setSjyybc(rs.getInt("sjyybc"));
4764 4764 sReport.setSjksbc(rs.getInt("sjksbc"));
4765 4765 sReport.setZbc(rs.getInt("zyybc"));
4766   - sReport.setZddfbc(rs.getInt("sddfbc"));
4767   - sReport.setSddfbc(rs.getInt("zddfbc"));
  4766 + sReport.setZddfbc(rs.getInt("zddfbc"));
  4767 + sReport.setSddfbc(rs.getInt("sddfbc"));
4768 4768 sReport.setWqwxhbc(rs.getInt("wqwxhbc"));
4769 4769 sReport.setBfwxhbc(rs.getInt("bfwxhbc"));
4770 4770 sReport.setPybc(rs.getInt("pybc"));
... ...
src/main/java/com/bsth/service/report/impl/ReportServiceImpl.java
... ... @@ -43,17 +43,17 @@ import javax.persistence.criteria.CriteriaBuilder.In;
43 43  
44 44 @Service
45 45 public class ReportServiceImpl implements ReportService{
46   -
  46 +
47 47 private static long zgf1 = 6 * 60 + 31,
48 48 zgf2 = 8 * 60 + 30,
49   - wgf1 = 16 * 60 + 1,
  49 + wgf1 = 16 * 60 + 1,
50 50 wgf2 = 18 * 60;
51   -
  51 +
52 52 private Logger logger = LoggerFactory.getLogger(this.getClass());
53   -
  53 +
54 54 @Autowired
55 55 JdbcTemplate jdbcTemplate;
56   -
  56 +
57 57 @Autowired
58 58 ScheduleRealInfoRepository scheduleRealInfoRepository;
59 59 @Autowired
... ... @@ -64,24 +64,24 @@ public class ReportServiceImpl implements ReportService{
64 64 LineRepository lineRepository;
65 65 @Autowired
66 66 StationRouteRepository stationRouteRepository;
67   -
  67 +
68 68 @Override
69 69 public List<ScheduleRealInfo> queryListBczx(String line, String date,String clzbh) {
70 70 // TODO Auto-generated method stub
71 71 List<ScheduleRealInfo> list=scheduleRealInfoRepository.findByDate2(line,date,clzbh);
72   -
  72 +
73 73 // jdbcTemplate.query("select * from bsth_c_s_sp_info_real where line=?1 "
74   -// + "and DATE_FORMAT(schedule_date,'%Y-%m-%d')=?2 and cl_zbl=?3",
75   -// new Object[]{line,date,clzbh},
76   -// new RowMapper(){
77   -// @Override
78   -// public Object mapRow(ResultSet rs, int rowNum) throws SQLException {
79   -// ScheduleRealInfo s = new ScheduleRealInfo();
  74 +// + "and DATE_FORMAT(schedule_date,'%Y-%m-%d')=?2 and cl_zbl=?3",
  75 +// new Object[]{line,date,clzbh},
  76 +// new RowMapper(){
  77 +// @Override
  78 +// public Object mapRow(ResultSet rs, int rowNum) throws SQLException {
  79 +// ScheduleRealInfo s = new ScheduleRealInfo();
80 80 //// s.
81   -// return s;
82   -// }
83   -// });
84   -
  81 +// return s;
  82 +// }
  83 +// });
  84 +
85 85 return list;
86 86 }
87 87 @Override
... ... @@ -96,7 +96,7 @@ public class ReportServiceImpl implements ReportService{
96 96 Long date2=simpleDateFormat.parse(date+" "+sjdd+":00").getTime();
97 97 Date dates=simpleDateFormat.parse(date+" 00:00:00");
98 98 List<ArrivalInfo> lists=load(line,sbbb,date1,date2,dates);
99   -
  99 +
100 100 for(int i=0;i<lists.size();i++){
101 101 ArrivalInfo t1=lists.get(i);
102 102 if(t1.getInOut()==0){
... ... @@ -109,53 +109,53 @@ public class ReportServiceImpl implements ReportService{
109 109 }
110 110 list.add(t1);
111 111 }
112   -
  112 +
113 113 }
114   -
115   -
  114 +
  115 +
116 116 } catch (ParseException e) {
117 117 // TODO Auto-generated catch block
118 118 e.printStackTrace();
119 119 }
120   -
  120 +
121 121 return list;
122 122 }
123 123  
124   -
  124 +
125 125 public List<ArrivalInfo> load(String line,String sbbb,Long date1,Long date2,Date dates){
126 126 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   - }
  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 + }
153 153 return list;
154 154 }
155   -
  155 +
156 156 public List<ArrivalInfo> resultSet2Set(ResultSet rs) throws SQLException{
157 157 List<ArrivalInfo> list = new ArrayList<>();
158   -
  158 +
159 159 ArrivalInfo arr;
160 160 while(rs.next()){
161 161 arr = new ArrivalInfo();
... ... @@ -167,7 +167,7 @@ public class ReportServiceImpl implements ReportService{
167 167 logger.warn("未注册的设备号," + arr.getDeviceId());
168 168 continue;
169 169 }
170   -
  170 +
171 171 arr.setTs(rs.getLong("ts"));
172 172 arr.setLineCode(rs.getString("line_id"));
173 173 arr.setUpDown(rs.getInt("up_down"));
... ... @@ -177,7 +177,7 @@ public class ReportServiceImpl implements ReportService{
177 177 arr.setCreateDate(rs.getLong("create_timestamp"));
178 178 arr.setWeeksYear(rs.getInt("weeks_year"));
179 179 arr.setEnable(true);
180   -
  180 +
181 181 list.add(arr);
182 182 }
183 183 return list;
... ... @@ -185,76 +185,76 @@ public class ReportServiceImpl implements ReportService{
185 185 @Override
186 186 public List<ArrivalInfo> queryListClzd(String line, String zd, String zdlx, String fcsj, String ddsj) {
187 187 // 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);
  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;
212 209 }
213   -
214 210 }
215   -
216   -
217   - } catch (ParseException e) {
218   - // TODO Auto-generated catch block
219   - e.printStackTrace();
  211 + list.add(t1);
220 212 }
221   -
222   - return list;
  213 +
  214 + }
  215 +
  216 +
  217 + } catch (ParseException e) {
  218 + // TODO Auto-generated catch block
  219 + e.printStackTrace();
  220 + }
  221 +
  222 + return list;
223 223 }
224   -
225   -
  224 +
  225 +
226 226 public List<ArrivalInfo> load2(String line,Long date1,Long date2,Date dates1,Date dates2,String zd,String zdlx){
227 227 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   - }
  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 + }
258 258 return list;
259 259 }
260 260 @Override
... ... @@ -285,14 +285,14 @@ public class ReportServiceImpl implements ReportService{
285 285 String sqlPc=" select count(*) from bsth_c_cars where id in("
286 286 + " select cl from bsth_c_s_ccinfo where xl in ( "
287 287 + " select id from bsth_c_line where line_code='"+line+"' )"
288   - + " group by equipment_code ) ";
289   -
  288 + + " group by equipment_code ) ";
  289 +
290 290 Map<String, Object> map=new HashMap<String,Object>();
291   -
  291 +
292 292 /*List<Map<String, Object>> listPc= jdbcTemplate.query(sqlPc,
293 293 new RowMapper<Map<String, Object>>(){
294 294 @Override
295   - public Map<String, Object> mapRow(ResultSet rs, int rowNum) throws SQLException {
  295 + public Map<String, Object> mapRow(ResultSet rs, int rowNum) throws SQLException {
296 296 Map<String, Object> m=new HashMap<String,Object>();
297 297 m.put("zbh", rs.getString("cl_zbh"));
298 298 return m;
... ... @@ -300,61 +300,61 @@ public class ReportServiceImpl implements ReportService{
300 300 });*/
301 301 //配车
302 302 int pcs=jdbcTemplate.queryForObject(sqlPc, Integer.class);
303   -
  303 +
304 304 String sqlPlan=" SELECT jhlc,bc_type,fcsj FROM bsth_c_s_ttinfo_detail "
305 305 +" where ttinfo ='"+ttinfo+"' ";
306   -
  306 +
307 307 //班次
308 308 int zgf_0 = 6*60+31,zgf_1 = 8*60+30,wgf_0 = 16*60+1,wgf_1 = 18*60;
309 309 int qcBc=0,qjBc=0,zqcBc=0,zqjBc=0,wqcBc=0,wqjBc=0;
310 310 double zlc = 0 , yylc = 0,kslc=0;
311 311 //查询班次
312   - List<Map<String, Object>> listPlan= jdbcTemplate.query(sqlPlan,
  312 + List<Map<String, Object>> listPlan= jdbcTemplate.query(sqlPlan,
313 313 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   -
  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 +
324 324 for (int i = 0; i < listPlan.size(); i++) {
325 325 Map<String, Object> m=listPlan.get(i);
326   - double jhlc=Double.parseDouble(m.get("jhlc").toString());
  326 + double jhlc=Double.parseDouble(m.get("jhlc").toString());
327 327 String bcType=m.get("bcType").toString();
328 328 String fcsjs[]=m.get("fcsj").toString().split(":");
329   -
  329 +
330 330 zlc +=jhlc;
331 331 if(bcType.equals("in") || bcType.equals("out")){
332 332 kslc+=jhlc;
333 333 }
334 334 else if(bcType.equals("region")){
335 335 qjBc++;
336   - if((Integer.parseInt(fcsjs[0])*60+Integer.parseInt(fcsjs[1])) > zgf_0
  336 + if((Integer.parseInt(fcsjs[0])*60+Integer.parseInt(fcsjs[1])) > zgf_0
337 337 && (Integer.parseInt(fcsjs[0])*60+Integer.parseInt(fcsjs[1])) < zgf_1){
338 338 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){
  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){
341 341 wqjBc++;
342 342 }
343   -
  343 +
344 344 yylc+=jhlc;
345 345 }else{
346 346 qcBc ++;
347   - if((Integer.parseInt(fcsjs[0])*60+Integer.parseInt(fcsjs[1])) > zgf_0
  347 + if((Integer.parseInt(fcsjs[0])*60+Integer.parseInt(fcsjs[1])) > zgf_0
348 348 && (Integer.parseInt(fcsjs[0])*60+Integer.parseInt(fcsjs[1])) < zgf_1){
349 349 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){
  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){
352 352 wqcBc++;
353 353 }
354 354 yylc +=jhlc;
355 355 }
356 356 }
357   -
  357 +
358 358 map.put("pcs", pcs);
359 359 map.put("qcbc", qcBc);
360 360 map.put("qjbc", qjBc);
... ... @@ -373,39 +373,39 @@ public class ReportServiceImpl implements ReportService{
373 373 DecimalFormat df = new DecimalFormat("#0.00");
374 374 // TODO Auto-generated method stub
375 375 //最早营运时间 区分夜宵线
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);
  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);
381 381 String[] minSjs = minfcsj.split(":");
382 382 int minSj=Integer.parseInt(minSjs[0])*60+Integer.parseInt(minSjs[1]);
383 383 //查询时间里程
384 384 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   -
  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 +
390 390 Map<String, Object> map=new HashMap<String,Object>();
391 391 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   - });
  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 + });
404 404 int yysj=0 ;
405 405 double yycs=0 ,yygl=0;
406 406 String lp ="0";
407 407 int sj=0;
408   -
  408 +
409 409 for(int i=0;i<list.size();i++){
410 410 Map<String, Object> m=list.get(i);
411 411 String time=m.get("fcsj").toString();
... ... @@ -421,7 +421,7 @@ public class ReportServiceImpl implements ReportService{
421 421 }
422 422 }else{
423 423 yygl += Double.parseDouble(m.get("yygl").toString());
424   -
  424 +
425 425 if(sj==0){
426 426 sj=(Integer.parseInt(times[0])+24)*60+Integer.parseInt(times[1]);
427 427 }else{
... ... @@ -439,7 +439,7 @@ public class ReportServiceImpl implements ReportService{
439 439 }
440 440 }else{
441 441 yygl += Double.parseDouble(m.get("yygl").toString());
442   -
  442 +
443 443 if(sj==0){
444 444 sj=Integer.parseInt(times[0])*60+Integer.parseInt(times[1]);
445 445 }else{
... ... @@ -456,7 +456,7 @@ public class ReportServiceImpl implements ReportService{
456 456 sj=0;
457 457 }
458 458 lp=m.get("lp").toString();
459   -
  459 +
460 460 }
461 461 if(m.containsKey("ists") && m.get("ists").equals("1")){
462 462 sj = 0;
... ... @@ -467,105 +467,105 @@ public class ReportServiceImpl implements ReportService{
467 467 }
468 468 int hh=yysj/60;
469 469 int mm=yysj%60;
470   -
  470 +
471 471 map.put("yysj", hh+":"+mm);
472 472 map.put("yycs", df.format(yycs)+"公里/小时");
473 473 // map.put(key, value)
474 474 return map;
475 475 }
476   -
  476 +
477 477 public static void main(String[] args) {
478 478 System.out.println(609360/60);
479 479 System.out.println(609360%60);
480 480 }
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   -
  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>>();
486 485  
487 486  
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   - }*/
  487 +
  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 + }*/
569 569 @Override
570 570 public List<Map<String, Object>> tbodyTime3(String line, String ttinfo) {
571 571 // TODO Auto-generated method stub
... ... @@ -595,39 +595,39 @@ public class ReportServiceImpl implements ReportService{
595 595 + " select cl_zbh,qdz_name from bsth_c_s_sp_info where tt_info ='"+ttinfo+"'"
596 596 + " and bc_type ='region' and fcsj >'16:01' and fcsj<'18:00'"
597 597 + " 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";
  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";
620 620 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   -
  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 +
631 631 for (int i = 0; i < lists.size(); i++) {
632 632 Map<String, Object> z=new HashMap<String,Object>();
633 633 Map<String, Object> w=new HashMap<String,Object>();
... ... @@ -636,7 +636,7 @@ public class ReportServiceImpl implements ReportService{
636 636 int wbcs=0;
637 637 if(p.get("bcType").toString().equals("normal")){
638 638 for (int j = 0; j < listj.size(); j++) {
639   - if(listj.get(j).get("qdz_name").toString().equals(p.get("zdm").toString()) &&
  639 + if(listj.get(j).get("qdz_name").toString().equals(p.get("zdm").toString()) &&
640 640 listj.get(j).get("bcType").toString().equals("normal")){
641 641 String time=listj.get(j).get("fcsj").toString();
642 642 long bcsj= Long.parseLong(listj.get(j).get("bcsj").toString());
... ... @@ -644,15 +644,15 @@ public class ReportServiceImpl implements ReportService{
644 644 String[] fcsjStr = time.split(":");
645 645 long fcsj= Long.parseLong(fcsjStr[0])*60+Long.parseLong(fcsjStr[1]);
646 646 long ddsj=fcsj+bcsj;
647   - if((fcsj>=zgf1 && fcsj<=zgf2) || (ddsj>=zgf1&&ddsj<=zgf2)
  647 + if((fcsj>=zgf1 && fcsj<=zgf2) || (ddsj>=zgf1&&ddsj<=zgf2)
648 648 || (fcsj<zgf1&&ddsj>zgf2)){
649 649 if(p.get("z"+clZbh)==null){
650 650 zbcs++;
651 651 p.put("z"+clZbh, clZbh);
652 652 }
653 653 }
654   -
655   - if((fcsj>=wgf1 && fcsj<=wgf2) || (ddsj>=wgf1&&ddsj<=wgf2)
  654 +
  655 + if((fcsj>=wgf1 && fcsj<=wgf2) || (ddsj>=wgf1&&ddsj<=wgf2)
656 656 || (fcsj<wgf1&&ddsj>wgf2)){
657 657 if(p.get("w"+clZbh)==null){
658 658 wbcs++;
... ... @@ -660,26 +660,26 @@ public class ReportServiceImpl implements ReportService{
660 660 }
661 661 }
662 662 }
663   -
  663 +
664 664 }
665 665 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);
  666 + z.put("zdm", p.get("zdm"));
  667 + z.put("cls", zbcs);
  668 + z.put("lx", "zqc");
  669 + list_s.add(z);
670 670 }
671 671 if(wbcs>0){
672 672 w.put("zdm", p.get("zdm"));
673   - w.put("cls", zbcs);
674   - w.put("lx", "wqc");
675   - list_s.add(w);
  673 + w.put("cls", zbcs);
  674 + w.put("lx", "wqc");
  675 + list_s.add(w);
676 676 }
677   -
  677 +
678 678 }
679   -
  679 +
680 680 if(p.get("bcType").equals("region")){
681 681 for (int j = 0; j < listj.size(); j++) {
682   - if(listj.get(j).get("qdz_name").toString().equals(p.get("zdm").toString()) &&
  682 + if(listj.get(j).get("qdz_name").toString().equals(p.get("zdm").toString()) &&
683 683 listj.get(j).get("bcType").toString().equals("region")){
684 684 String time=listj.get(j).get("fcsj").toString();
685 685 long bcsj= Long.parseLong(listj.get(j).get("bcsj").toString());
... ... @@ -687,15 +687,15 @@ public class ReportServiceImpl implements ReportService{
687 687 String[] fcsjStr = time.split(":");
688 688 long fcsj= Long.parseLong(fcsjStr[0])*60+Long.parseLong(fcsjStr[1]);
689 689 long ddsj=fcsj+bcsj;
690   - if((fcsj>=zgf1 && fcsj<=zgf2) || (ddsj>=zgf1&&ddsj<=zgf2)
  690 + if((fcsj>=zgf1 && fcsj<=zgf2) || (ddsj>=zgf1&&ddsj<=zgf2)
691 691 || (fcsj<zgf1&&ddsj>zgf2)){
692 692 if(p.get("z"+clZbh)==null){
693 693 zbcs++;
694 694 p.put("z"+clZbh, clZbh);
695 695 }
696 696 }
697   -
698   - if((fcsj>=wgf1 && fcsj<=wgf2) || (ddsj>=wgf1&&ddsj<=wgf2)
  697 +
  698 + if((fcsj>=wgf1 && fcsj<=wgf2) || (ddsj>=wgf1&&ddsj<=wgf2)
699 699 || (fcsj<wgf1&&ddsj>wgf2)){
700 700 if(p.get("w"+clZbh)==null){
701 701 wbcs++;
... ... @@ -703,22 +703,22 @@ public class ReportServiceImpl implements ReportService{
703 703 }
704 704 }
705 705 }
706   -
  706 +
707 707 }
708 708 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);
  709 + z.put("zdm", p.get("zdm"));
  710 + z.put("cls", zbcs);
  711 + z.put("lx", "zqj");
  712 + list_s.add(z);
713 713 }
714 714 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);
  715 + w.put("zdm", p.get("zdm"));
  716 + w.put("cls", zbcs);
  717 + w.put("lx", "wqj");
  718 + list_s.add(w);
719 719 }
720 720 }
721   -
  721 +
722 722 }
723 723 int a=0;
724 724 int b=0;
... ... @@ -764,47 +764,47 @@ public class ReportServiceImpl implements ReportService{
764 764 status=false;
765 765 }
766 766 }
767   -
  767 +
768 768 }
769 769 return list;
770 770 }
771   -
  771 +
772 772 @Override
773 773 public List<Map<String, Object>> tbodyTime4(String line, String ttinfo) {
774 774 List<Map<String, Object>> list =new ArrayList<>();
775 775 // TODO Auto-generated method stub
776 776 //最早营运时间 区分夜宵线
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   -
  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 +
783 783 //查询全程
784 784 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 ";
  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 ";
793 793 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   -
  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 +
808 808 List<List<Map<String, String>>> mapList = new ArrayList<List<Map<String,String>>>();
809 809 mapList.add(new ArrayList<Map<String, String>>());
810 810 mapList.add(new ArrayList<Map<String, String>>());
... ... @@ -816,7 +816,7 @@ public class ReportServiceImpl implements ReportService{
816 816 mapList.get(1).add(m);
817 817 }
818 818 }
819   -
  819 +
820 820 for(int i = 0; i < mapList.size(); i++){
821 821 List<Map<String, String>> l = mapList.get(i);
822 822 Map<String, Object> tempMap = new HashMap<String, Object>();
... ... @@ -852,33 +852,33 @@ public class ReportServiceImpl implements ReportService{
852 852 if(sxqdz.length()!=0 || xxqdz.length()!=0)
853 853 list.add(tempMap);
854 854 }
855   -
  855 +
856 856 return list;
857 857 }
858 858 @Override
859 859 public List<Map<String, Object>> tbodyTime5(String line, String ttinfo) {
860 860 // TODO Auto-generated method stub
861 861 //最早营运时间 区分夜宵线
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>>(){
  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>>(){
880 880 @Override
881   - public Map<String, Object> mapRow(ResultSet rs, int rowNum) throws SQLException {
  881 + public Map<String, Object> mapRow(ResultSet rs, int rowNum) throws SQLException {
882 882 Map<String, Object> m=new HashMap<String,Object>();
883 883 m.put("fcsj", rs.getString("fcsj"));
884 884 m.put("yygl", rs.getString("jhlc")==null?"0":rs.getString("jhlc"));
... ... @@ -891,11 +891,11 @@ public class ReportServiceImpl implements ReportService{
891 891 if(rs.getString("xh").equals("2")){
892 892 m.put("fcsj", (Integer.valueOf(split[0]) + 24) + ":"+split[1]);
893 893 }
894   -
  894 +
895 895 return m;
896 896 }
897 897 });
898   - List<Map<String, Object>> newList=new ArrayList<Map<String,Object>>();
  898 + List<Map<String, Object>> newList=new ArrayList<Map<String,Object>>();
899 899 int yysxZq=0,yyxxZq=0,tzsxZq=0,tzxxZq=0,minZqcj=0,maxZqcj=0,sxcountZqbc=0,xxcountZqbc=0; //早前
900 900 int yysxZgf=0,yyxxZgf=0,tzsxZgf=0,tzxxZgf=0,minZgfcj=0,maxZgfcj=0,sxcountZgfbc=0,xxcountZgfbc=0;//早高峰
901 901 int yysxZw=0,yyxxZw=0,tzsxZw=0,tzxxZw=0,minZwcj=0,maxZwcj=0,sxcountZwbc=0,xxcountZwbc=0;//中午
... ... @@ -906,7 +906,7 @@ public class ReportServiceImpl implements ReportService{
906 906 List<Integer> zwFcsj0=new ArrayList<Integer>();
907 907 List<Integer> wgfFcsj0=new ArrayList<Integer>();
908 908 List<Integer> whFcsj0=new ArrayList<Integer>();
909   -
  909 +
910 910 List<Integer> zqFcsj1=new ArrayList<Integer>();
911 911 List<Integer> zgfFcsj1=new ArrayList<Integer>();
912 912 List<Integer> zwFcsj1=new ArrayList<Integer>();
... ... @@ -934,9 +934,9 @@ public class ReportServiceImpl implements ReportService{
934 934 ists=false;
935 935 }
936 936 }else{
937   - if(temp>fcsjT){
938   - temp=fcsjT+bcsj;
939   - }
  937 +// if(temp>fcsjT){
  938 +// temp=fcsjT;
  939 +// }
940 940 if(bcType.equals("in") || bcType.equals("out")){
941 941 temp = fcsjT+bcsj;
942 942 lpname=m.get("lp").toString();
... ... @@ -944,141 +944,141 @@ public class ReportServiceImpl implements ReportService{
944 944 ists=false;
945 945 }else{
946 946 // 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);
  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);
  975 + }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;
975 988 }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   - }
  989 + if(fcsjT_>= minSj && fcsjT_ <= 6*60+30)
  990 + tzxxZq +=fcsjT-temp;
  991 + else
  992 + tzxxZgf +=fcsjT-temp;
995 993 }
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);
  994 + }
  995 + }
  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);
  1004 + }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;
1004 1016 }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   - }
  1017 + if(fcsjT_ > 6*60+30 && fcsjT_ <= 8*60+30)
  1018 + tzxxZgf +=fcsjT-temp;
  1019 + else
  1020 + tzxxZw +=fcsjT-temp;
1023 1021 }
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);
  1022 + }
  1023 + }
  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);
  1031 + }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;
1031 1044 }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   - }
  1045 + if(fcsjT_ > 8*60+30 && fcsjT_ <= 16*60)
  1046 + tzxxZw +=fcsjT-temp;
  1047 + else
  1048 + tzxxWgf +=fcsjT-temp;
1051 1049 }
1052   - temp =fcsjT+bcsj;
1053   - }else{
1054   - //晚高峰后
1055   - if(xlDir==0){
1056   - yysxWh +=bcsj;
1057   - sxcountWhbc ++;
1058   - whFcsj0.add(fcsjT);
  1050 + }
  1051 + }
  1052 + temp =fcsjT+bcsj;
  1053 + }else{
  1054 + //晚高峰后
  1055 + if(xlDir==0){
  1056 + yysxWh +=bcsj;
  1057 + sxcountWhbc ++;
  1058 + whFcsj0.add(fcsjT);
  1059 + }else{
  1060 + yyxxWh +=bcsj;
  1061 + xxcountWhbc ++;
  1062 + whFcsj1.add(fcsjT);
  1063 + }
  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;
1059 1071 }else{
1060   - yyxxWh +=bcsj;
1061   - xxcountWhbc ++;
1062   - whFcsj1.add(fcsjT);
1063   - }
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   - }
  1072 + if(fcsjT_ > 16*60 && fcsjT_ <= 18*60)
  1073 + tzxxWgf +=fcsjT-temp;
  1074 + else
  1075 + tzxxWh +=fcsjT-temp;
1078 1076 }
1079   - temp =fcsjT+bcsj;
1080 1077 }
1081   -
  1078 + }
  1079 + temp =fcsjT+bcsj;
  1080 + }
  1081 +
1082 1082 /*}else{
1083 1083 //下行数据
1084 1084 if(fcsjT>= minSj && fcsjT <= 6*60+30){
... ... @@ -1151,19 +1151,19 @@ public class ReportServiceImpl implements ReportService{
1151 1151 }
1152 1152 // }
1153 1153 }*/
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   - }
  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 + }
1163 1163 }
1164   -
  1164 +
1165 1165 }
1166   -
  1166 +
1167 1167 //---------------------------------------早前
1168 1168 List<Integer> cjs = new ArrayList<Integer>();
1169 1169 Collections.sort(zqFcsj0);
... ... @@ -1175,7 +1175,7 @@ public class ReportServiceImpl implements ReportService{
1175 1175 cjs.add(zqFcsj0.get(i)-fcsjs);
1176 1176 fcsjs=zqFcsj0.get(i);
1177 1177 }
1178   -
  1178 +
1179 1179 }
1180 1180 Collections.sort(zqFcsj1);
1181 1181 int fcsjx=0;
... ... @@ -1186,30 +1186,42 @@ public class ReportServiceImpl implements ReportService{
1186 1186 cjs.add(zqFcsj1.get(i)-fcsjx);
1187 1187 fcsjx =zqFcsj1.get(i);
1188 1188 }
1189   -
  1189 +
1190 1190 }
1191 1191 Collections.sort(cjs);
1192 1192 for(int i : cjs){
1193 1193 zcj += i;
1194 1194 }
1195 1195 Map<String, Object> tempMap = new HashMap<String, Object>();
  1196 + double sxtszq=0.0;
  1197 + double sxsjzq=0.0;
  1198 + if(sxcountZqbc>0){
  1199 + sxtszq=Arith.div(tzsxZq, sxcountZqbc, 1);
  1200 + sxsjzq=Arith.div(yysxZq, sxcountZqbc,1);
  1201 + }
  1202 +
  1203 + double xxtszq=0.0;
  1204 + double xxsjzq=0.0;
  1205 + if(xxcountZqbc>0){
  1206 + xxtszq=Arith.div(tzxxZq, xxcountZqbc, 1);
  1207 + xxsjzq=Arith.div(yyxxZq, xxcountZqbc,1);
  1208 + }
1196 1209 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()));
  1210 + tempMap.put("sxsj", sxsjzq);
  1211 + tempMap.put("xxsj", xxsjzq);
  1212 + tempMap.put("sxtssj", sxtszq);
  1213 + tempMap.put("xxtssj", xxtszq);
  1214 + tempMap.put("fqsj", Arith.add(Arith.add(sxtszq, sxsjzq), Arith.add(xxtszq, xxsjzq)));
1203 1215 tempMap.put("cjqj", cjs.size()>0?cjs.get(0)+"——"+cjs.get(cjs.size()-1):"——");
1204 1216 tempMap.put("pjcj", cjs.size()>0?zcj/cjs.size():"/");
1205 1217 newList.add(tempMap);
1206   -
  1218 +
1207 1219 //----------------------------------早高峰
1208 1220 cjs = new ArrayList<Integer>();
1209 1221 zcj =0;
1210   -
  1222 +
1211 1223 Collections.sort(zgfFcsj0);
1212   - fcsjs=0;
  1224 + fcsjs=0;
1213 1225 for (int i = 0; i < zgfFcsj0.size(); i++) {
1214 1226 if(i==0){
1215 1227 fcsjs =zgfFcsj0.get(i);
... ... @@ -1217,10 +1229,10 @@ public class ReportServiceImpl implements ReportService{
1217 1229 cjs.add(zgfFcsj0.get(i)-fcsjs);
1218 1230 fcsjs=zgfFcsj0.get(i);
1219 1231 }
1220   -
  1232 +
1221 1233 }
1222 1234 Collections.sort(zgfFcsj1);
1223   - fcsjx=0;
  1235 + fcsjx=0;
1224 1236 for (int i = 0; i < zgfFcsj1.size(); i++) {
1225 1237 if(i==0){
1226 1238 fcsjx =zgfFcsj1.get(i);
... ... @@ -1228,30 +1240,43 @@ public class ReportServiceImpl implements ReportService{
1228 1240 cjs.add(zgfFcsj1.get(i)-fcsjx);
1229 1241 fcsjx =zgfFcsj1.get(i);
1230 1242 }
1231   -
  1243 +
1232 1244 }
1233 1245 Collections.sort(cjs);
1234 1246 for(int i : cjs){
1235 1247 zcj += i;
1236 1248 }
1237   -
  1249 + double sxtszgf=0.0;
  1250 + double sxsjzgf=0.0;
  1251 + if(sxcountZgfbc>0){
  1252 + sxtszgf=Arith.div(tzsxZgf, sxcountZgfbc, 1);
  1253 + sxsjzgf =Arith.div(yysxZgf, sxcountZgfbc, 1);
  1254 + }
  1255 +
  1256 + double xxtszgf=0.0;
  1257 + double xxsjzgf=0.0;
  1258 + if(xxcountZgfbc>0){
  1259 + xxtszgf=Arith.div(tzxxZgf, xxcountZgfbc, 1);
  1260 + xxsjzgf=Arith.div(yyxxZgf, xxcountZgfbc,1);
  1261 + }
  1262 +
  1263 +
1238 1264 tempMap = new HashMap<String, Object>();
1239 1265 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()));
  1266 + tempMap.put("sxsj", sxsjzgf);
  1267 + tempMap.put("xxsj", xxsjzgf);
  1268 + tempMap.put("sxtssj", sxtszgf);
  1269 + tempMap.put("xxtssj", xxtszgf);
  1270 + tempMap.put("fqsj", Arith.add(Arith.add(sxtszgf, sxsjzgf), Arith.add(xxtszgf, xxsjzgf)));
1246 1271 tempMap.put("cjqj", cjs.size()>0?cjs.get(0)+"——"+cjs.get(cjs.size()-1):"——");
1247 1272 tempMap.put("pjcj", cjs.size()>0?zcj/cjs.size():"/");
1248 1273 newList.add(tempMap);
1249 1274 //----------------------------------------------中午
1250 1275 cjs = new ArrayList<Integer>();
1251 1276 zcj =0;
1252   -
  1277 +
1253 1278 Collections.sort(zwFcsj0);
1254   - fcsjs=0;
  1279 + fcsjs=0;
1255 1280 for (int i = 0; i < zwFcsj0.size(); i++) {
1256 1281 if(i==0){
1257 1282 fcsjs =zwFcsj0.get(i);
... ... @@ -1259,10 +1284,10 @@ public class ReportServiceImpl implements ReportService{
1259 1284 cjs.add(zwFcsj0.get(i)-fcsjs);
1260 1285 fcsjs=zwFcsj0.get(i);
1261 1286 }
1262   -
  1287 +
1263 1288 }
1264 1289 Collections.sort(zwFcsj1);
1265   - fcsjx=0;
  1290 + fcsjx=0;
1266 1291 for (int i = 0; i < zwFcsj1.size(); i++) {
1267 1292 if(i==0){
1268 1293 fcsjx =zwFcsj1.get(i);
... ... @@ -1270,30 +1295,41 @@ public class ReportServiceImpl implements ReportService{
1270 1295 cjs.add(zwFcsj1.get(i)-fcsjx);
1271 1296 fcsjx =zwFcsj1.get(i);
1272 1297 }
1273   -
  1298 +
1274 1299 }
1275 1300 Collections.sort(cjs);
1276 1301 for(int i : cjs){
1277 1302 zcj += i;
1278 1303 }
1279   -
  1304 + double sxtzsjzw=0.0;
  1305 + double sxsjsjzw=0.0;
  1306 + if(sxcountZwbc>0){
  1307 + sxtzsjzw=Arith.div(tzsxZw, sxcountZwbc, 1);
  1308 + sxsjsjzw=Arith.div(yysxZw, sxcountZwbc,1);
  1309 + }
  1310 +
  1311 + double xxtzsjzw=0.0;
  1312 + double xxsjsjzw=0.0;
  1313 + if(xxcountZwbc>0){
  1314 + xxtzsjzw=Arith.div(tzxxZw, xxcountZwbc,1);
  1315 + xxsjsjzw=Arith.div(yyxxZw, xxcountZwbc, 1);
  1316 + }
1280 1317 tempMap = new HashMap<String, Object>();
1281 1318 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()));
  1319 + tempMap.put("sxsj", sxsjsjzw);
  1320 + tempMap.put("xxsj", xxsjsjzw);
  1321 + tempMap.put("sxtssj", sxtzsjzw);
  1322 + tempMap.put("xxtssj", xxtzsjzw);
  1323 + tempMap.put("fqsj", Arith.add(Arith.add(sxtzsjzw, sxsjsjzw), Arith.add(xxtzsjzw, xxsjsjzw)));
1288 1324 tempMap.put("cjqj", cjs.size()>0?cjs.get(0)+"——"+cjs.get(cjs.size()-1):"——");
1289 1325 tempMap.put("pjcj", cjs.size()>0?zcj/cjs.size():"/");
1290 1326 newList.add(tempMap);
1291 1327 //-------------------------------------------------晚高峰
1292 1328 cjs = new ArrayList<Integer>();
1293 1329 zcj =0;
1294   -
  1330 +
1295 1331 Collections.sort(wgfFcsj0);
1296   - fcsjs=0;
  1332 + fcsjs=0;
1297 1333 for (int i = 0; i < wgfFcsj0.size(); i++) {
1298 1334 if(i==0){
1299 1335 fcsjs =wgfFcsj0.get(i);
... ... @@ -1301,10 +1337,10 @@ public class ReportServiceImpl implements ReportService{
1301 1337 cjs.add(wgfFcsj0.get(i)-fcsjs);
1302 1338 fcsjs=wgfFcsj0.get(i);
1303 1339 }
1304   -
  1340 +
1305 1341 }
1306 1342 Collections.sort(wgfFcsj1);
1307   - fcsjx=0;
  1343 + fcsjx=0;
1308 1344 for (int i = 0; i < wgfFcsj1.size(); i++) {
1309 1345 if(i==0){
1310 1346 fcsjx =wgfFcsj1.get(i);
... ... @@ -1312,31 +1348,44 @@ public class ReportServiceImpl implements ReportService{
1312 1348 cjs.add(wgfFcsj1.get(i)-fcsjx);
1313 1349 fcsjx =wgfFcsj1.get(i);
1314 1350 }
1315   -
  1351 +
1316 1352 }
1317 1353 Collections.sort(cjs);
1318 1354 for(int i : cjs){
1319 1355 zcj += i;
1320 1356 }
1321   -
  1357 +
  1358 + double sxtzsjwgf=0.0;
  1359 + double sxsjsjwgf=0.0;
  1360 + if(sxcountWgfbc>0){
  1361 + sxtzsjwgf=Arith.div(tzsxWgf, sxcountWgfbc, 1);
  1362 + sxsjsjwgf=Arith.div(yysxWgf, sxcountWgfbc,1);
  1363 + }
  1364 +
  1365 + double xxtzsjwgf=0.0;
  1366 + double xxsjsjwgf=0.0;
  1367 + if(xxcountWgfbc>0){
  1368 + xxtzsjwgf=Arith.div(tzxxWgf, xxcountWgfbc, 1);
  1369 + xxsjsjwgf=Arith.div(yyxxWgf, xxcountWgfbc,1);
  1370 + }
  1371 +
1322 1372 tempMap = new HashMap<String, Object>();
1323 1373 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()));
  1374 + tempMap.put("sxsj", sxsjsjwgf);
  1375 + tempMap.put("xxsj", xxsjsjwgf);
  1376 + tempMap.put("sxtssj", sxtzsjwgf);
  1377 + tempMap.put("xxtssj", xxtzsjwgf);
  1378 + tempMap.put("fqsj", Arith.add(Arith.add(sxsjsjwgf, sxtzsjwgf), Arith.add(xxsjsjwgf, xxtzsjwgf)));
1330 1379 tempMap.put("cjqj", cjs.size()>0?cjs.get(0)+"——"+cjs.get(cjs.size()-1):"——");
1331 1380 tempMap.put("pjcj", cjs.size()>0?zcj/cjs.size():"/");
1332 1381 newList.add(tempMap);
1333   -
  1382 +
1334 1383 //----------------------------------晚后
1335 1384 cjs = new ArrayList<Integer>();
1336 1385 zcj =0;
1337   -
  1386 +
1338 1387 Collections.sort(whFcsj0);
1339   - fcsjs=0;
  1388 + fcsjs=0;
1340 1389 for (int i = 0; i < whFcsj0.size(); i++) {
1341 1390 if(i==0){
1342 1391 fcsjs =whFcsj0.get(i);
... ... @@ -1344,10 +1393,10 @@ public class ReportServiceImpl implements ReportService{
1344 1393 cjs.add(whFcsj0.get(i)-fcsjs);
1345 1394 fcsjs=whFcsj0.get(i);
1346 1395 }
1347   -
  1396 +
1348 1397 }
1349 1398 Collections.sort(whFcsj1);
1350   - fcsjx=0;
  1399 + fcsjx=0;
1351 1400 for (int i = 0; i < whFcsj1.size(); i++) {
1352 1401 if(i==0){
1353 1402 fcsjx =whFcsj1.get(i);
... ... @@ -1355,21 +1404,32 @@ public class ReportServiceImpl implements ReportService{
1355 1404 cjs.add(whFcsj1.get(i)-fcsjx);
1356 1405 fcsjx =whFcsj1.get(i);
1357 1406 }
1358   -
  1407 +
1359 1408 }
1360 1409 Collections.sort(cjs);
1361 1410 for(int i : cjs){
1362 1411 zcj += i;
1363 1412 }
1364   -
  1413 + double sxtzsjwh=0.0;
  1414 + double sxsjsjwh=0.0;
  1415 + if(sxcountWhbc>0){
  1416 + sxtzsjwh=Arith.div(tzsxWh,sxcountWhbc,1);
  1417 + sxsjsjwh=Arith.div(yysxWh, sxcountWhbc,1);
  1418 + }
  1419 +
  1420 + double xxtzsjwh=0.0;
  1421 + double xxsjsjwh=0.0;
  1422 + if(xxcountWhbc>0){
  1423 + xxtzsjwh=Arith.div(tzxxWh, xxcountWhbc,1);
  1424 + xxsjsjwh=Arith.div(yyxxWh, xxcountWhbc, 1);
  1425 + }
1365 1426 tempMap = new HashMap<String, Object>();
1366 1427 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()));
  1428 + tempMap.put("sxsj", sxsjsjwh);
  1429 + tempMap.put("xxsj", xxsjsjwh);
  1430 + tempMap.put("sxtssj", sxtzsjwh);
  1431 + tempMap.put("xxtssj", xxtzsjwh);
  1432 + tempMap.put("fqsj", Arith.add(Arith.add(sxsjsjwh, sxtzsjwh), Arith.add(xxsjsjwh,xxtzsjwh)));
1373 1433 tempMap.put("cjqj", cjs.size()>0?cjs.get(0)+"——"+cjs.get(cjs.size()-1):"——");
1374 1434 tempMap.put("pjcj", cjs.size()>0?zcj/cjs.size():"/");
1375 1435 newList.add(tempMap);
... ... @@ -1398,7 +1458,7 @@ public class ReportServiceImpl implements ReportService{
1398 1458 keyMap.get("18:01——(末)").add(ttMap);
1399 1459 }
1400 1460 }
1401   -
  1461 +
1402 1462 for(String key : keyMap.keySet()){
1403 1463 Map<String, Object> tempMap = new HashMap<String, Object>();
1404 1464 List<Map<String, Object>> list2 = keyMap.get(key);
... ... @@ -1417,7 +1477,7 @@ public class ReportServiceImpl implements ReportService{
1417 1477 }else{
1418 1478 String[] split = m.get("fcsj").toString().split(":");
1419 1479 int fcsj = Integer.valueOf(split[0])*60 + Integer.valueOf(split[1]);
1420   -
  1480 +
1421 1481 int xlDir = Integer.valueOf(m.get("dir").toString());
1422 1482 int bcsj = Integer.valueOf(m.get("bcsj").toString());
1423 1483 if(temp >= fcsj){
... ... @@ -1438,17 +1498,17 @@ public class ReportServiceImpl implements ReportService{
1438 1498 }
1439 1499 }
1440 1500 lpname=m.get("lp").toString();
1441   -
  1501 +
1442 1502 }
1443 1503 sxtsbc++;
1444 1504 }
1445   -
  1505 +
1446 1506 } else {
1447   -
  1507 +
1448 1508 fcsj_x.add(fcsj);
1449 1509 xxsj += bcsj;
1450 1510 xxbc ++;
1451   -
  1511 +
1452 1512 if(!ists){
1453 1513 if(lpname.equals("")){
1454 1514 lpname=m.get("lp").toString();
... ... @@ -1462,7 +1522,7 @@ public class ReportServiceImpl implements ReportService{
1462 1522 }
1463 1523 xxtsbc++;
1464 1524 }
1465   -
  1525 +
1466 1526 }
1467 1527 if(temp < fcsj){
1468 1528 cjs.add(fcsj - temp);
... ... @@ -1484,7 +1544,7 @@ public class ReportServiceImpl implements ReportService{
1484 1544 cjs.add(fcsj_s.get(i)-fcsjs);
1485 1545 fcsjs=fcsj_s.get(i);
1486 1546 }
1487   -
  1547 +
1488 1548 }
1489 1549 Collections.sort(fcsj_x);
1490 1550 int fcsjx=0;
... ... @@ -1495,7 +1555,7 @@ public class ReportServiceImpl implements ReportService{
1495 1555 cjs.add(fcsj_x.get(i)-fcsjx);
1496 1556 fcsjx =fcsj_x.get(i);
1497 1557 }
1498   -
  1558 +
1499 1559 }
1500 1560 Collections.sort(cjs);
1501 1561 for(int i : cjs){
... ... @@ -1517,7 +1577,7 @@ public class ReportServiceImpl implements ReportService{
1517 1577 newList.add(maps.get("8:31——16:00"));
1518 1578 newList.add(maps.get("16:01——18:00"));
1519 1579 newList.add(maps.get("18:01——(末)"));*/
1520   -
  1580 +
1521 1581 return newList;
1522 1582 }
1523 1583 @Override
... ... @@ -1533,27 +1593,27 @@ public class ReportServiceImpl implements ReportService{
1533 1593 sql += " and cl.line_code = '"+line+"'";
1534 1594 }
1535 1595 sql += " order by tt.create_date desc";
1536   -
  1596 +
1537 1597 list = jdbcTemplate.query(sql,
1538 1598 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   - });
  1599 + @Override
  1600 + public Map<String, Object> mapRow(ResultSet rs, int rowNum) throws SQLException {
  1601 + Map<String, Object> map = new HashMap<String, Object>();
  1602 + map.put("id", rs.getString("id"));
  1603 + map.put("name", rs.getString("name"));
  1604 + return map;
  1605 + }
  1606 + });
1547 1607 }catch (Exception e) {
1548 1608 // TODO Auto-generated catch block
1549 1609 e.printStackTrace();
1550 1610 }
1551 1611 return list;
1552 1612 }
1553   -
  1613 +
1554 1614 private List<ScheduleRealInfo> getListSinfo(Map<String, Object> map){
1555 1615 List<ScheduleRealInfo> list =new ArrayList<ScheduleRealInfo>();
1556   -
  1616 +
1557 1617 String sql="select DISTINCT a.* from (select * from bsth_c_s_sp_info_real where 1=1 ";
1558 1618 if(map.get("date")!=null){
1559 1619 sql += " and schedule_date_str='"+map.get("date").toString()+"'";
... ... @@ -1562,70 +1622,70 @@ public class ReportServiceImpl implements ReportService{
1562 1622 if(map.get("line").toString()!=""){
1563 1623 sql += " and xl_bm='"+map.get("line").toString()+"'";
1564 1624 }
1565   -
  1625 +
1566 1626 }
1567 1627 if(map.get("bcType")!=null){
1568 1628 if(map.get("bcType").toString().equals("inout")){
1569 1629 sql += " and bc_type in ('in','out')";
1570 1630 }
1571   -
  1631 +
1572 1632 if(map.get("bcType").toString().equals("normal")){
1573 1633 sql += " and bc_type not in ('in','out')";
1574 1634 }
1575 1635 }
1576   -
  1636 +
1577 1637 sql += " )a left join bsth_c_s_child_task b on a.id=b.schedule";
1578 1638 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"));
  1639 + new RowMapper<ScheduleRealInfo>(){
  1640 + @Override
  1641 + public ScheduleRealInfo mapRow(ResultSet rs, int rowNum) throws SQLException {
  1642 + ScheduleRealInfo m=new ScheduleRealInfo();
  1643 + m.setId(rs.getLong("id"));
1584 1644 // m.setBcs();
1585 1645 // 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   -
  1646 + m.setClZbh(rs.getString("cl_zbh"));
  1647 + m.setFcsj(rs.getString("fcsj"));
  1648 + m.setFcsjActual(rs.getString("fcsj_actual"));
  1649 + m.setjGh(rs.getString("j_gh"));
  1650 + m.setjName(rs.getString("j_name"));
  1651 + m.setJhlc(rs.getDouble("jhlc"));
  1652 + m.setLpName(rs.getString("lp_name"));
  1653 + m.setQdzCode(rs.getString("qdz_code"));
  1654 + m.setQdzName(rs.getString("qdz_name"));
  1655 + m.setRealExecDate(rs.getString("real_exec_date"));
  1656 + m.setRealMileage(rs.getDouble("real_mileage"));
  1657 + m.setRemarks(rs.getString("remarks"));
  1658 + m.setsGh(rs.getString("s_gh"));
  1659 + m.setsName(rs.getString("s_name"));
  1660 + m.setScheduleDate(rs.getDate("schedule_date"));
  1661 + m.setScheduleDateStr(rs.getString("schedule_date_str"));
  1662 + m.setSflj(rs.getBoolean("sflj"));
  1663 + m.setSpId(rs.getLong("sp_id"));
  1664 + m.setStatus(rs.getInt("status"));
  1665 + m.setXlBm(rs.getString("xl_bm"));
  1666 + m.setXlDir(rs.getString("xl_dir"));
  1667 + m.setXlName(rs.getString("xl_name"));
  1668 + m.setZdsj(rs.getString("zdsj"));
  1669 + m.setZdsjActual(rs.getString("zdsj_actual"));
  1670 + m.setZdzCode(rs.getString("zdz_code"));
  1671 + m.setZdzName(rs.getString("zdz_name"));
  1672 + m.setCcno(rs.getInt("ccno"));
  1673 + m.setDfAuto(rs.getBoolean("df_auto"));
  1674 + m.setFgsBm(rs.getString("fgs_bm"));
  1675 + m.setFgsName(rs.getString("fgs_name"));
  1676 + m.setGsBm(rs.getString("gs_bm"));
  1677 + m.setGsName(rs.getString("gs_name"));
  1678 + m.setOnline(rs.getBoolean("online"));
  1679 + m.setAdjustExps(rs.getString("adjust_exps"));
  1680 + m.setReissue(rs.getBoolean("reissue"));
  1681 + m.setJhlcOrig(rs.getDouble("jhlc_orig"));
  1682 + return m;
  1683 + }
  1684 + });
  1685 +
1626 1686 return list;
1627 1687 }
1628   -
  1688 +
1629 1689 @Override
1630 1690 public List<Map<String, Object>> jobFwqk(Map<String, Object> map) {
1631 1691 // TODO Auto-generated method stub
... ... @@ -1637,7 +1697,7 @@ public class ReportServiceImpl implements ReportService{
1637 1697 List<ScheduleRealInfo> sList=scheduleRealInfoRepository.scheduleByDateAndLineTjrb(line, date);
1638 1698 for (int i = 0; i < sList.size(); i++) {
1639 1699 ScheduleRealInfo scheduleRealInfo = sList.get(i);
1640   - if (!(scheduleRealInfo.getBcType().equals("in")
  1700 + if (!(scheduleRealInfo.getBcType().equals("in")
1641 1701 || scheduleRealInfo.getBcType().equals("out")
1642 1702 ||scheduleRealInfo.getBcType().equals("ldks"))) {
1643 1703 Set<ChildTaskPlan> childTaskPlans = scheduleRealInfo.getcTasks();
... ... @@ -1695,43 +1755,43 @@ public class ReportServiceImpl implements ReportService{
1695 1755 }
1696 1756 }
1697 1757 }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   -
  1758 + while (it.hasNext()) {
  1759 + ChildTaskPlan childTaskPlan = it.next();
  1760 + if (childTaskPlan.isDestroy()) {
  1761 + String destroyReason = "";
  1762 + if ( childTaskPlan.getDestroyReason() == null) {
  1763 + destroyReason = "其他";
  1764 + }else if(childTaskPlan.getDestroyReason().equals("")){
  1765 + destroyReason = "其他";
  1766 + } else {
  1767 + destroyReason = childTaskPlan.getDestroyReason();
1722 1768 }
  1769 + Map<String, Object> newMap = new HashMap<String, Object>();
  1770 + newMap.put("nr", destroyReason);
  1771 + newMap.put("lp", scheduleRealInfo.getLpName());
  1772 + newMap.put("nbbm", scheduleRealInfo.getClZbh());
  1773 + newMap.put("jgh", scheduleRealInfo.getjGh());
  1774 + newMap.put("dz", childTaskPlan.getStartStationName());
  1775 + newMap.put("sj", childTaskPlan.getStartDate());
  1776 + newMap.put("gzf", " ");
  1777 + newMap.put("lbbc", 0);
  1778 + newMap.put("lblc", childTaskPlan.getMileage());
  1779 + newMap.put("jyqp", childTaskPlan.getRemarks());
  1780 + list.add(newMap);
  1781 +
1723 1782 }
  1783 + }
1724 1784 // }
1725   -
  1785 +
1726 1786 }
1727 1787 }
1728 1788 }
1729   - List<Map<String, Object>> listNew=new ArrayList<Map<String,Object>>();
  1789 + List<Map<String, Object>> listNew=new ArrayList<Map<String,Object>>();
1730 1790 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++) {
  1791 + String lx=lblxs[i];
  1792 + double lblc=0.0;
  1793 + int lbbc=0;
  1794 + for (int j = 0; j < list.size(); j++) {
1735 1795 Map<String, Object> m1=list.get(j);
1736 1796 if(lx.equals(m1.get("nr").toString())){
1737 1797 m1.put("lx", 0);
... ... @@ -1740,1434 +1800,1434 @@ public class ReportServiceImpl implements ReportService{
1740 1800 lbbc += Integer.parseInt(m1.get("lbbc").toString());
1741 1801 }
1742 1802 }
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   -
  1803 + if(lblc>0){
  1804 + Map<String, Object> newMap = new HashMap<String, Object>();
  1805 + newMap.put("lx", 1);
  1806 + newMap.put("nr", lx);
  1807 + newMap.put("lp", "小计");
  1808 + newMap.put("nbbm", "少驶班次");
  1809 + newMap.put("jgh", lbbc);
  1810 + newMap.put("lbbc", "少驶公里");
  1811 + newMap.put("lblc", lblc);
  1812 + newMap.put("dz", " ");
  1813 + newMap.put("sj", " ");
  1814 + newMap.put("gzf", " ");
  1815 + newMap.put("jyqp"," ");
  1816 + listNew.add(newMap);
  1817 + }
  1818 +
  1819 +
1760 1820 }
1761 1821 Collections.sort(listNew, new ComparableJob());
1762 1822 return listNew;
1763 1823 }
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"))) {
  1824 +
  1825 + //统计临加班次详细信息
  1826 + @Override
  1827 + public List<Map<String, Object>> jobLjqk(Map<String, Object> map) {
  1828 + // TODO Auto-generated method stub
  1829 + String line=map.get("line").toString();
  1830 + String date=map.get("date").toString();
  1831 + map.put("bcType", "normal");
  1832 + List<Map<String, Object>> list=new ArrayList<Map<String,Object>>();
  1833 + List<ScheduleRealInfo> sList=scheduleRealInfoRepository.scheduleByDateAndLineTjrb(line, date);
  1834 + for (int i = 0; i < sList.size(); i++) {
  1835 + ScheduleRealInfo scheduleRealInfo=sList.get(i);
  1836 + if (!(scheduleRealInfo.getBcType().equals("in")
  1837 + || scheduleRealInfo.getBcType().equals("out")
  1838 + || scheduleRealInfo.getBcType().equals("ldks"))) {
1779 1839 // Set<ChildTaskPlan> childTaskPlans = scheduleRealInfo.getcTasks();
1780 1840 // 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   - }
  1841 + if(scheduleRealInfo.isSflj()){
  1842 + Map<String, Object> newMap=new HashMap<String,Object>();
  1843 + newMap.put("lp", scheduleRealInfo.getLpName());
  1844 + newMap.put("nbbm", scheduleRealInfo.getClZbh());
  1845 + newMap.put("jgh", scheduleRealInfo.getjGh());
  1846 + newMap.put("dz", scheduleRealInfo.getQdzName());
  1847 + newMap.put("sj", scheduleRealInfo.getFcsj());
  1848 + newMap.put("ljlc", scheduleRealInfo.getJhlc()==null?0:scheduleRealInfo.getJhlc());
  1849 + newMap.put("jyqp", scheduleRealInfo.getRealMileage()==null?"":scheduleRealInfo.getRealMileage());
  1850 + list.add(newMap);
  1851 + }
1792 1852 // }else{
1793 1853 // Iterator<ChildTaskPlan> it = childTaskPlans.iterator();
1794 1854 // while (it.hasNext()) {
1795 1855 // ChildTaskPlan childTaskPlan = it.next();
1796 1856 // if (childTaskPlan.isDestroy()) {
1797   -// }
  1857 +// }
1798 1858 // }
1799 1859 // }
  1860 + }
  1861 + }
  1862 + return list;
  1863 + }
  1864 +
  1865 + public static double culateCJLC2(List<ScheduleRealInfo> list, String item) {
  1866 + // TODO Auto-generated method stub
  1867 + double sum = 0;
  1868 + Set<ChildTaskPlan> cts;
  1869 + for(ScheduleRealInfo sch : list){
  1870 + if (sch.isSflj())
  1871 + continue;
  1872 + cts = sch.getcTasks();
  1873 + //有子任务
  1874 + if (cts != null && cts.size() > 0) {
  1875 + for(ChildTaskPlan c : cts){
  1876 + if(c.isDestroy() && c.getDestroyReason().equals(item))
  1877 + sum = Arith.add(sum, c.getMileage());
1800 1878 }
1801 1879 }
1802   - return list;
1803   - }
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   - }
1820 1880 // else if(isInOut(sch))
1821 1881 // 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;
1937   - }
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();
  1882 + //主任务烂班
  1883 + else if(sch.getStatus() == -1){
  1884 + if(sch.getAdjustExps().equals(item) ||
  1885 + (StringUtils.isEmpty(sch.getAdjustExps()) && item.equals("其他"))){
  1886 + sum = Arith.add(sum, sch.getJhlcOrig());
  1887 + }
  1888 + }
  1889 + else if(item.equals("其他")){
  1890 + double diff = Arith.sub(sch.getJhlcOrig(), sch.getJhlc());
  1891 + if(diff > 0){
  1892 + sum = Arith.add(sum, diff);
  1893 + }
  1894 + }
  1895 + }
  1896 + return sum;
  1897 +
  1898 + }
  1899 + @Override
  1900 + public Map<String, Object> jobHzxx(Map<String, Object> map) {
  1901 + // TODO Auto-generated method stub
  1902 + String line="";
  1903 + if(map.get("line")!=null){
  1904 + line=map.get("line").toString();
  1905 + }
  1906 + String date="";
  1907 + if(map.get("date")!=null){
  1908 + date=map.get("date").toString();
  1909 + }
  1910 +
  1911 + List<ScheduleRealInfo> sList=scheduleRealInfoRepository.scheduleByDateAndLineTjrb(line, date);
  1912 + Map<String, Object> newMap=new HashMap<String,Object>();
  1913 + newMap.put("jhbc", culateService.culateJhbc(sList,""));
  1914 + newMap.put("jhgl", culateService.culateJhgl(sList));
  1915 + newMap.put("sjbc", culateService.culateSjbc(sList,""));
  1916 + newMap.put("sjgl", culateService.culateSjgl(sList));
  1917 + newMap.put("lbgl", culateService.culateLbgl(sList));
  1918 + newMap.put("lbbc", culateService.culateLbbc(sList));
  1919 + newMap.put("ljgl", culateService.culateLjgl(sList));
  1920 + newMap.put("ljbc", culateService.culateLjbc(sList,""));
  1921 + newMap.put("ksgl", culateService.culateKsgl(sList));
  1922 + return newMap;
  1923 + }
  1924 + @Override
  1925 + public List<Map<String, Object>> lineList() {
  1926 + // TODO Auto-generated method stub
  1927 + List<Map<String, Object>> list=new ArrayList<Map<String,Object>>();
  1928 + Iterator<Line> iterator = lineRepository.findAll().iterator();
  1929 + Line line;
  1930 + while (iterator.hasNext()) {
  1931 + line = iterator.next();
  1932 + Map<String, Object> map=new HashMap<String,Object>();
  1933 + map.put("gsbm", line.getCompany());
  1934 + map.put("fgsbm", line.getBrancheCompany());
  1935 + map.put("xlbm", line.getLineCode());
  1936 + map.put("xlname", line.getName());
  1937 + list.add(map);
  1938 + }
  1939 + return list;
  1940 + }
  1941 + @Override
  1942 + public List<Map<String, String>> carList(Map<String, Object> maps) {
  1943 + // TODO Auto-generated method stub
  1944 + // 转大写
  1945 + String nbbm =maps.get("nbbm").toString().toUpperCase();
  1946 + String gsbm="";
  1947 +
  1948 + if(maps.get("gsbm")!=null)
  1949 + gsbm= maps.get("gsbm").toString().trim();
1948 1950 // 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;
1980   - }
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;
2015   - }
2016   - });
  1951 + String xlbm=maps.get("xlbm").toString().trim();
  1952 + List<Map<String, String>> list = new ArrayList<Map<String, String>>();
  1953 + Map<String, String> map;
  1954 + Set<String> allSet = BasicData.nbbm2CompanyCodeMap.keySet();
2017 1955  
2018   - } catch (ParseException e1) {
2019   - // TODO Auto-generated catch block
2020   - e1.printStackTrace();
2021   - }
2022   - return list;
2023   -
2024   - }
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();
2041   - }
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);
  1956 + Line line;
  1957 + for (String k : allSet) {
  1958 + if (k.indexOf(nbbm) != -1) {
  1959 + // 所属线路
  1960 + boolean fage=true;
  1961 + map = new HashMap<>();
  1962 + line = BasicData.nbbm2LineMap.get(k);
  1963 + String clgsdm= BasicData.nbbm2CompanyCodeMap.get(k);
  1964 +
  1965 + map.put("id", k);
  1966 + map.put("text", k);
  1967 + if (null != line) {
  1968 + map.put("lineName", line.getName());
  1969 + map.put("lineCode", line.getLineCode());
2066 1970 }
2067   - return list;
2068   - }
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);
  1971 +
  1972 + if(!xlbm.equals("")){
  1973 + if(null!=line){
  1974 + if(!line.getLineCode().equals(xlbm)){
  1975 + fage=false;
2109 1976 }
2110 1977 }
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   - }
2124   - }
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"));
  1978 +
  1979 + }
  1980 +
  1981 + if(!gsbm.equals("")){
  1982 + if(!clgsdm.equals(gsbm)){
  1983 + fage=false;
2130 1984 }
2131   - inoutList.add(map2);
2132   - } catch (ParseException e) {
2133   - // TODO Auto-generated catch block
2134   - e.printStackTrace();
2135 1985 }
  1986 +
  1987 + if(fage){
  1988 + list.add(map);
  1989 + }
  1990 +
2136 1991 }
2137   - return inoutList;
  1992 +
  1993 + if (list.size() > 20)
  1994 + break;
2138 1995 }
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);
2166   -
2167   - /*for (int j = 0; j < listStation.size(); j++) {
2168   - map2=new HashMap<String,Object>();
2169   - StationRoute s=listStation.get(j);
2170   - List<ArrivalInfo> arrivalList=new ArrayList<ArrivalInfo>();
2171   - for (int j2 = 0; j2 < arrInfoList.size(); j2++) {
  1996 + return list;
  1997 + }
  1998 +
  1999 +
  2000 + @Override
  2001 + public List<Map<String, String>> userList(Map<String, Object> maps) {
  2002 + // TODO Auto-generated method stub
  2003 + // 转大写
  2004 + String jsy =maps.get("jsy").toString().toUpperCase();
  2005 + String gsbm="";
  2006 + if(maps.get("gsbm")!=null)
  2007 + gsbm=maps.get("gsbm").toString().trim();
  2008 +// String fgsbm=maps.get("fgsbm").toString().trim();
  2009 + List<Map<String, String>> list = new ArrayList<Map<String, String>>();
  2010 + Map<String, String> map;
  2011 +// Set<String> allSet = BasicData.nbbm2CompanyCodeMap.keySet();
  2012 + Set<String> allJsy = BasicData.perMap.keySet();
  2013 +
  2014 + Personnel per;
  2015 + for (String k : allJsy) {
  2016 + if (k.indexOf(jsy) != -1) {
  2017 + map = new HashMap<>();
  2018 + // 通过人员查找公司
  2019 + per = BasicData.perMap.get(k);
  2020 + String rygsdm="";
  2021 + if(null != per){
  2022 + if(per.getCompanyCode()!=null){
  2023 + rygsdm = per.getCompanyCode();
  2024 + }
  2025 + String jboCode=per.getJobCode().substring(per.getJobCode().indexOf("-")+1);
  2026 + map.put("id", jboCode);
  2027 + map.put("text", jboCode+"/"+per.getPersonnelName());
  2028 + if(!gsbm.equals("")){
  2029 + if(rygsdm.equals(gsbm)){
  2030 + list.add(map);
  2031 + }
  2032 + }
  2033 + }
  2034 + }
  2035 +
  2036 + if (list.size() > 20)
  2037 + break;
  2038 + }
  2039 + return list;
  2040 + }
  2041 +
  2042 + public List<ArrivalInfo> load4(String line, String date, int zd,String minfcsj){
  2043 + SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
  2044 + SimpleDateFormat sdf = new SimpleDateFormat("HH:mm:ss");
  2045 + Long date1=0L;
  2046 + Long date2=0L;
  2047 + Calendar cal = Calendar.getInstance();
  2048 + List<ArrivalInfo> list=null;
  2049 + try {
  2050 + Date dates1 = simpleDateFormat.parse(date+" "+minfcsj+":01");
  2051 + String d1=date+" "+minfcsj+":01";
  2052 +// Date dates2=simpleDateFormat.parse(date+" 23:59:59");
  2053 + date1=dates1.getTime();
  2054 +// date2=dates2.getTime();
  2055 + cal.setTime(dates1);
  2056 + int weeks_year1 = cal.get(Calendar.WEEK_OF_YEAR);
  2057 + cal.add(cal.DATE,1);//把日期往后增加一天.整数往后推,负数往前移动
  2058 + int weeks_year2 = cal.get(Calendar.WEEK_OF_YEAR);
  2059 + Date dates2=cal.getTime();
  2060 + String d2=simpleDateFormat.format(dates2);
  2061 + String sql="select *,UNIX_TIMESTAMP(times) as ts from bsth_c_arrival_info where times >= '"+d1 +"'and "
  2062 + + " times <='"+d2+"' and line_id = '"+line+"' and up_down = '"+zd+"'"
  2063 + + " order by device_id,times";
  2064 +
  2065 + list =jdbcTemplate.query(sql, new RowMapper<ArrivalInfo>() {
  2066 + @Override
  2067 + public ArrivalInfo mapRow(ResultSet arg0, int arg1) throws SQLException {
  2068 + ArrivalInfo ai=new ArrivalInfo();
  2069 + ai.setInOut(arg0.getInt("in_out"));
  2070 + ai.setDeviceId(arg0.getString("device_id"));
  2071 + ai.setStopNo(arg0.getString("stop_no"));
  2072 + ai.setDates(arg0.getDate("times"));
  2073 + ai.setTs(arg0.getLong("ts")*1000);
  2074 + return ai;
  2075 + }
  2076 + });
  2077 +
  2078 + } catch (ParseException e1) {
  2079 + // TODO Auto-generated catch block
  2080 + e1.printStackTrace();
  2081 + }
  2082 + return list;
  2083 +
  2084 + }
  2085 +
  2086 + public List<ArrivalInfo> load3(String line, String date, int zd){
  2087 + SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
  2088 + SimpleDateFormat sdf = new SimpleDateFormat("HH:mm:ss");
  2089 + Long date1=0L;
  2090 + Long date2=0L;
  2091 + Calendar cal = Calendar.getInstance();
  2092 + try {
  2093 + Date dates1 = simpleDateFormat.parse(date+" 00:00:01");
  2094 + Date dates2=simpleDateFormat.parse(date+" 23:59:59");
  2095 + date1=dates1.getTime();
  2096 + date2=dates2.getTime();
  2097 + cal.setTime(dates1);
  2098 + } catch (ParseException e1) {
  2099 + // TODO Auto-generated catch block
  2100 + e1.printStackTrace();
  2101 + }
  2102 + //周数,表分区字段
  2103 + int weeks_year1 = cal.get(Calendar.WEEK_OF_YEAR);
  2104 + List<ArrivalInfo> list = null;
  2105 + Connection conn = null;
  2106 + PreparedStatement ps = null;
  2107 + ResultSet rs = null;
  2108 +
  2109 + String sql = "select * from bsth_c_arrival_info where line_id=? AND weeks_year=? "
  2110 + + " AND ts >= ? AND ts <=? AND up_down=? order by device_id,ts";
  2111 + try{
  2112 + conn = DBUtils_MS.getConnection();
  2113 + ps = conn.prepareStatement(sql);
  2114 + ps.setString(1, line);
  2115 + ps.setInt(2, weeks_year1);
  2116 + ps.setLong(3, date1);
  2117 + ps.setLong(4, date2);
  2118 + ps.setInt(5, zd);
  2119 + rs = ps.executeQuery();
  2120 +
  2121 + list = resultSet2Set(rs);
  2122 + }catch(Exception e){
  2123 + logger.error("", e);
  2124 + }finally {
  2125 + DBUtils_MS.close(rs, ps, conn);
  2126 + }
  2127 + return list;
  2128 + }
  2129 +
  2130 + //根据排班查到离站
  2131 + @Override
  2132 + public List<Map<String, Object>> queryInOutStrtion(String line, String date, int zd,String lzsj) {
  2133 + SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
  2134 + //查询线路所有的站点
  2135 + List<ArrivalInfo> arrInfoList=this.load3(line, date, zd);
  2136 + List<StationRoute> listStation= stationRouteRepository.findByLine(line,zd);
  2137 + List<Map<String, Object>> inoutList=new ArrayList<Map<String,Object>>();
  2138 + //保存的所以的站点信息
  2139 + Map<String, Object> map1=new HashMap<String,Object>();
  2140 + map1.put("bc", "");
  2141 + map1.put("nbbm", "");
  2142 +
  2143 + //所有的班次信息(实际排班排序)
  2144 + List<ScheduleRealInfo> realList= scheduleRealInfoRepository.scheduleByDateAndLineInOut(line, date,zd+"");
  2145 + for (int i = 0; i < listStation.size(); i++) {
  2146 + map1.put(listStation.get(i).getStationCode()+"in"
  2147 + , listStation.get(i).getStationName());
  2148 + map1.put(listStation.get(i).getStationCode()+"out"
  2149 + , (i+1));
  2150 + }
  2151 + inoutList.add(map1);
  2152 +
  2153 + for (int i = 0; i < realList.size(); i++) {
  2154 + ScheduleRealInfo sinfo=realList.get(i);
  2155 + String devuceId=BasicData.deviceId2NbbmMap.inverse().get(sinfo.getClZbh());
  2156 + String sjfcsj=sinfo.getRealExecDate()+" "+sinfo.getFcsjActual()+":00";
  2157 + String sjddsj=sinfo.getRealExecDate()+" "+sinfo.getZdsjActual()+":59";
  2158 +
  2159 + try {
  2160 + Date dates1 = simpleDateFormat.parse(sjfcsj);
  2161 + Date dates2=simpleDateFormat.parse(sjddsj);
  2162 + Long date1=dates1.getTime();
  2163 + Long date2=dates2.getTime();
  2164 + List<ArrivalInfo> arrList=new ArrayList<ArrivalInfo>();
  2165 + for (int j = 0; j < arrInfoList.size(); j++) {
  2166 + ArrivalInfo a=arrInfoList.get(j);
  2167 + if(a.getDeviceId().equals(devuceId) && a.getTs()>=date1 && a.getTs()<=date2){
  2168 + arrList.add(a);
  2169 + }
  2170 + }
  2171 +
  2172 + Map<String, Object> map2=new HashMap<String,Object>();
  2173 + map2.put("bc", (i+1));
  2174 + map2.put("nbbm", sinfo.getClZbh());
  2175 +
  2176 + for (int j = 0; j < listStation.size(); j++) {
  2177 + StationRoute s=listStation.get(j);
  2178 + List<ArrivalInfo> arrivalList=new ArrayList<ArrivalInfo>();
  2179 + for (int j2 = 0; j2 < arrList.size(); j2++) {
  2180 + ArrivalInfo a=arrList.get(j2);
  2181 + if(s.getStationCode().equals(a.getStopNo())){
  2182 + arrivalList.add(a);
  2183 + }
  2184 + }
  2185 + Map<String, String> m=this.strInOut(arrivalList,lzsj);
  2186 +
  2187 + map2.put(s.getStationCode()+"in", m.get("in"));
  2188 + map2.put(s.getStationCode()+"out", m.get("out"));
  2189 + map2.put(s.getStationCode(), m.get("type"));
  2190 + }
  2191 + inoutList.add(map2);
  2192 + } catch (ParseException e) {
  2193 + // TODO Auto-generated catch block
  2194 + e.printStackTrace();
  2195 + }
  2196 + }
  2197 + return inoutList;
  2198 + }
  2199 +
  2200 + //根据GPS查到离站
  2201 + @Override
  2202 + public List<Map<String, Object>> queryInOutStrtions(String line, String date, int zd,String lzsj) {
  2203 + SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
  2204 + String sqlMinYysj="select start_opt from bsth_c_line_config where "
  2205 + + " id = ("
  2206 + + "select max(id) from bsth_c_line_config where line ='"+BasicData.lineId2CodeMap.inverse().get(line) +"'"
  2207 + + ")";
  2208 + String minfcsj=jdbcTemplate.queryForObject(sqlMinYysj, String.class);
  2209 + List<ArrivalInfo> arrInfoList=this.load4(line, date, zd,minfcsj);
  2210 +
  2211 + //查询线路所有的站点
  2212 + List<StationRoute> listStation= stationRouteRepository.findByLine(line,zd);
  2213 + List<Map<String, Object>> inoutList=new ArrayList<Map<String,Object>>();
  2214 + //保存的所以的站点信息
  2215 + Map<String, Object> map1=new HashMap<String,Object>();
  2216 + map1.put("bc", "");
  2217 + map1.put("nbbm", "");
  2218 +
  2219 + for (int i = 0; i < listStation.size(); i++) {
  2220 + map1.put(listStation.get(i).getStationCode()+"in"
  2221 + , listStation.get(i).getStationName());
  2222 + map1.put(listStation.get(i).getStationCode()+"out"
  2223 + , (i+1));
  2224 + }
  2225 + inoutList.add(map1);
  2226 +
  2227 + /*for (int j = 0; j < listStation.size(); j++) {
  2228 + map2=new HashMap<String,Object>();
  2229 + StationRoute s=listStation.get(j);
  2230 + List<ArrivalInfo> arrivalList=new ArrayList<ArrivalInfo>();
  2231 + for (int j2 = 0; j2 < arrInfoList.size(); j2++) {
2172 2232 ArrivalInfo a=arrivalList.get(j2);
2173 2233 if(s.getStationCode().equals(a.getStopNo())){
2174 2234 arrivalList.add(a);
2175 2235 }
2176 2236 }
2177 2237 Map<String, String> m=this.strInOut(arrivalList,lzsj);
2178   -
  2238 +
2179 2239 map2.put(s.getStationCode()+"in", m.get("in"));
2180 2240 map2.put(s.getStationCode()+"out", m.get("out"));
2181 2241 map2.put(s.getStationCode(), m.get("type"));
2182 2242 }*/
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());
  2243 + List<String> list_nbbm=new ArrayList<String>();
  2244 + Map<String, Object> m=new HashMap<String,Object>();
  2245 + for (int i = 0; i < arrInfoList.size(); i++) {
  2246 + arrInfoList.get(i).setRoute(-1);
  2247 + for (int j = 0; j < listStation.size(); j++) {
  2248 + if(arrInfoList.get(i).getStopNo().equals(listStation.get(j).getStationCode())){
  2249 + arrInfoList.get(i).setRoute(listStation.get(j).getStationRouteCode());
  2250 +
2196 2251 }
2197 2252 }
  2253 + if(m.get(arrInfoList.get(i).getDeviceId())==null){
  2254 + m.put(arrInfoList.get(i).getDeviceId(), arrInfoList.get(i).getDeviceId());
  2255 + list_nbbm.add(arrInfoList.get(i).getDeviceId());
  2256 + }
  2257 + }
2198 2258  
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   - }
  2259 + Map<String, Object> map2=new HashMap<String, Object>();
  2260 + for (int i = 0; i < list_nbbm.size(); i++) {
  2261 + String nbbm=list_nbbm.get(i);
  2262 +
  2263 + int zdbm =0;
  2264 + int inout=-1;
  2265 + List<ArrivalInfo> arrivalList=new ArrayList<ArrivalInfo>();
  2266 + for (int j = 0; j < arrInfoList.size(); j++) {
  2267 + ArrivalInfo aif=arrInfoList.get(j);
  2268 +
  2269 + if(aif.getDeviceId().equals(nbbm)){
  2270 + map2.put("nbbm", BasicData.deviceId2NbbmMap.get(nbbm));
  2271 + if(aif.getRoute()>-1){
  2272 + if(((inout==aif.getInOut() && zdbm==aif.getRoute()) || !(zdbm ==aif.getRoute()))){
  2273 + if(aif.getRoute()<=zdbm ){
  2274 + inoutList.add(map2);
  2275 + map2=new HashMap<String, Object>();
  2276 + arrivalList=new ArrayList<ArrivalInfo>();
2218 2277 }
2219   - arrivalList.add(aif);
  2278 + }
  2279 + arrivalList.add(aif);
2220 2280 // 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"));
  2281 + Map<String, String> m_=this.strInOut(arrivalList,lzsj);
  2282 + map2.put(aif.getStopNo()+"in", m_.get("in"));
  2283 + map2.put(aif.getStopNo()+"out", m_.get("out"));
  2284 + map2.put(aif.getStopNo(), m_.get("type"));
2225 2285 // arrivalList=new ArrayList<ArrivalInfo>();
2226 2286 // }
2227   - zdbm =aif.getRoute();
2228   - inout=aif.getInOut();
2229   -
2230   - }
2231   -
  2287 + zdbm =aif.getRoute();
  2288 + inout=aif.getInOut();
  2289 +
2232 2290 }
2233   -
  2291 +
2234 2292 }
  2293 +
2235 2294 }
2236   -
2237   - return inoutList;
2238 2295 }
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   - }
  2296 +
  2297 + return inoutList;
  2298 + }
  2299 +
  2300 + public Map<String, String> strInOut(List<ArrivalInfo> lists,String lzsj){
  2301 + String inout="";
  2302 + SimpleDateFormat sdf = new SimpleDateFormat("HH:mm:ss");
  2303 + Long in=0L;
  2304 + Long out=0L;
  2305 + for(int i=0;i<lists.size();i++){
  2306 + ArrivalInfo t1=lists.get(i);
  2307 + if(t1.getInOut()==0){
  2308 + in=t1.getTs();
  2309 + t1.setJzsj(sdf.format(new Date(t1.getTs())));
  2310 + for(int j=0;j<lists.size();j++){
  2311 + ArrivalInfo t2=lists.get(j);
  2312 + if(t2.getInOut()==1 && t2.getDeviceId().equals(t1.getDeviceId())
  2313 + && t2.getStopNo().equals(t1.getStopNo())
  2314 + && t2.getTs()>t1.getTs()){
  2315 + t1.setCzsj(sdf.format(new Date(t2.getTs())));
  2316 + out =t2.getTs();
  2317 + break;
  2318 + }else{
  2319 + t1.setCzsj("");
  2320 + out =0l;
2262 2321 }
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   - }
  2322 + }
  2323 +
  2324 + }else{
  2325 + out =t1.getTs();
  2326 + t1.setCzsj(sdf.format(new Date(t1.getTs())));
  2327 + for(int j=0;j<lists.size();j++){
  2328 + ArrivalInfo t2=lists.get(j);
  2329 + if(t2.getInOut()==0 && t2.getDeviceId().equals(t1.getDeviceId())
  2330 + && t2.getStopNo().equals(t1.getStopNo())
  2331 + && t2.getTs()>t1.getTs()){
  2332 + in =t2.getTs();
  2333 + t1.setJzsj(sdf.format(new Date(t2.getTs())));
  2334 + break;
2276 2335 }
2277 2336 }
2278 2337 }
2279   -
2280   - Map<String, String> map=new HashMap<String,String>();
2281   - if(in>0 ){
2282   - map.put("in",sdf.format(new Date(in)));
2283   -
  2338 + }
  2339 +
  2340 + Map<String, String> map=new HashMap<String,String>();
  2341 + if(in>0 ){
  2342 + map.put("in",sdf.format(new Date(in)));
  2343 +
  2344 + }else{
  2345 + map.put("in", "");
  2346 + }
  2347 + if(out>0){
  2348 + map.put("out", sdf.format(new Date(out)));
  2349 + }else{
  2350 + map.put("out", "");
  2351 + }
  2352 + Long sj=1000000000L;
  2353 + if(!lzsj.trim().equals("")){
  2354 + sj =Long.parseLong(lzsj);
  2355 + }
  2356 + if(in>0 && out >0){
  2357 + if((out-in)/1000>sj){
  2358 + map.put("type", "y");
2284 2359 }else{
2285   - map.put("in", "");
  2360 + map.put("type", "n");
2286 2361 }
2287   - if(out>0){
2288   - map.put("out", sdf.format(new Date(out)));
  2362 + }
  2363 + return map;
  2364 + }
  2365 + @Override
  2366 + public List<StationRoute> queryStrinon(String line, int zd) {
  2367 + // TODO Auto-generated method stub
  2368 + List<StationRoute> listStation= stationRouteRepository.findByLine(line,zd);
  2369 + return listStation;
  2370 + }
  2371 + @Override
  2372 + public List<Map<String, Object>> countByList(Map<String, Object> map) {
  2373 + // TODO Auto-generated method stub
  2374 +
  2375 + List<Map<String, Object>> lMap = new ArrayList<Map<String, Object>>();
  2376 + String gsdm="";
  2377 + if(map.get("gsdm")!=null){
  2378 + gsdm=map.get("gsdm").toString();
  2379 + }
  2380 + String fgsdm="";
  2381 + if(map.get("fgsdm")!=null){
  2382 + fgsdm=map.get("fgsdm").toString();
  2383 + }
  2384 + String line="";
  2385 + if(map.get("line")!=null){
  2386 + line=map.get("line").toString();
  2387 + }
  2388 + String date="";
  2389 + if(map.get("date")!=null){
  2390 + date=map.get("date").toString();
  2391 + }
  2392 + String date2="";
  2393 + if(map.get("date2")!=null){
  2394 + date2=map.get("date2").toString();
  2395 + }
  2396 + String xlName="";
  2397 + if(map.get("xlName")!=null){
  2398 + xlName=map.get("xlName").toString();
  2399 + }
  2400 + String type="";
  2401 + if(map.get("type")!=null){
  2402 + type=map.get("type").toString();
  2403 + }
  2404 + //所有班次信息
  2405 + List<ScheduleRealInfo> list = new ArrayList<ScheduleRealInfo>();
  2406 + line =line.trim();
  2407 + if(line.equals("")){
  2408 + //查询所有线路
  2409 + list = scheduleRealInfoRepository.scheduleByDateAndLineTj(line, date,date2,gsdm,fgsdm);
  2410 + }else{
  2411 + //查询单条线路
  2412 + list = scheduleRealInfoRepository.scheduleByDateAndLineTj2(line, date,date2);
  2413 + }
  2414 +
  2415 + String sql="select r.xl_bm"
  2416 + + " from bsth_c_s_sp_info_real r where"
  2417 + + " r.schedule_date_str BETWEEN '"+date+"' and '"+date2+"'";
  2418 +
  2419 +
  2420 + if(line.equals("")){
  2421 + sql +="and r.gs_bm='"+gsdm+"' "
  2422 + + " and r.fgs_bm='"+fgsdm+"'";
  2423 + }else{
  2424 + sql += " and r.xl_bm = '"+line+"'";
  2425 + }
  2426 + sql += " group by r.xl_bm";
  2427 +
  2428 + List<String> listLine=jdbcTemplate.query(sql, new RowMapper<String>() {
  2429 + @Override
  2430 + public String mapRow(ResultSet arg0, int arg1) throws SQLException {
  2431 + String ve = arg0.getString("xl_bm");
  2432 + return ve;
  2433 + }
  2434 + });
  2435 + for (int i = 0; i < listLine.size(); i++) {
  2436 + List<ScheduleRealInfo> lists = new ArrayList<ScheduleRealInfo>();
  2437 + String lineStr=listLine.get(i);
  2438 + for (int j = 0; j < list.size(); j++) {
  2439 + ScheduleRealInfo s=list.get(j);
  2440 + if(s.getXlBm().equals(lineStr)){
  2441 + lists.add(s);
  2442 + }
  2443 + }
  2444 +
  2445 + //计算线路的各项公里
  2446 + if(lists.size()>0){
  2447 + Map<String, Object> newMap=staticTj(lists,"z");
  2448 + lMap.add(newMap);
  2449 + }
  2450 + }
  2451 + if(list.size()>0){
  2452 + Map<String, Object> newMap=staticTj(list,"f");
  2453 + lMap.add(newMap);
  2454 + }
  2455 + if(type.equals("export")){
  2456 + List<Iterator<?>> listI = new ArrayList<Iterator<?>>();
  2457 + Map<String, Object> m = new HashMap<String, Object>();
  2458 + m.put("date", date);
  2459 + m.put("date1", date2);
  2460 + String by=map.get("by").toString();
  2461 + String xls="";
  2462 + if(by.equals("sj")){
  2463 + xls="countByLine.xls";
2289 2464 }else{
2290   - map.put("out", "");
  2465 + xls="countByLines.xls";
2291 2466 }
2292   - Long sj=1000000000L;
2293   - if(!lzsj.trim().equals("")){
2294   - sj =Long.parseLong(lzsj);
  2467 + ReportUtils ee = new ReportUtils();
  2468 + try {
  2469 + listI.add(lMap.iterator());
  2470 + String path = this.getClass().getResource("/").getPath() + "static/pages/forms/";
  2471 + ee.excelReplace(listI, new Object[]{m}, path + "mould/"+xls,
  2472 + path + "export/线路公里统计表.xls");
  2473 + } catch (Exception e) {
  2474 + // TODO: handle exception
  2475 + e.printStackTrace();
2295 2476 }
2296   - if(in>0 && out >0){
2297   - if((out-in)/1000>sj){
2298   - map.put("type", "y");
2299   - }else{
2300   - map.put("type", "n");
  2477 + }
  2478 + return lMap;
  2479 + }
  2480 +
  2481 +
  2482 + public final Map<String, Object> staticTj(List<ScheduleRealInfo> list,String status){
  2483 +
  2484 + List<ScheduleRealInfo> lists=new ArrayList<ScheduleRealInfo>();
  2485 + for(int i=0;i<list.size();i++){
  2486 + ScheduleRealInfo s=list.get(i);
  2487 + Set<ChildTaskPlan> cts = s.getcTasks();
  2488 + if(cts != null && cts.size() > 0){
  2489 + lists.add(s);
  2490 + }else{
  2491 + if(s.getZdsjActual()!=null){
  2492 + lists.add(s);
2301 2493 }
2302 2494 }
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+"'";
  2495 + }
  2496 + Map<String, Object> map = new HashMap<String, Object>();
  2497 + if(list.size()>0){
  2498 + if(status.equals("f")){
  2499 + map.put("xlName","合计");
  2500 + map.put("gs", "");
  2501 + map.put("fgs", "");
2363 2502 }else{
2364   - sql += " and r.xl_bm = '"+line+"'";
  2503 + map.put("xlName", list.get(0).getXlName());
  2504 + map.put("gs", list.get(0).getGsName());
  2505 + map.put("fgs", list.get(0).getFgsName());
  2506 + map.put("jGh", list.get(0).getjGh());
  2507 + map.put("sGh", list.get(0).getsGh()==null?"":list.get(0).getsGh());
  2508 + map.put("nbbm",list.get(0).getClZbh());
  2509 + map.put("line", list.get(0).getXlBm());
2365 2510 }
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;
  2511 +
  2512 + double jhyygl=culateService.culateJhgl(list);//计划营运公里
  2513 + double jhjcclc= culateService.culateJhJccgl(list);//计划进出场公里(计划空驶公里)
  2514 + map.put("jhlc", jhyygl);
  2515 + map.put("jcclc", jhjcclc);
  2516 + map.put("jhzlc", Arith.add(jhyygl, jhjcclc));//计划总里程
  2517 +
  2518 + //计划内外营运
  2519 + Map<String, Double> culateSjlcMap=culateService.culateSjlcMap(lists);
  2520 + double jhnlc=culateSjlcMap.get("jhnlc");
  2521 + double jhwlc=culateSjlcMap.get("jhwlc");
  2522 + map.put("jhnlc", jhnlc);
  2523 + map.put("jhwlc", jhwlc);
  2524 + double zyylc=Arith.add(jhnlc, jhwlc);
  2525 +
  2526 + //计划内外进出场
  2527 + Map<String, Double> culateSjJcclcMap=culateService.culateSjJcclcMap(lists);
  2528 + double jhwjcclc=culateSjJcclcMap.get("jhwlc");
  2529 + double jhnjcclc=culateSjJcclcMap.get("jhnlc");
  2530 + map.put("jhwjcclc", jhwjcclc);
  2531 + map.put("jhnjcclc", jhnjcclc);
  2532 + double zjcclc=Arith.add(jhwjcclc, jhnjcclc);
  2533 +
  2534 + //临加公里
  2535 + Map<String, Double> culateLjMile=culateService.culateLjMile(lists);
  2536 + double ljyy=culateLjMile.get("ljyy");
  2537 + double ljjcc=culateLjMile.get("ljjcc");
  2538 + double ljkfks=culateLjMile.get("ljkfks");
  2539 + map.put("ljyy", ljyy);
  2540 + map.put("ljjcc", ljjcc);
  2541 + map.put("ljkfks", ljkfks);
  2542 +
  2543 + double ljlc=Arith.add(Arith.add(ljyy, ljjcc),ljkfks);
  2544 +
  2545 + double lbss=culateService.culateSsMile(list);//烂班少驶
  2546 + map.put("lbss", lbss);
  2547 + map.put("ssgl_lz", culateService.culateSsMileXx(list, "路阻"));
  2548 + map.put("ssgl_dm", culateService.culateSsMileXx(list, "吊慢"));
  2549 + map.put("ssgl_gz", culateService.culateSsMileXx(list, "故障"));
  2550 + map.put("ssgl_jf", culateService.culateSsMileXx(list, "纠纷"));
  2551 + map.put("ssgl_zs", culateService.culateSsMileXx(list, "肇事"));
  2552 + map.put("ssgl_qr", culateService.culateSsMileXx(list, "缺人"));
  2553 + map.put("ssgl_qc", culateService.culateSsMileXx(list, "缺车"));
  2554 + map.put("ssgl_kx", culateService.culateSsMileXx(list, "客稀"));
  2555 + map.put("ssgl_qh", culateService.culateSsMileXx(list, "气候"));
  2556 + map.put("ssgl_yw", culateService.culateSsMileXx(list, "援外"));
  2557 + map.put("ssgl_other", culateService.culateSsMileXx(list, "其他"));
  2558 +
  2559 +
  2560 + double zrwjcclc=culateService.culateZrwJccLc(list, "故障");
  2561 + double zrwjcclc1=culateService.culateZrwJccLc(list, "肇事");
  2562 + double zrwjcclc2=culateService.culateZrwJccLc(list, "纠纷");
  2563 + double zrwjcclcqt=culateService.culateZrwJccLc(list, "其他");
  2564 + map.put("jhwjcclc_z", Arith.add(jhwjcclc,zrwjcclcqt));
  2565 + map.put("zrwjcclc", zrwjcclc);
  2566 + map.put("zrwjcclc1", zrwjcclc1);
  2567 + map.put("zrwjcclc2", zrwjcclc2);
  2568 + map.put("zrwjcclcqt", zrwjcclcqt);
  2569 + double zrwjcc=Arith.add(Arith.add(Arith.add(zrwjcclc, zrwjcclc1), zrwjcclc2),zrwjcclcqt);
  2570 + double kfks=Arith.add(culateService.culateKfksLc(lists),culateService.culateZrwJccLc(list, "空放"));
  2571 + map.put("kfks", kfks);
  2572 + double zlc=Arith.add(Arith.add(Arith.add(zrwjcc, ljlc),
  2573 + Arith.add(zjcclc, zyylc)),kfks);
  2574 + map.put("zlc", zlc);
  2575 + }
  2576 + return map;
  2577 + }
  2578 + @Override
  2579 + public List<Map<String, Object>> countByBusList(Map<String, Object> map) {
  2580 + // TODO Auto-generated method stub
  2581 + SimpleDateFormat sdf =new SimpleDateFormat("yyyy-MM-dd");
  2582 + List<Map<String, Object>> lMap = new ArrayList<Map<String, Object>>();
  2583 + List<Map<String, Object>> lMaps = new ArrayList<Map<String, Object>>();
  2584 + String gsdm="";
  2585 + if(map.get("gsdm")!=null){
  2586 + gsdm=map.get("gsdm").toString();
  2587 + }
  2588 + String fgsdm="";
  2589 + if(map.get("fgsdm")!=null){
  2590 + fgsdm=map.get("fgsdm").toString();
  2591 + }
  2592 + String line="";
  2593 + if(map.get("line")!=null){
  2594 + line=map.get("line").toString();
  2595 + }
  2596 + String date="";
  2597 + if(map.get("date")!=null){
  2598 + date=map.get("date").toString();
  2599 + }
  2600 + String date2="";
  2601 + if(map.get("date2")!=null){
  2602 + date2=map.get("date2").toString();
  2603 + }
  2604 + String xlName="";
  2605 + if(map.get("xlName")!=null){
  2606 + xlName=map.get("xlName").toString();
  2607 + }
  2608 + String zt="";
  2609 + if(map.get("zt")!=null){
  2610 + zt=map.get("zt").toString();
  2611 + }
  2612 + String type="";
  2613 + if(map.get("type")!=null){
  2614 + type=map.get("type").toString();
  2615 + }
  2616 + //所有班次信息
  2617 + List<ScheduleRealInfo> list = new ArrayList<ScheduleRealInfo>();
  2618 + line =line.trim();
  2619 + if(line.equals("")){
  2620 + //查询所有线路
  2621 + list = scheduleRealInfoRepository.scheduleByDateAndLineTj(line, date,date2,gsdm,fgsdm);
  2622 + }else{
  2623 + //查询单条线路
  2624 + list = scheduleRealInfoRepository.scheduleByDateAndLineTj2(line, date,date2);
  2625 + }
  2626 + String ylbSql=" select * from bsth_c_ylb where rq BETWEEN '"+date+"' and '"+date2+"'";
  2627 + if(line.equals("")){
  2628 + ylbSql +="and ssgsdm='"+gsdm+"' "
  2629 + + " and fgsdm='"+fgsdm+"'";
  2630 + }else{
  2631 + ylbSql += " and xlbm = '"+line+"'";
  2632 + }
  2633 + List<Ylb> ylbList=ylbList(ylbSql);
  2634 + String dlbSql=" select * from bsth_c_dlb where rq BETWEEN '"+date+"' and '"+date2+"'";
  2635 + if(line.equals("")){
  2636 + dlbSql +="and ssgsdm='"+gsdm+"' "
  2637 + + " and fgsdm='"+fgsdm+"'";
  2638 + }else{
  2639 + dlbSql += " and xlbm = '"+line+"'";
  2640 + }
  2641 + List<Dlb> dlbList=dlbList(dlbSql);
  2642 + String sql="select r.xl_bm,r.schedule_date_str,r.cl_zbh,r.j_gh,r.s_gh"
  2643 + + " from bsth_c_s_sp_info_real r where"
  2644 + + " r.schedule_date_str BETWEEN '"+date+"' and '"+date2+"'";
  2645 + if(line.equals("")){
  2646 + sql +="and r.gs_bm='"+gsdm+"' "
  2647 + + " and r.fgs_bm='"+fgsdm+"'";
  2648 + }else{
  2649 + sql += " and r.xl_bm = '"+line+"'";
  2650 + }
  2651 + sql += " group by r.xl_bm,r.cl_zbh,r.schedule_date_str,r.j_gh,r.s_gh";
  2652 +
  2653 + List<Map<String, Object>> listGroupBy=jdbcTemplate.query(sql, new RowMapper<Map<String, Object>>() {
  2654 + @Override
  2655 + public Map<String, Object> mapRow(ResultSet arg0, int arg1) throws SQLException {
  2656 + Map<String, Object> map=new HashMap<String,Object>();
  2657 + map.put("line",arg0.getString("xl_bm"));
  2658 + map.put("date", arg0.getString("schedule_date_str"));
  2659 + map.put("nbbm", arg0.getString("cl_zbh"));
  2660 + map.put("jGh", arg0.getString("j_gh"));
  2661 + map.put("sGh", arg0.getString("s_gh"));
  2662 + return map;
  2663 + }
  2664 + });
  2665 + for (int i = 0; i < listGroupBy.size(); i++) {
  2666 + Map<String, Object> m=listGroupBy.get(i);
  2667 + String xl_bm=m.get("line")==null?"":m.get("line").toString();
  2668 + String dateStr=m.get("date")==null?"":m.get("date").toString();
  2669 + String nbbm =m.get("nbbm")==null?"":m.get("nbbm").toString();
  2670 + String jGh= m.get("jGh")==null?"":m.get("jGh").toString();
  2671 + String sGh= m.get("sGh")==null?"":m.get("sGh").toString();
  2672 + List<ScheduleRealInfo> lists=new ArrayList<ScheduleRealInfo>();
  2673 + for (int j = 0; j < list.size(); j++) {
  2674 + ScheduleRealInfo s=list.get(j);
  2675 + if(zt.equals("zbh")){
  2676 + if(xl_bm.equals(s.getXlBm()) && nbbm.equals(s.getClZbh())){
  2677 + lists.add(s);
2373 2678 }
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;
2419   - }
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+"'";
2570 2679 }else{
2571   - ylbSql += " and xlbm = '"+line+"'";
  2680 + if(xl_bm.equals(s.getXlBm()) && nbbm.equals(s.getClZbh())
  2681 + && dateStr.equals(s.getScheduleDateStr())
  2682 + && jGh.equals(s.getjGh()) && sGh.equals(s.getsGh())){
  2683 + lists.add(s);
  2684 + }
2572 2685 }
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+"'";
  2686 + }
  2687 +
  2688 + if(zt.equals("zbh")){
  2689 + Map<String, Object> newMap=staticTj(lists, "");
  2690 + double yhl=0.0;
  2691 + double jzl=0.0;
  2692 + double hyl=0.0;
  2693 + double dhl=0.0;
  2694 + double cdl=0.0;
  2695 + for (int j = 0; j < ylbList.size(); j++) {
  2696 + Ylb y=ylbList.get(j);
  2697 + if(nbbm.equals(y.getNbbm()) && xl_bm.equals(y.getXlbm())){
  2698 + yhl=Arith.add(yhl, y.getYh());
  2699 + jzl=Arith.add(jzl, y.getJzl());
  2700 + hyl=Arith.add(hyl, y.getYh());
  2701 + }
  2702 +
  2703 + }
  2704 + for (int j = 0; j < dlbList.size(); j++) {
  2705 + Dlb d=dlbList.get(j);
  2706 + if(nbbm.equals(d.getNbbm())&&xl_bm.equals(d.getXlbm())){
  2707 + dhl=Arith.add(dhl, d.getHd());
  2708 + cdl=Arith.add(cdl, d.getCdl());
  2709 + }
  2710 + }
  2711 + if(date.equals(date2)){
  2712 + newMap.put("rq",date);
2578 2713 }else{
2579   - dlbSql += " and xlbm = '"+line+"'";
  2714 + newMap.put("rq",date+"至"+date2);
  2715 + }
  2716 + newMap.put("yhl", yhl);
  2717 + newMap.put("jzl", jzl);
  2718 + newMap.put("hyl", hyl);
  2719 + newMap.put("dhl", dhl);
  2720 + newMap.put("cdl", cdl);
  2721 + lMap.add(newMap);
  2722 + }else{
  2723 + Map<String, Object> newMap=staticTj(lists, "");
  2724 + double lc=Double.parseDouble(newMap.get("zlc").toString());
  2725 + double yhl=0.0;
  2726 + double jzl=0.0;
  2727 + double hyl=0.0;
  2728 + double dhl=0.0;
  2729 + double cdl=0.0;
  2730 + double zlc=0.0;
  2731 + for (int j = 0; j < ylbList.size(); j++) {
  2732 + Ylb y=ylbList.get(j);
  2733 + if(nbbm.equals(y.getNbbm()) && xl_bm.equals(y.getXlbm())
  2734 + &&dateStr.equals(sdf.format(y.getRq()))
  2735 + &&jGh.equals(y.getName())){
  2736 + yhl=Arith.add(yhl, y.getYh());
  2737 + jzl=Arith.add(jzl, y.getJzl());
  2738 + hyl=Arith.add(hyl, y.getYh());
  2739 + zlc=Arith.add(zlc, y.getZlc());
  2740 + }
  2741 +
2580 2742 }
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+"'";
  2743 +
  2744 + for (int j = 0; j < dlbList.size(); j++) {
  2745 + Dlb d=dlbList.get(j);
  2746 + if(nbbm.equals(d.getNbbm())&&xl_bm.equals(d.getXlbm())
  2747 + &&dateStr.equals(sdf.format(d.getRq()))
  2748 + &&jGh.equals(d.getName())){
  2749 + dhl=Arith.add(dhl, d.getHd());
  2750 + cdl=Arith.add(cdl, d.getCdl());
  2751 + zlc=Arith.add(zlc, d.getZlc());
  2752 + }
  2753 + }
  2754 + double div=0.0;
  2755 + if(lc>0){
  2756 + div=Arith.div(zlc, lc,2);
  2757 + }
  2758 + newMap.put("yhl", yhl*div);
  2759 + newMap.put("jzl", jzl*div);
  2760 + newMap.put("hyl", hyl*div);
  2761 + newMap.put("dhl", dhl*div);
  2762 + newMap.put("cdl", cdl*div);
  2763 + lMaps.add(newMap);
  2764 + }
  2765 +
  2766 + }
  2767 + if(!zt.equals("zbh")){
  2768 + String sqls="select r.xl_bm,r.cl_zbh,r.j_gh,r.s_gh"
  2769 + + " from bsth_c_s_sp_info_real r where"
  2770 + + " r.schedule_date_str BETWEEN '"+date+"' and '"+date2+"'";
2585 2771 if(line.equals("")){
2586   - sql +="and r.gs_bm='"+gsdm+"' "
  2772 + sqls +="and r.gs_bm='"+gsdm+"' "
2587 2773 + " and r.fgs_bm='"+fgsdm+"'";
2588 2774 }else{
2589   - sql += " and r.xl_bm = '"+line+"'";
  2775 + sqls += " and r.xl_bm = '"+line+"'";
2590 2776 }
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>>() {
  2777 + sqls += " group by r.xl_bm,r.cl_zbh,r.j_gh,r.s_gh";
  2778 +
  2779 + List<Map<String, Object>> listGroupBys=jdbcTemplate.query(sqls, new RowMapper<Map<String, Object>>() {
2594 2780 @Override
2595 2781 public Map<String, Object> mapRow(ResultSet arg0, int arg1) throws SQLException {
2596 2782 Map<String, Object> map=new HashMap<String,Object>();
2597 2783 map.put("line",arg0.getString("xl_bm"));
2598   - map.put("date", arg0.getString("schedule_date_str"));
2599 2784 map.put("nbbm", arg0.getString("cl_zbh"));
2600 2785 map.put("jGh", arg0.getString("j_gh"));
2601 2786 map.put("sGh", arg0.getString("s_gh"));
2602 2787 return map;
2603 2788 }
2604 2789 });
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   - }
  2790 + lMap=lists(listGroupBys, lMaps, gsdm, fgsdm, date, date2);
  2791 +
  2792 + }
  2793 + if(type.equals("export")){
  2794 + List<Iterator<?>> listI = new ArrayList<Iterator<?>>();
  2795 + Map<String, Object> m = new HashMap<String, Object>();
  2796 + m.put("date", date);
  2797 + m.put("date1", date2);
  2798 + String xls="";
  2799 + String by=map.get("by").toString();
  2800 +
  2801 +
  2802 + if(zt.equals("zbh")){
  2803 + if(by.equals("sj")){
  2804 + xls="countByBus1.xls";
  2805 + }else{
  2806 + xls="countByBus1s.xls";
2626 2807 }
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);
  2808 + }else{
  2809 +
  2810 + if(by.equals("sj")){
  2811 + xls="countByBus2.xls";
2662 2812 }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);
  2813 + xls="countByBus2s.xls";
2704 2814 }
2705   -
2706   - }
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;
2769   - }
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,
  2815 + }
  2816 + ReportUtils ee = new ReportUtils();
  2817 + try {
  2818 + listI.add(lMap.iterator());
  2819 + String path = this.getClass().getResource("/").getPath() + "static/pages/forms/";
  2820 + ee.excelReplace(listI, new Object[]{m}, path + "mould/"+xls,
  2821 + path + "export/路单数据统计表.xls");
  2822 + } catch (Exception e) {
  2823 + // TODO: handle exception
  2824 + e.printStackTrace();
  2825 + }
  2826 + }
  2827 +
  2828 + return lMap;
  2829 + }
  2830 +
  2831 + public final List<Ylb> ylbList(String sql){
  2832 + List<Ylb> ylbList= jdbcTemplate.query(sql, new RowMapper<Ylb>() {
  2833 + @Override
  2834 + public Ylb mapRow(ResultSet arg0, int arg1) throws SQLException {
  2835 + Ylb y = new Ylb();
  2836 + y.setRq(arg0.getDate("rq"));
  2837 + y.setXlbm(arg0.getString("xlbm"));
  2838 + y.setNbbm(arg0.getString("nbbm"));
  2839 + y.setJzl(arg0.getDouble("jzl"));
  2840 + y.setYh(arg0.getDouble("yh"));
  2841 + y.setSh(arg0.getDouble("sh"));
  2842 + return y;
  2843 + }
  2844 + });
  2845 + return ylbList;
  2846 + }
  2847 +
  2848 + public final List<Dlb> dlbList(String sql){
  2849 + List<Dlb> dlbList= jdbcTemplate.query(sql, new RowMapper<Dlb>() {
  2850 + @Override
  2851 + public Dlb mapRow(ResultSet arg0, int arg1) throws SQLException {
  2852 + Dlb y = new Dlb();
  2853 + y.setRq(arg0.getDate("rq"));
  2854 + y.setXlbm(arg0.getString("xlbm"));
  2855 + y.setNbbm(arg0.getString("nbbm"));
  2856 + y.setCdl(arg0.getDouble("cdl"));
  2857 + y.setHd(arg0.getDouble("hd"));
  2858 + y.setSh(arg0.getDouble("sh"));
  2859 + return y;
  2860 + }
  2861 + });
  2862 + return dlbList;
  2863 + }
  2864 +
  2865 + public final List<Map<String, Object>> lists(List<Map<String, Object>> listGb,
  2866 + List<Map<String, Object>> listLc,
  2867 + String gsdm,String fgsdm,
  2868 + String date,String date2){
  2869 + List<Map<String, Object>> lMap=new ArrayList<Map<String,Object>>();
  2870 + for (int i = 0; i < listGb.size(); i++) {
  2871 + Map<String, Object> m=listGb.get(i);
  2872 + String xl_bm=m.get("line")==null?"":m.get("line").toString();
  2873 + String nbbm =m.get("nbbm")==null?"":m.get("nbbm").toString();
  2874 + String jGh= m.get("jGh")==null?"":m.get("jGh").toString();
  2875 + String sGh= m.get("sGh")==null?"":m.get("sGh").toString();
  2876 + double jhzlc = 0.0,jhlc= 0.0,jcclc= 0.0,zlc= 0.0,jhnlc= 0.0,jhwlc= 0.0,
  2877 + jhnjcclc= 0.0,jhwjcclc= 0.0,jhwjcclc_z=0.0,zrwjcclc= 0.0,zrwjcclc1= 0.0,zrwjcclc2= 0.0,
  2878 + zrwjcclcqt=0.0,lbss= 0.0,ssgl_lz= 0.0,
  2879 + ssgl_dm= 0.0,ssgl_gz= 0.0,ssgl_jf= 0.0,ssgl_zs= 0.0,ssgl_qr= 0.0,ssgl_qc= 0.0,
  2880 + ssgl_kx= 0.0,ssgl_qh= 0.0,ssgl_yw= 0.0,ssgl_other= 0.0,ljyy=0.0,ljjcc=0.0,
2821 2881 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);
  2882 +
  2883 + for (int j = 0; j < listLc.size(); j++) {
  2884 + Map<String, Object> map=listLc.get(j);
  2885 + if(xl_bm.equals(map.get("line").toString())
  2886 + && nbbm.equals(map.get("nbbm").toString())
  2887 + && sGh.equals(map.get("sGh")==null?"":map.get("sGh").toString())
  2888 + && jGh.equals(map.get("jGh").toString())){
  2889 + jhzlc=Arith.add(jhzlc, map.get("jhzlc"));
  2890 + jhlc =Arith.add(jhlc, map.get("jhlc"));
  2891 + jcclc=Arith.add(jcclc, map.get("jcclc"));
  2892 + zlc=Arith.add(zlc, map.get("zlc"));
  2893 + jhnlc=Arith.add(jhnlc, map.get("jhnlc"));
  2894 + jhwlc=Arith.add(jhwlc, map.get("jhwlc"));
  2895 + jhnjcclc=Arith.add(jhnjcclc, map.get("jhnjcclc"));
  2896 + jhwjcclc=Arith.add(jhwjcclc, map.get("jhwjcclc"));
  2897 + jhwjcclc_z=Arith.add(jhwjcclc_z, map.get("jhwjcclc_z"));
  2898 + zrwjcclc=Arith.add(zrwjcclc, map.get("zrwjcclc"));
  2899 + zrwjcclc1=Arith.add(zrwjcclc1, map.get("zrwjcclc1"));
  2900 + zrwjcclc2=Arith.add(zrwjcclc2, map.get("zrwjcclc2"));
  2901 + zrwjcclcqt=Arith.add(zrwjcclcqt, map.get("zrwjcclcqt"));
  2902 + lbss=Arith.add(lbss, map.get("lbss"));
  2903 + ssgl_lz=Arith.add(ssgl_lz, map.get("ssgl_lz"));
  2904 + ssgl_dm=Arith.add(ssgl_dm, map.get("ssgl_dm"));
  2905 + ssgl_gz=Arith.add(ssgl_gz, map.get("ssgl_gz"));
  2906 + ssgl_jf=Arith.add(ssgl_jf, map.get("ssgl_jf"));
  2907 + ssgl_zs=Arith.add(ssgl_zs, map.get("ssgl_zs"));
  2908 + ssgl_qr=Arith.add(ssgl_qr, map.get("ssgl_qr"));
  2909 + ssgl_qc=Arith.add(ssgl_qc, map.get("ssgl_qc"));
  2910 + ssgl_kx=Arith.add(ssgl_kx, map.get("ssgl_kx"));
  2911 + ssgl_qh=Arith.add(ssgl_qh, map.get("ssgl_qh"));
  2912 + ssgl_yw=Arith.add(ssgl_yw, map.get("ssgl_yw"));
  2913 + ssgl_other=Arith.add(ssgl_other, map.get("ssgl_other"));
  2914 + kfks=Arith.add(kfks, map.get("kfks"));
  2915 + ljyy=Arith.add(ljyy, map.get("ljyy"));
  2916 + ljjcc=Arith.add(ljjcc, map.get("ljjcc"));
  2917 + yhl=Arith.add(yhl, map.get("yhl"));
  2918 + jzl=Arith.add(jzl, map.get("jzl"));
  2919 + hyl=Arith.add(hyl, map.get("hyl"));
  2920 + dhl=Arith.add(dhl, map.get("dhl"));
  2921 + cdl=Arith.add(cdl, map.get("cdl"));
  2922 +
  2923 +
  2924 + }
2932 2925 }
2933   - SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd HH:mm");
  2926 +
  2927 + Map<String, Object> newMap=new HashMap<String,Object>();
  2928 + if(date.equals(date2)){
  2929 + newMap.put("rq", date);
  2930 + }else{
  2931 + newMap.put("rq", date+"至"+date2);
  2932 + }
  2933 + newMap.put("fgs", BasicData.businessFgsCodeNameMap.get(fgsdm+"_"+gsdm));
  2934 + newMap.put("xlName", BasicData.lineCode2NameMap.get(xl_bm));
  2935 + newMap.put("jGh", jGh);
  2936 + newMap.put("jName", jGh);
  2937 + newMap.put("sGh",sGh);
  2938 + newMap.put("sName", sGh);
  2939 + newMap.put("nbbm", nbbm);
  2940 + newMap.put("jhzlc", jhzlc);
  2941 + newMap.put("jhlc", jhlc);
  2942 + newMap.put("jcclc", jcclc);
  2943 + newMap.put("zlc", zlc);
  2944 + newMap.put("jhnlc", jhnlc);
  2945 + newMap.put("jhwlc", jhwlc);
  2946 + newMap.put("jhnjcclc", jhnjcclc);
  2947 + newMap.put("jhwjcclc", jhwjcclc);
  2948 + newMap.put("jhwjcclc_z", jhwjcclc_z);
  2949 + newMap.put("zrwjcclc", zrwjcclc);
  2950 + newMap.put("zrwjcclc1", zrwjcclc1);
  2951 + newMap.put("zrwjcclc2", zrwjcclc2);
  2952 + newMap.put("zrwjcclcqt", zrwjcclcqt);
  2953 + newMap.put("lbss", lbss);
  2954 + newMap.put("ssgl_lz", ssgl_lz);
  2955 + newMap.put("ssgl_dm",ssgl_dm);
  2956 + newMap.put("ssgl_gz", ssgl_gz);
  2957 + newMap.put("ssgl_jf", ssgl_jf);
  2958 + newMap.put("ssgl_zs", ssgl_zs);
  2959 + newMap.put("ssgl_qr", ssgl_qr);
  2960 + newMap.put("ssgl_qc", ssgl_qc);
  2961 + newMap.put("ssgl_kx", ssgl_kx);
  2962 + newMap.put("ssgl_qh", ssgl_qh);
  2963 + newMap.put("ssgl_yw", ssgl_yw);
  2964 + newMap.put("ssgl_other", ssgl_other);
  2965 + newMap.put("kfks", kfks);
  2966 + newMap.put("ljyy", ljyy);
  2967 + newMap.put("ljjcc", ljjcc);
  2968 + newMap.put("yhl", yhl);
  2969 + newMap.put("jzl", jzl);
  2970 + newMap.put("hyl", hyl);
  2971 + newMap.put("dhl", dhl);
  2972 + newMap.put("cdl", cdl);
  2973 + lMap.add(newMap);
  2974 + }
  2975 + return lMap;
  2976 + }
  2977 + @Override
  2978 + public List<Map<String, Object>> countDjg(Map<String, Object> map) {
  2979 + // TODO Auto-generated method stub
  2980 + List<Map<String, Object>> lMap=new ArrayList<Map<String,Object>>();
  2981 + String line=map.get("line").toString().trim();
  2982 + String date=map.get("date").toString();
  2983 + String gsbm=map.get("gsbm").toString();
  2984 + String fgsbm=map.get("fgsbm").toString();
  2985 + String type=map.get("type").toString();
  2986 + List<ScheduleRealInfo> list=new ArrayList<ScheduleRealInfo>();
  2987 + if(line.equals("")){
  2988 + list=scheduleRealInfoRepository.scheduleByDateAndLineByGs(gsbm, fgsbm, date);
  2989 +
  2990 + }else{
  2991 + list=scheduleRealInfoRepository.scheduleByDateAndLine2(line, date);
  2992 + }
  2993 + SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd HH:mm");
2934 2994 // 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;
  2995 + //查询所有线路
  2996 + String xlSql="select line_code,spac_grade from bsth_c_line ";
  2997 + if(line.equals("")){
  2998 + xlSql +=" where company ='"+gsbm+"'";
  2999 + }else{
  3000 + xlSql +=" where line_code ='"+line+"'";
  3001 + }
  3002 +
  3003 + List<Map<String, Object>> xlList=jdbcTemplate.query(xlSql, new RowMapper<Map<String, Object>>() {
  3004 + @Override
  3005 + public Map<String, Object> mapRow(ResultSet arg0, int arg1) throws SQLException {
  3006 + Map<String, Object> map=new HashMap<String,Object>();
  3007 + map.put("line",arg0.getString("line_code"));
  3008 + map.put("grade", arg0.getString("spac_grade"));
  3009 + return map;
  3010 + }
  3011 + });
  3012 + //查询大间隔时间
  3013 + String djgSql="select * from bsth_c_interval";
  3014 + List<Interval> djgList=jdbcTemplate.query(djgSql, new RowMapper<Interval>() {
  3015 + @Override
  3016 + public Interval mapRow(ResultSet arg0, int arg1) throws SQLException {
  3017 + Interval m=new Interval();
  3018 + m.setLevel(arg0.getString("level"));
  3019 + m.setPeak(arg0.getInt("peak"));
  3020 + m.setTrough(arg0.getInt("trough"));
  3021 + return m;
  3022 + }
  3023 + });
  3024 +
  3025 + for (int i = 0; i < xlList.size(); i++) {
  3026 + String lineCode=xlList.get(i).get("line").toString();
  3027 + String grade =xlList.get(i).get("grade")==null?"1":xlList.get(i).get("grade").toString();
  3028 + int peak=0;
  3029 + int trough=0;
  3030 + for (int j = 0; j < djgList.size(); j++) {
  3031 + Interval il=djgList.get(j);
  3032 + if(il.getLevel().equals(grade)){
  3033 + peak=il.getPeak();
  3034 + trough=il.getTrough();
  3035 + continue;
2962 3036 }
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   -
  3037 + }
  3038 + List<ScheduleRealInfo> list_=new ArrayList<ScheduleRealInfo>();
  3039 + List<ScheduleRealInfo> listInfo=new ArrayList<ScheduleRealInfo>();
  3040 + for (int j = 0; j < list.size(); j++) {
  3041 + ScheduleRealInfo sinfo=list.get(j);
  3042 + try {
  3043 + if(sinfo.getXlBm().equals(lineCode)){
  3044 + list_.add(sinfo);
  3045 + ScheduleRealInfo s=checkBc(sinfo);
  3046 + String fcsj=s.getFcsjActual()==null?"":s.getFcsjActual();
  3047 + if(!fcsj.equals("")){
  3048 + Long fcsjAcual = sdf.parse(s.getRealExecDate() + " " + s.getFcsjActual()).getTime();
  3049 + s.setFcsjActualTime(fcsjAcual);
  3050 + s.setFcsjActual(fcsj);
  3051 + listInfo.add(s);
2994 3052 }
2995   - } catch (ParseException e) {
2996   - // TODO Auto-generated catch block
2997   - e.printStackTrace();
  3053 +
2998 3054 }
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   - }
  3055 + } catch (ParseException e) {
  3056 + // TODO Auto-generated catch block
  3057 + e.printStackTrace();
3044 3058 }
3045 3059 }
3046   - return s;
3047   - }
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   -
3062   - }
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);
  3060 +
  3061 + if(listInfo.size()>0){
  3062 + int sjbcs=culateService.culateSjbc(list_, "")+culateService.culateLjbc(list_, "");
  3063 + Map<String, Object> m=listDjg(gsbm,fgsbm,lineCode,sjbcs,peak,trough,listInfo,grade);
  3064 + lMap.add(m);
  3065 + }
  3066 +
  3067 + }
  3068 + if(type.equals("export")){
  3069 + List<Iterator<?>> listI = new ArrayList<Iterator<?>>();
  3070 + Map<String, Object> m = new HashMap<String, Object>();
  3071 + m.put("date", date);
  3072 + ReportUtils ee = new ReportUtils();
  3073 + try {
  3074 + listI.add(lMap.iterator());
  3075 + String path = this.getClass().getResource("/").getPath() + "static/pages/forms/";
  3076 + ee.excelReplace(listI, new Object[]{m}, path + "mould/countInterval.xls",
  3077 + path + "export/大间隔统计表.xls");
  3078 + } catch (Exception e) {
  3079 + // TODO: handle exception
  3080 + e.printStackTrace();
  3081 + }
  3082 + }
  3083 + return lMap;
  3084 + }
  3085 +
  3086 + public ScheduleRealInfo checkBc(ScheduleRealInfo s){
  3087 + //如果班次有子任务 且 子任务中有属于营运的。把该子任务的发车时间设置成班次的发车时间
  3088 + String fcsj=s.getFcsjActual()==null?"":s.getFcsjActual();
  3089 + if(fcsj.equals("")){
  3090 + Set<ChildTaskPlan> childTaskPlans = s.getcTasks();
  3091 + if(!childTaskPlans.isEmpty()){
  3092 + List<ChildTaskPlan> listit=new ArrayList<ChildTaskPlan>(childTaskPlans);
  3093 + Collections.sort(listit, new ComparableChild());
  3094 + for (int i = 0; i < listit.size(); i++) {
  3095 + ChildTaskPlan c=listit.get(i);
  3096 + if(!c.isDestroy()){
  3097 + if(c.getMileageType().equals("service")){
  3098 + s.setFcsjActual(c.getStartDate());
  3099 + break;
3111 3100 }
  3101 +
3112 3102 }
3113 3103 }
3114 3104 }
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   - }
  3105 + }
  3106 + return s;
  3107 + }
  3108 +
  3109 + public Map<String, Object> listDjg(String gsdm,String fgsdm,String line,int sjbcs,int peak,int trough,List<ScheduleRealInfo> listInfo,String grade){
  3110 + DecimalFormat df = new DecimalFormat("#0.00");
  3111 + Collections.sort(listInfo,new ComparableAcuals());
  3112 + List<ScheduleRealInfo> listInfo0=new ArrayList<ScheduleRealInfo>();
  3113 + List<ScheduleRealInfo> listInfo1=new ArrayList<ScheduleRealInfo>();
  3114 + for (int i = 0; i < listInfo.size(); i++) {
  3115 + ScheduleRealInfo s=listInfo.get(i);
  3116 + if(s.getXlDir().equals("0")){
  3117 + listInfo0.add(s);
  3118 + }else{
  3119 + listInfo0.add(s);
  3120 + }
  3121 +
  3122 + }
  3123 + Map<String, Object> map=new HashMap<String, Object>();
  3124 + map.put("line", line);
  3125 + map.put("xlName", BasicData.lineCode2NameMap.get(line));
  3126 + map.put("fgsname", BasicData.businessFgsCodeNameMap.get(fgsdm+"_"+gsdm));
  3127 + map.put("bcs", sjbcs);
  3128 + map.put("djgde", grade);
  3129 + int djgcs=0;
  3130 + List<Map<String, Object>> mapList=new ArrayList<Map<String, Object>>();
  3131 + for (int i = 0; i < listInfo0.size(); i++) {
  3132 + ScheduleRealInfo s=listInfo.get(i);
  3133 + Long fcsjTime=s.getFcsjActualTime();
  3134 + String time=s.getFcsjActual();
  3135 + String[] fcsjStr = time.split(":");
  3136 + long fcsj= Long.parseLong(fcsjStr[0])*60+Long.parseLong(fcsjStr[1]);
  3137 + if(i<listInfo.size()-1){
  3138 + Long djg=0l;
  3139 + Long fscjNext=listInfo.get(i+1).getFcsjActualTime();
  3140 + if((fcsj>=zgf1&&fcsj<=zgf2)||(fcsj>=wgf1&&fcsj<=wgf2)){
  3141 + djg = (long) (peak*60*1000);
  3142 + if(fscjNext-fcsjTime>djg){
  3143 + djgcs ++;
  3144 + Map<String, Object> m=new HashMap<String,Object>();
  3145 + m.put("xlName", BasicData.lineCode2NameMap.get(line));
  3146 + m.put("fgsname", BasicData.businessFgsCodeNameMap.get(fgsdm+"_"+gsdm));
  3147 + m.put("djgde", grade);
  3148 + m.put("qJh", s.getFcsj());
  3149 + m.put("qSj", time);
  3150 + m.put("hJh", listInfo.get(i+1).getFcsj());
  3151 + m.put("hSj", listInfo.get(i+1).getFcsjActual());
  3152 + m.put("djgsj", peak);
  3153 + m.put("bcjgsj", (fscjNext-fcsjTime)/60000);
  3154 + mapList.add(m);
  3155 + }
  3156 + }else{
  3157 + djg = (long) (trough*60*1000);
  3158 + if(fscjNext-fcsjTime>djg){
  3159 + djgcs ++;
  3160 + Map<String, Object> m=new HashMap<String,Object>();
  3161 + m.put("xlName", BasicData.lineCode2NameMap.get(line));
  3162 + m.put("fgsname", BasicData.businessFgsCodeNameMap.get(fgsdm+"_"+gsdm));
  3163 + m.put("djgde", grade);
  3164 + m.put("qJh", s.getFcsj());
  3165 + m.put("qSj", time);
  3166 + m.put("hJh", listInfo.get(i+1).getFcsj());
  3167 + m.put("hSj", listInfo.get(i+1).getFcsjActual());
  3168 + m.put("djgsj", trough);
  3169 + m.put("bcjgsj", (fscjNext-fcsjTime)/60000);
  3170 + mapList.add(m);
3157 3171 }
3158 3172 }
3159 3173 }
3160   - double fsl=0.0;
3161   - if(sjbcs>0){
3162   - fsl=Arith.div(djgcs,sjbcs, 2)*100;
  3174 + }
  3175 +
  3176 + for (int i = 0; i < listInfo1.size(); i++) {
  3177 + ScheduleRealInfo s=listInfo.get(i);
  3178 + Long fcsjTime=s.getFcsjActualTime();
  3179 + String time=s.getFcsjActual();
  3180 + String[] fcsjStr = time.split(":");
  3181 + long fcsj= Long.parseLong(fcsjStr[0])*60+Long.parseLong(fcsjStr[1]);
  3182 + if(i<listInfo.size()-1){
  3183 + Long djg=0l;
  3184 + Long fscjNext=listInfo.get(i+1).getFcsjActualTime();
  3185 + if((fcsj>=zgf1&&fcsj<=zgf2)||(fcsj>=wgf1&&fcsj<=wgf2)){
  3186 + djg = (long) (peak*60*1000);
  3187 + if(fscjNext-fcsjTime>djg){
  3188 + djgcs ++;
  3189 + Map<String, Object> m=new HashMap<String,Object>();
  3190 + m.put("xlName", BasicData.lineCode2NameMap.get(line));
  3191 + m.put("fgsname", BasicData.businessFgsCodeNameMap.get(fgsdm+"_"+gsdm));
  3192 + m.put("djgde", grade);
  3193 + m.put("qJh", s.getFcsj());
  3194 + m.put("qSj", time);
  3195 + m.put("hJh", listInfo.get(i+1).getFcsj());
  3196 + m.put("hSj", listInfo.get(i+1).getFcsjActual());
  3197 + m.put("djgsj", peak);
  3198 + m.put("bcjgsj", (fscjNext-fcsjTime)/60000);
  3199 + mapList.add(m);
  3200 + }
  3201 + }else{
  3202 + djg = (long) (trough*60*1000);
  3203 + if(fscjNext-fcsjTime>djg){
  3204 + djgcs ++;
  3205 + Map<String, Object> m=new HashMap<String,Object>();
  3206 + m.put("xlName", BasicData.lineCode2NameMap.get(line));
  3207 + m.put("fgsname", BasicData.businessFgsCodeNameMap.get(fgsdm+"_"+gsdm));
  3208 + m.put("djgde", grade);
  3209 + m.put("qJh", s.getFcsj());
  3210 + m.put("qSj", time);
  3211 + m.put("hJh", listInfo.get(i+1).getFcsj());
  3212 + m.put("hSj", listInfo.get(i+1).getFcsjActual());
  3213 + m.put("djgsj", trough);
  3214 + m.put("bcjgsj", (fscjNext-fcsjTime)/60000);
  3215 + mapList.add(m);
  3216 + }
  3217 + }
3163 3218 }
3164   -
3165   - map.put("djgcs", djgcs);
3166   - map.put("fsl", df.format(fsl)+"%");
3167   - map.put("djgxx", mapList);
3168   - return map;
3169 3219 }
3170   -
  3220 + double fsl=0.0;
  3221 + if(sjbcs>0){
  3222 + fsl=Arith.div(djgcs,sjbcs, 2)*100;
  3223 + }
  3224 +
  3225 + map.put("djgcs", djgcs);
  3226 + map.put("fsl", df.format(fsl)+"%");
  3227 + map.put("djgxx", mapList);
  3228 + return map;
  3229 + }
  3230 +
3171 3231 }
3172 3232  
3173 3233 class ComparableAcuals implements Comparator<ScheduleRealInfo>{
... ... @@ -3178,4 +3238,4 @@ class ComparableAcuals implements Comparator&lt;ScheduleRealInfo&gt;{
3178 3238 return o1.getFcsjActualTime().compareTo(o2.getFcsjActualTime());
3179 3239 }
3180 3240  
3181   -}
  3241 +}
3182 3242 \ No newline at end of file
... ...
src/main/resources/datatools/ktrs/ttinfodetailDataInput.ktr
... ... @@ -3052,4 +3052,4 @@
3052 3052 </slave-step-copy-partition-distribution>
3053 3053 <slave_transformation>N</slave_transformation>
3054 3054  
3055 3055 -</transformation>
  3056 +</transformation>
3056 3057 \ No newline at end of file
... ...
src/main/resources/datatools/ktrs/ttinfodetailDataInput2.ktr
... ... @@ -3052,4 +3052,4 @@
3052 3052 </slave-step-copy-partition-distribution>
3053 3053 <slave_transformation>N</slave_transformation>
3054 3054  
3055 3055 -</transformation>
  3056 +</transformation>
3056 3057 \ No newline at end of file
... ...
src/main/resources/static/pages/forms/statement/lineTimeAnaly.html
... ... @@ -87,14 +87,15 @@
87 87 <table class="table table-bordered table-hover table-checkable" id="forms">
88 88 <thead>
89 89 <tr class="hidden">
90   - <th >公司</th>
  90 +<!-- <th >公司</th> -->
91 91 <th width="30%">日期分段</th>
92   - <th >时段</th>
  92 + <th>时段</th>
93 93 <th width="20%">线路</th>
94   - <th >路牌</th>
  94 + <th>路牌</th>
95 95 <th width="20%">站点</th>
96   - <th >计划发车班次数</th>
97   - <th>实际完成班次数</th>
  96 + <th>班次数</th>
  97 +<!-- <th>计划发车班次数</th> -->
  98 +<!-- <th>实际完成班次数</th> -->
98 99 </tr>
99 100 </thead>
100 101 <tbody>
... ... @@ -120,10 +121,11 @@
120 121 <tr class="hidden">
121 122 <th rowspan="2">日期</th>
122 123 <th colspan="4">到达时间</th>
  124 + <th rowspan="2">误点分钟</th>
123 125 <th colspan="4">发车时间</th>
124 126 <th rowspan="2">误点分钟</th>
125   - <th colspan="5">运送时间</th>
126   - <th colspan="5">停站时间</th>
  127 + <th colspan="3">运送时间</th>
  128 + <th colspan="3">停站时间</th>
127 129 </tr>
128 130 <tr class="hidden">
129 131 <th>计划</th>
... ... @@ -136,13 +138,13 @@
136 138 <th>平均延误</th>
137 139 <th>计划</th>
138 140 <th>实际</th>
139   - <th>最快</th>
140   - <th>最慢</th>
  141 +<!-- <th>最快</th> -->
  142 +<!-- <th>最慢</th> -->
141 143 <th>平均</th>
142 144 <th>计划</th>
143 145 <th>实际</th>
144   - <th>最大</th>
145   - <th>最小</th>
  146 +<!-- <th>最大</th> -->
  147 +<!-- <th>最小</th> -->
146 148 <th>平均</th>
147 149 </tr>
148 150 </thead>
... ... @@ -406,7 +408,7 @@
406 408 }
407 409 });
408 410 $.each(list, function(i, g){
409   - if(g.line == params[3] && g.lp == params[4] &&g.station == params[5]){
  411 + if(g.line == params[2] && g.lp == params[3] &&g.station == params[4]){
410 412 var tbodyHtml = template('list_workList',{list:g});
411 413 $('#works tbody').html(tbodyHtml);
412 414 $("#works_hidden").removeClass("hidden");
... ... @@ -483,14 +485,12 @@
483 485 <script type="text/html" id="list_lineTimeAnaly">
484 486 {{each list as obj i}}
485 487 <tr>
486   - <td>{{obj.company}}</td>
487 488 <td>{{obj.dates}}</td>
488 489 <td>{{obj.times}}</td>
489 490 <td>{{obj.line}}</td>
490 491 <td>{{obj.lp}}</td>
491 492 <td>{{obj.station}}</td>
492   - <td>{{obj.jhbc}}</td>
493   - <td>{{obj.sjbc}}</td>
  493 + <td>{{obj.bcs}}</td>
494 494 </tr>
495 495 {{/each}}
496 496 {{if list.length == 0}}
... ... @@ -503,30 +503,27 @@
503 503 {{each list.workList as obj i}}
504 504 <tr>
505 505 <td>{{obj.date}}</td>
506   - <td>{{obj.jhdf}}</td>
507   - <td>{{obj.sjdf}}</td>
  506 + <td>{{obj.jhdd}}</td>
  507 + <td>{{obj.sjdd}}</td>
508 508 {{if i == 0}}
509   - <td rowspan="{{list.workList.length}}" class="merge">{{list.wddf1}}</td>
510   - <td rowspan="{{list.workList.length}}" class="merge">{{list.wddf2}}</td>
  509 + <td rowspan="{{list.workList.length}}" class="merge">{{list.ddwd1}}</td>
  510 + <td rowspan="{{list.workList.length}}" class="merge">{{list.ddwd2}}</td>
511 511 {{/if}}
  512 + <td class="merge">{{obj.ddwd}}</td>
512 513 <td>{{obj.jhfc}}</td>
513 514 <td>{{obj.sjfc}}</td>
514 515 {{if i == 0}}
515 516 <td rowspan="{{list.workList.length}}" class="merge">{{list.wdfc1}}</td>
516 517 <td rowspan="{{list.workList.length}}" class="merge">{{list.wdfc2}}</td>
517 518 {{/if}}
518   - <td class="merge">{{obj.wdfz}}</td>
  519 + <td class="merge">{{obj.fcwd}}</td>
519 520 <td>{{obj.jhys}}</td>
520 521 <td>{{obj.sjys}}</td>
521   - <td>{{obj.yssjMin}}</td>
522   - <td>{{obj.yssjMax}}</td>
523 522 {{if i == 0}}
524 523 <td rowspan="{{list.workList.length}}" class="merge">{{list.pjys}}</td>
525 524 {{/if}}
526 525 <td>{{obj.jhtz}}</td>
527 526 <td>{{obj.sjtz}}</td>
528   - <td>{{obj.tzsjMax}}</td>
529   - <td>{{obj.tzsjMin}}</td>
530 527 {{if i == 0}}
531 528 <td rowspan="{{list.workList.length}}" class="merge">{{list.pjtz}}</td>
532 529 {{/if}}
... ...
src/main/resources/static/real_control_v2/js/main.js
... ... @@ -169,8 +169,8 @@ var disabled_submit_btn = function (form) {
169 169 function showUpdateDescription() {
170 170 //更新说明
171 171 var updateDescription = {
172   - date: '2017-08-13',
173   - text: '<h5>1、修复了 “子任务-区间调头” 当上下行里程不等时,站间距公里提示错误的问题!</h5>'
  172 + date: '2017-08-25',
  173 + text: '<h5>1、修复了一个bug,这个bug导致个别班次不显示实到时间!</h5>'
174 174 };
175 175  
176 176 var storage = window.localStorage
... ...
src/main/resources/static/real_control_v2/mapmonitor/alone_page/alone_data_basic.js 0 → 100644
  1 +/* 基础数据管理模块 */
  2 +
  3 +var gb_data_basic = (function () {
  4 +
  5 + var stationRoutes, lineCode2NameAll, lineInformations, nbbm2deviceMap, device2nbbmMap, allPersonnel, svgAttrs;
  6 + var ep = EventProxy.create("stationRoutes", "lineCode2Name", "lineInformations", "nbbm2deviceId", "all_personnel", "svg_attrs"
  7 + , function (routes, code2Name, informations, nbbm2device, all_personnel, svgAttrMap) {
  8 + stationRoutes = routes;
  9 + lineCode2NameAll = code2Name;
  10 + lineInformations = informations;
  11 + nbbm2deviceMap = nbbm2device;
  12 + device2nbbmMap = gb_common.inverse(nbbm2deviceMap);
  13 + allPersonnel = all_personnel;
  14 + svgAttrs = svgAttrMap;
  15 + //gb_main_ep.emitLater('data-basic');
  16 + });
  17 +
  18 + var storage = window.localStorage;
  19 + //激活的线路
  20 + var activeLines = JSON.parse(storage.getItem('lineControlItems'));
  21 + //lineCode to line object
  22 + var codeToLine = {};
  23 + //lineCode idx string
  24 + var line_idx = (function () {
  25 + var str = '';
  26 + for (var i = 0, item; item = activeLines[i++];) {
  27 + str += (',' + item.lineCode);
  28 + codeToLine[item.lineCode] = item;
  29 + }
  30 + return str.substr(1);
  31 + })();
  32 +
  33 + //站点路由
  34 + gb_common.$get('/stationroute/multiLine', {lineIds: line_idx}, function (rs) {
  35 + var list = rs.list;//JSON.parse(rs.list);
  36 + var routeData = gb_common.groupBy(list, 'lineCode');
  37 + //排序
  38 + for (var lineCode in routeData) {
  39 + routeData[lineCode].sort(stationRouteSort);
  40 + }
  41 + ep.emit('stationRoutes', routeData);
  42 + });
  43 +
  44 + //线路标准信息
  45 + gb_common.$get('/lineInformation/line/multi', {lineCodes: line_idx}, function (rs) {
  46 + var informations = {};
  47 + $.each(rs, function () {
  48 + informations[this.line.lineCode] = this;
  49 + delete this['line'];
  50 + });
  51 + ep.emit('lineInformations', informations);
  52 + });
  53 +
  54 + //人员信息
  55 + loadAllPersonnel(function (data) {
  56 + ep.emit('all_personnel', data);
  57 + });
  58 + function loadAllPersonnel(cb) {
  59 + $.get('/personnel/all_py', function (rs) {
  60 + //转换成自动补全组件需要的数据
  61 + var data = [], code;
  62 + for(var i =0, p; p = rs[i++];){
  63 + code = p['workId'].indexOf('-')!=-1?p['workId'].split('-')[1]:p['workId'];
  64 + data.push({
  65 + value: code + '/' + p.name,
  66 + fullChars: p.fullChars.toUpperCase(),
  67 + camelChars: p.camelChars.toUpperCase()
  68 + });
  69 + }
  70 + cb && cb(data);
  71 + });
  72 + }
  73 +
  74 + var carparks = {};
  75 + //停车场数据
  76 + gb_common.$get('/realMap/carParkSpatialData', {}, function (rs) {
  77 + rs.list.sort(function (a, b) {
  78 + return a.parkName.localeCompare(b.parkName);
  79 + });
  80 + $.each(rs.list, function () {
  81 + carparks[this.parkCode] = this;
  82 + });
  83 + });
  84 +
  85 + //车辆数据
  86 + var carsArray;
  87 + $.get('/basic/cars?t=' + Math.random(), function (rs) {
  88 + carsArray = rs;
  89 + });
  90 +
  91 + var getCarparkByCode = function (code) {
  92 + return carparks[code];
  93 + };
  94 +
  95 + //line code to name
  96 + $.get('/basic/lineCode2Name', function (rs) {
  97 + ep.emit('lineCode2Name', rs);
  98 + });
  99 +
  100 + //nbbm to device id
  101 + $.get('/basic/nbbm2deviceId', function (rs) {
  102 + ep.emit('nbbm2deviceId', rs);
  103 + });
  104 + //nbbm to 车牌号
  105 + var nbbm2PlateMap;
  106 + $.get('/basic/nbbm2PlateNo', function (rs) {
  107 + nbbm2PlateMap = rs;
  108 + });
  109 +
  110 + //模拟图属性数据
  111 + gb_common.$get('/realSchedule/svgAttr', {idx: line_idx}, function (rs) {
  112 + var data = {};
  113 + $.each(rs.list, function () {
  114 + this.hideStations = JSON.parse(this.hideStations);
  115 + this.nicknames = JSON.parse(this.nicknames);
  116 + data[this.lineCode] = this;
  117 + });
  118 + ep.emit('svg_attrs', data);
  119 + });
  120 +
  121 + //站点和停车场历时、公里对照数据
  122 + var stat_park_data;
  123 + var load_stat_park_data = function () {
  124 + $.get('/basic/station2ParkData?t='+Math.random(), {idx: line_idx}, function (rs) {
  125 + stat_park_data = rs;
  126 + });
  127 + }
  128 + load_stat_park_data();
  129 +
  130 + function findLineByCodes(codeArr) {
  131 + var rs = [];
  132 + $.each(codeArr, function () {
  133 + rs.push(codeToLine[this]);
  134 + });
  135 + return rs;
  136 + }
  137 +
  138 + var findCodeByLinename = function (name) {
  139 + for (var code in lineCode2NameAll) {
  140 + if (name == lineCode2NameAll[code])
  141 + return code;
  142 + }
  143 +
  144 + return null;
  145 + };
  146 +
  147 + var getLineInformation = function (lineCode) {
  148 + return lineInformations[lineCode];
  149 + };
  150 +
  151 + var stationRouteSort = function (a, b) {
  152 + return a.stationRouteCode - b.stationRouteCode;
  153 + };
  154 +
  155 + return {
  156 + activeLines: activeLines,
  157 + line_idx: line_idx,
  158 + codeToLine: codeToLine,
  159 + nbbm2deviceMap: function () {
  160 + return nbbm2deviceMap;
  161 + },
  162 + device2nbbmMap: function () {
  163 + return device2nbbmMap;
  164 + },
  165 + getLineInformation: getLineInformation,
  166 + allInformations: function () {
  167 + return lineInformations;
  168 + },
  169 + stationRoutes: function (lineCode) {
  170 + return stationRoutes[lineCode]
  171 + },
  172 + findLineByCodes: findLineByCodes,
  173 + lineCode2NameAll: function () {
  174 + return lineCode2NameAll
  175 + },
  176 + allPersonnel: function () {
  177 + return allPersonnel;
  178 + },
  179 + findCodeByLinename: findCodeByLinename,
  180 + getCarparkByCode: getCarparkByCode,
  181 + getSvgAttr: function (lineCode) {
  182 + return svgAttrs[lineCode];
  183 + },
  184 + setSvgAttr: function (attr) {
  185 + attr.hideStations = JSON.parse(attr.hideStations);
  186 + attr.nicknames = JSON.parse(attr.nicknames);
  187 + svgAttrs[attr.lineCode] = attr;
  188 + },
  189 + //是否是环线
  190 + isLoopLine: function (lineCode) {
  191 + var data = gb_common.groupBy(stationRoutes[lineCode], 'directions');
  192 + //下行只有2个站点
  193 + var len = data[0].length;
  194 + if (len > 0 && data[1].length == 2) {
  195 + var first = data[0][0],
  196 + end = data[0][len - 1];
  197 +
  198 + /*if(first.stationName != end.stationName)
  199 + return false;*/
  200 +
  201 + var fPoint = {latitude: first.station.gLaty, longitude: first.station.gLonx}
  202 + , ePoint = {latitude: end.station.gLaty, longitude: end.station.gLonx};
  203 +
  204 + //并且上行起终点距离200米内
  205 + if (geolib.getDistance(fPoint, ePoint) < 200) {
  206 + return true;
  207 + }
  208 + }
  209 +
  210 + return false;
  211 + },
  212 + //刷新员工信息
  213 + refreshAllPersonnel: function (cb) {
  214 + loadAllPersonnel(function (data) {
  215 + allPersonnel = data;
  216 + cb && cb();
  217 + });
  218 + },
  219 + nbbm2PlateMap: function () {
  220 + return nbbm2PlateMap;
  221 + },
  222 + carsArray: function () {
  223 + return carsArray;
  224 + },
  225 + simpleParksArray: function () {
  226 + var map = {};
  227 + for(var code in carparks)
  228 + map[code] = carparks[code].parkName;
  229 + return map;
  230 + },
  231 + remarksMapps: function () {
  232 + return remarksMapps;
  233 + },
  234 + get_stat_park_data: function () {
  235 + return stat_park_data;
  236 + },
  237 + reload_stat_park_data: function () {
  238 + load_stat_park_data();
  239 + }
  240 + };
  241 +})();
... ...
src/main/resources/static/real_control_v2/mapmonitor/alone_page/alone_data_gps.js 0 → 100644
  1 +/* gps 数据管理模块 */
  2 +
  3 +var gb_data_gps = (function () {
  4 +
  5 + //fixed time refresh delay
  6 + var delay = 1000 * 7;
  7 + //deviceId ——> gps
  8 + var realData = {};
  9 + //refresh after callback
  10 + var refreshEventCallbacks = [];
  11 + //register callback function
  12 + var registerCallback = function (cb) {
  13 + if (cb)
  14 + refreshEventCallbacks.push(cb);
  15 + };
  16 +
  17 + var refresh = function (cb) {
  18 + $.ajax({
  19 + url: '/gps/real/line',
  20 + data: {lineCodes: gb_data_basic.line_idx},
  21 + dataType: 'json',
  22 + success: function (rs) {
  23 + //用定时的gps来检测session断开
  24 + if(rs.status && rs.status==407){
  25 + location.href = '/login.html';
  26 + return;
  27 + }
  28 + refreshData(rs);
  29 + cb();
  30 + },
  31 + error: function (xr, t) {
  32 + notify_err('刷新GPS失败,稍后重试' + t);
  33 + cb();
  34 + }
  35 + });
  36 + };
  37 +
  38 + var refreshData = function (rs) {
  39 + var old, addArr = [],
  40 + upArr = [],
  41 + upDownChange = [];
  42 +
  43 + var schArray;
  44 + $.each(rs, function () {
  45 + old = realData[this.deviceId];
  46 + if (old) {
  47 + if (this.timestamp > old.timestamp) {
  48 + if (old.upDown != this.upDown)
  49 + upDownChange.push(this);
  50 + else
  51 + upArr.push(this);
  52 + }
  53 +
  54 + } else
  55 + addArr.push(this);
  56 +
  57 + /* //班次信息
  58 + if (this.schId) {
  59 + schArray = gb_schedule_table.findScheduleByLine(this.lineId);
  60 + if (schArray)
  61 + this.sch = schArray[this.schId];
  62 + }*/
  63 +
  64 + //时间格式化
  65 + this.dateStr = moment(this.timestamp).format('YYYY-MM-DD HH:mm:ss');
  66 + realData[this.deviceId] = this;
  67 + });
  68 +
  69 + //console.log('add array size: ' + addArr.length, 'up array size: ' + upArr.length);
  70 + //CCCallFuncN
  71 + $.each(refreshEventCallbacks, function (i, cb) {
  72 + cb(addArr, upArr, upDownChange);
  73 + });
  74 +
  75 + };
  76 +
  77 + var startFixedTime;
  78 + var fixedTimeRefresh = function () {
  79 + if (startFixedTime)
  80 + return;
  81 + startFixedTime = true;
  82 +
  83 + (function () {
  84 + var f = arguments.callee;
  85 + refresh(function () {
  86 + setTimeout(f, delay);
  87 + });
  88 + })();
  89 + };
  90 +
  91 + var gpsByLineCode = function (lineCode) {
  92 + var rs = [];
  93 + for (var device in realData) {
  94 + if (realData[device].lineId == lineCode)
  95 + rs.push(realData[device]);
  96 + }
  97 + return rs;
  98 + };
  99 +
  100 + var findOne = function (deviceId) {
  101 + return realData[deviceId];
  102 + };
  103 +
  104 + var findGpsByNbbm = function (nbbm) {
  105 + return realData[gb_data_basic.nbbm2deviceMap()[nbbm]];
  106 + };
  107 +
  108 + /**
  109 + * 设备掉线事件
  110 + */
  111 + var deviceOffline = function (gps) {
  112 + $.each(offlineCallbacks, function (i, cb) {
  113 + cb(gps);
  114 + });
  115 + };
  116 +
  117 + //注册掉线事件回调函数
  118 + var offlineCallbacks = [];
  119 + var registerOfflineCb = function (cb) {
  120 + if (cb)
  121 + offlineCallbacks.push(cb);
  122 + };
  123 +
  124 + return {
  125 + fixedTimeRefresh: fixedTimeRefresh,
  126 + registerCallback: registerCallback,
  127 + allGps: realData,
  128 + gpsByLineCode: gpsByLineCode,
  129 + findOne: findOne,
  130 + findGpsByNbbm: findGpsByNbbm,
  131 + deviceOffline: deviceOffline,
  132 + registerOfflineCb: registerOfflineCb
  133 + };
  134 +})();
... ...
src/main/resources/static/real_control_v2/mapmonitor/alone_page/alone_wrap.html 0 → 100644
  1 +<!DOCTYPE html>
  2 +<html lang="zh-cn">
  3 +
  4 +<head>
  5 + <meta charset="UTF-8">
  6 + <title>地图监控 v2.0</title>
  7 + <!-- uikit core style-->
  8 + <link rel="stylesheet" href="/real_control_v2/assets/plugins/uikit-2.27.1/css/uikit.gradient.min.css" />
  9 + <link rel="stylesheet" href="/real_control_v2/assets/plugins/uikit-2.27.1/components/notify.gradient.min.css" />
  10 + <link rel="stylesheet" href="/real_control_v2/assets/plugins/uikit-2.27.1/components/tooltip.gradient.min.css" />
  11 + <link rel="stylesheet"
  12 + href="/real_control_v2/assets/plugins/uikit-2.27.1/components/autocomplete.gradient.min.css" />
  13 + <link rel="stylesheet" href="/real_control_v2/assets/plugins/uikit-2.27.1/components/accordion.gradient.min.css" />
  14 + <link rel="stylesheet" href="/real_control_v2/assets/plugins/uikit-2.27.1/components/slidenav.gradient.min.css" />
  15 + <link rel="stylesheet" href="/real_control_v2/assets/plugins/uikit-2.27.1/components/sticky.gradient.min.css" />
  16 +
  17 + <!-- main style -->
  18 + <link rel="stylesheet" href="/real_control_v2/css/main.css" />
  19 + <!-- north style -->
  20 + <link rel="stylesheet" href="/real_control_v2/css/north.css" />
  21 + <!-- home style -->
  22 + <link rel="stylesheet" href="/real_control_v2/css/home.css" />
  23 +
  24 + <!-- js tree -->
  25 + <link rel="stylesheet" href="/real_control_v2/assets/plugins/jstree/default/style.css" />
  26 +
  27 + <link rel="stylesheet" href="/real_control_v2/css/modal_extend.css" />
  28 + <!-- perfect-scrollbar style -->
  29 + <link rel="stylesheet" href="/real_control_v2/assets/plugins/perfect-scrollbar/perfect-scrollbar.css" />
  30 + <!-- layer 3.0.3 -->
  31 + <link rel="stylesheet" href="/real_control_v2/assets/plugins/layer3.0.3/skin/default/layer.css" />
  32 + <link rel="stylesheet" href="/real_control_v2/assets/plugins/layer3.0.3/skin/moon/style.css" />
  33 +
  34 + <!-- flatpickr -->
  35 + <link rel="stylesheet" href="/real_control_v2/assets/plugins/flatpickr/flatpickr.min.css" >
  36 + <link rel="stylesheet" href="/real_control_v2/assets/plugins/flatpickr/themes/airbnb.css" >
  37 +
  38 + <link rel="stylesheet" href="/real_control_v2/css/ct_table.css" />
  39 +</head>
  40 +
  41 +<body>
  42 +<div class="main-container" style="height: 100%;">
  43 +</div>
  44 +
  45 +<!-- 地图相关 -->
  46 +<script src="http://api.map.baidu.com/api?v=2.0&ak=IGGrr4UjwIYzatoCRFKEL8sT"></script>
  47 +<script src="http://api.map.baidu.com/library/TrafficControl/1.4/src/TrafficControl_min.js"></script>
  48 +<script src="/assets/js/baidu//MarkerClusterer.js" merge="plugins"></script>
  49 +<script src="/assets/js/TransGPS.js" merge="plugins"></script>
  50 +<!-- 高德 -->
  51 +<script src="http://webapi.amap.com/maps?v=1.3&key=16cb1c5043847e09ef9edafdd77befda"></script>
  52 +<!-- jquery -->
  53 +<script src="/real_control_v2/assets/js/jquery.min.js"></script>
  54 +<!-- jquery actual -->
  55 +<script src="/real_control_v2/assets/js/jquery.actual.min.js" ></script>
  56 +<!-- moment.js 日期处理类库 -->
  57 +<script src="/real_control_v2/assets/plugins/moment/moment.min.js"></script>
  58 +<script src="/real_control_v2/assets/plugins/moment/zh-cn.js"></script>
  59 +
  60 +<!-- flatpickr -->
  61 +<script src="/real_control_v2/assets/plugins/flatpickr/flatpickr.min.js"></script>
  62 +<script src="/real_control_v2/assets/plugins/flatpickr/l10n/zh.js"></script>
  63 +
  64 +<!-- perfect-scrollbar -->
  65 +<script src="/real_control_v2/assets/plugins/perfect-scrollbar/perfect-scrollbar.jquery.js" ></script>
  66 +<!-- common js -->
  67 +<script src="/real_control_v2/js/common.js"></script>
  68 +<!-- art-template 模版引擎 -->
  69 +<script src="/assets/plugins/template.js" ></script>
  70 +<!-- d3 -->
  71 +<script src="/assets/js/d3.min.js"></script>
  72 +<!-- EventProxy -->
  73 +<script src="/assets/js/eventproxy.js"></script>
  74 +<!-- uikit core -->
  75 +<script src="/real_control_v2/assets/plugins/uikit-2.27.1/uikit.min.js" ></script>
  76 +<script src="/real_control_v2/assets/plugins/uikit-2.27.1/components/notify.min.js" ></script>
  77 +<script src="/real_control_v2/assets/plugins/uikit-2.27.1/components/tooltip.min.js"></script>
  78 +<script src="/real_control_v2/assets/plugins/uikit-2.27.1/components/autocomplete.min.js"></script>
  79 +<script src="/real_control_v2/assets/plugins/uikit-2.27.1/components/accordion.min.js" ></script>
  80 +<script src="/real_control_v2/assets/plugins/uikit-2.27.1/components/sticky.min.js" ></script>
  81 +
  82 +<!-- js tree -->
  83 +<script src="/real_control_v2/assets/plugins/jstree/jstree.min.js" ></script>
  84 +<!-- layer 3.0.3 -->
  85 +<script src="/real_control_v2/assets/plugins/layer3.0.3/layer.js"></script>
  86 +
  87 +<!-- 模态框扩展 -->
  88 +<script src="/real_control_v2/js/modal_extend.js" ></script>
  89 +
  90 +<script src="/real_control_v2/mapmonitor/alone_page/alone_data_basic.js" ></script>
  91 +<script src="/real_control_v2/mapmonitor/alone_page/alone_data_gps.js" ></script>
  92 +<script src="/real_control_v2/js/utils/ct_table.js" ></script>
  93 +<script>
  94 + (function () {
  95 + gb_data_gps.fixedTimeRefresh();
  96 + //嵌入地图页面
  97 + $('.main-container').load('/real_control_v2/mapmonitor/real.html', function () {
  98 + $('.map-system-msg.flex-left').remove();
  99 + });
  100 + })();
  101 +</script>
  102 +</body>
  103 +
  104 +</html>
... ...
src/main/resources/static/real_control_v2/mapmonitor/css/real.css
... ... @@ -64,7 +64,7 @@ input[type=checkbox].disabled{
64 64 position: absolute;
65 65 z-index: 2;
66 66 top: 20px;
67   - background: red;
  67 + background: white;
68 68 color: white;
69 69 padding: 7px 25px 7px 7px;
70 70 right: calc(50% - 250px);
... ... @@ -87,14 +87,17 @@ input[type=checkbox].disabled{
87 87 box-shadow: none;
88 88 }
89 89  
90   -.map-system-msg.flex-left a:before{
91   - content: '老版本地图';
  90 +.map-system-msg.flex-left a.now_map{
  91 + top: 35px;
  92 + width: 50px;
  93 +}
  94 +
  95 +.map-system-msg.flex-left a:after{
92 96 position: absolute;
93 97 width: 100%;
94 98 z-index: 2;
95 99 height: 100%;
96 100 background: #ffffff;
97   - top: 0;
98 101 left: 0;
99 102 text-align: center;
100 103 font-size: 12px;
... ... @@ -102,6 +105,26 @@ input[type=checkbox].disabled{
102 105 color: #969696;
103 106 }
104 107  
  108 +.map-system-msg.flex-left a.old_map:after{
  109 + content: '老版本地图';
  110 + top: 0;
  111 +}
  112 +
  113 +.map-system-msg.flex-left a.now_map>i{
  114 + font-size: 12px;
  115 + vertical-align: top;
  116 + color: #535151;
  117 + margin-top: -1px;
  118 +}
  119 +
  120 +.map-system-msg.flex-left a.now_map:after{
  121 + content: '单屏地图';
  122 + top: 0;
  123 + left: 20px;
  124 + text-align: left;
  125 + text-indent: 7px;
  126 +}
  127 +
105 128 .map-system-msg a:hover{
106 129 text-decoration: none;
107 130 }
... ...
src/main/resources/static/real_control_v2/mapmonitor/js/config.js
... ... @@ -111,6 +111,8 @@ var gb_map_config = (function () {
111 111 function trafficSwitch(val) {
112 112 //修改配置项
113 113 set('traffic', this.checked);
  114 +
  115 + gb_map_imap.call('transparent_line', this.checked);
114 116 gb_map_imap.call('traffic', this.checked);
115 117 }
116 118  
... ...
src/main/resources/static/real_control_v2/mapmonitor/js/map/platform/baidu.js
... ... @@ -57,6 +57,19 @@ var gb_map_baidu = (function(){
57 57  
58 58 //根据ID保存映射
59 59 polylines[opt.id]=_pLines;
  60 + }
  61 + ,
  62 + transparent_line: function (checked) {
  63 + for(var id in polylines){
  64 + for(var i=0,polyline;polyline=polylines[id][i++];){
  65 + if(polyline.isVisible()){
  66 + if(checked)
  67 + polyline.setStrokeOpacity(0);
  68 + else
  69 + polyline.setStrokeOpacity(1);
  70 + }
  71 + }
  72 + }
60 73 },
61 74 traffic: function (enable) {
62 75 if(enable)
... ...
src/main/resources/static/real_control_v2/mapmonitor/real.html
... ... @@ -6,7 +6,10 @@
6 6 <link rel="stylesheet" href="/real_control_v2/assets/plugins/uikit-2.27.1/components/progress.gradient.min.css" merge="map_plugins">
7 7  
8 8 <div class="map-system-msg flex-left">
9   - <a class="z-depth-2" href="/pages/mapmonitor/alone/wrap.html" target="_blank"></a>
  9 + <a class="z-depth-2 old_map" href="/pages/mapmonitor/alone/wrap.html" target="_blank"></a>
  10 + <a class="z-depth-2 now_map" href="/real_control_v2/mapmonitor/alone_page/alone_wrap.html" target="_blank">
  11 + <i class="uk-icon-send-o"></i>
  12 + </a>
10 13 </div>
11 14  
12 15 <div id="real_map_container"></div>
... ...