Commit 3f04789a25c69111291df5fd52de41fdc2b0ae27
Merge branch 'pudong' of http://222.66.0.204:8090/panzhaov5/bsth_control
into pudong
Showing
6 changed files
with
47 additions
and
18 deletions
src/main/java/com/bsth/entity/search/PredicatesBuilder.java
| ... | ... | @@ -30,21 +30,15 @@ public class PredicatesBuilder { |
| 30 | 30 | static{ |
| 31 | 31 | nf = NumberFormat.getInstance(); |
| 32 | 32 | } |
| 33 | - | |
| 33 | + | |
| 34 | 34 | public static Predicate eq(CriteriaBuilder cb,Path<?> expression, Object object){ |
| 35 | - Class<?> leftType = expression.getJavaType(); | |
| 36 | - Class<?> rightType = object.getClass(); | |
| 35 | + Class<?> leftType = expression.getJavaType(); | |
| 36 | + Class<?> rightType = object.getClass(); | |
| 37 | 37 | |
| 38 | 38 | if(Date.class.isAssignableFrom(leftType) && |
| 39 | 39 | String.class.isAssignableFrom(rightType)){ |
| 40 | 40 | DateTime dateTime = new DateTime(object); |
| 41 | - Date startTime = dateTime.toDate();//设置起始时间 | |
| 42 | - Calendar c = Calendar.getInstance(); | |
| 43 | - c.setTime(startTime); | |
| 44 | - c.add(Calendar.DAY_OF_MONTH, 1); | |
| 45 | - // 设置结束时间,起始时间为结束时间加1天 | |
| 46 | - Date endTime = c.getTime(); | |
| 47 | - return cb.between((Path<Date>) expression,startTime,endTime); | |
| 41 | + return cb.equal(expression, dateTime.toDate()); | |
| 48 | 42 | } |
| 49 | 43 | else { |
| 50 | 44 | return cb.equal(expression, object); |
| ... | ... | @@ -208,4 +202,21 @@ public class PredicatesBuilder { |
| 208 | 202 | } |
| 209 | 203 | return cb.equal(expression, time); |
| 210 | 204 | } |
| 205 | + | |
| 206 | + public static Predicate dateEq(CriteriaBuilder cb,Path<?> expression, Object object){ | |
| 207 | + Predicate predicate = null; | |
| 208 | + try { | |
| 209 | + DateTime dateTime = new DateTime(object); | |
| 210 | + Date startTime = dateTime.toDate();//设置起始时间 | |
| 211 | + Calendar c = Calendar.getInstance(); | |
| 212 | + c.setTime(startTime); | |
| 213 | + c.add(Calendar.DAY_OF_MONTH, 1); | |
| 214 | + // 设置结束时间,起始时间为结束时间加1天 | |
| 215 | + Date endTime = c.getTime(); | |
| 216 | + predicate = cb.between((Path<Date>) expression,startTime,endTime); | |
| 217 | + } catch (Exception e) { | |
| 218 | + e.printStackTrace(); | |
| 219 | + } | |
| 220 | + return predicate; | |
| 221 | + } | |
| 211 | 222 | } | ... | ... |
src/main/java/com/bsth/entity/search/SearchOperator.java
src/main/java/com/bsth/service/calc/impl/CalcToolServiceImpl.java
src/main/java/com/bsth/service/impl/TrafficManageServiceImpl.java
| ... | ... | @@ -483,8 +483,13 @@ public class TrafficManageServiceImpl implements TrafficManageService{ |
| 483 | 483 | sf.append("</DLDS>"); |
| 484 | 484 | str = sf.toString().replace("'","");// 去掉'号 |
| 485 | 485 | results = ssop.setLD(userNameOther, passwordOther, StringEscapeUtils.unescapeHtml(str)); |
| 486 | - // 记录日志 | |
| 487 | - result = logRecord(results,logXlbmMap,logXlbmSuccessMap,logXlbmFailureMap,logSuccess,logFailure,str,logLineMap); | |
| 486 | + try { | |
| 487 | + // 记录日志 | |
| 488 | + result = logRecord(results,logXlbmMap,logXlbmSuccessMap,logXlbmFailureMap,logSuccess,logFailure,str,logLineMap); | |
| 489 | + }catch (Exception e){ | |
| 490 | + logger.error("logRecord:",e); | |
| 491 | + continue; | |
| 492 | + } | |
| 488 | 493 | } |
| 489 | 494 | } |
| 490 | 495 | // 每per条线路上传后剩下的数据再上传 |
| ... | ... | @@ -492,8 +497,12 @@ public class TrafficManageServiceImpl implements TrafficManageService{ |
| 492 | 497 | sf.append("</DLDS>"); |
| 493 | 498 | str = sf.toString().replace("'","");// 去掉'号 |
| 494 | 499 | results = ssop.setLD(userNameOther, passwordOther, StringEscapeUtils.unescapeHtml(str)); |
| 495 | - // 记录日志 | |
| 496 | - result = logRecord(results,logXlbmMap,logXlbmSuccessMap,logXlbmFailureMap,logSuccess,logFailure,str,logLineMap); | |
| 500 | + try { | |
| 501 | + // 记录日志 | |
| 502 | + result = logRecord(results, logXlbmMap, logXlbmSuccessMap, logXlbmFailureMap, logSuccess, logFailure, str, logLineMap); | |
| 503 | + }catch (Exception e){ | |
| 504 | + logger.error("logRecord:",e); | |
| 505 | + } | |
| 497 | 506 | } |
| 498 | 507 | } catch (Exception e) { |
| 499 | 508 | logger.error("setLD:",e); |
| ... | ... | @@ -529,7 +538,7 @@ public class TrafficManageServiceImpl implements TrafficManageService{ |
| 529 | 538 | * @param str |
| 530 | 539 | */ |
| 531 | 540 | private String logRecord(Results results,HashMap logXlbmMap,HashMap logXlbmSuccessMap,HashMap logXlbmFailureMap,StringBuffer logSuccess, |
| 532 | - StringBuffer logFailure,String str,Map<String ,Line> logLineMap){ | |
| 541 | + StringBuffer logFailure,String str,Map<String ,Line> logLineMap) throws Exception{ | |
| 533 | 542 | String result = "failure"; |
| 534 | 543 | String state; |
| 535 | 544 | // 记录日志 | ... | ... |
src/main/resources/rules/kBase3_validate_timetable.drl
| ... | ... | @@ -100,6 +100,7 @@ declare TTInfo_wrap |
| 100 | 100 | weekdays: List // 周一到周日是否启用 List<Boolean> |
| 101 | 101 | specialDays: List // 特殊节假日 List<DateTime> |
| 102 | 102 | updateDate: DateTime // 最新修改时间 |
| 103 | + lineVersion : Integer // 线路版本 | |
| 103 | 104 | end |
| 104 | 105 | |
| 105 | 106 | rule "TTInfo_wrap_result" |
| ... | ... | @@ -118,6 +119,7 @@ rule "TTInfo_wrap_result" |
| 118 | 119 | ttInfo_wrap.setUpdateDate(new DateTime($ttinfo.getUpdateDate())); |
| 119 | 120 | ttInfo_wrap.setWeekdays(new ArrayList()); |
| 120 | 121 | ttInfo_wrap.setSpecialDays(new ArrayList()); |
| 122 | + ttInfo_wrap.setLineVersion($ttinfo.getLineVersion()); | |
| 121 | 123 | |
| 122 | 124 | String[] days = $ttinfo.getRule_days().split(","); |
| 123 | 125 | for (int i = 0; i < 7; i++) { |
| ... | ... | @@ -151,6 +153,7 @@ end |
| 151 | 153 | |
| 152 | 154 | declare TTInfoDetails_wrap |
| 153 | 155 | ttInfoId: Long // 时刻表id |
| 156 | + lineVersion: Integer // 线路版本 | |
| 154 | 157 | bcInfoList: List // 班次信息列表 List<TTInfoDetail> |
| 155 | 158 | end |
| 156 | 159 | |
| ... | ... | @@ -165,6 +168,7 @@ rule "Calcu_iter_days_special_day" // 特殊日期匹配 |
| 165 | 168 | TTInfo_wrap( |
| 166 | 169 | $tid: id, |
| 167 | 170 | $tname: name, |
| 171 | + $lineVersion: lineVersion, | |
| 168 | 172 | specialDays contains $calcu_date |
| 169 | 173 | ) |
| 170 | 174 | then |
| ... | ... | @@ -189,6 +193,7 @@ rule "Calcu_iter_days_special_day" // 特殊日期匹配 |
| 189 | 193 | |
| 190 | 194 | TTInfoDetails_wrap ttInfoDetails_wrap = new TTInfoDetails_wrap(); |
| 191 | 195 | ttInfoDetails_wrap.setTtInfoId($tid); |
| 196 | + ttInfoDetails_wrap.setLineVersion($lineVersion); | |
| 192 | 197 | ttInfoDetails_wrap.setBcInfoList(tTInfoDetailRepository.findByTtinfoId($tid)); |
| 193 | 198 | insert(ttInfoDetails_wrap); |
| 194 | 199 | } |
| ... | ... | @@ -208,6 +213,7 @@ rule "Calcu_iter_days_normal_day" // 平日匹配 |
| 208 | 213 | TTInfo_wrap( |
| 209 | 214 | $tid: id, |
| 210 | 215 | $tname: name, |
| 216 | + $lineVersion: lineVersion, | |
| 211 | 217 | specialDays not contains $calcu_date, |
| 212 | 218 | weekdays[$calcu_weekday - 1] == Boolean.TRUE |
| 213 | 219 | ) |
| ... | ... | @@ -234,6 +240,7 @@ rule "Calcu_iter_days_normal_day" // 平日匹配 |
| 234 | 240 | |
| 235 | 241 | TTInfoDetails_wrap ttInfoDetails_wrap = new TTInfoDetails_wrap(); |
| 236 | 242 | ttInfoDetails_wrap.setTtInfoId($tid); |
| 243 | + ttInfoDetails_wrap.setLineVersion($lineVersion); | |
| 237 | 244 | ttInfoDetails_wrap.setBcInfoList(tTInfoDetailRepository.findByTtinfoId($tid)); |
| 238 | 245 | insert(ttInfoDetails_wrap); |
| 239 | 246 | } |
| ... | ... | @@ -253,6 +260,7 @@ rule "Calcu_iter_days_other_day" // 都没有的情况下,匹配 |
| 253 | 260 | TTInfo_wrap( |
| 254 | 261 | $tid: id, |
| 255 | 262 | $tname: name, |
| 263 | + $lineVersion: lineVersion, | |
| 256 | 264 | specialDays not contains $calcu_date, |
| 257 | 265 | weekdays[$calcu_weekday - 1] == false |
| 258 | 266 | ) |
| ... | ... | @@ -278,6 +286,7 @@ rule "Calcu_iter_days_other_day" // 都没有的情况下,匹配 |
| 278 | 286 | |
| 279 | 287 | TTInfoDetails_wrap ttInfoDetails_wrap = new TTInfoDetails_wrap(); |
| 280 | 288 | ttInfoDetails_wrap.setTtInfoId($tid); |
| 289 | + ttInfoDetails_wrap.setLineVersion($lineVersion); | |
| 281 | 290 | Map<String, Object> param = new HashMap<String, Object>(); |
| 282 | 291 | ttInfoDetails_wrap.setBcInfoList(tTInfoDetailRepository.findByTtinfoId($tid)); |
| 283 | 292 | insert(ttInfoDetails_wrap); |
| ... | ... | @@ -308,7 +317,7 @@ rule "statinfo_result" // 统计计算结果 |
| 308 | 317 | $statInfo.setYybc($yybc); |
| 309 | 318 | $statInfo.setErrorbc($errorbc); |
| 310 | 319 | |
| 311 | - int lineVersion = ((TTInfoDetail) $ttInfoDetails_wrap.getBcInfoList().get(0)).getLineVersion(); | |
| 320 | + int lineVersion = $ttInfoDetails_wrap.getLineVersion(); | |
| 312 | 321 | $statInfo.setLineVersion(lineVersion); |
| 313 | 322 | |
| 314 | 323 | rs.getInfos().add($statInfo); | ... | ... |
src/main/resources/static/pages/trafficManage/timeTempletUploadRecord.html
| ... | ... | @@ -13,7 +13,7 @@ |
| 13 | 13 | <li><select name="line.company_eq" class="form-control" id="companySelect"></select></li> |
| 14 | 14 | <li><select name="line.brancheCompany_eq" class="form-control" id="brancheCompanySelect"></select></li> |
| 15 | 15 | <li>日期:</li> |
| 16 | - <li><input type="text" class="inputCommon dateTime" name="createDate_eq" id="dateInput" placeholder="日期"> | |
| 16 | + <li><input type="text" class="inputCommon dateTime" name="createDate_dateEq" id="dateInput" placeholder="日期"> | |
| 17 | 17 | </li> |
| 18 | 18 | <li>线路名称:</li> |
| 19 | 19 | <li><input type="text" class="form-control form-filter input-sm" | ... | ... |