Commit 084e190745f7571568a54208cffeda54e7b8b838
Merge branch 'minhang' into qingpu_20180808
# Conflicts: # src/main/resources/application-prod.properties # src/main/resources/datatools/config-prod.properties # src/main/resources/ms-jdbc.properties # src/main/resources/static/index.html # src/main/resources/static/login.html # src/main/resources/static/metronic_v4.5.4/plugins/echarts4/echarts.js # src/main/resources/static/metronic_v4.5.4/plugins/echarts4/echarts.min.js # src/main/resources/static/real_control_v2/main.html # src/main/resources/traffic-jdbc.properties
Showing
97 changed files
with
2743 additions
and
654 deletions
Too many changes to show.
To preserve performance only 97 of 577 files are displayed.
src/main/java/com/bsth/XDApplication.java
| ... | ... | @@ -169,7 +169,7 @@ public class XDApplication implements CommandLineRunner { |
| 169 | 169 | sexec.scheduleWithFixedDelay(schedulePstThread, 180, 10, TimeUnit.SECONDS);//班次延迟入库线程 |
| 170 | 170 | sexec.scheduleWithFixedDelay(seiPstThread, 180, 60, TimeUnit.SECONDS);//班次修正日志入库 |
| 171 | 171 | sexec.scheduleWithFixedDelay(directivesPstThread, 120, 60, TimeUnit.SECONDS);//调度指令延迟入库 |
| 172 | - sexec.scheduleWithFixedDelay(threadMonotor, 240, 60, TimeUnit.SECONDS);//线程监听(防止重要的线程阻塞、异常结束。以及部分主备切换工作) | |
| 172 | + //sexec.scheduleWithFixedDelay(threadMonotor, 240, 60, TimeUnit.SECONDS);//线程监听(防止重要的线程阻塞、异常结束。以及部分主备切换工作) | |
| 173 | 173 | sexec.scheduleWithFixedDelay(sampleTimeDataLoader, 140, 120 * 60, TimeUnit.SECONDS);//到离站预测需要的站点间耗时数据 |
| 174 | 174 | sexec.scheduleWithFixedDelay(basicDataLoader, 1, 1, TimeUnit.HOURS);//基础数据更新 |
| 175 | 175 | sexec.scheduleWithFixedDelay(autoExecScanThread, 180, 50, TimeUnit.SECONDS);//班次自动执行 | ... | ... |
src/main/java/com/bsth/common/Constants.java
| ... | ... | @@ -20,6 +20,8 @@ public class Constants { |
| 20 | 20 | public static final String METRONIC_URL = "/metronic_v4.5.4/**"; |
| 21 | 21 | public static final String LOGIN_FAILURE = "/user/loginFailure"; |
| 22 | 22 | public static final String CAPTCHA = "/captcha.jpg"; |
| 23 | + public static final String XIANDIAO_LOGIN = "/xdlogin.html"; | |
| 24 | + public static final String IPAD_IMG_URL = "/apple-touch-icon-72x72.png"; | |
| 23 | 25 | |
| 24 | 26 | //对外的营运数据接口 |
| 25 | 27 | public static final String SERVICE_INTERFACE = "/companyService/**"; | ... | ... |
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; | |
| 6 | +import org.slf4j.Logger; | |
| 7 | +import org.slf4j.LoggerFactory; | |
| 5 | 8 | import org.springframework.beans.factory.annotation.Autowired; |
| 6 | 9 | import org.springframework.web.bind.annotation.RequestMapping; |
| 7 | 10 | import org.springframework.web.bind.annotation.RequestMethod; |
| 8 | 11 | import org.springframework.web.bind.annotation.RequestParam; |
| 9 | 12 | import org.springframework.web.bind.annotation.RestController; |
| 10 | 13 | |
| 11 | -import com.bsth.entity.Station; | |
| 12 | -import com.bsth.service.StationService; | |
| 13 | -import com.bsth.util.GetUIDAndCode; | |
| 14 | +import java.util.Map; | |
| 14 | 15 | |
| 15 | 16 | /** |
| 16 | 17 | * |
| ... | ... | @@ -34,6 +35,9 @@ public class StationController extends BaseController<Station, Integer> { |
| 34 | 35 | |
| 35 | 36 | @Autowired |
| 36 | 37 | private StationService service; |
| 38 | + | |
| 39 | + /** 日志记录器 */ | |
| 40 | + private static final Logger LOGGER = LoggerFactory.getLogger(StationController.class); | |
| 37 | 41 | |
| 38 | 42 | /** |
| 39 | 43 | * @Description :TODO(根据坐标点匹配数据库中的站点) |
| ... | ... | @@ -153,10 +157,13 @@ public class StationController extends BaseController<Station, Integer> { |
| 153 | 157 | */ |
| 154 | 158 | @RequestMapping(value="updateStationAndSectionCode" , method = RequestMethod.GET) |
| 155 | 159 | public int updateStationAndSectionCode(@RequestParam Integer stationCount, Integer sectionCount) { |
| 160 | + System.out.println(stationCount+" _ "+ sectionCount ); | |
| 156 | 161 | for(int i = 0; i < stationCount; i++) { |
| 162 | + System.out.println(i); | |
| 157 | 163 | GetUIDAndCode.getStationId(); |
| 158 | 164 | } |
| 159 | - for(int i = 0; i < sectionCount; i++) { | |
| 165 | + for(int j = 0; j < sectionCount; j++) { | |
| 166 | + System.out.println(j); | |
| 160 | 167 | GetUIDAndCode.getSectionId(); |
| 161 | 168 | } |
| 162 | 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/PageForwardingController.java
| ... | ... | @@ -6,10 +6,12 @@ import com.bsth.security.util.SecurityUtils; |
| 6 | 6 | import org.slf4j.Logger; |
| 7 | 7 | import org.slf4j.LoggerFactory; |
| 8 | 8 | import org.springframework.stereotype.Controller; |
| 9 | +import org.springframework.web.bind.annotation.PathVariable; | |
| 9 | 10 | import org.springframework.web.bind.annotation.RequestMapping; |
| 10 | 11 | import org.springframework.web.servlet.ModelAndView; |
| 11 | 12 | |
| 12 | 13 | import javax.servlet.http.HttpServletResponse; |
| 14 | +import javax.ws.rs.Path; | |
| 13 | 15 | |
| 14 | 16 | /** |
| 15 | 17 | * 线调登入页面转发 |
| ... | ... | @@ -21,7 +23,7 @@ public class PageForwardingController { |
| 21 | 23 | |
| 22 | 24 | Logger logger = LoggerFactory.getLogger(this.getClass()); |
| 23 | 25 | |
| 24 | - @RequestMapping("/v2") | |
| 26 | + /*@RequestMapping("/v2") | |
| 25 | 27 | public ModelAndView v2(HttpServletResponse response){ |
| 26 | 28 | ModelAndView mv = new ModelAndView(); |
| 27 | 29 | SysUser user = SecurityUtils.getCurrentUser(); |
| ... | ... | @@ -50,5 +52,42 @@ public class PageForwardingController { |
| 50 | 52 | //正常线调主页 |
| 51 | 53 | mv.setViewName("/real_control_v2/main.html"); |
| 52 | 54 | return mv; |
| 55 | + }*/ | |
| 56 | + | |
| 57 | + @RequestMapping("/{type}") | |
| 58 | + public ModelAndView v2(@PathVariable("type") String type, HttpServletResponse response){ | |
| 59 | + ModelAndView mv = new ModelAndView(); | |
| 60 | + SysUser user = SecurityUtils.getCurrentUser(); | |
| 61 | + | |
| 62 | + //班次管理员 | |
| 63 | + if(user.getUserName().equals("bcgly")){ | |
| 64 | + mv.setViewName("/real_control_v2/sch_manage/sch_imitate.html"); | |
| 65 | + return mv; | |
| 66 | + } | |
| 67 | + | |
| 68 | + try{ | |
| 69 | + //闵行运管所,直接打开地图页面 | |
| 70 | + if(user.getRoles().size() == 1){ | |
| 71 | + for(Role role : user.getRoles()){ | |
| 72 | + if(role.getCodeName().equals("MH_YGS")){ | |
| 73 | + // 直接重定向 | |
| 74 | + response.sendRedirect("/pages/mapmonitor/alone/wrap.html"); | |
| 75 | + return null; | |
| 76 | + } | |
| 77 | + } | |
| 78 | + } | |
| 79 | + }catch (Exception e){ | |
| 80 | + logger.error("", e); | |
| 81 | + } | |
| 82 | + | |
| 83 | + | |
| 84 | + if(type.equals("v2_mobile")){ | |
| 85 | + mv.setViewName("/real_control_v2_mobile/main.html"); | |
| 86 | + }else{ | |
| 87 | + //正常线调主页 | |
| 88 | + mv.setViewName("/real_control_v2/main.html"); | |
| 89 | + } | |
| 90 | + | |
| 91 | + return mv; | |
| 53 | 92 | } |
| 54 | 93 | } | ... | ... |
src/main/java/com/bsth/controller/realcontrol/ScheduleRealInfoController.java
| 1 | 1 | package com.bsth.controller.realcontrol; |
| 2 | 2 | |
| 3 | +import java.io.ByteArrayOutputStream; | |
| 4 | +import java.io.IOException; | |
| 5 | +import java.io.InputStream; | |
| 6 | +import java.io.OutputStream; | |
| 7 | +import java.net.HttpURLConnection; | |
| 8 | +import java.net.URL; | |
| 9 | +import java.util.ArrayList; | |
| 10 | +import java.util.Collection; | |
| 11 | +import java.util.HashMap; | |
| 12 | +import java.util.List; | |
| 13 | +import java.util.Map; | |
| 14 | + | |
| 15 | +import org.apache.commons.io.IOUtils; | |
| 16 | +import org.apache.commons.lang3.StringEscapeUtils; | |
| 17 | +import org.joda.time.format.DateTimeFormat; | |
| 18 | +import org.joda.time.format.DateTimeFormatter; | |
| 19 | +import org.springframework.beans.factory.annotation.Autowired; | |
| 20 | +import org.springframework.web.bind.annotation.PathVariable; | |
| 21 | +import org.springframework.web.bind.annotation.RequestMapping; | |
| 22 | +import org.springframework.web.bind.annotation.RequestMethod; | |
| 23 | +import org.springframework.web.bind.annotation.RequestParam; | |
| 24 | +import org.springframework.web.bind.annotation.RestController; | |
| 25 | + | |
| 3 | 26 | import com.alibaba.fastjson.JSONArray; |
| 4 | 27 | import com.bsth.common.ResponseCode; |
| 5 | 28 | import com.bsth.controller.BaseController; |
| ... | ... | @@ -10,14 +33,11 @@ import com.bsth.data.schedule.DayOfSchedule; |
| 10 | 33 | import com.bsth.data.schedule.edit_logs.service.dto.SchEditInfoDto; |
| 11 | 34 | import com.bsth.entity.realcontrol.ScheduleRealInfo; |
| 12 | 35 | import com.bsth.entity.schedule.SchedulePlanInfo; |
| 36 | +import com.bsth.entity.sys.SysUser; | |
| 37 | +import com.bsth.security.util.SecurityUtils; | |
| 13 | 38 | import com.bsth.service.realcontrol.ScheduleRealInfoService; |
| 14 | -import org.apache.commons.lang3.StringEscapeUtils; | |
| 15 | -import org.joda.time.format.DateTimeFormat; | |
| 16 | -import org.joda.time.format.DateTimeFormatter; | |
| 17 | -import org.springframework.beans.factory.annotation.Autowired; | |
| 18 | -import org.springframework.web.bind.annotation.*; | |
| 19 | - | |
| 20 | -import java.util.*; | |
| 39 | +import com.bsth.util.ConfigUtil; | |
| 40 | +import com.fasterxml.jackson.databind.ObjectMapper; | |
| 21 | 41 | |
| 22 | 42 | @RestController |
| 23 | 43 | @RequestMapping("/realSchedule") |
| ... | ... | @@ -515,6 +535,11 @@ public class ScheduleRealInfoController extends BaseController<ScheduleRealInfo, |
| 515 | 535 | return scheduleRealInfoService.realScheduleList(line,date); |
| 516 | 536 | } |
| 517 | 537 | |
| 538 | + @RequestMapping(value="/realScheduleList_zrw") | |
| 539 | + public List<ScheduleRealInfo> realScheduleList_zrw(@RequestParam String line,@RequestParam String date){ | |
| 540 | + return scheduleRealInfoService.realScheduleList_zrw(line,date); | |
| 541 | + } | |
| 542 | + | |
| 518 | 543 | @RequestMapping(value="/realScheduleList_mh_2") |
| 519 | 544 | public List<ScheduleRealInfo> realScheduleList_mh_2(@RequestParam String line,@RequestParam String date){ |
| 520 | 545 | return scheduleRealInfoService.realScheduleList_mh_2(line,date); |
| ... | ... | @@ -686,4 +711,74 @@ public class ScheduleRealInfoController extends BaseController<ScheduleRealInfo, |
| 686 | 711 | public Map<String, Object> deleteToHistory(@PathVariable("id") Long id){ |
| 687 | 712 | return scheduleRealInfoService.deleteToHistory(id); |
| 688 | 713 | } |
| 714 | + | |
| 715 | + /** | |
| 716 | + * 从历史库里删除临加班次 | |
| 717 | + * @param sch | |
| 718 | + * @return | |
| 719 | + */ | |
| 720 | + @RequestMapping(value = "wxsb", method = RequestMethod.POST) | |
| 721 | + public Map<String, Object> deleteToHistory(@RequestParam Map<String, Object> param){ | |
| 722 | + SysUser user = SecurityUtils.getCurrentUser(); | |
| 723 | + String uname = user.getUserName(); | |
| 724 | + StringBuilder url = new StringBuilder(ConfigUtil.get("http.report.url")); | |
| 725 | + url.append("?nbbm=").append(param.get("nbbm")).append("&bxy=").append(uname).append("&bxbm=").append(param.get("bxType")); | |
| 726 | + // 分公司保存格式 分公司编码_公司编码 | |
| 727 | + String val = BasicData.nbbm2FgsCompanyCodeMap.get(param.get("nbbm")); | |
| 728 | + String[] arr = val.split("_"); | |
| 729 | + if (!"22".equals(arr[1])) { | |
| 730 | + Map<String, Object> res = new HashMap<String, Object>(); | |
| 731 | + res.put("status", ResponseCode.ERROR); | |
| 732 | + res.put("msg", "除金高公司外暂未开通此功能"); | |
| 733 | + | |
| 734 | + return res; | |
| 735 | + } | |
| 736 | + url.append("&fgs=").append(arr[0]); | |
| 737 | + | |
| 738 | + return request(url.toString()); | |
| 739 | + } | |
| 740 | + | |
| 741 | + @SuppressWarnings("unchecked") | |
| 742 | + private static Map<String, Object> request(String url) { | |
| 743 | + Map<String, Object> res = new HashMap<String, Object>(); | |
| 744 | + res.put("status", ResponseCode.SUCCESS); | |
| 745 | + InputStream in = null; | |
| 746 | + HttpURLConnection con = null; | |
| 747 | + try { | |
| 748 | + con = (HttpURLConnection)new URL(url).openConnection(); | |
| 749 | + con.setRequestMethod("POST"); | |
| 750 | + con.setRequestProperty("keep-alive", "true"); | |
| 751 | + con.setRequestProperty("accept", "application/json"); | |
| 752 | + con.setRequestProperty("content-type", "application/json"); | |
| 753 | + con.setDoInput(true); | |
| 754 | + con.setReadTimeout(2500); | |
| 755 | + con.setConnectTimeout(2500); | |
| 756 | + | |
| 757 | + con.connect(); | |
| 758 | + if (con.getResponseCode() == 200) { | |
| 759 | + in = con.getInputStream(); | |
| 760 | + ByteArrayOutputStream bout = new ByteArrayOutputStream(); | |
| 761 | + IOUtils.copy(in, bout); bout.close(); | |
| 762 | + Map<String, Object> response = new ObjectMapper().readValue(bout.toByteArray(), Map.class); | |
| 763 | + if (!"报修成功".equals(response.get("msg"))) { | |
| 764 | + res.put("status", ResponseCode.ERROR); | |
| 765 | + res.putAll(response); | |
| 766 | + } | |
| 767 | + } | |
| 768 | + } catch (IOException e) { | |
| 769 | + // TODO Auto-generated catch block | |
| 770 | + res.put("status", ResponseCode.ERROR); | |
| 771 | + res.put("msg", "调用上报接口异常"); | |
| 772 | + } finally { | |
| 773 | + try { | |
| 774 | + if (in != null) in.close(); | |
| 775 | + if (con != null) con.disconnect(); | |
| 776 | + } catch (IOException e) { | |
| 777 | + // TODO Auto-generated catch block | |
| 778 | + e.printStackTrace(); | |
| 779 | + } | |
| 780 | + } | |
| 781 | + | |
| 782 | + return res; | |
| 783 | + } | |
| 689 | 784 | } | ... | ... |
src/main/java/com/bsth/controller/schedule/core/CarConfigInfoController.java
| 1 | 1 | package com.bsth.controller.schedule.core; |
| 2 | 2 | |
| 3 | +import com.bsth.common.Constants; | |
| 3 | 4 | import com.bsth.common.ResponseCode; |
| 4 | 5 | import com.bsth.controller.schedule.BController; |
| 5 | 6 | import com.bsth.entity.schedule.CarConfigInfo; |
| 7 | +import com.bsth.entity.sys.CompanyAuthority; | |
| 6 | 8 | import com.bsth.repository.schedule.CarConfigInfoRepository; |
| 7 | 9 | import com.bsth.service.schedule.CarConfigInfoService; |
| 8 | 10 | import com.bsth.service.schedule.exception.ScheduleException; |
| ... | ... | @@ -12,6 +14,8 @@ import org.springframework.web.bind.annotation.RequestMethod; |
| 12 | 14 | import org.springframework.web.bind.annotation.RequestParam; |
| 13 | 15 | import org.springframework.web.bind.annotation.RestController; |
| 14 | 16 | |
| 17 | +import javax.servlet.http.HttpServletRequest; | |
| 18 | +import javax.servlet.http.HttpSession; | |
| 15 | 19 | import java.util.HashMap; |
| 16 | 20 | import java.util.List; |
| 17 | 21 | import java.util.Map; |
| ... | ... | @@ -58,4 +62,84 @@ public class CarConfigInfoController extends BController<CarConfigInfo, Long> { |
| 58 | 62 | |
| 59 | 63 | return rtn; |
| 60 | 64 | } |
| 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 | + | |
| 80 | + @RequestMapping(value = "/validate_cars_gs", method = RequestMethod.GET) | |
| 81 | + public Map<String, Object> validate_cars_gs(HttpServletRequest request, @RequestParam Map<String, Object> param) { | |
| 82 | + HttpSession session = request.getSession(); | |
| 83 | + List<CompanyAuthority> cmyAuths = (List<CompanyAuthority>) session.getAttribute(Constants.COMPANY_AUTHORITYS); | |
| 84 | + | |
| 85 | + Map<String, Object> rtn = new HashMap<>(); | |
| 86 | + try { | |
| 87 | + CarConfigInfo carConfigInfo = new CarConfigInfo( | |
| 88 | + null, | |
| 89 | + param.get("xl.id_eq"), | |
| 90 | + param.get("xl.name_eq"), | |
| 91 | + param.get("cl.id_eq") | |
| 92 | + ); | |
| 93 | + carConfigInfoService.validate_cars_gs(carConfigInfo, cmyAuths); | |
| 94 | + rtn.put("status", ResponseCode.SUCCESS); | |
| 95 | + } catch (ScheduleException exp) { | |
| 96 | + rtn.put("status", ResponseCode.ERROR); | |
| 97 | + rtn.put("msg", exp.getMessage()); | |
| 98 | + } | |
| 99 | + | |
| 100 | + return rtn; | |
| 101 | + } | |
| 102 | + | |
| 103 | + @RequestMapping(value = "/validate_cars_fgs", method = RequestMethod.GET) | |
| 104 | + public Map<String, Object> validate_cars_fgs(HttpServletRequest request, @RequestParam Map<String, Object> param) { | |
| 105 | + HttpSession session = request.getSession(); | |
| 106 | + List<CompanyAuthority> cmyAuths = (List<CompanyAuthority>) session.getAttribute(Constants.COMPANY_AUTHORITYS); | |
| 107 | + | |
| 108 | + Map<String, Object> rtn = new HashMap<>(); | |
| 109 | + try { | |
| 110 | + CarConfigInfo carConfigInfo = new CarConfigInfo( | |
| 111 | + null, | |
| 112 | + param.get("xl.id_eq"), | |
| 113 | + param.get("xl.name_eq"), | |
| 114 | + param.get("cl.id_eq") | |
| 115 | + ); | |
| 116 | + carConfigInfoService.validate_cars_fgs(carConfigInfo, cmyAuths); | |
| 117 | + rtn.put("status", ResponseCode.SUCCESS); | |
| 118 | + } catch (ScheduleException exp) { | |
| 119 | + rtn.put("status", ResponseCode.ERROR); | |
| 120 | + rtn.put("msg", exp.getMessage()); | |
| 121 | + } | |
| 122 | + | |
| 123 | + return rtn; | |
| 124 | + } | |
| 125 | + | |
| 126 | + @RequestMapping(value = "/validate_cars_config", method = RequestMethod.GET) | |
| 127 | + public Map<String, Object> validate_cars_config(@RequestParam Map<String, Object> param) { | |
| 128 | + Map<String, Object> rtn = new HashMap<>(); | |
| 129 | + try { | |
| 130 | + CarConfigInfo carConfigInfo = new CarConfigInfo( | |
| 131 | + null, | |
| 132 | + param.get("xl.id_eq"), | |
| 133 | + param.get("xl.name_eq"), | |
| 134 | + param.get("cl.id_eq") | |
| 135 | + ); | |
| 136 | + carConfigInfoService.validate_cars_config(carConfigInfo); | |
| 137 | + rtn.put("status", ResponseCode.SUCCESS); | |
| 138 | + } catch (ScheduleException exp) { | |
| 139 | + rtn.put("status", ResponseCode.ERROR); | |
| 140 | + rtn.put("msg", exp.getMessage()); | |
| 141 | + } | |
| 142 | + | |
| 143 | + return rtn; | |
| 144 | + } | |
| 61 | 145 | } | ... | ... |
src/main/java/com/bsth/controller/schedule/core/EmployeeConfigInfoController.java
| 1 | 1 | package com.bsth.controller.schedule.core; |
| 2 | 2 | |
| 3 | +import com.bsth.common.Constants; | |
| 3 | 4 | import com.bsth.common.ResponseCode; |
| 4 | 5 | import com.bsth.controller.schedule.BController; |
| 5 | 6 | import com.bsth.entity.schedule.EmployeeConfigInfo; |
| 7 | +import com.bsth.entity.sys.CompanyAuthority; | |
| 6 | 8 | import com.bsth.repository.schedule.EmployeeConfigInfoRepository; |
| 7 | 9 | import com.bsth.service.schedule.EmployeeConfigInfoService; |
| 8 | 10 | import com.bsth.service.schedule.exception.ScheduleException; |
| 9 | 11 | import org.springframework.beans.factory.annotation.Autowired; |
| 10 | 12 | import org.springframework.web.bind.annotation.*; |
| 11 | 13 | |
| 14 | +import javax.servlet.http.HttpServletRequest; | |
| 15 | +import javax.servlet.http.HttpSession; | |
| 12 | 16 | import java.util.HashMap; |
| 13 | 17 | import java.util.List; |
| 14 | 18 | import java.util.Map; |
| ... | ... | @@ -91,6 +95,54 @@ public class EmployeeConfigInfoController extends BController<EmployeeConfigInfo |
| 91 | 95 | return rtn; |
| 92 | 96 | } |
| 93 | 97 | |
| 98 | + @RequestMapping(value = "/validate_jsy_gs", method = RequestMethod.GET) | |
| 99 | + public Map<String, Object> validate_jsy_gs(HttpServletRequest request, @RequestParam Map<String, Object> param) { | |
| 100 | + HttpSession session = request.getSession(); | |
| 101 | + List<CompanyAuthority> cmyAuths = (List<CompanyAuthority>) session.getAttribute(Constants.COMPANY_AUTHORITYS); | |
| 102 | + | |
| 103 | + Map<String, Object> rtn = new HashMap<>(); | |
| 104 | + try { | |
| 105 | + EmployeeConfigInfo employeeConfigInfo = new EmployeeConfigInfo( | |
| 106 | + null, | |
| 107 | + param.get("xl.id_eq"), | |
| 108 | + param.get("xl.name_eq"), | |
| 109 | + param.get("jsy.id_eq"), | |
| 110 | + null | |
| 111 | + ); | |
| 112 | + employeeConfigInfoService.validate_jsy_gs(employeeConfigInfo, cmyAuths); | |
| 113 | + rtn.put("status", ResponseCode.SUCCESS); | |
| 114 | + } catch (ScheduleException exp) { | |
| 115 | + rtn.put("status", ResponseCode.ERROR); | |
| 116 | + rtn.put("msg", exp.getMessage()); | |
| 117 | + } | |
| 118 | + | |
| 119 | + return rtn; | |
| 120 | + } | |
| 121 | + | |
| 122 | + @RequestMapping(value = "/validate_jsy_fgs", method = RequestMethod.GET) | |
| 123 | + public Map<String, Object> validate_jsy_fgs(HttpServletRequest request, @RequestParam Map<String, Object> param) { | |
| 124 | + HttpSession session = request.getSession(); | |
| 125 | + List<CompanyAuthority> cmyAuths = (List<CompanyAuthority>) session.getAttribute(Constants.COMPANY_AUTHORITYS); | |
| 126 | + | |
| 127 | + Map<String, Object> rtn = new HashMap<>(); | |
| 128 | + try { | |
| 129 | + EmployeeConfigInfo employeeConfigInfo = new EmployeeConfigInfo( | |
| 130 | + null, | |
| 131 | + param.get("xl.id_eq"), | |
| 132 | + param.get("xl.name_eq"), | |
| 133 | + param.get("jsy.id_eq"), | |
| 134 | + null | |
| 135 | + ); | |
| 136 | + employeeConfigInfoService.validate_jsy_fgs(employeeConfigInfo, cmyAuths); | |
| 137 | + rtn.put("status", ResponseCode.SUCCESS); | |
| 138 | + } catch (ScheduleException exp) { | |
| 139 | + rtn.put("status", ResponseCode.ERROR); | |
| 140 | + rtn.put("msg", exp.getMessage()); | |
| 141 | + } | |
| 142 | + | |
| 143 | + return rtn; | |
| 144 | + } | |
| 145 | + | |
| 94 | 146 | @RequestMapping(value = "/validate_spy", method = RequestMethod.GET) |
| 95 | 147 | public Map<String, Object> validate_spy(@RequestParam Map<String, Object> param) { |
| 96 | 148 | Map<String, Object> rtn = new HashMap<>(); |
| ... | ... | @@ -130,4 +182,50 @@ public class EmployeeConfigInfoController extends BController<EmployeeConfigInfo |
| 130 | 182 | } |
| 131 | 183 | return rtn; |
| 132 | 184 | } |
| 185 | + | |
| 186 | + @RequestMapping(value = "/validate_spy_gs", method = RequestMethod.GET) | |
| 187 | + public Map<String, Object> validate_spy_gs(HttpServletRequest request, @RequestParam Map<String, Object> param) { | |
| 188 | + HttpSession session = request.getSession(); | |
| 189 | + List<CompanyAuthority> cmyAuths = (List<CompanyAuthority>) session.getAttribute(Constants.COMPANY_AUTHORITYS); | |
| 190 | + | |
| 191 | + Map<String, Object> rtn = new HashMap<>(); | |
| 192 | + try { | |
| 193 | + EmployeeConfigInfo employeeConfigInfo = new EmployeeConfigInfo( | |
| 194 | + null, | |
| 195 | + param.get("xl.id_eq"), | |
| 196 | + param.get("xl.name_eq"), | |
| 197 | + null, | |
| 198 | + param.get("spy.id_eq") | |
| 199 | + ); | |
| 200 | + employeeConfigInfoService.validate_spy_gs(employeeConfigInfo, cmyAuths); | |
| 201 | + rtn.put("status", ResponseCode.SUCCESS); | |
| 202 | + } catch (ScheduleException exp) { | |
| 203 | + rtn.put("status", ResponseCode.ERROR); | |
| 204 | + rtn.put("msg", exp.getMessage()); | |
| 205 | + } | |
| 206 | + return rtn; | |
| 207 | + } | |
| 208 | + | |
| 209 | + @RequestMapping(value = "/validate_spy_fgs", method = RequestMethod.GET) | |
| 210 | + public Map<String, Object> validate_spy_fgs(HttpServletRequest request, @RequestParam Map<String, Object> param) { | |
| 211 | + HttpSession session = request.getSession(); | |
| 212 | + List<CompanyAuthority> cmyAuths = (List<CompanyAuthority>) session.getAttribute(Constants.COMPANY_AUTHORITYS); | |
| 213 | + | |
| 214 | + Map<String, Object> rtn = new HashMap<>(); | |
| 215 | + try { | |
| 216 | + EmployeeConfigInfo employeeConfigInfo = new EmployeeConfigInfo( | |
| 217 | + null, | |
| 218 | + param.get("xl.id_eq"), | |
| 219 | + param.get("xl.name_eq"), | |
| 220 | + null, | |
| 221 | + param.get("spy.id_eq") | |
| 222 | + ); | |
| 223 | + employeeConfigInfoService.validate_spy_fgs(employeeConfigInfo, cmyAuths); | |
| 224 | + rtn.put("status", ResponseCode.SUCCESS); | |
| 225 | + } catch (ScheduleException exp) { | |
| 226 | + rtn.put("status", ResponseCode.ERROR); | |
| 227 | + rtn.put("msg", exp.getMessage()); | |
| 228 | + } | |
| 229 | + return rtn; | |
| 230 | + } | |
| 133 | 231 | } | ... | ... |
src/main/java/com/bsth/controller/schedule/core/SchedulePlanController.java
| ... | ... | @@ -57,4 +57,21 @@ public class SchedulePlanController extends BController<SchedulePlan, Long> { |
| 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/data/gpsdata_v2/handlers/InStationProcess.java
| ... | ... | @@ -81,6 +81,7 @@ public class InStationProcess { |
| 81 | 81 | * @param prev |
| 82 | 82 | */ |
| 83 | 83 | private void inStation(GpsEntity gps, GpsEntity prev) { |
| 84 | + logger.info("进站记录(到达时间:" + gps.getArrTime() + " 进出站状态:" + gps.getInstation() + " 站点编号:" + gps.getStopNo() + " deviceId:" + gps.getDeviceId() + " nbbm:" + gps.getNbbm() + ")"); | |
| 84 | 85 | ScheduleRealInfo sch = dayOfSchedule.executeCurr(gps.getNbbm()); |
| 85 | 86 | boolean flow = true; |
| 86 | 87 | //要经过2个中途站才能进 |
| ... | ... | @@ -120,7 +121,7 @@ public class InStationProcess { |
| 120 | 121 | private void inEndStation(ScheduleRealInfo sch, GpsEntity gps) { |
| 121 | 122 | String nbbm = sch.getClZbh(); |
| 122 | 123 | //校验进站前置约束 |
| 123 | - if (!validInPremise(gps)) | |
| 124 | + if (!validInPremise(gps) && isNormalSch(sch)) | |
| 124 | 125 | return; |
| 125 | 126 | |
| 126 | 127 | //实达时间不覆盖 | ... | ... |
src/main/java/com/bsth/data/gpsdata_v2/handlers/OutStationProcess.java
| ... | ... | @@ -74,6 +74,7 @@ public class OutStationProcess { |
| 74 | 74 | * @param gps |
| 75 | 75 | */ |
| 76 | 76 | private void outStation(GpsEntity gps, GpsEntity prev) { |
| 77 | + logger.info("出站记录(到达时间:" + gps.getArrTime() + " 进出站状态:" + gps.getInstation() + " 站点编号:" + gps.getStopNo() + " deviceId:" + gps.getDeviceId() + " nbbm:" + gps.getNbbm() + ")"); | |
| 77 | 78 | ScheduleRealInfo sch = dayOfSchedule.executeCurr(gps.getNbbm()); |
| 78 | 79 | |
| 79 | 80 | //起点发车 | ... | ... |
src/main/java/com/bsth/data/gpsdata_v2/utils/GeoUtils.java
src/main/java/com/bsth/data/gpsdata_v2/utils/GpsDataRecovery.java
| ... | ... | @@ -84,7 +84,7 @@ public class GpsDataRecovery implements ApplicationContextAware { |
| 84 | 84 | Calendar calendar = Calendar.getInstance(); |
| 85 | 85 | int dayOfYear = calendar.get(Calendar.DAY_OF_YEAR); |
| 86 | 86 | |
| 87 | - String sql = "select DEVICE_ID,LAT,LON,TS,SPEED_GPS,LINE_ID,SERVICE_STATE,SERVER_TS from bsth_c_gps_info where days_year=39"; //+ dayOfYear; | |
| 87 | + String sql = "select DEVICE_ID,LAT,LON,TS,SPEED_GPS,LINE_ID,SERVICE_STATE,SERVER_TS from bsth_c_gps_info"; //+ dayOfYear; | |
| 88 | 88 | JdbcTemplate jdbcTemplate = new JdbcTemplate(DBUtils_MS.getDataSource()); |
| 89 | 89 | |
| 90 | 90 | List<GpsEntity> list = | ... | ... |
src/main/java/com/bsth/data/schedule/late_adjust/LateAdjustHandle.java
| ... | ... | @@ -108,6 +108,7 @@ public class LateAdjustHandle implements ApplicationContextAware { |
| 108 | 108 | try { |
| 109 | 109 | if (gps.getInstation() <= 0 || null == sch) |
| 110 | 110 | return; |
| 111 | + logger.info("carArrive id: " + sch.getId()); | |
| 111 | 112 | |
| 112 | 113 | if (!lateSchMap.containsKey(sch.getId())) { |
| 113 | 114 | //班次是否误点(可能处于误点线程扫描的空隙,所以再判定一次) | ... | ... |
src/main/java/com/bsth/data/schedule/thread/CalcOilThread.java
| ... | ... | @@ -2,13 +2,10 @@ package com.bsth.data.schedule.thread; |
| 2 | 2 | |
| 3 | 3 | import com.bsth.data.directive.DayOfDirectives; |
| 4 | 4 | import com.bsth.data.gpsdata_v2.handlers.overspeed.OverspeedProcess; |
| 5 | -import com.bsth.data.gpsdata_v2.thread.GpsDataLoaderThread; | |
| 6 | 5 | import com.bsth.service.calc.CalcWaybillService; |
| 7 | 6 | import com.bsth.service.oil.DlbService; |
| 8 | -import com.bsth.data.safe_driv.SafeDrivCenter; | |
| 9 | 7 | import com.bsth.service.oil.YlbService; |
| 10 | 8 | import com.bsth.service.report.SheetService; |
| 11 | - | |
| 12 | 9 | import org.slf4j.Logger; |
| 13 | 10 | import org.slf4j.LoggerFactory; |
| 14 | 11 | import org.springframework.beans.factory.annotation.Autowired; |
| ... | ... | @@ -60,7 +57,7 @@ public class CalcOilThread extends Thread{ |
| 60 | 57 | //清除指令数据 |
| 61 | 58 | dayOfDirectives.clearAll(); |
| 62 | 59 | //清除安全驾驶数据 |
| 63 | - SafeDrivCenter.clear(); | |
| 60 | + //SafeDrivCenter.clear(); | |
| 64 | 61 | //清除超速缓存数据 |
| 65 | 62 | OverspeedProcess.clear(); |
| 66 | 63 | ... | ... |
src/main/java/com/bsth/entity/mcy_forms/Shifday.java
| ... | ... | @@ -35,6 +35,8 @@ public class Shifday { |
| 35 | 35 | private String sjbc;//实际班次 |
| 36 | 36 | |
| 37 | 37 | private String jgh; |
| 38 | + | |
| 39 | + private String sgh; | |
| 38 | 40 | |
| 39 | 41 | private String zbh; |
| 40 | 42 | |
| ... | ... | @@ -56,6 +58,14 @@ public class Shifday { |
| 56 | 58 | this.jgh = jgh; |
| 57 | 59 | } |
| 58 | 60 | |
| 61 | + public String getSgh() { | |
| 62 | + return sgh; | |
| 63 | + } | |
| 64 | + | |
| 65 | + public void setSgh(String sgh) { | |
| 66 | + this.sgh = sgh; | |
| 67 | + } | |
| 68 | + | |
| 59 | 69 | public String getZbh() { |
| 60 | 70 | return zbh; |
| 61 | 71 | } | ... | ... |
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/filter/AccessLogFilter.java
| ... | ... | @@ -58,9 +58,11 @@ public class AccessLogFilter extends BaseFilter { |
| 58 | 58 | s.append(getBlock(params)); |
| 59 | 59 | s.append(getBlock(headers)); |
| 60 | 60 | s.append(getBlock(request.getHeader("Referer"))); |
| 61 | - | |
| 62 | - logger.info(s.toString()); | |
| 61 | + | |
| 62 | + long now = System.currentTimeMillis(); | |
| 63 | 63 | chain.doFilter(request, response); |
| 64 | + s.append("<cost time:").append(System.currentTimeMillis() - now).append(">"); | |
| 65 | + logger.info(s.toString()); | |
| 64 | 66 | } |
| 65 | 67 | |
| 66 | 68 | private static String getParams(HttpServletRequest request) { | ... | ... |
src/main/java/com/bsth/filter/BaseFilter.java
| ... | ... | @@ -17,7 +17,7 @@ public abstract class BaseFilter implements Filter { |
| 17 | 17 | * 白名单 |
| 18 | 18 | */ |
| 19 | 19 | private String[] whiteListURLs = { Constants.LOGIN_PAGE,Constants.CAPTCHA, Constants.SERVICE_INTERFACE, |
| 20 | - Constants.ASSETS_URL, Constants.FAVICON_URL, Constants.METRONIC_URL, Constants.LOGIN, Constants.LOGIN_FAILURE, Constants.UPSTREAM_URL, Constants.XD_CHILD_PAGES, Constants.XD_REAL_GPS, Constants.UP_RFID_URL, Constants.STATION_AND_SECTION_COUNT }; | |
| 20 | + Constants.ASSETS_URL, Constants.FAVICON_URL, Constants.METRONIC_URL, Constants.LOGIN, Constants.LOGIN_FAILURE, Constants.UPSTREAM_URL, Constants.XD_CHILD_PAGES, Constants.XD_REAL_GPS, Constants.UP_RFID_URL, Constants.STATION_AND_SECTION_COUNT,Constants.XIANDIAO_LOGIN ,Constants.IPAD_IMG_URL}; | |
| 21 | 21 | |
| 22 | 22 | @Override |
| 23 | 23 | public void destroy() { | ... | ... |
src/main/java/com/bsth/repository/CarDeviceRepository.java
| ... | ... | @@ -15,4 +15,10 @@ import org.springframework.stereotype.Repository; |
| 15 | 15 | public interface CarDeviceRepository extends BaseRepository<CarDevice, Long> { |
| 16 | 16 | @Query(value="select s from CarDevice s where s.newDeviceNo=?1 and s.qyrq<=?2 ") |
| 17 | 17 | List<CarDevice> findCarDevice(String device,Date date ); |
| 18 | + | |
| 19 | + @Query(value="select s from CarDevice s where s.oldDeviceNo=?1 and s.qyrq>=?2 ") | |
| 20 | + List<CarDevice> findCarOldDevice(String device,Date date ); | |
| 21 | + | |
| 22 | + @Query(value="select s from CarDevice s where s.clZbh=?1 and s.qyrq>=?2 ") | |
| 23 | + List<CarDevice> findCarCode(String code,Date date ); | |
| 18 | 24 | } | ... | ... |
src/main/java/com/bsth/repository/schedule/CarConfigInfoRepository.java
| ... | ... | @@ -50,4 +50,7 @@ public interface CarConfigInfoRepository extends BaseRepository<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<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<TTInfo, Long> { |
| 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/repository/sys/ResourceRepository.java
src/main/java/com/bsth/security/filter/LoginInterceptor.java
| ... | ... | @@ -33,7 +33,7 @@ public class LoginInterceptor implements Filter { |
| 33 | 33 | * 相比于 BaseFilter,此处对线调GPS请求进行了拦截验证 |
| 34 | 34 | */ |
| 35 | 35 | private String[] whiteListURLs = { Constants.LOGIN_PAGE,Constants.CAPTCHA, Constants.SERVICE_INTERFACE, |
| 36 | - Constants.ASSETS_URL, Constants.FAVICON_URL, Constants.METRONIC_URL, Constants.LOGIN, Constants.LOGIN_FAILURE, Constants.UPSTREAM_URL, Constants.XD_CHILD_PAGES, Constants.UP_RFID_URL,Constants.STATION_AND_SECTION_COUNT }; | |
| 36 | + Constants.ASSETS_URL, Constants.FAVICON_URL, Constants.METRONIC_URL, Constants.LOGIN, Constants.LOGIN_FAILURE, Constants.UPSTREAM_URL, Constants.XD_CHILD_PAGES, Constants.UP_RFID_URL,Constants.STATION_AND_SECTION_COUNT,Constants.XIANDIAO_LOGIN,Constants.IPAD_IMG_URL }; | |
| 37 | 37 | |
| 38 | 38 | |
| 39 | 39 | @Override | ... | ... |
src/main/java/com/bsth/service/directive/DirectiveServiceImpl.java
| ... | ... | @@ -115,7 +115,7 @@ public class DirectiveServiceImpl extends BaseServiceImpl<D60, Integer> implemen |
| 115 | 115 | //待发应到时间 |
| 116 | 116 | String dfsj = fmtHHmm.print(sch.getDfsjT() + (sch.getBcsj() * 60 * 1000)); |
| 117 | 117 | String text = "您已完成" + finish + "个班次,下一发车时间" + fmtHHmm_CN.print(sch.getDfsjT()) + ",由" |
| 118 | - + sch.getQdzName() + "发往" + sch.getZdzName() + ";应到 " + dfsj; | |
| 118 | + + sch.getQdzName() + "发往" + sch.getZdzName() + ";原计划到达时间 " + dfsj; | |
| 119 | 119 | |
| 120 | 120 | if(sch.getBcType().equals("venting")){ |
| 121 | 121 | text += " (直放)"; | ... | ... |
src/main/java/com/bsth/service/forms/impl/FormsServiceImpl.java
| ... | ... | @@ -596,7 +596,7 @@ public class FormsServiceImpl implements FormsService { |
| 596 | 596 | @Override |
| 597 | 597 | public List<Shifday> shifday(Map<String, Object> map) { |
| 598 | 598 | |
| 599 | - String line=""; | |
| 599 | + String line=""; | |
| 600 | 600 | String date=""; |
| 601 | 601 | String gsdmShif=""; |
| 602 | 602 | String fgsdmShif=""; |
| ... | ... | @@ -624,18 +624,17 @@ public class FormsServiceImpl implements FormsService { |
| 624 | 624 | if(!type.equals("") && !statue.equals("")){ |
| 625 | 625 | sql_ +=" order by "+statue+" "+type; |
| 626 | 626 | } |
| 627 | - String sql ="select t.* from (select r.schedule_date,r.j_name," | |
| 628 | - + "IFNULL(r.s_name,'')as s_name," | |
| 629 | - + " r.cl_zbh,r.xl_bm, r.j_gh,r.gs_bm,r.fgs_bm,r.lp_name " | |
| 630 | - + "FROM bsth_c_s_sp_info_real r where 1=1 " | |
| 631 | - + " and r.schedule_date_str='"+date + "' " | |
| 627 | + String sql ="select t.* from (select r.schedule_date," | |
| 628 | + + " IFNULL(r.s_gh,'')as s_gh,r.cl_zbh," | |
| 629 | + + " r.xl_bm,r.j_gh,r.gs_bm,r.fgs_bm,r.lp_name" | |
| 630 | + + " FROM bsth_c_s_sp_info_real r where 1=1 " | |
| 631 | + + " and r.schedule_date_str='"+date + "' " | |
| 632 | 632 | + " and r.xl_bm = '"+line+"' " |
| 633 | 633 | + " and r.gs_bm like '%"+gsdmShif+"%' " |
| 634 | - + " and r.fgs_bm like '%"+fgsdmShif+"%' ) t" | |
| 635 | - + " GROUP BY t.schedule_date,t.j_name,t.s_name, " | |
| 636 | - + "t.cl_zbh,t.xl_bm,t.j_gh,t.gs_bm,t.fgs_bm,t.lp_name " | |
| 637 | - + sql_; | |
| 638 | - | |
| 634 | + + " and r.fgs_bm like '%"+fgsdmShif+"%' "+sql_+") t" | |
| 635 | + + " GROUP BY t.schedule_date,t.xl_bm,t.cl_zbh,t.lp_name," | |
| 636 | + + " t.j_gh,t.s_gh,t.gs_bm,t.fgs_bm "; | |
| 637 | + | |
| 639 | 638 | |
| 640 | 639 | List<Shifday> list = jdbcTemplate.query(sql, new RowMapper<Shifday>() { |
| 641 | 640 | |
| ... | ... | @@ -643,15 +642,16 @@ public class FormsServiceImpl implements FormsService { |
| 643 | 642 | public Shifday mapRow(ResultSet arg0, int arg1) throws SQLException { |
| 644 | 643 | Shifday shifday = new Shifday(); |
| 645 | 644 | shifday.setRq(arg0.getString("schedule_date")); |
| 646 | - shifday.setjName(arg0.getString("j_name").toString()); | |
| 647 | - shifday.setsName(arg0.getString("s_name") == null ? "" : arg0.getString("s_name").toString()); | |
| 645 | +// shifday.setjName(arg0.getString("j_name").toString()); | |
| 646 | +// shifday.setsName(arg0.getString("s_name") == null ? "" : arg0.getString("s_name").toString()); | |
| 648 | 647 | shifday.setCarPlate(arg0.getString("cl_zbh").toString()); |
| 649 | 648 | shifday.setJgh(arg0.getString("j_gh")); |
| 649 | + shifday.setSgh(arg0.getString("s_gh") == null ? "" : arg0.getString("s_gh").toString()); | |
| 650 | 650 | shifday.setLpName(arg0.getString("lp_name")== null ? "" : arg0.getString("lp_name").toString()); |
| 651 | 651 | return shifday; |
| 652 | 652 | } |
| 653 | - | |
| 654 | 653 | }); |
| 654 | + | |
| 655 | 655 | List<ScheduleRealInfo> sList; |
| 656 | 656 | List<ScheduleRealInfo> list_s; |
| 657 | 657 | List<ScheduleRealInfo> lists=scheduleRealInfoRepository.scheduleByDateAndLineTjrb(map.get("line").toString(), map.get("date").toString()); |
| ... | ... | @@ -661,8 +661,9 @@ public class FormsServiceImpl implements FormsService { |
| 661 | 661 | Shifday d=list.get(i); |
| 662 | 662 | for (int j = 0; j < lists.size(); j++) { |
| 663 | 663 | ScheduleRealInfo s=lists.get(j); |
| 664 | - if(d.getJgh().equals(s.getjGh()) && d.getCarPlate().equals(s.getClZbh()) | |
| 665 | - &&d.getLpName().equals(s.getLpName())){ | |
| 664 | + if(d.getJgh().equals(s.getjGh()) && d.getSgh().equals(s.getsGh()) | |
| 665 | + && d.getCarPlate().equals(s.getClZbh()) | |
| 666 | + && d.getLpName().equals(s.getLpName())){ | |
| 666 | 667 | sList.add(s); |
| 667 | 668 | Set<ChildTaskPlan> cts = s.getcTasks(); |
| 668 | 669 | if(cts != null && cts.size() > 0){ |
| ... | ... | @@ -674,7 +675,10 @@ public class FormsServiceImpl implements FormsService { |
| 674 | 675 | } |
| 675 | 676 | } |
| 676 | 677 | } |
| 677 | - | |
| 678 | + if(sList.size()>0){ | |
| 679 | + d.setjName(sList.get(0).getjName()); | |
| 680 | + d.setsName(sList.get(0).getsName() == null ? "":sList.get(0).getsName()); | |
| 681 | + } | |
| 678 | 682 | double ksgl=culateMileageService.culateKsgl(list_s); |
| 679 | 683 | double jccgl=culateMileageService.culateJccgl(list_s); |
| 680 | 684 | double zksgl=Arith.add(ksgl, jccgl); |
| ... | ... | @@ -893,7 +897,8 @@ public class FormsServiceImpl implements FormsService { |
| 893 | 897 | if(fgsdm.length() != 0){ |
| 894 | 898 | sql += " and r.fgs_bm ='"+fgsdm+"'"; |
| 895 | 899 | } |
| 896 | - sql += " group by r.j_gh,r.xl_bm,r.cl_zbh,r.j_name order by r.xl_bm,r.cl_zbh"; | |
| 900 | + sql += " group by r.fgs_bm,r.j_gh,r.xl_bm,r.cl_zbh,r.j_name " + | |
| 901 | + "order by r.xl_bm,r.cl_zbh"; | |
| 897 | 902 | |
| 898 | 903 | list = jdbcTemplate.query(sql, new RowMapper<Singledata>() { |
| 899 | 904 | @Override |
| ... | ... | @@ -924,7 +929,7 @@ public class FormsServiceImpl implements FormsService { |
| 924 | 929 | + " WHERE rq = '"+startDate+"'" |
| 925 | 930 | + linesql |
| 926 | 931 | + " union" |
| 927 | - + " SELECT id,xlbm,nbbm,jsy,cdl as jzl,hd as yh,sh as sh,fgsdm FROM bsth_c_dlb" | |
| 932 | + + " SELECT id,xlbm,nbbm,jsy,cdl as jzl,hd as yh,sh as sh,fgsdm FROM bsth_c_dlb" | |
| 928 | 933 | + " WHERE rq = '"+startDate+"'" |
| 929 | 934 | + linesql; |
| 930 | 935 | List<Singledata> listNy = jdbcTemplate.query(nysql, new RowMapper<Singledata>() { | ... | ... |
src/main/java/com/bsth/service/impl/BusIntervalServiceImpl.java
| ... | ... | @@ -400,7 +400,7 @@ public class BusIntervalServiceImpl implements BusIntervalService { |
| 400 | 400 | sql += " and cl.line_code = '"+line+"'"; |
| 401 | 401 | if(ttId.length() != 0) |
| 402 | 402 | sql += " and td.ttinfo = '"+ttId+"'"; |
| 403 | - sql += " group by td.lp"; | |
| 403 | + sql += " group by td.lp, lp.lp_name"; | |
| 404 | 404 | |
| 405 | 405 | list = jdbcTemplate.query(sql, |
| 406 | 406 | new RowMapper<Map<String, Object>>(){ | ... | ... |
src/main/java/com/bsth/service/impl/TrafficManageServiceImpl.java
| ... | ... | @@ -945,11 +945,11 @@ public class TrafficManageServiceImpl implements TrafficManageService{ |
| 945 | 945 | */ |
| 946 | 946 | @Override |
| 947 | 947 | public String setSKB(String ids) { |
| 948 | - String result = "failure"; | |
| 948 | + String result = "上传失败,"; | |
| 949 | 949 | StringBuffer sBuffer = new StringBuffer(); |
| 950 | 950 | DecimalFormat df = new DecimalFormat("######0.000"); |
| 951 | - Map<String,String> lsStationCode2NameMap; | |
| 952 | - Map<String, Integer> lsStationName2YgcNumber; | |
| 951 | + Map<String,String> lsStationCode2NameMap = null; | |
| 952 | + Map<String, Integer> lsStationName2YgcNumber = null; | |
| 953 | 953 | try { |
| 954 | 954 | String[] idArray = ids.split(","); |
| 955 | 955 | StringBuffer sBufferA ,sBufferB ,sBufferC ; |
| ... | ... | @@ -965,14 +965,21 @@ public class TrafficManageServiceImpl implements TrafficManageService{ |
| 965 | 965 | sBuffer.append("<SKBs>"); |
| 966 | 966 | HashMap<String,String> paramMap; |
| 967 | 967 | HashMap<String,String> otherMap = new HashMap<>(); |
| 968 | + // 线路编码、周几执行、发车站点名称、发车站点序号、到达站点名称、到达站点序号 | |
| 969 | + String xlbm,zjzx,fczdmc,zdxh,ddzdmc,ddxh; | |
| 970 | + // 得到时刻表版本号 | |
| 971 | + int lineVersion; | |
| 972 | + long ttinfoId; | |
| 973 | + // 是否输出站点信息 | |
| 974 | + boolean isLogStation; | |
| 968 | 975 | for (int i = 0; i < idArray.length; i++) { |
| 969 | - long ttinfoId = Long.valueOf(idArray[i]); | |
| 976 | + ttinfoId = Long.valueOf(idArray[i]); | |
| 970 | 977 | ttInfo = ttInfoRepository.findOne(ttinfoId); |
| 971 | 978 | if(ttInfo == null) |
| 972 | 979 | continue; |
| 973 | 980 | ttinfoList.add(ttInfo); // 保存时刻表 |
| 974 | 981 | // 得到时刻表版本号 |
| 975 | - int lineVersion = ttInfo.getLineVersion(); | |
| 982 | + lineVersion = ttInfo.getLineVersion(); | |
| 976 | 983 | // 查询历史站点路由 |
| 977 | 984 | lsStationCode2NameMap = getLsStationCode(ttInfo.getXl().getLineCode(),lineVersion); |
| 978 | 985 | // 查询历史站点路由 |
| ... | ... | @@ -988,16 +995,35 @@ public class TrafficManageServiceImpl implements TrafficManageService{ |
| 988 | 995 | param = new HashMap(); |
| 989 | 996 | param.put("line.id_eq", ttInfo.getXl().getId()); |
| 990 | 997 | lineInformation = lineInformationRepository.findOne(new CustomerSpecs<LineInformation>(param)); |
| 998 | + // 初始化 | |
| 999 | + isLogStation = true; | |
| 991 | 1000 | if(ttInfoDetailIterator.hasNext()){ |
| 1001 | + // 得到线路信息 | |
| 1002 | + Line line = lineRepository.findOne(ttInfo.getXl().getId()); | |
| 1003 | + if(line == null){ | |
| 1004 | + result += "未找到相应的线路信息,请设置线路信息后再上传"; | |
| 1005 | + return result; | |
| 1006 | + } | |
| 1007 | + // 得到上海市线路编码 | |
| 1008 | + xlbm = line.getShanghaiLinecode(); | |
| 1009 | + if("".equals(xlbm) || "null".equals(xlbm)){ | |
| 1010 | + result += "线路编码为空,请设置线路编码后再上传"; | |
| 1011 | + return result; | |
| 1012 | + } | |
| 1013 | + // 拿到周几执行 | |
| 1014 | + zjzx = changeRuleDay(ttInfo.getRule_days()); | |
| 1015 | + if("".equals(zjzx) || "null".equals(zjzx)){ | |
| 1016 | + result += "时刻表执行时间为空,请设置执行时间后再上传"; | |
| 1017 | + return result; | |
| 1018 | + } | |
| 992 | 1019 | sBuffer.append("<SKB>"); |
| 993 | - sBuffer.append("<XLBM>").append(BasicData.lineId2ShangHaiCodeMap.get(ttInfo.getXl().getId())) | |
| 994 | - .append("</XLBM>"); | |
| 1020 | + sBuffer.append("<XLBM>").append(xlbm).append("</XLBM>"); | |
| 995 | 1021 | sBufferB = new StringBuffer(); |
| 996 | 1022 | sBufferC = new StringBuffer(); |
| 997 | 1023 | sBufferB.append("<KSRQ>").append(sdfnyr.format(ttInfo.getQyrq())).append("</KSRQ>"); |
| 998 | 1024 | // 结束日期暂时不要,节假日的班次表才需要,如春节的班次表 |
| 999 | 1025 | sBufferB.append("<JSRQ>").append("").append("</JSRQ>"); |
| 1000 | - sBufferB.append("<ZJZX>").append(changeRuleDay(ttInfo.getRule_days())).append("</ZJZX>"); | |
| 1026 | + sBufferB.append("<ZJZX>").append(zjzx).append("</ZJZX>"); | |
| 1001 | 1027 | sBufferB.append("<TBYY>").append("").append("</TBYY>"); |
| 1002 | 1028 | sBufferB.append("<UPDT>").append(sdfnyrsfm.format(new Date())).append("</UPDT>"); |
| 1003 | 1029 | sBufferB.append("<BCList>"); |
| ... | ... | @@ -1021,22 +1047,51 @@ public class TrafficManageServiceImpl implements TrafficManageService{ |
| 1021 | 1047 | if(changeTimeFormat(ttInfoDetail) == null){ |
| 1022 | 1048 | continue; |
| 1023 | 1049 | } |
| 1050 | + // 发生站点名称 | |
| 1051 | + fczdmc = lsStationCode2NameMap.get(ttInfoDetail.getXl().getLineCode()+"_"+ttInfoDetail.getXlDir()+"_"+ttInfoDetail.getQdzCode()); | |
| 1052 | + if("".equals(fczdmc) || "null".equals(fczdmc)){ | |
| 1053 | + result += "发车站点名称为空,请根据时刻表当前的版本号设置好历史站点路由再上传"; | |
| 1054 | + return result; | |
| 1055 | + } | |
| 1024 | 1056 | sBufferC.append("<BC>"); |
| 1025 | 1057 | sBufferC.append("<LPBH>").append(ttInfoDetail.getLp().getLpNo()).append("</LPBH>"); |
| 1026 | 1058 | sBufferC.append("<SXX>").append(sxx).append("</SXX>"); |
| 1027 | - sBufferC.append("<FCZDMC>").append(lsStationCode2NameMap.get(ttInfoDetail.getXl().getLineCode()+"_"+ttInfoDetail.getXlDir() | |
| 1028 | - +"_"+ttInfoDetail.getQdzCode())).append("</FCZDMC>"); | |
| 1059 | + sBufferC.append("<FCZDMC>").append(fczdmc).append("</FCZDMC>"); | |
| 1029 | 1060 | // 起点站的参数 |
| 1030 | 1061 | otherMap.put("stationMark","B"); |
| 1031 | 1062 | paramMap = packageYgcStationNumParam(ttInfoDetail,otherMap); |
| 1032 | - sBufferC.append("<ZDXH>").append(getYgcStationNumByLineCodeAndDirectionAndStationName(paramMap,lsStationName2YgcNumber)).append("</ZDXH>"); | |
| 1063 | + if(isLogStation){// 输出起点站信息 | |
| 1064 | + logger.info("setSKB:"+"起点站信息:"+paramMap); | |
| 1065 | + } | |
| 1066 | + // 发车站点序号 | |
| 1067 | + zdxh = String.valueOf(getYgcStationNumByLineCodeAndDirectionAndStationName(paramMap,lsStationName2YgcNumber)); | |
| 1068 | + if("".equals(zdxh) || "null".equals(zdxh) || "0".equals(zdxh)){ | |
| 1069 | + result += "发车站点序号为空,请根据时刻表当前的版本号设置好历史站点路由再上传"; | |
| 1070 | + return result; | |
| 1071 | + } | |
| 1072 | + // 到达站点名称 | |
| 1073 | + ddzdmc = lsStationCode2NameMap.get(ttInfoDetail.getXl().getLineCode()+"_"+ttInfoDetail.getXlDir()+"_"+ttInfoDetail.getZdzCode()); | |
| 1074 | + if("".equals(ddzdmc) || "null".equals(ddzdmc)){ | |
| 1075 | + result += "到达站点名称为空,请根据时刻表当前的版本号设置好历史站点路由再上传"; | |
| 1076 | + return result; | |
| 1077 | + } | |
| 1078 | + sBufferC.append("<ZDXH>").append(zdxh).append("</ZDXH>"); | |
| 1033 | 1079 | sBufferC.append("<JHFCSJ>").append(changeTimeFormat(ttInfoDetail)).append("</JHFCSJ>"); |
| 1034 | - sBufferC.append("<DDZDMC>").append(lsStationCode2NameMap.get(ttInfoDetail.getXl().getLineCode()+"_"+ttInfoDetail.getXlDir() | |
| 1035 | - +"_"+ttInfoDetail.getZdzCode())).append("</DDZDMC>"); | |
| 1036 | - // 起点站的参数 | |
| 1080 | + sBufferC.append("<DDZDMC>").append(ddzdmc).append("</DDZDMC>"); | |
| 1081 | + // 终点站的参数 | |
| 1037 | 1082 | otherMap.put("stationMark","E"); |
| 1038 | 1083 | paramMap = packageYgcStationNumParam(ttInfoDetail,otherMap); |
| 1039 | - sBufferC.append("<DDXH>").append(getYgcStationNumByLineCodeAndDirectionAndStationName(paramMap,lsStationName2YgcNumber)).append("</DDXH>"); | |
| 1084 | + if(isLogStation){// 输出终点站信息 | |
| 1085 | + logger.info("setSKB:"+"终点站信息:"+paramMap); | |
| 1086 | + } | |
| 1087 | + // 到达站点序号 | |
| 1088 | + ddxh = String.valueOf(getYgcStationNumByLineCodeAndDirectionAndStationName(paramMap,lsStationName2YgcNumber)); | |
| 1089 | + if("".equals(ddxh) || "null".equals(ddxh) || "0".equals(ddxh)){ | |
| 1090 | + result += "到达站点序号为空,请根据时刻表当前的版本号设置好历史站点路由再上传"; | |
| 1091 | + return result; | |
| 1092 | + } | |
| 1093 | + isLogStation = false; // 一条线路只输出一次,后面的不输出了 | |
| 1094 | + sBufferC.append("<DDXH>").append(ddxh).append("</DDXH>"); | |
| 1040 | 1095 | sBufferC.append("<JHDDSJ>").append(calcDdsj(ttInfoDetail.getFcsj(),ttInfoDetail.getBcsj())).append("</JHDDSJ>"); |
| 1041 | 1096 | sBufferC.append("</BC>"); |
| 1042 | 1097 | // 0:上行;1:下行 |
| ... | ... | @@ -1055,10 +1110,11 @@ public class TrafficManageServiceImpl implements TrafficManageService{ |
| 1055 | 1110 | sBufferA.append("<JHYYLC>").append(df.format(yylc)).append("</JHYYLC>"); |
| 1056 | 1111 | sBuffer.append(sBufferA).append(sBufferB).append(sBufferC); |
| 1057 | 1112 | } |
| 1113 | + logger.info("setSKB:"+"ttinfoId:"+ttinfoId+";当前站点版本号:"+lineVersion+";查询历史站点路由:"+lsStationCode2NameMap+";查询历史站点编号:"+lsStationName2YgcNumber); | |
| 1058 | 1114 | } |
| 1059 | 1115 | sBuffer.append("</SKBs>"); |
| 1060 | 1116 | if(ssop.setSKB(userNameOther, passwordOther, sBuffer.toString()).isSuccess()){ |
| 1061 | - result = "success"; | |
| 1117 | + result = "上传成功"; | |
| 1062 | 1118 | SKBUploadLogger skbUploadLogger ; |
| 1063 | 1119 | SysUser user = SecurityUtils.getCurrentUser(); |
| 1064 | 1120 | // 保存时刻表上传记录 | ... | ... |
src/main/java/com/bsth/service/realcontrol/ScheduleRealInfoService.java
| ... | ... | @@ -132,8 +132,8 @@ public interface ScheduleRealInfoService extends BaseService<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
| ... | ... | @@ -611,111 +611,119 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl<ScheduleRealInf |
| 611 | 611 | * 临加班次 |
| 612 | 612 | */ |
| 613 | 613 | @Override |
| 614 | - public Map<String, Object> save(ScheduleRealInfo t) { | |
| 614 | + public Map<String, Object> save(ScheduleRealInfo sch) { | |
| 615 | 615 | Map<String, Object> rs = new HashMap<>(); |
| 616 | 616 | try { |
| 617 | - if (!carExist(t.getGsBm(), t.getClZbh())) { | |
| 618 | - rs.put("msg", "车辆 " + t.getClZbh() + " <a href=\"/#/busInfoManage\" target=_blank>车辆基础信息</a> 里找不到!"); | |
| 619 | - rs.put("status", ResponseCode.ERROR); | |
| 620 | - return rs; | |
| 617 | + String clZbh = sch.getClZbh(); | |
| 618 | + if (StringUtils.isNotEmpty(clZbh)) { | |
| 619 | + //检测 | |
| 620 | + if (!carExist(sch.getGsBm(), clZbh)) { | |
| 621 | + rs.put("status", ResponseCode.ERROR); | |
| 622 | + rs.put("msg", "车辆 " + clZbh + " 不存在!"); | |
| 623 | + return rs; | |
| 624 | + } else if (!sch.getGsBm().equals(BasicData.nbbm2CompanyCodeMap.get(clZbh))) { | |
| 625 | + rs.put("status", ResponseCode.ERROR); | |
| 626 | + rs.put("msg", sch.getXlName() + "所属的公司编码下找不到自编号为【" + clZbh + "】的车辆"); | |
| 627 | + return rs; | |
| 628 | + } | |
| 621 | 629 | } |
| 622 | 630 | |
| 623 | 631 | SysUser user = SecurityUtils.getCurrentUser(); |
| 624 | - String schDate = DayOfSchedule.currSchDateMap.get(t.getXlBm()); | |
| 632 | + String schDate = DayOfSchedule.currSchDateMap.get(sch.getXlBm()); | |
| 625 | 633 | |
| 626 | 634 | SimpleDateFormat sdfyyyyMMdd = new SimpleDateFormat("yyyy-MM-dd"), sdfyyyyMMddHHmm = new SimpleDateFormat("yyyy-MM-ddHH:mm"); |
| 627 | 635 | |
| 628 | - if (StringUtils.isEmpty(t.getjGh())) { | |
| 636 | + if (StringUtils.isEmpty(sch.getjGh())) { | |
| 629 | 637 | rs.put("status", ResponseCode.ERROR); |
| 630 | 638 | rs.put("msg", "驾驶员工号不能为空!"); |
| 631 | 639 | return rs; |
| 632 | 640 | } |
| 633 | 641 | //截取驾驶员工号 |
| 634 | - if (t.getjGh().indexOf("-") != -1) { | |
| 635 | - t.setjGh(t.getjGh().split("-")[1]); | |
| 642 | + if (sch.getjGh().indexOf("-") != -1) { | |
| 643 | + sch.setjGh(sch.getjGh().split("-")[1]); | |
| 636 | 644 | } |
| 637 | 645 | //检查驾驶员工号 |
| 638 | - String jName = getPersonName(t.getGsBm(), t.getjGh()); | |
| 646 | + String jName = getPersonName(sch.getGsBm(), sch.getjGh()); | |
| 639 | 647 | if (StringUtils.isEmpty(jName)) { |
| 640 | - rs.put("msg", t.getXlName() + "所属的公司编码下找不到工号为【" + t.getjGh() + "】的驾驶员"); | |
| 648 | + rs.put("msg", sch.getXlName() + "所属的公司编码下找不到工号为【" + sch.getjGh() + "】的驾驶员"); | |
| 641 | 649 | rs.put("status", ResponseCode.ERROR); |
| 642 | 650 | return rs; |
| 643 | - } else if (StringUtils.isEmpty(t.getjName())) { | |
| 644 | - t.setjName(jName);//补上驾驶员名称 | |
| 651 | + } else if (StringUtils.isEmpty(sch.getjName())) { | |
| 652 | + sch.setjName(jName);//补上驾驶员名称 | |
| 645 | 653 | } |
| 646 | 654 | |
| 647 | 655 | //有售票员 |
| 648 | - if (StringUtils.isNotEmpty(t.getsGh())) { | |
| 649 | - String sName = getPersonName(t.getGsBm(), t.getsGh()); | |
| 656 | + if (StringUtils.isNotEmpty(sch.getsGh())) { | |
| 657 | + String sName = getPersonName(sch.getGsBm(), sch.getsGh()); | |
| 650 | 658 | if (StringUtils.isEmpty(sName)) { |
| 651 | - rs.put("msg", t.getXlName() + "所属的公司编码下找不到工号为【" + t.getjGh() + "】的售票员"); | |
| 659 | + rs.put("msg", sch.getXlName() + "所属的公司编码下找不到工号为【" + sch.getjGh() + "】的售票员"); | |
| 652 | 660 | rs.put("status", ResponseCode.ERROR); |
| 653 | 661 | return rs; |
| 654 | - } else if (StringUtils.isEmpty(t.getsName())) { | |
| 655 | - t.setsName(sName);//补上售票员名称 | |
| 662 | + } else if (StringUtils.isEmpty(sch.getsName())) { | |
| 663 | + sch.setsName(sName);//补上售票员名称 | |
| 656 | 664 | } |
| 657 | 665 | } else { |
| 658 | - t.setsGh(""); | |
| 659 | - t.setsName(""); | |
| 666 | + sch.setsGh(""); | |
| 667 | + sch.setsName(""); | |
| 660 | 668 | } |
| 661 | 669 | |
| 662 | 670 | //公司 和 分公司名称 |
| 663 | - t.setGsName(BasicData.businessCodeNameMap.get(t.getGsBm())); | |
| 664 | - t.setFgsName(BasicData.businessFgsCodeNameMap.get(t.getFgsBm() + "_" + t.getGsBm())); | |
| 665 | - t.setCreateDate(new Date()); | |
| 666 | - t.setScheduleDateStr(schDate); | |
| 667 | - t.setScheduleDate(sdfyyyyMMdd.parse(schDate)); | |
| 668 | - t.setRealExecDate(schDate); | |
| 669 | - | |
| 670 | - t.setCreateBy(user); | |
| 671 | - t.setSflj(true); | |
| 672 | - t.setLate(false); | |
| 673 | - t.setDfsj(t.getFcsj()); | |
| 674 | - t.setZdsjT(sdfyyyyMMddHHmm.parse(schDate + t.getZdsj()).getTime()); | |
| 675 | - t.setJhlcOrig(t.getJhlc()); | |
| 676 | - t.setCreateDate(new Date()); | |
| 677 | - t.setUpdateDate(new Date()); | |
| 678 | - t.setSpId(-1L); | |
| 671 | + sch.setGsName(BasicData.businessCodeNameMap.get(sch.getGsBm())); | |
| 672 | + sch.setFgsName(BasicData.businessFgsCodeNameMap.get(sch.getFgsBm() + "_" + sch.getGsBm())); | |
| 673 | + sch.setCreateDate(new Date()); | |
| 674 | + sch.setScheduleDateStr(schDate); | |
| 675 | + sch.setScheduleDate(sdfyyyyMMdd.parse(schDate)); | |
| 676 | + sch.setRealExecDate(schDate); | |
| 677 | + | |
| 678 | + sch.setCreateBy(user); | |
| 679 | + sch.setSflj(true); | |
| 680 | + sch.setLate(false); | |
| 681 | + sch.setDfsj(sch.getFcsj()); | |
| 682 | + sch.setZdsjT(sdfyyyyMMddHHmm.parse(schDate + sch.getZdsj()).getTime()); | |
| 683 | + sch.setJhlcOrig(sch.getJhlc()); | |
| 684 | + sch.setCreateDate(new Date()); | |
| 685 | + sch.setUpdateDate(new Date()); | |
| 686 | + sch.setSpId(-1L); | |
| 679 | 687 | //起终点名称 |
| 680 | - String prefix = t.getXlBm() + "_" + t.getXlDir() + "_"; | |
| 681 | - t.setQdzName(BasicData.getStationNameByCode(t.getQdzCode(), prefix)); | |
| 682 | - t.setZdzName(BasicData.getStationNameByCode(t.getZdzCode(), prefix)); | |
| 688 | + String prefix = sch.getXlBm() + "_" + sch.getXlDir() + "_"; | |
| 689 | + sch.setQdzName(BasicData.getStationNameByCode(sch.getQdzCode(), prefix)); | |
| 690 | + sch.setZdzName(BasicData.getStationNameByCode(sch.getZdzCode(), prefix)); | |
| 683 | 691 | |
| 684 | 692 | //计算班次实际执行时间 |
| 685 | - schAttrCalculator.calcRealDate(t).calcAllTimeByFcsj(t); | |
| 693 | + schAttrCalculator.calcRealDate(sch).calcAllTimeByFcsj(sch); | |
| 686 | 694 | |
| 687 | 695 | //处理计达跨24点 |
| 688 | - LineConfig conf = lineConfigData.get(t.getXlBm()); | |
| 689 | - if (t.getZdsj().compareTo(conf.getStartOpt()) < 0) { | |
| 690 | - t.setZdsjT(sdfyyyyMMddHHmm.parse(t.getScheduleDateStr() + t.getZdsj()).getTime() + (1000 * 60 * 60 * 24)); | |
| 696 | + LineConfig conf = lineConfigData.get(sch.getXlBm()); | |
| 697 | + if (sch.getZdsj().compareTo(conf.getStartOpt()) < 0) { | |
| 698 | + sch.setZdsjT(sdfyyyyMMddHHmm.parse(sch.getScheduleDateStr() + sch.getZdsj()).getTime() + (1000 * 60 * 60 * 24)); | |
| 691 | 699 | } |
| 692 | 700 | |
| 693 | 701 | //班次历时 |
| 694 | - t.setBcsj((int) ((t.getZdsjT() - t.getDfsjT()) / 1000 / 60)); | |
| 695 | - if (t.getZdsjT() < t.getFcsjT()) { | |
| 702 | + sch.setBcsj((int) ((sch.getZdsjT() - sch.getDfsjT()) / 1000 / 60)); | |
| 703 | + if (sch.getZdsjT() < sch.getFcsjT()) { | |
| 696 | 704 | rs.put("status", ResponseCode.ERROR); |
| 697 | 705 | rs.put("msg", "起终点时间异常!"); |
| 698 | 706 | return rs; |
| 699 | 707 | } |
| 700 | 708 | |
| 701 | - t.setId(dayOfSchedule.getId()); | |
| 709 | + sch.setId(dayOfSchedule.getId()); | |
| 702 | 710 | //实时入库 |
| 703 | - super.save(t); | |
| 711 | + super.save(sch); | |
| 704 | 712 | |
| 705 | 713 | // 加入缓存 |
| 706 | - dayOfSchedule.put(t); | |
| 714 | + dayOfSchedule.put(sch); | |
| 707 | 715 | |
| 708 | 716 | //更新起点应到时间 |
| 709 | - List<ScheduleRealInfo> ts = dayOfSchedule.updateQdzTimePlan(t); | |
| 717 | + List<ScheduleRealInfo> ts = dayOfSchedule.updateQdzTimePlan(sch); | |
| 710 | 718 | |
| 711 | 719 | //重新计算车辆当前执行班次 |
| 712 | - dayOfSchedule.reCalcExecPlan(t.getClZbh()); | |
| 720 | + dayOfSchedule.reCalcExecPlan(sch.getClZbh()); | |
| 713 | 721 | |
| 714 | 722 | //记录站到场历时数据 |
| 715 | - Station2ParkBuffer.put(t); | |
| 723 | + Station2ParkBuffer.put(sch); | |
| 716 | 724 | |
| 717 | 725 | rs.put("ts", ts); |
| 718 | - rs.put("t", t); | |
| 726 | + rs.put("t", sch); | |
| 719 | 727 | } catch (Exception e) { |
| 720 | 728 | logger.error("", e); |
| 721 | 729 | rs.put("status", ResponseCode.ERROR); |
| ... | ... | @@ -1210,34 +1218,73 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl<ScheduleRealInf |
| 1210 | 1218 | |
| 1211 | 1219 | } |
| 1212 | 1220 | String device = ""; |
| 1221 | + String device2 =""; | |
| 1222 | + long qyrqTime=0l; | |
| 1213 | 1223 | if (!code.equals("")) { |
| 1214 | - device = BasicData.deviceId2NbbmMap.inverse().get(code); | |
| 1224 | + try { | |
| 1225 | + List<CarDevice> deviceList=carDeviceRepository.findCarCode(code, sdf.parse(date+ " 00:00:00")); | |
| 1226 | + if(deviceList.size()>0){ | |
| 1227 | + device=deviceList.get(0).getOldDeviceNo(); | |
| 1228 | + Date qyrq=deviceList.get(0).getQyrq(); | |
| 1229 | + qyrqTime=qyrq.getTime(); | |
| 1230 | + if(qyrqTime<t){ | |
| 1231 | + device2=deviceList.get(0).getNewDeviceNo(); | |
| 1232 | + } | |
| 1233 | + }else{ | |
| 1234 | + device = BasicData.deviceId2NbbmMap.inverse().get(code); | |
| 1235 | + } | |
| 1236 | + } catch (ParseException e) { | |
| 1237 | + // TODO Auto-generated catch block | |
| 1238 | + e.printStackTrace(); | |
| 1239 | + } | |
| 1215 | 1240 | } |
| 1216 | - List<Object[]> list = scheduleRealInfoRepository.historyMessage(line, d, t, device); | |
| 1217 | - for (Object[] obj : list) { | |
| 1241 | + List<Object[]> list=new ArrayList<Object[]>(); | |
| 1242 | + | |
| 1243 | + List<Object[]> list0 =scheduleRealInfoRepository.historyMessage(line, d, t, device); | |
| 1244 | + for (Object[] obj : list0) { | |
| 1218 | 1245 | if (obj != null) { |
| 1219 | - | |
| 1220 | - if (BasicData.deviceId2NbbmMap.get(obj[0].toString()) == null) { | |
| 1221 | - List<CarDevice> carDeviceList = new ArrayList<CarDevice>(); | |
| 1222 | - try { | |
| 1223 | - carDeviceList = carDeviceRepository.findCarDevice(obj[0].toString(), new Date(Long.parseLong(obj[3].toString()))); | |
| 1224 | - } catch (Exception e) { | |
| 1225 | - // TODO Auto-generated catch block | |
| 1226 | - e.printStackTrace(); | |
| 1227 | - } | |
| 1228 | - if (carDeviceList.size() > 0) { | |
| 1229 | - obj[0] = carDeviceList.get(0).getClZbh(); | |
| 1246 | + if(code.equals("")){ | |
| 1247 | + if (BasicData.deviceId2NbbmMap.get(obj[0].toString()) == null) { | |
| 1248 | + List<CarDevice> carDeviceList = new ArrayList<CarDevice>(); | |
| 1249 | + try { | |
| 1250 | + carDeviceList = carDeviceRepository.findCarDevice(obj[0].toString(), new Date(Long.parseLong(obj[3].toString()))); | |
| 1251 | + //启用日期大于营运日期 还是根据旧设备号查询 | |
| 1252 | + if(carDeviceList.size()==0){ | |
| 1253 | + carDeviceList = carDeviceRepository.findCarOldDevice(obj[0].toString(), new Date(Long.parseLong(obj[3].toString()))); | |
| 1254 | + } | |
| 1255 | + } catch (Exception e) { | |
| 1256 | + // TODO Auto-generated catch block | |
| 1257 | + e.printStackTrace(); | |
| 1258 | + } | |
| 1259 | + if (carDeviceList.size() > 0) { | |
| 1260 | + obj[0] = carDeviceList.get(0).getClZbh(); | |
| 1261 | + } else { | |
| 1262 | + obj[0] = BasicData.deviceId2NbbmMap.get(obj[0].toString()); | |
| 1263 | + } | |
| 1230 | 1264 | } else { |
| 1231 | 1265 | obj[0] = BasicData.deviceId2NbbmMap.get(obj[0].toString()); |
| 1232 | 1266 | } |
| 1233 | - } else { | |
| 1234 | - obj[0] = BasicData.deviceId2NbbmMap.get(obj[0].toString()); | |
| 1235 | - } | |
| 1267 | + }else{ | |
| 1268 | + obj[0]=code; | |
| 1269 | + } | |
| 1270 | + | |
| 1236 | 1271 | obj[3] = sdf.format(new Date(Long.parseLong(obj[3].toString()))); |
| 1237 | 1272 | obj[4] = BasicData.lineCode2NameMap.get(line); |
| 1238 | 1273 | } |
| 1239 | 1274 | } |
| 1240 | - | |
| 1275 | + list.addAll(list0); | |
| 1276 | + if(!device2.equals("")){ | |
| 1277 | + List<Object[]> list1 =scheduleRealInfoRepository.historyMessage(line, d, t, device2); | |
| 1278 | + for (Object[] obj : list1) { | |
| 1279 | + if (obj != null) { | |
| 1280 | + obj[0] =code; | |
| 1281 | + obj[3] = sdf.format(new Date(Long.parseLong(obj[3].toString()))); | |
| 1282 | + obj[4] = BasicData.lineCode2NameMap.get(line); | |
| 1283 | + } | |
| 1284 | + } | |
| 1285 | + list.addAll(list1); | |
| 1286 | + } | |
| 1287 | + | |
| 1241 | 1288 | if (type != null && type.length() != 0 && type.equals("export")) { |
| 1242 | 1289 | String lineName = BasicData.lineCode2NameMap.get(line); |
| 1243 | 1290 | SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"), |
| ... | ... | @@ -3213,6 +3260,63 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl<ScheduleRealInf |
| 3213 | 3260 | String zdsj1 = ""; |
| 3214 | 3261 | String zdsjActual1 = ""; |
| 3215 | 3262 | List<ScheduleRealInfo> listInfo = scheduleRealInfoRepository.scheduleDdrb(line, date); |
| 3263 | + | |
| 3264 | + /* | |
| 3265 | + * 对计划发车时间相同的班次进行排序 out最前 in最后 | |
| 3266 | + */ | |
| 3267 | + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm"); | |
| 3268 | + String minfcsj = "02:00"; | |
| 3269 | + List<Line> lineList = lineRepository.findLineByCode(line); | |
| 3270 | + if (lineList.size() > 0) { | |
| 3271 | + String sqlMinYysj = "select start_opt from bsth_c_line_config where " | |
| 3272 | + + " id = (" | |
| 3273 | + + "select max(id) from bsth_c_line_config where line ='" + lineList.get(0).getId() + "'" | |
| 3274 | + + ")"; | |
| 3275 | + minfcsj = jdbcTemplate.queryForObject(sqlMinYysj, String.class); | |
| 3276 | + } | |
| 3277 | + String[] minSjs = minfcsj.split(":"); | |
| 3278 | + Long minSj = Long.parseLong(minSjs[0]) * 60 + Long.parseLong(minSjs[1]); | |
| 3279 | + for (int i = 0; i < listInfo.size(); i++) { | |
| 3280 | + ScheduleRealInfo s = listInfo.get(i); | |
| 3281 | + if (s.getBcType().equals("out")) { | |
| 3282 | + s.setRemark("1"); | |
| 3283 | + } else if (s.getBcType().equals("in")) { | |
| 3284 | + s.setRemark("3"); | |
| 3285 | + } else { | |
| 3286 | + s.setRemark("2"); | |
| 3287 | + } | |
| 3288 | + String[] fcsj = s.getFcsj().split(":"); | |
| 3289 | + Long fcsjL = Long.parseLong(fcsj[0]) * 60 + Long.parseLong(fcsj[1]); | |
| 3290 | + | |
| 3291 | + Long fscjT = 0L; | |
| 3292 | + if (fcsjL < minSj) { | |
| 3293 | + Calendar calendar = new GregorianCalendar(); | |
| 3294 | + calendar.setTime(s.getScheduleDate()); | |
| 3295 | + calendar.add(calendar.DATE, 1); | |
| 3296 | + s.setScheduleDate(calendar.getTime()); | |
| 3297 | + try { | |
| 3298 | + fscjT = sdf.parse(sdf.format(s.getScheduleDate()) + " " + s.getFcsj()).getTime(); | |
| 3299 | + } catch (ParseException e) { | |
| 3300 | + // TODO Auto-generated catch block | |
| 3301 | + e.printStackTrace(); | |
| 3302 | + } | |
| 3303 | + | |
| 3304 | + } else { | |
| 3305 | + try { | |
| 3306 | + fscjT = sdf.parse(s.getScheduleDateStr() + " " + s.getFcsj()).getTime(); | |
| 3307 | + } catch (ParseException e) { | |
| 3308 | + // TODO Auto-generated catch block | |
| 3309 | + e.printStackTrace(); | |
| 3310 | + } | |
| 3311 | + ; | |
| 3312 | + } | |
| 3313 | + s.setFcsjT(fscjT); | |
| 3314 | + } | |
| 3315 | + List<ScheduleRealInfo> listInfo2=new ArrayList<ScheduleRealInfo>(); | |
| 3316 | + listInfo2.addAll(listInfo); | |
| 3317 | + Collections.sort(listInfo, new compareLpFcsjType()); | |
| 3318 | + System.out.println(listInfo); | |
| 3319 | + Collections.sort(listInfo2,new compareDirLpFcsjType()); | |
| 3216 | 3320 | for (int i = 0; i < listInfo.size(); i++) { |
| 3217 | 3321 | ScheduleRealInfo t = listInfo.get(i); |
| 3218 | 3322 | if (!lpName.equals(t.getLpName())) { |
| ... | ... | @@ -3231,8 +3335,44 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl<ScheduleRealInf |
| 3231 | 3335 | lpName = t.getLpName(); |
| 3232 | 3336 | list.add(t); |
| 3233 | 3337 | } |
| 3234 | - | |
| 3338 | +/* | |
| 3235 | 3339 | List<ScheduleRealInfo> listInfo2 = scheduleRealInfoRepository.scheduleDdrb2(line, date); |
| 3340 | + for (int i = 0; i < listInfo2.size(); i++) { | |
| 3341 | + ScheduleRealInfo s = listInfo2.get(i); | |
| 3342 | + if (s.getBcType().equals("out")) { | |
| 3343 | + s.setRemark("1"); | |
| 3344 | + } else if (s.getBcType().equals("in")) { | |
| 3345 | + s.setRemark("3"); | |
| 3346 | + } else { | |
| 3347 | + s.setRemark("2"); | |
| 3348 | + } | |
| 3349 | + String[] fcsj = s.getFcsj().split(":"); | |
| 3350 | + Long fcsjL = Long.parseLong(fcsj[0]) * 60 + Long.parseLong(fcsj[1]); | |
| 3351 | + | |
| 3352 | + Long fscjT = 0L; | |
| 3353 | + if (fcsjL < minSj) { | |
| 3354 | + Calendar calendar = new GregorianCalendar(); | |
| 3355 | + calendar.setTime(s.getScheduleDate()); | |
| 3356 | + calendar.add(calendar.DATE, 1); | |
| 3357 | + s.setScheduleDate(calendar.getTime()); | |
| 3358 | + try { | |
| 3359 | + fscjT = sdf.parse(sdf.format(s.getScheduleDate()) + " " + s.getFcsj()).getTime(); | |
| 3360 | + } catch (ParseException e) { | |
| 3361 | + // TODO Auto-generated catch block | |
| 3362 | + e.printStackTrace(); | |
| 3363 | + } | |
| 3364 | + | |
| 3365 | + } else { | |
| 3366 | + try { | |
| 3367 | + fscjT = sdf.parse(s.getScheduleDateStr() + " " + s.getFcsj()).getTime(); | |
| 3368 | + } catch (ParseException e) { | |
| 3369 | + // TODO Auto-generated catch block | |
| 3370 | + e.printStackTrace(); | |
| 3371 | + } | |
| 3372 | + ; | |
| 3373 | + } | |
| 3374 | + s.setFcsjT(fscjT); | |
| 3375 | + }*/ | |
| 3236 | 3376 | List<ScheduleRealInfo> xList = new ArrayList<ScheduleRealInfo>(); |
| 3237 | 3377 | List<ScheduleRealInfo> yList = new ArrayList<ScheduleRealInfo>(); |
| 3238 | 3378 | List<ScheduleRealInfo> zList = new ArrayList<ScheduleRealInfo>(); |
| ... | ... | @@ -3301,6 +3441,195 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl<ScheduleRealInf |
| 3301 | 3441 | } |
| 3302 | 3442 | |
| 3303 | 3443 | @Override |
| 3444 | + public List<ScheduleRealInfo> realScheduleList_zrw(String line, String date) { | |
| 3445 | + List<ScheduleRealInfo> list = new ArrayList<ScheduleRealInfo>(); | |
| 3446 | + String lpName = "lpName"; | |
| 3447 | + String zdsj = ""; | |
| 3448 | + String zdsjActual = ""; | |
| 3449 | + String zdsj1 = ""; | |
| 3450 | + String zdsjActual1 = ""; | |
| 3451 | + List<ScheduleRealInfo> listInfo = scheduleRealInfoRepository.scheduleDdrb(line, date); | |
| 3452 | + | |
| 3453 | + /* | |
| 3454 | + * 对计划发车时间相同的班次进行排序 out最前 in最后 | |
| 3455 | + */ | |
| 3456 | + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm"); | |
| 3457 | + String minfcsj = "02:00"; | |
| 3458 | + List<Line> lineList = lineRepository.findLineByCode(line); | |
| 3459 | + if (lineList.size() > 0) { | |
| 3460 | + String sqlMinYysj = "select start_opt from bsth_c_line_config where " | |
| 3461 | + + " id = (" | |
| 3462 | + + "select max(id) from bsth_c_line_config where line ='" + lineList.get(0).getId() + "'" | |
| 3463 | + + ")"; | |
| 3464 | + minfcsj = jdbcTemplate.queryForObject(sqlMinYysj, String.class); | |
| 3465 | + } | |
| 3466 | + String[] minSjs = minfcsj.split(":"); | |
| 3467 | + Long minSj = Long.parseLong(minSjs[0]) * 60 + Long.parseLong(minSjs[1]); | |
| 3468 | + for (int i = 0; i < listInfo.size(); i++) { | |
| 3469 | + ScheduleRealInfo s = listInfo.get(i); | |
| 3470 | + if (s.getBcType().equals("out")) { | |
| 3471 | + s.setRemark("1"); | |
| 3472 | + } else if (s.getBcType().equals("in")) { | |
| 3473 | + s.setRemark("3"); | |
| 3474 | + } else { | |
| 3475 | + s.setRemark("2"); | |
| 3476 | + } | |
| 3477 | + String[] fcsj = s.getFcsj().split(":"); | |
| 3478 | + Long fcsjL = Long.parseLong(fcsj[0]) * 60 + Long.parseLong(fcsj[1]); | |
| 3479 | + | |
| 3480 | + Long fscjT = 0L; | |
| 3481 | + if (fcsjL < minSj) { | |
| 3482 | + Calendar calendar = new GregorianCalendar(); | |
| 3483 | + calendar.setTime(s.getScheduleDate()); | |
| 3484 | + calendar.add(calendar.DATE, 1); | |
| 3485 | + s.setScheduleDate(calendar.getTime()); | |
| 3486 | + try { | |
| 3487 | + fscjT = sdf.parse(sdf.format(s.getScheduleDate()) + " " + s.getFcsj()).getTime(); | |
| 3488 | + } catch (ParseException e) { | |
| 3489 | + // TODO Auto-generated catch block | |
| 3490 | + e.printStackTrace(); | |
| 3491 | + } | |
| 3492 | + | |
| 3493 | + } else { | |
| 3494 | + try { | |
| 3495 | + fscjT = sdf.parse(s.getScheduleDateStr() + " " + s.getFcsj()).getTime(); | |
| 3496 | + } catch (ParseException e) { | |
| 3497 | + // TODO Auto-generated catch block | |
| 3498 | + e.printStackTrace(); | |
| 3499 | + } | |
| 3500 | + ; | |
| 3501 | + } | |
| 3502 | + s.setFcsjT(fscjT); | |
| 3503 | + } | |
| 3504 | + | |
| 3505 | +// Collections.sort(listInfo, new compareLpFcsjType()); | |
| 3506 | + List<ScheduleRealInfo> listInfo2=new ArrayList<ScheduleRealInfo>(); | |
| 3507 | + | |
| 3508 | + Collections.sort(listInfo, new compareLpFcsjType()); | |
| 3509 | + for (int i = 0; i < listInfo.size(); i++) { | |
| 3510 | + ScheduleRealInfo t = listInfo.get(i); | |
| 3511 | + if (!lpName.equals(t.getLpName())) { | |
| 3512 | + zdsjActual = t.getZdsjActual(); | |
| 3513 | + zdsj = t.getZdsj(); | |
| 3514 | + t.setZdsjActual(""); | |
| 3515 | + t.setZdsj(""); | |
| 3516 | + } else { | |
| 3517 | + zdsj1 = t.getZdsj(); | |
| 3518 | + zdsjActual1 = t.getZdsjActual(); | |
| 3519 | + t.setZdsjActual(zdsjActual); | |
| 3520 | + t.setZdsj(zdsj); | |
| 3521 | + zdsj = zdsj1; | |
| 3522 | + zdsjActual = zdsjActual1; | |
| 3523 | + } | |
| 3524 | + | |
| 3525 | + | |
| 3526 | + | |
| 3527 | + lpName = t.getLpName(); | |
| 3528 | + listInfo2.add(t); | |
| 3529 | + | |
| 3530 | + } | |
| 3531 | + | |
| 3532 | + Collections.sort(listInfo2,new compareDirLpFcsjType()); | |
| 3533 | + for (int i = 0; i < listInfo2.size(); i++) { | |
| 3534 | + ScheduleRealInfo t=listInfo2.get(i); | |
| 3535 | + list.add(t); | |
| 3536 | + Set<ChildTaskPlan> childTaskPlans = t.getcTasks(); | |
| 3537 | + //计算营运里程,空驶里程 | |
| 3538 | + if (!childTaskPlans.isEmpty()) { | |
| 3539 | + List<ChildTaskPlan> listit = new ArrayList<ChildTaskPlan>(childTaskPlans); | |
| 3540 | + Collections.sort(listit, new ComparableChild()); | |
| 3541 | + for (int j = 0; j < listit.size(); j++) { | |
| 3542 | + ScheduleRealInfo s = new ScheduleRealInfo(); | |
| 3543 | + ChildTaskPlan childTaskPlan = listit.get(j); | |
| 3544 | + if (childTaskPlan.getCcId() == null) { | |
| 3545 | + if (childTaskPlan.isDestroy()) { | |
| 3546 | + s.setFcsjActual(""); | |
| 3547 | + s.setZdsjActual(""); | |
| 3548 | + } else { | |
| 3549 | + s.setFcsjActual(childTaskPlan.getStartDate()); | |
| 3550 | + s.setZdsjActual(""); | |
| 3551 | + s.setJhlc(Double.parseDouble(String.valueOf(childTaskPlan.getMileage()))); | |
| 3552 | + } | |
| 3553 | + s.setFcsj(childTaskPlan.getStartDate()); | |
| 3554 | + s.setZdsj(""); | |
| 3555 | + s.setQdzName(childTaskPlan.getStartStationName()); | |
| 3556 | + s.setZdzName(childTaskPlan.getEndStationName()); | |
| 3557 | + s.setRemarks(childTaskPlan.getRemarks()); | |
| 3558 | + s.setAdjustExps("子"); | |
| 3559 | + s.setLpName(""); | |
| 3560 | + list.add(s); | |
| 3561 | + } | |
| 3562 | + } | |
| 3563 | + } | |
| 3564 | + } | |
| 3565 | + List<ScheduleRealInfo> xList = new ArrayList<ScheduleRealInfo>(); | |
| 3566 | + List<ScheduleRealInfo> yList = new ArrayList<ScheduleRealInfo>(); | |
| 3567 | + List<ScheduleRealInfo> zList = new ArrayList<ScheduleRealInfo>(); | |
| 3568 | + List<ScheduleRealInfo> newList = new ArrayList<ScheduleRealInfo>(); | |
| 3569 | + if (list.size() > 0) { | |
| 3570 | + int a = list.size() % 3; | |
| 3571 | + int b = list.size() / 3; | |
| 3572 | + int x = 0, y = 0; | |
| 3573 | + if (a == 2) { | |
| 3574 | + x = b + 1; | |
| 3575 | + y = x * 2; | |
| 3576 | + } else if (a == 1) { | |
| 3577 | + x = b + 1; | |
| 3578 | + y = x * 2 - 1; | |
| 3579 | + } else { | |
| 3580 | + x = b; | |
| 3581 | + y = 2 * x; | |
| 3582 | + | |
| 3583 | + } | |
| 3584 | + for (int i = 0; i < list.size(); i++) { | |
| 3585 | + ScheduleRealInfo s = list.get(i); | |
| 3586 | + if (i + 1 <= x) { | |
| 3587 | + xList.add(s); | |
| 3588 | + } else if ((i + 1) > x && (i + 1) <= y) { | |
| 3589 | + yList.add(s); | |
| 3590 | + } else { | |
| 3591 | + zList.add(s); | |
| 3592 | + } | |
| 3593 | + } | |
| 3594 | + for (int i = 0; i < x; i++) { | |
| 3595 | + newList.add(xList.get(i)); | |
| 3596 | + if (yList.size() > i) { | |
| 3597 | + newList.add(yList.get(i)); | |
| 3598 | + } else { | |
| 3599 | + newList.add(new ScheduleRealInfo()); | |
| 3600 | + } | |
| 3601 | + if (zList.size() > i) { | |
| 3602 | + newList.add(zList.get(i)); | |
| 3603 | + } else { | |
| 3604 | + newList.add(new ScheduleRealInfo()); | |
| 3605 | + } | |
| 3606 | + | |
| 3607 | + } | |
| 3608 | + } | |
| 3609 | + /* for (int i = 0; i < newList.size(); i++) { | |
| 3610 | + ScheduleRealInfo t1 = newList.get(i); | |
| 3611 | + for (int j = 0; j < list.size(); j++) { | |
| 3612 | + ScheduleRealInfo t2 = list.get(j); | |
| 3613 | + if (t1.getId() == t2.getId()) { | |
| 3614 | + t1 = t2; | |
| 3615 | + } | |
| 3616 | + } | |
| 3617 | + }*/ | |
| 3618 | + | |
| 3619 | + for (int i = 0; i < newList.size(); i++) { | |
| 3620 | + ScheduleRealInfo t1 = newList.get(i); | |
| 3621 | + String reamrks1 = t1.getRemarks() == null ? "" : t1.getRemarks(); | |
| 3622 | + if (reamrks1.length() > 4) { | |
| 3623 | + t1.setRemarks(reamrks1.substring(0, 4)); | |
| 3624 | + t1.setRemark(reamrks1); | |
| 3625 | + } else { | |
| 3626 | + t1.setRemark(reamrks1); | |
| 3627 | + } | |
| 3628 | + } | |
| 3629 | + return newList; | |
| 3630 | + } | |
| 3631 | + | |
| 3632 | + @Override | |
| 3304 | 3633 | public List<ScheduleRealInfo> realScheduleList_mh_2(String line, String date) { |
| 3305 | 3634 | List<ScheduleRealInfo> list = new ArrayList<ScheduleRealInfo>(); |
| 3306 | 3635 | String lpName = "lpName"; |
| ... | ... | @@ -4658,13 +4987,18 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl<ScheduleRealInf |
| 4658 | 4987 | String xlName = map.get("xlName").toString(); |
| 4659 | 4988 | String state = map.get("state").toString(); |
| 4660 | 4989 | String type = map.get("type").toString(); |
| 4661 | - | |
| 4990 | + String genre =map.get("genre").toString(); | |
| 4662 | 4991 | List<Map<String, Object>> dataList2 = new ArrayList<Map<String, Object>>(); |
| 4663 | 4992 | List<Map<String, Object>> dataList3 = new ArrayList<Map<String, Object>>(); |
| 4664 | 4993 | List<Map<String, Object>> list1 = this.statisticsDaily(line, date, xlName, null); |
| 4665 | 4994 | List<ScheduleRealInfo> list2 = this.queryUserInfo(line, date, state); |
| 4666 | - List<ScheduleRealInfo> list3 = this.realScheduleList(line, date); | |
| 4667 | - | |
| 4995 | + List<ScheduleRealInfo> list3 = new ArrayList<ScheduleRealInfo>(); | |
| 4996 | + if(genre.equals("qp")) | |
| 4997 | + list3=this.realScheduleListQp(line, date); | |
| 4998 | + else if(genre.equals("zrw")) | |
| 4999 | + list3=this.realScheduleList_zrw(line, date); | |
| 5000 | + else | |
| 5001 | + list3=this.realScheduleList(line, date); | |
| 4668 | 5002 | Map<String, Object> nMap = new HashMap<String, Object>(); |
| 4669 | 5003 | nMap.put("date", xlName + date); |
| 4670 | 5004 | nMap.put("jls", list1.get(0).get("jls")); |
| ... | ... | @@ -4792,7 +5126,7 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl<ScheduleRealInf |
| 4792 | 5126 | } |
| 4793 | 5127 | } |
| 4794 | 5128 | tempMap.put("zdsjk" + x, zdsjk); |
| 4795 | - tempMap.put("zdsjm" + x, zdsjm); | |
| 5129 | + tempMap.put("zdsjm" + x, zdsjm.equals("0")?"":zdsjm); | |
| 4796 | 5130 | tempMap.put("fcsj" + x, schedule.getFcsj()); |
| 4797 | 5131 | String fcsjActural = schedule.getFcsjActual() != null ? schedule.getFcsjActual() : ""; |
| 4798 | 5132 | String bcType = schedule.getBcType() != null ? schedule.getBcType() : ""; |
| ... | ... | @@ -4819,7 +5153,7 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl<ScheduleRealInf |
| 4819 | 5153 | } |
| 4820 | 5154 | } |
| 4821 | 5155 | tempMap.put("fcsjk" + x, fcsjk); |
| 4822 | - tempMap.put("fcsjm" + x, fcsjm); | |
| 5156 | + tempMap.put("fcsjm" + x, fcsjm.equals("0")?"":fcsjm); | |
| 4823 | 5157 | tempMap.put("remarks" + x, schedule.getRemark() != null ? schedule.getRemark() : ""); |
| 4824 | 5158 | |
| 4825 | 5159 | size++; |
| ... | ... | @@ -5631,6 +5965,23 @@ class AccountXlbm implements Comparator<Map<String, Object>> { |
| 5631 | 5965 | } |
| 5632 | 5966 | } |
| 5633 | 5967 | |
| 5968 | +class compareLpFcsjType implements Comparator<ScheduleRealInfo> { | |
| 5969 | + @Override | |
| 5970 | + public int compare(ScheduleRealInfo o1, ScheduleRealInfo o2) { | |
| 5971 | + // TODO Auto-generated method stub | |
| 5972 | + return (o1.getLpName()+o1.getFcsjT() + o1.getRemark()).compareTo(o2.getLpName()+o2.getFcsjT() + o2.getRemark()); | |
| 5973 | + } | |
| 5974 | + | |
| 5975 | +} | |
| 5976 | + | |
| 5977 | +class compareDirLpFcsjType implements Comparator<ScheduleRealInfo> { | |
| 5978 | + @Override | |
| 5979 | + public int compare(ScheduleRealInfo o1, ScheduleRealInfo o2) { | |
| 5980 | + // TODO Auto-generated method stub | |
| 5981 | + return (o1.getXlDir()+o1.getFcsjT() + o1.getRemark()+o1.getLpName()).compareTo(o2.getXlDir()+o2.getFcsjT() + o2.getRemark()+o2.getLpName()); | |
| 5982 | + } | |
| 5983 | + | |
| 5984 | +} | |
| 5634 | 5985 | class compareFcsjType implements Comparator<ScheduleRealInfo> { |
| 5635 | 5986 | @Override |
| 5636 | 5987 | public int compare(ScheduleRealInfo o1, ScheduleRealInfo o2) { | ... | ... |
src/main/java/com/bsth/service/report/impl/CulateMileageServiceImpl.java
| ... | ... | @@ -863,6 +863,8 @@ public class CulateMileageServiceImpl implements CulateMileageService{ |
| 863 | 863 | if (sch.isSflj()) |
| 864 | 864 | continue; |
| 865 | 865 | cts = sch.getcTasks(); |
| 866 | + if(isInOut(sch)) | |
| 867 | + continue; | |
| 866 | 868 | //有子任务 |
| 867 | 869 | if (cts != null && cts.size() > 0) { |
| 868 | 870 | for(ChildTaskPlan c : cts){ |
| ... | ... | @@ -881,8 +883,7 @@ public class CulateMileageServiceImpl implements CulateMileageService{ |
| 881 | 883 | } |
| 882 | 884 | } |
| 883 | 885 | } |
| 884 | - else if(isInOut(sch)) | |
| 885 | - continue; | |
| 886 | + | |
| 886 | 887 | //主任务烂班 |
| 887 | 888 | else if(sch.getStatus() == -1 && !sch.isCcService()){ |
| 888 | 889 | if(sch.getAdjustExps().equals(item) || | ... | ... |
src/main/java/com/bsth/service/report/impl/ReportServiceImpl.java
| ... | ... | @@ -1825,7 +1825,7 @@ public class ReportServiceImpl implements ReportService{ |
| 1825 | 1825 | newMap.put("dz", scheduleRealInfo.getQdzName()); |
| 1826 | 1826 | newMap.put("sj", scheduleRealInfo.getFcsj()); |
| 1827 | 1827 | newMap.put("ljlc", scheduleRealInfo.getJhlc()==null?0:scheduleRealInfo.getJhlc()); |
| 1828 | - newMap.put("jyqp", scheduleRealInfo.getRealMileage()==null?"":scheduleRealInfo.getRealMileage()); | |
| 1828 | + newMap.put("jyqp", scheduleRealInfo.getRemarks()==null?"":scheduleRealInfo.getRemarks()); | |
| 1829 | 1829 | list.add(newMap); |
| 1830 | 1830 | } |
| 1831 | 1831 | // }else{ | ... | ... |
src/main/java/com/bsth/service/schedule/CarConfigInfoService.java
| 1 | 1 | package com.bsth.service.schedule; |
| 2 | 2 | |
| 3 | 3 | import com.bsth.entity.schedule.CarConfigInfo; |
| 4 | +import com.bsth.entity.sys.CompanyAuthority; | |
| 4 | 5 | import com.bsth.service.schedule.exception.ScheduleException; |
| 5 | 6 | |
| 7 | +import java.util.List; | |
| 8 | + | |
| 6 | 9 | /** |
| 7 | 10 | * Created by xu on 16/5/9. |
| 8 | 11 | */ |
| 9 | 12 | public interface CarConfigInfoService extends BService<CarConfigInfo, Long> { |
| 13 | + // 判定车辆是否配置在其他线路上 | |
| 10 | 14 | void validate_cars(CarConfigInfo carConfigInfo) throws ScheduleException; |
| 15 | + // 判定车辆是否配置在其他线路上2 | |
| 16 | + void validate_cars(Integer xlId, Integer clId) throws ScheduleException; | |
| 17 | + // 判定车辆是否配置在当前线路中 | |
| 18 | + void validate_cars_config(CarConfigInfo carConfigInfo) throws ScheduleException; | |
| 19 | + // 判定车辆所属公司和当前用户的所属公司 | |
| 20 | + void validate_cars_gs(CarConfigInfo carConfigInfo, List<CompanyAuthority> companyAuthorityList) throws ScheduleException; | |
| 21 | + // 判定车辆所属分公司和当前用户的所属分公司 | |
| 22 | + void validate_cars_fgs(CarConfigInfo carConfigInfo, List<CompanyAuthority> companyAuthorityList) throws ScheduleException; | |
| 11 | 23 | void toggleCancel(Long id) throws ScheduleException; |
| 24 | + | |
| 25 | + | |
| 12 | 26 | } | ... | ... |
src/main/java/com/bsth/service/schedule/EmployeeConfigInfoService.java
| 1 | 1 | package com.bsth.service.schedule; |
| 2 | 2 | |
| 3 | 3 | import com.bsth.entity.schedule.EmployeeConfigInfo; |
| 4 | +import com.bsth.entity.sys.CompanyAuthority; | |
| 4 | 5 | import com.bsth.service.schedule.exception.ScheduleException; |
| 5 | 6 | |
| 7 | +import java.util.List; | |
| 8 | + | |
| 6 | 9 | /** |
| 7 | 10 | * Created by xu on 16/5/10. |
| 8 | 11 | */ |
| ... | ... | @@ -13,8 +16,17 @@ public interface EmployeeConfigInfoService extends BService<EmployeeConfigInfo, |
| 13 | 16 | void validate_spy(EmployeeConfigInfo employeeConfigInfo) throws ScheduleException; |
| 14 | 17 | // 验证驾驶员是否配置在指定线路 |
| 15 | 18 | void validate_jsy_config(EmployeeConfigInfo employeeConfigInfo) throws ScheduleException; |
| 19 | + // 判定驾驶员所属公司和当前用户的所属公司 | |
| 20 | + void validate_jsy_gs(EmployeeConfigInfo employeeConfigInfo, List<CompanyAuthority> companyAuthorityList) throws ScheduleException; | |
| 21 | + // 判定驾驶员所属分公司和当前用户的所属分公司 | |
| 22 | + void validate_jsy_fgs(EmployeeConfigInfo employeeConfigInfo, List<CompanyAuthority> companyAuthorityList) throws ScheduleException; | |
| 16 | 23 | // 验证售票员是否配置在指定线路 |
| 17 | 24 | void validate_spy_config(EmployeeConfigInfo employeeConfigInfo) throws ScheduleException; |
| 25 | + // 判定驾驶员所属公司和当前用户的所属公司 | |
| 26 | + void validate_spy_gs(EmployeeConfigInfo employeeConfigInfo, List<CompanyAuthority> companyAuthorityList) throws ScheduleException; | |
| 27 | + // 判定驾驶员所属分公司和当前用户的所属分公司 | |
| 28 | + void validate_spy_fgs(EmployeeConfigInfo employeeConfigInfo, List<CompanyAuthority> companyAuthorityList) throws ScheduleException; | |
| 29 | + | |
| 18 | 30 | void toggleCancel(Long id) throws ScheduleException; |
| 19 | 31 | Long getMaxDbbm(Integer xlId); |
| 20 | 32 | } | ... | ... |
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<SchedulePlan, Long> { |
| 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
| 1 | 1 | package com.bsth.service.schedule.impl; |
| 2 | 2 | |
| 3 | +import com.bsth.entity.Cars; | |
| 3 | 4 | import com.bsth.entity.schedule.CarConfigInfo; |
| 4 | 5 | import com.bsth.entity.schedule.rule.ScheduleRule1Flat; |
| 6 | +import com.bsth.entity.sys.CompanyAuthority; | |
| 5 | 7 | import com.bsth.service.schedule.CarConfigInfoService; |
| 8 | +import com.bsth.service.schedule.CarsService; | |
| 6 | 9 | import com.bsth.service.schedule.ScheduleRule1FlatService; |
| 7 | 10 | import com.bsth.service.schedule.exception.ScheduleException; |
| 8 | 11 | import com.bsth.service.schedule.utils.DataToolsFile; |
| ... | ... | @@ -25,6 +28,8 @@ import java.util.Map; |
| 25 | 28 | public class CarConfigInfoServiceImpl extends BServiceImpl<CarConfigInfo, Long> implements CarConfigInfoService { |
| 26 | 29 | @Autowired |
| 27 | 30 | private ScheduleRule1FlatService scheduleRule1FlatService; |
| 31 | + @Autowired | |
| 32 | + private CarsService carsService; | |
| 28 | 33 | |
| 29 | 34 | @Autowired |
| 30 | 35 | @Qualifier(value = "carConfig_dataTool") |
| ... | ... | @@ -45,6 +50,57 @@ public class CarConfigInfoServiceImpl extends BServiceImpl<CarConfigInfo, Long> |
| 45 | 50 | return dataToolsService.exportData(params); |
| 46 | 51 | } |
| 47 | 52 | |
| 53 | + @Override | |
| 54 | + public void validate_cars_gs(CarConfigInfo carConfigInfo, List<CompanyAuthority> companyAuthorityList) throws ScheduleException { | |
| 55 | + if (CollectionUtils.isEmpty(companyAuthorityList)) { | |
| 56 | + throw new ScheduleException("当前用户没有公司权限!"); | |
| 57 | + } | |
| 58 | + | |
| 59 | + boolean isFind = false; | |
| 60 | + Cars cars = carsService.findById(carConfigInfo.getCl().getId()); | |
| 61 | + for (CompanyAuthority companyAuthority : companyAuthorityList) { | |
| 62 | + if (companyAuthority.getCompanyCode().equals(cars.getBusinessCode())) { | |
| 63 | + isFind = true; | |
| 64 | + break; | |
| 65 | + } | |
| 66 | + } | |
| 67 | + if (!isFind) { | |
| 68 | + throw new ScheduleException("当前车辆不在用户所属公司中!"); | |
| 69 | + } | |
| 70 | + } | |
| 71 | + | |
| 72 | + @Override | |
| 73 | + public void validate_cars_fgs(CarConfigInfo carConfigInfo, List<CompanyAuthority> companyAuthorityList) throws ScheduleException { | |
| 74 | + if (CollectionUtils.isEmpty(companyAuthorityList)) { | |
| 75 | + throw new ScheduleException("当前用户没有分公司权限!"); | |
| 76 | + } | |
| 77 | + | |
| 78 | + boolean isFind = false; | |
| 79 | + Cars cars = carsService.findById(carConfigInfo.getCl().getId()); | |
| 80 | + for (CompanyAuthority companyAuthority : companyAuthorityList) { | |
| 81 | + if (companyAuthority.getCompanyCode().equals(cars.getBusinessCode())) { | |
| 82 | + isFind = true; | |
| 83 | + break; | |
| 84 | + } | |
| 85 | + } | |
| 86 | + if (!isFind) { | |
| 87 | + // 如果没有公司权限,验证通过 | |
| 88 | + return; | |
| 89 | + } | |
| 90 | + | |
| 91 | + isFind = false; | |
| 92 | + for (CompanyAuthority companyAuthority : companyAuthorityList) { | |
| 93 | + if (companyAuthority.getCompanyCode().equals(cars.getBusinessCode()) && | |
| 94 | + companyAuthority.getSubCompanyCode().equals(cars.getBrancheCompanyCode())) { | |
| 95 | + isFind = true; | |
| 96 | + break; | |
| 97 | + } | |
| 98 | + } | |
| 99 | + if (!isFind) { | |
| 100 | + throw new ScheduleException("当前车辆不在用户所属分公司中!"); | |
| 101 | + } | |
| 102 | + } | |
| 103 | + | |
| 48 | 104 | @Transactional |
| 49 | 105 | public void validate_cars(CarConfigInfo carConfigInfo) throws ScheduleException { |
| 50 | 106 | // 相同车辆不能同时配置 |
| ... | ... | @@ -73,6 +129,29 @@ public class CarConfigInfoServiceImpl extends BServiceImpl<CarConfigInfo, Long> |
| 73 | 129 | |
| 74 | 130 | } |
| 75 | 131 | |
| 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 | |
| 145 | + public void validate_cars_config(CarConfigInfo carConfigInfo) throws ScheduleException { | |
| 146 | + Map<String, Object> param = new HashMap<>(); | |
| 147 | + param.put("xl.id_eq", carConfigInfo.getXl().getId()); | |
| 148 | + param.put("cl.id_eq", carConfigInfo.getCl().getId()); | |
| 149 | + List<CarConfigInfo> carConfigInfos = list(param); | |
| 150 | + if (CollectionUtils.isEmpty(carConfigInfos)) { | |
| 151 | + throw new ScheduleException("当前车辆没有配置在当前线路中,不属于当前线路!"); | |
| 152 | + } | |
| 153 | + } | |
| 154 | + | |
| 76 | 155 | @Transactional |
| 77 | 156 | @Override |
| 78 | 157 | public void delete(Long aLong) throws ScheduleException { | ... | ... |
src/main/java/com/bsth/service/schedule/impl/CarDeviceServiceImpl.java
| ... | ... | @@ -12,6 +12,7 @@ import org.springframework.transaction.annotation.Propagation; |
| 12 | 12 | import org.springframework.transaction.annotation.Transactional; |
| 13 | 13 | import org.springframework.util.CollectionUtils; |
| 14 | 14 | |
| 15 | +import java.util.Date; | |
| 15 | 16 | import java.util.HashMap; |
| 16 | 17 | import java.util.Map; |
| 17 | 18 | |
| ... | ... | @@ -29,6 +30,8 @@ public class CarDeviceServiceImpl extends BServiceImpl<CarDevice, Long> implemen |
| 29 | 30 | // 查找对应的车辆基础信息,更新设备编号数据 |
| 30 | 31 | Cars cars = carsService.findById(carDevice.getCl()); |
| 31 | 32 | cars.setEquipmentCode(carDevice.getNewDeviceNo()); |
| 33 | + // 设备启用日期使用后台日期 | |
| 34 | + carDevice.setQyrq(new Date()); | |
| 32 | 35 | return super.save(carDevice); |
| 33 | 36 | } |
| 34 | 37 | ... | ... |
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<Cars, Integer> 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/EmployeeConfigInfoServiceImpl.java
| 1 | 1 | package com.bsth.service.schedule.impl; |
| 2 | 2 | |
| 3 | +import com.bsth.entity.Personnel; | |
| 3 | 4 | import com.bsth.entity.schedule.EmployeeConfigInfo; |
| 4 | 5 | import com.bsth.entity.schedule.rule.ScheduleRule1Flat; |
| 6 | +import com.bsth.entity.sys.CompanyAuthority; | |
| 5 | 7 | import com.bsth.service.schedule.EmployeeConfigInfoService; |
| 8 | +import com.bsth.service.schedule.EmployeeService; | |
| 6 | 9 | import com.bsth.service.schedule.ScheduleRule1FlatService; |
| 7 | 10 | import com.bsth.service.schedule.exception.ScheduleException; |
| 8 | 11 | import com.bsth.service.schedule.utils.DataToolsFile; |
| ... | ... | @@ -28,6 +31,8 @@ import java.util.*; |
| 28 | 31 | public class EmployeeConfigInfoServiceImpl extends BServiceImpl<EmployeeConfigInfo, Long> implements EmployeeConfigInfoService { |
| 29 | 32 | @Autowired |
| 30 | 33 | private ScheduleRule1FlatService scheduleRule1FlatService; |
| 34 | + @Autowired | |
| 35 | + private EmployeeService employeeService; | |
| 31 | 36 | |
| 32 | 37 | @Autowired |
| 33 | 38 | @Qualifier(value = "employeeConfig_dataTool") |
| ... | ... | @@ -110,6 +115,57 @@ public class EmployeeConfigInfoServiceImpl extends BServiceImpl<EmployeeConfigIn |
| 110 | 115 | } |
| 111 | 116 | } |
| 112 | 117 | |
| 118 | + @Override | |
| 119 | + public void validate_jsy_gs(EmployeeConfigInfo employeeConfigInfo, List<CompanyAuthority> companyAuthorityList) throws ScheduleException { | |
| 120 | + if (CollectionUtils.isEmpty(companyAuthorityList)) { | |
| 121 | + throw new ScheduleException("当前用户没有公司权限!"); | |
| 122 | + } | |
| 123 | + | |
| 124 | + boolean isFind = false; | |
| 125 | + Personnel personnel = employeeService.findById(employeeConfigInfo.getJsy().getId()); | |
| 126 | + for (CompanyAuthority companyAuthority : companyAuthorityList) { | |
| 127 | + if (companyAuthority.getCompanyCode().equals(personnel.getCompanyCode())) { | |
| 128 | + isFind = true; | |
| 129 | + break; | |
| 130 | + } | |
| 131 | + } | |
| 132 | + if (!isFind) { | |
| 133 | + throw new ScheduleException("当前驾驶员不在用户所属公司中!"); | |
| 134 | + } | |
| 135 | + } | |
| 136 | + | |
| 137 | + @Override | |
| 138 | + public void validate_jsy_fgs(EmployeeConfigInfo employeeConfigInfo, List<CompanyAuthority> companyAuthorityList) throws ScheduleException { | |
| 139 | + if (CollectionUtils.isEmpty(companyAuthorityList)) { | |
| 140 | + throw new ScheduleException("当前用户没有分公司权限!"); | |
| 141 | + } | |
| 142 | + | |
| 143 | + boolean isFind = false; | |
| 144 | + Personnel personnel = employeeService.findById(employeeConfigInfo.getJsy().getId()); | |
| 145 | + for (CompanyAuthority companyAuthority : companyAuthorityList) { | |
| 146 | + if (companyAuthority.getCompanyCode().equals(personnel.getCompanyCode())) { | |
| 147 | + isFind = true; | |
| 148 | + break; | |
| 149 | + } | |
| 150 | + } | |
| 151 | + if (!isFind) { | |
| 152 | + // 如果没有公司权限,验证通过 | |
| 153 | + return; | |
| 154 | + } | |
| 155 | + | |
| 156 | + isFind = false; | |
| 157 | + for (CompanyAuthority companyAuthority : companyAuthorityList) { | |
| 158 | + if (companyAuthority.getCompanyCode().equals(personnel.getCompanyCode()) && | |
| 159 | + companyAuthority.getSubCompanyCode().equals(personnel.getBrancheCompanyCode())) { | |
| 160 | + isFind = true; | |
| 161 | + break; | |
| 162 | + } | |
| 163 | + } | |
| 164 | + if (!isFind) { | |
| 165 | + throw new ScheduleException("当前驾驶员不在用户所属分公司中!"); | |
| 166 | + } | |
| 167 | + } | |
| 168 | + | |
| 113 | 169 | @Transactional |
| 114 | 170 | @Override |
| 115 | 171 | public void validate_spy(EmployeeConfigInfo employeeConfigInfo) throws ScheduleException { |
| ... | ... | @@ -137,6 +193,57 @@ public class EmployeeConfigInfoServiceImpl extends BServiceImpl<EmployeeConfigIn |
| 137 | 193 | } |
| 138 | 194 | } |
| 139 | 195 | |
| 196 | + @Override | |
| 197 | + public void validate_spy_gs(EmployeeConfigInfo employeeConfigInfo, List<CompanyAuthority> companyAuthorityList) throws ScheduleException { | |
| 198 | + if (CollectionUtils.isEmpty(companyAuthorityList)) { | |
| 199 | + throw new ScheduleException("当前用户没有公司权限!"); | |
| 200 | + } | |
| 201 | + | |
| 202 | + boolean isFind = false; | |
| 203 | + Personnel personnel = employeeService.findById(employeeConfigInfo.getSpy().getId()); | |
| 204 | + for (CompanyAuthority companyAuthority : companyAuthorityList) { | |
| 205 | + if (companyAuthority.getCompanyCode().equals(personnel.getCompanyCode())) { | |
| 206 | + isFind = true; | |
| 207 | + break; | |
| 208 | + } | |
| 209 | + } | |
| 210 | + if (!isFind) { | |
| 211 | + throw new ScheduleException("当前售票员不在用户所属公司中!"); | |
| 212 | + } | |
| 213 | + } | |
| 214 | + | |
| 215 | + @Override | |
| 216 | + public void validate_spy_fgs(EmployeeConfigInfo employeeConfigInfo, List<CompanyAuthority> companyAuthorityList) throws ScheduleException { | |
| 217 | + if (CollectionUtils.isEmpty(companyAuthorityList)) { | |
| 218 | + throw new ScheduleException("当前用户没有分公司权限!"); | |
| 219 | + } | |
| 220 | + | |
| 221 | + boolean isFind = false; | |
| 222 | + Personnel personnel = employeeService.findById(employeeConfigInfo.getSpy().getId()); | |
| 223 | + for (CompanyAuthority companyAuthority : companyAuthorityList) { | |
| 224 | + if (companyAuthority.getCompanyCode().equals(personnel.getCompanyCode())) { | |
| 225 | + isFind = true; | |
| 226 | + break; | |
| 227 | + } | |
| 228 | + } | |
| 229 | + if (!isFind) { | |
| 230 | + // 如果没有公司权限,验证通过 | |
| 231 | + return; | |
| 232 | + } | |
| 233 | + | |
| 234 | + isFind = false; | |
| 235 | + for (CompanyAuthority companyAuthority : companyAuthorityList) { | |
| 236 | + if (companyAuthority.getCompanyCode().equals(personnel.getCompanyCode()) && | |
| 237 | + companyAuthority.getSubCompanyCode().equals(personnel.getBrancheCompanyCode())) { | |
| 238 | + isFind = true; | |
| 239 | + break; | |
| 240 | + } | |
| 241 | + } | |
| 242 | + if (!isFind) { | |
| 243 | + throw new ScheduleException("当前售票员不在用户所属分公司中!"); | |
| 244 | + } | |
| 245 | + } | |
| 246 | + | |
| 140 | 247 | @Transactional |
| 141 | 248 | @Override |
| 142 | 249 | public void validate_spy_config(EmployeeConfigInfo employeeConfigInfo) throws ScheduleException { | ... | ... |
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<SchedulePlan, Long> 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<SchedulePlan, Long> 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<SchedulePlan, Long> 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<SchedulePlan, Long> 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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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; | |
| 2 | - | |
| 3 | -import com.bsth.entity.schedule.SchedulePlanInfo; | |
| 4 | -import com.bsth.service.schedule.rules.ttinfo.LpInfoResult_output; | |
| 5 | -import org.kie.api.runtime.rule.AccumulateFunction; | |
| 6 | - | |
| 7 | -import java.io.*; | |
| 8 | -import java.text.SimpleDateFormat; | |
| 9 | -import java.util.*; | |
| 10 | - | |
| 11 | -/** | |
| 12 | - * 计算缺少路牌错误。 | |
| 13 | - * 同一天,如果有时刻表路牌没有执行到,统计。 | |
| 14 | - * 注意:使用这个函数时,要一天计算一次,多天计算无意义。 | |
| 15 | - */ | |
| 16 | -public class ValidWantLpFunction implements AccumulateFunction { | |
| 17 | - @Override | |
| 18 | - public void writeExternal(ObjectOutput out) throws IOException { | |
| 19 | - } | |
| 20 | - | |
| 21 | - @Override | |
| 22 | - public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException { | |
| 23 | - | |
| 24 | - } | |
| 25 | - | |
| 26 | - protected static class WantLpInfo implements Externalizable { | |
| 27 | - /** 错误描述 */ | |
| 28 | - public List<ValidateResults_output.ValidInfo> validInfoList = new ArrayList<>(); | |
| 29 | - /** 每天的路牌班次数量 */ | |
| 30 | - public Map<String, Integer> lpBcCount = new HashMap<>(); | |
| 31 | - /** 每天的路牌名字对应 */ | |
| 32 | - public Map<String, String> lpNamesMap = new HashMap<>(); | |
| 33 | - /** 排班日期 */ | |
| 34 | - public Date scheduleDate; | |
| 35 | - | |
| 36 | - public WantLpInfo() { | |
| 37 | - | |
| 38 | - } | |
| 39 | - | |
| 40 | - @Override | |
| 41 | - public void writeExternal(ObjectOutput out) throws IOException { | |
| 42 | - out.writeObject(validInfoList); | |
| 43 | - } | |
| 44 | - | |
| 45 | - @Override | |
| 46 | - public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException { | |
| 47 | - validInfoList = (List<ValidateResults_output.ValidInfo>) in.readObject(); | |
| 48 | - } | |
| 49 | - } | |
| 50 | - | |
| 51 | - @Override | |
| 52 | - public Serializable createContext() { | |
| 53 | - return new WantLpInfo(); | |
| 54 | - } | |
| 55 | - | |
| 56 | - @Override | |
| 57 | - public void init(Serializable serializable) throws Exception { | |
| 58 | - // TODO: | |
| 59 | -// System.out.println("init"); | |
| 60 | - } | |
| 61 | - | |
| 62 | - @Override | |
| 63 | - public void accumulate(Serializable context, Object o) { | |
| 64 | - WantLpInfo wantLpInfo = (WantLpInfo) context; | |
| 65 | - ValidateResource validateResource = (ValidateResource) o; | |
| 66 | - | |
| 67 | - SchedulePlanInfo spi = validateResource.getSpi(); | |
| 68 | - List<LpInfoResult_output> lpiList = validateResource.getLpiList(); | |
| 69 | - | |
| 70 | - // 获取当天所有路牌信息,每个验证对象都带当天所有路牌信息,只需判定一次 | |
| 71 | - if (wantLpInfo.lpNamesMap.isEmpty()) { | |
| 72 | - for (LpInfoResult_output lpInfoResult_output: lpiList) { | |
| 73 | - wantLpInfo.lpNamesMap.put(lpInfoResult_output.getLpId(), lpInfoResult_output.getLpName()); | |
| 74 | - wantLpInfo.lpBcCount.put(lpInfoResult_output.getLpId(), 0); | |
| 75 | - } | |
| 76 | - } | |
| 77 | - if (wantLpInfo.scheduleDate == null) { | |
| 78 | - wantLpInfo.scheduleDate = spi.getScheduleDate(); | |
| 79 | - } | |
| 80 | - | |
| 81 | - // 累计记录每个排班班次出现次数 | |
| 82 | - String lpId_spi = spi.getLp().toString(); | |
| 83 | - wantLpInfo.lpBcCount.put(lpId_spi, wantLpInfo.lpBcCount.get(lpId_spi) + 1); | |
| 84 | - | |
| 85 | - } | |
| 86 | - | |
| 87 | - @Override | |
| 88 | - public boolean supportsReverse() { | |
| 89 | - return true; | |
| 90 | - } | |
| 91 | - | |
| 92 | - @Override | |
| 93 | - public void reverse(Serializable context, Object o) throws Exception { | |
| 94 | - WantLpInfo wantLpInfo = (WantLpInfo) context; | |
| 95 | - | |
| 96 | - // 清空数据,下一天继续迭代 | |
| 97 | - wantLpInfo.lpBcCount.clear(); | |
| 98 | - wantLpInfo.lpNamesMap.clear(); | |
| 99 | - wantLpInfo.scheduleDate = null; | |
| 100 | - wantLpInfo.validInfoList.clear(); | |
| 101 | - | |
| 102 | -// System.out.println("reverse"); | |
| 103 | - | |
| 104 | - } | |
| 105 | - | |
| 106 | - @Override | |
| 107 | - public Class<?> getResultType() { | |
| 108 | - return List.class; | |
| 109 | - } | |
| 110 | - | |
| 111 | - @Override | |
| 112 | - public Object getResult(Serializable context) throws Exception { | |
| 113 | - WantLpInfo wantLpInfo = (WantLpInfo) context; | |
| 114 | - | |
| 115 | - SimpleDateFormat sf = new SimpleDateFormat("yyyy年MM月dd日"); | |
| 116 | - String infoFormat = "日期(%s),路牌(%s),没有排班班次"; | |
| 117 | - | |
| 118 | - for (String lpId : wantLpInfo.lpBcCount.keySet()) { | |
| 119 | - if (wantLpInfo.lpBcCount.get(lpId) == 0) { | |
| 120 | - // 排班没有班次 | |
| 121 | - ValidateResults_output.ValidInfo validInfo = new ValidateResults_output.ValidInfo(); | |
| 122 | - validInfo.setSd(wantLpInfo.scheduleDate); | |
| 123 | - validInfo.setDesc(String.format( | |
| 124 | - infoFormat, | |
| 125 | - sf.format(wantLpInfo.scheduleDate), | |
| 126 | - wantLpInfo.lpNamesMap.get(lpId)) | |
| 127 | - ); | |
| 128 | - wantLpInfo.validInfoList.add(validInfo); | |
| 129 | - } | |
| 130 | - } | |
| 131 | - | |
| 132 | - System.out.println("ValidWantLpFunction==>" + wantLpInfo.lpBcCount); | |
| 133 | - | |
| 134 | - return wantLpInfo.validInfoList; | |
| 135 | - } | |
| 136 | - | |
| 137 | -} | |
| 138 | - | |
| 139 | - | |
| 140 | - | |
| 141 | - | |
| 142 | - | |
| 143 | - | |
| 144 | - | |
| 145 | - | |
| 1 | +package com.bsth.service.schedule.impl.plan.kBase1.core.validate; | |
| 2 | + | |
| 3 | +import com.bsth.entity.schedule.SchedulePlanInfo; | |
| 4 | +import com.bsth.service.schedule.impl.plan.kBase1.core.ttinfo.LpInfoResult_output; | |
| 5 | +import org.kie.api.runtime.rule.AccumulateFunction; | |
| 6 | + | |
| 7 | +import java.io.*; | |
| 8 | +import java.text.SimpleDateFormat; | |
| 9 | +import java.util.*; | |
| 10 | + | |
| 11 | +/** | |
| 12 | + * 计算缺少路牌错误。 | |
| 13 | + * 同一天,如果有时刻表路牌没有执行到,统计。 | |
| 14 | + * 注意:使用这个函数时,要一天计算一次,多天计算无意义。 | |
| 15 | + */ | |
| 16 | +public class ValidWantLpFunction implements AccumulateFunction { | |
| 17 | + @Override | |
| 18 | + public void writeExternal(ObjectOutput out) throws IOException { | |
| 19 | + } | |
| 20 | + | |
| 21 | + @Override | |
| 22 | + public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException { | |
| 23 | + | |
| 24 | + } | |
| 25 | + | |
| 26 | + protected static class WantLpInfo implements Externalizable { | |
| 27 | + /** 错误描述 */ | |
| 28 | + public List<ValidateResults_output.ValidInfo> validInfoList = new ArrayList<>(); | |
| 29 | + /** 每天的路牌班次数量 */ | |
| 30 | + public Map<String, Integer> lpBcCount = new HashMap<>(); | |
| 31 | + /** 每天的路牌名字对应 */ | |
| 32 | + public Map<String, String> lpNamesMap = new HashMap<>(); | |
| 33 | + /** 排班日期 */ | |
| 34 | + public Date scheduleDate; | |
| 35 | + | |
| 36 | + public WantLpInfo() { | |
| 37 | + | |
| 38 | + } | |
| 39 | + | |
| 40 | + @Override | |
| 41 | + public void writeExternal(ObjectOutput out) throws IOException { | |
| 42 | + out.writeObject(validInfoList); | |
| 43 | + } | |
| 44 | + | |
| 45 | + @Override | |
| 46 | + public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException { | |
| 47 | + validInfoList = (List<ValidateResults_output.ValidInfo>) in.readObject(); | |
| 48 | + } | |
| 49 | + } | |
| 50 | + | |
| 51 | + @Override | |
| 52 | + public Serializable createContext() { | |
| 53 | + return new WantLpInfo(); | |
| 54 | + } | |
| 55 | + | |
| 56 | + @Override | |
| 57 | + public void init(Serializable serializable) throws Exception { | |
| 58 | + // TODO: | |
| 59 | +// System.out.println("init"); | |
| 60 | + } | |
| 61 | + | |
| 62 | + @Override | |
| 63 | + public void accumulate(Serializable context, Object o) { | |
| 64 | + WantLpInfo wantLpInfo = (WantLpInfo) context; | |
| 65 | + ValidateResource validateResource = (ValidateResource) o; | |
| 66 | + | |
| 67 | + SchedulePlanInfo spi = validateResource.getSpi(); | |
| 68 | + List<LpInfoResult_output> lpiList = validateResource.getLpiList(); | |
| 69 | + | |
| 70 | + // 获取当天所有路牌信息,每个验证对象都带当天所有路牌信息,只需判定一次 | |
| 71 | + if (wantLpInfo.lpNamesMap.isEmpty()) { | |
| 72 | + for (LpInfoResult_output lpInfoResult_output: lpiList) { | |
| 73 | + wantLpInfo.lpNamesMap.put(lpInfoResult_output.getLpId(), lpInfoResult_output.getLpName()); | |
| 74 | + wantLpInfo.lpBcCount.put(lpInfoResult_output.getLpId(), 0); | |
| 75 | + } | |
| 76 | + } | |
| 77 | + if (wantLpInfo.scheduleDate == null) { | |
| 78 | + wantLpInfo.scheduleDate = spi.getScheduleDate(); | |
| 79 | + } | |
| 80 | + | |
| 81 | + // 累计记录每个排班班次出现次数 | |
| 82 | + String lpId_spi = spi.getLp().toString(); | |
| 83 | + wantLpInfo.lpBcCount.put(lpId_spi, wantLpInfo.lpBcCount.get(lpId_spi) + 1); | |
| 84 | + | |
| 85 | + } | |
| 86 | + | |
| 87 | + @Override | |
| 88 | + public boolean supportsReverse() { | |
| 89 | + return true; | |
| 90 | + } | |
| 91 | + | |
| 92 | + @Override | |
| 93 | + public void reverse(Serializable context, Object o) throws Exception { | |
| 94 | + WantLpInfo wantLpInfo = (WantLpInfo) context; | |
| 95 | + | |
| 96 | + // 清空数据,下一天继续迭代 | |
| 97 | + wantLpInfo.lpBcCount.clear(); | |
| 98 | + wantLpInfo.lpNamesMap.clear(); | |
| 99 | + wantLpInfo.scheduleDate = null; | |
| 100 | + wantLpInfo.validInfoList.clear(); | |
| 101 | + | |
| 102 | +// System.out.println("reverse"); | |
| 103 | + | |
| 104 | + } | |
| 105 | + | |
| 106 | + @Override | |
| 107 | + public Class<?> getResultType() { | |
| 108 | + return List.class; | |
| 109 | + } | |
| 110 | + | |
| 111 | + @Override | |
| 112 | + public Object getResult(Serializable context) throws Exception { | |
| 113 | + WantLpInfo wantLpInfo = (WantLpInfo) context; | |
| 114 | + | |
| 115 | + SimpleDateFormat sf = new SimpleDateFormat("yyyy年MM月dd日"); | |
| 116 | + String infoFormat = "日期(%s),路牌(%s),没有排班班次"; | |
| 117 | + | |
| 118 | + for (String lpId : wantLpInfo.lpBcCount.keySet()) { | |
| 119 | + if (wantLpInfo.lpBcCount.get(lpId) == 0) { | |
| 120 | + // 排班没有班次 | |
| 121 | + ValidateResults_output.ValidInfo validInfo = new ValidateResults_output.ValidInfo(); | |
| 122 | + validInfo.setSd(wantLpInfo.scheduleDate); | |
| 123 | + validInfo.setDesc(String.format( | |
| 124 | + infoFormat, | |
| 125 | + sf.format(wantLpInfo.scheduleDate), | |
| 126 | + wantLpInfo.lpNamesMap.get(lpId)) | |
| 127 | + ); | |
| 128 | + wantLpInfo.validInfoList.add(validInfo); | |
| 129 | + } | |
| 130 | + } | |
| 131 | + | |
| 132 | + System.out.println("ValidWantLpFunction==>" + wantLpInfo.lpBcCount); | |
| 133 | + | |
| 134 | + return wantLpInfo.validInfoList; | |
| 135 | + } | |
| 136 | + | |
| 137 | +} | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | ... | ... |
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
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
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; | |
| 2 | - | |
| 3 | -import com.bsth.entity.schedule.SchedulePlanInfo; | |
| 4 | -import com.bsth.service.schedule.rules.ttinfo.LpInfoResult_output; | |
| 5 | - | |
| 6 | -import java.util.Date; | |
| 7 | -import java.util.List; | |
| 8 | - | |
| 9 | -/** | |
| 10 | - * 验证操作dsl类。 | |
| 11 | - */ | |
| 12 | -public class ValidateResource { | |
| 13 | - /** 具体日期 */ | |
| 14 | - private Date sd; | |
| 15 | - /** 当天排班计划 */ | |
| 16 | - private SchedulePlanInfo spi; | |
| 17 | - /** 当天所有路牌信息 */ | |
| 18 | - private List<LpInfoResult_output> lpiList; | |
| 19 | - | |
| 20 | - public Date getSd() { | |
| 21 | - return sd; | |
| 22 | - } | |
| 23 | - | |
| 24 | - public void setSd(Date sd) { | |
| 25 | - this.sd = sd; | |
| 26 | - } | |
| 27 | - | |
| 28 | - public SchedulePlanInfo getSpi() { | |
| 29 | - return spi; | |
| 30 | - } | |
| 31 | - | |
| 32 | - public void setSpi(SchedulePlanInfo spi) { | |
| 33 | - this.spi = spi; | |
| 34 | - } | |
| 35 | - | |
| 36 | - public List<LpInfoResult_output> getLpiList() { | |
| 37 | - return lpiList; | |
| 38 | - } | |
| 39 | - | |
| 40 | - public void setLpiList(List<LpInfoResult_output> lpiList) { | |
| 41 | - this.lpiList = lpiList; | |
| 42 | - } | |
| 43 | -} | |
| 1 | +package com.bsth.service.schedule.impl.plan.kBase1.core.validate; | |
| 2 | + | |
| 3 | +import com.bsth.entity.schedule.SchedulePlanInfo; | |
| 4 | +import com.bsth.service.schedule.impl.plan.kBase1.core.ttinfo.LpInfoResult_output; | |
| 5 | + | |
| 6 | +import java.util.Date; | |
| 7 | +import java.util.List; | |
| 8 | + | |
| 9 | +/** | |
| 10 | + * 验证操作dsl类。 | |
| 11 | + */ | |
| 12 | +public class ValidateResource { | |
| 13 | + /** 具体日期 */ | |
| 14 | + private Date sd; | |
| 15 | + /** 当天排班计划 */ | |
| 16 | + private SchedulePlanInfo spi; | |
| 17 | + /** 当天所有路牌信息 */ | |
| 18 | + private List<LpInfoResult_output> lpiList; | |
| 19 | + | |
| 20 | + public Date getSd() { | |
| 21 | + return sd; | |
| 22 | + } | |
| 23 | + | |
| 24 | + public void setSd(Date sd) { | |
| 25 | + this.sd = sd; | |
| 26 | + } | |
| 27 | + | |
| 28 | + public SchedulePlanInfo getSpi() { | |
| 29 | + return spi; | |
| 30 | + } | |
| 31 | + | |
| 32 | + public void setSpi(SchedulePlanInfo spi) { | |
| 33 | + this.spi = spi; | |
| 34 | + } | |
| 35 | + | |
| 36 | + public List<LpInfoResult_output> getLpiList() { | |
| 37 | + return lpiList; | |
| 38 | + } | |
| 39 | + | |
| 40 | + public void setLpiList(List<LpInfoResult_output> lpiList) { | |
| 41 | + this.lpiList = lpiList; | |
| 42 | + } | |
| 43 | +} | ... | ... |
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
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
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
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/java/com/bsth/service/sys/RoleService.java
src/main/java/com/bsth/service/sys/impl/RoleServiceImpl.java
src/main/resources/application-prod.properties
| ... | ... | @@ -26,4 +26,4 @@ spring.datasource.validation-query=select 1 |
| 26 | 26 | ## gateway real data |
| 27 | 27 | http.gps.real.url= http://192.168.40.82:8080/transport_server/rtgps/ |
| 28 | 28 | ## gateway send directive |
| 29 | -http.send.directive = http://192.168.40.82:8080/transport_server/message/ | |
| 30 | 29 | \ No newline at end of file |
| 30 | +http.send.directive = http://192.168.40.82:8080/transport_server/message/ | ... | ... |
src/main/resources/datatools/ktrs/carsDataOutput.ktr
| ... | ... | @@ -10,13 +10,18 @@ |
| 10 | 10 | <directory>/</directory> |
| 11 | 11 | <parameters> |
| 12 | 12 | <parameter> |
| 13 | + <name>QUERY</name> | |
| 14 | + <default_value/> | |
| 15 | + <description>查询</description> | |
| 16 | + </parameter> | |
| 17 | + <parameter> | |
| 13 | 18 | <name>cgsbm_in</name> |
| 14 | 19 | <default_value/> |
| 15 | 20 | <description>分公司编码</description> |
| 16 | 21 | </parameter> |
| 17 | 22 | <parameter> |
| 18 | 23 | <name>filepath</name> |
| 19 | - <default_value/> | |
| 24 | + <default_value>1=1</default_value> | |
| 20 | 25 | <description>excel文件路径</description> |
| 21 | 26 | </parameter> |
| 22 | 27 | </parameters> |
| ... | ... | @@ -192,6 +197,102 @@ |
| 192 | 197 | </attributes> |
| 193 | 198 | </connection> |
| 194 | 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> | |
| 195 | 296 | <name>xlab_mysql_youle</name> |
| 196 | 297 | <server>101.231.124.8</server> |
| 197 | 298 | <type>MYSQL</type> |
| ... | ... | @@ -270,6 +371,102 @@ |
| 270 | 371 | <attribute><code>USE_POOLING</code><attribute>N</attribute></attribute> |
| 271 | 372 | </attributes> |
| 272 | 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>公司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>公司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>公司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> | |
| 273 | 470 | <order> |
| 274 | 471 | <hop> <from>公司查询</from><to>分公司查询</to><enabled>Y</enabled> </hop> |
| 275 | 472 | <hop> <from>分公司查询</from><to>字段选择</to><enabled>Y</enabled> </hop> |
| ... | ... | @@ -480,7 +677,7 @@ |
| 480 | 677 | <name>字段选择</name> |
| 481 | 678 | <type>SelectValues</type> |
| 482 | 679 | <description/> |
| 483 | - <distribute>Y</distribute> | |
| 680 | + <distribute>N</distribute> | |
| 484 | 681 | <custom_distribution/> |
| 485 | 682 | <copies>1</copies> |
| 486 | 683 | <partitioning> |
| ... | ... | @@ -525,6 +722,36 @@ |
| 525 | 722 | </step> |
| 526 | 723 | |
| 527 | 724 | <step> |
| 725 | + <name>是否电车</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>//Script here

var 是否电车 = "否";

if(sfdc_cal == 0) {
 是否电车 = "否";
} else if (sfdc_cal == 1) {
 是否电车 = "是";
} else {
 是否电车 = "否";
}
</jsScript_script> | |
| 740 | + </jsScript> </jsScripts> <fields> <field> <name>是否电车</name> | |
| 741 | + <rename>是否电车</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> | |
| 528 | 755 | <name>添加查询常量</name> |
| 529 | 756 | <type>ScriptValueMod</type> |
| 530 | 757 | <description/> |
| ... | ... | @@ -566,7 +793,7 @@ |
| 566 | 793 | <schema_name/> |
| 567 | 794 | </partitioning> |
| 568 | 795 | <connection>bus_control_variable</connection> |
| 569 | - <sql>SELECT * FROM bsth_c_cars

</sql> | |
| 796 | + <sql>SELECT * FROM bsth_c_cars
where ${QUERY}</sql> | |
| 570 | 797 | <limit>0</limit> |
| 571 | 798 | <lookup/> |
| 572 | 799 | <execute_each_row>N</execute_each_row> |
| ... | ... | @@ -580,36 +807,6 @@ |
| 580 | 807 | </GUI> |
| 581 | 808 | </step> |
| 582 | 809 | |
| 583 | - <step> | |
| 584 | - <name>是否电车</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>//Script here

var 是否电车 = "否";

if(sfdc_cal) {
 是否电车 = "是";
}
</jsScript_script> | |
| 599 | - </jsScript> </jsScripts> <fields> <field> <name>是否电车</name> | |
| 600 | - <rename>是否电车</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 | 810 | <step_error_handling> |
| 614 | 811 | </step_error_handling> |
| 615 | 812 | <slave-step-copy-partition-distribution> | ... | ... |
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; | |
| 1 | +package com.bsth.service.schedule.impl.plan.kBase1.core.plan; | |
| 2 | 2 | |
| 3 | 3 | import org.joda.time.*; |
| 4 | 4 | import java.util.*; |
| 5 | 5 | |
| 6 | -import com.bsth.service.schedule.rules.plan.PlanCalcuParam_input; | |
| 7 | -import com.bsth.service.schedule.rules.plan.PlanResult; | |
| 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 | 8 | |
| 9 | 9 | import com.bsth.repository.schedule.TTInfoDetailRepository; |
| 10 | 10 | import com.bsth.repository.schedule.CarConfigInfoRepository; |
| ... | ... | @@ -12,10 +12,10 @@ import com.bsth.repository.schedule.EmployeeConfigInfoRepository; |
| 12 | 12 | import com.bsth.repository.LineRepository; |
| 13 | 13 | import com.bsth.repository.BusinessRepository; |
| 14 | 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; | |
| 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 | 19 | import com.bsth.entity.Line; |
| 20 | 20 | import com.bsth.entity.Business; |
| 21 | 21 | |
| ... | ... | @@ -28,7 +28,7 @@ import com.bsth.entity.schedule.SchedulePlanInfo; |
| 28 | 28 | import org.slf4j.Logger |
| 29 | 29 | import org.joda.time.format.DateTimeFormat |
| 30 | 30 | import org.apache.commons.lang3.StringUtils |
| 31 | -import com.bsth.service.schedule.rules.shiftloop.ScheduleRule_Type; | |
| 31 | +import com.bsth.service.schedule.impl.plan.kBase1.core.shiftloop.ScheduleRule_Type; | |
| 32 | 32 | |
| 33 | 33 | |
| 34 | 34 | // 全局日志类(一般使用调用此规则的service类) | ... | ... |
src/main/resources/rules/rerun.drl renamed to src/main/resources/rules/kBase1_core_rerun.drl
| 1 | -package com.bsth.service.schedule.rerun; | |
| 1 | +package com.bsth.service.schedule.impl.plan.kBase1.core.rerun; | |
| 2 | 2 | |
| 3 | 3 | import org.joda.time.*; |
| 4 | 4 | import java.util.*; |
| 5 | 5 | |
| 6 | -import com.bsth.service.schedule.rules.shiftloop.ScheduleResult_output; | |
| 7 | -import com.bsth.service.schedule.rules.shiftloop.ScheduleResults_output; | |
| 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 | 8 | |
| 9 | -import com.bsth.service.schedule.rules.rerun.RerunRule_input; | |
| 10 | -import com.bsth.service.schedule.rules.rerun.RerunRule_param; | |
| 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 | 11 | |
| 12 | 12 | import com.bsth.repository.schedule.CarConfigInfoRepository; |
| 13 | 13 | import com.bsth.repository.schedule.EmployeeConfigInfoRepository; |
| 14 | 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 | |
| 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 | 19 | import com.bsth.entity.schedule.SchedulePlanInfo; |
| 20 | 20 | |
| 21 | 21 | // 全局日志类(一般使用调用此规则的service类) | ... | ... |
src/main/resources/rules/shiftloop_fb_2.drl renamed to src/main/resources/rules/kBase1_core_shiftloop.drl
| 1 | -package com.bsth.service.schedule.shiftloop; | |
| 1 | +package com.bsth.service.schedule.impl.plan.kBase1.core.shiftloop; | |
| 2 | 2 | |
| 3 | 3 | import org.joda.time.*; |
| 4 | 4 | import java.util.*; |
| 5 | 5 | |
| 6 | -import com.bsth.service.schedule.rules.ttinfo.LpInfoResult_output; | |
| 6 | +import com.bsth.service.schedule.impl.plan.kBase1.core.ttinfo.LpInfoResult_output; | |
| 7 | 7 | |
| 8 | 8 | import com.bsth.service.schedule.utils.Md5Util; |
| 9 | 9 | |
| 10 | -import com.bsth.service.schedule.rules.shiftloop.ScheduleCalcuParam_input; | |
| 11 | -import com.bsth.service.schedule.rules.shiftloop.ScheduleRule_input; | |
| 12 | -import com.bsth.service.schedule.rules.shiftloop.ScheduleRule_Type; | |
| 13 | -import com.bsth.service.schedule.rules.shiftloop.ScheduleResult_output; | |
| 14 | -import com.bsth.service.schedule.rules.shiftloop.ScheduleResults_output; | |
| 10 | +import com.bsth.service.schedule.impl.plan.kBase1.core.shiftloop.ScheduleCalcuParam_input; | |
| 11 | +import com.bsth.service.schedule.impl.plan.kBase1.core.shiftloop.ScheduleRule_input; | |
| 12 | +import com.bsth.service.schedule.impl.plan.kBase1.core.shiftloop.ScheduleRule_Type; | |
| 13 | +import com.bsth.service.schedule.impl.plan.kBase1.core.shiftloop.ScheduleResult_output; | |
| 14 | +import com.bsth.service.schedule.impl.plan.kBase1.core.shiftloop.ScheduleResults_output; | |
| 15 | 15 | |
| 16 | 16 | import com.bsth.entity.schedule.temp.SchedulePlanRuleResult; |
| 17 | 17 | |
| 18 | 18 | import com.bsth.entity.schedule.SchedulePlan; |
| 19 | 19 | |
| 20 | -import com.bsth.service.schedule.rules.ScheduleRuleService; | |
| 20 | +import com.bsth.service.schedule.impl.plan.ScheduleRuleService; | |
| 21 | 21 | |
| 22 | 22 | import org.slf4j.Logger; |
| 23 | 23 | ... | ... |
src/main/resources/rules/ttinfo.drl renamed to src/main/resources/rules/kBase1_core_ttinfo.drl
| 1 | -package com.bsth.service.schedule.ttinfo; | |
| 1 | +package com.bsth.service.schedule.impl.plan.kBase1.core.ttinfo; | |
| 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; | |
| 2 | 11 | |
| 3 | 12 | import org.joda.time.*; |
| 4 | 13 | import java.util.*; |
| 5 | 14 | |
| 6 | -import com.bsth.service.schedule.rules.ttinfo.TTInfoCalcuParam_input; | |
| 7 | -import com.bsth.service.schedule.rules.ttinfo.TTInfo_input; | |
| 8 | -import com.bsth.service.schedule.rules.ttinfo.TTInfoResult_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; | |
| 15 | +import com.bsth.service.schedule.impl.plan.kBase1.core.ttinfo.TTInfoCalcuParam_input; | |
| 16 | +import com.bsth.service.schedule.impl.plan.kBase1.core.ttinfo.TTInfo_input; | |
| 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.service.schedule.impl.plan.kBase1.core.ttinfo.LpInfoResult_output; | |
| 20 | +import com.bsth.service.schedule.impl.plan.kBase1.core.ttinfo.LpInfoResults_output; | |
| 12 | 21 | |
| 13 | -import com.bsth.service.schedule.rules.shiftloop.ScheduleRule_input; | |
| 22 | +import com.bsth.service.schedule.impl.plan.kBase1.core.shiftloop.ScheduleRule_input; | |
| 14 | 23 | |
| 15 | 24 | import com.bsth.repository.schedule.TTInfoDetailRepository; |
| 16 | 25 | ... | ... |
src/main/resources/rules/validplan.drl renamed to src/main/resources/rules/kBase1_core_validate.drl
| 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; | |
| 5 | -import com.bsth.service.schedule.rules.validate.ValidateResource; | |
| 4 | +import com.bsth.service.schedule.impl.plan.kBase1.core.ttinfo.LpInfoResult_output; | |
| 5 | +import com.bsth.service.schedule.impl.plan.kBase1.core.validate.ValidateResource; | |
| 6 | 6 | |
| 7 | 7 | import org.joda.time.*; |
| 8 | 8 | import java.util.*; | ... | ... |
src/main/resources/rules/ruleWrap.drl renamed to src/main/resources/rules/kBase2_wrap_rule.drl
| 1 | -package com.bsth.service.schedule.rulewrap; | |
| 1 | +package com.bsth.service.schedule.impl.plan.kBase2.wrap.rule; | |
| 2 | 2 | |
| 3 | 3 | import org.joda.time.*; |
| 4 | 4 | import java.util.*; |
| 5 | 5 | import org.slf4j.Logger; |
| 6 | 6 | |
| 7 | -import com.bsth.service.schedule.rules.shiftloop.ScheduleCalcuParam_input; | |
| 8 | -import com.bsth.service.schedule.rules.shiftloop.ScheduleRule_input; | |
| 9 | -import com.bsth.service.schedule.rules.shiftloop.ScheduleRule_Type; | |
| 7 | +import com.bsth.service.schedule.impl.plan.kBase1.core.shiftloop.ScheduleCalcuParam_input; | |
| 8 | +import com.bsth.service.schedule.impl.plan.kBase1.core.shiftloop.ScheduleRule_input; | |
| 9 | +import com.bsth.service.schedule.impl.plan.kBase1.core.shiftloop.ScheduleRule_Type; | |
| 10 | +import com.bsth.service.schedule.impl.plan.kBase1.core.rerun.RerunRule_input; | |
| 10 | 11 | |
| 11 | 12 | import com.bsth.repository.schedule.RerunRuleRepository; |
| 12 | 13 | import com.bsth.repository.schedule.ScheduleRule1FlatRepository; |
| 13 | 14 | |
| 14 | -import com.bsth.service.schedule.rules.rerun.RerunRule_input; | |
| 15 | -import com.bsth.service.schedule.rules.ScheduleRuleService; | |
| 15 | +import com.bsth.service.schedule.impl.plan.ScheduleRuleService; | |
| 16 | 16 | |
| 17 | 17 | import com.bsth.entity.Line; |
| 18 | 18 | import com.bsth.entity.schedule.CarConfigInfo | ... | ... |
src/main/resources/rules/kBase3_validate_rule.drl
0 → 100644
| 1 | +package com.bsth.service.schedule.impl.plan.kBase3.validate.rule; | |
| 2 | + | |
| 3 | +import accumulate com.bsth.service.schedule.impl.plan.kBase3.validate.rule.ErrorInfoFunction srif; | |
| 4 | +import accumulate com.bsth.service.schedule.impl.plan.kBase3.validate.timetable.ErrorBcCountFunction ecount; | |
| 5 | + | |
| 6 | +import org.joda.time.*; | |
| 7 | +import java.util.*; | |
| 8 | + | |
| 9 | +import com.bsth.service.schedule.impl.plan.kBase3.validate.rule.CalcuParam; | |
| 10 | +import com.bsth.service.schedule.impl.plan.kBase3.validate.rule.ValidateRuleResult; | |
| 11 | +import com.bsth.service.schedule.impl.plan.kBase3.validate.rule.ValidateRuleResult.ErrorInfo; | |
| 12 | +import com.bsth.service.schedule.impl.plan.kBase3.validate.rule.WrapInput; | |
| 13 | + | |
| 14 | +import com.bsth.repository.schedule.ScheduleRule1FlatRepository | |
| 15 | +import com.bsth.repository.schedule.CarConfigInfoRepository; | |
| 16 | +import com.bsth.repository.schedule.GuideboardInfoRepository; | |
| 17 | +import com.bsth.repository.schedule.EmployeeConfigInfoRepository; | |
| 18 | + | |
| 19 | +import com.bsth.entity.schedule.rule.ScheduleRule1Flat; | |
| 20 | +import com.bsth.entity.schedule.CarConfigInfo; | |
| 21 | +import com.bsth.entity.schedule.GuideboardInfo; | |
| 22 | +import com.bsth.entity.schedule.EmployeeConfigInfo; | |
| 23 | + | |
| 24 | +import org.slf4j.Logger | |
| 25 | + | |
| 26 | +// 全局日志 | |
| 27 | +global Logger LOG; | |
| 28 | + | |
| 29 | +// repository查询 | |
| 30 | +global CarConfigInfoRepository ccRepo; | |
| 31 | +global GuideboardInfoRepository lpRepo; | |
| 32 | +global EmployeeConfigInfoRepository ecRepo; | |
| 33 | +global ScheduleRule1FlatRepository ruleRepo; | |
| 34 | + | |
| 35 | +// return输出 | |
| 36 | +global ValidateRuleResult result; | |
| 37 | + | |
| 38 | + | |
| 39 | +//------------------ 第一阶段、车辆信息,路牌信息,人员信息载入 -----------------// | |
| 40 | + | |
| 41 | +// 1、车辆信息载入 | |
| 42 | +declare CarConfig_Wraps | |
| 43 | + xlId: Integer // 线路Id | |
| 44 | + ccMap: Map // 车辆配置Map Map<车辆自编号, CarConfigInfo> | |
| 45 | +end | |
| 46 | + | |
| 47 | +rule "calcu_CarConfig_Wraps" | |
| 48 | + salience 800 | |
| 49 | + when | |
| 50 | + $param: CalcuParam($xlId: xlId) | |
| 51 | + then | |
| 52 | + List ccInfos = ccRepo.findByXlId($xlId); | |
| 53 | + | |
| 54 | + CarConfig_Wraps carConfig_wraps = new CarConfig_Wraps(); | |
| 55 | + carConfig_wraps.setXlId($xlId); | |
| 56 | + carConfig_wraps.setCcMap(new HashMap()); | |
| 57 | + | |
| 58 | + for (int i = 0; i < ccInfos.size(); i++) { | |
| 59 | + CarConfigInfo ccInfo = (CarConfigInfo) ccInfos.get(i); | |
| 60 | + if (!ccInfo.getIsCancel()) { | |
| 61 | + carConfig_wraps.getCcMap().put(ccInfo.getCl().getInsideCode(), ccInfo); | |
| 62 | + } | |
| 63 | + } | |
| 64 | + | |
| 65 | + insert(carConfig_wraps); | |
| 66 | + | |
| 67 | + LOG.info("第一阶段 --> 1、车辆信息载入 calcu_CarConfig_Wraps 有效配置车辆数={}", ccInfos.size()); | |
| 68 | +end | |
| 69 | + | |
| 70 | +// 2、路牌信息载入 | |
| 71 | +declare Lp_Wraps | |
| 72 | + xlId: Integer // 线路Id | |
| 73 | + lpMap: Map // 路牌Map Map<id, GuideboardInfo> | |
| 74 | +end | |
| 75 | + | |
| 76 | +rule "calcu_Lp_Wraps" | |
| 77 | + salience 800 | |
| 78 | + when | |
| 79 | + $param: CalcuParam($xlId: xlId) | |
| 80 | + then | |
| 81 | + List lpInfos = lpRepo.findByXlId($xlId); | |
| 82 | + Lp_Wraps lp_wraps = new Lp_Wraps(); | |
| 83 | + lp_wraps.setXlId($xlId); | |
| 84 | + lp_wraps.setLpMap(new HashMap()); | |
| 85 | + | |
| 86 | + for (int i = 0; i < lpInfos.size(); i++) { | |
| 87 | + GuideboardInfo lpInfo = (GuideboardInfo) lpInfos.get(i); | |
| 88 | + if (!lpInfo.getIsCancel()) { | |
| 89 | + lp_wraps.getLpMap().put(lpInfo.getId(), lpInfo); | |
| 90 | + } | |
| 91 | + } | |
| 92 | + | |
| 93 | + insert(lp_wraps); | |
| 94 | + | |
| 95 | + LOG.info("第一阶段 --> 2、路牌信息载入 calcu_Lp_Wraps 有效路牌数={}", lpInfos.size()); | |
| 96 | + | |
| 97 | +end | |
| 98 | + | |
| 99 | +// 3、人员信息载入 | |
| 100 | +declare EmployeeConfig_Wraps | |
| 101 | + xlId: Integer // 线路Id | |
| 102 | + ecMap: Map // 人员配置Map Map<id, EmployeeConfigInfo> | |
| 103 | +end | |
| 104 | + | |
| 105 | +rule "calcu_EmployeeConfig_Wraps" | |
| 106 | + salience 800 | |
| 107 | + when | |
| 108 | + $param: CalcuParam($xlId: xlId) | |
| 109 | + then | |
| 110 | + List ecInfos = ecRepo.findByXlId($xlId); | |
| 111 | + | |
| 112 | + EmployeeConfig_Wraps employeeConfig_wraps = new EmployeeConfig_Wraps(); | |
| 113 | + employeeConfig_wraps.setXlId($xlId); | |
| 114 | + employeeConfig_wraps.setEcMap(new HashMap()); | |
| 115 | + | |
| 116 | + for (int i = 0; i < ecInfos.size(); i++) { | |
| 117 | + EmployeeConfigInfo ecInfo = (EmployeeConfigInfo) ecInfos.get(i); | |
| 118 | + if (!ecInfo.getIsCancel()) { | |
| 119 | + employeeConfig_wraps.getEcMap().put(ecInfo.getId(), ecInfo); | |
| 120 | + } | |
| 121 | + } | |
| 122 | + | |
| 123 | + insert(employeeConfig_wraps); | |
| 124 | + | |
| 125 | + LOG.info("第一阶段 --> 3、人员信息载入 calcu_EmployeeConfig_Wraps 有效人员配置数={}", ecInfos.size()); | |
| 126 | +end | |
| 127 | + | |
| 128 | +//------------------ 第二阶段、规则载入,计算相关数量 -----------------// | |
| 129 | + | |
| 130 | +declare Rule_Wraps | |
| 131 | + xlId: Integer // 线路Id | |
| 132 | + qyrq: Date // 启用日期 | |
| 133 | + rule: ScheduleRule1Flat // ScheduleRule1Flat规则 | |
| 134 | +end | |
| 135 | + | |
| 136 | +rule "calcu_schedule_rule_wrap" | |
| 137 | + salience 700 | |
| 138 | + when | |
| 139 | + $param: CalcuParam($xlId: xlId) | |
| 140 | + $rule: ScheduleRule1Flat($qyrq: qyrq) from ruleRepo.findByXlId($xlId) | |
| 141 | + then | |
| 142 | + Rule_Wraps rw = new Rule_Wraps(); | |
| 143 | + rw.setXlId($xlId); | |
| 144 | + rw.setQyrq($qyrq); | |
| 145 | + rw.setRule($rule); | |
| 146 | + insert(rw); | |
| 147 | +end | |
| 148 | + | |
| 149 | +rule "calcu_all_rule_count" | |
| 150 | + salience 600 | |
| 151 | + when | |
| 152 | + $param: CalcuParam($xlId: xlId, $fd: fromDate, $td: toDate) | |
| 153 | + $allList: ArrayList() from collect(Rule_Wraps(xlId == $xlId)) | |
| 154 | + then | |
| 155 | + result.setXlId($xlId); | |
| 156 | + result.setCount($allList.size()); | |
| 157 | + | |
| 158 | + LOG.info("第二阶段 --> 规则总数={}", $allList.size()); | |
| 159 | +end | |
| 160 | + | |
| 161 | +rule "calcu_all_qy_rule_count" | |
| 162 | + salience 500 | |
| 163 | + when | |
| 164 | + $param: CalcuParam($xlId: xlId, $fd: fromDate, $td: toDate) | |
| 165 | + $qyList: ArrayList() from collect( | |
| 166 | + Rule_Wraps(xlId == $xlId, qyrq.getTime() <= $td.getMillis())) | |
| 167 | + then | |
| 168 | + result.setXlId($xlId); | |
| 169 | + result.setQyCount($qyList.size()); | |
| 170 | + | |
| 171 | + LOG.info("第二阶段 --> 启用规则数={}", $qyList.size()); | |
| 172 | + | |
| 173 | +end | |
| 174 | + | |
| 175 | +//------------------ 第三阶段、规则判定 -----------------// | |
| 176 | + | |
| 177 | +rule "calcu_Wrap_input" | |
| 178 | + salience 400 | |
| 179 | + when | |
| 180 | + $param: CalcuParam($xlId: xlId, $fd: fromDate, $td: toDate) | |
| 181 | + $qy_rule: Rule_Wraps(xlId == $xlId, qyrq.getTime() <= $td.getMillis()) | |
| 182 | + $cc: CarConfig_Wraps(xlId == $xlId) | |
| 183 | + $lp: Lp_Wraps(xlId == $xlId) | |
| 184 | + $ec: EmployeeConfig_Wraps(xlId == $xlId) | |
| 185 | + then | |
| 186 | + WrapInput wr = new WrapInput( | |
| 187 | + $qy_rule.getRule(), | |
| 188 | + $cc.getCcMap(), | |
| 189 | + $lp.getLpMap(), | |
| 190 | + $ec.getEcMap() | |
| 191 | + ); | |
| 192 | + insert(wr); | |
| 193 | +end | |
| 194 | + | |
| 195 | +rule "calcu_error_info" | |
| 196 | + salience 300 | |
| 197 | + when | |
| 198 | + $param: CalcuParam($xlId: xlId) | |
| 199 | + $errorMap: Map() from accumulate ($wr: WrapInput(xlId == $xlId), srif($wr)) | |
| 200 | + then | |
| 201 | + result.setQyErrorCount($errorMap.size()); | |
| 202 | + result.getErrorInfos().addAll($errorMap.values()); | |
| 203 | + | |
| 204 | + LOG.info("第三阶段 --> 规则总数={}, 启用规则数={}, 错误的启用规则数={}", | |
| 205 | + result.getCount(), result.getQyCount(), result.getQyErrorCount()); | |
| 206 | + | |
| 207 | +end | |
| 208 | + | |
| 209 | + | ... | ... |
src/main/resources/rules/ttinfo2.drl renamed to src/main/resources/rules/kBase3_validate_timetable.drl
| 1 | -package com.bsth.service.schedule.ttinfo2; | |
| 1 | +package com.bsth.service.schedule.impl.plan.kBase3.validate.timetable; | |
| 2 | 2 | |
| 3 | 3 | import org.joda.time.*; |
| 4 | 4 | import java.util.*; |
| 5 | 5 | import org.apache.commons.lang3.StringUtils; |
| 6 | 6 | |
| 7 | -import com.bsth.service.schedule.rules.ttinfo2.Result; | |
| 8 | -import com.bsth.service.schedule.rules.ttinfo2.Result.StatInfo; | |
| 9 | -import com.bsth.service.schedule.rules.ttinfo2.CalcuParam; | |
| 7 | +import com.bsth.service.schedule.impl.plan.kBase3.validate.timetable.Result; | |
| 8 | +import com.bsth.service.schedule.impl.plan.kBase3.validate.timetable.Result.StatInfo; | |
| 9 | +import com.bsth.service.schedule.impl.plan.kBase3.validate.timetable.CalcuParam; | |
| 10 | 10 | |
| 11 | 11 | import com.bsth.entity.schedule.TTInfo; |
| 12 | 12 | import com.bsth.entity.schedule.TTInfoDetail; |
| 13 | 13 | import com.bsth.entity.Line; |
| 14 | 14 | |
| 15 | -import com.bsth.repository.LineRepository; | |
| 16 | 15 | import com.bsth.repository.schedule.TTInfoDetailRepository; |
| 17 | 16 | |
| 18 | 17 | import org.slf4j.Logger |
| ... | ... | @@ -23,7 +22,6 @@ import java.lang.Object; |
| 23 | 22 | |
| 24 | 23 | // 全局日志类(一般使用调用此规则的service类) |
| 25 | 24 | global Logger log; |
| 26 | -global LineRepository lineRepository; | |
| 27 | 25 | global TTInfoDetailRepository tTInfoDetailRepository; |
| 28 | 26 | |
| 29 | 27 | // 输出 |
| ... | ... | @@ -63,15 +61,14 @@ rule "calcu_iter_days" |
| 63 | 61 | $toDate: toDate, |
| 64 | 62 | $fromDate.isBefore($toDate) || $fromDate.isEqual($toDate) |
| 65 | 63 | ) |
| 64 | + $line: Line(id == $xlId) | |
| 66 | 65 | then |
| 67 | 66 | // 构造Calcu_iter_days_result对象,进行下一步计算 |
| 68 | 67 | Calcu_iter_days_result cidr = new Calcu_iter_days_result(); |
| 69 | 68 | Period p = new Period($fromDate, $toDate, PeriodType.days()); |
| 70 | 69 | |
| 71 | - Line line = (Line) lineRepository.findOne($xlId); | |
| 72 | - | |
| 73 | 70 | cidr.setXlId($xlId); |
| 74 | - cidr.setXlName(line.getName()); | |
| 71 | + cidr.setXlName($line.getName()); | |
| 75 | 72 | |
| 76 | 73 | cidr.setCalcu_day(new Integer(1)); |
| 77 | 74 | cidr.setCalcu_weekday(Integer.valueOf($fromDate.getDayOfWeek())); |
| ... | ... | @@ -311,6 +308,9 @@ rule "statinfo_result" // 统计计算结果 |
| 311 | 308 | $statInfo.setYybc($yybc); |
| 312 | 309 | $statInfo.setErrorbc($errorbc); |
| 313 | 310 | |
| 311 | + int lineVersion = ((TTInfoDetail) $ttInfoDetails_wrap.getBcInfoList().get(0)).getLineVersion(); | |
| 312 | + $statInfo.setLineVersion(lineVersion); | |
| 313 | + | |
| 314 | 314 | rs.getInfos().add($statInfo); |
| 315 | 315 | |
| 316 | 316 | end | ... | ... |
src/main/resources/static/apple-touch-icon-72x72.png
0 → 100644
17 KB
src/main/resources/static/assets/js/common.js
| ... | ... | @@ -57,7 +57,11 @@ function ajaxComplete(xhr, ts, succ){ |
| 57 | 57 | successHandle(JSON.parse(xhr.responseText), succ); |
| 58 | 58 | } |
| 59 | 59 | else if(ts == 'error'){ |
| 60 | - layer.alert(xhr.responseText, {icon: 2, title: '操作失败'}); | |
| 60 | + //添加自动跳转首页 | |
| 61 | + layer.alert(xhr.responseText + '<br> <span id="goIndex" style="color: #ff1f08;font-weight: bold;font-size: large;">1</span> 秒后回到首页', {icon: 2, title: '操作失败'}); | |
| 62 | + setTimeout(function(){ | |
| 63 | + window.location.href = '/'; | |
| 64 | + },1500) | |
| 61 | 65 | } |
| 62 | 66 | } |
| 63 | 67 | ... | ... |
src/main/resources/static/index.html
| ... | ... | @@ -287,7 +287,7 @@ |
| 287 | 287 | </div> |
| 288 | 288 | <div class="page-content-wrapper"> |
| 289 | 289 | <div id="pjax-container" class="page-content"></div> |
| 290 | - | |
| 290 | + <a name="xd_position"></a> | |
| 291 | 291 | <div id="route-container"> |
| 292 | 292 | <div ng-app="ScheduleApp"> |
| 293 | 293 | <div ng-controller="ScheduleAppController"> |
| ... | ... | @@ -339,9 +339,9 @@ |
| 339 | 339 | |
| 340 | 340 | </script> |
| 341 | 341 | <script> |
| 342 | - delete window.require; | |
| 343 | - delete window.exports; | |
| 344 | - delete window.module; | |
| 342 | + delete window.require; | |
| 343 | + delete window.exports; | |
| 344 | + delete window.module; | |
| 345 | 345 | </script> |
| 346 | 346 | <!-- jQuery --> |
| 347 | 347 | <script src="/metronic_v4.5.4/plugins/jquery.min.js" data-exclude=1></script> |
| ... | ... | @@ -415,145 +415,145 @@ |
| 415 | 415 | <!-- tipso JS --> |
| 416 | 416 | <script src="/metronic_v4.5.4/plugins/tipso/js/tipso.js"></script> |
| 417 | 417 | <script data-exclude=1> |
| 418 | - //初始打开的片段地址 | |
| 419 | - var initFragment = "^_^initFragment^_^"; | |
| 420 | - //静态文件目录 | |
| 421 | - var dir = '/pages/'; | |
| 422 | - //片段容器 | |
| 423 | - var pjaxContainer = '#pjax-container' | |
| 424 | - , angJsContainer = '#route-container'; | |
| 425 | - | |
| 426 | - $(document).ajaxError(function (event, jqxhr, settings, thrownError) { | |
| 427 | - if(jqxhr.status == 403){ | |
| 428 | - layer.closeAll(); | |
| 429 | - layer.alert(jqxhr.message?jqxhr.message:'访问被拒绝', {icon: 2, title: '操作失败'}); | |
| 430 | - } | |
| 431 | - }); | |
| 432 | - | |
| 433 | - $(function () { | |
| 434 | - $.get('/user/currentUser', function (user) { | |
| 435 | - $('#indexTopUName').text(user.userName); | |
| 436 | - }); | |
| 437 | - | |
| 438 | - //带 data-pjax 的链接由pjax加载 | |
| 439 | - $(document).pjax('a[data-pjax]', pjaxContainer); | |
| 440 | - | |
| 441 | - //pjax左菜单点击事件 | |
| 442 | - $(document).on('click', '#leftMenuSidebar a[data-pjax]', function () { | |
| 443 | - setTitle(this); | |
| 444 | - | |
| 445 | - $('#leftMenuSidebar li.nav-item.active').removeClass('active'); | |
| 446 | - $(this).parent().addClass('active'); | |
| 447 | - showPjax(); | |
| 448 | - }); | |
| 449 | - | |
| 450 | - //angularjs左菜单点击事件 | |
| 451 | - $(document).on('click', '#leftMenuSidebar a[data-angularjs]', function () { | |
| 452 | - setTitle(this); | |
| 453 | - | |
| 454 | - $('#leftMenuSidebar li.nav-item.active').removeClass('active'); | |
| 455 | - $(this).parent().addClass('active'); | |
| 456 | - showAngJs(); | |
| 457 | - }); | |
| 458 | - | |
| 459 | - //加载左菜单栏 | |
| 460 | - $get('/module/findByCurrentUser', null, | |
| 461 | - function (ms) { | |
| 462 | - var treeArray = createTreeData(ms); | |
| 463 | - treeArray.sort(function (a, b) { | |
| 464 | - return a.createDate - b.createDate; | |
| 465 | - }); | |
| 466 | - var menuHtml = template('menu_list_temp', {list: treeArray}); | |
| 467 | - $('#leftMenuSidebar').html(menuHtml); | |
| 468 | - | |
| 469 | - //----------- 检查URL ---------------- | |
| 470 | - var h = location.hash; | |
| 471 | - if (initFragment && initFragment != '') { | |
| 472 | - showPjax(); | |
| 473 | - //普通片段 | |
| 474 | - loadPage(initFragment); | |
| 475 | - //选中菜单 | |
| 476 | - $.each($('#leftMenuSidebar a'), function (i, item) { | |
| 477 | - if (urlPattern($(item).attr('href'), initFragment)) { | |
| 478 | - activeLeftMenu(item); | |
| 479 | - } | |
| 480 | - }); | |
| 481 | - } else if (h) { | |
| 482 | - //angularjs片段 | |
| 483 | - showAngJs(); | |
| 484 | - //选中菜单 | |
| 485 | - $.each($('#leftMenuSidebar a'), function (i, item) { | |
| 486 | - if ($(item).attr('href') == h) { | |
| 487 | - activeLeftMenu(item); | |
| 488 | - } | |
| 489 | - }); | |
| 490 | - } | |
| 491 | - else { | |
| 492 | - //加载主页 | |
| 493 | - loadPage('/pages/home.html'); | |
| 494 | - } | |
| 495 | - }); | |
| 496 | - | |
| 497 | - //修改密码 | |
| 498 | - $('#changePWD').on('click', function () { | |
| 499 | - $.get('/pages/permission/user/changePWD.html', function (content) { | |
| 500 | - layer.open({ | |
| 501 | - type: 1, | |
| 502 | - area: ['600px', '360px'], | |
| 503 | - content: content, | |
| 504 | - title: '修改密码', | |
| 505 | - shift: 5, | |
| 506 | - scrollbar: false, | |
| 507 | - success: function () { | |
| 508 | - } | |
| 509 | - }); | |
| 510 | - }); | |
| 511 | - }); | |
| 512 | - }); | |
| 513 | - | |
| 514 | - //modal关闭时销毁dom | |
| 515 | - $(document).on('hidden.bs.modal', '.modal', function () { | |
| 516 | - $(this).remove(); | |
| 517 | - }); | |
| 518 | - | |
| 519 | - //pjax加载完成事件 | |
| 520 | - $(document).on('pjax:success', function () { | |
| 521 | - var dicts = $(pjaxContainer).find('.nt-dictionary'); | |
| 522 | - dictionaryUtils.transformDom(dicts); | |
| 523 | - }); | |
| 524 | - | |
| 525 | - function loadPage(url) { | |
| 526 | - $.pjax({url: url, container: pjaxContainer}) | |
| 527 | - } | |
| 528 | - | |
| 529 | - function urlPattern(a, b) { | |
| 530 | - var r; | |
| 531 | - try { | |
| 532 | - r = a.substring(0, a.lastIndexOf('/')) == b.substring(0, b.lastIndexOf('/')); | |
| 533 | - } catch (e) { | |
| 534 | - r = false; | |
| 535 | - } | |
| 536 | - return r; | |
| 537 | - } | |
| 538 | - | |
| 539 | - function showPjax() { | |
| 540 | - $(angJsContainer).removeClass('page-content active').hide(); | |
| 541 | - $(pjaxContainer).addClass('page-content active'); | |
| 542 | - } | |
| 543 | - | |
| 544 | - function showAngJs() { | |
| 545 | - $(pjaxContainer).html('').removeClass('page-content active').hide(); | |
| 546 | - $(angJsContainer).addClass('page-content active'); | |
| 547 | - } | |
| 548 | - | |
| 549 | - function activeLeftMenu(item) { | |
| 550 | - $(item).parent('.nav-item').addClass('active').parent('.sub-menu').show().parent().addClass('open'); | |
| 551 | - setTitle(item); | |
| 552 | - } | |
| 553 | - | |
| 554 | - function setTitle(menuItem){ | |
| 555 | - document.title = $('span.title', menuItem).text(); | |
| 556 | - } | |
| 418 | + //初始打开的片段地址 | |
| 419 | + var initFragment = "^_^initFragment^_^"; | |
| 420 | + //静态文件目录 | |
| 421 | + var dir = '/pages/'; | |
| 422 | + //片段容器 | |
| 423 | + var pjaxContainer = '#pjax-container' | |
| 424 | + , angJsContainer = '#route-container'; | |
| 425 | + | |
| 426 | + $(document).ajaxError(function (event, jqxhr, settings, thrownError) { | |
| 427 | + if(jqxhr.status == 403){ | |
| 428 | + layer.closeAll(); | |
| 429 | + layer.alert(jqxhr.message?jqxhr.message:'访问被拒绝', {icon: 2, title: '操作失败'}); | |
| 430 | + } | |
| 431 | + }); | |
| 432 | + | |
| 433 | + $(function () { | |
| 434 | + $.get('/user/currentUser', function (user) { | |
| 435 | + $('#indexTopUName').text(user.userName); | |
| 436 | + }); | |
| 437 | + | |
| 438 | + //带 data-pjax 的链接由pjax加载 | |
| 439 | + $(document).pjax('a[data-pjax]', pjaxContainer); | |
| 440 | + | |
| 441 | + //pjax左菜单点击事件 | |
| 442 | + $(document).on('click', '#leftMenuSidebar a[data-pjax]', function () { | |
| 443 | + setTitle(this); | |
| 444 | + | |
| 445 | + $('#leftMenuSidebar li.nav-item.active').removeClass('active'); | |
| 446 | + $(this).parent().addClass('active'); | |
| 447 | + showPjax(); | |
| 448 | + }); | |
| 449 | + | |
| 450 | + //angularjs左菜单点击事件 | |
| 451 | + $(document).on('click', '#leftMenuSidebar a[data-angularjs]', function () { | |
| 452 | + setTitle(this); | |
| 453 | + | |
| 454 | + $('#leftMenuSidebar li.nav-item.active').removeClass('active'); | |
| 455 | + $(this).parent().addClass('active'); | |
| 456 | + showAngJs(); | |
| 457 | + }); | |
| 458 | + | |
| 459 | + //加载左菜单栏 | |
| 460 | + $get('/module/findByCurrentUser', null, | |
| 461 | + function (ms) { | |
| 462 | + var treeArray = createTreeData(ms); | |
| 463 | + treeArray.sort(function (a, b) { | |
| 464 | + return a.createDate - b.createDate; | |
| 465 | + }); | |
| 466 | + var menuHtml = template('menu_list_temp', {list: treeArray}); | |
| 467 | + $('#leftMenuSidebar').html(menuHtml); | |
| 468 | + | |
| 469 | + //----------- 检查URL ---------------- | |
| 470 | + var h = location.hash; | |
| 471 | + if (initFragment && initFragment != '') { | |
| 472 | + showPjax(); | |
| 473 | + //普通片段 | |
| 474 | + loadPage(initFragment); | |
| 475 | + //选中菜单 | |
| 476 | + $.each($('#leftMenuSidebar a'), function (i, item) { | |
| 477 | + if (urlPattern($(item).attr('href'), initFragment)) { | |
| 478 | + activeLeftMenu(item); | |
| 479 | + } | |
| 480 | + }); | |
| 481 | + } else if (h) { | |
| 482 | + //angularjs片段 | |
| 483 | + showAngJs(); | |
| 484 | + //选中菜单 | |
| 485 | + $.each($('#leftMenuSidebar a'), function (i, item) { | |
| 486 | + if ($(item).attr('href') == h) { | |
| 487 | + activeLeftMenu(item); | |
| 488 | + } | |
| 489 | + }); | |
| 490 | + } | |
| 491 | + else { | |
| 492 | + //加载主页 | |
| 493 | + loadPage('/pages/home.html'); | |
| 494 | + } | |
| 495 | + }); | |
| 496 | + | |
| 497 | + //修改密码 | |
| 498 | + $('#changePWD').on('click', function () { | |
| 499 | + $.get('/pages/permission/user/changePWD.html', function (content) { | |
| 500 | + layer.open({ | |
| 501 | + type: 1, | |
| 502 | + area: ['600px', '360px'], | |
| 503 | + content: content, | |
| 504 | + title: '修改密码', | |
| 505 | + shift: 5, | |
| 506 | + scrollbar: false, | |
| 507 | + success: function () { | |
| 508 | + } | |
| 509 | + }); | |
| 510 | + }); | |
| 511 | + }); | |
| 512 | + }); | |
| 513 | + | |
| 514 | + //modal关闭时销毁dom | |
| 515 | + $(document).on('hidden.bs.modal', '.modal', function () { | |
| 516 | + $(this).remove(); | |
| 517 | + }); | |
| 518 | + | |
| 519 | + //pjax加载完成事件 | |
| 520 | + $(document).on('pjax:success', function () { | |
| 521 | + var dicts = $(pjaxContainer).find('.nt-dictionary'); | |
| 522 | + dictionaryUtils.transformDom(dicts); | |
| 523 | + }); | |
| 524 | + | |
| 525 | + function loadPage(url) { | |
| 526 | + $.pjax({url: url, container: pjaxContainer}) | |
| 527 | + } | |
| 528 | + | |
| 529 | + function urlPattern(a, b) { | |
| 530 | + var r; | |
| 531 | + try { | |
| 532 | + r = a.substring(0, a.lastIndexOf('/')) == b.substring(0, b.lastIndexOf('/')); | |
| 533 | + } catch (e) { | |
| 534 | + r = false; | |
| 535 | + } | |
| 536 | + return r; | |
| 537 | + } | |
| 538 | + | |
| 539 | + function showPjax() { | |
| 540 | + $(angJsContainer).removeClass('page-content active').hide(); | |
| 541 | + $(pjaxContainer).addClass('page-content active'); | |
| 542 | + } | |
| 543 | + | |
| 544 | + function showAngJs() { | |
| 545 | + $(pjaxContainer).html('').removeClass('page-content active').hide(); | |
| 546 | + $(angJsContainer).addClass('page-content active'); | |
| 547 | + } | |
| 548 | + | |
| 549 | + function activeLeftMenu(item) { | |
| 550 | + $(item).parent('.nav-item').addClass('active').parent('.sub-menu').show().parent().addClass('open'); | |
| 551 | + setTitle(item); | |
| 552 | + } | |
| 553 | + | |
| 554 | + function setTitle(menuItem){ | |
| 555 | + document.title = $('span.title', menuItem).text(); | |
| 556 | + } | |
| 557 | 557 | |
| 558 | 558 | </script> |
| 559 | 559 | <!-- d3 --> |
| ... | ... | @@ -632,7 +632,6 @@ |
| 632 | 632 | data-exclude=1></script> |
| 633 | 633 | <!-- echarts4 误删 --> |
| 634 | 634 | <script src="/metronic_v4.5.4/plugins/echarts4/echarts.min.js"></script> |
| 635 | -<script src="/real_control_v2/assets/plugins/perfect-scrollbar/perfect-scrollbar.jquery.js" merge="plugins"></script> | |
| 636 | 635 | |
| 637 | 636 | </body> |
| 638 | 637 | </html> |
| 639 | 638 | \ No newline at end of file | ... | ... |