Commit c250518916b8c053709a927ddbd1675035b5beac

Authored by 娄高锋
2 parents 5dc2ad20 58b5a128

Merge branch 'pudong' of 192.168.168.201:panzhaov5/bsth_control into pudong

Showing 60 changed files with 2520 additions and 1400 deletions

Too many changes to show.

To preserve performance only 60 of 123 files are displayed.

src/main/java/com/bsth/controller/StationController.java
1 1 package com.bsth.controller;
2 2  
3   -import java.util.Map;
4   -
  3 +import com.bsth.entity.Station;
  4 +import com.bsth.service.StationService;
  5 +import com.bsth.util.GetUIDAndCode;
5 6 import org.slf4j.Logger;
6 7 import org.slf4j.LoggerFactory;
7 8 import org.springframework.beans.factory.annotation.Autowired;
... ... @@ -10,9 +11,7 @@ import org.springframework.web.bind.annotation.RequestMethod;
10 11 import org.springframework.web.bind.annotation.RequestParam;
11 12 import org.springframework.web.bind.annotation.RestController;
12 13  
13   -import com.bsth.entity.Station;
14   -import com.bsth.service.StationService;
15   -import com.bsth.util.GetUIDAndCode;
  14 +import java.util.Map;
16 15  
17 16 /**
18 17 *
... ... @@ -160,11 +159,11 @@ public class StationController extends BaseController<Station, Integer> {
160 159 public int updateStationAndSectionCode(@RequestParam Integer stationCount, Integer sectionCount) {
161 160 System.out.println(stationCount+" _ "+ sectionCount );
162 161 for(int i = 0; i < stationCount; i++) {
163   - System.out.println(stationCount);
  162 + System.out.println(i);
164 163 GetUIDAndCode.getStationId();
165 164 }
166   - for(int i = 0; i < sectionCount; i++) {
167   - System.out.println(sectionCount);
  165 + for(int j = 0; j < sectionCount; j++) {
  166 + System.out.println(j);
168 167 GetUIDAndCode.getSectionId();
169 168 }
170 169 return 1;
... ...
src/main/java/com/bsth/controller/StationRouteController.java
1 1 package com.bsth.controller;
2 2  
3   -import com.bsth.entity.Station;
4 3 import com.bsth.entity.StationRoute;
5 4 import com.bsth.entity.StationRouteCache;
6 5 import com.bsth.repository.StationRouteCacheRepository;
... ... @@ -12,11 +11,10 @@ import org.springframework.web.bind.annotation.RequestMethod;
12 11 import org.springframework.web.bind.annotation.RequestParam;
13 12 import org.springframework.web.bind.annotation.RestController;
14 13  
  14 +import javax.servlet.http.HttpServletResponse;
15 15 import java.util.List;
16 16 import java.util.Map;
17 17  
18   -import javax.servlet.http.HttpServletResponse;
19   -
20 18 /**
21 19 *
22 20 * @ClassName: StationRouteController(站点路由控制器)
... ...
src/main/java/com/bsth/controller/realcontrol/ScheduleRealInfoController.java
... ... @@ -515,6 +515,11 @@ public class ScheduleRealInfoController extends BaseController&lt;ScheduleRealInfo,
515 515 return scheduleRealInfoService.realScheduleList(line,date);
516 516 }
517 517  
  518 + @RequestMapping(value="/realScheduleList_zrw")
  519 + public List<ScheduleRealInfo> realScheduleList_zrw(@RequestParam String line,@RequestParam String date){
  520 + return scheduleRealInfoService.realScheduleList_zrw(line,date);
  521 + }
  522 +
518 523 @RequestMapping(value="/realScheduleList_mh_2")
519 524 public List<ScheduleRealInfo> realScheduleList_mh_2(@RequestParam String line,@RequestParam String date){
520 525 return scheduleRealInfoService.realScheduleList_mh_2(line,date);
... ...
src/main/java/com/bsth/controller/schedule/core/CarConfigInfoController.java
... ... @@ -63,6 +63,20 @@ public class CarConfigInfoController extends BController&lt;CarConfigInfo, Long&gt; {
63 63 return rtn;
64 64 }
65 65  
  66 + @RequestMapping(value = "/validate_cars_2", method = RequestMethod.GET)
  67 + public Map<String, Object> validate_cars(@RequestParam Integer xlId, @RequestParam Integer clId) {
  68 + Map<String, Object> rtn = new HashMap<>();
  69 + try {
  70 + carConfigInfoService.validate_cars(xlId, clId);
  71 + rtn.put("status", ResponseCode.SUCCESS);
  72 + } catch (ScheduleException exp) {
  73 + rtn.put("status", ResponseCode.ERROR);
  74 + rtn.put("msg", exp.getMessage());
  75 + }
  76 +
  77 + return rtn;
  78 + }
  79 +
66 80 @RequestMapping(value = "/validate_cars_gs", method = RequestMethod.GET)
67 81 public Map<String, Object> validate_cars_gs(HttpServletRequest request, @RequestParam Map<String, Object> param) {
68 82 HttpSession session = request.getSession();
... ...
src/main/java/com/bsth/controller/schedule/core/SchedulePlanController.java
... ... @@ -57,4 +57,21 @@ public class SchedulePlanController extends BController&lt;SchedulePlan, Long&gt; {
57 57 return rtn;
58 58 }
59 59  
  60 + /**
  61 + * 验证排班计划时间范围内规则的正确性。
  62 + * @return
  63 + * @throws Exception
  64 + */
  65 + @RequestMapping(value = "/valttrule/{xlid}/{from}/{to}", method = RequestMethod.GET)
  66 + public Map<String, Object> validateRule(
  67 + @PathVariable(value = "xlid") Integer xlid,
  68 + @PathVariable(value = "from") Date from,
  69 + @PathVariable(value = "to") Date to
  70 + ) throws Exception {
  71 + Map<String, Object> rtn = new HashMap<>();
  72 + rtn.put("status", ResponseCode.SUCCESS);
  73 + rtn.put("data", schedulePlanService.validateRule(xlid, from, to));
  74 + return rtn;
  75 + }
  76 +
60 77 }
... ...
src/main/java/com/bsth/entity/schedule/SchedulePlanInfo.java
1 1 package com.bsth.entity.schedule;
2 2  
3 3 import com.bsth.entity.Line;
4   -import com.bsth.service.schedule.rules.rerun.RerunRule_input;
5   -import com.bsth.service.schedule.rules.shiftloop.ScheduleResult_output;
6   -import com.bsth.service.schedule.rules.shiftloop.ScheduleRule_Type;
  4 +import com.bsth.service.schedule.impl.plan.kBase1.core.rerun.RerunRule_input;
  5 +import com.bsth.service.schedule.impl.plan.kBase1.core.shiftloop.ScheduleResult_output;
  6 +import com.bsth.service.schedule.impl.plan.kBase1.core.shiftloop.ScheduleRule_Type;
7 7  
8 8 import javax.persistence.*;
9 9 import java.sql.PreparedStatement;
... ...
src/main/java/com/bsth/repository/schedule/CarConfigInfoRepository.java
... ... @@ -50,4 +50,7 @@ public interface CarConfigInfoRepository extends BaseRepository&lt;CarConfigInfo, L
50 50  
51 51 @EntityGraph(value = "carConfigInfo_xl_cl", type = EntityGraph.EntityGraphType.FETCH)
52 52 List<CarConfigInfo> findByXlId(Integer xlid);
  53 +
  54 + @EntityGraph(value = "carConfigInfo_xl_cl", type = EntityGraph.EntityGraphType.FETCH)
  55 + List<CarConfigInfo> findByClId(Integer clid);
53 56 }
54 57 \ No newline at end of file
... ...
src/main/java/com/bsth/repository/schedule/GuideboardInfoRepository.java
... ... @@ -43,5 +43,7 @@ public interface GuideboardInfoRepository extends BaseRepository&lt;GuideboardInfo,
43 43  
44 44 @Query(value = "SELECT g FROM GuideboardInfo g where g.xl =?1 and g.lpName = ?2 and g.lpNo = ?3 and lpType =?4 and isCancel = 0")
45 45 List<GuideboardInfo> validateLp(Line xl,String lpName , int lpNo,String lpType);
  46 +
  47 + List<GuideboardInfo> findByXlId(Integer id);
46 48  
47 49 }
... ...
src/main/java/com/bsth/repository/schedule/TTInfoRepository.java
... ... @@ -48,4 +48,6 @@ public interface TTInfoRepository extends BaseRepository&lt;TTInfo, Long&gt; {
48 48 "from LineVersions lv where lv.line.id = ?1 and lv.status = ?2 ")
49 49 List<Map<String, Object>> findLineVersionDescs3(Integer lineId, Integer status);
50 50  
  51 + List<TTInfo> findByXlId(Integer xlId);
  52 +
51 53 }
... ...
src/main/java/com/bsth/service/realcontrol/ScheduleRealInfoService.java
... ... @@ -132,8 +132,8 @@ public interface ScheduleRealInfoService extends BaseService&lt;ScheduleRealInfo, L
132 132  
133 133 Long getMaxId();
134 134 Map<String,Object> scheduleDaily(String line,String date);
135   -
136 135 List<ScheduleRealInfo> realScheduleList(String line,String date);
  136 + List<ScheduleRealInfo> realScheduleList_zrw(String line,String date);
137 137 List<ScheduleRealInfo> realScheduleListQp(String line,String date);
138 138  
139 139 List<Map<String,Object>> yesterdayDataList(String line,String date,String gsbm,String fgsbm,String jGh,String nbbm);
... ...
src/main/java/com/bsth/service/realcontrol/impl/ScheduleRealInfoServiceImpl.java
... ... @@ -3433,6 +3433,195 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
3433 3433 }
3434 3434  
3435 3435 @Override
  3436 + public List<ScheduleRealInfo> realScheduleList_zrw(String line, String date) {
  3437 + List<ScheduleRealInfo> list = new ArrayList<ScheduleRealInfo>();
  3438 + String lpName = "lpName";
  3439 + String zdsj = "";
  3440 + String zdsjActual = "";
  3441 + String zdsj1 = "";
  3442 + String zdsjActual1 = "";
  3443 + List<ScheduleRealInfo> listInfo = scheduleRealInfoRepository.scheduleDdrb(line, date);
  3444 +
  3445 + /*
  3446 + * 对计划发车时间相同的班次进行排序 out最前 in最后
  3447 + */
  3448 + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm");
  3449 + String minfcsj = "02:00";
  3450 + List<Line> lineList = lineRepository.findLineByCode(line);
  3451 + if (lineList.size() > 0) {
  3452 + String sqlMinYysj = "select start_opt from bsth_c_line_config where "
  3453 + + " id = ("
  3454 + + "select max(id) from bsth_c_line_config where line ='" + lineList.get(0).getId() + "'"
  3455 + + ")";
  3456 + minfcsj = jdbcTemplate.queryForObject(sqlMinYysj, String.class);
  3457 + }
  3458 + String[] minSjs = minfcsj.split(":");
  3459 + Long minSj = Long.parseLong(minSjs[0]) * 60 + Long.parseLong(minSjs[1]);
  3460 + for (int i = 0; i < listInfo.size(); i++) {
  3461 + ScheduleRealInfo s = listInfo.get(i);
  3462 + if (s.getBcType().equals("out")) {
  3463 + s.setRemark("1");
  3464 + } else if (s.getBcType().equals("in")) {
  3465 + s.setRemark("3");
  3466 + } else {
  3467 + s.setRemark("2");
  3468 + }
  3469 + String[] fcsj = s.getFcsj().split(":");
  3470 + Long fcsjL = Long.parseLong(fcsj[0]) * 60 + Long.parseLong(fcsj[1]);
  3471 +
  3472 + Long fscjT = 0L;
  3473 + if (fcsjL < minSj) {
  3474 + Calendar calendar = new GregorianCalendar();
  3475 + calendar.setTime(s.getScheduleDate());
  3476 + calendar.add(calendar.DATE, 1);
  3477 + s.setScheduleDate(calendar.getTime());
  3478 + try {
  3479 + fscjT = sdf.parse(sdf.format(s.getScheduleDate()) + " " + s.getFcsj()).getTime();
  3480 + } catch (ParseException e) {
  3481 + // TODO Auto-generated catch block
  3482 + e.printStackTrace();
  3483 + }
  3484 +
  3485 + } else {
  3486 + try {
  3487 + fscjT = sdf.parse(s.getScheduleDateStr() + " " + s.getFcsj()).getTime();
  3488 + } catch (ParseException e) {
  3489 + // TODO Auto-generated catch block
  3490 + e.printStackTrace();
  3491 + }
  3492 + ;
  3493 + }
  3494 + s.setFcsjT(fscjT);
  3495 + }
  3496 +
  3497 +// Collections.sort(listInfo, new compareLpFcsjType());
  3498 + List<ScheduleRealInfo> listInfo2=new ArrayList<ScheduleRealInfo>();
  3499 +
  3500 + Collections.sort(listInfo, new compareLpFcsjType());
  3501 + for (int i = 0; i < listInfo.size(); i++) {
  3502 + ScheduleRealInfo t = listInfo.get(i);
  3503 + if (!lpName.equals(t.getLpName())) {
  3504 + zdsjActual = t.getZdsjActual();
  3505 + zdsj = t.getZdsj();
  3506 + t.setZdsjActual("");
  3507 + t.setZdsj("");
  3508 + } else {
  3509 + zdsj1 = t.getZdsj();
  3510 + zdsjActual1 = t.getZdsjActual();
  3511 + t.setZdsjActual(zdsjActual);
  3512 + t.setZdsj(zdsj);
  3513 + zdsj = zdsj1;
  3514 + zdsjActual = zdsjActual1;
  3515 + }
  3516 +
  3517 +
  3518 +
  3519 + lpName = t.getLpName();
  3520 + listInfo2.add(t);
  3521 +
  3522 + }
  3523 +
  3524 + Collections.sort(listInfo2,new compareDirLpFcsjType());
  3525 + for (int i = 0; i < listInfo2.size(); i++) {
  3526 + ScheduleRealInfo t=listInfo2.get(i);
  3527 + list.add(t);
  3528 + Set<ChildTaskPlan> childTaskPlans = t.getcTasks();
  3529 + //计算营运里程,空驶里程
  3530 + if (!childTaskPlans.isEmpty()) {
  3531 + List<ChildTaskPlan> listit = new ArrayList<ChildTaskPlan>(childTaskPlans);
  3532 + Collections.sort(listit, new ComparableChild());
  3533 + for (int j = 0; j < listit.size(); j++) {
  3534 + ScheduleRealInfo s = new ScheduleRealInfo();
  3535 + ChildTaskPlan childTaskPlan = listit.get(j);
  3536 + if (childTaskPlan.getCcId() == null) {
  3537 + if (childTaskPlan.isDestroy()) {
  3538 + s.setFcsjActual("");
  3539 + s.setZdsjActual("");
  3540 + } else {
  3541 + s.setFcsjActual(childTaskPlan.getStartDate());
  3542 + s.setZdsjActual("");
  3543 + s.setJhlc(Double.parseDouble(String.valueOf(childTaskPlan.getMileage())));
  3544 + }
  3545 + s.setFcsj(childTaskPlan.getStartDate());
  3546 + s.setZdsj("");
  3547 + s.setQdzName(childTaskPlan.getStartStationName());
  3548 + s.setZdzName(childTaskPlan.getEndStationName());
  3549 + s.setRemarks(childTaskPlan.getRemarks());
  3550 + s.setAdjustExps("子");
  3551 + s.setLpName("");
  3552 + list.add(s);
  3553 + }
  3554 + }
  3555 + }
  3556 + }
  3557 + List<ScheduleRealInfo> xList = new ArrayList<ScheduleRealInfo>();
  3558 + List<ScheduleRealInfo> yList = new ArrayList<ScheduleRealInfo>();
  3559 + List<ScheduleRealInfo> zList = new ArrayList<ScheduleRealInfo>();
  3560 + List<ScheduleRealInfo> newList = new ArrayList<ScheduleRealInfo>();
  3561 + if (list.size() > 0) {
  3562 + int a = list.size() % 3;
  3563 + int b = list.size() / 3;
  3564 + int x = 0, y = 0;
  3565 + if (a == 2) {
  3566 + x = b + 1;
  3567 + y = x * 2;
  3568 + } else if (a == 1) {
  3569 + x = b + 1;
  3570 + y = x * 2 - 1;
  3571 + } else {
  3572 + x = b;
  3573 + y = 2 * x;
  3574 +
  3575 + }
  3576 + for (int i = 0; i < list.size(); i++) {
  3577 + ScheduleRealInfo s = list.get(i);
  3578 + if (i + 1 <= x) {
  3579 + xList.add(s);
  3580 + } else if ((i + 1) > x && (i + 1) <= y) {
  3581 + yList.add(s);
  3582 + } else {
  3583 + zList.add(s);
  3584 + }
  3585 + }
  3586 + for (int i = 0; i < x; i++) {
  3587 + newList.add(xList.get(i));
  3588 + if (yList.size() > i) {
  3589 + newList.add(yList.get(i));
  3590 + } else {
  3591 + newList.add(new ScheduleRealInfo());
  3592 + }
  3593 + if (zList.size() > i) {
  3594 + newList.add(zList.get(i));
  3595 + } else {
  3596 + newList.add(new ScheduleRealInfo());
  3597 + }
  3598 +
  3599 + }
  3600 + }
  3601 + /* for (int i = 0; i < newList.size(); i++) {
  3602 + ScheduleRealInfo t1 = newList.get(i);
  3603 + for (int j = 0; j < list.size(); j++) {
  3604 + ScheduleRealInfo t2 = list.get(j);
  3605 + if (t1.getId() == t2.getId()) {
  3606 + t1 = t2;
  3607 + }
  3608 + }
  3609 + }*/
  3610 +
  3611 + for (int i = 0; i < newList.size(); i++) {
  3612 + ScheduleRealInfo t1 = newList.get(i);
  3613 + String reamrks1 = t1.getRemarks() == null ? "" : t1.getRemarks();
  3614 + if (reamrks1.length() > 4) {
  3615 + t1.setRemarks(reamrks1.substring(0, 4));
  3616 + t1.setRemark(reamrks1);
  3617 + } else {
  3618 + t1.setRemark(reamrks1);
  3619 + }
  3620 + }
  3621 + return newList;
  3622 + }
  3623 +
  3624 + @Override
3436 3625 public List<ScheduleRealInfo> realScheduleList_mh_2(String line, String date) {
3437 3626 List<ScheduleRealInfo> list = new ArrayList<ScheduleRealInfo>();
3438 3627 String lpName = "lpName";
... ... @@ -4774,13 +4963,18 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
4774 4963 String xlName = map.get("xlName").toString();
4775 4964 String state = map.get("state").toString();
4776 4965 String type = map.get("type").toString();
4777   -
  4966 + String genre =map.get("genre").toString();
4778 4967 List<Map<String, Object>> dataList2 = new ArrayList<Map<String, Object>>();
4779 4968 List<Map<String, Object>> dataList3 = new ArrayList<Map<String, Object>>();
4780 4969 List<Map<String, Object>> list1 = this.statisticsDaily(line, date, xlName, null);
4781 4970 List<ScheduleRealInfo> list2 = this.queryUserInfo(line, date, state);
4782   - List<ScheduleRealInfo> list3 = this.realScheduleList(line, date);
4783   -
  4971 + List<ScheduleRealInfo> list3 = new ArrayList<ScheduleRealInfo>();
  4972 + if(genre.equals("qp"))
  4973 + list3=this.realScheduleListQp(line, date);
  4974 + else if(genre.equals("zrw"))
  4975 + list3=this.realScheduleList_zrw(line, date);
  4976 + else
  4977 + list3=this.realScheduleList(line, date);
4784 4978 Map<String, Object> nMap = new HashMap<String, Object>();
4785 4979 nMap.put("date", xlName + date);
4786 4980 nMap.put("jls", list1.get(0).get("jls"));
... ... @@ -4908,7 +5102,7 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
4908 5102 }
4909 5103 }
4910 5104 tempMap.put("zdsjk" + x, zdsjk);
4911   - tempMap.put("zdsjm" + x, zdsjm);
  5105 + tempMap.put("zdsjm" + x, zdsjm.equals("0")?"":zdsjm);
4912 5106 tempMap.put("fcsj" + x, schedule.getFcsj());
4913 5107 String fcsjActural = schedule.getFcsjActual() != null ? schedule.getFcsjActual() : "";
4914 5108 String bcType = schedule.getBcType() != null ? schedule.getBcType() : "";
... ... @@ -4935,7 +5129,7 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
4935 5129 }
4936 5130 }
4937 5131 tempMap.put("fcsjk" + x, fcsjk);
4938   - tempMap.put("fcsjm" + x, fcsjm);
  5132 + tempMap.put("fcsjm" + x, fcsjm.equals("0")?"":fcsjm);
4939 5133 tempMap.put("remarks" + x, schedule.getRemark() != null ? schedule.getRemark() : "");
4940 5134  
4941 5135 size++;
... ...
src/main/java/com/bsth/service/schedule/CarConfigInfoService.java
... ... @@ -10,7 +10,10 @@ import java.util.List;
10 10 * Created by xu on 16/5/9.
11 11 */
12 12 public interface CarConfigInfoService extends BService<CarConfigInfo, Long> {
  13 + // 判定车辆是否配置在其他线路上
13 14 void validate_cars(CarConfigInfo carConfigInfo) throws ScheduleException;
  15 + // 判定车辆是否配置在其他线路上2
  16 + void validate_cars(Integer xlId, Integer clId) throws ScheduleException;
14 17 // 判定车辆是否配置在当前线路中
15 18 void validate_cars_config(CarConfigInfo carConfigInfo) throws ScheduleException;
16 19 // 判定车辆所属公司和当前用户的所属公司
... ...
src/main/java/com/bsth/service/schedule/SchedulePlanService.java
1 1 package com.bsth.service.schedule;
2 2  
3 3 import com.bsth.entity.schedule.SchedulePlan;
4   -import com.bsth.service.schedule.rules.ttinfo2.Result;
  4 +import com.bsth.service.schedule.impl.plan.kBase3.validate.rule.ValidateRuleResult;
  5 +import com.bsth.service.schedule.impl.plan.kBase3.validate.timetable.Result;
5 6  
6 7 import java.util.Date;
7 8  
... ... @@ -26,4 +27,13 @@ public interface SchedulePlanService extends BService&lt;SchedulePlan, Long&gt; {
26 27 * @return
27 28 */
28 29 Result validateTTInfo(Integer xlid, Date from, Date to);
  30 +
  31 + /**
  32 + * 验证规则。
  33 + * @param xlId 线路id
  34 + * @param from 排班计划开始时间
  35 + * @param to 排班计划结束时间
  36 + * @return
  37 + */
  38 + ValidateRuleResult validateRule(Integer xlId, Date from, Date to);
29 39 }
30 40 \ No newline at end of file
... ...
src/main/java/com/bsth/service/schedule/impl/CarConfigInfoServiceImpl.java
... ... @@ -130,6 +130,18 @@ public class CarConfigInfoServiceImpl extends BServiceImpl&lt;CarConfigInfo, Long&gt;
130 130 }
131 131  
132 132 @Override
  133 + public void validate_cars(Integer xlId, Integer clId) throws ScheduleException {
  134 + Map<String, Object> param = new HashMap<>();
  135 + param.put("cl.id_eq", clId);
  136 + List<CarConfigInfo> carConfigInfos = list(param);
  137 + for (CarConfigInfo carConfigInfo : carConfigInfos) {
  138 + if (!carConfigInfo.getXl().getId().equals(xlId)) {
  139 + throw new ScheduleException("车辆不配置在当前线路下,配置在" + carConfigInfo.getXl().getName() + "线路中!");
  140 + }
  141 + }
  142 + }
  143 +
  144 + @Override
