Commit 8bbb7773576350c9cb3d1607ff9d3e7229ba35ea

Authored by 潘钊
2 parents 207bc494 3450bf73

Merge branch 'minhang' into pudong

Showing 42 changed files with 2405 additions and 432 deletions
src/main/java/com/bsth/controller/oil/DlbController.java
@@ -84,8 +84,14 @@ public class DlbController extends BaseController<Dlb, Integer>{ @@ -84,8 +84,14 @@ public class DlbController extends BaseController<Dlb, Integer>{
84 84
85 85
86 @RequestMapping(value = "/obtain",method = RequestMethod.GET) 86 @RequestMapping(value = "/obtain",method = RequestMethod.GET)
87 - public Map<String, Object> obtain(@RequestParam Map<String, Object> map){  
88 - Map<String, Object> list=service.obtain(map); 87 + public Map<String, Object> obtain(@RequestParam Map<String, Object> map) throws Exception{
  88 + Map<String, Object> list=new HashMap<String, Object>();
  89 + try {
  90 + list = service.obtain(map);
  91 + } catch (Exception e) {
  92 + // TODO Auto-generated catch block
  93 + throw e;
  94 + }
89 return list; 95 return list;
90 } 96 }
91 97
src/main/java/com/bsth/controller/sys/IntervalController.java
@@ -9,12 +9,13 @@ import org.springframework.web.bind.annotation.RequestParam; @@ -9,12 +9,13 @@ import org.springframework.web.bind.annotation.RequestParam;
9 import org.springframework.web.bind.annotation.RestController; 9 import org.springframework.web.bind.annotation.RestController;
10 10
11 import com.alibaba.fastjson.JSON; 11 import com.alibaba.fastjson.JSON;
  12 +import com.bsth.controller.BaseController;
12 import com.bsth.entity.sys.Interval; 13 import com.bsth.entity.sys.Interval;
13 import com.bsth.service.sys.IntervalService; 14 import com.bsth.service.sys.IntervalService;
14 15
15 @RestController 16 @RestController
16 @RequestMapping("interval") 17 @RequestMapping("interval")
17 -public class IntervalController { 18 +public class IntervalController extends BaseController<Interval, Integer> {
18 19
19 @Autowired 20 @Autowired
20 IntervalService intervalService; 21 IntervalService intervalService;
src/main/java/com/bsth/data/schedule/SchAttrCalculator.java
@@ -198,6 +198,7 @@ public class SchAttrCalculator { @@ -198,6 +198,7 @@ public class SchAttrCalculator {
198 public ScheduleRealInfo calcCurrentExecSch(List<ScheduleRealInfo> list){ 198 public ScheduleRealInfo calcCurrentExecSch(List<ScheduleRealInfo> list){
199 String lineCode = list.get(0).getXlBm(); 199 String lineCode = list.get(0).getXlBm();
200 LineConfig conf = lineConfigData.get(lineCode); 200 LineConfig conf = lineConfigData.get(lineCode);
  201 + long t = System.currentTimeMillis();
201 int outConfig = -1; 202 int outConfig = -1;
202 //限定出站既出场的停车场 203 //限定出站既出场的停车场
203 String park = null; 204 String park = null;
@@ -221,8 +222,62 @@ public class SchAttrCalculator { @@ -221,8 +222,62 @@ public class SchAttrCalculator {
221 if(StringUtils.isNotEmpty(sch.getZdsjActual())) 222 if(StringUtils.isNotEmpty(sch.getZdsjActual()))
222 continue; 223 continue;
223 224
  225 + if(Math.abs((t - sch.getDfsjT())) > 1000 * 60 * 60){
  226 + //差值较大,倒着找看有没有更合适的
  227 + ScheduleRealInfo schReverse = calcCurrentExecSchReverse(list, outConfig, limitPark, park);
  228 + if(null != schReverse && !schReverse.getId().equals(sch.getId())){
  229 + logger.info("calc_current_exec_sch_reverse... -" + schReverse.getId());
  230 + return suitableExecSch(schReverse, sch, t);
  231 + }
  232 + }
224 return sch; 233 return sch;
225 } 234 }
226 return null; 235 return null;
227 } 236 }
  237 +
  238 + /**
  239 + * 反转匹配一个班次
  240 + * @param list
  241 + * @param outConfig
  242 + * @param limitPark
  243 + * @param park
  244 + * @return
  245 + */
  246 + private ScheduleRealInfo calcCurrentExecSchReverse(List<ScheduleRealInfo> list, int outConfig, boolean limitPark, String park){
  247 + ScheduleRealInfo near = null;
  248 + for(ScheduleRealInfo sch : list){
  249 + //如果是出站既出场,忽略出场班次
  250 + if(outConfig == 2 && isInout(sch)
  251 + && (!limitPark || park.equals(sch.getQdzCode()) || park.equals(sch.getZdzCode())))
  252 + continue;
  253 +
  254 + //忽略烂班
  255 + if(sch.isDestroy())
  256 + continue;
  257 +
  258 + if(StringUtils.isNotEmpty(sch.getZdsjActual())){
  259 + near = null;
  260 + continue;
  261 + }
  262 +
  263 + if(null == near)
  264 + near = sch;
  265 + }
  266 + return near;
  267 + }
  268 +
  269 + /**
  270 + * 比较2个班次,谁是指定时间更合适执行的
  271 + * @param schReverse
  272 + * @param sch
  273 + * @param t
  274 + * @return
  275 + */
  276 + private ScheduleRealInfo suitableExecSch(ScheduleRealInfo schReverse, ScheduleRealInfo sch, long t){
  277 + return Math.abs(t - schReverse.getDfsjT()) > Math.abs(t - sch.getDfsjT())?sch: schReverse;
  278 + }
  279 +
  280 + private boolean isInout(ScheduleRealInfo sch){
  281 + return sch.getBcType().equals("out") || sch.getBcType().equals("in");
  282 + }
228 } 283 }
src/main/java/com/bsth/entity/oil/Dlb.java
@@ -54,6 +54,7 @@ public class Dlb { @@ -54,6 +54,7 @@ public class Dlb {
54 private String edituser; 54 private String edituser;
55 private Date edittime; 55 private Date edittime;
56 private Date createtime; 56 private Date createtime;
  57 + private Date updatetime;
57 private int nylx; 58 private int nylx;
58 //进场顺序(根据最先出场和最后进场来关联车辆的存电量) 59 //进场顺序(根据最先出场和最后进场来关联车辆的存电量)
59 private int jcsx; 60 private int jcsx;
@@ -374,4 +375,14 @@ public class Dlb { @@ -374,4 +375,14 @@ public class Dlb {
374 public void setFgsname(String fgsname) { 375 public void setFgsname(String fgsname) {
375 this.fgsname = fgsname; 376 this.fgsname = fgsname;
376 } 377 }
  378 +
  379 + public Date getUpdatetime() {
  380 + return updatetime;
  381 + }
  382 +
  383 + public void setUpdatetime(Date updatetime) {
  384 + this.updatetime = updatetime;
  385 + }
  386 +
  387 +
377 } 388 }
src/main/java/com/bsth/entity/schedule/SchedulePlanInfo.java
@@ -3,6 +3,7 @@ package com.bsth.entity.schedule; @@ -3,6 +3,7 @@ package com.bsth.entity.schedule;
3 import com.bsth.entity.Line; 3 import com.bsth.entity.Line;
4 import com.bsth.service.schedule.rules.rerun.RerunRule_input; 4 import com.bsth.service.schedule.rules.rerun.RerunRule_input;
5 import com.bsth.service.schedule.rules.shiftloop.ScheduleResult_output; 5 import com.bsth.service.schedule.rules.shiftloop.ScheduleResult_output;
  6 +import com.bsth.service.schedule.rules.shiftloop.ScheduleRule_Type;
6 import org.apache.commons.lang3.StringUtils; 7 import org.apache.commons.lang3.StringUtils;
7 8
8 import javax.persistence.*; 9 import javax.persistence.*;
@@ -267,7 +268,8 @@ public class SchedulePlanInfo extends BEntity { @@ -267,7 +268,8 @@ public class SchedulePlanInfo extends BEntity {
267 List<EmployeeConfigInfo> employeeConfigInfoList, 268 List<EmployeeConfigInfo> employeeConfigInfoList,
268 SchedulePlan schedulePlan, 269 SchedulePlan schedulePlan,
269 boolean isFirstBc, // 是否第一个班次 270 boolean isFirstBc, // 是否第一个班次
270 - boolean isLastBc // 是否最后一个班次 271 + boolean isLastBc, // 是否最后一个班次
  272 + ScheduleRule_Type sType // 类型
271 ) { 273 ) {
272 274
273 // TODO:关联的公司名称 275 // TODO:关联的公司名称
@@ -294,47 +296,51 @@ public class SchedulePlanInfo extends BEntity { @@ -294,47 +296,51 @@ public class SchedulePlanInfo extends BEntity {
294 this.lpName = ttInfoDetail.getLp().getLpName(); 296 this.lpName = ttInfoDetail.getLp().getLpName();
295 297
296 // 关联的车辆信息 298 // 关联的车辆信息
297 - this.cl = carConfigInfo.getCl().getId(); // 车辆id  
298 - this.clZbh = carConfigInfo.getCl().getInsideCode(); // 自编号/内部编号 299 + if (sType == ScheduleRule_Type.NORMAL) {
  300 + this.cl = carConfigInfo.getCl().getId(); // 车辆id
  301 + this.clZbh = carConfigInfo.getCl().getInsideCode(); // 自编号/内部编号
  302 + }
299 303
300 // TODO:报道时间,出场时间没有 304 // TODO:报道时间,出场时间没有
301 // 关联的驾驶员 305 // 关联的驾驶员
302 - EmployeeConfigInfo employeeConfigInfo = null;  
303 - if (isFb) {  
304 - if (employeeConfigInfoList.size() > 1) {  
305 - employeeConfigInfo = employeeConfigInfoList.get(1); 306 + if (sType == ScheduleRule_Type.NORMAL) {
  307 + EmployeeConfigInfo employeeConfigInfo = null;
  308 + if (isFb) {
  309 + if (employeeConfigInfoList.size() > 1) {
  310 + employeeConfigInfo = employeeConfigInfoList.get(1);
  311 + } else {
  312 + employeeConfigInfo = employeeConfigInfoList.get(0);
  313 + }
306 } else { 314 } else {
307 employeeConfigInfo = employeeConfigInfoList.get(0); 315 employeeConfigInfo = employeeConfigInfoList.get(0);
308 } 316 }
309 - } else {  
310 - employeeConfigInfo = employeeConfigInfoList.get(0);  
311 - }  
312 317
313 - this.j = employeeConfigInfo.getJsy().getId(); 318 + this.j = employeeConfigInfo.getJsy().getId();
314 // this.jGh = employeeConfigInfo.getJsy().getJobCode(); 319 // this.jGh = employeeConfigInfo.getJsy().getJobCode();
315 - if (StringUtils.isNotEmpty(employeeConfigInfo.getJsy().getJobCode())) {  
316 - String[] jsy_temp = employeeConfigInfo.getJsy().getJobCode().split("-");  
317 - if (jsy_temp.length > 1) {  
318 - this.jGh = jsy_temp[1];  
319 - } else {  
320 - this.jGh = jsy_temp[0];  
321 - }  
322 - }  
323 - this.jName = employeeConfigInfo.getJsy().getPersonnelName();  
324 - // 关联的售票员  
325 - if (employeeConfigInfo.getSpy() != null) {  
326 - this.s = employeeConfigInfo.getSpy().getId();  
327 -// this.sGh = employeeConfigInfo.getSpy().getJobCode();  
328 - if (StringUtils.isNotEmpty(employeeConfigInfo.getSpy().getJobCode())) {  
329 - String[] spy_temp = employeeConfigInfo.getSpy().getJobCode().split("-");  
330 - if (spy_temp.length > 1) {  
331 - this.sGh = spy_temp[1]; 320 + if (StringUtils.isNotEmpty(employeeConfigInfo.getJsy().getJobCode())) {
  321 + String[] jsy_temp = employeeConfigInfo.getJsy().getJobCode().split("-");
  322 + if (jsy_temp.length > 1) {
  323 + this.jGh = jsy_temp[1];
332 } else { 324 } else {
333 - this.sGh = spy_temp[0]; 325 + this.jGh = jsy_temp[0];
334 } 326 }
335 } 327 }
  328 + this.jName = employeeConfigInfo.getJsy().getPersonnelName();
  329 + // 关联的售票员
  330 + if (employeeConfigInfo.getSpy() != null) {
  331 + this.s = employeeConfigInfo.getSpy().getId();
  332 +// this.sGh = employeeConfigInfo.getSpy().getJobCode();
  333 + if (StringUtils.isNotEmpty(employeeConfigInfo.getSpy().getJobCode())) {
  334 + String[] spy_temp = employeeConfigInfo.getSpy().getJobCode().split("-");
  335 + if (spy_temp.length > 1) {
  336 + this.sGh = spy_temp[1];
  337 + } else {
  338 + this.sGh = spy_temp[0];
  339 + }
  340 + }
336 341
337 - this.sName = employeeConfigInfo.getSpy().getPersonnelName(); 342 + this.sName = employeeConfigInfo.getSpy().getPersonnelName();
  343 + }
338 } 344 }
339 345
340 // 时刻明细数据 346 // 时刻明细数据
@@ -360,42 +366,44 @@ public class SchedulePlanInfo extends BEntity { @@ -360,42 +366,44 @@ public class SchedulePlanInfo extends BEntity {
360 this.remark = ttInfoDetail.getRemark(); 366 this.remark = ttInfoDetail.getRemark();
361 367
362 // 使用车辆配置的停车场信息 368 // 使用车辆配置的停车场信息
363 - String pzType = carConfigInfo.getPzType(); // 配置类型  
364 - if (pzType != null && !pzType.equals("BSY")) {  
365 - if ("ZW".equals(pzType)) { // 只看早晚进出场  
366 - if (isFirstBc) { // 第一个班次是出场 369 + if (sType == ScheduleRule_Type.NORMAL) {
  370 + String pzType = carConfigInfo.getPzType(); // 配置类型
  371 + if (pzType != null && !pzType.equals("BSY")) {
  372 + if ("ZW".equals(pzType)) { // 只看早晚进出场
  373 + if (isFirstBc) { // 第一个班次是出场
367 // this.qdz = carConfigInfo.getTcc().getId(); // 起点站-停车场id 374 // this.qdz = carConfigInfo.getTcc().getId(); // 起点站-停车场id
368 - this.qdzCode = carConfigInfo.getTcc().getParkCode(); // 起点站-停车场code  
369 - this.qdzName = carConfigInfo.getTcc().getParkName(); // 起点站-停车场name 375 + this.qdzCode = carConfigInfo.getTcc().getParkCode(); // 起点站-停车场code
  376 + this.qdzName = carConfigInfo.getTcc().getParkName(); // 起点站-停车场name
370 377
371 - this.jhlc = "0".equals(this.xlDir) ? carConfigInfo.getUpOutLc() : carConfigInfo.getDownOutLc();  
372 - this.bcsj = "0".equals(this.xlDir) ? carConfigInfo.getUpOutSj().intValue() : carConfigInfo.getDownOutSj().intValue(); 378 + this.jhlc = "0".equals(this.xlDir) ? carConfigInfo.getUpOutLc() : carConfigInfo.getDownOutLc();
  379 + this.bcsj = "0".equals(this.xlDir) ? carConfigInfo.getUpOutSj().intValue() : carConfigInfo.getDownOutSj().intValue();
373 380
374 - } else if (isLastBc) { // 最后一个班次是进场 381 + } else if (isLastBc) { // 最后一个班次是进场
375 // this.zdz = carConfigInfo.getTcc().getId(); // 终点站-停车场id 382 // this.zdz = carConfigInfo.getTcc().getId(); // 终点站-停车场id
376 - this.zdzCode = carConfigInfo.getTcc().getParkCode(); // 终点站-停车场code  
377 - this.zdzName = carConfigInfo.getTcc().getParkName(); // 终点站-停车场name 383 + this.zdzCode = carConfigInfo.getTcc().getParkCode(); // 终点站-停车场code
  384 + this.zdzName = carConfigInfo.getTcc().getParkName(); // 终点站-停车场name
378 385
379 - this.jhlc = "0".equals(this.xlDir) ? carConfigInfo.getUpInLc() : carConfigInfo.getDownInLc();  
380 - this.bcsj = "0".equals(this.xlDir) ? carConfigInfo.getUpInSj().intValue() : carConfigInfo.getDownInSj().intValue();  
381 - } 386 + this.jhlc = "0".equals(this.xlDir) ? carConfigInfo.getUpInLc() : carConfigInfo.getDownInLc();
  387 + this.bcsj = "0".equals(this.xlDir) ? carConfigInfo.getUpInSj().intValue() : carConfigInfo.getDownInSj().intValue();
  388 + }
382 389
383 - } else if ("FS".equals(pzType)) { // 所有进出场  
384 - if ("out".equals(this.bcType)) { // 出场班次 390 + } else if ("FS".equals(pzType)) { // 所有进出场
  391 + if ("out".equals(this.bcType)) { // 出场班次
385 // this.qdz = carConfigInfo.getTcc().getId(); // 起点站-停车场id 392 // this.qdz = carConfigInfo.getTcc().getId(); // 起点站-停车场id
386 - this.qdzCode = carConfigInfo.getTcc().getParkCode(); // 起点站-停车场code  
387 - this.qdzName = carConfigInfo.getTcc().getParkName(); // 起点站-停车场name 393 + this.qdzCode = carConfigInfo.getTcc().getParkCode(); // 起点站-停车场code
  394 + this.qdzName = carConfigInfo.getTcc().getParkName(); // 起点站-停车场name
388 395
389 - this.jhlc = "0".equals(this.xlDir) ? carConfigInfo.getUpOutLc() : carConfigInfo.getDownOutLc();  
390 - this.bcsj = "0".equals(this.xlDir) ? carConfigInfo.getUpOutSj().intValue() : carConfigInfo.getDownOutSj().intValue(); 396 + this.jhlc = "0".equals(this.xlDir) ? carConfigInfo.getUpOutLc() : carConfigInfo.getDownOutLc();
  397 + this.bcsj = "0".equals(this.xlDir) ? carConfigInfo.getUpOutSj().intValue() : carConfigInfo.getDownOutSj().intValue();
391 398
392 - } else if ("in".equals(this.bcType)) { 399 + } else if ("in".equals(this.bcType)) {
393 // this.zdz = carConfigInfo.getTcc().getId(); // 终点站-停车场id 400 // this.zdz = carConfigInfo.getTcc().getId(); // 终点站-停车场id
394 - this.zdzCode = carConfigInfo.getTcc().getParkCode(); // 终点站-停车场code  
395 - this.zdzName = carConfigInfo.getTcc().getParkName(); // 终点站-停车场name 401 + this.zdzCode = carConfigInfo.getTcc().getParkCode(); // 终点站-停车场code
  402 + this.zdzName = carConfigInfo.getTcc().getParkName(); // 终点站-停车场name
396 403
397 - this.jhlc = "0".equals(this.xlDir) ? carConfigInfo.getUpInLc() : carConfigInfo.getDownInLc();  
398 - this.bcsj = "0".equals(this.xlDir) ? carConfigInfo.getUpInSj().intValue() : carConfigInfo.getDownInSj().intValue(); 404 + this.jhlc = "0".equals(this.xlDir) ? carConfigInfo.getUpInLc() : carConfigInfo.getDownInLc();
  405 + this.bcsj = "0".equals(this.xlDir) ? carConfigInfo.getUpInSj().intValue() : carConfigInfo.getDownInSj().intValue();
  406 + }
399 } 407 }
400 } 408 }
401 } 409 }
src/main/java/com/bsth/entity/sys/Interval.java
@@ -39,11 +39,11 @@ public class Interval { @@ -39,11 +39,11 @@ public class Interval {
39 } 39 }
40 40
41 41
42 - public Integer getCreateBy() { 42 + public String getCreateBy() {
43 return createBy; 43 return createBy;
44 } 44 }
45 45
46 - public void setCreateBy(Integer createBy) { 46 + public void setCreateBy(String createBy) {
47 this.createBy = createBy; 47 this.createBy = createBy;
48 } 48 }
49 49
@@ -55,11 +55,11 @@ public class Interval { @@ -55,11 +55,11 @@ public class Interval {
55 this.createDate = createDate; 55 this.createDate = createDate;
56 } 56 }
57 57
58 - public Integer getUpdateBy() { 58 + public String getUpdateBy() {
59 return updateBy; 59 return updateBy;
60 } 60 }
61 61
62 - public void setUpdateBy(Integer updateBy) { 62 + public void setUpdateBy(String updateBy) {
63 this.updateBy = updateBy; 63 this.updateBy = updateBy;
64 } 64 }
65 65
@@ -75,13 +75,13 @@ public class Interval { @@ -75,13 +75,13 @@ public class Interval {
75 private Integer trough; 75 private Integer trough;
76 76
77 @Column(name = "create_by") 77 @Column(name = "create_by")
78 - private Integer createBy; 78 + private String createBy;
79 79
80 @Column(updatable = false, name = "create_date", columnDefinition = "TIMESTAMP DEFAULT CURRENT_TIMESTAMP") 80 @Column(updatable = false, name = "create_date", columnDefinition = "TIMESTAMP DEFAULT CURRENT_TIMESTAMP")
81 private Date createDate; 81 private Date createDate;
82 82
83 @Column(name = "update_by") 83 @Column(name = "update_by")
84 - private Integer updateBy; 84 + private String updateBy;
85 85
86 @Column(name = "update_date", columnDefinition = "timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP") 86 @Column(name = "update_date", columnDefinition = "timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP")
87 private Date updateDate; 87 private Date updateDate;
src/main/java/com/bsth/repository/oil/CwjyRepository.java
@@ -27,4 +27,8 @@ public interface CwjyRepository extends BaseRepository&lt;Cwjy, Integer&gt;{ @@ -27,4 +27,8 @@ public interface CwjyRepository extends BaseRepository&lt;Cwjy, Integer&gt;{
27 " ) c on a.nbbm=c.nbbm where a.nbbm like %?2% ",nativeQuery=true) 27 " ) c on a.nbbm=c.nbbm where a.nbbm like %?2% ",nativeQuery=true)
28 List<Object[]> obtainCwjycl(String rq,String nbbm); 28 List<Object[]> obtainCwjycl(String rq,String nbbm);
29 29
  30 + @Query(value="select * from bsth_c_cwjy where nbbm like %?1% and gsdm like %?2% and fgsdm like %?3%",nativeQuery=true)
  31 + List<Cwjy> selectAll(String nbbm,String gsdm,String fgsdm);
  32 +
  33 +
30 } 34 }
src/main/java/com/bsth/repository/schedule/ScheduleRule1FlatRepository.java
@@ -29,4 +29,6 @@ public interface ScheduleRule1FlatRepository extends BaseRepository&lt;ScheduleRule @@ -29,4 +29,6 @@ public interface ScheduleRule1FlatRepository extends BaseRepository&lt;ScheduleRule
29 ScheduleRule1Flat findOneExtend(Long aLong); 29 ScheduleRule1Flat findOneExtend(Long aLong);
30 30
31 List<ScheduleRule1Flat> findByXl(Line line); 31 List<ScheduleRule1Flat> findByXl(Line line);
  32 +
  33 + List<ScheduleRule1Flat> findByXlId(Integer id);
32 } 34 }
src/main/java/com/bsth/service/impl/StationServiceImpl.java
@@ -689,7 +689,7 @@ public class StationServiceImpl extends BaseServiceImpl&lt;Station, Integer&gt; implem @@ -689,7 +689,7 @@ public class StationServiceImpl extends BaseServiceImpl&lt;Station, Integer&gt; implem
689 String bJwpoints[] = stationNameList.get(k)[0].toString().split(" "); 689 String bJwpoints[] = stationNameList.get(k)[0].toString().split(" ");
690 Point p2 = new Point(Double.parseDouble(bJwpoints[0]),Double.parseDouble(bJwpoints[1])); 690 Point p2 = new Point(Double.parseDouble(bJwpoints[0]),Double.parseDouble(bJwpoints[1]));
691 double jl = GeoUtils.getDistance(p1, p2); 691 double jl = GeoUtils.getDistance(p1, p2);
692 - if(jl<=120d) { 692 + if(jl<=20d) {
693 rsM.put("id", stationNameList.get(k)[1]); 693 rsM.put("id", stationNameList.get(k)[1]);
694 temp = true; 694 temp = true;
695 break; 695 break;
src/main/java/com/bsth/service/impl/TrafficManageServiceImpl.java
@@ -20,10 +20,10 @@ import com.bsth.service.traffic.YgcBasicDataService; @@ -20,10 +20,10 @@ import com.bsth.service.traffic.YgcBasicDataService;
20 import com.bsth.util.TimeUtils; 20 import com.bsth.util.TimeUtils;
21 import com.bsth.util.db.DBUtils_MS; 21 import com.bsth.util.db.DBUtils_MS;
22 import com.bsth.webService.trafficManage.geotool.services.InternalPortType; 22 import com.bsth.webService.trafficManage.geotool.services.InternalPortType;
23 -import com.bsth.webService.trafficManage.geotool.services.Internal;  
24 import com.bsth.webService.trafficManage.org.tempuri.Results; 23 import com.bsth.webService.trafficManage.org.tempuri.Results;
25 import com.bsth.webService.trafficManage.org.tempuri.WebServiceLocator; 24 import com.bsth.webService.trafficManage.org.tempuri.WebServiceLocator;
26 import com.bsth.webService.trafficManage.org.tempuri.WebServiceSoap; 25 import com.bsth.webService.trafficManage.org.tempuri.WebServiceSoap;
  26 +import org.apache.commons.lang.StringEscapeUtils;
27 import org.apache.commons.lang.StringUtils; 27 import org.apache.commons.lang.StringUtils;
28 import org.apache.commons.lang.time.DateUtils; 28 import org.apache.commons.lang.time.DateUtils;
29 import org.slf4j.Logger; 29 import org.slf4j.Logger;
@@ -373,7 +373,7 @@ public class TrafficManageServiceImpl implements TrafficManageService{ @@ -373,7 +373,7 @@ public class TrafficManageServiceImpl implements TrafficManageService{
373 counter = 0; 373 counter = 0;
374 sf.append("</DLDS>"); 374 sf.append("</DLDS>");
375 str = sf.toString().replace("'","");// 去掉'号 375 str = sf.toString().replace("'","");// 去掉'号
376 - Results results = ssop.setLD(userNameOther, passwordOther, str); 376 + Results results = ssop.setLD(userNameOther, passwordOther, StringEscapeUtils.unescapeHtml(str));
377 if(results.isSuccess()){ 377 if(results.isSuccess()){
378 result = "success"; 378 result = "success";
379 }else{ 379 }else{
@@ -387,7 +387,7 @@ public class TrafficManageServiceImpl implements TrafficManageService{ @@ -387,7 +387,7 @@ public class TrafficManageServiceImpl implements TrafficManageService{
387 if(counter > 0){ 387 if(counter > 0){
388 sf.append("</DLDS>"); 388 sf.append("</DLDS>");
389 str = sf.toString().replace("'","");// 去掉'号 389 str = sf.toString().replace("'","");// 去掉'号
390 - Results results = ssop.setLD(userNameOther, passwordOther, str); 390 + Results results = ssop.setLD(userNameOther, passwordOther, StringEscapeUtils.unescapeHtml(str));
391 if(results.isSuccess()){ 391 if(results.isSuccess()){
392 result = "success"; 392 result = "success";
393 }else{ 393 }else{
@@ -413,7 +413,7 @@ public class TrafficManageServiceImpl implements TrafficManageService{ @@ -413,7 +413,7 @@ public class TrafficManageServiceImpl implements TrafficManageService{
413 String result = "failure"; 413 String result = "failure";
414 try { 414 try {
415 String tmp = readXmlFromFile("E:/ld.txt"); 415 String tmp = readXmlFromFile("E:/ld.txt");
416 - Results rss = ssop.setLD(userNameOther, passwordOther, tmp); 416 + Results rss = ssop.setLD(userNameOther, passwordOther, StringEscapeUtils.unescapeHtml(tmp));
417 if(rss.isSuccess()){ 417 if(rss.isSuccess()){
418 result = "success"; 418 result = "success";
419 } 419 }
@@ -435,7 +435,7 @@ public class TrafficManageServiceImpl implements TrafficManageService{ @@ -435,7 +435,7 @@ public class TrafficManageServiceImpl implements TrafficManageService{
435 private String readXmlFromFile(String fileName) throws Exception { 435 private String readXmlFromFile(String fileName) throws Exception {
436 StringBuffer sf = new StringBuffer(""); 436 StringBuffer sf = new StringBuffer("");
437 File file = new File(fileName); 437 File file = new File(fileName);
438 - InputStreamReader reader = new InputStreamReader(new FileInputStream(file),"utf-8"); 438 + InputStreamReader reader = new InputStreamReader(new FileInputStream(file),"GBK");
439 BufferedReader bufferedReader = new BufferedReader(reader); 439 BufferedReader bufferedReader = new BufferedReader(reader);
440 String lineTxt = ""; 440 String lineTxt = "";
441 while((lineTxt = bufferedReader.readLine()) != null){ 441 while((lineTxt = bufferedReader.readLine()) != null){
@@ -964,47 +964,14 @@ public class TrafficManageServiceImpl implements TrafficManageService{ @@ -964,47 +964,14 @@ public class TrafficManageServiceImpl implements TrafficManageService{
964 * 下载全量的公交基础数据 964 * 下载全量的公交基础数据
965 */ 965 */
966 public String getDownLoadAllDataFile() { 966 public String getDownLoadAllDataFile() {
967 - String result = "success"; 967 + String result = "failure";
968 try { 968 try {
969 - Runtime currRuntime = Runtime.getRuntime ();  
970 -  
971 - int nFreeMemory = ( int ) (currRuntime.freeMemory() / 1024 / 1024);  
972 -  
973 - int nTotalMemory = ( int ) (currRuntime.totalMemory() / 1024 / 1024);  
974 -  
975 - System.out.println("zzz:"+nFreeMemory + "M/" + nTotalMemory +"M(free/total)");  
976 - portType = new Internal().getInternalHttpSoap11Endpoint();  
977 - byte[] res = portType.downloadAllDataFile("down_pdgj", "down_pdgj123");  
978 - String filePath = "E:\\ygc";  
979 - BufferedOutputStream bos = null;  
980 - FileOutputStream fos = null;  
981 - File file = null;  
982 try { 969 try {
983 - File dir = new File(filePath);  
984 - if(!dir.exists()&&dir.isDirectory()){//判断文件目录是否存在  
985 - dir.mkdirs(); 970 + if(ygcBasicDataService.download("admin","000000","abc.zip")){
  971 + result = "success";
986 } 972 }
987 - file = new File(filePath+"\\abc.rar");  
988 - fos = new FileOutputStream(file);  
989 - bos = new BufferedOutputStream(fos);  
990 - bos.write(res);  
991 } catch (Exception e) { 973 } catch (Exception e) {
992 e.printStackTrace(); 974 e.printStackTrace();
993 - } finally {  
994 - if (bos != null) {  
995 - try {  
996 - bos.close();  
997 - } catch (IOException e1) {  
998 - e1.printStackTrace();  
999 - }  
1000 - }  
1001 - if (fos != null) {  
1002 - try {  
1003 - fos.close();  
1004 - } catch (IOException e1) {  
1005 - e1.printStackTrace();  
1006 - }  
1007 - }  
1008 } 975 }
1009 } catch (Exception e) { 976 } catch (Exception e) {
1010 e.printStackTrace(); 977 e.printStackTrace();
src/main/java/com/bsth/service/oil/DlbService.java
@@ -7,7 +7,7 @@ import com.bsth.entity.oil.Dlb; @@ -7,7 +7,7 @@ import com.bsth.entity.oil.Dlb;
7 import com.bsth.service.BaseService; 7 import com.bsth.service.BaseService;
8 8
9 public interface DlbService extends BaseService<Dlb, Integer>{ 9 public interface DlbService extends BaseService<Dlb, Integer>{
10 - Map<String, Object> obtain(Map<String, Object> map); 10 + Map<String, Object> obtain(Map<String, Object> map) throws Exception;
11 11
12 Map<String, Object> sort(Map<String, Object> map); 12 Map<String, Object> sort(Map<String, Object> map);
13 13
src/main/java/com/bsth/service/oil/impl/CwjyServiceImpl.java
@@ -26,6 +26,7 @@ import com.alibaba.fastjson.JSONObject; @@ -26,6 +26,7 @@ import com.alibaba.fastjson.JSONObject;
26 import com.bsth.common.ResponseCode; 26 import com.bsth.common.ResponseCode;
27 import com.bsth.entity.oil.Cwjy; 27 import com.bsth.entity.oil.Cwjy;
28 import com.bsth.entity.oil.Cyl; 28 import com.bsth.entity.oil.Cyl;
  29 +import com.bsth.entity.oil.Ylb;
29 import com.bsth.entity.oil.Ylxxb; 30 import com.bsth.entity.oil.Ylxxb;
30 import com.bsth.repository.oil.CwjyRepository; 31 import com.bsth.repository.oil.CwjyRepository;
31 import com.bsth.repository.oil.YlxxbRepository; 32 import com.bsth.repository.oil.YlxxbRepository;
@@ -280,7 +281,7 @@ public class CwjyServiceImpl extends BaseServiceImpl&lt;Cwjy,Integer&gt; implements Cw @@ -280,7 +281,7 @@ public class CwjyServiceImpl extends BaseServiceImpl&lt;Cwjy,Integer&gt; implements Cw
280 String gsdm=map.get("gsdm_like").toString(); 281 String gsdm=map.get("gsdm_like").toString();
281 282
282 String fgsdm=map.get("fgsdm_like").toString(); 283 String fgsdm=map.get("fgsdm_like").toString();
283 - String sql="SELECT a.gsdm as gsdm,a.fgsdm as fgsdm,a.nbbm as nbbm," 284 + /*String sql="SELECT a.gsdm as gsdm,a.fgsdm as fgsdm,a.nbbm as nbbm,"
284 + "b.jyggh as jyggh,b.jzl as jzl ,b.stationid as stationid,b.jsy as jsy," 285 + "b.jyggh as jyggh,b.jzl as jzl ,b.stationid as stationid,b.jsy as jsy,"
285 + "b.nylx as nylx,b.yj as yj,b.bz as bz,b.id as id ,c.jsy as ldgh FROM bsth_c_cwjy a "+ 286 + "b.nylx as nylx,b.yj as yj,b.bz as bz,b.id as id ,c.jsy as ldgh FROM bsth_c_cwjy a "+
286 " left join (" 287 " left join ("
@@ -293,7 +294,10 @@ public class CwjyServiceImpl extends BaseServiceImpl&lt;Cwjy,Integer&gt; implements Cw @@ -293,7 +294,10 @@ public class CwjyServiceImpl extends BaseServiceImpl&lt;Cwjy,Integer&gt; implements Cw
293 + " and ssgsdm='"+gsdm+"' and fgsdm ='"+fgsdm+"' group by nbbm "+ 294 + " and ssgsdm='"+gsdm+"' and fgsdm ='"+fgsdm+"' group by nbbm "+
294 " ) c on a.nbbm=c.nbbm " 295 " ) c on a.nbbm=c.nbbm "
295 + "where a.nbbm like '%"+nbbm+"%' and a.gsdm='"+gsdm+"' and a.fgsdm ='"+fgsdm+"'" 296 + "where a.nbbm like '%"+nbbm+"%' and a.gsdm='"+gsdm+"' and a.fgsdm ='"+fgsdm+"'"
296 - + " order by a.nbbm"; 297 + + " order by a.nbbm";*/
  298 + String sql= " select * from bsth_c_ylxxb b "
  299 + + "where to_days(b.yyrq)=to_days('"+rq+"') and jylx=1 "
  300 + + " and gsdm = '"+gsdm+"'";
297 301
298 List<Ylxxb> yList= jdbcTemplate.query(sql, 302 List<Ylxxb> yList= jdbcTemplate.query(sql,
299 new RowMapper<Ylxxb>(){ 303 new RowMapper<Ylxxb>(){
@@ -311,24 +315,67 @@ public class CwjyServiceImpl extends BaseServiceImpl&lt;Cwjy,Integer&gt; implements Cw @@ -311,24 +315,67 @@ public class CwjyServiceImpl extends BaseServiceImpl&lt;Cwjy,Integer&gt; implements Cw
311 t.setNylx(rs.getInt("nylx")); 315 t.setNylx(rs.getInt("nylx"));
312 t.setYj(rs.getDouble("yj")); 316 t.setYj(rs.getDouble("yj"));
313 t.setBz(rs.getString("bz")); 317 t.setBz(rs.getString("bz"));
314 - t.setLdgh(rs.getString("ldgh"));  
315 return t; 318 return t;
316 } 319 }
317 }); 320 });
318 - /*List<Ylxxb> list= ylxxbRepository.checkYlxx(rq, gsdm);  
319 - for (int i = 0; i < yList.size(); i++) {  
320 - Ylxxb t=yList.get(i);  
321 - Double zjzl=0.0;  
322 - for (int j = 0; j < list.size(); j++) {  
323 - Ylxxb y=list.get(j);  
324 - if(t.getNbbm().equals(y.getNbbm())){  
325 - zjzl=Arith.add(zjzl, y.getJzl()); 321 + List<Cwjy> cwList=repository.selectAll(nbbm, gsdm, fgsdm);
  322 + String sql_ylb="SELECT nbbm,group_concat(jsy) AS jsy FROM bsth_c_ylb WHERE "
  323 + + " to_days(rq) = to_days('"+rq+"') AND ssgsdm = '"+gsdm+"' AND "
  324 + + " fgsdm = '"+fgsdm+"' GROUP BY nbbm";
  325 +
  326 + List<Map<String, String>> ylbList= jdbcTemplate.query(sql_ylb,
  327 + new RowMapper<Map<String, String>>(){
  328 + @Override
  329 + public Map<String, String> mapRow(ResultSet rs, int rowNum) throws SQLException {
  330 + Map<String, String> maps =new HashMap<String, String>();
  331 + maps.put("nbbm", rs.getString("nbbm"));
  332 + maps.put("ldgh", rs.getString("jsy"));
  333 + return maps;
  334 + }
  335 + });
  336 +
  337 + List<Ylxxb> ylxxbList= new ArrayList<Ylxxb>();
  338 + Ylxxb y=null;
  339 + for (int i = 0; i < cwList.size(); i++) {
  340 + Cwjy cwjy=cwList.get(i);
  341 + if(cwjy.getNbbm().equals("W7B-092")){
  342 + System.out.println();
  343 + }
  344 + y=new Ylxxb();
  345 + y.setNylx(0);
  346 + y.setId(0);
  347 + y.setJzl(0.0);
  348 + y.setGsdm(cwjy.getGsdm());
  349 + y.setFgsdm(cwjy.getFgsdm());
  350 + y.setNbbm(cwjy.getNbbm());
  351 + for (int j = 0; j < yList.size(); j++) {
  352 + Ylxxb ylxxb=yList.get(j);
  353 + if(y.getNbbm().equals(ylxxb.getNbbm())){
  354 + y.setId(ylxxb.getId());
  355 + y.setJyggh(ylxxb.getJyggh());
  356 + y.setJsy(ylxxb.getJsy());
  357 + y.setJzl(ylxxb.getJzl());
  358 + y.setStationid(ylxxb.getStationid());
  359 + y.setNylx(ylxxb.getNylx());
  360 + y.setYj(ylxxb.getYj());
  361 + y.setBz(ylxxb.getBz());
  362 + break;
  363 + }
  364 + }
  365 + for (int j = 0; j < ylbList.size(); j++) {
  366 + Map<String, String> m=ylbList.get(j);
  367 + if(m.get("nbbm").toString().equals(cwjy.getNbbm())){
  368 + y.setLdgh(m.get("ldgh").toString());
  369 + break;
326 } 370 }
327 371
328 } 372 }
329 - t.setZjzl(zjzl);  
330 - }*/  
331 - return yList; 373 +
  374 + ylxxbList.add(y);
  375 +
  376 + }
  377 +
  378 + return ylxxbList;
332 } 379 }
333 380
334 @Override 381 @Override
src/main/java/com/bsth/service/oil/impl/DlbServiceImpl.java
@@ -2,6 +2,8 @@ package com.bsth.service.oil.impl; @@ -2,6 +2,8 @@ package com.bsth.service.oil.impl;
2 2
3 3
4 4
  5 +import java.sql.ResultSet;
  6 +import java.sql.SQLException;
5 import java.text.DecimalFormat; 7 import java.text.DecimalFormat;
6 import java.text.ParseException; 8 import java.text.ParseException;
7 import java.text.SimpleDateFormat; 9 import java.text.SimpleDateFormat;
@@ -22,6 +24,7 @@ import org.springframework.beans.factory.annotation.Autowired; @@ -22,6 +24,7 @@ import org.springframework.beans.factory.annotation.Autowired;
22 import org.springframework.data.domain.Sort; 24 import org.springframework.data.domain.Sort;
23 import org.springframework.data.domain.Sort.Direction; 25 import org.springframework.data.domain.Sort.Direction;
24 import org.springframework.jdbc.core.JdbcTemplate; 26 import org.springframework.jdbc.core.JdbcTemplate;
  27 +import org.springframework.jdbc.core.RowMapper;
25 import org.springframework.stereotype.Service; 28 import org.springframework.stereotype.Service;
26 29
27 import com.alibaba.fastjson.JSONArray; 30 import com.alibaba.fastjson.JSONArray;
@@ -211,7 +214,7 @@ public class DlbServiceImpl extends BaseServiceImpl&lt;Dlb,Integer&gt; implements DlbS @@ -211,7 +214,7 @@ public class DlbServiceImpl extends BaseServiceImpl&lt;Dlb,Integer&gt; implements DlbS
211 * 获取进存电信息 214 * 获取进存电信息
212 * @Transactional 回滚事物 215 * @Transactional 回滚事物
213 */ 216 */
214 - @Transactional 217 + /*@Transactional
215 @Override 218 @Override
216 public Map<String, Object> obtain(Map<String, Object> map2) { 219 public Map<String, Object> obtain(Map<String, Object> map2) {
217 List<Cars> carsList=carsRepository.findCars(); 220 List<Cars> carsList=carsRepository.findCars();
@@ -224,6 +227,16 @@ public class DlbServiceImpl extends BaseServiceImpl&lt;Dlb,Integer&gt; implements DlbS @@ -224,6 +227,16 @@ public class DlbServiceImpl extends BaseServiceImpl&lt;Dlb,Integer&gt; implements DlbS
224 if(map2.get("ssgsdm_like")!=null){ 227 if(map2.get("ssgsdm_like")!=null){
225 gsbm=map2.get("ssgsdm_like").toString(); 228 gsbm=map2.get("ssgsdm_like").toString();
226 } 229 }
  230 +
  231 + String nbbm="";
  232 + if(map2.get("nbbm_eq")!=null){
  233 + nbbm=map2.get("nbbm_eq").toString();
  234 + }
  235 + String fgsbm="";
  236 + if(map2.get("fgsdm_like")!=null){
  237 + fgsbm=map2.get("fgsdm_like").toString();
  238 + }
  239 +
227 String rq=map2.get("rq").toString(); 240 String rq=map2.get("rq").toString();
228 String line=""; 241 String line="";
229 if(map2.get("xlbm_eq")!=null){ 242 if(map2.get("xlbm_eq")!=null){
@@ -236,16 +249,16 @@ public class DlbServiceImpl extends BaseServiceImpl&lt;Dlb,Integer&gt; implements DlbS @@ -236,16 +249,16 @@ public class DlbServiceImpl extends BaseServiceImpl&lt;Dlb,Integer&gt; implements DlbS
236 // TODO Auto-generated method stub 249 // TODO Auto-generated method stub
237 Map<String, Object> newMap=new HashMap<String,Object>(); 250 Map<String, Object> newMap=new HashMap<String,Object>();
238 //当天DLB信息 251 //当天DLB信息
239 - List<Dlb> dlList=repository.obtainDl(rq, gsbm, "", line, "", "nbbm"); 252 + List<Dlb> dlList=repository.obtainDl(rq, gsbm, fgsbm, line, nbbm, "nbbm");
240 //当天YLXXB信息 253 //当天YLXXB信息
241 List<Ylxxb> ylxxList=ylxxbRepository.obtainYlxx(rq,1,gsbm); 254 List<Ylxxb> ylxxList=ylxxbRepository.obtainYlxx(rq,1,gsbm);
242 //当天加电信息表 255 //当天加电信息表
243 List<Jdl> jdlList=jdlRepository.JdlList(rq); 256 List<Jdl> jdlList=jdlRepository.JdlList(rq);
244 //前一天所有车辆最后进场班次信息 257 //前一天所有车辆最后进场班次信息
245 - List<Dlb> dlListBe=repository.obtainYlbefore(rq, "", "", "", ""); 258 + List<Dlb> dlListBe=repository.obtainYlbefore(rq, gsbm, fgsbm, line, nbbm);
246 List<Cdl> cdyList=cdlRepository.obtainCdl(); 259 List<Cdl> cdyList=cdlRepository.obtainCdl();
247 //从排班表中计算出行驶的总里程 260 //从排班表中计算出行驶的总里程
248 - List<Map<String,Object>> listpb=scheduleRealInfoService.yesterdayDataList(line,rq,"","","",""); 261 + List<Map<String,Object>> listpb=scheduleRealInfoService.yesterdayDataList(line, rq, gsbm, fgsbm, "", nbbm);
249 List<Dlb> addList=new ArrayList<Dlb>(); 262 List<Dlb> addList=new ArrayList<Dlb>();
250 List<Dlb> updateList=new ArrayList<Dlb>(); 263 List<Dlb> updateList=new ArrayList<Dlb>();
251 for(int x=0;x<listpb.size();x++){ 264 for(int x=0;x<listpb.size();x++){
@@ -371,6 +384,240 @@ public class DlbServiceImpl extends BaseServiceImpl&lt;Dlb,Integer&gt; implements DlbS @@ -371,6 +384,240 @@ public class DlbServiceImpl extends BaseServiceImpl&lt;Dlb,Integer&gt; implements DlbS
371 newMap.put("status", ResponseCode.ERROR); 384 newMap.put("status", ResponseCode.ERROR);
372 } 385 }
373 return newMap; 386 return newMap;
  387 + }*/
  388 +
  389 + /**
  390 + * 获取进存油信息
  391 + * @Transactional 回滚事物
  392 + */
  393 + @Transactional
  394 + @Override
  395 + public Map<String, Object> obtain(Map<String, Object> map2) throws Exception{
  396 + Map<String, Object> newMap = new HashMap<String, Object>();
  397 + try {
  398 + Date date=new Date();
  399 + List<Cars> carsList = carsRepository.findCars();
  400 + Map<String, Boolean> carsMap = new HashMap<String, Boolean>();
  401 + for (int i = 0; i < carsList.size(); i++) {
  402 + Cars c = carsList.get(i);
  403 + carsMap.put(c.getInsideCode(), c.getSfdc());
  404 + }
  405 + String rq = map2.get("rq").toString();
  406 + String line = "";
  407 + if (map2.get("xlbm_like") != null) {
  408 + line = map2.get("xlbm_like").toString().trim();
  409 + }
  410 + String gsbm="";
  411 + if(map2.get("ssgsdm_like")!=null){
  412 + gsbm=map2.get("ssgsdm_like").toString();
  413 + }
  414 + String fgsbm="";
  415 + if(map2.get("fgsdm_like")!=null){
  416 + fgsbm=map2.get("fgsdm_like").toString();
  417 + }
  418 + String nbbm="";
  419 + if(map2.get("nbbm_eq")!=null){
  420 + nbbm=map2.get("nbbm_eq").toString();
  421 + }
  422 + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
  423 + // 保留两位小数
  424 + DecimalFormat df = new DecimalFormat("#.00");
  425 + // TODO Auto-generated method stub
  426 + // 当天YLB信息
  427 + List<Dlb> dlList = this.listOrderBy(rq,gsbm,fgsbm,line,nbbm,"nbbm");
  428 +// repository.obtainYl(rq,gsbm,fgsbm,line,nbbm,"nbbm");
  429 + // 当天YLXXB信息
  430 + List<Ylxxb> ylxxList = ylxxbRepository.obtainYlxx(rq, 0,gsbm);
  431 + // 前一天所有车辆最后进场班次信息
  432 +// List<Ylb> ylListBe = repository.obtainYlbefore(rq, gsbm, fgsbm, line, nbbm);
  433 +// List<Dlb> ylListBe =repository.listMaxRqJcsx(rq, gsbm, fgsbm, line, nbbm);
  434 +// List<Cyl> clyList = cylRepository.obtainCyl(nbbm,gsbm);
  435 + // 从排班表中计算出行驶的总里程
  436 + List<Map<String, Object>> listpb =new ArrayList<Map<String, Object>>();
  437 + List<Map<String, Object>> listpbs=scheduleRealInfoService.yesterdayDataList(line, rq, gsbm, fgsbm, "", nbbm);
  438 + List<Jdl> jdlList=jdlRepository.JdlList(rq);
  439 + String sxtj=map2.get("sxtj").toString();
  440 + if(sxtj.equals("0")){
  441 + listpb=listpbs;
  442 + }else{
  443 + List<Object[]> objectLists=repository.checkNbmmNum(rq, gsbm, fgsbm, line,nbbm);
  444 + List<String> stringList=new ArrayList<String>();
  445 + for (int i = 0; i < objectLists.size(); i++) {
  446 + String clbm=objectLists.get(i)[0].toString();
  447 + int cs=Integer.parseInt(objectLists.get(i)[1].toString());
  448 + //一车一单
  449 + if(sxtj.equals("1")){
  450 + if(cs==1){
  451 + stringList.add(clbm);
  452 + }
  453 + }
  454 + //一车多单
  455 + if(sxtj.equals("2")){
  456 + if(cs>1){
  457 + stringList.add(clbm);
  458 + }
  459 + }
  460 + }
  461 +
  462 + for (int i = 0; i < stringList.size(); i++) {
  463 + String strNbbm=stringList.get(i);
  464 + for (int j = 0; j < listpbs.size(); j++) {
  465 + Map<String, Object> map = listpbs.get(j);
  466 + String mapNbbm=map.get("clZbh").toString();
  467 + if(strNbbm.equals(mapNbbm)){
  468 + listpb.add(map);
  469 + }
  470 + }
  471 + }
  472 + }
  473 +
  474 + List<Dlb> addList = new ArrayList<Dlb>();
  475 + List<Dlb> updateList = new ArrayList<Dlb>();
  476 + String ins="";
  477 + Map<String, Object> ylMap=new HashMap<String, Object>();
  478 + for (int x = 0; x < listpb.size(); x++) {
  479 + String type = "add";
  480 + boolean sfdc = false;
  481 + Map<String, Object> map = listpb.get(x);
  482 + if (carsMap.get(map.get("clZbh").toString()) != null) {
  483 + sfdc = carsMap.get(map.get("clZbh").toString());
  484 + } else {
  485 + sfdc = false;
  486 + }
  487 + if (sfdc) {
  488 + // 判断驾驶员驾驶的该车辆是否已经存入了(查出的结果集中日期是相同的,根据驾驶员、内部编号、线路编码判断)
  489 + Dlb t = new Dlb();
  490 + for (int k = 0; k < dlList.size(); k++) {
  491 + Dlb t1 = dlList.get(k);
  492 + if (t1.getNbbm().equals(map.get("clZbh").toString())
  493 + && t1.getJsy().equals(map.get("jGh").toString())
  494 + && t1.getXlbm().equals(map.get("xlBm").toString())) {
  495 + t = t1;
  496 + type = "update";
  497 + }
  498 + }
  499 +
  500 + // 当日的第一个班次,出场油量等于前一天的最后一个班次的进场油量
  501 + /* if (map.get("seqNumber").toString().equals("1")) {
  502 + boolean fage = true;
  503 + for (int i = 0; i < ylListBe.size(); i++) {
  504 + Ylb ylb = ylListBe.get(i);
  505 + if (map.get("clZbh").toString().equals(ylb.getNbbm())) {
  506 + if(ylb.getJzyl()>0){
  507 + t.setCzyl(ylb.getJzyl());
  508 + fage = false;
  509 + break;
  510 + }
  511 +
  512 + }
  513 + }
  514 + if (fage) {
  515 + for (int y = 0; y < clyList.size(); y++) {
  516 + Cyl cyl = clyList.get(y);
  517 + if (map.get("clZbh").toString().equals(cyl.getNbbm())) {
  518 + if(cyl!=null){
  519 + if(cyl.getCyl()>=0){
  520 + t.setCzyl(cyl.getCyl());
  521 + fage = false;
  522 + break;
  523 + }else {
  524 + if(cyl.getCxrl()!=null){
  525 + if(cyl.getCxrl()>0){
  526 + t.setCzyl(cyl.getCxrl());
  527 + fage = false;
  528 + break;
  529 + }
  530 + }
  531 + }
  532 + }
  533 + }
  534 + }
  535 + }
  536 + if (fage) {
  537 + t.setCzyl(0.0);
  538 + }
  539 + }
  540 + */
  541 + Double jzl = 0.0;
  542 + //一人一车加注量只匹配一次
  543 + if(ylMap.get(map.get("clZbh").toString()+"_"+ map.get("jGh").toString())!=null){
  544 +
  545 + }else{
  546 + // 把当天的YLXXB的加注量设置为当天YLB的加注量(根据车号,驾驶员判断)
  547 + for (int j = 0; j < ylxxList.size(); j++) {
  548 + Ylxxb ylxxb = ylxxList.get(j);
  549 + if (map.get("clZbh").toString().equals(ylxxb.getNbbm())
  550 + && map.get("jGh").toString().equals(ylxxb.getJsy())) {
  551 + jzl +=Arith.add(jzl, ylxxb.getJzl());
  552 + }
  553 + }
  554 + ylMap.put(map.get("clZbh").toString()+"_"+ map.get("jGh").toString(),map.get("xlBm") == null ? "" : map.get("xlBm").toString());
  555 + }
  556 + for (int i = 0; i < jdlList.size(); i++) {
  557 + Jdl jdl=jdlList.get(i);
  558 + if(map.get("clZbh").toString().equals(jdl.getNbbm())
  559 + &&map.get("jGh").toString().equals(jdl.getJsy())
  560 + &&map.get("bCompany").toString().equals(jdl.getFgsBm())){
  561 + jzl+=jdl.getJdl();
  562 + }
  563 + }
  564 +
  565 + t.setCdl(jzl);
  566 + t.setCzcd(100.0);
  567 + t.setJzcd(100.0);
  568 + t.setHd(jzl);
  569 + t.setNbbm(map.get("clZbh").toString());
  570 + t.setJsy(map.get("jGh") == null ? "" : map.get("jGh").toString());
  571 + t.setZlc(map.get("totalKilometers") == null ? 0.0
  572 + : Double.parseDouble(map.get("totalKilometers").toString()));
  573 + t.setXlbm(map.get("xlBm") == null ? "" : map.get("xlBm").toString());
  574 + t.setJcsx(Integer.parseInt(map.get("seqNumber").toString()));
  575 + t.setSsgsdm(map.get("company") == null ? "" : map.get("company").toString());
  576 + t.setFgsdm(map.get("bCompany") == null ? "" : map.get("bCompany").toString());
  577 + t.setJhsj(map.get("fcsj")==null?"":map.get("fcsj").toString());
  578 + t.setRq(sdf.parse(rq));
  579 +
  580 + if(!(t.getSsgsdm().equals("") || t.getFgsdm().equals(""))){
  581 + if(type.equals("add")){
  582 + t.setCreatetime(date);
  583 + addList.add(t);
  584 + }else{
  585 + t.setUpdatetime(date);
  586 + updateList.add(t);
  587 + ins += t.getId().toString()+",";
  588 + }
  589 + }
  590 +// repository.save(t);
  591 + newMap.put("status", ResponseCode.SUCCESS);
  592 +
  593 + }
  594 + }
  595 + if(addList.size()>0){
  596 + try {
  597 + new BatchSaveUtils<Dlb>().saveList2(addList, Dlb.class);
  598 + } catch (Exception e) {
  599 + // TODO: handle exception
  600 + if(e.getMessage().indexOf("PK_YLB_UK")>0){
  601 + newMap.put("fage", "存在相同数据,数据已经过滤");
  602 + logger.info("获取:存在相同数据,数据已经过滤");
  603 + }
  604 + }
  605 +
  606 + }
  607 +
  608 + if(updateList.size()>0){
  609 + for (int i = 0; i < updateList.size(); i++) {
  610 + repository.save(updateList.get(i));
  611 + }
  612 + }
  613 + newMap.put("status", ResponseCode.SUCCESS);
  614 + } catch (Exception e) {
  615 + // TODO Auto-generated catch block
  616 + newMap.put("status", ResponseCode.ERROR);
  617 + throw e;
  618 + }
  619 +
  620 + return newMap;
374 } 621 }
375 622
376 /** 623 /**
@@ -727,4 +974,43 @@ public class DlbServiceImpl extends BaseServiceImpl&lt;Dlb,Integer&gt; implements DlbS @@ -727,4 +974,43 @@ public class DlbServiceImpl extends BaseServiceImpl&lt;Dlb,Integer&gt; implements DlbS
727 } 974 }
728 return newMap; 975 return newMap;
729 } 976 }
  977 +
  978 + public List<Dlb> listOrderBy(String rq,String gsdm,
  979 + String fgsdm,String xlbm,String nbbm,
  980 + String px) {
  981 + // TODO Auto-generated method stub
  982 + String sql="SELECT * FROM bsth_c_dlb "
  983 + + " where to_days('"+rq+"')=to_days(rq) and ssgsdm like '%"+gsdm+"%' "
  984 + + " and fgsdm like '%"+fgsdm+"%'";
  985 + if(xlbm.equals("")){
  986 + sql+= " and xlbm like '%"+xlbm+"%' ";
  987 + }else{
  988 + sql+= " and xlbm = '"+xlbm+"' ";
  989 + }
  990 +
  991 + sql += "and nbbm like '%"+nbbm+"%' order by "+px+" asc ";
  992 +
  993 + List<Dlb> list = jdbcTemplate.query(sql, new RowMapper<Dlb>() {
  994 + @Override
  995 + public Dlb mapRow(ResultSet arg0, int arg1) throws SQLException {
  996 + Dlb y = new Dlb();
  997 + y.setId(arg0.getInt("id"));
  998 + return y;
  999 + }
  1000 + });
  1001 + List<Dlb> lists=new ArrayList<Dlb>();
  1002 + List<Dlb> dlbLists=repository.obtainDl(rq,gsdm,fgsdm,xlbm,nbbm,"jcsx");
  1003 + for (int i = 0; i < list.size(); i++) {
  1004 + Dlb t=list.get(i);
  1005 + for (int j = 0; j < dlbLists.size(); j++) {
  1006 + Dlb t2=dlbLists.get(j);
  1007 + if(t.getId().intValue()==t2.getId().intValue()){
  1008 + lists.add(t2);
  1009 + break;
  1010 + }
  1011 + }
  1012 + }
  1013 +
  1014 + return lists;
  1015 + }
730 } 1016 }
src/main/java/com/bsth/service/oil/impl/YlbServiceImpl.java
@@ -871,15 +871,48 @@ public class YlbServiceImpl extends BaseServiceImpl&lt;Ylb,Integer&gt; implements YlbS @@ -871,15 +871,48 @@ public class YlbServiceImpl extends BaseServiceImpl&lt;Ylb,Integer&gt; implements YlbS
871 List<Ylb> ylListBe=repository.listMaxRqJcsx(rq, gsbm, fgsbm, xlbm, nbbm); 871 List<Ylb> ylListBe=repository.listMaxRqJcsx(rq, gsbm, fgsbm, xlbm, nbbm);
872 List<Ylb> ylbList=this.listOrderBy(rq,gsbm,fgsbm,xlbm,nbbm,"nbbm"); 872 List<Ylb> ylbList=this.listOrderBy(rq,gsbm,fgsbm,xlbm,nbbm,"nbbm");
873 // repository.obtainYl(rq,gsbm,fgsbm,xlbm,nbbm,"nbbm"); 873 // repository.obtainYl(rq,gsbm,fgsbm,xlbm,nbbm,"nbbm");
874 - List<Ylxxb> ylxxbList=ylxxbRepository.obtainYlxx(rq,0,gsbm); 874 +// List<Ylxxb> ylxxbList=ylxxbRepository.obtainYlxx(rq,0,gsbm);
  875 + String sql="select * from bsth_c_ylxxb where yyrq='"+rq+"' "
  876 + + " and gsdm ='"+gsbm+"' and nylx ='0' and nbbm "
  877 + + " not in ( select nbbm from bsth_c_ylb "
  878 + + " where DATE_FORMAT(rq,'%Y-%m-%d')='"+rq+"' "
  879 + + " and ssgsdm='"+gsbm+"' and fgsdm ='"+fgsbm+"')"
  880 + + " and nbbm in (select inside_code from "
  881 + + " bsth_c_cars where business_code ='"+gsbm+"' "
  882 + + " and branche_company_code='"+fgsbm+"')";
  883 +
  884 + List<Ylxxb> ylxxbList=jdbcTemplate.query(sql,
  885 + new RowMapper<Ylxxb>(){
  886 + @Override
  887 + public Ylxxb mapRow(ResultSet rs, int rowNum) throws SQLException {
  888 + Ylxxb s = new Ylxxb();
  889 + s.setId(rs.getInt("id"));
  890 + s.setYyrq(rs.getDate("yyrq"));
  891 + s.setNbbm(rs.getString("nbbm"));
  892 + s.setGsdm(rs.getString("gsdm"));
  893 + s.setFgsdm(rs.getString("fgsdm"));
  894 + s.setJsy(rs.getString("jsy"));
  895 + s.setJzl(rs.getDouble("jzl"));
  896 + s.setStationid(rs.getString("stationid"));
  897 + s.setNylx(rs.getInt("nylx"));
  898 + s.setJyggh(rs.getString("jyggh"));
  899 + s.setYj(rs.getDouble("yj"));
  900 +// s.setLdgh(rs.getString("ldgh"));
  901 + s.setBz(rs.getString("bz"));
  902 + return s;
  903 + }
  904 + });
875 for (int i = 0; i < ylxxbList.size(); i++) { 905 for (int i = 0; i < ylxxbList.size(); i++) {
876 - Boolean fage=true; 906 + Boolean fage=false;
877 Ylxxb y1=ylxxbList.get(i); 907 Ylxxb y1=ylxxbList.get(i);
878 - for(int y=0;y<ylbList.size();y++){  
879 - Ylb y2=ylbList.get(y);  
880 - if(y1.getNbbm().equals(y2.getNbbm())){  
881 - fage=false;  
882 - break; 908 + Line line=BasicData.nbbm2LineMap.get(y1.getNbbm());
  909 + if(null !=line){
  910 + if(!xlbm.equals("")){
  911 + if(line.getLineCode().equals(xlbm)){
  912 + fage=true;
  913 + }
  914 + }else{
  915 + fage=true;
883 } 916 }
884 } 917 }
885 918
@@ -896,7 +929,6 @@ public class YlbServiceImpl extends BaseServiceImpl&lt;Ylb,Integer&gt; implements YlbS @@ -896,7 +929,6 @@ public class YlbServiceImpl extends BaseServiceImpl&lt;Ylb,Integer&gt; implements YlbS
896 } 929 }
897 t.setFgsdm(fgsdm); 930 t.setFgsdm(fgsdm);
898 t.setJcsx(1); 931 t.setJcsx(1);
899 - Line line= BasicData.nbbm2LineMap.get(y1.getNbbm());  
900 if(null !=line){ 932 if(null !=line){
901 t.setXlbm(line.getLineCode()); 933 t.setXlbm(line.getLineCode());
902 }else{ 934 }else{
@@ -929,12 +961,6 @@ public class YlbServiceImpl extends BaseServiceImpl&lt;Ylb,Integer&gt; implements YlbS @@ -929,12 +961,6 @@ public class YlbServiceImpl extends BaseServiceImpl&lt;Ylb,Integer&gt; implements YlbS
929 logger.info("核对有存油没里程:存在相同数据,数据已经过滤"); 961 logger.info("核对有存油没里程:存在相同数据,数据已经过滤");
930 } 962 }
931 } 963 }
932 -  
933 - /*if(null!=cyl){  
934 - cyl.setCyl(Arith.add(t.getJzl(), t.getCzyl()));  
935 - cyl.setUpdatetime(y1.getYyrq());  
936 - cylRepository.save(cyl);  
937 - }*/  
938 } 964 }
939 } 965 }
940 } 966 }
src/main/java/com/bsth/service/oil/impl/YlxxbServiceImpl.java
@@ -49,14 +49,20 @@ public class YlxxbServiceImpl extends BaseServiceImpl&lt;Ylxxb,Integer&gt; implements @@ -49,14 +49,20 @@ public class YlxxbServiceImpl extends BaseServiceImpl&lt;Ylxxb,Integer&gt; implements
49 String rq=map.get("yyrq").toString(); 49 String rq=map.get("yyrq").toString();
50 String gsdm=map.get("gsdm_like").toString(); 50 String gsdm=map.get("gsdm_like").toString();
51 String fgsdm=map.get("fgsdm_like").toString(); 51 String fgsdm=map.get("fgsdm_like").toString();
52 - /*  
53 - String sql=" select x.*,y.jsy as ldgh,y.fgsdm as fgsdm from bsth_c_ylxxb x "  
54 - + " left join bsth_c_ylb y on x.nbbm = y.nbbm and x.jsy !=y.jsy "  
55 - + " where DATE_FORMAT(y.rq,'%Y-%m-%d')='"+rq+"' and y.ssgsdm='"+gsdm+"' "  
56 - + " and y.fgsdm='"+fgsdm+"' and DATE_FORMAT(x.yyrq,'%Y-%m-%d')='"+rq+"' "  
57 - + " and x.gsdm='"+gsdm+"'";*/  
58 52
59 - String sql= "select v.*,u.jsy as ldgh from " 53 + String sql=" select * from ("
  54 + + "select *,CONCAT(nbbm,jsy) as nj "
  55 + + " from bsth_c_ylxxb where yyrq='"+rq+"' "
  56 + + " and gsdm ='"+gsdm+"') x where x.nj not in ("
  57 + + " select CONCAT(nbbm,jsy) from bsth_c_ylb "
  58 + + " where DATE_FORMAT(rq,'%Y-%m-%d')='"+rq+"'"
  59 + + " and ssgsdm='"+gsdm+"' and fgsdm ='"+fgsdm+"')"
  60 + + " and x.nbbm in (select nbbm from bsth_c_ylb "
  61 + + " where DATE_FORMAT(rq,'%Y-%m-%d')='"+rq+"'"
  62 + + " and ssgsdm='"+gsdm+"' and fgsdm ='"+fgsdm+"')";
  63 +
  64 +
  65 + /*String sql= "select v.*,u.jsy as ldgh from "
60 + " ( select * from bsth_c_ylxxb x where " 66 + " ( select * from bsth_c_ylxxb x where "
61 + " DATE_FORMAT(x.yyrq,'%Y-%m-%d')='"+rq+"' and x.gsdm='"+gsdm+"'" 67 + " DATE_FORMAT(x.yyrq,'%Y-%m-%d')='"+rq+"' and x.gsdm='"+gsdm+"'"
62 + " and x.jsy not in (" 68 + " and x.jsy not in ("
@@ -69,7 +75,7 @@ public class YlxxbServiceImpl extends BaseServiceImpl&lt;Ylxxb,Integer&gt; implements @@ -69,7 +75,7 @@ public class YlxxbServiceImpl extends BaseServiceImpl&lt;Ylxxb,Integer&gt; implements
69 + " left join (select * from bsth_c_ylb " 75 + " left join (select * from bsth_c_ylb "
70 + " where DATE_FORMAT(rq,'%Y-%m-%d')='"+rq+"'" 76 + " where DATE_FORMAT(rq,'%Y-%m-%d')='"+rq+"'"
71 + " and ssgsdm='"+gsdm+"' and fgsdm='"+fgsdm+"' ) u " 77 + " and ssgsdm='"+gsdm+"' and fgsdm='"+fgsdm+"' ) u "
72 - + " on v.nbbm=u.nbbm "; 78 + + " on v.nbbm=u.nbbm ";*/
73 79
74 //根具条件查询指定日期Ylxxb的数据 80 //根具条件查询指定日期Ylxxb的数据
75 // List<Ylxxb> iterator=repository.checkYlxx(rq,gsdm); 81 // List<Ylxxb> iterator=repository.checkYlxx(rq,gsdm);
@@ -100,12 +106,28 @@ public class YlxxbServiceImpl extends BaseServiceImpl&lt;Ylxxb,Integer&gt; implements @@ -100,12 +106,28 @@ public class YlxxbServiceImpl extends BaseServiceImpl&lt;Ylxxb,Integer&gt; implements
100 s.setNylx(rs.getInt("nylx")); 106 s.setNylx(rs.getInt("nylx"));
101 s.setJyggh(rs.getString("jyggh")); 107 s.setJyggh(rs.getString("jyggh"));
102 s.setYj(rs.getDouble("yj")); 108 s.setYj(rs.getDouble("yj"));
103 - s.setLdgh(rs.getString("ldgh")); 109 +// s.setLdgh(rs.getString("ldgh"));
104 s.setBz(rs.getString("bz")); 110 s.setBz(rs.getString("bz"));
105 return s; 111 return s;
106 } 112 }
107 }); 113 });
108 114
  115 +
  116 + List<Ylb> listylb=ylbRepository.obtainYl(rq, gsdm, fgsdm, "", "", "nbbm");
  117 + for (int i = 0; i < list.size(); i++) {
  118 + String ldgh="";
  119 + for (int j = 0; j < listylb.size(); j++) {
  120 + Ylb ylb =listylb.get(j);
  121 + if(list.get(i).getNbbm().equals(ylb.getNbbm())){
  122 + if(ldgh.equals(""))
  123 + ldgh +=ylb.getJsy();
  124 + else
  125 + ldgh += ","+ylb.getJsy();
  126 + }
  127 + }
  128 + list.get(i).setLdgh(ldgh);
  129 +
  130 + }
109 //正式使用用下面代码 131 //正式使用用下面代码
110 // for (int i = 0; i < iterator.size(); i++) { 132 // for (int i = 0; i < iterator.size(); i++) {
111 // Ylxxb y1=iterator.get(i); 133 // Ylxxb y1=iterator.get(i);
src/main/java/com/bsth/service/realcontrol/impl/ScheduleRealInfoServiceImpl.java
@@ -868,30 +868,127 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf @@ -868,30 +868,127 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
868 Map<String, Object> map = this.MapById(scheduleRealInfos.get(0).getId()); 868 Map<String, Object> map = this.MapById(scheduleRealInfos.get(0).getId());
869 869
870 map.put("jhlc",Arith.add(culateMieageService.culateJhgl(scheduleRealInfos),culateMieageService.culateJhJccgl(scheduleRealInfos))); 870 map.put("jhlc",Arith.add(culateMieageService.culateJhgl(scheduleRealInfos),culateMieageService.culateJhJccgl(scheduleRealInfos)));
871 - map.put("remMileage",culateMieageService.culateLbgl(lists)); 871 + map.put("remMileage",culateMieageService.culateLbgl(scheduleRealInfos));
872 map.put("addMileage", culateMieageService.culateLjgl(lists)); 872 map.put("addMileage", culateMieageService.culateLjgl(lists));
873 double yygl=Arith.add(culateMieageService.culateSjgl(lists),culateMieageService.culateLjgl(lists)); 873 double yygl=Arith.add(culateMieageService.culateSjgl(lists),culateMieageService.culateLjgl(lists));
874 map.put("yygl", yygl); 874 map.put("yygl", yygl);
875 - double ksgl=Arith.add(culateMieageService.culateKsgl(lists),culateMieageService.culateJccgl(lists)); 875 + double ksgl=Arith.add(culateMieageService.culateKsgl(scheduleRealInfos),culateMieageService.culateJccgl(lists));
876 map.put("ksgl",ksgl); 876 map.put("ksgl",ksgl);
877 map.put("realMileage", Arith.add(yygl ,ksgl)); 877 map.put("realMileage", Arith.add(yygl ,ksgl));
878 map.put("jhbc", culateMieageService.culateJhbc(scheduleRealInfos,"")); 878 map.put("jhbc", culateMieageService.culateJhbc(scheduleRealInfos,""));
879 - map.put("cjbc", culateMieageService.culateLbbc(lists)); 879 + map.put("cjbc", culateMieageService.culateLbbc(scheduleRealInfos));
880 map.put("ljbc", culateMieageService.culateLjbc(lists, "")); 880 map.put("ljbc", culateMieageService.culateLjbc(lists, ""));
881 int sjbc =culateMieageService.culateLjbc(lists, "")+culateMieageService.culateSjbc(lists, ""); 881 int sjbc =culateMieageService.culateLjbc(lists, "")+culateMieageService.culateSjbc(lists, "");
882 map.put("sjbc", sjbc); 882 map.put("sjbc", sjbc);
883 // map=new HashMap<String,Object>(); 883 // map=new HashMap<String,Object>();
  884 +
  885 + SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd HH:mm");
  886 + String sqlMinYysj="select start_opt from bsth_c_line_config where "
  887 + + " id = ("
  888 + + "select max(id) from bsth_c_line_config where line ='"+BasicData.lineId2CodeMap.inverse().get(line) +"'"
  889 + + ")";
  890 + String minfcsj=jdbcTemplate.queryForObject(sqlMinYysj, String.class);
  891 + String[] minSjs = minfcsj.split(":");
  892 + Long minSj=Long.parseLong(minSjs[0])*60+Long.parseLong(minSjs[1]);
  893 +
  894 +
  895 + for (int i = 0; i < scheduleRealInfos.size(); i++) {
  896 + ScheduleRealInfo s=scheduleRealInfos.get(i);
  897 + String[] fcsj= s.getFcsj().split(":");
  898 + Long fcsjL=Long.parseLong(fcsj[0])*60+Long.parseLong(fcsj[1]);
  899 +
  900 + Long fscjT=0L;
  901 + if(fcsjL<minSj){
  902 + Calendar calendar = new GregorianCalendar();
  903 + calendar.setTime(s.getScheduleDate());
  904 + calendar.add(calendar.DATE,1);
  905 + s.setScheduleDate(calendar.getTime());
  906 + try {
  907 + fscjT = sdf.parse(sdf.format(s.getScheduleDate())+" "+s.getFcsj()).getTime();
  908 + } catch (ParseException e) {
  909 + // TODO Auto-generated catch block
  910 + e.printStackTrace();
  911 + }
  912 +
  913 + }else{
  914 + try {
  915 + fscjT =sdf.parse(s.getScheduleDateStr()+" "+s.getFcsj()).getTime();
  916 + } catch (ParseException e) {
  917 + // TODO Auto-generated catch block
  918 + e.printStackTrace();
  919 + };
  920 + }
  921 + s.setFcsjT(fscjT);
  922 + }
  923 + List<ScheduleRealInfo> listSchedule = new ArrayList<ScheduleRealInfo>();
  924 + Collections.sort(scheduleRealInfos, new ComparableReal());
  925 + for (int i = 0; i < scheduleRealInfos.size(); i++) {
  926 + ScheduleRealInfo s = scheduleRealInfos.get(i);
  927 + s.setAdjustExps(i + 1 + "");
  928 + String remarks = "";
  929 + if (s.getRemarks() != null) {
  930 + remarks += s.getRemarks();
  931 + }
  932 +
  933 + Set<ChildTaskPlan> childTaskPlans = s.getcTasks();
  934 + if (!childTaskPlans.isEmpty()) {
  935 + s.setFcsjActual("");
  936 + s.setZdsjActual("");
  937 + s.setJhlc(0.0);
  938 + }
  939 +
  940 + if (s.isDestroy()) {
  941 + s.setFcsjActual("");
  942 + s.setZdsjActual("");
  943 + s.setJhlc(0.0);
  944 + remarks += "(烂班)";
  945 + s.setRemarks(remarks);
  946 + }
  947 +
  948 + listSchedule.add(s);
  949 + //计算营运里程,空驶里程
  950 + if (!childTaskPlans.isEmpty()) {
  951 +// Iterator<ChildTaskPlan> it = childTaskPlans.iterator();
  952 + List<ChildTaskPlan> listit=new ArrayList<ChildTaskPlan>(childTaskPlans);
  953 + Collections.sort(listit, new ComparableChild());
  954 + for (int j = 0; j < listit.size(); j++) {
  955 + ScheduleRealInfo t = new ScheduleRealInfo();
  956 + ChildTaskPlan childTaskPlan = listit.get(j);
  957 + if (childTaskPlan.isDestroy()) {
  958 + t.setFcsjActual("");
  959 + t.setZdsjActual("");
  960 + t.setJhlc(0.0);
  961 + } else {
  962 + t.setFcsjActual(childTaskPlan.getStartDate());
  963 + t.setZdsjActual(childTaskPlan.getEndDate());
  964 + t.setJhlc(Double.parseDouble(String.valueOf(childTaskPlan.getMileage())));
  965 + }
  966 + t.setQdzName(childTaskPlan.getStartStationName());
  967 + t.setZdzName(childTaskPlan.getEndStationName());
  968 + t.setRemarks(childTaskPlan.getRemarks());
  969 + t.setAdjustExps("子");
  970 + t.setjGh("");
  971 + t.setjName("");
  972 + t.setsGh("");
  973 + t.setsName("");
  974 + listSchedule.add(t);
  975 + }
  976 + }
  977 + }
884 Map<String, Object> maps; 978 Map<String, Object> maps;
885 - for (ScheduleRealInfo scheduleRealInfo : scheduleRealInfos) { 979 + for (ScheduleRealInfo scheduleRealInfo : listSchedule) {
886 maps = new HashMap<String, Object>(); 980 maps = new HashMap<String, Object>();
887 try { 981 try {
888 scheduleRealInfo.setjName(scheduleRealInfo.getjGh() + scheduleRealInfo.getjName()); 982 scheduleRealInfo.setjName(scheduleRealInfo.getjGh() + scheduleRealInfo.getjName());
889 scheduleRealInfo.setsName(scheduleRealInfo.getsGh() + scheduleRealInfo.getsName()); 983 scheduleRealInfo.setsName(scheduleRealInfo.getsGh() + scheduleRealInfo.getsName());
890 maps = rru.getMapValue(scheduleRealInfo); 984 maps = rru.getMapValue(scheduleRealInfo);
  985 + maps.put("bcs", scheduleRealInfo.getAdjustExps());
891 String zdsj = scheduleRealInfo.getZdsj(); 986 String zdsj = scheduleRealInfo.getZdsj();
892 String zdsjActual = scheduleRealInfo.getZdsjActual(); 987 String zdsjActual = scheduleRealInfo.getZdsjActual();
893 if (zdsj != null && zdsjActual != null && 988 if (zdsj != null && zdsjActual != null &&
894 - !zdsj.equals(zdsjActual)) { 989 + !zdsj.equals(zdsjActual) &&
  990 + !zdsj.equals("")&&
  991 + !zdsjActual.equals("")) {
895 if (zdsj.compareTo(zdsjActual) > 0) { 992 if (zdsj.compareTo(zdsjActual) > 0) {
896 maps.put("fast", TimeUtils.getTimeDifference(zdsj, zdsjActual)); 993 maps.put("fast", TimeUtils.getTimeDifference(zdsj, zdsjActual));
897 maps.put("slow", ""); 994 maps.put("slow", "");
@@ -908,6 +1005,7 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf @@ -908,6 +1005,7 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
908 e.printStackTrace(); 1005 e.printStackTrace();
909 } 1006 }
910 } 1007 }
  1008 +
911 String xls=""; 1009 String xls="";
912 if(map.get("type").toString().equals("0")){ 1010 if(map.get("type").toString().equals("0")){
913 xls="waybill_minhang.xls"; 1011 xls="waybill_minhang.xls";
@@ -2685,6 +2783,8 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf @@ -2685,6 +2783,8 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
2685 if(reamrks2.length()>5){ 2783 if(reamrks2.length()>5){
2686 t2.setRemarks(reamrks2.substring(0, 5)); 2784 t2.setRemarks(reamrks2.substring(0, 5));
2687 t2.setRemark(reamrks2); 2785 t2.setRemark(reamrks2);
  2786 + }else{
  2787 + t2.setRemark(reamrks2);
2688 } 2788 }
2689 if (t1.getId() == t2.getId()) { 2789 if (t1.getId() == t2.getId()) {
2690 t1 = t2; 2790 t1 = t2;
@@ -3966,9 +4066,9 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf @@ -3966,9 +4066,9 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
3966 Long zdsj_=Long.parseLong(zdsj_s[0])*60+Long.parseLong(zdsj_s[1]); 4066 Long zdsj_=Long.parseLong(zdsj_s[0])*60+Long.parseLong(zdsj_s[1]);
3967 Long zdsjActual_=Long.parseLong(zdsjActual_s[0])*60+Long.parseLong(zdsjActual_s[1]); 4067 Long zdsjActual_=Long.parseLong(zdsjActual_s[0])*60+Long.parseLong(zdsjActual_s[1]);
3968 if((zdsj_-zdsjActual_)>0){ 4068 if((zdsj_-zdsjActual_)>0){
3969 - zdsjm =String.valueOf(zdsj_-zdsjActual_);  
3970 - }else{  
3971 zdsjk =String.valueOf(zdsj_-zdsjActual_); 4069 zdsjk =String.valueOf(zdsj_-zdsjActual_);
  4070 + }else{
  4071 + zdsjm =String.valueOf(zdsj_-zdsjActual_);
3972 } 4072 }
3973 } 4073 }
3974 tempMap.put("zdsjk" + x, zdsjk); 4074 tempMap.put("zdsjk" + x, zdsjk);
@@ -3979,9 +4079,10 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf @@ -3979,9 +4079,10 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
3979 String fcsjActuralstr=""; 4079 String fcsjActuralstr="";
3980 if(bcType.equals("in")){ 4080 if(bcType.equals("in")){
3981 fcsjActuralstr=fcsjActural+"(进)"; 4081 fcsjActuralstr=fcsjActural+"(进)";
3982 - }  
3983 - if(bcType.equals("out")){ 4082 + }else if(bcType.equals("out")){
3984 fcsjActuralstr=fcsjActural+"(出)"; 4083 fcsjActuralstr=fcsjActural+"(出)";
  4084 + }else{
  4085 + fcsjActuralstr=fcsjActural;
3985 } 4086 }
3986 tempMap.put("fcsjActual" + x, fcsjActuralstr); 4087 tempMap.put("fcsjActual" + x, fcsjActuralstr);
3987 String fcsjk=""; 4088 String fcsjk="";
@@ -3992,9 +4093,9 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf @@ -3992,9 +4093,9 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
3992 Long zdsj_=Long.parseLong(zdsj_s[0])*60+Long.parseLong(zdsj_s[1]); 4093 Long zdsj_=Long.parseLong(zdsj_s[0])*60+Long.parseLong(zdsj_s[1]);
3993 Long fcsjActural_=Long.parseLong(fcsjActural_s[0])*60+Long.parseLong(fcsjActural_s[1]); 4094 Long fcsjActural_=Long.parseLong(fcsjActural_s[0])*60+Long.parseLong(fcsjActural_s[1]);
3994 if((zdsj_-fcsjActural_)>0){ 4095 if((zdsj_-fcsjActural_)>0){
3995 - fcsjm =String.valueOf(zdsj_-fcsjActural_);  
3996 - }else{  
3997 fcsjk =String.valueOf(zdsj_-fcsjActural_); 4096 fcsjk =String.valueOf(zdsj_-fcsjActural_);
  4097 + }else{
  4098 + fcsjm =String.valueOf(zdsj_-fcsjActural_);
3998 } 4099 }
3999 } 4100 }
4000 tempMap.put("fcsjk" + x, fcsjk); 4101 tempMap.put("fcsjk" + x, fcsjk);
@@ -4068,65 +4169,163 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf @@ -4068,65 +4169,163 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
4068 List<Iterator<?>> list = new ArrayList<Iterator<?>>(); 4169 List<Iterator<?>> list = new ArrayList<Iterator<?>>();
4069 List<ScheduleRealInfo> scheduleRealInfos = listpl; 4170 List<ScheduleRealInfo> scheduleRealInfos = listpl;
4070 List<Map<String, Object>> listMap = new ArrayList<Map<String, Object>>(); 4171 List<Map<String, Object>> listMap = new ArrayList<Map<String, Object>>();
4071 -// List<ScheduleRealInfo> scheduleRealInfos=scheduleRealInfoRepository.queryListWaybillXcld(jName, clZbh, lpName, date, line);  
4072 - List<ScheduleRealInfo> lists=new ArrayList<ScheduleRealInfo>();  
4073 - for (int i = 0; i < scheduleRealInfos.size(); i++) {  
4074 - ScheduleRealInfo s=scheduleRealInfos.get(i);  
4075 - Set<ChildTaskPlan> cts = s.getcTasks();  
4076 - if(cts != null && cts.size() > 0){  
4077 - lists.add(s);  
4078 - }else{ 4172 +// List<ScheduleRealInfo> scheduleRealInfos=scheduleRealInfoRepository.queryListWaybillXcld(jName, clZbh, lpName, date, line);
  4173 + List<ScheduleRealInfo> lists=new ArrayList<ScheduleRealInfo>();
  4174 + for (int i = 0; i < scheduleRealInfos.size(); i++) {
  4175 + ScheduleRealInfo s=scheduleRealInfos.get(i);
  4176 + Set<ChildTaskPlan> cts = s.getcTasks();
  4177 + if(cts != null && cts.size() > 0){
  4178 + lists.add(s);
  4179 + }else{
4079 if(s.getZdsjActual()!=null){ 4180 if(s.getZdsjActual()!=null){
4080 lists.add(s); 4181 lists.add(s);
4081 } 4182 }
4082 - }  
4083 - }  
4084 - DecimalFormat format = new DecimalFormat("0.00"); 4183 + }
  4184 + }
  4185 + DecimalFormat format = new DecimalFormat("0.00");
4085 // int cjbc = scheduleRealInfoRepository.findCjbc(jName, clZbh, lpName); 4186 // int cjbc = scheduleRealInfoRepository.findCjbc(jName, clZbh, lpName);
4086 // int ljbc = scheduleRealInfoRepository.findLjbc(jName, clZbh, lpName); 4187 // int ljbc = scheduleRealInfoRepository.findLjbc(jName, clZbh, lpName);
4087 - Map<String, Object> map = this.MapById(scheduleRealInfos.get(0).getId());  
4088 - //计算里程和班次数,并放入Map里  
4089 - map.put("jhlc", Arith.add(culateMieageService.culateJhgl(scheduleRealInfos),culateMieageService.culateJhJccgl(scheduleRealInfos)));  
4090 - map.put("remMileage",culateMieageService.culateLbgl(lists));  
4091 - map.put("addMileage", culateMieageService.culateLjgl(lists));  
4092 - double yygl=Arith.add(culateMieageService.culateSjgl(lists),culateMieageService.culateLjgl(lists));  
4093 - map.put("yygl", yygl);  
4094 - double ksgl=Arith.add(culateMieageService.culateKsgl(lists),culateMieageService.culateJccgl(lists));  
4095 - map.put("ksgl",ksgl);  
4096 - map.put("realMileage", Arith.add(yygl ,ksgl));  
4097 - map.put("jhbc", culateMieageService.culateJhbc(scheduleRealInfos,""));  
4098 - map.put("cjbc", culateMieageService.culateLbbc(lists));  
4099 - map.put("ljbc", culateMieageService.culateLjbc(lists, ""));  
4100 - int sjbc =culateMieageService.culateLjbc(lists, "")+culateMieageService.culateSjbc(lists, "");  
4101 - map.put("sjbc", sjbc);  
4102 -  
4103 - Map<String, Object> maps;  
4104 - for (ScheduleRealInfo scheduleRealInfo : scheduleRealInfos) {  
4105 - maps = new HashMap<String, Object>();  
4106 - try {  
4107 - scheduleRealInfo.setjName(scheduleRealInfo.getjGh() + scheduleRealInfo.getjName());  
4108 - scheduleRealInfo.setsName(scheduleRealInfo.getsGh() + scheduleRealInfo.getsName());  
4109 - maps = rru.getMapValue(scheduleRealInfo);  
4110 - String zdsj = scheduleRealInfo.getZdsj();  
4111 - String zdsjActual = scheduleRealInfo.getZdsjActual();  
4112 - if (zdsj != null && zdsjActual != null &&  
4113 - !zdsj.equals(zdsjActual)) {  
4114 - if (zdsj.compareTo(zdsjActual) > 0) {  
4115 - maps.put("fast", TimeUtils.getTimeDifference(zdsj, zdsjActual));  
4116 - maps.put("slow", "");  
4117 - } else {  
4118 - maps.put("fast", "");  
4119 - maps.put("slow", TimeUtils.getTimeDifference(zdsj, zdsjActual));  
4120 - }  
4121 - } else {  
4122 - maps.put("fast", "");  
4123 - maps.put("slow", "");  
4124 - }  
4125 - listMap.add(maps);  
4126 - } catch (Exception e) {  
4127 - e.printStackTrace();  
4128 - }  
4129 - } 4188 + //计算里程和班次数,并放入Map里
  4189 + Map<String, Object> map = this.MapById(scheduleRealInfos.get(0).getId());
  4190 +
  4191 + map.put("jhlc",Arith.add(culateMieageService.culateJhgl(scheduleRealInfos),culateMieageService.culateJhJccgl(scheduleRealInfos)));
  4192 + map.put("remMileage",culateMieageService.culateLbgl(scheduleRealInfos));
  4193 + map.put("addMileage", culateMieageService.culateLjgl(lists));
  4194 + double yygl=Arith.add(culateMieageService.culateSjgl(lists),culateMieageService.culateLjgl(lists));
  4195 + map.put("yygl", yygl);
  4196 + double ksgl=Arith.add(culateMieageService.culateKsgl(scheduleRealInfos),culateMieageService.culateJccgl(lists));
  4197 + map.put("ksgl",ksgl);
  4198 + map.put("realMileage", Arith.add(yygl ,ksgl));
  4199 + map.put("jhbc", culateMieageService.culateJhbc(scheduleRealInfos,""));
  4200 + map.put("cjbc", culateMieageService.culateLbbc(scheduleRealInfos));
  4201 + map.put("ljbc", culateMieageService.culateLjbc(lists, ""));
  4202 + int sjbc =culateMieageService.culateLjbc(lists, "")+culateMieageService.culateSjbc(lists, "");
  4203 + map.put("sjbc", sjbc);
  4204 +// map=new HashMap<String,Object>();
  4205 +
  4206 + SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd HH:mm");
  4207 + String sqlMinYysj="select start_opt from bsth_c_line_config where "
  4208 + + " id = ("
  4209 + + "select max(id) from bsth_c_line_config where line ='"+BasicData.lineId2CodeMap.inverse().get(listpl.get(0).getXlBm()) +"'"
  4210 + + ")";
  4211 + String minfcsj=jdbcTemplate.queryForObject(sqlMinYysj, String.class);
  4212 + String[] minSjs = minfcsj.split(":");
  4213 + Long minSj=Long.parseLong(minSjs[0])*60+Long.parseLong(minSjs[1]);
  4214 +
  4215 +
  4216 + for (int i = 0; i < scheduleRealInfos.size(); i++) {
  4217 + ScheduleRealInfo s=scheduleRealInfos.get(i);
  4218 + String[] fcsj= s.getFcsj().split(":");
  4219 + Long fcsjL=Long.parseLong(fcsj[0])*60+Long.parseLong(fcsj[1]);
  4220 +
  4221 + Long fscjT=0L;
  4222 + if(fcsjL<minSj){
  4223 + Calendar calendar = new GregorianCalendar();
  4224 + calendar.setTime(s.getScheduleDate());
  4225 + calendar.add(calendar.DATE,1);
  4226 + s.setScheduleDate(calendar.getTime());
  4227 + try {
  4228 + fscjT = sdf.parse(sdf.format(s.getScheduleDate())+" "+s.getFcsj()).getTime();
  4229 + } catch (ParseException e) {
  4230 + // TODO Auto-generated catch block
  4231 + e.printStackTrace();
  4232 + }
  4233 +
  4234 + }else{
  4235 + try {
  4236 + fscjT =sdf.parse(s.getScheduleDateStr()+" "+s.getFcsj()).getTime();
  4237 + } catch (ParseException e) {
  4238 + // TODO Auto-generated catch block
  4239 + e.printStackTrace();
  4240 + };
  4241 + }
  4242 + s.setFcsjT(fscjT);
  4243 + }
  4244 + List<ScheduleRealInfo> listSchedule = new ArrayList<ScheduleRealInfo>();
  4245 + Collections.sort(scheduleRealInfos, new ComparableReal());
  4246 + for (int i = 0; i < scheduleRealInfos.size(); i++) {
  4247 + ScheduleRealInfo s = scheduleRealInfos.get(i);
  4248 + s.setAdjustExps(i + 1 + "");
  4249 + String remarks = "";
  4250 + if (s.getRemarks() != null) {
  4251 + remarks += s.getRemarks();
  4252 + }
  4253 +
  4254 + Set<ChildTaskPlan> childTaskPlans = s.getcTasks();
  4255 + if (!childTaskPlans.isEmpty()) {
  4256 + s.setFcsjActual("");
  4257 + s.setZdsjActual("");
  4258 + s.setJhlc(0.0);
  4259 + }
  4260 +
  4261 + if (s.isDestroy()) {
  4262 + s.setFcsjActual("");
  4263 + s.setZdsjActual("");
  4264 + s.setJhlc(0.0);
  4265 + remarks += "(烂班)";
  4266 + s.setRemarks(remarks);
  4267 + }
  4268 +
  4269 + listSchedule.add(s);
  4270 + //计算营运里程,空驶里程
  4271 + if (!childTaskPlans.isEmpty()) {
  4272 +// Iterator<ChildTaskPlan> it = childTaskPlans.iterator();
  4273 + List<ChildTaskPlan> listit=new ArrayList<ChildTaskPlan>(childTaskPlans);
  4274 + Collections.sort(listit, new ComparableChild());
  4275 + for (int j = 0; j < listit.size(); j++) {
  4276 + ScheduleRealInfo t = new ScheduleRealInfo();
  4277 + ChildTaskPlan childTaskPlan = listit.get(j);
  4278 + if (childTaskPlan.isDestroy()) {
  4279 + t.setFcsjActual("");
  4280 + t.setZdsjActual("");
  4281 + t.setJhlc(0.0);
  4282 + } else {
  4283 + t.setFcsjActual(childTaskPlan.getStartDate());
  4284 + t.setZdsjActual(childTaskPlan.getEndDate());
  4285 + t.setJhlc(Double.parseDouble(String.valueOf(childTaskPlan.getMileage())));
  4286 + }
  4287 + t.setQdzName(childTaskPlan.getStartStationName());
  4288 + t.setZdzName(childTaskPlan.getEndStationName());
  4289 + t.setRemarks(childTaskPlan.getRemarks());
  4290 + t.setAdjustExps("子");
  4291 + t.setjGh("");
  4292 + t.setjName("");
  4293 + t.setsGh("");
  4294 + t.setsName("");
  4295 + listSchedule.add(t);
  4296 + }
  4297 + }
  4298 + }
  4299 + Map<String, Object> maps;
  4300 + for (ScheduleRealInfo scheduleRealInfo : listSchedule) {
  4301 + maps = new HashMap<String, Object>();
  4302 + try {
  4303 + scheduleRealInfo.setjName(scheduleRealInfo.getjGh() + scheduleRealInfo.getjName());
  4304 + scheduleRealInfo.setsName(scheduleRealInfo.getsGh() + scheduleRealInfo.getsName());
  4305 + maps = rru.getMapValue(scheduleRealInfo);
  4306 + maps.put("bcs", scheduleRealInfo.getAdjustExps());
  4307 + String zdsj = scheduleRealInfo.getZdsj();
  4308 + String zdsjActual = scheduleRealInfo.getZdsjActual();
  4309 + if (zdsj != null && zdsjActual != null &&
  4310 + !zdsj.equals(zdsjActual) &&
  4311 + !zdsj.equals("")&&
  4312 + !zdsjActual.equals("")) {
  4313 + if (zdsj.compareTo(zdsjActual) > 0) {
  4314 + maps.put("fast", TimeUtils.getTimeDifference(zdsj, zdsjActual));
  4315 + maps.put("slow", "");
  4316 + } else {
  4317 + maps.put("fast", "");
  4318 + maps.put("slow", TimeUtils.getTimeDifference(zdsj, zdsjActual));
  4319 + }
  4320 + } else {
  4321 + maps.put("fast", "");
  4322 + maps.put("slow", "");
  4323 + }
  4324 + listMap.add(maps);
  4325 + } catch (Exception e) {
  4326 + e.printStackTrace();
  4327 + }
  4328 + }
4130 4329
4131 4330
4132 String path = this.getClass().getResource("/").getPath() + "static/pages/forms/"; 4331 String path = this.getClass().getResource("/").getPath() + "static/pages/forms/";
src/main/java/com/bsth/service/report/impl/ReportServiceImpl.java
@@ -39,6 +39,8 @@ import java.text.ParseException; @@ -39,6 +39,8 @@ import java.text.ParseException;
39 import java.text.SimpleDateFormat; 39 import java.text.SimpleDateFormat;
40 import java.util.*; 40 import java.util.*;
41 41
  42 +import javax.persistence.criteria.CriteriaBuilder.In;
  43 +
42 @Service 44 @Service
43 public class ReportServiceImpl implements ReportService{ 45 public class ReportServiceImpl implements ReportService{
44 46
@@ -864,12 +866,12 @@ public class ReportServiceImpl implements ReportService{ @@ -864,12 +866,12 @@ public class ReportServiceImpl implements ReportService{
864 //查询时间里程 866 //查询时间里程
865 String sqlPc=" (SELECT jhlc,fcsj,bcsj,bc_type,lp,xl_dir,ists,2 as xh FROM " 867 String sqlPc=" (SELECT jhlc,fcsj,bcsj,bc_type,lp,xl_dir,ists,2 as xh FROM "
866 + " bsth_c_s_ttinfo_detail where ttinfo ='"+ttinfo+"' and " 868 + " bsth_c_s_ttinfo_detail where ttinfo ='"+ttinfo+"' and "
867 - + " fcsj <='"+minfcsj+"' and bc_type!='in' and bc_type!='out' and bc_type!='ldks'" 869 + + " fcsj <='"+minfcsj+"' and bc_type!='ldks'"
868 + " and bc_type !='region') " 870 + " and bc_type !='region') "
869 + " union " 871 + " union "
870 + " (SELECT jhlc,fcsj,bcsj,bc_type,lp,xl_dir,ists,1 as xh FROM " 872 + " (SELECT jhlc,fcsj,bcsj,bc_type,lp,xl_dir,ists,1 as xh FROM "
871 + " bsth_c_s_ttinfo_detail where ttinfo ='"+ttinfo+"' and " 873 + " bsth_c_s_ttinfo_detail where ttinfo ='"+ttinfo+"' and "
872 - + " fcsj > '"+minfcsj+"' and bc_type!='in' and bc_type!='out' and bc_type!='ldks' " 874 + + " fcsj > '"+minfcsj+"' and bc_type!='ldks' "
873 + " and bc_type !='region') " 875 + " and bc_type !='region') "
874 + " order by xl_dir, xh, lp,fcsj"; 876 + " order by xl_dir, xh, lp,fcsj";
875 Map<String, Object> map=new HashMap<String,Object>(); 877 Map<String, Object> map=new HashMap<String,Object>();
@@ -885,17 +887,399 @@ public class ReportServiceImpl implements ReportService{ @@ -885,17 +887,399 @@ public class ReportServiceImpl implements ReportService{
885 m.put("lp", rs.getString("lp")); 887 m.put("lp", rs.getString("lp"));
886 m.put("dir", rs.getString("xl_dir")); 888 m.put("dir", rs.getString("xl_dir"));
887 m.put("ists", rs.getString("ists")!=null?rs.getString("ists"):""); 889 m.put("ists", rs.getString("ists")!=null?rs.getString("ists"):"");
888 - 890 + String[] split = m.get("fcsj").toString().split(":");
889 if(rs.getString("xh").equals("2")){ 891 if(rs.getString("xh").equals("2")){
890 - String[] split = m.get("fcsj").toString().split(":");  
891 - m.put("fcsj", Integer.valueOf(split[0]) + 24 + ":"+split[1]); 892 + m.put("fcsj", (Integer.valueOf(split[0]) + 24) + ":"+split[1]);
892 } 893 }
893 894
894 return m; 895 return m;
895 } 896 }
896 }); 897 });
897 -  
898 - List<Map<String, Object>> newList=new ArrayList<Map<String,Object>>(); 898 + List<Map<String, Object>> newList=new ArrayList<Map<String,Object>>();
  899 + int yysxZq=0,yyxxZq=0,tzsxZq=0,tzxxZq=0,minZqcj=0,maxZqcj=0,sxcountZqbc=0,xxcountZqbc=0; //早前
  900 + int yysxZgf=0,yyxxZgf=0,tzsxZgf=0,tzxxZgf=0,minZgfcj=0,maxZgfcj=0,sxcountZgfbc=0,xxcountZgfbc=0;//早高峰
  901 + int yysxZw=0,yyxxZw=0,tzsxZw=0,tzxxZw=0,minZwcj=0,maxZwcj=0,sxcountZwbc=0,xxcountZwbc=0;//中午
  902 + int yysxWgf=0,yyxxWgf=0,tzsxWgf=0,tzxxWgf=0,minWgfcj=0,maxWgfcj=0,sxcountWgfbc=0,xxcountWgfbc=0;//晚高峰
  903 + int yysxWh=0,yyxxWh=0,tzsxWh=0,tzxxWh=0,minWhcj=0,maxWhcj=0,sxcountWhbc=0,xxcountWhbc=0;//晚后
  904 + List<Integer> zqFcsj0=new ArrayList<Integer>();
  905 + List<Integer> zgfFcsj0=new ArrayList<Integer>();
  906 + List<Integer> zwFcsj0=new ArrayList<Integer>();
  907 + List<Integer> wgfFcsj0=new ArrayList<Integer>();
  908 + List<Integer> whFcsj0=new ArrayList<Integer>();
  909 +
  910 + List<Integer> zqFcsj1=new ArrayList<Integer>();
  911 + List<Integer> zgfFcsj1=new ArrayList<Integer>();
  912 + List<Integer> zwFcsj1=new ArrayList<Integer>();
  913 + List<Integer> wgfFcsj1=new ArrayList<Integer>();
  914 + List<Integer> whFcsj1=new ArrayList<Integer>();
  915 + int temp = 48*60+1, zcj = 0;
  916 + boolean ists = true;
  917 + String lpname="";
  918 + for (int i = 0; i < list.size(); i++) {
  919 + Map<String, Object> m=list.get(i);
  920 + int xlDir = Integer.valueOf(m.get("dir").toString());
  921 + String[] split = m.get("fcsj").toString().split(":");
  922 + int fcsjT = Integer.valueOf(split[0])*60 + Integer.valueOf(split[1]);
  923 + String bcType=m.get("bcType").toString();
  924 + int bcsj = Integer.valueOf(m.get("bcsj").toString());
  925 + if(i==0){
  926 + lpname=m.get("lp").toString();
  927 + if(temp>fcsjT){
  928 + temp=fcsjT+bcsj;
  929 + }
  930 + }else{
  931 + if(temp>fcsjT){
  932 + temp=fcsjT+bcsj;
  933 + }
  934 + if(bcType.equals("in") || bcType.equals("out")){
  935 + temp = fcsjT+bcsj;
  936 + lpname=m.get("lp").toString();
  937 + ists=false;
  938 + }else{
  939 +// if(ists){
  940 +// temp = fcsjT+bcsj;
  941 +// lpname=m.get("lp").toString();
  942 +// }else{
  943 + if(xlDir==0){
  944 + //上行数据
  945 + if(fcsjT>= minSj && fcsjT <= 6*60+30){
  946 + //早高峰前
  947 + yysxZq +=bcsj;
  948 + sxcountZqbc ++;
  949 + zqFcsj0.add(fcsjT);
  950 + if(ists){
  951 + if(lpname.equals(m.get("lp").toString())){
  952 + tzsxZq +=fcsjT-temp;
  953 + }
  954 + }
  955 + temp = fcsjT+bcsj;
  956 +
  957 + }else if(fcsjT > 6*60+30 && fcsjT <= 8*60+30){
  958 + //早高峰
  959 + yysxZgf +=bcsj;
  960 + sxcountZgfbc ++;
  961 + zgfFcsj0.add(fcsjT);
  962 + if(ists){
  963 + if(lpname.equals(m.get("lp").toString())){
  964 + tzsxZgf +=fcsjT-temp;
  965 + }
  966 + }
  967 + temp =fcsjT+bcsj;
  968 +
  969 + }else if(fcsjT > 8*60+30 && fcsjT <= 16*60){
  970 + //中午
  971 + yysxZw +=bcsj;
  972 + sxcountZwbc ++;
  973 + zwFcsj0.add(fcsjT);
  974 + if(ists){
  975 + if(lpname.equals(m.get("lp").toString())){
  976 + tzsxZw +=fcsjT-temp;
  977 + }
  978 + }
  979 + temp =fcsjT+bcsj;
  980 + }else if(fcsjT > 16*60 && fcsjT <= 18*60){
  981 + //晚高峰
  982 + yysxWgf +=bcsj;
  983 + sxcountWgfbc ++;
  984 + wgfFcsj0.add(fcsjT);
  985 + if(ists){
  986 + if(lpname.equals(m.get("lp").toString())){
  987 + tzsxWgf +=fcsjT-temp;
  988 + }
  989 + }
  990 + temp =fcsjT+bcsj;
  991 + }else{
  992 + //晚高峰后
  993 + yysxWh +=bcsj;
  994 + sxcountWhbc ++;
  995 + whFcsj0.add(fcsjT);
  996 + if(ists){
  997 + if(lpname.equals(m.get("lp").toString())){
  998 + tzsxWh +=fcsjT-temp;
  999 + }
  1000 + }
  1001 + temp =fcsjT+bcsj;
  1002 + }
  1003 + lpname=m.get("lp").toString();
  1004 + }else{
  1005 + //下行数据
  1006 + if(fcsjT>= minSj && fcsjT <= 6*60+30){
  1007 + //早高峰前
  1008 + yyxxZq +=bcsj;
  1009 + xxcountZqbc ++;
  1010 + zqFcsj1.add(fcsjT);
  1011 + if(ists){
  1012 + if(lpname.equals(m.get("lp").toString())){
  1013 + tzxxZq +=fcsjT-temp;
  1014 + }
  1015 + }
  1016 + temp =fcsjT+bcsj;
  1017 + }else if(fcsjT > 6*60+30 && fcsjT <= 8*60+30){
  1018 + //早高峰
  1019 + yyxxZgf +=bcsj;
  1020 + xxcountZgfbc ++;
  1021 + zgfFcsj1.add(fcsjT);
  1022 + if(ists){
  1023 + if(lpname.equals(m.get("lp").toString())){
  1024 + tzxxZgf +=fcsjT-temp;
  1025 + }
  1026 + }
  1027 + temp =fcsjT+bcsj;
  1028 + }else if(fcsjT > 8*60+30 && fcsjT <= 16*60){
  1029 + //中午
  1030 + yyxxZw +=bcsj;
  1031 + xxcountZwbc ++;
  1032 + zwFcsj1.add(fcsjT);
  1033 + if(ists){
  1034 + if(lpname.equals(m.get("lp").toString())){
  1035 + tzxxZw +=fcsjT-temp;
  1036 + }
  1037 + }
  1038 + temp =fcsjT+bcsj;
  1039 + }else if(fcsjT > 16*60 && fcsjT <= 18*60){
  1040 + //晚高峰
  1041 + yyxxWgf +=bcsj;
  1042 + xxcountWgfbc ++;
  1043 + wgfFcsj1.add(fcsjT);
  1044 + if(ists){
  1045 + if(lpname.equals(m.get("lp").toString())){
  1046 + tzxxWgf +=fcsjT-temp;
  1047 + }
  1048 + }
  1049 + temp =fcsjT+bcsj;
  1050 + }else{
  1051 + //晚高峰后
  1052 + yyxxWh +=bcsj;
  1053 + xxcountWhbc ++;
  1054 + whFcsj1.add(fcsjT);
  1055 + if(ists){
  1056 + if(lpname.equals(m.get("lp").toString())){
  1057 + tzxxWh +=fcsjT-temp;
  1058 + }
  1059 + }
  1060 + temp =fcsjT+bcsj;
  1061 + }
  1062 +// }
  1063 + }
  1064 + }
  1065 + }
  1066 + if(m.get("ists").toString().trim().equals("1")){
  1067 + ists=false;
  1068 + }else{
  1069 + ists = true;
  1070 + }
  1071 + }
  1072 +
  1073 + //---------------------------------------早前
  1074 + List<Integer> cjs = new ArrayList<Integer>();
  1075 + Collections.sort(zqFcsj0);
  1076 + int fcsjs=0;
  1077 + for (int i = 0; i < zqFcsj0.size(); i++) {
  1078 + if(i==0){
  1079 + fcsjs =zqFcsj0.get(i);
  1080 + }else{
  1081 + cjs.add(zqFcsj0.get(i)-fcsjs);
  1082 + fcsjs=zqFcsj0.get(i);
  1083 + }
  1084 +
  1085 + }
  1086 + Collections.sort(zqFcsj1);
  1087 + int fcsjx=0;
  1088 + for (int i = 0; i < zqFcsj1.size(); i++) {
  1089 + if(i==0){
  1090 + fcsjx =zqFcsj1.get(i);
  1091 + }else{
  1092 + cjs.add(zqFcsj1.get(i)-fcsjx);
  1093 + fcsjx =zqFcsj1.get(i);
  1094 + }
  1095 +
  1096 + }
  1097 + Collections.sort(cjs);
  1098 + for(int i : cjs){
  1099 + zcj += i;
  1100 + }
  1101 + Map<String, Object> tempMap = new HashMap<String, Object>();
  1102 + tempMap.put("sjd", "(首)——6:30");
  1103 + tempMap.put("sxsj", sxcountZqbc != 0 ? yysxZq / sxcountZqbc : "0");
  1104 + tempMap.put("xxsj", xxcountZqbc != 0 ? yyxxZq / xxcountZqbc : "0");
  1105 + tempMap.put("sxtssj", sxcountZqbc!= 0 ? tzsxZq / sxcountZqbc : "0");
  1106 + tempMap.put("xxtssj", xxcountZqbc != 0 ? tzxxZq / xxcountZqbc : "0");
  1107 + tempMap.put("fqsj", Integer.valueOf(tempMap.get("sxsj").toString()) + Integer.valueOf(tempMap.get("xxsj").toString())
  1108 + + Integer.valueOf(tempMap.get("sxtssj").toString()) + Integer.valueOf(tempMap.get("xxtssj").toString()));
  1109 + tempMap.put("cjqj", cjs.size()>0?cjs.get(0)+"——"+cjs.get(cjs.size()-1):"——");
  1110 + tempMap.put("pjcj", cjs.size()>0?zcj/cjs.size():"/");
  1111 + newList.add(tempMap);
  1112 +
  1113 + //----------------------------------早高峰
  1114 + cjs = new ArrayList<Integer>();
  1115 + zcj =0;
  1116 +
  1117 + Collections.sort(zgfFcsj0);
  1118 + fcsjs=0;
  1119 + for (int i = 0; i < zgfFcsj0.size(); i++) {
  1120 + if(i==0){
  1121 + fcsjs =zgfFcsj0.get(i);
  1122 + }else{
  1123 + cjs.add(zgfFcsj0.get(i)-fcsjs);
  1124 + fcsjs=zgfFcsj0.get(i);
  1125 + }
  1126 +
  1127 + }
  1128 + Collections.sort(zgfFcsj1);
  1129 + fcsjx=0;
  1130 + for (int i = 0; i < zgfFcsj1.size(); i++) {
  1131 + if(i==0){
  1132 + fcsjx =zgfFcsj1.get(i);
  1133 + }else{
  1134 + cjs.add(zgfFcsj1.get(i)-fcsjx);
  1135 + fcsjx =zgfFcsj1.get(i);
  1136 + }
  1137 +
  1138 + }
  1139 + Collections.sort(cjs);
  1140 + for(int i : cjs){
  1141 + zcj += i;
  1142 + }
  1143 +
  1144 + tempMap = new HashMap<String, Object>();
  1145 + tempMap.put("sjd", "6:31——8:30");
  1146 + tempMap.put("sxsj", sxcountZgfbc != 0 ? yysxZgf / sxcountZgfbc : "0");
  1147 + tempMap.put("xxsj", xxcountZgfbc != 0 ? yyxxZgf / xxcountZgfbc : "0");
  1148 + tempMap.put("sxtssj", sxcountZgfbc!= 0 ? tzsxZgf / sxcountZgfbc : "0");
  1149 + tempMap.put("xxtssj", xxcountZgfbc != 0 ? tzxxZgf / xxcountZgfbc : "0");
  1150 + tempMap.put("fqsj", Integer.valueOf(tempMap.get("sxsj").toString()) + Integer.valueOf(tempMap.get("xxsj").toString())
  1151 + + Integer.valueOf(tempMap.get("sxtssj").toString()) + Integer.valueOf(tempMap.get("xxtssj").toString()));
  1152 + tempMap.put("cjqj", cjs.size()>0?cjs.get(0)+"——"+cjs.get(cjs.size()-1):"——");
  1153 + tempMap.put("pjcj", cjs.size()>0?zcj/cjs.size():"/");
  1154 + newList.add(tempMap);
  1155 + //----------------------------------------------中午
  1156 + cjs = new ArrayList<Integer>();
  1157 + zcj =0;
  1158 +
  1159 + Collections.sort(zwFcsj0);
  1160 + fcsjs=0;
  1161 + for (int i = 0; i < zwFcsj0.size(); i++) {
  1162 + if(i==0){
  1163 + fcsjs =zwFcsj0.get(i);
  1164 + }else{
  1165 + cjs.add(zwFcsj0.get(i)-fcsjs);
  1166 + fcsjs=zwFcsj0.get(i);
  1167 + }
  1168 +
  1169 + }
  1170 + Collections.sort(zwFcsj1);
  1171 + fcsjx=0;
  1172 + for (int i = 0; i < zwFcsj1.size(); i++) {
  1173 + if(i==0){
  1174 + fcsjx =zwFcsj1.get(i);
  1175 + }else{
  1176 + cjs.add(zwFcsj1.get(i)-fcsjx);
  1177 + fcsjx =zwFcsj1.get(i);
  1178 + }
  1179 +
  1180 + }
  1181 + Collections.sort(cjs);
  1182 + for(int i : cjs){
  1183 + zcj += i;
  1184 + }
  1185 +
  1186 + tempMap = new HashMap<String, Object>();
  1187 + tempMap.put("sjd", "8:31——16:00");
  1188 + tempMap.put("sxsj", sxcountZwbc != 0 ? yysxZw / sxcountZwbc : "0");
  1189 + tempMap.put("xxsj", xxcountZwbc != 0 ? yyxxZw / xxcountZwbc : "0");
  1190 + tempMap.put("sxtssj", sxcountZwbc!= 0 ? tzsxZw / sxcountZwbc : "0");
  1191 + tempMap.put("xxtssj", xxcountZwbc != 0 ? tzxxZw / xxcountZwbc : "0");
  1192 + tempMap.put("fqsj", Integer.valueOf(tempMap.get("sxsj").toString()) + Integer.valueOf(tempMap.get("xxsj").toString())
  1193 + + Integer.valueOf(tempMap.get("sxtssj").toString()) + Integer.valueOf(tempMap.get("xxtssj").toString()));
  1194 + tempMap.put("cjqj", cjs.size()>0?cjs.get(0)+"——"+cjs.get(cjs.size()-1):"——");
  1195 + tempMap.put("pjcj", cjs.size()>0?zcj/cjs.size():"/");
  1196 + newList.add(tempMap);
  1197 + //-------------------------------------------------晚高峰
  1198 + cjs = new ArrayList<Integer>();
  1199 + zcj =0;
  1200 +
  1201 + Collections.sort(wgfFcsj0);
  1202 + fcsjs=0;
  1203 + for (int i = 0; i < wgfFcsj0.size(); i++) {
  1204 + if(i==0){
  1205 + fcsjs =wgfFcsj0.get(i);
  1206 + }else{
  1207 + cjs.add(wgfFcsj0.get(i)-fcsjs);
  1208 + fcsjs=wgfFcsj0.get(i);
  1209 + }
  1210 +
  1211 + }
  1212 + Collections.sort(wgfFcsj1);
  1213 + fcsjx=0;
  1214 + for (int i = 0; i < wgfFcsj1.size(); i++) {
  1215 + if(i==0){
  1216 + fcsjx =wgfFcsj1.get(i);
  1217 + }else{
  1218 + cjs.add(wgfFcsj1.get(i)-fcsjx);
  1219 + fcsjx =wgfFcsj1.get(i);
  1220 + }
  1221 +
  1222 + }
  1223 + Collections.sort(cjs);
  1224 + for(int i : cjs){
  1225 + zcj += i;
  1226 + }
  1227 +
  1228 + tempMap = new HashMap<String, Object>();
  1229 + tempMap.put("sjd", "16:01——18:00");
  1230 + tempMap.put("sxsj", sxcountWgfbc != 0 ? yysxWgf / sxcountWgfbc : "0");
  1231 + tempMap.put("xxsj", xxcountWgfbc != 0 ? yyxxWgf / xxcountWgfbc : "0");
  1232 + tempMap.put("sxtssj", sxcountWgfbc!= 0 ? tzsxWgf / sxcountWgfbc : "0");
  1233 + tempMap.put("xxtssj", xxcountWgfbc != 0 ? tzxxWgf / xxcountWgfbc : "0");
  1234 + tempMap.put("fqsj", Integer.valueOf(tempMap.get("sxsj").toString()) + Integer.valueOf(tempMap.get("xxsj").toString())
  1235 + + Integer.valueOf(tempMap.get("sxtssj").toString()) + Integer.valueOf(tempMap.get("xxtssj").toString()));
  1236 + tempMap.put("cjqj", cjs.size()>0?cjs.get(0)+"——"+cjs.get(cjs.size()-1):"——");
  1237 + tempMap.put("pjcj", cjs.size()>0?zcj/cjs.size():"/");
  1238 + newList.add(tempMap);
  1239 +
  1240 + //----------------------------------晚后
  1241 + cjs = new ArrayList<Integer>();
  1242 + zcj =0;
  1243 +
  1244 + Collections.sort(whFcsj0);
  1245 + fcsjs=0;
  1246 + for (int i = 0; i < whFcsj0.size(); i++) {
  1247 + if(i==0){
  1248 + fcsjs =whFcsj0.get(i);
  1249 + }else{
  1250 + cjs.add(whFcsj0.get(i)-fcsjs);
  1251 + fcsjs=whFcsj0.get(i);
  1252 + }
  1253 +
  1254 + }
  1255 + Collections.sort(whFcsj1);
  1256 + fcsjx=0;
  1257 + for (int i = 0; i < whFcsj1.size(); i++) {
  1258 + if(i==0){
  1259 + fcsjx =whFcsj1.get(i);
  1260 + }else{
  1261 + cjs.add(whFcsj1.get(i)-fcsjx);
  1262 + fcsjx =whFcsj1.get(i);
  1263 + }
  1264 +
  1265 + }
  1266 + Collections.sort(cjs);
  1267 + for(int i : cjs){
  1268 + zcj += i;
  1269 + }
  1270 +
  1271 + tempMap = new HashMap<String, Object>();
  1272 + tempMap.put("sjd", "18:01——(末)");
  1273 + tempMap.put("sxsj", sxcountWhbc != 0 ? yysxWh / sxcountWhbc : "0");
  1274 + tempMap.put("xxsj", xxcountWhbc != 0 ? yyxxWh / xxcountWhbc : "0");
  1275 + tempMap.put("sxtssj", sxcountWhbc!= 0 ? tzsxWh / sxcountWhbc : "0");
  1276 + tempMap.put("xxtssj", xxcountWhbc != 0 ? tzxxWh / xxcountWhbc : "0");
  1277 + tempMap.put("fqsj", Integer.valueOf(tempMap.get("sxsj").toString()) + Integer.valueOf(tempMap.get("xxsj").toString())
  1278 + + Integer.valueOf(tempMap.get("sxtssj").toString()) + Integer.valueOf(tempMap.get("xxtssj").toString()));
  1279 + tempMap.put("cjqj", cjs.size()>0?cjs.get(0)+"——"+cjs.get(cjs.size()-1):"——");
  1280 + tempMap.put("pjcj", cjs.size()>0?zcj/cjs.size():"/");
  1281 + newList.add(tempMap);
  1282 + /*
899 Map<String, List<Map<String, Object>>> keyMap = new HashMap<String, List<Map<String, Object>>>(); 1283 Map<String, List<Map<String, Object>>> keyMap = new HashMap<String, List<Map<String, Object>>>();
900 Map<String, Map<String, Object>> maps = new HashMap<String, Map<String, Object>>(); 1284 Map<String, Map<String, Object>> maps = new HashMap<String, Map<String, Object>>();
901 keyMap.put("(首)——6:30", new ArrayList<Map<String, Object>>()); 1285 keyMap.put("(首)——6:30", new ArrayList<Map<String, Object>>());
@@ -929,58 +1313,72 @@ public class ReportServiceImpl implements ReportService{ @@ -929,58 +1313,72 @@ public class ReportServiceImpl implements ReportService{
929 List<Integer> fcsj_x = new ArrayList<Integer>(); 1313 List<Integer> fcsj_x = new ArrayList<Integer>();
930 int sxsj = 0, xxsj = 0, sxtssj = 0, xxtssj = 0; 1314 int sxsj = 0, xxsj = 0, sxtssj = 0, xxtssj = 0;
931 int sxbc = 0, xxbc = 0, sxtsbc = 0, xxtsbc = 0; 1315 int sxbc = 0, xxbc = 0, sxtsbc = 0, xxtsbc = 0;
932 - int temp = 24*60+1, zcj = 0; 1316 + int temp = 48*60+1, zcj = 0;
933 boolean ists = false; 1317 boolean ists = false;
934 String lpname=""; 1318 String lpname="";
935 for(Map<String, Object> m : list2){ 1319 for(Map<String, Object> m : list2){
936 - String[] split = m.get("fcsj").toString().split(":");  
937 - int fcsj = Integer.valueOf(split[0])*60 + Integer.valueOf(split[1]);  
938 -  
939 - int xlDir = Integer.valueOf(m.get("dir").toString());  
940 - int bcsj = Integer.valueOf(m.get("bcsj").toString());  
941 - if(temp >= fcsj){  
942 - temp = fcsj;  
943 - ists = false;  
944 - }  
945 - if(xlDir == 0){  
946 - fcsj_s.add(fcsj);  
947 - sxsj += bcsj;  
948 - sxbc ++;  
949 - if(!ists){  
950 - if(lpname.equals("")){  
951 - lpname=m.get("lp").toString();  
952 - }else{  
953 - if(lpname.equals(m.get("lp").toString())){  
954 - sxtssj += (fcsj+bcsj) - temp; 1320 + String bcType=m.get("bcType").toString();
  1321 + if(bcType.equals("in") || bcType.equals("out")){
  1322 + temp=24*60+1;
  1323 + }else{
  1324 + String[] split = m.get("fcsj").toString().split(":");
  1325 + int fcsj = Integer.valueOf(split[0])*60 + Integer.valueOf(split[1]);
  1326 +
  1327 + int xlDir = Integer.valueOf(m.get("dir").toString());
  1328 + int bcsj = Integer.valueOf(m.get("bcsj").toString());
  1329 + if(temp >= fcsj){
  1330 + temp = fcsj+bcsj;
  1331 + ists = false;
  1332 + }
  1333 + if(xlDir == 0){
  1334 + fcsj_s.add(fcsj);
  1335 + sxsj += bcsj;
  1336 + sxbc ++;
  1337 + if(!ists){
  1338 + if(lpname.equals("")){
  1339 + lpname=m.get("lp").toString();
  1340 + }else{
  1341 + if(lpname.equals(m.get("lp").toString())){
  1342 + if(fcsj-temp<90){
  1343 + sxtssj += fcsj - temp;
  1344 + }
  1345 + }
  1346 + lpname=m.get("lp").toString();
  1347 +
955 } 1348 }
  1349 + sxtsbc++;
956 } 1350 }
957 - sxtsbc++;  
958 - }  
959 - } else {  
960 - fcsj_x.add(fcsj);  
961 - xxsj += bcsj;  
962 - xxbc ++;  
963 -  
964 - if(!ists){  
965 1351
966 - if(lpname.equals("")){  
967 - lpname=m.get("lp").toString();  
968 - }else{  
969 - if(lpname.equals(m.get("lp").toString())){  
970 - xxtssj += (fcsj+bcsj) - temp; 1352 + } else {
  1353 +
  1354 + fcsj_x.add(fcsj);
  1355 + xxsj += bcsj;
  1356 + xxbc ++;
  1357 +
  1358 + if(!ists){
  1359 + if(lpname.equals("")){
  1360 + lpname=m.get("lp").toString();
  1361 + }else{
  1362 + if(lpname.equals(m.get("lp").toString())){
  1363 + if(fcsj-temp<90){
  1364 + xxtssj += fcsj- temp;
  1365 + }
  1366 + }
  1367 + lpname=m.get("lp").toString();
971 } 1368 }
  1369 + xxtsbc++;
972 } 1370 }
973 - xxtsbc++; 1371 +
  1372 + }
  1373 + if(temp < fcsj){
  1374 + cjs.add(fcsj - temp);
  1375 + temp = fcsj;
  1376 + }
  1377 + if(m.get("ists").toString().trim().equals("1")){
  1378 + ists = true;
  1379 + }else{
  1380 + ists=false;
974 } 1381 }
975 - }  
976 - /*if(temp < fcsj){  
977 - cjs.add(fcsj - temp);  
978 - temp = fcsj;  
979 - }*/  
980 - if(m.get("ists").toString().trim().equals("1")){  
981 - ists = true;  
982 - }else{  
983 - ists=false;  
984 } 1382 }
985 } 1383 }
986 Collections.sort(fcsj_s); 1384 Collections.sort(fcsj_s);
@@ -1024,7 +1422,7 @@ public class ReportServiceImpl implements ReportService{ @@ -1024,7 +1422,7 @@ public class ReportServiceImpl implements ReportService{
1024 newList.add(maps.get("6:31——8:30")); 1422 newList.add(maps.get("6:31——8:30"));
1025 newList.add(maps.get("8:31——16:00")); 1423 newList.add(maps.get("8:31——16:00"));
1026 newList.add(maps.get("16:01——18:00")); 1424 newList.add(maps.get("16:01——18:00"));
1027 - newList.add(maps.get("18:01——(末)")); 1425 + newList.add(maps.get("18:01——(末)"));*/
1028 1426
1029 return newList; 1427 return newList;
1030 } 1428 }
src/main/java/com/bsth/service/schedule/impl/SchedulePlanServiceImpl.java
@@ -30,6 +30,7 @@ import org.kie.api.runtime.KieSession; @@ -30,6 +30,7 @@ import org.kie.api.runtime.KieSession;
30 import org.slf4j.Logger; 30 import org.slf4j.Logger;
31 import org.slf4j.LoggerFactory; 31 import org.slf4j.LoggerFactory;
32 import org.springframework.beans.factory.annotation.Autowired; 32 import org.springframework.beans.factory.annotation.Autowired;
  33 +import org.springframework.beans.factory.annotation.Qualifier;
33 import org.springframework.stereotype.Service; 34 import org.springframework.stereotype.Service;
34 import org.springframework.transaction.annotation.Isolation; 35 import org.springframework.transaction.annotation.Isolation;
35 import org.springframework.transaction.annotation.Propagation; 36 import org.springframework.transaction.annotation.Propagation;
@@ -43,7 +44,13 @@ import java.util.*; @@ -43,7 +44,13 @@ import java.util.*;
43 @Service 44 @Service
44 public class SchedulePlanServiceImpl extends BServiceImpl<SchedulePlan, Long> implements SchedulePlanService { 45 public class SchedulePlanServiceImpl extends BServiceImpl<SchedulePlan, Long> implements SchedulePlanService {
45 @Autowired 46 @Autowired
  47 + @Qualifier("kb1")
46 private KieBase kieBase; 48 private KieBase kieBase;
  49 +
  50 + @Autowired
  51 + @Qualifier("kb2")
  52 + private KieBase kieBase2;
  53 +
47 @Autowired 54 @Autowired
48 private ScheduleRule1FlatRepository scheduleRule1FlatRepository; 55 private ScheduleRule1FlatRepository scheduleRule1FlatRepository;
49 @Autowired 56 @Autowired
@@ -60,11 +67,49 @@ public class SchedulePlanServiceImpl extends BServiceImpl&lt;SchedulePlan, Long&gt; im @@ -60,11 +67,49 @@ public class SchedulePlanServiceImpl extends BServiceImpl&lt;SchedulePlan, Long&gt; im
60 private BusinessRepository businessRepository; 67 private BusinessRepository businessRepository;
61 @Autowired 68 @Autowired
62 private ScheduleRuleService scheduleRuleService; 69 private ScheduleRuleService scheduleRuleService;
  70 + @Autowired
  71 + private RerunRuleRepository rerunRuleRepository;
63 72
64 /** 日志记录器 */ 73 /** 日志记录器 */
65 private Logger logger = LoggerFactory.getLogger(SchedulePlanServiceImpl.class); 74 private Logger logger = LoggerFactory.getLogger(SchedulePlanServiceImpl.class);
66 75
67 /** 76 /**
  77 + * 计算规则输入。
  78 + * @param schedulePlan
  79 + * @return
  80 + */
  81 + private List<ScheduleRule_input> calcuSrfList(SchedulePlan schedulePlan) {
  82 + // 1-1、构造drools规则输入数据,输出数据
  83 + // 全局计算参数
  84 + ScheduleCalcuParam_input scheduleCalcuParam_input = new ScheduleCalcuParam_input(schedulePlan);
  85 +
  86 + // 规则输出数据
  87 + List<ScheduleRule_input> scheduleRule_inputs = new ArrayList<>();
  88 +
  89 + // 1-2、构造drools session->载入数据->启动规则->计算->销毁session
  90 + // 创建session,内部配置的是stateful
  91 + KieSession session = kieBase2.newKieSession();
  92 + // 设置gloable对象,在drl中通过别名使用
  93 + session.setGlobal("sriList", scheduleRule_inputs);
  94 + session.setGlobal("log", logger); // 设置日志
  95 +
  96 + session.setGlobal("srf", scheduleRule1FlatRepository);
  97 + session.setGlobal("rrr", rerunRuleRepository);
  98 + session.setGlobal("srservice", scheduleRuleService);
  99 +
  100 + // 载入数据
  101 + session.insert(scheduleCalcuParam_input);
  102 +
  103 + // 执行rule
  104 + session.fireAllRules();
  105 +
  106 + // 执行完毕销毁,有日志的也要关闭
  107 + session.dispose();
  108 +
  109 + return scheduleRule_inputs;
  110 + }
  111 +
  112 + /**
68 * 循环规则输出。 113 * 循环规则输出。
69 * @param schedulePlan 排班计划对象 114 * @param schedulePlan 排班计划对象
70 * @param lpInfoResults_output 时刻表每日路牌的情况 115 * @param lpInfoResults_output 时刻表每日路牌的情况
@@ -76,13 +121,7 @@ public class SchedulePlanServiceImpl extends BServiceImpl&lt;SchedulePlan, Long&gt; im @@ -76,13 +121,7 @@ public class SchedulePlanServiceImpl extends BServiceImpl&lt;SchedulePlan, Long&gt; im
76 // 全局计算参数 121 // 全局计算参数
77 ScheduleCalcuParam_input scheduleCalcuParam_input = new ScheduleCalcuParam_input(schedulePlan); 122 ScheduleCalcuParam_input scheduleCalcuParam_input = new ScheduleCalcuParam_input(schedulePlan);
78 // 每个规则对应的输入参数 123 // 每个规则对应的输入参数
79 - List<ScheduleRule_input> scheduleRule_inputs = new ArrayList<>();  
80 - List<ScheduleRule1Flat> scheduleRule1Flats = scheduleRule1FlatRepository.findByXl(schedulePlan.getXl());  
81 -  
82 - for (ScheduleRule1Flat scheduleRule1Flat: scheduleRule1Flats) {  
83 - ScheduleRule_input scheduleRule_input = new ScheduleRule_input(scheduleRule1Flat);  
84 - scheduleRule_inputs.add(scheduleRule_input);  
85 - } 124 + List<ScheduleRule_input> scheduleRule_inputs = calcuSrfList(schedulePlan);
86 125
87 // 规则输出数据 126 // 规则输出数据
88 ScheduleResults_output scheduleResults_output = new ScheduleResults_output(); 127 ScheduleResults_output scheduleResults_output = new ScheduleResults_output();
src/main/java/com/bsth/service/schedule/rules/MyDroolsConfiguration.java
@@ -28,7 +28,7 @@ public class MyDroolsConfiguration { @@ -28,7 +28,7 @@ public class MyDroolsConfiguration {
28 * 返回一个kiebase知识库,直接冲文件系统读入drl规则文件, 28 * 返回一个kiebase知识库,直接冲文件系统读入drl规则文件,
29 * TODO:以后需要从数据库读入规则文件,并重新创建kbase知识库。 29 * TODO:以后需要从数据库读入规则文件,并重新创建kbase知识库。
30 */ 30 */
31 - @Bean 31 + @Bean(name = "kb1")
32 public KieBase myKieBase() { 32 public KieBase myKieBase() {
33 // Drools 6开始引入kie统一接口(jboss的jbpm工作流也使用kie接口了),整个定义方式和5差别很大 33 // Drools 6开始引入kie统一接口(jboss的jbpm工作流也使用kie接口了),整个定义方式和5差别很大
34 // 这里使用全api方式创建知识库对象,不使用xml的方式,提供最大的灵活性 34 // 这里使用全api方式创建知识库对象,不使用xml的方式,提供最大的灵活性
@@ -100,4 +100,65 @@ public class MyDroolsConfiguration { @@ -100,4 +100,65 @@ public class MyDroolsConfiguration {
100 100
101 return kieBase; 101 return kieBase;
102 } 102 }
  103 +
  104 + /**
  105 + * 返回一个kiebase知识库,直接冲文件系统读入drl规则文件,
  106 + * TODO:以后需要从数据库读入规则文件,并重新创建kbase知识库。
  107 + */
  108 + @Bean(name = "kb2")
  109 + public KieBase myKieBase2() {
  110 + // Drools 6开始引入kie统一接口(jboss的jbpm工作流也使用kie接口了),整个定义方式和5差别很大
  111 + // 这里使用全api方式创建知识库对象,不使用xml的方式,提供最大的灵活性
  112 +
  113 + // 1、创建kieservices
  114 + KieServices kieServices = KieServices.Factory.get();
  115 + // 2、创建KieModuleModel,默认是由kmodule.xml的方式创建,这里使用api方式闯将
  116 + KieModuleModel kieModuleModel = kieServices.newKieModuleModel();
  117 + // 2.1、创建KieBaseModel,类似kmodule.xml中的kbase标签
  118 + KieBaseModel kieBaseModel1 = kieModuleModel.newKieBaseModel("KBase2")
  119 + .setDefault(true)
  120 + .setEqualsBehavior(EqualityBehaviorOption.EQUALITY)
  121 + .setEventProcessingMode(EventProcessingOption.STREAM);
  122 + // 2.2、创建与kbase关联的KieSessionModel,类似kmodule.xml中的kbase内的ksession标签
  123 + kieBaseModel1.newKieSessionModel("KSession1")
  124 + .setDefault(true)
  125 + .setType(KieSessionModel.KieSessionType.STATEFUL)
  126 + .setClockType(ClockTypeOption.get("realtime"));
  127 +
  128 + // 3、创建KieFileSystem,将模型xml,drl等写入,TODO:以后考虑从数据库中获取
  129 + KieFileSystem kfs = kieServices.newKieFileSystem();
  130 + // 3.1、写入KieBaseModel(内部包含了KieSessionModel的内容了,注意之前的KieSessionModel的创建方式)
  131 + kfs.writeKModuleXML(kieModuleModel.toXML());
  132 +
  133 + // 3.2、写入drl(写法超多,有点混乱)
  134 + // 这里使用文件的形式写入,TODO:以后考虑从数据库中读drl写入
  135 + // 注意kfs写的时候如果指定path,强制为src/main/resources/加上文件名,还有就是文件名不要重复否则会覆盖的
  136 +
  137 + kfs.write("src/main/resources/ruleWrap.drl", kieServices.getResources()
  138 + .newInputStreamResource(this.getClass().getResourceAsStream(
  139 + "/rules/ruleWrap.drl"), "UTF-8"));
  140 +
  141 + // TODO:还有其他drl....
  142 +
  143 + // 4、创建KieBuilder,使用KieFileSystem构建
  144 + KieBuilder kieBuilder = kieServices.newKieBuilder(kfs).buildAll();
  145 + Results results = kieBuilder.getResults();
  146 + if (results.hasMessages(Message.Level.ERROR))
  147 + throw new IllegalStateException("构建drools6错误:" + results.getMessages());
  148 +// if (results.hasMessages(Message.Level.ERROR)) {
  149 +// logger.info("构建drools6错误:" + results.getMessages());
  150 +// return null;
  151 +// }
  152 +
  153 + // 5、获取KieContainer
  154 + // TODO:ReleaseId用处很大,以后再议
  155 + ReleaseId releaseId = kieServices.getRepository().getDefaultReleaseId();
  156 + KieContainer kieContainer = kieServices.newKieContainer(releaseId);
  157 +
  158 + // 6、创建kbase
  159 + KieBaseConfiguration kieBaseConfiguration = kieServices.newKieBaseConfiguration();
  160 + KieBase kieBase = kieContainer.newKieBase("KBase2", kieBaseConfiguration);
  161 +
  162 + return kieBase;
  163 + }
103 } 164 }
src/main/java/com/bsth/service/schedule/rules/shiftloop/ScheduleResult_output.java
@@ -20,6 +20,9 @@ public class ScheduleResult_output { @@ -20,6 +20,9 @@ public class ScheduleResult_output {
20 /** 线路id */ 20 /** 线路id */
21 private String xlId; 21 private String xlId;
22 22
  23 + /** 排班输入规则类型 */
  24 + private ScheduleRule_Type sType = ScheduleRule_Type.NORMAL;
  25 +
23 public DateTime getSd() { 26 public DateTime getSd() {
24 return sd; 27 return sd;
25 } 28 }
@@ -67,4 +70,12 @@ public class ScheduleResult_output { @@ -67,4 +70,12 @@ public class ScheduleResult_output {
67 public void setXlId(String xlId) { 70 public void setXlId(String xlId) {
68 this.xlId = xlId; 71 this.xlId = xlId;
69 } 72 }
  73 +
  74 + public ScheduleRule_Type getsType() {
  75 + return sType;
  76 + }
  77 +
  78 + public void setsType(ScheduleRule_Type sType) {
  79 + this.sType = sType;
  80 + }
70 } 81 }
src/main/java/com/bsth/service/schedule/rules/shiftloop/ScheduleRule_Type.java 0 → 100644
  1 +package com.bsth.service.schedule.rules.shiftloop;
  2 +
  3 +/**
  4 + * 排班规则_输入_输出_类型。
  5 + */
  6 +public enum ScheduleRule_Type {
  7 + NORMAL, // 正常类型
  8 + // 套跑类型,使用套跑规则当作实际规则。
  9 + // 有的线路所有路牌都没有规则,或者只有部份规则,
  10 + // 则需要先补充temp规则,路牌id,人员配置id,车辆配置id都设为'NULL'
  11 + // 最后套跑规则重新排班覆盖temp规则
  12 + RERUN
  13 +}
src/main/java/com/bsth/service/schedule/rules/shiftloop/ScheduleRule_input.java
@@ -37,6 +37,9 @@ public class ScheduleRule_input { @@ -37,6 +37,9 @@ public class ScheduleRule_input {
37 /** 车辆翻版(周一到周日是否启用) */ 37 /** 车辆翻版(周一到周日是否启用) */
38 private List<Boolean> weekdays = new ArrayList<>(); 38 private List<Boolean> weekdays = new ArrayList<>();
39 39
  40 + /** 排班输入规则类型 */
  41 + private ScheduleRule_Type sType = ScheduleRule_Type.NORMAL;
  42 +
40 /** 关联的原始规则 */ 43 /** 关联的原始规则 */
41 private ScheduleRule1Flat self; 44 private ScheduleRule1Flat self;
42 45
@@ -164,4 +167,11 @@ public class ScheduleRule_input { @@ -164,4 +167,11 @@ public class ScheduleRule_input {
164 this.self = self; 167 this.self = self;
165 } 168 }
166 169
  170 + public ScheduleRule_Type getsType() {
  171 + return sType;
  172 + }
  173 +
  174 + public void setsType(ScheduleRule_Type sType) {
  175 + this.sType = sType;
  176 + }
167 } 177 }
src/main/java/com/bsth/service/traffic/YgcBasicDataService.java
@@ -17,5 +17,14 @@ public interface YgcBasicDataService { @@ -17,5 +17,14 @@ public interface YgcBasicDataService {
17 * @return 17 * @return
18 */ 18 */
19 String invokeMethod(String methodName,String param); 19 String invokeMethod(String methodName,String param);
  20 +
  21 + /**
  22 + * 下载基础数据,并生成rar文件
  23 + * @param userName
  24 + * @param password
  25 + * @param saveFile
  26 + * @return
  27 + */
  28 + boolean download(String userName, String password, String saveFile);
20 } 29 }
21 30
src/main/java/com/bsth/service/traffic/impl/YgcBasicDataServiceImpl.java
@@ -68,7 +68,7 @@ public class YgcBasicDataServiceImpl implements YgcBasicDataService{ @@ -68,7 +68,7 @@ public class YgcBasicDataServiceImpl implements YgcBasicDataService{
68 String flag = "failure"; 68 String flag = "failure";
69 try { 69 try {
70 // 调用接口下载基础数据 70 // 调用接口下载基础数据
71 - if(download(userName, DigestUtils.md5Hex(passWord), saveFile)){ 71 + if(download(userName, passWord, saveFile)){
72 // 读取基础数据zip 72 // 读取基础数据zip
73 StringBuffer sb = readZipFile(saveFile); 73 StringBuffer sb = readZipFile(saveFile);
74 // 解析xml 74 // 解析xml
@@ -99,10 +99,11 @@ public class YgcBasicDataServiceImpl implements YgcBasicDataService{ @@ -99,10 +99,11 @@ public class YgcBasicDataServiceImpl implements YgcBasicDataService{
99 * @param saveFile 99 * @param saveFile
100 * @return 100 * @return
101 */ 101 */
102 - private boolean download(String userName, String password, String saveFile) 102 + public boolean download(String userName, String password, String saveFile)
103 { 103 {
104 try 104 try
105 { 105 {
  106 + password = DigestUtils.md5Hex(password);
106 OMElement data = buildDownloadEnvelope(userName, password); 107 OMElement data = buildDownloadEnvelope(userName, password);
107 ServiceClient sender = new ServiceClient(); 108 ServiceClient sender = new ServiceClient();
108 Options options = sender.getOptions(); 109 Options options = sender.getOptions();
@@ -123,6 +124,12 @@ public class YgcBasicDataServiceImpl implements YgcBasicDataService{ @@ -123,6 +124,12 @@ public class YgcBasicDataServiceImpl implements YgcBasicDataService{
123 while ((read = is.read(buffer)) != -1) { 124 while ((read = is.read(buffer)) != -1) {
124 imageOutStream.write(buffer, 0, read); 125 imageOutStream.write(buffer, 0, read);
125 } 126 }
  127 + if(is != null){
  128 + is.close();
  129 + }
  130 + if(imageOutStream != null){
  131 + imageOutStream.close();
  132 + }
126 return true; 133 return true;
127 } catch (Exception e) { 134 } catch (Exception e) {
128 e.printStackTrace(); 135 e.printStackTrace();
src/main/resources/rules/plan.drl
@@ -27,7 +27,8 @@ import com.bsth.entity.schedule.SchedulePlanInfo; @@ -27,7 +27,8 @@ import com.bsth.entity.schedule.SchedulePlanInfo;
27 27
28 import org.slf4j.Logger 28 import org.slf4j.Logger
29 import org.joda.time.format.DateTimeFormat 29 import org.joda.time.format.DateTimeFormat
30 -import org.apache.commons.lang3.StringUtils; 30 +import org.apache.commons.lang3.StringUtils
  31 +import com.bsth.service.schedule.rules.shiftloop.ScheduleRule_Type;
31 32
32 33
33 // 全局日志类(一般使用调用此规则的service类) 34 // 全局日志类(一般使用调用此规则的service类)
@@ -385,9 +386,11 @@ rule &quot;Calcu_SchedulePlanInfo&quot; @@ -385,9 +386,11 @@ rule &quot;Calcu_SchedulePlanInfo&quot;
385 // 路牌 386 // 路牌
386 String gid = sro.getGuideboardId(); 387 String gid = sro.getGuideboardId();
387 // 车辆配置 388 // 车辆配置
388 - CarConfigInfo carConfigInfo = (CarConfigInfo) $ccs.getCcMap().get(sro.getCarConfigId()); 389 + CarConfigInfo carConfigInfo = sro.getsType() == ScheduleRule_Type.NORMAL ?
  390 + (CarConfigInfo) $ccs.getCcMap().get(sro.getCarConfigId()) : null;
389 // 人员配置 391 // 人员配置
390 - List eclist = ecList(employeeConfigInfoRepository, sro.getEmployeeConfigId()); 392 + List eclist = sro.getsType() == ScheduleRule_Type.NORMAL ?
  393 + ecList(employeeConfigInfoRepository, sro.getEmployeeConfigId()) : null;
391 394
392 // 时刻表id 395 // 时刻表id
393 String ttInfoId = ttInfoId_sd($lr.getTtInfoMapLoop(), sd); 396 String ttInfoId = ttInfoId_sd($lr.getTtInfoMapLoop(), sd);
@@ -419,7 +422,8 @@ rule &quot;Calcu_SchedulePlanInfo&quot; @@ -419,7 +422,8 @@ rule &quot;Calcu_SchedulePlanInfo&quot;
419 eclist, 422 eclist,
420 $param.getSchedulePlan(), 423 $param.getSchedulePlan(),
421 wrap.getIsFirstBc(), 424 wrap.getIsFirstBc(),
422 - wrap.getIsLastBc() 425 + wrap.getIsLastBc(),
  426 + sro.getsType()
423 ); 427 );
424 428
425 // 获取公司,分公司信息 429 // 获取公司,分公司信息
src/main/resources/rules/ruleWrap.drl 0 → 100644
  1 +package com.bsth.service.schedule.rulewrap;
  2 +
  3 +import org.joda.time.*;
  4 +import java.util.*;
  5 +import org.slf4j.Logger;
  6 +
  7 +import com.bsth.service.schedule.rules.shiftloop.ScheduleCalcuParam_input;
  8 +import com.bsth.service.schedule.rules.shiftloop.ScheduleRule_input;
  9 +import com.bsth.service.schedule.rules.shiftloop.ScheduleRule_Type;
  10 +
  11 +import com.bsth.repository.schedule.RerunRuleRepository;
  12 +import com.bsth.repository.schedule.ScheduleRule1FlatRepository;
  13 +
  14 +import com.bsth.service.schedule.rules.rerun.RerunRule_input;
  15 +import com.bsth.service.schedule.rules.ScheduleRuleService;
  16 +
  17 +import com.bsth.entity.Line;
  18 +import com.bsth.entity.schedule.CarConfigInfo
  19 +import com.bsth.entity.schedule.EmployeeConfigInfo;
  20 +
  21 +// 全局日志类(一般使用调用此规则的service类)
  22 +global Logger log;
  23 +
  24 +global ScheduleRule1FlatRepository srf;
  25 +global RerunRuleRepository rrr;
  26 +global ScheduleRuleService srservice;
  27 +global List sriList;
  28 +
  29 +
  30 +declare Sri_Wrap
  31 + xlId : String // 线路id
  32 + lpIds : List // 路牌id
  33 + srf : Object // ScheduleRule1Flat类型
  34 + sri : ScheduleRule_input; // ScheduleRule_input输入
  35 +end
  36 +
  37 +rule "rw1"
  38 + salience 1000
  39 + when
  40 + ScheduleCalcuParam_input(
  41 + $fromDate : fromDate,
  42 + $toDate : toDate,
  43 + $xlId: xlId
  44 + )
  45 + $srf : Object() from srf.findByXlId(Integer.parseInt($xlId))
  46 + then
  47 + // 创建Sri_Wrap
  48 + Sri_Wrap sw = new Sri_Wrap();
  49 + sw.setXlId($xlId);
  50 + sw.setSrf($srf);
  51 + ScheduleRule_input sri = new ScheduleRule_input((com.bsth.entity.schedule.rule.ScheduleRule1Flat) sw.getSrf());
  52 + sw.setSri(sri);
  53 + sw.setLpIds(sri.getGuideboardIds());
  54 +
  55 + insert(sw);
  56 +
  57 +end
  58 +
  59 +rule "rw2"
  60 + salience 800
  61 + no-loop
  62 + when
  63 + ScheduleCalcuParam_input(
  64 + $fromDate : fromDate,
  65 + $toDate : toDate,
  66 + $xlId: xlId
  67 + )
  68 + $reu : RerunRule_input($lpId : lp) from srservice.findRerunrule(Integer.parseInt($xlId))
  69 + not Sri_Wrap(xlId == $xlId, lpIds contains $lpId)
  70 + then
  71 + // 套跑中有规则,主线路的路牌,主线路该路牌不存在,添加一个临时的,做处理
  72 + Sri_Wrap sw = new Sri_Wrap();
  73 + sw.setSrf(new com.bsth.entity.schedule.rule.ScheduleRule1Flat());
  74 + // 线路
  75 + Line xl = new Line();
  76 + xl.setId(Integer.valueOf($xlId));
  77 + ((com.bsth.entity.schedule.rule.ScheduleRule1Flat) sw.getSrf()).setXl(xl);
  78 + // id
  79 + ((com.bsth.entity.schedule.rule.ScheduleRule1Flat) sw.getSrf()).setId((new Date()).getTime());
  80 + // 启用日期
  81 + ((com.bsth.entity.schedule.rule.ScheduleRule1Flat) sw.getSrf()).setQyrq($fromDate.toDate());
  82 + // 车辆配置
  83 + CarConfigInfo cci = new CarConfigInfo();
  84 + cci.setId(new Date().getTime());
  85 + ((com.bsth.entity.schedule.rule.ScheduleRule1Flat) sw.getSrf()).setCarConfigInfo(cci);
  86 + // 人员配置
  87 + ((com.bsth.entity.schedule.rule.ScheduleRule1Flat) sw.getSrf()).setRyConfigIds("TEMP");
  88 + // 人员搭班编码
  89 + ((com.bsth.entity.schedule.rule.ScheduleRule1Flat) sw.getSrf()).setRyDbbms("TEMP");
  90 + // 起始人员
  91 + ((com.bsth.entity.schedule.rule.ScheduleRule1Flat) sw.getSrf()).setRyStart(1);
  92 + // 路牌id
  93 + ((com.bsth.entity.schedule.rule.ScheduleRule1Flat) sw.getSrf()).setLpIds($lpId);
  94 + // 起始路牌
  95 + ((com.bsth.entity.schedule.rule.ScheduleRule1Flat) sw.getSrf()).setLpStart(1);
  96 +
  97 + ScheduleRule_input sri = new ScheduleRule_input((com.bsth.entity.schedule.rule.ScheduleRule1Flat) sw.getSrf());
  98 + sri.setsType(ScheduleRule_Type.RERUN);
  99 + sw.setSri(sri);
  100 +
  101 + sw.setXlId($xlId);
  102 +
  103 + List lpIds = new ArrayList();
  104 + lpIds.add($lpId);
  105 + sw.setLpIds(lpIds);
  106 +
  107 + insert(sw);
  108 +end
  109 +
  110 +rule "rw3"
  111 + salience 600
  112 + when
  113 + $sri_wrap : Sri_Wrap($sri : sri, $xlId: xlId, $lpIds : lpIds)
  114 + then
  115 + log.info("线路id={},lpids={}", $xlId, $lpIds);
  116 + sriList.add($sri);
  117 +end
0 \ No newline at end of file 118 \ No newline at end of file
src/main/resources/rules/shiftloop_fb_2.drl
@@ -9,6 +9,7 @@ import com.bsth.service.schedule.utils.Md5Util; @@ -9,6 +9,7 @@ import com.bsth.service.schedule.utils.Md5Util;
9 9
10 import com.bsth.service.schedule.rules.shiftloop.ScheduleCalcuParam_input; 10 import com.bsth.service.schedule.rules.shiftloop.ScheduleCalcuParam_input;
11 import com.bsth.service.schedule.rules.shiftloop.ScheduleRule_input; 11 import com.bsth.service.schedule.rules.shiftloop.ScheduleRule_input;
  12 +import com.bsth.service.schedule.rules.shiftloop.ScheduleRule_Type;
12 import com.bsth.service.schedule.rules.shiftloop.ScheduleResult_output; 13 import com.bsth.service.schedule.rules.shiftloop.ScheduleResult_output;
13 import com.bsth.service.schedule.rules.shiftloop.ScheduleResults_output; 14 import com.bsth.service.schedule.rules.shiftloop.ScheduleResults_output;
14 15
@@ -342,33 +343,41 @@ rule &quot;Calcu_loop2_1_&quot; // 路牌在时刻表中存在,就翻 @@ -342,33 +343,41 @@ rule &quot;Calcu_loop2_1_&quot; // 路牌在时刻表中存在,就翻
342 ro.setCarConfigId($cid); 343 ro.setCarConfigId($cid);
343 ro.setXlId($xlid); 344 ro.setXlId($xlid);
344 345
  346 + // 类型
  347 + ro.setsType($sri.getsType());
  348 +
345 scheduleResult.getResults().add(ro); 349 scheduleResult.getResults().add(ro);
346 350
  351 +// log.info("gogoogogogogo");
  352 +
347 $cdrp.setCalcu_index_lp(($lpindex + 1) % $lprangesize); 353 $cdrp.setCalcu_index_lp(($lpindex + 1) % $lprangesize);
348 $cdrp.setCalcu_index_ry(($ryindex + 1) % $ryrangesize); 354 $cdrp.setCalcu_index_ry(($ryindex + 1) % $ryrangesize);
349 $cdrp.setCalcu_start_date_2($csd2.plusDays(1)); 355 $cdrp.setCalcu_start_date_2($csd2.plusDays(1));
350 356
351 - // 保存排班规则循环结果 --> SchedulePlanRuleResult  
352 - SchedulePlanRuleResult schedulePlanRuleResult = new SchedulePlanRuleResult($sp); 357 + if ($sri.getsType() == ScheduleRule_Type.NORMAL) {
  358 + // 保存排班规则循环结果 --> SchedulePlanRuleResult
  359 + SchedulePlanRuleResult schedulePlanRuleResult = new SchedulePlanRuleResult($sp);
353 // schedulePlanRuleResult.setXlId(String.valueOf($srf.getXl().getId())); 360 // schedulePlanRuleResult.setXlId(String.valueOf($srf.getXl().getId()));
354 - schedulePlanRuleResult.setXlId($srf.getXl().getId());  
355 - schedulePlanRuleResult.setXlName($srf.getXl().getName());  
356 - schedulePlanRuleResult.setRuleId($ruleId);  
357 - schedulePlanRuleResult.setCcId($cid);  
358 - schedulePlanRuleResult.setCcZbh($srf.getCarConfigInfo().getCl().getInsideCode());  
359 - schedulePlanRuleResult.setGids($srf.getLpIds()); // 参与md5计算  
360 - schedulePlanRuleResult.setGnames($srf.getLpNames());  
361 - schedulePlanRuleResult.setGidindex(String.valueOf($lpindex));  
362 - schedulePlanRuleResult.setEcids($srf.getRyConfigIds());  
363 - schedulePlanRuleResult.setEcdbbms($srf.getRyDbbms());  
364 - schedulePlanRuleResult.setEcindex(String.valueOf($ryindex));  
365 - schedulePlanRuleResult.setScheduleDate($csd2.toDate());  
366 - schedulePlanRuleResult.setTtinfoId($ttinfoId);  
367 - schedulePlanRuleResult.setTtinfoName($ttinfoName);  
368 - schedulePlanRuleResult.setQyrq($sri.getQyrq().toDate()); // 参与md5计算  
369 - schedulePlanRuleResult.setOrigingidindex(String.valueOf($sri.getSelf().getLpStart())); // 参与md5计算  
370 -  
371 - scheduleResult.getSchedulePlanRuleResults().add(schedulePlanRuleResult); 361 + schedulePlanRuleResult.setXlId($srf.getXl().getId());
  362 + schedulePlanRuleResult.setXlName($srf.getXl().getName());
  363 + schedulePlanRuleResult.setRuleId($ruleId);
  364 + schedulePlanRuleResult.setCcId($cid);
  365 + schedulePlanRuleResult.setCcZbh($srf.getCarConfigInfo().getCl().getInsideCode());
  366 + schedulePlanRuleResult.setGids($srf.getLpIds()); // 参与md5计算
  367 + schedulePlanRuleResult.setGnames($srf.getLpNames());
  368 + schedulePlanRuleResult.setGidindex(String.valueOf($lpindex));
  369 + schedulePlanRuleResult.setEcids($srf.getRyConfigIds());
  370 + schedulePlanRuleResult.setEcdbbms($srf.getRyDbbms());
  371 + schedulePlanRuleResult.setEcindex(String.valueOf($ryindex));
  372 + schedulePlanRuleResult.setScheduleDate($csd2.toDate());
  373 + schedulePlanRuleResult.setTtinfoId($ttinfoId);
  374 + schedulePlanRuleResult.setTtinfoName($ttinfoName);
  375 + schedulePlanRuleResult.setQyrq($sri.getQyrq().toDate()); // 参与md5计算
  376 + schedulePlanRuleResult.setOrigingidindex(String.valueOf($sri.getSelf().getLpStart())); // 参与md5计算
  377 +
  378 + scheduleResult.getSchedulePlanRuleResults().add(schedulePlanRuleResult);
  379 + }
  380 +
372 381
373 382
374 // log.info("Calcu_loop2_1_ ruleId={}, calcu_index_lp/ry={}/{}, from={}, to={}", 383 // log.info("Calcu_loop2_1_ ruleId={}, calcu_index_lp/ry={}/{}, from={}, to={}",
@@ -406,6 +415,9 @@ rule &quot;Calcu_loop2_2_&quot; // 路牌在时刻表中不存在,就不翻 @@ -406,6 +415,9 @@ rule &quot;Calcu_loop2_2_&quot; // 路牌在时刻表中不存在,就不翻
406 ro.setCarConfigId($cid); 415 ro.setCarConfigId($cid);
407 ro.setXlId($xlid); 416 ro.setXlId($xlid);
408 417
  418 + // 类型
  419 + ro.setsType($sri.getsType());
  420 +
409 scheduleResult.getResults().add(ro); 421 scheduleResult.getResults().add(ro);
410 422
411 $cdrp.setCalcu_start_date_2($csd2.plusDays(1)); 423 $cdrp.setCalcu_start_date_2($csd2.plusDays(1));
src/main/resources/static/pages/base/interval/add.html 0 → 100644
  1 +<!-- 片段标题 START -->
  2 +<div class="page-head">
  3 + <div class="page-title">
  4 + <h1>新增间隔信息</h1>
  5 + </div>
  6 +</div>
  7 +<!-- 片段标题 END -->
  8 +
  9 +<!-- 线路信息导航栏组件 START -->
  10 +<ul class="page-breadcrumb breadcrumb">
  11 + <li><a href="/pages/home.html" data-pjax>首页</a> <i class="fa fa-circle"></i></li>
  12 + <li><span class="active">基础信息</span> <i class="fa fa-circle"></i></li>
  13 + <li><a href="/pages/base/interval/list.html" data-pjax>间隔信息</a> <i class="fa fa-circle"></i></li>
  14 + <li><span class="active">新增间隔信息</span></li>
  15 +</ul>
  16 +<!-- 线路信息导航栏组件 END -->
  17 +
  18 +<!-- 信息容器组件 START -->
  19 +<div class="portlet light bordered">
  20 +
  21 + <!-- 信息容器组件标题 START -->
  22 + <div class="portlet-title">
  23 + <div class="caption">
  24 + <i class="icon-equalizer font-red-sunglo"></i>
  25 + <span class="caption-subject font-red-sunglo bold uppercase">新增间隔信息</span>
  26 + </div>
  27 + </div>
  28 + <!-- 信息容器组件标题 END -->
  29 +
  30 + <!-- 表单容器组件 START -->
  31 + <div class="portlet-body form" id="intervalAddForm">
  32 +
  33 + <!-- START FORM -->
  34 + <form action="/" class="form-horizontal" id="interval_add_form" >
  35 +
  36 + <!-- 错误提示信息组件 START -->
  37 + <div class="alert alert-danger display-hide">
  38 + <button class="close" data-close="alert"></button>
  39 + 您的输入有误,请检查下面的输入项
  40 + </div>
  41 + <!-- 错误提示信息组件 END -->
  42 +
  43 + <!-- 表单内容 START -->
  44 + <div class="form-body">
  45 +
  46 + <!-- 表单分组组件 form-group START -->
  47 + <div class="form-group">
  48 + <div class="col-md-12" style="margin-top:10px">
  49 + <label class="control-label col-md-5"> 间隔等级&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:</label>
  50 + <div class="col-md-4">
  51 + <input type="text" class="form-control" name="level" id="level" placeholder="间隔等级">
  52 + </div>
  53 + </div>
  54 +
  55 + <div class="col-md-12" style="margin-top:10px">
  56 + <label class="control-label col-md-5"> 高峰间隔时间&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;: </label>
  57 + <div class="col-md-4">
  58 + <input type="text" class="form-control" name="peak" id="peak" placeholder="高峰间隔时间">
  59 + </div>
  60 + </div>
  61 +
  62 + <div class="col-md-12" style="margin-top:10px">
  63 + <label class="control-label col-md-5"> 低谷间隔时间&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;: </label>
  64 + <div class="col-md-4">
  65 + <input type="text" class="form-control" name="trough" id="trough" placeholder="低谷间隔时间">
  66 + </div>
  67 + </div>
  68 +
  69 + <div class="col-md-12" style="margin-top:10px" hidden>
  70 + <label class="control-label col-md-5"> 创建人&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;: </label>
  71 + <div class="col-md-4">
  72 + <input type="text" class="form-control" name="createBy" id="createBy" placeholder="创建人">
  73 + </div>
  74 + </div>
  75 +
  76 + </div>
  77 + <!-- 表单分组组件 form-group END -->
  78 +
  79 + <!-- 表单按钮组件 START -->
  80 + <div class="form-actions">
  81 + <div class="row">
  82 + <div class="col-md-offset-5 col-md-7">
  83 + <button type="submit" class="btn green" ><i class="fa fa-check"></i> 提交</button>
  84 + <a type="button" class="btn default" href="list.html" data-pjax><i class="fa fa-times"></i> 取消</a>
  85 + </div>
  86 + </div>
  87 + </div>
  88 + <!-- 表单按钮组件 END -->
  89 + </form>
  90 + <!-- END FORM-->
  91 + </div>
  92 + <!-- 表单组件 END -->
  93 +</div>
  94 +<!-- 信息容器组件 END -->
  95 +
  96 +<!-- 线路信息修改片段JS模块 -->
  97 +<script src="/pages/base/interval/js/interval-add-form.js"></script>
0 \ No newline at end of file 98 \ No newline at end of file
src/main/resources/static/pages/base/interval/edit.html 0 → 100644
  1 +<!-- 片段标题 START -->
  2 +<div class="page-head">
  3 + <div class="page-title">
  4 + <h1>修改间隔信息</h1>
  5 + </div>
  6 +</div>
  7 +<!-- 片段标题 END -->
  8 +
  9 +<!-- 线路信息导航栏组件 START -->
  10 +<ul class="page-breadcrumb breadcrumb">
  11 + <li><a href="/pages/home.html" data-pjax>首页</a> <i class="fa fa-circle"></i></li>
  12 + <li><span class="active">基础信息</span> <i class="fa fa-circle"></i></li>
  13 + <li><a href="/pages/base/interval/list.html" data-pjax>间隔信息</a> <i class="fa fa-circle"></i></li>
  14 + <li><span class="active">修改间隔信息</span></li>
  15 +</ul>
  16 +<!-- 线路信息导航栏组件 END -->
  17 +
  18 +<!-- 信息容器组件 START -->
  19 +<div class="portlet light bordered">
  20 +
  21 + <!-- 信息容器组件标题 START -->
  22 + <div class="portlet-title">
  23 + <div class="caption">
  24 + <i class="icon-equalizer font-red-sunglo"></i>
  25 + <span class="caption-subject font-red-sunglo bold uppercase">修改间隔信息</span>
  26 + </div>
  27 + </div>
  28 + <!-- 信息容器组件标题 END -->
  29 +
  30 + <!-- 表单容器组件 START -->
  31 + <div class="portlet-body form" id="intervalEditForm">
  32 +
  33 + <!-- START FORM -->
  34 + <form action="/" class="form-horizontal" id="interval_edit_form" >
  35 +
  36 + <!-- 错误提示信息组件 START -->
  37 + <div class="alert alert-danger display-hide">
  38 + <button class="close" data-close="alert"></button>
  39 + 您的输入有误,请检查下面的输入项
  40 + </div>
  41 + <!-- 错误提示信息组件 END -->
  42 +
  43 + <!-- 表单内容 START -->
  44 + <div class="form-body">
  45 + <input type="hidden" name="id" id="intervalId">
  46 +
  47 + <!-- 表单分组组件 form-group START -->
  48 + <div class="form-group">
  49 + <div class="col-md-12" style="margin-top:10px">
  50 + <label class="control-label col-md-5"> 间隔等级&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:</label>
  51 + <div class="col-md-4">
  52 + <input type="text" class="form-control" name="level" id="levelInput" placeholder="间隔等级">
  53 + </div>
  54 + </div>
  55 +
  56 + <div class="col-md-12" style="margin-top:10px">
  57 + <label class="control-label col-md-5"> 高峰间隔时间&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;: </label>
  58 + <div class="col-md-4">
  59 + <input type="text" class="form-control" name="peak" id="peakInput" placeholder="高峰间隔时间">
  60 + </div>
  61 + </div>
  62 +
  63 + <div class="col-md-12" style="margin-top:10px">
  64 + <label class="control-label col-md-5"> 低谷间隔时间&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;: </label>
  65 + <div class="col-md-4">
  66 + <input type="text" class="form-control" name="trough" id="troughInput" placeholder="低谷间隔时间">
  67 + </div>
  68 + </div>
  69 +
  70 + <div class="col-md-12" style="margin-top:10px">
  71 + <label class="control-label col-md-5"> 创建人&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;: </label>
  72 + <div class="col-md-4">
  73 + <input type="text" class="form-control" name="createBy" id="createByInput" readonly>
  74 + </div>
  75 + </div>
  76 +
  77 + <div class="col-md-12" style="margin-top:10px">
  78 + <label class="control-label col-md-5"> 创建时间&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;: </label>
  79 + <div class="col-md-4">
  80 + <input type="text" class="form-control" name="createDate" id="createDateInput" disabled>
  81 + </div>
  82 + </div>
  83 +
  84 + <div class="col-md-12" style="margin-top:10px">
  85 + <label class="control-label col-md-5"> 修改人&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;: </label>
  86 + <div class="col-md-4">
  87 + <input type="text" class="form-control" name="updateBy" id="updateByInput" readonly>
  88 + </div>
  89 + </div>
  90 +
  91 + <div class="col-md-12" style="margin-top:10px">
  92 + <label class="control-label col-md-5"> 修改时间&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;: </label>
  93 + <div class="col-md-4">
  94 + <input type="text" class="form-control" name="updateDate" id="updateDateInput" disabled>
  95 + </div>
  96 + </div>
  97 +
  98 + </div>
  99 + <!-- 表单分组组件 form-group END -->
  100 +
  101 + <!-- 表单按钮组件 START -->
  102 + <div class="form-actions">
  103 + <div class="row">
  104 + <div class="col-md-offset-5 col-md-7">
  105 + <button type="submit" class="btn green" ><i class="fa fa-check"></i> 提交</button>
  106 + <a type="button" class="btn default" href="list.html" data-pjax><i class="fa fa-times"></i> 取消</a>
  107 + </div>
  108 + </div>
  109 + </div>
  110 + <!-- 表单按钮组件 END -->
  111 + </form>
  112 + <!-- END FORM-->
  113 + </div>
  114 + <!-- 表单组件 END -->
  115 +</div>
  116 +<!-- 信息容器组件 END -->
  117 +
  118 +<!-- 线路信息修改片段JS模块 -->
  119 +<script src="/pages/base/interval/js/interval-edit-form.js"></script>
0 \ No newline at end of file 120 \ No newline at end of file
src/main/resources/static/pages/base/interval/js/interval-add-form.js 0 → 100644
  1 +/**
  2 + * @description TODO(公司信息添加片段JS模块)
  3 + *
  4 + * @author bsth@lq
  5 + *
  6 + * @date 二〇一六年十月十八日 13:31:58
  7 + *
  8 + */
  9 +
  10 +$(function(){
  11 + // 定义表单
  12 + var form = $('#interval_add_form');
  13 + // 定义表单异常
  14 + var error = $('.alert-danger',form);
  15 + $.ajax({
  16 + type: "get",
  17 + async:false,
  18 + url: '/user/currentUser',
  19 + success: function (user) {
  20 + $("#createBy").val(user.userName);
  21 + }
  22 + })
  23 + // 表单验证
  24 + form.validate({
  25 + // 错误提示元素span对象
  26 + errorElement : 'span',
  27 + // 错误提示元素class名称
  28 + errorClass : 'help-block help-block-error',
  29 + // 验证错误获取焦点
  30 + focusInvalid : true,
  31 + // 需要验证的表单元素
  32 + rules : {
  33 + // 公司名称编码
  34 + 'level' : {
  35 + // 必填项
  36 + required : true,
  37 + // 最大长度
  38 + maxlength: 10
  39 + },
  40 + // 公司名称
  41 + 'peak' : {
  42 + // 必填项
  43 + required : true,
  44 + // 最大长度
  45 + maxlength: 10
  46 + },
  47 + // 公司名称
  48 + 'trough' : {
  49 + // 必填项
  50 + required : true,
  51 + // 最大长度
  52 + maxlength: 10
  53 + },
  54 + },
  55 + /**
  56 + * 类型:Callback。当未通过验证的表单提交时,可以在该回调函数中处理一些事情。
  57 + *
  58 + * 参数:该回调函数有两个参数:第一个为一个事件对象,第二个为验证器(validator)
  59 + */
  60 + invalidHandler : function(event, validator) {
  61 + // 显示表单未通过提示信息
  62 + error.show();
  63 + // 把提示信息放到指定的位置。
  64 + App.scrollTo(error, -200);
  65 + },
  66 + /**
  67 + * 类型:Callback。
  68 + *
  69 + * 默认:添加errorClass("has-error")到表单元素。将未通过验证的表单元素设置高亮。
  70 + */
  71 + highlight : function(element) {
  72 + // 添加errorClass("has-error")到表单元素
  73 + $(element).closest('.form-group').addClass('has-error');
  74 +
  75 + },
  76 + /**
  77 + * 类型:Callback。
  78 + *
  79 + * 默认:移除errorClass("has-error")。与highlight操作相反
  80 + */
  81 + unhighlight : function(element) {
  82 + // 移除errorClass("has-error")
  83 + $(element).closest('.form-group').removeClass('has-error');
  84 +
  85 + },
  86 + /**
  87 + * 类型:String,Callback。
  88 + *
  89 + * 如果指定它,当验证通过时显示一个消息。
  90 + *
  91 + * 如果是String类型的,则添加该样式到标签中;
  92 + *
  93 + * 如果是一个回调函数,则将标签作为其唯一的参数。
  94 + */
  95 + success : function(label) {
  96 + // 当验证通过时,移除errorClass("has-error")
  97 + label.closest('.form-group').removeClass('has-error');
  98 + },
  99 +
  100 + /**
  101 + * 类型:Callback。
  102 + *
  103 + * 默认:default (native) form submit;当表单通过验证,提交表单。回调函数有个默认参数form
  104 + */
  105 + submitHandler : function(f) {
  106 + // 隐藏错误提示
  107 + error.hide();
  108 + // 表单序列化
  109 + var params = form.serializeJSON();
  110 + console.log(params);
  111 + submit();
  112 + // 提交
  113 + function submit() {
  114 + // 添加数据
  115 + $post('/interval', params, function(result) {
  116 + // 如果返回结果不为空
  117 + if(result){
  118 + // 返回状态码为"SUCCESS" ,则添加成功;返回状态码为"ERROR" ,则添加失败
  119 + if(result.status=='SUCCESS') {
  120 + // 弹出添加成功提示消息
  121 + layer.msg('添加成功...');
  122 + } else if(result.status=='ERROR') {
  123 + // 弹出添加失败提示消息
  124 + layer.msg('添加失败...');
  125 + }
  126 + }
  127 + // 返回list.html页面
  128 + //loadPage('list.html');
  129 + window.location.href = 'list.html';
  130 + });
  131 + }
  132 + }
  133 + });
  134 +});
0 \ No newline at end of file 135 \ No newline at end of file
src/main/resources/static/pages/base/interval/js/interval-edit-form.js 0 → 100644
  1 +/**
  2 + * @description TODO(间隔信息修改片段JS模块)
  3 + *
  4 + * @author bsth@zb
  5 + *
  6 + * @date 2017.08.01
  7 + *
  8 + */
  9 +
  10 +!function(){
  11 + // 获取参数ID
  12 + var intervalId = $.url().param('no');
  13 + // 如果参数ID不为空
  14 + if(intervalId) {
  15 + // 获取线路Id元素并设值
  16 + $('#intervalId').val(intervalId);
  17 + /** 根据ID查询详细信息 */
  18 + $get('/interval/' + intervalId ,null, function(result){
  19 + if(result) {
  20 + /** 填充修改线路表单元素值 @param:<result:数据结果集;interval_edit_form:表单元素> */
  21 + // 定义日期格式
  22 + var fs = 'YYYY-MM-DD'
  23 + // 设置日期
  24 + result.createDate = moment(result.createDate).format(fs);
  25 + result.updateDate = moment(result.updateDate).format(fs);
  26 + putFormData(result, '#interval_edit_form');
  27 + }
  28 + });
  29 + } else {
  30 + // 缺少ID
  31 + layer.confirm('【ID缺失,请点击返回,重新进行修改操作】', {btn : [ '返回' ],icon: 3, title:'提示'}, function(index){
  32 + // 关闭弹出层
  33 + layer.close(index);
  34 + // 跳转到list页面
  35 + loadPage('list.html');
  36 + });
  37 + }
  38 + // 定义表单
  39 + var form = $('#interval_edit_form');
  40 +
  41 + // 定义表单异常
  42 + var error = $('.alert-danger',form);
  43 + // 表单验证
  44 + form.validate({
  45 + // 错误提示元素span对象
  46 + errorElement : 'span',
  47 + // 错误提示元素class名称
  48 + errorClass : 'help-block help-block-error',
  49 + // 验证错误获取焦点
  50 + focusInvalid : true,
  51 + // 需要验证的表单元素
  52 + rules : {
  53 + // 公司名称编码
  54 + 'level' : {
  55 + // 必填项
  56 + required : true,
  57 + // 最大长度
  58 + maxlength: 10
  59 + },
  60 + // 公司名称
  61 + 'peak' : {
  62 + // 必填项
  63 + required : true,
  64 + // 最大长度
  65 + maxlength: 10
  66 + },
  67 + // 公司名称
  68 + 'trough' : {
  69 + // 必填项
  70 + required : true,
  71 + // 最大长度
  72 + maxlength: 10
  73 + },
  74 + },
  75 +
  76 + /**
  77 + * 类型:Callback。当未通过验证的表单提交时,可以在该回调函数中处理一些事情。
  78 + *
  79 + * 参数:该回调函数有两个参数:第一个为一个事件对象,第二个为验证器(validator)
  80 + */
  81 + invalidHandler : function(event, validator) {
  82 +
  83 + // 显示表单未通过提示信息
  84 + error.show();
  85 +
  86 + // 把提示信息放到指定的位置。
  87 + App.scrollTo(error, -200);
  88 + },
  89 +
  90 + /**
  91 + * 类型:Callback。
  92 + *
  93 + * 默认:添加errorClass("has-error")到表单元素。将未通过验证的表单元素设置高亮。
  94 + */
  95 + highlight : function(element) {
  96 +
  97 + // 添加errorClass("has-error")到表单元素
  98 + $(element).closest('.form-group').addClass('has-error');
  99 +
  100 + },
  101 +
  102 + /**
  103 + * 类型:Callback。
  104 + *
  105 + * 默认:移除errorClass("has-error")。与highlight操作相反
  106 + */
  107 + unhighlight : function(element) {
  108 +
  109 + // 移除errorClass("has-error")
  110 + $(element).closest('.form-group').removeClass('has-error');
  111 +
  112 + },
  113 +
  114 + /**
  115 + * 类型:String,Callback。
  116 + *
  117 + * 如果指定它,当验证通过时显示一个消息。
  118 + *
  119 + * 如果是String类型的,则添加该样式到标签中;
  120 + *
  121 + * 如果是一个回调函数,则将标签作为其唯一的参数。
  122 + */
  123 + success : function(label) {
  124 +
  125 + // 当验证通过时,移除errorClass("has-error")
  126 + label.closest('.form-group').removeClass('has-error');
  127 +
  128 + },
  129 + /**
  130 + * 类型:Callback。
  131 + *
  132 + * 默认:default (native) form submit;当表单通过验证,提交表单。回调函数有个默认参数form
  133 + */
  134 + submitHandler : function(f) {
  135 + // 隐藏错误提示
  136 + error.hide();
  137 + // 表单序列化
  138 + $.ajax({
  139 + type: "get",
  140 + async:false,
  141 + url: '/user/currentUser',
  142 + success: function (user) {
  143 + $("#updateByInput").val(user.userName);
  144 + }
  145 + });
  146 + var params = form.serializeJSON();
  147 + console.log(params);
  148 + submit();
  149 + // 提交
  150 + function submit() {
  151 + // 修改数据
  152 + $post('/interval', params, function(result) {
  153 + // 如果返回结果不为空
  154 + if(result){
  155 + // 返回状态码为"SUCCESS" ,则添加成功;返回状态码为"ERROR" ,则添加失败
  156 + if(result.status=='SUCCESS') {
  157 + // 弹出添加成功提示消息
  158 + layer.msg('添加成功...');
  159 + } else if(result.status=='ERROR') {
  160 + // 弹出添加失败提示消息
  161 + layer.msg('添加失败...');
  162 + }
  163 + }
  164 + // 返回list.html页面
  165 + //loadPage('list.html');
  166 + window.location.href = 'list.html';
  167 + });
  168 + }
  169 + }
  170 + });
  171 +}();
0 \ No newline at end of file 172 \ No newline at end of file
src/main/resources/static/pages/base/interval/js/interval-list-table.js 0 → 100644
  1 +/**
  2 + *
  3 + * @JSName : list.js(站点信息list.html页面js)
  4 + *
  5 + * @Author : bsth@zb
  6 + *
  7 + * @Description : TODO(站点信息list.html页面js)
  8 + *
  9 + * @Data : 2017年8月1日 上午9:21:17
  10 + *
  11 + * @Version 公交调度系统BS版 0.1
  12 + *
  13 + */
  14 +
  15 +(function(){
  16 + // 关闭左侧栏
  17 + if (!$('body').hasClass('page-sidebar-closed')) {$('.menu-toggler.sidebar-toggler').click();}
  18 + /** page : 当前页 initPag : */
  19 + var page = 0,initPag,storage = window.localStorage;
  20 + if(storage.xlName_AgursData!=null && storage.xlName_AgursData !='') {
  21 + $('.tipso-animation').children().remove();
  22 + // 延迟加载
  23 + setTimeout(function(){
  24 + $('.tipso-animation').tipso({
  25 + speed : 400,
  26 + background : '#0ed0e8',
  27 + color : '#ffffff',
  28 + position :'bottom',
  29 + width : 400,
  30 + delay : 100,
  31 + animationIn : 'fadeInDownBig',
  32 + animationOut : 'fadeOut',
  33 + offsetX : -50,
  34 + offsetY : -195,
  35 + content :'您可以通过点击重置按钮来清除对线路名称的记忆哦!',
  36 +
  37 + });
  38 + $('.tipso-animation').tipso('show');
  39 + setTimeout(function(){$('.tipso-animation').tipso('hide');},4000);
  40 + },200);
  41 + }
  42 +
  43 + /** 表格数据分页加载 */
  44 + loadTableDate(null,true);
  45 +
  46 + /** 重置按钮事件 */
  47 + $('tr.filter .filter-cancel').on('click',function(){
  48 + // 清空搜索框值
  49 + $('tr.filter input,select').val('').change();
  50 + $('.tipso-animation').tipso('hide');
  51 + storage.setItem('xlName_AgursData','');
  52 + // 重新加载表格数据
  53 + loadTableDate(null,true);
  54 + });
  55 +
  56 + /** 搜索按钮事件 */
  57 + $('tr.filter .filter-submit').on('click',function(){
  58 + var params = getParams();
  59 + page = 0;
  60 + /** 表格数据分页加载 @param:<params:搜索参数;true:是否重新分页> */
  61 + loadTableDate(params,true);
  62 + });
  63 +
  64 + function getParams() {
  65 + // cells 集合返回表格中所有(列)单元格的一个数组
  66 + var cells = $('tr.filter')[0].cells;
  67 + // 搜索参数集合
  68 + var params = {};
  69 + // 搜索字段名称
  70 + var name;
  71 + // 遍历cells数组
  72 + $.each(cells, function(i, cell){
  73 + // 获取第i列的input或者select集合
  74 + var items = $('input,select', cell);
  75 + // 遍历items集合
  76 + for(var j = 0, item; item = items[j++];){
  77 + // 获取字段名称
  78 + name = $(item).attr('name');
  79 + if(name){
  80 + // 赋取相对应的值
  81 + params[name] = $(item).val();
  82 + }
  83 + }
  84 + });
  85 + return params;
  86 + }
  87 +
  88 + /**
  89 + * 表格数据分页加载事件
  90 + *
  91 + * ------@param : 查询参数
  92 + *
  93 + * ------@isPon : 是否重新分页
  94 + *
  95 + */
  96 + function loadTableDate(param,isPon){
  97 + // 搜索参数
  98 + var params = {};
  99 + if(param) {
  100 + params = param;
  101 + }
  102 + // 排序(按id)
  103 + params['order'] = 'id';
  104 + //排序方向
  105 + params['direction'] = 'ASC';
  106 + // 记录当前页数
  107 + params['page'] = page;
  108 + // 弹出正在加载层
  109 + var i = layer.load(2);
  110 + // 异步请求获取表格数据
  111 + $.get('/interval',params,function(result){
  112 + // 添加序号
  113 + result.content.page = page;
  114 + // 把数据填充到模版中
  115 + var tbodyHtml = template('interval_list_temp',{list:result.content});
  116 + $('#datatable_interval tbody').html(tbodyHtml);
  117 + // 是重新分页且返回数据长度大于0
  118 + if(isPon && result.content.length > 0){
  119 + // 重新分页
  120 + initPag = true;
  121 + // 分页栏
  122 + showPagination(result);
  123 + }
  124 + // 关闭弹出加载层
  125 + layer.close(i);
  126 + });
  127 + }
  128 + /** 分页栏组件 */
  129 + function showPagination(data){
  130 + // 分页组件
  131 + $('#pagination').jqPaginator({
  132 + // 总页数
  133 + totalPages: data.totalPages,
  134 + // 中间显示页数
  135 + visiblePages: 6,
  136 + // 当前页
  137 + currentPage: page + 1,
  138 + first: '<li class="first"><a href="javascript:void(0);">首页<\/a><\/li>',
  139 + prev: '<li class="prev"><a href="javascript:void(0);">上一页<\/a><\/li>',
  140 + next: '<li class="next"><a href="javascript:void(0);">下一页<\/a><\/li>',
  141 + last: '<li class="last"><a href="javascript:void(0);">尾页<\/a><\/li>',
  142 + page: '<li class="page"><a href="javascript:void(0);">{{page}}<\/a><\/li>',
  143 + onPageChange: function (num, type) {
  144 + if(initPag){
  145 + initPag = false;
  146 + return;
  147 + }
  148 + var pData = getParams();
  149 + if(pData.stationName_like!='' && pData.stationName_like != null) {
  150 + pData.stationName_like = pData.stationName_like.split('_')[0];
  151 + }
  152 + page = num - 1;
  153 + loadTableDate(pData, false);
  154 + }
  155 + });
  156 + }
  157 +})();
0 \ No newline at end of file 158 \ No newline at end of file
src/main/resources/static/pages/base/interval/list.html
1 -<!-- <link href="/pages/base/line/css/animate.css" rel="stylesheet" type="text/css" />  
2 -<link href="/pages/base/line/css/tipso.css" rel="stylesheet" type="text/css" /> -->  
3 <!-- 片段标题 START --> 1 <!-- 片段标题 START -->
4 <div class="page-head"> 2 <div class="page-head">
5 <div class="page-title"> 3 <div class="page-title">
6 - <h1>间隔信息</h1> 4 + <h1>间隔信息</h1>
7 </div> 5 </div>
8 </div> 6 </div>
9 <!-- 片段标题 END --> 7 <!-- 片段标题 END -->
@@ -12,7 +10,7 @@ @@ -12,7 +10,7 @@
12 <ul class="page-breadcrumb breadcrumb"> 10 <ul class="page-breadcrumb breadcrumb">
13 <li><a href="/pages/home.html" data-pjax>首页</a> <i class="fa fa-circle"></i></li> 11 <li><a href="/pages/home.html" data-pjax>首页</a> <i class="fa fa-circle"></i></li>
14 <li><span class="active">基础信息</span> <i class="fa fa-circle"></i></li> 12 <li><span class="active">基础信息</span> <i class="fa fa-circle"></i></li>
15 - <li><span class="active">间隔信息</span></li> 13 + <li><span class="active">间隔信息</span></li>
16 </ul> 14 </ul>
17 <!-- 线路信息导航栏组件 END --> 15 <!-- 线路信息导航栏组件 END -->
18 16
@@ -24,29 +22,27 @@ @@ -24,29 +22,27 @@
24 </div> 22 </div>
25 <div class="caption"> 23 <div class="caption">
26 <i class="fa fa-info-circle font-dark"></i> 24 <i class="fa fa-info-circle font-dark"></i>
27 - <span class="caption-subject font-dark sbold uppercase">线路信息</span> 25 + <span class="caption-subject font-dark sbold uppercase">间隔信息</span>
28 </div> 26 </div>
29 <div class="actions"> 27 <div class="actions">
30 <div class="btn-group btn-group-devided" data-toggle="buttons"> 28 <div class="btn-group btn-group-devided" data-toggle="buttons">
31 - <a class="btn btn-circle blue" href="add.html" data-pjax><i class="fa fa-plus"></i> 添加线路</a> 29 + <a class="btn btn-circle blue" href="add.html" data-pjax><i class="fa fa-plus"></i> 添加间隔信息</a>
32 </div> 30 </div>
33 </div> 31 </div>
34 </div> 32 </div>
35 <div class="portlet-body"> 33 <div class="portlet-body">
36 <div class="table-container" style="margin-top: 10px"> 34 <div class="table-container" style="margin-top: 10px">
37 - <table class="table table-striped table-bordered table-hover table-checkable" id="datatable_line"> 35 + <table class="table table-striped table-bordered table-hover table-checkable" id="datatable_interval">
38 <thead> 36 <thead>
39 <tr role="row" class="heading"> 37 <tr role="row" class="heading">
40 - <th >#</th>  
41 <th >序号</th> 38 <th >序号</th>
42 - <th >大间隔ID</th>  
43 - <th >大间隔等级</th> 39 + <th >间隔ID</th>
  40 + <th >间隔等级</th>
44 <th >高峰间隔时间</th> 41 <th >高峰间隔时间</th>
45 <th >低谷间隔时间</th> 42 <th >低谷间隔时间</th>
46 <th >操作</th> 43 <th >操作</th>
47 </tr> 44 </tr>
48 <tr role="row" class="filter"> 45 <tr role="row" class="filter">
49 - <td>#</td>  
50 <td></td> 46 <td></td>
51 <td></td> 47 <td></td>
52 <td></td> 48 <td></td>
@@ -73,72 +69,27 @@ @@ -73,72 +69,27 @@
73 </div> 69 </div>
74 </div> 70 </div>
75 </div> 71 </div>
76 -<script type="text/html" id="line_list_temp"> 72 +<script type="text/html" id="interval_list_temp">
77 {{each list as obj i }} 73 {{each list as obj i }}
78 <tr> 74 <tr>
79 - <td style="vertical-align: middle;">  
80 - <input type="checkbox" class="group-checkable icheck" value="{{obj.name}}" id="{{obj.id}}" data-id="{{obj.id}}" data-lineName="{{obj.name}}">  
81 - </td>  
82 - <td style="vertical-align: middle;">  
83 - {{(list.page*10)+(i+1)}}  
84 - </td>  
85 - <td>  
86 - {{obj.lineCode}}  
87 - </td>  
88 <td> 75 <td>
89 - {{obj.name}}  
90 - </td>  
91 - <td>  
92 - {{if obj.nature == 'lj'}}  
93 - 路救  
94 - {{else if obj.nature == 'bc'}}  
95 - 备车  
96 - {{else if obj.nature == 'dbc'}}  
97 - 定班车  
98 - {{else if obj.nature == 'yxl'}}  
99 - 夜宵路  
100 - {{else if obj.nature == 'cgxl'}}  
101 - 常规线路  
102 - {{else if obj.nature == 'gjxl'}}  
103 - 过江线路  
104 - {{else if obj.nature == 'csbs'}}  
105 - 穿梭巴士  
106 - {{else if obj.nature == 'tyxl'}}  
107 - 特约线路  
108 - {{else if obj.nature == 'qt'}}  
109 - 其他  
110 - {{else if obj.nature == 'cctxl'}}  
111 - 村村通线路  
112 - {{/if}}  
113 - </td>  
114 - <td>  
115 - {{if obj.level == '1'}}  
116 - 一级线路  
117 - {{else if obj.level == '2'}}  
118 - 二级线路  
119 - {{else if obj.level == '0'}}  
120 - 未知等级  
121 - {{/if}} 76 + {{(list.page*10)+(i+1)}}
122 </td> 77 </td>
123 <td> 78 <td>
124 - {{obj.shanghaiLinecode}} 79 + {{obj.id}}
125 </td> 80 </td>
126 <td> 81 <td>
127 - {{if obj.destroy == 1}}  
128 - <span style="font-weight: bold; color: red; padding: 5px; background-color: #FFE4E1; margin: 5px; font-size: 9px;border-radius: 4px;">撤销</span>  
129 - {{else if obj.destroy == 0}}  
130 - <span style="font-weight: bold; color: #07824e; padding: 5px; background-color: #FFE4E1; margin: 5px; font-size: 9px;border-radius: 4px;">运营</span>  
131 - {{/if}} 82 + {{obj.level}}
132 </td> 83 </td>
133 <td> 84 <td>
134 - <a href="/pages/base/lineinformation/list.html?no={{obj.id}}" class="btn default blue-stripe btn-sm" data-pjax> 查看 </a> 85 + {{obj.peak}}
135 </td> 86 </td>
136 <td> 87 <td>
137 - <a href="/pages/base/stationroute/list.html?no={{obj.id}}" class="btn default blue-stripe btn-sm" data-pjax> 查看 </a> 88 + {{obj.trough}}
138 </td> 89 </td>
139 <td> 90 <td>
140 - <a href="details.html?no={{obj.id}}" class="btn default blue-stripe btn-sm" data-pjax> 详细 </a>  
141 - <a href="edit.html?no={{obj.id}}" class="btn default blue-stripe btn-sm" data-pjax> 修改 </a> 91 + <a href="edit.html?no={{obj.id}}" class="btn btn-info btn-sm" data-pjax> 修改 </a>
  92 + <a class="btn btn-danger btn-sm" onclick="del({{obj.id}})"> 删除</a>
142 </td> 93 </td>
143 </tr> 94 </tr>
144 {{/each}} 95 {{/each}}
@@ -150,4 +101,20 @@ @@ -150,4 +101,20 @@
150 </script> 101 </script>
151 <!-- <script src="/pages/base/line/js/tipso.js"></script> --> 102 <!-- <script src="/pages/base/line/js/tipso.js"></script> -->
152 <!-- 线路信息片段JS模块 --> 103 <!-- 线路信息片段JS模块 -->
153 -<script src="/pages/base/line/js/line-list-table.js"></script>  
154 \ No newline at end of file 104 \ No newline at end of file
  105 +<script src="/pages/base/interval/js/interval-list-table.js"></script>
  106 +<script>
  107 + function del(intervalId){
  108 + layer.confirm('确定要删除间隔信息吗?', {
  109 + btn: ['确定','取消'] //按钮
  110 + }, function(){
  111 + $.ajax({
  112 + url: '/interval/' + intervalId,
  113 + type: 'DELETE',
  114 + success: function(result) {
  115 + window.location.href = 'list.html';
  116 + }
  117 + });
  118 + }, function(){
  119 + });
  120 + }
  121 +</script>
155 \ No newline at end of file 122 \ No newline at end of file
src/main/resources/static/pages/base/line/editRoute.html
@@ -149,9 +149,9 @@ $(&#39;#edit_route_mobal&#39;).on(&#39;editRouteMobal.show&#39;, function(e,transGPS,editRoute,m @@ -149,9 +149,9 @@ $(&#39;#edit_route_mobal&#39;).on(&#39;editRouteMobal.show&#39;, function(e,transGPS,editRoute,m
149 var stationList = arrayFormat.stationList; 149 var stationList = arrayFormat.stationList;
150 var sectionListTemp = arrayFormat.sectionList; 150 var sectionListTemp = arrayFormat.sectionList;
151 var sectionList = []; 151 var sectionList = [];
152 - // 隔50个取一个点(相当于50s)  
153 - for(var i = 0; i*40 < sectionListTemp.length; i++) {  
154 - sectionList[i] = sectionListTemp[i*40]; 152 + // 隔30个取一个点(相当于30s)
  153 + for(var i = 0; i*30 < sectionListTemp.length; i++) {
  154 + sectionList[i] = sectionListTemp[i*30];
155 } 155 }
156 156
157 var sectionListFinal = []; 157 var sectionListFinal = [];
@@ -273,7 +273,7 @@ $(&#39;#edit_route_mobal&#39;).on(&#39;editRouteMobal.show&#39;, function(e,transGPS,editRoute,m @@ -273,7 +273,7 @@ $(&#39;#edit_route_mobal&#39;).on(&#39;editRouteMobal.show&#39;, function(e,transGPS,editRoute,m
273 //$('#uploadRoute').addClass('hidden'); 273 //$('#uploadRoute').addClass('hidden');
274 $('#upload').addClass('hidden'); 274 $('#upload').addClass('hidden');
275 layer.msg('请先编辑路段,并保存!!!'); 275 layer.msg('请先编辑路段,并保存!!!');
276 - }else { 276 + }else {
277 layer.msg('生成路线失败!'); 277 layer.msg('生成路线失败!');
278 } 278 }
279 }); 279 });
src/main/resources/static/pages/base/line/js/line-list-map.js
@@ -30,7 +30,7 @@ var WorldsBMapLine = function () { @@ -30,7 +30,7 @@ var WorldsBMapLine = function () {
30 mapBValue = new BMap.Map("bmap_basic"); 30 mapBValue = new BMap.Map("bmap_basic");
31 31
32 //中心点和缩放级别 32 //中心点和缩放级别
33 - mapBValue.centerAndZoom(new BMap.Point(CENTER_POINT.lng,CENTER_POINT.lat), 15); 33 + mapBValue.centerAndZoom(new BMap.Point(CENTER_POINT.lng,CENTER_POINT.lat), 20);
34 34
35 //启用地图拖拽事件,默认启用(可不写) 35 //启用地图拖拽事件,默认启用(可不写)
36 mapBValue.enableDragging(); 36 mapBValue.enableDragging();
src/main/resources/static/pages/base/line/map.html
@@ -109,11 +109,11 @@ $(function(){ @@ -109,11 +109,11 @@ $(function(){
109 }); 109 });
110 110
111 // 提交截取事件 111 // 提交截取事件
112 - $('#cutSection').on('click', function() {  
113 - layer.confirm('提交会把原有的站点和路段覆盖,您确定要提交吗?', {  
114 - btn: ['提交','取消'] //按钮  
115 - }, function(){  
116 - if(WorldsBMapLine.getPointIndex() > 0) { 112 + $('#cutSection').on('click', function() {
  113 + if(WorldsBMapLine.getPointIndex() > 0) {
  114 + layer.confirm('提交会把原有的站点和路段覆盖,您确定要提交吗?', {
  115 + btn: ['提交','取消'] //按钮
  116 + }, function(){
117 var sectionList = WorldsBMapLine.getSectionList(); 117 var sectionList = WorldsBMapLine.getSectionList();
118 var data = {}; 118 var data = {};
119 var section = EditSectionObj.getEitdSection(); 119 var section = EditSectionObj.getEitdSection();
@@ -131,10 +131,11 @@ $(function(){ @@ -131,10 +131,11 @@ $(function(){
131 layer.msg('提交失败...'); 131 layer.msg('提交失败...');
132 } 132 }
133 }); 133 });
134 - } else {  
135 - layer.msg("请先截取路段!!!");  
136 - }  
137 - }); 134 + });
  135 + } else {
  136 + layer.msg("请先截取路段!!!");
  137 + }
  138 + //});
138 }); 139 });
139 140
140 // 删除最后一个路段 141 // 删除最后一个路段
src/main/resources/static/pages/excep/mhspeedingList.html
@@ -32,9 +32,10 @@ @@ -32,9 +32,10 @@
32 <th width="3%">#</th> 32 <th width="3%">#</th>
33 <th width="4%">线路</th> 33 <th width="4%">线路</th>
34 <th width="6%">车辆自编号</th> 34 <th width="6%">车辆自编号</th>
35 - <th width="8%">上下行</th>  
36 - <th width="10%">开始时间</th>  
37 - <th width="10%">结束时间</th> 35 + <th width="6%">上下行</th>
  36 + <th width="8%">超速位置</th>
  37 + <th width="8%">开始时间</th>
  38 + <th width="8%">结束时间</th>
38 <th width="8%">持续时间</th> 39 <th width="8%">持续时间</th>
39 <th width="8%">查看轨迹</th> 40 <th width="8%">查看轨迹</th>
40 <th width="6%">操作</th> 41 <th width="6%">操作</th>
@@ -47,11 +48,6 @@ @@ -47,11 +48,6 @@
47 <td> 48 <td>
48 <select class="form-control" name="nbbm" id="nbbm" style="width: 100px;"></select> 49 <select class="form-control" name="nbbm" id="nbbm" style="width: 100px;"></select>
49 </td> 50 </td>
50 - <!-- <td>  
51 -  
52 - </td>  
53 - <td>  
54 - </td> -->  
55 <td> 51 <td>
56 <select class="form-control form-filter " name="updown" style="width: 90px;"> 52 <select class="form-control form-filter " name="updown" style="width: 90px;">
57 <option value="">请选择...</option> 53 <option value="">请选择...</option>
@@ -60,7 +56,9 @@ @@ -60,7 +56,9 @@
60 <option value="-1">无效</option> 56 <option value="-1">无效</option>
61 </select> 57 </select>
62 </td> 58 </td>
63 - <td> 59 + <td>
  60 + </td>
  61 + <td>
64 <input class="form-control" type="date" name="startDate" /> 62 <input class="form-control" type="date" name="startDate" />
65 </td> 63 </td>
66 <td> 64 <td>
@@ -114,6 +112,9 @@ @@ -114,6 +112,9 @@
114 {{/if}} 112 {{/if}}
115 </td> 113 </td>
116 <td> 114 <td>
  115 + {{obj.address}}
  116 + </td>
  117 + <td>
117 {{obj.timestampDate}} 118 {{obj.timestampDate}}
118 </td> 119 </td>
119 <td> 120 <td>
@@ -142,10 +143,9 @@ @@ -142,10 +143,9 @@
142 {{/if}} 143 {{/if}}
143 </script> 144 </script>
144 145
145 -<script type="text/javascript" src="http://api.map.baidu.com/api?v=2.0&ak=IGGrr4UjwIYzatoCRFKEL8sT"></script>  
146 -  
147 <script> 146 <script>
148 $(function(){ 147 $(function(){
  148 + if (!$('body').hasClass('page-sidebar-closed')) {$('.menu-toggler.sidebar-toggler').click();}
149 var page = 0, initPagination; 149 var page = 0, initPagination;
150 var icheckOptions = { 150 var icheckOptions = {
151 checkboxClass: 'icheckbox_flat-blue', 151 checkboxClass: 'icheckbox_flat-blue',
@@ -222,41 +222,55 @@ $(function(){ @@ -222,41 +222,55 @@ $(function(){
222 params['page'] = page; 222 params['page'] = page;
223 var i = layer.load(2); 223 var i = layer.load(2);
224 $get('/nowspeeding/pagequery' ,params, function(data){ 224 $get('/nowspeeding/pagequery' ,params, function(data){
225 - var bodyHtm = template('speeding_list_temp', {list: data.dataList});  
226 - $('#datatable_speeding tbody').html(bodyHtm)  
227 - .find('.icheck').iCheck(icheckOptions)  
228 - .on('ifChanged', iCheckChange);  
229 - if(pagination && data.dataList.length > 0){  
230 - //重新分页  
231 - initPagination = true;  
232 - showPagination(data);  
233 - }  
234 - layer.close(i);  
235 - $(".lookTrajectory").click(function(){  
236 - var vehicle = $(this).data('vehicle');  
237 - var startDate = $(this).data('startdate');  
238 - var endDate = $(this).data('enddate');  
239 - var lon = $(this).data('lon');  
240 - var lat = $(this).data('lat');  
241 - var endLon = $(this).data('endlon');  
242 - var endLat = $(this).data('endlat');  
243 - var lineid = $(this).data('lineid');  
244 - var upDown = $(this).data('updown');  
245 - var storage = window.localStorage;  
246 - storage.setItem("zbhAndDate",vehicle+","+startDate+","+endDate+","+lon+","+lat+","+endLon+","+endLat+","+lineid+","+upDown);  
247 - $.get('/pages/excep/speedingMap.html?',function (result) {  
248 - layer.open({  
249 - type: 1,  
250 - title:'<i class="uk-icon-play-circle"></i>轨迹回放',  
251 - shadeClose: true,  
252 - shade: true,  
253 - scrollbar: false,  
254 - maxmin: false, //开启最大化最小化按钮  
255 - area: ['100%', '100%'],  
256 - content:result,//内容  
257 - });  
258 - });  
259 - }) 225 + var listResult = data.dataList;
  226 + var index=0;
  227 + (function(){
  228 + var f = arguments.callee;
  229 + if(index >= listResult.length){
  230 + var bodyHtm = template('speeding_list_temp', {list:listResult});
  231 + $('#datatable_speeding tbody').html(bodyHtm).find('.icheck').iCheck(icheckOptions).on('ifChanged', iCheckChange);
  232 + if(pagination && data.dataList.length > 0){
  233 + //重新分页
  234 + initPagination = true;
  235 + showPagination(data);
  236 + }
  237 + layer.close(i);
  238 + $(".lookTrajectory").click(function(){
  239 + var vehicle = $(this).data('vehicle');
  240 + var startDate = $(this).data('startdate');
  241 + var endDate = $(this).data('enddate');
  242 + var lon = $(this).data('lon');
  243 + var lat = $(this).data('lat');
  244 + var endLon = $(this).data('endlon');
  245 + var endLat = $(this).data('endlat');
  246 + var lineid = $(this).data('lineid');
  247 + var upDown = $(this).data('updown');
  248 + var storage = window.localStorage;
  249 + storage.setItem("zbhAndDate",vehicle+","+startDate+","+endDate+","+lon+","+lat+","+endLon+","+endLat+","+lineid+","+upDown);
  250 + $.get('/pages/excep/speedingMap.html?',function (result) {
  251 + layer.open({
  252 + type: 1,
  253 + title:'<i class="uk-icon-play-circle"></i>轨迹回放',
  254 + shadeClose: true,
  255 + shade: true,
  256 + scrollbar: false,
  257 + maxmin: false, //开启最大化最小化按钮
  258 + area: ['100%', '100%'],
  259 + content:result,//内容
  260 + });
  261 + });
  262 + })
  263 + return;
  264 + }
  265 + var result = listResult[index];
  266 + new BMap.Geocoder().getLocation(new BMap.Point(result.lon,result.lat), function(rs){
  267 + var addComp = rs.addressComponents;
  268 + result.address = addComp.district+addComp.street+addComp.streetNumber;
  269 + f();
  270 + index++;
  271 + });
  272 + })();
  273 + console.log(listResult);
260 }); 274 });
261 } 275 }
262 276
src/main/resources/static/pages/excep/pdspeedingList.html
@@ -142,8 +142,6 @@ @@ -142,8 +142,6 @@
142 {{/if}} 142 {{/if}}
143 </script> 143 </script>
144 144
145 -<script type="text/javascript" src="http://api.map.baidu.com/api?v=2.0&ak=IGGrr4UjwIYzatoCRFKEL8sT"></script>  
146 -  
147 <script> 145 <script>
148 $(function(){ 146 $(function(){
149 var page = 0, initPagination; 147 var page = 0, initPagination;
src/main/resources/static/pages/forms/statement/waybill.html
@@ -333,7 +333,8 @@ @@ -333,7 +333,8 @@
333 return; 333 return;
334 } 334 }
335 $get('/realSchedule/exportWaybill',{jName:jName,clZbh:params[1],lpName:params[2],date:date,line:line},function(result){ 335 $get('/realSchedule/exportWaybill',{jName:jName,clZbh:params[1],lpName:params[2],date:date,line:line},function(result){
336 - window.open("/downloadFile/download?fileName="+date+"-"+jName+"-"+params[1]+"-"+params[2]+"-行车路单"); 336 + var fileName=date+"-"+jName+"-"+params[1]+"-"+params[2]+"-行车路单";
  337 + window.open("/downloadFile/download?fileName="+encodeURIComponent(fileName));
337 }); 338 });
338 }); 339 });
339 340
src/main/resources/static/pages/mapmonitor/real/js/playBack.js
@@ -269,9 +269,9 @@ var playBack = (function() { @@ -269,9 +269,9 @@ var playBack = (function() {
269 269
270 if(defaultLine){ 270 if(defaultLine){
271 layer.msg('加载线路图层数据...', {icon: 16, time: 0,shade:0.3}); 271 layer.msg('加载线路图层数据...', {icon: 16, time: 0,shade:0.3});
272 - $.get('/realMap/findRouteByLine', {lineCode: defaultLine}  
273 - ,function(route){  
274 - lineRoute = route; 272 + $.get('/realMap/findRouteByLine', {idx: defaultLine}
  273 + ,function(rs){
  274 + lineRoute = rs[defaultLine];
275 iMap.call('drawLine', {route: lineRoute}); 275 iMap.call('drawLine', {route: lineRoute});
276 276
277 cTime = sTime; 277 cTime = sTime;
src/main/resources/static/pages/oil/checkJyryList.html
@@ -168,7 +168,6 @@ $(function(){ @@ -168,7 +168,6 @@ $(function(){
168 }) 168 })
169 var params = {}; 169 var params = {};
170 params['ylbList']=JSON.stringify(ylArray); 170 params['ylbList']=JSON.stringify(ylArray);
171 - console.log(params);  
172 var i = layer.load(2); 171 var i = layer.load(2);
173 $post('/ylxxb/check', params, function(){ 172 $post('/ylxxb/check', params, function(){
174 layer.close(i); 173 layer.close(i);
@@ -287,7 +286,6 @@ $(function(){ @@ -287,7 +286,6 @@ $(function(){
287 params['yyrq']=$("#yyrq").val(); 286 params['yyrq']=$("#yyrq").val();
288 // var i = layer.load(2); 287 // var i = layer.load(2);
289 288
290 - var i = 2;  
291 /* var jyryGsdm=$("#jyryListGsdmId").val(); 289 /* var jyryGsdm=$("#jyryListGsdmId").val();
292 var jyryFgsdm=$("#jyryListFgsdmId").val(); 290 var jyryFgsdm=$("#jyryListFgsdmId").val();
293 if(jyryGsdm=="" || jyryGsdm==null){ 291 if(jyryGsdm=="" || jyryGsdm==null){
@@ -307,7 +305,7 @@ $(function(){ @@ -307,7 +305,7 @@ $(function(){
307 params['fgsdm_in']=fgsqx1; 305 params['fgsdm_in']=fgsqx1;
308 } 306 }
309 } */ 307 } */
310 - 308 + var i = layer.load(2);
311 $get('/ylxxb/pagequery' ,params, function(data){ 309 $get('/ylxxb/pagequery' ,params, function(data){
312 $.each(data.dataList, function(i, obj) { 310 $.each(data.dataList, function(i, obj) {
313 obj.yyrq = moment(obj.yyrq).format("YYYY-MM-DD"); 311 obj.yyrq = moment(obj.yyrq).format("YYYY-MM-DD");
src/main/resources/static/real_control_v2/fragments/line_schedule/context_menu/dftz.html
@@ -146,6 +146,7 @@ @@ -146,6 +146,7 @@
146 var f = $('form', modal).formValidation(gb_form_validation_opts); 146 var f = $('form', modal).formValidation(gb_form_validation_opts);
147 f.on('success.form.fv', function(e) { 147 f.on('success.form.fv', function(e) {
148 e.preventDefault(); 148 e.preventDefault();
  149 + $('[type=submit]', f).attr('disabled', 'disabled');
149 var data = $(this).serializeJSON(); 150 var data = $(this).serializeJSON();
150 if(data.dfsj==sch.dfsj && data.remarks=='' && data.bcType == sch.bcType){ 151 if(data.dfsj==sch.dfsj && data.remarks=='' && data.bcType == sch.bcType){
151 return; 152 return;