Commit 4e501eed9c27bac0db51437526bb75796abbcee2

Authored by 徐烜
2 parents 6a5549cf 3fa0edcc

Update

Showing 49 changed files with 2893 additions and 951 deletions

Too many changes to show.

To preserve performance only 49 of 51 files are displayed.

src/main/java/com/bsth/common/Constants.java
... ... @@ -21,6 +21,9 @@ public class Constants {
21 21 public static final String LOGIN_FAILURE = "/user/loginFailure";
22 22 public static final String CAPTCHA = "/captcha.jpg";
23 23  
  24 + //对外的营运数据接口
  25 + public static final String SERVICE_INTERFACE = "/companyService/**";
  26 +
24 27 /**
25 28 * 线调部分子页面不做拦截,便于浏览器缓存
26 29 */
... ...
src/main/java/com/bsth/controller/oil/YlbController.java
... ... @@ -119,8 +119,15 @@ public class YlbController extends BaseController<Ylb, Integer>{
119 119  
120 120 Direction d;
121 121 map.put("xlbm_like", map.get("xlbm_like").toString().trim());
122   -// try {
123 122 String rq=map.get("rq").toString();
  123 + int lx=Integer.parseInt(map.get("sxtj").toString().trim());
  124 + if(lx>0){
  125 + map.put("nbbm_in", yblService.checkNbmmNum(rq, map.get("ssgsdm_like").toString(),
  126 + map.get("fgsdm_like").toString(), map.get("xlbm_like").toString(),
  127 + map.get("nbbm_eq").toString(),lx));
  128 + }
  129 +// try {
  130 +
124 131 if(!(rq=="")){
125 132 //
126 133 // SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd");
... ... @@ -155,6 +162,11 @@ public class YlbController extends BaseController<Ylb, Integer>{
155 162 return yblService.oilListMonth(line, date);
156 163 }
157 164  
  165 + @RequestMapping(value = "/sumYlb",method = RequestMethod.GET)
  166 + public Map<String, Object> sumYlb(@RequestParam Map<String, Object> map){
  167 + Map<String, Object> list=yblService.sumYlb(map);
  168 + return list;
  169 + }
158 170  
159 171 @RequestMapping(value = "/listExport",method = RequestMethod.POST)
160 172 public List<Map<String, Object>> listExport(@RequestParam Map<String, Object> map){
... ...
src/main/java/com/bsth/controller/realcontrol/OilStationSocietyController.java 0 → 100644
  1 +package com.bsth.controller.realcontrol;
  2 +
  3 +import com.bsth.controller.BaseController;
  4 +import com.bsth.entity.realcontrol.OilStationSociety;
  5 +import org.springframework.web.bind.annotation.RequestMapping;
  6 +import org.springframework.web.bind.annotation.RestController;
  7 +
  8 +/**
  9 + * Created by panzhao on 2017/3/16.
  10 + */
  11 +@RestController
  12 +@RequestMapping("/oilStation")
  13 +public class OilStationSocietyController extends BaseController<OilStationSociety, String>{
  14 +}
... ...
src/main/java/com/bsth/controller/realcontrol/ScheduleRealInfoController.java
... ... @@ -279,13 +279,13 @@ public class ScheduleRealInfoController extends BaseController&lt;ScheduleRealInfo,
279 279 return scheduleRealInfoService.queryUserInfoPx(line, date,state,type);
280 280 }
281 281  
282   - @RequestMapping(value = "/exportWaybill")
  282 + @RequestMapping(value = "/exportWaybill",method = RequestMethod.GET)
283 283 public List<ScheduleRealInfo> exportWaybill(@RequestParam String jName, @RequestParam String clZbh,
284 284 @RequestParam String lpName,@RequestParam String date,@RequestParam String line) {
285 285 return scheduleRealInfoService.exportWaybill(jName, clZbh, lpName,date,line);
286 286 }
287 287  
288   - @RequestMapping(value = "/exportWaybillQp")
  288 + @RequestMapping(value = "/exportWaybillQp",method = RequestMethod.GET)
289 289 public List<ScheduleRealInfo> exportWaybillQp(@RequestParam String clZbh
290 290 ,@RequestParam String date,@RequestParam String line) {
291 291 return scheduleRealInfoService.exportWaybillQp( clZbh, date,line);
... ... @@ -308,13 +308,13 @@ public class ScheduleRealInfoController extends BaseController&lt;ScheduleRealInfo,
308 308 return scheduleRealInfoService.findLine(line);
309 309 }
310 310  
311   - @RequestMapping(value="/findKMBC")
  311 + @RequestMapping(value="/findKMBC",method = RequestMethod.GET)
312 312 public Map<String,Object> findKMBC(@RequestParam String jName,@RequestParam String clZbh,@RequestParam String lpName
313 313 ,@RequestParam String date,@RequestParam String line){
314 314 return scheduleRealInfoService.findKMBC(jName, clZbh,lpName,date,line);
315 315 }
316 316  
317   - @RequestMapping(value="/findKMBCQp")
  317 + @RequestMapping(value="/findKMBCQp",method = RequestMethod.GET)
318 318 public Map<String,Object> findKMBCQp(@RequestParam String clZbh
319 319 ,@RequestParam String date,@RequestParam String line){
320 320 return scheduleRealInfoService.findKMBCQp(clZbh,date,line);
... ... @@ -344,13 +344,13 @@ public class ScheduleRealInfoController extends BaseController&lt;ScheduleRealInfo,
344 344 * @param lpName 路牌
345 345 * @return
346 346 */
347   - @RequestMapping(value="/queryListWaybill")
  347 + @RequestMapping(value="/queryListWaybill",method = RequestMethod.GET)
348 348 public List<ScheduleRealInfo> queryListWaybill(@RequestParam String jName,@RequestParam String clZbh,@RequestParam String lpName
349 349 ,@RequestParam String date,@RequestParam String line){
350 350 return scheduleRealInfoService.queryListWaybill(jName, clZbh,lpName,date,line);
351 351 }
352 352  
353   - @RequestMapping(value="/queryListWaybillQp")
  353 + @RequestMapping(value="/queryListWaybillQp",method = RequestMethod.GET)
354 354 public List<ScheduleRealInfo> queryListWaybillQp(@RequestParam String clZbh,
355 355 @RequestParam String date,@RequestParam String line){
356 356 return scheduleRealInfoService.queryListWaybillQp(clZbh,date,line);
... ... @@ -362,6 +362,12 @@ public class ScheduleRealInfoController extends BaseController&lt;ScheduleRealInfo,
362 362 return scheduleRealInfoService.statisticsDaily(line, date, xlName, type);
363 363 }
364 364  
  365 + @RequestMapping(value="/statisticsDailyTj")
  366 + public List<Map<String,Object>> statisticsDailyTj(@RequestParam String line, @RequestParam String date,
  367 + @RequestParam String date2,@RequestParam String xlName, @RequestParam String type){
  368 + return scheduleRealInfoService.statisticsDailyTj(line, date,date2, xlName, type);
  369 + }
  370 +
365 371 @RequestMapping(value="/MapById",method = RequestMethod.GET)
366 372 public Map<String, Object> MapById(@RequestParam("id") Long id){
367 373 return scheduleRealInfoService.MapById(id);
... ... @@ -457,7 +463,7 @@ public class ScheduleRealInfoController extends BaseController&lt;ScheduleRealInfo,
457 463 return scheduleRealInfoService.scheduleDailyExport(map);
458 464 }
459 465  
460   - @RequestMapping(value = "exportWaybillMore", method = RequestMethod.POST)
  466 + @RequestMapping(value = "exportWaybillMore", method = RequestMethod.GET)
461 467 public Map<String, Object> exportWaybillMore(@RequestParam Map<String, Object> map){
462 468 return scheduleRealInfoService.exportWaybillMore(map);
463 469 }
... ...
src/main/java/com/bsth/controller/realcontrol/ServiceDataInterface.java 0 → 100644
  1 +package com.bsth.controller.realcontrol;
  2 +
  3 +import com.bsth.data.schedule.DayOfSchedule;
  4 +import com.bsth.entity.realcontrol.ScheduleRealInfo;
  5 +import org.apache.commons.lang3.StringUtils;
  6 +import org.springframework.beans.factory.annotation.Autowired;
  7 +import org.springframework.web.bind.annotation.RequestMapping;
  8 +import org.springframework.web.bind.annotation.RequestParam;
  9 +import org.springframework.web.bind.annotation.RestController;
  10 +
  11 +import java.util.ArrayList;
  12 +import java.util.List;
  13 +
  14 +/**
  15 + * 对外的营运数据接口,主要输出当日的数据
  16 + * Created by panzhao on 2017/3/15.
  17 + */
  18 +@RestController
  19 +@RequestMapping("/companyService")
  20 +public class ServiceDataInterface {
  21 +
  22 + private final static String SECRE_KEY = "dVPHJkWUt5FhMT7jrM2dLV7QvlHAmZFd42rs1P0usBx8A7HZki";
  23 +
  24 + @Autowired
  25 + DayOfSchedule dayOfSchedule;
  26 +
  27 + @RequestMapping("/getCurrentDayPlan")
  28 + public List<ScheduleRealInfo> getCurrentDayPlan(
  29 + @RequestParam String companyId,
  30 + @RequestParam String workId,
  31 + @RequestParam String secretKey) {
  32 +
  33 + if (StringUtils.isEmpty(secretKey) || !secretKey.equals(SECRE_KEY))
  34 + return null;
  35 +
  36 + List<ScheduleRealInfo> all = new ArrayList<>(dayOfSchedule.findAll()), rs = new ArrayList<>();
  37 + for (ScheduleRealInfo sch : all) {
  38 + if (sch.getGsBm() != null
  39 + && sch.getGsBm().equals(companyId)
  40 + && sch.getjGh().equals(workId)) {
  41 + rs.add(sch);
  42 + }
  43 + }
  44 + return rs;
  45 + }
  46 +
  47 + @RequestMapping("/returnCCInfo")
  48 + public List<ScheduleRealInfo> returnCCInfo(@RequestParam String companyId, @RequestParam String secretKey){
  49 + if (StringUtils.isEmpty(secretKey) || !secretKey.equals(SECRE_KEY))
  50 + return null;
  51 +
  52 +
  53 + List<ScheduleRealInfo> all = new ArrayList<>(dayOfSchedule.findAll()), rs = new ArrayList<>();
  54 + for (ScheduleRealInfo sch : all) {
  55 +
  56 + if (sch.getBcType().equals("out")
  57 + && sch.getGsBm() != null
  58 + && sch.getGsBm().equals(companyId)) {
  59 + rs.add(sch);
  60 + }
  61 + }
  62 + return rs;
  63 + }
  64 +
  65 + @RequestMapping("/returnJCInfo")
  66 + public List<ScheduleRealInfo> returnJCInfo(@RequestParam String companyId, @RequestParam String secretKey){
  67 + if (StringUtils.isEmpty(secretKey) || !secretKey.equals(SECRE_KEY))
  68 + return null;
  69 +
  70 +
  71 + List<ScheduleRealInfo> all = new ArrayList<>(dayOfSchedule.findAll()), rs = new ArrayList<>();
  72 + for (ScheduleRealInfo sch : all) {
  73 + if (sch.getBcType().equals("in")
  74 + && sch.getGsBm() != null
  75 + && sch.getGsBm().equals(companyId)) {
  76 + rs.add(sch);
  77 + }
  78 + }
  79 + return rs;
  80 + }
  81 +}
... ...
src/main/java/com/bsth/controller/realcontrol/dto/LpData.java
... ... @@ -22,7 +22,7 @@ public class LpData {
22 22 this.zdzName = sch.getZdzName();
23 23 }
24 24  
25   - public void appendTo(ScheduleRealInfo sch, int type, boolean changeRealTime) {
  25 + public void appendTo(ScheduleRealInfo sch, int type) {
26 26  
27 27 if (type == 0) {
28 28 //只换人
... ... @@ -33,11 +33,11 @@ public class LpData {
33 33 } else if (type == 1) {
34 34 //只换车
35 35 sch.setClZbh(this.nbbm);
36   -
37   - //换实际时间
  36 + changeRealTime(sch);
  37 + /*//换实际时间
38 38 if(changeRealTime){
39 39 changeRealTime(sch);
40   - }
  40 + }*/
41 41  
42 42 } else if (type == 2) {
43 43 //换人并换车
... ... @@ -48,9 +48,9 @@ public class LpData {
48 48 sch.setClZbh(this.nbbm);
49 49  
50 50 //换实际时间
51   - if(changeRealTime){
  51 + //if(changeRealTime){
52 52 changeRealTime(sch);
53   - }
  53 + //}
54 54 }
55 55 }
56 56  
... ...
src/main/java/com/bsth/data/schedule/DayOfSchedule.java
... ... @@ -378,9 +378,11 @@ public class DayOfSchedule implements CommandLineRunner {
378 378 sch.setZdsj(fmtHHmm.print(fmtHHmm.parseMillis(sch.getFcsj()) + (sch.getBcsj() * 60 * 1000)));
379 379 sch.setLate(false);
380 380 }
  381 +
  382 + sch.setJhlcOrig(sch.getJhlc());
381 383 //计划里程为0,设置NULL
382   - if (sch.getJhlc() != null && sch.getJhlc() == 0)
383   - sch.setJhlc(null);
  384 + //if (sch.getJhlc() != null && sch.getJhlc() == 0)
  385 + // sch.setJhlc(null);
384 386 }
385 387 } catch (Exception e) {
386 388 logger.error("", e);
... ...
src/main/java/com/bsth/entity/oil/Ylb.java
... ... @@ -30,7 +30,7 @@ public class Ylb {
30 30 private Double jzlc=0.0;
31 31 private Double czyl=0.0;
32 32 private Double jzyl=0.0;
33   - private Double jzl;
  33 + private Double jzl=0.0;
34 34 private int sfkt;
35 35 private String jhsj;
36 36 private Double yh=0.0;
... ...
src/main/java/com/bsth/entity/realcontrol/OilStationSociety.java 0 → 100644
  1 +package com.bsth.entity.realcontrol;
  2 +
  3 +import javax.persistence.Entity;
  4 +import javax.persistence.Id;
  5 +import javax.persistence.Table;
  6 +
  7 +/**
  8 + * 社会加油站
  9 + * Created by panzhao on 2017/3/16.
  10 + */
  11 +@Entity
  12 +@Table(name = "bsth_c_oil_station")
  13 +public class OilStationSociety {
  14 +
  15 + @Id
  16 + private String lineCode;
  17 +
  18 + /**
  19 + * 加油站名称
  20 + */
  21 + private String stationName;
  22 +
  23 + /**
  24 + * 上行进场距离
  25 + */
  26 + private Double upInMile;
  27 + /**
  28 + * 上行出场距离
  29 + */
  30 + private Double upOutMile;
  31 +
  32 + /**
  33 + * 下行进场距离
  34 + */
  35 + private Double downInMile;
  36 + /**
  37 + * 下行出场距离
  38 + */
  39 + private Double downOutMile;
  40 +
  41 +
  42 + /**
  43 + * 上行进场时间 分钟
  44 + */
  45 + private int upInTime;
  46 + /**
  47 + * 上行出场时间 分钟
  48 + */
  49 + private int upOutTime;
  50 +
  51 + /**
  52 + * 下行进场时间 分钟
  53 + */
  54 + private int downInTime;
  55 + /**
  56 + * 下行出场时间 分钟
  57 + */
  58 + private int downOutTime;
  59 +
  60 +
  61 + public String getLineCode() {
  62 + return lineCode;
  63 + }
  64 +
  65 + public void setLineCode(String lineCode) {
  66 + this.lineCode = lineCode;
  67 + }
  68 +
  69 + public String getStationName() {
  70 + return stationName;
  71 + }
  72 +
  73 + public void setStationName(String stationName) {
  74 + this.stationName = stationName;
  75 + }
  76 +
  77 + public Double getUpInMile() {
  78 + return upInMile;
  79 + }
  80 +
  81 + public void setUpInMile(Double upInMile) {
  82 + this.upInMile = upInMile;
  83 + }
  84 +
  85 + public Double getUpOutMile() {
  86 + return upOutMile;
  87 + }
  88 +
  89 + public void setUpOutMile(Double upOutMile) {
  90 + this.upOutMile = upOutMile;
  91 + }
  92 +
  93 + public Double getDownInMile() {
  94 + return downInMile;
  95 + }
  96 +
  97 + public void setDownInMile(Double downInMile) {
  98 + this.downInMile = downInMile;
  99 + }
  100 +
  101 + public Double getDownOutMile() {
  102 + return downOutMile;
  103 + }
  104 +
  105 + public void setDownOutMile(Double downOutMile) {
  106 + this.downOutMile = downOutMile;
  107 + }
  108 +
  109 + public int getUpInTime() {
  110 + return upInTime;
  111 + }
  112 +
  113 + public void setUpInTime(int upInTime) {
  114 + this.upInTime = upInTime;
  115 + }
  116 +
  117 + public int getUpOutTime() {
  118 + return upOutTime;
  119 + }
  120 +
  121 + public void setUpOutTime(int upOutTime) {
  122 + this.upOutTime = upOutTime;
  123 + }
  124 +
  125 + public int getDownInTime() {
  126 + return downInTime;
  127 + }
  128 +
  129 + public void setDownInTime(int downInTime) {
  130 + this.downInTime = downInTime;
  131 + }
  132 +
  133 + public int getDownOutTime() {
  134 + return downOutTime;
  135 + }
  136 +
  137 + public void setDownOutTime(int downOutTime) {
  138 + this.downOutTime = downOutTime;
  139 + }
  140 +}
... ...
src/main/java/com/bsth/entity/realcontrol/ScheduleRealInfo.java
... ... @@ -88,7 +88,10 @@ public class ScheduleRealInfo {
88 88 /** 计划里程 */
89 89 private Double jhlc;
90 90  
91   - /** 实际里程 */
  91 + /** 原始计划里程 (原计调的数据) */
  92 + private Double jhlcOrig;
  93 +
  94 + /** 实际里程 这个字段被废弃*/
92 95 private Double realMileage;
93 96  
94 97 /** 实际里程 */
... ... @@ -623,6 +626,11 @@ public class ScheduleRealInfo {
623 626 }
624 627 }
625 628  
  629 + @Override
  630 + public int hashCode() {
  631 + return ("schedule_" + this.id).hashCode();
  632 + }
  633 +
626 634 public String getQdzArrDateJH() {
627 635 return qdzArrDatejh;
628 636 }
... ... @@ -757,6 +765,7 @@ public class ScheduleRealInfo {
757 765 }
758 766  
759 767 public void destroy(){
  768 + this.jhlc = 0.0;
760 769 this.status = -1;
761 770 }
762 771  
... ... @@ -845,4 +854,22 @@ public class ScheduleRealInfo {
845 854 public void setRealMileage(Double realMileage) {
846 855 this.realMileage = realMileage;
847 856 }
  857 +
  858 + public Double getJhlcOrig() {
  859 + return jhlcOrig;
  860 + }
  861 +
  862 + public void setJhlcOrig(Double jhlcOrig) {
  863 + this.jhlcOrig = jhlcOrig;
  864 + }
  865 +
  866 + public void reCalcLate() {
  867 + if(this.getStatus() == 0
  868 + && this.getFcsjActual() == null
  869 + && this.dfsjT < System.currentTimeMillis()){
  870 + this.setLate(true);
  871 + }
  872 + else
  873 + this.setLate(false);
  874 + }
848 875 }
... ...
src/main/java/com/bsth/entity/search/PredicatesBuilder.java
... ... @@ -69,6 +69,11 @@ public class PredicatesBuilder {
69 69 return cb.in(expression).value(list);
70 70 }
71 71  
  72 +
  73 + public static Predicate ins(CriteriaBuilder cb,Path<?> expression, List<String> list){
  74 + return cb.in(expression).value(list);
  75 + }
  76 +
72 77 public static Predicate gt(CriteriaBuilder cb,Path<Number> expression, Object object){
73 78 try {
74 79 return cb.gt(expression, nf.parse(object.toString()));
... ...
src/main/java/com/bsth/entity/search/SearchOperator.java
... ... @@ -27,5 +27,6 @@ public enum SearchOperator {
27 27 isf, //假 isFalse,boolean
28 28 ist, //真 isTrue,boolean
29 29 date, //时间
30   - in //数组
  30 + in, //数组
  31 + ins //传参 List<String>
31 32 }
... ...
src/main/java/com/bsth/filter/BaseFilter.java
... ... @@ -16,7 +16,7 @@ public abstract class BaseFilter implements Filter {
16 16 /**
17 17 * 白名单
18 18 */
19   - private String[] whiteListURLs = { Constants.LOGIN_PAGE,Constants.CAPTCHA,
  19 + private String[] whiteListURLs = { Constants.LOGIN_PAGE,Constants.CAPTCHA, Constants.SERVICE_INTERFACE,
20 20 Constants.ASSETS_URL, Constants.FAVICON_URL, Constants.METRONIC_URL, Constants.LOGIN, Constants.LOGIN_FAILURE, Constants.UPSTREAM_URL, Constants.XD_CHILD_PAGES, Constants.XD_REAL_GPS };
21 21  
22 22 @Override
... ...
src/main/java/com/bsth/repository/oil/YlbRepository.java
... ... @@ -23,8 +23,9 @@ public interface YlbRepository extends BaseRepository&lt;Ylb, Integer&gt;{
23 23 @Modifying
24 24 @Query(value="SELECT a.* FROM bsth_c_ylb a where to_days(?1)-to_days(a.rq)=1"
25 25 + " and jcsx=(select max(b.jcsx) from bsth_c_ylb b where a.nbbm=b.nbbm and "
26   - + " to_days(?1)-to_days(b.rq)=1 )",nativeQuery=true)
27   - List<Ylb> obtainYlbefore(String rq);
  26 + + " to_days(?1)-to_days(b.rq)=1 ) and ssgsdm like %?2% and fgsdm like %?3% and "
  27 + + " xlbm like %?4% and nbbm like %?5% ",nativeQuery=true)
  28 + List<Ylb> obtainYlbefore(String rq,String gsbm,String fgsbm,String xlbm,String nbbm);
28 29  
29 30 /**
30 31 * 当天YLB信息
... ... @@ -50,6 +51,41 @@ public interface YlbRepository extends BaseRepository&lt;Ylb, Integer&gt;{
50 51 */
51 52 @Transactional
52 53 @Modifying
53   - @Query(value="select sum(jzl) as jzl,sum(zlc) as zlc ,sum(sh) as sh from bsth_c_ylb where nbbm=?1 and rq=?2",nativeQuery=true)
54   - List<Object[]> sumLcYl(String nbbm,Date rq);
  54 + @Query(value="select ifnull(jzl,0),ifnull(zlc,0),ifnull(sh,0) from bsth_c_ylb where nbbm=?1 and rq=?2 and xlbm like %?3%",nativeQuery=true)
  55 + List<Object[]> sumLcYl(String nbbm,Date rq,String xlbm);
  56 +
  57 + /**
  58 + *
  59 + * @param nbbm
  60 + * @param rq
  61 + * @param xlbm
  62 + * @return
  63 + */
  64 + @Transactional
  65 + @Modifying
  66 + @Query(value="select nbbm,count(nbbm) from bsth_c_ylb where to_days(?1)=to_days(rq) and "
  67 + + " ssgsdm like %?2% "
  68 + + " and fgsdm like %?3%"
  69 + + " and xlbm like %?4% and nbbm like %?5% "
  70 + + " group by nbbm,rq,ssgsdm,fgsdm,xlbm",nativeQuery=true)
  71 + List<Object[]> checkNbmmNum(String rq, String gsbm,String fgsbm,String xlbm,String nbbm);
  72 +
  73 +
  74 + @Query(value="select jzl,yh,sh from Ylb s "
  75 + + " where to_days(?1)=to_days(s.rq) "
  76 + + " and s.ssgsdm like %?2% "
  77 + + " and s.fgsdm like %?3%"
  78 + + " and s.xlbm like %?4% "
  79 + + " and s.nbbm in ?5 ")
  80 + List<Object[]> sumYlb(String rq, String gsbm,String fgsbm,String xlbm,List<String> listNbbm);
  81 +
  82 + @Transactional
  83 + @Modifying
  84 + @Query(value="select ifnull(jzl,0),ifnull(yh,0),ifnull(sh,0) from bsth_c_ylb "
  85 + + " where to_days(?1)=to_days(rq) "
  86 + + " and ssgsdm like %?2% "
  87 + + " and fgsdm like %?3%"
  88 + + " and xlbm like %?4% "
  89 + + " and nbbm like %?5%",nativeQuery=true)
  90 + List<Object[]> sumYlb2(String rq, String gsbm,String fgsbm,String xlbm,String nbbm);
55 91 }
... ...
src/main/java/com/bsth/repository/oil/YlxxbRepository.java
... ... @@ -19,8 +19,8 @@ public interface YlxxbRepository extends BaseRepository&lt;Ylxxb, Integer&gt;{
19 19 */
20 20 @Transactional
21 21 @Modifying
22   - @Query(value="SELECT * FROM bsth_c_ylxxb where to_days(?1)=to_days(yyrq) and nylx=?2",nativeQuery=true)
23   - List<Ylxxb> obtainYlxx(String rq,int nylx);
  22 + @Query(value="SELECT * FROM bsth_c_ylxxb where to_days(?1)=to_days(yyrq) and nylx=?2 and gsdm like %?3%",nativeQuery=true)
  23 + List<Ylxxb> obtainYlxx(String rq,int nylx,String gsdm);
24 24  
25 25 @Transactional
26 26 @Modifying
... ...
src/main/java/com/bsth/repository/realcontrol/ChildTaskPlanRepository.java
1 1 package com.bsth.repository.realcontrol;
2 2  
3   -import java.util.List;
4   -
  3 +import com.bsth.entity.realcontrol.ChildTaskPlan;
  4 +import com.bsth.repository.BaseRepository;
5 5 import org.springframework.data.jpa.domain.Specification;
6 6 import org.springframework.data.jpa.repository.EntityGraph;
7 7 import org.springframework.stereotype.Repository;
8 8  
9   -import com.bsth.entity.realcontrol.ChildTaskPlan;
10   -import com.bsth.repository.BaseRepository;
  9 +import java.util.List;
11 10  
12 11 @Repository
13 12 public interface ChildTaskPlanRepository extends BaseRepository<ChildTaskPlan, Long>{
... ... @@ -15,4 +14,8 @@ public interface ChildTaskPlanRepository extends BaseRepository&lt;ChildTaskPlan, L
15 14 @EntityGraph(value = "childTaskPlan_schedule", type = EntityGraph.EntityGraphType.FETCH)
16 15 @Override
17 16 List<ChildTaskPlan> findAll(Specification<ChildTaskPlan> spec);
  17 +
  18 + @EntityGraph(value = "childTaskPlan_schedule", type = EntityGraph.EntityGraphType.FETCH)
  19 + @Override
  20 + ChildTaskPlan findOne(Long id);
18 21 }
... ...
src/main/java/com/bsth/repository/realcontrol/OilStationSocietyRepository.java 0 → 100644
  1 +package com.bsth.repository.realcontrol;
  2 +
  3 +import com.bsth.entity.realcontrol.OilStationSociety;
  4 +import com.bsth.repository.BaseRepository;
  5 +import org.springframework.stereotype.Repository;
  6 +
  7 +/**
  8 + * Created by panzhao on 2017/3/16.
  9 + */
  10 +@Repository
  11 +public interface OilStationSocietyRepository extends BaseRepository<OilStationSociety, String>{
  12 +}
... ...
src/main/java/com/bsth/repository/realcontrol/ScheduleRealInfoRepository.java
... ... @@ -65,11 +65,11 @@ public interface ScheduleRealInfoRepository extends BaseRepository&lt;ScheduleRealI
65 65 int countByDate(String date);
66 66  
67 67 @EntityGraph(value = "scheduleRealInfo_cTasks", type = EntityGraph.EntityGraphType.FETCH)
68   - @Query(value = "select s from ScheduleRealInfo s where s.scheduleDateStr = ?1")
  68 + @Query(value = "select DISTINCT s from ScheduleRealInfo s where s.scheduleDateStr = ?1")
69 69 List<ScheduleRealInfo> findByDate(String dateStr);
70 70  
71 71 @EntityGraph(value = "scheduleRealInfo_cTasks", type = EntityGraph.EntityGraphType.FETCH)
72   - @Query(value="select s from ScheduleRealInfo s where s.xlBm = ?1 and DATE_FORMAT(s.scheduleDate,'%Y-%m-%d') = ?2 and cl_zbh=?3 order by bcs")
  72 + @Query(value="select DISTINCT s from ScheduleRealInfo s where s.xlBm = ?1 and DATE_FORMAT(s.scheduleDate,'%Y-%m-%d') = ?2 and cl_zbh=?3 order by bcs")
73 73 List<ScheduleRealInfo> findByDate2(String line,String date,String clzbh);
74 74  
75 75 @Query(value="select count(jName) from ScheduleRealInfo s where s.jName = ?1 and s.clZbh = ?2 and s.lpName = ?3 and s.status = -1")
... ... @@ -86,26 +86,31 @@ public interface ScheduleRealInfoRepository extends BaseRepository&lt;ScheduleRealI
86 86 + " and clZbh like %?5% order by s.fcsj")
87 87 List<ScheduleRealInfo> correctForm(String line,String startDate,String endDate,String lpName,String code);
88 88  
89   - @Query(value="select s from ScheduleRealInfo s where s.jName = ?1 and s.clZbh = ?2 and s.lpName = ?3 and s.scheduleDate = str_to_date(?4,'%Y-%m-%d') and s.xlBm=?5 order by realExecDate,fcsj")
  89 + @EntityGraph(value = "scheduleRealInfo_cTasks", type = EntityGraph.EntityGraphType.FETCH)
  90 + @Query(value="select DISTINCT s from ScheduleRealInfo s where s.jName = ?1 and s.clZbh = ?2 and s.lpName = ?3 and s.scheduleDate = str_to_date(?4,'%Y-%m-%d') and s.xlBm=?5 order by realExecDate,fcsj")
90 91 List<ScheduleRealInfo> queryListWaybill(String jName,String clZbh,String lpName,String date,String line);
91 92  
92   - @Query(value="select s from ScheduleRealInfo s where s.clZbh = ?1 and s.scheduleDate = str_to_date(?2,'%Y-%m-%d') and xlBm =?3 order by realExecDate,fcsj")
  93 + @EntityGraph(value = "scheduleRealInfo_cTasks", type = EntityGraph.EntityGraphType.FETCH)
  94 + @Query(value="select DISTINCT s from ScheduleRealInfo s where s.clZbh = ?1 and s.scheduleDate = str_to_date(?2,'%Y-%m-%d') and xlBm =?3 order by realExecDate,fcsj")
93 95 List<ScheduleRealInfo> queryListWaybill2(String clZbh,String date,String line);
94 96  
95   - @Query(value="select s from ScheduleRealInfo s where s.jGh = ?1 and s.clZbh = ?2 and s.scheduleDate = str_to_date(?3,'%Y-%m-%d') order by realExecDate,fcsj")
96   - List<ScheduleRealInfo> queryListWaybill3(String jName,String clZbh,String date);
  97 + @EntityGraph(value = "scheduleRealInfo_cTasks", type = EntityGraph.EntityGraphType.FETCH)
  98 + @Query(value="select DISTINCT s from ScheduleRealInfo s where s.jGh like %?1% and s.clZbh like %?2% and s.scheduleDate = str_to_date(?3,'%Y-%m-%d') and s.gsBm like %?4% and s.fgsBm like %?5% order by realExecDate,fcsj")
  99 + List<ScheduleRealInfo> queryListWaybill3(String jName,String clZbh,String date,String gsbm,String fgsbm);
97 100  
98   - @Query(value="select s from ScheduleRealInfo s where s.jName = ?1 and s.clZbh = ?2 and DATE_FORMAT(s.scheduleDate,'%Y-%m-%d') between str_to_date(?3,'%Y-%m-%d') and str_to_date(?4,'%Y-%m-%d') order by bcs")
  101 + @EntityGraph(value = "scheduleRealInfo_cTasks", type = EntityGraph.EntityGraphType.FETCH)
  102 + @Query(value="select DISTINCT s from ScheduleRealInfo s where s.jName = ?1 and s.clZbh = ?2 and DATE_FORMAT(s.scheduleDate,'%Y-%m-%d') between str_to_date(?3,'%Y-%m-%d') and str_to_date(?4,'%Y-%m-%d') order by bcs")
99 103 List<ScheduleRealInfo> queryListWaybill4(String jName,String clZbh,String date,String enddate);
100 104  
101   - @Query(value="select s from ScheduleRealInfo s where s.xlBm = ?1 and DATE_FORMAT(s.scheduleDate,'%Y-%m-%d') = ?2")
  105 + @EntityGraph(value = "scheduleRealInfo_cTasks", type = EntityGraph.EntityGraphType.FETCH)
  106 + @Query(value="select DISTINCT s from ScheduleRealInfo s where s.xlBm = ?1 and DATE_FORMAT(s.scheduleDate,'%Y-%m-%d') = ?2")
102 107 List<ScheduleRealInfo> scheduleDaily(String line,String date);
103 108  
104 109 @Query(value = "select count(*) from ScheduleRealInfo s where s.xlBm=?1 and s.scheduleDateStr=?2")
105 110 int countByLineCodeAndDate(String xlBm, String schDate);
106 111  
107 112 @EntityGraph(value = "scheduleRealInfo_cTasks", type = EntityGraph.EntityGraphType.FETCH)
108   - @Query(value = "select s from ScheduleRealInfo s where s.xlBm=?1 and s.scheduleDateStr=?2")
  113 + @Query(value = "select DISTINCT s from ScheduleRealInfo s where s.xlBm=?1 and s.scheduleDateStr=?2")
109 114 List<ScheduleRealInfo> findByLineCodeAndDate(String xlBm, String schDate);
110 115  
111 116 @Modifying
... ... @@ -127,8 +132,12 @@ public interface ScheduleRealInfoRepository extends BaseRepository&lt;ScheduleRealI
127 132 @Query(value="select s from ScheduleRealInfo s where s.xlBm like %?1% and DATE_FORMAT(s.scheduleDate,'%Y-%m') = ?2 and s.bcType not in ('in','out') order by s.xlBm")
128 133 List<ScheduleRealInfo> scheduleByDateAndLine3(String line,String date);
129 134  
130   - @Query(value="select new map(s.scheduleDate as scheduleDate,s.xlBm as xlBm,s.clZbh as clZbh,s.jGh as jGh) from ScheduleRealInfo s where s.xlBm like %?1% and DATE_FORMAT(s.scheduleDate,'%Y-%m-%d') = ?2 GROUP BY xlBm,clZbh,jGh,scheduleDate,jGh ORDER BY xlBm,clZbh")
131   - List<Map<String,Object>> yesterdayDataList(String line,String date);
  135 + //按照时间段统计
  136 + @Query(value="select s from ScheduleRealInfo s where s.xlBm like %?1% and DATE_FORMAT(s.scheduleDate,'%Y-%m-%d') between ?2 and ?3 and s.bcType not in ('in','out') order by s.xlBm")
  137 + List<ScheduleRealInfo> scheduleByDateAndLineTj(String line,String date,String date2);
  138 +
  139 + @Query(value="select new map(s.scheduleDate as scheduleDate,s.xlBm as xlBm,s.clZbh as clZbh,s.jGh as jGh) from ScheduleRealInfo s where s.xlBm like %?1% and DATE_FORMAT(s.scheduleDate,'%Y-%m-%d') = ?2 and s.gsBm like %?3% and s.fgsBm like %?4% GROUP BY xlBm,clZbh,jGh,scheduleDate,jGh ORDER BY xlBm,clZbh")
  140 + List<Map<String,Object>> yesterdayDataList(String line,String date,String gsbm,String fgsbm);
132 141  
133 142 @Query(value="select s from ScheduleRealInfo s where DATE_FORMAT(s.scheduleDate,'%Y-%m-%d') = ?1 ORDER BY xlBm,lpName,clZbh,xlDir")
134 143 List<ScheduleRealInfo> setLD(String date);
... ...
src/main/java/com/bsth/security/WebSecurityConfig.java
... ... @@ -36,7 +36,7 @@ public class WebSecurityConfig extends WebSecurityConfigurerAdapter {
36 36 public void configure(WebSecurity web) throws Exception {
37 37 // 白名单
38 38 web.ignoring().antMatchers(Constants.LOGIN_PAGE, Constants.LOGIN, Constants.ASSETS_URL, Constants.FAVICON_URL, Constants.CAPTCHA,
39   - Constants.METRONIC_URL, Constants.LOGIN_FAILURE, Constants.UPSTREAM_URL, Constants.XD_CHILD_PAGES, Constants.XD_REAL_GPS);
  39 + Constants.SERVICE_INTERFACE, Constants.METRONIC_URL, Constants.LOGIN_FAILURE, Constants.UPSTREAM_URL, Constants.XD_CHILD_PAGES, Constants.XD_REAL_GPS);
40 40 }
41 41  
42 42 @Override
... ...
src/main/java/com/bsth/service/forms/impl/CommonServiceImpl.java
... ... @@ -101,7 +101,7 @@ public class CommonServiceImpl implements CommonService{
101 101 + " order by bcs";
102 102  
103 103  
104   - List<ScheduleRealInfo> list = scheduleRealInfoRepository.queryListWaybill3(jName, clZbh , date);
  104 + List<ScheduleRealInfo> list = scheduleRealInfoRepository.queryListWaybill3(jName, clZbh , date,"","");
105 105  
106 106 DecimalFormat format = new DecimalFormat("0.00");
107 107 // int cjbc = scheduleRealInfoRepository.findCjbc(jName, clZbh, lpName);
... ...
src/main/java/com/bsth/service/impl/TrafficManageServiceImpl.java
... ... @@ -15,6 +15,7 @@ import com.bsth.service.TrafficManageService;
15 15 import com.bsth.util.TimeUtils;
16 16 import com.bsth.util.db.DBUtils_MS;
17 17 import com.bsth.webService.trafficManage.geotool.services.InternalPortType;
  18 +import com.bsth.webService.trafficManage.geotool.services.Internal;
18 19 import com.bsth.webService.trafficManage.org.tempuri.WebServiceLocator;
19 20 import com.bsth.webService.trafficManage.org.tempuri.WebServiceSoap;
20 21 import org.apache.commons.lang.time.DateUtils;
... ... @@ -25,10 +26,7 @@ import org.springframework.data.domain.Sort;
25 26 import org.springframework.data.domain.Sort.Direction;
26 27 import org.springframework.stereotype.Service;
27 28  
28   -import java.io.BufferedOutputStream;
29   -import java.io.File;
30   -import java.io.FileOutputStream;
31   -import java.io.IOException;
  29 +import java.io.*;
32 30 import java.sql.Connection;
33 31 import java.sql.PreparedStatement;
34 32 import java.sql.ResultSet;
... ... @@ -188,6 +186,7 @@ public class TrafficManageServiceImpl implements TrafficManageService{
188 186 sBuffer.append("</XLs>");
189 187 System.out.println(sBuffer.toString());
190 188 if(sBuffer.indexOf("<XL>") != -1){
  189 + portType = new Internal().getInternalHttpSoap11Endpoint();
191 190 String portResult = portType.setXL(userNameXl, passwordXl, sBuffer.toString());
192 191 String portArray[] = portResult.split("\n");
193 192 if(portArray.length >= 4){
... ... @@ -386,6 +385,24 @@ public class TrafficManageServiceImpl implements TrafficManageService{
386 385 }
387 386  
388 387 /**
  388 + * 从文件中读取xml
  389 + * @param fileName 例:D:/test.txt
  390 + * @return
  391 + * @throws Exception
  392 + */
  393 + private String readXmlFromFile(String fileName) throws Exception {
  394 + StringBuffer sf = new StringBuffer("");
  395 + File file = new File(fileName);
  396 + InputStreamReader reader = new InputStreamReader(new FileInputStream(file),"utf-8");
  397 + BufferedReader bufferedReader = new BufferedReader(reader);
  398 + String lineTxt = "";
  399 + while((lineTxt = bufferedReader.readLine()) != null){
  400 + sf.append(lineTxt);
  401 + }
  402 + reader.close();
  403 + return sf.toString().replaceAll("\t","");
  404 + }
  405 + /**
389 406 * 上传里程油耗
390 407 * @return 上传成功标识
391 408 */
... ... @@ -890,7 +907,7 @@ public class TrafficManageServiceImpl implements TrafficManageService{
890 907 int nTotalMemory = ( int ) (currRuntime.totalMemory() / 1024 / 1024);
891 908  
892 909 System.out.println("zzz:"+nFreeMemory + "M/" + nTotalMemory +"M(free/total)");
893   -
  910 + portType = new Internal().getInternalHttpSoap11Endpoint();
894 911 byte[] res = portType.downloadAllDataFile("down_pdgj", "down_pdgj123");
895 912 String filePath = "E:\\ygc";
896 913 BufferedOutputStream bos = null;
... ...
src/main/java/com/bsth/service/oil/YlbService.java
... ... @@ -15,5 +15,9 @@ public interface YlbService extends BaseService&lt;Ylb, Integer&gt;{
15 15  
16 16 Map<String, Object> checkYl(Map<String, Object> map);
17 17  
  18 + Map<String, Object> sumYlb(Map<String, Object> map);
  19 +
18 20 List<Ylb> oilListMonth(String line,String date);
  21 +
  22 + StringBuffer checkNbmmNum(String rq, String gsbm,String fgsbm,String xlbm,String nbbm,int lx);
19 23 }
... ...
src/main/java/com/bsth/service/oil/impl/DlbServiceImpl.java
... ... @@ -77,6 +77,10 @@ public class DlbServiceImpl extends BaseServiceImpl&lt;Dlb,Integer&gt; implements DlbS
77 77 Cars c=carsList.get(i);
78 78 carsMap.put(c.getInsideCode(), c.getSfdc());
79 79 }
  80 + String gsbm="";
  81 + if(map2.get("ssgsdm_like")!=null){
  82 + gsbm=map2.get("ssgsdm_like").toString();
  83 + }
80 84 String rq=map2.get("rq").toString();
81 85 String line="";
82 86 if(map2.get("xlbm_eq")!=null){
... ... @@ -91,14 +95,14 @@ public class DlbServiceImpl extends BaseServiceImpl&lt;Dlb,Integer&gt; implements DlbS
91 95 //当天DLB信息
92 96 List<Dlb> dlList=repository.obtainDl(rq);
93 97 //当天YLXXB信息
94   - List<Ylxxb> ylxxList=ylxxbRepository.obtainYlxx(rq,1);
  98 + List<Ylxxb> ylxxList=ylxxbRepository.obtainYlxx(rq,1,gsbm);
95 99 //当天加电信息表
96 100 List<Jdl> jdlList=jdlRepository.JdlList(rq);
97 101 //前一天所有车辆最后进场班次信息
98 102 List<Dlb> dlListBe=repository.obtainYlbefore(rq);
99 103 List<Cdl> cdyList=cdlRepository.obtainCdl();
100 104 //从排班表中计算出行驶的总里程
101   - List<Map<String,Object>> listpb=scheduleRealInfoService.yesterdayDataList(line,rq);
  105 + List<Map<String,Object>> listpb=scheduleRealInfoService.yesterdayDataList(line,rq,"","","","");
102 106 List<Ylb> addList=new ArrayList<Ylb>();
103 107 List<Ylb> updateList=new ArrayList<Ylb>();
104 108 for(int x=0;x<listpb.size();x++){
... ... @@ -244,14 +248,17 @@ public class DlbServiceImpl extends BaseServiceImpl&lt;Dlb,Integer&gt; implements DlbS
244 248 public Map<String, Object> checkDl(Map<String, Object> map) {
245 249 Map<String, Object> newMap=new HashMap<String,Object>();
246 250 String xlbm=map.get("xlbm_eq").toString();
247   -
  251 + String gsbm="";
  252 + if(map.get("ssgsdm_like")!=null){
  253 + gsbm=map.get("ssgsdm_like").toString();
  254 + }
248 255 // TODO Auto-generated method stub
249 256 try{
250 257 //获取车辆存油信息
251 258 // List<Cyl> cylList=cylRepository.findAll(new CustomerSpecs<Cyl>(newMap));
252 259 String rq=map.get("rq").toString();
253 260 List<Dlb> dlbList=repository.obtainDl(rq);
254   - List<Ylxxb> ylxxbList=ylxxbRepository.obtainYlxx(rq,1);
  261 + List<Ylxxb> ylxxbList=ylxxbRepository.obtainYlxx(rq,1,gsbm);
255 262 //当天加电信息表
256 263 List<Jdl> jdlList=jdlRepository.JdlList(rq);
257 264 for (int i = 0; i < ylxxbList.size(); i++) {
... ...
src/main/java/com/bsth/service/oil/impl/YlbServiceImpl.java
... ... @@ -38,6 +38,7 @@ import com.bsth.repository.oil.YlxxbRepository;
38 38 import com.bsth.service.impl.BaseServiceImpl;
39 39 import com.bsth.service.oil.YlbService;
40 40 import com.bsth.service.realcontrol.ScheduleRealInfoService;
  41 +import com.bsth.util.Arith;
41 42 import com.bsth.util.BatchSaveUtils;
42 43 import com.github.abel533.echarts.code.Y;
43 44  
... ... @@ -97,10 +98,10 @@ public class YlbServiceImpl extends BaseServiceImpl&lt;Ylb,Integer&gt; implements YlbS
97 98 //当天YLXXB信息
98 99 // List<Ylxxb> ylxxList=ylxxbRepository.obtainYlxx(rq);
99 100 //前一天所有车辆最后进场班次信息
100   - List<Ylb> ylListBe=repository.obtainYlbefore(rq);
  101 + List<Ylb> ylListBe=repository.obtainYlbefore(rq,"","","","");
101 102 List<Cyl> clyList=cylRepository.obtainCyl("","");
102 103 //从排班表中计算出行驶的总里程
103   - List<Map<String,Object>> listpb=scheduleRealInfoService.yesterdayDataList("",rq);
  104 + List<Map<String,Object>> listpb=scheduleRealInfoService.yesterdayDataList("", rq, "", "", "", "");
104 105  
105 106 for(int x=0;x<listpb.size();x++){
106 107 boolean sfdc=true;
... ... @@ -222,14 +223,15 @@ public class YlbServiceImpl extends BaseServiceImpl&lt;Ylb,Integer&gt; implements YlbS
222 223 // 当天YLB信息
223 224 List<Ylb> ylList = repository.obtainYl(rq,gsbm,fgsbm,line,nbbm,"nbbm");
224 225 // 当天YLXXB信息
225   - List<Ylxxb> ylxxList = ylxxbRepository.obtainYlxx(rq, 0);
  226 + List<Ylxxb> ylxxList = ylxxbRepository.obtainYlxx(rq, 0,gsbm);
226 227 // 前一天所有车辆最后进场班次信息
227   - List<Ylb> ylListBe = repository.obtainYlbefore(rq);
  228 + List<Ylb> ylListBe = repository.obtainYlbefore(rq, gsbm, fgsbm, line, nbbm);
228 229 List<Cyl> clyList = cylRepository.obtainCyl(nbbm,gsbm);
229 230 // 从排班表中计算出行驶的总里程
230   - List<Map<String, Object>> listpb = scheduleRealInfoService.yesterdayDataList(line, rq);
  231 + List<Map<String, Object>> listpb = scheduleRealInfoService.yesterdayDataList(line, rq, gsbm, fgsbm, "", nbbm);
231 232 List<Ylb> addList = new ArrayList<Ylb>();
232 233 List<Ylb> updateList = new ArrayList<Ylb>();
  234 + String ins="";
233 235 for (int x = 0; x < listpb.size(); x++) {
234 236 String type = "add";
235 237 boolean sfdc = true;
... ... @@ -282,9 +284,7 @@ public class YlbServiceImpl extends BaseServiceImpl&lt;Ylb,Integer&gt; implements YlbS
282 284 break;
283 285 }
284 286 }
285   -
286 287 }
287   -
288 288 }
289 289 }
290 290 }
... ... @@ -299,9 +299,16 @@ public class YlbServiceImpl extends BaseServiceImpl&lt;Ylb,Integer&gt; implements YlbS
299 299 Ylxxb ylxxb = ylxxList.get(j);
300 300 if (map.get("clZbh").toString().equals(ylxxb.getNbbm())
301 301 && map.get("jGh").toString().equals(ylxxb.getJsy())) {
302   - jzl += ylxxb.getJzl();
  302 +// jzl += ylxxb.getJzl();
  303 + jzl =Arith.add(jzl, ylxxb.getJzl());
303 304 }
304 305 }
  306 + if(map.get("clZbh").toString().equals("W0A-212")){
  307 + System.out.println();
  308 + }
  309 + if(map.get("clZbh").toString().equals("W0A-211")){
  310 + System.out.println();
  311 + }
305 312 t.setJzl(jzl);
306 313 t.setNbbm(map.get("clZbh").toString());
307 314 t.setJsy(map.get("jGh") == null ? "" : map.get("jGh").toString());
... ... @@ -312,29 +319,34 @@ public class YlbServiceImpl extends BaseServiceImpl&lt;Ylb,Integer&gt; implements YlbS
312 319 t.setSsgsdm(map.get("company") == null ? "" : map.get("company").toString());
313 320 t.setFgsdm(map.get("bCompany") == null ? "" : map.get("bCompany").toString());
314 321 t.setRq(sdf.parse(rq));
315   - /*
316   - * if(type.equals("add")){ addList.add(t); }else{
317   - * updateList.add(t); }
318   - */
319   - repository.save(t);
  322 +
  323 + if(type.equals("add")){
  324 + addList.add(t);
  325 + }else{
  326 + updateList.add(t);
  327 + ins += t.getId().toString()+",";
  328 + }
  329 +// repository.save(t);
320 330 newMap.put("status", ResponseCode.SUCCESS);
321 331  
322 332 }
323 333 }
  334 + if(addList.size()>0){
  335 + new BatchSaveUtils<Ylb>().saveList(addList, Ylb.class);
  336 + }
  337 +
  338 + if(updateList.size()>0){
  339 + for (int i = 0; i < updateList.size(); i++) {
  340 + repository.save(updateList.get(i));
  341 + }
  342 + }
  343 + newMap.put("status", ResponseCode.SUCCESS);
324 344 } catch (ParseException e) {
325 345 // TODO Auto-generated catch block
326 346 newMap.put("status", ResponseCode.ERROR);
327 347 throw e;
328 348 }
329   - /*
330   - * try { if(addList.size()>0){ new
331   - * BatchSaveUtils<Ylb>().saveList(addList, Ylb.class); }
332   - *
333   - * if(updateList.size()>0){
334   - *
335   - * } newMap.put("status", ResponseCode.SUCCESS); } catch (Exception e) {
336   - * // TODO: handle exception newMap.put("status", ResponseCode.ERROR); }
337   - */
  349 +
338 350 return newMap;
339 351 }
340 352  
... ... @@ -383,15 +395,19 @@ public class YlbServiceImpl extends BaseServiceImpl&lt;Ylb,Integer&gt; implements YlbS
383 395 String nbbm_eq = ylb.getNbbm();
384 396 Date rq_eq = ylb.getRq();
385 397 // 得到一天总的加油和里程(根据车,时间)
386   - List<Object[]> sumList = repository.sumLcYl(nbbm_eq, rq_eq);
  398 + List<Object[]> sumList = repository.sumLcYl(nbbm_eq, rq_eq,ylb.getXlbm());
387 399 // 保存总的加油量
388   - Double jzl = Double.valueOf(sumList.get(0)[0].toString());
  400 + Double jzl = 0.0;
389 401 // 保存总的里程
390   - Double zlc = Double.valueOf(sumList.get(0)[1].toString());
391   -
392   - Double zsh = Double.valueOf(sumList.get(0)[2].toString());
393   -
394   - jzl=jzl-zsh;
  402 + Double zlc = 0.0;
  403 + //保存总的损耗
  404 + Double zsh = 0.0;
  405 + for (int j = 0; j < sumList.size(); j++) {
  406 + jzl = Arith.add(jzl, Double.valueOf(sumList.get(j)[0].toString()));
  407 + zlc = Arith.add(zlc, Double.valueOf(sumList.get(j)[1].toString()));
  408 + zsh = Arith.add(zsh, Double.valueOf(sumList.get(j)[2].toString()));
  409 + }
  410 + jzl = Arith.sub(jzl, zsh);
395 411 // 保留两位小数
396 412 DecimalFormat df = new DecimalFormat("#.00");
397 413 Double zyl = 0.0;
... ... @@ -413,17 +429,23 @@ public class YlbServiceImpl extends BaseServiceImpl&lt;Ylb,Integer&gt; implements YlbS
413 429 // 进场等于出场的操作 既 最后进场存油量等于第一次的出场存油量
414 430 Double yl = t.getCzyl();
415 431 Double jcyl = t.getCzyl();
416   - zyl = jcyl + jzl - yl;
  432 +// zyl = jcyl + jzl - yl;
  433 + zyl =Arith.sub( Arith.add(jcyl, jzl),yl);
417 434 Double yh = Double.parseDouble(df.format(zyl * (t.getZlc() / zlc)));
418 435 t.setYh(yh);
419   - nextJzyl = t.getJzl() + t.getCzyl() - yh;
420   - t.setJzyl(Double.parseDouble(df.format(nextJzyl)));
  436 +// nextJzyl = t.getJzl() + t.getCzyl() - yh;
  437 + nextJzyl =Arith.sub( Arith.add(t.getJzl(), t.getCzyl()),yh);
  438 +// t.setJzyl(Double.parseDouble(df.format(nextJzyl)));
  439 + t.setJzyl(nextJzyl);
421 440 } else {
422   - t.setCzyl(Double.parseDouble(df.format(nextJzyl)));
  441 +// t.setCzyl(Double.parseDouble(df.format(nextJzyl)));
  442 + t.setCzyl(nextJzyl);
423 443 Double yh = Double.parseDouble(df.format(zyl * (t.getZlc() / zlc)));
424 444 t.setYh(yh);
425   - nextJzyl = t.getJzl() + nextJzyl - yh;
426   - t.setJzyl(Double.parseDouble(df.format(nextJzyl)));
  445 +// nextJzyl = t.getJzl() + nextJzyl - yh;
  446 + nextJzyl =Arith.sub( Arith.add(t.getJzl(),nextJzyl),yh);
  447 +// t.setJzyl(Double.parseDouble(df.format(nextJzyl)));
  448 + t.setJzyl(nextJzyl);
427 449 }
428 450 repository.save(t);
429 451 }
... ... @@ -484,20 +506,29 @@ public class YlbServiceImpl extends BaseServiceImpl&lt;Ylb,Integer&gt; implements YlbS
484 506 String nbbm_eq = ylb.getNbbm();
485 507 Date rq_eq = ylb.getRq();
486 508 // 得到一天总的加油和里程(根据车,时间)
487   - List<Object[]> sumList = repository.sumLcYl(nbbm_eq, rq_eq);
  509 + List<Object[]> sumList = repository.sumLcYl(nbbm_eq, rq_eq,ylb.getXlbm());
488 510 // 保存总的加油量
489   - Double jzl = Double.valueOf(sumList.get(0)[0].toString());
  511 + Double jzl = 0.0;
490 512 // 保存总的里程
491   - Double zlc = Double.valueOf(sumList.get(0)[1].toString());
492   - // 保存总的损耗
493   - Double zsh = Double.valueOf(sumList.get(0)[2].toString());
  513 + Double zlc = 0.0;
  514 + //保存总的损耗
  515 + Double zsh = 0.0;
  516 + for (int j = 0; j < sumList.size(); j++) {
  517 + jzl = Arith.add(jzl, Double.valueOf(sumList.get(j)[0].toString()));
  518 + zlc = Arith.add(zlc, Double.valueOf(sumList.get(j)[1].toString()));
  519 + zsh = Arith.add(zsh, Double.valueOf(sumList.get(j)[2].toString()));
  520 + }
  521 + jzl = Arith.sub(jzl, zsh);
494 522  
495 523 //新的 损耗不等于 旧的损耗 总损耗从新算
496   - if(ylb.getSh() - sh >0.0000001 || ylb.getSh()-sh <0.00000001){
497   - zsh =zsh-ylb.getSh()+sh;
498   - jzl =jzl-zsh;
  524 + if(Arith.sub(ylb.getSh(),sh )!=0){
  525 +// zsh =zsh-ylb.getSh()+sh;
  526 + zsh =Arith.add(Arith.sub(zsh, ylb.getSh()), sh);
  527 +// jzl =jzl-zsh;
  528 + jzl =Arith.sub(jzl, zsh);
499 529 }else{
500   - jzl=jzl-zsh;
  530 +// jzl=jzl-zsh;
  531 + jzl =Arith.sub(jzl, zsh);
501 532 }
502 533 map.put("nbbm_eq", nbbm_eq);
503 534 map.put("rq_eq", rq_eq);
... ... @@ -519,25 +550,31 @@ public class YlbServiceImpl extends BaseServiceImpl&lt;Ylb,Integer&gt; implements YlbS
519 550 t.setShyy(shyy);
520 551 }
521 552 Double jcyl = t.getCzyl();
522   - zyl = jcyl + jzl - yl;
  553 +// zyl = jcyl + jzl - yl;
  554 + zyl = Arith.sub(Arith.add(jcyl, jzl), yl);
523 555 Double yh = 0.0;
524 556 if (zlc > 0 && t.getZlc() > 0) {
525 557 yh = Double.parseDouble(df.format(zyl * (t.getZlc() / zlc)));
526 558 }
527 559 t.setYh(yh);
528   - nextJzyl = t.getJzl() + t.getCzyl() - yh-t.getSh();
529   - t.setJzyl(Double.parseDouble(df.format(nextJzyl)));
  560 +// nextJzyl = t.getJzl() + t.getCzyl() - yh-t.getSh();
  561 + nextJzyl =Arith.sub(Arith.add(t.getJzl(), t.getCzyl()), Arith.add(yh, t.getSh()));
  562 +// t.setJzyl(Double.parseDouble(df.format(nextJzyl)));
  563 + t.setJzyl(nextJzyl);
530 564 } else {
531 565 if(t.getId()==id){
532 566 t.setSh(sh);
533 567 t.setShyy(shyy);
534 568 }
535 569 if (t.getZlc() != 0) {
536   - t.setCzyl(Double.parseDouble(df.format(nextJzyl)));
  570 +// t.setCzyl(Double.parseDouble(df.format(nextJzyl)));
  571 + t.setCzyl(nextJzyl);
537 572 Double yh = Double.parseDouble(df.format(zyl * (t.getZlc() / zlc)));
538 573 t.setYh(yh);
539   - nextJzyl = t.getJzl() + nextJzyl - yh-t.getSh();
540   - t.setJzyl(Double.parseDouble(df.format(nextJzyl)));
  574 +// nextJzyl = t.getJzl() + nextJzyl - yh-t.getSh();
  575 + nextJzyl = Arith.sub(Arith.add(t.getJzl(), nextJzyl), Arith.add(yh, t.getSh()));
  576 +// t.setJzyl(Double.parseDouble(df.format(nextJzyl)));
  577 + t.setJzyl(nextJzyl);
541 578 }
542 579  
543 580 }
... ... @@ -610,7 +647,7 @@ public class YlbServiceImpl extends BaseServiceImpl&lt;Ylb,Integer&gt; implements YlbS
610 647 nbbm=map.get("nbbm_eq").toString();
611 648 }
612 649 List<Ylb> ylbList=repository.obtainYl(rq,gsbm,fgsbm,xlbm,nbbm,"nbbm");
613   - List<Ylxxb> ylxxbList=ylxxbRepository.obtainYlxx(rq,0);
  650 + List<Ylxxb> ylxxbList=ylxxbRepository.obtainYlxx(rq,0,gsbm);
614 651 for (int i = 0; i < ylxxbList.size(); i++) {
615 652 Boolean fage=true;
616 653 Ylxxb y1=ylxxbList.get(i);
... ... @@ -638,7 +675,8 @@ public class YlbServiceImpl extends BaseServiceImpl&lt;Ylb,Integer&gt; implements YlbS
638 675 for(int z=0;z<cylList.size();z++){
639 676 cyl=cylList.get(z);
640 677 if(t.getNbbm().equals(cyl.getNbbm())){
641   - cyl.setCyl(cyl.getCyl()+t.getJzl());
  678 +// cyl.setCyl(cyl.getCyl()+t.getJzl());
  679 + cyl.setCyl(Arith.add(cyl.getCyl(),t.getJzl()));
642 680 cyl.setUpdatetime(t.getRq());
643 681 status=true;
644 682 break;
... ... @@ -702,6 +740,106 @@ public class YlbServiceImpl extends BaseServiceImpl&lt;Ylb,Integer&gt; implements YlbS
702 740 });
703 741 return list;
704 742 }
  743 +
  744 + @Override
  745 + public StringBuffer checkNbmmNum(String rq, String gsbm, String fgsbm, String xlbm,String nbbm,int lx) {
  746 + StringBuffer stringList =new StringBuffer();
  747 + List<Object[]> objectList=repository.checkNbmmNum(rq, gsbm, fgsbm, xlbm,nbbm);
  748 + for (int i = 0; i < objectList.size(); i++) {
  749 + String clbm=objectList.get(i)[0].toString()+",";
  750 + int cs=Integer.parseInt(objectList.get(i)[1].toString());
  751 + //一车一单
  752 + if(lx==1){
  753 + if(cs==1){
  754 + stringList.append(clbm);
  755 + }
  756 + }
  757 + //一车多单
  758 + if(lx==2){
  759 + if(cs>1){
  760 + stringList.append(clbm);
  761 + }
  762 +
  763 + }
  764 + }
  765 + return stringList;
  766 + }
  767 +
  768 +
  769 +
  770 + @Override
  771 + public Map<String, Object> sumYlb(Map<String, Object> map) {
  772 + // TODO Auto-generated method stub
  773 + List<String> stringList=new ArrayList<String>();
  774 + String rq=map.get("rq").toString();
  775 + String gsbm=map.get("ssgsdm_like").toString();
  776 + String fgsbm=map.get("fgsdm_like").toString();
  777 + String xlbm=map.get("xlbm_like").toString().trim();
  778 + String nbbm=map.get("nbbm_eq").toString();
  779 + String sxtj=map.get("sxtj").toString();
  780 + if(nbbm.trim()!=""){
  781 + stringList.add(nbbm);
  782 + }else{
  783 + if(!sxtj.equals("0")){
  784 + List<Object[]> objectLists=repository.checkNbmmNum(rq, gsbm, fgsbm, xlbm,nbbm);
  785 + for (int i = 0; i < objectLists.size(); i++) {
  786 + String clbm=objectLists.get(i)[0].toString();
  787 + int cs=Integer.parseInt(objectLists.get(i)[1].toString());
  788 + //一车一单
  789 +
  790 + if(sxtj.equals("1")){
  791 + if(cs==1){
  792 + stringList.add(clbm);
  793 + }
  794 + }
  795 + //一车多单
  796 + if(sxtj.equals("2")){
  797 + if(cs>1){
  798 + stringList.add(clbm);
  799 + }
  800 + }
  801 + }
  802 + }
  803 + }
  804 + List<Object[]> sumYlbList=new ArrayList<Object[]>();
  805 + if(sxtj.equals("0")){
  806 + sumYlbList=repository.sumYlb2(rq, gsbm, fgsbm, xlbm,nbbm);
  807 + }else{
  808 + if(stringList.size()>0){
  809 +
  810 +// String strings[]=new String[stringList.size()];
  811 +// for(int i=0;i<stringList.size();i++){
  812 +// strings[i]=stringList.get(i);
  813 +// }
  814 + sumYlbList=repository.sumYlb(rq, gsbm, fgsbm, xlbm, stringList);
  815 + }else{
  816 + sumYlbList=repository.sumYlb2(rq, gsbm, fgsbm, xlbm, nbbm);
  817 + }
  818 +
  819 + }
  820 +
  821 + Double jzl=0.0,yh=0.0,sh=0.0;
  822 + for (int i = 0; i < sumYlbList.size(); i++) {
  823 + jzl = Arith.add(jzl, Double.valueOf(sumYlbList.get(i)[0].toString()));
  824 + yh = Arith.add(yh, Double.valueOf(sumYlbList.get(i)[1].toString()));
  825 + sh = Arith.add(sh, Double.valueOf(sumYlbList.get(i)[2].toString()));
  826 + }
  827 +
  828 + Map<String, Object> sumMap=new HashMap<String,Object>();
  829 + sumMap.put("jzl", jzl);
  830 + sumMap.put("yh", yh);
  831 + sumMap.put("sh", sh);
  832 +// String sql="select sum(jzl),sum(yh),sum(sh) from bsth_c_ylb "
  833 +// + " where to_days('"+map.get("rq").toString()+"')=to_days(rq) "
  834 +// + " and ssgsdm like '%"+map.get("ssgsdm_like").toString()+"%' "
  835 +// + " and fgsdm like '%"+map.get("fgsdm_like").toString()+"%' "
  836 +// + " and xlbm like '%"+map.get("xlbm_like").toString()+ "%'"
  837 +// + " and nbbm like '%"+map.get("nbbm_eq").toString()+"% '";
  838 +// if(map.get("nbbm_in")!=null){
  839 +//// sql +=" and nbbm in ("
  840 +// }
  841 + return sumMap;
  842 + }
705 843  
706 844  
707 845 }
... ...
src/main/java/com/bsth/service/realcontrol/OilStationSocietyService.java 0 → 100644
  1 +package com.bsth.service.realcontrol;
  2 +
  3 +import com.bsth.entity.realcontrol.OilStationSociety;
  4 +import com.bsth.service.BaseService;
  5 +
  6 +/**
  7 + * Created by panzhao on 2017/3/16.
  8 + */
  9 +public interface OilStationSocietyService extends BaseService<OilStationSociety, String> {
  10 +}
... ...
src/main/java/com/bsth/service/realcontrol/ScheduleRealInfoService.java
... ... @@ -112,6 +112,8 @@ public interface ScheduleRealInfoService extends BaseService&lt;ScheduleRealInfo, L
112 112  
113 113 List<Map<String,Object>> statisticsDaily(String line, String date, String xlName, String type);
114 114  
  115 + List<Map<String,Object>> statisticsDailyTj(String line, String date,String date2, String xlName, String type);
  116 +
115 117 //List<Object> scheduleDaily(String line,String date);
116 118  
117 119 int countByLineCodeAndDate(String xlBm, String schDate);
... ... @@ -126,7 +128,7 @@ public interface ScheduleRealInfoService extends BaseService&lt;ScheduleRealInfo, L
126 128 List<ScheduleRealInfo> realScheduleList(String line,String date);
127 129 List<ScheduleRealInfo> realScheduleListQp(String line,String date);
128 130  
129   - List<Map<String,Object>> yesterdayDataList(String line,String date);
  131 + List<Map<String,Object>> yesterdayDataList(String line,String date,String gsbm,String fgsbm,String jGh,String nbbm);
130 132  
131 133 List<Map<String,Object>> yesterdayDataList(String line);
132 134  
... ... @@ -156,7 +158,7 @@ public interface ScheduleRealInfoService extends BaseService&lt;ScheduleRealInfo, L
156 158  
157 159 Map<String,Object> lpChangeMulti(String leftIdx, String rightIdx, int type);
158 160  
159   - void lpChange(ScheduleRealInfo leftSch, ScheduleRealInfo rightSch, int type, boolean changeRealTime);
  161 + void lpChange(ScheduleRealInfo leftSch, ScheduleRealInfo rightSch, int type);
160 162  
161 163 Map<String,Object> revokeRealArrive(Long id);
162 164 }
... ...
src/main/java/com/bsth/service/realcontrol/impl/ChildTaskPlanServiceImpl.java
... ... @@ -9,6 +9,7 @@ import com.bsth.repository.realcontrol.ChildTaskPlanRepository;
9 9 import com.bsth.repository.realcontrol.ScheduleRealInfoRepository;
10 10 import com.bsth.service.impl.BaseServiceImpl;
11 11 import com.bsth.service.realcontrol.ChildTaskPlanService;
  12 +import org.apache.commons.lang3.StringUtils;
12 13 import org.springframework.beans.factory.annotation.Autowired;
13 14 import org.springframework.jdbc.core.JdbcTemplate;
14 15 import org.springframework.stereotype.Service;
... ... @@ -45,8 +46,11 @@ public class ChildTaskPlanServiceImpl extends BaseServiceImpl&lt;ChildTaskPlan, Lon
45 46 //保存起终点名称
46 47 String prefix = sch.getXlBm() + "_" + sch.getXlDir() + "_";
47 48  
48   - t.setStartStationName(BasicData.getStationNameByCode(t.getStartStation(), prefix));
49   - t.setEndStationName(BasicData.getStationNameByCode(t.getEndStation(), prefix));
  49 + if(StringUtils.isEmpty(t.getStartStationName()))
  50 + t.setStartStationName(BasicData.getStationNameByCode(t.getStartStation(), prefix));
  51 +
  52 + if(StringUtils.isEmpty(t.getEndStationName()))
  53 + t.setEndStationName(BasicData.getStationNameByCode(t.getEndStation(), prefix));
50 54 //先持久化子任务
51 55 rs = super.save(t);
52 56 //再关联主任务
... ...
src/main/java/com/bsth/service/realcontrol/impl/OilStationSocietyServiceImpl.java 0 → 100644
  1 +package com.bsth.service.realcontrol.impl;
  2 +
  3 +import com.bsth.entity.realcontrol.OilStationSociety;
  4 +import com.bsth.service.impl.BaseServiceImpl;
  5 +import com.bsth.service.realcontrol.OilStationSocietyService;
  6 +import org.springframework.stereotype.Service;
  7 +
  8 +/**
  9 + * Created by panzhao on 2017/3/16.
  10 + */
  11 +@Service
  12 +public class OilStationSocietyServiceImpl extends BaseServiceImpl<OilStationSociety, String> implements OilStationSocietyService {
  13 +}
... ...
src/main/java/com/bsth/service/realcontrol/impl/ScheduleRealInfoServiceImpl.java
... ... @@ -179,6 +179,9 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
179 179 schedule.setBcType(bcType);
180 180 }
181 181  
  182 + //重新计算是否误点
  183 + schedule.reCalcLate();
  184 +
182 185 // 持久化到数据库
183 186 dayOfSchedule.save(schedule);
184 187  
... ... @@ -391,14 +394,15 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
391 394 return rs;
392 395 }
393 396  
394   - dayOfSchedule.delete(sch);
395   - //ScheduleRealInfo sch = dayOfSchedule.delete(id);
396 397 //数据库删除
397 398 rs = super.delete(id);
398   - //更新起点应到时间
399   - List<ScheduleRealInfo> ts = dayOfSchedule.updateQdzTimePlan(sch.getClZbh());
400   - rs.put("ts", ts);
401   - rs.put("delete", sch);
  399 + if(rs.get("status").equals(ResponseCode.SUCCESS)){
  400 + dayOfSchedule.delete(sch);
  401 + //更新起点应到时间
  402 + List<ScheduleRealInfo> ts = dayOfSchedule.updateQdzTimePlan(sch.getClZbh());
  403 + rs.put("ts", ts);
  404 + rs.put("delete", sch);
  405 + }
402 406  
403 407 return rs;
404 408 }
... ... @@ -853,6 +857,8 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
853 857 rs.put("msg", "未烂班,无法撤销!");
854 858 } else {
855 859 sch.setStatus(0);
  860 + sch.setRemarks("");//清空备注
  861 + sch.setJhlc(sch.getJhlcOrig());
856 862 rs.put("status", ResponseCode.SUCCESS);
857 863 rs.put("t", sch);
858 864  
... ... @@ -1057,9 +1063,11 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
1057 1063  
1058 1064 //修改班次里程
1059 1065 String jhlc = map.get("jhlc");
1060   - if (StringUtils.isNotEmpty(jhlc)
1061   - && Double.parseDouble(jhlc) != sch.getJhlc()) {
1062   - sch.setJhlc(Double.parseDouble(jhlc));
  1066 + if (StringUtils.isNotEmpty(jhlc)) {
  1067 + if(Double.parseDouble(jhlc) == 0 && sch.getJhlcOrig() != 0)
  1068 + destroy(sch.getId() + "", "", map.get("adjustExps").toString());
  1069 + else
  1070 + sch.setJhlc(Double.parseDouble(jhlc));
1063 1071 }
1064 1072 }
1065 1073  
... ... @@ -1097,6 +1105,8 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
1097 1105 schedule = dayOfSchedule.get(jsonObj.getLong("id"));
1098 1106 //设置待发时间
1099 1107 schedule.setDfsjAll(dfsj);
  1108 + //重新计算是否误点
  1109 + schedule.reCalcLate();
1100 1110  
1101 1111 dayOfSchedule.save(schedule);
1102 1112 }
... ... @@ -1215,7 +1225,7 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
1215 1225  
1216 1226 @Override
1217 1227 public Map<String, Object> findKMBC2(String jName, String clZbh, String date) {
1218   - List<ScheduleRealInfo> list = scheduleRealInfoRepository.queryListWaybill3(jName, clZbh, date);
  1228 + List<ScheduleRealInfo> list = scheduleRealInfoRepository.queryListWaybill3(jName, clZbh, date,"","");
1219 1229  
1220 1230 DecimalFormat format = new DecimalFormat("0.00");
1221 1231 // int cjbc = scheduleRealInfoRepository.findCjbc(jName, clZbh, lpName);
... ... @@ -1290,7 +1300,7 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
1290 1300 // int ljbc = scheduleRealInfoRepository.findLjbc(jName, clZbh, lpName);
1291 1301 int jhbc = 0, cjbc = 0, ljbc = 0;
1292 1302 double jhlc = 0, yygl = 0, ksgl = 0, tempJhlc = 0, jcclc = 0;
1293   - float addMileage = 0l, remMileage = 0l;
  1303 + float addMileage = 0l, remMileage = 0l,addMileageYy = 0l,addMileageJc =0l;
1294 1304 Map<String, Object> map = new HashMap<String, Object>();
1295 1305 for (ScheduleRealInfo scheduleRealInfo : list) {
1296 1306 if (scheduleRealInfo != null) {
... ... @@ -1301,18 +1311,25 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
1301 1311 tempJhlc = scheduleRealInfo.getJhlc() == null ? 0 : scheduleRealInfo.getJhlc();
1302 1312 if (scheduleRealInfo.isSflj()) {
1303 1313 addMileage += tempJhlc;
1304   - ljbc++;
  1314 + if (scheduleRealInfo.getBcType().equals("in")
  1315 + || scheduleRealInfo.getBcType().equals("out")) {
  1316 + addMileageJc +=tempJhlc;
  1317 + }else{
  1318 + ljbc++;
  1319 + addMileageYy +=tempJhlc;
  1320 + }
  1321 +
1305 1322 } else {
1306 1323 if (!(scheduleRealInfo.getBcType().equals("in")
1307 1324 || scheduleRealInfo.getBcType().equals("out"))) {
1308   - jhbc++;
1309   - jhlc += tempJhlc;
  1325 + jhbc++;
  1326 + jhlc += tempJhlc;
  1327 + if (scheduleRealInfo.getStatus() == -1) {
  1328 + remMileage += tempJhlc;
  1329 + cjbc++;
  1330 + }
1310 1331 }
1311 1332  
1312   - if (scheduleRealInfo.getStatus() == -1) {
1313   - remMileage += tempJhlc;
1314   - cjbc++;
1315   - }
1316 1333 }
1317 1334 Set<ChildTaskPlan> childTaskPlans = scheduleRealInfo.getcTasks();
1318 1335 //计算营运里程,空驶里程
... ... @@ -1358,15 +1375,15 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
1358 1375 map.put("jhlc", format.format(jhlc));
1359 1376 map.put("remMileage", format.format(remMileage));
1360 1377 map.put("addMileage", format.format(addMileage));
1361   - map.put("yygl", format.format(yygl));
  1378 + map.put("yygl", format.format(yygl+addMileageYy));
1362 1379 map.put("ksgl", format.format(ksgl));
1363   - map.put("realMileage", format.format(yygl + ksgl + jcclc));
  1380 + map.put("realMileage", format.format(yygl + ksgl + jcclc+addMileage));
1364 1381 map.put("jhbc", jhbc);
1365 1382 map.put("cjbc", cjbc);
1366 1383 map.put("ljbc", ljbc);
1367 1384 map.put("sjbc", jhbc - cjbc + ljbc);
1368 1385 map.put("jcclc", jcclc);
1369   - map.put("zkslc", format.format(ksgl + jcclc));
  1386 + map.put("zkslc", format.format(ksgl + jcclc+addMileageJc));
1370 1387 return map;
1371 1388 }
1372 1389  
... ... @@ -1436,140 +1453,681 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
1436 1453 List<Iterator<?>> listI = new ArrayList<Iterator<?>>();
1437 1454 Map<String, Object> m = new HashMap<String, Object>();
1438 1455 ReportUtils ee = new ReportUtils();
1439   - m.put("dates", startDate + " 至 " + endDate);
1440   - List<Map<String, Object>> tempList = new ArrayList<Map<String, Object>>();
1441   - SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
1442   - for (ScheduleRealInfo schedule : list) {
1443   - Map<String, Object> tempMap = new HashMap<String, Object>();
1444   - tempMap.put("xlName", schedule.getXlName() != null ? schedule.getXlName() : "");
1445   - tempMap.put("lpName", schedule.getLpName() != null ? schedule.getLpName() : "");
1446   - tempMap.put("clZbh", schedule.getClZbh() != null ? schedule.getClZbh() : "");
1447   - tempMap.put("jName", schedule.getjName() != null ? schedule.getjName() : "");
1448   - tempMap.put("sName", schedule.getsName() != null ? schedule.getsName() : "");
1449   - tempMap.put("fcsj", schedule.getFcsj() != null ? schedule.getFcsj() : "");
1450   - tempMap.put("fcsjActual", schedule.getFcsjActual() != null ? schedule.getFcsjActual() : "");
1451   - tempMap.put("zdsj", schedule.getZdsj() != null ? schedule.getZdsj() : "");
1452   - tempMap.put("zdsjActual", schedule.getZdsjActual() != null ? schedule.getZdsjActual() : "");
1453   - if (schedule.getUpdateBy() != null) {
1454   - if (schedule.getUpdateBy().getName() != null)
1455   - tempMap.put("userName", schedule.getUpdateBy().getName());
1456   - else
1457   - tempMap.put("userName", "");
1458   - } else {
1459   - tempMap.put("userName", "");
1460   - }
1461   - if (schedule.getUpdateDate() != null) {
1462   - tempMap.put("updateDate", sdf.format(schedule.getUpdateDate()));
1463   - } else {
1464   - tempMap.put("updateDate", "");
1465   - }
1466   - tempMap.put("remarks", schedule.getRemarks() != null ? schedule.getRemarks() : "");
1467   - tempList.add(tempMap);
1468   - }
  1456 + m.put("dates", startDate + " 至 " + endDate);
  1457 + List<Map<String, Object>> tempList = new ArrayList<Map<String, Object>>();
  1458 + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
  1459 + for (ScheduleRealInfo schedule : list) {
  1460 + Map<String, Object> tempMap = new HashMap<String, Object>();
  1461 + tempMap.put("xlName", schedule.getXlName() != null ? schedule.getXlName() : "");
  1462 + tempMap.put("lpName", schedule.getLpName() != null ? schedule.getLpName() : "");
  1463 + tempMap.put("clZbh", schedule.getClZbh() != null ? schedule.getClZbh() : "");
  1464 + tempMap.put("jName", schedule.getjName() != null ? schedule.getjName() : "");
  1465 + tempMap.put("sName", schedule.getsName() != null ? schedule.getsName() : "");
  1466 + tempMap.put("fcsj", schedule.getFcsj() != null ? schedule.getFcsj() : "");
  1467 + tempMap.put("fcsjActual", schedule.getFcsjActual() != null ? schedule.getFcsjActual() : "");
  1468 + tempMap.put("zdsj", schedule.getZdsj() != null ? schedule.getZdsj() : "");
  1469 + tempMap.put("zdsjActual", schedule.getZdsjActual() != null ? schedule.getZdsjActual() : "");
  1470 + if (schedule.getUpdateBy() != null) {
  1471 + if (schedule.getUpdateBy().getName() != null)
  1472 + tempMap.put("userName", schedule.getUpdateBy().getName());
  1473 + else
  1474 + tempMap.put("userName", "");
  1475 + } else {
  1476 + tempMap.put("userName", "");
  1477 + }
  1478 + if (schedule.getUpdateDate() != null) {
  1479 + tempMap.put("updateDate", sdf.format(schedule.getUpdateDate()));
  1480 + } else {
  1481 + tempMap.put("updateDate", "");
  1482 + }
  1483 + tempMap.put("remarks", schedule.getRemarks() != null ? schedule.getRemarks() : "");
  1484 + tempList.add(tempMap);
  1485 + }
  1486 + try {
  1487 + listI.add(tempList.iterator());
  1488 + String path = this.getClass().getResource("/").getPath() + "static/pages/forms/";
  1489 + ee.excelReplace(listI, new Object[]{m}, path + "mould/correctForm.xls",
  1490 + path + "export/修正报表" + sdfSimple.format(sdfMonth.parse(startDate)) + "-" + sdfSimple.format(sdfMonth.parse(endDate)) + ".xls");
  1491 + } catch (Exception e) {
  1492 + // TODO: handle exception
  1493 + e.printStackTrace();
  1494 + }
  1495 + Map<String, Object> map = tempList.get(tempList.size() - 1);
  1496 + System.out.println("tempMap:" + map);
  1497 + }
  1498 +
  1499 + return list;
  1500 + }
  1501 +
  1502 + @Override
  1503 + public List<ScheduleRealInfo> queryListWaybill(String jName, String clZbh,
  1504 + String lpName, String date, String line) {
  1505 + List<ScheduleRealInfo> listSchedule = new ArrayList<ScheduleRealInfo>();
  1506 + List<ScheduleRealInfo> list = null;
  1507 + list = scheduleRealInfoRepository.queryListWaybill(jName, clZbh, lpName, date, line);
  1508 + for (int i = 0; i < list.size(); i++) {
  1509 + ScheduleRealInfo s = list.get(i);
  1510 + s.setAdjustExps(i + 1 + "");
  1511 + String remarks = "";
  1512 + if (s.getRemarks() != null) {
  1513 + remarks += s.getRemarks();
  1514 + }
  1515 +
  1516 + Set<ChildTaskPlan> childTaskPlans = s.getcTasks();
  1517 + if (!childTaskPlans.isEmpty()) {
  1518 + s.setFcsjActual("");
  1519 + s.setZdsjActual("");
  1520 + s.setJhlc(0.0);
  1521 + }
  1522 +
  1523 + if (s.isDestroy()) {
  1524 + s.setFcsjActual("");
  1525 + s.setZdsjActual("");
  1526 + s.setJhlc(0.0);
  1527 + remarks += "(烂班)";
  1528 + s.setRemarks(remarks);
  1529 + }
  1530 + listSchedule.add(s);
  1531 + //计算营运里程,空驶里程
  1532 + if (!childTaskPlans.isEmpty()) {
  1533 + Iterator<ChildTaskPlan> it = childTaskPlans.iterator();
  1534 + while (it.hasNext()) {
  1535 + ScheduleRealInfo t = new ScheduleRealInfo();
  1536 + ChildTaskPlan childTaskPlan = it.next();
  1537 + if (childTaskPlan.isDestroy()) {
  1538 + t.setFcsjActual("");
  1539 + t.setZdsjActual("");
  1540 + t.setJhlc(0.0);
  1541 + } else {
  1542 + t.setFcsjActual(childTaskPlan.getStartDate());
  1543 + t.setZdsjActual(childTaskPlan.getEndDate());
  1544 + t.setJhlc(Double.parseDouble(String.valueOf(childTaskPlan.getMileage())));
  1545 + }
  1546 + t.setQdzName(childTaskPlan.getStartStationName());
  1547 + t.setZdzName(childTaskPlan.getEndStationName());
  1548 + t.setRemarks(childTaskPlan.getRemarks());
  1549 + t.setAdjustExps("子");
  1550 + listSchedule.add(t);
  1551 + }
  1552 + /* String sqlPc = "select * from bsth_c_s_child_task where schedule=" + s.getId() + " order by start_date ";
  1553 + List<ScheduleRealInfo> lists = jdbcTemplate.query(sqlPc,
  1554 + new RowMapper<ScheduleRealInfo>() {
  1555 + @Override
  1556 + public ScheduleRealInfo mapRow(ResultSet rs, int rowNum) throws SQLException {
  1557 + ScheduleRealInfo t = new ScheduleRealInfo();
  1558 + if (rs.getInt("destroy") == 0) {
  1559 + t.setFcsjActual(rs.getString("start_date"));
  1560 + t.setZdsjActual(rs.getString("end_date"));
  1561 + t.setJhlc(rs.getDouble("mileage"));
  1562 + } else {
  1563 + t.setFcsjActual("");
  1564 + t.setZdsjActual("");
  1565 + t.setJhlc(0.0);
  1566 + }
  1567 + t.setQdzName(rs.getString("start_station_name"));
  1568 + t.setZdzName(rs.getString("end_station_name"));
  1569 + t.setRemarks(rs.getString("remarks"));
  1570 + t.setAdjustExps("子");
  1571 + return t;
  1572 + }
  1573 + });
  1574 + for (int j = 0; j < lists.size(); j++) {
  1575 + ScheduleRealInfo t = lists.get(j);
  1576 + listSchedule.add(t);
  1577 + }*/
  1578 + }
  1579 + }
  1580 +
  1581 + return listSchedule;
  1582 + }
  1583 +
  1584 + @Override
  1585 + public Map<String, Object> removeChildTask(Long taskId) {
  1586 + Map<String, Object> rs = new HashMap<>();
  1587 + ChildTaskPlan chTask = cTaskPlanRepository.findOne(taskId);
  1588 +
  1589 + ScheduleRealInfo sch = dayOfSchedule.get(chTask.getSchedule().getId());
  1590 + try {
  1591 +
  1592 + sch.getcTasks().remove(chTask);
  1593 + scheduleRealInfoRepository.save(sch);
  1594 + rs.put("status", ResponseCode.SUCCESS);
  1595 + } catch (Exception e) {
  1596 + logger.error("", e);
  1597 + rs.put("status", ResponseCode.ERROR);
  1598 + }
  1599 + return rs;
  1600 + }
  1601 +
  1602 + @Override
  1603 + public List<Map<String, Object>> statisticsDaily(String line, String date,
  1604 + String xlName, String type) {
  1605 + List<ScheduleRealInfo> list = new ArrayList<ScheduleRealInfo>();
  1606 + if (date.length() == 10)
  1607 + list = scheduleRealInfoRepository.scheduleByDateAndLine2(line, date);
  1608 + else if (date.length() == 7)
  1609 + list = scheduleRealInfoRepository.scheduleByDateAndLine3(line, date);
  1610 +
  1611 + List<Map<String, Object>> lMap = new ArrayList<Map<String, Object>>();
  1612 + DecimalFormat format = new DecimalFormat("0.00");
  1613 + double jhlc = 0, tempJhlc = 0, childMileage = 0;
  1614 + float sjgl = 0f, ssgl = 0f, ssgl_lz = 0f, ssgl_dm = 0f, ssgl_gz = 0f, ssgl_jf = 0f, ssgl_zs = 0f, ssgl_qr = 0f, ssgl_qc = 0f, ssgl_kx = 0f, ssgl_qh = 0f, ssgl_yw = 0f, ssgl_other = 0f, ljgl = 0f;
  1615 + //班次
  1616 + int ssbc = 0, ssbc_lz = 0, ssbc_dm = 0, ssbc_gz = 0, ssbc_jf = 0, ssbc_zs = 0, ssbc_qr = 0, ssbc_qc = 0, ssbc_kx = 0, ssbc_qh = 0, ssbc_yw = 0, ssbc_other = 0;
  1617 + int sj_0 = 6 * 60 + 31, sj_1 = 8 * 60 + 30, sj_2 = 16 * 60 + 1, sj_3 = 18 * 60;
  1618 + int jhbc = 0, jhbc_m = 0, jhbc_a = 0;
  1619 + int sjbc = 0, sjbc_m = 0, sjbc_a = 0;
  1620 + int ljbc = 0, ljbc_m = 0, ljbc_a = 0;
  1621 + int fzbc = 0, fzbc_m = 0, fzbc_a = 0;
  1622 + int dtbc = 0, dtbc_m = 0, dtbc_a = 0;
  1623 + int djg = 0, djg_m = 0, djg_a = 0, djg_time = 0;
  1624 +
  1625 + double jhlcZ = 0, tempJhlcZ = 0, childMileageZ = 0;
  1626 + float sjglZ = 0f, ssglZ = 0f, ssgl_lzZ = 0f, ssgl_dmZ = 0f,
  1627 + ssgl_gzZ = 0f, ssgl_jfZ = 0f, ssgl_zsZ = 0f, ssgl_qrZ = 0f, ssgl_qcZ = 0f,
  1628 + ssgl_kxZ = 0f, ssgl_qhZ = 0f, ssgl_ywZ = 0f, ssgl_otherZ = 0f, ljglZ = 0f;
  1629 + //班次
  1630 + int ssbcZ = 0, ssbc_lzZ = 0, ssbc_dmZ = 0, ssbc_gzZ = 0, ssbc_jfZ = 0, ssbc_zsZ = 0, ssbc_qrZ = 0, ssbc_qcZ = 0, ssbc_kxZ = 0, ssbc_qhZ = 0, ssbc_ywZ = 0, ssbc_otherZ = 0;
  1631 + int jhbcZ = 0, jhbc_mZ = 0, jhbc_aZ = 0;
  1632 + int sjbcZ = 0, sjbc_mZ = 0, sjbc_aZ = 0;
  1633 + int ljbcZ = 0, ljbc_mZ = 0, ljbc_aZ = 0;
  1634 + int fzbcZ = 0, fzbc_mZ = 0, fzbc_aZ = 0;
  1635 + int dtbcZ = 0, dtbc_mZ = 0, dtbc_aZ = 0;
  1636 + int djgZ = 0, djg_mZ = 0, djg_aZ = 0, djg_timeZ = 0;
  1637 + Map<String, Object> map = null;
  1638 + for (int i = 0; i < list.size(); i++) {
  1639 + ScheduleRealInfo scheduleRealInfo = list.get(i);
  1640 + if (scheduleRealInfo != null) {
  1641 + Set<ChildTaskPlan> childTaskPlans = scheduleRealInfo.getcTasks();
  1642 + //计算实际里程,少驶里程,计划里程=实际里程+少驶里程
  1643 + if (childTaskPlans.isEmpty()) {
  1644 + tempJhlc = scheduleRealInfo.getJhlc() == null ? 0 : scheduleRealInfo.getJhlc();
  1645 + //临加公里
  1646 + if (scheduleRealInfo.isSflj()) {
  1647 + ljgl += tempJhlc;
  1648 + ljglZ += tempJhlc;
  1649 + } else {
  1650 + jhlc += tempJhlc;
  1651 + jhlcZ += tempJhlc;
  1652 + }
  1653 + if (scheduleRealInfo.getStatus() == -1) {
  1654 + ssgl += tempJhlc;
  1655 + ssglZ += tempJhlc;
  1656 + ssbc++;
  1657 + ssbcZ++;
  1658 + if ((scheduleRealInfo.getRemarks() == null ? "" : scheduleRealInfo.getRemarks()).indexOf("路阻") != -1) {
  1659 + ssgl_lz += tempJhlc;
  1660 + ssgl_lzZ += tempJhlc;
  1661 + ssbc_lz++;
  1662 + ssbc_lzZ++;
  1663 + } else if ((scheduleRealInfo.getRemarks() == null ? "" : scheduleRealInfo.getRemarks()).indexOf("吊慢") != -1) {
  1664 + ssgl_dm += tempJhlc;
  1665 + ssgl_dmZ += tempJhlc;
  1666 + ssbc_dm++;
  1667 + ssbc_dmZ++;
  1668 + } else if ((scheduleRealInfo.getRemarks() == null ? "" : scheduleRealInfo.getRemarks()).indexOf("故障") != -1) {
  1669 + ssgl_gz += tempJhlc;
  1670 + ssgl_gzZ += tempJhlc;
  1671 + ssbc_gz++;
  1672 + ssbc_gzZ++;
  1673 + } else if ((scheduleRealInfo.getRemarks() == null ? "" : scheduleRealInfo.getRemarks()).indexOf("纠纷") != -1) {
  1674 + ssgl_jf += tempJhlc;
  1675 + ssgl_jfZ += tempJhlc;
  1676 + ssbc_jf++;
  1677 + ssbc_jfZ++;
  1678 + } else if ((scheduleRealInfo.getRemarks() == null ? "" : scheduleRealInfo.getRemarks()).indexOf("肇事") != -1) {
  1679 + ssgl_zs += tempJhlc;
  1680 + ssgl_zsZ += tempJhlc;
  1681 + ssbc_zs++;
  1682 + ssbc_zsZ++;
  1683 + } else if ((scheduleRealInfo.getRemarks() == null ? "" : scheduleRealInfo.getRemarks()).indexOf("缺人") != -1) {
  1684 + ssgl_qr += tempJhlc;
  1685 + ssgl_qrZ += tempJhlc;
  1686 + ssbc_qr++;
  1687 + ssbc_qrZ++;
  1688 + } else if ((scheduleRealInfo.getRemarks() == null ? "" : scheduleRealInfo.getRemarks()).indexOf("缺车") != -1) {
  1689 + ssgl_qc += tempJhlc;
  1690 + ssgl_qcZ += tempJhlc;
  1691 + ssbc_qc++;
  1692 + ssbc_qcZ++;
  1693 + } else if ((scheduleRealInfo.getRemarks() == null ? "" : scheduleRealInfo.getRemarks()).indexOf("客稀") != -1) {
  1694 + ssgl_kx += tempJhlc;
  1695 + ssgl_kxZ += tempJhlc;
  1696 + ssbc_kx++;
  1697 + ssbc_kxZ++;
  1698 + } else if ((scheduleRealInfo.getRemarks() == null ? "" : scheduleRealInfo.getRemarks()).indexOf("气候") != -1) {
  1699 + ssgl_qh += tempJhlc;
  1700 + ssgl_qhZ += tempJhlc;
  1701 + ssbc_qh++;
  1702 + ssbc_qhZ++;
  1703 + } else if ((scheduleRealInfo.getRemarks() == null ? "" : scheduleRealInfo.getRemarks()).indexOf("援外") != -1) {
  1704 + ssgl_yw += tempJhlc;
  1705 + ssgl_ywZ += tempJhlc;
  1706 + ssbc_yw++;
  1707 + ssbc_ywZ++;
  1708 + } else {
  1709 + ssgl_other += tempJhlc;
  1710 + ssgl_otherZ += tempJhlc;
  1711 + ssbc_other++;
  1712 + ssbc_otherZ++;
  1713 + }
  1714 + } else {
  1715 + sjgl += tempJhlc;
  1716 + sjglZ += tempJhlc;
  1717 + }
  1718 + } else {
  1719 + Iterator<ChildTaskPlan> it = childTaskPlans.iterator();
  1720 + while (it.hasNext()) {
  1721 + ChildTaskPlan childTaskPlan = it.next();
  1722 + childMileage = childTaskPlan.getMileage() == null ? 0 : childTaskPlan.getMileage();
  1723 + jhlc += childMileage;
  1724 + jhlcZ += childMileage;
  1725 + if (childTaskPlan.isDestroy()) {
  1726 + ssgl += childMileage;
  1727 + ssglZ += childMileage;
  1728 + ssbc++;
  1729 + ssbcZ++;
  1730 + if (childTaskPlan.getDestroyReason().equals("路阻")) {
  1731 + ssgl_lz += childTaskPlan.getMileage();
  1732 + ssgl_lzZ += childTaskPlan.getMileage();
  1733 + ssbc_lzZ++;
  1734 + ssbc_lzZ++;
  1735 + } else if (childTaskPlan.getDestroyReason().equals("吊慢")) {
  1736 + ssgl_dm += childTaskPlan.getMileage();
  1737 + ssgl_dmZ += childTaskPlan.getMileage();
  1738 + ssbc_dm++;
  1739 + ssbc_dmZ++;
  1740 + } else if (childTaskPlan.getDestroyReason().equals("故障")) {
  1741 + ssgl_gz += childTaskPlan.getMileage();
  1742 + ssgl_gzZ += childTaskPlan.getMileage();
  1743 + ssbc_gz++;
  1744 + ssbc_gzZ++;
  1745 + } else if (childTaskPlan.getDestroyReason().equals("纠纷")) {
  1746 + ssgl_jf += childTaskPlan.getMileage();
  1747 + ssgl_jfZ += childTaskPlan.getMileage();
  1748 + ssbc_jf++;
  1749 + ssbc_jfZ++;
  1750 + } else if (childTaskPlan.getDestroyReason().equals("肇事")) {
  1751 + ssgl_zs += childTaskPlan.getMileage();
  1752 + ssgl_zsZ += childTaskPlan.getMileage();
  1753 + ssbc_zs++;
  1754 + ssbc_zsZ++;
  1755 + } else if (childTaskPlan.getDestroyReason().equals("缺人")) {
  1756 + ssgl_qr += childTaskPlan.getMileage();
  1757 + ssgl_qrZ += childTaskPlan.getMileage();
  1758 + ssbc_qr++;
  1759 + ssbc_qrZ++;
  1760 + } else if (childTaskPlan.getDestroyReason().equals("缺车")) {
  1761 + ssgl_qc += childTaskPlan.getMileage();
  1762 + ssgl_qcZ += childTaskPlan.getMileage();
  1763 + ssbc_qc++;
  1764 + ssbc_qcZ++;
  1765 + } else if (childTaskPlan.getDestroyReason().equals("客稀")) {
  1766 + ssgl_kx += childTaskPlan.getMileage();
  1767 + ssgl_kxZ += childTaskPlan.getMileage();
  1768 + ssbc_kx++;
  1769 + ssbc_kxZ++;
  1770 + } else if (childTaskPlan.getDestroyReason().equals("气候")) {
  1771 + ssgl_qh += childTaskPlan.getMileage();
  1772 + ssgl_qhZ += childTaskPlan.getMileage();
  1773 + ssbc_qh++;
  1774 + ssbc_qhZ++;
  1775 + } else if (childTaskPlan.getDestroyReason().equals("援外")) {
  1776 + ssgl_yw += childTaskPlan.getMileage();
  1777 + ssgl_ywZ += childTaskPlan.getMileage();
  1778 + ssbc_yw++;
  1779 + ssbc_ywZ++;
  1780 + } else {
  1781 + ssgl_other += childTaskPlan.getMileage();
  1782 + ssgl_otherZ += childTaskPlan.getMileage();
  1783 + ssbc_other++;
  1784 + ssbc_otherZ++;
  1785 + }
  1786 + } else {
  1787 + sjgl += childMileage;
  1788 + sjglZ += childMileage;
  1789 + }
  1790 + }
  1791 + }
  1792 +
  1793 + //班次
  1794 + jhbc++;
  1795 + jhbcZ++;
  1796 + String[] fcsj = scheduleRealInfo.getFcsj().split(":");
  1797 + String[] fcsjActual = (scheduleRealInfo.getFcsjActual() == null ? "0:00" : scheduleRealInfo.getFcsjActual()).split(":");
  1798 + if ((Integer.parseInt(fcsj[0]) * 60 + Integer.parseInt(fcsj[1])) > sj_0 && (Integer.parseInt(fcsj[0]) * 60 + Integer.parseInt(fcsj[1])) < sj_1) {
  1799 + jhbc_m++;
  1800 + jhbc_mZ++;
  1801 + } else if ((Integer.parseInt(fcsj[0]) * 60 + Integer.parseInt(fcsj[1])) > sj_2 && (Integer.parseInt(fcsj[0]) * 60 + Integer.parseInt(fcsj[1])) < sj_3) {
  1802 + jhbc_a++;
  1803 + jhbc_aZ++;
  1804 + }
  1805 + if (scheduleRealInfo.getStatus() != -1) {
  1806 + sjbc++;
  1807 + sjbcZ++;
  1808 + if ((Integer.parseInt(fcsjActual[0]) * 60 + Integer.parseInt(fcsjActual[1])) > sj_0 && (Integer.parseInt(fcsjActual[0]) * 60 + Integer.parseInt(fcsjActual[1])) < sj_1) {
  1809 + sjbc_m++;
  1810 + sjbc_mZ++;
  1811 + } else if ((Integer.parseInt(fcsjActual[0]) * 60 + Integer.parseInt(fcsjActual[1])) > sj_2 && (Integer.parseInt(fcsjActual[0]) * 60 + Integer.parseInt(fcsjActual[1])) < sj_3) {
  1812 + sjbc_a++;
  1813 + sjbc_aZ++;
  1814 + }
  1815 + }
  1816 + if (scheduleRealInfo.isSflj()) {
  1817 + ljbc++;
  1818 + ljbcZ++;
  1819 + if ((Integer.parseInt(fcsjActual[0]) * 60 + Integer.parseInt(fcsjActual[1])) > sj_0 && (Integer.parseInt(fcsjActual[0]) * 60 + Integer.parseInt(fcsjActual[1])) < sj_1) {
  1820 + ljbc_m++;
  1821 + ljbc_mZ++;
  1822 + } else if ((Integer.parseInt(fcsjActual[0]) * 60 + Integer.parseInt(fcsjActual[1])) > sj_2 && (Integer.parseInt(fcsjActual[0]) * 60 + Integer.parseInt(fcsjActual[1])) < sj_3) {
  1823 + ljbc_a++;
  1824 + ljbc_aZ++;
  1825 + }
  1826 + }
  1827 + if (scheduleRealInfo.getBcType().equals("venting")) {
  1828 + fzbc++;
  1829 + fzbcZ++;
  1830 + if ((Integer.parseInt(fcsjActual[0]) * 60 + Integer.parseInt(fcsjActual[1])) > sj_0 && (Integer.parseInt(fcsjActual[0]) * 60 + Integer.parseInt(fcsjActual[1])) < sj_1) {
  1831 + fzbc_m++;
  1832 + fzbc_mZ++;
  1833 + } else if ((Integer.parseInt(fcsjActual[0]) * 60 + Integer.parseInt(fcsjActual[1])) > sj_2 && (Integer.parseInt(fcsjActual[0]) * 60 + Integer.parseInt(fcsjActual[1])) < sj_3) {
  1834 + fzbc_a++;
  1835 + fzbc_aZ++;
  1836 + }
  1837 + }
  1838 +
  1839 + if (i < list.size() - 1) {
  1840 + if (!scheduleRealInfo.getXlBm().equals(list.get(i + 1).getXlBm())) {
  1841 + map = new HashMap<String, Object>();
  1842 + map.put("xlName", scheduleRealInfo.getXlName());
  1843 + map.put("jhlc", format.format(jhlc));
  1844 + map.put("sjgl", format.format(sjgl));
  1845 + map.put("ssgl", format.format(ssgl));
  1846 + map.put("ssgl_lz", ssgl_lz == 0 ? 0 : format.format(ssgl_lz));
  1847 + map.put("ssgl_dm", ssgl_dm == 0 ? 0 : format.format(ssgl_dm));
  1848 + map.put("ssgl_gz", ssgl_gz == 0 ? 0 : format.format(ssgl_gz));
  1849 + map.put("ssgl_jf", ssgl_jf == 0 ? 0 : format.format(ssgl_jf));
  1850 + map.put("ssgl_zs", ssgl_zs == 0 ? 0 : format.format(ssgl_zs));
  1851 + map.put("ssgl_qr", ssgl_qr == 0 ? 0 : format.format(ssgl_qr));
  1852 + map.put("ssgl_qc", ssgl_qc == 0 ? 0 : format.format(ssgl_qc));
  1853 + map.put("ssgl_kx", ssgl_kx == 0 ? 0 : format.format(ssgl_kx));
  1854 + map.put("ssgl_qh", ssgl_qh == 0 ? 0 : format.format(ssgl_qh));
  1855 + map.put("ssgl_yw", ssgl_yw == 0 ? 0 : format.format(ssgl_yw));
  1856 + map.put("ssgl_other", ssgl_other == 0 ? 0 : format.format(ssgl_other));
  1857 + map.put("ssbc", ssbc);
  1858 + map.put("ssbc_lz", ssbc_lz);
  1859 + map.put("ssbc_dm", ssbc_dm);
  1860 + map.put("ssbc_gz", ssbc_gz);
  1861 + map.put("ssbc_jf", ssbc_jf);
  1862 + map.put("ssbc_zs", ssbc_zs);
  1863 + map.put("ssbc_qr", ssbc_qr);
  1864 + map.put("ssbc_qc", ssbc_qc);
  1865 + map.put("ssbc_kx", ssbc_kx);
  1866 + map.put("ssbc_qh", ssbc_qh);
  1867 + map.put("ssbc_yw", ssbc_yw);
  1868 + map.put("ssbc_other", ssbc_other);
  1869 + map.put("ljgl", ljgl == 0 ? 0 : format.format(ljgl));
  1870 + map.put("jhbc", jhbc);
  1871 + map.put("jhbc_m", jhbc_m);
  1872 + map.put("jhbc_a", jhbc_a);
  1873 + map.put("sjbc", sjbc);
  1874 + map.put("sjbc_m", sjbc_m);
  1875 + map.put("sjbc_a", sjbc_a);
  1876 + map.put("ljbc", ljbc);
  1877 + map.put("ljbc_m", ljbc_m);
  1878 + map.put("ljbc_a", ljbc_a);
  1879 + map.put("fzbc", fzbc);
  1880 + map.put("fzbc_m", fzbc_m);
  1881 + map.put("fzbc_a", fzbc_a);
  1882 + map.put("dtbc", dtbc);
  1883 + map.put("dtbc_m", dtbc_m);
  1884 + map.put("dtbc_a", dtbc_a);
  1885 + map.put("djg", djg);
  1886 + map.put("djg_m", djg_m);
  1887 + map.put("djg_a", djg_a);
  1888 + map.put("djg_time", djg_time);
  1889 + lMap.add(map);
  1890 + jhlc = 0;
  1891 + tempJhlc = 0;
  1892 + childMileage = 0;
  1893 + sjgl = 0f;
  1894 + ssgl = 0f;
  1895 + ssgl_lz = 0f;
  1896 + ssgl_dm = 0f;
  1897 + ssgl_gz = 0f;
  1898 + ssgl_jf = 0f;
  1899 + ssgl_zs = 0f;
  1900 + ssgl_qr = 0f;
  1901 + ssgl_qc = 0f;
  1902 + ssgl_kx = 0f;
  1903 + ssgl_qh = 0f;
  1904 + ssgl_yw = 0f;
  1905 + ssgl_other = 0f;
  1906 + ljgl = 0f;
  1907 + //班次
  1908 + jhbc = 0;
  1909 + jhbc_m = 0;
  1910 + jhbc_a = 0;
  1911 + sjbc = 0;
  1912 + sjbc_m = 0;
  1913 + sjbc_a = 0;
  1914 + ljbc = 0;
  1915 + ljbc_m = 0;
  1916 + ljbc_a = 0;
  1917 + fzbc = 0;
  1918 + fzbc_m = 0;
  1919 + fzbc_a = 0;
  1920 + dtbc = 0;
  1921 + dtbc_m = 0;
  1922 + dtbc_a = 0;
  1923 + djg = 0;
  1924 + djg_m = 0;
  1925 + djg_a = 0;
  1926 + djg_time = 0;
  1927 + }
  1928 + } else {
  1929 + map = new HashMap<String, Object>();
  1930 + map.put("xlName", scheduleRealInfo.getXlName());
  1931 + map.put("jhlc", format.format(jhlc));
  1932 + map.put("sjgl", format.format(sjgl));
  1933 + map.put("ssgl", format.format(ssgl));
  1934 + map.put("ssgl_lz", ssgl_lz == 0 ? 0 : format.format(ssgl_lz));
  1935 + map.put("ssgl_dm", ssgl_dm == 0 ? 0 : format.format(ssgl_dm));
  1936 + map.put("ssgl_gz", ssgl_gz == 0 ? 0 : format.format(ssgl_gz));
  1937 + map.put("ssgl_jf", ssgl_jf == 0 ? 0 : format.format(ssgl_jf));
  1938 + map.put("ssgl_zs", ssgl_zs == 0 ? 0 : format.format(ssgl_zs));
  1939 + map.put("ssgl_qr", ssgl_qr == 0 ? 0 : format.format(ssgl_qr));
  1940 + map.put("ssgl_qc", ssgl_qc == 0 ? 0 : format.format(ssgl_qc));
  1941 + map.put("ssgl_kx", ssgl_kx == 0 ? 0 : format.format(ssgl_kx));
  1942 + map.put("ssgl_qh", ssgl_qh == 0 ? 0 : format.format(ssgl_qh));
  1943 + map.put("ssgl_yw", ssgl_yw == 0 ? 0 : format.format(ssgl_yw));
  1944 + map.put("ssgl_other", ssgl_other == 0 ? 0 : format.format(ssgl_other));
  1945 + map.put("ssbc", ssbc);
  1946 + map.put("ssbc_lz", ssbc_lz);
  1947 + map.put("ssbc_dm", ssbc_dm);
  1948 + map.put("ssbc_gz", ssbc_gz);
  1949 + map.put("ssbc_jf", ssbc_jf);
  1950 + map.put("ssbc_zs", ssbc_zs);
  1951 + map.put("ssbc_qr", ssbc_qr);
  1952 + map.put("ssbc_qc", ssbc_qc);
  1953 + map.put("ssbc_kx", ssbc_kx);
  1954 + map.put("ssbc_qh", ssbc_qh);
  1955 + map.put("ssbc_yw", ssbc_yw);
  1956 + map.put("ssbc_other", ssbc_other);
  1957 + map.put("ljgl", ljgl == 0 ? 0 : format.format(ljgl));
  1958 + map.put("jhbc", jhbc);
  1959 + map.put("jhbc_m", jhbc_m);
  1960 + map.put("jhbc_a", jhbc_a);
  1961 + map.put("sjbc", sjbc);
  1962 + map.put("sjbc_m", sjbc_m);
  1963 + map.put("sjbc_a", sjbc_a);
  1964 + map.put("ljbc", ljbc);
  1965 + map.put("ljbc_m", ljbc_m);
  1966 + map.put("ljbc_a", ljbc_a);
  1967 + map.put("fzbc", fzbc);
  1968 + map.put("fzbc_m", fzbc_m);
  1969 + map.put("fzbc_a", fzbc_a);
  1970 + map.put("dtbc", dtbc);
  1971 + map.put("dtbc_m", dtbc_m);
  1972 + map.put("dtbc_a", dtbc_a);
  1973 + map.put("djg", djg);
  1974 + map.put("djg_m", djg_m);
  1975 + map.put("djg_a", djg_a);
  1976 + map.put("djg_time", djg_time);
  1977 + lMap.add(map);
  1978 + jhlc = 0;
  1979 + tempJhlc = 0;
  1980 + childMileage = 0;
  1981 + sjgl = 0f;
  1982 + ssgl = 0f;
  1983 + ssgl_lz = 0f;
  1984 + ssgl_dm = 0f;
  1985 + ssgl_gz = 0f;
  1986 + ssgl_jf = 0f;
  1987 + ssgl_zs = 0f;
  1988 + ssgl_qr = 0f;
  1989 + ssgl_qc = 0f;
  1990 + ssgl_kx = 0f;
  1991 + ssgl_qh = 0f;
  1992 + ssgl_yw = 0f;
  1993 + ssgl_other = 0f;
  1994 + ljgl = 0f;
  1995 + //班次
  1996 + jhbc = 0;
  1997 + jhbc_m = 0;
  1998 + jhbc_a = 0;
  1999 + sjbc = 0;
  2000 + sjbc_m = 0;
  2001 + sjbc_a = 0;
  2002 + ljbc = 0;
  2003 + ljbc_m = 0;
  2004 + ljbc_a = 0;
  2005 + fzbc = 0;
  2006 + fzbc_m = 0;
  2007 + fzbc_a = 0;
  2008 + dtbc = 0;
  2009 + dtbc_m = 0;
  2010 + dtbc_a = 0;
  2011 + djg = 0;
  2012 + djg_m = 0;
  2013 + djg_a = 0;
  2014 + djg_time = 0;
  2015 + }
  2016 + }
  2017 + }
  2018 + map = new HashMap<String, Object>();
  2019 + map.put("xlName", "合计");
  2020 + map.put("jhlc", format.format(jhlcZ));
  2021 + map.put("sjgl", format.format(sjglZ));
  2022 + map.put("ssgl", format.format(ssglZ));
  2023 + map.put("ssgl_lz", ssgl_lzZ == 0 ? 0 : format.format(ssgl_lzZ));
  2024 + map.put("ssgl_dm", ssgl_dmZ == 0 ? 0 : format.format(ssgl_dmZ));
  2025 + map.put("ssgl_gz", ssgl_gzZ == 0 ? 0 : format.format(ssgl_gzZ));
  2026 + map.put("ssgl_jf", ssgl_jfZ == 0 ? 0 : format.format(ssgl_jfZ));
  2027 + map.put("ssgl_zs", ssgl_zsZ == 0 ? 0 : format.format(ssgl_zsZ));
  2028 + map.put("ssgl_qr", ssgl_qrZ == 0 ? 0 : format.format(ssgl_qrZ));
  2029 + map.put("ssgl_qc", ssgl_qcZ == 0 ? 0 : format.format(ssgl_qcZ));
  2030 + map.put("ssgl_kx", ssgl_kxZ == 0 ? 0 : format.format(ssgl_kxZ));
  2031 + map.put("ssgl_qh", ssgl_qhZ == 0 ? 0 : format.format(ssgl_qhZ));
  2032 + map.put("ssgl_yw", ssgl_ywZ == 0 ? 0 : format.format(ssgl_ywZ));
  2033 + map.put("ssgl_other", ssgl_otherZ == 0 ? 0 : format.format(ssgl_otherZ));
  2034 + map.put("ssbc", ssbcZ);
  2035 + map.put("ssbc_lz", ssbc_lzZ);
  2036 + map.put("ssbc_dm", ssbc_lzZ);
  2037 + map.put("ssbc_gz", ssbc_gzZ);
  2038 + map.put("ssbc_jf", ssbc_jfZ);
  2039 + map.put("ssbc_zs", ssbc_zsZ);
  2040 + map.put("ssbc_qr", ssbc_qrZ);
  2041 + map.put("ssbc_qc", ssbc_qcZ);
  2042 + map.put("ssbc_kx", ssbc_qcZ);
  2043 + map.put("ssbc_qh", ssbc_qhZ);
  2044 + map.put("ssbc_yw", ssbc_ywZ);
  2045 + map.put("ssbc_other", ssbc_otherZ);
  2046 + map.put("ljgl", ljglZ == 0 ? 0 : format.format(ljglZ));
  2047 + map.put("jhbc", jhbcZ);
  2048 + map.put("jhbc_m", jhbc_mZ);
  2049 + map.put("jhbc_a", jhbc_aZ);
  2050 + map.put("sjbc", sjbcZ);
  2051 + map.put("sjbc_m", sjbc_mZ);
  2052 + map.put("sjbc_a", sjbc_aZ);
  2053 + map.put("ljbc", ljbcZ);
  2054 + map.put("ljbc_m", ljbc_mZ);
  2055 + map.put("ljbc_a", ljbc_aZ);
  2056 + map.put("fzbc", fzbcZ);
  2057 + map.put("fzbc_m", fzbc_mZ);
  2058 + map.put("fzbc_a", fzbc_aZ);
  2059 + map.put("dtbc", dtbcZ);
  2060 + map.put("dtbc_m", dtbc_mZ);
  2061 + map.put("dtbc_a", dtbc_aZ);
  2062 + map.put("djg", djgZ);
  2063 + map.put("djg_m", djg_mZ);
  2064 + map.put("djg_a", djg_aZ);
  2065 + map.put("djg_time", djg_timeZ);
  2066 + lMap.add(map);
  2067 + /* for (int i = 0; i < lMap.size(); i++) {
  2068 + Map<String, Object> m=lMap.get(i);
  2069 +// m.get(""))
  2070 + jhlc += Double.parseDouble(m.get("jhlc").toString());
  2071 + sjgl += Double.parseDouble(m.get("sjgl").toString());
  2072 + ssgl += Double.parseDouble( m.get("ssgl").toString());
  2073 + ssgl_lz += Double.parseDouble( m.get("ssgl_lz").toString());
  2074 + ssgl_dm += Double.parseDouble(m.get("ssgl_dm").toString());
  2075 + ssgl_gz += Double.parseDouble( m.get("ssgl_gz").toString());
  2076 + ssgl_jf += m.get("ssgl_jf", ssgl_jf == 0 ? 0 : format.format(ssgl_jf));
  2077 + m.get("ssgl_zs", ssgl_zs == 0 ? 0 : format.format(ssgl_zs));
  2078 + m.get("ssgl_qr", ssgl_qr == 0 ? 0 : format.format(ssgl_qr));
  2079 + m.get("ssgl_qc", ssgl_qc == 0 ? 0 : format.format(ssgl_qc));
  2080 + m.get("ssgl_kx", ssgl_kx == 0 ? 0 : format.format(ssgl_kx));
  2081 + m.get("ssgl_qh", ssgl_qh == 0 ? 0 : format.format(ssgl_qh));
  2082 + m.get("ssgl_yw", ssgl_yw == 0 ? 0 : format.format(ssgl_yw));
  2083 + m.get("ssgl_other", ssgl_other == 0 ? 0 : format.format(ssgl_other));
  2084 + m.get("ljgl", ljgl == 0 ? 0 : format.format(ljgl));
  2085 + m.get("jhbc", jhbc);
  2086 + m.get("jhbc_m", jhbc_m);
  2087 + m.get("jhbc_a", jhbc_a);
  2088 + m.get("sjbc", sjbc);
  2089 + m.get("sjbc_m", sjbc_m);
  2090 + m.get("sjbc_a", sjbc_a);
  2091 + m.get("ljbc", ljbc);
  2092 + m.get("ljbc_m", ljbc_m);
  2093 + m.get("ljbc_a", ljbc_a);
  2094 + m.get("fzbc", fzbc);
  2095 + m.get("fzbc_m", fzbc_m);
  2096 + m.get("fzbc_a", fzbc_a);
  2097 + m.get("dtbc", dtbc);
  2098 + m.get("dtbc_m", dtbc_m);
  2099 + m.get("dtbc_a", dtbc_a);
  2100 + m.get("djg", djg);
  2101 + m.get("djg_m", djg_m);
  2102 + m.get("djg_a", djg_a);
  2103 + m.get("djg_time", djg_time);
  2104 + }*/
  2105 +
  2106 + if (type != null && type.length() != 0 && type.equals("export")) {
  2107 + SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"),
  2108 + sdfSimple = new SimpleDateFormat("yyyyMMdd");
  2109 + List<Iterator<?>> listI = new ArrayList<Iterator<?>>();
  2110 + Map<String, Object> m = new HashMap<String, Object>();
  2111 + ReportUtils ee = new ReportUtils();
1469 2112 try {
1470   - listI.add(tempList.iterator());
  2113 + listI.add(lMap.iterator());
1471 2114 String path = this.getClass().getResource("/").getPath() + "static/pages/forms/";
1472   - ee.excelReplace(listI, new Object[]{m}, path + "mould/correctForm.xls",
1473   - path + "export/修正报表" + sdfSimple.format(sdfMonth.parse(startDate)) + "-" + sdfSimple.format(sdfMonth.parse(endDate)) + ".xls");
  2115 + ee.excelReplace(listI, new Object[]{m}, path + "mould/statisticsDaily_.xls",
  2116 + path + "export/统计日报" + sdfSimple.format(sdfMonth.parse(date)) + ".xls");
1474 2117 } catch (Exception e) {
1475 2118 // TODO: handle exception
1476 2119 e.printStackTrace();
1477 2120 }
1478   - Map<String, Object> map = tempList.get(tempList.size() - 1);
1479   - System.out.println("tempMap:" + map);
1480   - }
1481   -
1482   - return list;
1483   - }
1484   -
1485   - @Override
1486   - public List<ScheduleRealInfo> queryListWaybill(String jName, String clZbh,
1487   - String lpName, String date, String line) {
1488   - List<ScheduleRealInfo> listSchedule = new ArrayList<ScheduleRealInfo>();
1489   - List<ScheduleRealInfo> list = null;
1490   - list = scheduleRealInfoRepository.queryListWaybill(jName, clZbh, lpName, date, line);
1491   - for (int i = 0; i < list.size(); i++) {
1492   - ScheduleRealInfo s = list.get(i);
1493   - s.setAdjustExps(i + 1 + "");
1494   - String remarks = "";
1495   - if (s.getRemarks() != null) {
1496   - remarks += s.getRemarks();
1497   - }
1498   -
1499   - Set<ChildTaskPlan> childTaskPlans = s.getcTasks();
1500   - if (!childTaskPlans.isEmpty()) {
1501   - s.setFcsjActual("");
1502   - s.setZdsjActual("");
1503   - }
1504   -
1505   - if (s.isDestroy()) {
1506   - s.setFcsjActual("");
1507   - s.setZdsjActual("");
1508   - s.setJhlc(0.0);
1509   - remarks += "(烂班)";
1510   - s.setRemarks(remarks);
1511   - }
1512   - listSchedule.add(s);
1513   - //计算营运里程,空驶里程
1514   - if (!childTaskPlans.isEmpty()) {
1515   - String sqlPc = "select * from bsth_c_s_child_task where schedule=" + s.getId() + " order by start_date ";
1516   - List<ScheduleRealInfo> lists = jdbcTemplate.query(sqlPc,
1517   - new RowMapper<ScheduleRealInfo>() {
1518   - @Override
1519   - public ScheduleRealInfo mapRow(ResultSet rs, int rowNum) throws SQLException {
1520   - ScheduleRealInfo t = new ScheduleRealInfo();
1521   - if (rs.getInt("destroy") == 0) {
1522   - t.setFcsjActual(rs.getString("start_date"));
1523   - t.setZdsjActual(rs.getString("end_date"));
1524   - t.setJhlc(rs.getDouble("mileage"));
1525   - } else {
1526   - t.setFcsjActual("");
1527   - t.setZdsjActual("");
1528   - t.setJhlc(0.0);
1529   - }
1530   - t.setQdzName(rs.getString("start_station_name"));
1531   - t.setZdzName(rs.getString("end_station_name"));
1532   - t.setRemarks(rs.getString("remarks"));
1533   - t.setAdjustExps("子");
1534   - return t;
1535   - }
1536   - });
1537   - for (int j = 0; j < lists.size(); j++) {
1538   - ScheduleRealInfo t = lists.get(j);
1539   - listSchedule.add(t);
1540   - }
1541   - }
1542 2121 }
1543 2122  
1544   - return listSchedule;
1545   - }
1546   -
1547   - @Override
1548   - public Map<String, Object> removeChildTask(Long taskId) {
1549   - Map<String, Object> rs = new HashMap<>();
1550   - ChildTaskPlan chTask = cTaskPlanRepository.findOne(taskId);
1551   -
1552   - ScheduleRealInfo sch = dayOfSchedule.get(chTask.getSchedule().getId());
1553   - try {
1554   -
1555   - sch.getcTasks().remove(chTask);
1556   - scheduleRealInfoRepository.save(sch);
1557   - rs.put("status", ResponseCode.SUCCESS);
1558   - } catch (Exception e) {
1559   - logger.error("", e);
1560   - rs.put("status", ResponseCode.ERROR);
1561   - }
1562   - return rs;
  2123 + return lMap;
1563 2124 }
1564   -
  2125 +
