Commit 07506aa1632c07e7e0e59975315adf1f2020b122

Authored by 王通
2 parents caa62f01 c6dc0b52

Merge branch 'pudong' into pudong_jdk8

# Conflicts:
#	src/main/java/com/bsth/service/calc/impl/CalcWaybillServiceImpl.java
src/main/java/com/bsth/repository/calc/CalcWaybillRepository.java
@@ -69,7 +69,7 @@ public interface CalcWaybillRepository extends BaseRepository<CalcWaybill, Integ @@ -69,7 +69,7 @@ public interface CalcWaybillRepository extends BaseRepository<CalcWaybill, Integ
69 @Query(value="select DISTINCT c from CalcWaybill c where c.xl like %?1% and c.rqStr between ?2 and ?3 and c.gsdm like %?4% and c.fgsdm like %?5% and c.cl like %?6% order by c.xl") 69 @Query(value="select DISTINCT c from CalcWaybill c where c.xl like %?1% and c.rqStr between ?2 and ?3 and c.gsdm like %?4% and c.fgsdm like %?5% and c.cl like %?6% order by c.xl")
70 List<CalcWaybill> scheduleByZbh(String line,String date,String date2,String gsdm,String fgsdm,String zbh); 70 List<CalcWaybill> scheduleByZbh(String line,String date,String date2,String gsdm,String fgsdm,String zbh);
71 @Query(value="select DISTINCT c from CalcWaybill c where c.xl like %?1% and c.rqStr between ?2 and ?3 and c.gsdm like %?4% and c.fgsdm like %?5% and c.cl like %?6%" 71 @Query(value="select DISTINCT c from CalcWaybill c where c.xl like %?1% and c.rqStr between ?2 and ?3 and c.gsdm like %?4% and c.fgsdm like %?5% and c.cl like %?6%"
72 - + " and c.cl in (select s.carCode from Cars s where s.sfdc = ?7) order by c.xl") 72 + + " and c.cl in (select s.insideCode from Cars s where s.sfdc = ?7) order by c.xl")
73 List<CalcWaybill> scheduleByZbh(String line,String date,String date2,String gsdm,String fgsdm,String zbh,Boolean sfdc); 73 List<CalcWaybill> scheduleByZbh(String line,String date,String date2,String gsdm,String fgsdm,String zbh,Boolean sfdc);
74 74
75 75
src/main/java/com/bsth/service/calc/impl/CalcCulateMileageServiceImpl.java
@@ -252,28 +252,28 @@ public class CalcCulateMileageServiceImpl implements CalcCulateMileageService{ @@ -252,28 +252,28 @@ public class CalcCulateMileageServiceImpl implements CalcCulateMileageService{
252 if(!scheduleRealInfo.isDestroy()){ 252 if(!scheduleRealInfo.isDestroy()){
253 double jhlcOrig=scheduleRealInfo.getJhlcOrig()==null?0:scheduleRealInfo.getJhlcOrig(); 253 double jhlcOrig=scheduleRealInfo.getJhlcOrig()==null?0:scheduleRealInfo.getJhlcOrig();
254 double jhlc=scheduleRealInfo.getJhlc()==null?0:scheduleRealInfo.getJhlc(); 254 double jhlc=scheduleRealInfo.getJhlc()==null?0:scheduleRealInfo.getJhlc();
255 -// if(jhlc-jhlcOrig>0){  
256 -// sjgl=Arith.add(sjgl,jhlcOrig);  
257 -// }else{ 255 + if(jhlc-jhlcOrig>0){
  256 + sjgl=Arith.add(sjgl,jhlcOrig);
  257 + }else{
258 sjgl=Arith.add(sjgl,jhlc); 258 sjgl=Arith.add(sjgl,jhlc);
259 -// } 259 + }
260 } 260 }
261 - }  
262 - }else{  
263 - Iterator<ChildTaskPlan> it = childTaskPlans.iterator();  
264 - while (it.hasNext()) {  
265 - ChildTaskPlan childTaskPlan = it.next();  
266 - if(childTaskPlan.getMileageType().equals("empty")  
267 -// &&"正常".equals(childTaskPlan.getType1())  
268 - && (!childTaskPlan.isNoClerk())  
269 - && childTaskPlan.getCcId()==null){  
270 - if (!childTaskPlan.isDestroy()) {  
271 - Float jhgl=childTaskPlan.getMileage()==null?0:childTaskPlan.getMileage();  
272 - sjgl=Arith.add(sjgl,jhgl);  
273 - } 261 + }
  262 + }else{
  263 + Iterator<ChildTaskPlan> it = childTaskPlans.iterator();
  264 + while (it.hasNext()) {
  265 + ChildTaskPlan childTaskPlan = it.next();
  266 + if(childTaskPlan.getMileageType().equals("empty")
  267 + &&"正常".equals(childTaskPlan.getType1())
  268 + && (!childTaskPlan.isNoClerk())
  269 + && childTaskPlan.getCcId()==null){
  270 + if (!childTaskPlan.isDestroy()) {
  271 + Float jhgl=childTaskPlan.getMileage()==null?0:childTaskPlan.getMileage();
  272 + sjgl=Arith.add(sjgl,jhgl);
  273 + }
274 } 274 }
275 - }  
276 - } 275 + }
  276 + }