133 145 public void validate_cars_config(CarConfigInfo carConfigInfo) throws ScheduleException {
134 146 Map<String, Object> param = new HashMap<>();
135 147 param.put("xl.id_eq", carConfigInfo.getXl().getId());
... ...
src/main/java/com/bsth/service/schedule/impl/CarsServiceImpl.java
1 1 package com.bsth.service.schedule.impl;
2 2  
  3 +import com.bsth.entity.CarDevice;
3 4 import com.bsth.entity.Cars;
  5 +import com.bsth.entity.schedule.CarConfigInfo;
  6 +import com.bsth.repository.schedule.CarConfigInfoRepository;
  7 +import com.bsth.service.schedule.CarDeviceService;
4 8 import com.bsth.service.schedule.CarsService;
5 9 import com.bsth.service.schedule.exception.ScheduleException;
6 10 import com.bsth.service.schedule.utils.DataToolsFile;
... ... @@ -12,7 +16,9 @@ import org.springframework.transaction.annotation.Transactional;
12 16 import org.springframework.util.CollectionUtils;
13 17  
14 18 import java.io.File;
  19 +import java.util.Date;
15 20 import java.util.HashMap;
  21 +import java.util.List;
16 22 import java.util.Map;
17 23  
18 24 /**
... ... @@ -24,6 +30,48 @@ public class CarsServiceImpl extends BServiceImpl&lt;Cars, Integer&gt; implements Cars
24 30 @Qualifier(value = "cars_dataTool")
25 31 private DataToolsService dataToolsService;
26 32  
  33 + @Autowired
  34 + @Qualifier(value = "carDeviceServiceImpl_sc")
  35 + private CarDeviceService carDeviceService;
  36 +
  37 + @Autowired
  38 + private CarConfigInfoRepository carConfigInfoRepository;
  39 +
  40 + @Override
  41 + public Cars save(Cars cars) {
  42 + if (cars.getId() != null && cars.getScrapState()) { // 更新车辆信息,报废车辆
  43 + // 1、作废的车辆,修改报废号
  44 + String eCode = cars.getEquipmentCode();
  45 + cars.setEquipmentCode("BF-" + eCode);
  46 + cars.setScrapCode("BF-" + cars.getEquipmentCode());
  47 + // 2、添加一条相关的设备替换记录
  48 + // 查找在哪条线路上
  49 + List<CarConfigInfo> carConfigInfoList = carConfigInfoRepository.findByClId(cars.getId());
  50 + for (CarConfigInfo carConfigInfo : carConfigInfoList) {
  51 + CarDevice carDevice = new CarDevice();
  52 + carDevice.setGsName(cars.getCompany());
  53 + carDevice.setCompany(cars.getBusinessCode());
  54 + carDevice.setBrancheCompany(cars.getBrancheCompanyCode());
  55 + carDevice.setCl(cars.getId());
  56 + carDevice.setClZbh(cars.getInsideCode());
  57 + carDevice.setXl(carConfigInfo.getXl().getId());
  58 + carDevice.setXlName(carConfigInfo.getXl().getName());
  59 + carDevice.setXlBm(carConfigInfo.getXl().getLineCode());
  60 + carDevice.setOldDeviceNo(eCode);
  61 + carDevice.setNewDeviceNo("BF-" + eCode);
  62 + carDevice.setIsCancel(false);
  63 +
  64 + carDevice.setCreateBy(cars.getCreateBy());
  65 + carDevice.setUpdateBy(cars.getUpdateBy());
  66 + carDevice.setCreateDate(new Date());
  67 + carDevice.setUpdateDate(new Date());
  68 + carDeviceService.save(carDevice);
  69 + }
  70 + }
  71 +
  72 + return super.save(cars);
  73 + }
  74 +
27 75 @Override
28 76 public void importData(File file, Map<String, Object> params) throws ScheduleException {
29 77 dataToolsService.importData(file, params);
... ...
src/main/java/com/bsth/service/schedule/impl/SchedulePlanServiceImpl.java
1 1 package com.bsth.service.schedule.impl;
2 2  
  3 +import com.bsth.entity.Line;
3 4 import com.bsth.entity.schedule.SchedulePlan;
4 5 import com.bsth.entity.schedule.TTInfo;
5 6 import com.bsth.repository.BusinessRepository;
... ... @@ -7,10 +8,11 @@ import com.bsth.repository.LineRepository;
7 8 import com.bsth.repository.schedule.*;
8 9 import com.bsth.service.schedule.SchedulePlanService;
9 10 import com.bsth.service.schedule.exception.ScheduleException;
10   -import com.bsth.service.schedule.plan.DroolsSchedulePlan;
11   -import com.bsth.service.schedule.rules.ScheduleRuleService;
12   -import com.bsth.service.schedule.rules.ttinfo2.CalcuParam;
13   -import com.bsth.service.schedule.rules.ttinfo2.Result;
  11 +import com.bsth.service.schedule.impl.plan.kBase3.validate.rule.ValidateRuleResult;
  12 +import com.bsth.service.schedule.impl.plan.kBase3.validate.timetable.CalcuParam;
  13 +import com.bsth.service.schedule.impl.plan.kBase3.validate.timetable.Result;
  14 +import com.bsth.service.schedule.impl.plan.DroolsSchedulePlan;
  15 +import com.bsth.service.schedule.impl.plan.ScheduleRuleService;
14 16 import org.joda.time.DateTime;
15 17 import org.kie.api.KieBase;
16 18 import org.kie.api.runtime.KieSession;
... ... @@ -42,6 +44,10 @@ public class SchedulePlanServiceImpl extends BServiceImpl&lt;SchedulePlan, Long&gt; im
42 44 private KieBase preKBase;
43 45  
44 46 @Autowired
  47 + @Qualifier("KBase3")
  48 + private KieBase validateKBase;
  49 +
  50 + @Autowired
45 51 private ScheduleRule1FlatRepository scheduleRule1FlatRepository;
46 52 @Autowired
47 53 private TTInfoRepository ttInfoRepository;
... ... @@ -52,6 +58,8 @@ public class SchedulePlanServiceImpl extends BServiceImpl&lt;SchedulePlan, Long&gt; im
52 58 @Autowired
53 59 private CarConfigInfoRepository carConfigInfoRepository;
54 60 @Autowired
  61 + private GuideboardInfoRepository guideboardInfoRepository;
  62 + @Autowired
55 63 private EmployeeConfigInfoRepository employeeConfigInfoRepository;
56 64 @Autowired
57 65 private BusinessRepository businessRepository;
... ... @@ -146,22 +154,25 @@ public class SchedulePlanServiceImpl extends BServiceImpl&lt;SchedulePlan, Long&gt; im
146 154 public Result validateTTInfo(Integer xlid, Date from, Date to) {
147 155 // 构造drools session->载入数据->启动规则->计算->销毁session
148 156 // 创建session,内部配置的是stateful
149   - KieSession session = coreKBase.newKieSession();
  157 + KieSession session = validateKBase.newKieSession();
150 158 // 设置gloable对象,在drl中通过别名使用
151 159 session.setGlobal("log", logger);
152   - session.setGlobal("lineRepository", lineRepository);
153 160 session.setGlobal("tTInfoDetailRepository", ttInfoDetailRepository);
154 161  
155 162 Result rs = new Result(); // 输出gloable对象
156 163 session.setGlobal("rs", rs);
157 164  
158 165 // 载入数据
  166 + Line line = lineRepository.findOne(xlid);
  167 + session.insert(line);
  168 +
159 169 CalcuParam calcuParam = new CalcuParam(
160 170 new DateTime(from), new DateTime(to), xlid);
161 171 session.insert(calcuParam);
162   - List<TTInfo> ttInfos = (List<TTInfo>) ttInfoRepository.findAll();
163   - for (TTInfo ttInfo: ttInfos)
164   - session.insert(ttInfo);
  172 + List<TTInfo> ttInfos = ttInfoRepository.findByXlId(xlid);
  173 + for (TTInfo ttInfo: ttInfos) {
  174 + session.insert(ttInfo);
  175 + }
165 176  
166 177 // 执行rule
167 178 session.fireAllRules();
... ... @@ -171,4 +182,30 @@ public class SchedulePlanServiceImpl extends BServiceImpl&lt;SchedulePlan, Long&gt; im
171 182  
172 183 return rs;
173 184 }
  185 +
  186 + @Override
  187 + public ValidateRuleResult validateRule(Integer xlId, Date from, Date to) {
  188 + KieSession session = validateKBase.newKieSession();
  189 + session.setGlobal("LOG", logger);
  190 + session.setGlobal("ccRepo", carConfigInfoRepository);
  191 + session.setGlobal("lpRepo", guideboardInfoRepository);
  192 + session.setGlobal("ecRepo", employeeConfigInfoRepository);
  193 + session.setGlobal("ruleRepo", scheduleRule1FlatRepository);
  194 +
  195 + ValidateRuleResult result = new ValidateRuleResult();
  196 + session.setGlobal("result", result);
  197 +
  198 + com.bsth.service.schedule.impl.plan.kBase3.validate.rule.CalcuParam calcuParam =
  199 + new com.bsth.service.schedule.impl.plan.kBase3.validate.rule.CalcuParam();
  200 + calcuParam.setXlId(xlId);
  201 + calcuParam.setFromDate(new DateTime(from));
  202 + calcuParam.setToDate(new DateTime(to));
  203 + session.insert(calcuParam);
  204 +
  205 + session.fireAllRules();
  206 +
  207 + session.dispose();;
  208 +
  209 + return result;
  210 + }
174 211 }
... ...
src/main/java/com/bsth/service/schedule/plan/DroolsSchedulePlan.java renamed to src/main/java/com/bsth/service/schedule/impl/plan/DroolsSchedulePlan.java
1   -package com.bsth.service.schedule.plan;
  1 +package com.bsth.service.schedule.impl.plan;
2 2  
3 3 import com.bsth.entity.Line;
4 4 import com.bsth.entity.schedule.SchedulePlan;
... ... @@ -8,17 +8,16 @@ import com.bsth.entity.schedule.rule.ScheduleRule1Flat;
8 8 import com.bsth.repository.BusinessRepository;
9 9 import com.bsth.repository.LineRepository;
10 10 import com.bsth.repository.schedule.*;
11   -import com.bsth.service.schedule.rules.ScheduleRuleService;
12   -import com.bsth.service.schedule.rules.plan.PlanCalcuParam_input;
13   -import com.bsth.service.schedule.rules.plan.PlanResult;
14   -import com.bsth.service.schedule.rules.rerun.RerunRule_input;
15   -import com.bsth.service.schedule.rules.rerun.RerunRule_param;
16   -import com.bsth.service.schedule.rules.shiftloop.ScheduleCalcuParam_input;
17   -import com.bsth.service.schedule.rules.shiftloop.ScheduleResults_output;
18   -import com.bsth.service.schedule.rules.shiftloop.ScheduleRule_input;
19   -import com.bsth.service.schedule.rules.ttinfo.*;
20   -import com.bsth.service.schedule.rules.validate.ValidateParam;
21   -import com.bsth.service.schedule.rules.validate.ValidateResults_output;
  11 +import com.bsth.service.schedule.impl.plan.kBase1.core.plan.PlanCalcuParam_input;
  12 +import com.bsth.service.schedule.impl.plan.kBase1.core.plan.PlanResult;
  13 +import com.bsth.service.schedule.impl.plan.kBase1.core.rerun.RerunRule_input;
  14 +import com.bsth.service.schedule.impl.plan.kBase1.core.rerun.RerunRule_param;
  15 +import com.bsth.service.schedule.impl.plan.kBase1.core.shiftloop.ScheduleCalcuParam_input;
  16 +import com.bsth.service.schedule.impl.plan.kBase1.core.shiftloop.ScheduleResults_output;
  17 +import com.bsth.service.schedule.impl.plan.kBase1.core.shiftloop.ScheduleRule_input;
  18 +import com.bsth.service.schedule.impl.plan.kBase1.core.ttinfo.*;
  19 +import com.bsth.service.schedule.impl.plan.kBase1.core.validate.ValidateParam;
  20 +import com.bsth.service.schedule.impl.plan.kBase1.core.validate.ValidateResults_output;
22 21 import org.apache.commons.lang3.StringUtils;
23 22 import org.joda.time.DateTime;
24 23 import org.kie.api.KieBase;
... ...
src/main/java/com/bsth/service/schedule/rules/MyDroolsConfiguration.java renamed to src/main/java/com/bsth/service/schedule/impl/plan/MyDroolsConfiguration.java
1   -package com.bsth.service.schedule.rules;
  1 +package com.bsth.service.schedule.impl.plan;
2 2  
3 3 import org.kie.api.KieBase;
4 4 import org.kie.api.KieBaseConfiguration;
... ... @@ -56,27 +56,24 @@ public class MyDroolsConfiguration {
56 56 // 3.2、写入drl(写法超多,有点混乱)
57 57 // 这里使用文件的形式写入,TODO:以后考虑从数据库中读drl写入
58 58 // 注意kfs写的时候如果指定path,强制为src/main/resources/加上文件名,还有就是文件名不要重复否则会覆盖的
59   - kfs.write("src/main/resources/functions.drl", kieServices.getResources()
  59 + kfs.write("src/main/resources/kBase1_core_shiftloop.drl", kieServices.getResources()
60 60 .newInputStreamResource(this.getClass().getResourceAsStream(
61   - "/rules/functions.drl"), "UTF-8"));
62   - kfs.write("src/main/resources/shiftloop_fb_2.drl", kieServices.getResources()
  61 + "/rules/kBase1_core_shiftloop.drl"), "UTF-8"));
  62 + kfs.write("src/main/resources/kBase1_core_ttinfo.drl", kieServices.getResources()
63 63 .newInputStreamResource(this.getClass().getResourceAsStream(
64   - "/rules/shiftloop_fb_2.drl"), "UTF-8"));
65   - kfs.write("src/main/resources/ttinfo.drl", kieServices.getResources()
  64 + "/rules/kBase1_core_ttinfo.drl"), "UTF-8"));
  65 + kfs.write("src/main/resources/kBase1_core_plan.drl", kieServices.getResources()
66 66 .newInputStreamResource(this.getClass().getResourceAsStream(
67   - "/rules/ttinfo.drl"), "UTF-8"));
68   - kfs.write("src/main/resources/ttinfo2.drl", kieServices.getResources()
  67 + "/rules/kBase1_core_plan.drl"), "UTF-8"));
  68 + kfs.write("src/main/resources/kBase1_core_rerun.drl", kieServices.getResources()
69 69 .newInputStreamResource(this.getClass().getResourceAsStream(
70   - "/rules/ttinfo2.drl"), "UTF-8"));
71   - kfs.write("src/main/resources/plan.drl", kieServices.getResources()
  70 + "/rules/kBase1_core_rerun.drl"), "UTF-8"));
  71 + kfs.write("src/main/resources/kBase1_core_validate.drl", kieServices.getResources()
72 72 .newInputStreamResource(this.getClass().getResourceAsStream(
73   - "/rules/plan.drl"), "UTF-8"));
74   - kfs.write("src/main/resources/rerun.drl", kieServices.getResources()
  73 + "/rules/kBase1_core_validate.drl"), "UTF-8"));
  74 + kfs.write("src/main/resources/kBase1_core_functions.drl", kieServices.getResources()
75 75 .newInputStreamResource(this.getClass().getResourceAsStream(
76   - "/rules/rerun.drl"), "UTF-8"));
77   - kfs.write("src/main/resources/validplan.drl", kieServices.getResources()
78   - .newInputStreamResource(this.getClass().getResourceAsStream(
79   - "/rules/validplan.drl"), "UTF-8"));
  76 + "/rules/kBase1_core_functions.drl"), "UTF-8"));
80 77 // TODO:还有其他drl....
81 78  
82 79 // 4、创建KieBuilder,使用KieFileSystem构建
... ... @@ -134,9 +131,9 @@ public class MyDroolsConfiguration {
134 131 // 这里使用文件的形式写入,TODO:以后考虑从数据库中读drl写入
135 132 // 注意kfs写的时候如果指定path,强制为src/main/resources/加上文件名,还有就是文件名不要重复否则会覆盖的
136 133  
137   - kfs.write("src/main/resources/ruleWrap.drl", kieServices.getResources()
  134 + kfs.write("src/main/resources/kBase2_wrap_rule.drl", kieServices.getResources()
138 135 .newInputStreamResource(this.getClass().getResourceAsStream(
139   - "/rules/ruleWrap.drl"), "UTF-8"));
  136 + "/rules/kBase2_wrap_rule.drl"), "UTF-8"));
140 137  
141 138 // TODO:还有其他drl....
142 139  
... ... @@ -161,4 +158,52 @@ public class MyDroolsConfiguration {
161 158  
162 159 return kieBase;
163 160 }
  161 +
  162 + /**
  163 + * 验证相关的drl知识库。
  164 + * @return
  165 + */
  166 + @Bean(name = "KBase3")
  167 + public KieBase myKieBase3() {
  168 + KieServices kieServices = KieServices.Factory.get();
  169 + KieModuleModel kieModuleModel = kieServices.newKieModuleModel();
  170 + KieBaseModel kieBaseModel = kieModuleModel.newKieBaseModel("KBase3")
  171 + .setDefault(true)
  172 + .setEqualsBehavior(EqualityBehaviorOption.EQUALITY)
  173 + .setEventProcessingMode(EventProcessingOption.STREAM);
  174 + kieBaseModel.newKieSessionModel("KSession1")
  175 + .setDefault(true)
  176 + .setType(KieSessionModel.KieSessionType.STATEFUL)
  177 + .setClockType(ClockTypeOption.get("realtime"));
  178 +
  179 + KieFileSystem kieFileSystem = kieServices.newKieFileSystem();
  180 + kieFileSystem.writeKModuleXML(kieModuleModel.toXML());
  181 +
  182 + kieFileSystem.write(
  183 + "src/main/resources/kBase3_validate_timetable.drl",
  184 + kieServices.getResources().newInputStreamResource(
  185 + this.getClass().getResourceAsStream("/rules/kBase3_validate_timetable.drl"),
  186 + "UTF-8"));
  187 + kieFileSystem.write(
  188 + "src/main/resources/kbase3_validate_rule.drl",
  189 + kieServices.getResources().newInputStreamResource(
  190 + this.getClass().getResourceAsStream("/rules/kBase3_validate_rule.drl"),
  191 + "UTF-8"));
  192 +
  193 + KieBuilder kieBuilder = kieServices.newKieBuilder(kieFileSystem).buildAll();
  194 + Results results = kieBuilder.getResults();
  195 + if (results.hasMessages(Message.Level.ERROR)) {
  196 + throw new IllegalStateException("构建drools6错误:" + results.getMessages());
  197 + }
  198 +
  199 + ReleaseId releaseId = kieServices.getRepository().getDefaultReleaseId();
  200 + KieContainer kieContainer = kieServices.newKieContainer(releaseId);
  201 +
  202 + KieBaseConfiguration kieBaseConfiguration = kieServices.newKieBaseConfiguration();
  203 + KieBase kieBase = kieContainer.newKieBase("KBase3", kieBaseConfiguration);
  204 +
  205 + return kieBase;
  206 +
  207 + }
  208 +
164 209 }
... ...
src/main/java/com/bsth/service/schedule/rules/ScheduleRuleService.java renamed to src/main/java/com/bsth/service/schedule/impl/plan/ScheduleRuleService.java
1   -package com.bsth.service.schedule.rules;
  1 +package com.bsth.service.schedule.impl.plan;
2 2  
3 3 import com.bsth.entity.schedule.SchedulePlan;
4 4 import com.bsth.entity.schedule.SchedulePlanInfo;
5 5 import com.bsth.entity.schedule.temp.SchedulePlanRuleResult;
6   -import com.bsth.service.schedule.rules.rerun.RerunRule_input;
  6 +import com.bsth.service.schedule.impl.plan.kBase1.core.rerun.RerunRule_input;
7 7  
8 8 import java.util.Date;
9 9 import java.util.List;
... ...
src/main/java/com/bsth/service/schedule/rules/ScheduleRuleServiceImpl.java renamed to src/main/java/com/bsth/service/schedule/impl/plan/ScheduleRuleServiceImpl.java
1   -package com.bsth.service.schedule.rules;
  1 +package com.bsth.service.schedule.impl.plan;
2 2  
3 3 import com.bsth.entity.schedule.SchedulePlan;
4 4 import com.bsth.entity.schedule.SchedulePlanInfo;
5 5 import com.bsth.entity.schedule.temp.SchedulePlanRuleResult;
6   -import com.bsth.service.schedule.rules.rerun.RerunRule_input;
  6 +import com.bsth.service.schedule.impl.plan.kBase1.core.rerun.RerunRule_input;
7 7 import org.slf4j.Logger;
8 8 import org.slf4j.LoggerFactory;
9 9 import org.springframework.beans.factory.annotation.Autowired;
... ...
src/main/java/com/bsth/service/schedule/rules/plan/PlanCalcuParam_input.java renamed to src/main/java/com/bsth/service/schedule/impl/plan/kBase1/core/plan/PlanCalcuParam_input.java
1   -package com.bsth.service.schedule.rules.plan;
  1 +package com.bsth.service.schedule.impl.plan.kBase1.core.plan;
2 2  
3 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;
  4 +import com.bsth.service.schedule.impl.plan.kBase1.core.shiftloop.ScheduleResults_output;
  5 +import com.bsth.service.schedule.impl.plan.kBase1.core.ttinfo.TTInfoResults_output;
6 6  
7 7 /**
8 8 * 排班规则-规则输入参数。
... ...
src/main/java/com/bsth/service/schedule/rules/plan/PlanResult.java renamed to src/main/java/com/bsth/service/schedule/impl/plan/kBase1/core/plan/PlanResult.java
1   -package com.bsth.service.schedule.rules.plan;
  1 +package com.bsth.service.schedule.impl.plan.kBase1.core.plan;
2 2  
3 3 import com.bsth.entity.schedule.SchedulePlanInfo;
4 4  
... ...
src/main/java/com/bsth/service/schedule/rules/plan/readme.txt renamed to src/main/java/com/bsth/service/schedule/impl/plan/kBase1/core/plan/readme.txt
src/main/java/com/bsth/service/schedule/rules/rerun/RerunRule_input.java renamed to src/main/java/com/bsth/service/schedule/impl/plan/kBase1/core/rerun/RerunRule_input.java
1   -package com.bsth.service.schedule.rules.rerun;
  1 +package com.bsth.service.schedule.impl.plan.kBase1.core.rerun;
2 2  
3 3 /**
4 4 * Created by xu on 17/4/26.
... ...
src/main/java/com/bsth/service/schedule/rules/rerun/RerunRule_param.java renamed to src/main/java/com/bsth/service/schedule/impl/plan/kBase1/core/rerun/RerunRule_param.java
1   -package com.bsth.service.schedule.rules.rerun;
  1 +package com.bsth.service.schedule.impl.plan.kBase1.core.rerun;
2 2  
3 3 import java.util.Set;
4 4  
... ...
src/main/java/com/bsth/service/schedule/rules/shiftloop/GidFbFcnoFunction.java renamed to src/main/java/com/bsth/service/schedule/impl/plan/kBase1/core/shiftloop/GidFbFcnoFunction.java
1   -package com.bsth.service.schedule.rules.shiftloop;
  1 +package com.bsth.service.schedule.impl.plan.kBase1.core.shiftloop;
2 2  
3 3 import com.bsth.entity.schedule.TTInfoDetail;
4 4 import org.kie.api.runtime.rule.AccumulateFunction;
... ...
src/main/java/com/bsth/service/schedule/rules/shiftloop/GidFbTimeFunction.java renamed to src/main/java/com/bsth/service/schedule/impl/plan/kBase1/core/shiftloop/GidFbTimeFunction.java
1   -package com.bsth.service.schedule.rules.shiftloop;
  1 +package com.bsth.service.schedule.impl.plan.kBase1.core.shiftloop;
2 2  
3 3 import com.bsth.entity.schedule.TTInfoDetail;
4 4 import org.joda.time.LocalTime;
... ...
src/main/java/com/bsth/service/schedule/rules/shiftloop/GidsCountFunction.java renamed to src/main/java/com/bsth/service/schedule/impl/plan/kBase1/core/shiftloop/GidsCountFunction.java
1   -package com.bsth.service.schedule.rules.shiftloop;
  1 +package com.bsth.service.schedule.impl.plan.kBase1.core.shiftloop;
2 2  
3 3 import com.bsth.entity.schedule.TTInfoDetail;
4 4 import org.kie.api.runtime.rule.AccumulateFunction;
... ...
src/main/java/com/bsth/service/schedule/rules/shiftloop/ScheduleCalcuParam_input.java renamed to src/main/java/com/bsth/service/schedule/impl/plan/kBase1/core/shiftloop/ScheduleCalcuParam_input.java
1   -package com.bsth.service.schedule.rules.shiftloop;
  1 +package com.bsth.service.schedule.impl.plan.kBase1.core.shiftloop;
2 2  
3 3 import com.bsth.entity.schedule.SchedulePlan;
4 4 import org.joda.time.DateTime;
... ...
src/main/java/com/bsth/service/schedule/rules/shiftloop/ScheduleResult_output.java renamed to src/main/java/com/bsth/service/schedule/impl/plan/kBase1/core/shiftloop/ScheduleResult_output.java
1   -package com.bsth.service.schedule.rules.shiftloop;
  1 +package com.bsth.service.schedule.impl.plan.kBase1.core.shiftloop;
2 2  
3 3 import org.joda.time.DateTime;
4 4  
... ...
src/main/java/com/bsth/service/schedule/rules/shiftloop/ScheduleResults_output.java renamed to src/main/java/com/bsth/service/schedule/impl/plan/kBase1/core/shiftloop/ScheduleResults_output.java
1   -package com.bsth.service.schedule.rules.shiftloop;
  1 +package com.bsth.service.schedule.impl.plan.kBase1.core.shiftloop;
2 2  
3 3 import com.bsth.entity.schedule.temp.SchedulePlanRuleResult;
4 4 import org.apache.commons.lang3.StringUtils;
... ...
src/main/java/com/bsth/service/schedule/rules/shiftloop/ScheduleRule_Type.java renamed to src/main/java/com/bsth/service/schedule/impl/plan/kBase1/core/shiftloop/ScheduleRule_Type.java
1   -package com.bsth.service.schedule.rules.shiftloop;
  1 +package com.bsth.service.schedule.impl.plan.kBase1.core.shiftloop;
2 2  
3 3 /**
4 4 * 排班规则_输入_输出_类型。
... ...
src/main/java/com/bsth/service/schedule/rules/shiftloop/ScheduleRule_input.java renamed to src/main/java/com/bsth/service/schedule/impl/plan/kBase1/core/shiftloop/ScheduleRule_input.java
1   -package com.bsth.service.schedule.rules.shiftloop;
  1 +package com.bsth.service.schedule.impl.plan.kBase1.core.shiftloop;
2 2  
3 3 import com.bsth.entity.schedule.rule.ScheduleRule1Flat;
4 4 import com.google.common.base.Splitter;
... ...
src/main/java/com/bsth/service/schedule/rules/ttinfo/LpInfoResult_output.java renamed to src/main/java/com/bsth/service/schedule/impl/plan/kBase1/core/ttinfo/LpInfoResult_output.java
1   -package com.bsth.service.schedule.rules.ttinfo;
  1 +package com.bsth.service.schedule.impl.plan.kBase1.core.ttinfo;
2 2  
3 3 import org.joda.time.DateTime;
4 4  
... ...
src/main/java/com/bsth/service/schedule/rules/ttinfo/LpInfoResultsFunction.java renamed to src/main/java/com/bsth/service/schedule/impl/plan/kBase1/core/ttinfo/LpInfoResultsFunction.java
1   -package com.bsth.service.schedule.rules.ttinfo;
  1 +package com.bsth.service.schedule.impl.plan.kBase1.core.ttinfo;
2 2  
3 3 import com.bsth.entity.schedule.TTInfoDetail;
4 4 import org.kie.api.runtime.rule.AccumulateFunction;
... ...
src/main/java/com/bsth/service/schedule/rules/ttinfo/LpInfoResults_output.java renamed to src/main/java/com/bsth/service/schedule/impl/plan/kBase1/core/ttinfo/LpInfoResults_output.java
1   -package com.bsth.service.schedule.rules.ttinfo;
  1 +package com.bsth.service.schedule.impl.plan.kBase1.core.ttinfo;
2 2  
3 3 import java.util.ArrayList;
4 4 import java.util.List;
... ...
src/main/java/com/bsth/service/schedule/rules/ttinfo/MinRuleQyrqFunction.java renamed to src/main/java/com/bsth/service/schedule/impl/plan/kBase1/core/ttinfo/MinRuleQyrqFunction.java
1   -package com.bsth.service.schedule.rules.ttinfo;
  1 +package com.bsth.service.schedule.impl.plan.kBase1.core.ttinfo;
2 2  
3   -import com.bsth.service.schedule.rules.shiftloop.ScheduleRule_input;
  3 +import com.bsth.service.schedule.impl.plan.kBase1.core.shiftloop.ScheduleRule_input;
4 4 import org.joda.time.DateTime;
5 5 import org.kie.api.runtime.rule.AccumulateFunction;
6 6  
... ...
src/main/java/com/bsth/service/schedule/rules/ttinfo/TTInfoCalcuParam_input.java renamed to src/main/java/com/bsth/service/schedule/impl/plan/kBase1/core/ttinfo/TTInfoCalcuParam_input.java
1   -package com.bsth.service.schedule.rules.ttinfo;
  1 +package com.bsth.service.schedule.impl.plan.kBase1.core.ttinfo;
2 2  
3 3 import org.joda.time.DateTime;
4 4  
... ...
src/main/java/com/bsth/service/schedule/rules/ttinfo/TTInfoResult_output.java renamed to src/main/java/com/bsth/service/schedule/impl/plan/kBase1/core/ttinfo/TTInfoResult_output.java
1   -package com.bsth.service.schedule.rules.ttinfo;
  1 +package com.bsth.service.schedule.impl.plan.kBase1.core.ttinfo;
2 2  
3 3 import org.joda.time.DateTime;
4 4  
... ...
src/main/java/com/bsth/service/schedule/rules/ttinfo/TTInfoResults_output.java renamed to src/main/java/com/bsth/service/schedule/impl/plan/kBase1/core/ttinfo/TTInfoResults_output.java
1   -package com.bsth.service.schedule.rules.ttinfo;
  1 +package com.bsth.service.schedule.impl.plan.kBase1.core.ttinfo;
2 2  
3 3 import com.google.common.collect.ArrayListMultimap;
4 4 import com.google.common.collect.Multimap;
... ...
src/main/java/com/bsth/service/schedule/rules/ttinfo/TTInfo_input.java renamed to src/main/java/com/bsth/service/schedule/impl/plan/kBase1/core/ttinfo/TTInfo_input.java
1   -package com.bsth.service.schedule.rules.ttinfo;
  1 +package com.bsth.service.schedule.impl.plan.kBase1.core.ttinfo;
2 2  
3 3 import com.bsth.entity.schedule.TTInfo;
4 4 import org.apache.commons.lang3.StringUtils;
... ...
src/main/java/com/bsth/service/schedule/rules/ttinfo/readme.txt renamed to src/main/java/com/bsth/service/schedule/impl/plan/kBase1/core/ttinfo/readme.txt
src/main/java/com/bsth/service/schedule/rules/validate/ValidRepeatBcFunction.java renamed to src/main/java/com/bsth/service/schedule/impl/plan/kBase1/core/validate/ValidRepeatBcFunction.java
1   -package com.bsth.service.schedule.rules.validate;
  1 +package com.bsth.service.schedule.impl.plan.kBase1.core.validate;
2 2  
3 3 import com.bsth.entity.schedule.SchedulePlanInfo;
4 4 import org.kie.api.runtime.rule.AccumulateFunction;
... ...
src/main/java/com/bsth/service/schedule/rules/validate/ValidWantLpFunction.java renamed to src/main/java/com/bsth/service/schedule/impl/plan/kBase1/core/validate/ValidWantLpFunction.java
1   -package com.bsth.service.schedule.rules.validate;
  1 +package com.bsth.service.schedule.impl.plan.kBase1.core.validate;
2 2  
3 3 import com.bsth.entity.schedule.SchedulePlanInfo;
4   -import com.bsth.service.schedule.rules.ttinfo.LpInfoResult_output;
  4 +import com.bsth.service.schedule.impl.plan.kBase1.core.ttinfo.LpInfoResult_output;
5 5 import org.kie.api.runtime.rule.AccumulateFunction;
6 6  
7 7 import java.io.*;
... ...
src/main/java/com/bsth/service/schedule/rules/validate/ValidWholeRerunBcFunction.java renamed to src/main/java/com/bsth/service/schedule/impl/plan/kBase1/core/validate/ValidWholeRerunBcFunction.java
1   -package com.bsth.service.schedule.rules.validate;
  1 +package com.bsth.service.schedule.impl.plan.kBase1.core.validate;
2 2  
3 3 import com.bsth.entity.schedule.SchedulePlanInfo;
4 4 import org.kie.api.runtime.rule.AccumulateFunction;
... ...
src/main/java/com/bsth/service/schedule/rules/validate/ValidateParam.java renamed to src/main/java/com/bsth/service/schedule/impl/plan/kBase1/core/validate/ValidateParam.java
1   -package com.bsth.service.schedule.rules.validate;
  1 +package com.bsth.service.schedule.impl.plan.kBase1.core.validate;
2 2  
3 3 import org.joda.time.DateTime;
4 4 import org.joda.time.Period;
... ...
src/main/java/com/bsth/service/schedule/rules/validate/ValidateResource.java renamed to src/main/java/com/bsth/service/schedule/impl/plan/kBase1/core/validate/ValidateResource.java
1   -package com.bsth.service.schedule.rules.validate;
  1 +package com.bsth.service.schedule.impl.plan.kBase1.core.validate;
2 2  
3 3 import com.bsth.entity.schedule.SchedulePlanInfo;
4   -import com.bsth.service.schedule.rules.ttinfo.LpInfoResult_output;
  4 +import com.bsth.service.schedule.impl.plan.kBase1.core.ttinfo.LpInfoResult_output;
5 5  
6 6 import java.util.Date;
7 7 import java.util.List;
... ...
src/main/java/com/bsth/service/schedule/rules/validate/ValidateResults_output.java renamed to src/main/java/com/bsth/service/schedule/impl/plan/kBase1/core/validate/ValidateResults_output.java
1   -package com.bsth.service.schedule.rules.validate;
  1 +package com.bsth.service.schedule.impl.plan.kBase1.core.validate;
2 2  
3 3 import java.util.ArrayList;
4 4 import java.util.Date;
... ...
src/main/java/com/bsth/service/schedule/impl/plan/kBase3/validate/rule/CalcuParam.java 0 → 100644
  1 +package com.bsth.service.schedule.impl.plan.kBase3.validate.rule;
  2 +
  3 +import org.joda.time.DateTime;
  4 +
  5 +/**
  6 + * 计算用参数。
  7 + */
  8 +public class CalcuParam {
  9 + /** 线路Id */
  10 + private Integer xlId;
  11 +
  12 + /** 计划开始计算日期 */
  13 + private DateTime fromDate;
  14 + /** 计划结束计算日期 */
  15 + private DateTime toDate;
  16 +
  17 + public Integer getXlId() {
  18 + return xlId;
  19 + }
  20 +
  21 + public void setXlId(Integer xlId) {
  22 + this.xlId = xlId;
  23 + }
  24 +
  25 + public DateTime getFromDate() {
  26 + return fromDate;
  27 + }
  28 +
  29 + public void setFromDate(DateTime fromDate) {
  30 + this.fromDate = fromDate;
  31 + }
  32 +
  33 + public DateTime getToDate() {
  34 + return toDate;
  35 + }
  36 +
  37 + public void setToDate(DateTime toDate) {
  38 + this.toDate = toDate;
  39 + }
  40 +}
