Commit 3f04789a25c69111291df5fd52de41fdc2b0ae27

Authored by 廖磊
2 parents e6d71322 b7789aeb

Merge branch 'pudong' of http://222.66.0.204:8090/panzhaov5/bsth_control

into pudong
src/main/java/com/bsth/entity/search/PredicatesBuilder.java
@@ -30,21 +30,15 @@ public class PredicatesBuilder { @@ -30,21 +30,15 @@ public class PredicatesBuilder {
30 static{ 30 static{
31 nf = NumberFormat.getInstance(); 31 nf = NumberFormat.getInstance();
32 } 32 }
33 - 33 +
34 public static Predicate eq(CriteriaBuilder cb,Path<?> expression, Object object){ 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 if(Date.class.isAssignableFrom(leftType) && 38 if(Date.class.isAssignableFrom(leftType) &&
39 String.class.isAssignableFrom(rightType)){ 39 String.class.isAssignableFrom(rightType)){
40 DateTime dateTime = new DateTime(object); 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 else { 43 else {
50 return cb.equal(expression, object); 44 return cb.equal(expression, object);
@@ -208,4 +202,21 @@ public class PredicatesBuilder { @@ -208,4 +202,21 @@ public class PredicatesBuilder {
208 } 202 }
209 return cb.equal(expression, time); 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
@@ -27,6 +27,7 @@ public enum SearchOperator { @@ -27,6 +27,7 @@ public enum SearchOperator {
27 isf, //假 isFalse,boolean 27 isf, //假 isFalse,boolean
28 ist, //真 isTrue,boolean 28 ist, //真 isTrue,boolean
29 date, //时间 29 date, //时间
  30 + dateEq, //时间等于
30 in, //数组 31 in, //数组
31 ins //传参 List<String> 32 ins //传参 List<String>
32 } 33 }
src/main/java/com/bsth/service/calc/impl/CalcToolServiceImpl.java
@@ -358,7 +358,6 @@ public class CalcToolServiceImpl implements CalcToolService { @@ -358,7 +358,6 @@ public class CalcToolServiceImpl implements CalcToolService {
358 t_.setDtbc(0); 358 t_.setDtbc(0);
359 t_.setDtbczgf(0); 359 t_.setDtbczgf(0);
360 t_.setDtbcwgf(0); 360 t_.setDtbcwgf(0);
361 - list.add(t_);  
362 list2.add(t_); 361 list2.add(t_);
363 } 362 }
364 } 363 }
src/main/java/com/bsth/service/impl/TrafficManageServiceImpl.java
@@ -483,8 +483,13 @@ public class TrafficManageServiceImpl implements TrafficManageService{ @@ -483,8 +483,13 @@ public class TrafficManageServiceImpl implements TrafficManageService{
483 sf.append("</DLDS>"); 483 sf.append("</DLDS>");
484 str = sf.toString().replace("'","");// 去掉'号 484 str = sf.toString().replace("'","");// 去掉'号
485 results = ssop.setLD(userNameOther, passwordOther, StringEscapeUtils.unescapeHtml(str)); 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 // 每per条线路上传后剩下的数据再上传 495 // 每per条线路上传后剩下的数据再上传
@@ -492,8 +497,12 @@ public class TrafficManageServiceImpl implements TrafficManageService{ @@ -492,8 +497,12 @@ public class TrafficManageServiceImpl implements TrafficManageService{
492 sf.append("</DLDS>"); 497 sf.append("</DLDS>");
493 str = sf.toString().replace("'","");// 去掉'号 498 str = sf.toString().replace("'","");// 去掉'号
494 results = ssop.setLD(userNameOther, passwordOther, StringEscapeUtils.unescapeHtml(str)); 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 } catch (Exception e) { 507 } catch (Exception e) {
499 logger.error("setLD:",e); 508 logger.error("setLD:",e);
@@ -529,7 +538,7 @@ public class TrafficManageServiceImpl implements TrafficManageService{ @@ -529,7 +538,7 @@ public class TrafficManageServiceImpl implements TrafficManageService{
529 * @param str 538 * @param str
530 */ 539 */
531 private String logRecord(Results results,HashMap logXlbmMap,HashMap logXlbmSuccessMap,HashMap logXlbmFailureMap,StringBuffer logSuccess, 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 String result = "failure"; 542 String result = "failure";
534 String state; 543 String state;
535 // 记录日志 544 // 记录日志
src/main/resources/rules/kBase3_validate_timetable.drl
@@ -100,6 +100,7 @@ declare TTInfo_wrap @@ -100,6 +100,7 @@ declare TTInfo_wrap
100 weekdays: List // 周一到周日是否启用 List<Boolean> 100 weekdays: List // 周一到周日是否启用 List<Boolean>
101 specialDays: List // 特殊节假日 List<DateTime> 101 specialDays: List // 特殊节假日 List<DateTime>
102 updateDate: DateTime // 最新修改时间 102 updateDate: DateTime // 最新修改时间
  103 + lineVersion : Integer // 线路版本
103 end 104 end
104 105
105 rule "TTInfo_wrap_result" 106 rule "TTInfo_wrap_result"
@@ -118,6 +119,7 @@ rule &quot;TTInfo_wrap_result&quot; @@ -118,6 +119,7 @@ rule &quot;TTInfo_wrap_result&quot;
118 ttInfo_wrap.setUpdateDate(new DateTime($ttinfo.getUpdateDate())); 119 ttInfo_wrap.setUpdateDate(new DateTime($ttinfo.getUpdateDate()));
119 ttInfo_wrap.setWeekdays(new ArrayList()); 120 ttInfo_wrap.setWeekdays(new ArrayList());
120 ttInfo_wrap.setSpecialDays(new ArrayList()); 121 ttInfo_wrap.setSpecialDays(new ArrayList());
  122 + ttInfo_wrap.setLineVersion($ttinfo.getLineVersion());
121 123
122 String[] days = $ttinfo.getRule_days().split(","); 124 String[] days = $ttinfo.getRule_days().split(",");
123 for (int i = 0; i < 7; i++) { 125 for (int i = 0; i < 7; i++) {
@@ -151,6 +153,7 @@ end @@ -151,6 +153,7 @@ end
151 153
152 declare TTInfoDetails_wrap 154 declare TTInfoDetails_wrap
153 ttInfoId: Long // 时刻表id 155 ttInfoId: Long // 时刻表id
  156 + lineVersion: Integer // 线路版本
154 bcInfoList: List // 班次信息列表 List<TTInfoDetail> 157 bcInfoList: List // 班次信息列表 List<TTInfoDetail>
155 end 158 end
156 159
@@ -165,6 +168,7 @@ rule &quot;Calcu_iter_days_special_day&quot; // 特殊日期匹配 @@ -165,6 +168,7 @@ rule &quot;Calcu_iter_days_special_day&quot; // 特殊日期匹配
165 TTInfo_wrap( 168 TTInfo_wrap(
166 $tid: id, 169 $tid: id,
167 $tname: name, 170 $tname: name,
  171 + $lineVersion: lineVersion,
168 specialDays contains $calcu_date 172 specialDays contains $calcu_date
169 ) 173 )
170 then 174 then
@@ -189,6 +193,7 @@ rule &quot;Calcu_iter_days_special_day&quot; // 特殊日期匹配 @@ -189,6 +193,7 @@ rule &quot;Calcu_iter_days_special_day&quot; // 特殊日期匹配
189 193
190 TTInfoDetails_wrap ttInfoDetails_wrap = new TTInfoDetails_wrap(); 194 TTInfoDetails_wrap ttInfoDetails_wrap = new TTInfoDetails_wrap();
191 ttInfoDetails_wrap.setTtInfoId($tid); 195 ttInfoDetails_wrap.setTtInfoId($tid);
  196 + ttInfoDetails_wrap.setLineVersion($lineVersion);
192 ttInfoDetails_wrap.setBcInfoList(tTInfoDetailRepository.findByTtinfoId($tid)); 197 ttInfoDetails_wrap.setBcInfoList(tTInfoDetailRepository.findByTtinfoId($tid));
193 insert(ttInfoDetails_wrap); 198 insert(ttInfoDetails_wrap);
194 } 199 }
@@ -208,6 +213,7 @@ rule &quot;Calcu_iter_days_normal_day&quot; // 平日匹配 @@ -208,6 +213,7 @@ rule &quot;Calcu_iter_days_normal_day&quot; // 平日匹配
208 TTInfo_wrap( 213 TTInfo_wrap(
209 $tid: id, 214 $tid: id,
210 $tname: name, 215 $tname: name,
  216 + $lineVersion: lineVersion,
211 specialDays not contains $calcu_date, 217 specialDays not contains $calcu_date,
212 weekdays[$calcu_weekday - 1] == Boolean.TRUE 218 weekdays[$calcu_weekday - 1] == Boolean.TRUE
213 ) 219 )
@@ -234,6 +240,7 @@ rule &quot;Calcu_iter_days_normal_day&quot; // 平日匹配 @@ -234,6 +240,7 @@ rule &quot;Calcu_iter_days_normal_day&quot; // 平日匹配
234 240
235 TTInfoDetails_wrap ttInfoDetails_wrap = new TTInfoDetails_wrap(); 241 TTInfoDetails_wrap ttInfoDetails_wrap = new TTInfoDetails_wrap();
236 ttInfoDetails_wrap.setTtInfoId($tid); 242 ttInfoDetails_wrap.setTtInfoId($tid);
  243 + ttInfoDetails_wrap.setLineVersion($lineVersion);
237 ttInfoDetails_wrap.setBcInfoList(tTInfoDetailRepository.findByTtinfoId($tid)); 244 ttInfoDetails_wrap.setBcInfoList(tTInfoDetailRepository.findByTtinfoId($tid));
238 insert(ttInfoDetails_wrap); 245 insert(ttInfoDetails_wrap);
239 } 246 }
@@ -253,6 +260,7 @@ rule &quot;Calcu_iter_days_other_day&quot; // 都没有的情况下,匹配 @@ -253,6 +260,7 @@ rule &quot;Calcu_iter_days_other_day&quot; // 都没有的情况下,匹配
253 TTInfo_wrap( 260 TTInfo_wrap(
254 $tid: id, 261 $tid: id,
255 $tname: name, 262 $tname: name,
  263 + $lineVersion: lineVersion,
256 specialDays not contains $calcu_date, 264 specialDays not contains $calcu_date,
257 weekdays[$calcu_weekday - 1] == false 265 weekdays[$calcu_weekday - 1] == false
258 ) 266 )
@@ -278,6 +286,7 @@ rule &quot;Calcu_iter_days_other_day&quot; // 都没有的情况下,匹配 @@ -278,6 +286,7 @@ rule &quot;Calcu_iter_days_other_day&quot; // 都没有的情况下,匹配
278 286
279 TTInfoDetails_wrap ttInfoDetails_wrap = new TTInfoDetails_wrap(); 287 TTInfoDetails_wrap ttInfoDetails_wrap = new TTInfoDetails_wrap();
280 ttInfoDetails_wrap.setTtInfoId($tid); 288 ttInfoDetails_wrap.setTtInfoId($tid);
  289 + ttInfoDetails_wrap.setLineVersion($lineVersion);
281 Map<String, Object> param = new HashMap<String, Object>(); 290 Map<String, Object> param = new HashMap<String, Object>();
282 ttInfoDetails_wrap.setBcInfoList(tTInfoDetailRepository.findByTtinfoId($tid)); 291 ttInfoDetails_wrap.setBcInfoList(tTInfoDetailRepository.findByTtinfoId($tid));
283 insert(ttInfoDetails_wrap); 292 insert(ttInfoDetails_wrap);
@@ -308,7 +317,7 @@ rule &quot;statinfo_result&quot; // 统计计算结果 @@ -308,7 +317,7 @@ rule &quot;statinfo_result&quot; // 统计计算结果
308 $statInfo.setYybc($yybc); 317 $statInfo.setYybc($yybc);
309 $statInfo.setErrorbc($errorbc); 318 $statInfo.setErrorbc($errorbc);
310 319
311 - int lineVersion = ((TTInfoDetail) $ttInfoDetails_wrap.getBcInfoList().get(0)).getLineVersion(); 320 + int lineVersion = $ttInfoDetails_wrap.getLineVersion();
312 $statInfo.setLineVersion(lineVersion); 321 $statInfo.setLineVersion(lineVersion);
313 322
314 rs.getInfos().add($statInfo); 323 rs.getInfos().add($statInfo);
src/main/resources/static/pages/trafficManage/timeTempletUploadRecord.html
@@ -13,7 +13,7 @@ @@ -13,7 +13,7 @@
13 <li><select name="line.company_eq" class="form-control" id="companySelect"></select></li> 13 <li><select name="line.company_eq" class="form-control" id="companySelect"></select></li>
14 <li><select name="line.brancheCompany_eq" class="form-control" id="brancheCompanySelect"></select></li> 14 <li><select name="line.brancheCompany_eq" class="form-control" id="brancheCompanySelect"></select></li>
15 <li>日期:</li> 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 </li> 17 </li>
18 <li>线路名称:</li> 18 <li>线路名称:</li>
19 <li><input type="text" class="form-control form-filter input-sm" 19 <li><input type="text" class="form-control form-filter input-sm"