Commit 69f3f94ea5a1b5767ff7829e7e865dec8dcb8b73
Merge branch 'minhang' into pudong
# Conflicts: # src/main/resources/application-prod.properties
Showing
20 changed files
with
662 additions
and
53 deletions
Too many changes to show.
To preserve performance only 20 of 36 files are displayed.
src/main/java/com/bsth/controller/forms/ExportController.java
| @@ -190,9 +190,6 @@ public class ExportController { | @@ -190,9 +190,6 @@ public class ExportController { | ||
| 190 | m.put("clzbh", l.getClzbh()); | 190 | m.put("clzbh", l.getClzbh()); |
| 191 | m.put("jsy", l.getJsy()); | 191 | m.put("jsy", l.getJsy()); |
| 192 | m.put("jName", l.getjName()); | 192 | m.put("jName", l.getjName()); |
| 193 | - | ||
| 194 | - | ||
| 195 | - | ||
| 196 | m.put("sgh", l.getSgh()); | 193 | m.put("sgh", l.getSgh()); |
| 197 | m.put("sName", l.getsName()); | 194 | m.put("sName", l.getsName()); |
| 198 | m.put("jhlc", l.getJhlc()); | 195 | m.put("jhlc", l.getJhlc()); |
src/main/java/com/bsth/controller/forms/MCY_FormsController.java
| @@ -78,6 +78,13 @@ public class MCY_FormsController { | @@ -78,6 +78,13 @@ public class MCY_FormsController { | ||
| 78 | 78 | ||
| 79 | return formsService.singledata(map); | 79 | return formsService.singledata(map); |
| 80 | } | 80 | } |
| 81 | + | ||
| 82 | + // 路单数据 | ||
| 83 | + @RequestMapping(value = "/singledatanew", method = RequestMethod.GET) | ||
| 84 | + public List<Singledata> singledatanew(@RequestParam Map<String, Object> map) { | ||
| 85 | + | ||
| 86 | + return formsService.singledata(map); | ||
| 87 | + } | ||
| 81 | 88 | ||
| 82 | // 车辆加注 | 89 | // 车辆加注 |
| 83 | @RequestMapping(value = "/vehicleloading", method = RequestMethod.GET) | 90 | @RequestMapping(value = "/vehicleloading", method = RequestMethod.GET) |
src/main/java/com/bsth/controller/oil/YlxxbController.java
| 1 | package com.bsth.controller.oil; | 1 | package com.bsth.controller.oil; |
| 2 | 2 | ||
| 3 | import java.util.HashMap; | 3 | import java.util.HashMap; |
| 4 | +import java.util.List; | ||
| 4 | import java.util.Map; | 5 | import java.util.Map; |
| 5 | 6 | ||
| 6 | import org.springframework.beans.factory.annotation.Autowired; | 7 | import org.springframework.beans.factory.annotation.Autowired; |
| @@ -28,6 +29,12 @@ public class YlxxbController extends BaseController<Ylxxb, Integer>{ | @@ -28,6 +29,12 @@ public class YlxxbController extends BaseController<Ylxxb, Integer>{ | ||
| 28 | return pagequery; | 29 | return pagequery; |
| 29 | } | 30 | } |
| 30 | 31 | ||
| 32 | + @RequestMapping(value = "/listNbbm",method = RequestMethod.GET) | ||
| 33 | + public List<Ylxxb> listNbbm(@RequestParam Map<String, Object> map){ | ||
| 34 | + List<Ylxxb> list=service.Pagequery_nbbm(map); | ||
| 35 | + return list; | ||
| 36 | + } | ||
| 37 | + | ||
| 31 | 38 | ||
| 32 | /** | 39 | /** |
| 33 | * 核对油量(有加油没里程) | 40 | * 核对油量(有加油没里程) |
| @@ -45,4 +52,17 @@ public class YlxxbController extends BaseController<Ylxxb, Integer>{ | @@ -45,4 +52,17 @@ public class YlxxbController extends BaseController<Ylxxb, Integer>{ | ||
| 45 | } | 52 | } |
| 46 | return list; | 53 | return list; |
| 47 | } | 54 | } |
| 55 | + | ||
| 56 | + @RequestMapping(value = "/checkNbbm",method = RequestMethod.POST) | ||
| 57 | + public Map<String, Object> checkNbbm(@RequestParam Map<String, Object> map){ | ||
| 58 | + Map<String, Object> list=new HashMap<>(); | ||
| 59 | + try { | ||
| 60 | + list = service.checkNbbm(map); | ||
| 61 | + } catch (Exception e) { | ||
| 62 | + // TODO Auto-generated catch block | ||
| 63 | + e.printStackTrace(); | ||
| 64 | + } | ||
| 65 | + return list; | ||
| 66 | + } | ||
| 67 | + | ||
| 48 | } | 68 | } |
src/main/java/com/bsth/controller/realcontrol/BasicDataController.java
| @@ -131,7 +131,7 @@ public class BasicDataController { | @@ -131,7 +131,7 @@ public class BasicDataController { | ||
| 131 | */ | 131 | */ |
| 132 | @RequestMapping("/nbbm2PlateNo") | 132 | @RequestMapping("/nbbm2PlateNo") |
| 133 | public Map<String, String> nbbm2PlateNo(){ | 133 | public Map<String, String> nbbm2PlateNo(){ |
| 134 | - return basicData.getNbbm2PlateNo(); | 134 | + return basicData.nbbmCompanyPlateMap; |
| 135 | } | 135 | } |
| 136 | 136 | ||
| 137 | 137 |
src/main/java/com/bsth/data/BasicData.java
| @@ -12,7 +12,6 @@ import org.apache.commons.lang3.StringUtils; | @@ -12,7 +12,6 @@ import org.apache.commons.lang3.StringUtils; | ||
| 12 | import org.slf4j.Logger; | 12 | import org.slf4j.Logger; |
| 13 | import org.slf4j.LoggerFactory; | 13 | import org.slf4j.LoggerFactory; |
| 14 | import org.springframework.beans.factory.annotation.Autowired; | 14 | import org.springframework.beans.factory.annotation.Autowired; |
| 15 | -import org.springframework.jdbc.core.JdbcTemplate; | ||
| 16 | import org.springframework.stereotype.Component; | 15 | import org.springframework.stereotype.Component; |
| 17 | 16 | ||
| 18 | import java.util.*; | 17 | import java.util.*; |
| @@ -82,7 +81,7 @@ public class BasicData { | @@ -82,7 +81,7 @@ public class BasicData { | ||
| 82 | return name != null? name: stationCode2NameMap.get(prefix + code); | 81 | return name != null? name: stationCode2NameMap.get(prefix + code); |
| 83 | } | 82 | } |
| 84 | 83 | ||
| 85 | - @Autowired | 84 | +/* @Autowired |
| 86 | JdbcTemplate jdbcTemplate; | 85 | JdbcTemplate jdbcTemplate; |
| 87 | public Map<String, String> getNbbm2PlateNo(){ | 86 | public Map<String, String> getNbbm2PlateNo(){ |
| 88 | List<Map<String, Object>> list = jdbcTemplate.queryForList("select CAR_CODE,CAR_PLATE from bsth_c_cars where CAR_CODE is not null and CAR_PLATE is not null"); | 87 | List<Map<String, Object>> list = jdbcTemplate.queryForList("select CAR_CODE,CAR_PLATE from bsth_c_cars where CAR_CODE is not null and CAR_PLATE is not null"); |
| @@ -92,7 +91,7 @@ public class BasicData { | @@ -92,7 +91,7 @@ public class BasicData { | ||
| 92 | rs.put(map.get("CAR_CODE").toString(), map.get("CAR_PLATE").toString()); | 91 | rs.put(map.get("CAR_CODE").toString(), map.get("CAR_PLATE").toString()); |
| 93 | } | 92 | } |
| 94 | return rs; | 93 | return rs; |
| 95 | - } | 94 | + }*/ |
| 96 | 95 | ||
| 97 | @Component | 96 | @Component |
| 98 | public static class BasicDataLoader extends Thread { | 97 | public static class BasicDataLoader extends Thread { |
src/main/java/com/bsth/data/gpsdata/arrival/entity/TimedEnableStationRoute.java
| 1 | -package com.bsth.data.gpsdata.arrival.entity; | ||
| 2 | - | ||
| 3 | -/** | ||
| 4 | - * 定时启用站点路由 | ||
| 5 | - * Created by panzhao on 2017/8/28. | ||
| 6 | - */ | ||
| 7 | -public class TimedEnableStationRoute { | ||
| 8 | - | ||
| 9 | - private String lineCode; | ||
| 10 | - | ||
| 11 | - private Long enableTime; | ||
| 12 | - | ||
| 13 | - public String getLineCode() { | ||
| 14 | - return lineCode; | ||
| 15 | - } | ||
| 16 | - | ||
| 17 | - public void setLineCode(String lineCode) { | ||
| 18 | - this.lineCode = lineCode; | ||
| 19 | - } | ||
| 20 | - | ||
| 21 | - public Long getEnableTime() { | ||
| 22 | - return enableTime; | ||
| 23 | - } | ||
| 24 | - | ||
| 25 | - public void setEnableTime(Long enableTime) { | ||
| 26 | - this.enableTime = enableTime; | ||
| 27 | - } | ||
| 28 | -} | 1 | +package com.bsth.data.gpsdata.arrival.entity; |
| 2 | + | ||
| 3 | +/** | ||
| 4 | + * 定时启用站点路由 | ||
| 5 | + * Created by panzhao on 2017/8/28. | ||
| 6 | + */ | ||
| 7 | +public class TimedEnableStationRoute { | ||
| 8 | + | ||
| 9 | + private String lineCode; | ||
| 10 | + | ||
| 11 | + private Long enableTime; | ||
| 12 | + | ||
| 13 | + public String getLineCode() { | ||
| 14 | + return lineCode; | ||
| 15 | + } | ||
| 16 | + | ||
| 17 | + public void setLineCode(String lineCode) { | ||
| 18 | + this.lineCode = lineCode; | ||
| 19 | + } | ||
| 20 | + | ||
| 21 | + public Long getEnableTime() { | ||
| 22 | + return enableTime; | ||
| 23 | + } | ||
| 24 | + | ||
| 25 | + public void setEnableTime(Long enableTime) { | ||
| 26 | + this.enableTime = enableTime; | ||
| 27 | + } | ||
| 28 | +} |
src/main/java/com/bsth/data/gpsdata/arrival/handlers/InOutStationSignalHandle.java
| @@ -260,7 +260,7 @@ public class InOutStationSignalHandle extends SignalHandle{ | @@ -260,7 +260,7 @@ public class InOutStationSignalHandle extends SignalHandle{ | ||
| 260 | if (config != null && config.getOutConfig() == 2) { | 260 | if (config != null && config.getOutConfig() == 2) { |
| 261 | //出站既出场 | 261 | //出站既出场 |
| 262 | ScheduleRealInfo schPrev = dayOfSchedule.prev(sch); | 262 | ScheduleRealInfo schPrev = dayOfSchedule.prev(sch); |
| 263 | - if (schPrev != null && schPrev.getBcType().equals("out") && (schPrev.getBcsj()==0 || schPrev.getJhlcOrig().equals(0)) | 263 | + if (schPrev != null && schPrev.getBcType().equals("out") && (schPrev.getBcsj()==0 || schPrev.getJhlcOrig().intValue()==0) |
| 264 | && (!limitPark || park.equals(schPrev.getQdzCode()))) { | 264 | && (!limitPark || park.equals(schPrev.getQdzCode()))) { |
| 265 | 265 | ||
| 266 | schPrev.setFcsjActualAll(sch.getFcsjActualTime()); | 266 | schPrev.setFcsjActualAll(sch.getFcsjActualTime()); |
| @@ -429,7 +429,7 @@ public class InOutStationSignalHandle extends SignalHandle{ | @@ -429,7 +429,7 @@ public class InOutStationSignalHandle extends SignalHandle{ | ||
| 429 | String stopId = gps.getStopNo(); | 429 | String stopId = gps.getStopNo(); |
| 430 | for(int i = 0; i < halfList.size(); i ++){ | 430 | for(int i = 0; i < halfList.size(); i ++){ |
| 431 | sch = halfList.get(i); | 431 | sch = halfList.get(i); |
| 432 | - if(!sch.getZdzCode().equals(stopId)) | 432 | + if(!sch.getZdzCode().equals(stopId) || sch.getStatus()==2) |
| 433 | continue; | 433 | continue; |
| 434 | 434 | ||
| 435 | if(sch.getZdsjT() < gps.getTimestamp()) | 435 | if(sch.getZdsjT() < gps.getTimestamp()) |
src/main/java/com/bsth/data/gpsdata/recovery/GpsDataRecovery.java
| @@ -60,7 +60,7 @@ public class GpsDataRecovery implements ApplicationContextAware { | @@ -60,7 +60,7 @@ public class GpsDataRecovery implements ApplicationContextAware { | ||
| 60 | for (String nbbm : keys) { | 60 | for (String nbbm : keys) { |
| 61 | Collections.sort(listMap.get(nbbm), comp); | 61 | Collections.sort(listMap.get(nbbm), comp); |
| 62 | threadPool.execute(new RecoveryThread(listMap.get(nbbm), count)); | 62 | threadPool.execute(new RecoveryThread(listMap.get(nbbm), count)); |
| 63 | - /*if(nbbm.equals("W09-164")) | 63 | + /*if(nbbm.equals("S0K-004")) |
| 64 | new RecoveryThread(listMap.get(nbbm), count).run();*/ | 64 | new RecoveryThread(listMap.get(nbbm), count).run();*/ |
| 65 | /*if(lineId.equals("60028")) | 65 | /*if(lineId.equals("60028")) |
| 66 | new RecoveryThread(listMap.get(lineId), count).run();*/ | 66 | new RecoveryThread(listMap.get(lineId), count).run();*/ |
| @@ -84,7 +84,7 @@ public class GpsDataRecovery implements ApplicationContextAware { | @@ -84,7 +84,7 @@ public class GpsDataRecovery implements ApplicationContextAware { | ||
| 84 | Calendar calendar = Calendar.getInstance(); | 84 | Calendar calendar = Calendar.getInstance(); |
| 85 | int dayOfYear = calendar.get(Calendar.DAY_OF_YEAR); | 85 | int dayOfYear = calendar.get(Calendar.DAY_OF_YEAR); |
| 86 | 86 | ||
| 87 | - String sql = "select DEVICE_ID,LAT,LON,TS,SPEED_GPS,LINE_ID,SERVICE_STATE from bsth_c_gps_info where days_year=241";// + dayOfYear; | 87 | + String sql = "select DEVICE_ID,LAT,LON,TS,SPEED_GPS,LINE_ID,SERVICE_STATE from bsth_c_gps_info where days_year=245";// + dayOfYear; |
| 88 | JdbcTemplate jdbcTemplate = new JdbcTemplate(DBUtils_MS.getDataSource()); | 88 | JdbcTemplate jdbcTemplate = new JdbcTemplate(DBUtils_MS.getDataSource()); |
| 89 | 89 | ||
| 90 | List<GpsEntity> list = | 90 | List<GpsEntity> list = |
| @@ -153,7 +153,7 @@ public class GpsDataRecovery implements ApplicationContextAware { | @@ -153,7 +153,7 @@ public class GpsDataRecovery implements ApplicationContextAware { | ||
| 153 | boolean task; | 153 | boolean task; |
| 154 | for (GpsEntity gps : list) { | 154 | for (GpsEntity gps : list) { |
| 155 | try { | 155 | try { |
| 156 | - /*if(gps.getTimestamp() >= 1503960000000L){ | 156 | + /*if(gps.getTimestamp() >= 1504298280000L){ |
| 157 | System.out.println("debugger..."); | 157 | System.out.println("debugger..."); |
| 158 | }*/ | 158 | }*/ |
| 159 | //是否有任务 | 159 | //是否有任务 |
src/main/java/com/bsth/data/schedule/DayOfSchedule.java
| @@ -592,7 +592,7 @@ public class DayOfSchedule { | @@ -592,7 +592,7 @@ public class DayOfSchedule { | ||
| 592 | * @param sch 当前班次 | 592 | * @param sch 当前班次 |
| 593 | * @return | 593 | * @return |
| 594 | */ | 594 | */ |
| 595 | - private ScheduleRealInfo next2(Collection<ScheduleRealInfo> list, ScheduleRealInfo sch) { | 595 | + private ScheduleRealInfo next2_lp(Collection<ScheduleRealInfo> list, ScheduleRealInfo sch) { |
| 596 | int outConfig = -1; | 596 | int outConfig = -1; |
| 597 | LineConfig config = lineConfigData.get(sch.getXlBm()); | 597 | LineConfig config = lineConfigData.get(sch.getXlBm()); |
| 598 | if (config != null) | 598 | if (config != null) |
| @@ -605,8 +605,35 @@ public class DayOfSchedule { | @@ -605,8 +605,35 @@ public class DayOfSchedule { | ||
| 605 | flag = true; | 605 | flag = true; |
| 606 | continue; | 606 | continue; |
| 607 | } | 607 | } |
| 608 | - //忽略烂班 | ||
| 609 | - if (temp.isDestroy()) | 608 | + |
| 609 | + if (flag) { | ||
| 610 | + next = temp; | ||
| 611 | + break; | ||
| 612 | + } | ||
| 613 | + } | ||
| 614 | + return next; | ||
| 615 | + } | ||
| 616 | + | ||
| 617 | + private ScheduleRealInfo next3_lp(Collection<ScheduleRealInfo> list, ScheduleRealInfo sch) { | ||
| 618 | + int outConfig = -1; | ||
| 619 | + LineConfig config = lineConfigData.get(sch.getXlBm()); | ||
| 620 | + if (config != null) | ||
| 621 | + outConfig = config.getOutConfig(); | ||
| 622 | + | ||
| 623 | + //限定出站既出场的停车场 | ||
| 624 | + String park = config.getTwinsPark(); | ||
| 625 | + boolean limitPark = StringUtils.isNotEmpty(park); | ||
| 626 | + boolean flag = false; | ||
| 627 | + ScheduleRealInfo next = null; | ||
| 628 | + for (ScheduleRealInfo temp : list) { | ||
| 629 | + if (temp.getId() == sch.getId()) { | ||
| 630 | + flag = true; | ||
| 631 | + continue; | ||
| 632 | + } | ||
| 633 | + | ||
| 634 | + //出站既出场,忽略出场班次 | ||
| 635 | + if (outConfig == 2 && temp.getBcType().equals("out") && (temp.getBcsj()==0 || temp.getJhlcOrig().equals(0)) | ||
| 636 | + && (!limitPark || park.equals(temp.getQdzCode()))) | ||
| 610 | continue; | 637 | continue; |
| 611 | 638 | ||
| 612 | if (flag) { | 639 | if (flag) { |
| @@ -1121,7 +1148,7 @@ public class DayOfSchedule { | @@ -1121,7 +1148,7 @@ public class DayOfSchedule { | ||
| 1121 | public ScheduleRealInfo nextByLp(ScheduleRealInfo sch) { | 1148 | public ScheduleRealInfo nextByLp(ScheduleRealInfo sch) { |
| 1122 | List<ScheduleRealInfo> list = lpScheduleMap.get(sch.getXlBm() + "_" + sch.getLpName()); | 1149 | List<ScheduleRealInfo> list = lpScheduleMap.get(sch.getXlBm() + "_" + sch.getLpName()); |
| 1123 | Collections.sort(list, schFCSJComparator); | 1150 | Collections.sort(list, schFCSJComparator); |
| 1124 | - return next(list, sch); | 1151 | + return next3_lp(list, sch); |
| 1125 | } | 1152 | } |
| 1126 | 1153 | ||
| 1127 | /** | 1154 | /** |
| @@ -1133,7 +1160,7 @@ public class DayOfSchedule { | @@ -1133,7 +1160,7 @@ public class DayOfSchedule { | ||
| 1133 | public ScheduleRealInfo nextByLp2(ScheduleRealInfo sch) { | 1160 | public ScheduleRealInfo nextByLp2(ScheduleRealInfo sch) { |
| 1134 | List<ScheduleRealInfo> list = lpScheduleMap.get(sch.getXlBm() + "_" + sch.getLpName()); | 1161 | List<ScheduleRealInfo> list = lpScheduleMap.get(sch.getXlBm() + "_" + sch.getLpName()); |
| 1135 | Collections.sort(list, schFCSJComparator); | 1162 | Collections.sort(list, schFCSJComparator); |
| 1136 | - return next2(list, sch); | 1163 | + return next2_lp(list, sch); |
| 1137 | } | 1164 | } |
| 1138 | 1165 | ||
| 1139 | public ArrayListMultimap<String, ScheduleRealInfo> getLpScheduleMap() { | 1166 | public ArrayListMultimap<String, ScheduleRealInfo> getLpScheduleMap() { |
src/main/java/com/bsth/entity/oil/Ylxxb.java
| @@ -38,7 +38,7 @@ public class Ylxxb { | @@ -38,7 +38,7 @@ public class Ylxxb { | ||
| 38 | private Integer nylx; | 38 | private Integer nylx; |
| 39 | @Transient | 39 | @Transient |
| 40 | private String ldgh; | 40 | private String ldgh; |
| 41 | - //0为接口数据,1为手工输入 | 41 | + //0为接口数据,1为手工输入,2为改变车号,3为改变驾驶员 |
| 42 | private Integer jylx=0; | 42 | private Integer jylx=0; |
| 43 | @Transient | 43 | @Transient |
| 44 | private String gsname; | 44 | private String gsname; |
src/main/java/com/bsth/entity/oil/YlxxbUpdate.java
0 → 100644
| 1 | +package com.bsth.entity.oil; | ||
| 2 | + | ||
| 3 | +import java.util.Date; | ||
| 4 | + | ||
| 5 | +import javax.persistence.Entity; | ||
| 6 | +import javax.persistence.GeneratedValue; | ||
| 7 | +import javax.persistence.Id; | ||
| 8 | +import javax.persistence.Table; | ||
| 9 | +import javax.persistence.Transient; | ||
| 10 | + | ||
| 11 | +import org.springframework.format.annotation.DateTimeFormat; | ||
| 12 | + | ||
| 13 | +import com.bsth.data.BasicData; | ||
| 14 | + | ||
| 15 | +@Entity | ||
| 16 | +@Table(name = "bsth_c_ylxxb_update") | ||
| 17 | +public class YlxxbUpdate { | ||
| 18 | + @Id | ||
| 19 | + @GeneratedValue | ||
| 20 | + private Integer id; | ||
| 21 | + @DateTimeFormat(pattern="yyyy-MM-dd") | ||
| 22 | + private Date yyrq; | ||
| 23 | + private Date jlrq; | ||
| 24 | + private String nbbm; | ||
| 25 | + private String jsy; | ||
| 26 | + private Double jzl; | ||
| 27 | + private String stationid; | ||
| 28 | + private Date createtime; | ||
| 29 | + private String gsdm; | ||
| 30 | + | ||
| 31 | + private Date xgrq; | ||
| 32 | + private String xgr; | ||
| 33 | + private String tj; | ||
| 34 | + public Integer getId() { | ||
| 35 | + return id; | ||
| 36 | + } | ||
| 37 | + public void setId(Integer id) { | ||
| 38 | + this.id = id; | ||
| 39 | + } | ||
| 40 | + public Date getYyrq() { | ||
| 41 | + return yyrq; | ||
| 42 | + } | ||
| 43 | + public void setYyrq(Date yyrq) { | ||
| 44 | + this.yyrq = yyrq; | ||
| 45 | + } | ||
| 46 | + public Date getJlrq() { | ||
| 47 | + return jlrq; | ||
| 48 | + } | ||
| 49 | + public void setJlrq(Date jlrq) { | ||
| 50 | + this.jlrq = jlrq; | ||
| 51 | + } | ||
| 52 | + public String getNbbm() { | ||
| 53 | + return nbbm; | ||
| 54 | + } | ||
| 55 | + public void setNbbm(String nbbm) { | ||
| 56 | + this.nbbm = nbbm; | ||
| 57 | + } | ||
| 58 | + public String getJsy() { | ||
| 59 | + return jsy; | ||
| 60 | + } | ||
| 61 | + public void setJsy(String jsy) { | ||
| 62 | + this.jsy = jsy; | ||
| 63 | + } | ||
| 64 | + public Double getJzl() { | ||
| 65 | + return jzl; | ||
| 66 | + } | ||
| 67 | + public void setJzl(Double jzl) { | ||
| 68 | + this.jzl = jzl; | ||
| 69 | + } | ||
| 70 | + public String getStationid() { | ||
| 71 | + return stationid; | ||
| 72 | + } | ||
| 73 | + public void setStationid(String stationid) { | ||
| 74 | + this.stationid = stationid; | ||
| 75 | + } | ||
| 76 | + public Date getCreatetime() { | ||
| 77 | + return createtime; | ||
| 78 | + } | ||
| 79 | + public void setCreatetime(Date createtime) { | ||
| 80 | + this.createtime = createtime; | ||
| 81 | + } | ||
| 82 | + public String getGsdm() { | ||
| 83 | + return gsdm; | ||
| 84 | + } | ||
| 85 | + public void setGsdm(String gsdm) { | ||
| 86 | + this.gsdm = gsdm; | ||
| 87 | + } | ||
| 88 | + public Date getXgrq() { | ||
| 89 | + return xgrq; | ||
| 90 | + } | ||
| 91 | + public void setXgrq(Date xgrq) { | ||
| 92 | + this.xgrq = xgrq; | ||
| 93 | + } | ||
| 94 | + public String getXgr() { | ||
| 95 | + return xgr; | ||
| 96 | + } | ||
| 97 | + public void setXgr(String xgr) { | ||
| 98 | + this.xgr = xgr; | ||
| 99 | + } | ||
| 100 | + public String getTj() { | ||
| 101 | + return tj; | ||
| 102 | + } | ||
| 103 | + public void setTj(String tj) { | ||
| 104 | + this.tj = tj; | ||
| 105 | + } | ||
| 106 | + | ||
| 107 | + | ||
| 108 | + | ||
| 109 | + | ||
| 110 | +} |
src/main/java/com/bsth/entity/realcontrol/ScheduleRealInfo.java
| @@ -217,6 +217,14 @@ public class ScheduleRealInfo { | @@ -217,6 +217,14 @@ public class ScheduleRealInfo { | ||
| 217 | /** 是否需要补充GPS信号 (网关提交至运管处动态数据用) 1: 能发车, 2:能到达 3: 补发过*/ | 217 | /** 是否需要补充GPS信号 (网关提交至运管处动态数据用) 1: 能发车, 2:能到达 3: 补发过*/ |
| 218 | private int siginCompate; | 218 | private int siginCompate; |
| 219 | 219 | ||
| 220 | + /** | ||
| 221 | + * 漂移状态 | ||
| 222 | + * 1: 发车漂移 | ||
| 223 | + * 2:到站漂移 | ||
| 224 | + * 3:中途漂移 | ||
| 225 | + */ | ||
| 226 | + private Integer driftStatus = 0; | ||
| 227 | + | ||
| 220 | public boolean isDfAuto() { | 228 | public boolean isDfAuto() { |
| 221 | return dfAuto; | 229 | return dfAuto; |
| 222 | } | 230 | } |
| @@ -933,4 +941,12 @@ public class ScheduleRealInfo { | @@ -933,4 +941,12 @@ public class ScheduleRealInfo { | ||
| 933 | public void setSiginCompate(int siginCompate) { | 941 | public void setSiginCompate(int siginCompate) { |
| 934 | this.siginCompate = siginCompate; | 942 | this.siginCompate = siginCompate; |
| 935 | } | 943 | } |
| 944 | + | ||
| 945 | + public Integer getDriftStatus() { | ||
| 946 | + return driftStatus; | ||
| 947 | + } | ||
| 948 | + | ||
| 949 | + public void setDriftStatus(Integer driftStatus) { | ||
| 950 | + this.driftStatus = driftStatus; | ||
| 951 | + } | ||
| 936 | } | 952 | } |
src/main/java/com/bsth/repository/oil/YlxxbUpdateRepository.java
0 → 100644
| 1 | +package com.bsth.repository.oil; | ||
| 2 | + | ||
| 3 | + | ||
| 4 | +import org.springframework.stereotype.Repository; | ||
| 5 | +import com.bsth.entity.oil.YlxxbUpdate; | ||
| 6 | +import com.bsth.repository.BaseRepository; | ||
| 7 | + | ||
| 8 | +@Repository | ||
| 9 | +public interface YlxxbUpdateRepository extends BaseRepository<YlxxbUpdate, Integer>{ | ||
| 10 | + | ||
| 11 | +} |
src/main/java/com/bsth/repository/realcontrol/ScheduleRealInfoRepository.java
| @@ -146,6 +146,11 @@ public interface ScheduleRealInfoRepository extends BaseRepository<ScheduleRealI | @@ -146,6 +146,11 @@ public interface ScheduleRealInfoRepository extends BaseRepository<ScheduleRealI | ||
| 146 | @Query(value="select DISTINCT s from ScheduleRealInfo s where s.xlBm =?1 and DATE_FORMAT(s.scheduleDate,'%Y-%m-%d') = ?2 order by s.lpName, s.realExecDate,s.fcsj") | 146 | @Query(value="select DISTINCT s from ScheduleRealInfo s where s.xlBm =?1 and DATE_FORMAT(s.scheduleDate,'%Y-%m-%d') = ?2 order by s.lpName, s.realExecDate,s.fcsj") |
| 147 | List<ScheduleRealInfo> scheduleByDateAndLineQp(String line,String date); | 147 | List<ScheduleRealInfo> scheduleByDateAndLineQp(String line,String date); |
| 148 | 148 | ||
| 149 | + | ||
| 150 | + @EntityGraph(value = "scheduleRealInfo_cTasks", type = EntityGraph.EntityGraphType.FETCH) | ||
| 151 | + @Query(value="select DISTINCT s from ScheduleRealInfo s where gsBm like %?1% and fgsBm like %?2% and DATE_FORMAT(s.scheduleDate,'%Y-%m-%d') = ?3 order by s.xlDir,s.realExecDate,s.fcsj, s.lpName") | ||
| 152 | + List<ScheduleRealInfo> scheduleByDateAndLineByGs_(String gsdm,String fgsdm,String date); | ||
| 153 | + | ||
| 149 | @EntityGraph(value = "scheduleRealInfo_cTasks", type = EntityGraph.EntityGraphType.FETCH) | 154 | @EntityGraph(value = "scheduleRealInfo_cTasks", type = EntityGraph.EntityGraphType.FETCH) |
| 150 | @Query(value="select DISTINCT s from ScheduleRealInfo s where gsBm like %?1% and fgsBm like %?2% and DATE_FORMAT(s.scheduleDate,'%Y-%m-%d') = ?3 and s.bcType not in ('in','out','ldks') order by s.xlDir,s.realExecDate,s.fcsj, s.lpName") | 155 | @Query(value="select DISTINCT s from ScheduleRealInfo s where gsBm like %?1% and fgsBm like %?2% and DATE_FORMAT(s.scheduleDate,'%Y-%m-%d') = ?3 and s.bcType not in ('in','out','ldks') order by s.xlDir,s.realExecDate,s.fcsj, s.lpName") |
| 151 | List<ScheduleRealInfo> scheduleByDateAndLineByGs(String gsdm,String fgsdm,String date); | 156 | List<ScheduleRealInfo> scheduleByDateAndLineByGs(String gsdm,String fgsdm,String date); |
src/main/java/com/bsth/service/forms/FormsService.java
| @@ -30,6 +30,7 @@ public interface FormsService { | @@ -30,6 +30,7 @@ public interface FormsService { | ||
| 30 | public List<Shifday> shifday(Map<String, Object> map); | 30 | public List<Shifday> shifday(Map<String, Object> map); |
| 31 | 31 | ||
| 32 | public List<Singledata> singledata(Map<String, Object> map); | 32 | public List<Singledata> singledata(Map<String, Object> map); |
| 33 | + public List<Singledata> singledatanew(Map<String, Object> map); | ||
| 33 | 34 | ||
| 34 | public List<Vehicleloading> vehicleloading(String line,String data); | 35 | public List<Vehicleloading> vehicleloading(String line,String data); |
| 35 | 36 |
src/main/java/com/bsth/service/forms/impl/FormsServiceImpl.java
| @@ -8,6 +8,8 @@ import java.text.NumberFormat; | @@ -8,6 +8,8 @@ import java.text.NumberFormat; | ||
| 8 | import java.text.ParseException; | 8 | import java.text.ParseException; |
| 9 | import java.text.SimpleDateFormat; | 9 | import java.text.SimpleDateFormat; |
| 10 | import java.util.ArrayList; | 10 | import java.util.ArrayList; |
| 11 | +import java.util.Collections; | ||
| 12 | +import java.util.Comparator; | ||
| 11 | import java.util.Date; | 13 | import java.util.Date; |
| 12 | import java.util.HashMap; | 14 | import java.util.HashMap; |
| 13 | import java.util.HashSet; | 15 | import java.util.HashSet; |
| @@ -598,7 +600,7 @@ public class FormsServiceImpl implements FormsService { | @@ -598,7 +600,7 @@ public class FormsServiceImpl implements FormsService { | ||
| 598 | 600 | ||
| 599 | // 路单数据 | 601 | // 路单数据 |
| 600 | @Override | 602 | @Override |
| 601 | - public List<Singledata> singledata(Map<String, Object> map) { | 603 | + public List<Singledata> singledatanew(Map<String, Object> map) { |
| 602 | 604 | ||
| 603 | String gsdm=""; | 605 | String gsdm=""; |
| 604 | if(map.get("gsdmSing")!=null){ | 606 | if(map.get("gsdmSing")!=null){ |
| @@ -651,7 +653,7 @@ public class FormsServiceImpl implements FormsService { | @@ -651,7 +653,7 @@ public class FormsServiceImpl implements FormsService { | ||
| 651 | sql += " and r.xl_bm = '"+xlbm+"'"; | 653 | sql += " and r.xl_bm = '"+xlbm+"'"; |
| 652 | } | 654 | } |
| 653 | sql += " group by r.s_gh,r.s_name," | 655 | sql += " group by r.s_gh,r.s_name," |
| 654 | - + " r.xl_bm,r.cl_zbh,r.j_gh,r.j_name,r.gs_bm,r.fgs_bm order by r.xl_bm"; | 656 | + + " r.xl_bm,r.cl_zbh,r.j_gh,r.j_name,r.gs_bm,r.fgs_bm order by r.xl_bm,r.cl_zbh"; |
| 655 | 657 | ||
| 656 | List<Singledata> list = jdbcTemplate.query(sql, new RowMapper<Singledata>() { | 658 | List<Singledata> list = jdbcTemplate.query(sql, new RowMapper<Singledata>() { |
| 657 | //SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); | 659 | //SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); |
| @@ -735,6 +737,199 @@ public class FormsServiceImpl implements FormsService { | @@ -735,6 +737,199 @@ public class FormsServiceImpl implements FormsService { | ||
| 735 | return list; | 737 | return list; |
| 736 | } | 738 | } |
| 737 | 739 | ||
| 740 | + | ||
| 741 | + // 路单数据 | ||
| 742 | + @Override | ||
| 743 | + public List<Singledata> singledata(Map<String, Object> map) { | ||
| 744 | + | ||
| 745 | + String gsdm=""; | ||
| 746 | + if(map.get("gsdmSing")!=null){ | ||
| 747 | + gsdm=map.get("gsdmSing").toString(); | ||
| 748 | + } | ||
| 749 | + String fgsdm=""; | ||
| 750 | + if(map.get("fgsdmSing")!=null){ | ||
| 751 | + fgsdm=map.get("fgsdmSing").toString(); | ||
| 752 | + } | ||
| 753 | + | ||
| 754 | + String tjtype=map.get("tjtype").toString(); | ||
| 755 | + String xlbm=map.get("line").toString().trim(); | ||
| 756 | + startDate = map.get("startDate").toString(); | ||
| 757 | + | ||
| 758 | + List<ScheduleRealInfo> listReal=new ArrayList<ScheduleRealInfo>(); | ||
| 759 | + if(xlbm.equals("")){ | ||
| 760 | + listReal=scheduleRealInfoRepository.scheduleByDateAndLineByGs_(gsdm, fgsdm, startDate); | ||
| 761 | + }else{ | ||
| 762 | + listReal=scheduleRealInfoRepository.scheduleByDateAndLineQp(xlbm, startDate); | ||
| 763 | + } | ||
| 764 | + List<Singledata> list=new ArrayList<Singledata>(); | ||
| 765 | + List<Singledata> listY=new ArrayList<Singledata>(); | ||
| 766 | + List<Singledata> listD=new ArrayList<Singledata>(); | ||
| 767 | + | ||
| 768 | + if(tjtype.equals("jsy")){ | ||
| 769 | + DecimalFormat df = new DecimalFormat("0.00"); | ||
| 770 | + List<Ylb> listYlb= ylbRepository.obtainYl(startDate, gsdm, fgsdm, xlbm, "", "xlbm"); | ||
| 771 | + for (int i = 0; i < listYlb.size(); i++) { | ||
| 772 | + Ylb y=listYlb.get(i); | ||
| 773 | + String jsy=y.getJsy(); | ||
| 774 | + String line=y.getXlbm(); | ||
| 775 | + String clzbh=y.getNbbm(); | ||
| 776 | + List<ScheduleRealInfo> newList=new ArrayList<ScheduleRealInfo>(); | ||
| 777 | + for (int j = 0; j < listReal.size(); j++) { | ||
| 778 | + ScheduleRealInfo s=listReal.get(j); | ||
| 779 | + if(s.getjGh().equals(jsy) && s.getClZbh().equals(clzbh) | ||
| 780 | + &&s.getXlBm().equals(line)){ | ||
| 781 | + newList.add(s); | ||
| 782 | + } | ||
| 783 | + } | ||
| 784 | + double jhgl=culateMileageService.culateJhgl(newList); | ||
| 785 | + double jhjcc=culateMileageService.culateJhJccgl(newList); | ||
| 786 | + double yygl=culateMileageService.culateSjgl(newList); | ||
| 787 | + double ljgl=culateMileageService.culateLjgl(newList); | ||
| 788 | + double ksgl=culateMileageService.culateKsgl(newList); | ||
| 789 | + double jcgl=culateMileageService.culateJccgl(newList); | ||
| 790 | + | ||
| 791 | + double zyygl=Arith.add(yygl, ljgl); | ||
| 792 | + double zksgl=Arith.add(ksgl, jcgl); | ||
| 793 | + | ||
| 794 | + Singledata sin=new Singledata(); | ||
| 795 | + sin.setJhlc(String.valueOf(Arith.add(zyygl,zksgl))); | ||
| 796 | + | ||
| 797 | + sin.setEmptMileage(String.valueOf(zksgl)); | ||
| 798 | + sin.setJhjl(String.valueOf(Arith.add(jhgl,jhjcc))); | ||
| 799 | + sin.setxL(BasicData.lineCode2NameMap.get(y.getXlbm())); | ||
| 800 | + sin.setClzbh(clzbh); | ||
| 801 | + sin.setJsy(jsy); | ||
| 802 | + sin.setrQ(startDate); | ||
| 803 | + sin.setjName(BasicData.allPerson.get(gsdm+"-"+jsy)); | ||
| 804 | + sin.setSgh(""); | ||
| 805 | + sin.setsName(""); | ||
| 806 | + sin.setgS(BasicData.businessFgsCodeNameMap.get(fgsdm+"_"+gsdm)); | ||
| 807 | + sin.setHyl(df.format(y.getYh())); | ||
| 808 | + sin.setJzl(df.format(y.getJzl())); | ||
| 809 | + sin.setUnyyyl(df.format(y.getSh())); | ||
| 810 | + listY.add(sin); | ||
| 811 | + } | ||
| 812 | + | ||
| 813 | + List<Dlb> listDlb= dlbRepository.obtainDl(startDate, gsdm, fgsdm, xlbm, "", "xlbm"); | ||
| 814 | + for (int i = 0; i < listDlb.size(); i++) { | ||
| 815 | + | ||
| 816 | + Dlb y=listDlb.get(i); | ||
| 817 | + String jsy=y.getJsy(); | ||
| 818 | + String line=y.getXlbm(); | ||
| 819 | + String clzbh=y.getNbbm(); | ||
| 820 | + List<ScheduleRealInfo> newList=new ArrayList<ScheduleRealInfo>(); | ||
| 821 | + for (int j = 0; j < listReal.size(); j++) { | ||
| 822 | + ScheduleRealInfo s=listReal.get(j); | ||
| 823 | + if(s.getjGh().equals(jsy) && s.getClZbh().equals(clzbh) | ||
| 824 | + &&s.getXlBm().equals(line)){ | ||
| 825 | + newList.add(s); | ||
| 826 | + } | ||
| 827 | + } | ||
| 828 | + double jhgl=culateMileageService.culateJhgl(newList); | ||
| 829 | + double jhjcc=culateMileageService.culateJhJccgl(newList); | ||
| 830 | + double yygl=culateMileageService.culateSjgl(newList); | ||
| 831 | + double ljgl=culateMileageService.culateLjgl(newList); | ||
| 832 | + double ksgl=culateMileageService.culateKsgl(newList); | ||
| 833 | + double jcgl=culateMileageService.culateJccgl(newList); | ||
| 834 | + | ||
| 835 | + double zyygl=Arith.add(yygl, ljgl); | ||
| 836 | + double zksgl=Arith.add(ksgl, jcgl); | ||
| 837 | + | ||
| 838 | + Singledata sin=new Singledata(); | ||
| 839 | + sin.setJhlc(String.valueOf(Arith.add(zyygl,zksgl))); | ||
| 840 | + | ||
| 841 | + sin.setEmptMileage(String.valueOf(zksgl)); | ||
| 842 | + sin.setJhjl(String.valueOf(Arith.add(jhgl,jhjcc))); | ||
| 843 | + sin.setxL(BasicData.lineCode2NameMap.get(y.getXlbm())); | ||
| 844 | + sin.setClzbh(clzbh); | ||
| 845 | + sin.setJsy(jsy); | ||
| 846 | + sin.setrQ(startDate); | ||
| 847 | + sin.setjName(BasicData.allPerson.get(gsdm+"-"+jsy)); | ||
| 848 | + sin.setSgh(""); | ||
| 849 | + sin.setsName(""); | ||
| 850 | + sin.setgS(BasicData.businessFgsCodeNameMap.get(fgsdm+"_"+gsdm)); | ||
| 851 | + sin.setHyl(df.format(y.getHd())); | ||
| 852 | + sin.setJzl(df.format(y.getCdl())); | ||
| 853 | + sin.setUnyyyl(df.format(y.getSh())); | ||
| 854 | + listD.add(sin); | ||
| 855 | + } | ||
| 856 | + | ||
| 857 | + Collections.sort(listY,new SingledataByXlbm()); | ||
| 858 | + Collections.sort(listD,new SingledataByXlbm()); | ||
| 859 | + list.addAll(listY); | ||
| 860 | + list.addAll(listD); | ||
| 861 | + }else{ | ||
| 862 | + String sql="select r.s_gh,r.s_name, " | ||
| 863 | + + " r.xl_bm,r.cl_zbh,r.gs_bm,r.fgs_bm" | ||
| 864 | + + " from bsth_c_s_sp_info_real r where " | ||
| 865 | + + " r.schedule_date_str = '"+startDate+"'" | ||
| 866 | + + " and r.s_gh !='' and r.s_gh is not null "; | ||
| 867 | + if(xlbm.equals("")){ | ||
| 868 | + sql +="and r.gs_bm='"+gsdm+"' " | ||
| 869 | + + " and r.fgs_bm='"+fgsdm+"'"; | ||
| 870 | + }else{ | ||
| 871 | + sql += " and r.xl_bm = '"+xlbm+"'"; | ||
| 872 | + } | ||
| 873 | + sql += " group by r.s_gh,r.s_name," | ||
| 874 | + + " r.xl_bm,r.cl_zbh,r.gs_bm,r.fgs_bm order by r.xl_bm,r.cl_zbh"; | ||
| 875 | + | ||
| 876 | + list = jdbcTemplate.query(sql, new RowMapper<Singledata>() { | ||
| 877 | + //SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); | ||
| 878 | + @Override | ||
| 879 | + public Singledata mapRow(ResultSet arg0, int arg1) throws SQLException { | ||
| 880 | + Singledata sin = new Singledata(); | ||
| 881 | + sin.setrQ(startDate); | ||
| 882 | + sin.setxL(arg0.getString("xl_bm")); | ||
| 883 | + sin.setClzbh(arg0.getString("cl_zbh")); | ||
| 884 | + sin.setSgh(arg0.getString("s_gh")); | ||
| 885 | + sin.setsName(arg0.getString("s_name")); | ||
| 886 | + return sin; | ||
| 887 | + } | ||
| 888 | + }); | ||
| 889 | + | ||
| 890 | + for (int i = 0; i < list.size(); i++) { | ||
| 891 | + Singledata sin=list.get(i); | ||
| 892 | + String jsy=sin.getSgh(); | ||
| 893 | + String line=sin.getxL(); | ||
| 894 | + String clzbh=sin.getClzbh(); | ||
| 895 | + List<ScheduleRealInfo> newList=new ArrayList<ScheduleRealInfo>(); | ||
| 896 | + for (int j = 0; j < listReal.size(); j++) { | ||
| 897 | + ScheduleRealInfo s=listReal.get(j); | ||
| 898 | + if(s.getsGh().equals(jsy) && s.getClZbh().equals(clzbh) | ||
| 899 | + &&s.getXlBm().equals(line)){ | ||
| 900 | + newList.add(s); | ||
| 901 | + } | ||
| 902 | + } | ||
| 903 | + double jhgl=culateMileageService.culateJhgl(newList); | ||
| 904 | + double jhjcc=culateMileageService.culateJhJccgl(newList); | ||
| 905 | + double yygl=culateMileageService.culateSjgl(newList); | ||
| 906 | + double ljgl=culateMileageService.culateLjgl(newList); | ||
| 907 | + double ksgl=culateMileageService.culateKsgl(newList); | ||
| 908 | + double jcgl=culateMileageService.culateJccgl(newList); | ||
| 909 | + | ||
| 910 | + double zyygl=Arith.add(yygl, ljgl); | ||
| 911 | + double zksgl=Arith.add(ksgl, jcgl); | ||
| 912 | + | ||
| 913 | + sin.setJhlc(String.valueOf(Arith.add(zyygl,zksgl))); | ||
| 914 | + | ||
| 915 | + sin.setEmptMileage(String.valueOf(zksgl)); | ||
| 916 | + sin.setJhjl(String.valueOf(Arith.add(jhgl,jhjcc))); | ||
| 917 | + sin.setxL(BasicData.lineCode2NameMap.get(line)); | ||
| 918 | + sin.setClzbh(clzbh); | ||
| 919 | + sin.setJsy(""); | ||
| 920 | + sin.setjName(""); | ||
| 921 | + sin.setgS(BasicData.businessFgsCodeNameMap.get(fgsdm+"_"+gsdm)); | ||
| 922 | + sin.setHyl(""); | ||
| 923 | + sin.setJzl(""); | ||
| 924 | + sin.setUnyyyl(""); | ||
| 925 | + } | ||
| 926 | + Collections.sort(list,new SingledataByXlbm()); | ||
| 927 | + } | ||
| 928 | + | ||
| 929 | + return list; | ||
| 930 | + | ||
| 931 | + } | ||
| 932 | + | ||
| 738 | // 运营服务阶段报表 | 933 | // 运营服务阶段报表 |
| 739 | @Override | 934 | @Override |
| 740 | public List<Operationservice> operationservice(Map<String, Object> map) { | 935 | public List<Operationservice> operationservice(Map<String, Object> map) { |
| @@ -1398,4 +1593,12 @@ public class FormsServiceImpl implements FormsService { | @@ -1398,4 +1593,12 @@ public class FormsServiceImpl implements FormsService { | ||
| 1398 | } | 1593 | } |
| 1399 | return list; | 1594 | return list; |
| 1400 | } | 1595 | } |
| 1596 | + | ||
| 1597 | + class SingledataByXlbm implements Comparator<Singledata>{ | ||
| 1598 | + @Override | ||
| 1599 | + public int compare(Singledata o1, Singledata o2) { | ||
| 1600 | + // TODO Auto-generated method stub | ||
| 1601 | + return o2.getxL().compareTo(o1.getxL()); | ||
| 1602 | + } | ||
| 1603 | + } | ||
| 1401 | } | 1604 | } |
src/main/java/com/bsth/service/oil/YlxxbService.java
| 1 | package com.bsth.service.oil; | 1 | package com.bsth.service.oil; |
| 2 | 2 | ||
| 3 | +import java.util.List; | ||
| 3 | import java.util.Map; | 4 | import java.util.Map; |
| 4 | 5 | ||
| 5 | import com.bsth.entity.oil.Ylxxb; | 6 | import com.bsth.entity.oil.Ylxxb; |
| @@ -9,6 +10,9 @@ import com.bsth.util.PageObject; | @@ -9,6 +10,9 @@ import com.bsth.util.PageObject; | ||
| 9 | public interface YlxxbService extends BaseService<Ylxxb, Integer>{ | 10 | public interface YlxxbService extends BaseService<Ylxxb, Integer>{ |
| 10 | PageObject<Ylxxb> Pagequery(Map<String, Object> map) ; | 11 | PageObject<Ylxxb> Pagequery(Map<String, Object> map) ; |
| 11 | 12 | ||
| 13 | + List<Ylxxb> Pagequery_nbbm(Map<String, Object> map) ; | ||
| 14 | + | ||
| 12 | Map<String, Object> checkJsy(Map<String, Object> map) throws Exception; | 15 | Map<String, Object> checkJsy(Map<String, Object> map) throws Exception; |
| 16 | + Map<String, Object> checkNbbm(Map<String, Object> map) throws Exception; | ||
| 13 | 17 | ||
| 14 | } | 18 | } |
src/main/java/com/bsth/service/oil/impl/YlxxbServiceImpl.java
| @@ -5,6 +5,7 @@ import java.sql.SQLException; | @@ -5,6 +5,7 @@ import java.sql.SQLException; | ||
| 5 | import java.text.ParseException; | 5 | import java.text.ParseException; |
| 6 | import java.text.SimpleDateFormat; | 6 | import java.text.SimpleDateFormat; |
| 7 | import java.util.ArrayList; | 7 | import java.util.ArrayList; |
| 8 | +import java.util.Date; | ||
| 8 | import java.util.HashMap; | 9 | import java.util.HashMap; |
| 9 | import java.util.List; | 10 | import java.util.List; |
| 10 | import java.util.Map; | 11 | import java.util.Map; |
| @@ -25,9 +26,11 @@ import com.bsth.common.ResponseCode; | @@ -25,9 +26,11 @@ import com.bsth.common.ResponseCode; | ||
| 25 | import com.bsth.entity.excep.Offline; | 26 | import com.bsth.entity.excep.Offline; |
| 26 | import com.bsth.entity.oil.Ylb; | 27 | import com.bsth.entity.oil.Ylb; |
| 27 | import com.bsth.entity.oil.Ylxxb; | 28 | import com.bsth.entity.oil.Ylxxb; |
| 29 | +import com.bsth.entity.oil.YlxxbUpdate; | ||
| 28 | import com.bsth.entity.search.CustomerSpecs; | 30 | import com.bsth.entity.search.CustomerSpecs; |
| 29 | import com.bsth.repository.oil.YlbRepository; | 31 | import com.bsth.repository.oil.YlbRepository; |
| 30 | import com.bsth.repository.oil.YlxxbRepository; | 32 | import com.bsth.repository.oil.YlxxbRepository; |
| 33 | +import com.bsth.repository.oil.YlxxbUpdateRepository; | ||
| 31 | import com.bsth.service.impl.BaseServiceImpl; | 34 | import com.bsth.service.impl.BaseServiceImpl; |
| 32 | import com.bsth.service.oil.YlxxbService; | 35 | import com.bsth.service.oil.YlxxbService; |
| 33 | import com.bsth.util.PageHelper; | 36 | import com.bsth.util.PageHelper; |
| @@ -40,6 +43,8 @@ public class YlxxbServiceImpl extends BaseServiceImpl<Ylxxb,Integer> implements | @@ -40,6 +43,8 @@ public class YlxxbServiceImpl extends BaseServiceImpl<Ylxxb,Integer> implements | ||
| 40 | @Autowired | 43 | @Autowired |
| 41 | YlxxbRepository repository; | 44 | YlxxbRepository repository; |
| 42 | @Autowired | 45 | @Autowired |
| 46 | + YlxxbUpdateRepository updateRepository; | ||
| 47 | + @Autowired | ||
| 43 | YlbRepository ylbRepository; | 48 | YlbRepository ylbRepository; |
| 44 | @Autowired | 49 | @Autowired |
| 45 | JdbcTemplate jdbcTemplate; | 50 | JdbcTemplate jdbcTemplate; |
| @@ -53,7 +58,7 @@ public class YlxxbServiceImpl extends BaseServiceImpl<Ylxxb,Integer> implements | @@ -53,7 +58,7 @@ public class YlxxbServiceImpl extends BaseServiceImpl<Ylxxb,Integer> implements | ||
| 53 | String sql=" select * from (" | 58 | String sql=" select * from (" |
| 54 | + "select *,CONCAT(nbbm,jsy) as nj " | 59 | + "select *,CONCAT(nbbm,jsy) as nj " |
| 55 | + " from bsth_c_ylxxb where yyrq='"+rq+"' " | 60 | + " from bsth_c_ylxxb where yyrq='"+rq+"' " |
| 56 | - + " and gsdm ='"+gsdm+"' and jylx ='0') x where x.nj not in (" | 61 | + + " and gsdm ='"+gsdm+"' and jylx !='1') x where x.nj not in (" |
| 57 | + " select CONCAT(nbbm,jsy) from bsth_c_ylb " | 62 | + " select CONCAT(nbbm,jsy) from bsth_c_ylb " |
| 58 | + " where rq='"+rq+"'" | 63 | + " where rq='"+rq+"'" |
| 59 | + " and ssgsdm='"+gsdm+"' and fgsdm ='"+fgsdm+"')" | 64 | + " and ssgsdm='"+gsdm+"' and fgsdm ='"+fgsdm+"')" |
| @@ -61,7 +66,7 @@ public class YlxxbServiceImpl extends BaseServiceImpl<Ylxxb,Integer> implements | @@ -61,7 +66,7 @@ public class YlxxbServiceImpl extends BaseServiceImpl<Ylxxb,Integer> implements | ||
| 61 | + " where rq='"+rq+"'" | 66 | + " where rq='"+rq+"'" |
| 62 | + " and ssgsdm='"+gsdm+"' and fgsdm ='"+fgsdm+"') " | 67 | + " and ssgsdm='"+gsdm+"' and fgsdm ='"+fgsdm+"') " |
| 63 | + " and x.nbbm not in (select nbbm from bsth_c_ylxxb" | 68 | + " and x.nbbm not in (select nbbm from bsth_c_ylxxb" |
| 64 | - + " where yyrq='"+rq+"' and gsdm ='"+gsdm+"' AND jylx ='1')"; | 69 | + + " where yyrq='"+rq+"' and gsdm ='"+gsdm+"' AND jylx !='0')"; |
| 65 | 70 | ||
| 66 | 71 | ||
| 67 | /*String sql= "select v.*,u.jsy as ldgh from " | 72 | /*String sql= "select v.*,u.jsy as ldgh from " |
| @@ -179,7 +184,7 @@ public class YlxxbServiceImpl extends BaseServiceImpl<Ylxxb,Integer> implements | @@ -179,7 +184,7 @@ public class YlxxbServiceImpl extends BaseServiceImpl<Ylxxb,Integer> implements | ||
| 179 | Ylxxb ylxxb=repository.findOne(id); | 184 | Ylxxb ylxxb=repository.findOne(id); |
| 180 | if(!ylxxb.getJsy().equals(jsy)){ | 185 | if(!ylxxb.getJsy().equals(jsy)){ |
| 181 | ylxxb.setJsy(jsy); | 186 | ylxxb.setJsy(jsy); |
| 182 | - ylxxb.setJylx(1); | 187 | + ylxxb.setJylx(3); |
| 183 | repository.save(ylxxb); | 188 | repository.save(ylxxb); |
| 184 | } | 189 | } |
| 185 | } | 190 | } |
| @@ -191,5 +196,87 @@ public class YlxxbServiceImpl extends BaseServiceImpl<Ylxxb,Integer> implements | @@ -191,5 +196,87 @@ public class YlxxbServiceImpl extends BaseServiceImpl<Ylxxb,Integer> implements | ||
| 191 | } | 196 | } |
| 192 | return newMap; | 197 | return newMap; |
| 193 | } | 198 | } |
| 199 | + @Override | ||
| 200 | + public List<Ylxxb> Pagequery_nbbm(Map<String, Object> map) { | ||
| 201 | + // TODO Auto-generated method stub | ||
| 202 | + String rq=map.get("yyrq").toString(); | ||
| 203 | + String gsdm=map.get("gsdm_like").toString(); | ||
| 204 | + String nbbm=map.get("nbbm").toString(); | ||
| 205 | + | ||
| 206 | + String sql="select * from (select *,CONCAT(t.nbbm,'_',t.jsy,'_',t.jzl) as tj " | ||
| 207 | + + " from bsth_c_ylxxb t where t.yyrq='"+rq+"' and t.gsdm='"+gsdm+"' and " | ||
| 208 | + + " t.nylx=0 and t.jylx=0 and t.nbbm like '%"+nbbm+"%') y " | ||
| 209 | + + " where y.nbbm not in (select c.inside_code from bsth_c_cars c " | ||
| 210 | + + " where c.business_code ='05' and c.sfdc=0) and y.tj not in (" | ||
| 211 | + + " select x.tj from bsth_c_ylxxb_update x)"; | ||
| 212 | + | ||
| 213 | + //根具条件查询指定日期Ylb的数据 | ||
| 214 | +// List<Ylb> ylbIterator=ylbRepository.checkYl(rq,gsdm,fgsdm); | ||
| 215 | + List<Ylxxb> list=jdbcTemplate.query(sql, | ||
| 216 | + new RowMapper<Ylxxb>(){ | ||
| 217 | + @Override | ||
| 218 | + public Ylxxb mapRow(ResultSet rs, int rowNum) throws SQLException { | ||
| 219 | + Ylxxb s = new Ylxxb(); | ||
| 220 | + s.setId(rs.getInt("id")); | ||
| 221 | + s.setYyrq(rs.getDate("yyrq")); | ||
| 222 | + s.setNbbm(rs.getString("nbbm")); | ||
| 223 | + s.setGsdm(rs.getString("gsdm")); | ||
| 224 | + s.setJsy(rs.getString("jsy")); | ||
| 225 | + s.setJzl(rs.getDouble("jzl")); | ||
| 226 | + s.setStationid(rs.getString("stationid")); | ||
| 227 | + s.setNylx(rs.getInt("nylx")); | ||
| 228 | + s.setJyggh(rs.getString("jyggh")); | ||
| 229 | + s.setYj(rs.getDouble("yj")); | ||
| 230 | +// s.setLdgh(rs.getString("ldgh")); | ||
| 231 | + s.setBz(rs.getString("bz")); | ||
| 232 | + return s; | ||
| 233 | + } | ||
| 234 | + }); | ||
| 235 | + return list; | ||
| 236 | + } | ||
| 194 | 237 | ||
| 195 | -} | ||
| 196 | \ No newline at end of file | 238 | \ No newline at end of file |
| 239 | + | ||
| 240 | + @Transactional | ||
| 241 | + @Override | ||
| 242 | + public Map<String, Object> checkNbbm(Map<String, Object> map) throws Exception{ | ||
| 243 | + Map<String, Object> newMap=new HashMap<String,Object>(); | ||
| 244 | + // TODO Auto-generated method stub | ||
| 245 | + try { | ||
| 246 | +// int id=Integer.parseInt(map.get("id").toString()); | ||
| 247 | +// String jsy=map.get("jsy").toString(); | ||
| 248 | +// Ylxxb ylxxb=repository.findOne(id); | ||
| 249 | +// ylxxb.setJsy(jsy); | ||
| 250 | +// repository.save(ylxxb); | ||
| 251 | + String json =StringEscapeUtils.unescapeHtml4(map.get("ylbList").toString()); | ||
| 252 | + JSONArray jsonArray=JSONArray.parseArray(json); | ||
| 253 | + JSONObject jsonObject; | ||
| 254 | + for (int x = 0; x < jsonArray.size(); x++) { | ||
| 255 | + jsonObject=jsonArray.getJSONObject(x); | ||
| 256 | + Integer id =jsonObject.getInteger("id"); | ||
| 257 | + String nbbm =jsonObject.getString("nbbm").trim(); | ||
| 258 | + Ylxxb ylxxb=repository.findOne(id); | ||
| 259 | + if(!ylxxb.getNbbm().equals(nbbm)){ | ||
| 260 | + ylxxb.setNbbm(nbbm); | ||
| 261 | + ylxxb.setJylx(2); | ||
| 262 | + repository.save(ylxxb); | ||
| 263 | + YlxxbUpdate ylxxbUpdate=new YlxxbUpdate(); | ||
| 264 | + ylxxbUpdate.setGsdm(ylxxb.getGsdm()); | ||
| 265 | + ylxxbUpdate.setJsy(ylxxb.getJsy()); | ||
| 266 | + ylxxbUpdate.setJzl(ylxxb.getJzl()); | ||
| 267 | + ylxxbUpdate.setJlrq(ylxxb.getJlrq()); | ||
| 268 | + ylxxbUpdate.setNbbm(ylxxb.getNbbm()); | ||
| 269 | + ylxxbUpdate.setYyrq(ylxxb.getYyrq()); | ||
| 270 | + ylxxbUpdate.setCreatetime(new Date()); | ||
| 271 | + ylxxbUpdate.setTj(nbbm+"_"+ylxxb.getJsy()+"_"+ylxxb.getJzl()); | ||
| 272 | + updateRepository.save(ylxxbUpdate); | ||
| 273 | + } | ||
| 274 | + } | ||
| 275 | + newMap.put("status", ResponseCode.SUCCESS); | ||
| 276 | + }catch(Exception e){ | ||
| 277 | + newMap.put("status", ResponseCode.ERROR); | ||
| 278 | + logger.error("save erro.", e); | ||
| 279 | + throw e; | ||
| 280 | + } | ||
| 281 | + return newMap; | ||
| 282 | + } | ||
| 283 | +} |
src/main/java/com/bsth/service/schedule/impl/SchedulePlanServiceImpl.java
| @@ -436,7 +436,7 @@ public class SchedulePlanServiceImpl extends BServiceImpl<SchedulePlan, Long> im | @@ -436,7 +436,7 @@ public class SchedulePlanServiceImpl extends BServiceImpl<SchedulePlan, Long> im | ||
| 436 | Line xl = lineRepository.findOne(schedulePlan.getXl().getId()); | 436 | Line xl = lineRepository.findOne(schedulePlan.getXl().getId()); |
| 437 | logger.info("<--- 排班master线路 id={}, name={}, 开始排班", xl.getId(), xl.getName()); | 437 | logger.info("<--- 排班master线路 id={}, name={}, 开始排班", xl.getId(), xl.getName()); |
| 438 | 438 | ||
| 439 | - // 2、确定主线路排班(无套跑规则) | 439 | + // 2、确定主线路排班(包含完全套跑路牌规则,所谓完全套跑路牌规则指整个路牌的班次都是套跑规则指定的) |
| 440 | PlanResult planResult = schedulePlanWithOutRerun(schedulePlan); | 440 | PlanResult planResult = schedulePlanWithOutRerun(schedulePlan); |
| 441 | 441 | ||
| 442 | // 3、确定套跑规则 | 442 | // 3、确定套跑规则 |
| @@ -445,6 +445,15 @@ public class SchedulePlanServiceImpl extends BServiceImpl<SchedulePlan, Long> im | @@ -445,6 +445,15 @@ public class SchedulePlanServiceImpl extends BServiceImpl<SchedulePlan, Long> im | ||
| 445 | // TODO:3-1、验证排班结果 | 445 | // TODO:3-1、验证排班结果 |
| 446 | validPlanResult(planResult, schedulePlan); | 446 | validPlanResult(planResult, schedulePlan); |
| 447 | 447 | ||
| 448 | + // TODO:3-2、去除完全套跑遗漏班次(以后放到规则中执行) | ||
| 449 | + Iterator<SchedulePlanInfo> infoIterator = planResult.getSchedulePlanInfos().iterator(); | ||
| 450 | + while (infoIterator.hasNext()) { | ||
| 451 | + SchedulePlanInfo schedulePlanInfo = infoIterator.next(); | ||
| 452 | + if (schedulePlanInfo.getCl() == null) { | ||
| 453 | + infoIterator.remove(); | ||
| 454 | + } | ||
| 455 | + } | ||
| 456 | + | ||
| 448 | // 4、保存数据(jdbcTemplate 批量插入) | 457 | // 4、保存数据(jdbcTemplate 批量插入) |
| 449 | Date start4 = new Date(); | 458 | Date start4 = new Date(); |
| 450 | scheduleRuleService.generateSchedulePlan(schedulePlan, planResult.getSchedulePlanInfos()); | 459 | scheduleRuleService.generateSchedulePlan(schedulePlan, planResult.getSchedulePlanInfos()); |
src/main/java/com/bsth/service/schedule/rules/validate/ValidWholeRerunBcFunction.java
0 → 100644
| 1 | +package com.bsth.service.schedule.rules.validate; | ||
| 2 | + | ||
| 3 | +import com.bsth.entity.schedule.SchedulePlanInfo; | ||
| 4 | +import org.kie.api.runtime.rule.AccumulateFunction; | ||
| 5 | + | ||
| 6 | +import java.io.*; | ||
| 7 | +import java.text.SimpleDateFormat; | ||
| 8 | +import java.util.ArrayList; | ||
| 9 | +import java.util.HashMap; | ||
| 10 | +import java.util.List; | ||
| 11 | +import java.util.Map; | ||
| 12 | + | ||
| 13 | +/** | ||
| 14 | + * 验证完全套跑路牌班次正确性。 | ||
| 15 | + * 完全套跑路牌班次指此路牌下的所有班次由其他线路完成。 | ||
| 16 | + * 记录漏掉的班次,并给出警告信息。 | ||
| 17 | + */ | ||
| 18 | +public class ValidWholeRerunBcFunction implements AccumulateFunction { | ||
| 19 | + @Override | ||
| 20 | + public void writeExternal(ObjectOutput out) throws IOException { | ||
| 21 | + } | ||
| 22 | + | ||
| 23 | + @Override | ||
| 24 | + public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException { | ||
| 25 | + | ||
| 26 | + } | ||
| 27 | + | ||
| 28 | + protected static class RerunBcInfo implements Externalizable { | ||
| 29 | + /** 错误描述 */ | ||
| 30 | + public List<ValidateResults_output.ValidInfo> validInfoList = new ArrayList<>(); | ||
| 31 | + /** 内部计数Map,key:{路牌Id}_{发车时间},value:个数 */ | ||
| 32 | + public Map<String, Integer> lpBcFcsjCount = new HashMap<>(); | ||
| 33 | + | ||
| 34 | + public RerunBcInfo() { | ||
| 35 | + } | ||
| 36 | + | ||
| 37 | + @Override | ||
| 38 | + public void writeExternal(ObjectOutput out) throws IOException { | ||
| 39 | + out.writeObject(validInfoList); | ||
| 40 | + } | ||
| 41 | + | ||
| 42 | + @Override | ||
| 43 | + public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException { | ||
| 44 | + validInfoList = (List<ValidateResults_output.ValidInfo>) in.readObject(); | ||
| 45 | + } | ||
| 46 | + } | ||
| 47 | + | ||
| 48 | + @Override | ||
| 49 | + public Serializable createContext() { | ||
| 50 | +// System.out.println("create"); | ||
| 51 | + return new RerunBcInfo(); | ||
| 52 | + } | ||
| 53 | + | ||
| 54 | + @Override | ||
| 55 | + public void init(Serializable serializable) throws Exception { | ||
| 56 | + // TODO: | ||
| 57 | +// System.out.println("init"); | ||
| 58 | + } | ||
| 59 | + | ||
| 60 | + @Override | ||
| 61 | + public void accumulate(Serializable context, Object o) { | ||
| 62 | + RerunBcInfo rerunBcInfo = (RerunBcInfo) context; | ||
| 63 | + SchedulePlanInfo schedulePlanInfo = (SchedulePlanInfo) o; | ||
| 64 | + | ||
| 65 | + String key = schedulePlanInfo.getLp() + "_" + schedulePlanInfo.getFcsj(); | ||
| 66 | + SimpleDateFormat sf = new SimpleDateFormat("yyyy年MM月dd日"); | ||
| 67 | + String infoformat = "日期(%s),路牌(%s)完全套跑,班次(%s),在套跑规则中未指定"; | ||
| 68 | + | ||
| 69 | + if (schedulePlanInfo.getCl() == null) { | ||
| 70 | + rerunBcInfo.lpBcFcsjCount.put(key, 1); | ||
| 71 | + | ||
| 72 | + ValidateResults_output.ValidInfo validInfo = new ValidateResults_output.ValidInfo(); | ||
| 73 | + validInfo.setSd(schedulePlanInfo.getScheduleDate()); | ||
| 74 | + validInfo.setDesc(String.format( | ||
| 75 | + infoformat, | ||
| 76 | + sf.format(schedulePlanInfo.getScheduleDate()), | ||
| 77 | + schedulePlanInfo.getLpName(), | ||
| 78 | + schedulePlanInfo.getFcsj(), | ||
| 79 | + 1)); | ||
| 80 | + | ||
| 81 | + rerunBcInfo.validInfoList.add(validInfo); | ||
| 82 | + } | ||
| 83 | + } | ||
| 84 | + | ||
| 85 | + @Override | ||
| 86 | + public boolean supportsReverse() { | ||
| 87 | + return true; | ||
| 88 | + } | ||
| 89 | + | ||
| 90 | + @Override | ||
| 91 | + public void reverse(Serializable context, Object o) throws Exception { | ||
| 92 | + RerunBcInfo rerunBcInfo = (RerunBcInfo) context; | ||
| 93 | + SchedulePlanInfo schedulePlanInfo = (SchedulePlanInfo) o; | ||
| 94 | + | ||
| 95 | + String key = schedulePlanInfo.getLp() + "_" + schedulePlanInfo.getFcsj(); | ||
| 96 | + rerunBcInfo.lpBcFcsjCount.remove(key); | ||
| 97 | + | ||
| 98 | + if (!rerunBcInfo.validInfoList.isEmpty()) { // 全部清空 | ||
| 99 | + rerunBcInfo.validInfoList.clear(); | ||
| 100 | + } | ||
| 101 | + } | ||
| 102 | + | ||
| 103 | + @Override | ||
| 104 | + public Class<?> getResultType() { | ||
| 105 | + return List.class; | ||
| 106 | + } | ||
| 107 | + | ||
| 108 | + @Override | ||
| 109 | + public Object getResult(Serializable context) throws Exception { | ||
| 110 | + RerunBcInfo rerunBcInfo = (RerunBcInfo) context; | ||
| 111 | + return rerunBcInfo.validInfoList; | ||
| 112 | + } | ||
| 113 | +} |