277 } 277 }
278 } 278 }
279 return sjgl; 279 return sjgl;
@@ -421,7 +421,7 @@ public class CalcCulateMileageServiceImpl implements CalcCulateMileageService{ @@ -421,7 +421,7 @@ public class CalcCulateMileageServiceImpl implements CalcCulateMileageService{
421 } 421 }
422 } 422 }
423 } 423 }
424 - } 424 + }
425 }else{ 425 }else{
426 if(childTaskPlans.isEmpty()){ 426 if(childTaskPlans.isEmpty()){
427 Iterator<ChildTaskPlan> it = childTaskPlans.iterator(); 427 Iterator<ChildTaskPlan> it = childTaskPlans.iterator();
@@ -451,7 +451,7 @@ public class CalcCulateMileageServiceImpl implements CalcCulateMileageService{ @@ -451,7 +451,7 @@ public class CalcCulateMileageServiceImpl implements CalcCulateMileageService{
451 for (int i = 0; i < lists.size(); i++) { 451 for (int i = 0; i < lists.size(); i++) {
452 ScheduleRealInfo scheduleRealInfo=lists.get(i); 452 ScheduleRealInfo scheduleRealInfo=lists.get(i);
453 Set<ChildTaskPlan> childTaskPlans = scheduleRealInfo.getcTasks(); 453 Set<ChildTaskPlan> childTaskPlans = scheduleRealInfo.getcTasks();
454 -// if (isInOut(scheduleRealInfo)) { 454 + if (isInOut(scheduleRealInfo)) {
455 if(scheduleRealInfo.isSflj()){ 455 if(scheduleRealInfo.isSflj()){
456 if(childTaskPlans.isEmpty()){ 456 if(childTaskPlans.isEmpty()){
457 if(!scheduleRealInfo.isDestroy() && isInOut(scheduleRealInfo)) 457 if(!scheduleRealInfo.isDestroy() && isInOut(scheduleRealInfo))
@@ -470,48 +470,47 @@ public class CalcCulateMileageServiceImpl implements CalcCulateMileageService{ @@ -470,48 +470,47 @@ public class CalcCulateMileageServiceImpl implements CalcCulateMileageService{
470 } 470 }
471 } 471 }
472 } 472 }
  473 + }else{
  474 + if(childTaskPlans.isEmpty()){
  475 + double jhlc=scheduleRealInfo.getJhlc()==null?0:scheduleRealInfo.getJhlc();
  476 + double jhlcOrig=scheduleRealInfo.getJhlcOrig()==null?0:scheduleRealInfo.getJhlcOrig();
  477 + double zjlc=Arith.sub(jhlc, jhlcOrig);
  478 + if(zjlc>0){
  479 + ljgl=Arith.add(zjlc, ljgl);
  480 + }
  481 + }else{
  482 + Iterator<ChildTaskPlan> it = childTaskPlans.iterator();
  483 + while (it.hasNext()) {
  484 + ChildTaskPlan childTaskPlan = it.next();
  485 + if("empty".equals(childTaskPlan.getMileageType())
  486 + &&"临加".equals(childTaskPlan.getType1())
  487 + && childTaskPlan.getCcId() == null
  488 + && (!childTaskPlan.isNoClerk())){
  489 + if (!childTaskPlan.isDestroy()) {
  490 + Float jhgl=childTaskPlan.getMileage()==null?0:childTaskPlan.getMileage();
  491 + ljgl=Arith.add(ljgl,jhgl);
  492 + }
  493 + }
  494 + }
  495 + }
473 } 496 }
474 -// }else{  
475 -// if(childTaskPlans.isEmpty()){  
476 -// double jhlc=scheduleRealInfo.getJhlc()==null?0:scheduleRealInfo.getJhlc();  
477 -// double jhlcOrig=scheduleRealInfo.getJhlcOrig()==null?0:scheduleRealInfo.getJhlcOrig();  
478 -// double zjlc=Arith.sub(jhlc, jhlcOrig);  
479 -// if(zjlc>0){  
480 -// ljgl=Arith.add(zjlc, ljgl);  
481 -// }  
482 -// }else{  
483 -// Iterator<ChildTaskPlan> it = childTaskPlans.iterator();  
484 -// while (it.hasNext()) {  
485 -// ChildTaskPlan childTaskPlan = it.next();  
486 -// if("empty".equals(childTaskPlan.getMileageType())  
487 -// &&"临加".equals(childTaskPlan.getType1())  
488 -// && childTaskPlan.getCcId() == null  
489 -// && (!childTaskPlan.isNoClerk())){  
490 -// if (!childTaskPlan.isDestroy()) {  
491 -// Float jhgl=childTaskPlan.getMileage()==null?0:childTaskPlan.getMileage();  
492 -// ljgl=Arith.add(ljgl,jhgl);  
493 -// }  
494 -// }  
495 -// }  
496 -// }  
497 -// }  
498 -// }else{  
499 -// if (!childTaskPlans.isEmpty()) {  
500 -// Iterator<ChildTaskPlan> it = childTaskPlans.iterator();  
501 -// while (it.hasNext()) {  
502 -// ChildTaskPlan childTaskPlan = it.next();  
503 -// if ("empty".equals(childTaskPlan.getMileageType())  
504 -// && "临加".equals(childTaskPlan.getType1())  
505 -// && childTaskPlan.getCcId() == null  
506 -// && (!childTaskPlan.isNoClerk())) {  
507 -// if (!childTaskPlan.isDestroy()) {  
508 -// Float jhgl = childTaskPlan.getMileage() == null ? 0 : childTaskPlan.getMileage();  
509 -// ljgl = Arith.add(ljgl, jhgl);  
510 -// }  
511 -// }  
512 -// }  
513 -// }  
514 -// } 497 + }else{
  498 + if (!childTaskPlans.isEmpty()) {
  499 + Iterator<ChildTaskPlan> it = childTaskPlans.iterator();
  500 + while (it.hasNext()) {
  501 + ChildTaskPlan childTaskPlan = it.next();
  502 + if ("empty".equals(childTaskPlan.getMileageType())
  503 + && "临加".equals(childTaskPlan.getType1())
  504 + && childTaskPlan.getCcId() == null
  505 + && (!childTaskPlan.isNoClerk())) {
  506 + if (!childTaskPlan.isDestroy()) {
  507 + Float jhgl = childTaskPlan.getMileage() == null ? 0 : childTaskPlan.getMileage();
  508 + ljgl = Arith.add(ljgl, jhgl);
  509 + }
  510 + }
  511 + }
  512 + }
  513 + }
515 } 514 }
516 return ljgl; 515 return ljgl;
517 } 516 }
@@ -522,7 +521,7 @@ public class CalcCulateMileageServiceImpl implements CalcCulateMileageService{ @@ -522,7 +521,7 @@ public class CalcCulateMileageServiceImpl implements CalcCulateMileageService{
522 double ljgl =0; 521 double ljgl =0;
523 for (int i = 0; i < lists.size(); i++) { 522 for (int i = 0; i < lists.size(); i++) {
524 ScheduleRealInfo scheduleRealInfo=lists.get(i); 523 ScheduleRealInfo scheduleRealInfo=lists.get(i);
525 -// if (!isInOut(scheduleRealInfo)) { 524 + if (!isInOut(scheduleRealInfo)) {
526 Set<ChildTaskPlan> childTaskPlans = scheduleRealInfo.getcTasks(); 525 Set<ChildTaskPlan> childTaskPlans = scheduleRealInfo.getcTasks();
527 if(scheduleRealInfo.isSflj()){ 526 if(scheduleRealInfo.isSflj()){
528 if(!childTaskPlans.isEmpty()){ 527 if(!childTaskPlans.isEmpty()){
@@ -538,24 +537,24 @@ public class CalcCulateMileageServiceImpl implements CalcCulateMileageService{ @@ -538,24 +537,24 @@ public class CalcCulateMileageServiceImpl implements CalcCulateMileageService{
538 } 537 }
539 } 538 }
540 } 539 }
541 - }  
542 -// }else{  
543 -// if(childTaskPlans.isEmpty()){  
544 -// Iterator<ChildTaskPlan> it = childTaskPlans.iterator();  
545 -// while (it.hasNext()) {  
546 -// ChildTaskPlan childTaskPlan = it.next();  
547 -// if("empty".equals(childTaskPlan.getMileageType())  
548 -// &&"临加".equals(childTaskPlan.getType1())  
549 -// && childTaskPlan.getCcId()==null  
550 -// && childTaskPlan.isNoClerk()){  
551 -// if (!childTaskPlan.isDestroy()) {  
552 -// Float jhgl=childTaskPlan.getMileage()==null?0:childTaskPlan.getMileage();  
553 -// ljgl=Arith.add(ljgl,jhgl);  
554 -// }  
555 -// }  
556 -// }  
557 -// }  
558 -// } 540 + }
  541 + }else{
  542 + if(childTaskPlans.isEmpty()){
  543 + Iterator<ChildTaskPlan> it = childTaskPlans.iterator();
  544 + while (it.hasNext()) {
  545 + ChildTaskPlan childTaskPlan = it.next();
  546 + if("empty".equals(childTaskPlan.getMileageType())
  547 + &&"临加".equals(childTaskPlan.getType1())
  548 + && childTaskPlan.getCcId()==null
  549 + && childTaskPlan.isNoClerk()){
  550 + if (!childTaskPlan.isDestroy()) {
  551 + Float jhgl=childTaskPlan.getMileage()==null?0:childTaskPlan.getMileage();
  552 + ljgl=Arith.add(ljgl,jhgl);
  553 + }
  554 + }
  555 + }
  556 + }
  557 + }
559 } 558 }
560 } 559 }
561 return ljgl; 560 return ljgl;
src/main/java/com/bsth/service/calc/impl/CalcWaybillServiceImpl.java
@@ -95,7 +95,7 @@ public class CalcWaybillServiceImpl extends BaseServiceImpl&lt;CalcWaybill, Integer @@ -95,7 +95,7 @@ public class CalcWaybillServiceImpl extends BaseServiceImpl&lt;CalcWaybill, Integer
95 private ReportService reportService; 95 private ReportService reportService;
96 @Autowired 96 @Autowired
97 CarsRepository carsRepository; 97 CarsRepository carsRepository;
98 - 98 +
99 @Autowired 99 @Autowired
100 JdbcTemplate jdbcTemplate; 100 JdbcTemplate jdbcTemplate;
101 101
@@ -109,10 +109,9 @@ public class CalcWaybillServiceImpl extends BaseServiceImpl&lt;CalcWaybill, Integer @@ -109,10 +109,9 @@ public class CalcWaybillServiceImpl extends BaseServiceImpl&lt;CalcWaybill, Integer
109 if(date == null || date.trim().length() == 0){ 109 if(date == null || date.trim().length() == 0){
110 Date d = new Date(); 110 Date d = new Date();
111 d.setTime(d.getTime() - (4l * 1000 * 60 * 60 * 24)); 111 d.setTime(d.getTime() - (4l * 1000 * 60 * 60 * 24));
112 - for(long i = 0; i < 3; i++){  
113 - d.setTime(d.getTime() + (i * 1000 * 60 * 60 * 24));  
114 - dateList.add(sdf.format(d));  
115 - } 112 + dateList.add(sdf.format(d));
  113 + d.setTime(d.getTime() - (1l * 1000 * 60 * 60 * 24));
  114 + dateList.add(sdf.format(d));
116 } else { 115 } else {
117 date = date.trim(); 116 date = date.trim();
118 dateList.add(date); 117 dateList.add(date);
@@ -130,21 +129,21 @@ public class CalcWaybillServiceImpl extends BaseServiceImpl&lt;CalcWaybill, Integer @@ -130,21 +129,21 @@ public class CalcWaybillServiceImpl extends BaseServiceImpl&lt;CalcWaybill, Integer
130 m.put("generateNew", generateNew); 129 m.put("generateNew", generateNew);
131 } catch (Exception e) { 130 } catch (Exception e) {
132 // TODO: handle exception 131 // TODO: handle exception
133 - logger.info("重新统计保存失败!"); 132 + logger.info("date="+d+";line="+line+";重新统计保存失败!");
134 } 133 }
135 try { 134 try {
136 Map<String, Object> calcLineMileage = calcLineMileage(d, line); 135 Map<String, Object> calcLineMileage = calcLineMileage(d, line);
137 m.put("lineMileage", calcLineMileage); 136 m.put("lineMileage", calcLineMileage);
138 } catch (Exception e) { 137 } catch (Exception e) {
139 // TODO: handle exception 138 // TODO: handle exception
140 - logger.info("线路公里审计保存失败!"); 139 + logger.info("date="+d+";line="+line+";线路公里审计保存失败!");
141 } 140 }
142 try { 141 try {
143 Map<String, Object> calcBusMileage = calcBusMileage(d, line); 142 Map<String, Object> calcBusMileage = calcBusMileage(d, line);
144 m.put("busMileage", calcBusMileage); 143 m.put("busMileage", calcBusMileage);
145 } catch (Exception e) { 144 } catch (Exception e) {
146 // TODO: handle exception 145 // TODO: handle exception
147 - logger.info("路单数据审计保存失败!"); 146 + logger.info("date="+d+";line="+line+";路单数据审计保存失败!");
148 } 147 }
149 } 148 }
150 149
@@ -473,6 +472,7 @@ public class CalcWaybillServiceImpl extends BaseServiceImpl&lt;CalcWaybill, Integer @@ -473,6 +472,7 @@ public class CalcWaybillServiceImpl extends BaseServiceImpl&lt;CalcWaybill, Integer
473 public String calcDaily(String rq, String line) throws Exception{ 472 public String calcDaily(String rq, String line) throws Exception{
474 String result = ""; 473 String result = "";
475 try { 474 try {
  475 + List<String> dateList = new ArrayList<String>();
476 if(rq == null || rq.trim().length() == 0){ 476 if(rq == null || rq.trim().length() == 0){
477 SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd"); 477 SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd");
478 Date dNow = new Date(); //当前时间 478 Date dNow = new Date(); //当前时间
@@ -481,101 +481,115 @@ public class CalcWaybillServiceImpl extends BaseServiceImpl&lt;CalcWaybill, Integer @@ -481,101 +481,115 @@ public class CalcWaybillServiceImpl extends BaseServiceImpl&lt;CalcWaybill, Integer
481 calendar.setTime(dNow);//把当前时间赋给日历 481 calendar.setTime(dNow);//把当前时间赋给日历
482 calendar.add(Calendar.DAY_OF_MONTH, -4); //设置为前一天 482 calendar.add(Calendar.DAY_OF_MONTH, -4); //设置为前一天
483 dBefore = calendar.getTime(); //得到前一天的时间 483 dBefore = calendar.getTime(); //得到前一天的时间
484 - rq = sdf.format(dBefore); 484 +// rq = sdf.format(dBefore);
  485 + dateList.add(sdf.format(dBefore));
  486 + Date date = new Date();
  487 + date.setTime(dBefore.getTime() - 1l*1000*60*60*24);
  488 + dateList.add(sdf.format(date));
485 } else { 489 } else {
486 - rq = rq.trim(); 490 +// rq = rq.trim();
  491 + dateList.add(rq.trim());
487 } 492 }
488 if(line == null || line.trim().length() == 0){ 493 if(line == null || line.trim().length() == 0){
489 line = ""; 494 line = "";
490 } else { 495 } else {
491 line = line.trim(); 496 line = line.trim();
492 } 497 }
493 - List<ScheduleRealInfo> list = new ArrayList<ScheduleRealInfo>();  
494 - List<ScheduleRealInfo> list_s = new ArrayList<ScheduleRealInfo>();  
495 - List<ScheduleRealInfo> lists = new ArrayList<ScheduleRealInfo>();  
496 -  
497 - String gsSql="select gs_bm, fgs_bm from bsth_c_s_sp_info_real where schedule_date_str = '"+rq+"'";  
498 - if(line.trim().length() > 0)  
499 - gsSql += " and xl_bm = '"+line+"'";  
500 - gsSql += " group by gs_bm, fgs_bm";  
501 - List<Map<String, String>> gsList=jdbcTemplate.query(gsSql, new RowMapper<Map<String, String>>() {  
502 - @Override  
503 - public Map<String, String> mapRow(ResultSet arg0, int arg1) throws SQLException {  
504 - Map<String, String> m = new HashMap<String, String>();  
505 - m.put("gsdm", arg0.getString("gs_bm"));  
506 - m.put("fgsdm", arg0.getString("fgs_bm"));  
507 - return m;  
508 - }});  
509 -  
510 - //查询所有线路  
511 - for(Map<String, String> m : gsList){  
512 - list.addAll(calcStatisticsRepository.scheduleByDateAndLine(line, rq, rq, m.get("gsdm"), m.get("fgsdm")));  
513 - }  
514 498
515 - List<CalcInterval> listInterval=calcIntervalRepository.selectByDateAndCompany(rq, "", "","");  
516 - Map<String,CalcInterval> mapInterval=new HashMap<String,CalcInterval>();  
517 - for (int i = 0; i < listInterval.size(); i++) {  
518 - CalcInterval c=listInterval.get(i);  
519 - mapInterval.put(c.getXlBm(), c);  
520 - }  
521 -  
522 -  
523 - for (int i = 0; i < list.size(); i++) {  
524 - ScheduleRealInfo s=list.get(i);  
525 - Set<ChildTaskPlan> cts = s.getcTasks();  
526 - if(cts != null && cts.size() > 0){  
527 - list_s.add(s);  
528 - }else{  
529 - if(s.getZdsjActual()!=null && s.getFcsjActual()!=null){  
530 - list_s.add(s); 499 + for(int j = 0; j < dateList.size(); j++){
  500 + rq = dateList.get(j);
  501 +
  502 + List<ScheduleRealInfo> list = new ArrayList<ScheduleRealInfo>();
  503 + List<ScheduleRealInfo> list_s = new ArrayList<ScheduleRealInfo>();
  504 + List<ScheduleRealInfo> lists = new ArrayList<ScheduleRealInfo>();
  505 +
  506 + String gsSql="select gs_bm, fgs_bm from bsth_c_s_sp_info_real where schedule_date_str = '"+rq+"'";
  507 + if(line.trim().length() > 0)
  508 + gsSql += " and xl_bm = '"+line+"'";
  509 + gsSql += " group by gs_bm, fgs_bm";
  510 + List<Map<String, String>> gsList=jdbcTemplate.query(gsSql, new RowMapper<Map<String, String>>() {
  511 + @Override
  512 + public Map<String, String> mapRow(ResultSet arg0, int arg1) throws SQLException {
  513 + Map<String, String> m = new HashMap<String, String>();
  514 + m.put("gsdm", arg0.getString("gs_bm"));
  515 + m.put("fgsdm", arg0.getString("fgs_bm"));
  516 + return m;
  517 + }});
  518 +
  519 + //查询所有线路
  520 + for(Map<String, String> m : gsList){
  521 + list.addAll(calcStatisticsRepository.scheduleByDateAndLine(line, rq, rq, m.get("gsdm"), m.get("fgsdm")));
  522 + }
  523 +
  524 + List<CalcInterval> listInterval=calcIntervalRepository.selectByDateAndCompany(rq, "", "","");
  525 + Map<String,CalcInterval> mapInterval=new HashMap<String,CalcInterval>();
  526 + for (int i = 0; i < listInterval.size(); i++) {
  527 + CalcInterval c=listInterval.get(i);
  528 + mapInterval.put(c.getXlBm(), c);
  529 + }
  530 +
  531 +
  532 + for (int i = 0; i < list.size(); i++) {
  533 + ScheduleRealInfo s=list.get(i);
  534 + Set<ChildTaskPlan> cts = s.getcTasks();
  535 + if(cts != null && cts.size() > 0){
  536 + list_s.add(s);
  537 + }else{
  538 + if(s.getZdsjActual()!=null && s.getFcsjActual()!=null){
  539 + list_s.add(s);
  540 + }
531 } 541 }
532 - }  
533 - }  
534 - List<CalcStatistics> lMap = new ArrayList<CalcStatistics>();  
535 - for (int i = 0; i < list.size(); i++) {  
536 - if(i<list.size()-1){  
537 - if(list.get(i+1).getXlBm().equals(list.get(i).getXlBm())){  
538 - lists.add(list.get(i));  
539 - }else{  
540 - lists.add(list.get(i));  
541 - CalcInterval t=null;  
542 - if(mapInterval.get(lists.get(0).getXlBm())!=null){  
543 - t=mapInterval.get(lists.get(0).getXlBm());  
544 - }  
545 -  
546 - CalcStatistics s=staticTj(lists,t);  
547 - lMap.add(s);  
548 - lists=new ArrayList<ScheduleRealInfo>();  
549 - }  
550 - }else{  
551 - if(list.get(i).getXlBm().equals(list.get(i-1).getXlBm())){  
552 - lists.add(list.get(i));  
553 - CalcInterval t=null;  
554 - if(mapInterval.get(lists.get(0).getXlBm())!=null){  
555 - t=mapInterval.get(lists.get(0).getXlBm());  
556 - }  
557 - CalcStatistics s=staticTj(lists,t);  
558 - lMap.add(s);  
559 - }else{  
560 - lists=new ArrayList<ScheduleRealInfo>();  
561 - lists.add(list.get(i));  
562 - CalcInterval t=null;  
563 - if(mapInterval.get(lists.get(0).getXlBm())!=null){  
564 - t=mapInterval.get(lists.get(0).getXlBm());  
565 - }  
566 - CalcStatistics s=staticTj(lists,t);  
567 - lMap.add(s);  
568 - }  
569 - }  
570 - }  
571 -// Collections.sort(lMap,new AccountXlbm());  
572 -  
573 - if(line.trim().length() > 0){  
574 - calcStatisticsRepository.deleteByDateAndLine(rq, line);  
575 - } else {  
576 - calcStatisticsRepository.deleteByDate(rq);  
577 - }  
578 - calcStatisticsRepository.saveAll(lMap); 542 + }
  543 + List<CalcStatistics> lMap = new ArrayList<CalcStatistics>();
  544 + for (int i = 0; i < list.size(); i++) {
  545 + if(i<list.size()-1){
  546 + if(list.get(i+1).getXlBm().equals(list.get(i).getXlBm())){
  547 + lists.add(list.get(i));
  548 + }else{
  549 + lists.add(list.get(i));
  550 + CalcInterval t=null;
  551 + if(mapInterval.get(lists.get(0).getXlBm())!=null){
  552 + t=mapInterval.get(lists.get(0).getXlBm());
  553 + }
  554 +
  555 + CalcStatistics s=staticTj(lists,t);
  556 + lMap.add(s);
  557 + lists=new ArrayList<ScheduleRealInfo>();
  558 + }
  559 + }else{
  560 + if(list.get(i).getXlBm().equals(list.get(i-1).getXlBm())){
  561 + lists.add(list.get(i));
  562 + CalcInterval t=null;
  563 + if(mapInterval.get(lists.get(0).getXlBm())!=null){
  564 + t=mapInterval.get(lists.get(0).getXlBm());
  565 + }
  566 + CalcStatistics s=staticTj(lists,t);
  567 + lMap.add(s);
  568 + }else{
  569 + lists=new ArrayList<ScheduleRealInfo>();
  570 + lists.add(list.get(i));
  571 + CalcInterval t=null;
  572 + if(mapInterval.get(lists.get(0).getXlBm())!=null){
  573 + t=mapInterval.get(lists.get(0).getXlBm());
  574 + }
  575 + CalcStatistics s=staticTj(lists,t);
  576 + lMap.add(s);
  577 + }
  578 + }
  579 + }
  580 + // Collections.sort(lMap,new AccountXlbm());
  581 +
  582 + if(line.trim().length() > 0){
  583 + calcStatisticsRepository.deleteByDateAndLine(rq, line);
  584 + } else {
  585 + calcStatisticsRepository.deleteByDate(rq);
  586 + }
  587 + calcStatisticsRepository.saveAll(lMap);
  588 +
  589 + System.out.println(rq);
  590 + System.out.println(dateList.size());
  591 + }
  592 +
579 result = "success"; 593 result = "success";
580 } catch (Exception e) { 594 } catch (Exception e) {
581 // TODO: handle exception 595 // TODO: handle exception
src/main/java/com/bsth/service/report/impl/CulateMileageServiceImpl.java
@@ -1101,6 +1101,71 @@ public class CulateMileageServiceImpl implements CulateMileageService{ @@ -1101,6 +1101,71 @@ public class CulateMileageServiceImpl implements CulateMileageService{
1101 } 1101 }
1102 } 1102 }
1103 } 1103 }
  1104 + } else {
  1105 + Set<ChildTaskPlan> childTaskPlans = t.getcTasks();
  1106 + if(!isInOut(t)){
  1107 + if(childTaskPlans.isEmpty()){
  1108 + double jhlc=t.getJhlc()==null?0:t.getJhlc();
  1109 + double jhlcOrig=t.getJhlcOrig()==null?0:t.getJhlcOrig();
  1110 + double zjlc=Arith.sub(jhlc, jhlcOrig);
  1111 + if(zjlc>0){
  1112 + ljyy=Arith.add(zjlc, ljyy);
  1113 + }
  1114 + }else{
  1115 + Iterator<ChildTaskPlan> it = childTaskPlans.iterator();
  1116 + while (it.hasNext()) {
  1117 + ChildTaskPlan childTaskPlan = it.next();
  1118 + if("service".equals(childTaskPlan.getMileageType())
  1119 + &&"临加".equals(childTaskPlan.getType1())
  1120 + && childTaskPlan.getCcId() == null
  1121 + && (!childTaskPlan.isNoClerk())){
  1122 + if (!childTaskPlan.isDestroy()) {
  1123 + Float jhgl=childTaskPlan.getMileage()==null?0:childTaskPlan.getMileage();
  1124 + ljyy=Arith.add(ljyy,jhgl);
  1125 + }
  1126 + }
  1127 + }
  1128 + }
  1129 + } else {
  1130 + if(childTaskPlans.isEmpty()){
  1131 + if(t.getBcType().equals("in") || t.getBcType().equals("out")){
  1132 + double jhlc=t.getJhlc()==null?0:t.getJhlc();
  1133 + double jhlcOrig=t.getJhlcOrig()==null?0:t.getJhlcOrig();
  1134 + double zjlc=Arith.sub(jhlc, jhlcOrig);
  1135 + if(zjlc>0){
  1136 + ljjcc=Arith.add(zjlc, ljjcc);
  1137 + }
  1138 + }
  1139 +
  1140 + if(t.getBcType().equals("ldks")){
  1141 + double jhlc=t.getJhlc()==null?0:t.getJhlc();
  1142 + double jhlcOrig=t.getJhlcOrig()==null?0:t.getJhlcOrig();
  1143 + double zjlc=Arith.sub(jhlc, jhlcOrig);
  1144 + if(zjlc>0){
  1145 + ljkfks=Arith.add(zjlc, ljkfks);
  1146 + }
  1147 + }
  1148 + }else{
  1149 + Iterator<ChildTaskPlan> it = childTaskPlans.iterator();
  1150 + while (it.hasNext()) {
  1151 + ChildTaskPlan childTaskPlan = it.next();
  1152 + if("empty".equals(childTaskPlan.getMileageType())
  1153 + &&"临加".equals(childTaskPlan.getType1())
  1154 + && childTaskPlan.getCcId() == null
  1155 + && (!childTaskPlan.isNoClerk())){
  1156 + if (!childTaskPlan.isDestroy()) {
  1157 + Float jhgl=childTaskPlan.getMileage()==null?0:childTaskPlan.getMileage();
  1158 + if(childTaskPlan.getType2().equals("2")||childTaskPlan.getType2().equals("3")){
  1159 + ljjcc=Arith.add(ljjcc,jhgl);
  1160 + } else {
  1161 + ljkfks=Arith.add(ljkfks,jhgl);
  1162 + }
  1163 +
  1164 + }
  1165 + }
  1166 + }
  1167 + }
  1168 + }
1104 } 1169 }
1105 } 1170 }
1106 1171
src/main/resources/static/pages/forms/calc/calcsingledata.html
@@ -40,6 +40,14 @@ @@ -40,6 +40,14 @@
40 <span class="item-label" style="width: 80px;">线路: </span> 40 <span class="item-label" style="width: 80px;">线路: </span>
41 <select class="form-control" name="line" id="line" style="width: 140px;"></select> 41 <select class="form-control" name="line" id="line" style="width: 140px;"></select>
42 </div> 42 </div>
  43 + <div style="display: inline-block; margin-left: 18px;" id="sfdcDiv">
  44 + <span class="item-label" style="width: 80px;">是否电车: </span>
  45 + <select class="form-control form-filter " name="sfdc" id="sfdc">
  46 + <option value="">请选择...</option>
  47 + <option value="0">否</option>
  48 + <option value="1">是</option>
  49 + </select>
  50 + </div>