... ...
src/main/java/com/bsth/service/schedule/impl/plan/kBase3/validate/rule/ErrorInfoFunction.java 0 → 100644
  1 +package com.bsth.service.schedule.impl.plan.kBase3.validate.rule;
  2 +
  3 +
  4 +import com.bsth.entity.schedule.EmployeeConfigInfo;
  5 +import com.bsth.entity.schedule.GuideboardInfo;
  6 +import org.apache.commons.lang3.StringUtils;
  7 +import org.apache.commons.lang3.math.NumberUtils;
  8 +import org.kie.api.runtime.rule.AccumulateFunction;
  9 +
  10 +import java.io.*;
  11 +import java.util.HashMap;
  12 +import java.util.Map;
  13 +
  14 +/**
  15 + * 查找错误函数。
  16 + */
  17 +public class ErrorInfoFunction implements AccumulateFunction {
  18 + @Override
  19 + public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
  20 +
  21 + }
  22 +
  23 + @Override
  24 + public void writeExternal(ObjectOutput out) throws IOException {
  25 +
  26 + }
  27 +
  28 + protected static class ErrorInfoContext implements Externalizable {
  29 + /** 错误数量 */
  30 + public Integer errorCount = 0;
  31 + /** 错误Map,Map<规则id,errorInfo> */
  32 + public Map<Long, ValidateRuleResult.ErrorInfo> errorInfoMap = new HashMap<>();
  33 +
  34 + public ErrorInfoContext() {
  35 +
  36 + }
  37 +
  38 + @Override
  39 + public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
  40 + errorCount = in.readInt();
  41 + errorInfoMap = (Map<Long, ValidateRuleResult.ErrorInfo>) in.readObject();
  42 +
  43 + }
  44 +
  45 + @Override
  46 + public void writeExternal(ObjectOutput out) throws IOException {
  47 + out.writeInt(errorCount);
  48 + out.writeObject(errorInfoMap);
  49 + }
  50 +
  51 + }
  52 +
  53 + @Override
  54 + public Serializable createContext() {
  55 + return new ErrorInfoContext();
  56 + }
  57 +
  58 + @Override
  59 + public void init(Serializable serializable) throws Exception {
  60 + ErrorInfoContext errorInfoContext = (ErrorInfoContext) serializable;
  61 + errorInfoContext.errorCount = 0;
  62 + errorInfoContext.errorInfoMap = new HashMap<>();
  63 + }
  64 +
  65 + @Override
  66 + public void accumulate(Serializable serializable, Object o) {
  67 + ErrorInfoContext errorInfoContext = (ErrorInfoContext) serializable;
  68 + WrapInput wrapInput = (WrapInput) o;
  69 +
  70 + ValidateRuleResult.ErrorInfo errorInfo = new ValidateRuleResult.ErrorInfo();
  71 + errorInfo.setRuleId(wrapInput.getRuleId());
  72 + errorInfo.setClZbh(wrapInput.getClZbh());
  73 + errorInfo.setQyrq(wrapInput.getQyrq());
  74 +
  75 + // 1、车辆配置验证
  76 + if (StringUtils.isNotEmpty(wrapInput.getClZbh())) { // 自编号不能为空
  77 + if (wrapInput.getCcInfos().get(wrapInput.getClZbh()) == null) { // 车辆配置不在当前线路上
  78 + errorInfo.getErrorDescList().add("车辆配置不在当前线路,请重新编辑保存!");
  79 + }
  80 + } else {
  81 + errorInfo.getErrorDescList().add("自编号不能为空,请重新编辑保存!");
  82 + }
  83 +
  84 + // 2、路牌id,路牌名字,路牌起始索引验证
  85 + if (StringUtils.isNotEmpty(wrapInput.getLpIds()) &&
  86 + StringUtils.isNotEmpty(wrapInput.getLpNames())) { // 冗余的路牌id和路牌名字都不能为空
  87 + String[] lpIds = wrapInput.getLpIds().split(",");
  88 + String[] lpNames = wrapInput.getLpNames().split(",");
  89 + if (lpIds.length == lpNames.length) { // 路牌id和路牌名字个数一致
  90 + for (int i = 0; i < lpIds.length; i++) {
  91 + if (!NumberUtils.isDigits(lpIds[i])) { // 冗余路牌id必须是数字
  92 + errorInfo.getErrorDescList().add("冗余路牌id必须是数字,请重新编辑保存!");
  93 + break;
  94 + }
  95 +
  96 + GuideboardInfo lpInfo = wrapInput.getLpInfos().get(NumberUtils.toLong(lpIds[i]));
  97 + if (lpInfo == null) { // 路牌不在当前线路上
  98 + errorInfo.getErrorDescList().add("路牌不在当前线路上,请重新编辑保存!");
  99 + } else {
  100 + if (StringUtils.isEmpty(lpNames[i]) ||
  101 + !(lpNames[i].equals(lpInfo.getLpName()))) { // 路牌id和路牌名字不对应
  102 + errorInfo.getErrorDescList().add("路牌id和路牌名字不对应,请重新编辑保存!");
  103 + break;
  104 + }
  105 + }
  106 + }
  107 +
  108 + if (wrapInput.getLpStartIndex() < 1 ||
  109 + wrapInput.getLpStartIndex() > lpIds.length) { // 路牌起始索引溢出
  110 + errorInfo.getErrorDescList().add("路牌起始索引溢出,请重新编辑保存!");
  111 + }
  112 + } else {
  113 + errorInfo.getErrorDescList().add("路牌id和路牌名字个数不一致,请重新编辑保存!");
  114 + }
  115 + } else {
  116 + errorInfo.getErrorDescList().add("冗余的路牌id和路牌名字都不能为空,请重新编辑保存!");
  117 + }
  118 +
  119 + // 3、人员配置,搭班编码,人员起始索引验证
  120 + if (StringUtils.isNotEmpty(wrapInput.getEcIds()) &&
  121 + StringUtils.isNotEmpty(wrapInput.getEcDbbms())) { // 冗余的人员配置id和人员搭班编码都不能为空
  122 + String[] ecIds = wrapInput.getEcIds().split(",");
  123 + String[] ecDbbms = wrapInput.getEcDbbms().split(",");
  124 + if (ecIds.length == ecDbbms.length) { // 人员配置id和搭班编码个数一致
  125 + for (int i = 0; i < ecIds.length; i++) {
  126 + if (ecIds[i].contains("-")) { // 分班标识
  127 + String[] fb_ecIds = ecIds[i].split("-");
  128 + String[] fb_ecDbbms = ecDbbms[i].split("-");
  129 + if (fb_ecIds.length != 2 || fb_ecDbbms.length != 2) { // 只能早晚分班
  130 + errorInfo.getErrorDescList().add("只能早晚分班,请重新编辑保存!");
  131 + break;
  132 + } else {
  133 + EmployeeConfigInfo fb_ecInfo1 = wrapInput.getEcInfos().get(NumberUtils.toLong(fb_ecIds[0]));
  134 + EmployeeConfigInfo fb_ecInfo2 = wrapInput.getEcInfos().get(NumberUtils.toLong(fb_ecIds[1]));
  135 + if (fb_ecInfo1 == null || fb_ecInfo2 == null) { // 分班的人员配置不在当前线路
  136 + errorInfo.getErrorDescList().add("分班的人员配置不在当前线路,请重新编辑保存!");
  137 + break;
  138 + } else {
  139 + if (StringUtils.isEmpty(fb_ecDbbms[0]) ||
  140 + StringUtils.isEmpty(fb_ecDbbms[1]) ||
  141 + !(fb_ecDbbms[0].equals(fb_ecInfo1.getDbbm())) ||
  142 + !(fb_ecDbbms[1].equals(fb_ecInfo2.getDbbm()))) { // 分班人员配置id和搭班编码不对应
  143 + errorInfo.getErrorDescList().add("分班人员配置id和搭班编码不对应,请重新编辑保存!");
  144 + break;
  145 + }
  146 + }
  147 + }
  148 +
  149 + } else {
  150 + if (!NumberUtils.isDigits(ecIds[i])) { // 冗余的人员配置id必须是数字
  151 + errorInfo.getErrorDescList().add("冗余的人员配置id必须是数字,请重新编辑保存!");
  152 + break;
  153 + }
  154 +
  155 + EmployeeConfigInfo ecInfo = wrapInput.getEcInfos().get(NumberUtils.toLong(ecIds[i]));
  156 + if (ecInfo == null) { // 人员配置不在当前线路
  157 + errorInfo.getErrorDescList().add("人员配置不在当前线路,请重新编辑保存!");
  158 + break;
  159 + } else {
  160 + if (StringUtils.isEmpty(ecDbbms[i]) ||
  161 + !(ecDbbms[i].equals(ecInfo.getDbbm()))) { // 人员配置id和搭班编码不对应
  162 + errorInfo.getErrorDescList().add("人员配置id和搭班编码不对应,请重新编辑保存!");
  163 + break;
  164 + }
  165 + }
  166 + }
  167 + }
  168 +
  169 + if (wrapInput.getEcStartIndex() < 1 ||
  170 + wrapInput.getEcStartIndex() > ecIds.length) { // 人员起始索引溢出
  171 + errorInfo.getErrorDescList().add("人员起始索引溢出,请重新编辑保存!");
  172 + }
  173 + } else {
  174 + errorInfo.getErrorDescList().add("人员配置id和搭班编码个数不一致,请重新编辑保存!");
  175 + }
  176 + }
  177 +
  178 + if (errorInfo.getErrorDescList().size() > 0) {
  179 + errorInfoContext.errorCount ++;
  180 + errorInfoContext.errorInfoMap.put(wrapInput.getRuleId(), errorInfo);
  181 + }
  182 +
  183 + }
  184 +
  185 + @Override
  186 + public void reverse(Serializable serializable, Object o) throws Exception {
  187 + ErrorInfoContext errorInfoContext = (ErrorInfoContext) serializable;
  188 + WrapInput wrapInput = (WrapInput) o;
  189 +
  190 + if (errorInfoContext.errorInfoMap.get(wrapInput.getRuleId()) != null) {
  191 + errorInfoContext.errorInfoMap.remove(wrapInput.getRuleId());
  192 + errorInfoContext.errorCount --;
  193 + }
  194 + }
  195 +
  196 + @Override
  197 + public Object getResult(Serializable serializable) throws Exception {
  198 + ErrorInfoContext errorInfoContext = (ErrorInfoContext) serializable;
  199 + return errorInfoContext.errorInfoMap;
  200 + }
  201 +
  202 + @Override
  203 + public boolean supportsReverse() {
  204 + return true;
  205 + }
  206 +
  207 + @Override
  208 + public Class<?> getResultType() {
  209 + return Map.class;
  210 + }
  211 +
  212 +}
... ...
src/main/java/com/bsth/service/schedule/impl/plan/kBase3/validate/rule/ValidateRuleResult.java 0 → 100644
  1 +package com.bsth.service.schedule.impl.plan.kBase3.validate.rule;
  2 +
  3 +import java.util.ArrayList;
  4 +import java.util.Date;
  5 +import java.util.List;
  6 +
  7 +/**
  8 + * 输出结果值。
  9 + */
  10 +public class ValidateRuleResult {
  11 + /** 线路id */
  12 + private Integer xlId;
  13 + /** 规则总数量 */
  14 + private Integer count;
  15 + /** 启用的规则数量 */
  16 + private Integer qyCount;
  17 + /** 启用规则中的错误数量 */
  18 + private Integer qyErrorCount;
  19 + /** 错误列表 */
  20 + private List<ErrorInfo> errorInfos = new ArrayList<>();
  21 +
  22 + public Integer getXlId() {
  23 + return xlId;
  24 + }
  25 +
  26 + public void setXlId(Integer xlId) {
  27 + this.xlId = xlId;
  28 + }
  29 +
  30 + public Integer getCount() {
  31 + return count;
  32 + }
  33 +
  34 + public void setCount(Integer count) {
  35 + this.count = count;
  36 + }
  37 +
  38 + public Integer getQyCount() {
  39 + return qyCount;
  40 + }
  41 +
  42 + public void setQyCount(Integer qyCount) {
  43 + this.qyCount = qyCount;
  44 + }
  45 +
  46 + public Integer getQyErrorCount() {
  47 + return qyErrorCount;
  48 + }
  49 +
  50 + public void setQyErrorCount(Integer qyErrorCount) {
  51 + this.qyErrorCount = qyErrorCount;
  52 + }
  53 +
  54 + public List<ErrorInfo> getErrorInfos() {
  55 + return errorInfos;
  56 + }
  57 +
  58 + public void setErrorInfos(List<ErrorInfo> errorInfos) {
  59 + this.errorInfos = errorInfos;
  60 + }
  61 +
  62 + public static class ErrorInfo {
  63 + /** 规则id */
  64 + private Long ruleId;
  65 + /** 车辆自编号 */
  66 + private String clZbh;
  67 + /** 启用日期 */
  68 + private Date qyrq;
  69 + /** 错误描述 */
  70 + private List<String> errorDescList = new ArrayList<>();
  71 +
  72 + public Long getRuleId() {
  73 + return ruleId;
  74 + }
  75 +
  76 + public void setRuleId(Long ruleId) {
  77 + this.ruleId = ruleId;
  78 + }
  79 +
  80 + public String getClZbh() {
  81 + return clZbh;
  82 + }
  83 +
  84 + public void setClZbh(String clZbh) {
  85 + this.clZbh = clZbh;
  86 + }
  87 +
  88 + public Date getQyrq() {
  89 + return qyrq;
  90 + }
  91 +
  92 + public void setQyrq(Date qyrq) {
  93 + this.qyrq = qyrq;
  94 + }
  95 +
  96 + public List<String> getErrorDescList() {
  97 + return errorDescList;
  98 + }
  99 +
  100 + public void setErrorDescList(List<String> errorDescList) {
  101 + this.errorDescList = errorDescList;
  102 + }
  103 + }
  104 +}
... ...
src/main/java/com/bsth/service/schedule/impl/plan/kBase3/validate/rule/WrapInput.java 0 → 100644
  1 +package com.bsth.service.schedule.impl.plan.kBase3.validate.rule;
  2 +
  3 +import com.bsth.entity.schedule.CarConfigInfo;
  4 +import com.bsth.entity.schedule.EmployeeConfigInfo;
  5 +import com.bsth.entity.schedule.GuideboardInfo;
  6 +import com.bsth.entity.schedule.rule.ScheduleRule1Flat;
  7 +import org.springframework.util.CollectionUtils;
  8 +
  9 +import java.util.*;
  10 +
  11 +/**
  12 + * 聚合输入的待判定数据。
  13 + */
  14 +public class WrapInput {
  15 + /** 线路Id */
  16 + private Integer xlId;
  17 + /** 车辆自编号 */
  18 + private String clZbh;
  19 + /** 路牌id列表 */
  20 + private String lpIds;
  21 + /** 路牌名字列表 */
  22 + private String lpNames;
  23 + /** 人员配置列表 */
  24 + private String ecIds;
  25 + /** 人员搭班编码列表 */
  26 + private String ecDbbms;
  27 + /** 路牌循环起始索引 */
  28 + private Integer lpStartIndex;
  29 + /** 人员循环起始索引 */
  30 + private Integer ecStartIndex;
  31 + /** 规则id */
  32 + private Long ruleId;
  33 + /** 启用日期 */
  34 + private Date qyrq;
  35 +
  36 + private Map<String, CarConfigInfo> ccInfos = new HashMap<>();
  37 + private Map<Long, GuideboardInfo> lpInfos = new HashMap<>();
  38 + private Map<Long, EmployeeConfigInfo> ecInfos = new HashMap<>();
  39 +
  40 + public WrapInput(ScheduleRule1Flat r,
  41 + Map<String, CarConfigInfo> cc,
  42 + Map<Long, GuideboardInfo> lp,
  43 + Map<Long, EmployeeConfigInfo> ec) {
  44 + this.xlId = r.getXl().getId();
  45 + this.clZbh = r.getCarConfigInfo().getCl().getInsideCode();
  46 + this.lpIds = r.getLpIds();
  47 + this.lpNames = r.getLpNames();
  48 + this.ecIds = r.getRyConfigIds();
  49 + this.ecDbbms = r.getRyDbbms();
  50 + this.lpStartIndex = r.getLpStart();
  51 + this.ecStartIndex = r.getRyStart();
  52 + this.ruleId = r.getId();
  53 + this.qyrq = r.getQyrq();
  54 +
  55 + if (!CollectionUtils.isEmpty(cc)) {
  56 + this.ccInfos.putAll(cc);
  57 + }
  58 + if (!CollectionUtils.isEmpty(lp)) {
  59 + this.lpInfos.putAll(lp);
  60 + }
  61 + if (!CollectionUtils.isEmpty(ec)) {
  62 + this.ecInfos.putAll(ec);
  63 + }
  64 +
  65 + }
  66 +
  67 + public Integer getXlId() {
  68 + return xlId;
  69 + }
  70 +
  71 + public void setXlId(Integer xlId) {
  72 + this.xlId = xlId;
  73 + }
  74 +
  75 + public String getClZbh() {
  76 + return clZbh;
  77 + }
  78 +
  79 + public void setClZbh(String clZbh) {
  80 + this.clZbh = clZbh;
  81 + }
  82 +
  83 + public String getLpIds() {
  84 + return lpIds;
  85 + }
  86 +
  87 + public void setLpIds(String lpIds) {
  88 + this.lpIds = lpIds;
  89 + }
  90 +
  91 + public String getLpNames() {
  92 + return lpNames;
  93 + }
  94 +
  95 + public void setLpNames(String lpNames) {
  96 + this.lpNames = lpNames;
  97 + }
  98 +
  99 + public String getEcIds() {
  100 + return ecIds;
  101 + }
  102 +
  103 + public void setEcIds(String ecIds) {
  104 + this.ecIds = ecIds;
  105 + }
  106 +
  107 + public String getEcDbbms() {
  108 + return ecDbbms;
  109 + }
  110 +
  111 + public void setEcDbbms(String ecDbbms) {
  112 + this.ecDbbms = ecDbbms;
  113 + }
  114 +
  115 + public Integer getLpStartIndex() {
  116 + return lpStartIndex;
  117 + }
  118 +
  119 + public void setLpStartIndex(Integer lpStartIndex) {
  120 + this.lpStartIndex = lpStartIndex;
  121 + }
  122 +
  123 + public Integer getEcStartIndex() {
  124 + return ecStartIndex;
  125 + }
  126 +
  127 + public void setEcStartIndex(Integer ecStartIndex) {
  128 + this.ecStartIndex = ecStartIndex;
  129 + }
  130 +
  131 + public Long getRuleId() {
  132 + return ruleId;
  133 + }
  134 +
  135 + public void setRuleId(Long ruleId) {
  136 + this.ruleId = ruleId;
  137 + }
  138 +
  139 + public Date getQyrq() {
  140 + return qyrq;
  141 + }
  142 +
  143 + public void setQyrq(Date qyrq) {
  144 + this.qyrq = qyrq;
  145 + }
  146 +
  147 + public Map<String, CarConfigInfo> getCcInfos() {
  148 + return ccInfos;
  149 + }
  150 +
  151 + public void setCcInfos(Map<String, CarConfigInfo> ccInfos) {
  152 + this.ccInfos = ccInfos;
  153 + }
  154 +
  155 + public Map<Long, GuideboardInfo> getLpInfos() {
  156 + return lpInfos;
  157 + }
  158 +
  159 + public void setLpInfos(Map<Long, GuideboardInfo> lpInfos) {
  160 + this.lpInfos = lpInfos;
  161 + }
  162 +
  163 + public Map<Long, EmployeeConfigInfo> getEcInfos() {
  164 + return ecInfos;
  165 + }
  166 +
  167 + public void setEcInfos(Map<Long, EmployeeConfigInfo> ecInfos) {
  168 + this.ecInfos = ecInfos;
  169 + }
  170 +}
... ...
src/main/java/com/bsth/service/schedule/rules/ttinfo2/CalcuParam.java renamed to src/main/java/com/bsth/service/schedule/impl/plan/kBase3/validate/timetable/CalcuParam.java
1   -package com.bsth.service.schedule.rules.ttinfo2;
  1 +package com.bsth.service.schedule.impl.plan.kBase3.validate.timetable;
2 2  
3 3 import org.joda.time.DateTime;
4 4  
... ...
src/main/java/com/bsth/service/schedule/rules/ttinfo2/ErrorBcCountFunction.java renamed to src/main/java/com/bsth/service/schedule/impl/plan/kBase3/validate/timetable/ErrorBcCountFunction.java
1   -package com.bsth.service.schedule.rules.ttinfo2;
  1 +package com.bsth.service.schedule.impl.plan.kBase3.validate.timetable;
2 2  
3 3 import com.bsth.entity.schedule.TTInfoDetail;
4 4 import org.apache.commons.lang3.StringUtils;
... ...
src/main/java/com/bsth/service/schedule/rules/ttinfo2/Result.java renamed to src/main/java/com/bsth/service/schedule/impl/plan/kBase3/validate/timetable/Result.java
1   -package com.bsth.service.schedule.rules.ttinfo2;
  1 +package com.bsth.service.schedule.impl.plan.kBase3.validate.timetable;
