Commit 107f8dd237fa26c73cef56d3ac09c76327388238
Merge branch 'minhang' into pudong
Showing
37 changed files
with
1374 additions
and
491 deletions
src/main/java/com/bsth/controller/oil/YlbController.java
| ... | ... | @@ -50,8 +50,14 @@ public class YlbController extends BaseController<Ylb, Integer>{ |
| 50 | 50 | * @return |
| 51 | 51 | */ |
| 52 | 52 | @RequestMapping(value = "/obtain",method = RequestMethod.GET) |
| 53 | - public Map<String, Object> obtain(@RequestParam Map<String, Object> map){ | |
| 54 | - Map<String, Object> list=yblService.obtain(map); | |
| 53 | + public Map<String, Object> obtain(@RequestParam Map<String, Object> map) throws Exception{ | |
| 54 | + Map<String, Object> list =new HashMap<String, Object>(); | |
| 55 | + try { | |
| 56 | + list = yblService.obtain(map); | |
| 57 | + } catch (Exception e) { | |
| 58 | + // TODO Auto-generated catch block | |
| 59 | + throw e; | |
| 60 | + } | |
| 55 | 61 | System.out.println(); |
| 56 | 62 | return list; |
| 57 | 63 | } |
| ... | ... | @@ -73,8 +79,14 @@ public class YlbController extends BaseController<Ylb, Integer>{ |
| 73 | 79 | * @return |
| 74 | 80 | */ |
| 75 | 81 | @RequestMapping(value = "/outAndIn",method = RequestMethod.GET) |
| 76 | - public Map<String, Object> outAndIn(@RequestParam Map<String, Object> map){ | |
| 77 | - Map<String, Object> list=yblService.outAndIn(map); | |
| 82 | + public Map<String, Object> outAndIn(@RequestParam Map<String, Object> map) throws Exception{ | |
| 83 | + Map<String, Object> list=new HashMap<String, Object>(); | |
| 84 | + try { | |
| 85 | + list=yblService.outAndIn(map); | |
| 86 | + } catch (Exception e) { | |
| 87 | + // TODO: handle exception | |
| 88 | + } | |
| 89 | + | |
| 78 | 90 | return list; |
| 79 | 91 | } |
| 80 | 92 | ... | ... |
src/main/java/com/bsth/entity/schedule/CarConfigInfo.java
| 1 | 1 | package com.bsth.entity.schedule; |
| 2 | 2 | |
| 3 | +import com.bsth.entity.CarPark; | |
| 3 | 4 | import com.bsth.entity.Cars; |
| 4 | 5 | import com.bsth.entity.Line; |
| 5 | 6 | import com.fasterxml.jackson.annotation.JsonIgnoreProperties; |
| ... | ... | @@ -47,9 +48,16 @@ public class CarConfigInfo extends BEntity implements Serializable { |
| 47 | 48 | private Date qyrq; |
| 48 | 49 | /** 终止日期 */ |
| 49 | 50 | private Date zzrq; |
| 51 | + | |
| 52 | + | |
| 50 | 53 | @Column(nullable = false) |
| 51 | 54 | /** 停车点(TODO:这个不知道是否要关联)*/ |
| 52 | 55 | private String tcd; |
| 56 | + | |
| 57 | + /** 停车场关联(出场,进场班次会关联停车场) */ | |
| 58 | + @ManyToOne(cascade = CascadeType.DETACH, fetch = FetchType.LAZY) | |
| 59 | + private CarPark tcc; | |
| 60 | + | |
| 53 | 61 | /** 受否切换 0或者1(TODO:不懂,貌似喝历史配车有关) */ |
| 54 | 62 | @Column(nullable = false) |
| 55 | 63 | private int isSwitch; |
| ... | ... | @@ -248,4 +256,12 @@ public class CarConfigInfo extends BEntity implements Serializable { |
| 248 | 256 | public void setDownInSj(Double downInSj) { |
| 249 | 257 | this.downInSj = downInSj; |
| 250 | 258 | } |
| 259 | + | |
| 260 | + public CarPark getTcc() { | |
| 261 | + return tcc; | |
| 262 | + } | |
| 263 | + | |
| 264 | + public void setTcc(CarPark tcc) { | |
| 265 | + this.tcc = tcc; | |
| 266 | + } | |
| 251 | 267 | } | ... | ... |
src/main/java/com/bsth/entity/schedule/SchedulePlanInfo.java
| ... | ... | @@ -160,7 +160,10 @@ public class SchedulePlanInfo { |
| 160 | 160 | Boolean isFb, |
| 161 | 161 | CarConfigInfo carConfigInfo, |
| 162 | 162 | List<EmployeeConfigInfo> employeeConfigInfoList, |
| 163 | - SchedulePlan schedulePlan) { | |
| 163 | + SchedulePlan schedulePlan, | |
| 164 | + boolean isFirstBc, // 是否第一个班次 | |
| 165 | + boolean isLastBc // 是否最后一个班次 | |
| 166 | + ) { | |
| 164 | 167 | |
| 165 | 168 | // TODO:关联的公司名称 |
| 166 | 169 | // TODO:关联的公司编码 |
| ... | ... | @@ -266,6 +269,47 @@ public class SchedulePlanInfo { |
| 266 | 269 | // 使用的时刻表名字 |
| 267 | 270 | this.ttInfoName = ttInfoDetail.getTtinfo().getName(); |
| 268 | 271 | |
| 272 | + // 使用车辆配置的停车场信息 | |
| 273 | + String pzType = carConfigInfo.getPzType(); // 配置类型 | |
| 274 | + if (pzType != null && !pzType.equals("BSY")) { | |
| 275 | + if ("ZW".equals(pzType)) { // 只看早晚进出场 | |
| 276 | + if (isFirstBc) { // 第一个班次是出场 | |
| 277 | + this.qdz = carConfigInfo.getTcc().getId(); // 起点站-停车场id | |
| 278 | + this.qdzCode = carConfigInfo.getTcc().getParkCode(); // 起点站-停车场code | |
| 279 | + this.qdzName = carConfigInfo.getTcc().getParkName(); // 起点站-停车场name | |
| 280 | + | |
| 281 | + this.jhlc = "0".equals(this.xlDir) ? carConfigInfo.getUpOutLc() : carConfigInfo.getDownOutLc(); | |
| 282 | + this.bcsj = "0".equals(this.xlDir) ? carConfigInfo.getUpOutSj().intValue() : carConfigInfo.getDownOutSj().intValue(); | |
| 283 | + | |
| 284 | + } else if (isLastBc) { // 最后一个班次是进场 | |
| 285 | + this.zdz = carConfigInfo.getTcc().getId(); // 终点站-停车场id | |
| 286 | + this.zdzCode = carConfigInfo.getTcc().getParkCode(); // 终点站-停车场code | |
| 287 | + this.zdzName = carConfigInfo.getTcc().getParkName(); // 终点站-停车场name | |
| 288 | + | |
| 289 | + this.jhlc = "0".equals(this.xlDir) ? carConfigInfo.getUpInLc() : carConfigInfo.getDownInLc(); | |
| 290 | + this.bcsj = "0".equals(this.xlDir) ? carConfigInfo.getUpInSj().intValue() : carConfigInfo.getDownInSj().intValue(); | |
| 291 | + } | |
| 292 | + | |
| 293 | + } else if ("FS".equals(pzType)) { // 所有进出场 | |
| 294 | + if ("out".equals(this.bcType)) { // 出场班次 | |
| 295 | + this.qdz = carConfigInfo.getTcc().getId(); // 起点站-停车场id | |
| 296 | + this.qdzCode = carConfigInfo.getTcc().getParkCode(); // 起点站-停车场code | |
| 297 | + this.qdzName = carConfigInfo.getTcc().getParkName(); // 起点站-停车场name | |
| 298 | + | |
| 299 | + this.jhlc = "0".equals(this.xlDir) ? carConfigInfo.getUpOutLc() : carConfigInfo.getDownOutLc(); | |
| 300 | + this.bcsj = "0".equals(this.xlDir) ? carConfigInfo.getUpOutSj().intValue() : carConfigInfo.getDownOutSj().intValue(); | |
| 301 | + | |
| 302 | + } else if ("in".equals(this.bcType)) { | |
| 303 | + this.zdz = carConfigInfo.getTcc().getId(); // 终点站-停车场id | |
| 304 | + this.zdzCode = carConfigInfo.getTcc().getParkCode(); // 终点站-停车场code | |
| 305 | + this.zdzName = carConfigInfo.getTcc().getParkName(); // 终点站-停车场name | |
| 306 | + | |
| 307 | + this.jhlc = "0".equals(this.xlDir) ? carConfigInfo.getUpInLc() : carConfigInfo.getDownInLc(); | |
| 308 | + this.bcsj = "0".equals(this.xlDir) ? carConfigInfo.getUpInSj().intValue() : carConfigInfo.getDownInSj().intValue(); | |
| 309 | + } | |
| 310 | + } | |
| 311 | + } | |
| 312 | + | |
| 269 | 313 | } |
| 270 | 314 | |
| 271 | 315 | ... | ... |
src/main/java/com/bsth/entity/schedule/rule/ScheduleRule1Flat.java
src/main/java/com/bsth/repository/oil/CylRepository.java
| ... | ... | @@ -15,6 +15,6 @@ import com.bsth.repository.BaseRepository; |
| 15 | 15 | public interface CylRepository extends BaseRepository<Cyl, Integer>{ |
| 16 | 16 | @Transactional |
| 17 | 17 | @Modifying |
| 18 | - @Query(value="SELECT * FROM bsth_c_cyl ",nativeQuery=true) | |
| 19 | - List<Cyl> obtainCyl(); | |
| 18 | + @Query(value="SELECT * FROM bsth_c_cyl where nbbm like %?1% and gsdm like %?2%",nativeQuery=true) | |
| 19 | + List<Cyl> obtainCyl(String nbbm,String gsdm); | |
| 20 | 20 | } | ... | ... |
src/main/java/com/bsth/repository/oil/YlbRepository.java
| ... | ... | @@ -33,8 +33,10 @@ public interface YlbRepository extends BaseRepository<Ylb, Integer>{ |
| 33 | 33 | */ |
| 34 | 34 | @Transactional |
| 35 | 35 | @Modifying |
| 36 | - @Query(value="SELECT * FROM bsth_c_ylb where to_days(?)=to_days(rq)",nativeQuery=true) | |
| 37 | - List<Ylb> obtainYl(String rq); | |
| 36 | + @Query(value="SELECT * FROM bsth_c_ylb where to_days(?1)=to_days(rq) and ssgsdm like %?2% " | |
| 37 | + + " and fgsdm like %?3%" | |
| 38 | + + " and xlbm like %?4% and nbbm like %?5% order by ?6 asc ",nativeQuery=true) | |
| 39 | + List<Ylb> obtainYl(String rq,String gsdm,String fgsdm,String xlbm,String nbbm,String px); | |
| 38 | 40 | |
| 39 | 41 | |
| 40 | 42 | @Transactional |
| ... | ... | @@ -48,6 +50,6 @@ public interface YlbRepository extends BaseRepository<Ylb, Integer>{ |
| 48 | 50 | */ |
| 49 | 51 | @Transactional |
| 50 | 52 | @Modifying |
| 51 | - @Query(value="select sum(jzl) as jzl,sum(zlc) as zlc from bsth_c_ylb where nbbm=?1 and rq=?2",nativeQuery=true) | |
| 53 | + @Query(value="select sum(jzl) as jzl,sum(zlc) as zlc ,sum(sh) as sh from bsth_c_ylb where nbbm=?1 and rq=?2",nativeQuery=true) | |
| 52 | 54 | List<Object[]> sumLcYl(String nbbm,Date rq); |
| 53 | 55 | } | ... | ... |
src/main/java/com/bsth/service/forms/impl/FormsServiceImpl.java
| ... | ... | @@ -2,6 +2,7 @@ package com.bsth.service.forms.impl; |
| 2 | 2 | |
| 3 | 3 | import java.sql.ResultSet; |
| 4 | 4 | import java.sql.SQLException; |
| 5 | +import java.text.DecimalFormat; | |
| 5 | 6 | import java.text.NumberFormat; |
| 6 | 7 | import java.text.ParseException; |
| 7 | 8 | import java.text.SimpleDateFormat; |
| ... | ... | @@ -23,6 +24,7 @@ import com.bsth.entity.mcy_forms.Singledata; |
| 23 | 24 | import com.bsth.entity.mcy_forms.Turnoutrate; |
| 24 | 25 | import com.bsth.entity.mcy_forms.Vehicleloading; |
| 25 | 26 | import com.bsth.entity.mcy_forms.Waybillday; |
| 27 | +import com.bsth.data.BasicData; | |
| 26 | 28 | import com.bsth.entity.mcy_forms.Allline; |
| 27 | 29 | import com.bsth.entity.mcy_forms.Changetochange; |
| 28 | 30 | import com.bsth.entity.mcy_forms.Daily; |
| ... | ... | @@ -341,33 +343,28 @@ public class FormsServiceImpl implements FormsService { |
| 341 | 343 | String rq3 = sdf1.format(d1); |
| 342 | 344 | |
| 343 | 345 | rq = rq2 + "-" + rq3; |
| 344 | - | |
| 345 | - String sql = " SELECT r.xl_bm,r.xl_name,r.cl_zbh,r.j_gh,r.j_name,y.YH,y.JZL,r.gs_bm,r.gs_name,r.fgs_bm,r.fgs_name " | |
| 346 | - + " FROM bsth_c_s_sp_info_real r " | |
| 347 | - + " left join bsth_c_ylb y" | |
| 348 | - + " ON r.cl_zbh = y.nbbm " | |
| 349 | - + " where r.schedule_date_str BETWEEN '" + map.get("startDate").toString() + "'" | |
| 350 | - + " and '"+ map.get("endDate").toString() + "'" | |
| 351 | - + " and r.xl_bm='" + map.get("line").toString() + "'" | |
| 352 | - + " AND r.gs_bm is not null"; | |
| 353 | - | |
| 354 | - if(map.get("gsdmSing").toString()!=""){ | |
| 355 | - sql+=" and r.gs_bm='"+map.get("gsdmSing").toString()+"'"; | |
| 356 | - } | |
| 357 | - if(map.get("fgsdmSing").toString()!=""){ | |
| 358 | - sql+=" and r.fgs_bm='"+map.get("fgsdmSing").toString()+"'"; | |
| 359 | - } | |
| 360 | - sql += " GROUP BY r.xl_bm,r.cl_zbh,r.j_gh,r.j_name,y.YH,y.JZL,r.gs_bm,r.gs_name,r.fgs_bm,r.fgs_name "; | |
| 361 | - | |
| 362 | 346 | startDate = map.get("startDate").toString(); |
| 363 | 347 | endDate = map.get("endDate").toString(); |
| 348 | + String sql = "select t.*,y.yh,y.jzl from (" | |
| 349 | + + " select r.xl_bm,r.xl_name,r.cl_zbh,r.j_gh,r.j_name,r.gs_bm,r.fgs_bm" | |
| 350 | + + " from bsth_c_s_sp_info_real r where r.schedule_date_str " | |
| 351 | + + " BETWEEN '"+startDate+"' and '"+endDate+"' and r.xl_bm='"+map.get("line").toString()+"' " | |
| 352 | + + " AND r.gs_bm is not null and r.gs_bm='"+map.get("gsdmSing").toString()+"' " | |
| 353 | + + " and r.fgs_bm='"+map.get("fgsdmSing").toString()+"' " | |
| 354 | + + " group by r.xl_bm,r.xl_name,r.cl_zbh,r.j_gh,r.j_name,r.gs_bm,r.fgs_bm) t " | |
| 355 | + + " LEFT JOIN (select a.nbbm,a.jsy,SUM(a.yh) as yh,SUM(a.jzl) as jzl " | |
| 356 | + + " from bsth_c_ylb a where a.rq BETWEEN '"+startDate+"' and '"+endDate+"'and " | |
| 357 | + + " a.ssgsdm='"+map.get("gsdmSing").toString()+"' and a.fgsdm='"+map.get("fgsdmSing").toString()+"' " | |
| 358 | + + "group by a.nbbm,a.jsy) y" | |
| 359 | + + " on y.nbbm=t.cl_zbh and y.jsy= t.j_gh"; | |
| 360 | + | |
| 364 | 361 | List<Singledata> list = jdbcTemplate.query(sql, new RowMapper<Singledata>() { |
| 365 | 362 | //SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); |
| 366 | 363 | @Override |
| 367 | 364 | public Singledata mapRow(ResultSet arg0, int arg1) throws SQLException { |
| 368 | 365 | Singledata sin = new Singledata(); |
| 369 | 366 | sin.setrQ(rq); |
| 370 | - sin.setgS(arg0.getString("gs_name")); | |
| 367 | + sin.setgS(arg0.getString("gs_bm")); | |
| 371 | 368 | sin.setxL(arg0.getString("xl_name")); |
| 372 | 369 | sin.setClzbh(arg0.getString("cl_zbh")); |
| 373 | 370 | sin.setJsy(arg0.getString("j_gh")); |
| ... | ... | @@ -380,8 +377,13 @@ public class FormsServiceImpl implements FormsService { |
| 380 | 377 | return sin; |
| 381 | 378 | } |
| 382 | 379 | }); |
| 380 | + DecimalFormat df = new DecimalFormat("0.00"); | |
| 383 | 381 | for(int i=0;i<list.size();i++){ |
| 382 | + | |
| 384 | 383 | Singledata si=list.get(i); |
| 384 | + si.setgS(BasicData.businessCodeNameMap.get(si.getgS())); | |
| 385 | + si.setJzl(df.format(Double.parseDouble(si.getJzl()))); | |
| 386 | + si.setHyl(df.format(Double.parseDouble(si.getHyl()))); | |
| 385 | 387 | Map<String, Object> maps = new HashMap<>(); |
| 386 | 388 | maps = commonService.findKMBC1(si.getjName(),si.getClzbh(), startDate, |
| 387 | 389 | endDate); | ... | ... |
src/main/java/com/bsth/service/impl/BusIntervalServiceImpl.java
| ... | ... | @@ -1345,8 +1345,8 @@ public class BusIntervalServiceImpl implements BusIntervalService { |
| 1345 | 1345 | Collections.sort(keyMap1.get(key), new Comparator<Map<String, Object>>() { |
| 1346 | 1346 | |
| 1347 | 1347 | public int compare(Map<String, Object> o1, Map<String, Object> o2) { |
| 1348 | - Integer a; | |
| 1349 | - Integer b; | |
| 1348 | + Long a; | |
| 1349 | + Long b; | |
| 1350 | 1350 | String lp1 = o1.get("lp").toString(); |
| 1351 | 1351 | String lp2 = o2.get("lp").toString(); |
| 1352 | 1352 | String str1 = ""; |
| ... | ... | @@ -1358,8 +1358,8 @@ public class BusIntervalServiceImpl implements BusIntervalService { |
| 1358 | 1358 | str2 += (int)lp2.charAt(i); |
| 1359 | 1359 | } |
| 1360 | 1360 | |
| 1361 | - a = Integer.valueOf(str1); | |
| 1362 | - b = Integer.valueOf(str2); | |
| 1361 | + a = Long.valueOf(str1); | |
| 1362 | + b = Long.valueOf(str2); | |
| 1363 | 1363 | |
| 1364 | 1364 | // 升序 |
| 1365 | 1365 | return a.compareTo(b); | ... | ... |
src/main/java/com/bsth/service/oil/YlbService.java
| ... | ... | @@ -7,11 +7,11 @@ import com.bsth.entity.oil.Ylb; |
| 7 | 7 | import com.bsth.service.BaseService; |
| 8 | 8 | |
| 9 | 9 | public interface YlbService extends BaseService<Ylb, Integer>{ |
| 10 | - Map<String, Object> obtain(Map<String, Object> map); | |
| 11 | - String obtainDsq(); | |
| 10 | + Map<String, Object> obtain(Map<String, Object> map) throws Exception; | |
| 11 | + String obtainDsq() throws Exception; | |
| 12 | 12 | Map<String, Object> sort(Map<String, Object> map); |
| 13 | 13 | |
| 14 | - Map<String, Object> outAndIn(Map<String, Object> map); | |
| 14 | + Map<String, Object> outAndIn(Map<String, Object> map) throws Exception; | |
| 15 | 15 | |
| 16 | 16 | Map<String, Object> checkYl(Map<String, Object> map); |
| 17 | 17 | ... | ... |
src/main/java/com/bsth/service/oil/impl/YlbServiceImpl.java
| ... | ... | @@ -71,109 +71,113 @@ public class YlbServiceImpl extends BaseServiceImpl<Ylb,Integer> implements YlbS |
| 71 | 71 | */ |
| 72 | 72 | @Transactional |
| 73 | 73 | @Override |
| 74 | - public String obtainDsq() { | |
| 75 | - List<Cars> carsList=carsRepository.findCars(); | |
| 76 | - Map<String, Boolean> carsMap=new HashMap<String, Boolean>(); | |
| 77 | - for (int i = 0; i < carsList.size(); i++) { | |
| 78 | - Cars c=carsList.get(i); | |
| 79 | - carsMap.put(c.getInsideCode(), c.getSfdc()); | |
| 80 | - } | |
| 74 | + public String obtainDsq() throws Exception{ | |
| 81 | 75 | String result = "failure"; |
| 82 | - SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd"); | |
| 83 | - Date dNow = new Date(); //当前时间 | |
| 84 | - Date dBefore = new Date(); | |
| 85 | - Calendar calendar = Calendar.getInstance(); //得到日历 | |
| 86 | - calendar.setTime(dNow);//把当前时间赋给日历 | |
| 87 | - calendar.add(Calendar.DAY_OF_MONTH, -1); //设置为前一天 | |
| 88 | - dBefore = calendar.getTime(); //得到前一天的时间 | |
| 89 | - String rq=sdf.format(dBefore); | |
| 90 | - //保留两位小数 | |
| 91 | - DecimalFormat df = new DecimalFormat("#.00"); | |
| 92 | - // TODO Auto-generated method stub | |
| 93 | - Map<String, Object> newMap=new HashMap<String,Object>(); | |
| 94 | - //当天YLB信息 | |
| 95 | - List<Ylb> ylList=repository.obtainYl(rq); | |
| 96 | - //当天YLXXB信息 | |
| 97 | -// List<Ylxxb> ylxxList=ylxxbRepository.obtainYlxx(rq); | |
| 98 | - //前一天所有车辆最后进场班次信息 | |
| 99 | - List<Ylb> ylListBe=repository.obtainYlbefore(rq); | |
| 100 | - List<Cyl> clyList=cylRepository.obtainCyl(); | |
| 101 | - //从排班表中计算出行驶的总里程 | |
| 102 | - List<Map<String,Object>> listpb=scheduleRealInfoService.yesterdayDataList("",rq); | |
| 103 | - | |
| 104 | - for(int x=0;x<listpb.size();x++){ | |
| 105 | - boolean sfdc=true; | |
| 106 | - Map<String, Object> map=listpb.get(x); | |
| 107 | - if (carsMap.get(map.get("clZbh").toString())!=null) { | |
| 108 | - sfdc= carsMap.get(map.get("clZbh").toString()); | |
| 109 | - }else{ | |
| 110 | - sfdc=true; | |
| 76 | + try { | |
| 77 | + List<Cars> carsList=carsRepository.findCars(); | |
| 78 | + Map<String, Boolean> carsMap=new HashMap<String, Boolean>(); | |
| 79 | + for (int i = 0; i < carsList.size(); i++) { | |
| 80 | + Cars c=carsList.get(i); | |
| 81 | + carsMap.put(c.getInsideCode(), c.getSfdc()); | |
| 111 | 82 | } |
| 112 | - if(!sfdc){ | |
| 113 | - //判断驾驶员驾驶的该车辆是否已经存入了(查出的结果集中日期是相同的,根据驾驶员、内部编号、线路编码判断) | |
| 114 | - Ylb t=new Ylb(); | |
| 115 | - for(int k=0;k<ylList.size();k++){ | |
| 116 | - Ylb t1=ylList.get(k); | |
| 117 | - if(t1.getNbbm().equals(map.get("clZbh").toString()) | |
| 118 | - &&t1.getJsy().equals(map.get("jGh").toString()) | |
| 119 | - &&t1.getXlbm().equals(map.get("xlBm").toString())) | |
| 120 | - { | |
| 121 | - t=t1; | |
| 122 | - } | |
| 83 | + SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd"); | |
| 84 | + Date dNow = new Date(); //当前时间 | |
| 85 | + Date dBefore = new Date(); | |
| 86 | + Calendar calendar = Calendar.getInstance(); //得到日历 | |
| 87 | + calendar.setTime(dNow);//把当前时间赋给日历 | |
| 88 | + calendar.add(Calendar.DAY_OF_MONTH, -1); //设置为前一天 | |
| 89 | + dBefore = calendar.getTime(); //得到前一天的时间 | |
| 90 | + String rq=sdf.format(dBefore); | |
| 91 | + //保留两位小数 | |
| 92 | + DecimalFormat df = new DecimalFormat("#.00"); | |
| 93 | + // TODO Auto-generated method stub | |
| 94 | + Map<String, Object> newMap=new HashMap<String,Object>(); | |
| 95 | + //当天YLB信息 | |
| 96 | + List<Ylb> ylList=repository.obtainYl(rq,"","","","","nbbm"); | |
| 97 | + //当天YLXXB信息 | |
| 98 | + // List<Ylxxb> ylxxList=ylxxbRepository.obtainYlxx(rq); | |
| 99 | + //前一天所有车辆最后进场班次信息 | |
| 100 | + List<Ylb> ylListBe=repository.obtainYlbefore(rq); | |
| 101 | + List<Cyl> clyList=cylRepository.obtainCyl("",""); | |
| 102 | + //从排班表中计算出行驶的总里程 | |
| 103 | + List<Map<String,Object>> listpb=scheduleRealInfoService.yesterdayDataList("",rq); | |
| 104 | + | |
| 105 | + for(int x=0;x<listpb.size();x++){ | |
| 106 | + boolean sfdc=true; | |
| 107 | + Map<String, Object> map=listpb.get(x); | |
| 108 | + if (carsMap.get(map.get("clZbh").toString())!=null) { | |
| 109 | + sfdc= carsMap.get(map.get("clZbh").toString()); | |
| 110 | + }else{ | |
| 111 | + sfdc=true; | |
| 123 | 112 | } |
| 124 | - try { | |
| 125 | - //当日的第一个班次,出场油量等于前一天的最后一个班次的进场油量 | |
| 126 | - if(map.get("seqNumber").toString().equals("1")){ | |
| 127 | - boolean fage=true; | |
| 128 | - for (int i = 0; i < ylListBe.size(); i++) { | |
| 129 | - Ylb ylb=ylListBe.get(i); | |
| 130 | - if(map.get("clZbh").toString().equals(ylb.getNbbm())){ | |
| 131 | - t.setCzyl(ylb.getJzyl()); | |
| 132 | - fage=false; | |
| 133 | - break; | |
| 134 | - } | |
| 113 | + if(!sfdc){ | |
| 114 | + //判断驾驶员驾驶的该车辆是否已经存入了(查出的结果集中日期是相同的,根据驾驶员、内部编号、线路编码判断) | |
| 115 | + Ylb t=new Ylb(); | |
| 116 | + for(int k=0;k<ylList.size();k++){ | |
| 117 | + Ylb t1=ylList.get(k); | |
| 118 | + if(t1.getNbbm().equals(map.get("clZbh").toString()) | |
| 119 | + &&t1.getJsy().equals(map.get("jGh").toString()) | |
| 120 | + &&t1.getXlbm().equals(map.get("xlBm").toString())) | |
| 121 | + { | |
| 122 | + t=t1; | |
| 135 | 123 | } |
| 136 | - if(fage){ | |
| 137 | - for (int y = 0; y < clyList.size(); y++) { | |
| 138 | - Cyl cyl=clyList.get(y); | |
| 139 | - if(map.get("clZbh").toString().equals(cyl.getNbbm())){ | |
| 140 | - t.setCzyl(cyl.getCyl()); | |
| 141 | - fage=false; | |
| 142 | - break; | |
| 124 | + } | |
| 125 | + | |
| 126 | + //当日的第一个班次,出场油量等于前一天的最后一个班次的进场油量 | |
| 127 | + if(map.get("seqNumber").toString().equals("1")){ | |
| 128 | + boolean fage=true; | |
| 129 | + for (int i = 0; i < ylListBe.size(); i++) { | |
| 130 | + Ylb ylb=ylListBe.get(i); | |
| 131 | + if(map.get("clZbh").toString().equals(ylb.getNbbm())){ | |
| 132 | + if(ylb.getJzyl()>0){ | |
| 133 | + t.setCzyl(ylb.getJzyl()); | |
| 134 | + fage=false; | |
| 135 | + break; | |
| 136 | + } | |
| 143 | 137 | } |
| 144 | 138 | } |
| 139 | + if(fage){ | |
| 140 | + for (int y = 0; y < clyList.size(); y++) { | |
| 141 | + Cyl cyl=clyList.get(y); | |
| 142 | + if(map.get("clZbh").toString().equals(cyl.getNbbm())){ | |
| 143 | + t.setCzyl(cyl.getCyl()); | |
| 144 | + fage=false; | |
| 145 | + break; | |
| 146 | + } | |
| 147 | + } | |
| 148 | + } | |
| 149 | + if(fage){ | |
| 150 | + t.setCzyl(0.0); | |
| 151 | + } | |
| 145 | 152 | } |
| 146 | - if(fage){ | |
| 147 | - t.setCzyl(0.0); | |
| 148 | - } | |
| 149 | - } | |
| 150 | - | |
| 151 | - /*Double jzl=0.0; | |
| 152 | - //把当天的YLXXB的加注量设置为当天YLB的加注量(根据车号,驾驶员判断) | |
| 153 | - for(int j=0;j<ylxxList.size();j++){ | |
| 154 | - Ylxxb ylxxb= ylxxList.get(j); | |
| 155 | - if(map.get("clZbh").toString().equals(ylxxb.getNbbm()) &&map.get("jGh").toString().equals(ylxxb.getJsy())){ | |
| 156 | - jzl+=ylxxb.getJzl(); | |
| 153 | + | |
| 154 | + /*Double jzl=0.0; | |
| 155 | + //把当天的YLXXB的加注量设置为当天YLB的加注量(根据车号,驾驶员判断) | |
| 156 | + for(int j=0;j<ylxxList.size();j++){ | |
| 157 | + Ylxxb ylxxb= ylxxList.get(j); | |
| 158 | + if(map.get("clZbh").toString().equals(ylxxb.getNbbm()) &&map.get("jGh").toString().equals(ylxxb.getJsy())){ | |
| 159 | + jzl+=ylxxb.getJzl(); | |
| 160 | + } | |
| 157 | 161 | } |
| 158 | - } | |
| 159 | - t.setJzl(jzl);*/ | |
| 160 | - t.setNbbm(map.get("clZbh").toString()); | |
| 161 | - t.setJsy(map.get("jGh")==null?"":map.get("jGh").toString()); | |
| 162 | - t.setZlc(map.get("totalKilometers")==null?0.0:Double.parseDouble(df.format(Double.parseDouble(map.get("totalKilometers").toString())))); | |
| 163 | - t.setXlbm(map.get("xlBm")==null?"":map.get("xlBm").toString()); | |
| 164 | - t.setJcsx(Integer.parseInt(map.get("seqNumber").toString())); | |
| 165 | - t.setSsgsdm(map.get("company")==null?"":map.get("company").toString()); | |
| 166 | - t.setFgsdm(map.get("bCompany")==null?"":map.get("bCompany").toString()); | |
| 167 | - t.setRq(sdf.parse(rq)); | |
| 168 | - repository.save(t); | |
| 169 | - result = "success"; | |
| 170 | - } catch (Exception e) { | |
| 171 | - // TODO Auto-generated catch block | |
| 172 | - e.printStackTrace(); | |
| 173 | - }finally{ | |
| 174 | - logger.info("setDDRB:"+result); | |
| 175 | - } | |
| 162 | + t.setJzl(jzl);*/ | |
| 163 | + t.setNbbm(map.get("clZbh").toString()); | |
| 164 | + t.setJsy(map.get("jGh")==null?"":map.get("jGh").toString()); | |
| 165 | + t.setZlc(map.get("totalKilometers")==null?0.0:Double.parseDouble(df.format(Double.parseDouble(map.get("totalKilometers").toString())))); | |
| 166 | + t.setXlbm(map.get("xlBm")==null?"":map.get("xlBm").toString()); | |
| 167 | + t.setJcsx(Integer.parseInt(map.get("seqNumber").toString())); | |
| 168 | + t.setSsgsdm(map.get("company")==null?"":map.get("company").toString()); | |
| 169 | + t.setFgsdm(map.get("bCompany")==null?"":map.get("bCompany").toString()); | |
| 170 | + t.setRq(sdf.parse(rq)); | |
| 171 | + repository.save(t); | |
| 172 | + | |
| 176 | 173 | } |
| 174 | + result = "success"; | |
| 175 | + } | |
| 176 | + }catch (Exception e) { | |
| 177 | + // TODO Auto-generated catch block | |
| 178 | + throw e; | |
| 179 | + }finally{ | |
| 180 | + logger.info("setDDRB:"+result); | |
| 177 | 181 | } |
| 178 | 182 | |
| 179 | 183 | return result; |
| ... | ... | @@ -185,129 +189,152 @@ public class YlbServiceImpl extends BaseServiceImpl<Ylb,Integer> implements YlbS |
| 185 | 189 | */ |
| 186 | 190 | @Transactional |
| 187 | 191 | @Override |
| 188 | - public Map<String, Object> obtain(Map<String, Object> map2) { | |
| 189 | - List<Cars> carsList=carsRepository.findCars(); | |
| 190 | - Map<String, Boolean> carsMap=new HashMap<String, Boolean>(); | |
| 191 | - for (int i = 0; i < carsList.size(); i++) { | |
| 192 | - Cars c=carsList.get(i); | |
| 193 | - carsMap.put(c.getInsideCode(), c.getSfdc()); | |
| 194 | - } | |
| 195 | - String rq=map2.get("rq").toString(); | |
| 196 | - String line=""; | |
| 197 | - if(map2.get("xlbm_eq")!=null){ | |
| 198 | - line=map2.get("xlbm_eq").toString(); | |
| 199 | - } | |
| 200 | - | |
| 201 | - SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd"); | |
| 202 | - //保留两位小数 | |
| 203 | - DecimalFormat df = new DecimalFormat("#.00"); | |
| 204 | - // TODO Auto-generated method stub | |
| 205 | - Map<String, Object> newMap=new HashMap<String,Object>(); | |
| 206 | - //当天YLB信息 | |
| 207 | - List<Ylb> ylList=repository.obtainYl(rq); | |
| 208 | - //当天YLXXB信息 | |
| 209 | - List<Ylxxb> ylxxList=ylxxbRepository.obtainYlxx(rq,0); | |
| 210 | - //前一天所有车辆最后进场班次信息 | |
| 211 | - List<Ylb> ylListBe=repository.obtainYlbefore(rq); | |
| 212 | - List<Cyl> clyList=cylRepository.obtainCyl(); | |
| 213 | - //从排班表中计算出行驶的总里程 | |
| 214 | - List<Map<String,Object>> listpb=scheduleRealInfoService.yesterdayDataList(line,rq); | |
| 215 | - List<Ylb> addList=new ArrayList<Ylb>(); | |
| 216 | - List<Ylb> updateList=new ArrayList<Ylb>(); | |
| 217 | - for(int x=0;x<listpb.size();x++){ | |
| 218 | - String type="add"; | |
| 219 | - boolean sfdc=true; | |
| 220 | - Map<String, Object> map=listpb.get(x); | |
| 221 | - if (carsMap.get(map.get("clZbh").toString())!=null) { | |
| 222 | - sfdc= carsMap.get(map.get("clZbh").toString()); | |
| 223 | - }else{ | |
| 224 | - sfdc=true; | |
| 192 | + public Map<String, Object> obtain(Map<String, Object> map2) throws Exception{ | |
| 193 | + Map<String, Object> newMap = new HashMap<String, Object>(); | |
| 194 | + try { | |
| 195 | + List<Cars> carsList = carsRepository.findCars(); | |
| 196 | + Map<String, Boolean> carsMap = new HashMap<String, Boolean>(); | |
| 197 | + for (int i = 0; i < carsList.size(); i++) { | |
| 198 | + Cars c = carsList.get(i); | |
| 199 | + carsMap.put(c.getInsideCode(), c.getSfdc()); | |
| 225 | 200 | } |
| 226 | - if(!sfdc){ | |
| 227 | - //判断驾驶员驾驶的该车辆是否已经存入了(查出的结果集中日期是相同的,根据驾驶员、内部编号、线路编码判断) | |
| 228 | - Ylb t=new Ylb(); | |
| 229 | - for(int k=0;k<ylList.size();k++){ | |
| 230 | - Ylb t1=ylList.get(k); | |
| 231 | - if(t1.getNbbm().equals(map.get("clZbh").toString()) | |
| 232 | - &&t1.getJsy().equals(map.get("jGh").toString()) | |
| 233 | - &&t1.getXlbm().equals(map.get("xlBm").toString())) | |
| 234 | - { | |
| 235 | - t=t1; | |
| 236 | - type="update"; | |
| 237 | - } | |
| 201 | + String rq = map2.get("rq").toString(); | |
| 202 | + String line = ""; | |
| 203 | + if (map2.get("xlbm_like") != null) { | |
| 204 | + line = map2.get("xlbm_like").toString().trim(); | |
| 205 | + } | |
| 206 | + String gsbm=""; | |
| 207 | + if(map2.get("ssgsdm_like")!=null){ | |
| 208 | + gsbm=map2.get("ssgsdm_like").toString(); | |
| 209 | + } | |
| 210 | + String fgsbm=""; | |
| 211 | + if(map2.get("fgsdm_like")!=null){ | |
| 212 | + fgsbm=map2.get("fgsdm_like").toString(); | |
| 213 | + } | |
| 214 | + String nbbm=""; | |
| 215 | + if(map2.get("nbbm_eq")!=null){ | |
| 216 | + nbbm=map2.get("nbbm_eq").toString(); | |
| 217 | + } | |
| 218 | + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); | |
| 219 | + // 保留两位小数 | |
| 220 | + DecimalFormat df = new DecimalFormat("#.00"); | |
| 221 | + // TODO Auto-generated method stub | |
| 222 | + // 当天YLB信息 | |
| 223 | + List<Ylb> ylList = repository.obtainYl(rq,gsbm,fgsbm,line,nbbm,"nbbm"); | |
| 224 | + // 当天YLXXB信息 | |
| 225 | + List<Ylxxb> ylxxList = ylxxbRepository.obtainYlxx(rq, 0); | |
| 226 | + // 前一天所有车辆最后进场班次信息 | |
| 227 | + List<Ylb> ylListBe = repository.obtainYlbefore(rq); | |
| 228 | + List<Cyl> clyList = cylRepository.obtainCyl(nbbm,gsbm); | |
| 229 | + // 从排班表中计算出行驶的总里程 | |
| 230 | + List<Map<String, Object>> listpb = scheduleRealInfoService.yesterdayDataList(line, rq); | |
| 231 | + List<Ylb> addList = new ArrayList<Ylb>(); | |
| 232 | + List<Ylb> updateList = new ArrayList<Ylb>(); | |
| 233 | + for (int x = 0; x < listpb.size(); x++) { | |
| 234 | + String type = "add"; | |
| 235 | + boolean sfdc = true; | |
| 236 | + Map<String, Object> map = listpb.get(x); | |
| 237 | + if (carsMap.get(map.get("clZbh").toString()) != null) { | |
| 238 | + sfdc = carsMap.get(map.get("clZbh").toString()); | |
| 239 | + } else { | |
| 240 | + sfdc = true; | |
| 238 | 241 | } |
| 239 | - try { | |
| 240 | - //当日的第一个班次,出场油量等于前一天的最后一个班次的进场油量 | |
| 241 | - if(map.get("seqNumber").toString().equals("1")){ | |
| 242 | - boolean fage=true; | |
| 242 | + if (!sfdc) { | |
| 243 | + // 判断驾驶员驾驶的该车辆是否已经存入了(查出的结果集中日期是相同的,根据驾驶员、内部编号、线路编码判断) | |
| 244 | + Ylb t = new Ylb(); | |
| 245 | + for (int k = 0; k < ylList.size(); k++) { | |
| 246 | + Ylb t1 = ylList.get(k); | |
| 247 | + if (t1.getNbbm().equals(map.get("clZbh").toString()) | |
| 248 | + && t1.getJsy().equals(map.get("jGh").toString()) | |
| 249 | + && t1.getXlbm().equals(map.get("xlBm").toString())) { | |
| 250 | + t = t1; | |
| 251 | + type = "update"; | |
| 252 | + } | |
| 253 | + } | |
| 254 | + | |
| 255 | + // 当日的第一个班次,出场油量等于前一天的最后一个班次的进场油量 | |
| 256 | + if (map.get("seqNumber").toString().equals("1")) { | |
| 257 | + boolean fage = true; | |
| 243 | 258 | for (int i = 0; i < ylListBe.size(); i++) { |
| 244 | - Ylb ylb=ylListBe.get(i); | |
| 245 | - if(map.get("clZbh").toString().equals(ylb.getNbbm())){ | |
| 246 | - t.setCzyl(ylb.getJzyl()); | |
| 247 | - fage=false; | |
| 248 | - break; | |
| 259 | + Ylb ylb = ylListBe.get(i); | |
| 260 | + if (map.get("clZbh").toString().equals(ylb.getNbbm())) { | |
| 261 | + if(ylb.getJzyl()>0){ | |
| 262 | + t.setCzyl(ylb.getJzyl()); | |
| 263 | + fage = false; | |
| 264 | + break; | |
| 265 | + } | |
| 266 | + | |
| 249 | 267 | } |
| 250 | 268 | } |
| 251 | - if(fage){ | |
| 269 | + if (fage) { | |
| 252 | 270 | for (int y = 0; y < clyList.size(); y++) { |
| 253 | - Cyl cyl=clyList.get(y); | |
| 254 | - if(map.get("clZbh").toString().equals(cyl.getNbbm())){ | |
| 255 | - t.setCzyl(cyl.getCyl()); | |
| 256 | - fage=false; | |
| 257 | - break; | |
| 271 | + Cyl cyl = clyList.get(y); | |
| 272 | + if (map.get("clZbh").toString().equals(cyl.getNbbm())) { | |
| 273 | + if(cyl.getCyl()>0){ | |
| 274 | + t.setCzyl(cyl.getCyl()); | |
| 275 | + fage = false; | |
| 276 | + break; | |
| 277 | + }else { | |
| 278 | + if(cyl.getCxrl()!=null){ | |
| 279 | + if(cyl.getCxrl()>0){ | |
| 280 | + t.setCzyl(cyl.getCxrl()); | |
| 281 | + fage = false; | |
| 282 | + break; | |
| 283 | + } | |
| 284 | + } | |
| 285 | + | |
| 286 | + } | |
| 287 | + | |
| 258 | 288 | } |
| 259 | 289 | } |
| 260 | 290 | } |
| 261 | - if(fage){ | |
| 291 | + if (fage) { | |
| 262 | 292 | t.setCzyl(0.0); |
| 263 | 293 | } |
| 264 | 294 | } |
| 265 | - | |
| 266 | - Double jzl=0.0; | |
| 267 | - //把当天的YLXXB的加注量设置为当天YLB的加注量(根据车号,驾驶员判断) | |
| 268 | - for(int j=0;j<ylxxList.size();j++){ | |
| 269 | - Ylxxb ylxxb= ylxxList.get(j); | |
| 270 | - if(map.get("clZbh").toString().equals(ylxxb.getNbbm()) &&map.get("jGh").toString().equals(ylxxb.getJsy())){ | |
| 271 | - jzl+=ylxxb.getJzl(); | |
| 295 | + | |
| 296 | + Double jzl = 0.0; | |
| 297 | + // 把当天的YLXXB的加注量设置为当天YLB的加注量(根据车号,驾驶员判断) | |
| 298 | + for (int j = 0; j < ylxxList.size(); j++) { | |
| 299 | + Ylxxb ylxxb = ylxxList.get(j); | |
| 300 | + if (map.get("clZbh").toString().equals(ylxxb.getNbbm()) | |
| 301 | + && map.get("jGh").toString().equals(ylxxb.getJsy())) { | |
| 302 | + jzl += ylxxb.getJzl(); | |
| 272 | 303 | } |
| 273 | 304 | } |
| 274 | 305 | t.setJzl(jzl); |
| 275 | 306 | t.setNbbm(map.get("clZbh").toString()); |
| 276 | - t.setJsy(map.get("jGh")==null?"":map.get("jGh").toString()); | |
| 277 | - t.setZlc(map.get("totalKilometers")==null?0.0:Double.parseDouble(df.format(Double.parseDouble(map.get("totalKilometers").toString())))); | |
| 278 | - t.setXlbm(map.get("xlBm")==null?"":map.get("xlBm").toString()); | |
| 307 | + t.setJsy(map.get("jGh") == null ? "" : map.get("jGh").toString()); | |
| 308 | + t.setZlc(map.get("totalKilometers") == null ? 0.0 | |
| 309 | + : Double.parseDouble(df.format(Double.parseDouble(map.get("totalKilometers").toString())))); | |
| 310 | + t.setXlbm(map.get("xlBm") == null ? "" : map.get("xlBm").toString()); | |
| 279 | 311 | t.setJcsx(Integer.parseInt(map.get("seqNumber").toString())); |
| 280 | - t.setSsgsdm(map.get("company")==null?"":map.get("company").toString()); | |
| 281 | - t.setFgsdm(map.get("bCompany")==null?"":map.get("bCompany").toString()); | |
| 312 | + t.setSsgsdm(map.get("company") == null ? "" : map.get("company").toString()); | |
| 313 | + t.setFgsdm(map.get("bCompany") == null ? "" : map.get("bCompany").toString()); | |
| 282 | 314 | t.setRq(sdf.parse(rq)); |
| 283 | - /*if(type.equals("add")){ | |
| 284 | - addList.add(t); | |
| 285 | - }else{ | |
| 286 | - updateList.add(t); | |
| 287 | - }*/ | |
| 315 | + /* | |
| 316 | + * if(type.equals("add")){ addList.add(t); }else{ | |
| 317 | + * updateList.add(t); } | |
| 318 | + */ | |
| 288 | 319 | repository.save(t); |
| 289 | 320 | newMap.put("status", ResponseCode.SUCCESS); |
| 290 | - } catch (ParseException e) { | |
| 291 | - // TODO Auto-generated catch block | |
| 292 | - newMap.put("status", ResponseCode.ERROR); | |
| 293 | - e.printStackTrace(); | |
| 321 | + | |
| 294 | 322 | } |
| 295 | 323 | } |
| 296 | - } | |
| 297 | - /* try { | |
| 298 | - if(addList.size()>0){ | |
| 299 | - new BatchSaveUtils<Ylb>().saveList(addList, Ylb.class); | |
| 300 | - } | |
| 301 | - | |
| 302 | - if(updateList.size()>0){ | |
| 303 | - | |
| 304 | - } | |
| 305 | - newMap.put("status", ResponseCode.SUCCESS); | |
| 306 | - } | |
| 307 | - catch (Exception e) { | |
| 308 | - // TODO: handle exception | |
| 324 | + } catch (ParseException e) { | |
| 325 | + // TODO Auto-generated catch block | |
| 309 | 326 | newMap.put("status", ResponseCode.ERROR); |
| 310 | - }*/ | |
| 327 | + throw e; | |
| 328 | + } | |
| 329 | + /* | |
| 330 | + * try { if(addList.size()>0){ new | |
| 331 | + * BatchSaveUtils<Ylb>().saveList(addList, Ylb.class); } | |
| 332 | + * | |
| 333 | + * if(updateList.size()>0){ | |
| 334 | + * | |
| 335 | + * } newMap.put("status", ResponseCode.SUCCESS); } catch (Exception e) { | |
| 336 | + * // TODO: handle exception newMap.put("status", ResponseCode.ERROR); } | |
| 337 | + */ | |
| 311 | 338 | return newMap; |
| 312 | 339 | } |
| 313 | 340 | |
| ... | ... | @@ -317,104 +344,121 @@ public class YlbServiceImpl extends BaseServiceImpl<Ylb,Integer> implements YlbS |
| 317 | 344 | */ |
| 318 | 345 | @Transactional |
| 319 | 346 | @Override |
| 320 | - public Map<String, Object> outAndIn(Map<String, Object> map){ | |
| 347 | + public Map<String, Object> outAndIn(Map<String, Object> map) throws Exception{ | |
| 321 | 348 | // TODO Auto-generated method stub |
| 349 | + String xlbm=""; | |
| 350 | + if(map.get("xlbm_like")!=null){ | |
| 351 | + xlbm= map.get("xlbm_like").toString().trim(); | |
| 352 | + } | |
| 353 | + String gsbm=""; | |
| 354 | + if(map.get("ssgsdm_like")!=null){ | |
| 355 | + gsbm=map.get("ssgsdm_like").toString(); | |
| 356 | + } | |
| 357 | + String fgsbm=""; | |
| 358 | + if(map.get("fgsdm_like")!=null){ | |
| 359 | + fgsbm=map.get("fgsdm_like").toString(); | |
| 360 | + } | |
| 361 | + String rq = map.get("rq").toString(); | |
| 362 | + String nbbm=""; | |
| 363 | + if(map.get("nbbm_eq")!=null){ | |
| 364 | + nbbm=map.get("nbbm_eq").toString(); | |
| 365 | + } | |
| 366 | + | |
| 322 | 367 | Map<String, Object> newMap=new HashMap<String,Object>(); |
| 323 | 368 | Map<String, Object> map2=new HashMap<String,Object>(); |
| 324 | - String rq=map.get("rq").toString(); | |
| 325 | - SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd"); | |
| 326 | - | |
| 327 | 369 | try { |
| 370 | + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); | |
| 371 | + | |
| 328 | 372 | map.put("rq_eq", sdf.parse(rq)); |
| 329 | - } catch (ParseException e1) { | |
| 330 | - // TODO Auto-generated catch block | |
| 331 | - e1.printStackTrace(); | |
| 332 | - } | |
| 333 | - //获取车辆存油信息 | |
| 334 | - List<Cyl> cylList=cylRepository.findAll(new CustomerSpecs<Cyl>(newMap)); | |
| 335 | - //指定日期YLB信息 | |
| 336 | - Iterator<Ylb> iterator= repository.findAll(new CustomerSpecs<Ylb>(map)).iterator(); | |
| 337 | - while(iterator.hasNext()){ | |
| 338 | - Ylb ylb=iterator.next(); | |
| 339 | - //判断是否已经计算过 | |
| 340 | - if(newMap.get("nbbm"+ylb.getNbbm())==null){ | |
| 341 | - String nbbm_eq=ylb.getNbbm(); | |
| 342 | - Date rq_eq=ylb.getRq(); | |
| 343 | - //得到一天总的加油和里程(根据车,时间) | |
| 344 | - List<Object[]> sumList=repository.sumLcYl(nbbm_eq, rq_eq); | |
| 345 | - //保存总的加油量 | |
| 346 | - Double jzl=Double.valueOf(sumList.get(0)[0].toString()); | |
| 347 | - //保存总的里程 | |
| 348 | - Double zlc=Double.valueOf(sumList.get(0)[1].toString()); | |
| 349 | - //保留两位小数 | |
| 350 | - DecimalFormat df = new DecimalFormat("#.00"); | |
| 351 | - Double zyl=0.0; | |
| 352 | - Double nextJzyl=0.0; | |
| 373 | +// List<Cyl> clyList = cylRepository.obtainCyl(); | |
| 374 | + // 获取车辆存油信息 | |
| 375 | + List<Cyl> cylList = cylRepository.obtainCyl(nbbm,gsbm); | |
| 376 | + // 指定日期YLB信息 | |
| 377 | + List<Ylb> ylbList =repository.obtainYl(rq,gsbm,fgsbm,xlbm,nbbm,"nbbm"); | |
| 378 | + List<Ylb> iterator2=repository.obtainYl(rq,gsbm,fgsbm,xlbm,nbbm,"jcsx"); | |
| 379 | + for (int i=0;i<ylbList.size();i++) { | |
| 380 | + Ylb ylb = ylbList.get(i); | |
| 381 | + // 判断是否已经计算过 | |
| 382 | + if (newMap.get("nbbm" + ylb.getNbbm()) == null) { | |
| 383 | + String nbbm_eq = ylb.getNbbm(); | |
| 384 | + Date rq_eq = ylb.getRq(); | |
| 385 | + // 得到一天总的加油和里程(根据车,时间) | |
| 386 | + List<Object[]> sumList = repository.sumLcYl(nbbm_eq, rq_eq); | |
| 387 | + // 保存总的加油量 | |
| 388 | + Double jzl = Double.valueOf(sumList.get(0)[0].toString()); | |
| 389 | + // 保存总的里程 | |
| 390 | + Double zlc = Double.valueOf(sumList.get(0)[1].toString()); | |
| 353 | 391 | |
| 354 | - //保存已经计算过的车辆,相同车辆编号的车不在计算 | |
| 355 | - newMap.put("nbbm"+ylb.getNbbm(), ylb.getNbbm()); | |
| 392 | + Double zsh = Double.valueOf(sumList.get(0)[2].toString()); | |
| 356 | 393 | |
| 357 | - //查询指定车辆,设置进、存、耗油量 | |
| 394 | + jzl=jzl-zsh; | |
| 395 | + // 保留两位小数 | |
| 396 | + DecimalFormat df = new DecimalFormat("#.00"); | |
| 397 | + Double zyl = 0.0; | |
| 398 | + Double nextJzyl = 0.0; | |
| 399 | + // 保存已经计算过的车辆,相同车辆编号的车不在计算 | |
| 400 | + newMap.put("nbbm" + ylb.getNbbm(), ylb.getNbbm()); | |
| 401 | + | |
| 402 | + // 查询指定车辆,设置进、存、耗油量 | |
| 358 | 403 | map.remove("nbbm_eq"); |
| 359 | 404 | map.put("nbbm_eq", ylb.getNbbm()); |
| 360 | - Iterator<Ylb> iterator2= repository.findAll(new CustomerSpecs<Ylb>(map),new Sort(Direction.ASC, "jcsx")).iterator(); | |
| 361 | - while(iterator2.hasNext()){ | |
| 362 | - try{ | |
| 363 | - Ylb t = iterator2.next(); | |
| 364 | - if(t.getJcsx()==1){ | |
| 365 | - //进场等于出场的操作 既 最后进场存油量等于第一次的出场存油量 | |
| 366 | - Double yl=t.getCzyl(); | |
| 367 | - Double jcyl=t.getCzyl(); | |
| 368 | - zyl=jcyl+jzl-yl; | |
| 369 | - Double yh=Double.parseDouble(df.format(zyl*(t.getZlc()/zlc))); | |
| 405 | + map.put("xlbm_like", ylb.getXlbm()); | |
| 406 | +// Iterator<Ylb> iterator2 = repository | |
| 407 | +// .findAll(new CustomerSpecs<Ylb>(map), new Sort(Direction.ASC, "jcsx")).iterator(); | |
| 408 | + for (int j = 0; j < iterator2.size(); j++) { | |
| 409 | + | |
| 410 | + Ylb t = iterator2.get(j); | |
| 411 | + if(t.getNbbm().equals(ylb.getNbbm())){ | |
| 412 | + if (t.getJcsx() == 1) { | |
| 413 | + // 进场等于出场的操作 既 最后进场存油量等于第一次的出场存油量 | |
| 414 | + Double yl = t.getCzyl(); | |
| 415 | + Double jcyl = t.getCzyl(); | |
| 416 | + zyl = jcyl + jzl - yl; | |
| 417 | + Double yh = Double.parseDouble(df.format(zyl * (t.getZlc() / zlc))); | |
| 370 | 418 | t.setYh(yh); |
| 371 | - nextJzyl=t.getJzl()+t.getCzyl()-yh; | |
| 419 | + nextJzyl = t.getJzl() + t.getCzyl() - yh; | |
| 372 | 420 | t.setJzyl(Double.parseDouble(df.format(nextJzyl))); |
| 373 | - }else{ | |
| 421 | + } else { | |
| 374 | 422 | t.setCzyl(Double.parseDouble(df.format(nextJzyl))); |
| 375 | - Double yh=Double.parseDouble(df.format(zyl*(t.getZlc()/zlc))); | |
| 423 | + Double yh = Double.parseDouble(df.format(zyl * (t.getZlc() / zlc))); | |
| 376 | 424 | t.setYh(yh); |
| 377 | - nextJzyl=t.getJzl()+nextJzyl-yh; | |
| 425 | + nextJzyl = t.getJzl() + nextJzyl - yh; | |
| 378 | 426 | t.setJzyl(Double.parseDouble(df.format(nextJzyl))); |
| 379 | 427 | } |
| 380 | - | |
| 381 | 428 | repository.save(t); |
| 382 | - //设置存油量 | |
| 383 | - Cyl cyl=null; | |
| 384 | - boolean fage=false; | |
| 385 | - for(int z=0;z<cylList.size();z++){ | |
| 386 | - cyl=cylList.get(z); | |
| 387 | - if(t.getNbbm().equals(cyl.getNbbm())){ | |
| 388 | - cyl.setCyl(t.getJzyl()); | |
| 389 | - cyl.setUpdatetime(t.getRq()); | |
| 390 | - fage=true; | |
| 391 | - break; | |
| 392 | - } | |
| 393 | - } | |
| 394 | - | |
| 395 | - if(fage){ | |
| 396 | - cylRepository.save(cyl); | |
| 397 | - }else{ | |
| 398 | - cyl=new Cyl(); | |
| 399 | - cyl.setNbbm(t.getNbbm()); | |
| 429 | + } | |
| 430 | + | |
| 431 | + // 设置存油量 | |
| 432 | + Cyl cyl = null; | |
| 433 | + boolean fage = false; | |
| 434 | + for (int z = 0; z < cylList.size(); z++) { | |
| 435 | + cyl = cylList.get(z); | |
| 436 | + if (t.getNbbm().equals(cyl.getNbbm())) { | |
| 400 | 437 | cyl.setCyl(t.getJzyl()); |
| 401 | - cyl.setGsdm(t.getSsgsdm()); | |
| 402 | 438 | cyl.setUpdatetime(t.getRq()); |
| 403 | - cylRepository.save(cyl); | |
| 439 | + fage = true; | |
| 440 | + break; | |
| 404 | 441 | } |
| 405 | - | |
| 406 | - | |
| 407 | - map2.put("status", ResponseCode.SUCCESS); | |
| 408 | - }catch(Exception e){ | |
| 409 | - map2.put("status", ResponseCode.ERROR); | |
| 410 | - logger.error("save erro.", e); | |
| 411 | 442 | } |
| 443 | + if (fage) { | |
| 444 | + cylRepository.save(cyl); | |
| 445 | + } else { | |
| 446 | + cyl = new Cyl(); | |
| 447 | + cyl.setNbbm(t.getNbbm()); | |
| 448 | + cyl.setCyl(t.getJzyl()); | |
| 449 | + cyl.setGsdm(t.getSsgsdm()); | |
| 450 | + cyl.setUpdatetime(t.getRq()); | |
| 451 | + cylRepository.save(cyl); | |
| 452 | + } | |
| 453 | + map2.put("status", ResponseCode.SUCCESS); | |
| 412 | 454 | } |
| 413 | - | |
| 414 | - | |
| 415 | 455 | } |
| 456 | + } | |
| 457 | + } catch (Exception e) { | |
| 458 | + map2.put("status", ResponseCode.ERROR); | |
| 459 | + logger.error("save erro.", e); | |
| 460 | + throw e; | |
| 416 | 461 | } |
| 417 | - | |
| 418 | 462 | return map2; |
| 419 | 463 | } |
| 420 | 464 | |
| ... | ... | @@ -426,82 +470,107 @@ public class YlbServiceImpl extends BaseServiceImpl<Ylb,Integer> implements YlbS |
| 426 | 470 | public Map<String, Object> sort(Map<String, Object> map) { |
| 427 | 471 | // TODO Auto-generated method stub |
| 428 | 472 | Map<String, Object> newMap = new HashMap<String, Object>(); |
| 429 | - //获取车辆存油信息 | |
| 430 | - List<Cyl> cylList=cylRepository.findAll(new CustomerSpecs<Cyl>(newMap)); | |
| 431 | - int id=Integer.parseInt(map.get("id").toString()); | |
| 432 | - //最后存油量 | |
| 433 | - Double yl=Double.parseDouble(map.get("jzyl").toString()); | |
| 434 | - Ylb ylb=repository.findOne(id); | |
| 435 | - String nbbm_eq=ylb.getNbbm(); | |
| 436 | - Date rq_eq=ylb.getRq(); | |
| 437 | - //得到一天总的加油和里程(根据车,时间) | |
| 438 | - List<Object[]> sumList=repository.sumLcYl(nbbm_eq, rq_eq); | |
| 439 | - //保存总的加油量 | |
| 440 | - Double jzl=Double.valueOf(sumList.get(0)[0].toString()); | |
| 441 | - //保存总的里程 | |
| 442 | - Double zlc=Double.valueOf(sumList.get(0)[1].toString()); | |
| 443 | - map.put("nbbm_eq", nbbm_eq); | |
| 444 | - map.put("rq_eq",rq_eq); | |
| 445 | - Iterator<Ylb> iterator= repository.findAll(new CustomerSpecs<Ylb>(map),new Sort(Direction.ASC, "jcsx")).iterator(); | |
| 446 | - //根据jcyl排序1为该车当日第一个出场,出场油量为前一天的存油 | |
| 447 | - //保留两位小数 | |
| 448 | - DecimalFormat df = new DecimalFormat("#.00"); | |
| 449 | - Double zyl=0.0; | |
| 450 | - Double nextJzyl=0.0; | |
| 451 | - //车的,进,出油量及耗油 | |
| 452 | - while(iterator.hasNext()){ | |
| 453 | - try{ | |
| 454 | - Ylb t = iterator.next(); | |
| 455 | - if(t.getJcsx()==1){ | |
| 456 | - Double jcyl=t.getCzyl(); | |
| 457 | - zyl=jcyl+jzl-yl; | |
| 458 | - Double yh=0.0; | |
| 459 | - if(zlc>0&&t.getZlc()>0){ | |
| 460 | - yh=Double.parseDouble(df.format(zyl*(t.getZlc()/zlc))); | |
| 473 | + SimpleDateFormat sdf =new SimpleDateFormat("yyyy-MM-dd"); | |
| 474 | + try { | |
| 475 | + // 获取车辆存油信息 | |
| 476 | + List<Cyl> cylList = cylRepository.findAll(new CustomerSpecs<Cyl>(newMap)); | |
| 477 | + int id = Integer.parseInt(map.get("id").toString()); | |
| 478 | + // 最后存油量 | |
| 479 | + Double yl = Double.parseDouble(map.get("jzyl").toString()); | |
| 480 | + Double sh= Double.parseDouble(map.get("sh").toString()); | |
| 481 | + String shyy=map.get("shyy").toString(); | |
| 482 | + Ylb ylb = repository.findOne(id); | |
| 483 | + | |
| 484 | + String nbbm_eq = ylb.getNbbm(); | |
| 485 | + Date rq_eq = ylb.getRq(); | |
| 486 | + // 得到一天总的加油和里程(根据车,时间) | |
| 487 | + List<Object[]> sumList = repository.sumLcYl(nbbm_eq, rq_eq); | |
| 488 | + // 保存总的加油量 | |
| 489 | + Double jzl = Double.valueOf(sumList.get(0)[0].toString()); | |
| 490 | + // 保存总的里程 | |
| 491 | + Double zlc = Double.valueOf(sumList.get(0)[1].toString()); | |
| 492 | + // 保存总的损耗 | |
| 493 | + Double zsh = Double.valueOf(sumList.get(0)[2].toString()); | |
| 494 | + | |
| 495 | + //新的 损耗不等于 旧的损耗 总损耗从新算 | |
| 496 | + if(ylb.getSh() - sh >0.0000001 || ylb.getSh()-sh <0.00000001){ | |
| 497 | + zsh =zsh-ylb.getSh()+sh; | |
| 498 | + jzl =jzl-zsh; | |
| 499 | + }else{ | |
| 500 | + jzl=jzl-zsh; | |
| 501 | + } | |
| 502 | + map.put("nbbm_eq", nbbm_eq); | |
| 503 | + map.put("rq_eq", rq_eq); | |
| 504 | + List<Ylb> iterator2=repository.obtainYl(sdf.format(rq_eq),ylb.getSsgsdm(),ylb.getFgsdm(),ylb.getXlbm(), | |
| 505 | + ylb.getNbbm(),"jcsx"); | |
| 506 | +// Iterator<Ylb> iterator = repository.findAll(new CustomerSpecs<Ylb>(map), new Sort(Direction.ASC, "jcsx")) | |
| 507 | +// .iterator(); | |
| 508 | + // 根据jcyl排序1为该车当日第一个出场,出场油量为前一天的存油 | |
| 509 | + // 保留两位小数 | |
| 510 | + DecimalFormat df = new DecimalFormat("#.00"); | |
| 511 | + Double zyl = 0.0; | |
| 512 | + Double nextJzyl = 0.0; | |
| 513 | + // 车的,进,出油量及耗油 | |
| 514 | + for (int i = 0; i < iterator2.size(); i++) { | |
| 515 | + Ylb t = iterator2.get(i); | |
| 516 | + if (t.getJcsx() == 1) { | |
| 517 | + if(t.getId()==id){ | |
| 518 | + t.setSh(sh); | |
| 519 | + t.setShyy(shyy); | |
| 520 | + } | |
| 521 | + Double jcyl = t.getCzyl(); | |
| 522 | + zyl = jcyl + jzl - yl; | |
| 523 | + Double yh = 0.0; | |
| 524 | + if (zlc > 0 && t.getZlc() > 0) { | |
| 525 | + yh = Double.parseDouble(df.format(zyl * (t.getZlc() / zlc))); | |
| 461 | 526 | } |
| 462 | 527 | t.setYh(yh); |
| 463 | - nextJzyl=t.getJzl()+t.getCzyl()-yh; | |
| 528 | + nextJzyl = t.getJzl() + t.getCzyl() - yh-t.getSh(); | |
| 464 | 529 | t.setJzyl(Double.parseDouble(df.format(nextJzyl))); |
| 465 | - }else{ | |
| 466 | - if(t.getZlc()!=0){ | |
| 530 | + } else { | |
| 531 | + if(t.getId()==id){ | |
| 532 | + t.setSh(sh); | |
| 533 | + t.setShyy(shyy); | |
| 534 | + } | |
| 535 | + if (t.getZlc() != 0) { | |
| 467 | 536 | t.setCzyl(Double.parseDouble(df.format(nextJzyl))); |
| 468 | - Double yh=Double.parseDouble(df.format(zyl*(t.getZlc()/zlc))); | |
| 537 | + Double yh = Double.parseDouble(df.format(zyl * (t.getZlc() / zlc))); | |
| 469 | 538 | t.setYh(yh); |
| 470 | - nextJzyl=t.getJzl()+nextJzyl-yh; | |
| 539 | + nextJzyl = t.getJzl() + nextJzyl - yh-t.getSh(); | |
| 471 | 540 | t.setJzyl(Double.parseDouble(df.format(nextJzyl))); |
| 472 | 541 | } |
| 473 | - | |
| 542 | + | |
| 474 | 543 | } |
| 475 | 544 | repository.save(t); |
| 476 | - | |
| 477 | - //设置存油量 | |
| 478 | - Cyl cyl=null; | |
| 479 | - boolean fage=false; | |
| 480 | - for(int z=0;z<cylList.size();z++){ | |
| 481 | - cyl=cylList.get(z); | |
| 482 | - if(t.getNbbm().equals(cyl.getNbbm())){ | |
| 545 | + | |
| 546 | + // 设置存油量 | |
| 547 | + Cyl cyl = null; | |
| 548 | + boolean fage = false; | |
| 549 | + for (int z = 0; z < cylList.size(); z++) { | |
| 550 | + cyl = cylList.get(z); | |
| 551 | + if (t.getNbbm().equals(cyl.getNbbm())) { | |
| 483 | 552 | cyl.setCyl(t.getJzyl()); |
| 484 | 553 | cyl.setUpdatetime(t.getRq()); |
| 485 | - fage=true; | |
| 554 | + fage = true; | |
| 486 | 555 | break; |
| 487 | 556 | } |
| 488 | 557 | } |
| 489 | - if(fage){ | |
| 558 | + if (fage) { | |
| 490 | 559 | cylRepository.save(cyl); |
| 491 | - }else{ | |
| 492 | - cyl=new Cyl(); | |
| 560 | + } else { | |
| 561 | + cyl = new Cyl(); | |
| 493 | 562 | cyl.setNbbm(t.getNbbm()); |
| 494 | 563 | cyl.setCyl(t.getJzyl()); |
| 495 | 564 | cyl.setGsdm(t.getSsgsdm()); |
| 496 | 565 | cyl.setUpdatetime(t.getRq()); |
| 497 | 566 | cylRepository.save(cyl); |
| 498 | 567 | } |
| 499 | - | |
| 568 | + | |
| 500 | 569 | newMap.put("status", ResponseCode.SUCCESS); |
| 501 | - }catch(Exception e){ | |
| 502 | - newMap.put("status", ResponseCode.ERROR); | |
| 503 | - logger.error("save erro.", e); | |
| 504 | 570 | } |
| 571 | + } catch (Exception e) { | |
| 572 | + newMap.put("status", ResponseCode.ERROR); | |
| 573 | + logger.error("save erro.", e); | |
| 505 | 574 | } |
| 506 | 575 | return newMap; |
| 507 | 576 | } |
| ... | ... | @@ -515,13 +584,32 @@ public class YlbServiceImpl extends BaseServiceImpl<Ylb,Integer> implements YlbS |
| 515 | 584 | @Override |
| 516 | 585 | public Map<String, Object> checkYl(Map<String, Object> map) { |
| 517 | 586 | Map<String, Object> newMap=new HashMap<String,Object>(); |
| 518 | - String xlbm=map.get("xlbm_eq").toString(); | |
| 587 | +// String xlbm=""; | |
| 588 | +// if(map.get("xlbm_like")!=null){ | |
| 589 | +// xlbm=map.get("xlbm_like").toString(); | |
| 590 | +// } | |
| 519 | 591 | // TODO Auto-generated method stub |
| 520 | 592 | try{ |
| 521 | 593 | //获取车辆存油信息 |
| 522 | 594 | List<Cyl> cylList=cylRepository.findAll(new CustomerSpecs<Cyl>(newMap)); |
| 523 | 595 | String rq=map.get("rq").toString(); |
| 524 | - List<Ylb> ylbList=repository.obtainYl(rq); | |
| 596 | + String xlbm=""; | |
| 597 | + if(map.get("xlbm_like")!=null){ | |
| 598 | + xlbm= map.get("xlbm_like").toString().trim(); | |
| 599 | + } | |
| 600 | + String gsbm=""; | |
| 601 | + if(map.get("ssgsdm_like")!=null){ | |
| 602 | + gsbm=map.get("ssgsdm_like").toString(); | |
| 603 | + } | |
| 604 | + String fgsbm=""; | |
| 605 | + if(map.get("fgsdm_like")!=null){ | |
| 606 | + fgsbm=map.get("fgsdm_like").toString(); | |
| 607 | + } | |
| 608 | + String nbbm=""; | |
| 609 | + if(map.get("nbbm_eq")!=null){ | |
| 610 | + nbbm=map.get("nbbm_eq").toString(); | |
| 611 | + } | |
| 612 | + List<Ylb> ylbList=repository.obtainYl(rq,gsbm,fgsbm,xlbm,nbbm,"nbbm"); | |
| 525 | 613 | List<Ylxxb> ylxxbList=ylxxbRepository.obtainYlxx(rq,0); |
| 526 | 614 | for (int i = 0; i < ylxxbList.size(); i++) { |
| 527 | 615 | Boolean fage=true; |
| ... | ... | @@ -574,6 +662,7 @@ public class YlbServiceImpl extends BaseServiceImpl<Ylb,Integer> implements YlbS |
| 574 | 662 | }catch(Exception e){ |
| 575 | 663 | newMap.put("status", ResponseCode.ERROR); |
| 576 | 664 | logger.error("save erro.", e); |
| 665 | + throw e; | |
| 577 | 666 | } |
| 578 | 667 | |
| 579 | 668 | return newMap; | ... | ... |
src/main/java/com/bsth/service/schedule/PeopleCarPlanServiceImpl.java
| ... | ... | @@ -229,22 +229,22 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService { |
| 229 | 229 | temp.get(key).add(m); |
| 230 | 230 | } |
| 231 | 231 | for(String key : temp.keySet()){ |
| 232 | - Map<Integer, List<Map<String, Object>>> tempList = new HashMap<Integer, List<Map<String,Object>>>(); | |
| 233 | - List<Integer> keyList = new ArrayList<Integer>(); | |
| 232 | + Map<Long, List<Map<String, Object>>> tempList = new HashMap<Long, List<Map<String,Object>>>(); | |
| 233 | + List<Long> keyList = new ArrayList<Long>(); | |
| 234 | 234 | for(Map<String, Object> m : temp.get(key)){ |
| 235 | 235 | String lp = m.get("lp").toString(); |
| 236 | 236 | String str = ""; |
| 237 | 237 | for(int i = 0; i < lp.length(); i++){ |
| 238 | 238 | str += (int)lp.charAt(i); |
| 239 | 239 | } |
| 240 | - int i = Integer.valueOf(str); | |
| 240 | + Long i = Long.valueOf(str); | |
| 241 | 241 | if(!tempList.containsKey(i)) |
| 242 | 242 | tempList.put(i, new ArrayList<Map<String, Object>>()); |
| 243 | 243 | tempList.get(i).add(m); |
| 244 | 244 | keyList.add(i); |
| 245 | 245 | } |
| 246 | 246 | Collections.sort(keyList); |
| 247 | - for(Integer i : keyList){ | |
| 247 | + for(Long i : keyList){ | |
| 248 | 248 | for(Map<String, Object> m : tempList.get(i)){ |
| 249 | 249 | resList.add(m); |
| 250 | 250 | } | ... | ... |
src/main/java/com/bsth/service/schedule/impl/SchedulePlanServiceImpl.java
| ... | ... | @@ -8,14 +8,17 @@ import com.bsth.repository.schedule.SchedulePlanInfoRepository; |
| 8 | 8 | import com.bsth.repository.schedule.SchedulePlanRepository; |
| 9 | 9 | import com.bsth.service.BusinessService; |
| 10 | 10 | import com.bsth.service.LineService; |
| 11 | -import com.bsth.service.schedule.SchedulePlanService; | |
| 12 | -import com.bsth.service.schedule.TTInfoDetailService; | |
| 13 | -import com.bsth.service.schedule.TTInfoService; | |
| 11 | +import com.bsth.service.schedule.*; | |
| 12 | +import com.bsth.service.schedule.rules.plan.PlanCalcuParam_input; | |
| 13 | +import com.bsth.service.schedule.rules.plan.PlanResult; | |
| 14 | 14 | import com.bsth.service.schedule.rules.shiftloop.ScheduleCalcuParam_input; |
| 15 | 15 | import com.bsth.service.schedule.rules.shiftloop.ScheduleResult_output; |
| 16 | 16 | import com.bsth.service.schedule.rules.shiftloop.ScheduleResults_output; |
| 17 | 17 | import com.bsth.service.schedule.rules.shiftloop.ScheduleRule_input; |
| 18 | 18 | import com.bsth.service.schedule.rules.strategy.IStrategy; |
| 19 | +import com.bsth.service.schedule.rules.ttinfo.TTInfoCalcuParam_input; | |
| 20 | +import com.bsth.service.schedule.rules.ttinfo.TTInfoResults_output; | |
| 21 | +import com.bsth.service.schedule.rules.ttinfo.TTInfo_input; | |
| 19 | 22 | import com.bsth.service.schedule.rules.ttinfo2.CalcuParam; |
| 20 | 23 | import com.bsth.service.schedule.rules.ttinfo2.Result; |
| 21 | 24 | import com.google.common.collect.Multimap; |
| ... | ... | @@ -30,6 +33,7 @@ import org.springframework.stereotype.Service; |
| 30 | 33 | import org.springframework.transaction.annotation.Isolation; |
| 31 | 34 | import org.springframework.transaction.annotation.Propagation; |
| 32 | 35 | import org.springframework.transaction.annotation.Transactional; |
| 36 | +import org.springframework.util.CollectionUtils; | |
| 33 | 37 | |
| 34 | 38 | import java.util.*; |
| 35 | 39 | |
| ... | ... | @@ -54,12 +58,191 @@ public class SchedulePlanServiceImpl extends BServiceImpl<SchedulePlan, Long> im |
| 54 | 58 | private TTInfoDetailService ttInfoDetailService; |
| 55 | 59 | @Autowired |
| 56 | 60 | private BusinessService businessService; |
| 61 | + @Autowired | |
| 62 | + private CarConfigInfoService carConfigInfoService; | |
| 63 | + @Autowired | |
| 64 | + private EmployeeConfigInfoService employeeConfigInfoService; | |
| 57 | 65 | |
| 58 | 66 | /** 日志记录器 */ |
| 59 | 67 | private Logger logger = LoggerFactory.getLogger(SchedulePlanServiceImpl.class); |
| 60 | 68 | |
| 69 | + // 查找线路(未撤销),TODO:到时候放入drl中 | |
| 70 | + private Line getLine(Integer xlId) { | |
| 71 | + Map<String, Object> param = new HashMap<>(); | |
| 72 | + param.put("id_eq", xlId); | |
| 73 | + param.put("destroy_eq", 0); // 未撤销 | |
| 74 | + List<Line> lines = (List<Line>) lineService.list(param); | |
| 75 | + if (CollectionUtils.isEmpty(lines)) { | |
| 76 | + throw new RuntimeException("线路找不到,可能已经撤销!"); | |
| 77 | + } | |
| 78 | + return lines.get(0); | |
| 79 | + } | |
| 80 | + // 查找时刻表(未作废),TODO:到时候放入drl中 | |
| 81 | + private List<TTInfo> getTTInfos(Integer xlId) { | |
| 82 | + // 查询参数 | |
| 83 | + Map<String, Object> param = new HashMap<>(); | |
| 84 | + param.put("xl.id_eq", xlId); // 线路Id | |
| 85 | + param.put("isCancel_eq", false); // 作废的过滤掉 | |
| 86 | + Iterator<TTInfo> ttInfoIterator = ttInfoService.list(param).iterator(); | |
| 87 | + if (!ttInfoIterator.hasNext()) { | |
| 88 | + throw new RuntimeException("线路id=" + xlId + " 没有时刻表!"); | |
| 89 | + } | |
| 90 | + List<TTInfo> ttInfos = new ArrayList<>(); | |
| 91 | + while (ttInfoIterator.hasNext()) { | |
| 92 | + TTInfo ttInfo = ttInfoIterator.next(); | |
| 93 | + ttInfos.add(ttInfo); | |
| 94 | + } | |
| 95 | + return ttInfos; | |
| 96 | + } | |
| 97 | + | |
| 98 | + /** | |
| 99 | + * 循环规则输出。 | |
| 100 | + * @param schedulePlan | |
| 101 | + */ | |
| 102 | + private ScheduleResults_output loopRuleOutput(SchedulePlan schedulePlan) { | |
| 103 | + // 获取主线路 | |
| 104 | + Line xl = strategy.getLine(schedulePlan.getXl().getId()); | |
| 105 | + | |
| 106 | + // 1-1、构造drools规则输入数据,输出数据 | |
| 107 | + // 全局计算参数 | |
| 108 | + ScheduleCalcuParam_input scheduleCalcuParam_input = new ScheduleCalcuParam_input(schedulePlan); | |
| 109 | + // 每个规则对应的输入参数 | |
| 110 | + List<ScheduleRule_input> scheduleRule_inputs = new ArrayList<>(); | |
| 111 | + Iterator<ScheduleRule1Flat> scheduleRule1FlatIterator = strategy.getScheduleRule(xl.getId()).iterator(); | |
| 112 | + while (scheduleRule1FlatIterator.hasNext()) { | |
| 113 | + ScheduleRule1Flat scheduleRule1Flat_temp = scheduleRule1FlatIterator.next(); | |
| 114 | + ScheduleRule_input scheduleRule_input = new ScheduleRule_input(scheduleRule1Flat_temp); | |
| 115 | + scheduleRule_inputs.add(scheduleRule_input); | |
| 116 | + } | |
| 117 | + // 规则输出数据 | |
| 118 | + ScheduleResults_output scheduleResults_output = new ScheduleResults_output(); | |
| 119 | + | |
| 120 | + // 1-2、构造drools session->载入数据->启动规则->计算->销毁session | |
| 121 | + // 创建session,内部配置的是stateful | |
| 122 | + KieSession session = kieBase.newKieSession(); | |
| 123 | + // 设置gloable对象,在drl中通过别名使用 | |
| 124 | + session.setGlobal("scheduleResult", scheduleResults_output); | |
| 125 | + session.setGlobal("log", logger); // 设置日志 | |
| 126 | + | |
| 127 | + // 载入数据 | |
| 128 | + session.insert(scheduleCalcuParam_input); | |
| 129 | + for (ScheduleRule_input scheduleRule_input : scheduleRule_inputs) { | |
| 130 | + session.insert(scheduleRule_input); | |
| 131 | + } | |
| 132 | + // 执行rule | |
| 133 | + session.fireAllRules(); | |
| 134 | + | |
| 135 | + // 执行完毕销毁,有日志的也要关闭 | |
| 136 | + session.dispose(); | |
| 137 | + | |
| 138 | + logger.info("循环规则输出={}", scheduleResults_output.showGuideboardDesc1()); | |
| 139 | + | |
| 140 | + return scheduleResults_output; | |
| 141 | + } | |
| 142 | + | |
| 143 | + /** | |
| 144 | + * 时刻表选择(判定每天使用的时刻表)。 | |
| 145 | + * @param schedulePlan | |
| 146 | + * @return | |
| 147 | + */ | |
| 148 | + private TTInfoResults_output ttInfoOutput(SchedulePlan schedulePlan) { | |
| 149 | + // 获取线路的所有未作废的时刻表 | |
| 150 | + List<TTInfo> ttInfos = getTTInfos(schedulePlan.getXl().getId()); | |
| 151 | + | |
| 152 | + // 1-1、构造drools规则输入数据,输出数据 | |
| 153 | + // 全局计算参数 | |
| 154 | + TTInfoCalcuParam_input ttInfoCalcuParam_input = | |
| 155 | + new TTInfoCalcuParam_input( | |
| 156 | + new DateTime(schedulePlan.getScheduleFromTime()), | |
| 157 | + new DateTime(schedulePlan.getScheduleToTime()), | |
| 158 | + String.valueOf(schedulePlan.getXl().getId()) | |
| 159 | + ); | |
| 160 | + // 规则输出数据 | |
| 161 | + TTInfoResults_output ttInfoResults_output = new TTInfoResults_output(); | |
| 162 | + | |
| 163 | + // 1-2、构造drools session->载入数据->启动规则->计算->销毁session | |
| 164 | + // 创建session,内部配置的是stateful | |
| 165 | + KieSession session = kieBase.newKieSession(); | |
| 166 | + | |
| 167 | + // 设置gloable对象,在drl中通过别名使用 | |
| 168 | + session.setGlobal("results", ttInfoResults_output); | |
| 169 | + session.setGlobal("log", logger); // 设置日志 | |
| 170 | + | |
| 171 | + // 载入数据 | |
| 172 | + session.insert(ttInfoCalcuParam_input); | |
| 173 | + for (TTInfo ttInfo : ttInfos) { | |
| 174 | + TTInfo_input ttInfo_input = new TTInfo_input(ttInfo); | |
| 175 | + session.insert(ttInfo_input); | |
| 176 | + } | |
| 177 | + | |
| 178 | + // 执行rule | |
| 179 | + session.fireAllRules(); | |
| 180 | + | |
| 181 | + // 执行完毕销毁,有日志的也要关闭 | |
| 182 | + session.dispose(); | |
| 183 | + | |
| 184 | + return ttInfoResults_output; | |
| 185 | + | |
| 186 | + } | |
| 187 | + | |
| 188 | + private PlanResult planResultOutput( | |
| 189 | + SchedulePlan schedulePlan, | |
| 190 | + ScheduleResults_output scheduleResults_output, | |
| 191 | + TTInfoResults_output ttInfoResults_output) { | |
| 192 | + | |
| 193 | + // 1-1、构造drools规则输入数据,输出数据 | |
| 194 | + PlanCalcuParam_input planCalcuParam_input = new PlanCalcuParam_input( | |
| 195 | + schedulePlan, | |
| 196 | + scheduleResults_output, | |
| 197 | + ttInfoResults_output | |
| 198 | + ); | |
| 199 | + // 规则输出数据 | |
| 200 | + PlanResult planResult = new PlanResult(); | |
| 201 | + | |
| 202 | + // 1-2、构造drools session->载入数据->启动规则->计算->销毁session | |
| 203 | + // 创建session,内部配置的是stateful | |
| 204 | + KieSession session = kieBase.newKieSession(); | |
| 205 | + | |
| 206 | + // 设置gloable对象,在drl中通过别名使用 | |
| 207 | + session.setGlobal("planResult", planResult); | |
| 208 | + session.setGlobal("tTInfoService", ttInfoService); | |
| 209 | + session.setGlobal("tTInfoDetailService", ttInfoDetailService); | |
| 210 | + session.setGlobal("carConfigInfoService", carConfigInfoService); | |
| 211 | + session.setGlobal("employeeConfigInfoService", employeeConfigInfoService); | |
| 212 | + session.setGlobal("log", logger); // 设置日志 | |
| 213 | + | |
| 214 | + // 载入数据 | |
| 215 | + session.insert(planCalcuParam_input); | |
| 216 | + | |
| 217 | + // 执行rule | |
| 218 | + session.fireAllRules(); | |
| 219 | + | |
| 220 | + // 执行完毕销毁,有日志的也要关闭 | |
| 221 | + session.dispose(); | |
| 222 | + | |
| 223 | + return planResult; | |
| 224 | + | |
| 225 | + } | |
| 226 | + | |
| 227 | + @Transactional(propagation = Propagation.REQUIRED, isolation = Isolation.READ_COMMITTED) | |
| 228 | + public SchedulePlan save2(SchedulePlan schedulePlan) { | |
| 229 | + // 1、循环规则计算输出 | |
| 230 | + ScheduleResults_output scheduleResults_output = loopRuleOutput(schedulePlan); | |
| 231 | + // 2、时刻表选择 | |
| 232 | + TTInfoResults_output ttInfoResults_output = ttInfoOutput(schedulePlan); | |
| 233 | + // 3、计划输出 | |
| 234 | + PlanResult planResult = planResultOutput(schedulePlan, scheduleResults_output, ttInfoResults_output); | |
| 235 | + | |
| 236 | + // TODO: | |
| 237 | + | |
| 238 | + return new SchedulePlan(); | |
| 239 | + } | |
| 240 | + | |
| 61 | 241 | @Transactional(propagation = Propagation.REQUIRED, isolation = Isolation.READ_COMMITTED) |
| 62 | 242 | public SchedulePlan save(SchedulePlan schedulePlan) { |
| 243 | + // 测试 | |
| 244 | +// return save2(schedulePlan); | |
| 245 | + | |
| 63 | 246 | // 1-1、查找线路具体信息 |
| 64 | 247 | Line xl = strategy.getLine(schedulePlan.getXl().getId()); |
| 65 | 248 | // 1-2、查出指定线路的所有规则 |
| ... | ... | @@ -139,7 +322,9 @@ public class SchedulePlanServiceImpl extends BServiceImpl<SchedulePlan, Long> im |
| 139 | 322 | }); |
| 140 | 323 | |
| 141 | 324 | Boolean isFb = false; // 是否分班 |
| 142 | - for (TTInfoDetail ttInfoDetail : ttInfoDetails) { | |
| 325 | + for (int i = 0; i < ttInfoDetails.size(); i++) { | |
| 326 | + TTInfoDetail ttInfoDetail = ttInfoDetails.get(i); | |
| 327 | + | |
| 143 | 328 | if (ttInfoDetail.getIsFB()) |
| 144 | 329 | isFb = ttInfoDetail.getIsFB(); |
| 145 | 330 | |
| ... | ... | @@ -150,7 +335,9 @@ public class SchedulePlanServiceImpl extends BServiceImpl<SchedulePlan, Long> im |
| 150 | 335 | isFb, |
| 151 | 336 | configInfo, |
| 152 | 337 | employeeConfigInfoList, |
| 153 | - schedulePlan); | |
| 338 | + schedulePlan, | |
| 339 | + i == 0, | |
| 340 | + i == ttInfoDetails.size() - 1); | |
| 154 | 341 | |
| 155 | 342 | // 获取公司,分公司信息 |
| 156 | 343 | String gsbm = xl.getCompany(); |
| ... | ... | @@ -197,6 +384,7 @@ public class SchedulePlanServiceImpl extends BServiceImpl<SchedulePlan, Long> im |
| 197 | 384 | ttInfoMap.put(ttInfoDetail.getTtinfo().getId(), ttInfoDetail.getTtinfo().getName()); |
| 198 | 385 | |
| 199 | 386 | } |
| 387 | + | |
| 200 | 388 | } |
| 201 | 389 | |
| 202 | 390 | schedulePlan.setTtInfoId(StringUtils.join(ttInfoMap.keySet(), ",")); | ... | ... |
src/main/java/com/bsth/service/schedule/impl/TTInfoDetailServiceImpl.java
| ... | ... | @@ -406,6 +406,7 @@ public class TTInfoDetailServiceImpl extends BServiceImpl<TTInfoDetail, Long> im |
| 406 | 406 | p1.put("line.id_eq", lineid); |
| 407 | 407 | p1.put("stationName_eq", cell_con.trim()); |
| 408 | 408 | p1.put("stationMark_eq", "B"); |
| 409 | + p1.put("destroy_eq", 0); // 未撤销 | |
| 409 | 410 | |
| 410 | 411 | |
| 411 | 412 | // TODO:这里要修改(起点站有启用撤销的标志的) | ... | ... |
src/main/java/com/bsth/service/schedule/rules/MyDroolsConfiguration.java
| ... | ... | @@ -67,6 +67,9 @@ public class MyDroolsConfiguration { |
| 67 | 67 | kfs.write("src/main/resources/ttinfo2.drl", kieServices.getResources() |
| 68 | 68 | .newInputStreamResource(this.getClass().getResourceAsStream( |
| 69 | 69 | "/rules/ttinfo2.drl"), "UTF-8")); |
| 70 | + kfs.write("src/main/resources/plan.drl", kieServices.getResources() | |
| 71 | + .newInputStreamResource(this.getClass().getResourceAsStream( | |
| 72 | + "/rules/plan.drl"), "UTF-8")); | |
| 70 | 73 | // TODO:还有其他drl.... |
| 71 | 74 | |
| 72 | 75 | // 4、创建KieBuilder,使用KieFileSystem构建 | ... | ... |
src/main/java/com/bsth/service/schedule/rules/plan/PlanCalcuParam_input.java
0 → 100644
| 1 | +package com.bsth.service.schedule.rules.plan; | |
| 2 | + | |
| 3 | +import com.bsth.entity.schedule.SchedulePlan; | |
| 4 | +import com.bsth.service.schedule.rules.shiftloop.ScheduleResults_output; | |
| 5 | +import com.bsth.service.schedule.rules.ttinfo.TTInfoResults_output; | |
| 6 | + | |
| 7 | +/** | |
| 8 | + * 排班规则-规则输入参数。 | |
| 9 | + */ | |
| 10 | +public class PlanCalcuParam_input { | |
| 11 | + /** 线路id */ | |
| 12 | + private Integer xlId; | |
| 13 | + /** 循环规则输出 */ | |
| 14 | + private ScheduleResults_output scheduleResults_output; | |
| 15 | + /** 时刻表选择规则输出 */ | |
| 16 | + private TTInfoResults_output ttInfoResults_output; | |
| 17 | + | |
| 18 | + public PlanCalcuParam_input() { | |
| 19 | + } | |
| 20 | + public PlanCalcuParam_input( | |
| 21 | + SchedulePlan schedulePlan, | |
| 22 | + ScheduleResults_output scheduleResults_output, | |
| 23 | + TTInfoResults_output ttInfoResults_output) { | |
| 24 | + this.xlId = schedulePlan.getXl().getId(); | |
| 25 | + this.scheduleResults_output = scheduleResults_output; | |
| 26 | + this.ttInfoResults_output = ttInfoResults_output; | |
| 27 | + } | |
| 28 | + | |
| 29 | + public Integer getXlId() { | |
| 30 | + return xlId; | |
| 31 | + } | |
| 32 | + | |
| 33 | + public void setXlId(Integer xlId) { | |
| 34 | + this.xlId = xlId; | |
| 35 | + } | |
| 36 | + | |
| 37 | + public ScheduleResults_output getScheduleResults_output() { | |
| 38 | + return scheduleResults_output; | |
| 39 | + } | |
| 40 | + | |
| 41 | + public void setScheduleResults_output(ScheduleResults_output scheduleResults_output) { | |
| 42 | + this.scheduleResults_output = scheduleResults_output; | |
| 43 | + } | |
| 44 | + | |
| 45 | + public TTInfoResults_output getTtInfoResults_output() { | |
| 46 | + return ttInfoResults_output; | |
| 47 | + } | |
| 48 | + | |
| 49 | + public void setTtInfoResults_output(TTInfoResults_output ttInfoResults_output) { | |
| 50 | + this.ttInfoResults_output = ttInfoResults_output; | |
| 51 | + } | |
| 52 | +} | ... | ... |
src/main/java/com/bsth/service/schedule/rules/plan/PlanResult.java
0 → 100644
| 1 | +package com.bsth.service.schedule.rules.plan; | |
| 2 | + | |
| 3 | +import com.bsth.entity.schedule.SchedulePlanInfo; | |
| 4 | + | |
| 5 | +import java.util.ArrayList; | |
| 6 | +import java.util.List; | |
| 7 | + | |
| 8 | +/** | |
| 9 | + * 计划输出。 | |
| 10 | + */ | |
| 11 | +public class PlanResult { | |
| 12 | + private List<SchedulePlanInfo> schedulePlanInfos = new ArrayList<>(); | |
| 13 | + | |
| 14 | + public PlanResult() { | |
| 15 | + } | |
| 16 | + | |
| 17 | + public void add(SchedulePlanInfo schedulePlanInfo) { | |
| 18 | + schedulePlanInfos.add(schedulePlanInfo); | |
| 19 | + } | |
| 20 | + | |
| 21 | + public List<SchedulePlanInfo> getSchedulePlanInfos() { | |
| 22 | + return schedulePlanInfos; | |
| 23 | + } | |
| 24 | + | |
| 25 | + public void setSchedulePlanInfos(List<SchedulePlanInfo> schedulePlanInfos) { | |
| 26 | + this.schedulePlanInfos = schedulePlanInfos; | |
| 27 | + } | |
| 28 | +} | ... | ... |
src/main/java/com/bsth/service/schedule/rules/plan/readme.txt
0 → 100644
src/main/java/com/bsth/service/schedule/rules/shiftloop/ScheduleRule_input.java
| ... | ... | @@ -2,6 +2,7 @@ package com.bsth.service.schedule.rules.shiftloop; |
| 2 | 2 | |
| 3 | 3 | import com.bsth.entity.schedule.rule.ScheduleRule1Flat; |
| 4 | 4 | import com.google.common.base.Splitter; |
| 5 | +import org.apache.commons.lang3.StringUtils; | |
| 5 | 6 | import org.joda.time.DateTime; |
| 6 | 7 | |
| 7 | 8 | import java.util.ArrayList; |
| ... | ... | @@ -29,7 +30,8 @@ public class ScheduleRule_input { |
| 29 | 30 | /** 车辆配置id */ |
| 30 | 31 | private String carConfigId; |
| 31 | 32 | |
| 32 | - // TODO:车辆翻班暂时不考虑进去 | |
| 33 | + /** 车辆翻版(周一到周日是否启用) */ | |
| 34 | + private List<Boolean> weekdays = new ArrayList<>(); | |
| 33 | 35 | |
| 34 | 36 | public ScheduleRule_input() {} |
| 35 | 37 | |
| ... | ... | @@ -51,6 +53,22 @@ public class ScheduleRule_input { |
| 51 | 53 | // 人员初始索引减1 |
| 52 | 54 | this.startEIndex = scheduleRule1Flat.getRyStart() - 1; |
| 53 | 55 | this.carConfigId = String.valueOf(scheduleRule1Flat.getCarConfigInfo().getId()); |
| 56 | + | |
| 57 | + /** 车辆翻版(周一到周日是否启用)*/ | |
| 58 | + String fbgs_temp = null; | |
| 59 | + if (StringUtils.isEmpty(scheduleRule1Flat.getFbgs()) || "1".equals(scheduleRule1Flat.getFbgs())) { | |
| 60 | + fbgs_temp = "1,1,1,1,1,1,1"; | |
| 61 | + } else { | |
| 62 | + fbgs_temp = scheduleRule1Flat.getFbgs(); | |
| 63 | + } | |
| 64 | + String[] days = fbgs_temp.split(","); | |
| 65 | + for (int i = 0; i < 7; i++) { | |
| 66 | + if ("1".equals(days[i])) { | |
| 67 | + weekdays.add(true); | |
| 68 | + } else { | |
| 69 | + weekdays.add(false); | |
| 70 | + } | |
| 71 | + } | |
| 54 | 72 | } |
| 55 | 73 | |
| 56 | 74 | public String getRuleId() { |
| ... | ... | @@ -108,4 +126,12 @@ public class ScheduleRule_input { |
| 108 | 126 | public void setCarConfigId(String carConfigId) { |
| 109 | 127 | this.carConfigId = carConfigId; |
| 110 | 128 | } |
| 129 | + | |
| 130 | + public List<Boolean> getWeekdays() { | |
| 131 | + return weekdays; | |
| 132 | + } | |
| 133 | + | |
| 134 | + public void setWeekdays(List<Boolean> weekdays) { | |
| 135 | + this.weekdays = weekdays; | |
| 136 | + } | |
| 111 | 137 | } | ... | ... |
src/main/resources/rules/plan.drl
0 → 100644
| 1 | +package com.bsth.service.schedule.plan; | |
| 2 | + | |
| 3 | +import org.joda.time.*; | |
| 4 | +import java.util.*; | |
| 5 | + | |
| 6 | +import com.bsth.service.schedule.rules.plan.PlanCalcuParam_input; | |
| 7 | +import com.bsth.service.schedule.rules.plan.PlanResult; | |
| 8 | + | |
| 9 | +import com.bsth.service.schedule.TTInfoService; | |
| 10 | +import com.bsth.service.schedule.TTInfoDetailService; | |
| 11 | +import com.bsth.service.schedule.CarConfigInfoService; | |
| 12 | +import com.bsth.service.schedule.EmployeeConfigInfoService; | |
| 13 | +import com.bsth.service.schedule.rules.shiftloop.ScheduleResult_output; | |
| 14 | +import com.bsth.service.schedule.rules.shiftloop.ScheduleResults_output; | |
| 15 | +import com.bsth.service.schedule.rules.ttinfo.TTInfoResult_output; | |
| 16 | +import com.bsth.service.schedule.rules.ttinfo.TTInfoResults_output; | |
| 17 | + | |
| 18 | +import com.bsth.entity.schedule.CarConfigInfo; | |
| 19 | +import com.bsth.entity.schedule.EmployeeConfigInfo; | |
| 20 | +import com.bsth.entity.schedule.TTInfo; | |
| 21 | +import com.bsth.entity.schedule.TTInfoDetail; | |
| 22 | +import com.bsth.entity.schedule.SchedulePlanInfo; | |
| 23 | + | |
| 24 | +import org.slf4j.Logger; | |
| 25 | + | |
| 26 | + | |
| 27 | +// 全局日志类(一般使用调用此规则的service类) | |
| 28 | +global Logger log; | |
| 29 | +global TTInfoDetailService tTInfoDetailService; | |
| 30 | +global TTInfoService tTInfoService; | |
| 31 | +global CarConfigInfoService carConfigInfoService; | |
| 32 | +global EmployeeConfigInfoService employeeConfigInfoService; | |
| 33 | + | |
| 34 | +// 输出 | |
| 35 | +global PlanResult planResult; | |
| 36 | + | |
| 37 | +function Map ttidParams(String ttid) { | |
| 38 | + Map param = new HashMap(); | |
| 39 | + param.put("ttinfo.id_eq", Long.parseLong(ttid)); | |
| 40 | + return param; | |
| 41 | +} | |
| 42 | + | |
| 43 | +function Map xlidParams(Integer xlid) { | |
| 44 | + Map param = new HashMap(); | |
| 45 | + param.put("xl.id_eq", xlid); | |
| 46 | + return param; | |
| 47 | +} | |
| 48 | + | |
| 49 | +/* | |
| 50 | + 规则说明: | |
| 51 | + 1、根据循环规则输出,时刻表选择规则输出,计算排班明细 | |
| 52 | +*/ | |
| 53 | + | |
| 54 | +//-------------------- 第一阶段、计算迭代数据 -----------------// | |
| 55 | +declare Loop_result | |
| 56 | + xlId: Integer // 线路id | |
| 57 | + ruleLoop: List // 每天分配的规则 List<ScheduleResult_output> | |
| 58 | + ttInfoMapLoop_temp: Map // 每天分配的时刻表 Map<DataTime, Collection<TTInfoResult_output>> | |
| 59 | + ttInfoMapLoop: Map // 每天分配的时刻表 Map<DataTime, TTInfoResult_output> | |
| 60 | + | |
| 61 | + ttInfoMap: Map // 总共用到的时刻表 Map<id, TTInfoResult_output> | |
| 62 | +end | |
| 63 | + | |
| 64 | +rule "calcu_step1_Loop_result" | |
| 65 | + salience 1000 | |
| 66 | + when | |
| 67 | + $param: PlanCalcuParam_input($xlId: xlId) | |
| 68 | + then | |
| 69 | + Loop_result loop_result = new Loop_result(); | |
| 70 | + loop_result.setXlId($xlId); | |
| 71 | + loop_result.setRuleLoop($param.getScheduleResults_output().getResults()); | |
| 72 | + | |
| 73 | + loop_result.setTtInfoMapLoop(new HashMap()); | |
| 74 | + loop_result.setTtInfoMap(new HashMap()); | |
| 75 | + | |
| 76 | + com.google.common.collect.Multimap ttInfoMap_temp = | |
| 77 | + (com.google.common.collect.Multimap) | |
| 78 | + $param.getTtInfoResults_output().getResults().get( | |
| 79 | + String.valueOf($xlId)); | |
| 80 | + | |
| 81 | + loop_result.setTtInfoMapLoop_temp(ttInfoMap_temp.asMap()); | |
| 82 | + | |
| 83 | + insert(loop_result); | |
| 84 | + | |
| 85 | + log.info("calcu_step1_Loop_result"); | |
| 86 | +end | |
| 87 | + | |
| 88 | +rule "calcu_step2_loop_result" | |
| 89 | + salience 1000 | |
| 90 | + no-loop | |
| 91 | + when | |
| 92 | + $param: PlanCalcuParam_input($xlId: xlId) | |
| 93 | + $lr: Loop_result(xlId == $xlId) | |
| 94 | + $sd: DateTime() from $lr.ttInfoMapLoop_temp.keySet() | |
| 95 | + then | |
| 96 | + // 当天时刻表只取第一张 TODO: | |
| 97 | + Collection col = (Collection) $lr.getTtInfoMapLoop_temp().get($sd); | |
| 98 | + Iterator iter = col.iterator(); | |
| 99 | + TTInfoResult_output ttInfo_result = (TTInfoResult_output) iter.next(); | |
| 100 | + $lr.getTtInfoMapLoop().put($sd, ttInfo_result); | |
| 101 | + | |
| 102 | + // 总共使用的时刻表 | |
| 103 | + $lr.getTtInfoMap().put(ttInfo_result.getTtInfoId(), ttInfo_result); | |
| 104 | + | |
| 105 | + update($lr); | |
| 106 | +end | |
| 107 | + | |
| 108 | +//-------------------- 第二阶段、将时刻表班次,车辆配置,人员配置信息载入 -----------------// | |
| 109 | + | |
| 110 | +declare TTInfoDetail_Wrap | |
| 111 | + ttInfoId: String // 时刻表id(cast字符串-方便比较) | |
| 112 | + gid: String // 路牌id(cast字符串-方便比较) | |
| 113 | + | |
| 114 | + self: TTInfoDetail // 原始数据 | |
| 115 | +end | |
| 116 | + | |
| 117 | +rule "calcu_TTInfoDetail_Wrap" | |
| 118 | + salience 800 | |
| 119 | + when | |
| 120 | + $lr: Loop_result($xlId: xlId) | |
| 121 | + $ttInfoId: String() from $lr.getTtInfoMap().keySet() | |
| 122 | + $ttInfoDetail: TTInfoDetail() from tTInfoDetailService.list(ttidParams($ttInfoId)) | |
| 123 | + then | |
| 124 | + TTInfoDetail_Wrap ttInfoDetail_wrap = new TTInfoDetail_Wrap(); | |
| 125 | + ttInfoDetail_wrap.setTtInfoId($ttInfoId); | |
| 126 | + ttInfoDetail_wrap.setGid(String.valueOf($ttInfoDetail.getLp().getId())); | |
| 127 | + ttInfoDetail_wrap.setSelf($ttInfoDetail); | |
| 128 | + | |
| 129 | +// log.info("时刻表id={}", $ttInfoId); | |
| 130 | +// log.info("时刻表明细id={}", $ttInfoDetail.getId()); | |
| 131 | + | |
| 132 | + insert(ttInfoDetail_wrap); | |
| 133 | +end | |
| 134 | + | |
| 135 | +declare CarConfig_Wrap | |
| 136 | + id: String // 车辆配置id(cast字符串-方便比较) | |
| 137 | + | |
| 138 | + self: CarConfigInfo // 原始数据 | |
| 139 | +end | |
| 140 | + | |
| 141 | +rule "calcu_CarConfig_Wrap" | |
| 142 | + salience 800 | |
| 143 | + when | |
| 144 | + $lr: Loop_result($xlId: xlId) | |
| 145 | + $ccf: CarConfigInfo() from carConfigInfoService.list(xlidParams($xlId)) | |
| 146 | + then | |
| 147 | + CarConfig_Wrap carConfig_wrap = new CarConfig_Wrap(); | |
| 148 | + carConfig_wrap.setId(String.valueOf($ccf.getId())); | |
| 149 | + carConfig_wrap.setSelf($ccf); | |
| 150 | + | |
| 151 | + insert(carConfig_wrap); | |
| 152 | +end | |
| 153 | + | |
| 154 | +declare EmployeeConfig_Wrap | |
| 155 | + id: String // 人员配置id(cast字符串-方便比较) | |
| 156 | + | |
| 157 | + self: EmployeeConfigInfo // 原始数据 | |
| 158 | +end | |
| 159 | + | |
| 160 | +rule "calcu_EmployeeConfig_Wrap" | |
| 161 | + salience 800 | |
| 162 | + when | |
| 163 | + $lr: Loop_result($xlId: xlId) | |
| 164 | + $eci: EmployeeConfigInfo() from employeeConfigInfoService.list(xlidParams($xlId)) | |
| 165 | + then | |
| 166 | + EmployeeConfig_Wrap employeeConfig_wrap = new EmployeeConfig_Wrap(); | |
| 167 | + employeeConfig_wrap.setId(String.valueOf($eci.getId())); | |
| 168 | + employeeConfig_wrap.setSelf($eci); | |
| 169 | + | |
| 170 | + insert(employeeConfig_wrap); | |
| 171 | +end | |
| 172 | + | |
| 173 | +declare ScheduleResult_output_Wrap | |
| 174 | + xlId: Integer // 线路id | |
| 175 | + sd: DateTime // 日期 | |
| 176 | + ruleId: String // 规则Id | |
| 177 | + eciIds: List // 人员配置ids | |
| 178 | + | |
| 179 | + self: ScheduleResult_output // 原始数据 | |
| 180 | +end | |
| 181 | + | |
| 182 | +rule "calcu_ScheduleResult_output_Wrap" | |
| 183 | + salience 800 | |
| 184 | + when | |
| 185 | + $lr: Loop_result($xlId: xlId) | |
| 186 | + $sro: ScheduleResult_output() from $lr.getRuleLoop() | |
| 187 | + then | |
| 188 | + ScheduleResult_output_Wrap scheduleResult_output_wrap = new ScheduleResult_output_Wrap(); | |
| 189 | + scheduleResult_output_wrap.setXlId($xlId); | |
| 190 | + scheduleResult_output_wrap.setSd($sro.getSd()); | |
| 191 | + scheduleResult_output_wrap.setRuleId($sro.getRuleId()); | |
| 192 | + scheduleResult_output_wrap.setEciIds(Arrays.asList( | |
| 193 | + $sro.getEmployeeConfigId().split("-"))); | |
| 194 | + scheduleResult_output_wrap.setSelf($sro); | |
| 195 | + | |
| 196 | + insert(scheduleResult_output_wrap); | |
| 197 | +end | |
| 198 | + | |
| 199 | +//-------------------- 第三阶段、合并计算SchedulePlanInfo -----------------// | |
| 200 | + | |
| 201 | +// TODO:暂时不考虑分班 | |
| 202 | + | |
| 203 | +//rule "Calcu_SchedulePlanInfo" | |
| 204 | +// salience 600 | |
| 205 | +// when | |
| 206 | +// $lr: Loop_result($xlId: xlId) | |
| 207 | +// $sro: ScheduleResult_output($sd: sd) from $lr.getRuleLoop() | |
| 208 | +// ScheduleResult_output_Wrap( | |
| 209 | +// xlId == $xlId, sd == $sro.sd, ruleId == $sro.ruleId, | |
| 210 | +// $eciIds: eciIds, $sr: self) | |
| 211 | +// $ecId: String() from $eciIds | |
| 212 | +// CarConfig_Wrap(id == $sro.carConfigId, $cc: self) | |
| 213 | +// EmployeeConfig_Wrap(id == $ecId, $ec: self) | |
| 214 | +// TTInfoDetail_Wrap( | |
| 215 | +// ttInfoId == ((TTInfoResult_output) $lr.getTtInfoMapLoop($sd))., | |
| 216 | +// gid == $sr.guideboardId, | |
| 217 | +// $ttInfoDetail: self | |
| 218 | +// ) | |
| 219 | +// then | |
| 220 | +// log.info("Calcu_SchedulePlanInfo"); | |
| 221 | +// | |
| 222 | +//end | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | ... | ... |
src/main/resources/rules/shiftloop.drl
| ... | ... | @@ -515,49 +515,70 @@ rule "calcu_loop_guideboard" |
| 515 | 515 | when |
| 516 | 516 | $loopData : Calcu_guideboard_range_loop_result($ruleId : ruleId, rangeSize >= 0) |
| 517 | 517 | $indexData : Calcu_guideboard_index_result(ruleId == $ruleId) |
| 518 | - $ruleData : ScheduleRule_input(ruleId == $ruleId) | |
| 519 | - Calcu_days_result(ruleId == $ruleId, $startDate : calcu_start_date) | |
| 518 | + $ruleData : ScheduleRule_input(ruleId == $ruleId, $weekdays: weekdays) | |
| 519 | + Calcu_days_result(ruleId == $ruleId, $startDate : calcu_start_date, $calcu_end_date: calcu_end_date) | |
| 520 | 520 | then |
| 521 | 521 | // 循环计算路牌 |
| 522 | - DateTime initDate = $startDate; | |
| 522 | + DateTime initDate = $startDate; // 开始时间 | |
| 523 | + DateTime endDate = $calcu_end_date; // 结束实际 | |
| 523 | 524 | List<ScheduleResult_output> scheduleResult_outputs = new ArrayList<ScheduleResult_output>(); |
| 524 | 525 | |
| 525 | 526 | // 1、初始组循环 |
| 526 | - for (int i = $indexData.getCalcu_index(); i<= $loopData.getFirstLoopSize(); i++) { | |
| 527 | - ScheduleResult_output ro = new ScheduleResult_output(); | |
| 528 | - ro.setRuleId($ruleId); | |
| 529 | - ro.setSd(initDate); | |
| 530 | - ro.setGuideboardId($ruleData.getGuideboardIds().get(i)); | |
| 531 | - ro.setCarConfigId($ruleData.getCarConfigId()); | |
| 532 | - scheduleResult_outputs.add(ro); | |
| 533 | - | |
| 534 | - initDate = initDate.plusDays(1); | |
| 527 | + int i = $indexData.getCalcu_index(); | |
| 528 | + while (!initDate.isAfter(endDate) && i <= $loopData.getFirstLoopSize()) { | |
| 529 | + if (((Boolean) $weekdays.get(initDate.getDayOfWeek() - 1)).booleanValue()) { | |
| 530 | + ScheduleResult_output ro = new ScheduleResult_output(); | |
| 531 | + ro.setRuleId($ruleId); | |
| 532 | + ro.setSd(initDate); | |
| 533 | + ro.setGuideboardId($ruleData.getGuideboardIds().get(i)); | |
| 534 | + ro.setCarConfigId($ruleData.getCarConfigId()); | |
| 535 | + scheduleResult_outputs.add(ro); | |
| 536 | + | |
| 537 | + initDate = initDate.plusDays(1); | |
| 538 | + i++; | |
| 539 | + } else { | |
| 540 | + initDate = initDate.plusDays(1); | |
| 541 | + } | |
| 535 | 542 | } |
| 536 | 543 | |
| 537 | 544 | // 2、组循环 |
| 538 | - for (int j = 0; j < $loopData.getMiddelLoopCount(); j++) { | |
| 539 | - for (int k = 0; k < $loopData.getRangeSize(); k++) { | |
| 540 | - ScheduleResult_output ro2 = new ScheduleResult_output(); | |
| 541 | - ro2.setRuleId($ruleId); | |
| 542 | - ro2.setSd(initDate); | |
| 543 | - ro2.setGuideboardId($ruleData.getGuideboardIds().get(k)); | |
| 544 | - ro2.setCarConfigId($ruleData.getCarConfigId()); | |
| 545 | - scheduleResult_outputs.add(ro2); | |
| 546 | - | |
| 547 | - initDate = initDate.plusDays(1); | |
| 545 | + int j = 0; | |
| 546 | + while (!initDate.isAfter(endDate) && j < $loopData.getMiddelLoopCount()) { | |
| 547 | + int k = 0; | |
| 548 | + while (!initDate.isAfter(endDate) && k < $loopData.getRangeSize()) { | |
| 549 | + if (((Boolean) $weekdays.get(initDate.getDayOfWeek() - 1)).booleanValue()) { | |
| 550 | + ScheduleResult_output ro2 = new ScheduleResult_output(); | |
| 551 | + ro2.setRuleId($ruleId); | |
| 552 | + ro2.setSd(initDate); | |
| 553 | + ro2.setGuideboardId($ruleData.getGuideboardIds().get(k)); | |
| 554 | + ro2.setCarConfigId($ruleData.getCarConfigId()); | |
| 555 | + scheduleResult_outputs.add(ro2); | |
| 556 | + | |
| 557 | + initDate = initDate.plusDays(1); | |
| 558 | + k++; | |
| 559 | + } else { | |
| 560 | + initDate = initDate.plusDays(1); | |
| 561 | + } | |
| 548 | 562 | } |
| 563 | + j++; | |
| 549 | 564 | } |
| 550 | 565 | |
| 551 | 566 | // 3、余下组循环 |
| 552 | - for (int l = 0; l < $loopData.getLastLoopSize(); l++) { | |
| 553 | - ScheduleResult_output ro3 = new ScheduleResult_output(); | |
| 554 | - ro3.setRuleId($ruleId); | |
| 555 | - ro3.setSd(initDate); | |
| 556 | - ro3.setGuideboardId($ruleData.getGuideboardIds().get(l)); | |
| 557 | - ro3.setCarConfigId($ruleData.getCarConfigId()); | |
| 558 | - scheduleResult_outputs.add(ro3); | |
| 559 | - | |
| 560 | - initDate = initDate.plusDays(1); | |
| 567 | + int l = 0; | |
| 568 | + while (!initDate.isAfter(endDate) && l < $loopData.getLastLoopSize()) { | |
| 569 | + if (((Boolean) $weekdays.get(initDate.getDayOfWeek() - 1)).booleanValue()) { | |
| 570 | + ScheduleResult_output ro3 = new ScheduleResult_output(); | |
| 571 | + ro3.setRuleId($ruleId); | |
| 572 | + ro3.setSd(initDate); | |
| 573 | + ro3.setGuideboardId($ruleData.getGuideboardIds().get(l)); | |
| 574 | + ro3.setCarConfigId($ruleData.getCarConfigId()); | |
| 575 | + scheduleResult_outputs.add(ro3); | |
| 576 | + | |
| 577 | + initDate = initDate.plusDays(1); | |
| 578 | + l++; | |
| 579 | + } else { | |
| 580 | + initDate = initDate.plusDays(1); | |
| 581 | + } | |
| 561 | 582 | } |
| 562 | 583 | |
| 563 | 584 | Calcu_loop_guideboard_result clgr = new Calcu_loop_guideboard_result(); |
| ... | ... | @@ -579,49 +600,70 @@ rule "calcu_loop_employee" |
| 579 | 600 | when |
| 580 | 601 | $loopData : Calcu_employee_range_loop_result($ruleId : ruleId, rangeSize >= 0) |
| 581 | 602 | $indexData : Calcu_employee_index_result(ruleId == $ruleId) |
| 582 | - $ruleData : ScheduleRule_input(ruleId == $ruleId) | |
| 583 | - Calcu_days_result(ruleId == $ruleId, $startDate : calcu_start_date) | |
| 603 | + $ruleData : ScheduleRule_input(ruleId == $ruleId, $weekdays: weekdays) | |
| 604 | + Calcu_days_result(ruleId == $ruleId, $startDate : calcu_start_date, $calcu_end_date: calcu_end_date) | |
| 584 | 605 | then |
| 585 | 606 | // 循环计算路牌 |
| 586 | - DateTime initDate = $startDate; | |
| 607 | + DateTime initDate = $startDate; // 开始时间 | |
| 608 | + DateTime endDate = $calcu_end_date; // 结束实际 | |
| 587 | 609 | List<ScheduleResult_output> scheduleResult_outputs = new ArrayList<ScheduleResult_output>(); |
| 588 | 610 | |
| 589 | 611 | // 1、初始组循环 |
| 590 | - for (int i = $indexData.getCalcu_index(); i<= $loopData.getFirstLoopSize(); i++) { | |
| 591 | - ScheduleResult_output ro = new ScheduleResult_output(); | |
| 592 | - ro.setRuleId($ruleId); | |
| 593 | - ro.setSd(initDate); | |
| 594 | - ro.setEmployeeConfigId($ruleData.getEmployeeConfigIds().get(i)); | |
| 595 | - ro.setCarConfigId($ruleData.getCarConfigId()); | |
| 596 | - scheduleResult_outputs.add(ro); | |
| 597 | - | |
| 598 | - initDate = initDate.plusDays(1); | |
| 612 | + int i = $indexData.getCalcu_index(); | |
| 613 | + while (!initDate.isAfter(endDate) && i<= $loopData.getFirstLoopSize()) { | |
| 614 | + if (((Boolean) $weekdays.get(initDate.getDayOfWeek() - 1)).booleanValue()) { | |
| 615 | + ScheduleResult_output ro = new ScheduleResult_output(); | |
| 616 | + ro.setRuleId($ruleId); | |
| 617 | + ro.setSd(initDate); | |
| 618 | + ro.setEmployeeConfigId($ruleData.getEmployeeConfigIds().get(i)); | |
| 619 | + ro.setCarConfigId($ruleData.getCarConfigId()); | |
| 620 | + scheduleResult_outputs.add(ro); | |
| 621 | + | |
| 622 | + initDate = initDate.plusDays(1); | |
| 623 | + i++; | |
| 624 | + } else { | |
| 625 | + initDate = initDate.plusDays(1); | |
| 626 | + } | |
| 599 | 627 | } |
| 600 | 628 | |
| 601 | 629 | // 2、组循环 |
| 602 | - for (int j = 0; j < $loopData.getMiddelLoopCount(); j++) { | |
| 603 | - for (int k = 0; k < $loopData.getRangeSize(); k++) { | |
| 604 | - ScheduleResult_output ro2 = new ScheduleResult_output(); | |
| 605 | - ro2.setRuleId($ruleId); | |
| 606 | - ro2.setSd(initDate); | |
| 607 | - ro2.setEmployeeConfigId($ruleData.getEmployeeConfigIds().get(k)); | |
| 608 | - ro2.setCarConfigId($ruleData.getCarConfigId()); | |
| 609 | - scheduleResult_outputs.add(ro2); | |
| 610 | - | |
| 611 | - initDate = initDate.plusDays(1); | |
| 630 | + int j = 0; | |
| 631 | + while (!initDate.isAfter(endDate) && j < $loopData.getMiddelLoopCount()) { | |
| 632 | + int k = 0; | |
| 633 | + while (!initDate.isAfter(endDate) && k < $loopData.getRangeSize()) { | |
| 634 | + if (((Boolean) $weekdays.get(initDate.getDayOfWeek() - 1)).booleanValue()) { | |
| 635 | + ScheduleResult_output ro2 = new ScheduleResult_output(); | |
| 636 | + ro2.setRuleId($ruleId); | |
| 637 | + ro2.setSd(initDate); | |
| 638 | + ro2.setEmployeeConfigId($ruleData.getEmployeeConfigIds().get(k)); | |
| 639 | + ro2.setCarConfigId($ruleData.getCarConfigId()); | |
| 640 | + scheduleResult_outputs.add(ro2); | |
| 641 | + | |
| 642 | + initDate = initDate.plusDays(1); | |
| 643 | + k++; | |
| 644 | + } else { | |
| 645 | + initDate = initDate.plusDays(1); | |
| 646 | + } | |
| 612 | 647 | } |
| 648 | + j++; | |
| 613 | 649 | } |
| 614 | 650 | |
| 615 | 651 | // 3、余下组循环 |
| 616 | - for (int l = 0; l < $loopData.getLastLoopSize(); l++) { | |
| 617 | - ScheduleResult_output ro3 = new ScheduleResult_output(); | |
| 618 | - ro3.setRuleId($ruleId); | |
| 619 | - ro3.setSd(initDate); | |
| 620 | - ro3.setEmployeeConfigId($ruleData.getEmployeeConfigIds().get(l)); | |
| 621 | - ro3.setCarConfigId($ruleData.getCarConfigId()); | |
| 622 | - scheduleResult_outputs.add(ro3); | |
| 623 | - | |
| 624 | - initDate = initDate.plusDays(1); | |
| 652 | + int l = 0; | |
| 653 | + while (!initDate.isAfter(endDate) && l < $loopData.getLastLoopSize()) { | |
| 654 | + if (((Boolean) $weekdays.get(initDate.getDayOfWeek() - 1)).booleanValue()) { | |
| 655 | + ScheduleResult_output ro3 = new ScheduleResult_output(); | |
| 656 | + ro3.setRuleId($ruleId); | |
| 657 | + ro3.setSd(initDate); | |
| 658 | + ro3.setEmployeeConfigId($ruleData.getEmployeeConfigIds().get(l)); | |
| 659 | + ro3.setCarConfigId($ruleData.getCarConfigId()); | |
| 660 | + scheduleResult_outputs.add(ro3); | |
| 661 | + | |
| 662 | + initDate = initDate.plusDays(1); | |
| 663 | + l++; | |
| 664 | + } else { | |
| 665 | + initDate = initDate.plusDays(1); | |
| 666 | + } | |
| 625 | 667 | } |
| 626 | 668 | |
| 627 | 669 | Calcu_loop_employee_result clgr = new Calcu_loop_employee_result(); | ... | ... |
src/main/resources/static/pages/electricity/list/list.html
| ... | ... | @@ -16,7 +16,7 @@ |
| 16 | 16 | <div class="portlet light portlet-fit portlet-datatable bordered"> |
| 17 | 17 | <div class="portlet-title"> |
| 18 | 18 | <div class="caption"> |
| 19 | - <i class="fa fa-fire-extinguisher"></i> <span | |
| 19 | + <i class="fa fa-battery-quarter"></i> <span | |
| 20 | 20 | class="caption-subject font-dark sbold uppercase">进出场存电量表</span> |
| 21 | 21 | </div> |
| 22 | 22 | <div class="actions"> | ... | ... |
src/main/resources/static/pages/forms/statement/lineTimeAnaly.html
| ... | ... | @@ -288,6 +288,7 @@ |
| 288 | 288 | params['type'] = "query"; |
| 289 | 289 | $("#forms .hidden").removeClass("hidden"); |
| 290 | 290 | $get('/busInterval/lineTimeAnaliy', params, function(result){ |
| 291 | + console.log(result); | |
| 291 | 292 | // 把数据填充到模版中 |
| 292 | 293 | var tbodyHtml = template('list_lineTimeAnaly',{list:result}); |
| 293 | 294 | // 把渲染好的模版html文本追加到表格中 | ... | ... |
src/main/resources/static/pages/mforms/changetochanges/changetochange.html
| ... | ... | @@ -59,6 +59,7 @@ |
| 59 | 59 | <span class="item-label" style="width: 80px;">线路: </span> <select |
| 60 | 60 | class="form-control" name="line" id="line" style="width: 180px;"></select> |
| 61 | 61 | </div> |
| 62 | + <div style="margin-top: 10px"></div> | |
| 62 | 63 | <div style="display: inline-block; margin-left: 15px;"> |
| 63 | 64 | <span class="item-label" style="width: 80px;">开始时间: </span> <input |
| 64 | 65 | class="form-control" type="text" id="startDate" | ... | ... |
src/main/resources/static/pages/mforms/shiftuehiclemanths/shiftuehiclemanth.html
| ... | ... | @@ -40,6 +40,9 @@ |
| 40 | 40 | <span class="item-label" style="width: 80px;">线路: </span> |
| 41 | 41 | <select class="form-control" name="line" id="line" style="width: 136px;"></select> |
| 42 | 42 | </div> |
| 43 | + <div style="margin-top: 10px"> | |
| 44 | + | |
| 45 | + </div> | |
| 43 | 46 | <div style="display: inline-block;margin-left: 15px;"> |
| 44 | 47 | <span class="item-label" style="width: 80px;">开始时间: </span> |
| 45 | 48 | <input class="form-control" type="text" id="startDate" style="width: 120px;"/> | ... | ... |
src/main/resources/static/pages/mforms/singledatas/singledata.html
| ... | ... | @@ -40,6 +40,7 @@ |
| 40 | 40 | <span class="item-label" style="width: 80px;">线路: </span> |
| 41 | 41 | <select class="form-control" name="line" id="line" style="width: 136px;"></select> |
| 42 | 42 | </div> |
| 43 | + <div style="margin-top: 10px"></div> | |
| 43 | 44 | <div style="display: inline-block;margin-left: 15px;"> |
| 44 | 45 | <span class="item-label" style="width: 80px;">开始时间: </span> |
| 45 | 46 | <input class="form-control" type="text" id="startDate" style="width: 120px;"/> | ... | ... |
src/main/resources/static/pages/mforms/turnoutrates/turnoutrate.html
| ... | ... | @@ -183,7 +183,9 @@ |
| 183 | 183 | gsdmTurn=$("#gsdmTurn").val(); |
| 184 | 184 | fgsdmTurn=$("#fgsdmTurn").val(); |
| 185 | 185 | if(startDate1!=''&&endDate1!=''){ |
| 186 | - $post('/mcy_forms/turnoutrate',{ gsdmTurn:gsdmTurn,fgsdmTurn:fgsdmTurn, line:line,startDate:$("#startDate").val(),endDate:$("#endDate").val(),type:'query'},function(result){ | |
| 186 | +// $post('/mcy_forms/turnoutrate', | |
| 187 | +// { gsdmTurn:gsdmTurn,fgsdmTurn:fgsdmTurn, line:line,startDate:$("#startDate").val(),endDate:$("#endDate").val(),type:'query'},function(result){ | |
| 188 | + var result=[]; | |
| 187 | 189 | // 把数据填充到模版中 |
| 188 | 190 | var tbodyHtml = template('turnoutrate',{list:result}); |
| 189 | 191 | // 把渲染好的模版html文本追加到表格中 |
| ... | ... | @@ -235,7 +237,7 @@ |
| 235 | 237 | obj.updateDate = moment(obj.startDate).format("YYYY-MM-DD HH:mm:ss"); |
| 236 | 238 | }); |
| 237 | 239 | |
| 238 | - }) | |
| 240 | +// }) | |
| 239 | 241 | |
| 240 | 242 | }else{ |
| 241 | 243 | alert("请选择时间范围!"); | ... | ... |
src/main/resources/static/pages/oil/list_ph.html
| ... | ... | @@ -81,25 +81,30 @@ |
| 81 | 81 | <td > |
| 82 | 82 | 线路: |
| 83 | 83 | </td> |
| 84 | - <td colspan="3"> | |
| 85 | - <select class="form-control" name="xlbm_eq" id="xlbm" style="width: 120px;"></select> | |
| 86 | - <input type="hidden" name="xlbm_like" value=""/> | |
| 87 | - | |
| 84 | + <td colspan="2"> | |
| 85 | + <select class="form-control" name="xlbm_like" id="xlbm" style="width: 120px;"></select> | |
| 88 | 86 | </td> |
| 89 | 87 | <td > |
| 90 | 88 | 内部编码: |
| 91 | 89 | </td> |
| 92 | - <td colspan="3"> | |
| 90 | + <td colspan="4"> | |
| 91 | + <div style="float:left;"> | |
| 93 | 92 | <select class="form-control" name="nbbm_eq" id="nbbm" style="width: 120px;"></select> |
| 93 | + </div> | |
| 94 | + <div style="float:left;"> | |
| 95 | + <button class="btn btn-sm #000 btn-outline filter-cancel" style="margin-right:0px"> | |
| 96 | + <i class="fa fa-times"></i> | |
| 97 | + </button> | |
| 98 | + </div> | |
| 94 | 99 | </td> |
| 95 | - <td colspan="4"> | |
| 100 | + <td colspan="1"> | |
| 96 | 101 | <button class="btn btn-sm green btn-outline filter-submit margin-bottom" style="margin-right:0px"> |
| 97 | 102 | <i class="fa fa-search"></i> 搜索 |
| 98 | 103 | </button> |
| 99 | 104 | |
| 100 | - <button class="btn btn-sm red btn-outline filter-cancel" style="margin-right:0px"> | |
| 101 | - <i class="fa fa-times"></i> 重置 | |
| 102 | - </button> | |
| 105 | +<!-- <button class="btn btn-sm red btn-outline filter-cancel" style="margin-right:0px"> --> | |
| 106 | +<!-- <i class="fa fa-times"></i> 重置 --> | |
| 107 | +<!-- </button> --> | |
| 103 | 108 | |
| 104 | 109 | </td> |
| 105 | 110 | </tr> |
| ... | ... | @@ -111,8 +116,6 @@ |
| 111 | 116 | <th width="5%">自编号</th> |
| 112 | 117 | <th width="6%">驾驶员</th> |
| 113 | 118 | <th width="4%">加油量</th> |
| 114 | - <th width="5%">出场公里</th> | |
| 115 | - <th width="4%">进场公里</th> | |
| 116 | 119 | <th width="4%">出场存油</th> |
| 117 | 120 | <th width="4%">进场存油</th> |
| 118 | 121 | <th width="5%">油耗</th> |
| ... | ... | @@ -123,7 +126,7 @@ |
| 123 | 126 | <th width="5%">当日总里程</th> |
| 124 | 127 | <th width="5%">数据类型</th> |
| 125 | 128 | <th width="5%">百公里油耗</th> |
| 126 | - <!-- <th width="5%">操作</th> --> | |
| 129 | +<!-- <th width="5%">操作</th> --> | |
| 127 | 130 | </tr> |
| 128 | 131 | </thead> |
| 129 | 132 | <tbody></tbody> |
| ... | ... | @@ -163,12 +166,6 @@ |
| 163 | 166 | {{obj.jzl}} |
| 164 | 167 | </td> |
| 165 | 168 | <td> |
| 166 | - {{obj.czlc}} | |
| 167 | - </td> | |
| 168 | - <td> | |
| 169 | - {{obj.jzlc}} | |
| 170 | - </td> | |
| 171 | - <td> | |
| 172 | 169 | {{obj.czyl}} |
| 173 | 170 | </td> |
| 174 | 171 | <td> |
| ... | ... | @@ -186,10 +183,22 @@ |
| 186 | 183 | {{obj.ns}} |
| 187 | 184 | </td> |
| 188 | 185 | <td> |
| 189 | - {{obj.shyy}} | |
| 186 | + <select data-id="{{obj.id}}" class="in_carpark_shyy"> | |
| 187 | + <option value='0' {{if obj.shyy==0}} selected = 'selected' {{/if}}>请选择</option> | |
| 188 | + <option value='1' {{if obj.shyy==1}} selected = 'selected' {{/if}}>票务用油</option> | |
| 189 | + <option value='2' {{if obj.shyy==2}} selected = 'selected' {{/if}}>保养用油</option> | |
| 190 | + <option value='3' {{if obj.shyy==3}} selected = 'selected' {{/if}}>报废车用油</option> | |
| 191 | + <option value='4' {{if obj.shyy==4}} selected = 'selected' {{/if}}>其它用油</option> | |
| 192 | + <option value='5' {{if obj.shyy==5}} selected = 'selected' {{/if}}>人保部</option> | |
| 193 | + <option value='6' {{if obj.shyy==6}} selected = 'selected' {{/if}}>车队</option> | |
| 194 | + <option value='7' {{if obj.shyy==7}} selected = 'selected' {{/if}}>车间(高保)</option> | |
| 195 | + <option value='8' {{if obj.shyy==8}} selected = 'selected' {{/if}}>车间(小修)</option> | |
| 196 | + </select> | |
| 190 | 197 | </td> |
| 191 | 198 | <td> |
| 192 | - {{obj.sh}} | |
| 199 | + <a data-id="{{obj.id}}" href="javascript:;" class="in_carpark_shyl"> | |
| 200 | + {{obj.sh}} | |
| 201 | + </a> | |
| 193 | 202 | </td> |
| 194 | 203 | <td> |
| 195 | 204 | {{obj.zlc}} |
| ... | ... | @@ -200,14 +209,11 @@ |
| 200 | 209 | <td> |
| 201 | 210 | {{obj.bglyh}} |
| 202 | 211 | </td> |
| 203 | - <td> | |
| 204 | - <!--<a class="btn btn-sm blue btn-outline" href="edit.html?no={{obj.id}}" data-pjax><i class="fa fa-edit"></i> 编辑</a>--> | |
| 205 | - </td> | |
| 206 | 212 | </tr> |
| 207 | 213 | {{/each}} |
| 208 | 214 | {{if list.length == 0}} |
| 209 | 215 | <tr> |
| 210 | - <td colspan=20><h6 class="muted">没有找到相关数据</h6></td> | |
| 216 | + <td colspan=17><h6 class="muted">没有找到相关数据</h6></td> | |
| 211 | 217 | </tr> |
| 212 | 218 | {{/if}} |
| 213 | 219 | </script> |
| ... | ... | @@ -277,11 +283,15 @@ |
| 277 | 283 | } else { |
| 278 | 284 | //获取输入的进场存油 |
| 279 | 285 | var jzyl = $('.in_carpark_jzyl[data-id='+id+']', '#ll_oil_list').html(); |
| 286 | + var sh = $('.in_carpark_shyl[data-id='+id+']', '#ll_oil_list').html(); | |
| 287 | + var shyy = $('.in_carpark_shyy[data-id='+id+']', '#ll_oil_list').val(); | |
| 280 | 288 | // $("#jzyl" + id).html(); |
| 281 | 289 | var params = {}; |
| 282 | 290 | params['jzyl'] = jzyl; |
| 291 | + params['sh'] =sh; | |
| 292 | + params['shyy']=shyy; | |
| 283 | 293 | params['id'] = id; |
| 284 | - var i = layer.load(2); | |
| 294 | + var i = layer.load(2); | |
| 285 | 295 | $get('/ylb/sort', params, function () { |
| 286 | 296 | layer.close(i); |
| 287 | 297 | var cells = $('tr.filter')[0].cells |
| ... | ... | @@ -297,7 +307,7 @@ |
| 297 | 307 | } |
| 298 | 308 | }); |
| 299 | 309 | jsDoQuery(params1, true); |
| 300 | - }); | |
| 310 | + }); | |
| 301 | 311 | |
| 302 | 312 | } |
| 303 | 313 | } else { |
| ... | ... | @@ -343,7 +353,7 @@ |
| 343 | 353 | |
| 344 | 354 | //重置 |
| 345 | 355 | $('tr.filter .filter-cancel').on('click', function () { |
| 346 | - $('tr.filter input, select').val('').change(); | |
| 356 | + $('tr.filter , #nbbm').val('').change(); | |
| 347 | 357 | }); |
| 348 | 358 | |
| 349 | 359 | //提交 |
| ... | ... | @@ -444,7 +454,7 @@ |
| 444 | 454 | params['fgsdm_in']=fgsqx1; |
| 445 | 455 | } |
| 446 | 456 | } */ |
| 447 | - var i = layer.load(2); | |
| 457 | + var l = layer.load(2); | |
| 448 | 458 | $get('/ylb', params, function (data) { |
| 449 | 459 | $.each(data.content, function (i, obj) { |
| 450 | 460 | obj.rq = moment(obj.rq).format("YYYY-MM-DD"); |
| ... | ... | @@ -459,9 +469,10 @@ |
| 459 | 469 | initPagination = true; |
| 460 | 470 | showPagination(data); |
| 461 | 471 | } |
| 462 | - layer.close(i); | |
| 472 | + layer.close(l); | |
| 463 | 473 | |
| 464 | 474 | startOptJzylLink($('#ll_oil_list .in_carpark_jzyl')); |
| 475 | + startOptShylLink($('#ll_oil_list .in_carpark_shyl')); | |
| 465 | 476 | }); |
| 466 | 477 | } |
| 467 | 478 | |
| ... | ... | @@ -487,6 +498,27 @@ |
| 487 | 498 | }); |
| 488 | 499 | } |
| 489 | 500 | |
| 501 | + //改变状态 | |
| 502 | + function startOptShylLink(es) { | |
| 503 | + es.editable({ | |
| 504 | + type: 'text', | |
| 505 | + placement: 'right', | |
| 506 | + width: 100, | |
| 507 | + display: false, | |
| 508 | + validate: function (value) { | |
| 509 | + if (!value) | |
| 510 | + return '值不能为空!'; | |
| 511 | + if (isNaN(value)) | |
| 512 | + return '只能为数字!'; | |
| 513 | + if (value < 0) | |
| 514 | + return '值不能小于0!'; | |
| 515 | + }, | |
| 516 | + inputclass: 'form-control input-medium input-edtable-sm' | |
| 517 | + }) | |
| 518 | + .on('save', function (e, params) { | |
| 519 | + $(this).text(params.newValue); | |
| 520 | + }); | |
| 521 | + } | |
| 490 | 522 | function iCheckChange() { |
| 491 | 523 | var tr = $(this).parents('tr'); |
| 492 | 524 | if (this.checked) |
| ... | ... | @@ -550,14 +582,14 @@ |
| 550 | 582 | //搜索线路 |
| 551 | 583 | $.get('/basic/lineCode2Name',function(result){ |
| 552 | 584 | var data=[]; |
| 553 | -// data.push({id: " ", text: "全部线路"}); | |
| 585 | + data.push({id: " ", text: "全部线路"}); | |
| 554 | 586 | for(var code in result){ |
| 555 | 587 | data.push({id: code, text: result[code]}); |
| 556 | 588 | } |
| 557 | 589 | initPinYinSelect2('#xlbm',data,''); |
| 558 | 590 | |
| 559 | 591 | }) |
| 560 | - | |
| 592 | + | |
| 561 | 593 | $('#nbbm').select2({ |
| 562 | 594 | placeholder: '搜索车辆...', |
| 563 | 595 | ajax: { |
| ... | ... | @@ -598,8 +630,7 @@ |
| 598 | 630 | return '<span style="color:gray;font-size: 12px;"> 正在搜索车辆...</span>'; |
| 599 | 631 | } |
| 600 | 632 | } |
| 601 | - }) | |
| 602 | - | |
| 633 | + }); | |
| 603 | 634 | |
| 604 | 635 | //导出 |
| 605 | 636 | ... | ... |
src/main/resources/static/pages/scheduleApp/module/core/busConfig/edit.html
| ... | ... | @@ -135,11 +135,11 @@ |
| 135 | 135 | <div class="form-group has-success has-feedback"> |
| 136 | 136 | <label class="col-md-2 control-label">停车场*:</label> |
| 137 | 137 | <div class="col-md-3"> |
| 138 | - <sa-Select5 name="tcd" | |
| 138 | + <sa-Select5 name="tcc" | |
| 139 | 139 | model="ctrl.busConfigForSave" |
| 140 | - cmaps="{'tcd': 'parkName'}" | |
| 141 | - dcname="tcd" | |
| 142 | - icname="parkName" | |
| 140 | + cmaps="{'tcc.id': 'id', 'tcd': 'parkName'}" | |
| 141 | + dcname="tcc.id" | |
| 142 | + icname="id" | |
| 143 | 143 | dsparams="{{ {type: 'ajax', param:{type: 'all'}, atype:'tcc' } | json }}" |
| 144 | 144 | iterobjname="item" |
| 145 | 145 | iterobjexp="item.parkName" |
| ... | ... | @@ -149,7 +149,7 @@ |
| 149 | 149 | </sa-Select5> |
| 150 | 150 | </div> |
| 151 | 151 | <!-- 隐藏块,显示验证信息 --> |
| 152 | - <div class="alert alert-danger well-sm" ng-show="myForm.tcd.$error.required"> | |
| 152 | + <div class="alert alert-danger well-sm" ng-show="myForm.tcc.$error.required"> | |
| 153 | 153 | 停车场必须填写 |
| 154 | 154 | </div> |
| 155 | 155 | </div> | ... | ... |
src/main/resources/static/pages/scheduleApp/module/core/busConfig/form.html
| ... | ... | @@ -135,11 +135,11 @@ |
| 135 | 135 | <div class="form-group has-success has-feedback"> |
| 136 | 136 | <label class="col-md-2 control-label">停车场*:</label> |
| 137 | 137 | <div class="col-md-3"> |
| 138 | - <sa-Select5 name="tcd" | |
| 138 | + <sa-Select5 name="tcc" | |
| 139 | 139 | model="ctrl.busConfigForSave" |
| 140 | - cmaps="{'tcd': 'parkName'}" | |
| 141 | - dcname="tcd" | |
| 142 | - icname="parkName" | |
| 140 | + cmaps="{'tcc.id': 'id', 'tcd': 'parkName'}" | |
| 141 | + dcname="tcc.id" | |
| 142 | + icname="id" | |
| 143 | 143 | dsparams="{{ {type: 'ajax', param:{type: 'all'}, atype:'tcc' } | json }}" |
| 144 | 144 | iterobjname="item" |
| 145 | 145 | iterobjexp="item.parkName" |
| ... | ... | @@ -149,7 +149,7 @@ |
| 149 | 149 | </sa-Select5> |
| 150 | 150 | </div> |
| 151 | 151 | <!-- 隐藏块,显示验证信息 --> |
| 152 | - <div class="alert alert-danger well-sm" ng-show="myForm.tcd.$error.required"> | |
| 152 | + <div class="alert alert-danger well-sm" ng-show="myForm.tcc.$error.required"> | |
| 153 | 153 | 停车场必须填写 |
| 154 | 154 | </div> |
| 155 | 155 | </div> | ... | ... |
src/main/resources/static/pages/scheduleApp/module/core/busConfig/module.js
| ... | ... | @@ -237,12 +237,17 @@ angular.module('ScheduleApp').controller( |
| 237 | 237 | self.busConfigForSave = new BusConfig; |
| 238 | 238 | self.busConfigForSave.xl = {}; |
| 239 | 239 | self.busConfigForSave.cl = {}; |
| 240 | + self.busConfigForSave.tcc = {}; | |
| 240 | 241 | |
| 241 | 242 | // 获取传过来的id,有的话就是修改,获取一遍数据 |
| 242 | 243 | var id = $stateParams.id; |
| 243 | 244 | if (id) { |
| 244 | 245 | BusConfig.get({id: id}, function(value) { |
| 245 | 246 | self.busConfigForSave = value; |
| 247 | + | |
| 248 | + if (!self.busConfigForSave.tcc) { | |
| 249 | + self.busConfigForSave.tcc = {}; | |
| 250 | + } | |
| 246 | 251 | }); |
| 247 | 252 | } else { |
| 248 | 253 | // 初始表单,从查询条件中获取线路id | ... | ... |
src/main/resources/static/pages/scheduleApp/module/core/schedulePlanManage/info/list_info.html
| ... | ... | @@ -8,12 +8,14 @@ |
| 8 | 8 | <th style="width: 80px;">线路</th> |
| 9 | 9 | <th style="width: 150px;">日期</th> |
| 10 | 10 | <th style="width: 50px;">路牌</th> |
| 11 | - <th style="width: 120px;">车辆</th> | |
| 11 | + <th style="width: 100px;">车辆</th> | |
| 12 | 12 | <th style="width: 120px;">驾驶员(工号)</th> |
| 13 | - <th style="width: 120px;">售票员(工号)</th> | |
| 13 | + <!--<th style="width: 120px;">售票员(工号)</th>--> | |
| 14 | 14 | <th style="width: 80px;">班次类型</th> |
| 15 | 15 | <th style="width: 80px;">上下行</th> |
| 16 | 16 | <th style="width: 80px;">发车时间</th> |
| 17 | + <th style="width: 100px;">起点站</th> | |
| 18 | + <th style="width: 100px;">终点站</th> | |
| 17 | 19 | <th style="width: 100%">时刻表</th> |
| 18 | 20 | <th style="width: 90px;">修改人</th> |
| 19 | 21 | <th style="width: 90px;">修改时间</th> |
| ... | ... | @@ -48,6 +50,7 @@ |
| 48 | 50 | <td></td> |
| 49 | 51 | <td></td> |
| 50 | 52 | <td></td> |
| 53 | + <td></td> | |
| 51 | 54 | |
| 52 | 55 | </tr> |
| 53 | 56 | </thead> |
| ... | ... | @@ -73,9 +76,9 @@ |
| 73 | 76 | <span>{{info.jName ? info.jName + '(' + info.jGh + ')' : ''}}</span> |
| 74 | 77 | |
| 75 | 78 | </td> |
| 76 | - <td> | |
| 77 | - <span>{{info.sGh ? info.sName + '(' + info.sGh + ')' : ''}}</span> | |
| 78 | - </td> | |
| 79 | + <!--<td>--> | |
| 80 | + <!--<span>{{info.sGh ? info.sName + '(' + info.sGh + ')' : ''}}</span>--> | |
| 81 | + <!--</td>--> | |
| 79 | 82 | <td> |
| 80 | 83 | <span ng-bind="info.bcType | dict:'ScheduleType':'未知' "></span> |
| 81 | 84 | </td> |
| ... | ... | @@ -86,7 +89,31 @@ |
| 86 | 89 | <span ng-bind="info.fcsj"></span> |
| 87 | 90 | </td> |
| 88 | 91 | <td> |
| 89 | - <span ng-bind="info.ttInfoName"></span> | |
| 92 | + <a href="#" | |
| 93 | + tooltip-animation="false" | |
| 94 | + tooltip-placement="top" | |
| 95 | + uib-tooltip="{{info.qdzName}}" | |
| 96 | + tooltip-class="headClass"> | |
| 97 | + {{info.qdzName}} | |
| 98 | + </a> | |
| 99 | + </td> | |
| 100 | + <td> | |
| 101 | + <a href="#" | |
| 102 | + tooltip-animation="false" | |
| 103 | + tooltip-placement="top" | |
| 104 | + uib-tooltip="{{info.zdzName}}" | |
| 105 | + tooltip-class="headClass"> | |
| 106 | + {{info.zdzName}} | |
| 107 | + </a> | |
| 108 | + </td> | |
| 109 | + <td> | |
| 110 | + <a href="#" | |
| 111 | + tooltip-animation="false" | |
| 112 | + tooltip-placement="top" | |
| 113 | + uib-tooltip="{{info.ttInfoName}}" | |
| 114 | + tooltip-class="headClass"> | |
| 115 | + {{info.ttInfoName}} | |
| 116 | + </a> | |
| 90 | 117 | </td> |
| 91 | 118 | <td> |
| 92 | 119 | <span ng-bind="info.updateBy.userName"></span> | ... | ... |
src/main/resources/static/pages/scheduleApp/module/core/scheduleRuleManage/edit.html
| ... | ... | @@ -148,6 +148,21 @@ |
| 148 | 148 | </div> |
| 149 | 149 | </div> |
| 150 | 150 | |
| 151 | + <div class="form-group has-success has-feedback"> | |
| 152 | + <label class="col-md-2 control-label">翻班格式*:</label> | |
| 153 | + <div class="col-md-6"> | |
| 154 | + <sa-Checkboxgroup model="ctrl.scheduleRuleManageForSave" | |
| 155 | + name="fbgs" | |
| 156 | + dcvalue="{{ctrl.scheduleRuleManageForSave.fbgs}}" | |
| 157 | + dcname="fbgs" | |
| 158 | + required > | |
| 159 | + </sa-Checkboxgroup> | |
| 160 | + </div> | |
| 161 | + <div class="alert alert-danger well-sm" ng-show="myForm.fbgs.$error.required"> | |
| 162 | + 请操作一下1 | |
| 163 | + </div> | |
| 164 | + </div> | |
| 165 | + | |
| 151 | 166 | <!--<div class="form-group">--> |
| 152 | 167 | <!--<label class="col-md-2 control-label">翻班格式:</label>--> |
| 153 | 168 | <!--<div class="col-md-4">--> | ... | ... |
src/main/resources/static/pages/scheduleApp/module/core/scheduleRuleManage/list.html
| ... | ... | @@ -12,6 +12,7 @@ |
| 12 | 12 | <th>路牌范围</th> |
| 13 | 13 | <th>起始人员</th> |
| 14 | 14 | <th>人员范围</th> |
| 15 | + <th>翻版格式</th> | |
| 15 | 16 | <th style="width: 21%">操作</th> |
| 16 | 17 | </tr> |
| 17 | 18 | <tr role="row" class="filter"> |
| ... | ... | @@ -37,6 +38,7 @@ |
| 37 | 38 | <td></td> |
| 38 | 39 | <td></td> |
| 39 | 40 | <td></td> |
| 41 | + <td></td> | |
| 40 | 42 | <td> |
| 41 | 43 | <button class="btn btn-sm green btn-outline filter-submit margin-bottom" |
| 42 | 44 | ng-click="ctrl.doPage()"> |
| ... | ... | @@ -72,13 +74,34 @@ |
| 72 | 74 | <span ng-bind="info.lpStart"></span> |
| 73 | 75 | </td> |
| 74 | 76 | <td> |
| 75 | - <span ng-bind="info.lpNames"></span> | |
| 77 | + <a href="#" | |
| 78 | + tooltip-animation="false" | |
| 79 | + tooltip-placement="left-top" | |
| 80 | + uib-tooltip="{{info.lpNames}}" | |
| 81 | + tooltip-class="headClass"> | |
| 82 | + {{info.lpNames}} | |
| 83 | + </a> | |
| 76 | 84 | </td> |
| 77 | 85 | <td> |
| 78 | 86 | <span ng-bind="info.ryStart"></span> |
| 79 | 87 | </td> |
| 80 | 88 | <td> |
| 81 | - <span ng-bind="info.ryDbbms"></span> | |
| 89 | + <a href="#" | |
| 90 | + tooltip-animation="false" | |
| 91 | + tooltip-placement="top" | |
| 92 | + uib-tooltip="{{info.ryDbbms}}" | |
| 93 | + tooltip-class="headClass"> | |
| 94 | + {{info.ryDbbms}} | |
| 95 | + </a> | |
| 96 | + </td> | |
| 97 | + <td> | |
| 98 | + <a href="#" | |
| 99 | + tooltip-animation="false" | |
| 100 | + tooltip-placement="top" | |
| 101 | + uib-tooltip="{{info.fbgs}}" | |
| 102 | + tooltip-class="headClass"> | |
| 103 | + {{info.fbgs}} | |
| 104 | + </a> | |
| 82 | 105 | </td> |
| 83 | 106 | <td> |
| 84 | 107 | <!--<a href="details.html?lineId={{obj.id}}" class="btn default blue-stripe btn-sm"> 详细 </a>--> | ... | ... |
src/main/resources/static/real_control_v2/css/ct_table.css
src/main/resources/static/real_control_v2/css/line_schedule.css
| ... | ... | @@ -96,7 +96,7 @@ |
| 96 | 96 | } |
| 97 | 97 | |
| 98 | 98 | .line-schedule-table dl dt:nth-of-type(3), .line-schedule-table dl dd:nth-of-type(3) { |
| 99 | - width: calc(2% + 86px); | |
| 99 | + width: calc(2% + 66px); | |
| 100 | 100 | } |
| 101 | 101 | |
| 102 | 102 | .line-schedule-table dl dt:nth-of-type(4), .line-schedule-table dl dd:nth-of-type(4) { |
| ... | ... | @@ -122,7 +122,7 @@ |
| 122 | 122 | } |
| 123 | 123 | |
| 124 | 124 | .line-schedule-table dl dt:nth-of-type(9), .line-schedule-table dl dd:nth-of-type(9) { |
| 125 | - width: 50px; | |
| 125 | + width: 70px; | |
| 126 | 126 | border-right: 0; |
| 127 | 127 | } |
| 128 | 128 | |
| ... | ... | @@ -238,6 +238,10 @@ |
| 238 | 238 | height: 36px; |
| 239 | 239 | } |
| 240 | 240 | |
| 241 | +.schedule-body .ct_table dl:nth-child(even){ | |
| 242 | + background: rgba(249, 249, 249, 0.31); | |
| 243 | +} | |
| 244 | + | |
| 241 | 245 | span.fcsj-diff { |
| 242 | 246 | color: gray; |
| 243 | 247 | margin-left: 3px; |
| ... | ... | @@ -528,8 +532,7 @@ div.drop-rail[data-type="car"]:before { |
| 528 | 532 | } |
| 529 | 533 | |
| 530 | 534 | dl.relevance-active dd:nth-child(n+2) { |
| 531 | - background: #f1efef !important; | |
| 532 | - color: #333; | |
| 535 | + background: #c1e2f9 !important; | |
| 533 | 536 | } |
| 534 | 537 | |
| 535 | 538 | dl.relevance-active.intimity dd:nth-child(n+2) { | ... | ... |
src/test/java/com/bsth/service/schedule/rules/DroolsRulesTest2.java
0 → 100644
| 1 | +package com.bsth.service.schedule.rules; | |
| 2 | + | |
| 3 | +import com.bsth.Application; | |
| 4 | +import org.junit.runner.RunWith; | |
| 5 | +import org.kie.api.KieBase; | |
| 6 | +import org.springframework.beans.factory.annotation.Autowired; | |
| 7 | +import org.springframework.boot.test.SpringApplicationConfiguration; | |
| 8 | +import org.springframework.context.annotation.ComponentScan; | |
| 9 | +import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; | |
| 10 | + | |
| 11 | +/** | |
| 12 | + * 测试类。 | |
| 13 | + */ | |
| 14 | +@RunWith(SpringJUnit4ClassRunner.class) | |
| 15 | +@SpringApplicationConfiguration(classes = {Application.class}) | |
| 16 | +@ComponentScan(basePackages = {"com.bsth.entity"}) | |
| 17 | +public class DroolsRulesTest2 { | |
| 18 | + @Autowired | |
| 19 | + private KieBase kieBase; | |
| 20 | + | |
| 21 | + @org.junit.Test | |
| 22 | + public void test1() throws Exception { | |
| 23 | + System.out.println("dfdfdfdfd"); | |
| 24 | + } | |
| 25 | + | |
| 26 | +} | ... | ... |
src/test/resources/test.properties
0 → 100644