Commit 76d4c49e1aac1e01d6c6081459c3e30245e2ae1a
1 parent
3ef833c6
新增配人接口,线路营运状态
Showing
1 changed file
with
344 additions
and
18 deletions
src/main/java/com/bsth/server_rs/bigdata/BigdateService.java
| @@ -3,6 +3,9 @@ package com.bsth.server_rs.bigdata; | @@ -3,6 +3,9 @@ package com.bsth.server_rs.bigdata; | ||
| 3 | import java.sql.ResultSet; | 3 | import java.sql.ResultSet; |
| 4 | import java.sql.SQLException; | 4 | import java.sql.SQLException; |
| 5 | import java.text.DecimalFormat; | 5 | import java.text.DecimalFormat; |
| 6 | +import java.text.SimpleDateFormat; | ||
| 7 | +import java.util.Calendar; | ||
| 8 | +import java.util.Date; | ||
| 6 | import java.util.HashMap; | 9 | import java.util.HashMap; |
| 7 | import java.util.List; | 10 | import java.util.List; |
| 8 | import java.util.Map; | 11 | import java.util.Map; |
| @@ -96,16 +99,41 @@ public class BigdateService { | @@ -96,16 +99,41 @@ public class BigdateService { | ||
| 96 | return ""; | 99 | return ""; |
| 97 | } | 100 | } |
| 98 | } | 101 | } |
| 102 | + public Map<String, Long> getEndtime(String date){ | ||
| 103 | + Map<String, Long> map=new HashMap<String,Long>(); | ||
| 104 | + String sql="select xl,endtime from bsth_c_calc_count " | ||
| 105 | + + " where date='"+date+"' "; | ||
| 106 | + List<Map<String, Object>> list=jdbcTemplate.query(sql, | ||
| 107 | + new RowMapper<Map<String, Object>>(){ | ||
| 108 | + @Override | ||
| 109 | + public Map<String, Object> mapRow(ResultSet rs, int rowNum) throws SQLException { | ||
| 110 | + Map<String, Object> m=new HashMap<String, Object>(); | ||
| 111 | + m.put("line", rs.getString("xl")); | ||
| 112 | + m.put("endtime", rs.getString("endtime")); | ||
| 113 | + return m; | ||
| 114 | + } | ||
| 115 | + }); | ||
| 116 | + for (int i = 0; i < list.size(); i++) { | ||
| 117 | + map.put(list.get(i).get("line").toString(), | ||
| 118 | + Long.parseLong(list.get(i).get("endtime").toString())); | ||
| 119 | + } | ||
| 120 | + return map; | ||
| 121 | + } | ||
| 99 | @GET | 122 | @GET |
| 100 | @Path("/line/all") | 123 | @Path("/line/all") |
| 101 | public List<Map<String, Object>> findLineAll(){ | 124 | public List<Map<String, Object>> findLineAll(){ |
| 102 | - String sql="SELECT company,line_code,name,level,shanghai_linecode, nature from bsth_c_line where " | ||
| 103 | - + " shanghai_linecode is not null and shanghai_linecode !='' and destroy=0 and remove=0 "; | 125 | + String sql="SELECT b.start_opt,a.company,a.line_code,a.name,a.level," |
| 126 | + + " a.shanghai_linecode, a.nature from " | ||
| 127 | + + " bsth_c_line a left join bsth_c_line_config b " | ||
| 128 | + + " on a.id=b.line where " | ||
| 129 | + + " a.shanghai_linecode is not null and a.shanghai_linecode !='' and a.destroy=0 " | ||
| 130 | + + " and a.remove=0 "; | ||
| 104 | List<Map<String, Object>> list=jdbcTemplate.query(sql, | 131 | List<Map<String, Object>> list=jdbcTemplate.query(sql, |
| 105 | new RowMapper<Map<String, Object>>(){ | 132 | new RowMapper<Map<String, Object>>(){ |
| 106 | @Override | 133 | @Override |
| 107 | public Map<String, Object> mapRow(ResultSet rs, int rowNum) throws SQLException { | 134 | public Map<String, Object> mapRow(ResultSet rs, int rowNum) throws SQLException { |
| 108 | Map<String, Object> m=new HashMap<String,Object>(); | 135 | Map<String, Object> m=new HashMap<String,Object>(); |
| 136 | + m.put("state", rs.getString("start_opt")); | ||
| 109 | m.put("company", rs.getString("company")); | 137 | m.put("company", rs.getString("company")); |
| 110 | m.put("companyName", getGs(rs.getString("company"))); | 138 | m.put("companyName", getGs(rs.getString("company"))); |
| 111 | m.put("lineCode",rs.getString("line_code")); | 139 | m.put("lineCode",rs.getString("line_code")); |
| @@ -116,6 +144,56 @@ public class BigdateService { | @@ -116,6 +144,56 @@ public class BigdateService { | ||
| 116 | return m; | 144 | return m; |
| 117 | } | 145 | } |
| 118 | }); | 146 | }); |
| 147 | + Date d=new Date(); | ||
| 148 | + SimpleDateFormat hm=new SimpleDateFormat("HH:mm"); | ||
| 149 | + SimpleDateFormat ymd=new SimpleDateFormat("yyyy-MM-dd"); | ||
| 150 | + | ||
| 151 | + String qqrq=ymd.format(d); | ||
| 152 | + String qqsj=hm.format(d); | ||
| 153 | + String qqsjs[]=qqsj.split(":"); | ||
| 154 | + Date nDate=new Date(); | ||
| 155 | + Calendar calendar = Calendar.getInstance(); | ||
| 156 | + calendar.setTime(nDate); | ||
| 157 | + calendar.add(Calendar.DAY_OF_MONTH, -1); | ||
| 158 | + Date dBefore = calendar.getTime(); | ||
| 159 | + String qqrqbefore =ymd.format(dBefore); | ||
| 160 | + int qqsjtime=Integer.parseInt(qqsjs[0])*60+Integer.parseInt(qqsjs[1]); | ||
| 161 | + Map<String, Long> endMap1=getEndtime(qqrqbefore); | ||
| 162 | + Map<String, Long> endMap2=getEndtime(qqrq); | ||
| 163 | + | ||
| 164 | + for (int i = 0; i < list.size(); i++) { | ||
| 165 | + Map<String, Object> m=list.get(i); | ||
| 166 | + int fcsjtime=0; | ||
| 167 | + if(m.get("state")!=null){ | ||
| 168 | + String start_opt[]=m.get("state").toString().split(":"); | ||
| 169 | + fcsjtime=Integer.parseInt(start_opt[0])*60+Integer.parseInt(start_opt[1]); | ||
| 170 | + } | ||
| 171 | + //请求时间小于翻班时间 营运日期当做请求日期的前一天。 | ||
| 172 | + long maxtime=d.getTime(); | ||
| 173 | + String yyzt=""; | ||
| 174 | + if(qqsjtime<fcsjtime){ | ||
| 175 | + if(endMap1.get(m.get("lineCode").toString())!=null){ | ||
| 176 | + if(endMap1.get(m.get("lineCode").toString())>=maxtime){ | ||
| 177 | + yyzt="营运"; | ||
| 178 | + }else{ | ||
| 179 | + yyzt="未营运"; | ||
| 180 | + } | ||
| 181 | + }else{ | ||
| 182 | + yyzt="未营运"; | ||
| 183 | + } | ||
| 184 | + }else{ | ||
| 185 | + if(endMap2.get(m.get("lineCode").toString())!=null){ | ||
| 186 | + if(endMap2.get(m.get("lineCode").toString())>=maxtime){ | ||
| 187 | + yyzt="营运"; | ||
| 188 | + }else{ | ||
| 189 | + yyzt="未营运"; | ||
| 190 | + } | ||
| 191 | + }else{ | ||
| 192 | + yyzt="未营运"; | ||
| 193 | + } | ||
| 194 | + } | ||
| 195 | + m.put("state", yyzt); | ||
| 196 | + } | ||
| 119 | return list; | 197 | return list; |
| 120 | } | 198 | } |
| 121 | 199 | ||
| @@ -123,14 +201,18 @@ public class BigdateService { | @@ -123,14 +201,18 @@ public class BigdateService { | ||
| 123 | @GET | 201 | @GET |
| 124 | @Path("/line/company/{companyId}") | 202 | @Path("/line/company/{companyId}") |
| 125 | public List<Map<String, Object>> findLineByCompany(@PathParam("companyId") String companyId) { | 203 | public List<Map<String, Object>> findLineByCompany(@PathParam("companyId") String companyId) { |
| 126 | - String sql="SELECT company,line_code,name,level,shanghai_linecode, nature from bsth_c_line where " | ||
| 127 | - + " shanghai_linecode is not null and shanghai_linecode !='' and destroy=0 and remove=0 " | ||
| 128 | - + " and company = '"+companyId+"'"; | 204 | + String sql="SELECT b.start_opt,a.company,a.line_code,a.name,a.level," |
| 205 | + + " a.shanghai_linecode, a.nature from " | ||
| 206 | + + " bsth_c_line a left join bsth_c_line_config b " | ||
| 207 | + + " on a.id=b.line where " | ||
| 208 | + + " a.shanghai_linecode is not null and a.shanghai_linecode !='' and a.destroy=0 " | ||
| 209 | + + " and a.remove=0 and a.company = '"+companyId+"'"; | ||
| 129 | List<Map<String, Object>> list=jdbcTemplate.query(sql, | 210 | List<Map<String, Object>> list=jdbcTemplate.query(sql, |
| 130 | new RowMapper<Map<String, Object>>(){ | 211 | new RowMapper<Map<String, Object>>(){ |
| 131 | @Override | 212 | @Override |
| 132 | public Map<String, Object> mapRow(ResultSet rs, int rowNum) throws SQLException { | 213 | public Map<String, Object> mapRow(ResultSet rs, int rowNum) throws SQLException { |
| 133 | Map<String, Object> m=new HashMap<String,Object>(); | 214 | Map<String, Object> m=new HashMap<String,Object>(); |
| 215 | + m.put("state", rs.getString("start_opt")); | ||
| 134 | m.put("company", rs.getString("company")); | 216 | m.put("company", rs.getString("company")); |
| 135 | m.put("companyName", getGs(rs.getString("company"))); | 217 | m.put("companyName", getGs(rs.getString("company"))); |
| 136 | m.put("lineCode",rs.getString("line_code")); | 218 | m.put("lineCode",rs.getString("line_code")); |
| @@ -141,20 +223,74 @@ public class BigdateService { | @@ -141,20 +223,74 @@ public class BigdateService { | ||
| 141 | return m; | 223 | return m; |
| 142 | } | 224 | } |
| 143 | }); | 225 | }); |
| 226 | + Date d=new Date(); | ||
| 227 | + SimpleDateFormat hm=new SimpleDateFormat("HH:mm"); | ||
| 228 | + SimpleDateFormat ymd=new SimpleDateFormat("yyyy-MM-dd"); | ||
| 229 | + | ||
| 230 | + String qqrq=ymd.format(d); | ||
| 231 | + String qqsj=hm.format(d); | ||
| 232 | + String qqsjs[]=qqsj.split(":"); | ||
| 233 | + Date nDate=new Date(); | ||
| 234 | + Calendar calendar = Calendar.getInstance(); | ||
| 235 | + calendar.setTime(nDate); | ||
| 236 | + calendar.add(Calendar.DAY_OF_MONTH, -1); | ||
| 237 | + Date dBefore = calendar.getTime(); | ||
| 238 | + String qqrqbefore =ymd.format(dBefore); | ||
| 239 | + int qqsjtime=Integer.parseInt(qqsjs[0])*60+Integer.parseInt(qqsjs[1]); | ||
| 240 | + Map<String, Long> endMap1=getEndtime(qqrqbefore); | ||
| 241 | + Map<String, Long> endMap2=getEndtime(qqrq); | ||
| 242 | + | ||
| 243 | + for (int i = 0; i < list.size(); i++) { | ||
| 244 | + Map<String, Object> m=list.get(i); | ||
| 245 | + int fcsjtime=0; | ||
| 246 | + if(m.get("state")!=null){ | ||
| 247 | + String start_opt[]=m.get("state").toString().split(":"); | ||
| 248 | + fcsjtime=Integer.parseInt(start_opt[0])*60+Integer.parseInt(start_opt[1]); | ||
| 249 | + } | ||
| 250 | + //请求时间小于翻班时间 营运日期当做请求日期的前一天。 | ||
| 251 | + long maxtime=d.getTime(); | ||
| 252 | + String yyzt=""; | ||
| 253 | + if(qqsjtime<fcsjtime){ | ||
| 254 | + if(endMap1.get(m.get("lineCode").toString())!=null){ | ||
| 255 | + if(endMap1.get(m.get("lineCode").toString())>=maxtime){ | ||
| 256 | + yyzt="营运"; | ||
| 257 | + }else{ | ||
| 258 | + yyzt="未营运"; | ||
| 259 | + } | ||
| 260 | + }else{ | ||
| 261 | + yyzt="未营运"; | ||
| 262 | + } | ||
| 263 | + }else{ | ||
| 264 | + if(endMap2.get(m.get("lineCode").toString())!=null){ | ||
| 265 | + if(endMap2.get(m.get("lineCode").toString())>=maxtime){ | ||
| 266 | + yyzt="营运"; | ||
| 267 | + }else{ | ||
| 268 | + yyzt="未营运"; | ||
| 269 | + } | ||
| 270 | + }else{ | ||
| 271 | + yyzt="未营运"; | ||
| 272 | + } | ||
| 273 | + } | ||
| 274 | + m.put("state", yyzt); | ||
| 275 | + } | ||
| 144 | return list; | 276 | return list; |
| 145 | } | 277 | } |
| 146 | 278 | ||
| 147 | @GET | 279 | @GET |
| 148 | @Path("/line/{lineCode}") | 280 | @Path("/line/{lineCode}") |
| 149 | public List<Map<String, Object>> findLineByCode(@PathParam("lineCode") String lineCode) { | 281 | public List<Map<String, Object>> findLineByCode(@PathParam("lineCode") String lineCode) { |
| 150 | - String sql="SELECT company,line_code,name,level,shanghai_linecode, nature from bsth_c_line where " | ||
| 151 | - + " shanghai_linecode is not null and shanghai_linecode !='' and destroy=0 and remove=0 " | ||
| 152 | - + " and line_code = '"+lineCode+"'"; | 282 | + String sql="SELECT b.start_opt,a.company,a.line_code,a.name,a.level," |
| 283 | + + " a.shanghai_linecode, a.nature from " | ||
| 284 | + + " bsth_c_line a left join bsth_c_line_config b " | ||
| 285 | + + " on a.id=b.line where " | ||
| 286 | + + " a.shanghai_linecode is not null and a.shanghai_linecode !='' and a.destroy=0 " | ||
| 287 | + + " and a.remove=0 and a.line_code = '"+lineCode+"'"; | ||
| 153 | List<Map<String, Object>> list=jdbcTemplate.query(sql, | 288 | List<Map<String, Object>> list=jdbcTemplate.query(sql, |
| 154 | new RowMapper<Map<String, Object>>(){ | 289 | new RowMapper<Map<String, Object>>(){ |
| 155 | @Override | 290 | @Override |
| 156 | public Map<String, Object> mapRow(ResultSet rs, int rowNum) throws SQLException { | 291 | public Map<String, Object> mapRow(ResultSet rs, int rowNum) throws SQLException { |
| 157 | Map<String, Object> m=new HashMap<String,Object>(); | 292 | Map<String, Object> m=new HashMap<String,Object>(); |
| 293 | + m.put("state", rs.getString("start_opt")); | ||
| 158 | m.put("company", rs.getString("company")); | 294 | m.put("company", rs.getString("company")); |
| 159 | m.put("companyName", getGs(rs.getString("company"))); | 295 | m.put("companyName", getGs(rs.getString("company"))); |
| 160 | m.put("lineCode",rs.getString("line_code")); | 296 | m.put("lineCode",rs.getString("line_code")); |
| @@ -165,20 +301,74 @@ public class BigdateService { | @@ -165,20 +301,74 @@ public class BigdateService { | ||
| 165 | return m; | 301 | return m; |
| 166 | } | 302 | } |
| 167 | }); | 303 | }); |
| 304 | + Date d=new Date(); | ||
| 305 | + SimpleDateFormat hm=new SimpleDateFormat("HH:mm"); | ||
| 306 | + SimpleDateFormat ymd=new SimpleDateFormat("yyyy-MM-dd"); | ||
| 307 | + | ||
| 308 | + String qqrq=ymd.format(d); | ||
| 309 | + String qqsj=hm.format(d); | ||
| 310 | + String qqsjs[]=qqsj.split(":"); | ||
| 311 | + Date nDate=new Date(); | ||
| 312 | + Calendar calendar = Calendar.getInstance(); | ||
| 313 | + calendar.setTime(nDate); | ||
| 314 | + calendar.add(Calendar.DAY_OF_MONTH, -1); | ||
| 315 | + Date dBefore = calendar.getTime(); | ||
| 316 | + String qqrqbefore =ymd.format(dBefore); | ||
| 317 | + int qqsjtime=Integer.parseInt(qqsjs[0])*60+Integer.parseInt(qqsjs[1]); | ||
| 318 | + Map<String, Long> endMap1=getEndtime(qqrqbefore); | ||
| 319 | + Map<String, Long> endMap2=getEndtime(qqrq); | ||
| 320 | + | ||
| 321 | + for (int i = 0; i < list.size(); i++) { | ||
| 322 | + Map<String, Object> m=list.get(i); | ||
| 323 | + int fcsjtime=0; | ||
| 324 | + if(m.get("state")!=null){ | ||
| 325 | + String start_opt[]=m.get("state").toString().split(":"); | ||
| 326 | + fcsjtime=Integer.parseInt(start_opt[0])*60+Integer.parseInt(start_opt[1]); | ||
| 327 | + } | ||
| 328 | + //请求时间小于翻班时间 营运日期当做请求日期的前一天。 | ||
| 329 | + long maxtime=d.getTime(); | ||
| 330 | + String yyzt=""; | ||
| 331 | + if(qqsjtime<fcsjtime){ | ||
| 332 | + if(endMap1.get(m.get("lineCode").toString())!=null){ | ||
| 333 | + if(endMap1.get(m.get("lineCode").toString())>=maxtime){ | ||
| 334 | + yyzt="营运"; | ||
| 335 | + }else{ | ||
| 336 | + yyzt="未营运"; | ||
| 337 | + } | ||
| 338 | + }else{ | ||
| 339 | + yyzt="未营运"; | ||
| 340 | + } | ||
| 341 | + }else{ | ||
| 342 | + if(endMap2.get(m.get("lineCode").toString())!=null){ | ||
| 343 | + if(endMap2.get(m.get("lineCode").toString())>=maxtime){ | ||
| 344 | + yyzt="营运"; | ||
| 345 | + }else{ | ||
| 346 | + yyzt="未营运"; | ||
| 347 | + } | ||
| 348 | + }else{ | ||
| 349 | + yyzt="未营运"; | ||
| 350 | + } | ||
| 351 | + } | ||
| 352 | + m.put("state", yyzt); | ||
| 353 | + } | ||
| 168 | return list; | 354 | return list; |
| 169 | } | 355 | } |
| 170 | 356 | ||
| 171 | @GET | 357 | @GET |
| 172 | @Path("/line/level/{level}") | 358 | @Path("/line/level/{level}") |
| 173 | public List<Map<String, Object>> findLineByLevle(@PathParam("level") String level) { | 359 | public List<Map<String, Object>> findLineByLevle(@PathParam("level") String level) { |
| 174 | - String sql="SELECT company,line_code,name,level,shanghai_linecode, nature from bsth_c_line where " | ||
| 175 | - + " shanghai_linecode is not null and shanghai_linecode !='' and destroy=0 and remove=0 " | ||
| 176 | - + " and level = '"+level+"'"; | 360 | + String sql="SELECT b.start_opt,a.company,a.line_code,a.name,a.level," |
| 361 | + + " a.shanghai_linecode, a.nature from " | ||
| 362 | + + " bsth_c_line a left join bsth_c_line_config b " | ||
| 363 | + + " on a.id=b.line where " | ||
| 364 | + + " a.shanghai_linecode is not null and a.shanghai_linecode !='' and a.destroy=0 " | ||
| 365 | + + " and a.remove=0 and a.level = '"+level+"'"; | ||
| 177 | List<Map<String, Object>> list=jdbcTemplate.query(sql, | 366 | List<Map<String, Object>> list=jdbcTemplate.query(sql, |
| 178 | new RowMapper<Map<String, Object>>(){ | 367 | new RowMapper<Map<String, Object>>(){ |
| 179 | @Override | 368 | @Override |
| 180 | public Map<String, Object> mapRow(ResultSet rs, int rowNum) throws SQLException { | 369 | public Map<String, Object> mapRow(ResultSet rs, int rowNum) throws SQLException { |
| 181 | Map<String, Object> m=new HashMap<String,Object>(); | 370 | Map<String, Object> m=new HashMap<String,Object>(); |
| 371 | + m.put("state", rs.getString("start_opt")); | ||
| 182 | m.put("company", rs.getString("company")); | 372 | m.put("company", rs.getString("company")); |
| 183 | m.put("companyName", getGs(rs.getString("company"))); | 373 | m.put("companyName", getGs(rs.getString("company"))); |
| 184 | m.put("lineCode",rs.getString("line_code")); | 374 | m.put("lineCode",rs.getString("line_code")); |
| @@ -189,6 +379,56 @@ public class BigdateService { | @@ -189,6 +379,56 @@ public class BigdateService { | ||
| 189 | return m; | 379 | return m; |
| 190 | } | 380 | } |
| 191 | }); | 381 | }); |
| 382 | + Date d=new Date(); | ||
| 383 | + SimpleDateFormat hm=new SimpleDateFormat("HH:mm"); | ||
| 384 | + SimpleDateFormat ymd=new SimpleDateFormat("yyyy-MM-dd"); | ||
| 385 | + | ||
| 386 | + String qqrq=ymd.format(d); | ||
| 387 | + String qqsj=hm.format(d); | ||
| 388 | + String qqsjs[]=qqsj.split(":"); | ||
| 389 | + Date nDate=new Date(); | ||
| 390 | + Calendar calendar = Calendar.getInstance(); | ||
| 391 | + calendar.setTime(nDate); | ||
| 392 | + calendar.add(Calendar.DAY_OF_MONTH, -1); | ||
| 393 | + Date dBefore = calendar.getTime(); | ||
| 394 | + String qqrqbefore =ymd.format(dBefore); | ||
| 395 | + int qqsjtime=Integer.parseInt(qqsjs[0])*60+Integer.parseInt(qqsjs[1]); | ||
| 396 | + Map<String, Long> endMap1=getEndtime(qqrqbefore); | ||
| 397 | + Map<String, Long> endMap2=getEndtime(qqrq); | ||
| 398 | + | ||
| 399 | + for (int i = 0; i < list.size(); i++) { | ||
| 400 | + Map<String, Object> m=list.get(i); | ||
| 401 | + int fcsjtime=0; | ||
| 402 | + if(m.get("state")!=null){ | ||
| 403 | + String start_opt[]=m.get("state").toString().split(":"); | ||
| 404 | + fcsjtime=Integer.parseInt(start_opt[0])*60+Integer.parseInt(start_opt[1]); | ||
| 405 | + } | ||
| 406 | + //请求时间小于翻班时间 营运日期当做请求日期的前一天。 | ||
| 407 | + long maxtime=d.getTime(); | ||
| 408 | + String yyzt=""; | ||
| 409 | + if(qqsjtime<fcsjtime){ | ||
| 410 | + if(endMap1.get(m.get("lineCode").toString())!=null){ | ||
| 411 | + if(endMap1.get(m.get("lineCode").toString())>=maxtime){ | ||
| 412 | + yyzt="营运"; | ||
| 413 | + }else{ | ||
| 414 | + yyzt="未营运"; | ||
| 415 | + } | ||
| 416 | + }else{ | ||
| 417 | + yyzt="未营运"; | ||
| 418 | + } | ||
| 419 | + }else{ | ||
| 420 | + if(endMap2.get(m.get("lineCode").toString())!=null){ | ||
| 421 | + if(endMap2.get(m.get("lineCode").toString())>=maxtime){ | ||
| 422 | + yyzt="营运"; | ||
| 423 | + }else{ | ||
| 424 | + yyzt="未营运"; | ||
| 425 | + } | ||
| 426 | + }else{ | ||
| 427 | + yyzt="未营运"; | ||
| 428 | + } | ||
| 429 | + } | ||
| 430 | + m.put("state", yyzt); | ||
| 431 | + } | ||
| 192 | return list; | 432 | return list; |
| 193 | } | 433 | } |
| 194 | /* | 434 | /* |
| @@ -270,6 +510,91 @@ public class BigdateService { | @@ -270,6 +510,91 @@ public class BigdateService { | ||
| 270 | */ | 510 | */ |
| 271 | 511 | ||
| 272 | /* | 512 | /* |
| 513 | + * 线路配人接口开始 | ||
| 514 | + */ | ||
| 515 | + @GET | ||
| 516 | + @Path("/linePerson/{type}/date/{date}") | ||
| 517 | + public List<Map<String, Object>> findLinePersonByDate(@PathParam("type") String type,@PathParam("date") String date) { | ||
| 518 | + String sql=""; | ||
| 519 | + if(type.equals("all")){ | ||
| 520 | + sql="select t.date,t.gsdm,t.xl,t.xl_name,t.jhprz as jhpr,t.sjpr" | ||
| 521 | + + " from bsth_c_calc_count t where t.date='"+date+"'"; | ||
| 522 | + } | ||
| 523 | + if(type.equals("actual")){ | ||
| 524 | + sql="select t.date,t.gsdm,t.xl,t.xl_name,t.jhprss as jhpr,t.sjpr" | ||
| 525 | + + " from bsth_c_calc_count t where t.date='"+date+"'"; | ||
| 526 | + } | ||
| 527 | + List<Map<String, Object>> list=jdbcTemplate.query(sql, | ||
| 528 | + new RowMapper<Map<String, Object>>(){ | ||
| 529 | + @Override | ||
| 530 | + public Map<String, Object> mapRow(ResultSet rs, int rowNum) throws SQLException { | ||
| 531 | + Map<String, Object> m=new HashMap<String,Object>(); | ||
| 532 | + m.put("date", rs.getString("date")); | ||
| 533 | + m.put("company", rs.getString("gsdm")); | ||
| 534 | + m.put("companyName", getGs(rs.getString("gsdm"))); | ||
| 535 | + m.put("lineCode",rs.getString("xl")); | ||
| 536 | + m.put("lineName", rs.getString("xl_name")); | ||
| 537 | + String jhpr=rs.getString("jhpr"); | ||
| 538 | + m.put("jhjsy", jhpr.split("/")[0]); | ||
| 539 | + m.put("jhspy", jhpr.split("/")[1]); | ||
| 540 | + String sjpr= rs.getString("sjpr"); | ||
| 541 | + m.put("sjjsy", sjpr.split("/")[0]); | ||
| 542 | + m.put("sjspy", sjpr.split("/")[1]); | ||
| 543 | + return m; | ||
| 544 | + } | ||
| 545 | + }); | ||
| 546 | + | ||
| 547 | + return list; | ||
| 548 | + } | ||
| 549 | + | ||
| 550 | + | ||
| 551 | + @GET | ||
| 552 | + @Path("/linePerson/{type}/date/{date}/line/{line}") | ||
| 553 | + public List<Map<String, Object>> findLinePersonByDateLine(@PathParam("type") String type,@PathParam("date") String date, | ||
| 554 | + @PathParam("line") String line) { | ||
| 555 | + String sql=""; | ||
| 556 | + if(type.equals("all")){ | ||
| 557 | + sql="select t.date,t.gsdm,t.xl,t.xl_name,t.jhprz as jhpr,t.sjpr" | ||
| 558 | + + " from bsth_c_calc_count t where t.date='"+date+"'" | ||
| 559 | + + " and xl ='"+line+"'"; | ||
| 560 | + } | ||
| 561 | + if(type.equals("actual")){ | ||
| 562 | + sql="select t.date,t.gsdm,t.xl,t.xl_name,t.jhprss as jhpr,t.sjpr" | ||
| 563 | + + " from bsth_c_calc_count t where t.date='"+date+"'" | ||
| 564 | + + " and xl ='"+line+"'"; | ||
| 565 | + } | ||
| 566 | + List<Map<String, Object>> list=jdbcTemplate.query(sql, | ||
| 567 | + new RowMapper<Map<String, Object>>(){ | ||
| 568 | + @Override | ||
| 569 | + public Map<String, Object> mapRow(ResultSet rs, int rowNum) throws SQLException { | ||
| 570 | + Map<String, Object> m=new HashMap<String,Object>(); | ||
| 571 | + m.put("date", rs.getString("date")); | ||
| 572 | + m.put("company", rs.getString("gsdm")); | ||
| 573 | + m.put("companyName", getGs(rs.getString("gsdm"))); | ||
| 574 | + m.put("lineCode",rs.getString("xl")); | ||
| 575 | + m.put("lineName", rs.getString("xl_name")); | ||
| 576 | + String jhpr=rs.getString("jhpr"); | ||
| 577 | + m.put("jhjsy", jhpr.split("/")[0]); | ||
| 578 | + m.put("jhspy", jhpr.split("/")[1]); | ||
| 579 | + String sjpr= rs.getString("sjpr"); | ||
| 580 | + m.put("sjjsy", sjpr.split("/")[0]); | ||
| 581 | + m.put("sjspy", sjpr.split("/")[1]); | ||
| 582 | + return m; | ||
| 583 | + } | ||
| 584 | + }); | ||
| 585 | + | ||
| 586 | + return list; | ||
| 587 | + } | ||
| 588 | + | ||
| 589 | + | ||
| 590 | + | ||
| 591 | + | ||
| 592 | + /* | ||
| 593 | + * 线路配人接口结束 | ||
| 594 | + */ | ||
| 595 | + | ||
| 596 | + | ||
| 597 | + /* | ||
| 273 | * 线路班次接口开始 | 598 | * 线路班次接口开始 |
| 274 | */ | 599 | */ |
| 275 | @GET | 600 | @GET |
| @@ -597,17 +922,18 @@ public class BigdateService { | @@ -597,17 +922,18 @@ public class BigdateService { | ||
| 597 | *安全驾驶接口开始 | 922 | *安全驾驶接口开始 |
| 598 | */ | 923 | */ |
| 599 | @GET | 924 | @GET |
| 600 | - @Path("/safedriving/date/{date}") | ||
| 601 | - public List<Map<String, Object>> findSafedriving(@PathParam("date") String date) { | ||
| 602 | - String accidentAll= GetHttpInterface.getHttpInterface("http://180.166.5.82:9006/safedriving/safedrivingInterface?StarTime="+date); | 925 | + @Path("/safedriving/starDate/{starDate}/endDate/{endDate}") |
| 926 | + public List<Map<String, Object>> findSafedriving(@PathParam("starDate") String starDate, | ||
| 927 | + @PathParam("endDate") String endDate) { | ||
| 928 | + String accidentAll= GetHttpInterface.getHttpInterface("http://180.166.5.82:9006/safedriving/safedrivingInterface?StarTime="+starDate+"&EndTime="+endDate); | ||
| 603 | List<Map<String, Object>> list=(List<Map<String, Object>>) JSONObject.parse(accidentAll); | 929 | List<Map<String, Object>> list=(List<Map<String, Object>>) JSONObject.parse(accidentAll); |
| 604 | return list; | 930 | return list; |
| 605 | } | 931 | } |
| 606 | @GET | 932 | @GET |
| 607 | - @Path("/safedriving/date/{date}/line/{line}") | ||
| 608 | - public List<Map<String, Object>> findSafedrivingByLine(@PathParam("date") String date, | ||
| 609 | - @PathParam("line") String line) { | ||
| 610 | - String accidentAll= GetHttpInterface.getHttpInterface("http://180.166.5.82:9006/safedriving/safedrivingInterface?StarTime="+date | 933 | + @Path("/safedriving/starDate/{starDate}/endDate/{endDate}/line/{line}") |
| 934 | + public List<Map<String, Object>> findSafedrivingByLine(@PathParam("starDate") String starDate, | ||
| 935 | + @PathParam("endDate") String endDate,@PathParam("line") String line) { | ||
| 936 | + String accidentAll= GetHttpInterface.getHttpInterface("http://180.166.5.82:9006/safedriving/safedrivingInterface?StarTime="+starDate+"&EndTime="+endDate | ||
| 611 | +"&LineId="+line); | 937 | +"&LineId="+line); |
| 612 | List<Map<String, Object>> list=(List<Map<String, Object>>) JSONObject.parse(accidentAll); | 938 | List<Map<String, Object>> list=(List<Map<String, Object>>) JSONObject.parse(accidentAll); |
| 613 | return list; | 939 | return list; |