Commit 3c3df9d708cb55a96445902361c9ecd73d07c861
1 parent
644c5f63
电对同人车不同路牌处理
Showing
2 changed files
with
53 additions
and
24 deletions
src/main/java/com/bsth/service/oil/impl/DlbServiceImpl.java
| @@ -2,6 +2,33 @@ package com.bsth.service.oil.impl; | @@ -2,6 +2,33 @@ package com.bsth.service.oil.impl; | ||
| 2 | 2 | ||
| 3 | 3 | ||
| 4 | 4 | ||
| 5 | +import java.sql.ResultSet; | ||
| 6 | +import java.sql.SQLException; | ||
| 7 | +import java.text.DecimalFormat; | ||
| 8 | +import java.text.ParseException; | ||
| 9 | +import java.text.SimpleDateFormat; | ||
| 10 | +import java.util.ArrayList; | ||
| 11 | +import java.util.Calendar; | ||
| 12 | +import java.util.Collections; | ||
| 13 | +import java.util.Comparator; | ||
| 14 | +import java.util.Date; | ||
| 15 | +import java.util.HashMap; | ||
| 16 | +import java.util.Iterator; | ||
| 17 | +import java.util.List; | ||
| 18 | +import java.util.Map; | ||
| 19 | + | ||
| 20 | +import javax.transaction.Transactional; | ||
| 21 | + | ||
| 22 | +import org.apache.commons.lang3.StringEscapeUtils; | ||
| 23 | +import org.slf4j.Logger; | ||
| 24 | +import org.slf4j.LoggerFactory; | ||
| 25 | +import org.springframework.beans.factory.annotation.Autowired; | ||
| 26 | +import org.springframework.data.domain.Sort; | ||
| 27 | +import org.springframework.data.domain.Sort.Direction; | ||
| 28 | +import org.springframework.jdbc.core.JdbcTemplate; | ||
| 29 | +import org.springframework.jdbc.core.RowMapper; | ||
| 30 | +import org.springframework.stereotype.Service; | ||
| 31 | + | ||
| 5 | import com.alibaba.fastjson.JSONArray; | 32 | import com.alibaba.fastjson.JSONArray; |
| 6 | import com.alibaba.fastjson.JSONObject; | 33 | import com.alibaba.fastjson.JSONObject; |
| 7 | import com.bsth.common.ResponseCode; | 34 | import com.bsth.common.ResponseCode; |
| @@ -9,34 +36,24 @@ import com.bsth.data.BasicData; | @@ -9,34 +36,24 @@ import com.bsth.data.BasicData; | ||
| 9 | import com.bsth.entity.Cars; | 36 | import com.bsth.entity.Cars; |
| 10 | import com.bsth.entity.Line; | 37 | import com.bsth.entity.Line; |
| 11 | import com.bsth.entity.oil.Cdl; | 38 | import com.bsth.entity.oil.Cdl; |
| 39 | +import com.bsth.entity.oil.Cyl; | ||
| 12 | import com.bsth.entity.oil.Dlb; | 40 | import com.bsth.entity.oil.Dlb; |
| 13 | import com.bsth.entity.oil.Jdl; | 41 | import com.bsth.entity.oil.Jdl; |
| 42 | +import com.bsth.entity.oil.Ylb; | ||
| 14 | import com.bsth.entity.oil.Ylxxb; | 43 | import com.bsth.entity.oil.Ylxxb; |
| 44 | +import com.bsth.entity.search.CustomerSpecs; | ||
| 15 | import com.bsth.repository.CarsRepository; | 45 | import com.bsth.repository.CarsRepository; |
| 16 | import com.bsth.repository.oil.CdlRepository; | 46 | import com.bsth.repository.oil.CdlRepository; |
| 47 | +import com.bsth.repository.oil.CylRepository; | ||
| 17 | import com.bsth.repository.oil.DlbRepository; | 48 | import com.bsth.repository.oil.DlbRepository; |
| 18 | import com.bsth.repository.oil.JdlRepository; | 49 | import com.bsth.repository.oil.JdlRepository; |
| 50 | +import com.bsth.repository.oil.YlbRepository; | ||
| 19 | import com.bsth.repository.oil.YlxxbRepository; | 51 | import com.bsth.repository.oil.YlxxbRepository; |
| 20 | import com.bsth.service.impl.BaseServiceImpl; | 52 | import com.bsth.service.impl.BaseServiceImpl; |
| 21 | import com.bsth.service.oil.DlbService; | 53 | import com.bsth.service.oil.DlbService; |
| 22 | import com.bsth.service.realcontrol.ScheduleRealInfoService; | 54 | import com.bsth.service.realcontrol.ScheduleRealInfoService; |
| 23 | import com.bsth.util.Arith; | 55 | import com.bsth.util.Arith; |
| 24 | import com.bsth.util.BatchSaveUtils; | 56 | import com.bsth.util.BatchSaveUtils; |
| 25 | -import org.apache.commons.lang3.StringEscapeUtils; | ||
| 26 | -import org.slf4j.Logger; | ||
| 27 | -import org.slf4j.LoggerFactory; | ||
| 28 | -import org.springframework.beans.factory.annotation.Autowired; | ||
| 29 | -import org.springframework.jdbc.core.JdbcTemplate; | ||
| 30 | -import org.springframework.jdbc.core.RowMapper; | ||
| 31 | -import org.springframework.stereotype.Service; | ||
| 32 | - | ||
| 33 | -import javax.transaction.Transactional; | ||
| 34 | -import java.sql.ResultSet; | ||
| 35 | -import java.sql.SQLException; | ||
| 36 | -import java.text.DecimalFormat; | ||
| 37 | -import java.text.ParseException; | ||
| 38 | -import java.text.SimpleDateFormat; | ||
| 39 | -import java.util.*; | ||
| 40 | 57 | ||
| 41 | @Service | 58 | @Service |
| 42 | public class DlbServiceImpl extends BaseServiceImpl<Dlb,Integer> implements DlbService{ | 59 | public class DlbServiceImpl extends BaseServiceImpl<Dlb,Integer> implements DlbService{ |
| @@ -410,7 +427,6 @@ public class DlbServiceImpl extends BaseServiceImpl<Dlb,Integer> implements DlbS | @@ -410,7 +427,6 @@ public class DlbServiceImpl extends BaseServiceImpl<Dlb,Integer> implements DlbS | ||
| 410 | // TODO Auto-generated method stub | 427 | // TODO Auto-generated method stub |
| 411 | // 当天YLB信息 | 428 | // 当天YLB信息 |
| 412 | List<Dlb> dlList = this.listOrderBy(rq,gsbm,fgsbm,line,nbbm,"nbbm"); | 429 | List<Dlb> dlList = this.listOrderBy(rq,gsbm,fgsbm,line,nbbm,"nbbm"); |
| 413 | -// repository.obtainYl(rq,gsbm,fgsbm,line,nbbm,"nbbm"); | ||
| 414 | // 当天YLXXB信息 | 430 | // 当天YLXXB信息 |
| 415 | List<Ylxxb> ylxxList = ylxxbRepository.obtainYlxx(rq, 0,gsbm); | 431 | List<Ylxxb> ylxxList = ylxxbRepository.obtainYlxx(rq, 0,gsbm); |
| 416 | // 从排班表中计算出行驶的总里程 | 432 | // 从排班表中计算出行驶的总里程 |
| @@ -467,8 +483,7 @@ public class DlbServiceImpl extends BaseServiceImpl<Dlb,Integer> implements DlbS | @@ -467,8 +483,7 @@ public class DlbServiceImpl extends BaseServiceImpl<Dlb,Integer> implements DlbS | ||
| 467 | Map<String, Object> newMap_=new HashMap<String,Object>(); | 483 | Map<String, Object> newMap_=new HashMap<String,Object>(); |
| 468 | List<Dlb> addList = new ArrayList<Dlb>(); | 484 | List<Dlb> addList = new ArrayList<Dlb>(); |
| 469 | List<Dlb> updateList = new ArrayList<Dlb>(); | 485 | List<Dlb> updateList = new ArrayList<Dlb>(); |
| 470 | - String ins=""; | ||
| 471 | - Map<String, Object> ylMap=new HashMap<String, Object>(); | 486 | + Map<String, Object> cMap=new HashMap<String, Object>(); |
| 472 | List<Map<String, Object>> listpb_=listpb; | 487 | List<Map<String, Object>> listpb_=listpb; |
| 473 | Collections.sort(listpb,new NbbmJcsxMap()); | 488 | Collections.sort(listpb,new NbbmJcsxMap()); |
| 474 | for (int x = 0; x < listpb_.size(); x++) { | 489 | for (int x = 0; x < listpb_.size(); x++) { |
| @@ -514,9 +529,24 @@ public class DlbServiceImpl extends BaseServiceImpl<Dlb,Integer> implements DlbS | @@ -514,9 +529,24 @@ public class DlbServiceImpl extends BaseServiceImpl<Dlb,Integer> implements DlbS | ||
| 514 | if (t1.getNbbm().equals(map.get("clZbh").toString()) | 529 | if (t1.getNbbm().equals(map.get("clZbh").toString()) |
| 515 | && t1.getJsy().equals(map.get("jGh").toString()) | 530 | && t1.getJsy().equals(map.get("jGh").toString()) |
| 516 | && t1.getXlbm().equals(map.get("xlBm").toString())) { | 531 | && t1.getXlbm().equals(map.get("xlBm").toString())) { |
| 517 | - t = t1; | ||
| 518 | - type = "update"; | 532 | + if(t1.getLp()==null){ |
| 533 | + //同人同车同线路不同路牌的过滤 (考虑到历史数据) | ||
| 534 | + if (cMap.get(map.get("clZbh").toString()+map.get("jGh").toString()+map.get("xlBm").toString())==null) { | ||
| 535 | + t = t1; | ||
| 536 | + type = "update"; | ||
| 537 | + cMap.put(map.get("clZbh").toString()+map.get("jGh").toString()+map.get("xlBm").toString(), | ||
| 538 | + map.get("clZbh").toString()); | ||
| 539 | + } | ||
| 540 | + }else{ | ||
| 541 | + if(t1.getLp().equals(map.get("lpName").toString())){ | ||
| 542 | + t = t1; | ||
| 543 | + type = "update"; | ||
| 544 | + } | ||
| 545 | + | ||
| 546 | + } | ||
| 519 | } | 547 | } |
| 548 | + | ||
| 549 | + | ||
| 520 | } | 550 | } |
| 521 | Double lc= Double.parseDouble(map.get("totalKilometers").toString()); | 551 | Double lc= Double.parseDouble(map.get("totalKilometers").toString()); |
| 522 | if(map.get("seqNumber").toString().equals("1")){ | 552 | if(map.get("seqNumber").toString().equals("1")){ |
| @@ -576,7 +606,7 @@ public class DlbServiceImpl extends BaseServiceImpl<Dlb,Integer> implements DlbS | @@ -576,7 +606,7 @@ public class DlbServiceImpl extends BaseServiceImpl<Dlb,Integer> implements DlbS | ||
| 576 | t.setFgsdm(map.get("bCompany") == null ? "" : map.get("bCompany").toString()); | 606 | t.setFgsdm(map.get("bCompany") == null ? "" : map.get("bCompany").toString()); |
| 577 | t.setJhsj(map.get("fcsj")==null?"":map.get("fcsj").toString()); | 607 | t.setJhsj(map.get("fcsj")==null?"":map.get("fcsj").toString()); |
| 578 | t.setRq(sdf.parse(rq)); | 608 | t.setRq(sdf.parse(rq)); |
| 579 | - | 609 | + t.setLp(map.get("lpName").toString()); |
| 580 | if(!(t.getSsgsdm().equals("") || t.getFgsdm().equals(""))){ | 610 | if(!(t.getSsgsdm().equals("") || t.getFgsdm().equals(""))){ |
| 581 | if(type.equals("add")){ | 611 | if(type.equals("add")){ |
| 582 | t.setCreatetime(date); | 612 | t.setCreatetime(date); |
| @@ -586,7 +616,6 @@ public class DlbServiceImpl extends BaseServiceImpl<Dlb,Integer> implements DlbS | @@ -586,7 +616,6 @@ public class DlbServiceImpl extends BaseServiceImpl<Dlb,Integer> implements DlbS | ||
| 586 | updateList.add(t); | 616 | updateList.add(t); |
| 587 | } | 617 | } |
| 588 | } | 618 | } |
| 589 | -// repository.save(t); | ||
| 590 | newMap.put("status", ResponseCode.SUCCESS); | 619 | newMap.put("status", ResponseCode.SUCCESS); |
| 591 | } | 620 | } |
| 592 | } | 621 | } |
src/main/resources/application-dev.properties
| @@ -8,9 +8,9 @@ spring.jpa.hibernate.naming_strategy= org.hibernate.cfg.ImprovedNamingStrategy | @@ -8,9 +8,9 @@ spring.jpa.hibernate.naming_strategy= org.hibernate.cfg.ImprovedNamingStrategy | ||
| 8 | spring.jpa.database= MYSQL | 8 | spring.jpa.database= MYSQL |
| 9 | spring.jpa.show-sql= false | 9 | spring.jpa.show-sql= false |
| 10 | spring.datasource.driver-class-name= com.mysql.jdbc.Driver | 10 | spring.datasource.driver-class-name= com.mysql.jdbc.Driver |
| 11 | -spring.datasource.url= jdbc:mysql://localhost:3306/pd_control?useUnicode=true&characterEncoding=utf-8&useSSL=false | 11 | +spring.datasource.url= jdbc:mysql://localhost:3306/control?useUnicode=true&characterEncoding=utf-8&useSSL=false |
| 12 | spring.datasource.username= root | 12 | spring.datasource.username= root |
| 13 | -spring.datasource.password= root | 13 | +spring.datasource.password= |
| 14 | #spring.datasource.url= jdbc:mysql://192.168.168.117/pd_control?useUnicode=true&characterEncoding=utf-8&useSSL=false | 14 | #spring.datasource.url= jdbc:mysql://192.168.168.117/pd_control?useUnicode=true&characterEncoding=utf-8&useSSL=false |
| 15 | #spring.datasource.username= root | 15 | #spring.datasource.username= root |
| 16 | #spring.datasource.password= root | 16 | #spring.datasource.password= root |