2 2  
3 3 import java.util.ArrayList;
4 4 import java.util.List;
... ... @@ -22,6 +22,8 @@ public class Result {
22 22 private Long ttid;
23 23 /** 时刻表名字 */
24 24 private String ttname;
  25 + /** 线路版本 */
  26 + private Integer lineVersion;
25 27  
26 28 /** 所有班次数 */
27 29 private Long allbc;
... ... @@ -90,5 +92,13 @@ public class Result {
90 92 public void setErrorbc(Long errorbc) {
91 93 this.errorbc = errorbc;
92 94 }
  95 +
  96 + public Integer getLineVersion() {
  97 + return lineVersion;
  98 + }
  99 +
  100 + public void setLineVersion(Integer lineVersion) {
  101 + this.lineVersion = lineVersion;
  102 + }
93 103 }
94 104 }
... ...
src/main/resources/datatools/ktrs/carsDataOutput.ktr
1   -<?xml version="1.0" encoding="UTF-8"?>
2   -<transformation>
3   - <info>
4   - <name>&#x8f66;&#x8f86;&#x4fe1;&#x606f;&#x5bfc;&#x51fa;</name>
5   - <description>&#x8f66;&#x8f86;&#x4fe1;&#x606f;&#x5bfc;&#x51fa;</description>
6   - <extended_description>&#x8f66;&#x8f86;&#x57fa;&#x7840;&#x4fe1;&#x606f;</extended_description>
7   - <trans_version/>
8   - <trans_type>Normal</trans_type>
9   - <trans_status>0</trans_status>
10   - <directory>&#x2f;</directory>
11   - <parameters>
12   - <parameter>
13   - <name>cgsbm_in</name>
14   - <default_value/>
15   - <description>&#x5206;&#x516c;&#x53f8;&#x7f16;&#x7801;</description>
16   - </parameter>
17   - <parameter>
18   - <name>filepath</name>
19   - <default_value/>
20   - <description>excel&#x6587;&#x4ef6;&#x8def;&#x5f84;</description>
21   - </parameter>
22   - </parameters>
23   - <log>
24   -<trans-log-table><connection/>
25   -<schema/>
26   -<table/>
27   -<size_limit_lines/>
28   -<interval/>
29   -<timeout_days/>
30   -<field><id>ID_BATCH</id><enabled>Y</enabled><name>ID_BATCH</name></field><field><id>CHANNEL_ID</id><enabled>Y</enabled><name>CHANNEL_ID</name></field><field><id>TRANSNAME</id><enabled>Y</enabled><name>TRANSNAME</name></field><field><id>STATUS</id><enabled>Y</enabled><name>STATUS</name></field><field><id>LINES_READ</id><enabled>Y</enabled><name>LINES_READ</name><subject/></field><field><id>LINES_WRITTEN</id><enabled>Y</enabled><name>LINES_WRITTEN</name><subject/></field><field><id>LINES_UPDATED</id><enabled>Y</enabled><name>LINES_UPDATED</name><subject/></field><field><id>LINES_INPUT</id><enabled>Y</enabled><name>LINES_INPUT</name><subject/></field><field><id>LINES_OUTPUT</id><enabled>Y</enabled><name>LINES_OUTPUT</name><subject/></field><field><id>LINES_REJECTED</id><enabled>Y</enabled><name>LINES_REJECTED</name><subject/></field><field><id>ERRORS</id><enabled>Y</enabled><name>ERRORS</name></field><field><id>STARTDATE</id><enabled>Y</enabled><name>STARTDATE</name></field><field><id>ENDDATE</id><enabled>Y</enabled><name>ENDDATE</name></field><field><id>LOGDATE</id><enabled>Y</enabled><name>LOGDATE</name></field><field><id>DEPDATE</id><enabled>Y</enabled><name>DEPDATE</name></field><field><id>REPLAYDATE</id><enabled>Y</enabled><name>REPLAYDATE</name></field><field><id>LOG_FIELD</id><enabled>Y</enabled><name>LOG_FIELD</name></field><field><id>EXECUTING_SERVER</id><enabled>N</enabled><name>EXECUTING_SERVER</name></field><field><id>EXECUTING_USER</id><enabled>N</enabled><name>EXECUTING_USER</name></field><field><id>CLIENT</id><enabled>N</enabled><name>CLIENT</name></field></trans-log-table>
31   -<perf-log-table><connection/>
32   -<schema/>
33   -<table/>
34   -<interval/>
35   -<timeout_days/>
36   -<field><id>ID_BATCH</id><enabled>Y</enabled><name>ID_BATCH</name></field><field><id>SEQ_NR</id><enabled>Y</enabled><name>SEQ_NR</name></field><field><id>LOGDATE</id><enabled>Y</enabled><name>LOGDATE</name></field><field><id>TRANSNAME</id><enabled>Y</enabled><name>TRANSNAME</name></field><field><id>STEPNAME</id><enabled>Y</enabled><name>STEPNAME</name></field><field><id>STEP_COPY</id><enabled>Y</enabled><name>STEP_COPY</name></field><field><id>LINES_READ</id><enabled>Y</enabled><name>LINES_READ</name></field><field><id>LINES_WRITTEN</id><enabled>Y</enabled><name>LINES_WRITTEN</name></field><field><id>LINES_UPDATED</id><enabled>Y</enabled><name>LINES_UPDATED</name></field><field><id>LINES_INPUT</id><enabled>Y</enabled><name>LINES_INPUT</name></field><field><id>LINES_OUTPUT</id><enabled>Y</enabled><name>LINES_OUTPUT</name></field><field><id>LINES_REJECTED</id><enabled>Y</enabled><name>LINES_REJECTED</name></field><field><id>ERRORS</id><enabled>Y</enabled><name>ERRORS</name></field><field><id>INPUT_BUFFER_ROWS</id><enabled>Y</enabled><name>INPUT_BUFFER_ROWS</name></field><field><id>OUTPUT_BUFFER_ROWS</id><enabled>Y</enabled><name>OUTPUT_BUFFER_ROWS</name></field></perf-log-table>
37   -<channel-log-table><connection/>
38   -<schema/>
39   -<table/>
40   -<timeout_days/>
41   -<field><id>ID_BATCH</id><enabled>Y</enabled><name>ID_BATCH</name></field><field><id>CHANNEL_ID</id><enabled>Y</enabled><name>CHANNEL_ID</name></field><field><id>LOG_DATE</id><enabled>Y</enabled><name>LOG_DATE</name></field><field><id>LOGGING_OBJECT_TYPE</id><enabled>Y</enabled><name>LOGGING_OBJECT_TYPE</name></field><field><id>OBJECT_NAME</id><enabled>Y</enabled><name>OBJECT_NAME</name></field><field><id>OBJECT_COPY</id><enabled>Y</enabled><name>OBJECT_COPY</name></field><field><id>REPOSITORY_DIRECTORY</id><enabled>Y</enabled><name>REPOSITORY_DIRECTORY</name></field><field><id>FILENAME</id><enabled>Y</enabled><name>FILENAME</name></field><field><id>OBJECT_ID</id><enabled>Y</enabled><name>OBJECT_ID</name></field><field><id>OBJECT_REVISION</id><enabled>Y</enabled><name>OBJECT_REVISION</name></field><field><id>PARENT_CHANNEL_ID</id><enabled>Y</enabled><name>PARENT_CHANNEL_ID</name></field><field><id>ROOT_CHANNEL_ID</id><enabled>Y</enabled><name>ROOT_CHANNEL_ID</name></field></channel-log-table>
42   -<step-log-table><connection/>
43   -<schema/>
44   -<table/>
45   -<timeout_days/>
46   -<field><id>ID_BATCH</id><enabled>Y</enabled><name>ID_BATCH</name></field><field><id>CHANNEL_ID</id><enabled>Y</enabled><name>CHANNEL_ID</name></field><field><id>LOG_DATE</id><enabled>Y</enabled><name>LOG_DATE</name></field><field><id>TRANSNAME</id><enabled>Y</enabled><name>TRANSNAME</name></field><field><id>STEPNAME</id><enabled>Y</enabled><name>STEPNAME</name></field><field><id>STEP_COPY</id><enabled>Y</enabled><name>STEP_COPY</name></field><field><id>LINES_READ</id><enabled>Y</enabled><name>LINES_READ</name></field><field><id>LINES_WRITTEN</id><enabled>Y</enabled><name>LINES_WRITTEN</name></field><field><id>LINES_UPDATED</id><enabled>Y</enabled><name>LINES_UPDATED</name></field><field><id>LINES_INPUT</id><enabled>Y</enabled><name>LINES_INPUT</name></field><field><id>LINES_OUTPUT</id><enabled>Y</enabled><name>LINES_OUTPUT</name></field><field><id>LINES_REJECTED</id><enabled>Y</enabled><name>LINES_REJECTED</name></field><field><id>ERRORS</id><enabled>Y</enabled><name>ERRORS</name></field><field><id>LOG_FIELD</id><enabled>N</enabled><name>LOG_FIELD</name></field></step-log-table>
47   -<metrics-log-table><connection/>
48   -<schema/>
49   -<table/>
50   -<timeout_days/>
51   -<field><id>ID_BATCH</id><enabled>Y</enabled><name>ID_BATCH</name></field><field><id>CHANNEL_ID</id><enabled>Y</enabled><name>CHANNEL_ID</name></field><field><id>LOG_DATE</id><enabled>Y</enabled><name>LOG_DATE</name></field><field><id>METRICS_DATE</id><enabled>Y</enabled><name>METRICS_DATE</name></field><field><id>METRICS_CODE</id><enabled>Y</enabled><name>METRICS_CODE</name></field><field><id>METRICS_DESCRIPTION</id><enabled>Y</enabled><name>METRICS_DESCRIPTION</name></field><field><id>METRICS_SUBJECT</id><enabled>Y</enabled><name>METRICS_SUBJECT</name></field><field><id>METRICS_TYPE</id><enabled>Y</enabled><name>METRICS_TYPE</name></field><field><id>METRICS_VALUE</id><enabled>Y</enabled><name>METRICS_VALUE</name></field></metrics-log-table>
52   - </log>
53   - <maxdate>
54   - <connection/>
55   - <table/>
56   - <field/>
57   - <offset>0.0</offset>
58   - <maxdiff>0.0</maxdiff>
59   - </maxdate>
60   - <size_rowset>10000</size_rowset>
61   - <sleep_time_empty>50</sleep_time_empty>
62   - <sleep_time_full>50</sleep_time_full>
63   - <unique_connections>N</unique_connections>
64   - <feedback_shown>Y</feedback_shown>
65   - <feedback_size>50000</feedback_size>
66   - <using_thread_priorities>Y</using_thread_priorities>
67   - <shared_objects_file/>
68   - <capture_step_performance>N</capture_step_performance>
69   - <step_performance_capturing_delay>1000</step_performance_capturing_delay>
70   - <step_performance_capturing_size_limit>100</step_performance_capturing_size_limit>
71   - <dependencies>
72   - </dependencies>
73   - <partitionschemas>
74   - </partitionschemas>
75   - <slaveservers>
76   - </slaveservers>
77   - <clusterschemas>
78   - </clusterschemas>
79   - <created_user>-</created_user>
80   - <created_date>2016&#x2f;08&#x2f;05 16&#x3a;42&#x3a;22.753</created_date>
81   - <modified_user>-</modified_user>
82   - <modified_date>2016&#x2f;08&#x2f;05 16&#x3a;42&#x3a;22.753</modified_date>
83   - <key_for_session_key>H4sIAAAAAAAAAAMAAAAAAAAAAAA&#x3d;</key_for_session_key>
84   - <is_key_private>N</is_key_private>
85   - </info>
86   - <notepads>
87   - </notepads>
88   - <connection>
89   - <name>192.168.168.1_jwgl_dw</name>
90   - <server>192.168.168.1</server>
91   - <type>ORACLE</type>
92   - <access>Native</access>
93   - <database>orcl</database>
94   - <port>1521</port>
95   - <username>jwgl_dw</username>
96   - <password>Encrypted 2be98afc86aa7f2e4cb13b977d2adabcd</password>
97   - <servername/>
98   - <data_tablespace/>
99   - <index_tablespace/>
100   - <attributes>
101   - <attribute><code>FORCE_IDENTIFIERS_TO_LOWERCASE</code><attribute>N</attribute></attribute>
102   - <attribute><code>FORCE_IDENTIFIERS_TO_UPPERCASE</code><attribute>N</attribute></attribute>
103   - <attribute><code>IS_CLUSTERED</code><attribute>N</attribute></attribute>
104   - <attribute><code>PORT_NUMBER</code><attribute>1521</attribute></attribute>
105   - <attribute><code>PRESERVE_RESERVED_WORD_CASE</code><attribute>N</attribute></attribute>
106   - <attribute><code>QUOTE_ALL_FIELDS</code><attribute>N</attribute></attribute>
107   - <attribute><code>SUPPORTS_BOOLEAN_DATA_TYPE</code><attribute>Y</attribute></attribute>
108   - <attribute><code>SUPPORTS_TIMESTAMP_DATA_TYPE</code><attribute>Y</attribute></attribute>
109   - <attribute><code>USE_POOLING</code><attribute>N</attribute></attribute>
110   - </attributes>
111   - </connection>
112   - <connection>
113   - <name>bus_control_variable</name>
114   - <server>&#x24;&#x7b;v_db_ip&#x7d;</server>
115   - <type>MYSQL</type>
116   - <access>Native</access>
117   - <database>&#x24;&#x7b;v_db_dname&#x7d;</database>
118   - <port>3306</port>
119   - <username>&#x24;&#x7b;v_db_uname&#x7d;</username>
120   - <password>&#x24;&#x7b;v_db_pwd&#x7d;</password>
121   - <servername/>
122   - <data_tablespace/>
123   - <index_tablespace/>
124   - <attributes>
125   - <attribute><code>EXTRA_OPTION_MYSQL.characterEncoding</code><attribute>utf8</attribute></attribute>
126   - <attribute><code>EXTRA_OPTION_MYSQL.defaultFetchSize</code><attribute>500</attribute></attribute>
127   - <attribute><code>EXTRA_OPTION_MYSQL.useCursorFetch</code><attribute>true</attribute></attribute>
128   - <attribute><code>FORCE_IDENTIFIERS_TO_LOWERCASE</code><attribute>N</attribute></attribute>
129   - <attribute><code>FORCE_IDENTIFIERS_TO_UPPERCASE</code><attribute>N</attribute></attribute>
130   - <attribute><code>IS_CLUSTERED</code><attribute>N</attribute></attribute>
131   - <attribute><code>PORT_NUMBER</code><attribute>3306</attribute></attribute>
132   - <attribute><code>PRESERVE_RESERVED_WORD_CASE</code><attribute>N</attribute></attribute>
133   - <attribute><code>QUOTE_ALL_FIELDS</code><attribute>N</attribute></attribute>
134   - <attribute><code>STREAM_RESULTS</code><attribute>N</attribute></attribute>
135   - <attribute><code>SUPPORTS_BOOLEAN_DATA_TYPE</code><attribute>Y</attribute></attribute>
136   - <attribute><code>SUPPORTS_TIMESTAMP_DATA_TYPE</code><attribute>Y</attribute></attribute>
137   - <attribute><code>USE_POOLING</code><attribute>N</attribute></attribute>
138   - </attributes>
139   - </connection>
140   - <connection>
141   - <name>bus_control_&#x516c;&#x53f8;_201</name>
142   - <server>localhost</server>
143   - <type>MYSQL</type>
144   - <access>Native</access>
145   - <database>control</database>
146   - <port>3306</port>
147   - <username>root</username>
148   - <password>Encrypted </password>
149   - <servername/>
150   - <data_tablespace/>
151   - <index_tablespace/>
152   - <attributes>
153   - <attribute><code>EXTRA_OPTION_MYSQL.defaultFetchSize</code><attribute>500</attribute></attribute>
154   - <attribute><code>EXTRA_OPTION_MYSQL.useCursorFetch</code><attribute>true</attribute></attribute>
155   - <attribute><code>FORCE_IDENTIFIERS_TO_LOWERCASE</code><attribute>N</attribute></attribute>
156   - <attribute><code>FORCE_IDENTIFIERS_TO_UPPERCASE</code><attribute>N</attribute></attribute>
157   - <attribute><code>IS_CLUSTERED</code><attribute>N</attribute></attribute>
158   - <attribute><code>PORT_NUMBER</code><attribute>3306</attribute></attribute>
159   - <attribute><code>PRESERVE_RESERVED_WORD_CASE</code><attribute>N</attribute></attribute>
160   - <attribute><code>QUOTE_ALL_FIELDS</code><attribute>N</attribute></attribute>
161   - <attribute><code>STREAM_RESULTS</code><attribute>N</attribute></attribute>
162   - <attribute><code>SUPPORTS_BOOLEAN_DATA_TYPE</code><attribute>Y</attribute></attribute>
163   - <attribute><code>SUPPORTS_TIMESTAMP_DATA_TYPE</code><attribute>Y</attribute></attribute>
164   - <attribute><code>USE_POOLING</code><attribute>N</attribute></attribute>
165   - </attributes>
166   - </connection>
167   - <connection>
168   - <name>bus_control_&#x672c;&#x673a;</name>
169   - <server>localhost</server>
170   - <type>MYSQL</type>
171   - <access>Native</access>
172   - <database>control</database>
173   - <port>3306</port>
174   - <username>root</username>
175   - <password>Encrypted </password>
176   - <servername/>
177   - <data_tablespace/>
178   - <index_tablespace/>
179   - <attributes>
180   - <attribute><code>EXTRA_OPTION_MYSQL.defaultFetchSize</code><attribute>500</attribute></attribute>
181   - <attribute><code>EXTRA_OPTION_MYSQL.useCursorFetch</code><attribute>true</attribute></attribute>
182   - <attribute><code>FORCE_IDENTIFIERS_TO_LOWERCASE</code><attribute>N</attribute></attribute>
183   - <attribute><code>FORCE_IDENTIFIERS_TO_UPPERCASE</code><attribute>N</attribute></attribute>
184   - <attribute><code>IS_CLUSTERED</code><attribute>N</attribute></attribute>
185   - <attribute><code>PORT_NUMBER</code><attribute>3306</attribute></attribute>
186   - <attribute><code>PRESERVE_RESERVED_WORD_CASE</code><attribute>N</attribute></attribute>
187   - <attribute><code>QUOTE_ALL_FIELDS</code><attribute>N</attribute></attribute>
188   - <attribute><code>STREAM_RESULTS</code><attribute>Y</attribute></attribute>
189   - <attribute><code>SUPPORTS_BOOLEAN_DATA_TYPE</code><attribute>Y</attribute></attribute>
190   - <attribute><code>SUPPORTS_TIMESTAMP_DATA_TYPE</code><attribute>Y</attribute></attribute>
191   - <attribute><code>USE_POOLING</code><attribute>N</attribute></attribute>
192   - </attributes>
193   - </connection>
194   - <connection>
195   - <name>xlab_mysql_youle</name>
196   - <server>101.231.124.8</server>
197   - <type>MYSQL</type>
198   - <access>Native</access>
199   - <database>xlab_youle</database>
200   - <port>45687</port>
201   - <username>xlab-youle</username>
202   - <password>Encrypted 2be98afc86aa78a88aa1be369d187a3df</password>
203   - <servername/>
204   - <data_tablespace/>
205   - <index_tablespace/>
206   - <attributes>
207   - <attribute><code>EXTRA_OPTION_MYSQL.defaultFetchSize</code><attribute>500</attribute></attribute>
208   - <attribute><code>EXTRA_OPTION_MYSQL.useCursorFetch</code><attribute>true</attribute></attribute>
209   - <attribute><code>FORCE_IDENTIFIERS_TO_LOWERCASE</code><attribute>N</attribute></attribute>
210   - <attribute><code>FORCE_IDENTIFIERS_TO_UPPERCASE</code><attribute>N</attribute></attribute>
211   - <attribute><code>IS_CLUSTERED</code><attribute>N</attribute></attribute>
212   - <attribute><code>PORT_NUMBER</code><attribute>45687</attribute></attribute>
213   - <attribute><code>PRESERVE_RESERVED_WORD_CASE</code><attribute>N</attribute></attribute>
214   - <attribute><code>QUOTE_ALL_FIELDS</code><attribute>N</attribute></attribute>
215   - <attribute><code>STREAM_RESULTS</code><attribute>Y</attribute></attribute>
216   - <attribute><code>SUPPORTS_BOOLEAN_DATA_TYPE</code><attribute>N</attribute></attribute>
217   - <attribute><code>SUPPORTS_TIMESTAMP_DATA_TYPE</code><attribute>N</attribute></attribute>
218   - <attribute><code>USE_POOLING</code><attribute>N</attribute></attribute>
219   - </attributes>
220   - </connection>
221   - <connection>
222   - <name>xlab_mysql_youle&#xff08;&#x672c;&#x673a;&#xff09;</name>
223   - <server>localhost</server>
224   - <type>MYSQL</type>
225   - <access>Native</access>
226   - <database>xlab_youle</database>
227   - <port>3306</port>
228   - <username>root</username>
229   - <password>Encrypted </password>
230   - <servername/>
231   - <data_tablespace/>
232   - <index_tablespace/>
233   - <attributes>
234   - <attribute><code>EXTRA_OPTION_MYSQL.defaultFetchSize</code><attribute>500</attribute></attribute>
235   - <attribute><code>EXTRA_OPTION_MYSQL.useCursorFetch</code><attribute>true</attribute></attribute>
236   - <attribute><code>FORCE_IDENTIFIERS_TO_LOWERCASE</code><attribute>N</attribute></attribute>
237   - <attribute><code>FORCE_IDENTIFIERS_TO_UPPERCASE</code><attribute>N</attribute></attribute>
238   - <attribute><code>IS_CLUSTERED</code><attribute>N</attribute></attribute>
239   - <attribute><code>PORT_NUMBER</code><attribute>3306</attribute></attribute>
240   - <attribute><code>PRESERVE_RESERVED_WORD_CASE</code><attribute>N</attribute></attribute>
241   - <attribute><code>QUOTE_ALL_FIELDS</code><attribute>N</attribute></attribute>
242   - <attribute><code>STREAM_RESULTS</code><attribute>Y</attribute></attribute>
243   - <attribute><code>SUPPORTS_BOOLEAN_DATA_TYPE</code><attribute>N</attribute></attribute>
244   - <attribute><code>SUPPORTS_TIMESTAMP_DATA_TYPE</code><attribute>N</attribute></attribute>
245   - <attribute><code>USE_POOLING</code><attribute>N</attribute></attribute>
246   - </attributes>
247   - </connection>
248   - <connection>
249   - <name>xlab_youle</name>
250   - <server/>
251   - <type>MYSQL</type>
252   - <access>JNDI</access>
253   - <database>xlab_youle</database>
254   - <port>1521</port>
255   - <username/>
256   - <password>Encrypted </password>
257   - <servername/>
258   - <data_tablespace/>
259   - <index_tablespace/>
260   - <attributes>
261   - <attribute><code>FORCE_IDENTIFIERS_TO_LOWERCASE</code><attribute>N</attribute></attribute>
262   - <attribute><code>FORCE_IDENTIFIERS_TO_UPPERCASE</code><attribute>N</attribute></attribute>
263   - <attribute><code>IS_CLUSTERED</code><attribute>N</attribute></attribute>
264   - <attribute><code>PORT_NUMBER</code><attribute>1521</attribute></attribute>
265   - <attribute><code>PRESERVE_RESERVED_WORD_CASE</code><attribute>N</attribute></attribute>
266   - <attribute><code>QUOTE_ALL_FIELDS</code><attribute>N</attribute></attribute>
267   - <attribute><code>STREAM_RESULTS</code><attribute>Y</attribute></attribute>
268   - <attribute><code>SUPPORTS_BOOLEAN_DATA_TYPE</code><attribute>Y</attribute></attribute>
269   - <attribute><code>SUPPORTS_TIMESTAMP_DATA_TYPE</code><attribute>Y</attribute></attribute>
270   - <attribute><code>USE_POOLING</code><attribute>N</attribute></attribute>
271   - </attributes>
272   - </connection>
273   - <order>
274   - <hop> <from>&#x516c;&#x53f8;&#x67e5;&#x8be2;</from><to>&#x5206;&#x516c;&#x53f8;&#x67e5;&#x8be2;</to><enabled>Y</enabled> </hop>
275   - <hop> <from>&#x5206;&#x516c;&#x53f8;&#x67e5;&#x8be2;</from><to>&#x5b57;&#x6bb5;&#x9009;&#x62e9;</to><enabled>Y</enabled> </hop>
276   - <hop> <from>&#x6dfb;&#x52a0;&#x67e5;&#x8be2;&#x5e38;&#x91cf;</from><to>&#x516c;&#x53f8;&#x67e5;&#x8be2;</to><enabled>Y</enabled> </hop>
277   - <hop> <from>&#x8f66;&#x8f86;&#x4fe1;&#x606f;&#x8868;&#x8f93;&#x5165;</from><to>&#x6dfb;&#x52a0;&#x67e5;&#x8be2;&#x5e38;&#x91cf;</to><enabled>Y</enabled> </hop>
278   - <hop> <from>&#x5b57;&#x6bb5;&#x9009;&#x62e9;</from><to>&#x662f;&#x5426;&#x7535;&#x8f66;</to><enabled>Y</enabled> </hop>
279   - <hop> <from>&#x662f;&#x5426;&#x7535;&#x8f66;</from><to>Excel&#x8f93;&#x51fa;</to><enabled>Y</enabled> </hop>
280   - </order>
281   - <step>
282   - <name>Excel&#x8f93;&#x51fa;</name>
283   - <type>ExcelOutput</type>
284   - <description/>
285   - <distribute>Y</distribute>
286   - <custom_distribution/>
287   - <copies>1</copies>
288   - <partitioning>
289   - <method>none</method>
290   - <schema_name/>
291   - </partitioning>
292   - <header>Y</header>
293   - <footer>N</footer>
294   - <encoding/>
295   - <append>N</append>
296   - <add_to_result_filenames>Y</add_to_result_filenames>
297   - <file>
298   - <name>&#x24;&#x7b;filepath&#x7d;</name>
299   - <extention>xls</extention>
300   - <do_not_open_newfile_init>N</do_not_open_newfile_init>
301   - <create_parent_folder>N</create_parent_folder>
302   - <split>N</split>
303   - <add_date>N</add_date>
304   - <add_time>N</add_time>
305   - <SpecifyFormat>N</SpecifyFormat>
306   - <date_time_format>yyyyMMddHHmmss</date_time_format>
307   - <sheetname>&#x5de5;&#x4f5c;&#x8868;1</sheetname>
308   - <autosizecolums>N</autosizecolums>
309   - <nullisblank>N</nullisblank>
310   - <protect_sheet>N</protect_sheet>
311   - <password>Encrypted </password>
312   - <splitevery>0</splitevery>
313   - <usetempfiles>N</usetempfiles>
314   - <tempdirectory/>
315   - </file>
316   - <template>
317   - <enabled>N</enabled>
318   - <append>N</append>
319   - <filename>template.xls</filename>
320   - </template>
321   - <fields>
322   - <field>
323   - <name>&#x8f66;&#x724c;&#x53f7;</name>
324   - <type>String</type>
325   - <format/>
326   - </field>
327   - <field>
328   - <name>&#x5185;&#x90e8;&#x7f16;&#x7801;</name>
329   - <type>String</type>
330   - <format/>
331   - </field>
332   - <field>
333   - <name>&#x6240;&#x5c5e;&#x516c;&#x53f8;</name>
334   - <type>String</type>
335   - <format/>
336   - </field>
337   - <field>
338   - <name>&#x6240;&#x5c5e;&#x5206;&#x516c;&#x53f8;</name>
339   - <type>String</type>
340   - <format/>
341   - </field>
342   - <field>
343   - <name>&#x8bbe;&#x5907;&#x4f9b;&#x5e94;&#x5382;&#x5546;</name>
344   - <type>String</type>
345   - <format/>
346   - </field>
347   - <field>
348   - <name>&#x8bbe;&#x5907;&#x7ec8;&#x7aef;&#x53f7;</name>
349   - <type>String</type>
350   - <format/>
351   - </field>
352   - <field>
353   - <name>&#x662f;&#x5426;&#x7535;&#x8f66;</name>
354   - <type>String</type>
355   - <format/>
356   - </field>
357   - </fields>
358   - <custom>
359   - <header_font_name>arial</header_font_name>
360   - <header_font_size>10</header_font_size>
361   - <header_font_bold>N</header_font_bold>
362   - <header_font_italic>N</header_font_italic>
363   - <header_font_underline>no</header_font_underline>
364   - <header_font_orientation>horizontal</header_font_orientation>
365   - <header_font_color>black</header_font_color>
366   - <header_background_color>none</header_background_color>
367   - <header_row_height>255</header_row_height>
368   - <header_alignment>left</header_alignment>
369   - <header_image/>
370   - <row_font_name>arial</row_font_name>
371   - <row_font_size>10</row_font_size>
372   - <row_font_color>black</row_font_color>
373   - <row_background_color>none</row_background_color>
374   - </custom>
375   - <cluster_schema/>
376   - <remotesteps> <input> </input> <output> </output> </remotesteps> <GUI>
377   - <xloc>498</xloc>
378   - <yloc>348</yloc>
379   - <draw>Y</draw>
380   - </GUI>
381   - </step>
382   -
383   - <step>
384   - <name>&#x516c;&#x53f8;&#x67e5;&#x8be2;</name>
385   - <type>DBLookup</type>
386   - <description/>
387   - <distribute>Y</distribute>
388   - <custom_distribution/>
389   - <copies>1</copies>
390   - <partitioning>
391   - <method>none</method>
392   - <schema_name/>
393   - </partitioning>
394   - <connection>bus_control_variable</connection>
395   - <cache>N</cache>
396   - <cache_load_all>N</cache_load_all>
397   - <cache_size>0</cache_size>
398   - <lookup>
399   - <schema/>
400   - <table>bsth_c_business</table>
401   - <orderby/>
402   - <fail_on_multiple>N</fail_on_multiple>
403   - <eat_row_on_failure>N</eat_row_on_failure>
404   - <key>
405   - <name>up_code</name>
406   - <field>up_code</field>
407   - <condition>&#x3d;</condition>
408   - <name2/>
409   - </key>
410   - <key>
411   - <name>business_code</name>
412   - <field>business_code</field>
413   - <condition>&#x3d;</condition>
414   - <name2/>
415   - </key>
416   - <value>
417   - <name>business_name</name>
418   - <rename>gs</rename>
419   - <default/>
420   - <type>String</type>
421   - </value>
422   - </lookup>
423   - <cluster_schema/>
424   - <remotesteps> <input> </input> <output> </output> </remotesteps> <GUI>
425   - <xloc>364</xloc>
426   - <yloc>60</yloc>
427   - <draw>Y</draw>
428   - </GUI>
429   - </step>
430   -
431   - <step>
432   - <name>&#x5206;&#x516c;&#x53f8;&#x67e5;&#x8be2;</name>
433   - <type>DBLookup</type>
434   - <description/>
435   - <distribute>Y</distribute>
436   - <custom_distribution/>
437   - <copies>1</copies>
438   - <partitioning>
439   - <method>none</method>
440   - <schema_name/>
441   - </partitioning>
442   - <connection>bus_control_variable</connection>
443   - <cache>N</cache>
444   - <cache_load_all>N</cache_load_all>
445   - <cache_size>0</cache_size>
446   - <lookup>
447   - <schema/>
448   - <table>bsth_c_business</table>
449   - <orderby/>
450   - <fail_on_multiple>N</fail_on_multiple>
451   - <eat_row_on_failure>N</eat_row_on_failure>
452   - <key>
453   - <name>business_code</name>
454   - <field>up_code</field>
455   - <condition>&#x3d;</condition>
456   - <name2/>
457   - </key>
458   - <key>
459   - <name>branche_company_code</name>
460   - <field>business_code</field>
461   - <condition>&#x3d;</condition>
462   - <name2/>
463   - </key>
464   - <value>
465   - <name>business_name</name>
466   - <rename>fgs</rename>
467   - <default/>
468   - <type>String</type>
469   - </value>
470   - </lookup>
471   - <cluster_schema/>
472   - <remotesteps> <input> </input> <output> </output> </remotesteps> <GUI>
473   - <xloc>491</xloc>
474   - <yloc>60</yloc>
475   - <draw>Y</draw>
476   - </GUI>
477   - </step>
478   -
479   - <step>
480   - <name>&#x5b57;&#x6bb5;&#x9009;&#x62e9;</name>
481   - <type>SelectValues</type>
482   - <description/>
483   - <distribute>Y</distribute>
484   - <custom_distribution/>
485   - <copies>1</copies>
486   - <partitioning>
487   - <method>none</method>
488   - <schema_name/>
489   - </partitioning>
490   - <fields> <field> <name>car_plate</name>
491   - <rename>&#x8f66;&#x724c;&#x53f7;</rename>
492   - <length>-2</length>
493   - <precision>-2</precision>
494   - </field> <field> <name>inside_code</name>
495   - <rename>&#x5185;&#x90e8;&#x7f16;&#x7801;</rename>
496   - <length>-2</length>
497   - <precision>-2</precision>
498   - </field> <field> <name>gs</name>
499   - <rename>&#x6240;&#x5c5e;&#x516c;&#x53f8;</rename>
500   - <length>-2</length>
501   - <precision>-2</precision>
502   - </field> <field> <name>fgs</name>
503   - <rename>&#x6240;&#x5c5e;&#x5206;&#x516c;&#x53f8;</rename>
504   - <length>-2</length>
505   - <precision>-2</precision>
506   - </field> <field> <name>supplier_name</name>
507   - <rename>&#x8bbe;&#x5907;&#x4f9b;&#x5e94;&#x5382;&#x5546;</rename>
508   - <length>-2</length>
509   - <precision>-2</precision>
510   - </field> <field> <name>equipment_code</name>
511   - <rename>&#x8bbe;&#x5907;&#x7ec8;&#x7aef;&#x53f7;</rename>
512   - <length>-2</length>
513   - <precision>-2</precision>
514   - </field> <field> <name>sfdc</name>
515   - <rename>sfdc_cal</rename>
516   - <length>-2</length>
517   - <precision>-2</precision>
518   - </field> <select_unspecified>N</select_unspecified>
519   - </fields> <cluster_schema/>
520   - <remotesteps> <input> </input> <output> </output> </remotesteps> <GUI>
521   - <xloc>495</xloc>
522   - <yloc>173</yloc>
523   - <draw>Y</draw>
524   - </GUI>
525   - </step>
526   -
527   - <step>
528   - <name>&#x6dfb;&#x52a0;&#x67e5;&#x8be2;&#x5e38;&#x91cf;</name>
529   - <type>ScriptValueMod</type>
530   - <description/>
531   - <distribute>Y</distribute>
532   - <custom_distribution/>
533   - <copies>1</copies>
534   - <partitioning>
535   - <method>none</method>
536   - <schema_name/>
537   - </partitioning>
538   - <compatible>N</compatible>
539   - <optimizationLevel>9</optimizationLevel>
540   - <jsScripts> <jsScript> <jsScript_type>0</jsScript_type>
541   - <jsScript_name>Script 1</jsScript_name>
542   - <jsScript_script>&#x2f;&#x2f;Script here&#xa;&#xa;var up_code &#x3d; &#x27;88&#x27;&#x3b;</jsScript_script>
543   - </jsScript> </jsScripts> <fields> <field> <name>up_code</name>
544   - <rename>up_code</rename>
545   - <type>String</type>
546   - <length>-1</length>
547   - <precision>-1</precision>
548   - <replace>N</replace>
549   - </field> </fields> <cluster_schema/>
550   - <remotesteps> <input> </input> <output> </output> </remotesteps> <GUI>
551   - <xloc>227</xloc>
552   - <yloc>59</yloc>
553   - <draw>Y</draw>
554   - </GUI>
555   - </step>
556   -
557   - <step>
558   - <name>&#x8f66;&#x8f86;&#x4fe1;&#x606f;&#x8868;&#x8f93;&#x5165;</name>
559   - <type>TableInput</type>
560   - <description/>
561   - <distribute>Y</distribute>
562   - <custom_distribution/>
563   - <copies>1</copies>
564   - <partitioning>
565   - <method>none</method>
566   - <schema_name/>
567   - </partitioning>
568   - <connection>bus_control_variable</connection>
569   - <sql>SELECT &#x2a; FROM bsth_c_cars&#xa;&#xa;</sql>
570   - <limit>0</limit>
571   - <lookup/>
572   - <execute_each_row>N</execute_each_row>
573   - <variables_active>Y</variables_active>
574   - <lazy_conversion_active>N</lazy_conversion_active>
575   - <cluster_schema/>
576   - <remotesteps> <input> </input> <output> </output> </remotesteps> <GUI>
577   - <xloc>88</xloc>
578   - <yloc>59</yloc>
579   - <draw>Y</draw>
580   - </GUI>
581   - </step>
582   -
583   - <step>
584   - <name>&#x662f;&#x5426;&#x7535;&#x8f66;</name>
585   - <type>ScriptValueMod</type>
586   - <description/>
587   - <distribute>Y</distribute>
588   - <custom_distribution/>
589   - <copies>1</copies>
590   - <partitioning>
591   - <method>none</method>
592   - <schema_name/>
593   - </partitioning>
594   - <compatible>N</compatible>
595   - <optimizationLevel>9</optimizationLevel>
596   - <jsScripts> <jsScript> <jsScript_type>0</jsScript_type>
597   - <jsScript_name>Script 1</jsScript_name>
598   - <jsScript_script>&#x2f;&#x2f;Script here&#xa;&#xa;var &#x662f;&#x5426;&#x7535;&#x8f66; &#x3d; &#x22;&#x5426;&#x22;&#x3b;&#xa;&#xa;if&#x28;sfdc_cal&#x29; &#x7b;&#xa; &#x662f;&#x5426;&#x7535;&#x8f66; &#x3d; &#x22;&#x662f;&#x22;&#x3b;&#xa;&#x7d;&#xa;</jsScript_script>
599   - </jsScript> </jsScripts> <fields> <field> <name>&#x662f;&#x5426;&#x7535;&#x8f66;</name>
600   - <rename>&#x662f;&#x5426;&#x7535;&#x8f66;</rename>
601   - <type>String</type>
602   - <length>-1</length>
603   - <precision>-1</precision>
604   - <replace>N</replace>
605   - </field> </fields> <cluster_schema/>
606   - <remotesteps> <input> </input> <output> </output> </remotesteps> <GUI>
607   - <xloc>695</xloc>
608   - <yloc>173</yloc>
609   - <draw>Y</draw>
610   - </GUI>
611   - </step>
612   -
613   - <step_error_handling>
614   - </step_error_handling>
615   - <slave-step-copy-partition-distribution>
616   -</slave-step-copy-partition-distribution>
617   - <slave_transformation>N</slave_transformation>
618   -
619   -</transformation>
  1 +<?xml version="1.0" encoding="UTF-8"?>
  2 +<transformation>
  3 + <info>
  4 + <name>&#x8f66;&#x8f86;&#x4fe1;&#x606f;&#x5bfc;&#x51fa;</name>
  5 + <description>&#x8f66;&#x8f86;&#x4fe1;&#x606f;&#x5bfc;&#x51fa;</description>
  6 + <extended_description>&#x8f66;&#x8f86;&#x57fa;&#x7840;&#x4fe1;&#x606f;</extended_description>
  7 + <trans_version/>
  8 + <trans_type>Normal</trans_type>
  9 + <trans_status>0</trans_status>
  10 + <directory>&#x2f;</directory>
  11 + <parameters>
  12 + <parameter>
  13 + <name>QUERY</name>
  14 + <default_value/>
  15 + <description>&#x67e5;&#x8be2;</description>
  16 + </parameter>
  17 + <parameter>
  18 + <name>cgsbm_in</name>
  19 + <default_value/>
  20 + <description>&#x5206;&#x516c;&#x53f8;&#x7f16;&#x7801;</description>
  21 + </parameter>
  22 + <parameter>
  23 + <name>filepath</name>
  24 + <default_value>1&#x3d;1</default_value>
  25 + <description>excel&#x6587;&#x4ef6;&#x8def;&#x5f84;</description>
  26 + </parameter>
  27 + </parameters>
  28 + <log>
  29 +<trans-log-table><connection/>
  30 +<schema/>
  31 +<table/>
  32 +<size_limit_lines/>
  33 +<interval/>
  34 +<timeout_days/>
  35 +<field><id>ID_BATCH</id><enabled>Y</enabled><name>ID_BATCH</name></field><field><id>CHANNEL_ID</id><enabled>Y</enabled><name>CHANNEL_ID</name></field><field><id>TRANSNAME</id><enabled>Y</enabled><name>TRANSNAME</name></field><field><id>STATUS</id><enabled>Y</enabled><name>STATUS</name></field><field><id>LINES_READ</id><enabled>Y</enabled><name>LINES_READ</name><subject/></field><field><id>LINES_WRITTEN</id><enabled>Y</enabled><name>LINES_WRITTEN</name><subject/></field><field><id>LINES_UPDATED</id><enabled>Y</enabled><name>LINES_UPDATED</name><subject/></field><field><id>LINES_INPUT</id><enabled>Y</enabled><name>LINES_INPUT</name><subject/></field><field><id>LINES_OUTPUT</id><enabled>Y</enabled><name>LINES_OUTPUT</name><subject/></field><field><id>LINES_REJECTED</id><enabled>Y</enabled><name>LINES_REJECTED</name><subject/></field><field><id>ERRORS</id><enabled>Y</enabled><name>ERRORS</name></field><field><id>STARTDATE</id><enabled>Y</enabled><name>STARTDATE</name></field><field><id>ENDDATE</id><enabled>Y</enabled><name>ENDDATE</name></field><field><id>LOGDATE</id><enabled>Y</enabled><name>LOGDATE</name></field><field><id>DEPDATE</id><enabled>Y</enabled><name>DEPDATE</name></field><field><id>REPLAYDATE</id><enabled>Y</enabled><name>REPLAYDATE</name></field><field><id>LOG_FIELD</id><enabled>Y</enabled><name>LOG_FIELD</name></field><field><id>EXECUTING_SERVER</id><enabled>N</enabled><name>EXECUTING_SERVER</name></field><field><id>EXECUTING_USER</id><enabled>N</enabled><name>EXECUTING_USER</name></field><field><id>CLIENT</id><enabled>N</enabled><name>CLIENT</name></field></trans-log-table>
  36 +<perf-log-table><connection/>
  37 +<schema/>
  38 +<table/>
  39 +<interval/>
  40 +<timeout_days/>
  41 +<field><id>ID_BATCH</id><enabled>Y</enabled><name>ID_BATCH</name></field><field><id>SEQ_NR</id><enabled>Y</enabled><name>SEQ_NR</name></field><field><id>LOGDATE</id><enabled>Y</enabled><name>LOGDATE</name></field><field><id>TRANSNAME</id><enabled>Y</enabled><name>TRANSNAME</name></field><field><id>STEPNAME</id><enabled>Y</enabled><name>STEPNAME</name></field><field><id>STEP_COPY</id><enabled>Y</enabled><name>STEP_COPY</name></field><field><id>LINES_READ</id><enabled>Y</enabled><name>LINES_READ</name></field><field><id>LINES_WRITTEN</id><enabled>Y</enabled><name>LINES_WRITTEN</name></field><field><id>LINES_UPDATED</id><enabled>Y</enabled><name>LINES_UPDATED</name></field><field><id>LINES_INPUT</id><enabled>Y</enabled><name>LINES_INPUT</name></field><field><id>LINES_OUTPUT</id><enabled>Y</enabled><name>LINES_OUTPUT</name></field><field><id>LINES_REJECTED</id><enabled>Y</enabled><name>LINES_REJECTED</name></field><field><id>ERRORS</id><enabled>Y</enabled><name>ERRORS</name></field><field><id>INPUT_BUFFER_ROWS</id><enabled>Y</enabled><name>INPUT_BUFFER_ROWS</name></field><field><id>OUTPUT_BUFFER_ROWS</id><enabled>Y</enabled><name>OUTPUT_BUFFER_ROWS</name></field></perf-log-table>
  42 +<channel-log-table><connection/>
  43 +<schema/>
  44 +<table/>
  45 +<timeout_days/>
  46 +<field><id>ID_BATCH</id><enabled>Y</enabled><name>ID_BATCH</name></field><field><id>CHANNEL_ID</id><enabled>Y</enabled><name>CHANNEL_ID</name></field><field><id>LOG_DATE</id><enabled>Y</enabled><name>LOG_DATE</name></field><field><id>LOGGING_OBJECT_TYPE</id><enabled>Y</enabled><name>LOGGING_OBJECT_TYPE</name></field><field><id>OBJECT_NAME</id><enabled>Y</enabled><name>OBJECT_NAME</name></field><field><id>OBJECT_COPY</id><enabled>Y</enabled><name>OBJECT_COPY</name></field><field><id>REPOSITORY_DIRECTORY</id><enabled>Y</enabled><name>REPOSITORY_DIRECTORY</name></field><field><id>FILENAME</id><enabled>Y</enabled><name>FILENAME</name></field><field><id>OBJECT_ID</id><enabled>Y</enabled><name>OBJECT_ID</name></field><field><id>OBJECT_REVISION</id><enabled>Y</enabled><name>OBJECT_REVISION</name></field><field><id>PARENT_CHANNEL_ID</id><enabled>Y</enabled><name>PARENT_CHANNEL_ID</name></field><field><id>ROOT_CHANNEL_ID</id><enabled>Y</enabled><name>ROOT_CHANNEL_ID</name></field></channel-log-table>
  47 +<step-log-table><connection/>
  48 +<schema/>
  49 +<table/>
  50 +<timeout_days/>
  51 +<field><id>ID_BATCH</id><enabled>Y</enabled><name>ID_BATCH</name></field><field><id>CHANNEL_ID</id><enabled>Y</enabled><name>CHANNEL_ID</name></field><field><id>LOG_DATE</id><enabled>Y</enabled><name>LOG_DATE</name></field><field><id>TRANSNAME</id><enabled>Y</enabled><name>TRANSNAME</name></field><field><id>STEPNAME</id><enabled>Y</enabled><name>STEPNAME</name></field><field><id>STEP_COPY</id><enabled>Y</enabled><name>STEP_COPY</name></field><field><id>LINES_READ</id><enabled>Y</enabled><name>LINES_READ</name></field><field><id>LINES_WRITTEN</id><enabled>Y</enabled><name>LINES_WRITTEN</name></field><field><id>LINES_UPDATED</id><enabled>Y</enabled><name>LINES_UPDATED</name></field><field><id>LINES_INPUT</id><enabled>Y</enabled><name>LINES_INPUT</name></field><field><id>LINES_OUTPUT</id><enabled>Y</enabled><name>LINES_OUTPUT</name></field><field><id>LINES_REJECTED</id><enabled>Y</enabled><name>LINES_REJECTED</name></field><field><id>ERRORS</id><enabled>Y</enabled><name>ERRORS</name></field><field><id>LOG_FIELD</id><enabled>N</enabled><name>LOG_FIELD</name></field></step-log-table>
  52 +<metrics-log-table><connection/>
  53 +<schema/>
  54 +<table/>
  55 +<timeout_days/>
  56 +<field><id>ID_BATCH</id><enabled>Y</enabled><name>ID_BATCH</name></field><field><id>CHANNEL_ID</id><enabled>Y</enabled><name>CHANNEL_ID</name></field><field><id>LOG_DATE</id><enabled>Y</enabled><name>LOG_DATE</name></field><field><id>METRICS_DATE</id><enabled>Y</enabled><name>METRICS_DATE</name></field><field><id>METRICS_CODE</id><enabled>Y</enabled><name>METRICS_CODE</name></field><field><id>METRICS_DESCRIPTION</id><enabled>Y</enabled><name>METRICS_DESCRIPTION</name></field><field><id>METRICS_SUBJECT</id><enabled>Y</enabled><name>METRICS_SUBJECT</name></field><field><id>METRICS_TYPE</id><enabled>Y</enabled><name>METRICS_TYPE</name></field><field><id>METRICS_VALUE</id><enabled>Y</enabled><name>METRICS_VALUE</name></field></metrics-log-table>
  57 + </log>
  58 + <maxdate>
  59 + <connection/>
  60 + <table/>
  61 + <field/>
  62 + <offset>0.0</offset>
  63 + <maxdiff>0.0</maxdiff>
  64 + </maxdate>
  65 + <size_rowset>10000</size_rowset>
  66 + <sleep_time_empty>50</sleep_time_empty>
  67 + <sleep_time_full>50</sleep_time_full>
  68 + <unique_connections>N</unique_connections>
  69 + <feedback_shown>Y</feedback_shown>
  70 + <feedback_size>50000</feedback_size>
  71 + <using_thread_priorities>Y</using_thread_priorities>
  72 + <shared_objects_file/>
  73 + <capture_step_performance>N</capture_step_performance>
  74 + <step_performance_capturing_delay>1000</step_performance_capturing_delay>
  75 + <step_performance_capturing_size_limit>100</step_performance_capturing_size_limit>
  76 + <dependencies>
  77 + </dependencies>
  78 + <partitionschemas>
  79 + </partitionschemas>
  80 + <slaveservers>
  81 + </slaveservers>
  82 + <clusterschemas>
  83 + </clusterschemas>
  84 + <created_user>-</created_user>
  85 + <created_date>2016&#x2f;08&#x2f;05 16&#x3a;42&#x3a;22.753</created_date>
  86 + <modified_user>-</modified_user>
  87 + <modified_date>2016&#x2f;08&#x2f;05 16&#x3a;42&#x3a;22.753</modified_date>
  88 + <key_for_session_key>H4sIAAAAAAAAAAMAAAAAAAAAAAA&#x3d;</key_for_session_key>
  89 + <is_key_private>N</is_key_private>
  90 + </info>
  91 + <notepads>
  92 + </notepads>
  93 + <connection>
  94 + <name>192.168.168.1_jwgl_dw</name>
  95 + <server>192.168.168.1</server>
  96 + <type>ORACLE</type>
  97 + <access>Native</access>
  98 + <database>orcl</database>
  99 + <port>1521</port>
  100 + <username>jwgl_dw</username>
  101 + <password>Encrypted 2be98afc86aa7f2e4cb13b977d2adabcd</password>
  102 + <servername/>
  103 + <data_tablespace/>
  104 + <index_tablespace/>
  105 + <attributes>
  106 + <attribute><code>FORCE_IDENTIFIERS_TO_LOWERCASE</code><attribute>N</attribute></attribute>
  107 + <attribute><code>FORCE_IDENTIFIERS_TO_UPPERCASE</code><attribute>N</attribute></attribute>
  108 + <attribute><code>IS_CLUSTERED</code><attribute>N</attribute></attribute>
  109 + <attribute><code>PORT_NUMBER</code><attribute>1521</attribute></attribute>
  110 + <attribute><code>PRESERVE_RESERVED_WORD_CASE</code><attribute>N</attribute></attribute>
  111 + <attribute><code>QUOTE_ALL_FIELDS</code><attribute>N</attribute></attribute>
  112 + <attribute><code>SUPPORTS_BOOLEAN_DATA_TYPE</code><attribute>Y</attribute></attribute>
  113 + <attribute><code>SUPPORTS_TIMESTAMP_DATA_TYPE</code><attribute>Y</attribute></attribute>
  114 + <attribute><code>USE_POOLING</code><attribute>N</attribute></attribute>
  115 + </attributes>
  116 + </connection>
  117 + <connection>
  118 + <name>bus_control_variable</name>
  119 + <server>&#x24;&#x7b;v_db_ip&#x7d;</server>
  120 + <type>MYSQL</type>
  121 + <access>Native</access>
  122 + <database>&#x24;&#x7b;v_db_dname&#x7d;</database>
  123 + <port>3306</port>
  124 + <username>&#x24;&#x7b;v_db_uname&#x7d;</username>
  125 + <password>&#x24;&#x7b;v_db_pwd&#x7d;</password>
  126 + <servername/>
  127 + <data_tablespace/>
  128 + <index_tablespace/>
  129 + <attributes>
  130 + <attribute><code>EXTRA_OPTION_MYSQL.characterEncoding</code><attribute>utf8</attribute></attribute>
  131 + <attribute><code>EXTRA_OPTION_MYSQL.defaultFetchSize</code><attribute>500</attribute></attribute>
  132 + <attribute><code>EXTRA_OPTION_MYSQL.useCursorFetch</code><attribute>true</attribute></attribute>
  133 + <attribute><code>FORCE_IDENTIFIERS_TO_LOWERCASE</code><attribute>N</attribute></attribute>
  134 + <attribute><code>FORCE_IDENTIFIERS_TO_UPPERCASE</code><attribute>N</attribute></attribute>
  135 + <attribute><code>IS_CLUSTERED</code><attribute>N</attribute></attribute>
  136 + <attribute><code>PORT_NUMBER</code><attribute>3306</attribute></attribute>
  137 + <attribute><code>PRESERVE_RESERVED_WORD_CASE</code><attribute>N</attribute></attribute>
  138 + <attribute><code>QUOTE_ALL_FIELDS</code><attribute>N</attribute></attribute>
  139 + <attribute><code>STREAM_RESULTS</code><attribute>N</attribute></attribute>
  140 + <attribute><code>SUPPORTS_BOOLEAN_DATA_TYPE</code><attribute>Y</attribute></attribute>
  141 + <attribute><code>SUPPORTS_TIMESTAMP_DATA_TYPE</code><attribute>Y</attribute></attribute>
  142 + <attribute><code>USE_POOLING</code><attribute>N</attribute></attribute>
  143 + </attributes>
  144 + </connection>
  145 + <connection>
  146 + <name>bus_control_&#x516c;&#x53f8;_201</name>
  147 + <server>localhost</server>
  148 + <type>MYSQL</type>
  149 + <access>Native</access>
  150 + <database>control</database>
  151 + <port>3306</port>
  152 + <username>root</username>
  153 + <password>Encrypted </password>
  154 + <servername/>
  155 + <data_tablespace/>
  156 + <index_tablespace/>
  157 + <attributes>
  158 + <attribute><code>EXTRA_OPTION_MYSQL.defaultFetchSize</code><attribute>500</attribute></attribute>
  159 + <attribute><code>EXTRA_OPTION_MYSQL.useCursorFetch</code><attribute>true</attribute></attribute>
  160 + <attribute><code>FORCE_IDENTIFIERS_TO_LOWERCASE</code><attribute>N</attribute></attribute>
  161 + <attribute><code>FORCE_IDENTIFIERS_TO_UPPERCASE</code><attribute>N</attribute></attribute>
  162 + <attribute><code>IS_CLUSTERED</code><attribute>N</attribute></attribute>
  163 + <attribute><code>PORT_NUMBER</code><attribute>3306</attribute></attribute>
  164 + <attribute><code>PRESERVE_RESERVED_WORD_CASE</code><attribute>N</attribute></attribute>
  165 + <attribute><code>QUOTE_ALL_FIELDS</code><attribute>N</attribute></attribute>
  166 + <attribute><code>STREAM_RESULTS</code><attribute>N</attribute></attribute>
  167 + <attribute><code>SUPPORTS_BOOLEAN_DATA_TYPE</code><attribute>Y</attribute></attribute>
  168 + <attribute><code>SUPPORTS_TIMESTAMP_DATA_TYPE</code><attribute>Y</attribute></attribute>
  169 + <attribute><code>USE_POOLING</code><attribute>N</attribute></attribute>
  170 + </attributes>
  171 + </connection>
  172 + <connection>
  173 + <name>bus_control_&#x672c;&#x673a;</name>
  174 + <server>localhost</server>
  175 + <type>MYSQL</type>
  176 + <access>Native</access>
  177 + <database>control</database>
  178 + <port>3306</port>
  179 + <username>root</username>
  180 + <password>Encrypted </password>
  181 + <servername/>
  182 + <data_tablespace/>
  183 + <index_tablespace/>
  184 + <attributes>
  185 + <attribute><code>EXTRA_OPTION_MYSQL.defaultFetchSize</code><attribute>500</attribute></attribute>
  186 + <attribute><code>EXTRA_OPTION_MYSQL.useCursorFetch</code><attribute>true</attribute></attribute>
  187 + <attribute><code>FORCE_IDENTIFIERS_TO_LOWERCASE</code><attribute>N</attribute></attribute>
  188 + <attribute><code>FORCE_IDENTIFIERS_TO_UPPERCASE</code><attribute>N</attribute></attribute>
  189 + <attribute><code>IS_CLUSTERED</code><attribute>N</attribute></attribute>
  190 + <attribute><code>PORT_NUMBER</code><attribute>3306</attribute></attribute>
  191 + <attribute><code>PRESERVE_RESERVED_WORD_CASE</code><attribute>N</attribute></attribute>
  192 + <attribute><code>QUOTE_ALL_FIELDS</code><attribute>N</attribute></attribute>
  193 + <attribute><code>STREAM_RESULTS</code><attribute>Y</attribute></attribute>
  194 + <attribute><code>SUPPORTS_BOOLEAN_DATA_TYPE</code><attribute>Y</attribute></attribute>
  195 + <attribute><code>SUPPORTS_TIMESTAMP_DATA_TYPE</code><attribute>Y</attribute></attribute>
  196 + <attribute><code>USE_POOLING</code><attribute>N</attribute></attribute>
  197 + </attributes>
  198 + </connection>
  199 + <connection>
  200 + <name>JGJW_VM</name>
  201 + <server>192.168.198.240</server>
  202 + <type>ORACLE</type>
  203 + <access>Native</access>
  204 + <database>orcl</database>
  205 + <port>1521</port>
  206 + <username>jwgl</username>
  207 + <password>Encrypted 2be98afc86aa7f2e4cb79ce10d485a8d6</password>
  208 + <servername/>
  209 + <data_tablespace/>
  210 + <index_tablespace/>
  211 + <attributes>
  212 + <attribute><code>FORCE_IDENTIFIERS_TO_LOWERCASE</code><attribute>N</attribute></attribute>
  213 + <attribute><code>FORCE_IDENTIFIERS_TO_UPPERCASE</code><attribute>N</attribute></attribute>
  214 + <attribute><code>IS_CLUSTERED</code><attribute>N</attribute></attribute>
  215 + <attribute><code>PORT_NUMBER</code><attribute>1521</attribute></attribute>
  216 + <attribute><code>PRESERVE_RESERVED_WORD_CASE</code><attribute>N</attribute></attribute>
  217 + <attribute><code>QUOTE_ALL_FIELDS</code><attribute>N</attribute></attribute>
  218 + <attribute><code>SUPPORTS_BOOLEAN_DATA_TYPE</code><attribute>Y</attribute></attribute>
  219 + <attribute><code>SUPPORTS_TIMESTAMP_DATA_TYPE</code><attribute>Y</attribute></attribute>
  220 + <attribute><code>USE_POOLING</code><attribute>N</attribute></attribute>
  221 + </attributes>
  222 + </connection>
  223 + <connection>
  224 + <name>NHJW_VM</name>
  225 + <server>192.168.198.240</server>
  226 + <type>ORACLE</type>
  227 + <access>Native</access>
  228 + <database>orcl</database>
  229 + <port>1521</port>
  230 + <username>nhjw</username>
  231 + <password>Encrypted 2be98afc86aa7f2e4cb79ce10d09aa5cd</password>
  232 + <servername/>
  233 + <data_tablespace/>
  234 + <index_tablespace/>
  235 + <attributes>
  236 + <attribute><code>FORCE_IDENTIFIERS_TO_LOWERCASE</code><attribute>N</attribute></attribute>
  237 + <attribute><code>FORCE_IDENTIFIERS_TO_UPPERCASE</code><attribute>N</attribute></attribute>
  238 + <attribute><code>IS_CLUSTERED</code><attribute>N</attribute></attribute>
  239 + <attribute><code>PORT_NUMBER</code><attribute>1521</attribute></attribute>
  240 + <attribute><code>PRESERVE_RESERVED_WORD_CASE</code><attribute>N</attribute></attribute>
  241 + <attribute><code>QUOTE_ALL_FIELDS</code><attribute>N</attribute></attribute>
  242 + <attribute><code>SUPPORTS_BOOLEAN_DATA_TYPE</code><attribute>Y</attribute></attribute>
  243 + <attribute><code>SUPPORTS_TIMESTAMP_DATA_TYPE</code><attribute>Y</attribute></attribute>
  244 + <attribute><code>USE_POOLING</code><attribute>N</attribute></attribute>
  245 + </attributes>
  246 + </connection>
  247 + <connection>
  248 + <name>PDGJ_VM</name>
  249 + <server>192.168.198.240</server>
  250 + <type>ORACLE</type>
  251 + <access>Native</access>
  252 + <database>orcl</database>
  253 + <port>1521</port>
  254 + <username>pdgj</username>
  255 + <password>Encrypted 2be98afc86aa7f2e4cb79ce10ce96a8d0</password>
  256 + <servername/>
  257 + <data_tablespace/>
  258 + <index_tablespace/>
  259 + <attributes>
  260 + <attribute><code>FORCE_IDENTIFIERS_TO_LOWERCASE</code><attribute>N</attribute></attribute>
  261 + <attribute><code>FORCE_IDENTIFIERS_TO_UPPERCASE</code><attribute>N</attribute></attribute>
  262 + <attribute><code>IS_CLUSTERED</code><attribute>N</attribute></attribute>
  263 + <attribute><code>PORT_NUMBER</code><attribute>1521</attribute></attribute>
  264 + <attribute><code>PRESERVE_RESERVED_WORD_CASE</code><attribute>N</attribute></attribute>
  265 + <attribute><code>QUOTE_ALL_FIELDS</code><attribute>N</attribute></attribute>
  266 + <attribute><code>SUPPORTS_BOOLEAN_DATA_TYPE</code><attribute>Y</attribute></attribute>
  267 + <attribute><code>SUPPORTS_TIMESTAMP_DATA_TYPE</code><attribute>Y</attribute></attribute>
  268 + <attribute><code>USE_POOLING</code><attribute>N</attribute></attribute>
  269 + </attributes>
  270 + </connection>
  271 + <connection>
  272 + <name>SNJW_VM</name>
  273 + <server>192.168.198.240</server>
  274 + <type>ORACLE</type>
  275 + <access>Native</access>
  276 + <database>orcl</database>
  277 + <port>1521</port>
  278 + <username>snjw</username>
  279 + <password>Encrypted 2be98afc86aa7f2e4cb79ce10cd9ca5cd</password>
  280 + <servername/>
  281 + <data_tablespace/>
  282 + <index_tablespace/>
  283 + <attributes>
  284 + <attribute><code>FORCE_IDENTIFIERS_TO_LOWERCASE</code><attribute>N</attribute></attribute>
  285 + <attribute><code>FORCE_IDENTIFIERS_TO_UPPERCASE</code><attribute>N</attribute></attribute>
  286 + <attribute><code>IS_CLUSTERED</code><attribute>N</attribute></attribute>
  287 + <attribute><code>PORT_NUMBER</code><attribute>1521</attribute></attribute>
  288 + <attribute><code>PRESERVE_RESERVED_WORD_CASE</code><attribute>N</attribute></attribute>
  289 + <attribute><code>QUOTE_ALL_FIELDS</code><attribute>N</attribute></attribute>
  290 + <attribute><code>SUPPORTS_BOOLEAN_DATA_TYPE</code><attribute>Y</attribute></attribute>
  291 + <attribute><code>SUPPORTS_TIMESTAMP_DATA_TYPE</code><attribute>Y</attribute></attribute>
  292 + <attribute><code>USE_POOLING</code><attribute>N</attribute></attribute>
  293 + </attributes>
  294 + </connection>
  295 + <connection>
  296 + <name>xlab_mysql_youle</name>
  297 + <server>101.231.124.8</server>
  298 + <type>MYSQL</type>
  299 + <access>Native</access>
  300 + <database>xlab_youle</database>
  301 + <port>45687</port>
  302 + <username>xlab-youle</username>
  303 + <password>Encrypted 2be98afc86aa78a88aa1be369d187a3df</password>
  304 + <servername/>
  305 + <data_tablespace/>
  306 + <index_tablespace/>
  307 + <attributes>
  308 + <attribute><code>EXTRA_OPTION_MYSQL.defaultFetchSize</code><attribute>500</attribute></attribute>
  309 + <attribute><code>EXTRA_OPTION_MYSQL.useCursorFetch</code><attribute>true</attribute></attribute>
  310 + <attribute><code>FORCE_IDENTIFIERS_TO_LOWERCASE</code><attribute>N</attribute></attribute>
  311 + <attribute><code>FORCE_IDENTIFIERS_TO_UPPERCASE</code><attribute>N</attribute></attribute>
  312 + <attribute><code>IS_CLUSTERED</code><attribute>N</attribute></attribute>
  313 + <attribute><code>PORT_NUMBER</code><attribute>45687</attribute></attribute>
  314 + <attribute><code>PRESERVE_RESERVED_WORD_CASE</code><attribute>N</attribute></attribute>
  315 + <attribute><code>QUOTE_ALL_FIELDS</code><attribute>N</attribute></attribute>
  316 + <attribute><code>STREAM_RESULTS</code><attribute>Y</attribute></attribute>
  317 + <attribute><code>SUPPORTS_BOOLEAN_DATA_TYPE</code><attribute>N</attribute></attribute>
  318 + <attribute><code>SUPPORTS_TIMESTAMP_DATA_TYPE</code><attribute>N</attribute></attribute>
  319 + <attribute><code>USE_POOLING</code><attribute>N</attribute></attribute>
  320 + </attributes>
  321 + </connection>
  322 + <connection>
  323 + <name>xlab_mysql_youle&#xff08;&#x672c;&#x673a;&#xff09;</name>
  324 + <server>localhost</server>
  325 + <type>MYSQL</type>
  326 + <access>Native</access>
  327 + <database>xlab_youle</database>
  328 + <port>3306</port>
  329 + <username>root</username>
  330 + <password>Encrypted </password>
  331 + <servername/>
  332 + <data_tablespace/>
  333 + <index_tablespace/>
  334 + <attributes>
  335 + <attribute><code>EXTRA_OPTION_MYSQL.defaultFetchSize</code><attribute>500</attribute></attribute>
  336 + <attribute><code>EXTRA_OPTION_MYSQL.useCursorFetch</code><attribute>true</attribute></attribute>
  337 + <attribute><code>FORCE_IDENTIFIERS_TO_LOWERCASE</code><attribute>N</attribute></attribute>
  338 + <attribute><code>FORCE_IDENTIFIERS_TO_UPPERCASE</code><attribute>N</attribute></attribute>
  339 + <attribute><code>IS_CLUSTERED</code><attribute>N</attribute></attribute>
  340 + <attribute><code>PORT_NUMBER</code><attribute>3306</attribute></attribute>
  341 + <attribute><code>PRESERVE_RESERVED_WORD_CASE</code><attribute>N</attribute></attribute>
  342 + <attribute><code>QUOTE_ALL_FIELDS</code><attribute>N</attribute></attribute>
  343 + <attribute><code>STREAM_RESULTS</code><attribute>Y</attribute></attribute>
  344 + <attribute><code>SUPPORTS_BOOLEAN_DATA_TYPE</code><attribute>N</attribute></attribute>
  345 + <attribute><code>SUPPORTS_TIMESTAMP_DATA_TYPE</code><attribute>N</attribute></attribute>
  346 + <attribute><code>USE_POOLING</code><attribute>N</attribute></attribute>
  347 + </attributes>
  348 + </connection>
  349 + <connection>
  350 + <name>xlab_youle</name>
  351 + <server/>
  352 + <type>MYSQL</type>
  353 + <access>JNDI</access>
  354 + <database>xlab_youle</database>
  355 + <port>1521</port>
  356 + <username/>
  357 + <password>Encrypted </password>
  358 + <servername/>
  359 + <data_tablespace/>
  360 + <index_tablespace/>
  361 + <attributes>
  362 + <attribute><code>FORCE_IDENTIFIERS_TO_LOWERCASE</code><attribute>N</attribute></attribute>
  363 + <attribute><code>FORCE_IDENTIFIERS_TO_UPPERCASE</code><attribute>N</attribute></attribute>
  364 + <attribute><code>IS_CLUSTERED</code><attribute>N</attribute></attribute>
  365 + <attribute><code>PORT_NUMBER</code><attribute>1521</attribute></attribute>
  366 + <attribute><code>PRESERVE_RESERVED_WORD_CASE</code><attribute>N</attribute></attribute>
  367 + <attribute><code>QUOTE_ALL_FIELDS</code><attribute>N</attribute></attribute>
  368 + <attribute><code>STREAM_RESULTS</code><attribute>Y</attribute></attribute>
  369 + <attribute><code>SUPPORTS_BOOLEAN_DATA_TYPE</code><attribute>Y</attribute></attribute>
  370 + <attribute><code>SUPPORTS_TIMESTAMP_DATA_TYPE</code><attribute>Y</attribute></attribute>
  371 + <attribute><code>USE_POOLING</code><attribute>N</attribute></attribute>
  372 + </attributes>
  373 + </connection>
  374 + <connection>
  375 + <name>YGJW_VM</name>
  376 + <server>192.168.198.240</server>
  377 + <type>ORACLE</type>
  378 + <access>Native</access>
  379 + <database>orcl</database>
  380 + <port>1521</port>
  381 + <username>ygjw</username>
  382 + <password>Encrypted 2be98afc86aa7f2e4cb79ce10c795a5cd</password>
  383 + <servername/>
  384 + <data_tablespace/>
  385 + <index_tablespace/>
  386 + <attributes>
  387 + <attribute><code>FORCE_IDENTIFIERS_TO_LOWERCASE</code><attribute>N</attribute></attribute>
  388 + <attribute><code>FORCE_IDENTIFIERS_TO_UPPERCASE</code><attribute>N</attribute></attribute>
  389 + <attribute><code>IS_CLUSTERED</code><attribute>N</attribute></attribute>
  390 + <attribute><code>PORT_NUMBER</code><attribute>1521</attribute></attribute>
  391 + <attribute><code>PRESERVE_RESERVED_WORD_CASE</code><attribute>N</attribute></attribute>
  392 + <attribute><code>QUOTE_ALL_FIELDS</code><attribute>N</attribute></attribute>
  393 + <attribute><code>SUPPORTS_BOOLEAN_DATA_TYPE</code><attribute>Y</attribute></attribute>
  394 + <attribute><code>SUPPORTS_TIMESTAMP_DATA_TYPE</code><attribute>Y</attribute></attribute>
  395 + <attribute><code>USE_POOLING</code><attribute>N</attribute></attribute>
  396 + </attributes>
  397 + </connection>
  398 + <connection>
  399 + <name>&#x516c;&#x53f8;jgjw</name>
  400 + <server>192.168.168.1</server>
  401 + <type>ORACLE</type>
  402 + <access>Native</access>
  403 + <database>orcl</database>
  404 + <port>1521</port>
  405 + <username>jwgl</username>
  406 + <password>Encrypted 2be98afc86aa7f2e4cb79ce10d485a8d6</password>
  407 + <servername/>
  408 + <data_tablespace/>
  409 + <index_tablespace/>
  410 + <attributes>
  411 + <attribute><code>FORCE_IDENTIFIERS_TO_LOWERCASE</code><attribute>N</attribute></attribute>
  412 + <attribute><code>FORCE_IDENTIFIERS_TO_UPPERCASE</code><attribute>N</attribute></attribute>
  413 + <attribute><code>IS_CLUSTERED</code><attribute>N</attribute></attribute>
  414 + <attribute><code>PORT_NUMBER</code><attribute>1521</attribute></attribute>
  415 + <attribute><code>PRESERVE_RESERVED_WORD_CASE</code><attribute>N</attribute></attribute>
  416 + <attribute><code>QUOTE_ALL_FIELDS</code><attribute>N</attribute></attribute>
  417 + <attribute><code>SUPPORTS_BOOLEAN_DATA_TYPE</code><attribute>Y</attribute></attribute>
  418 + <attribute><code>SUPPORTS_TIMESTAMP_DATA_TYPE</code><attribute>Y</attribute></attribute>
  419 + <attribute><code>USE_POOLING</code><attribute>N</attribute></attribute>
  420 + </attributes>
  421 + </connection>
  422 + <connection>
  423 + <name>&#x516c;&#x53f8;snjw</name>
  424 + <server>192.168.168.1</server>
  425 + <type>ORACLE</type>
  426 + <access>Native</access>
  427 + <database>orcl</database>
  428 + <port>1521</port>
  429 + <username>snjw</username>
  430 + <password>Encrypted 2be98afc86aa7f2e4cb79ce10cd9ca5cd</password>
  431 + <servername/>
  432 + <data_tablespace/>
  433 + <index_tablespace/>
  434 + <attributes>
  435 + <attribute><code>FORCE_IDENTIFIERS_TO_LOWERCASE</code><attribute>N</attribute></attribute>
  436 + <attribute><code>FORCE_IDENTIFIERS_TO_UPPERCASE</code><attribute>N</attribute></attribute>
  437 + <attribute><code>IS_CLUSTERED</code><attribute>N</attribute></attribute>
  438 + <attribute><code>PORT_NUMBER</code><attribute>1521</attribute></attribute>
  439 + <attribute><code>PRESERVE_RESERVED_WORD_CASE</code><attribute>N</attribute></attribute>
  440 + <attribute><code>QUOTE_ALL_FIELDS</code><attribute>N</attribute></attribute>
  441 + <attribute><code>SUPPORTS_BOOLEAN_DATA_TYPE</code><attribute>Y</attribute></attribute>
  442 + <attribute><code>SUPPORTS_TIMESTAMP_DATA_TYPE</code><attribute>Y</attribute></attribute>
  443 + <attribute><code>USE_POOLING</code><attribute>N</attribute></attribute>
  444 + </attributes>
  445 + </connection>
  446 + <connection>
  447 + <name>&#x516c;&#x53f8;ygjw</name>
  448 + <server>192.168.168.1</server>
  449 + <type>ORACLE</type>
  450 + <access>Native</access>
  451 + <database>orcl</database>
  452 + <port>1521</port>
  453 + <username>ygjw</username>
  454 + <password>Encrypted 2be98afc86aa7f2e4cb79ce10c795a5cd</password>
  455 + <servername/>
  456 + <data_tablespace/>
  457 + <index_tablespace/>
  458 + <attributes>
  459 + <attribute><code>FORCE_IDENTIFIERS_TO_LOWERCASE</code><attribute>N</attribute></attribute>
  460 + <attribute><code>FORCE_IDENTIFIERS_TO_UPPERCASE</code><attribute>N</attribute></attribute>
  461 + <attribute><code>IS_CLUSTERED</code><attribute>N</attribute></attribute>
  462 + <attribute><code>PORT_NUMBER</code><attribute>1521</attribute></attribute>
  463 + <attribute><code>PRESERVE_RESERVED_WORD_CASE</code><attribute>N</attribute></attribute>
  464 + <attribute><code>QUOTE_ALL_FIELDS</code><attribute>N</attribute></attribute>
  465 + <attribute><code>SUPPORTS_BOOLEAN_DATA_TYPE</code><attribute>Y</attribute></attribute>
  466 + <attribute><code>SUPPORTS_TIMESTAMP_DATA_TYPE</code><attribute>Y</attribute></attribute>
  467 + <attribute><code>USE_POOLING</code><attribute>N</attribute></attribute>
  468 + </attributes>
  469 + </connection>
  470 + <order>
  471 + <hop> <from>&#x516c;&#x53f8;&#x67e5;&#x8be2;</from><to>&#x5206;&#x516c;&#x53f8;&#x67e5;&#x8be2;</to><enabled>Y</enabled> </hop>
  472 + <hop> <from>&#x5206;&#x516c;&#x53f8;&#x67e5;&#x8be2;</from><to>&#x5b57;&#x6bb5;&#x9009;&#x62e9;</to><enabled>Y</enabled> </hop>
  473 + <hop> <from>&#x6dfb;&#x52a0;&#x67e5;&#x8be2;&#x5e38;&#x91cf;</from><to>&#x516c;&#x53f8;&#x67e5;&#x8be2;</to><enabled>Y</enabled> </hop>
  474 + <hop> <from>&#x8f66;&#x8f86;&#x4fe1;&#x606f;&#x8868;&#x8f93;&#x5165;</from><to>&#x6dfb;&#x52a0;&#x67e5;&#x8be2;&#x5e38;&#x91cf;</to><enabled>Y</enabled> </hop>
  475 + <hop> <from>&#x5b57;&#x6bb5;&#x9009;&#x62e9;</from><to>&#x662f;&#x5426;&#x7535;&#x8f66;</to><enabled>Y</enabled> </hop>
  476 + <hop> <from>&#x662f;&#x5426;&#x7535;&#x8f66;</from><to>Excel&#x8f93;&#x51fa;</to><enabled>Y</enabled> </hop>
  477 + </order>
  478 + <step>
  479 + <name>Excel&#x8f93;&#x51fa;</name>
  480 + <type>ExcelOutput</type>
  481 + <description/>
  482 + <distribute>Y</distribute>
  483 + <custom_distribution/>
  484 + <copies>1</copies>
  485 + <partitioning>
  486 + <method>none</method>
  487 + <schema_name/>
  488 + </partitioning>
  489 + <header>Y</header>
  490 + <footer>N</footer>
  491 + <encoding/>
  492 + <append>N</append>
  493 + <add_to_result_filenames>Y</add_to_result_filenames>
  494 + <file>
  495 + <name>&#x24;&#x7b;filepath&#x7d;</name>
  496 + <extention>xls</extention>
  497 + <do_not_open_newfile_init>N</do_not_open_newfile_init>
  498 + <create_parent_folder>N</create_parent_folder>
  499 + <split>N</split>
  500 + <add_date>N</add_date>
  501 + <add_time>N</add_time>
  502 + <SpecifyFormat>N</SpecifyFormat>
  503 + <date_time_format>yyyyMMddHHmmss</date_time_format>
  504 + <sheetname>&#x5de5;&#x4f5c;&#x8868;1</sheetname>
  505 + <autosizecolums>N</autosizecolums>
  506 + <nullisblank>N</nullisblank>
  507 + <protect_sheet>N</protect_sheet>
  508 + <password>Encrypted </password>
  509 + <splitevery>0</splitevery>
  510 + <usetempfiles>N</usetempfiles>
  511 + <tempdirectory/>
  512 + </file>
  513 + <template>
  514 + <enabled>N</enabled>
  515 + <append>N</append>
  516 + <filename>template.xls</filename>
  517 + </template>
  518 + <fields>
  519 + <field>
  520 + <name>&#x8f66;&#x724c;&#x53f7;</name>
  521 + <type>String</type>
  522 + <format/>
  523 + </field>
  524 + <field>
  525 + <name>&#x5185;&#x90e8;&#x7f16;&#x7801;</name>
  526 + <type>String</type>
  527 + <format/>
  528 + </field>
  529 + <field>
  530 + <name>&#x6240;&#x5c5e;&#x516c;&#x53f8;</name>
  531 + <type>String</type>
  532 + <format/>
  533 + </field>
  534 + <field>
  535 + <name>&#x6240;&#x5c5e;&#x5206;&#x516c;&#x53f8;</name>
  536 + <type>String</type>
  537 + <format/>
  538 + </field>
  539 + <field>
  540 + <name>&#x8bbe;&#x5907;&#x4f9b;&#x5e94;&#x5382;&#x5546;</name>
  541 + <type>String</type>
  542 + <format/>
  543 + </field>
  544 + <field>
  545 + <name>&#x8bbe;&#x5907;&#x7ec8;&#x7aef;&#x53f7;</name>
  546 + <type>String</type>
  547 + <format/>
  548 + </field>
  549 + <field>
  550 + <name>&#x662f;&#x5426;&#x7535;&#x8f66;</name>
  551 + <type>String</type>
  552 + <format/>
  553 + </field>
  554 + </fields>
  555 + <custom>
  556 + <header_font_name>arial</header_font_name>
  557 + <header_font_size>10</header_font_size>
  558 + <header_font_bold>N</header_font_bold>
  559 + <header_font_italic>N</header_font_italic>
  560 + <header_font_underline>no</header_font_underline>
  561 + <header_font_orientation>horizontal</header_font_orientation>
  562 + <header_font_color>black</header_font_color>
  563 + <header_background_color>none</header_background_color>
  564 + <header_row_height>255</header_row_height>
  565 + <header_alignment>left</header_alignment>
  566 + <header_image/>
  567 + <row_font_name>arial</row_font_name>
  568 + <row_font_size>10</row_font_size>
  569 + <row_font_color>black</row_font_color>
  570 + <row_background_color>none</row_background_color>
  571 + </custom>
  572 + <cluster_schema/>
  573 + <remotesteps> <input> </input> <output> </output> </remotesteps> <GUI>
  574 + <xloc>498</xloc>
  575 + <yloc>348</yloc>
  576 + <draw>Y</draw>
  577 + </GUI>
  578 + </step>
  579 +
  580 + <step>
  581 + <name>&#x516c;&#x53f8;&#x67e5;&#x8be2;</name>
  582 + <type>DBLookup</type>
  583 + <description/>
  584 + <distribute>Y</distribute>
  585 + <custom_distribution/>
  586 + <copies>1</copies>
  587 + <partitioning>
  588 + <method>none</method>
  589 + <schema_name/>
  590 + </partitioning>
  591 + <connection>bus_control_variable</connection>
  592 + <cache>N</cache>
  593 + <cache_load_all>N</cache_load_all>
  594 + <cache_size>0</cache_size>
  595 + <lookup>
  596 + <schema/>
  597 + <table>bsth_c_business</table>
  598 + <orderby/>
  599 + <fail_on_multiple>N</fail_on_multiple>
  600 + <eat_row_on_failure>N</eat_row_on_failure>
  601 + <key>
  602 + <name>up_code</name>
  603 + <field>up_code</field>
  604 + <condition>&#x3d;</condition>
  605 + <name2/>
  606 + </key>
  607 + <key>
  608 + <name>business_code</name>
  609 + <field>business_code</field>
  610 + <condition>&#x3d;</condition>
  611 + <name2/>
  612 + </key>
  613 + <value>
  614 + <name>business_name</name>
  615 + <rename>gs</rename>
  616 + <default/>
  617 + <type>String</type>
  618 + </value>
  619 + </lookup>
  620 + <cluster_schema/>
  621 + <remotesteps> <input> </input> <output> </output> </remotesteps> <GUI>
  622 + <xloc>364</xloc>
  623 + <yloc>60</yloc>
  624 + <draw>Y</draw>
  625 + </GUI>
  626 + </step>
  627 +
  628 + <step>
  629 + <name>&#x5206;&#x516c;&#x53f8;&#x67e5;&#x8be2;</name>
  630 + <type>DBLookup</type>
  631 + <description/>
  632 + <distribute>Y</distribute>
  633 + <custom_distribution/>
  634 + <copies>1</copies>
  635 + <partitioning>
  636 + <method>none</method>
  637 + <schema_name/>
  638 + </partitioning>
  639 + <connection>bus_control_variable</connection>
  640 + <cache>N</cache>
  641 + <cache_load_all>N</cache_load_all>
  642 + <cache_size>0</cache_size>
  643 + <lookup>
  644 + <schema/>
  645 + <table>bsth_c_business</table>
  646 + <orderby/>
  647 + <fail_on_multiple>N</fail_on_multiple>
  648 + <eat_row_on_failure>N</eat_row_on_failure>
  649 + <key>
  650 + <name>business_code</name>
  651 + <field>up_code</field>
  652 + <condition>&#x3d;</condition>
  653 + <name2/>
  654 + </key>
  655 + <key>
  656 + <name>branche_company_code</name>
  657 + <field>business_code</field>
  658 + <condition>&#x3d;</condition>
  659 + <name2/>
  660 + </key>
  661 + <value>
  662 + <name>business_name</name>
  663 + <rename>fgs</rename>
  664 + <default/>
  665 + <type>String</type>
  666 + </value>
  667 + </lookup>
  668 + <cluster_schema/>
  669 + <remotesteps> <input> </input> <output> </output> </remotesteps> <GUI>
  670 + <xloc>491</xloc>
  671 + <yloc>60</yloc>
  672 + <draw>Y</draw>
  673 + </GUI>
  674 + </step>
  675 +
  676 + <step>
  677 + <name>&#x5b57;&#x6bb5;&#x9009;&#x62e9;</name>
  678 + <type>SelectValues</type>
  679 + <description/>
  680 + <distribute>N</distribute>
  681 + <custom_distribution/>
  682 + <copies>1</copies>
  683 + <partitioning>
  684 + <method>none</method>
  685 + <schema_name/>
  686 + </partitioning>
  687 + <fields> <field> <name>car_plate</name>
  688 + <rename>&#x8f66;&#x724c;&#x53f7;</rename>
  689 + <length>-2</length>
  690 + <precision>-2</precision>
  691 + </field> <field> <name>inside_code</name>
  692 + <rename>&#x5185;&#x90e8;&#x7f16;&#x7801;</rename>
  693 + <length>-2</length>
  694 + <precision>-2</precision>
  695 + </field> <field> <name>gs</name>
  696 + <rename>&#x6240;&#x5c5e;&#x516c;&#x53f8;</rename>
  697 + <length>-2</length>
  698 + <precision>-2</precision>
  699 + </field> <field> <name>fgs</name>
  700 + <rename>&#x6240;&#x5c5e;&#x5206;&#x516c;&#x53f8;</rename>
  701 + <length>-2</length>
  702 + <precision>-2</precision>
  703 + </field> <field> <name>supplier_name</name>
  704 + <rename>&#x8bbe;&#x5907;&#x4f9b;&#x5e94;&#x5382;&#x5546;</rename>
  705 + <length>-2</length>
  706 + <precision>-2</precision>
  707 + </field> <field> <name>equipment_code</name>
  708 + <rename>&#x8bbe;&#x5907;&#x7ec8;&#x7aef;&#x53f7;</rename>
  709 + <length>-2</length>
  710 + <precision>-2</precision>
  711 + </field> <field> <name>sfdc</name>
  712 + <rename>sfdc_cal</rename>
  713 + <length>-2</length>
  714 + <precision>-2</precision>
  715 + </field> <select_unspecified>N</select_unspecified>
  716 + </fields> <cluster_schema/>
  717 + <remotesteps> <input> </input> <output> </output> </remotesteps> <GUI>
  718 + <xloc>495</xloc>
  719 + <yloc>173</yloc>
  720 + <draw>Y</draw>
  721 + </GUI>
  722 + </step>
  723 +
  724 + <step>
  725 + <name>&#x662f;&#x5426;&#x7535;&#x8f66;</name>
  726 + <type>ScriptValueMod</type>
  727 + <description/>
  728 + <distribute>Y</distribute>
  729 + <custom_distribution/>
  730 + <copies>1</copies>
  731 + <partitioning>
  732 + <method>none</method>
  733 + <schema_name/>
  734 + </partitioning>
  735 + <compatible>N</compatible>
  736 + <optimizationLevel>9</optimizationLevel>
  737 + <jsScripts> <jsScript> <jsScript_type>0</jsScript_type>
  738 + <jsScript_name>Script 1</jsScript_name>
  739 + <jsScript_script>&#x2f;&#x2f;Script here&#xa;&#xa;var &#x662f;&#x5426;&#x7535;&#x8f66; &#x3d; &#x22;&#x5426;&#x22;&#x3b;&#xa;&#xa;if&#x28;sfdc_cal &#x3d;&#x3d; 0&#x29; &#x7b;&#xa; &#x662f;&#x5426;&#x7535;&#x8f66; &#x3d; &#x22;&#x5426;&#x22;&#x3b;&#xa;&#x7d; else if &#x28;sfdc_cal &#x3d;&#x3d; 1&#x29; &#x7b;&#xa; &#x662f;&#x5426;&#x7535;&#x8f66; &#x3d; &#x22;&#x662f;&#x22;&#x3b;&#xa;&#x7d; else &#x7b;&#xa; &#x662f;&#x5426;&#x7535;&#x8f66; &#x3d; &#x22;&#x5426;&#x22;&#x3b;&#xa;&#x7d;&#xa;</jsScript_script>
  740 + </jsScript> </jsScripts> <fields> <field> <name>&#x662f;&#x5426;&#x7535;&#x8f66;</name>
  741 + <rename>&#x662f;&#x5426;&#x7535;&#x8f66;</rename>
  742 + <type>String</type>
  743 + <length>-1</length>
  744 + <precision>-1</precision>
  745 + <replace>N</replace>
  746 + </field> </fields> <cluster_schema/>
  747 + <remotesteps> <input> </input> <output> </output> </remotesteps> <GUI>
  748 + <xloc>695</xloc>
  749 + <yloc>173</yloc>
  750 + <draw>Y</draw>
  751 + </GUI>
  752 + </step>
  753 +
  754 + <step>
  755 + <name>&#x6dfb;&#x52a0;&#x67e5;&#x8be2;&#x5e38;&#x91cf;</name>
  756 + <type>ScriptValueMod</type>
  757 + <description/>
  758 + <distribute>Y</distribute>
  759 + <custom_distribution/>
  760 + <copies>1</copies>
  761 + <partitioning>
  762 + <method>none</method>
  763 + <schema_name/>
  764 + </partitioning>
  765 + <compatible>N</compatible>
  766 + <optimizationLevel>9</optimizationLevel>
  767 + <jsScripts> <jsScript> <jsScript_type>0</jsScript_type>
  768 + <jsScript_name>Script 1</jsScript_name>
  769 + <jsScript_script>&#x2f;&#x2f;Script here&#xa;&#xa;var up_code &#x3d; &#x27;88&#x27;&#x3b;</jsScript_script>
  770 + </jsScript> </jsScripts> <fields> <field> <name>up_code</name>
  771 + <rename>up_code</rename>
  772 + <type>String</type>
  773 + <length>-1</length>
  774 + <precision>-1</precision>
  775 + <replace>N</replace>
  776 + </field> </fields> <cluster_schema/>
  777 + <remotesteps> <input> </input> <output> </output> </remotesteps> <GUI>
  778 + <xloc>227</xloc>
  779 + <yloc>59</yloc>
  780 + <draw>Y</draw>
  781 + </GUI>
  782 + </step>
  783 +
  784 + <step>
  785 + <name>&#x8f66;&#x8f86;&#x4fe1;&#x606f;&#x8868;&#x8f93;&#x5165;</name>
  786 + <type>TableInput</type>
  787 + <description/>
  788 + <distribute>Y</distribute>
  789 + <custom_distribution/>
  790 + <copies>1</copies>
  791 + <partitioning>
  792 + <method>none</method>
  793 + <schema_name/>
  794 + </partitioning>
  795 + <connection>bus_control_variable</connection>
  796 + <sql>SELECT &#x2a; FROM bsth_c_cars&#xa;where &#x24;&#x7b;QUERY&#x7d;</sql>
  797 + <limit>0</limit>
  798 + <lookup/>
  799 + <execute_each_row>N</execute_each_row>
  800 + <variables_active>Y</variables_active>
  801 + <lazy_conversion_active>N</lazy_conversion_active>
  802 + <cluster_schema/>
  803 + <remotesteps> <input> </input> <output> </output> </remotesteps> <GUI>
  804 + <xloc>88</xloc>
  805 + <yloc>59</yloc>
  806 + <draw>Y</draw>
  807 + </GUI>
  808 + </step>
  809 +
  810 + <step_error_handling>
  811 + </step_error_handling>
  812 + <slave-step-copy-partition-distribution>
  813 +</slave-step-copy-partition-distribution>
  814 + <slave_transformation>N</slave_transformation>
  815 +
  816 +</transformation>