1565 2126 @Override
1566   - public List<Map<String, Object>> statisticsDaily(String line, String date,
  2127 + public List<Map<String, Object>> statisticsDailyTj(String line, String date,String date2,
1567 2128 String xlName, String type) {
1568 2129 List<ScheduleRealInfo> list = new ArrayList<ScheduleRealInfo>();
1569   - if (date.length() == 10)
1570   - list = scheduleRealInfoRepository.scheduleByDateAndLine2(line, date);
1571   - else if (date.length() == 7)
1572   - list = scheduleRealInfoRepository.scheduleByDateAndLine3(line, date);
  2130 + list = scheduleRealInfoRepository.scheduleByDateAndLineTj(line, date,date2);
1573 2131  
1574 2132 List<Map<String, Object>> lMap = new ArrayList<Map<String, Object>>();
1575 2133 DecimalFormat format = new DecimalFormat("0.00");
... ... @@ -2331,119 +2889,113 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
2331 2889 return list;
2332 2890 }
2333 2891  
2334   - public List<Map<String, Object>> yesterdayDataList(String line, String date) {
  2892 + public List<Map<String, Object>> yesterdayDataList(String line, String date,String gsbm,String fgsbm,String jGh,String nbbm) {
  2893 +// Arith arith=new Arith();
2335 2894 //前一天日期
2336 2895 // String date = sdfMonth.format(org.apache.commons.lang.time.DateUtils.addDays(new Date(), -1));
2337 2896 // String date = "2016-09-20";
2338   - List<Map<String, Object>> yesterdayDataList = scheduleRealInfoRepository.yesterdayDataList(line, date);
2339   -// List<ScheduleRealInfo> list = scheduleRealInfoRepository.scheduleByDateAndLine(line, date);
  2897 + System.out.println("shijian1:"+new Date());
  2898 + List<Map<String, Object>> yesterdayDataList = scheduleRealInfoRepository.yesterdayDataList(line, date,gsbm,fgsbm);
  2899 + System.out.println("shijian2:"+new Date());
  2900 + // List<ScheduleRealInfo> list = scheduleRealInfoRepository.scheduleByDateAndLine(line, date);
  2901 + List<ScheduleRealInfo> lists = scheduleRealInfoRepository.queryListWaybill3(jGh, nbbm, date,gsbm,fgsbm);
  2902 + System.out.println("shijian3:"+new Date());
2340 2903 for (int x = 0; x < yesterdayDataList.size(); x++) {
2341 2904 String jName = yesterdayDataList.get(x).get("jGh").toString();
2342 2905 String clZbh = yesterdayDataList.get(x).get("clZbh").toString();
2343   - List<ScheduleRealInfo> lists = scheduleRealInfoRepository.queryListWaybill3(jName, clZbh, date);
  2906 +
2344 2907 double jhlc = 0, yygl = 0, ksgl = 0, tempJhlc = 0, jcclc = 0;
2345   - float addMileage = 0l, remMileage = 0l;
  2908 + double addMileage = 0, remMileage = 0;
2346 2909 Map<String, Object> map = new HashMap<String, Object>();
2347 2910 boolean fage = true;
  2911 + String company="";
  2912 + String bCompany="";
2348 2913 for (ScheduleRealInfo scheduleRealInfo : lists) {
2349   - if (fage) {
2350   - //根据线路代码获取公司
2351   - Line li = lineRepository.findByLineCode(scheduleRealInfo.getXlBm());
2352   - yesterdayDataList.get(x).put("company", li.getCompany());
2353   - yesterdayDataList.get(x).put("bCompany", li.getBrancheCompany());
2354   - fage = false;
2355   - }
2356   - if (scheduleRealInfo != null) {
2357   - //计划里程(主任务过滤掉临加班次),
2358   - //烂班里程(主任务烂班),
2359   - //临加里程(主任务临加),
2360   - //计划班次,烂班班次,增加班次
2361   - tempJhlc = scheduleRealInfo.getJhlc() == null ? 0 : scheduleRealInfo.getJhlc();
2362   - if (scheduleRealInfo.isSflj()) {
2363   - addMileage += tempJhlc;
2364   - } else {
2365   - if (!(scheduleRealInfo.getBcType().equals("in")
2366   - || scheduleRealInfo.getBcType().equals("out"))) {
2367   - jhlc += tempJhlc;
2368   - }
2369   -
2370   - if (scheduleRealInfo.getStatus() == -1) {
2371   - remMileage += tempJhlc;
2372   - }
2373   - }
2374   - Set<ChildTaskPlan> childTaskPlans = scheduleRealInfo.getcTasks();
2375   - //计算营运里程,空驶里程
2376   - if (childTaskPlans.isEmpty()) {
2377   - if (scheduleRealInfo.getBcType().equals("in") ||
2378   - scheduleRealInfo.getBcType().equals("out")) {
2379   - if (scheduleRealInfo.getStatus() != -1) {
2380   - jcclc += tempJhlc;
2381   - }
2382   - }
2383   - //主任务 放空班次属于营运
2384   -// else if(scheduleRealInfo.getBcType().equals("venting")){
2385   -// ksgl += tempJhlc;
2386   -// }
2387   - else {
2388   - if (scheduleRealInfo.getStatus() != -1) {
2389   - yygl += tempJhlc;
2390   - }
2391   - }
2392   - } else {
2393   - Iterator<ChildTaskPlan> it = childTaskPlans.iterator();
2394   - while (it.hasNext()) {
2395   - ChildTaskPlan childTaskPlan = it.next();
2396   - if (childTaskPlan.getMileageType().equals("empty")) {
2397   - if (childTaskPlan.isDestroy()) {
2398   - remMileage += childTaskPlan.getMileage() == null ? 0 : childTaskPlan.getMileage();
2399   - } else {
2400   - ksgl += childTaskPlan.getMileage() == null ? 0 : childTaskPlan.getMileage();
2401   - }
2402   - } else {
2403   - if (childTaskPlan.isDestroy()) {
2404   - remMileage += childTaskPlan.getMileage() == null ? 0 : childTaskPlan.getMileage();
2405   - } else {
2406   - yygl += childTaskPlan.getMileage() == null ? 0 : childTaskPlan.getMileage();
2407   - }
2408   - }
2409   - }
2410   - }
2411   - }
  2914 + if(scheduleRealInfo.getjGh().equals(jName) && scheduleRealInfo.getClZbh().equals(clZbh)){
  2915 + if (fage) {
  2916 + //根据线路代码获取公司
  2917 + company=scheduleRealInfo.getGsBm();
  2918 + bCompany=scheduleRealInfo.getFgsBm();
  2919 + fage = false;
  2920 + }
  2921 + if (scheduleRealInfo != null) {
  2922 + //计划里程(主任务过滤掉临加班次),
  2923 + //烂班里程(主任务烂班),
  2924 + //临加里程(主任务临加),
  2925 + //计划班次,烂班班次,增加班次
  2926 + tempJhlc = scheduleRealInfo.getJhlc() == null ? 0 : scheduleRealInfo.getJhlc();
  2927 + if (scheduleRealInfo.isSflj()) {
  2928 + if(scheduleRealInfo.getStatus() == -1){
  2929 +// addMileage += tempJhlc;
  2930 + addMileage =Arith.add(addMileage, tempJhlc);
  2931 + }
  2932 + } else {
  2933 + if (!(scheduleRealInfo.getBcType().equals("in")
  2934 + || scheduleRealInfo.getBcType().equals("out"))) {
  2935 +// jhlc += tempJhlc;
  2936 + jhlc =Arith.add(jhlc,tempJhlc);
  2937 + }
  2938 +
  2939 + if (scheduleRealInfo.getStatus() == -1) {
  2940 +// remMileage += tempJhlc;
  2941 + remMileage =Arith.add(remMileage,tempJhlc);
  2942 + }
  2943 + }
  2944 + Set<ChildTaskPlan> childTaskPlans = scheduleRealInfo.getcTasks();
  2945 + //计算营运里程,空驶里程
  2946 + if (childTaskPlans.isEmpty()) {
  2947 + if (scheduleRealInfo.getBcType().equals("in") ||
  2948 + scheduleRealInfo.getBcType().equals("out")) {
  2949 + if (scheduleRealInfo.getStatus() != -1) {
  2950 +// jcclc += tempJhlc;
  2951 + jcclc=Arith.add(jcclc,tempJhlc);
  2952 + }
  2953 + }
  2954 + //主任务 放空班次属于营运
  2955 + // else if(scheduleRealInfo.getBcType().equals("venting")){
  2956 + // ksgl += tempJhlc;
  2957 + // }
  2958 + else {
  2959 + if (scheduleRealInfo.getStatus() != -1) {
  2960 +// yygl += tempJhlc;
  2961 + yygl=Arith.add(yygl,tempJhlc);
  2962 + }
  2963 + }
  2964 + } else {
  2965 + Iterator<ChildTaskPlan> it = childTaskPlans.iterator();
  2966 + while (it.hasNext()) {
  2967 + ChildTaskPlan childTaskPlan = it.next();
  2968 + if (childTaskPlan.getMileageType().equals("empty")) {
  2969 + if (childTaskPlan.isDestroy()) {
  2970 +// remMileage += childTaskPlan.getMileage() == null ? 0 : childTaskPlan.getMileage();
  2971 + remMileage=Arith.add(remMileage,childTaskPlan.getMileage() == null ? 0 : childTaskPlan.getMileage());
  2972 + } else {
  2973 +// ksgl += childTaskPlan.getMileage() == null ? 0 : childTaskPlan.getMileage();
  2974 + ksgl += Arith.add(ksgl,childTaskPlan.getMileage() == null ? 0 : childTaskPlan.getMileage());
  2975 + }
  2976 + } else {
  2977 + if (childTaskPlan.isDestroy()) {
  2978 +// remMileage += childTaskPlan.getMileage() == null ? 0 : childTaskPlan.getMileage();
  2979 + remMileage=Arith.add(remMileage,childTaskPlan.getMileage() == null ? 0 : childTaskPlan.getMileage());
  2980 +
  2981 + } else {
  2982 +// yygl += childTaskPlan.getMileage() == null ? 0 : childTaskPlan.getMileage();
  2983 + yygl=Arith.add(yygl,childTaskPlan.getMileage() == null ? 0 : childTaskPlan.getMileage());
  2984 +
  2985 + }
  2986 + }
  2987 + }
  2988 + }
  2989 + }
  2990 + }
2412 2991 }
  2992 + yesterdayDataList.get(x).put("company", company);
  2993 + yesterdayDataList.get(x).put("bCompany", bCompany);
  2994 + Double zgl=Arith.add(yygl,ksgl);
  2995 + yesterdayDataList.get(x).put("totalKilometers", Arith.add(zgl, jcclc));
2413 2996  
2414   - yesterdayDataList.get(x).put("totalKilometers", yygl + ksgl + jcclc);
2415   -
2416   - }
2417   -
2418   - /* for(ScheduleRealInfo scheduleRealInfo:list){
2419   - if(scheduleRealInfo != null){
2420   - for(int i=0;i<yesterdayDataList.size();i++){
2421   - if(scheduleRealInfo.getXlBm().equals(yesterdayDataList.get(i).get("xlBm")) && scheduleRealInfo.getClZbh().equals(yesterdayDataList.get(i).get("clZbh"))
2422   - && scheduleRealInfo.getjGh().equals(yesterdayDataList.get(i).get("jGh"))){
2423   - //根据线路代码获取公司
2424   - Line li = lineRepository.findByLineCode(scheduleRealInfo.getXlBm());
2425   - yesterdayDataList.get(i).put("company", li.getCompany());
2426   - yesterdayDataList.get(i).put("bCompany", li.getBrancheCompany());
2427   - //计算总公里
2428   - Set<ChildTaskPlan> childTaskPlans = scheduleRealInfo.getcTasks();
2429   - //如果没有子任务,里程就是已执行(Status=2);有子任务的,忽略主任务,子任务的烂班
2430   - if(childTaskPlans.isEmpty()){
2431   - if(scheduleRealInfo.getStatus() == 2){
2432   - yesterdayDataList.get(i).put("totalKilometers", scheduleRealInfo.getJhlc()==null?0.0:scheduleRealInfo.getJhlc()+(double)(yesterdayDataList.get(i).get("totalKilometers")==null?0.0:yesterdayDataList.get(i).get("totalKilometers")));
2433   - }
2434   - }else{
2435   - Iterator<ChildTaskPlan> it = childTaskPlans.iterator();
2436   - while(it.hasNext()){
2437   - ChildTaskPlan childTaskPlan = it.next();
2438   - if(!childTaskPlan.isDestroy()){
2439   - yesterdayDataList.get(i).put("totalKilometers", childTaskPlan.getMileage()==null?0.0:childTaskPlan.getMileage()+(double)(yesterdayDataList.get(i).get("totalKilometers")==null?0.0:yesterdayDataList.get(i).get("totalKilometers")));
2440   - }
2441   - }
2442   - }
2443   - }
2444   - }
2445   - }
2446   - }*/
  2997 + }
  2998 + System.out.println();
2447 2999 //增加顺序号
2448 3000 for (int i = 0; i < yesterdayDataList.size(); i++) {
2449 3001 if (i == 0) {
... ... @@ -3118,7 +3670,9 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
3118 3670 }
3119 3671  
3120 3672 if (!c.isDestroy()) {
3121   - sjlc += c.getMileage() == null ? 0 : c.getMileage();
  3673 + if(c.getMileageType().equals("service")){
  3674 + sjlc += c.getMileage() == null ? 0 : c.getMileage();
  3675 + }
3122 3676 }
3123 3677  
3124 3678 }
... ... @@ -3593,17 +4147,21 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
3593 4147 }
3594 4148  
3595 4149 ScheduleRealInfo leftSch, rightSch = null;
3596   - boolean changeRealTime = true;
3597 4150 for (int i = 0; i < largeList.size(); i++) {
3598 4151 leftSch = largeList.get(i);
3599 4152 if (i < smallList.size()) {
3600 4153 rightSch = smallList.get(i);
3601 4154 ts.add(rightSch);
3602   - } else
3603   - changeRealTime = false;
  4155 + } else{
  4156 + //不对称时多出来的
  4157 + lpChangeByLeft(leftSch, largeList.get(i - 1), type);
  4158 + ts.add(leftSch);
  4159 + cars.add(leftSch.getClZbh());
  4160 + continue;
  4161 + }
3604 4162  
3605 4163 //调换路牌
3606   - lpChange(leftSch, rightSch, type, changeRealTime);
  4164 + lpChange(leftSch, rightSch, type);
3607 4165 ts.add(leftSch);
3608 4166  
3609 4167 cars.add(leftSch.getClZbh());
... ... @@ -3639,19 +4197,38 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
3639 4197 }
3640 4198  
3641 4199 @Override
3642   - public void lpChange(ScheduleRealInfo leftSch, ScheduleRealInfo rightSch, int type, boolean changeRealTime) {
  4200 + public void lpChange(ScheduleRealInfo leftSch, ScheduleRealInfo rightSch, int type) {
3643 4201 LpData leftData = new LpData(leftSch);
3644 4202 LpData rightData = new LpData(rightSch);
3645 4203  
3646   - leftData.appendTo(rightSch, type, changeRealTime);
3647   - rightData.appendTo(leftSch, type, changeRealTime);
  4204 + leftData.appendTo(rightSch, type);
  4205 + rightData.appendTo(leftSch, type);
  4206 +
  4207 + if(type > 0){
  4208 + //更新车辆和班次映射信息
  4209 + dayOfSchedule.removeNbbm2SchMapp(leftSch, leftData.getNbbm());
  4210 + dayOfSchedule.removeNbbm2SchMapp(rightSch, rightData.getNbbm());
3648 4211  
3649   - //更新车辆和班次映射信息
3650   - dayOfSchedule.removeNbbm2SchMapp(leftSch, leftData.getNbbm());
3651   - dayOfSchedule.removeNbbm2SchMapp(rightSch, rightData.getNbbm());
  4212 + dayOfSchedule.addNbbm2SchMapp(leftSch, rightData.getNbbm());
  4213 + dayOfSchedule.addNbbm2SchMapp(rightSch, leftData.getNbbm());
  4214 + }
  4215 + }
  4216 +
  4217 + /**
  4218 + * 更换左边班次的路牌,右边不变
  4219 + * @param leftSch
  4220 + * @param rightSch
  4221 + * @param type
  4222 + */
  4223 + public void lpChangeByLeft(ScheduleRealInfo leftSch, ScheduleRealInfo rightSch, int type) {
  4224 + LpData rightData = new LpData(rightSch);
3652 4225  
3653   - dayOfSchedule.addNbbm2SchMapp(leftSch, rightData.getNbbm());
3654   - dayOfSchedule.addNbbm2SchMapp(rightSch, leftData.getNbbm());
  4226 + rightData.appendTo(leftSch, type);
  4227 +
  4228 + if(type > 0){
  4229 + //更新车辆和班次映射信息
  4230 + dayOfSchedule.addNbbm2SchMapp(leftSch, rightData.getNbbm());
  4231 + }
3655 4232 }
3656 4233  
3657 4234 @Override
... ...
src/main/java/com/bsth/service/schedule/rules/plan/PlanResult.java
1   -package com.bsth.service.schedule.rules.plan;
2   -
3   -import com.bsth.entity.schedule.SchedulePlanInfo;
4   -
5   -import java.util.ArrayList;
6   -import java.util.List;
7   -
8   -/**
9   - * 计划输出。
10   - */
11   -public class PlanResult {
12   - private List<SchedulePlanInfo> schedulePlanInfos = new ArrayList<>();
13   -
14   - public PlanResult() {
15   - }
16   -
17   - public void add(SchedulePlanInfo schedulePlanInfo) {
18   - schedulePlanInfos.add(schedulePlanInfo);
19   - }
20   -
21   - public List<SchedulePlanInfo> getSchedulePlanInfos() {
22   - return schedulePlanInfos;
23   - }
24   -
25   - public void setSchedulePlanInfos(List<SchedulePlanInfo> schedulePlanInfos) {
26   - this.schedulePlanInfos = schedulePlanInfos;
27   - }
28   -}
  1 +package com.bsth.service.schedule.rules.plan;
  2 +
  3 +import com.bsth.entity.schedule.SchedulePlanInfo;
  4 +
  5 +import java.util.ArrayList;
  6 +import java.util.List;
  7 +
  8 +/**
  9 + * 计划输出。
  10 + */
  11 +public class PlanResult {
  12 + private List<SchedulePlanInfo> schedulePlanInfos = new ArrayList<>();
  13 +
  14 + public PlanResult() {
  15 + }
  16 +
  17 + public void add(SchedulePlanInfo schedulePlanInfo) {
  18 + schedulePlanInfos.add(schedulePlanInfo);
  19 + }
  20 +
  21 + public List<SchedulePlanInfo> getSchedulePlanInfos() {
  22 + return schedulePlanInfos;
  23 + }
  24 +
  25 + public void setSchedulePlanInfos(List<SchedulePlanInfo> schedulePlanInfos) {
  26 + this.schedulePlanInfos = schedulePlanInfos;
  27 + }
  28 +}
... ...
src/main/java/com/bsth/service/schedule/rules/plan/readme.txt
1   -排班计划规则,构造计划明细输出
2   -1、使用shiftloop.drl和ttinfo.drl的输出作为输入,进行规则计算
  1 +排班计划规则,构造计划明细输出
  2 +1、使用shiftloop.drl和ttinfo.drl的输出作为输入,进行规则计算
3 3 2、计算后输出排班明细列表
4 4 \ No newline at end of file
... ...
src/main/java/com/bsth/util/Arith.java 0 → 100644
  1 +package com.bsth.util;
  2 +
  3 +import java.math.BigDecimal;
  4 +
  5 +public class Arith {
  6 + /**
  7 + * 由于Java的简单类型不能够精确的对浮点数进行运算,这个工具类提供精
  8 + * 确的浮点数运算,包括加减乘除和四舍五入。
  9 + */
  10 + //默认除法运算精度
  11 + private static final int DEF_DIV_SCALE = 10;
  12 +
  13 + //这个类不能实例化
  14 + private Arith(){
  15 + }
  16 +
  17 + /**
  18 + * 提供精确的加法运算。
  19 + * @param v1 被加数
  20 + * @param v2 加数
  21 + * @return 两个参数的和
  22 + */
  23 + public static double add(double v1,double v2){
  24 + BigDecimal b1 = new BigDecimal(Double.toString(v1));
  25 + BigDecimal b2 = new BigDecimal(Double.toString(v2));
  26 + return b1.add(b2).doubleValue();
  27 + }
  28 +
  29 + /**
  30 + * 提供精确的减法运算。
  31 + * @param v1 被减数
  32 + * @param v2 减数
  33 + * @return 两个参数的差
  34 + */
  35 + public static double sub(double v1,double v2){
  36 + BigDecimal b1 = new BigDecimal(Double.toString(v1));
  37 + BigDecimal b2 = new BigDecimal(Double.toString(v2));
  38 + return b1.subtract(b2).doubleValue();
  39 + }
  40 +
  41 + /**
  42 + * 提供精确的乘法运算。
  43 + * @param v1 被乘数
  44 + * @param v2 乘数
  45 + * @return 两个参数的积
  46 + */
  47 + public static double mul(double v1,double v2){
  48 + BigDecimal b1 = new BigDecimal(Double.toString(v1));
  49 + BigDecimal b2 = new BigDecimal(Double.toString(v2));
  50 + return b1.multiply(b2).doubleValue();
  51 + }
  52 +
  53 + /**
  54 + * 提供(相对)精确的除法运算,当发生除不尽的情况时,精确到
  55 + * 小数点以后10位,以后的数字四舍五入。
  56 + * @param v1 被除数
  57 + * @param v2 除数
  58 + * @return 两个参数的商
  59 + */
  60 + public static double div(double v1,double v2){
  61 + return div(v1,v2,DEF_DIV_SCALE);
  62 + }
  63 +
  64 + /**
  65 + * 提供(相对)精确的除法运算。当发生除不尽的情况时,由scale参数指
  66 + * 定精度,以后的数字四舍五入。
  67 + * @param v1 被除数
  68 + * @param v2 除数
  69 + * @param scale 表示表示需要精确到小数点以后几位。
  70 + * @return 两个参数的商
  71 + */
  72 + public static double div(double v1,double v2,int scale){
  73 + if(scale<0){
  74 + throw new IllegalArgumentException(
  75 + "The scale must be a positive integer or zero");
  76 + }
  77 + BigDecimal b1 = new BigDecimal(Double.toString(v1));
  78 + BigDecimal b2 = new BigDecimal(Double.toString(v2));
  79 + return b1.divide(b2,scale,BigDecimal.ROUND_HALF_UP).doubleValue();
  80 + }
  81 +
  82 + /**
  83 + * 提供精确的小数位四舍五入处理。
  84 + * @param v 需要四舍五入的数字
  85 + * @param scale 小数点后保留几位
  86 + * @return 四舍五入后的结果
  87 + */
  88 + public static double round(double v,int scale){
  89 + if(scale<0){
  90 + throw new IllegalArgumentException(
  91 + "The scale must be a positive integer or zero");
  92 + }
  93 + BigDecimal b = new BigDecimal(Double.toString(v));
  94 + BigDecimal one = new BigDecimal("1");
  95 + return b.divide(one,scale,BigDecimal.ROUND_HALF_UP).doubleValue();
  96 + }
  97 +
  98 + /**
  99 + * 提供精确的类型转换(Float)
  100 + * @param v 需要被转换的数字
  101 + * @return 返回转换结果
  102 + */
  103 + public static float convertsToFloat(double v){
  104 + BigDecimal b = new BigDecimal(v);
  105 + return b.floatValue();
  106 + }
  107 +
  108 + /**
  109 + * 提供精确的类型转换(Int)不进行四舍五入
  110 + * @param v 需要被转换的数字
  111 + * @return 返回转换结果
  112 + */
  113 + public static int convertsToInt(double v){
  114 + BigDecimal b = new BigDecimal(v);
  115 + return b.intValue();
  116 + }
  117 +
  118 + /**
  119 + * 提供精确的类型转换(Long)
  120 + * @param v 需要被转换的数字
  121 + * @return 返回转换结果
  122 + */
  123 + public static long convertsToLong(double v){
  124 + BigDecimal b = new BigDecimal(v);
  125 + return b.longValue();
  126 + }
  127 +
  128 + /**
  129 + * 返回两个数中大的一个值
  130 + * @param v1 需要被对比的第一个数
  131 + * @param v2 需要被对比的第二个数
  132 + * @return 返回两个数中大的一个值
  133 + */
  134 + public static double returnMax(double v1,double v2){
  135 + BigDecimal b1 = new BigDecimal(v1);
  136 + BigDecimal b2 = new BigDecimal(v2);
  137 + return b1.max(b2).doubleValue();
  138 + }
  139 +
  140 + /**
  141 + * 返回两个数中小的一个值
  142 + * @param v1 需要被对比的第一个数
  143 + * @param v2 需要被对比的第二个数
  144 + * @return 返回两个数中小的一个值
  145 + */
  146 + public static double returnMin(double v1,double v2){
  147 + BigDecimal b1 = new BigDecimal(v1);
  148 + BigDecimal b2 = new BigDecimal(v2);
  149 + return b1.min(b2).doubleValue();
  150 + }
  151 +
  152 + /**
  153 + * 精确对比两个数字
  154 + * @param v1 需要被对比的第一个数
  155 + * @param v2 需要被对比的第二个数
  156 + * @return 如果两个数一样则返回0,如果第一个数比第二个数大则返回1,反之返回-1
  157 + */
  158 + public static int compareTo(double v1,double v2){
  159 + BigDecimal b1 = new BigDecimal(v1);
  160 + BigDecimal b2 = new BigDecimal(v2);
  161 + return b1.compareTo(b2);
  162 + }
  163 +}
... ...
src/main/resources/rules/plan.drl
... ... @@ -356,3 +356,4 @@ end
356 356  
357 357  
358 358  
  359 +
... ...
src/main/resources/rules/shiftloop_fb.drl
1   -package com.bsth.service.schedule.shiftloop;
2   -
3   -import org.joda.time.*;
4   -import java.util.*;
5   -
6   -import com.bsth.service.schedule.rules.shiftloop.ScheduleCalcuParam_input;
7   -import com.bsth.service.schedule.rules.shiftloop.ScheduleRule_input;
8   -import com.bsth.service.schedule.rules.shiftloop.ScheduleResult_output;
9   -import com.bsth.service.schedule.rules.shiftloop.ScheduleResults_output;
10   -
11   -import org.slf4j.Logger;
12   -
13   -global Logger log;
14   -
15   -/*
16   - 存在(翻班格式)
17   -*/
18   -
19   -//------------------------- 第一阶段、计算规则准备数据(天数) ----------------------------//
20   -
21   -declare Calcu_days_result
22   - ruleId : String // 规则Id
23   - qyrq_days : Integer // 开始日期离启用日期的天数
24   - sdays : Integer // 总共需要排班的天数
25   - calcu_start_date : DateTime // 开始计算日期
26   - calcu_end_date : DateTime // 结束计算日期
27   -end
28   -
29   -/*
30   - 计算启用日期,开始计算日期,结束计算日期,相差天数
31   - 1、规则启用日期小于开始计算日期
32   - 2、规则启用日期大于等于开始日期,小于等于结束日期
33   -*/
34   -rule "calcu_days_1"
35   - salience 100
36   - when
37   - ScheduleCalcuParam_input(
38   - fromDate.isBefore(toDate) || fromDate.isEqual(toDate),
39   - $fromDate : fromDate,
40   - $toDate : toDate
41   - )
42   - ScheduleRule_input($ruleId : ruleId, $qyrq : qyrq)
43   - eval($qyrq.isBefore($fromDate))
44   - then
45   - // 构造Calcu_days_result对象,进行下一阶段计算
46   - Calcu_days_result cdr = new Calcu_days_result();
47   - cdr.setRuleId($ruleId);
48   - Period p1 = new Period($qyrq, $fromDate, PeriodType.days());
49   - cdr.setQyrq_days(p1.getDays());
50   - Period p2 = new Period($fromDate, $toDate, PeriodType.days());
51   - cdr.setSdays(p2.getDays() + 1);
52   - cdr.setCalcu_start_date($fromDate);
53   - cdr.setCalcu_end_date($toDate);
54   -
55   - log.info("开始日期离启用日期的天数 qyrq_days={}", p1.getDays());
56   - log.info("总共需要排班的天数 sdays={}", (p2.getDays() + 1));
57   -
58   - insert(cdr); // 插入fact数据,进入下一个阶段
59   -end
60   -
61   -rule "calcu_days_2"
62   - salience 100
63   - when
64   - ScheduleCalcuParam_input(
65   - fromDate.isBefore(toDate) || fromDate.isEqual(toDate),
66   - $fromDate : fromDate,
67   - $toDate : toDate
68   - )
69   - ScheduleRule_input($ruleId : ruleId, $qyrq : qyrq)
70   - eval((!$qyrq.isBefore($fromDate)) && (!$qyrq.isAfter($toDate)))
71   - then
72   - // 构造Calcu_days_result对象,进行下一阶段计算
73   - Calcu_days_result cdr = new Calcu_days_result();
74   - cdr.setRuleId($ruleId);
75   - cdr.setQyrq_days(0);
76   - Period p2 = new Period($qyrq, $toDate, PeriodType.days());
77   - cdr.setSdays(Integer.valueOf(p2.getDays() + 1));
78   - cdr.setCalcu_start_date($qyrq);
79   - cdr.setCalcu_end_date($toDate);
80   -
81   - log.info("开始日期离启用日期的天数 qyrq_days=0");
82   - log.info("总共需要排班的天数 sdays={}", (p2.getDays() + 1));
83   -
84   - insert(cdr); // 插入fact数据,进入下一个阶段
85   -end
86   -
87   -//------------------------- 第二阶段、计算规则准备数据2(起始索引) ----------------------------//
88   -
89   -//----------------------- 路牌范围循环计算 ------------------------//
90   -
91   -declare Calcu_guideboard_index_result
92   - ruleId : String // 规则Id
93   - calcu_index : Integer // 计算之后的起始索引
94   -end
95   -
96   -// 启用日期等于开始日期
97   -rule "calcu_guideboard_index_qyrq_eq_startrq"
98   - when
99   - $calcu_days_result : Calcu_days_result(
100   - qyrq_days == 0,
101   - $ruleId: ruleId
102   - )
103   - $scheduleRule_input : ScheduleRule_input(
104   - ruleId == $ruleId,
105   - $oindex : startGbdIndex
106   - )
107   - then
108   - Calcu_guideboard_index_result cgir = new Calcu_guideboard_index_result();
109   - cgir.setRuleId($ruleId);
110   - cgir.setCalcu_index($oindex);
111   -
112   - log.info("calcu_guideboard_index_qyrq_eq_startrq ruleId={}, calcu_index={}", $ruleId, cgir.getCalcu_index());
113   -
114   - insert(cgir);
115   -end
116   -
117   -// 开始日期大于启用日期
118   -rule "calcu_guideboard_index_startrq_gt_qyrq"
119   - when
120   - $calcu_days_result : Calcu_days_result(
121   - qyrq_days > 0,
122   - $ruleId: ruleId, $qyrq_days: qyrq_days,
123   - $calcu_start_date: calcu_start_date
124   - )
125   - $scheduleRule_input : ScheduleRule_input(
126   - ruleId == $ruleId,
127   - $qyrq: qyrq,
128   - $rangesize : guideboardIds.size(),
129   - $oindex : startGbdIndex,
130   - $weekdays: weekdays
131   - )
132   - then
133   - // 开始时间
134   - DateTime initDate = $qyrq;
135   - int index = $oindex;
136   - int resultIndex = index;
137   -
138   - while (!initDate.isAfter($calcu_start_date)) {
139   - if (((Boolean) $weekdays.get(initDate.getDayOfWeek() - 1)).booleanValue()) {
140   - resultIndex = index;
141   - index = (index + 1) % $rangesize;
142   - }
143   - initDate = initDate.plusDays(1);
144   - }
145   -
146   - Calcu_guideboard_index_result cgir = new Calcu_guideboard_index_result();
147   - cgir.setRuleId($ruleId);
148   - cgir.setCalcu_index(resultIndex);
149   -
150   - log.info("calcu_guideboard_index_startrq_gt_qyrq ruleId={}, calcu_index={}", $ruleId, cgir.getCalcu_index());
151   -
152   - insert(cgir);
153   -end
154   -
155   -//----------------------- 人员范围循环计算 ------------------------//
156   -
157   -declare Calcu_employee_index_result
158   - ruleId : String // 规则Id
159   - calcu_index : Integer // 计算之后的起始索引
160   -end
161   -
162   -// 启用日期等于开始日期
163   -rule "calcu_employee_index_qyrq_eq_startrq"
164   - when
165   - $calcu_days_result : Calcu_days_result(
166   - qyrq_days == 0,
167   - $ruleId: ruleId)
168   - $scheduleRule_input : ScheduleRule_input(
169   - ruleId == $ruleId,
170   - $oindex : startEIndex)
171   - then
172   - Calcu_employee_index_result cgir = new Calcu_employee_index_result();
173   - cgir.setRuleId($ruleId);
174   - cgir.setCalcu_index($oindex);
175   -
176   - log.info("calcu_employee_index_qyrq_eq_startrq ruleId={}, calcu_index={}", $ruleId, cgir.getCalcu_index());
177   -
178   - insert(cgir);
179   -end
180   -
181   -// 开始日期大于启用日期
182   -rule "calcu_employee_index_startrq_gt_qyrq"
183   - when
184   - $calcu_days_result : Calcu_days_result(
185   - qyrq_days > 0,
186   - $ruleId: ruleId, $qyrq_days: qyrq_days,
187   - $calcu_start_date: calcu_start_date
188   - )
189   - $scheduleRule_input : ScheduleRule_input(
190   - ruleId == $ruleId,
191   - $qyrq: qyrq,
192   - $rangesize : employeeConfigIds.size(),
193   - $oindex : startEIndex,
194   - $weekdays: weekdays
195   - )
196   - then
197   - // 开始时间
198   - DateTime initDate = $qyrq;
199   - int index = $oindex;
200   - int resultIndex = index;
201   -
202   - while (!initDate.isAfter($calcu_start_date)) {
203   - if (((Boolean) $weekdays.get(initDate.getDayOfWeek() - 1)).booleanValue()) {
204   - resultIndex = index;
205   - index = (index + 1) % $rangesize;
206   - }
207   - initDate = initDate.plusDays(1);
208   - }
209   -
210   - Calcu_employee_index_result cgir = new Calcu_employee_index_result();
211   - cgir.setRuleId($ruleId);
212   - cgir.setCalcu_index(resultIndex);
213   -
214   - log.info("calcu_employee_index_startrq_gt_qyrq ruleId={}, calcu_index={}", $ruleId, cgir.getCalcu_index());
215   -
216   - insert(cgir);
217   -
218   -end
219   -
220   -//------------------------- 第三阶段、循环计算 ------------------------//
221   -
222   -//----------------------- 路牌范围循环计算 ------------------------//
223   -declare loop_guideboard_result
224   - ruleId : String // 规则id
225   - go_list : List // 路牌循环的列表
226   -end
227   -
228   -// 循环路牌计算
229   -rule "Calcu_loop_guideboard_result"
230   - when
231   - Calcu_days_result(
232   - $ruleId: ruleId,
233   - $startDate : calcu_start_date,
234   - $calcu_end_date: calcu_end_date
235   - )
236   - $ruleData : ScheduleRule_input(
237   - ruleId == $ruleId,
238   - $rangesize : guideboardIds.size(),
239   - $weekdays: weekdays
240   - )
241   - $indexData : Calcu_guideboard_index_result(
242   - ruleId == $ruleId
243   - )
244   - then
245   - DateTime initDate = $startDate; // 开始时间
246   - DateTime endDate = $calcu_end_date; // 结束实际
247   - List<ScheduleResult_output> scheduleResult_outputs =
248   - new ArrayList<ScheduleResult_output>();
249   -
250   - int i = $indexData.getCalcu_index();
251   - if (((Boolean) $weekdays.get(initDate.getDayOfWeek() - 1)).booleanValue() == false) {
252   - i = (i + 1) % $rangesize;
253   - }
254   -
255   - while (!initDate.isAfter(endDate)) {
256   - if (((Boolean) $weekdays.get(initDate.getDayOfWeek() - 1)).booleanValue()) {
257   - ScheduleResult_output ro = new ScheduleResult_output();
258   - ro.setRuleId($ruleId);
259   - ro.setSd(initDate);
260   - ro.setGuideboardId($ruleData.getGuideboardIds().get(i));
261   - ro.setCarConfigId($ruleData.getCarConfigId());
262   - scheduleResult_outputs.add(ro);
263   -
264   - i = (i + 1) % $rangesize;
265   - }
266   -
267   - initDate = initDate.plusDays(1);
268   - }
269   -
270   - loop_guideboard_result clgr = new loop_guideboard_result();
271   - clgr.setRuleId($ruleId);
272   - clgr.setGo_list(scheduleResult_outputs);
273   -
274   - log.info(String.valueOf(scheduleResult_outputs.size()));
275   -
276   - insert(clgr);
277   -
278   -end
279   -
280   -//----------------------- 人员范围循环计算 ------------------------//
281   -declare loop_employee_result
282   - ruleId : String // 规则id
283   - eo_list : List // 人员循环的列表
284   -end
285   -
286   -// 循环人员计算
287   -rule "Calcu_loop_employee_result"
288   - when
289   - Calcu_days_result(
290   - $ruleId: ruleId,
291   - $startDate : calcu_start_date,
292   - $calcu_end_date: calcu_end_date
293   - )
294   - $ruleData : ScheduleRule_input(
295   - ruleId == $ruleId,
296   - $rangesize : employeeConfigIds.size(),
297   - $weekdays: weekdays
298   - )
299   - $indexData : Calcu_employee_index_result(
300   - ruleId == $ruleId
301   - )
302   - then
303   - DateTime initDate = $startDate; // 开始时间
304   - DateTime endDate = $calcu_end_date; // 结束实际
305   - List<ScheduleResult_output> scheduleResult_outputs =
306   - new ArrayList<ScheduleResult_output>();
307   -
308   - int i = $indexData.getCalcu_index();
309   - if (((Boolean) $weekdays.get(initDate.getDayOfWeek() - 1)).booleanValue() == false) {
310   - i = (i + 1) % $rangesize;
311   - }
312   -
313   - while (!initDate.isAfter(endDate)) {
314   - if (((Boolean) $weekdays.get(initDate.getDayOfWeek() - 1)).booleanValue()) {
315   - ScheduleResult_output ro = new ScheduleResult_output();
316   - ro.setRuleId($ruleId);
317   - ro.setSd(initDate);
318   - ro.setEmployeeConfigId($ruleData.getEmployeeConfigIds().get(i));
319   - ro.setCarConfigId($ruleData.getCarConfigId());
320   - scheduleResult_outputs.add(ro);
321   -
322   - i = (i + 1) % $rangesize;
323   - }
324   -
325   - initDate = initDate.plusDays(1);
326   - }
327   -
328   - loop_employee_result clgr = new loop_employee_result();
329   - clgr.setRuleId($ruleId);
330   - clgr.setEo_list(scheduleResult_outputs);
331   -
332   - log.info(String.valueOf(scheduleResult_outputs.size()));
333   -
334   - insert(clgr);
335   -end
336   -
337   -//------------------------- 第四阶段、范围组循环计算 ----------------------------//
338   -
339   -global ScheduleResults_output scheduleResult;
340   -
341   -rule "output"
342   - when
343   - loop_guideboard_result(
344   - go_list.size() > 0,
345   - $ruleId : ruleId, $go_list : go_list
346   - )
347   - loop_employee_result(
348   - ruleId == $ruleId,
349   - eo_list.size() == $go_list.size(),
350   - $eo_list : eo_list
351   - )
352   - then
353   - for (int i = 0; i < $go_list.size(); i++) {
354   - ScheduleResult_output go = (ScheduleResult_output) $go_list.get(i);
355   - ScheduleResult_output eo = (ScheduleResult_output) $eo_list.get(i);
356   - go.setEmployeeConfigId(eo.getEmployeeConfigId());
357   - scheduleResult.getResults().add(go);
358   - }
359   -
360   -end
361   -
362   -
363   -
364   -
365   -
366   -
367   -
368   -
369   -
370   -
371   -
372   -
373   -
374   -
375   -
376   -
  1 +package com.bsth.service.schedule.shiftloop;
  2 +
  3 +import org.joda.time.*;
  4 +import java.util.*;
  5 +
  6 +import com.bsth.service.schedule.rules.shiftloop.ScheduleCalcuParam_input;
  7 +import com.bsth.service.schedule.rules.shiftloop.ScheduleRule_input;
  8 +import com.bsth.service.schedule.rules.shiftloop.ScheduleResult_output;
  9 +import com.bsth.service.schedule.rules.shiftloop.ScheduleResults_output;
  10 +
  11 +import org.slf4j.Logger;
  12 +
  13 +global Logger log;
  14 +
  15 +/*
  16 + 存在(翻班格式)
  17 +*/
  18 +
  19 +//------------------------- 第一阶段、计算规则准备数据(天数) ----------------------------//
  20 +
  21 +declare Calcu_days_result
  22 + ruleId : String // 规则Id
  23 + qyrq_days : Integer // 开始日期离启用日期的天数
  24 + sdays : Integer // 总共需要排班的天数
  25 + calcu_start_date : DateTime // 开始计算日期
  26 + calcu_end_date : DateTime // 结束计算日期
  27 +end
  28 +
  29 +/*
  30 + 计算启用日期,开始计算日期,结束计算日期,相差天数
  31 + 1、规则启用日期小于开始计算日期
  32 + 2、规则启用日期大于等于开始日期,小于等于结束日期
  33 +*/
  34 +rule "calcu_days_1"
  35 + salience 100
  36 + when
  37 + ScheduleCalcuParam_input(
  38 + fromDate.isBefore(toDate) || fromDate.isEqual(toDate),
  39 + $fromDate : fromDate,
  40 + $toDate : toDate
  41 + )
  42 + ScheduleRule_input($ruleId : ruleId, $qyrq : qyrq)
  43 + eval($qyrq.isBefore($fromDate))
  44 + then
  45 + // 构造Calcu_days_result对象,进行下一阶段计算
  46 + Calcu_days_result cdr = new Calcu_days_result();
  47 + cdr.setRuleId($ruleId);
  48 + Period p1 = new Period($qyrq, $fromDate, PeriodType.days());
  49 + cdr.setQyrq_days(p1.getDays());
  50 + Period p2 = new Period($fromDate, $toDate, PeriodType.days());
  51 + cdr.setSdays(p2.getDays() + 1);
  52 + cdr.setCalcu_start_date($fromDate);
  53 + cdr.setCalcu_end_date($toDate);
  54 +
  55 + log.info("开始日期离启用日期的天数 qyrq_days={}", p1.getDays());
  56 + log.info("总共需要排班的天数 sdays={}", (p2.getDays() + 1));
  57 +
  58 + insert(cdr); // 插入fact数据,进入下一个阶段
  59 +end
  60 +
  61 +rule "calcu_days_2"
  62 + salience 100
  63 + when
  64 + ScheduleCalcuParam_input(
  65 + fromDate.isBefore(toDate) || fromDate.isEqual(toDate),
  66 + $fromDate : fromDate,
  67 + $toDate : toDate
  68 + )
  69 + ScheduleRule_input($ruleId : ruleId, $qyrq : qyrq)
  70 + eval((!$qyrq.isBefore($fromDate)) && (!$qyrq.isAfter($toDate)))
  71 + then
  72 + // 构造Calcu_days_result对象,进行下一阶段计算
  73 + Calcu_days_result cdr = new Calcu_days_result();
  74 + cdr.setRuleId($ruleId);
  75 + cdr.setQyrq_days(0);
  76 + Period p2 = new Period($qyrq, $toDate, PeriodType.days());
  77 + cdr.setSdays(Integer.valueOf(p2.getDays() + 1));
  78 + cdr.setCalcu_start_date($qyrq);
  79 + cdr.setCalcu_end_date($toDate);
  80 +
  81 + log.info("开始日期离启用日期的天数 qyrq_days=0");
  82 + log.info("总共需要排班的天数 sdays={}", (p2.getDays() + 1));
  83 +
  84 + insert(cdr); // 插入fact数据,进入下一个阶段
  85 +end
  86 +
  87 +//------------------------- 第二阶段、计算规则准备数据2(起始索引) ----------------------------//
  88 +
  89 +//----------------------- 路牌范围循环计算 ------------------------//
  90 +
  91 +declare Calcu_guideboard_index_result
  92 + ruleId : String // 规则Id
  93 + calcu_index : Integer // 计算之后的起始索引
  94 +end
  95 +
  96 +// 启用日期等于开始日期
  97 +rule "calcu_guideboard_index_qyrq_eq_startrq"
  98 + when
  99 + $calcu_days_result : Calcu_days_result(
  100 + qyrq_days == 0,
  101 + $ruleId: ruleId
  102 + )
  103 + $scheduleRule_input : ScheduleRule_input(
  104 + ruleId == $ruleId,
  105 + $oindex : startGbdIndex
  106 + )
  107 + then
  108 + Calcu_guideboard_index_result cgir = new Calcu_guideboard_index_result();
  109 + cgir.setRuleId($ruleId);
  110 + cgir.setCalcu_index($oindex);
  111 +
  112 + log.info("calcu_guideboard_index_qyrq_eq_startrq ruleId={}, calcu_index={}", $ruleId, cgir.getCalcu_index());
  113 +
  114 + insert(cgir);
  115 +end
  116 +
  117 +// 开始日期大于启用日期
  118 +rule "calcu_guideboard_index_startrq_gt_qyrq"
  119 + when
  120 + $calcu_days_result : Calcu_days_result(
  121 + qyrq_days > 0,
  122 + $ruleId: ruleId, $qyrq_days: qyrq_days,
  123 + $calcu_start_date: calcu_start_date
  124 + )
  125 + $scheduleRule_input : ScheduleRule_input(
  126 + ruleId == $ruleId,
  127 + $qyrq: qyrq,
  128 + $rangesize : guideboardIds.size(),
  129 + $oindex : startGbdIndex,
  130 + $weekdays: weekdays
  131 + )
  132 + then
  133 + // 开始时间
  134 + DateTime initDate = $qyrq;
  135 + int index = $oindex;
  136 + int resultIndex = index;
  137 +
  138 + while (!initDate.isAfter($calcu_start_date)) {
  139 + if (((Boolean) $weekdays.get(initDate.getDayOfWeek() - 1)).booleanValue()) {
  140 + resultIndex = index;
  141 + index = (index + 1) % $rangesize;
  142 + }
  143 + initDate = initDate.plusDays(1);
  144 + }
  145 +
  146 + Calcu_guideboard_index_result cgir = new Calcu_guideboard_index_result();
  147 + cgir.setRuleId($ruleId);
  148 + cgir.setCalcu_index(resultIndex);
  149 +
  150 + log.info("calcu_guideboard_index_startrq_gt_qyrq ruleId={}, calcu_index={}", $ruleId, cgir.getCalcu_index());
  151 +
  152 + insert(cgir);
  153 +end
  154 +
  155 +//----------------------- 人员范围循环计算 ------------------------//
  156 +
  157 +declare Calcu_employee_index_result
  158 + ruleId : String // 规则Id
  159 + calcu_index : Integer // 计算之后的起始索引
  160 +end
  161 +
  162 +// 启用日期等于开始日期
  163 +rule "calcu_employee_index_qyrq_eq_startrq"
  164 + when
  165 + $calcu_days_result : Calcu_days_result(
  166 + qyrq_days == 0,
  167 + $ruleId: ruleId)
  168 + $scheduleRule_input : ScheduleRule_input(
  169 + ruleId == $ruleId,
  170 + $oindex : startEIndex)
  171 + then
  172 + Calcu_employee_index_result cgir = new Calcu_employee_index_result();
  173 + cgir.setRuleId($ruleId);
  174 + cgir.setCalcu_index($oindex);
  175 +
  176 + log.info("calcu_employee_index_qyrq_eq_startrq ruleId={}, calcu_index={}", $ruleId, cgir.getCalcu_index());
  177 +
  178 + insert(cgir);
  179 +end
  180 +
  181 +// 开始日期大于启用日期
  182 +rule "calcu_employee_index_startrq_gt_qyrq"
  183 + when
  184 + $calcu_days_result : Calcu_days_result(
  185 + qyrq_days > 0,
  186 + $ruleId: ruleId, $qyrq_days: qyrq_days,
  187 + $calcu_start_date: calcu_start_date
  188 + )
  189 + $scheduleRule_input : ScheduleRule_input(
  190 + ruleId == $ruleId,
  191 + $qyrq: qyrq,
  192 + $rangesize : employeeConfigIds.size(),
  193 + $oindex : startEIndex,
  194 + $weekdays: weekdays
  195 + )
  196 + then
  197 + // 开始时间
  198 + DateTime initDate = $qyrq;
  199 + int index = $oindex;
  200 + int resultIndex = index;
  201 +
  202 + while (!initDate.isAfter($calcu_start_date)) {
  203 + if (((Boolean) $weekdays.get(initDate.getDayOfWeek() - 1)).booleanValue()) {
  204 + resultIndex = index;
  205 + index = (index + 1) % $rangesize;
  206 + }
  207 + initDate = initDate.plusDays(1);
  208 + }
  209 +
  210 + Calcu_employee_index_result cgir = new Calcu_employee_index_result();
  211 + cgir.setRuleId($ruleId);
  212 + cgir.setCalcu_index(resultIndex);
  213 +
  214 + log.info("calcu_employee_index_startrq_gt_qyrq ruleId={}, calcu_index={}", $ruleId, cgir.getCalcu_index());
  215 +
  216 + insert(cgir);
  217 +
  218 +end
  219 +
  220 +//------------------------- 第三阶段、循环计算 ------------------------//
  221 +
  222 +//----------------------- 路牌范围循环计算 ------------------------//
  223 +declare loop_guideboard_result
  224 + ruleId : String // 规则id
  225 + go_list : List // 路牌循环的列表
  226 +end
  227 +
  228 +// 循环路牌计算
  229 +rule "Calcu_loop_guideboard_result"
  230 + when
  231 + Calcu_days_result(
  232 + $ruleId: ruleId,
  233 + $startDate : calcu_start_date,
  234 + $calcu_end_date: calcu_end_date
  235 + )
  236 + $ruleData : ScheduleRule_input(
  237 + ruleId == $ruleId,
  238 + $rangesize : guideboardIds.size(),
  239 + $weekdays: weekdays
  240 + )
  241 + $indexData : Calcu_guideboard_index_result(
  242 + ruleId == $ruleId
  243 + )
  244 + then
  245 + DateTime initDate = $startDate; // 开始时间
  246 + DateTime endDate = $calcu_end_date; // 结束实际
  247 + List<ScheduleResult_output> scheduleResult_outputs =
  248 + new ArrayList<ScheduleResult_output>();
  249 +
  250 + int i = $indexData.getCalcu_index();
  251 + if (((Boolean) $weekdays.get(initDate.getDayOfWeek() - 1)).booleanValue() == false) {
  252 + i = (i + 1) % $rangesize;
  253 + }
  254 +
  255 + while (!initDate.isAfter(endDate)) {
  256 + if (((Boolean) $weekdays.get(initDate.getDayOfWeek() - 1)).booleanValue()) {
  257 + ScheduleResult_output ro = new ScheduleResult_output();
  258 + ro.setRuleId($ruleId);
  259 + ro.setSd(initDate);
  260 + ro.setGuideboardId($ruleData.getGuideboardIds().get(i));
  261 + ro.setCarConfigId($ruleData.getCarConfigId());
  262 + scheduleResult_outputs.add(ro);
  263 +
  264 + i = (i + 1) % $rangesize;
  265 + }
  266 +
  267 + initDate = initDate.plusDays(1);
  268 + }
  269 +
  270 + loop_guideboard_result clgr = new loop_guideboard_result();
  271 + clgr.setRuleId($ruleId);
  272 + clgr.setGo_list(scheduleResult_outputs);
  273 +
  274 + log.info(String.valueOf(scheduleResult_outputs.size()));
  275 +
  276 + insert(clgr);
  277 +
  278 +end
  279 +
  280 +//----------------------- 人员范围循环计算 ------------------------//
  281 +declare loop_employee_result
  282 + ruleId : String // 规则id
  283 + eo_list : List // 人员循环的列表
  284 +end
  285 +
  286 +// 循环人员计算
  287 +rule "Calcu_loop_employee_result"
  288 + when
  289 + Calcu_days_result(
  290 + $ruleId: ruleId,
  291 + $startDate : calcu_start_date,
  292 + $calcu_end_date: calcu_end_date
  293 + )
  294 + $ruleData : ScheduleRule_input(
  295 + ruleId == $ruleId,
  296 + $rangesize : employeeConfigIds.size(),
  297 + $weekdays: weekdays
  298 + )
  299 + $indexData : Calcu_employee_index_result(
  300 + ruleId == $ruleId
  301 + )
  302 + then
  303 + DateTime initDate = $startDate; // 开始时间
  304 + DateTime endDate = $calcu_end_date; // 结束实际
  305 + List<ScheduleResult_output> scheduleResult_outputs =
  306 + new ArrayList<ScheduleResult_output>();
  307 +
  308 + int i = $indexData.getCalcu_index();
  309 + if (((Boolean) $weekdays.get(initDate.getDayOfWeek() - 1)).booleanValue() == false) {
  310 + i = (i + 1) % $rangesize;
  311 + }
  312 +
  313 + while (!initDate.isAfter(endDate)) {
  314 + if (((Boolean) $weekdays.get(initDate.getDayOfWeek() - 1)).booleanValue()) {
  315 + ScheduleResult_output ro = new ScheduleResult_output();
  316 + ro.setRuleId($ruleId);
  317 + ro.setSd(initDate);
  318 + ro.setEmployeeConfigId($ruleData.getEmployeeConfigIds().get(i));
  319 + ro.setCarConfigId($ruleData.getCarConfigId());
  320 + scheduleResult_outputs.add(ro);
  321 +
  322 + i = (i + 1) % $rangesize;
  323 + }
  324 +
  325 + initDate = initDate.plusDays(1);
  326 + }
  327 +
  328 + loop_employee_result clgr = new loop_employee_result();
  329 + clgr.setRuleId($ruleId);
  330 + clgr.setEo_list(scheduleResult_outputs);
  331 +
  332 + log.info(String.valueOf(scheduleResult_outputs.size()));
  333 +
  334 + insert(clgr);
  335 +end
  336 +
  337 +//------------------------- 第四阶段、范围组循环计算 ----------------------------//
  338 +
  339 +global ScheduleResults_output scheduleResult;
  340 +
  341 +rule "output"
  342 + when
  343 + loop_guideboard_result(
  344 + go_list.size() > 0,
  345 + $ruleId : ruleId, $go_list : go_list
  346 + )
  347 + loop_employee_result(
  348 + ruleId == $ruleId,
  349 + eo_list.size() == $go_list.size(),
  350 + $eo_list : eo_list
  351 + )
  352 + then
  353 + for (int i = 0; i < $go_list.size(); i++) {
  354 + ScheduleResult_output go = (ScheduleResult_output) $go_list.get(i);
  355 + ScheduleResult_output eo = (ScheduleResult_output) $eo_list.get(i);
  356 + go.setEmployeeConfigId(eo.getEmployeeConfigId());
  357 + scheduleResult.getResults().add(go);
  358 + }
  359 +
  360 +end
  361 +
  362 +
  363 +
  364 +
  365 +
  366 +
  367 +
  368 +
  369 +
  370 +
  371 +
  372 +
  373 +
  374 +
  375 +
  376 +
... ...
src/main/resources/static/pages/forms/statement/scheduleDaily.html
... ... @@ -37,7 +37,7 @@
37 37 </div>
38 38 <div class="form-group">
39 39 <input class="btn btn-default" type="button" id="query" value="查询"/>
40   - <input class="btn btn-default" type="button" id="month" value="按月查询"/>
  40 +<!-- <input class="btn btn-default" type="button" id="month" value="按月查询"/> -->
41 41 <input class="btn btn-default" type="button" id="export" value="导出"/>
42 42 </div>
43 43 </form>
... ... @@ -345,7 +345,7 @@
345 345 });
346 346  
347 347 //按月查询
348   - $("#month").on('click',function(){
  348 + /* $("#month").on('click',function(){
349 349 line = $("#line").val();
350 350 xlName = $("#select2-line-container").html();
351 351 date = $("#date").val();
... ... @@ -363,7 +363,7 @@
363 363 $('#forms .scheduleDaily_2').html("");
364 364 $('#forms .scheduleDaily_3').html("");
365 365  
366   - });
  366 + }); */
367 367  
368 368 $("#export").on("click",function(){
369 369 var params = {};
... ...
src/main/resources/static/pages/forms/statement/statisticsDaily.html
... ... @@ -32,9 +32,13 @@
32 32 <select class="form-control" name="line" id="line" style="width: 180px;"></select>
33 33 </div>
34 34 <div style="display: inline-block;margin-left: 15px;">
35   - <span class="item-label" style="width: 80px;">时间: </span>
  35 + <span class="item-label" style="width: 80px;">开始时间: </span>
36 36 <input class="form-control" type="text" id="date" style="width: 180px;"/>
37 37 </div>
  38 + <div style="display: inline-block;margin-left: 15px;">
  39 + <span class="item-label" style="width: 80px;">结束时间: </span>
  40 + <input class="form-control" type="text" id="date2" style="width: 180px;"/>
  41 + </div>
38 42 <div class="form-group">
39 43 <input class="btn btn-default" type="button" id="query" value="查询"/>
40 44 <input class="btn btn-default" type="button" id="export" value="导出"/>
... ... @@ -124,6 +128,22 @@
124 128 format : 'YYYY-MM-DD',
125 129 locale : 'zh-cn'
126 130 });
  131 +
  132 + $("#date2").datetimepicker({
  133 + format : 'YYYY-MM-DD',
  134 + locale : 'zh-cn'
  135 + });
  136 + var d = new Date();
  137 + var year = d.getFullYear();
  138 + var month = d.getMonth() + 1;
  139 + var day = d.getDate();
  140 + if(month < 10)
  141 + month = "0" + month;
  142 + if(day < 10)
  143 + day = "0" + day;
  144 + $("#date").val(year + "-" + month + "-" + day);
  145 +
  146 + $("#date2").val(year + "-" + month + "-" + day);
127 147 $.get('/basic/lineCode2Name',function(result){
128 148 var data=[];
129 149  
... ... @@ -139,24 +159,31 @@
139 159 var line ="";
140 160 var xlName ="";
141 161 var date = "";
  162 + var date2 ="";
142 163 $("#query").on("click",function(){
143 164 line = $("#line").val();
144 165 xlName = $("#select2-line-container").html();
145 166 date = $("#date").val();
  167 + date2 =$("#date2").val();
146 168 if(line=="请选择"){
147 169 line="";
148 170 }
149   - $get('/realSchedule/statisticsDaily',{line:line,date:date,xlName:xlName,type:"query"},function(result){
150   - // 把数据填充到模版中
151   - var tbodyHtml = template('statisticsDaily',{list:result});
152   - // 把渲染好的模版html文本追加到表格中
153   - $('#forms .statisticsDaily').html(tbodyHtml);
154   -
155   - if(result.length == 0)
156   - $("#export").attr('disabled',"true");
157   - else
158   - $("#export").removeAttr("disabled");
159   - });
  171 + if(date==null || date =="" ||date2==null || date2 ==""){
  172 + layer.msg('请选择时间段.');
  173 + }else{
  174 + $get('/realSchedule/statisticsDailyTj',{line:line,date:date,date2:date2,xlName:xlName,type:"query"},function(result){
  175 + // 把数据填充到模版中
  176 + var tbodyHtml = template('statisticsDaily',{list:result});
  177 + // 把渲染好的模版html文本追加到表格中
  178 + $('#forms .statisticsDaily').html(tbodyHtml);
  179 +
  180 + if(result.length == 0)
  181 + $("#export").attr('disabled',"true");
  182 + else
  183 + $("#export").removeAttr("disabled");
  184 + });
  185 + }
  186 +
160 187 });
161 188  
162 189 $("#export").on("click",function(){
... ...
src/main/resources/static/pages/forms/statement/waybill.html
... ... @@ -238,13 +238,13 @@
238 238 // 把渲染好的模版html文本追加到表格中
239 239 $('#forms .ludan_1').html(ludan_1);
240 240 });
241   - $post('/realSchedule/queryListWaybill',{jName:jName,clZbh:params[1],lpName:params[2],date:date,line:line},function(result){
  241 + $get('/realSchedule/queryListWaybill',{jName:jName,clZbh:params[1],lpName:params[2],date:date,line:line},function(result){
242 242 getTime(result);
243 243 var ludan_2 = template('ludan_2',{list:result});
244 244 // 把渲染好的模版html文本追加到表格中
245 245 $('#forms .ludan_2').html(ludan_2);
246 246 });
247   - $post('/realSchedule/findKMBC',{jName:jName,clZbh:params[1],lpName:params[2],date:date,line:line},function(result){
  247 + $get('/realSchedule/findKMBC',{jName:jName,clZbh:params[1],lpName:params[2],date:date,line:line},function(result){
248 248 var ludan_3 = template('ludan_3',result);
249 249 $('#forms .ludan_3').html(ludan_3);
250 250 });
... ... @@ -254,7 +254,7 @@
254 254 if(params.length < 1){
255 255 return;
256 256 }
257   - $post('/realSchedule/exportWaybill',{jName:jName,clZbh:params[1],lpName:params[2],date:date,line:line},function(result){
  257 + $get('/realSchedule/exportWaybill',{jName:jName,clZbh:params[1],lpName:params[2],date:date,line:line},function(result){
258 258 window.open("/downloadFile/download?fileName="+date+"-"+jName+"-"+params[1]+"-"+params[2]+"-行车路单");
259 259 });
260 260 });
... ...
src/main/resources/static/pages/forms/statement/waybillQp.html
... ... @@ -181,13 +181,13 @@
181 181 $('#forms .ludan_1').html(ludan_1);
182 182 //$('#forms .ludan_4').html(ludan_4);
183 183 });
184   - $post('/realSchedule/queryListWaybillQp',{clZbh:params[0],date:date,line:line},function(result){
  184 + $get('/realSchedule/queryListWaybillQp',{clZbh:params[0],date:date,line:line},function(result){
185 185 getTime(result);
186 186 var ludan_2 = template('ludan_2',{list:result});
187 187 // 把渲染好的模版html文本追加到表格中
188 188 $('#forms .ludan_2').html(ludan_2);
189 189 });
190   - $post('/realSchedule/findKMBCQp',{clZbh:params[0],date:date,line:line},function(result){
  190 + $get('/realSchedule/findKMBCQp',{clZbh:params[0],date:date,line:line},function(result){
191 191 console.log(result);
192 192 var ludan_3 = template('ludan_3',{map:result});
193 193 $('#forms .ludan_3').html(ludan_3);
... ... @@ -199,7 +199,7 @@
199 199 if(params.length < 1){
200 200 return;
201 201 }
202   - $post('/realSchedule/exportWaybillQp',{clZbh:params[0],date:date,line:line},function(result){
  202 + $get('/realSchedule/exportWaybillQp',{clZbh:params[0],date:date,line:line},function(result){
203 203 var fileName=date+"-"+params[0]+"-行车路单"
204 204 window.open("/downloadFile/download?fileName="+fileName);
205 205 // window.open("/downloadFile/download?fileName="+encodeURIComponent(encodeURIComponent(fileName)));
... ...
src/main/resources/static/pages/oil/checkJyryList.html
... ... @@ -20,7 +20,7 @@
20 20 class="caption-subject font-dark sbold uppercase">加油人员不符</span>
21 21 </div>
22 22 <div class="actions">
23   - <a class="btn btn-circle blue" href="cylAdd.html" data-pjax><i class="fa fa-plus"></i> 添加</a>
  23 +<!-- <a class="btn btn-circle blue" href="cylAdd.html" data-pjax><i class="fa fa-plus"></i> 添加</a> -->
24 24 <button type="button" class="btn btn-circle blue" id="saveButton"><i class="fa fa-minus-square"></i> 保存</button>
25 25 <!-- <button type="button" class="btn btn-circle red" disabled="disabled" id="removeButton"><i class="fa fa-trash"></i> 删除用户</button> -->
26 26 <!-- <div class="btn-group">
... ...
src/main/resources/static/pages/oil/list_ph.html
... ... @@ -21,7 +21,7 @@
21 21 </div>
22 22 <div class="actions">
23 23 <a class="btn btn-circle blue" href="add.html" data-pjax><i class="fa fa-plus"></i> 添加</a>
24   - <!-- <button type="button" class="btn btn-circle blue" id="removeButton"><i class="fa fa-trash-o"></i> 删除</button> -->
  24 + <button type="button" class="btn btn-circle blue" id="removeButton"><i class="fa fa-trash-o"></i> 删除</button>
25 25 <button type="button" class="btn btn-circle blue" id="sortButton"><i class="fa fa-minus-square"></i>
26 26 拆分/保存
27 27 </button>
... ... @@ -58,56 +58,99 @@
58 58 id="datatable_ylb">
59 59 <thead>
60 60 <tr role="row" class="filter">
61   - <td> 公司:</td>
62   - <td colspan="2">
63   -
64   - <select class="form-control" name="ssgsdm_like" id="ylbListGsdmId" ></select>
65   -
66   - </td>
67   - <td>
68   - 分公司:
69   - </td>
70   - <td colspan="2">
71   -
72   - <select class="form-control" name="fgsdm_like" id="ylbListFgsdmId" ></select>
73   - </td>
74   -
75   - <td>
76   - 日期:
77   - </td>
78   - <td>
79   - <input type="text" style="width: 80px" name="rq" id="rq"/>
80   - </td>
81   - <td >
82   - 线路:
83   - </td>
84   - <td colspan="2">
85   - <select class="form-control" name="xlbm_like" id="xlbm" style="width: 120px;"></select>
86   - </td>
87   - <td >
88   - 内部编码:
89   - </td>
90   - <td colspan="4">
91   - <div style="float:left;">
92   - <select class="form-control" name="nbbm_eq" id="nbbm" style="width: 120px;"></select>
93   - </div>
94   - <div style="float:left;">
95   - <button class="btn btn-sm #000 btn-outline filter-cancel" style="margin-right:0px">
96   - <i class="fa fa-times"></i>
97   - </button>
98   - </div>
99   - </td>
100   - <td colspan="1">
101   - <button class="btn btn-sm green btn-outline filter-submit margin-bottom" style="margin-right:0px">
102   - <i class="fa fa-search"></i> 搜索
103   - </button>
  61 + <td colspan="2">
  62 + <div style="float: right; " >&nbsp;公司&nbsp;</div>
  63 + </td>
  64 + <td colspan="3">
  65 + <div style="float: left;width: 150px">
  66 + <select class="form-control" name="ssgsdm_like"
  67 + id="ylbListGsdmId"></select>
  68 + </div>
  69 + </td>
  70 + <td colspan="2">
  71 + <div style="float: right; " >&nbsp;分公司&nbsp;</div>
  72 + </td>
  73 + <td colspan="4">
  74 + <div style="float: left;">
  75 + <select class="form-control" name="fgsdm_like"
  76 + id="ylbListFgsdmId" style="width: 150px"></select>
  77 + </div>
  78 + </td>
  79 + <td >
  80 + <div style="float: right; ">日期</div>
  81 + </td>
  82 + <td colspan="3">
  83 + <div style="float: left;">
  84 + <input type="text" style="width: 120px" name="rq" id="rq" />
  85 + </div>
  86 + </td>
  87 + <td rowspan="2" colspan="2">
  88 + <div style="float: left;">
  89 + &nbsp;<button
  90 + class="btn btn-sm green btn-outline filter-submit margin-bottom"
  91 + style="margin-right: 0px">
  92 + <i class="fa fa-search"></i> 搜索
  93 + </button> <!-- <button class="btn btn-sm red btn-outline filter-cancel" style="margin-right:0px"> -->
  94 + <!-- <i class="fa fa-times"></i> 重置 -->
  95 + <!-- </button> -->
104 96  
105   -<!-- <button class="btn btn-sm red btn-outline filter-cancel" style="margin-right:0px"> -->
106   -<!-- <i class="fa fa-times"></i> 重置 -->
107   -<!-- </button> -->
108   -
109   - </td>
  97 + </div>
  98 + </td>
110 99 </tr>
  100 + <tr class="filter2">
  101 + <td colspan="2">
  102 + <div style="float: right; ">&nbsp;线路</div>
  103 + </td>
  104 + <td colspan="3">
  105 + <div style="float: left;">
  106 + <select class="form-control" name="xlbm_like" id="xlbm"
  107 + style="width: 150px;"></select>
  108 + </div>
  109 + </td>
  110 + <td colspan="2">
  111 + <div style="float: right;">&nbsp;内部编码</div>
  112 + </td>
  113 + <td colspan="4">
  114 + <div style="float: left;">
  115 + <select class="form-control" name="nbbm_eq" id="nbbm"
  116 + style="width: 120px;"></select>
  117 + </div>
  118 + <div style="float: left;">
  119 + <button class="btn btn-sm #000 btn-outline filter-cancel"
  120 + style="margin-right: 0px">
  121 + <i class="fa fa-times"></i>
  122 + </button>
  123 + </div>
  124 + </td>
  125 + <td >
  126 + <div style="float: right;">
  127 + 类型
  128 + </div>
  129 + </td>
  130 + <td colspan="3">
  131 + <div style="float: left;">
  132 + <select class="form-control" name="sxtj">
  133 + <option value="0">全部</option>
  134 + <option value="1">一车一单</option>
  135 + <option value="2">一车多单</option>
  136 + </select>
  137 + </div>
  138 +
  139 + </td>
  140 + </tr>
  141 + <tr>
  142 + <td colspan="17">
  143 + <div style="float: left;">
  144 + 总计
  145 + &nbsp;&nbsp;
  146 + 加注量:&nbsp;<label id="sumJzl"></label>
  147 + &nbsp;&nbsp;
  148 + 耗油量:&nbsp;<label id="sumYh"></label>
  149 + &nbsp;&nbsp;
  150 + 损耗量:&nbsp;<label id="sumSh"></label>
  151 + </div>
  152 + </td>
  153 + </tr>
111 154 <tr role="row" class="heading">
112 155 <th width="2%">#</th>
113 156 <th width="8%">日期</th>
... ... @@ -226,18 +269,7 @@
226 269 $("#checkYl").on('click', function () {
227 270 console.log("核对加注量");
228 271 if ($("#rq").val() != "") {
229   - var cells = $('tr.filter')[0].cells
230   - , params = {}
231   - , name;
232   - $.each(cells, function (i, cell) {
233   - var items = $('input,select', cell);
234   - for (var j = 0, item; item = items[j++];) {
235   - name = $(item).attr('name');
236   - if (name) {
237   - params[name] = $(item).val();
238   - }
239   - }
240   - });
  272 + var params=getParamsList();
241 273 var i = layer.load(2);
242 274 $get('/ylb/checkYl', params, function () {
243 275 layer.close(i);
... ... @@ -252,18 +284,7 @@
252 284 $("#outAndIn").on('click', function () {
253 285 console.log("进场油量等于出场油量");
254 286 if ($("#rq").val() != "") {
255   - var cells = $('tr.filter')[0].cells
256   - , params = {}
257   - , name;
258   - $.each(cells, function (i, cell) {
259   - var items = $('input,select', cell);
260   - for (var j = 0, item; item = items[j++];) {
261   - name = $(item).attr('name');
262   - if (name) {
263   - params[name] = $(item).val();
264   - }
265   - }
266   - });
  287 + var params=getParamsList();
267 288 var i = layer.load(2);
268 289 $get('/ylb/outAndIn', params, function () {
269 290 layer.close(i);
... ... @@ -272,7 +293,8 @@
272 293 } else {
273 294 layer.msg('请选择日期.');
274 295 }
275   - })
  296 + });
  297 +
276 298 //拆分
277 299 $("#sortButton").on('click', function () {
278 300 if ($("#rq").val() != "") {
... ... @@ -294,18 +316,7 @@
294 316 var i = layer.load(2);
295 317 $get('/ylb/sort', params, function () {
296 318 layer.close(i);
297   - var cells = $('tr.filter')[0].cells
298   - , params1 = {}
299   - , name;
300   - $.each(cells, function (i, cell) {
301   - var items = $('input,select', cell);
302   - for (var j = 0, item; item = items[j++];) {
303   - name = $(item).attr('name');
304   - if (name) {
305   - params1[name] = $(item).val();
306   - }
307   - }
308   - });
  319 + var params1 =getParamsList();
309 320 jsDoQuery(params1, true);
310 321 });
311 322  
... ... @@ -318,18 +329,8 @@
318 329 $("#obtain").on('click', function () {
319 330 console.log("获取加存");
320 331 if ($("#rq").val() != "") {
321   - var cells = $('tr.filter')[0].cells
322   - , params = {}
323   - , name;
324   - $.each(cells, function (i, cell) {
325   - var items = $('input,select', cell);
326   - for (var j = 0, item; item = items[j++];) {
327   - name = $(item).attr('name');
328   - if (name) {
329   - params[name] = $(item).val();
330   - }
331   - }
332   - });
  332 + var params =getParamsList();
  333 +
333 334 var i = layer.load(2);
334 335 $get('/ylb/obtain', params, function () {
335 336 layer.close(i);
... ... @@ -352,8 +353,8 @@
352 353 }
353 354  
354 355 //重置
355   - $('tr.filter .filter-cancel').on('click', function () {
356   - $('tr.filter , #nbbm').val('').change();
  356 + $('tr.filter2 .filter-cancel').on('click', function () {
  357 + $('tr.filter2 , #nbbm').val('').change();
357 358 });
358 359  
359 360 //提交
... ... @@ -365,23 +366,39 @@
365 366 }else if(ylbGsdm=="" || ylbGsdm==null || ylbFgsdm=="" ||ylbFgsdm==null){
366 367 layer.msg('请选择公司和分公司.');
367 368 }else {
368   - var cells = $('tr.filter')[0].cells
369   - , params = {}
370   - , name;
371   - $.each(cells, function (i, cell) {
372   - var items = $('input,select', cell);
373   - for (var j = 0, item; item = items[j++];) {
374   - name = $(item).attr('name');
375   - if (name) {
376   - params[name] = $(item).val();
377   - }
378   - }
379   - });
  369 + var params = getParamsList();
  370 +
  371 +
380 372 page = 0;
381 373 jsDoQuery(params, true);
382 374 }
383 375 });
384 376  
  377 + function getParamsList(){
  378 + var cells = $('tr.filter')[0].cells
  379 + , cells1 = $('tr.filter2')[0].cells,params = {}
  380 + , name;
  381 + $.each(cells, function (i, cell) {
  382 + var items = $('input,select', cell);
  383 + for (var j = 0, item; item = items[j++];) {
  384 + name = $(item).attr('name');
  385 + if (name) {
  386 + params[name] = $(item).val();
  387 + }
  388 + }
  389 + });
  390 + $.each(cells1, function (i, cell) {
  391 + var items = $('input,select', cell);
  392 + for (var j = 0, item; item = items[j++];) {
  393 + name = $(item).attr('name');
  394 + if (name) {
  395 + params[name] = $(item).val();
  396 + }
  397 + }
  398 + });
  399 +
  400 + return params;
  401 + }
385 402  
386 403 // var gsqxdm="";
387 404  
... ... @@ -454,13 +471,15 @@
454 471 params['fgsdm_in']=fgsqx1;
455 472 }
456 473 } */
  474 +
457 475 var l = layer.load(2);
458 476 $get('/ylb', params, function (data) {
  477 +
459 478 $.each(data.content, function (i, obj) {
460 479 obj.rq = moment(obj.rq).format("YYYY-MM-DD");
461 480 });
462 481 var bodyHtm = template('ylb_list_temp', {list: data.content});
463   -
  482 +
464 483 $('#datatable_ylb tbody').html(bodyHtm)
465 484 .find('.icheck').iCheck(icheckOptions)
466 485 .on('ifChanged', iCheckChange);
... ... @@ -470,7 +489,13 @@
470 489 showPagination(data);
471 490 }
472 491 layer.close(l);
473   -
  492 + $get('/ylb/sumYlb',params,function(returns){
  493 + console.log(returns);
  494 + console.log(returns.jzl);
  495 + $("#sumJzl").html(returns.jzl);
  496 + $("#sumYh").html(returns.yh);
  497 + $("#sumSh").html(returns.sh);
  498 + });
474 499 startOptJzylLink($('#ll_oil_list .in_carpark_jzyl'));
475 500 startOptShylLink($('#ll_oil_list .in_carpark_shyl'));
476 501 });
... ... @@ -549,18 +574,7 @@
549 574 return;
550 575 }
551 576  
552   - var cells = $('tr.filter')[0].cells
553   - , params = {}
554   - , name;
555   - $.each(cells, function (i, cell) {
556   - var items = $('input,select', cell);
557   - for (var j = 0, item; item = items[j++];) {
558   - name = $(item).attr('name');
559   - if (name) {
560   - params[name] = $(item).val();
561   - }
562   - }
563   - });
  577 + var params=getParamsList();
564 578 page = num - 1;
565 579 jsDoQuery(params, true);
566 580 }
... ... @@ -570,13 +584,15 @@
570 584  
571 585 //删除
572 586 $('#removeButton').on('click', function () {
573   - if ($(this).attr('disabled'))
574   - return;
575   -
576   - var id = $('input.icheck:checked').data('id');
577   - removeConfirm('确定要删除选中的数据?', '/resource/' + id, function () {
578   - $('tr.filter .filter-submit').click();
579   - });
  587 + var id = $('input.icheck:checked').data('id');
  588 + if (typeof(id) == 'undefined') {
  589 + layer.msg("请选择要删除的数据");
  590 + }else{
  591 + removeConfirm('确定要删除选中的数据?', '/ylb/' + id, function () {
  592 + var params=getParamsList();
  593 + jsDoQuery(params, true);
  594 + });
  595 + }
580 596 });
581 597  
582 598 //搜索线路
... ... @@ -636,18 +652,7 @@
636 652  
637 653 $("#export").on("click", function () {
638 654 if ($("#rq").val() != "") {
639   - var cells = $('tr.filter')[0].cells
640   - , params = {}
641   - , name;
642   - $.each(cells, function (i, cell) {
643   - var items = $('input,select', cell);
644   - for (var j = 0, item; item = items[j++];) {
645   - name = $(item).attr('name');
646   - if (name) {
647   - params[name] = $(item).val();
648   - }
649   - }
650   - });
  655 + var params=getParamsList();
651 656 $post('/ylb/listExport', params, function (result) {
652 657 window.open("/downloadFile/download?fileName=进出场存油量" + moment($("#rq").val()).format("YYYYMMDD"));
653 658 });
... ...
src/main/resources/static/real_control_v2/css/line_schedule.css
... ... @@ -239,7 +239,7 @@
239 239 }
240 240  
241 241 .schedule-body .ct_table dl:nth-child(even){
242   - background: rgba(249, 249, 249, 0.31);
  242 + background: rgba(101, 204, 220, 0.13);
243 243 }
244 244  
245 245 span.fcsj-diff {
... ... @@ -532,7 +532,7 @@ div.drop-rail[data-type=&quot;car&quot;]:before {
532 532 }
533 533  
534 534 dl.relevance-active dd:nth-child(n+2) {
535   - background: #c1e2f9 !important;
  535 + background: #d2d2d2 !important;
536 536 }
537 537  
538 538 dl.relevance-active.intimity dd:nth-child(n+2) {
... ...
src/main/resources/static/real_control_v2/css/main.css
... ... @@ -863,4 +863,40 @@ svg rect.offline{
863 863 color: white;
864 864 box-shadow: 0px 4px 6px 0 rgba(0, 0, 0, 0.2), 0px 4px 10px 0 rgba(0, 0, 0, 0.19);
865 865 border-radius: 1px 1px 4px 4px;
  866 +}
  867 +
  868 +#oil_station-modal.ct-form-modal form.uk-form-horizontal .uk-form-label{
  869 + width: 120px;
  870 +}
  871 +
  872 +#oil_station-modal.ct-form-modal form.uk-form-horizontal .uk-form-controls{
  873 + margin-left: 125px;
  874 +}
  875 +
  876 +#oil_station-modal .uk-form-icon>[class*=uk-icon-]{
  877 + right: 23px;
  878 +}
  879 +
  880 +#oil_station-modal .uk-form-icon:not(.uk-form-icon-flip)>input{
  881 + padding-left: 10px !important;
  882 +}
  883 +
  884 +#oil_station-modal .uk-form-icon{
  885 + width: calc(100% - 145px);
  886 +}
  887 +
  888 +#oil_station-modal .uk-icon-mile:before{
  889 + content: '公里';
  890 +}
  891 +
  892 +#oil_station-modal .uk-icon-minute:before{
  893 + content: '分钟';
  894 +}
  895 +
  896 +option.oil_station_opt{
  897 + color: red;
  898 +}
  899 +
  900 +#oil_station-modal .uk-modal .uk-form.fv-form{
  901 + margin-bottom: 0 !important;
866 902 }
867 903 \ No newline at end of file
... ...
src/main/resources/static/real_control_v2/fragments/line_schedule/context_menu/fcxxwt.html
... ... @@ -141,7 +141,7 @@
141 141 <div class="uk-form-row">
142 142 <label class="uk-form-label" >里程</label>
143 143 <div class="uk-form-controls">
144   - <input type="text" value="{{if sch.status==-1}}0{{else}}{{sch.jhlc}}{{/if}}" name="jhlc" >
  144 + <input type="text" value="{{if sch.status==-1}}0{{else}}{{sch.jhlc}}{{/if}}" name="jhlc" required>
145 145 </div>
146 146 </div>
147 147 </div>
... ... @@ -197,7 +197,7 @@
197 197 }
198 198  
199 199 //里程有修改
200   - if(data.jhlc != sch.jhlc){
  200 + if(data.jhlc != sch.jhlc && data.jhlc != 0){
201 201 var confHtml = '<h4 style="color: #c04c4c;margin-bottom: 9px;">确认要将班次里程由'+sch.jhlc+' 修改为'+data.jhlc+' </h4><small>备注:</small>';
202 202 UIkit.modal.prompt(confHtml, data.remarks, function(remarks){
203 203 if(remarks){
... ...
src/main/resources/static/real_control_v2/fragments/line_schedule/context_menu/lj_zrw.html
... ... @@ -267,7 +267,7 @@
267 267 }
268 268 });
269 269 //公里与主任务不符合
270   - if (sum != sch.jhlc) {
  270 + if (sum != sch.jhlcOrig) {
271 271 if (i > 1)
272 272 calcs += ('=' + sum);
273 273 calcs += (' ≠ ' + sch.jhlc);
... ... @@ -320,6 +320,11 @@
320 320 var sch = getActiveSch();
321 321 if (!sch)
322 322 return notify_err('无法获取到主任务信息!');
  323 +
  324 + if(sch.bcType == 'out' || sch.bcType == 'in'){
  325 + notify_err('暂不能在进出场班次上做回场子任务!');
  326 + return;
  327 + }
323 328 open_modal(folder + '/sub_task/add_sub_task_inpark.html', {
324 329 sch: sch
325 330 }, modal_opts);
... ... @@ -330,6 +335,10 @@
330 335 var sch = getActiveSch();
331 336 if (!sch)
332 337 return notify_err('无法获取到主任务信息!');
  338 + if(sch.bcType == 'out' || sch.bcType == 'in'){
  339 + notify_err('暂不能在进出场班次上做出场子任务!');
  340 + return;
  341 + }
333 342 open_modal(folder + '/sub_task/add_sub_task_outpark.html', {
334 343 sch: sch
335 344 }, modal_opts);
... ... @@ -369,6 +378,20 @@
369 378 });
370 379 }, '确定删除');
371 380 };
  381 + //加油
  382 + var add_oil = function () {
  383 + var sch = getActiveSch();
  384 + if (!sch)
  385 + return notify_err('无法获取到主任务信息!');
  386 +
  387 + if(sch.bcType == 'out' || sch.bcType == 'in'){
  388 + notify_err('暂不能在进出场班次上做加油子任务!');
  389 + return;
  390 + }
  391 + open_modal(folder + '/sub_task/add_sub_task_oil.html', {
  392 + sch: sch
  393 + }, modal_opts);
  394 + };
372 395  
373 396 var callbackHandler = {
374 397 add_temp_sch: add_temp_sch,
... ... @@ -377,7 +400,8 @@
377 400 add_sub_task_in: add_sub_task_in,
378 401 remove_sub_task: remove_sub_task,
379 402 add_sub_task_out: add_sub_task_out,
380   - add_sub_task_range_turn: add_sub_task_range_turn
  403 + add_sub_task_range_turn: add_sub_task_range_turn,
  404 + add_oil: add_oil
381 405 };
382 406  
383 407 //右键菜单
... ... @@ -394,6 +418,9 @@
394 418 "add_sub_task": {
395 419 name: "添加子任务",
396 420 items: {
  421 + 'add_oil':{
  422 + name: '加油'
  423 + },
397 424 'add_sub_task_in': {
398 425 name: '回场'
399 426 },
... ...
src/main/resources/static/real_control_v2/fragments/line_schedule/context_menu/sub_task/add_sub_task_inpark.html
... ... @@ -52,7 +52,7 @@
52 52 </div>
53 53 </div>
54 54 <div class="uk-width-7-10 pl5">
55   - <input type="text" name="mileage" required>
  55 + <input type="number" step="0.01" name="mileage" required>
56 56 </div>
57 57 </div>
58 58 <div class="uk-grid">
... ... @@ -125,7 +125,7 @@
125 125 </div>
126 126 </div>
127 127 <div class="uk-width-7-10 pl5">
128   - <input type="text" name="mileage" required style="width: calc(100% - 62px);">
  128 + <input type="number" step="0.01" name="mileage" required style="width: calc(100% - 62px);">
129 129 <a style="font-size: 12px;color: grey;cursor: default;" data-uk-tooltip title="可选择回场路径,设置途径点位。暂不开放" id="inpark_paths_link">路径(<span>0</span>)</a>
130 130 </div>
131 131 </div>
... ... @@ -190,7 +190,7 @@
190 190 </div>
191 191 </div>
192 192 <div class="uk-width-7-10 pl5">
193   - <input type="text" name="mileage" required>
  193 + <input type="number" step="0.01" name="mileage" required>
194 194 </div>
195 195 </div>
196 196 <div class="uk-grid">
... ...
src/main/resources/static/real_control_v2/fragments/line_schedule/context_menu/sub_task/add_sub_task_oil.html 0 → 100644
  1 +<div class="uk-modal ct-form-modal" id="schedule-addsch_oil-modal">
  2 + <div class="uk-modal-dialog" style="width: 1201px;">
  3 + <a href="" class="uk-modal-close uk-close"></a>
  4 + <div class="uk-modal-header">
  5 + <h2>加油</h2></div>
  6 +
  7 + <div class="uk-grid">
  8 + <div class="uk-width-1-3">
  9 + <form class="uk-form uk-form-horizontal ">
  10 + <input type="hidden" name="type1" value="正常">
  11 + <input type="hidden" name="type2" value="1">
  12 + <input type="hidden" name="mileageType" value="service">
  13 +
  14 + <div class="uk-panel uk-panel-box uk-panel-box-primary">
  15 + <div class="uk-panel-badge uk-badge ">营运</div>
  16 + <h3 class="uk-panel-title">线路上站点间</h3>
  17 + <div class="uk-form-row">
  18 + <label class="uk-form-label">起点站</label>
  19 + <div class="uk-form-controls">
  20 + <input type="hidden" name="startStation">
  21 + <input type="text" name="startStationName" disabled>
  22 + </div>
  23 + </div>
  24 + <div class="uk-form-row">
  25 + <label class="uk-form-label">终点站</label>
  26 + <div class="uk-form-controls">
  27 + <input type="hidden" name="endStation">
  28 + <input type="text" name="endStationName" disabled>
  29 + </div>
  30 + </div>
  31 + <div class="uk-form-row">
  32 + <label class="uk-form-label">里程</label>
  33 + <div class="uk-form-controls">
  34 + <input type="number" step="0.01" name="mileage" max=222
  35 + data-fv-lessthan-inclusive="false"
  36 + disabled>
  37 + </div>
  38 + </div>
  39 + <div class="uk-form-row">
  40 + <label class="uk-form-label">开始时间</label>
  41 + <div class="uk-form-controls">
  42 + <input type="time" name="startDate" required>
  43 + </div>
  44 + </div>
  45 + <div class="uk-form-row">
  46 + <label class="uk-form-label">结束时间</label>
  47 + <div class="uk-form-controls">
  48 + <input type="time" name="endDate" required>
  49 + </div>
  50 + </div>
  51 + </div>
  52 + </form>
  53 + </div>
  54 +
  55 + <div class="uk-width-1-3">
  56 + <form class="uk-form uk-form-horizontal">
  57 + <input type="hidden" name="type1" value="临加">
  58 + <input type="hidden" name="type2" value="2">
  59 + <input type="hidden" name="mileageType" value="empty">
  60 +
  61 + <div class="uk-panel uk-panel-box uk-panel-box-secondary">
  62 + <div class="uk-panel-badge uk-badge uk-badge-default">空驶</div>
  63 + <h3 class="uk-panel-title">进场</h3>
  64 + <div class="uk-form-row">
  65 + <label class="uk-form-label">起点站</label>
  66 + <div class="uk-form-controls">
  67 + <select name="startStation" required>
  68 + </select>
  69 + <input type="hidden" name="startStationName" disabled>
  70 + </div>
  71 + </div>
  72 + <div class="uk-form-row">
  73 + <label class="uk-form-label">终点站</label>
  74 + <div class="uk-form-controls">
  75 + <select name="endStation" required>
  76 + </select>
  77 + <input type="hidden" name="endStationName" disabled>
  78 + </div>
  79 + </div>
  80 + <div class="uk-form-row">
  81 + <label class="uk-form-label">里程</label>
  82 + <div class="uk-form-controls">
  83 + <input type="number" step="0.01" name="mileage" max=222
  84 + data-fv-lessthan-inclusive="false"
  85 + required>
  86 + </div>
  87 + </div>
  88 + <div class="uk-form-row">
  89 + <label class="uk-form-label">开始时间</label>
  90 + <div class="uk-form-controls">
  91 + <input type="time" name="startDate" required>
  92 + </div>
  93 + </div>
  94 + <div class="uk-form-row">
  95 + <label class="uk-form-label">结束时间</label>
  96 + <div class="uk-form-controls">
  97 + <input type="time" name="endDate" required>
  98 + </div>
  99 + </div>
  100 + </div>
  101 + </form>
  102 + </div>
  103 +
  104 + <div class="uk-width-1-3">
  105 + <form class="uk-form uk-form-horizontal">
  106 + <input type="hidden" name="type1" value="临加">
  107 + <input type="hidden" name="type2" value="3">
  108 + <input type="hidden" name="mileageType" value="empty">
  109 +
  110 + <div class="uk-panel uk-panel-box uk-panel-box-secondary">
  111 + <div class="uk-panel-badge uk-badge uk-badge-default">空驶</div>
  112 + <h3 class="uk-panel-title">出场</h3>
  113 + <div class="uk-form-row">
  114 + <label class="uk-form-label">起点站</label>
  115 + <div class="uk-form-controls">
  116 + <select name="startStation" required>
  117 + </select>
  118 + <input type="hidden" name="startStationName" disabled>
  119 + </div>
  120 + </div>
  121 + <div class="uk-form-row">
  122 + <label class="uk-form-label">终点站</label>
  123 + <div class="uk-form-controls">
  124 + <select name="endStation" required>
  125 + </select>
  126 + <input type="hidden" name="endStationName" disabled>
  127 + </div>
  128 + </div>
  129 + <div class="uk-form-row">
  130 + <label class="uk-form-label">里程</label>
  131 + <div class="uk-form-controls">
  132 + <input type="number" step="0.01" name="mileage" max=222
  133 + data-fv-lessthan-inclusive="false"
  134 + required>
  135 + </div>
  136 + </div>
  137 + <div class="uk-form-row">
  138 + <label class="uk-form-label">开始时间</label>
  139 + <div class="uk-form-controls">
  140 + <input type="time" name="startDate" required>
  141 + </div>
  142 + </div>
  143 + <div class="uk-form-row">
  144 + <label class="uk-form-label">结束时间</label>
  145 + <div class="uk-form-controls">
  146 + <input type="time" name="endDate" required>
  147 + </div>
  148 + </div>
  149 + </div>
  150 + </form>
  151 + </div>
  152 + </div>
  153 + <div class="uk-modal-footer uk-text-right" style="margin-bottom: -20px;">
  154 + <span class="bind_gas_station_panel" style="position: absolute;left: 30px;text-decoration: underline;"></span>
  155 + <button type="button" class="uk-button uk-modal-close">取消</button>
  156 + <button type="submit" id="submitChildTaskBtn" class="uk-button uk-button-primary"><i class="uk-icon-check"></i> &nbsp;保存</button>
  157 + </div>
  158 + </div>
  159 +
  160 + <script id="schedule-addsch_oil-form-temp" type="text/html">
  161 +
  162 + </script>
  163 +
  164 + <script>
  165 + (function () {
  166 + var modal = '#schedule-addsch_oil-modal',
  167 + sch, stationRoutes, parks, oilStation;
  168 + var yyForm = $('form', modal)[0];
  169 + var jcForm = $('form', modal)[1];
  170 + var ccForm = $('form', modal)[2];
  171 + var oilId;
  172 + var lineInfo;
  173 +
  174 + var folder = '/real_control_v2/fragments/line_schedule/context_menu';
  175 + $(modal).on('init', function (e, data) {
  176 + e.stopPropagation();
  177 + sch = data.sch;
  178 + oilId = sch.xlBm + '_oil_station';
  179 + lineInfo = gb_data_basic.codeToLine[sch.xlBm];
  180 +
  181 + //站点路由
  182 + stationRoutes = gb_common.groupBy(gb_data_basic.stationRoutes(sch.xlBm).sort(function (a, b) {
  183 + return a.stationRouteCode - b.stationRouteCode;
  184 + }), 'directions');
  185 +
  186 + setDefaultVal();
  187 + //停车场
  188 + $.get('/basic/parks', function (rs) {
  189 + parks = rs;
  190 + var opts = '';
  191 + for (var code in parks) {
  192 + opts += '<option value="' + code + '">' + parks[code] + '</option>';
  193 + }
  194 + $('[name=endStation]', jcForm).html(opts);
  195 + $('[name=startStation]', ccForm).html(opts);
  196 + });
  197 +
  198 + //切换空驶起终点
  199 + $('[name=endStation]', jcForm).on('change', reCalcIn);
  200 + $('[name=startStation]', jcForm).on('change', reCalcIn);
  201 +
  202 + $('[name=endStation]', ccForm).on('change', reCalcOut);
  203 + $('[name=startStation]', ccForm).on('change', reCalcOut);
  204 + //修改开始时间
  205 + $('[name=startDate]', jcForm).on('change', reCalcIn);
  206 + $('[name=startDate]', ccForm).on('change', reCalcOut);
  207 +
  208 + //绑定的社会加油站
  209 + $.get('/oilStation/'+sch.xlBm, function (rs) {
  210 + var htmlStr;
  211 + oilStation = rs;
  212 + if(oilStation){
  213 + htmlStr = '<a><i class="uk-icon-product-hunt"></i> '+oilStation.stationName+'</a>';
  214 +
  215 + var opt = '<option value="'+oilId+'" class="oil_station_opt">'+oilStation.stationName+'</option>';
  216 + $('[name=endStation]', jcForm).prepend(opt).val(oilId).change();
  217 + $('[name=startStation]', ccForm).prepend(opt).val(oilId).change();
  218 + }
  219 + else
  220 + htmlStr = '<a>为'+sch.xlName+'绑定一个社会加油站</a>';
  221 +
  222 + $('.bind_gas_station_panel', modal).html(htmlStr);
  223 + $('.bind_gas_station_panel a', modal).on('click', function () {
  224 + open_modal(folder + '/sub_task//oil_station.html', {
  225 + sch: sch
  226 + }, {center: false, bgclose: false, modal: false});
  227 + });
  228 + });
  229 + });
  230 +
  231 + var dataArray = [];
  232 + var fs = $('form', modal).formValidation({
  233 + framework: 'uikit',
  234 + locale: 'zh_CN'
  235 + });
  236 + fs.on('success.form.fv', function(e) {
  237 + e.preventDefault();
  238 + if($(this).is(':hidden'))
  239 + return;
  240 + dataArray.push($.extend($(this).serializeJSON(), getDisabledVal(this)
  241 + , {remarks: '加油', 'schedule.id': sch.id}));
  242 + $(this).data('valid', true);
  243 +
  244 + if(allValidSuccess()){
  245 + var i = 0;
  246 + (function () {
  247 + var f = arguments.callee;
  248 + if(i >= dataArray.length){
  249 + UIkit.modal(modal).hide();
  250 + $('#schedule-lj_zrw-modal .main-schedule-table').trigger('refresh', {sch: sch});
  251 + return;
  252 + }
  253 + var data = dataArray[i];
  254 + //里程为0的不保存
  255 + if(data.mileage==0){
  256 + i++;
  257 + f();
  258 + }
  259 + else{
  260 + gb_common.$post('/childTask', data, function (rs) {
  261 + notify_succ('子任务添加成功');
  262 + gb_schedule_table.updateSchedule(rs.t);
  263 + i++;
  264 + f();
  265 + });
  266 + }
  267 + })();
  268 + }
  269 + });
  270 +
  271 + //校验不过
  272 + fs.on('err.field.fv', function () {
  273 + $('#submitChildTaskBtn', modal).removeClass('disabled').removeAttr('disabled');
  274 + });
  275 +
  276 + //submit
  277 + $('#submitChildTaskBtn', modal).on('click', function () {
  278 + //空驶的进场终点名称
  279 + if(!oilStation || $('[name=endStation]', jcForm).val() != oilId)
  280 + $('[name=endStationName]', jcForm).val('');
  281 + else
  282 + $('[name=endStationName]', jcForm).val(oilStation.stationName);
  283 +
  284 + //空驶的出场起点名称
  285 + if(!oilStation || $('[name=startStation]', ccForm).val() != oilId)
  286 + $('[name=startStationName]', ccForm).val('');
  287 + else
  288 + $('[name=startStationName]', ccForm).val(oilStation.stationName);
  289 +
  290 +
  291 + //提交表单
  292 + $(this).addClass('disabled').attr('disabled','disabled');
  293 + dataArray = [];
  294 + fs.data('valid', false);
  295 + fs.formValidation('validate');
  296 + //fs.submit();
  297 + });
  298 +
  299 + //获取表单disabled 项的值
  300 + function getDisabledVal(f) {
  301 + var rs = {};
  302 + $('input,select', f).each(function () {
  303 + if($(this).attr('disabled')){
  304 + rs[$(this).attr('name')]=$(this).val();
  305 + }
  306 + });
  307 + return rs;
  308 + }
  309 +
  310 + function allValidSuccess() {
  311 + var flag = true;
  312 + $('form:visible', modal).each(function (i, f) {
  313 + if(!$(f).data('valid')){
  314 + flag = false;
  315 + return false;
  316 + }
  317 + });
  318 + return flag;
  319 + }
  320 +
  321 + function setDefaultVal() {
  322 + //营运班次
  323 + $('[name=startStation]', yyForm).val(sch.qdzCode);
  324 + $('[name=startStationName]', yyForm).val(sch.qdzName);
  325 + $('[name=endStation]', yyForm).val(sch.zdzCode);
  326 + $('[name=endStationName]', yyForm).val(sch.zdzName);
  327 + $('[name=mileage]', yyForm).val(sch.jhlc);
  328 + $('[name=startDate]', yyForm).val(sch.fcsjActual==null?sch.dfsj:sch.fcsjActual);
  329 + $('[name=endDate]', yyForm).val(sch.zdsjActual==null?sch.zdsj:sch.zdsjActual);
  330 +
  331 + //设置进场默认值
  332 + $('[name=startStation]', jcForm).html(createStationOpts(stationRoutes[sch.xlDir]));
  333 + $('[name=startDate]', jcForm).val(sch.zdsjActual==null?sch.zdsj:sch.zdsjActual);
  334 + $('[name=startStation]', jcForm).val(sch.zdzCode);
  335 +
  336 + //设置出场默认值
  337 + $('[name=endStation]', ccForm).html(createStationOpts(stationRoutes[sch.xlDir]));
  338 + $('[name=endStation]', ccForm).val(sch.zdzCode);
  339 + }
  340 +
  341 + function createStationOpts(list) {
  342 + var opts = '';
  343 + $.each(list, function () {
  344 + opts += '<option value="'+this.station.stationCod+'">'+this.stationName+'</option>';
  345 + });
  346 + return opts;
  347 + }
  348 +
  349 + function reCalcIn() {
  350 + if(!oilStation || $('[name=endStation]', jcForm).val() != oilId)
  351 + return;
  352 +
  353 + var data;
  354 + var qdz = $('[name=startStation]', jcForm).find("option:selected").text();
  355 + if(qdz == lineInfo.startStationName){
  356 + //起点进场
  357 + data = {
  358 + mileage: oilStation.upInMile,
  359 + time: oilStation.upInTime
  360 + }
  361 + }
  362 + else if(qdz == lineInfo.endStationName){
  363 + //终点进场
  364 + data = {
  365 + mileage: oilStation.downInMile,
  366 + time: oilStation.downInTime
  367 + }
  368 + }
  369 + if(!data)
  370 + return;
  371 +
  372 + $('[name=mileage]', jcForm).val(data.mileage);
  373 + var st = $('[name=startDate]', jcForm).val();
  374 + if(!st)
  375 + return;
  376 + var ets = moment(st, 'HH:mm').add(data.time, 'minute').format('HH:mm');
  377 + $('[name=endDate]', jcForm).val(ets);
  378 +
  379 + //出场时间 + 1 分钟
  380 + $('[name=startDate]', ccForm).val(moment(ets, 'HH:mm').add(1, 'minute').format('HH:mm'));
  381 + }
  382 +
  383 + function reCalcOut() {
  384 + if(!oilStation || $('[name=startStation]', ccForm).val() != oilId)
  385 + return;
  386 +
  387 + var data;
  388 + var zdz = $('[name=endStation]', ccForm).find("option:selected").text();
  389 + if(zdz == lineInfo.startStationName){
  390 + //出场到起点
  391 + data = {
  392 + mileage: oilStation.upOutMile,
  393 + time: oilStation.upOutTime
  394 + }
  395 + }
  396 + else if(zdz == lineInfo.endStationName){
  397 + //出场到终点
  398 + data = {
  399 + mileage: oilStation.downOutMile,
  400 + time: oilStation.downOutTime
  401 + }
  402 + }
  403 + if(!data)
  404 + return;
  405 +
  406 + $('[name=mileage]', ccForm).val(data.mileage);
  407 + var st = $('[name=startDate]', ccForm).val();
  408 + if(!st)
  409 + return;
  410 + var ets = moment(st, 'HH:mm').add(data.time, 'minute').format('HH:mm');
  411 + $('[name=endDate]', ccForm).val(ets);
  412 + }
  413 + })();
  414 + </script>
  415 +</div>
... ...
src/main/resources/static/real_control_v2/fragments/line_schedule/context_menu/sub_task/add_sub_task_outpark.html
... ... @@ -52,7 +52,7 @@
52 52 </div>
53 53 </div>
54 54 <div class="uk-width-7-10 pl5">
55   - <input type="text" name="mileage" required style="width: calc(100% - 62px);">
  55 + <input type="number" step="0.01" name="mileage" required style="width: calc(100% - 62px);">
56 56 <a style="font-size: 12px;color: grey;cursor: default;" target="_blank"
57 57 class="linkToLineInfo">线路标准</a>
58 58 </div>
... ... @@ -128,7 +128,7 @@
128 128 </div>
129 129 </div>
130 130 <div class="uk-width-7-10 pl5">
131   - <input type="text" name="mileage" disabled>
  131 + <input type="number" step="0.01" name="mileage" disabled>
132 132 </div>
133 133 </div>
134 134 <div class="uk-grid">
... ...
src/main/resources/static/real_control_v2/fragments/line_schedule/context_menu/sub_task/add_sub_task_range_turn.html
... ... @@ -168,7 +168,7 @@
168 168 </div>
169 169 </div>
170 170 <div class="uk-width-7-10 pl5">
171   - <input type="text" name="mileage" value="{{sch.jhlc}}" required>
  171 + <input type="number" step="0.01" name="mileage" value="{{sch.jhlc}}" required>
172 172 </div>
173 173 </div>
174 174 <div class="uk-grid">
... ... @@ -237,7 +237,7 @@
237 237 </div>
238 238 </div>
239 239 <div class="uk-width-7-10 pl5">
240   - <input type="text" name="mileage" required>
  240 + <input type="number" step="0.01" name="mileage" required>
241 241 </div>
242 242 </div>
243 243 <div class="uk-grid">
... ...
src/main/resources/static/real_control_v2/fragments/line_schedule/context_menu/sub_task/oil_station.html 0 → 100644
  1 +<div class="uk-modal ct-form-modal" id="oil_station-modal">
  2 + <div class="uk-modal-dialog" style="width: 450px;">
  3 + <a href="" class="uk-modal-close uk-close"></a>
  4 + <div class="uk-modal-header">
  5 + <h2>社会加油站</h2></div>
  6 +
  7 + <form class="uk-form uk-form-horizontal " style="margin-bottom: 0 !important;">
  8 + <div class="uk-form-row">
  9 + <label class="uk-form-label">线路</label>
  10 + <div class="uk-form-icon">
  11 + <input type="hidden" name="lineCode">
  12 + <input type="text" name="qdzName" disabled>
  13 + </div>
  14 + </div>
  15 + <div class="uk-form-row">
  16 + <label class="uk-form-label">加油站名称</label>
  17 + <div class="uk-form-icon">
  18 + <input type="text" name="stationName" value="社会加油站" required>
  19 + </div>
  20 + </div>
  21 + <div class="uk-form-row">
  22 + <label class="uk-form-label">起点进场里程</label>
  23 + <div class="uk-form-icon">
  24 + <i class="uk-icon-mile"></i>
  25 + <input type="number" name="upInMile" step="0.01" required>
  26 + </div>
  27 + </div>
  28 + <div class="uk-form-row">
  29 + <label class="uk-form-label">终点进场里程</label>
  30 + <div class="uk-form-icon">
  31 + <i class="uk-icon-mile"></i>
  32 + <input type="number" name="downInMile" step="0.01" required>
  33 + </div>
  34 + </div>
  35 + <div class="uk-form-row">
  36 + <label class="uk-form-label">起点进场时间</label>
  37 + <div class="uk-form-icon">
  38 + <i class="uk-icon-minute"></i>
  39 + <input type="text" name="upInTime" required>
  40 + </div>
  41 + </div>
  42 + <div class="uk-form-row">
  43 + <label class="uk-form-label">终点进场时间</label>
  44 + <div class="uk-form-icon">
  45 + <i class="uk-icon-minute"></i>
  46 + <input type="text" name="downInTime" required>
  47 + </div>
  48 + </div>
  49 +
  50 + <hr>
  51 + <div class="uk-form-row">
  52 + <label class="uk-form-label">出场到起点里程</label>
  53 + <div class="uk-form-icon">
  54 + <i class="uk-icon-mile"></i>
  55 + <input type="number" name="upOutMile" step="0.01" required>
  56 + </div>
  57 + </div>
  58 + <div class="uk-form-row">
  59 + <label class="uk-form-label">出场到终点里程</label>
  60 + <div class="uk-form-icon">
  61 + <i class="uk-icon-mile"></i>
  62 + <input type="number" name="downOutMile" step="0.01" required>
  63 + </div>
  64 + </div>
  65 + <div class="uk-form-row">
  66 + <label class="uk-form-label">出场到起点时间</label>
  67 + <div class="uk-form-icon">
  68 + <i class="uk-icon-minute"></i>
  69 + <input type="text" name="upOutTime" required>
  70 + </div>
  71 + </div>
  72 + <div class="uk-form-row">
  73 + <label class="uk-form-label">出场到终点时间</label>
  74 + <div class="uk-form-icon">
  75 + <i class="uk-icon-minute"></i>
  76 + <input type="text" name="downOutTime" required>
  77 + </div>
  78 + </div>
  79 + <div class="uk-modal-footer uk-text-right" style="margin-bottom: -20px;">
  80 + <button type="button" class="uk-button uk-modal-close">取消</button>
  81 + <button type="submit" class="uk-button uk-button-primary"><i class="uk-icon-check"></i> &nbsp;保存</button>
  82 + </div>
  83 + </form>
  84 + </div>
  85 +
  86 + <script id="" type="text/html">
  87 +
  88 + </script>
  89 +
  90 + <script>
  91 + (function () {
  92 + var modal = '#oil_station-modal',
  93 + sch, oilStation;
  94 +
  95 + var cognates = {
  96 + 'upInMile': 'upOutMile',
  97 + 'downInMile': 'downOutMile',
  98 + 'upInTime': 'upOutTime',
  99 + 'downInTime': 'downOutTime'
  100 + };
  101 + $(modal).on('init', function (e, data) {
  102 + e.stopPropagation();
  103 + sch = data.sch;
  104 +
  105 + $.get('/oilStation/'+sch.xlBm, function (rs) {
  106 + oilStation = rs;
  107 + setDefaultVal(oilStation);
  108 + });
  109 +
  110 + $('form [name=qdzName]', modal).val(sch.xlName);
  111 + $('form [name=lineCode]', modal).val(sch.xlBm);
  112 +
  113 + //submit
  114 + var f = $('form', modal).formValidation(gb_form_validation_opts);
  115 + f.on('success.form.fv', function(e) {
  116 + e.preventDefault();
  117 + var data = $(this).serializeJSON();
  118 +
  119 + gb_common.$post('/oilStation', data, function (rs) {
  120 + notify_succ('添加成功!');
  121 + UIkit.modal(modal).hide();
  122 + $('#schedule-addsch_oil-modal').trigger('init', {sch: sch});
  123 + });
  124 + });
  125 +
  126 + $('form input', modal).on('input', function () {
  127 + var name = $(this).attr('name');
  128 + if(cognates[name]){
  129 + $('form [name='+cognates[name]+']', modal).val($(this).val());
  130 + }
  131 + });
  132 + });
  133 +
  134 + function setDefaultVal(obj) {
  135 + if(!obj)
  136 + return;
  137 + $('form input', modal).each(function () {
  138 + var name = $(this).attr('name');
  139 + if(obj[name])
  140 + $(this).val(obj[name]);
  141 + });
  142 + }
  143 + })();
  144 + </script>
  145 +</div>
... ...