Commit 3450bf7363afc0c39e4831b5ca0a7856d039891b
Merge branch 'minhang' of http://222.66.0.204:8090/panzhaov5/bsth_control into minhang
Showing
34 changed files
with
1990 additions
and
247 deletions
src/main/java/com/bsth/controller/oil/DlbController.java
| ... | ... | @@ -84,8 +84,14 @@ public class DlbController extends BaseController<Dlb, Integer>{ |
| 84 | 84 | |
| 85 | 85 | |
| 86 | 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 | 95 | return list; |
| 90 | 96 | } |
| 91 | 97 | ... | ... |
src/main/java/com/bsth/entity/oil/Dlb.java
| ... | ... | @@ -54,6 +54,7 @@ public class Dlb { |
| 54 | 54 | private String edituser; |
| 55 | 55 | private Date edittime; |
| 56 | 56 | private Date createtime; |
| 57 | + private Date updatetime; | |
| 57 | 58 | private int nylx; |
| 58 | 59 | //进场顺序(根据最先出场和最后进场来关联车辆的存电量) |
| 59 | 60 | private int jcsx; |
| ... | ... | @@ -374,4 +375,14 @@ public class Dlb { |
| 374 | 375 | public void setFgsname(String fgsname) { |
| 375 | 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 | 3 | import com.bsth.entity.Line; |
| 4 | 4 | import com.bsth.service.schedule.rules.rerun.RerunRule_input; |
| 5 | 5 | import com.bsth.service.schedule.rules.shiftloop.ScheduleResult_output; |
| 6 | +import com.bsth.service.schedule.rules.shiftloop.ScheduleRule_Type; | |
| 6 | 7 | import org.apache.commons.lang3.StringUtils; |
| 7 | 8 | |
| 8 | 9 | import javax.persistence.*; |
| ... | ... | @@ -267,7 +268,8 @@ public class SchedulePlanInfo extends BEntity { |
| 267 | 268 | List<EmployeeConfigInfo> employeeConfigInfoList, |
| 268 | 269 | SchedulePlan schedulePlan, |
| 269 | 270 | boolean isFirstBc, // 是否第一个班次 |
| 270 | - boolean isLastBc // 是否最后一个班次 | |
| 271 | + boolean isLastBc, // 是否最后一个班次 | |
| 272 | + ScheduleRule_Type sType // 类型 | |
| 271 | 273 | ) { |
| 272 | 274 | |
| 273 | 275 | // TODO:关联的公司名称 |
| ... | ... | @@ -294,47 +296,51 @@ public class SchedulePlanInfo extends BEntity { |
| 294 | 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 | 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 | 314 | } else { |
| 307 | 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 | 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 | 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 | 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 | 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 | 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 | 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 | 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/repository/oil/CwjyRepository.java
| ... | ... | @@ -27,4 +27,8 @@ public interface CwjyRepository extends BaseRepository<Cwjy, Integer>{ |
| 27 | 27 | " ) c on a.nbbm=c.nbbm where a.nbbm like %?2% ",nativeQuery=true) |
| 28 | 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
src/main/java/com/bsth/service/impl/StationServiceImpl.java
| ... | ... | @@ -689,7 +689,7 @@ public class StationServiceImpl extends BaseServiceImpl<Station, Integer> implem |
| 689 | 689 | String bJwpoints[] = stationNameList.get(k)[0].toString().split(" "); |
| 690 | 690 | Point p2 = new Point(Double.parseDouble(bJwpoints[0]),Double.parseDouble(bJwpoints[1])); |
| 691 | 691 | double jl = GeoUtils.getDistance(p1, p2); |
| 692 | - if(jl<=120d) { | |
| 692 | + if(jl<=20d) { | |
| 693 | 693 | rsM.put("id", stationNameList.get(k)[1]); |
| 694 | 694 | temp = true; |
| 695 | 695 | break; | ... | ... |
src/main/java/com/bsth/service/impl/TrafficManageServiceImpl.java
| ... | ... | @@ -20,10 +20,10 @@ import com.bsth.service.traffic.YgcBasicDataService; |
| 20 | 20 | import com.bsth.util.TimeUtils; |
| 21 | 21 | import com.bsth.util.db.DBUtils_MS; |
| 22 | 22 | import com.bsth.webService.trafficManage.geotool.services.InternalPortType; |
| 23 | -import com.bsth.webService.trafficManage.geotool.services.Internal; | |
| 24 | 23 | import com.bsth.webService.trafficManage.org.tempuri.Results; |
| 25 | 24 | import com.bsth.webService.trafficManage.org.tempuri.WebServiceLocator; |
| 26 | 25 | import com.bsth.webService.trafficManage.org.tempuri.WebServiceSoap; |
| 26 | +import org.apache.commons.lang.StringEscapeUtils; | |
| 27 | 27 | import org.apache.commons.lang.StringUtils; |
| 28 | 28 | import org.apache.commons.lang.time.DateUtils; |
| 29 | 29 | import org.slf4j.Logger; |
| ... | ... | @@ -373,7 +373,7 @@ public class TrafficManageServiceImpl implements TrafficManageService{ |
| 373 | 373 | counter = 0; |
| 374 | 374 | sf.append("</DLDS>"); |
| 375 | 375 | str = sf.toString().replace("'","");// 去掉'号 |
| 376 | - Results results = ssop.setLD(userNameOther, passwordOther, str); | |
| 376 | + Results results = ssop.setLD(userNameOther, passwordOther, StringEscapeUtils.unescapeHtml(str)); | |
| 377 | 377 | if(results.isSuccess()){ |
| 378 | 378 | result = "success"; |
| 379 | 379 | }else{ |
| ... | ... | @@ -387,7 +387,7 @@ public class TrafficManageServiceImpl implements TrafficManageService{ |
| 387 | 387 | if(counter > 0){ |
| 388 | 388 | sf.append("</DLDS>"); |
| 389 | 389 | str = sf.toString().replace("'","");// 去掉'号 |
| 390 | - Results results = ssop.setLD(userNameOther, passwordOther, str); | |
| 390 | + Results results = ssop.setLD(userNameOther, passwordOther, StringEscapeUtils.unescapeHtml(str)); | |
| 391 | 391 | if(results.isSuccess()){ |
| 392 | 392 | result = "success"; |
| 393 | 393 | }else{ |
| ... | ... | @@ -413,7 +413,7 @@ public class TrafficManageServiceImpl implements TrafficManageService{ |
| 413 | 413 | String result = "failure"; |
| 414 | 414 | try { |
| 415 | 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 | 417 | if(rss.isSuccess()){ |
| 418 | 418 | result = "success"; |
| 419 | 419 | } |
| ... | ... | @@ -435,7 +435,7 @@ public class TrafficManageServiceImpl implements TrafficManageService{ |
| 435 | 435 | private String readXmlFromFile(String fileName) throws Exception { |
| 436 | 436 | StringBuffer sf = new StringBuffer(""); |
| 437 | 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 | 439 | BufferedReader bufferedReader = new BufferedReader(reader); |
| 440 | 440 | String lineTxt = ""; |
| 441 | 441 | while((lineTxt = bufferedReader.readLine()) != null){ |
| ... | ... | @@ -964,47 +964,14 @@ public class TrafficManageServiceImpl implements TrafficManageService{ |
| 964 | 964 | * 下载全量的公交基础数据 |
| 965 | 965 | */ |
| 966 | 966 | public String getDownLoadAllDataFile() { |
| 967 | - String result = "success"; | |
| 967 | + String result = "failure"; | |
| 968 | 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 | 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 | 973 | } catch (Exception e) { |
| 992 | 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 | 976 | } catch (Exception e) { |
| 1010 | 977 | e.printStackTrace(); | ... | ... |
src/main/java/com/bsth/service/oil/DlbService.java
| ... | ... | @@ -7,7 +7,7 @@ import com.bsth.entity.oil.Dlb; |
| 7 | 7 | import com.bsth.service.BaseService; |
| 8 | 8 | |
| 9 | 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 | 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 | 26 | import com.bsth.common.ResponseCode; |
| 27 | 27 | import com.bsth.entity.oil.Cwjy; |
| 28 | 28 | import com.bsth.entity.oil.Cyl; |
| 29 | +import com.bsth.entity.oil.Ylb; | |
| 29 | 30 | import com.bsth.entity.oil.Ylxxb; |
| 30 | 31 | import com.bsth.repository.oil.CwjyRepository; |
| 31 | 32 | import com.bsth.repository.oil.YlxxbRepository; |
| ... | ... | @@ -280,7 +281,7 @@ public class CwjyServiceImpl extends BaseServiceImpl<Cwjy,Integer> implements Cw |
| 280 | 281 | String gsdm=map.get("gsdm_like").toString(); |
| 281 | 282 | |
| 282 | 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 | 285 | + "b.jyggh as jyggh,b.jzl as jzl ,b.stationid as stationid,b.jsy as jsy," |
| 285 | 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 | 287 | " left join (" |
| ... | ... | @@ -293,7 +294,10 @@ public class CwjyServiceImpl extends BaseServiceImpl<Cwjy,Integer> implements Cw |
| 293 | 294 | + " and ssgsdm='"+gsdm+"' and fgsdm ='"+fgsdm+"' group by nbbm "+ |
| 294 | 295 | " ) c on a.nbbm=c.nbbm " |
| 295 | 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 | 302 | List<Ylxxb> yList= jdbcTemplate.query(sql, |
| 299 | 303 | new RowMapper<Ylxxb>(){ |
| ... | ... | @@ -311,24 +315,67 @@ public class CwjyServiceImpl extends BaseServiceImpl<Cwjy,Integer> implements Cw |
| 311 | 315 | t.setNylx(rs.getInt("nylx")); |
| 312 | 316 | t.setYj(rs.getDouble("yj")); |
| 313 | 317 | t.setBz(rs.getString("bz")); |
| 314 | - t.setLdgh(rs.getString("ldgh")); | |
| 315 | 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 | 381 | @Override | ... | ... |
src/main/java/com/bsth/service/oil/impl/DlbServiceImpl.java
| ... | ... | @@ -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 | 7 | import java.text.DecimalFormat; |
| 6 | 8 | import java.text.ParseException; |
| 7 | 9 | import java.text.SimpleDateFormat; |
| ... | ... | @@ -22,6 +24,7 @@ import org.springframework.beans.factory.annotation.Autowired; |
| 22 | 24 | import org.springframework.data.domain.Sort; |
| 23 | 25 | import org.springframework.data.domain.Sort.Direction; |
| 24 | 26 | import org.springframework.jdbc.core.JdbcTemplate; |
| 27 | +import org.springframework.jdbc.core.RowMapper; | |
| 25 | 28 | import org.springframework.stereotype.Service; |
| 26 | 29 | |
| 27 | 30 | import com.alibaba.fastjson.JSONArray; |
| ... | ... | @@ -211,7 +214,7 @@ public class DlbServiceImpl extends BaseServiceImpl<Dlb,Integer> implements DlbS |
| 211 | 214 | * 获取进存电信息 |
| 212 | 215 | * @Transactional 回滚事物 |
| 213 | 216 | */ |
| 214 | - @Transactional | |
| 217 | + /*@Transactional | |
| 215 | 218 | @Override |
| 216 | 219 | public Map<String, Object> obtain(Map<String, Object> map2) { |
| 217 | 220 | List<Cars> carsList=carsRepository.findCars(); |
| ... | ... | @@ -224,6 +227,16 @@ public class DlbServiceImpl extends BaseServiceImpl<Dlb,Integer> implements DlbS |
| 224 | 227 | if(map2.get("ssgsdm_like")!=null){ |
| 225 | 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 | 240 | String rq=map2.get("rq").toString(); |
| 228 | 241 | String line=""; |
| 229 | 242 | if(map2.get("xlbm_eq")!=null){ |
| ... | ... | @@ -236,16 +249,16 @@ public class DlbServiceImpl extends BaseServiceImpl<Dlb,Integer> implements DlbS |
| 236 | 249 | // TODO Auto-generated method stub |
| 237 | 250 | Map<String, Object> newMap=new HashMap<String,Object>(); |
| 238 | 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 | 253 | //当天YLXXB信息 |
| 241 | 254 | List<Ylxxb> ylxxList=ylxxbRepository.obtainYlxx(rq,1,gsbm); |
| 242 | 255 | //当天加电信息表 |
| 243 | 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 | 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 | 262 | List<Dlb> addList=new ArrayList<Dlb>(); |
| 250 | 263 | List<Dlb> updateList=new ArrayList<Dlb>(); |
| 251 | 264 | for(int x=0;x<listpb.size();x++){ |
| ... | ... | @@ -371,6 +384,240 @@ public class DlbServiceImpl extends BaseServiceImpl<Dlb,Integer> implements DlbS |
| 371 | 384 | newMap.put("status", ResponseCode.ERROR); |
| 372 | 385 | } |
| 373 | 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<Dlb,Integer> implements DlbS |
| 727 | 974 | } |
| 728 | 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<Ylb,Integer> implements YlbS |
| 871 | 871 | List<Ylb> ylListBe=repository.listMaxRqJcsx(rq, gsbm, fgsbm, xlbm, nbbm); |
| 872 | 872 | List<Ylb> ylbList=this.listOrderBy(rq,gsbm,fgsbm,xlbm,nbbm,"nbbm"); |
| 873 | 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 | 905 | for (int i = 0; i < ylxxbList.size(); i++) { |
| 876 | - Boolean fage=true; | |
| 906 | + Boolean fage=false; | |
| 877 | 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<Ylb,Integer> implements YlbS |
| 896 | 929 | } |
| 897 | 930 | t.setFgsdm(fgsdm); |
| 898 | 931 | t.setJcsx(1); |
| 899 | - Line line= BasicData.nbbm2LineMap.get(y1.getNbbm()); | |
| 900 | 932 | if(null !=line){ |
| 901 | 933 | t.setXlbm(line.getLineCode()); |
| 902 | 934 | }else{ |
| ... | ... | @@ -929,12 +961,6 @@ public class YlbServiceImpl extends BaseServiceImpl<Ylb,Integer> implements YlbS |
| 929 | 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<Ylxxb,Integer> implements |
| 49 | 49 | String rq=map.get("yyrq").toString(); |
| 50 | 50 | String gsdm=map.get("gsdm_like").toString(); |
| 51 | 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 | 66 | + " ( select * from bsth_c_ylxxb x where " |
| 61 | 67 | + " DATE_FORMAT(x.yyrq,'%Y-%m-%d')='"+rq+"' and x.gsdm='"+gsdm+"'" |
| 62 | 68 | + " and x.jsy not in (" |
| ... | ... | @@ -69,7 +75,7 @@ public class YlxxbServiceImpl extends BaseServiceImpl<Ylxxb,Integer> implements |
| 69 | 75 | + " left join (select * from bsth_c_ylb " |
| 70 | 76 | + " where DATE_FORMAT(rq,'%Y-%m-%d')='"+rq+"'" |
| 71 | 77 | + " and ssgsdm='"+gsdm+"' and fgsdm='"+fgsdm+"' ) u " |
| 72 | - + " on v.nbbm=u.nbbm "; | |
| 78 | + + " on v.nbbm=u.nbbm ";*/ | |
| 73 | 79 | |
| 74 | 80 | //根具条件查询指定日期Ylxxb的数据 |
| 75 | 81 | // List<Ylxxb> iterator=repository.checkYlxx(rq,gsdm); |
| ... | ... | @@ -100,12 +106,28 @@ public class YlxxbServiceImpl extends BaseServiceImpl<Ylxxb,Integer> implements |
| 100 | 106 | s.setNylx(rs.getInt("nylx")); |
| 101 | 107 | s.setJyggh(rs.getString("jyggh")); |
| 102 | 108 | s.setYj(rs.getDouble("yj")); |
| 103 | - s.setLdgh(rs.getString("ldgh")); | |
| 109 | +// s.setLdgh(rs.getString("ldgh")); | |
| 104 | 110 | s.setBz(rs.getString("bz")); |
| 105 | 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 | 132 | // for (int i = 0; i < iterator.size(); i++) { |
| 111 | 133 | // Ylxxb y1=iterator.get(i); | ... | ... |
src/main/java/com/bsth/service/realcontrol/impl/ScheduleRealInfoServiceImpl.java
| ... | ... | @@ -2783,6 +2783,8 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl<ScheduleRealInf |
| 2783 | 2783 | if(reamrks2.length()>5){ |
| 2784 | 2784 | t2.setRemarks(reamrks2.substring(0, 5)); |
| 2785 | 2785 | t2.setRemark(reamrks2); |
| 2786 | + }else{ | |
| 2787 | + t2.setRemark(reamrks2); | |
| 2786 | 2788 | } |
| 2787 | 2789 | if (t1.getId() == t2.getId()) { |
| 2788 | 2790 | t1 = t2; |
| ... | ... | @@ -4064,9 +4066,9 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl<ScheduleRealInf |
| 4064 | 4066 | Long zdsj_=Long.parseLong(zdsj_s[0])*60+Long.parseLong(zdsj_s[1]); |
| 4065 | 4067 | Long zdsjActual_=Long.parseLong(zdsjActual_s[0])*60+Long.parseLong(zdsjActual_s[1]); |
| 4066 | 4068 | if((zdsj_-zdsjActual_)>0){ |
| 4067 | - zdsjm =String.valueOf(zdsj_-zdsjActual_); | |
| 4068 | - }else{ | |
| 4069 | 4069 | zdsjk =String.valueOf(zdsj_-zdsjActual_); |
| 4070 | + }else{ | |
| 4071 | + zdsjm =String.valueOf(zdsj_-zdsjActual_); | |
| 4070 | 4072 | } |
| 4071 | 4073 | } |
| 4072 | 4074 | tempMap.put("zdsjk" + x, zdsjk); |
| ... | ... | @@ -4077,9 +4079,10 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl<ScheduleRealInf |
| 4077 | 4079 | String fcsjActuralstr=""; |
| 4078 | 4080 | if(bcType.equals("in")){ |
| 4079 | 4081 | fcsjActuralstr=fcsjActural+"(进)"; |
| 4080 | - } | |
| 4081 | - if(bcType.equals("out")){ | |
| 4082 | + }else if(bcType.equals("out")){ | |
| 4082 | 4083 | fcsjActuralstr=fcsjActural+"(出)"; |
| 4084 | + }else{ | |
| 4085 | + fcsjActuralstr=fcsjActural; | |
| 4083 | 4086 | } |
| 4084 | 4087 | tempMap.put("fcsjActual" + x, fcsjActuralstr); |
| 4085 | 4088 | String fcsjk=""; |
| ... | ... | @@ -4090,9 +4093,9 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl<ScheduleRealInf |
| 4090 | 4093 | Long zdsj_=Long.parseLong(zdsj_s[0])*60+Long.parseLong(zdsj_s[1]); |
| 4091 | 4094 | Long fcsjActural_=Long.parseLong(fcsjActural_s[0])*60+Long.parseLong(fcsjActural_s[1]); |
| 4092 | 4095 | if((zdsj_-fcsjActural_)>0){ |
| 4093 | - fcsjm =String.valueOf(zdsj_-fcsjActural_); | |
| 4094 | - }else{ | |
| 4095 | 4096 | fcsjk =String.valueOf(zdsj_-fcsjActural_); |
| 4097 | + }else{ | |
| 4098 | + fcsjm =String.valueOf(zdsj_-fcsjActural_); | |
| 4096 | 4099 | } |
| 4097 | 4100 | } |
| 4098 | 4101 | tempMap.put("fcsjk" + x, fcsjk); | ... | ... |
src/main/java/com/bsth/service/report/impl/ReportServiceImpl.java
| ... | ... | @@ -39,6 +39,8 @@ import java.text.ParseException; |
| 39 | 39 | import java.text.SimpleDateFormat; |
| 40 | 40 | import java.util.*; |
| 41 | 41 | |
| 42 | +import javax.persistence.criteria.CriteriaBuilder.In; | |
| 43 | + | |
| 42 | 44 | @Service |
| 43 | 45 | public class ReportServiceImpl implements ReportService{ |
| 44 | 46 | |
| ... | ... | @@ -893,8 +895,391 @@ public class ReportServiceImpl implements ReportService{ |
| 893 | 895 | return m; |
| 894 | 896 | } |
| 895 | 897 | }); |
| 896 | - | |
| 897 | - 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 | + /* | |
| 898 | 1283 | Map<String, List<Map<String, Object>>> keyMap = new HashMap<String, List<Map<String, Object>>>(); |
| 899 | 1284 | Map<String, Map<String, Object>> maps = new HashMap<String, Map<String, Object>>(); |
| 900 | 1285 | keyMap.put("(首)——6:30", new ArrayList<Map<String, Object>>()); |
| ... | ... | @@ -985,10 +1370,10 @@ public class ReportServiceImpl implements ReportService{ |
| 985 | 1370 | } |
| 986 | 1371 | |
| 987 | 1372 | } |
| 988 | - /*if(temp < fcsj){ | |
| 1373 | + if(temp < fcsj){ | |
| 989 | 1374 | cjs.add(fcsj - temp); |
| 990 | 1375 | temp = fcsj; |
| 991 | - }*/ | |
| 1376 | + } | |
| 992 | 1377 | if(m.get("ists").toString().trim().equals("1")){ |
| 993 | 1378 | ists = true; |
| 994 | 1379 | }else{ |
| ... | ... | @@ -1037,7 +1422,7 @@ public class ReportServiceImpl implements ReportService{ |
| 1037 | 1422 | newList.add(maps.get("6:31——8:30")); |
| 1038 | 1423 | newList.add(maps.get("8:31——16:00")); |
| 1039 | 1424 | newList.add(maps.get("16:01——18:00")); |
| 1040 | - newList.add(maps.get("18:01——(末)")); | |
| 1425 | + newList.add(maps.get("18:01——(末)"));*/ | |
| 1041 | 1426 | |
| 1042 | 1427 | return newList; |
| 1043 | 1428 | } | ... | ... |
src/main/java/com/bsth/service/schedule/impl/SchedulePlanServiceImpl.java
| ... | ... | @@ -30,6 +30,7 @@ import org.kie.api.runtime.KieSession; |
| 30 | 30 | import org.slf4j.Logger; |
| 31 | 31 | import org.slf4j.LoggerFactory; |
| 32 | 32 | import org.springframework.beans.factory.annotation.Autowired; |
| 33 | +import org.springframework.beans.factory.annotation.Qualifier; | |
| 33 | 34 | import org.springframework.stereotype.Service; |
| 34 | 35 | import org.springframework.transaction.annotation.Isolation; |
| 35 | 36 | import org.springframework.transaction.annotation.Propagation; |
| ... | ... | @@ -43,7 +44,13 @@ import java.util.*; |
| 43 | 44 | @Service |
| 44 | 45 | public class SchedulePlanServiceImpl extends BServiceImpl<SchedulePlan, Long> implements SchedulePlanService { |
| 45 | 46 | @Autowired |
| 47 | + @Qualifier("kb1") | |
| 46 | 48 | private KieBase kieBase; |
| 49 | + | |
| 50 | + @Autowired | |
| 51 | + @Qualifier("kb2") | |
| 52 | + private KieBase kieBase2; | |
| 53 | + | |
| 47 | 54 | @Autowired |
| 48 | 55 | private ScheduleRule1FlatRepository scheduleRule1FlatRepository; |
| 49 | 56 | @Autowired |
| ... | ... | @@ -60,11 +67,49 @@ public class SchedulePlanServiceImpl extends BServiceImpl<SchedulePlan, Long> im |
| 60 | 67 | private BusinessRepository businessRepository; |
| 61 | 68 | @Autowired |
| 62 | 69 | private ScheduleRuleService scheduleRuleService; |
| 70 | + @Autowired | |
| 71 | + private RerunRuleRepository rerunRuleRepository; | |
| 63 | 72 | |
| 64 | 73 | /** 日志记录器 */ |
| 65 | 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 | 114 | * @param schedulePlan 排班计划对象 |
| 70 | 115 | * @param lpInfoResults_output 时刻表每日路牌的情况 |
| ... | ... | @@ -76,13 +121,7 @@ public class SchedulePlanServiceImpl extends BServiceImpl<SchedulePlan, Long> im |
| 76 | 121 | // 全局计算参数 |
| 77 | 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 | 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 | 28 | * 返回一个kiebase知识库,直接冲文件系统读入drl规则文件, |
| 29 | 29 | * TODO:以后需要从数据库读入规则文件,并重新创建kbase知识库。 |
| 30 | 30 | */ |
| 31 | - @Bean | |
| 31 | + @Bean(name = "kb1") | |
| 32 | 32 | public KieBase myKieBase() { |
| 33 | 33 | // Drools 6开始引入kie统一接口(jboss的jbpm工作流也使用kie接口了),整个定义方式和5差别很大 |
| 34 | 34 | // 这里使用全api方式创建知识库对象,不使用xml的方式,提供最大的灵活性 |
| ... | ... | @@ -100,4 +100,65 @@ public class MyDroolsConfiguration { |
| 100 | 100 | |
| 101 | 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 | 20 | /** 线路id */ |
| 21 | 21 | private String xlId; |
| 22 | 22 | |
| 23 | + /** 排班输入规则类型 */ | |
| 24 | + private ScheduleRule_Type sType = ScheduleRule_Type.NORMAL; | |
| 25 | + | |
| 23 | 26 | public DateTime getSd() { |
| 24 | 27 | return sd; |
| 25 | 28 | } |
| ... | ... | @@ -67,4 +70,12 @@ public class ScheduleResult_output { |
| 67 | 70 | public void setXlId(String xlId) { |
| 68 | 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 | 37 | /** 车辆翻版(周一到周日是否启用) */ |
| 38 | 38 | private List<Boolean> weekdays = new ArrayList<>(); |
| 39 | 39 | |
| 40 | + /** 排班输入规则类型 */ | |
| 41 | + private ScheduleRule_Type sType = ScheduleRule_Type.NORMAL; | |
| 42 | + | |
| 40 | 43 | /** 关联的原始规则 */ |
| 41 | 44 | private ScheduleRule1Flat self; |
| 42 | 45 | |
| ... | ... | @@ -164,4 +167,11 @@ public class ScheduleRule_input { |
| 164 | 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 | 17 | * @return |
| 18 | 18 | */ |
| 19 | 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 | 68 | String flag = "failure"; |
| 69 | 69 | try { |
| 70 | 70 | // 调用接口下载基础数据 |
| 71 | - if(download(userName, DigestUtils.md5Hex(passWord), saveFile)){ | |
| 71 | + if(download(userName, passWord, saveFile)){ | |
| 72 | 72 | // 读取基础数据zip |
| 73 | 73 | StringBuffer sb = readZipFile(saveFile); |
| 74 | 74 | // 解析xml |
| ... | ... | @@ -99,10 +99,11 @@ public class YgcBasicDataServiceImpl implements YgcBasicDataService{ |
| 99 | 99 | * @param saveFile |
| 100 | 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 | 104 | try |
| 105 | 105 | { |
| 106 | + password = DigestUtils.md5Hex(password); | |
| 106 | 107 | OMElement data = buildDownloadEnvelope(userName, password); |
| 107 | 108 | ServiceClient sender = new ServiceClient(); |
| 108 | 109 | Options options = sender.getOptions(); |
| ... | ... | @@ -123,6 +124,12 @@ public class YgcBasicDataServiceImpl implements YgcBasicDataService{ |
| 123 | 124 | while ((read = is.read(buffer)) != -1) { |
| 124 | 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 | 133 | return true; |
| 127 | 134 | } catch (Exception e) { |
| 128 | 135 | e.printStackTrace(); | ... | ... |
src/main/resources/rules/plan.drl
| ... | ... | @@ -27,7 +27,8 @@ import com.bsth.entity.schedule.SchedulePlanInfo; |
| 27 | 27 | |
| 28 | 28 | import org.slf4j.Logger |
| 29 | 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 | 34 | // 全局日志类(一般使用调用此规则的service类) |
| ... | ... | @@ -385,9 +386,11 @@ rule "Calcu_SchedulePlanInfo" |
| 385 | 386 | // 路牌 |
| 386 | 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 | 395 | // 时刻表id |
| 393 | 396 | String ttInfoId = ttInfoId_sd($lr.getTtInfoMapLoop(), sd); |
| ... | ... | @@ -419,7 +422,8 @@ rule "Calcu_SchedulePlanInfo" |
| 419 | 422 | eclist, |
| 420 | 423 | $param.getSchedulePlan(), |
| 421 | 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 | 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 | 9 | |
| 10 | 10 | import com.bsth.service.schedule.rules.shiftloop.ScheduleCalcuParam_input; |
| 11 | 11 | import com.bsth.service.schedule.rules.shiftloop.ScheduleRule_input; |
| 12 | +import com.bsth.service.schedule.rules.shiftloop.ScheduleRule_Type; | |
| 12 | 13 | import com.bsth.service.schedule.rules.shiftloop.ScheduleResult_output; |
| 13 | 14 | import com.bsth.service.schedule.rules.shiftloop.ScheduleResults_output; |
| 14 | 15 | |
| ... | ... | @@ -342,33 +343,41 @@ rule "Calcu_loop2_1_" // 路牌在时刻表中存在,就翻 |
| 342 | 343 | ro.setCarConfigId($cid); |
| 343 | 344 | ro.setXlId($xlid); |
| 344 | 345 | |
| 346 | + // 类型 | |
| 347 | + ro.setsType($sri.getsType()); | |
| 348 | + | |
| 345 | 349 | scheduleResult.getResults().add(ro); |
| 346 | 350 | |
| 351 | +// log.info("gogoogogogogo"); | |
| 352 | + | |
| 347 | 353 | $cdrp.setCalcu_index_lp(($lpindex + 1) % $lprangesize); |
| 348 | 354 | $cdrp.setCalcu_index_ry(($ryindex + 1) % $ryrangesize); |
| 349 | 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 | 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 | 383 | // log.info("Calcu_loop2_1_ ruleId={}, calcu_index_lp/ry={}/{}, from={}, to={}", |
| ... | ... | @@ -406,6 +415,9 @@ rule "Calcu_loop2_2_" // 路牌在时刻表中不存在,就不翻 |
| 406 | 415 | ro.setCarConfigId($cid); |
| 407 | 416 | ro.setXlId($xlid); |
| 408 | 417 | |
| 418 | + // 类型 | |
| 419 | + ro.setsType($sri.getsType()); | |
| 420 | + | |
| 409 | 421 | scheduleResult.getResults().add(ro); |
| 410 | 422 | |
| 411 | 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"> 间隔等级 :</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"> 高峰间隔时间 : </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"> 低谷间隔时间 : </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"> 创建人 : </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 | 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"> 间隔等级 :</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"> 高峰间隔时间 : </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"> 低谷间隔时间 : </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"> 创建人 : </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"> 创建时间 : </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"> 修改人 : </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"> 修改时间 : </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 | 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 | 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 | 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 | 158 | \ No newline at end of file | ... | ... |
src/main/resources/static/pages/base/line/editRoute.html
| ... | ... | @@ -149,9 +149,9 @@ $('#edit_route_mobal').on('editRouteMobal.show', function(e,transGPS,editRoute,m |
| 149 | 149 | var stationList = arrayFormat.stationList; |
| 150 | 150 | var sectionListTemp = arrayFormat.sectionList; |
| 151 | 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 | 157 | var sectionListFinal = []; |
| ... | ... | @@ -273,7 +273,7 @@ $('#edit_route_mobal').on('editRouteMobal.show', function(e,transGPS,editRoute,m |
| 273 | 273 | //$('#uploadRoute').addClass('hidden'); |
| 274 | 274 | $('#upload').addClass('hidden'); |
| 275 | 275 | layer.msg('请先编辑路段,并保存!!!'); |
| 276 | - }else { | |
| 276 | + }else { | |
| 277 | 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 | 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 | 36 | mapBValue.enableDragging(); | ... | ... |
src/main/resources/static/pages/base/line/map.html
| ... | ... | @@ -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 | 117 | var sectionList = WorldsBMapLine.getSectionList(); |
| 118 | 118 | var data = {}; |
| 119 | 119 | var section = EditSectionObj.getEitdSection(); |
| ... | ... | @@ -131,10 +131,11 @@ $(function(){ |
| 131 | 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 | 32 | <th width="3%">#</th> |
| 33 | 33 | <th width="4%">线路</th> |
| 34 | 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 | 39 | <th width="8%">持续时间</th> |
| 39 | 40 | <th width="8%">查看轨迹</th> |
| 40 | 41 | <th width="6%">操作</th> |
| ... | ... | @@ -47,11 +48,6 @@ |
| 47 | 48 | <td> |
| 48 | 49 | <select class="form-control" name="nbbm" id="nbbm" style="width: 100px;"></select> |
| 49 | 50 | </td> |
| 50 | - <!-- <td> | |
| 51 | - | |
| 52 | - </td> | |
| 53 | - <td> | |
| 54 | - </td> --> | |
| 55 | 51 | <td> |
| 56 | 52 | <select class="form-control form-filter " name="updown" style="width: 90px;"> |
| 57 | 53 | <option value="">请选择...</option> |
| ... | ... | @@ -60,7 +56,9 @@ |
| 60 | 56 | <option value="-1">无效</option> |
| 61 | 57 | </select> |
| 62 | 58 | </td> |
| 63 | - <td> | |
| 59 | + <td> | |
| 60 | + </td> | |
| 61 | + <td> | |
| 64 | 62 | <input class="form-control" type="date" name="startDate" /> |
| 65 | 63 | </td> |
| 66 | 64 | <td> |
| ... | ... | @@ -114,6 +112,9 @@ |
| 114 | 112 | {{/if}} |
| 115 | 113 | </td> |
| 116 | 114 | <td> |
| 115 | + {{obj.address}} | |
| 116 | + </td> | |
| 117 | + <td> | |
| 117 | 118 | {{obj.timestampDate}} |
| 118 | 119 | </td> |
| 119 | 120 | <td> |
| ... | ... | @@ -144,6 +145,7 @@ |
| 144 | 145 | |
| 145 | 146 | <script> |
| 146 | 147 | $(function(){ |
| 148 | + if (!$('body').hasClass('page-sidebar-closed')) {$('.menu-toggler.sidebar-toggler').click();} | |
| 147 | 149 | var page = 0, initPagination; |
| 148 | 150 | var icheckOptions = { |
| 149 | 151 | checkboxClass: 'icheckbox_flat-blue', |
| ... | ... | @@ -220,41 +222,55 @@ $(function(){ |
| 220 | 222 | params['page'] = page; |
| 221 | 223 | var i = layer.load(2); |
| 222 | 224 | $get('/nowspeeding/pagequery' ,params, function(data){ |
| 223 | - var bodyHtm = template('speeding_list_temp', {list: data.dataList}); | |
| 224 | - $('#datatable_speeding tbody').html(bodyHtm) | |
| 225 | - .find('.icheck').iCheck(icheckOptions) | |
| 226 | - .on('ifChanged', iCheckChange); | |
| 227 | - if(pagination && data.dataList.length > 0){ | |
| 228 | - //重新分页 | |
| 229 | - initPagination = true; | |
| 230 | - showPagination(data); | |
| 231 | - } | |
| 232 | - layer.close(i); | |
| 233 | - $(".lookTrajectory").click(function(){ | |
| 234 | - var vehicle = $(this).data('vehicle'); | |
| 235 | - var startDate = $(this).data('startdate'); | |
| 236 | - var endDate = $(this).data('enddate'); | |
| 237 | - var lon = $(this).data('lon'); | |
| 238 | - var lat = $(this).data('lat'); | |
| 239 | - var endLon = $(this).data('endlon'); | |
| 240 | - var endLat = $(this).data('endlat'); | |
| 241 | - var lineid = $(this).data('lineid'); | |
| 242 | - var upDown = $(this).data('updown'); | |
| 243 | - var storage = window.localStorage; | |
| 244 | - storage.setItem("zbhAndDate",vehicle+","+startDate+","+endDate+","+lon+","+lat+","+endLon+","+endLat+","+lineid+","+upDown); | |
| 245 | - $.get('/pages/excep/speedingMap.html?',function (result) { | |
| 246 | - layer.open({ | |
| 247 | - type: 1, | |
| 248 | - title:'<i class="uk-icon-play-circle"></i>轨迹回放', | |
| 249 | - shadeClose: true, | |
| 250 | - shade: true, | |
| 251 | - scrollbar: false, | |
| 252 | - maxmin: false, //开启最大化最小化按钮 | |
| 253 | - area: ['100%', '100%'], | |
| 254 | - content:result,//内容 | |
| 255 | - }); | |
| 256 | - }); | |
| 257 | - }) | |
| 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); | |
| 258 | 274 | }); |
| 259 | 275 | } |
| 260 | 276 | ... | ... |
src/main/resources/static/pages/oil/checkJyryList.html
| ... | ... | @@ -168,7 +168,6 @@ $(function(){ |
| 168 | 168 | }) |
| 169 | 169 | var params = {}; |
| 170 | 170 | params['ylbList']=JSON.stringify(ylArray); |
| 171 | - console.log(params); | |
| 172 | 171 | var i = layer.load(2); |
| 173 | 172 | $post('/ylxxb/check', params, function(){ |
| 174 | 173 | layer.close(i); |
| ... | ... | @@ -287,7 +286,6 @@ $(function(){ |
| 287 | 286 | params['yyrq']=$("#yyrq").val(); |
| 288 | 287 | // var i = layer.load(2); |
| 289 | 288 | |
| 290 | - var i = 2; | |
| 291 | 289 | /* var jyryGsdm=$("#jyryListGsdmId").val(); |
| 292 | 290 | var jyryFgsdm=$("#jyryListFgsdmId").val(); |
| 293 | 291 | if(jyryGsdm=="" || jyryGsdm==null){ |
| ... | ... | @@ -307,7 +305,7 @@ $(function(){ |
| 307 | 305 | params['fgsdm_in']=fgsqx1; |
| 308 | 306 | } |
| 309 | 307 | } */ |
| 310 | - | |
| 308 | + var i = layer.load(2); | |
| 311 | 309 | $get('/ylxxb/pagequery' ,params, function(data){ |
| 312 | 310 | $.each(data.dataList, function(i, obj) { |
| 313 | 311 | obj.yyrq = moment(obj.yyrq).format("YYYY-MM-DD"); | ... | ... |