... ...
src/main/resources/rules/functions.drl deleted 100644 → 0
1   -package com.bsth.service.schedule;
2   -
3   -import accumulate com.bsth.service.schedule.rules.ttinfo2.ErrorBcCountFunction ecount;
4   -import accumulate com.bsth.service.schedule.rules.shiftloop.GidsCountFunction gidscount;
5   -import accumulate com.bsth.service.schedule.rules.shiftloop.GidFbTimeFunction gidfbtime;
6   -import accumulate com.bsth.service.schedule.rules.shiftloop.GidFbFcnoFunction gidfbfcno;
7   -import accumulate com.bsth.service.schedule.rules.ttinfo.LpInfoResultsFunction lpinforesult;
8   -import accumulate com.bsth.service.schedule.rules.ttinfo.MinRuleQyrqFunction minruleqyrq;
9   -import accumulate com.bsth.service.schedule.rules.validate.ValidRepeatBcFunction vrb;
10   -import accumulate com.bsth.service.schedule.rules.validate.ValidWholeRerunBcFunction vwrb;
11   -import accumulate com.bsth.service.schedule.rules.validate.ValidWantLpFunction vwlp;
src/main/resources/rules/kBase1_core_functions.drl 0 → 100644
  1 +package com.bsth.service.schedule.impl.plan.kBase1.core;
  2 +
  3 +import accumulate com.bsth.service.schedule.impl.plan.kBase1.core.shiftloop.GidsCountFunction gidscount;
  4 +import accumulate com.bsth.service.schedule.impl.plan.kBase1.core.shiftloop.GidFbTimeFunction gidfbtime;
  5 +import accumulate com.bsth.service.schedule.impl.plan.kBase1.core.shiftloop.GidFbFcnoFunction gidfbfcno;
  6 +import accumulate com.bsth.service.schedule.impl.plan.kBase1.core.ttinfo.LpInfoResultsFunction lpinforesult;
  7 +import accumulate com.bsth.service.schedule.impl.plan.kBase1.core.ttinfo.MinRuleQyrqFunction minruleqyrq;
  8 +import accumulate com.bsth.service.schedule.impl.plan.kBase1.core.validate.ValidRepeatBcFunction vrb;
  9 +import accumulate com.bsth.service.schedule.impl.plan.kBase1.core.validate.ValidWholeRerunBcFunction vwrb;
  10 +import accumulate com.bsth.service.schedule.impl.plan.kBase1.core.validate.ValidWantLpFunction vwlp;
