Commit df01d8ebf3bae6624a95d2239fe6eec8d80366d4
1 parent
d2f2a2a8
电量表计算 时刻统计表计算
Showing
5 changed files
with
700 additions
and
12 deletions
src/main/java/com/bsth/controller/oil/DlbController.java
| @@ -84,8 +84,14 @@ public class DlbController extends BaseController<Dlb, Integer>{ | @@ -84,8 +84,14 @@ public class DlbController extends BaseController<Dlb, Integer>{ | ||
| 84 | 84 | ||
| 85 | 85 | ||
| 86 | @RequestMapping(value = "/obtain",method = RequestMethod.GET) | 86 | @RequestMapping(value = "/obtain",method = RequestMethod.GET) |
| 87 | - public Map<String, Object> obtain(@RequestParam Map<String, Object> map){ | ||
| 88 | - Map<String, Object> list=service.obtain(map); | 87 | + public Map<String, Object> obtain(@RequestParam Map<String, Object> map) throws Exception{ |
| 88 | + Map<String, Object> list=new HashMap<String, Object>(); | ||
| 89 | + try { | ||
| 90 | + list = service.obtain(map); | ||
| 91 | + } catch (Exception e) { | ||
| 92 | + // TODO Auto-generated catch block | ||
| 93 | + throw e; | ||
| 94 | + } | ||
| 89 | return list; | 95 | return list; |
| 90 | } | 96 | } |
| 91 | 97 |
src/main/java/com/bsth/entity/oil/Dlb.java
| @@ -54,6 +54,7 @@ public class Dlb { | @@ -54,6 +54,7 @@ public class Dlb { | ||
| 54 | private String edituser; | 54 | private String edituser; |
| 55 | private Date edittime; | 55 | private Date edittime; |
| 56 | private Date createtime; | 56 | private Date createtime; |
| 57 | + private Date updatetime; | ||
| 57 | private int nylx; | 58 | private int nylx; |
| 58 | //进场顺序(根据最先出场和最后进场来关联车辆的存电量) | 59 | //进场顺序(根据最先出场和最后进场来关联车辆的存电量) |
| 59 | private int jcsx; | 60 | private int jcsx; |
| @@ -374,4 +375,14 @@ public class Dlb { | @@ -374,4 +375,14 @@ public class Dlb { | ||
| 374 | public void setFgsname(String fgsname) { | 375 | public void setFgsname(String fgsname) { |
| 375 | this.fgsname = fgsname; | 376 | this.fgsname = fgsname; |
| 376 | } | 377 | } |
| 378 | + | ||
| 379 | + public Date getUpdatetime() { | ||
| 380 | + return updatetime; | ||
| 381 | + } | ||
| 382 | + | ||
| 383 | + public void setUpdatetime(Date updatetime) { | ||
| 384 | + this.updatetime = updatetime; | ||
| 385 | + } | ||
| 386 | + | ||
| 387 | + | ||
| 377 | } | 388 | } |
src/main/java/com/bsth/service/oil/DlbService.java
| @@ -7,7 +7,7 @@ import com.bsth.entity.oil.Dlb; | @@ -7,7 +7,7 @@ import com.bsth.entity.oil.Dlb; | ||
| 7 | import com.bsth.service.BaseService; | 7 | import com.bsth.service.BaseService; |
| 8 | 8 | ||
| 9 | public interface DlbService extends BaseService<Dlb, Integer>{ | 9 | public interface DlbService extends BaseService<Dlb, Integer>{ |
| 10 | - Map<String, Object> obtain(Map<String, Object> map); | 10 | + Map<String, Object> obtain(Map<String, Object> map) throws Exception; |
| 11 | 11 | ||
| 12 | Map<String, Object> sort(Map<String, Object> map); | 12 | Map<String, Object> sort(Map<String, Object> map); |
| 13 | 13 |
src/main/java/com/bsth/service/oil/impl/DlbServiceImpl.java
| @@ -2,6 +2,8 @@ package com.bsth.service.oil.impl; | @@ -2,6 +2,8 @@ package com.bsth.service.oil.impl; | ||
| 2 | 2 | ||
| 3 | 3 | ||
| 4 | 4 | ||
| 5 | +import java.sql.ResultSet; | ||
| 6 | +import java.sql.SQLException; | ||
| 5 | import java.text.DecimalFormat; | 7 | import java.text.DecimalFormat; |
| 6 | import java.text.ParseException; | 8 | import java.text.ParseException; |
| 7 | import java.text.SimpleDateFormat; | 9 | import java.text.SimpleDateFormat; |
| @@ -22,6 +24,7 @@ import org.springframework.beans.factory.annotation.Autowired; | @@ -22,6 +24,7 @@ import org.springframework.beans.factory.annotation.Autowired; | ||
| 22 | import org.springframework.data.domain.Sort; | 24 | import org.springframework.data.domain.Sort; |
| 23 | import org.springframework.data.domain.Sort.Direction; | 25 | import org.springframework.data.domain.Sort.Direction; |
| 24 | import org.springframework.jdbc.core.JdbcTemplate; | 26 | import org.springframework.jdbc.core.JdbcTemplate; |
| 27 | +import org.springframework.jdbc.core.RowMapper; | ||
| 25 | import org.springframework.stereotype.Service; | 28 | import org.springframework.stereotype.Service; |
| 26 | 29 | ||
| 27 | import com.alibaba.fastjson.JSONArray; | 30 | import com.alibaba.fastjson.JSONArray; |
| @@ -211,7 +214,7 @@ public class DlbServiceImpl extends BaseServiceImpl<Dlb,Integer> implements DlbS | @@ -211,7 +214,7 @@ public class DlbServiceImpl extends BaseServiceImpl<Dlb,Integer> implements DlbS | ||
| 211 | * 获取进存电信息 | 214 | * 获取进存电信息 |
| 212 | * @Transactional 回滚事物 | 215 | * @Transactional 回滚事物 |
| 213 | */ | 216 | */ |
| 214 | - @Transactional | 217 | + /*@Transactional |
| 215 | @Override | 218 | @Override |
| 216 | public Map<String, Object> obtain(Map<String, Object> map2) { | 219 | public Map<String, Object> obtain(Map<String, Object> map2) { |
| 217 | List<Cars> carsList=carsRepository.findCars(); | 220 | List<Cars> carsList=carsRepository.findCars(); |
| @@ -224,6 +227,16 @@ public class DlbServiceImpl extends BaseServiceImpl<Dlb,Integer> implements DlbS | @@ -224,6 +227,16 @@ public class DlbServiceImpl extends BaseServiceImpl<Dlb,Integer> implements DlbS | ||
| 224 | if(map2.get("ssgsdm_like")!=null){ | 227 | if(map2.get("ssgsdm_like")!=null){ |
| 225 | gsbm=map2.get("ssgsdm_like").toString(); | 228 | gsbm=map2.get("ssgsdm_like").toString(); |
| 226 | } | 229 | } |
| 230 | + | ||
| 231 | + String nbbm=""; | ||
| 232 | + if(map2.get("nbbm_eq")!=null){ | ||
| 233 | + nbbm=map2.get("nbbm_eq").toString(); | ||
| 234 | + } | ||
| 235 | + String fgsbm=""; | ||
| 236 | + if(map2.get("fgsdm_like")!=null){ | ||
| 237 | + fgsbm=map2.get("fgsdm_like").toString(); | ||
| 238 | + } | ||
| 239 | + | ||
| 227 | String rq=map2.get("rq").toString(); | 240 | String rq=map2.get("rq").toString(); |
| 228 | String line=""; | 241 | String line=""; |
| 229 | if(map2.get("xlbm_eq")!=null){ | 242 | if(map2.get("xlbm_eq")!=null){ |
| @@ -236,16 +249,16 @@ public class DlbServiceImpl extends BaseServiceImpl<Dlb,Integer> implements DlbS | @@ -236,16 +249,16 @@ public class DlbServiceImpl extends BaseServiceImpl<Dlb,Integer> implements DlbS | ||
| 236 | // TODO Auto-generated method stub | 249 | // TODO Auto-generated method stub |
| 237 | Map<String, Object> newMap=new HashMap<String,Object>(); | 250 | Map<String, Object> newMap=new HashMap<String,Object>(); |
| 238 | //当天DLB信息 | 251 | //当天DLB信息 |
| 239 | - List<Dlb> dlList=repository.obtainDl(rq, gsbm, "", line, "", "nbbm"); | 252 | + List<Dlb> dlList=repository.obtainDl(rq, gsbm, fgsbm, line, nbbm, "nbbm"); |
| 240 | //当天YLXXB信息 | 253 | //当天YLXXB信息 |
| 241 | List<Ylxxb> ylxxList=ylxxbRepository.obtainYlxx(rq,1,gsbm); | 254 | List<Ylxxb> ylxxList=ylxxbRepository.obtainYlxx(rq,1,gsbm); |
| 242 | //当天加电信息表 | 255 | //当天加电信息表 |
| 243 | List<Jdl> jdlList=jdlRepository.JdlList(rq); | 256 | List<Jdl> jdlList=jdlRepository.JdlList(rq); |
| 244 | //前一天所有车辆最后进场班次信息 | 257 | //前一天所有车辆最后进场班次信息 |
| 245 | - List<Dlb> dlListBe=repository.obtainYlbefore(rq, "", "", "", ""); | 258 | + List<Dlb> dlListBe=repository.obtainYlbefore(rq, gsbm, fgsbm, line, nbbm); |
| 246 | List<Cdl> cdyList=cdlRepository.obtainCdl(); | 259 | List<Cdl> cdyList=cdlRepository.obtainCdl(); |
| 247 | //从排班表中计算出行驶的总里程 | 260 | //从排班表中计算出行驶的总里程 |
| 248 | - List<Map<String,Object>> listpb=scheduleRealInfoService.yesterdayDataList(line,rq,"","","",""); | 261 | + List<Map<String,Object>> listpb=scheduleRealInfoService.yesterdayDataList(line, rq, gsbm, fgsbm, "", nbbm); |
| 249 | List<Dlb> addList=new ArrayList<Dlb>(); | 262 | List<Dlb> addList=new ArrayList<Dlb>(); |
| 250 | List<Dlb> updateList=new ArrayList<Dlb>(); | 263 | List<Dlb> updateList=new ArrayList<Dlb>(); |
| 251 | for(int x=0;x<listpb.size();x++){ | 264 | for(int x=0;x<listpb.size();x++){ |
| @@ -371,6 +384,240 @@ public class DlbServiceImpl extends BaseServiceImpl<Dlb,Integer> implements DlbS | @@ -371,6 +384,240 @@ public class DlbServiceImpl extends BaseServiceImpl<Dlb,Integer> implements DlbS | ||
| 371 | newMap.put("status", ResponseCode.ERROR); | 384 | newMap.put("status", ResponseCode.ERROR); |
| 372 | } | 385 | } |
| 373 | return newMap; | 386 | return newMap; |
| 387 | + }*/ | ||
| 388 | + | ||
| 389 | + /** | ||
| 390 | + * 获取进存油信息 | ||
| 391 | + * @Transactional 回滚事物 | ||
| 392 | + */ | ||
| 393 | + @Transactional | ||
| 394 | + @Override | ||
| 395 | + public Map<String, Object> obtain(Map<String, Object> map2) throws Exception{ | ||
| 396 | + Map<String, Object> newMap = new HashMap<String, Object>(); | ||
| 397 | + try { | ||
| 398 | + Date date=new Date(); | ||
| 399 | + List<Cars> carsList = carsRepository.findCars(); | ||
| 400 | + Map<String, Boolean> carsMap = new HashMap<String, Boolean>(); | ||
| 401 | + for (int i = 0; i < carsList.size(); i++) { | ||
| 402 | + Cars c = carsList.get(i); | ||
| 403 | + carsMap.put(c.getInsideCode(), c.getSfdc()); | ||
| 404 | + } | ||
| 405 | + String rq = map2.get("rq").toString(); | ||
| 406 | + String line = ""; | ||
| 407 | + if (map2.get("xlbm_like") != null) { | ||
| 408 | + line = map2.get("xlbm_like").toString().trim(); | ||
| 409 | + } | ||
| 410 | + String gsbm=""; | ||
| 411 | + if(map2.get("ssgsdm_like")!=null){ | ||
| 412 | + gsbm=map2.get("ssgsdm_like").toString(); | ||
| 413 | + } | ||
| 414 | + String fgsbm=""; | ||
| 415 | + if(map2.get("fgsdm_like")!=null){ | ||
| 416 | + fgsbm=map2.get("fgsdm_like").toString(); | ||
| 417 | + } | ||
| 418 | + String nbbm=""; | ||
| 419 | + if(map2.get("nbbm_eq")!=null){ | ||
| 420 | + nbbm=map2.get("nbbm_eq").toString(); | ||
| 421 | + } | ||
| 422 | + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); | ||
| 423 | + // 保留两位小数 | ||
| 424 | + DecimalFormat df = new DecimalFormat("#.00"); | ||
| 425 | + // TODO Auto-generated method stub | ||
| 426 | + // 当天YLB信息 | ||
| 427 | + List<Dlb> dlList = this.listOrderBy(rq,gsbm,fgsbm,line,nbbm,"nbbm"); | ||
| 428 | +// repository.obtainYl(rq,gsbm,fgsbm,line,nbbm,"nbbm"); | ||
| 429 | + // 当天YLXXB信息 | ||
| 430 | + List<Ylxxb> ylxxList = ylxxbRepository.obtainYlxx(rq, 0,gsbm); | ||
| 431 | + // 前一天所有车辆最后进场班次信息 | ||
| 432 | +// List<Ylb> ylListBe = repository.obtainYlbefore(rq, gsbm, fgsbm, line, nbbm); | ||
| 433 | +// List<Dlb> ylListBe =repository.listMaxRqJcsx(rq, gsbm, fgsbm, line, nbbm); | ||
| 434 | +// List<Cyl> clyList = cylRepository.obtainCyl(nbbm,gsbm); | ||
| 435 | + // 从排班表中计算出行驶的总里程 | ||
| 436 | + List<Map<String, Object>> listpb =new ArrayList<Map<String, Object>>(); | ||
| 437 | + List<Map<String, Object>> listpbs=scheduleRealInfoService.yesterdayDataList(line, rq, gsbm, fgsbm, "", nbbm); | ||
| 438 | + List<Jdl> jdlList=jdlRepository.JdlList(rq); | ||
| 439 | + String sxtj=map2.get("sxtj").toString(); | ||
| 440 | + if(sxtj.equals("0")){ | ||
| 441 | + listpb=listpbs; | ||
| 442 | + }else{ | ||
| 443 | + List<Object[]> objectLists=repository.checkNbmmNum(rq, gsbm, fgsbm, line,nbbm); | ||
| 444 | + List<String> stringList=new ArrayList<String>(); | ||
| 445 | + for (int i = 0; i < objectLists.size(); i++) { | ||
| 446 | + String clbm=objectLists.get(i)[0].toString(); | ||
| 447 | + int cs=Integer.parseInt(objectLists.get(i)[1].toString()); | ||
| 448 | + //一车一单 | ||
| 449 | + if(sxtj.equals("1")){ | ||
| 450 | + if(cs==1){ | ||
| 451 | + stringList.add(clbm); | ||
| 452 | + } | ||
| 453 | + } | ||
| 454 | + //一车多单 | ||
| 455 | + if(sxtj.equals("2")){ | ||
| 456 | + if(cs>1){ | ||
| 457 | + stringList.add(clbm); | ||
| 458 | + } | ||
| 459 | + } | ||
| 460 | + } | ||
| 461 | + | ||
| 462 | + for (int i = 0; i < stringList.size(); i++) { | ||
| 463 | + String strNbbm=stringList.get(i); | ||
| 464 | + for (int j = 0; j < listpbs.size(); j++) { | ||
| 465 | + Map<String, Object> map = listpbs.get(j); | ||
| 466 | + String mapNbbm=map.get("clZbh").toString(); | ||
| 467 | + if(strNbbm.equals(mapNbbm)){ | ||
| 468 | + listpb.add(map); | ||
| 469 | + } | ||
| 470 | + } | ||
| 471 | + } | ||
| 472 | + } | ||
| 473 | + | ||
| 474 | + List<Dlb> addList = new ArrayList<Dlb>(); | ||
| 475 | + List<Dlb> updateList = new ArrayList<Dlb>(); | ||
| 476 | + String ins=""; | ||
| 477 | + Map<String, Object> ylMap=new HashMap<String, Object>(); | ||
| 478 | + for (int x = 0; x < listpb.size(); x++) { | ||
| 479 | + String type = "add"; | ||
| 480 | + boolean sfdc = false; | ||
| 481 | + Map<String, Object> map = listpb.get(x); | ||
| 482 | + if (carsMap.get(map.get("clZbh").toString()) != null) { | ||
| 483 | + sfdc = carsMap.get(map.get("clZbh").toString()); | ||
| 484 | + } else { | ||
| 485 | + sfdc = false; | ||
| 486 | + } | ||
| 487 | + if (sfdc) { | ||
| 488 | + // 判断驾驶员驾驶的该车辆是否已经存入了(查出的结果集中日期是相同的,根据驾驶员、内部编号、线路编码判断) | ||
| 489 | + Dlb t = new Dlb(); | ||
| 490 | + for (int k = 0; k < dlList.size(); k++) { | ||
| 491 | + Dlb t1 = dlList.get(k); | ||
| 492 | + if (t1.getNbbm().equals(map.get("clZbh").toString()) | ||
| 493 | + && t1.getJsy().equals(map.get("jGh").toString()) | ||
| 494 | + && t1.getXlbm().equals(map.get("xlBm").toString())) { | ||
| 495 | + t = t1; | ||
| 496 | + type = "update"; | ||
| 497 | + } | ||
| 498 | + } | ||
| 499 | + | ||
| 500 | + // 当日的第一个班次,出场油量等于前一天的最后一个班次的进场油量 | ||
| 501 | + /* if (map.get("seqNumber").toString().equals("1")) { | ||
| 502 | + boolean fage = true; | ||
| 503 | + for (int i = 0; i < ylListBe.size(); i++) { | ||
| 504 | + Ylb ylb = ylListBe.get(i); | ||
| 505 | + if (map.get("clZbh").toString().equals(ylb.getNbbm())) { | ||
| 506 | + if(ylb.getJzyl()>0){ | ||
| 507 | + t.setCzyl(ylb.getJzyl()); | ||
| 508 | + fage = false; | ||
| 509 | + break; | ||
| 510 | + } | ||
| 511 | + | ||
| 512 | + } | ||
| 513 | + } | ||
| 514 | + if (fage) { | ||
| 515 | + for (int y = 0; y < clyList.size(); y++) { | ||
| 516 | + Cyl cyl = clyList.get(y); | ||
| 517 | + if (map.get("clZbh").toString().equals(cyl.getNbbm())) { | ||
| 518 | + if(cyl!=null){ | ||
| 519 | + if(cyl.getCyl()>=0){ | ||
| 520 | + t.setCzyl(cyl.getCyl()); | ||
| 521 | + fage = false; | ||
| 522 | + break; | ||
| 523 | + }else { | ||
| 524 | + if(cyl.getCxrl()!=null){ | ||
| 525 | + if(cyl.getCxrl()>0){ | ||
| 526 | + t.setCzyl(cyl.getCxrl()); | ||
| 527 | + fage = false; | ||
| 528 | + break; | ||
| 529 | + } | ||
| 530 | + } | ||
| 531 | + } | ||
| 532 | + } | ||
| 533 | + } | ||
| 534 | + } | ||
| 535 | + } | ||
| 536 | + if (fage) { | ||
| 537 | + t.setCzyl(0.0); | ||
| 538 | + } | ||
| 539 | + } | ||
| 540 | + */ | ||
| 541 | + Double jzl = 0.0; | ||
| 542 | + //一人一车加注量只匹配一次 | ||
| 543 | + if(ylMap.get(map.get("clZbh").toString()+"_"+ map.get("jGh").toString())!=null){ | ||
| 544 | + | ||
| 545 | + }else{ | ||
| 546 | + // 把当天的YLXXB的加注量设置为当天YLB的加注量(根据车号,驾驶员判断) | ||
| 547 | + for (int j = 0; j < ylxxList.size(); j++) { | ||
| 548 | + Ylxxb ylxxb = ylxxList.get(j); | ||
| 549 | + if (map.get("clZbh").toString().equals(ylxxb.getNbbm()) | ||
| 550 | + && map.get("jGh").toString().equals(ylxxb.getJsy())) { | ||
| 551 | + jzl +=Arith.add(jzl, ylxxb.getJzl()); | ||
| 552 | + } | ||
| 553 | + } | ||
| 554 | + ylMap.put(map.get("clZbh").toString()+"_"+ map.get("jGh").toString(),map.get("xlBm") == null ? "" : map.get("xlBm").toString()); | ||
| 555 | + } | ||
| 556 | + for (int i = 0; i < jdlList.size(); i++) { | ||
| 557 | + Jdl jdl=jdlList.get(i); | ||
| 558 | + if(map.get("clZbh").toString().equals(jdl.getNbbm()) | ||
| 559 | + &&map.get("jGh").toString().equals(jdl.getJsy()) | ||
| 560 | + &&map.get("bCompany").toString().equals(jdl.getFgsBm())){ | ||
| 561 | + jzl+=jdl.getJdl(); | ||
| 562 | + } | ||
| 563 | + } | ||
| 564 | + | ||
| 565 | + t.setCdl(jzl); | ||
| 566 | + t.setCzcd(100.0); | ||
| 567 | + t.setJzcd(100.0); | ||
| 568 | + t.setHd(jzl); | ||
| 569 | + t.setNbbm(map.get("clZbh").toString()); | ||
| 570 | + t.setJsy(map.get("jGh") == null ? "" : map.get("jGh").toString()); | ||
| 571 | + t.setZlc(map.get("totalKilometers") == null ? 0.0 | ||
| 572 | + : Double.parseDouble(map.get("totalKilometers").toString())); | ||
| 573 | + t.setXlbm(map.get("xlBm") == null ? "" : map.get("xlBm").toString()); | ||
| 574 | + t.setJcsx(Integer.parseInt(map.get("seqNumber").toString())); | ||
| 575 | + t.setSsgsdm(map.get("company") == null ? "" : map.get("company").toString()); | ||
| 576 | + t.setFgsdm(map.get("bCompany") == null ? "" : map.get("bCompany").toString()); | ||
| 577 | + t.setJhsj(map.get("fcsj")==null?"":map.get("fcsj").toString()); | ||
| 578 | + t.setRq(sdf.parse(rq)); | ||
| 579 | + | ||
| 580 | + if(!(t.getSsgsdm().equals("") || t.getFgsdm().equals(""))){ | ||
| 581 | + if(type.equals("add")){ | ||
| 582 | + t.setCreatetime(date); | ||
| 583 | + addList.add(t); | ||
| 584 | + }else{ | ||
| 585 | + t.setUpdatetime(date); | ||
| 586 | + updateList.add(t); | ||
| 587 | + ins += t.getId().toString()+","; | ||
| 588 | + } | ||
| 589 | + } | ||
| 590 | +// repository.save(t); | ||
| 591 | + newMap.put("status", ResponseCode.SUCCESS); | ||
| 592 | + | ||
| 593 | + } | ||
| 594 | + } | ||
| 595 | + if(addList.size()>0){ | ||
| 596 | + try { | ||
| 597 | + new BatchSaveUtils<Dlb>().saveList2(addList, Dlb.class); | ||
| 598 | + } catch (Exception e) { | ||
| 599 | + // TODO: handle exception | ||
| 600 | + if(e.getMessage().indexOf("PK_YLB_UK")>0){ | ||
| 601 | + newMap.put("fage", "存在相同数据,数据已经过滤"); | ||
| 602 | + logger.info("获取:存在相同数据,数据已经过滤"); | ||
| 603 | + } | ||
| 604 | + } | ||
| 605 | + | ||
| 606 | + } | ||
| 607 | + | ||
| 608 | + if(updateList.size()>0){ | ||
| 609 | + for (int i = 0; i < updateList.size(); i++) { | ||
| 610 | + repository.save(updateList.get(i)); | ||
| 611 | + } | ||
| 612 | + } | ||
| 613 | + newMap.put("status", ResponseCode.SUCCESS); | ||
| 614 | + } catch (Exception e) { | ||
| 615 | + // TODO Auto-generated catch block | ||
| 616 | + newMap.put("status", ResponseCode.ERROR); | ||
| 617 | + throw e; | ||
| 618 | + } | ||
| 619 | + | ||
| 620 | + return newMap; | ||
| 374 | } | 621 | } |
| 375 | 622 | ||
| 376 | /** | 623 | /** |
| @@ -727,4 +974,43 @@ public class DlbServiceImpl extends BaseServiceImpl<Dlb,Integer> implements DlbS | @@ -727,4 +974,43 @@ public class DlbServiceImpl extends BaseServiceImpl<Dlb,Integer> implements DlbS | ||
| 727 | } | 974 | } |
| 728 | return newMap; | 975 | return newMap; |
| 729 | } | 976 | } |
| 977 | + | ||
| 978 | + public List<Dlb> listOrderBy(String rq,String gsdm, | ||
| 979 | + String fgsdm,String xlbm,String nbbm, | ||
| 980 | + String px) { | ||
| 981 | + // TODO Auto-generated method stub | ||
| 982 | + String sql="SELECT * FROM bsth_c_dlb " | ||
| 983 | + + " where to_days('"+rq+"')=to_days(rq) and ssgsdm like '%"+gsdm+"%' " | ||
| 984 | + + " and fgsdm like '%"+fgsdm+"%'"; | ||
| 985 | + if(xlbm.equals("")){ | ||
| 986 | + sql+= " and xlbm like '%"+xlbm+"%' "; | ||
| 987 | + }else{ | ||
| 988 | + sql+= " and xlbm = '"+xlbm+"' "; | ||
| 989 | + } | ||
| 990 | + | ||
| 991 | + sql += "and nbbm like '%"+nbbm+"%' order by "+px+" asc "; | ||
| 992 | + | ||
| 993 | + List<Dlb> list = jdbcTemplate.query(sql, new RowMapper<Dlb>() { | ||
| 994 | + @Override | ||
| 995 | + public Dlb mapRow(ResultSet arg0, int arg1) throws SQLException { | ||
| 996 | + Dlb y = new Dlb(); | ||
| 997 | + y.setId(arg0.getInt("id")); | ||
| 998 | + return y; | ||
| 999 | + } | ||
| 1000 | + }); | ||
| 1001 | + List<Dlb> lists=new ArrayList<Dlb>(); | ||
| 1002 | + List<Dlb> dlbLists=repository.obtainDl(rq,gsdm,fgsdm,xlbm,nbbm,"jcsx"); | ||
| 1003 | + for (int i = 0; i < list.size(); i++) { | ||
| 1004 | + Dlb t=list.get(i); | ||
| 1005 | + for (int j = 0; j < dlbLists.size(); j++) { | ||
| 1006 | + Dlb t2=dlbLists.get(j); | ||
| 1007 | + if(t.getId().intValue()==t2.getId().intValue()){ | ||
| 1008 | + lists.add(t2); | ||
| 1009 | + break; | ||
| 1010 | + } | ||
| 1011 | + } | ||
| 1012 | + } | ||
| 1013 | + | ||
| 1014 | + return lists; | ||
| 1015 | + } | ||
| 730 | } | 1016 | } |
src/main/java/com/bsth/service/report/impl/ReportServiceImpl.java
| @@ -39,6 +39,8 @@ import java.text.ParseException; | @@ -39,6 +39,8 @@ import java.text.ParseException; | ||
| 39 | import java.text.SimpleDateFormat; | 39 | import java.text.SimpleDateFormat; |
| 40 | import java.util.*; | 40 | import java.util.*; |
| 41 | 41 | ||
| 42 | +import javax.persistence.criteria.CriteriaBuilder.In; | ||
| 43 | + | ||
| 42 | @Service | 44 | @Service |
| 43 | public class ReportServiceImpl implements ReportService{ | 45 | public class ReportServiceImpl implements ReportService{ |
| 44 | 46 | ||
| @@ -893,8 +895,391 @@ public class ReportServiceImpl implements ReportService{ | @@ -893,8 +895,391 @@ public class ReportServiceImpl implements ReportService{ | ||
| 893 | return m; | 895 | return m; |
| 894 | } | 896 | } |
| 895 | }); | 897 | }); |
| 896 | - | ||
| 897 | - List<Map<String, Object>> newList=new ArrayList<Map<String,Object>>(); | 898 | + List<Map<String, Object>> newList=new ArrayList<Map<String,Object>>(); |
| 899 | + int yysxZq=0,yyxxZq=0,tzsxZq=0,tzxxZq=0,minZqcj=0,maxZqcj=0,sxcountZqbc=0,xxcountZqbc=0; //早前 | ||
| 900 | + int yysxZgf=0,yyxxZgf=0,tzsxZgf=0,tzxxZgf=0,minZgfcj=0,maxZgfcj=0,sxcountZgfbc=0,xxcountZgfbc=0;//早高峰 | ||
| 901 | + int yysxZw=0,yyxxZw=0,tzsxZw=0,tzxxZw=0,minZwcj=0,maxZwcj=0,sxcountZwbc=0,xxcountZwbc=0;//中午 | ||
| 902 | + int yysxWgf=0,yyxxWgf=0,tzsxWgf=0,tzxxWgf=0,minWgfcj=0,maxWgfcj=0,sxcountWgfbc=0,xxcountWgfbc=0;//晚高峰 | ||
| 903 | + int yysxWh=0,yyxxWh=0,tzsxWh=0,tzxxWh=0,minWhcj=0,maxWhcj=0,sxcountWhbc=0,xxcountWhbc=0;//晚后 | ||
| 904 | + List<Integer> zqFcsj0=new ArrayList<Integer>(); | ||
| 905 | + List<Integer> zgfFcsj0=new ArrayList<Integer>(); | ||
| 906 | + List<Integer> zwFcsj0=new ArrayList<Integer>(); | ||
| 907 | + List<Integer> wgfFcsj0=new ArrayList<Integer>(); | ||
| 908 | + List<Integer> whFcsj0=new ArrayList<Integer>(); | ||
| 909 | + | ||
| 910 | + List<Integer> zqFcsj1=new ArrayList<Integer>(); | ||
| 911 | + List<Integer> zgfFcsj1=new ArrayList<Integer>(); | ||
| 912 | + List<Integer> zwFcsj1=new ArrayList<Integer>(); | ||
| 913 | + List<Integer> wgfFcsj1=new ArrayList<Integer>(); | ||
| 914 | + List<Integer> whFcsj1=new ArrayList<Integer>(); | ||
| 915 | + int temp = 48*60+1, zcj = 0; | ||
| 916 | + boolean ists = true; | ||
| 917 | + String lpname=""; | ||
| 918 | + for (int i = 0; i < list.size(); i++) { | ||
| 919 | + Map<String, Object> m=list.get(i); | ||
| 920 | + int xlDir = Integer.valueOf(m.get("dir").toString()); | ||
| 921 | + String[] split = m.get("fcsj").toString().split(":"); | ||
| 922 | + int fcsjT = Integer.valueOf(split[0])*60 + Integer.valueOf(split[1]); | ||
| 923 | + String bcType=m.get("bcType").toString(); | ||
| 924 | + int bcsj = Integer.valueOf(m.get("bcsj").toString()); | ||
| 925 | + if(i==0){ | ||
| 926 | + lpname=m.get("lp").toString(); | ||
| 927 | + if(temp>fcsjT){ | ||
| 928 | + temp=fcsjT+bcsj; | ||
| 929 | + } | ||
| 930 | + }else{ | ||
| 931 | + if(temp>fcsjT){ | ||
| 932 | + temp=fcsjT+bcsj; | ||
| 933 | + } | ||
| 934 | + if(bcType.equals("in") || bcType.equals("out")){ | ||
| 935 | + temp = fcsjT+bcsj; | ||
| 936 | + lpname=m.get("lp").toString(); | ||
| 937 | + ists=false; | ||
| 938 | + }else{ | ||
| 939 | +// if(ists){ | ||
| 940 | +// temp = fcsjT+bcsj; | ||
| 941 | +// lpname=m.get("lp").toString(); | ||
| 942 | +// }else{ | ||
| 943 | + if(xlDir==0){ | ||
| 944 | + //上行数据 | ||
| 945 | + if(fcsjT>= minSj && fcsjT <= 6*60+30){ | ||
| 946 | + //早高峰前 | ||
| 947 | + yysxZq +=bcsj; | ||
| 948 | + sxcountZqbc ++; | ||
| 949 | + zqFcsj0.add(fcsjT); | ||
| 950 | + if(ists){ | ||
| 951 | + if(lpname.equals(m.get("lp").toString())){ | ||
| 952 | + tzsxZq +=fcsjT-temp; | ||
| 953 | + } | ||
| 954 | + } | ||
| 955 | + temp = fcsjT+bcsj; | ||
| 956 | + | ||
| 957 | + }else if(fcsjT > 6*60+30 && fcsjT <= 8*60+30){ | ||
| 958 | + //早高峰 | ||
| 959 | + yysxZgf +=bcsj; | ||
| 960 | + sxcountZgfbc ++; | ||
| 961 | + zgfFcsj0.add(fcsjT); | ||
| 962 | + if(ists){ | ||
| 963 | + if(lpname.equals(m.get("lp").toString())){ | ||
| 964 | + tzsxZgf +=fcsjT-temp; | ||
| 965 | + } | ||
| 966 | + } | ||
| 967 | + temp =fcsjT+bcsj; | ||
| 968 | + | ||
| 969 | + }else if(fcsjT > 8*60+30 && fcsjT <= 16*60){ | ||
| 970 | + //中午 | ||
| 971 | + yysxZw +=bcsj; | ||
| 972 | + sxcountZwbc ++; | ||
| 973 | + zwFcsj0.add(fcsjT); | ||
| 974 | + if(ists){ | ||
| 975 | + if(lpname.equals(m.get("lp").toString())){ | ||
| 976 | + tzsxZw +=fcsjT-temp; | ||
| 977 | + } | ||
| 978 | + } | ||
| 979 | + temp =fcsjT+bcsj; | ||
| 980 | + }else if(fcsjT > 16*60 && fcsjT <= 18*60){ | ||
| 981 | + //晚高峰 | ||
| 982 | + yysxWgf +=bcsj; | ||
| 983 | + sxcountWgfbc ++; | ||
| 984 | + wgfFcsj0.add(fcsjT); | ||
| 985 | + if(ists){ | ||
| 986 | + if(lpname.equals(m.get("lp").toString())){ | ||
| 987 | + tzsxWgf +=fcsjT-temp; | ||
| 988 | + } | ||
| 989 | + } | ||
| 990 | + temp =fcsjT+bcsj; | ||
| 991 | + }else{ | ||
| 992 | + //晚高峰后 | ||
| 993 | + yysxWh +=bcsj; | ||
| 994 | + sxcountWhbc ++; | ||
| 995 | + whFcsj0.add(fcsjT); | ||
| 996 | + if(ists){ | ||
| 997 | + if(lpname.equals(m.get("lp").toString())){ | ||
| 998 | + tzsxWh +=fcsjT-temp; | ||
| 999 | + } | ||
| 1000 | + } | ||
| 1001 | + temp =fcsjT+bcsj; | ||
| 1002 | + } | ||
| 1003 | + lpname=m.get("lp").toString(); | ||
| 1004 | + }else{ | ||
| 1005 | + //下行数据 | ||
| 1006 | + if(fcsjT>= minSj && fcsjT <= 6*60+30){ | ||
| 1007 | + //早高峰前 | ||
| 1008 | + yyxxZq +=bcsj; | ||
| 1009 | + xxcountZqbc ++; | ||
| 1010 | + zqFcsj1.add(fcsjT); | ||
| 1011 | + if(ists){ | ||
| 1012 | + if(lpname.equals(m.get("lp").toString())){ | ||
| 1013 | + tzxxZq +=fcsjT-temp; | ||
| 1014 | + } | ||
| 1015 | + } | ||
| 1016 | + temp =fcsjT+bcsj; | ||
| 1017 | + }else if(fcsjT > 6*60+30 && fcsjT <= 8*60+30){ | ||
| 1018 | + //早高峰 | ||
| 1019 | + yyxxZgf +=bcsj; | ||
| 1020 | + xxcountZgfbc ++; | ||
| 1021 | + zgfFcsj1.add(fcsjT); | ||
| 1022 | + if(ists){ | ||
| 1023 | + if(lpname.equals(m.get("lp").toString())){ | ||
| 1024 | + tzxxZgf +=fcsjT-temp; | ||
| 1025 | + } | ||
| 1026 | + } | ||
| 1027 | + temp =fcsjT+bcsj; | ||
| 1028 | + }else if(fcsjT > 8*60+30 && fcsjT <= 16*60){ | ||
| 1029 | + //中午 | ||
| 1030 | + yyxxZw +=bcsj; | ||
| 1031 | + xxcountZwbc ++; | ||
| 1032 | + zwFcsj1.add(fcsjT); | ||
| 1033 | + if(ists){ | ||
| 1034 | + if(lpname.equals(m.get("lp").toString())){ | ||
| 1035 | + tzxxZw +=fcsjT-temp; | ||
| 1036 | + } | ||
| 1037 | + } | ||
| 1038 | + temp =fcsjT+bcsj; | ||
| 1039 | + }else if(fcsjT > 16*60 && fcsjT <= 18*60){ | ||
| 1040 | + //晚高峰 | ||
| 1041 | + yyxxWgf +=bcsj; | ||
| 1042 | + xxcountWgfbc ++; | ||
| 1043 | + wgfFcsj1.add(fcsjT); | ||
| 1044 | + if(ists){ | ||
| 1045 | + if(lpname.equals(m.get("lp").toString())){ | ||
| 1046 | + tzxxWgf +=fcsjT-temp; | ||
| 1047 | + } | ||
| 1048 | + } | ||
| 1049 | + temp =fcsjT+bcsj; | ||
| 1050 | + }else{ | ||
| 1051 | + //晚高峰后 | ||
| 1052 | + yyxxWh +=bcsj; | ||
| 1053 | + xxcountWhbc ++; | ||
| 1054 | + whFcsj1.add(fcsjT); | ||
| 1055 | + if(ists){ | ||
| 1056 | + if(lpname.equals(m.get("lp").toString())){ | ||
| 1057 | + tzxxWh +=fcsjT-temp; | ||
| 1058 | + } | ||
| 1059 | + } | ||
| 1060 | + temp =fcsjT+bcsj; | ||
| 1061 | + } | ||
| 1062 | +// } | ||
| 1063 | + } | ||
| 1064 | + } | ||
| 1065 | + } | ||
| 1066 | + if(m.get("ists").toString().trim().equals("1")){ | ||
| 1067 | + ists=false; | ||
| 1068 | + }else{ | ||
| 1069 | + ists = true; | ||
| 1070 | + } | ||
| 1071 | + } | ||
| 1072 | + | ||
| 1073 | + //---------------------------------------早前 | ||
| 1074 | + List<Integer> cjs = new ArrayList<Integer>(); | ||
| 1075 | + Collections.sort(zqFcsj0); | ||
| 1076 | + int fcsjs=0; | ||
| 1077 | + for (int i = 0; i < zqFcsj0.size(); i++) { | ||
| 1078 | + if(i==0){ | ||
| 1079 | + fcsjs =zqFcsj0.get(i); | ||
| 1080 | + }else{ | ||
| 1081 | + cjs.add(zqFcsj0.get(i)-fcsjs); | ||
| 1082 | + fcsjs=zqFcsj0.get(i); | ||
| 1083 | + } | ||
| 1084 | + | ||
| 1085 | + } | ||
| 1086 | + Collections.sort(zqFcsj1); | ||
| 1087 | + int fcsjx=0; | ||
| 1088 | + for (int i = 0; i < zqFcsj1.size(); i++) { | ||
| 1089 | + if(i==0){ | ||
| 1090 | + fcsjx =zqFcsj1.get(i); | ||
| 1091 | + }else{ | ||
| 1092 | + cjs.add(zqFcsj1.get(i)-fcsjx); | ||
| 1093 | + fcsjx =zqFcsj1.get(i); | ||
| 1094 | + } | ||
| 1095 | + | ||
| 1096 | + } | ||
| 1097 | + Collections.sort(cjs); | ||
| 1098 | + for(int i : cjs){ | ||
| 1099 | + zcj += i; | ||
| 1100 | + } | ||
| 1101 | + Map<String, Object> tempMap = new HashMap<String, Object>(); | ||
| 1102 | + tempMap.put("sjd", "(首)——6:30"); | ||
| 1103 | + tempMap.put("sxsj", sxcountZqbc != 0 ? yysxZq / sxcountZqbc : "0"); | ||
| 1104 | + tempMap.put("xxsj", xxcountZqbc != 0 ? yyxxZq / xxcountZqbc : "0"); | ||
| 1105 | + tempMap.put("sxtssj", sxcountZqbc!= 0 ? tzsxZq / sxcountZqbc : "0"); | ||
| 1106 | + tempMap.put("xxtssj", xxcountZqbc != 0 ? tzxxZq / xxcountZqbc : "0"); | ||
| 1107 | + tempMap.put("fqsj", Integer.valueOf(tempMap.get("sxsj").toString()) + Integer.valueOf(tempMap.get("xxsj").toString()) | ||
| 1108 | + + Integer.valueOf(tempMap.get("sxtssj").toString()) + Integer.valueOf(tempMap.get("xxtssj").toString())); | ||
| 1109 | + tempMap.put("cjqj", cjs.size()>0?cjs.get(0)+"——"+cjs.get(cjs.size()-1):"——"); | ||
| 1110 | + tempMap.put("pjcj", cjs.size()>0?zcj/cjs.size():"/"); | ||
| 1111 | + newList.add(tempMap); | ||
| 1112 | + | ||
| 1113 | + //----------------------------------早高峰 | ||
| 1114 | + cjs = new ArrayList<Integer>(); | ||
| 1115 | + zcj =0; | ||
| 1116 | + | ||
| 1117 | + Collections.sort(zgfFcsj0); | ||
| 1118 | + fcsjs=0; | ||
| 1119 | + for (int i = 0; i < zgfFcsj0.size(); i++) { | ||
| 1120 | + if(i==0){ | ||
| 1121 | + fcsjs =zgfFcsj0.get(i); | ||
| 1122 | + }else{ | ||
| 1123 | + cjs.add(zgfFcsj0.get(i)-fcsjs); | ||
| 1124 | + fcsjs=zgfFcsj0.get(i); | ||
| 1125 | + } | ||
| 1126 | + | ||
| 1127 | + } | ||
| 1128 | + Collections.sort(zgfFcsj1); | ||
| 1129 | + fcsjx=0; | ||
| 1130 | + for (int i = 0; i < zgfFcsj1.size(); i++) { | ||
| 1131 | + if(i==0){ | ||
| 1132 | + fcsjx =zgfFcsj1.get(i); | ||
| 1133 | + }else{ | ||
| 1134 | + cjs.add(zgfFcsj1.get(i)-fcsjx); | ||
| 1135 | + fcsjx =zgfFcsj1.get(i); | ||
| 1136 | + } | ||
| 1137 | + | ||
| 1138 | + } | ||
| 1139 | + Collections.sort(cjs); | ||
| 1140 | + for(int i : cjs){ | ||
| 1141 | + zcj += i; | ||
| 1142 | + } | ||
| 1143 | + | ||
| 1144 | + tempMap = new HashMap<String, Object>(); | ||
| 1145 | + tempMap.put("sjd", "6:31——8:30"); | ||
| 1146 | + tempMap.put("sxsj", sxcountZgfbc != 0 ? yysxZgf / sxcountZgfbc : "0"); | ||
| 1147 | + tempMap.put("xxsj", xxcountZgfbc != 0 ? yyxxZgf / xxcountZgfbc : "0"); | ||
| 1148 | + tempMap.put("sxtssj", sxcountZgfbc!= 0 ? tzsxZgf / sxcountZgfbc : "0"); | ||
| 1149 | + tempMap.put("xxtssj", xxcountZgfbc != 0 ? tzxxZgf / xxcountZgfbc : "0"); | ||
| 1150 | + tempMap.put("fqsj", Integer.valueOf(tempMap.get("sxsj").toString()) + Integer.valueOf(tempMap.get("xxsj").toString()) | ||
| 1151 | + + Integer.valueOf(tempMap.get("sxtssj").toString()) + Integer.valueOf(tempMap.get("xxtssj").toString())); | ||
| 1152 | + tempMap.put("cjqj", cjs.size()>0?cjs.get(0)+"——"+cjs.get(cjs.size()-1):"——"); | ||
| 1153 | + tempMap.put("pjcj", cjs.size()>0?zcj/cjs.size():"/"); | ||
| 1154 | + newList.add(tempMap); | ||
| 1155 | + //----------------------------------------------中午 | ||
| 1156 | + cjs = new ArrayList<Integer>(); | ||
| 1157 | + zcj =0; | ||
| 1158 | + | ||
| 1159 | + Collections.sort(zwFcsj0); | ||
| 1160 | + fcsjs=0; | ||
| 1161 | + for (int i = 0; i < zwFcsj0.size(); i++) { | ||
| 1162 | + if(i==0){ | ||
| 1163 | + fcsjs =zwFcsj0.get(i); | ||
| 1164 | + }else{ | ||
| 1165 | + cjs.add(zwFcsj0.get(i)-fcsjs); | ||
| 1166 | + fcsjs=zwFcsj0.get(i); | ||
| 1167 | + } | ||
| 1168 | + | ||
| 1169 | + } | ||
| 1170 | + Collections.sort(zwFcsj1); | ||
| 1171 | + fcsjx=0; | ||
| 1172 | + for (int i = 0; i < zwFcsj1.size(); i++) { | ||
| 1173 | + if(i==0){ | ||
| 1174 | + fcsjx =zwFcsj1.get(i); | ||
| 1175 | + }else{ | ||
| 1176 | + cjs.add(zwFcsj1.get(i)-fcsjx); | ||
| 1177 | + fcsjx =zwFcsj1.get(i); | ||
| 1178 | + } | ||
| 1179 | + | ||
| 1180 | + } | ||
| 1181 | + Collections.sort(cjs); | ||
| 1182 | + for(int i : cjs){ | ||
| 1183 | + zcj += i; | ||
| 1184 | + } | ||
| 1185 | + | ||
| 1186 | + tempMap = new HashMap<String, Object>(); | ||
| 1187 | + tempMap.put("sjd", "8:31——16:00"); | ||
| 1188 | + tempMap.put("sxsj", sxcountZwbc != 0 ? yysxZw / sxcountZwbc : "0"); | ||
| 1189 | + tempMap.put("xxsj", xxcountZwbc != 0 ? yyxxZw / xxcountZwbc : "0"); | ||
| 1190 | + tempMap.put("sxtssj", sxcountZwbc!= 0 ? tzsxZw / sxcountZwbc : "0"); | ||
| 1191 | + tempMap.put("xxtssj", xxcountZwbc != 0 ? tzxxZw / xxcountZwbc : "0"); | ||
| 1192 | + tempMap.put("fqsj", Integer.valueOf(tempMap.get("sxsj").toString()) + Integer.valueOf(tempMap.get("xxsj").toString()) | ||
| 1193 | + + Integer.valueOf(tempMap.get("sxtssj").toString()) + Integer.valueOf(tempMap.get("xxtssj").toString())); | ||
| 1194 | + tempMap.put("cjqj", cjs.size()>0?cjs.get(0)+"——"+cjs.get(cjs.size()-1):"——"); | ||
| 1195 | + tempMap.put("pjcj", cjs.size()>0?zcj/cjs.size():"/"); | ||
| 1196 | + newList.add(tempMap); | ||
| 1197 | + //-------------------------------------------------晚高峰 | ||
| 1198 | + cjs = new ArrayList<Integer>(); | ||
| 1199 | + zcj =0; | ||
| 1200 | + | ||
| 1201 | + Collections.sort(wgfFcsj0); | ||
| 1202 | + fcsjs=0; | ||
| 1203 | + for (int i = 0; i < wgfFcsj0.size(); i++) { | ||
| 1204 | + if(i==0){ | ||
| 1205 | + fcsjs =wgfFcsj0.get(i); | ||
| 1206 | + }else{ | ||
| 1207 | + cjs.add(wgfFcsj0.get(i)-fcsjs); | ||
| 1208 | + fcsjs=wgfFcsj0.get(i); | ||
| 1209 | + } | ||
| 1210 | + | ||
| 1211 | + } | ||
| 1212 | + Collections.sort(wgfFcsj1); | ||
| 1213 | + fcsjx=0; | ||
| 1214 | + for (int i = 0; i < wgfFcsj1.size(); i++) { | ||
| 1215 | + if(i==0){ | ||
| 1216 | + fcsjx =wgfFcsj1.get(i); | ||
| 1217 | + }else{ | ||
| 1218 | + cjs.add(wgfFcsj1.get(i)-fcsjx); | ||
| 1219 | + fcsjx =wgfFcsj1.get(i); | ||
| 1220 | + } | ||
| 1221 | + | ||
| 1222 | + } | ||
| 1223 | + Collections.sort(cjs); | ||
| 1224 | + for(int i : cjs){ | ||
| 1225 | + zcj += i; | ||
| 1226 | + } | ||
| 1227 | + | ||
| 1228 | + tempMap = new HashMap<String, Object>(); | ||
| 1229 | + tempMap.put("sjd", "16:01——18:00"); | ||
| 1230 | + tempMap.put("sxsj", sxcountWgfbc != 0 ? yysxWgf / sxcountWgfbc : "0"); | ||
| 1231 | + tempMap.put("xxsj", xxcountWgfbc != 0 ? yyxxWgf / xxcountWgfbc : "0"); | ||
| 1232 | + tempMap.put("sxtssj", sxcountWgfbc!= 0 ? tzsxWgf / sxcountWgfbc : "0"); | ||
| 1233 | + tempMap.put("xxtssj", xxcountWgfbc != 0 ? tzxxWgf / xxcountWgfbc : "0"); | ||
| 1234 | + tempMap.put("fqsj", Integer.valueOf(tempMap.get("sxsj").toString()) + Integer.valueOf(tempMap.get("xxsj").toString()) | ||
| 1235 | + + Integer.valueOf(tempMap.get("sxtssj").toString()) + Integer.valueOf(tempMap.get("xxtssj").toString())); | ||
| 1236 | + tempMap.put("cjqj", cjs.size()>0?cjs.get(0)+"——"+cjs.get(cjs.size()-1):"——"); | ||
| 1237 | + tempMap.put("pjcj", cjs.size()>0?zcj/cjs.size():"/"); | ||
| 1238 | + newList.add(tempMap); | ||
| 1239 | + | ||
| 1240 | + //----------------------------------晚后 | ||
| 1241 | + cjs = new ArrayList<Integer>(); | ||
| 1242 | + zcj =0; | ||
| 1243 | + | ||
| 1244 | + Collections.sort(whFcsj0); | ||
| 1245 | + fcsjs=0; | ||
| 1246 | + for (int i = 0; i < whFcsj0.size(); i++) { | ||
| 1247 | + if(i==0){ | ||
| 1248 | + fcsjs =whFcsj0.get(i); | ||
| 1249 | + }else{ | ||
| 1250 | + cjs.add(whFcsj0.get(i)-fcsjs); | ||
| 1251 | + fcsjs=whFcsj0.get(i); | ||
| 1252 | + } | ||
| 1253 | + | ||
| 1254 | + } | ||
| 1255 | + Collections.sort(whFcsj1); | ||
| 1256 | + fcsjx=0; | ||
| 1257 | + for (int i = 0; i < whFcsj1.size(); i++) { | ||
| 1258 | + if(i==0){ | ||
| 1259 | + fcsjx =whFcsj1.get(i); | ||
| 1260 | + }else{ | ||
| 1261 | + cjs.add(whFcsj1.get(i)-fcsjx); | ||
| 1262 | + fcsjx =whFcsj1.get(i); | ||
| 1263 | + } | ||
| 1264 | + | ||
| 1265 | + } | ||
| 1266 | + Collections.sort(cjs); | ||
| 1267 | + for(int i : cjs){ | ||
| 1268 | + zcj += i; | ||
| 1269 | + } | ||
| 1270 | + | ||
| 1271 | + tempMap = new HashMap<String, Object>(); | ||
| 1272 | + tempMap.put("sjd", "18:01——(末)"); | ||
| 1273 | + tempMap.put("sxsj", sxcountWhbc != 0 ? yysxWh / sxcountWhbc : "0"); | ||
| 1274 | + tempMap.put("xxsj", xxcountWhbc != 0 ? yyxxWh / xxcountWhbc : "0"); | ||
| 1275 | + tempMap.put("sxtssj", sxcountWhbc!= 0 ? tzsxWh / sxcountWhbc : "0"); | ||
| 1276 | + tempMap.put("xxtssj", xxcountWhbc != 0 ? tzxxWh / xxcountWhbc : "0"); | ||
| 1277 | + tempMap.put("fqsj", Integer.valueOf(tempMap.get("sxsj").toString()) + Integer.valueOf(tempMap.get("xxsj").toString()) | ||
| 1278 | + + Integer.valueOf(tempMap.get("sxtssj").toString()) + Integer.valueOf(tempMap.get("xxtssj").toString())); | ||
| 1279 | + tempMap.put("cjqj", cjs.size()>0?cjs.get(0)+"——"+cjs.get(cjs.size()-1):"——"); | ||
| 1280 | + tempMap.put("pjcj", cjs.size()>0?zcj/cjs.size():"/"); | ||
| 1281 | + newList.add(tempMap); | ||
| 1282 | + /* | ||
| 898 | Map<String, List<Map<String, Object>>> keyMap = new HashMap<String, List<Map<String, Object>>>(); | 1283 | Map<String, List<Map<String, Object>>> keyMap = new HashMap<String, List<Map<String, Object>>>(); |
| 899 | Map<String, Map<String, Object>> maps = new HashMap<String, Map<String, Object>>(); | 1284 | Map<String, Map<String, Object>> maps = new HashMap<String, Map<String, Object>>(); |
| 900 | keyMap.put("(首)——6:30", new ArrayList<Map<String, Object>>()); | 1285 | keyMap.put("(首)——6:30", new ArrayList<Map<String, Object>>()); |
| @@ -985,10 +1370,10 @@ public class ReportServiceImpl implements ReportService{ | @@ -985,10 +1370,10 @@ public class ReportServiceImpl implements ReportService{ | ||
| 985 | } | 1370 | } |
| 986 | 1371 | ||
| 987 | } | 1372 | } |
| 988 | - /*if(temp < fcsj){ | 1373 | + if(temp < fcsj){ |
| 989 | cjs.add(fcsj - temp); | 1374 | cjs.add(fcsj - temp); |
| 990 | temp = fcsj; | 1375 | temp = fcsj; |
| 991 | - }*/ | 1376 | + } |
| 992 | if(m.get("ists").toString().trim().equals("1")){ | 1377 | if(m.get("ists").toString().trim().equals("1")){ |
| 993 | ists = true; | 1378 | ists = true; |
| 994 | }else{ | 1379 | }else{ |
| @@ -1037,7 +1422,7 @@ public class ReportServiceImpl implements ReportService{ | @@ -1037,7 +1422,7 @@ public class ReportServiceImpl implements ReportService{ | ||
| 1037 | newList.add(maps.get("6:31——8:30")); | 1422 | newList.add(maps.get("6:31——8:30")); |
| 1038 | newList.add(maps.get("8:31——16:00")); | 1423 | newList.add(maps.get("8:31——16:00")); |
| 1039 | newList.add(maps.get("16:01——18:00")); | 1424 | newList.add(maps.get("16:01——18:00")); |
| 1040 | - newList.add(maps.get("18:01——(末)")); | 1425 | + newList.add(maps.get("18:01——(末)"));*/ |
| 1041 | 1426 | ||
| 1042 | return newList; | 1427 | return newList; |
| 1043 | } | 1428 | } |