43 <div style="margin-top: 10px"></div> 51 <div style="margin-top: 10px"></div>
44 <div style="display: inline-block;margin-left: 3px;"> 52 <div style="display: inline-block;margin-left: 3px;">
45 <span class="item-label" style="width: 140px;">开始时间: </span> 53 <span class="item-label" style="width: 140px;">开始时间: </span>
@@ -195,6 +203,8 @@ @@ -195,6 +203,8 @@
195 } 203 }
196 }); 204 });
197 205
  206 + $("#sfdcDiv").hide();
  207 +
198 var cont = "驾驶员", cont1 = "", cont2 = "", cont3 = ""; 208 var cont = "驾驶员", cont1 = "", cont2 = "", cont3 = "";
199 $("#tjtype").on("change",function(){ 209 $("#tjtype").on("change",function(){
200 if(cont == "驾驶员"){ 210 if(cont == "驾驶员"){
@@ -207,10 +217,13 @@ @@ -207,10 +217,13 @@
207 cont = $("#tjtype").val(); 217 cont = $("#tjtype").val();
208 if($("#tjtype").val() == "驾驶员"){ 218 if($("#tjtype").val() == "驾驶员"){
209 $("#cont").val(cont1); 219 $("#cont").val(cont1);
  220 + $("#sfdcDiv").hide();
210 } else if($("#tjtype").val() == "售票员"){ 221 } else if($("#tjtype").val() == "售票员"){
211 $("#cont").val(cont2); 222 $("#cont").val(cont2);
  223 + $("#sfdcDiv").hide();
212 } else if($("#tjtype").val() == "车辆自编号"){ 224 } else if($("#tjtype").val() == "车辆自编号"){
213 $("#cont").val(cont3); 225 $("#cont").val(cont3);
  226 + $("#sfdcDiv").show();
214 } 227 }
215 }); 228 });
216 229
@@ -231,9 +244,10 @@ @@ -231,9 +244,10 @@
231 var fgsdmSing = $("#fgsdmSing").val(); 244 var fgsdmSing = $("#fgsdmSing").val();
232 var tjtype=$("#tjtype").val(); 245 var tjtype=$("#tjtype").val();
233 var cont=$("#cont").val(); 246 var cont=$("#cont").val();
  247 + var sfdc=$("#sfdc").val();
234 var params = {}; 248 var params = {};
235 var i = layer.load(2); 249 var i = layer.load(2);
236 - $get("/calc_mix/singledatatj",{gsdmSing:gsdmSing,fgsdmSing:fgsdmSing,line:line,startDate:startDate,endDate:endDate,tjtype:tjtype,cont:cont},function(result){ 250 + $get("/calc_mix/singledatatj",{gsdmSing:gsdmSing,fgsdmSing:fgsdmSing,line:line,startDate:startDate,endDate:endDate,tjtype:tjtype,cont:cont,sfdc:sfdc},function(result){
237 layer.close(i); 251 layer.close(i);
238 var singledata = template('singledata',{list:result}); 252 var singledata = template('singledata',{list:result});
239 // 把渲染好的模版html文本追加到表格中 253 // 把渲染好的模版html文本追加到表格中
@@ -249,11 +263,12 @@ @@ -249,11 +263,12 @@
249 var fgsdmSing = $("#fgsdmSing").val(); 263 var fgsdmSing = $("#fgsdmSing").val();
250 var tjtype=$("#tjtype").val(); 264 var tjtype=$("#tjtype").val();
251 var cont=$("#cont").val(); 265 var cont=$("#cont").val();
  266 + var sfdc=$("#sfdc").val();
252 var lineName = $('#line option:selected').text(); 267 var lineName = $('#line option:selected').text();
253 if(lineName == "全部线路") 268 if(lineName == "全部线路")
254 lineName = $('#fgsdmSing option:selected').text(); 269 lineName = $('#fgsdmSing option:selected').text();
255 var i = layer.load(2); 270 var i = layer.load(2);
256 - $get('/calc_export/singledataExportTj',{gsdmSing:gsdmSing,fgsdmSing:fgsdmSing,line:line,startDate:startDate,endDate:endDate,tjtype:tjtype,cont:cont,type:'export',lineName:lineName},function(result){ 271 + $get('/calc_export/singledataExportTj',{gsdmSing:gsdmSing,fgsdmSing:fgsdmSing,line:line,startDate:startDate,endDate:endDate,tjtype:tjtype,cont:cont,sfdc:sfdc,type:'export',lineName:lineName},function(result){
257 var dateTime = ""; 272 var dateTime = "";
258 if(startDate == endDate){ 273 if(startDate == endDate){
259 dateTime = moment(startDate).format("YYYYMMDD"); 274 dateTime = moment(startDate).format("YYYYMMDD");
src/main/resources/static/real_control_v2/fragments/north/nav/report_register/add.html
@@ -40,7 +40,7 @@ @@ -40,7 +40,7 @@
40 <option value="1">首末班误点</option> 40 <option value="1">首末班误点</option>
41 <option value="2">大间隔</option> 41 <option value="2">大间隔</option>
42 <option value="3">突发事件</option> 42 <option value="3">突发事件</option>
43 -<!-- <option value="7">绕改道</option> --> 43 + <option value="7">绕改道</option>
44 <!-- <option value="4">事故</option> --> 44 <!-- <option value="4">事故</option> -->
45 <option value="5">其他</option> 45 <option value="5">其他</option>
46 <!-- <option value="6">咨询</option> --> 46 <!-- <option value="6">咨询</option> -->
src/main/resources/static/real_control_v2/fragments/north/nav/report_register/list.html
@@ -33,7 +33,7 @@ @@ -33,7 +33,7 @@
33 <li id="first_last_late" class="uk-active"><a>首末班误点</a></li> 33 <li id="first_last_late" class="uk-active"><a>首末班误点</a></li>
34 <li id="large_interval"><a>大间隔</a></li> 34 <li id="large_interval"><a>大间隔</a></li>
35 <li id="emergency"><a>突发事件</a></li> 35 <li id="emergency"><a>突发事件</a></li>
36 -<!-- <li id="detour"><a>绕改道</a></li> --> 36 + <li id="detour"><a>绕改道</a></li>
37 <!-- <li id="accident"><a>事故</a></li> --> 37 <!-- <li id="accident"><a>事故</a></li> -->
38 <li id="rests"><a>其他</a></li> 38 <li id="rests"><a>其他</a></li>
39 <!-- <li id="consult"><a>咨询</a></li> --> 39 <!-- <li id="consult"><a>咨询</a></li> -->
src/main/resources/static/real_control_v2/fragments/north/nav/report_register/manage.html
@@ -36,7 +36,7 @@ @@ -36,7 +36,7 @@
36 <li id="first_last_late" class="uk-active"><a>首末班误点</a></li> 36 <li id="first_last_late" class="uk-active"><a>首末班误点</a></li>
37 <li id="large_interval"><a>大间隔</a></li> 37 <li id="large_interval"><a>大间隔</a></li>
38 <li id="emergency"><a>突发事件</a></li> 38 <li id="emergency"><a>突发事件</a></li>
39 -<!-- <li id="detour"><a>绕改道</a></li> --> 39 + <li id="detour"><a>绕改道</a></li>
40 <!-- <li id="accident"><a>事故</a></li> --> 40 <!-- <li id="accident"><a>事故</a></li> -->
41 <li id="rests"><a>其他</a></li> 41 <li id="rests"><a>其他</a></li>
42 <!-- <li id="consult"><a>咨询</a></li> --> 42 <!-- <li id="consult"><a>咨询</a></li> -->
src/main/resources/static/real_control_v2/fragments/north/nav/report_register/update.html
@@ -41,7 +41,7 @@ @@ -41,7 +41,7 @@
41 <option value="1">首末班误点</option> 41 <option value="1">首末班误点</option>
42 <option value="2">大间隔</option> 42 <option value="2">大间隔</option>
43 <option value="3">突发事件</option> 43 <option value="3">突发事件</option>
44 -<!-- <option value="7">绕改道</option> --> 44 + <option value="7">绕改道</option>
45 <!-- <option value="4">事故</option> --> 45 <!-- <option value="4">事故</option> -->
46 <option value="5">其他</option> 46 <option value="5">其他</option>
47 <!-- <option value="6">咨询</option> --> 47 <!-- <option value="6">咨询</option> -->