... ...
src/main/resources/rules/plan.drl renamed to src/main/resources/rules/kBase1_core_plan.drl
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.repository.schedule.TTInfoDetailRepository;
10   -import com.bsth.repository.schedule.CarConfigInfoRepository;
11   -import com.bsth.repository.schedule.EmployeeConfigInfoRepository;
12   -import com.bsth.repository.LineRepository;
13   -import com.bsth.repository.BusinessRepository;
14   -
15   -import com.bsth.service.schedule.rules.shiftloop.ScheduleResult_output;
16   -import com.bsth.service.schedule.rules.shiftloop.ScheduleResults_output;
17   -import com.bsth.service.schedule.rules.ttinfo.TTInfoResult_output;
18   -import com.bsth.service.schedule.rules.ttinfo.TTInfoResults_output;
19   -import com.bsth.entity.Line;
20   -import com.bsth.entity.Business;
21   -
22   -import com.bsth.entity.schedule.CarConfigInfo;
23   -import com.bsth.entity.schedule.EmployeeConfigInfo;
24   -import com.bsth.entity.schedule.TTInfo;
25   -import com.bsth.entity.schedule.TTInfoDetail;
26   -import com.bsth.entity.schedule.SchedulePlanInfo;
27   -
28   -import org.slf4j.Logger
29   -import org.joda.time.format.DateTimeFormat
30   -import org.apache.commons.lang3.StringUtils
31   -import com.bsth.service.schedule.rules.shiftloop.ScheduleRule_Type;
32   -
33   -
34   -// 全局日志类(一般使用调用此规则的service类)
35   -global Logger log;
36   -
37   -global TTInfoDetailRepository tTInfoDetailRepository;
38   -global CarConfigInfoRepository carConfigInfoRepository;
39   -global EmployeeConfigInfoRepository employeeConfigInfoRepository;
40   -global LineRepository lineRepository;
41   -global BusinessRepository businessRepository;
42   -
43   -// 输出
44   -global PlanResult planResult;
45   -
46   -function Map xlidParams(String xlid) {
47   - Map param = new HashMap();
48   - param.put("xl.id_eq", Integer.valueOf(xlid));
49   - return param;
50   -}
51   -
52   -function List ecList(EmployeeConfigInfoRepository repo, String ecids) {
53   - List<String> ids = Arrays.asList(ecids.split("-"));
54   - List rst = new ArrayList();
55   - for (int i = 0; i < ids.size(); i++) {
56   - rst.add(repo.findOne(Long.parseLong(ids.get(i))));
57   - }
58   - return rst;
59   -}
60   -
61   -function LocalTime fcsjTime(String fcsj) {
62   - if ("NULL".equals(fcsj)) {
63   - return null;
64   - }
65   - return LocalTime.parse(fcsj, DateTimeFormat.forPattern("HH:mm"));
66   -}
67   -
68   -function String ttInfoId_sd(Map map, DateTime sd) {
69   - TTInfoResult_output ttInfoResult_output = (TTInfoResult_output) map.get(sd);
70   - return ttInfoResult_output.getTtInfoId();
71   -}
72   -
73   -function Map gsMap(List gses) {
74   - Map gsMap = new HashMap();
75   - for (int i = 0; i < gses.size(); i++) {
76   - Business gs = (Business) gses.get(i);
77   - if (StringUtils.isNotEmpty(gs.getBusinessCode())) {
78   - if ("88".equals(gs.getUpCode())) { // 浦东公交
79   - gsMap.put(gs.getBusinessCode(), gs);
80   - }
81   - if (gs.getBusinessCode().equals(gs.getUpCode())) { // 闵行,青浦
82   - gsMap.put(gs.getBusinessCode(), gs);
83   - }
84   - }
85   - }
86   - return gsMap;
87   -}
88   -
89   -function Map fgsMap(List gses) {
90   - // 这里简单将 businessCode和upCode合并
91   - Map fgsMap = new HashMap();
92   - for (int i = 0; i < gses.size(); i++) {
93   - Business gs = (Business) gses.get(i);
94   - if (StringUtils.isNotEmpty(gs.getBusinessCode()) && StringUtils.isNotEmpty(gs.getUpCode())) {
95   - fgsMap.put(gs.getUpCode() + "_" + gs.getBusinessCode(), gs);
96   - }
97   - }
98   - return fgsMap;
99   -}
100   -
101   -/*
102   - 规则说明:
103   - 根据循环规则输出,时刻表选择规则输出,组合计算排班明细
104   -*/
105   -
106   -//-------------------- 第一阶段、计算迭代数据 -----------------//
107   -declare Loop_result
108   - xlId: String // 线路id
109   -
110   - ruleLoop: List // 每天分配的规则 List<ScheduleResult_output>
111   -
112   - ttInfoMapLoop_temp: Map // 每天分配的时刻表 Map<DataTime, Collection<TTInfoResult_output>>
113   - ttInfoMapLoop: Map // 每天分配的时刻表 Map<DataTime, TTInfoResult_output>
114   - ttInfoMap: Map // 总共用到的时刻表 Map<id, TTInfoResult_output>
115   -end
116   -
117   -rule "calcu_step1_Loop_result"
118   - salience 1000
119   - when
120   - $param: PlanCalcuParam_input($xlId: xlId)
121   - then
122   - Loop_result loop_result = new Loop_result();
123   - loop_result.setXlId($xlId);
124   - loop_result.setRuleLoop($param.getScheduleResults_output().getResults());
125   -
126   - loop_result.setTtInfoMapLoop(new HashMap());
127   - loop_result.setTtInfoMap(new HashMap());
128   -
129   - com.google.common.collect.Multimap ttInfoMap_temp =
130   - (com.google.common.collect.Multimap)
131   - $param.getTtInfoResults_output().getResults().get(
132   - String.valueOf($xlId));
133   -
134   - loop_result.setTtInfoMapLoop_temp(ttInfoMap_temp.asMap());
135   -
136   - insert(loop_result);
137   -
138   -// log.info("calcu_step1_Loop_result");
139   -end
140   -
141   -rule "calcu_step2_loop_result"
142   - salience 1000
143   - no-loop
144   - when
145   - $param: PlanCalcuParam_input($xlId: xlId)
146   - $lr: Loop_result(xlId == $xlId)
147   - $sd: DateTime() from $lr.ttInfoMapLoop_temp.keySet()
148   - then
149   - // 当天时刻表只取第一张 TODO:
150   - Collection col = (Collection) $lr.getTtInfoMapLoop_temp().get($sd);
151   - Iterator iter = col.iterator();
152   - TTInfoResult_output ttInfo_result = (TTInfoResult_output) iter.next();
153   - $lr.getTtInfoMapLoop().put($sd, ttInfo_result);
154   -
155   - // 总共使用的时刻表
156   - $lr.getTtInfoMap().put(ttInfo_result.getTtInfoId(), ttInfo_result);
157   -
158   - update($lr);
159   -
160   -// log.info("calcu_step2_Loop_result");
161   -end
162   -
163   -//-------------------- 第二阶段、将时刻表班次,车辆配置,人员配置信息载入 -----------------//
164   -
165   -//--------------- 车辆配置信息载入 -------------//
166   -declare CarConfig_Wraps
167   - xlId: String // 线路Id
168   - ccMap: Map // 车辆配置Map Map<id, CarConfigInfo>
169   -end
170   -
171   -rule "calcu_CarConfig_Wraps"
172   - salience 800
173   - when
174   - $lr: Loop_result($xlId: xlId)
175   - then
176   - List carConfigInfos = carConfigInfoRepository.findByXlId(Integer.parseInt($xlId));
177   -
178   - CarConfig_Wraps carConfig_wraps = new CarConfig_Wraps();
179   - carConfig_wraps.setXlId($xlId);
180   - carConfig_wraps.setCcMap(new HashMap());
181   -
182   - for (int i = 0; i < carConfigInfos.size(); i++) {
183   - CarConfigInfo carConfigInfo = (CarConfigInfo) carConfigInfos.get(i);
184   - carConfig_wraps.getCcMap().put(carConfigInfo.getId().toString(), carConfigInfo);
185   - }
186   -
187   - insert(carConfig_wraps);
188   -
189   - log.info("calcu_CarConfig_Wrap");
190   -end
191   -
192   -//--------------- 人员配置信息载入 --------------//
193   -declare EmployeeConfig_Wraps
194   - xlId: String // 线路Id
195   - ecMap: Map // 人员配置Map Map<id, EmployeeConfigInfo>
196   -end
197   -
198   -rule "calcu_EmployeeConfig_Wraps"
199   - salience 800
200   - when
201   - $lr: Loop_result($xlId: xlId)
202   - then
203   - List employeeConfigInfos = employeeConfigInfoRepository.findByXlId(Integer.parseInt($xlId));
204   -
205   - EmployeeConfig_Wraps employeeConfig_wraps = new EmployeeConfig_Wraps();
206   - employeeConfig_wraps.setXlId($xlId);
207   - employeeConfig_wraps.setEcMap(new HashMap());
208   -
209   - for (int i = 0; i < employeeConfigInfos.size(); i++) {
210   - EmployeeConfigInfo employeeConfigInfo = (EmployeeConfigInfo) employeeConfigInfos.get(i);
211   - employeeConfig_wraps.getEcMap().put(employeeConfigInfo.getId().toString(), employeeConfigInfo);
212   - }
213   -
214   - insert(employeeConfig_wraps);
215   -
216   - log.info("calcu_EmployeeConfig_Wrap");
217   -end
218   -
219   -//----------------- 时刻表班次信息载入 -----------------//
220   -declare TTInfo_gid_stat
221   - xlId: String // 线路id(cast字符串-方便比较)
222   - ttInfoId: String // 时刻表id(cast字符串-方便比较)
223   - gid: String // 路牌id(cast字符串-方便比较)
224   -
225   - maxFcno: Integer // 最大发车顺序号
226   -
227   - fbTime: LocalTime // 分班时间
228   - fbfcno: Integer // 分班发车顺序号
229   -end
230   -
231   -rule "calcu_TTInfo_gid_stat"
232   - salience 800
233   - when
234   - $lr: Loop_result($xlId: xlId)
235   - $ttInfoId: String() from $lr.getTtInfoMap().keySet()
236   - $gids: List() from accumulate ($ttd: TTInfoDetail() from tTInfoDetailRepository.findByTtinfoId(Long.parseLong($ttInfoId)), gidscount($ttd))
237   - $gid: String() from $gids
238   - $fbtime_str: String() from accumulate ($ttd: TTInfoDetail(lp.id.toString() == $gid) from tTInfoDetailRepository.findByTtinfoId(Long.parseLong($ttInfoId)), gidfbtime($ttd))
239   - $fbfcno: Integer() from accumulate ($ttd: TTInfoDetail(lp.id.toString() == $gid) from tTInfoDetailRepository.findByTtinfoId(Long.parseLong($ttInfoId)), gidfbfcno($ttd))
240   - $maxfcno: Double() from accumulate ($ttd: TTInfoDetail(lp.id.toString() == $gid) from tTInfoDetailRepository.findByTtinfoId(Long.parseLong($ttInfoId)), max($ttd.getFcno()))
241   - then
242   - TTInfo_gid_stat ttInfo_gid_stat = new TTInfo_gid_stat();
243   - ttInfo_gid_stat.setXlId($xlId);
244   - ttInfo_gid_stat.setTtInfoId($ttInfoId);
245   - ttInfo_gid_stat.setGid($gid);
246   -
247   - ttInfo_gid_stat.setMaxFcno($maxfcno.intValue());
248   - ttInfo_gid_stat.setFbTime(fcsjTime($fbtime_str));
249   - ttInfo_gid_stat.setFbfcno($fbfcno);
250   -
251   - insert(ttInfo_gid_stat);
252   -
253   -// log.info("xlid={},ttid={},gid={},maxfcno={},fbtime={},fbfcno={}",
254   -// $xlId, $ttInfoId, $gid, ttInfo_gid_stat.getMaxFcno(), ttInfo_gid_stat.getFbTime(), ttInfo_gid_stat.getFbfcno());
255   -
256   -end
257   -
258   -declare TTInfoDetail_Wrap
259   - isFirstBc: Boolean = false // 是否是当前路牌的第一个班次
260   - isLastBc: Boolean = false // 是否是当前路牌的最后一个班次
261   - isFb: Boolean = false // 是否分班
262   -
263   - self: TTInfoDetail // 原始数据
264   -end
265   -
266   -declare TTInfoDetail_Wraps
267   - xlId: String // 线路id(cast字符串-方便比较)
268   - ttInfoId: String // 时刻表id(cast字符串-方便比较)
269   -
270   - detailsMap: Map // 明细Map,Map<路牌id, List<TTInfoDetail_Wrap>>
271   -end
272   -
273   -rule "calcu_TTInfoDetail_Wraps"
274   - salience 700
275   - when
276   - $lr: Loop_result($xlId: xlId)
277   - $ttInfoId: String() from $lr.getTtInfoMap().keySet()
278   - $ttInfoStatList: List(size > 0) from collect (TTInfo_gid_stat(ttInfoId == $ttInfoId))
279   - then
280   - TTInfoDetail_Wraps ttInfoDetail_wraps = new TTInfoDetail_Wraps();
281   - ttInfoDetail_wraps.setXlId($xlId);
282   - ttInfoDetail_wraps.setTtInfoId($ttInfoId);
283   - ttInfoDetail_wraps.setDetailsMap(new HashMap());
284   -
285   - // 将list的形式变成 Map<路牌id, TTInfo_gid_stat>
286   - Map statMap = new HashMap();
287   - for (int i = 0; i < $ttInfoStatList.size(); i++) {
288   - TTInfo_gid_stat ttInfo_gid_stat = (TTInfo_gid_stat) $ttInfoStatList.get(i);
289   - statMap.put(ttInfo_gid_stat.getGid(), ttInfo_gid_stat);
290   - }
291   -
292   - // 迭代ttinfodetail,拼装 TTInfoDetail_Wraps
293   - List detaillist = tTInfoDetailRepository.findByTtinfoId(Long.parseLong($ttInfoId));
294   - for (int j = 0; j < detaillist.size(); j++) {
295   - TTInfoDetail ttInfoDetail = (TTInfoDetail) detaillist.get(j);
296   - String gid = String.valueOf(ttInfoDetail.getLp().getId());
297   -
298   - if (ttInfoDetail_wraps.getDetailsMap().get(gid) == null) {
299   - ttInfoDetail_wraps.getDetailsMap().put(gid, new ArrayList());
300   - }
301   -
302   - // 获取stat
303   - TTInfo_gid_stat ttInfo_gid_stat = (TTInfo_gid_stat) statMap.get(gid);
304   -
305   - TTInfoDetail_Wrap ttInfoDetail_wrap = new TTInfoDetail_Wrap();
306   - ttInfoDetail_wrap.setIsFirstBc(1 == ttInfoDetail.getFcno());
307   - ttInfoDetail_wrap.setIsLastBc(ttInfo_gid_stat.getMaxFcno() == ttInfoDetail.getFcno());
308   -
309   - LocalTime fcsj = fcsjTime(ttInfoDetail.getFcsj());
310   - LocalTime fbsj = ttInfo_gid_stat.getFbTime();
311   - Integer fbfcno = ttInfo_gid_stat.getFbfcno();
312   - // 不用时间判定,因为有的路牌,后面的班次都是凌晨的,时间反而比分班时间早,不合理,所以使用发车顺序号做第二次比较
313   -// ttInfoDetail_wrap.setIsFb(fbsj == null ? false : (fcsj.isEqual(fbsj) || fcsj.isAfter(fbsj)));
314   - ttInfoDetail_wrap.setIsFb(fbsj == null ? false : ttInfoDetail.getFcno() >= fbfcno);
315   -
316   - ttInfoDetail_wrap.setSelf(ttInfoDetail);
317   -
318   - ((List) ttInfoDetail_wraps.getDetailsMap().get(gid)).add(ttInfoDetail_wrap);
319   -
320   - }
321   -
322   -
323   - insert(ttInfoDetail_wraps);
324   -
325   - log.info("xlid={}, ttinfoid={}, lpstatCount={}, detailLpCount={}",
326   - $xlId, $ttInfoId, $ttInfoStatList.size(), ttInfoDetail_wraps.getDetailsMap().keySet().size());
327   -
328   -
329   -end
330   -
331   -declare TTInfoDetail_Wraps_map
332   - xlId: String // 线路id(cast字符串-方便比较)
333   -
334   - wrapsMap: Map // 明细Map,Map<时刻表Id, TTInfoDetail_Wraps>
335   -end
336   -
337   -rule "calcu_TTInfoDetail_Wraps_toMap"
338   - salience 600
339   - when
340   - $lr: Loop_result($xlId: xlId)
341   - $wrapsList: List(size > 0) from collect (TTInfoDetail_Wraps(xlId == $xlId))
342   - then
343   - // 转换成Map
344   - TTInfoDetail_Wraps_map all = new TTInfoDetail_Wraps_map();
345   - all.setXlId($xlId);
346   - all.setWrapsMap(new HashMap());
347   -
348   - for (int i = 0; i < $wrapsList.size(); i++) {
349   - TTInfoDetail_Wraps ttInfoDetail_wraps = (TTInfoDetail_Wraps) $wrapsList.get(i);
350   - all.getWrapsMap().put(ttInfoDetail_wraps.getTtInfoId(), ttInfoDetail_wraps);
351   - }
352   -
353   - insert(all);
354   -end
355   -
356   -
357   -
358   -
359   -//-------------------- 第三阶段、合并计算SchedulePlanInfo -----------------//
360   -
361   -
362   -rule "Calcu_SchedulePlanInfo"
363   - salience 500
364   - when
365   - $param: PlanCalcuParam_input($xlId: xlId)
366   - $lr: Loop_result(xlId == $xlId)
367   - $ccs: CarConfig_Wraps(xlId == $xlId)
368   - $ecs: EmployeeConfig_Wraps(xlId == $xlId)
369   - $tts: TTInfoDetail_Wraps_map(xlId == $xlId)
370   - then
371   - // 线路
372   - Line xl = lineRepository.findOne(Integer.parseInt($xlId));
373   -
374   - // 查找公司
375   - List gses = (List) businessRepository.findAll();
376   - // 构造公司代码对应map
377   - Map gsMap = gsMap(gses);
378   - // 构造分公司对应的map
379   - Map fgsMap = fgsMap(gses);
380   -
381   - for (int i = 0; i < $lr.getRuleLoop().size(); i++) {
382   - ScheduleResult_output sro = (ScheduleResult_output) $lr.getRuleLoop().get(i);
383   -
384   - // 日期
385   - DateTime sd = sro.getSd();
386   - // 路牌
387   - String gid = sro.getGuideboardId();
388   - // 车辆配置
389   - CarConfigInfo carConfigInfo = sro.getsType() == ScheduleRule_Type.NORMAL ?
390   - (CarConfigInfo) $ccs.getCcMap().get(sro.getCarConfigId()) : null;
391   - // 人员配置
392   - List eclist = sro.getsType() == ScheduleRule_Type.NORMAL ?
393   - ecList(employeeConfigInfoRepository, sro.getEmployeeConfigId()) : null;
394   -
395   - // 时刻表id
396   - String ttInfoId = ttInfoId_sd($lr.getTtInfoMapLoop(), sd);
397   - TTInfoDetail_Wraps ttInfoDetail_wraps = (TTInfoDetail_Wraps) $tts.getWrapsMap().get(ttInfoId);
398   - if (ttInfoDetail_wraps == null) {
399   - // 时刻表为空,直接跳过
400   - // 如1118路,周末不开,此是时刻表指定一个空表
401   - // TODO:这个以后要改的,选时刻表的规则要修正,没有默认的时刻表
402   - continue;
403   - }
404   -
405   - List detaillist = (List) ttInfoDetail_wraps.getDetailsMap().get(gid);
406   - if (detaillist == null) {
407   - // 这里翻到的路牌时刻表里可能没有,
408   - // 因为没有考虑翻班格式(就是做几休几)
409   - // 所有翻班格式全由时刻表决定,即时刻表有的路牌就做,没有不做
410   - continue;
411   - }
412   -
413   - for (int j = 0; j < detaillist.size(); j++) {
414   - TTInfoDetail_Wrap wrap = (TTInfoDetail_Wrap) detaillist.get(j);
415   -
416   - SchedulePlanInfo schedulePlanInfo = new SchedulePlanInfo(
417   - xl,
418   - sro,
419   - wrap.getSelf(),
420   - wrap.getIsFb(),
421   - carConfigInfo,
422   - eclist,
423   - $param.getSchedulePlan(),
424   - wrap.getIsFirstBc(),
425   - wrap.getIsLastBc(),
426   - sro.getsType()
427   - );
428   -
429   - // 获取公司,分公司信息
430   - String gsbm = xl.getCompany();
431   - String fgsbm = xl.getBrancheCompany();
432   - Business gs = null;
433   - Business fgs = null;
434   -
435   - if (StringUtils.isNotEmpty(gsbm)) {
436   - gs = (Business) gsMap.get(gsbm);
437   - }
438   - if (StringUtils.isNotEmpty(gsbm) && StringUtils.isNotEmpty(fgsbm)) {
439   - fgs = (Business) fgsMap.get(gsbm + "_" + fgsbm);
440   - }
441   -
442   - if (gs != null) {
443   - schedulePlanInfo.setGsBm(gs.getBusinessCode());
444   - schedulePlanInfo.setGsName(gs.getBusinessName());
445   - }
446   - if (fgs != null) {
447   - schedulePlanInfo.setFgsBm(fgs.getBusinessCode());
448   - schedulePlanInfo.setFgsName(fgs.getBusinessName());
449   - }
450   -
451   - // 操作人,操作时间
452   - schedulePlanInfo.setCreateBy($param.getSchedulePlan().getCreateBy());
453   - schedulePlanInfo.setCreateDate($param.getSchedulePlan().getCreateDate());
454   - schedulePlanInfo.setUpdateBy($param.getSchedulePlan().getUpdateBy());
455   - schedulePlanInfo.setUpdateDate($param.getSchedulePlan().getUpdateDate());
456   -
457   - // result 输出
458   - planResult.getSchedulePlanInfos().add(schedulePlanInfo);
459   -
460   - }
461   -
462   - }
463   -
464   - log.info("xlid={} plan ok!", $xlId);
465   -
466   -end
467   -
468   -
469   -
470   -
471   -
472   -
473   -
474   -
475   -
476   -
477   -
478   -
479   -
480   -
  1 +package com.bsth.service.schedule.impl.plan.kBase1.core.plan;
  2 +
  3 +import org.joda.time.*;
  4 +import java.util.*;
  5 +
  6 +import com.bsth.service.schedule.impl.plan.kBase1.core.plan.PlanCalcuParam_input;
  7 +import com.bsth.service.schedule.impl.plan.kBase1.core.plan.PlanResult;
  8 +
  9 +import com.bsth.repository.schedule.TTInfoDetailRepository;
  10 +import com.bsth.repository.schedule.CarConfigInfoRepository;
  11 +import com.bsth.repository.schedule.EmployeeConfigInfoRepository;
  12 +import com.bsth.repository.LineRepository;
  13 +import com.bsth.repository.BusinessRepository;
  14 +
  15 +import com.bsth.service.schedule.impl.plan.kBase1.core.shiftloop.ScheduleResult_output;
  16 +import com.bsth.service.schedule.impl.plan.kBase1.core.shiftloop.ScheduleResults_output;
  17 +import com.bsth.service.schedule.impl.plan.kBase1.core.ttinfo.TTInfoResult_output;
  18 +import com.bsth.service.schedule.impl.plan.kBase1.core.ttinfo.TTInfoResults_output;
  19 +import com.bsth.entity.Line;
  20 +import com.bsth.entity.Business;
  21 +
  22 +import com.bsth.entity.schedule.CarConfigInfo;
  23 +import com.bsth.entity.schedule.EmployeeConfigInfo;
  24 +import com.bsth.entity.schedule.TTInfo;
  25 +import com.bsth.entity.schedule.TTInfoDetail;
  26 +import com.bsth.entity.schedule.SchedulePlanInfo;
  27 +
  28 +import org.slf4j.Logger
  29 +import org.joda.time.format.DateTimeFormat
  30 +import org.apache.commons.lang3.StringUtils
  31 +import com.bsth.service.schedule.impl.plan.kBase1.core.shiftloop.ScheduleRule_Type;
  32 +
  33 +
  34 +// 全局日志类(一般使用调用此规则的service类)
  35 +global Logger log;
  36 +
  37 +global TTInfoDetailRepository tTInfoDetailRepository;
  38 +global CarConfigInfoRepository carConfigInfoRepository;
  39 +global EmployeeConfigInfoRepository employeeConfigInfoRepository;
  40 +global LineRepository lineRepository;
  41 +global BusinessRepository businessRepository;
  42 +
  43 +// 输出
  44 +global PlanResult planResult;
  45 +
  46 +function Map xlidParams(String xlid) {
  47 + Map param = new HashMap();
  48 + param.put("xl.id_eq", Integer.valueOf(xlid));
  49 + return param;
  50 +}
  51 +
  52 +function List ecList(EmployeeConfigInfoRepository repo, String ecids) {
  53 + List<String> ids = Arrays.asList(ecids.split("-"));
  54 + List rst = new ArrayList();
  55 + for (int i = 0; i < ids.size(); i++) {
  56 + rst.add(repo.findOne(Long.parseLong(ids.get(i))));
  57 + }
  58 + return rst;
  59 +}
  60 +
  61 +function LocalTime fcsjTime(String fcsj) {
  62 + if ("NULL".equals(fcsj)) {
  63 + return null;
  64 + }
  65 + return LocalTime.parse(fcsj, DateTimeFormat.forPattern("HH:mm"));
  66 +}
  67 +
  68 +function String ttInfoId_sd(Map map, DateTime sd) {
  69 + TTInfoResult_output ttInfoResult_output = (TTInfoResult_output) map.get(sd);
  70 + return ttInfoResult_output.getTtInfoId();
  71 +}
  72 +
  73 +function Map gsMap(List gses) {
  74 + Map gsMap = new HashMap();
  75 + for (int i = 0; i < gses.size(); i++) {
  76 + Business gs = (Business) gses.get(i);
  77 + if (StringUtils.isNotEmpty(gs.getBusinessCode())) {
  78 + if ("88".equals(gs.getUpCode())) { // 浦东公交
  79 + gsMap.put(gs.getBusinessCode(), gs);
  80 + }
  81 + if (gs.getBusinessCode().equals(gs.getUpCode())) { // 闵行,青浦
  82 + gsMap.put(gs.getBusinessCode(), gs);
  83 + }
  84 + }
  85 + }
  86 + return gsMap;
  87 +}
  88 +
  89 +function Map fgsMap(List gses) {
  90 + // 这里简单将 businessCode和upCode合并
  91 + Map fgsMap = new HashMap();
  92 + for (int i = 0; i < gses.size(); i++) {
  93 + Business gs = (Business) gses.get(i);
  94 + if (StringUtils.isNotEmpty(gs.getBusinessCode()) && StringUtils.isNotEmpty(gs.getUpCode())) {
  95 + fgsMap.put(gs.getUpCode() + "_" + gs.getBusinessCode(), gs);
  96 + }
  97 + }
  98 + return fgsMap;
  99 +}
  100 +
  101 +/*
  102 + 规则说明:
  103 + 根据循环规则输出,时刻表选择规则输出,组合计算排班明细
  104 +*/
  105 +
  106 +//-------------------- 第一阶段、计算迭代数据 -----------------//
  107 +declare Loop_result
  108 + xlId: String // 线路id
  109 +
  110 + ruleLoop: List // 每天分配的规则 List<ScheduleResult_output>
  111 +
  112 + ttInfoMapLoop_temp: Map // 每天分配的时刻表 Map<DataTime, Collection<TTInfoResult_output>>
  113 + ttInfoMapLoop: Map // 每天分配的时刻表 Map<DataTime, TTInfoResult_output>
  114 + ttInfoMap: Map // 总共用到的时刻表 Map<id, TTInfoResult_output>
  115 +end
  116 +
  117 +rule "calcu_step1_Loop_result"
  118 + salience 1000
  119 + when
  120 + $param: PlanCalcuParam_input($xlId: xlId)
  121 + then
  122 + Loop_result loop_result = new Loop_result();
  123 + loop_result.setXlId($xlId);
  124 + loop_result.setRuleLoop($param.getScheduleResults_output().getResults());
  125 +
  126 + loop_result.setTtInfoMapLoop(new HashMap());
  127 + loop_result.setTtInfoMap(new HashMap());
  128 +
  129 + com.google.common.collect.Multimap ttInfoMap_temp =
  130 + (com.google.common.collect.Multimap)
  131 + $param.getTtInfoResults_output().getResults().get(
  132 + String.valueOf($xlId));
  133 +
  134 + loop_result.setTtInfoMapLoop_temp(ttInfoMap_temp.asMap());
  135 +
  136 + insert(loop_result);
  137 +
  138 +// log.info("calcu_step1_Loop_result");
  139 +end
  140 +
  141 +rule "calcu_step2_loop_result"
  142 + salience 1000
  143 + no-loop
  144 + when
  145 + $param: PlanCalcuParam_input($xlId: xlId)
  146 + $lr: Loop_result(xlId == $xlId)
  147 + $sd: DateTime() from $lr.ttInfoMapLoop_temp.keySet()
  148 + then
  149 + // 当天时刻表只取第一张 TODO:
  150 + Collection col = (Collection) $lr.getTtInfoMapLoop_temp().get($sd);
  151 + Iterator iter = col.iterator();
  152 + TTInfoResult_output ttInfo_result = (TTInfoResult_output) iter.next();
  153 + $lr.getTtInfoMapLoop().put($sd, ttInfo_result);
  154 +
  155 + // 总共使用的时刻表
  156 + $lr.getTtInfoMap().put(ttInfo_result.getTtInfoId(), ttInfo_result);
  157 +
  158 + update($lr);
  159 +
  160 +// log.info("calcu_step2_Loop_result");
  161 +end
  162 +
  163 +//-------------------- 第二阶段、将时刻表班次,车辆配置,人员配置信息载入 -----------------//
  164 +
  165 +//--------------- 车辆配置信息载入 -------------//
  166 +declare CarConfig_Wraps
  167 + xlId: String // 线路Id
  168 + ccMap: Map // 车辆配置Map Map<id, CarConfigInfo>
  169 +end
  170 +
  171 +rule "calcu_CarConfig_Wraps"
  172 + salience 800
  173 + when
  174 + $lr: Loop_result($xlId: xlId)
  175 + then
  176 + List carConfigInfos = carConfigInfoRepository.findByXlId(Integer.parseInt($xlId));
  177 +
  178 + CarConfig_Wraps carConfig_wraps = new CarConfig_Wraps();
  179 + carConfig_wraps.setXlId($xlId);
  180 + carConfig_wraps.setCcMap(new HashMap());
  181 +
  182 + for (int i = 0; i < carConfigInfos.size(); i++) {
  183 + CarConfigInfo carConfigInfo = (CarConfigInfo) carConfigInfos.get(i);
  184 + carConfig_wraps.getCcMap().put(carConfigInfo.getId().toString(), carConfigInfo);
  185 + }
  186 +
  187 + insert(carConfig_wraps);
  188 +
  189 + log.info("calcu_CarConfig_Wrap");
  190 +end
  191 +
  192 +//--------------- 人员配置信息载入 --------------//
  193 +declare EmployeeConfig_Wraps
  194 + xlId: String // 线路Id
  195 + ecMap: Map // 人员配置Map Map<id, EmployeeConfigInfo>
  196 +end
  197 +
  198 +rule "calcu_EmployeeConfig_Wraps"
  199 + salience 800
  200 + when
  201 + $lr: Loop_result($xlId: xlId)
  202 + then
  203 + List employeeConfigInfos = employeeConfigInfoRepository.findByXlId(Integer.parseInt($xlId));
  204 +
  205 + EmployeeConfig_Wraps employeeConfig_wraps = new EmployeeConfig_Wraps();
  206 + employeeConfig_wraps.setXlId($xlId);
  207 + employeeConfig_wraps.setEcMap(new HashMap());
  208 +
  209 + for (int i = 0; i < employeeConfigInfos.size(); i++) {
  210 + EmployeeConfigInfo employeeConfigInfo = (EmployeeConfigInfo) employeeConfigInfos.get(i);
  211 + employeeConfig_wraps.getEcMap().put(employeeConfigInfo.getId().toString(), employeeConfigInfo);
  212 + }
  213 +
  214 + insert(employeeConfig_wraps);
  215 +
  216 + log.info("calcu_EmployeeConfig_Wrap");
  217 +end
  218 +
  219 +//----------------- 时刻表班次信息载入 -----------------//
  220 +declare TTInfo_gid_stat
  221 + xlId: String // 线路id(cast字符串-方便比较)
  222 + ttInfoId: String // 时刻表id(cast字符串-方便比较)
  223 + gid: String // 路牌id(cast字符串-方便比较)
  224 +
  225 + maxFcno: Integer // 最大发车顺序号
  226 +
  227 + fbTime: LocalTime // 分班时间
  228 + fbfcno: Integer // 分班发车顺序号
  229 +end
  230 +
  231 +rule "calcu_TTInfo_gid_stat"
  232 + salience 800
  233 + when
  234 + $lr: Loop_result($xlId: xlId)
  235 + $ttInfoId: String() from $lr.getTtInfoMap().keySet()
  236 + $gids: List() from accumulate ($ttd: TTInfoDetail() from tTInfoDetailRepository.findByTtinfoId(Long.parseLong($ttInfoId)), gidscount($ttd))
  237 + $gid: String() from $gids
  238 + $fbtime_str: String() from accumulate ($ttd: TTInfoDetail(lp.id.toString() == $gid) from tTInfoDetailRepository.findByTtinfoId(Long.parseLong($ttInfoId)), gidfbtime($ttd))
  239 + $fbfcno: Integer() from accumulate ($ttd: TTInfoDetail(lp.id.toString() == $gid) from tTInfoDetailRepository.findByTtinfoId(Long.parseLong($ttInfoId)), gidfbfcno($ttd))
  240 + $maxfcno: Double() from accumulate ($ttd: TTInfoDetail(lp.id.toString() == $gid) from tTInfoDetailRepository.findByTtinfoId(Long.parseLong($ttInfoId)), max($ttd.getFcno()))
  241 + then
  242 + TTInfo_gid_stat ttInfo_gid_stat = new TTInfo_gid_stat();
  243 + ttInfo_gid_stat.setXlId($xlId);
  244 + ttInfo_gid_stat.setTtInfoId($ttInfoId);
  245 + ttInfo_gid_stat.setGid($gid);
  246 +
  247 + ttInfo_gid_stat.setMaxFcno($maxfcno.intValue());
  248 + ttInfo_gid_stat.setFbTime(fcsjTime($fbtime_str));
  249 + ttInfo_gid_stat.setFbfcno($fbfcno);
  250 +
  251 + insert(ttInfo_gid_stat);
  252 +
  253 +// log.info("xlid={},ttid={},gid={},maxfcno={},fbtime={},fbfcno={}",
  254 +// $xlId, $ttInfoId, $gid, ttInfo_gid_stat.getMaxFcno(), ttInfo_gid_stat.getFbTime(), ttInfo_gid_stat.getFbfcno());
  255 +
  256 +end
  257 +
  258 +declare TTInfoDetail_Wrap
  259 + isFirstBc: Boolean = false // 是否是当前路牌的第一个班次
  260 + isLastBc: Boolean = false // 是否是当前路牌的最后一个班次
  261 + isFb: Boolean = false // 是否分班
  262 +
  263 + self: TTInfoDetail // 原始数据
  264 +end
  265 +
  266 +declare TTInfoDetail_Wraps
  267 + xlId: String // 线路id(cast字符串-方便比较)
  268 + ttInfoId: String // 时刻表id(cast字符串-方便比较)
  269 +
  270 + detailsMap: Map // 明细Map,Map<路牌id, List<TTInfoDetail_Wrap>>
  271 +end
  272 +
  273 +rule "calcu_TTInfoDetail_Wraps"
  274 + salience 700
  275 + when
  276 + $lr: Loop_result($xlId: xlId)
  277 + $ttInfoId: String() from $lr.getTtInfoMap().keySet()
  278 + $ttInfoStatList: List(size > 0) from collect (TTInfo_gid_stat(ttInfoId == $ttInfoId))
  279 + then
  280 + TTInfoDetail_Wraps ttInfoDetail_wraps = new TTInfoDetail_Wraps();
  281 + ttInfoDetail_wraps.setXlId($xlId);
  282 + ttInfoDetail_wraps.setTtInfoId($ttInfoId);
  283 + ttInfoDetail_wraps.setDetailsMap(new HashMap());
  284 +
  285 + // 将list的形式变成 Map<路牌id, TTInfo_gid_stat>
  286 + Map statMap = new HashMap();
  287 + for (int i = 0; i < $ttInfoStatList.size(); i++) {
  288 + TTInfo_gid_stat ttInfo_gid_stat = (TTInfo_gid_stat) $ttInfoStatList.get(i);
  289 + statMap.put(ttInfo_gid_stat.getGid(), ttInfo_gid_stat);
  290 + }
  291 +
  292 + // 迭代ttinfodetail,拼装 TTInfoDetail_Wraps
  293 + List detaillist = tTInfoDetailRepository.findByTtinfoId(Long.parseLong($ttInfoId));
  294 + for (int j = 0; j < detaillist.size(); j++) {
  295 + TTInfoDetail ttInfoDetail = (TTInfoDetail) detaillist.get(j);
  296 + String gid = String.valueOf(ttInfoDetail.getLp().getId());
  297 +
  298 + if (ttInfoDetail_wraps.getDetailsMap().get(gid) == null) {
  299 + ttInfoDetail_wraps.getDetailsMap().put(gid, new ArrayList());
  300 + }
  301 +
  302 + // 获取stat
  303 + TTInfo_gid_stat ttInfo_gid_stat = (TTInfo_gid_stat) statMap.get(gid);
  304 +
  305 + TTInfoDetail_Wrap ttInfoDetail_wrap = new TTInfoDetail_Wrap();
  306 + ttInfoDetail_wrap.setIsFirstBc(1 == ttInfoDetail.getFcno());
  307 + ttInfoDetail_wrap.setIsLastBc(ttInfo_gid_stat.getMaxFcno() == ttInfoDetail.getFcno());
  308 +
  309 + LocalTime fcsj = fcsjTime(ttInfoDetail.getFcsj());
  310 + LocalTime fbsj = ttInfo_gid_stat.getFbTime();
  311 + Integer fbfcno = ttInfo_gid_stat.getFbfcno();
  312 + // 不用时间判定,因为有的路牌,后面的班次都是凌晨的,时间反而比分班时间早,不合理,所以使用发车顺序号做第二次比较
  313 +// ttInfoDetail_wrap.setIsFb(fbsj == null ? false : (fcsj.isEqual(fbsj) || fcsj.isAfter(fbsj)));
  314 + ttInfoDetail_wrap.setIsFb(fbsj == null ? false : ttInfoDetail.getFcno() >= fbfcno);
  315 +
  316 + ttInfoDetail_wrap.setSelf(ttInfoDetail);
  317 +
  318 + ((List) ttInfoDetail_wraps.getDetailsMap().get(gid)).add(ttInfoDetail_wrap);
  319 +
  320 + }
  321 +
  322 +
  323 + insert(ttInfoDetail_wraps);
  324 +
  325 + log.info("xlid={}, ttinfoid={}, lpstatCount={}, detailLpCount={}",
  326 + $xlId, $ttInfoId, $ttInfoStatList.size(), ttInfoDetail_wraps.getDetailsMap().keySet().size());
  327 +
  328 +
  329 +end
  330 +
  331 +declare TTInfoDetail_Wraps_map
  332 + xlId: String // 线路id(cast字符串-方便比较)
  333 +
  334 + wrapsMap: Map // 明细Map,Map<时刻表Id, TTInfoDetail_Wraps>
  335 +end
  336 +
  337 +rule "calcu_TTInfoDetail_Wraps_toMap"
  338 + salience 600
  339 + when
  340 + $lr: Loop_result($xlId: xlId)
  341 + $wrapsList: List(size > 0) from collect (TTInfoDetail_Wraps(xlId == $xlId))
  342 + then
  343 + // 转换成Map
  344 + TTInfoDetail_Wraps_map all = new TTInfoDetail_Wraps_map();
  345 + all.setXlId($xlId);
  346 + all.setWrapsMap(new HashMap());
  347 +
  348 + for (int i = 0; i < $wrapsList.size(); i++) {
  349 + TTInfoDetail_Wraps ttInfoDetail_wraps = (TTInfoDetail_Wraps) $wrapsList.get(i);
  350 + all.getWrapsMap().put(ttInfoDetail_wraps.getTtInfoId(), ttInfoDetail_wraps);
  351 + }
  352 +
  353 + insert(all);
  354 +end
  355 +
  356 +
  357 +
  358 +
  359 +//-------------------- 第三阶段、合并计算SchedulePlanInfo -----------------//
  360 +
  361 +
  362 +rule "Calcu_SchedulePlanInfo"
  363 + salience 500
  364 + when
  365 + $param: PlanCalcuParam_input($xlId: xlId)
  366 + $lr: Loop_result(xlId == $xlId)
  367 + $ccs: CarConfig_Wraps(xlId == $xlId)
  368 + $ecs: EmployeeConfig_Wraps(xlId == $xlId)
  369 + $tts: TTInfoDetail_Wraps_map(xlId == $xlId)
  370 + then
  371 + // 线路
  372 + Line xl = lineRepository.findOne(Integer.parseInt($xlId));
  373 +
  374 + // 查找公司
  375 + List gses = (List) businessRepository.findAll();
  376 + // 构造公司代码对应map
  377 + Map gsMap = gsMap(gses);
  378 + // 构造分公司对应的map
  379 + Map fgsMap = fgsMap(gses);
  380 +
  381 + for (int i = 0; i < $lr.getRuleLoop().size(); i++) {
  382 + ScheduleResult_output sro = (ScheduleResult_output) $lr.getRuleLoop().get(i);
  383 +
  384 + // 日期
  385 + DateTime sd = sro.getSd();
  386 + // 路牌
  387 + String gid = sro.getGuideboardId();
  388 + // 车辆配置
  389 + CarConfigInfo carConfigInfo = sro.getsType() == ScheduleRule_Type.NORMAL ?
  390 + (CarConfigInfo) $ccs.getCcMap().get(sro.getCarConfigId()) : null;
  391 + // 人员配置
  392 + List eclist = sro.getsType() == ScheduleRule_Type.NORMAL ?
  393 + ecList(employeeConfigInfoRepository, sro.getEmployeeConfigId()) : null;
  394 +
  395 + // 时刻表id
  396 + String ttInfoId = ttInfoId_sd($lr.getTtInfoMapLoop(), sd);
  397 + TTInfoDetail_Wraps ttInfoDetail_wraps = (TTInfoDetail_Wraps) $tts.getWrapsMap().get(ttInfoId);
  398 + if (ttInfoDetail_wraps == null) {
  399 + // 时刻表为空,直接跳过
  400 + // 如1118路,周末不开,此是时刻表指定一个空表
  401 + // TODO:这个以后要改的,选时刻表的规则要修正,没有默认的时刻表
  402 + continue;
  403 + }
  404 +
  405 + List detaillist = (List) ttInfoDetail_wraps.getDetailsMap().get(gid);
  406 + if (detaillist == null) {
  407 + // 这里翻到的路牌时刻表里可能没有,
  408 + // 因为没有考虑翻班格式(就是做几休几)
  409 + // 所有翻班格式全由时刻表决定,即时刻表有的路牌就做,没有不做
  410 + continue;
  411 + }
  412 +
  413 + for (int j = 0; j < detaillist.size(); j++) {
  414 + TTInfoDetail_Wrap wrap = (TTInfoDetail_Wrap) detaillist.get(j);
  415 +
  416 + SchedulePlanInfo schedulePlanInfo = new SchedulePlanInfo(
  417 + xl,
  418 + sro,
  419 + wrap.getSelf(),
  420 + wrap.getIsFb(),
  421 + carConfigInfo,
  422 + eclist,
  423 + $param.getSchedulePlan(),
  424 + wrap.getIsFirstBc(),
  425 + wrap.getIsLastBc(),
  426 + sro.getsType()
  427 + );
  428 +
  429 + // 获取公司,分公司信息
  430 + String gsbm = xl.getCompany();
  431 + String fgsbm = xl.getBrancheCompany();
  432 + Business gs = null;
  433 + Business fgs = null;
  434 +
  435 + if (StringUtils.isNotEmpty(gsbm)) {
  436 + gs = (Business) gsMap.get(gsbm);
  437 + }
  438 + if (StringUtils.isNotEmpty(gsbm) && StringUtils.isNotEmpty(fgsbm)) {
  439 + fgs = (Business) fgsMap.get(gsbm + "_" + fgsbm);
  440 + }
  441 +
  442 + if (gs != null) {
  443 + schedulePlanInfo.setGsBm(gs.getBusinessCode());
  444 + schedulePlanInfo.setGsName(gs.getBusinessName());
  445 + }
  446 + if (fgs != null) {
  447 + schedulePlanInfo.setFgsBm(fgs.getBusinessCode());
  448 + schedulePlanInfo.setFgsName(fgs.getBusinessName());
  449 + }
  450 +
  451 + // 操作人,操作时间
  452 + schedulePlanInfo.setCreateBy($param.getSchedulePlan().getCreateBy());
  453 + schedulePlanInfo.setCreateDate($param.getSchedulePlan().getCreateDate());
  454 + schedulePlanInfo.setUpdateBy($param.getSchedulePlan().getUpdateBy());
  455 + schedulePlanInfo.setUpdateDate($param.getSchedulePlan().getUpdateDate());
  456 +
  457 + // result 输出
  458 + planResult.getSchedulePlanInfos().add(schedulePlanInfo);
  459 +
  460 + }
  461 +
  462 + }
  463 +
  464 + log.info("xlid={} plan ok!", $xlId);
  465 +
  466 +end
  467 +
  468 +
  469 +
  470 +
  471 +
  472 +
  473 +
  474 +
  475 +
  476 +
  477 +
  478 +
  479 +
  480 +
