Commit ffabc22401a0ef0ef942b72b5dde984ba53e52d7
1 parent
4e501eed
Update
Showing
6 changed files
with
239 additions
and
13 deletions
src/main/java/com/bsth/service/schedule/impl/SchedulePlanServiceImpl.java
| @@ -15,6 +15,7 @@ import com.bsth.service.schedule.rules.shiftloop.ScheduleCalcuParam_input; | @@ -15,6 +15,7 @@ import com.bsth.service.schedule.rules.shiftloop.ScheduleCalcuParam_input; | ||
| 15 | import com.bsth.service.schedule.rules.shiftloop.ScheduleResults_output; | 15 | import com.bsth.service.schedule.rules.shiftloop.ScheduleResults_output; |
| 16 | import com.bsth.service.schedule.rules.shiftloop.ScheduleRule_input; | 16 | import com.bsth.service.schedule.rules.shiftloop.ScheduleRule_input; |
| 17 | import com.bsth.service.schedule.rules.strategy.IStrategy; | 17 | import com.bsth.service.schedule.rules.strategy.IStrategy; |
| 18 | +import com.bsth.service.schedule.rules.ttinfo.LpInfoResults_output; | ||
| 18 | import com.bsth.service.schedule.rules.ttinfo.TTInfoCalcuParam_input; | 19 | import com.bsth.service.schedule.rules.ttinfo.TTInfoCalcuParam_input; |
| 19 | import com.bsth.service.schedule.rules.ttinfo.TTInfoResults_output; | 20 | import com.bsth.service.schedule.rules.ttinfo.TTInfoResults_output; |
| 20 | import com.bsth.service.schedule.rules.ttinfo.TTInfo_input; | 21 | import com.bsth.service.schedule.rules.ttinfo.TTInfo_input; |
| @@ -156,6 +157,7 @@ public class SchedulePlanServiceImpl extends BServiceImpl<SchedulePlan, Long> im | @@ -156,6 +157,7 @@ public class SchedulePlanServiceImpl extends BServiceImpl<SchedulePlan, Long> im | ||
| 156 | ); | 157 | ); |
| 157 | // 规则输出数据 | 158 | // 规则输出数据 |
| 158 | TTInfoResults_output ttInfoResults_output = new TTInfoResults_output(); | 159 | TTInfoResults_output ttInfoResults_output = new TTInfoResults_output(); |
| 160 | + LpInfoResults_output lpInfoResults_output = new LpInfoResults_output(); | ||
| 159 | 161 | ||
| 160 | // 1-2、构造drools session->载入数据->启动规则->计算->销毁session | 162 | // 1-2、构造drools session->载入数据->启动规则->计算->销毁session |
| 161 | // 创建session,内部配置的是stateful | 163 | // 创建session,内部配置的是stateful |
| @@ -163,8 +165,11 @@ public class SchedulePlanServiceImpl extends BServiceImpl<SchedulePlan, Long> im | @@ -163,8 +165,11 @@ public class SchedulePlanServiceImpl extends BServiceImpl<SchedulePlan, Long> im | ||
| 163 | 165 | ||
| 164 | // 设置gloable对象,在drl中通过别名使用 | 166 | // 设置gloable对象,在drl中通过别名使用 |
| 165 | session.setGlobal("results", ttInfoResults_output); | 167 | session.setGlobal("results", ttInfoResults_output); |
| 168 | + session.setGlobal("lpInfoResults_output", lpInfoResults_output); | ||
| 166 | session.setGlobal("log", logger); // 设置日志 | 169 | session.setGlobal("log", logger); // 设置日志 |
| 167 | 170 | ||
| 171 | + session.setGlobal("tTInfoDetailService", ttInfoDetailService); | ||
| 172 | + | ||
| 168 | // 载入数据 | 173 | // 载入数据 |
| 169 | session.insert(ttInfoCalcuParam_input); | 174 | session.insert(ttInfoCalcuParam_input); |
| 170 | for (TTInfo ttInfo : ttInfos) { | 175 | for (TTInfo ttInfo : ttInfos) { |
| @@ -225,18 +230,18 @@ public class SchedulePlanServiceImpl extends BServiceImpl<SchedulePlan, Long> im | @@ -225,18 +230,18 @@ public class SchedulePlanServiceImpl extends BServiceImpl<SchedulePlan, Long> im | ||
| 225 | 230 | ||
| 226 | @Transactional(propagation = Propagation.REQUIRED, isolation = Isolation.READ_COMMITTED) | 231 | @Transactional(propagation = Propagation.REQUIRED, isolation = Isolation.READ_COMMITTED) |
| 227 | public SchedulePlan save2(SchedulePlan schedulePlan) { | 232 | public SchedulePlan save2(SchedulePlan schedulePlan) { |
| 228 | - // 1、循环规则计算输出 | ||
| 229 | - ScheduleResults_output scheduleResults_output = loopRuleOutput(schedulePlan); | 233 | +// // 1、循环规则计算输出 |
| 234 | +// ScheduleResults_output scheduleResults_output = loopRuleOutput(schedulePlan); | ||
| 230 | // 2、时刻表选择 | 235 | // 2、时刻表选择 |
| 231 | TTInfoResults_output ttInfoResults_output = ttInfoOutput(schedulePlan); | 236 | TTInfoResults_output ttInfoResults_output = ttInfoOutput(schedulePlan); |
| 232 | - // 3、计划输出 | ||
| 233 | - PlanResult planResult = planResultOutput(schedulePlan, scheduleResults_output, ttInfoResults_output); | ||
| 234 | - | ||
| 235 | - schedulePlan.getSchedulePlanInfoList().addAll(planResult.getSchedulePlanInfos()); | ||
| 236 | - schedulePlan.setTtInfoId("todo"); // TODO:待修正 | ||
| 237 | - schedulePlan.setTtInfoNames("todo"); // TODO:待修正 | ||
| 238 | - | ||
| 239 | - super.save(schedulePlan); | 237 | +// // 3、计划输出 |
| 238 | +// PlanResult planResult = planResultOutput(schedulePlan, scheduleResults_output, ttInfoResults_output); | ||
| 239 | +// | ||
| 240 | +// schedulePlan.getSchedulePlanInfoList().addAll(planResult.getSchedulePlanInfos()); | ||
| 241 | +// schedulePlan.setTtInfoId("todo"); // TODO:待修正 | ||
| 242 | +// schedulePlan.setTtInfoNames("todo"); // TODO:待修正 | ||
| 243 | +// | ||
| 244 | +// super.save(schedulePlan); | ||
| 240 | 245 | ||
| 241 | return new SchedulePlan(); | 246 | return new SchedulePlan(); |
| 242 | } | 247 | } |
src/main/java/com/bsth/service/schedule/rules/ttinfo/LpInfoResult_output.java
0 → 100644
| 1 | +package com.bsth.service.schedule.rules.ttinfo; | ||
| 2 | + | ||
| 3 | +import org.joda.time.DateTime; | ||
| 4 | + | ||
| 5 | +/** | ||
| 6 | + * 每日路爬信息。 | ||
| 7 | + */ | ||
| 8 | +public class LpInfoResult_output { | ||
| 9 | + /** 具体日期 */ | ||
| 10 | + private DateTime dateTime; | ||
| 11 | + /** 路牌Id */ | ||
| 12 | + private String lpId; | ||
| 13 | + /** 线路Id */ | ||
| 14 | + private String xlId; | ||
| 15 | + /** 时刻表Id */ | ||
| 16 | + private String ttInfoId; | ||
| 17 | + | ||
| 18 | + public DateTime getDateTime() { | ||
| 19 | + return dateTime; | ||
| 20 | + } | ||
| 21 | + | ||
| 22 | + public void setDateTime(DateTime dateTime) { | ||
| 23 | + this.dateTime = dateTime; | ||
| 24 | + } | ||
| 25 | + | ||
| 26 | + public String getLpId() { | ||
| 27 | + return lpId; | ||
| 28 | + } | ||
| 29 | + | ||
| 30 | + public void setLpId(String lpId) { | ||
| 31 | + this.lpId = lpId; | ||
| 32 | + } | ||
| 33 | + | ||
| 34 | + public String getXlId() { | ||
| 35 | + return xlId; | ||
| 36 | + } | ||
| 37 | + | ||
| 38 | + public void setXlId(String xlId) { | ||
| 39 | + this.xlId = xlId; | ||
| 40 | + } | ||
| 41 | + | ||
| 42 | + public String getTtInfoId() { | ||
| 43 | + return ttInfoId; | ||
| 44 | + } | ||
| 45 | + | ||
| 46 | + public void setTtInfoId(String ttInfoId) { | ||
| 47 | + this.ttInfoId = ttInfoId; | ||
| 48 | + } | ||
| 49 | +} |
src/main/java/com/bsth/service/schedule/rules/ttinfo/LpInfoResultsFunction.java
0 → 100644
| 1 | +package com.bsth.service.schedule.rules.ttinfo; | ||
| 2 | + | ||
| 3 | +import com.bsth.entity.schedule.TTInfoDetail; | ||
| 4 | +import org.kie.api.runtime.rule.AccumulateFunction; | ||
| 5 | + | ||
| 6 | +import java.io.*; | ||
| 7 | +import java.util.ArrayList; | ||
| 8 | +import java.util.HashMap; | ||
| 9 | +import java.util.List; | ||
| 10 | +import java.util.Map; | ||
| 11 | + | ||
| 12 | +/** | ||
| 13 | + * 路牌信息统计函数。 | ||
| 14 | + */ | ||
| 15 | +public class LpInfoResultsFunction implements AccumulateFunction { | ||
| 16 | + @Override | ||
| 17 | + public void writeExternal(ObjectOutput out) throws IOException { | ||
| 18 | + | ||
| 19 | + } | ||
| 20 | + | ||
| 21 | + @Override | ||
| 22 | + public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException { | ||
| 23 | + | ||
| 24 | + } | ||
| 25 | + | ||
| 26 | + protected static class LpInfoResultsData implements Externalizable { | ||
| 27 | + public List<LpInfoResult_output> lpInfoResult_outputs = new ArrayList<>(); | ||
| 28 | + public Map<Long, LpInfoResult_output> lpInfoResult_outputMap = new HashMap<>(); | ||
| 29 | + public TTInfoDetail ttInfoDetail; | ||
| 30 | + | ||
| 31 | + public LpInfoResultsData() {} | ||
| 32 | + | ||
| 33 | + @Override | ||
| 34 | + public void writeExternal(ObjectOutput out) throws IOException { | ||
| 35 | + out.writeObject(lpInfoResult_outputs); | ||
| 36 | + out.writeObject(ttInfoDetail); | ||
| 37 | + } | ||
| 38 | + | ||
| 39 | + @Override | ||
| 40 | + public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException { | ||
| 41 | + lpInfoResult_outputs = (List<LpInfoResult_output>) in.readObject(); | ||
| 42 | + ttInfoDetail = (TTInfoDetail) in.readObject(); | ||
| 43 | + } | ||
| 44 | + } | ||
| 45 | + | ||
| 46 | + @Override | ||
| 47 | + public Serializable createContext() { | ||
| 48 | + return new LpInfoResultsData(); | ||
| 49 | + } | ||
| 50 | + | ||
| 51 | + @Override | ||
| 52 | + public void init(Serializable context) throws Exception { | ||
| 53 | + LpInfoResultsData lpInfoResultsData = (LpInfoResultsData) context; | ||
| 54 | + lpInfoResultsData.lpInfoResult_outputs = new ArrayList<>(); | ||
| 55 | + lpInfoResultsData.lpInfoResult_outputMap = new HashMap<>(); | ||
| 56 | + } | ||
| 57 | + | ||
| 58 | + @Override | ||
| 59 | + public void accumulate(Serializable context, Object value) { | ||
| 60 | + LpInfoResultsData lpInfoResultsData = (LpInfoResultsData) context; | ||
| 61 | + TTInfoDetail ttInfoDetail = (TTInfoDetail) value; | ||
| 62 | + | ||
| 63 | + if (ttInfoDetail.getLp() != null) { | ||
| 64 | + if (lpInfoResultsData.lpInfoResult_outputMap.get(ttInfoDetail.getLp().getId()) == null) { | ||
| 65 | + LpInfoResult_output lpInfoResult_output = new LpInfoResult_output(); | ||
| 66 | + lpInfoResult_output.setLpId(String.valueOf(ttInfoDetail.getLp().getId())); | ||
| 67 | + lpInfoResult_output.setXlId(String.valueOf(ttInfoDetail.getXl().getId())); | ||
| 68 | + lpInfoResult_output.setTtInfoId(String.valueOf(ttInfoDetail.getTtinfo().getId())); | ||
| 69 | + | ||
| 70 | + lpInfoResultsData.lpInfoResult_outputMap.put( | ||
| 71 | + ttInfoDetail.getLp().getId(), | ||
| 72 | + lpInfoResult_output); | ||
| 73 | + } | ||
| 74 | + } | ||
| 75 | + | ||
| 76 | + lpInfoResultsData.lpInfoResult_outputs.clear(); | ||
| 77 | + lpInfoResultsData.lpInfoResult_outputs.addAll( | ||
| 78 | + lpInfoResultsData.lpInfoResult_outputMap.values()); | ||
| 79 | + } | ||
| 80 | + | ||
| 81 | + @Override | ||
| 82 | + public boolean supportsReverse() { | ||
| 83 | + return true; | ||
| 84 | + } | ||
| 85 | + | ||
| 86 | + @Override | ||
| 87 | + public void reverse(Serializable context, Object value) throws Exception { | ||
| 88 | + LpInfoResultsData lpInfoResultsData = (LpInfoResultsData) context; | ||
| 89 | + TTInfoDetail ttInfoDetail = (TTInfoDetail) value; | ||
| 90 | + | ||
| 91 | + lpInfoResultsData.lpInfoResult_outputMap.remove(ttInfoDetail.getLp().getId()); | ||
| 92 | + | ||
| 93 | + lpInfoResultsData.lpInfoResult_outputs.clear(); | ||
| 94 | + lpInfoResultsData.lpInfoResult_outputs.addAll( | ||
| 95 | + lpInfoResultsData.lpInfoResult_outputMap.values()); | ||
| 96 | + | ||
| 97 | + } | ||
| 98 | + | ||
| 99 | + @Override | ||
| 100 | + public Object getResult(Serializable context) throws Exception { | ||
| 101 | + LpInfoResultsData lpInfoResultsData = (LpInfoResultsData) context; | ||
| 102 | + return lpInfoResultsData.lpInfoResult_outputs; | ||
| 103 | + } | ||
| 104 | + | ||
| 105 | + @Override | ||
| 106 | + public Class<?> getResultType() { | ||
| 107 | + return List.class; | ||
| 108 | + } | ||
| 109 | +} |
src/main/java/com/bsth/service/schedule/rules/ttinfo/LpInfoResults_output.java
0 → 100644
| 1 | +package com.bsth.service.schedule.rules.ttinfo; | ||
| 2 | + | ||
| 3 | +import java.util.ArrayList; | ||
| 4 | +import java.util.List; | ||
| 5 | + | ||
| 6 | +/** | ||
| 7 | + * Created by xu on 17/3/21. | ||
| 8 | + */ | ||
| 9 | +public class LpInfoResults_output { | ||
| 10 | + | ||
| 11 | + private List<LpInfoResult_output> lpInfoResult_outputs = new ArrayList<>(); | ||
| 12 | + | ||
| 13 | + public List<LpInfoResult_output> getLpInfoResult_outputs() { | ||
| 14 | + return lpInfoResult_outputs; | ||
| 15 | + } | ||
| 16 | + | ||
| 17 | + public void setLpInfoResult_outputs(List<LpInfoResult_output> lpInfoResult_outputs) { | ||
| 18 | + this.lpInfoResult_outputs = lpInfoResult_outputs; | ||
| 19 | + } | ||
| 20 | +} |
src/main/resources/rules/functions.drl
| @@ -2,4 +2,5 @@ package com.bsth.service.schedule; | @@ -2,4 +2,5 @@ package com.bsth.service.schedule; | ||
| 2 | 2 | ||
| 3 | import accumulate com.bsth.service.schedule.rules.ttinfo2.ErrorBcCountFunction ecount; | 3 | import accumulate com.bsth.service.schedule.rules.ttinfo2.ErrorBcCountFunction ecount; |
| 4 | import accumulate com.bsth.service.schedule.rules.shiftloop.GidsCountFunction gidscount; | 4 | import accumulate com.bsth.service.schedule.rules.shiftloop.GidsCountFunction gidscount; |
| 5 | -import accumulate com.bsth.service.schedule.rules.shiftloop.GidFbTimeFunction gidfbtime; | ||
| 6 | \ No newline at end of file | 5 | \ No newline at end of file |
| 6 | +import accumulate com.bsth.service.schedule.rules.shiftloop.GidFbTimeFunction gidfbtime; | ||
| 7 | +import accumulate com.bsth.service.schedule.rules.ttinfo.LpInfoResultsFunction lpinforesult; | ||
| 7 | \ No newline at end of file | 8 | \ No newline at end of file |
src/main/resources/rules/ttinfo.drl
| @@ -7,13 +7,31 @@ import com.bsth.service.schedule.rules.ttinfo.TTInfoCalcuParam_input; | @@ -7,13 +7,31 @@ import com.bsth.service.schedule.rules.ttinfo.TTInfoCalcuParam_input; | ||
| 7 | import com.bsth.service.schedule.rules.ttinfo.TTInfo_input; | 7 | import com.bsth.service.schedule.rules.ttinfo.TTInfo_input; |
| 8 | import com.bsth.service.schedule.rules.ttinfo.TTInfoResult_output; | 8 | import com.bsth.service.schedule.rules.ttinfo.TTInfoResult_output; |
| 9 | import com.bsth.service.schedule.rules.ttinfo.TTInfoResults_output; | 9 | import com.bsth.service.schedule.rules.ttinfo.TTInfoResults_output; |
| 10 | +import com.bsth.service.schedule.rules.ttinfo.LpInfoResult_output; | ||
| 11 | +import com.bsth.service.schedule.rules.ttinfo.LpInfoResults_output; | ||
| 10 | 12 | ||
| 11 | -import org.slf4j.Logger; | 13 | +import com.bsth.service.schedule.TTInfoDetailService; |
| 14 | + | ||
| 15 | +import com.bsth.entity.schedule.TTInfo; | ||
| 16 | +import com.bsth.entity.schedule.TTInfoDetail; | ||
| 17 | + | ||
| 18 | +import org.slf4j.Logger | ||
| 12 | 19 | ||
| 13 | // 全局日志 | 20 | // 全局日志 |
| 14 | global Logger log; | 21 | global Logger log; |
| 22 | +// service | ||
| 23 | +global TTInfoDetailService tTInfoDetailService; | ||
| 15 | // return输出 | 24 | // return输出 |
| 16 | global TTInfoResults_output results | 25 | global TTInfoResults_output results |
| 26 | +global LpInfoResults_output lpInfoResults_output | ||
| 27 | + | ||
| 28 | +function Map ttidParams(List ttinfolist) { | ||
| 29 | + // 获取第一张时刻表id | ||
| 30 | + TTInfo_input ttInfo_input = (TTInfo_input) ttinfolist.get(0); | ||
| 31 | + Map param = new HashMap(); | ||
| 32 | + param.put("ttinfo.id_eq", Long.parseLong(ttInfo_input.getTtInfoId())); | ||
| 33 | + return param; | ||
| 34 | +} | ||
| 17 | 35 | ||
| 18 | 36 | ||
| 19 | /* | 37 | /* |
| @@ -91,6 +109,7 @@ rule "calcu_ttinfo_special_day" // 特殊日期匹配 | @@ -91,6 +109,7 @@ rule "calcu_ttinfo_special_day" // 特殊日期匹配 | ||
| 91 | $calcu_ttinfo_enable_result : Calcu_ttinfo_enable_result($xlId : xlId, $calcu_date : calcu_date, $ttInfo_input_list : ttInfo_input_list) | 109 | $calcu_ttinfo_enable_result : Calcu_ttinfo_enable_result($xlId : xlId, $calcu_date : calcu_date, $ttInfo_input_list : ttInfo_input_list) |
| 92 | $calcu_days_result : Calcu_days_result(calcu_date == $calcu_date, xlId == $xlId, $calcu_day : calcu_day) | 110 | $calcu_days_result : Calcu_days_result(calcu_date == $calcu_date, xlId == $xlId, $calcu_day : calcu_day) |
| 93 | $ttinfolist : ArrayList(size >= 1) from collect (TTInfo_input(specialDays contains $calcu_date) from $ttInfo_input_list) | 111 | $ttinfolist : ArrayList(size >= 1) from collect (TTInfo_input(specialDays contains $calcu_date) from $ttInfo_input_list) |
| 112 | + $lpInfoResults: List() from accumulate ($ttd: TTInfoDetail() from tTInfoDetailService.list(ttidParams($ttinfolist)), lpinforesult($ttd)) | ||
| 94 | then | 113 | then |
| 95 | // 更新Calcu_days_result对象 | 114 | // 更新Calcu_days_result对象 |
| 96 | int new_calcu_day = $calcu_day + 1; | 115 | int new_calcu_day = $calcu_day + 1; |
| @@ -105,6 +124,13 @@ rule "calcu_ttinfo_special_day" // 特殊日期匹配 | @@ -105,6 +124,13 @@ rule "calcu_ttinfo_special_day" // 特殊日期匹配 | ||
| 105 | Collections.sort($ttinfolist); | 124 | Collections.sort($ttinfolist); |
| 106 | results.addXlTTInfos($xlId, $calcu_date, $ttinfolist); | 125 | results.addXlTTInfos($xlId, $calcu_date, $ttinfolist); |
| 107 | 126 | ||
| 127 | + // lp输出 | ||
| 128 | + for (int i = 0; i < $lpInfoResults.size(); i++) { | ||
| 129 | + LpInfoResult_output lpInfoResult_output = (LpInfoResult_output) $lpInfoResults.get(i); | ||
| 130 | + lpInfoResult_output.setDateTime($calcu_date); // 设定时间 | ||
| 131 | + lpInfoResults_output.getLpInfoResult_outputs().add(lpInfoResult_output); | ||
| 132 | + } | ||
| 133 | + | ||
| 108 | update($calcu_days_result); | 134 | update($calcu_days_result); |
| 109 | end | 135 | end |
| 110 | 136 | ||
| @@ -114,6 +140,7 @@ rule "calcu_ttinfo_normal_day" // 平日匹配 | @@ -114,6 +140,7 @@ rule "calcu_ttinfo_normal_day" // 平日匹配 | ||
| 114 | $calcu_ttinfo_enable_result : Calcu_ttinfo_enable_result($xlId : xlId, $calcu_date : calcu_date, $ttInfo_input_list : ttInfo_input_list) | 140 | $calcu_ttinfo_enable_result : Calcu_ttinfo_enable_result($xlId : xlId, $calcu_date : calcu_date, $ttInfo_input_list : ttInfo_input_list) |
| 115 | $calcu_days_result : Calcu_days_result(calcu_date == $calcu_date, xlId == $xlId, $calcu_day : calcu_day, $calcu_weekday : calcu_weekday) | 141 | $calcu_days_result : Calcu_days_result(calcu_date == $calcu_date, xlId == $xlId, $calcu_day : calcu_day, $calcu_weekday : calcu_weekday) |
| 116 | $ttinfolist : ArrayList(size >= 1) from collect (TTInfo_input(specialDays not contains $calcu_date, weekdays[$calcu_weekday - 1] == true) from $ttInfo_input_list) | 142 | $ttinfolist : ArrayList(size >= 1) from collect (TTInfo_input(specialDays not contains $calcu_date, weekdays[$calcu_weekday - 1] == true) from $ttInfo_input_list) |
| 143 | + $lpInfoResults: List() from accumulate ($ttd: TTInfoDetail() from tTInfoDetailService.list(ttidParams($ttinfolist)), lpinforesult($ttd)) | ||
| 117 | then | 144 | then |
| 118 | // 更新Calcu_days_result对象 | 145 | // 更新Calcu_days_result对象 |
| 119 | int new_calcu_day = $calcu_day + 1; | 146 | int new_calcu_day = $calcu_day + 1; |
| @@ -122,12 +149,19 @@ rule "calcu_ttinfo_normal_day" // 平日匹配 | @@ -122,12 +149,19 @@ rule "calcu_ttinfo_normal_day" // 平日匹配 | ||
| 122 | $calcu_days_result.setCalcu_date(new_calcu_date); | 149 | $calcu_days_result.setCalcu_date(new_calcu_date); |
| 123 | $calcu_days_result.setCalcu_weekday(new_calcu_date.getDayOfWeek()); | 150 | $calcu_days_result.setCalcu_weekday(new_calcu_date.getDayOfWeek()); |
| 124 | 151 | ||
| 125 | - log.info("启用常规日期时刻表:xlId={} 时刻表个数={} 常规日期={} 星期几={}", $xlId, $ttinfolist.size(), $calcu_date, $calcu_weekday); | 152 | + log.info("启用常规日期时刻表:xlId={} 时刻表个数={} 常规日期={} 星期几={} 路牌size={}", $xlId, $ttinfolist.size(), $calcu_date, $calcu_weekday, $lpInfoResults.size()); |
| 126 | 153 | ||
| 127 | // $ttinfolist按时间倒排序,result输出 | 154 | // $ttinfolist按时间倒排序,result输出 |
| 128 | Collections.sort($ttinfolist); | 155 | Collections.sort($ttinfolist); |
| 129 | results.addXlTTInfos($xlId, $calcu_date, $ttinfolist); | 156 | results.addXlTTInfos($xlId, $calcu_date, $ttinfolist); |
| 130 | 157 | ||
| 158 | + // lp输出 | ||
| 159 | + for (int i = 0; i < $lpInfoResults.size(); i++) { | ||
| 160 | + LpInfoResult_output lpInfoResult_output = (LpInfoResult_output) $lpInfoResults.get(i); | ||
| 161 | + lpInfoResult_output.setDateTime($calcu_date); // 设定时间 | ||
| 162 | + lpInfoResults_output.getLpInfoResult_outputs().add(lpInfoResult_output); | ||
| 163 | + } | ||
| 164 | + | ||
| 131 | update($calcu_days_result); | 165 | update($calcu_days_result); |
| 132 | end | 166 | end |
| 133 | 167 | ||
| @@ -137,6 +171,7 @@ rule "calcu_ttinfo_other_day" // 都没有的情况下,匹配 | @@ -137,6 +171,7 @@ rule "calcu_ttinfo_other_day" // 都没有的情况下,匹配 | ||
| 137 | $calcu_ttinfo_enable_result : Calcu_ttinfo_enable_result($xlId : xlId, $calcu_date : calcu_date, $ttInfo_input_list : ttInfo_input_list) | 171 | $calcu_ttinfo_enable_result : Calcu_ttinfo_enable_result($xlId : xlId, $calcu_date : calcu_date, $ttInfo_input_list : ttInfo_input_list) |
| 138 | $calcu_days_result : Calcu_days_result(calcu_date == $calcu_date, xlId == $xlId, $calcu_day : calcu_day, $calcu_weekday : calcu_weekday) | 172 | $calcu_days_result : Calcu_days_result(calcu_date == $calcu_date, xlId == $xlId, $calcu_day : calcu_day, $calcu_weekday : calcu_weekday) |
| 139 | $ttinfolist : ArrayList(size >= 1) from collect (TTInfo_input(specialDays not contains $calcu_date, weekdays[$calcu_weekday - 1] == false) from $ttInfo_input_list) | 173 | $ttinfolist : ArrayList(size >= 1) from collect (TTInfo_input(specialDays not contains $calcu_date, weekdays[$calcu_weekday - 1] == false) from $ttInfo_input_list) |
| 174 | + $lpInfoResults: List() from accumulate ($ttd: TTInfoDetail() from tTInfoDetailService.list(ttidParams($ttinfolist)), lpinforesult($ttd)) | ||
| 140 | then | 175 | then |
| 141 | // 更新Calcu_days_result对象 | 176 | // 更新Calcu_days_result对象 |
| 142 | int new_calcu_day = $calcu_day + 1; | 177 | int new_calcu_day = $calcu_day + 1; |
| @@ -151,6 +186,13 @@ rule "calcu_ttinfo_other_day" // 都没有的情况下,匹配 | @@ -151,6 +186,13 @@ rule "calcu_ttinfo_other_day" // 都没有的情况下,匹配 | ||
| 151 | Collections.sort($ttinfolist); | 186 | Collections.sort($ttinfolist); |
| 152 | results.addXlTTInfos($xlId, $calcu_date, $ttinfolist); | 187 | results.addXlTTInfos($xlId, $calcu_date, $ttinfolist); |
| 153 | 188 | ||
| 189 | + // lp输出 | ||
| 190 | + for (int i = 0; i < $lpInfoResults.size(); i++) { | ||
| 191 | + LpInfoResult_output lpInfoResult_output = (LpInfoResult_output) $lpInfoResults.get(i); | ||
| 192 | + lpInfoResult_output.setDateTime($calcu_date); // 设定时间 | ||
| 193 | + lpInfoResults_output.getLpInfoResult_outputs().add(lpInfoResult_output); | ||
| 194 | + } | ||
| 195 | + | ||
| 154 | update($calcu_days_result); | 196 | update($calcu_days_result); |
| 155 | 197 | ||
| 156 | end | 198 | end |
| 157 | \ No newline at end of file | 199 | \ No newline at end of file |