Commit bb1640465e089c7f508071ebf0757867aa8e13ed
Merge branch 'pudong' of http://222.66.0.204:8090/panzhaov5/bsth_control
into pudong
Showing
32 changed files
with
1668 additions
and
357 deletions
Too many changes to show.
To preserve performance only 32 of 97 files are displayed.
src/main/java/com/bsth/controller/StationController.java
| @@ -2,6 +2,8 @@ package com.bsth.controller; | @@ -2,6 +2,8 @@ package com.bsth.controller; | ||
| 2 | 2 | ||
| 3 | import java.util.Map; | 3 | import java.util.Map; |
| 4 | 4 | ||
| 5 | +import org.slf4j.Logger; | ||
| 6 | +import org.slf4j.LoggerFactory; | ||
| 5 | import org.springframework.beans.factory.annotation.Autowired; | 7 | import org.springframework.beans.factory.annotation.Autowired; |
| 6 | import org.springframework.web.bind.annotation.RequestMapping; | 8 | import org.springframework.web.bind.annotation.RequestMapping; |
| 7 | import org.springframework.web.bind.annotation.RequestMethod; | 9 | import org.springframework.web.bind.annotation.RequestMethod; |
| @@ -34,6 +36,9 @@ public class StationController extends BaseController<Station, Integer> { | @@ -34,6 +36,9 @@ public class StationController extends BaseController<Station, Integer> { | ||
| 34 | 36 | ||
| 35 | @Autowired | 37 | @Autowired |
| 36 | private StationService service; | 38 | private StationService service; |
| 39 | + | ||
| 40 | + /** 日志记录器 */ | ||
| 41 | + private static final Logger LOGGER = LoggerFactory.getLogger(StationController.class); | ||
| 37 | 42 | ||
| 38 | /** | 43 | /** |
| 39 | * @Description :TODO(根据坐标点匹配数据库中的站点) | 44 | * @Description :TODO(根据坐标点匹配数据库中的站点) |
| @@ -153,10 +158,13 @@ public class StationController extends BaseController<Station, Integer> { | @@ -153,10 +158,13 @@ public class StationController extends BaseController<Station, Integer> { | ||
| 153 | */ | 158 | */ |
| 154 | @RequestMapping(value="updateStationAndSectionCode" , method = RequestMethod.GET) | 159 | @RequestMapping(value="updateStationAndSectionCode" , method = RequestMethod.GET) |
| 155 | public int updateStationAndSectionCode(@RequestParam Integer stationCount, Integer sectionCount) { | 160 | public int updateStationAndSectionCode(@RequestParam Integer stationCount, Integer sectionCount) { |
| 161 | + System.out.println(stationCount+" _ "+ sectionCount ); | ||
| 156 | for(int i = 0; i < stationCount; i++) { | 162 | for(int i = 0; i < stationCount; i++) { |
| 163 | + System.out.println(stationCount); | ||
| 157 | GetUIDAndCode.getStationId(); | 164 | GetUIDAndCode.getStationId(); |
| 158 | } | 165 | } |
| 159 | for(int i = 0; i < sectionCount; i++) { | 166 | for(int i = 0; i < sectionCount; i++) { |
| 167 | + System.out.println(sectionCount); | ||
| 160 | GetUIDAndCode.getSectionId(); | 168 | GetUIDAndCode.getSectionId(); |
| 161 | } | 169 | } |
| 162 | return 1; | 170 | return 1; |
src/main/java/com/bsth/controller/forms/ExportController.java
| @@ -469,12 +469,13 @@ public class ExportController { | @@ -469,12 +469,13 @@ public class ExportController { | ||
| 469 | for (Operationservice l : operationservice) { | 469 | for (Operationservice l : operationservice) { |
| 470 | Map<String, Object> m = new HashMap<String, Object>(); | 470 | Map<String, Object> m = new HashMap<String, Object>(); |
| 471 | m.put("i", i); | 471 | m.put("i", i); |
| 472 | - m.put("xlName", l.getXlName()); | ||
| 473 | - m.put("jzl", l.getJzl()); | ||
| 474 | - m.put("xhl", l.getXhl()); | ||
| 475 | - m.put("xsgl", l.getXsgl()); | ||
| 476 | - m.put("emptMileage", l.getEmptMileage()); | ||
| 477 | - m.put("sjbc", l.getSjbc()); | 472 | + m.put("fgs", l.getFgs()!=null?l.getFgs():""); |
| 473 | + m.put("xlName", l.getXlName()!=null?l.getXlName():""); | ||
| 474 | + m.put("jzl", l.getJzl()!=null?l.getJzl():""); | ||
| 475 | + m.put("xhl", l.getXhl()!=null?l.getXhl():""); | ||
| 476 | + m.put("xsgl", l.getXsgl()!=null?l.getXsgl():""); | ||
| 477 | + m.put("emptMileage", l.getEmptMileage()!=null?l.getEmptMileage():""); | ||
| 478 | + m.put("sjbc", l.getSjbc()!=null?l.getSjbc():""); | ||
| 478 | resList.add(m); | 479 | resList.add(m); |
| 479 | i++; | 480 | i++; |
| 480 | } | 481 | } |
src/main/java/com/bsth/controller/schedule/core/CarConfigInfoController.java
| 1 | package com.bsth.controller.schedule.core; | 1 | package com.bsth.controller.schedule.core; |
| 2 | 2 | ||
| 3 | +import com.bsth.common.Constants; | ||
| 3 | import com.bsth.common.ResponseCode; | 4 | import com.bsth.common.ResponseCode; |
| 4 | import com.bsth.controller.schedule.BController; | 5 | import com.bsth.controller.schedule.BController; |
| 5 | import com.bsth.entity.schedule.CarConfigInfo; | 6 | import com.bsth.entity.schedule.CarConfigInfo; |
| 7 | +import com.bsth.entity.sys.CompanyAuthority; | ||
| 6 | import com.bsth.repository.schedule.CarConfigInfoRepository; | 8 | import com.bsth.repository.schedule.CarConfigInfoRepository; |
| 7 | import com.bsth.service.schedule.CarConfigInfoService; | 9 | import com.bsth.service.schedule.CarConfigInfoService; |
| 8 | import com.bsth.service.schedule.exception.ScheduleException; | 10 | import com.bsth.service.schedule.exception.ScheduleException; |
| @@ -12,6 +14,8 @@ import org.springframework.web.bind.annotation.RequestMethod; | @@ -12,6 +14,8 @@ import org.springframework.web.bind.annotation.RequestMethod; | ||
| 12 | import org.springframework.web.bind.annotation.RequestParam; | 14 | import org.springframework.web.bind.annotation.RequestParam; |
| 13 | import org.springframework.web.bind.annotation.RestController; | 15 | import org.springframework.web.bind.annotation.RestController; |
| 14 | 16 | ||
| 17 | +import javax.servlet.http.HttpServletRequest; | ||
| 18 | +import javax.servlet.http.HttpSession; | ||
| 15 | import java.util.HashMap; | 19 | import java.util.HashMap; |
| 16 | import java.util.List; | 20 | import java.util.List; |
| 17 | import java.util.Map; | 21 | import java.util.Map; |
| @@ -58,4 +62,70 @@ public class CarConfigInfoController extends BController<CarConfigInfo, Long> { | @@ -58,4 +62,70 @@ public class CarConfigInfoController extends BController<CarConfigInfo, Long> { | ||
| 58 | 62 | ||
| 59 | return rtn; | 63 | return rtn; |
| 60 | } | 64 | } |
| 65 | + | ||
| 66 | + @RequestMapping(value = "/validate_cars_gs", method = RequestMethod.GET) | ||
| 67 | + public Map<String, Object> validate_cars_gs(HttpServletRequest request, @RequestParam Map<String, Object> param) { | ||
| 68 | + HttpSession session = request.getSession(); | ||
| 69 | + List<CompanyAuthority> cmyAuths = (List<CompanyAuthority>) session.getAttribute(Constants.COMPANY_AUTHORITYS); | ||
| 70 | + | ||
| 71 | + Map<String, Object> rtn = new HashMap<>(); | ||
| 72 | + try { | ||
| 73 | + CarConfigInfo carConfigInfo = new CarConfigInfo( | ||
| 74 | + null, | ||
| 75 | + param.get("xl.id_eq"), | ||
| 76 | + param.get("xl.name_eq"), | ||
| 77 | + param.get("cl.id_eq") | ||
| 78 | + ); | ||
| 79 | + carConfigInfoService.validate_cars_gs(carConfigInfo, cmyAuths); | ||
| 80 | + rtn.put("status", ResponseCode.SUCCESS); | ||
| 81 | + } catch (ScheduleException exp) { | ||
| 82 | + rtn.put("status", ResponseCode.ERROR); | ||
| 83 | + rtn.put("msg", exp.getMessage()); | ||
| 84 | + } | ||
| 85 | + | ||
| 86 | + return rtn; | ||
| 87 | + } | ||
| 88 | + | ||
| 89 | + @RequestMapping(value = "/validate_cars_fgs", method = RequestMethod.GET) | ||
| 90 | + public Map<String, Object> validate_cars_fgs(HttpServletRequest request, @RequestParam Map<String, Object> param) { | ||
| 91 | + HttpSession session = request.getSession(); | ||
| 92 | + List<CompanyAuthority> cmyAuths = (List<CompanyAuthority>) session.getAttribute(Constants.COMPANY_AUTHORITYS); | ||
| 93 | + | ||
| 94 | + Map<String, Object> rtn = new HashMap<>(); | ||
| 95 | + try { | ||
| 96 | + CarConfigInfo carConfigInfo = new CarConfigInfo( | ||
| 97 | + null, | ||
| 98 | + param.get("xl.id_eq"), | ||
| 99 | + param.get("xl.name_eq"), | ||
| 100 | + param.get("cl.id_eq") | ||
| 101 | + ); | ||
| 102 | + carConfigInfoService.validate_cars_fgs(carConfigInfo, cmyAuths); | ||
| 103 | + rtn.put("status", ResponseCode.SUCCESS); | ||
| 104 | + } catch (ScheduleException exp) { | ||
| 105 | + rtn.put("status", ResponseCode.ERROR); | ||
| 106 | + rtn.put("msg", exp.getMessage()); | ||
| 107 | + } | ||
| 108 | + | ||
| 109 | + return rtn; | ||
| 110 | + } | ||
| 111 | + | ||
| 112 | + @RequestMapping(value = "/validate_cars_config", method = RequestMethod.GET) | ||
| 113 | + public Map<String, Object> validate_cars_config(@RequestParam Map<String, Object> param) { | ||
| 114 | + Map<String, Object> rtn = new HashMap<>(); | ||
| 115 | + try { | ||
| 116 | + CarConfigInfo carConfigInfo = new CarConfigInfo( | ||
| 117 | + null, | ||
| 118 | + param.get("xl.id_eq"), | ||
| 119 | + param.get("xl.name_eq"), | ||
| 120 | + param.get("cl.id_eq") | ||
| 121 | + ); | ||
| 122 | + carConfigInfoService.validate_cars_config(carConfigInfo); | ||
| 123 | + rtn.put("status", ResponseCode.SUCCESS); | ||
| 124 | + } catch (ScheduleException exp) { | ||
| 125 | + rtn.put("status", ResponseCode.ERROR); | ||
| 126 | + rtn.put("msg", exp.getMessage()); | ||
| 127 | + } | ||
| 128 | + | ||
| 129 | + return rtn; | ||
| 130 | + } | ||
| 61 | } | 131 | } |
src/main/java/com/bsth/controller/schedule/core/EmployeeConfigInfoController.java
| 1 | package com.bsth.controller.schedule.core; | 1 | package com.bsth.controller.schedule.core; |
| 2 | 2 | ||
| 3 | +import com.bsth.common.Constants; | ||
| 3 | import com.bsth.common.ResponseCode; | 4 | import com.bsth.common.ResponseCode; |
| 4 | import com.bsth.controller.schedule.BController; | 5 | import com.bsth.controller.schedule.BController; |
| 5 | import com.bsth.entity.schedule.EmployeeConfigInfo; | 6 | import com.bsth.entity.schedule.EmployeeConfigInfo; |
| 7 | +import com.bsth.entity.sys.CompanyAuthority; | ||
| 6 | import com.bsth.repository.schedule.EmployeeConfigInfoRepository; | 8 | import com.bsth.repository.schedule.EmployeeConfigInfoRepository; |
| 7 | import com.bsth.service.schedule.EmployeeConfigInfoService; | 9 | import com.bsth.service.schedule.EmployeeConfigInfoService; |
| 8 | import com.bsth.service.schedule.exception.ScheduleException; | 10 | import com.bsth.service.schedule.exception.ScheduleException; |
| 9 | import org.springframework.beans.factory.annotation.Autowired; | 11 | import org.springframework.beans.factory.annotation.Autowired; |
| 10 | import org.springframework.web.bind.annotation.*; | 12 | import org.springframework.web.bind.annotation.*; |
| 11 | 13 | ||
| 14 | +import javax.servlet.http.HttpServletRequest; | ||
| 15 | +import javax.servlet.http.HttpSession; | ||
| 12 | import java.util.HashMap; | 16 | import java.util.HashMap; |
| 13 | import java.util.List; | 17 | import java.util.List; |
| 14 | import java.util.Map; | 18 | import java.util.Map; |
| @@ -70,6 +74,75 @@ public class EmployeeConfigInfoController extends BController<EmployeeConfigInfo | @@ -70,6 +74,75 @@ public class EmployeeConfigInfoController extends BController<EmployeeConfigInfo | ||
| 70 | return rtn; | 74 | return rtn; |
| 71 | } | 75 | } |
| 72 | 76 | ||
| 77 | + @RequestMapping(value = "/validate_jsy_config", method = RequestMethod.GET) | ||
| 78 | + public Map<String, Object> validate_jsy_config(@RequestParam Map<String, Object> param) { | ||
| 79 | + Map<String, Object> rtn = new HashMap<>(); | ||
| 80 | + try { | ||
| 81 | + EmployeeConfigInfo employeeConfigInfo = new EmployeeConfigInfo( | ||
| 82 | + null, | ||
| 83 | + param.get("xl.id_eq"), | ||
| 84 | + param.get("xl.name_eq"), | ||
| 85 | + param.get("jsy.id_eq"), | ||
| 86 | + null | ||
| 87 | + ); | ||
| 88 | + employeeConfigInfoService.validate_jsy_config(employeeConfigInfo); | ||
| 89 | + rtn.put("status", ResponseCode.SUCCESS); | ||
| 90 | + } catch (ScheduleException exp) { | ||
| 91 | + rtn.put("status", ResponseCode.ERROR); | ||
| 92 | + rtn.put("msg", exp.getMessage()); | ||
| 93 | + } | ||
| 94 | + | ||
| 95 | + return rtn; | ||
| 96 | + } | ||
| 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 | + | ||
| 73 | @RequestMapping(value = "/validate_spy", method = RequestMethod.GET) | 146 | @RequestMapping(value = "/validate_spy", method = RequestMethod.GET) |
| 74 | public Map<String, Object> validate_spy(@RequestParam Map<String, Object> param) { | 147 | public Map<String, Object> validate_spy(@RequestParam Map<String, Object> param) { |
| 75 | Map<String, Object> rtn = new HashMap<>(); | 148 | Map<String, Object> rtn = new HashMap<>(); |
| @@ -89,4 +162,70 @@ public class EmployeeConfigInfoController extends BController<EmployeeConfigInfo | @@ -89,4 +162,70 @@ public class EmployeeConfigInfoController extends BController<EmployeeConfigInfo | ||
| 89 | } | 162 | } |
| 90 | return rtn; | 163 | return rtn; |
| 91 | } | 164 | } |
| 165 | + | ||
| 166 | + @RequestMapping(value = "/validate_spy_config", method = RequestMethod.GET) | ||
| 167 | + public Map<String, Object> validate_spy_config(@RequestParam Map<String, Object> param) { | ||
| 168 | + Map<String, Object> rtn = new HashMap<>(); | ||
| 169 | + try { | ||
| 170 | + EmployeeConfigInfo employeeConfigInfo = new EmployeeConfigInfo( | ||
| 171 | + null, | ||
| 172 | + param.get("xl.id_eq"), | ||
| 173 | + param.get("xl.name_eq"), | ||
| 174 | + null, | ||
| 175 | + param.get("spy.id_eq") | ||
| 176 | + ); | ||
| 177 | + employeeConfigInfoService.validate_spy_config(employeeConfigInfo); | ||
| 178 | + rtn.put("status", ResponseCode.SUCCESS); | ||
| 179 | + } catch (ScheduleException exp) { | ||
| 180 | + rtn.put("status", ResponseCode.ERROR); | ||
| 181 | + rtn.put("msg", exp.getMessage()); | ||
| 182 | + } | ||
| 183 | + return rtn; | ||
| 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 | + } | ||
| 92 | } | 231 | } |
src/main/java/com/bsth/data/safe_driv/SafeDrivDataLoadThread.java
| @@ -20,12 +20,12 @@ import java.util.List; | @@ -20,12 +20,12 @@ import java.util.List; | ||
| 20 | * Created by panzhao on 2017/4/6. | 20 | * Created by panzhao on 2017/4/6. |
| 21 | */ | 21 | */ |
| 22 | @Component | 22 | @Component |
| 23 | -public class SafeDrivDataLoadThread extends Thread{ | 23 | +public class SafeDrivDataLoadThread extends Thread { |
| 24 | 24 | ||
| 25 | Logger logger = LoggerFactory.getLogger(this.getClass()); | 25 | Logger logger = LoggerFactory.getLogger(this.getClass()); |
| 26 | 26 | ||
| 27 | static String url; | 27 | static String url; |
| 28 | - static CloseableHttpClient httpClient = null; | 28 | + static CloseableHttpClient httpClient; |
| 29 | static HttpGet get; | 29 | static HttpGet get; |
| 30 | static RequestConfig requestConfig; | 30 | static RequestConfig requestConfig; |
| 31 | static CloseableHttpResponse response; | 31 | static CloseableHttpResponse response; |
| @@ -51,9 +51,7 @@ public class SafeDrivDataLoadThread extends Thread{ | @@ -51,9 +51,7 @@ public class SafeDrivDataLoadThread extends Thread{ | ||
| 51 | 51 | ||
| 52 | int statusCode = response.getStatusLine().getStatusCode(); | 52 | int statusCode = response.getStatusLine().getStatusCode(); |
| 53 | if(statusCode != 200){ | 53 | if(statusCode != 200){ |
| 54 | - get.abort(); | ||
| 55 | logger.error("http client status code: " + statusCode); | 54 | logger.error("http client status code: " + statusCode); |
| 56 | - return; | ||
| 57 | } | 55 | } |
| 58 | 56 | ||
| 59 | entity = response.getEntity(); | 57 | entity = response.getEntity(); |
| @@ -67,7 +65,7 @@ public class SafeDrivDataLoadThread extends Thread{ | @@ -67,7 +65,7 @@ public class SafeDrivDataLoadThread extends Thread{ | ||
| 67 | 65 | ||
| 68 | list = JSON.parseArray(stringBuffer.toString(), SafeDriv.class); | 66 | list = JSON.parseArray(stringBuffer.toString(), SafeDriv.class); |
| 69 | 67 | ||
| 70 | - for(SafeDriv sd : list){ | 68 | + for (SafeDriv sd : list) { |
| 71 | SafeDrivCenter.put(sd); | 69 | SafeDrivCenter.put(sd); |
| 72 | } | 70 | } |
| 73 | } | 71 | } |
| @@ -75,7 +73,7 @@ public class SafeDrivDataLoadThread extends Thread{ | @@ -75,7 +73,7 @@ public class SafeDrivDataLoadThread extends Thread{ | ||
| 75 | if (null != response) | 73 | if (null != response) |
| 76 | response.close(); | 74 | response.close(); |
| 77 | } catch (Exception e) { | 75 | } catch (Exception e) { |
| 78 | - logger.error("安全驾驶接口报错了" , e.getMessage()); | 76 | + logger.error("安全驾驶接口报错了", e.getMessage()); |
| 79 | } | 77 | } |
| 80 | } | 78 | } |
| 81 | } | 79 | } |
src/main/java/com/bsth/data/schedule/ScheduleComparator.java
| @@ -9,12 +9,10 @@ import java.util.HashMap; | @@ -9,12 +9,10 @@ import java.util.HashMap; | ||
| 9 | import java.util.Map; | 9 | import java.util.Map; |
| 10 | 10 | ||
| 11 | /** | 11 | /** |
| 12 | - * | ||
| 13 | - * @ClassName: ScheduleComparator | ||
| 14 | - * @Description: TODO(实际班次排序器) | ||
| 15 | * @author PanZhao | 12 | * @author PanZhao |
| 16 | - * @date 2016年8月15日 下午1:53:28 | ||
| 17 | - * | 13 | + * @ClassName: ScheduleComparator |
| 14 | + * @Description: TODO(实际班次排序器) | ||
| 15 | + * @date 2016年8月15日 下午1:53:28 | ||
| 18 | */ | 16 | */ |
| 19 | public class ScheduleComparator { | 17 | public class ScheduleComparator { |
| 20 | 18 | ||
| @@ -26,71 +24,62 @@ public class ScheduleComparator { | @@ -26,71 +24,62 @@ public class ScheduleComparator { | ||
| 26 | }*/ | 24 | }*/ |
| 27 | 25 | ||
| 28 | 26 | ||
| 29 | - static Map<String, Integer> bcTypeOrderMap = new HashMap<>(); | 27 | + static Map<String, Integer> bcTypeOrderMap = new HashMap<>(); |
| 30 | 28 | ||
| 31 | - static{ | ||
| 32 | - bcTypeOrderMap.put("out", 0); | ||
| 33 | - bcTypeOrderMap.put("normal", 1); | ||
| 34 | - bcTypeOrderMap.put("region", 2); | ||
| 35 | - bcTypeOrderMap.put("major", 3); | ||
| 36 | - bcTypeOrderMap.put("venting", 4); | ||
| 37 | - bcTypeOrderMap.put("ldks", 5); | ||
| 38 | - bcTypeOrderMap.put("in", 6); | ||
| 39 | - } | ||
| 40 | - | ||
| 41 | - public static class FCSJ implements Comparator<ScheduleRealInfo>{ | 29 | + static { |
| 30 | + bcTypeOrderMap.put("out", 0); | ||
| 31 | + bcTypeOrderMap.put("normal", 1); | ||
| 32 | + bcTypeOrderMap.put("region", 2); | ||
| 33 | + bcTypeOrderMap.put("major", 3); | ||
| 34 | + bcTypeOrderMap.put("venting", 4); | ||
| 35 | + bcTypeOrderMap.put("ldks", 5); | ||
| 36 | + bcTypeOrderMap.put("in", 6); | ||
| 37 | + } | ||
| 42 | 38 | ||
| 43 | - @Override | ||
| 44 | - public int compare(ScheduleRealInfo s1, ScheduleRealInfo s2) { | ||
| 45 | - int diff = (int) (s1.getFcsjT() - s2.getFcsjT()); | ||
| 46 | - return diff!=0?diff:typeOrder(s1.getBcType()) - typeOrder(s2.getBcType()); | ||
| 47 | - } | ||
| 48 | - } | 39 | + public static class FCSJ implements Comparator<ScheduleRealInfo> { |
| 49 | 40 | ||
| 50 | - private static int typeOrder(String bcType){ | ||
| 51 | - return bcTypeOrderMap.get(bcType)!=null?bcTypeOrderMap.get(bcType):0; | ||
| 52 | - } | 41 | + @Override |
| 42 | + public int compare(ScheduleRealInfo s1, ScheduleRealInfo s2) { | ||
| 43 | + int diff = (int) (s1.getFcsjT() - s2.getFcsjT()); | ||
| 44 | + return diff != 0 ? diff : typeOrder(s1.getBcType()) - typeOrder(s2.getBcType()); | ||
| 45 | + } | ||
| 46 | + } | ||
| 47 | + | ||
| 48 | + private static int typeOrder(String bcType) { | ||
| 49 | + return bcTypeOrderMap.get(bcType) != null ? bcTypeOrderMap.get(bcType) : 0; | ||
| 50 | + } | ||
| 53 | 51 | ||
| 54 | - public static class DFSJ implements Comparator<ScheduleRealInfo>{ | 52 | + public static class DFSJ implements Comparator<ScheduleRealInfo> { |
| 55 | 53 | ||
| 56 | static Logger logger = LoggerFactory.getLogger(DFSJ.class); | 54 | static Logger logger = LoggerFactory.getLogger(DFSJ.class); |
| 57 | 55 | ||
| 58 | - @Override | ||
| 59 | - public int compare(ScheduleRealInfo s1, ScheduleRealInfo s2) { | ||
| 60 | - try{ | 56 | + @Override |
| 57 | + public int compare(ScheduleRealInfo s1, ScheduleRealInfo s2) { | ||
| 58 | + try { | ||
| 59 | + int diff; | ||
| 60 | + if (!s2.isSflj() && !s1.isSflj()) { | ||
| 61 | + diff = (int) (s1.getFcsjT() - s2.getFcsjT()); | ||
| 61 | 62 | ||
| 62 | - if(!s1.getXlBm().equals(s2.getXlBm()) || !s1.getLpName().equals(s2.getLpName())){ | ||
| 63 | - int diff = (int) (s1.getDfsjT() - s2.getDfsjT()); | ||
| 64 | - return diff!=0?diff:typeOrder(s1.getBcType()) - typeOrder(s2.getBcType()); | ||
| 65 | - } | ||
| 66 | - else{ | ||
| 67 | - /** | ||
| 68 | - * 按时刻表发车顺序号 | ||
| 69 | - */ | ||
| 70 | - Integer fc1 = s1.getFcno(); | ||
| 71 | - Integer fc2 = s2.getFcno(); | ||
| 72 | - if(null != fc1 && null != fc2){ | ||
| 73 | - return fc1.intValue()==fc2.intValue()?0:fc1.intValue()-fc2.intValue(); | ||
| 74 | - } | ||
| 75 | - else{ | ||
| 76 | - int diff = (int) (s1.getDfsjT() - s2.getDfsjT()); | ||
| 77 | - return diff!=0?diff:typeOrder(s1.getBcType()) - typeOrder(s2.getBcType()); | ||
| 78 | - } | 63 | + } else { |
| 64 | + diff = (int) (s1.getDfsjT() - s2.getDfsjT()); | ||
| 79 | } | 65 | } |
| 80 | - }catch (Exception e){ | 66 | + |
| 67 | + return diff != 0 ? diff : typeOrder(s1.getBcType()) - typeOrder(s2.getBcType()); | ||
| 68 | + | ||
| 69 | + } catch (Exception e) { | ||
| 81 | logger.error("排序异常", e); | 70 | logger.error("排序异常", e); |
| 82 | - return s1.getDfsjT() - s2.getDfsjT() > 0?1:-1; | 71 | + return s1.getDfsjT() - s2.getDfsjT() > 0 ? 1 : -1; |
| 83 | } | 72 | } |
| 84 | - } | ||
| 85 | - } | 73 | + } |
| 74 | + } | ||
| 86 | 75 | ||
| 87 | - public static class DFSJ2 implements Comparator<ScheduleRealInfo>{ | 76 | + public static class DFSJ2 implements Comparator<ScheduleRealInfo> { |
| 88 | 77 | ||
| 89 | 78 | ||
| 90 | @Override | 79 | @Override |
| 91 | public int compare(ScheduleRealInfo s1, ScheduleRealInfo s2) { | 80 | public int compare(ScheduleRealInfo s1, ScheduleRealInfo s2) { |
| 92 | int diff = (int) (s1.getDfsjT() - s2.getDfsjT()); | 81 | int diff = (int) (s1.getDfsjT() - s2.getDfsjT()); |
| 93 | - return diff!=0?diff:typeOrder(s1.getBcType()) - typeOrder(s2.getBcType()); | 82 | + return diff != 0 ? diff : typeOrder(s1.getBcType()) - typeOrder(s2.getBcType()); |
| 94 | } | 83 | } |
| 95 | } | 84 | } |
| 96 | } | 85 | } |
src/main/java/com/bsth/entity/calc/CalcStatistics.java
| @@ -67,6 +67,8 @@ public class CalcStatistics { | @@ -67,6 +67,8 @@ public class CalcStatistics { | ||
| 67 | private Double qtlc; | 67 | private Double qtlc; |
| 68 | /* 临加公里*/ | 68 | /* 临加公里*/ |
| 69 | private Double ljlc; | 69 | private Double ljlc; |
| 70 | + /* 临加空驶公里*/ | ||
| 71 | + private Double ljkslc; | ||
| 70 | /* 计划班次*/ | 72 | /* 计划班次*/ |
| 71 | private int jhbcq; | 73 | private int jhbcq; |
| 72 | /* 计划班次(早高峰)*/ | 74 | /* 计划班次(早高峰)*/ |
| @@ -272,6 +274,12 @@ public class CalcStatistics { | @@ -272,6 +274,12 @@ public class CalcStatistics { | ||
| 272 | public void setLjlc(Double ljlc) { | 274 | public void setLjlc(Double ljlc) { |
| 273 | this.ljlc = ljlc; | 275 | this.ljlc = ljlc; |
| 274 | } | 276 | } |
| 277 | + public Double getLjkslc() { | ||
| 278 | + return ljkslc; | ||
| 279 | + } | ||
| 280 | + public void setLjkslc(Double ljkslc) { | ||
| 281 | + this.ljkslc = ljkslc; | ||
| 282 | + } | ||
| 275 | public int getJhbcq() { | 283 | public int getJhbcq() { |
| 276 | return jhbcq; | 284 | return jhbcq; |
| 277 | } | 285 | } |
src/main/java/com/bsth/entity/mcy_forms/Operationservice.java
| @@ -17,6 +17,10 @@ public class Operationservice { | @@ -17,6 +17,10 @@ public class Operationservice { | ||
| 17 | private String jname; | 17 | private String jname; |
| 18 | 18 | ||
| 19 | private String clzbh; | 19 | private String clzbh; |
| 20 | + | ||
| 21 | + private String gs; | ||
| 22 | + | ||
| 23 | + private String fgs; | ||
| 20 | 24 | ||
| 21 | public String getJname() { | 25 | public String getJname() { |
| 22 | return jname; | 26 | return jname; |
| @@ -89,6 +93,22 @@ public class Operationservice { | @@ -89,6 +93,22 @@ public class Operationservice { | ||
| 89 | public void setXlBm(String xlBm) { | 93 | public void setXlBm(String xlBm) { |
| 90 | this.xlBm = xlBm; | 94 | this.xlBm = xlBm; |
| 91 | } | 95 | } |
| 96 | + | ||
| 97 | + public String getGs() { | ||
| 98 | + return gs; | ||
| 99 | + } | ||
| 100 | + | ||
| 101 | + public void setGs(String gs) { | ||
| 102 | + this.gs = gs; | ||
| 103 | + } | ||
| 104 | + | ||
| 105 | + public String getFgs() { | ||
| 106 | + return fgs; | ||
| 107 | + } | ||
| 108 | + | ||
| 109 | + public void setFgs(String fgs) { | ||
| 110 | + this.fgs = fgs; | ||
| 111 | + } | ||
| 92 | 112 | ||
| 93 | 113 | ||
| 94 | } | 114 | } |
src/main/java/com/bsth/repository/calc/CalcStatisticsRepository.java
| @@ -6,8 +6,10 @@ import javax.transaction.Transactional; | @@ -6,8 +6,10 @@ import javax.transaction.Transactional; | ||
| 6 | 6 | ||
| 7 | import com.bsth.entity.calc.CalcStatistics; | 7 | import com.bsth.entity.calc.CalcStatistics; |
| 8 | import com.bsth.entity.calc.CalcWaybill; | 8 | import com.bsth.entity.calc.CalcWaybill; |
| 9 | +import com.bsth.entity.realcontrol.ScheduleRealInfo; | ||
| 9 | import com.bsth.repository.BaseRepository; | 10 | import com.bsth.repository.BaseRepository; |
| 10 | 11 | ||
| 12 | +import org.springframework.data.jpa.repository.EntityGraph; | ||
| 11 | import org.springframework.data.jpa.repository.Modifying; | 13 | import org.springframework.data.jpa.repository.Modifying; |
| 12 | import org.springframework.data.jpa.repository.Query; | 14 | import org.springframework.data.jpa.repository.Query; |
| 13 | import org.springframework.stereotype.Repository; | 15 | import org.springframework.stereotype.Repository; |
| @@ -38,4 +40,8 @@ public interface CalcStatisticsRepository extends BaseRepository<CalcStatistics, | @@ -38,4 +40,8 @@ public interface CalcStatisticsRepository extends BaseRepository<CalcStatistics, | ||
| 38 | @Query(value = "delete CalcStatistics c where c.dateStr=?1") | 40 | @Query(value = "delete CalcStatistics c where c.dateStr=?1") |
| 39 | void deleteByDate(String date); | 41 | void deleteByDate(String date); |
| 40 | 42 | ||
| 43 | + //按照时间段查询实际排班(分公司条件不可为空) | ||
| 44 | + @EntityGraph(value = "scheduleRealInfo_cTasks", type = EntityGraph.EntityGraphType.FETCH) | ||
| 45 | + @Query(value="select DISTINCT s from ScheduleRealInfo s where s.xlBm like %?1% and s.scheduleDateStr between ?2 and ?3 and gsBm = ?4 and fgsBm = ?5 order by s.fgsBm, s.xlBm") | ||
| 46 | + List<ScheduleRealInfo> scheduleByDateAndLine(String line,String date,String date2,String gsdm,String fgsdm); | ||
| 41 | } | 47 | } |
src/main/java/com/bsth/repository/sys/ResourceRepository.java
| @@ -10,5 +10,5 @@ import com.bsth.repository.BaseRepository; | @@ -10,5 +10,5 @@ import com.bsth.repository.BaseRepository; | ||
| 10 | @Repository | 10 | @Repository |
| 11 | public interface ResourceRepository extends BaseRepository<Resource, Integer> { | 11 | public interface ResourceRepository extends BaseRepository<Resource, Integer> { |
| 12 | 12 | ||
| 13 | - List<Resource> findByRolesId(Integer roleId); | 13 | + List<Resource> findByRolesId(Integer roleId); |
| 14 | } | 14 | } |
src/main/java/com/bsth/service/calc/impl/CalcWaybillServiceImpl.java
| @@ -553,7 +553,7 @@ public class CalcWaybillServiceImpl extends BaseServiceImpl<CalcWaybill, Integer | @@ -553,7 +553,7 @@ public class CalcWaybillServiceImpl extends BaseServiceImpl<CalcWaybill, Integer | ||
| 553 | 553 | ||
| 554 | //查询所有线路 | 554 | //查询所有线路 |
| 555 | for(Map<String, String> m : gsList){ | 555 | for(Map<String, String> m : gsList){ |
| 556 | - list.addAll(scheduleRealInfoRepository.scheduleByDateAndLineTj(line, rq, rq, m.get("gsdm"), m.get("fgsdm"))); | 556 | + list.addAll(calcStatisticsRepository.scheduleByDateAndLine(line, rq, rq, m.get("gsdm"), m.get("fgsdm"))); |
| 557 | } | 557 | } |
| 558 | 558 | ||
| 559 | for (int i = 0; i < list.size(); i++) { | 559 | for (int i = 0; i < list.size(); i++) { |
| @@ -644,6 +644,7 @@ public class CalcWaybillServiceImpl extends BaseServiceImpl<CalcWaybill, Integer | @@ -644,6 +644,7 @@ public class CalcWaybillServiceImpl extends BaseServiceImpl<CalcWaybill, Integer | ||
| 644 | double sjyygl= culateService.culateSjgl(lists); | 644 | double sjyygl= culateService.culateSjgl(lists); |
| 645 | double zyygl= Arith.add(sjyygl,ljgl); | 645 | double zyygl= Arith.add(sjyygl,ljgl); |
| 646 | 646 | ||
| 647 | + double ljksgl= culateService.culateLjksgl(lists); | ||
| 647 | double sjjccgl=culateService.culateJccgl(lists); | 648 | double sjjccgl=culateService.culateJccgl(lists); |
| 648 | double sjksgl=culateService.culateKsgl(lists); | 649 | double sjksgl=culateService.culateKsgl(lists); |
| 649 | double zksgl=Arith.add(sjjccgl, sjksgl); | 650 | double zksgl=Arith.add(sjjccgl, sjksgl); |
| @@ -651,6 +652,8 @@ public class CalcWaybillServiceImpl extends BaseServiceImpl<CalcWaybill, Integer | @@ -651,6 +652,8 @@ public class CalcWaybillServiceImpl extends BaseServiceImpl<CalcWaybill, Integer | ||
| 651 | s.setSjkslc(zksgl); | 652 | s.setSjkslc(zksgl); |
| 652 | s.setSjzlc(Arith.add(zyygl, zksgl)); | 653 | s.setSjzlc(Arith.add(zyygl, zksgl)); |
| 653 | 654 | ||
| 655 | + s.setLjkslc(ljksgl); | ||
| 656 | + | ||
| 654 | s.setSslc(culateService.culateLbgl(list)); | 657 | s.setSslc(culateService.culateLbgl(list)); |
| 655 | s.setSsbc(culateService.culateLbbc(list)); | 658 | s.setSsbc(culateService.culateLbbc(list)); |
| 656 | 659 | ||
| @@ -841,6 +844,7 @@ public class CalcWaybillServiceImpl extends BaseServiceImpl<CalcWaybill, Integer | @@ -841,6 +844,7 @@ public class CalcWaybillServiceImpl extends BaseServiceImpl<CalcWaybill, Integer | ||
| 841 | m.put("ssgl_yw", c.getYwlc()); | 844 | m.put("ssgl_yw", c.getYwlc()); |
| 842 | m.put("ssgl_other", c.getQtlc()); | 845 | m.put("ssgl_other", c.getQtlc()); |
| 843 | m.put("ljgl", c.getLjlc()); | 846 | m.put("ljgl", c.getLjlc()); |
| 847 | + m.put("ljks", c.getLjkslc()); | ||
| 844 | m.put("jhbc", c.getJhbcq()); | 848 | m.put("jhbc", c.getJhbcq()); |
| 845 | m.put("jhbc_m", c.getJhbcz()); | 849 | m.put("jhbc_m", c.getJhbcz()); |
| 846 | m.put("jhbc_a", c.getJhbcw()); | 850 | m.put("jhbc_a", c.getJhbcw()); |
| @@ -942,16 +946,17 @@ public class CalcWaybillServiceImpl extends BaseServiceImpl<CalcWaybill, Integer | @@ -942,16 +946,17 @@ public class CalcWaybillServiceImpl extends BaseServiceImpl<CalcWaybill, Integer | ||
| 942 | } | 946 | } |
| 943 | Map<String, Boolean> lineMap=lineService.lineNature(); | 947 | Map<String, Boolean> lineMap=lineService.lineNature(); |
| 944 | List<CalcStatistics> list=new ArrayList<CalcStatistics>(); | 948 | List<CalcStatistics> list=new ArrayList<CalcStatistics>(); |
| 949 | + | ||
| 945 | for (int i = 0; i < listAll.size(); i++) { | 950 | for (int i = 0; i < listAll.size(); i++) { |
| 946 | CalcStatistics s=listAll.get(i); | 951 | CalcStatistics s=listAll.get(i); |
| 947 | if(nature.equals("0")){ | 952 | if(nature.equals("0")){ |
| 948 | list.add(s); | 953 | list.add(s); |
| 949 | }else if(nature.equals("1")){ | 954 | }else if(nature.equals("1")){ |
| 950 | - if(lineMap.get(s.getXl())){ | 955 | + if(lineMap.containsKey(s.getXl()) && lineMap.get(s.getXl())){ |
| 951 | list.add(s); | 956 | list.add(s); |
| 952 | } | 957 | } |
| 953 | }else{ | 958 | }else{ |
| 954 | - if(!lineMap.get(s.getXl())){ | 959 | + if(lineMap.containsKey(s.getXl()) && !lineMap.get(s.getXl())){ |
| 955 | list.add(s); | 960 | list.add(s); |
| 956 | } | 961 | } |
| 957 | } | 962 | } |
| @@ -1035,6 +1040,7 @@ public class CalcWaybillServiceImpl extends BaseServiceImpl<CalcWaybill, Integer | @@ -1035,6 +1040,7 @@ public class CalcWaybillServiceImpl extends BaseServiceImpl<CalcWaybill, Integer | ||
| 1035 | m.put("ssgl_yw", c.getYwlc()); | 1040 | m.put("ssgl_yw", c.getYwlc()); |
| 1036 | m.put("ssgl_other", c.getQtlc()); | 1041 | m.put("ssgl_other", c.getQtlc()); |
| 1037 | m.put("ljgl", c.getLjlc()); | 1042 | m.put("ljgl", c.getLjlc()); |
| 1043 | + m.put("ljks", c.getLjkslc()); | ||
| 1038 | m.put("jhbc", c.getJhbcq()); | 1044 | m.put("jhbc", c.getJhbcq()); |
| 1039 | m.put("jhbc_m", c.getJhbcz()); | 1045 | m.put("jhbc_m", c.getJhbcz()); |
| 1040 | m.put("jhbc_a", c.getJhbcw()); | 1046 | m.put("jhbc_a", c.getJhbcw()); |
| @@ -1131,6 +1137,7 @@ public class CalcWaybillServiceImpl extends BaseServiceImpl<CalcWaybill, Integer | @@ -1131,6 +1137,7 @@ public class CalcWaybillServiceImpl extends BaseServiceImpl<CalcWaybill, Integer | ||
| 1131 | hjMap.put("ssgl_yw", Arith.add(lsMap.get("ssgl_yw"), hjMap.get("ssgl_yw")==null?"0":hjMap.get("ssgl_yw"))); | 1137 | hjMap.put("ssgl_yw", Arith.add(lsMap.get("ssgl_yw"), hjMap.get("ssgl_yw")==null?"0":hjMap.get("ssgl_yw"))); |
| 1132 | hjMap.put("ssgl_other", Arith.add(lsMap.get("ssgl_other"), hjMap.get("ssgl_other")==null?"0":hjMap.get("ssgl_other"))); | 1138 | hjMap.put("ssgl_other", Arith.add(lsMap.get("ssgl_other"), hjMap.get("ssgl_other")==null?"0":hjMap.get("ssgl_other"))); |
| 1133 | hjMap.put("ljgl", Arith.add(lsMap.get("ljgl"), hjMap.get("ljgl")==null?"0":hjMap.get("ljgl"))); | 1139 | hjMap.put("ljgl", Arith.add(lsMap.get("ljgl"), hjMap.get("ljgl")==null?"0":hjMap.get("ljgl"))); |
| 1140 | + hjMap.put("ljks", Arith.add(lsMap.get("ljks"), hjMap.get("ljks")==null?"0":hjMap.get("ljks"))); | ||
| 1134 | hjMap.put("jhbc", Integer.parseInt(lsMap.get("jhbc").toString())+ Integer.parseInt(hjMap.get("jhbc")==null?"0":hjMap.get("jhbc").toString())); | 1141 | hjMap.put("jhbc", Integer.parseInt(lsMap.get("jhbc").toString())+ Integer.parseInt(hjMap.get("jhbc")==null?"0":hjMap.get("jhbc").toString())); |
| 1135 | hjMap.put("jhbc_m", Integer.parseInt(lsMap.get("jhbc_m").toString())+Integer.parseInt(hjMap.get("jhbc_m")==null?"0":hjMap.get("jhbc_m").toString())); | 1142 | hjMap.put("jhbc_m", Integer.parseInt(lsMap.get("jhbc_m").toString())+Integer.parseInt(hjMap.get("jhbc_m")==null?"0":hjMap.get("jhbc_m").toString())); |
| 1136 | hjMap.put("jhbc_a", Integer.parseInt(lsMap.get("jhbc_a").toString())+ Integer.parseInt(hjMap.get("jhbc_a")==null?"0":hjMap.get("jhbc_a").toString())); | 1143 | hjMap.put("jhbc_a", Integer.parseInt(lsMap.get("jhbc_a").toString())+ Integer.parseInt(hjMap.get("jhbc_a")==null?"0":hjMap.get("jhbc_a").toString())); |
| @@ -1230,6 +1237,10 @@ public class CalcWaybillServiceImpl extends BaseServiceImpl<CalcWaybill, Integer | @@ -1230,6 +1237,10 @@ public class CalcWaybillServiceImpl extends BaseServiceImpl<CalcWaybill, Integer | ||
| 1230 | s.setYwlc(Arith.add(s.getYwlc()!=null?s.getYwlc():0, s_.getYwlc())); | 1237 | s.setYwlc(Arith.add(s.getYwlc()!=null?s.getYwlc():0, s_.getYwlc())); |
| 1231 | s.setQtlc(Arith.add(s.getQtlc()!=null?s.getQtlc():0, s_.getQtlc())); | 1238 | s.setQtlc(Arith.add(s.getQtlc()!=null?s.getQtlc():0, s_.getQtlc())); |
| 1232 | s.setLjlc(Arith.add(s.getLjlc()!=null?s.getLjlc():0, s_.getLjlc())); | 1239 | s.setLjlc(Arith.add(s.getLjlc()!=null?s.getLjlc():0, s_.getLjlc())); |
| 1240 | + if(s_.getLjkslc() == null){ | ||
| 1241 | + s_.setLjkslc(0d); | ||
| 1242 | + } | ||
| 1243 | + s.setLjkslc(Arith.add(s.getLjkslc()!=null?s.getLjkslc():0, s_.getLjkslc())); | ||
| 1233 | s.setJhbcq(s.getJhbcq() + s_.getJhbcq()); | 1244 | s.setJhbcq(s.getJhbcq() + s_.getJhbcq()); |
| 1234 | s.setJhbcz(s.getJhbcz() + s_.getJhbcz()); | 1245 | s.setJhbcz(s.getJhbcz() + s_.getJhbcz()); |
| 1235 | s.setJhbcw(s.getJhbcw() + s_.getJhbcw()); | 1246 | s.setJhbcw(s.getJhbcw() + s_.getJhbcw()); |
src/main/java/com/bsth/service/forms/impl/FormsServiceImpl.java
| @@ -28,7 +28,6 @@ import com.bsth.entity.mcy_forms.Operationservice; | @@ -28,7 +28,6 @@ import com.bsth.entity.mcy_forms.Operationservice; | ||
| 28 | import com.bsth.entity.mcy_forms.Shifday; | 28 | import com.bsth.entity.mcy_forms.Shifday; |
| 29 | import com.bsth.entity.mcy_forms.Shiftuehiclemanth; | 29 | import com.bsth.entity.mcy_forms.Shiftuehiclemanth; |
| 30 | import com.bsth.entity.mcy_forms.Singledata; | 30 | import com.bsth.entity.mcy_forms.Singledata; |
| 31 | -import com.bsth.entity.mcy_forms.Turnoutrate; | ||
| 32 | import com.bsth.entity.mcy_forms.Vehicleloading; | 31 | import com.bsth.entity.mcy_forms.Vehicleloading; |
| 33 | import com.bsth.entity.mcy_forms.Waybillday; | 32 | import com.bsth.entity.mcy_forms.Waybillday; |
| 34 | import com.bsth.entity.oil.Dlb; | 33 | import com.bsth.entity.oil.Dlb; |
| @@ -45,6 +44,7 @@ import com.bsth.entity.mcy_forms.Allline; | @@ -45,6 +44,7 @@ import com.bsth.entity.mcy_forms.Allline; | ||
| 45 | import com.bsth.entity.mcy_forms.Changetochange; | 44 | import com.bsth.entity.mcy_forms.Changetochange; |
| 46 | import com.bsth.entity.mcy_forms.Daily; | 45 | import com.bsth.entity.mcy_forms.Daily; |
| 47 | import com.bsth.entity.mcy_forms.Executionrate; | 46 | import com.bsth.entity.mcy_forms.Executionrate; |
| 47 | +import com.bsth.service.LineService; | ||
| 48 | import com.bsth.service.forms.CommonService; | 48 | import com.bsth.service.forms.CommonService; |
| 49 | import com.bsth.service.forms.FormsService; | 49 | import com.bsth.service.forms.FormsService; |
| 50 | import com.bsth.service.realcontrol.ScheduleRealInfoService; | 50 | import com.bsth.service.realcontrol.ScheduleRealInfoService; |
| @@ -61,6 +61,9 @@ public class FormsServiceImpl implements FormsService { | @@ -61,6 +61,9 @@ public class FormsServiceImpl implements FormsService { | ||
| 61 | ScheduleRealInfoService scheduleRealInfoService; | 61 | ScheduleRealInfoService scheduleRealInfoService; |
| 62 | 62 | ||
| 63 | @Autowired | 63 | @Autowired |
| 64 | + LineService lineService; | ||
| 65 | + | ||
| 66 | + @Autowired | ||
| 64 | CommonService commonService; | 67 | CommonService commonService; |
| 65 | 68 | ||
| 66 | @Autowired | 69 | @Autowired |
| @@ -214,11 +217,11 @@ public class FormsServiceImpl implements FormsService { | @@ -214,11 +217,11 @@ public class FormsServiceImpl implements FormsService { | ||
| 214 | sql+=" and l.line_code=" + map.get("line").toString(); | 217 | sql+=" and l.line_code=" + map.get("line").toString(); |
| 215 | } | 218 | } |
| 216 | sql+= " AND r.gs_bm is not null"; | 219 | sql+= " AND r.gs_bm is not null"; |
| 217 | - if(map.get("gsdmLine").toString()!=""){ | 220 | + if(map.get("gsdmLine") != null && map.get("gsdmLine").toString()!=""){ |
| 218 | sql+=" and r.gs_bm='"+map.get("gsdmLine").toString()+"' "; | 221 | sql+=" and r.gs_bm='"+map.get("gsdmLine").toString()+"' "; |
| 219 | } | 222 | } |
| 220 | - if(map.get("fgsdmLine").toString()!=""){ | ||
| 221 | - sql+=" and r.fgs_bm='"+map.get("fgsdmLine").toString()+"'"; | 223 | + if(map.get("fgsdmLine") != null && map.get("fgsdmLine").toString()!=""){ |
| 224 | + sql+=" and r.fgs_bm='"+map.get("fgsdmLine").toString()+"' "; | ||
| 222 | } | 225 | } |
| 223 | sql += " GROUP BY s.station_name,l.name,r.gs_bm,r.gs_name,r.fgs_bm,r.fgs_name "; | 226 | sql += " GROUP BY s.station_name,l.name,r.gs_bm,r.gs_name,r.fgs_bm,r.fgs_name "; |
| 224 | List<Linepasswengerflow> list = jdbcTemplate.query(sql, new RowMapper<Linepasswengerflow>() { | 227 | List<Linepasswengerflow> list = jdbcTemplate.query(sql, new RowMapper<Linepasswengerflow>() { |
| @@ -244,10 +247,10 @@ public class FormsServiceImpl implements FormsService { | @@ -244,10 +247,10 @@ public class FormsServiceImpl implements FormsService { | ||
| 244 | final String empnames=map.get("empnames").toString(); | 247 | final String empnames=map.get("empnames").toString(); |
| 245 | String gsdmManth=""; | 248 | String gsdmManth=""; |
| 246 | String fgsdmManth=""; | 249 | String fgsdmManth=""; |
| 247 | - if(map.containsKey("gsdmManth")){ | 250 | + if(map.get("gsdmManth") != null){ |
| 248 | gsdmManth=map.get("gsdmManth").toString(); | 251 | gsdmManth=map.get("gsdmManth").toString(); |
| 249 | } | 252 | } |
| 250 | - if(map.containsKey("fgsdmManth")){ | 253 | + if(map.get("fgsdmManth") != null){ |
| 251 | fgsdmManth=map.get("fgsdmManth").toString(); | 254 | fgsdmManth=map.get("fgsdmManth").toString(); |
| 252 | } | 255 | } |
| 253 | String sql ="select "; | 256 | String sql ="select "; |
| @@ -410,10 +413,10 @@ public class FormsServiceImpl implements FormsService { | @@ -410,10 +413,10 @@ public class FormsServiceImpl implements FormsService { | ||
| 410 | final String empnames=map.get("empnames").toString(); | 413 | final String empnames=map.get("empnames").toString(); |
| 411 | String gsdmManth=""; | 414 | String gsdmManth=""; |
| 412 | String fgsdmManth=""; | 415 | String fgsdmManth=""; |
| 413 | - if(map.containsKey("gsdmManth")){ | 416 | + if(map.get("gsdmManth")!=null){ |
| 414 | gsdmManth=map.get("gsdmManth").toString(); | 417 | gsdmManth=map.get("gsdmManth").toString(); |
| 415 | } | 418 | } |
| 416 | - if(map.containsKey("fgsdmManth")){ | 419 | + if(map.get("fgsdmManth")!=null){ |
| 417 | fgsdmManth=map.get("fgsdmManth").toString(); | 420 | fgsdmManth=map.get("fgsdmManth").toString(); |
| 418 | } | 421 | } |
| 419 | String sql ="select "; | 422 | String sql ="select "; |
| @@ -766,6 +769,10 @@ public class FormsServiceImpl implements FormsService { | @@ -766,6 +769,10 @@ public class FormsServiceImpl implements FormsService { | ||
| 766 | 769 | ||
| 767 | rq = rq2 + "-" + rq3; | 770 | rq = rq2 + "-" + rq3; |
| 768 | 771 | ||
| 772 | + String sfyy=""; | ||
| 773 | + if(map.get("sfyy")!=null){ | ||
| 774 | + sfyy=map.get("sfyy").toString(); | ||
| 775 | + } | ||
| 769 | String line=""; | 776 | String line=""; |
| 770 | if(map.get("line")!=null){ | 777 | if(map.get("line")!=null){ |
| 771 | line=map.get("line").toString().trim(); | 778 | line=map.get("line").toString().trim(); |
| @@ -784,21 +791,23 @@ public class FormsServiceImpl implements FormsService { | @@ -784,21 +791,23 @@ public class FormsServiceImpl implements FormsService { | ||
| 784 | 791 | ||
| 785 | if(!line.equals("")){ | 792 | if(!line.equals("")){ |
| 786 | sql +=" and xl= '"+line+"'"; | 793 | sql +=" and xl= '"+line+"'"; |
| 787 | - }else{ | ||
| 788 | - sql += " and gs= '"+gs+"' and fgs= '"+fgs+"'"; | 794 | + } |
| 795 | + if(!gs.equals("")){ | ||
| 796 | + sql += " and gs= '"+gs+"'"; | ||
| 797 | + } | ||
| 798 | + if(!fgs.equals("")){ | ||
| 799 | + sql += " and fgs= '"+fgs+"'"; | ||
| 789 | } | 800 | } |
| 790 | 801 | ||
| 791 | sql +=" order by rq"; | 802 | sql +=" order by rq"; |
| 792 | List<Changetochange> list = jdbcTemplate.query(sql, new RowMapper<Changetochange>() { | 803 | List<Changetochange> list = jdbcTemplate.query(sql, new RowMapper<Changetochange>() { |
| 793 | - | ||
| 794 | - | ||
| 795 | @Override | 804 | @Override |
| 796 | public Changetochange mapRow(ResultSet arg0, int arg1) throws SQLException { | 805 | public Changetochange mapRow(ResultSet arg0, int arg1) throws SQLException { |
| 797 | Changetochange chan = new Changetochange(); | 806 | Changetochange chan = new Changetochange(); |
| 798 | chan.setRq(arg0.getString("rq")); | 807 | chan.setRq(arg0.getString("rq")); |
| 799 | chan.setGs(BasicData.businessCodeNameMap.get(arg0.getString("gs"))); | 808 | chan.setGs(BasicData.businessCodeNameMap.get(arg0.getString("gs"))); |
| 800 | chan.setFgs(BasicData.businessFgsCodeNameMap.get(arg0.getString("fgs")+"_"+arg0.getString("gs"))); | 809 | chan.setFgs(BasicData.businessFgsCodeNameMap.get(arg0.getString("fgs")+"_"+arg0.getString("gs"))); |
| 801 | - chan.setXl(BasicData.lineCode2NameMap.get(arg0.getString("xl"))); | 810 | + chan.setXl(arg0.getString("xl")); |
| 802 | chan.setLp(arg0.getString("lp")); | 811 | chan.setLp(arg0.getString("lp")); |
| 803 | chan.setFssj(arg0.getString("fssj")); | 812 | chan.setFssj(arg0.getString("fssj")); |
| 804 | chan.setXgsj(arg0.getString("xgsj")); | 813 | chan.setXgsj(arg0.getString("xgsj")); |
| @@ -813,13 +822,42 @@ public class FormsServiceImpl implements FormsService { | @@ -813,13 +822,42 @@ public class FormsServiceImpl implements FormsService { | ||
| 813 | return chan; | 822 | return chan; |
| 814 | } | 823 | } |
| 815 | }); | 824 | }); |
| 816 | - return list; | 825 | + |
| 826 | + Map<String, Boolean> lineNature = lineService.lineNature(); | ||
| 827 | + List<Changetochange> resList = new ArrayList<Changetochange>(); | ||
| 828 | + | ||
| 829 | + for(Changetochange c : list){ | ||
| 830 | + String xl = c.getXl(); | ||
| 831 | + if(sfyy.length() != 0){ | ||
| 832 | + if(sfyy.equals("0")){ | ||
| 833 | + resList.add(c); | ||
| 834 | + } else if(sfyy.equals("1")){ | ||
| 835 | + if(lineNature.containsKey(xl) && lineNature.get(xl)){ | ||
| 836 | + resList.add(c); | ||
| 837 | + } | ||
| 838 | + } else { | ||
| 839 | + if(lineNature.containsKey(xl) && !lineNature.get(xl)){ | ||
| 840 | + resList.add(c); | ||
| 841 | + } | ||
| 842 | + } | ||
| 843 | + } else { | ||
| 844 | + resList.add(c); | ||
| 845 | + } | ||
| 846 | + | ||
| 847 | + c.setXl(BasicData.lineCode2NameMap.get(xl)); | ||
| 848 | + } | ||
| 849 | + | ||
| 850 | + return resList; | ||
| 817 | } | 851 | } |
| 818 | 852 | ||
| 819 | 853 | ||
| 820 | // 路单数据 | 854 | // 路单数据 |
| 821 | @Override | 855 | @Override |
| 822 | public List<Singledata> singledatatj(Map<String, Object> map) { | 856 | public List<Singledata> singledatatj(Map<String, Object> map) { |
| 857 | + String sfyy=""; | ||
| 858 | + if(map.get("sfyy")!=null){ | ||
| 859 | + sfyy=map.get("sfyy").toString(); | ||
| 860 | + } | ||
| 823 | String gsdm=""; | 861 | String gsdm=""; |
| 824 | if(map.get("gsdmSing")!=null){ | 862 | if(map.get("gsdmSing")!=null){ |
| 825 | gsdm=map.get("gsdmSing").toString(); | 863 | gsdm=map.get("gsdmSing").toString(); |
| @@ -843,16 +881,20 @@ public class FormsServiceImpl implements FormsService { | @@ -843,16 +881,20 @@ public class FormsServiceImpl implements FormsService { | ||
| 843 | List<Singledata> list_=new ArrayList<Singledata>(); | 881 | List<Singledata> list_=new ArrayList<Singledata>(); |
| 844 | if(tjtype.equals("jsy")){ | 882 | if(tjtype.equals("jsy")){ |
| 845 | //油统计 | 883 | //油统计 |
| 846 | - String sql="select r.j_gh, r.xl_bm,r.cl_zbh,r.j_name" | 884 | + String sql="select r.j_gh, r.xl_bm,r.cl_zbh,r.j_name,r.fgs_bm" |
| 847 | + " from bsth_c_s_sp_info_real r where " | 885 | + " from bsth_c_s_sp_info_real r where " |
| 848 | + " r.schedule_date_str = '"+startDate+"'"; | 886 | + " r.schedule_date_str = '"+startDate+"'"; |
| 849 | - if(xlbm.equals("")){ | ||
| 850 | - sql +="and r.gs_bm='"+gsdm+"' " | ||
| 851 | - + " and r.fgs_bm='"+fgsdm+"'"; | ||
| 852 | - }else{ | 887 | + if(xlbm.length() != 0){ |
| 853 | sql += " and r.xl_bm = '"+xlbm+"'"; | 888 | sql += " and r.xl_bm = '"+xlbm+"'"; |
| 854 | } | 889 | } |
| 855 | - sql += " group by r.j_gh,r.xl_bm,r.cl_zbh,r.j_name order by r.xl_bm,r.cl_zbh"; | 890 | + if(gsdm.length() != 0){ |
| 891 | + sql += " and r.gs_bm ='"+gsdm+"'"; | ||
| 892 | + } | ||
| 893 | + if(fgsdm.length() != 0){ | ||
| 894 | + sql += " and r.fgs_bm ='"+fgsdm+"'"; | ||
| 895 | + } | ||
| 896 | + sql += " group by r.j_gh,r.xl_bm,r.cl_zbh,r.j_name order by r.xl_bm,r.cl_zbh"; | ||
| 897 | + | ||
| 856 | list = jdbcTemplate.query(sql, new RowMapper<Singledata>() { | 898 | list = jdbcTemplate.query(sql, new RowMapper<Singledata>() { |
| 857 | @Override | 899 | @Override |
| 858 | public Singledata mapRow(ResultSet arg0, int arg1) throws SQLException { | 900 | public Singledata mapRow(ResultSet arg0, int arg1) throws SQLException { |
| @@ -861,20 +903,30 @@ public class FormsServiceImpl implements FormsService { | @@ -861,20 +903,30 @@ public class FormsServiceImpl implements FormsService { | ||
| 861 | sin.setJsy(arg0.getString("j_gh")); | 903 | sin.setJsy(arg0.getString("j_gh")); |
| 862 | sin.setjName(arg0.getString("j_name")); | 904 | sin.setjName(arg0.getString("j_name")); |
| 863 | sin.setClzbh(arg0.getString("cl_zbh")); | 905 | sin.setClzbh(arg0.getString("cl_zbh")); |
| 906 | + sin.setgS(arg0.getString("fgs_bm")); | ||
| 864 | return sin; | 907 | return sin; |
| 865 | } | 908 | } |
| 866 | }); | 909 | }); |
| 910 | + | ||
| 911 | + Collections.sort(list,new SingledataByXlbm()); | ||
| 912 | + | ||
| 867 | String linesql=""; | 913 | String linesql=""; |
| 868 | if(!xlbm.equals("")){ | 914 | if(!xlbm.equals("")){ |
| 869 | linesql +=" and xlbm ='"+xlbm+"' "; | 915 | linesql +=" and xlbm ='"+xlbm+"' "; |
| 870 | } | 916 | } |
| 871 | - String nysql="SELECT id,xlbm,nbbm, jsy,jzl as jzl,yh as yh,sh as sh FROM bsth_c_ylb " | 917 | + if(!gsdm.equals("")){ |
| 918 | + linesql +=" and ssgsdm ='"+gsdm+"' "; | ||
| 919 | + } | ||
| 920 | + if(!fgsdm.equals("")){ | ||
| 921 | + linesql +=" and fgsdm ='"+fgsdm+"' "; | ||
| 922 | + } | ||
| 923 | + String nysql="SELECT id,xlbm,nbbm,jsy,jzl as jzl,yh as yh,sh as sh,fgsdm FROM bsth_c_ylb" | ||
| 872 | + " WHERE rq = '"+startDate+"'" | 924 | + " WHERE rq = '"+startDate+"'" |
| 873 | - + " AND ssgsdm = '"+gsdm+"' AND fgsdm = '"+fgsdm+"'" +linesql | 925 | + + linesql |
| 874 | + " union" | 926 | + " union" |
| 875 | - + " SELECT id,xlbm,nbbm,jsy,cdl as jzl,hd as yh,sh as sh FROM bsth_c_dlb" | 927 | + + " SELECT id,xlbm,nbbm,jsy,cdl as jzl,hd as yh,sh as sh,fgsdm FROM bsth_c_dlb" |
| 876 | + " WHERE rq = '"+startDate+"'" | 928 | + " WHERE rq = '"+startDate+"'" |
| 877 | - + " AND ssgsdm = '"+gsdm+"' AND fgsdm = '"+fgsdm+"'"+linesql; | 929 | + + linesql; |
| 878 | List<Singledata> listNy = jdbcTemplate.query(nysql, new RowMapper<Singledata>() { | 930 | List<Singledata> listNy = jdbcTemplate.query(nysql, new RowMapper<Singledata>() { |
| 879 | @Override | 931 | @Override |
| 880 | public Singledata mapRow(ResultSet arg0, int arg1) throws SQLException { | 932 | public Singledata mapRow(ResultSet arg0, int arg1) throws SQLException { |
| @@ -885,6 +937,7 @@ public class FormsServiceImpl implements FormsService { | @@ -885,6 +937,7 @@ public class FormsServiceImpl implements FormsService { | ||
| 885 | sin.setJzl(arg0.getString("jzl")); | 937 | sin.setJzl(arg0.getString("jzl")); |
| 886 | sin.setHyl(arg0.getString("yh")); | 938 | sin.setHyl(arg0.getString("yh")); |
| 887 | sin.setUnyyyl(arg0.getString("sh")); | 939 | sin.setUnyyyl(arg0.getString("sh")); |
| 940 | + sin.setgS(arg0.getString("fgsdm")); | ||
| 888 | return sin; | 941 | return sin; |
| 889 | } | 942 | } |
| 890 | }); | 943 | }); |
| @@ -913,7 +966,7 @@ public class FormsServiceImpl implements FormsService { | @@ -913,7 +966,7 @@ public class FormsServiceImpl implements FormsService { | ||
| 913 | s.setClzbh(clzbh); | 966 | s.setClzbh(clzbh); |
| 914 | s.setSgh(""); | 967 | s.setSgh(""); |
| 915 | s.setsName(""); | 968 | s.setsName(""); |
| 916 | - s.setgS(BasicData.businessFgsCodeNameMap.get(fgsdm+"_"+gsdm)); | 969 | + s.setgS(BasicData.businessFgsCodeNameMap.get(sin_.getgS()+"_"+gsdm)); |
| 917 | s.setxL(line); | 970 | s.setxL(line); |
| 918 | s.setXlmc(BasicData.lineCode2NameMap.get(line)); | 971 | s.setXlmc(BasicData.lineCode2NameMap.get(line)); |
| 919 | s.setJzl(sin_.getJzl()); | 972 | s.setJzl(sin_.getJzl()); |
| @@ -983,27 +1036,29 @@ public class FormsServiceImpl implements FormsService { | @@ -983,27 +1036,29 @@ public class FormsServiceImpl implements FormsService { | ||
| 983 | // sin.setjName(BasicData.allPerson.get(gsdm+"-"+jsy)); | 1036 | // sin.setjName(BasicData.allPerson.get(gsdm+"-"+jsy)); |
| 984 | sin.setSgh(""); | 1037 | sin.setSgh(""); |
| 985 | sin.setsName(""); | 1038 | sin.setsName(""); |
| 986 | - sin.setgS(BasicData.businessFgsCodeNameMap.get(fgsdm+"_"+gsdm)); | 1039 | + sin.setgS(BasicData.businessFgsCodeNameMap.get(sin.getgS()+"_"+gsdm)); |
| 987 | list_.add(sin); | 1040 | list_.add(sin); |
| 988 | 1041 | ||
| 989 | } | 1042 | } |
| 990 | - Collections.sort(list_,new SingledataByXlbm()); | ||
| 991 | }else{ | 1043 | }else{ |
| 992 | String sql="select r.s_gh,r.s_name, " | 1044 | String sql="select r.s_gh,r.s_name, " |
| 993 | + " r.xl_bm,r.cl_zbh,r.gs_bm,r.fgs_bm" | 1045 | + " r.xl_bm,r.cl_zbh,r.gs_bm,r.fgs_bm" |
| 994 | + " from bsth_c_s_sp_info_real r where " | 1046 | + " from bsth_c_s_sp_info_real r where " |
| 995 | + " r.schedule_date_str = '"+startDate+"'" | 1047 | + " r.schedule_date_str = '"+startDate+"'" |
| 996 | + " and r.s_gh !='' and r.s_gh is not null "; | 1048 | + " and r.s_gh !='' and r.s_gh is not null "; |
| 997 | - if(xlbm.equals("")){ | ||
| 998 | - sql +="and r.gs_bm='"+gsdm+"' " | ||
| 999 | - + " and r.fgs_bm='"+fgsdm+"'"; | ||
| 1000 | - }else{ | 1049 | + if(!xlbm.equals("")){ |
| 1001 | sql += " and r.xl_bm = '"+xlbm+"'"; | 1050 | sql += " and r.xl_bm = '"+xlbm+"'"; |
| 1002 | } | 1051 | } |
| 1003 | - sql += " group by r.s_gh,r.s_name," | 1052 | + if(!gsdm.equals("")){ |
| 1053 | + sql += " and r.gs_bm = '"+gsdm+"'"; | ||
| 1054 | + } | ||
| 1055 | + if(!fgsdm.equals("")){ | ||
| 1056 | + sql += " and r.fgs_bm = '"+fgsdm+"'"; | ||
| 1057 | + } | ||
| 1058 | + sql += " group by r.s_gh,r.s_name," | ||
| 1004 | + " r.xl_bm,r.cl_zbh,r.gs_bm,r.fgs_bm order by r.xl_bm,r.cl_zbh"; | 1059 | + " r.xl_bm,r.cl_zbh,r.gs_bm,r.fgs_bm order by r.xl_bm,r.cl_zbh"; |
| 1005 | 1060 | ||
| 1006 | - list = jdbcTemplate.query(sql, new RowMapper<Singledata>() { | 1061 | + list = jdbcTemplate.query(sql, new RowMapper<Singledata>() { |
| 1007 | //SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); | 1062 | //SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); |
| 1008 | @Override | 1063 | @Override |
| 1009 | public Singledata mapRow(ResultSet arg0, int arg1) throws SQLException { | 1064 | public Singledata mapRow(ResultSet arg0, int arg1) throws SQLException { |
| @@ -1013,10 +1068,13 @@ public class FormsServiceImpl implements FormsService { | @@ -1013,10 +1068,13 @@ public class FormsServiceImpl implements FormsService { | ||
| 1013 | sin.setClzbh(arg0.getString("cl_zbh")); | 1068 | sin.setClzbh(arg0.getString("cl_zbh")); |
| 1014 | sin.setSgh(arg0.getString("s_gh")); | 1069 | sin.setSgh(arg0.getString("s_gh")); |
| 1015 | sin.setsName(arg0.getString("s_name")); | 1070 | sin.setsName(arg0.getString("s_name")); |
| 1071 | + sin.setgS(arg0.getString("fgs_bm")); | ||
| 1016 | return sin; | 1072 | return sin; |
| 1017 | } | 1073 | } |
| 1018 | }); | 1074 | }); |
| 1019 | 1075 | ||
| 1076 | + Collections.sort(list,new SingledataByXlbm()); | ||
| 1077 | + | ||
| 1020 | for (int i = 0; i < list.size(); i++) { | 1078 | for (int i = 0; i < list.size(); i++) { |
| 1021 | Singledata sin=list.get(i); | 1079 | Singledata sin=list.get(i); |
| 1022 | String jsy=sin.getSgh(); | 1080 | String jsy=sin.getSgh(); |
| @@ -1058,15 +1116,36 @@ public class FormsServiceImpl implements FormsService { | @@ -1058,15 +1116,36 @@ public class FormsServiceImpl implements FormsService { | ||
| 1058 | sin.setClzbh(clzbh); | 1116 | sin.setClzbh(clzbh); |
| 1059 | sin.setJsy(""); | 1117 | sin.setJsy(""); |
| 1060 | sin.setjName(""); | 1118 | sin.setjName(""); |
| 1061 | - sin.setgS(BasicData.businessFgsCodeNameMap.get(fgsdm+"_"+gsdm)); | 1119 | + sin.setgS(BasicData.businessFgsCodeNameMap.get(sin.getgS()+"_"+gsdm)); |
| 1062 | sin.setHyl(""); | 1120 | sin.setHyl(""); |
| 1063 | sin.setJzl(""); | 1121 | sin.setJzl(""); |
| 1064 | sin.setUnyyyl(""); | 1122 | sin.setUnyyyl(""); |
| 1065 | list_.add(sin); | 1123 | list_.add(sin); |
| 1066 | } | 1124 | } |
| 1067 | - Collections.sort(list_,new SingledataByXlbm()); | ||
| 1068 | } | 1125 | } |
| 1069 | - return list_; | 1126 | + |
| 1127 | + Map<String, Boolean> lineNature = lineService.lineNature(); | ||
| 1128 | + List<Singledata> resList = new ArrayList<Singledata>(); | ||
| 1129 | + for(Singledata s : list_){ | ||
| 1130 | + String xlBm = s.getxL(); | ||
| 1131 | + if(sfyy.length() != 0){ | ||
| 1132 | + if(sfyy.equals("0")){ | ||
| 1133 | + resList.add(s); | ||
| 1134 | + } else if(sfyy.equals("1")){ | ||
| 1135 | + if(lineNature.containsKey(xlBm) && lineNature.get(xlBm)){ | ||
| 1136 | + resList.add(s); | ||
| 1137 | + } | ||
| 1138 | + } else { | ||
| 1139 | + if(lineNature.containsKey(xlBm) && !lineNature.get(xlBm)){ | ||
| 1140 | + resList.add(s); | ||
| 1141 | + } | ||
| 1142 | + } | ||
| 1143 | + } else { | ||
| 1144 | + resList.add(s); | ||
| 1145 | + } | ||
| 1146 | + } | ||
| 1147 | + | ||
| 1148 | + return resList; | ||
| 1070 | } | 1149 | } |
| 1071 | 1150 | ||
| 1072 | 1151 | ||
| @@ -1098,12 +1177,15 @@ public class FormsServiceImpl implements FormsService { | @@ -1098,12 +1177,15 @@ public class FormsServiceImpl implements FormsService { | ||
| 1098 | String sql="select r.j_gh, r.xl_bm,r.cl_zbh,r.j_name" | 1177 | String sql="select r.j_gh, r.xl_bm,r.cl_zbh,r.j_name" |
| 1099 | + " from bsth_c_s_sp_info_real r where " | 1178 | + " from bsth_c_s_sp_info_real r where " |
| 1100 | + " r.schedule_date_str = '"+startDate+"'"; | 1179 | + " r.schedule_date_str = '"+startDate+"'"; |
| 1101 | - if(xlbm.equals("")){ | ||
| 1102 | - sql +="and r.gs_bm='"+gsdm+"' " | ||
| 1103 | - + " and r.fgs_bm='"+fgsdm+"'"; | ||
| 1104 | - }else{ | 1180 | + if(!xlbm.equals("")){ |
| 1105 | sql += " and r.xl_bm = '"+xlbm+"'"; | 1181 | sql += " and r.xl_bm = '"+xlbm+"'"; |
| 1106 | } | 1182 | } |
| 1183 | + if(!gsdm.equals("")){ | ||
| 1184 | + sql += " and r.gs_bm='"+gsdm+"'"; | ||
| 1185 | + } | ||
| 1186 | + if(!fgsdm.equals("")){ | ||
| 1187 | + sql += " and r.fgs_bm='"+fgsdm+"'"; | ||
| 1188 | + } | ||
| 1107 | sql += " group by r.j_gh,r.xl_bm,r.cl_zbh,r.j_name order by r.xl_bm,r.cl_zbh"; | 1189 | sql += " group by r.j_gh,r.xl_bm,r.cl_zbh,r.j_name order by r.xl_bm,r.cl_zbh"; |
| 1108 | list = jdbcTemplate.query(sql, new RowMapper<Singledata>() { | 1190 | list = jdbcTemplate.query(sql, new RowMapper<Singledata>() { |
| 1109 | @Override | 1191 | @Override |
| @@ -1118,15 +1200,21 @@ public class FormsServiceImpl implements FormsService { | @@ -1118,15 +1200,21 @@ public class FormsServiceImpl implements FormsService { | ||
| 1118 | }); | 1200 | }); |
| 1119 | String linesql=""; | 1201 | String linesql=""; |
| 1120 | if(!xlbm.equals("")){ | 1202 | if(!xlbm.equals("")){ |
| 1121 | - linesql +=" and xlbm ='"+xlbm+"' "; | 1203 | + linesql += " and xlbm ='"+xlbm+"' "; |
| 1122 | } | 1204 | } |
| 1205 | + if(!gsdm.equals("")){ | ||
| 1206 | + linesql += " and ssgsdm ='"+gsdm+"'"; | ||
| 1207 | + } | ||
| 1208 | + if(!fgsdm.equals("")){ | ||
| 1209 | + linesql += " and fgsdm ='"+fgsdm+"'"; | ||
| 1210 | + } | ||
| 1123 | String nysql="SELECT id,xlbm,nbbm, jsy,jzl as jzl,yh as yh,sh as sh FROM bsth_c_ylb " | 1211 | String nysql="SELECT id,xlbm,nbbm, jsy,jzl as jzl,yh as yh,sh as sh FROM bsth_c_ylb " |
| 1124 | + " WHERE rq = '"+startDate+"'" | 1212 | + " WHERE rq = '"+startDate+"'" |
| 1125 | - + " AND ssgsdm = '"+gsdm+"' AND fgsdm = '"+fgsdm+"'" +linesql | 1213 | + + linesql |
| 1126 | + " union" | 1214 | + " union" |
| 1127 | + " SELECT id,xlbm,nbbm,jsy,cdl as jzl,hd as yh,sh as sh FROM bsth_c_dlb" | 1215 | + " SELECT id,xlbm,nbbm,jsy,cdl as jzl,hd as yh,sh as sh FROM bsth_c_dlb" |
| 1128 | + " WHERE rq = '"+startDate+"'" | 1216 | + " WHERE rq = '"+startDate+"'" |
| 1129 | - + " AND ssgsdm = '"+gsdm+"' AND fgsdm = '"+fgsdm+"'"+linesql; | 1217 | + + linesql; |
| 1130 | List<Singledata> listNy = jdbcTemplate.query(nysql, new RowMapper<Singledata>() { | 1218 | List<Singledata> listNy = jdbcTemplate.query(nysql, new RowMapper<Singledata>() { |
| 1131 | @Override | 1219 | @Override |
| 1132 | public Singledata mapRow(ResultSet arg0, int arg1) throws SQLException { | 1220 | public Singledata mapRow(ResultSet arg0, int arg1) throws SQLException { |
| @@ -1246,14 +1334,17 @@ public class FormsServiceImpl implements FormsService { | @@ -1246,14 +1334,17 @@ public class FormsServiceImpl implements FormsService { | ||
| 1246 | + " from bsth_c_s_sp_info_real r where " | 1334 | + " from bsth_c_s_sp_info_real r where " |
| 1247 | + " r.schedule_date_str = '"+startDate+"'" | 1335 | + " r.schedule_date_str = '"+startDate+"'" |
| 1248 | + " and r.s_gh !='' and r.s_gh is not null "; | 1336 | + " and r.s_gh !='' and r.s_gh is not null "; |
| 1249 | - if(xlbm.equals("")){ | ||
| 1250 | - sql +="and r.gs_bm='"+gsdm+"' " | ||
| 1251 | - + " and r.fgs_bm='"+fgsdm+"'"; | ||
| 1252 | - }else{ | 1337 | + if(!xlbm.equals("")){ |
| 1253 | sql += " and r.xl_bm = '"+xlbm+"'"; | 1338 | sql += " and r.xl_bm = '"+xlbm+"'"; |
| 1254 | } | 1339 | } |
| 1255 | - sql += " group by r.s_gh,r.s_name," | ||
| 1256 | - + " r.xl_bm,r.cl_zbh,r.gs_bm,r.fgs_bm order by r.xl_bm,r.cl_zbh"; | 1340 | + if(!gsdm.equals("")){ |
| 1341 | + sql += " and r.gs_bm='"+gsdm+"'"; | ||
| 1342 | + } | ||
| 1343 | + if(!fgsdm.equals("")){ | ||
| 1344 | + sql += " and r.fgs_bm='"+fgsdm+"'"; | ||
| 1345 | + } | ||
| 1346 | + sql += " group by r.s_gh,r.s_name," | ||
| 1347 | + + " r.xl_bm,r.cl_zbh,r.gs_bm,r.fgs_bm order by r.xl_bm,r.cl_zbh"; | ||
| 1257 | 1348 | ||
| 1258 | list = jdbcTemplate.query(sql, new RowMapper<Singledata>() { | 1349 | list = jdbcTemplate.query(sql, new RowMapper<Singledata>() { |
| 1259 | //SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); | 1350 | //SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); |
| @@ -1635,14 +1726,17 @@ public class FormsServiceImpl implements FormsService { | @@ -1635,14 +1726,17 @@ public class FormsServiceImpl implements FormsService { | ||
| 1635 | String sql="select r.s_gh,r.s_name, " | 1726 | String sql="select r.s_gh,r.s_name, " |
| 1636 | + " r.xl_bm,r.cl_zbh,r.j_gh,r.j_name,r.gs_bm,r.fgs_bm" | 1727 | + " r.xl_bm,r.cl_zbh,r.j_gh,r.j_name,r.gs_bm,r.fgs_bm" |
| 1637 | + " from bsth_c_s_sp_info_real r where r.schedule_date_str = '"+startDate+"'"; | 1728 | + " from bsth_c_s_sp_info_real r where r.schedule_date_str = '"+startDate+"'"; |
| 1638 | - if(xlbm.equals("")){ | ||
| 1639 | - sql +="and r.gs_bm='"+gsdm+"' " | ||
| 1640 | - + " and r.fgs_bm='"+fgsdm+"'"; | ||
| 1641 | - }else{ | 1729 | + if(!xlbm.equals("")){ |
| 1642 | sql += " and r.xl_bm = '"+xlbm+"'"; | 1730 | sql += " and r.xl_bm = '"+xlbm+"'"; |
| 1643 | } | 1731 | } |
| 1644 | - sql += " group by r.s_gh,r.s_name," | ||
| 1645 | - + " r.xl_bm,r.cl_zbh,r.j_gh,r.j_name,r.gs_bm,r.fgs_bm order by r.xl_bm,r.cl_zbh"; | 1732 | + if(!gsdm.equals("")){ |
| 1733 | + sql += " and r.gs_bm='"+gsdm+"'"; | ||
| 1734 | + } | ||
| 1735 | + if(!fgsdm.equals("")){ | ||
| 1736 | + sql += " and r.fgs_bm='"+fgsdm+"'"; | ||
| 1737 | + } | ||
| 1738 | + sql += " group by r.s_gh,r.s_name," | ||
| 1739 | + + " r.xl_bm,r.cl_zbh,r.j_gh,r.j_name,r.gs_bm,r.fgs_bm order by r.xl_bm,r.cl_zbh"; | ||
| 1646 | 1740 | ||
| 1647 | List<Singledata> list = jdbcTemplate.query(sql, new RowMapper<Singledata>() { | 1741 | List<Singledata> list = jdbcTemplate.query(sql, new RowMapper<Singledata>() { |
| 1648 | //SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); | 1742 | //SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); |
| @@ -1929,14 +2023,17 @@ public class FormsServiceImpl implements FormsService { | @@ -1929,14 +2023,17 @@ public class FormsServiceImpl implements FormsService { | ||
| 1929 | + " from bsth_c_s_sp_info_real r where " | 2023 | + " from bsth_c_s_sp_info_real r where " |
| 1930 | + " r.schedule_date_str = '"+startDate+"'" | 2024 | + " r.schedule_date_str = '"+startDate+"'" |
| 1931 | + " and r.s_gh !='' and r.s_gh is not null "; | 2025 | + " and r.s_gh !='' and r.s_gh is not null "; |
| 1932 | - if(xlbm.equals("")){ | ||
| 1933 | - sql +="and r.gs_bm='"+gsdm+"' " | ||
| 1934 | - + " and r.fgs_bm='"+fgsdm+"'"; | ||
| 1935 | - }else{ | 2026 | + if(!xlbm.equals("")){ |
| 1936 | sql += " and r.xl_bm = '"+xlbm+"'"; | 2027 | sql += " and r.xl_bm = '"+xlbm+"'"; |
| 1937 | } | 2028 | } |
| 1938 | - sql += " group by r.s_gh,r.s_name," | ||
| 1939 | - + " r.xl_bm,r.cl_zbh,r.gs_bm,r.fgs_bm order by r.xl_bm,r.cl_zbh"; | 2029 | + if(!gsdm.equals("")){ |
| 2030 | + sql += " and r.gs_bm='"+gsdm+"'"; | ||
| 2031 | + } | ||
| 2032 | + if(!fgsdm.equals("")){ | ||
| 2033 | + sql += " and r.fgs_bm='"+fgsdm+"'"; | ||
| 2034 | + } | ||
| 2035 | + sql += " group by r.s_gh,r.s_name," | ||
| 2036 | + + " r.xl_bm,r.cl_zbh,r.gs_bm,r.fgs_bm order by r.xl_bm,r.cl_zbh"; | ||
| 1940 | 2037 | ||
| 1941 | list = jdbcTemplate.query(sql, new RowMapper<Singledata>() { | 2038 | list = jdbcTemplate.query(sql, new RowMapper<Singledata>() { |
| 1942 | //SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); | 2039 | //SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); |
| @@ -2205,13 +2302,16 @@ public class FormsServiceImpl implements FormsService { | @@ -2205,13 +2302,16 @@ public class FormsServiceImpl implements FormsService { | ||
| 2205 | + " r.xl_bm,r.cl_zbh,r.gs_bm,r.fgs_bm" | 2302 | + " r.xl_bm,r.cl_zbh,r.gs_bm,r.fgs_bm" |
| 2206 | + " from bsth_c_s_sp_info_real r where " | 2303 | + " from bsth_c_s_sp_info_real r where " |
| 2207 | + " r.schedule_date_str = '"+startDate+"'" | 2304 | + " r.schedule_date_str = '"+startDate+"'" |
| 2208 | - + " and r.s_gh !='' and r.s_gh is not null "; | ||
| 2209 | - if(xlbm.equals("")){ | ||
| 2210 | - sql +="and r.gs_bm='"+gsdm+"' " | ||
| 2211 | - + " and r.fgs_bm='"+fgsdm+"'"; | ||
| 2212 | - }else{ | 2305 | + + " and r.s_gh !='' and r.s_gh is not null "; |
| 2306 | + if(!xlbm.equals("")){ | ||
| 2213 | sql += " and r.xl_bm = '"+xlbm+"'"; | 2307 | sql += " and r.xl_bm = '"+xlbm+"'"; |
| 2214 | } | 2308 | } |
| 2309 | + if(!gsdm.equals("")){ | ||
| 2310 | + sql += " and r.gs_bm='"+gsdm+"'"; | ||
| 2311 | + } | ||
| 2312 | + if(!fgsdm.equals("")){ | ||
| 2313 | + sql += " and r.fgs_bm='"+fgsdm+"'"; | ||
| 2314 | + } | ||
| 2215 | sql += " group by r.s_gh,r.s_name," | 2315 | sql += " group by r.s_gh,r.s_name," |
| 2216 | + " r.xl_bm,r.cl_zbh,r.gs_bm,r.fgs_bm order by r.xl_bm,r.cl_zbh"; | 2316 | + " r.xl_bm,r.cl_zbh,r.gs_bm,r.fgs_bm order by r.xl_bm,r.cl_zbh"; |
| 2217 | 2317 | ||
| @@ -2285,7 +2385,10 @@ public class FormsServiceImpl implements FormsService { | @@ -2285,7 +2385,10 @@ public class FormsServiceImpl implements FormsService { | ||
| 2285 | @Override | 2385 | @Override |
| 2286 | public List<Operationservice> operationservice(Map<String, Object> map) { | 2386 | public List<Operationservice> operationservice(Map<String, Object> map) { |
| 2287 | 2387 | ||
| 2288 | - String xlbm=map.get("line").toString().trim(); | 2388 | + String sfyy=""; |
| 2389 | + if(map.get("sfyy")!=null){ | ||
| 2390 | + sfyy=map.get("sfyy").toString(); | ||
| 2391 | + } | ||
| 2289 | String gsdm=""; | 2392 | String gsdm=""; |
| 2290 | if(map.get("gsdmOperat")!=null){ | 2393 | if(map.get("gsdmOperat")!=null){ |
| 2291 | gsdm=map.get("gsdmOperat").toString(); | 2394 | gsdm=map.get("gsdmOperat").toString(); |
| @@ -2294,37 +2397,72 @@ public class FormsServiceImpl implements FormsService { | @@ -2294,37 +2397,72 @@ public class FormsServiceImpl implements FormsService { | ||
| 2294 | if(map.get("fgsdmOperat")!=null){ | 2397 | if(map.get("fgsdmOperat")!=null){ |
| 2295 | fgsdm=map.get("fgsdmOperat").toString(); | 2398 | fgsdm=map.get("fgsdmOperat").toString(); |
| 2296 | } | 2399 | } |
| 2297 | - startDate=map.get("startDate").toString(); | ||
| 2298 | - endDate =map.get("endDate").toString(); | ||
| 2299 | - String sql="select r.xl_bm" | 2400 | + String xlbm=map.get("line").toString().trim(); |
| 2401 | + String startDate=map.get("startDate").toString(); | ||
| 2402 | + String endDate =map.get("endDate").toString(); | ||
| 2403 | + | ||
| 2404 | + String sql="select r.xl_bm, r.gs_bm, r.fgs_bm" | ||
| 2300 | + " from bsth_c_s_sp_info_real r where" | 2405 | + " from bsth_c_s_sp_info_real r where" |
| 2301 | + " r.schedule_date_str BETWEEN '"+startDate+"' and '"+endDate+"'"; | 2406 | + " r.schedule_date_str BETWEEN '"+startDate+"' and '"+endDate+"'"; |
| 2302 | - if(xlbm.equals("")){ | ||
| 2303 | - sql +="and r.gs_bm='"+gsdm+"' " | ||
| 2304 | - + " and r.fgs_bm='"+fgsdm+"'"; | ||
| 2305 | - }else{ | 2407 | + if(xlbm.length() != 0){ |
| 2306 | sql += " and r.xl_bm = '"+xlbm+"'"; | 2408 | sql += " and r.xl_bm = '"+xlbm+"'"; |
| 2307 | } | 2409 | } |
| 2308 | - sql += " group by r.xl_bm"; | ||
| 2309 | - | 2410 | + if(gsdm.length() != 0){ |
| 2411 | + sql += " and r.gs_bm='"+gsdm+"'"; | ||
| 2412 | + } | ||
| 2413 | + if(fgsdm.length() != 0){ | ||
| 2414 | + sql += " and r.fgs_bm='"+fgsdm+"'"; | ||
| 2415 | + } | ||
| 2416 | + sql += " group by r.gs_bm, r.fgs_bm, r.xl_bm " + | ||
| 2417 | + "order by r.gs_bm, r.fgs_bm, r.xl_bm"; | ||
| 2418 | + | ||
| 2419 | + System.out.println(sql); | ||
| 2310 | 2420 | ||
| 2311 | - List<Operationservice> list= jdbcTemplate.query(sql, new RowMapper<Operationservice>() { | ||
| 2312 | - @Override | ||
| 2313 | - public Operationservice mapRow(ResultSet arg0, int arg1) throws SQLException { | ||
| 2314 | - Operationservice ve = new Operationservice(); | ||
| 2315 | - ve.setXlBm(arg0.getString("xl_bm")); | ||
| 2316 | - return ve; | 2421 | + List<Operationservice> query = jdbcTemplate.query(sql, new RowMapper<Operationservice>() { |
| 2422 | + @Override | ||
| 2423 | + public Operationservice mapRow(ResultSet arg0, int arg1) throws SQLException { | ||
| 2424 | + Operationservice ve = new Operationservice(); | ||
| 2425 | + ve.setXlBm(arg0.getString("xl_bm")); | ||
| 2426 | + ve.setGs(arg0.getString("gs_bm")); | ||
| 2427 | + ve.setFgs(arg0.getString("fgs_bm")); | ||
| 2428 | + return ve; | ||
| 2429 | + } | ||
| 2430 | + }); | ||
| 2431 | + | ||
| 2432 | + List<Operationservice> list = new ArrayList<Operationservice>(); | ||
| 2433 | + Map<String, Boolean> lineNature = lineService.lineNature(); | ||
| 2434 | + for(Operationservice o : query){ | ||
| 2435 | + o.setFgs(BasicData.businessFgsCodeNameMap.get(o.getFgs()+"_"+o.getGs())); | ||
| 2436 | + | ||
| 2437 | + String xl = o.getXlBm(); | ||
| 2438 | + if(sfyy.length() != 0){ | ||
| 2439 | + if(sfyy.equals("0")){ | ||
| 2440 | + list.add(o); | ||
| 2441 | + } else if(sfyy.equals("1")){ | ||
| 2442 | + if(lineNature.containsKey(xl) && lineNature.get(xl)){ | ||
| 2443 | + list.add(o); | ||
| 2444 | + } | ||
| 2445 | + } else { | ||
| 2446 | + if(lineNature.containsKey(xl) && !lineNature.get(xl)){ | ||
| 2447 | + list.add(o); | ||
| 2448 | + } | ||
| 2317 | } | 2449 | } |
| 2318 | - }); | ||
| 2319 | - | ||
| 2320 | - String ylbSql=" select * from bsth_c_ylb where rq BETWEEN '"+startDate+"' and '"+endDate+"'"; | ||
| 2321 | - if(xlbm.equals("")){ | ||
| 2322 | - ylbSql +="and ssgsdm='"+gsdm+"' " | ||
| 2323 | - + " and fgsdm='"+fgsdm+"'"; | ||
| 2324 | - }else{ | 2450 | + } else { |
| 2451 | + list.add(o); | ||
| 2452 | + } | ||
| 2453 | + } | ||
| 2454 | + | ||
| 2455 | + String ylbSql=" select * from bsth_c_ylb where rq BETWEEN '"+startDate+"' and '"+endDate+"'"; | ||
| 2456 | + if(!xlbm.equals("")){ | ||
| 2325 | ylbSql += " and xlbm = '"+xlbm+"'"; | 2457 | ylbSql += " and xlbm = '"+xlbm+"'"; |
| 2326 | } | 2458 | } |
| 2327 | - List<Ylb> ylbList= jdbcTemplate.query(ylbSql, new RowMapper<Ylb>() { | 2459 | + if(!gsdm.equals("")){ |
| 2460 | + ylbSql += " and ssgsdm='"+gsdm+"'"; | ||
| 2461 | + } | ||
| 2462 | + if(!fgsdm.equals("")){ | ||
| 2463 | + ylbSql += " and fgsdm='"+fgsdm+"'"; | ||
| 2464 | + } | ||
| 2465 | + List<Ylb> ylbList= jdbcTemplate.query(ylbSql, new RowMapper<Ylb>() { | ||
| 2328 | @Override | 2466 | @Override |
| 2329 | public Ylb mapRow(ResultSet arg0, int arg1) throws SQLException { | 2467 | public Ylb mapRow(ResultSet arg0, int arg1) throws SQLException { |
| 2330 | Ylb y = new Ylb(); | 2468 | Ylb y = new Ylb(); |
| @@ -2333,16 +2471,19 @@ public class FormsServiceImpl implements FormsService { | @@ -2333,16 +2471,19 @@ public class FormsServiceImpl implements FormsService { | ||
| 2333 | y.setYh(arg0.getDouble("yh")); | 2471 | y.setYh(arg0.getDouble("yh")); |
| 2334 | return y; | 2472 | return y; |
| 2335 | } | 2473 | } |
| 2336 | - }); | 2474 | + }); |
| 2337 | 2475 | ||
| 2338 | - String dlbSql=" select * from bsth_c_dlb where rq BETWEEN '"+startDate+"' and '"+endDate+"'"; | ||
| 2339 | - if(xlbm.equals("")){ | ||
| 2340 | - ylbSql +="and ssgsdm='"+gsdm+"' " | ||
| 2341 | - + " and fgsdm='"+fgsdm+"'"; | ||
| 2342 | - }else{ | 2476 | + String dlbSql=" select * from bsth_c_dlb where rq BETWEEN '"+startDate+"' and '"+endDate+"'"; |
| 2477 | + if(!xlbm.equals("")){ | ||
| 2343 | ylbSql += " and xlbm = '"+xlbm+"'"; | 2478 | ylbSql += " and xlbm = '"+xlbm+"'"; |
| 2344 | } | 2479 | } |
| 2345 | - List<Dlb> dlbList= jdbcTemplate.query(dlbSql, new RowMapper<Dlb>() { | 2480 | + if(!gsdm.equals("")){ |
| 2481 | + ylbSql += " and ssgsdm='"+gsdm+"'"; | ||
| 2482 | + } | ||
| 2483 | + if(!fgsdm.equals("")){ | ||
| 2484 | + ylbSql += " and fgsdm='"+fgsdm+"'"; | ||
| 2485 | + } | ||
| 2486 | + List<Dlb> dlbList= jdbcTemplate.query(dlbSql, new RowMapper<Dlb>() { | ||
| 2346 | @Override | 2487 | @Override |
| 2347 | public Dlb mapRow(ResultSet arg0, int arg1) throws SQLException { | 2488 | public Dlb mapRow(ResultSet arg0, int arg1) throws SQLException { |
| 2348 | Dlb d = new Dlb(); | 2489 | Dlb d = new Dlb(); |
| @@ -2544,8 +2685,13 @@ public class FormsServiceImpl implements FormsService { | @@ -2544,8 +2685,13 @@ public class FormsServiceImpl implements FormsService { | ||
| 2544 | } | 2685 | } |
| 2545 | String rq2 = sdf1.format(d); | 2686 | String rq2 = sdf1.format(d); |
| 2546 | String rq3 = sdf1.format(d1); | 2687 | String rq3 = sdf1.format(d1); |
| 2547 | - String company = map.get("gsdmTurn").toString(); | ||
| 2548 | - String subCompany = map.get("fgsdmTurn").toString(); | 2688 | + String company = "", subCompany = ""; |
| 2689 | + if(map.get("gsdmTurn") != null){ | ||
| 2690 | + company = map.get("gsdmTurn").toString(); | ||
| 2691 | + } | ||
| 2692 | + if(map.get("fgsdmTurn") != null){ | ||
| 2693 | + subCompany = map.get("fgsdmTurn").toString(); | ||
| 2694 | + } | ||
| 2549 | String line = map.get("line").toString(); | 2695 | String line = map.get("line").toString(); |
| 2550 | String startDate = map.get("startDate").toString(); | 2696 | String startDate = map.get("startDate").toString(); |
| 2551 | String endDate = map.get("endDate").toString(); | 2697 | String endDate = map.get("endDate").toString(); |
| @@ -2559,12 +2705,17 @@ public class FormsServiceImpl implements FormsService { | @@ -2559,12 +2705,17 @@ public class FormsServiceImpl implements FormsService { | ||
| 2559 | List<Line> lineList = lineRepository.findLineBygsBm(company, subCompany, line.length()==0?"%"+line+"%":line); | 2705 | List<Line> lineList = lineRepository.findLineBygsBm(company, subCompany, line.length()==0?"%"+line+"%":line); |
| 2560 | 2706 | ||
| 2561 | String sql = "select gs_name, fgs_name, cl_zbh, fcsj, bc_type, xl_bm, xl_name, schedule_date" | 2707 | String sql = "select gs_name, fgs_name, cl_zbh, fcsj, bc_type, xl_bm, xl_name, schedule_date" |
| 2562 | - + " from bsth_c_s_sp_info where gs_bm = '"+company+"' and fgs_bm = '"+subCompany+"' " | ||
| 2563 | - + "and schedule_date >= '"+startDate+"' " | ||
| 2564 | - + "and schedule_date <= '"+endDate+"' "; | 2708 | + + " from bsth_c_s_sp_info where " |
| 2709 | + + "schedule_date >= '"+startDate+"' and schedule_date <= '"+endDate+"' "; | ||
| 2565 | if(line.trim().length() != 0){ | 2710 | if(line.trim().length() != 0){ |
| 2566 | sql += "and xl_bm = '"+line+"' "; | 2711 | sql += "and xl_bm = '"+line+"' "; |
| 2567 | } | 2712 | } |
| 2713 | + if(company.trim().length() != 0){ | ||
| 2714 | + sql += "and gs_bm = '"+company+"' "; | ||
| 2715 | + } | ||
| 2716 | + if(subCompany.trim().length() != 0){ | ||
| 2717 | + sql += "and fgs_bm = '"+subCompany+"' "; | ||
| 2718 | + } | ||
| 2568 | List<SchedulePlanInfo> planList = jdbcTemplate.query(sql, new RowMapper<SchedulePlanInfo>() { | 2719 | List<SchedulePlanInfo> planList = jdbcTemplate.query(sql, new RowMapper<SchedulePlanInfo>() { |
| 2569 | 2720 | ||
| 2570 | @Override | 2721 | @Override |
| @@ -2711,18 +2862,34 @@ public class FormsServiceImpl implements FormsService { | @@ -2711,18 +2862,34 @@ public class FormsServiceImpl implements FormsService { | ||
| 2711 | 2862 | ||
| 2712 | e.printStackTrace(); | 2863 | e.printStackTrace(); |
| 2713 | } | 2864 | } |
| 2865 | + | ||
| 2866 | + String gsbm = "", fgsbm = ""; | ||
| 2867 | + if(map.get("gsdmEcecut")!=null){ | ||
| 2868 | + gsbm = map.get("gsdmEcecut").toString(); | ||
| 2869 | + } | ||
| 2870 | + if(map.get("fgsdmEcecut")!=null){ | ||
| 2871 | + fgsbm = map.get("fgsdmEcecut").toString(); | ||
| 2872 | + } | ||
| 2873 | + | ||
| 2714 | String rq2 = sdf1.format(d); | 2874 | String rq2 = sdf1.format(d); |
| 2715 | String rq3 = sdf1.format(d1); | 2875 | String rq3 = sdf1.format(d1); |
| 2716 | 2876 | ||
| 2717 | rq = rq2 + "-" + rq3; | 2877 | rq = rq2 + "-" + rq3; |
| 2718 | 2878 | ||
| 2879 | + String where = ""; | ||
| 2880 | + if(gsbm.trim().length() != 0){ | ||
| 2881 | + where += " and gs_bm = '" + gsbm + "'"; | ||
| 2882 | + } | ||
| 2883 | + if(fgsbm.trim().length() != 0){ | ||
| 2884 | + where += " and fgs_bm = '" + fgsbm + "'"; | ||
| 2885 | + } | ||
| 2886 | + | ||
| 2719 | String sql = " select b.xlgs, a.gs_bm,a.gs_name, a.fgs_bm,a.fgs_name , a.xl_bm,b.xl_name,b.sbc,b.sxl,b.scl,a.jbc ,a.jxl ,a.jcl,a.gslsbm,a.fgsbm,a.bc_type from " | 2887 | String sql = " select b.xlgs, a.gs_bm,a.gs_name, a.fgs_bm,a.fgs_name , a.xl_bm,b.xl_name,b.sbc,b.sxl,b.scl,a.jbc ,a.jxl ,a.jcl,a.gslsbm,a.fgsbm,a.bc_type from " |
| 2720 | + " (select count(DISTINCT gs_bm) gslsbm, gs_bm, count(DISTINCT fgs_bm) fgsbm,fgs_bm,gs_name,fgs_name ,xl_bm, count(*) as jbc,COUNT(DISTINCT xl_bm) as jxl ,COUNT(DISTINCT cl_zbh) as jcl,bc_type" | 2888 | + " (select count(DISTINCT gs_bm) gslsbm, gs_bm, count(DISTINCT fgs_bm) fgsbm,fgs_bm,gs_name,fgs_name ,xl_bm, count(*) as jbc,COUNT(DISTINCT xl_bm) as jxl ,COUNT(DISTINCT cl_zbh) as jcl,bc_type" |
| 2721 | + " from bsth_c_s_sp_info" + " where schedule_date >= '" | 2889 | + " from bsth_c_s_sp_info" + " where schedule_date >= '" |
| 2722 | + map.get("startDate").toString() + "' and schedule_date <= '" + map.get("endDate").toString() + "' and xl_bm='" | 2890 | + map.get("startDate").toString() + "' and schedule_date <= '" + map.get("endDate").toString() + "' and xl_bm='" |
| 2723 | + map.get("line").toString() + "' AND gs_bm is not null AND bc_type NOT IN ('in', 'out')" | 2891 | + map.get("line").toString() + "' AND gs_bm is not null AND bc_type NOT IN ('in', 'out')" |
| 2724 | - + " and gs_bm='"+ map.get("gsdmEcecut").toString() + "'" | ||
| 2725 | - + " and fgs_bm='"+ map.get("fgsdmEcecut").toString() + "'" | 2892 | + + where |
| 2726 | // + " GROUP BY gs_bm,fgs_bm,xl_bm,gs_name,fgs_name,bc_type " | 2893 | // + " GROUP BY gs_bm,fgs_bm,xl_bm,gs_name,fgs_name,bc_type " |
| 2727 | + " ) a left JOIN (" | 2894 | + " ) a left JOIN (" |
| 2728 | + "SELECT COUNT(*) as xlgs,b.gs_bm,b.fgs_bm,b.xl_bm,b.xl_name,b.gs_name,b.fgs_name, b.sbc,b.sxl ,b.scl " | 2895 | + "SELECT COUNT(*) as xlgs,b.gs_bm,b.fgs_bm,b.xl_bm,b.xl_name,b.gs_name,b.fgs_name, b.sbc,b.sxl ,b.scl " |
| @@ -2899,14 +3066,17 @@ public class FormsServiceImpl implements FormsService { | @@ -2899,14 +3066,17 @@ public class FormsServiceImpl implements FormsService { | ||
| 2899 | + " r.xl_bm,r.cl_zbh,r.j_gh,r.j_name,r.gs_bm,r.fgs_bm" | 3066 | + " r.xl_bm,r.cl_zbh,r.j_gh,r.j_name,r.gs_bm,r.fgs_bm" |
| 2900 | + " from bsth_c_s_sp_info_real r where " | 3067 | + " from bsth_c_s_sp_info_real r where " |
| 2901 | + "r.schedule_date_str = '"+map.get("date").toString()+"'"; | 3068 | + "r.schedule_date_str = '"+map.get("date").toString()+"'"; |
| 2902 | - if(xlbm.equals("")){ | ||
| 2903 | - sql +="and r.gs_bm='"+gsbm+"' " | ||
| 2904 | - + " and r.fgs_bm='"+fgsbm+"'"; | ||
| 2905 | - }else{ | 3069 | + if(!xlbm.equals("")){ |
| 2906 | sql += " and r.xl_bm = '"+xlbm+"'"; | 3070 | sql += " and r.xl_bm = '"+xlbm+"'"; |
| 2907 | } | 3071 | } |
| 2908 | - sql += " group by r.schedule_date_str," | ||
| 2909 | - + " r.xl_bm,r.cl_zbh,r.j_gh,r.j_name,r.gs_bm,r.fgs_bm order by r.xl_bm,r.cl_zbh"; | 3072 | + if(!gsbm.equals("")){ |
| 3073 | + sql += " and r.gs_bm='"+gsbm+"'"; | ||
| 3074 | + } | ||
| 3075 | + if(!fgsbm.equals("")){ | ||
| 3076 | + sql += " and r.fgs_bm='"+fgsbm+"'"; | ||
| 3077 | + } | ||
| 3078 | + sql += " group by r.schedule_date_str," | ||
| 3079 | + + " r.xl_bm,r.cl_zbh,r.j_gh,r.j_name,r.gs_bm,r.fgs_bm order by r.xl_bm,r.cl_zbh"; | ||
| 2910 | 3080 | ||
| 2911 | List<Daily> list = jdbcTemplate.query(sql, new RowMapper<Daily>() { | 3081 | List<Daily> list = jdbcTemplate.query(sql, new RowMapper<Daily>() { |
| 2912 | @Override | 3082 | @Override |
| @@ -2972,10 +3142,10 @@ public class FormsServiceImpl implements FormsService { | @@ -2972,10 +3142,10 @@ public class FormsServiceImpl implements FormsService { | ||
| 2972 | } | 3142 | } |
| 2973 | 3143 | ||
| 2974 | class SingledataByXlbm implements Comparator<Singledata>{ | 3144 | class SingledataByXlbm implements Comparator<Singledata>{ |
| 2975 | - @Override | ||
| 2976 | - public int compare(Singledata o1, Singledata o2) { | ||
| 2977 | - // TODO Auto-generated method stub | ||
| 2978 | - return (o2.getxL()+o2.getClzbh()).compareTo((o1.getxL()+o1.getClzbh())); | ||
| 2979 | - } | 3145 | + @Override |
| 3146 | + public int compare(Singledata o1, Singledata o2) { | ||
| 3147 | + // TODO Auto-generated method stub | ||
| 3148 | + return (o1.getgS()+o1.getxL()+o1.getClzbh()).compareTo((o2.getgS()+o2.getxL()+o2.getClzbh())); | ||
| 3149 | + } | ||
| 2980 | } | 3150 | } |
| 2981 | } | 3151 | } |
src/main/java/com/bsth/service/gps/GpsServiceImpl.java
| @@ -359,6 +359,10 @@ public class GpsServiceImpl implements GpsService { | @@ -359,6 +359,10 @@ public class GpsServiceImpl implements GpsService { | ||
| 359 | return (byte)(((serviceState & 0x80000000) == 0x80000000) ? 1 : 0); | 359 | return (byte)(((serviceState & 0x80000000) == 0x80000000) ? 1 : 0); |
| 360 | } | 360 | } |
| 361 | 361 | ||
| 362 | + public static void main(String[] args){ | ||
| 363 | + System.out.println(getGpsValid(-2147483648)); | ||
| 364 | + } | ||
| 365 | + | ||
| 362 | public Map<String, ArrivalEntity> findArrivalByTs(Long st, Long et, List<DeviceChange> dcs) { | 366 | public Map<String, ArrivalEntity> findArrivalByTs(Long st, Long et, List<DeviceChange> dcs) { |
| 363 | Map<String, ArrivalEntity> map = new HashMap<>(); | 367 | Map<String, ArrivalEntity> map = new HashMap<>(); |
| 364 | 368 |
src/main/java/com/bsth/service/impl/BusIntervalServiceImpl.java
| @@ -44,6 +44,7 @@ import com.bsth.repository.oil.DlbRepository; | @@ -44,6 +44,7 @@ import com.bsth.repository.oil.DlbRepository; | ||
| 44 | import com.bsth.repository.oil.YlbRepository; | 44 | import com.bsth.repository.oil.YlbRepository; |
| 45 | import com.bsth.repository.realcontrol.ScheduleRealInfoRepository; | 45 | import com.bsth.repository.realcontrol.ScheduleRealInfoRepository; |
| 46 | import com.bsth.service.BusIntervalService; | 46 | import com.bsth.service.BusIntervalService; |
| 47 | +import com.bsth.service.LineService; | ||
| 47 | import com.bsth.service.report.CulateMileageService; | 48 | import com.bsth.service.report.CulateMileageService; |
| 48 | import com.bsth.service.schedule.PeopleCarPlanService; | 49 | import com.bsth.service.schedule.PeopleCarPlanService; |
| 49 | import com.bsth.service.sys.DutyEmployeeService; | 50 | import com.bsth.service.sys.DutyEmployeeService; |
| @@ -60,8 +61,11 @@ import com.google.gson.Gson; | @@ -60,8 +61,11 @@ import com.google.gson.Gson; | ||
| 60 | public class BusIntervalServiceImpl implements BusIntervalService { | 61 | public class BusIntervalServiceImpl implements BusIntervalService { |
| 61 | 62 | ||
| 62 | @Autowired | 63 | @Autowired |
| 63 | - CulateMileageService culateService; | 64 | + LineService lineService; |
| 64 | 65 | ||
| 66 | + @Autowired | ||
| 67 | + CulateMileageService culateService; | ||
| 68 | + | ||
| 65 | @Autowired | 69 | @Autowired |
| 66 | private PeopleCarPlanService peopleCarPlanService; | 70 | private PeopleCarPlanService peopleCarPlanService; |
| 67 | 71 | ||
| @@ -113,7 +117,10 @@ public class BusIntervalServiceImpl implements BusIntervalService { | @@ -113,7 +117,10 @@ public class BusIntervalServiceImpl implements BusIntervalService { | ||
| 113 | } | 117 | } |
| 114 | } | 118 | } |
| 115 | if(company.length() != 0){ | 119 | if(company.length() != 0){ |
| 116 | - sql += " and gs_bm = '"+company+"' and fgs_bm = '"+subCompany+"'"; | 120 | + sql += " and gs_bm = '"+company+"'"; |
| 121 | + } | ||
| 122 | + if(subCompany.length() != 0){ | ||
| 123 | + sql += " and fgs_bm = '"+subCompany+"'"; | ||
| 117 | } | 124 | } |
| 118 | if(normal){ | 125 | if(normal){ |
| 119 | sql += " and bc_type != 'in' and bc_type != 'out' and bc_type != 'ldks'"; | 126 | sql += " and bc_type != 'in' and bc_type != 'out' and bc_type != 'ldks'"; |
| @@ -147,6 +154,7 @@ public class BusIntervalServiceImpl implements BusIntervalService { | @@ -147,6 +154,7 @@ public class BusIntervalServiceImpl implements BusIntervalService { | ||
| 147 | schedule.setAdjustExps(rs.getString("adjust_exps")); | 154 | schedule.setAdjustExps(rs.getString("adjust_exps")); |
| 148 | schedule.setJhlcOrig(rs.getDouble("jhlc_orig")); | 155 | schedule.setJhlcOrig(rs.getDouble("jhlc_orig")); |
| 149 | schedule.setRemarks(rs.getString("remarks")); | 156 | schedule.setRemarks(rs.getString("remarks")); |
| 157 | + schedule.setFgsBm(rs.getString("fgs_bm")); | ||
| 150 | schedule.setGsName(rs.getString("gs_name")); | 158 | schedule.setGsName(rs.getString("gs_name")); |
| 151 | schedule.setFgsName(rs.getString("fgs_name")); | 159 | schedule.setFgsName(rs.getString("fgs_name")); |
| 152 | schedule.setDfAuto(rs.getBoolean("df_auto")); | 160 | schedule.setDfAuto(rs.getBoolean("df_auto")); |
| @@ -419,8 +427,11 @@ public class BusIntervalServiceImpl implements BusIntervalService { | @@ -419,8 +427,11 @@ public class BusIntervalServiceImpl implements BusIntervalService { | ||
| 419 | List<Map<String, Object>> tempList = new ArrayList<Map<String, Object>>(); | 427 | List<Map<String, Object>> tempList = new ArrayList<Map<String, Object>>(); |
| 420 | Map<String, List<ScheduleRealInfo>> keyMap = new HashMap<String, List<ScheduleRealInfo>>(); | 428 | Map<String, List<ScheduleRealInfo>> keyMap = new HashMap<String, List<ScheduleRealInfo>>(); |
| 421 | 429 | ||
| 422 | - String company = map.get("company").toString(); | ||
| 423 | - String subCompany = map.get("subCompany").toString(); | 430 | + String company = "", subCompany = ""; |
| 431 | + if(map.get("company")!=null) | ||
| 432 | + company = map.get("company").toString(); | ||
| 433 | + if(map.get("subCompany")!=null) | ||
| 434 | + subCompany = map.get("subCompany").toString(); | ||
| 424 | String line = map.get("line").toString(); | 435 | String line = map.get("line").toString(); |
| 425 | String startDate = map.get("startDate").toString(); | 436 | String startDate = map.get("startDate").toString(); |
| 426 | String endDate = map.get("endDate").toString(); | 437 | String endDate = map.get("endDate").toString(); |
| @@ -429,6 +440,7 @@ public class BusIntervalServiceImpl implements BusIntervalService { | @@ -429,6 +440,7 @@ public class BusIntervalServiceImpl implements BusIntervalService { | ||
| 429 | String times1 = map.get("times1").toString(); | 440 | String times1 = map.get("times1").toString(); |
| 430 | String times2 = map.get("times2").toString(); | 441 | String times2 = map.get("times2").toString(); |
| 431 | String type = map.get("type").toString(); | 442 | String type = map.get("type").toString(); |
| 443 | + String sfyy = map.get("sfyy").toString(); | ||
| 432 | int sfqr = Integer.valueOf(map.get("sfqr").toString()); | 444 | int sfqr = Integer.valueOf(map.get("sfqr").toString()); |
| 433 | 445 | ||
| 434 | if(startDate.length() == 0){ | 446 | if(startDate.length() == 0){ |
| @@ -467,6 +479,8 @@ public class BusIntervalServiceImpl implements BusIntervalService { | @@ -467,6 +479,8 @@ public class BusIntervalServiceImpl implements BusIntervalService { | ||
| 467 | // int startTime = Integer.valueOf(split[0].split(":")[0])*60 + Integer.valueOf(split[0].split(":")[1]); | 479 | // int startTime = Integer.valueOf(split[0].split(":")[0])*60 + Integer.valueOf(split[0].split(":")[1]); |
| 468 | // int endTime = Integer.valueOf(split[1].split(":")[0])*60 + Integer.valueOf(split[1].split(":")[1]); | 480 | // int endTime = Integer.valueOf(split[1].split(":")[0])*60 + Integer.valueOf(split[1].split(":")[1]); |
| 469 | 481 | ||
| 482 | + Map<String, Boolean> lineNature = lineService.lineNature(); | ||
| 483 | + | ||
| 470 | for(ScheduleRealInfo schedule : list){ | 484 | for(ScheduleRealInfo schedule : list){ |
| 471 | if(schedule.isCcService()) | 485 | if(schedule.isCcService()) |
| 472 | continue; | 486 | continue; |
| @@ -479,7 +493,19 @@ public class BusIntervalServiceImpl implements BusIntervalService { | @@ -479,7 +493,19 @@ public class BusIntervalServiceImpl implements BusIntervalService { | ||
| 479 | } | 493 | } |
| 480 | if(schedule.getXlName() == null || schedule.getXlName().trim().length() == 0) | 494 | if(schedule.getXlName() == null || schedule.getXlName().trim().length() == 0) |
| 481 | continue; | 495 | continue; |
| 482 | - String key = schedule.getXlBm() + "/" + schedule.getXlName() + "/" + schedule.getQdzName(); | 496 | + |
| 497 | + if(lineNature.containsKey(schedule.getXlBm()) && lineNature.get(schedule.getXlBm()) != null){ | ||
| 498 | + if(sfyy.equals("1") && !lineNature.get(schedule.getXlBm())){ | ||
| 499 | + continue; | ||
| 500 | + } else if(sfyy.equals("2") && lineNature.get(schedule.getXlBm())){ | ||
| 501 | + continue; | ||
| 502 | + } | ||
| 503 | + } else if(sfyy.equals("2")){ | ||
| 504 | + continue; | ||
| 505 | + } | ||
| 506 | + | ||
| 507 | + String key = schedule.getXlBm() + "/" + schedule.getXlName() + "/" + schedule.getQdzName() | ||
| 508 | + + "/" + schedule.getFgsName() + "/" + schedule.getFgsBm(); | ||
| 483 | if(!keyMap.containsKey(key)) | 509 | if(!keyMap.containsKey(key)) |
| 484 | keyMap.put(key, new ArrayList<ScheduleRealInfo>()); | 510 | keyMap.put(key, new ArrayList<ScheduleRealInfo>()); |
| 485 | keyMap.get(key).add(schedule); | 511 | keyMap.get(key).add(schedule); |
| @@ -592,7 +618,8 @@ public class BusIntervalServiceImpl implements BusIntervalService { | @@ -592,7 +618,8 @@ public class BusIntervalServiceImpl implements BusIntervalService { | ||
| 592 | tempMap.put("line", split[1]); | 618 | tempMap.put("line", split[1]); |
| 593 | tempMap.put("qdz", split[2]); | 619 | tempMap.put("qdz", split[2]); |
| 594 | tempMap.put("company", companyName); | 620 | tempMap.put("company", companyName); |
| 595 | - tempMap.put("subCompany", subCompanyName); | 621 | + tempMap.put("subCompany", split[3]); |
| 622 | + tempMap.put("fgsbm", split[4]); | ||
| 596 | long jhInterval = 0l; | 623 | long jhInterval = 0l; |
| 597 | long sjInterval = 0l; | 624 | long sjInterval = 0l; |
| 598 | for(Long i : fcsjs) | 625 | for(Long i : fcsjs) |
| @@ -622,7 +649,8 @@ public class BusIntervalServiceImpl implements BusIntervalService { | @@ -622,7 +649,8 @@ public class BusIntervalServiceImpl implements BusIntervalService { | ||
| 622 | Map<Long, List<Map<String, Object>>> sortMap = new HashMap<Long, List<Map<String, Object>>>(); | 649 | Map<Long, List<Map<String, Object>>> sortMap = new HashMap<Long, List<Map<String, Object>>>(); |
| 623 | for(Map<String, Object> m : tempList){ | 650 | for(Map<String, Object> m : tempList){ |
| 624 | String times = m.get("times").toString(); | 651 | String times = m.get("times").toString(); |
| 625 | - Long sort = Long.valueOf(times.substring(0, 2)); | 652 | + Long sort = Long.valueOf(times.substring(0, 2)) * 1000l |
| 653 | + + Long.valueOf(m.get("fgsbm").toString()); | ||
| 626 | if(!sortMap.containsKey(sort)){ | 654 | if(!sortMap.containsKey(sort)){ |
| 627 | sortMap.put(sort, new ArrayList<Map<String, Object>>()); | 655 | sortMap.put(sort, new ArrayList<Map<String, Object>>()); |
| 628 | sortList.add(sort); | 656 | sortList.add(sort); |
| @@ -649,7 +677,7 @@ public class BusIntervalServiceImpl implements BusIntervalService { | @@ -649,7 +677,7 @@ public class BusIntervalServiceImpl implements BusIntervalService { | ||
| 649 | }else if(statu.equals("0")){ | 677 | }else if(statu.equals("0")){ |
| 650 | List<Long> longList = new ArrayList<Long>(); | 678 | List<Long> longList = new ArrayList<Long>(); |
| 651 | for(String key : keyList){ | 679 | for(String key : keyList){ |
| 652 | - long xlBm = Long.valueOf(key.split("/")[0]); | 680 | + long xlBm = Long.valueOf(key.split("/")[4]) * 1000000l + Long.valueOf(key.split("/")[0]); |
| 653 | if(!longList.contains(xlBm)) | 681 | if(!longList.contains(xlBm)) |
| 654 | longList.add(xlBm); | 682 | longList.add(xlBm); |
| 655 | Collections.sort(longList); | 683 | Collections.sort(longList); |
| @@ -657,7 +685,8 @@ public class BusIntervalServiceImpl implements BusIntervalService { | @@ -657,7 +685,8 @@ public class BusIntervalServiceImpl implements BusIntervalService { | ||
| 657 | for(long xlBm : longList){ | 685 | for(long xlBm : longList){ |
| 658 | for(String key : keyList){ | 686 | for(String key : keyList){ |
| 659 | String[] split = key.split("/"); | 687 | String[] split = key.split("/"); |
| 660 | - if((long)Long.valueOf(split[0]) == xlBm){ | 688 | + long kl = Long.valueOf(split[4]) * 1000000l + Long.valueOf(split[0]); |
| 689 | + if(kl == xlBm){ | ||
| 661 | Map<String, Object> tempMap = new HashMap<String, Object>(); | 690 | Map<String, Object> tempMap = new HashMap<String, Object>(); |
| 662 | List<Long> fcsjs = new ArrayList<Long>(); | 691 | List<Long> fcsjs = new ArrayList<Long>(); |
| 663 | List<Long> fcsjAs = new ArrayList<Long>(); | 692 | List<Long> fcsjAs = new ArrayList<Long>(); |
| @@ -683,7 +712,8 @@ public class BusIntervalServiceImpl implements BusIntervalService { | @@ -683,7 +712,8 @@ public class BusIntervalServiceImpl implements BusIntervalService { | ||
| 683 | tempMap.put("line", split[1]); | 712 | tempMap.put("line", split[1]); |
| 684 | tempMap.put("qdz", split[2]); | 713 | tempMap.put("qdz", split[2]); |
| 685 | tempMap.put("company", companyName); | 714 | tempMap.put("company", companyName); |
| 686 | - tempMap.put("subCompany", subCompanyName); | 715 | + tempMap.put("subCompany", split[3]); |
| 716 | + tempMap.put("fgsbm", split[4]); | ||
| 687 | tempMap.put("jhInterval", fcsjs.size()>0?df.format((double)fcsj/fcsjs.size()):"/"); | 717 | tempMap.put("jhInterval", fcsjs.size()>0?df.format((double)fcsj/fcsjs.size()):"/"); |
| 688 | tempMap.put("sjInterval", fcsjAs.size()>0?df.format((double)fcsjA/fcsjAs.size()):"/"); | 718 | tempMap.put("sjInterval", fcsjAs.size()>0?df.format((double)fcsjA/fcsjAs.size()):"/"); |
| 689 | tempMap.put("MaxInterval", fcsjAs.size()>0?fcsjAs.get(fcsjAs.size() - 1):"/"); | 719 | tempMap.put("MaxInterval", fcsjAs.size()>0?fcsjAs.get(fcsjAs.size() - 1):"/"); |
| @@ -745,9 +775,13 @@ public class BusIntervalServiceImpl implements BusIntervalService { | @@ -745,9 +775,13 @@ public class BusIntervalServiceImpl implements BusIntervalService { | ||
| 745 | Set<Long> tsSet = new HashSet<Long>(); | 775 | Set<Long> tsSet = new HashSet<Long>(); |
| 746 | Set<Long> ttSet = new HashSet<Long>(); | 776 | Set<Long> ttSet = new HashSet<Long>(); |
| 747 | 777 | ||
| 748 | - String company = map.get("company").toString(); | ||
| 749 | - String subCompany = map.get("subCompany").toString(); | 778 | + String company = "", subCompany = ""; |
| 779 | + if(map.get("company")!=null) | ||
| 780 | + company = map.get("company").toString(); | ||
| 781 | + if(map.get("subCompany")!=null) | ||
| 782 | + subCompany = map.get("subCompany").toString(); | ||
| 750 | String lp = map.get("lp").toString(); | 783 | String lp = map.get("lp").toString(); |
| 784 | + String sfyy = map.get("sfyy").toString(); | ||
| 751 | String line = map.get("line").toString(); | 785 | String line = map.get("line").toString(); |
| 752 | String statu = map.get("statu").toString(); | 786 | String statu = map.get("statu").toString(); |
| 753 | String startDate = map.get("startDate").toString(); | 787 | String startDate = map.get("startDate").toString(); |
| @@ -775,7 +809,10 @@ public class BusIntervalServiceImpl implements BusIntervalService { | @@ -775,7 +809,10 @@ public class BusIntervalServiceImpl implements BusIntervalService { | ||
| 775 | where += " and lp_name = '"+lp+"'"; | 809 | where += " and lp_name = '"+lp+"'"; |
| 776 | } | 810 | } |
| 777 | if(company.length() != 0){ | 811 | if(company.length() != 0){ |
| 778 | - where += " and gs_bm = '"+company+"' and fgs_bm = '"+subCompany+"'"; | 812 | + where += " and gs_bm = '"+company+"'"; |
| 813 | + } | ||
| 814 | + if(subCompany.length() != 0){ | ||
| 815 | + where += " and fgs_bm = '"+subCompany+"'"; | ||
| 779 | } | 816 | } |
| 780 | if(sfqr == 1){ | 817 | if(sfqr == 1){ |
| 781 | where += " and zdsj >= '"+times1+"' and fcsj <= '"+times2+"'"; | 818 | where += " and zdsj >= '"+times1+"' and fcsj <= '"+times2+"'"; |
| @@ -783,7 +820,7 @@ public class BusIntervalServiceImpl implements BusIntervalService { | @@ -783,7 +820,7 @@ public class BusIntervalServiceImpl implements BusIntervalService { | ||
| 783 | // where += " and bc_type != 'in' and bc_type != 'out' and bc_type != 'ldks'"; | 820 | // where += " and bc_type != 'in' and bc_type != 'out' and bc_type != 'ldks'"; |
| 784 | where += " and bc_type != 'ldks'"; | 821 | where += " and bc_type != 'ldks'"; |
| 785 | 822 | ||
| 786 | - String sql = "select id, schedule_date_str, real_exec_date, xl_name, lp_name, bcs, bcsj, jhlc, bc_type," | 823 | + String sql = "select id, schedule_date_str, real_exec_date, xl_name, lp_name, bcs, bcsj, jhlc, bc_type, xl_bm, fgs_bm," |
| 787 | + " fcsj, fcsj_actual, zdsj, zdsj_actual, qdz_name, zdz_name, xl_dir, status, remarks, gs_name, fgs_name, sp_id" | 824 | + " fcsj, fcsj_actual, zdsj, zdsj_actual, qdz_name, zdz_name, xl_dir, status, remarks, gs_name, fgs_name, sp_id" |
| 788 | + " ,cc_service from bsth_c_s_sp_info_real where schedule_date_str >= '"+startDate+"'" | 825 | + " ,cc_service from bsth_c_s_sp_info_real where schedule_date_str >= '"+startDate+"'" |
| 789 | + " and schedule_date_str <= '"+endDate+"'"+where+""; | 826 | + " and schedule_date_str <= '"+endDate+"'"+where+""; |
| @@ -796,6 +833,7 @@ public class BusIntervalServiceImpl implements BusIntervalService { | @@ -796,6 +833,7 @@ public class BusIntervalServiceImpl implements BusIntervalService { | ||
| 796 | schedule.setId(rs.getLong("id")); | 833 | schedule.setId(rs.getLong("id")); |
| 797 | schedule.setScheduleDateStr(rs.getString("schedule_date_str")); | 834 | schedule.setScheduleDateStr(rs.getString("schedule_date_str")); |
| 798 | schedule.setRealExecDate(rs.getString("real_exec_date")); | 835 | schedule.setRealExecDate(rs.getString("real_exec_date")); |
| 836 | + schedule.setXlBm(rs.getString("xl_bm")); | ||
| 799 | schedule.setXlName(rs.getString("xl_name")); | 837 | schedule.setXlName(rs.getString("xl_name")); |
| 800 | schedule.setLpName(rs.getString("lp_name")); | 838 | schedule.setLpName(rs.getString("lp_name")); |
| 801 | schedule.setBcs(rs.getInt("bcs")); | 839 | schedule.setBcs(rs.getInt("bcs")); |
| @@ -813,6 +851,7 @@ public class BusIntervalServiceImpl implements BusIntervalService { | @@ -813,6 +851,7 @@ public class BusIntervalServiceImpl implements BusIntervalService { | ||
| 813 | schedule.setRemarks(rs.getString("remarks")); | 851 | schedule.setRemarks(rs.getString("remarks")); |
| 814 | schedule.setGsName(rs.getString("gs_name")); | 852 | schedule.setGsName(rs.getString("gs_name")); |
| 815 | schedule.setFgsName(rs.getString("fgs_name")); | 853 | schedule.setFgsName(rs.getString("fgs_name")); |
| 854 | + schedule.setFgsBm(rs.getString("fgs_bm")); | ||
| 816 | schedule.setSpId(rs.getLong("sp_id")); | 855 | schedule.setSpId(rs.getLong("sp_id")); |
| 817 | schedule.setCcService(rs.getBoolean("cc_service")); | 856 | schedule.setCcService(rs.getBoolean("cc_service")); |
| 818 | 857 | ||
| @@ -877,7 +916,10 @@ public class BusIntervalServiceImpl implements BusIntervalService { | @@ -877,7 +916,10 @@ public class BusIntervalServiceImpl implements BusIntervalService { | ||
| 877 | sql += " and xl_bm = '"+line+"'"; | 916 | sql += " and xl_bm = '"+line+"'"; |
| 878 | } | 917 | } |
| 879 | if(company.length() != 0){ | 918 | if(company.length() != 0){ |
| 880 | - sql += " and gs_bm = '"+company+"' and fgs_bm = '"+subCompany+"'"; | 919 | + sql += " and gs_bm = '"+company+"'"; |
| 920 | + } | ||
| 921 | + if(subCompany.length() != 0){ | ||
| 922 | + sql += " and fgs_bm = '"+subCompany+"'"; | ||
| 881 | } | 923 | } |
| 882 | temp1 = jdbcTemplate.query(sql, | 924 | temp1 = jdbcTemplate.query(sql, |
| 883 | new RowMapper<Map<String, String>>(){ | 925 | new RowMapper<Map<String, String>>(){ |
| @@ -1002,13 +1044,26 @@ public class BusIntervalServiceImpl implements BusIntervalService { | @@ -1002,13 +1044,26 @@ public class BusIntervalServiceImpl implements BusIntervalService { | ||
| 1002 | cMap.get(key).add(cTask); | 1044 | cMap.get(key).add(cTask); |
| 1003 | } | 1045 | } |
| 1004 | 1046 | ||
| 1047 | + Map<String, Boolean> lineNature = lineService.lineNature(); | ||
| 1048 | + | ||
| 1005 | for(ScheduleRealInfo schedule : list){ | 1049 | for(ScheduleRealInfo schedule : list){ |
| 1006 | if(schedule.getXlName()==null || schedule.getXlName().trim().length()==0 | 1050 | if(schedule.getXlName()==null || schedule.getXlName().trim().length()==0 |
| 1007 | || schedule.isCcService()) | 1051 | || schedule.isCcService()) |
| 1008 | continue; | 1052 | continue; |
| 1053 | + String xlBm = schedule.getXlBm(); | ||
| 1054 | + if(lineNature.containsKey(xlBm) && lineNature.get(xlBm) != null){ | ||
| 1055 | + if(sfyy.equals("1") && !lineNature.get(xlBm)){ | ||
| 1056 | + continue; | ||
| 1057 | + } else if(sfyy.equals("2") && lineNature.get(xlBm)){ | ||
| 1058 | + continue; | ||
| 1059 | + } | ||
| 1060 | + } else if(sfyy.equals("2")){ | ||
| 1061 | + continue; | ||
| 1062 | + } | ||
| 1063 | + String key = schedule.getScheduleDateStr() + "/" + schedule.getXlName() + "/" | ||
| 1064 | + + schedule.getLpName() + "/" + schedule.getFgsName(); | ||
| 1009 | if(model.length() != 0){ | 1065 | if(model.length() != 0){ |
| 1010 | if(ttSet.contains(schedule.getSpId())){ | 1066 | if(ttSet.contains(schedule.getSpId())){ |
| 1011 | - String key = schedule.getScheduleDateStr() + "/" + schedule.getXlName() + "/" + schedule.getLpName(); | ||
| 1012 | if(!keyMap.containsKey(key)) | 1067 | if(!keyMap.containsKey(key)) |
| 1013 | keyMap.put(key, new ArrayList<ScheduleRealInfo>()); | 1068 | keyMap.put(key, new ArrayList<ScheduleRealInfo>()); |
| 1014 | keyMap.get(key).add(schedule); | 1069 | keyMap.get(key).add(schedule); |
| @@ -1023,7 +1078,6 @@ public class BusIntervalServiceImpl implements BusIntervalService { | @@ -1023,7 +1078,6 @@ public class BusIntervalServiceImpl implements BusIntervalService { | ||
| 1023 | // } | 1078 | // } |
| 1024 | // } | 1079 | // } |
| 1025 | }else{ | 1080 | }else{ |
| 1026 | - String key = schedule.getScheduleDateStr() + "/" + schedule.getXlName() + "/" + schedule.getLpName(); | ||
| 1027 | if(!keyMap.containsKey(key)) | 1081 | if(!keyMap.containsKey(key)) |
| 1028 | keyMap.put(key, new ArrayList<ScheduleRealInfo>()); | 1082 | keyMap.put(key, new ArrayList<ScheduleRealInfo>()); |
| 1029 | keyMap.get(key).add(schedule); | 1083 | keyMap.get(key).add(schedule); |
| @@ -1081,9 +1135,6 @@ public class BusIntervalServiceImpl implements BusIntervalService { | @@ -1081,9 +1135,6 @@ public class BusIntervalServiceImpl implements BusIntervalService { | ||
| 1081 | }else{ | 1135 | }else{ |
| 1082 | jhyysj += fcsj2 - fcsj1; | 1136 | jhyysj += fcsj2 - fcsj1; |
| 1083 | } | 1137 | } |
| 1084 | - if(jhyysj < 0){ | ||
| 1085 | - System.out.println(fcsj2 + " - " + fcsj1 + " = " + (fcsj2 - fcsj1)); | ||
| 1086 | - } | ||
| 1087 | jhyysj1 += fcsj2 - fcsj1; | 1138 | jhyysj1 += fcsj2 - fcsj1; |
| 1088 | } | 1139 | } |
| 1089 | if(i == 1 && schedule1.getBcType().toString().equals("normal")){ | 1140 | if(i == 1 && schedule1.getBcType().toString().equals("normal")){ |
| @@ -1220,9 +1271,9 @@ public class BusIntervalServiceImpl implements BusIntervalService { | @@ -1220,9 +1271,9 @@ public class BusIntervalServiceImpl implements BusIntervalService { | ||
| 1220 | sjlc += Double.valueOf(m.get("lc").toString()); | 1271 | sjlc += Double.valueOf(m.get("lc").toString()); |
| 1221 | } | 1272 | } |
| 1222 | } | 1273 | } |
| 1223 | - tempMap.put("company", companyName); | ||
| 1224 | - tempMap.put("subCompany", subCompanyName); | ||
| 1225 | String[] split = key.split("/"); | 1274 | String[] split = key.split("/"); |
| 1275 | + tempMap.put("company", companyName); | ||
| 1276 | + tempMap.put("subCompany", split[3]); | ||
| 1226 | tempMap.put("date", split[0]); | 1277 | tempMap.put("date", split[0]); |
| 1227 | tempMap.put("line", split[1]); | 1278 | tempMap.put("line", split[1]); |
| 1228 | tempMap.put("lp", split[2]); | 1279 | tempMap.put("lp", split[2]); |
| @@ -1272,7 +1323,8 @@ public class BusIntervalServiceImpl implements BusIntervalService { | @@ -1272,7 +1323,8 @@ public class BusIntervalServiceImpl implements BusIntervalService { | ||
| 1272 | } | 1323 | } |
| 1273 | Map<String, List<Map<String, Object>>> keyMap2 = new HashMap<String, List<Map<String, Object>>>(); | 1324 | Map<String, List<Map<String, Object>>> keyMap2 = new HashMap<String, List<Map<String, Object>>>(); |
| 1274 | for(Map<String, Object> m : resList){ | 1325 | for(Map<String, Object> m : resList){ |
| 1275 | - String key = m.get("line").toString() + "/" + m.get("lp").toString(); | 1326 | + String key = m.get("line").toString() + "/" + m.get("lp").toString() |
| 1327 | + + "/" + m.get("subCompany").toString(); | ||
| 1276 | if(!keyMap2.containsKey(key)) | 1328 | if(!keyMap2.containsKey(key)) |
| 1277 | keyMap2.put(key, new ArrayList<Map<String, Object>>()); | 1329 | keyMap2.put(key, new ArrayList<Map<String, Object>>()); |
| 1278 | keyMap2.get(key).add(m); | 1330 | keyMap2.get(key).add(m); |
| @@ -1333,6 +1385,32 @@ public class BusIntervalServiceImpl implements BusIntervalService { | @@ -1333,6 +1385,32 @@ public class BusIntervalServiceImpl implements BusIntervalService { | ||
| 1333 | return a.compareTo(b); | 1385 | return a.compareTo(b); |
| 1334 | } | 1386 | } |
| 1335 | }); | 1387 | }); |
| 1388 | + Collections.sort(list3, new Comparator<String>() { | ||
| 1389 | + | ||
| 1390 | + public int compare(String o1, String o2) { | ||
| 1391 | + | ||
| 1392 | + Long a = 0l; | ||
| 1393 | + Long b = 0l; | ||
| 1394 | + String[] split1 = o1.split("/"); | ||
| 1395 | + String[] split2 = o2.split("/"); | ||
| 1396 | + char[] charArray1 = split1[2].toCharArray(); | ||
| 1397 | + char[] charArray2 = split2[2].toCharArray(); | ||
| 1398 | + for(int i = 0; i < charArray1.length; i++){ | ||
| 1399 | + long temp = 1l; | ||
| 1400 | + for(int j = 0; j < i; j++) | ||
| 1401 | + temp *= 10; | ||
| 1402 | + a += (long)charArray1[charArray1.length - 1 - i] * temp; | ||
| 1403 | + } | ||
| 1404 | + for(int i = 0; i < charArray2.length; i++){ | ||
| 1405 | + long temp = 1l; | ||
| 1406 | + for(int j = 0; j < i; j++) | ||
| 1407 | + temp *= 10; | ||
| 1408 | + b += (long)charArray2[charArray2.length - 1 - i] * temp; | ||
| 1409 | + } | ||
| 1410 | + | ||
| 1411 | + return a.compareTo(b); | ||
| 1412 | + } | ||
| 1413 | + }); | ||
| 1336 | for(String key : list3){ | 1414 | for(String key : list3){ |
| 1337 | Map<String, Object> tempMap = new HashMap<String, Object>(); | 1415 | Map<String, Object> tempMap = new HashMap<String, Object>(); |
| 1338 | BigDecimal jhyysj = new BigDecimal(0), jhyssj = new BigDecimal(0); | 1416 | BigDecimal jhyysj = new BigDecimal(0), jhyssj = new BigDecimal(0); |
| @@ -1362,7 +1440,7 @@ public class BusIntervalServiceImpl implements BusIntervalService { | @@ -1362,7 +1440,7 @@ public class BusIntervalServiceImpl implements BusIntervalService { | ||
| 1362 | tempMap.put("line", split[0]); | 1440 | tempMap.put("line", split[0]); |
| 1363 | tempMap.put("lp", split[1]); | 1441 | tempMap.put("lp", split[1]); |
| 1364 | tempMap.put("company", companyName); | 1442 | tempMap.put("company", companyName); |
| 1365 | - tempMap.put("subCompany", subCompanyName); | 1443 | + tempMap.put("subCompany", split[2]); |
| 1366 | tempMap.put("date", date); | 1444 | tempMap.put("date", date); |
| 1367 | list4.add(tempMap); | 1445 | list4.add(tempMap); |
| 1368 | } | 1446 | } |
| @@ -1373,7 +1451,7 @@ public class BusIntervalServiceImpl implements BusIntervalService { | @@ -1373,7 +1451,7 @@ public class BusIntervalServiceImpl implements BusIntervalService { | ||
| 1373 | List<Map<String, Object>> list5 = new ArrayList<Map<String, Object>>(); | 1451 | List<Map<String, Object>> list5 = new ArrayList<Map<String, Object>>(); |
| 1374 | List<String> keyList = new ArrayList<String>(); | 1452 | List<String> keyList = new ArrayList<String>(); |
| 1375 | for(Map<String, Object> m : list4){ | 1453 | for(Map<String, Object> m : list4){ |
| 1376 | - String key = m.get("line").toString(); | 1454 | + String key = m.get("line").toString() + "/" + m.get("subCompany").toString(); |
| 1377 | if(!keyMap4.containsKey(key)){ | 1455 | if(!keyMap4.containsKey(key)){ |
| 1378 | keyList.add(key); | 1456 | keyList.add(key); |
| 1379 | keyMap4.put(key, new ArrayList<Map<String, Object>>()); | 1457 | keyMap4.put(key, new ArrayList<Map<String, Object>>()); |
| @@ -1405,10 +1483,11 @@ public class BusIntervalServiceImpl implements BusIntervalService { | @@ -1405,10 +1483,11 @@ public class BusIntervalServiceImpl implements BusIntervalService { | ||
| 1405 | tempMap.put("sjyssj", sjyssj.equals(0)?0:sjyssj.divide(size, 2, RoundingMode.HALF_UP)); | 1483 | tempMap.put("sjyssj", sjyssj.equals(0)?0:sjyssj.divide(size, 2, RoundingMode.HALF_UP)); |
| 1406 | tempMap.put("sjyycs", sjyycs.equals(0)?0:sjyycs.divide(size, 2, RoundingMode.HALF_UP)); | 1484 | tempMap.put("sjyycs", sjyycs.equals(0)?0:sjyycs.divide(size, 2, RoundingMode.HALF_UP)); |
| 1407 | tempMap.put("sjyscs", sjyscs.equals(0)?0:sjyscs.divide(size, 2, RoundingMode.HALF_UP)); | 1485 | tempMap.put("sjyscs", sjyscs.equals(0)?0:sjyscs.divide(size, 2, RoundingMode.HALF_UP)); |
| 1408 | - tempMap.put("line", key); | 1486 | + String[] split = key.split("/"); |
| 1487 | + tempMap.put("line", split[0]); | ||
| 1409 | tempMap.put("lp", keyMap4.get(key).size()); | 1488 | tempMap.put("lp", keyMap4.get(key).size()); |
| 1410 | tempMap.put("company", companyName); | 1489 | tempMap.put("company", companyName); |
| 1411 | - tempMap.put("subCompany", subCompanyName); | 1490 | + tempMap.put("subCompany", split[1]); |
| 1412 | tempMap.put("date", date); | 1491 | tempMap.put("date", date); |
| 1413 | tempMap.put("work", keyMap4.get(key)); | 1492 | tempMap.put("work", keyMap4.get(key)); |
| 1414 | list5.add(tempMap); | 1493 | list5.add(tempMap); |
| @@ -1491,8 +1570,13 @@ public class BusIntervalServiceImpl implements BusIntervalService { | @@ -1491,8 +1570,13 @@ public class BusIntervalServiceImpl implements BusIntervalService { | ||
| 1491 | Map<String, List<Map<String, Object>>> keyMap0 = new HashMap<String, List<Map<String, Object>>>(); | 1570 | Map<String, List<Map<String, Object>>> keyMap0 = new HashMap<String, List<Map<String, Object>>>(); |
| 1492 | Map<String, List<Map<String, Object>>> keyMap1 = new HashMap<String, List<Map<String, Object>>>(); | 1571 | Map<String, List<Map<String, Object>>> keyMap1 = new HashMap<String, List<Map<String, Object>>>(); |
| 1493 | 1572 | ||
| 1494 | - String company = map.get("company").toString(); | ||
| 1495 | - String subCompany = map.get("subCompany").toString(); | 1573 | + String sfqr = "", company = "", subCompany = ""; |
| 1574 | + if(map.get("sfqr")!=null) | ||
| 1575 | + sfqr = map.get("sfqr").toString(); | ||
| 1576 | + if(map.get("company")!=null) | ||
| 1577 | + company = map.get("company").toString(); | ||
| 1578 | + if(map.get("subCompany")!=null) | ||
| 1579 | + subCompany = map.get("subCompany").toString(); | ||
| 1496 | String line = map.get("line").toString(); | 1580 | String line = map.get("line").toString(); |
| 1497 | String startDate = map.get("startDate").toString(); | 1581 | String startDate = map.get("startDate").toString(); |
| 1498 | String endDate = map.get("endDate").toString(); | 1582 | String endDate = map.get("endDate").toString(); |
| @@ -1510,6 +1594,9 @@ public class BusIntervalServiceImpl implements BusIntervalService { | @@ -1510,6 +1594,9 @@ public class BusIntervalServiceImpl implements BusIntervalService { | ||
| 1510 | if(times.length() == 0){ | 1594 | if(times.length() == 0){ |
| 1511 | times = "05:00-23:00"; | 1595 | times = "05:00-23:00"; |
| 1512 | } | 1596 | } |
| 1597 | + if(sfqr.equals("0")){ | ||
| 1598 | + times = ""; | ||
| 1599 | + } | ||
| 1513 | 1600 | ||
| 1514 | list = getSchedule(company, subCompany, line, startDate, endDate, model, times, false); | 1601 | list = getSchedule(company, subCompany, line, startDate, endDate, model, times, false); |
| 1515 | 1602 | ||
| @@ -1522,9 +1609,9 @@ public class BusIntervalServiceImpl implements BusIntervalService { | @@ -1522,9 +1609,9 @@ public class BusIntervalServiceImpl implements BusIntervalService { | ||
| 1522 | date = startDate; | 1609 | date = startDate; |
| 1523 | } | 1610 | } |
| 1524 | 1611 | ||
| 1525 | - String[] split = times.split("-"); | ||
| 1526 | - int startTime = Integer.valueOf(split[0].split(":")[0])*60 + Integer.valueOf(split[0].split(":")[1]); | ||
| 1527 | - int endTime = Integer.valueOf(split[1].split(":")[0])*60 + Integer.valueOf(split[1].split(":")[1]); | 1612 | +// String[] split = times.split("-"); |
| 1613 | +// int startTime = Integer.valueOf(split[0].split(":")[0])*60 + Integer.valueOf(split[0].split(":")[1]); | ||
| 1614 | +// int endTime = Integer.valueOf(split[1].split(":")[0])*60 + Integer.valueOf(split[1].split(":")[1]); | ||
| 1528 | 1615 | ||
| 1529 | for(ScheduleRealInfo s : list){ | 1616 | for(ScheduleRealInfo s : list){ |
| 1530 | if(s.isCcService()){ | 1617 | if(s.isCcService()){ |
| @@ -1708,7 +1795,7 @@ public class BusIntervalServiceImpl implements BusIntervalService { | @@ -1708,7 +1795,7 @@ public class BusIntervalServiceImpl implements BusIntervalService { | ||
| 1708 | 1795 | ||
| 1709 | Map<String, Object> m = mapList.get(0); | 1796 | Map<String, Object> m = mapList.get(0); |
| 1710 | tempMap.put("dates", date); | 1797 | tempMap.put("dates", date); |
| 1711 | - tempMap.put("times", times); | 1798 | + tempMap.put("times", times.length()==0?"全日":times); |
| 1712 | tempMap.put("line", m.get("line")); | 1799 | tempMap.put("line", m.get("line")); |
| 1713 | tempMap.put("lp", m.get("lp")); | 1800 | tempMap.put("lp", m.get("lp")); |
| 1714 | tempMap.put("station", m.get("station")); | 1801 | tempMap.put("station", m.get("station")); |
| @@ -1730,10 +1817,14 @@ public class BusIntervalServiceImpl implements BusIntervalService { | @@ -1730,10 +1817,14 @@ public class BusIntervalServiceImpl implements BusIntervalService { | ||
| 1730 | List<Map<String, Object>> resList = new ArrayList<Map<String, Object>>(); | 1817 | List<Map<String, Object>> resList = new ArrayList<Map<String, Object>>(); |
| 1731 | List<ScheduleRealInfo> list = new ArrayList<ScheduleRealInfo>(); | 1818 | List<ScheduleRealInfo> list = new ArrayList<ScheduleRealInfo>(); |
| 1732 | Map<String, List<ScheduleRealInfo>> keyMap = new HashMap<String, List<ScheduleRealInfo>>(); | 1819 | Map<String, List<ScheduleRealInfo>> keyMap = new HashMap<String, List<ScheduleRealInfo>>(); |
| 1733 | - | ||
| 1734 | - String company = map.get("company").toString(); | ||
| 1735 | - String subCompany = map.get("subCompany").toString(); | 1820 | + |
| 1821 | + String company = "", subCompany = ""; | ||
| 1822 | + String sfyy = map.get("sfyy").toString(); | ||
| 1736 | String line = map.get("line").toString(); | 1823 | String line = map.get("line").toString(); |
| 1824 | + if(map.get("company")!=null) | ||
| 1825 | + company = map.get("company").toString(); | ||
| 1826 | + if(map.get("subCompany")!=null) | ||
| 1827 | + subCompany = map.get("subCompany").toString(); | ||
| 1737 | String startDate = map.get("startDate").toString(); | 1828 | String startDate = map.get("startDate").toString(); |
| 1738 | String endDate = map.get("endDate").toString(); | 1829 | String endDate = map.get("endDate").toString(); |
| 1739 | String model = map.get("model").toString(); | 1830 | String model = map.get("model").toString(); |
| @@ -1777,17 +1868,86 @@ public class BusIntervalServiceImpl implements BusIntervalService { | @@ -1777,17 +1868,86 @@ public class BusIntervalServiceImpl implements BusIntervalService { | ||
| 1777 | int startTime = Integer.valueOf(split[0].split(":")[0])*60 + Integer.valueOf(split[0].split(":")[1]); | 1868 | int startTime = Integer.valueOf(split[0].split(":")[0])*60 + Integer.valueOf(split[0].split(":")[1]); |
| 1778 | int endTime = Integer.valueOf(split[1].split(":")[0])*60 + Integer.valueOf(split[1].split(":")[1]); | 1869 | int endTime = Integer.valueOf(split[1].split(":")[0])*60 + Integer.valueOf(split[1].split(":")[1]); |
| 1779 | 1870 | ||
| 1871 | + Map<String, Boolean> lineNature = lineService.lineNature(); | ||
| 1872 | + | ||
| 1780 | for(ScheduleRealInfo schedule : list){ | 1873 | for(ScheduleRealInfo schedule : list){ |
| 1781 | Long fcsj = schedule.getFcsjT(); | 1874 | Long fcsj = schedule.getFcsjT(); |
| 1782 | if(sfqr == 1 && !(endTime!=0?fcsj>=startTime&&fcsj<endTime:fcsj>=startTime)){ | 1875 | if(sfqr == 1 && !(endTime!=0?fcsj>=startTime&&fcsj<endTime:fcsj>=startTime)){ |
| 1783 | continue; | 1876 | continue; |
| 1784 | } | 1877 | } |
| 1785 | - String key = schedule.getXlName(); | 1878 | + |
| 1879 | + String xlBm = schedule.getXlBm(); | ||
| 1880 | + if(lineNature.containsKey(xlBm) && lineNature.get(xlBm) != null){ | ||
| 1881 | + if(sfyy.equals("1") && !lineNature.get(xlBm)){ | ||
| 1882 | + continue; | ||
| 1883 | + } else if(sfyy.equals("2") && lineNature.get(xlBm)){ | ||
| 1884 | + continue; | ||
| 1885 | + } | ||
| 1886 | + } else if(sfyy.equals("2")){ | ||
| 1887 | + continue; | ||
| 1888 | + } | ||
| 1889 | + | ||
| 1890 | + String key = schedule.getXlName() + "/" + schedule.getFgsName(); | ||
| 1786 | if(!keyMap.containsKey(key)) | 1891 | if(!keyMap.containsKey(key)) |
| 1787 | keyMap.put(key, new ArrayList<ScheduleRealInfo>()); | 1892 | keyMap.put(key, new ArrayList<ScheduleRealInfo>()); |
| 1788 | keyMap.get(key).add(schedule); | 1893 | keyMap.get(key).add(schedule); |
| 1789 | } | 1894 | } |
| 1790 | 1895 | ||
| 1896 | + List<String> keyList = new ArrayList<String>(); | ||
| 1897 | + keyList.addAll(keyMap.keySet()); | ||
| 1898 | + Collections.sort(keyList, new Comparator<String>() { | ||
| 1899 | + | ||
| 1900 | + public int compare(String o1, String o2) { | ||
| 1901 | + | ||
| 1902 | + Long a = 0l; | ||
| 1903 | + Long b = 0l; | ||
| 1904 | + String[] split1 = o1.split("/"); | ||
| 1905 | + String[] split2 = o2.split("/"); | ||
| 1906 | + char[] charArray1 = split1[0].toCharArray(); | ||
| 1907 | + char[] charArray2 = split2[0].toCharArray(); | ||
| 1908 | + for(int i = 0; i < charArray1.length; i++){ | ||
| 1909 | + long temp = 1l; | ||
| 1910 | + for(int j = 0; j < i; j++) | ||
| 1911 | + temp *= 10; | ||
| 1912 | + a += (long)charArray1[charArray1.length - 1 - i] * temp; | ||
| 1913 | + } | ||
| 1914 | + for(int i = 0; i < charArray2.length; i++){ | ||
| 1915 | + long temp = 1l; | ||
| 1916 | + for(int j = 0; j < i; j++) | ||
| 1917 | + temp *= 10; | ||
| 1918 | + b += (long)charArray2[charArray2.length - 1 - i] * temp; | ||
| 1919 | + } | ||
| 1920 | + | ||
| 1921 | + return a.compareTo(b); | ||
| 1922 | + } | ||
| 1923 | + }); | ||
| 1924 | + Collections.sort(keyList, new Comparator<String>() { | ||
| 1925 | + | ||
| 1926 | + public int compare(String o1, String o2) { | ||
| 1927 | + | ||
| 1928 | + Long a = 0l; | ||
| 1929 | + Long b = 0l; | ||
| 1930 | + String[] split1 = o1.split("/"); | ||
| 1931 | + String[] split2 = o2.split("/"); | ||
| 1932 | + char[] charArray1 = split1[1].toCharArray(); | ||
| 1933 | + char[] charArray2 = split2[1].toCharArray(); | ||
| 1934 | + for(int i = 0; i < charArray1.length; i++){ | ||
| 1935 | + long temp = 1l; | ||
| 1936 | + for(int j = 0; j < i; j++) | ||
| 1937 | + temp *= 10; | ||
| 1938 | + a += (long)charArray1[charArray1.length - 1 - i] * temp; | ||
| 1939 | + } | ||
| 1940 | + for(int i = 0; i < charArray2.length; i++){ | ||
| 1941 | + long temp = 1l; | ||
| 1942 | + for(int j = 0; j < i; j++) | ||
| 1943 | + temp *= 10; | ||
| 1944 | + b += (long)charArray2[charArray2.length - 1 - i] * temp; | ||
| 1945 | + } | ||
| 1946 | + | ||
| 1947 | + return a.compareTo(b); | ||
| 1948 | + } | ||
| 1949 | + }); | ||
| 1950 | + | ||
| 1791 | Map<String, Object> temp = new HashMap<String, Object>(); | 1951 | Map<String, Object> temp = new HashMap<String, Object>(); |
| 1792 | int jhbc_ = 0, sjbc_ = 0, | 1952 | int jhbc_ = 0, sjbc_ = 0, |
| 1793 | lzbc_ = 0, dmbc_ = 0, | 1953 | lzbc_ = 0, dmbc_ = 0, |
| @@ -1801,7 +1961,8 @@ public class BusIntervalServiceImpl implements BusIntervalService { | @@ -1801,7 +1961,8 @@ public class BusIntervalServiceImpl implements BusIntervalService { | ||
| 1801 | qclc_ = new BigDecimal("0"), kxlc_ = new BigDecimal("0"), | 1961 | qclc_ = new BigDecimal("0"), kxlc_ = new BigDecimal("0"), |
| 1802 | qhlc_ = new BigDecimal("0"), wylc_ = new BigDecimal("0"), | 1962 | qhlc_ = new BigDecimal("0"), wylc_ = new BigDecimal("0"), |
| 1803 | qtlc_ = new BigDecimal("0"); | 1963 | qtlc_ = new BigDecimal("0"); |
| 1804 | - for(String key : keyMap.keySet()){ | 1964 | +// for(String key : keyMap.keySet()){ |
| 1965 | + for(String key : keyList){ | ||
| 1805 | Map<String, Object> tempMap = new HashMap<String, Object>(); | 1966 | Map<String, Object> tempMap = new HashMap<String, Object>(); |
| 1806 | int jhbc = 0, sjbc = 0, | 1967 | int jhbc = 0, sjbc = 0, |
| 1807 | lzbc = 0, dmbc = 0, | 1968 | lzbc = 0, dmbc = 0, |
| @@ -1907,11 +2068,12 @@ public class BusIntervalServiceImpl implements BusIntervalService { | @@ -1907,11 +2068,12 @@ public class BusIntervalServiceImpl implements BusIntervalService { | ||
| 1907 | if(jhlc.doubleValue() == 0d){ | 2068 | if(jhlc.doubleValue() == 0d){ |
| 1908 | flag = false; | 2069 | flag = false; |
| 1909 | } | 2070 | } |
| 2071 | + String[] keys = key.split("/"); | ||
| 1910 | tempMap.put("date", Date); | 2072 | tempMap.put("date", Date); |
| 1911 | tempMap.put("company", companyName); | 2073 | tempMap.put("company", companyName); |
| 1912 | - tempMap.put("subCompany", subCompanyName); | 2074 | + tempMap.put("subCompany", keys[1]); |
| 1913 | tempMap.put("times", sfqr == 1 ? times : "全日"); | 2075 | tempMap.put("times", sfqr == 1 ? times : "全日"); |
| 1914 | - tempMap.put("line", key); | 2076 | + tempMap.put("line", keys[0]); |
| 1915 | tempMap.put("jhbc", jhbc); | 2077 | tempMap.put("jhbc", jhbc); |
| 1916 | tempMap.put("sjbc", sjbc); | 2078 | tempMap.put("sjbc", sjbc); |
| 1917 | tempMap.put("bcbfb", df.format(jhbc>0?(double)sjbc/jhbc*100:0)+"%"); | 2079 | tempMap.put("bcbfb", df.format(jhbc>0?(double)sjbc/jhbc*100:0)+"%"); |
| @@ -2055,10 +2217,14 @@ public class BusIntervalServiceImpl implements BusIntervalService { | @@ -2055,10 +2217,14 @@ public class BusIntervalServiceImpl implements BusIntervalService { | ||
| 2055 | Map<String, List<ScheduleRealInfo>> keyMap = new HashMap<String, List<ScheduleRealInfo>>(); | 2217 | Map<String, List<ScheduleRealInfo>> keyMap = new HashMap<String, List<ScheduleRealInfo>>(); |
| 2056 | Map<String, List<Map<String, Object>>> keyMap0 = new HashMap<String, List<Map<String, Object>>>(); | 2218 | Map<String, List<Map<String, Object>>> keyMap0 = new HashMap<String, List<Map<String, Object>>>(); |
| 2057 | Map<String, List<Map<String, Object>>> keyMap1 = new HashMap<String, List<Map<String, Object>>>(); | 2219 | Map<String, List<Map<String, Object>>> keyMap1 = new HashMap<String, List<Map<String, Object>>>(); |
| 2058 | - | ||
| 2059 | - String company = map.get("company").toString(); | ||
| 2060 | - String subCompany = map.get("subCompany").toString(); | 2220 | + |
| 2221 | + String company = "", subCompany = ""; | ||
| 2222 | + String sfyy = map.get("sfyy").toString(); | ||
| 2061 | String line = map.get("line").toString(); | 2223 | String line = map.get("line").toString(); |
| 2224 | + if(map.get("company")!=null) | ||
| 2225 | + company = map.get("company").toString(); | ||
| 2226 | + if(map.get("subCompany")!=null) | ||
| 2227 | + subCompany = map.get("subCompany").toString(); | ||
| 2062 | String startDate = map.get("startDate").toString(); | 2228 | String startDate = map.get("startDate").toString(); |
| 2063 | String endDate = map.get("endDate").toString(); | 2229 | String endDate = map.get("endDate").toString(); |
| 2064 | String times = map.get("times").toString(); | 2230 | String times = map.get("times").toString(); |
| @@ -2091,7 +2257,10 @@ public class BusIntervalServiceImpl implements BusIntervalService { | @@ -2091,7 +2257,10 @@ public class BusIntervalServiceImpl implements BusIntervalService { | ||
| 2091 | } | 2257 | } |
| 2092 | } | 2258 | } |
| 2093 | if(company.length() != 0){ | 2259 | if(company.length() != 0){ |
| 2094 | - sql += " and (gs_bm = '"+company+"' and fgs_bm = '"+subCompany+"')"; | 2260 | + sql += " and gs_bm = '"+company+"'"; |
| 2261 | + } | ||
| 2262 | + if(subCompany.length() != 0){ | ||
| 2263 | + sql += " and fgs_bm = '"+subCompany+"'"; | ||
| 2095 | } | 2264 | } |
| 2096 | sql += " and bc_type != 'in' and bc_type != 'out' and bc_type != 'ldks'"; | 2265 | sql += " and bc_type != 'in' and bc_type != 'out' and bc_type != 'ldks'"; |
| 2097 | 2266 | ||
| @@ -2152,10 +2321,23 @@ public class BusIntervalServiceImpl implements BusIntervalService { | @@ -2152,10 +2321,23 @@ public class BusIntervalServiceImpl implements BusIntervalService { | ||
| 2152 | date = startDate; | 2321 | date = startDate; |
| 2153 | else | 2322 | else |
| 2154 | date = startDate + "--" + endDate; | 2323 | date = startDate + "--" + endDate; |
| 2324 | + | ||
| 2325 | + Map<String, Boolean> lineNature = lineService.lineNature(); | ||
| 2155 | 2326 | ||
| 2156 | for(ScheduleRealInfo schedule : list){ | 2327 | for(ScheduleRealInfo schedule : list){ |
| 2157 | if(schedule.getXlName() == null || schedule.getXlName().trim().length() == 0) | 2328 | if(schedule.getXlName() == null || schedule.getXlName().trim().length() == 0) |
| 2158 | continue; | 2329 | continue; |
| 2330 | + String xlBm = schedule.getXlBm(); | ||
| 2331 | + if(lineNature.containsKey(xlBm) && lineNature.get(xlBm) != null){ | ||
| 2332 | + if(sfyy.equals("1") && !lineNature.get(xlBm)){ | ||
| 2333 | + continue; | ||
| 2334 | + } else if(sfyy.equals("2") && lineNature.get(xlBm)){ | ||
| 2335 | + continue; | ||
| 2336 | + } | ||
| 2337 | + } else if(sfyy.equals("2")){ | ||
| 2338 | + continue; | ||
| 2339 | + } | ||
| 2340 | + | ||
| 2159 | String key = schedule.getGsName() + "/" + schedule.getFgsName() + "/" + schedule.getXlBm(); | 2341 | String key = schedule.getGsName() + "/" + schedule.getFgsName() + "/" + schedule.getXlBm(); |
| 2160 | if(!keyMap.containsKey(key)) | 2342 | if(!keyMap.containsKey(key)) |
| 2161 | keyMap.put(key, new ArrayList<ScheduleRealInfo>()); | 2343 | keyMap.put(key, new ArrayList<ScheduleRealInfo>()); |
| @@ -2339,13 +2521,14 @@ public class BusIntervalServiceImpl implements BusIntervalService { | @@ -2339,13 +2521,14 @@ public class BusIntervalServiceImpl implements BusIntervalService { | ||
| 2339 | // tempMap.put("correctbl", df.format((double)(sddf + zddf + dxtz + lbtz)/sjbc*100) + "%"); | 2521 | // tempMap.put("correctbl", df.format((double)(sddf + zddf + dxtz + lbtz)/sjbc*100) + "%"); |
| 2340 | resList.add(tempMap); | 2522 | resList.add(tempMap); |
| 2341 | } | 2523 | } |
| 2524 | + | ||
| 2342 | //计算掉线调整 | 2525 | //计算掉线调整 |
| 2343 | String sqldot = "select * from " | 2526 | String sqldot = "select * from " |
| 2344 | - + "logger_sch_modify where gsbm =? and fgsbm=? and rq BETWEEN ? and ? order by line_code,sch_id"; | ||
| 2345 | - | ||
| 2346 | - ; | 2527 | + + "logger_sch_modify where gsbm = ? and fgsbm like ? and rq BETWEEN ? and ? order by line_code,sch_id"; |
| 2528 | + | ||
| 2529 | + | ||
| 2347 | List<SchEditInfoDto> listDot = jdbcTemplate.query(sqldot, | 2530 | List<SchEditInfoDto> listDot = jdbcTemplate.query(sqldot, |
| 2348 | - new BeanPropertyRowMapper(SchEditInfoDto.class),company,subCompany,map.get("startDate").toString(),map.get("endDate").toString()); | 2531 | + new BeanPropertyRowMapper(SchEditInfoDto.class),company,"%"+subCompany+"%",map.get("startDate").toString(),map.get("endDate").toString()); |
| 2349 | int dxtzz=0; | 2532 | int dxtzz=0; |
| 2350 | Map<String, Object> mapSchId=new HashMap<String,Object>(); | 2533 | Map<String, Object> mapSchId=new HashMap<String,Object>(); |
| 2351 | for (int i = 0; i < resList.size(); i++) { | 2534 | for (int i = 0; i < resList.size(); i++) { |
| @@ -2860,21 +3043,28 @@ public class BusIntervalServiceImpl implements BusIntervalService { | @@ -2860,21 +3043,28 @@ public class BusIntervalServiceImpl implements BusIntervalService { | ||
| 2860 | String startDate = map.get("startDate").toString().trim(); | 3043 | String startDate = map.get("startDate").toString().trim(); |
| 2861 | String endDate = map.get("endDate").toString().trim(); | 3044 | String endDate = map.get("endDate").toString().trim(); |
| 2862 | String line = map.get("line").toString().trim(); | 3045 | String line = map.get("line").toString().trim(); |
| 2863 | - String company = map.get("gs").toString().trim(); | ||
| 2864 | - String subCompany = map.get("fgs").toString().trim(); | 3046 | + String company = "", subCompany = ""; |
| 3047 | + if(map.get("gs")!=null) | ||
| 3048 | + company = map.get("gs").toString().trim(); | ||
| 3049 | + if(map.get("fgs")!=null) | ||
| 3050 | + subCompany = map.get("fgs").toString().trim(); | ||
| 3051 | + String sfyy = ""; | ||
| 3052 | + if(map.get("sfyy")!=null) | ||
| 3053 | + sfyy = map.get("sfyy").toString().trim(); | ||
| 2865 | 3054 | ||
| 2866 | String sql = "select id, cl_zbh, fcsj, fcsj_actual, j_gh, j_name, lp_name, qdz_name, " + | 3055 | String sql = "select id, cl_zbh, fcsj, fcsj_actual, j_gh, j_name, lp_name, qdz_name, " + |
| 2867 | - "schedule_date_str, xl_name, zdsj, zdsj_actual, fgs_name, gs_name, xl_dir, xl_bm " + | 3056 | + "schedule_date_str, xl_name, zdsj, zdsj_actual, fgs_bm, fgs_name, gs_name, xl_dir, xl_bm " + |
| 2868 | "from bsth_c_s_sp_info_real " + | 3057 | "from bsth_c_s_sp_info_real " + |
| 2869 | "where schedule_date_str >= '"+startDate+"' and schedule_date_str <= '"+endDate+"' " + | 3058 | "where schedule_date_str >= '"+startDate+"' and schedule_date_str <= '"+endDate+"' " + |
| 2870 | "and bc_type != 'in' and bc_type != 'out' and bc_type != 'ldks' and cc_service = 0"; | 3059 | "and bc_type != 'in' and bc_type != 'out' and bc_type != 'ldks' and cc_service = 0"; |
| 2871 | 3060 | ||
| 2872 | if(company.length() != 0) | 3061 | if(company.length() != 0) |
| 2873 | - sql += " and gs_bm = '"+company+"' and fgs_bm = '"+subCompany+"'"; | 3062 | + sql += " and gs_bm = '"+company+"'"; |
| 3063 | + if(subCompany.length() != 0) | ||
| 3064 | + sql += " and fgs_bm = '"+subCompany+"'"; | ||
| 2874 | if(line.length() != 0) | 3065 | if(line.length() != 0) |
| 2875 | sql += " and xl_bm = '"+line+"'"; | 3066 | sql += " and xl_bm = '"+line+"'"; |
| 2876 | 3067 | ||
| 2877 | - System.out.println(sql); | ||
| 2878 | List<ScheduleRealInfo> list = jdbcTemplate.query(sql, | 3068 | List<ScheduleRealInfo> list = jdbcTemplate.query(sql, |
| 2879 | new RowMapper<ScheduleRealInfo>(){ | 3069 | new RowMapper<ScheduleRealInfo>(){ |
| 2880 | @Override | 3070 | @Override |
| @@ -2893,6 +3083,7 @@ public class BusIntervalServiceImpl implements BusIntervalService { | @@ -2893,6 +3083,7 @@ public class BusIntervalServiceImpl implements BusIntervalService { | ||
| 2893 | schedule.setQdzName(rs.getString("qdz_name")); | 3083 | schedule.setQdzName(rs.getString("qdz_name")); |
| 2894 | schedule.setGsName(rs.getString("gs_name")); | 3084 | schedule.setGsName(rs.getString("gs_name")); |
| 2895 | schedule.setFgsName(rs.getString("fgs_name")); | 3085 | schedule.setFgsName(rs.getString("fgs_name")); |
| 3086 | + schedule.setFgsBm(rs.getString("fgs_bm")); | ||
| 2896 | schedule.setClZbh(rs.getString("cl_zbh")); | 3087 | schedule.setClZbh(rs.getString("cl_zbh")); |
| 2897 | schedule.setjGh(rs.getString("j_gh")); | 3088 | schedule.setjGh(rs.getString("j_gh")); |
| 2898 | schedule.setjName(rs.getString("j_name")); | 3089 | schedule.setjName(rs.getString("j_name")); |
| @@ -2903,8 +3094,21 @@ public class BusIntervalServiceImpl implements BusIntervalService { | @@ -2903,8 +3094,21 @@ public class BusIntervalServiceImpl implements BusIntervalService { | ||
| 2903 | Map<String, Map<String, List<ScheduleRealInfo>>> sches = new HashMap<String, Map<String, List<ScheduleRealInfo>>>(); | 3094 | Map<String, Map<String, List<ScheduleRealInfo>>> sches = new HashMap<String, Map<String, List<ScheduleRealInfo>>>(); |
| 2904 | Map<String, List<List<Map<String, Object>>>> keyMap = new HashMap<String, List<List<Map<String, Object>>>>(); | 3095 | Map<String, List<List<Map<String, Object>>>> keyMap = new HashMap<String, List<List<Map<String, Object>>>>(); |
| 2905 | 3096 | ||
| 3097 | + Map<String, Boolean> lineNature = lineService.lineNature(); | ||
| 3098 | + | ||
| 2906 | for(ScheduleRealInfo s : list){ | 3099 | for(ScheduleRealInfo s : list){ |
| 2907 | - String xl = s.getXlName(); | 3100 | + String xlBm = s.getXlBm(); |
| 3101 | + if(lineNature.containsKey(xlBm) && lineNature.get(xlBm) != null){ | ||
| 3102 | + if(sfyy.equals("1") && !lineNature.get(xlBm)){ | ||
| 3103 | + continue; | ||
| 3104 | + } else if(sfyy.equals("2") && lineNature.get(xlBm)){ | ||
| 3105 | + continue; | ||
| 3106 | + } | ||
| 3107 | + } else if(sfyy.equals("2")){ | ||
| 3108 | + continue; | ||
| 3109 | + } | ||
| 3110 | + | ||
| 3111 | + String xl = s.getXlName() + "/" + s.getFgsName(); | ||
| 2908 | String dateStr = s.getScheduleDateStr(); | 3112 | String dateStr = s.getScheduleDateStr(); |
| 2909 | if(!sches.containsKey(xl)){ | 3113 | if(!sches.containsKey(xl)){ |
| 2910 | sches.put(xl, new HashMap<String, List<ScheduleRealInfo>>()); | 3114 | sches.put(xl, new HashMap<String, List<ScheduleRealInfo>>()); |
| @@ -2956,6 +3160,7 @@ public class BusIntervalServiceImpl implements BusIntervalService { | @@ -2956,6 +3160,7 @@ public class BusIntervalServiceImpl implements BusIntervalService { | ||
| 2956 | Map<String, Object> temp = new HashMap<String, Object>(); | 3160 | Map<String, Object> temp = new HashMap<String, Object>(); |
| 2957 | temp.put("gs", s.getGsName()); | 3161 | temp.put("gs", s.getGsName()); |
| 2958 | temp.put("fgs", s.getFgsName()); | 3162 | temp.put("fgs", s.getFgsName()); |
| 3163 | + temp.put("fgsBm", s.getFgsBm()); | ||
| 2959 | temp.put("date", date); | 3164 | temp.put("date", date); |
| 2960 | temp.put("xlbm", s.getXlBm()); | 3165 | temp.put("xlbm", s.getXlBm()); |
| 2961 | temp.put("line", s.getXlName()); | 3166 | temp.put("line", s.getXlName()); |
| @@ -3020,6 +3225,7 @@ public class BusIntervalServiceImpl implements BusIntervalService { | @@ -3020,6 +3225,7 @@ public class BusIntervalServiceImpl implements BusIntervalService { | ||
| 3020 | } | 3225 | } |
| 3021 | tempMap.put("gs", list1.get(0).get(0).get("gs")); | 3226 | tempMap.put("gs", list1.get(0).get(0).get("gs")); |
| 3022 | tempMap.put("fgs", list1.get(0).get(0).get("fgs")); | 3227 | tempMap.put("fgs", list1.get(0).get(0).get("fgs")); |
| 3228 | + tempMap.put("fgsBm", list1.get(0).get(0).get("fgsBm")); | ||
| 3023 | tempMap.put("line", list1.get(0).get(0).get("line")); | 3229 | tempMap.put("line", list1.get(0).get(0).get("line")); |
| 3024 | tempMap.put("date", list1.get(0).get(0).get("date")); | 3230 | tempMap.put("date", list1.get(0).get(0).get("date")); |
| 3025 | tempMap.put("xlbm", list1.get(0).get(0).get("xlbm")); | 3231 | tempMap.put("xlbm", list1.get(0).get(0).get("xlbm")); |
| @@ -3077,6 +3283,7 @@ public class BusIntervalServiceImpl implements BusIntervalService { | @@ -3077,6 +3283,7 @@ public class BusIntervalServiceImpl implements BusIntervalService { | ||
| 3077 | } | 3283 | } |
| 3078 | tempMap.put("gs", list2.get(0).get("gs")); | 3284 | tempMap.put("gs", list2.get(0).get("gs")); |
| 3079 | tempMap.put("fgs", list2.get(0).get("fgs")); | 3285 | tempMap.put("fgs", list2.get(0).get("fgs")); |
| 3286 | + tempMap.put("fgsBm", list2.get(0).get("fgsBm")); | ||
| 3080 | tempMap.put("line", list2.get(0).get("line")); | 3287 | tempMap.put("line", list2.get(0).get("line")); |
| 3081 | tempMap.put("date", list2.get(0).get("date")); | 3288 | tempMap.put("date", list2.get(0).get("date")); |
| 3082 | tempMap.put("xl_date", list2.get(0).get("date") + "_" + list2.get(0).get("xlbm") + "_" + list2.get(0).get("line")); | 3289 | tempMap.put("xl_date", list2.get(0).get("date") + "_" + list2.get(0).get("xlbm") + "_" + list2.get(0).get("line")); |
src/main/java/com/bsth/service/impl/TrafficManageServiceImpl.java
| @@ -536,7 +536,7 @@ public class TrafficManageServiceImpl implements TrafficManageService{ | @@ -536,7 +536,7 @@ public class TrafficManageServiceImpl implements TrafficManageService{ | ||
| 536 | //发送邮件 | 536 | //发送邮件 |
| 537 | EmailBean mail = new EmailBean(); | 537 | EmailBean mail = new EmailBean(); |
| 538 | mail.setSubject(InetAddress.getLocalHost().getHostAddress()+":路单日志数据"+date); | 538 | mail.setSubject(InetAddress.getLocalHost().getHostAddress()+":路单日志数据"+date); |
| 539 | - mail.setContent(logSuccess+"<br/>成功数:"+countSuccess+"<br/>" +logFailure+"<br/>失败数:"+countFailure); | 539 | + mail.setContent("成功数:"+countSuccess+"<br/>失败数:"+countFailure+"<br/>" +logSuccess + "<br/>"+logFailure); |
| 540 | sendEmailController.sendMail(emailSendToAddress, mail); | 540 | sendEmailController.sendMail(emailSendToAddress, mail); |
| 541 | logger.info("setLD-sendMail:邮件发送成功!"); | 541 | logger.info("setLD-sendMail:邮件发送成功!"); |
| 542 | }catch (Exception e){ | 542 | }catch (Exception e){ |
| @@ -945,11 +945,11 @@ public class TrafficManageServiceImpl implements TrafficManageService{ | @@ -945,11 +945,11 @@ public class TrafficManageServiceImpl implements TrafficManageService{ | ||
| 945 | */ | 945 | */ |
| 946 | @Override | 946 | @Override |
| 947 | public String setSKB(String ids) { | 947 | public String setSKB(String ids) { |
| 948 | - String result = "failure"; | 948 | + String result = "上传失败,"; |
| 949 | StringBuffer sBuffer = new StringBuffer(); | 949 | StringBuffer sBuffer = new StringBuffer(); |
| 950 | DecimalFormat df = new DecimalFormat("######0.000"); | 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 | try { | 953 | try { |
| 954 | String[] idArray = ids.split(","); | 954 | String[] idArray = ids.split(","); |
| 955 | StringBuffer sBufferA ,sBufferB ,sBufferC ; | 955 | StringBuffer sBufferA ,sBufferB ,sBufferC ; |
| @@ -965,14 +965,21 @@ public class TrafficManageServiceImpl implements TrafficManageService{ | @@ -965,14 +965,21 @@ public class TrafficManageServiceImpl implements TrafficManageService{ | ||
| 965 | sBuffer.append("<SKBs>"); | 965 | sBuffer.append("<SKBs>"); |
| 966 | HashMap<String,String> paramMap; | 966 | HashMap<String,String> paramMap; |
| 967 | HashMap<String,String> otherMap = new HashMap<>(); | 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 | for (int i = 0; i < idArray.length; i++) { | 975 | for (int i = 0; i < idArray.length; i++) { |
| 969 | - long ttinfoId = Long.valueOf(idArray[i]); | 976 | + ttinfoId = Long.valueOf(idArray[i]); |
| 970 | ttInfo = ttInfoRepository.findOne(ttinfoId); | 977 | ttInfo = ttInfoRepository.findOne(ttinfoId); |
| 971 | if(ttInfo == null) | 978 | if(ttInfo == null) |
| 972 | continue; | 979 | continue; |
| 973 | ttinfoList.add(ttInfo); // 保存时刻表 | 980 | ttinfoList.add(ttInfo); // 保存时刻表 |
| 974 | // 得到时刻表版本号 | 981 | // 得到时刻表版本号 |
| 975 | - int lineVersion = ttInfo.getLineVersion(); | 982 | + lineVersion = ttInfo.getLineVersion(); |
| 976 | // 查询历史站点路由 | 983 | // 查询历史站点路由 |
| 977 | lsStationCode2NameMap = getLsStationCode(ttInfo.getXl().getLineCode(),lineVersion); | 984 | lsStationCode2NameMap = getLsStationCode(ttInfo.getXl().getLineCode(),lineVersion); |
| 978 | // 查询历史站点路由 | 985 | // 查询历史站点路由 |
| @@ -988,16 +995,35 @@ public class TrafficManageServiceImpl implements TrafficManageService{ | @@ -988,16 +995,35 @@ public class TrafficManageServiceImpl implements TrafficManageService{ | ||
| 988 | param = new HashMap(); | 995 | param = new HashMap(); |
| 989 | param.put("line.id_eq", ttInfo.getXl().getId()); | 996 | param.put("line.id_eq", ttInfo.getXl().getId()); |
| 990 | lineInformation = lineInformationRepository.findOne(new CustomerSpecs<LineInformation>(param)); | 997 | lineInformation = lineInformationRepository.findOne(new CustomerSpecs<LineInformation>(param)); |
| 998 | + // 初始化 | ||
| 999 | + isLogStation = true; | ||
| 991 | if(ttInfoDetailIterator.hasNext()){ | 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 | sBuffer.append("<SKB>"); | 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 | sBufferB = new StringBuffer(); | 1021 | sBufferB = new StringBuffer(); |
| 996 | sBufferC = new StringBuffer(); | 1022 | sBufferC = new StringBuffer(); |
| 997 | sBufferB.append("<KSRQ>").append(sdfnyr.format(ttInfo.getQyrq())).append("</KSRQ>"); | 1023 | sBufferB.append("<KSRQ>").append(sdfnyr.format(ttInfo.getQyrq())).append("</KSRQ>"); |
| 998 | // 结束日期暂时不要,节假日的班次表才需要,如春节的班次表 | 1024 | // 结束日期暂时不要,节假日的班次表才需要,如春节的班次表 |
| 999 | sBufferB.append("<JSRQ>").append("").append("</JSRQ>"); | 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 | sBufferB.append("<TBYY>").append("").append("</TBYY>"); | 1027 | sBufferB.append("<TBYY>").append("").append("</TBYY>"); |
| 1002 | sBufferB.append("<UPDT>").append(sdfnyrsfm.format(new Date())).append("</UPDT>"); | 1028 | sBufferB.append("<UPDT>").append(sdfnyrsfm.format(new Date())).append("</UPDT>"); |
| 1003 | sBufferB.append("<BCList>"); | 1029 | sBufferB.append("<BCList>"); |
| @@ -1005,7 +1031,7 @@ public class TrafficManageServiceImpl implements TrafficManageService{ | @@ -1005,7 +1031,7 @@ public class TrafficManageServiceImpl implements TrafficManageService{ | ||
| 1005 | ttInfoDetail = ttInfoDetailIterator.next(); | 1031 | ttInfoDetail = ttInfoDetailIterator.next(); |
| 1006 | bcType = ttInfoDetail.getBcType(); | 1032 | bcType = ttInfoDetail.getBcType(); |
| 1007 | sxx = ttInfoDetail.getXlDir(); | 1033 | sxx = ttInfoDetail.getXlDir(); |
| 1008 | - // 进出场班次 | 1034 | + // 进出场班次的里程,加入总里程 |
| 1009 | if(bcType.equals("in") || bcType.equals("out")){ | 1035 | if(bcType.equals("in") || bcType.equals("out")){ |
| 1010 | // 进出班次的计划里程,算空驶里程 | 1036 | // 进出班次的计划里程,算空驶里程 |
| 1011 | emptyLc = ttInfoDetail.getJhlc(); | 1037 | emptyLc = ttInfoDetail.getJhlc(); |
| @@ -1013,26 +1039,59 @@ public class TrafficManageServiceImpl implements TrafficManageService{ | @@ -1013,26 +1039,59 @@ public class TrafficManageServiceImpl implements TrafficManageService{ | ||
| 1013 | zlc += emptyLc; | 1039 | zlc += emptyLc; |
| 1014 | continue; | 1040 | continue; |
| 1015 | } | 1041 | } |
| 1042 | + // 不是正常班次,不传到运管处 | ||
| 1043 | + if(!bcType.equals("normal")){ | ||
| 1044 | + continue; | ||
| 1045 | + } | ||
| 1016 | // 如果发车时间格式错误,忽略此条 | 1046 | // 如果发车时间格式错误,忽略此条 |
| 1017 | if(changeTimeFormat(ttInfoDetail) == null){ | 1047 | if(changeTimeFormat(ttInfoDetail) == null){ |
| 1018 | continue; | 1048 | continue; |
| 1019 | } | 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 | + } | ||
| 1020 | sBufferC.append("<BC>"); | 1056 | sBufferC.append("<BC>"); |
| 1021 | sBufferC.append("<LPBH>").append(ttInfoDetail.getLp().getLpNo()).append("</LPBH>"); | 1057 | sBufferC.append("<LPBH>").append(ttInfoDetail.getLp().getLpNo()).append("</LPBH>"); |
| 1022 | sBufferC.append("<SXX>").append(sxx).append("</SXX>"); | 1058 | sBufferC.append("<SXX>").append(sxx).append("</SXX>"); |
| 1023 | - sBufferC.append("<FCZDMC>").append(lsStationCode2NameMap.get(ttInfoDetail.getXl().getLineCode()+"_"+ttInfoDetail.getXlDir() | ||
| 1024 | - +"_"+ttInfoDetail.getQdzCode())).append("</FCZDMC>"); | 1059 | + sBufferC.append("<FCZDMC>").append(fczdmc).append("</FCZDMC>"); |
| 1025 | // 起点站的参数 | 1060 | // 起点站的参数 |
| 1026 | otherMap.put("stationMark","B"); | 1061 | otherMap.put("stationMark","B"); |
| 1027 | paramMap = packageYgcStationNumParam(ttInfoDetail,otherMap); | 1062 | paramMap = packageYgcStationNumParam(ttInfoDetail,otherMap); |
| 1028 | - 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>"); | ||
| 1029 | sBufferC.append("<JHFCSJ>").append(changeTimeFormat(ttInfoDetail)).append("</JHFCSJ>"); | 1079 | sBufferC.append("<JHFCSJ>").append(changeTimeFormat(ttInfoDetail)).append("</JHFCSJ>"); |
| 1030 | - sBufferC.append("<DDZDMC>").append(lsStationCode2NameMap.get(ttInfoDetail.getXl().getLineCode()+"_"+ttInfoDetail.getXlDir() | ||
| 1031 | - +"_"+ttInfoDetail.getZdzCode())).append("</DDZDMC>"); | ||
| 1032 | - // 起点站的参数 | 1080 | + sBufferC.append("<DDZDMC>").append(ddzdmc).append("</DDZDMC>"); |
| 1081 | + // 终点站的参数 | ||
| 1033 | otherMap.put("stationMark","E"); | 1082 | otherMap.put("stationMark","E"); |
| 1034 | paramMap = packageYgcStationNumParam(ttInfoDetail,otherMap); | 1083 | paramMap = packageYgcStationNumParam(ttInfoDetail,otherMap); |
| 1035 | - 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>"); | ||
| 1036 | sBufferC.append("<JHDDSJ>").append(calcDdsj(ttInfoDetail.getFcsj(),ttInfoDetail.getBcsj())).append("</JHDDSJ>"); | 1095 | sBufferC.append("<JHDDSJ>").append(calcDdsj(ttInfoDetail.getFcsj(),ttInfoDetail.getBcsj())).append("</JHDDSJ>"); |
| 1037 | sBufferC.append("</BC>"); | 1096 | sBufferC.append("</BC>"); |
| 1038 | // 0:上行;1:下行 | 1097 | // 0:上行;1:下行 |
| @@ -1051,10 +1110,11 @@ public class TrafficManageServiceImpl implements TrafficManageService{ | @@ -1051,10 +1110,11 @@ public class TrafficManageServiceImpl implements TrafficManageService{ | ||
| 1051 | sBufferA.append("<JHYYLC>").append(df.format(yylc)).append("</JHYYLC>"); | 1110 | sBufferA.append("<JHYYLC>").append(df.format(yylc)).append("</JHYYLC>"); |
| 1052 | sBuffer.append(sBufferA).append(sBufferB).append(sBufferC); | 1111 | sBuffer.append(sBufferA).append(sBufferB).append(sBufferC); |
| 1053 | } | 1112 | } |
| 1113 | + logger.info("setSKB:"+"ttinfoId:"+ttinfoId+";当前站点版本号:"+lineVersion+";查询历史站点路由:"+lsStationCode2NameMap+";查询历史站点编号:"+lsStationName2YgcNumber); | ||
| 1054 | } | 1114 | } |
| 1055 | sBuffer.append("</SKBs>"); | 1115 | sBuffer.append("</SKBs>"); |
| 1056 | if(ssop.setSKB(userNameOther, passwordOther, sBuffer.toString()).isSuccess()){ | 1116 | if(ssop.setSKB(userNameOther, passwordOther, sBuffer.toString()).isSuccess()){ |
| 1057 | - result = "success"; | 1117 | + result = "上传成功"; |
| 1058 | SKBUploadLogger skbUploadLogger ; | 1118 | SKBUploadLogger skbUploadLogger ; |
| 1059 | SysUser user = SecurityUtils.getCurrentUser(); | 1119 | SysUser user = SecurityUtils.getCurrentUser(); |
| 1060 | // 保存时刻表上传记录 | 1120 | // 保存时刻表上传记录 |
src/main/java/com/bsth/service/realcontrol/impl/ScheduleRealInfoServiceImpl.java
| @@ -2234,6 +2234,9 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl<ScheduleRealInf | @@ -2234,6 +2234,9 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl<ScheduleRealInf | ||
| 2234 | } | 2234 | } |
| 2235 | try { | 2235 | try { |
| 2236 | String dateTime = sdfSimple.format(sdfMonth.parse(date)); | 2236 | String dateTime = sdfSimple.format(sdfMonth.parse(date)); |
| 2237 | + if(!endDate.equals(date)){ | ||
| 2238 | + dateTime += "-" + sdfSimple.format(sdfMonth.parse(endDate)); | ||
| 2239 | + } | ||
| 2237 | String lineName = BasicData.lineCode2NameMap.get(line); | 2240 | String lineName = BasicData.lineCode2NameMap.get(line); |
| 2238 | listI.add(tempList.iterator()); | 2241 | listI.add(tempList.iterator()); |
| 2239 | String path = this.getClass().getResource("/").getPath() + "static/pages/forms/"; | 2242 | String path = this.getClass().getResource("/").getPath() + "static/pages/forms/"; |
src/main/java/com/bsth/service/schedule/CarConfigInfoService.java
| 1 | package com.bsth.service.schedule; | 1 | package com.bsth.service.schedule; |
| 2 | 2 | ||
| 3 | import com.bsth.entity.schedule.CarConfigInfo; | 3 | import com.bsth.entity.schedule.CarConfigInfo; |
| 4 | +import com.bsth.entity.sys.CompanyAuthority; | ||
| 4 | import com.bsth.service.schedule.exception.ScheduleException; | 5 | import com.bsth.service.schedule.exception.ScheduleException; |
| 5 | 6 | ||
| 7 | +import java.util.List; | ||
| 8 | + | ||
| 6 | /** | 9 | /** |
| 7 | * Created by xu on 16/5/9. | 10 | * Created by xu on 16/5/9. |
| 8 | */ | 11 | */ |
| 9 | public interface CarConfigInfoService extends BService<CarConfigInfo, Long> { | 12 | public interface CarConfigInfoService extends BService<CarConfigInfo, Long> { |
| 10 | void validate_cars(CarConfigInfo carConfigInfo) throws ScheduleException; | 13 | void validate_cars(CarConfigInfo carConfigInfo) throws ScheduleException; |
| 14 | + // 判定车辆是否配置在当前线路中 | ||
| 15 | + void validate_cars_config(CarConfigInfo carConfigInfo) throws ScheduleException; | ||
| 16 | + // 判定车辆所属公司和当前用户的所属公司 | ||
| 17 | + void validate_cars_gs(CarConfigInfo carConfigInfo, List<CompanyAuthority> companyAuthorityList) throws ScheduleException; | ||
| 18 | + // 判定车辆所属分公司和当前用户的所属分公司 | ||
| 19 | + void validate_cars_fgs(CarConfigInfo carConfigInfo, List<CompanyAuthority> companyAuthorityList) throws ScheduleException; | ||
| 11 | void toggleCancel(Long id) throws ScheduleException; | 20 | void toggleCancel(Long id) throws ScheduleException; |
| 21 | + | ||
| 22 | + | ||
| 12 | } | 23 | } |
src/main/java/com/bsth/service/schedule/EmployeeConfigInfoService.java
| 1 | package com.bsth.service.schedule; | 1 | package com.bsth.service.schedule; |
| 2 | 2 | ||
| 3 | import com.bsth.entity.schedule.EmployeeConfigInfo; | 3 | import com.bsth.entity.schedule.EmployeeConfigInfo; |
| 4 | +import com.bsth.entity.sys.CompanyAuthority; | ||
| 4 | import com.bsth.service.schedule.exception.ScheduleException; | 5 | import com.bsth.service.schedule.exception.ScheduleException; |
| 5 | 6 | ||
| 7 | +import java.util.List; | ||
| 8 | + | ||
| 6 | /** | 9 | /** |
| 7 | * Created by xu on 16/5/10. | 10 | * Created by xu on 16/5/10. |
| 8 | */ | 11 | */ |
| 9 | public interface EmployeeConfigInfoService extends BService<EmployeeConfigInfo, Long> { | 12 | public interface EmployeeConfigInfoService extends BService<EmployeeConfigInfo, Long> { |
| 13 | + // 验证驾驶员配置是否重复配置 | ||
| 10 | void validate_jsy(EmployeeConfigInfo employeeConfigInfo) throws ScheduleException; | 14 | void validate_jsy(EmployeeConfigInfo employeeConfigInfo) throws ScheduleException; |
| 15 | + // 验证售票员配置是否重复配置 | ||
| 11 | void validate_spy(EmployeeConfigInfo employeeConfigInfo) throws ScheduleException; | 16 | void validate_spy(EmployeeConfigInfo employeeConfigInfo) throws ScheduleException; |
| 17 | + // 验证驾驶员是否配置在指定线路 | ||
| 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; | ||
| 23 | + // 验证售票员是否配置在指定线路 | ||
| 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 | + | ||
| 12 | void toggleCancel(Long id) throws ScheduleException; | 30 | void toggleCancel(Long id) throws ScheduleException; |
| 13 | Long getMaxDbbm(Integer xlId); | 31 | Long getMaxDbbm(Integer xlId); |
| 14 | } | 32 | } |
src/main/java/com/bsth/service/schedule/impl/CarConfigInfoServiceImpl.java
| 1 | package com.bsth.service.schedule.impl; | 1 | package com.bsth.service.schedule.impl; |
| 2 | 2 | ||
| 3 | +import com.bsth.entity.Cars; | ||
| 3 | import com.bsth.entity.schedule.CarConfigInfo; | 4 | import com.bsth.entity.schedule.CarConfigInfo; |
| 4 | import com.bsth.entity.schedule.rule.ScheduleRule1Flat; | 5 | import com.bsth.entity.schedule.rule.ScheduleRule1Flat; |
| 6 | +import com.bsth.entity.sys.CompanyAuthority; | ||
| 5 | import com.bsth.service.schedule.CarConfigInfoService; | 7 | import com.bsth.service.schedule.CarConfigInfoService; |
| 8 | +import com.bsth.service.schedule.CarsService; | ||
| 6 | import com.bsth.service.schedule.ScheduleRule1FlatService; | 9 | import com.bsth.service.schedule.ScheduleRule1FlatService; |
| 7 | import com.bsth.service.schedule.exception.ScheduleException; | 10 | import com.bsth.service.schedule.exception.ScheduleException; |
| 8 | import com.bsth.service.schedule.utils.DataToolsFile; | 11 | import com.bsth.service.schedule.utils.DataToolsFile; |
| @@ -25,6 +28,8 @@ import java.util.Map; | @@ -25,6 +28,8 @@ import java.util.Map; | ||
| 25 | public class CarConfigInfoServiceImpl extends BServiceImpl<CarConfigInfo, Long> implements CarConfigInfoService { | 28 | public class CarConfigInfoServiceImpl extends BServiceImpl<CarConfigInfo, Long> implements CarConfigInfoService { |
| 26 | @Autowired | 29 | @Autowired |
| 27 | private ScheduleRule1FlatService scheduleRule1FlatService; | 30 | private ScheduleRule1FlatService scheduleRule1FlatService; |
| 31 | + @Autowired | ||
| 32 | + private CarsService carsService; | ||
| 28 | 33 | ||
| 29 | @Autowired | 34 | @Autowired |
| 30 | @Qualifier(value = "carConfig_dataTool") | 35 | @Qualifier(value = "carConfig_dataTool") |
| @@ -45,6 +50,57 @@ public class CarConfigInfoServiceImpl extends BServiceImpl<CarConfigInfo, Long> | @@ -45,6 +50,57 @@ public class CarConfigInfoServiceImpl extends BServiceImpl<CarConfigInfo, Long> | ||
| 45 | return dataToolsService.exportData(params); | 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 | @Transactional | 104 | @Transactional |
| 49 | public void validate_cars(CarConfigInfo carConfigInfo) throws ScheduleException { | 105 | public void validate_cars(CarConfigInfo carConfigInfo) throws ScheduleException { |
| 50 | // 相同车辆不能同时配置 | 106 | // 相同车辆不能同时配置 |
| @@ -73,6 +129,17 @@ public class CarConfigInfoServiceImpl extends BServiceImpl<CarConfigInfo, Long> | @@ -73,6 +129,17 @@ public class CarConfigInfoServiceImpl extends BServiceImpl<CarConfigInfo, Long> | ||
| 73 | 129 | ||
| 74 | } | 130 | } |
| 75 | 131 | ||
| 132 | + @Override | ||
| 133 | + public void validate_cars_config(CarConfigInfo carConfigInfo) throws ScheduleException { | ||
| 134 | + Map<String, Object> param = new HashMap<>(); | ||
| 135 | + param.put("xl.id_eq", carConfigInfo.getXl().getId()); | ||
| 136 | + param.put("cl.id_eq", carConfigInfo.getCl().getId()); | ||
| 137 | + List<CarConfigInfo> carConfigInfos = list(param); | ||
| 138 | + if (CollectionUtils.isEmpty(carConfigInfos)) { | ||
| 139 | + throw new ScheduleException("当前车辆没有配置在当前线路中,不属于当前线路!"); | ||
| 140 | + } | ||
| 141 | + } | ||
| 142 | + | ||
| 76 | @Transactional | 143 | @Transactional |
| 77 | @Override | 144 | @Override |
| 78 | public void delete(Long aLong) throws ScheduleException { | 145 | public void delete(Long aLong) throws ScheduleException { |
src/main/java/com/bsth/service/schedule/impl/CarDeviceServiceImpl.java
| @@ -47,6 +47,7 @@ public class CarDeviceServiceImpl extends BServiceImpl<CarDevice, Long> implemen | @@ -47,6 +47,7 @@ public class CarDeviceServiceImpl extends BServiceImpl<CarDevice, Long> implemen | ||
| 47 | } | 47 | } |
| 48 | param.put("xl_eq", carDevice.getXl()); | 48 | param.put("xl_eq", carDevice.getXl()); |
| 49 | param.put("cl_eq", carDevice.getCl()); | 49 | param.put("cl_eq", carDevice.getCl()); |
| 50 | + param.put("isCancel_eq", false); // 未标记作废删除的 | ||
| 50 | param.put("qyrq_ge", carDevice.getQyrq()); | 51 | param.put("qyrq_ge", carDevice.getQyrq()); |
| 51 | if (!CollectionUtils.isEmpty(list(param))) { | 52 | if (!CollectionUtils.isEmpty(list(param))) { |
| 52 | throw new ScheduleException("启用日期必须比历史的启用日期大"); | 53 | throw new ScheduleException("启用日期必须比历史的启用日期大"); |
src/main/java/com/bsth/service/schedule/impl/EmployeeConfigInfoServiceImpl.java
| 1 | package com.bsth.service.schedule.impl; | 1 | package com.bsth.service.schedule.impl; |
| 2 | 2 | ||
| 3 | +import com.bsth.entity.Personnel; | ||
| 3 | import com.bsth.entity.schedule.EmployeeConfigInfo; | 4 | import com.bsth.entity.schedule.EmployeeConfigInfo; |
| 4 | import com.bsth.entity.schedule.rule.ScheduleRule1Flat; | 5 | import com.bsth.entity.schedule.rule.ScheduleRule1Flat; |
| 6 | +import com.bsth.entity.sys.CompanyAuthority; | ||
| 5 | import com.bsth.service.schedule.EmployeeConfigInfoService; | 7 | import com.bsth.service.schedule.EmployeeConfigInfoService; |
| 8 | +import com.bsth.service.schedule.EmployeeService; | ||
| 6 | import com.bsth.service.schedule.ScheduleRule1FlatService; | 9 | import com.bsth.service.schedule.ScheduleRule1FlatService; |
| 7 | import com.bsth.service.schedule.exception.ScheduleException; | 10 | import com.bsth.service.schedule.exception.ScheduleException; |
| 8 | import com.bsth.service.schedule.utils.DataToolsFile; | 11 | import com.bsth.service.schedule.utils.DataToolsFile; |
| @@ -28,6 +31,8 @@ import java.util.*; | @@ -28,6 +31,8 @@ import java.util.*; | ||
| 28 | public class EmployeeConfigInfoServiceImpl extends BServiceImpl<EmployeeConfigInfo, Long> implements EmployeeConfigInfoService { | 31 | public class EmployeeConfigInfoServiceImpl extends BServiceImpl<EmployeeConfigInfo, Long> implements EmployeeConfigInfoService { |
| 29 | @Autowired | 32 | @Autowired |
| 30 | private ScheduleRule1FlatService scheduleRule1FlatService; | 33 | private ScheduleRule1FlatService scheduleRule1FlatService; |
| 34 | + @Autowired | ||
| 35 | + private EmployeeService employeeService; | ||
| 31 | 36 | ||
| 32 | @Autowired | 37 | @Autowired |
| 33 | @Qualifier(value = "employeeConfig_dataTool") | 38 | @Qualifier(value = "employeeConfig_dataTool") |
| @@ -100,6 +105,69 @@ public class EmployeeConfigInfoServiceImpl extends BServiceImpl<EmployeeConfigIn | @@ -100,6 +105,69 @@ public class EmployeeConfigInfoServiceImpl extends BServiceImpl<EmployeeConfigIn | ||
| 100 | 105 | ||
| 101 | @Transactional | 106 | @Transactional |
| 102 | @Override | 107 | @Override |
| 108 | + public void validate_jsy_config(EmployeeConfigInfo employeeConfigInfo) throws ScheduleException { | ||
| 109 | + Map<String, Object> param = new HashMap<>(); | ||
| 110 | + param.put("xl.id_eq", employeeConfigInfo.getXl().getId()); | ||
| 111 | + param.put("jsy.id_eq", employeeConfigInfo.getJsy().getId()); | ||
| 112 | + List<EmployeeConfigInfo> employeeConfigInfos = list(param); | ||
| 113 | + if (CollectionUtils.isEmpty(employeeConfigInfos)) { | ||
| 114 | + throw new ScheduleException("驾驶员没有配置在当前线路中,不属于当前线路!"); | ||
| 115 | + } | ||
| 116 | + } | ||
| 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 | + | ||
| 169 | + @Transactional | ||
| 170 | + @Override | ||
| 103 | public void validate_spy(EmployeeConfigInfo employeeConfigInfo) throws ScheduleException { | 171 | public void validate_spy(EmployeeConfigInfo employeeConfigInfo) throws ScheduleException { |
| 104 | // 售票员不能重复配置 | 172 | // 售票员不能重复配置 |
| 105 | Map<String, Object> param = new HashMap<>(); | 173 | Map<String, Object> param = new HashMap<>(); |
| @@ -125,6 +193,69 @@ public class EmployeeConfigInfoServiceImpl extends BServiceImpl<EmployeeConfigIn | @@ -125,6 +193,69 @@ public class EmployeeConfigInfoServiceImpl extends BServiceImpl<EmployeeConfigIn | ||
| 125 | } | 193 | } |
| 126 | } | 194 | } |
| 127 | 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 | + | ||
| 247 | + @Transactional | ||
| 248 | + @Override | ||
| 249 | + public void validate_spy_config(EmployeeConfigInfo employeeConfigInfo) throws ScheduleException { | ||
| 250 | + Map<String, Object> param = new HashMap<>(); | ||
| 251 | + param.put("xl.id_eq", employeeConfigInfo.getXl().getId()); | ||
| 252 | + param.put("spy.id_eq", employeeConfigInfo.getSpy().getId()); | ||
| 253 | + List<EmployeeConfigInfo> employeeConfigInfos = list(param); | ||
| 254 | + if (CollectionUtils.isEmpty(employeeConfigInfos)) { | ||
| 255 | + throw new ScheduleException("售票员没有配置在当前线路中,不属于当前线路!"); | ||
| 256 | + } | ||
| 257 | + } | ||
| 258 | + | ||
| 128 | @Transactional | 259 | @Transactional |
| 129 | @Override | 260 | @Override |
| 130 | public void delete(Long aLong) throws ScheduleException { | 261 | public void delete(Long aLong) throws ScheduleException { |
src/main/java/com/bsth/service/schedule/impl/PeopleCarPlanServiceImpl.java
| @@ -26,6 +26,7 @@ import com.bsth.data.BasicData; | @@ -26,6 +26,7 @@ import com.bsth.data.BasicData; | ||
| 26 | import com.bsth.entity.realcontrol.ScheduleRealInfo; | 26 | import com.bsth.entity.realcontrol.ScheduleRealInfo; |
| 27 | import com.bsth.entity.schedule.SchedulePlanInfo; | 27 | import com.bsth.entity.schedule.SchedulePlanInfo; |
| 28 | import com.bsth.repository.realcontrol.ScheduleRealInfoRepository; | 28 | import com.bsth.repository.realcontrol.ScheduleRealInfoRepository; |
| 29 | +import com.bsth.service.LineService; | ||
| 29 | import com.bsth.service.schedule.PeopleCarPlanService; | 30 | import com.bsth.service.schedule.PeopleCarPlanService; |
| 30 | import com.bsth.util.ReportUtils; | 31 | import com.bsth.util.ReportUtils; |
| 31 | 32 | ||
| @@ -36,6 +37,9 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService { | @@ -36,6 +37,9 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService { | ||
| 36 | private ScheduleRealInfoRepository scheduleRealInfoRepository; | 37 | private ScheduleRealInfoRepository scheduleRealInfoRepository; |
| 37 | 38 | ||
| 38 | @Autowired | 39 | @Autowired |
| 40 | + private LineService lineService; | ||
| 41 | + | ||
| 42 | + @Autowired | ||
| 39 | private JdbcTemplate jdbcTemplate; | 43 | private JdbcTemplate jdbcTemplate; |
| 40 | 44 | ||
| 41 | public List<ScheduleRealInfo> getSchedule(String company, String subCompany, String line, String date){ | 45 | public List<ScheduleRealInfo> getSchedule(String company, String subCompany, String line, String date){ |
| @@ -47,7 +51,11 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService { | @@ -47,7 +51,11 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService { | ||
| 47 | if(line.length() != 0) | 51 | if(line.length() != 0) |
| 48 | sql += " and xl_bm = '"+line+"'"; | 52 | sql += " and xl_bm = '"+line+"'"; |
| 49 | if(company.length() != 0) | 53 | if(company.length() != 0) |
| 50 | - sql += " and gs_bm = '"+company+"' and fgs_bm = '"+subCompany+"'"; | 54 | + sql += " and gs_bm = '"+company+"'"; |
| 55 | + if(subCompany.length() != 0) | ||
| 56 | + sql += " and fgs_bm = '"+subCompany+"'"; | ||
| 57 | + | ||
| 58 | + sql += " order by gs_bm, fgs_bm, xl_bm"; | ||
| 51 | 59 | ||
| 52 | list = jdbcTemplate.query(sql, | 60 | list = jdbcTemplate.query(sql, |
| 53 | new RowMapper<ScheduleRealInfo>(){ | 61 | new RowMapper<ScheduleRealInfo>(){ |
| @@ -56,6 +64,7 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService { | @@ -56,6 +64,7 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService { | ||
| 56 | ScheduleRealInfo schedule = new ScheduleRealInfo(); | 64 | ScheduleRealInfo schedule = new ScheduleRealInfo(); |
| 57 | schedule.setScheduleDateStr(rs.getString("schedule_date_str")); | 65 | schedule.setScheduleDateStr(rs.getString("schedule_date_str")); |
| 58 | schedule.setRealExecDate(rs.getString("real_exec_date")); | 66 | schedule.setRealExecDate(rs.getString("real_exec_date")); |
| 67 | + schedule.setXlBm(rs.getString("xl_bm")); | ||
| 59 | schedule.setXlName(rs.getString("xl_name")); | 68 | schedule.setXlName(rs.getString("xl_name")); |
| 60 | schedule.setLpName(rs.getString("lp_name")); | 69 | schedule.setLpName(rs.getString("lp_name")); |
| 61 | schedule.setBcType(rs.getString("bc_type")); | 70 | schedule.setBcType(rs.getString("bc_type")); |
| @@ -170,15 +179,11 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService { | @@ -170,15 +179,11 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService { | ||
| 170 | List<Map<String, Object>> resList = new ArrayList<Map<String, Object>>(); | 179 | List<Map<String, Object>> resList = new ArrayList<Map<String, Object>>(); |
| 171 | List<Map<String, Object>> mapList = new ArrayList<Map<String, Object>>(); | 180 | List<Map<String, Object>> mapList = new ArrayList<Map<String, Object>>(); |
| 172 | 181 | ||
| 173 | - String company = ""; | ||
| 174 | - String subCompany =""; | ||
| 175 | - if(map.get("company")!=null){ | ||
| 176 | - company = map.get("company").toString(); | ||
| 177 | - } | ||
| 178 | - | ||
| 179 | - if(map.get("subCompany")!=null){ | 182 | + String company = "", subCompany =""; |
| 183 | + if(map.get("company")!=null) | ||
| 184 | + company = map.get("company").toString(); | ||
| 185 | + if(map.get("subCompany")!=null) | ||
| 180 | subCompany = map.get("subCompany").toString(); | 186 | subCompany = map.get("subCompany").toString(); |
| 181 | - } | ||
| 182 | String line = map.get("line").toString(); | 187 | String line = map.get("line").toString(); |
| 183 | String date = map.get("date").toString(); | 188 | String date = map.get("date").toString(); |
| 184 | String type = map.get("type").toString(); | 189 | String type = map.get("type").toString(); |
| @@ -193,9 +198,10 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService { | @@ -193,9 +198,10 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService { | ||
| 193 | if(line.length() != 0){ | 198 | if(line.length() != 0){ |
| 194 | sql += " and xl_bm = '"+line+"'"; | 199 | sql += " and xl_bm = '"+line+"'"; |
| 195 | } | 200 | } |
| 196 | - if(company.length() != 0){ | ||
| 197 | - sql += " and gs_bm = '"+company+"' and fgs_bm = '"+subCompany+"'"; | ||
| 198 | - } | 201 | + if(company.length() != 0) |
| 202 | + sql += " and gs_bm = '"+company+"'"; | ||
| 203 | + if(subCompany.length() != 0) | ||
| 204 | + sql += " and fgs_bm = '"+subCompany+"'"; | ||
| 199 | 205 | ||
| 200 | list = jdbcTemplate.query(sql, | 206 | list = jdbcTemplate.query(sql, |
| 201 | new RowMapper<SchedulePlanInfo>(){ | 207 | new RowMapper<SchedulePlanInfo>(){ |
| @@ -322,8 +328,13 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService { | @@ -322,8 +328,13 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService { | ||
| 322 | Set<String> lineSet = getNotOperation(); | 328 | Set<String> lineSet = getNotOperation(); |
| 323 | DecimalFormat df = new DecimalFormat("###0.##"); | 329 | DecimalFormat df = new DecimalFormat("###0.##"); |
| 324 | 330 | ||
| 325 | - String company = map.get("company").toString(); | ||
| 326 | - String subCompany = map.get("subCompany").toString(); | 331 | + String sfyy = "", company = "", subCompany = ""; |
| 332 | + if(map.get("sfyy")!=null) | ||
| 333 | + sfyy = map.get("sfyy").toString(); | ||
| 334 | + if(map.get("company")!=null) | ||
| 335 | + company = map.get("company").toString(); | ||
| 336 | + if(map.get("subCompany")!=null) | ||
| 337 | + subCompany = map.get("subCompany").toString(); | ||
| 327 | String line = map.get("line").toString(); | 338 | String line = map.get("line").toString(); |
| 328 | String date = map.get("date").toString(); | 339 | String date = map.get("date").toString(); |
| 329 | String type = map.get("type").toString(); | 340 | String type = map.get("type").toString(); |
| @@ -332,9 +343,27 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService { | @@ -332,9 +343,27 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService { | ||
| 332 | date = new SimpleDateFormat("yyyy-MM-dd").format(new Date()); | 343 | date = new SimpleDateFormat("yyyy-MM-dd").format(new Date()); |
| 333 | } | 344 | } |
| 334 | 345 | ||
| 335 | - List<ScheduleRealInfo> list = this.getSchedule(company, subCompany, line, date); | 346 | + List<ScheduleRealInfo> schedules = this.getSchedule(company, subCompany, line, date); |
| 347 | + Map<String, Boolean> lineNature = lineService.lineNature(); | ||
| 336 | 348 | ||
| 349 | + List<ScheduleRealInfo> list = new ArrayList<ScheduleRealInfo>(); | ||
| 337 | Map<String, List<ScheduleRealInfo>> keyMap = new HashMap<String, List<ScheduleRealInfo>>(); | 350 | Map<String, List<ScheduleRealInfo>> keyMap = new HashMap<String, List<ScheduleRealInfo>>(); |
| 351 | + | ||
| 352 | + //是否营运 | ||
| 353 | + for(ScheduleRealInfo schedule : schedules){ | ||
| 354 | + String xlbm = schedule.getXlBm(); | ||
| 355 | + if(sfyy.length() == 0 || sfyy.equals("0")){ | ||
| 356 | + list.add(schedule); | ||
| 357 | + } else if(sfyy.equals("1")){ | ||
| 358 | + if(lineNature.containsKey(xlbm) && lineNature.get(xlbm)){ | ||
| 359 | + list.add(schedule); | ||
| 360 | + } | ||
| 361 | + } else { | ||
| 362 | + if(lineNature.containsKey(xlbm) && !lineNature.get(xlbm)){ | ||
| 363 | + list.add(schedule); | ||
| 364 | + } | ||
| 365 | + } | ||
| 366 | + } | ||
| 338 | for(ScheduleRealInfo schedule : list){ | 367 | for(ScheduleRealInfo schedule : list){ |
| 339 | String key = schedule.getXlName(); | 368 | String key = schedule.getXlName(); |
| 340 | if(key == null || key.trim().equals("") || lineSet.contains(key)) | 369 | if(key == null || key.trim().equals("") || lineSet.contains(key)) |
| @@ -573,16 +602,19 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService { | @@ -573,16 +602,19 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService { | ||
| 573 | } | 602 | } |
| 574 | try { | 603 | try { |
| 575 | 604 | ||
| 576 | - String sql = "select schedule_date_str,xl_name,bc_type,gs_name,fgs_name,bcs,fcno," | ||
| 577 | - +"fcsj,fcsj_actual,zdsj,zdsj_actual,bcsj,qdz_name,sp_id,cc_service" | 605 | + String sql = "select schedule_date_str,xl_name,bc_type,gs_name,fgs_name,fgs_bm,bcs," |
| 606 | + +"fcno,fcsj,fcsj_actual,zdsj,zdsj_actual,bcsj,qdz_name,sp_id,cc_service" | ||
| 578 | +" from bsth_c_s_sp_info_real where schedule_date_str >= '"+startDate | 607 | +" from bsth_c_s_sp_info_real where schedule_date_str >= '"+startDate |
| 579 | +"' and schedule_date_str <= '"+endDate+"'"; | 608 | +"' and schedule_date_str <= '"+endDate+"'"; |
| 580 | if(line.length() != 0){ | 609 | if(line.length() != 0){ |
| 581 | sql += " and xl_bm = '"+line+"'"; | 610 | sql += " and xl_bm = '"+line+"'"; |
| 582 | } | 611 | } |
| 583 | -// if(company.length() != 0){ | ||
| 584 | - sql += " and gs_bm like '%"+company+"%' and fgs_bm like '%"+subCompany+"%'"; | ||
| 585 | -// } | 612 | + if(company.length() != 0){ |
| 613 | + sql += " and gs_bm = '"+company+"'"; | ||
| 614 | + } | ||
| 615 | + if(subCompany.length() != 0){ | ||
| 616 | + sql += " and fgs_bm = '"+subCompany+"'"; | ||
| 617 | + } | ||
| 586 | sql += " and bc_type != 'in' and bc_type != 'out' and bc_type != 'ldks'"; | 618 | sql += " and bc_type != 'in' and bc_type != 'out' and bc_type != 'ldks'"; |
| 587 | if(Integer.valueOf(bcType) == 1){ | 619 | if(Integer.valueOf(bcType) == 1){ |
| 588 | sql += " and bc_type != 'region'"; | 620 | sql += " and bc_type != 'region'"; |
| @@ -599,6 +631,7 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService { | @@ -599,6 +631,7 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService { | ||
| 599 | schedule.setBcType(rs.getString("bc_type")); | 631 | schedule.setBcType(rs.getString("bc_type")); |
| 600 | schedule.setGsName(rs.getString("gs_name")); | 632 | schedule.setGsName(rs.getString("gs_name")); |
| 601 | schedule.setFgsName(rs.getString("fgs_name")); | 633 | schedule.setFgsName(rs.getString("fgs_name")); |
| 634 | + schedule.setFgsBm(rs.getString("fgs_bm")); | ||
| 602 | schedule.setBcs(rs.getInt("bcs")); | 635 | schedule.setBcs(rs.getInt("bcs")); |
| 603 | schedule.setFcno(rs.getInt("fcno")); | 636 | schedule.setFcno(rs.getInt("fcno")); |
| 604 | schedule.setFcsj(rs.getString("fcsj")); | 637 | schedule.setFcsj(rs.getString("fcsj")); |
| @@ -676,22 +709,23 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService { | @@ -676,22 +709,23 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService { | ||
| 676 | if(schedule.isCcService()){ | 709 | if(schedule.isCcService()){ |
| 677 | continue; | 710 | continue; |
| 678 | } | 711 | } |
| 712 | + | ||
| 713 | + String key = schedule.getXlName()+"/"+schedule.getQdzName()+"/"+schedule.getFcsj()+"/"+schedule.getFgsBm(); | ||
| 679 | if(model.length() != 0){ | 714 | if(model.length() != 0){ |
| 680 | if(ttSet.contains(schedule.getSpId())){ | 715 | if(ttSet.contains(schedule.getSpId())){ |
| 681 | - String key = schedule.getXlName()+"/"+schedule.getQdzName()+"/"+schedule.getFcsj(); | ||
| 682 | if(!keyMap.containsKey(key)) | 716 | if(!keyMap.containsKey(key)) |
| 683 | keyMap.put(key, new ArrayList<ScheduleRealInfo>()); | 717 | keyMap.put(key, new ArrayList<ScheduleRealInfo>()); |
| 684 | keyMap.get(key).add(schedule); | 718 | keyMap.get(key).add(schedule); |
| 685 | } | 719 | } |
| 686 | } else { | 720 | } else { |
| 687 | - String key = schedule.getXlName()+"/"+schedule.getQdzName()+"/"+schedule.getFcsj(); | ||
| 688 | - if(!keyMap.containsKey(key)) | 721 | + if(!keyMap.containsKey(key)){ |
| 689 | keyMap.put(key, new ArrayList<ScheduleRealInfo>()); | 722 | keyMap.put(key, new ArrayList<ScheduleRealInfo>()); |
| 723 | + } | ||
| 690 | keyMap.get(key).add(schedule); | 724 | keyMap.get(key).add(schedule); |
| 691 | } | 725 | } |
| 692 | } | 726 | } |
| 693 | - String companyName = "", subCompanyName = ""; | ||
| 694 | for(String key : keyMap.keySet()){ | 727 | for(String key : keyMap.keySet()){ |
| 728 | + String companyName = "", subCompanyName = ""; | ||
| 695 | Map<String, Object> tempMap = new HashMap<String, Object>(); | 729 | Map<String, Object> tempMap = new HashMap<String, Object>(); |
| 696 | List<Integer> fcsj = new ArrayList<Integer>(); | 730 | List<Integer> fcsj = new ArrayList<Integer>(); |
| 697 | List<Integer> yssj = new ArrayList<Integer>(); | 731 | List<Integer> yssj = new ArrayList<Integer>(); |
| @@ -777,7 +811,7 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService { | @@ -777,7 +811,7 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService { | ||
| 777 | Map<String, List<Map<String, Object>>> listMap = new HashMap<String, List<Map<String, Object>>>(); | 811 | Map<String, List<Map<String, Object>>> listMap = new HashMap<String, List<Map<String, Object>>>(); |
| 778 | Map<String, List<Map<String, Object>>> listMap2 = new HashMap<String, List<Map<String, Object>>>(); | 812 | Map<String, List<Map<String, Object>>> listMap2 = new HashMap<String, List<Map<String, Object>>>(); |
| 779 | for(Map<String, Object> m : tempList){ | 813 | for(Map<String, Object> m : tempList){ |
| 780 | - String key = m.get("line").toString() + m.get("qdz"); | 814 | + String key = m.get("line").toString() + m.get("qdz") + m.get("subCompany"); |
| 781 | if(!listMap.containsKey(key)) | 815 | if(!listMap.containsKey(key)) |
| 782 | listMap.put(key, new ArrayList<Map<String, Object>>()); | 816 | listMap.put(key, new ArrayList<Map<String, Object>>()); |
| 783 | listMap.get(key).add(m); | 817 | listMap.get(key).add(m); |
| @@ -889,9 +923,12 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService { | @@ -889,9 +923,12 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService { | ||
| 889 | if(nbbm.length() != 0){ | 923 | if(nbbm.length() != 0){ |
| 890 | sql += " and cl_zbh like '%"+nbbm+"%'"; | 924 | sql += " and cl_zbh like '%"+nbbm+"%'"; |
| 891 | } | 925 | } |
| 892 | -// if(company.length() != 0){ | ||
| 893 | - sql += " and gs_bm like '%"+company+"%' and fgs_bm like '%"+subCompany+"%'"; | ||
| 894 | -// } | 926 | + if(company.length() != 0){ |
| 927 | + sql += " and gs_bm like '"+company+"'"; | ||
| 928 | + } | ||
| 929 | + if(subCompany.length() != 0){ | ||
| 930 | + sql += " and fgs_bm like '"+subCompany+"'"; | ||
| 931 | + } | ||
| 895 | sql += " and bc_type != 'in' and bc_type != 'out' and bc_type != 'ldks'"; | 932 | sql += " and bc_type != 'in' and bc_type != 'out' and bc_type != 'ldks'"; |
| 896 | if(bcType.trim().equals("1")){ | 933 | if(bcType.trim().equals("1")){ |
| 897 | sql += " and bc_type != 'region'"; | 934 | sql += " and bc_type != 'region'"; |
| @@ -1209,10 +1246,13 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService { | @@ -1209,10 +1246,13 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService { | ||
| 1209 | List<ScheduleRealInfo> list = new ArrayList<ScheduleRealInfo>(); | 1246 | List<ScheduleRealInfo> list = new ArrayList<ScheduleRealInfo>(); |
| 1210 | List<Map<String, Object>> resList = new ArrayList<Map<String, Object>>(); | 1247 | List<Map<String, Object>> resList = new ArrayList<Map<String, Object>>(); |
| 1211 | 1248 | ||
| 1212 | - Set<String> lineSet = getNotOperation(); | ||
| 1213 | - | ||
| 1214 | - String company = map.get("company").toString(); | ||
| 1215 | - String subCompany = map.get("subCompany").toString(); | 1249 | + String sfyy = "", company = "", subCompany = ""; |
| 1250 | + if(map.get("sfyy")!=null) | ||
| 1251 | + sfyy = map.get("sfyy").toString(); | ||
| 1252 | + if(map.get("company")!=null) | ||
| 1253 | + company = map.get("company").toString(); | ||
| 1254 | + if(map.get("subCompany")!=null) | ||
| 1255 | + subCompany = map.get("subCompany").toString(); | ||
| 1216 | String line = map.get("line").toString(); | 1256 | String line = map.get("line").toString(); |
| 1217 | String date = map.get("date").toString(); | 1257 | String date = map.get("date").toString(); |
| 1218 | String type = map.get("type").toString(); | 1258 | String type = map.get("type").toString(); |
| @@ -1222,13 +1262,15 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService { | @@ -1222,13 +1262,15 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService { | ||
| 1222 | 1262 | ||
| 1223 | try { | 1263 | try { |
| 1224 | String sql = "select a.schedule_date_str, a.real_exec_date, a.xl_name, a.fcsj, a.fcsj_actual, a.zdsj, a.zdsj_actual, a.qdz_name, a.zdz_name, a.xl_dir, a.status, a.gs_name, a.fgs_name," | 1264 | String sql = "select a.schedule_date_str, a.real_exec_date, a.xl_name, a.fcsj, a.fcsj_actual, a.zdsj, a.zdsj_actual, a.qdz_name, a.zdz_name, a.xl_dir, a.status, a.gs_name, a.fgs_name," |
| 1225 | - + " a.cc_service, b.start_opt from bsth_c_s_sp_info_real a left join (select line, start_opt from bsth_c_line_config order by id desc) b on a.xl_bm = b.line" | 1265 | + + " a.xl_bm, a.fgs_bm, a.cc_service, b.start_opt from bsth_c_s_sp_info_real a left join (select line, start_opt from bsth_c_line_config order by id desc) b on a.xl_bm = b.line" |
| 1226 | + " where schedule_date_str = '"+date+"'" | 1266 | + " where schedule_date_str = '"+date+"'" |
| 1227 | + " and bc_type != 'in' and bc_type != 'out' and bc_type != 'ldks' and bc_type != 'region'"; | 1267 | + " and bc_type != 'in' and bc_type != 'out' and bc_type != 'ldks' and bc_type != 'region'"; |
| 1228 | if(line.trim().length() != 0) | 1268 | if(line.trim().length() != 0) |
| 1229 | sql += " and xl_bm = '"+line+"'"; | 1269 | sql += " and xl_bm = '"+line+"'"; |
| 1230 | - else if(company.length() != 0) | ||
| 1231 | - sql += " and gs_bm = '"+company+"' and fgs_bm = '"+subCompany+"'"; | 1270 | + if(company.length() != 0) |
| 1271 | + sql += " and gs_bm = '"+company+"'"; | ||
| 1272 | + if(subCompany.length() != 0) | ||
| 1273 | + sql += " and fgs_bm = '"+subCompany+"'"; | ||
| 1232 | 1274 | ||
| 1233 | list = jdbcTemplate.query(sql, | 1275 | list = jdbcTemplate.query(sql, |
| 1234 | new RowMapper<ScheduleRealInfo>(){ | 1276 | new RowMapper<ScheduleRealInfo>(){ |
| @@ -1238,6 +1280,7 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService { | @@ -1238,6 +1280,7 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService { | ||
| 1238 | schedule.setScheduleDateStr(rs.getString("schedule_date_str")); | 1280 | schedule.setScheduleDateStr(rs.getString("schedule_date_str")); |
| 1239 | schedule.setRealExecDate(rs.getString("real_exec_date")); | 1281 | schedule.setRealExecDate(rs.getString("real_exec_date")); |
| 1240 | schedule.setXlName(rs.getString("xl_name")); | 1282 | schedule.setXlName(rs.getString("xl_name")); |
| 1283 | + schedule.setXlBm(rs.getString("xl_Bm")); | ||
| 1241 | schedule.setFcsj(rs.getString("fcsj")); | 1284 | schedule.setFcsj(rs.getString("fcsj")); |
| 1242 | schedule.setFcsjActual(rs.getString("fcsj_actual")); | 1285 | schedule.setFcsjActual(rs.getString("fcsj_actual")); |
| 1243 | schedule.setZdsj(rs.getString("zdsj")); | 1286 | schedule.setZdsj(rs.getString("zdsj")); |
| @@ -1248,6 +1291,7 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService { | @@ -1248,6 +1291,7 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService { | ||
| 1248 | schedule.setStatus(rs.getInt("status")); | 1291 | schedule.setStatus(rs.getInt("status")); |
| 1249 | schedule.setGsName(rs.getString("gs_name")); | 1292 | schedule.setGsName(rs.getString("gs_name")); |
| 1250 | schedule.setFgsName(rs.getString("fgs_name")); | 1293 | schedule.setFgsName(rs.getString("fgs_name")); |
| 1294 | + schedule.setFgsBm(rs.getString("fgs_bm")); | ||
| 1251 | schedule.setCcService(rs.getBoolean("cc_service")); | 1295 | schedule.setCcService(rs.getBoolean("cc_service")); |
| 1252 | 1296 | ||
| 1253 | int startOpt = 0; | 1297 | int startOpt = 0; |
| @@ -1287,26 +1331,54 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService { | @@ -1287,26 +1331,54 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService { | ||
| 1287 | } | 1331 | } |
| 1288 | 1332 | ||
| 1289 | Map<String, List<ScheduleRealInfo>> keyMap = new HashMap<String, List<ScheduleRealInfo>>(); | 1333 | Map<String, List<ScheduleRealInfo>> keyMap = new HashMap<String, List<ScheduleRealInfo>>(); |
| 1290 | - String companyName = "", subCompanyName = ""; | 1334 | + Map<String, Boolean> lineNature = lineService.lineNature(); |
| 1291 | 1335 | ||
| 1292 | for(ScheduleRealInfo s : list){ | 1336 | for(ScheduleRealInfo s : list){ |
| 1293 | - if(lineSet.contains(s.getXlName()) || s.isCcService()){ | 1337 | + if(s.isCcService()){ |
| 1294 | continue; | 1338 | continue; |
| 1295 | } | 1339 | } |
| 1296 | - String xlName = s.getXlName(); | ||
| 1297 | - if(!keyMap.containsKey(xlName)) | ||
| 1298 | - keyMap.put(xlName, new ArrayList<ScheduleRealInfo>()); | ||
| 1299 | - keyMap.get(xlName).add(s); | ||
| 1300 | - if(companyName.length()==0&&s.getGsName()!=null&&s.getGsName().trim().length()!=0) | ||
| 1301 | - companyName = s.getGsName(); | ||
| 1302 | - if(subCompanyName.length()==0&&s.getFgsName()!=null&&s.getFgsName().trim().length()!=0) | ||
| 1303 | - subCompanyName = s.getFgsName(); | 1340 | + |
| 1341 | + String xlbm = s.getXlBm(); | ||
| 1342 | + boolean flag = false; | ||
| 1343 | + if(sfyy.length() == 0 || sfyy.equals("0")){ | ||
| 1344 | + flag = true; | ||
| 1345 | + } else if(sfyy.equals("1")){ | ||
| 1346 | + if(lineNature.containsKey(xlbm) && lineNature.get(xlbm)){ | ||
| 1347 | + flag = true; | ||
| 1348 | + } | ||
| 1349 | + } else { | ||
| 1350 | + if(lineNature.containsKey(xlbm) && !lineNature.get(xlbm)){ | ||
| 1351 | + flag = true; | ||
| 1352 | + } | ||
| 1353 | + } | ||
| 1354 | + if(!flag){ | ||
| 1355 | + continue; | ||
| 1356 | + } | ||
| 1357 | + | ||
| 1358 | + String key = s.getXlName() + "/" + s.getXlBm() + "/" + s.getFgsBm(); | ||
| 1359 | + if(!keyMap.containsKey(key)){ | ||
| 1360 | + keyMap.put(key, new ArrayList<ScheduleRealInfo>()); | ||
| 1361 | + } | ||
| 1362 | + keyMap.get(key).add(s); | ||
| 1304 | } | 1363 | } |
| 1305 | 1364 | ||
| 1306 | - for(String xlName : keyMap.keySet()){ | 1365 | + //给key排序 |
| 1366 | + List<Long> longList = new ArrayList<Long>(); | ||
| 1367 | + Map<Long, String> longMap = new HashMap<Long, String>(); | ||
| 1368 | + for(String key : keyMap.keySet()){ | ||
| 1369 | + String[] keys = key.split("/"); | ||
| 1370 | + Long l = Long.valueOf(keys[2]) * 10000000000l + Long.valueOf(keys[1]); | ||
| 1371 | + longMap.put(l, key); | ||
| 1372 | + longList.add(l); | ||
| 1373 | + } | ||
| 1374 | + Collections.sort(longList); | ||
| 1375 | + | ||
| 1376 | + for(Long l : longList){ | ||
| 1377 | + String key = longMap.get(l); | ||
| 1307 | Map<String, Object> tempMap = new HashMap<String, Object>(); | 1378 | Map<String, Object> tempMap = new HashMap<String, Object>(); |
| 1379 | + String[] keys = key.split("/"); | ||
| 1308 | tempMap.put("date", date.substring(5)); | 1380 | tempMap.put("date", date.substring(5)); |
| 1309 | - tempMap.put("line", xlName); | 1381 | + tempMap.put("line", keys[0]); |
| 1310 | List<Long> up1 = new ArrayList<Long>(); | 1382 | List<Long> up1 = new ArrayList<Long>(); |
| 1311 | List<Long> up2 = new ArrayList<Long>(); | 1383 | List<Long> up2 = new ArrayList<Long>(); |
| 1312 | List<Long> dn1 = new ArrayList<Long>(); | 1384 | List<Long> dn1 = new ArrayList<Long>(); |
| @@ -1315,7 +1387,12 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService { | @@ -1315,7 +1387,12 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService { | ||
| 1315 | Map<Long, ScheduleRealInfo> up2Map = new HashMap<Long, ScheduleRealInfo>(); | 1387 | Map<Long, ScheduleRealInfo> up2Map = new HashMap<Long, ScheduleRealInfo>(); |
| 1316 | Map<Long, ScheduleRealInfo> dn1Map = new HashMap<Long, ScheduleRealInfo>(); | 1388 | Map<Long, ScheduleRealInfo> dn1Map = new HashMap<Long, ScheduleRealInfo>(); |
| 1317 | Map<Long, ScheduleRealInfo> dn2Map = new HashMap<Long, ScheduleRealInfo>(); | 1389 | Map<Long, ScheduleRealInfo> dn2Map = new HashMap<Long, ScheduleRealInfo>(); |
| 1318 | - for(ScheduleRealInfo s : keyMap.get(xlName)){ | 1390 | + String companyName = "", subCompanyName = ""; |
| 1391 | + for(ScheduleRealInfo s : keyMap.get(key)){ | ||
| 1392 | + if(companyName.length()==0&&s.getGsName()!=null&&s.getGsName().trim().length()!=0) | ||
| 1393 | + companyName = s.getGsName(); | ||
| 1394 | + if(subCompanyName.length()==0&&s.getFgsName()!=null&&s.getFgsName().trim().length()!=0) | ||
| 1395 | + subCompanyName = s.getFgsName(); | ||
| 1319 | if(s.getXlDir().equals("0")){ | 1396 | if(s.getXlDir().equals("0")){ |
| 1320 | up1.add(s.getFcsjT()); | 1397 | up1.add(s.getFcsjT()); |
| 1321 | up1Map.put(s.getFcsjT(), s); | 1398 | up1Map.put(s.getFcsjT(), s); |
| @@ -1389,7 +1466,7 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService { | @@ -1389,7 +1466,7 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService { | ||
| 1389 | tempMap.put("company", companyName); | 1466 | tempMap.put("company", companyName); |
| 1390 | tempMap.put("subCompany", subCompanyName); | 1467 | tempMap.put("subCompany", subCompanyName); |
| 1391 | tempMap.put("date", date); | 1468 | tempMap.put("date", date); |
| 1392 | - tempMap.put("line", xlName); | 1469 | + tempMap.put("line", keys[0]); |
| 1393 | resList.add(tempMap); | 1470 | resList.add(tempMap); |
| 1394 | } | 1471 | } |
| 1395 | 1472 | ||
| @@ -1425,10 +1502,13 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService { | @@ -1425,10 +1502,13 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService { | ||
| 1425 | List<ScheduleRealInfo> list = new ArrayList<ScheduleRealInfo>(); | 1502 | List<ScheduleRealInfo> list = new ArrayList<ScheduleRealInfo>(); |
| 1426 | List<Map<String, Object>> resList = new ArrayList<Map<String, Object>>(); | 1503 | List<Map<String, Object>> resList = new ArrayList<Map<String, Object>>(); |
| 1427 | 1504 | ||
| 1428 | - Set<String> lineSet = getNotOperation(); | ||
| 1429 | - | ||
| 1430 | - String company = map.get("company").toString(); | ||
| 1431 | - String subCompany = map.get("subCompany").toString(); | 1505 | + String sfyy = "", company = "", subCompany = ""; |
| 1506 | + if(map.get("sfyy")!=null) | ||
| 1507 | + sfyy = map.get("sfyy").toString(); | ||
| 1508 | + if(map.get("company")!=null) | ||
| 1509 | + company = map.get("company").toString(); | ||
| 1510 | + if(map.get("subCompany")!=null) | ||
| 1511 | + subCompany = map.get("subCompany").toString(); | ||
| 1432 | String line = map.get("line").toString(); | 1512 | String line = map.get("line").toString(); |
| 1433 | // String date = map.get("date").toString(); | 1513 | // String date = map.get("date").toString(); |
| 1434 | String startDate = map.get("startDate").toString(); | 1514 | String startDate = map.get("startDate").toString(); |
| @@ -1453,13 +1533,16 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService { | @@ -1453,13 +1533,16 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService { | ||
| 1453 | 1533 | ||
| 1454 | try { | 1534 | try { |
| 1455 | String sql = "select a.schedule_date_str, a.real_exec_date, a.xl_bm, a.xl_name, a.fcsj, a.fcsj_actual, a.zdsj, a.zdsj_actual, a.qdz_name, a.zdz_name, a.xl_dir, a.status, a.gs_name, a.fgs_name," | 1535 | String sql = "select a.schedule_date_str, a.real_exec_date, a.xl_bm, a.xl_name, a.fcsj, a.fcsj_actual, a.zdsj, a.zdsj_actual, a.qdz_name, a.zdz_name, a.xl_dir, a.status, a.gs_name, a.fgs_name," |
| 1456 | - + " a.cc_service, a.remarks, a.adjust_exps, b.start_opt from bsth_c_s_sp_info_real a left join (select line, start_opt from bsth_c_line_config order by id desc) b on a.xl_bm = b.line" | 1536 | + + " a.fgs_bm, a.cc_service, a.remarks, a.adjust_exps, b.start_opt from bsth_c_s_sp_info_real a left join (select line, start_opt from bsth_c_line_config order by id desc) b " |
| 1537 | + + " on a.xl_bm = b.line" | ||
| 1457 | + " where schedule_date_str >= '"+startDate+"' and schedule_date_str <= '"+endDate+"'" | 1538 | + " where schedule_date_str >= '"+startDate+"' and schedule_date_str <= '"+endDate+"'" |
| 1458 | + " and bc_type != 'in' and bc_type != 'out' and bc_type != 'ldks' and bc_type != 'region'"; | 1539 | + " and bc_type != 'in' and bc_type != 'out' and bc_type != 'ldks' and bc_type != 'region'"; |
| 1459 | if(line.length() != 0) | 1540 | if(line.length() != 0) |
| 1460 | sql += " and xl_bm = '"+line+"'"; | 1541 | sql += " and xl_bm = '"+line+"'"; |
| 1461 | if(company.length() != 0) | 1542 | if(company.length() != 0) |
| 1462 | - sql += " and gs_bm = '"+company+"' and fgs_bm = '"+subCompany+"'"; | 1543 | + sql += " and gs_bm = '"+company+"'"; |
| 1544 | + if(subCompany.length() != 0) | ||
| 1545 | + sql += " and fgs_bm = '"+subCompany+"'"; | ||
| 1463 | 1546 | ||
| 1464 | list = jdbcTemplate.query(sql, | 1547 | list = jdbcTemplate.query(sql, |
| 1465 | new RowMapper<ScheduleRealInfo>(){ | 1548 | new RowMapper<ScheduleRealInfo>(){ |
| @@ -1480,6 +1563,7 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService { | @@ -1480,6 +1563,7 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService { | ||
| 1480 | schedule.setStatus(rs.getInt("status")); | 1563 | schedule.setStatus(rs.getInt("status")); |
| 1481 | schedule.setGsName(rs.getString("gs_name")); | 1564 | schedule.setGsName(rs.getString("gs_name")); |
| 1482 | schedule.setFgsName(rs.getString("fgs_name")); | 1565 | schedule.setFgsName(rs.getString("fgs_name")); |
| 1566 | + schedule.setFgsBm(rs.getString("fgs_bm")); | ||
| 1483 | schedule.setCcService(rs.getBoolean("cc_service")); | 1567 | schedule.setCcService(rs.getBoolean("cc_service")); |
| 1484 | schedule.setRemarks(rs.getString("remarks")!=null?rs.getString("remarks"):""); | 1568 | schedule.setRemarks(rs.getString("remarks")!=null?rs.getString("remarks"):""); |
| 1485 | schedule.setAdjustExps(rs.getString("adjust_exps")!=null?rs.getString("adjust_exps"):""); | 1569 | schedule.setAdjustExps(rs.getString("adjust_exps")!=null?rs.getString("adjust_exps"):""); |
| @@ -1520,36 +1604,67 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService { | @@ -1520,36 +1604,67 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService { | ||
| 1520 | e.printStackTrace(); | 1604 | e.printStackTrace(); |
| 1521 | } | 1605 | } |
| 1522 | 1606 | ||
| 1607 | + Map<String, Boolean> lineNature = lineService.lineNature(); | ||
| 1523 | Map<String, Map<String, List<ScheduleRealInfo>>> keyMap = new HashMap<String, Map<String,List<ScheduleRealInfo>>>(); | 1608 | Map<String, Map<String, List<ScheduleRealInfo>>> keyMap = new HashMap<String, Map<String,List<ScheduleRealInfo>>>(); |
| 1524 | Map<String, String> xlMap = new HashMap<String, String>(); | 1609 | Map<String, String> xlMap = new HashMap<String, String>(); |
| 1525 | - String companyName = "", subCompanyName = ""; | ||
| 1526 | 1610 | ||
| 1527 | for(ScheduleRealInfo s : list){ | 1611 | for(ScheduleRealInfo s : list){ |
| 1528 | - if(lineSet.contains(s.getXlName()) || s.isCcService()){ | 1612 | + if(s.isCcService()){ |
| 1529 | continue; | 1613 | continue; |
| 1530 | } | 1614 | } |
| 1531 | - String xlName = s.getXlName(); | 1615 | + |
| 1616 | + boolean flag = false; | ||
| 1617 | + String xlbm = s.getXlBm(); | ||
| 1618 | + if(sfyy.length() == 0 || sfyy.equals("0")){ | ||
| 1619 | + flag = true; | ||
| 1620 | + } else if(sfyy.equals("1")){ | ||
| 1621 | + if(lineNature.containsKey(xlbm) && lineNature.get(xlbm)){ | ||
| 1622 | + flag = true; | ||
| 1623 | + } | ||
| 1624 | + } else { | ||
| 1625 | + if(lineNature.containsKey(xlbm) && !lineNature.get(xlbm)){ | ||
| 1626 | + flag = true; | ||
| 1627 | + } | ||
| 1628 | + } | ||
| 1629 | + if(!flag){ | ||
| 1630 | + continue; | ||
| 1631 | + } | ||
| 1632 | + | ||
| 1633 | + String key = s.getXlName() + "/" + s.getXlBm() + "/" + s.getFgsBm(); | ||
| 1532 | String date = s.getScheduleDateStr(); | 1634 | String date = s.getScheduleDateStr(); |
| 1533 | - if(!keyMap.containsKey(xlName)) | ||
| 1534 | - keyMap.put(xlName, new HashMap<String, List<ScheduleRealInfo>>()); | ||
| 1535 | - if(!keyMap.get(xlName).containsKey(date)) | ||
| 1536 | - keyMap.get(xlName).put(date, new ArrayList<ScheduleRealInfo>()); | ||
| 1537 | - keyMap.get(xlName).get(date).add(s); | ||
| 1538 | - if(companyName.length()==0&&s.getGsName()!=null&&s.getGsName().trim().length()!=0) | ||
| 1539 | - companyName = s.getGsName(); | ||
| 1540 | - if(subCompanyName.length()==0&&s.getFgsName()!=null&&s.getFgsName().trim().length()!=0) | ||
| 1541 | - subCompanyName = s.getFgsName(); | ||
| 1542 | - xlMap.put(xlName, s.getXlBm()); | 1635 | + if(!keyMap.containsKey(key)){ |
| 1636 | + keyMap.put(key, new HashMap<String, List<ScheduleRealInfo>>()); | ||
| 1637 | + } | ||
| 1638 | + if(!keyMap.get(key).containsKey(date)){ | ||
| 1639 | + keyMap.get(key).put(date, new ArrayList<ScheduleRealInfo>()); | ||
| 1640 | + } | ||
| 1641 | + keyMap.get(key).get(date).add(s); | ||
| 1642 | + | ||
| 1643 | + xlMap.put(key, s.getXlBm()); | ||
| 1543 | } | 1644 | } |
| 1544 | 1645 | ||
| 1646 | + //给key排序 | ||
| 1647 | + List<Long> longList = new ArrayList<Long>(); | ||
| 1648 | + Map<Long, String> longMap = new HashMap<Long, String>(); | ||
| 1649 | + for(String key : keyMap.keySet()){ | ||
| 1650 | + String[] keys = key.split("/"); | ||
| 1651 | + Long l = Long.valueOf(keys[2]) * 10000000000l + Long.valueOf(keys[1]); | ||
| 1652 | + longMap.put(l, key); | ||
| 1653 | + longList.add(l); | ||
| 1654 | + } | ||
| 1655 | + Collections.sort(longList); | ||
| 1656 | + | ||
| 1657 | + | ||
| 1545 | List<Map<String, Object>> mapList = new ArrayList<Map<String, Object>>(); | 1658 | List<Map<String, Object>> mapList = new ArrayList<Map<String, Object>>(); |
| 1546 | - for(String xlName : keyMap.keySet()){ | 1659 | + for(Long tempLong : longList){ |
| 1660 | + String key = longMap.get(tempLong); | ||
| 1661 | + String companyName = "", subCompanyName = ""; | ||
| 1547 | List<Map<String, Object>> tempList = new ArrayList<Map<String,Object>>(); | 1662 | List<Map<String, Object>> tempList = new ArrayList<Map<String,Object>>(); |
| 1548 | Map<String, Object> tempMap = new HashMap<String, Object>(); | 1663 | Map<String, Object> tempMap = new HashMap<String, Object>(); |
| 1549 | Map<Long, String> dateMap = new HashMap<Long, String>(); | 1664 | Map<Long, String> dateMap = new HashMap<Long, String>(); |
| 1550 | List<Long> Longs = new ArrayList<Long>(); | 1665 | List<Long> Longs = new ArrayList<Long>(); |
| 1551 | int jhbc = 0, sjbc = 0; | 1666 | int jhbc = 0, sjbc = 0; |
| 1552 | - for(String date : keyMap.get(xlName).keySet()){ | 1667 | + for(String date : keyMap.get(key).keySet()){ |
| 1553 | String[] split = date.split("-"); | 1668 | String[] split = date.split("-"); |
| 1554 | long l = Long.valueOf(split[0])*10000 + Long.valueOf(split[1])*100 + Long.valueOf(split[2]); | 1669 | long l = Long.valueOf(split[0])*10000 + Long.valueOf(split[1])*100 + Long.valueOf(split[2]); |
| 1555 | dateMap.put(l, date); | 1670 | dateMap.put(l, date); |
| @@ -1559,10 +1674,11 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService { | @@ -1559,10 +1674,11 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService { | ||
| 1559 | for(long l : Longs){ | 1674 | for(long l : Longs){ |
| 1560 | String date = dateMap.get(l); | 1675 | String date = dateMap.get(l); |
| 1561 | Map<String, Object> temp = new HashMap<String, Object>(); | 1676 | Map<String, Object> temp = new HashMap<String, Object>(); |
| 1677 | + String[] keys = key.split("/"); | ||
| 1562 | temp.put("date", date.substring(5)); | 1678 | temp.put("date", date.substring(5)); |
| 1563 | temp.put("dates", date); | 1679 | temp.put("dates", date); |
| 1564 | - temp.put("line", xlName); | ||
| 1565 | - temp.put("xlbm", xlMap.get(xlName)); | 1680 | + temp.put("line", keys[0]); |
| 1681 | + temp.put("xlbm", xlMap.get(key)); | ||
| 1566 | List<Long> up1 = new ArrayList<Long>(); | 1682 | List<Long> up1 = new ArrayList<Long>(); |
| 1567 | List<Long> up2 = new ArrayList<Long>(); | 1683 | List<Long> up2 = new ArrayList<Long>(); |
| 1568 | List<Long> dn1 = new ArrayList<Long>(); | 1684 | List<Long> dn1 = new ArrayList<Long>(); |
| @@ -1571,7 +1687,12 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService { | @@ -1571,7 +1687,12 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService { | ||
| 1571 | Map<Long, ScheduleRealInfo> up2Map = new HashMap<Long, ScheduleRealInfo>(); | 1687 | Map<Long, ScheduleRealInfo> up2Map = new HashMap<Long, ScheduleRealInfo>(); |
| 1572 | Map<Long, ScheduleRealInfo> dn1Map = new HashMap<Long, ScheduleRealInfo>(); | 1688 | Map<Long, ScheduleRealInfo> dn1Map = new HashMap<Long, ScheduleRealInfo>(); |
| 1573 | Map<Long, ScheduleRealInfo> dn2Map = new HashMap<Long, ScheduleRealInfo>(); | 1689 | Map<Long, ScheduleRealInfo> dn2Map = new HashMap<Long, ScheduleRealInfo>(); |
| 1574 | - for(ScheduleRealInfo s : keyMap.get(xlName).get(date)){ | 1690 | + for(ScheduleRealInfo s : keyMap.get(key).get(date)){ |
| 1691 | + if(companyName.length()==0&&s.getGsName()!=null&&s.getGsName().trim().length()!=0) | ||
| 1692 | + companyName = s.getGsName(); | ||
| 1693 | + if(subCompanyName.length()==0&&s.getFgsName()!=null&&s.getFgsName().trim().length()!=0) | ||
| 1694 | + subCompanyName = s.getFgsName(); | ||
| 1695 | + | ||
| 1575 | if(s.getXlDir().equals("0")){ | 1696 | if(s.getXlDir().equals("0")){ |
| 1576 | up1.add(s.getFcsjT()); | 1697 | up1.add(s.getFcsjT()); |
| 1577 | up1Map.put(s.getFcsjT(), s); | 1698 | up1Map.put(s.getFcsjT(), s); |
| @@ -1612,7 +1733,9 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService { | @@ -1612,7 +1733,9 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService { | ||
| 1612 | Map<String, Object> m = new HashMap<String, Object>(); | 1733 | Map<String, Object> m = new HashMap<String, Object>(); |
| 1613 | m.put("date", date.substring(5)); | 1734 | m.put("date", date.substring(5)); |
| 1614 | m.put("dates", date); | 1735 | m.put("dates", date); |
| 1615 | - m.put("line", xlName); | 1736 | + m.put("line", keys[0]); |
| 1737 | + m.put("company", companyName); | ||
| 1738 | + m.put("subCompany", subCompanyName); | ||
| 1616 | m.put("firstOrLast", "上行首发"); | 1739 | m.put("firstOrLast", "上行首发"); |
| 1617 | m.put("qdz", s1.getQdzName()); | 1740 | m.put("qdz", s1.getQdzName()); |
| 1618 | m.put("jhfc", s1.getFcsj()); | 1741 | m.put("jhfc", s1.getFcsj()); |
| @@ -1629,7 +1752,9 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService { | @@ -1629,7 +1752,9 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService { | ||
| 1629 | Map<String, Object> m = new HashMap<String, Object>(); | 1752 | Map<String, Object> m = new HashMap<String, Object>(); |
| 1630 | m.put("date", date.substring(5)); | 1753 | m.put("date", date.substring(5)); |
| 1631 | m.put("dates", date); | 1754 | m.put("dates", date); |
| 1632 | - m.put("line", xlName); | 1755 | + m.put("line", keys[0]); |
| 1756 | + m.put("company", companyName); | ||
| 1757 | + m.put("subCompany", subCompanyName); | ||
| 1633 | m.put("firstOrLast", "上行末发"); | 1758 | m.put("firstOrLast", "上行末发"); |
| 1634 | m.put("qdz", s3.getQdzName()); | 1759 | m.put("qdz", s3.getQdzName()); |
| 1635 | m.put("jhfc", s3.getFcsj()); | 1760 | m.put("jhfc", s3.getFcsj()); |
| @@ -1674,7 +1799,9 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService { | @@ -1674,7 +1799,9 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService { | ||
| 1674 | Map<String, Object> m = new HashMap<String, Object>(); | 1799 | Map<String, Object> m = new HashMap<String, Object>(); |
| 1675 | m.put("date", date.substring(5)); | 1800 | m.put("date", date.substring(5)); |
| 1676 | m.put("dates", date); | 1801 | m.put("dates", date); |
| 1677 | - m.put("line", xlName); | 1802 | + m.put("line", keys[0]); |
| 1803 | + m.put("company", companyName); | ||
| 1804 | + m.put("subCompany", subCompanyName); | ||
| 1678 | m.put("firstOrLast", "下行首发"); | 1805 | m.put("firstOrLast", "下行首发"); |
| 1679 | m.put("qdz", s1.getQdzName()); | 1806 | m.put("qdz", s1.getQdzName()); |
| 1680 | m.put("jhfc", s1.getFcsj()); | 1807 | m.put("jhfc", s1.getFcsj()); |
| @@ -1692,7 +1819,9 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService { | @@ -1692,7 +1819,9 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService { | ||
| 1692 | Map<String, Object> m = new HashMap<String, Object>(); | 1819 | Map<String, Object> m = new HashMap<String, Object>(); |
| 1693 | m.put("date", date.substring(5)); | 1820 | m.put("date", date.substring(5)); |
| 1694 | m.put("dates", date); | 1821 | m.put("dates", date); |
| 1695 | - m.put("line", xlName); | 1822 | + m.put("line", keys[0]); |
| 1823 | + m.put("company", companyName); | ||
| 1824 | + m.put("subCompany", subCompanyName); | ||
| 1696 | m.put("firstOrLast", "下行末发"); | 1825 | m.put("firstOrLast", "下行末发"); |
| 1697 | m.put("qdz", s3.getQdzName()); | 1826 | m.put("qdz", s3.getQdzName()); |
| 1698 | m.put("jhfc", s3.getFcsj()); | 1827 | m.put("jhfc", s3.getFcsj()); |
| @@ -1718,11 +1847,12 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService { | @@ -1718,11 +1847,12 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService { | ||
| 1718 | continue; | 1847 | continue; |
| 1719 | tempList.add(temp); | 1848 | tempList.add(temp); |
| 1720 | } | 1849 | } |
| 1850 | + String[] keys = key.split("/"); | ||
| 1721 | tempMap.put("map", tempList); | 1851 | tempMap.put("map", tempList); |
| 1722 | tempMap.put("company", companyName); | 1852 | tempMap.put("company", companyName); |
| 1723 | tempMap.put("subCompany", subCompanyName); | 1853 | tempMap.put("subCompany", subCompanyName); |
| 1724 | - tempMap.put("xlbm", xlMap.get(xlName)); | ||
| 1725 | - tempMap.put("line", xlName); | 1854 | + tempMap.put("xlbm", xlMap.get(key)); |
| 1855 | + tempMap.put("line", keys[0]); | ||
| 1726 | tempMap.put("date", dates); | 1856 | tempMap.put("date", dates); |
| 1727 | tempMap.put("jhbc", jhbc); | 1857 | tempMap.put("jhbc", jhbc); |
| 1728 | tempMap.put("sjbc", sjbc); | 1858 | tempMap.put("sjbc", sjbc); |
| @@ -1744,8 +1874,8 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService { | @@ -1744,8 +1874,8 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService { | ||
| 1744 | tempMap.put("zdl", (jhbc<1?"0":nf.format((float) sjbc / jhbc * 100)) + "%"); | 1874 | tempMap.put("zdl", (jhbc<1?"0":nf.format((float) sjbc / jhbc * 100)) + "%"); |
| 1745 | for(Map<String, Object> m : mapList){ | 1875 | for(Map<String, Object> m : mapList){ |
| 1746 | m.put("no", ++i); | 1876 | m.put("no", ++i); |
| 1747 | - m.put("company", companyName); | ||
| 1748 | - m.put("subCompany", subCompanyName); | 1877 | +// m.put("company", companyName); |
| 1878 | +// m.put("subCompany", subCompanyName); | ||
| 1749 | } | 1879 | } |
| 1750 | tempMap.put("map", mapList); | 1880 | tempMap.put("map", mapList); |
| 1751 | if(!type.equals("export")) | 1881 | if(!type.equals("export")) |
| @@ -1844,7 +1974,10 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService { | @@ -1844,7 +1974,10 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService { | ||
| 1844 | sql += " and cl_zbh = '"+code+"'"; | 1974 | sql += " and cl_zbh = '"+code+"'"; |
| 1845 | } | 1975 | } |
| 1846 | if(company.length() != 0){ | 1976 | if(company.length() != 0){ |
| 1847 | - sql += " and gs_bm = '"+company+"' and fgs_bm = '"+subCompany+"'"; | 1977 | + sql += " and gs_bm = '"+company+"'"; |
| 1978 | + } | ||
| 1979 | + if(subCompany.length() != 0){ | ||
| 1980 | + sql += " and fgs_bm = '"+subCompany+"'"; | ||
| 1848 | } | 1981 | } |
| 1849 | sql += " union " + | 1982 | sql += " union " + |
| 1850 | "select r.id, r.schedule_date_str, r.xl_name, r.cl_zbh, r.j_gh, r.j_name, r.fcsj, d.timestamp, d.reply46, d.reply47, d.reply46time, d.reply47time, r.gs_name, r.fgs_name " + | 1983 | "select r.id, r.schedule_date_str, r.xl_name, r.cl_zbh, r.j_gh, r.j_name, r.fcsj, d.timestamp, d.reply46, d.reply47, d.reply46time, d.reply47time, r.gs_name, r.fgs_name " + |
| @@ -1856,7 +1989,10 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService { | @@ -1856,7 +1989,10 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService { | ||
| 1856 | sql += " and cl_zbh = '"+code+"'"; | 1989 | sql += " and cl_zbh = '"+code+"'"; |
| 1857 | } | 1990 | } |
| 1858 | if(company.length() != 0){ | 1991 | if(company.length() != 0){ |
| 1859 | - sql += " and gs_bm = '"+company+"' and fgs_bm = '"+subCompany+"'"; | 1992 | + sql += " and gs_bm = '"+company+"'"; |
| 1993 | + } | ||
| 1994 | + if(subCompany.length() != 0){ | ||
| 1995 | + sql += " and fgs_bm = '"+subCompany+"'"; | ||
| 1860 | } | 1996 | } |
| 1861 | sql += " order by xl_name, fcsj"; | 1997 | sql += " order by xl_name, fcsj"; |
| 1862 | 1998 | ||
| @@ -1998,11 +2134,17 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService { | @@ -1998,11 +2134,17 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService { | ||
| 1998 | return resList; | 2134 | return resList; |
| 1999 | } | 2135 | } |
| 2000 | */ | 2136 | */ |
| 2137 | + | ||
| 2001 | @Override | 2138 | @Override |
| 2002 | public List<Map<String, Object>> commandState(Map<String, Object> map) { | 2139 | public List<Map<String, Object>> commandState(Map<String, Object> map) { |
| 2003 | // TODO Auto-generated method stub | 2140 | // TODO Auto-generated method stub |
| 2004 | - String company = map.get("company").toString(); | ||
| 2005 | - String subCompany = map.get("subCompany").toString(); | 2141 | + String sfyy = "", company = "", subCompany = ""; |
| 2142 | + if(map.get("sfyy")!=null) | ||
| 2143 | + sfyy=map.get("sfyy").toString(); | ||
| 2144 | + if(map.get("company")!=null) | ||
| 2145 | + company=map.get("company").toString(); | ||
| 2146 | + if(map.get("subCompany")!=null) | ||
| 2147 | + subCompany=map.get("subCompany").toString(); | ||
| 2006 | String line = map.get("line").toString().trim(); | 2148 | String line = map.get("line").toString().trim(); |
| 2007 | String date = map.get("date").toString(); | 2149 | String date = map.get("date").toString(); |
| 2008 | // String code = map.get("code").toString(); | 2150 | // String code = map.get("code").toString(); |
| @@ -2010,18 +2152,22 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService { | @@ -2010,18 +2152,22 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService { | ||
| 2010 | 2152 | ||
| 2011 | String sql_="select * from bsth_c_s_sp_info_real " | 2153 | String sql_="select * from bsth_c_s_sp_info_real " |
| 2012 | + " WHERE schedule_date_str = '"+date+"' "; | 2154 | + " WHERE schedule_date_str = '"+date+"' "; |
| 2013 | - if(line.equals("")){ | ||
| 2014 | - sql_ += "and gs_bm='"+company+"'and fgs_bm='"+subCompany+"'"; | ||
| 2015 | - }else{ | 2155 | + if(!line.equals("")){ |
| 2016 | sql_ += " and xl_bm = '"+line+"'"; | 2156 | sql_ += " and xl_bm = '"+line+"'"; |
| 2017 | } | 2157 | } |
| 2158 | + if(company.length() != 0){ | ||
| 2159 | + sql_ += " and gs_bm='"+company+"'"; | ||
| 2160 | + } | ||
| 2161 | + if(subCompany.length() != 0){ | ||
| 2162 | + sql_ += " and fgs_bm='"+subCompany+"'"; | ||
| 2163 | + } | ||
| 2018 | 2164 | ||
| 2019 | 2165 | ||
| 2020 | String sql="SELECT r.id,r.schedule_date_str,r.xl_name,r.xl_bm,r.cl_zbh,r.j_gh,r.j_name,r.fcsj," | 2166 | String sql="SELECT r.id,r.schedule_date_str,r.xl_name,r.xl_bm,r.cl_zbh,r.j_gh,r.j_name,r.fcsj," |
| 2021 | + " r.gs_name,r.fgs_name,CONCAT(r.xl_bm,'_',r.id) as line_sch FROM ("+sql_+") AS r" | 2167 | + " r.gs_name,r.fgs_name,CONCAT(r.xl_bm,'_',r.id) as line_sch FROM ("+sql_+") AS r" |
| 2022 | - + " order by r.xl_name,r.id "; | 2168 | + + " order by r.gs_bm,r.fgs_bm,r.xl_bm,r.id "; |
| 2023 | 2169 | ||
| 2024 | - List<Map<String, Object>> list = jdbcTemplate.query(sql, | 2170 | + List<Map<String, Object>> tempList = jdbcTemplate.query(sql, |
| 2025 | new RowMapper<Map<String, Object>>(){ | 2171 | new RowMapper<Map<String, Object>>(){ |
| 2026 | @Override | 2172 | @Override |
| 2027 | public Map<String, Object> mapRow(ResultSet rs, int rowNum) throws SQLException { | 2173 | public Map<String, Object> mapRow(ResultSet rs, int rowNum) throws SQLException { |
| @@ -2050,6 +2196,23 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService { | @@ -2050,6 +2196,23 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService { | ||
| 2050 | e.printStackTrace(); | 2196 | e.printStackTrace(); |
| 2051 | } | 2197 | } |
| 2052 | 2198 | ||
| 2199 | + Map<String, Boolean> lineNature = lineService.lineNature(); | ||
| 2200 | + List<Map<String, Object>> list = new ArrayList<Map<String, Object>>(); | ||
| 2201 | + for(Map<String, Object> m : tempList){ | ||
| 2202 | + String xlbm = m.get("xlbm").toString(); | ||
| 2203 | + if(sfyy.length() == 0 || sfyy.equals("0")){ | ||
| 2204 | + list.add(m); | ||
| 2205 | + } else if(sfyy.equals("1")){ | ||
| 2206 | + if(lineNature.containsKey(xlbm) && lineNature.get(xlbm)){ | ||
| 2207 | + list.add(m); | ||
| 2208 | + } | ||
| 2209 | + } else { | ||
| 2210 | + if(lineNature.containsKey(xlbm) && !lineNature.get(xlbm)){ | ||
| 2211 | + list.add(m); | ||
| 2212 | + } | ||
| 2213 | + } | ||
| 2214 | + } | ||
| 2215 | + | ||
| 2053 | long min = 0, max = 0; | 2216 | long min = 0, max = 0; |
| 2054 | for(Map<String, Object> m : list){ | 2217 | for(Map<String, Object> m : list){ |
| 2055 | long l = Long.valueOf(m.get("id").toString()); | 2218 | long l = Long.valueOf(m.get("id").toString()); |
| @@ -2411,7 +2574,7 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService { | @@ -2411,7 +2574,7 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService { | ||
| 2411 | String jgh = map.get("jgh").toString(); | 2574 | String jgh = map.get("jgh").toString(); |
| 2412 | // String code = map.get("code").toString(); | 2575 | // String code = map.get("code").toString(); |
| 2413 | String type = ""; | 2576 | String type = ""; |
| 2414 | - if(map.containsKey("type")) | 2577 | + if(map.get("type")!=null) |
| 2415 | type = map.get("type").toString().trim(); | 2578 | type = map.get("type").toString().trim(); |
| 2416 | 2579 | ||
| 2417 | String sql_="select * from bsth_c_s_sp_info_real " | 2580 | String sql_="select * from bsth_c_s_sp_info_real " |
| @@ -2420,7 +2583,7 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService { | @@ -2420,7 +2583,7 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService { | ||
| 2420 | if(!line.equals("")){ | 2583 | if(!line.equals("")){ |
| 2421 | sql_ +=" and xl_bm = '"+line+"'"; | 2584 | sql_ +=" and xl_bm = '"+line+"'"; |
| 2422 | } | 2585 | } |
| 2423 | - | 2586 | + |
| 2424 | 2587 | ||
| 2425 | String sql="SELECT r.id,r.schedule_date_str,r.fcsj,r.xl_name,r.xl_bm,r.cl_zbh,r.j_gh,r.j_name," | 2588 | String sql="SELECT r.id,r.schedule_date_str,r.fcsj,r.xl_name,r.xl_bm,r.cl_zbh,r.j_gh,r.j_name," |
| 2426 | + " r.fcsj,d. TIMESTAMP,d.reply46,d.reply47,d.reply46time,d.reply47time," | 2589 | + " r.fcsj,d. TIMESTAMP,d.reply46,d.reply47,d.reply46time,d.reply47time," |
src/main/java/com/bsth/service/schedule/plan/DroolsSchedulePlan.java
| @@ -475,6 +475,9 @@ public class DroolsSchedulePlan { | @@ -475,6 +475,9 @@ public class DroolsSchedulePlan { | ||
| 475 | * @param schedulePlan | 475 | * @param schedulePlan |
| 476 | */ | 476 | */ |
| 477 | public void validPlanResult(PlanResult planResult) { | 477 | public void validPlanResult(PlanResult planResult) { |
| 478 | + // 1-0、获取路牌信息 | ||
| 479 | + LpInfoResults_output lpInfoResults_output = (LpInfoResults_output) this.ttInfoOutput(this.mainLine)[1]; | ||
| 480 | + | ||
| 478 | // 1-1、构造drools规则输入数据,输出数据 | 481 | // 1-1、构造drools规则输入数据,输出数据 |
| 479 | ValidateParam validateParam = new ValidateParam( | 482 | ValidateParam validateParam = new ValidateParam( |
| 480 | new DateTime(this.from), new DateTime(this.to)); | 483 | new DateTime(this.from), new DateTime(this.to)); |
| @@ -494,6 +497,9 @@ public class DroolsSchedulePlan { | @@ -494,6 +497,9 @@ public class DroolsSchedulePlan { | ||
| 494 | for (SchedulePlanInfo schedulePlanInfo: planResult.getSchedulePlanInfos()) { | 497 | for (SchedulePlanInfo schedulePlanInfo: planResult.getSchedulePlanInfos()) { |
| 495 | session.insert(schedulePlanInfo); | 498 | session.insert(schedulePlanInfo); |
| 496 | } | 499 | } |
| 500 | + for (LpInfoResult_output lpInfoResult_output: lpInfoResults_output.getLpInfoResult_outputs()) { | ||
| 501 | + session.insert(lpInfoResult_output); | ||
| 502 | + } | ||
| 497 | 503 | ||
| 498 | // 执行rule | 504 | // 执行rule |
| 499 | session.fireAllRules(); | 505 | session.fireAllRules(); |
src/main/java/com/bsth/service/schedule/rules/ttinfo/LpInfoResult_output.java
| @@ -10,6 +10,8 @@ public class LpInfoResult_output { | @@ -10,6 +10,8 @@ public class LpInfoResult_output { | ||
| 10 | private DateTime dateTime; | 10 | private DateTime dateTime; |
| 11 | /** 路牌Id */ | 11 | /** 路牌Id */ |
| 12 | private String lpId; | 12 | private String lpId; |
| 13 | + /** 路牌名字 */ | ||
| 14 | + private String lpName; | ||
| 13 | /** 线路Id */ | 15 | /** 线路Id */ |
| 14 | private String xlId; | 16 | private String xlId; |
| 15 | /** 时刻表Id */ | 17 | /** 时刻表Id */ |
| @@ -56,4 +58,12 @@ public class LpInfoResult_output { | @@ -56,4 +58,12 @@ public class LpInfoResult_output { | ||
| 56 | public void setTtInfoName(String ttInfoName) { | 58 | public void setTtInfoName(String ttInfoName) { |
| 57 | this.ttInfoName = ttInfoName; | 59 | this.ttInfoName = ttInfoName; |
| 58 | } | 60 | } |
| 61 | + | ||
| 62 | + public String getLpName() { | ||
| 63 | + return lpName; | ||
| 64 | + } | ||
| 65 | + | ||
| 66 | + public void setLpName(String lpName) { | ||
| 67 | + this.lpName = lpName; | ||
| 68 | + } | ||
| 59 | } | 69 | } |
src/main/java/com/bsth/service/schedule/rules/ttinfo/LpInfoResultsFunction.java
| @@ -64,6 +64,7 @@ public class LpInfoResultsFunction implements AccumulateFunction { | @@ -64,6 +64,7 @@ public class LpInfoResultsFunction implements AccumulateFunction { | ||
| 64 | if (lpInfoResultsData.lpInfoResult_outputMap.get(ttInfoDetail.getLp().getId()) == null) { | 64 | if (lpInfoResultsData.lpInfoResult_outputMap.get(ttInfoDetail.getLp().getId()) == null) { |
| 65 | LpInfoResult_output lpInfoResult_output = new LpInfoResult_output(); | 65 | LpInfoResult_output lpInfoResult_output = new LpInfoResult_output(); |
| 66 | lpInfoResult_output.setLpId(String.valueOf(ttInfoDetail.getLp().getId())); | 66 | lpInfoResult_output.setLpId(String.valueOf(ttInfoDetail.getLp().getId())); |
| 67 | + lpInfoResult_output.setLpName(ttInfoDetail.getLp().getLpName()); | ||
| 67 | lpInfoResult_output.setXlId(String.valueOf(ttInfoDetail.getXl().getId())); | 68 | lpInfoResult_output.setXlId(String.valueOf(ttInfoDetail.getXl().getId())); |
| 68 | lpInfoResult_output.setTtInfoId(String.valueOf(ttInfoDetail.getTtinfo().getId())); | 69 | lpInfoResult_output.setTtInfoId(String.valueOf(ttInfoDetail.getTtinfo().getId())); |
| 69 | lpInfoResult_output.setTtInfoName(ttInfoDetail.getTtinfo().getName()); | 70 | lpInfoResult_output.setTtInfoName(ttInfoDetail.getTtinfo().getName()); |
src/main/java/com/bsth/service/schedule/rules/validate/ValidWantLpFunction.java
0 → 100644
| 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 | + |
src/main/java/com/bsth/service/schedule/rules/validate/ValidateResource.java
0 → 100644
| 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 | +} |
src/main/java/com/bsth/service/sys/RoleService.java
| @@ -8,6 +8,6 @@ import com.bsth.service.BaseService; | @@ -8,6 +8,6 @@ import com.bsth.service.BaseService; | ||
| 8 | public interface RoleService extends BaseService<Role, Integer>{ | 8 | public interface RoleService extends BaseService<Role, Integer>{ |
| 9 | 9 | ||
| 10 | Map<String, Object> settRoleModules(Integer roleId, String mIds); | 10 | Map<String, Object> settRoleModules(Integer roleId, String mIds); |
| 11 | - | 11 | + |
| 12 | Map<String, Object> roleInfo(Integer id); | 12 | Map<String, Object> roleInfo(Integer id); |
| 13 | } | 13 | } |
src/main/java/com/bsth/service/sys/impl/RoleServiceImpl.java
| @@ -33,7 +33,7 @@ public class RoleServiceImpl extends BaseServiceImpl<Role, Integer> implements | @@ -33,7 +33,7 @@ public class RoleServiceImpl extends BaseServiceImpl<Role, Integer> implements | ||
| 33 | 33 | ||
| 34 | @Autowired | 34 | @Autowired |
| 35 | ModuleRepository moduleRepository; | 35 | ModuleRepository moduleRepository; |
| 36 | - | 36 | + |
| 37 | SimpleDateFormat sdfMinute = new SimpleDateFormat("yyyy-MM-dd HH:mm"); | 37 | SimpleDateFormat sdfMinute = new SimpleDateFormat("yyyy-MM-dd HH:mm"); |
| 38 | 38 | ||
| 39 | @Override | 39 | @Override |
src/main/resources/rules/functions.drl
| @@ -8,3 +8,4 @@ import accumulate com.bsth.service.schedule.rules.ttinfo.LpInfoResultsFunction l | @@ -8,3 +8,4 @@ import accumulate com.bsth.service.schedule.rules.ttinfo.LpInfoResultsFunction l | ||
| 8 | import accumulate com.bsth.service.schedule.rules.ttinfo.MinRuleQyrqFunction minruleqyrq; | 8 | import accumulate com.bsth.service.schedule.rules.ttinfo.MinRuleQyrqFunction minruleqyrq; |
| 9 | import accumulate com.bsth.service.schedule.rules.validate.ValidRepeatBcFunction vrb; | 9 | import accumulate com.bsth.service.schedule.rules.validate.ValidRepeatBcFunction vrb; |
| 10 | import accumulate com.bsth.service.schedule.rules.validate.ValidWholeRerunBcFunction vwrb; | 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/validplan.drl
| @@ -2,6 +2,7 @@ package com.bsth.service.schedule.rules.validate; | @@ -2,6 +2,7 @@ package com.bsth.service.schedule.rules.validate; | ||
| 2 | 2 | ||
| 3 | import com.bsth.entity.schedule.SchedulePlanInfo; | 3 | import com.bsth.entity.schedule.SchedulePlanInfo; |
| 4 | import com.bsth.service.schedule.rules.ttinfo.LpInfoResult_output; | 4 | import com.bsth.service.schedule.rules.ttinfo.LpInfoResult_output; |
| 5 | +import com.bsth.service.schedule.rules.validate.ValidateResource; | ||
| 5 | 6 | ||
| 6 | import org.joda.time.*; | 7 | import org.joda.time.*; |
| 7 | import java.util.*; | 8 | import java.util.*; |
| @@ -14,7 +15,22 @@ global Logger log; | @@ -14,7 +15,22 @@ global Logger log; | ||
| 14 | // 输出 | 15 | // 输出 |
| 15 | global ValidateResults_output validResult; | 16 | global ValidateResults_output validResult; |
| 16 | 17 | ||
| 17 | -//------------------------- 第一阶段、构造循环体 ----------------------------// | 18 | +//------------------------- 第一阶段、构造验证源 ----------------------------// |
| 19 | +rule "Calcu_validate_resource" | ||
| 20 | + salience 2000 | ||
| 21 | + when | ||
| 22 | + $spi: SchedulePlanInfo($sd: scheduleDate) | ||
| 23 | + $lpiList: ArrayList() from collect (LpInfoResult_output(dateTime.getMillis() == $sd.getTime())) | ||
| 24 | + then | ||
| 25 | + ValidateResource resource = new ValidateResource(); | ||
| 26 | + resource.setSd($sd); | ||
| 27 | + resource.setSpi($spi); | ||
| 28 | + resource.setLpiList($lpiList); | ||
| 29 | + | ||
| 30 | + insert(resource); | ||
| 31 | +end | ||
| 32 | + | ||
| 33 | +//------------------------- 第二阶段、构造循环体 ----------------------------// | ||
| 18 | 34 | ||
| 19 | declare Loop_param | 35 | declare Loop_param |
| 20 | start_date: DateTime // 开始日期(这个要不停的更新迭代) | 36 | start_date: DateTime // 开始日期(这个要不停的更新迭代) |
| @@ -39,23 +55,27 @@ rule "Calcu_Loop_param" | @@ -39,23 +55,27 @@ rule "Calcu_Loop_param" | ||
| 39 | insert(p); | 55 | insert(p); |
| 40 | end | 56 | end |
| 41 | 57 | ||
| 42 | -//------------------------- 第二阶段、验证计算 ----------------------------// | 58 | +//------------------------- 第三阶段、验证计算 ----------------------------// |
| 43 | 59 | ||
| 44 | 60 | ||
| 45 | -rule "Valid_repeat_bc" // 验证是否存在重复班次 | 61 | +rule "Valid_repeat_bc" // 验证是否存在重复班次,未套跑班次,未执行路牌 |
| 46 | salience 600 | 62 | salience 600 |
| 47 | when | 63 | when |
| 48 | $lp: Loop_param($sd: start_date, $ed: end_date) | 64 | $lp: Loop_param($sd: start_date, $ed: end_date) |
| 49 | eval($sd.isBefore($ed) || $sd.isEqual($ed)) | 65 | eval($sd.isBefore($ed) || $sd.isEqual($ed)) |
| 50 | - $spiList: ArrayList() from collect (SchedulePlanInfo(scheduleDate.getTime() == $sd.getMillis())) | ||
| 51 | - $infos: ArrayList() from accumulate ($spi: SchedulePlanInfo() from $spiList, vrb($spi)) | ||
| 52 | - $infos2: ArrayList() from accumulate ($spi: SchedulePlanInfo() from $spiList, vwrb($spi)) | 66 | + $vrList: ArrayList() from collect (ValidateResource(sd.getTime() == $sd.getMillis())) |
| 67 | + $infos: ArrayList() from accumulate ($vr: ValidateResource() from $vrList, vrb($vr.getSpi())) | ||
| 68 | + $infos2: ArrayList() from accumulate ($vr: ValidateResource() from $vrList, vwrb($vr.getSpi())) | ||
| 69 | + $infos3: ArrayList() from accumulate ($vr: ValidateResource() from $vrList, vwlp($vr)) | ||
| 53 | then | 70 | then |
| 54 | // TODO: | 71 | // TODO: |
| 55 | // log.info("日期={},班次重复错误数={}", $sd, $infos.size()); | 72 | // log.info("日期={},班次重复错误数={}", $sd, $infos.size()); |
| 56 | 73 | ||
| 74 | +// log.info("班次数={}", $vrList.size()); | ||
| 75 | + | ||
| 57 | validResult.getInfos().addAll($infos); | 76 | validResult.getInfos().addAll($infos); |
| 58 | validResult.getInfos().addAll($infos2); | 77 | validResult.getInfos().addAll($infos2); |
| 78 | + validResult.getInfos().addAll($infos3); | ||
| 59 | 79 | ||
| 60 | // 迭代 | 80 | // 迭代 |
| 61 | $lp.setStart_date($sd.plusDays(1)); | 81 | $lp.setStart_date($sd.plusDays(1)); |
src/main/resources/static/index.html
| @@ -630,7 +630,7 @@ | @@ -630,7 +630,7 @@ | ||
| 630 | <script | 630 | <script |
| 631 | src="http://webapi.amap.com/maps?v=1.3&key=16cb1c5043847e09ef9edafdd77befda" | 631 | src="http://webapi.amap.com/maps?v=1.3&key=16cb1c5043847e09ef9edafdd77befda" |
| 632 | data-exclude=1></script> | 632 | data-exclude=1></script> |
| 633 | -<!-- echarts --> | 633 | +<!-- echarts4 误删 --> |
| 634 | <script src="/metronic_v4.5.4/plugins/echarts4/echarts.min.js"></script> | 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> | 635 | <script src="/real_control_v2/assets/plugins/perfect-scrollbar/perfect-scrollbar.jquery.js" merge="plugins"></script> |
| 636 | 636 |