... ...
src/main/resources/rules/rerun.drl renamed to src/main/resources/rules/kBase1_core_rerun.drl
1   -package com.bsth.service.schedule.rerun;
2   -
3   -import org.joda.time.*;
4   -import java.util.*;
5   -
6   -import com.bsth.service.schedule.rules.shiftloop.ScheduleResult_output;
7   -import com.bsth.service.schedule.rules.shiftloop.ScheduleResults_output;
8   -
9   -import com.bsth.service.schedule.rules.rerun.RerunRule_input;
10   -import com.bsth.service.schedule.rules.rerun.RerunRule_param;
11   -
12   -import com.bsth.repository.schedule.CarConfigInfoRepository;
13   -import com.bsth.repository.schedule.EmployeeConfigInfoRepository;
14   -
15   -import org.slf4j.Logger
16   -import com.bsth.entity.schedule.CarConfigInfo
17   -import java.util.HashMap
18   -import com.bsth.entity.schedule.EmployeeConfigInfo
19   -import com.bsth.entity.schedule.SchedulePlanInfo;
20   -
21   -// 全局日志类(一般使用调用此规则的service类)
22   -global Logger log;
23   -
24   -global CarConfigInfoRepository carConfigInfoRepository;
25   -global EmployeeConfigInfoRepository employeeConfigInfoRepository;
26   -
27   -// 输出
28   -
29   -
30   -/*
31   - 规则说明:
32   - 1、对应路牌规则:将对应路牌的车辆,人员替换指定的套跑班次已有的配置
33   - 2、对应班车规则:直接使用指定的人员,车辆替换指定的套跑班次已有的配置
34   -*/
35   -
36   -//-------------------- 第一阶段、计算对应路牌套跑的车辆配置,人员配置数据 -----------------//
37   -
38   -//--------------- 车辆配置信息载入 -------------//
39   -declare Dylp_CarConfig_Wraps
40   - xlId: String // 线路Id
41   - ccMap: Map // 车辆配置Map Map<id, CarConfigInfo>
42   -end
43   -
44   -rule "calcu_Dylp_CarConfig_Wraps"
45   - salience 1000
46   - when
47   - $rp: RerunRule_param($xlId: mxlid)
48   - $dylpxlid: String() from $rp.getXlIds_dylp()
49   - then
50   - List carConfigInfos = carConfigInfoRepository.findByXlId(Integer.parseInt($dylpxlid));
51   -
52   - Dylp_CarConfig_Wraps carConfig_wraps = new Dylp_CarConfig_Wraps();
53   - carConfig_wraps.setXlId($dylpxlid);
54   - carConfig_wraps.setCcMap(new HashMap());
55   -
56   - for (int i = 0; i < carConfigInfos.size(); i++) {
57   - CarConfigInfo carConfigInfo = (CarConfigInfo) carConfigInfos.get(i);
58   - carConfig_wraps.getCcMap().put(carConfigInfo.getId().toString(), carConfigInfo);
59   - }
60   -
61   - insert(carConfig_wraps);
62   -
63   - log.info("calcu_Dylp_CarConfig_Wraps");
64   -
65   -end
66   -
67   -//--------------- 人员配置信息载入 --------------//
68   -declare Dylp_EmployeeConfig_Wraps
69   - xlId: String // 线路Id
70   - ecMap: Map // 人员配置Map Map<id, EmployeeConfigInfo>
71   -end
72   -
73   -rule "calcu_Dylp_EmployeeConfig_Wraps"
74   - salience 1000
75   - when
76   - $rp: RerunRule_param($xlId: mxlid)
77   - $dylpxlid: String() from $rp.getXlIds_dylp()
78   - then
79   - List employeeConfigInfos = employeeConfigInfoRepository.findByXlId(Integer.parseInt($dylpxlid));
80   -
81   - Dylp_EmployeeConfig_Wraps employeeConfig_wraps = new Dylp_EmployeeConfig_Wraps();
82   - employeeConfig_wraps.setXlId($dylpxlid);
83   - employeeConfig_wraps.setEcMap(new HashMap());
84   -
85   - for (int i = 0; i < employeeConfigInfos.size(); i++) {
86   - EmployeeConfigInfo employeeConfigInfo = (EmployeeConfigInfo) employeeConfigInfos.get(i);
87   - employeeConfig_wraps.getEcMap().put(employeeConfigInfo.getId().toString(), employeeConfigInfo);
88   - }
89   -
90   - insert(employeeConfig_wraps);
91   -
92   - log.info("calcu_Dylp_EmployeeConfig_Wraps");
93   -
94   -end
95   -
96   -//-------------------- 第二阶段、包装对应路牌的循环规则输出 -----------------//
97   -
98   -declare Dylp_ScheduleResult_output_wrap
99   - xlId: String // 线路
100   - sd: DateTime // 日期
101   - lp: String // 路牌
102   - cc: CarConfigInfo // 使用的车辆配置
103   - ec: List // 使用的人员配置 List<EmployeeConfigInfo>
104   -end
105   -
106   -rule "calcu_Dylp_ScheduleResult_output_wrap"
107   - salience 900
108   - when
109   - $sro: ScheduleResults_output($xlId: xlid)
110   - $sr: ScheduleResult_output() from $sro.getResults()
111   - Dylp_CarConfig_Wraps(xlId == $xlId, $ccmap: ccMap)
112   - Dylp_EmployeeConfig_Wraps(xlId == $xlId, $ecmap: ecMap)
113   - then
114   - Dylp_ScheduleResult_output_wrap wrap = new Dylp_ScheduleResult_output_wrap();
115   - wrap.setXlId($xlId);
116   - wrap.setSd($sr.getSd());
117   - wrap.setLp($sr.getGuideboardId());
118   - wrap.setCc((CarConfigInfo) $ccmap.get($sr.getCarConfigId()));
119   -
120   - List ecs = new ArrayList();
121   - String[] ecids = $sr.getEmployeeConfigId().split("-"); // 分班的人
122   - for (int i = 0; i < ecids.length; i++) {
123   - ecs.add($ecmap.get(ecids[i]));
124   - }
125   - wrap.setEc(ecs);
126   -
127   -// log.info("xlid = {}", $xlId);
128   -
129   - insert(wrap);
130   -end
131   -
132   -//-------------------- 第三阶段、套跑线路,替换班次的车辆,人员 --------------------//
133   -rule "calcu_Dylp_rerun_update_dylp"
134   - salience 800
135   -// no-loop
136   - when
137   - $spi: SchedulePlanInfo($xlid: xl, $sd: scheduleDate, $lp: lp, $fcsj: fcsj, $ttinfo: ttInfo)
138   - $ri: RerunRule_input(
139   - type == "dylp",
140   - xl == $xlid.toString(),
141   - ttinfo == $ttinfo.toString(),
142   - lp == $lp.toString(),
143   - fcsj == $fcsj,
144   - $sxl: s_xl, $slp: s_lp, $type: usetype, $hrtype: userhrtype
145   - )
146   - $dsro: Dylp_ScheduleResult_output_wrap(
147   - xlId == $sxl,
148   - lp == $slp,
149   - sd.getMillis() == $sd.getTime()
150   - )
151   - then
152   -// log.info("TODO:测试 {}", $fcsj);
153   -
154   - $spi.setRerunInfoDylp($dsro.getCc(), $dsro.getEc(), $type, $hrtype);
155   -
156   -end
157   -
158   -rule "calcu_Dylp_rerun_update_dybc"
159   - salience 700
160   - when
161   - $spi: SchedulePlanInfo($xlid: xl, $sd: scheduleDate, $lp: lp, $fcsj: fcsj, $ttinfo: ttInfo)
162   - $ri: RerunRule_input(
163   - type == "dybc",
164   - xl == $xlid.toString(),
165   - ttinfo == $ttinfo.toString(),
166   - lp == $lp.toString(),
167   - fcsj == $fcsj
168   - )
169   -
170   - then
171   -
172   - $spi.setRerunInfoDybc($ri);
173   -
174   -
175   -end
176   -
177   -
178   -
179   -
180   -
181   -
182   -
183   -
184   -
185   -
186   -
187   -
188   -
189   -
190   -
191   -
192   -
  1 +package com.bsth.service.schedule.impl.plan.kBase1.core.rerun;
  2 +
  3 +import org.joda.time.*;
  4 +import java.util.*;
  5 +
  6 +import com.bsth.service.schedule.impl.plan.kBase1.core.shiftloop.ScheduleResult_output;
  7 +import com.bsth.service.schedule.impl.plan.kBase1.core.shiftloop.ScheduleResults_output;
  8 +
  9 +import com.bsth.service.schedule.impl.plan.kBase1.core.rerun.RerunRule_input;
  10 +import com.bsth.service.schedule.impl.plan.kBase1.core.rerun.RerunRule_param;
  11 +
  12 +import com.bsth.repository.schedule.CarConfigInfoRepository;
  13 +import com.bsth.repository.schedule.EmployeeConfigInfoRepository;
  14 +
  15 +import org.slf4j.Logger;
  16 +import com.bsth.entity.schedule.CarConfigInfo;
  17 +import java.util.HashMap;
  18 +import com.bsth.entity.schedule.EmployeeConfigInfo;
  19 +import com.bsth.entity.schedule.SchedulePlanInfo;
  20 +
  21 +// 全局日志类(一般使用调用此规则的service类)
  22 +global Logger log;
  23 +
  24 +global CarConfigInfoRepository carConfigInfoRepository;
  25 +global EmployeeConfigInfoRepository employeeConfigInfoRepository;
  26 +
  27 +// 输出
  28 +
  29 +
  30 +/*
  31 + 规则说明:
  32 + 1、对应路牌规则:将对应路牌的车辆,人员替换指定的套跑班次已有的配置
  33 + 2、对应班车规则:直接使用指定的人员,车辆替换指定的套跑班次已有的配置
  34 +*/
  35 +
  36 +//-------------------- 第一阶段、计算对应路牌套跑的车辆配置,人员配置数据 -----------------//
  37 +
  38 +//--------------- 车辆配置信息载入 -------------//
  39 +declare Dylp_CarConfig_Wraps
  40 + xlId: String // 线路Id
  41 + ccMap: Map // 车辆配置Map Map<id, CarConfigInfo>
  42 +end
  43 +
  44 +rule "calcu_Dylp_CarConfig_Wraps"
  45 + salience 1000
  46 + when
  47 + $rp: RerunRule_param($xlId: mxlid)
  48 + $dylpxlid: String() from $rp.getXlIds_dylp()
  49 + then
  50 + List carConfigInfos = carConfigInfoRepository.findByXlId(Integer.parseInt($dylpxlid));
  51 +
  52 + Dylp_CarConfig_Wraps carConfig_wraps = new Dylp_CarConfig_Wraps();
  53 + carConfig_wraps.setXlId($dylpxlid);
  54 + carConfig_wraps.setCcMap(new HashMap());
  55 +
  56 + for (int i = 0; i < carConfigInfos.size(); i++) {
  57 + CarConfigInfo carConfigInfo = (CarConfigInfo) carConfigInfos.get(i);
  58 + carConfig_wraps.getCcMap().put(carConfigInfo.getId().toString(), carConfigInfo);
  59 + }
  60 +
  61 + insert(carConfig_wraps);
  62 +
  63 + log.info("calcu_Dylp_CarConfig_Wraps");
  64 +
  65 +end
  66 +
  67 +//--------------- 人员配置信息载入 --------------//
  68 +declare Dylp_EmployeeConfig_Wraps
  69 + xlId: String // 线路Id
  70 + ecMap: Map // 人员配置Map Map<id, EmployeeConfigInfo>
  71 +end
  72 +
  73 +rule "calcu_Dylp_EmployeeConfig_Wraps"
  74 + salience 1000
  75 + when
  76 + $rp: RerunRule_param($xlId: mxlid)
  77 + $dylpxlid: String() from $rp.getXlIds_dylp()
  78 + then
  79 + List employeeConfigInfos = employeeConfigInfoRepository.findByXlId(Integer.parseInt($dylpxlid));
  80 +
  81 + Dylp_EmployeeConfig_Wraps employeeConfig_wraps = new Dylp_EmployeeConfig_Wraps();
  82 + employeeConfig_wraps.setXlId($dylpxlid);
  83 + employeeConfig_wraps.setEcMap(new HashMap());
  84 +
  85 + for (int i = 0; i < employeeConfigInfos.size(); i++) {
  86 + EmployeeConfigInfo employeeConfigInfo = (EmployeeConfigInfo) employeeConfigInfos.get(i);
  87 + employeeConfig_wraps.getEcMap().put(employeeConfigInfo.getId().toString(), employeeConfigInfo);
  88 + }
  89 +
  90 + insert(employeeConfig_wraps);
  91 +
  92 + log.info("calcu_Dylp_EmployeeConfig_Wraps");
  93 +
  94 +end
  95 +
  96 +//-------------------- 第二阶段、包装对应路牌的循环规则输出 -----------------//
  97 +
  98 +declare Dylp_ScheduleResult_output_wrap
  99 + xlId: String // 线路
  100 + sd: DateTime // 日期
  101 + lp: String // 路牌
  102 + cc: CarConfigInfo // 使用的车辆配置
  103 + ec: List // 使用的人员配置 List<EmployeeConfigInfo>
  104 +end
  105 +
  106 +rule "calcu_Dylp_ScheduleResult_output_wrap"
  107 + salience 900
  108 + when
  109 + $sro: ScheduleResults_output($xlId: xlid)
  110 + $sr: ScheduleResult_output() from $sro.getResults()
  111 + Dylp_CarConfig_Wraps(xlId == $xlId, $ccmap: ccMap)
  112 + Dylp_EmployeeConfig_Wraps(xlId == $xlId, $ecmap: ecMap)
  113 + then
  114 + Dylp_ScheduleResult_output_wrap wrap = new Dylp_ScheduleResult_output_wrap();
  115 + wrap.setXlId($xlId);
  116 + wrap.setSd($sr.getSd());
  117 + wrap.setLp($sr.getGuideboardId());
  118 + wrap.setCc((CarConfigInfo) $ccmap.get($sr.getCarConfigId()));
  119 +
  120 + List ecs = new ArrayList();
  121 + String[] ecids = $sr.getEmployeeConfigId().split("-"); // 分班的人
  122 + for (int i = 0; i < ecids.length; i++) {
  123 + ecs.add($ecmap.get(ecids[i]));
  124 + }
  125 + wrap.setEc(ecs);
  126 +
  127 +// log.info("xlid = {}", $xlId);
  128 +
  129 + insert(wrap);
  130 +end
  131 +
  132 +//-------------------- 第三阶段、套跑线路,替换班次的车辆,人员 --------------------//
  133 +rule "calcu_Dylp_rerun_update_dylp"
  134 + salience 800
  135 +// no-loop
  136 + when
  137 + $spi: SchedulePlanInfo($xlid: xl, $sd: scheduleDate, $lp: lp, $fcsj: fcsj, $ttinfo: ttInfo)
  138 + $ri: RerunRule_input(
  139 + type == "dylp",
  140 + xl == $xlid.toString(),
  141 + ttinfo == $ttinfo.toString(),
  142 + lp == $lp.toString(),
  143 + fcsj == $fcsj,
  144 + $sxl: s_xl, $slp: s_lp, $type: usetype, $hrtype: userhrtype
  145 + )
  146 + $dsro: Dylp_ScheduleResult_output_wrap(
  147 + xlId == $sxl,
  148 + lp == $slp,
  149 + sd.getMillis() == $sd.getTime()
  150 + )
  151 + then
  152 +// log.info("TODO:测试 {}", $fcsj);
  153 +
  154 + $spi.setRerunInfoDylp($dsro.getCc(), $dsro.getEc(), $type, $hrtype);
  155 +
  156 +end
  157 +
  158 +rule "calcu_Dylp_rerun_update_dybc"
  159 + salience 700
  160 + when
  161 + $spi: SchedulePlanInfo($xlid: xl, $sd: scheduleDate, $lp: lp, $fcsj: fcsj, $ttinfo: ttInfo)
  162 + $ri: RerunRule_input(
  163 + type == "dybc",
  164 + xl == $xlid.toString(),
  165 + ttinfo == $ttinfo.toString(),
  166 + lp == $lp.toString(),
  167 + fcsj == $fcsj
  168 + )
  169 +
  170 + then
  171 +
  172 + $spi.setRerunInfoDybc($ri);
  173 +
  174 +
  175 +end
  176 +
  177 +
  178 +
  179 +
  180 +
  181 +
  182 +
  183 +
  184 +
  185 +
  186 +
  187 +
  188 +
  189 +
  190 +
  191 +
  192 +
... ...