Commit d143649f69ba1f9a3e1fb09460bfea1c8090772a
12312
Showing
71 changed files
with
11096 additions
and
8689 deletions
pom.xml
| @@ -400,6 +400,12 @@ | @@ -400,6 +400,12 @@ | ||
| 400 | <version>1.0.0</version> | 400 | <version>1.0.0</version> |
| 401 | </dependency> | 401 | </dependency> |
| 402 | 402 | ||
| 403 | + <!-- geotool --> | ||
| 404 | + <dependency> | ||
| 405 | + <groupId>org.locationtech.jts</groupId> | ||
| 406 | + <artifactId>jts-core</artifactId> | ||
| 407 | + <version>1.16.1</version> | ||
| 408 | + </dependency> | ||
| 403 | </dependencies> | 409 | </dependencies> |
| 404 | 410 | ||
| 405 | <dependencyManagement> | 411 | <dependencyManagement> |
src/main/java/com/bsth/common/Constants.java
| @@ -54,4 +54,9 @@ public class Constants { | @@ -54,4 +54,9 @@ public class Constants { | ||
| 54 | * 批量解除调度指令和班次的外键约束 | 54 | * 批量解除调度指令和班次的外键约束 |
| 55 | */ | 55 | */ |
| 56 | public static final String MULTI_REMOVE_DIRECTIVE_SCH_FK = "update bsth_v_directive_60 set sch=NULL where sch in "; | 56 | public static final String MULTI_REMOVE_DIRECTIVE_SCH_FK = "update bsth_v_directive_60 set sch=NULL where sch in "; |
| 57 | + | ||
| 58 | + /** | ||
| 59 | + * 批量解除子任务和班次的外键约束 | ||
| 60 | + */ | ||
| 61 | + public static final String MULTI_REMOVE_CHILDTASK_SCH_FK = "update bsth_c_s_child_task set schedule=NULL where schedule in "; | ||
| 57 | } | 62 | } |
src/main/java/com/bsth/controller/InoutCarparkController.java
0 → 100644
| 1 | +package com.bsth.controller; | ||
| 2 | + | ||
| 3 | +import com.bsth.common.ResponseCode; | ||
| 4 | +import com.bsth.entity.LsInoutSectionRoute; | ||
| 5 | +import com.bsth.repository.StationRouteCacheRepository; | ||
| 6 | +import com.bsth.repository.StationRouteRepository; | ||
| 7 | +import com.bsth.service.InoutCarparkService; | ||
| 8 | +import com.bsth.service.StationRouteService; | ||
| 9 | +import com.fasterxml.jackson.core.JsonProcessingException; | ||
| 10 | +import org.slf4j.Logger; | ||
| 11 | +import org.slf4j.LoggerFactory; | ||
| 12 | +import org.springframework.beans.factory.annotation.Autowired; | ||
| 13 | +import org.springframework.util.StringUtils; | ||
| 14 | +import org.springframework.web.bind.annotation.*; | ||
| 15 | + | ||
| 16 | +import java.util.HashMap; | ||
| 17 | +import java.util.Map; | ||
| 18 | + | ||
| 19 | +@RestController | ||
| 20 | +@RequestMapping("inout") | ||
| 21 | +public class InoutCarparkController extends BaseController<LsInoutSectionRoute, Long>{ | ||
| 22 | + | ||
| 23 | + private final static Logger logger = LoggerFactory.getLogger(InoutCarparkController.class); | ||
| 24 | + | ||
| 25 | + @Autowired | ||
| 26 | + InoutCarparkService inoutCarparkService; | ||
| 27 | + | ||
| 28 | + @RequestMapping(value = "/getStartEndByLine", method = RequestMethod.GET) | ||
| 29 | + public Map<String, Object> getStartEndByLine(@RequestParam("lineId")int lineId, @RequestParam("version")int version) { | ||
| 30 | + return inoutCarparkService.getStartEndByLine(lineId, version); | ||
| 31 | + } | ||
| 32 | + | ||
| 33 | + @RequestMapping(value = "/getRouteByStartEnd", method = RequestMethod.GET) | ||
| 34 | + public Map<String, Object> getRouteByStartEnd(@RequestParam("lineId")int lineId, @RequestParam("version")int version, @RequestParam("start")String start, @RequestParam("end")String end) { | ||
| 35 | + return inoutCarparkService.getRouteByStartEnd(lineId, version, start, end); | ||
| 36 | + } | ||
| 37 | + | ||
| 38 | + /** | ||
| 39 | + * 新增路段信息 | ||
| 40 | + * | ||
| 41 | + * @param map:<bsectionVector:折线百度坐标集合;dbType:圆坐标类型;descriptions:描述与说明;destroy:是否撤销;directions:方向;lineId:线路ID | ||
| 42 | + * | ||
| 43 | + * lineCode :线路编码;roadCoding:道路编码;sectionCode:路段编码;sectionDistance:路段长度;sectionName:路段名称;sectionTime:路段时长; | ||
| 44 | + * | ||
| 45 | + * sectionrouteCode:路段序号;speedLimit:路段限速> | ||
| 46 | + * | ||
| 47 | + * @return map<SUCCESS:成功;ERROR:异常> | ||
| 48 | + */ | ||
| 49 | + @RequestMapping(value="sectionSave" , method = RequestMethod.POST) | ||
| 50 | + public Map<String, Object> sectionSave(@RequestParam Map<String, Object> map) { | ||
| 51 | + map.put("createBy", ""); | ||
| 52 | + map.put("updateBy", ""); | ||
| 53 | + return inoutCarparkService.sectionSave(map); | ||
| 54 | + } | ||
| 55 | + | ||
| 56 | + /** | ||
| 57 | + * @Description :TODO(编辑线路走向) | ||
| 58 | + * | ||
| 59 | + * @param map <sectionId:路段ID; sectionJSON:路段信息> | ||
| 60 | + * | ||
| 61 | + * @return Map<String, Object> <SUCCESS ; ERROR> | ||
| 62 | + */ | ||
| 63 | + @RequestMapping(value="sectionUpdate" , method = RequestMethod.POST) | ||
| 64 | + public Map<String, Object> sectionUpdate(@RequestParam Map<String, Object> map) { | ||
| 65 | + | ||
| 66 | + map.put("updateBy", ""); | ||
| 67 | + | ||
| 68 | + map.put("createBy", ""); | ||
| 69 | + | ||
| 70 | + map.put("createDate", ""); | ||
| 71 | + | ||
| 72 | + return inoutCarparkService.sectionUpdate(map); | ||
| 73 | + | ||
| 74 | + } | ||
| 75 | + | ||
| 76 | + /** | ||
| 77 | + * @param id //路段路由id | ||
| 78 | + * @Description: TODO(撤销路段) | ||
| 79 | + */ | ||
| 80 | + @RequestMapping(value = "/destroy", method = RequestMethod.POST) | ||
| 81 | + public Map<String, Object> destroy(@RequestParam Map<String, Object> map) { | ||
| 82 | + return inoutCarparkService.destroy(map); | ||
| 83 | + } | ||
| 84 | + | ||
| 85 | + /** | ||
| 86 | + * 从历史轨迹做进场路径规划 | ||
| 87 | + * @Description: TODO(撤销路段) | ||
| 88 | + */ | ||
| 89 | + @RequestMapping(value = "/pathPlaningByHistory", method = RequestMethod.POST) | ||
| 90 | + public Map<String, Object> pathPlaningByHistory(@RequestParam Map<String, Object> map){ | ||
| 91 | + Map<String, Object> result = new HashMap<>(); | ||
| 92 | + result.put("status", ResponseCode.SUCCESS); | ||
| 93 | + try { | ||
| 94 | + String schId = (String)map.get("schId"), version = (String)map.get("version"); | ||
| 95 | + if (StringUtils.isEmpty(schId) || StringUtils.isEmpty(version)) { | ||
| 96 | + throw new RuntimeException("无效的参数"); | ||
| 97 | + } | ||
| 98 | + inoutCarparkService.pathPlaningByHistory(Long.parseLong(schId), Integer.parseInt(version)); | ||
| 99 | + } catch (Exception e) { | ||
| 100 | + result.put("status", ResponseCode.ERROR); | ||
| 101 | + logger.error("路径规划异常", e); | ||
| 102 | + } | ||
| 103 | + | ||
| 104 | + return result; | ||
| 105 | + } | ||
| 106 | +} |
src/main/java/com/bsth/controller/oil/YlbController.java
| @@ -234,8 +234,24 @@ public class YlbController extends BaseController<Ylb, Integer>{ | @@ -234,8 +234,24 @@ public class YlbController extends BaseController<Ylb, Integer>{ | ||
| 234 | 234 | ||
| 235 | @RequestMapping(value = "/checkDate",method = RequestMethod.GET) | 235 | @RequestMapping(value = "/checkDate",method = RequestMethod.GET) |
| 236 | public String checkDate(@RequestParam Map<String, Object> map){ | 236 | public String checkDate(@RequestParam Map<String, Object> map){ |
| 237 | - String list=ylbService.checkDate(map); | ||
| 238 | - return list; | 237 | + String result=ylbService.checkDate(map); |
| 238 | + return result; | ||
| 239 | + } | ||
| 240 | + | ||
| 241 | + @RequestMapping(value = "/getModifyRights",method = RequestMethod.GET) | ||
| 242 | + public Map<String, Object> getModifyRights(@RequestParam Map<String, Object> map){ | ||
| 243 | + String result=ylbService.getModifyRights(); | ||
| 244 | + Map<String, Object> resMap = new HashMap<String, Object>(); | ||
| 245 | + resMap.put("text", result); | ||
| 246 | + return resMap; | ||
| 247 | + } | ||
| 248 | + | ||
| 249 | + @RequestMapping(value = "/modifyRightsChange",method = RequestMethod.GET) | ||
| 250 | + public Map<String, Object> modifyRightsChange(@RequestParam Map<String, Object> map){ | ||
| 251 | + String result=ylbService.modifyRightsChange(); | ||
| 252 | + Map<String, Object> resMap = new HashMap<String, Object>(); | ||
| 253 | + resMap.put("text", result); | ||
| 254 | + return resMap; | ||
| 239 | } | 255 | } |
| 240 | 256 | ||
| 241 | @RequestMapping(value = "/sumYlb",method = RequestMethod.GET) | 257 | @RequestMapping(value = "/sumYlb",method = RequestMethod.GET) |
src/main/java/com/bsth/controller/realcontrol/ServiceDataInterface.java
| @@ -13,9 +13,12 @@ import com.bsth.data.gpsdata_v2.GpsRealData; | @@ -13,9 +13,12 @@ import com.bsth.data.gpsdata_v2.GpsRealData; | ||
| 13 | import com.bsth.data.gpsdata_v2.entity.GpsEntity; | 13 | import com.bsth.data.gpsdata_v2.entity.GpsEntity; |
| 14 | import com.bsth.data.schedule.DayOfSchedule; | 14 | import com.bsth.data.schedule.DayOfSchedule; |
| 15 | import com.bsth.data.schedule.external.TccExternalService; | 15 | import com.bsth.data.schedule.external.TccExternalService; |
| 16 | +import com.bsth.entity.Line; | ||
| 16 | import com.bsth.entity.directive.D60; | 17 | import com.bsth.entity.directive.D60; |
| 17 | import com.bsth.entity.realcontrol.ScheduleRealInfo; | 18 | import com.bsth.entity.realcontrol.ScheduleRealInfo; |
| 19 | +import com.bsth.repository.LineRepository; | ||
| 18 | import com.bsth.repository.directive.D60Repository; | 20 | import com.bsth.repository.directive.D60Repository; |
| 21 | +import com.bsth.service.LineService; | ||
| 19 | import com.bsth.websocket.handler.SendUtils; | 22 | import com.bsth.websocket.handler.SendUtils; |
| 20 | import com.fasterxml.jackson.databind.ObjectMapper; | 23 | import com.fasterxml.jackson.databind.ObjectMapper; |
| 21 | import com.google.common.base.Splitter; | 24 | import com.google.common.base.Splitter; |
| @@ -59,6 +62,13 @@ public class ServiceDataInterface { | @@ -59,6 +62,13 @@ public class ServiceDataInterface { | ||
| 59 | @Autowired | 62 | @Autowired |
| 60 | private SendUtils sendUtils; | 63 | private SendUtils sendUtils; |
| 61 | 64 | ||
| 65 | + | ||
| 66 | + @Autowired | ||
| 67 | + LineRepository lineRepository; | ||
| 68 | + | ||
| 69 | + @Autowired | ||
| 70 | + private LineService service; | ||
| 71 | + | ||
| 62 | /** | 72 | /** |
| 63 | * 获取车辆 和 当前执行班次对照信息 | 73 | * 获取车辆 和 当前执行班次对照信息 |
| 64 | * | 74 | * |
| @@ -324,9 +334,26 @@ public class ServiceDataInterface { | @@ -324,9 +334,26 @@ public class ServiceDataInterface { | ||
| 324 | 334 | ||
| 325 | ObjectMapper mapper = new ObjectMapper(); | 335 | ObjectMapper mapper = new ObjectMapper(); |
| 326 | try { | 336 | try { |
| 337 | + List<Map<String,String>> emergencyList = new ArrayList(); | ||
| 338 | + List<Map<String,String>> emergencyListAll = new ArrayList(); | ||
| 327 | List<Map> maps = mapper.readValue(jsonStr,mapper.getTypeFactory().constructParametricType(List.class, Map.class)); | 339 | List<Map> maps = mapper.readValue(jsonStr,mapper.getTypeFactory().constructParametricType(List.class, Map.class)); |
| 328 | for (Map map : maps) { | 340 | for (Map map : maps) { |
| 329 | sendUtils.sendContingencyPlan(map); | 341 | sendUtils.sendContingencyPlan(map); |
| 342 | + emergencyList.add((Map<String, String>) map.get("emergencyLine")); | ||
| 343 | + } | ||
| 344 | + | ||
| 345 | + for (Map.Entry<String, String> m : BasicData.lineCode2NameMap.entrySet()){ | ||
| 346 | + for (Map<String,String> emer : emergencyList){ | ||
| 347 | + for (Map.Entry<String,String> t : emer.entrySet()){ | ||
| 348 | + if(m.getKey().equals(t.getKey())){ | ||
| 349 | + emergencyListAll.add(emer); // | ||
| 350 | + Line line = lineRepository.findById(Integer.parseInt(t.getKey())).get(); | ||
| 351 | + line.setName(t.getValue()); | ||
| 352 | + Map<String, Object> status = service.update(line); | ||
| 353 | + logger.info("应急接口修改线路名称-----------------------"+status.get("status")); | ||
| 354 | + } | ||
| 355 | + } | ||
| 356 | + } | ||
| 330 | } | 357 | } |
| 331 | } catch (IOException e) { | 358 | } catch (IOException e) { |
| 332 | result.put("errCode", 502); | 359 | result.put("errCode", 502); |
src/main/java/com/bsth/controller/report/ReportController.java
| @@ -218,8 +218,9 @@ public class ReportController { | @@ -218,8 +218,9 @@ public class ReportController { | ||
| 218 | return new ArrayList<Map<String, Object>>(); | 218 | return new ArrayList<Map<String, Object>>(); |
| 219 | } | 219 | } |
| 220 | @RequestMapping(value = "/sreachZd", method = RequestMethod.GET) | 220 | @RequestMapping(value = "/sreachZd", method = RequestMethod.GET) |
| 221 | - public List<Map<String, String>> sreachPersonnel(@RequestParam String line,@RequestParam int zdlx) { | ||
| 222 | - return service.sreachZd(line,zdlx); | 221 | + public List<Map<String, String>> sreachPersonnel(@RequestParam String line,@RequestParam int zdlx, |
| 222 | + @RequestParam String date1,@RequestParam String date2) { | ||
| 223 | + return service.sreachZd(line,zdlx,date1,date2); | ||
| 223 | } | 224 | } |
| 224 | 225 | ||
| 225 | 226 |
src/main/java/com/bsth/controller/schedule/TrafficManageController.java
| 1 | -package com.bsth.controller.schedule; | ||
| 2 | - | ||
| 3 | -import com.bsth.service.TrafficManageService; | ||
| 4 | - | ||
| 5 | -import org.springframework.beans.factory.annotation.Autowired; | ||
| 6 | -import org.springframework.web.bind.annotation.RequestMapping; | ||
| 7 | -import org.springframework.web.bind.annotation.RequestMethod; | ||
| 8 | -import org.springframework.web.bind.annotation.RequestParam; | ||
| 9 | -import org.springframework.web.bind.annotation.RestController; | ||
| 10 | - | ||
| 11 | -/** | ||
| 12 | - * | ||
| 13 | - * @author BSTH | ||
| 14 | - * | ||
| 15 | - */ | ||
| 16 | -@RestController | ||
| 17 | -@RequestMapping("trmg") | ||
| 18 | -public class TrafficManageController { | ||
| 19 | - | ||
| 20 | - @Autowired | ||
| 21 | - private TrafficManageService trManageService; | ||
| 22 | - | ||
| 23 | - | ||
| 24 | - @RequestMapping(value = "/setXL", method = RequestMethod.GET) | ||
| 25 | - public String setXL(@RequestParam("ids") String ids) throws Exception { | ||
| 26 | - try { | ||
| 27 | - return trManageService.setXL(ids); | ||
| 28 | - } catch (Exception exp) { | ||
| 29 | - throw new Exception(exp.getCause()); | ||
| 30 | - } | ||
| 31 | - } | ||
| 32 | - | ||
| 33 | - @RequestMapping(value = "/setXLByInUse", method = RequestMethod.GET) | ||
| 34 | - public String setXLByInUse(@RequestParam("inUse") String inUse) throws Exception { | ||
| 35 | - try { | ||
| 36 | - return trManageService.setXLByInUse(inUse); | ||
| 37 | - } catch (Exception exp) { | ||
| 38 | - throw new Exception(exp.getCause()); | ||
| 39 | - } | ||
| 40 | - } | ||
| 41 | - | ||
| 42 | - @RequestMapping(value = "/setCL", method = RequestMethod.GET) | ||
| 43 | - public String setCL() throws Exception { | ||
| 44 | - try { | ||
| 45 | - return trManageService.setCL(); | ||
| 46 | - } catch (Exception exp) { | ||
| 47 | - throw new Exception(exp.getCause()); | ||
| 48 | - } | ||
| 49 | - } | ||
| 50 | - | ||
| 51 | - @RequestMapping(value = "/setSJ", method = RequestMethod.GET) | ||
| 52 | - public String setSJ() throws Exception { | ||
| 53 | - try { | ||
| 54 | - return trManageService.setSJ(); | ||
| 55 | - } catch (Exception exp) { | ||
| 56 | - throw new Exception(exp.getCause()); | ||
| 57 | - } | ||
| 58 | - } | ||
| 59 | - | ||
| 60 | - @RequestMapping(value = "/setLD", method = RequestMethod.GET) | ||
| 61 | - public String setLD() throws Exception { | ||
| 62 | - try { | ||
| 63 | - return trManageService.setLD(); | ||
| 64 | - } catch (Exception exp) { | ||
| 65 | - throw new Exception(exp.getCause()); | ||
| 66 | - } | ||
| 67 | - } | ||
| 68 | - | ||
| 69 | - @RequestMapping(value = "/setLDByDate", method = RequestMethod.GET) | ||
| 70 | - public String setLDByDate(@RequestParam("theDate") String theDate) throws Exception { | ||
| 71 | - try { | ||
| 72 | - return trManageService.setLD(theDate); | ||
| 73 | - } catch (Exception exp) { | ||
| 74 | - throw new Exception(exp.getCause()); | ||
| 75 | - } | ||
| 76 | - } | ||
| 77 | - | ||
| 78 | - @RequestMapping(value = "/setLDFile", method = RequestMethod.GET) | ||
| 79 | - public String setLDFile() throws Exception { | ||
| 80 | - try { | ||
| 81 | - return trManageService.setLDFile(); | ||
| 82 | - } catch (Exception exp) { | ||
| 83 | - throw new Exception(exp.getCause()); | ||
| 84 | - } | ||
| 85 | - } | ||
| 86 | - | ||
| 87 | - @RequestMapping(value = "/setLCYH", method = RequestMethod.GET) | ||
| 88 | - public String setLCYH() throws Exception { | ||
| 89 | - try { | ||
| 90 | - return trManageService.setLCYH(); | ||
| 91 | - } catch (Exception exp) { | ||
| 92 | - throw new Exception(exp.getCause()); | ||
| 93 | - } | ||
| 94 | - } | ||
| 95 | - | ||
| 96 | - @RequestMapping(value = "/setDDRB", method = RequestMethod.GET) | ||
| 97 | - public String setDDRB() throws Exception { | ||
| 98 | - try { | ||
| 99 | - return trManageService.setDDRB(); | ||
| 100 | - } catch (Exception exp) { | ||
| 101 | - throw new Exception(exp.getCause()); | ||
| 102 | - } | ||
| 103 | - } | ||
| 104 | - | ||
| 105 | - @RequestMapping(value = "/setJHBC", method = RequestMethod.GET) | ||
| 106 | - public String setJHBC() throws Exception { | ||
| 107 | - try { | ||
| 108 | - return trManageService.setJHBC(); | ||
| 109 | - } catch (Exception exp) { | ||
| 110 | - throw new Exception(exp.getCause()); | ||
| 111 | - } | ||
| 112 | - } | ||
| 113 | - | ||
| 114 | - @RequestMapping(value = "/setJHBCByDate", method = RequestMethod.GET) | ||
| 115 | - public String setJHBCByDate(@RequestParam("theDate") String theDate) throws Exception { | ||
| 116 | - try { | ||
| 117 | - return trManageService.setJHBC(theDate); | ||
| 118 | - } catch (Exception exp) { | ||
| 119 | - throw new Exception(exp.getCause()); | ||
| 120 | - } | ||
| 121 | - } | ||
| 122 | - | ||
| 123 | - @RequestMapping(value = "/setSKB", method = RequestMethod.GET) | ||
| 124 | - public String setSKB(@RequestParam("ids") String ids) throws Exception { | ||
| 125 | - try { | ||
| 126 | - return trManageService.setSKB(ids); | ||
| 127 | - } catch (Exception exp) { | ||
| 128 | - throw new Exception(exp.getCause()); | ||
| 129 | - } | ||
| 130 | - } | ||
| 131 | - | ||
| 132 | - @RequestMapping(value = "/setXLPC", method = RequestMethod.GET) | ||
| 133 | - public String setXLPC() throws Exception { | ||
| 134 | - try { | ||
| 135 | - return trManageService.setXLPC(); | ||
| 136 | - } catch (Exception exp) { | ||
| 137 | - throw new Exception(exp.getCause()); | ||
| 138 | - } | ||
| 139 | - } | ||
| 140 | - | ||
| 141 | - @RequestMapping(value = "/setCS", method = RequestMethod.GET) | ||
| 142 | - public String setCS() throws Exception { | ||
| 143 | - try { | ||
| 144 | - return trManageService.setCS(); | ||
| 145 | - } catch (Exception exp) { | ||
| 146 | - throw new Exception(exp.getCause()); | ||
| 147 | - } | ||
| 148 | - } | ||
| 149 | - | ||
| 150 | - @RequestMapping(value = "/getDownLoadAllDataFile", method = RequestMethod.GET) | ||
| 151 | - public String getDownLoadAllDataFile() throws Exception { | ||
| 152 | - try { | ||
| 153 | - return trManageService.getDownLoadAllDataFile(); | ||
| 154 | - } catch (Exception exp) { | ||
| 155 | - throw new Exception(exp.getCause()); | ||
| 156 | - } | ||
| 157 | - } | ||
| 158 | - | ||
| 159 | -} | 1 | +package com.bsth.controller.schedule; |
| 2 | + | ||
| 3 | +import com.bsth.service.TrafficManageService; | ||
| 4 | + | ||
| 5 | +import org.springframework.beans.factory.annotation.Autowired; | ||
| 6 | +import org.springframework.web.bind.annotation.RequestMapping; | ||
| 7 | +import org.springframework.web.bind.annotation.RequestMethod; | ||
| 8 | +import org.springframework.web.bind.annotation.RequestParam; | ||
| 9 | +import org.springframework.web.bind.annotation.RestController; | ||
| 10 | + | ||
| 11 | +/** | ||
| 12 | + * | ||
| 13 | + * @author BSTH | ||
| 14 | + * | ||
| 15 | + */ | ||
| 16 | +@RestController | ||
| 17 | +@RequestMapping("trmg") | ||
| 18 | +public class TrafficManageController { | ||
| 19 | + | ||
| 20 | + @Autowired | ||
| 21 | + private TrafficManageService trManageService; | ||
| 22 | + | ||
| 23 | + | ||
| 24 | + @RequestMapping(value = "/setXL", method = RequestMethod.GET) | ||
| 25 | + public String setXL(@RequestParam("ids") String ids) throws Exception { | ||
| 26 | + try { | ||
| 27 | + return trManageService.setXL(ids); | ||
| 28 | + } catch (Exception exp) { | ||
| 29 | + throw new Exception(exp.getCause()); | ||
| 30 | + } | ||
| 31 | + } | ||
| 32 | + | ||
| 33 | + @RequestMapping(value = "/setXLByInUse", method = RequestMethod.GET) | ||
| 34 | + public String setXLByInUse(@RequestParam("inUse") String inUse) throws Exception { | ||
| 35 | + try { | ||
| 36 | + return trManageService.setXLByInUse(inUse); | ||
| 37 | + } catch (Exception exp) { | ||
| 38 | + throw new Exception(exp.getCause()); | ||
| 39 | + } | ||
| 40 | + } | ||
| 41 | + | ||
| 42 | + @RequestMapping(value = "/setCL", method = RequestMethod.GET) | ||
| 43 | + public String setCL() throws Exception { | ||
| 44 | + try { | ||
| 45 | + return trManageService.setCL(); | ||
| 46 | + } catch (Exception exp) { | ||
| 47 | + throw new Exception(exp.getCause()); | ||
| 48 | + } | ||
| 49 | + } | ||
| 50 | + | ||
| 51 | + @RequestMapping(value = "/setSJ", method = RequestMethod.GET) | ||
| 52 | + public String setSJ() throws Exception { | ||
| 53 | + try { | ||
| 54 | + return trManageService.setSJ(); | ||
| 55 | + } catch (Exception exp) { | ||
| 56 | + throw new Exception(exp.getCause()); | ||
| 57 | + } | ||
| 58 | + } | ||
| 59 | + | ||
| 60 | + @RequestMapping(value = "/setLD", method = RequestMethod.GET) | ||
| 61 | + public String setLD() throws Exception { | ||
| 62 | + try { | ||
| 63 | + return trManageService.setLD(); | ||
| 64 | + } catch (Exception exp) { | ||
| 65 | + throw new Exception(exp.getCause()); | ||
| 66 | + } | ||
| 67 | + } | ||
| 68 | + | ||
| 69 | + @RequestMapping(value = "/setLDByDate", method = RequestMethod.GET) | ||
| 70 | + public String setLDByDate(@RequestParam("theDate") String theDate) throws Exception { | ||
| 71 | + try { | ||
| 72 | + return trManageService.setLD(theDate); | ||
| 73 | + } catch (Exception exp) { | ||
| 74 | + throw new Exception(exp.getCause()); | ||
| 75 | + } | ||
| 76 | + } | ||
| 77 | + | ||
| 78 | + @RequestMapping(value = "/setLDFile", method = RequestMethod.GET) | ||
| 79 | + public String setLDFile() throws Exception { | ||
| 80 | + try { | ||
| 81 | + return trManageService.setLDFile(); | ||
| 82 | + } catch (Exception exp) { | ||
| 83 | + throw new Exception(exp.getCause()); | ||
| 84 | + } | ||
| 85 | + } | ||
| 86 | + | ||
| 87 | + @RequestMapping(value = "/setLCYH", method = RequestMethod.GET) | ||
| 88 | + public String setLCYH() throws Exception { | ||
| 89 | + try { | ||
| 90 | + return trManageService.setLCYH(); | ||
| 91 | + } catch (Exception exp) { | ||
| 92 | + throw new Exception(exp.getCause()); | ||
| 93 | + } | ||
| 94 | + } | ||
| 95 | + | ||
| 96 | + @RequestMapping(value = "/setDDRB", method = RequestMethod.GET) | ||
| 97 | + public String setDDRB() throws Exception { | ||
| 98 | + try { | ||
| 99 | + return trManageService.setDDRB(); | ||
| 100 | + } catch (Exception exp) { | ||
| 101 | + throw new Exception(exp.getCause()); | ||
| 102 | + } | ||
| 103 | + } | ||
| 104 | + | ||
| 105 | + @RequestMapping(value = "/setJHBC", method = RequestMethod.GET) | ||
| 106 | + public String setJHBC() throws Exception { | ||
| 107 | + try { | ||
| 108 | + return trManageService.setJHBC(); | ||
| 109 | + } catch (Exception exp) { | ||
| 110 | + throw new Exception(exp.getCause()); | ||
| 111 | + } | ||
| 112 | + } | ||
| 113 | + | ||
| 114 | + @RequestMapping(value = "/setJHBCByDate", method = RequestMethod.GET) | ||
| 115 | + public String setJHBCByDate(@RequestParam("theDate") String theDate) throws Exception { | ||
| 116 | + try { | ||
| 117 | + return trManageService.setJHBC(theDate); | ||
| 118 | + } catch (Exception exp) { | ||
| 119 | + throw new Exception(exp.getCause()); | ||
| 120 | + } | ||
| 121 | + } | ||
| 122 | + | ||
| 123 | + @RequestMapping(value = "/setSKB", method = RequestMethod.GET) | ||
| 124 | + public String setSKB(@RequestParam("ids") String ids, @RequestParam("qyrqs") String qyrqs) throws Exception { | ||
| 125 | + try { | ||
| 126 | + return trManageService.setSKB(ids, qyrqs); | ||
| 127 | + } catch (Exception exp) { | ||
| 128 | + throw new Exception(exp.getCause()); | ||
| 129 | + } | ||
| 130 | + } | ||
| 131 | + | ||
| 132 | + @RequestMapping(value = "/setXLPC", method = RequestMethod.GET) | ||
| 133 | + public String setXLPC() throws Exception { | ||
| 134 | + try { | ||
| 135 | + return trManageService.setXLPC(); | ||
| 136 | + } catch (Exception exp) { | ||
| 137 | + throw new Exception(exp.getCause()); | ||
| 138 | + } | ||
| 139 | + } | ||
| 140 | + | ||
| 141 | + @RequestMapping(value = "/setCS", method = RequestMethod.GET) | ||
| 142 | + public String setCS() throws Exception { | ||
| 143 | + try { | ||
| 144 | + return trManageService.setCS(); | ||
| 145 | + } catch (Exception exp) { | ||
| 146 | + throw new Exception(exp.getCause()); | ||
| 147 | + } | ||
| 148 | + } | ||
| 149 | + | ||
| 150 | + @RequestMapping(value = "/getDownLoadAllDataFile", method = RequestMethod.GET) | ||
| 151 | + public String getDownLoadAllDataFile() throws Exception { | ||
| 152 | + try { | ||
| 153 | + return trManageService.getDownLoadAllDataFile(); | ||
| 154 | + } catch (Exception exp) { | ||
| 155 | + throw new Exception(exp.getCause()); | ||
| 156 | + } | ||
| 157 | + } | ||
| 158 | + | ||
| 159 | +} |
src/main/java/com/bsth/data/gpsdata_v2/DataHandleProcess.java
| @@ -6,6 +6,7 @@ import com.bsth.data.gpsdata_v2.entity.GpsEntity; | @@ -6,6 +6,7 @@ import com.bsth.data.gpsdata_v2.entity.GpsEntity; | ||
| 6 | import com.bsth.data.gpsdata_v2.handlers.*; | 6 | import com.bsth.data.gpsdata_v2.handlers.*; |
| 7 | import com.bsth.email.SendEmailController; | 7 | import com.bsth.email.SendEmailController; |
| 8 | import com.bsth.email.entity.EmailBean; | 8 | import com.bsth.email.entity.EmailBean; |
| 9 | +import com.bsth.util.IpUtils; | ||
| 9 | import com.fasterxml.jackson.databind.ObjectMapper; | 10 | import com.fasterxml.jackson.databind.ObjectMapper; |
| 10 | import com.google.common.collect.ArrayListMultimap; | 11 | import com.google.common.collect.ArrayListMultimap; |
| 11 | import org.apache.commons.lang3.StringUtils; | 12 | import org.apache.commons.lang3.StringUtils; |
| @@ -109,7 +110,7 @@ public class DataHandleProcess { | @@ -109,7 +110,7 @@ public class DataHandleProcess { | ||
| 109 | //发送邮件 | 110 | //发送邮件 |
| 110 | EmailBean mail = new EmailBean(); | 111 | EmailBean mail = new EmailBean(); |
| 111 | mail.setSubject("线调GPS处理"); | 112 | mail.setSubject("线调GPS处理"); |
| 112 | - mail.setContent("GPS处理超时,检查日志信息<br/>"); | 113 | + mail.setContent(IpUtils.getLocalIpAddress() + "GPS处理超时,检查日志信息<br/>"); |
| 113 | sendEmailController.sendMail("113252620@qq.com", mail); | 114 | sendEmailController.sendMail("113252620@qq.com", mail); |
| 114 | logger.info(new ObjectMapper().writeValueAsString(list)); | 115 | logger.info(new ObjectMapper().writeValueAsString(list)); |
| 115 | logger.info("DataHandlerProcess:邮件发送成功!"); | 116 | logger.info("DataHandlerProcess:邮件发送成功!"); |
src/main/java/com/bsth/data/schedule/DayOfSchedule.java
| @@ -1020,6 +1020,7 @@ public class DayOfSchedule { | @@ -1020,6 +1020,7 @@ public class DayOfSchedule { | ||
| 1020 | } | 1020 | } |
| 1021 | inStr.deleteCharAt(inStr.length() - 1).append(")"); | 1021 | inStr.deleteCharAt(inStr.length() - 1).append(")"); |
| 1022 | jdbcTemplate.update(Constants.MULTI_REMOVE_DIRECTIVE_SCH_FK + " " + inStr.toString()); | 1022 | jdbcTemplate.update(Constants.MULTI_REMOVE_DIRECTIVE_SCH_FK + " " + inStr.toString()); |
| 1023 | + jdbcTemplate.update(Constants.MULTI_REMOVE_CHILDTASK_SCH_FK + " " + inStr.toString()); | ||
| 1023 | } | 1024 | } |
| 1024 | 1025 | ||
| 1025 | //删除班次数据 | 1026 | //删除班次数据 |
src/main/java/com/bsth/entity/CarPark.java
| @@ -40,7 +40,7 @@ public class CarPark { | @@ -40,7 +40,7 @@ public class CarPark { | ||
| 40 | 40 | ||
| 41 | // 地理位置(百度坐标) | 41 | // 地理位置(百度坐标) |
| 42 | private String bParkPoint; | 42 | private String bParkPoint; |
| 43 | - | 43 | + |
| 44 | // 地理位置中心点(百度坐标) | 44 | // 地理位置中心点(百度坐标) |
| 45 | private String bCenterPoint; | 45 | private String bCenterPoint; |
| 46 | 46 | ||
| @@ -81,7 +81,7 @@ public class CarPark { | @@ -81,7 +81,7 @@ public class CarPark { | ||
| 81 | private String brancheCompany; | 81 | private String brancheCompany; |
| 82 | 82 | ||
| 83 | /** 组合公司分公司编码 */ | 83 | /** 组合公司分公司编码 */ |
| 84 | - @Formula(" concat(company, '_', branche_company) ") | 84 | + @Transient |
| 85 | private String cgsbm; | 85 | private String cgsbm; |
| 86 | 86 | ||
| 87 | // 是否撤销 | 87 | // 是否撤销 |
| @@ -106,14 +106,6 @@ public class CarPark { | @@ -106,14 +106,6 @@ public class CarPark { | ||
| 106 | // 修改日期 | 106 | // 修改日期 |
| 107 | @Column(name = "update_date", columnDefinition = "TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP") | 107 | @Column(name = "update_date", columnDefinition = "TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP") |
| 108 | private Date updateDate; | 108 | private Date updateDate; |
| 109 | - | ||
| 110 | - public String getCgsbm() { | ||
| 111 | - return cgsbm; | ||
| 112 | - } | ||
| 113 | - | ||
| 114 | - public void setCgsbm(String cgsbm) { | ||
| 115 | - this.cgsbm = cgsbm; | ||
| 116 | - } | ||
| 117 | 109 | ||
| 118 | public Integer getId() { | 110 | public Integer getId() { |
| 119 | return id; | 111 | return id; |
| @@ -219,6 +211,14 @@ public class CarPark { | @@ -219,6 +211,14 @@ public class CarPark { | ||
| 219 | this.company = company; | 211 | this.company = company; |
| 220 | } | 212 | } |
| 221 | 213 | ||
| 214 | + public String getCgsbm() { | ||
| 215 | + return this.company + "_" + this.brancheCompany; | ||
| 216 | + } | ||
| 217 | + | ||
| 218 | + public void setCgsbm(String cgsbm) { | ||
| 219 | + this.cgsbm = cgsbm; | ||
| 220 | + } | ||
| 221 | + | ||
| 222 | public Integer getDestroy() { | 222 | public Integer getDestroy() { |
| 223 | return destroy; | 223 | return destroy; |
| 224 | } | 224 | } |
src/main/java/com/bsth/entity/LsInoutSectionRoute.java
0 → 100644
| 1 | +package com.bsth.entity; | ||
| 2 | + | ||
| 3 | +import javax.persistence.*; | ||
| 4 | +import java.util.Date; | ||
| 5 | + | ||
| 6 | + | ||
| 7 | +/** | ||
| 8 | + * | ||
| 9 | + * @ClassName : LsInoutSectionRoute(历史进出场路段路由实体类) | ||
| 10 | + * | ||
| 11 | + * @Author : bsth@lq | ||
| 12 | + * | ||
| 13 | + * @Description : TODO(历史路段路由) | ||
| 14 | + * | ||
| 15 | + * @Version 公交调度系统BS版 0.1 | ||
| 16 | + * | ||
| 17 | + */ | ||
| 18 | + | ||
| 19 | +@Entity | ||
| 20 | +@Table(name = "bsth_c_ls_inout_sectionroute") | ||
| 21 | +public class LsInoutSectionRoute { | ||
| 22 | + | ||
| 23 | + @Id | ||
| 24 | + @GeneratedValue(strategy = GenerationType.IDENTITY) | ||
| 25 | + private Long id; | ||
| 26 | + | ||
| 27 | + // 路段路由序号 | ||
| 28 | + private Integer sectionrouteCode; | ||
| 29 | + | ||
| 30 | + // 线路编号 | ||
| 31 | + private String lineCode; | ||
| 32 | + | ||
| 33 | + /** | ||
| 34 | + * 进出场起点编码 | ||
| 35 | + */ | ||
| 36 | + private String start; | ||
| 37 | + | ||
| 38 | + /** | ||
| 39 | + * 进出场终点编码 | ||
| 40 | + */ | ||
| 41 | + private String end; | ||
| 42 | + | ||
| 43 | + // 路段编号 | ||
| 44 | + private String sectionCode; | ||
| 45 | + | ||
| 46 | + // 路段路由方向 | ||
| 47 | + private Integer directions; | ||
| 48 | + | ||
| 49 | + // 版本号 | ||
| 50 | + private Integer versions; | ||
| 51 | + | ||
| 52 | + // 是否撤销 | ||
| 53 | + private Integer destroy; | ||
| 54 | + | ||
| 55 | + // 描述 | ||
| 56 | + private String descriptions; | ||
| 57 | + | ||
| 58 | + // 创建人 | ||
| 59 | + private Integer createBy; | ||
| 60 | + | ||
| 61 | + // 修改人 | ||
| 62 | + private Integer updateBy; | ||
| 63 | + | ||
| 64 | + // 创建日期 | ||
| 65 | + @Column(updatable = false, name = "create_date", columnDefinition = "TIMESTAMP DEFAULT CURRENT_TIMESTAMP") | ||
| 66 | + private Date createDate; | ||
| 67 | + | ||
| 68 | + // 修改日期 | ||
| 69 | + @Column(name = "update_date", columnDefinition = "timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP") | ||
| 70 | + private Date updateDate; | ||
| 71 | + | ||
| 72 | + // 路段信息 | ||
| 73 | + @OneToOne | ||
| 74 | + private Section section; | ||
| 75 | + | ||
| 76 | + // 线路信息 | ||
| 77 | + @ManyToOne | ||
| 78 | + private Line line; | ||
| 79 | + | ||
| 80 | + public Long getId() { | ||
| 81 | + return id; | ||
| 82 | + } | ||
| 83 | + | ||
| 84 | + public void setId(Long id) { | ||
| 85 | + this.id = id; | ||
| 86 | + } | ||
| 87 | + | ||
| 88 | + public Integer getSectionrouteCode() { | ||
| 89 | + return sectionrouteCode; | ||
| 90 | + } | ||
| 91 | + | ||
| 92 | + public void setSectionrouteCode(Integer sectionrouteCode) { | ||
| 93 | + this.sectionrouteCode = sectionrouteCode; | ||
| 94 | + } | ||
| 95 | + | ||
| 96 | + public String getLineCode() { | ||
| 97 | + return lineCode; | ||
| 98 | + } | ||
| 99 | + | ||
| 100 | + public void setLineCode(String lineCode) { | ||
| 101 | + this.lineCode = lineCode; | ||
| 102 | + } | ||
| 103 | + | ||
| 104 | + public String getStart() { | ||
| 105 | + return start; | ||
| 106 | + } | ||
| 107 | + | ||
| 108 | + public void setStart(String start) { | ||
| 109 | + this.start = start; | ||
| 110 | + } | ||
| 111 | + | ||
| 112 | + public String getEnd() { | ||
| 113 | + return end; | ||
| 114 | + } | ||
| 115 | + | ||
| 116 | + public void setEnd(String end) { | ||
| 117 | + this.end = end; | ||
| 118 | + } | ||
| 119 | + | ||
| 120 | + public String getSectionCode() { | ||
| 121 | + return sectionCode; | ||
| 122 | + } | ||
| 123 | + | ||
| 124 | + public void setSectionCode(String sectionCode) { | ||
| 125 | + this.sectionCode = sectionCode; | ||
| 126 | + } | ||
| 127 | + | ||
| 128 | + public Integer getDirections() { | ||
| 129 | + return directions; | ||
| 130 | + } | ||
| 131 | + | ||
| 132 | + public void setDirections(Integer directions) { | ||
| 133 | + this.directions = directions; | ||
| 134 | + } | ||
| 135 | + | ||
| 136 | + public Integer getVersions() { | ||
| 137 | + return versions; | ||
| 138 | + } | ||
| 139 | + | ||
| 140 | + public void setVersions(Integer versions) { | ||
| 141 | + this.versions = versions; | ||
| 142 | + } | ||
| 143 | + | ||
| 144 | + public Integer getDestroy() { | ||
| 145 | + return destroy; | ||
| 146 | + } | ||
| 147 | + | ||
| 148 | + public void setDestroy(Integer destroy) { | ||
| 149 | + this.destroy = destroy; | ||
| 150 | + } | ||
| 151 | + | ||
| 152 | + public String getDescriptions() { | ||
| 153 | + return descriptions; | ||
| 154 | + } | ||
| 155 | + | ||
| 156 | + public void setDescriptions(String descriptions) { | ||
| 157 | + this.descriptions = descriptions; | ||
| 158 | + } | ||
| 159 | + | ||
| 160 | + public Integer getCreateBy() { | ||
| 161 | + return createBy; | ||
| 162 | + } | ||
| 163 | + | ||
| 164 | + public void setCreateBy(Integer createBy) { | ||
| 165 | + this.createBy = createBy; | ||
| 166 | + } | ||
| 167 | + | ||
| 168 | + public Integer getUpdateBy() { | ||
| 169 | + return updateBy; | ||
| 170 | + } | ||
| 171 | + | ||
| 172 | + public void setUpdateBy(Integer updateBy) { | ||
| 173 | + this.updateBy = updateBy; | ||
| 174 | + } | ||
| 175 | + | ||
| 176 | + public Date getCreateDate() { | ||
| 177 | + return createDate; | ||
| 178 | + } | ||
| 179 | + | ||
| 180 | + public void setCreateDate(Date createDate) { | ||
| 181 | + this.createDate = createDate; | ||
| 182 | + } | ||
| 183 | + | ||
| 184 | + public Date getUpdateDate() { | ||
| 185 | + return updateDate; | ||
| 186 | + } | ||
| 187 | + | ||
| 188 | + public void setUpdateDate(Date updateDate) { | ||
| 189 | + this.updateDate = updateDate; | ||
| 190 | + } | ||
| 191 | + | ||
| 192 | + public Section getSection() { | ||
| 193 | + return section; | ||
| 194 | + } | ||
| 195 | + | ||
| 196 | + public void setSection(Section section) { | ||
| 197 | + this.section = section; | ||
| 198 | + } | ||
| 199 | + | ||
| 200 | + public Line getLine() { | ||
| 201 | + return line; | ||
| 202 | + } | ||
| 203 | + | ||
| 204 | + public void setLine(Line line) { | ||
| 205 | + this.line = line; | ||
| 206 | + } | ||
| 207 | +} |
src/main/java/com/bsth/entity/Section.java
| 1 | package com.bsth.entity; | 1 | package com.bsth.entity; |
| 2 | 2 | ||
| 3 | +import org.hibernate.annotations.Formula; | ||
| 4 | + | ||
| 3 | import java.util.Date; | 5 | import java.util.Date; |
| 4 | 6 | ||
| 5 | import javax.persistence.Column; | 7 | import javax.persistence.Column; |
| @@ -53,12 +55,15 @@ public class Section{ | @@ -53,12 +55,15 @@ public class Section{ | ||
| 53 | private String sectionType; | 55 | private String sectionType; |
| 54 | 56 | ||
| 55 | // 路段矢量(空间坐标点集合)--GPS坐标点 | 57 | // 路段矢量(空间坐标点集合)--GPS坐标点 |
| 58 | + @Formula("ST_AsText(gsection_vector)") | ||
| 56 | private String gsectionVector; | 59 | private String gsectionVector; |
| 57 | 60 | ||
| 58 | // 路段矢量(空间坐标点集合)--百度原始坐标坐标点 | 61 | // 路段矢量(空间坐标点集合)--百度原始坐标坐标点 |
| 62 | + @Formula("ST_AsText(bsection_vector)") | ||
| 59 | private String bsectionVector; | 63 | private String bsectionVector; |
| 60 | 64 | ||
| 61 | // 路段矢量(空间坐标点集合)--城建坐标点 | 65 | // 路段矢量(空间坐标点集合)--城建坐标点 |
| 66 | + @Formula("ST_AsText(csection_vector)") | ||
| 62 | private String csectionVector; | 67 | private String csectionVector; |
| 63 | 68 | ||
| 64 | // 交叉路 | 69 | // 交叉路 |
src/main/java/com/bsth/entity/Station.java
| 1 | package com.bsth.entity; | 1 | package com.bsth.entity; |
| 2 | 2 | ||
| 3 | +import com.bsth.util.Geo.Point; | ||
| 3 | import com.fasterxml.jackson.annotation.JsonIgnoreProperties; | 4 | import com.fasterxml.jackson.annotation.JsonIgnoreProperties; |
| 5 | +import org.hibernate.annotations.Formula; | ||
| 6 | +import org.locationtech.jts.geom.Geometry; | ||
| 7 | +import org.locationtech.jts.io.WKBReader; | ||
| 4 | 8 | ||
| 5 | -import javax.persistence.Column; | ||
| 6 | -import javax.persistence.Entity; | ||
| 7 | -import javax.persistence.GeneratedValue; | ||
| 8 | -import javax.persistence.GenerationType; | ||
| 9 | -import javax.persistence.Id; | ||
| 10 | -import javax.persistence.Table; | 9 | +import javax.persistence.*; |
| 11 | 10 | ||
| 12 | import java.util.Arrays; | 11 | import java.util.Arrays; |
| 13 | import java.util.Date; | 12 | import java.util.Date; |
| 13 | +import java.util.List; | ||
| 14 | 14 | ||
| 15 | 15 | ||
| 16 | /** | 16 | /** |
| @@ -89,6 +89,9 @@ public class Station { | @@ -89,6 +89,9 @@ public class Station { | ||
| 89 | 89 | ||
| 90 | // 多边形空间原坐标坐标点集合 | 90 | // 多边形空间原坐标坐标点集合 |
| 91 | private byte[] bPolygonGrid; | 91 | private byte[] bPolygonGrid; |
| 92 | + | ||
| 93 | + @Transient | ||
| 94 | + private String bdPolygon; | ||
| 92 | 95 | ||
| 93 | /** | 96 | /** |
| 94 | * 是否撤销 | 97 | * 是否撤销 |
| @@ -272,6 +275,17 @@ public class Station { | @@ -272,6 +275,17 @@ public class Station { | ||
| 272 | this.bPolygonGrid = bPolygonGrid; | 275 | this.bPolygonGrid = bPolygonGrid; |
| 273 | } | 276 | } |
| 274 | 277 | ||
| 278 | + public String getBdPolygon() { | ||
| 279 | + if (bPolygonGrid == null) { | ||
| 280 | + return null; | ||
| 281 | + } | ||
| 282 | + Geometry geometry = getGeometryFromBytes(getbPolygonGrid()); | ||
| 283 | + if (geometry == null) { | ||
| 284 | + return null; | ||
| 285 | + } | ||
| 286 | + return geometry.toString(); | ||
| 287 | + } | ||
| 288 | + | ||
| 275 | public Integer getDestroy() { | 289 | public Integer getDestroy() { |
| 276 | return destroy; | 290 | return destroy; |
| 277 | } | 291 | } |
| @@ -328,6 +342,48 @@ public class Station { | @@ -328,6 +342,48 @@ public class Station { | ||
| 328 | this.updateDate = updateDate; | 342 | this.updateDate = updateDate; |
| 329 | } | 343 | } |
| 330 | 344 | ||
| 345 | + private static Geometry getGeometryFromBytes(byte[] geometryAsBytes) { | ||
| 346 | + Geometry geometry = null; | ||
| 347 | + try { | ||
| 348 | + // 字节数组小于5,说明geometry有问题 | ||
| 349 | + if (geometryAsBytes.length < 5) { | ||
| 350 | + throw new Exception("Invalid geometry inputStream - less than five bytes"); | ||
| 351 | + } | ||
| 352 | + | ||
| 353 | + //first four bytes of the geometry are the SRID, | ||
| 354 | + //followed by the actual WKB. Determine the SRID | ||
| 355 | + //这里是取字节数组的前4个来解析srid | ||
| 356 | + byte[] sridBytes = new byte[4]; | ||
| 357 | + System.arraycopy(geometryAsBytes, 0, sridBytes, 0, 4); | ||
| 358 | + boolean bigEndian = (geometryAsBytes[4] == 0x00); | ||
| 359 | + // 解析srid | ||
| 360 | + int srid = 0; | ||
| 361 | + if (bigEndian) { | ||
| 362 | + for (int i = 0; i < sridBytes.length; i++) { | ||
| 363 | + srid = (srid << 8) + (sridBytes[i] & 0xff); | ||
| 364 | + } | ||
| 365 | + } else { | ||
| 366 | + for (int i = 0; i < sridBytes.length; i++) { | ||
| 367 | + srid += (sridBytes[i] & 0xff) << (8 * i); | ||
| 368 | + } | ||
| 369 | + } | ||
| 370 | + | ||
| 371 | + //use the JTS WKBReader for WKB parsing | ||
| 372 | + WKBReader wkbReader = new WKBReader(); | ||
| 373 | + // 使用geotool的WKBReader 把字节数组转成geometry对象。 | ||
| 374 | + //copy the byte array, removing the first four | ||
| 375 | + //SRID bytes | ||
| 376 | + byte[] wkb = new byte[geometryAsBytes.length - 4]; | ||
| 377 | + System.arraycopy(geometryAsBytes, 4, wkb, 0, wkb.length); | ||
| 378 | + geometry = wkbReader.read(wkb); | ||
| 379 | + geometry.setSRID(srid); | ||
| 380 | + } catch (Exception e) { | ||
| 381 | + e.printStackTrace(); | ||
| 382 | + } | ||
| 383 | + | ||
| 384 | + return geometry; | ||
| 385 | + } | ||
| 386 | + | ||
| 331 | @Override | 387 | @Override |
| 332 | public String toString() { | 388 | public String toString() { |
| 333 | return "Station [id=" + id + ", stationCod=" + stationCod + ", stationName=" + stationName + ", roadCoding=" | 389 | return "Station [id=" + id + ", stationCod=" + stationCod + ", stationName=" + stationName + ", roadCoding=" |
src/main/java/com/bsth/entity/schedule/datasync/VehicleDataSyncTask.java
src/main/java/com/bsth/repository/CarParkRepository.java
| 1 | -package com.bsth.repository; | ||
| 2 | - | ||
| 3 | -import java.util.List; | ||
| 4 | - | ||
| 5 | -import org.springframework.data.jpa.repository.Modifying; | ||
| 6 | -import org.springframework.data.jpa.repository.Query; | ||
| 7 | -import org.springframework.stereotype.Repository; | ||
| 8 | -import org.springframework.transaction.annotation.Transactional; | ||
| 9 | - | ||
| 10 | -import com.bsth.entity.CarPark; | ||
| 11 | - | ||
| 12 | -@Repository | ||
| 13 | -public interface CarParkRepository extends BaseRepository<CarPark, Integer>{ | ||
| 14 | - | ||
| 15 | - // 查询最大ID | ||
| 16 | - @Query(value = "SELECT IFNULL(num,0) as maxId from (SELECT MAX(id) as num FROM bsth_c_car_park) k" | ||
| 17 | - , nativeQuery=true) | ||
| 18 | - public long carParkMaxId(); | ||
| 19 | - | ||
| 20 | - @Transactional | ||
| 21 | - @Modifying | ||
| 22 | - @Query(value="INSERT INTO bsth_c_car_park (" + | ||
| 23 | - " area , company , park_code , park_name , branche_company , " + | ||
| 24 | - | ||
| 25 | - "create_by , create_date , descriptions , destroy, update_by, " + | ||
| 26 | - | ||
| 27 | - "update_date , versions , b_center_point , b_park_point ,db_type, " + | ||
| 28 | - | ||
| 29 | - "g_center_point, g_park_point, radius, shapes_type) " + | ||
| 30 | - | ||
| 31 | - " VALUES(" + | ||
| 32 | - "?1 , ?2 , ?3 , ?4 , ?5," + | ||
| 33 | - | ||
| 34 | - "?6 , str_to_date(?7,'%Y-%m-%d %H:%i:%s') , ?8 , ?9 , ?10," + | ||
| 35 | - | ||
| 36 | - "str_to_date(?11,'%Y-%m-%d %H:%i:%s'), ?12 ,?13,ST_GeomFromText(?14), ?15, " + | ||
| 37 | - | ||
| 38 | - "?16, ST_GeomFromText(?17), ?18,?19)", nativeQuery=true) | ||
| 39 | - public void carParkSave(Double area,String company,String parkCode,String parkName, | ||
| 40 | - | ||
| 41 | - String brancheCompany,Integer createBy,String createDate,String descriptions,Integer destroy, | ||
| 42 | - | ||
| 43 | - Integer updateBy,String updateDate,Integer versions,String bCenterPoint,String bParkPoint, | ||
| 44 | - | ||
| 45 | - String dbType,String gCenterPoint,String gParkPoint,Integer radius,String shapesType); | ||
| 46 | - | ||
| 47 | - | ||
| 48 | - /** | ||
| 49 | - * @Description :TODO(查询路段信息) | ||
| 50 | - * | ||
| 51 | - * @param map <id:路段路由ID> | ||
| 52 | - * | ||
| 53 | - * @return List<Object[]> | ||
| 54 | - */ | ||
| 55 | - @Query(value ="SELECT k.id AS carParkId," + | ||
| 56 | - "k.area AS carParkArea," + | ||
| 57 | - "k.company AS carParkCompany," + | ||
| 58 | - "k.park_code AS carParkCode," + | ||
| 59 | - "k.park_name AS carParkName," + | ||
| 60 | - "k.branche_company AS carParkBrancheCompany," + | ||
| 61 | - "k.create_by AS carParkCreateBy," + | ||
| 62 | - "k.create_date AS carParkCreateDate," + | ||
| 63 | - "k.descriptions AS carParkDescriptions," + | ||
| 64 | - "k.destroy AS carParkDestroy," + | ||
| 65 | - "k.update_by AS carParkUpdate," + | ||
| 66 | - "k.update_date AS carParkUpdateDate," + | ||
| 67 | - "k.versions AS carParkVersions," + | ||
| 68 | - "k.b_center_point AS carParkBcenterPoint," + | ||
| 69 | - "ST_AsText(k.b_park_point) AS carParkBparkPoint," + | ||
| 70 | - "k.g_center_point AS carParkGcenterPoint," + | ||
| 71 | - "ST_AsText(k.g_park_point) AS carParkGparkPoint, " + | ||
| 72 | - "k.db_type AS carParkDBtype," + | ||
| 73 | - "k.radius AS carParkRadius," + | ||
| 74 | - "k.shapes_type AS carParkShapesType FROM bsth_c_car_park k where k.id = ?1", nativeQuery=true) | ||
| 75 | - List<Object[]> findCarParkInfoFormId(int id); | ||
| 76 | - | ||
| 77 | - @Transactional | ||
| 78 | - @Modifying | ||
| 79 | - @Query(value="UPDATE bsth_c_car_park SET " + | ||
| 80 | - "area = ?1 , " + | ||
| 81 | - "company = ?2 , " + | ||
| 82 | - "park_code = ?3 , " + | ||
| 83 | - "park_name = ?4 , " + | ||
| 84 | - "branche_company = ?5 , " + | ||
| 85 | - "create_by = ?6 , " + | ||
| 86 | - "create_date = str_to_date(?7,'%Y-%m-%d %H:%i:%s') , " + | ||
| 87 | - "descriptions = ?8 , " + | ||
| 88 | - "destroy = ?9 , " + | ||
| 89 | - "update_by = ?10 , " + | ||
| 90 | - "update_date =str_to_date(?11,'%Y-%m-%d %H:%i:%s') , " + | ||
| 91 | - "versions = ?12 , " + | ||
| 92 | - "b_center_point = ?13 , " + | ||
| 93 | - "g_center_point = ?14 , " + | ||
| 94 | - "b_park_point = ST_GeomFromText(?15) , " + | ||
| 95 | - "g_park_point = ST_GeomFromText(?16) , " + | ||
| 96 | - "db_type = ?17 , " + | ||
| 97 | - "radius = ?18 , " + | ||
| 98 | - "shapes_type = ?19 " + | ||
| 99 | - " WHERE id = ?20 ", nativeQuery=true) | ||
| 100 | - public void carParkUpdate(double area,String company,String parkCode,String parkName,String brancheCompany, | ||
| 101 | - | ||
| 102 | - Integer createBy ,String createDate,String descriptions,Integer destroy,Integer updateBy, | ||
| 103 | - | ||
| 104 | - String updateDate,Integer versions,String bCenterPoint,String gCenterPoint,String bParkPoint, | ||
| 105 | - | ||
| 106 | - String gParkPoint,String dbType,Integer radius,String shapesType,Integer id ); | ||
| 107 | - | ||
| 108 | - @Query(value = "select st_astext(g_park_point), shapes_type, g_center_point, radius,park_code,park_name from bsth_c_car_park where park_code=?1", nativeQuery = true) | ||
| 109 | - public Object[][] bufferAera(String parkCode); | ||
| 110 | - | ||
| 111 | - @Query(value ="SELECT p.park_name,p.park_code from bsth_c_car_park p where p.park_code = ?1", nativeQuery=true) | ||
| 112 | - List<Object[]> selectTccInfoByCode(String parkCode); | ||
| 113 | -} | 1 | +package com.bsth.repository; |
| 2 | + | ||
| 3 | +import java.util.List; | ||
| 4 | + | ||
| 5 | +import org.springframework.data.jpa.repository.Modifying; | ||
| 6 | +import org.springframework.data.jpa.repository.Query; | ||
| 7 | +import org.springframework.stereotype.Repository; | ||
| 8 | +import org.springframework.transaction.annotation.Transactional; | ||
| 9 | + | ||
| 10 | +import com.bsth.entity.CarPark; | ||
| 11 | + | ||
| 12 | +@Repository | ||
| 13 | +public interface CarParkRepository extends BaseRepository<CarPark, Integer>{ | ||
| 14 | + | ||
| 15 | + // 查询最大ID | ||
| 16 | + @Query(value = "SELECT IFNULL(num,0) as maxId from (SELECT MAX(id) as num FROM bsth_c_car_park) k" | ||
| 17 | + , nativeQuery=true) | ||
| 18 | + public long carParkMaxId(); | ||
| 19 | + | ||
| 20 | + @Transactional | ||
| 21 | + @Modifying | ||
| 22 | + @Query(value="INSERT INTO bsth_c_car_park (" + | ||
| 23 | + " area , company , park_code , park_name , branche_company , " + | ||
| 24 | + | ||
| 25 | + "create_by , create_date , descriptions , destroy, update_by, " + | ||
| 26 | + | ||
| 27 | + "update_date , versions , b_center_point , b_park_point ,db_type, " + | ||
| 28 | + | ||
| 29 | + "g_center_point, g_park_point, radius, shapes_type) " + | ||
| 30 | + | ||
| 31 | + " VALUES(" + | ||
| 32 | + "?1 , ?2 , ?3 , ?4 , ?5," + | ||
| 33 | + | ||
| 34 | + "?6 , str_to_date(?7,'%Y-%m-%d %H:%i:%s') , ?8 , ?9 , ?10," + | ||
| 35 | + | ||
| 36 | + "str_to_date(?11,'%Y-%m-%d %H:%i:%s'), ?12 ,?13,ST_GeomFromText(?14), ?15, " + | ||
| 37 | + | ||
| 38 | + "?16, ST_GeomFromText(?17), ?18,?19)", nativeQuery=true) | ||
| 39 | + public void carParkSave(Double area,String company,String parkCode,String parkName, | ||
| 40 | + | ||
| 41 | + String brancheCompany,Integer createBy,String createDate,String descriptions,Integer destroy, | ||
| 42 | + | ||
| 43 | + Integer updateBy,String updateDate,Integer versions,String bCenterPoint,String bParkPoint, | ||
| 44 | + | ||
| 45 | + String dbType,String gCenterPoint,String gParkPoint,Integer radius,String shapesType); | ||
| 46 | + | ||
| 47 | + | ||
| 48 | + /** | ||
| 49 | + * @Description :TODO(查询路段信息) | ||
| 50 | + * | ||
| 51 | + * @param map <id:路段路由ID> | ||
| 52 | + * | ||
| 53 | + * @return List<Object[]> | ||
| 54 | + */ | ||
| 55 | + @Query(value ="SELECT k.id AS carParkId," + | ||
| 56 | + "k.area AS carParkArea," + | ||
| 57 | + "k.company AS carParkCompany," + | ||
| 58 | + "k.park_code AS carParkCode," + | ||
| 59 | + "k.park_name AS carParkName," + | ||
| 60 | + "k.branche_company AS carParkBrancheCompany," + | ||
| 61 | + "k.create_by AS carParkCreateBy," + | ||
| 62 | + "k.create_date AS carParkCreateDate," + | ||
| 63 | + "k.descriptions AS carParkDescriptions," + | ||
| 64 | + "k.destroy AS carParkDestroy," + | ||
| 65 | + "k.update_by AS carParkUpdate," + | ||
| 66 | + "k.update_date AS carParkUpdateDate," + | ||
| 67 | + "k.versions AS carParkVersions," + | ||
| 68 | + "k.b_center_point AS carParkBcenterPoint," + | ||
| 69 | + "ST_AsText(k.b_park_point) AS carParkBparkPoint," + | ||
| 70 | + "k.g_center_point AS carParkGcenterPoint," + | ||
| 71 | + "ST_AsText(k.g_park_point) AS carParkGparkPoint, " + | ||
| 72 | + "k.db_type AS carParkDBtype," + | ||
| 73 | + "k.radius AS carParkRadius," + | ||
| 74 | + "k.shapes_type AS carParkShapesType FROM bsth_c_car_park k where k.id = ?1", nativeQuery=true) | ||
| 75 | + List<Object[]> findCarParkInfoFormId(int id); | ||
| 76 | + | ||
| 77 | + @Transactional | ||
| 78 | + @Modifying | ||
| 79 | + @Query(value="UPDATE bsth_c_car_park SET " + | ||
| 80 | + "area = ?1 , " + | ||
| 81 | + "company = ?2 , " + | ||
| 82 | + "park_code = ?3 , " + | ||
| 83 | + "park_name = ?4 , " + | ||
| 84 | + "branche_company = ?5 , " + | ||
| 85 | + "create_by = ?6 , " + | ||
| 86 | + "create_date = str_to_date(?7,'%Y-%m-%d %H:%i:%s') , " + | ||
| 87 | + "descriptions = ?8 , " + | ||
| 88 | + "destroy = ?9 , " + | ||
| 89 | + "update_by = ?10 , " + | ||
| 90 | + "update_date =str_to_date(?11,'%Y-%m-%d %H:%i:%s') , " + | ||
| 91 | + "versions = ?12 , " + | ||
| 92 | + "b_center_point = ?13 , " + | ||
| 93 | + "g_center_point = ?14 , " + | ||
| 94 | + "b_park_point = ST_GeomFromText(?15) , " + | ||
| 95 | + "g_park_point = ST_GeomFromText(?16) , " + | ||
| 96 | + "db_type = ?17 , " + | ||
| 97 | + "radius = ?18 , " + | ||
| 98 | + "shapes_type = ?19 " + | ||
| 99 | + " WHERE id = ?20 ", nativeQuery=true) | ||
| 100 | + public void carParkUpdate(double area,String company,String parkCode,String parkName,String brancheCompany, | ||
| 101 | + | ||
| 102 | + Integer createBy ,String createDate,String descriptions,Integer destroy,Integer updateBy, | ||
| 103 | + | ||
| 104 | + String updateDate,Integer versions,String bCenterPoint,String gCenterPoint,String bParkPoint, | ||
| 105 | + | ||
| 106 | + String gParkPoint,String dbType,Integer radius,String shapesType,Integer id ); | ||
| 107 | + | ||
| 108 | + @Query(value = "select st_astext(g_park_point), shapes_type, g_center_point, radius,park_code,park_name from bsth_c_car_park where park_code=?1", nativeQuery = true) | ||
| 109 | + public Object[][] bufferAera(String parkCode); | ||
| 110 | + | ||
| 111 | + @Query(value ="SELECT p.park_name,p.park_code from bsth_c_car_park p where p.park_code = ?1", nativeQuery=true) | ||
| 112 | + List<Object[]> selectTccInfoByCode(String parkCode); | ||
| 113 | + | ||
| 114 | + @Query(value ="select c.id, c.area,c.company,c.park_code,c.park_name,c.branche_company,c.create_by,c.create_date,c.descriptions,c.destroy,c.update_by,c.update_date,c.versions,c.b_center_point,ST_AsText(c.b_park_point) b_park_point,c.g_center_point,ST_AsText(c.g_park_point) g_park_point,c.db_type,c.radius,c.shapes_type from bsth_c_line_information l left join bsth_c_car_park c on l.car_park = c.park_code where l.line = ?1", nativeQuery=true) | ||
| 115 | + CarPark findByLineId(int lineId); | ||
| 116 | +} |
src/main/java/com/bsth/repository/LsInoutSectionRouteRepository.java
0 → 100644
| 1 | +package com.bsth.repository; | ||
| 2 | + | ||
| 3 | +import com.bsth.entity.LsInoutSectionRoute; | ||
| 4 | +import com.bsth.entity.LsSectionRoute; | ||
| 5 | +import org.springframework.data.jpa.repository.Modifying; | ||
| 6 | +import org.springframework.data.jpa.repository.Query; | ||
| 7 | +import org.springframework.stereotype.Repository; | ||
| 8 | +import org.springframework.transaction.annotation.Transactional; | ||
| 9 | + | ||
| 10 | +import java.util.List; | ||
| 11 | + | ||
| 12 | +/** | ||
| 13 | + * | ||
| 14 | + * @Interface: SectionRouteRepository(路段路由Repository数据持久层接口) | ||
| 15 | + * | ||
| 16 | + * @Extends : BaseRepository | ||
| 17 | + * | ||
| 18 | + * @Description: TODO(路段路由Repository数据持久层接口) | ||
| 19 | + * | ||
| 20 | + * @Author bsth@lq | ||
| 21 | + * | ||
| 22 | + * @Version 公交调度系统BS版 0.1 | ||
| 23 | + * | ||
| 24 | + */ | ||
| 25 | + | ||
| 26 | +@Repository | ||
| 27 | +public interface LsInoutSectionRouteRepository extends BaseRepository<LsInoutSectionRoute, Long> { | ||
| 28 | + | ||
| 29 | + /** | ||
| 30 | + * 查询待更新线路的路段路由 | ||
| 31 | + */ | ||
| 32 | + @Query(value = "SELECT sr FROM LsInoutSectionRoute sr where sr.line.id =?1 and sr.versions=?2 and sr.start=?3 and sr.end=?4 and sr.destroy=0") | ||
| 33 | + List<LsInoutSectionRoute> getRouteByStartEnd(int lineId, int version, String start, String end); | ||
| 34 | + | ||
| 35 | + /** | ||
| 36 | + * | ||
| 37 | + * @param lineCode | ||
| 38 | + * @param version | ||
| 39 | + * @param start | ||
| 40 | + * @param end | ||
| 41 | + * @param sectionrouteCode | ||
| 42 | + */ | ||
| 43 | + @Modifying | ||
| 44 | + @Query(value="UPDATE bsth_c_ls_inout_sectionroute set sectionroute_code = (sectionroute_code+1) where line_code = ?1 and versions = ?2 and start = ?3 and end = ?4 and sectionroute_code >=?5 and destroy = 0", nativeQuery=true) | ||
| 45 | + public void sectionUpdSectionRouteCode(String lineCode, int version, String start, String end, Integer sectionrouteCode); | ||
| 46 | + | ||
| 47 | + /** | ||
| 48 | + * 撤销线路某版本进出场 | ||
| 49 | + * @param lineCode | ||
| 50 | + * @param version | ||
| 51 | + * @param start | ||
| 52 | + * @param end | ||
| 53 | + */ | ||
| 54 | + @Modifying | ||
| 55 | + @Query(value="UPDATE bsth_c_ls_inout_sectionroute set destroy = 1 where line_code = ?1 and versions = ?2 and start = ?3 and end = ?4", nativeQuery=true) | ||
| 56 | + public void destroy(String lineCode, int version, String start, String end); | ||
| 57 | +} |
src/main/java/com/bsth/repository/LsStationRouteRepository.java
| 1 | -package com.bsth.repository; | ||
| 2 | - | ||
| 3 | -import java.util.List; | ||
| 4 | -import java.util.Map; | ||
| 5 | - | ||
| 6 | -import org.springframework.data.domain.Sort; | ||
| 7 | -import org.springframework.data.jpa.repository.EntityGraph; | ||
| 8 | -import org.springframework.data.jpa.repository.Modifying; | ||
| 9 | -import org.springframework.data.jpa.repository.Query; | ||
| 10 | -import org.springframework.stereotype.Repository; | ||
| 11 | -import org.springframework.transaction.annotation.Transactional; | ||
| 12 | - | ||
| 13 | -import com.bsth.entity.LsStationRoute; | ||
| 14 | -import com.bsth.entity.StationRoute; | ||
| 15 | - | ||
| 16 | -/** | ||
| 17 | - * | ||
| 18 | - * @Interface: StationRouteRepository(站点路由Repository数据持久层接口) | ||
| 19 | - * | ||
| 20 | - * @Extends : BaseRepository | ||
| 21 | - * | ||
| 22 | - * @Description: TODO(站点路由Repository数据持久层接口) | ||
| 23 | - * | ||
| 24 | - * @Author bsth@lq | ||
| 25 | - * | ||
| 26 | - * @Version 公交调度系统BS版 0.1 | ||
| 27 | - * | ||
| 28 | - */ | ||
| 29 | - | ||
| 30 | -@Repository | ||
| 31 | -public interface LsStationRouteRepository extends BaseRepository<LsStationRoute, Integer> { | ||
| 32 | - | ||
| 33 | - /** | ||
| 34 | - * 查询待更新线路的站点路由 | ||
| 35 | - */ | ||
| 36 | - @EntityGraph(value = "ls_stationRoute_station", type = EntityGraph.EntityGraphType.FETCH) | ||
| 37 | - @Query(value = "SELECT DISTINCT sr FROM LsStationRoute sr where sr.line.id =?1 and sr.lineCode=?2 and sr.versions=?3 and sr.destroy=0") | ||
| 38 | - List<LsStationRoute> findupdated(Integer lineId, String lineCode, Integer versions); | ||
| 39 | - | ||
| 40 | - @Query(value = "SELECT a.`stationRoute.id`," + | ||
| 41 | - "a.`stationRoute.line`," + | ||
| 42 | - "a.`stationRoute.station`," + | ||
| 43 | - "a.`stationRoute.stationName`," + | ||
| 44 | - "a.`stationRoute.stationRouteCode`," + | ||
| 45 | - "a.`stationRoute.lineCode`," + | ||
| 46 | - "a.`stationRoute.stationMark`," + | ||
| 47 | - "a.`stationRoute.outStationNmber`," + | ||
| 48 | - "a.`stationRoute.directions`," + | ||
| 49 | - "a.`stationRoute.distances`," + | ||
| 50 | - "a.`stationRoute.toTime`," + | ||
| 51 | - "a.`stationRoute.firstTime`," + | ||
| 52 | - "a.`stationRoute.endTime`," + | ||
| 53 | - "a.`stationRoute.descriptions`," + | ||
| 54 | - "a.`stationRoute.versions`," + | ||
| 55 | - "b.id AS 'station.id'," + | ||
| 56 | - "b.station_cod AS 'station.stationCod'," + | ||
| 57 | - "b.station_name AS 'station.stationName'," + | ||
| 58 | - "b.road_coding AS 'station.roadCoding'," + | ||
| 59 | - "b.db_type AS 'station.dbType'," + | ||
| 60 | - "b.b_jwpoints AS 'station.bJwpoints'," + | ||
| 61 | - "b.g_lonx AS 'station.gLonx'," + | ||
| 62 | - "b.g_lonx AS 'station.gLaty'," + | ||
| 63 | - "b.x AS 'station.x'," + | ||
| 64 | - "b.y AS 'station.y'," + | ||
| 65 | - "b.shapes_type AS 'station.shapesType'," + | ||
| 66 | - "b.radius AS 'station.radius'," + | ||
| 67 | - "ST_AsText(b.g_polygon_grid) AS 'station.gPolygonGrid'," + | ||
| 68 | - "ST_AsText(b.b_polygon_grid) AS 'station.bPolygonGrid'," + | ||
| 69 | - "b.destroy AS 'station.destroy'," + | ||
| 70 | - "b.versions AS 'station.versions'," + | ||
| 71 | - "b.descriptions AS 'station.descriptions', " + | ||
| 72 | - "a.`stationRoute.industryCode` " + | ||
| 73 | - " FROM (" + | ||
| 74 | - "SELECT r.id AS 'stationRoute.id'," + | ||
| 75 | - " r.line AS 'stationRoute.line'," + | ||
| 76 | - "r.station AS 'stationRoute.station'," + | ||
| 77 | - "r.station_name AS 'stationRoute.stationName'," + | ||
| 78 | - "r.station_route_code as 'stationRoute.stationRouteCode'," + | ||
| 79 | - "r.line_code AS 'stationRoute.lineCode'," + | ||
| 80 | - "r.station_mark AS 'stationRoute.stationMark'," + | ||
| 81 | - "r.out_station_nmber AS 'stationRoute.outStationNmber'," + | ||
| 82 | - "r.directions AS 'stationRoute.directions'," + | ||
| 83 | - "r.distances AS 'stationRoute.distances'," + | ||
| 84 | - "r.to_time AS 'stationRoute.toTime'," + | ||
| 85 | - "r.first_time AS 'stationRoute.firstTime'," + | ||
| 86 | - "r.end_time AS 'stationRoute.endTime'," + | ||
| 87 | - "r.descriptions AS 'stationRoute.descriptions'," + | ||
| 88 | - "r.versions AS 'stationRoute.versions', " + | ||
| 89 | - "r.industry_code AS 'stationRoute.industryCode' " + | ||
| 90 | - " FROM bsth_c_ls_stationroute r WHERE r.line = ?1 and r.directions = ?2 and r.versions=?3 and r.destroy=0) a " + | ||
| 91 | - "LEFT JOIN bsth_c_station b " + | ||
| 92 | - "ON a.`stationRoute.station` = b.id ORDER BY a.`stationRoute.stationRouteCode` ASC", nativeQuery=true) | ||
| 93 | - List<Object[]> findPoints(Integer lineId, Integer direction, Integer versions); | ||
| 94 | - | ||
| 95 | - | ||
| 96 | - @Query(value = "SELECT a.stationRouteLine," + | ||
| 97 | - " a.stationRouteStation," + | ||
| 98 | - " a.stationRouteCode," + | ||
| 99 | - " a.stationRouteLIneCode," + | ||
| 100 | - " a.stationRouteStationMark," + | ||
| 101 | - " a.stationOutStationNmber," + | ||
| 102 | - " a.stationRoutedirections," + | ||
| 103 | - " a.stationRouteDistances," + | ||
| 104 | - " a.stationRouteToTime," + | ||
| 105 | - " a.staitonRouteFirstTime," + | ||
| 106 | - " a.stationRouteEndTime," + | ||
| 107 | - " a.stationRouteDescriptions," + | ||
| 108 | - " a.stationRouteDestroy," + | ||
| 109 | - " a.stationRouteVersions," + | ||
| 110 | - " a.stationRouteCreateBy," + | ||
| 111 | - " a.stationRouteCreateDate," + | ||
| 112 | - " a.stationRouteUpdateBy," + | ||
| 113 | - " a.stationRouteUpdateDate," + | ||
| 114 | - " b.id AS stationId," + | ||
| 115 | - " b.station_cod AS stationCode," + | ||
| 116 | - " a.stationRouteName," + | ||
| 117 | - " b.road_coding AS stationRoadCoding," + | ||
| 118 | - " b.db_type AS stationDbType," + | ||
| 119 | - " b.b_jwpoints AS stationJwpoints," + | ||
| 120 | - " b.g_lonx AS stationGlonx," + | ||
| 121 | - " b.g_laty AS stationGlaty," + | ||
| 122 | - " b.x AS stationX," + | ||
| 123 | - " b.y AS stationY," + | ||
| 124 | - " ST_AsText(b.b_polygon_grid) as stationBPolyonGrid," + | ||
| 125 | - " ST_AsText(b.g_polygon_grid) AS stationGPloyonGrid, " + | ||
| 126 | - " b.destroy AS stationDestroy," + | ||
| 127 | - " b.radius AS stationRadius," + | ||
| 128 | - " b.shapes_type AS stationShapesType," + | ||
| 129 | - " b.versions AS stationVersions," + | ||
| 130 | - " b.descriptions AS sttationDescriptions," + | ||
| 131 | - " b.create_by AS stationCreateBy," + | ||
| 132 | - " b.create_date AS stationCreateDate," + | ||
| 133 | - " b.update_by AS stationUpdateBy," + | ||
| 134 | - " b.update_date AS stationUpdateDate," + | ||
| 135 | - " a.stationRouteId," + | ||
| 136 | - "b.station_name as zdmc, "+ | ||
| 137 | - "a.industryCode "+ | ||
| 138 | - " FROM ( SELECT s.id AS stationRouteId," + | ||
| 139 | - " s.line AS stationRouteLine," + | ||
| 140 | - " s.station as stationRouteStation," + | ||
| 141 | - " s.station_name AS stationRouteName," + | ||
| 142 | - " s.station_route_code as stationRouteCode," + | ||
| 143 | - " s.industry_code as industryCode," + | ||
| 144 | - " s.line_code AS stationRouteLIneCode," + | ||
| 145 | - " s.station_mark AS stationRouteStationMark," + | ||
| 146 | - " s.out_station_nmber AS stationOutStationNmber," + | ||
| 147 | - " s.directions AS stationRoutedirections," + | ||
| 148 | - " s.distances AS stationRouteDistances," + | ||
| 149 | - " s.to_time AS stationRouteToTime," + | ||
| 150 | - " s.first_time AS staitonRouteFirstTime," + | ||
| 151 | - " s.end_time AS stationRouteEndTime," + | ||
| 152 | - " s.descriptions AS stationRouteDescriptions," + | ||
| 153 | - " s.destroy AS stationRouteDestroy," + | ||
| 154 | - " s.versions AS stationRouteVersions," + | ||
| 155 | - " s.create_by AS stationRouteCreateBy," + | ||
| 156 | - " s.create_date AS stationRouteCreateDate," + | ||
| 157 | - " s.update_by AS stationRouteUpdateBy," + | ||
| 158 | - " s.update_date AS stationRouteUpdateDate FROM bsth_c_ls_stationroute s WHERE s.line = ?1 and s.directions = ?2 and s.versions=?3 and s.destroy = 0) a " + | ||
| 159 | - " LEFT JOIN bsth_c_station b ON a.stationRouteStation = b.id order by a.stationRouteCode", nativeQuery=true) | ||
| 160 | - List<Object[]> getStationRouteList(Integer lineId, Integer dir ,Integer version); | ||
| 161 | - /** | ||
| 162 | - * 更新路线前删除线路版本号历史原有站点路由 | ||
| 163 | - * | ||
| 164 | - * @param line | ||
| 165 | - * @param dir | ||
| 166 | - */ | ||
| 167 | - @Modifying | ||
| 168 | - @Transactional | ||
| 169 | - @Query(value="DELETE from bsth_c_ls_stationroute where line = ?1 and directions = ?2 and versions = ?3", nativeQuery=true) | ||
| 170 | - public void batchDelete(Integer line,Integer dir, Integer versions); | ||
| 171 | - | ||
| 172 | - /** | ||
| 173 | - * 更新路线前撤销线路版本号历史原有站点路由 | ||
| 174 | - * | ||
| 175 | - * @param line | ||
| 176 | - * @param dir | ||
| 177 | - */ | ||
| 178 | - @Modifying | ||
| 179 | - @Query(value="UPDATE bsth_c_ls_stationroute set destroy = 1 where line = ?1 and directions = ?2 and versions = ?3", nativeQuery=true) | ||
| 180 | - public void batchDestroy(Integer sectionRouteLine, Integer directions, Integer versions); | ||
| 181 | - | ||
| 182 | - /** | ||
| 183 | - * 按线路编码查询各站点的顺序号 | ||
| 184 | - * @param lineCode 线路编码 | ||
| 185 | - * @param lineVersion 版本号 | ||
| 186 | - * @return | ||
| 187 | - */ | ||
| 188 | - @Query("SELECT new map(" + | ||
| 189 | - "lineCode as lineCode,directions as directions,stationName as stationName,stationCode as stationCode," + | ||
| 190 | - "line.linePlayType as linePlayType,s.stationMark as stationMark) " + | ||
| 191 | - "FROM " + | ||
| 192 | - "LsStationRoute s " + | ||
| 193 | - "WHERE " + | ||
| 194 | - "s.destroy = 0 AND s.lineCode = ?1 AND s.versions = ?2 " + | ||
| 195 | - "ORDER BY " + | ||
| 196 | - "lineCode,directions,stationRouteCode") | ||
| 197 | - List<Map<String, String>> findLineWithLineCode4Ygc(String lineCode,Integer lineVersion); | ||
| 198 | - /** | ||
| 199 | - * @Description : TODO(根据站点路由Id查询详情) | ||
| 200 | - * | ||
| 201 | - * @param id:站点路由ID | ||
| 202 | - * | ||
| 203 | - * @return List<Object[]> | ||
| 204 | - */ | ||
| 205 | - @Query(value = "SELECT a.stationRouteLine," + | ||
| 206 | - " a.stationRouteStation," + | ||
| 207 | - " a.stationRouteCode," + | ||
| 208 | - " a.stationRouteLIneCode," + | ||
| 209 | - " a.stationRouteStationMark," + | ||
| 210 | - " a.stationOutStationNmber," + | ||
| 211 | - " a.stationRoutedirections," + | ||
| 212 | - " a.stationRouteDistances," + | ||
| 213 | - " a.stationRouteToTime," + | ||
| 214 | - " a.staitonRouteFirstTime," + | ||
| 215 | - " a.stationRouteEndTime," + | ||
| 216 | - " a.stationRouteDescriptions," + | ||
| 217 | - " a.stationRouteDestroy," + | ||
| 218 | - " a.stationRouteVersions," + | ||
| 219 | - " a.stationRouteCreateBy," + | ||
| 220 | - " a.stationRouteCreateDate," + | ||
| 221 | - " a.stationRouteUpdateBy," + | ||
| 222 | - " a.stationRouteUpdateDate," + | ||
| 223 | - " b.id AS stationId," + | ||
| 224 | - " b.station_cod AS stationCode," + | ||
| 225 | - " a.stationRouteName," + | ||
| 226 | - " b.road_coding AS stationRoadCoding," + | ||
| 227 | - " b.db_type AS stationDbType," + | ||
| 228 | - " b.b_jwpoints AS stationJwpoints," + | ||
| 229 | - " b.g_lonx AS stationGlonx," + | ||
| 230 | - " b.g_laty AS stationGlaty," + | ||
| 231 | - " b.x AS stationX," + | ||
| 232 | - " b.y AS stationY," + | ||
| 233 | - " ST_AsText(b.b_polygon_grid) as stationBPolyonGrid," + | ||
| 234 | - " ST_AsText(b.g_polygon_grid) AS stationGPloyonGrid, " + | ||
| 235 | - " b.destroy AS stationDestroy," + | ||
| 236 | - " b.radius AS stationRadius," + | ||
| 237 | - " b.shapes_type AS stationShapesType," + | ||
| 238 | - " b.versions AS stationVersions," + | ||
| 239 | - " b.descriptions AS sttationDescriptions," + | ||
| 240 | - " b.create_by AS stationCreateBy," + | ||
| 241 | - " b.create_date AS stationCreateDate," + | ||
| 242 | - " b.update_by AS stationUpdateBy," + | ||
| 243 | - " b.update_date AS stationUpdateDate," + | ||
| 244 | - " a.stationRouteId,b.station_name as zdmc, " + | ||
| 245 | - " a.industryCode "+ | ||
| 246 | - " FROM " + | ||
| 247 | - "( SELECT s.id AS stationRouteId," + | ||
| 248 | - " s.line AS stationRouteLine," + | ||
| 249 | - " s.station as stationRouteStation," + | ||
| 250 | - " s.station_name AS stationRouteName," + | ||
| 251 | - " s.station_route_code as stationRouteCode," + | ||
| 252 | - " s.industry_code as industryCode," + | ||
| 253 | - " s.line_code AS stationRouteLIneCode," + | ||
| 254 | - " s.station_mark AS stationRouteStationMark," + | ||
| 255 | - " s.out_station_nmber AS stationOutStationNmber," + | ||
| 256 | - " s.directions AS stationRoutedirections," + | ||
| 257 | - " s.distances AS stationRouteDistances," + | ||
| 258 | - " s.to_time AS stationRouteToTime," + | ||
| 259 | - " s.first_time AS staitonRouteFirstTime," + | ||
| 260 | - " s.end_time AS stationRouteEndTime," + | ||
| 261 | - " s.descriptions AS stationRouteDescriptions," + | ||
| 262 | - " s.destroy AS stationRouteDestroy," + | ||
| 263 | - " s.versions AS stationRouteVersions," + | ||
| 264 | - " s.create_by AS stationRouteCreateBy," + | ||
| 265 | - " s.create_date AS stationRouteCreateDate," + | ||
| 266 | - " s.update_by AS stationRouteUpdateBy," + | ||
| 267 | - " s.update_date AS stationRouteUpdateDate FROM bsth_c_ls_stationroute s WHERE s.id = ?1 ) a " + | ||
| 268 | - " LEFT JOIN bsth_c_station b ON a.stationRouteStation = b.id", nativeQuery=true) | ||
| 269 | - List<Object[]> findStationRouteInfo(Integer id); | ||
| 270 | - | ||
| 271 | - // 批量修改站点行业编码 | ||
| 272 | - @Modifying | ||
| 273 | - @Query(value="update bsth_c_ls_stationroute set industry_code =?2 where id = ?1 ", nativeQuery=true) | ||
| 274 | - void updIndustryCode(Integer id, String industryCode); | ||
| 275 | - | ||
| 276 | - @Modifying | ||
| 277 | - @Query(value="UPDATE bsth_c_ls_stationroute set station_route_code = (station_route_code+10) where line = ?1 and directions = ?2 and station_route_code >=?3 and destroy = 0", nativeQuery=true) | ||
| 278 | - void stationUpdStationRouteCode(Integer line,Integer dir,Integer routeCod); | ||
| 279 | - | ||
| 280 | - @Modifying | ||
| 281 | - @Query(value="update bsth_c_ls_stationroute set directions = case directions when 1 then 0 when 0 then 1 end where line = ?1 ", nativeQuery=true) | ||
| 282 | - void stationRouteDir(Integer line); | ||
| 283 | - | ||
| 284 | - @Query("select r from LsStationRoute r where r.line.id=?1 and r.directions=?2 and r.destroy=0 order by r.stationRouteCode") | ||
| 285 | - List<LsStationRoute> findByLine(int lineId, int dir); | ||
| 286 | - | ||
| 287 | - @Modifying | ||
| 288 | - @Query(value="update bsth_c_ls_stationroute set distances =?2 where id = ?1 ", nativeQuery=true) | ||
| 289 | - void upddis(Integer id,Double dis); | ||
| 290 | - | ||
| 291 | - @Query(value="select * from bsth_c_ls_stationroute where line_code = ?3 and directions = ?4 and destroy = 0 and versions = ?5 limit ?1,?2", nativeQuery=true) | ||
| 292 | - Iterable<LsStationRoute> page(int start , int end , int line ,int dir, int version); | ||
| 293 | - | ||
| 294 | - @Query(value="select count(*) from bsth_c_ls_stationroute where line_code = ?1 and directions = ?2 and destroy = 0 and versions = ?3 ", nativeQuery=true) | ||
| 295 | - int count(int line, int dir, int version); | ||
| 296 | -} | 1 | +package com.bsth.repository; |
| 2 | + | ||
| 3 | +import java.util.List; | ||
| 4 | +import java.util.Map; | ||
| 5 | + | ||
| 6 | +import org.springframework.data.jpa.repository.EntityGraph; | ||
| 7 | +import org.springframework.data.jpa.repository.Modifying; | ||
| 8 | +import org.springframework.data.jpa.repository.Query; | ||
| 9 | +import org.springframework.stereotype.Repository; | ||
| 10 | +import org.springframework.transaction.annotation.Transactional; | ||
| 11 | + | ||
| 12 | +import com.bsth.entity.LsStationRoute; | ||
| 13 | + | ||
| 14 | +/** | ||
| 15 | + * | ||
| 16 | + * @Interface: StationRouteRepository(站点路由Repository数据持久层接口) | ||
| 17 | + * | ||
| 18 | + * @Extends : BaseRepository | ||
| 19 | + * | ||
| 20 | + * @Description: TODO(站点路由Repository数据持久层接口) | ||
| 21 | + * | ||
| 22 | + * @Author bsth@lq | ||
| 23 | + * | ||
| 24 | + * @Version 公交调度系统BS版 0.1 | ||
| 25 | + * | ||
| 26 | + */ | ||
| 27 | + | ||
| 28 | +@Repository | ||
| 29 | +public interface LsStationRouteRepository extends BaseRepository<LsStationRoute, Integer> { | ||
| 30 | + | ||
| 31 | + /** | ||
| 32 | + * 查询待更新线路的站点路由 | ||
| 33 | + */ | ||
| 34 | + @EntityGraph(value = "ls_stationRoute_station", type = EntityGraph.EntityGraphType.FETCH) | ||
| 35 | + @Query(value = "SELECT DISTINCT sr FROM LsStationRoute sr where sr.line.id =?1 and sr.lineCode=?2 and sr.versions=?3 and sr.destroy=0") | ||
| 36 | + List<LsStationRoute> findupdated(Integer lineId, String lineCode, Integer versions); | ||
| 37 | + | ||
| 38 | + @Query(value = "SELECT a.`stationRoute.id`," + | ||
| 39 | + "a.`stationRoute.line`," + | ||
| 40 | + "a.`stationRoute.station`," + | ||
| 41 | + "a.`stationRoute.stationName`," + | ||
| 42 | + "a.`stationRoute.stationRouteCode`," + | ||
| 43 | + "a.`stationRoute.lineCode`," + | ||
| 44 | + "a.`stationRoute.stationMark`," + | ||
| 45 | + "a.`stationRoute.outStationNmber`," + | ||
| 46 | + "a.`stationRoute.directions`," + | ||
| 47 | + "a.`stationRoute.distances`," + | ||
| 48 | + "a.`stationRoute.toTime`," + | ||
| 49 | + "a.`stationRoute.firstTime`," + | ||
| 50 | + "a.`stationRoute.endTime`," + | ||
| 51 | + "a.`stationRoute.descriptions`," + | ||
| 52 | + "a.`stationRoute.versions`," + | ||
| 53 | + "b.id AS 'station.id'," + | ||
| 54 | + "b.station_cod AS 'station.stationCod'," + | ||
| 55 | + "b.station_name AS 'station.stationName'," + | ||
| 56 | + "b.road_coding AS 'station.roadCoding'," + | ||
| 57 | + "b.db_type AS 'station.dbType'," + | ||
| 58 | + "b.b_jwpoints AS 'station.bJwpoints'," + | ||
| 59 | + "b.g_lonx AS 'station.gLonx'," + | ||
| 60 | + "b.g_lonx AS 'station.gLaty'," + | ||
| 61 | + "b.x AS 'station.x'," + | ||
| 62 | + "b.y AS 'station.y'," + | ||
| 63 | + "b.shapes_type AS 'station.shapesType'," + | ||
| 64 | + "b.radius AS 'station.radius'," + | ||
| 65 | + "ST_AsText(b.g_polygon_grid) AS 'station.gPolygonGrid'," + | ||
| 66 | + "ST_AsText(b.b_polygon_grid) AS 'station.bPolygonGrid'," + | ||
| 67 | + "b.destroy AS 'station.destroy'," + | ||
| 68 | + "b.versions AS 'station.versions'," + | ||
| 69 | + "b.descriptions AS 'station.descriptions', " + | ||
| 70 | + "a.`stationRoute.industryCode` " + | ||
| 71 | + " FROM (" + | ||
| 72 | + "SELECT r.id AS 'stationRoute.id'," + | ||
| 73 | + " r.line AS 'stationRoute.line'," + | ||
| 74 | + "r.station AS 'stationRoute.station'," + | ||
| 75 | + "r.station_name AS 'stationRoute.stationName'," + | ||
| 76 | + "r.station_route_code as 'stationRoute.stationRouteCode'," + | ||
| 77 | + "r.line_code AS 'stationRoute.lineCode'," + | ||
| 78 | + "r.station_mark AS 'stationRoute.stationMark'," + | ||
| 79 | + "r.out_station_nmber AS 'stationRoute.outStationNmber'," + | ||
| 80 | + "r.directions AS 'stationRoute.directions'," + | ||
| 81 | + "r.distances AS 'stationRoute.distances'," + | ||
| 82 | + "r.to_time AS 'stationRoute.toTime'," + | ||
| 83 | + "r.first_time AS 'stationRoute.firstTime'," + | ||
| 84 | + "r.end_time AS 'stationRoute.endTime'," + | ||
| 85 | + "r.descriptions AS 'stationRoute.descriptions'," + | ||
| 86 | + "r.versions AS 'stationRoute.versions', " + | ||
| 87 | + "r.industry_code AS 'stationRoute.industryCode' " + | ||
| 88 | + " FROM bsth_c_ls_stationroute r WHERE r.line = ?1 and r.directions = ?2 and r.versions=?3 and r.destroy=0) a " + | ||
| 89 | + "LEFT JOIN bsth_c_station b " + | ||
| 90 | + "ON a.`stationRoute.station` = b.id ORDER BY a.`stationRoute.stationRouteCode` ASC", nativeQuery=true) | ||
| 91 | + List<Object[]> findPoints(Integer lineId, Integer direction, Integer versions); | ||
| 92 | + | ||
| 93 | + | ||
| 94 | + @Query(value = "SELECT a.stationRouteLine," + | ||
| 95 | + " a.stationRouteStation," + | ||
| 96 | + " a.stationRouteCode," + | ||
| 97 | + " a.stationRouteLIneCode," + | ||
| 98 | + " a.stationRouteStationMark," + | ||
| 99 | + " a.stationOutStationNmber," + | ||
| 100 | + " a.stationRoutedirections," + | ||
| 101 | + " a.stationRouteDistances," + | ||
| 102 | + " a.stationRouteToTime," + | ||
| 103 | + " a.staitonRouteFirstTime," + | ||
| 104 | + " a.stationRouteEndTime," + | ||
| 105 | + " a.stationRouteDescriptions," + | ||
| 106 | + " a.stationRouteDestroy," + | ||
| 107 | + " a.stationRouteVersions," + | ||
| 108 | + " a.stationRouteCreateBy," + | ||
| 109 | + " a.stationRouteCreateDate," + | ||
| 110 | + " a.stationRouteUpdateBy," + | ||
| 111 | + " a.stationRouteUpdateDate," + | ||
| 112 | + " b.id AS stationId," + | ||
| 113 | + " b.station_cod AS stationCode," + | ||
| 114 | + " a.stationRouteName," + | ||
| 115 | + " b.road_coding AS stationRoadCoding," + | ||
| 116 | + " b.db_type AS stationDbType," + | ||
| 117 | + " b.b_jwpoints AS stationJwpoints," + | ||
| 118 | + " b.g_lonx AS stationGlonx," + | ||
| 119 | + " b.g_laty AS stationGlaty," + | ||
| 120 | + " b.x AS stationX," + | ||
| 121 | + " b.y AS stationY," + | ||
| 122 | + " ST_AsText(b.b_polygon_grid) as stationBPolyonGrid," + | ||
| 123 | + " ST_AsText(b.g_polygon_grid) AS stationGPloyonGrid, " + | ||
| 124 | + " b.destroy AS stationDestroy," + | ||
| 125 | + " b.radius AS stationRadius," + | ||
| 126 | + " b.shapes_type AS stationShapesType," + | ||
| 127 | + " b.versions AS stationVersions," + | ||
| 128 | + " b.descriptions AS sttationDescriptions," + | ||
| 129 | + " b.create_by AS stationCreateBy," + | ||
| 130 | + " b.create_date AS stationCreateDate," + | ||
| 131 | + " b.update_by AS stationUpdateBy," + | ||
| 132 | + " b.update_date AS stationUpdateDate," + | ||
| 133 | + " a.stationRouteId," + | ||
| 134 | + "b.station_name as zdmc, "+ | ||
| 135 | + "a.industryCode "+ | ||
| 136 | + " FROM ( SELECT s.id AS stationRouteId," + | ||
| 137 | + " s.line AS stationRouteLine," + | ||
| 138 | + " s.station as stationRouteStation," + | ||
| 139 | + " s.station_name AS stationRouteName," + | ||
| 140 | + " s.station_route_code as stationRouteCode," + | ||
| 141 | + " s.industry_code as industryCode," + | ||
| 142 | + " s.line_code AS stationRouteLIneCode," + | ||
| 143 | + " s.station_mark AS stationRouteStationMark," + | ||
| 144 | + " s.out_station_nmber AS stationOutStationNmber," + | ||
| 145 | + " s.directions AS stationRoutedirections," + | ||
| 146 | + " s.distances AS stationRouteDistances," + | ||
| 147 | + " s.to_time AS stationRouteToTime," + | ||
| 148 | + " s.first_time AS staitonRouteFirstTime," + | ||
| 149 | + " s.end_time AS stationRouteEndTime," + | ||
| 150 | + " s.descriptions AS stationRouteDescriptions," + | ||
| 151 | + " s.destroy AS stationRouteDestroy," + | ||
| 152 | + " s.versions AS stationRouteVersions," + | ||
| 153 | + " s.create_by AS stationRouteCreateBy," + | ||
| 154 | + " s.create_date AS stationRouteCreateDate," + | ||
| 155 | + " s.update_by AS stationRouteUpdateBy," + | ||
| 156 | + " s.update_date AS stationRouteUpdateDate FROM bsth_c_ls_stationroute s WHERE s.line = ?1 and s.directions = ?2 and s.versions=?3 and s.destroy = 0) a " + | ||
| 157 | + " LEFT JOIN bsth_c_station b ON a.stationRouteStation = b.id order by a.stationRouteCode", nativeQuery=true) | ||
| 158 | + List<Object[]> getStationRouteList(Integer lineId, Integer dir ,Integer version); | ||
| 159 | + /** | ||
| 160 | + * 更新路线前删除线路版本号历史原有站点路由 | ||
| 161 | + * | ||
| 162 | + * @param line | ||
| 163 | + * @param dir | ||
| 164 | + */ | ||
| 165 | + @Modifying | ||
| 166 | + @Transactional | ||
| 167 | + @Query(value="DELETE from bsth_c_ls_stationroute where line = ?1 and directions = ?2 and versions = ?3", nativeQuery=true) | ||
| 168 | + public void batchDelete(Integer line,Integer dir, Integer versions); | ||
| 169 | + | ||
| 170 | + /** | ||
| 171 | + * 更新路线前撤销线路版本号历史原有站点路由 | ||
| 172 | + * | ||
| 173 | + * @param line | ||
| 174 | + * @param dir | ||
| 175 | + */ | ||
| 176 | + @Modifying | ||
| 177 | + @Query(value="UPDATE bsth_c_ls_stationroute set destroy = 1 where line = ?1 and directions = ?2 and versions = ?3", nativeQuery=true) | ||
| 178 | + public void batchDestroy(Integer sectionRouteLine, Integer directions, Integer versions); | ||
| 179 | + | ||
| 180 | + /** | ||
| 181 | + * 按线路编码查询各站点的顺序号 | ||
| 182 | + * @param lineCode 线路编码 | ||
| 183 | + * @param lineVersion 版本号 | ||
| 184 | + * @return | ||
| 185 | + */ | ||
| 186 | + @Query("SELECT new map(" + | ||
| 187 | + "lineCode as lineCode,directions as directions,stationName as stationName,stationCode as stationCode," + | ||
| 188 | + "line.linePlayType as linePlayType,s.stationMark as stationMark) " + | ||
| 189 | + "FROM " + | ||
| 190 | + "LsStationRoute s " + | ||
| 191 | + "WHERE " + | ||
| 192 | + "s.destroy = 0 AND s.lineCode = ?1 AND s.versions = ?2 " + | ||
| 193 | + "ORDER BY " + | ||
| 194 | + "lineCode,directions,stationRouteCode") | ||
| 195 | + List<Map<String, String>> findLineWithLineCode4Ygc(String lineCode,Integer lineVersion); | ||
| 196 | + /** | ||
| 197 | + * @Description : TODO(根据站点路由Id查询详情) | ||
| 198 | + * | ||
| 199 | + * @param id:站点路由ID | ||
| 200 | + * | ||
| 201 | + * @return List<Object[]> | ||
| 202 | + */ | ||
| 203 | + @Query(value = "SELECT a.stationRouteLine," + | ||
| 204 | + " a.stationRouteStation," + | ||
| 205 | + " a.stationRouteCode," + | ||
| 206 | + " a.stationRouteLIneCode," + | ||
| 207 | + " a.stationRouteStationMark," + | ||
| 208 | + " a.stationOutStationNmber," + | ||
| 209 | + " a.stationRoutedirections," + | ||
| 210 | + " a.stationRouteDistances," + | ||
| 211 | + " a.stationRouteToTime," + | ||
| 212 | + " a.staitonRouteFirstTime," + | ||
| 213 | + " a.stationRouteEndTime," + | ||
| 214 | + " a.stationRouteDescriptions," + | ||
| 215 | + " a.stationRouteDestroy," + | ||
| 216 | + " a.stationRouteVersions," + | ||
| 217 | + " a.stationRouteCreateBy," + | ||
| 218 | + " a.stationRouteCreateDate," + | ||
| 219 | + " a.stationRouteUpdateBy," + | ||
| 220 | + " a.stationRouteUpdateDate," + | ||
| 221 | + " b.id AS stationId," + | ||
| 222 | + " b.station_cod AS stationCode," + | ||
| 223 | + " a.stationRouteName," + | ||
| 224 | + " b.road_coding AS stationRoadCoding," + | ||
| 225 | + " b.db_type AS stationDbType," + | ||
| 226 | + " b.b_jwpoints AS stationJwpoints," + | ||
| 227 | + " b.g_lonx AS stationGlonx," + | ||
| 228 | + " b.g_laty AS stationGlaty," + | ||
| 229 | + " b.x AS stationX," + | ||
| 230 | + " b.y AS stationY," + | ||
| 231 | + " ST_AsText(b.b_polygon_grid) as stationBPolyonGrid," + | ||
| 232 | + " ST_AsText(b.g_polygon_grid) AS stationGPloyonGrid, " + | ||
| 233 | + " b.destroy AS stationDestroy," + | ||
| 234 | + " b.radius AS stationRadius," + | ||
| 235 | + " b.shapes_type AS stationShapesType," + | ||
| 236 | + " b.versions AS stationVersions," + | ||
| 237 | + " b.descriptions AS sttationDescriptions," + | ||
| 238 | + " b.create_by AS stationCreateBy," + | ||
| 239 | + " b.create_date AS stationCreateDate," + | ||
| 240 | + " b.update_by AS stationUpdateBy," + | ||
| 241 | + " b.update_date AS stationUpdateDate," + | ||
| 242 | + " a.stationRouteId,b.station_name as zdmc, " + | ||
| 243 | + " a.industryCode "+ | ||
| 244 | + " FROM " + | ||
| 245 | + "( SELECT s.id AS stationRouteId," + | ||
| 246 | + " s.line AS stationRouteLine," + | ||
| 247 | + " s.station as stationRouteStation," + | ||
| 248 | + " s.station_name AS stationRouteName," + | ||
| 249 | + " s.station_route_code as stationRouteCode," + | ||
| 250 | + " s.industry_code as industryCode," + | ||
| 251 | + " s.line_code AS stationRouteLIneCode," + | ||
| 252 | + " s.station_mark AS stationRouteStationMark," + | ||
| 253 | + " s.out_station_nmber AS stationOutStationNmber," + | ||
| 254 | + " s.directions AS stationRoutedirections," + | ||
| 255 | + " s.distances AS stationRouteDistances," + | ||
| 256 | + " s.to_time AS stationRouteToTime," + | ||
| 257 | + " s.first_time AS staitonRouteFirstTime," + | ||
| 258 | + " s.end_time AS stationRouteEndTime," + | ||
| 259 | + " s.descriptions AS stationRouteDescriptions," + | ||
| 260 | + " s.destroy AS stationRouteDestroy," + | ||
| 261 | + " s.versions AS stationRouteVersions," + | ||
| 262 | + " s.create_by AS stationRouteCreateBy," + | ||
| 263 | + " s.create_date AS stationRouteCreateDate," + | ||
| 264 | + " s.update_by AS stationRouteUpdateBy," + | ||
| 265 | + " s.update_date AS stationRouteUpdateDate FROM bsth_c_ls_stationroute s WHERE s.id = ?1 ) a " + | ||
| 266 | + " LEFT JOIN bsth_c_station b ON a.stationRouteStation = b.id", nativeQuery=true) | ||
| 267 | + List<Object[]> findStationRouteInfo(Integer id); | ||
| 268 | + | ||
| 269 | + // 批量修改站点行业编码 | ||
| 270 | + @Modifying | ||
| 271 | + @Query(value="update bsth_c_ls_stationroute set industry_code =?2 where id = ?1 ", nativeQuery=true) | ||
| 272 | + void updIndustryCode(Integer id, String industryCode); | ||
| 273 | + | ||
| 274 | + @Modifying | ||
| 275 | + @Query(value="UPDATE bsth_c_ls_stationroute set station_route_code = (station_route_code+10) where line = ?1 and directions = ?2 and station_route_code >=?3 and destroy = 0", nativeQuery=true) | ||
| 276 | + void stationUpdStationRouteCode(Integer line,Integer dir,Integer routeCod); | ||
| 277 | + | ||
| 278 | + @Modifying | ||
| 279 | + @Query(value="update bsth_c_ls_stationroute set directions = case directions when 1 then 0 when 0 then 1 end where line = ?1 ", nativeQuery=true) | ||
| 280 | + void stationRouteDir(Integer line); | ||
| 281 | + | ||
| 282 | + @Query("select r from LsStationRoute r where r.line.id=?1 and r.directions=?2 and r.destroy=0 order by r.stationRouteCode") | ||
| 283 | + List<LsStationRoute> findByLine(int lineId, int dir); | ||
| 284 | + | ||
| 285 | + @Modifying | ||
| 286 | + @Query(value="update bsth_c_ls_stationroute set distances =?2 where id = ?1 ", nativeQuery=true) | ||
| 287 | + void upddis(Integer id,Double dis); | ||
| 288 | + | ||
| 289 | + @Query(value="select * from bsth_c_ls_stationroute where line_code = ?3 and directions = ?4 and destroy = 0 and versions = ?5 limit ?1,?2", nativeQuery=true) | ||
| 290 | + Iterable<LsStationRoute> page(int start , int end , int line ,int dir, int version); | ||
| 291 | + | ||
| 292 | + @Query(value="select count(*) from bsth_c_ls_stationroute where line_code = ?1 and directions = ?2 and destroy = 0 and versions = ?3 ", nativeQuery=true) | ||
| 293 | + int count(int line, int dir, int version); | ||
| 294 | + | ||
| 295 | + @Query(value = " select r.station_code, r.station_name, r.versions " + | ||
| 296 | + "from bsth_c_ls_stationroute r where r.line_code = ?1 " + | ||
| 297 | + "and r.directions=?2 and r.destroy = 0 and r.versions in(" + | ||
| 298 | + "select v.versions from bsth_c_line_versions v where v.line_code=?1 " + | ||
| 299 | + "and ((date_format(v.start_date, '%Y-%m-%d') >= ?3 and date_format(v.start_date, '%Y-%m-%d') <= ?4) " + | ||
| 300 | + " or (date_format(v.start_date, '%Y-%m-%d') <= ?4 and date_format(v.end_date, '%Y-%m-%d') >= ?4) " + | ||
| 301 | + " or (date_format(v.start_date, '%Y-%m-%d') >= ?3 and date_format(v.end_date, '%Y-%m-%d') <= ?4))" + | ||
| 302 | + ") order by r.versions desc, r.station_route_code asc ", nativeQuery = true) | ||
| 303 | + List<Object[]> findHistory(String lineCode, Integer updown, String date1, String date2); | ||
| 304 | + | ||
| 305 | + @Query("select r from LsStationRoute r where r.line.id=?1 and r.versions=?2 and r.directions=?3 and r.destroy=0 order by r.stationRouteCode") | ||
| 306 | + List<LsStationRoute> findByLineVersion(int lineId, int version, int dir); | ||
| 307 | +} |
src/main/java/com/bsth/repository/StationRouteRepository.java
| @@ -422,7 +422,7 @@ public interface StationRouteRepository extends BaseRepository<StationRoute, Int | @@ -422,7 +422,7 @@ public interface StationRouteRepository extends BaseRepository<StationRoute, Int | ||
| 422 | @Query("select r from StationRoute r where r.line.id=?1 and r.directions=?2 and r.destroy=0 order by r.stationRouteCode") | 422 | @Query("select r from StationRoute r where r.line.id=?1 and r.directions=?2 and r.destroy=0 order by r.stationRouteCode") |
| 423 | List<StationRoute> findByLine(Integer lineId, Integer dir); | 423 | List<StationRoute> findByLine(Integer lineId, Integer dir); |
| 424 | 424 | ||
| 425 | - @Query("select r from StationRoute r where r.lineCode=?1 and r.directions=?2 and versions is not null order by r.destroy, r.stationRouteCode") | 425 | + @Query("select r from StationRoute r where r.lineCode=?1 and r.directions=?2 and r.destroy=0 order by r.stationRouteCode") |
| 426 | List<StationRoute> findAllByLine(String lineCode, int updown); | 426 | List<StationRoute> findAllByLine(String lineCode, int updown); |
| 427 | 427 | ||
| 428 | @EntityGraph(value = "stationRoute_station", type = EntityGraph.EntityGraphType.FETCH) | 428 | @EntityGraph(value = "stationRoute_station", type = EntityGraph.EntityGraphType.FETCH) |
src/main/java/com/bsth/repository/oil/YlbRepository.java
| @@ -47,8 +47,8 @@ public interface YlbRepository extends BaseRepository<Ylb, Integer>{ | @@ -47,8 +47,8 @@ public interface YlbRepository extends BaseRepository<Ylb, Integer>{ | ||
| 47 | List<Ylb> listMaxRqJcsx(String rq,String gsbm,String fgsbm,String xlbm,String nbbm); | 47 | List<Ylb> listMaxRqJcsx(String rq,String gsbm,String fgsbm,String xlbm,String nbbm); |
| 48 | 48 | ||
| 49 | @Query(value="select * from bsth_c_ylb where " | 49 | @Query(value="select * from bsth_c_ylb where " |
| 50 | - + " DATE_SUB(CURDATE(), INTERVAL 30 DAY) <= rq " | ||
| 51 | - + " and rq< ?1 and ssgsdm like %?2%" | 50 | + + " rq >= str_to_date(?1, '%Y-%m-%d') - INTERVAL 90 DAY " |
| 51 | + + " and rq< ?1 and ssgsdm like %?2% " | ||
| 52 | + " and fgsdm like %?3% and xlbm like %?4% and nbbm like %?5% " | 52 | + " and fgsdm like %?3% and xlbm like %?4% and nbbm like %?5% " |
| 53 | + " order by nbbm , rq desc,jcsx desc,lp desc",nativeQuery=true) | 53 | + " order by nbbm , rq desc,jcsx desc,lp desc",nativeQuery=true) |
| 54 | List<Ylb> listByRqJcsx(String rq,String gsbm,String fgsbm,String xlbm,String nbbm); | 54 | List<Ylb> listByRqJcsx(String rq,String gsbm,String fgsbm,String xlbm,String nbbm); |
src/main/java/com/bsth/repository/schedule/TTInfoDetailRepository.java
| @@ -47,6 +47,7 @@ public interface TTInfoDetailRepository extends BaseRepository<TTInfoDetail, Lon | @@ -47,6 +47,7 @@ public interface TTInfoDetailRepository extends BaseRepository<TTInfoDetail, Lon | ||
| 47 | @Query(value = "select tt from TTInfoDetail tt where tt.ttinfo.id = ?1 and tt.lp.id = ?2 order by tt.fcno asc") | 47 | @Query(value = "select tt from TTInfoDetail tt where tt.ttinfo.id = ?1 and tt.lp.id = ?2 order by tt.fcno asc") |
| 48 | List<TTInfoDetail> findBcdetails(Long ttinfoId, Long lpId); | 48 | List<TTInfoDetail> findBcdetails(Long ttinfoId, Long lpId); |
| 49 | 49 | ||
| 50 | + @Query(value = "select tt from TTInfoDetail tt left join fetch tt.lp where tt.ttinfo.id = ?1 ") | ||
| 50 | List<TTInfoDetail> findByTtinfoId(Long id); | 51 | List<TTInfoDetail> findByTtinfoId(Long id); |
| 51 | 52 | ||
| 52 | @Modifying | 53 | @Modifying |
src/main/java/com/bsth/service/InoutCarparkService.java
0 → 100644
| 1 | +package com.bsth.service; | ||
| 2 | + | ||
| 3 | +import com.bsth.entity.LsStationRoute; | ||
| 4 | +import com.bsth.entity.StationRoute; | ||
| 5 | +import com.bsth.entity.StationRouteCache; | ||
| 6 | +import com.fasterxml.jackson.core.JsonProcessingException; | ||
| 7 | + | ||
| 8 | +import javax.servlet.http.HttpServletResponse; | ||
| 9 | +import java.util.List; | ||
| 10 | +import java.util.Map; | ||
| 11 | + | ||
| 12 | +public interface InoutCarparkService { | ||
| 13 | + | ||
| 14 | + Map<String, Object> getStartEndByLine(int lineId, int version); | ||
| 15 | + | ||
| 16 | + Map<String, Object> getRouteByStartEnd(int lineId, int version, String start, String end); | ||
| 17 | + | ||
| 18 | + Map<String, Object> sectionSave(Map<String, Object> map); | ||
| 19 | + | ||
| 20 | + Map<String, Object> sectionUpdate(Map<String, Object> map); | ||
| 21 | + | ||
| 22 | + Map<String, Object> destroy(Map<String, Object> map); | ||
| 23 | + | ||
| 24 | + void pathPlaningByHistory(long schId, int versions) throws JsonProcessingException; | ||
| 25 | +} |
src/main/java/com/bsth/service/TrafficManageService.java
| 1 | -package com.bsth.service; | ||
| 2 | - | ||
| 3 | -/** | ||
| 4 | - * | ||
| 5 | - * @Interface: LineService(线路service业务层实现接口) | ||
| 6 | - * | ||
| 7 | - * @extends : BaseService | ||
| 8 | - * | ||
| 9 | - * @Description: TODO(线路service业务层实现接口) | ||
| 10 | - * | ||
| 11 | - * @Author bsth@lq | ||
| 12 | - * | ||
| 13 | - * @Date 2016年4月28日 上午9:21:17 | ||
| 14 | - * | ||
| 15 | - * @Version 公交调度系统BS版 0.1 | ||
| 16 | - * | ||
| 17 | - */ | ||
| 18 | -public interface TrafficManageService { | ||
| 19 | - | ||
| 20 | - /** | ||
| 21 | - * 上传线路信息 | ||
| 22 | - * | ||
| 23 | - * @return 调用接口返回信息 | ||
| 24 | - */ | ||
| 25 | - String setXL(String ids); | ||
| 26 | - | ||
| 27 | - /** | ||
| 28 | - * 上传线路信息 | ||
| 29 | - * | ||
| 30 | - * @return 调用接口返回信息 | ||
| 31 | - */ | ||
| 32 | - String setXLByInUse(String ids); | ||
| 33 | - | ||
| 34 | - /** | ||
| 35 | - * 上传车辆信息 | ||
| 36 | - * | ||
| 37 | - * @return 调用接口返回信息 | ||
| 38 | - */ | ||
| 39 | - String setCL(); | ||
| 40 | - | ||
| 41 | - /** | ||
| 42 | - * 上传司机信息 | ||
| 43 | - * @return 调用接口返回信息 | ||
| 44 | - */ | ||
| 45 | - String setSJ(); | ||
| 46 | - | ||
| 47 | - /** | ||
| 48 | - * 上传超速数据 | ||
| 49 | - * | ||
| 50 | - * @return 调用接口返回信息 | ||
| 51 | - */ | ||
| 52 | - String setCS(); | ||
| 53 | - | ||
| 54 | - /** | ||
| 55 | - * 上传线路班次时刻表数据 | ||
| 56 | - * | ||
| 57 | - * @return 调用接口返回信息 | ||
| 58 | - */ | ||
| 59 | - String setSKB(String ids); | ||
| 60 | - | ||
| 61 | - /** | ||
| 62 | - * 线路人员车辆配置信息 | ||
| 63 | - * @return 调用接口返回信息 | ||
| 64 | - */ | ||
| 65 | - String setXLPC(); | ||
| 66 | - | ||
| 67 | - /** | ||
| 68 | - * 线路计划班次表 | ||
| 69 | - * @return 调用接口返回信息 | ||
| 70 | - */ | ||
| 71 | - String setJHBC(); | ||
| 72 | - | ||
| 73 | - String setJHBC(String theDate); | ||
| 74 | - | ||
| 75 | - String setLD(String theDate); | ||
| 76 | - | ||
| 77 | - String setLD(); | ||
| 78 | - | ||
| 79 | - String setLDFile(); | ||
| 80 | - | ||
| 81 | - String setLCYH(); | ||
| 82 | - | ||
| 83 | - String setDDRB(); | ||
| 84 | - | ||
| 85 | - /** | ||
| 86 | - * 下载全量的公交基础数据 | ||
| 87 | - * @return | ||
| 88 | - */ | ||
| 89 | - String getDownLoadAllDataFile(); | ||
| 90 | - | ||
| 91 | - /** | ||
| 92 | - * 下载增量的公交基础数据 | ||
| 93 | - * @return | ||
| 94 | - */ | ||
| 95 | - String getDownLoadIncreaseDataFile(); | ||
| 96 | - | ||
| 97 | - /** | ||
| 98 | - * 指定线路查询方式公交基础数据下载 | ||
| 99 | - * @return | ||
| 100 | - */ | ||
| 101 | - String getDownLoadWarrantsBusLineStation(); | ||
| 102 | -} | 1 | +package com.bsth.service; |
| 2 | + | ||
| 3 | +/** | ||
| 4 | + * | ||
| 5 | + * @Interface: LineService(线路service业务层实现接口) | ||
| 6 | + * | ||
| 7 | + * @extends : BaseService | ||
| 8 | + * | ||
| 9 | + * @Description: TODO(线路service业务层实现接口) | ||
| 10 | + * | ||
| 11 | + * @Author bsth@lq | ||
| 12 | + * | ||
| 13 | + * @Date 2016年4月28日 上午9:21:17 | ||
| 14 | + * | ||
| 15 | + * @Version 公交调度系统BS版 0.1 | ||
| 16 | + * | ||
| 17 | + */ | ||
| 18 | +public interface TrafficManageService { | ||
| 19 | + | ||
| 20 | + /** | ||
| 21 | + * 上传线路信息 | ||
| 22 | + * | ||
| 23 | + * @return 调用接口返回信息 | ||
| 24 | + */ | ||
| 25 | + String setXL(String ids); | ||
| 26 | + | ||
| 27 | + /** | ||
| 28 | + * 上传线路信息 | ||
| 29 | + * | ||
| 30 | + * @return 调用接口返回信息 | ||
| 31 | + */ | ||
| 32 | + String setXLByInUse(String ids); | ||
| 33 | + | ||
| 34 | + /** | ||
| 35 | + * 上传车辆信息 | ||
| 36 | + * | ||
| 37 | + * @return 调用接口返回信息 | ||
| 38 | + */ | ||
| 39 | + String setCL(); | ||
| 40 | + | ||
| 41 | + /** | ||
| 42 | + * 上传司机信息 | ||
| 43 | + * @return 调用接口返回信息 | ||
| 44 | + */ | ||
| 45 | + String setSJ(); | ||
| 46 | + | ||
| 47 | + /** | ||
| 48 | + * 上传超速数据 | ||
| 49 | + * | ||
| 50 | + * @return 调用接口返回信息 | ||
| 51 | + */ | ||
| 52 | + String setCS(); | ||
| 53 | + | ||
| 54 | + /** | ||
| 55 | + * 上传线路班次时刻表数据 | ||
| 56 | + * | ||
| 57 | + * @return 调用接口返回信息 | ||
| 58 | + */ | ||
| 59 | + String setSKB(String ids, String qyrqs); | ||
| 60 | + | ||
| 61 | + /** | ||
| 62 | + * 线路人员车辆配置信息 | ||
| 63 | + * @return 调用接口返回信息 | ||
| 64 | + */ | ||
| 65 | + String setXLPC(); | ||
| 66 | + | ||
| 67 | + /** | ||
| 68 | + * 线路计划班次表 | ||
| 69 | + * @return 调用接口返回信息 | ||
| 70 | + */ | ||
| 71 | + String setJHBC(); | ||
| 72 | + | ||
| 73 | + String setJHBC(String theDate); | ||
| 74 | + | ||
| 75 | + String setLD(String theDate); | ||
| 76 | + | ||
| 77 | + String setLD(); | ||
| 78 | + | ||
| 79 | + String setLDFile(); | ||
| 80 | + | ||
| 81 | + String setLCYH(); | ||
| 82 | + | ||
| 83 | + String setDDRB(); | ||
| 84 | + | ||
| 85 | + /** | ||
| 86 | + * 下载全量的公交基础数据 | ||
| 87 | + * @return | ||
| 88 | + */ | ||
| 89 | + String getDownLoadAllDataFile(); | ||
| 90 | + | ||
| 91 | + /** | ||
| 92 | + * 下载增量的公交基础数据 | ||
| 93 | + * @return | ||
| 94 | + */ | ||
| 95 | + String getDownLoadIncreaseDataFile(); | ||
| 96 | + | ||
| 97 | + /** | ||
| 98 | + * 指定线路查询方式公交基础数据下载 | ||
| 99 | + * @return | ||
| 100 | + */ | ||
| 101 | + String getDownLoadWarrantsBusLineStation(); | ||
| 102 | +} |
src/main/java/com/bsth/service/forms/impl/BudgetServiceImpl.java
| @@ -150,7 +150,6 @@ public class BudgetServiceImpl extends BaseServiceImpl<Budget, Integer> implemen | @@ -150,7 +150,6 @@ public class BudgetServiceImpl extends BaseServiceImpl<Budget, Integer> implemen | ||
| 150 | 150 | ||
| 151 | for(int i = 0; i < textList.size(); i++){ | 151 | for(int i = 0; i < textList.size(); i++){ |
| 152 | String text = textList.get(i); | 152 | String text = textList.get(i); |
| 153 | -// System.out.println(text); | ||
| 154 | String[] split = text.split(","); | 153 | String[] split = text.split(","); |
| 155 | int rowNo = Integer.valueOf(split[0].trim()); | 154 | int rowNo = Integer.valueOf(split[0].trim()); |
| 156 | String year = split[1].trim(); | 155 | String year = split[1].trim(); |
| @@ -229,11 +228,11 @@ public class BudgetServiceImpl extends BaseServiceImpl<Budget, Integer> implemen | @@ -229,11 +228,11 @@ public class BudgetServiceImpl extends BaseServiceImpl<Budget, Integer> implemen | ||
| 229 | Budget bud = budgets.get(0); | 228 | Budget bud = budgets.get(0); |
| 230 | if(b.getFormalPerson() != null){ | 229 | if(b.getFormalPerson() != null){ |
| 231 | if(bud.getBudgetMileage() != null){ | 230 | if(bud.getBudgetMileage() != null){ |
| 232 | - bud.setChangeMileage(b.getFormalPerson()); | 231 | + bud.setChangeMileage(b.getFormalMileage()); |
| 233 | } else { | 232 | } else { |
| 234 | - bud.setBudgetMileage(b.getFormalPerson()); | 233 | + bud.setBudgetMileage(b.getFormalMileage()); |
| 235 | } | 234 | } |
| 236 | - bud.setFormalMileage(b.getFormalPerson()); | 235 | + bud.setFormalMileage(b.getFormalMileage()); |
| 237 | } | 236 | } |
| 238 | if(b.getFormalPerson() != null){ | 237 | if(b.getFormalPerson() != null){ |
| 239 | if(bud.getBudgetPerson() != null){ | 238 | if(bud.getBudgetPerson() != null){ |
| @@ -251,11 +250,11 @@ public class BudgetServiceImpl extends BaseServiceImpl<Budget, Integer> implemen | @@ -251,11 +250,11 @@ public class BudgetServiceImpl extends BaseServiceImpl<Budget, Integer> implemen | ||
| 251 | } | 250 | } |
| 252 | bud.setFormalAmounts(b.getFormalAmounts()); | 251 | bud.setFormalAmounts(b.getFormalAmounts()); |
| 253 | } | 252 | } |
| 254 | - repository.update(bud.getBudgetMileage(), bud.getChangeMileage(), bud.getFormalPerson(), | 253 | + repository.update(bud.getBudgetMileage(), bud.getChangeMileage(), bud.getFormalMileage(), |
| 255 | bud.getBudgetPerson(), bud.getChangePerson(), bud.getFormalPerson(), | 254 | bud.getBudgetPerson(), bud.getChangePerson(), bud.getFormalPerson(), |
| 256 | bud.getBudgetAmounts(), bud.getChangeAmounts(), bud.getFormalAmounts(), bud.getId()); | 255 | bud.getBudgetAmounts(), bud.getChangeAmounts(), bud.getFormalAmounts(), bud.getId()); |
| 257 | } else { | 256 | } else { |
| 258 | - b.setBudgetMileage(b.getFormalPerson()); | 257 | + b.setBudgetMileage(b.getFormalMileage()); |
| 259 | b.setBudgetPerson(b.getFormalPerson()); | 258 | b.setBudgetPerson(b.getFormalPerson()); |
| 260 | b.setBudgetAmounts(b.getFormalAmounts()); | 259 | b.setBudgetAmounts(b.getFormalAmounts()); |
| 261 | insertList.add(b); | 260 | insertList.add(b); |
| @@ -380,7 +379,6 @@ public class BudgetServiceImpl extends BaseServiceImpl<Budget, Integer> implemen | @@ -380,7 +379,6 @@ public class BudgetServiceImpl extends BaseServiceImpl<Budget, Integer> implemen | ||
| 380 | r.setXlName(lineAllMap.get(name).getName()); | 379 | r.setXlName(lineAllMap.get(name).getName()); |
| 381 | } | 380 | } |
| 382 | } else { | 381 | } else { |
| 383 | - boolean flag = true; | ||
| 384 | for(String key : lineAllMap.keySet()){ | 382 | for(String key : lineAllMap.keySet()){ |
| 385 | Line l = lineAllMap.get(key); | 383 | Line l = lineAllMap.get(key); |
| 386 | String name = l.getName(); | 384 | String name = l.getName(); |
| @@ -388,15 +386,11 @@ public class BudgetServiceImpl extends BaseServiceImpl<Budget, Integer> implemen | @@ -388,15 +386,11 @@ public class BudgetServiceImpl extends BaseServiceImpl<Budget, Integer> implemen | ||
| 388 | name = name.replaceAll("区间", "") + l.getStartStationName().substring(0, 1); | 386 | name = name.replaceAll("区间", "") + l.getStartStationName().substring(0, 1); |
| 389 | } | 387 | } |
| 390 | if(l.getName().equals(lineName) || name.equals(lineName)){ | 388 | if(l.getName().equals(lineName) || name.equals(lineName)){ |
| 391 | - flag = false; | ||
| 392 | r.setXlBm(l.getLineCode()); | 389 | r.setXlBm(l.getLineCode()); |
| 393 | r.setXlName(l.getName()); | 390 | r.setXlName(l.getName()); |
| 394 | break; | 391 | break; |
| 395 | } | 392 | } |
| 396 | } | 393 | } |
| 397 | -// if(flag){ | ||
| 398 | -// System.out.println(m.get("lineName").toString() + " >> " + lineName); | ||
| 399 | -// } | ||
| 400 | } | 394 | } |
| 401 | 395 | ||
| 402 | if(r.getXlBm() != null){ | 396 | if(r.getXlBm() != null){ |
| @@ -432,6 +426,7 @@ public class BudgetServiceImpl extends BaseServiceImpl<Budget, Integer> implemen | @@ -432,6 +426,7 @@ public class BudgetServiceImpl extends BaseServiceImpl<Budget, Integer> implemen | ||
| 432 | // TODO Auto-generated method stub | 426 | // TODO Auto-generated method stub |
| 433 | SimpleDateFormat sdfYY = new SimpleDateFormat("YYYY"); | 427 | SimpleDateFormat sdfYY = new SimpleDateFormat("YYYY"); |
| 434 | SimpleDateFormat sdfMM = new SimpleDateFormat("MM"); | 428 | SimpleDateFormat sdfMM = new SimpleDateFormat("MM"); |
| 429 | + DecimalFormat df = new DecimalFormat("0.###"); | ||
| 435 | List<Map<String, Object>> resList = new ArrayList<Map<String, Object>>(); | 430 | List<Map<String, Object>> resList = new ArrayList<Map<String, Object>>(); |
| 436 | Map<String, Map<String, Object>> keyMap = new HashMap<String, Map<String, Object>>(); | 431 | Map<String, Map<String, Object>> keyMap = new HashMap<String, Map<String, Object>>(); |
| 437 | Map<String, Boolean> lineNature = lineService.lineNature(); | 432 | Map<String, Boolean> lineNature = lineService.lineNature(); |
| @@ -474,9 +469,9 @@ public class BudgetServiceImpl extends BaseServiceImpl<Budget, Integer> implemen | @@ -474,9 +469,9 @@ public class BudgetServiceImpl extends BaseServiceImpl<Budget, Integer> implemen | ||
| 474 | m.put("xlName", xlName); | 469 | m.put("xlName", xlName); |
| 475 | m.put("sfyy", sfyy); | 470 | m.put("sfyy", sfyy); |
| 476 | m.put("sfjc", sfjc); | 471 | m.put("sfjc", sfjc); |
| 477 | - m.put("budget", b.getBudgetMileage()!=null?b.getBudgetMileage():""); | ||
| 478 | - m.put("change", b.getChangeMileage()!=null?b.getChangeMileage():""); | ||
| 479 | - m.put("formal", b.getFormalMileage()!=null?b.getFormalMileage():""); | 472 | + m.put("budget", b.getBudgetMileage()!=null?df.format(b.getBudgetMileage()):""); |
| 473 | + m.put("change", b.getChangeMileage()!=null?df.format(b.getChangeMileage()):""); | ||
| 474 | + m.put("formal", b.getFormalMileage()!=null?df.format(b.getFormalMileage()):""); | ||
| 480 | for(int i = 1; i <= 12; i++){ | 475 | for(int i = 1; i <= 12; i++){ |
| 481 | m.put("mon"+i, ""); | 476 | m.put("mon"+i, ""); |
| 482 | m.put("bud"+i, ""); | 477 | m.put("bud"+i, ""); |
| @@ -494,28 +489,28 @@ public class BudgetServiceImpl extends BaseServiceImpl<Budget, Integer> implemen | @@ -494,28 +489,28 @@ public class BudgetServiceImpl extends BaseServiceImpl<Budget, Integer> implemen | ||
| 494 | String bud = "bud" + Integer.valueOf(b.getYear().split("-")[1]); | 489 | String bud = "bud" + Integer.valueOf(b.getYear().split("-")[1]); |
| 495 | if(b.getBudgetMileage()!=null){ | 490 | if(b.getBudgetMileage()!=null){ |
| 496 | if(m.get("budget").toString().length() > 0){ | 491 | if(m.get("budget").toString().length() > 0){ |
| 497 | - m.put("budget", new BigDecimal(m.get("budget").toString()).add( | ||
| 498 | - new BigDecimal(b.getBudgetMileage())).doubleValue()); | 492 | + m.put("budget", df.format(new BigDecimal(m.get("budget").toString()).add( |
| 493 | + new BigDecimal(b.getBudgetMileage())).doubleValue())); | ||
| 499 | } else { | 494 | } else { |
| 500 | - m.put("budget", b.getBudgetMileage()); | 495 | + m.put("budget", df.format(b.getBudgetMileage())); |
| 501 | } | 496 | } |
| 502 | } | 497 | } |
| 503 | if(b.getChangeMileage()!=null){ | 498 | if(b.getChangeMileage()!=null){ |
| 504 | if(m.get("change").toString().length() > 0){ | 499 | if(m.get("change").toString().length() > 0){ |
| 505 | - m.put("change", new BigDecimal(m.get("change").toString()).add( | ||
| 506 | - new BigDecimal(b.getChangeMileage())).doubleValue()); | 500 | + m.put("change", df.format(new BigDecimal(m.get("change").toString()).add( |
| 501 | + new BigDecimal(b.getChangeMileage())).doubleValue())); | ||
| 507 | } else { | 502 | } else { |
| 508 | - m.put("change", b.getChangeMileage()); | 503 | + m.put("change", df.format(b.getChangeMileage())); |
| 509 | } | 504 | } |
| 510 | } | 505 | } |
| 511 | if(b.getFormalMileage()!=null){ | 506 | if(b.getFormalMileage()!=null){ |
| 512 | if(m.get("formal").toString().length() > 0){ | 507 | if(m.get("formal").toString().length() > 0){ |
| 513 | - m.put("formal", new BigDecimal(m.get("formal").toString()).add( | ||
| 514 | - new BigDecimal(b.getFormalMileage())).doubleValue()); | 508 | + m.put("formal", df.format(new BigDecimal(m.get("formal").toString()).add( |
| 509 | + new BigDecimal(b.getFormalMileage())).doubleValue())); | ||
| 515 | } else { | 510 | } else { |
| 516 | - m.put("formal", b.getFormalMileage()); | 511 | + m.put("formal", df.format(b.getFormalMileage())); |
| 517 | } | 512 | } |
| 518 | - m.put(bud, b.getFormalMileage()); | 513 | + m.put(bud, df.format(b.getFormalMileage())); |
| 519 | } | 514 | } |
| 520 | } | 515 | } |
| 521 | } | 516 | } |
| @@ -611,6 +606,50 @@ public class BudgetServiceImpl extends BaseServiceImpl<Budget, Integer> implemen | @@ -611,6 +606,50 @@ public class BudgetServiceImpl extends BaseServiceImpl<Budget, Integer> implemen | ||
| 611 | } | 606 | } |
| 612 | strList.add(gsBm + "_all"); | 607 | strList.add(gsBm + "_all"); |
| 613 | 608 | ||
| 609 | + BigDecimal monAll = new BigDecimal("0"); | ||
| 610 | + BigDecimal preAll = new BigDecimal("0"); | ||
| 611 | + for(int i = 1; i <= 12; i++){ | ||
| 612 | + if(m.get("mon"+i).toString().length() > 0){ | ||
| 613 | + BigDecimal val = new BigDecimal(m.get("mon"+i).toString()); | ||
| 614 | + monAll = monAll.add(val); | ||
| 615 | + val = val.divide(new BigDecimal("10000"), 3, BigDecimal.ROUND_HALF_UP); | ||
| 616 | + m.put("mon"+i, val.doubleValue()); | ||
| 617 | + } | ||
| 618 | + if(m.get("pre"+i).toString().length() > 0){ | ||
| 619 | + BigDecimal val = new BigDecimal(m.get("pre"+i).toString()); | ||
| 620 | + preAll = preAll.add(val); | ||
| 621 | + val = val.divide(new BigDecimal("10000"), 3, BigDecimal.ROUND_HALF_UP); | ||
| 622 | + m.put("pre"+i, val.doubleValue()); | ||
| 623 | + if(m.get("mon"+i).toString().length() > 0){ | ||
| 624 | + BigDecimal monVal = new BigDecimal(m.get("mon"+i).toString()); | ||
| 625 | + BigDecimal sub = monVal.subtract(val); | ||
| 626 | + m.put("sub"+i, sub.doubleValue() > 0 ? "+" + sub.doubleValue() : sub.doubleValue()); | ||
| 627 | + } else { | ||
| 628 | + m.put("sub"+i, "-" + val.doubleValue()); | ||
| 629 | + } | ||
| 630 | + } | ||
| 631 | + } | ||
| 632 | + monAll = monAll.divide(new BigDecimal("10000"), 3, BigDecimal.ROUND_HALF_UP); | ||
| 633 | + preAll = preAll.divide(new BigDecimal("10000"), 3, BigDecimal.ROUND_HALF_UP); | ||
| 634 | + Double subAll = monAll.subtract(preAll).doubleValue(); | ||
| 635 | + m.put("monAll", monAll.doubleValue()); | ||
| 636 | + m.put("preAll", preAll.doubleValue()); | ||
| 637 | + m.put("subAll", subAll > 0 ? "+" + subAll : subAll); | ||
| 638 | + | ||
| 639 | + if(m.get("formal").toString().length() > 0 && m.get("monAll").toString().length() > 0 | ||
| 640 | + && new BigDecimal(m.get("formal").toString()).doubleValue() > 0d){ | ||
| 641 | + BigDecimal formal = new BigDecimal(m.get("formal").toString()); | ||
| 642 | + m.put("complete", monAll.divide( | ||
| 643 | + formal, 4, BigDecimal.ROUND_HALF_UP).multiply( | ||
| 644 | + new BigDecimal(100)).divide( | ||
| 645 | + new BigDecimal(1), 2, BigDecimal.ROUND_HALF_UP)+ "%"); | ||
| 646 | + BigDecimal diff = monAll.subtract(formal); | ||
| 647 | + m.put("diff", diff.doubleValue() > 0 ? "+" + diff.doubleValue() : diff.doubleValue()); | ||
| 648 | + } else { | ||
| 649 | + m.put("complete", ""); | ||
| 650 | + m.put("diff", ""); | ||
| 651 | + } | ||
| 652 | + | ||
| 614 | for(String str : strList){ | 653 | for(String str : strList){ |
| 615 | if(!keyMap.containsKey(str)){ | 654 | if(!keyMap.containsKey(str)){ |
| 616 | continue; | 655 | continue; |
| @@ -652,7 +691,7 @@ public class BudgetServiceImpl extends BaseServiceImpl<Budget, Integer> implemen | @@ -652,7 +691,7 @@ public class BudgetServiceImpl extends BaseServiceImpl<Budget, Integer> implemen | ||
| 652 | } | 691 | } |
| 653 | if(m.get(bud).toString().length() > 0){ | 692 | if(m.get(bud).toString().length() > 0){ |
| 654 | if(map.get(bud).toString().length() > 0){ | 693 | if(map.get(bud).toString().length() > 0){ |
| 655 | - map.put(mon, new BigDecimal(m.get(bud).toString()).add( | 694 | + map.put(bud, new BigDecimal(m.get(bud).toString()).add( |
| 656 | new BigDecimal(map.get(bud).toString())).doubleValue()); | 695 | new BigDecimal(map.get(bud).toString())).doubleValue()); |
| 657 | } else { | 696 | } else { |
| 658 | map.put(bud, new BigDecimal(m.get(bud).toString()).doubleValue()); | 697 | map.put(bud, new BigDecimal(m.get(bud).toString()).doubleValue()); |
| @@ -670,50 +709,6 @@ public class BudgetServiceImpl extends BaseServiceImpl<Budget, Integer> implemen | @@ -670,50 +709,6 @@ public class BudgetServiceImpl extends BaseServiceImpl<Budget, Integer> implemen | ||
| 670 | List<Map<String, Object>>dataList = (List<Map<String, Object>>)map.get("dataList"); | 709 | List<Map<String, Object>>dataList = (List<Map<String, Object>>)map.get("dataList"); |
| 671 | dataList.add(m); | 710 | dataList.add(m); |
| 672 | } | 711 | } |
| 673 | - | ||
| 674 | - BigDecimal monAll = new BigDecimal("0"); | ||
| 675 | - BigDecimal preAll = new BigDecimal("0"); | ||
| 676 | - for(int i = 1; i <= 12; i++){ | ||
| 677 | - if(m.get("mon"+i).toString().length() > 0){ | ||
| 678 | - BigDecimal val = new BigDecimal(m.get("mon"+i).toString()); | ||
| 679 | - monAll = monAll.add(val); | ||
| 680 | - val = val.divide(new BigDecimal("10000"), 3, BigDecimal.ROUND_HALF_UP); | ||
| 681 | - m.put("mon"+i, val.doubleValue()); | ||
| 682 | - } | ||
| 683 | - if(m.get("pre"+i).toString().length() > 0){ | ||
| 684 | - BigDecimal val = new BigDecimal(m.get("pre"+i).toString()); | ||
| 685 | - preAll = preAll.add(val); | ||
| 686 | - val = val.divide(new BigDecimal("10000"), 3, BigDecimal.ROUND_HALF_UP); | ||
| 687 | - m.put("pre"+i, val.doubleValue()); | ||
| 688 | - if(m.get("mon"+i).toString().length() > 0){ | ||
| 689 | - BigDecimal monVal = new BigDecimal(m.get("mon"+i).toString()); | ||
| 690 | - BigDecimal sub = monVal.subtract(val); | ||
| 691 | - m.put("sub"+i, sub.doubleValue() > 0 ? "+" + sub.doubleValue() : sub.doubleValue()); | ||
| 692 | - } else { | ||
| 693 | - m.put("sub"+i, "-" + val.doubleValue()); | ||
| 694 | - } | ||
| 695 | - } | ||
| 696 | - } | ||
| 697 | - monAll = monAll.divide(new BigDecimal("10000"), 3, BigDecimal.ROUND_HALF_UP); | ||
| 698 | - preAll = preAll.divide(new BigDecimal("10000"), 3, BigDecimal.ROUND_HALF_UP); | ||
| 699 | - Double subAll = monAll.subtract(preAll).doubleValue(); | ||
| 700 | - m.put("monAll", monAll.doubleValue()); | ||
| 701 | - m.put("preAll", preAll.doubleValue()); | ||
| 702 | - m.put("subAll", subAll > 0 ? "+" + subAll : subAll); | ||
| 703 | - | ||
| 704 | - if(m.get("formal").toString().length() > 0 && m.get("monAll").toString().length() > 0 | ||
| 705 | - && new BigDecimal(m.get("formal").toString()).doubleValue() > 0d){ | ||
| 706 | - BigDecimal formal = new BigDecimal(m.get("formal").toString()); | ||
| 707 | - m.put("complete", monAll.divide( | ||
| 708 | - formal, 4, BigDecimal.ROUND_HALF_UP).multiply( | ||
| 709 | - new BigDecimal(100)).divide( | ||
| 710 | - new BigDecimal(1), 2, BigDecimal.ROUND_HALF_UP)+ "%"); | ||
| 711 | - BigDecimal diff = monAll.subtract(formal); | ||
| 712 | - m.put("diff", diff.doubleValue() > 0 ? "+" + diff.doubleValue() : diff.doubleValue()); | ||
| 713 | - } else { | ||
| 714 | - m.put("complete", ""); | ||
| 715 | - m.put("diff", ""); | ||
| 716 | - } | ||
| 717 | } | 712 | } |
| 718 | 713 | ||
| 719 | for(String key : strs){ | 714 | for(String key : strs){ |
| @@ -764,14 +759,10 @@ public class BudgetServiceImpl extends BaseServiceImpl<Budget, Integer> implemen | @@ -764,14 +759,10 @@ public class BudgetServiceImpl extends BaseServiceImpl<Budget, Integer> implemen | ||
| 764 | if(m.get("mon"+i).toString().length() > 0){ | 759 | if(m.get("mon"+i).toString().length() > 0){ |
| 765 | BigDecimal val = new BigDecimal(m.get("mon"+i).toString()); | 760 | BigDecimal val = new BigDecimal(m.get("mon"+i).toString()); |
| 766 | monAll = monAll.add(val); | 761 | monAll = monAll.add(val); |
| 767 | - val = val.divide(new BigDecimal("10000"), 3, BigDecimal.ROUND_HALF_UP); | ||
| 768 | - m.put("mon"+i, val.doubleValue()); | ||
| 769 | } | 762 | } |
| 770 | if(m.get("pre"+i).toString().length() > 0){ | 763 | if(m.get("pre"+i).toString().length() > 0){ |
| 771 | BigDecimal val = new BigDecimal(m.get("pre"+i).toString()); | 764 | BigDecimal val = new BigDecimal(m.get("pre"+i).toString()); |
| 772 | preAll = preAll.add(val); | 765 | preAll = preAll.add(val); |
| 773 | - val = val.divide(new BigDecimal("10000"), 3, BigDecimal.ROUND_HALF_UP); | ||
| 774 | - m.put("pre"+i, val.doubleValue()); | ||
| 775 | if(m.get("mon"+i).toString().length() > 0){ | 766 | if(m.get("mon"+i).toString().length() > 0){ |
| 776 | BigDecimal monVal = new BigDecimal(m.get("mon"+i).toString()); | 767 | BigDecimal monVal = new BigDecimal(m.get("mon"+i).toString()); |
| 777 | BigDecimal sub = monVal.subtract(val); | 768 | BigDecimal sub = monVal.subtract(val); |
| @@ -781,8 +772,6 @@ public class BudgetServiceImpl extends BaseServiceImpl<Budget, Integer> implemen | @@ -781,8 +772,6 @@ public class BudgetServiceImpl extends BaseServiceImpl<Budget, Integer> implemen | ||
| 781 | } | 772 | } |
| 782 | } | 773 | } |
| 783 | } | 774 | } |
| 784 | - monAll = monAll.divide(new BigDecimal("10000"), 3, BigDecimal.ROUND_HALF_UP); | ||
| 785 | - preAll = preAll.divide(new BigDecimal("10000"), 3, BigDecimal.ROUND_HALF_UP); | ||
| 786 | Double subAll = monAll.subtract(preAll).doubleValue(); | 775 | Double subAll = monAll.subtract(preAll).doubleValue(); |
| 787 | m.put("monAll", monAll.doubleValue()); | 776 | m.put("monAll", monAll.doubleValue()); |
| 788 | m.put("preAll", preAll.doubleValue()); | 777 | m.put("preAll", preAll.doubleValue()); |
| @@ -869,6 +858,7 @@ public class BudgetServiceImpl extends BaseServiceImpl<Budget, Integer> implemen | @@ -869,6 +858,7 @@ public class BudgetServiceImpl extends BaseServiceImpl<Budget, Integer> implemen | ||
| 869 | // TODO Auto-generated method stub | 858 | // TODO Auto-generated method stub |
| 870 | SimpleDateFormat sdfYY = new SimpleDateFormat("YYYY"); | 859 | SimpleDateFormat sdfYY = new SimpleDateFormat("YYYY"); |
| 871 | SimpleDateFormat sdfMM = new SimpleDateFormat("MM"); | 860 | SimpleDateFormat sdfMM = new SimpleDateFormat("MM"); |
| 861 | + DecimalFormat df = new DecimalFormat("0.###"); | ||
| 872 | List<Map<String, Object>> resList = new ArrayList<Map<String, Object>>(); | 862 | List<Map<String, Object>> resList = new ArrayList<Map<String, Object>>(); |
| 873 | Map<String, Map<String, Object>> keyMap = new HashMap<String, Map<String, Object>>(); | 863 | Map<String, Map<String, Object>> keyMap = new HashMap<String, Map<String, Object>>(); |
| 874 | Map<String, Boolean> lineNature = lineService.lineNature(); | 864 | Map<String, Boolean> lineNature = lineService.lineNature(); |
| @@ -911,9 +901,9 @@ public class BudgetServiceImpl extends BaseServiceImpl<Budget, Integer> implemen | @@ -911,9 +901,9 @@ public class BudgetServiceImpl extends BaseServiceImpl<Budget, Integer> implemen | ||
| 911 | m.put("xlName", xlName); | 901 | m.put("xlName", xlName); |
| 912 | m.put("sfyy", sfyy); | 902 | m.put("sfyy", sfyy); |
| 913 | m.put("sfjc", sfjc); | 903 | m.put("sfjc", sfjc); |
| 914 | - m.put("budget", b.getBudgetPerson()!=null?b.getBudgetPerson():""); | ||
| 915 | - m.put("change", b.getChangePerson()!=null?b.getChangePerson():""); | ||
| 916 | - m.put("formal", b.getFormalPerson()!=null?b.getFormalPerson():""); | 904 | + m.put("budget", b.getBudgetPerson()!=null?df.format(b.getBudgetPerson()):""); |
| 905 | + m.put("change", b.getChangePerson()!=null?df.format(b.getChangePerson()):""); | ||
| 906 | + m.put("formal", b.getFormalPerson()!=null?df.format(b.getFormalPerson()):""); | ||
| 917 | for(int i = 1; i <= 12; i++){ | 907 | for(int i = 1; i <= 12; i++){ |
| 918 | m.put("mon"+i, ""); | 908 | m.put("mon"+i, ""); |
| 919 | m.put("bud"+i, ""); | 909 | m.put("bud"+i, ""); |
| @@ -931,28 +921,28 @@ public class BudgetServiceImpl extends BaseServiceImpl<Budget, Integer> implemen | @@ -931,28 +921,28 @@ public class BudgetServiceImpl extends BaseServiceImpl<Budget, Integer> implemen | ||
| 931 | String bud = "bud" + Integer.valueOf(b.getYear().split("-")[1]); | 921 | String bud = "bud" + Integer.valueOf(b.getYear().split("-")[1]); |
| 932 | if(b.getBudgetPerson()!=null){ | 922 | if(b.getBudgetPerson()!=null){ |
| 933 | if(m.get("budget").toString().length() > 0){ | 923 | if(m.get("budget").toString().length() > 0){ |
| 934 | - m.put("budget", new BigDecimal(m.get("budget").toString()).add( | ||
| 935 | - new BigDecimal(b.getBudgetPerson())).doubleValue()); | 924 | + m.put("budget", df.format(new BigDecimal(m.get("budget").toString()).add( |
| 925 | + new BigDecimal(b.getBudgetPerson())).doubleValue())); | ||
| 936 | } else { | 926 | } else { |
| 937 | - m.put("budget", b.getBudgetPerson()); | 927 | + m.put("budget", df.format(b.getBudgetPerson())); |
| 938 | } | 928 | } |
| 939 | } | 929 | } |
| 940 | if(b.getChangePerson()!=null){ | 930 | if(b.getChangePerson()!=null){ |
| 941 | if(m.get("change").toString().length() > 0){ | 931 | if(m.get("change").toString().length() > 0){ |
| 942 | - m.put("change", new BigDecimal(m.get("change").toString()).add( | ||
| 943 | - new BigDecimal(b.getChangePerson())).doubleValue()); | 932 | + m.put("change", df.format(new BigDecimal(m.get("change").toString()).add( |
| 933 | + new BigDecimal(b.getChangePerson())).doubleValue())); | ||
| 944 | } else { | 934 | } else { |
| 945 | - m.put("change", b.getChangePerson()); | 935 | + m.put("change", df.format(b.getChangePerson())); |
| 946 | } | 936 | } |
| 947 | } | 937 | } |
| 948 | if(b.getFormalPerson()!=null){ | 938 | if(b.getFormalPerson()!=null){ |
| 949 | if(m.get("formal").toString().length() > 0){ | 939 | if(m.get("formal").toString().length() > 0){ |
| 950 | - m.put("formal", new BigDecimal(m.get("formal").toString()).add( | ||
| 951 | - new BigDecimal(b.getFormalPerson())).doubleValue()); | 940 | + m.put("formal", df.format(new BigDecimal(m.get("formal").toString()).add( |
| 941 | + new BigDecimal(b.getFormalPerson())).doubleValue())); | ||
| 952 | } else { | 942 | } else { |
| 953 | - m.put("formal", b.getFormalPerson()); | 943 | + m.put("formal", df.format(b.getFormalPerson())); |
| 954 | } | 944 | } |
| 955 | - m.put(bud, b.getFormalPerson()); | 945 | + m.put(bud, df.format(b.getFormalPerson())); |
| 956 | } | 946 | } |
| 957 | } | 947 | } |
| 958 | } | 948 | } |
| @@ -1091,7 +1081,7 @@ public class BudgetServiceImpl extends BaseServiceImpl<Budget, Integer> implemen | @@ -1091,7 +1081,7 @@ public class BudgetServiceImpl extends BaseServiceImpl<Budget, Integer> implemen | ||
| 1091 | } | 1081 | } |
| 1092 | if(m.get(bud).toString().length() > 0){ | 1082 | if(m.get(bud).toString().length() > 0){ |
| 1093 | if(map.get(bud).toString().length() > 0){ | 1083 | if(map.get(bud).toString().length() > 0){ |
| 1094 | - map.put(mon, new BigDecimal(m.get(bud).toString()).add( | 1084 | + map.put(bud, new BigDecimal(m.get(bud).toString()).add( |
| 1095 | new BigDecimal(map.get(bud).toString())).doubleValue()); | 1085 | new BigDecimal(map.get(bud).toString())).doubleValue()); |
| 1096 | } else { | 1086 | } else { |
| 1097 | map.put(bud, new BigDecimal(m.get(bud).toString()).doubleValue()); | 1087 | map.put(bud, new BigDecimal(m.get(bud).toString()).doubleValue()); |
| @@ -1308,6 +1298,7 @@ public class BudgetServiceImpl extends BaseServiceImpl<Budget, Integer> implemen | @@ -1308,6 +1298,7 @@ public class BudgetServiceImpl extends BaseServiceImpl<Budget, Integer> implemen | ||
| 1308 | // TODO Auto-generated method stub | 1298 | // TODO Auto-generated method stub |
| 1309 | SimpleDateFormat sdfYY = new SimpleDateFormat("YYYY"); | 1299 | SimpleDateFormat sdfYY = new SimpleDateFormat("YYYY"); |
| 1310 | SimpleDateFormat sdfMM = new SimpleDateFormat("MM"); | 1300 | SimpleDateFormat sdfMM = new SimpleDateFormat("MM"); |
| 1301 | + DecimalFormat df = new DecimalFormat("0.###"); | ||
| 1311 | List<Map<String, Object>> resList = new ArrayList<Map<String, Object>>(); | 1302 | List<Map<String, Object>> resList = new ArrayList<Map<String, Object>>(); |
| 1312 | Map<String, Map<String, Object>> keyMap = new HashMap<String, Map<String, Object>>(); | 1303 | Map<String, Map<String, Object>> keyMap = new HashMap<String, Map<String, Object>>(); |
| 1313 | Map<String, Boolean> lineNature = lineService.lineNature(); | 1304 | Map<String, Boolean> lineNature = lineService.lineNature(); |
| @@ -1351,9 +1342,9 @@ public class BudgetServiceImpl extends BaseServiceImpl<Budget, Integer> implemen | @@ -1351,9 +1342,9 @@ public class BudgetServiceImpl extends BaseServiceImpl<Budget, Integer> implemen | ||
| 1351 | m.put("xlName", xlName); | 1342 | m.put("xlName", xlName); |
| 1352 | m.put("sfyy", sfyy); | 1343 | m.put("sfyy", sfyy); |
| 1353 | m.put("sfjc", sfjc); | 1344 | m.put("sfjc", sfjc); |
| 1354 | - m.put("budget", b.getBudgetAmounts()!=null?b.getBudgetAmounts():""); | ||
| 1355 | - m.put("change", b.getChangeAmounts()!=null?b.getChangeAmounts():""); | ||
| 1356 | - m.put("formal", b.getFormalAmounts()!=null?b.getFormalAmounts():""); | 1345 | + m.put("budget", b.getBudgetAmounts()!=null?df.format(b.getBudgetAmounts()):""); |
| 1346 | + m.put("change", b.getChangeAmounts()!=null?df.format(b.getChangeAmounts()):""); | ||
| 1347 | + m.put("formal", b.getFormalAmounts()!=null?df.format(b.getFormalAmounts()):""); | ||
| 1357 | for(int i = 1; i <= 12; i++){ | 1348 | for(int i = 1; i <= 12; i++){ |
| 1358 | m.put("mon"+i, ""); | 1349 | m.put("mon"+i, ""); |
| 1359 | m.put("bud"+i, ""); | 1350 | m.put("bud"+i, ""); |
| @@ -1372,28 +1363,28 @@ public class BudgetServiceImpl extends BaseServiceImpl<Budget, Integer> implemen | @@ -1372,28 +1363,28 @@ public class BudgetServiceImpl extends BaseServiceImpl<Budget, Integer> implemen | ||
| 1372 | String bud = "bud" + Integer.valueOf(b.getYear().split("-")[1]); | 1363 | String bud = "bud" + Integer.valueOf(b.getYear().split("-")[1]); |
| 1373 | if(b.getBudgetAmounts()!=null){ | 1364 | if(b.getBudgetAmounts()!=null){ |
| 1374 | if(m.get("budget").toString().length() > 0){ | 1365 | if(m.get("budget").toString().length() > 0){ |
| 1375 | - m.put("budget", new BigDecimal(m.get("budget").toString()).add( | ||
| 1376 | - new BigDecimal(b.getBudgetAmounts())).doubleValue()); | 1366 | + m.put("budget", df.format(new BigDecimal(m.get("budget").toString()).add( |
| 1367 | + new BigDecimal(b.getBudgetAmounts())).doubleValue())); | ||
| 1377 | } else { | 1368 | } else { |
| 1378 | - m.put("budget", b.getBudgetAmounts()); | 1369 | + m.put("budget", df.format(b.getBudgetAmounts())); |
| 1379 | } | 1370 | } |
| 1380 | } | 1371 | } |
| 1381 | if(b.getChangeAmounts()!=null){ | 1372 | if(b.getChangeAmounts()!=null){ |
| 1382 | if(m.get("change").toString().length() > 0){ | 1373 | if(m.get("change").toString().length() > 0){ |
| 1383 | - m.put("change", new BigDecimal(m.get("change").toString()).add( | ||
| 1384 | - new BigDecimal(b.getChangeAmounts())).doubleValue()); | 1374 | + m.put("change", df.format(new BigDecimal(m.get("change").toString()).add( |
| 1375 | + new BigDecimal(b.getChangeAmounts())).doubleValue())); | ||
| 1385 | } else { | 1376 | } else { |
| 1386 | - m.put("change", b.getChangeAmounts()); | 1377 | + m.put("change", df.format(b.getChangeAmounts())); |
| 1387 | } | 1378 | } |
| 1388 | } | 1379 | } |
| 1389 | if(b.getFormalAmounts()!=null){ | 1380 | if(b.getFormalAmounts()!=null){ |
| 1390 | if(m.get("formal").toString().length() > 0){ | 1381 | if(m.get("formal").toString().length() > 0){ |
| 1391 | - m.put("formal", new BigDecimal(m.get("formal").toString()).add( | ||
| 1392 | - new BigDecimal(b.getFormalAmounts())).doubleValue()); | 1382 | + m.put("formal", df.format(new BigDecimal(m.get("formal").toString()).add( |
| 1383 | + new BigDecimal(b.getFormalAmounts())).doubleValue())); | ||
| 1393 | } else { | 1384 | } else { |
| 1394 | - m.put("formal", b.getFormalAmounts()); | 1385 | + m.put("formal", df.format(b.getFormalAmounts())); |
| 1395 | } | 1386 | } |
| 1396 | - m.put(bud, b.getFormalAmounts()); | 1387 | + m.put(bud, df.format(b.getFormalAmounts())); |
| 1397 | } | 1388 | } |
| 1398 | } | 1389 | } |
| 1399 | } | 1390 | } |
| @@ -1529,7 +1520,7 @@ public class BudgetServiceImpl extends BaseServiceImpl<Budget, Integer> implemen | @@ -1529,7 +1520,7 @@ public class BudgetServiceImpl extends BaseServiceImpl<Budget, Integer> implemen | ||
| 1529 | } | 1520 | } |
| 1530 | } | 1521 | } |
| 1531 | for(int i = 1; i <= 12; i++){ | 1522 | for(int i = 1; i <= 12; i++){ |
| 1532 | - String mon = "mon"+i, bud = "bud"+i; | 1523 | + String mon = "mon"+i, bud = "bud"+i, pre = "pre"+i; |
| 1533 | if(m.get(mon).toString().length() > 0){ | 1524 | if(m.get(mon).toString().length() > 0){ |
| 1534 | if(map.get(mon).toString().length() > 0){ | 1525 | if(map.get(mon).toString().length() > 0){ |
| 1535 | map.put(mon, new BigDecimal(m.get(mon).toString()).add( | 1526 | map.put(mon, new BigDecimal(m.get(mon).toString()).add( |
| @@ -1540,12 +1531,20 @@ public class BudgetServiceImpl extends BaseServiceImpl<Budget, Integer> implemen | @@ -1540,12 +1531,20 @@ public class BudgetServiceImpl extends BaseServiceImpl<Budget, Integer> implemen | ||
| 1540 | } | 1531 | } |
| 1541 | if(m.get(bud).toString().length() > 0){ | 1532 | if(m.get(bud).toString().length() > 0){ |
| 1542 | if(map.get(bud).toString().length() > 0){ | 1533 | if(map.get(bud).toString().length() > 0){ |
| 1543 | - map.put(mon, new BigDecimal(m.get(bud).toString()).add( | 1534 | + map.put(bud, new BigDecimal(m.get(bud).toString()).add( |
| 1544 | new BigDecimal(map.get(bud).toString())).doubleValue()); | 1535 | new BigDecimal(map.get(bud).toString())).doubleValue()); |
| 1545 | } else { | 1536 | } else { |
| 1546 | map.put(bud, new BigDecimal(m.get(bud).toString()).doubleValue()); | 1537 | map.put(bud, new BigDecimal(m.get(bud).toString()).doubleValue()); |
| 1547 | } | 1538 | } |
| 1548 | } | 1539 | } |
| 1540 | + if(m.get(pre).toString().length() > 0){ | ||
| 1541 | + if(map.get(pre).toString().length() > 0){ | ||
| 1542 | + map.put(pre, new BigDecimal(m.get(pre).toString()).add( | ||
| 1543 | + new BigDecimal(map.get(pre).toString())).doubleValue()); | ||
| 1544 | + } else { | ||
| 1545 | + map.put(pre, new BigDecimal(m.get(pre).toString()).doubleValue()); | ||
| 1546 | + } | ||
| 1547 | + } | ||
| 1549 | } | 1548 | } |
| 1550 | if(m.containsKey("num") && m.get("num").toString().length() > 0){ | 1549 | if(m.containsKey("num") && m.get("num").toString().length() > 0){ |
| 1551 | if(map.containsKey("num") && map.get("num").toString().length() > 0){ | 1550 | if(map.containsKey("num") && map.get("num").toString().length() > 0){ |
| @@ -1582,10 +1581,10 @@ public class BudgetServiceImpl extends BaseServiceImpl<Budget, Integer> implemen | @@ -1582,10 +1581,10 @@ public class BudgetServiceImpl extends BaseServiceImpl<Budget, Integer> implemen | ||
| 1582 | } | 1581 | } |
| 1583 | } | 1582 | } |
| 1584 | } | 1583 | } |
| 1585 | - BigDecimal monAll_ = monAll.divide(new BigDecimal("1000000"), 3, BigDecimal.ROUND_HALF_UP); | 1584 | + monAll = monAll.divide(new BigDecimal("1000000"), 3, BigDecimal.ROUND_HALF_UP); |
| 1586 | preAll = preAll.divide(new BigDecimal("1000000"), 3, BigDecimal.ROUND_HALF_UP); | 1585 | preAll = preAll.divide(new BigDecimal("1000000"), 3, BigDecimal.ROUND_HALF_UP); |
| 1587 | - Double subAll = monAll_.subtract(preAll).doubleValue(); | ||
| 1588 | - m.put("monAll", monAll_.doubleValue()); | 1586 | + Double subAll = monAll.subtract(preAll).doubleValue(); |
| 1587 | + m.put("monAll", monAll.doubleValue()); | ||
| 1589 | m.put("preAll", preAll.doubleValue()); | 1588 | m.put("preAll", preAll.doubleValue()); |
| 1590 | m.put("subAll", subAll > 0 ? "+" + subAll : subAll); | 1589 | m.put("subAll", subAll > 0 ? "+" + subAll : subAll); |
| 1591 | 1590 | ||
| @@ -1687,10 +1686,10 @@ public class BudgetServiceImpl extends BaseServiceImpl<Budget, Integer> implemen | @@ -1687,10 +1686,10 @@ public class BudgetServiceImpl extends BaseServiceImpl<Budget, Integer> implemen | ||
| 1687 | } | 1686 | } |
| 1688 | } | 1687 | } |
| 1689 | } | 1688 | } |
| 1690 | - BigDecimal monAll_ = monAll.divide(new BigDecimal("1000000"), 3, BigDecimal.ROUND_HALF_UP); | 1689 | + monAll = monAll.divide(new BigDecimal("1000000"), 3, BigDecimal.ROUND_HALF_UP); |
| 1691 | preAll = preAll.divide(new BigDecimal("1000000"), 3, BigDecimal.ROUND_HALF_UP); | 1690 | preAll = preAll.divide(new BigDecimal("1000000"), 3, BigDecimal.ROUND_HALF_UP); |
| 1692 | - Double subAll = monAll_.subtract(preAll).doubleValue(); | ||
| 1693 | - m.put("monAll", monAll_.doubleValue()); | 1691 | + Double subAll = monAll.subtract(preAll).doubleValue(); |
| 1692 | + m.put("monAll", monAll.doubleValue()); | ||
| 1694 | m.put("preAll", preAll.doubleValue()); | 1693 | m.put("preAll", preAll.doubleValue()); |
| 1695 | m.put("subAll", subAll > 0 ? "+" + subAll : subAll); | 1694 | m.put("subAll", subAll > 0 ? "+" + subAll : subAll); |
| 1696 | 1695 | ||
| @@ -1784,6 +1783,7 @@ public class BudgetServiceImpl extends BaseServiceImpl<Budget, Integer> implemen | @@ -1784,6 +1783,7 @@ public class BudgetServiceImpl extends BaseServiceImpl<Budget, Integer> implemen | ||
| 1784 | // TODO Auto-generated method stub | 1783 | // TODO Auto-generated method stub |
| 1785 | SimpleDateFormat sdfYY = new SimpleDateFormat("YYYY"); | 1784 | SimpleDateFormat sdfYY = new SimpleDateFormat("YYYY"); |
| 1786 | SimpleDateFormat sdfMM = new SimpleDateFormat("MM"); | 1785 | SimpleDateFormat sdfMM = new SimpleDateFormat("MM"); |
| 1786 | + DecimalFormat df = new DecimalFormat("0.###"); | ||
| 1787 | List<Map<String, Object>> resList = new ArrayList<Map<String, Object>>(); | 1787 | List<Map<String, Object>> resList = new ArrayList<Map<String, Object>>(); |
| 1788 | Map<String, Map<String, Object>> keyMap = new HashMap<String, Map<String, Object>>(); | 1788 | Map<String, Map<String, Object>> keyMap = new HashMap<String, Map<String, Object>>(); |
| 1789 | List<Budget> findByYear = repository.findByYear(year); | 1789 | List<Budget> findByYear = repository.findByYear(year); |
| @@ -1834,9 +1834,9 @@ public class BudgetServiceImpl extends BaseServiceImpl<Budget, Integer> implemen | @@ -1834,9 +1834,9 @@ public class BudgetServiceImpl extends BaseServiceImpl<Budget, Integer> implemen | ||
| 1834 | m.put("xlBm", xlBm); | 1834 | m.put("xlBm", xlBm); |
| 1835 | m.put("xlName", xlName); | 1835 | m.put("xlName", xlName); |
| 1836 | m.put("type", "公里"); | 1836 | m.put("type", "公里"); |
| 1837 | - m.put("budget", b.getBudgetMileage()!=null?b.getBudgetMileage():""); | ||
| 1838 | - m.put("change", b.getChangeMileage()!=null?b.getChangeMileage():""); | ||
| 1839 | - m.put("formal", b.getFormalMileage()!=null?b.getFormalMileage():""); | 1837 | + m.put("budget", b.getBudgetMileage()!=null?df.format(b.getBudgetMileage()):""); |
| 1838 | + m.put("change", b.getChangeMileage()!=null?df.format(b.getChangeMileage()):""); | ||
| 1839 | + m.put("formal", b.getFormalMileage()!=null?df.format(b.getFormalMileage()):""); | ||
| 1840 | for(int i = 1; i <= 12; i++){ | 1840 | for(int i = 1; i <= 12; i++){ |
| 1841 | m.put("mon"+i, ""); | 1841 | m.put("mon"+i, ""); |
| 1842 | m.put("bud"+i, ""); | 1842 | m.put("bud"+i, ""); |
| @@ -1844,7 +1844,7 @@ public class BudgetServiceImpl extends BaseServiceImpl<Budget, Integer> implemen | @@ -1844,7 +1844,7 @@ public class BudgetServiceImpl extends BaseServiceImpl<Budget, Integer> implemen | ||
| 1844 | } | 1844 | } |
| 1845 | String bud = "bud" + Integer.valueOf(b.getYear().split("-")[1]); | 1845 | String bud = "bud" + Integer.valueOf(b.getYear().split("-")[1]); |
| 1846 | if(b.getFormalMileage()!=null){ | 1846 | if(b.getFormalMileage()!=null){ |
| 1847 | - m.put(bud, b.getFormalMileage()); | 1847 | + m.put(bud, df.format(b.getFormalMileage())); |
| 1848 | } | 1848 | } |
| 1849 | m.put("monAll", "0"); | 1849 | m.put("monAll", "0"); |
| 1850 | xlMap.put(key1, m); | 1850 | xlMap.put(key1, m); |
| @@ -1854,28 +1854,28 @@ public class BudgetServiceImpl extends BaseServiceImpl<Budget, Integer> implemen | @@ -1854,28 +1854,28 @@ public class BudgetServiceImpl extends BaseServiceImpl<Budget, Integer> implemen | ||
| 1854 | String bud = "bud" + Integer.valueOf(b.getYear().split("-")[1]); | 1854 | String bud = "bud" + Integer.valueOf(b.getYear().split("-")[1]); |
| 1855 | if(b.getBudgetMileage()!=null){ | 1855 | if(b.getBudgetMileage()!=null){ |
| 1856 | if(m.get("budget").toString().length() > 0){ | 1856 | if(m.get("budget").toString().length() > 0){ |
| 1857 | - m.put("budget", new BigDecimal(m.get("budget").toString()).add( | ||
| 1858 | - new BigDecimal(b.getBudgetMileage())).doubleValue()); | 1857 | + m.put("budget", df.format(new BigDecimal(m.get("budget").toString()).add( |
| 1858 | + new BigDecimal(b.getBudgetMileage())).doubleValue())); | ||
| 1859 | } else { | 1859 | } else { |
| 1860 | - m.put("budget", b.getBudgetMileage()); | 1860 | + m.put("budget", df.format(b.getBudgetMileage())); |
| 1861 | } | 1861 | } |
| 1862 | } | 1862 | } |
| 1863 | if(b.getChangeMileage()!=null){ | 1863 | if(b.getChangeMileage()!=null){ |
| 1864 | if(m.get("change").toString().length() > 0){ | 1864 | if(m.get("change").toString().length() > 0){ |
| 1865 | - m.put("change", new BigDecimal(m.get("change").toString()).add( | ||
| 1866 | - new BigDecimal(b.getChangeMileage())).doubleValue()); | 1865 | + m.put("change", df.format(new BigDecimal(m.get("change").toString()).add( |
| 1866 | + new BigDecimal(b.getChangeMileage())).doubleValue())); | ||
| 1867 | } else { | 1867 | } else { |
| 1868 | - m.put("change", b.getChangeMileage()); | 1868 | + m.put("change", df.format(b.getChangeMileage())); |
| 1869 | } | 1869 | } |
| 1870 | } | 1870 | } |
| 1871 | if(b.getFormalMileage()!=null){ | 1871 | if(b.getFormalMileage()!=null){ |
| 1872 | if(m.get("formal").toString().length() > 0){ | 1872 | if(m.get("formal").toString().length() > 0){ |
| 1873 | - m.put("formal", new BigDecimal(m.get("formal").toString()).add( | ||
| 1874 | - new BigDecimal(b.getFormalMileage())).doubleValue()); | 1873 | + m.put("formal", df.format(new BigDecimal(m.get("formal").toString()).add( |
| 1874 | + new BigDecimal(b.getFormalMileage())).doubleValue())); | ||
| 1875 | } else { | 1875 | } else { |
| 1876 | - m.put("formal", b.getFormalMileage()); | 1876 | + m.put("formal", df.format(b.getFormalMileage())); |
| 1877 | } | 1877 | } |
| 1878 | - m.put(bud, b.getFormalMileage()); | 1878 | + m.put(bud, df.format(b.getFormalMileage())); |
| 1879 | } | 1879 | } |
| 1880 | } | 1880 | } |
| 1881 | } | 1881 | } |
| @@ -1888,9 +1888,9 @@ public class BudgetServiceImpl extends BaseServiceImpl<Budget, Integer> implemen | @@ -1888,9 +1888,9 @@ public class BudgetServiceImpl extends BaseServiceImpl<Budget, Integer> implemen | ||
| 1888 | m.put("xlBm", xlBm); | 1888 | m.put("xlBm", xlBm); |
| 1889 | m.put("xlName", xlName); | 1889 | m.put("xlName", xlName); |
| 1890 | m.put("type", "人次"); | 1890 | m.put("type", "人次"); |
| 1891 | - m.put("budget", b.getBudgetPerson()!=null?b.getBudgetPerson():""); | ||
| 1892 | - m.put("change", b.getChangePerson()!=null?b.getChangePerson():""); | ||
| 1893 | - m.put("formal", b.getFormalPerson()!=null?b.getFormalPerson():""); | 1891 | + m.put("budget", b.getBudgetPerson()!=null?df.format(b.getBudgetPerson()):""); |
| 1892 | + m.put("change", b.getChangePerson()!=null?df.format(b.getChangePerson()):""); | ||
| 1893 | + m.put("formal", b.getFormalPerson()!=null?df.format(b.getFormalPerson()):""); | ||
| 1894 | for(int i = 1; i <= 12; i++){ | 1894 | for(int i = 1; i <= 12; i++){ |
| 1895 | m.put("mon"+i, ""); | 1895 | m.put("mon"+i, ""); |
| 1896 | m.put("bud"+i, ""); | 1896 | m.put("bud"+i, ""); |
| @@ -1898,7 +1898,7 @@ public class BudgetServiceImpl extends BaseServiceImpl<Budget, Integer> implemen | @@ -1898,7 +1898,7 @@ public class BudgetServiceImpl extends BaseServiceImpl<Budget, Integer> implemen | ||
| 1898 | } | 1898 | } |
| 1899 | String bud = "bud" + Integer.valueOf(b.getYear().split("-")[1]); | 1899 | String bud = "bud" + Integer.valueOf(b.getYear().split("-")[1]); |
| 1900 | if(b.getFormalPerson()!=null){ | 1900 | if(b.getFormalPerson()!=null){ |
| 1901 | - m.put(bud, b.getFormalPerson()); | 1901 | + m.put(bud, df.format(b.getFormalPerson())); |
| 1902 | } | 1902 | } |
| 1903 | m.put("monAll", "0"); | 1903 | m.put("monAll", "0"); |
| 1904 | xlMap.put(key2, m); | 1904 | xlMap.put(key2, m); |
| @@ -1908,28 +1908,28 @@ public class BudgetServiceImpl extends BaseServiceImpl<Budget, Integer> implemen | @@ -1908,28 +1908,28 @@ public class BudgetServiceImpl extends BaseServiceImpl<Budget, Integer> implemen | ||
| 1908 | String bud = "bud" + Integer.valueOf(b.getYear().split("-")[1]); | 1908 | String bud = "bud" + Integer.valueOf(b.getYear().split("-")[1]); |
| 1909 | if(b.getBudgetPerson()!=null){ | 1909 | if(b.getBudgetPerson()!=null){ |
| 1910 | if(m.get("budget").toString().length() > 0){ | 1910 | if(m.get("budget").toString().length() > 0){ |
| 1911 | - m.put("budget", new BigDecimal(m.get("budget").toString()).add( | ||
| 1912 | - new BigDecimal(b.getBudgetPerson())).doubleValue()); | 1911 | + m.put("budget", df.format(new BigDecimal(m.get("budget").toString()).add( |
| 1912 | + new BigDecimal(b.getBudgetPerson())).doubleValue())); | ||
| 1913 | } else { | 1913 | } else { |
| 1914 | - m.put("budget", b.getBudgetPerson()); | 1914 | + m.put("budget", df.format(b.getBudgetPerson())); |
| 1915 | } | 1915 | } |
| 1916 | } | 1916 | } |
| 1917 | if(b.getChangePerson()!=null){ | 1917 | if(b.getChangePerson()!=null){ |
| 1918 | if(m.get("change").toString().length() > 0){ | 1918 | if(m.get("change").toString().length() > 0){ |
| 1919 | - m.put("change", new BigDecimal(m.get("change").toString()).add( | ||
| 1920 | - new BigDecimal(b.getChangePerson())).doubleValue()); | 1919 | + m.put("change", df.format(new BigDecimal(m.get("change").toString()).add( |
| 1920 | + new BigDecimal(b.getChangePerson())).doubleValue())); | ||
| 1921 | } else { | 1921 | } else { |
| 1922 | - m.put("change", b.getChangePerson()); | 1922 | + m.put("change", df.format(b.getChangePerson())); |
| 1923 | } | 1923 | } |
| 1924 | } | 1924 | } |
| 1925 | if(b.getFormalPerson()!=null){ | 1925 | if(b.getFormalPerson()!=null){ |
| 1926 | if(m.get("formal").toString().length() > 0){ | 1926 | if(m.get("formal").toString().length() > 0){ |
| 1927 | - m.put("formal", new BigDecimal(m.get("formal").toString()).add( | ||
| 1928 | - new BigDecimal(b.getFormalPerson())).doubleValue()); | 1927 | + m.put("formal", df.format(new BigDecimal(m.get("formal").toString()).add( |
| 1928 | + new BigDecimal(b.getFormalPerson())).doubleValue())); | ||
| 1929 | } else { | 1929 | } else { |
| 1930 | - m.put("formal", b.getFormalPerson()); | 1930 | + m.put("formal", df.format(b.getFormalPerson())); |
| 1931 | } | 1931 | } |
| 1932 | - m.put(bud, b.getFormalPerson()); | 1932 | + m.put(bud, df.format(b.getFormalPerson())); |
| 1933 | } | 1933 | } |
| 1934 | } | 1934 | } |
| 1935 | } | 1935 | } |
| @@ -1942,9 +1942,9 @@ public class BudgetServiceImpl extends BaseServiceImpl<Budget, Integer> implemen | @@ -1942,9 +1942,9 @@ public class BudgetServiceImpl extends BaseServiceImpl<Budget, Integer> implemen | ||
| 1942 | m.put("xlBm", xlBm); | 1942 | m.put("xlBm", xlBm); |
| 1943 | m.put("xlName", xlName); | 1943 | m.put("xlName", xlName); |
| 1944 | m.put("type", "营收"); | 1944 | m.put("type", "营收"); |
| 1945 | - m.put("budget", b.getBudgetAmounts()!=null?b.getBudgetAmounts():""); | ||
| 1946 | - m.put("change", b.getChangeAmounts()!=null?b.getChangeAmounts():""); | ||
| 1947 | - m.put("formal", b.getFormalAmounts()!=null?b.getFormalAmounts():""); | 1945 | + m.put("budget", b.getBudgetAmounts()!=null?df.format(b.getBudgetAmounts()):""); |
| 1946 | + m.put("change", b.getChangeAmounts()!=null?df.format(b.getChangeAmounts()):""); | ||
| 1947 | + m.put("formal", b.getFormalAmounts()!=null?df.format(b.getFormalAmounts()):""); | ||
| 1948 | for(int i = 1; i <= 12; i++){ | 1948 | for(int i = 1; i <= 12; i++){ |
| 1949 | m.put("mon"+i, ""); | 1949 | m.put("mon"+i, ""); |
| 1950 | m.put("bud"+i, ""); | 1950 | m.put("bud"+i, ""); |
| @@ -1952,7 +1952,7 @@ public class BudgetServiceImpl extends BaseServiceImpl<Budget, Integer> implemen | @@ -1952,7 +1952,7 @@ public class BudgetServiceImpl extends BaseServiceImpl<Budget, Integer> implemen | ||
| 1952 | } | 1952 | } |
| 1953 | String bud = "bud" + Integer.valueOf(b.getYear().split("-")[1]); | 1953 | String bud = "bud" + Integer.valueOf(b.getYear().split("-")[1]); |
| 1954 | if(b.getFormalAmounts()!=null){ | 1954 | if(b.getFormalAmounts()!=null){ |
| 1955 | - m.put(bud, b.getFormalAmounts()); | 1955 | + m.put(bud, df.format(b.getFormalAmounts())); |
| 1956 | } | 1956 | } |
| 1957 | m.put("monAll", "0"); | 1957 | m.put("monAll", "0"); |
| 1958 | xlMap.put(key3, m); | 1958 | xlMap.put(key3, m); |
| @@ -1962,28 +1962,28 @@ public class BudgetServiceImpl extends BaseServiceImpl<Budget, Integer> implemen | @@ -1962,28 +1962,28 @@ public class BudgetServiceImpl extends BaseServiceImpl<Budget, Integer> implemen | ||
| 1962 | String bud = "bud" + Integer.valueOf(b.getYear().split("-")[1]); | 1962 | String bud = "bud" + Integer.valueOf(b.getYear().split("-")[1]); |
| 1963 | if(b.getBudgetAmounts()!=null){ | 1963 | if(b.getBudgetAmounts()!=null){ |
| 1964 | if(m.get("budget").toString().length() > 0){ | 1964 | if(m.get("budget").toString().length() > 0){ |
| 1965 | - m.put("budget", new BigDecimal(m.get("budget").toString()).add( | ||
| 1966 | - new BigDecimal(b.getBudgetAmounts())).doubleValue()); | 1965 | + m.put("budget", df.format(new BigDecimal(m.get("budget").toString()).add( |
| 1966 | + new BigDecimal(b.getBudgetAmounts())).doubleValue())); | ||
| 1967 | } else { | 1967 | } else { |
| 1968 | - m.put("budget", b.getBudgetAmounts()); | 1968 | + m.put("budget", df.format(b.getBudgetAmounts())); |
| 1969 | } | 1969 | } |
| 1970 | } | 1970 | } |
| 1971 | if(b.getChangeAmounts()!=null){ | 1971 | if(b.getChangeAmounts()!=null){ |
| 1972 | if(m.get("change").toString().length() > 0){ | 1972 | if(m.get("change").toString().length() > 0){ |
| 1973 | - m.put("change", new BigDecimal(m.get("change").toString()).add( | ||
| 1974 | - new BigDecimal(b.getChangeAmounts())).doubleValue()); | 1973 | + m.put("change", df.format(new BigDecimal(m.get("change").toString()).add( |
| 1974 | + new BigDecimal(b.getChangeAmounts())).doubleValue())); | ||
| 1975 | } else { | 1975 | } else { |
| 1976 | - m.put("change", b.getChangeAmounts()); | 1976 | + m.put("change", df.format(b.getChangeAmounts())); |
| 1977 | } | 1977 | } |
| 1978 | } | 1978 | } |
| 1979 | if(b.getFormalAmounts()!=null){ | 1979 | if(b.getFormalAmounts()!=null){ |
| 1980 | if(m.get("formal").toString().length() > 0){ | 1980 | if(m.get("formal").toString().length() > 0){ |
| 1981 | - m.put("formal", new BigDecimal(m.get("formal").toString()).add( | ||
| 1982 | - new BigDecimal(b.getFormalAmounts())).doubleValue()); | 1981 | + m.put("formal", df.format(new BigDecimal(m.get("formal").toString()).add( |
| 1982 | + new BigDecimal(b.getFormalAmounts())).doubleValue())); | ||
| 1983 | } else { | 1983 | } else { |
| 1984 | - m.put("formal", b.getFormalAmounts()); | 1984 | + m.put("formal", df.format(b.getFormalAmounts())); |
| 1985 | } | 1985 | } |
| 1986 | - m.put(bud, b.getFormalAmounts()); | 1986 | + m.put(bud, df.format(b.getFormalAmounts())); |
| 1987 | } | 1987 | } |
| 1988 | } | 1988 | } |
| 1989 | } | 1989 | } |
| @@ -2298,7 +2298,7 @@ public class BudgetServiceImpl extends BaseServiceImpl<Budget, Integer> implemen | @@ -2298,7 +2298,7 @@ public class BudgetServiceImpl extends BaseServiceImpl<Budget, Integer> implemen | ||
| 2298 | } | 2298 | } |
| 2299 | if(m.get(bud).toString().length() > 0){ | 2299 | if(m.get(bud).toString().length() > 0){ |
| 2300 | if(map.get(bud).toString().length() > 0){ | 2300 | if(map.get(bud).toString().length() > 0){ |
| 2301 | - map.put(mon, new BigDecimal(m.get(bud).toString()).add( | 2301 | + map.put(bud, new BigDecimal(m.get(bud).toString()).add( |
| 2302 | new BigDecimal(map.get(bud).toString())).doubleValue()); | 2302 | new BigDecimal(map.get(bud).toString())).doubleValue()); |
| 2303 | } else { | 2303 | } else { |
| 2304 | map.put(bud, new BigDecimal(m.get(bud).toString()).doubleValue()); | 2304 | map.put(bud, new BigDecimal(m.get(bud).toString()).doubleValue()); |
src/main/java/com/bsth/service/forms/impl/RevenueLoader.java
| @@ -40,13 +40,13 @@ public class RevenueLoader { | @@ -40,13 +40,13 @@ public class RevenueLoader { | ||
| 40 | */ | 40 | */ |
| 41 | public static List<Map<String, Object>> load(String date, String gsBm){ | 41 | public static List<Map<String, Object>> load(String date, String gsBm){ |
| 42 | try { | 42 | try { |
| 43 | - url = ConfigUtil.get("http.ticketing.interface") + "?txnType=getLineRevenue&busiDate="+date+"&companyCode="+gsBm; | 43 | + url = ConfigUtil.get("http.ticketing.interface") + "?revenueFlag=1&txnType=getLineRevenue&busiDate="+date+"&companyCode="+gsBm; |
| 44 | list = new ArrayList<>(); | 44 | list = new ArrayList<>(); |
| 45 | httpClient = HttpClients.createDefault(); | 45 | httpClient = HttpClients.createDefault(); |
| 46 | get = new HttpGet(url); | 46 | get = new HttpGet(url); |
| 47 | requestConfig = RequestConfig.custom() | 47 | requestConfig = RequestConfig.custom() |
| 48 | - .setConnectTimeout(2500).setConnectionRequestTimeout(2000) | ||
| 49 | - .setSocketTimeout(2500).build(); | 48 | + .setConnectTimeout(10000).setConnectionRequestTimeout(10000) |
| 49 | + .setSocketTimeout(60000).build(); | ||
| 50 | get.setConfig(requestConfig); | 50 | get.setConfig(requestConfig); |
| 51 | if(list.size() > 0) | 51 | if(list.size() > 0) |
| 52 | list.clear(); | 52 | list.clear(); |
src/main/java/com/bsth/service/impl/InoutCarparkServiceImpl.java
0 → 100644
| 1 | +package com.bsth.service.impl; | ||
| 2 | + | ||
| 3 | +import com.alibaba.fastjson.JSONArray; | ||
| 4 | +import com.bsth.common.ResponseCode; | ||
| 5 | +import com.bsth.data.BasicData; | ||
| 6 | +import com.bsth.entity.*; | ||
| 7 | +import com.bsth.entity.realcontrol.ScheduleRealInfo; | ||
| 8 | +import com.bsth.repository.*; | ||
| 9 | +import com.bsth.repository.realcontrol.ScheduleRealInfoRepository; | ||
| 10 | +import com.bsth.service.InoutCarparkService; | ||
| 11 | +import com.bsth.service.gps.GpsService; | ||
| 12 | +import com.bsth.util.TransGPS; | ||
| 13 | +import com.fasterxml.jackson.core.JsonProcessingException; | ||
| 14 | +import com.fasterxml.jackson.databind.ObjectMapper; | ||
| 15 | +import org.joda.time.DateTime; | ||
| 16 | +import org.joda.time.format.DateTimeFormat; | ||
| 17 | +import org.joda.time.format.DateTimeFormatter; | ||
| 18 | +import org.slf4j.Logger; | ||
| 19 | +import org.slf4j.LoggerFactory; | ||
| 20 | +import org.springframework.beans.factory.annotation.Autowired; | ||
| 21 | +import org.springframework.stereotype.Service; | ||
| 22 | +import org.springframework.transaction.annotation.Transactional; | ||
| 23 | + | ||
| 24 | +import javax.persistence.EntityManager; | ||
| 25 | +import java.text.SimpleDateFormat; | ||
| 26 | +import java.util.*; | ||
| 27 | + | ||
| 28 | +/** | ||
| 29 | + * @author Hill | ||
| 30 | + */ | ||
| 31 | +@Service | ||
| 32 | +public class InoutCarparkServiceImpl extends BaseServiceImpl<LsInoutSectionRoute, Long> implements InoutCarparkService { | ||
| 33 | + | ||
| 34 | + private final static Logger logger = LoggerFactory.getLogger(InoutCarparkServiceImpl.class); | ||
| 35 | + | ||
| 36 | + @Autowired | ||
| 37 | + private LsStationRouteRepository lsStationRouteRepository; | ||
| 38 | + | ||
| 39 | + @Autowired | ||
| 40 | + private CarParkRepository carParkRepository; | ||
| 41 | + | ||
| 42 | + @Autowired | ||
| 43 | + private LsInoutSectionRouteRepository lsInoutSectionRouteRepository; | ||
| 44 | + | ||
| 45 | + @Autowired | ||
| 46 | + private SectionRepository sectionRepository; | ||
| 47 | + | ||
| 48 | + @Autowired | ||
| 49 | + LineRepository lineRepository; | ||
| 50 | + | ||
| 51 | + @Autowired | ||
| 52 | + private ScheduleRealInfoRepository scheduleRealInfoRepository; | ||
| 53 | + | ||
| 54 | + @Autowired | ||
| 55 | + private GpsService gpsService; | ||
| 56 | + | ||
| 57 | + @Override | ||
| 58 | + public Map<String, Object> getStartEndByLine(int lineId, int version) { | ||
| 59 | + Map<String, Object> result = new HashMap<>(), data = new HashMap<>(); | ||
| 60 | + result.put("code", 0); | ||
| 61 | + result.put("msg", ""); | ||
| 62 | + result.put("data", data); | ||
| 63 | + | ||
| 64 | + List<LsStationRoute> upRoutes = lsStationRouteRepository.findByLineVersion(lineId, version, 0), downRoutes = lsStationRouteRepository.findByLineVersion(lineId, version, 1); | ||
| 65 | + CarPark carPark = carParkRepository.findByLineId(lineId); | ||
| 66 | + if (carPark == null) { | ||
| 67 | + result.put("code", 500); | ||
| 68 | + result.put("msg", "线路标准信息中无相应的停车场信息"); | ||
| 69 | + | ||
| 70 | + return result; | ||
| 71 | + } | ||
| 72 | + if (upRoutes.size() < 2) { | ||
| 73 | + result.put("code", 500); | ||
| 74 | + result.put("msg", "线路上行站级少于2"); | ||
| 75 | + | ||
| 76 | + return result; | ||
| 77 | + } | ||
| 78 | + LsStationRoute upFirst = upRoutes.get(0), upLast = upRoutes.get(upRoutes.size() - 1); | ||
| 79 | + LsStationRoute downFirst = downRoutes.get(0), downLast = downRoutes.get(downRoutes.size() - 1); | ||
| 80 | + // 环线或双环线只需提取一个起点站 | ||
| 81 | + if (upFirst.getStationCode().equals(upLast.getStationCode())) { | ||
| 82 | + data.put("start", new LsStationRoute[]{ upFirst }); | ||
| 83 | + data.put("end", new LsStationRoute[]{ upFirst }); | ||
| 84 | + } else { | ||
| 85 | + if (downRoutes.size() < 2) { | ||
| 86 | + result.put("code", 500); | ||
| 87 | + result.put("msg", "非环线线路下行站级少于2"); | ||
| 88 | + | ||
| 89 | + return result; | ||
| 90 | + } | ||
| 91 | + data.put("start", new LsStationRoute[]{ upFirst, downFirst }); | ||
| 92 | + data.put("end", new LsStationRoute[]{ upLast, downLast }); | ||
| 93 | + } | ||
| 94 | + data.put("carpark", carPark); | ||
| 95 | + | ||
| 96 | + return result; | ||
| 97 | + } | ||
| 98 | + | ||
| 99 | + @Override | ||
| 100 | + public Map<String, Object> getRouteByStartEnd(int lineId, int version, String start, String end) { | ||
| 101 | + Map<String, Object> result = new HashMap<>(), data = new HashMap<>(); | ||
| 102 | + result.put("code", 0); | ||
| 103 | + result.put("msg", ""); | ||
| 104 | + result.put("data", data); | ||
| 105 | + data.put("routes", lsInoutSectionRouteRepository.getRouteByStartEnd(lineId, version, start, end)); | ||
| 106 | + | ||
| 107 | + return result; | ||
| 108 | + } | ||
| 109 | + | ||
| 110 | + /** | ||
| 111 | + * 新增路段信息 | ||
| 112 | + * | ||
| 113 | + * @param map:<bsectionVector:折线百度坐标集合;dbType:圆坐标类型;descriptions:描述与说明;destroy:是否撤销;directions:方向;lineId:线路ID | ||
| 114 | + * | ||
| 115 | + * lineCode :线路编码;roadCoding:道路编码;sectionCode:路段编码;sectionDistance:路段长度;sectionName:路段名称;sectionTime:路段时长; | ||
| 116 | + * | ||
| 117 | + * sectionrouteCode:路段序号;speedLimit:路段限速> | ||
| 118 | + * | ||
| 119 | + * @return map<SUCCESS:成功;ERROR:异常> | ||
| 120 | + */ | ||
| 121 | + @Override | ||
| 122 | + @Transactional | ||
| 123 | + public Map<String, Object> sectionSave(Map<String, Object> map) { | ||
| 124 | + Map<String, Object> resultMap = new HashMap<String, Object>(); | ||
| 125 | + try { | ||
| 126 | + // 线路ID. | ||
| 127 | + Integer lineId = map.get("lineId").equals("") ? null : Integer.valueOf(map.get("lineId").toString()); | ||
| 128 | + // 线路编码. | ||
| 129 | + String lineCode = map.get("lineCode").equals("") ? "" : map.get("lineCode").toString(); | ||
| 130 | + // 路段名称. | ||
| 131 | + String sectionName = map.get("sectionName").equals("") ? "" : map.get("sectionName").toString(); | ||
| 132 | + // 路段编码. | ||
| 133 | + String sectionCode = map.get("sectionCode").equals("") ? "" : map.get("sectionCode").toString(); | ||
| 134 | + // 道路编码. | ||
| 135 | + String roadCoding = map.get("roadCoding").equals("") ? "" : map.get("roadCoding").toString(); | ||
| 136 | + // 原始坐标类型. | ||
| 137 | + String dbType = map.get("dbType").equals("") ? "" :map.get("dbType").toString(); | ||
| 138 | + // 路段几何图形坐标. | ||
| 139 | + String sectionJSON = map.get("bsectionVector").equals("") ? "" : map.get("bsectionVector").toString(); | ||
| 140 | + // 路段序号 | ||
| 141 | + String sectionrouteCode = map.get("sectionrouteCode").equals("") ? "" : map.get("sectionrouteCode").toString(); | ||
| 142 | + // 路段时长. | ||
| 143 | + Double sectionTime = map.get("sectionTime").equals("") ? 0.0d : Double.valueOf(map.get("sectionTime").toString()); | ||
| 144 | + // 路段距离. | ||
| 145 | + Double sectionDistance = map.get("sectionDistance").equals("") ? 0.0d : Double.valueOf(map.get("sectionDistance").toString()); | ||
| 146 | + // 路段限速. | ||
| 147 | + Double speedLimit = map.get("speedLimit").equals("") ? 0.0d : Double.valueOf(map.get("speedLimit").toString()); | ||
| 148 | + // 版本. | ||
| 149 | + Integer versions = map.get("versions").equals("") ? 1 : Integer.valueOf(map.get("versions").toString()); | ||
| 150 | + // 是否撤销. | ||
| 151 | + Integer destroy = map.get("destroy").equals("") ? 0 : Integer.valueOf(map.get("destroy").toString()); | ||
| 152 | + // 路段方向. | ||
| 153 | + Integer directions = map.get("directions").equals("") ? 0 : Integer.valueOf(map.get("directions").toString()); | ||
| 154 | + // 描述与说明. | ||
| 155 | + String descriptions = map.get("descriptions").equals("")? "" : map.get("descriptions").toString(); | ||
| 156 | + // 起始 | ||
| 157 | + String start = map.get("start").equals("")? "" : map.get("start").toString(); | ||
| 158 | + // 结束 | ||
| 159 | + String end = map.get("end").equals("")? "" : map.get("end").toString(); | ||
| 160 | + // 原始线状图形坐标集合 | ||
| 161 | + String sectionsBpoints = ""; | ||
| 162 | + // WGS线状图形坐标集合 | ||
| 163 | + String sectionsWJPpoints = ""; | ||
| 164 | + if(!sectionJSON.equals("")) { | ||
| 165 | + // 转换成JSON数组 | ||
| 166 | + JSONArray sectionsArray = JSONArray.parseArray(sectionJSON); | ||
| 167 | + // 遍历 | ||
| 168 | + for(int s = 0 ;s<sectionsArray.size();s++) { | ||
| 169 | + String pointsLngStr = sectionsArray.getJSONObject(s).get("lng").toString(); | ||
| 170 | + String pointsLatStr = sectionsArray.getJSONObject(s).get("lat").toString(); | ||
| 171 | + String WGSLngStr = ""; | ||
| 172 | + String WGSLatStr = ""; | ||
| 173 | + TransGPS.Location resultPoint = FromBDPointToWGSPoint(pointsLngStr,pointsLatStr); | ||
| 174 | + WGSLngStr = String.valueOf(resultPoint.getLng()); | ||
| 175 | + WGSLatStr = String.valueOf(resultPoint.getLat()); | ||
| 176 | + if(s==0) { | ||
| 177 | + sectionsBpoints = pointsLngStr + " " + pointsLatStr; | ||
| 178 | + sectionsWJPpoints = WGSLngStr + " " + WGSLatStr; | ||
| 179 | + }else { | ||
| 180 | + sectionsBpoints = sectionsBpoints + "," + pointsLngStr + " " + pointsLatStr; | ||
| 181 | + sectionsWJPpoints = sectionsWJPpoints + "," + WGSLngStr + " " + WGSLatStr; | ||
| 182 | + } | ||
| 183 | + } | ||
| 184 | + } | ||
| 185 | + // WGS坐标点集合 | ||
| 186 | + String gsectionVector = "LINESTRING(" + sectionsWJPpoints +")"; | ||
| 187 | + // 原坐标点集合 | ||
| 188 | + String bsectionVector = "LINESTRING(" + sectionsBpoints + ")"; | ||
| 189 | + String crosesRoad=""; | ||
| 190 | + String endNode =""; | ||
| 191 | + String startNode=""; | ||
| 192 | + String middleNode=""; | ||
| 193 | + String sectionType=""; | ||
| 194 | + String csectionVector=null; | ||
| 195 | + Integer id = Integer.valueOf(sectionCode); | ||
| 196 | + sectionRepository.systemSave(sectionCode, sectionName, crosesRoad, endNode, startNode, middleNode, gsectionVector, bsectionVector, sectionType, csectionVector, roadCoding, sectionDistance, sectionTime, dbType, speedLimit, descriptions, versions, id); | ||
| 197 | + Section section = sectionRepository.findById(id).get(); | ||
| 198 | + | ||
| 199 | + Line line = lineRepository.findById(lineId).get(); | ||
| 200 | + | ||
| 201 | + | ||
| 202 | + if (map.get("status") == null || Integer.parseInt(map.get("status").toString()) != 0) { | ||
| 203 | + | ||
| 204 | + LsInoutSectionRoute sectionRoute = new LsInoutSectionRoute(); | ||
| 205 | + Integer routeCode = null; | ||
| 206 | + if(!sectionrouteCode.equals("")){ | ||
| 207 | + String sectionrouteCodeArray[] = sectionrouteCode.split("_"); | ||
| 208 | + routeCode = Integer.valueOf(sectionrouteCodeArray[0])+1; | ||
| 209 | + }else { | ||
| 210 | + routeCode = 1; | ||
| 211 | + } | ||
| 212 | + sectionRoute.setSectionrouteCode(routeCode); | ||
| 213 | + sectionRoute.setLineCode(lineCode); | ||
| 214 | + sectionRoute.setSection(section); | ||
| 215 | + sectionRoute.setSectionCode(sectionCode); | ||
| 216 | + sectionRoute.setDirections(directions); | ||
| 217 | + sectionRoute.setDescriptions(descriptions); | ||
| 218 | + sectionRoute.setDestroy(destroy); | ||
| 219 | + sectionRoute.setVersions(versions); | ||
| 220 | + sectionRoute.setLine(line); | ||
| 221 | + sectionRoute.setStart(start); | ||
| 222 | + sectionRoute.setEnd(end); | ||
| 223 | + lsInoutSectionRouteRepository.save(sectionRoute); | ||
| 224 | + } | ||
| 225 | + | ||
| 226 | + | ||
| 227 | + resultMap.put("status", ResponseCode.SUCCESS); | ||
| 228 | + } catch (Exception e) { | ||
| 229 | + resultMap.put("status", ResponseCode.ERROR); | ||
| 230 | + logger.error("save erro.", e); | ||
| 231 | + } | ||
| 232 | + return resultMap; | ||
| 233 | + } | ||
| 234 | + | ||
| 235 | + /** 百度坐标转WGS坐标 */ | ||
| 236 | + public TransGPS.Location FromBDPointToWGSPoint(String bLonx, String bLatx) { | ||
| 237 | + | ||
| 238 | + double lng = Double.parseDouble(bLonx); | ||
| 239 | + | ||
| 240 | + double lat = Double.parseDouble(bLatx); | ||
| 241 | + | ||
| 242 | + TransGPS.Location bdLoc = TransGPS.LocationMake(lng, lat); | ||
| 243 | + | ||
| 244 | + TransGPS.Location location = TransGPS.bd_decrypt(bdLoc); | ||
| 245 | + | ||
| 246 | + TransGPS.Location WGSPoint = TransGPS.transformFromGCJToWGS(location); | ||
| 247 | + | ||
| 248 | + return WGSPoint; | ||
| 249 | + | ||
| 250 | + } | ||
| 251 | + | ||
| 252 | + /** | ||
| 253 | + * @Description :TODO(编辑线路走向) | ||
| 254 | + * | ||
| 255 | + * @param map <sectionId:路段ID; sectionJSON:路段信息> | ||
| 256 | + * | ||
| 257 | + * @return Map<String, Object> <SUCCESS ; ERROR> | ||
| 258 | + */ | ||
| 259 | + @Override | ||
| 260 | + @Transactional | ||
| 261 | + public Map<String, Object> sectionUpdate(Map<String, Object> map) { | ||
| 262 | + Map<String, Object> resultMap = new HashMap<String, Object>(); | ||
| 263 | + try { | ||
| 264 | + String bsectionVector = map.get("bsectionVector").equals("") ? "" :map.get("bsectionVector").toString(); | ||
| 265 | + // 原始线状图形坐标集合 | ||
| 266 | + String sectionsBpoints = ""; | ||
| 267 | + // WGS线状图形坐标集合 | ||
| 268 | + String sectionsWJPpoints = ""; | ||
| 269 | + if(!bsectionVector.equals("")) { | ||
| 270 | + // 转换成JSON数组 | ||
| 271 | + JSONArray sectionsArray = JSONArray.parseArray(bsectionVector); | ||
| 272 | + // 遍历 | ||
| 273 | + for(int s = 0 ;s<sectionsArray.size();s++) { | ||
| 274 | + String pointsLngStr = sectionsArray.getJSONObject(s).get("lng").toString(); | ||
| 275 | + String pointsLatStr = sectionsArray.getJSONObject(s).get("lat").toString(); | ||
| 276 | + /** to WGS坐标 */ | ||
| 277 | + TransGPS.Location resultPoint = FromBDPointToWGSPoint(pointsLngStr,pointsLatStr); | ||
| 278 | + String WGSLngStr = String.valueOf(resultPoint.getLng()); | ||
| 279 | + String WGSLatStr = String.valueOf(resultPoint.getLat()); | ||
| 280 | + if(s==0) { | ||
| 281 | + sectionsBpoints = pointsLngStr + " " + pointsLatStr; | ||
| 282 | + sectionsWJPpoints = WGSLngStr + " " + WGSLatStr; | ||
| 283 | + }else { | ||
| 284 | + sectionsBpoints = sectionsBpoints + "," + pointsLngStr + " " + pointsLatStr; | ||
| 285 | + sectionsWJPpoints = sectionsWJPpoints + "," + WGSLngStr + " " + WGSLatStr; | ||
| 286 | + } | ||
| 287 | + } | ||
| 288 | + } | ||
| 289 | + // 原坐标类型 | ||
| 290 | + String dbType = map.get("dbType").equals("") ? "" : map.get("dbType").toString(); | ||
| 291 | + // 说明 | ||
| 292 | + String descriptions = ""; | ||
| 293 | + // 是否撤销 | ||
| 294 | + Integer destroy = map.get("destroy").equals("") ? null : Integer.parseInt(map.get("destroy").toString()); | ||
| 295 | + // 方向 | ||
| 296 | + Integer directions = map.get("directions").equals("") ? null : Integer.parseInt(map.get("directions").toString()); | ||
| 297 | + // 线路ID | ||
| 298 | + Integer sectionRouteLine = map.get("sectionRouteLine").equals("") ? null : Integer.parseInt(map.get("sectionRouteLine").toString()); | ||
| 299 | + // 道路编码 | ||
| 300 | + String roadCoding = map.get("roadCoding").equals("") ? "" : map.get("roadCoding").toString(); | ||
| 301 | + // 路段编码 | ||
| 302 | + String sectionCode = map.get("sectionCode").equals("") ? "" : map.get("sectionCode").toString(); | ||
| 303 | + // 路段长度 | ||
| 304 | + Double sectionDistance = map.get("sectionDistance").equals("") ? null : Double.valueOf(map.get("sectionDistance").toString()); | ||
| 305 | + // 路段ID | ||
| 306 | + Integer sectionId = map.get("sectionId").equals("") ? 0 : Integer.parseInt(map.get("sectionId").toString()); | ||
| 307 | + // 路段名称 | ||
| 308 | + String sectionName = map.get("sectionName").equals("") ? "" : map.get("sectionName").toString(); | ||
| 309 | + // 路段路由Id | ||
| 310 | + Long sectionRouteId = map.get("sectionRouteId").equals("") ? null : Long.valueOf(map.get("sectionRouteId").toString()); | ||
| 311 | + // 线路编码 | ||
| 312 | + String lineCode =map.get("lineCode").equals("") ? "" : map.get("lineCode").toString(); | ||
| 313 | + // 路段时长 | ||
| 314 | + Double sectionTime = map.get("sectionTime").equals("") ? null : Double.valueOf(map.get("sectionTime").toString()); | ||
| 315 | + // 路段路由 | ||
| 316 | + Integer sectionrouteCode = "".equals(map.get("sectionrouteCode")) ? null : Integer.valueOf(map.get("sectionrouteCode").toString()); | ||
| 317 | + // 限速 | ||
| 318 | + Double speedLimit = map.get("speedLimit").equals("") ? null : Double.valueOf(map.get("speedLimit").toString()); | ||
| 319 | + // 版本 | ||
| 320 | + Integer version = map.get("versions").equals("") ? null : Integer.valueOf(map.get("versions").toString()); | ||
| 321 | + // 起始 | ||
| 322 | + String start = map.get("start").equals("")? "" : map.get("start").toString(); | ||
| 323 | + // 结束 | ||
| 324 | + String end = map.get("end").equals("")? "" : map.get("end").toString(); | ||
| 325 | + // WGS坐标点集合 | ||
| 326 | + String gsectionVector = null; | ||
| 327 | + if(!sectionsWJPpoints.equals("")) { | ||
| 328 | + gsectionVector = "LINESTRING(" + sectionsWJPpoints +")"; | ||
| 329 | + } | ||
| 330 | + // 原坐标点集合 | ||
| 331 | + String bsectionVectorS = null; | ||
| 332 | + if(!sectionsBpoints.equals("")) { | ||
| 333 | + bsectionVectorS = "LINESTRING(" + sectionsBpoints + ")"; | ||
| 334 | + } | ||
| 335 | + Integer createBy = map.get("createBy").equals("") ? null : Integer.valueOf(map.get("createBy").toString()); | ||
| 336 | + String createDate = map.get("createDate").equals("") ? null : map.get("createDate").toString(); | ||
| 337 | + Integer updateBy = map.get("updateBy").equals("") ?null : Integer.valueOf(map.get("updateBy").toString()); | ||
| 338 | + SimpleDateFormat formatter = new SimpleDateFormat ("yyyy-MM-dd HH:mm:ss"); | ||
| 339 | + Date date = new Date(); | ||
| 340 | + // 修改日期 | ||
| 341 | + String updateDate = formatter.format(date); | ||
| 342 | + String crosesRoad=""; | ||
| 343 | + String endNode=""; | ||
| 344 | + String startNode=""; | ||
| 345 | + String middleNode=""; | ||
| 346 | + String sectionType=""; | ||
| 347 | + // 更新 | ||
| 348 | + sectionRepository.sectionUpdate(sectionId, gsectionVector, bsectionVectorS, sectionCode, sectionName, crosesRoad, endNode, startNode, middleNode, sectionType, roadCoding, sectionDistance, sectionTime, dbType, speedLimit, descriptions, version, createBy, createDate, updateBy, updateDate); | ||
| 349 | + | ||
| 350 | + Line line = lineRepository.findById(sectionRouteLine).get(); | ||
| 351 | + Section section = sectionRepository.findById(sectionId).get(); | ||
| 352 | + | ||
| 353 | + if(map.get("status") == null || Integer.parseInt(map.get("status").toString()) != 0) { | ||
| 354 | + | ||
| 355 | + LsInoutSectionRoute resultS = lsInoutSectionRouteRepository.findById(sectionRouteId).get(); | ||
| 356 | + int old_code = resultS.getSectionrouteCode(); | ||
| 357 | + // 是否修改路段序号标记 | ||
| 358 | + boolean type = false; | ||
| 359 | + if(sectionrouteCode!=null) { | ||
| 360 | + if(++sectionrouteCode == old_code) { | ||
| 361 | + type = true; | ||
| 362 | + } | ||
| 363 | + // 默认是最前面路段 | ||
| 364 | + }else { | ||
| 365 | + sectionrouteCode = 1; | ||
| 366 | + } | ||
| 367 | + if(!type) | ||
| 368 | + lsInoutSectionRouteRepository.sectionUpdSectionRouteCode(lineCode, version, start, end,sectionrouteCode); | ||
| 369 | + LsInoutSectionRoute route = new LsInoutSectionRoute(); | ||
| 370 | + route.setId(sectionRouteId); | ||
| 371 | + route.setSectionrouteCode(sectionrouteCode); | ||
| 372 | + route.setLineCode(lineCode); | ||
| 373 | + route.setSectionCode(sectionCode); | ||
| 374 | + route.setDirections(directions); | ||
| 375 | + route.setVersions(version); | ||
| 376 | + route.setDestroy(destroy); | ||
| 377 | + route.setCreateBy(createBy); | ||
| 378 | + route.setUpdateBy(updateBy); | ||
| 379 | + route.setSection(section); | ||
| 380 | + route.setLine(line); | ||
| 381 | + route.setStart(start); | ||
| 382 | + route.setEnd(end); | ||
| 383 | + lsInoutSectionRouteRepository.save(route); | ||
| 384 | + } | ||
| 385 | + resultMap.put("status", ResponseCode.SUCCESS); | ||
| 386 | + } catch (Exception e) { | ||
| 387 | + resultMap.put("status", ResponseCode.ERROR); | ||
| 388 | + logger.error("save erro.", e); | ||
| 389 | + } | ||
| 390 | + return resultMap; | ||
| 391 | + } | ||
| 392 | + | ||
| 393 | + @Override | ||
| 394 | + public Map<String, Object> destroy(Map<String, Object> map) { | ||
| 395 | + Map<String, Object> resultMap = new HashMap<String, Object>(); | ||
| 396 | + try { | ||
| 397 | + long id = Long.parseLong(map.get("id").toString()); | ||
| 398 | + | ||
| 399 | + if(map.get("status") == null || Integer.parseInt(map.get("status").toString()) != 0) { | ||
| 400 | + lsInoutSectionRouteRepository.deleteById(id); | ||
| 401 | + } | ||
| 402 | + resultMap.put("status", ResponseCode.SUCCESS); | ||
| 403 | + } catch (Exception e) { | ||
| 404 | + resultMap.put("status", ResponseCode.ERROR); | ||
| 405 | + logger.error("destroy erro.", e); | ||
| 406 | + } | ||
| 407 | + return resultMap; | ||
| 408 | + } | ||
| 409 | + | ||
| 410 | + @Override | ||
| 411 | + @Transactional | ||
| 412 | + public void pathPlaningByHistory(long schId, int versions) throws JsonProcessingException { | ||
| 413 | + ScheduleRealInfo scheduleRealInfo = scheduleRealInfoRepository.findById(schId).get(); | ||
| 414 | + DateTimeFormatter formatter = DateTimeFormat.forPattern("yyyy-MM-ddHH:mm"); | ||
| 415 | + DateTime start = formatter.parseDateTime(scheduleRealInfo.getRealExecDate() + scheduleRealInfo.getFcsjActual()); | ||
| 416 | + DateTime end = formatter.parseDateTime(scheduleRealInfo.getRealExecDate() + scheduleRealInfo.getZdsjActual()); | ||
| 417 | + if (start.isAfter(end)) { | ||
| 418 | + end = end.plusDays(1); | ||
| 419 | + } | ||
| 420 | + Map<String, Object> map = gpsService.history(new String[]{ scheduleRealInfo.getClZbh() }, start.getMillis() / 1000 - 20, end.getMillis() / 1000 + 20); | ||
| 421 | + List<Map<String, Object>> list = (List<Map<String, Object>>)map.get("list"); | ||
| 422 | + List<Map<String, Object>> bsectionVector = new ArrayList<>(); | ||
| 423 | + for (Map<String, Object> m : list) { | ||
| 424 | + Map<String, Object> m1 = new HashMap<>(); | ||
| 425 | + Float lng = (Float)m.get("lon"), lat = (Float)m.get("lat"); | ||
| 426 | + if (lng == 0 || lat == 0) { | ||
| 427 | + continue; | ||
| 428 | + } | ||
| 429 | + m1.put("lng", m.get("bd_lon")); | ||
| 430 | + m1.put("lat", m.get("bd_lat")); | ||
| 431 | + bsectionVector.add(m1); | ||
| 432 | + } | ||
| 433 | + map.clear(); | ||
| 434 | + map.put("lineId", scheduleRealInfo.getXlBm()); | ||
| 435 | + map.put("lineCode", scheduleRealInfo.getXlBm()); | ||
| 436 | + map.put("sectionName", scheduleRealInfo.getQdzName() + "-" + scheduleRealInfo.getZdzName()); | ||
| 437 | + map.put("sectionCode", sectionRepository.sectionMaxId() + 1); | ||
| 438 | + map.put("roadCoding", ""); | ||
| 439 | + map.put("dbType", "b"); | ||
| 440 | + map.put("sectionrouteCode", "1"); | ||
| 441 | + map.put("sectionTime", ""); | ||
| 442 | + map.put("sectionDistance", ""); | ||
| 443 | + map.put("speedLimit", "60"); | ||
| 444 | + map.put("versions", versions); | ||
| 445 | + map.put("destroy", 0); | ||
| 446 | + map.put("directions", 3); | ||
| 447 | + map.put("descriptions", ""); | ||
| 448 | + map.put("start", scheduleRealInfo.getQdzCode()); | ||
| 449 | + map.put("end", scheduleRealInfo.getZdzCode()); | ||
| 450 | + map.put("bsectionVector", new ObjectMapper().writeValueAsString(bsectionVector)); | ||
| 451 | + | ||
| 452 | + lsInoutSectionRouteRepository.destroy(scheduleRealInfo.getXlBm(), versions, scheduleRealInfo.getQdzCode(), scheduleRealInfo.getZdzCode()); | ||
| 453 | + sectionSave(map); | ||
| 454 | + } | ||
| 455 | +} |
src/main/java/com/bsth/service/impl/TrafficManageServiceImpl.java
| 1 | -package com.bsth.service.impl; | ||
| 2 | - | ||
| 3 | -import com.bsth.data.BasicData; | ||
| 4 | -import com.bsth.email.SendEmailController; | ||
| 5 | -import com.bsth.email.entity.EmailBean; | ||
| 6 | -import com.bsth.entity.*; | ||
| 7 | -import com.bsth.entity.realcontrol.ChildTaskPlan; | ||
| 8 | -import com.bsth.entity.realcontrol.ScheduleRealInfo; | ||
| 9 | -import com.bsth.entity.schedule.SchedulePlanInfo; | ||
| 10 | -import com.bsth.entity.schedule.TTInfo; | ||
| 11 | -import com.bsth.entity.schedule.TTInfoDetail; | ||
| 12 | -import com.bsth.entity.search.CustomerSpecs; | ||
| 13 | -import com.bsth.entity.sys.SysUser; | ||
| 14 | -import com.bsth.entity.traffic.SKBUploadLogger; | ||
| 15 | -import com.bsth.repository.*; | ||
| 16 | -import com.bsth.repository.realcontrol.ScheduleRealInfoRepository; | ||
| 17 | -import com.bsth.repository.schedule.*; | ||
| 18 | -import com.bsth.repository.traffic.SKBUploadLoggerRepository; | ||
| 19 | -import com.bsth.security.util.SecurityUtils; | ||
| 20 | -import com.bsth.service.TrafficManageService; | ||
| 21 | -import com.bsth.service.traffic.YgcBasicDataService; | ||
| 22 | -import com.bsth.util.TimeUtils; | ||
| 23 | -import com.bsth.util.db.DBUtils_MS; | ||
| 24 | -import com.bsth.webService.trafficManage.org.tempuri.Results; | ||
| 25 | -import com.bsth.webService.trafficManage.org.tempuri.WebServiceLocator; | ||
| 26 | -import com.bsth.webService.trafficManage.org.tempuri.WebServiceSoap; | ||
| 27 | -import org.apache.commons.lang.StringEscapeUtils; | ||
| 28 | -import org.apache.commons.lang.StringUtils; | ||
| 29 | -import org.apache.commons.lang.time.DateUtils; | ||
| 30 | -import org.joda.time.DateTime; | ||
| 31 | -import org.slf4j.Logger; | ||
| 32 | -import org.slf4j.LoggerFactory; | ||
| 33 | -import org.springframework.beans.factory.annotation.Autowired; | ||
| 34 | -import org.springframework.data.domain.Sort; | ||
| 35 | -import org.springframework.data.domain.Sort.Direction; | ||
| 36 | -import org.springframework.security.core.context.SecurityContextHolder; | ||
| 37 | -import org.springframework.stereotype.Service; | ||
| 38 | - | ||
| 39 | -import java.io.*; | ||
| 40 | -import java.net.InetAddress; | ||
| 41 | -import java.sql.Connection; | ||
| 42 | -import java.sql.PreparedStatement; | ||
| 43 | -import java.sql.ResultSet; | ||
| 44 | -import java.text.DecimalFormat; | ||
| 45 | -import java.text.SimpleDateFormat; | ||
| 46 | -import java.util.*; | ||
| 47 | -import java.util.regex.Matcher; | ||
| 48 | -import java.util.regex.Pattern; | ||
| 49 | - | ||
| 50 | -/** | ||
| 51 | - * | ||
| 52 | - * @ClassName: TrafficManageServiceImpl(运管处接口service业务层实现类) | ||
| 53 | - * | ||
| 54 | - * @Extends : BaseService | ||
| 55 | - * | ||
| 56 | - * @Description: TODO(运管处接口service业务层) | ||
| 57 | - * | ||
| 58 | - * @Author bsth@zq | ||
| 59 | - * | ||
| 60 | - * @Date 2016年10月28日 上午9:21:17 | ||
| 61 | - * | ||
| 62 | - * @Version 公交调度系统BS版 0.1 | ||
| 63 | - * | ||
| 64 | - */ | ||
| 65 | - | ||
| 66 | -@Service | ||
| 67 | -public class TrafficManageServiceImpl implements TrafficManageService{ | ||
| 68 | - | ||
| 69 | - Logger logger = LoggerFactory.getLogger(this.getClass()); | ||
| 70 | - // 运管处上传日志类型 | ||
| 71 | - public static final String UPLOAD_TYPE_SKB = "1"; | ||
| 72 | - public static final String UPLOAD_TYPE_XL = "2"; | ||
| 73 | - public static final String UPLOAD_TYPE_LD = "3"; | ||
| 74 | - | ||
| 75 | - // 线路repository | ||
| 76 | - @Autowired | ||
| 77 | - private LineRepository lineRepository; | ||
| 78 | - | ||
| 79 | - @Autowired | ||
| 80 | - private LineInformationRepository lineInformationRepository; | ||
| 81 | - | ||
| 82 | - // 站点路由repository | ||
| 83 | - @Autowired | ||
| 84 | - private StationRouteRepository stationRouteRepository; | ||
| 85 | - | ||
| 86 | - // 历史站点路由repository | ||
| 87 | - @Autowired | ||
| 88 | - private LsStationRouteRepository lsStationRouteRepository; | ||
| 89 | - | ||
| 90 | - @Autowired | ||
| 91 | - private SectionRepository sectionRepository; | ||
| 92 | - | ||
| 93 | - // 车辆repository | ||
| 94 | - @Autowired | ||
| 95 | - private CarsRepository carsRepository; | ||
| 96 | - | ||
| 97 | - // 人员repository | ||
| 98 | - @Autowired | ||
| 99 | - private PersonnelRepository personnelRepository; | ||
| 100 | - | ||
| 101 | - // 时刻模板repository | ||
| 102 | - @Autowired | ||
| 103 | - private TTInfoRepository ttInfoRepository; | ||
| 104 | - | ||
| 105 | - // 时刻模板明细repository | ||
| 106 | - @Autowired | ||
| 107 | - private TTInfoDetailRepository ttInfoDetailRepository; | ||
| 108 | - | ||
| 109 | - // 排班计划明细repository | ||
| 110 | - @Autowired | ||
| 111 | - private SchedulePlanInfoRepository schedulePlanInfoRepository; | ||
| 112 | - | ||
| 113 | - // 实际排班计划明细repository | ||
| 114 | - @Autowired | ||
| 115 | - private ScheduleRealInfoRepository scheduleRealInfoRepository; | ||
| 116 | - | ||
| 117 | - // 时刻表上传记录repository | ||
| 118 | - @Autowired | ||
| 119 | - private SKBUploadLoggerRepository skbUploadLoggerRepository; | ||
| 120 | - | ||
| 121 | - // 线路站点repository | ||
| 122 | - @Autowired | ||
| 123 | - private YgcBasicDataService ygcBasicDataService; | ||
| 124 | - | ||
| 125 | - // 发送邮件 | ||
| 126 | - @Autowired | ||
| 127 | - private SendEmailController sendEmailController; | ||
| 128 | - | ||
| 129 | - /** | ||
| 130 | - * 线路版本repository | ||
| 131 | - */ | ||
| 132 | - @Autowired | ||
| 133 | - private LineVersionsRepository lineVersionsRepository; | ||
| 134 | - | ||
| 135 | - // 运管处上传接口 | ||
| 136 | - private com.bsth.webService.trafficManage.up.org.tempuri.WebServiceSoap webServiceSoapUp; | ||
| 137 | - private WebServiceSoap ssop ; | ||
| 138 | - { | ||
| 139 | - try { | ||
| 140 | - ssop = new WebServiceLocator().getWebServiceSoap(); | ||
| 141 | - } catch (Exception e) { | ||
| 142 | - e.printStackTrace(); | ||
| 143 | - } | ||
| 144 | - } | ||
| 145 | - // 格式化 年月日时分秒 nyrsfm是年月日时分秒的拼音首字母 | ||
| 146 | - private SimpleDateFormat sdfnyrsfm = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); | ||
| 147 | - | ||
| 148 | - // 格式化 年月日 | ||
| 149 | - private SimpleDateFormat sdfnyr = new SimpleDateFormat("yyyy-MM-dd"); | ||
| 150 | - | ||
| 151 | - // 数字格式化 | ||
| 152 | - DecimalFormat format = new DecimalFormat("0.00"); | ||
| 153 | - | ||
| 154 | - // 用户名 | ||
| 155 | - private final String userNameOther = "user"; | ||
| 156 | - // 密码 | ||
| 157 | - private final String passwordOther = "user"; | ||
| 158 | - | ||
| 159 | - // 用户名 | ||
| 160 | - private final String userNameUp = "user"; | ||
| 161 | - // 密码 | ||
| 162 | - private final String passwordUp = "user"; | ||
| 163 | - // 接收邮件人 | ||
| 164 | - private final String emailSendToAddress = "113252620@qq.com"; | ||
| 165 | - // 记录路单上线的成功、失败线路数 | ||
| 166 | - private Integer countSuccess,countFailure; | ||
| 167 | - | ||
| 168 | - private synchronized com.bsth.webService.trafficManage.up.org.tempuri.WebServiceSoap getWebServiceSoapUp(){ | ||
| 169 | - try { | ||
| 170 | - if(webServiceSoapUp == null){ | ||
| 171 | - webServiceSoapUp = new com.bsth.webService.trafficManage.up.org.tempuri.WebServiceLocator().getWebServiceSoap(); | ||
| 172 | - } | ||
| 173 | - }catch (Exception e){ | ||
| 174 | - e.printStackTrace(); | ||
| 175 | - }finally { | ||
| 176 | - return webServiceSoapUp; | ||
| 177 | - } | ||
| 178 | - } | ||
| 179 | - /** | ||
| 180 | - * 上传线路信息 | ||
| 181 | - */ | ||
| 182 | - @Override | ||
| 183 | - public String setXL(String ids) { | ||
| 184 | - String result = "failure"; | ||
| 185 | - String xml ; | ||
| 186 | - String[] idArray = ids.split(","); | ||
| 187 | - try { | ||
| 188 | - for (String id : idArray) { | ||
| 189 | - if(id == null || id.trim().equals("")){ | ||
| 190 | - continue; | ||
| 191 | - } | ||
| 192 | - Map<String,Object> map = new HashMap<>(); | ||
| 193 | - map.put("lineCode_eq", id); | ||
| 194 | - Line line ; | ||
| 195 | - LineInformation lineInformation; | ||
| 196 | - Optional<Line> optionalLine = lineRepository.findOne(new CustomerSpecs<Line>(map)); | ||
| 197 | - line = optionalLine.isPresent() ? optionalLine.get() : null; | ||
| 198 | - if(line == null){ | ||
| 199 | - continue; | ||
| 200 | - } | ||
| 201 | - if(BasicData.lineId2ShangHaiCodeMap.get(line.getId()) == null){ | ||
| 202 | - return result; | ||
| 203 | - } | ||
| 204 | - map = new HashMap<>(); | ||
| 205 | - map.put("line.id_eq",line.getId()); | ||
| 206 | - Optional<LineInformation> optionalLineInformation = lineInformationRepository.findOne(new CustomerSpecs<LineInformation>(map)); | ||
| 207 | - lineInformation = optionalLineInformation.isPresent() ? optionalLineInformation.get() : null; | ||
| 208 | - if(lineInformation == null){ | ||
| 209 | - continue; | ||
| 210 | - } | ||
| 211 | - // 取得封装好的xml | ||
| 212 | - xml = getSetXlXml(line,lineInformation); | ||
| 213 | - // 站点序号不能为0,如果为0,则返回错误 | ||
| 214 | - if(xml.indexOf("<ZDXH>0</ZDXH>") != -1){ | ||
| 215 | - return "0"; | ||
| 216 | - } | ||
| 217 | - String state;// 是否上传成功 | ||
| 218 | - // 调用上传方法 | ||
| 219 | - if(getWebServiceSoapUp().setXL(userNameUp,passwordUp,xml).isSuccess()){ | ||
| 220 | - result = "success"; | ||
| 221 | - state = "1"; | ||
| 222 | - }else{ | ||
| 223 | - result = "failure"; | ||
| 224 | - state = "0"; | ||
| 225 | - } | ||
| 226 | - logger.info("setXL:"+xml); | ||
| 227 | - logger.info("setXL:"+result); | ||
| 228 | - // 保存运管处上传记录 | ||
| 229 | - saveYgcUploadLog(line,xml,TrafficManageServiceImpl.UPLOAD_TYPE_XL,state); | ||
| 230 | - } | ||
| 231 | - } catch (Exception e) { | ||
| 232 | - logger.error("setXL:",e); | ||
| 233 | - e.printStackTrace(); | ||
| 234 | - } | ||
| 235 | - return result; | ||
| 236 | - } | ||
| 237 | - | ||
| 238 | - /** | ||
| 239 | - * 加载运管处的站点及序号 | ||
| 240 | - * 上行从1开始,下行顺序续编 | ||
| 241 | - */ | ||
| 242 | - private Map<String, Integer> getStationName2YgcNumberMap (String lineCode){ | ||
| 243 | - Map<String, Integer> resultMap = new HashMap<>(); | ||
| 244 | - List<Map<String, String>> ygcLines = stationRouteRepository.findLineWithYgcByLine(lineCode); | ||
| 245 | - if(ygcLines != null && ygcLines.size() > 0){ | ||
| 246 | - int size = ygcLines.size(); | ||
| 247 | - Map<String, String> tempMap ; | ||
| 248 | - int num = 1; | ||
| 249 | - String key; | ||
| 250 | - for (int i = 0; i < size; i ++){ | ||
| 251 | - tempMap = ygcLines.get(i); | ||
| 252 | - key = tempMap.get("lineCode") + "_"+String.valueOf(tempMap.get("directions")) | ||
| 253 | - + "_"+tempMap.get("stationCode")+ "_"+tempMap.get("stationMark"); | ||
| 254 | - resultMap.put(key,num++); | ||
| 255 | - } | ||
| 256 | - } | ||
| 257 | - return resultMap; | ||
| 258 | - } | ||
| 259 | - | ||
| 260 | - /** | ||
| 261 | - * 上传线路信息(按in_use上传) | ||
| 262 | - */ | ||
| 263 | - @Override | ||
| 264 | - public String setXLByInUse(String inUse) { | ||
| 265 | - StringBuffer result = new StringBuffer(); | ||
| 266 | - try { | ||
| 267 | - Map<String,Object> map = new HashMap<>(); | ||
| 268 | - if(inUse != null && inUse.equals("1")){ | ||
| 269 | - map.put("inUse_eq", inUse); | ||
| 270 | - } | ||
| 271 | - List<Line> lines ; | ||
| 272 | - Line line; | ||
| 273 | - lines = lineRepository.findAll(new CustomerSpecs<Line>(map)); | ||
| 274 | - if(lines != null && lines.size() > 0){ | ||
| 275 | - for(int i = 0 ; i < lines.size() ; i ++){ | ||
| 276 | - line = lines.get(i); | ||
| 277 | - if(line != null && line.getId() != null){ | ||
| 278 | - result.append(line.getLineCode()).append(":").append(setXL(line.getLineCode())).append(";"); | ||
| 279 | - } | ||
| 280 | - } | ||
| 281 | - } | ||
| 282 | - } catch (Exception e) { | ||
| 283 | - result.append("failure"); | ||
| 284 | - logger.error("setXLByInUse:",e); | ||
| 285 | - e.printStackTrace(); | ||
| 286 | - } | ||
| 287 | - return result.toString(); | ||
| 288 | - } | ||
| 289 | - | ||
| 290 | - /** | ||
| 291 | - * 上传车辆信息 | ||
| 292 | - */ | ||
| 293 | - @Override | ||
| 294 | - public String setCL() { | ||
| 295 | - String result = "failure"; | ||
| 296 | - StringBuffer sBuffer =new StringBuffer(); | ||
| 297 | - try { | ||
| 298 | - sBuffer.append("<CLs>"); | ||
| 299 | - Cars cars = null; | ||
| 300 | - String company; | ||
| 301 | - Iterator<Cars> carsIterator = carsRepository.findAll().iterator(); | ||
| 302 | - while(carsIterator.hasNext()){ | ||
| 303 | - cars = carsIterator.next(); | ||
| 304 | - sBuffer.append("<CL>"); | ||
| 305 | - company = cars.getCompany(); | ||
| 306 | - setCompanyName(company);// 统一公司名称 | ||
| 307 | - sBuffer.append("<GSJC>").append(company).append("</GSJC>"); | ||
| 308 | - sBuffer.append("<NBH>").append(cars.getInsideCode()).append("</NBH>"); | ||
| 309 | - sBuffer.append("<CPH>").append(cars.getCarPlate()).append("</CPH>"); | ||
| 310 | - sBuffer.append("<YYZBH>").append(cars.getServiceNo()).append("</YYZBH>"); | ||
| 311 | - sBuffer.append("<CZCPH>").append(cars.getCarPlate()).append("</CZCPH>");//******这个数据没有*********** | ||
| 312 | - sBuffer.append("<CZZDBH>").append(cars.getEquipmentCode()).append("</CZZDBH>"); | ||
| 313 | - sBuffer.append("<UPDT>").append(sdfnyrsfm.format(new Date())).append("</UPDT>"); | ||
| 314 | - sBuffer.append("</CL>"); | ||
| 315 | - } | ||
| 316 | - sBuffer.append("</CLs>"); | ||
| 317 | - if(ssop.setCL(userNameOther, passwordOther, sBuffer.toString()).isSuccess()){ | ||
| 318 | - result = "success"; | ||
| 319 | - } | ||
| 320 | - } catch (Exception e) { | ||
| 321 | - logger.error("setCL:",e); | ||
| 322 | - e.printStackTrace(); | ||
| 323 | - }finally{ | ||
| 324 | - logger.info("setCL:"+sBuffer.toString()); | ||
| 325 | - logger.info("setCL:"+result); | ||
| 326 | - } | ||
| 327 | - return result; | ||
| 328 | - } | ||
| 329 | - | ||
| 330 | - /** | ||
| 331 | - * 上传司机信息 | ||
| 332 | - */ | ||
| 333 | - @Override | ||
| 334 | - public String setSJ() { | ||
| 335 | - String result = "failure"; | ||
| 336 | - StringBuffer sBuffer =new StringBuffer(); | ||
| 337 | - try { | ||
| 338 | - sBuffer.append("<SJs>"); | ||
| 339 | - Personnel personnel = null; | ||
| 340 | - String company; | ||
| 341 | - Iterator<Personnel> personIterator = personnelRepository.findAll().iterator(); | ||
| 342 | - while(personIterator.hasNext()){ | ||
| 343 | - personnel = personIterator.next(); | ||
| 344 | - sBuffer.append("<SJ>"); | ||
| 345 | - company = personnel.getCompany(); | ||
| 346 | - setCompanyName(company);// 统一公司名称 | ||
| 347 | - sBuffer.append("<GSJC>").append(company).append("</GSJC>"); | ||
| 348 | - sBuffer.append("<SJGH>").append(personnel.getJobCode()).append("</SJGH>"); | ||
| 349 | - sBuffer.append("<CYZGZH>").append(personnel.getPapersCode()).append("</CYZGZH>");//*********** | ||
| 350 | - sBuffer.append("<XM>").append(personnel.getPersonnelName()).append("</XM>"); | ||
| 351 | - sBuffer.append("<UPDT>").append(sdfnyrsfm.format(new Date())).append("</UPDT>"); | ||
| 352 | - sBuffer.append("</SJ>"); | ||
| 353 | - } | ||
| 354 | - sBuffer.append("</SJs>"); | ||
| 355 | - if(ssop.setSJ(userNameOther, passwordOther, sBuffer.toString()).isSuccess()){ | ||
| 356 | - result = "success"; | ||
| 357 | - }; | ||
| 358 | - } catch (Exception e) { | ||
| 359 | - logger.error("setSJ:",e); | ||
| 360 | - e.printStackTrace(); | ||
| 361 | - }finally{ | ||
| 362 | - logger.info("setSJ:"+sBuffer.toString()); | ||
| 363 | - logger.info("setSJ:"+result); | ||
| 364 | - } | ||
| 365 | - return result; | ||
| 366 | - } | ||
| 367 | - | ||
| 368 | - /** | ||
| 369 | - * 上传路单 指定日期 yyyy-MM-dd | ||
| 370 | - * @param theDate | ||
| 371 | - * @return | ||
| 372 | - */ | ||
| 373 | - public String setLD(String theDate){ | ||
| 374 | - return uploadLD(theDate); | ||
| 375 | - } | ||
| 376 | - | ||
| 377 | - /** | ||
| 378 | - * 上传路单 上传前一天的路单 | ||
| 379 | - * @return | ||
| 380 | - */ | ||
| 381 | - public String setLD(){ | ||
| 382 | - return uploadLD(null); | ||
| 383 | - } | ||
| 384 | - /** | ||
| 385 | - * 上传路单 | ||
| 386 | - * @return 上传成功标识 | ||
| 387 | - */ | ||
| 388 | - private String uploadLD(String theDate){ | ||
| 389 | - // 取昨天 的日期 | ||
| 390 | - String date = theDate == null ?sdfnyr.format(DateUtils.addDays(new Date(), -1)) : theDate; | ||
| 391 | - StringBuffer sf = new StringBuffer(); | ||
| 392 | - Results results = null; | ||
| 393 | - String str = "", xlbm = null, oldXlbm = null; | ||
| 394 | - List<Map<String,Object>> listGroup = null; | ||
| 395 | - int scount = 0, ccount = 0; | ||
| 396 | - long start = System.currentTimeMillis(); | ||
| 397 | - try { | ||
| 398 | - // 计数器 | ||
| 399 | - int counter = 0; | ||
| 400 | - // 每几条线路上传一次路单 | ||
| 401 | - int per = 10; | ||
| 402 | - List<ScheduleRealInfo> list = scheduleRealInfoRepository.setLD(date); | ||
| 403 | - listGroup = scheduleRealInfoRepository.setLDGroup(date); | ||
| 404 | - Map<String,Object> map = new HashMap(); | ||
| 405 | - HashMap<String,String> paramMap; | ||
| 406 | - HashMap<String,String> otherMap = new HashMap(); | ||
| 407 | - | ||
| 408 | - // 车辆内部编码和车牌做映射 | ||
| 409 | - Map<String, String> inside2plate = new HashMap<>(); | ||
| 410 | - Iterable<Cars> cars = carsRepository.findAll(); | ||
| 411 | - for (Cars car : cars) { | ||
| 412 | - inside2plate.put(car.getInsideCode(), car.getCarPlate()); | ||
| 413 | - } | ||
| 414 | - | ||
| 415 | - // 线路编码和线路信息映射 | ||
| 416 | - Map<String, Line> code2line = new HashMap<>(); | ||
| 417 | - Iterable<Line> lines = lineRepository.findAll(); | ||
| 418 | - for (Line line : lines) { | ||
| 419 | - code2line.put(line.getLineCode(), line); | ||
| 420 | - } | ||
| 421 | - | ||
| 422 | - // 线路编码和线路版本映射(电子路单日期) | ||
| 423 | - Map<String, Integer> code2version = new HashMap<>(); | ||
| 424 | - Iterable<LineVersions> versions = lineVersionsRepository.findLineVersionsByDate((int)(DateTime.parse(date).getMillis() / 1000)); | ||
| 425 | - for (LineVersions version : versions) { | ||
| 426 | - code2version.put(version.getLineCode(), version.getVersions()); | ||
| 427 | - } | ||
| 428 | - | ||
| 429 | - Map<String, Integer> stationNumMap = null; | ||
| 430 | - for(Map<String,Object> schRealInfo:listGroup){ | ||
| 431 | - if(schRealInfo != null){ | ||
| 432 | - // 获取线路是否使用标识,如果未使用,则不查该线路数据 | ||
| 433 | - String lineCode = schRealInfo.get("xlBm")+""; | ||
| 434 | - Line line = code2line.get(lineCode); | ||
| 435 | - if(line == null || line.getInUse() == null || line.getInUse() == 0){ | ||
| 436 | - ccount++; | ||
| 437 | - continue; | ||
| 438 | - } | ||
| 439 | - if(counter % per == 0){ | ||
| 440 | - sf = new StringBuffer(); | ||
| 441 | - sf.append("<DLDS>"); | ||
| 442 | - } | ||
| 443 | - counter ++; | ||
| 444 | - xlbm = BasicData.lineCode2ShangHaiCodeMap.get(lineCode); | ||
| 445 | - if (!xlbm.equals(oldXlbm)) { | ||
| 446 | - oldXlbm = xlbm; | ||
| 447 | - Integer ver = code2version.get(lineCode); | ||
| 448 | - if (ver != null) { | ||
| 449 | - stationNumMap = getLsStationRoute(lineCode, ver); | ||
| 450 | - } | ||
| 451 | - } | ||
| 452 | - | ||
| 453 | - sf.append("<DLD>"); | ||
| 454 | - sf.append("<RQ>").append(date).append("</RQ>"); | ||
| 455 | - sf.append("<XLBM>").append(xlbm).append("</XLBM>"); | ||
| 456 | - sf.append("<LPBH>").append(schRealInfo.get("lpName")).append("</LPBH>"); | ||
| 457 | - sf.append("<CPH>").append(inside2plate.get(schRealInfo.get("clZbh"))).append("</CPH>"); | ||
| 458 | - sf.append("<UPDT>").append(sdfnyrsfm.format(new Date())).append("</UPDT>"); | ||
| 459 | - sf.append("<LDList>"); | ||
| 460 | - for(ScheduleRealInfo scheduleRealInfo:list){ | ||
| 461 | - if((schRealInfo.get("xlBm")+"").equals(scheduleRealInfo.getXlBm()) && (schRealInfo.get("lpName")+"") | ||
| 462 | - .equals(scheduleRealInfo.getLpName()) | ||
| 463 | - && (schRealInfo.get("clZbh")+"").equals(scheduleRealInfo.getClZbh())){ | ||
| 464 | - | ||
| 465 | - if(scheduleRealInfo.isDestroy()){ | ||
| 466 | - if(scheduleRealInfo.isReissue()){ | ||
| 467 | - scheduleRealInfo.setFcsjActualAll(scheduleRealInfo.getDfsj()); | ||
| 468 | - scheduleRealInfo.setZdsjActualAll(scheduleRealInfo.getZdsj()); | ||
| 469 | - } | ||
| 470 | - else | ||
| 471 | - continue; | ||
| 472 | - } | ||
| 473 | - | ||
| 474 | - if(scheduleRealInfo.getBcType().equals("in") | ||
| 475 | - || scheduleRealInfo.getBcType().equals("out")){ | ||
| 476 | - continue; | ||
| 477 | - } | ||
| 478 | - | ||
| 479 | - sf.append("<LD>"); | ||
| 480 | - sf.append("<SJGH>").append(scheduleRealInfo.getjGh()).append("</SJGH>"); | ||
| 481 | - sf.append("<SXX>").append(scheduleRealInfo.getXlDir()).append("</SXX>"); | ||
| 482 | - sf.append("<FCZDMC>").append(scheduleRealInfo.getQdzName()).append("</FCZDMC>"); | ||
| 483 | - // 起点站的参数 | ||
| 484 | - otherMap.put("stationMark","B"); | ||
| 485 | - paramMap = packageYgcStationNumParam(scheduleRealInfo,otherMap); | ||
| 486 | - sf.append("<FCZDXH>").append(getYgcStationNumByLineCodeAndDirectionAndStationName(paramMap,stationNumMap)).append("</FCZDXH>"); | ||
| 487 | - sf.append("<FCZDBM>").append(scheduleRealInfo.getQdzCode()).append("</FCZDBM>"); | ||
| 488 | - sf.append("<JHFCSJ>").append(scheduleRealInfo.getFcsj()).append("</JHFCSJ>"); | ||
| 489 | - sf.append("<DFSJ>").append(scheduleRealInfo.getDfsj()).append("</DFSJ>"); | ||
| 490 | - sf.append("<SJFCSJ>").append(scheduleRealInfo.getFcsjActual()).append("</SJFCSJ>"); | ||
| 491 | - sf.append("<FCZDLX></FCZDLX>"); | ||
| 492 | - sf.append("<DDZDMC>").append(scheduleRealInfo.getZdzName()).append("</DDZDMC>"); | ||
| 493 | - // 终点站的参数 | ||
| 494 | - otherMap.put("stationMark","E"); | ||
| 495 | - paramMap = packageYgcStationNumParam(scheduleRealInfo,otherMap); | ||
| 496 | - sf.append("<DDZDXH>").append(getYgcStationNumByLineCodeAndDirectionAndStationName(paramMap,stationNumMap)).append("</DDZDXH>"); | ||
| 497 | - sf.append("<DDZDBM>").append(scheduleRealInfo.getZdzCode()).append("</DDZDBM>"); | ||
| 498 | - sf.append("<JHDDSJ>").append(scheduleRealInfo.getZdsj()).append("</JHDDSJ>"); | ||
| 499 | - sf.append("<SJDDSJ>").append(scheduleRealInfo.getZdsjActual()).append("</SJDDSJ>"); | ||
| 500 | - sf.append("<DDZDLX></DDZDLX>"); | ||
| 501 | - sf.append("<LDSCBZ>0</LDSCBZ>"); | ||
| 502 | - sf.append("<DDBZ>").append("").append("</DDBZ>"); | ||
| 503 | - sf.append("</LD>"); | ||
| 504 | - } | ||
| 505 | - } | ||
| 506 | - sf.append("</LDList>"); | ||
| 507 | - sf.append("</DLD>"); | ||
| 508 | - } | ||
| 509 | - if(counter % per == per - 1){ | ||
| 510 | - sf.append("</DLDS>"); | ||
| 511 | - // 去掉'号 | ||
| 512 | - str = sf.toString().replace("'",""); | ||
| 513 | - scount += invokeSetLD(str, counter); | ||
| 514 | - counter = 0; | ||
| 515 | - } | ||
| 516 | - } | ||
| 517 | - // 每per条线路上传后剩下的数据再上传 | ||
| 518 | - if(counter > 0){ | ||
| 519 | - sf.append("</DLDS>"); | ||
| 520 | - // 去掉'号 | ||
| 521 | - str = sf.toString().replace("'",""); | ||
| 522 | - scount += invokeSetLD(str, counter); | ||
| 523 | - } | ||
| 524 | - } catch (Exception e) { | ||
| 525 | - e.printStackTrace(); | ||
| 526 | - logger.error("setLD:", e); | ||
| 527 | - } finally { | ||
| 528 | - try { | ||
| 529 | - //发送邮件 | ||
| 530 | - EmailBean mail = new EmailBean(); | ||
| 531 | - mail.setSubject(InetAddress.getLocalHost().getHostAddress()+":路单日志数据"+date); | ||
| 532 | - mail.setContent("总数:" + (listGroup == null ? 0 : listGroup.size()) + "<br/>成功数:" + scount + "<br/>跳过数:" + ccount + "<br/>耗时:" + (System.currentTimeMillis() - start)); | ||
| 533 | - sendEmailController.sendMail(emailSendToAddress, mail); | ||
| 534 | - logger.info("setLD-sendMail:邮件发送成功!"); | ||
| 535 | - } catch (Exception e) { | ||
| 536 | - e.printStackTrace(); | ||
| 537 | - logger.error("setLD-sendMail:",e); | ||
| 538 | - } | ||
| 539 | - } | ||
| 540 | - return "success"; | ||
| 541 | - } | ||
| 542 | - | ||
| 543 | - /** | ||
| 544 | - * 调用运管处电子路单接口,如果上传失败或有网络问题,最多执行10次 | ||
| 545 | - * @param xml 拼接的xml字符串 | ||
| 546 | - * @param counter 分组数 | ||
| 547 | - * @return 成功返回counter 失败返回0 | ||
| 548 | - */ | ||
| 549 | - private int invokeSetLD(String xml, int counter) { | ||
| 550 | - for (int i = 0;i < 10;i++) { | ||
| 551 | - try { | ||
| 552 | - Results results = ssop.setLD(userNameOther, passwordOther, StringEscapeUtils.unescapeHtml(xml)); | ||
| 553 | - if (results.isSuccess()) { | ||
| 554 | - logger.info("setLD: " + xml); | ||
| 555 | - logger.info("setLD: 成功"); | ||
| 556 | - return counter; | ||
| 557 | - } else if (i == 9) { | ||
| 558 | - logger.error("setLD: " + xml); | ||
| 559 | - logger.error("setLD: 失败," + results.getMessage()); | ||
| 560 | - } | ||
| 561 | - Thread.sleep(2000); | ||
| 562 | - } catch (Exception e) { | ||
| 563 | - logger.error("运管处接口调用异常", e); | ||
| 564 | - try { | ||
| 565 | - Thread.sleep(2000); | ||
| 566 | - } catch (InterruptedException ex) { | ||
| 567 | - ex.printStackTrace(); | ||
| 568 | - } | ||
| 569 | - } | ||
| 570 | - } | ||
| 571 | - | ||
| 572 | - return 0; | ||
| 573 | - } | ||
| 574 | - | ||
| 575 | - /** | ||
| 576 | - * 上传路单 xml来自文件 | ||
| 577 | - * @return 上传成功标识 | ||
| 578 | - */ | ||
| 579 | - public String setLDFile(){ | ||
| 580 | - String result = "failure"; | ||
| 581 | - try { | ||
| 582 | - String tmp = readXmlFromFile("E:/ld.txt"); | ||
| 583 | - Results rss = ssop.setLD(userNameOther, passwordOther, StringEscapeUtils.unescapeHtml(tmp)); | ||
| 584 | - if(rss.isSuccess()){ | ||
| 585 | - result = "success"; | ||
| 586 | - } | ||
| 587 | - } catch (Exception e) { | ||
| 588 | - logger.error("setLD:",e); | ||
| 589 | - e.printStackTrace(); | ||
| 590 | - }finally{ | ||
| 591 | - | ||
| 592 | - } | ||
| 593 | - return result; | ||
| 594 | - } | ||
| 595 | - | ||
| 596 | - /** | ||
| 597 | - * 从文件中读取xml | ||
| 598 | - * @param fileName 例:D:/test.txt | ||
| 599 | - * @return | ||
| 600 | - * @throws Exception | ||
| 601 | - */ | ||
| 602 | - private String readXmlFromFile(String fileName) throws Exception { | ||
| 603 | - StringBuffer sf = new StringBuffer(""); | ||
| 604 | - File file = new File(fileName); | ||
| 605 | - InputStreamReader reader = new InputStreamReader(new FileInputStream(file),"GBK"); | ||
| 606 | - BufferedReader bufferedReader = new BufferedReader(reader); | ||
| 607 | - String lineTxt = ""; | ||
| 608 | - while((lineTxt = bufferedReader.readLine()) != null){ | ||
| 609 | - sf.append(lineTxt); | ||
| 610 | - } | ||
| 611 | - reader.close(); | ||
| 612 | - return sf.toString().replaceAll("\t",""); | ||
| 613 | - } | ||
| 614 | - /** | ||
| 615 | - * 上传里程油耗 | ||
| 616 | - * @return 上传成功标识 | ||
| 617 | - */ | ||
| 618 | - public String setLCYH(){ | ||
| 619 | - String result = "failure"; | ||
| 620 | - // 取昨天 的日期 | ||
| 621 | - String date = sdfnyr.format(DateUtils.addDays(new Date(), -1)); | ||
| 622 | - StringBuffer sf = new StringBuffer(); | ||
| 623 | - try { | ||
| 624 | - sf.append("<LCYHS>"); | ||
| 625 | - List<Map<String,Object>> listGroup = scheduleRealInfoRepository.setLCYHGroup(date); | ||
| 626 | - List<ScheduleRealInfo> list = scheduleRealInfoRepository.findByDate(date); | ||
| 627 | - Map<String,Object> map = new HashMap<String,Object>(); | ||
| 628 | - for(Map<String,Object> schRealInfo:listGroup){ | ||
| 629 | - if(schRealInfo != null){ | ||
| 630 | - map.put("insideCode_eq", schRealInfo.get("clZbh")+""); | ||
| 631 | - Optional<Cars> optionalCars = carsRepository.findOne(new CustomerSpecs<Cars>(map)); | ||
| 632 | - Cars car = optionalCars.isPresent() ? optionalCars.get() : null; | ||
| 633 | - /** | ||
| 634 | - * 如果car==null,则说明该车辆是从线调中换车功能中加进去的, | ||
| 635 | - * 在cars基础信息中查不到车辆的信息,所以忽略该车辆 | ||
| 636 | - */ | ||
| 637 | - if(car == null){ | ||
| 638 | - continue; | ||
| 639 | - } | ||
| 640 | - //计算总公里和空驶公里,营运公里=总公里-空驶公里 | ||
| 641 | - double totalKilometers = 0,emptyKilometers =0; | ||
| 642 | - sf.append("<LCYH>"); | ||
| 643 | - sf.append("<RQ>"+date+"</RQ>"); | ||
| 644 | - sf.append("<XLBM>"+BasicData.lineCode2ShangHaiCodeMap.get(schRealInfo.get("xlBm"))+"</XLBM>"); | ||
| 645 | - sf.append("<CPH>"+car.getCarPlate()+"</CPH>"); | ||
| 646 | - if(list != null && list.size() > 0){ | ||
| 647 | - for(ScheduleRealInfo scheduleRealInfo:list){ | ||
| 648 | - if((schRealInfo.get("xlBm")+"").equals(scheduleRealInfo.getXlBm()) && (schRealInfo.get("clZbh")+"") | ||
| 649 | - .equals(scheduleRealInfo.getClZbh())){ | ||
| 650 | - Set<ChildTaskPlan> childTaskPlans = scheduleRealInfo.getcTasks(); | ||
| 651 | - //如果没有子任务,里程就是已执行(Status=2);有子任务的,忽略主任务,子任务的烂班 | ||
| 652 | - if(childTaskPlans.isEmpty()){ | ||
| 653 | - if(scheduleRealInfo.getStatus() == 2){ | ||
| 654 | - totalKilometers += scheduleRealInfo.getJhlc()==null?0.0:scheduleRealInfo.getJhlc(); | ||
| 655 | - if(scheduleRealInfo.getBcType().equals("in") || scheduleRealInfo.getBcType().equals("out") | ||
| 656 | - || scheduleRealInfo.getBcType().equals("venting")){ | ||
| 657 | - emptyKilometers += scheduleRealInfo.getJhlc()==null?0.0:scheduleRealInfo.getJhlc(); | ||
| 658 | - } | ||
| 659 | - } | ||
| 660 | - }else{ | ||
| 661 | - Iterator<ChildTaskPlan> it = childTaskPlans.iterator(); | ||
| 662 | - while(it.hasNext()){ | ||
| 663 | - ChildTaskPlan childTaskPlan = it.next(); | ||
| 664 | - if(!childTaskPlan.isDestroy()){ | ||
| 665 | - totalKilometers += childTaskPlan.getMileage()==null?0.0:childTaskPlan.getMileage(); | ||
| 666 | - if(childTaskPlan.getMileageType().equals("empty")){ | ||
| 667 | - emptyKilometers += childTaskPlan.getMileage()==null?0.0:childTaskPlan.getMileage();; | ||
| 668 | - } | ||
| 669 | - } | ||
| 670 | - } | ||
| 671 | - } | ||
| 672 | - } | ||
| 673 | - } | ||
| 674 | - } | ||
| 675 | - sf.append("<ZLC>"+totalKilometers+"</ZLC>"); | ||
| 676 | - sf.append("<YYLC>"+emptyKilometers+"</YYLC>"); | ||
| 677 | - sf.append("<YH>"+""+"</YH>"); | ||
| 678 | - sf.append("<JZYL>"+""+"</JZYL>"); | ||
| 679 | - sf.append("<DH>"+""+"</DH>"); | ||
| 680 | - sf.append("<UPDT>"+sdfnyrsfm.format(new Date())+"</UPDT>"); | ||
| 681 | - sf.append("<BBSCBZ>"+0+"</BBSCBZ>"); | ||
| 682 | - sf.append("</LCYH>"); | ||
| 683 | - } | ||
| 684 | - } | ||
| 685 | - sf.append("</LCYHS>"); | ||
| 686 | - if(ssop.setLCYH(userNameOther, passwordOther, sf.toString()).isSuccess()){ | ||
| 687 | - result = "success"; | ||
| 688 | - } | ||
| 689 | - } catch (Exception e) { | ||
| 690 | - logger.error("setLCYH:",e); | ||
| 691 | - e.printStackTrace(); | ||
| 692 | - }finally{ | ||
| 693 | - logger.info("setLCYH:"+sf.toString()); | ||
| 694 | - logger.info("setLCYH:"+result); | ||
| 695 | - } | ||
| 696 | - return result; | ||
| 697 | - } | ||
| 698 | - | ||
| 699 | - /** | ||
| 700 | - * 上传线路调度日报 | ||
| 701 | - * @return | ||
| 702 | - */ | ||
| 703 | - public String setDDRB(){ | ||
| 704 | - String result = "failure"; | ||
| 705 | - // 取昨天 的日期 | ||
| 706 | - String date = sdfnyr.format(DateUtils.addDays(new Date(), -1)); | ||
| 707 | - StringBuffer sf = new StringBuffer(); | ||
| 708 | - try { | ||
| 709 | - sf.append("<DDRBS>"); | ||
| 710 | - List<Map<String,Object>> listGroup = scheduleRealInfoRepository.setDDRBGroup(date); | ||
| 711 | - List<ScheduleRealInfo> list = scheduleRealInfoRepository.findByDate(date); | ||
| 712 | - for(Map<String,Object> schRealInfo:listGroup){ | ||
| 713 | - if(schRealInfo != null){ | ||
| 714 | - double jhlc = 0,zlc = 0,jhkslc = 0,sjkslc = 0; | ||
| 715 | - int jhbc = 0,sjbc = 0,jhzgfbc = 0,sjzgfbc = 0,jhwgfbc = 0,sjwgfbc = 0; | ||
| 716 | - sf.append("<DDRB>"); | ||
| 717 | - sf.append("<RQ>"+date+"</RQ>"); | ||
| 718 | - sf.append("<XLBM>"+BasicData.lineCode2ShangHaiCodeMap.get(schRealInfo.get("xlBm"))+"</XLBM>"); | ||
| 719 | - for(ScheduleRealInfo scheduleRealInfo:list){ | ||
| 720 | - if(scheduleRealInfo != null){ | ||
| 721 | - if((schRealInfo.get("xlBm")+"").equals(scheduleRealInfo.getXlBm())){ | ||
| 722 | - //计划 | ||
| 723 | - if(!scheduleRealInfo.isSflj()){ | ||
| 724 | - jhlc += scheduleRealInfo.getJhlc()==null?0.0:scheduleRealInfo.getJhlc(); | ||
| 725 | - //计划空驶 | ||
| 726 | - if(scheduleRealInfo.getBcType().equals("in") || scheduleRealInfo.getBcType().equals("out")){ | ||
| 727 | - jhkslc += scheduleRealInfo.getJhlc()==null?0.0:scheduleRealInfo.getJhlc(); | ||
| 728 | - } | ||
| 729 | - //计划早高峰,计划晚高峰 | ||
| 730 | - if(TimeUtils.morningPeak(scheduleRealInfo.getFcsj())){ | ||
| 731 | - jhzgfbc++; | ||
| 732 | - } else if(TimeUtils.evenignPeak(scheduleRealInfo.getFcsj())){ | ||
| 733 | - jhwgfbc++; | ||
| 734 | - } | ||
| 735 | - } | ||
| 736 | - jhbc++; | ||
| 737 | - | ||
| 738 | - //实际 | ||
| 739 | - Set<ChildTaskPlan> childTaskPlans = scheduleRealInfo.getcTasks(); | ||
| 740 | - //如果没有子任务,里程就是已执行(Status=2);有子任务的,忽略主任务,子任务的烂班 | ||
| 741 | - if(childTaskPlans.isEmpty()){ | ||
| 742 | - if(scheduleRealInfo.getStatus() == 2){ | ||
| 743 | - sjbc++; | ||
| 744 | - zlc += scheduleRealInfo.getJhlc()==null?0.0:scheduleRealInfo.getJhlc(); | ||
| 745 | - if(scheduleRealInfo.getBcType().equals("in") || scheduleRealInfo.getBcType().equals("out") | ||
| 746 | - || scheduleRealInfo.getBcType().equals("venting")){ | ||
| 747 | - sjkslc += scheduleRealInfo.getJhlc()==null?0.0:scheduleRealInfo.getJhlc();; | ||
| 748 | - } | ||
| 749 | - } | ||
| 750 | - }else{ | ||
| 751 | - sjbc++; | ||
| 752 | - Iterator<ChildTaskPlan> it = childTaskPlans.iterator(); | ||
| 753 | - while(it.hasNext()){ | ||
| 754 | - ChildTaskPlan childTaskPlan = it.next(); | ||
| 755 | - if(!childTaskPlan.isDestroy()){ | ||
| 756 | - zlc += childTaskPlan.getMileage()==null?0.0:childTaskPlan.getMileage(); | ||
| 757 | - if(childTaskPlan.getMileageType().equals("empty")){ | ||
| 758 | - sjkslc += childTaskPlan.getMileage()==null?0.0:childTaskPlan.getMileage();; | ||
| 759 | - } | ||
| 760 | - } | ||
| 761 | - } | ||
| 762 | - } | ||
| 763 | - //实际早高峰,计划晚高峰 | ||
| 764 | - if(scheduleRealInfo.getFcsjActual() != null){ | ||
| 765 | - if(TimeUtils.morningPeak(scheduleRealInfo.getFcsj())){ | ||
| 766 | - sjzgfbc++; | ||
| 767 | - } else if(TimeUtils.evenignPeak(scheduleRealInfo.getFcsj())){ | ||
| 768 | - sjwgfbc++; | ||
| 769 | - } | ||
| 770 | - } | ||
| 771 | - } | ||
| 772 | - } | ||
| 773 | - } | ||
| 774 | - sf.append("<JHLC>"+format.format(jhlc)+"</JHLC>"); | ||
| 775 | - sf.append("<SSLC>"+format.format((zlc-sjkslc))+"</SSLC>"); | ||
| 776 | - sf.append("<JHKSLC>"+format.format(jhkslc)+"</JHKSLC>"); | ||
| 777 | - sf.append("<SJKSLC>"+format.format(sjkslc)+"</SJKSLC>"); | ||
| 778 | - sf.append("<JHBC>"+jhbc+"</JHBC>"); | ||
| 779 | - sf.append("<SJBC>"+sjbc+"</SJBC>"); | ||
| 780 | - sf.append("<JHZGFBC>"+jhzgfbc+"</JHZGFBC>"); | ||
| 781 | - sf.append("<SJZGFBC>"+sjzgfbc+"</SJZGFBC>"); | ||
| 782 | - sf.append("<JHWGFBC>"+jhwgfbc+"</JHWGFBC>"); | ||
| 783 | - sf.append("<SJWGFBC>"+sjwgfbc+"</SJWGFBC>"); | ||
| 784 | - sf.append("<UPDT>"+sdfnyrsfm.format(new Date())+"</UPDT>"); | ||
| 785 | - sf.append("<RBSCBZ>"+0+"</RBSCBZ>"); | ||
| 786 | - sf.append("</DDRB>"); | ||
| 787 | - } | ||
| 788 | - } | ||
| 789 | - sf.append("</DDRBS>"); | ||
| 790 | - if(ssop.setDDRB(userNameOther, passwordOther, sf.toString()).isSuccess()){ | ||
| 791 | - result = "success"; | ||
| 792 | - } | ||
| 793 | - } catch (Exception e) { | ||
| 794 | - logger.error("setDDRB:",e); | ||
| 795 | - e.printStackTrace(); | ||
| 796 | - }finally{ | ||
| 797 | - logger.info("setDDRB:"+sf.toString()); | ||
| 798 | - logger.info("setDDRB:"+result); | ||
| 799 | - } | ||
| 800 | - return result; | ||
| 801 | - } | ||
| 802 | - | ||
| 803 | - /** | ||
| 804 | - * 上传计划班次 指定日期 yyyy-MM-dd | ||
| 805 | - * @param theDate | ||
| 806 | - * @return | ||
| 807 | - */ | ||
| 808 | - public String setJHBC(String theDate){ | ||
| 809 | - return uploadJHBC(theDate); | ||
| 810 | - } | ||
| 811 | - | ||
| 812 | - /** | ||
| 813 | - * 上传计划班次 | ||
| 814 | - * @return | ||
| 815 | - */ | ||
| 816 | - public String setJHBC(){ | ||
| 817 | - return uploadJHBC(null); | ||
| 818 | - } | ||
| 819 | - /** | ||
| 820 | - * 上传线路计划班次表 | ||
| 821 | - */ | ||
| 822 | - | ||
| 823 | - private String uploadJHBC(String theDate) { | ||
| 824 | - String result = "failure"; | ||
| 825 | - Line line; | ||
| 826 | - StringBuffer sBuffer =new StringBuffer(); | ||
| 827 | - try { | ||
| 828 | - sBuffer.append("<JHBCs>"); | ||
| 829 | - // 声明变量 | ||
| 830 | - SchedulePlanInfo schedulePlanInfo; | ||
| 831 | - String xlbm,zbh = ""; | ||
| 832 | - Long lp = 0L; | ||
| 833 | - // 取得计划班次时间 | ||
| 834 | - String tomorrow = theDate == null ? sdfnyr.format(DateUtils.addDays(new Date(), +1)) : theDate; | ||
| 835 | - // 查询所有班次 | ||
| 836 | - List<SchedulePlanInfo> schedulePlanList = schedulePlanInfoRepository.findLineScheduleBc(tomorrow); | ||
| 837 | - int j = 0; // 初始化标识 | ||
| 838 | - if(schedulePlanList != null ){ | ||
| 839 | - HashMap<String,String> paramMap; | ||
| 840 | - HashMap<String,String> otherMap = new HashMap<String, String>(); | ||
| 841 | - int size = schedulePlanList.size(); | ||
| 842 | - for (int i = 0; i < size; i++) { | ||
| 843 | - schedulePlanInfo = schedulePlanList.get(i); | ||
| 844 | - xlbm = schedulePlanInfo.getXlBm(); | ||
| 845 | - // 获取线路是否使用标识,如果未使用,则不查该线路数据 | ||
| 846 | - line = lineRepository.findByLineCode(xlbm); | ||
| 847 | - if(line.getInUse() == null || line.getInUse() == 0){ | ||
| 848 | - continue; | ||
| 849 | - } | ||
| 850 | - if(++j == 1){// 第一次,则初始化值 | ||
| 851 | - zbh = schedulePlanInfo.getClZbh(); | ||
| 852 | - lp = schedulePlanInfo.getLp(); | ||
| 853 | - // 拼装XML | ||
| 854 | - assembleJHBC(sBuffer, schedulePlanInfo, xlbm, zbh, lp); | ||
| 855 | - } | ||
| 856 | - // 比较是否为同一条线路同一辆车 | ||
| 857 | - if(xlbm.equals(schedulePlanInfo.getXlBm()) | ||
| 858 | - && zbh.equals(schedulePlanInfo.getClZbh()) | ||
| 859 | - && lp == schedulePlanInfo.getLp()){ | ||
| 860 | - if(schedulePlanInfo.getBcType().equals("in") || schedulePlanInfo.getBcType().equals("out")){ | ||
| 861 | - continue; | ||
| 862 | - } | ||
| 863 | - sBuffer.append("<BC>"); | ||
| 864 | - sBuffer.append("<SJGH>").append(schedulePlanInfo.getjGh()).append("</SJGH>"); | ||
| 865 | - sBuffer.append("<SXX>").append(schedulePlanInfo.getXlDir()).append("</SXX>"); | ||
| 866 | - sBuffer.append("<FCZDMC>").append(schedulePlanInfo.getQdzName()).append("</FCZDMC>"); | ||
| 867 | - // 起点站的参数 | ||
| 868 | - otherMap.put("stationMark","B"); | ||
| 869 | - paramMap = packageYgcStationNumParam(schedulePlanInfo,otherMap); | ||
| 870 | - sBuffer.append("<ZDXH>").append(getYgcStationNumByLineCodeAndDirectionAndStationName(paramMap,null)).append("</ZDXH>"); | ||
| 871 | - sBuffer.append("<JHFCSJ>").append(schedulePlanInfo.getFcsj()).append("</JHFCSJ>"); | ||
| 872 | - sBuffer.append("<DDZDMC>").append(schedulePlanInfo.getZdzName()).append("</DDZDMC>"); | ||
| 873 | - // 起点站的参数 | ||
| 874 | - otherMap.put("stationMark","E"); | ||
| 875 | - paramMap = packageYgcStationNumParam(schedulePlanInfo,otherMap); | ||
| 876 | - sBuffer.append("<DDXH>").append(getYgcStationNumByLineCodeAndDirectionAndStationName(paramMap,null)).append("</DDXH>"); | ||
| 877 | - sBuffer.append("<JHDDSJ>").append(calcDdsj(schedulePlanInfo.getFcsj(),schedulePlanInfo.getBcsj())) | ||
| 878 | - .append("</JHDDSJ>"); | ||
| 879 | - sBuffer.append("</BC>"); | ||
| 880 | - if(i == size -1 ){ | ||
| 881 | - sBuffer.append("</BCList>"); | ||
| 882 | - sBuffer.append("</JHBC>"); | ||
| 883 | - } | ||
| 884 | - }else{ | ||
| 885 | - zbh = schedulePlanInfo.getClZbh(); | ||
| 886 | - lp = schedulePlanInfo.getLp(); | ||
| 887 | - sBuffer.append("</BCList>"); | ||
| 888 | - sBuffer.append("</JHBC>"); | ||
| 889 | - // 拼装XML | ||
| 890 | - assembleJHBC(sBuffer, schedulePlanInfo, xlbm, zbh, lp); | ||
| 891 | - } | ||
| 892 | - } | ||
| 893 | - } | ||
| 894 | - // 判断XML是否以</BCList>结尾,如果不是,则加上 | ||
| 895 | - String regex = "^*</JHBC>$"; | ||
| 896 | - Pattern p = Pattern.compile(regex); | ||
| 897 | - Matcher m = p.matcher(sBuffer); | ||
| 898 | - boolean isEndWithTrueFlag = false; | ||
| 899 | - while (m.find()) { | ||
| 900 | - isEndWithTrueFlag = true; | ||
| 901 | - } | ||
| 902 | - // 加上缺失的标签 | ||
| 903 | - if(!isEndWithTrueFlag){ | ||
| 904 | - sBuffer.append("</BCList>"); | ||
| 905 | - sBuffer.append("</JHBC>"); | ||
| 906 | - } | ||
| 907 | - sBuffer.append("</JHBCs>"); | ||
| 908 | - if(ssop.setJHBC(userNameOther, passwordOther, sBuffer.toString()).isSuccess()){ | ||
| 909 | - result = "success"; | ||
| 910 | - } | ||
| 911 | - } catch (Exception e) { | ||
| 912 | - logger.error("setJHBC:",e); | ||
| 913 | - e.printStackTrace(); | ||
| 914 | - }finally{ | ||
| 915 | - logger.info("setJHBC:"+sBuffer.toString()); | ||
| 916 | - logger.info("setJHBC:"+result); | ||
| 917 | - } | ||
| 918 | - return result; | ||
| 919 | - } | ||
| 920 | - | ||
| 921 | - /** | ||
| 922 | - * 上传线路班次时刻表数据 | ||
| 923 | - */ | ||
| 924 | - @Override | ||
| 925 | - public String setSKB(String ids) { | ||
| 926 | - String result = "上传失败,"; | ||
| 927 | - StringBuffer sBuffer = new StringBuffer("<SKBs>"); | ||
| 928 | - DecimalFormat df = new DecimalFormat("######0.000"); | ||
| 929 | - Map<String,String> lsStationCode2NameMap = null; | ||
| 930 | - Map<String, Integer> lsStationName2YgcNumber = null; | ||
| 931 | - try { | ||
| 932 | - String[] idArray = ids.split(","); | ||
| 933 | - StringBuffer sBufferA ,sBufferB ,sBufferC ; | ||
| 934 | - double zlc,yylc,singleLc,emptyLc;// 总里程、营运里程、单程、空放里程 | ||
| 935 | - String bcType,sxx;// 班次类型、上下行 | ||
| 936 | - // 上传的时刻表集合 | ||
| 937 | - List<TTInfo> ttinfoList = new ArrayList<>(); | ||
| 938 | - TTInfo ttInfo; | ||
| 939 | - TTInfoDetail ttInfoDetail; | ||
| 940 | - LineInformation lineInformation; | ||
| 941 | - Iterator<TTInfoDetail> ttInfoDetailIterator; | ||
| 942 | - HashMap<String,Object> param ; | ||
| 943 | - HashMap<String,String> paramMap; | ||
| 944 | - HashMap<String,String> otherMap = new HashMap<>(); | ||
| 945 | - // 线路编码、周几执行、发车站点名称、发车站点序号、到达站点名称、到达站点序号 | ||
| 946 | - String xlbm,zjzx,fczdmc,zdxh,ddzdmc,ddxh; | ||
| 947 | - // 得到时刻表版本号 | ||
| 948 | - int lineVersion; | ||
| 949 | - long ttinfoId; | ||
| 950 | - // 是否输出站点信息 | ||
| 951 | - boolean isLogStation; | ||
| 952 | - for (int i = 0; i < idArray.length; i++) { | ||
| 953 | - ttinfoId = Long.valueOf(idArray[i]); | ||
| 954 | - Optional<TTInfo> optionalTTInfo = ttInfoRepository.findById(ttinfoId); | ||
| 955 | - ttInfo = optionalTTInfo.isPresent() ? optionalTTInfo.get() : null; | ||
| 956 | - if(ttInfo == null) | ||
| 957 | - continue; | ||
| 958 | - ttinfoList.add(ttInfo); // 保存时刻表 | ||
| 959 | - // 得到时刻表版本号 | ||
| 960 | - lineVersion = ttInfo.getLineVersion(); | ||
| 961 | - // 查询历史站点路由 | ||
| 962 | - lsStationCode2NameMap = getLsStationCode(ttInfo.getXl().getLineCode(),lineVersion); | ||
| 963 | - // 查询历史站点路由 | ||
| 964 | - lsStationName2YgcNumber = getLsStationRoute(ttInfo.getXl().getLineCode(),lineVersion); | ||
| 965 | - zlc = 0.0f; | ||
| 966 | - yylc = 0.0f; | ||
| 967 | - // 获得时刻表 | ||
| 968 | - param = new HashMap(); | ||
| 969 | - param.put("ttinfo.id_eq", ttInfo.getId()); | ||
| 970 | - ttInfoDetailIterator = ttInfoDetailRepository.findAll(new CustomerSpecs<TTInfoDetail>(param), | ||
| 971 | - new Sort(Direction.ASC, "xlDir")).iterator(); | ||
| 972 | - // 获得lineInformation | ||
| 973 | - param = new HashMap(); | ||
| 974 | - param.put("line.id_eq", ttInfo.getXl().getId()); | ||
| 975 | - Optional<LineInformation> optionalLineInformation = lineInformationRepository.findOne(new CustomerSpecs<LineInformation>(param)); | ||
| 976 | - lineInformation = optionalLineInformation.isPresent() ? optionalLineInformation.get() : null; | ||
| 977 | - // 初始化 | ||
| 978 | - isLogStation = true; | ||
| 979 | - if(ttInfoDetailIterator.hasNext()){ | ||
| 980 | - // 得到线路信息 | ||
| 981 | - Optional<Line> optionalLine = lineRepository.findById(ttInfo.getXl().getId()); | ||
| 982 | - Line line = optionalLine.isPresent() ? optionalLine.get() : null; | ||
| 983 | - if(line == null){ | ||
| 984 | - result += "未找到相应的线路信息,请设置线路信息后再上传"; | ||
| 985 | - return result; | ||
| 986 | - } | ||
| 987 | - // 得到上海市线路编码 | ||
| 988 | - xlbm = line.getShanghaiLinecode(); | ||
| 989 | - if("".equals(xlbm) || "null".equals(xlbm)){ | ||
| 990 | - result += "线路编码为空,请设置线路编码后再上传"; | ||
| 991 | - return result; | ||
| 992 | - } | ||
| 993 | - // 拿到周几执行 | ||
| 994 | - zjzx = changeRuleDay(ttInfo.getRule_days()); | ||
| 995 | - if("".equals(zjzx) || "null".equals(zjzx)){ | ||
| 996 | - result += "时刻表执行时间为空,请设置执行时间后再上传"; | ||
| 997 | - return result; | ||
| 998 | - } | ||
| 999 | - sBuffer.append("<SKB>"); | ||
| 1000 | - sBuffer.append("<XLBM>").append(xlbm).append("</XLBM>"); | ||
| 1001 | - sBufferB = new StringBuffer(); | ||
| 1002 | - sBufferC = new StringBuffer(); | ||
| 1003 | - sBufferB.append("<KSRQ>").append(sdfnyr.format(ttInfo.getQyrq())).append("</KSRQ>"); | ||
| 1004 | - // 结束日期暂时不要,节假日的班次表才需要,如春节的班次表 | ||
| 1005 | - sBufferB.append("<JSRQ>").append("").append("</JSRQ>"); | ||
| 1006 | - sBufferB.append("<ZJZX>").append(zjzx).append("</ZJZX>"); | ||
| 1007 | - sBufferB.append("<TBYY>").append("").append("</TBYY>"); | ||
| 1008 | - sBufferB.append("<UPDT>").append(sdfnyrsfm.format(new Date())).append("</UPDT>"); | ||
| 1009 | - sBufferB.append("<BCList>"); | ||
| 1010 | - while (ttInfoDetailIterator.hasNext()) { | ||
| 1011 | - ttInfoDetail = ttInfoDetailIterator.next(); | ||
| 1012 | - bcType = ttInfoDetail.getBcType(); | ||
| 1013 | - sxx = ttInfoDetail.getXlDir(); | ||
| 1014 | - // 进出场班次的里程,加入总里程 | ||
| 1015 | - if(bcType.equals("in") || bcType.equals("out")){ | ||
| 1016 | - // 进出班次的计划里程,算空驶里程 | ||
| 1017 | - emptyLc = ttInfoDetail.getJhlc(); | ||
| 1018 | - // 总里程需要加上空驶里程 | ||
| 1019 | - zlc += emptyLc; | ||
| 1020 | - continue; | ||
| 1021 | - } | ||
| 1022 | - // 不是正常班次,不传到运管处 | ||
| 1023 | - if(!bcType.equals("normal")){ | ||
| 1024 | - continue; | ||
| 1025 | - } | ||
| 1026 | - // 如果发车时间格式错误,忽略此条 | ||
| 1027 | - if(changeTimeFormat(ttInfoDetail) == null){ | ||
| 1028 | - continue; | ||
| 1029 | - } | ||
| 1030 | - // 发生站点名称 | ||
| 1031 | - fczdmc = lsStationCode2NameMap.get(ttInfoDetail.getXl().getLineCode()+"_"+ttInfoDetail.getXlDir()+"_"+ttInfoDetail.getQdzCode()); | ||
| 1032 | - if("".equals(fczdmc) || "null".equals(fczdmc)){ | ||
| 1033 | - result += "发车站点名称为空,请根据时刻表当前的版本号设置好历史站点路由再上传"; | ||
| 1034 | - return result; | ||
| 1035 | - } | ||
| 1036 | - sBufferC.append("<BC>"); | ||
| 1037 | - sBufferC.append("<LPBH>").append(ttInfoDetail.getLp().getLpNo()).append("</LPBH>"); | ||
| 1038 | - sBufferC.append("<SXX>").append(sxx).append("</SXX>"); | ||
| 1039 | - sBufferC.append("<FCZDMC>").append(fczdmc).append("</FCZDMC>"); | ||
| 1040 | - // 起点站的参数 | ||
| 1041 | - otherMap.put("stationMark","B"); | ||
| 1042 | - paramMap = packageYgcStationNumParam(ttInfoDetail,otherMap); | ||
| 1043 | - if(isLogStation){// 输出起点站信息 | ||
| 1044 | - logger.info("setSKB:"+"起点站信息:"+paramMap); | ||
| 1045 | - } | ||
| 1046 | - // 发车站点序号 | ||
| 1047 | - zdxh = String.valueOf(getYgcStationNumByLineCodeAndDirectionAndStationName(paramMap,lsStationName2YgcNumber)); | ||
| 1048 | - if("".equals(zdxh) || "null".equals(zdxh) || "0".equals(zdxh)){ | ||
| 1049 | - result += "发车站点序号为空,请根据时刻表当前的版本号设置好历史站点路由再上传"; | ||
| 1050 | - return result; | ||
| 1051 | - } | ||
| 1052 | - // 到达站点名称 | ||
| 1053 | - ddzdmc = lsStationCode2NameMap.get(ttInfoDetail.getXl().getLineCode()+"_"+ttInfoDetail.getXlDir()+"_"+ttInfoDetail.getZdzCode()); | ||
| 1054 | - if("".equals(ddzdmc) || "null".equals(ddzdmc)){ | ||
| 1055 | - result += "到达站点名称为空,请根据时刻表当前的版本号设置好历史站点路由再上传"; | ||
| 1056 | - return result; | ||
| 1057 | - } | ||
| 1058 | - sBufferC.append("<ZDXH>").append(zdxh).append("</ZDXH>"); | ||
| 1059 | - sBufferC.append("<JHFCSJ>").append(changeTimeFormat(ttInfoDetail)).append("</JHFCSJ>"); | ||
| 1060 | - sBufferC.append("<DDZDMC>").append(ddzdmc).append("</DDZDMC>"); | ||
| 1061 | - // 终点站的参数 | ||
| 1062 | - otherMap.put("stationMark","E"); | ||
| 1063 | - paramMap = packageYgcStationNumParam(ttInfoDetail,otherMap); | ||
| 1064 | - if(isLogStation){// 输出终点站信息 | ||
| 1065 | - logger.info("setSKB:"+"终点站信息:"+paramMap); | ||
| 1066 | - } | ||
| 1067 | - // 到达站点序号 | ||
| 1068 | - ddxh = String.valueOf(getYgcStationNumByLineCodeAndDirectionAndStationName(paramMap,lsStationName2YgcNumber)); | ||
| 1069 | - if("".equals(ddxh) || "null".equals(ddxh) || "0".equals(ddxh)){ | ||
| 1070 | - result += "到达站点序号为空,请根据时刻表当前的版本号设置好历史站点路由再上传"; | ||
| 1071 | - return result; | ||
| 1072 | - } | ||
| 1073 | - isLogStation = false; // 一条线路只输出一次,后面的不输出了 | ||
| 1074 | - sBufferC.append("<DDXH>").append(ddxh).append("</DDXH>"); | ||
| 1075 | - sBufferC.append("<JHDDSJ>").append(calcDdsj(ttInfoDetail.getFcsj(),ttInfoDetail.getBcsj())).append("</JHDDSJ>"); | ||
| 1076 | - sBufferC.append("</BC>"); | ||
| 1077 | - // 0:上行;1:下行 | ||
| 1078 | - if("0".equals(sxx)){ | ||
| 1079 | - singleLc = lineInformation.getUpMileage(); | ||
| 1080 | - }else{ | ||
| 1081 | - singleLc = lineInformation.getDownMileage(); | ||
| 1082 | - } | ||
| 1083 | - zlc += singleLc ; | ||
| 1084 | - yylc += singleLc; | ||
| 1085 | - } | ||
| 1086 | - sBufferC.append("</BCList>"); | ||
| 1087 | - sBufferC.append("</SKB>"); | ||
| 1088 | - sBufferA = new StringBuffer(); | ||
| 1089 | - sBufferA.append("<JHZLC>").append(df.format(zlc)).append("</JHZLC>"); | ||
| 1090 | - sBufferA.append("<JHYYLC>").append(df.format(yylc)).append("</JHYYLC>"); | ||
| 1091 | - sBuffer.append(sBufferA).append(sBufferB).append(sBufferC); | ||
| 1092 | - } | ||
| 1093 | - logger.info("setSKB:"+"ttinfoId:"+ttinfoId+";当前站点版本号:"+lineVersion+";查询历史站点路由:"+lsStationCode2NameMap+";查询历史站点编号:"+lsStationName2YgcNumber); | ||
| 1094 | - } | ||
| 1095 | - sBuffer.append("</SKBs>"); | ||
| 1096 | - String state;// 是否上传成功 | ||
| 1097 | - if(ssop.setSKB(userNameOther, passwordOther, sBuffer.toString()).isSuccess()){ | ||
| 1098 | - result = "上传成功"; | ||
| 1099 | - state = "1"; | ||
| 1100 | - }else{// 上传失败 | ||
| 1101 | - result = "上传失败"; | ||
| 1102 | - state = "0"; | ||
| 1103 | - } | ||
| 1104 | - // 保存运管处上传记录 | ||
| 1105 | - saveYgcUploadLog(ttinfoList,sBuffer.toString(),TrafficManageServiceImpl.UPLOAD_TYPE_SKB,state); | ||
| 1106 | - } catch (Exception e) { | ||
| 1107 | - logger.error("setSKB:", e); | ||
| 1108 | - e.printStackTrace(); | ||
| 1109 | - }finally{ | ||
| 1110 | - logger.info("setSKB:"+sBuffer.toString()); | ||
| 1111 | - logger.info("setSKB:"+result); | ||
| 1112 | - } | ||
| 1113 | - return result; | ||
| 1114 | - } | ||
| 1115 | - | ||
| 1116 | - /** | ||
| 1117 | - * 保存上传运管处的日志 | ||
| 1118 | - * @param obj 参数 | ||
| 1119 | - * @param type 日志类型 | ||
| 1120 | - * @param xml 上传参数 | ||
| 1121 | - */ | ||
| 1122 | - private void saveYgcUploadLog(Object obj,String xml,String type,String state){ | ||
| 1123 | - SKBUploadLogger skbUploadLogger = new SKBUploadLogger(); | ||
| 1124 | - SysUser user; | ||
| 1125 | - // 如果不是人为上传,SysUser则为空,设置上传人员为管理员 | ||
| 1126 | - if(SecurityContextHolder.getContext() == null || SecurityContextHolder.getContext().getAuthentication() == null){ | ||
| 1127 | - user = new SysUser(); | ||
| 1128 | - user.setId(1); | ||
| 1129 | - }else{// 获取上传人员 | ||
| 1130 | - user = SecurityUtils.getCurrentUser(); | ||
| 1131 | - } | ||
| 1132 | - // 最大的字符长度 | ||
| 1133 | - int maxLength = 60000; | ||
| 1134 | - int cutLength = 50000;// 需要截取的字符长度 | ||
| 1135 | - String xml_sub = null; | ||
| 1136 | - skbUploadLogger.setType(type);// 设置类型 | ||
| 1137 | - // 判断xml是否超长,如果超长,则截取 | ||
| 1138 | - if(xml != null && xml.length() > maxLength){ | ||
| 1139 | - int xmlLength = xml.length(); | ||
| 1140 | - int cutCount = xmlLength / cutLength + (xmlLength % cutLength > 0 ? 1 : 0); | ||
| 1141 | - if(cutCount > 2){ | ||
| 1142 | - xml = "由于上传参数内容超长,请查看服务器的系统日志"; | ||
| 1143 | - }else if(cutCount == 2){ | ||
| 1144 | - xml_sub =xml.substring(cutLength); | ||
| 1145 | - xml = xml.substring(0,cutLength); | ||
| 1146 | - }else{ | ||
| 1147 | - // 不做处理 | ||
| 1148 | - } | ||
| 1149 | - } | ||
| 1150 | -// skbUploadLogger.setUploadXml(xml);// 上传的参数 | ||
| 1151 | -// skbUploadLogger.setUploadXmlSub(xml_sub); | ||
| 1152 | - skbUploadLogger.setState(state);// 状态:是否成功 | ||
| 1153 | - skbUploadLogger.setUser(user); | ||
| 1154 | - // 时刻表 | ||
| 1155 | - if(type.equals(TrafficManageServiceImpl.UPLOAD_TYPE_SKB)){ | ||
| 1156 | - List<TTInfo> ttInfoList = (List<TTInfo>)obj; | ||
| 1157 | - String name = ""; | ||
| 1158 | - Line line = null; | ||
| 1159 | - for(TTInfo ttInfo : ttInfoList){ | ||
| 1160 | - name += ttInfo.getName() + " "; | ||
| 1161 | - line = ttInfo.getXl(); | ||
| 1162 | - } | ||
| 1163 | - skbUploadLogger.setLine(line); | ||
| 1164 | - skbUploadLogger.setUser(user); | ||
| 1165 | - skbUploadLogger.setName(name); | ||
| 1166 | - skbUploadLoggerRepository.save(skbUploadLogger); | ||
| 1167 | - }else{ | ||
| 1168 | - if(type.equals(TrafficManageServiceImpl.UPLOAD_TYPE_XL)){ | ||
| 1169 | - Line line = (Line) obj; | ||
| 1170 | - String name = line.getName() + "线路停靠站上传"; | ||
| 1171 | - skbUploadLogger.setLine(line); | ||
| 1172 | - skbUploadLogger.setName(name); | ||
| 1173 | - skbUploadLoggerRepository.save(skbUploadLogger); | ||
| 1174 | - }else if(type.equals(TrafficManageServiceImpl.UPLOAD_TYPE_LD)){ | ||
| 1175 | - Map<String ,Line> logLineMap = (Map<String ,Line> )obj; | ||
| 1176 | - for (String key : logLineMap.keySet()) { | ||
| 1177 | - Line line = logLineMap.get(key); | ||
| 1178 | - String name = line.getName() + "路单上传"; | ||
| 1179 | - skbUploadLogger = new SKBUploadLogger(); | ||
| 1180 | - skbUploadLogger.setType(type);// 设置类型 | ||
| 1181 | -// skbUploadLogger.setUploadXml(xml);// 上传的参数 | ||
| 1182 | -// skbUploadLogger.setUploadXmlSub(xml_sub); | ||
| 1183 | - skbUploadLogger.setState(state);// 状态:是否成功 | ||
| 1184 | - skbUploadLogger.setUser(user); | ||
| 1185 | - skbUploadLogger.setLine(line); | ||
| 1186 | - skbUploadLogger.setName(name); | ||
| 1187 | -// skbUploadLoggerRepository.save(skbUploadLogger); | ||
| 1188 | - } | ||
| 1189 | - } | ||
| 1190 | - } | ||
| 1191 | - } | ||
| 1192 | - /** | ||
| 1193 | - * 上传线路人员车辆配置信息 | ||
| 1194 | - */ | ||
| 1195 | - @Override | ||
| 1196 | - public String setXLPC() { | ||
| 1197 | - String result = "failure"; | ||
| 1198 | - StringBuffer sBuffer =new StringBuffer(); | ||
| 1199 | - try { | ||
| 1200 | - sBuffer.append("<XLPCs>"); | ||
| 1201 | - // 声明变量 | ||
| 1202 | - Line line = null; | ||
| 1203 | - Cars cars = null; | ||
| 1204 | - List<Personnel> personnelList = null; | ||
| 1205 | - List<Cars> carsList = null; | ||
| 1206 | - int totalPersonnel,totalCar ;// 人员数量。车辆数量 | ||
| 1207 | - // 查询所有线路 | ||
| 1208 | - Iterator<Line> lineIterator = lineRepository.findAll().iterator(); | ||
| 1209 | - // 循环查找线路下的信息 | ||
| 1210 | - while(lineIterator.hasNext()){ | ||
| 1211 | - line = lineIterator.next(); | ||
| 1212 | - sBuffer.append("<XLPC>"); | ||
| 1213 | - sBuffer.append("<XLBM>").append(BasicData.lineId2ShangHaiCodeMap.get(line.getId())).append("</XLBM>"); | ||
| 1214 | - // 查询驾驶员数量 | ||
| 1215 | - personnelList = personnelRepository.findJsysByLineId(line.getId()); | ||
| 1216 | - totalPersonnel = personnelList != null ? personnelList.size():0; | ||
| 1217 | - sBuffer.append("<SJRS>").append(totalPersonnel).append("</SJRS>"); | ||
| 1218 | - // 查询售票员人员数量 | ||
| 1219 | - personnelList = personnelRepository.findSpysByLineId(line.getId()); | ||
| 1220 | - totalPersonnel = personnelList != null ? personnelList.size():0; | ||
| 1221 | - sBuffer.append("<SPYRS>").append(totalPersonnel).append("</SPYRS>"); | ||
| 1222 | - // 查询车辆 | ||
| 1223 | - carsList = carsRepository.findCarsByLineId(line.getId()); | ||
| 1224 | - totalCar = carsList != null ? carsList.size():0; | ||
| 1225 | - sBuffer.append("<PCSL>").append(totalCar).append("</PCSL>"); | ||
| 1226 | - sBuffer.append("<UPDT>").append(sdfnyrsfm.format(new Date())).append("</UPDT>"); | ||
| 1227 | - int carsNum = 0; | ||
| 1228 | - // 取车牌号 | ||
| 1229 | - if(carsList != null){ | ||
| 1230 | - carsNum = carsList.size(); | ||
| 1231 | - sBuffer.append("<CPHList>"); | ||
| 1232 | - for (int i = 0; i < carsNum; i++) { | ||
| 1233 | - cars = carsList.get(i); | ||
| 1234 | - sBuffer.append("<CPH>").append("沪").append(cars.getCarCode()).append("</CPH>"); | ||
| 1235 | - } | ||
| 1236 | - sBuffer.append("</CPHList>"); | ||
| 1237 | - } | ||
| 1238 | - sBuffer.append("</XLPC>"); | ||
| 1239 | - } | ||
| 1240 | - sBuffer.append("</XLPCs>"); | ||
| 1241 | - if(ssop.setXLPC(userNameOther, passwordOther, sBuffer.toString()).isSuccess()){ | ||
| 1242 | - result = "success"; | ||
| 1243 | - } | ||
| 1244 | - } catch (Exception e) { | ||
| 1245 | - logger.error("setXLPC:",e); | ||
| 1246 | - e.printStackTrace(); | ||
| 1247 | - }finally{ | ||
| 1248 | - logger.info("setXLPC:"+sBuffer.toString()); | ||
| 1249 | - logger.info("setXLPC:"+result); | ||
| 1250 | - } | ||
| 1251 | - return result; | ||
| 1252 | - } | ||
| 1253 | - | ||
| 1254 | - | ||
| 1255 | - /** | ||
| 1256 | - * 上传超速数据 | ||
| 1257 | - */ | ||
| 1258 | - @Override | ||
| 1259 | - public String setCS() { | ||
| 1260 | - String result = "failure"; | ||
| 1261 | - StringBuffer sBuffer =new StringBuffer(); | ||
| 1262 | - sBuffer.append("<CSs>"); | ||
| 1263 | - String sql = "SELECT * FROM bsth_c_speeding where DATE_FORMAT(create_date,'%Y-%m-%d') = ? order by create_date "; | ||
| 1264 | - Connection conn = null; | ||
| 1265 | - PreparedStatement ps = null; | ||
| 1266 | - ResultSet rs = null; | ||
| 1267 | - // 取昨天 的日期 | ||
| 1268 | - String yesterday = sdfnyr.format(DateUtils.addDays(new Date(), -1)); | ||
| 1269 | - try { | ||
| 1270 | - conn = DBUtils_MS.getConnection(); | ||
| 1271 | - ps = conn.prepareStatement(sql); | ||
| 1272 | - ps.setString(1, yesterday); | ||
| 1273 | - rs = ps.executeQuery(); | ||
| 1274 | - Float lon, lat; | ||
| 1275 | - String kssk; | ||
| 1276 | - String speed; | ||
| 1277 | - while (rs.next()) { | ||
| 1278 | - kssk = sdfnyrsfm.format(rs.getLong("TIMESTAMP")); | ||
| 1279 | - speed = rs.getString("SPEED"); | ||
| 1280 | - // 经纬度 | ||
| 1281 | - lon = rs.getFloat("LON"); | ||
| 1282 | - lat = rs.getFloat("LAT"); | ||
| 1283 | - sBuffer.append("<CS>"); | ||
| 1284 | - sBuffer.append("<RQ>").append(sdfnyr.format(rs.getDate("CREATE_DATE"))).append("</RQ>"); | ||
| 1285 | - sBuffer.append("<XLBM>").append(BasicData.lineCode2ShangHaiCodeMap.get(rs.getString("LINE"))).append("</XLBM>");//////// | ||
| 1286 | - sBuffer.append("<CPH>").append(rs.getString("VEHICLE")).append("</CPH>"); | ||
| 1287 | - sBuffer.append("<KSSK>").append(kssk).append("</KSSK>"); | ||
| 1288 | - sBuffer.append("<KSDDJD>").append(lon).append("</KSDDJD>"); | ||
| 1289 | - sBuffer.append("<KSDDWD>").append(lat).append("</KSDDWD>"); | ||
| 1290 | - sBuffer.append("<KSLD>").append("").append("</KSLD>");//********************** | ||
| 1291 | - sBuffer.append("<JSSK>").append(kssk).append("</JSSK>"); | ||
| 1292 | - sBuffer.append("<JSDDJD>").append(lon).append("</JSDDJD>"); | ||
| 1293 | - sBuffer.append("<JSDDWD>").append(lat).append("</JSDDWD>"); | ||
| 1294 | - sBuffer.append("<JSLD>").append("").append("</JSLD>");//********************** | ||
| 1295 | - sBuffer.append("<PJSD>").append(speed).append("</PJSD>"); | ||
| 1296 | - sBuffer.append("<ZGSS>").append(speed).append("</ZGSS>"); | ||
| 1297 | - sBuffer.append("<UPDT>").append(sdfnyrsfm.format(new Date())).append("</UPDT>"); | ||
| 1298 | - sBuffer.append("</CS>"); | ||
| 1299 | - } | ||
| 1300 | - sBuffer.append("</CSs>"); | ||
| 1301 | - if(ssop.setCS(userNameOther, passwordOther, sBuffer.toString()).isSuccess()){ | ||
| 1302 | - result = "success"; | ||
| 1303 | - } | ||
| 1304 | - } catch (Exception e) { | ||
| 1305 | - logger.error("setCS:",e); | ||
| 1306 | - e.printStackTrace(); | ||
| 1307 | - } finally { | ||
| 1308 | - logger.info("setCS:"+sBuffer.toString()); | ||
| 1309 | - logger.info("setCS:"+result); | ||
| 1310 | - DBUtils_MS.close(rs, ps, conn); | ||
| 1311 | - } | ||
| 1312 | - return result; | ||
| 1313 | - } | ||
| 1314 | - | ||
| 1315 | - | ||
| 1316 | - /** | ||
| 1317 | - * 下载全量的公交基础数据 | ||
| 1318 | - */ | ||
| 1319 | - public String getDownLoadAllDataFile() { | ||
| 1320 | - String result = "failure"; | ||
| 1321 | - try { | ||
| 1322 | - try { | ||
| 1323 | - if(ygcBasicDataService.download("admin","000000","abc.zip")){ | ||
| 1324 | - result = "success"; | ||
| 1325 | - } | ||
| 1326 | - } catch (Exception e) { | ||
| 1327 | - e.printStackTrace(); | ||
| 1328 | - } | ||
| 1329 | - } catch (Exception e) { | ||
| 1330 | - e.printStackTrace(); | ||
| 1331 | - } | ||
| 1332 | - | ||
| 1333 | - return result; | ||
| 1334 | - } | ||
| 1335 | - | ||
| 1336 | - /** | ||
| 1337 | - * 下载增量的公交基础数据 | ||
| 1338 | - */ | ||
| 1339 | - public String getDownLoadIncreaseDataFile() { | ||
| 1340 | - String result = "success"; | ||
| 1341 | - try { | ||
| 1342 | - //System.out.println(portType.downloadIncreaseDataFile(args0, args1, args2)); | ||
| 1343 | - } catch (Exception e) { | ||
| 1344 | - e.printStackTrace(); | ||
| 1345 | - } | ||
| 1346 | - | ||
| 1347 | - return result; | ||
| 1348 | - } | ||
| 1349 | - | ||
| 1350 | - /** | ||
| 1351 | - * 指定线路查询方式公交基础数据下载 | ||
| 1352 | - */ | ||
| 1353 | - public String getDownLoadWarrantsBusLineStation() { | ||
| 1354 | - String result = "success"; | ||
| 1355 | - try { | ||
| 1356 | - | ||
| 1357 | - //portType.setXL(userNameXl, passwordXl, sBuffer.toString()); | ||
| 1358 | - } catch (Exception e) { | ||
| 1359 | - e.printStackTrace(); | ||
| 1360 | - } | ||
| 1361 | - | ||
| 1362 | - return result; | ||
| 1363 | - } | ||
| 1364 | - | ||
| 1365 | - /** | ||
| 1366 | - * 计算结束时间 | ||
| 1367 | - * @param fcsj 发车时间 | ||
| 1368 | - * @param bcsj 班次历时 | ||
| 1369 | - * @return | ||
| 1370 | - */ | ||
| 1371 | - private String calcDdsj(String fcsj,Integer bcsj){ | ||
| 1372 | - String result = ""; | ||
| 1373 | - if(fcsj.indexOf(":") != -1){ | ||
| 1374 | - if(bcsj == null){ | ||
| 1375 | - return fcsj; | ||
| 1376 | - } | ||
| 1377 | - // 时和分隔开 | ||
| 1378 | - String[] fcsjArray = fcsj.split(":"); | ||
| 1379 | - // 分和历时时间相加 | ||
| 1380 | - Integer fullTime = Integer.valueOf(fcsjArray[1])+ bcsj; | ||
| 1381 | - int hour,min,sumHour; | ||
| 1382 | - hour = fullTime / 60; | ||
| 1383 | - min = fullTime % 60; | ||
| 1384 | - sumHour = Integer.valueOf(fcsjArray[0])+hour; | ||
| 1385 | - if(sumHour >= 24){ | ||
| 1386 | - result = String.format("%02d",sumHour - 24); | ||
| 1387 | - }else{ | ||
| 1388 | - result = String.format("%02d",sumHour);; | ||
| 1389 | - } | ||
| 1390 | - result +=":"+String.format("%02d", min); | ||
| 1391 | - }else{ | ||
| 1392 | - result = fcsj; | ||
| 1393 | - } | ||
| 1394 | - return result; | ||
| 1395 | - } | ||
| 1396 | - | ||
| 1397 | - /** | ||
| 1398 | - * 改变时间格式 | ||
| 1399 | - * @param ttInfoDetail 时刻表详细 | ||
| 1400 | - * @return xx:yy | ||
| 1401 | - */ | ||
| 1402 | - private String changeTimeFormat(TTInfoDetail ttInfoDetail){ | ||
| 1403 | - String result = "00:00"; | ||
| 1404 | - String fcsj = ttInfoDetail.getFcsj(); | ||
| 1405 | - if(fcsj.indexOf(":") != -1){ | ||
| 1406 | - // 时和分隔开 | ||
| 1407 | - String[] fcsjArray = fcsj.split(":"); | ||
| 1408 | - result = String.format("%02d", Integer.valueOf(fcsjArray[0]))+":"; | ||
| 1409 | - result +=String.format("%02d", Integer.valueOf(fcsjArray[1])); | ||
| 1410 | - }else{ | ||
| 1411 | - result = null; | ||
| 1412 | - logger.info("setSKB:发车时间错误:ttInfoDetail.id="+ttInfoDetail.getId()); | ||
| 1413 | - } | ||
| 1414 | - return result; | ||
| 1415 | - } | ||
| 1416 | - | ||
| 1417 | - /** | ||
| 1418 | - * 拼装线路计划班次表的XML | ||
| 1419 | - * @param sBuffer | ||
| 1420 | - * @param schedulePlanInfo | ||
| 1421 | - * @param xlbm | ||
| 1422 | - * @param zbh | ||
| 1423 | - * @param lp | ||
| 1424 | - */ | ||
| 1425 | - private void assembleJHBC(StringBuffer sBuffer,SchedulePlanInfo schedulePlanInfo,String xlbm,String zbh,Long lp){ | ||
| 1426 | - sBuffer.append("<JHBC>"); | ||
| 1427 | - sBuffer.append("<RQ>").append(sdfnyr.format(schedulePlanInfo.getScheduleDate())).append("</RQ>"); | ||
| 1428 | - sBuffer.append("<XLBM>").append(BasicData.lineCode2ShangHaiCodeMap.get(xlbm)).append("</XLBM>"); | ||
| 1429 | - sBuffer.append("<CPH>").append("沪"+zbh).append("</CPH>"); | ||
| 1430 | - sBuffer.append("<LPBH>").append(lp).append("</LPBH>"); | ||
| 1431 | - sBuffer.append("<UPDT>").append(sdfnyrsfm.format(new Date())).append("</UPDT>"); | ||
| 1432 | - sBuffer.append("<BCList>"); | ||
| 1433 | - } | ||
| 1434 | - /** | ||
| 1435 | - * 转换排班规则 | ||
| 1436 | - * @param ruleDay | ||
| 1437 | - * @return | ||
| 1438 | - */ | ||
| 1439 | - private String changeRuleDay(String ruleDay){ | ||
| 1440 | - String result = ""; | ||
| 1441 | - int flag ; | ||
| 1442 | - String[] ruleDayArray = ruleDay.split(","); | ||
| 1443 | - for (int i = 0; i < ruleDayArray.length; i++) { | ||
| 1444 | - if(ruleDayArray[i].equals("1")){ | ||
| 1445 | - flag = i+1; | ||
| 1446 | - }else{ | ||
| 1447 | - flag = 0; | ||
| 1448 | - } | ||
| 1449 | - if(flag > 0){ | ||
| 1450 | - result += flag + ","; | ||
| 1451 | - } | ||
| 1452 | - } | ||
| 1453 | - // 去掉最后一个字符 | ||
| 1454 | - if(StringUtils.endsWith(result,",")){ | ||
| 1455 | - result = StringUtils.removeEnd(result,","); | ||
| 1456 | - } | ||
| 1457 | - return result; | ||
| 1458 | - } | ||
| 1459 | - /** | ||
| 1460 | - * 设置统一的公司名称 | ||
| 1461 | - * @param company | ||
| 1462 | - */ | ||
| 1463 | - private void setCompanyName(String company){ | ||
| 1464 | - if(company.equals("闵行公司")){ | ||
| 1465 | - company = "浦东闵行公交公司"; | ||
| 1466 | - }else if(company.equals("杨高公司")){ | ||
| 1467 | - company = "浦东杨高公交公司"; | ||
| 1468 | - }else if(company.equals("上南公司")){ | ||
| 1469 | - company = "浦东上南公交公司"; | ||
| 1470 | - }else if(company.equals("金高公司")){ | ||
| 1471 | - company = "浦东金高公交公司"; | ||
| 1472 | - }else if(company.equals("南汇公司")){ | ||
| 1473 | - company = "浦东南汇公交公司"; | ||
| 1474 | - }else if(company.equals("青浦公交")){ | ||
| 1475 | - company = "浦东青浦公交公司"; | ||
| 1476 | - } | ||
| 1477 | - } | ||
| 1478 | - /** | ||
| 1479 | - * @param stationsList 站点路由集 | ||
| 1480 | - * @param sBuffer sBuffer | ||
| 1481 | - * @param startId 站点序号起始ID | ||
| 1482 | - * | ||
| 1483 | - * @return 站点序号累加后的ID | ||
| 1484 | - */ | ||
| 1485 | - private int packagStationXml(List<StationRoute> stationsList,StringBuffer sBuffer,int startId,Map<String, Integer> stationNumMap){ | ||
| 1486 | - int size = stationsList.size(); | ||
| 1487 | - StationRoute srRoute; | ||
| 1488 | - HashMap<String,String> paraMap; | ||
| 1489 | - String zdlx ;// 站点类型:0:起点站、1:终点站、2:中途站 | ||
| 1490 | - for (int i = 0; i < size; i++) { | ||
| 1491 | - srRoute = stationsList.get(i); | ||
| 1492 | - zdlx = srRoute.getStationMark(); | ||
| 1493 | - if(zdlx.equals("B")){ | ||
| 1494 | - zdlx = "0"; | ||
| 1495 | - }else if(zdlx.equals("E")){ | ||
| 1496 | - zdlx = "1"; | ||
| 1497 | - }else{ | ||
| 1498 | - zdlx = "2"; | ||
| 1499 | - } | ||
| 1500 | - paraMap = packageYgcStationNumParam(srRoute,null); | ||
| 1501 | - sBuffer.append("<Station>"); | ||
| 1502 | - sBuffer.append("<ZDXH>").append(getYgcStationNumByLineCodeAndDirectionAndStationName(paraMap,stationNumMap)).append("</ZDXH>"); | ||
| 1503 | - sBuffer.append("<SXX>").append(srRoute.getDirections()).append("</SXX>"); | ||
| 1504 | - sBuffer.append("<ZDMC>").append(srRoute.getStationName()).append("</ZDMC>"); | ||
| 1505 | - sBuffer.append("<ZDBM>").append(srRoute.getStationCode()).append("</ZDBM>"); | ||
| 1506 | - sBuffer.append("<ZDJD>").append(srRoute.getStation().getgLonx()).append("</ZDJD>"); | ||
| 1507 | - sBuffer.append("<ZDWD>").append(srRoute.getStation().getgLaty()).append("</ZDWD>"); | ||
| 1508 | - sBuffer.append("<ZZ>").append(srRoute.getStation().getAddr() == null ? "" : srRoute.getStation().getAddr()).append("</ZZ>"); | ||
| 1509 | - sBuffer.append("<ZDLX>").append(zdlx).append("</ZDLX>"); | ||
| 1510 | - sBuffer.append("<ZJLC>").append(srRoute.getDistances()).append("</ZJLC>"); | ||
| 1511 | - sBuffer.append("</Station>"); | ||
| 1512 | - startId++; | ||
| 1513 | - } | ||
| 1514 | - return startId; | ||
| 1515 | - } | ||
| 1516 | - | ||
| 1517 | - /** | ||
| 1518 | - * @param pointList 站点点位集 | ||
| 1519 | - * @param sBuffer sBuffer | ||
| 1520 | - * @param startId 站点序号起始ID | ||
| 1521 | - * | ||
| 1522 | - * @return 站点序号累加后的ID | ||
| 1523 | - */ | ||
| 1524 | - private int packagStationPointXml(List<Object[]> pointList,StringBuffer sBuffer,int startId){ | ||
| 1525 | - int size = pointList.size(); | ||
| 1526 | - Object[] objs; | ||
| 1527 | - String bsection,dir,section; | ||
| 1528 | - String[] sections ; | ||
| 1529 | - for (int i = 0; i < size; i++) { | ||
| 1530 | - objs = pointList.get(i); | ||
| 1531 | - bsection = objs[0]+""; | ||
| 1532 | - dir = objs[1]+""; | ||
| 1533 | - // 取括号内的内容 | ||
| 1534 | - Pattern pattern = Pattern.compile("(?<=\\()(.+?)(?=\\))"); | ||
| 1535 | - Matcher matcher = pattern.matcher(bsection); | ||
| 1536 | - if(matcher.find()){ | ||
| 1537 | - sections = matcher.group().split(","); | ||
| 1538 | - for (int j = 0 ; j < sections.length ; j ++){ | ||
| 1539 | - section = sections[j]; | ||
| 1540 | - sBuffer.append("<LinePoint>"); | ||
| 1541 | - sBuffer.append("<ZDXH>").append(startId).append("</ZDXH>"); | ||
| 1542 | - sBuffer.append("<SXX>").append(dir).append("</SXX>"); | ||
| 1543 | - sBuffer.append("<ZDJD>").append(section.split(" ")[0]).append("</ZDJD>"); | ||
| 1544 | - sBuffer.append("<ZDWD>").append(section.split(" ")[1]).append("</ZDWD>"); | ||
| 1545 | - sBuffer.append("</LinePoint>"); | ||
| 1546 | - startId++; | ||
| 1547 | - } | ||
| 1548 | - } | ||
| 1549 | - } | ||
| 1550 | - return startId; | ||
| 1551 | - } | ||
| 1552 | - | ||
| 1553 | - /** | ||
| 1554 | - * 获取运管处站点序号 | ||
| 1555 | - * @param map | ||
| 1556 | - * @return 运管处站点序号 | ||
| 1557 | - */ | ||
| 1558 | - private Integer getYgcStationNumByLineCodeAndDirectionAndStationName(HashMap<String,String> map,Map<String, Integer> stationNumMap){ | ||
| 1559 | - // 线路编码 | ||
| 1560 | - String lineCode = map.get("lineCode"); | ||
| 1561 | - // 线路走向 0:上行 1:下行 | ||
| 1562 | - String direction = map.get("direction"); | ||
| 1563 | - // 站点编码 | ||
| 1564 | - String stationCode = map.get("stationCode"); | ||
| 1565 | - // 站点类型:B:起点站 Z:中途站 E:终点站 T:停车场 | ||
| 1566 | - String stationMark = map.get("stationMark"); | ||
| 1567 | - String[] marks = null; | ||
| 1568 | - // 起点站,先从起点找,找不到再从中途站找,最后从终点找 | ||
| 1569 | - if(stationMark.equals("B")){ | ||
| 1570 | - marks= new String[]{"B","Z","E"}; | ||
| 1571 | - }else if(stationMark.equals("E")){// 终点站相反 | ||
| 1572 | - marks= new String[]{"E","Z","B"}; | ||
| 1573 | - }else if(stationMark.equals("Z")){ | ||
| 1574 | - marks= new String[]{"Z"}; | ||
| 1575 | - } | ||
| 1576 | - // 默认从缓存BasicData.stationName2YgcNumber | ||
| 1577 | - Map<String, Integer> tempMap = BasicData.stationName2YgcNumber; | ||
| 1578 | - // 如果传入的stationNumMap不为空,则不是缓存取,而从stationNumMap取 | ||
| 1579 | - if(stationNumMap != null){ | ||
| 1580 | - tempMap = stationNumMap; | ||
| 1581 | - } | ||
| 1582 | - Integer number = null; | ||
| 1583 | - for (int i = 0 ;i < marks.length ; i ++){ | ||
| 1584 | - number = tempMap.get(lineCode+"_"+direction+"_"+stationCode+"_"+marks[i]); | ||
| 1585 | - if(number != null){ | ||
| 1586 | - break; | ||
| 1587 | - } | ||
| 1588 | - } | ||
| 1589 | - return number == null ? 0 : number; | ||
| 1590 | - } | ||
| 1591 | - | ||
| 1592 | - /** | ||
| 1593 | - * 封装查询站序条件 | ||
| 1594 | - * @param obj | ||
| 1595 | - * @return | ||
| 1596 | - */ | ||
| 1597 | - private HashMap packageYgcStationNumParam(Object obj,HashMap<String,String> otherParam){ | ||
| 1598 | - HashMap<String,String> map = new HashMap<String,String>(); | ||
| 1599 | - String lineCode = "",direction = "",stationCode = "",stationMark = ""; | ||
| 1600 | - // 站点路由 | ||
| 1601 | - if(obj instanceof StationRoute){ | ||
| 1602 | - StationRoute sr = (StationRoute)obj; | ||
| 1603 | - lineCode = sr.getLineCode(); | ||
| 1604 | - direction = String.valueOf(sr.getDirections()); | ||
| 1605 | - stationCode = sr.getStationCode(); | ||
| 1606 | - stationMark = sr.getStationMark(); | ||
| 1607 | - }else if(obj instanceof ScheduleRealInfo){ //实际排班计划明细。 | ||
| 1608 | - ScheduleRealInfo sri = (ScheduleRealInfo)obj; | ||
| 1609 | - lineCode = sri.getXlBm(); | ||
| 1610 | - direction = sri.getXlDir(); | ||
| 1611 | - if(otherParam != null && otherParam.get("stationMark") != null){ | ||
| 1612 | - stationMark = otherParam.get("stationMark"); | ||
| 1613 | - if(stationMark.equals("B")){ // 起点站 | ||
| 1614 | - stationCode = sri.getQdzCode(); | ||
| 1615 | - }else if(stationMark.equals("E")){ // 终点站 | ||
| 1616 | - stationCode = sri.getZdzCode(); | ||
| 1617 | - } | ||
| 1618 | - } | ||
| 1619 | - }else if(obj instanceof SchedulePlanInfo){ //排班计划明细 | ||
| 1620 | - SchedulePlanInfo spi = (SchedulePlanInfo)obj; | ||
| 1621 | - lineCode = spi.getXlBm(); | ||
| 1622 | - direction = spi.getXlDir(); | ||
| 1623 | - if(otherParam != null && otherParam.get("stationMark") != null){ | ||
| 1624 | - stationMark = otherParam.get("stationMark"); | ||
| 1625 | - if(stationMark.equals("B")){ // 起点站 | ||
| 1626 | - stationCode = spi.getQdzCode(); | ||
| 1627 | - }else if(stationMark.equals("E")){ // 终点站 | ||
| 1628 | - stationCode = spi.getZdzCode(); | ||
| 1629 | - } | ||
| 1630 | - } | ||
| 1631 | - }else if(obj instanceof TTInfoDetail){ //时刻表明细 | ||
| 1632 | - TTInfoDetail ttid = (TTInfoDetail)obj; | ||
| 1633 | - lineCode = ttid.getXl().getLineCode(); | ||
| 1634 | - direction = ttid.getXlDir(); | ||
| 1635 | - if(otherParam != null && otherParam.get("stationMark") != null){ | ||
| 1636 | - stationMark = otherParam.get("stationMark"); | ||
| 1637 | - if(stationMark.equals("B")){ // 起点站 | ||
| 1638 | - stationCode = ttid.getQdzCode(); | ||
| 1639 | - }else if(stationMark.equals("E")){ // 终点站 | ||
| 1640 | - stationCode = ttid.getZdzCode(); | ||
| 1641 | - } | ||
| 1642 | - } | ||
| 1643 | - } | ||
| 1644 | - map.put("lineCode",lineCode);// 站点编码 | ||
| 1645 | - map.put("direction",direction); // 上下行 | ||
| 1646 | - map.put("stationCode",stationCode); // 站点编号 | ||
| 1647 | - map.put("stationMark",stationMark); // 站点类型 | ||
| 1648 | - return map; | ||
| 1649 | - } | ||
| 1650 | - | ||
| 1651 | - /** | ||
| 1652 | - * 取得历史站点编码和站点名称的对应关系 | ||
| 1653 | - * @return | ||
| 1654 | - */ | ||
| 1655 | - private Map<String, String> getLsStationCode(String lineCode,int lineVersion){ | ||
| 1656 | - Map<String,Object> map = new HashMap<>(); | ||
| 1657 | - map.put("lineCode_eq", lineCode); | ||
| 1658 | - map.put("versions_eq",lineVersion); | ||
| 1659 | - LsStationRoute lsroute; | ||
| 1660 | - Iterator<LsStationRoute> iterator = lsStationRouteRepository.findAll(new CustomerSpecs<LsStationRoute>(map)).iterator(); | ||
| 1661 | - Map<String, String> stationCode2Name = new HashMap<>(); | ||
| 1662 | - while (iterator.hasNext()) { | ||
| 1663 | - lsroute = iterator.next(); | ||
| 1664 | - stationCode2Name.put(lsroute.getLineCode() + "_" + lsroute.getDirections() + "_" + lsroute.getStationCode(), lsroute.getStationName()); | ||
| 1665 | - } | ||
| 1666 | - return stationCode2Name; | ||
| 1667 | - } | ||
| 1668 | - | ||
| 1669 | - private Map<String, Integer> getLsStationRoute(String xlbm,int lineVersion){ | ||
| 1670 | - Map<String, Integer> tempStationName2YgcNumber = new HashMap<String, Integer>(); | ||
| 1671 | - /** | ||
| 1672 | - * 加载运管处的站点及序号 | ||
| 1673 | - * 上行从1开始,下行顺序续编 | ||
| 1674 | - */ | ||
| 1675 | - List<Map<String, String>> ygcLines = lsStationRouteRepository.findLineWithLineCode4Ygc(xlbm,lineVersion); | ||
| 1676 | - if(ygcLines != null && ygcLines.size() > 0){ | ||
| 1677 | - int size = ygcLines.size(); | ||
| 1678 | - Map<String, String> tempMap ; | ||
| 1679 | - int num = 1; | ||
| 1680 | - String key; | ||
| 1681 | - String lineCode = ""; | ||
| 1682 | - for (int i = 0; i < size; i ++){ | ||
| 1683 | - tempMap = ygcLines.get(i); | ||
| 1684 | - if(lineCode.equals("")){ | ||
| 1685 | - lineCode = tempMap.get("lineCode"); | ||
| 1686 | - }else if(!lineCode.equals(tempMap.get("lineCode"))){ | ||
| 1687 | - num = 1; | ||
| 1688 | - lineCode = tempMap.get("lineCode"); | ||
| 1689 | - } | ||
| 1690 | - key = tempMap.get("lineCode") + "_"+String.valueOf(tempMap.get("directions")) | ||
| 1691 | - + "_"+tempMap.get("stationCode")+ "_"+tempMap.get("stationMark"); | ||
| 1692 | - tempStationName2YgcNumber.put(key,num++); | ||
| 1693 | - } | ||
| 1694 | - } | ||
| 1695 | - return tempStationName2YgcNumber; | ||
| 1696 | - } | ||
| 1697 | - | ||
| 1698 | - private String getSetXlXml(Line line,LineInformation lineInformation){ | ||
| 1699 | - StringBuffer sBuffer = new StringBuffer(); | ||
| 1700 | - List<StationRoute> upStationsList ;// 上行站点路由集 | ||
| 1701 | - List<StationRoute> downStationsList;// 下行站点路由集 | ||
| 1702 | - List<Object[]> downPointList;// 下行站点集 | ||
| 1703 | - List<Object[]> upPointList;// 上行站点集 | ||
| 1704 | - sBuffer.append("<XLs>"); | ||
| 1705 | - sBuffer.append("<XL>"); | ||
| 1706 | - sBuffer.append("<XLBM>").append(BasicData.lineId2ShangHaiCodeMap.get(line.getId())).append("</XLBM>"); | ||
| 1707 | - sBuffer.append("<XLMC>").append(line.getName()).append("</XLMC>"); | ||
| 1708 | - sBuffer.append("<QDZ>").append(line.getStartStationName()).append("</QDZ>"); | ||
| 1709 | - sBuffer.append("<ZDZ>").append(line.getEndStationName()).append("</ZDZ>"); | ||
| 1710 | - sBuffer.append("<QZLC>").append(lineInformation.getUpMileage()).append("</QZLC>"); | ||
| 1711 | - sBuffer.append("<ZQLC>").append(lineInformation.getDownMileage()).append("</ZQLC>"); | ||
| 1712 | - sBuffer.append("<XLGH>").append(line.getLinePlayType()).append("</XLGH>"); | ||
| 1713 | - sBuffer.append("<UPDATE_DATE>").append(sdfnyr.format(new Date())).append("</UPDATE_DATE>"); | ||
| 1714 | - // 循环添加站点信息 | ||
| 1715 | - sBuffer.append("<StationList>"); | ||
| 1716 | - // 先查上行 | ||
| 1717 | - upStationsList = stationRouteRepository.findByLine(line.getLineCode(), 0); | ||
| 1718 | - Map<String, Integer> stationNumMap = getStationName2YgcNumberMap(line.getLineCode()); | ||
| 1719 | - int startId = 1; | ||
| 1720 | - startId = packagStationXml(upStationsList, sBuffer, startId,stationNumMap); | ||
| 1721 | - // 环线不查下行 | ||
| 1722 | - if(line.getLinePlayType() != 1){ | ||
| 1723 | - // 再查下行 | ||
| 1724 | - downStationsList = stationRouteRepository.findByLine(line.getLineCode(), 1); | ||
| 1725 | - packagStationXml(downStationsList, sBuffer, startId,stationNumMap); | ||
| 1726 | - } | ||
| 1727 | - sBuffer.append("</StationList>"); | ||
| 1728 | - // 循环添加站点点位信息 | ||
| 1729 | - sBuffer.append("<LinePointList>"); | ||
| 1730 | - upPointList = sectionRepository.getSectionDirByLineId(line.getId(),0); | ||
| 1731 | - startId = 1; | ||
| 1732 | - startId = packagStationPointXml(upPointList, sBuffer, startId); | ||
| 1733 | - // 环线不查下行 | ||
| 1734 | - if(line.getLinePlayType() != 1){ | ||
| 1735 | - downPointList = sectionRepository.getSectionDirByLineId(line.getId(),1); | ||
| 1736 | - packagStationPointXml(downPointList, sBuffer, startId); | ||
| 1737 | - } | ||
| 1738 | - sBuffer.append("</LinePointList>"); | ||
| 1739 | - sBuffer.append("</XL>"); | ||
| 1740 | - sBuffer.append("</XLs>"); | ||
| 1741 | - return sBuffer.toString(); | ||
| 1742 | - } | ||
| 1743 | -} | 1 | +package com.bsth.service.impl; |
| 2 | + | ||
| 3 | +import com.bsth.data.BasicData; | ||
| 4 | +import com.bsth.email.SendEmailController; | ||
| 5 | +import com.bsth.email.entity.EmailBean; | ||
| 6 | +import com.bsth.entity.*; | ||
| 7 | +import com.bsth.entity.realcontrol.ChildTaskPlan; | ||
| 8 | +import com.bsth.entity.realcontrol.ScheduleRealInfo; | ||
| 9 | +import com.bsth.entity.schedule.SchedulePlanInfo; | ||
| 10 | +import com.bsth.entity.schedule.TTInfo; | ||
| 11 | +import com.bsth.entity.schedule.TTInfoDetail; | ||
| 12 | +import com.bsth.entity.search.CustomerSpecs; | ||
| 13 | +import com.bsth.entity.sys.SysUser; | ||
| 14 | +import com.bsth.entity.traffic.SKBUploadLogger; | ||
| 15 | +import com.bsth.repository.*; | ||
| 16 | +import com.bsth.repository.realcontrol.ScheduleRealInfoRepository; | ||
| 17 | +import com.bsth.repository.schedule.*; | ||
| 18 | +import com.bsth.repository.traffic.SKBUploadLoggerRepository; | ||
| 19 | +import com.bsth.security.util.SecurityUtils; | ||
| 20 | +import com.bsth.service.TrafficManageService; | ||
| 21 | +import com.bsth.service.traffic.YgcBasicDataService; | ||
| 22 | +import com.bsth.util.IpUtils; | ||
| 23 | +import com.bsth.util.TimeUtils; | ||
| 24 | +import com.bsth.util.db.DBUtils_MS; | ||
| 25 | +import com.bsth.webService.trafficManage.org.tempuri.Results; | ||
| 26 | +import com.bsth.webService.trafficManage.org.tempuri.WebServiceLocator; | ||
| 27 | +import com.bsth.webService.trafficManage.org.tempuri.WebServiceSoap; | ||
| 28 | +import org.apache.commons.lang.StringEscapeUtils; | ||
| 29 | +import org.apache.commons.lang.StringUtils; | ||
| 30 | +import org.apache.commons.lang.time.DateUtils; | ||
| 31 | +import org.joda.time.DateTime; | ||
| 32 | +import org.slf4j.Logger; | ||
| 33 | +import org.slf4j.LoggerFactory; | ||
| 34 | +import org.springframework.beans.factory.annotation.Autowired; | ||
| 35 | +import org.springframework.data.domain.Sort; | ||
| 36 | +import org.springframework.data.domain.Sort.Direction; | ||
| 37 | +import org.springframework.security.core.context.SecurityContextHolder; | ||
| 38 | +import org.springframework.stereotype.Service; | ||
| 39 | + | ||
| 40 | +import java.io.*; | ||
| 41 | +import java.net.InetAddress; | ||
| 42 | +import java.sql.Connection; | ||
| 43 | +import java.sql.PreparedStatement; | ||
| 44 | +import java.sql.ResultSet; | ||
| 45 | +import java.text.DecimalFormat; | ||
| 46 | +import java.text.SimpleDateFormat; | ||
| 47 | +import java.util.*; | ||
| 48 | +import java.util.regex.Matcher; | ||
| 49 | +import java.util.regex.Pattern; | ||
| 50 | + | ||
| 51 | +/** | ||
| 52 | + * | ||
| 53 | + * @ClassName: TrafficManageServiceImpl(运管处接口service业务层实现类) | ||
| 54 | + * | ||
| 55 | + * @Extends : BaseService | ||
| 56 | + * | ||
| 57 | + * @Description: TODO(运管处接口service业务层) | ||
| 58 | + * | ||
| 59 | + * @Author bsth@zq | ||
| 60 | + * | ||
| 61 | + * @Date 2016年10月28日 上午9:21:17 | ||
| 62 | + * | ||
| 63 | + * @Version 公交调度系统BS版 0.1 | ||
| 64 | + * | ||
| 65 | + */ | ||
| 66 | + | ||
| 67 | +@Service | ||
| 68 | +public class TrafficManageServiceImpl implements TrafficManageService{ | ||
| 69 | + | ||
| 70 | + Logger logger = LoggerFactory.getLogger(this.getClass()); | ||
| 71 | + // 运管处上传日志类型 | ||
| 72 | + public static final String UPLOAD_TYPE_SKB = "1"; | ||
| 73 | + public static final String UPLOAD_TYPE_XL = "2"; | ||
| 74 | + public static final String UPLOAD_TYPE_LD = "3"; | ||
| 75 | + | ||
| 76 | + // 线路repository | ||
| 77 | + @Autowired | ||
| 78 | + private LineRepository lineRepository; | ||
| 79 | + | ||
| 80 | + @Autowired | ||
| 81 | + private LineInformationRepository lineInformationRepository; | ||
| 82 | + | ||
| 83 | + // 站点路由repository | ||
| 84 | + @Autowired | ||
| 85 | + private StationRouteRepository stationRouteRepository; | ||
| 86 | + | ||
| 87 | + // 历史站点路由repository | ||
| 88 | + @Autowired | ||
| 89 | + private LsStationRouteRepository lsStationRouteRepository; | ||
| 90 | + | ||
| 91 | + @Autowired | ||
| 92 | + private SectionRepository sectionRepository; | ||
| 93 | + | ||
| 94 | + // 车辆repository | ||
| 95 | + @Autowired | ||
| 96 | + private CarsRepository carsRepository; | ||
| 97 | + | ||
| 98 | + // 人员repository | ||
| 99 | + @Autowired | ||
| 100 | + private PersonnelRepository personnelRepository; | ||
| 101 | + | ||
| 102 | + // 时刻模板repository | ||
| 103 | + @Autowired | ||
| 104 | + private TTInfoRepository ttInfoRepository; | ||
| 105 | + | ||
| 106 | + // 时刻模板明细repository | ||
| 107 | + @Autowired | ||
| 108 | + private TTInfoDetailRepository ttInfoDetailRepository; | ||
| 109 | + | ||
| 110 | + // 排班计划明细repository | ||
| 111 | + @Autowired | ||
| 112 | + private SchedulePlanInfoRepository schedulePlanInfoRepository; | ||
| 113 | + | ||
| 114 | + // 实际排班计划明细repository | ||
| 115 | + @Autowired | ||
| 116 | + private ScheduleRealInfoRepository scheduleRealInfoRepository; | ||
| 117 | + | ||
| 118 | + // 时刻表上传记录repository | ||
| 119 | + @Autowired | ||
| 120 | + private SKBUploadLoggerRepository skbUploadLoggerRepository; | ||
| 121 | + | ||
| 122 | + // 线路站点repository | ||
| 123 | + @Autowired | ||
| 124 | + private YgcBasicDataService ygcBasicDataService; | ||
| 125 | + | ||
| 126 | + // 发送邮件 | ||
| 127 | + @Autowired | ||
| 128 | + private SendEmailController sendEmailController; | ||
| 129 | + | ||
| 130 | + /** | ||
| 131 | + * 线路版本repository | ||
| 132 | + */ | ||
| 133 | + @Autowired | ||
| 134 | + private LineVersionsRepository lineVersionsRepository; | ||
| 135 | + | ||
| 136 | + // 运管处上传接口 | ||
| 137 | + private com.bsth.webService.trafficManage.up.org.tempuri.WebServiceSoap webServiceSoapUp; | ||
| 138 | + private WebServiceSoap ssop ; | ||
| 139 | + { | ||
| 140 | + try { | ||
| 141 | + ssop = new WebServiceLocator().getWebServiceSoap(); | ||
| 142 | + } catch (Exception e) { | ||
| 143 | + e.printStackTrace(); | ||
| 144 | + } | ||
| 145 | + } | ||
| 146 | + // 格式化 年月日时分秒 nyrsfm是年月日时分秒的拼音首字母 | ||
| 147 | + private SimpleDateFormat sdfnyrsfm = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); | ||
| 148 | + | ||
| 149 | + // 格式化 年月日 | ||
| 150 | + private SimpleDateFormat sdfnyr = new SimpleDateFormat("yyyy-MM-dd"); | ||
| 151 | + | ||
| 152 | + // 数字格式化 | ||
| 153 | + DecimalFormat format = new DecimalFormat("0.00"); | ||
| 154 | + | ||
| 155 | + // 用户名 | ||
| 156 | + private final String userNameOther = "user"; | ||
| 157 | + // 密码 | ||
| 158 | + private final String passwordOther = "user"; | ||
| 159 | + | ||
| 160 | + // 用户名 | ||
| 161 | + private final String userNameUp = "user"; | ||
| 162 | + // 密码 | ||
| 163 | + private final String passwordUp = "user"; | ||
| 164 | + // 接收邮件人 | ||
| 165 | + private final String emailSendToAddress = "113252620@qq.com"; | ||
| 166 | + // 记录路单上线的成功、失败线路数 | ||
| 167 | + private Integer countSuccess,countFailure; | ||
| 168 | + | ||
| 169 | + private synchronized com.bsth.webService.trafficManage.up.org.tempuri.WebServiceSoap getWebServiceSoapUp(){ | ||
| 170 | + try { | ||
| 171 | + if(webServiceSoapUp == null){ | ||
| 172 | + webServiceSoapUp = new com.bsth.webService.trafficManage.up.org.tempuri.WebServiceLocator().getWebServiceSoap(); | ||
| 173 | + } | ||
| 174 | + }catch (Exception e){ | ||
| 175 | + e.printStackTrace(); | ||
| 176 | + }finally { | ||
| 177 | + return webServiceSoapUp; | ||
| 178 | + } | ||
| 179 | + } | ||
| 180 | + /** | ||
| 181 | + * 上传线路信息 | ||
| 182 | + */ | ||
| 183 | + @Override | ||
| 184 | + public String setXL(String ids) { | ||
| 185 | + String result = "failure"; | ||
| 186 | + String xml ; | ||
| 187 | + String[] idArray = ids.split(","); | ||
| 188 | + try { | ||
| 189 | + for (String id : idArray) { | ||
| 190 | + if(id == null || id.trim().equals("")){ | ||
| 191 | + continue; | ||
| 192 | + } | ||
| 193 | + Map<String,Object> map = new HashMap<>(); | ||
| 194 | + map.put("lineCode_eq", id); | ||
| 195 | + Line line ; | ||
| 196 | + LineInformation lineInformation; | ||
| 197 | + Optional<Line> optionalLine = lineRepository.findOne(new CustomerSpecs<Line>(map)); | ||
| 198 | + line = optionalLine.isPresent() ? optionalLine.get() : null; | ||
| 199 | + if(line == null){ | ||
| 200 | + continue; | ||
| 201 | + } | ||
| 202 | + if(BasicData.lineId2ShangHaiCodeMap.get(line.getId()) == null){ | ||
| 203 | + return result; | ||
| 204 | + } | ||
| 205 | + map = new HashMap<>(); | ||
| 206 | + map.put("line.id_eq",line.getId()); | ||
| 207 | + Optional<LineInformation> optionalLineInformation = lineInformationRepository.findOne(new CustomerSpecs<LineInformation>(map)); | ||
| 208 | + lineInformation = optionalLineInformation.isPresent() ? optionalLineInformation.get() : null; | ||
| 209 | + if(lineInformation == null){ | ||
| 210 | + continue; | ||
| 211 | + } | ||
| 212 | + // 取得封装好的xml | ||
| 213 | + xml = getSetXlXml(line,lineInformation); | ||
| 214 | + // 站点序号不能为0,如果为0,则返回错误 | ||
| 215 | + if(xml.indexOf("<ZDXH>0</ZDXH>") != -1){ | ||
| 216 | + return "0"; | ||
| 217 | + } | ||
| 218 | + String state;// 是否上传成功 | ||
| 219 | + // 调用上传方法 | ||
| 220 | + if(getWebServiceSoapUp().setXL(userNameUp,passwordUp,xml).isSuccess()){ | ||
| 221 | + result = "success"; | ||
| 222 | + state = "1"; | ||
| 223 | + }else{ | ||
| 224 | + result = "failure"; | ||
| 225 | + state = "0"; | ||
| 226 | + } | ||
| 227 | + logger.info("setXL:"+xml); | ||
| 228 | + logger.info("setXL:"+result); | ||
| 229 | + // 保存运管处上传记录 | ||
| 230 | + saveYgcUploadLog(line,xml,TrafficManageServiceImpl.UPLOAD_TYPE_XL,state); | ||
| 231 | + } | ||
| 232 | + } catch (Exception e) { | ||
| 233 | + logger.error("setXL:",e); | ||
| 234 | + e.printStackTrace(); | ||
| 235 | + } | ||
| 236 | + return result; | ||
| 237 | + } | ||
| 238 | + | ||
| 239 | + /** | ||
| 240 | + * 加载运管处的站点及序号 | ||
| 241 | + * 上行从1开始,下行顺序续编 | ||
| 242 | + */ | ||
| 243 | + private Map<String, Integer> getStationName2YgcNumberMap (String lineCode){ | ||
| 244 | + Map<String, Integer> resultMap = new HashMap<>(); | ||
| 245 | + List<Map<String, String>> ygcLines = stationRouteRepository.findLineWithYgcByLine(lineCode); | ||
| 246 | + if(ygcLines != null && ygcLines.size() > 0){ | ||
| 247 | + int size = ygcLines.size(); | ||
| 248 | + Map<String, String> tempMap ; | ||
| 249 | + int num = 1; | ||
| 250 | + String key; | ||
| 251 | + for (int i = 0; i < size; i ++){ | ||
| 252 | + tempMap = ygcLines.get(i); | ||
| 253 | + key = tempMap.get("lineCode") + "_"+String.valueOf(tempMap.get("directions")) | ||
| 254 | + + "_"+tempMap.get("stationCode")+ "_"+tempMap.get("stationMark"); | ||
| 255 | + resultMap.put(key,num++); | ||
| 256 | + } | ||
| 257 | + } | ||
| 258 | + return resultMap; | ||
| 259 | + } | ||
| 260 | + | ||
| 261 | + /** | ||
| 262 | + * 上传线路信息(按in_use上传) | ||
| 263 | + */ | ||
| 264 | + @Override | ||
| 265 | + public String setXLByInUse(String inUse) { | ||
| 266 | + StringBuffer result = new StringBuffer(); | ||
| 267 | + try { | ||
| 268 | + Map<String,Object> map = new HashMap<>(); | ||
| 269 | + if(inUse != null && inUse.equals("1")){ | ||
| 270 | + map.put("inUse_eq", inUse); | ||
| 271 | + } | ||
| 272 | + List<Line> lines ; | ||
| 273 | + Line line; | ||
| 274 | + lines = lineRepository.findAll(new CustomerSpecs<Line>(map)); | ||
| 275 | + if(lines != null && lines.size() > 0){ | ||
| 276 | + for(int i = 0 ; i < lines.size() ; i ++){ | ||
| 277 | + line = lines.get(i); | ||
| 278 | + if(line != null && line.getId() != null){ | ||
| 279 | + result.append(line.getLineCode()).append(":").append(setXL(line.getLineCode())).append(";"); | ||
| 280 | + } | ||
| 281 | + } | ||
| 282 | + } | ||
| 283 | + } catch (Exception e) { | ||
| 284 | + result.append("failure"); | ||
| 285 | + logger.error("setXLByInUse:",e); | ||
| 286 | + e.printStackTrace(); | ||
| 287 | + } | ||
| 288 | + return result.toString(); | ||
| 289 | + } | ||
| 290 | + | ||
| 291 | + /** | ||
| 292 | + * 上传车辆信息 | ||
| 293 | + */ | ||
| 294 | + @Override | ||
| 295 | + public String setCL() { | ||
| 296 | + String result = "failure"; | ||
| 297 | + StringBuffer sBuffer =new StringBuffer(); | ||
| 298 | + try { | ||
| 299 | + sBuffer.append("<CLs>"); | ||
| 300 | + Cars cars = null; | ||
| 301 | + String company; | ||
| 302 | + Iterator<Cars> carsIterator = carsRepository.findAll().iterator(); | ||
| 303 | + while(carsIterator.hasNext()){ | ||
| 304 | + cars = carsIterator.next(); | ||
| 305 | + sBuffer.append("<CL>"); | ||
| 306 | + company = cars.getCompany(); | ||
| 307 | + setCompanyName(company);// 统一公司名称 | ||
| 308 | + sBuffer.append("<GSJC>").append(company).append("</GSJC>"); | ||
| 309 | + sBuffer.append("<NBH>").append(cars.getInsideCode()).append("</NBH>"); | ||
| 310 | + sBuffer.append("<CPH>").append(cars.getCarPlate()).append("</CPH>"); | ||
| 311 | + sBuffer.append("<YYZBH>").append(cars.getServiceNo()).append("</YYZBH>"); | ||
| 312 | + sBuffer.append("<CZCPH>").append(cars.getCarPlate()).append("</CZCPH>");//******这个数据没有*********** | ||
| 313 | + sBuffer.append("<CZZDBH>").append(cars.getEquipmentCode()).append("</CZZDBH>"); | ||
| 314 | + sBuffer.append("<UPDT>").append(sdfnyrsfm.format(new Date())).append("</UPDT>"); | ||
| 315 | + sBuffer.append("</CL>"); | ||
| 316 | + } | ||
| 317 | + sBuffer.append("</CLs>"); | ||
| 318 | + if(ssop.setCL(userNameOther, passwordOther, sBuffer.toString()).isSuccess()){ | ||
| 319 | + result = "success"; | ||
| 320 | + } | ||
| 321 | + } catch (Exception e) { | ||
| 322 | + logger.error("setCL:",e); | ||
| 323 | + e.printStackTrace(); | ||
| 324 | + }finally{ | ||
| 325 | + logger.info("setCL:"+sBuffer.toString()); | ||
| 326 | + logger.info("setCL:"+result); | ||
| 327 | + } | ||
| 328 | + return result; | ||
| 329 | + } | ||
| 330 | + | ||
| 331 | + /** | ||
| 332 | + * 上传司机信息 | ||
| 333 | + */ | ||
| 334 | + @Override | ||
| 335 | + public String setSJ() { | ||
| 336 | + String result = "failure"; | ||
| 337 | + StringBuffer sBuffer =new StringBuffer(); | ||
| 338 | + try { | ||
| 339 | + sBuffer.append("<SJs>"); | ||
| 340 | + Personnel personnel = null; | ||
| 341 | + String company; | ||
| 342 | + Iterator<Personnel> personIterator = personnelRepository.findAll().iterator(); | ||
| 343 | + while(personIterator.hasNext()){ | ||
| 344 | + personnel = personIterator.next(); | ||
| 345 | + sBuffer.append("<SJ>"); | ||
| 346 | + company = personnel.getCompany(); | ||
| 347 | + setCompanyName(company);// 统一公司名称 | ||
| 348 | + sBuffer.append("<GSJC>").append(company).append("</GSJC>"); | ||
| 349 | + sBuffer.append("<SJGH>").append(personnel.getJobCode()).append("</SJGH>"); | ||
| 350 | + sBuffer.append("<CYZGZH>").append(personnel.getPapersCode()).append("</CYZGZH>");//*********** | ||
| 351 | + sBuffer.append("<XM>").append(personnel.getPersonnelName()).append("</XM>"); | ||
| 352 | + sBuffer.append("<UPDT>").append(sdfnyrsfm.format(new Date())).append("</UPDT>"); | ||
| 353 | + sBuffer.append("</SJ>"); | ||
| 354 | + } | ||
| 355 | + sBuffer.append("</SJs>"); | ||
| 356 | + if(ssop.setSJ(userNameOther, passwordOther, sBuffer.toString()).isSuccess()){ | ||
| 357 | + result = "success"; | ||
| 358 | + }; | ||
| 359 | + } catch (Exception e) { | ||
| 360 | + logger.error("setSJ:",e); | ||
| 361 | + e.printStackTrace(); | ||
| 362 | + }finally{ | ||
| 363 | + logger.info("setSJ:"+sBuffer.toString()); | ||
| 364 | + logger.info("setSJ:"+result); | ||
| 365 | + } | ||
| 366 | + return result; | ||
| 367 | + } | ||
| 368 | + | ||
| 369 | + /** | ||
| 370 | + * 上传路单 指定日期 yyyy-MM-dd | ||
| 371 | + * @param theDate | ||
| 372 | + * @return | ||
| 373 | + */ | ||
| 374 | + public String setLD(String theDate){ | ||
| 375 | + return uploadLD(theDate); | ||
| 376 | + } | ||
| 377 | + | ||
| 378 | + /** | ||
| 379 | + * 上传路单 上传前一天的路单 | ||
| 380 | + * @return | ||
| 381 | + */ | ||
| 382 | + public String setLD(){ | ||
| 383 | + return uploadLD(null); | ||
| 384 | + } | ||
| 385 | + /** | ||
| 386 | + * 上传路单 | ||
| 387 | + * @return 上传成功标识 | ||
| 388 | + */ | ||
| 389 | + private String uploadLD(String theDate){ | ||
| 390 | + // 取昨天 的日期 | ||
| 391 | + String date = theDate == null ?sdfnyr.format(DateUtils.addDays(new Date(), -1)) : theDate; | ||
| 392 | + StringBuffer sf = new StringBuffer(); | ||
| 393 | + Results results = null; | ||
| 394 | + String str = "", xlbm = null, oldXlbm = null; | ||
| 395 | + List<Map<String,Object>> listGroup = null; | ||
| 396 | + int scount = 0, ccount = 0; | ||
| 397 | + long start = System.currentTimeMillis(); | ||
| 398 | + try { | ||
| 399 | + // 计数器 | ||
| 400 | + int counter = 0; | ||
| 401 | + // 每几条线路上传一次路单 | ||
| 402 | + int per = 10; | ||
| 403 | + List<ScheduleRealInfo> list = scheduleRealInfoRepository.setLD(date); | ||
| 404 | + listGroup = scheduleRealInfoRepository.setLDGroup(date); | ||
| 405 | + Map<String,Object> map = new HashMap(); | ||
| 406 | + HashMap<String,String> paramMap; | ||
| 407 | + HashMap<String,String> otherMap = new HashMap(); | ||
| 408 | + | ||
| 409 | + // 车辆内部编码和车牌做映射 | ||
| 410 | + Map<String, String> inside2plate = new HashMap<>(); | ||
| 411 | + Iterable<Cars> cars = carsRepository.findAll(); | ||
| 412 | + for (Cars car : cars) { | ||
| 413 | + inside2plate.put(car.getInsideCode(), car.getCarPlate()); | ||
| 414 | + } | ||
| 415 | + | ||
| 416 | + // 线路编码和线路信息映射 | ||
| 417 | + Map<String, Line> code2line = new HashMap<>(); | ||
| 418 | + Iterable<Line> lines = lineRepository.findAll(); | ||
| 419 | + for (Line line : lines) { | ||
| 420 | + code2line.put(line.getLineCode(), line); | ||
| 421 | + } | ||
| 422 | + | ||
| 423 | + // 线路编码和线路版本映射(电子路单日期) | ||
| 424 | + Map<String, Integer> code2version = new HashMap<>(); | ||
| 425 | + Iterable<LineVersions> versions = lineVersionsRepository.findLineVersionsByDate((int)(DateTime.parse(date).getMillis() / 1000)); | ||
| 426 | + for (LineVersions version : versions) { | ||
| 427 | + code2version.put(version.getLineCode(), version.getVersions()); | ||
| 428 | + } | ||
| 429 | + | ||
| 430 | + Map<String, Integer> stationNumMap = null; | ||
| 431 | + for(Map<String,Object> schRealInfo:listGroup){ | ||
| 432 | + if(schRealInfo != null){ | ||
| 433 | + // 获取线路是否使用标识,如果未使用,则不查该线路数据 | ||
| 434 | + String lineCode = schRealInfo.get("xlBm")+""; | ||
| 435 | + Line line = code2line.get(lineCode); | ||
| 436 | + if(line == null || line.getInUse() == null || line.getInUse() == 0){ | ||
| 437 | + ccount++; | ||
| 438 | + continue; | ||
| 439 | + } | ||
| 440 | + if(counter % per == 0){ | ||
| 441 | + sf = new StringBuffer(); | ||
| 442 | + sf.append("<DLDS>"); | ||
| 443 | + } | ||
| 444 | + counter ++; | ||
| 445 | + xlbm = BasicData.lineCode2ShangHaiCodeMap.get(lineCode); | ||
| 446 | + if (!xlbm.equals(oldXlbm)) { | ||
| 447 | + oldXlbm = xlbm; | ||
| 448 | + Integer ver = code2version.get(lineCode); | ||
| 449 | + if (ver != null) { | ||
| 450 | + stationNumMap = getLsStationRoute(lineCode, ver); | ||
| 451 | + } | ||
| 452 | + } | ||
| 453 | + | ||
| 454 | + sf.append("<DLD>"); | ||
| 455 | + sf.append("<RQ>").append(date).append("</RQ>"); | ||
| 456 | + sf.append("<XLBM>").append(xlbm).append("</XLBM>"); | ||
| 457 | + sf.append("<LPBH>").append(schRealInfo.get("lpName")).append("</LPBH>"); | ||
| 458 | + sf.append("<CPH>").append(inside2plate.get(schRealInfo.get("clZbh"))).append("</CPH>"); | ||
| 459 | + sf.append("<UPDT>").append(sdfnyrsfm.format(new Date())).append("</UPDT>"); | ||
| 460 | + sf.append("<LDList>"); | ||
| 461 | + for(ScheduleRealInfo scheduleRealInfo:list){ | ||
| 462 | + if((schRealInfo.get("xlBm")+"").equals(scheduleRealInfo.getXlBm()) && (schRealInfo.get("lpName")+"") | ||
| 463 | + .equals(scheduleRealInfo.getLpName()) | ||
| 464 | + && (schRealInfo.get("clZbh")+"").equals(scheduleRealInfo.getClZbh())){ | ||
| 465 | + | ||
| 466 | + if(scheduleRealInfo.isDestroy()){ | ||
| 467 | + if(scheduleRealInfo.isReissue()){ | ||
| 468 | + scheduleRealInfo.setFcsjActualAll(scheduleRealInfo.getDfsj()); | ||
| 469 | + scheduleRealInfo.setZdsjActualAll(scheduleRealInfo.getZdsj()); | ||
| 470 | + } | ||
| 471 | + else | ||
| 472 | + continue; | ||
| 473 | + } | ||
| 474 | + | ||
| 475 | + if(scheduleRealInfo.getBcType().equals("in") | ||
| 476 | + || scheduleRealInfo.getBcType().equals("out")){ | ||
| 477 | + continue; | ||
| 478 | + } | ||
| 479 | + | ||
| 480 | + sf.append("<LD>"); | ||
| 481 | + sf.append("<SJGH>").append(scheduleRealInfo.getjGh()).append("</SJGH>"); | ||
| 482 | + sf.append("<SXX>").append(scheduleRealInfo.getXlDir()).append("</SXX>"); | ||
| 483 | + sf.append("<FCZDMC>").append(scheduleRealInfo.getQdzName()).append("</FCZDMC>"); | ||
| 484 | + // 起点站的参数 | ||
| 485 | + otherMap.put("stationMark","B"); | ||
| 486 | + paramMap = packageYgcStationNumParam(scheduleRealInfo,otherMap); | ||
| 487 | + sf.append("<FCZDXH>").append(getYgcStationNumByLineCodeAndDirectionAndStationName(paramMap,stationNumMap)).append("</FCZDXH>"); | ||
| 488 | + sf.append("<FCZDBM>").append(scheduleRealInfo.getQdzCode()).append("</FCZDBM>"); | ||
| 489 | + sf.append("<JHFCSJ>").append(scheduleRealInfo.getFcsj()).append("</JHFCSJ>"); | ||
| 490 | + sf.append("<DFSJ>").append(scheduleRealInfo.getDfsj()).append("</DFSJ>"); | ||
| 491 | + sf.append("<SJFCSJ>").append(scheduleRealInfo.getFcsjActual()).append("</SJFCSJ>"); | ||
| 492 | + sf.append("<FCZDLX></FCZDLX>"); | ||
| 493 | + sf.append("<DDZDMC>").append(scheduleRealInfo.getZdzName()).append("</DDZDMC>"); | ||
| 494 | + // 终点站的参数 | ||
| 495 | + otherMap.put("stationMark","E"); | ||
| 496 | + paramMap = packageYgcStationNumParam(scheduleRealInfo,otherMap); | ||
| 497 | + sf.append("<DDZDXH>").append(getYgcStationNumByLineCodeAndDirectionAndStationName(paramMap,stationNumMap)).append("</DDZDXH>"); | ||
| 498 | + sf.append("<DDZDBM>").append(scheduleRealInfo.getZdzCode()).append("</DDZDBM>"); | ||
| 499 | + sf.append("<JHDDSJ>").append(scheduleRealInfo.getZdsj()).append("</JHDDSJ>"); | ||
| 500 | + sf.append("<SJDDSJ>").append(scheduleRealInfo.getZdsjActual()).append("</SJDDSJ>"); | ||
| 501 | + sf.append("<DDZDLX></DDZDLX>"); | ||
| 502 | + sf.append("<LDSCBZ>0</LDSCBZ>"); | ||
| 503 | + sf.append("<DDBZ>").append("").append("</DDBZ>"); | ||
| 504 | + sf.append("</LD>"); | ||
| 505 | + } | ||
| 506 | + } | ||
| 507 | + sf.append("</LDList>"); | ||
| 508 | + sf.append("</DLD>"); | ||
| 509 | + } | ||
| 510 | + if(counter % per == per - 1){ | ||
| 511 | + sf.append("</DLDS>"); | ||
| 512 | + // 去掉'号 | ||
| 513 | + str = sf.toString().replace("'",""); | ||
| 514 | + scount += invokeSetLD(str, counter); | ||
| 515 | + counter = 0; | ||
| 516 | + } | ||
| 517 | + } | ||
| 518 | + // 每per条线路上传后剩下的数据再上传 | ||
| 519 | + if(counter > 0){ | ||
| 520 | + sf.append("</DLDS>"); | ||
| 521 | + // 去掉'号 | ||
| 522 | + str = sf.toString().replace("'",""); | ||
| 523 | + scount += invokeSetLD(str, counter); | ||
| 524 | + } | ||
| 525 | + } catch (Exception e) { | ||
| 526 | + e.printStackTrace(); | ||
| 527 | + logger.error("setLD:", e); | ||
| 528 | + } finally { | ||
| 529 | + try { | ||
| 530 | + //发送邮件 | ||
| 531 | + EmailBean mail = new EmailBean(); | ||
| 532 | + mail.setSubject(IpUtils.getLocalIpAddress() +":路单日志数据"+date); | ||
| 533 | + mail.setContent("总数:" + (listGroup == null ? 0 : listGroup.size()) + "<br/>成功数:" + scount + "<br/>跳过数:" + ccount + "<br/>耗时:" + (System.currentTimeMillis() - start)); | ||
| 534 | + sendEmailController.sendMail(emailSendToAddress, mail); | ||
| 535 | + logger.info("setLD-sendMail:邮件发送成功!"); | ||
| 536 | + } catch (Exception e) { | ||
| 537 | + e.printStackTrace(); | ||
| 538 | + logger.error("setLD-sendMail:",e); | ||
| 539 | + } | ||
| 540 | + } | ||
| 541 | + return "success"; | ||
| 542 | + } | ||
| 543 | + | ||
| 544 | + /** | ||
| 545 | + * 调用运管处电子路单接口,如果上传失败或有网络问题,最多执行10次 | ||
| 546 | + * @param xml 拼接的xml字符串 | ||
| 547 | + * @param counter 分组数 | ||
| 548 | + * @return 成功返回counter 失败返回0 | ||
| 549 | + */ | ||
| 550 | + private int invokeSetLD(String xml, int counter) { | ||
| 551 | + for (int i = 0;i < 10;i++) { | ||
| 552 | + try { | ||
| 553 | + Results results = ssop.setLD(userNameOther, passwordOther, StringEscapeUtils.unescapeHtml(xml)); | ||
| 554 | + if (results.isSuccess()) { | ||
| 555 | + logger.info("setLD: " + xml); | ||
| 556 | + logger.info("setLD: 成功"); | ||
| 557 | + return counter; | ||
| 558 | + } else if (i == 9) { | ||
| 559 | + logger.error("setLD: " + xml); | ||
| 560 | + logger.error("setLD: 失败," + results.getMessage()); | ||
| 561 | + } | ||
| 562 | + Thread.sleep(2000); | ||
| 563 | + } catch (Exception e) { | ||
| 564 | + logger.error("运管处接口调用异常", e); | ||
| 565 | + try { | ||
| 566 | + Thread.sleep(2000); | ||
| 567 | + } catch (InterruptedException ex) { | ||
| 568 | + ex.printStackTrace(); | ||
| 569 | + } | ||
| 570 | + } | ||
| 571 | + } | ||
| 572 | + | ||
| 573 | + return 0; | ||
| 574 | + } | ||
| 575 | + | ||
| 576 | + /** | ||
| 577 | + * 上传路单 xml来自文件 | ||
| 578 | + * @return 上传成功标识 | ||
| 579 | + */ | ||
| 580 | + public String setLDFile(){ | ||
| 581 | + String result = "failure"; | ||
| 582 | + try { | ||
| 583 | + String tmp = readXmlFromFile("E:/ld.txt"); | ||
| 584 | + Results rss = ssop.setLD(userNameOther, passwordOther, StringEscapeUtils.unescapeHtml(tmp)); | ||
| 585 | + if(rss.isSuccess()){ | ||
| 586 | + result = "success"; | ||
| 587 | + } | ||
| 588 | + } catch (Exception e) { | ||
| 589 | + logger.error("setLD:",e); | ||
| 590 | + e.printStackTrace(); | ||
| 591 | + }finally{ | ||
| 592 | + | ||
| 593 | + } | ||
| 594 | + return result; | ||
| 595 | + } | ||
| 596 | + | ||
| 597 | + /** | ||
| 598 | + * 从文件中读取xml | ||
| 599 | + * @param fileName 例:D:/test.txt | ||
| 600 | + * @return | ||
| 601 | + * @throws Exception | ||
| 602 | + */ | ||
| 603 | + private String readXmlFromFile(String fileName) throws Exception { | ||
| 604 | + StringBuffer sf = new StringBuffer(""); | ||
| 605 | + File file = new File(fileName); | ||
| 606 | + InputStreamReader reader = new InputStreamReader(new FileInputStream(file),"GBK"); | ||
| 607 | + BufferedReader bufferedReader = new BufferedReader(reader); | ||
| 608 | + String lineTxt = ""; | ||
| 609 | + while((lineTxt = bufferedReader.readLine()) != null){ | ||
| 610 | + sf.append(lineTxt); | ||
| 611 | + } | ||
| 612 | + reader.close(); | ||
| 613 | + return sf.toString().replaceAll("\t",""); | ||
| 614 | + } | ||
| 615 | + /** | ||
| 616 | + * 上传里程油耗 | ||
| 617 | + * @return 上传成功标识 | ||
| 618 | + */ | ||
| 619 | + public String setLCYH(){ | ||
| 620 | + String result = "failure"; | ||
| 621 | + // 取昨天 的日期 | ||
| 622 | + String date = sdfnyr.format(DateUtils.addDays(new Date(), -1)); | ||
| 623 | + StringBuffer sf = new StringBuffer(); | ||
| 624 | + try { | ||
| 625 | + sf.append("<LCYHS>"); | ||
| 626 | + List<Map<String,Object>> listGroup = scheduleRealInfoRepository.setLCYHGroup(date); | ||
| 627 | + List<ScheduleRealInfo> list = scheduleRealInfoRepository.findByDate(date); | ||
| 628 | + Map<String,Object> map = new HashMap<String,Object>(); | ||
| 629 | + for(Map<String,Object> schRealInfo:listGroup){ | ||
| 630 | + if(schRealInfo != null){ | ||
| 631 | + map.put("insideCode_eq", schRealInfo.get("clZbh")+""); | ||
| 632 | + Optional<Cars> optionalCars = carsRepository.findOne(new CustomerSpecs<Cars>(map)); | ||
| 633 | + Cars car = optionalCars.isPresent() ? optionalCars.get() : null; | ||
| 634 | + /** | ||
| 635 | + * 如果car==null,则说明该车辆是从线调中换车功能中加进去的, | ||
| 636 | + * 在cars基础信息中查不到车辆的信息,所以忽略该车辆 | ||
| 637 | + */ | ||
| 638 | + if(car == null){ | ||
| 639 | + continue; | ||
| 640 | + } | ||
| 641 | + //计算总公里和空驶公里,营运公里=总公里-空驶公里 | ||
| 642 | + double totalKilometers = 0,emptyKilometers =0; | ||
| 643 | + sf.append("<LCYH>"); | ||
| 644 | + sf.append("<RQ>"+date+"</RQ>"); | ||
| 645 | + sf.append("<XLBM>"+BasicData.lineCode2ShangHaiCodeMap.get(schRealInfo.get("xlBm"))+"</XLBM>"); | ||
| 646 | + sf.append("<CPH>"+car.getCarPlate()+"</CPH>"); | ||
| 647 | + if(list != null && list.size() > 0){ | ||
| 648 | + for(ScheduleRealInfo scheduleRealInfo:list){ | ||
| 649 | + if((schRealInfo.get("xlBm")+"").equals(scheduleRealInfo.getXlBm()) && (schRealInfo.get("clZbh")+"") | ||
| 650 | + .equals(scheduleRealInfo.getClZbh())){ | ||
| 651 | + Set<ChildTaskPlan> childTaskPlans = scheduleRealInfo.getcTasks(); | ||
| 652 | + //如果没有子任务,里程就是已执行(Status=2);有子任务的,忽略主任务,子任务的烂班 | ||
| 653 | + if(childTaskPlans.isEmpty()){ | ||
| 654 | + if(scheduleRealInfo.getStatus() == 2){ | ||
| 655 | + totalKilometers += scheduleRealInfo.getJhlc()==null?0.0:scheduleRealInfo.getJhlc(); | ||
| 656 | + if(scheduleRealInfo.getBcType().equals("in") || scheduleRealInfo.getBcType().equals("out") | ||
| 657 | + || scheduleRealInfo.getBcType().equals("venting")){ | ||
| 658 | + emptyKilometers += scheduleRealInfo.getJhlc()==null?0.0:scheduleRealInfo.getJhlc(); | ||
| 659 | + } | ||
| 660 | + } | ||
| 661 | + }else{ | ||
| 662 | + Iterator<ChildTaskPlan> it = childTaskPlans.iterator(); | ||
| 663 | + while(it.hasNext()){ | ||
| 664 | + ChildTaskPlan childTaskPlan = it.next(); | ||
| 665 | + if(!childTaskPlan.isDestroy()){ | ||
| 666 | + totalKilometers += childTaskPlan.getMileage()==null?0.0:childTaskPlan.getMileage(); | ||
| 667 | + if(childTaskPlan.getMileageType().equals("empty")){ | ||
| 668 | + emptyKilometers += childTaskPlan.getMileage()==null?0.0:childTaskPlan.getMileage();; | ||
| 669 | + } | ||
| 670 | + } | ||
| 671 | + } | ||
| 672 | + } | ||
| 673 | + } | ||
| 674 | + } | ||
| 675 | + } | ||
| 676 | + sf.append("<ZLC>"+totalKilometers+"</ZLC>"); | ||
| 677 | + sf.append("<YYLC>"+emptyKilometers+"</YYLC>"); | ||
| 678 | + sf.append("<YH>"+""+"</YH>"); | ||
| 679 | + sf.append("<JZYL>"+""+"</JZYL>"); | ||
| 680 | + sf.append("<DH>"+""+"</DH>"); | ||
| 681 | + sf.append("<UPDT>"+sdfnyrsfm.format(new Date())+"</UPDT>"); | ||
| 682 | + sf.append("<BBSCBZ>"+0+"</BBSCBZ>"); | ||
| 683 | + sf.append("</LCYH>"); | ||
| 684 | + } | ||
| 685 | + } | ||
| 686 | + sf.append("</LCYHS>"); | ||
| 687 | + if(ssop.setLCYH(userNameOther, passwordOther, sf.toString()).isSuccess()){ | ||
| 688 | + result = "success"; | ||
| 689 | + } | ||
| 690 | + } catch (Exception e) { | ||
| 691 | + logger.error("setLCYH:",e); | ||
| 692 | + e.printStackTrace(); | ||
| 693 | + }finally{ | ||
| 694 | + logger.info("setLCYH:"+sf.toString()); | ||
| 695 | + logger.info("setLCYH:"+result); | ||
| 696 | + } | ||
| 697 | + return result; | ||
| 698 | + } | ||
| 699 | + | ||
| 700 | + /** | ||
| 701 | + * 上传线路调度日报 | ||
| 702 | + * @return | ||
| 703 | + */ | ||
| 704 | + public String setDDRB(){ | ||
| 705 | + String result = "failure"; | ||
| 706 | + // 取昨天 的日期 | ||
| 707 | + String date = sdfnyr.format(DateUtils.addDays(new Date(), -1)); | ||
| 708 | + StringBuffer sf = new StringBuffer(); | ||
| 709 | + try { | ||
| 710 | + sf.append("<DDRBS>"); | ||
| 711 | + List<Map<String,Object>> listGroup = scheduleRealInfoRepository.setDDRBGroup(date); | ||
| 712 | + List<ScheduleRealInfo> list = scheduleRealInfoRepository.findByDate(date); | ||
| 713 | + for(Map<String,Object> schRealInfo:listGroup){ | ||
| 714 | + if(schRealInfo != null){ | ||
| 715 | + double jhlc = 0,zlc = 0,jhkslc = 0,sjkslc = 0; | ||
| 716 | + int jhbc = 0,sjbc = 0,jhzgfbc = 0,sjzgfbc = 0,jhwgfbc = 0,sjwgfbc = 0; | ||
| 717 | + sf.append("<DDRB>"); | ||
| 718 | + sf.append("<RQ>"+date+"</RQ>"); | ||
| 719 | + sf.append("<XLBM>"+BasicData.lineCode2ShangHaiCodeMap.get(schRealInfo.get("xlBm"))+"</XLBM>"); | ||
| 720 | + for(ScheduleRealInfo scheduleRealInfo:list){ | ||
| 721 | + if(scheduleRealInfo != null){ | ||
| 722 | + if((schRealInfo.get("xlBm")+"").equals(scheduleRealInfo.getXlBm())){ | ||
| 723 | + //计划 | ||
| 724 | + if(!scheduleRealInfo.isSflj()){ | ||
| 725 | + jhlc += scheduleRealInfo.getJhlc()==null?0.0:scheduleRealInfo.getJhlc(); | ||
| 726 | + //计划空驶 | ||
| 727 | + if(scheduleRealInfo.getBcType().equals("in") || scheduleRealInfo.getBcType().equals("out")){ | ||
| 728 | + jhkslc += scheduleRealInfo.getJhlc()==null?0.0:scheduleRealInfo.getJhlc(); | ||
| 729 | + } | ||
| 730 | + //计划早高峰,计划晚高峰 | ||
| 731 | + if(TimeUtils.morningPeak(scheduleRealInfo.getFcsj())){ | ||
| 732 | + jhzgfbc++; | ||
| 733 | + } else if(TimeUtils.evenignPeak(scheduleRealInfo.getFcsj())){ | ||
| 734 | + jhwgfbc++; | ||
| 735 | + } | ||
| 736 | + } | ||
| 737 | + jhbc++; | ||
| 738 | + | ||
| 739 | + //实际 | ||
| 740 | + Set<ChildTaskPlan> childTaskPlans = scheduleRealInfo.getcTasks(); | ||
| 741 | + //如果没有子任务,里程就是已执行(Status=2);有子任务的,忽略主任务,子任务的烂班 | ||
| 742 | + if(childTaskPlans.isEmpty()){ | ||
| 743 | + if(scheduleRealInfo.getStatus() == 2){ | ||
| 744 | + sjbc++; | ||
| 745 | + zlc += scheduleRealInfo.getJhlc()==null?0.0:scheduleRealInfo.getJhlc(); | ||
| 746 | + if(scheduleRealInfo.getBcType().equals("in") || scheduleRealInfo.getBcType().equals("out") | ||
| 747 | + || scheduleRealInfo.getBcType().equals("venting")){ | ||
| 748 | + sjkslc += scheduleRealInfo.getJhlc()==null?0.0:scheduleRealInfo.getJhlc();; | ||
| 749 | + } | ||
| 750 | + } | ||
| 751 | + }else{ | ||
| 752 | + sjbc++; | ||
| 753 | + Iterator<ChildTaskPlan> it = childTaskPlans.iterator(); | ||
| 754 | + while(it.hasNext()){ | ||
| 755 | + ChildTaskPlan childTaskPlan = it.next(); | ||
| 756 | + if(!childTaskPlan.isDestroy()){ | ||
| 757 | + zlc += childTaskPlan.getMileage()==null?0.0:childTaskPlan.getMileage(); | ||
| 758 | + if(childTaskPlan.getMileageType().equals("empty")){ | ||
| 759 | + sjkslc += childTaskPlan.getMileage()==null?0.0:childTaskPlan.getMileage();; | ||
| 760 | + } | ||
| 761 | + } | ||
| 762 | + } | ||
| 763 | + } | ||
| 764 | + //实际早高峰,计划晚高峰 | ||
| 765 | + if(scheduleRealInfo.getFcsjActual() != null){ | ||
| 766 | + if(TimeUtils.morningPeak(scheduleRealInfo.getFcsj())){ | ||
| 767 | + sjzgfbc++; | ||
| 768 | + } else if(TimeUtils.evenignPeak(scheduleRealInfo.getFcsj())){ | ||
| 769 | + sjwgfbc++; | ||
| 770 | + } | ||
| 771 | + } | ||
| 772 | + } | ||
| 773 | + } | ||
| 774 | + } | ||
| 775 | + sf.append("<JHLC>"+format.format(jhlc)+"</JHLC>"); | ||
| 776 | + sf.append("<SSLC>"+format.format((zlc-sjkslc))+"</SSLC>"); | ||
| 777 | + sf.append("<JHKSLC>"+format.format(jhkslc)+"</JHKSLC>"); | ||
| 778 | + sf.append("<SJKSLC>"+format.format(sjkslc)+"</SJKSLC>"); | ||
| 779 | + sf.append("<JHBC>"+jhbc+"</JHBC>"); | ||
| 780 | + sf.append("<SJBC>"+sjbc+"</SJBC>"); | ||
| 781 | + sf.append("<JHZGFBC>"+jhzgfbc+"</JHZGFBC>"); | ||
| 782 | + sf.append("<SJZGFBC>"+sjzgfbc+"</SJZGFBC>"); | ||
| 783 | + sf.append("<JHWGFBC>"+jhwgfbc+"</JHWGFBC>"); | ||
| 784 | + sf.append("<SJWGFBC>"+sjwgfbc+"</SJWGFBC>"); | ||
| 785 | + sf.append("<UPDT>"+sdfnyrsfm.format(new Date())+"</UPDT>"); | ||
| 786 | + sf.append("<RBSCBZ>"+0+"</RBSCBZ>"); | ||
| 787 | + sf.append("</DDRB>"); | ||
| 788 | + } | ||
| 789 | + } | ||
| 790 | + sf.append("</DDRBS>"); | ||
| 791 | + if(ssop.setDDRB(userNameOther, passwordOther, sf.toString()).isSuccess()){ | ||
| 792 | + result = "success"; | ||
| 793 | + } | ||
| 794 | + } catch (Exception e) { | ||
| 795 | + logger.error("setDDRB:",e); | ||
| 796 | + e.printStackTrace(); | ||
| 797 | + }finally{ | ||
| 798 | + logger.info("setDDRB:"+sf.toString()); | ||
| 799 | + logger.info("setDDRB:"+result); | ||
| 800 | + } | ||
| 801 | + return result; | ||
| 802 | + } | ||
| 803 | + | ||
| 804 | + /** | ||
| 805 | + * 上传计划班次 指定日期 yyyy-MM-dd | ||
| 806 | + * @param theDate | ||
| 807 | + * @return | ||
| 808 | + */ | ||
| 809 | + public String setJHBC(String theDate){ | ||
| 810 | + return uploadJHBC(theDate); | ||
| 811 | + } | ||
| 812 | + | ||
| 813 | + /** | ||
| 814 | + * 上传计划班次 | ||
| 815 | + * @return | ||
| 816 | + */ | ||
| 817 | + public String setJHBC(){ | ||
| 818 | + return uploadJHBC(null); | ||
| 819 | + } | ||
| 820 | + /** | ||
| 821 | + * 上传线路计划班次表 | ||
| 822 | + */ | ||
| 823 | + | ||
| 824 | + private String uploadJHBC(String theDate) { | ||
| 825 | + String result = "failure"; | ||
| 826 | + Line line; | ||
| 827 | + StringBuffer sBuffer =new StringBuffer(); | ||
| 828 | + try { | ||
| 829 | + sBuffer.append("<JHBCs>"); | ||
| 830 | + // 声明变量 | ||
| 831 | + SchedulePlanInfo schedulePlanInfo; | ||
| 832 | + String xlbm,zbh = ""; | ||
| 833 | + Long lp = 0L; | ||
| 834 | + // 取得计划班次时间 | ||
| 835 | + String tomorrow = theDate == null ? sdfnyr.format(DateUtils.addDays(new Date(), +1)) : theDate; | ||
| 836 | + // 查询所有班次 | ||
| 837 | + List<SchedulePlanInfo> schedulePlanList = schedulePlanInfoRepository.findLineScheduleBc(tomorrow); | ||
| 838 | + int j = 0; // 初始化标识 | ||
| 839 | + if(schedulePlanList != null ){ | ||
| 840 | + HashMap<String,String> paramMap; | ||
| 841 | + HashMap<String,String> otherMap = new HashMap<String, String>(); | ||
| 842 | + int size = schedulePlanList.size(); | ||
| 843 | + for (int i = 0; i < size; i++) { | ||
| 844 | + schedulePlanInfo = schedulePlanList.get(i); | ||
| 845 | + xlbm = schedulePlanInfo.getXlBm(); | ||
| 846 | + // 获取线路是否使用标识,如果未使用,则不查该线路数据 | ||
| 847 | + line = lineRepository.findByLineCode(xlbm); | ||
| 848 | + if(line.getInUse() == null || line.getInUse() == 0){ | ||
| 849 | + continue; | ||
| 850 | + } | ||
| 851 | + if(++j == 1){// 第一次,则初始化值 | ||
| 852 | + zbh = schedulePlanInfo.getClZbh(); | ||
| 853 | + lp = schedulePlanInfo.getLp(); | ||
| 854 | + // 拼装XML | ||
| 855 | + assembleJHBC(sBuffer, schedulePlanInfo, xlbm, zbh, lp); | ||
| 856 | + } | ||
| 857 | + // 比较是否为同一条线路同一辆车 | ||
| 858 | + if(xlbm.equals(schedulePlanInfo.getXlBm()) | ||
| 859 | + && zbh.equals(schedulePlanInfo.getClZbh()) | ||
| 860 | + && lp == schedulePlanInfo.getLp()){ | ||
| 861 | + if(schedulePlanInfo.getBcType().equals("in") || schedulePlanInfo.getBcType().equals("out")){ | ||
| 862 | + continue; | ||
| 863 | + } | ||
| 864 | + sBuffer.append("<BC>"); | ||
| 865 | + sBuffer.append("<SJGH>").append(schedulePlanInfo.getjGh()).append("</SJGH>"); | ||
| 866 | + sBuffer.append("<SXX>").append(schedulePlanInfo.getXlDir()).append("</SXX>"); | ||
| 867 | + sBuffer.append("<FCZDMC>").append(schedulePlanInfo.getQdzName()).append("</FCZDMC>"); | ||
| 868 | + // 起点站的参数 | ||
| 869 | + otherMap.put("stationMark","B"); | ||
| 870 | + paramMap = packageYgcStationNumParam(schedulePlanInfo,otherMap); | ||
| 871 | + sBuffer.append("<ZDXH>").append(getYgcStationNumByLineCodeAndDirectionAndStationName(paramMap,null)).append("</ZDXH>"); | ||
| 872 | + sBuffer.append("<JHFCSJ>").append(schedulePlanInfo.getFcsj()).append("</JHFCSJ>"); | ||
| 873 | + sBuffer.append("<DDZDMC>").append(schedulePlanInfo.getZdzName()).append("</DDZDMC>"); | ||
| 874 | + // 起点站的参数 | ||
| 875 | + otherMap.put("stationMark","E"); | ||
| 876 | + paramMap = packageYgcStationNumParam(schedulePlanInfo,otherMap); | ||
| 877 | + sBuffer.append("<DDXH>").append(getYgcStationNumByLineCodeAndDirectionAndStationName(paramMap,null)).append("</DDXH>"); | ||
| 878 | + sBuffer.append("<JHDDSJ>").append(calcDdsj(schedulePlanInfo.getFcsj(),schedulePlanInfo.getBcsj())) | ||
| 879 | + .append("</JHDDSJ>"); | ||
| 880 | + sBuffer.append("</BC>"); | ||
| 881 | + if(i == size -1 ){ | ||
| 882 | + sBuffer.append("</BCList>"); | ||
| 883 | + sBuffer.append("</JHBC>"); | ||
| 884 | + } | ||
| 885 | + }else{ | ||
| 886 | + zbh = schedulePlanInfo.getClZbh(); | ||
| 887 | + lp = schedulePlanInfo.getLp(); | ||
| 888 | + sBuffer.append("</BCList>"); | ||
| 889 | + sBuffer.append("</JHBC>"); | ||
| 890 | + // 拼装XML | ||
| 891 | + assembleJHBC(sBuffer, schedulePlanInfo, xlbm, zbh, lp); | ||
| 892 | + } | ||
| 893 | + } | ||
| 894 | + } | ||
| 895 | + // 判断XML是否以</BCList>结尾,如果不是,则加上 | ||
| 896 | + String regex = "^*</JHBC>$"; | ||
| 897 | + Pattern p = Pattern.compile(regex); | ||
| 898 | + Matcher m = p.matcher(sBuffer); | ||
| 899 | + boolean isEndWithTrueFlag = false; | ||
| 900 | + while (m.find()) { | ||
| 901 | + isEndWithTrueFlag = true; | ||
| 902 | + } | ||
| 903 | + // 加上缺失的标签 | ||
| 904 | + if(!isEndWithTrueFlag){ | ||
| 905 | + sBuffer.append("</BCList>"); | ||
| 906 | + sBuffer.append("</JHBC>"); | ||
| 907 | + } | ||
| 908 | + sBuffer.append("</JHBCs>"); | ||
| 909 | + if(ssop.setJHBC(userNameOther, passwordOther, sBuffer.toString()).isSuccess()){ | ||
| 910 | + result = "success"; | ||
| 911 | + } | ||
| 912 | + } catch (Exception e) { | ||
| 913 | + logger.error("setJHBC:",e); | ||
| 914 | + e.printStackTrace(); | ||
| 915 | + }finally{ | ||
| 916 | + logger.info("setJHBC:"+sBuffer.toString()); | ||
| 917 | + logger.info("setJHBC:"+result); | ||
| 918 | + } | ||
| 919 | + return result; | ||
| 920 | + } | ||
| 921 | + | ||
| 922 | + /** | ||
| 923 | + * 上传线路班次时刻表数据 | ||
| 924 | + */ | ||
| 925 | + @Override | ||
| 926 | + public String setSKB(String ids, String qyrqs) { | ||
| 927 | + String result = "上传失败,"; | ||
| 928 | + StringBuffer sBuffer = new StringBuffer("<SKBs>"); | ||
| 929 | + DecimalFormat df = new DecimalFormat("######0.000"); | ||
| 930 | + Map<String,String> lsStationCode2NameMap = null; | ||
| 931 | + Map<String, Integer> lsStationName2YgcNumber = null; | ||
| 932 | + try { | ||
| 933 | + String[] idArray = ids.split(","), qyrqArray = qyrqs.split(","); | ||
| 934 | + StringBuffer sBufferA ,sBufferB ,sBufferC ; | ||
| 935 | + double zlc,yylc,singleLc,emptyLc;// 总里程、营运里程、单程、空放里程 | ||
| 936 | + String bcType,sxx;// 班次类型、上下行 | ||
| 937 | + // 上传的时刻表集合 | ||
| 938 | + List<TTInfo> ttinfoList = new ArrayList<>(); | ||
| 939 | + TTInfo ttInfo; | ||
| 940 | + TTInfoDetail ttInfoDetail; | ||
| 941 | + LineInformation lineInformation; | ||
| 942 | + Iterator<TTInfoDetail> ttInfoDetailIterator; | ||
| 943 | + HashMap<String,Object> param ; | ||
| 944 | + HashMap<String,String> paramMap; | ||
| 945 | + HashMap<String,String> otherMap = new HashMap<>(); | ||
| 946 | + // 线路编码、周几执行、发车站点名称、发车站点序号、到达站点名称、到达站点序号 | ||
| 947 | + String xlbm,zjzx,fczdmc,zdxh,ddzdmc,ddxh; | ||
| 948 | + // 得到时刻表版本号 | ||
| 949 | + int lineVersion; | ||
| 950 | + long ttinfoId; | ||
| 951 | + // 是否输出站点信息 | ||
| 952 | + boolean isLogStation; | ||
| 953 | + for (int i = 0; i < idArray.length; i++) { | ||
| 954 | + ttinfoId = Long.valueOf(idArray[i]); | ||
| 955 | + Optional<TTInfo> optionalTTInfo = ttInfoRepository.findById(ttinfoId); | ||
| 956 | + ttInfo = optionalTTInfo.isPresent() ? optionalTTInfo.get() : null; | ||
| 957 | + if(ttInfo == null) | ||
| 958 | + continue; | ||
| 959 | + ttinfoList.add(ttInfo); // 保存时刻表 | ||
| 960 | + // 得到时刻表版本号 | ||
| 961 | + lineVersion = ttInfo.getLineVersion(); | ||
| 962 | + // 查询历史站点路由 | ||
| 963 | + lsStationCode2NameMap = getLsStationCode(ttInfo.getXl().getLineCode(),lineVersion); | ||
| 964 | + // 查询历史站点路由 | ||
| 965 | + lsStationName2YgcNumber = getLsStationRoute(ttInfo.getXl().getLineCode(),lineVersion); | ||
| 966 | + zlc = 0.0f; | ||
| 967 | + yylc = 0.0f; | ||
| 968 | + // 获得时刻表 | ||
| 969 | + param = new HashMap(); | ||
| 970 | + param.put("ttinfo.id_eq", ttInfo.getId()); | ||
| 971 | + ttInfoDetailIterator = ttInfoDetailRepository.findAll(new CustomerSpecs<TTInfoDetail>(param), | ||
| 972 | + new Sort(Direction.ASC, "xlDir")).iterator(); | ||
| 973 | + // 获得lineInformation | ||
| 974 | + param = new HashMap(); | ||
| 975 | + param.put("line.id_eq", ttInfo.getXl().getId()); | ||
| 976 | + Optional<LineInformation> optionalLineInformation = lineInformationRepository.findOne(new CustomerSpecs<LineInformation>(param)); | ||
| 977 | + lineInformation = optionalLineInformation.isPresent() ? optionalLineInformation.get() : null; | ||
| 978 | + // 初始化 | ||
| 979 | + isLogStation = true; | ||
| 980 | + if(ttInfoDetailIterator.hasNext()){ | ||
| 981 | + // 得到线路信息 | ||
| 982 | + Optional<Line> optionalLine = lineRepository.findById(ttInfo.getXl().getId()); | ||
| 983 | + Line line = optionalLine.isPresent() ? optionalLine.get() : null; | ||
| 984 | + if(line == null){ | ||
| 985 | + result += "未找到相应的线路信息,请设置线路信息后再上传"; | ||
| 986 | + return result; | ||
| 987 | + } | ||
| 988 | + // 得到上海市线路编码 | ||
| 989 | + xlbm = line.getShanghaiLinecode(); | ||
| 990 | + if("".equals(xlbm) || "null".equals(xlbm)){ | ||
| 991 | + result += "线路编码为空,请设置线路编码后再上传"; | ||
| 992 | + return result; | ||
| 993 | + } | ||
| 994 | + // 拿到周几执行 | ||
| 995 | + zjzx = changeRuleDay(ttInfo.getRule_days()); | ||
| 996 | + if("".equals(zjzx) || "null".equals(zjzx)){ | ||
| 997 | + result += "时刻表执行时间为空,请设置执行时间后再上传"; | ||
| 998 | + return result; | ||
| 999 | + } | ||
| 1000 | + sBuffer.append("<SKB>"); | ||
| 1001 | + sBuffer.append("<XLBM>").append(xlbm).append("</XLBM>"); | ||
| 1002 | + sBufferB = new StringBuffer(); | ||
| 1003 | + sBufferC = new StringBuffer(); | ||
| 1004 | + sBufferB.append("<KSRQ>").append(qyrqArray[i]).append("</KSRQ>"); | ||
| 1005 | + // 结束日期暂时不要,节假日的班次表才需要,如春节的班次表 | ||
| 1006 | + sBufferB.append("<JSRQ>").append("").append("</JSRQ>"); | ||
| 1007 | + sBufferB.append("<ZJZX>").append(zjzx).append("</ZJZX>"); | ||
| 1008 | + sBufferB.append("<TBYY>").append("").append("</TBYY>"); | ||
| 1009 | + sBufferB.append("<UPDT>").append(sdfnyrsfm.format(new Date())).append("</UPDT>"); | ||
| 1010 | + sBufferB.append("<BCList>"); | ||
| 1011 | + while (ttInfoDetailIterator.hasNext()) { | ||
| 1012 | + ttInfoDetail = ttInfoDetailIterator.next(); | ||
| 1013 | + bcType = ttInfoDetail.getBcType(); | ||
| 1014 | + sxx = ttInfoDetail.getXlDir(); | ||
| 1015 | + // 进出场班次的里程,加入总里程 | ||
| 1016 | + if(bcType.equals("in") || bcType.equals("out")){ | ||
| 1017 | + // 进出班次的计划里程,算空驶里程 | ||
| 1018 | + emptyLc = ttInfoDetail.getJhlc(); | ||
| 1019 | + // 总里程需要加上空驶里程 | ||
| 1020 | + zlc += emptyLc; | ||
| 1021 | + continue; | ||
| 1022 | + } | ||
| 1023 | + // 不是正常班次,不传到运管处 | ||
| 1024 | + if(!bcType.equals("normal")){ | ||
| 1025 | + continue; | ||
| 1026 | + } | ||
| 1027 | + // 如果发车时间格式错误,忽略此条 | ||
| 1028 | + if(changeTimeFormat(ttInfoDetail) == null){ | ||
| 1029 | + continue; | ||
| 1030 | + } | ||
| 1031 | + // 发生站点名称 | ||
| 1032 | + fczdmc = lsStationCode2NameMap.get(ttInfoDetail.getXl().getLineCode()+"_"+ttInfoDetail.getXlDir()+"_"+ttInfoDetail.getQdzCode()); | ||
| 1033 | + if("".equals(fczdmc) || "null".equals(fczdmc)){ | ||
| 1034 | + result += "发车站点名称为空,请根据时刻表当前的版本号设置好历史站点路由再上传"; | ||
| 1035 | + return result; | ||
| 1036 | + } | ||
| 1037 | + sBufferC.append("<BC>"); | ||
| 1038 | + sBufferC.append("<LPBH>").append(ttInfoDetail.getLp().getLpNo()).append("</LPBH>"); | ||
| 1039 | + sBufferC.append("<SXX>").append(sxx).append("</SXX>"); | ||
| 1040 | + sBufferC.append("<FCZDMC>").append(fczdmc).append("</FCZDMC>"); | ||
| 1041 | + // 起点站的参数 | ||
| 1042 | + otherMap.put("stationMark","B"); | ||
| 1043 | + paramMap = packageYgcStationNumParam(ttInfoDetail,otherMap); | ||
| 1044 | + if(isLogStation){// 输出起点站信息 | ||
| 1045 | + logger.info("setSKB:"+"起点站信息:"+paramMap); | ||
| 1046 | + } | ||
| 1047 | + // 发车站点序号 | ||
| 1048 | + zdxh = String.valueOf(getYgcStationNumByLineCodeAndDirectionAndStationName(paramMap,lsStationName2YgcNumber)); | ||
| 1049 | + if("".equals(zdxh) || "null".equals(zdxh) || "0".equals(zdxh)){ | ||
| 1050 | + result += "发车站点序号为空,请根据时刻表当前的版本号设置好历史站点路由再上传"; | ||
| 1051 | + return result; | ||
| 1052 | + } | ||
| 1053 | + // 到达站点名称 | ||
| 1054 | + ddzdmc = lsStationCode2NameMap.get(ttInfoDetail.getXl().getLineCode()+"_"+ttInfoDetail.getXlDir()+"_"+ttInfoDetail.getZdzCode()); | ||
| 1055 | + if("".equals(ddzdmc) || "null".equals(ddzdmc)){ | ||
| 1056 | + result += "到达站点名称为空,请根据时刻表当前的版本号设置好历史站点路由再上传"; | ||
| 1057 | + return result; | ||
| 1058 | + } | ||
| 1059 | + sBufferC.append("<ZDXH>").append(zdxh).append("</ZDXH>"); | ||
| 1060 | + sBufferC.append("<JHFCSJ>").append(changeTimeFormat(ttInfoDetail)).append("</JHFCSJ>"); | ||
| 1061 | + sBufferC.append("<DDZDMC>").append(ddzdmc).append("</DDZDMC>"); | ||
| 1062 | + // 终点站的参数 | ||
| 1063 | + otherMap.put("stationMark","E"); | ||
| 1064 | + paramMap = packageYgcStationNumParam(ttInfoDetail,otherMap); | ||
| 1065 | + if(isLogStation){// 输出终点站信息 | ||
| 1066 | + logger.info("setSKB:"+"终点站信息:"+paramMap); | ||
| 1067 | + } | ||
| 1068 | + // 到达站点序号 | ||
| 1069 | + ddxh = String.valueOf(getYgcStationNumByLineCodeAndDirectionAndStationName(paramMap,lsStationName2YgcNumber)); | ||
| 1070 | + if("".equals(ddxh) || "null".equals(ddxh) || "0".equals(ddxh)){ | ||
| 1071 | + result += "到达站点序号为空,请根据时刻表当前的版本号设置好历史站点路由再上传"; | ||
| 1072 | + return result; | ||
| 1073 | + } | ||
| 1074 | + isLogStation = false; // 一条线路只输出一次,后面的不输出了 | ||
| 1075 | + sBufferC.append("<DDXH>").append(ddxh).append("</DDXH>"); | ||
| 1076 | + sBufferC.append("<JHDDSJ>").append(calcDdsj(ttInfoDetail.getFcsj(),ttInfoDetail.getBcsj())).append("</JHDDSJ>"); | ||
| 1077 | + sBufferC.append("</BC>"); | ||
| 1078 | + // 0:上行;1:下行 | ||
| 1079 | + if("0".equals(sxx)){ | ||
| 1080 | + singleLc = lineInformation.getUpMileage(); | ||
| 1081 | + }else{ | ||
| 1082 | + singleLc = lineInformation.getDownMileage(); | ||
| 1083 | + } | ||
| 1084 | + zlc += singleLc ; | ||
| 1085 | + yylc += singleLc; | ||
| 1086 | + } | ||
| 1087 | + sBufferC.append("</BCList>"); | ||
| 1088 | + sBufferC.append("</SKB>"); | ||
| 1089 | + sBufferA = new StringBuffer(); | ||
| 1090 | + sBufferA.append("<JHZLC>").append(df.format(zlc)).append("</JHZLC>"); | ||
| 1091 | + sBufferA.append("<JHYYLC>").append(df.format(yylc)).append("</JHYYLC>"); | ||
| 1092 | + sBuffer.append(sBufferA).append(sBufferB).append(sBufferC); | ||
| 1093 | + } | ||
| 1094 | + logger.info("setSKB:"+"ttinfoId:"+ttinfoId+";当前站点版本号:"+lineVersion+";查询历史站点路由:"+lsStationCode2NameMap+";查询历史站点编号:"+lsStationName2YgcNumber); | ||
| 1095 | + } | ||
| 1096 | + sBuffer.append("</SKBs>"); | ||
| 1097 | + String state;// 是否上传成功 | ||
| 1098 | + if(ssop.setSKB(userNameOther, passwordOther, sBuffer.toString()).isSuccess()){ | ||
| 1099 | + result = "上传成功"; | ||
| 1100 | + state = "1"; | ||
| 1101 | + }else{// 上传失败 | ||
| 1102 | + result = "上传失败"; | ||
| 1103 | + state = "0"; | ||
| 1104 | + } | ||
| 1105 | + // 保存运管处上传记录 | ||
| 1106 | + saveYgcUploadLog(ttinfoList,sBuffer.toString(),TrafficManageServiceImpl.UPLOAD_TYPE_SKB,state); | ||
| 1107 | + } catch (Exception e) { | ||
| 1108 | + logger.error("setSKB:", e); | ||
| 1109 | + e.printStackTrace(); | ||
| 1110 | + }finally{ | ||
| 1111 | + logger.info("setSKB:"+sBuffer.toString()); | ||
| 1112 | + logger.info("setSKB:"+result); | ||
| 1113 | + } | ||
| 1114 | + return result; | ||
| 1115 | + } | ||
| 1116 | + | ||
| 1117 | + /** | ||
| 1118 | + * 保存上传运管处的日志 | ||
| 1119 | + * @param obj 参数 | ||
| 1120 | + * @param type 日志类型 | ||
| 1121 | + * @param xml 上传参数 | ||
| 1122 | + */ | ||
| 1123 | + private void saveYgcUploadLog(Object obj,String xml,String type,String state){ | ||
| 1124 | + SKBUploadLogger skbUploadLogger = new SKBUploadLogger(); | ||
| 1125 | + SysUser user; | ||
| 1126 | + // 如果不是人为上传,SysUser则为空,设置上传人员为管理员 | ||
| 1127 | + if(SecurityContextHolder.getContext() == null || SecurityContextHolder.getContext().getAuthentication() == null){ | ||
| 1128 | + user = new SysUser(); | ||
| 1129 | + user.setId(1); | ||
| 1130 | + }else{// 获取上传人员 | ||
| 1131 | + user = SecurityUtils.getCurrentUser(); | ||
| 1132 | + } | ||
| 1133 | + // 最大的字符长度 | ||
| 1134 | + int maxLength = 60000; | ||
| 1135 | + int cutLength = 50000;// 需要截取的字符长度 | ||
| 1136 | + String xml_sub = null; | ||
| 1137 | + skbUploadLogger.setType(type);// 设置类型 | ||
| 1138 | + // 判断xml是否超长,如果超长,则截取 | ||
| 1139 | + if(xml != null && xml.length() > maxLength){ | ||
| 1140 | + int xmlLength = xml.length(); | ||
| 1141 | + int cutCount = xmlLength / cutLength + (xmlLength % cutLength > 0 ? 1 : 0); | ||
| 1142 | + if(cutCount > 2){ | ||
| 1143 | + xml = "由于上传参数内容超长,请查看服务器的系统日志"; | ||
| 1144 | + }else if(cutCount == 2){ | ||
| 1145 | + xml_sub =xml.substring(cutLength); | ||
| 1146 | + xml = xml.substring(0,cutLength); | ||
| 1147 | + }else{ | ||
| 1148 | + // 不做处理 | ||
| 1149 | + } | ||
| 1150 | + } | ||
| 1151 | +// skbUploadLogger.setUploadXml(xml);// 上传的参数 | ||
| 1152 | +// skbUploadLogger.setUploadXmlSub(xml_sub); | ||
| 1153 | + skbUploadLogger.setState(state);// 状态:是否成功 | ||
| 1154 | + skbUploadLogger.setUser(user); | ||
| 1155 | + // 时刻表 | ||
| 1156 | + if(type.equals(TrafficManageServiceImpl.UPLOAD_TYPE_SKB)){ | ||
| 1157 | + List<TTInfo> ttInfoList = (List<TTInfo>)obj; | ||
| 1158 | + String name = ""; | ||
| 1159 | + Line line = null; | ||
| 1160 | + for(TTInfo ttInfo : ttInfoList){ | ||
| 1161 | + name += ttInfo.getName() + " "; | ||
| 1162 | + line = ttInfo.getXl(); | ||
| 1163 | + } | ||
| 1164 | + skbUploadLogger.setLine(line); | ||
| 1165 | + skbUploadLogger.setUser(user); | ||
| 1166 | + skbUploadLogger.setName(name); | ||
| 1167 | + skbUploadLoggerRepository.save(skbUploadLogger); | ||
| 1168 | + }else{ | ||
| 1169 | + if(type.equals(TrafficManageServiceImpl.UPLOAD_TYPE_XL)){ | ||
| 1170 | + Line line = (Line) obj; | ||
| 1171 | + String name = line.getName() + "线路停靠站上传"; | ||
| 1172 | + skbUploadLogger.setLine(line); | ||
| 1173 | + skbUploadLogger.setName(name); | ||
| 1174 | + skbUploadLoggerRepository.save(skbUploadLogger); | ||
| 1175 | + }else if(type.equals(TrafficManageServiceImpl.UPLOAD_TYPE_LD)){ | ||
| 1176 | + Map<String ,Line> logLineMap = (Map<String ,Line> )obj; | ||
| 1177 | + for (String key : logLineMap.keySet()) { | ||
| 1178 | + Line line = logLineMap.get(key); | ||
| 1179 | + String name = line.getName() + "路单上传"; | ||
| 1180 | + skbUploadLogger = new SKBUploadLogger(); | ||
| 1181 | + skbUploadLogger.setType(type);// 设置类型 | ||
| 1182 | +// skbUploadLogger.setUploadXml(xml);// 上传的参数 | ||
| 1183 | +// skbUploadLogger.setUploadXmlSub(xml_sub); | ||
| 1184 | + skbUploadLogger.setState(state);// 状态:是否成功 | ||
| 1185 | + skbUploadLogger.setUser(user); | ||
| 1186 | + skbUploadLogger.setLine(line); | ||
| 1187 | + skbUploadLogger.setName(name); | ||
| 1188 | +// skbUploadLoggerRepository.save(skbUploadLogger); | ||
| 1189 | + } | ||
| 1190 | + } | ||
| 1191 | + } | ||
| 1192 | + } | ||
| 1193 | + /** | ||
| 1194 | + * 上传线路人员车辆配置信息 | ||
| 1195 | + */ | ||
| 1196 | + @Override | ||
| 1197 | + public String setXLPC() { | ||
| 1198 | + String result = "failure"; | ||
| 1199 | + StringBuffer sBuffer =new StringBuffer(); | ||
| 1200 | + try { | ||
| 1201 | + sBuffer.append("<XLPCs>"); | ||
| 1202 | + // 声明变量 | ||
| 1203 | + Line line = null; | ||
| 1204 | + Cars cars = null; | ||
| 1205 | + List<Personnel> personnelList = null; | ||
| 1206 | + List<Cars> carsList = null; | ||
| 1207 | + int totalPersonnel,totalCar ;// 人员数量。车辆数量 | ||
| 1208 | + // 查询所有线路 | ||
| 1209 | + Iterator<Line> lineIterator = lineRepository.findAll().iterator(); | ||
| 1210 | + // 循环查找线路下的信息 | ||
| 1211 | + while(lineIterator.hasNext()){ | ||
| 1212 | + line = lineIterator.next(); | ||
| 1213 | + sBuffer.append("<XLPC>"); | ||
| 1214 | + sBuffer.append("<XLBM>").append(BasicData.lineId2ShangHaiCodeMap.get(line.getId())).append("</XLBM>"); | ||
| 1215 | + // 查询驾驶员数量 | ||
| 1216 | + personnelList = personnelRepository.findJsysByLineId(line.getId()); | ||
| 1217 | + totalPersonnel = personnelList != null ? personnelList.size():0; | ||
| 1218 | + sBuffer.append("<SJRS>").append(totalPersonnel).append("</SJRS>"); | ||
| 1219 | + // 查询售票员人员数量 | ||
| 1220 | + personnelList = personnelRepository.findSpysByLineId(line.getId()); | ||
| 1221 | + totalPersonnel = personnelList != null ? personnelList.size():0; | ||
| 1222 | + sBuffer.append("<SPYRS>").append(totalPersonnel).append("</SPYRS>"); | ||
| 1223 | + // 查询车辆 | ||
| 1224 | + carsList = carsRepository.findCarsByLineId(line.getId()); | ||
| 1225 | + totalCar = carsList != null ? carsList.size():0; | ||
| 1226 | + sBuffer.append("<PCSL>").append(totalCar).append("</PCSL>"); | ||
| 1227 | + sBuffer.append("<UPDT>").append(sdfnyrsfm.format(new Date())).append("</UPDT>"); | ||
| 1228 | + int carsNum = 0; | ||
| 1229 | + // 取车牌号 | ||
| 1230 | + if(carsList != null){ | ||
| 1231 | + carsNum = carsList.size(); | ||
| 1232 | + sBuffer.append("<CPHList>"); | ||
| 1233 | + for (int i = 0; i < carsNum; i++) { | ||
| 1234 | + cars = carsList.get(i); | ||
| 1235 | + sBuffer.append("<CPH>").append("沪").append(cars.getCarCode()).append("</CPH>"); | ||
| 1236 | + } | ||
| 1237 | + sBuffer.append("</CPHList>"); | ||
| 1238 | + } | ||
| 1239 | + sBuffer.append("</XLPC>"); | ||
| 1240 | + } | ||
| 1241 | + sBuffer.append("</XLPCs>"); | ||
| 1242 | + if(ssop.setXLPC(userNameOther, passwordOther, sBuffer.toString()).isSuccess()){ | ||
| 1243 | + result = "success"; | ||
| 1244 | + } | ||
| 1245 | + } catch (Exception e) { | ||
| 1246 | + logger.error("setXLPC:",e); | ||
| 1247 | + e.printStackTrace(); | ||
| 1248 | + }finally{ | ||
| 1249 | + logger.info("setXLPC:"+sBuffer.toString()); | ||
| 1250 | + logger.info("setXLPC:"+result); | ||
| 1251 | + } | ||
| 1252 | + return result; | ||
| 1253 | + } | ||
| 1254 | + | ||
| 1255 | + | ||
| 1256 | + /** | ||
| 1257 | + * 上传超速数据 | ||
| 1258 | + */ | ||
| 1259 | + @Override | ||
| 1260 | + public String setCS() { | ||
| 1261 | + String result = "failure"; | ||
| 1262 | + StringBuffer sBuffer =new StringBuffer(); | ||
| 1263 | + sBuffer.append("<CSs>"); | ||
| 1264 | + String sql = "SELECT * FROM bsth_c_speeding where DATE_FORMAT(create_date,'%Y-%m-%d') = ? order by create_date "; | ||
| 1265 | + Connection conn = null; | ||
| 1266 | + PreparedStatement ps = null; | ||
| 1267 | + ResultSet rs = null; | ||
| 1268 | + // 取昨天 的日期 | ||
| 1269 | + String yesterday = sdfnyr.format(DateUtils.addDays(new Date(), -1)); | ||
| 1270 | + try { | ||
| 1271 | + conn = DBUtils_MS.getConnection(); | ||
| 1272 | + ps = conn.prepareStatement(sql); | ||
| 1273 | + ps.setString(1, yesterday); | ||
| 1274 | + rs = ps.executeQuery(); | ||
| 1275 | + Float lon, lat; | ||
| 1276 | + String kssk; | ||
| 1277 | + String speed; | ||
| 1278 | + while (rs.next()) { | ||
| 1279 | + kssk = sdfnyrsfm.format(rs.getLong("TIMESTAMP")); | ||
| 1280 | + speed = rs.getString("SPEED"); | ||
| 1281 | + // 经纬度 | ||
| 1282 | + lon = rs.getFloat("LON"); | ||
| 1283 | + lat = rs.getFloat("LAT"); | ||
| 1284 | + sBuffer.append("<CS>"); | ||
| 1285 | + sBuffer.append("<RQ>").append(sdfnyr.format(rs.getDate("CREATE_DATE"))).append("</RQ>"); | ||
| 1286 | + sBuffer.append("<XLBM>").append(BasicData.lineCode2ShangHaiCodeMap.get(rs.getString("LINE"))).append("</XLBM>");//////// | ||
| 1287 | + sBuffer.append("<CPH>").append(rs.getString("VEHICLE")).append("</CPH>"); | ||
| 1288 | + sBuffer.append("<KSSK>").append(kssk).append("</KSSK>"); | ||
| 1289 | + sBuffer.append("<KSDDJD>").append(lon).append("</KSDDJD>"); | ||
| 1290 | + sBuffer.append("<KSDDWD>").append(lat).append("</KSDDWD>"); | ||
| 1291 | + sBuffer.append("<KSLD>").append("").append("</KSLD>");//********************** | ||
| 1292 | + sBuffer.append("<JSSK>").append(kssk).append("</JSSK>"); | ||
| 1293 | + sBuffer.append("<JSDDJD>").append(lon).append("</JSDDJD>"); | ||
| 1294 | + sBuffer.append("<JSDDWD>").append(lat).append("</JSDDWD>"); | ||
| 1295 | + sBuffer.append("<JSLD>").append("").append("</JSLD>");//********************** | ||
| 1296 | + sBuffer.append("<PJSD>").append(speed).append("</PJSD>"); | ||
| 1297 | + sBuffer.append("<ZGSS>").append(speed).append("</ZGSS>"); | ||
| 1298 | + sBuffer.append("<UPDT>").append(sdfnyrsfm.format(new Date())).append("</UPDT>"); | ||
| 1299 | + sBuffer.append("</CS>"); | ||
| 1300 | + } | ||
| 1301 | + sBuffer.append("</CSs>"); | ||
| 1302 | + if(ssop.setCS(userNameOther, passwordOther, sBuffer.toString()).isSuccess()){ | ||
| 1303 | + result = "success"; | ||
| 1304 | + } | ||
| 1305 | + } catch (Exception e) { | ||
| 1306 | + logger.error("setCS:",e); | ||
| 1307 | + e.printStackTrace(); | ||
| 1308 | + } finally { | ||
| 1309 | + logger.info("setCS:"+sBuffer.toString()); | ||
| 1310 | + logger.info("setCS:"+result); | ||
| 1311 | + DBUtils_MS.close(rs, ps, conn); | ||
| 1312 | + } | ||
| 1313 | + return result; | ||
| 1314 | + } | ||
| 1315 | + | ||
| 1316 | + | ||
| 1317 | + /** | ||
| 1318 | + * 下载全量的公交基础数据 | ||
| 1319 | + */ | ||
| 1320 | + public String getDownLoadAllDataFile() { | ||
| 1321 | + String result = "failure"; | ||
| 1322 | + try { | ||
| 1323 | + try { | ||
| 1324 | + if(ygcBasicDataService.download("admin","000000","abc.zip")){ | ||
| 1325 | + result = "success"; | ||
| 1326 | + } | ||
| 1327 | + } catch (Exception e) { | ||
| 1328 | + e.printStackTrace(); | ||
| 1329 | + } | ||
| 1330 | + } catch (Exception e) { | ||
| 1331 | + e.printStackTrace(); | ||
| 1332 | + } | ||
| 1333 | + | ||
| 1334 | + return result; | ||
| 1335 | + } | ||
| 1336 | + | ||
| 1337 | + /** | ||
| 1338 | + * 下载增量的公交基础数据 | ||
| 1339 | + */ | ||
| 1340 | + public String getDownLoadIncreaseDataFile() { | ||
| 1341 | + String result = "success"; | ||
| 1342 | + try { | ||
| 1343 | + //System.out.println(portType.downloadIncreaseDataFile(args0, args1, args2)); | ||
| 1344 | + } catch (Exception e) { | ||
| 1345 | + e.printStackTrace(); | ||
| 1346 | + } | ||
| 1347 | + | ||
| 1348 | + return result; | ||
| 1349 | + } | ||
| 1350 | + | ||
| 1351 | + /** | ||
| 1352 | + * 指定线路查询方式公交基础数据下载 | ||
| 1353 | + */ | ||
| 1354 | + public String getDownLoadWarrantsBusLineStation() { | ||
| 1355 | + String result = "success"; | ||
| 1356 | + try { | ||
| 1357 | + | ||
| 1358 | + //portType.setXL(userNameXl, passwordXl, sBuffer.toString()); | ||
| 1359 | + } catch (Exception e) { | ||
| 1360 | + e.printStackTrace(); | ||
| 1361 | + } | ||
| 1362 | + | ||
| 1363 | + return result; | ||
| 1364 | + } | ||
| 1365 | + | ||
| 1366 | + /** | ||
| 1367 | + * 计算结束时间 | ||
| 1368 | + * @param fcsj 发车时间 | ||
| 1369 | + * @param bcsj 班次历时 | ||
| 1370 | + * @return | ||
| 1371 | + */ | ||
| 1372 | + private String calcDdsj(String fcsj,Integer bcsj){ | ||
| 1373 | + String result = ""; | ||
| 1374 | + if(fcsj.indexOf(":") != -1){ | ||
| 1375 | + if(bcsj == null){ | ||
| 1376 | + return fcsj; | ||
| 1377 | + } | ||
| 1378 | + // 时和分隔开 | ||
| 1379 | + String[] fcsjArray = fcsj.split(":"); | ||
| 1380 | + // 分和历时时间相加 | ||
| 1381 | + Integer fullTime = Integer.valueOf(fcsjArray[1])+ bcsj; | ||
| 1382 | + int hour,min,sumHour; | ||
| 1383 | + hour = fullTime / 60; | ||
| 1384 | + min = fullTime % 60; | ||
| 1385 | + sumHour = Integer.valueOf(fcsjArray[0])+hour; | ||
| 1386 | + if(sumHour >= 24){ | ||
| 1387 | + result = String.format("%02d",sumHour - 24); | ||
| 1388 | + }else{ | ||
| 1389 | + result = String.format("%02d",sumHour);; | ||
| 1390 | + } | ||
| 1391 | + result +=":"+String.format("%02d", min); | ||
| 1392 | + }else{ | ||
| 1393 | + result = fcsj; | ||
| 1394 | + } | ||
| 1395 | + return result; | ||
| 1396 | + } | ||
| 1397 | + | ||
| 1398 | + /** | ||
| 1399 | + * 改变时间格式 | ||
| 1400 | + * @param ttInfoDetail 时刻表详细 | ||
| 1401 | + * @return xx:yy | ||
| 1402 | + */ | ||
| 1403 | + private String changeTimeFormat(TTInfoDetail ttInfoDetail){ | ||
| 1404 | + String result = "00:00"; | ||
| 1405 | + String fcsj = ttInfoDetail.getFcsj(); | ||
| 1406 | + if(fcsj.indexOf(":") != -1){ | ||
| 1407 | + // 时和分隔开 | ||
| 1408 | + String[] fcsjArray = fcsj.split(":"); | ||
| 1409 | + result = String.format("%02d", Integer.valueOf(fcsjArray[0]))+":"; | ||
| 1410 | + result +=String.format("%02d", Integer.valueOf(fcsjArray[1])); | ||
| 1411 | + }else{ | ||
| 1412 | + result = null; | ||
| 1413 | + logger.info("setSKB:发车时间错误:ttInfoDetail.id="+ttInfoDetail.getId()); | ||
| 1414 | + } | ||
| 1415 | + return result; | ||
| 1416 | + } | ||
| 1417 | + | ||
| 1418 | + /** | ||
| 1419 | + * 拼装线路计划班次表的XML | ||
| 1420 | + * @param sBuffer | ||
| 1421 | + * @param schedulePlanInfo | ||
| 1422 | + * @param xlbm | ||
| 1423 | + * @param zbh | ||
| 1424 | + * @param lp | ||
| 1425 | + */ | ||
| 1426 | + private void assembleJHBC(StringBuffer sBuffer,SchedulePlanInfo schedulePlanInfo,String xlbm,String zbh,Long lp){ | ||
| 1427 | + sBuffer.append("<JHBC>"); | ||
| 1428 | + sBuffer.append("<RQ>").append(sdfnyr.format(schedulePlanInfo.getScheduleDate())).append("</RQ>"); | ||
| 1429 | + sBuffer.append("<XLBM>").append(BasicData.lineCode2ShangHaiCodeMap.get(xlbm)).append("</XLBM>"); | ||
| 1430 | + sBuffer.append("<CPH>").append("沪"+zbh).append("</CPH>"); | ||
| 1431 | + sBuffer.append("<LPBH>").append(lp).append("</LPBH>"); | ||
| 1432 | + sBuffer.append("<UPDT>").append(sdfnyrsfm.format(new Date())).append("</UPDT>"); | ||
| 1433 | + sBuffer.append("<BCList>"); | ||
| 1434 | + } | ||
| 1435 | + /** | ||
| 1436 | + * 转换排班规则 | ||
| 1437 | + * @param ruleDay | ||
| 1438 | + * @return | ||
| 1439 | + */ | ||
| 1440 | + private String changeRuleDay(String ruleDay){ | ||
| 1441 | + String result = ""; | ||
| 1442 | + int flag ; | ||
| 1443 | + String[] ruleDayArray = ruleDay.split(","); | ||
| 1444 | + for (int i = 0; i < ruleDayArray.length; i++) { | ||
| 1445 | + if(ruleDayArray[i].equals("1")){ | ||
| 1446 | + flag = i+1; | ||
| 1447 | + }else{ | ||
| 1448 | + flag = 0; | ||
| 1449 | + } | ||
| 1450 | + if(flag > 0){ | ||
| 1451 | + result += flag + ","; | ||
| 1452 | + } | ||
| 1453 | + } | ||
| 1454 | + // 去掉最后一个字符 | ||
| 1455 | + if(StringUtils.endsWith(result,",")){ | ||
| 1456 | + result = StringUtils.removeEnd(result,","); | ||
| 1457 | + } | ||
| 1458 | + return result; | ||
| 1459 | + } | ||
| 1460 | + /** | ||
| 1461 | + * 设置统一的公司名称 | ||
| 1462 | + * @param company | ||
| 1463 | + */ | ||
| 1464 | + private void setCompanyName(String company){ | ||
| 1465 | + if(company.equals("闵行公司")){ | ||
| 1466 | + company = "浦东闵行公交公司"; | ||
| 1467 | + }else if(company.equals("杨高公司")){ | ||
| 1468 | + company = "浦东杨高公交公司"; | ||
| 1469 | + }else if(company.equals("上南公司")){ | ||
| 1470 | + company = "浦东上南公交公司"; | ||
| 1471 | + }else if(company.equals("金高公司")){ | ||
| 1472 | + company = "浦东金高公交公司"; | ||
| 1473 | + }else if(company.equals("南汇公司")){ | ||
| 1474 | + company = "浦东南汇公交公司"; | ||
| 1475 | + }else if(company.equals("青浦公交")){ | ||
| 1476 | + company = "浦东青浦公交公司"; | ||
| 1477 | + } | ||
| 1478 | + } | ||
| 1479 | + /** | ||
| 1480 | + * @param stationsList 站点路由集 | ||
| 1481 | + * @param sBuffer sBuffer | ||
| 1482 | + * @param startId 站点序号起始ID | ||
| 1483 | + * | ||
| 1484 | + * @return 站点序号累加后的ID | ||
| 1485 | + */ | ||
| 1486 | + private int packagStationXml(List<StationRoute> stationsList,StringBuffer sBuffer,int startId,Map<String, Integer> stationNumMap){ | ||
| 1487 | + int size = stationsList.size(); | ||
| 1488 | + StationRoute srRoute; | ||
| 1489 | + HashMap<String,String> paraMap; | ||
| 1490 | + String zdlx ;// 站点类型:0:起点站、1:终点站、2:中途站 | ||
| 1491 | + for (int i = 0; i < size; i++) { | ||
| 1492 | + srRoute = stationsList.get(i); | ||
| 1493 | + zdlx = srRoute.getStationMark(); | ||
| 1494 | + if(zdlx.equals("B")){ | ||
| 1495 | + zdlx = "0"; | ||
| 1496 | + }else if(zdlx.equals("E")){ | ||
| 1497 | + zdlx = "1"; | ||
| 1498 | + }else{ | ||
| 1499 | + zdlx = "2"; | ||
| 1500 | + } | ||
| 1501 | + paraMap = packageYgcStationNumParam(srRoute,null); | ||
| 1502 | + sBuffer.append("<Station>"); | ||
| 1503 | + sBuffer.append("<ZDXH>").append(getYgcStationNumByLineCodeAndDirectionAndStationName(paraMap,stationNumMap)).append("</ZDXH>"); | ||
| 1504 | + sBuffer.append("<SXX>").append(srRoute.getDirections()).append("</SXX>"); | ||
| 1505 | + sBuffer.append("<ZDMC>").append(srRoute.getStationName()).append("</ZDMC>"); | ||
| 1506 | + sBuffer.append("<ZDBM>").append(srRoute.getStationCode()).append("</ZDBM>"); | ||
| 1507 | + sBuffer.append("<ZDJD>").append(srRoute.getStation().getgLonx()).append("</ZDJD>"); | ||
| 1508 | + sBuffer.append("<ZDWD>").append(srRoute.getStation().getgLaty()).append("</ZDWD>"); | ||
| 1509 | + sBuffer.append("<ZZ>").append(srRoute.getStation().getAddr() == null ? "" : srRoute.getStation().getAddr()).append("</ZZ>"); | ||
| 1510 | + sBuffer.append("<ZDLX>").append(zdlx).append("</ZDLX>"); | ||
| 1511 | + sBuffer.append("<ZJLC>").append(srRoute.getDistances()).append("</ZJLC>"); | ||
| 1512 | + sBuffer.append("</Station>"); | ||
| 1513 | + startId++; | ||
| 1514 | + } | ||
| 1515 | + return startId; | ||
| 1516 | + } | ||
| 1517 | + | ||
| 1518 | + /** | ||
| 1519 | + * @param pointList 站点点位集 | ||
| 1520 | + * @param sBuffer sBuffer | ||
| 1521 | + * @param startId 站点序号起始ID | ||
| 1522 | + * | ||
| 1523 | + * @return 站点序号累加后的ID | ||
| 1524 | + */ | ||
| 1525 | + private int packagStationPointXml(List<Object[]> pointList,StringBuffer sBuffer,int startId){ | ||
| 1526 | + int size = pointList.size(); | ||
| 1527 | + Object[] objs; | ||
| 1528 | + String bsection,dir,section; | ||
| 1529 | + String[] sections ; | ||
| 1530 | + for (int i = 0; i < size; i++) { | ||
| 1531 | + objs = pointList.get(i); | ||
| 1532 | + bsection = objs[0]+""; | ||
| 1533 | + dir = objs[1]+""; | ||
| 1534 | + // 取括号内的内容 | ||
| 1535 | + Pattern pattern = Pattern.compile("(?<=\\()(.+?)(?=\\))"); | ||
| 1536 | + Matcher matcher = pattern.matcher(bsection); | ||
| 1537 | + if(matcher.find()){ | ||
| 1538 | + sections = matcher.group().split(","); | ||
| 1539 | + for (int j = 0 ; j < sections.length ; j ++){ | ||
| 1540 | + section = sections[j]; | ||
| 1541 | + sBuffer.append("<LinePoint>"); | ||
| 1542 | + sBuffer.append("<ZDXH>").append(startId).append("</ZDXH>"); | ||
| 1543 | + sBuffer.append("<SXX>").append(dir).append("</SXX>"); | ||
| 1544 | + sBuffer.append("<ZDJD>").append(section.split(" ")[0]).append("</ZDJD>"); | ||
| 1545 | + sBuffer.append("<ZDWD>").append(section.split(" ")[1]).append("</ZDWD>"); | ||
| 1546 | + sBuffer.append("</LinePoint>"); | ||
| 1547 | + startId++; | ||
| 1548 | + } | ||
| 1549 | + } | ||
| 1550 | + } | ||
| 1551 | + return startId; | ||
| 1552 | + } | ||
| 1553 | + | ||
| 1554 | + /** | ||
| 1555 | + * 获取运管处站点序号 | ||
| 1556 | + * @param map | ||
| 1557 | + * @return 运管处站点序号 | ||
| 1558 | + */ | ||
| 1559 | + private Integer getYgcStationNumByLineCodeAndDirectionAndStationName(HashMap<String,String> map,Map<String, Integer> stationNumMap){ | ||
| 1560 | + // 线路编码 | ||
| 1561 | + String lineCode = map.get("lineCode"); | ||
| 1562 | + // 线路走向 0:上行 1:下行 | ||
| 1563 | + String direction = map.get("direction"); | ||
| 1564 | + // 站点编码 | ||
| 1565 | + String stationCode = map.get("stationCode"); | ||
| 1566 | + // 站点类型:B:起点站 Z:中途站 E:终点站 T:停车场 | ||
| 1567 | + String stationMark = map.get("stationMark"); | ||
| 1568 | + String[] marks = null; | ||
| 1569 | + // 起点站,先从起点找,找不到再从中途站找,最后从终点找 | ||
| 1570 | + if(stationMark.equals("B")){ | ||
| 1571 | + marks= new String[]{"B","Z","E"}; | ||
| 1572 | + }else if(stationMark.equals("E")){// 终点站相反 | ||
| 1573 | + marks= new String[]{"E","Z","B"}; | ||
| 1574 | + }else if(stationMark.equals("Z")){ | ||
| 1575 | + marks= new String[]{"Z"}; | ||
| 1576 | + } | ||
| 1577 | + // 默认从缓存BasicData.stationName2YgcNumber | ||
| 1578 | + Map<String, Integer> tempMap = BasicData.stationName2YgcNumber; | ||
| 1579 | + // 如果传入的stationNumMap不为空,则不是缓存取,而从stationNumMap取 | ||
| 1580 | + if(stationNumMap != null){ | ||
| 1581 | + tempMap = stationNumMap; | ||
| 1582 | + } | ||
| 1583 | + Integer number = null; | ||
| 1584 | + for (int i = 0 ;i < marks.length ; i ++){ | ||
| 1585 | + number = tempMap.get(lineCode+"_"+direction+"_"+stationCode+"_"+marks[i]); | ||
| 1586 | + if(number != null){ | ||
| 1587 | + break; | ||
| 1588 | + } | ||
| 1589 | + } | ||
| 1590 | + return number == null ? 0 : number; | ||
| 1591 | + } | ||
| 1592 | + | ||
| 1593 | + /** | ||
| 1594 | + * 封装查询站序条件 | ||
| 1595 | + * @param obj | ||
| 1596 | + * @return | ||
| 1597 | + */ | ||
| 1598 | + private HashMap packageYgcStationNumParam(Object obj,HashMap<String,String> otherParam){ | ||
| 1599 | + HashMap<String,String> map = new HashMap<String,String>(); | ||
| 1600 | + String lineCode = "",direction = "",stationCode = "",stationMark = ""; | ||
| 1601 | + // 站点路由 | ||
| 1602 | + if(obj instanceof StationRoute){ | ||
| 1603 | + StationRoute sr = (StationRoute)obj; | ||
| 1604 | + lineCode = sr.getLineCode(); | ||
| 1605 | + direction = String.valueOf(sr.getDirections()); | ||
| 1606 | + stationCode = sr.getStationCode(); | ||
| 1607 | + stationMark = sr.getStationMark(); | ||
| 1608 | + }else if(obj instanceof ScheduleRealInfo){ //实际排班计划明细。 | ||
| 1609 | + ScheduleRealInfo sri = (ScheduleRealInfo)obj; | ||
| 1610 | + lineCode = sri.getXlBm(); | ||
| 1611 | + direction = sri.getXlDir(); | ||
| 1612 | + if(otherParam != null && otherParam.get("stationMark") != null){ | ||
| 1613 | + stationMark = otherParam.get("stationMark"); | ||
| 1614 | + if(stationMark.equals("B")){ // 起点站 | ||
| 1615 | + stationCode = sri.getQdzCode(); | ||
| 1616 | + }else if(stationMark.equals("E")){ // 终点站 | ||
| 1617 | + stationCode = sri.getZdzCode(); | ||
| 1618 | + } | ||
| 1619 | + } | ||
| 1620 | + }else if(obj instanceof SchedulePlanInfo){ //排班计划明细 | ||
| 1621 | + SchedulePlanInfo spi = (SchedulePlanInfo)obj; | ||
| 1622 | + lineCode = spi.getXlBm(); | ||
| 1623 | + direction = spi.getXlDir(); | ||
| 1624 | + if(otherParam != null && otherParam.get("stationMark") != null){ | ||
| 1625 | + stationMark = otherParam.get("stationMark"); | ||
| 1626 | + if(stationMark.equals("B")){ // 起点站 | ||
| 1627 | + stationCode = spi.getQdzCode(); | ||
| 1628 | + }else if(stationMark.equals("E")){ // 终点站 | ||
| 1629 | + stationCode = spi.getZdzCode(); | ||
| 1630 | + } | ||
| 1631 | + } | ||
| 1632 | + }else if(obj instanceof TTInfoDetail){ //时刻表明细 | ||
| 1633 | + TTInfoDetail ttid = (TTInfoDetail)obj; | ||
| 1634 | + lineCode = ttid.getXl().getLineCode(); | ||
| 1635 | + direction = ttid.getXlDir(); | ||
| 1636 | + if(otherParam != null && otherParam.get("stationMark") != null){ | ||
| 1637 | + stationMark = otherParam.get("stationMark"); | ||
| 1638 | + if(stationMark.equals("B")){ // 起点站 | ||
| 1639 | + stationCode = ttid.getQdzCode(); | ||
| 1640 | + }else if(stationMark.equals("E")){ // 终点站 | ||
| 1641 | + stationCode = ttid.getZdzCode(); | ||
| 1642 | + } | ||
| 1643 | + } | ||
| 1644 | + } | ||
| 1645 | + map.put("lineCode",lineCode);// 站点编码 | ||
| 1646 | + map.put("direction",direction); // 上下行 | ||
| 1647 | + map.put("stationCode",stationCode); // 站点编号 | ||
| 1648 | + map.put("stationMark",stationMark); // 站点类型 | ||
| 1649 | + return map; | ||
| 1650 | + } | ||
| 1651 | + | ||
| 1652 | + /** | ||
| 1653 | + * 取得历史站点编码和站点名称的对应关系 | ||
| 1654 | + * @return | ||
| 1655 | + */ | ||
| 1656 | + private Map<String, String> getLsStationCode(String lineCode,int lineVersion){ | ||
| 1657 | + Map<String,Object> map = new HashMap<>(); | ||
| 1658 | + map.put("lineCode_eq", lineCode); | ||
| 1659 | + map.put("versions_eq",lineVersion); | ||
| 1660 | + LsStationRoute lsroute; | ||
| 1661 | + Iterator<LsStationRoute> iterator = lsStationRouteRepository.findAll(new CustomerSpecs<LsStationRoute>(map)).iterator(); | ||
| 1662 | + Map<String, String> stationCode2Name = new HashMap<>(); | ||
| 1663 | + while (iterator.hasNext()) { | ||
| 1664 | + lsroute = iterator.next(); | ||
| 1665 | + stationCode2Name.put(lsroute.getLineCode() + "_" + lsroute.getDirections() + "_" + lsroute.getStationCode(), lsroute.getStationName()); | ||
| 1666 | + } | ||
| 1667 | + return stationCode2Name; | ||
| 1668 | + } | ||
| 1669 | + | ||
| 1670 | + private Map<String, Integer> getLsStationRoute(String xlbm,int lineVersion){ | ||
| 1671 | + Map<String, Integer> tempStationName2YgcNumber = new HashMap<String, Integer>(); | ||
| 1672 | + /** | ||
| 1673 | + * 加载运管处的站点及序号 | ||
| 1674 | + * 上行从1开始,下行顺序续编 | ||
| 1675 | + */ | ||
| 1676 | + List<Map<String, String>> ygcLines = lsStationRouteRepository.findLineWithLineCode4Ygc(xlbm,lineVersion); | ||
| 1677 | + if(ygcLines != null && ygcLines.size() > 0){ | ||
| 1678 | + int size = ygcLines.size(); | ||
| 1679 | + Map<String, String> tempMap ; | ||
| 1680 | + int num = 1; | ||
| 1681 | + String key; | ||
| 1682 | + String lineCode = ""; | ||
| 1683 | + for (int i = 0; i < size; i ++){ | ||
| 1684 | + tempMap = ygcLines.get(i); | ||
| 1685 | + if(lineCode.equals("")){ | ||
| 1686 | + lineCode = tempMap.get("lineCode"); | ||
| 1687 | + }else if(!lineCode.equals(tempMap.get("lineCode"))){ | ||
| 1688 | + num = 1; | ||
| 1689 | + lineCode = tempMap.get("lineCode"); | ||
| 1690 | + } | ||
| 1691 | + key = tempMap.get("lineCode") + "_"+String.valueOf(tempMap.get("directions")) | ||
| 1692 | + + "_"+tempMap.get("stationCode")+ "_"+tempMap.get("stationMark"); | ||
| 1693 | + tempStationName2YgcNumber.put(key,num++); | ||
| 1694 | + } | ||
| 1695 | + } | ||
| 1696 | + return tempStationName2YgcNumber; | ||
| 1697 | + } | ||
| 1698 | + | ||
| 1699 | + private String getSetXlXml(Line line,LineInformation lineInformation){ | ||
| 1700 | + StringBuffer sBuffer = new StringBuffer(); | ||
| 1701 | + List<StationRoute> upStationsList ;// 上行站点路由集 | ||
| 1702 | + List<StationRoute> downStationsList;// 下行站点路由集 | ||
| 1703 | + List<Object[]> downPointList;// 下行站点集 | ||
| 1704 | + List<Object[]> upPointList;// 上行站点集 | ||
| 1705 | + sBuffer.append("<XLs>"); | ||
| 1706 | + sBuffer.append("<XL>"); | ||
| 1707 | + sBuffer.append("<XLBM>").append(BasicData.lineId2ShangHaiCodeMap.get(line.getId())).append("</XLBM>"); | ||
| 1708 | + sBuffer.append("<XLMC>").append(line.getName()).append("</XLMC>"); | ||
| 1709 | + sBuffer.append("<QDZ>").append(line.getStartStationName()).append("</QDZ>"); | ||
| 1710 | + sBuffer.append("<ZDZ>").append(line.getEndStationName()).append("</ZDZ>"); | ||
| 1711 | + sBuffer.append("<QZLC>").append(lineInformation.getUpMileage()).append("</QZLC>"); | ||
| 1712 | + sBuffer.append("<ZQLC>").append(lineInformation.getDownMileage()).append("</ZQLC>"); | ||
| 1713 | + sBuffer.append("<XLGH>").append(line.getLinePlayType()).append("</XLGH>"); | ||
| 1714 | + sBuffer.append("<UPDATE_DATE>").append(sdfnyr.format(new Date())).append("</UPDATE_DATE>"); | ||
| 1715 | + // 循环添加站点信息 | ||
| 1716 | + sBuffer.append("<StationList>"); | ||
| 1717 | + // 先查上行 | ||
| 1718 | + upStationsList = stationRouteRepository.findByLine(line.getLineCode(), 0); | ||
| 1719 | + Map<String, Integer> stationNumMap = getStationName2YgcNumberMap(line.getLineCode()); | ||
| 1720 | + int startId = 1; | ||
| 1721 | + startId = packagStationXml(upStationsList, sBuffer, startId,stationNumMap); | ||
| 1722 | + // 环线不查下行 | ||
| 1723 | + if(line.getLinePlayType() != 1){ | ||
| 1724 | + // 再查下行 | ||
| 1725 | + downStationsList = stationRouteRepository.findByLine(line.getLineCode(), 1); | ||
| 1726 | + packagStationXml(downStationsList, sBuffer, startId,stationNumMap); | ||
| 1727 | + } | ||
| 1728 | + sBuffer.append("</StationList>"); | ||
| 1729 | + // 循环添加站点点位信息 | ||
| 1730 | + sBuffer.append("<LinePointList>"); | ||
| 1731 | + upPointList = sectionRepository.getSectionDirByLineId(line.getId(),0); | ||
| 1732 | + startId = 1; | ||
| 1733 | + startId = packagStationPointXml(upPointList, sBuffer, startId); | ||
| 1734 | + // 环线不查下行 | ||
| 1735 | + if(line.getLinePlayType() != 1){ | ||
| 1736 | + downPointList = sectionRepository.getSectionDirByLineId(line.getId(),1); | ||
| 1737 | + packagStationPointXml(downPointList, sBuffer, startId); | ||
| 1738 | + } | ||
| 1739 | + sBuffer.append("</LinePointList>"); | ||
| 1740 | + sBuffer.append("</XL>"); | ||
| 1741 | + sBuffer.append("</XLs>"); | ||
| 1742 | + return sBuffer.toString(); | ||
| 1743 | + } | ||
| 1744 | +} |
src/main/java/com/bsth/service/oil/YlbService.java
| @@ -20,6 +20,9 @@ public interface YlbService extends BaseService<Ylb, Integer>{ | @@ -20,6 +20,9 @@ public interface YlbService extends BaseService<Ylb, Integer>{ | ||
| 20 | Map<String, Object> sumYlb(Map<String, Object> map); | 20 | Map<String, Object> sumYlb(Map<String, Object> map); |
| 21 | String checkJsy(Map<String, Object> map); | 21 | String checkJsy(Map<String, Object> map); |
| 22 | String checkDate(Map<String, Object> map); | 22 | String checkDate(Map<String, Object> map); |
| 23 | + | ||
| 24 | + String getModifyRights(); | ||
| 25 | + String modifyRightsChange(); | ||
| 23 | 26 | ||
| 24 | List<Map<String, Object>> oilListMonth(Map<String, Object> map); | 27 | List<Map<String, Object>> oilListMonth(Map<String, Object> map); |
| 25 | List<Ylb> listYlb(Map<String, Object> map); | 28 | List<Ylb> listYlb(Map<String, Object> map); |
src/main/java/com/bsth/service/oil/impl/CwjyServiceImpl.java
| 1 | -package com.bsth.service.oil.impl; | ||
| 2 | - | ||
| 3 | -import java.io.File; | ||
| 4 | -import java.io.FileInputStream; | ||
| 5 | -import java.sql.ResultSet; | ||
| 6 | -import java.sql.SQLException; | ||
| 7 | -import java.text.DecimalFormat; | ||
| 8 | -import java.text.ParseException; | ||
| 9 | -import java.text.SimpleDateFormat; | ||
| 10 | -import java.util.ArrayList; | ||
| 11 | -import java.util.Arrays; | ||
| 12 | -import java.util.Date; | ||
| 13 | -import java.util.HashMap; | ||
| 14 | -import java.util.List; | ||
| 15 | -import java.util.Map; | ||
| 16 | - | ||
| 17 | -import javax.transaction.Transactional; | ||
| 18 | - | ||
| 19 | -import org.apache.commons.lang3.StringEscapeUtils; | ||
| 20 | -import org.apache.poi.hssf.usermodel.HSSFCell; | ||
| 21 | -import org.apache.poi.hssf.usermodel.HSSFRow; | ||
| 22 | -import org.apache.poi.hssf.usermodel.HSSFSheet; | ||
| 23 | -import org.apache.poi.hssf.usermodel.HSSFWorkbook; | ||
| 24 | -import org.apache.poi.poifs.filesystem.POIFSFileSystem; | ||
| 25 | -import org.apache.poi.ss.usermodel.Cell; | ||
| 26 | -import org.slf4j.Logger; | ||
| 27 | -import org.slf4j.LoggerFactory; | ||
| 28 | -import org.springframework.beans.factory.annotation.Autowired; | ||
| 29 | -import org.springframework.jdbc.core.JdbcTemplate; | ||
| 30 | -import org.springframework.jdbc.core.RowMapper; | ||
| 31 | -import org.springframework.stereotype.Service; | ||
| 32 | - | ||
| 33 | -import com.alibaba.fastjson.JSONArray; | ||
| 34 | -import com.alibaba.fastjson.JSONObject; | ||
| 35 | -import com.bsth.common.ResponseCode; | ||
| 36 | -import com.bsth.data.BasicData; | ||
| 37 | -import com.bsth.entity.oil.Cwjy; | ||
| 38 | -import com.bsth.entity.oil.Cyl; | ||
| 39 | -import com.bsth.entity.oil.Ylb; | ||
| 40 | -import com.bsth.entity.oil.Ylxxb; | ||
| 41 | -import com.bsth.repository.oil.CwjyRepository; | ||
| 42 | -import com.bsth.repository.oil.YlxxbRepository; | ||
| 43 | -import com.bsth.service.impl.BaseServiceImpl; | ||
| 44 | -import com.bsth.service.oil.CwjyService; | ||
| 45 | -import com.bsth.util.Arith; | ||
| 46 | -import com.bsth.util.PageHelper; | ||
| 47 | -import com.bsth.util.PageObject; | ||
| 48 | - | ||
| 49 | -@Service | ||
| 50 | -public class CwjyServiceImpl extends BaseServiceImpl<Cwjy,Integer> implements CwjyService | ||
| 51 | -{ | ||
| 52 | - @Autowired | ||
| 53 | - CwjyRepository repository; | ||
| 54 | - @Autowired | ||
| 55 | - YlxxbRepository ylxxbRepository; | ||
| 56 | - | ||
| 57 | - @Autowired | ||
| 58 | - JdbcTemplate jdbcTemplate; | ||
| 59 | - Logger logger = LoggerFactory.getLogger(this.getClass()); | ||
| 60 | - /*@SuppressWarnings("unchecked") | ||
| 61 | - public PageObject<Ylxxb> Pagequery(Map<String, Object> map) { | ||
| 62 | - int page=Integer.parseInt(map.get("page").toString()); | ||
| 63 | - SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd"); | ||
| 64 | - | ||
| 65 | - String rq=map.get("rq").toString(); | ||
| 66 | - String nbbm=""; | ||
| 67 | - if(map.get("nbbh")!=null){ | ||
| 68 | - nbbm=map.get("nbbh").toString(); | ||
| 69 | - } | ||
| 70 | - | ||
| 71 | - Object gsdmIn=map.get("gsdm_in"); | ||
| 72 | - Object fgsdmIn=map.get("fgsdm_in"); | ||
| 73 | - String addSql=""; | ||
| 74 | - String gsdmLike=""; | ||
| 75 | - String fgsdmLike=""; | ||
| 76 | - | ||
| 77 | - //选择了公司 | ||
| 78 | - if(gsdmIn==null){ | ||
| 79 | - gsdmLike=map.get("gsdm_like").toString(); | ||
| 80 | - addSql += " and a.gsdm = '"+gsdmLike+ "' "; | ||
| 81 | - | ||
| 82 | - //选择了分公司 | ||
| 83 | - if(fgsdmIn==null){ | ||
| 84 | - fgsdmLike=map.get("fgsdm_like").toString();; | ||
| 85 | - addSql += " and a.fgsdm = '"+fgsdmLike+ "' "; | ||
| 86 | - }else{ | ||
| 87 | - String fgsdmIns[]= fgsdmIn.toString().split(","); | ||
| 88 | - addSql +=" and a.fgsdm in ("; | ||
| 89 | - for(int i=0;i<fgsdmIns.length;i++){ | ||
| 90 | - addSql +="'"+fgsdmIns[i]+"'"; | ||
| 91 | - if(i<fgsdmIns.length-1){ | ||
| 92 | - addSql +=","; | ||
| 93 | - } | ||
| 94 | - } | ||
| 95 | - addSql +=")"; | ||
| 96 | - } | ||
| 97 | - }else{ | ||
| 98 | - //没有选择公司 (分公司也没有选择) | ||
| 99 | - String gsdmIns[]=gsdmIn.toString().split(","); | ||
| 100 | - addSql += " and a.gsdm in ("; | ||
| 101 | - for(int i=0;i<gsdmIns.length;i++){ | ||
| 102 | - addSql +="'" +gsdmIns[i]+"'"; | ||
| 103 | - if(i<gsdmIns.length-1){ | ||
| 104 | - addSql+=","; | ||
| 105 | - } | ||
| 106 | - } | ||
| 107 | - addSql +=")"; | ||
| 108 | - String fgsdmIns[]= fgsdmIn.toString().split(","); | ||
| 109 | - addSql +=" and a.fgsdm in ("; | ||
| 110 | - for(int i=0;i<fgsdmIns.length;i++){ | ||
| 111 | - addSql +="'"+fgsdmIns[i]+"'"; | ||
| 112 | - if(i<fgsdmIns.length-1){ | ||
| 113 | - addSql +=","; | ||
| 114 | - } | ||
| 115 | - } | ||
| 116 | - addSql +=")"; | ||
| 117 | - | ||
| 118 | - | ||
| 119 | - } | ||
| 120 | - String countSql="SELECT ifnull(count(*),0) as countTs FROM bsth_c_cwjy a "+ | ||
| 121 | - " left join ( select * from bsth_c_ylxxb b where to_days(b.yyrq)=to_days('"+rq+"') and jylx=1) b " + | ||
| 122 | - " on a.nbbm=b.nbbm left join (select nbbm,group_concat(jsy) as jsy " | ||
| 123 | - + "from bsth_c_ylb where to_days(rq)= to_days('"+rq+"' ) group by nbbm "+ | ||
| 124 | - " ) c on a.nbbm=c.nbbm where a.nbbm like '%"+nbbm+"%' " +addSql ; | ||
| 125 | - int listsize=jdbcTemplate.queryForObject(countSql, Integer.class); | ||
| 126 | - // TODO Auto-generated method stub | ||
| 127 | - String sql="SELECT a.gsdm as gsdm,a.fgsdm as fgsdm,a.nbbm as nbbm,b.jsy as jsy,b.jzl as jzl ,b.stationid as stationid," | ||
| 128 | - + "b.nylx as nylx,b.yj as yj,b.bz as bz,c.jsy as ldgh FROM bsth_c_cwjy a "+ | ||
| 129 | - " left join ( select * from bsth_c_ylxxb b where to_days(b.yyrq)=to_days('"+rq+"') and jylx=1) b " + | ||
| 130 | - " on a.nbbm=b.nbbm left join (select nbbm,group_concat(jsy) as jsy " | ||
| 131 | - + "from bsth_c_ylb where to_days(rq)= to_days('"+rq+"' ) group by nbbm "+ | ||
| 132 | - " ) c on a.nbbm=c.nbbm where a.nbbm like '%"+nbbm+"%' " +addSql+ " limit "+page*10+","+10; | ||
| 133 | - | ||
| 134 | - | ||
| 135 | - List<Ylxxb> yList= jdbcTemplate.query(sql, | ||
| 136 | - new RowMapper<Ylxxb>(){ | ||
| 137 | - @Override | ||
| 138 | - public Ylxxb mapRow(ResultSet rs, int rowNum) throws SQLException { | ||
| 139 | - Ylxxb t=new Ylxxb(); | ||
| 140 | - t.setGsdm(rs.getString("gsdm")); | ||
| 141 | - t.setFgsdm(rs.getString("fgsdm")); | ||
| 142 | - t.setNbbm(rs.getString("nbbm")); | ||
| 143 | - t.setJsy(rs.getString("jsy")); | ||
| 144 | - t.setJzl(rs.getDouble("jzl")); | ||
| 145 | - t.setStationid(rs.getString("stationid")); | ||
| 146 | - t.setNylx(rs.getInt("nylx")); | ||
| 147 | - t.setYj(rs.getDouble("yj")); | ||
| 148 | - t.setBz(rs.getString("bz")); | ||
| 149 | - t.setLdgh(rs.getString("ldgh")); | ||
| 150 | - return t; | ||
| 151 | - } | ||
| 152 | - }); | ||
| 153 | - List<Object[]> list=repository.obtainCwjycl(rq,nbbm); | ||
| 154 | - for (int i = 0; i < list.size(); i++) { | ||
| 155 | - Ylxxb y=new Ylxxb(); | ||
| 156 | - y.setGsdm(list.get(i)[0]==null?"":list.get(i)[0].toString()); | ||
| 157 | - y.setNbbm(list.get(i)[1]==null?"":list.get(i)[1].toString()); | ||
| 158 | - y.setJsy(list.get(i)[2]==null?"":list.get(i)[2].toString()); | ||
| 159 | - y.setJzl(list.get(i)[3]==null?0.0:Double.parseDouble(list.get(i)[3].toString())); | ||
| 160 | - y.setStationid(list.get(i)[4]==null?"":list.get(i)[4].toString()); | ||
| 161 | - y.setNylx(list.get(i)[5]==null?0:Integer.parseInt(list.get(i)[5].toString())); | ||
| 162 | - y.setYj(list.get(i)[6]==null?0.0:Double.parseDouble(list.get(i)[6].toString())); | ||
| 163 | - y.setBz(list.get(i)[7]==null?"":list.get(i)[7].toString()); | ||
| 164 | - y.setLdgh(list.get(i)[8]==null?"":list.get(i)[8].toString()); | ||
| 165 | - try { | ||
| 166 | - y.setYyrq(sdf.parse(rq)); | ||
| 167 | - } catch (ParseException e) { | ||
| 168 | - // TODO Auto-generated catch block | ||
| 169 | - e.printStackTrace(); | ||
| 170 | - } | ||
| 171 | - yList.add(y); | ||
| 172 | - } | ||
| 173 | - PageHelper pageHelper = new PageHelper(listsize, map); | ||
| 174 | - pageHelper.getMap(); | ||
| 175 | - PageObject<Ylxxb> pageObject=pageHelper.getPageObject(); | ||
| 176 | - pageObject.setDataList(yList); | ||
| 177 | - return pageObject; | ||
| 178 | - }*/ | ||
| 179 | - | ||
| 180 | - @Override | ||
| 181 | - public Ylxxb bynbbm(Map<String, Object> map) { | ||
| 182 | - // TODO Auto-generated method stub | ||
| 183 | - // TODO Auto-generated method stub | ||
| 184 | - SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); | ||
| 185 | - String rq = map.get("rq").toString(); | ||
| 186 | - String nbbm = ""; | ||
| 187 | - if (map.get("nbbm") != null) { | ||
| 188 | - nbbm = map.get("nbbm").toString(); | ||
| 189 | - } | ||
| 190 | - List<Object[]> list = repository.obtainCwjycl(rq, nbbm); | ||
| 191 | - Ylxxb y = new Ylxxb(); | ||
| 192 | - if (list.size() > 0) { | ||
| 193 | - y.setGsdm(list.get(0)[0] == null ? "" : list.get(0)[0].toString()); | ||
| 194 | - y.setNbbm(list.get(0)[1] == null ? "" : list.get(0)[1].toString()); | ||
| 195 | - y.setJsy(list.get(0)[2] == null ? "" : list.get(0)[2].toString()); | ||
| 196 | - y.setJzl(list.get(0)[3] == null ? 0.0 : Double.parseDouble(list.get(0)[3].toString())); | ||
| 197 | - y.setStationid(list.get(0)[4] == null ? "" : list.get(0)[4].toString()); | ||
| 198 | - y.setNylx(list.get(0)[5] == null ? 0 : Integer.parseInt(list.get(0)[5].toString())); | ||
| 199 | - y.setYj(list.get(0)[6] == null ? 0.0 : Double.parseDouble(list.get(0)[6].toString())); | ||
| 200 | - y.setBz(list.get(0)[7] == null ? "" : list.get(0)[7].toString()); | ||
| 201 | - y.setLdgh(list.get(0)[8] == null ? "" : list.get(0)[8].toString()); | ||
| 202 | - try { | ||
| 203 | - y.setYyrq(sdf.parse(rq)); | ||
| 204 | - } catch (ParseException e) { | ||
| 205 | - // TODO Auto-generated catch block | ||
| 206 | - e.printStackTrace(); | ||
| 207 | - } | ||
| 208 | - } | ||
| 209 | - return y; | ||
| 210 | - } | ||
| 211 | - | ||
| 212 | - @Transactional | ||
| 213 | - @Override | ||
| 214 | - public Map<String, Object> savejzl(Map<String, Object> maps) throws Exception { | ||
| 215 | - // TODO Auto-generated method stub | ||
| 216 | - Map<String, Object> map=new HashMap<String,Object>(); | ||
| 217 | - try { | ||
| 218 | - SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); | ||
| 219 | -// String rq = sdf.format(t.getYyrq()); | ||
| 220 | -// String nbbm=t.getNbbm(); | ||
| 221 | -// List<Ylxxb> yList=ylxxbRepository.obtainYlxx2(rq,nbbm); | ||
| 222 | -// if(yList.size()>0){ | ||
| 223 | -// t.setId(yList.get(0).getId()); | ||
| 224 | -// ylxxbRepository.save(t); | ||
| 225 | -// }else{ | ||
| 226 | -// ylxxbRepository.save(t); | ||
| 227 | -// } | ||
| 228 | - String gsbm=maps.get("gsbm").toString(); | ||
| 229 | - String fgsbm=maps.get("fgsbm").toString(); | ||
| 230 | - String rq=maps.get("rq").toString(); | ||
| 231 | - Date date=sdf.parse(rq); | ||
| 232 | - String json =StringEscapeUtils.unescapeHtml4(maps.get("ylbList").toString()); | ||
| 233 | - JSONArray jsonArray=JSONArray.parseArray(json); | ||
| 234 | - JSONObject jsonObject; | ||
| 235 | - // 获取车辆存油信息 | ||
| 236 | - for (int i = 0; i < jsonArray.size(); i++) { | ||
| 237 | - jsonObject=jsonArray.getJSONObject(i); | ||
| 238 | - Integer id =jsonObject.getInteger("id"); | ||
| 239 | - String jsy=jsonObject.getString("jsy"); | ||
| 240 | - double jzl=jsonObject.getDoubleValue("jzl"); | ||
| 241 | - String stationid=jsonObject.getString("stationid"); | ||
| 242 | - String nbbm=jsonObject.getString("nbbm"); | ||
| 243 | - int nylx=jsonObject.getIntValue("nylx"); | ||
| 244 | - String jyggh=jsonObject.getString("jyggh"); | ||
| 245 | - String bz=jsonObject.getString("bz"); | ||
| 246 | - Ylxxb y; | ||
| 247 | - if(id>0){ | ||
| 248 | - y=ylxxbRepository.findById(id).get(); | ||
| 249 | - y.setJsy(jsy); | ||
| 250 | - y.setJzl(jzl); | ||
| 251 | - y.setStationid(stationid); | ||
| 252 | - y.setJyggh(jyggh); | ||
| 253 | - y.setBz(bz); | ||
| 254 | - y.setCreatetime(new Date()); | ||
| 255 | - y.setYyrq(date); | ||
| 256 | - ylxxbRepository.save(y); | ||
| 257 | - }else{ | ||
| 258 | - if(jsy!="" && jzl>0){ | ||
| 259 | - y=new Ylxxb(); | ||
| 260 | - y.setGsdm(gsbm); | ||
| 261 | - y.setJsy(jsy); | ||
| 262 | - y.setNbbm(nbbm); | ||
| 263 | - y.setJzl(jzl); | ||
| 264 | - y.setStationid(stationid); | ||
| 265 | - y.setJyggh(jyggh); | ||
| 266 | - y.setBz(bz); | ||
| 267 | - y.setCreatetime(new Date()); | ||
| 268 | - y.setYyrq(date); | ||
| 269 | - y.setJylx(1); | ||
| 270 | - y.setNylx(0); | ||
| 271 | - ylxxbRepository.save(y); | ||
| 272 | - } | ||
| 273 | - } | ||
| 274 | - } | ||
| 275 | - map.put("status", ResponseCode.SUCCESS); | ||
| 276 | - | ||
| 277 | - } catch (Exception e) { | ||
| 278 | - map.put("status", ResponseCode.ERROR); | ||
| 279 | - logger.error("save erro.", e); | ||
| 280 | - throw e; | ||
| 281 | - // TODO: handle exception | ||
| 282 | - } | ||
| 283 | - return map; | ||
| 284 | - } | ||
| 285 | - | ||
| 286 | - | ||
| 287 | - | ||
| 288 | - @Override | ||
| 289 | - public List<Ylxxb> Pagequery(Map<String, Object> map) { | ||
| 290 | - // TODO Auto-generated method stub | ||
| 291 | - String rq=map.get("rq").toString(); | ||
| 292 | - String nbbm=map.get("nbbh").toString(); | ||
| 293 | - String gsdm=map.get("gsdm_like").toString(); | ||
| 294 | - | ||
| 295 | - String fgsdm=map.get("fgsdm_like").toString(); | ||
| 296 | - String line =map.get("line_like").toString().trim(); | ||
| 297 | - /*String sql="SELECT a.gsdm as gsdm,a.fgsdm as fgsdm,a.nbbm as nbbm," | ||
| 298 | - + "b.jyggh as jyggh,b.jzl as jzl ,b.stationid as stationid,b.jsy as jsy," | ||
| 299 | - + "b.nylx as nylx,b.yj as yj,b.bz as bz,b.id as id ,c.jsy as ldgh FROM bsth_c_cwjy a "+ | ||
| 300 | - " left join (" | ||
| 301 | - + " select * from bsth_c_ylxxb b " | ||
| 302 | - + "where to_days(b.yyrq)=to_days('"+rq+"') and jylx=1 " | ||
| 303 | - + " and gsdm = '"+gsdm+"') b " + | ||
| 304 | - " on a.nbbm=b.nbbm " | ||
| 305 | - + "left join (select nbbm,group_concat(jsy) as jsy " | ||
| 306 | - + "from bsth_c_ylb where to_days(rq)= to_days('"+rq+"' ) " | ||
| 307 | - + " and ssgsdm='"+gsdm+"' and fgsdm ='"+fgsdm+"' group by nbbm "+ | ||
| 308 | - " ) c on a.nbbm=c.nbbm " | ||
| 309 | - + "where a.nbbm like '%"+nbbm+"%' and a.gsdm='"+gsdm+"' and a.fgsdm ='"+fgsdm+"'" | ||
| 310 | - + " order by a.nbbm";*/ | ||
| 311 | - String sql= " select * from bsth_c_ylxxb b " | ||
| 312 | - + "where to_days(b.yyrq)=to_days('"+rq+"') and jylx=1 " | ||
| 313 | - + " and gsdm = '"+gsdm+"'"; | ||
| 314 | - | ||
| 315 | - List<Ylxxb> yList= jdbcTemplate.query(sql, | ||
| 316 | - new RowMapper<Ylxxb>(){ | ||
| 317 | - @Override | ||
| 318 | - public Ylxxb mapRow(ResultSet rs, int rowNum) throws SQLException { | ||
| 319 | - Ylxxb t=new Ylxxb(); | ||
| 320 | - t.setId(rs.getInt("id")); | ||
| 321 | - t.setGsdm(rs.getString("gsdm")); | ||
| 322 | - t.setFgsdm(rs.getString("fgsdm")); | ||
| 323 | - t.setNbbm(rs.getString("nbbm")); | ||
| 324 | - t.setJyggh(rs.getString("jyggh")); | ||
| 325 | - t.setJsy(rs.getString("jsy")); | ||
| 326 | - t.setJzl(rs.getDouble("jzl")); | ||
| 327 | - t.setStationid(rs.getString("stationid")); | ||
| 328 | - t.setNylx(rs.getInt("nylx")); | ||
| 329 | - t.setYj(rs.getDouble("yj")); | ||
| 330 | - t.setBz(rs.getString("bz")); | ||
| 331 | - return t; | ||
| 332 | - } | ||
| 333 | - }); | ||
| 334 | - List<Cwjy> cwList=null; | ||
| 335 | - if(line.equals("")){ | ||
| 336 | - cwList = repository.selectAll(nbbm, gsdm, fgsdm); | ||
| 337 | - }else{ | ||
| 338 | - cwList = repository.selectAll_s(nbbm, gsdm, fgsdm, line); | ||
| 339 | - } | ||
| 340 | - | ||
| 341 | - String sql_ylb="SELECT nbbm,group_concat(jsy) AS jsy FROM bsth_c_ylb WHERE " | ||
| 342 | - + " rq = '"+rq+"' AND ssgsdm = '"+gsdm+"' AND " | ||
| 343 | - + " fgsdm = '"+fgsdm+"' GROUP BY nbbm"; | ||
| 344 | - | ||
| 345 | - List<Map<String, String>> ylbList= jdbcTemplate.query(sql_ylb, | ||
| 346 | - new RowMapper<Map<String, String>>(){ | ||
| 347 | - @Override | ||
| 348 | - public Map<String, String> mapRow(ResultSet rs, int rowNum) throws SQLException { | ||
| 349 | - Map<String, String> maps =new HashMap<String, String>(); | ||
| 350 | - maps.put("nbbm", rs.getString("nbbm")); | ||
| 351 | - maps.put("ldgh", rs.getString("jsy")); | ||
| 352 | - return maps; | ||
| 353 | - } | ||
| 354 | - }); | ||
| 355 | - | ||
| 356 | - List<Ylxxb> ylxxbList= new ArrayList<Ylxxb>(); | ||
| 357 | - Ylxxb y=null; | ||
| 358 | - for (int i = 0; i < cwList.size(); i++) { | ||
| 359 | - Cwjy cwjy=cwList.get(i); | ||
| 360 | - y=new Ylxxb(); | ||
| 361 | - y.setNylx(0); | ||
| 362 | - y.setId(0); | ||
| 363 | - y.setJzl(0.0); | ||
| 364 | - y.setGsdm(cwjy.getGsdm()); | ||
| 365 | - y.setFgsdm(cwjy.getFgsdm()); | ||
| 366 | - y.setNbbm(cwjy.getNbbm()); | ||
| 367 | - y.setLinename(cwjy.getLinename()); | ||
| 368 | - for (int j = 0; j < yList.size(); j++) { | ||
| 369 | - Ylxxb ylxxb=yList.get(j); | ||
| 370 | - if(y.getNbbm().equals(ylxxb.getNbbm())){ | ||
| 371 | - y.setId(ylxxb.getId()); | ||
| 372 | - y.setJyggh(ylxxb.getJyggh()); | ||
| 373 | - y.setJsy(ylxxb.getJsy()); | ||
| 374 | - y.setJzl(ylxxb.getJzl()); | ||
| 375 | - y.setStationid(ylxxb.getStationid()); | ||
| 376 | - y.setNylx(ylxxb.getNylx()); | ||
| 377 | - y.setYj(ylxxb.getYj()); | ||
| 378 | - y.setBz(ylxxb.getBz()); | ||
| 379 | - break; | ||
| 380 | - } | ||
| 381 | - } | ||
| 382 | - for (int j = 0; j < ylbList.size(); j++) { | ||
| 383 | - Map<String, String> m=ylbList.get(j); | ||
| 384 | - if(m.get("nbbm").toString().equals(cwjy.getNbbm())){ | ||
| 385 | - y.setLdgh(m.get("ldgh").toString()); | ||
| 386 | - break; | ||
| 387 | - } | ||
| 388 | - | ||
| 389 | - } | ||
| 390 | - | ||
| 391 | - ylxxbList.add(y); | ||
| 392 | - | ||
| 393 | - } | ||
| 394 | - | ||
| 395 | - return ylxxbList; | ||
| 396 | - } | ||
| 397 | - | ||
| 398 | - @Override | ||
| 399 | - public int checkNbbm(Cwjy t) { | ||
| 400 | - // TODO Auto-generated method stub | ||
| 401 | - String sql="select count(*) from bsth_c_cwjy where nbbm ='"+t.getNbbm()+"'" | ||
| 402 | - + " and gsdm ='"+t.getFgsdm()+"' and fgsdm ='"+t.getFgsdm()+"'"; | ||
| 403 | - int cs=jdbcTemplate.queryForObject(sql, Integer.class); | ||
| 404 | - | ||
| 405 | - return cs; | ||
| 406 | - } | ||
| 407 | - | ||
| 408 | - @Override | ||
| 409 | - public List<Ylxxb> cwjyList(Map<String, Object> map) { | ||
| 410 | - String rq=map.get("rq").toString(); | ||
| 411 | - String nbbm=map.get("nbbh").toString(); | ||
| 412 | - String gsdm=map.get("gsdm_like").toString(); | ||
| 413 | - | ||
| 414 | - String fgsdm=map.get("fgsdm_like").toString(); | ||
| 415 | - String line =map.get("line_like").toString().trim(); | ||
| 416 | - boolean type=false; | ||
| 417 | - if(map.get("type")!=null){ | ||
| 418 | - type=true; | ||
| 419 | - } | ||
| 420 | - String sql="select a.nbbm,a.gsdm,a.fgsdm,IFNULL(b.id,0) as id,IFNULL(b.jzl,0) as jzl," | ||
| 421 | - + " IFNULL(b.jyggh,0) as jyggh,IFNULL(b.jsy,0) as jsy,IFNULL(b.stationid,0) as stationid ," | ||
| 422 | - + " IFNULL(b.yj,0) as yj,IFNULL(b.nylx,0) as nylx,IFNULL(b.bz,'') as bz,IFNULL(c.jsy,'') as ldgh ," | ||
| 423 | - + " IFNULL(c.xlname,c.linename) as xlname from " | ||
| 424 | - + " (select * from bsth_c_cwjy where gsdm='"+gsdm+"' and fgsdm='"+fgsdm+"') a " | ||
| 425 | - + " left join (select * from bsth_c_ylxxb where yyrq='"+rq+"' and gsdm='"+gsdm+"' and jylx=1) b" | ||
| 426 | - + " on a.nbbm=b.nbbm LEFT JOIN (select u.nbbm,u.jsy,v.linename,v.xlname,v.xlbm from(select a.nbbm,GROUP_CONCAT(a.jsy) as jsy " | ||
| 427 | - + " from (select nbbm,jsy from bsth_c_ylb x where x.rq='"+rq+"' " | ||
| 428 | - + " and x.ssgsdm='"+gsdm+"' and x.fgsdm='"+fgsdm+"' group by nbbm,jsy ) a group by a.nbbm) u" | ||
| 429 | - + " LEFT JOIN(select o.nbbm,GROUP_CONCAT(o.xlbm) xlbm ,GROUP_CONCAT(o.linename) as xlname," | ||
| 430 | - + " GROUP_CONCAT(p.`name`) as linename from (select nbbm,xlbm,linename from bsth_c_ylb " | ||
| 431 | - + " where rq='"+rq+"' and ssgsdm='"+gsdm+"' and fgsdm='"+fgsdm+"' group by nbbm,xlbm,linename) o " | ||
| 432 | - + " LEFT JOIN bsth_c_line p on o.xlbm=p.line_code group by o.nbbm ) v on u.nbbm=v.nbbm) c " | ||
| 433 | - + " on a.nbbm=c.nbbm where 1=1 "; | ||
| 434 | - if(!nbbm.equals("")){ | ||
| 435 | - sql +=" and a.nbbm like '%"+nbbm+"%'"; | ||
| 436 | - } | ||
| 437 | - if(!line.equals("")){ | ||
| 438 | - sql += " and c.xlbm ='"+line+"'"; | ||
| 439 | - } | ||
| 440 | - if(type){ | ||
| 441 | - sql +=" and c.xlbm is not null"; | ||
| 442 | - } | ||
| 443 | - sql +=" order by xlname desc"; | ||
| 444 | - List<Ylxxb> yList= jdbcTemplate.query(sql, | ||
| 445 | - new RowMapper<Ylxxb>(){ | ||
| 446 | - @Override | ||
| 447 | - public Ylxxb mapRow(ResultSet rs, int rowNum) throws SQLException { | ||
| 448 | - Ylxxb t=new Ylxxb(); | ||
| 449 | - t.setId(rs.getInt("id")); | ||
| 450 | - t.setGsdm(rs.getString("gsdm")); | ||
| 451 | - t.setFgsdm(rs.getString("fgsdm")); | ||
| 452 | - t.setNbbm(rs.getString("nbbm")); | ||
| 453 | - t.setJyggh(rs.getString("jyggh")); | ||
| 454 | - t.setJsy(rs.getString("jsy")); | ||
| 455 | - t.setJzl(rs.getDouble("jzl")); | ||
| 456 | - t.setStationid(rs.getString("stationid")); | ||
| 457 | - t.setNylx(rs.getInt("nylx")); | ||
| 458 | - t.setYj(rs.getDouble("yj")); | ||
| 459 | - t.setBz(rs.getString("bz")); | ||
| 460 | - t.setLdgh(rs.getString("ldgh")); | ||
| 461 | - t.setLinename(rs.getString("xlname")); | ||
| 462 | - return t; | ||
| 463 | - } | ||
| 464 | - }); | ||
| 465 | - return yList; | ||
| 466 | - } | ||
| 467 | - | ||
| 468 | - | ||
| 469 | - @Override | ||
| 470 | - public String importExcel(File file, String gsbm, String gsName) { | ||
| 471 | - SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); | ||
| 472 | - SimpleDateFormat sd = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); | ||
| 473 | - DecimalFormat df = new DecimalFormat("######0.00"); | ||
| 474 | - List<String> textList = new ArrayList<String>(); | ||
| 475 | - try { | ||
| 476 | - POIFSFileSystem fs = new POIFSFileSystem(new FileInputStream(file)); | ||
| 477 | - HSSFWorkbook wb = new HSSFWorkbook(fs); | ||
| 478 | - HSSFSheet sheet = wb.getSheetAt(0); | ||
| 479 | - // 取得总行数 | ||
| 480 | - int rowNum = sheet.getLastRowNum() + 1; | ||
| 481 | - // 取得总列数 | ||
| 482 | - int cellNum = sheet.getRow(0).getLastCellNum(); | ||
| 483 | - HSSFRow row = null; | ||
| 484 | - HSSFCell cell = null; | ||
| 485 | - for(int i = 2; i < rowNum; i++){ | ||
| 486 | - row = sheet.getRow(i); | ||
| 487 | - if (row == null){ | ||
| 488 | - continue; | ||
| 489 | - } | ||
| 490 | - String text = ""; | ||
| 491 | - for(int j = 0; j < cellNum; j++){ | ||
| 492 | - cell = row.getCell(j); | ||
| 493 | - if(cell == null){ | ||
| 494 | - text += ","; | ||
| 495 | - continue; | ||
| 496 | - } | ||
| 497 | - text += String.valueOf(cell) + ","; | ||
| 498 | - } | ||
| 499 | - String[] split = (text+";").split(","); | ||
| 500 | - String str = ""; | ||
| 501 | - for(int j = 0; j < split.length && j < 5; j++){ | ||
| 502 | - str += split[j]; | ||
| 503 | - } | ||
| 504 | - if(str.trim().length() == 0){ | ||
| 505 | - continue; | ||
| 506 | - } | ||
| 507 | - textList.add(text + ";"); | ||
| 508 | - } | ||
| 509 | - for(int i = 0; i < textList.size(); i++){ | ||
| 510 | - String text = textList.get(i); | ||
| 511 | - System.out.println(text); | ||
| 512 | - String[] split = text.split(","); | ||
| 513 | - String rq = split[0].trim(); | ||
| 514 | - String nbbm = split[1].trim(); | ||
| 515 | - String jsy = split[2].trim(); | ||
| 516 | - double jzl = Double.valueOf(split[3].trim().length()!=0?split[3]:"0"); | ||
| 517 | - String jyz = split[4].trim(); | ||
| 518 | - String remarks = split[5].trim(); | ||
| 519 | - if(rq.trim().length() == 0){ | ||
| 520 | - rq = sdf.format(new Date()); | ||
| 521 | - } | ||
| 522 | - | ||
| 523 | - List<Double> jzl_ = repository.import_queryBySame(gsbm, rq, nbbm); | ||
| 524 | -// | ||
| 525 | - if(jzl_.size() == 0){ | ||
| 526 | - repository.import_insertData(gsbm, rq, nbbm, jsy, | ||
| 527 | - df.format(jzl), jyz, remarks, sd.format(new Date())); | ||
| 528 | - }else{ | ||
| 529 | - repository.import_UpdateJzl(df.format(jzl), jsy, jyz, remarks, gsbm, rq, nbbm); | ||
| 530 | - } | ||
| 531 | - } | ||
| 532 | - | ||
| 533 | - /** 以下为测试导入ylxxb用 */ | ||
| 534 | -// Date date = new Date(); | ||
| 535 | -// SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); | ||
| 536 | -// for(int i = 1; i < rowNum; i++){ | ||
| 537 | -// row = sheet.getRow(i); | ||
| 538 | -// if (row == null){ | ||
| 539 | -// continue; | ||
| 540 | -// } | ||
| 541 | -// String text = ""; | ||
| 542 | -// for(int j = 0; j < cellNum; j++){ | ||
| 543 | -// cell = row.getCell(j); | ||
| 544 | -// if(cell == null){ | ||
| 545 | -// text += ","; | ||
| 546 | -// continue; | ||
| 547 | -// } | ||
| 548 | -// if(j == 1 && cell.getCellType() == Cell.CELL_TYPE_NUMERIC){ | ||
| 549 | -// text += dateFormat.format(cell.getDateCellValue()) + ","; | ||
| 550 | -// } else if(j == 4 || j == 7){ | ||
| 551 | -// text += "0,"; | ||
| 552 | -//// } else if(j == 6 && String.valueOf(cell).contains("-")){ | ||
| 553 | -//// String str = String.valueOf(cell); | ||
| 554 | -//// text += str.split("-")[1] + ","; | ||
| 555 | -// } else { | ||
| 556 | -// text += String.valueOf(cell) + ","; | ||
| 557 | -// } | ||
| 558 | -// } | ||
| 559 | -// System.out.println(text); | ||
| 560 | -// Ylxxb ylxxb = new Ylxxb(); | ||
| 561 | -// String[] split = text.split(","); | ||
| 562 | -// ylxxb.setCreatetime(date); | ||
| 563 | -// ylxxb.setYyrq(sdf.parse(split[0].trim())); | ||
| 564 | -// ylxxb.setJlrq(dateFormat.parse(split[1])); | ||
| 565 | -// ylxxb.setFromgsdm("22"); | ||
| 566 | -// ylxxb.setNbbm(split[2]); | ||
| 567 | -// ylxxb.setJzl(Double.valueOf(split[3])); | ||
| 568 | -// ylxxb.setNylx(Integer.valueOf(split[4])); | ||
| 569 | -// ylxxb.setStationid(split[5]); | ||
| 570 | -// if(split[6].contains("-")){ | ||
| 571 | -// ylxxb.setJsy(split[6].split("-")[1]); | ||
| 572 | -// } | ||
| 573 | -// ylxxb.setBz(split[6]); | ||
| 574 | -// ylxxb.setJylx(Integer.valueOf(split[7])); | ||
| 575 | -// ylxxbRepository.save(ylxxb); | ||
| 576 | -// } | ||
| 577 | - wb.close(); | ||
| 578 | - fs.close(); | ||
| 579 | - } catch (Exception e) { | ||
| 580 | - // TODO Auto-generated catch block | ||
| 581 | - e.printStackTrace(); | ||
| 582 | - return "文件导入失败"; | ||
| 583 | - } finally { | ||
| 584 | - file.delete(); | ||
| 585 | - } | ||
| 586 | - return "文件导入成功"; | ||
| 587 | - } | ||
| 588 | - | ||
| 589 | - | 1 | +package com.bsth.service.oil.impl; |
| 2 | + | ||
| 3 | +import java.io.File; | ||
| 4 | +import java.io.FileInputStream; | ||
| 5 | +import java.sql.ResultSet; | ||
| 6 | +import java.sql.SQLException; | ||
| 7 | +import java.text.DecimalFormat; | ||
| 8 | +import java.text.ParseException; | ||
| 9 | +import java.text.SimpleDateFormat; | ||
| 10 | +import java.util.ArrayList; | ||
| 11 | +import java.util.Arrays; | ||
| 12 | +import java.util.Date; | ||
| 13 | +import java.util.HashMap; | ||
| 14 | +import java.util.List; | ||
| 15 | +import java.util.Map; | ||
| 16 | + | ||
| 17 | +import javax.transaction.Transactional; | ||
| 18 | + | ||
| 19 | +import org.apache.commons.lang3.StringEscapeUtils; | ||
| 20 | +import org.apache.poi.hssf.usermodel.HSSFCell; | ||
| 21 | +import org.apache.poi.hssf.usermodel.HSSFRow; | ||
| 22 | +import org.apache.poi.hssf.usermodel.HSSFSheet; | ||
| 23 | +import org.apache.poi.hssf.usermodel.HSSFWorkbook; | ||
| 24 | +import org.apache.poi.poifs.filesystem.POIFSFileSystem; | ||
| 25 | +import org.apache.poi.ss.usermodel.Cell; | ||
| 26 | +import org.slf4j.Logger; | ||
| 27 | +import org.slf4j.LoggerFactory; | ||
| 28 | +import org.springframework.beans.factory.annotation.Autowired; | ||
| 29 | +import org.springframework.jdbc.core.JdbcTemplate; | ||
| 30 | +import org.springframework.jdbc.core.RowMapper; | ||
| 31 | +import org.springframework.stereotype.Service; | ||
| 32 | + | ||
| 33 | +import com.alibaba.fastjson.JSONArray; | ||
| 34 | +import com.alibaba.fastjson.JSONObject; | ||
| 35 | +import com.bsth.common.ResponseCode; | ||
| 36 | +import com.bsth.data.BasicData; | ||
| 37 | +import com.bsth.entity.oil.Cwjy; | ||
| 38 | +import com.bsth.entity.oil.Cyl; | ||
| 39 | +import com.bsth.entity.oil.Ylb; | ||
| 40 | +import com.bsth.entity.oil.Ylxxb; | ||
| 41 | +import com.bsth.repository.oil.CwjyRepository; | ||
| 42 | +import com.bsth.repository.oil.YlxxbRepository; | ||
| 43 | +import com.bsth.service.impl.BaseServiceImpl; | ||
| 44 | +import com.bsth.service.oil.CwjyService; | ||
| 45 | +import com.bsth.util.Arith; | ||
| 46 | +import com.bsth.util.PageHelper; | ||
| 47 | +import com.bsth.util.PageObject; | ||
| 48 | + | ||
| 49 | +@Service | ||
| 50 | +public class CwjyServiceImpl extends BaseServiceImpl<Cwjy,Integer> implements CwjyService | ||
| 51 | +{ | ||
| 52 | + @Autowired | ||
| 53 | + CwjyRepository repository; | ||
| 54 | + @Autowired | ||
| 55 | + YlxxbRepository ylxxbRepository; | ||
| 56 | + | ||
| 57 | + @Autowired | ||
| 58 | + JdbcTemplate jdbcTemplate; | ||
| 59 | + Logger logger = LoggerFactory.getLogger(this.getClass()); | ||
| 60 | + /*@SuppressWarnings("unchecked") | ||
| 61 | + public PageObject<Ylxxb> Pagequery(Map<String, Object> map) { | ||
| 62 | + int page=Integer.parseInt(map.get("page").toString()); | ||
| 63 | + SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd"); | ||
| 64 | + | ||
| 65 | + String rq=map.get("rq").toString(); | ||
| 66 | + String nbbm=""; | ||
| 67 | + if(map.get("nbbh")!=null){ | ||
| 68 | + nbbm=map.get("nbbh").toString(); | ||
| 69 | + } | ||
| 70 | + | ||
| 71 | + Object gsdmIn=map.get("gsdm_in"); | ||
| 72 | + Object fgsdmIn=map.get("fgsdm_in"); | ||
| 73 | + String addSql=""; | ||
| 74 | + String gsdmLike=""; | ||
| 75 | + String fgsdmLike=""; | ||
| 76 | + | ||
| 77 | + //选择了公司 | ||
| 78 | + if(gsdmIn==null){ | ||
| 79 | + gsdmLike=map.get("gsdm_like").toString(); | ||
| 80 | + addSql += " and a.gsdm = '"+gsdmLike+ "' "; | ||
| 81 | + | ||
| 82 | + //选择了分公司 | ||
| 83 | + if(fgsdmIn==null){ | ||
| 84 | + fgsdmLike=map.get("fgsdm_like").toString();; | ||
| 85 | + addSql += " and a.fgsdm = '"+fgsdmLike+ "' "; | ||
| 86 | + }else{ | ||
| 87 | + String fgsdmIns[]= fgsdmIn.toString().split(","); | ||
| 88 | + addSql +=" and a.fgsdm in ("; | ||
| 89 | + for(int i=0;i<fgsdmIns.length;i++){ | ||
| 90 | + addSql +="'"+fgsdmIns[i]+"'"; | ||
| 91 | + if(i<fgsdmIns.length-1){ | ||
| 92 | + addSql +=","; | ||
| 93 | + } | ||
| 94 | + } | ||
| 95 | + addSql +=")"; | ||
| 96 | + } | ||
| 97 | + }else{ | ||
| 98 | + //没有选择公司 (分公司也没有选择) | ||
| 99 | + String gsdmIns[]=gsdmIn.toString().split(","); | ||
| 100 | + addSql += " and a.gsdm in ("; | ||
| 101 | + for(int i=0;i<gsdmIns.length;i++){ | ||
| 102 | + addSql +="'" +gsdmIns[i]+"'"; | ||
| 103 | + if(i<gsdmIns.length-1){ | ||
| 104 | + addSql+=","; | ||
| 105 | + } | ||
| 106 | + } | ||
| 107 | + addSql +=")"; | ||
| 108 | + String fgsdmIns[]= fgsdmIn.toString().split(","); | ||
| 109 | + addSql +=" and a.fgsdm in ("; | ||
| 110 | + for(int i=0;i<fgsdmIns.length;i++){ | ||
| 111 | + addSql +="'"+fgsdmIns[i]+"'"; | ||
| 112 | + if(i<fgsdmIns.length-1){ | ||
| 113 | + addSql +=","; | ||
| 114 | + } | ||
| 115 | + } | ||
| 116 | + addSql +=")"; | ||
| 117 | + | ||
| 118 | + | ||
| 119 | + } | ||
| 120 | + String countSql="SELECT ifnull(count(*),0) as countTs FROM bsth_c_cwjy a "+ | ||
| 121 | + " left join ( select * from bsth_c_ylxxb b where to_days(b.yyrq)=to_days('"+rq+"') and jylx=1) b " + | ||
| 122 | + " on a.nbbm=b.nbbm left join (select nbbm,group_concat(jsy) as jsy " | ||
| 123 | + + "from bsth_c_ylb where to_days(rq)= to_days('"+rq+"' ) group by nbbm "+ | ||
| 124 | + " ) c on a.nbbm=c.nbbm where a.nbbm like '%"+nbbm+"%' " +addSql ; | ||
| 125 | + int listsize=jdbcTemplate.queryForObject(countSql, Integer.class); | ||
| 126 | + // TODO Auto-generated method stub | ||
| 127 | + String sql="SELECT a.gsdm as gsdm,a.fgsdm as fgsdm,a.nbbm as nbbm,b.jsy as jsy,b.jzl as jzl ,b.stationid as stationid," | ||
| 128 | + + "b.nylx as nylx,b.yj as yj,b.bz as bz,c.jsy as ldgh FROM bsth_c_cwjy a "+ | ||
| 129 | + " left join ( select * from bsth_c_ylxxb b where to_days(b.yyrq)=to_days('"+rq+"') and jylx=1) b " + | ||
| 130 | + " on a.nbbm=b.nbbm left join (select nbbm,group_concat(jsy) as jsy " | ||
| 131 | + + "from bsth_c_ylb where to_days(rq)= to_days('"+rq+"' ) group by nbbm "+ | ||
| 132 | + " ) c on a.nbbm=c.nbbm where a.nbbm like '%"+nbbm+"%' " +addSql+ " limit "+page*10+","+10; | ||
| 133 | + | ||
| 134 | + | ||
| 135 | + List<Ylxxb> yList= jdbcTemplate.query(sql, | ||
| 136 | + new RowMapper<Ylxxb>(){ | ||
| 137 | + @Override | ||
| 138 | + public Ylxxb mapRow(ResultSet rs, int rowNum) throws SQLException { | ||
| 139 | + Ylxxb t=new Ylxxb(); | ||
| 140 | + t.setGsdm(rs.getString("gsdm")); | ||
| 141 | + t.setFgsdm(rs.getString("fgsdm")); | ||
| 142 | + t.setNbbm(rs.getString("nbbm")); | ||
| 143 | + t.setJsy(rs.getString("jsy")); | ||
| 144 | + t.setJzl(rs.getDouble("jzl")); | ||
| 145 | + t.setStationid(rs.getString("stationid")); | ||
| 146 | + t.setNylx(rs.getInt("nylx")); | ||
| 147 | + t.setYj(rs.getDouble("yj")); | ||
| 148 | + t.setBz(rs.getString("bz")); | ||
| 149 | + t.setLdgh(rs.getString("ldgh")); | ||
| 150 | + return t; | ||
| 151 | + } | ||
| 152 | + }); | ||
| 153 | + List<Object[]> list=repository.obtainCwjycl(rq,nbbm); | ||
| 154 | + for (int i = 0; i < list.size(); i++) { | ||
| 155 | + Ylxxb y=new Ylxxb(); | ||
| 156 | + y.setGsdm(list.get(i)[0]==null?"":list.get(i)[0].toString()); | ||
| 157 | + y.setNbbm(list.get(i)[1]==null?"":list.get(i)[1].toString()); | ||
| 158 | + y.setJsy(list.get(i)[2]==null?"":list.get(i)[2].toString()); | ||
| 159 | + y.setJzl(list.get(i)[3]==null?0.0:Double.parseDouble(list.get(i)[3].toString())); | ||
| 160 | + y.setStationid(list.get(i)[4]==null?"":list.get(i)[4].toString()); | ||
| 161 | + y.setNylx(list.get(i)[5]==null?0:Integer.parseInt(list.get(i)[5].toString())); | ||
| 162 | + y.setYj(list.get(i)[6]==null?0.0:Double.parseDouble(list.get(i)[6].toString())); | ||
| 163 | + y.setBz(list.get(i)[7]==null?"":list.get(i)[7].toString()); | ||
| 164 | + y.setLdgh(list.get(i)[8]==null?"":list.get(i)[8].toString()); | ||
| 165 | + try { | ||
| 166 | + y.setYyrq(sdf.parse(rq)); | ||
| 167 | + } catch (ParseException e) { | ||
| 168 | + // TODO Auto-generated catch block | ||
| 169 | + e.printStackTrace(); | ||
| 170 | + } | ||
| 171 | + yList.add(y); | ||
| 172 | + } | ||
| 173 | + PageHelper pageHelper = new PageHelper(listsize, map); | ||
| 174 | + pageHelper.getMap(); | ||
| 175 | + PageObject<Ylxxb> pageObject=pageHelper.getPageObject(); | ||
| 176 | + pageObject.setDataList(yList); | ||
| 177 | + return pageObject; | ||
| 178 | + }*/ | ||
| 179 | + | ||
| 180 | + @Override | ||
| 181 | + public Ylxxb bynbbm(Map<String, Object> map) { | ||
| 182 | + // TODO Auto-generated method stub | ||
| 183 | + // TODO Auto-generated method stub | ||
| 184 | + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); | ||
| 185 | + String rq = map.get("rq").toString(); | ||
| 186 | + String nbbm = ""; | ||
| 187 | + if (map.get("nbbm") != null) { | ||
| 188 | + nbbm = map.get("nbbm").toString(); | ||
| 189 | + } | ||
| 190 | + List<Object[]> list = repository.obtainCwjycl(rq, nbbm); | ||
| 191 | + Ylxxb y = new Ylxxb(); | ||
| 192 | + if (list.size() > 0) { | ||
| 193 | + y.setGsdm(list.get(0)[0] == null ? "" : list.get(0)[0].toString()); | ||
| 194 | + y.setNbbm(list.get(0)[1] == null ? "" : list.get(0)[1].toString()); | ||
| 195 | + y.setJsy(list.get(0)[2] == null ? "" : list.get(0)[2].toString()); | ||
| 196 | + y.setJzl(list.get(0)[3] == null ? 0.0 : Double.parseDouble(list.get(0)[3].toString())); | ||
| 197 | + y.setStationid(list.get(0)[4] == null ? "" : list.get(0)[4].toString()); | ||
| 198 | + y.setNylx(list.get(0)[5] == null ? 0 : Integer.parseInt(list.get(0)[5].toString())); | ||
| 199 | + y.setYj(list.get(0)[6] == null ? 0.0 : Double.parseDouble(list.get(0)[6].toString())); | ||
| 200 | + y.setBz(list.get(0)[7] == null ? "" : list.get(0)[7].toString()); | ||
| 201 | + y.setLdgh(list.get(0)[8] == null ? "" : list.get(0)[8].toString()); | ||
| 202 | + try { | ||
| 203 | + y.setYyrq(sdf.parse(rq)); | ||
| 204 | + } catch (ParseException e) { | ||
| 205 | + // TODO Auto-generated catch block | ||
| 206 | + e.printStackTrace(); | ||
| 207 | + } | ||
| 208 | + } | ||
| 209 | + return y; | ||
| 210 | + } | ||
| 211 | + | ||
| 212 | + @Transactional | ||
| 213 | + @Override | ||
| 214 | + public Map<String, Object> savejzl(Map<String, Object> maps) throws Exception { | ||
| 215 | + // TODO Auto-generated method stub | ||
| 216 | + Map<String, Object> map=new HashMap<String,Object>(); | ||
| 217 | + try { | ||
| 218 | + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); | ||
| 219 | +// String rq = sdf.format(t.getYyrq()); | ||
| 220 | +// String nbbm=t.getNbbm(); | ||
| 221 | +// List<Ylxxb> yList=ylxxbRepository.obtainYlxx2(rq,nbbm); | ||
| 222 | +// if(yList.size()>0){ | ||
| 223 | +// t.setId(yList.get(0).getId()); | ||
| 224 | +// ylxxbRepository.save(t); | ||
| 225 | +// }else{ | ||
| 226 | +// ylxxbRepository.save(t); | ||
| 227 | +// } | ||
| 228 | + String gsbm=maps.get("gsbm").toString(); | ||
| 229 | + String fgsbm=maps.get("fgsbm").toString(); | ||
| 230 | + String rq=maps.get("rq").toString(); | ||
| 231 | + Date date=sdf.parse(rq); | ||
| 232 | + String json =StringEscapeUtils.unescapeHtml4(maps.get("ylbList").toString()); | ||
| 233 | + JSONArray jsonArray=JSONArray.parseArray(json); | ||
| 234 | + JSONObject jsonObject; | ||
| 235 | + // 获取车辆存油信息 | ||
| 236 | + for (int i = 0; i < jsonArray.size(); i++) { | ||
| 237 | + jsonObject=jsonArray.getJSONObject(i); | ||
| 238 | + Integer id =jsonObject.getInteger("id"); | ||
| 239 | + String jsy=jsonObject.getString("jsy"); | ||
| 240 | + double jzl=jsonObject.getDoubleValue("jzl"); | ||
| 241 | + String stationid=jsonObject.getString("stationid"); | ||
| 242 | + String nbbm=jsonObject.getString("nbbm"); | ||
| 243 | + int nylx=jsonObject.getIntValue("nylx"); | ||
| 244 | + String jyggh=jsonObject.getString("jyggh"); | ||
| 245 | + String bz=jsonObject.getString("bz"); | ||
| 246 | + Ylxxb y; | ||
| 247 | + if(id>0){ | ||
| 248 | + y=ylxxbRepository.findById(id).get(); | ||
| 249 | + y.setJsy(jsy); | ||
| 250 | + y.setJzl(jzl); | ||
| 251 | + y.setStationid(stationid); | ||
| 252 | + y.setJyggh(jyggh); | ||
| 253 | + y.setBz(bz); | ||
| 254 | + y.setCreatetime(new Date()); | ||
| 255 | + y.setYyrq(date); | ||
| 256 | + ylxxbRepository.save(y); | ||
| 257 | + }else{ | ||
| 258 | + if(jsy!="" && jzl>0){ | ||
| 259 | + y=new Ylxxb(); | ||
| 260 | + y.setGsdm(gsbm); | ||
| 261 | + y.setJsy(jsy); | ||
| 262 | + y.setNbbm(nbbm); | ||
| 263 | + y.setJzl(jzl); | ||
| 264 | + y.setStationid(stationid); | ||
| 265 | + y.setJyggh(jyggh); | ||
| 266 | + y.setBz(bz); | ||
| 267 | + y.setCreatetime(new Date()); | ||
| 268 | + y.setYyrq(date); | ||
| 269 | + y.setJylx(1); | ||
| 270 | + y.setNylx(0); | ||
| 271 | + ylxxbRepository.save(y); | ||
| 272 | + } | ||
| 273 | + } | ||
| 274 | + } | ||
| 275 | + map.put("status", ResponseCode.SUCCESS); | ||
| 276 | + | ||
| 277 | + } catch (Exception e) { | ||
| 278 | + map.put("status", ResponseCode.ERROR); | ||
| 279 | + logger.error("save erro.", e); | ||
| 280 | + throw e; | ||
| 281 | + // TODO: handle exception | ||
| 282 | + } | ||
| 283 | + return map; | ||
| 284 | + } | ||
| 285 | + | ||
| 286 | + | ||
| 287 | + | ||
| 288 | + @Override | ||
| 289 | + public List<Ylxxb> Pagequery(Map<String, Object> map) { | ||
| 290 | + // TODO Auto-generated method stub | ||
| 291 | + String rq=map.get("rq").toString(); | ||
| 292 | + String nbbm=map.get("nbbh").toString(); | ||
| 293 | + String gsdm=map.get("gsdm_like").toString(); | ||
| 294 | + | ||
| 295 | + String fgsdm=map.get("fgsdm_like").toString(); | ||
| 296 | + String line =map.get("line_like").toString().trim(); | ||
| 297 | + /*String sql="SELECT a.gsdm as gsdm,a.fgsdm as fgsdm,a.nbbm as nbbm," | ||
| 298 | + + "b.jyggh as jyggh,b.jzl as jzl ,b.stationid as stationid,b.jsy as jsy," | ||
| 299 | + + "b.nylx as nylx,b.yj as yj,b.bz as bz,b.id as id ,c.jsy as ldgh FROM bsth_c_cwjy a "+ | ||
| 300 | + " left join (" | ||
| 301 | + + " select * from bsth_c_ylxxb b " | ||
| 302 | + + "where to_days(b.yyrq)=to_days('"+rq+"') and jylx=1 " | ||
| 303 | + + " and gsdm = '"+gsdm+"') b " + | ||
| 304 | + " on a.nbbm=b.nbbm " | ||
| 305 | + + "left join (select nbbm,group_concat(jsy) as jsy " | ||
| 306 | + + "from bsth_c_ylb where to_days(rq)= to_days('"+rq+"' ) " | ||
| 307 | + + " and ssgsdm='"+gsdm+"' and fgsdm ='"+fgsdm+"' group by nbbm "+ | ||
| 308 | + " ) c on a.nbbm=c.nbbm " | ||
| 309 | + + "where a.nbbm like '%"+nbbm+"%' and a.gsdm='"+gsdm+"' and a.fgsdm ='"+fgsdm+"'" | ||
| 310 | + + " order by a.nbbm";*/ | ||
| 311 | + String sql= " select * from bsth_c_ylxxb b " | ||
| 312 | + + "where to_days(b.yyrq)=to_days('"+rq+"') and jylx=1 " | ||
| 313 | + + " and gsdm = '"+gsdm+"'"; | ||
| 314 | + | ||
| 315 | + List<Ylxxb> yList= jdbcTemplate.query(sql, | ||
| 316 | + new RowMapper<Ylxxb>(){ | ||
| 317 | + @Override | ||
| 318 | + public Ylxxb mapRow(ResultSet rs, int rowNum) throws SQLException { | ||
| 319 | + Ylxxb t=new Ylxxb(); | ||
| 320 | + t.setId(rs.getInt("id")); | ||
| 321 | + t.setGsdm(rs.getString("gsdm")); | ||
| 322 | + t.setFgsdm(rs.getString("fgsdm")); | ||
| 323 | + t.setNbbm(rs.getString("nbbm")); | ||
| 324 | + t.setJyggh(rs.getString("jyggh")); | ||
| 325 | + t.setJsy(rs.getString("jsy")); | ||
| 326 | + t.setJzl(rs.getDouble("jzl")); | ||
| 327 | + t.setStationid(rs.getString("stationid")); | ||
| 328 | + t.setNylx(rs.getInt("nylx")); | ||
| 329 | + t.setYj(rs.getDouble("yj")); | ||
| 330 | + t.setBz(rs.getString("bz")); | ||
| 331 | + return t; | ||
| 332 | + } | ||
| 333 | + }); | ||
| 334 | + List<Cwjy> cwList=null; | ||
| 335 | + if(line.equals("")){ | ||
| 336 | + cwList = repository.selectAll(nbbm, gsdm, fgsdm); | ||
| 337 | + }else{ | ||
| 338 | + cwList = repository.selectAll_s(nbbm, gsdm, fgsdm, line); | ||
| 339 | + } | ||
| 340 | + | ||
| 341 | + String sql_ylb="SELECT nbbm,group_concat(jsy) AS jsy FROM bsth_c_ylb WHERE " | ||
| 342 | + + " rq = '"+rq+"' AND ssgsdm = '"+gsdm+"' AND " | ||
| 343 | + + " fgsdm = '"+fgsdm+"' GROUP BY nbbm"; | ||
| 344 | + | ||
| 345 | + List<Map<String, String>> ylbList= jdbcTemplate.query(sql_ylb, | ||
| 346 | + new RowMapper<Map<String, String>>(){ | ||
| 347 | + @Override | ||
| 348 | + public Map<String, String> mapRow(ResultSet rs, int rowNum) throws SQLException { | ||
| 349 | + Map<String, String> maps =new HashMap<String, String>(); | ||
| 350 | + maps.put("nbbm", rs.getString("nbbm")); | ||
| 351 | + maps.put("ldgh", rs.getString("jsy")); | ||
| 352 | + return maps; | ||
| 353 | + } | ||
| 354 | + }); | ||
| 355 | + | ||
| 356 | + List<Ylxxb> ylxxbList= new ArrayList<Ylxxb>(); | ||
| 357 | + Ylxxb y=null; | ||
| 358 | + for (int i = 0; i < cwList.size(); i++) { | ||
| 359 | + Cwjy cwjy=cwList.get(i); | ||
| 360 | + y=new Ylxxb(); | ||
| 361 | + y.setNylx(0); | ||
| 362 | + y.setId(0); | ||
| 363 | + y.setJzl(0.0); | ||
| 364 | + y.setGsdm(cwjy.getGsdm()); | ||
| 365 | + y.setFgsdm(cwjy.getFgsdm()); | ||
| 366 | + y.setNbbm(cwjy.getNbbm()); | ||
| 367 | + y.setLinename(cwjy.getLinename()); | ||
| 368 | + for (int j = 0; j < yList.size(); j++) { | ||
| 369 | + Ylxxb ylxxb=yList.get(j); | ||
| 370 | + if(y.getNbbm().equals(ylxxb.getNbbm())){ | ||
| 371 | + y.setId(ylxxb.getId()); | ||
| 372 | + y.setJyggh(ylxxb.getJyggh()); | ||
| 373 | + y.setJsy(ylxxb.getJsy()); | ||
| 374 | + y.setJzl(ylxxb.getJzl()); | ||
| 375 | + y.setStationid(ylxxb.getStationid()); | ||
| 376 | + y.setNylx(ylxxb.getNylx()); | ||
| 377 | + y.setYj(ylxxb.getYj()); | ||
| 378 | + y.setBz(ylxxb.getBz()); | ||
| 379 | + break; | ||
| 380 | + } | ||
| 381 | + } | ||
| 382 | + for (int j = 0; j < ylbList.size(); j++) { | ||
| 383 | + Map<String, String> m=ylbList.get(j); | ||
| 384 | + if(m.get("nbbm").toString().equals(cwjy.getNbbm())){ | ||
| 385 | + y.setLdgh(m.get("ldgh").toString()); | ||
| 386 | + break; | ||
| 387 | + } | ||
| 388 | + | ||
| 389 | + } | ||
| 390 | + | ||
| 391 | + ylxxbList.add(y); | ||
| 392 | + | ||
| 393 | + } | ||
| 394 | + | ||
| 395 | + return ylxxbList; | ||
| 396 | + } | ||
| 397 | + | ||
| 398 | + @Override | ||
| 399 | + public int checkNbbm(Cwjy t) { | ||
| 400 | + // TODO Auto-generated method stub | ||
| 401 | + String sql="select count(*) from bsth_c_cwjy where nbbm ='"+t.getNbbm()+"'" | ||
| 402 | + + " and gsdm ='"+t.getFgsdm()+"' and fgsdm ='"+t.getFgsdm()+"'"; | ||
| 403 | + int cs=jdbcTemplate.queryForObject(sql, Integer.class); | ||
| 404 | + | ||
| 405 | + return cs; | ||
| 406 | + } | ||
| 407 | + | ||
| 408 | + @Override | ||
| 409 | + public List<Ylxxb> cwjyList(Map<String, Object> map) { | ||
| 410 | + String rq=map.get("rq").toString(); | ||
| 411 | + String nbbm=map.get("nbbh").toString(); | ||
| 412 | + String gsdm=map.get("gsdm_like").toString(); | ||
| 413 | + | ||
| 414 | + String fgsdm=map.get("fgsdm_like").toString(); | ||
| 415 | + String line =map.get("line_like").toString().trim(); | ||
| 416 | + boolean type=false; | ||
| 417 | + if(map.get("type")!=null){ | ||
| 418 | + type=true; | ||
| 419 | + } | ||
| 420 | + String sql="select a.nbbm,a.gsdm,a.fgsdm,IFNULL(b.id,0) as id,IFNULL(b.jzl,0) as jzl," | ||
| 421 | + + " IFNULL(b.jyggh,0) as jyggh,IFNULL(b.jsy,0) as jsy,IFNULL(b.stationid,0) as stationid ," | ||
| 422 | + + " IFNULL(b.yj,0) as yj,IFNULL(b.nylx,0) as nylx,IFNULL(b.bz,'') as bz,IFNULL(c.jsy,'') as ldgh ," | ||
| 423 | + + " IFNULL(c.xlname,c.linename) as xlname from " | ||
| 424 | + + " (select * from bsth_c_cwjy where gsdm='"+gsdm+"' and fgsdm='"+fgsdm+"') a " | ||
| 425 | + + " left join (select * from bsth_c_ylxxb where yyrq='"+rq+"' and gsdm='"+gsdm+"' and jylx=1) b" | ||
| 426 | + + " on a.nbbm=b.nbbm LEFT JOIN (select u.nbbm,u.jsy,v.linename,v.xlname,v.xlbm from(select a.nbbm,GROUP_CONCAT(a.jsy) as jsy " | ||
| 427 | + + " from (select nbbm,jsy from bsth_c_ylb x where x.rq='"+rq+"' " | ||
| 428 | + + " and x.ssgsdm='"+gsdm+"' and x.fgsdm='"+fgsdm+"' group by nbbm,jsy ) a group by a.nbbm) u" | ||
| 429 | + + " LEFT JOIN(select o.nbbm,GROUP_CONCAT(o.xlbm) xlbm ,GROUP_CONCAT(o.linename) as xlname," | ||
| 430 | + + " GROUP_CONCAT(p.`name`) as linename from (select nbbm,xlbm,linename from bsth_c_ylb " | ||
| 431 | + + " where rq='"+rq+"' and ssgsdm='"+gsdm+"' and fgsdm='"+fgsdm+"' group by nbbm,xlbm,linename) o " | ||
| 432 | + + " LEFT JOIN bsth_c_line p on o.xlbm=p.line_code group by o.nbbm ) v on u.nbbm=v.nbbm) c " | ||
| 433 | + + " on a.nbbm=c.nbbm where 1=1 "; | ||
| 434 | + if(!nbbm.equals("")){ | ||
| 435 | + sql +=" and a.nbbm like '%"+nbbm+"%'"; | ||
| 436 | + } | ||
| 437 | + if(!line.equals("")){ | ||
| 438 | + sql += " and c.xlbm ='"+line+"'"; | ||
| 439 | + } | ||
| 440 | + if(type){ | ||
| 441 | + sql +=" and c.xlbm is not null"; | ||
| 442 | + } | ||
| 443 | + sql +=" order by xlname desc"; | ||
| 444 | + List<Ylxxb> yList= jdbcTemplate.query(sql, | ||
| 445 | + new RowMapper<Ylxxb>(){ | ||
| 446 | + @Override | ||
| 447 | + public Ylxxb mapRow(ResultSet rs, int rowNum) throws SQLException { | ||
| 448 | + Ylxxb t=new Ylxxb(); | ||
| 449 | + t.setId(rs.getInt("id")); | ||
| 450 | + t.setGsdm(rs.getString("gsdm")); | ||
| 451 | + t.setFgsdm(rs.getString("fgsdm")); | ||
| 452 | + t.setNbbm(rs.getString("nbbm")); | ||
| 453 | + t.setJyggh(rs.getString("jyggh")); | ||
| 454 | + t.setJsy(rs.getString("jsy")); | ||
| 455 | + t.setJzl(rs.getDouble("jzl")); | ||
| 456 | + t.setStationid(rs.getString("stationid")); | ||
| 457 | + t.setNylx(rs.getInt("nylx")); | ||
| 458 | + t.setYj(rs.getDouble("yj")); | ||
| 459 | + t.setBz(rs.getString("bz")); | ||
| 460 | + t.setLdgh(rs.getString("ldgh")); | ||
| 461 | + t.setLinename(rs.getString("xlname")); | ||
| 462 | + return t; | ||
| 463 | + } | ||
| 464 | + }); | ||
| 465 | + return yList; | ||
| 466 | + } | ||
| 467 | + | ||
| 468 | + | ||
| 469 | + @Override | ||
| 470 | + public String importExcel(File file, String gsbm, String gsName) { | ||
| 471 | + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); | ||
| 472 | + SimpleDateFormat sd = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); | ||
| 473 | + DecimalFormat df = new DecimalFormat("######0.00"); | ||
| 474 | + List<String> textList = new ArrayList<String>(); | ||
| 475 | + try { | ||
| 476 | + POIFSFileSystem fs = new POIFSFileSystem(new FileInputStream(file)); | ||
| 477 | + HSSFWorkbook wb = new HSSFWorkbook(fs); | ||
| 478 | + HSSFSheet sheet = wb.getSheetAt(0); | ||
| 479 | + // 取得总行数 | ||
| 480 | + int rowNum = sheet.getLastRowNum() + 1; | ||
| 481 | + // 取得总列数 | ||
| 482 | + int cellNum = sheet.getRow(0).getLastCellNum(); | ||
| 483 | + HSSFRow row = null; | ||
| 484 | + HSSFCell cell = null; | ||
| 485 | + for(int i = 2; i < rowNum; i++){ | ||
| 486 | + row = sheet.getRow(i); | ||
| 487 | + if (row == null){ | ||
| 488 | + continue; | ||
| 489 | + } | ||
| 490 | + String text = ""; | ||
| 491 | + for(int j = 0; j < cellNum; j++){ | ||
| 492 | + cell = row.getCell(j); | ||
| 493 | + if(cell == null){ | ||
| 494 | + text += ","; | ||
| 495 | + continue; | ||
| 496 | + } | ||
| 497 | + text += String.valueOf(cell) + ","; | ||
| 498 | + } | ||
| 499 | + String[] split = (text+";").split(","); | ||
| 500 | + String str = ""; | ||
| 501 | + for(int j = 0; j < split.length && j < 5; j++){ | ||
| 502 | + str += split[j]; | ||
| 503 | + } | ||
| 504 | + if(str.trim().length() == 0){ | ||
| 505 | + continue; | ||
| 506 | + } | ||
| 507 | + textList.add(text + ";"); | ||
| 508 | + } | ||
| 509 | + for(int i = 0; i < textList.size(); i++){ | ||
| 510 | + String text = textList.get(i); | ||
| 511 | + System.out.println(text); | ||
| 512 | + String[] split = text.split(","); | ||
| 513 | + String rq = split[0].trim(); | ||
| 514 | + String nbbm = split[1].trim(); | ||
| 515 | + String jsy = split[2].trim(); | ||
| 516 | + double jzl = Double.valueOf(split[3].trim().length()!=0?split[3]:"0"); | ||
| 517 | + String jyz = split[4].trim(); | ||
| 518 | + String remarks = split[5].trim(); | ||
| 519 | + if(rq.trim().length() == 0){ | ||
| 520 | + rq = sdf.format(new Date()); | ||
| 521 | + } | ||
| 522 | + System.out.println(jsy); | ||
| 523 | + if(jsy != null && jsy.length() > 0 && !(jsy.equals(jsy.replaceAll("\\p{P}", "")))){ | ||
| 524 | + return "场外加油:驾驶员工号错误,请检查是否导入错误excel"; | ||
| 525 | + } | ||
| 526 | + | ||
| 527 | + List<Double> jzl_ = repository.import_queryBySame(gsbm, rq, nbbm); | ||
| 528 | +// | ||
| 529 | + if(jzl_.size() == 0){ | ||
| 530 | + repository.import_insertData(gsbm, rq, nbbm, jsy, | ||
| 531 | + df.format(jzl), jyz, remarks, sd.format(new Date())); | ||
| 532 | + }else{ | ||
| 533 | + repository.import_UpdateJzl(df.format(jzl), jsy, jyz, remarks, gsbm, rq, nbbm); | ||
| 534 | + } | ||
| 535 | + } | ||
| 536 | + | ||
| 537 | + /** 以下为测试导入ylxxb用 */ | ||
| 538 | +// Date date = new Date(); | ||
| 539 | +// SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); | ||
| 540 | +// for(int i = 1; i < rowNum; i++){ | ||
| 541 | +// row = sheet.getRow(i); | ||
| 542 | +// if (row == null){ | ||
| 543 | +// continue; | ||
| 544 | +// } | ||
| 545 | +// String text = ""; | ||
| 546 | +// for(int j = 0; j < cellNum; j++){ | ||
| 547 | +// cell = row.getCell(j); | ||
| 548 | +// if(cell == null){ | ||
| 549 | +// text += ","; | ||
| 550 | +// continue; | ||
| 551 | +// } | ||
| 552 | +// if(j == 1 && cell.getCellType() == Cell.CELL_TYPE_NUMERIC){ | ||
| 553 | +// text += dateFormat.format(cell.getDateCellValue()) + ","; | ||
| 554 | +// } else if(j == 4 || j == 7){ | ||
| 555 | +// text += "0,"; | ||
| 556 | +//// } else if(j == 6 && String.valueOf(cell).contains("-")){ | ||
| 557 | +//// String str = String.valueOf(cell); | ||
| 558 | +//// text += str.split("-")[1] + ","; | ||
| 559 | +// } else { | ||
| 560 | +// text += String.valueOf(cell) + ","; | ||
| 561 | +// } | ||
| 562 | +// } | ||
| 563 | +// System.out.println(text); | ||
| 564 | +// Ylxxb ylxxb = new Ylxxb(); | ||
| 565 | +// String[] split = text.split(","); | ||
| 566 | +// ylxxb.setCreatetime(date); | ||
| 567 | +// ylxxb.setYyrq(sdf.parse(split[0].trim())); | ||
| 568 | +// ylxxb.setJlrq(dateFormat.parse(split[1])); | ||
| 569 | +// ylxxb.setFromgsdm("22"); | ||
| 570 | +// ylxxb.setNbbm(split[2]); | ||
| 571 | +// ylxxb.setJzl(Double.valueOf(split[3])); | ||
| 572 | +// ylxxb.setNylx(Integer.valueOf(split[4])); | ||
| 573 | +// ylxxb.setStationid(split[5]); | ||
| 574 | +// if(split[6].contains("-")){ | ||
| 575 | +// ylxxb.setJsy(split[6].split("-")[1]); | ||
| 576 | +// } | ||
| 577 | +// ylxxb.setBz(split[6]); | ||
| 578 | +// ylxxb.setJylx(Integer.valueOf(split[7])); | ||
| 579 | +// ylxxbRepository.save(ylxxb); | ||
| 580 | +// } | ||
| 581 | + wb.close(); | ||
| 582 | + fs.close(); | ||
| 583 | + } catch (Exception e) { | ||
| 584 | + // TODO Auto-generated catch block | ||
| 585 | + e.printStackTrace(); | ||
| 586 | + return "文件导入失败"; | ||
| 587 | + } finally { | ||
| 588 | + file.delete(); | ||
| 589 | + } | ||
| 590 | + return "文件导入成功"; | ||
| 591 | + } | ||
| 592 | + | ||
| 593 | + | ||
| 590 | } | 594 | } |
| 591 | \ No newline at end of file | 595 | \ No newline at end of file |
src/main/java/com/bsth/service/oil/impl/YlbServiceImpl.java
| 1 | -package com.bsth.service.oil.impl; | ||
| 2 | - | ||
| 3 | -import java.sql.ResultSet; | ||
| 4 | -import java.sql.SQLException; | ||
| 5 | -import java.text.DecimalFormat; | ||
| 6 | -import java.text.ParseException; | ||
| 7 | -import java.text.SimpleDateFormat; | ||
| 8 | -import java.util.ArrayList; | ||
| 9 | -import java.util.Calendar; | ||
| 10 | -import java.util.Date; | ||
| 11 | -import java.util.HashMap; | ||
| 12 | -import java.util.Iterator; | ||
| 13 | -import java.util.List; | ||
| 14 | -import java.util.Map; | ||
| 15 | - | ||
| 16 | -import javax.transaction.Transactional; | ||
| 17 | - | ||
| 18 | -import org.apache.commons.lang3.StringEscapeUtils; | ||
| 19 | -import org.apache.commons.lang3.StringUtils; | ||
| 20 | -import org.slf4j.Logger; | ||
| 21 | -import org.slf4j.LoggerFactory; | ||
| 22 | -import org.springframework.beans.factory.annotation.Autowired; | ||
| 23 | -import org.springframework.data.domain.Sort; | ||
| 24 | -import org.springframework.data.domain.Sort.Direction; | ||
| 25 | -import org.springframework.jdbc.core.JdbcTemplate; | ||
| 26 | -import org.springframework.jdbc.core.RowMapper; | ||
| 27 | -import org.springframework.stereotype.Service; | ||
| 28 | - | ||
| 29 | -import com.alibaba.fastjson.JSONArray; | ||
| 30 | -import com.alibaba.fastjson.JSONObject; | ||
| 31 | -import com.bsth.common.ResponseCode; | ||
| 32 | -import com.bsth.data.BasicData; | ||
| 33 | -import com.bsth.entity.Cars; | ||
| 34 | -import com.bsth.entity.Line; | ||
| 35 | -import com.bsth.entity.mcy_forms.Daily; | ||
| 36 | -import com.bsth.entity.oil.Cyl; | ||
| 37 | -import com.bsth.entity.oil.Dlb; | ||
| 38 | -import com.bsth.entity.oil.Nylog; | ||
| 39 | -import com.bsth.entity.oil.Ylb; | ||
| 40 | -import com.bsth.entity.oil.Ylxxb; | ||
| 41 | -import com.bsth.entity.search.CustomerSpecs; | ||
| 42 | -import com.bsth.entity.sys.SysUser; | ||
| 43 | -import com.bsth.repository.CarsRepository; | ||
| 44 | -import com.bsth.repository.LineRepository; | ||
| 45 | -import com.bsth.repository.oil.CylRepository; | ||
| 46 | -import com.bsth.repository.oil.DlbRepository; | ||
| 47 | -import com.bsth.repository.oil.NylogRepository; | ||
| 48 | -import com.bsth.repository.oil.YlbRepository; | ||
| 49 | -import com.bsth.repository.oil.YlxxbRepository; | ||
| 50 | -import com.bsth.security.util.SecurityUtils; | ||
| 51 | -import com.bsth.service.impl.BaseServiceImpl; | ||
| 52 | -import com.bsth.service.oil.DlbService; | ||
| 53 | -import com.bsth.service.oil.YlbService; | ||
| 54 | -import com.bsth.service.realcontrol.ScheduleRealInfoService; | ||
| 55 | -import com.bsth.util.Arith; | ||
| 56 | -import com.bsth.util.BatchSaveUtils; | ||
| 57 | -import com.bsth.util.ReportUtils; | ||
| 58 | -import com.github.abel533.echarts.code.Y; | ||
| 59 | - | ||
| 60 | -import javassist.bytecode.stackmap.BasicBlock.Catch; | ||
| 61 | - | ||
| 62 | -@Service | ||
| 63 | -public class YlbServiceImpl extends BaseServiceImpl<Ylb,Integer> implements YlbService{ | ||
| 64 | - @Autowired | ||
| 65 | - YlbRepository repository; | ||
| 66 | - @Autowired | ||
| 67 | - NylogRepository nylogRepository; | ||
| 68 | - @Autowired | ||
| 69 | - YlxxbRepository ylxxbRepository; | ||
| 70 | - | ||
| 71 | - @Autowired | ||
| 72 | - DlbService dlbService; | ||
| 73 | - | ||
| 74 | - @Autowired | ||
| 75 | - DlbRepository dlbRepository; | ||
| 76 | - | ||
| 77 | - @Autowired | ||
| 78 | - CylRepository cylRepository; | ||
| 79 | - | ||
| 80 | - @Autowired | ||
| 81 | - CarsRepository carsRepository; | ||
| 82 | - | ||
| 83 | - | ||
| 84 | - @Autowired | ||
| 85 | - LineRepository lineRepository; | ||
| 86 | - | ||
| 87 | - @Autowired | ||
| 88 | - ScheduleRealInfoService scheduleRealInfoService; | ||
| 89 | - | ||
| 90 | - @Autowired | ||
| 91 | - JdbcTemplate jdbcTemplate; | ||
| 92 | - | ||
| 93 | - Logger logger = LoggerFactory.getLogger(this.getClass()); | ||
| 94 | - | ||
| 95 | - | ||
| 96 | - | ||
| 97 | - /** | ||
| 98 | - * 获取进存油信息 | ||
| 99 | - * @Transactional 回滚事物 | ||
| 100 | - */ | ||
| 101 | - @Transactional | ||
| 102 | - @Override | ||
| 103 | - public String obtainDsq() throws Exception{ | ||
| 104 | - String result = "failure"; | ||
| 105 | - try { | ||
| 106 | - List<Ylb> addList = new ArrayList<Ylb>(); | ||
| 107 | - String type = ""; | ||
| 108 | - List<Cars> carsList=carsRepository.findCars(); | ||
| 109 | - Map<String, Boolean> carsMap=new HashMap<String, Boolean>(); | ||
| 110 | - for (int i = 0; i < carsList.size(); i++) { | ||
| 111 | - Cars c=carsList.get(i); | ||
| 112 | - carsMap.put(c.getInsideCode(), c.getSfdc()); | ||
| 113 | - } | ||
| 114 | - SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd"); | ||
| 115 | - Date dNow = new Date(); //当前时间 | ||
| 116 | - Date dBefore = new Date(); | ||
| 117 | - Calendar calendar = Calendar.getInstance(); //得到日历 | ||
| 118 | - calendar.setTime(dNow);//把当前时间赋给日历 | ||
| 119 | - calendar.add(Calendar.DAY_OF_MONTH, -1); //设置为前一天 | ||
| 120 | - dBefore = calendar.getTime(); //得到前一天的时间 | ||
| 121 | - String rq=sdf.format(dBefore); | ||
| 122 | - //保留两位小数 | ||
| 123 | - DecimalFormat df = new DecimalFormat("#.00"); | ||
| 124 | - // TODO Auto-generated method stub | ||
| 125 | - Map<String, Object> newMap=new HashMap<String,Object>(); | ||
| 126 | - //当天YLB信息 | ||
| 127 | -// List<Ylb> ylList=repository.obtainYl(rq,"","","","","nbbm"); | ||
| 128 | - List<Ylb> ylList=this.listOrderBy(rq,"","","","","nbbm"); | ||
| 129 | - //当天YLXXB信息 | ||
| 130 | - // List<Ylxxb> ylxxList=ylxxbRepository.obtainYlxx(rq); | ||
| 131 | - //前一天所有车辆最后进场班次信息 | ||
| 132 | - List<Ylb> ylListBe=this.listByRqJcsx(rq,"","","",""); | ||
| 133 | -// List<Ylb> ylListBe=repository.listMaxRqJcsx(rq, "", "", "", ""); | ||
| 134 | - List<Cyl> clyList=cylRepository.obtainCyl("",""); | ||
| 135 | - //从排班表中计算出行驶的总里程 | ||
| 136 | - List<Map<String,Object>> listpb=scheduleRealInfoService.yesterdayDataList("", rq, "", "", "", ""); | ||
| 137 | - | ||
| 138 | - for(int x=0;x<listpb.size();x++){ | ||
| 139 | - boolean sfdc=true; | ||
| 140 | - Map<String, Object> map=listpb.get(x); | ||
| 141 | - if (carsMap.get(map.get("clZbh").toString())!=null) { | ||
| 142 | - sfdc= carsMap.get(map.get("clZbh").toString()); | ||
| 143 | - }else{ | ||
| 144 | - sfdc=true; | ||
| 145 | - } | ||
| 146 | - if(!sfdc){ | ||
| 147 | - //判断驾驶员驾驶的该车辆是否已经存入了(查出的结果集中日期是相同的,根据驾驶员、内部编号、线路编码判断) | ||
| 148 | - Ylb t=new Ylb(); | ||
| 149 | - for(int k=0;k<ylList.size();k++){ | ||
| 150 | - Ylb t1=ylList.get(k); | ||
| 151 | - if(t1.getNbbm().equals(map.get("clZbh").toString()) | ||
| 152 | - &&t1.getJsy().equals(map.get("jGh").toString()) | ||
| 153 | - &&t1.getXlbm().equals(map.get("xlBm").toString()) | ||
| 154 | - &&t1.getLp().equals(map.get("lpName").toString())) | ||
| 155 | - { | ||
| 156 | - t=t1; | ||
| 157 | - type="update"; | ||
| 158 | - } | ||
| 159 | - } | ||
| 160 | - | ||
| 161 | - //当日的第一个班次,出场油量等于前一天的最后一个班次的进场油量 | ||
| 162 | - if(map.get("seqNumber").toString().equals("1")){ | ||
| 163 | - boolean fage=true; | ||
| 164 | - for (int i = 0; i < ylListBe.size(); i++) { | ||
| 165 | - Ylb ylb=ylListBe.get(i); | ||
| 166 | - if(map.get("clZbh").toString().equals(ylb.getNbbm())){ | ||
| 167 | - if(ylb.getJzyl()!=null){ | ||
| 168 | - if(ylb.getJzyl()>0){ | ||
| 169 | - t.setCzyl(ylb.getJzyl()); | ||
| 170 | - fage=false; | ||
| 171 | - break; | ||
| 172 | - } | ||
| 173 | - } | ||
| 174 | - | ||
| 175 | - } | ||
| 176 | - } | ||
| 177 | - if(fage){ | ||
| 178 | - for (int y = 0; y < clyList.size(); y++) { | ||
| 179 | - Cyl cyl=clyList.get(y); | ||
| 180 | - if(map.get("clZbh").toString().equals(cyl.getNbbm())){ | ||
| 181 | - if(cyl.getCyl()!=null){ | ||
| 182 | - t.setCzyl(cyl.getCyl()); | ||
| 183 | - fage=false; | ||
| 184 | - break; | ||
| 185 | - } | ||
| 186 | - } | ||
| 187 | - } | ||
| 188 | - } | ||
| 189 | - if(fage){ | ||
| 190 | - t.setCzyl(0.0); | ||
| 191 | - } | ||
| 192 | - } | ||
| 193 | - t.setNbbm(map.get("clZbh").toString()); | ||
| 194 | - t.setJsy(map.get("jGh")==null?"":map.get("jGh").toString()); | ||
| 195 | - t.setZlc(map.get("totalKilometers")==null?0.0:Double.parseDouble(map.get("totalKilometers").toString())); | ||
| 196 | - t.setXlbm(map.get("xlBm")==null?"":map.get("xlBm").toString()); | ||
| 197 | - t.setLinename(map.get("lineName")==null?"":map.get("lineName").toString()); | ||
| 198 | - t.setJcsx(Integer.parseInt(map.get("seqNumber").toString())); | ||
| 199 | - t.setSsgsdm(map.get("company")==null?"":map.get("company").toString()); | ||
| 200 | - t.setFgsdm(map.get("bCompany")==null?"":map.get("bCompany").toString()); | ||
| 201 | - t.setLp(map.get("lpName")==null?"":map.get("lpName").toString()); | ||
| 202 | - t.setJhsj(map.get("fcsj")==null?"":map.get("fcsj").toString()); | ||
| 203 | - t.setJname(map.get("jName").toString()); | ||
| 204 | - t.setRq(sdf.parse(rq)); | ||
| 205 | - t.setCreatetime(dNow); | ||
| 206 | - if(!(t.getSsgsdm().equals("") || t.getFgsdm().equals(""))){ | ||
| 207 | - if(type.equals("update")){ | ||
| 208 | - repository.save(t); | ||
| 209 | - }else{ | ||
| 210 | - addList.add(t); | ||
| 211 | - } | ||
| 212 | - } | ||
| 213 | - } | ||
| 214 | - | ||
| 215 | - } | ||
| 216 | - if(addList.size()>0){ | ||
| 217 | - try { | ||
| 218 | - new BatchSaveUtils<Ylb>().saveList2(addList, Ylb.class); | ||
| 219 | - } catch (Exception e) { | ||
| 220 | - // TODO: handle exception | ||
| 221 | - if(e.getMessage().indexOf("PK_YLB_UK")>0){ | ||
| 222 | - newMap.put("fage", "存在相同数据,数据已经过滤"); | ||
| 223 | - logger.info("定时器:存在相同数据,数据已经过滤"); | ||
| 224 | - } | ||
| 225 | - } | ||
| 226 | - } | ||
| 227 | - result = "success"; | ||
| 228 | - }catch (Exception e) { | ||
| 229 | - // TODO Auto-generated catch block | ||
| 230 | - throw e; | ||
| 231 | - }finally{ | ||
| 232 | - logger.info("setDDRB:"+result); | ||
| 233 | - } | ||
| 234 | - | ||
| 235 | - return result; | ||
| 236 | - } | ||
| 237 | - | ||
| 238 | - /** | ||
| 239 | - * 获取进存油信息 | ||
| 240 | - * @Transactional 回滚事物 | ||
| 241 | - */ | ||
| 242 | - @Transactional | ||
| 243 | - @Override | ||
| 244 | - public Map<String, Object> obtain(Map<String, Object> map2) throws Exception{ | ||
| 245 | - Map<String, Object> newMap = new HashMap<String, Object>(); | ||
| 246 | - try { | ||
| 247 | - Date date=new Date(); | ||
| 248 | - List<Cars> carsList = carsRepository.findCars(); | ||
| 249 | - Map<String, Boolean> carsMap = new HashMap<String, Boolean>(); | ||
| 250 | - for (int i = 0; i < carsList.size(); i++) { | ||
| 251 | - Cars c = carsList.get(i); | ||
| 252 | - carsMap.put(c.getInsideCode(), c.getSfdc()); | ||
| 253 | - } | ||
| 254 | - String rq = map2.get("rq").toString(); | ||
| 255 | - String line = ""; | ||
| 256 | - if (map2.get("xlbm_like") != null) { | ||
| 257 | - line = map2.get("xlbm_like").toString().trim(); | ||
| 258 | - } | ||
| 259 | - String gsbm=""; | ||
| 260 | - if(map2.get("ssgsdm_like")!=null){ | ||
| 261 | - gsbm=map2.get("ssgsdm_like").toString(); | ||
| 262 | - } | ||
| 263 | - String fgsbm=""; | ||
| 264 | - if(map2.get("fgsdm_like")!=null){ | ||
| 265 | - fgsbm=map2.get("fgsdm_like").toString(); | ||
| 266 | - } | ||
| 267 | - String nbbm=""; | ||
| 268 | - if(map2.get("nbbm_eq")!=null){ | ||
| 269 | - nbbm=map2.get("nbbm_eq").toString(); | ||
| 270 | - } | ||
| 271 | - SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); | ||
| 272 | - // 保留两位小数 | ||
| 273 | - DecimalFormat df = new DecimalFormat("#.00"); | ||
| 274 | - // TODO Auto-generated method stub | ||
| 275 | - // 当天YLB信息 | ||
| 276 | - List<Ylb> ylList = this.listOrderBy(rq,gsbm,fgsbm,"",nbbm,"nbbm"); | ||
| 277 | - | ||
| 278 | - // 当天YLXXB信息 | ||
| 279 | - List<Ylxxb> ylxxList = ylxxbRepository.obtainYlxx(rq, 0,gsbm); | ||
| 280 | - | ||
| 281 | - // 前一天所有车辆最后进场班次信息 | ||
| 282 | - List<Ylb> ylListBe = this.listByRqJcsx(rq, gsbm, fgsbm, "", nbbm); | ||
| 283 | - List<Cyl> clyList = cylRepository.obtainCyl(nbbm,gsbm); | ||
| 284 | - | ||
| 285 | - // 从排班表中计算出行驶的总里程 | ||
| 286 | - List<Map<String, Object>> listpb =new ArrayList<Map<String, Object>>(); | ||
| 287 | - List<Map<String, Object>> listpbs=scheduleRealInfoService.yesterdayDataList("", rq, gsbm, fgsbm, "", nbbm); | ||
| 288 | - | ||
| 289 | - String sxtj=map2.get("sxtj").toString(); | ||
| 290 | - if(sxtj.equals("0")){ | ||
| 291 | - listpb=listpbs; | ||
| 292 | - }else if (sxtj.equals("5")){ | ||
| 293 | - List<String> stringList=new ArrayList<String>(); | ||
| 294 | - | ||
| 295 | - List<Object[]> objectLists = repository.checkNbmmFgs(rq, gsbm); | ||
| 296 | - for (int i = 0; i < objectLists.size(); i++) { | ||
| 297 | - String clbm=objectLists.get(i)[0].toString(); | ||
| 298 | - stringList.add(clbm); | ||
| 299 | - } | ||
| 300 | - | ||
| 301 | - for (int i = 0; i < stringList.size(); i++) { | ||
| 302 | - String strNbbm=stringList.get(i); | ||
| 303 | - for (int j = 0; j < listpbs.size(); j++) { | ||
| 304 | - Map<String, Object> map = listpbs.get(j); | ||
| 305 | - String mapNbbm=map.get("clZbh").toString(); | ||
| 306 | - if(strNbbm.equals(mapNbbm)){ | ||
| 307 | - listpb.add(map); | ||
| 308 | - } | ||
| 309 | - } | ||
| 310 | - } | ||
| 311 | - | ||
| 312 | - }else{ | ||
| 313 | - List<Object[]> objectLists=repository.checkNbmmNum(rq, gsbm, fgsbm, "",nbbm); | ||
| 314 | - List<String> stringList=new ArrayList<String>(); | ||
| 315 | - for (int i = 0; i < objectLists.size(); i++) { | ||
| 316 | - String clbm=objectLists.get(i)[0].toString(); | ||
| 317 | - int cs=Integer.parseInt(objectLists.get(i)[1].toString()); | ||
| 318 | - //一车一单 | ||
| 319 | - if(sxtj.equals("1")){ | ||
| 320 | - if(cs==1){ | ||
| 321 | - stringList.add(clbm); | ||
| 322 | - } | ||
| 323 | - } | ||
| 324 | - //一车多单 | ||
| 325 | - if(sxtj.equals("2")){ | ||
| 326 | - if(cs>1){ | ||
| 327 | - stringList.add(clbm); | ||
| 328 | - } | ||
| 329 | - } | ||
| 330 | - } | ||
| 331 | - | ||
| 332 | - for (int i = 0; i < stringList.size(); i++) { | ||
| 333 | - String strNbbm=stringList.get(i); | ||
| 334 | - for (int j = 0; j < listpbs.size(); j++) { | ||
| 335 | - Map<String, Object> map = listpbs.get(j); | ||
| 336 | - String mapNbbm=map.get("clZbh").toString(); | ||
| 337 | - if(strNbbm.equals(mapNbbm)){ | ||
| 338 | - listpb.add(map); | ||
| 339 | - } | ||
| 340 | - } | ||
| 341 | - } | ||
| 342 | - } | ||
| 343 | - | ||
| 344 | - List<Ylb> addList = new ArrayList<Ylb>(); | ||
| 345 | - List<Ylb> updateList = new ArrayList<Ylb>(); | ||
| 346 | - Map<String, Object> ylMap=new HashMap<String, Object>(); | ||
| 347 | - | ||
| 348 | - Map<String, Object> cMap=new HashMap<String, Object>(); | ||
| 349 | - for (int x = 0; x < listpb.size(); x++) { | ||
| 350 | - String type = "add"; | ||
| 351 | - boolean sfdc = true; | ||
| 352 | - Map<String, Object> map = listpb.get(x); | ||
| 353 | - if (carsMap.get(map.get("clZbh").toString()) != null) { | ||
| 354 | - sfdc = carsMap.get(map.get("clZbh").toString()); | ||
| 355 | - } else { | ||
| 356 | - sfdc = true; | ||
| 357 | - } | ||
| 358 | - if (!sfdc) { | ||
| 359 | - // 判断驾驶员驾驶的该车辆是否已经存入了(查出的结果集中日期是相同的,根据驾驶员、内部编号、线路编码判断) | ||
| 360 | - Ylb t = new Ylb(); | ||
| 361 | - for (int k = 0; k < ylList.size(); k++) { | ||
| 362 | - Ylb t1 = ylList.get(k); | ||
| 363 | - if (t1.getNbbm().equals(map.get("clZbh").toString()) | ||
| 364 | - && t1.getJsy().equals(map.get("jGh").toString()) | ||
| 365 | - && t1.getXlbm().equals(map.get("xlBm").toString() | ||
| 366 | - )) { | ||
| 367 | - if(t1.getLp()==null){ | ||
| 368 | - //同人同车同线路不同路牌的过滤 (考虑到历史数据) | ||
| 369 | - if (cMap.get(map.get("clZbh").toString()+map.get("jGh").toString()+map.get("xlBm").toString())==null) { | ||
| 370 | - t = t1; | ||
| 371 | - type = "update"; | ||
| 372 | - cMap.put(map.get("clZbh").toString()+map.get("jGh").toString()+map.get("xlBm").toString(), | ||
| 373 | - map.get("clZbh").toString()); | ||
| 374 | - } | ||
| 375 | - }else{ | ||
| 376 | - if(t1.getLp().equals(map.get("lpName").toString())){ | ||
| 377 | - t = t1; | ||
| 378 | - type = "update"; | ||
| 379 | - } | ||
| 380 | - | ||
| 381 | - } | ||
| 382 | - } | ||
| 383 | - } | ||
| 384 | - // 当日的第一个班次,出场油量等于前一天的最后一个班次的进场油量 | ||
| 385 | - if (map.get("seqNumber").toString().equals("1")) { | ||
| 386 | - boolean fage = true; | ||
| 387 | - if(line.equals("")){ | ||
| 388 | - for (int i = 0; i < ylListBe.size(); i++) { | ||
| 389 | - Ylb ylb = ylListBe.get(i); | ||
| 390 | - if (map.get("clZbh").toString().equals(ylb.getNbbm())) { | ||
| 391 | - if(ylb.getJzyl()>0){ | ||
| 392 | - t.setCzyl(ylb.getJzyl()); | ||
| 393 | - fage = false; | ||
| 394 | - break; | ||
| 395 | - } | ||
| 396 | - | ||
| 397 | - } | ||
| 398 | - } | ||
| 399 | - if (fage) { | ||
| 400 | - for (int y = 0; y < clyList.size(); y++) { | ||
| 401 | - Cyl cyl = clyList.get(y); | ||
| 402 | - if (map.get("clZbh").toString().equals(cyl.getNbbm())) { | ||
| 403 | - if(cyl!=null){ | ||
| 404 | - if(cyl.getCyl()>=0){ | ||
| 405 | - t.setCzyl(cyl.getCyl()); | ||
| 406 | - fage = false; | ||
| 407 | - break; | ||
| 408 | - }else { | ||
| 409 | - if(cyl.getCxrl()!=null){ | ||
| 410 | - if(cyl.getCxrl()>0){ | ||
| 411 | - t.setCzyl(cyl.getCxrl()); | ||
| 412 | - fage = false; | ||
| 413 | - break; | ||
| 414 | - } | ||
| 415 | - } | ||
| 416 | - } | ||
| 417 | - } | ||
| 418 | - } | ||
| 419 | - } | ||
| 420 | - } | ||
| 421 | - if (fage) { | ||
| 422 | - t.setCzyl(0.0); | ||
| 423 | - } | ||
| 424 | - }else{ | ||
| 425 | - if (line.equals(map.get("xlBm").toString())) { | ||
| 426 | - for (int i = 0; i < ylListBe.size(); i++) { | ||
| 427 | - Ylb ylb = ylListBe.get(i); | ||
| 428 | - if (map.get("clZbh").toString().equals(ylb.getNbbm())) { | ||
| 429 | - if(ylb.getJzyl()>0){ | ||
| 430 | - t.setCzyl(ylb.getJzyl()); | ||
| 431 | - fage = false; | ||
| 432 | - break; | ||
| 433 | - } | ||
| 434 | - | ||
| 435 | - } | ||
| 436 | - } | ||
| 437 | - if (fage) { | ||
| 438 | - for (int y = 0; y < clyList.size(); y++) { | ||
| 439 | - Cyl cyl = clyList.get(y); | ||
| 440 | - if (map.get("clZbh").toString().equals(cyl.getNbbm())) { | ||
| 441 | - if(cyl!=null){ | ||
| 442 | - if(cyl.getCyl()>=0){ | ||
| 443 | - t.setCzyl(cyl.getCyl()); | ||
| 444 | - fage = false; | ||
| 445 | - break; | ||
| 446 | - }else { | ||
| 447 | - if(cyl.getCxrl()!=null){ | ||
| 448 | - if(cyl.getCxrl()>0){ | ||
| 449 | - t.setCzyl(cyl.getCxrl()); | ||
| 450 | - fage = false; | ||
| 451 | - break; | ||
| 452 | - } | ||
| 453 | - } | ||
| 454 | - } | ||
| 455 | - } | ||
| 456 | - } | ||
| 457 | - } | ||
| 458 | - } | ||
| 459 | - if (fage) { | ||
| 460 | - t.setCzyl(0.0); | ||
| 461 | - } | ||
| 462 | - } | ||
| 463 | - } | ||
| 464 | - | ||
| 465 | - } | ||
| 466 | - | ||
| 467 | - Double jzl = 0.0; | ||
| 468 | - //一人一车加注量只匹配一次 | ||
| 469 | - if(ylMap.get(map.get("clZbh").toString()+"_"+ map.get("jGh").toString())==null){ | ||
| 470 | - | ||
| 471 | - boolean fage2=false; | ||
| 472 | - for (int i = 0; i < ylxxList.size(); i++) { | ||
| 473 | - Ylxxb ylxxb = ylxxList.get(i); | ||
| 474 | - if (map.get("clZbh").toString().equals(ylxxb.getNbbm()) | ||
| 475 | - && map.get("jGh").toString().equals(ylxxb.getJsy()) | ||
| 476 | - && ylxxb.getJylx()==1) { | ||
| 477 | - if(ylxxb.getJzl()>0){ | ||
| 478 | - fage2=true; | ||
| 479 | - } | ||
| 480 | - | ||
| 481 | - } | ||
| 482 | - } | ||
| 483 | - //车辆的加注量如果有任工干预,略接口过来 数据 | ||
| 484 | - if(fage2){ | ||
| 485 | - // 把当天手工输入的的YLXXB的加注量设置为当天YLB的加注量(根据车号,驾驶员判断,加油类型为1) | ||
| 486 | - for (int j = 0; j < ylxxList.size(); j++) { | ||
| 487 | - Ylxxb ylxxb = ylxxList.get(j); | ||
| 488 | - if (map.get("clZbh").toString().equals(ylxxb.getNbbm()) | ||
| 489 | - && map.get("jGh").toString().equals(ylxxb.getJsy()) | ||
| 490 | - && ylxxb.getJylx()==1) { | ||
| 491 | - jzl =Arith.add(jzl, ylxxb.getJzl()); | ||
| 492 | - } | ||
| 493 | - } | ||
| 494 | - ylMap.put(map.get("clZbh").toString()+"_"+ map.get("jGh").toString(),map.get("xlBm") == null ? "" : map.get("xlBm").toString()); | ||
| 495 | - }else{ | ||
| 496 | - // 把当天的YLXXB的加注量设置为当天YLB的加注量(根据车号,驾驶员判断) | ||
| 497 | - for (int j = 0; j < ylxxList.size(); j++) { | ||
| 498 | - Ylxxb ylxxb = ylxxList.get(j); | ||
| 499 | - if (map.get("clZbh").toString().equals(ylxxb.getNbbm()) | ||
| 500 | - && map.get("jGh").toString().equals(ylxxb.getJsy())) { | ||
| 501 | - jzl =Arith.add(jzl, ylxxb.getJzl()); | ||
| 502 | - } | ||
| 503 | - } | ||
| 504 | - ylMap.put(map.get("clZbh").toString()+"_"+ map.get("jGh").toString(),map.get("xlBm") == null ? "" : map.get("xlBm").toString()); | ||
| 505 | - } | ||
| 506 | - | ||
| 507 | - } | ||
| 508 | - t.setJzl(jzl); | ||
| 509 | - t.setNbbm(map.get("clZbh").toString()); | ||
| 510 | - t.setJsy(map.get("jGh") == null ? "" : map.get("jGh").toString()); | ||
| 511 | - t.setZlc(map.get("totalKilometers") == null ? 0.0 | ||
| 512 | - : Double.parseDouble(map.get("totalKilometers").toString())); | ||
| 513 | - t.setXlbm(map.get("xlBm") == null ? "" : map.get("xlBm").toString()); | ||
| 514 | - t.setLinename(map.get("lineName")==null?"":map.get("lineName").toString()); | ||
| 515 | - t.setJcsx(Integer.parseInt(map.get("seqNumber").toString())); | ||
| 516 | - t.setSsgsdm(map.get("company") == null ? "" : map.get("company").toString()); | ||
| 517 | - t.setFgsdm(map.get("bCompany") == null ? "" : map.get("bCompany").toString()); | ||
| 518 | - t.setJhsj(map.get("fcsj")==null?"":map.get("fcsj").toString()); | ||
| 519 | - t.setRq(sdf.parse(rq)); | ||
| 520 | - t.setLp(map.get("lpName")==null?"":map.get("lpName").toString()); | ||
| 521 | - t.setJname(map.get("jName").toString()); | ||
| 522 | - if(!(t.getSsgsdm().equals("") || t.getFgsdm().equals(""))){ | ||
| 523 | - if(type.equals("add")){ | ||
| 524 | - t.setCreatetime(date); | ||
| 525 | - addList.add(t); | ||
| 526 | - }else{ | ||
| 527 | - t.setUpdatetime(date); | ||
| 528 | - updateList.add(t); | ||
| 529 | - } | ||
| 530 | - } | ||
| 531 | -// repository.save(t); | ||
| 532 | - newMap.put("status", ResponseCode.SUCCESS); | ||
| 533 | - | ||
| 534 | - } | ||
| 535 | - } | ||
| 536 | - if(addList.size()>0){ | ||
| 537 | - try { | ||
| 538 | - new BatchSaveUtils<Ylb>().saveList2(addList, Ylb.class); | ||
| 539 | - } catch (Exception e) { | ||
| 540 | - // TODO: handle exception | ||
| 541 | - if(e.getMessage().indexOf("PK_YLB_UK")>0){ | ||
| 542 | - newMap.put("fage", "存在相同数据,数据已经过滤"); | ||
| 543 | - logger.info("获取:存在相同数据,数据已经过滤"); | ||
| 544 | - } | ||
| 545 | - } | ||
| 546 | - | ||
| 547 | - } | ||
| 548 | - if(updateList.size()>0){ | ||
| 549 | - for (int i = 0; i < updateList.size(); i++) { | ||
| 550 | - repository.save(updateList.get(i)); | ||
| 551 | - } | ||
| 552 | - } | ||
| 553 | - SysUser user = SecurityUtils.getCurrentUser(); | ||
| 554 | - Nylog nylog=new Nylog(); | ||
| 555 | - nylog.setCreatedate(new Date()); | ||
| 556 | - nylog.setCzmc("获取加存油"); | ||
| 557 | - nylog.setNylx("油"); | ||
| 558 | - nylog.setUserid(user.getUserName()); | ||
| 559 | - nylog.setUsername(user.getName()); | ||
| 560 | - nylog.setCxtj(rq+"-"+gsbm+"-"+fgsbm+"-"+line+"-"+nbbm+"-"+sxtj); | ||
| 561 | - nylogRepository.save(nylog); | ||
| 562 | - newMap.put("status", ResponseCode.SUCCESS); | ||
| 563 | - } catch (Exception e) { | ||
| 564 | - // TODO Auto-generated catch block | ||
| 565 | - newMap.put("status", ResponseCode.ERROR); | ||
| 566 | - throw e; | ||
| 567 | - } | ||
| 568 | - | ||
| 569 | - return newMap; | ||
| 570 | - } | ||
| 571 | - | ||
| 572 | - | ||
| 573 | - /** | ||
| 574 | - * 进场等于出场 | ||
| 575 | - */ | ||
| 576 | - @Transactional | ||
| 577 | - @Override | ||
| 578 | - public Map<String, Object> outAndIn(Map<String, Object> map) throws Exception{ | ||
| 579 | - // TODO Auto-generated method stub | ||
| 580 | - String xlbm=""; | ||
| 581 | - if(map.get("xlbm_like")!=null){ | ||
| 582 | - xlbm= map.get("xlbm_like").toString().trim(); | ||
| 583 | - } | ||
| 584 | - String gsbm=""; | ||
| 585 | - if(map.get("ssgsdm_like")!=null){ | ||
| 586 | - gsbm=map.get("ssgsdm_like").toString(); | ||
| 587 | - } | ||
| 588 | - String fgsbm=""; | ||
| 589 | - if(map.get("fgsdm_like")!=null){ | ||
| 590 | - fgsbm=map.get("fgsdm_like").toString(); | ||
| 591 | - } | ||
| 592 | - String rq = map.get("rq").toString(); | ||
| 593 | - String nbbm=""; | ||
| 594 | - if(map.get("nbbm_eq")!=null){ | ||
| 595 | - nbbm=map.get("nbbm_eq").toString(); | ||
| 596 | - } | ||
| 597 | - | ||
| 598 | - Map<String, Object> newMap=new HashMap<String,Object>(); | ||
| 599 | - Map<String, Object> map2=new HashMap<String,Object>(); | ||
| 600 | - try { | ||
| 601 | - SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); | ||
| 602 | - | ||
| 603 | - map.put("rq_eq", sdf.parse(rq)); | ||
| 604 | -// List<Cyl> clyList = cylRepository.obtainCyl(); | ||
| 605 | - // 获取车辆存油信息 | ||
| 606 | - List<Cyl> cylList = cylRepository.obtainCyl(nbbm,gsbm); | ||
| 607 | - // 指定日期YLB信息 | ||
| 608 | - List<Ylb> ylbList =new ArrayList<Ylb>(); | ||
| 609 | - List<Ylb> ylbLists =new ArrayList<Ylb>(); | ||
| 610 | - List<Ylb> iterator2=new ArrayList<Ylb>(); | ||
| 611 | - ylbLists=this.listOrderBy(rq,gsbm,fgsbm,xlbm,nbbm,"jcsx"); | ||
| 612 | - iterator2=this.listOrderBy(rq,gsbm,fgsbm,xlbm,nbbm,"nbbm,jcsx"); | ||
| 613 | - // 从排班表中计算出行驶的总里程 | ||
| 614 | - | ||
| 615 | - String sxtj=map.get("sxtj").toString(); | ||
| 616 | - if(sxtj.equals("0")){ | ||
| 617 | - ylbList=ylbLists; | ||
| 618 | - }else{ | ||
| 619 | - List<Object[]> objectLists=repository.checkNbmmNum(rq, gsbm, fgsbm, xlbm,nbbm); | ||
| 620 | - List<String> stringList=new ArrayList<String>(); | ||
| 621 | - for (int i = 0; i < objectLists.size(); i++) { | ||
| 622 | - String clbm=objectLists.get(i)[0].toString(); | ||
| 623 | - int cs=Integer.parseInt(objectLists.get(i)[1].toString()); | ||
| 624 | - //一车一单 | ||
| 625 | - if(sxtj.equals("1")){ | ||
| 626 | - if(cs==1){ | ||
| 627 | - stringList.add(clbm); | ||
| 628 | - } | ||
| 629 | - } | ||
| 630 | - //一车多单 | ||
| 631 | - if(sxtj.equals("2")){ | ||
| 632 | - if(cs>1){ | ||
| 633 | - stringList.add(clbm); | ||
| 634 | - } | ||
| 635 | - } | ||
| 636 | - } | ||
| 637 | - | ||
| 638 | - for (int i = 0; i < stringList.size(); i++) { | ||
| 639 | - String strNbbm=stringList.get(i); | ||
| 640 | - for (int j = 0; j < ylbLists.size(); j++) { | ||
| 641 | - Ylb y = ylbLists.get(j); | ||
| 642 | - String mapNbbm=y.getNbbm(); | ||
| 643 | - if(strNbbm.equals(mapNbbm)){ | ||
| 644 | - ylbList.add(y); | ||
| 645 | - } | ||
| 646 | - } | ||
| 647 | - } | ||
| 648 | - } | ||
| 649 | - | ||
| 650 | - for (int i=0;i<ylbList.size();i++) { | ||
| 651 | - Ylb ylb = ylbList.get(i); | ||
| 652 | - // 判断是否已经计算过 | ||
| 653 | - if (newMap.get("nbbm" + ylb.getNbbm()) == null) { | ||
| 654 | - String nbbm_eq = ylb.getNbbm(); | ||
| 655 | - Date rq_eq = ylb.getRq(); | ||
| 656 | - // 得到一天总的加油和里程(根据车,时间) | ||
| 657 | - List<Object[]> sumList = repository.sumLcYl(nbbm_eq, rq_eq,"",gsbm,fgsbm); | ||
| 658 | - // 保存总的加油量 | ||
| 659 | - Double jzl = 0.0; | ||
| 660 | - // 保存总的里程 | ||
| 661 | - Double zlc = 0.0; | ||
| 662 | - //保存总的损耗 | ||
| 663 | - Double zsh = 0.0; | ||
| 664 | - for (int j = 0; j < sumList.size(); j++) { | ||
| 665 | - jzl = Arith.add(jzl, Double.valueOf(sumList.get(j)[0].toString())); | ||
| 666 | - zlc = Arith.add(zlc, Double.valueOf(sumList.get(j)[1].toString())); | ||
| 667 | - zsh = Arith.add(zsh, Double.valueOf(sumList.get(j)[2].toString())); | ||
| 668 | - } | ||
| 669 | -// jzl = Arith.sub(jzl, zsh); | ||
| 670 | - // 保留两位小数 | ||
| 671 | - DecimalFormat df = new DecimalFormat("#.00"); | ||
| 672 | - Double zyl = 0.0; | ||
| 673 | - Double nextJzyl = 0.0; | ||
| 674 | - // 保存已经计算过的车辆,相同车辆编号的车不在计算 | ||
| 675 | - newMap.put("nbbm" + ylb.getNbbm(), ylb.getNbbm()); | ||
| 676 | - | ||
| 677 | - // 查询指定车辆,设置进、存、耗油量 | ||
| 678 | - map.remove("nbbm_eq"); | ||
| 679 | - map.put("nbbm_eq", ylb.getNbbm()); | ||
| 680 | - map.put("xlbm_like", ylb.getXlbm()); | ||
| 681 | -// Iterator<Ylb> iterator2 = repository | ||
| 682 | -// .findAll(new CustomerSpecs<Ylb>(map), new Sort(Direction.ASC, "jcsx")).iterator(); | ||
| 683 | - double czyl=0.0; | ||
| 684 | - for (int j = 0; j < iterator2.size(); j++) { | ||
| 685 | - Ylb t = iterator2.get(j); | ||
| 686 | - if(t.getNbbm().equals(ylb.getNbbm())){ | ||
| 687 | - if (t.getJcsx() == 1) { | ||
| 688 | - // 进场等于出场的操作 既 最后进场存油量等于第一次的出场存油量 | ||
| 689 | -// Double yl = t.getCzyl(); | ||
| 690 | -// Double jcyl = t.getCzyl(); | ||
| 691 | - czyl = t.getCzyl(); | ||
| 692 | - zyl =jzl; | ||
| 693 | - Double yh=0.0; | ||
| 694 | - if(zlc>0 ){ | ||
| 695 | - yh = Double.parseDouble(df.format(zyl * (t.getZlc() / zlc))); | ||
| 696 | - } | ||
| 697 | - nextJzyl =Arith.sub( Arith.add(t.getJzl(), t.getCzyl()),yh); | ||
| 698 | -// nextJzyl =Arith.sub( Arith.add(Arith.sub(t.getJzl(),t.getSh()), t.getCzyl()),yh); | ||
| 699 | - //把进场油量的小数和整数分别取出 | ||
| 700 | -// int ylxs=(int) nextJzyl; 10.6--11 10.3--10 | ||
| 701 | - if(zlc>0 && t.getZlc()>0){ | ||
| 702 | - long l=Math.round(nextJzyl); | ||
| 703 | - double ylxs=l*100/100; | ||
| 704 | -// nextJzyl = Arith.add(nextJzyl,Arith.sub(nextJzyl,ylxs)); | ||
| 705 | - yh=Arith.add(yh, Arith.sub(nextJzyl,ylxs)); | ||
| 706 | - t.setYh(yh); | ||
| 707 | - t.setJzyl(ylxs); | ||
| 708 | - nextJzyl=ylxs; | ||
| 709 | - }else{ | ||
| 710 | - t.setYh(yh); | ||
| 711 | - t.setJzyl(nextJzyl); | ||
| 712 | - } | ||
| 713 | - } else { | ||
| 714 | - t.setCzyl(nextJzyl); | ||
| 715 | - Double yh=0.0; | ||
| 716 | - if(zlc>0){ | ||
| 717 | - yh= Double.parseDouble(df.format(zyl * (t.getZlc() / zlc))); | ||
| 718 | - } | ||
| 719 | - nextJzyl =Arith.sub( Arith.add(t.getJzl(),nextJzyl),yh); | ||
| 720 | -// nextJzyl =Arith.sub( Arith.add(Arith.sub(t.getJzl(),t.getSh()),nextJzyl),yh); | ||
| 721 | - if(zlc>0 && t.getZlc()>0){ | ||
| 722 | - long l=0l; | ||
| 723 | - double ylxs=0.0; | ||
| 724 | - if(j==iterator2.size()-1){ | ||
| 725 | - ylxs=czyl; | ||
| 726 | - }else{ | ||
| 727 | - if(iterator2.get(j+1).getNbbm().equals(t.getNbbm())){ | ||
| 728 | - l=Math.round(nextJzyl); | ||
| 729 | - ylxs=l*100/100; | ||
| 730 | - }else{ | ||
| 731 | - ylxs=czyl; | ||
| 732 | - } | ||
| 733 | - | ||
| 734 | - } | ||
| 735 | - yh=Arith.add(yh, Arith.sub(nextJzyl,ylxs)); | ||
| 736 | -// nextJzyl = Arith.add(nextJzyl,Arith.sub(nextJzyl,ylxs)); | ||
| 737 | - | ||
| 738 | - t.setYh(yh); | ||
| 739 | - t.setJzyl(ylxs); | ||
| 740 | - nextJzyl=ylxs; | ||
| 741 | - }else{ | ||
| 742 | - t.setYh(yh); | ||
| 743 | - t.setJzyl(nextJzyl); | ||
| 744 | - } | ||
| 745 | - } | ||
| 746 | - if(t.getJzyl()<0){ | ||
| 747 | - t.setJzyl(0.0); | ||
| 748 | - } | ||
| 749 | - if(t.getCzyl()<0){ | ||
| 750 | - t.setCzyl(0.0); | ||
| 751 | - } | ||
| 752 | - if(t.getYh()<0){ | ||
| 753 | - t.setYh(0.0); | ||
| 754 | - } | ||
| 755 | - if(t.getSh()<0){ | ||
| 756 | - t.setSh(0.0); | ||
| 757 | - } | ||
| 758 | - repository.save(t); | ||
| 759 | - } | ||
| 760 | - map2.put("status", ResponseCode.SUCCESS); | ||
| 761 | - } | ||
| 762 | - } | ||
| 763 | - } | ||
| 764 | - | ||
| 765 | - SysUser user = SecurityUtils.getCurrentUser(); | ||
| 766 | - Nylog nylog=new Nylog(); | ||
| 767 | - nylog.setCreatedate(new Date()); | ||
| 768 | - nylog.setCzmc("进场等于出场"); | ||
| 769 | - nylog.setNylx("油"); | ||
| 770 | - nylog.setUserid(user.getUserName()); | ||
| 771 | - nylog.setUsername(user.getName()); | ||
| 772 | - nylog.setCxtj(rq+"-"+gsbm+"-"+fgsbm+"-"+xlbm+"-"+nbbm+"-"+sxtj); | ||
| 773 | - | ||
| 774 | - nylogRepository.save(nylog); | ||
| 775 | - } catch (Exception e) { | ||
| 776 | - map2.put("status", ResponseCode.ERROR); | ||
| 777 | - logger.error("save erro.", e); | ||
| 778 | - throw e; | ||
| 779 | - } | ||
| 780 | - return map2; | ||
| 781 | - } | ||
| 782 | - | ||
| 783 | - | ||
| 784 | - /** | ||
| 785 | - * 核对,有加注没里程 | ||
| 786 | - * @param map | ||
| 787 | - * @return | ||
| 788 | - */ | ||
| 789 | - @Transactional | ||
| 790 | - @Override | ||
| 791 | - public Map<String, Object> checkYl(Map<String, Object> map) throws Exception{ | ||
| 792 | - Map<String, Object> newMap=new HashMap<String,Object>(); | ||
| 793 | -// String xlbm=""; | ||
| 794 | -// if(map.get("xlbm_like")!=null){ | ||
| 795 | -// xlbm=map.get("xlbm_like").toString(); | ||
| 796 | -// } | ||
| 797 | - // TODO Auto-generated method stub | ||
| 798 | - | ||
| 799 | - List<Cars> carsList = carsRepository.findCars(); | ||
| 800 | - Map<String, String> carsMap = new HashMap<String, String>(); | ||
| 801 | - for (int i = 0; i < carsList.size(); i++) { | ||
| 802 | - Cars c = carsList.get(i); | ||
| 803 | - carsMap.put(c.getInsideCode(), c.getBrancheCompanyCode()==null?"":c.getBrancheCompanyCode()); | ||
| 804 | - } | ||
| 805 | - | ||
| 806 | - try{ | ||
| 807 | - //获取车辆存油信息 | ||
| 808 | - | ||
| 809 | - String rq=map.get("rq").toString(); | ||
| 810 | - String xlbm=""; | ||
| 811 | - if(map.get("xlbm_like")!=null){ | ||
| 812 | - xlbm= map.get("xlbm_like").toString().trim(); | ||
| 813 | - } | ||
| 814 | - String gsbm=""; | ||
| 815 | - if(map.get("ssgsdm_like")!=null){ | ||
| 816 | - gsbm=map.get("ssgsdm_like").toString(); | ||
| 817 | - } | ||
| 818 | - String fgsbm=""; | ||
| 819 | - if(map.get("fgsdm_like")!=null){ | ||
| 820 | - fgsbm=map.get("fgsdm_like").toString(); | ||
| 821 | - } | ||
| 822 | - String nbbm=""; | ||
| 823 | - if(map.get("nbbm_eq")!=null){ | ||
| 824 | - nbbm=map.get("nbbm_eq").toString(); | ||
| 825 | - } | ||
| 826 | -// List<Ylb> ylListBe=repository.obtainYlbefore(rq, gsbm, "", xlbm, nbbm); | ||
| 827 | - List<Ylb> ylListBe=this.listByRqJcsx(rq, gsbm, fgsbm, "", nbbm); | ||
| 828 | - List<Ylb> ylbList=this.listOrderBy(rq,gsbm,fgsbm,xlbm,nbbm,"nbbm"); | ||
| 829 | -// repository.obtainYl(rq,gsbm,fgsbm,xlbm,nbbm,"nbbm"); | ||
| 830 | -// List<Ylxxb> ylxxbList=ylxxbRepository.obtainYlxx(rq,0,gsbm); | ||
| 831 | - String sql="select * from bsth_c_ylxxb where yyrq='"+rq+"' " | ||
| 832 | - + " and gsdm ='"+gsbm+"' and nylx ='0' and nbbm " | ||
| 833 | - + " not in ( select nbbm from bsth_c_ylb " | ||
| 834 | - + " where rq='"+rq+"' " | ||
| 835 | - + " and ssgsdm='"+gsbm+"' and fgsdm ='"+fgsbm+"')" | ||
| 836 | - + " and nbbm in (select inside_code from " | ||
| 837 | - + " bsth_c_cars where business_code ='"+gsbm+"' " | ||
| 838 | - + " and branche_company_code='"+fgsbm+"')"; | ||
| 839 | - | ||
| 840 | - List<Ylxxb> ylxxbList=jdbcTemplate.query(sql, | ||
| 841 | - new RowMapper<Ylxxb>(){ | ||
| 842 | - @Override | ||
| 843 | - public Ylxxb mapRow(ResultSet rs, int rowNum) throws SQLException { | ||
| 844 | - Ylxxb s = new Ylxxb(); | ||
| 845 | - s.setId(rs.getInt("id")); | ||
| 846 | - s.setYyrq(rs.getDate("yyrq")); | ||
| 847 | - s.setNbbm(rs.getString("nbbm")); | ||
| 848 | - s.setGsdm(rs.getString("gsdm")); | ||
| 849 | - s.setFgsdm(rs.getString("fgsdm")); | ||
| 850 | - s.setJsy(rs.getString("jsy")); | ||
| 851 | - s.setJzl(rs.getDouble("jzl")); | ||
| 852 | - s.setStationid(rs.getString("stationid")); | ||
| 853 | - s.setNylx(rs.getInt("nylx")); | ||
| 854 | - s.setJyggh(rs.getString("jyggh")); | ||
| 855 | - s.setYj(rs.getDouble("yj")); | ||
| 856 | -// s.setLdgh(rs.getString("ldgh")); | ||
| 857 | - s.setBz(rs.getString("bz")); | ||
| 858 | - return s; | ||
| 859 | - } | ||
| 860 | - }); | ||
| 861 | - Map<String, Object> m=new HashMap<String,Object>(); | ||
| 862 | - for (int i = 0; i < ylxxbList.size(); i++) { | ||
| 863 | - Boolean fage=false; | ||
| 864 | - Ylxxb y1=ylxxbList.get(i); | ||
| 865 | - if(m.get(y1.getNbbm())==null){ | ||
| 866 | - Line line=BasicData.nbbm2LineMap.get(y1.getNbbm()); | ||
| 867 | - if(null !=line){ | ||
| 868 | - if(!xlbm.equals("")){ | ||
| 869 | - if(line.getLineCode().equals(xlbm)){ | ||
| 870 | - fage=true; | ||
| 871 | - } | ||
| 872 | - }else{ | ||
| 873 | - fage=true; | ||
| 874 | - } | ||
| 875 | - } | ||
| 876 | - | ||
| 877 | - if(fage){ | ||
| 878 | - Ylb t=new Ylb(); | ||
| 879 | - t.setNbbm(y1.getNbbm()); | ||
| 880 | - t.setRq(y1.getYyrq()); | ||
| 881 | - t.setJsy(y1.getJsy()); | ||
| 882 | - t.setJname(BasicData.allPerson.get(y1.getGsdm()+"-"+y1.getJsy())); | ||
| 883 | - t.setJzl(y1.getJzl()); | ||
| 884 | - t.setSsgsdm(y1.getGsdm()); | ||
| 885 | - String fgsdm=""; | ||
| 886 | - if(null !=carsMap.get(y1.getNbbm())){ | ||
| 887 | - fgsdm=carsMap.get(y1.getNbbm()); | ||
| 888 | - } | ||
| 889 | - t.setFgsdm(fgsdm); | ||
| 890 | - t.setJcsx(1); | ||
| 891 | - if(null !=line){ | ||
| 892 | - t.setXlbm(line.getLineCode()); | ||
| 893 | - }else{ | ||
| 894 | - t.setXlbm(""); | ||
| 895 | - } | ||
| 896 | - t.setJcsx(1); | ||
| 897 | - boolean status=true; | ||
| 898 | - for (int j = 0; j < ylListBe.size(); j++) { | ||
| 899 | - Ylb b=ylListBe.get(j); | ||
| 900 | - if(b.getNbbm().equals(y1.getNbbm())){ | ||
| 901 | - t.setCzyl(b.getJzyl()); | ||
| 902 | - status=false; | ||
| 903 | - break; | ||
| 904 | - } | ||
| 905 | - } | ||
| 906 | - if(status){ | ||
| 907 | - t.setCzyl(0.0); | ||
| 908 | - } | ||
| 909 | - t.setJzyl(Arith.add(t.getJzl(), t.getCzyl())); | ||
| 910 | - t.setYh(0.0); | ||
| 911 | - if(!(t.getSsgsdm().equals("") || t.getFgsdm().equals(""))){ | ||
| 912 | - t.setCreatetime(new Date()); | ||
| 913 | - try { | ||
| 914 | - repository.save(t); | ||
| 915 | - m.put(t.getName(), t.getName()); | ||
| 916 | - } catch (Exception e) { | ||
| 917 | - // TODO: handle exception | ||
| 918 | - if(e.getMessage().indexOf("PK_YLB_UK")>0){ | ||
| 919 | - newMap.put("fage", "存在相同数据,数据已经过滤"); | ||
| 920 | - logger.info("核对有存油没里程:存在相同数据,数据已经过滤"); | ||
| 921 | - } | ||
| 922 | - } | ||
| 923 | - } | ||
| 924 | - } | ||
| 925 | - } | ||
| 926 | - } | ||
| 927 | - | ||
| 928 | - SysUser user = SecurityUtils.getCurrentUser(); | ||
| 929 | - Nylog nylog=new Nylog(); | ||
| 930 | - nylog.setCreatedate(new Date()); | ||
| 931 | - nylog.setCzmc("核对加注量"); | ||
| 932 | - nylog.setNylx("油"); | ||
| 933 | - nylog.setUserid(user.getUserName()); | ||
| 934 | - nylog.setUsername(user.getName()); | ||
| 935 | - nylog.setCxtj(rq+"-"+gsbm+"-"+fgsbm+"-"+xlbm+"-"+nbbm+"-"); | ||
| 936 | - nylogRepository.save(nylog); | ||
| 937 | - newMap.put("status", ResponseCode.SUCCESS); | ||
| 938 | - }catch(Exception e){ | ||
| 939 | - newMap.put("status", ResponseCode.ERROR); | ||
| 940 | - logger.error("save erro.", e); | ||
| 941 | - throw e; | ||
| 942 | - } | ||
| 943 | - | ||
| 944 | - return newMap; | ||
| 945 | - } | ||
| 946 | - | ||
| 947 | - | ||
| 948 | - @Override | ||
| 949 | - public List<Map<String, Object>> oilListMonth(Map<String, Object> map) { | ||
| 950 | - SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"), | ||
| 951 | - sdfSimple = new SimpleDateFormat("yyyyMMdd"); | ||
| 952 | - | ||
| 953 | - String type=map.get("type").toString(); | ||
| 954 | - String date=map.get("date").toString().trim(); | ||
| 955 | - String gsdm=map.get("gsdm").toString(); | ||
| 956 | - String fgsdm=map.get("fgsdm").toString(); | ||
| 957 | - String date2=date.substring(0, 8)+"01"; | ||
| 958 | - String lineStr=""; | ||
| 959 | - String line =map.get("line").toString().trim(); | ||
| 960 | - /*if(line !=null && !line.equals("")){ | ||
| 961 | - lineStr =" and xlbm= '"+ line +"'"; | ||
| 962 | - }else{ | ||
| 963 | - lineStr =" and ssgsdm='"+gsdm+"' and fgsdm ='"+fgsdm+"' "; | ||
| 964 | - } | ||
| 965 | - String sql="select a.nbbm,a.rq,a.jzyl from (" + | ||
| 966 | - " select x.nbbm,max(x.rq) as rq,max(x.jcsx) as jcsx from " | ||
| 967 | - + "(select nbbm,rq,max(jcsx) as jcsx from bsth_c_ylb where rq between '" | ||
| 968 | - + date2 +"' and '" + date+"' "+lineStr | ||
| 969 | - + " group by nbbm,rq) x group by x.nbbm ) b" | ||
| 970 | - + " left join (select nbbm,rq,jzyl,jcsx FROM bsth_c_ylb " | ||
| 971 | - + " where rq between '" | ||
| 972 | - + date2 +"' and '" + date+"' "+lineStr | ||
| 973 | - + ") a " | ||
| 974 | - + " on a.nbbm =b.nbbm and a.jcsx=b.jcsx and a.rq=b.rq " | ||
| 975 | - + " where a.nbbm is not null order by a.nbbm"; | ||
| 976 | - | ||
| 977 | - // TODO Auto-generated method stub | ||
| 978 | - List<Ylb> list =jdbcTemplate.query(sql, | ||
| 979 | - new RowMapper<Ylb>(){ | ||
| 980 | - @Override | ||
| 981 | - public Ylb mapRow(ResultSet rs, int rowNum) throws SQLException { | ||
| 982 | - Ylb s = new Ylb(); | ||
| 983 | - s.setNbbm(rs.getString("nbbm")); | ||
| 984 | - s.setRq(rs.getDate("rq")); | ||
| 985 | - s.setJzyl(rs.getDouble("jzyl")); | ||
| 986 | - return s; | ||
| 987 | - } | ||
| 988 | - }); */ | ||
| 989 | - | ||
| 990 | - double qtyy=0.0;//其他用油 | ||
| 991 | - double cdyy=0.0;//车队用油 | ||
| 992 | - double byyy=0.0;//保养用油 | ||
| 993 | - double cjxx=0.0;//车间小修 | ||
| 994 | - double cjgb=0.0;//车间高保 | ||
| 995 | - double fyyyhj=0.0;//非营运用油合计 | ||
| 996 | - List<Ylb> listYlb=repository.listByMonthJcsx(date2, date, gsdm, fgsdm, line); | ||
| 997 | - | ||
| 998 | - Map<String, Object> ms=new HashMap<String,Object>(); | ||
| 999 | - List<Ylb> list=new ArrayList<Ylb>(); | ||
| 1000 | - for (int i = 0; i < listYlb.size(); i++) { | ||
| 1001 | - Ylb t=listYlb.get(i); | ||
| 1002 | - fyyyhj =Arith.add(fyyyhj, t.getSh()); | ||
| 1003 | - if(t.getShyy()==null){ | ||
| 1004 | - qtyy=Arith.add(qtyy, t.getSh()); | ||
| 1005 | - }else{ | ||
| 1006 | - if(t.getShyy().equals("6")){ | ||
| 1007 | - cdyy=Arith.add(cdyy, t.getSh()); | ||
| 1008 | - }else if(t.getShyy().equals("2")){ | ||
| 1009 | - byyy=Arith.add(byyy, t.getSh()); | ||
| 1010 | - }else if(t.getShyy().equals("7")){ | ||
| 1011 | - cjxx=Arith.add(cjxx, t.getSh()); | ||
| 1012 | - }else if(t.getShyy().equals("8")){ | ||
| 1013 | - cjgb=Arith.add(cjgb, t.getSh()); | ||
| 1014 | - }else{ | ||
| 1015 | - qtyy=Arith.add(qtyy, t.getSh()); | ||
| 1016 | - } | ||
| 1017 | - } | ||
| 1018 | - if(ms.get(t.getNbbm())==null){ | ||
| 1019 | - ms.put(t.getNbbm(), t.getNbbm()); | ||
| 1020 | - list.add(t); | ||
| 1021 | - } | ||
| 1022 | - } | ||
| 1023 | - | ||
| 1024 | - List<Map<String, Object>> mapList = new ArrayList<Map<String, Object>>(); | ||
| 1025 | - int size = 0; | ||
| 1026 | - Map<String, Object> m_ = new HashMap<String, Object>(); | ||
| 1027 | - double ycyhj=0.0; | ||
| 1028 | - for(Ylb ylb : list){ | ||
| 1029 | - ycyhj=Arith.add(ycyhj, ylb.getJzyl()); | ||
| 1030 | - int x=size%3; | ||
| 1031 | - if(x==0 && size>0){ | ||
| 1032 | - mapList.add(m_); | ||
| 1033 | - m_ = new HashMap<String, Object>(); | ||
| 1034 | - } | ||
| 1035 | - size++; | ||
| 1036 | - m_.put("xh"+x, size); | ||
| 1037 | - m_.put("nbbm"+x, ylb.getNbbm()!=null?ylb.getNbbm():""); | ||
| 1038 | - m_.put("rq"+x, ylb.getRq()!=null?sdfMonth.format(ylb.getRq()):""); | ||
| 1039 | - m_.put("jzyl"+x, ylb.getJzyl()!=null?ylb.getJzyl():""); | ||
| 1040 | - | ||
| 1041 | - } | ||
| 1042 | - if(m_.get("nbbm0")!=null){ | ||
| 1043 | - if(m_.get("nbbm1")==null){ | ||
| 1044 | - m_.put("xh1", ""); | ||
| 1045 | - m_.put("nbbm1" , ""); | ||
| 1046 | - m_.put("rq1" , ""); | ||
| 1047 | - m_.put("jzyl1" , ""); | ||
| 1048 | - } | ||
| 1049 | - if(m_.get("nbbm2")==null){ | ||
| 1050 | - m_.put("xh2", ""); | ||
| 1051 | - m_.put("nbbm2" , ""); | ||
| 1052 | - m_.put("rq2" , ""); | ||
| 1053 | - m_.put("jzyl2" , ""); | ||
| 1054 | - } | ||
| 1055 | - mapList.add(m_); | ||
| 1056 | - } | ||
| 1057 | - | ||
| 1058 | - if(type != null && type.equals("export")){ | ||
| 1059 | - List<Iterator<?>> listI = new ArrayList<Iterator<?>>(); | ||
| 1060 | - Map<String, Object> m = new HashMap<String, Object>(); | ||
| 1061 | - m.put("ycyhj", ycyhj); | ||
| 1062 | - m.put("qtyy", qtyy); | ||
| 1063 | - m.put("cdyy", cdyy); | ||
| 1064 | - m.put("byyy", byyy); | ||
| 1065 | - m.put("cjxx", cjxx); | ||
| 1066 | - m.put("cjgb", cjgb); | ||
| 1067 | - m.put("fyyyhj", fyyyhj); | ||
| 1068 | - ReportUtils ee = new ReportUtils(); | ||
| 1069 | - try { | ||
| 1070 | - String lineName = ""; | ||
| 1071 | - if(map.containsKey("lineName")) | ||
| 1072 | - lineName = map.get("lineName").toString(); | ||
| 1073 | - listI.add(mapList.iterator()); | ||
| 1074 | - String path = this.getClass().getResource("/").getPath()+"static/pages/forms/"; | ||
| 1075 | - ee.excelReplace(listI, new Object[] { m }, path+"mould/oilListMonth.xls", | ||
| 1076 | - path+"export/" + sdfSimple.format(sdfMonth.parse(date)) | ||
| 1077 | - + "-" + lineName + "-月存油报表.xls"); | ||
| 1078 | - } catch (Exception e) { | ||
| 1079 | - // TODO: handle exception | ||
| 1080 | - e.printStackTrace(); | ||
| 1081 | - } | ||
| 1082 | - }else{ | ||
| 1083 | - m_=new HashMap<String,Object>(); | ||
| 1084 | - m_.put("xh0", "99"); | ||
| 1085 | - m_.put("nbbm0", "存油合计:"+ycyhj +" 非营运用油: 其他用油:"+qtyy +",车队:"+cdyy+",保养用油:"+byyy | ||
| 1086 | - +",车间(小修):"+cjxx+",车间(高保):"+cjgb+",非营运用油合计:"+fyyyhj); | ||
| 1087 | - mapList.add(m_); | ||
| 1088 | - } | ||
| 1089 | - | ||
| 1090 | - return mapList; | ||
| 1091 | - } | ||
| 1092 | - | ||
| 1093 | - @Override | ||
| 1094 | - public StringBuffer checkNbmmNum(String rq, String gsbm, String fgsbm, String xlbm,String nbbm,int lx) { | ||
| 1095 | - StringBuffer stringList =new StringBuffer(); | ||
| 1096 | - List<Object[]> objectList=repository.checkNbmmNum(rq, gsbm, fgsbm, xlbm,nbbm); | ||
| 1097 | - for (int i = 0; i < objectList.size(); i++) { | ||
| 1098 | - String clbm=objectList.get(i)[0].toString()+","; | ||
| 1099 | - int cs=Integer.parseInt(objectList.get(i)[1].toString()); | ||
| 1100 | - //一车一单 | ||
| 1101 | - if(lx==1){ | ||
| 1102 | - if(cs==1){ | ||
| 1103 | - stringList.append(clbm); | ||
| 1104 | - } | ||
| 1105 | - } | ||
| 1106 | - //一车多单 | ||
| 1107 | - if(lx==2){ | ||
| 1108 | - if(cs>1){ | ||
| 1109 | - stringList.append(clbm); | ||
| 1110 | - } | ||
| 1111 | - | ||
| 1112 | - } | ||
| 1113 | - } | ||
| 1114 | - return stringList; | ||
| 1115 | - } | ||
| 1116 | - | ||
| 1117 | - | ||
| 1118 | - | ||
| 1119 | - @Override | ||
| 1120 | - public Map<String, Object> sumYlb(Map<String, Object> map) { | ||
| 1121 | - // TODO Auto-generated method stub | ||
| 1122 | - List<String> stringList=new ArrayList<String>(); | ||
| 1123 | - String rq=map.get("rq").toString(); | ||
| 1124 | - String gsbm=map.get("ssgsdm_like").toString(); | ||
| 1125 | - String fgsbm=map.get("fgsdm_like").toString(); | ||
| 1126 | - String xlbm=map.get("xlbm_like").toString().trim(); | ||
| 1127 | - String nbbm=map.get("nbbm_eq").toString(); | ||
| 1128 | - String sxtj=map.get("sxtj").toString(); | ||
| 1129 | - String type=map.get("type").toString(); | ||
| 1130 | - SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); | ||
| 1131 | - List<Object[]> sumYlbList=new ArrayList<Object[]>(); | ||
| 1132 | - try { | ||
| 1133 | - if(nbbm.trim()!=""){ | ||
| 1134 | - stringList.add(nbbm); | ||
| 1135 | - }else{ | ||
| 1136 | - if(!sxtj.equals("0")){ | ||
| 1137 | - List<Object[]> objectLists; | ||
| 1138 | - if(sxtj.equals("3")){ | ||
| 1139 | - //有加油没里程 | ||
| 1140 | - objectLists=repository.checkNbmmYl(rq, gsbm, fgsbm, xlbm, nbbm); | ||
| 1141 | - for (int i = 0; i < objectLists.size(); i++) { | ||
| 1142 | - String clbm=objectLists.get(i)[0].toString(); | ||
| 1143 | - double jzl=Double.parseDouble(objectLists.get(i)[1].toString()); | ||
| 1144 | - double zlc=Double.parseDouble(objectLists.get(i)[2].toString()); | ||
| 1145 | - if(jzl>0 && zlc<=0){ | ||
| 1146 | - stringList.add(clbm); | ||
| 1147 | - } | ||
| 1148 | - | ||
| 1149 | - } | ||
| 1150 | - | ||
| 1151 | - }else if(sxtj.equals("4")){ | ||
| 1152 | - //有里程没加油 | ||
| 1153 | - objectLists=repository.checkNbmmYl(rq, gsbm, fgsbm, xlbm, nbbm); | ||
| 1154 | - for (int i = 0; i < objectLists.size(); i++) { | ||
| 1155 | - String clbm=objectLists.get(i)[0].toString(); | ||
| 1156 | - double jzl=Double.parseDouble(objectLists.get(i)[1].toString()); | ||
| 1157 | - double zlc=Double.parseDouble(objectLists.get(i)[2].toString()); | ||
| 1158 | - if(zlc>0 && jzl<=0){ | ||
| 1159 | - stringList.add(clbm); | ||
| 1160 | - } | ||
| 1161 | - | ||
| 1162 | - } | ||
| 1163 | - }else{ | ||
| 1164 | - objectLists=repository.checkNbmmNum(rq, gsbm, fgsbm, xlbm,nbbm); | ||
| 1165 | - for (int i = 0; i < objectLists.size(); i++) { | ||
| 1166 | - String clbm=objectLists.get(i)[0].toString(); | ||
| 1167 | - int cs=Integer.parseInt(objectLists.get(i)[1].toString()); | ||
| 1168 | - //一车一单 | ||
| 1169 | - | ||
| 1170 | - if(sxtj.equals("1")){ | ||
| 1171 | - if(cs==1){ | ||
| 1172 | - stringList.add(clbm); | ||
| 1173 | - } | ||
| 1174 | - } | ||
| 1175 | - //一车多单 | ||
| 1176 | - if(sxtj.equals("2")){ | ||
| 1177 | - if(cs>1){ | ||
| 1178 | - stringList.add(clbm); | ||
| 1179 | - } | ||
| 1180 | - } | ||
| 1181 | - } | ||
| 1182 | - } | ||
| 1183 | - } | ||
| 1184 | - } | ||
| 1185 | - if(sxtj.equals("0")){ | ||
| 1186 | - sumYlbList=repository.sumYlb2(rq, gsbm, fgsbm, xlbm,nbbm); | ||
| 1187 | - }else{ | ||
| 1188 | - if(stringList.size()>0){ | ||
| 1189 | - | ||
| 1190 | -// String strings[]=new String[stringList.size()]; | ||
| 1191 | -// for(int i=0;i<stringList.size();i++){ | ||
| 1192 | -// strings[i]=stringList.get(i); | ||
| 1193 | -// } | ||
| 1194 | - if (type.equals("1")) | ||
| 1195 | - sumYlbList=repository.sumYlb(rq, gsbm, fgsbm, xlbm, stringList); | ||
| 1196 | - else | ||
| 1197 | - sumYlbList=repository.sumYlb_s(sdf.parse(rq+" 00:00:00"), gsbm, fgsbm, xlbm, stringList); | ||
| 1198 | - } | ||
| 1199 | -// else{ | ||
| 1200 | -// sumYlbList=repository.sumYlb2(rq, gsbm, fgsbm, xlbm, nbbm); | ||
| 1201 | -// } | ||
| 1202 | - | ||
| 1203 | - } | ||
| 1204 | - } catch (ParseException e) { | ||
| 1205 | - // TODO Auto-generated catch block | ||
| 1206 | - e.printStackTrace(); | ||
| 1207 | - } | ||
| 1208 | - Double jzl=0.0,yh=0.0,sh=0.0; | ||
| 1209 | - for (int i = 0; i < sumYlbList.size(); i++) { | ||
| 1210 | - jzl = Arith.add(jzl, Double.valueOf(sumYlbList.get(i)[0].toString())); | ||
| 1211 | - yh = Arith.add(yh, Double.valueOf(sumYlbList.get(i)[1].toString())); | ||
| 1212 | - sh = Arith.add(sh, Double.valueOf(sumYlbList.get(i)[2].toString())); | ||
| 1213 | - } | ||
| 1214 | - | ||
| 1215 | - Map<String, Object> sumMap=new HashMap<String,Object>(); | ||
| 1216 | - sumMap.put("jzl", jzl); | ||
| 1217 | - sumMap.put("yh", yh); | ||
| 1218 | - sumMap.put("sh", sh); | ||
| 1219 | - | ||
| 1220 | -// String sql="select sum(jzl),sum(yh),sum(sh) from bsth_c_ylb " | ||
| 1221 | -// + " where to_days('"+map.get("rq").toString()+"')=to_days(rq) " | ||
| 1222 | -// + " and ssgsdm like '%"+map.get("ssgsdm_like").toString()+"%' " | ||
| 1223 | -// + " and fgsdm like '%"+map.get("fgsdm_like").toString()+"%' " | ||
| 1224 | -// + " and xlbm like '%"+map.get("xlbm_like").toString()+ "%'" | ||
| 1225 | -// + " and nbbm like '%"+map.get("nbbm_eq").toString()+"% '"; | ||
| 1226 | -// if(map.get("nbbm_in")!=null){ | ||
| 1227 | -//// sql +=" and nbbm in (" | ||
| 1228 | -// } | ||
| 1229 | - return sumMap; | ||
| 1230 | - } | ||
| 1231 | - | ||
| 1232 | - | ||
| 1233 | - | ||
| 1234 | - @Override | ||
| 1235 | - public List<Ylb> listYlb(Map<String, Object> map) { | ||
| 1236 | - // TODO Auto-generated method stub | ||
| 1237 | - List<Ylb> listYlb = new ArrayList<Ylb>(); | ||
| 1238 | - try { | ||
| 1239 | - List<String> stringList = new ArrayList<String>(); | ||
| 1240 | - String rq = map.get("rq").toString(); | ||
| 1241 | - String gsbm = map.get("ssgsdm_like").toString(); | ||
| 1242 | - String fgsbm = map.get("fgsdm_like").toString(); | ||
| 1243 | - String xlbm = map.get("xlbm_like").toString().trim(); | ||
| 1244 | - String nbbm = map.get("nbbm_eq").toString(); | ||
| 1245 | - String sxtj = map.get("sxtj").toString(); | ||
| 1246 | - SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); | ||
| 1247 | - String type = map.get("type").toString(); | ||
| 1248 | - if (nbbm.trim() != "") { | ||
| 1249 | - stringList.add(nbbm); | ||
| 1250 | - List<Object[]> objectLists = repository.checkNbmmNum(rq, gsbm, fgsbm, xlbm, nbbm); | ||
| 1251 | - if (objectLists.size() > 0) { | ||
| 1252 | - int cs = Integer.parseInt(objectLists.get(0)[1].toString()); | ||
| 1253 | - if (sxtj.equals("1")) { | ||
| 1254 | - if (cs == 1) { | ||
| 1255 | - if (type.equals("1")) | ||
| 1256 | - listYlb = repository.listYlb(rq, gsbm, fgsbm, xlbm, stringList); | ||
| 1257 | - else | ||
| 1258 | - listYlb = repository.listYlb_s(sdf.parse(rq+" 00:00:00"), gsbm, fgsbm, xlbm, stringList); | ||
| 1259 | - | ||
| 1260 | - } | ||
| 1261 | - } else if (sxtj.equals("2")) { | ||
| 1262 | - if (cs > 1) { | ||
| 1263 | - if (type.equals("1")) | ||
| 1264 | - listYlb = repository.listYlb(rq, gsbm, fgsbm, xlbm, stringList); | ||
| 1265 | - else | ||
| 1266 | - listYlb = repository.listYlb_s(sdf.parse(rq+" 00:00:00"), gsbm, fgsbm, xlbm, stringList); | ||
| 1267 | - } | ||
| 1268 | - } else { | ||
| 1269 | - if (type.equals("1")) | ||
| 1270 | - listYlb = repository.listYlb(rq, gsbm, fgsbm, xlbm, stringList); | ||
| 1271 | - else | ||
| 1272 | - listYlb = repository.listYlb_s(sdf.parse(rq+" 00:00:00"), gsbm, fgsbm, xlbm, stringList); | ||
| 1273 | - } | ||
| 1274 | - } | ||
| 1275 | - | ||
| 1276 | - } else { | ||
| 1277 | - // 全部 | ||
| 1278 | - if (sxtj.equals("0")) { | ||
| 1279 | - List<Object[]> objectLists = repository.checkNbmmNum(rq, gsbm, fgsbm, xlbm, nbbm); | ||
| 1280 | - for (int i = 0; i < objectLists.size(); i++) { | ||
| 1281 | - String clbm = objectLists.get(i)[0].toString(); | ||
| 1282 | - stringList.add(clbm); | ||
| 1283 | - } | ||
| 1284 | - if (stringList.size() > 0) { | ||
| 1285 | - if (type.equals("1")) | ||
| 1286 | - listYlb = repository.listYlb(rq, gsbm, fgsbm, xlbm, stringList); | ||
| 1287 | - else | ||
| 1288 | - listYlb = repository.listYlb_s(sdf.parse(rq+" 00:00:00"), gsbm, fgsbm, xlbm, stringList); | ||
| 1289 | - } | ||
| 1290 | - }else if(sxtj.equals("5")){ | ||
| 1291 | - List<Object[]> objectLists = repository.checkNbmmFgs(rq, gsbm); | ||
| 1292 | - for (int i = 0; i < objectLists.size(); i++) { | ||
| 1293 | - String clbm =objectLists.get(i)[0].toString(); | ||
| 1294 | - stringList.add(clbm); | ||
| 1295 | - } | ||
| 1296 | - | ||
| 1297 | - if (stringList.size() > 0) { | ||
| 1298 | - if (type.equals("1")) | ||
| 1299 | - listYlb = repository.listYlb(rq, gsbm, fgsbm, xlbm, stringList); | ||
| 1300 | - else | ||
| 1301 | - listYlb = repository.listYlb_s(sdf.parse(rq+" 00:00:00"), gsbm, fgsbm, xlbm, stringList); | ||
| 1302 | - } | ||
| 1303 | - } else { | ||
| 1304 | - List<Object[]> objectLists; | ||
| 1305 | - if (sxtj.equals("3")) { | ||
| 1306 | - // 有加油没里程 | ||
| 1307 | - objectLists = repository.checkNbmmYl(rq, gsbm, fgsbm, xlbm, nbbm); | ||
| 1308 | - for (int i = 0; i < objectLists.size(); i++) { | ||
| 1309 | - String clbm = objectLists.get(i)[0].toString(); | ||
| 1310 | - double jzl = Double.parseDouble(objectLists.get(i)[1].toString()); | ||
| 1311 | - double zlc = Double.parseDouble(objectLists.get(i)[2].toString()); | ||
| 1312 | - if (jzl > 0 && zlc <= 0) { | ||
| 1313 | - stringList.add(clbm); | ||
| 1314 | - } | ||
| 1315 | - | ||
| 1316 | - } | ||
| 1317 | - | ||
| 1318 | - } else if (sxtj.equals("4")) { | ||
| 1319 | - // 有里程没加油 | ||
| 1320 | - objectLists = repository.checkNbmmYl(rq, gsbm, fgsbm, xlbm, nbbm); | ||
| 1321 | - for (int i = 0; i < objectLists.size(); i++) { | ||
| 1322 | - String clbm = objectLists.get(i)[0].toString(); | ||
| 1323 | - double jzl = Double.parseDouble(objectLists.get(i)[1].toString()); | ||
| 1324 | - double zlc = Double.parseDouble(objectLists.get(i)[2].toString()); | ||
| 1325 | - if (zlc > 0 && jzl <= 0) { | ||
| 1326 | - stringList.add(clbm); | ||
| 1327 | - } | ||
| 1328 | - | ||
| 1329 | - } | ||
| 1330 | - } else { | ||
| 1331 | - objectLists = repository.checkNbmmNum(rq, gsbm, fgsbm, xlbm, nbbm); | ||
| 1332 | - for (int i = 0; i < objectLists.size(); i++) { | ||
| 1333 | - String clbm = objectLists.get(i)[0].toString(); | ||
| 1334 | - int cs = Integer.parseInt(objectLists.get(i)[1].toString()); | ||
| 1335 | - // 一车一单 | ||
| 1336 | - if (sxtj.equals("1")) { | ||
| 1337 | - if (cs == 1) { | ||
| 1338 | - stringList.add(clbm); | ||
| 1339 | - } | ||
| 1340 | - } | ||
| 1341 | - // 一车多单 | ||
| 1342 | - if (sxtj.equals("2")) { | ||
| 1343 | - if (cs > 1) { | ||
| 1344 | - stringList.add(clbm); | ||
| 1345 | - } | ||
| 1346 | - } | ||
| 1347 | - } | ||
| 1348 | - } | ||
| 1349 | - | ||
| 1350 | - if (stringList.size() > 0) { | ||
| 1351 | - if (type.equals("1")) | ||
| 1352 | - listYlb = repository.listYlb(rq, gsbm, fgsbm, xlbm, stringList); | ||
| 1353 | - else | ||
| 1354 | - listYlb = repository.listYlb_s(sdf.parse(rq+" 00:00:00"), gsbm, fgsbm, xlbm, stringList); | ||
| 1355 | - } | ||
| 1356 | - } | ||
| 1357 | - } | ||
| 1358 | - } catch (ParseException e) { | ||
| 1359 | - // TODO Auto-generated catch block | ||
| 1360 | - e.printStackTrace(); | ||
| 1361 | - } | ||
| 1362 | - return listYlb; | ||
| 1363 | - } | ||
| 1364 | - | ||
| 1365 | - @Transactional | ||
| 1366 | - @Override | ||
| 1367 | - public Map<String, Object> saveYlbList(Map<String, Object> map) throws Exception { | ||
| 1368 | - // TODO Auto-generated method stub | ||
| 1369 | - Map<String, Object> newMap=new HashMap<String,Object>(); | ||
| 1370 | - try{ | ||
| 1371 | - SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd"); | ||
| 1372 | - String json =StringEscapeUtils.unescapeHtml4(map.get("ylbList").toString()); | ||
| 1373 | - JSONArray jsonArray=JSONArray.parseArray(json); | ||
| 1374 | - JSONObject jsonObject; | ||
| 1375 | - // 获取车辆存油信息 | ||
| 1376 | - List<Cyl> cylList = cylRepository.obtainCyl("",""); | ||
| 1377 | - for (int i = 0; i < jsonArray.size(); i++) { | ||
| 1378 | -// Ylb t=new Ylb(); | ||
| 1379 | - jsonObject=jsonArray.getJSONObject(i); | ||
| 1380 | - double czyl = jsonObject.getDoubleValue("czyl"); | ||
| 1381 | - double jzl =jsonObject.getDoubleValue("jzl"); | ||
| 1382 | - double jzyl =jsonObject.getDoubleValue("jzyl"); | ||
| 1383 | - double sh =jsonObject.getDoubleValue("sh"); | ||
| 1384 | - String shyy =jsonObject.getString("shyy"); | ||
| 1385 | - double ns = jsonObject.getDoubleValue("ns"); | ||
| 1386 | - String rylx =jsonObject.getString("rylx"); | ||
| 1387 | - int yhlx =jsonObject.getIntValue("yhlx"); | ||
| 1388 | - Integer id =jsonObject.getInteger("id"); | ||
| 1389 | - String nbbm =jsonObject.getString("nbbm"); | ||
| 1390 | - String rq=jsonObject.getString("rq"); | ||
| 1391 | - double yh = Arith.sub(Arith.add(czyl, jzl),jzyl); | ||
| 1392 | - if(yh<0){ | ||
| 1393 | - yh=0.0; | ||
| 1394 | - } | ||
| 1395 | - repository.ylbUpdate(id, czyl, jzyl, yh, sh, shyy, ns, rylx,yhlx); | ||
| 1396 | - } | ||
| 1397 | -// List<Map<String, Object>> list=(List<Map<String, Object>>) map.get("ylbList"); | ||
| 1398 | - SysUser user = SecurityUtils.getCurrentUser(); | ||
| 1399 | - Nylog nylog=new Nylog(); | ||
| 1400 | - nylog.setCreatedate(new Date()); | ||
| 1401 | - nylog.setCzmc("保存全部"); | ||
| 1402 | - nylog.setNylx("油"); | ||
| 1403 | - nylog.setUserid(user.getUserName()); | ||
| 1404 | - nylog.setUsername(user.getName()); | ||
| 1405 | - nylog.setCxtj(""); | ||
| 1406 | - nylogRepository.save(nylog); | ||
| 1407 | - newMap.put("status", ResponseCode.SUCCESS); | ||
| 1408 | - }catch(Exception e){ | ||
| 1409 | - newMap.put("status", ResponseCode.ERROR); | ||
| 1410 | - logger.error("save erro.", e); | ||
| 1411 | - throw e; | ||
| 1412 | - } | ||
| 1413 | - return newMap; | ||
| 1414 | - } | ||
| 1415 | - | ||
| 1416 | - /** | ||
| 1417 | - * 拆分 | ||
| 1418 | - */ | ||
| 1419 | - @Transactional | ||
| 1420 | - @Override | ||
| 1421 | - public Map<String, Object> sort(Map<String, Object> map) throws Exception{ | ||
| 1422 | - // TODO Auto-generated method stub | ||
| 1423 | - Map<String, Object> newMap = new HashMap<String, Object>(); | ||
| 1424 | - SimpleDateFormat sdf =new SimpleDateFormat("yyyy-MM-dd"); | ||
| 1425 | - | ||
| 1426 | - try { | ||
| 1427 | - List<Cyl> cylList = cylRepository.findAll(new CustomerSpecs<Cyl>(newMap)); | ||
| 1428 | - String json =StringEscapeUtils.unescapeHtml4(map.get("ylbList").toString()); | ||
| 1429 | - String fgsbm="999"; | ||
| 1430 | - if(map.get("fgsbm")!=null){ | ||
| 1431 | - fgsbm=map.get("fgsbm").toString(); | ||
| 1432 | - } | ||
| 1433 | - JSONArray jsonArray=JSONArray.parseArray(json); | ||
| 1434 | - JSONObject jsonObject; | ||
| 1435 | - for (int x = 0; x < jsonArray.size(); x++) { | ||
| 1436 | - jsonObject=jsonArray.getJSONObject(x); | ||
| 1437 | - Double yl =jsonObject.getDoubleValue("jzyl"); | ||
| 1438 | - Double sh =jsonObject.getDoubleValue("sh"); | ||
| 1439 | - String shyy =jsonObject.getString("shyy"); | ||
| 1440 | - Double ns = jsonObject.getDoubleValue("ns"); | ||
| 1441 | - String rylx =jsonObject.getString("rylx"); | ||
| 1442 | - Integer id =jsonObject.getInteger("id"); | ||
| 1443 | - Ylb ylb = repository.findById(id).get(); | ||
| 1444 | - String nbbm_eq = ylb.getNbbm(); | ||
| 1445 | - Date rq_eq = ylb.getRq(); | ||
| 1446 | - // 得到一天总的加油和里程(根据车,时间) | ||
| 1447 | - List<Object[]> sumList=new ArrayList<Object[]>(); | ||
| 1448 | - if(fgsbm.equals("")) | ||
| 1449 | - sumList = repository.sumLcYl(nbbm_eq, rq_eq,"",ylb.getSsgsdm(),fgsbm); | ||
| 1450 | - else | ||
| 1451 | - sumList = repository.sumLcYl(nbbm_eq, rq_eq,"",ylb.getSsgsdm(),ylb.getFgsdm()); | ||
| 1452 | - | ||
| 1453 | - // 保存总的加油量 | ||
| 1454 | - Double jzl = 0.0; | ||
| 1455 | - // 保存总的里程 | ||
| 1456 | - Double zlc = 0.0; | ||
| 1457 | - //保存总的损耗 | ||
| 1458 | - Double zsh = 0.0; | ||
| 1459 | - for (int j = 0; j < sumList.size(); j++) { | ||
| 1460 | - jzl = Arith.add(jzl, Double.valueOf(sumList.get(j)[0].toString())); | ||
| 1461 | - zlc = Arith.add(zlc, Double.valueOf(sumList.get(j)[1].toString())); | ||
| 1462 | - zsh = Arith.add(zsh, Double.valueOf(sumList.get(j)[2].toString())); | ||
| 1463 | - } | ||
| 1464 | -// jzl = Arith.sub(jzl, zsh); | ||
| 1465 | - //新的 损耗不等于 旧的损耗 总损耗从新算 | ||
| 1466 | - /*if(Arith.sub(ylb.getSh(),sh )!=0){ | ||
| 1467 | - zsh =Arith.add(Arith.sub(zsh, ylb.getSh()), sh); | ||
| 1468 | - jzl =Arith.sub(jzl, zsh); | ||
| 1469 | - }else{ | ||
| 1470 | - jzl =Arith.sub(jzl, zsh); | ||
| 1471 | - }*/ | ||
| 1472 | - map.put("nbbm_eq", nbbm_eq); | ||
| 1473 | - map.put("rq_eq", rq_eq); | ||
| 1474 | - List<Ylb> iterator2=null; | ||
| 1475 | - if(fgsbm.equals("")) | ||
| 1476 | - iterator2=this.listOrderBy(sdf.format(rq_eq),ylb.getSsgsdm(),fgsbm,"", | ||
| 1477 | - ylb.getNbbm(),"jcsx"); | ||
| 1478 | - else | ||
| 1479 | - iterator2=this.listOrderBy(sdf.format(rq_eq),ylb.getSsgsdm(),ylb.getFgsdm(),"", | ||
| 1480 | - ylb.getNbbm(),"jcsx"); | ||
| 1481 | - | ||
| 1482 | -// repository.obtainYl(sdf.format(rq_eq),ylb.getSsgsdm(),ylb.getFgsdm(),"", | ||
| 1483 | -// ylb.getNbbm(),"jcsx"); | ||
| 1484 | - DecimalFormat df = new DecimalFormat("#.00"); | ||
| 1485 | - Double zyl = 0.0; | ||
| 1486 | - Double nextJzyl = 0.0; | ||
| 1487 | - // 车的,进,出油量及耗油 | ||
| 1488 | - double czyl=0.0; | ||
| 1489 | - for (int i = 0; i < iterator2.size(); i++) { | ||
| 1490 | - Ylb t = iterator2.get(i); | ||
| 1491 | - if (t.getJcsx() == 1) { | ||
| 1492 | - if(t.getId()==id){ | ||
| 1493 | - t.setSh(sh); | ||
| 1494 | - t.setShyy(shyy); | ||
| 1495 | - } | ||
| 1496 | - czyl=t.getCzyl(); | ||
| 1497 | - Double jcyl = t.getCzyl(); | ||
| 1498 | - zyl = Arith.sub(Arith.add(jcyl, jzl), yl); | ||
| 1499 | - Double yh = 0.0; | ||
| 1500 | - if (zlc > 0 && t.getZlc() > 0) { | ||
| 1501 | - yh = Double.parseDouble(df.format(zyl * (t.getZlc() / zlc))); | ||
| 1502 | - } | ||
| 1503 | - nextJzyl =Arith.sub(Arith.add(t.getJzl(), t.getCzyl()), yh); | ||
| 1504 | -// nextJzyl =Arith.sub(Arith.add(t.getJzl(), t.getCzyl()), Arith.add(yh, t.getSh())); | ||
| 1505 | - if(zlc>0 && t.getZlc() > 0){ | ||
| 1506 | - long l=Math.round(nextJzyl); | ||
| 1507 | - double ylxs=l*100/100; | ||
| 1508 | -// nextJzyl = Arith.add(nextJzyl,Arith.sub(nextJzyl,ylxs)); | ||
| 1509 | - yh=Arith.add(yh, Arith.sub(nextJzyl,ylxs)); | ||
| 1510 | - t.setYh(yh); | ||
| 1511 | - t.setJzyl(ylxs); | ||
| 1512 | - nextJzyl=ylxs; | ||
| 1513 | - }else{ | ||
| 1514 | - t.setYh(yh); | ||
| 1515 | - t.setJzyl(nextJzyl); | ||
| 1516 | - } | ||
| 1517 | - } else { | ||
| 1518 | - if(t.getId()==id){ | ||
| 1519 | - t.setSh(sh); | ||
| 1520 | - t.setShyy(shyy); | ||
| 1521 | - } | ||
| 1522 | - t.setCzyl(nextJzyl); | ||
| 1523 | - Double yh =0.0; | ||
| 1524 | - if (t.getZlc() >= 0) { | ||
| 1525 | - yh= Double.parseDouble(df.format(zyl * (t.getZlc() / zlc))); | ||
| 1526 | - } | ||
| 1527 | -// nextJzyl = Arith.sub(Arith.add(t.getJzl(), nextJzyl), Arith.add(yh, t.getSh())); | ||
| 1528 | - nextJzyl = Arith.sub(Arith.add(t.getJzl(), nextJzyl), yh); | ||
| 1529 | - if(zlc>0 && t.getZlc() >0){ | ||
| 1530 | - long l=0l; | ||
| 1531 | - double ylxs=0.0; | ||
| 1532 | - if(i==iterator2.size()-1){ | ||
| 1533 | - ylxs=yl; | ||
| 1534 | - }else{ | ||
| 1535 | - l=Math.round(nextJzyl); | ||
| 1536 | - ylxs=l*100/100; | ||
| 1537 | - } | ||
| 1538 | - yh=Arith.add(yh, Arith.sub(nextJzyl,ylxs)); | ||
| 1539 | - t.setYh(yh); | ||
| 1540 | - t.setJzyl(ylxs); | ||
| 1541 | - nextJzyl=ylxs; | ||
| 1542 | - }else{ | ||
| 1543 | - t.setYh(yh); | ||
| 1544 | - t.setJzyl(nextJzyl); | ||
| 1545 | - } | ||
| 1546 | - } | ||
| 1547 | - if(t.getJzyl()<0){ | ||
| 1548 | - t.setJzyl(0.0); | ||
| 1549 | - } | ||
| 1550 | - if(t.getCzyl()<0){ | ||
| 1551 | - t.setCzyl(0.0); | ||
| 1552 | - } | ||
| 1553 | - if(t.getYh()<0){ | ||
| 1554 | - t.setYh(0.0); | ||
| 1555 | - } | ||
| 1556 | - if(t.getSh()<0){ | ||
| 1557 | - t.setSh(0.0); | ||
| 1558 | - } | ||
| 1559 | - repository.save(t); | ||
| 1560 | - } | ||
| 1561 | - newMap.put("status", ResponseCode.SUCCESS); | ||
| 1562 | - } | ||
| 1563 | - | ||
| 1564 | - SysUser user = SecurityUtils.getCurrentUser(); | ||
| 1565 | - Nylog nylog=new Nylog(); | ||
| 1566 | - nylog.setCreatedate(new Date()); | ||
| 1567 | - nylog.setCzmc("拆分"); | ||
| 1568 | - nylog.setNylx("油"); | ||
| 1569 | - nylog.setUserid(user.getUserName()); | ||
| 1570 | - nylog.setUsername(user.getName()); | ||
| 1571 | - nylog.setCxtj(""); | ||
| 1572 | - nylogRepository.save(nylog); | ||
| 1573 | - } catch (Exception e) { | ||
| 1574 | - newMap.put("status", ResponseCode.ERROR); | ||
| 1575 | - logger.error("save erro.", e); | ||
| 1576 | - throw e; | ||
| 1577 | - } | ||
| 1578 | - return newMap; | ||
| 1579 | - } | ||
| 1580 | - | ||
| 1581 | - | ||
| 1582 | - @Override | ||
| 1583 | - public String checkJsy(Map<String, Object> map) { | ||
| 1584 | - // TODO Auto-generated method stub | ||
| 1585 | - SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd"); | ||
| 1586 | - String rq=map.get("date").toString(); | ||
| 1587 | - String nbbm=map.get("nbbm").toString(); | ||
| 1588 | - String jsy =map.get("jsy").toString(); | ||
| 1589 | - String xlbm=map.get("xlbm").toString(); | ||
| 1590 | - List<Ylb> list= repository.checkYlb(rq, nbbm, jsy,xlbm,"nbbm"); | ||
| 1591 | - String type="1"; | ||
| 1592 | - if(list.size()>0){ | ||
| 1593 | - type="0"; | ||
| 1594 | - } | ||
| 1595 | - return type; | ||
| 1596 | - } | ||
| 1597 | - | ||
| 1598 | - @Override | ||
| 1599 | - public String checkDate(Map<String, Object> map) { | ||
| 1600 | - // TODO Auto-generated method stub | ||
| 1601 | - SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd"); | ||
| 1602 | - String rq=map.get("rq").toString(); | ||
| 1603 | - String gsbm=map.get("ssgsdm_like").toString(); | ||
| 1604 | - String type="1"; | ||
| 1605 | - if(gsbm.equals("26")){ | ||
| 1606 | - Date date=new Date(); | ||
| 1607 | - try { | ||
| 1608 | - long day2=date.getTime(); | ||
| 1609 | - long day1=sdf.parse(rq).getTime(); | ||
| 1610 | - long days = (day2 - day1) / (24*3600*1000); | ||
| 1611 | - if(days>3){ | ||
| 1612 | - type="2"; | ||
| 1613 | - } | ||
| 1614 | - } catch (ParseException e) { | ||
| 1615 | - // TODO Auto-generated catch block | ||
| 1616 | - e.printStackTrace(); | ||
| 1617 | - } | ||
| 1618 | - } | ||
| 1619 | - return type; | ||
| 1620 | - } | ||
| 1621 | - | ||
| 1622 | - | ||
| 1623 | - | ||
| 1624 | - @Override | ||
| 1625 | - public Map<String, Object> saveYlb(Ylb t) { | ||
| 1626 | - Map<String, Object> map = new HashMap<>(); | ||
| 1627 | - SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd"); | ||
| 1628 | - String rq=sdf.format(t.getRq()); | ||
| 1629 | - String gsdm=t.getSsgsdm(); | ||
| 1630 | - String fgsdm=t.getFgsdm(); | ||
| 1631 | - String xlbm=t.getXlbm(); | ||
| 1632 | - String jhsj=t.getJhsj(); | ||
| 1633 | - String jsy=t.getJsy(); | ||
| 1634 | - String nbbm=t.getNbbm(); | ||
| 1635 | - t.setCreatetime(new Date()); | ||
| 1636 | - String[] jhsjStr = jhsj.split(":"); | ||
| 1637 | - long fcsjL= Long.parseLong(jhsjStr[0])*60+Long.parseLong(jhsjStr[1]); | ||
| 1638 | - List<Ylb> list=this.listOrderBy(rq, gsdm, fgsdm, xlbm, nbbm, "jhsj"); | ||
| 1639 | -// repository.obtainYl(rq, gsdm, fgsdm, xlbm, nbbm, "jhsj"); | ||
| 1640 | - int jcsx=1; | ||
| 1641 | - if(list.size()>0){ | ||
| 1642 | - for (int i = 0; i < list.size(); i++) { | ||
| 1643 | - Ylb y=list.get(i); | ||
| 1644 | - String[] fcsjStr = y.getJhsj().split(":"); | ||
| 1645 | - long fcsj=Long.parseLong(fcsjStr[0])*60+Long.parseLong(fcsjStr[1]); | ||
| 1646 | - if(fcsjL>fcsj){ | ||
| 1647 | - jcsx=jcsx+y.getJcsx(); | ||
| 1648 | - }else{ | ||
| 1649 | - y.setJcsx(y.getJcsx()+1); | ||
| 1650 | - repository.save(y); | ||
| 1651 | - } | ||
| 1652 | - } | ||
| 1653 | - | ||
| 1654 | - } | ||
| 1655 | - t.setJcsx(jcsx); | ||
| 1656 | - repository.save(t); | ||
| 1657 | - | ||
| 1658 | - SysUser user = SecurityUtils.getCurrentUser(); | ||
| 1659 | - Nylog nylog=new Nylog(); | ||
| 1660 | - nylog.setCreatedate(new Date()); | ||
| 1661 | - nylog.setCzmc("手动添加"); | ||
| 1662 | - nylog.setNylx("油"); | ||
| 1663 | - nylog.setUserid(user.getUserName()); | ||
| 1664 | - nylog.setUsername(user.getName()); | ||
| 1665 | - nylog.setCxtj(""); | ||
| 1666 | - nylogRepository.save(nylog); | ||
| 1667 | - map.put("status", ResponseCode.SUCCESS); | ||
| 1668 | - map.put("t", t); | ||
| 1669 | - return map; | ||
| 1670 | - } | ||
| 1671 | - @Transactional | ||
| 1672 | - @Override | ||
| 1673 | - public Map<String, Object> deleteIds(Map<String, Object> map) throws Exception{ | ||
| 1674 | - // TODO Auto-generated method stub | ||
| 1675 | - Map<String, Object> maps = new HashMap<>(); | ||
| 1676 | - try{ | ||
| 1677 | - String json =StringEscapeUtils.unescapeHtml4(map.get("ids").toString()); | ||
| 1678 | - JSONArray jsonArray=JSONArray.parseArray(json); | ||
| 1679 | - JSONObject jsonObject; | ||
| 1680 | - for (int x = 0; x < jsonArray.size(); x++) { | ||
| 1681 | - jsonObject=jsonArray.getJSONObject(x); | ||
| 1682 | - Integer id =jsonObject.getInteger("id"); | ||
| 1683 | - repository.deleteById(id); | ||
| 1684 | - } | ||
| 1685 | - | ||
| 1686 | - SysUser user = SecurityUtils.getCurrentUser(); | ||
| 1687 | - Nylog nylog=new Nylog(); | ||
| 1688 | - nylog.setCreatedate(new Date()); | ||
| 1689 | - nylog.setCzmc("删除"); | ||
| 1690 | - nylog.setNylx("油"); | ||
| 1691 | - nylog.setUserid(user.getUserName()); | ||
| 1692 | - nylog.setUsername(user.getName()); | ||
| 1693 | - nylog.setCxtj(""); | ||
| 1694 | - nylogRepository.save(nylog); | ||
| 1695 | - maps.put("status", ResponseCode.SUCCESS); | ||
| 1696 | - } catch (Exception e) { | ||
| 1697 | - maps.put("status", ResponseCode.ERROR); | ||
| 1698 | - logger.error("save erro.", e); | ||
| 1699 | - throw e; | ||
| 1700 | - } | ||
| 1701 | - return maps; | ||
| 1702 | - } | ||
| 1703 | - | ||
| 1704 | - public List<Ylb> listOrderBy(String rq,String gsdm, | ||
| 1705 | - String fgsdm,String xlbm,String nbbm, | ||
| 1706 | - String px) { | ||
| 1707 | - // TODO Auto-generated method stub | ||
| 1708 | - String sql="SELECT * FROM bsth_c_ylb " | ||
| 1709 | - + " where rq ='"+rq+"' and ssgsdm like '%"+gsdm+"%' " | ||
| 1710 | - + " and fgsdm like '%"+fgsdm+"%'"; | ||
| 1711 | - if(xlbm.equals("")){ | ||
| 1712 | - sql+= " and xlbm like '%"+xlbm+"%' "; | ||
| 1713 | - }else{ | ||
| 1714 | - sql+= " and xlbm = '"+xlbm+"' "; | ||
| 1715 | - } | ||
| 1716 | - | ||
| 1717 | - sql += "and nbbm like '%"+nbbm+"%' order by "+px+" asc "; | ||
| 1718 | - | ||
| 1719 | - List<Ylb> list = jdbcTemplate.query(sql, new RowMapper<Ylb>() { | ||
| 1720 | - @Override | ||
| 1721 | - public Ylb mapRow(ResultSet arg0, int arg1) throws SQLException { | ||
| 1722 | - Ylb y = new Ylb(); | ||
| 1723 | - y.setId(arg0.getInt("id")); | ||
| 1724 | - return y; | ||
| 1725 | - } | ||
| 1726 | - }); | ||
| 1727 | - List<Ylb> lists=new ArrayList<Ylb>(); | ||
| 1728 | - List<Ylb> ylbLists=repository.obtainYl(rq,gsdm,fgsdm,xlbm,nbbm,"jcsx"); | ||
| 1729 | - for (int i = 0; i < list.size(); i++) { | ||
| 1730 | - Ylb t=list.get(i); | ||
| 1731 | - for (int j = 0; j < ylbLists.size(); j++) { | ||
| 1732 | - Ylb t2=ylbLists.get(j); | ||
| 1733 | - if(t.getId().intValue()==t2.getId().intValue()){ | ||
| 1734 | - lists.add(t2); | ||
| 1735 | - break; | ||
| 1736 | - } | ||
| 1737 | - } | ||
| 1738 | - } | ||
| 1739 | - | ||
| 1740 | - return lists; | ||
| 1741 | - } | ||
| 1742 | - | ||
| 1743 | - @Override | ||
| 1744 | - public Map<String, Object> updateHistory(Map<String, Object> map) throws Exception { | ||
| 1745 | - // TODO Auto-generated method stub | ||
| 1746 | - Map<String, Object> newMap = new HashMap<String, Object>(); | ||
| 1747 | - | ||
| 1748 | - List<Cars> carsList = carsRepository.findCars(); | ||
| 1749 | - Map<String, Boolean> carsMap = new HashMap<String, Boolean>(); | ||
| 1750 | - for (int i = 0; i < carsList.size(); i++) { | ||
| 1751 | - Cars c = carsList.get(i); | ||
| 1752 | - carsMap.put(c.getInsideCode(), c.getSfdc()); | ||
| 1753 | - } | ||
| 1754 | - try{ | ||
| 1755 | - String date = map.get("date").toString(); | ||
| 1756 | - String line = map.get("line").toString(); | ||
| 1757 | - List<Line> listLine=lineRepository.findLineByCode(line); | ||
| 1758 | - String gsdm =""; | ||
| 1759 | - String fgsdm =""; | ||
| 1760 | - if(listLine.size()>0){ | ||
| 1761 | - Line l=listLine.get(0); | ||
| 1762 | - gsdm=l.getCompany(); | ||
| 1763 | - fgsdm=l.getBrancheCompany(); | ||
| 1764 | - } | ||
| 1765 | - | ||
| 1766 | - String nbbmstr=""; | ||
| 1767 | - List<Map<String, Object>> listpbYc=new ArrayList<Map<String, Object>>();//油车数据 | ||
| 1768 | - List<Map<String, Object>> listpbDc=new ArrayList<Map<String, Object>>();//电车数据 | ||
| 1769 | - List<Map<String,Object>> listpb=scheduleRealInfoService.yesterdayDataList("", date,gsdm, fgsdm, "", ""); | ||
| 1770 | - for (int i = 0; i < listpb.size(); i++) { | ||
| 1771 | - if(listpb.get(i).get("xlBm").toString().equals(line)){ | ||
| 1772 | - nbbmstr +=listpb.get(i).get("clZbh").toString(); | ||
| 1773 | - } | ||
| 1774 | - } | ||
| 1775 | - for (int i = 0; i < listpb.size(); i++) { | ||
| 1776 | - boolean sfdc=true; | ||
| 1777 | - Map<String, Object> m = listpb.get(i); | ||
| 1778 | - if (carsMap.get(m.get("clZbh").toString()) != null) { | ||
| 1779 | - sfdc = carsMap.get(m.get("clZbh").toString()); | ||
| 1780 | - } else { | ||
| 1781 | - sfdc = true; | ||
| 1782 | - } | ||
| 1783 | - if(nbbmstr.indexOf(m.get("clZbh").toString())>-1){ | ||
| 1784 | - if(sfdc){ | ||
| 1785 | - listpbDc.add(m); | ||
| 1786 | - }else{ | ||
| 1787 | - listpbYc.add(m); | ||
| 1788 | - } | ||
| 1789 | - } | ||
| 1790 | - } | ||
| 1791 | - SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); | ||
| 1792 | - //初始存油量 | ||
| 1793 | - List<Cyl> clyList = cylRepository.obtainCyl("",gsdm); | ||
| 1794 | - List<Ylxxb> ylxxList = ylxxbRepository.obtainYlxx(date, 0,gsdm); | ||
| 1795 | - //重新统计油车数据开始 | ||
| 1796 | - List<Ylb> ylListBe =repository.listByRqJcsx(date, gsdm, fgsdm, "", ""); | ||
| 1797 | - List<Ylb> ylbList=this.listOrderBy(date,gsdm,fgsdm,"","","nbbm"); | ||
| 1798 | - List<Ylb> ylbList_upd=new ArrayList<Ylb>(); | ||
| 1799 | - List<Ylb> ylbList_del=new ArrayList<Ylb>(); | ||
| 1800 | - | ||
| 1801 | - for (int j = 0; j < ylbList.size(); j++) { | ||
| 1802 | - Ylb t=ylbList.get(j); | ||
| 1803 | - boolean fage=true; | ||
| 1804 | - if(StringUtils.isEmpty(t.getLp())){ | ||
| 1805 | - fage=false; | ||
| 1806 | - }else{ | ||
| 1807 | - for (int i = 0; i < listpbYc.size(); i++) { | ||
| 1808 | - Map<String, Object> m = listpbYc.get(i); | ||
| 1809 | - if(t.getNbbm().equals(m.get("clZbh").toString()) | ||
| 1810 | - &&t.getJsy().equals(m.get("jGh").toString()) | ||
| 1811 | - &&t.getXlbm().equals(m.get("xlBm").toString()) | ||
| 1812 | - &&t.getLp().equals(m.get("lpName").toString())){ | ||
| 1813 | - //该条记录不用删除 | ||
| 1814 | - fage =false; | ||
| 1815 | - ylbList_upd.add(t); | ||
| 1816 | - } | ||
| 1817 | - } | ||
| 1818 | - } | ||
| 1819 | - if(fage){ | ||
| 1820 | - if(t.getXlbm().equals(line)){ | ||
| 1821 | - ylbList_del.add(t); | ||
| 1822 | - } | ||
| 1823 | - } | ||
| 1824 | - | ||
| 1825 | - } | ||
| 1826 | - String nbbmStr=""; | ||
| 1827 | - List<Ylb> list=new ArrayList<Ylb>(); | ||
| 1828 | - /* | ||
| 1829 | - * 第一步 修改车辆里程 和加注量 | ||
| 1830 | - */ | ||
| 1831 | - Map<String, Object> ylMap=new HashMap<String, Object>(); | ||
| 1832 | - for (int x = 0; x < listpbYc.size(); x++) { | ||
| 1833 | - String type = "add"; | ||
| 1834 | - Map<String, Object> maps = listpbYc.get(x); | ||
| 1835 | - // 判断驾驶员驾驶的该车辆是否已经存入了(查出的结果集中日期是相同的,根据驾驶员、内部编号、线路编码判断) | ||
| 1836 | - Ylb t = new Ylb(); | ||
| 1837 | - for (int k = 0; k < ylbList_upd.size(); k++) { | ||
| 1838 | - Ylb t1 = ylbList_upd.get(k); | ||
| 1839 | - if (t1.getNbbm().equals(maps.get("clZbh").toString()) | ||
| 1840 | - && t1.getJsy().equals(maps.get("jGh").toString()) | ||
| 1841 | - && t1.getXlbm().equals(maps.get("xlBm").toString()) | ||
| 1842 | - && t1.getLp().equals(maps.get("lpName").toString())) { | ||
| 1843 | - t = t1; | ||
| 1844 | - type = "update"; | ||
| 1845 | - } | ||
| 1846 | - } | ||
| 1847 | - if(type.equals("add")){ | ||
| 1848 | - // 当日的第一个班次,出场油量等于前一天的最后一个班次的进场油量 | ||
| 1849 | - if (maps.get("seqNumber").toString().equals("1")) { | ||
| 1850 | - boolean fage = true; | ||
| 1851 | - for (int i = 0; i < ylListBe.size(); i++) { | ||
| 1852 | - Ylb ylb = ylListBe.get(i); | ||
| 1853 | - if (maps.get("clZbh").toString().equals(ylb.getNbbm())) { | ||
| 1854 | - if(ylb.getJzyl()>0){ | ||
| 1855 | - t.setCzyl(ylb.getJzyl()); | ||
| 1856 | - fage = false; | ||
| 1857 | - break; | ||
| 1858 | - } | ||
| 1859 | - } | ||
| 1860 | - } | ||
| 1861 | - if (fage) { | ||
| 1862 | - for (int y = 0; y < clyList.size(); y++) { | ||
| 1863 | - Cyl cyl = clyList.get(y); | ||
| 1864 | - if (maps.get("clZbh").toString().equals(cyl.getNbbm())) { | ||
| 1865 | - if(cyl!=null){ | ||
| 1866 | - if(cyl.getCyl()>=0){ | ||
| 1867 | - t.setCzyl(cyl.getCyl()); | ||
| 1868 | - fage = false; | ||
| 1869 | - break; | ||
| 1870 | - }else { | ||
| 1871 | - if(cyl.getCxrl()!=null){ | ||
| 1872 | - if(cyl.getCxrl()>0){ | ||
| 1873 | - t.setCzyl(cyl.getCxrl()); | ||
| 1874 | - fage = false; | ||
| 1875 | - break; | ||
| 1876 | - } | ||
| 1877 | - } | ||
| 1878 | - } | ||
| 1879 | - } | ||
| 1880 | - } | ||
| 1881 | - } | ||
| 1882 | - } | ||
| 1883 | - if (fage) { | ||
| 1884 | - t.setCzyl(0.0); | ||
| 1885 | - } | ||
| 1886 | - } | ||
| 1887 | - } | ||
| 1888 | - | ||
| 1889 | - Double jzl = 0.0; | ||
| 1890 | - //一人一车加注量只匹配一次 | ||
| 1891 | - if(ylMap.get(maps.get("clZbh").toString()+"_"+ maps.get("jGh").toString())!=null){ | ||
| 1892 | - }else{ | ||
| 1893 | - boolean fage2=false; | ||
| 1894 | - for (int i = 0; i < ylxxList.size(); i++) { | ||
| 1895 | - Ylxxb ylxxb = ylxxList.get(i); | ||
| 1896 | - if (maps.get("clZbh").toString().equals(ylxxb.getNbbm()) | ||
| 1897 | - && maps.get("jGh").toString().equals(ylxxb.getJsy()) | ||
| 1898 | - && ylxxb.getJylx()==1) { | ||
| 1899 | - if(ylxxb.getJzl()>0){ | ||
| 1900 | - fage2=true; | ||
| 1901 | - } | ||
| 1902 | - } | ||
| 1903 | - } | ||
| 1904 | - //车辆的加注量如果有任工干预,略接口过来 数据 | ||
| 1905 | - if(fage2){ | ||
| 1906 | - // 把当天手工输入的的YLXXB的加注量设置为当天YLB的加注量(根据车号,驾驶员判断,加油类型为1) | ||
| 1907 | - for (int j = 0; j < ylxxList.size(); j++) { | ||
| 1908 | - Ylxxb ylxxb = ylxxList.get(j); | ||
| 1909 | - if (maps.get("clZbh").toString().equals(ylxxb.getNbbm()) | ||
| 1910 | - && maps.get("jGh").toString().equals(ylxxb.getJsy()) | ||
| 1911 | - && ylxxb.getJylx()==1) { | ||
| 1912 | - jzl =Arith.add(jzl, ylxxb.getJzl()); | ||
| 1913 | - } | ||
| 1914 | - } | ||
| 1915 | - ylMap.put(maps.get("clZbh").toString()+"_"+ maps.get("jGh").toString(),maps.get("xlBm") == null ? "" : maps.get("xlBm").toString()); | ||
| 1916 | - }else{ | ||
| 1917 | - // 把当天的YLXXB的加注量设置为当天YLB的加注量(根据车号,驾驶员判断) | ||
| 1918 | - for (int j = 0; j < ylxxList.size(); j++) { | ||
| 1919 | - Ylxxb ylxxb = ylxxList.get(j); | ||
| 1920 | - if (maps.get("clZbh").toString().equals(ylxxb.getNbbm()) | ||
| 1921 | - && maps.get("jGh").toString().equals(ylxxb.getJsy())) { | ||
| 1922 | - jzl =Arith.add(jzl, ylxxb.getJzl()); | ||
| 1923 | - } | ||
| 1924 | - } | ||
| 1925 | - ylMap.put(maps.get("clZbh").toString()+"_"+ maps.get("jGh").toString(),maps.get("xlBm") == null ? "" : maps.get("xlBm").toString()); | ||
| 1926 | - } | ||
| 1927 | - } | ||
| 1928 | - t.setJzl(jzl); | ||
| 1929 | - t.setNbbm(maps.get("clZbh").toString()); | ||
| 1930 | - t.setJsy(maps.get("jGh") == null ? "" : maps.get("jGh").toString()); | ||
| 1931 | - t.setJname(maps.get("jName").toString()); | ||
| 1932 | - t.setZlc(maps.get("totalKilometers") == null ? 0.0 | ||
| 1933 | - : Double.parseDouble(maps.get("totalKilometers").toString())); | ||
| 1934 | - t.setXlbm(maps.get("xlBm") == null ? "" : maps.get("xlBm").toString()); | ||
| 1935 | - t.setJcsx(Integer.parseInt(maps.get("seqNumber").toString())); | ||
| 1936 | - t.setSsgsdm(maps.get("company") == null ? "" : maps.get("company").toString()); | ||
| 1937 | - t.setFgsdm(maps.get("bCompany") == null ? "" : maps.get("bCompany").toString()); | ||
| 1938 | - t.setJhsj(maps.get("fcsj")==null?"":maps.get("fcsj").toString()); | ||
| 1939 | - t.setRq(sdf.parse(date)); | ||
| 1940 | - t.setLp(maps.get("lpName")==null?"":maps.get("lpName").toString()); | ||
| 1941 | - if(!(t.getSsgsdm().equals("") || t.getFgsdm().equals(""))){ | ||
| 1942 | - if(type.equals("add")){ | ||
| 1943 | - if(nbbmStr.indexOf(t.getNbbm())<0){ | ||
| 1944 | - nbbmStr +=t.getNbbm()+","; | ||
| 1945 | - } | ||
| 1946 | - t.setCreatetime(new Date()); | ||
| 1947 | - }else{ | ||
| 1948 | - t.setUpdatetime(new Date()); | ||
| 1949 | - } | ||
| 1950 | - } | ||
| 1951 | - try { | ||
| 1952 | - repository.save(t); | ||
| 1953 | - } catch (Exception e) { | ||
| 1954 | - // TODO: handle exception | ||
| 1955 | - if(e.getMessage().indexOf("PK_YLB_UK")>0){ | ||
| 1956 | - newMap.put("fage", "存在相同数据,数据已经过滤"); | ||
| 1957 | - logger.info("油量存在相同数据,数据已经过滤"); | ||
| 1958 | - } | ||
| 1959 | - } | ||
| 1960 | - | ||
| 1961 | - } | ||
| 1962 | - for (int i = 0; i < ylbList_del.size(); i++) { | ||
| 1963 | - Ylb y=ylbList_del.get(i); | ||
| 1964 | - if(nbbmStr.indexOf(y.getNbbm())<0){ | ||
| 1965 | - nbbmStr +=y.getNbbm()+","; | ||
| 1966 | - } | ||
| 1967 | - repository.deleteById(y.getId()); | ||
| 1968 | - } | ||
| 1969 | - | ||
| 1970 | - //重新计算删除了的或者新增了的车的车的油耗信息(考虑车辆可能跨线路,从分公司赛选计算) | ||
| 1971 | - double czyl=0.0; | ||
| 1972 | - List<Ylb> iterator2=this.listOrderBy(date,gsdm,fgsdm,"","","nbbm,jcsx"); | ||
| 1973 | - String[] nbbms=nbbmStr.split(","); | ||
| 1974 | - for (int i = 0; i < nbbms.length; i++) { | ||
| 1975 | - String clzbm=nbbms[i]; | ||
| 1976 | - // 得到一天总的加油和里程(根据车,时间) | ||
| 1977 | - List<Object[]> sumList = repository.sumLcYl(clzbm, sdf.parse(date),"",gsdm,fgsdm); | ||
| 1978 | - // 保存总的加油量 | ||
| 1979 | - Double jzl = 0.0; | ||
| 1980 | - // 保存总的里程 | ||
| 1981 | - Double zlc = 0.0; | ||
| 1982 | - for (int j = 0; j < sumList.size(); j++) { | ||
| 1983 | - jzl = Arith.add(jzl, Double.valueOf(sumList.get(j)[0].toString())); | ||
| 1984 | - zlc = Arith.add(zlc, Double.valueOf(sumList.get(j)[1].toString())); | ||
| 1985 | - } | ||
| 1986 | - // 保留两位小数 | ||
| 1987 | - DecimalFormat df = new DecimalFormat("#.00"); | ||
| 1988 | - Double zyl = 0.0; | ||
| 1989 | - Double nextJzyl = 0.0; | ||
| 1990 | - for (int j = 0; j < iterator2.size(); j++) { | ||
| 1991 | - Ylb t = iterator2.get(j); | ||
| 1992 | - if(t.getNbbm().equals(clzbm)){ | ||
| 1993 | - if (t.getJcsx() == 1) { | ||
| 1994 | - // 进场等于出场的操作 既 最后进场存油量等于第一次的出场存油量 | ||
| 1995 | - czyl = t.getCzyl(); | ||
| 1996 | - zyl =jzl; | ||
| 1997 | - Double yh=0.0; | ||
| 1998 | - if(zlc>0 ){ | ||
| 1999 | - yh = Double.parseDouble(df.format(zyl * (t.getZlc() / zlc))); | ||
| 2000 | - } | ||
| 2001 | - nextJzyl =Arith.sub( Arith.add(t.getJzl(), t.getCzyl()),yh); | ||
| 2002 | - //把进场油量的小数和整数分别取出 | ||
| 2003 | - if(zlc>0 && t.getZlc()>0){ | ||
| 2004 | - long l=Math.round(nextJzyl); | ||
| 2005 | - double ylxs=l*100/100; | ||
| 2006 | - yh=Arith.add(yh, Arith.sub(nextJzyl,ylxs)); | ||
| 2007 | - t.setYh(yh); | ||
| 2008 | - t.setJzyl(ylxs); | ||
| 2009 | - nextJzyl=ylxs; | ||
| 2010 | - }else{ | ||
| 2011 | - t.setYh(yh); | ||
| 2012 | - t.setJzyl(nextJzyl); | ||
| 2013 | - } | ||
| 2014 | - } else { | ||
| 2015 | - t.setCzyl(nextJzyl); | ||
| 2016 | - Double yh=0.0; | ||
| 2017 | - if(zlc>0){ | ||
| 2018 | - yh= Double.parseDouble(df.format(zyl * (t.getZlc() / zlc))); | ||
| 2019 | - } | ||
| 2020 | - nextJzyl =Arith.sub( Arith.add(t.getJzl(),nextJzyl),yh); | ||
| 2021 | - if(zlc>0 && t.getZlc()>0){ | ||
| 2022 | - long l=0l; | ||
| 2023 | - double ylxs=0.0; | ||
| 2024 | - if(j==iterator2.size()-1){ | ||
| 2025 | - ylxs=czyl; | ||
| 2026 | - }else{ | ||
| 2027 | - if(iterator2.get(j+1).getNbbm().equals(t.getNbbm())){ | ||
| 2028 | - l=Math.round(nextJzyl); | ||
| 2029 | - ylxs=l*100/100; | ||
| 2030 | - }else{ | ||
| 2031 | - ylxs=czyl; | ||
| 2032 | - } | ||
| 2033 | - | ||
| 2034 | - } | ||
| 2035 | - yh=Arith.add(yh, Arith.sub(nextJzyl,ylxs)); | ||
| 2036 | - t.setYh(yh); | ||
| 2037 | - t.setJzyl(ylxs); | ||
| 2038 | - nextJzyl=ylxs; | ||
| 2039 | - }else{ | ||
| 2040 | - t.setYh(yh); | ||
| 2041 | - t.setJzyl(nextJzyl); | ||
| 2042 | - } | ||
| 2043 | - } | ||
| 2044 | - if(t.getJzyl()<0){ | ||
| 2045 | - t.setJzyl(0.0); | ||
| 2046 | - } | ||
| 2047 | - if(t.getCzyl()<0){ | ||
| 2048 | - t.setCzyl(0.0); | ||
| 2049 | - } | ||
| 2050 | - if(t.getYh()<0){ | ||
| 2051 | - t.setYh(0.0); | ||
| 2052 | - } | ||
| 2053 | - if(t.getSh()<0){ | ||
| 2054 | - t.setSh(0.0); | ||
| 2055 | - } | ||
| 2056 | - repository.save(t); | ||
| 2057 | - } | ||
| 2058 | - } | ||
| 2059 | - } | ||
| 2060 | - | ||
| 2061 | - //重新统计油车数据结束 | ||
| 2062 | - | ||
| 2063 | - | ||
| 2064 | - //重新获取电耗数据开始 | ||
| 2065 | - Map<String, List<Dlb>> mapList=dlbService.updeteHistory(listpbDc, date, gsdm, fgsdm, line); | ||
| 2066 | - List<Dlb> delDlb=mapList.get("delList"); | ||
| 2067 | - for (int i = 0; i < delDlb.size(); i++) { | ||
| 2068 | - Dlb d=delDlb.get(i); | ||
| 2069 | - dlbRepository.deleteById(d.getId()); | ||
| 2070 | - } | ||
| 2071 | - List<Dlb> updDlb=mapList.get("updList"); | ||
| 2072 | - for (int i = 0; i < updDlb.size(); i++) { | ||
| 2073 | - Dlb d=updDlb.get(i); | ||
| 2074 | - try { | ||
| 2075 | - dlbRepository.save(d); | ||
| 2076 | - } catch (Exception e) { | ||
| 2077 | - // TODO: handle exception | ||
| 2078 | - if(e.getMessage().indexOf("PK_DLB_UK")>0){ | ||
| 2079 | - newMap.put("fage", "存在相同数据,数据已经过滤"); | ||
| 2080 | - logger.info("电量存在相同数据,数据已经过滤"); | ||
| 2081 | - } | ||
| 2082 | - } | ||
| 2083 | - } | ||
| 2084 | - //重新获取电耗数据结束 | ||
| 2085 | - | ||
| 2086 | - SysUser user = SecurityUtils.getCurrentUser(); | ||
| 2087 | - Nylog nylog=new Nylog(); | ||
| 2088 | - nylog.setCreatedate(new Date()); | ||
| 2089 | - nylog.setCzmc("重新统计"); | ||
| 2090 | - nylog.setNylx("油"); | ||
| 2091 | - nylog.setUserid(user.getUserName()); | ||
| 2092 | - nylog.setUsername(user.getName()); | ||
| 2093 | - nylog.setCxtj(line+"-"+ date+"-"+gsdm+"-"+fgsdm); | ||
| 2094 | - nylogRepository.save(nylog); | ||
| 2095 | - newMap.put("status", ResponseCode.SUCCESS); | ||
| 2096 | - }catch(Exception e){ | ||
| 2097 | - // TODO Auto-generated catch block | ||
| 2098 | - newMap.put("status", ResponseCode.ERROR); | ||
| 2099 | - throw e; | ||
| 2100 | - } | ||
| 2101 | - | ||
| 2102 | - | ||
| 2103 | - return newMap; | ||
| 2104 | - } | ||
| 2105 | - | ||
| 2106 | - public List<Ylb> listByRqJcsx(String rq,String gsdm,String fgsdm,String xlbm,String nbbm) { | ||
| 2107 | - List<Ylb> list=repository.listByRqJcsx(rq, gsdm, fgsdm, xlbm, nbbm); | ||
| 2108 | - Map<String, Object> m=new HashMap<String,Object>(); | ||
| 2109 | - List<Ylb> list_=new ArrayList<Ylb>(); | ||
| 2110 | - for (int i = 0; i < list.size(); i++) { | ||
| 2111 | - Ylb t=list.get(i); | ||
| 2112 | - if(m.get(t.getNbbm())==null){ | ||
| 2113 | - m.put(t.getNbbm(), t.getNbbm()); | ||
| 2114 | - list_.add(t); | ||
| 2115 | - } | ||
| 2116 | - } | ||
| 2117 | - return list_; | ||
| 2118 | - } | ||
| 2119 | - | ||
| 2120 | - @Override | ||
| 2121 | - public Map<String, Object> update(Map<String, Object> map) { | ||
| 2122 | - if(map.get("id")!=null){ | ||
| 2123 | - if(map.get("id").toString().length()>0){ | ||
| 2124 | - Integer id=Integer.parseInt(map.get("id").toString()); | ||
| 2125 | - String jsy=map.get("jsy").toString(); | ||
| 2126 | - Ylb t=repository.findById(id).get(); | ||
| 2127 | - t.setJsy(jsy); | ||
| 2128 | - repository.save(t); | ||
| 2129 | - map.put("status", ResponseCode.SUCCESS); | ||
| 2130 | - } | ||
| 2131 | - } | ||
| 2132 | - return map; | ||
| 2133 | - } | ||
| 2134 | -} | 1 | +package com.bsth.service.oil.impl; |
| 2 | + | ||
| 3 | +import java.sql.ResultSet; | ||
| 4 | +import java.sql.SQLException; | ||
| 5 | +import java.text.DecimalFormat; | ||
| 6 | +import java.text.ParseException; | ||
| 7 | +import java.text.SimpleDateFormat; | ||
| 8 | +import java.util.ArrayList; | ||
| 9 | +import java.util.Calendar; | ||
| 10 | +import java.util.Date; | ||
| 11 | +import java.util.HashMap; | ||
| 12 | +import java.util.Iterator; | ||
| 13 | +import java.util.List; | ||
| 14 | +import java.util.Map; | ||
| 15 | + | ||
| 16 | +import javax.transaction.Transactional; | ||
| 17 | + | ||
| 18 | +import org.apache.commons.lang3.StringEscapeUtils; | ||
| 19 | +import org.apache.commons.lang3.StringUtils; | ||
| 20 | +import org.slf4j.Logger; | ||
| 21 | +import org.slf4j.LoggerFactory; | ||
| 22 | +import org.springframework.beans.factory.annotation.Autowired; | ||
| 23 | +import org.springframework.data.domain.Sort; | ||
| 24 | +import org.springframework.data.domain.Sort.Direction; | ||
| 25 | +import org.springframework.jdbc.core.JdbcTemplate; | ||
| 26 | +import org.springframework.jdbc.core.RowMapper; | ||
| 27 | +import org.springframework.stereotype.Service; | ||
| 28 | + | ||
| 29 | +import com.alibaba.fastjson.JSONArray; | ||
| 30 | +import com.alibaba.fastjson.JSONObject; | ||
| 31 | +import com.bsth.common.ResponseCode; | ||
| 32 | +import com.bsth.data.BasicData; | ||
| 33 | +import com.bsth.entity.Cars; | ||
| 34 | +import com.bsth.entity.Line; | ||
| 35 | +import com.bsth.entity.mcy_forms.Daily; | ||
| 36 | +import com.bsth.entity.oil.Cyl; | ||
| 37 | +import com.bsth.entity.oil.Dlb; | ||
| 38 | +import com.bsth.entity.oil.Nylog; | ||
| 39 | +import com.bsth.entity.oil.Ylb; | ||
| 40 | +import com.bsth.entity.oil.Ylxxb; | ||
| 41 | +import com.bsth.entity.search.CustomerSpecs; | ||
| 42 | +import com.bsth.entity.sys.SysUser; | ||
| 43 | +import com.bsth.repository.CarsRepository; | ||
| 44 | +import com.bsth.repository.LineRepository; | ||
| 45 | +import com.bsth.repository.oil.CylRepository; | ||
| 46 | +import com.bsth.repository.oil.DlbRepository; | ||
| 47 | +import com.bsth.repository.oil.NylogRepository; | ||
| 48 | +import com.bsth.repository.oil.YlbRepository; | ||
| 49 | +import com.bsth.repository.oil.YlxxbRepository; | ||
| 50 | +import com.bsth.security.util.SecurityUtils; | ||
| 51 | +import com.bsth.service.impl.BaseServiceImpl; | ||
| 52 | +import com.bsth.service.oil.DlbService; | ||
| 53 | +import com.bsth.service.oil.YlbService; | ||
| 54 | +import com.bsth.service.realcontrol.ScheduleRealInfoService; | ||
| 55 | +import com.bsth.util.Arith; | ||
| 56 | +import com.bsth.util.BatchSaveUtils; | ||
| 57 | +import com.bsth.util.ReportUtils; | ||
| 58 | +import com.github.abel533.echarts.code.Y; | ||
| 59 | + | ||
| 60 | +import javassist.bytecode.stackmap.BasicBlock.Catch; | ||
| 61 | + | ||
| 62 | +@Service | ||
| 63 | +public class YlbServiceImpl extends BaseServiceImpl<Ylb,Integer> implements YlbService{ | ||
| 64 | + @Autowired | ||
| 65 | + YlbRepository repository; | ||
| 66 | + @Autowired | ||
| 67 | + NylogRepository nylogRepository; | ||
| 68 | + @Autowired | ||
| 69 | + YlxxbRepository ylxxbRepository; | ||
| 70 | + | ||
| 71 | + @Autowired | ||
| 72 | + DlbService dlbService; | ||
| 73 | + | ||
| 74 | + @Autowired | ||
| 75 | + DlbRepository dlbRepository; | ||
| 76 | + | ||
| 77 | + @Autowired | ||
| 78 | + CylRepository cylRepository; | ||
| 79 | + | ||
| 80 | + @Autowired | ||
| 81 | + CarsRepository carsRepository; | ||
| 82 | + | ||
| 83 | + | ||
| 84 | + @Autowired | ||
| 85 | + LineRepository lineRepository; | ||
| 86 | + | ||
| 87 | + @Autowired | ||
| 88 | + ScheduleRealInfoService scheduleRealInfoService; | ||
| 89 | + | ||
| 90 | + @Autowired | ||
| 91 | + JdbcTemplate jdbcTemplate; | ||
| 92 | + | ||
| 93 | + Logger logger = LoggerFactory.getLogger(this.getClass()); | ||
| 94 | + | ||
| 95 | + private static boolean modify_rights_close = true; | ||
| 96 | + | ||
| 97 | + /** | ||
| 98 | + * 获取进存油信息 | ||
| 99 | + * @Transactional 回滚事物 | ||
| 100 | + */ | ||
| 101 | + @Transactional | ||
| 102 | + @Override | ||
| 103 | + public String obtainDsq() throws Exception{ | ||
| 104 | + String result = "failure"; | ||
| 105 | + try { | ||
| 106 | + List<Ylb> addList = new ArrayList<Ylb>(); | ||
| 107 | + String type = ""; | ||
| 108 | + List<Cars> carsList=carsRepository.findCars(); | ||
| 109 | + Map<String, Boolean> carsMap=new HashMap<String, Boolean>(); | ||
| 110 | + for (int i = 0; i < carsList.size(); i++) { | ||
| 111 | + Cars c=carsList.get(i); | ||
| 112 | + carsMap.put(c.getInsideCode(), c.getSfdc()); | ||
| 113 | + } | ||
| 114 | + SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd"); | ||
| 115 | + Date dNow = new Date(); //当前时间 | ||
| 116 | + Date dBefore = new Date(); | ||
| 117 | + Calendar calendar = Calendar.getInstance(); //得到日历 | ||
| 118 | + calendar.setTime(dNow);//把当前时间赋给日历 | ||
| 119 | + calendar.add(Calendar.DAY_OF_MONTH, -1); //设置为前一天 | ||
| 120 | + dBefore = calendar.getTime(); //得到前一天的时间 | ||
| 121 | + String rq=sdf.format(dBefore); | ||
| 122 | + //保留两位小数 | ||
| 123 | + DecimalFormat df = new DecimalFormat("#.00"); | ||
| 124 | + // TODO Auto-generated method stub | ||
| 125 | + Map<String, Object> newMap=new HashMap<String,Object>(); | ||
| 126 | + //当天YLB信息 | ||
| 127 | +// List<Ylb> ylList=repository.obtainYl(rq,"","","","","nbbm"); | ||
| 128 | + List<Ylb> ylList=this.listOrderBy(rq,"","","","","nbbm"); | ||
| 129 | + //当天YLXXB信息 | ||
| 130 | + // List<Ylxxb> ylxxList=ylxxbRepository.obtainYlxx(rq); | ||
| 131 | + //前一天所有车辆最后进场班次信息 | ||
| 132 | + List<Ylb> ylListBe=this.listByRqJcsx(rq,"","","",""); | ||
| 133 | +// List<Ylb> ylListBe=repository.listMaxRqJcsx(rq, "", "", "", ""); | ||
| 134 | + List<Cyl> clyList=cylRepository.obtainCyl("",""); | ||
| 135 | + //从排班表中计算出行驶的总里程 | ||
| 136 | + List<Map<String,Object>> listpb=scheduleRealInfoService.yesterdayDataList("", rq, "", "", "", ""); | ||
| 137 | + | ||
| 138 | + for(int x=0;x<listpb.size();x++){ | ||
| 139 | + boolean sfdc=true; | ||
| 140 | + Map<String, Object> map=listpb.get(x); | ||
| 141 | + if (carsMap.get(map.get("clZbh").toString())!=null) { | ||
| 142 | + sfdc= carsMap.get(map.get("clZbh").toString()); | ||
| 143 | + }else{ | ||
| 144 | + sfdc=true; | ||
| 145 | + } | ||
| 146 | + if(!sfdc){ | ||
| 147 | + //判断驾驶员驾驶的该车辆是否已经存入了(查出的结果集中日期是相同的,根据驾驶员、内部编号、线路编码判断) | ||
| 148 | + Ylb t=new Ylb(); | ||
| 149 | + for(int k=0;k<ylList.size();k++){ | ||
| 150 | + Ylb t1=ylList.get(k); | ||
| 151 | + if(t1.getNbbm().equals(map.get("clZbh").toString()) | ||
| 152 | + &&t1.getJsy().equals(map.get("jGh").toString()) | ||
| 153 | + &&t1.getXlbm().equals(map.get("xlBm").toString()) | ||
| 154 | + &&t1.getLp().equals(map.get("lpName").toString())) | ||
| 155 | + { | ||
| 156 | + t=t1; | ||
| 157 | + type="update"; | ||
| 158 | + } | ||
| 159 | + } | ||
| 160 | + | ||
| 161 | + //当日的第一个班次,出场油量等于前一天的最后一个班次的进场油量 | ||
| 162 | + if(map.get("seqNumber").toString().equals("1")){ | ||
| 163 | + boolean fage=true; | ||
| 164 | + for (int i = 0; i < ylListBe.size(); i++) { | ||
| 165 | + Ylb ylb=ylListBe.get(i); | ||
| 166 | + if(map.get("clZbh").toString().equals(ylb.getNbbm())){ | ||
| 167 | + if(ylb.getJzyl()!=null){ | ||
| 168 | + if(ylb.getJzyl()>=0){ | ||
| 169 | + t.setCzyl(ylb.getJzyl()); | ||
| 170 | + fage=false; | ||
| 171 | + break; | ||
| 172 | + } | ||
| 173 | + } | ||
| 174 | + | ||
| 175 | + } | ||
| 176 | + } | ||
| 177 | + if(fage){ | ||
| 178 | + for (int y = 0; y < clyList.size(); y++) { | ||
| 179 | + Cyl cyl=clyList.get(y); | ||
| 180 | + if(map.get("clZbh").toString().equals(cyl.getNbbm())){ | ||
| 181 | + if(cyl.getCyl()!=null){ | ||
| 182 | + t.setCzyl(cyl.getCyl()); | ||
| 183 | + fage=false; | ||
| 184 | + break; | ||
| 185 | + } | ||
| 186 | + } | ||
| 187 | + } | ||
| 188 | + } | ||
| 189 | + if(fage){ | ||
| 190 | + t.setCzyl(0.0); | ||
| 191 | + } | ||
| 192 | + } | ||
| 193 | + t.setNbbm(map.get("clZbh").toString()); | ||
| 194 | + t.setJsy(map.get("jGh")==null?"":map.get("jGh").toString()); | ||
| 195 | + t.setZlc(map.get("totalKilometers")==null?0.0:Double.parseDouble(map.get("totalKilometers").toString())); | ||
| 196 | + t.setXlbm(map.get("xlBm")==null?"":map.get("xlBm").toString()); | ||
| 197 | + t.setLinename(map.get("lineName")==null?"":map.get("lineName").toString()); | ||
| 198 | + t.setJcsx(Integer.parseInt(map.get("seqNumber").toString())); | ||
| 199 | + t.setSsgsdm(map.get("company")==null?"":map.get("company").toString()); | ||
| 200 | + t.setFgsdm(map.get("bCompany")==null?"":map.get("bCompany").toString()); | ||
| 201 | + t.setLp(map.get("lpName")==null?"":map.get("lpName").toString()); | ||
| 202 | + t.setJhsj(map.get("fcsj")==null?"":map.get("fcsj").toString()); | ||
| 203 | + t.setJname(map.get("jName").toString()); | ||
| 204 | + t.setRq(sdf.parse(rq)); | ||
| 205 | + t.setCreatetime(dNow); | ||
| 206 | + if(!(t.getSsgsdm().equals("") || t.getFgsdm().equals(""))){ | ||
| 207 | + if(type.equals("update")){ | ||
| 208 | + repository.save(t); | ||
| 209 | + }else{ | ||
| 210 | + addList.add(t); | ||
| 211 | + } | ||
| 212 | + } | ||
| 213 | + } | ||
| 214 | + | ||
| 215 | + } | ||
| 216 | + if(addList.size()>0){ | ||
| 217 | + try { | ||
| 218 | + new BatchSaveUtils<Ylb>().saveList2(addList, Ylb.class); | ||
| 219 | + } catch (Exception e) { | ||
| 220 | + // TODO: handle exception | ||
| 221 | + if(e.getMessage().indexOf("PK_YLB_UK")>0){ | ||
| 222 | + newMap.put("fage", "存在相同数据,数据已经过滤"); | ||
| 223 | + logger.info("定时器:存在相同数据,数据已经过滤"); | ||
| 224 | + } | ||
| 225 | + } | ||
| 226 | + } | ||
| 227 | + result = "success"; | ||
| 228 | + }catch (Exception e) { | ||
| 229 | + // TODO Auto-generated catch block | ||
| 230 | + throw e; | ||
| 231 | + }finally{ | ||
| 232 | + logger.info("setDDRB:"+result); | ||
| 233 | + } | ||
| 234 | + | ||
| 235 | + return result; | ||
| 236 | + } | ||
| 237 | + | ||
| 238 | + /** | ||
| 239 | + * 获取进存油信息 | ||
| 240 | + * @Transactional 回滚事物 | ||
| 241 | + */ | ||
| 242 | + @Transactional | ||
| 243 | + @Override | ||
| 244 | + public Map<String, Object> obtain(Map<String, Object> map2) throws Exception{ | ||
| 245 | + Map<String, Object> newMap = new HashMap<String, Object>(); | ||
| 246 | + try { | ||
| 247 | + Date date=new Date(); | ||
| 248 | + List<Cars> carsList = carsRepository.findCars(); | ||
| 249 | + Map<String, Boolean> carsMap = new HashMap<String, Boolean>(); | ||
| 250 | + for (int i = 0; i < carsList.size(); i++) { | ||
| 251 | + Cars c = carsList.get(i); | ||
| 252 | + carsMap.put(c.getInsideCode(), c.getSfdc()); | ||
| 253 | + } | ||
| 254 | + String rq = map2.get("rq").toString(); | ||
| 255 | + String line = ""; | ||
| 256 | + if (map2.get("xlbm_like") != null) { | ||
| 257 | + line = map2.get("xlbm_like").toString().trim(); | ||
| 258 | + } | ||
| 259 | + String gsbm=""; | ||
| 260 | + if(map2.get("ssgsdm_like")!=null){ | ||
| 261 | + gsbm=map2.get("ssgsdm_like").toString(); | ||
| 262 | + } | ||
| 263 | + String fgsbm=""; | ||
| 264 | + if(map2.get("fgsdm_like")!=null){ | ||
| 265 | + fgsbm=map2.get("fgsdm_like").toString(); | ||
| 266 | + } | ||
| 267 | + String nbbm=""; | ||
| 268 | + if(map2.get("nbbm_eq")!=null){ | ||
| 269 | + nbbm=map2.get("nbbm_eq").toString(); | ||
| 270 | + } | ||
| 271 | + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); | ||
| 272 | + // 保留两位小数 | ||
| 273 | + DecimalFormat df = new DecimalFormat("#.00"); | ||
| 274 | + // TODO Auto-generated method stub | ||
| 275 | + // 当天YLB信息 | ||
| 276 | + List<Ylb> ylList = this.listOrderBy(rq,gsbm,fgsbm,"",nbbm,"nbbm"); | ||
| 277 | + | ||
| 278 | + // 当天YLXXB信息 | ||
| 279 | + List<Ylxxb> ylxxList = ylxxbRepository.obtainYlxx(rq, 0,gsbm); | ||
| 280 | + | ||
| 281 | + // 前一天所有车辆最后进场班次信息 | ||
| 282 | + List<Ylb> ylListBe = this.listByRqJcsx(rq, gsbm, fgsbm, "", nbbm); | ||
| 283 | + List<Cyl> clyList = cylRepository.obtainCyl(nbbm,gsbm); | ||
| 284 | + | ||
| 285 | + // 从排班表中计算出行驶的总里程 | ||
| 286 | + List<Map<String, Object>> listpb =new ArrayList<Map<String, Object>>(); | ||
| 287 | + List<Map<String, Object>> listpbs=scheduleRealInfoService.yesterdayDataList("", rq, gsbm, fgsbm, "", nbbm); | ||
| 288 | + | ||
| 289 | + String sxtj=map2.get("sxtj").toString(); | ||
| 290 | + if(sxtj.equals("0")){ | ||
| 291 | + listpb=listpbs; | ||
| 292 | + }else if (sxtj.equals("5")){ | ||
| 293 | + List<String> stringList=new ArrayList<String>(); | ||
| 294 | + | ||
| 295 | + List<Object[]> objectLists = repository.checkNbmmFgs(rq, gsbm); | ||
| 296 | + for (int i = 0; i < objectLists.size(); i++) { | ||
| 297 | + String clbm=objectLists.get(i)[0].toString(); | ||
| 298 | + stringList.add(clbm); | ||
| 299 | + } | ||
| 300 | + | ||
| 301 | + for (int i = 0; i < stringList.size(); i++) { | ||
| 302 | + String strNbbm=stringList.get(i); | ||
| 303 | + for (int j = 0; j < listpbs.size(); j++) { | ||
| 304 | + Map<String, Object> map = listpbs.get(j); | ||
| 305 | + String mapNbbm=map.get("clZbh").toString(); | ||
| 306 | + if(strNbbm.equals(mapNbbm)){ | ||
| 307 | + listpb.add(map); | ||
| 308 | + } | ||
| 309 | + } | ||
| 310 | + } | ||
| 311 | + | ||
| 312 | + }else{ | ||
| 313 | + List<Object[]> objectLists=repository.checkNbmmNum(rq, gsbm, fgsbm, "",nbbm); | ||
| 314 | + List<String> stringList=new ArrayList<String>(); | ||
| 315 | + for (int i = 0; i < objectLists.size(); i++) { | ||
| 316 | + String clbm=objectLists.get(i)[0].toString(); | ||
| 317 | + int cs=Integer.parseInt(objectLists.get(i)[1].toString()); | ||
| 318 | + //一车一单 | ||
| 319 | + if(sxtj.equals("1")){ | ||
| 320 | + if(cs==1){ | ||
| 321 | + stringList.add(clbm); | ||
| 322 | + } | ||
| 323 | + } | ||
| 324 | + //一车多单 | ||
| 325 | + if(sxtj.equals("2")){ | ||
| 326 | + if(cs>1){ | ||
| 327 | + stringList.add(clbm); | ||
| 328 | + } | ||
| 329 | + } | ||
| 330 | + } | ||
| 331 | + | ||
| 332 | + for (int i = 0; i < stringList.size(); i++) { | ||
| 333 | + String strNbbm=stringList.get(i); | ||
| 334 | + for (int j = 0; j < listpbs.size(); j++) { | ||
| 335 | + Map<String, Object> map = listpbs.get(j); | ||
| 336 | + String mapNbbm=map.get("clZbh").toString(); | ||
| 337 | + if(strNbbm.equals(mapNbbm)){ | ||
| 338 | + listpb.add(map); | ||
| 339 | + } | ||
| 340 | + } | ||
| 341 | + } | ||
| 342 | + } | ||
| 343 | + | ||
| 344 | + List<Ylb> addList = new ArrayList<Ylb>(); | ||
| 345 | + List<Ylb> updateList = new ArrayList<Ylb>(); | ||
| 346 | + Map<String, Object> ylMap=new HashMap<String, Object>(); | ||
| 347 | + | ||
| 348 | + Map<String, Object> cMap=new HashMap<String, Object>(); | ||
| 349 | + for (int x = 0; x < listpb.size(); x++) { | ||
| 350 | + String type = "add"; | ||
| 351 | + boolean sfdc = true; | ||
| 352 | + Map<String, Object> map = listpb.get(x); | ||
| 353 | + if (carsMap.get(map.get("clZbh").toString()) != null) { | ||
| 354 | + sfdc = carsMap.get(map.get("clZbh").toString()); | ||
| 355 | + } else { | ||
| 356 | + sfdc = true; | ||
| 357 | + } | ||
| 358 | + if (!sfdc) { | ||
| 359 | + // 判断驾驶员驾驶的该车辆是否已经存入了(查出的结果集中日期是相同的,根据驾驶员、内部编号、线路编码判断) | ||
| 360 | + Ylb t = new Ylb(); | ||
| 361 | + for (int k = 0; k < ylList.size(); k++) { | ||
| 362 | + Ylb t1 = ylList.get(k); | ||
| 363 | + if (t1.getNbbm().equals(map.get("clZbh").toString()) | ||
| 364 | + && t1.getJsy().equals(map.get("jGh").toString()) | ||
| 365 | + && t1.getXlbm().equals(map.get("xlBm").toString() | ||
| 366 | + )) { | ||
| 367 | + if(t1.getLp()==null){ | ||
| 368 | + //同人同车同线路不同路牌的过滤 (考虑到历史数据) | ||
| 369 | + if (cMap.get(map.get("clZbh").toString()+map.get("jGh").toString()+map.get("xlBm").toString())==null) { | ||
| 370 | + t = t1; | ||
| 371 | + type = "update"; | ||
| 372 | + cMap.put(map.get("clZbh").toString()+map.get("jGh").toString()+map.get("xlBm").toString(), | ||
| 373 | + map.get("clZbh").toString()); | ||
| 374 | + } | ||
| 375 | + }else{ | ||
| 376 | + if(t1.getLp().equals(map.get("lpName").toString())){ | ||
| 377 | + t = t1; | ||
| 378 | + type = "update"; | ||
| 379 | + } | ||
| 380 | + | ||
| 381 | + } | ||
| 382 | + } | ||
| 383 | + } | ||
| 384 | + // 当日的第一个班次,出场油量等于前一天的最后一个班次的进场油量 | ||
| 385 | + if (map.get("seqNumber").toString().equals("1")) { | ||
| 386 | + boolean fage = true; | ||
| 387 | + if(line.equals("")){ | ||
| 388 | + for (int i = 0; i < ylListBe.size(); i++) { | ||
| 389 | + Ylb ylb = ylListBe.get(i); | ||
| 390 | + if (map.get("clZbh").toString().equals(ylb.getNbbm())) { | ||
| 391 | + if(ylb.getJzyl()>=0){ | ||
| 392 | + t.setCzyl(ylb.getJzyl()); | ||
| 393 | + fage = false; | ||
| 394 | + break; | ||
| 395 | + } | ||
| 396 | + | ||
| 397 | + } | ||
| 398 | + } | ||
| 399 | + if (fage) { | ||
| 400 | + for (int y = 0; y < clyList.size(); y++) { | ||
| 401 | + Cyl cyl = clyList.get(y); | ||
| 402 | + if (map.get("clZbh").toString().equals(cyl.getNbbm())) { | ||
| 403 | + if(cyl!=null){ | ||
| 404 | + if(cyl.getCyl()>=0){ | ||
| 405 | + t.setCzyl(cyl.getCyl()); | ||
| 406 | + fage = false; | ||
| 407 | + break; | ||
| 408 | + }else { | ||
| 409 | + if(cyl.getCxrl()!=null){ | ||
| 410 | + if(cyl.getCxrl()>0){ | ||
| 411 | + t.setCzyl(cyl.getCxrl()); | ||
| 412 | + fage = false; | ||
| 413 | + break; | ||
| 414 | + } | ||
| 415 | + } | ||
| 416 | + } | ||
| 417 | + } | ||
| 418 | + } | ||
| 419 | + } | ||
| 420 | + } | ||
| 421 | + if (fage) { | ||
| 422 | + t.setCzyl(0.0); | ||
| 423 | + } | ||
| 424 | + }else{ | ||
| 425 | + if (line.equals(map.get("xlBm").toString())) { | ||
| 426 | + for (int i = 0; i < ylListBe.size(); i++) { | ||
| 427 | + Ylb ylb = ylListBe.get(i); | ||
| 428 | + if (map.get("clZbh").toString().equals(ylb.getNbbm())) { | ||
| 429 | + if(ylb.getJzyl()>=0){ | ||
| 430 | + t.setCzyl(ylb.getJzyl()); | ||
| 431 | + fage = false; | ||
| 432 | + break; | ||
| 433 | + } | ||
| 434 | + | ||
| 435 | + } | ||
| 436 | + } | ||
| 437 | + if (fage) { | ||
| 438 | + for (int y = 0; y < clyList.size(); y++) { | ||
| 439 | + Cyl cyl = clyList.get(y); | ||
| 440 | + if (map.get("clZbh").toString().equals(cyl.getNbbm())) { | ||
| 441 | + if(cyl!=null){ | ||
| 442 | + if(cyl.getCyl()>=0){ | ||
| 443 | + t.setCzyl(cyl.getCyl()); | ||
| 444 | + fage = false; | ||
| 445 | + break; | ||
| 446 | + }else { | ||
| 447 | + if(cyl.getCxrl()!=null){ | ||
| 448 | + if(cyl.getCxrl()>0){ | ||
| 449 | + t.setCzyl(cyl.getCxrl()); | ||
| 450 | + fage = false; | ||
| 451 | + break; | ||
| 452 | + } | ||
| 453 | + } | ||
| 454 | + } | ||
| 455 | + } | ||
| 456 | + } | ||
| 457 | + } | ||
| 458 | + } | ||
| 459 | + if (fage) { | ||
| 460 | + t.setCzyl(0.0); | ||
| 461 | + } | ||
| 462 | + } | ||
| 463 | + } | ||
| 464 | + | ||
| 465 | + } | ||
| 466 | + | ||
| 467 | + Double jzl = 0.0; | ||
| 468 | + //一人一车加注量只匹配一次 | ||
| 469 | + if(ylMap.get(map.get("clZbh").toString()+"_"+ map.get("jGh").toString())==null){ | ||
| 470 | + | ||
| 471 | + boolean fage2=false; | ||
| 472 | + for (int i = 0; i < ylxxList.size(); i++) { | ||
| 473 | + Ylxxb ylxxb = ylxxList.get(i); | ||
| 474 | + if (map.get("clZbh").toString().equals(ylxxb.getNbbm()) | ||
| 475 | + && map.get("jGh").toString().equals(ylxxb.getJsy()) | ||
| 476 | + && ylxxb.getJylx()==1) { | ||
| 477 | + if(ylxxb.getJzl()>0){ | ||
| 478 | + fage2=true; | ||
| 479 | + } | ||
| 480 | + | ||
| 481 | + } | ||
| 482 | + } | ||
| 483 | + //车辆的加注量如果有任工干预,略接口过来 数据 | ||
| 484 | + if(fage2){ | ||
| 485 | + // 把当天手工输入的的YLXXB的加注量设置为当天YLB的加注量(根据车号,驾驶员判断,加油类型为1) | ||
| 486 | + for (int j = 0; j < ylxxList.size(); j++) { | ||
| 487 | + Ylxxb ylxxb = ylxxList.get(j); | ||
| 488 | + if (map.get("clZbh").toString().equals(ylxxb.getNbbm()) | ||
| 489 | + && map.get("jGh").toString().equals(ylxxb.getJsy()) | ||
| 490 | + && ylxxb.getJylx()==1) { | ||
| 491 | + jzl =Arith.add(jzl, ylxxb.getJzl()); | ||
| 492 | + } | ||
| 493 | + } | ||
| 494 | + ylMap.put(map.get("clZbh").toString()+"_"+ map.get("jGh").toString(),map.get("xlBm") == null ? "" : map.get("xlBm").toString()); | ||
| 495 | + }else{ | ||
| 496 | + // 把当天的YLXXB的加注量设置为当天YLB的加注量(根据车号,驾驶员判断) | ||
| 497 | + for (int j = 0; j < ylxxList.size(); j++) { | ||
| 498 | + Ylxxb ylxxb = ylxxList.get(j); | ||
| 499 | + if (map.get("clZbh").toString().equals(ylxxb.getNbbm()) | ||
| 500 | + && map.get("jGh").toString().equals(ylxxb.getJsy())) { | ||
| 501 | + jzl =Arith.add(jzl, ylxxb.getJzl()); | ||
| 502 | + } | ||
| 503 | + } | ||
| 504 | + ylMap.put(map.get("clZbh").toString()+"_"+ map.get("jGh").toString(),map.get("xlBm") == null ? "" : map.get("xlBm").toString()); | ||
| 505 | + } | ||
| 506 | + | ||
| 507 | + } | ||
| 508 | + t.setJzl(jzl); | ||
| 509 | + t.setNbbm(map.get("clZbh").toString()); | ||
| 510 | + t.setJsy(map.get("jGh") == null ? "" : map.get("jGh").toString()); | ||
| 511 | + t.setZlc(map.get("totalKilometers") == null ? 0.0 | ||
| 512 | + : Double.parseDouble(map.get("totalKilometers").toString())); | ||
| 513 | + t.setXlbm(map.get("xlBm") == null ? "" : map.get("xlBm").toString()); | ||
| 514 | + t.setLinename(map.get("lineName")==null?"":map.get("lineName").toString()); | ||
| 515 | + t.setJcsx(Integer.parseInt(map.get("seqNumber").toString())); | ||
| 516 | + t.setSsgsdm(map.get("company") == null ? "" : map.get("company").toString()); | ||
| 517 | + t.setFgsdm(map.get("bCompany") == null ? "" : map.get("bCompany").toString()); | ||
| 518 | + t.setJhsj(map.get("fcsj")==null?"":map.get("fcsj").toString()); | ||
| 519 | + t.setRq(sdf.parse(rq)); | ||
| 520 | + t.setLp(map.get("lpName")==null?"":map.get("lpName").toString()); | ||
| 521 | + t.setJname(map.get("jName").toString()); | ||
| 522 | + if(!(t.getSsgsdm().equals("") || t.getFgsdm().equals(""))){ | ||
| 523 | + if(type.equals("add")){ | ||
| 524 | + t.setCreatetime(date); | ||
| 525 | + addList.add(t); | ||
| 526 | + }else{ | ||
| 527 | + t.setUpdatetime(date); | ||
| 528 | + updateList.add(t); | ||
| 529 | + } | ||
| 530 | + } | ||
| 531 | +// repository.save(t); | ||
| 532 | + newMap.put("status", ResponseCode.SUCCESS); | ||
| 533 | + | ||
| 534 | + } | ||
| 535 | + } | ||
| 536 | + if(addList.size()>0){ | ||
| 537 | + try { | ||
| 538 | + new BatchSaveUtils<Ylb>().saveList2(addList, Ylb.class); | ||
| 539 | + } catch (Exception e) { | ||
| 540 | + // TODO: handle exception | ||
| 541 | + if(e.getMessage().indexOf("PK_YLB_UK")>0){ | ||
| 542 | + newMap.put("fage", "存在相同数据,数据已经过滤"); | ||
| 543 | + logger.info("获取:存在相同数据,数据已经过滤"); | ||
| 544 | + } | ||
| 545 | + } | ||
| 546 | + | ||
| 547 | + } | ||
| 548 | + if(updateList.size()>0){ | ||
| 549 | + for (int i = 0; i < updateList.size(); i++) { | ||
| 550 | + repository.save(updateList.get(i)); | ||
| 551 | + } | ||
| 552 | + } | ||
| 553 | + SysUser user = SecurityUtils.getCurrentUser(); | ||
| 554 | + Nylog nylog=new Nylog(); | ||
| 555 | + nylog.setCreatedate(new Date()); | ||
| 556 | + nylog.setCzmc("获取加存油"); | ||
| 557 | + nylog.setNylx("油"); | ||
| 558 | + nylog.setUserid(user.getUserName()); | ||
| 559 | + nylog.setUsername(user.getName()); | ||
| 560 | + nylog.setCxtj(rq+"-"+gsbm+"-"+fgsbm+"-"+line+"-"+nbbm+"-"+sxtj); | ||
| 561 | + nylogRepository.save(nylog); | ||
| 562 | + newMap.put("status", ResponseCode.SUCCESS); | ||
| 563 | + } catch (Exception e) { | ||
| 564 | + // TODO Auto-generated catch block | ||
| 565 | + newMap.put("status", ResponseCode.ERROR); | ||
| 566 | + throw e; | ||
| 567 | + } | ||
| 568 | + | ||
| 569 | + return newMap; | ||
| 570 | + } | ||
| 571 | + | ||
| 572 | + | ||
| 573 | + /** | ||
| 574 | + * 进场等于出场 | ||
| 575 | + */ | ||
| 576 | + @Transactional | ||
| 577 | + @Override | ||
| 578 | + public Map<String, Object> outAndIn(Map<String, Object> map) throws Exception{ | ||
| 579 | + // TODO Auto-generated method stub | ||
| 580 | + String xlbm=""; | ||
| 581 | + if(map.get("xlbm_like")!=null){ | ||
| 582 | + xlbm= map.get("xlbm_like").toString().trim(); | ||
| 583 | + } | ||
| 584 | + String gsbm=""; | ||
| 585 | + if(map.get("ssgsdm_like")!=null){ | ||
| 586 | + gsbm=map.get("ssgsdm_like").toString(); | ||
| 587 | + } | ||
| 588 | + String fgsbm=""; | ||
| 589 | + if(map.get("fgsdm_like")!=null){ | ||
| 590 | + fgsbm=map.get("fgsdm_like").toString(); | ||
| 591 | + } | ||
| 592 | + String rq = map.get("rq").toString(); | ||
| 593 | + String nbbm=""; | ||
| 594 | + if(map.get("nbbm_eq")!=null){ | ||
| 595 | + nbbm=map.get("nbbm_eq").toString(); | ||
| 596 | + } | ||
| 597 | + | ||
| 598 | + Map<String, Object> newMap=new HashMap<String,Object>(); | ||
| 599 | + Map<String, Object> map2=new HashMap<String,Object>(); | ||
| 600 | + try { | ||
| 601 | + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); | ||
| 602 | + | ||
| 603 | + map.put("rq_eq", sdf.parse(rq)); | ||
| 604 | +// List<Cyl> clyList = cylRepository.obtainCyl(); | ||
| 605 | + // 获取车辆存油信息 | ||
| 606 | + List<Cyl> cylList = cylRepository.obtainCyl(nbbm,gsbm); | ||
| 607 | + // 指定日期YLB信息 | ||
| 608 | + List<Ylb> ylbList =new ArrayList<Ylb>(); | ||
| 609 | + List<Ylb> ylbLists =new ArrayList<Ylb>(); | ||
| 610 | + List<Ylb> iterator2=new ArrayList<Ylb>(); | ||
| 611 | + ylbLists=this.listOrderBy(rq,gsbm,fgsbm,xlbm,nbbm,"jcsx"); | ||
| 612 | + iterator2=this.listOrderBy(rq,gsbm,fgsbm,xlbm,nbbm,"nbbm,jcsx"); | ||
| 613 | + // 从排班表中计算出行驶的总里程 | ||
| 614 | + | ||
| 615 | + String sxtj=map.get("sxtj").toString(); | ||
| 616 | + if(sxtj.equals("0")){ | ||
| 617 | + ylbList=ylbLists; | ||
| 618 | + }else{ | ||
| 619 | + List<Object[]> objectLists=repository.checkNbmmNum(rq, gsbm, fgsbm, xlbm,nbbm); | ||
| 620 | + List<String> stringList=new ArrayList<String>(); | ||
| 621 | + for (int i = 0; i < objectLists.size(); i++) { | ||
| 622 | + String clbm=objectLists.get(i)[0].toString(); | ||
| 623 | + int cs=Integer.parseInt(objectLists.get(i)[1].toString()); | ||
| 624 | + //一车一单 | ||
| 625 | + if(sxtj.equals("1")){ | ||
| 626 | + if(cs==1){ | ||
| 627 | + stringList.add(clbm); | ||
| 628 | + } | ||
| 629 | + } | ||
| 630 | + //一车多单 | ||
| 631 | + if(sxtj.equals("2")){ | ||
| 632 | + if(cs>1){ | ||
| 633 | + stringList.add(clbm); | ||
| 634 | + } | ||
| 635 | + } | ||
| 636 | + } | ||
| 637 | + | ||
| 638 | + for (int i = 0; i < stringList.size(); i++) { | ||
| 639 | + String strNbbm=stringList.get(i); | ||
| 640 | + for (int j = 0; j < ylbLists.size(); j++) { | ||
| 641 | + Ylb y = ylbLists.get(j); | ||
| 642 | + String mapNbbm=y.getNbbm(); | ||
| 643 | + if(strNbbm.equals(mapNbbm)){ | ||
| 644 | + ylbList.add(y); | ||
| 645 | + } | ||
| 646 | + } | ||
| 647 | + } | ||
| 648 | + } | ||
| 649 | + | ||
| 650 | + for (int i=0;i<ylbList.size();i++) { | ||
| 651 | + Ylb ylb = ylbList.get(i); | ||
| 652 | + // 判断是否已经计算过 | ||
| 653 | + if (newMap.get("nbbm" + ylb.getNbbm()) == null) { | ||
| 654 | + String nbbm_eq = ylb.getNbbm(); | ||
| 655 | + Date rq_eq = ylb.getRq(); | ||
| 656 | + // 得到一天总的加油和里程(根据车,时间) | ||
| 657 | + List<Object[]> sumList = repository.sumLcYl(nbbm_eq, rq_eq,"",gsbm,fgsbm); | ||
| 658 | + // 保存总的加油量 | ||
| 659 | + Double jzl = 0.0; | ||
| 660 | + // 保存总的里程 | ||
| 661 | + Double zlc = 0.0; | ||
| 662 | + //保存总的损耗 | ||
| 663 | + Double zsh = 0.0; | ||
| 664 | + for (int j = 0; j < sumList.size(); j++) { | ||
| 665 | + jzl = Arith.add(jzl, Double.valueOf(sumList.get(j)[0].toString())); | ||
| 666 | + zlc = Arith.add(zlc, Double.valueOf(sumList.get(j)[1].toString())); | ||
| 667 | + zsh = Arith.add(zsh, Double.valueOf(sumList.get(j)[2].toString())); | ||
| 668 | + } | ||
| 669 | +// jzl = Arith.sub(jzl, zsh); | ||
| 670 | + // 保留两位小数 | ||
| 671 | + DecimalFormat df = new DecimalFormat("#.00"); | ||
| 672 | + Double zyl = 0.0; | ||
| 673 | + Double nextJzyl = 0.0; | ||
| 674 | + // 保存已经计算过的车辆,相同车辆编号的车不在计算 | ||
| 675 | + newMap.put("nbbm" + ylb.getNbbm(), ylb.getNbbm()); | ||
| 676 | + | ||
| 677 | + // 查询指定车辆,设置进、存、耗油量 | ||
| 678 | + map.remove("nbbm_eq"); | ||
| 679 | + map.put("nbbm_eq", ylb.getNbbm()); | ||
| 680 | + map.put("xlbm_like", ylb.getXlbm()); | ||
| 681 | +// Iterator<Ylb> iterator2 = repository | ||
| 682 | +// .findAll(new CustomerSpecs<Ylb>(map), new Sort(Direction.ASC, "jcsx")).iterator(); | ||
| 683 | + double czyl=0.0; | ||
| 684 | + for (int j = 0; j < iterator2.size(); j++) { | ||
| 685 | + Ylb t = iterator2.get(j); | ||
| 686 | + if(t.getNbbm().equals(ylb.getNbbm())){ | ||
| 687 | + if (t.getJcsx() == 1) { | ||
| 688 | + // 进场等于出场的操作 既 最后进场存油量等于第一次的出场存油量 | ||
| 689 | +// Double yl = t.getCzyl(); | ||
| 690 | +// Double jcyl = t.getCzyl(); | ||
| 691 | + czyl = t.getCzyl(); | ||
| 692 | + zyl =jzl; | ||
| 693 | + Double yh=0.0; | ||
| 694 | + if(zlc>0 ){ | ||
| 695 | + yh = Double.parseDouble(df.format(zyl * (t.getZlc() / zlc))); | ||
| 696 | + } | ||
| 697 | + nextJzyl =Arith.sub( Arith.add(t.getJzl(), t.getCzyl()),yh); | ||
| 698 | +// nextJzyl =Arith.sub( Arith.add(Arith.sub(t.getJzl(),t.getSh()), t.getCzyl()),yh); | ||
| 699 | + //把进场油量的小数和整数分别取出 | ||
| 700 | +// int ylxs=(int) nextJzyl; 10.6--11 10.3--10 | ||
| 701 | + if(zlc>0 && t.getZlc()>0){ | ||
| 702 | + long l=Math.round(nextJzyl); | ||
| 703 | + double ylxs=l*100/100; | ||
| 704 | +// nextJzyl = Arith.add(nextJzyl,Arith.sub(nextJzyl,ylxs)); | ||
| 705 | + yh=Arith.add(yh, Arith.sub(nextJzyl,ylxs)); | ||
| 706 | + t.setYh(yh); | ||
| 707 | + t.setJzyl(ylxs); | ||
| 708 | + nextJzyl=ylxs; | ||
| 709 | + }else{ | ||
| 710 | + t.setYh(yh); | ||
| 711 | + t.setJzyl(nextJzyl); | ||
| 712 | + } | ||
| 713 | + } else { | ||
| 714 | + t.setCzyl(nextJzyl); | ||
| 715 | + Double yh=0.0; | ||
| 716 | + if(zlc>0){ | ||
| 717 | + yh= Double.parseDouble(df.format(zyl * (t.getZlc() / zlc))); | ||
| 718 | + } | ||
| 719 | + nextJzyl =Arith.sub( Arith.add(t.getJzl(),nextJzyl),yh); | ||
| 720 | +// nextJzyl =Arith.sub( Arith.add(Arith.sub(t.getJzl(),t.getSh()),nextJzyl),yh); | ||
| 721 | + if(zlc>0 && t.getZlc()>0){ | ||
| 722 | + long l=0l; | ||
| 723 | + double ylxs=0.0; | ||
| 724 | + if(j==iterator2.size()-1){ | ||
| 725 | + ylxs=czyl; | ||
| 726 | + }else{ | ||
| 727 | + if(iterator2.get(j+1).getNbbm().equals(t.getNbbm())){ | ||
| 728 | + l=Math.round(nextJzyl); | ||
| 729 | + ylxs=l*100/100; | ||
| 730 | + }else{ | ||
| 731 | + ylxs=czyl; | ||
| 732 | + } | ||
| 733 | + | ||
| 734 | + } | ||
| 735 | + yh=Arith.add(yh, Arith.sub(nextJzyl,ylxs)); | ||
| 736 | +// nextJzyl = Arith.add(nextJzyl,Arith.sub(nextJzyl,ylxs)); | ||
| 737 | + | ||
| 738 | + t.setYh(yh); | ||
| 739 | + t.setJzyl(ylxs); | ||
| 740 | + nextJzyl=ylxs; | ||
| 741 | + }else{ | ||
| 742 | + t.setYh(yh); | ||
| 743 | + t.setJzyl(nextJzyl); | ||
| 744 | + } | ||
| 745 | + } | ||
| 746 | + if(t.getJzyl()<0){ | ||
| 747 | + t.setJzyl(0.0); | ||
| 748 | + } | ||
| 749 | + if(t.getCzyl()<0){ | ||
| 750 | + t.setCzyl(0.0); | ||
| 751 | + } | ||
| 752 | + if(t.getYh()<0){ | ||
| 753 | + t.setYh(0.0); | ||
| 754 | + } | ||
| 755 | + if(t.getSh()<0){ | ||
| 756 | + t.setSh(0.0); | ||
| 757 | + } | ||
| 758 | + repository.save(t); | ||
| 759 | + } | ||
| 760 | + map2.put("status", ResponseCode.SUCCESS); | ||
| 761 | + } | ||
| 762 | + } | ||
| 763 | + } | ||
| 764 | + | ||
| 765 | + SysUser user = SecurityUtils.getCurrentUser(); | ||
| 766 | + Nylog nylog=new Nylog(); | ||
| 767 | + nylog.setCreatedate(new Date()); | ||
| 768 | + nylog.setCzmc("进场等于出场"); | ||
| 769 | + nylog.setNylx("油"); | ||
| 770 | + nylog.setUserid(user.getUserName()); | ||
| 771 | + nylog.setUsername(user.getName()); | ||
| 772 | + nylog.setCxtj(rq+"-"+gsbm+"-"+fgsbm+"-"+xlbm+"-"+nbbm+"-"+sxtj); | ||
| 773 | + | ||
| 774 | + nylogRepository.save(nylog); | ||
| 775 | + } catch (Exception e) { | ||
| 776 | + map2.put("status", ResponseCode.ERROR); | ||
| 777 | + logger.error("save erro.", e); | ||
| 778 | + throw e; | ||
| 779 | + } | ||
| 780 | + return map2; | ||
| 781 | + } | ||
| 782 | + | ||
| 783 | + | ||
| 784 | + /** | ||
| 785 | + * 核对,有加注没里程 | ||
| 786 | + * @param map | ||
| 787 | + * @return | ||
| 788 | + */ | ||
| 789 | + @Transactional | ||
| 790 | + @Override | ||
| 791 | + public Map<String, Object> checkYl(Map<String, Object> map) throws Exception{ | ||
| 792 | + Map<String, Object> newMap=new HashMap<String,Object>(); | ||
| 793 | +// String xlbm=""; | ||
| 794 | +// if(map.get("xlbm_like")!=null){ | ||
| 795 | +// xlbm=map.get("xlbm_like").toString(); | ||
| 796 | +// } | ||
| 797 | + // TODO Auto-generated method stub | ||
| 798 | + | ||
| 799 | + List<Cars> carsList = carsRepository.findCars(); | ||
| 800 | + Map<String, String> carsMap = new HashMap<String, String>(); | ||
| 801 | + for (int i = 0; i < carsList.size(); i++) { | ||
| 802 | + Cars c = carsList.get(i); | ||
| 803 | + carsMap.put(c.getInsideCode(), c.getBrancheCompanyCode()==null?"":c.getBrancheCompanyCode()); | ||
| 804 | + } | ||
| 805 | + | ||
| 806 | + try{ | ||
| 807 | + //获取车辆存油信息 | ||
| 808 | + | ||
| 809 | + String rq=map.get("rq").toString(); | ||
| 810 | + String xlbm=""; | ||
| 811 | + if(map.get("xlbm_like")!=null){ | ||
| 812 | + xlbm= map.get("xlbm_like").toString().trim(); | ||
| 813 | + } | ||
| 814 | + String gsbm=""; | ||
| 815 | + if(map.get("ssgsdm_like")!=null){ | ||
| 816 | + gsbm=map.get("ssgsdm_like").toString(); | ||
| 817 | + } | ||
| 818 | + String fgsbm=""; | ||
| 819 | + if(map.get("fgsdm_like")!=null){ | ||
| 820 | + fgsbm=map.get("fgsdm_like").toString(); | ||
| 821 | + } | ||
| 822 | + String nbbm=""; | ||
| 823 | + if(map.get("nbbm_eq")!=null){ | ||
| 824 | + nbbm=map.get("nbbm_eq").toString(); | ||
| 825 | + } | ||
| 826 | +// List<Ylb> ylListBe=repository.obtainYlbefore(rq, gsbm, "", xlbm, nbbm); | ||
| 827 | + List<Ylb> ylListBe=this.listByRqJcsx(rq, gsbm, fgsbm, "", nbbm); | ||
| 828 | + List<Ylb> ylbList=this.listOrderBy(rq,gsbm,fgsbm,xlbm,nbbm,"nbbm"); | ||
| 829 | +// repository.obtainYl(rq,gsbm,fgsbm,xlbm,nbbm,"nbbm"); | ||
| 830 | +// List<Ylxxb> ylxxbList=ylxxbRepository.obtainYlxx(rq,0,gsbm); | ||
| 831 | + String sql="select * from bsth_c_ylxxb where yyrq='"+rq+"' " | ||
| 832 | + + " and gsdm ='"+gsbm+"' and nylx ='0' and nbbm " | ||
| 833 | + + " not in ( select nbbm from bsth_c_ylb " | ||
| 834 | + + " where rq='"+rq+"' " | ||
| 835 | + + " and ssgsdm='"+gsbm+"' and fgsdm ='"+fgsbm+"')" | ||
| 836 | + + " and nbbm in (select inside_code from " | ||
| 837 | + + " bsth_c_cars where business_code ='"+gsbm+"' " | ||
| 838 | + + " and branche_company_code='"+fgsbm+"')"; | ||
| 839 | + | ||
| 840 | + List<Ylxxb> ylxxbList=jdbcTemplate.query(sql, | ||
| 841 | + new RowMapper<Ylxxb>(){ | ||
| 842 | + @Override | ||
| 843 | + public Ylxxb mapRow(ResultSet rs, int rowNum) throws SQLException { | ||
| 844 | + Ylxxb s = new Ylxxb(); | ||
| 845 | + s.setId(rs.getInt("id")); | ||
| 846 | + s.setYyrq(rs.getDate("yyrq")); | ||
| 847 | + s.setNbbm(rs.getString("nbbm")); | ||
| 848 | + s.setGsdm(rs.getString("gsdm")); | ||
| 849 | + s.setFgsdm(rs.getString("fgsdm")); | ||
| 850 | + s.setJsy(rs.getString("jsy")); | ||
| 851 | + s.setJzl(rs.getDouble("jzl")); | ||
| 852 | + s.setStationid(rs.getString("stationid")); | ||
| 853 | + s.setNylx(rs.getInt("nylx")); | ||
| 854 | + s.setJyggh(rs.getString("jyggh")); | ||
| 855 | + s.setYj(rs.getDouble("yj")); | ||
| 856 | +// s.setLdgh(rs.getString("ldgh")); | ||
| 857 | + s.setBz(rs.getString("bz")); | ||
| 858 | + return s; | ||
| 859 | + } | ||
| 860 | + }); | ||
| 861 | + Map<String, Object> m=new HashMap<String,Object>(); | ||
| 862 | + for (int i = 0; i < ylxxbList.size(); i++) { | ||
| 863 | + Boolean fage=false; | ||
| 864 | + Ylxxb y1=ylxxbList.get(i); | ||
| 865 | + if(m.get(y1.getNbbm())==null){ | ||
| 866 | + Line line=BasicData.nbbm2LineMap.get(y1.getNbbm()); | ||
| 867 | + if(null !=line){ | ||
| 868 | + if(!xlbm.equals("")){ | ||
| 869 | + if(line.getLineCode().equals(xlbm)){ | ||
| 870 | + fage=true; | ||
| 871 | + } | ||
| 872 | + }else{ | ||
| 873 | + fage=true; | ||
| 874 | + } | ||
| 875 | + } | ||
| 876 | + | ||
| 877 | + if(fage){ | ||
| 878 | + Ylb t=new Ylb(); | ||
| 879 | + t.setNbbm(y1.getNbbm()); | ||
| 880 | + t.setRq(y1.getYyrq()); | ||
| 881 | + t.setJsy(y1.getJsy()); | ||
| 882 | + t.setJname(BasicData.allPerson.get(y1.getGsdm()+"-"+y1.getJsy())); | ||
| 883 | + t.setJzl(y1.getJzl()); | ||
| 884 | + t.setSsgsdm(y1.getGsdm()); | ||
| 885 | + String fgsdm=""; | ||
| 886 | + if(null !=carsMap.get(y1.getNbbm())){ | ||
| 887 | + fgsdm=carsMap.get(y1.getNbbm()); | ||
| 888 | + } | ||
| 889 | + t.setFgsdm(fgsdm); | ||
| 890 | + t.setJcsx(1); | ||
| 891 | + if(null !=line){ | ||
| 892 | + t.setXlbm(line.getLineCode()); | ||
| 893 | + }else{ | ||
| 894 | + t.setXlbm(""); | ||
| 895 | + } | ||
| 896 | + t.setJcsx(1); | ||
| 897 | + boolean status=true; | ||
| 898 | + for (int j = 0; j < ylListBe.size(); j++) { | ||
| 899 | + Ylb b=ylListBe.get(j); | ||
| 900 | + if(b.getNbbm().equals(y1.getNbbm())){ | ||
| 901 | + t.setCzyl(b.getJzyl()); | ||
| 902 | + status=false; | ||
| 903 | + break; | ||
| 904 | + } | ||
| 905 | + } | ||
| 906 | + if(status){ | ||
| 907 | + t.setCzyl(0.0); | ||
| 908 | + } | ||
| 909 | + t.setJzyl(Arith.add(t.getJzl(), t.getCzyl())); | ||
| 910 | + t.setYh(0.0); | ||
| 911 | + if(!(t.getSsgsdm().equals("") || t.getFgsdm().equals(""))){ | ||
| 912 | + t.setCreatetime(new Date()); | ||
| 913 | + try { | ||
| 914 | + repository.save(t); | ||
| 915 | + m.put(t.getName(), t.getName()); | ||
| 916 | + } catch (Exception e) { | ||
| 917 | + // TODO: handle exception | ||
| 918 | + if(e.getMessage().indexOf("PK_YLB_UK")>0){ | ||
| 919 | + newMap.put("fage", "存在相同数据,数据已经过滤"); | ||
| 920 | + logger.info("核对有存油没里程:存在相同数据,数据已经过滤"); | ||
| 921 | + } | ||
| 922 | + } | ||
| 923 | + } | ||
| 924 | + } | ||
| 925 | + } | ||
| 926 | + } | ||
| 927 | + | ||
| 928 | + SysUser user = SecurityUtils.getCurrentUser(); | ||
| 929 | + Nylog nylog=new Nylog(); | ||
| 930 | + nylog.setCreatedate(new Date()); | ||
| 931 | + nylog.setCzmc("核对加注量"); | ||
| 932 | + nylog.setNylx("油"); | ||
| 933 | + nylog.setUserid(user.getUserName()); | ||
| 934 | + nylog.setUsername(user.getName()); | ||
| 935 | + nylog.setCxtj(rq+"-"+gsbm+"-"+fgsbm+"-"+xlbm+"-"+nbbm+"-"); | ||
| 936 | + nylogRepository.save(nylog); | ||
| 937 | + newMap.put("status", ResponseCode.SUCCESS); | ||
| 938 | + }catch(Exception e){ | ||
| 939 | + newMap.put("status", ResponseCode.ERROR); | ||
| 940 | + logger.error("save erro.", e); | ||
| 941 | + throw e; | ||
| 942 | + } | ||
| 943 | + | ||
| 944 | + return newMap; | ||
| 945 | + } | ||
| 946 | + | ||
| 947 | + | ||
| 948 | + @Override | ||
| 949 | + public List<Map<String, Object>> oilListMonth(Map<String, Object> map) { | ||
| 950 | + SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"), | ||
| 951 | + sdfSimple = new SimpleDateFormat("yyyyMMdd"); | ||
| 952 | + | ||
| 953 | + String type=map.get("type").toString(); | ||
| 954 | + String date=map.get("date").toString().trim(); | ||
| 955 | + String gsdm=map.get("gsdm").toString(); | ||
| 956 | + String fgsdm=map.get("fgsdm").toString(); | ||
| 957 | + String date2=date.substring(0, 8)+"01"; | ||
| 958 | + String lineStr=""; | ||
| 959 | + String line =map.get("line").toString().trim(); | ||
| 960 | + /*if(line !=null && !line.equals("")){ | ||
| 961 | + lineStr =" and xlbm= '"+ line +"'"; | ||
| 962 | + }else{ | ||
| 963 | + lineStr =" and ssgsdm='"+gsdm+"' and fgsdm ='"+fgsdm+"' "; | ||
| 964 | + } | ||
| 965 | + String sql="select a.nbbm,a.rq,a.jzyl from (" + | ||
| 966 | + " select x.nbbm,max(x.rq) as rq,max(x.jcsx) as jcsx from " | ||
| 967 | + + "(select nbbm,rq,max(jcsx) as jcsx from bsth_c_ylb where rq between '" | ||
| 968 | + + date2 +"' and '" + date+"' "+lineStr | ||
| 969 | + + " group by nbbm,rq) x group by x.nbbm ) b" | ||
| 970 | + + " left join (select nbbm,rq,jzyl,jcsx FROM bsth_c_ylb " | ||
| 971 | + + " where rq between '" | ||
| 972 | + + date2 +"' and '" + date+"' "+lineStr | ||
| 973 | + + ") a " | ||
| 974 | + + " on a.nbbm =b.nbbm and a.jcsx=b.jcsx and a.rq=b.rq " | ||
| 975 | + + " where a.nbbm is not null order by a.nbbm"; | ||
| 976 | + | ||
| 977 | + // TODO Auto-generated method stub | ||
| 978 | + List<Ylb> list =jdbcTemplate.query(sql, | ||
| 979 | + new RowMapper<Ylb>(){ | ||
| 980 | + @Override | ||
| 981 | + public Ylb mapRow(ResultSet rs, int rowNum) throws SQLException { | ||
| 982 | + Ylb s = new Ylb(); | ||
| 983 | + s.setNbbm(rs.getString("nbbm")); | ||
| 984 | + s.setRq(rs.getDate("rq")); | ||
| 985 | + s.setJzyl(rs.getDouble("jzyl")); | ||
| 986 | + return s; | ||
| 987 | + } | ||
| 988 | + }); */ | ||
| 989 | + | ||
| 990 | + double qtyy=0.0;//其他用油 | ||
| 991 | + double cdyy=0.0;//车队用油 | ||
| 992 | + double byyy=0.0;//保养用油 | ||
| 993 | + double cjxx=0.0;//车间小修 | ||
| 994 | + double cjgb=0.0;//车间高保 | ||
| 995 | + double fyyyhj=0.0;//非营运用油合计 | ||
| 996 | + List<Ylb> listYlb=repository.listByMonthJcsx(date2, date, gsdm, fgsdm, line); | ||
| 997 | + | ||
| 998 | + Map<String, Object> ms=new HashMap<String,Object>(); | ||
| 999 | + List<Ylb> list=new ArrayList<Ylb>(); | ||
| 1000 | + for (int i = 0; i < listYlb.size(); i++) { | ||
| 1001 | + Ylb t=listYlb.get(i); | ||
| 1002 | + fyyyhj =Arith.add(fyyyhj, t.getSh()); | ||
| 1003 | + if(t.getShyy()==null){ | ||
| 1004 | + qtyy=Arith.add(qtyy, t.getSh()); | ||
| 1005 | + }else{ | ||
| 1006 | + if(t.getShyy().equals("6")){ | ||
| 1007 | + cdyy=Arith.add(cdyy, t.getSh()); | ||
| 1008 | + }else if(t.getShyy().equals("2")){ | ||
| 1009 | + byyy=Arith.add(byyy, t.getSh()); | ||
| 1010 | + }else if(t.getShyy().equals("7")){ | ||
| 1011 | + cjxx=Arith.add(cjxx, t.getSh()); | ||
| 1012 | + }else if(t.getShyy().equals("8")){ | ||
| 1013 | + cjgb=Arith.add(cjgb, t.getSh()); | ||
| 1014 | + }else{ | ||
| 1015 | + qtyy=Arith.add(qtyy, t.getSh()); | ||
| 1016 | + } | ||
| 1017 | + } | ||
| 1018 | + if(ms.get(t.getNbbm())==null){ | ||
| 1019 | + ms.put(t.getNbbm(), t.getNbbm()); | ||
| 1020 | + list.add(t); | ||
| 1021 | + } | ||
| 1022 | + } | ||
| 1023 | + | ||
| 1024 | + List<Map<String, Object>> mapList = new ArrayList<Map<String, Object>>(); | ||
| 1025 | + int size = 0; | ||
| 1026 | + Map<String, Object> m_ = new HashMap<String, Object>(); | ||
| 1027 | + double ycyhj=0.0; | ||
| 1028 | + for(Ylb ylb : list){ | ||
| 1029 | + ycyhj=Arith.add(ycyhj, ylb.getJzyl()); | ||
| 1030 | + int x=size%3; | ||
| 1031 | + if(x==0 && size>0){ | ||
| 1032 | + mapList.add(m_); | ||
| 1033 | + m_ = new HashMap<String, Object>(); | ||
| 1034 | + } | ||
| 1035 | + size++; | ||
| 1036 | + m_.put("xh"+x, size); | ||
| 1037 | + m_.put("nbbm"+x, ylb.getNbbm()!=null?ylb.getNbbm():""); | ||
| 1038 | + m_.put("rq"+x, ylb.getRq()!=null?sdfMonth.format(ylb.getRq()):""); | ||
| 1039 | + m_.put("jzyl"+x, ylb.getJzyl()!=null?ylb.getJzyl():""); | ||
| 1040 | + | ||
| 1041 | + } | ||
| 1042 | + if(m_.get("nbbm0")!=null){ | ||
| 1043 | + if(m_.get("nbbm1")==null){ | ||
| 1044 | + m_.put("xh1", ""); | ||
| 1045 | + m_.put("nbbm1" , ""); | ||
| 1046 | + m_.put("rq1" , ""); | ||
| 1047 | + m_.put("jzyl1" , ""); | ||
| 1048 | + } | ||
| 1049 | + if(m_.get("nbbm2")==null){ | ||
| 1050 | + m_.put("xh2", ""); | ||
| 1051 | + m_.put("nbbm2" , ""); | ||
| 1052 | + m_.put("rq2" , ""); | ||
| 1053 | + m_.put("jzyl2" , ""); | ||
| 1054 | + } | ||
| 1055 | + mapList.add(m_); | ||
| 1056 | + } | ||
| 1057 | + | ||
| 1058 | + if(type != null && type.equals("export")){ | ||
| 1059 | + List<Iterator<?>> listI = new ArrayList<Iterator<?>>(); | ||
| 1060 | + Map<String, Object> m = new HashMap<String, Object>(); | ||
| 1061 | + m.put("ycyhj", ycyhj); | ||
| 1062 | + m.put("qtyy", qtyy); | ||
| 1063 | + m.put("cdyy", cdyy); | ||
| 1064 | + m.put("byyy", byyy); | ||
| 1065 | + m.put("cjxx", cjxx); | ||
| 1066 | + m.put("cjgb", cjgb); | ||
| 1067 | + m.put("fyyyhj", fyyyhj); | ||
| 1068 | + ReportUtils ee = new ReportUtils(); | ||
| 1069 | + try { | ||
| 1070 | + String lineName = ""; | ||
| 1071 | + if(map.containsKey("lineName")) | ||
| 1072 | + lineName = map.get("lineName").toString(); | ||
| 1073 | + listI.add(mapList.iterator()); | ||
| 1074 | + String path = this.getClass().getResource("/").getPath()+"static/pages/forms/"; | ||
| 1075 | + ee.excelReplace(listI, new Object[] { m }, path+"mould/oilListMonth.xls", | ||
| 1076 | + path+"export/" + sdfSimple.format(sdfMonth.parse(date)) | ||
| 1077 | + + "-" + lineName + "-月存油报表.xls"); | ||
| 1078 | + } catch (Exception e) { | ||
| 1079 | + // TODO: handle exception | ||
| 1080 | + e.printStackTrace(); | ||
| 1081 | + } | ||
| 1082 | + }else{ | ||
| 1083 | + m_=new HashMap<String,Object>(); | ||
| 1084 | + m_.put("xh0", "99"); | ||
| 1085 | + m_.put("nbbm0", "存油合计:"+ycyhj +" 非营运用油: 其他用油:"+qtyy +",车队:"+cdyy+",保养用油:"+byyy | ||
| 1086 | + +",车间(小修):"+cjxx+",车间(高保):"+cjgb+",非营运用油合计:"+fyyyhj); | ||
| 1087 | + mapList.add(m_); | ||
| 1088 | + } | ||
| 1089 | + | ||
| 1090 | + return mapList; | ||
| 1091 | + } | ||
| 1092 | + | ||
| 1093 | + @Override | ||
| 1094 | + public StringBuffer checkNbmmNum(String rq, String gsbm, String fgsbm, String xlbm,String nbbm,int lx) { | ||
| 1095 | + StringBuffer stringList =new StringBuffer(); | ||
| 1096 | + List<Object[]> objectList=repository.checkNbmmNum(rq, gsbm, fgsbm, xlbm,nbbm); | ||
| 1097 | + for (int i = 0; i < objectList.size(); i++) { | ||
| 1098 | + String clbm=objectList.get(i)[0].toString()+","; | ||
| 1099 | + int cs=Integer.parseInt(objectList.get(i)[1].toString()); | ||
| 1100 | + //一车一单 | ||
| 1101 | + if(lx==1){ | ||
| 1102 | + if(cs==1){ | ||
| 1103 | + stringList.append(clbm); | ||
| 1104 | + } | ||
| 1105 | + } | ||
| 1106 | + //一车多单 | ||
| 1107 | + if(lx==2){ | ||
| 1108 | + if(cs>1){ | ||
| 1109 | + stringList.append(clbm); | ||
| 1110 | + } | ||
| 1111 | + | ||
| 1112 | + } | ||
| 1113 | + } | ||
| 1114 | + return stringList; | ||
| 1115 | + } | ||
| 1116 | + | ||
| 1117 | + | ||
| 1118 | + | ||
| 1119 | + @Override | ||
| 1120 | + public Map<String, Object> sumYlb(Map<String, Object> map) { | ||
| 1121 | + // TODO Auto-generated method stub | ||
| 1122 | + List<String> stringList=new ArrayList<String>(); | ||
| 1123 | + String rq=map.get("rq").toString(); | ||
| 1124 | + String gsbm=map.get("ssgsdm_like").toString(); | ||
| 1125 | + String fgsbm=map.get("fgsdm_like").toString(); | ||
| 1126 | + String xlbm=map.get("xlbm_like").toString().trim(); | ||
| 1127 | + String nbbm=map.get("nbbm_eq").toString(); | ||
| 1128 | + String sxtj=map.get("sxtj").toString(); | ||
| 1129 | + String type=map.get("type").toString(); | ||
| 1130 | + SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); | ||
| 1131 | + List<Object[]> sumYlbList=new ArrayList<Object[]>(); | ||
| 1132 | + try { | ||
| 1133 | + if(nbbm.trim()!=""){ | ||
| 1134 | + stringList.add(nbbm); | ||
| 1135 | + }else{ | ||
| 1136 | + if(!sxtj.equals("0")){ | ||
| 1137 | + List<Object[]> objectLists; | ||
| 1138 | + if(sxtj.equals("3")){ | ||
| 1139 | + //有加油没里程 | ||
| 1140 | + objectLists=repository.checkNbmmYl(rq, gsbm, fgsbm, xlbm, nbbm); | ||
| 1141 | + for (int i = 0; i < objectLists.size(); i++) { | ||
| 1142 | + String clbm=objectLists.get(i)[0].toString(); | ||
| 1143 | + double jzl=Double.parseDouble(objectLists.get(i)[1].toString()); | ||
| 1144 | + double zlc=Double.parseDouble(objectLists.get(i)[2].toString()); | ||
| 1145 | + if(jzl>0 && zlc<=0){ | ||
| 1146 | + stringList.add(clbm); | ||
| 1147 | + } | ||
| 1148 | + | ||
| 1149 | + } | ||
| 1150 | + | ||
| 1151 | + }else if(sxtj.equals("4")){ | ||
| 1152 | + //有里程没加油 | ||
| 1153 | + objectLists=repository.checkNbmmYl(rq, gsbm, fgsbm, xlbm, nbbm); | ||
| 1154 | + for (int i = 0; i < objectLists.size(); i++) { | ||
| 1155 | + String clbm=objectLists.get(i)[0].toString(); | ||
| 1156 | + double jzl=Double.parseDouble(objectLists.get(i)[1].toString()); | ||
| 1157 | + double zlc=Double.parseDouble(objectLists.get(i)[2].toString()); | ||
| 1158 | + if(zlc>0 && jzl<=0){ | ||
| 1159 | + stringList.add(clbm); | ||
| 1160 | + } | ||
| 1161 | + | ||
| 1162 | + } | ||
| 1163 | + }else{ | ||
| 1164 | + objectLists=repository.checkNbmmNum(rq, gsbm, fgsbm, xlbm,nbbm); | ||
| 1165 | + for (int i = 0; i < objectLists.size(); i++) { | ||
| 1166 | + String clbm=objectLists.get(i)[0].toString(); | ||
| 1167 | + int cs=Integer.parseInt(objectLists.get(i)[1].toString()); | ||
| 1168 | + //一车一单 | ||
| 1169 | + | ||
| 1170 | + if(sxtj.equals("1")){ | ||
| 1171 | + if(cs==1){ | ||
| 1172 | + stringList.add(clbm); | ||
| 1173 | + } | ||
| 1174 | + } | ||
| 1175 | + //一车多单 | ||
| 1176 | + if(sxtj.equals("2")){ | ||
| 1177 | + if(cs>1){ | ||
| 1178 | + stringList.add(clbm); | ||
| 1179 | + } | ||
| 1180 | + } | ||
| 1181 | + } | ||
| 1182 | + } | ||
| 1183 | + } | ||
| 1184 | + } | ||
| 1185 | + if(sxtj.equals("0")){ | ||
| 1186 | + sumYlbList=repository.sumYlb2(rq, gsbm, fgsbm, xlbm,nbbm); | ||
| 1187 | + }else{ | ||
| 1188 | + if(stringList.size()>0){ | ||
| 1189 | + | ||
| 1190 | +// String strings[]=new String[stringList.size()]; | ||
| 1191 | +// for(int i=0;i<stringList.size();i++){ | ||
| 1192 | +// strings[i]=stringList.get(i); | ||
| 1193 | +// } | ||
| 1194 | + if (type.equals("1")) | ||
| 1195 | + sumYlbList=repository.sumYlb(rq, gsbm, fgsbm, xlbm, stringList); | ||
| 1196 | + else | ||
| 1197 | + sumYlbList=repository.sumYlb_s(sdf.parse(rq+" 00:00:00"), gsbm, fgsbm, xlbm, stringList); | ||
| 1198 | + } | ||
| 1199 | +// else{ | ||
| 1200 | +// sumYlbList=repository.sumYlb2(rq, gsbm, fgsbm, xlbm, nbbm); | ||
| 1201 | +// } | ||
| 1202 | + | ||
| 1203 | + } | ||
| 1204 | + } catch (ParseException e) { | ||
| 1205 | + // TODO Auto-generated catch block | ||
| 1206 | + e.printStackTrace(); | ||
| 1207 | + } | ||
| 1208 | + Double jzl=0.0,yh=0.0,sh=0.0; | ||
| 1209 | + for (int i = 0; i < sumYlbList.size(); i++) { | ||
| 1210 | + jzl = Arith.add(jzl, Double.valueOf(sumYlbList.get(i)[0].toString())); | ||
| 1211 | + yh = Arith.add(yh, Double.valueOf(sumYlbList.get(i)[1].toString())); | ||
| 1212 | + sh = Arith.add(sh, Double.valueOf(sumYlbList.get(i)[2].toString())); | ||
| 1213 | + } | ||
| 1214 | + | ||
| 1215 | + Map<String, Object> sumMap=new HashMap<String,Object>(); | ||
| 1216 | + sumMap.put("jzl", jzl); | ||
| 1217 | + sumMap.put("yh", yh); | ||
| 1218 | + sumMap.put("sh", sh); | ||
| 1219 | + | ||
| 1220 | +// String sql="select sum(jzl),sum(yh),sum(sh) from bsth_c_ylb " | ||
| 1221 | +// + " where to_days('"+map.get("rq").toString()+"')=to_days(rq) " | ||
| 1222 | +// + " and ssgsdm like '%"+map.get("ssgsdm_like").toString()+"%' " | ||
| 1223 | +// + " and fgsdm like '%"+map.get("fgsdm_like").toString()+"%' " | ||
| 1224 | +// + " and xlbm like '%"+map.get("xlbm_like").toString()+ "%'" | ||
| 1225 | +// + " and nbbm like '%"+map.get("nbbm_eq").toString()+"% '"; | ||
| 1226 | +// if(map.get("nbbm_in")!=null){ | ||
| 1227 | +//// sql +=" and nbbm in (" | ||
| 1228 | +// } | ||
| 1229 | + return sumMap; | ||
| 1230 | + } | ||
| 1231 | + | ||
| 1232 | + | ||
| 1233 | + | ||
| 1234 | + @Override | ||
| 1235 | + public List<Ylb> listYlb(Map<String, Object> map) { | ||
| 1236 | + // TODO Auto-generated method stub | ||
| 1237 | + List<Ylb> listYlb = new ArrayList<Ylb>(); | ||
| 1238 | + try { | ||
| 1239 | + List<String> stringList = new ArrayList<String>(); | ||
| 1240 | + String rq = map.get("rq").toString(); | ||
| 1241 | + String gsbm = map.get("ssgsdm_like").toString(); | ||
| 1242 | + String fgsbm = map.get("fgsdm_like").toString(); | ||
| 1243 | + String xlbm = map.get("xlbm_like").toString().trim(); | ||
| 1244 | + String nbbm = map.get("nbbm_eq").toString(); | ||
| 1245 | + String sxtj = map.get("sxtj").toString(); | ||
| 1246 | + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); | ||
| 1247 | + String type = map.get("type").toString(); | ||
| 1248 | + if (nbbm.trim() != "") { | ||
| 1249 | + stringList.add(nbbm); | ||
| 1250 | + List<Object[]> objectLists = repository.checkNbmmNum(rq, gsbm, fgsbm, xlbm, nbbm); | ||
| 1251 | + if (objectLists.size() > 0) { | ||
| 1252 | + int cs = Integer.parseInt(objectLists.get(0)[1].toString()); | ||
| 1253 | + if (sxtj.equals("1")) { | ||
| 1254 | + if (cs == 1) { | ||
| 1255 | + if (type.equals("1")) | ||
| 1256 | + listYlb = repository.listYlb(rq, gsbm, fgsbm, xlbm, stringList); | ||
| 1257 | + else | ||
| 1258 | + listYlb = repository.listYlb_s(sdf.parse(rq+" 00:00:00"), gsbm, fgsbm, xlbm, stringList); | ||
| 1259 | + | ||
| 1260 | + } | ||
| 1261 | + } else if (sxtj.equals("2")) { | ||
| 1262 | + if (cs > 1) { | ||
| 1263 | + if (type.equals("1")) | ||
| 1264 | + listYlb = repository.listYlb(rq, gsbm, fgsbm, xlbm, stringList); | ||
| 1265 | + else | ||
| 1266 | + listYlb = repository.listYlb_s(sdf.parse(rq+" 00:00:00"), gsbm, fgsbm, xlbm, stringList); | ||
| 1267 | + } | ||
| 1268 | + } else { | ||
| 1269 | + if (type.equals("1")) | ||
| 1270 | + listYlb = repository.listYlb(rq, gsbm, fgsbm, xlbm, stringList); | ||
| 1271 | + else | ||
| 1272 | + listYlb = repository.listYlb_s(sdf.parse(rq+" 00:00:00"), gsbm, fgsbm, xlbm, stringList); | ||
| 1273 | + } | ||
| 1274 | + } | ||
| 1275 | + | ||
| 1276 | + } else { | ||
| 1277 | + // 全部 | ||
| 1278 | + if (sxtj.equals("0")) { | ||
| 1279 | + List<Object[]> objectLists = repository.checkNbmmNum(rq, gsbm, fgsbm, xlbm, nbbm); | ||
| 1280 | + for (int i = 0; i < objectLists.size(); i++) { | ||
| 1281 | + String clbm = objectLists.get(i)[0].toString(); | ||
| 1282 | + stringList.add(clbm); | ||
| 1283 | + } | ||
| 1284 | + if (stringList.size() > 0) { | ||
| 1285 | + if (type.equals("1")) | ||
| 1286 | + listYlb = repository.listYlb(rq, gsbm, fgsbm, xlbm, stringList); | ||
| 1287 | + else | ||
| 1288 | + listYlb = repository.listYlb_s(sdf.parse(rq+" 00:00:00"), gsbm, fgsbm, xlbm, stringList); | ||
| 1289 | + } | ||
| 1290 | + }else if(sxtj.equals("5")){ | ||
| 1291 | + List<Object[]> objectLists = repository.checkNbmmFgs(rq, gsbm); | ||
| 1292 | + for (int i = 0; i < objectLists.size(); i++) { | ||
| 1293 | + String clbm =objectLists.get(i)[0].toString(); | ||
| 1294 | + stringList.add(clbm); | ||
| 1295 | + } | ||
| 1296 | + | ||
| 1297 | + if (stringList.size() > 0) { | ||
| 1298 | + if (type.equals("1")) | ||
| 1299 | + listYlb = repository.listYlb(rq, gsbm, fgsbm, xlbm, stringList); | ||
| 1300 | + else | ||
| 1301 | + listYlb = repository.listYlb_s(sdf.parse(rq+" 00:00:00"), gsbm, fgsbm, xlbm, stringList); | ||
| 1302 | + } | ||
| 1303 | + } else { | ||
| 1304 | + List<Object[]> objectLists; | ||
| 1305 | + if (sxtj.equals("3")) { | ||
| 1306 | + // 有加油没里程 | ||
| 1307 | + objectLists = repository.checkNbmmYl(rq, gsbm, fgsbm, xlbm, nbbm); | ||
| 1308 | + for (int i = 0; i < objectLists.size(); i++) { | ||
| 1309 | + String clbm = objectLists.get(i)[0].toString(); | ||
| 1310 | + double jzl = Double.parseDouble(objectLists.get(i)[1].toString()); | ||
| 1311 | + double zlc = Double.parseDouble(objectLists.get(i)[2].toString()); | ||
| 1312 | + if (jzl > 0 && zlc <= 0) { | ||
| 1313 | + stringList.add(clbm); | ||
| 1314 | + } | ||
| 1315 | + | ||
| 1316 | + } | ||
| 1317 | + | ||
| 1318 | + } else if (sxtj.equals("4")) { | ||
| 1319 | + // 有里程没加油 | ||
| 1320 | + objectLists = repository.checkNbmmYl(rq, gsbm, fgsbm, xlbm, nbbm); | ||
| 1321 | + for (int i = 0; i < objectLists.size(); i++) { | ||
| 1322 | + String clbm = objectLists.get(i)[0].toString(); | ||
| 1323 | + double jzl = Double.parseDouble(objectLists.get(i)[1].toString()); | ||
| 1324 | + double zlc = Double.parseDouble(objectLists.get(i)[2].toString()); | ||
| 1325 | + if (zlc > 0 && jzl <= 0) { | ||
| 1326 | + stringList.add(clbm); | ||
| 1327 | + } | ||
| 1328 | + | ||
| 1329 | + } | ||
| 1330 | + } else { | ||
| 1331 | + objectLists = repository.checkNbmmNum(rq, gsbm, fgsbm, xlbm, nbbm); | ||
| 1332 | + for (int i = 0; i < objectLists.size(); i++) { | ||
| 1333 | + String clbm = objectLists.get(i)[0].toString(); | ||
| 1334 | + int cs = Integer.parseInt(objectLists.get(i)[1].toString()); | ||
| 1335 | + // 一车一单 | ||
| 1336 | + if (sxtj.equals("1")) { | ||
| 1337 | + if (cs == 1) { | ||
| 1338 | + stringList.add(clbm); | ||
| 1339 | + } | ||
| 1340 | + } | ||
| 1341 | + // 一车多单 | ||
| 1342 | + if (sxtj.equals("2")) { | ||
| 1343 | + if (cs > 1) { | ||
| 1344 | + stringList.add(clbm); | ||
| 1345 | + } | ||
| 1346 | + } | ||
| 1347 | + } | ||
| 1348 | + } | ||
| 1349 | + | ||
| 1350 | + if (stringList.size() > 0) { | ||
| 1351 | + if (type.equals("1")) | ||
| 1352 | + listYlb = repository.listYlb(rq, gsbm, fgsbm, xlbm, stringList); | ||
| 1353 | + else | ||
| 1354 | + listYlb = repository.listYlb_s(sdf.parse(rq+" 00:00:00"), gsbm, fgsbm, xlbm, stringList); | ||
| 1355 | + } | ||
| 1356 | + } | ||
| 1357 | + } | ||
| 1358 | + } catch (ParseException e) { | ||
| 1359 | + // TODO Auto-generated catch block | ||
| 1360 | + e.printStackTrace(); | ||
| 1361 | + } | ||
| 1362 | + return listYlb; | ||
| 1363 | + } | ||
| 1364 | + | ||
| 1365 | + @Transactional | ||
| 1366 | + @Override | ||
| 1367 | + public Map<String, Object> saveYlbList(Map<String, Object> map) throws Exception { | ||
| 1368 | + // TODO Auto-generated method stub | ||
| 1369 | + Map<String, Object> newMap=new HashMap<String,Object>(); | ||
| 1370 | + try{ | ||
| 1371 | + SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd"); | ||
| 1372 | + String json =StringEscapeUtils.unescapeHtml4(map.get("ylbList").toString()); | ||
| 1373 | + JSONArray jsonArray=JSONArray.parseArray(json); | ||
| 1374 | + JSONObject jsonObject; | ||
| 1375 | + // 获取车辆存油信息 | ||
| 1376 | + List<Cyl> cylList = cylRepository.obtainCyl("",""); | ||
| 1377 | + for (int i = 0; i < jsonArray.size(); i++) { | ||
| 1378 | +// Ylb t=new Ylb(); | ||
| 1379 | + jsonObject=jsonArray.getJSONObject(i); | ||
| 1380 | + double czyl = jsonObject.getDoubleValue("czyl"); | ||
| 1381 | + double jzl =jsonObject.getDoubleValue("jzl"); | ||
| 1382 | + double jzyl =jsonObject.getDoubleValue("jzyl"); | ||
| 1383 | + double sh =jsonObject.getDoubleValue("sh"); | ||
| 1384 | + String shyy =jsonObject.getString("shyy"); | ||
| 1385 | + double ns = jsonObject.getDoubleValue("ns"); | ||
| 1386 | + String rylx =jsonObject.getString("rylx"); | ||
| 1387 | + int yhlx =jsonObject.getIntValue("yhlx"); | ||
| 1388 | + Integer id =jsonObject.getInteger("id"); | ||
| 1389 | + String nbbm =jsonObject.getString("nbbm"); | ||
| 1390 | + String rq=jsonObject.getString("rq"); | ||
| 1391 | + double yh = Arith.sub(Arith.add(czyl, jzl),jzyl); | ||
| 1392 | + if(yh<0){ | ||
| 1393 | + yh=0.0; | ||
| 1394 | + } | ||
| 1395 | + repository.ylbUpdate(id, czyl, jzyl, yh, sh, shyy, ns, rylx,yhlx); | ||
| 1396 | + } | ||
| 1397 | +// List<Map<String, Object>> list=(List<Map<String, Object>>) map.get("ylbList"); | ||
| 1398 | + SysUser user = SecurityUtils.getCurrentUser(); | ||
| 1399 | + Nylog nylog=new Nylog(); | ||
| 1400 | + nylog.setCreatedate(new Date()); | ||
| 1401 | + nylog.setCzmc("保存全部"); | ||
| 1402 | + nylog.setNylx("油"); | ||
| 1403 | + nylog.setUserid(user.getUserName()); | ||
| 1404 | + nylog.setUsername(user.getName()); | ||
| 1405 | + nylog.setCxtj(""); | ||
| 1406 | + nylogRepository.save(nylog); | ||
| 1407 | + newMap.put("status", ResponseCode.SUCCESS); | ||
| 1408 | + }catch(Exception e){ | ||
| 1409 | + newMap.put("status", ResponseCode.ERROR); | ||
| 1410 | + logger.error("save erro.", e); | ||
| 1411 | + throw e; | ||
| 1412 | + } | ||
| 1413 | + return newMap; | ||
| 1414 | + } | ||
| 1415 | + | ||
| 1416 | + /** | ||
| 1417 | + * 拆分 | ||
| 1418 | + */ | ||
| 1419 | + @Transactional | ||
| 1420 | + @Override | ||
| 1421 | + public Map<String, Object> sort(Map<String, Object> map) throws Exception{ | ||
| 1422 | + // TODO Auto-generated method stub | ||
| 1423 | + Map<String, Object> newMap = new HashMap<String, Object>(); | ||
| 1424 | + SimpleDateFormat sdf =new SimpleDateFormat("yyyy-MM-dd"); | ||
| 1425 | + | ||
| 1426 | + try { | ||
| 1427 | + List<Cyl> cylList = cylRepository.findAll(new CustomerSpecs<Cyl>(newMap)); | ||
| 1428 | + String json =StringEscapeUtils.unescapeHtml4(map.get("ylbList").toString()); | ||
| 1429 | + String fgsbm="999"; | ||
| 1430 | + if(map.get("fgsbm")!=null){ | ||
| 1431 | + fgsbm=map.get("fgsbm").toString(); | ||
| 1432 | + } | ||
| 1433 | + JSONArray jsonArray=JSONArray.parseArray(json); | ||
| 1434 | + JSONObject jsonObject; | ||
| 1435 | + for (int x = 0; x < jsonArray.size(); x++) { | ||
| 1436 | + jsonObject=jsonArray.getJSONObject(x); | ||
| 1437 | + Double yl =jsonObject.getDoubleValue("jzyl"); | ||
| 1438 | + Double sh =jsonObject.getDoubleValue("sh"); | ||
| 1439 | + String shyy =jsonObject.getString("shyy"); | ||
| 1440 | + Double ns = jsonObject.getDoubleValue("ns"); | ||
| 1441 | + String rylx =jsonObject.getString("rylx"); | ||
| 1442 | + Integer id =jsonObject.getInteger("id"); | ||
| 1443 | + Ylb ylb = repository.findById(id).get(); | ||
| 1444 | + String nbbm_eq = ylb.getNbbm(); | ||
| 1445 | + Date rq_eq = ylb.getRq(); | ||
| 1446 | + // 得到一天总的加油和里程(根据车,时间) | ||
| 1447 | + List<Object[]> sumList=new ArrayList<Object[]>(); | ||
| 1448 | + if(fgsbm.equals("")) | ||
| 1449 | + sumList = repository.sumLcYl(nbbm_eq, rq_eq,"",ylb.getSsgsdm(),fgsbm); | ||
| 1450 | + else | ||
| 1451 | + sumList = repository.sumLcYl(nbbm_eq, rq_eq,"",ylb.getSsgsdm(),ylb.getFgsdm()); | ||
| 1452 | + | ||
| 1453 | + // 保存总的加油量 | ||
| 1454 | + Double jzl = 0.0; | ||
| 1455 | + // 保存总的里程 | ||
| 1456 | + Double zlc = 0.0; | ||
| 1457 | + //保存总的损耗 | ||
| 1458 | + Double zsh = 0.0; | ||
| 1459 | + for (int j = 0; j < sumList.size(); j++) { | ||
| 1460 | + jzl = Arith.add(jzl, Double.valueOf(sumList.get(j)[0].toString())); | ||
| 1461 | + zlc = Arith.add(zlc, Double.valueOf(sumList.get(j)[1].toString())); | ||
| 1462 | + zsh = Arith.add(zsh, Double.valueOf(sumList.get(j)[2].toString())); | ||
| 1463 | + } | ||
| 1464 | +// jzl = Arith.sub(jzl, zsh); | ||
| 1465 | + //新的 损耗不等于 旧的损耗 总损耗从新算 | ||
| 1466 | + /*if(Arith.sub(ylb.getSh(),sh )!=0){ | ||
| 1467 | + zsh =Arith.add(Arith.sub(zsh, ylb.getSh()), sh); | ||
| 1468 | + jzl =Arith.sub(jzl, zsh); | ||
| 1469 | + }else{ | ||
| 1470 | + jzl =Arith.sub(jzl, zsh); | ||
| 1471 | + }*/ | ||
| 1472 | + map.put("nbbm_eq", nbbm_eq); | ||
| 1473 | + map.put("rq_eq", rq_eq); | ||
| 1474 | + List<Ylb> iterator2=null; | ||
| 1475 | + if(fgsbm.equals("")) | ||
| 1476 | + iterator2=this.listOrderBy(sdf.format(rq_eq),ylb.getSsgsdm(),fgsbm,"", | ||
| 1477 | + ylb.getNbbm(),"jcsx"); | ||
| 1478 | + else | ||
| 1479 | + iterator2=this.listOrderBy(sdf.format(rq_eq),ylb.getSsgsdm(),ylb.getFgsdm(),"", | ||
| 1480 | + ylb.getNbbm(),"jcsx"); | ||
| 1481 | + | ||
| 1482 | +// repository.obtainYl(sdf.format(rq_eq),ylb.getSsgsdm(),ylb.getFgsdm(),"", | ||
| 1483 | +// ylb.getNbbm(),"jcsx"); | ||
| 1484 | + DecimalFormat df = new DecimalFormat("#.00"); | ||
| 1485 | + Double zyl = 0.0; | ||
| 1486 | + Double nextJzyl = 0.0; | ||
| 1487 | + // 车的,进,出油量及耗油 | ||
| 1488 | + double czyl=0.0; | ||
| 1489 | + for (int i = 0; i < iterator2.size(); i++) { | ||
| 1490 | + Ylb t = iterator2.get(i); | ||
| 1491 | + if (t.getJcsx() == 1) { | ||
| 1492 | + if(t.getId()==id){ | ||
| 1493 | + t.setSh(sh); | ||
| 1494 | + t.setShyy(shyy); | ||
| 1495 | + } | ||
| 1496 | + czyl=t.getCzyl(); | ||
| 1497 | + Double jcyl = t.getCzyl(); | ||
| 1498 | + zyl = Arith.sub(Arith.add(jcyl, jzl), yl); | ||
| 1499 | + Double yh = 0.0; | ||
| 1500 | + if (zlc > 0 && t.getZlc() > 0) { | ||
| 1501 | + yh = Double.parseDouble(df.format(zyl * (t.getZlc() / zlc))); | ||
| 1502 | + } | ||
| 1503 | + nextJzyl =Arith.sub(Arith.add(t.getJzl(), t.getCzyl()), yh); | ||
| 1504 | +// nextJzyl =Arith.sub(Arith.add(t.getJzl(), t.getCzyl()), Arith.add(yh, t.getSh())); | ||
| 1505 | + if(zlc>0 && t.getZlc() > 0){ | ||
| 1506 | + long l=Math.round(nextJzyl); | ||
| 1507 | + double ylxs=l*100/100; | ||
| 1508 | +// nextJzyl = Arith.add(nextJzyl,Arith.sub(nextJzyl,ylxs)); | ||
| 1509 | + yh=Arith.add(yh, Arith.sub(nextJzyl,ylxs)); | ||
| 1510 | + t.setYh(yh); | ||
| 1511 | + t.setJzyl(ylxs); | ||
| 1512 | + nextJzyl=ylxs; | ||
| 1513 | + }else{ | ||
| 1514 | + t.setYh(yh); | ||
| 1515 | + t.setJzyl(nextJzyl); | ||
| 1516 | + } | ||
| 1517 | + } else { | ||
| 1518 | + if(t.getId()==id){ | ||
| 1519 | + t.setSh(sh); | ||
| 1520 | + t.setShyy(shyy); | ||
| 1521 | + } | ||
| 1522 | + t.setCzyl(nextJzyl); | ||
| 1523 | + Double yh =0.0; | ||
| 1524 | + if (t.getZlc() >= 0) { | ||
| 1525 | + yh= Double.parseDouble(df.format(zyl * (t.getZlc() / zlc))); | ||
| 1526 | + } | ||
| 1527 | +// nextJzyl = Arith.sub(Arith.add(t.getJzl(), nextJzyl), Arith.add(yh, t.getSh())); | ||
| 1528 | + nextJzyl = Arith.sub(Arith.add(t.getJzl(), nextJzyl), yh); | ||
| 1529 | + if(zlc>0 && t.getZlc() >0){ | ||
| 1530 | + long l=0l; | ||
| 1531 | + double ylxs=0.0; | ||
| 1532 | + if(i==iterator2.size()-1){ | ||
| 1533 | + ylxs=yl; | ||
| 1534 | + }else{ | ||
| 1535 | + l=Math.round(nextJzyl); | ||
| 1536 | + ylxs=l*100/100; | ||
| 1537 | + } | ||
| 1538 | + yh=Arith.add(yh, Arith.sub(nextJzyl,ylxs)); | ||
| 1539 | + t.setYh(yh); | ||
| 1540 | + t.setJzyl(ylxs); | ||
| 1541 | + nextJzyl=ylxs; | ||
| 1542 | + }else{ | ||
| 1543 | + t.setYh(yh); | ||
| 1544 | + t.setJzyl(nextJzyl); | ||
| 1545 | + } | ||
| 1546 | + } | ||
| 1547 | + if(t.getJzyl()<0){ | ||
| 1548 | + t.setJzyl(0.0); | ||
| 1549 | + } | ||
| 1550 | + if(t.getCzyl()<0){ | ||
| 1551 | + t.setCzyl(0.0); | ||
| 1552 | + } | ||
| 1553 | + if(t.getYh()<0){ | ||
| 1554 | + t.setYh(0.0); | ||
| 1555 | + } | ||
| 1556 | + if(t.getSh()<0){ | ||
| 1557 | + t.setSh(0.0); | ||
| 1558 | + } | ||
| 1559 | + repository.save(t); | ||
| 1560 | + } | ||
| 1561 | + newMap.put("status", ResponseCode.SUCCESS); | ||
| 1562 | + } | ||
| 1563 | + | ||
| 1564 | + SysUser user = SecurityUtils.getCurrentUser(); | ||
| 1565 | + Nylog nylog=new Nylog(); | ||
| 1566 | + nylog.setCreatedate(new Date()); | ||
| 1567 | + nylog.setCzmc("拆分"); | ||
| 1568 | + nylog.setNylx("油"); | ||
| 1569 | + nylog.setUserid(user.getUserName()); | ||
| 1570 | + nylog.setUsername(user.getName()); | ||
| 1571 | + nylog.setCxtj(""); | ||
| 1572 | + nylogRepository.save(nylog); | ||
| 1573 | + } catch (Exception e) { | ||
| 1574 | + newMap.put("status", ResponseCode.ERROR); | ||
| 1575 | + logger.error("save erro.", e); | ||
| 1576 | + throw e; | ||
| 1577 | + } | ||
| 1578 | + return newMap; | ||
| 1579 | + } | ||
| 1580 | + | ||
| 1581 | + | ||
| 1582 | + @Override | ||
| 1583 | + public String checkJsy(Map<String, Object> map) { | ||
| 1584 | + // TODO Auto-generated method stub | ||
| 1585 | + SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd"); | ||
| 1586 | + String rq=map.get("date").toString(); | ||
| 1587 | + String nbbm=map.get("nbbm").toString(); | ||
| 1588 | + String jsy =map.get("jsy").toString(); | ||
| 1589 | + String xlbm=map.get("xlbm").toString(); | ||
| 1590 | + List<Ylb> list= repository.checkYlb(rq, nbbm, jsy,xlbm,"nbbm"); | ||
| 1591 | + String type="1"; | ||
| 1592 | + if(list.size()>0){ | ||
| 1593 | + type="0"; | ||
| 1594 | + } | ||
| 1595 | + return type; | ||
| 1596 | + } | ||
| 1597 | + | ||
| 1598 | + @Override | ||
| 1599 | + public String checkDate(Map<String, Object> map) { | ||
| 1600 | + // TODO Auto-generated method stub | ||
| 1601 | + SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd"); | ||
| 1602 | + String rq=map.get("rq").toString(); | ||
| 1603 | + String gsbm=map.get("ssgsdm_like").toString(); | ||
| 1604 | + String type="1"; | ||
| 1605 | + if(gsbm.equals("26") && modify_rights_close){ | ||
| 1606 | + Date date=new Date(); | ||
| 1607 | + try { | ||
| 1608 | + long day2=date.getTime(); | ||
| 1609 | + long day1=sdf.parse(rq).getTime(); | ||
| 1610 | + long days = (day2 - day1) / (24*3600*1000); | ||
| 1611 | + if(days>3){ | ||
| 1612 | + type="2"; | ||
| 1613 | + } | ||
| 1614 | + } catch (ParseException e) { | ||
| 1615 | + // TODO Auto-generated catch block | ||
| 1616 | + e.printStackTrace(); | ||
| 1617 | + } | ||
| 1618 | + } | ||
| 1619 | + return type; | ||
| 1620 | + } | ||
| 1621 | + | ||
| 1622 | + @Override | ||
| 1623 | + public String getModifyRights(){ | ||
| 1624 | + return modify_rights_close?"关闭":"打开"; | ||
| 1625 | + } | ||
| 1626 | + | ||
| 1627 | + @Override | ||
| 1628 | + public String modifyRightsChange(){ | ||
| 1629 | + if(modify_rights_close){ | ||
| 1630 | + modify_rights_close = false; | ||
| 1631 | + } else { | ||
| 1632 | + modify_rights_close = true; | ||
| 1633 | + } | ||
| 1634 | + return modify_rights_close?"权限关闭":"权限打开"; | ||
| 1635 | + } | ||
| 1636 | + | ||
| 1637 | + | ||
| 1638 | + | ||
| 1639 | + @Override | ||
| 1640 | + public Map<String, Object> saveYlb(Ylb t) { | ||
| 1641 | + Map<String, Object> map = new HashMap<>(); | ||
| 1642 | + SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd"); | ||
| 1643 | + String rq=sdf.format(t.getRq()); | ||
| 1644 | + String gsdm=t.getSsgsdm(); | ||
| 1645 | + String fgsdm=t.getFgsdm(); | ||
| 1646 | + String xlbm=t.getXlbm(); | ||
| 1647 | + String jhsj=t.getJhsj(); | ||
| 1648 | + String jsy=t.getJsy(); | ||
| 1649 | + String nbbm=t.getNbbm(); | ||
| 1650 | + t.setCreatetime(new Date()); | ||
| 1651 | + String[] jhsjStr = jhsj.split(":"); | ||
| 1652 | + long fcsjL= Long.parseLong(jhsjStr[0])*60+Long.parseLong(jhsjStr[1]); | ||
| 1653 | + List<Ylb> list=this.listOrderBy(rq, gsdm, fgsdm, xlbm, nbbm, "jhsj"); | ||
| 1654 | +// repository.obtainYl(rq, gsdm, fgsdm, xlbm, nbbm, "jhsj"); | ||
| 1655 | + int jcsx=1; | ||
| 1656 | + if(list.size()>0){ | ||
| 1657 | + for (int i = 0; i < list.size(); i++) { | ||
| 1658 | + Ylb y=list.get(i); | ||
| 1659 | + String[] fcsjStr = y.getJhsj().split(":"); | ||
| 1660 | + long fcsj=Long.parseLong(fcsjStr[0])*60+Long.parseLong(fcsjStr[1]); | ||
| 1661 | + if(fcsjL>fcsj){ | ||
| 1662 | + jcsx=jcsx+y.getJcsx(); | ||
| 1663 | + }else{ | ||
| 1664 | + y.setJcsx(y.getJcsx()+1); | ||
| 1665 | + repository.save(y); | ||
| 1666 | + } | ||
| 1667 | + } | ||
| 1668 | + | ||
| 1669 | + } | ||
| 1670 | + t.setJcsx(jcsx); | ||
| 1671 | + repository.save(t); | ||
| 1672 | + | ||
| 1673 | + SysUser user = SecurityUtils.getCurrentUser(); | ||
| 1674 | + Nylog nylog=new Nylog(); | ||
| 1675 | + nylog.setCreatedate(new Date()); | ||
| 1676 | + nylog.setCzmc("手动添加"); | ||
| 1677 | + nylog.setNylx("油"); | ||
| 1678 | + nylog.setUserid(user.getUserName()); | ||
| 1679 | + nylog.setUsername(user.getName()); | ||
| 1680 | + nylog.setCxtj(""); | ||
| 1681 | + nylogRepository.save(nylog); | ||
| 1682 | + map.put("status", ResponseCode.SUCCESS); | ||
| 1683 | + map.put("t", t); | ||
| 1684 | + return map; | ||
| 1685 | + } | ||
| 1686 | + @Transactional | ||
| 1687 | + @Override | ||
| 1688 | + public Map<String, Object> deleteIds(Map<String, Object> map) throws Exception{ | ||
| 1689 | + // TODO Auto-generated method stub | ||
| 1690 | + Map<String, Object> maps = new HashMap<>(); | ||
| 1691 | + try{ | ||
| 1692 | + String json =StringEscapeUtils.unescapeHtml4(map.get("ids").toString()); | ||
| 1693 | + JSONArray jsonArray=JSONArray.parseArray(json); | ||
| 1694 | + JSONObject jsonObject; | ||
| 1695 | + for (int x = 0; x < jsonArray.size(); x++) { | ||
| 1696 | + jsonObject=jsonArray.getJSONObject(x); | ||
| 1697 | + Integer id =jsonObject.getInteger("id"); | ||
| 1698 | + repository.deleteById(id); | ||
| 1699 | + } | ||
| 1700 | + | ||
| 1701 | + SysUser user = SecurityUtils.getCurrentUser(); | ||
| 1702 | + Nylog nylog=new Nylog(); | ||
| 1703 | + nylog.setCreatedate(new Date()); | ||
| 1704 | + nylog.setCzmc("删除"); | ||
| 1705 | + nylog.setNylx("油"); | ||
| 1706 | + nylog.setUserid(user.getUserName()); | ||
| 1707 | + nylog.setUsername(user.getName()); | ||
| 1708 | + nylog.setCxtj(""); | ||
| 1709 | + nylogRepository.save(nylog); | ||
| 1710 | + maps.put("status", ResponseCode.SUCCESS); | ||
| 1711 | + } catch (Exception e) { | ||
| 1712 | + maps.put("status", ResponseCode.ERROR); | ||
| 1713 | + logger.error("save erro.", e); | ||
| 1714 | + throw e; | ||
| 1715 | + } | ||
| 1716 | + return maps; | ||
| 1717 | + } | ||
| 1718 | + | ||
| 1719 | + public List<Ylb> listOrderBy(String rq,String gsdm, | ||
| 1720 | + String fgsdm,String xlbm,String nbbm, | ||
| 1721 | + String px) { | ||
| 1722 | + // TODO Auto-generated method stub | ||
| 1723 | + String sql="SELECT * FROM bsth_c_ylb " | ||
| 1724 | + + " where rq ='"+rq+"' and ssgsdm like '%"+gsdm+"%' " | ||
| 1725 | + + " and fgsdm like '%"+fgsdm+"%'"; | ||
| 1726 | + if(xlbm.equals("")){ | ||
| 1727 | + sql+= " and xlbm like '%"+xlbm+"%' "; | ||
| 1728 | + }else{ | ||
| 1729 | + sql+= " and xlbm = '"+xlbm+"' "; | ||
| 1730 | + } | ||
| 1731 | + | ||
| 1732 | + sql += "and nbbm like '%"+nbbm+"%' order by "+px+" asc "; | ||
| 1733 | + | ||
| 1734 | + List<Ylb> list = jdbcTemplate.query(sql, new RowMapper<Ylb>() { | ||
| 1735 | + @Override | ||
| 1736 | + public Ylb mapRow(ResultSet arg0, int arg1) throws SQLException { | ||
| 1737 | + Ylb y = new Ylb(); | ||
| 1738 | + y.setId(arg0.getInt("id")); | ||
| 1739 | + return y; | ||
| 1740 | + } | ||
| 1741 | + }); | ||
| 1742 | + List<Ylb> lists=new ArrayList<Ylb>(); | ||
| 1743 | + List<Ylb> ylbLists=repository.obtainYl(rq,gsdm,fgsdm,xlbm,nbbm,"jcsx"); | ||
| 1744 | + for (int i = 0; i < list.size(); i++) { | ||
| 1745 | + Ylb t=list.get(i); | ||
| 1746 | + for (int j = 0; j < ylbLists.size(); j++) { | ||
| 1747 | + Ylb t2=ylbLists.get(j); | ||
| 1748 | + if(t.getId().intValue()==t2.getId().intValue()){ | ||
| 1749 | + lists.add(t2); | ||
| 1750 | + break; | ||
| 1751 | + } | ||
| 1752 | + } | ||
| 1753 | + } | ||
| 1754 | + | ||
| 1755 | + return lists; | ||
| 1756 | + } | ||
| 1757 | + | ||
| 1758 | + @Override | ||
| 1759 | + public Map<String, Object> updateHistory(Map<String, Object> map) throws Exception { | ||
| 1760 | + // TODO Auto-generated method stub | ||
| 1761 | + Map<String, Object> newMap = new HashMap<String, Object>(); | ||
| 1762 | + | ||
| 1763 | + List<Cars> carsList = carsRepository.findCars(); | ||
| 1764 | + Map<String, Boolean> carsMap = new HashMap<String, Boolean>(); | ||
| 1765 | + for (int i = 0; i < carsList.size(); i++) { | ||
| 1766 | + Cars c = carsList.get(i); | ||
| 1767 | + carsMap.put(c.getInsideCode(), c.getSfdc()); | ||
| 1768 | + } | ||
| 1769 | + try{ | ||
| 1770 | + String date = map.get("date").toString(); | ||
| 1771 | + String line = map.get("line").toString(); | ||
| 1772 | + List<Line> listLine=lineRepository.findLineByCode(line); | ||
| 1773 | + String gsdm =""; | ||
| 1774 | + String fgsdm =""; | ||
| 1775 | + if(listLine.size()>0){ | ||
| 1776 | + Line l=listLine.get(0); | ||
| 1777 | + gsdm=l.getCompany(); | ||
| 1778 | + fgsdm=l.getBrancheCompany(); | ||
| 1779 | + } | ||
| 1780 | + | ||
| 1781 | + String nbbmstr=""; | ||
| 1782 | + List<Map<String, Object>> listpbYc=new ArrayList<Map<String, Object>>();//油车数据 | ||
| 1783 | + List<Map<String, Object>> listpbDc=new ArrayList<Map<String, Object>>();//电车数据 | ||
| 1784 | + List<Map<String,Object>> listpb=scheduleRealInfoService.yesterdayDataList("", date,gsdm, fgsdm, "", ""); | ||
| 1785 | + for (int i = 0; i < listpb.size(); i++) { | ||
| 1786 | + if(listpb.get(i).get("xlBm").toString().equals(line)){ | ||
| 1787 | + nbbmstr +=listpb.get(i).get("clZbh").toString(); | ||
| 1788 | + } | ||
| 1789 | + } | ||
| 1790 | + for (int i = 0; i < listpb.size(); i++) { | ||
| 1791 | + boolean sfdc=true; | ||
| 1792 | + Map<String, Object> m = listpb.get(i); | ||
| 1793 | + if (carsMap.get(m.get("clZbh").toString()) != null) { | ||
| 1794 | + sfdc = carsMap.get(m.get("clZbh").toString()); | ||
| 1795 | + } else { | ||
| 1796 | + sfdc = true; | ||
| 1797 | + } | ||
| 1798 | + if(nbbmstr.indexOf(m.get("clZbh").toString())>-1){ | ||
| 1799 | + if(sfdc){ | ||
| 1800 | + listpbDc.add(m); | ||
| 1801 | + }else{ | ||
| 1802 | + listpbYc.add(m); | ||
| 1803 | + } | ||
| 1804 | + } | ||
| 1805 | + } | ||
| 1806 | + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); | ||
| 1807 | + //初始存油量 | ||
| 1808 | + List<Cyl> clyList = cylRepository.obtainCyl("",gsdm); | ||
| 1809 | + List<Ylxxb> ylxxList = ylxxbRepository.obtainYlxx(date, 0,gsdm); | ||
| 1810 | + //重新统计油车数据开始 | ||
| 1811 | + List<Ylb> ylListBe =repository.listByRqJcsx(date, gsdm, fgsdm, "", ""); | ||
| 1812 | + List<Ylb> ylbList=this.listOrderBy(date,gsdm,fgsdm,"","","nbbm"); | ||
| 1813 | + List<Ylb> ylbList_upd=new ArrayList<Ylb>(); | ||
| 1814 | + List<Ylb> ylbList_del=new ArrayList<Ylb>(); | ||
| 1815 | + | ||
| 1816 | + for (int j = 0; j < ylbList.size(); j++) { | ||
| 1817 | + Ylb t=ylbList.get(j); | ||
| 1818 | + boolean fage=true; | ||
| 1819 | + if(StringUtils.isEmpty(t.getLp())){ | ||
| 1820 | + fage=false; | ||
| 1821 | + }else{ | ||
| 1822 | + for (int i = 0; i < listpbYc.size(); i++) { | ||
| 1823 | + Map<String, Object> m = listpbYc.get(i); | ||
| 1824 | + if(t.getNbbm().equals(m.get("clZbh").toString()) | ||
| 1825 | + &&t.getJsy().equals(m.get("jGh").toString()) | ||
| 1826 | + &&t.getXlbm().equals(m.get("xlBm").toString()) | ||
| 1827 | + &&t.getLp().equals(m.get("lpName").toString())){ | ||
| 1828 | + //该条记录不用删除 | ||
| 1829 | + fage =false; | ||
| 1830 | + ylbList_upd.add(t); | ||
| 1831 | + } | ||
| 1832 | + } | ||
| 1833 | + } | ||
| 1834 | + if(fage){ | ||
| 1835 | + if(t.getXlbm().equals(line)){ | ||
| 1836 | + ylbList_del.add(t); | ||
| 1837 | + } | ||
| 1838 | + } | ||
| 1839 | + | ||
| 1840 | + } | ||
| 1841 | + String nbbmStr=""; | ||
| 1842 | + List<Ylb> list=new ArrayList<Ylb>(); | ||
| 1843 | + /* | ||
| 1844 | + * 第一步 修改车辆里程 和加注量 | ||
| 1845 | + */ | ||
| 1846 | + Map<String, Object> ylMap=new HashMap<String, Object>(); | ||
| 1847 | + for (int x = 0; x < listpbYc.size(); x++) { | ||
| 1848 | + String type = "add"; | ||
| 1849 | + Map<String, Object> maps = listpbYc.get(x); | ||
| 1850 | + // 判断驾驶员驾驶的该车辆是否已经存入了(查出的结果集中日期是相同的,根据驾驶员、内部编号、线路编码判断) | ||
| 1851 | + Ylb t = new Ylb(); | ||
| 1852 | + for (int k = 0; k < ylbList_upd.size(); k++) { | ||
| 1853 | + Ylb t1 = ylbList_upd.get(k); | ||
| 1854 | + if (t1.getNbbm().equals(maps.get("clZbh").toString()) | ||
| 1855 | + && t1.getJsy().equals(maps.get("jGh").toString()) | ||
| 1856 | + && t1.getXlbm().equals(maps.get("xlBm").toString()) | ||
| 1857 | + && t1.getLp().equals(maps.get("lpName").toString())) { | ||
| 1858 | + t = t1; | ||
| 1859 | + type = "update"; | ||
| 1860 | + } | ||
| 1861 | + } | ||
| 1862 | + if(type.equals("add")){ | ||
| 1863 | + // 当日的第一个班次,出场油量等于前一天的最后一个班次的进场油量 | ||
| 1864 | + if (maps.get("seqNumber").toString().equals("1")) { | ||
| 1865 | + boolean fage = true; | ||
| 1866 | + for (int i = 0; i < ylListBe.size(); i++) { | ||
| 1867 | + Ylb ylb = ylListBe.get(i); | ||
| 1868 | + if (maps.get("clZbh").toString().equals(ylb.getNbbm())) { | ||
| 1869 | + if(ylb.getJzyl()>=0){ | ||
| 1870 | + t.setCzyl(ylb.getJzyl()); | ||
| 1871 | + fage = false; | ||
| 1872 | + break; | ||
| 1873 | + } | ||
| 1874 | + } | ||
| 1875 | + } | ||
| 1876 | + if (fage) { | ||
| 1877 | + for (int y = 0; y < clyList.size(); y++) { | ||
| 1878 | + Cyl cyl = clyList.get(y); | ||
| 1879 | + if (maps.get("clZbh").toString().equals(cyl.getNbbm())) { | ||
| 1880 | + if(cyl!=null){ | ||
| 1881 | + if(cyl.getCyl()>=0){ | ||
| 1882 | + t.setCzyl(cyl.getCyl()); | ||
| 1883 | + fage = false; | ||
| 1884 | + break; | ||
| 1885 | + }else { | ||
| 1886 | + if(cyl.getCxrl()!=null){ | ||
| 1887 | + if(cyl.getCxrl()>0){ | ||
| 1888 | + t.setCzyl(cyl.getCxrl()); | ||
| 1889 | + fage = false; | ||
| 1890 | + break; | ||
| 1891 | + } | ||
| 1892 | + } | ||
| 1893 | + } | ||
| 1894 | + } | ||
| 1895 | + } | ||
| 1896 | + } | ||
| 1897 | + } | ||
| 1898 | + if (fage) { | ||
| 1899 | + t.setCzyl(0.0); | ||
| 1900 | + } | ||
| 1901 | + } | ||
| 1902 | + } | ||
| 1903 | + | ||
| 1904 | + Double jzl = 0.0; | ||
| 1905 | + //一人一车加注量只匹配一次 | ||
| 1906 | + if(ylMap.get(maps.get("clZbh").toString()+"_"+ maps.get("jGh").toString())!=null){ | ||
| 1907 | + }else{ | ||
| 1908 | + boolean fage2=false; | ||
| 1909 | + for (int i = 0; i < ylxxList.size(); i++) { | ||
| 1910 | + Ylxxb ylxxb = ylxxList.get(i); | ||
| 1911 | + if (maps.get("clZbh").toString().equals(ylxxb.getNbbm()) | ||
| 1912 | + && maps.get("jGh").toString().equals(ylxxb.getJsy()) | ||
| 1913 | + && ylxxb.getJylx()==1) { | ||
| 1914 | + if(ylxxb.getJzl()>0){ | ||
| 1915 | + fage2=true; | ||
| 1916 | + } | ||
| 1917 | + } | ||
| 1918 | + } | ||
| 1919 | + //车辆的加注量如果有任工干预,略接口过来 数据 | ||
| 1920 | + if(fage2){ | ||
| 1921 | + // 把当天手工输入的的YLXXB的加注量设置为当天YLB的加注量(根据车号,驾驶员判断,加油类型为1) | ||
| 1922 | + for (int j = 0; j < ylxxList.size(); j++) { | ||
| 1923 | + Ylxxb ylxxb = ylxxList.get(j); | ||
| 1924 | + if (maps.get("clZbh").toString().equals(ylxxb.getNbbm()) | ||
| 1925 | + && maps.get("jGh").toString().equals(ylxxb.getJsy()) | ||
| 1926 | + && ylxxb.getJylx()==1) { | ||
| 1927 | + jzl =Arith.add(jzl, ylxxb.getJzl()); | ||
| 1928 | + } | ||
| 1929 | + } | ||
| 1930 | + ylMap.put(maps.get("clZbh").toString()+"_"+ maps.get("jGh").toString(),maps.get("xlBm") == null ? "" : maps.get("xlBm").toString()); | ||
| 1931 | + }else{ | ||
| 1932 | + // 把当天的YLXXB的加注量设置为当天YLB的加注量(根据车号,驾驶员判断) | ||
| 1933 | + for (int j = 0; j < ylxxList.size(); j++) { | ||
| 1934 | + Ylxxb ylxxb = ylxxList.get(j); | ||
| 1935 | + if (maps.get("clZbh").toString().equals(ylxxb.getNbbm()) | ||
| 1936 | + && maps.get("jGh").toString().equals(ylxxb.getJsy())) { | ||
| 1937 | + jzl =Arith.add(jzl, ylxxb.getJzl()); | ||
| 1938 | + } | ||
| 1939 | + } | ||
| 1940 | + ylMap.put(maps.get("clZbh").toString()+"_"+ maps.get("jGh").toString(),maps.get("xlBm") == null ? "" : maps.get("xlBm").toString()); | ||
| 1941 | + } | ||
| 1942 | + } | ||
| 1943 | + t.setJzl(jzl); | ||
| 1944 | + t.setNbbm(maps.get("clZbh").toString()); | ||
| 1945 | + t.setJsy(maps.get("jGh") == null ? "" : maps.get("jGh").toString()); | ||
| 1946 | + t.setJname(maps.get("jName").toString()); | ||
| 1947 | + t.setZlc(maps.get("totalKilometers") == null ? 0.0 | ||
| 1948 | + : Double.parseDouble(maps.get("totalKilometers").toString())); | ||
| 1949 | + t.setXlbm(maps.get("xlBm") == null ? "" : maps.get("xlBm").toString()); | ||
| 1950 | + t.setJcsx(Integer.parseInt(maps.get("seqNumber").toString())); | ||
| 1951 | + t.setSsgsdm(maps.get("company") == null ? "" : maps.get("company").toString()); | ||
| 1952 | + t.setFgsdm(maps.get("bCompany") == null ? "" : maps.get("bCompany").toString()); | ||
| 1953 | + t.setJhsj(maps.get("fcsj")==null?"":maps.get("fcsj").toString()); | ||
| 1954 | + t.setRq(sdf.parse(date)); | ||
| 1955 | + t.setLp(maps.get("lpName")==null?"":maps.get("lpName").toString()); | ||
| 1956 | + if(!(t.getSsgsdm().equals("") || t.getFgsdm().equals(""))){ | ||
| 1957 | + if(type.equals("add")){ | ||
| 1958 | + if(nbbmStr.indexOf(t.getNbbm())<0){ | ||
| 1959 | + nbbmStr +=t.getNbbm()+","; | ||
| 1960 | + } | ||
| 1961 | + t.setCreatetime(new Date()); | ||
| 1962 | + }else{ | ||
| 1963 | + t.setUpdatetime(new Date()); | ||
| 1964 | + } | ||
| 1965 | + } | ||
| 1966 | + try { | ||
| 1967 | + repository.save(t); | ||
| 1968 | + } catch (Exception e) { | ||
| 1969 | + // TODO: handle exception | ||
| 1970 | + if(e.getMessage().indexOf("PK_YLB_UK")>0){ | ||
| 1971 | + newMap.put("fage", "存在相同数据,数据已经过滤"); | ||
| 1972 | + logger.info("油量存在相同数据,数据已经过滤"); | ||
| 1973 | + } | ||
| 1974 | + } | ||
| 1975 | + | ||
| 1976 | + } | ||
| 1977 | + for (int i = 0; i < ylbList_del.size(); i++) { | ||
| 1978 | + Ylb y=ylbList_del.get(i); | ||
| 1979 | + if(nbbmStr.indexOf(y.getNbbm())<0){ | ||
| 1980 | + nbbmStr +=y.getNbbm()+","; | ||
| 1981 | + } | ||
| 1982 | + repository.deleteById(y.getId()); | ||
| 1983 | + } | ||
| 1984 | + | ||
| 1985 | + //重新计算删除了的或者新增了的车的车的油耗信息(考虑车辆可能跨线路,从分公司赛选计算) | ||
| 1986 | + double czyl=0.0; | ||
| 1987 | + List<Ylb> iterator2=this.listOrderBy(date,gsdm,fgsdm,"","","nbbm,jcsx"); | ||
| 1988 | + String[] nbbms=nbbmStr.split(","); | ||
| 1989 | + for (int i = 0; i < nbbms.length; i++) { | ||
| 1990 | + String clzbm=nbbms[i]; | ||
| 1991 | + // 得到一天总的加油和里程(根据车,时间) | ||
| 1992 | + List<Object[]> sumList = repository.sumLcYl(clzbm, sdf.parse(date),"",gsdm,fgsdm); | ||
| 1993 | + // 保存总的加油量 | ||
| 1994 | + Double jzl = 0.0; | ||
| 1995 | + // 保存总的里程 | ||
| 1996 | + Double zlc = 0.0; | ||
| 1997 | + for (int j = 0; j < sumList.size(); j++) { | ||
| 1998 | + jzl = Arith.add(jzl, Double.valueOf(sumList.get(j)[0].toString())); | ||
| 1999 | + zlc = Arith.add(zlc, Double.valueOf(sumList.get(j)[1].toString())); | ||
| 2000 | + } | ||
| 2001 | + // 保留两位小数 | ||
| 2002 | + DecimalFormat df = new DecimalFormat("#.00"); | ||
| 2003 | + Double zyl = 0.0; | ||
| 2004 | + Double nextJzyl = 0.0; | ||
| 2005 | + for (int j = 0; j < iterator2.size(); j++) { | ||
| 2006 | + Ylb t = iterator2.get(j); | ||
| 2007 | + if(t.getNbbm().equals(clzbm)){ | ||
| 2008 | + if (t.getJcsx() == 1) { | ||
| 2009 | + // 进场等于出场的操作 既 最后进场存油量等于第一次的出场存油量 | ||
| 2010 | + czyl = t.getCzyl(); | ||
| 2011 | + zyl =jzl; | ||
| 2012 | + Double yh=0.0; | ||
| 2013 | + if(zlc>0 ){ | ||
| 2014 | + yh = Double.parseDouble(df.format(zyl * (t.getZlc() / zlc))); | ||
| 2015 | + } | ||
| 2016 | + nextJzyl =Arith.sub( Arith.add(t.getJzl(), t.getCzyl()),yh); | ||
| 2017 | + //把进场油量的小数和整数分别取出 | ||
| 2018 | + if(zlc>0 && t.getZlc()>0){ | ||
| 2019 | + long l=Math.round(nextJzyl); | ||
| 2020 | + double ylxs=l*100/100; | ||
| 2021 | + yh=Arith.add(yh, Arith.sub(nextJzyl,ylxs)); | ||
| 2022 | + t.setYh(yh); | ||
| 2023 | + t.setJzyl(ylxs); | ||
| 2024 | + nextJzyl=ylxs; | ||
| 2025 | + }else{ | ||
| 2026 | + t.setYh(yh); | ||
| 2027 | + t.setJzyl(nextJzyl); | ||
| 2028 | + } | ||
| 2029 | + } else { | ||
| 2030 | + t.setCzyl(nextJzyl); | ||
| 2031 | + Double yh=0.0; | ||
| 2032 | + if(zlc>0){ | ||
| 2033 | + yh= Double.parseDouble(df.format(zyl * (t.getZlc() / zlc))); | ||
| 2034 | + } | ||
| 2035 | + nextJzyl =Arith.sub( Arith.add(t.getJzl(),nextJzyl),yh); | ||
| 2036 | + if(zlc>0 && t.getZlc()>0){ | ||
| 2037 | + long l=0l; | ||
| 2038 | + double ylxs=0.0; | ||
| 2039 | + if(j==iterator2.size()-1){ | ||
| 2040 | + ylxs=czyl; | ||
| 2041 | + }else{ | ||
| 2042 | + if(iterator2.get(j+1).getNbbm().equals(t.getNbbm())){ | ||
| 2043 | + l=Math.round(nextJzyl); | ||
| 2044 | + ylxs=l*100/100; | ||
| 2045 | + }else{ | ||
| 2046 | + ylxs=czyl; | ||
| 2047 | + } | ||
| 2048 | + | ||
| 2049 | + } | ||
| 2050 | + yh=Arith.add(yh, Arith.sub(nextJzyl,ylxs)); | ||
| 2051 | + t.setYh(yh); | ||
| 2052 | + t.setJzyl(ylxs); | ||
| 2053 | + nextJzyl=ylxs; | ||
| 2054 | + }else{ | ||
| 2055 | + t.setYh(yh); | ||
| 2056 | + t.setJzyl(nextJzyl); | ||
| 2057 | + } | ||
| 2058 | + } | ||
| 2059 | + if(t.getJzyl()<0){ | ||
| 2060 | + t.setJzyl(0.0); | ||
| 2061 | + } | ||
| 2062 | + if(t.getCzyl()<0){ | ||
| 2063 | + t.setCzyl(0.0); | ||
| 2064 | + } | ||
| 2065 | + if(t.getYh()<0){ | ||
| 2066 | + t.setYh(0.0); | ||
| 2067 | + } | ||
| 2068 | + if(t.getSh()<0){ | ||
| 2069 | + t.setSh(0.0); | ||
| 2070 | + } | ||
| 2071 | + repository.save(t); | ||
| 2072 | + } | ||
| 2073 | + } | ||
| 2074 | + } | ||
| 2075 | + | ||
| 2076 | + //重新统计油车数据结束 | ||
| 2077 | + | ||
| 2078 | + | ||
| 2079 | + //重新获取电耗数据开始 | ||
| 2080 | + Map<String, List<Dlb>> mapList=dlbService.updeteHistory(listpbDc, date, gsdm, fgsdm, line); | ||
| 2081 | + List<Dlb> delDlb=mapList.get("delList"); | ||
| 2082 | + for (int i = 0; i < delDlb.size(); i++) { | ||
| 2083 | + Dlb d=delDlb.get(i); | ||
| 2084 | + dlbRepository.deleteById(d.getId()); | ||
| 2085 | + } | ||
| 2086 | + List<Dlb> updDlb=mapList.get("updList"); | ||
| 2087 | + for (int i = 0; i < updDlb.size(); i++) { | ||
| 2088 | + Dlb d=updDlb.get(i); | ||
| 2089 | + try { | ||
| 2090 | + dlbRepository.save(d); | ||
| 2091 | + } catch (Exception e) { | ||
| 2092 | + // TODO: handle exception | ||
| 2093 | + if(e.getMessage().indexOf("PK_DLB_UK")>0){ | ||
| 2094 | + newMap.put("fage", "存在相同数据,数据已经过滤"); | ||
| 2095 | + logger.info("电量存在相同数据,数据已经过滤"); | ||
| 2096 | + } | ||
| 2097 | + } | ||
| 2098 | + } | ||
| 2099 | + //重新获取电耗数据结束 | ||
| 2100 | + | ||
| 2101 | + SysUser user = SecurityUtils.getCurrentUser(); | ||
| 2102 | + Nylog nylog=new Nylog(); | ||
| 2103 | + nylog.setCreatedate(new Date()); | ||
| 2104 | + nylog.setCzmc("重新统计"); | ||
| 2105 | + nylog.setNylx("油"); | ||
| 2106 | + nylog.setUserid(user.getUserName()); | ||
| 2107 | + nylog.setUsername(user.getName()); | ||
| 2108 | + nylog.setCxtj(line+"-"+ date+"-"+gsdm+"-"+fgsdm); | ||
| 2109 | + nylogRepository.save(nylog); | ||
| 2110 | + newMap.put("status", ResponseCode.SUCCESS); | ||
| 2111 | + }catch(Exception e){ | ||
| 2112 | + // TODO Auto-generated catch block | ||
| 2113 | + newMap.put("status", ResponseCode.ERROR); | ||
| 2114 | + throw e; | ||
| 2115 | + } | ||
| 2116 | + | ||
| 2117 | + | ||
| 2118 | + return newMap; | ||
| 2119 | + } | ||
| 2120 | + | ||
| 2121 | + public List<Ylb> listByRqJcsx(String rq,String gsdm,String fgsdm,String xlbm,String nbbm) { | ||
| 2122 | + List<Ylb> list=repository.listByRqJcsx(rq, gsdm, fgsdm, xlbm, nbbm); | ||
| 2123 | + Map<String, Object> m=new HashMap<String,Object>(); | ||
| 2124 | + List<Ylb> list_=new ArrayList<Ylb>(); | ||
| 2125 | + for (int i = 0; i < list.size(); i++) { | ||
| 2126 | + Ylb t=list.get(i); | ||
| 2127 | + if(m.get(t.getNbbm())==null){ | ||
| 2128 | + m.put(t.getNbbm(), t.getNbbm()); | ||
| 2129 | + list_.add(t); | ||
| 2130 | + } | ||
| 2131 | + } | ||
| 2132 | + return list_; | ||
| 2133 | + } | ||
| 2134 | + | ||
| 2135 | + @Override | ||
| 2136 | + public Map<String, Object> update(Map<String, Object> map) { | ||
| 2137 | + if(map.get("id")!=null){ | ||
| 2138 | + if(map.get("id").toString().length()>0){ | ||
| 2139 | + Integer id=Integer.parseInt(map.get("id").toString()); | ||
| 2140 | + String jsy=map.get("jsy").toString(); | ||
| 2141 | + Ylb t=repository.findById(id).get(); | ||
| 2142 | + t.setJsy(jsy); | ||
| 2143 | + repository.save(t); | ||
| 2144 | + map.put("status", ResponseCode.SUCCESS); | ||
| 2145 | + } | ||
| 2146 | + } | ||
| 2147 | + return map; | ||
| 2148 | + } | ||
| 2149 | +} |
src/main/java/com/bsth/service/report/ReportService.java
| @@ -20,7 +20,7 @@ public interface ReportService { | @@ -20,7 +20,7 @@ public interface ReportService { | ||
| 20 | List<Map<String, Object>> queryInOutStrtion(String line,String date,int zd,String lzsj); | 20 | List<Map<String, Object>> queryInOutStrtion(String line,String date,int zd,String lzsj); |
| 21 | 21 | ||
| 22 | List<Map<String, Object>> queryInOutStrtions(String line,String date,int zd,String lzsj); | 22 | List<Map<String, Object>> queryInOutStrtions(String line,String date,int zd,String lzsj); |
| 23 | - List<Map<String, String>> sreachZd(String line,int zdlx); | 23 | + List<Map<String, String>> sreachZd(String line,int zdlx, String date1, String date2); |
| 24 | 24 | ||
| 25 | List<Object[]> historyMessageCount(String line, String date, String code); | 25 | List<Object[]> historyMessageCount(String line, String date, String code); |
| 26 | List<Object[]> historyMessageList(String line, String date, String code,String type); | 26 | List<Object[]> historyMessageList(String line, String date, String code,String type); |
src/main/java/com/bsth/service/report/impl/ReportServiceImpl.java
| @@ -4,7 +4,6 @@ import com.bsth.data.BasicData; | @@ -4,7 +4,6 @@ import com.bsth.data.BasicData; | ||
| 4 | import com.bsth.entity.Line; | 4 | import com.bsth.entity.Line; |
| 5 | import com.bsth.entity.Personnel; | 5 | import com.bsth.entity.Personnel; |
| 6 | import com.bsth.entity.StationRoute; | 6 | import com.bsth.entity.StationRoute; |
| 7 | -import com.bsth.entity.calc.CalcStatistics; | ||
| 8 | import com.bsth.entity.excep.ArrivalInfo; | 7 | import com.bsth.entity.excep.ArrivalInfo; |
| 9 | import com.bsth.entity.mcy_forms.Singledata; | 8 | import com.bsth.entity.mcy_forms.Singledata; |
| 10 | import com.bsth.entity.oil.Dlb; | 9 | import com.bsth.entity.oil.Dlb; |
| @@ -14,6 +13,7 @@ import com.bsth.entity.realcontrol.ScheduleRealInfo; | @@ -14,6 +13,7 @@ import com.bsth.entity.realcontrol.ScheduleRealInfo; | ||
| 14 | import com.bsth.entity.sys.Dictionary; | 13 | import com.bsth.entity.sys.Dictionary; |
| 15 | import com.bsth.entity.sys.Interval; | 14 | import com.bsth.entity.sys.Interval; |
| 16 | import com.bsth.repository.LineRepository; | 15 | import com.bsth.repository.LineRepository; |
| 16 | +import com.bsth.repository.LsStationRouteRepository; | ||
| 17 | import com.bsth.repository.StationRouteRepository; | 17 | import com.bsth.repository.StationRouteRepository; |
| 18 | import com.bsth.repository.realcontrol.ScheduleRealInfoRepository; | 18 | import com.bsth.repository.realcontrol.ScheduleRealInfoRepository; |
| 19 | import com.bsth.service.LineService; | 19 | import com.bsth.service.LineService; |
| @@ -74,6 +74,8 @@ public class ReportServiceImpl implements ReportService{ | @@ -74,6 +74,8 @@ public class ReportServiceImpl implements ReportService{ | ||
| 74 | @Autowired | 74 | @Autowired |
| 75 | StationRouteRepository stationRouteRepository; | 75 | StationRouteRepository stationRouteRepository; |
| 76 | @Autowired | 76 | @Autowired |
| 77 | + LsStationRouteRepository lsStationRouteRepository; | ||
| 78 | + @Autowired | ||
| 77 | CulateMileageService culateMileageService; | 79 | CulateMileageService culateMileageService; |
| 78 | @Autowired | 80 | @Autowired |
| 79 | DictionaryService dictionaryService; | 81 | DictionaryService dictionaryService; |
| @@ -285,74 +287,24 @@ public class ReportServiceImpl implements ReportService{ | @@ -285,74 +287,24 @@ public class ReportServiceImpl implements ReportService{ | ||
| 285 | return list; | 287 | return list; |
| 286 | } | 288 | } |
| 287 | @Override | 289 | @Override |
| 288 | - public List<Map<String, String>> sreachZd(String line, int zdlx) { | 290 | + public List<Map<String, String>> sreachZd(String line, int zdlx, String date1, String date2) { |
| 289 | List<Map<String, String>> list = new ArrayList<>(); | 291 | List<Map<String, String>> list = new ArrayList<>(); |
| 290 | // TODO Auto-generated method stub | 292 | // TODO Auto-generated method stub |
| 291 | - | ||
| 292 | - List<StationRoute> listSr = stationRoutRepository.findAllByLine(line, zdlx); | ||
| 293 | - List<String> temp0List = new ArrayList<String>(), | ||
| 294 | - temp1List = new ArrayList<String>(); | ||
| 295 | - Map<String, List<String>> temp0 = new HashMap<String, List<String>>(); | ||
| 296 | - Map<String, List<String>> temp1 = new HashMap<String, List<String>>(); | ||
| 297 | - for(StationRoute sr : listSr){ | ||
| 298 | - String stationCode = sr.getStationCode().trim(); | ||
| 299 | - String stationName = sr.getStationName().trim(); | ||
| 300 | - if(sr.getDestroy() == 0){ | ||
| 301 | - if(!temp0.containsKey(stationName)){ | ||
| 302 | - temp0.put(stationName, new ArrayList<String>()); | ||
| 303 | - temp0List.add(stationName); | 293 | + if(date1.length() >= 10 && date1.length() >= 10){ |
| 294 | + date1 = date1.substring(0, 10); | ||
| 295 | + date2 = date2.substring(0, 10); | ||
| 296 | + List<Object[]> findHistory = lsStationRouteRepository.findHistory(line, zdlx, date1, date2); | ||
| 297 | + Set<String> tempSet = new HashSet<String>(); | ||
| 298 | + for(Object[] obj : findHistory){ | ||
| 299 | + if(obj[2] != null && obj[2].toString().trim().length() > 0){ | ||
| 300 | + tempSet.add(obj[2].toString().trim()); | ||
| 304 | } | 301 | } |
| 305 | - temp0.get(stationName).add(stationCode); | ||
| 306 | - } else if(sr.getDestroy() == 1){ | ||
| 307 | - if(!temp1.containsKey(stationName)){ | ||
| 308 | - temp1.put(stationName, new ArrayList<String>()); | ||
| 309 | - temp1List.add(stationName); | ||
| 310 | - } | ||
| 311 | - temp1.get(stationName).add(stationCode); | ||
| 312 | } | 302 | } |
| 313 | - } | ||
| 314 | - | ||
| 315 | - Set<String> keySet = temp0.keySet(); | ||
| 316 | - for(String key : temp0List){ | ||
| 317 | - Map<String, String> reMap = new HashMap<String, String>(); | ||
| 318 | - String stationCode_s = ""; | ||
| 319 | - List<String> list0 = temp0.get(key); | ||
| 320 | - for(String sc : list0){ | ||
| 321 | - if(stationCode_s.length() > 0) | ||
| 322 | - stationCode_s += ","; | ||
| 323 | - stationCode_s += sc; | ||
| 324 | - } | ||
| 325 | - if(temp1.containsKey(key)){ | ||
| 326 | - List<String> list1 = temp1.get(key); | ||
| 327 | - String sc1 = ""; | ||
| 328 | - for(String sc : list1){ | ||
| 329 | - if(sc1.length() > 0) | ||
| 330 | - sc1 += ","; | ||
| 331 | - sc1 += sc; | ||
| 332 | - } | ||
| 333 | - if(sc1.length() > 0 && stationCode_s.length() > 0){ | ||
| 334 | - stationCode_s = sc1 + "," + stationCode_s; | ||
| 335 | - } else { | ||
| 336 | - stationCode_s = sc1 + stationCode_s; | ||
| 337 | - } | ||
| 338 | - } | ||
| 339 | - reMap.put("id", stationCode_s); | ||
| 340 | - reMap.put("text", key); | ||
| 341 | - list.add(reMap); | ||
| 342 | - } | ||
| 343 | - | ||
| 344 | - for(String key : temp1List){ | ||
| 345 | - if(!(keySet.contains(key))){ | 303 | + for(Object[] obj : findHistory){ |
| 304 | + int length = tempSet.toArray().length; | ||
| 346 | Map<String, String> reMap = new HashMap<String, String>(); | 305 | Map<String, String> reMap = new HashMap<String, String>(); |
| 347 | - String stationCode_s = ""; | ||
| 348 | - List<String> list1 = temp1.get(key); | ||
| 349 | - for(String sc : list1){ | ||
| 350 | - if(stationCode_s.length() > 0) | ||
| 351 | - stationCode_s += ","; | ||
| 352 | - stationCode_s += sc; | ||
| 353 | - } | ||
| 354 | - reMap.put("id", stationCode_s); | ||
| 355 | - reMap.put("text", key + " (历史)"); | 306 | + reMap.put("id", obj[0].toString()); |
| 307 | + reMap.put("text", obj[1] + (length > 1 ? (" -版本" + obj[2]) : "")); | ||
| 356 | list.add(reMap); | 308 | list.add(reMap); |
| 357 | } | 309 | } |
| 358 | } | 310 | } |
src/main/java/com/bsth/service/schedule/datasync/VehicleDataSyncTaskServiceImpl.java
| @@ -148,28 +148,27 @@ public class VehicleDataSyncTaskServiceImpl extends BServiceImpl<VehicleDataSync | @@ -148,28 +148,27 @@ public class VehicleDataSyncTaskServiceImpl extends BServiceImpl<VehicleDataSync | ||
| 148 | .build()).start(); | 148 | .build()).start(); |
| 149 | // 3、等待同步结束 | 149 | // 3、等待同步结束 |
| 150 | countDownLatch.await(); | 150 | countDownLatch.await(); |
| 151 | - // 3-1、更新日志 | ||
| 152 | - task.setEndDate(new Date()); | ||
| 153 | - long runMills = task.getEndDate().getTime() - task.getStartDate().getTime(); | ||
| 154 | - task.setProcessSeconds((int) runMills / 1000); | ||
| 155 | - task.setStatus(VehicleDataSyncTaskStatusEnum.END); | ||
| 156 | - task.setProcessMsg("成功!"); | ||
| 157 | - super.save(task); | 151 | + |
| 158 | } catch (Exception exp) { | 152 | } catch (Exception exp) { |
| 159 | // 获取异常stack信息 | 153 | // 获取异常stack信息 |
| 160 | StringWriter sw = new StringWriter(); | 154 | StringWriter sw = new StringWriter(); |
| 161 | PrintWriter pw = new PrintWriter(sw); | 155 | PrintWriter pw = new PrintWriter(sw); |
| 162 | exp.printStackTrace(pw); | 156 | exp.printStackTrace(pw); |
| 157 | + task.setProcessMsg("有问题:" + StringUtils.substring(sw.toString(), 0, 1800)); // 日志限定长度 | ||
| 158 | + } finally { | ||
| 159 | + MDC.clear(); | ||
| 163 | 160 | ||
| 164 | - // 更新日志 | 161 | + // 3-1、更新执行信息 |
| 162 | + if (StringUtils.isEmpty(task.getProcessMsg())) { | ||
| 163 | + task.setProcessMsg("成功!"); | ||
| 164 | + } | ||
| 165 | + // 3-2、更新执行时间 | ||
| 165 | task.setEndDate(new Date()); | 166 | task.setEndDate(new Date()); |
| 166 | long runMills = task.getEndDate().getTime() - task.getStartDate().getTime(); | 167 | long runMills = task.getEndDate().getTime() - task.getStartDate().getTime(); |
| 167 | task.setProcessSeconds((int) runMills / 1000); | 168 | task.setProcessSeconds((int) runMills / 1000); |
| 168 | task.setStatus(VehicleDataSyncTaskStatusEnum.END); | 169 | task.setStatus(VehicleDataSyncTaskStatusEnum.END); |
| 169 | - task.setProcessMsg("有问题:" + StringUtils.substring(sw.toString(), 0, 1800)); // 日志限定长度 | 170 | + // 3-3、更新任务信息 |
| 170 | super.save(task); | 171 | super.save(task); |
| 171 | - } finally { | ||
| 172 | - MDC.clear(); | ||
| 173 | } | 172 | } |
| 174 | } | 173 | } |
| 175 | 174 |
src/main/java/com/bsth/service/schedule/datasync/task/VehicleDataSyncTaskThread.java
| @@ -104,8 +104,8 @@ public class VehicleDataSyncTaskThread implements Runnable { | @@ -104,8 +104,8 @@ public class VehicleDataSyncTaskThread implements Runnable { | ||
| 104 | vehicleDataSyncTask.setSyncUpdateCounts(Long.valueOf( | 104 | vehicleDataSyncTask.setSyncUpdateCounts(Long.valueOf( |
| 105 | processKtrStepMeatureMap.get("更新车辆数据输出").updates).intValue()); | 105 | processKtrStepMeatureMap.get("更新车辆数据输出").updates).intValue()); |
| 106 | vehicleDataSyncTask.setSyncErrorCounts(Long.valueOf( | 106 | vehicleDataSyncTask.setSyncErrorCounts(Long.valueOf( |
| 107 | - processKtrStepMeatureMap.get("新增车辆数据输出").errors + | ||
| 108 | - processKtrStepMeatureMap.get("更新车辆数据输出").errors).intValue()); | 107 | + processKtrStepMeatureMap.get("新增错误数据文件").writes + |
| 108 | + processKtrStepMeatureMap.get("更新错误数据文件").writes).intValue()); | ||
| 109 | 109 | ||
| 110 | LOG.info("ktr执行度量值:{}", processKtrStepMeatureMap); | 110 | LOG.info("ktr执行度量值:{}", processKtrStepMeatureMap); |
| 111 | 111 | ||
| @@ -190,7 +190,7 @@ public class VehicleDataSyncTaskThread implements Runnable { | @@ -190,7 +190,7 @@ public class VehicleDataSyncTaskThread implements Runnable { | ||
| 190 | ); | 190 | ); |
| 191 | LOG.info(stringBuffer.toString()); | 191 | LOG.info(stringBuffer.toString()); |
| 192 | 192 | ||
| 193 | - // 如果task内部有errors,更新日志 | 193 | + // 如果task内部有errors,更新执行信息 |
| 194 | if (processKtrStepMeatureMap.get("数据检验错误输出").writes > 0) { | 194 | if (processKtrStepMeatureMap.get("数据检验错误输出").writes > 0) { |
| 195 | task.setProcessMsg("有问题:存在数据检验错误,请查看日志!"); | 195 | task.setProcessMsg("有问题:存在数据检验错误,请查看日志!"); |
| 196 | } else if (processKtrStepMeatureMap.get("新增错误数据文件").writes > 0) { | 196 | } else if (processKtrStepMeatureMap.get("新增错误数据文件").writes > 0) { |
src/main/java/com/bsth/service/schedule/impl/SchedulePlanServiceImpl.java
| @@ -205,7 +205,7 @@ public class SchedulePlanServiceImpl extends BServiceImpl<SchedulePlan, Long> im | @@ -205,7 +205,7 @@ public class SchedulePlanServiceImpl extends BServiceImpl<SchedulePlan, Long> im | ||
| 205 | 205 | ||
| 206 | session.fireAllRules(); | 206 | session.fireAllRules(); |
| 207 | 207 | ||
| 208 | - session.dispose();; | 208 | + session.dispose(); |
| 209 | 209 | ||
| 210 | return result; | 210 | return result; |
| 211 | } | 211 | } |
src/main/java/com/bsth/service/schedule/impl/plan/kBase3/validate/timetable/ErrorBcCountFunction.java
| @@ -5,6 +5,10 @@ import org.apache.commons.lang3.StringUtils; | @@ -5,6 +5,10 @@ import org.apache.commons.lang3.StringUtils; | ||
| 5 | import org.kie.api.runtime.rule.AccumulateFunction; | 5 | import org.kie.api.runtime.rule.AccumulateFunction; |
| 6 | 6 | ||
| 7 | import java.io.*; | 7 | import java.io.*; |
| 8 | +import java.util.ArrayList; | ||
| 9 | +import java.util.HashMap; | ||
| 10 | +import java.util.List; | ||
| 11 | +import java.util.Map; | ||
| 8 | 12 | ||
| 9 | /** | 13 | /** |
| 10 | * Created by xu on 17/2/28. | 14 | * Created by xu on 17/2/28. |
| @@ -18,24 +22,68 @@ public class ErrorBcCountFunction implements AccumulateFunction { | @@ -18,24 +22,68 @@ public class ErrorBcCountFunction implements AccumulateFunction { | ||
| 18 | public void writeExternal(ObjectOutput out) throws IOException { | 22 | public void writeExternal(ObjectOutput out) throws IOException { |
| 19 | } | 23 | } |
| 20 | 24 | ||
| 21 | - protected static class ErrorCountData implements Externalizable { | ||
| 22 | - public long errorcount = 0; | 25 | + protected static class ErrorCountData implements Serializable { |
| 26 | + // TODO:这里暂时这样写,之后新版本去除 | ||
| 23 | public TTInfoDetail ttInfoDetail; | 27 | public TTInfoDetail ttInfoDetail; |
| 28 | + /** 错误班次map,key=ttinfodetailId value=ttinfodetail */ | ||
| 29 | + public Map<Long, TTInfoDetail> errorTtInfoDetailMap; | ||
| 30 | + // 空班次数 | ||
| 31 | + public Integer nullBcCount; | ||
| 32 | + /** 错误路牌map,key=路牌Id,value=路牌名字 */ | ||
| 33 | + public Map<Long, String> errorlpMap; | ||
| 24 | 34 | ||
| 25 | public ErrorCountData() { | 35 | public ErrorCountData() { |
| 36 | + nullBcCount = 0; | ||
| 37 | + errorTtInfoDetailMap = new HashMap<>(); | ||
| 38 | + errorlpMap = new HashMap<>(); | ||
| 26 | } | 39 | } |
| 27 | 40 | ||
| 28 | - @Override | ||
| 29 | - public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException { | ||
| 30 | - errorcount = in.readLong(); | ||
| 31 | - ttInfoDetail = (TTInfoDetail) in.readObject(); | 41 | + public void accTTInfoDetail(TTInfoDetail ttInfoDetail) { |
| 42 | + // 计算错误班次 | ||
| 43 | + | ||
| 44 | + if (ttInfoDetail.getTtinfo() == null) { | ||
| 45 | + nullBcCount ++; | ||
| 46 | + return; | ||
| 47 | + } | ||
| 48 | + | ||
| 49 | + // 判定条件(数据库中的对应字段没有非空约束),与界面saTimeTable.js的validInfo方法对应 | ||
| 50 | + // 1、起点站编码,名字为空 | ||
| 51 | + // 2、终点站编码,名字为空 | ||
| 52 | + // 3、班次时间 | ||
| 53 | + // TODO:其他再议 | ||
| 54 | + if (StringUtils.isEmpty(ttInfoDetail.getQdzCode()) || | ||
| 55 | + StringUtils.isEmpty(ttInfoDetail.getQdzName()) || | ||
| 56 | + StringUtils.isEmpty(ttInfoDetail.getZdzCode()) || | ||
| 57 | + StringUtils.isEmpty(ttInfoDetail.getZdzName()) || | ||
| 58 | + (ttInfoDetail.getBcsj() == null) ) { | ||
| 59 | + | ||
| 60 | + errorTtInfoDetailMap.put(ttInfoDetail.getId(), ttInfoDetail); | ||
| 61 | + } | ||
| 62 | + | ||
| 63 | + // 计算错误路牌 | ||
| 64 | + if (ttInfoDetail.getLp().getIsCancel()) { | ||
| 65 | + errorlpMap.put(ttInfoDetail.getLp().getId(), ttInfoDetail.getLp().getLpName()); | ||
| 66 | + } | ||
| 32 | } | 67 | } |
| 33 | 68 | ||
| 34 | - @Override | ||
| 35 | - public void writeExternal(ObjectOutput out) throws IOException { | ||
| 36 | - out.writeLong(errorcount); | ||
| 37 | - out.writeObject(ttInfoDetail); | 69 | + public void reTTInfoDetail(TTInfoDetail ttInfoDetail) { |
| 70 | + if (ttInfoDetail.getTtinfo() == null) { | ||
| 71 | + nullBcCount --; | ||
| 72 | + return; | ||
| 73 | + } | ||
| 74 | + if (StringUtils.isEmpty(ttInfoDetail.getQdzCode()) || | ||
| 75 | + StringUtils.isEmpty(ttInfoDetail.getQdzName()) || | ||
| 76 | + StringUtils.isEmpty(ttInfoDetail.getZdzCode()) || | ||
| 77 | + StringUtils.isEmpty(ttInfoDetail.getZdzName()) || | ||
| 78 | + (ttInfoDetail.getBcsj() == null) ) { | ||
| 79 | + | ||
| 80 | + errorTtInfoDetailMap.remove(ttInfoDetail.getId()); | ||
| 81 | + } | ||
| 82 | + if (ttInfoDetail.getLp().getIsCancel()) { | ||
| 83 | + errorlpMap.remove(ttInfoDetail.getLp().getId()); | ||
| 84 | + } | ||
| 38 | } | 85 | } |
| 86 | + | ||
| 39 | } | 87 | } |
| 40 | 88 | ||
| 41 | @Override | 89 | @Override |
| @@ -44,60 +92,42 @@ public class ErrorBcCountFunction implements AccumulateFunction { | @@ -44,60 +92,42 @@ public class ErrorBcCountFunction implements AccumulateFunction { | ||
| 44 | } | 92 | } |
| 45 | 93 | ||
| 46 | @Override | 94 | @Override |
| 47 | - public void init(Serializable context) throws Exception { | ||
| 48 | - ErrorCountData errorCountData = (ErrorCountData) context; | ||
| 49 | - errorCountData.errorcount = 0; | ||
| 50 | - } | 95 | + public void init(Serializable context) throws Exception { } |
| 51 | 96 | ||
| 52 | @Override | 97 | @Override |
| 53 | public void accumulate(Serializable context, Object value) { | 98 | public void accumulate(Serializable context, Object value) { |
| 54 | ErrorCountData errorCountData = (ErrorCountData) context; | 99 | ErrorCountData errorCountData = (ErrorCountData) context; |
| 55 | TTInfoDetail ttInfoDetail = (TTInfoDetail) value; | 100 | TTInfoDetail ttInfoDetail = (TTInfoDetail) value; |
| 56 | - | ||
| 57 | - if (ttInfoDetail.getTtinfo() == null) { | ||
| 58 | - errorCountData.errorcount ++; | ||
| 59 | - return; | ||
| 60 | - } | ||
| 61 | - | ||
| 62 | - // 判定条件(数据库中的对应字段没有非空约束),与界面saTimeTable.js的validInfo方法对应 | ||
| 63 | - // 1、起点站编码,名字为空 | ||
| 64 | - // 2、终点站编码,名字为空 | ||
| 65 | - // 3、班次时间 | ||
| 66 | - // TODO:其他再议 | ||
| 67 | - if (StringUtils.isEmpty(ttInfoDetail.getQdzCode()) || | ||
| 68 | - StringUtils.isEmpty(ttInfoDetail.getQdzName()) || | ||
| 69 | - StringUtils.isEmpty(ttInfoDetail.getZdzCode()) || | ||
| 70 | - StringUtils.isEmpty(ttInfoDetail.getZdzName()) || | ||
| 71 | - (ttInfoDetail.getBcsj() == null) ) { | ||
| 72 | - | ||
| 73 | - errorCountData.errorcount ++; | ||
| 74 | - } | 101 | + errorCountData.accTTInfoDetail(ttInfoDetail); |
| 75 | } | 102 | } |
| 76 | 103 | ||
| 77 | @Override | 104 | @Override |
| 78 | public void reverse(Serializable context, Object value) throws Exception { | 105 | public void reverse(Serializable context, Object value) throws Exception { |
| 79 | ErrorCountData errorCountData = (ErrorCountData) context; | 106 | ErrorCountData errorCountData = (ErrorCountData) context; |
| 80 | TTInfoDetail ttInfoDetail = (TTInfoDetail) value; | 107 | TTInfoDetail ttInfoDetail = (TTInfoDetail) value; |
| 81 | - | ||
| 82 | - if (ttInfoDetail.getTtinfo() == null) { | ||
| 83 | - errorCountData.errorcount --; | ||
| 84 | - return; | ||
| 85 | - } | ||
| 86 | - | ||
| 87 | - if (StringUtils.isEmpty(ttInfoDetail.getQdzCode()) || | ||
| 88 | - StringUtils.isEmpty(ttInfoDetail.getQdzName()) || | ||
| 89 | - StringUtils.isEmpty(ttInfoDetail.getZdzCode()) || | ||
| 90 | - StringUtils.isEmpty(ttInfoDetail.getZdzName()) ) { | ||
| 91 | - | ||
| 92 | - errorCountData.errorcount --; | ||
| 93 | - } | ||
| 94 | - | 108 | + errorCountData.reTTInfoDetail(ttInfoDetail); |
| 95 | } | 109 | } |
| 96 | 110 | ||
| 97 | @Override | 111 | @Override |
| 98 | public Object getResult(Serializable context) throws Exception { | 112 | public Object getResult(Serializable context) throws Exception { |
| 99 | ErrorCountData errorCountData = (ErrorCountData) context; | 113 | ErrorCountData errorCountData = (ErrorCountData) context; |
| 100 | - return errorCountData.errorcount; | 114 | + |
| 115 | + // 错误班次数 | ||
| 116 | + Integer errorBcCount = errorCountData.nullBcCount + errorCountData.errorTtInfoDetailMap.values().size(); | ||
| 117 | + // 错误路牌数 | ||
| 118 | + Integer errorLpCount = errorCountData.errorlpMap.values().size(); | ||
| 119 | + // 错误路牌描述 | ||
| 120 | + List<String> errorLpInfoList = new ArrayList<>(); | ||
| 121 | + for (String lpName: errorCountData.errorlpMap.values()) { | ||
| 122 | + errorLpInfoList.add("路牌" + "[" + lpName + "]" + "已作废"); | ||
| 123 | + } | ||
| 124 | + | ||
| 125 | + List<Object> resultObj = new ArrayList<>(3); | ||
| 126 | + resultObj.add(errorBcCount); | ||
| 127 | + resultObj.add(errorLpCount); | ||
| 128 | + resultObj.add(errorLpInfoList); | ||
| 129 | + | ||
| 130 | + return resultObj; | ||
| 101 | } | 131 | } |
| 102 | 132 | ||
| 103 | @Override | 133 | @Override |
| @@ -107,6 +137,6 @@ public class ErrorBcCountFunction implements AccumulateFunction { | @@ -107,6 +137,6 @@ public class ErrorBcCountFunction implements AccumulateFunction { | ||
| 107 | 137 | ||
| 108 | @Override | 138 | @Override |
| 109 | public Class<?> getResultType() { | 139 | public Class<?> getResultType() { |
| 110 | - return Number.class; | 140 | + return List.class; |
| 111 | } | 141 | } |
| 112 | } | 142 | } |
src/main/java/com/bsth/service/schedule/impl/plan/kBase3/validate/timetable/Result.java
| @@ -35,7 +35,12 @@ public class Result { | @@ -35,7 +35,12 @@ public class Result { | ||
| 35 | private Long yybc; | 35 | private Long yybc; |
| 36 | 36 | ||
| 37 | /** 错误班次数 */ | 37 | /** 错误班次数 */ |
| 38 | - private Long errorbc; | 38 | + private Integer errorbc; |
| 39 | + | ||
| 40 | + /** 错误路牌数 */ | ||
| 41 | + private Integer errorlpCount; | ||
| 42 | + /** 错误路牌描述 */ | ||
| 43 | + private List<String> errorlpInfo; | ||
| 39 | 44 | ||
| 40 | public Long getTtid() { | 45 | public Long getTtid() { |
| 41 | return ttid; | 46 | return ttid; |
| @@ -85,14 +90,10 @@ public class Result { | @@ -85,14 +90,10 @@ public class Result { | ||
| 85 | this.yybc = yybc; | 90 | this.yybc = yybc; |
| 86 | } | 91 | } |
| 87 | 92 | ||
| 88 | - public Long getErrorbc() { | 93 | + public Integer getErrorbc() { |
| 89 | return errorbc; | 94 | return errorbc; |
| 90 | } | 95 | } |
| 91 | 96 | ||
| 92 | - public void setErrorbc(Long errorbc) { | ||
| 93 | - this.errorbc = errorbc; | ||
| 94 | - } | ||
| 95 | - | ||
| 96 | public Integer getLineVersion() { | 97 | public Integer getLineVersion() { |
| 97 | return lineVersion; | 98 | return lineVersion; |
| 98 | } | 99 | } |
| @@ -100,5 +101,25 @@ public class Result { | @@ -100,5 +101,25 @@ public class Result { | ||
| 100 | public void setLineVersion(Integer lineVersion) { | 101 | public void setLineVersion(Integer lineVersion) { |
| 101 | this.lineVersion = lineVersion; | 102 | this.lineVersion = lineVersion; |
| 102 | } | 103 | } |
| 104 | + | ||
| 105 | + public void setErrorbc(Integer errorbc) { | ||
| 106 | + this.errorbc = errorbc; | ||
| 107 | + } | ||
| 108 | + | ||
| 109 | + public Integer getErrorlpCount() { | ||
| 110 | + return errorlpCount; | ||
| 111 | + } | ||
| 112 | + | ||
| 113 | + public void setErrorlpCount(Integer errorlpCount) { | ||
| 114 | + this.errorlpCount = errorlpCount; | ||
| 115 | + } | ||
| 116 | + | ||
| 117 | + public List<String> getErrorlpInfo() { | ||
| 118 | + return errorlpInfo; | ||
| 119 | + } | ||
| 120 | + | ||
| 121 | + public void setErrorlpInfo(List<String> errorlpInfo) { | ||
| 122 | + this.errorlpInfo = errorlpInfo; | ||
| 123 | + } | ||
| 103 | } | 124 | } |
| 104 | } | 125 | } |
src/main/java/com/bsth/util/IpUtils.java
| 1 | -package com.bsth.util; | ||
| 2 | - | ||
| 3 | -import javax.servlet.http.HttpServletRequest; | ||
| 4 | - | ||
| 5 | -public class IpUtils { | ||
| 6 | - | ||
| 7 | - public static String getIpAddr(HttpServletRequest request) { | ||
| 8 | - if (request == null) { | ||
| 9 | - return "unknown"; | ||
| 10 | - } | ||
| 11 | - String ip = request.getHeader("x-forwarded-for"); | ||
| 12 | - if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) { | ||
| 13 | - ip = request.getHeader("Proxy-Client-IP"); | ||
| 14 | - } | ||
| 15 | - if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) { | ||
| 16 | - ip = request.getHeader("X-Forwarded-For"); | ||
| 17 | - } | ||
| 18 | - if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) { | ||
| 19 | - ip = request.getHeader("WL-Proxy-Client-IP"); | ||
| 20 | - } | ||
| 21 | - if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) { | ||
| 22 | - ip = request.getHeader("X-Real-IP"); | ||
| 23 | - } | ||
| 24 | - if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) { | ||
| 25 | - ip = request.getRemoteAddr(); | ||
| 26 | - } | ||
| 27 | - return ip; | ||
| 28 | - } | ||
| 29 | -} | 1 | +package com.bsth.util; |
| 2 | + | ||
| 3 | +import javax.servlet.http.HttpServletRequest; | ||
| 4 | +import java.net.Inet4Address; | ||
| 5 | +import java.net.InetAddress; | ||
| 6 | +import java.net.NetworkInterface; | ||
| 7 | +import java.util.Enumeration; | ||
| 8 | + | ||
| 9 | +public class IpUtils { | ||
| 10 | + | ||
| 11 | + public static String getIpAddr(HttpServletRequest request) { | ||
| 12 | + if (request == null) { | ||
| 13 | + return "unknown"; | ||
| 14 | + } | ||
| 15 | + String ip = request.getHeader("x-forwarded-for"); | ||
| 16 | + if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) { | ||
| 17 | + ip = request.getHeader("Proxy-Client-IP"); | ||
| 18 | + } | ||
| 19 | + if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) { | ||
| 20 | + ip = request.getHeader("X-Forwarded-For"); | ||
| 21 | + } | ||
| 22 | + if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) { | ||
| 23 | + ip = request.getHeader("WL-Proxy-Client-IP"); | ||
| 24 | + } | ||
| 25 | + if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) { | ||
| 26 | + ip = request.getHeader("X-Real-IP"); | ||
| 27 | + } | ||
| 28 | + if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) { | ||
| 29 | + ip = request.getRemoteAddr(); | ||
| 30 | + } | ||
| 31 | + return ip; | ||
| 32 | + } | ||
| 33 | + | ||
| 34 | + /** | ||
| 35 | + * 获取本地IP地址 | ||
| 36 | + * @return | ||
| 37 | + */ | ||
| 38 | + public static String getLocalIpAddress() { | ||
| 39 | + try { | ||
| 40 | + Enumeration<NetworkInterface> allNetInterfaces = NetworkInterface.getNetworkInterfaces(); | ||
| 41 | + InetAddress ip = null; | ||
| 42 | + while (allNetInterfaces.hasMoreElements()) { | ||
| 43 | + NetworkInterface netInterface = (NetworkInterface) allNetInterfaces.nextElement(); | ||
| 44 | + if (netInterface.isLoopback() || netInterface.isVirtual() || !netInterface.isUp() || "docker0".equals(netInterface.getDisplayName())) { | ||
| 45 | + continue; | ||
| 46 | + } else { | ||
| 47 | + Enumeration<InetAddress> addresses = netInterface.getInetAddresses(); | ||
| 48 | + while (addresses.hasMoreElements()) { | ||
| 49 | + ip = addresses.nextElement(); | ||
| 50 | + if (ip != null && ip instanceof Inet4Address) { | ||
| 51 | + return ip.getHostAddress(); | ||
| 52 | + } | ||
| 53 | + } | ||
| 54 | + } | ||
| 55 | + } | ||
| 56 | + } catch (Exception e) { | ||
| 57 | + System.err.println("IP地址获取失败" + e.toString()); | ||
| 58 | + } | ||
| 59 | + | ||
| 60 | + return ""; | ||
| 61 | + } | ||
| 62 | +} |
src/main/resources/application-prod.properties
| @@ -9,7 +9,7 @@ spring.jpa.hibernate.naming.implicit-strategy=org.hibernate.boot.model.naming.Im | @@ -9,7 +9,7 @@ spring.jpa.hibernate.naming.implicit-strategy=org.hibernate.boot.model.naming.Im | ||
| 9 | spring.jpa.hibernate.naming.physical-strategy=org.springframework.boot.orm.jpa.hibernate.SpringPhysicalNamingStrategy | 9 | spring.jpa.hibernate.naming.physical-strategy=org.springframework.boot.orm.jpa.hibernate.SpringPhysicalNamingStrategy |
| 10 | spring.jpa.database= MYSQL | 10 | spring.jpa.database= MYSQL |
| 11 | spring.jpa.properties.hibernate.enable_lazy_load_no_trans=true | 11 | spring.jpa.properties.hibernate.enable_lazy_load_no_trans=true |
| 12 | -spring.jpa.show-sql= true | 12 | +spring.jpa.show-sql= false |
| 13 | 13 | ||
| 14 | #DATABASE | 14 | #DATABASE |
| 15 | spring.datasource.driver-class-name= com.mysql.jdbc.Driver | 15 | spring.datasource.driver-class-name= com.mysql.jdbc.Driver |
src/main/resources/datatools/config-dev.properties
| @@ -10,7 +10,7 @@ datatools.kvars_dbuname=root | @@ -10,7 +10,7 @@ datatools.kvars_dbuname=root | ||
| 10 | #数据库密码 | 10 | #数据库密码 |
| 11 | datatools.kvars_dbpwd= | 11 | datatools.kvars_dbpwd= |
| 12 | #数据库库名 | 12 | #数据库库名 |
| 13 | -datatools.kvars_dbdname=control | 13 | +datatools.kvars_dbdname=test_control |
| 14 | 14 | ||
| 15 | # 3、上传数据配置信息 | 15 | # 3、上传数据配置信息 |
| 16 | # 上传文件目录配置(根据不同的环境需要修正) | 16 | # 上传文件目录配置(根据不同的环境需要修正) |
src/main/resources/datatools/ktrs/vehicleDataSync.ktr
| @@ -36,17 +36,17 @@ | @@ -36,17 +36,17 @@ | ||
| 36 | </parameter> | 36 | </parameter> |
| 37 | <parameter> | 37 | <parameter> |
| 38 | <name>paramClzbh</name> | 38 | <name>paramClzbh</name> |
| 39 | - <default_value/> | 39 | + <default_value>S0I-052</default_value> |
| 40 | <description>参数-车辆自编号</description> | 40 | <description>参数-车辆自编号</description> |
| 41 | </parameter> | 41 | </parameter> |
| 42 | <parameter> | 42 | <parameter> |
| 43 | <name>paramFrom</name> | 43 | <name>paramFrom</name> |
| 44 | - <default_value>2021-01-01 00:00:00</default_value> | 44 | + <default_value/> |
| 45 | <description>参数-开始时间(格式:yyyy-MM-dd HH:mm:ss)</description> | 45 | <description>参数-开始时间(格式:yyyy-MM-dd HH:mm:ss)</description> |
| 46 | </parameter> | 46 | </parameter> |
| 47 | <parameter> | 47 | <parameter> |
| 48 | <name>paramTo</name> | 48 | <name>paramTo</name> |
| 49 | - <default_value>2021-05-01 00:00:00</default_value> | 49 | + <default_value/> |
| 50 | <description>参数-结束时间(格式:yyyy-MM-dd HH:mm:ss)</description> | 50 | <description>参数-结束时间(格式:yyyy-MM-dd HH:mm:ss)</description> |
| 51 | </parameter> | 51 | </parameter> |
| 52 | <parameter> | 52 | <parameter> |
| @@ -452,6 +452,33 @@ | @@ -452,6 +452,33 @@ | ||
| 452 | </attributes> | 452 | </attributes> |
| 453 | </connection> | 453 | </connection> |
| 454 | <connection> | 454 | <connection> |
| 455 | + <name>test_control_local</name> | ||
| 456 | + <server>localhost</server> | ||
| 457 | + <type>MYSQL</type> | ||
| 458 | + <access>Native</access> | ||
| 459 | + <database>test_control</database> | ||
| 460 | + <port>3306</port> | ||
| 461 | + <username>root</username> | ||
| 462 | + <password>Encrypted </password> | ||
| 463 | + <servername/> | ||
| 464 | + <data_tablespace/> | ||
| 465 | + <index_tablespace/> | ||
| 466 | + <attributes> | ||
| 467 | + <attribute><code>EXTRA_OPTION_MYSQL.defaultFetchSize</code><attribute>500</attribute></attribute> | ||
| 468 | + <attribute><code>EXTRA_OPTION_MYSQL.useCursorFetch</code><attribute>true</attribute></attribute> | ||
| 469 | + <attribute><code>FORCE_IDENTIFIERS_TO_LOWERCASE</code><attribute>N</attribute></attribute> | ||
| 470 | + <attribute><code>FORCE_IDENTIFIERS_TO_UPPERCASE</code><attribute>N</attribute></attribute> | ||
| 471 | + <attribute><code>IS_CLUSTERED</code><attribute>N</attribute></attribute> | ||
| 472 | + <attribute><code>PORT_NUMBER</code><attribute>3306</attribute></attribute> | ||
| 473 | + <attribute><code>PRESERVE_RESERVED_WORD_CASE</code><attribute>N</attribute></attribute> | ||
| 474 | + <attribute><code>QUOTE_ALL_FIELDS</code><attribute>N</attribute></attribute> | ||
| 475 | + <attribute><code>STREAM_RESULTS</code><attribute>Y</attribute></attribute> | ||
| 476 | + <attribute><code>SUPPORTS_BOOLEAN_DATA_TYPE</code><attribute>Y</attribute></attribute> | ||
| 477 | + <attribute><code>SUPPORTS_TIMESTAMP_DATA_TYPE</code><attribute>Y</attribute></attribute> | ||
| 478 | + <attribute><code>USE_POOLING</code><attribute>N</attribute></attribute> | ||
| 479 | + </attributes> | ||
| 480 | + </connection> | ||
| 481 | + <connection> | ||
| 455 | <name>test_control(本机)</name> | 482 | <name>test_control(本机)</name> |
| 456 | <server>127.0.0.1</server> | 483 | <server>127.0.0.1</server> |
| 457 | <type>MYSQL</type> | 484 | <type>MYSQL</type> |
| @@ -464,6 +491,7 @@ | @@ -464,6 +491,7 @@ | ||
| 464 | <data_tablespace/> | 491 | <data_tablespace/> |
| 465 | <index_tablespace/> | 492 | <index_tablespace/> |
| 466 | <attributes> | 493 | <attributes> |
| 494 | + <attribute><code>EXTRA_OPTION_MYSQL.characterEncoding</code><attribute>utf8</attribute></attribute> | ||
| 467 | <attribute><code>EXTRA_OPTION_MYSQL.defaultFetchSize</code><attribute>500</attribute></attribute> | 495 | <attribute><code>EXTRA_OPTION_MYSQL.defaultFetchSize</code><attribute>500</attribute></attribute> |
| 468 | <attribute><code>EXTRA_OPTION_MYSQL.useCursorFetch</code><attribute>true</attribute></attribute> | 496 | <attribute><code>EXTRA_OPTION_MYSQL.useCursorFetch</code><attribute>true</attribute></attribute> |
| 469 | <attribute><code>FORCE_IDENTIFIERS_TO_LOWERCASE</code><attribute>N</attribute></attribute> | 497 | <attribute><code>FORCE_IDENTIFIERS_TO_LOWERCASE</code><attribute>N</attribute></attribute> |
| @@ -669,8 +697,6 @@ | @@ -669,8 +697,6 @@ | ||
| 669 | <hop> <from>本地车辆信息查询 </from><to>本地车辆配置信息查询</to><enabled>Y</enabled> </hop> | 697 | <hop> <from>本地车辆信息查询 </from><to>本地车辆配置信息查询</to><enabled>Y</enabled> </hop> |
| 670 | <hop> <from>待更新数据</from><to>更新数据处理</to><enabled>Y</enabled> </hop> | 698 | <hop> <from>待更新数据</from><to>更新数据处理</to><enabled>Y</enabled> </hop> |
| 671 | <hop> <from>字段选择</from><to>待处理数据xls输出</to><enabled>Y</enabled> </hop> | 699 | <hop> <from>字段选择</from><to>待处理数据xls输出</to><enabled>Y</enabled> </hop> |
| 672 | - <hop> <from>更新数据处理</from><to>获取报废车辆数据(曾经配置过线路)</to><enabled>Y</enabled> </hop> | ||
| 673 | - <hop> <from>获取报废车辆数据(曾经配置过线路)</from><to>报废车辆管理设备数据处理</to><enabled>Y</enabled> </hop> | ||
| 674 | <hop> <from>本地车辆配置信息查询</from><to>本地线路信息查询</to><enabled>Y</enabled> </hop> | 700 | <hop> <from>本地车辆配置信息查询</from><to>本地线路信息查询</to><enabled>Y</enabled> </hop> |
| 675 | <hop> <from>本地线路信息查询</from><to>字段选择</to><enabled>Y</enabled> </hop> | 701 | <hop> <from>本地线路信息查询</from><to>字段选择</to><enabled>Y</enabled> </hop> |
| 676 | <hop> <from>本地线路信息查询</from><to>判定新增/更新数据</to><enabled>Y</enabled> </hop> | 702 | <hop> <from>本地线路信息查询</from><to>判定新增/更新数据</to><enabled>Y</enabled> </hop> |
| @@ -681,7 +707,11 @@ | @@ -681,7 +707,11 @@ | ||
| 681 | <hop> <from>新增车辆设备数据输出</from><to>添加车辆设备错误数据文件</to><enabled>Y</enabled> </hop> | 707 | <hop> <from>新增车辆设备数据输出</from><to>添加车辆设备错误数据文件</to><enabled>Y</enabled> </hop> |
| 682 | <hop> <from>更新数据处理</from><to>判定是否更新</to><enabled>Y</enabled> </hop> | 708 | <hop> <from>更新数据处理</from><to>判定是否更新</to><enabled>Y</enabled> </hop> |
| 683 | <hop> <from>更新车辆数据输出</from><to>更新错误数据文件</to><enabled>Y</enabled> </hop> | 709 | <hop> <from>更新车辆数据输出</from><to>更新错误数据文件</to><enabled>Y</enabled> </hop> |
| 684 | - <hop> <from>判定是否更新</from><to>更新车辆数据输出</to><enabled>Y</enabled> </hop> | 710 | + <hop> <from>判定是否更新</from><to>待处理更新数据</to><enabled>Y</enabled> </hop> |
| 711 | + <hop> <from>待处理更新数据</from><to>更新车辆数据输出</to><enabled>Y</enabled> </hop> | ||
| 712 | + <hop> <from>待处理更新数据</from><to>判断是否报废更新</to><enabled>Y</enabled> </hop> | ||
| 713 | + <hop> <from>判断是否报废更新</from><to>是否报废且曾经配置过线路</to><enabled>Y</enabled> </hop> | ||
| 714 | + <hop> <from>是否报废且曾经配置过线路</from><to>报废车辆管理设备数据处理</to><enabled>Y</enabled> </hop> | ||
| 685 | </order> | 715 | </order> |
| 686 | <step> | 716 | <step> |
| 687 | <name>JavaScript解析json生成数据</name> | 717 | <name>JavaScript解析json生成数据</name> |
| @@ -971,7 +1001,7 @@ | @@ -971,7 +1001,7 @@ | ||
| 971 | <method>none</method> | 1001 | <method>none</method> |
| 972 | <schema_name/> | 1002 | <schema_name/> |
| 973 | </partitioning> | 1003 | </partitioning> |
| 974 | -<send_true_to>更新车辆数据输出</send_true_to> | 1004 | +<send_true_to>待处理更新数据</send_true_to> |
| 975 | <send_false_to/> | 1005 | <send_false_to/> |
| 976 | <compare> | 1006 | <compare> |
| 977 | <condition> | 1007 | <condition> |
| @@ -995,8 +1025,43 @@ | @@ -995,8 +1025,43 @@ | ||
| 995 | </compare> | 1025 | </compare> |
| 996 | <cluster_schema/> | 1026 | <cluster_schema/> |
| 997 | <remotesteps> <input> </input> <output> </output> </remotesteps> <GUI> | 1027 | <remotesteps> <input> </input> <output> </output> </remotesteps> <GUI> |
| 998 | - <xloc>754</xloc> | ||
| 999 | - <yloc>312</yloc> | 1028 | + <xloc>822</xloc> |
| 1029 | + <yloc>311</yloc> | ||
| 1030 | + <draw>Y</draw> | ||
| 1031 | + </GUI> | ||
| 1032 | + </step> | ||
| 1033 | + | ||
| 1034 | + <step> | ||
| 1035 | + <name>判断是否报废更新</name> | ||
| 1036 | + <type>FilterRows</type> | ||
| 1037 | + <description/> | ||
| 1038 | + <distribute>Y</distribute> | ||
| 1039 | + <custom_distribution/> | ||
| 1040 | + <copies>1</copies> | ||
| 1041 | + <partitioning> | ||
| 1042 | + <method>none</method> | ||
| 1043 | + <schema_name/> | ||
| 1044 | + </partitioning> | ||
| 1045 | +<send_true_to>是否报废且曾经配置过线路</send_true_to> | ||
| 1046 | +<send_false_to/> | ||
| 1047 | + <compare> | ||
| 1048 | +<condition> | ||
| 1049 | + <negated>N</negated> | ||
| 1050 | + <conditions> | ||
| 1051 | + <condition> | ||
| 1052 | + <negated>N</negated> | ||
| 1053 | + <operator>OR</operator> | ||
| 1054 | + <leftvalue>isScrapUpdate</leftvalue> | ||
| 1055 | + <function>=</function> | ||
| 1056 | + <rightvalue/> | ||
| 1057 | + <value><name>constant</name><type>Boolean</type><text>Y</text><length>-1</length><precision>-1</precision><isnull>N</isnull><mask/></value> </condition> | ||
| 1058 | + </conditions> | ||
| 1059 | + </condition> | ||
| 1060 | + </compare> | ||
| 1061 | + <cluster_schema/> | ||
| 1062 | + <remotesteps> <input> </input> <output> </output> </remotesteps> <GUI> | ||
| 1063 | + <xloc>672</xloc> | ||
| 1064 | + <yloc>497</yloc> | ||
| 1000 | <draw>Y</draw> | 1065 | <draw>Y</draw> |
| 1001 | </GUI> | 1066 | </GUI> |
| 1002 | </step> | 1067 | </step> |
| @@ -1279,6 +1344,25 @@ | @@ -1279,6 +1344,25 @@ | ||
| 1279 | </step> | 1344 | </step> |
| 1280 | 1345 | ||
| 1281 | <step> | 1346 | <step> |
| 1347 | + <name>待处理更新数据</name> | ||
| 1348 | + <type>Dummy</type> | ||
| 1349 | + <description/> | ||
| 1350 | + <distribute>N</distribute> | ||
| 1351 | + <custom_distribution/> | ||
| 1352 | + <copies>1</copies> | ||
| 1353 | + <partitioning> | ||
| 1354 | + <method>none</method> | ||
| 1355 | + <schema_name/> | ||
| 1356 | + </partitioning> | ||
| 1357 | + <cluster_schema/> | ||
| 1358 | + <remotesteps> <input> </input> <output> </output> </remotesteps> <GUI> | ||
| 1359 | + <xloc>673</xloc> | ||
| 1360 | + <yloc>406</yloc> | ||
| 1361 | + <draw>Y</draw> | ||
| 1362 | + </GUI> | ||
| 1363 | + </step> | ||
| 1364 | + | ||
| 1365 | + <step> | ||
| 1282 | <name>待新增数据</name> | 1366 | <name>待新增数据</name> |
| 1283 | <type>Dummy</type> | 1367 | <type>Dummy</type> |
| 1284 | <description/> | 1368 | <description/> |
| @@ -2085,10 +2169,51 @@ | @@ -2085,10 +2169,51 @@ | ||
| 2085 | </step> | 2169 | </step> |
| 2086 | 2170 | ||
| 2087 | <step> | 2171 | <step> |
| 2172 | + <name>是否报废且曾经配置过线路</name> | ||
| 2173 | + <type>FilterRows</type> | ||
| 2174 | + <description/> | ||
| 2175 | + <distribute>Y</distribute> | ||
| 2176 | + <custom_distribution/> | ||
| 2177 | + <copies>1</copies> | ||
| 2178 | + <partitioning> | ||
| 2179 | + <method>none</method> | ||
| 2180 | + <schema_name/> | ||
| 2181 | + </partitioning> | ||
| 2182 | +<send_true_to>报废车辆管理设备数据处理</send_true_to> | ||
| 2183 | +<send_false_to/> | ||
| 2184 | + <compare> | ||
| 2185 | +<condition> | ||
| 2186 | + <negated>N</negated> | ||
| 2187 | + <conditions> | ||
| 2188 | + <condition> | ||
| 2189 | + <negated>N</negated> | ||
| 2190 | + <leftvalue>scrapState_update</leftvalue> | ||
| 2191 | + <function>=</function> | ||
| 2192 | + <rightvalue/> | ||
| 2193 | + <value><name>constant</name><type>String</type><text>1</text><length>-1</length><precision>-1</precision><isnull>N</isnull><mask/></value> </condition> | ||
| 2194 | + <condition> | ||
| 2195 | + <negated>N</negated> | ||
| 2196 | + <operator>AND</operator> | ||
| 2197 | + <leftvalue>xl</leftvalue> | ||
| 2198 | + <function>IS NOT NULL</function> | ||
| 2199 | + <rightvalue/> | ||
| 2200 | + </condition> | ||
| 2201 | + </conditions> | ||
| 2202 | + </condition> | ||
| 2203 | + </compare> | ||
| 2204 | + <cluster_schema/> | ||
| 2205 | + <remotesteps> <input> </input> <output> </output> </remotesteps> <GUI> | ||
| 2206 | + <xloc>513</xloc> | ||
| 2207 | + <yloc>585</yloc> | ||
| 2208 | + <draw>Y</draw> | ||
| 2209 | + </GUI> | ||
| 2210 | + </step> | ||
| 2211 | + | ||
| 2212 | + <step> | ||
| 2088 | <name>更新数据处理</name> | 2213 | <name>更新数据处理</name> |
| 2089 | <type>ScriptValueMod</type> | 2214 | <type>ScriptValueMod</type> |
| 2090 | <description/> | 2215 | <description/> |
| 2091 | - <distribute>N</distribute> | 2216 | + <distribute>Y</distribute> |
| 2092 | <custom_distribution/> | 2217 | <custom_distribution/> |
| 2093 | <copies>1</copies> | 2218 | <copies>1</copies> |
| 2094 | <partitioning> | 2219 | <partitioning> |
| @@ -2099,7 +2224,7 @@ | @@ -2099,7 +2224,7 @@ | ||
| 2099 | <optimizationLevel>9</optimizationLevel> | 2224 | <optimizationLevel>9</optimizationLevel> |
| 2100 | <jsScripts> <jsScript> <jsScript_type>0</jsScript_type> | 2225 | <jsScripts> <jsScript> <jsScript_type>0</jsScript_type> |
| 2101 | <jsScript_name>Script 1</jsScript_name> | 2226 | <jsScript_name>Script 1</jsScript_name> |
| 2102 | - <jsScript_script>//Script here

//---------------- 更新用的字段重新命名(方便后续操作)-----------//
// TODO:后面还有更多的更新字段

var update_date = new Date();

//------------ 1、公司分公司相关字段 -----------//
var company_update = gsmc; // 公司名称
var branche_company_update = fgsmc; // 分公司名称
var business_code_update = gsdm; // 公司代码
var branch_company_code_update = fgsdm; // 分公司代码
var isGsUpdate = false; // 是否更新
if (!company_update.equals(company)) {
 isGsUpdate = true;
}
if (!branche_company_update.equals(branche_company)) {
 isGsUpdate = true;
}

//------------- 2、报废相关字段 ------------//
var equipmentCode_update = equipment_code; // 设备编号
var scrapCode_update = scrap_code; // 报废号
var scrapState_update = (scrap_state == true ? 1 : 0); // 报废状态
var scrapState_update_b = scrap_state; // 报废状态
var scrapDate_update = scrap_date; // 报废日期
var isScrapUpdate = false; // 是否更新
if (carState == '3' || scrapType == '1') {
 scrapState_update_b = true;
 scrapState_update = 1;
 scrapDate_update = scrapDate == null ? null : str2date(scrapDate, 'yyyy-MM-dd');
 equipmentCode_update = 'BF-' + equipmentCode_update;
 scrapCode_update = 'BF-' + equipmentCode_update;
}
if (scrapState_update_b != scrap_state) {
 isScrapUpdate = true;
}</jsScript_script> | 2227 | + <jsScript_script>//Script here

//---------------- 更新用的字段重新命名(方便后续操作)-----------//
// TODO:后面还有更多的更新字段

var update_date = new Date();

//------------ 1、公司分公司相关字段 -----------//
var company_update = gsmc; // 公司名称
var branche_company_update = fgsmc; // 分公司名称
var business_code_update = gsdm; // 公司代码
var branch_company_code_update = fgsdm; // 分公司代码
var isGsUpdate = false; // 是否更新
if (!company_update.equals(company)) {
 isGsUpdate = true;
}
if (!branche_company_update.equals(branche_company)) {
 isGsUpdate = true;
}

//------------- 2、报废相关字段 ------------//
var equipmentCode_update = equipment_code; // 设备编号
var scrapCode_update = scrap_code; // 报废号
var scrapState_update = (scrap_state == true ? 1 : 0); // 报废状态
var scrapState_update_b = scrap_state; // 报废状态
var scrapDate_update = scrap_date; // 报废日期
var isScrapUpdate = false; // 是否更新
if (carState == '3' || scrapType == '1') {
 scrapState_update_b = true;
 scrapState_update = 1;
 // 使用车辆库的报废时间
 scrapDate_update = scrapDate == null ? null : str2date(scrapDate, 'yyyy-MM-dd');
 // 车辆库报废时间为空,再使用当前时间
 if (scrapDate_update == null) {
 scrapDate_update = new Date(); // 报废日期设定位当前日期
 }
 equipmentCode_update = 'BF-' + equipmentCode_update;
 scrapCode_update = 'BF-' + equipmentCode_update;
}
if (scrapState_update_b != scrap_state) {
 isScrapUpdate = true;
}</jsScript_script> |
| 2103 | </jsScript> </jsScripts> <fields> <field> <name>update_date</name> | 2228 | </jsScript> </jsScripts> <fields> <field> <name>update_date</name> |
| 2104 | <rename>update_date</rename> | 2229 | <rename>update_date</rename> |
| 2105 | <type>Date</type> | 2230 | <type>Date</type> |
| @@ -2162,7 +2287,7 @@ | @@ -2162,7 +2287,7 @@ | ||
| 2162 | <replace>N</replace> | 2287 | <replace>N</replace> |
| 2163 | </field> <field> <name>scrapDate_update</name> | 2288 | </field> <field> <name>scrapDate_update</name> |
| 2164 | <rename>scrapDate_update</rename> | 2289 | <rename>scrapDate_update</rename> |
| 2165 | - <type>String</type> | 2290 | + <type>Date</type> |
| 2166 | <length>-1</length> | 2291 | <length>-1</length> |
| 2167 | <precision>-1</precision> | 2292 | <precision>-1</precision> |
| 2168 | <replace>N</replace> | 2293 | <replace>N</replace> |
| @@ -2174,17 +2299,17 @@ | @@ -2174,17 +2299,17 @@ | ||
| 2174 | <replace>N</replace> | 2299 | <replace>N</replace> |
| 2175 | </field> </fields> <cluster_schema/> | 2300 | </field> </fields> <cluster_schema/> |
| 2176 | <remotesteps> <input> </input> <output> </output> </remotesteps> <GUI> | 2301 | <remotesteps> <input> </input> <output> </output> </remotesteps> <GUI> |
| 2177 | - <xloc>674</xloc> | ||
| 2178 | - <yloc>403</yloc> | 2302 | + <xloc>670</xloc> |
| 2303 | + <yloc>309</yloc> | ||
| 2179 | <draw>Y</draw> | 2304 | <draw>Y</draw> |
| 2180 | </GUI> | 2305 | </GUI> |
| 2181 | </step> | 2306 | </step> |
| 2182 | 2307 | ||
| 2183 | <step> | 2308 | <step> |
| 2184 | - <name>本地线路信息查询</name> | ||
| 2185 | - <type>DBLookup</type> | 2309 | + <name>更新车辆数据输出</name> |
| 2310 | + <type>Update</type> | ||
| 2186 | <description/> | 2311 | <description/> |
| 2187 | - <distribute>N</distribute> | 2312 | + <distribute>Y</distribute> |
| 2188 | <custom_distribution/> | 2313 | <custom_distribution/> |
| 2189 | <copies>1</copies> | 2314 | <copies>1</copies> |
| 2190 | <partitioning> | 2315 | <partitioning> |
| @@ -2192,45 +2317,68 @@ | @@ -2192,45 +2317,68 @@ | ||
| 2192 | <schema_name/> | 2317 | <schema_name/> |
| 2193 | </partitioning> | 2318 | </partitioning> |
| 2194 | <connection>control_jndi</connection> | 2319 | <connection>control_jndi</connection> |
| 2195 | - <cache>Y</cache> | ||
| 2196 | - <cache_load_all>Y</cache_load_all> | ||
| 2197 | - <cache_size>0</cache_size> | 2320 | + <skip_lookup>N</skip_lookup> |
| 2321 | + <commit>100</commit> | ||
| 2322 | + <use_batch>N</use_batch> | ||
| 2323 | + <error_ignored>N</error_ignored> | ||
| 2324 | + <ignore_flag_field/> | ||
| 2198 | <lookup> | 2325 | <lookup> |
| 2199 | <schema/> | 2326 | <schema/> |
| 2200 | - <table>bsth_c_line</table> | ||
| 2201 | - <orderby/> | ||
| 2202 | - <fail_on_multiple>N</fail_on_multiple> | ||
| 2203 | - <eat_row_on_failure>N</eat_row_on_failure> | 2327 | + <table>bsth_c_cars</table> |
| 2204 | <key> | 2328 | <key> |
| 2205 | - <name>xl</name> | 2329 | + <name>id</name> |
| 2206 | <field>id</field> | 2330 | <field>id</field> |
| 2207 | <condition>=</condition> | 2331 | <condition>=</condition> |
| 2208 | <name2/> | 2332 | <name2/> |
| 2209 | - </key> | 2333 | + </key> |
| 2210 | <value> | 2334 | <value> |
| 2211 | - <name>line_code</name> | ||
| 2212 | - <rename>line_code</rename> | ||
| 2213 | - <default/> | ||
| 2214 | - <type>None</type> | ||
| 2215 | - </value> | 2335 | + <name>equipment_code</name> |
| 2336 | + <rename>equipmentCode_update</rename> | ||
| 2337 | + </value> | ||
| 2216 | <value> | 2338 | <value> |
| 2217 | - <name>name</name> | ||
| 2218 | - <rename>name</rename> | ||
| 2219 | - <default/> | ||
| 2220 | - <type>None</type> | ||
| 2221 | - </value> | ||
| 2222 | - </lookup> | 2339 | + <name>scrap_code</name> |
| 2340 | + <rename>scrapCode_update</rename> | ||
| 2341 | + </value> | ||
| 2342 | + <value> | ||
| 2343 | + <name>scrap_date</name> | ||
| 2344 | + <rename>scrapDate_update</rename> | ||
| 2345 | + </value> | ||
| 2346 | + <value> | ||
| 2347 | + <name>scrap_state</name> | ||
| 2348 | + <rename>scrapState_update</rename> | ||
| 2349 | + </value> | ||
| 2350 | + <value> | ||
| 2351 | + <name>company</name> | ||
| 2352 | + <rename>company_update</rename> | ||
| 2353 | + </value> | ||
| 2354 | + <value> | ||
| 2355 | + <name>business_code</name> | ||
| 2356 | + <rename>business_code_update</rename> | ||
| 2357 | + </value> | ||
| 2358 | + <value> | ||
| 2359 | + <name>branche_company</name> | ||
| 2360 | + <rename>branche_company_update</rename> | ||
| 2361 | + </value> | ||
| 2362 | + <value> | ||
| 2363 | + <name>branche_company_code</name> | ||
| 2364 | + <rename>branch_company_code_update</rename> | ||
| 2365 | + </value> | ||
| 2366 | + <value> | ||
| 2367 | + <name>update_date</name> | ||
| 2368 | + <rename>update_date</rename> | ||
| 2369 | + </value> | ||
| 2370 | + </lookup> | ||
| 2223 | <cluster_schema/> | 2371 | <cluster_schema/> |
| 2224 | <remotesteps> <input> </input> <output> </output> </remotesteps> <GUI> | 2372 | <remotesteps> <input> </input> <output> </output> </remotesteps> <GUI> |
| 2225 | - <xloc>340</xloc> | ||
| 2226 | - <yloc>582</yloc> | 2373 | + <xloc>820</xloc> |
| 2374 | + <yloc>404</yloc> | ||
| 2227 | <draw>Y</draw> | 2375 | <draw>Y</draw> |
| 2228 | </GUI> | 2376 | </GUI> |
| 2229 | </step> | 2377 | </step> |
| 2230 | 2378 | ||
| 2231 | <step> | 2379 | <step> |
| 2232 | - <name>本地车辆信息查询 </name> | ||
| 2233 | - <type>DBLookup</type> | 2380 | + <name>更新错误数据文件</name> |
| 2381 | + <type>ExcelOutput</type> | ||
| 2234 | <description/> | 2382 | <description/> |
| 2235 | <distribute>Y</distribute> | 2383 | <distribute>Y</distribute> |
| 2236 | <custom_distribution/> | 2384 | <custom_distribution/> |
| @@ -2239,30 +2387,215 @@ | @@ -2239,30 +2387,215 @@ | ||
| 2239 | <method>none</method> | 2387 | <method>none</method> |
| 2240 | <schema_name/> | 2388 | <schema_name/> |
| 2241 | </partitioning> | 2389 | </partitioning> |
| 2242 | - <connection>control_jndi</connection> | ||
| 2243 | - <cache>Y</cache> | ||
| 2244 | - <cache_load_all>Y</cache_load_all> | ||
| 2245 | - <cache_size>0</cache_size> | ||
| 2246 | - <lookup> | ||
| 2247 | - <schema/> | ||
| 2248 | - <table>bsth_c_cars</table> | ||
| 2249 | - <orderby>update_date desc</orderby> | ||
| 2250 | - <fail_on_multiple>N</fail_on_multiple> | ||
| 2251 | - <eat_row_on_failure>N</eat_row_on_failure> | ||
| 2252 | - <key> | 2390 | + <header>Y</header> |
| 2391 | + <footer>N</footer> | ||
| 2392 | + <encoding/> | ||
| 2393 | + <append>N</append> | ||
| 2394 | + <add_to_result_filenames>Y</add_to_result_filenames> | ||
| 2395 | + <file> | ||
| 2396 | + <name>${file_update_error}</name> | ||
| 2397 | + <extention>xls</extention> | ||
| 2398 | + <do_not_open_newfile_init>N</do_not_open_newfile_init> | ||
| 2399 | + <create_parent_folder>N</create_parent_folder> | ||
| 2400 | + <split>N</split> | ||
| 2401 | + <add_date>N</add_date> | ||
| 2402 | + <add_time>N</add_time> | ||
| 2403 | + <SpecifyFormat>N</SpecifyFormat> | ||
| 2404 | + <date_time_format/> | ||
| 2405 | + <sheetname>Sheet1</sheetname> | ||
| 2406 | + <autosizecolums>N</autosizecolums> | ||
| 2407 | + <nullisblank>N</nullisblank> | ||
| 2408 | + <protect_sheet>N</protect_sheet> | ||
| 2409 | + <password>Encrypted </password> | ||
| 2410 | + <splitevery>0</splitevery> | ||
| 2411 | + <usetempfiles>N</usetempfiles> | ||
| 2412 | + <tempdirectory/> | ||
| 2413 | + </file> | ||
| 2414 | + <template> | ||
| 2415 | + <enabled>N</enabled> | ||
| 2416 | + <append>N</append> | ||
| 2417 | + <filename>template.xls</filename> | ||
| 2418 | + </template> | ||
| 2419 | + <fields> | ||
| 2420 | + <field> | ||
| 2253 | <name>clzbh</name> | 2421 | <name>clzbh</name> |
| 2254 | - <field>inside_code</field> | ||
| 2255 | - <condition>=</condition> | ||
| 2256 | - <name2/> | ||
| 2257 | - </key> | ||
| 2258 | - <value> | 2422 | + <type>String</type> |
| 2423 | + <format/> | ||
| 2424 | + </field> | ||
| 2425 | + <field> | ||
| 2259 | <name>id</name> | 2426 | <name>id</name> |
| 2260 | - <rename>id</rename> | ||
| 2261 | - <default/> | ||
| 2262 | <type>Integer</type> | 2427 | <type>Integer</type> |
| 2263 | - </value> | ||
| 2264 | - <value> | ||
| 2265 | - <name>equipment_code</name> | 2428 | + <format/> |
| 2429 | + </field> | ||
| 2430 | + <field> | ||
| 2431 | + <name>company_update</name> | ||
| 2432 | + <type>String</type> | ||
| 2433 | + <format/> | ||
| 2434 | + </field> | ||
| 2435 | + <field> | ||
| 2436 | + <name>branche_company_update</name> | ||
| 2437 | + <type>String</type> | ||
| 2438 | + <format/> | ||
| 2439 | + </field> | ||
| 2440 | + <field> | ||
| 2441 | + <name>business_code_update</name> | ||
| 2442 | + <type>String</type> | ||
| 2443 | + <format/> | ||
| 2444 | + </field> | ||
| 2445 | + <field> | ||
| 2446 | + <name>branch_company_code_update</name> | ||
| 2447 | + <type>String</type> | ||
| 2448 | + <format/> | ||
| 2449 | + </field> | ||
| 2450 | + <field> | ||
| 2451 | + <name>equipmentCode_update</name> | ||
| 2452 | + <type>String</type> | ||
| 2453 | + <format/> | ||
| 2454 | + </field> | ||
| 2455 | + <field> | ||
| 2456 | + <name>scrapCode_update</name> | ||
| 2457 | + <type>String</type> | ||
| 2458 | + <format/> | ||
| 2459 | + </field> | ||
| 2460 | + <field> | ||
| 2461 | + <name>scrapState_update</name> | ||
| 2462 | + <type>Integer</type> | ||
| 2463 | + <format/> | ||
| 2464 | + </field> | ||
| 2465 | + <field> | ||
| 2466 | + <name>scrapDate_update</name> | ||
| 2467 | + <type>String</type> | ||
| 2468 | + <format/> | ||
| 2469 | + </field> | ||
| 2470 | + <field> | ||
| 2471 | + <name>NrErrors</name> | ||
| 2472 | + <type>Integer</type> | ||
| 2473 | + <format/> | ||
| 2474 | + </field> | ||
| 2475 | + <field> | ||
| 2476 | + <name>ErrorDescription</name> | ||
| 2477 | + <type>String</type> | ||
| 2478 | + <format/> | ||
| 2479 | + </field> | ||
| 2480 | + <field> | ||
| 2481 | + <name>ErrorFields</name> | ||
| 2482 | + <type>String</type> | ||
| 2483 | + <format/> | ||
| 2484 | + </field> | ||
| 2485 | + <field> | ||
| 2486 | + <name>ErrorCodes</name> | ||
| 2487 | + <type>String</type> | ||
| 2488 | + <format/> | ||
| 2489 | + </field> | ||
| 2490 | + </fields> | ||
| 2491 | + <custom> | ||
| 2492 | + <header_font_name>arial</header_font_name> | ||
| 2493 | + <header_font_size>10</header_font_size> | ||
| 2494 | + <header_font_bold>N</header_font_bold> | ||
| 2495 | + <header_font_italic>N</header_font_italic> | ||
| 2496 | + <header_font_underline>no</header_font_underline> | ||
| 2497 | + <header_font_orientation>horizontal</header_font_orientation> | ||
| 2498 | + <header_font_color>black</header_font_color> | ||
| 2499 | + <header_background_color>none</header_background_color> | ||
| 2500 | + <header_row_height>255</header_row_height> | ||
| 2501 | + <header_alignment>left</header_alignment> | ||
| 2502 | + <header_image/> | ||
| 2503 | + <row_font_name>arial</row_font_name> | ||
| 2504 | + <row_font_size>10</row_font_size> | ||
| 2505 | + <row_font_color>black</row_font_color> | ||
| 2506 | + <row_background_color>none</row_background_color> | ||
| 2507 | + </custom> | ||
| 2508 | + <cluster_schema/> | ||
| 2509 | + <remotesteps> <input> </input> <output> </output> </remotesteps> <GUI> | ||
| 2510 | + <xloc>972</xloc> | ||
| 2511 | + <yloc>404</yloc> | ||
| 2512 | + <draw>Y</draw> | ||
| 2513 | + </GUI> | ||
| 2514 | + </step> | ||
| 2515 | + | ||
| 2516 | + <step> | ||
| 2517 | + <name>本地线路信息查询</name> | ||
| 2518 | + <type>DBLookup</type> | ||
| 2519 | + <description/> | ||
| 2520 | + <distribute>N</distribute> | ||
| 2521 | + <custom_distribution/> | ||
| 2522 | + <copies>1</copies> | ||
| 2523 | + <partitioning> | ||
| 2524 | + <method>none</method> | ||
| 2525 | + <schema_name/> | ||
| 2526 | + </partitioning> | ||
| 2527 | + <connection>control_jndi</connection> | ||
| 2528 | + <cache>Y</cache> | ||
| 2529 | + <cache_load_all>Y</cache_load_all> | ||
| 2530 | + <cache_size>0</cache_size> | ||
| 2531 | + <lookup> | ||
| 2532 | + <schema/> | ||
| 2533 | + <table>bsth_c_line</table> | ||
| 2534 | + <orderby/> | ||
| 2535 | + <fail_on_multiple>N</fail_on_multiple> | ||
| 2536 | + <eat_row_on_failure>N</eat_row_on_failure> | ||
| 2537 | + <key> | ||
| 2538 | + <name>xl</name> | ||
| 2539 | + <field>id</field> | ||
| 2540 | + <condition>=</condition> | ||
| 2541 | + <name2/> | ||
| 2542 | + </key> | ||
| 2543 | + <value> | ||
| 2544 | + <name>line_code</name> | ||
| 2545 | + <rename>line_code</rename> | ||
| 2546 | + <default/> | ||
| 2547 | + <type>None</type> | ||
| 2548 | + </value> | ||
| 2549 | + <value> | ||
| 2550 | + <name>name</name> | ||
| 2551 | + <rename>name</rename> | ||
| 2552 | + <default/> | ||
| 2553 | + <type>None</type> | ||
| 2554 | + </value> | ||
| 2555 | + </lookup> | ||
| 2556 | + <cluster_schema/> | ||
| 2557 | + <remotesteps> <input> </input> <output> </output> </remotesteps> <GUI> | ||
| 2558 | + <xloc>340</xloc> | ||
| 2559 | + <yloc>582</yloc> | ||
| 2560 | + <draw>Y</draw> | ||
| 2561 | + </GUI> | ||
| 2562 | + </step> | ||
| 2563 | + | ||
| 2564 | + <step> | ||
| 2565 | + <name>本地车辆信息查询 </name> | ||
| 2566 | + <type>DBLookup</type> | ||
| 2567 | + <description/> | ||
| 2568 | + <distribute>Y</distribute> | ||
| 2569 | + <custom_distribution/> | ||
| 2570 | + <copies>1</copies> | ||
| 2571 | + <partitioning> | ||
| 2572 | + <method>none</method> | ||
| 2573 | + <schema_name/> | ||
| 2574 | + </partitioning> | ||
| 2575 | + <connection>control_jndi</connection> | ||
| 2576 | + <cache>Y</cache> | ||
| 2577 | + <cache_load_all>Y</cache_load_all> | ||
| 2578 | + <cache_size>0</cache_size> | ||
| 2579 | + <lookup> | ||
| 2580 | + <schema/> | ||
| 2581 | + <table>bsth_c_cars</table> | ||
| 2582 | + <orderby>update_date desc</orderby> | ||
| 2583 | + <fail_on_multiple>N</fail_on_multiple> | ||
| 2584 | + <eat_row_on_failure>N</eat_row_on_failure> | ||
| 2585 | + <key> | ||
| 2586 | + <name>clzbh</name> | ||
| 2587 | + <field>inside_code</field> | ||
| 2588 | + <condition>=</condition> | ||
| 2589 | + <name2/> | ||
| 2590 | + </key> | ||
| 2591 | + <value> | ||
| 2592 | + <name>id</name> | ||
| 2593 | + <rename>id</rename> | ||
| 2594 | + <default/> | ||
| 2595 | + <type>Integer</type> | ||
| 2596 | + </value> | ||
| 2597 | + <value> | ||
| 2598 | + <name>equipment_code</name> | ||
| 2266 | <rename>equipment_code</rename> | 2599 | <rename>equipment_code</rename> |
| 2267 | <default/> | 2600 | <default/> |
| 2268 | <type>String</type> | 2601 | <type>String</type> |
| @@ -2628,255 +2961,6 @@ | @@ -2628,255 +2961,6 @@ | ||
| 2628 | </GUI> | 2961 | </GUI> |
| 2629 | </step> | 2962 | </step> |
| 2630 | 2963 | ||
| 2631 | - <step> | ||
| 2632 | - <name>获取报废车辆数据(曾经配置过线路)</name> | ||
| 2633 | - <type>FilterRows</type> | ||
| 2634 | - <description/> | ||
| 2635 | - <distribute>Y</distribute> | ||
| 2636 | - <custom_distribution/> | ||
| 2637 | - <copies>1</copies> | ||
| 2638 | - <partitioning> | ||
| 2639 | - <method>none</method> | ||
| 2640 | - <schema_name/> | ||
| 2641 | - </partitioning> | ||
| 2642 | -<send_true_to/> | ||
| 2643 | -<send_false_to/> | ||
| 2644 | - <compare> | ||
| 2645 | -<condition> | ||
| 2646 | - <negated>N</negated> | ||
| 2647 | - <conditions> | ||
| 2648 | - <condition> | ||
| 2649 | - <negated>N</negated> | ||
| 2650 | - <leftvalue>scrapState_update</leftvalue> | ||
| 2651 | - <function>=</function> | ||
| 2652 | - <rightvalue/> | ||
| 2653 | - <value><name>constant</name><type>String</type><text>1</text><length>-1</length><precision>-1</precision><isnull>N</isnull><mask/></value> </condition> | ||
| 2654 | - <condition> | ||
| 2655 | - <negated>N</negated> | ||
| 2656 | - <operator>AND</operator> | ||
| 2657 | - <leftvalue>xl</leftvalue> | ||
| 2658 | - <function>IS NOT NULL</function> | ||
| 2659 | - <rightvalue/> | ||
| 2660 | - </condition> | ||
| 2661 | - </conditions> | ||
| 2662 | - </condition> | ||
| 2663 | - </compare> | ||
| 2664 | - <cluster_schema/> | ||
| 2665 | - <remotesteps> <input> </input> <output> </output> </remotesteps> <GUI> | ||
| 2666 | - <xloc>672</xloc> | ||
| 2667 | - <yloc>496</yloc> | ||
| 2668 | - <draw>Y</draw> | ||
| 2669 | - </GUI> | ||
| 2670 | - </step> | ||
| 2671 | - | ||
| 2672 | - <step> | ||
| 2673 | - <name>更新车辆数据输出</name> | ||
| 2674 | - <type>Update</type> | ||
| 2675 | - <description/> | ||
| 2676 | - <distribute>Y</distribute> | ||
| 2677 | - <custom_distribution/> | ||
| 2678 | - <copies>1</copies> | ||
| 2679 | - <partitioning> | ||
| 2680 | - <method>none</method> | ||
| 2681 | - <schema_name/> | ||
| 2682 | - </partitioning> | ||
| 2683 | - <connection>control_jndi</connection> | ||
| 2684 | - <skip_lookup>N</skip_lookup> | ||
| 2685 | - <commit>100</commit> | ||
| 2686 | - <use_batch>N</use_batch> | ||
| 2687 | - <error_ignored>N</error_ignored> | ||
| 2688 | - <ignore_flag_field/> | ||
| 2689 | - <lookup> | ||
| 2690 | - <schema/> | ||
| 2691 | - <table>bsth_c_cars</table> | ||
| 2692 | - <key> | ||
| 2693 | - <name>id</name> | ||
| 2694 | - <field>id</field> | ||
| 2695 | - <condition>=</condition> | ||
| 2696 | - <name2/> | ||
| 2697 | - </key> | ||
| 2698 | - <value> | ||
| 2699 | - <name>equipment_code</name> | ||
| 2700 | - <rename>equipmentCode_update</rename> | ||
| 2701 | - </value> | ||
| 2702 | - <value> | ||
| 2703 | - <name>scrap_code</name> | ||
| 2704 | - <rename>scrapCode_update</rename> | ||
| 2705 | - </value> | ||
| 2706 | - <value> | ||
| 2707 | - <name>scrap_date</name> | ||
| 2708 | - <rename>scrapDate_update</rename> | ||
| 2709 | - </value> | ||
| 2710 | - <value> | ||
| 2711 | - <name>scrap_state</name> | ||
| 2712 | - <rename>scrapState_update</rename> | ||
| 2713 | - </value> | ||
| 2714 | - <value> | ||
| 2715 | - <name>company</name> | ||
| 2716 | - <rename>company_update</rename> | ||
| 2717 | - </value> | ||
| 2718 | - <value> | ||
| 2719 | - <name>business_code</name> | ||
| 2720 | - <rename>business_code_update</rename> | ||
| 2721 | - </value> | ||
| 2722 | - <value> | ||
| 2723 | - <name>branche_company</name> | ||
| 2724 | - <rename>branche_company_update</rename> | ||
| 2725 | - </value> | ||
| 2726 | - <value> | ||
| 2727 | - <name>branche_company_code</name> | ||
| 2728 | - <rename>branch_company_code_update</rename> | ||
| 2729 | - </value> | ||
| 2730 | - <value> | ||
| 2731 | - <name>update_date</name> | ||
| 2732 | - <rename>update_date</rename> | ||
| 2733 | - </value> | ||
| 2734 | - </lookup> | ||
| 2735 | - <cluster_schema/> | ||
| 2736 | - <remotesteps> <input> </input> <output> </output> </remotesteps> <GUI> | ||
| 2737 | - <xloc>825</xloc> | ||
| 2738 | - <yloc>400</yloc> | ||
| 2739 | - <draw>Y</draw> | ||
| 2740 | - </GUI> | ||
| 2741 | - </step> | ||
| 2742 | - | ||
| 2743 | - <step> | ||
| 2744 | - <name>更新错误数据文件</name> | ||
| 2745 | - <type>ExcelOutput</type> | ||
| 2746 | - <description/> | ||
| 2747 | - <distribute>Y</distribute> | ||
| 2748 | - <custom_distribution/> | ||
| 2749 | - <copies>1</copies> | ||
| 2750 | - <partitioning> | ||
| 2751 | - <method>none</method> | ||
| 2752 | - <schema_name/> | ||
| 2753 | - </partitioning> | ||
| 2754 | - <header>Y</header> | ||
| 2755 | - <footer>N</footer> | ||
| 2756 | - <encoding/> | ||
| 2757 | - <append>N</append> | ||
| 2758 | - <add_to_result_filenames>Y</add_to_result_filenames> | ||
| 2759 | - <file> | ||
| 2760 | - <name>${file_update_error}</name> | ||
| 2761 | - <extention>xls</extention> | ||
| 2762 | - <do_not_open_newfile_init>N</do_not_open_newfile_init> | ||
| 2763 | - <create_parent_folder>N</create_parent_folder> | ||
| 2764 | - <split>N</split> | ||
| 2765 | - <add_date>N</add_date> | ||
| 2766 | - <add_time>N</add_time> | ||
| 2767 | - <SpecifyFormat>N</SpecifyFormat> | ||
| 2768 | - <date_time_format/> | ||
| 2769 | - <sheetname>Sheet1</sheetname> | ||
| 2770 | - <autosizecolums>N</autosizecolums> | ||
| 2771 | - <nullisblank>N</nullisblank> | ||
| 2772 | - <protect_sheet>N</protect_sheet> | ||
| 2773 | - <password>Encrypted </password> | ||
| 2774 | - <splitevery>0</splitevery> | ||
| 2775 | - <usetempfiles>N</usetempfiles> | ||
| 2776 | - <tempdirectory/> | ||
| 2777 | - </file> | ||
| 2778 | - <template> | ||
| 2779 | - <enabled>N</enabled> | ||
| 2780 | - <append>N</append> | ||
| 2781 | - <filename>template.xls</filename> | ||
| 2782 | - </template> | ||
| 2783 | - <fields> | ||
| 2784 | - <field> | ||
| 2785 | - <name>clzbh</name> | ||
| 2786 | - <type>String</type> | ||
| 2787 | - <format/> | ||
| 2788 | - </field> | ||
| 2789 | - <field> | ||
| 2790 | - <name>id</name> | ||
| 2791 | - <type>Integer</type> | ||
| 2792 | - <format/> | ||
| 2793 | - </field> | ||
| 2794 | - <field> | ||
| 2795 | - <name>company_update</name> | ||
| 2796 | - <type>String</type> | ||
| 2797 | - <format/> | ||
| 2798 | - </field> | ||
| 2799 | - <field> | ||
| 2800 | - <name>branche_company_update</name> | ||
| 2801 | - <type>String</type> | ||
| 2802 | - <format/> | ||
| 2803 | - </field> | ||
| 2804 | - <field> | ||
| 2805 | - <name>business_code_update</name> | ||
| 2806 | - <type>String</type> | ||
| 2807 | - <format/> | ||
| 2808 | - </field> | ||
| 2809 | - <field> | ||
| 2810 | - <name>branch_company_code_update</name> | ||
| 2811 | - <type>String</type> | ||
| 2812 | - <format/> | ||
| 2813 | - </field> | ||
| 2814 | - <field> | ||
| 2815 | - <name>equipmentCode_update</name> | ||
| 2816 | - <type>String</type> | ||
| 2817 | - <format/> | ||
| 2818 | - </field> | ||
| 2819 | - <field> | ||
| 2820 | - <name>scrapCode_update</name> | ||
| 2821 | - <type>String</type> | ||
| 2822 | - <format/> | ||
| 2823 | - </field> | ||
| 2824 | - <field> | ||
| 2825 | - <name>scrapState_update</name> | ||
| 2826 | - <type>Integer</type> | ||
| 2827 | - <format/> | ||
| 2828 | - </field> | ||
| 2829 | - <field> | ||
| 2830 | - <name>scrapDate_update</name> | ||
| 2831 | - <type>String</type> | ||
| 2832 | - <format/> | ||
| 2833 | - </field> | ||
| 2834 | - <field> | ||
| 2835 | - <name>NrErrors</name> | ||
| 2836 | - <type>Integer</type> | ||
| 2837 | - <format/> | ||
| 2838 | - </field> | ||
| 2839 | - <field> | ||
| 2840 | - <name>ErrorDescription</name> | ||
| 2841 | - <type>String</type> | ||
| 2842 | - <format/> | ||
| 2843 | - </field> | ||
| 2844 | - <field> | ||
| 2845 | - <name>ErrorFields</name> | ||
| 2846 | - <type>String</type> | ||
| 2847 | - <format/> | ||
| 2848 | - </field> | ||
| 2849 | - <field> | ||
| 2850 | - <name>ErrorCodes</name> | ||
| 2851 | - <type>String</type> | ||
| 2852 | - <format/> | ||
| 2853 | - </field> | ||
| 2854 | - </fields> | ||
| 2855 | - <custom> | ||
| 2856 | - <header_font_name>arial</header_font_name> | ||
| 2857 | - <header_font_size>10</header_font_size> | ||
| 2858 | - <header_font_bold>N</header_font_bold> | ||
| 2859 | - <header_font_italic>N</header_font_italic> | ||
| 2860 | - <header_font_underline>no</header_font_underline> | ||
| 2861 | - <header_font_orientation>horizontal</header_font_orientation> | ||
| 2862 | - <header_font_color>black</header_font_color> | ||
| 2863 | - <header_background_color>none</header_background_color> | ||
| 2864 | - <header_row_height>255</header_row_height> | ||
| 2865 | - <header_alignment>left</header_alignment> | ||
| 2866 | - <header_image/> | ||
| 2867 | - <row_font_name>arial</row_font_name> | ||
| 2868 | - <row_font_size>10</row_font_size> | ||
| 2869 | - <row_font_color>black</row_font_color> | ||
| 2870 | - <row_background_color>none</row_background_color> | ||
| 2871 | - </custom> | ||
| 2872 | - <cluster_schema/> | ||
| 2873 | - <remotesteps> <input> </input> <output> </output> </remotesteps> <GUI> | ||
| 2874 | - <xloc>962</xloc> | ||
| 2875 | - <yloc>400</yloc> | ||
| 2876 | - <draw>Y</draw> | ||
| 2877 | - </GUI> | ||
| 2878 | - </step> | ||
| 2879 | - | ||
| 2880 | <step_error_handling> | 2964 | <step_error_handling> |
| 2881 | <error> | 2965 | <error> |
| 2882 | <source_step>JavaScript解析json生成数据</source_step> | 2966 | <source_step>JavaScript解析json生成数据</source_step> |
src/main/resources/logback.xml
| @@ -359,6 +359,10 @@ | @@ -359,6 +359,10 @@ | ||
| 359 | <level value="INFO" /> | 359 | <level value="INFO" /> |
| 360 | <appender-ref ref="STDOUT" /> | 360 | <appender-ref ref="STDOUT" /> |
| 361 | </logger> | 361 | </logger> |
| 362 | + <!--<logger name="org.hibernate.type.descriptor.sql.BasicBinder" additivity="true"> | ||
| 363 | + <level value="TRACE" /> | ||
| 364 | + <appender-ref ref="STDOUT" /> | ||
| 365 | + </logger>--> | ||
| 362 | 366 | ||
| 363 | <!-- 日志输出级别 --> | 367 | <!-- 日志输出级别 --> |
| 364 | <root level="info"> | 368 | <root level="info"> |
src/main/resources/rules/kBase3_validate_timetable.drl
| @@ -307,7 +307,7 @@ rule "statinfo_result" // 统计计算结果 | @@ -307,7 +307,7 @@ rule "statinfo_result" // 统计计算结果 | ||
| 307 | $inbc: Long() from accumulate (TTInfoDetail(bcType == "in") from $ttInfoDetails_wrap.getBcInfoList(), count()) | 307 | $inbc: Long() from accumulate (TTInfoDetail(bcType == "in") from $ttInfoDetails_wrap.getBcInfoList(), count()) |
| 308 | $outbc: Long() from accumulate (TTInfoDetail(bcType == "out") from $ttInfoDetails_wrap.getBcInfoList(), count()) | 308 | $outbc: Long() from accumulate (TTInfoDetail(bcType == "out") from $ttInfoDetails_wrap.getBcInfoList(), count()) |
| 309 | $yybc: Long() from accumulate (TTInfoDetail(bcType != "out", bcType != "in") from $ttInfoDetails_wrap.getBcInfoList(), count()) | 309 | $yybc: Long() from accumulate (TTInfoDetail(bcType != "out", bcType != "in") from $ttInfoDetails_wrap.getBcInfoList(), count()) |
| 310 | - $errorbc: Long() from accumulate ($ttd: TTInfoDetail() from $ttInfoDetails_wrap.getBcInfoList(), ecount($ttd)) | 310 | + $errorbc: List() from accumulate ($ttd: TTInfoDetail() from $ttInfoDetails_wrap.getBcInfoList(), ecount($ttd)) |
| 311 | then | 311 | then |
| 312 | log.info("时刻表={},id={},班次数={},进场={},出场={},营运={},错误={}", $statInfo.getTtname(), $statInfo.getTtid(), $allbc, $inbc, $outbc, $yybc, $errorbc); | 312 | log.info("时刻表={},id={},班次数={},进场={},出场={},营运={},错误={}", $statInfo.getTtname(), $statInfo.getTtid(), $allbc, $inbc, $outbc, $yybc, $errorbc); |
| 313 | 313 | ||
| @@ -315,7 +315,9 @@ rule "statinfo_result" // 统计计算结果 | @@ -315,7 +315,9 @@ rule "statinfo_result" // 统计计算结果 | ||
| 315 | $statInfo.setInbc($inbc); | 315 | $statInfo.setInbc($inbc); |
| 316 | $statInfo.setOutbc($outbc); | 316 | $statInfo.setOutbc($outbc); |
| 317 | $statInfo.setYybc($yybc); | 317 | $statInfo.setYybc($yybc); |
| 318 | - $statInfo.setErrorbc($errorbc); | 318 | + $statInfo.setErrorbc((Integer) $errorbc.get(0)); |
| 319 | + $statInfo.setErrorlpCount((Integer) $errorbc.get(1)); | ||
| 320 | + $statInfo.setErrorlpInfo((List<String>) $errorbc.get(2)); | ||
| 319 | 321 | ||
| 320 | int lineVersion = $ttInfoDetails_wrap.getLineVersion(); | 322 | int lineVersion = $ttInfoDetails_wrap.getLineVersion(); |
| 321 | $statInfo.setLineVersion(lineVersion); | 323 | $statInfo.setLineVersion(lineVersion); |
src/main/resources/static/index.html
| 1 | -<!DOCTYPE html> | ||
| 2 | -<html lang="zh"> | ||
| 3 | -<head> | ||
| 4 | - <meta name="renderer" content="webkit" /> | ||
| 5 | - <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" /> | ||
| 6 | - <meta charset="UTF-8"> | ||
| 7 | - <title>调度系统</title> | ||
| 8 | - | ||
| 9 | - <meta http-equiv="Pragma" content="no-cache"> | ||
| 10 | - <meta http-equiv="Cache-control" content="no-cache"> | ||
| 11 | - <meta http-equiv="Cache" content="no-cache"> | ||
| 12 | - | ||
| 13 | - <!-- Font Awesome 图标字体 --> | ||
| 14 | - <link | ||
| 15 | - href="/metronic_v4.5.4/plugins/font-awesome/css/font-awesome.min.css" | ||
| 16 | - rel="stylesheet" type="text/css" /> | ||
| 17 | - <!-- Bootstrap style --> | ||
| 18 | - <link href="/metronic_v4.5.4/plugins/bootstrap/css/bootstrap.min.css" | ||
| 19 | - rel="stylesheet" type="text/css" /> | ||
| 20 | - <!-- jsTree 数插件 --> | ||
| 21 | - <link | ||
| 22 | - href="/metronic_v4.5.4/plugins/jstree/dist/themes/default/style.min.css" | ||
| 23 | - rel="stylesheet" type="text/css" /> | ||
| 24 | - <!-- MULTI-select 多选下拉框美化 --> | ||
| 25 | - <link | ||
| 26 | - href="/metronic_v4.5.4/plugins/jquery-multi-select/css/multi-select.css" | ||
| 27 | - rel="stylesheet" type="text/css" /> | ||
| 28 | - | ||
| 29 | - <!-- editable --> | ||
| 30 | - <link | ||
| 31 | - href="/metronic_v4.5.4/plugins/bootstrap-editable/bootstrap-editable/css/bootstrap-editable.css" | ||
| 32 | - rel="stylesheet" type="text/css" /> | ||
| 33 | - <!-- METRONIC style --> | ||
| 34 | - <link href="/metronic_v4.5.4/layout4/css/themes/light.min.css" | ||
| 35 | - rel="stylesheet" type="text/css" id="style_color" /> | ||
| 36 | - <link href="/metronic_v4.5.4/css/components.css" rel="stylesheet" | ||
| 37 | - type="text/css" /> | ||
| 38 | - <link href="/metronic_v4.5.4/css/plugins.css" rel="stylesheet" | ||
| 39 | - type="text/css" /> | ||
| 40 | - <link href="/metronic_v4.5.4/layout4/css/layout.min.css" | ||
| 41 | - rel="stylesheet" type="text/css" /> | ||
| 42 | - <link href="/metronic_v4.5.4/layout4/css/custom.min.css" | ||
| 43 | - rel="stylesheet" type="text/css" /> | ||
| 44 | - <!-- select2 下拉框插件 --> | ||
| 45 | - <link href="/metronic_v4.5.4/plugins/select2/css/select2.min.css" | ||
| 46 | - rel="stylesheet" type="text/css" /> | ||
| 47 | - <link | ||
| 48 | - href="/metronic_v4.5.4/plugins/select2/css/select2-bootstrap.min.css" | ||
| 49 | - rel="stylesheet" type="text/css" /> | ||
| 50 | - <!-- layer 弹层 插件 --> | ||
| 51 | - <link href="/assets/plugins/layer-v2.4/layer/skin/layer.css" | ||
| 52 | - rel="stylesheet" type="text/css" /> | ||
| 53 | - <!-- fileinput 上传 插件 --> | ||
| 54 | - <link href="/assets/plugins/fileinput/css/fileinput.min.css" | ||
| 55 | - rel="stylesheet" type="text/css" /> | ||
| 56 | - <!-- iCheck 单选框和复选框 --> | ||
| 57 | - <link href="/metronic_v4.5.4/plugins/icheck/skins/all.css" | ||
| 58 | - rel="stylesheet" type="text/css" /> | ||
| 59 | - <!-- 日期控件 --> | ||
| 60 | - <link | ||
| 61 | - href="/metronic_v4.5.4/plugins/bootstrap-datetimepicker-2/css/bootstrap-datetimepicker.min.css" | ||
| 62 | - rel="stylesheet" type="text/css" /> | ||
| 63 | - <!-- table 表格控件 --> | ||
| 64 | - <!--<link rel="stylesheet"--> | ||
| 65 | - <!--href="http://api.map.baidu.com/library/DrawingManager/1.4/src/DrawingManager_min.css"--> | ||
| 66 | - <!--type="text/css" />--> | ||
| 67 | - <link href="/metronic_v4.5.4/plugins/bootstrap-tagsinput/bootstrap-tagsinput.css" rel="stylesheet" type="text/css"/> | ||
| 68 | - <!-- handsontable样式 --> | ||
| 69 | - <link rel="stylesheet" | ||
| 70 | - href="/assets/bower_components/handsontable/dist/handsontable.full.css" /> | ||
| 71 | - <!-- sweetalert样式 --> | ||
| 72 | - <link rel="stylesheet" | ||
| 73 | - href="/assets/bower_components/sweetalert/dist/sweetalert.css" /> | ||
| 74 | - <!-- schedule计划调度AngularJS模块主css --> | ||
| 75 | - <link rel="stylesheet" href="/pages/scheduleApp/module/common/main.css" | ||
| 76 | - type="text/css" /> | ||
| 77 | - <link rel="stylesheet" href="/real_control_v2/assets/plugins/perfect-scrollbar/perfect-scrollbar.css" merge="plugins"/> | ||
| 78 | - | ||
| 79 | - <!-- CSS动画 --> | ||
| 80 | - <link | ||
| 81 | - href="/metronic_v4.5.4/plugins/tipso/css/animate.css" | ||
| 82 | - rel="stylesheet" type="text/css" /> | ||
| 83 | - | ||
| 84 | - <!-- 提示工具样式 --> | ||
| 85 | - <link | ||
| 86 | - href="/metronic_v4.5.4/plugins/tipso/css/tipso.css" | ||
| 87 | - rel="stylesheet" type="text/css" /> | ||
| 88 | - | ||
| 89 | - <style type="text/css"> | ||
| 90 | - .searchForm { | ||
| 91 | - | ||
| 92 | - } | ||
| 93 | - | ||
| 94 | - .searchForm .form-group .control-label { | ||
| 95 | - padding-right: 0px; | ||
| 96 | - text-align: right; | ||
| 97 | - margin-top: 7px; | ||
| 98 | - } | ||
| 99 | - | ||
| 100 | - .searchForm .form-group>div { | ||
| 101 | - padding-left: 10px; | ||
| 102 | - padding-right: 0px; | ||
| 103 | - } | ||
| 104 | - | ||
| 105 | - .searchForm .row>div { | ||
| 106 | - padding-left: 0px; | ||
| 107 | - padding-right: 0px; | ||
| 108 | - padding: 5px 0 5px 0; | ||
| 109 | - width: 270px; | ||
| 110 | - display: inline-block; | ||
| 111 | - } | ||
| 112 | - | ||
| 113 | - .searchForm .form-actions { | ||
| 114 | - | ||
| 115 | - } | ||
| 116 | - | ||
| 117 | - tr.row-active td { | ||
| 118 | - border-bottom: 1px solid blue !important; | ||
| 119 | - color: blue; | ||
| 120 | - } | ||
| 121 | - | ||
| 122 | - .ms-container .ms-selectable li.ms-elem-selectable,.ms-container .ms-selection li.ms-elem-selection | ||
| 123 | - { | ||
| 124 | - font-size: 14px; | ||
| 125 | - } | ||
| 126 | - | ||
| 127 | - .ms-container .ms-selectable li.ms-elem-selectable,.ms-container .ms-selection li.ms-elem-selection | ||
| 128 | - { | ||
| 129 | - padding: 6px 26px; | ||
| 130 | - } | ||
| 131 | - | ||
| 132 | - .ms-container .ms-list { | ||
| 133 | - height: 306px; | ||
| 134 | - } | ||
| 135 | - | ||
| 136 | - .ms-container .ms-selectable,.ms-container .ms-selection { | ||
| 137 | - width: 47%; | ||
| 138 | - } | ||
| 139 | - | ||
| 140 | - .ms-container { | ||
| 141 | - width: 470px; | ||
| 142 | - margin: auto; | ||
| 143 | - } | ||
| 144 | - | ||
| 145 | - .multi-custom-header-left { | ||
| 146 | - text-align: center; | ||
| 147 | - padding: 7px; | ||
| 148 | - color: #3B3F51; | ||
| 149 | - } | ||
| 150 | - | ||
| 151 | - .multi-custom-header-right { | ||
| 152 | - text-align: center; | ||
| 153 | - padding: 7px; | ||
| 154 | - font-weight: bold; | ||
| 155 | - color: #36C6D3; | ||
| 156 | - } | ||
| 157 | - | ||
| 158 | - .mt-element-list .list-simple.mt-list-container ul>.mt-list-item>.list-item-content | ||
| 159 | - { | ||
| 160 | - padding: 0 55px 0 0px; | ||
| 161 | - } | ||
| 162 | - | ||
| 163 | - .mt-element-list .list-simple.mt-list-container ul>.mt-list-item { | ||
| 164 | - padding: 3.3px 0; | ||
| 165 | - } | ||
| 166 | - | ||
| 167 | - #route-container { | ||
| 168 | - display: none; | ||
| 169 | - } | ||
| 170 | - | ||
| 171 | - .page-content.active { | ||
| 172 | - display: block !important; | ||
| 173 | - } | ||
| 174 | - | ||
| 175 | - .page-header.navbar .page-logo .logo-default { | ||
| 176 | - margin: 0; | ||
| 177 | - } | ||
| 178 | - | ||
| 179 | - .page-header.navbar .top-menu .navbar-nav>li.dropdown.open .dropdown-toggle | ||
| 180 | - { | ||
| 181 | - background-color: #284a99; | ||
| 182 | - } | ||
| 183 | - | ||
| 184 | - .page-header.navbar .page-logo { | ||
| 185 | - padding-right: 10px; | ||
| 186 | - } | ||
| 187 | - | ||
| 188 | - .page-logo .logo-default.logo-default-text { | ||
| 189 | - font-weight: 600; | ||
| 190 | - color: white !important; | ||
| 191 | - margin-top: 19px !important; | ||
| 192 | - font-size: 24px; | ||
| 193 | - text-decoration: none; | ||
| 194 | - } | ||
| 195 | - | ||
| 196 | - .page-logo .logo-default.logo-default-text:HOVER { | ||
| 197 | - color: #dedede !important; | ||
| 198 | - } | ||
| 199 | - | ||
| 200 | - body,.page-content-wrapper,#pjax-container{ | ||
| 201 | - height: 100%; | ||
| 202 | - } | ||
| 203 | - html{ | ||
| 204 | - height: 90%; | ||
| 205 | - } | ||
| 206 | - .page-container{ | ||
| 207 | - height: 100%; | ||
| 208 | - } | ||
| 209 | - </style> | ||
| 210 | - | ||
| 211 | - <!-- ocLazyLoading载入文件的位置 --> | ||
| 212 | - <link id="ng_load_plugins_before" /> | ||
| 213 | - | ||
| 214 | -</head> | ||
| 215 | -<body | ||
| 216 | - class="page-container-bg-solid page-header-fixed page-sidebar-closed-hide-logo page-sidebar-fixed"> | ||
| 217 | -<div class="page-header navbar navbar-fixed-top" | ||
| 218 | - style="background: linear-gradient(to bottom, #124e78, #125688);"> | ||
| 219 | - <div class="page-header-inner "> | ||
| 220 | - <!-- LOGO --> | ||
| 221 | - <div class="page-logo"> | ||
| 222 | - <a href="index.html" class="logo-default logo-default-text"> | ||
| 223 | - 浦东公交调度系统 </a> | ||
| 224 | - <div class="menu-toggler sidebar-toggler"></div> | ||
| 225 | - </div> | ||
| 226 | - <!-- END LOGO --> | ||
| 227 | - <a href="javascript:;" class="menu-toggler responsive-toggler" | ||
| 228 | - data-toggle="collapse" data-target=".navbar-collapse"> </a> | ||
| 229 | - <div class="page-top"> | ||
| 230 | - <div class="top-menu"> | ||
| 231 | - <ul class="nav navbar-nav pull-right"> | ||
| 232 | - <!-- 信息通知区 --> | ||
| 233 | - <li | ||
| 234 | - class="dropdown dropdown-extended dropdown-notification dropdown-dark" | ||
| 235 | - id="header_notification_bar"><a href="javascript:;" | ||
| 236 | - class="dropdown-toggle" data-toggle="dropdown" | ||
| 237 | - data-hover="dropdown" data-close-others="true"> <i | ||
| 238 | - class="fa fa-bell"></i> <span class="badge badge-success"> | ||
| 239 | - 0 </span> | ||
| 240 | - </a> | ||
| 241 | - <ul class="dropdown-menu" style="max-width: 345px; width: 345px;"> | ||
| 242 | - <li class="external"> | ||
| 243 | - <h3> | ||
| 244 | - 今日 <span class="bold">0 条</span> 通知 | ||
| 245 | - </h3> <a href="javascript:;">查看全部</a> | ||
| 246 | - </li> | ||
| 247 | - <li> | ||
| 248 | - <ul class="dropdown-menu-list scroller" style="height: 250px;" | ||
| 249 | - data-handle-color="#637283"> | ||
| 250 | - </ul> | ||
| 251 | - </li> | ||
| 252 | - </ul></li> | ||
| 253 | - <li class="dropdown dropdown-user dropdown-dark"><a | ||
| 254 | - href="javascript:;" class="dropdown-toggle" | ||
| 255 | - data-toggle="dropdown" data-hover="dropdown" | ||
| 256 | - data-close-others="true"> <span id="indexTopUName" | ||
| 257 | - class="username username-hide-on-mobile" | ||
| 258 | - style="vertical-align: middle;"> <i class="fa fa-user"></i></span> | ||
| 259 | - </a> | ||
| 260 | - <ul class="dropdown-menu dropdown-menu-default"> | ||
| 261 | - <li><a href="javascript:;"> <i class="fa fa-user"></i> | ||
| 262 | - 我的信息 | ||
| 263 | - </a></li> | ||
| 264 | - <li><a href="javascript:;" id="changePWD"> <i | ||
| 265 | - class="fa fa-unlock-alt"></i> 修改密码 | ||
| 266 | - </a></li> | ||
| 267 | - <li class="divider"></li> | ||
| 268 | - <li><a href="javascript:;"> <i class="fa fa-lock"></i> | ||
| 269 | - 锁屏 | ||
| 270 | - </a></li> | ||
| 271 | - <li><a href="/logout"> <i class="fa fa-key"></i> 注销登陆 | ||
| 272 | - </a></li> | ||
| 273 | - </ul></li> | ||
| 274 | - </ul> | ||
| 275 | - </div> | ||
| 276 | - </div> | ||
| 277 | - </div> | ||
| 278 | -</div> | ||
| 279 | -<div class="page-container"> | ||
| 280 | - <div class="page-sidebar-wrapper"> | ||
| 281 | - <div class="page-sidebar navbar-collapse collapse"> | ||
| 282 | - <ul class="page-sidebar-menu page-sidebar-menu-fixed" | ||
| 283 | - data-keep-expanded="false" data-auto-scroll="true" | ||
| 284 | - data-slide-speed="200" id="leftMenuSidebar"> | ||
| 285 | - </ul> | ||
| 286 | - </div> | ||
| 287 | - </div> | ||
| 288 | - <div class="page-content-wrapper"> | ||
| 289 | - <div id="pjax-container" class="page-content"></div> | ||
| 290 | - | ||
| 291 | - <div id="route-container"> | ||
| 292 | - <div ng-app="ScheduleApp"> | ||
| 293 | - <div ng-controller="ScheduleAppController"> | ||
| 294 | - | ||
| 295 | - <!-- loading widget --> | ||
| 296 | - <div id="loadingWidget" class="flyover mask" loading-widget> | ||
| 297 | - <div class="alert alert-info"> | ||
| 298 | - <strong>载入中......</strong> | ||
| 299 | - </div> | ||
| 300 | - </div> | ||
| 301 | - | ||
| 302 | - <div ui-view class="uv"></div> | ||
| 303 | - </div> | ||
| 304 | - </div> | ||
| 305 | - </div> | ||
| 306 | - </div> | ||
| 307 | -</div> | ||
| 308 | - | ||
| 309 | -<script id="menu_list_temp" type="text/html"> | ||
| 310 | - {{each list as group i}} | ||
| 311 | - <li class="heading"> | ||
| 312 | - <h3 class="uppercase">{{group.name}}</h3> | ||
| 313 | - </li> | ||
| 314 | - {{each group.children as dir j}} | ||
| 315 | - <li class="nav-item"> | ||
| 316 | - <a href="javascript:;" class="nav-link nav-toggle "> | ||
| 317 | - <i class="{{dir.icon}}"></i> | ||
| 318 | - <span class="title">{{dir.name}}</span> | ||
| 319 | - <span class="arrow"></span> | ||
| 320 | - </a> | ||
| 321 | - <ul class="sub-menu"> | ||
| 322 | - {{each dir.children as module s}} | ||
| 323 | - <li class="nav-item "> | ||
| 324 | - {{if module.container=="pjax-container"}} | ||
| 325 | - <a href="/pages/{{module.path}}" class="nav-link " data-pjax> | ||
| 326 | - <span class="title">{{module.name}}</span> | ||
| 327 | - </a> | ||
| 328 | - {{else}} | ||
| 329 | - <a href="{{module.path}}" class="nav-link " data-angularjs> | ||
| 330 | - <span class="title">{{module.name}}</span> | ||
| 331 | - </a> | ||
| 332 | - {{/if}} | ||
| 333 | - </li> | ||
| 334 | - {{/each}} | ||
| 335 | - </ul> | ||
| 336 | - </li> | ||
| 337 | - {{/each}} | ||
| 338 | - {{/each}} | ||
| 339 | - | ||
| 340 | -</script> | ||
| 341 | -<script> | ||
| 342 | - delete window.require; | ||
| 343 | - delete window.exports; | ||
| 344 | - delete window.module; | ||
| 345 | -</script> | ||
| 346 | -<!-- jQuery --> | ||
| 347 | -<script src="/metronic_v4.5.4/plugins/jquery.min.js" data-exclude=1></script> | ||
| 348 | -<!-- bootstrap --> | ||
| 349 | -<script src="/metronic_v4.5.4/plugins/bootstrap/js/bootstrap.min.js" | ||
| 350 | - data-exclude=1></script> | ||
| 351 | -<script src="/pages/forms/statement/js/jquery.autocompleter.js"></script> | ||
| 352 | -<script src="/pages/forms/statement/js/jquery.PrintArea.js"></script> | ||
| 353 | -<!-- MTRONIC JS --> | ||
| 354 | -<script src="/metronic_v4.5.4/scripts/app.min.js" data-exclude=1></script> | ||
| 355 | -<script src="/metronic_v4.5.4/layout4/scripts/layout.min.js" | ||
| 356 | - data-exclude=1></script> | ||
| 357 | -<!-- 虚拟滚动条 --> | ||
| 358 | -<script | ||
| 359 | - src="/metronic_v4.5.4/plugins/jquery-slimscroll/jquery.slimscroll.min.js"></script> | ||
| 360 | -<!-- jsTree 树插件 --> | ||
| 361 | -<script src="/metronic_v4.5.4/plugins/jstree/dist/jstree.min.js"></script> | ||
| 362 | -<!-- bootstrap-hover-dropDown --> | ||
| 363 | -<script | ||
| 364 | - src="/metronic_v4.5.4/plugins/bootstrap-hover-dropdown/bootstrap-hover-dropdown.min.js"></script> | ||
| 365 | -<!-- jquery.validate 表单验证 --> | ||
| 366 | -<script | ||
| 367 | - src="/metronic_v4.5.4/plugins/jquery-validation/js/jquery.validate.min.js"></script> | ||
| 368 | -<script | ||
| 369 | - src="/metronic_v4.5.4/plugins/jquery-validation/js/localization/messages_zh.js"></script> | ||
| 370 | -<!-- 向导式插件 --> | ||
| 371 | -<script | ||
| 372 | - src="/metronic_v4.5.4//plugins/bootstrap-wizard/jquery.bootstrap.wizard.min.js"></script> | ||
| 373 | -<!-- iCheck 单选框和复选框 --> | ||
| 374 | -<script src="/metronic_v4.5.4/plugins/icheck/icheck.min.js"></script> | ||
| 375 | -<!-- select2 下拉框 --> | ||
| 376 | -<script src="/metronic_v4.5.4/plugins/select2/js/select2.full.min.js"></script> | ||
| 377 | -<!-- MULTI SELECT 多选下拉框 --> | ||
| 378 | -<script | ||
| 379 | - src="/metronic_v4.5.4/plugins/jquery-multi-select/js/jquery.multi-select.js"></script> | ||
| 380 | -<!-- editable.js --> | ||
| 381 | -<script | ||
| 382 | - src="/metronic_v4.5.4/plugins/bootstrap-editable/bootstrap-editable/js/bootstrap-editable.min.js"></script> | ||
| 383 | -<!-- PJAX --> | ||
| 384 | -<script src="/assets/plugins/jquery.pjax.js"></script> | ||
| 385 | -<!-- layer 弹层 --> | ||
| 386 | -<script src="/assets/plugins/layer-v2.4/layer/layer.js" data-exclude=1></script> | ||
| 387 | -<!-- fileinput 上传 --> | ||
| 388 | -<script src="/assets/plugins/fileinput/canvas-to-blob.min.js"></script> | ||
| 389 | -<script src="/assets/plugins/fileinput/purify.min.js"></script> | ||
| 390 | -<script src="/assets/plugins/fileinput/sortable.min.js"></script> | ||
| 391 | -<script src="/assets/plugins/fileinput/fileinput.min.js"></script> | ||
| 392 | -<script src="/assets/plugins/fileinput/fileinput_locale_zh.js"></script> | ||
| 393 | -<!-- jquery.purl URL解析 --> | ||
| 394 | -<script src="/assets/plugins/purl.js"></script> | ||
| 395 | -<!-- jquery.serializejson JSON序列化插件 --> | ||
| 396 | -<script src="/assets/plugins/jquery.serializejson.js"></script> | ||
| 397 | -<!-- art-template 模版引擎 --> | ||
| 398 | -<script src="/assets/plugins/template.js"></script> | ||
| 399 | -<!-- jquery.pageinator 分页 --> | ||
| 400 | -<script src="/assets/plugins/jqPaginator.min.js"></script> | ||
| 401 | -<!-- moment.js 日期处理类库 --> | ||
| 402 | -<script src="/assets/plugins/moment-with-locales.js"></script> | ||
| 403 | - | ||
| 404 | -<script src="/assets/plugins/pinyin.js"></script> | ||
| 405 | -<!-- 日期控件 --> | ||
| 406 | -<script | ||
| 407 | - src="/metronic_v4.5.4/plugins/bootstrap-datetimepicker-2/js/bootstrap-datetimepicker.min.js"></script> | ||
| 408 | -<!-- 表格控件 --> | ||
| 409 | -<script src="/metronic_v4.5.4/plugins/bootstrap-tagsinput/bootstrap-tagsinput.min.js"></script> | ||
| 410 | -<!-- 统计图控件 --> | ||
| 411 | -<!--<script src="/assets/global/getEchart.js"></script> | ||
| 412 | -<script src="/assets/global/echarts.js"></script> --> | ||
| 413 | -<script src="/assets/js/common.js"></script> | ||
| 414 | -<script src="/assets/js/dictionary.js"></script> | ||
| 415 | -<!-- tipso JS --> | ||
| 416 | -<script src="/metronic_v4.5.4/plugins/tipso/js/tipso.js"></script> | ||
| 417 | -<script data-exclude=1> | ||
| 418 | - //初始打开的片段地址 | ||
| 419 | - var initFragment = "^_^initFragment^_^"; | ||
| 420 | - //静态文件目录 | ||
| 421 | - var dir = '/pages/'; | ||
| 422 | - //片段容器 | ||
| 423 | - var pjaxContainer = '#pjax-container' | ||
| 424 | - , angJsContainer = '#route-container'; | ||
| 425 | - | ||
| 426 | - $(document).ajaxError(function (event, jqxhr, settings, thrownError) { | ||
| 427 | - if(jqxhr.status == 403){ | ||
| 428 | - layer.closeAll(); | ||
| 429 | - layer.alert(jqxhr.message?jqxhr.message:'访问被拒绝', {icon: 2, title: '操作失败'}); | ||
| 430 | - } | ||
| 431 | - }); | ||
| 432 | - | ||
| 433 | - $(function () { | ||
| 434 | - $.get('/user/currentUser', function (user) { | ||
| 435 | - $('#indexTopUName').text(user.userName); | ||
| 436 | - }); | ||
| 437 | - | ||
| 438 | - //带 data-pjax 的链接由pjax加载 | ||
| 439 | - $(document).pjax('a[data-pjax]', pjaxContainer); | ||
| 440 | - | ||
| 441 | - //pjax左菜单点击事件 | ||
| 442 | - $(document).on('click', '#leftMenuSidebar a[data-pjax]', function () { | ||
| 443 | - setTitle(this); | ||
| 444 | - | ||
| 445 | - $('#leftMenuSidebar li.nav-item.active').removeClass('active'); | ||
| 446 | - $(this).parent().addClass('active'); | ||
| 447 | - showPjax(); | ||
| 448 | - }); | ||
| 449 | - | ||
| 450 | - //angularjs左菜单点击事件 | ||
| 451 | - $(document).on('click', '#leftMenuSidebar a[data-angularjs]', function () { | ||
| 452 | - setTitle(this); | ||
| 453 | - | ||
| 454 | - $('#leftMenuSidebar li.nav-item.active').removeClass('active'); | ||
| 455 | - $(this).parent().addClass('active'); | ||
| 456 | - showAngJs(); | ||
| 457 | - }); | ||
| 458 | - | ||
| 459 | - //加载左菜单栏 | ||
| 460 | - $get('/module/findByCurrentUser', null, | ||
| 461 | - function (ms) { | ||
| 462 | - var treeArray = createTreeData(ms); | ||
| 463 | - treeArray.sort(function (a, b) { | ||
| 464 | - return a.createDate - b.createDate; | ||
| 465 | - }); | ||
| 466 | - var menuHtml = template('menu_list_temp', {list: treeArray}); | ||
| 467 | - $('#leftMenuSidebar').html(menuHtml); | ||
| 468 | - | ||
| 469 | - //----------- 检查URL ---------------- | ||
| 470 | - var h = location.hash; | ||
| 471 | - if (initFragment && initFragment != '') { | ||
| 472 | - showPjax(); | ||
| 473 | - //普通片段 | ||
| 474 | - loadPage(initFragment); | ||
| 475 | - //选中菜单 | ||
| 476 | - $.each($('#leftMenuSidebar a'), function (i, item) { | ||
| 477 | - if (urlPattern($(item).attr('href'), initFragment)) { | ||
| 478 | - activeLeftMenu(item); | ||
| 479 | - } | ||
| 480 | - }); | ||
| 481 | - } else if (h) { | ||
| 482 | - //angularjs片段 | ||
| 483 | - showAngJs(); | ||
| 484 | - //选中菜单 | ||
| 485 | - $.each($('#leftMenuSidebar a'), function (i, item) { | ||
| 486 | - if ($(item).attr('href') == h) { | ||
| 487 | - activeLeftMenu(item); | ||
| 488 | - } | ||
| 489 | - }); | ||
| 490 | - } | ||
| 491 | - else { | ||
| 492 | - //加载主页 | ||
| 493 | - loadPage('/pages/home.html'); | ||
| 494 | - } | ||
| 495 | - }); | ||
| 496 | - | ||
| 497 | - //修改密码 | ||
| 498 | - $('#changePWD').on('click', function () { | ||
| 499 | - $.get('/pages/permission/user/changePWD.html', function (content) { | ||
| 500 | - layer.open({ | ||
| 501 | - type: 1, | ||
| 502 | - area: ['600px', '360px'], | ||
| 503 | - content: content, | ||
| 504 | - title: '修改密码', | ||
| 505 | - shift: 5, | ||
| 506 | - scrollbar: false, | ||
| 507 | - success: function () { | ||
| 508 | - } | ||
| 509 | - }); | ||
| 510 | - }); | ||
| 511 | - }); | ||
| 512 | - }); | ||
| 513 | - | ||
| 514 | - //modal关闭时销毁dom | ||
| 515 | - $(document).on('hidden.bs.modal', '.modal', function () { | ||
| 516 | - $(this).remove(); | ||
| 517 | - }); | ||
| 518 | - | ||
| 519 | - //pjax加载完成事件 | ||
| 520 | - $(document).on('pjax:success', function () { | ||
| 521 | - var dicts = $(pjaxContainer).find('.nt-dictionary'); | ||
| 522 | - dictionaryUtils.transformDom(dicts); | ||
| 523 | - }); | ||
| 524 | - | ||
| 525 | - function loadPage(url) { | ||
| 526 | - $.pjax({url: url, container: pjaxContainer}) | ||
| 527 | - } | ||
| 528 | - | ||
| 529 | - function urlPattern(a, b) { | ||
| 530 | - var r; | ||
| 531 | - try { | ||
| 532 | - r = a.substring(0, a.lastIndexOf('/')) == b.substring(0, b.lastIndexOf('/')); | ||
| 533 | - } catch (e) { | ||
| 534 | - r = false; | ||
| 535 | - } | ||
| 536 | - return r; | ||
| 537 | - } | ||
| 538 | - | ||
| 539 | - function showPjax() { | ||
| 540 | - $(angJsContainer).removeClass('page-content active').hide(); | ||
| 541 | - $(pjaxContainer).addClass('page-content active'); | ||
| 542 | - } | ||
| 543 | - | ||
| 544 | - function showAngJs() { | ||
| 545 | - $(pjaxContainer).html('').removeClass('page-content active').hide(); | ||
| 546 | - $(angJsContainer).addClass('page-content active'); | ||
| 547 | - } | ||
| 548 | - | ||
| 549 | - function activeLeftMenu(item) { | ||
| 550 | - $(item).parent('.nav-item').addClass('active').parent('.sub-menu').show().parent().addClass('open'); | ||
| 551 | - setTitle(item); | ||
| 552 | - } | ||
| 553 | - | ||
| 554 | - function setTitle(menuItem){ | ||
| 555 | - document.title = $('span.title', menuItem).text(); | ||
| 556 | - } | ||
| 557 | - | ||
| 558 | -</script> | ||
| 559 | -<!-- d3 --> | ||
| 560 | -<script src="/assets/js/d3.min.js" data-exclude=1></script> | ||
| 561 | -<!-- webSocket JS --> | ||
| 562 | -<script src="/assets/js/sockjs.min.js"></script> | ||
| 563 | - | ||
| 564 | -<!-- TODO:angularJS相关库 --> | ||
| 565 | - | ||
| 566 | -<!-- angularJS相关库 --> | ||
| 567 | -<!-- 这个是基于angularjs 1.4.10修改的版本,主要是修改了history控制部分,用于兼容route和pjax的同时操作history的冲突 --> | ||
| 568 | -<script src="/assets/js/angular.js" data-autocephaly=1></script> | ||
| 569 | -<script src="/assets/bower_components/angular-i18n/angular-locale_zh-cn.js" data-autocephaly=1></script> | ||
| 570 | -<script | ||
| 571 | - src="/assets/bower_components/angular-resource/angular-resource.min.js" | ||
| 572 | - data-exclude=1></script> | ||
| 573 | -<script | ||
| 574 | - src="/assets/bower_components/angular-sanitize/angular-sanitize.min.js" | ||
| 575 | - data-exclude=1></script> | ||
| 576 | -<script | ||
| 577 | - src="/assets/bower_components/angular-animate/angular-animate.min.js" | ||
| 578 | - data-exclude=1></script> | ||
| 579 | -<script | ||
| 580 | - src="/assets/bower_components/angular-touch/angular-touch.min.js" | ||
| 581 | - data-exclude=1></script> | ||
| 582 | -<script | ||
| 583 | - src="/assets/bower_components/angular-ui-router/release/angular-ui-router.min.js" | ||
| 584 | - data-exclude=1></script> | ||
| 585 | -<script | ||
| 586 | - src="/assets/bower_components/oclazyload/dist/ocLazyLoad.min.js" | ||
| 587 | - data-exclude=1></script> | ||
| 588 | -<script | ||
| 589 | - src="/assets/bower_components/angular-bootstrap/ui-bootstrap-tpls.min.js" | ||
| 590 | - data-exclude=1></script> | ||
| 591 | -<!-- handsontable相关js --> | ||
| 592 | -<script | ||
| 593 | - src="/assets/bower_components/handsontable/dist/handsontable.full.js"></script> | ||
| 594 | -<script | ||
| 595 | - src="/assets/bower_components/ngHandsontable/dist/ngHandsontable.js"></script> | ||
| 596 | -<!-- sweetalert相关js --> | ||
| 597 | -<script src="/assets/bower_components/sweetalert/dist/sweetalert.min.js"></script> | ||
| 598 | -<script src="/assets/bower_components/ng-sweet-alert/ng-sweet-alert.js"></script> | ||
| 599 | - | ||
| 600 | -<!-- schedule计划调度AngularJS模块主JS --> | ||
| 601 | -<script src="/pages/scheduleApp/module/common/main.js" data-exclude=1></script> | ||
| 602 | -<script | ||
| 603 | - src="/pages/scheduleApp/module/common/prj-common-globalservice.js" | ||
| 604 | - data-exclude=1></script> | ||
| 605 | -<script src="/pages/scheduleApp/module/common/prj-common-filter.js" | ||
| 606 | - data-exclude=1></script> | ||
| 607 | -<script src="/pages/scheduleApp/module/common/prj-common-directive.js" | ||
| 608 | - data-exclude=1></script> | ||
| 609 | -<script | ||
| 610 | - src="/pages/scheduleApp/module/common/prj-common-ui-route-state.js" | ||
| 611 | - data-exclude=1></script> | ||
| 612 | - | ||
| 613 | -<!-- 地图相关 --> | ||
| 614 | -<!-- 百度 --> | ||
| 615 | -<script | ||
| 616 | - src="http://api.map.baidu.com/api?v=2.0&ak=IGGrr4UjwIYzatoCRFKEL8sT" | ||
| 617 | - data-exclude=1></script> | ||
| 618 | -<script | ||
| 619 | - src="http://api.map.baidu.com/library/TrafficControl/1.4/src/TrafficControl_min.js" | ||
| 620 | - data-exclude=1></script> | ||
| 621 | -<script type="text/javascript" | ||
| 622 | - src="http://api.map.baidu.com/library/DrawingManager/1.4/src/DrawingManager_min.js" | ||
| 623 | - data-exclude=1></script> | ||
| 624 | -<script type="text/javascript" | ||
| 625 | - src="http://api.map.baidu.com/library/RichMarker/1.2/src/RichMarker_min.js " | ||
| 626 | - data-exclude=1></script> | ||
| 627 | -<script src="/assets/js/baidu/TextIconOverlay.js" data-exclude=1></script> | ||
| 628 | -<script src="/assets/js/baidu//MarkerClusterer.js" data-exclude=1></script> | ||
| 629 | -<!-- 高德 --> | ||
| 630 | -<script | ||
| 631 | - src="http://webapi.amap.com/maps?v=1.3&key=16cb1c5043847e09ef9edafdd77befda" | ||
| 632 | - data-exclude=1></script> | ||
| 633 | -<!-- echarts4 --> | ||
| 634 | -<script src="/metronic_v4.5.4/plugins/echarts4/echarts.min.js"></script> | ||
| 635 | -<script src="/real_control_v2/assets/plugins/perfect-scrollbar/perfect-scrollbar.jquery.js" merge="plugins"></script> | ||
| 636 | -<!-- RSA加密 --> | ||
| 637 | -<script src="/assets/plugins/jsencrypt.min.js"></script> | ||
| 638 | - | ||
| 639 | -</body> | 1 | +<!DOCTYPE html> |
| 2 | +<html lang="zh"> | ||
| 3 | +<head> | ||
| 4 | + <meta name="renderer" content="webkit" /> | ||
| 5 | + <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" /> | ||
| 6 | + <meta charset="UTF-8"> | ||
| 7 | + <title>调度系统</title> | ||
| 8 | + | ||
| 9 | + <meta http-equiv="Pragma" content="no-cache"> | ||
| 10 | + <meta http-equiv="Cache-control" content="no-cache"> | ||
| 11 | + <meta http-equiv="Cache" content="no-cache"> | ||
| 12 | + | ||
| 13 | + <!-- Font Awesome 图标字体 --> | ||
| 14 | + <link | ||
| 15 | + href="/metronic_v4.5.4/plugins/font-awesome/css/font-awesome.min.css" | ||
| 16 | + rel="stylesheet" type="text/css" /> | ||
| 17 | + <!-- Bootstrap style --> | ||
| 18 | + <link href="/metronic_v4.5.4/plugins/bootstrap/css/bootstrap.min.css" | ||
| 19 | + rel="stylesheet" type="text/css" /> | ||
| 20 | + <!-- jsTree 数插件 --> | ||
| 21 | + <link | ||
| 22 | + href="/metronic_v4.5.4/plugins/jstree/dist/themes/default/style.min.css" | ||
| 23 | + rel="stylesheet" type="text/css" /> | ||
| 24 | + <!-- MULTI-select 多选下拉框美化 --> | ||
| 25 | + <link | ||
| 26 | + href="/metronic_v4.5.4/plugins/jquery-multi-select/css/multi-select.css" | ||
| 27 | + rel="stylesheet" type="text/css" /> | ||
| 28 | + | ||
| 29 | + <!-- editable --> | ||
| 30 | + <link | ||
| 31 | + href="/metronic_v4.5.4/plugins/bootstrap-editable/bootstrap-editable/css/bootstrap-editable.css" | ||
| 32 | + rel="stylesheet" type="text/css" /> | ||
| 33 | + <!-- METRONIC style --> | ||
| 34 | + <link href="/metronic_v4.5.4/layout4/css/themes/light.min.css" | ||
| 35 | + rel="stylesheet" type="text/css" id="style_color" /> | ||
| 36 | + <link href="/metronic_v4.5.4/css/components.css" rel="stylesheet" | ||
| 37 | + type="text/css" /> | ||
| 38 | + <link href="/metronic_v4.5.4/css/plugins.css" rel="stylesheet" | ||
| 39 | + type="text/css" /> | ||
| 40 | + <link href="/metronic_v4.5.4/layout4/css/layout.min.css" | ||
| 41 | + rel="stylesheet" type="text/css" /> | ||
| 42 | + <link href="/metronic_v4.5.4/layout4/css/custom.min.css" | ||
| 43 | + rel="stylesheet" type="text/css" /> | ||
| 44 | + <!-- select2 下拉框插件 --> | ||
| 45 | + <link href="/metronic_v4.5.4/plugins/select2/css/select2.min.css" | ||
| 46 | + rel="stylesheet" type="text/css" /> | ||
| 47 | + <link | ||
| 48 | + href="/metronic_v4.5.4/plugins/select2/css/select2-bootstrap.min.css" | ||
| 49 | + rel="stylesheet" type="text/css" /> | ||
| 50 | + <!-- layer 弹层 插件 --> | ||
| 51 | + <link href="/assets/plugins/layer-v2.4/layer/skin/layer.css" | ||
| 52 | + rel="stylesheet" type="text/css" /> | ||
| 53 | + <!-- fileinput 上传 插件 --> | ||
| 54 | + <link href="/assets/plugins/fileinput/css/fileinput.min.css" | ||
| 55 | + rel="stylesheet" type="text/css" /> | ||
| 56 | + <!-- iCheck 单选框和复选框 --> | ||
| 57 | + <link href="/metronic_v4.5.4/plugins/icheck/skins/all.css" | ||
| 58 | + rel="stylesheet" type="text/css" /> | ||
| 59 | + <!-- 日期控件 --> | ||
| 60 | + <link | ||
| 61 | + href="/metronic_v4.5.4/plugins/bootstrap-datetimepicker-2/css/bootstrap-datetimepicker.min.css" | ||
| 62 | + rel="stylesheet" type="text/css" /> | ||
| 63 | + <!-- table 表格控件 --> | ||
| 64 | + <!--<link rel="stylesheet"--> | ||
| 65 | + <!--href="//api.map.baidu.com/library/DrawingManager/1.4/src/DrawingManager_min.css"--> | ||
| 66 | + <!--type="text/css" />--> | ||
| 67 | + <link href="/metronic_v4.5.4/plugins/bootstrap-tagsinput/bootstrap-tagsinput.css" rel="stylesheet" type="text/css"/> | ||
| 68 | + <!-- handsontable样式 --> | ||
| 69 | + <link rel="stylesheet" | ||
| 70 | + href="/assets/bower_components/handsontable/dist/handsontable.full.css" /> | ||
| 71 | + <!-- sweetalert样式 --> | ||
| 72 | + <link rel="stylesheet" | ||
| 73 | + href="/assets/bower_components/sweetalert/dist/sweetalert.css" /> | ||
| 74 | + <!-- schedule计划调度AngularJS模块主css --> | ||
| 75 | + <link rel="stylesheet" href="/pages/scheduleApp/module/common/main.css" | ||
| 76 | + type="text/css" /> | ||
| 77 | + <link rel="stylesheet" href="/real_control_v2/assets/plugins/perfect-scrollbar/perfect-scrollbar.css" merge="plugins"/> | ||
| 78 | + | ||
| 79 | + <!-- CSS动画 --> | ||
| 80 | + <link | ||
| 81 | + href="/metronic_v4.5.4/plugins/tipso/css/animate.css" | ||
| 82 | + rel="stylesheet" type="text/css" /> | ||
| 83 | + | ||
| 84 | + <!-- 提示工具样式 --> | ||
| 85 | + <link | ||
| 86 | + href="/metronic_v4.5.4/plugins/tipso/css/tipso.css" | ||
| 87 | + rel="stylesheet" type="text/css" /> | ||
| 88 | + | ||
| 89 | + <style type="text/css"> | ||
| 90 | + .searchForm { | ||
| 91 | + | ||
| 92 | + } | ||
| 93 | + | ||
| 94 | + .searchForm .form-group .control-label { | ||
| 95 | + padding-right: 0px; | ||
| 96 | + text-align: right; | ||
| 97 | + margin-top: 7px; | ||
| 98 | + } | ||
| 99 | + | ||
| 100 | + .searchForm .form-group>div { | ||
| 101 | + padding-left: 10px; | ||
| 102 | + padding-right: 0px; | ||
| 103 | + } | ||
| 104 | + | ||
| 105 | + .searchForm .row>div { | ||
| 106 | + padding-left: 0px; | ||
| 107 | + padding-right: 0px; | ||
| 108 | + padding: 5px 0 5px 0; | ||
| 109 | + width: 270px; | ||
| 110 | + display: inline-block; | ||
| 111 | + } | ||
| 112 | + | ||
| 113 | + .searchForm .form-actions { | ||
| 114 | + | ||
| 115 | + } | ||
| 116 | + | ||
| 117 | + tr.row-active td { | ||
| 118 | + border-bottom: 1px solid blue !important; | ||
| 119 | + color: blue; | ||
| 120 | + } | ||
| 121 | + | ||
| 122 | + .ms-container .ms-selectable li.ms-elem-selectable,.ms-container .ms-selection li.ms-elem-selection | ||
| 123 | + { | ||
| 124 | + font-size: 14px; | ||
| 125 | + } | ||
| 126 | + | ||
| 127 | + .ms-container .ms-selectable li.ms-elem-selectable,.ms-container .ms-selection li.ms-elem-selection | ||
| 128 | + { | ||
| 129 | + padding: 6px 26px; | ||
| 130 | + } | ||
| 131 | + | ||
| 132 | + .ms-container .ms-list { | ||
| 133 | + height: 306px; | ||
| 134 | + } | ||
| 135 | + | ||
| 136 | + .ms-container .ms-selectable,.ms-container .ms-selection { | ||
| 137 | + width: 47%; | ||
| 138 | + } | ||
| 139 | + | ||
| 140 | + .ms-container { | ||
| 141 | + width: 470px; | ||
| 142 | + margin: auto; | ||
| 143 | + } | ||
| 144 | + | ||
| 145 | + .multi-custom-header-left { | ||
| 146 | + text-align: center; | ||
| 147 | + padding: 7px; | ||
| 148 | + color: #3B3F51; | ||
| 149 | + } | ||
| 150 | + | ||
| 151 | + .multi-custom-header-right { | ||
| 152 | + text-align: center; | ||
| 153 | + padding: 7px; | ||
| 154 | + font-weight: bold; | ||
| 155 | + color: #36C6D3; | ||
| 156 | + } | ||
| 157 | + | ||
| 158 | + .mt-element-list .list-simple.mt-list-container ul>.mt-list-item>.list-item-content | ||
| 159 | + { | ||
| 160 | + padding: 0 55px 0 0px; | ||
| 161 | + } | ||
| 162 | + | ||
| 163 | + .mt-element-list .list-simple.mt-list-container ul>.mt-list-item { | ||
| 164 | + padding: 3.3px 0; | ||
| 165 | + } | ||
| 166 | + | ||
| 167 | + #route-container { | ||
| 168 | + display: none; | ||
| 169 | + } | ||
| 170 | + | ||
| 171 | + .page-content.active { | ||
| 172 | + display: block !important; | ||
| 173 | + } | ||
| 174 | + | ||
| 175 | + .page-header.navbar .page-logo .logo-default { | ||
| 176 | + margin: 0; | ||
| 177 | + } | ||
| 178 | + | ||
| 179 | + .page-header.navbar .top-menu .navbar-nav>li.dropdown.open .dropdown-toggle | ||
| 180 | + { | ||
| 181 | + background-color: #284a99; | ||
| 182 | + } | ||
| 183 | + | ||
| 184 | + .page-header.navbar .page-logo { | ||
| 185 | + padding-right: 10px; | ||
| 186 | + } | ||
| 187 | + | ||
| 188 | + .page-logo .logo-default.logo-default-text { | ||
| 189 | + font-weight: 600; | ||
| 190 | + color: white !important; | ||
| 191 | + margin-top: 19px !important; | ||
| 192 | + font-size: 24px; | ||
| 193 | + text-decoration: none; | ||
| 194 | + } | ||
| 195 | + | ||
| 196 | + .page-logo .logo-default.logo-default-text:HOVER { | ||
| 197 | + color: #dedede !important; | ||
| 198 | + } | ||
| 199 | + | ||
| 200 | + body,.page-content-wrapper,#pjax-container{ | ||
| 201 | + height: 100%; | ||
| 202 | + } | ||
| 203 | + html{ | ||
| 204 | + height: 90%; | ||
| 205 | + } | ||
| 206 | + .page-container{ | ||
| 207 | + height: 100%; | ||
| 208 | + } | ||
| 209 | + </style> | ||
| 210 | + | ||
| 211 | + <!-- ocLazyLoading载入文件的位置 --> | ||
| 212 | + <link id="ng_load_plugins_before" /> | ||
| 213 | + | ||
| 214 | +</head> | ||
| 215 | +<body | ||
| 216 | + class="page-container-bg-solid page-header-fixed page-sidebar-closed-hide-logo page-sidebar-fixed"> | ||
| 217 | +<div class="page-header navbar navbar-fixed-top" | ||
| 218 | + style="background: linear-gradient(to bottom, #124e78, #125688);"> | ||
| 219 | + <div class="page-header-inner "> | ||
| 220 | + <!-- LOGO --> | ||
| 221 | + <div class="page-logo"> | ||
| 222 | + <a href="index.html" class="logo-default logo-default-text"> | ||
| 223 | + 浦东公交调度系统 </a> | ||
| 224 | + <div class="menu-toggler sidebar-toggler"></div> | ||
| 225 | + </div> | ||
| 226 | + <!-- END LOGO --> | ||
| 227 | + <a href="javascript:;" class="menu-toggler responsive-toggler" | ||
| 228 | + data-toggle="collapse" data-target=".navbar-collapse"> </a> | ||
| 229 | + <div class="page-top"> | ||
| 230 | + <div class="top-menu"> | ||
| 231 | + <ul class="nav navbar-nav pull-right"> | ||
| 232 | + <!-- 信息通知区 --> | ||
| 233 | + <li | ||
| 234 | + class="dropdown dropdown-extended dropdown-notification dropdown-dark" | ||
| 235 | + id="header_notification_bar"><a href="javascript:;" | ||
| 236 | + class="dropdown-toggle" data-toggle="dropdown" | ||
| 237 | + data-hover="dropdown" data-close-others="true"> <i | ||
| 238 | + class="fa fa-bell"></i> <span class="badge badge-success"> | ||
| 239 | + 0 </span> | ||
| 240 | + </a> | ||
| 241 | + <ul class="dropdown-menu" style="max-width: 345px; width: 345px;"> | ||
| 242 | + <li class="external"> | ||
| 243 | + <h3> | ||
| 244 | + 今日 <span class="bold">0 条</span> 通知 | ||
| 245 | + </h3> <a href="javascript:;">查看全部</a> | ||
| 246 | + </li> | ||
| 247 | + <li> | ||
| 248 | + <ul class="dropdown-menu-list scroller" style="height: 250px;" | ||
| 249 | + data-handle-color="#637283"> | ||
| 250 | + </ul> | ||
| 251 | + </li> | ||
| 252 | + </ul></li> | ||
| 253 | + <li class="dropdown dropdown-user dropdown-dark"><a | ||
| 254 | + href="javascript:;" class="dropdown-toggle" | ||
| 255 | + data-toggle="dropdown" data-hover="dropdown" | ||
| 256 | + data-close-others="true"> <span id="indexTopUName" | ||
| 257 | + class="username username-hide-on-mobile" | ||
| 258 | + style="vertical-align: middle;"> <i class="fa fa-user"></i></span> | ||
| 259 | + </a> | ||
| 260 | + <ul class="dropdown-menu dropdown-menu-default"> | ||
| 261 | + <li><a href="javascript:;"> <i class="fa fa-user"></i> | ||
| 262 | + 我的信息 | ||
| 263 | + </a></li> | ||
| 264 | + <li><a href="javascript:;" id="changePWD"> <i | ||
| 265 | + class="fa fa-unlock-alt"></i> 修改密码 | ||
| 266 | + </a></li> | ||
| 267 | + <li class="divider"></li> | ||
| 268 | + <li><a href="javascript:;"> <i class="fa fa-lock"></i> | ||
| 269 | + 锁屏 | ||
| 270 | + </a></li> | ||
| 271 | + <li><a href="/logout"> <i class="fa fa-key"></i> 注销登陆 | ||
| 272 | + </a></li> | ||
| 273 | + </ul></li> | ||
| 274 | + </ul> | ||
| 275 | + </div> | ||
| 276 | + </div> | ||
| 277 | + </div> | ||
| 278 | +</div> | ||
| 279 | +<div class="page-container"> | ||
| 280 | + <div class="page-sidebar-wrapper"> | ||
| 281 | + <div class="page-sidebar navbar-collapse collapse"> | ||
| 282 | + <ul class="page-sidebar-menu page-sidebar-menu-fixed" | ||
| 283 | + data-keep-expanded="false" data-auto-scroll="true" | ||
| 284 | + data-slide-speed="200" id="leftMenuSidebar"> | ||
| 285 | + </ul> | ||
| 286 | + </div> | ||
| 287 | + </div> | ||
| 288 | + <div class="page-content-wrapper"> | ||
| 289 | + <div id="pjax-container" class="page-content"></div> | ||
| 290 | + | ||
| 291 | + <div id="route-container"> | ||
| 292 | + <div ng-app="ScheduleApp"> | ||
| 293 | + <div ng-controller="ScheduleAppController"> | ||
| 294 | + | ||
| 295 | + <!-- loading widget --> | ||
| 296 | + <div id="loadingWidget" class="flyover mask" loading-widget> | ||
| 297 | + <div class="alert alert-info"> | ||
| 298 | + <strong>载入中......</strong> | ||
| 299 | + </div> | ||
| 300 | + </div> | ||
| 301 | + | ||
| 302 | + <div ui-view class="uv"></div> | ||
| 303 | + </div> | ||
| 304 | + </div> | ||
| 305 | + </div> | ||
| 306 | + </div> | ||
| 307 | +</div> | ||
| 308 | + | ||
| 309 | +<script id="menu_list_temp" type="text/html"> | ||
| 310 | + {{each list as group i}} | ||
| 311 | + <li class="heading"> | ||
| 312 | + <h3 class="uppercase">{{group.name}}</h3> | ||
| 313 | + </li> | ||
| 314 | + {{each group.children as dir j}} | ||
| 315 | + <li class="nav-item"> | ||
| 316 | + <a href="javascript:;" class="nav-link nav-toggle "> | ||
| 317 | + <i class="{{dir.icon}}"></i> | ||
| 318 | + <span class="title">{{dir.name}}</span> | ||
| 319 | + <span class="arrow"></span> | ||
| 320 | + </a> | ||
| 321 | + <ul class="sub-menu"> | ||
| 322 | + {{each dir.children as module s}} | ||
| 323 | + <li class="nav-item "> | ||
| 324 | + {{if module.container=="pjax-container"}} | ||
| 325 | + <a href="/pages/{{module.path}}" class="nav-link " data-pjax> | ||
| 326 | + <span class="title">{{module.name}}</span> | ||
| 327 | + </a> | ||
| 328 | + {{else}} | ||
| 329 | + <a href="{{module.path}}" class="nav-link " data-angularjs> | ||
| 330 | + <span class="title">{{module.name}}</span> | ||
| 331 | + </a> | ||
| 332 | + {{/if}} | ||
| 333 | + </li> | ||
| 334 | + {{/each}} | ||
| 335 | + </ul> | ||
| 336 | + </li> | ||
| 337 | + {{/each}} | ||
| 338 | + {{/each}} | ||
| 339 | + | ||
| 340 | +</script> | ||
| 341 | +<script> | ||
| 342 | + delete window.require; | ||
| 343 | + delete window.exports; | ||
| 344 | + delete window.module; | ||
| 345 | +</script> | ||
| 346 | +<!-- jQuery --> | ||
| 347 | +<script src="/metronic_v4.5.4/plugins/jquery.min.js" data-exclude=1></script> | ||
| 348 | +<!-- bootstrap --> | ||
| 349 | +<script src="/metronic_v4.5.4/plugins/bootstrap/js/bootstrap.min.js" | ||
| 350 | + data-exclude=1></script> | ||
| 351 | +<script src="/pages/forms/statement/js/jquery.autocompleter.js"></script> | ||
| 352 | +<script src="/pages/forms/statement/js/jquery.PrintArea.js"></script> | ||
| 353 | +<!-- MTRONIC JS --> | ||
| 354 | +<script src="/metronic_v4.5.4/scripts/app.min.js" data-exclude=1></script> | ||
| 355 | +<script src="/metronic_v4.5.4/layout4/scripts/layout.min.js" | ||
| 356 | + data-exclude=1></script> | ||
| 357 | +<!-- 虚拟滚动条 --> | ||
| 358 | +<script | ||
| 359 | + src="/metronic_v4.5.4/plugins/jquery-slimscroll/jquery.slimscroll.min.js"></script> | ||
| 360 | +<!-- jsTree 树插件 --> | ||
| 361 | +<script src="/metronic_v4.5.4/plugins/jstree/dist/jstree.min.js"></script> | ||
| 362 | +<!-- bootstrap-hover-dropDown --> | ||
| 363 | +<script | ||
| 364 | + src="/metronic_v4.5.4/plugins/bootstrap-hover-dropdown/bootstrap-hover-dropdown.min.js"></script> | ||
| 365 | +<!-- jquery.validate 表单验证 --> | ||
| 366 | +<script | ||
| 367 | + src="/metronic_v4.5.4/plugins/jquery-validation/js/jquery.validate.min.js"></script> | ||
| 368 | +<script | ||
| 369 | + src="/metronic_v4.5.4/plugins/jquery-validation/js/localization/messages_zh.js"></script> | ||
| 370 | +<!-- 向导式插件 --> | ||
| 371 | +<script | ||
| 372 | + src="/metronic_v4.5.4//plugins/bootstrap-wizard/jquery.bootstrap.wizard.min.js"></script> | ||
| 373 | +<!-- iCheck 单选框和复选框 --> | ||
| 374 | +<script src="/metronic_v4.5.4/plugins/icheck/icheck.min.js"></script> | ||
| 375 | +<!-- select2 下拉框 --> | ||
| 376 | +<script src="/metronic_v4.5.4/plugins/select2/js/select2.full.min.js"></script> | ||
| 377 | +<!-- MULTI SELECT 多选下拉框 --> | ||
| 378 | +<script | ||
| 379 | + src="/metronic_v4.5.4/plugins/jquery-multi-select/js/jquery.multi-select.js"></script> | ||
| 380 | +<!-- editable.js --> | ||
| 381 | +<script | ||
| 382 | + src="/metronic_v4.5.4/plugins/bootstrap-editable/bootstrap-editable/js/bootstrap-editable.min.js"></script> | ||
| 383 | +<!-- PJAX --> | ||
| 384 | +<script src="/assets/plugins/jquery.pjax.js"></script> | ||
| 385 | +<!-- layer 弹层 --> | ||
| 386 | +<script src="/assets/plugins/layer-v2.4/layer/layer.js" data-exclude=1></script> | ||
| 387 | +<!-- fileinput 上传 --> | ||
| 388 | +<script src="/assets/plugins/fileinput/canvas-to-blob.min.js"></script> | ||
| 389 | +<script src="/assets/plugins/fileinput/purify.min.js"></script> | ||
| 390 | +<script src="/assets/plugins/fileinput/sortable.min.js"></script> | ||
| 391 | +<script src="/assets/plugins/fileinput/fileinput.min.js"></script> | ||
| 392 | +<script src="/assets/plugins/fileinput/fileinput_locale_zh.js"></script> | ||
| 393 | +<!-- jquery.purl URL解析 --> | ||
| 394 | +<script src="/assets/plugins/purl.js"></script> | ||
| 395 | +<!-- jquery.serializejson JSON序列化插件 --> | ||
| 396 | +<script src="/assets/plugins/jquery.serializejson.js"></script> | ||
| 397 | +<!-- art-template 模版引擎 --> | ||
| 398 | +<script src="/assets/plugins/template.js"></script> | ||
| 399 | +<!-- jquery.pageinator 分页 --> | ||
| 400 | +<script src="/assets/plugins/jqPaginator.min.js"></script> | ||
| 401 | +<!-- moment.js 日期处理类库 --> | ||
| 402 | +<script src="/assets/plugins/moment-with-locales.js"></script> | ||
| 403 | + | ||
| 404 | +<script src="/assets/plugins/pinyin.js"></script> | ||
| 405 | +<!-- 日期控件 --> | ||
| 406 | +<script | ||
| 407 | + src="/metronic_v4.5.4/plugins/bootstrap-datetimepicker-2/js/bootstrap-datetimepicker.min.js"></script> | ||
| 408 | +<!-- 表格控件 --> | ||
| 409 | +<script src="/metronic_v4.5.4/plugins/bootstrap-tagsinput/bootstrap-tagsinput.min.js"></script> | ||
| 410 | +<!-- 统计图控件 --> | ||
| 411 | +<!--<script src="/assets/global/getEchart.js"></script> | ||
| 412 | +<script src="/assets/global/echarts.js"></script> --> | ||
| 413 | +<script src="/assets/js/common.js"></script> | ||
| 414 | +<script src="/assets/js/dictionary.js"></script> | ||
| 415 | +<!-- tipso JS --> | ||
| 416 | +<script src="/metronic_v4.5.4/plugins/tipso/js/tipso.js"></script> | ||
| 417 | +<script data-exclude=1> | ||
| 418 | + //初始打开的片段地址 | ||
| 419 | + var initFragment = "^_^initFragment^_^"; | ||
| 420 | + //静态文件目录 | ||
| 421 | + var dir = '/pages/'; | ||
| 422 | + //片段容器 | ||
| 423 | + var pjaxContainer = '#pjax-container' | ||
| 424 | + , angJsContainer = '#route-container'; | ||
| 425 | + | ||
| 426 | + $(document).ajaxError(function (event, jqxhr, settings, thrownError) { | ||
| 427 | + if(jqxhr.status == 403){ | ||
| 428 | + layer.closeAll(); | ||
| 429 | + layer.alert(jqxhr.message?jqxhr.message:'访问被拒绝', {icon: 2, title: '操作失败'}); | ||
| 430 | + } | ||
| 431 | + }); | ||
| 432 | + | ||
| 433 | + $(function () { | ||
| 434 | + $.get('/user/currentUser', function (user) { | ||
| 435 | + $('#indexTopUName').text(user.userName); | ||
| 436 | + }); | ||
| 437 | + | ||
| 438 | + //带 data-pjax 的链接由pjax加载 | ||
| 439 | + $(document).pjax('a[data-pjax]', pjaxContainer); | ||
| 440 | + | ||
| 441 | + //pjax左菜单点击事件 | ||
| 442 | + $(document).on('click', '#leftMenuSidebar a[data-pjax]', function () { | ||
| 443 | + setTitle(this); | ||
| 444 | + | ||
| 445 | + $('#leftMenuSidebar li.nav-item.active').removeClass('active'); | ||
| 446 | + $(this).parent().addClass('active'); | ||
| 447 | + showPjax(); | ||
| 448 | + }); | ||
| 449 | + | ||
| 450 | + //angularjs左菜单点击事件 | ||
| 451 | + $(document).on('click', '#leftMenuSidebar a[data-angularjs]', function () { | ||
| 452 | + setTitle(this); | ||
| 453 | + | ||
| 454 | + $('#leftMenuSidebar li.nav-item.active').removeClass('active'); | ||
| 455 | + $(this).parent().addClass('active'); | ||
| 456 | + showAngJs(); | ||
| 457 | + }); | ||
| 458 | + | ||
| 459 | + //加载左菜单栏 | ||
| 460 | + $get('/module/findByCurrentUser', null, | ||
| 461 | + function (ms) { | ||
| 462 | + var treeArray = createTreeData(ms); | ||
| 463 | + treeArray.sort(function (a, b) { | ||
| 464 | + return a.createDate - b.createDate; | ||
| 465 | + }); | ||
| 466 | + var menuHtml = template('menu_list_temp', {list: treeArray}); | ||
| 467 | + $('#leftMenuSidebar').html(menuHtml); | ||
| 468 | + | ||
| 469 | + //----------- 检查URL ---------------- | ||
| 470 | + var h = location.hash; | ||
| 471 | + if (initFragment && initFragment != '') { | ||
| 472 | + showPjax(); | ||
| 473 | + //普通片段 | ||
| 474 | + loadPage(initFragment); | ||
| 475 | + //选中菜单 | ||
| 476 | + $.each($('#leftMenuSidebar a'), function (i, item) { | ||
| 477 | + if (urlPattern($(item).attr('href'), initFragment)) { | ||
| 478 | + activeLeftMenu(item); | ||
| 479 | + } | ||
| 480 | + }); | ||
| 481 | + } else if (h) { | ||
| 482 | + //angularjs片段 | ||
| 483 | + showAngJs(); | ||
| 484 | + //选中菜单 | ||
| 485 | + $.each($('#leftMenuSidebar a'), function (i, item) { | ||
| 486 | + if ($(item).attr('href') == h) { | ||
| 487 | + activeLeftMenu(item); | ||
| 488 | + } | ||
| 489 | + }); | ||
| 490 | + } | ||
| 491 | + else { | ||
| 492 | + //加载主页 | ||
| 493 | + loadPage('/pages/home.html'); | ||
| 494 | + } | ||
| 495 | + }); | ||
| 496 | + | ||
| 497 | + //修改密码 | ||
| 498 | + $('#changePWD').on('click', function () { | ||
| 499 | + $.get('/pages/permission/user/changePWD.html', function (content) { | ||
| 500 | + layer.open({ | ||
| 501 | + type: 1, | ||
| 502 | + area: ['600px', '360px'], | ||
| 503 | + content: content, | ||
| 504 | + title: '修改密码', | ||
| 505 | + shift: 5, | ||
| 506 | + scrollbar: false, | ||
| 507 | + success: function () { | ||
| 508 | + } | ||
| 509 | + }); | ||
| 510 | + }); | ||
| 511 | + }); | ||
| 512 | + }); | ||
| 513 | + | ||
| 514 | + //modal关闭时销毁dom | ||
| 515 | + $(document).on('hidden.bs.modal', '.modal', function () { | ||
| 516 | + $(this).remove(); | ||
| 517 | + }); | ||
| 518 | + | ||
| 519 | + //pjax加载完成事件 | ||
| 520 | + $(document).on('pjax:success', function () { | ||
| 521 | + var dicts = $(pjaxContainer).find('.nt-dictionary'); | ||
| 522 | + dictionaryUtils.transformDom(dicts); | ||
| 523 | + }); | ||
| 524 | + | ||
| 525 | + function loadPage(url) { | ||
| 526 | + $.pjax({url: url, container: pjaxContainer}) | ||
| 527 | + } | ||
| 528 | + | ||
| 529 | + function urlPattern(a, b) { | ||
| 530 | + var r; | ||
| 531 | + try { | ||
| 532 | + r = a.substring(0, a.lastIndexOf('/')) == b.substring(0, b.lastIndexOf('/')); | ||
| 533 | + } catch (e) { | ||
| 534 | + r = false; | ||
| 535 | + } | ||
| 536 | + return r; | ||
| 537 | + } | ||
| 538 | + | ||
| 539 | + function showPjax() { | ||
| 540 | + $(angJsContainer).removeClass('page-content active').hide(); | ||
| 541 | + $(pjaxContainer).addClass('page-content active'); | ||
| 542 | + } | ||
| 543 | + | ||
| 544 | + function showAngJs() { | ||
| 545 | + $(pjaxContainer).html('').removeClass('page-content active').hide(); | ||
| 546 | + $(angJsContainer).addClass('page-content active'); | ||
| 547 | + } | ||
| 548 | + | ||
| 549 | + function activeLeftMenu(item) { | ||
| 550 | + $(item).parent('.nav-item').addClass('active').parent('.sub-menu').show().parent().addClass('open'); | ||
| 551 | + setTitle(item); | ||
| 552 | + } | ||
| 553 | + | ||
| 554 | + function setTitle(menuItem){ | ||
| 555 | + document.title = $('span.title', menuItem).text(); | ||
| 556 | + } | ||
| 557 | + | ||
| 558 | +</script> | ||
| 559 | +<!-- d3 --> | ||
| 560 | +<script src="/assets/js/d3.min.js" data-exclude=1></script> | ||
| 561 | +<!-- webSocket JS --> | ||
| 562 | +<script src="/assets/js/sockjs.min.js"></script> | ||
| 563 | + | ||
| 564 | +<!-- TODO:angularJS相关库 --> | ||
| 565 | + | ||
| 566 | +<!-- angularJS相关库 --> | ||
| 567 | +<!-- 这个是基于angularjs 1.4.10修改的版本,主要是修改了history控制部分,用于兼容route和pjax的同时操作history的冲突 --> | ||
| 568 | +<script src="/assets/js/angular.js" data-autocephaly=1></script> | ||
| 569 | +<script src="/assets/bower_components/angular-i18n/angular-locale_zh-cn.js" data-autocephaly=1></script> | ||
| 570 | +<script | ||
| 571 | + src="/assets/bower_components/angular-resource/angular-resource.min.js" | ||
| 572 | + data-exclude=1></script> | ||
| 573 | +<script | ||
| 574 | + src="/assets/bower_components/angular-sanitize/angular-sanitize.min.js" | ||
| 575 | + data-exclude=1></script> | ||
| 576 | +<script | ||
| 577 | + src="/assets/bower_components/angular-animate/angular-animate.min.js" | ||
| 578 | + data-exclude=1></script> | ||
| 579 | +<script | ||
| 580 | + src="/assets/bower_components/angular-touch/angular-touch.min.js" | ||
| 581 | + data-exclude=1></script> | ||
| 582 | +<script | ||
| 583 | + src="/assets/bower_components/angular-ui-router/release/angular-ui-router.min.js" | ||
| 584 | + data-exclude=1></script> | ||
| 585 | +<script | ||
| 586 | + src="/assets/bower_components/oclazyload/dist/ocLazyLoad.min.js" | ||
| 587 | + data-exclude=1></script> | ||
| 588 | +<script | ||
| 589 | + src="/assets/bower_components/angular-bootstrap/ui-bootstrap-tpls.min.js" | ||
| 590 | + data-exclude=1></script> | ||
| 591 | +<!-- handsontable相关js --> | ||
| 592 | +<script | ||
| 593 | + src="/assets/bower_components/handsontable/dist/handsontable.full.js"></script> | ||
| 594 | +<script | ||
| 595 | + src="/assets/bower_components/ngHandsontable/dist/ngHandsontable.js"></script> | ||
| 596 | +<!-- sweetalert相关js --> | ||
| 597 | +<script src="/assets/bower_components/sweetalert/dist/sweetalert.min.js"></script> | ||
| 598 | +<script src="/assets/bower_components/ng-sweet-alert/ng-sweet-alert.js"></script> | ||
| 599 | + | ||
| 600 | +<!-- schedule计划调度AngularJS模块主JS --> | ||
| 601 | +<script src="/pages/scheduleApp/module/common/main.js" data-exclude=1></script> | ||
| 602 | +<script | ||
| 603 | + src="/pages/scheduleApp/module/common/prj-common-globalservice.js" | ||
| 604 | + data-exclude=1></script> | ||
| 605 | +<script src="/pages/scheduleApp/module/common/prj-common-filter.js" | ||
| 606 | + data-exclude=1></script> | ||
| 607 | +<script src="/pages/scheduleApp/module/common/prj-common-directive.js" | ||
| 608 | + data-exclude=1></script> | ||
| 609 | +<script | ||
| 610 | + src="/pages/scheduleApp/module/common/prj-common-ui-route-state.js" | ||
| 611 | + data-exclude=1></script> | ||
| 612 | + | ||
| 613 | +<!-- 地图相关 --> | ||
| 614 | +<!-- 百度 --> | ||
| 615 | +<script | ||
| 616 | + src="//api.map.baidu.com/api?v=2.0&ak=IGGrr4UjwIYzatoCRFKEL8sT" | ||
| 617 | + data-exclude=1></script> | ||
| 618 | +<script | ||
| 619 | + src="//api.map.baidu.com/library/TrafficControl/1.4/src/TrafficControl_min.js" | ||
| 620 | + data-exclude=1></script> | ||
| 621 | +<script type="text/javascript" | ||
| 622 | + src="//api.map.baidu.com/library/DrawingManager/1.4/src/DrawingManager_min.js" | ||
| 623 | + data-exclude=1></script> | ||
| 624 | +<script type="text/javascript" | ||
| 625 | + src="//api.map.baidu.com/library/RichMarker/1.2/src/RichMarker_min.js " | ||
| 626 | + data-exclude=1></script> | ||
| 627 | +<script src="/assets/js/baidu/TextIconOverlay.js" data-exclude=1></script> | ||
| 628 | +<script src="/assets/js/baidu//MarkerClusterer.js" data-exclude=1></script> | ||
| 629 | +<!-- 高德 --> | ||
| 630 | +<script | ||
| 631 | + src="//webapi.amap.com/maps?v=1.3&key=16cb1c5043847e09ef9edafdd77befda" | ||
| 632 | + data-exclude=1></script> | ||
| 633 | +<!-- echarts4 --> | ||
| 634 | +<script src="/metronic_v4.5.4/plugins/echarts4/echarts.min.js"></script> | ||
| 635 | +<script src="/real_control_v2/assets/plugins/perfect-scrollbar/perfect-scrollbar.jquery.js" merge="plugins"></script> | ||
| 636 | +<!-- RSA加密 --> | ||
| 637 | +<script src="/assets/plugins/jsencrypt.min.js"></script> | ||
| 638 | + | ||
| 639 | +</body> | ||
| 640 | </html> | 640 | </html> |
| 641 | \ No newline at end of file | 641 | \ No newline at end of file |
src/main/resources/static/pages/base/line/editRoute.html
| 1 | -<!-- 手动添加站点 --> | ||
| 2 | -<div class="modal fade" id="edit_route_mobal" tabindex="-1" role="basic" | ||
| 3 | - aria-hidden="true"> | ||
| 4 | - | ||
| 5 | - <div class="modal-dialog"> | ||
| 6 | - | ||
| 7 | - <div class="modal-content" > | ||
| 8 | - | ||
| 9 | - <div class="modal-header"> | ||
| 10 | - <button type="button" class="close" data-dismiss="modal" | ||
| 11 | - aria-hidden="true"></button> | ||
| 12 | - <h4 class="modal-title">生成路线(站点和路段)</h4> | ||
| 13 | - </div> | ||
| 14 | - | ||
| 15 | - <div class="modal-body"> | ||
| 16 | - | ||
| 17 | - <form class="form-horizontal" role="form" | ||
| 18 | - id="save_route_template_form" action="" method=""> | ||
| 19 | - | ||
| 20 | - <div class="alert alert-danger display-hide"> | ||
| 21 | - <button class="close" data-close="alert"></button> | ||
| 22 | - 您的输入有误,请检查下面的输入项 | ||
| 23 | - </div> | ||
| 24 | - | ||
| 25 | - <!-- 站点名称 --> | ||
| 26 | - <div class="form-body"> | ||
| 27 | - | ||
| 28 | - <div class="form-group"> | ||
| 29 | - <label class="control-label col-md-2"> <span | ||
| 30 | - class="required"> * </span> 坐标: | ||
| 31 | - </label> | ||
| 32 | - <div class="col-md-10"> | ||
| 33 | - <textarea class="form-control" rows="12" name="points" | ||
| 34 | - id="pointInput" placeholder="坐标点"></textarea> | ||
| 35 | - </div> | ||
| 36 | - </div> | ||
| 37 | - </div> | ||
| 38 | - <div class="form-group"> | ||
| 39 | - <label class="col-md-3 control-label">选择文本类型:</label> | ||
| 40 | - <div class="col-md-3"> | ||
| 41 | - <div class="icheck-list"> | ||
| 42 | - <label> <input type="radio" class="icheck" | ||
| 43 | - name="typeCheck" value='0' checked> txt | ||
| 44 | - </label> <label> <input type="radio" class="icheck" | ||
| 45 | - name="typeCheck" value='1'> xml | ||
| 46 | - </label> | ||
| 47 | - </div> | ||
| 48 | - </div> | ||
| 49 | - <label class="col-md-3 control-label">选择方向:</label> | ||
| 50 | - <div class="col-md-3"> | ||
| 51 | - <div class="icheck-list"> | ||
| 52 | - <label> <input type="radio" class="icheck" | ||
| 53 | - name="dirCheck" value='0' checked> 上行 | ||
| 54 | - </label> <label> <input type="radio" class="icheck" | ||
| 55 | - name="dirCheck" value='1'> 下行 | ||
| 56 | - </label> | ||
| 57 | - </div> | ||
| 58 | - </div> | ||
| 59 | - </div> | ||
| 60 | - <div class="form-group"> | ||
| 61 | - <div class="alert alert-info font-blue-chambray" | ||
| 62 | - style="background-color: #2C3E50"> | ||
| 63 | - <h5 class="block"> | ||
| 64 | - <span class="help-block" style="color: #1bbc9b;"> * | ||
| 65 | - 坐标生成路线规划说明: </span> | ||
| 66 | - </h5> | ||
| 67 | - <p> | ||
| 68 | - | ||
| 69 | - <span class="help-block" style="color: #1bbc9b;"> | ||
| 70 | - 1.txt格式 | ||
| 71 | - <br> 请在文本域中按顺序依次输坐标点,每行中的数据之间用【Tab】键隔开(如果是站点,请将在坐标后面加 stop;没有 | ||
| 72 | - stop默认是路段点,连续带stop的坐标认为是同一个站点),每输入完一个坐标时请按回车键【Enter】换行. 例如: | ||
| 73 | - <br>121.511870 31.180638 043703.000 | ||
| 74 | - <br>121.511870 31.180643 043705.000 | ||
| 75 | - <br>121.511870 31.180648 043706.000 Stop | ||
| 76 | - <br>121.511872 31.180653 043707.000 | ||
| 77 | - </span> | ||
| 78 | - </p> | ||
| 79 | - <p> | ||
| 80 | - | ||
| 81 | - <span class="help-block" style="color: #1bbc9b;"> | ||
| 82 | - 2.xml格式 | ||
| 83 | - <br>用gps生成工具,生成的kml文件里的数据 | ||
| 84 | - </span> | ||
| 85 | - </p> | ||
| 86 | - </div> | ||
| 87 | - </div> | ||
| 88 | - </form> | ||
| 89 | - </div> | ||
| 90 | - <div class="modal-footer"> | ||
| 91 | - <button type="button" class="btn default" data-dismiss="modal" | ||
| 92 | - id="addMobalHiden">取消</button> | ||
| 93 | -<!-- <button type="button" class="btn btn-primary hidden" id="referenceCurrentVersion">引用当前版本</button> --> | ||
| 94 | - <button type="button" class="btn btn-primary" id="templateSaveData">提交数据</button> | ||
| 95 | - </div> | ||
| 96 | - </div> | ||
| 97 | - </div> | ||
| 98 | -</div> | ||
| 99 | -<script type="text/javascript"> | ||
| 100 | - | ||
| 101 | -$('#edit_route_mobal').on('editRouteMobal.show', function(e,transGPS,editRoute,map,dra,ajaxd,fun){ | ||
| 102 | - // 延迟加载显示mobal | ||
| 103 | - setTimeout(function(){$('#edit_route_mobal').modal({show : true,backdrop: 'static', keyboard: false});},200); | ||
| 104 | - // 获取表单元素 | ||
| 105 | - var form = $('#save_route_template_form'); | ||
| 106 | - | ||
| 107 | - // 获取错误提示信息元素 | ||
| 108 | - var error = $('.alert-danger', form); | ||
| 109 | - | ||
| 110 | - // 提交数据点击事件 | ||
| 111 | - $('.modal-footer #templateSaveData').on('click',function() { | ||
| 112 | - form.submit(); | ||
| 113 | - }); | ||
| 114 | - | ||
| 115 | - | ||
| 116 | - //从xml中获取节点内容 | ||
| 117 | - function getXmlNode(str){ | ||
| 118 | - //创建文档对象 | ||
| 119 | - var parser=new DOMParser(); | ||
| 120 | - var xmlDoc=parser.parseFromString(str,"text/xml"); | ||
| 121 | - | ||
| 122 | - //提取数据 | ||
| 123 | - var countrys = xmlDoc.getElementsByTagName('coordinates'); | ||
| 124 | - //var countrys = xmlDoc.getElementsByTagName('DataSource'); | ||
| 125 | - | ||
| 126 | - var arr = []; | ||
| 127 | - | ||
| 128 | - for (var i = 0; i < countrys.length; i++) { | ||
| 129 | - arr.push(countrys[i].textContent); | ||
| 130 | - }; | ||
| 131 | - // console.log(arr); | ||
| 132 | - return arr; | ||
| 133 | - | ||
| 134 | - } | ||
| 135 | - | ||
| 136 | - // xml方式上传是,处理转成txt格式的方法 | ||
| 137 | - var getXmlSection = function (xml) { | ||
| 138 | - // var xml = $("#xmlText").val(); | ||
| 139 | - var stationPointList = getXmlNode(xml); | ||
| 140 | - var sListSize = stationPointList.length; | ||
| 141 | - var sectionPointListStr = stationPointList[stationPointList.length - 1]; | ||
| 142 | - var sectionPointList = sectionPointListStr.split(" "); | ||
| 143 | - var index = 0; | ||
| 144 | - | ||
| 145 | - // var sectionStr = ""; | ||
| 146 | - var sections = []; | ||
| 147 | - for (var i = 0; i < sectionPointList.length; i++) { | ||
| 148 | - var pointStr = sectionPointList[i], | ||
| 149 | - point = pointStr.split(","); | ||
| 150 | - | ||
| 151 | - if (index < sListSize - 1 && point == stationPointList[index]) { | ||
| 152 | - sections.push(point[0] + " " + point[1] + " " + point[2] + " Stop"); | ||
| 153 | - index++; | ||
| 154 | - } else { | ||
| 155 | - sections.push(point[0] + " " + point[1] + " " + point[2]); | ||
| 156 | - } | ||
| 157 | - } | ||
| 158 | - return sections; | ||
| 159 | - }; | ||
| 160 | - | ||
| 161 | - | ||
| 162 | - // 表单验证 | ||
| 163 | - form.validate({ | ||
| 164 | - | ||
| 165 | - errorElement : 'span', | ||
| 166 | - | ||
| 167 | - errorClass : 'help-block help-block-error', | ||
| 168 | - | ||
| 169 | - focusInvalid : false, | ||
| 170 | - | ||
| 171 | - rules : { | ||
| 172 | - | ||
| 173 | - 'points' : { | ||
| 174 | - | ||
| 175 | - required : true, | ||
| 176 | - | ||
| 177 | - } | ||
| 178 | - | ||
| 179 | - }, | ||
| 180 | - | ||
| 181 | - invalidHandler : function(event, validator) { | ||
| 182 | - | ||
| 183 | - error.show(); | ||
| 184 | - | ||
| 185 | - App.scrollTo(error, -200); | ||
| 186 | - | ||
| 187 | - }, | ||
| 188 | - | ||
| 189 | - highlight : function(element) { | ||
| 190 | - | ||
| 191 | - $(element).closest('.form-group').addClass('has-error'); | ||
| 192 | - | ||
| 193 | - }, | ||
| 194 | - | ||
| 195 | - unhighlight : function(element) { | ||
| 196 | - | ||
| 197 | - $(element).closest('.form-group').removeClass('has-error'); | ||
| 198 | - | ||
| 199 | - }, | ||
| 200 | - | ||
| 201 | - success : function(label) { | ||
| 202 | - | ||
| 203 | - label.closest('.form-group').removeClass('has-error'); | ||
| 204 | - | ||
| 205 | - }, | ||
| 206 | - submitHandler : function(f) { | ||
| 207 | - // 隐藏弹出层 | ||
| 208 | - $('#edit_route_mobal').modal('hide'); | ||
| 209 | - // 获取线路对象 | ||
| 210 | - var line = editRoute.getLineObj(); | ||
| 211 | - // 原坐标类型 | ||
| 212 | - var baseRes = "WGS84"; | ||
| 213 | - // 定义线路名称 | ||
| 214 | - var lineNameV = $('.portlet-title .caption').text(); | ||
| 215 | - var dirStr = ''; | ||
| 216 | - // 路线方向 | ||
| 217 | - var directionData = $("input[name='dirCheck']:checked").val(); | ||
| 218 | - /** | ||
| 219 | - * 添加类型0(txt)/1(xml) | ||
| 220 | - * txt方式路段需要30个点取一个 | ||
| 221 | - * xml路段取所有点 | ||
| 222 | - */ | ||
| 223 | - var type = $("input[name='typeCheck']:checked").val(); | ||
| 224 | - editRoute.setLineDir(directionData); | ||
| 225 | - // 设置线路对象生成方式 | ||
| 226 | - editRoute.setLineGenerationType('uploadGPS'); | ||
| 227 | - // 弹出正在加载层 | ||
| 228 | - var i = layer.load(2); | ||
| 229 | - // 表单序列化 | ||
| 230 | - var paramsForm = form.serializeJSON(); | ||
| 231 | - var array = []; | ||
| 232 | - if(type == 1){ | ||
| 233 | - array = getXmlSection(paramsForm.points); | ||
| 234 | - } else { | ||
| 235 | - // 切割坐标点 | ||
| 236 | - array = paramsForm.points.split('\r\n'); | ||
| 237 | - } | ||
| 238 | - // 把坐标点转换为站点或路段 | ||
| 239 | - var arrayFormat = inputStationValueFormat(array); | ||
| 240 | - var stationList = arrayFormat.stationList; | ||
| 241 | - var sectionListTemp = arrayFormat.sectionList; | ||
| 242 | - var sectionList = []; | ||
| 243 | - // 隔30个取一个点(相当于30s) | ||
| 244 | - var typeNum = type == 0 ? 30:1; | ||
| 245 | - for(var i = 0; i*typeNum < sectionListTemp.length; i++) { | ||
| 246 | - sectionList[i] = sectionListTemp[i*typeNum]; | ||
| 247 | - } | ||
| 248 | - sectionList[sectionList.length] = sectionListTemp[sectionListTemp.length-1]; | ||
| 249 | - | ||
| 250 | - var sectionListFinal = []; | ||
| 251 | - sectionListFinal.push({sectionName : lineNameV, points : sectionList}); | ||
| 252 | - // 根据站点名称获取百度坐标 | ||
| 253 | - map.stationsPointsToLibraryPoint(stationList,function(resultJson) { | ||
| 254 | - // 根据坐标点获取两点之间的时间与距离 | ||
| 255 | - map.getDistanceAndDuration(resultJson,function(stationdataList) { | ||
| 256 | - // 设置第一个站的距离 | ||
| 257 | - stationdataList[0].distance = ''; | ||
| 258 | - // 设置第一个站的时间 | ||
| 259 | - stationdataList[0].duration = ''; | ||
| 260 | - // 定义站点信息JSON字符串 | ||
| 261 | - var stationJSON = JSON.stringify(stationdataList); | ||
| 262 | - // 参数集合 | ||
| 263 | - var params = {}; | ||
| 264 | - params.baseRes = baseRes; | ||
| 265 | - // 是否添加该站点 | ||
| 266 | - | ||
| 267 | - // 站点信息JSON字符串 | ||
| 268 | - params.stationJSON = stationJSON; | ||
| 269 | - // 线路ID | ||
| 270 | - params.lineId = line.id; | ||
| 271 | - // 方向 | ||
| 272 | - params.directions = directionData; | ||
| 273 | - // 原始坐标类型 | ||
| 274 | - params.dbType = 'b'; | ||
| 275 | - // 圆形半径 | ||
| 276 | - params.radius = '80'; | ||
| 277 | - // 限速 | ||
| 278 | - params.speedLimit = '60'; | ||
| 279 | - // 图形类型(r:圆形;p:多边形) | ||
| 280 | - params.shapesType = 'r'; | ||
| 281 | - // destroy:是否撤销 | ||
| 282 | - params.destroy = '0'; | ||
| 283 | - // versions:版本号 | ||
| 284 | - params.versions = '1'; | ||
| 285 | - // 定义路段信息字符串 | ||
| 286 | - var sectionJSON = JSON.stringify(sectionListFinal); | ||
| 287 | - // 路段信息JSON字符串 | ||
| 288 | - params.sectionJSON = sectionJSON; | ||
| 289 | - addSave(params,line.id,directionData); | ||
| 290 | - }); | ||
| 291 | - | ||
| 292 | - }); | ||
| 293 | - }, | ||
| 294 | - | ||
| 295 | - }); | ||
| 296 | - | ||
| 297 | - function inputStationValueFormat(paramsStationsArray) { | ||
| 298 | - var stationList = []; | ||
| 299 | - var sectionList = []; | ||
| 300 | - var routeList = {"stationList":stationList, "sectionList":sectionList}; | ||
| 301 | - var len = paramsStationsArray.length; | ||
| 302 | - // 处理相同站点判断值 | ||
| 303 | - var isPush = true; | ||
| 304 | - for(var k =0;k<len;k++) { | ||
| 305 | - if(paramsStationsArray[k]=="") | ||
| 306 | - continue; | ||
| 307 | - var tempStr = paramsStationsArray[k].split('\t'); | ||
| 308 | - var tempPoint = transGpsLoc(tempStr[0],tempStr[1]); | ||
| 309 | - var point = {lng:tempPoint.lng, lat:tempPoint.lat}; | ||
| 310 | - if(tempStr.length < 4){ | ||
| 311 | - sectionList[k] = point; | ||
| 312 | - isPush = true; | ||
| 313 | - }else { | ||
| 314 | - if(isPush) { | ||
| 315 | - sectionList[k] = point; | ||
| 316 | - stationList.push({name:tempStr[3], potion:{lng:tempPoint.lng, lat:tempPoint.lat} , wgs:{x:tempStr[0], y:tempStr[1]}}); | ||
| 317 | - } | ||
| 318 | - isPush = false; | ||
| 319 | - } | ||
| 320 | - } | ||
| 321 | - for(var i = 0 ;i<sectionList.length;i++) { | ||
| 322 | - if(sectionList[i] == "" || typeof(sectionList[i]) == "undefined" || sectionList[i] == null) { | ||
| 323 | - sectionList.splice(i,1);//删除数组中下表i-i+1之间的值 | ||
| 324 | - i= i-1; | ||
| 325 | - } | ||
| 326 | - | ||
| 327 | - } | ||
| 328 | - return routeList; | ||
| 329 | - } | ||
| 330 | - | ||
| 331 | - function transGpsLoc(lng,lat) { | ||
| 332 | - var bdLoc = transGPS.locationMake(lng, lat); | ||
| 333 | - var gcjLoc = transGPS.transformFromWGSToGCJ(bdLoc); | ||
| 334 | - var bdEn = transGPS.bd_encrypt(gcjLoc); | ||
| 335 | - return bdEn; | ||
| 336 | - } | ||
| 337 | - | ||
| 338 | - /** 引用当前版本站点和走向*/ | ||
| 339 | - /* $("#referenceCurrentVersion").on('click',function() { | ||
| 340 | - // 获取线路对象 | ||
| 341 | - var line = editRoute.getLineObj(); | ||
| 342 | - // 路线方向 | ||
| 343 | - var direction = $("input[name='dirCheck']:checked").val(); | ||
| 344 | - // 设置线路对象方向 | ||
| 345 | - editRoute.setLineDir(direction); | ||
| 346 | - // 设置线路对象生成方式 | ||
| 347 | - editRoute.setLineGenerationType('cite'); | ||
| 348 | - $.post("/station/referenceCurrentVersion",{'lineId' : line.id , 'directions' : direction},function(rd){ | ||
| 349 | - // 隐藏弹出层 | ||
| 350 | - $('#edit_route_mobal').modal('hide'); | ||
| 351 | - // 关闭弹出层 | ||
| 352 | - layer.closeAll(); | ||
| 353 | - if(rd.status='SUCCESS') { | ||
| 354 | - // 清除地图覆盖物 | ||
| 355 | - map.clearMarkAndOverlays(); | ||
| 356 | - // 查询路段信息 | ||
| 357 | - var params = {}; | ||
| 358 | - params.lineId=line.id; | ||
| 359 | - params.dir = direction; | ||
| 360 | - // 查询路段信息 | ||
| 361 | - $get('/sectionroute/findCacheSection',params,function(data) { | ||
| 362 | - // 在地图上画出线路走向 | ||
| 363 | - fun.linePanlThree(line.id,data,direction); | ||
| 364 | - }); | ||
| 365 | - $('#route_show').removeClass('hidden'); | ||
| 366 | - $('#generationRoute_div').addClass('hidden'); | ||
| 367 | - // 刷新路段列表 | ||
| 368 | - $('#section').click(); | ||
| 369 | - layer.msg('引用当前版本成功!'); | ||
| 370 | - }else { | ||
| 371 | - layer.msg('引用当前版本失败,请重新引用或选择其他方式!'); | ||
| 372 | - } | ||
| 373 | - }) | ||
| 374 | - }); */ | ||
| 375 | - | ||
| 376 | - function addSave(params,lineid,directionData) { | ||
| 377 | - // 保存 | ||
| 378 | - $post("/station/cacheSave",params,function(rd) { | ||
| 379 | - // 关闭弹出层 | ||
| 380 | - layer.closeAll(); | ||
| 381 | - if(rd.status='SUCCESS') { | ||
| 382 | - var stationD = rd.stationData,isNullStr = ''; | ||
| 383 | - for(var t = 0 ;t<stationD.length;t++) { | ||
| 384 | - if(stationD[t].potion.lat =='' || stationD[t].potion.lat ==null || | ||
| 385 | - stationD[t].potion.lng =='' || stationD[t].potion.lng ==null) | ||
| 386 | - isNullStr = isNullStr + stationD[t].name + ' , '; | ||
| 387 | - } | ||
| 388 | - if(isNullStr!='') { | ||
| 389 | - layer.open({ | ||
| 390 | - title: '提示', | ||
| 391 | - content:'【' + isNullStr + '】' + '地址系统无法解析!,请手动调整位置!' | ||
| 392 | - }); | ||
| 393 | - } | ||
| 394 | - // 清除地图覆盖物 | ||
| 395 | - map.clearMarkAndOverlays(); | ||
| 396 | - var params = {}; | ||
| 397 | - params.lineId = lineid; | ||
| 398 | - params.dir = directionData; | ||
| 399 | - // 查询路段信息 | ||
| 400 | - $get('/sectionroute/findCacheSection',params,function(data) { | ||
| 401 | - // 在地图上画出线路走向 | ||
| 402 | - fun.linePanlThree(lineid,data,directionData); | ||
| 403 | - }); | ||
| 404 | - $('#route_show').removeClass('hidden'); | ||
| 405 | - $('#generationRoute_div').addClass('hidden'); | ||
| 406 | - // 刷新路段列表 | ||
| 407 | - $('#section').click(); | ||
| 408 | - layer.open({title: '友情提示' | ||
| 409 | - ,content: '生成路线成功,生成的线路可能会有误差。请先单击路段,拖动编辑、然后双击保存!'}); | ||
| 410 | - }else { | ||
| 411 | - layer.msg('生成路线失败!'); | ||
| 412 | - } | ||
| 413 | - }); | ||
| 414 | - } | ||
| 415 | -}); | 1 | +<!-- 手动添加站点 --> |
| 2 | +<div class="modal fade" id="edit_route_mobal" tabindex="-1" role="basic" | ||
| 3 | + aria-hidden="true"> | ||
| 4 | + | ||
| 5 | + <div class="modal-dialog"> | ||
| 6 | + | ||
| 7 | + <div class="modal-content" > | ||
| 8 | + | ||
| 9 | + <div class="modal-header"> | ||
| 10 | + <button type="button" class="close" data-dismiss="modal" | ||
| 11 | + aria-hidden="true"></button> | ||
| 12 | + <h4 class="modal-title">生成路线(站点和路段)</h4> | ||
| 13 | + </div> | ||
| 14 | + | ||
| 15 | + <div class="modal-body"> | ||
| 16 | + | ||
| 17 | + <form class="form-horizontal" role="form" | ||
| 18 | + id="save_route_template_form" action="" method=""> | ||
| 19 | + | ||
| 20 | + <div class="alert alert-danger display-hide"> | ||
| 21 | + <button class="close" data-close="alert"></button> | ||
| 22 | + 您的输入有误,请检查下面的输入项 | ||
| 23 | + </div> | ||
| 24 | + | ||
| 25 | + <!-- 站点名称 --> | ||
| 26 | + <div class="form-body"> | ||
| 27 | + | ||
| 28 | + <div class="form-group"> | ||
| 29 | + <label class="control-label col-md-2"> <span | ||
| 30 | + class="required"> * </span> 坐标: | ||
| 31 | + </label> | ||
| 32 | + <div class="col-md-10"> | ||
| 33 | + <textarea class="form-control" rows="12" name="points" | ||
| 34 | + id="pointInput" placeholder="坐标点"></textarea> | ||
| 35 | + </div> | ||
| 36 | + </div> | ||
| 37 | + </div> | ||
| 38 | + <div class="form-group"> | ||
| 39 | + <label class="col-md-3 control-label">选择文本类型:</label> | ||
| 40 | + <div class="col-md-3"> | ||
| 41 | + <div class="icheck-list"> | ||
| 42 | + <label> <input type="radio" class="icheck" | ||
| 43 | + name="typeCheck" value='0' checked> txt | ||
| 44 | + </label> <label> <input type="radio" class="icheck" | ||
| 45 | + name="typeCheck" value='1'> xml | ||
| 46 | + </label> | ||
| 47 | + </div> | ||
| 48 | + </div> | ||
| 49 | + <label class="col-md-3 control-label">选择方向:</label> | ||
| 50 | + <div class="col-md-3"> | ||
| 51 | + <div class="icheck-list"> | ||
| 52 | + <label> <input type="radio" class="icheck" | ||
| 53 | + name="dirCheck" value='0' checked> 上行 | ||
| 54 | + </label> <label> <input type="radio" class="icheck" | ||
| 55 | + name="dirCheck" value='1'> 下行 | ||
| 56 | + </label> | ||
| 57 | + </div> | ||
| 58 | + </div> | ||
| 59 | + </div> | ||
| 60 | + <div class="form-group"> | ||
| 61 | + <div class="alert alert-info font-blue-chambray" | ||
| 62 | + style="background-color: #2C3E50"> | ||
| 63 | + <h5 class="block"> | ||
| 64 | + <span class="help-block" style="color: #1bbc9b;"> * | ||
| 65 | + 坐标生成路线规划说明: </span> | ||
| 66 | + </h5> | ||
| 67 | + <p> | ||
| 68 | + | ||
| 69 | + <span class="help-block" style="color: #1bbc9b;"> | ||
| 70 | + 1.txt格式 | ||
| 71 | + <br> 请在文本域中按顺序依次输坐标点,每行中的数据之间用【Tab】键隔开(如果是站点,请将在坐标后面加 stop;没有 | ||
| 72 | + stop默认是路段点,连续带stop的坐标认为是同一个站点),每输入完一个坐标时请按回车键【Enter】换行. 例如: | ||
| 73 | + <br>121.511870 31.180638 043703.000 | ||
| 74 | + <br>121.511870 31.180643 043705.000 | ||
| 75 | + <br>121.511870 31.180648 043706.000 Stop | ||
| 76 | + <br>121.511872 31.180653 043707.000 | ||
| 77 | + </span> | ||
| 78 | + </p> | ||
| 79 | + <p> | ||
| 80 | + | ||
| 81 | + <span class="help-block" style="color: #1bbc9b;"> | ||
| 82 | + 2.xml格式 | ||
| 83 | + <br>用gps生成工具,生成的kml文件里的数据 | ||
| 84 | + </span> | ||
| 85 | + </p> | ||
| 86 | + </div> | ||
| 87 | + </div> | ||
| 88 | + </form> | ||
| 89 | + </div> | ||
| 90 | + <div class="modal-footer"> | ||
| 91 | + <button type="button" class="btn default" data-dismiss="modal" | ||
| 92 | + id="addMobalHiden">取消</button> | ||
| 93 | +<!-- <button type="button" class="btn btn-primary hidden" id="referenceCurrentVersion">引用当前版本</button> --> | ||
| 94 | + <button type="button" class="btn btn-primary" id="templateSaveData">提交数据</button> | ||
| 95 | + </div> | ||
| 96 | + </div> | ||
| 97 | + </div> | ||
| 98 | +</div> | ||
| 99 | +<script type="text/javascript"> | ||
| 100 | + | ||
| 101 | +$('#edit_route_mobal').on('editRouteMobal.show', function(e,transGPS,editRoute,map,dra,ajaxd,fun){ | ||
| 102 | + // 延迟加载显示mobal | ||
| 103 | + setTimeout(function(){$('#edit_route_mobal').modal({show : true,backdrop: 'static', keyboard: false});},200); | ||
| 104 | + // 获取表单元素 | ||
| 105 | + var form = $('#save_route_template_form'); | ||
| 106 | + | ||
| 107 | + // 获取错误提示信息元素 | ||
| 108 | + var error = $('.alert-danger', form); | ||
| 109 | + | ||
| 110 | + // 提交数据点击事件 | ||
| 111 | + $('.modal-footer #templateSaveData').on('click',function() { | ||
| 112 | + form.submit(); | ||
| 113 | + }); | ||
| 114 | + | ||
| 115 | + | ||
| 116 | + //从xml中获取节点内容 | ||
| 117 | + function getXmlNode(str){ | ||
| 118 | + //创建文档对象 | ||
| 119 | + var parser=new DOMParser(); | ||
| 120 | + var xmlDoc=parser.parseFromString(str,"text/xml"); | ||
| 121 | + | ||
| 122 | + //提取数据 | ||
| 123 | + var countrys = xmlDoc.getElementsByTagName('coordinates'); | ||
| 124 | + //var countrys = xmlDoc.getElementsByTagName('DataSource'); | ||
| 125 | + | ||
| 126 | + var arr = []; | ||
| 127 | + | ||
| 128 | + for (var i = 0; i < countrys.length; i++) { | ||
| 129 | + arr.push(countrys[i].textContent); | ||
| 130 | + }; | ||
| 131 | + // console.log(arr); | ||
| 132 | + return arr; | ||
| 133 | + | ||
| 134 | + } | ||
| 135 | + | ||
| 136 | + // xml方式上传是,处理转成txt格式的方法 | ||
| 137 | + var getXmlSection = function (xml) { | ||
| 138 | + // var xml = $("#xmlText").val(); | ||
| 139 | + var stationPointList = getXmlNode(xml); | ||
| 140 | + var sListSize = stationPointList.length; | ||
| 141 | + var sectionPointListStr = stationPointList[stationPointList.length - 1]; | ||
| 142 | + var sectionPointList = sectionPointListStr.split(" "); | ||
| 143 | + | ||
| 144 | + // var sectionStr = ""; | ||
| 145 | + var sections = []; | ||
| 146 | + var mapping = nearestSectionPoint(stationPointList, sectionPointList); | ||
| 147 | + for (var i = 0; i < sectionPointList.length; i++) { | ||
| 148 | + var pointStr = sectionPointList[i], | ||
| 149 | + point = pointStr.split(","); | ||
| 150 | + | ||
| 151 | + if (mapping[pointStr]) { | ||
| 152 | + sections.push(point[0] + " " + point[1] + " " + point[2] + " Stop"); | ||
| 153 | + } else { | ||
| 154 | + sections.push(point[0] + " " + point[1] + " " + point[2]); | ||
| 155 | + } | ||
| 156 | + } | ||
| 157 | + return sections; | ||
| 158 | + }; | ||
| 159 | + | ||
| 160 | + var nearestSectionPoint = function (stationPointList, sectionPointList) { | ||
| 161 | + var mapping = {}; | ||
| 162 | + for (var i = 0;i < stationPointList.length - 1;i++) { | ||
| 163 | + var minDistance = 999999999, stationPoint = stationPointList[i].split(","), pointStr; | ||
| 164 | + for (var j = 0;j < sectionPointList.length;j++) { | ||
| 165 | + var sectionPointStr = sectionPointList[j], sectionPoint = sectionPointStr.split(","); | ||
| 166 | + var distance = Math.sqrt(Math.pow(parseFloat(stationPoint[0]) - parseFloat(sectionPoint[0]), 2) + Math.pow(parseFloat(stationPoint[1]) - parseFloat(sectionPoint[1]), 2)); | ||
| 167 | + if (distance < minDistance) { | ||
| 168 | + minDistance = distance; | ||
| 169 | + pointStr = sectionPointStr; | ||
| 170 | + } | ||
| 171 | + } | ||
| 172 | + mapping[pointStr] = stationPointList[i]; | ||
| 173 | + } | ||
| 174 | + | ||
| 175 | + return mapping; | ||
| 176 | + } | ||
| 177 | + | ||
| 178 | + | ||
| 179 | + // 表单验证 | ||
| 180 | + form.validate({ | ||
| 181 | + | ||
| 182 | + errorElement : 'span', | ||
| 183 | + | ||
| 184 | + errorClass : 'help-block help-block-error', | ||
| 185 | + | ||
| 186 | + focusInvalid : false, | ||
| 187 | + | ||
| 188 | + rules : { | ||
| 189 | + | ||
| 190 | + 'points' : { | ||
| 191 | + | ||
| 192 | + required : true, | ||
| 193 | + | ||
| 194 | + } | ||
| 195 | + | ||
| 196 | + }, | ||
| 197 | + | ||
| 198 | + invalidHandler : function(event, validator) { | ||
| 199 | + | ||
| 200 | + error.show(); | ||
| 201 | + | ||
| 202 | + App.scrollTo(error, -200); | ||
| 203 | + | ||
| 204 | + }, | ||
| 205 | + | ||
| 206 | + highlight : function(element) { | ||
| 207 | + | ||
| 208 | + $(element).closest('.form-group').addClass('has-error'); | ||
| 209 | + | ||
| 210 | + }, | ||
| 211 | + | ||
| 212 | + unhighlight : function(element) { | ||
| 213 | + | ||
| 214 | + $(element).closest('.form-group').removeClass('has-error'); | ||
| 215 | + | ||
| 216 | + }, | ||
| 217 | + | ||
| 218 | + success : function(label) { | ||
| 219 | + | ||
| 220 | + label.closest('.form-group').removeClass('has-error'); | ||
| 221 | + | ||
| 222 | + }, | ||
| 223 | + submitHandler : function(f) { | ||
| 224 | + // 隐藏弹出层 | ||
| 225 | + $('#edit_route_mobal').modal('hide'); | ||
| 226 | + // 获取线路对象 | ||
| 227 | + var line = editRoute.getLineObj(); | ||
| 228 | + // 原坐标类型 | ||
| 229 | + var baseRes = "WGS84"; | ||
| 230 | + // 定义线路名称 | ||
| 231 | + var lineNameV = $('.portlet-title .caption').text(); | ||
| 232 | + var dirStr = ''; | ||
| 233 | + // 路线方向 | ||
| 234 | + var directionData = $("input[name='dirCheck']:checked").val(); | ||
| 235 | + /** | ||
| 236 | + * 添加类型0(txt)/1(xml) | ||
| 237 | + * txt方式路段需要30个点取一个 | ||
| 238 | + * xml路段取所有点 | ||
| 239 | + */ | ||
| 240 | + var type = $("input[name='typeCheck']:checked").val(); | ||
| 241 | + editRoute.setLineDir(directionData); | ||
| 242 | + // 设置线路对象生成方式 | ||
| 243 | + editRoute.setLineGenerationType('uploadGPS'); | ||
| 244 | + // 弹出正在加载层 | ||
| 245 | + var i = layer.load(2); | ||
| 246 | + // 表单序列化 | ||
| 247 | + var paramsForm = form.serializeJSON(); | ||
| 248 | + var array = []; | ||
| 249 | + if(type == 1){ | ||
| 250 | + array = getXmlSection(paramsForm.points); | ||
| 251 | + } else { | ||
| 252 | + // 切割坐标点 | ||
| 253 | + array = paramsForm.points.split('\r\n'); | ||
| 254 | + } | ||
| 255 | + // 把坐标点转换为站点或路段 | ||
| 256 | + var arrayFormat = inputStationValueFormat(array); | ||
| 257 | + var stationList = arrayFormat.stationList; | ||
| 258 | + var sectionListTemp = arrayFormat.sectionList; | ||
| 259 | + var sectionList = []; | ||
| 260 | + // 隔30个取一个点(相当于30s) | ||
| 261 | + var typeNum = type == 0 ? 30:1; | ||
| 262 | + for(var i = 0; i*typeNum < sectionListTemp.length; i++) { | ||
| 263 | + sectionList[i] = sectionListTemp[i*typeNum]; | ||
| 264 | + } | ||
| 265 | + sectionList[sectionList.length] = sectionListTemp[sectionListTemp.length-1]; | ||
| 266 | + | ||
| 267 | + var sectionListFinal = []; | ||
| 268 | + sectionListFinal.push({sectionName : lineNameV, points : sectionList}); | ||
| 269 | + // 根据站点名称获取百度坐标 | ||
| 270 | + map.stationsPointsToLibraryPoint(stationList,function(resultJson) { | ||
| 271 | + // 根据坐标点获取两点之间的时间与距离 | ||
| 272 | + map.getDistanceAndDuration(resultJson,function(stationdataList) { | ||
| 273 | + // 设置第一个站的距离 | ||
| 274 | + stationdataList[0].distance = ''; | ||
| 275 | + // 设置第一个站的时间 | ||
| 276 | + stationdataList[0].duration = ''; | ||
| 277 | + // 定义站点信息JSON字符串 | ||
| 278 | + var stationJSON = JSON.stringify(stationdataList); | ||
| 279 | + // 参数集合 | ||
| 280 | + var params = {}; | ||
| 281 | + params.baseRes = baseRes; | ||
| 282 | + // 是否添加该站点 | ||
| 283 | + | ||
| 284 | + // 站点信息JSON字符串 | ||
| 285 | + params.stationJSON = stationJSON; | ||
| 286 | + // 线路ID | ||
| 287 | + params.lineId = line.id; | ||
| 288 | + // 方向 | ||
| 289 | + params.directions = directionData; | ||
| 290 | + // 原始坐标类型 | ||
| 291 | + params.dbType = 'b'; | ||
| 292 | + // 圆形半径 | ||
| 293 | + params.radius = '80'; | ||
| 294 | + // 限速 | ||
| 295 | + params.speedLimit = '60'; | ||
| 296 | + // 图形类型(r:圆形;p:多边形) | ||
| 297 | + params.shapesType = 'r'; | ||
| 298 | + // destroy:是否撤销 | ||
| 299 | + params.destroy = '0'; | ||
| 300 | + // versions:版本号 | ||
| 301 | + params.versions = '1'; | ||
| 302 | + // 定义路段信息字符串 | ||
| 303 | + var sectionJSON = JSON.stringify(sectionListFinal); | ||
| 304 | + // 路段信息JSON字符串 | ||
| 305 | + params.sectionJSON = sectionJSON; | ||
| 306 | + addSave(params,line.id,directionData); | ||
| 307 | + }); | ||
| 308 | + | ||
| 309 | + }); | ||
| 310 | + }, | ||
| 311 | + | ||
| 312 | + }); | ||
| 313 | + | ||
| 314 | + function inputStationValueFormat(paramsStationsArray) { | ||
| 315 | + var stationList = []; | ||
| 316 | + var sectionList = []; | ||
| 317 | + var routeList = {"stationList":stationList, "sectionList":sectionList}; | ||
| 318 | + var len = paramsStationsArray.length; | ||
| 319 | + // 处理相同站点判断值 | ||
| 320 | + var isPush = true; | ||
| 321 | + for(var k =0;k<len;k++) { | ||
| 322 | + if(paramsStationsArray[k]=="") | ||
| 323 | + continue; | ||
| 324 | + var tempStr = paramsStationsArray[k].split('\t'); | ||
| 325 | + var tempPoint = transGpsLoc(tempStr[0],tempStr[1]); | ||
| 326 | + var point = {lng:tempPoint.lng, lat:tempPoint.lat}; | ||
| 327 | + if(tempStr.length < 4){ | ||
| 328 | + sectionList[k] = point; | ||
| 329 | + isPush = true; | ||
| 330 | + }else { | ||
| 331 | + if(isPush) { | ||
| 332 | + sectionList[k] = point; | ||
| 333 | + stationList.push({name:tempStr[3], potion:{lng:tempPoint.lng, lat:tempPoint.lat} , wgs:{x:tempStr[0], y:tempStr[1]}}); | ||
| 334 | + } | ||
| 335 | + isPush = false; | ||
| 336 | + } | ||
| 337 | + } | ||
| 338 | + for(var i = 0 ;i<sectionList.length;i++) { | ||
| 339 | + if(sectionList[i] == "" || isNaN(sectionList[i].lng) || typeof(sectionList[i]) == "undefined" || sectionList[i] == null) { | ||
| 340 | + sectionList.splice(i,1);//删除数组中下表i-i+1之间的值 | ||
| 341 | + i= i-1; | ||
| 342 | + } | ||
| 343 | + | ||
| 344 | + } | ||
| 345 | + return routeList; | ||
| 346 | + } | ||
| 347 | + | ||
| 348 | + function transGpsLoc(lng,lat) { | ||
| 349 | + var bdLoc = transGPS.locationMake(lng, lat); | ||
| 350 | + var gcjLoc = transGPS.transformFromWGSToGCJ(bdLoc); | ||
| 351 | + var bdEn = transGPS.bd_encrypt(gcjLoc); | ||
| 352 | + return bdEn; | ||
| 353 | + } | ||
| 354 | + | ||
| 355 | + /** 引用当前版本站点和走向*/ | ||
| 356 | + /* $("#referenceCurrentVersion").on('click',function() { | ||
| 357 | + // 获取线路对象 | ||
| 358 | + var line = editRoute.getLineObj(); | ||
| 359 | + // 路线方向 | ||
| 360 | + var direction = $("input[name='dirCheck']:checked").val(); | ||
| 361 | + // 设置线路对象方向 | ||
| 362 | + editRoute.setLineDir(direction); | ||
| 363 | + // 设置线路对象生成方式 | ||
| 364 | + editRoute.setLineGenerationType('cite'); | ||
| 365 | + $.post("/station/referenceCurrentVersion",{'lineId' : line.id , 'directions' : direction},function(rd){ | ||
| 366 | + // 隐藏弹出层 | ||
| 367 | + $('#edit_route_mobal').modal('hide'); | ||
| 368 | + // 关闭弹出层 | ||
| 369 | + layer.closeAll(); | ||
| 370 | + if(rd.status='SUCCESS') { | ||
| 371 | + // 清除地图覆盖物 | ||
| 372 | + map.clearMarkAndOverlays(); | ||
| 373 | + // 查询路段信息 | ||
| 374 | + var params = {}; | ||
| 375 | + params.lineId=line.id; | ||
| 376 | + params.dir = direction; | ||
| 377 | + // 查询路段信息 | ||
| 378 | + $get('/sectionroute/findCacheSection',params,function(data) { | ||
| 379 | + // 在地图上画出线路走向 | ||
| 380 | + fun.linePanlThree(line.id,data,direction); | ||
| 381 | + }); | ||
| 382 | + $('#route_show').removeClass('hidden'); | ||
| 383 | + $('#generationRoute_div').addClass('hidden'); | ||
| 384 | + // 刷新路段列表 | ||
| 385 | + $('#section').click(); | ||
| 386 | + layer.msg('引用当前版本成功!'); | ||
| 387 | + }else { | ||
| 388 | + layer.msg('引用当前版本失败,请重新引用或选择其他方式!'); | ||
| 389 | + } | ||
| 390 | + }) | ||
| 391 | + }); */ | ||
| 392 | + | ||
| 393 | + function addSave(params,lineid,directionData) { | ||
| 394 | + // 保存 | ||
| 395 | + $post("/station/cacheSave",params,function(rd) { | ||
| 396 | + // 关闭弹出层 | ||
| 397 | + layer.closeAll(); | ||
| 398 | + if(rd.status='SUCCESS') { | ||
| 399 | + var stationD = rd.stationData,isNullStr = ''; | ||
| 400 | + for(var t = 0 ;t<stationD.length;t++) { | ||
| 401 | + if(stationD[t].potion.lat =='' || stationD[t].potion.lat ==null || | ||
| 402 | + stationD[t].potion.lng =='' || stationD[t].potion.lng ==null) | ||
| 403 | + isNullStr = isNullStr + stationD[t].name + ' , '; | ||
| 404 | + } | ||
| 405 | + if(isNullStr!='') { | ||
| 406 | + layer.open({ | ||
| 407 | + title: '提示', | ||
| 408 | + content:'【' + isNullStr + '】' + '地址系统无法解析!,请手动调整位置!' | ||
| 409 | + }); | ||
| 410 | + } | ||
| 411 | + // 清除地图覆盖物 | ||
| 412 | + map.clearMarkAndOverlays(); | ||
| 413 | + var params = {}; | ||
| 414 | + params.lineId = lineid; | ||
| 415 | + params.dir = directionData; | ||
| 416 | + // 查询路段信息 | ||
| 417 | + $get('/sectionroute/findCacheSection',params,function(data) { | ||
| 418 | + // 在地图上画出线路走向 | ||
| 419 | + fun.linePanlThree(lineid,data,directionData); | ||
| 420 | + }); | ||
| 421 | + $('#route_show').removeClass('hidden'); | ||
| 422 | + $('#generationRoute_div').addClass('hidden'); | ||
| 423 | + // 刷新路段列表 | ||
| 424 | + $('#section').click(); | ||
| 425 | + layer.open({title: '友情提示' | ||
| 426 | + ,content: '生成路线成功,生成的线路可能会有误差。请先单击路段,拖动编辑、然后双击保存!'}); | ||
| 427 | + }else { | ||
| 428 | + layer.msg('生成路线失败!'); | ||
| 429 | + } | ||
| 430 | + }); | ||
| 431 | + } | ||
| 432 | +}); | ||
| 416 | </script> | 433 | </script> |
| 417 | \ No newline at end of file | 434 | \ No newline at end of file |
src/main/resources/static/pages/base/stationroute/editsection_inout.html
0 → 100644
| 1 | +<!-- 编辑路段 --> | ||
| 2 | +<div class="modal fade" id="edit_section_mobal" role="basic" aria-hidden="true"> | ||
| 3 | + <div class="modal-dialog"> | ||
| 4 | + <div class="modal-content"> | ||
| 5 | + <div class="modal-header"> | ||
| 6 | + <button type="button" class="close" data-dismiss="modal" aria-hidden="true"></button> | ||
| 7 | + <h4 class="modal-title">路段修改</h4> | ||
| 8 | + </div> | ||
| 9 | + <div class="modal-body"> | ||
| 10 | + <form class="form-horizontal" role="form" id="edit_section_form" action="/module" method="post"> | ||
| 11 | + <div class="alert alert-danger display-hide"> <button class="close" data-close="alert"></button> | ||
| 12 | + 您的输入有误,请检查下面的输入项 | ||
| 13 | + </div> | ||
| 14 | + <!-- 线路ID --> | ||
| 15 | + <input type="hidden" name="sectionId" id="section.id"> | ||
| 16 | + <input type="hidden" name="sectionRouteId" id="id"> | ||
| 17 | + <input type="hidden" name="sectionCode" id="section.sectionCode"> | ||
| 18 | + <input type="hidden" name="sectionRouteLine" id="lineId"> | ||
| 19 | + <input type="hidden" name="lineCode" id="lineCode"> | ||
| 20 | + <input type="hidden" name="bsectionVector" id="bsectionVector" /> | ||
| 21 | + <input type="hidden" name="csectionVector" id="csectionVector" value=""/> | ||
| 22 | + <input type="hidden" name="dbType" id="dbType" value="b"/> | ||
| 23 | + <input type="hidden" name="directions" id="dir"> | ||
| 24 | + <input type="hidden" name="speedLimit" id="speedLimit" > | ||
| 25 | + <input type="hidden" name="roadCoding" id="roadCoding"/> | ||
| 26 | + <input type="hidden" name="versions" id="versions"/> | ||
| 27 | + <input type="hidden" name="start" id="start"/> | ||
| 28 | + <input type="hidden" name="end" id="end"/> | ||
| 29 | + <!-- 路段名称 --> | ||
| 30 | + <div class="form-body"> | ||
| 31 | + <div class="form-group"> | ||
| 32 | + <label class="control-label col-md-3"> | ||
| 33 | + <span class="required"> * </span> 路段名称: | ||
| 34 | + </label> | ||
| 35 | + <div class="col-md-6"> | ||
| 36 | + <input type="text" class="form-control" name="sectionName" id="sectionName" placeholder="路段名称"> | ||
| 37 | + </div> | ||
| 38 | + </div> | ||
| 39 | + </div> | ||
| 40 | + <!-- 路段序号 --> | ||
| 41 | + <div class="form-body"> | ||
| 42 | + <div class="form-group"> | ||
| 43 | + <label class="control-label col-md-3"> | ||
| 44 | + 上一路段: | ||
| 45 | + </label> | ||
| 46 | + <div class="col-md-6"> | ||
| 47 | + <select name="sectionrouteCode" class="form-control" id="sectionrouteCode" style="width:100%"></select> | ||
| 48 | + <span class="help-block">说明:选择的路段将作为本站序号的参考,成为选择路段的下一个路段。 </span> | ||
| 49 | + </div> | ||
| 50 | + </div> | ||
| 51 | + </div> | ||
| 52 | + </form> | ||
| 53 | + </div> | ||
| 54 | + <div class="modal-footer"> | ||
| 55 | + <button type="button" class="btn btn-primary" id="editSectionButton">提交数据</button> | ||
| 56 | + <button type="button" class="btn default" data-dismiss="modal">取消</button> | ||
| 57 | + </div> | ||
| 58 | + </div> | ||
| 59 | + </div> | ||
| 60 | +</div> | ||
| 61 | +<script type="text/javascript"> | ||
| 62 | +debugger; | ||
| 63 | +$('#edit_section_mobal').on('editSectionMobal_show', function(e, map_,ajaxd,p,fun){ | ||
| 64 | + function setSectionFormValue(section) { | ||
| 65 | + $('#edit_section_form input').each(function() { | ||
| 66 | + $(this).val(eval('section.' + this.id)); | ||
| 67 | + }); | ||
| 68 | + } | ||
| 69 | + let section = p.data; | ||
| 70 | + let lineId = section.lineCode, version = section.versions, start = section.start, end = section.end; | ||
| 71 | + setSectionFormValue(section); | ||
| 72 | + // 获取路段号元素,并添加下拉属性值 | ||
| 73 | + ajaxd.getRouteByStartEnd(lineId,version,start, end,function(result) { | ||
| 74 | + let routes = result.data.routes,paramsD =new Array(); | ||
| 75 | + var eq_scetionRouteCode = section.sectionrouteCode; | ||
| 76 | + paramsD.push({'id':'请选择...','text':'将此路段设置位第一个路段'}); | ||
| 77 | + // 遍历 | ||
| 78 | + $.each(routes, function(i, g){ | ||
| 79 | + // 判断. | ||
| 80 | + if(g.section.sectionName) { | ||
| 81 | + let ptions_v = g.sectionrouteCode; | ||
| 82 | + if(eq_scetionRouteCode != ptions_v) { | ||
| 83 | + // 添加拼音检索下拉框格式数据数组. | ||
| 84 | + paramsD.push({'id':ptions_v, | ||
| 85 | + 'text':g.section.sectionName + '(' + ptions_v + ')'}); | ||
| 86 | + } | ||
| 87 | + } | ||
| 88 | + }); | ||
| 89 | + // 初始化上一个路段拼音检索下拉框. | ||
| 90 | + initPinYinSelect2($('#sectionrouteCode'),paramsD,function(selector) { | ||
| 91 | + if(paramsD.length > 0) { | ||
| 92 | + var upStationRouteCode = paramsD[paramsD.length - 1].sectionrouteCode; | ||
| 93 | + $('#sectionrouteCode').select2('val',upStationRouteCode); | ||
| 94 | + }else { | ||
| 95 | + $('#sectionrouteCode').select2('val','请选择...'); | ||
| 96 | + } | ||
| 97 | + }); | ||
| 98 | + }); | ||
| 99 | + // 显示mobal | ||
| 100 | + $('#edit_section_mobal').modal({show : true,backdrop: 'static',keyboard: false});// | ||
| 101 | + // 当调用 hide 实例方法时触发 | ||
| 102 | + $('#edit_section_mobal').on('hide.bs.modal', function () { | ||
| 103 | + closeMobleSetClean(); | ||
| 104 | + }); | ||
| 105 | + function closeMobleSetClean() { | ||
| 106 | + // 清除地图覆盖物 | ||
| 107 | + map_.clearMarkAndOverlays(); | ||
| 108 | + $('#inoutSearch').click(); | ||
| 109 | + fun.editAChangeCssRemoveDisabled(); | ||
| 110 | + //ajaxd.getSectionRouteInfo(lineId,dir,$("#versions").val(),function(data) { | ||
| 111 | + // fun.linePanlThree(lineId,data,dir); | ||
| 112 | + //}); | ||
| 113 | + setTimeout(function () { | ||
| 114 | + map_.openSectionInfoWin_inout(p); | ||
| 115 | + },1000); | ||
| 116 | + } | ||
| 117 | + // 编辑表单元素 | ||
| 118 | + var form = $('#edit_section_form'); | ||
| 119 | + // 获取错误提示元素 | ||
| 120 | + var error = $('.alert-danger', form); | ||
| 121 | + // 提交数据按钮事件 | ||
| 122 | + $('#editSectionButton').on('click', function() { | ||
| 123 | + // 表单提交 | ||
| 124 | + form.submit(); | ||
| 125 | + }); | ||
| 126 | + // 表单验证 | ||
| 127 | + form.validate({ | ||
| 128 | + errorElement : 'span', | ||
| 129 | + errorClass : 'help-block help-block-error', | ||
| 130 | + focusInvalid : false, | ||
| 131 | + rules : { | ||
| 132 | + 'sectionName' : {required : true,maxlength:50} | ||
| 133 | + }, | ||
| 134 | + invalidHandler : function(event, validator) { | ||
| 135 | + error.show(); | ||
| 136 | + App.scrollTo(error, -200); | ||
| 137 | + }, | ||
| 138 | + highlight : function(element) { | ||
| 139 | + $(element).closest('.form-group').addClass('has-error'); | ||
| 140 | + }, | ||
| 141 | + unhighlight : function(element) { | ||
| 142 | + $(element).closest('.form-group').removeClass('has-error'); | ||
| 143 | + }, | ||
| 144 | + success : function(label) { | ||
| 145 | + label.closest('.form-group').removeClass('has-error'); | ||
| 146 | + }, | ||
| 147 | + submitHandler : function(f) { | ||
| 148 | + // 获取折线坐标集合 | ||
| 149 | + var editPloyLineArray = p.getPath(); | ||
| 150 | + // 折线坐标集合 | ||
| 151 | + $('#bsectionVector').val(JSON.stringify(editPloyLineArray)); | ||
| 152 | + var params = form.serializeJSON(); | ||
| 153 | + params.destroy=0; | ||
| 154 | + params.sectionDistance=0; | ||
| 155 | + params.sectionTime=0; | ||
| 156 | + params.status=$($("#versions").find("option:selected")[0]).attr("status"); | ||
| 157 | + error.hide(); | ||
| 158 | + debugger | ||
| 159 | + if(params.sectionrouteCode=='请选择...') | ||
| 160 | + params.sectionrouteCode=''; | ||
| 161 | + ajaxd.inoutSectionUpdate(params,function(resuntDate) { | ||
| 162 | + if(resuntDate.status=='SUCCESS') { | ||
| 163 | + // 弹出添加成功提示消息 | ||
| 164 | + layer.msg('修改成功...'); | ||
| 165 | + }else { | ||
| 166 | + // 弹出添加失败提示消息 | ||
| 167 | + layer.msg('修改失败...'); | ||
| 168 | + } | ||
| 169 | + $('#edit_section_mobal').modal('hide'); | ||
| 170 | + var dir = params.directions | ||
| 171 | + closeMobleSetClean(); | ||
| 172 | + }); | ||
| 173 | + } | ||
| 174 | + }); | ||
| 175 | +}); | ||
| 176 | +</script> | ||
| 0 | \ No newline at end of file | 177 | \ No newline at end of file |
src/main/resources/static/pages/base/stationroute/js/stationroute-ajax-getdata.js
| @@ -196,6 +196,41 @@ var GetAjaxData = function(){ | @@ -196,6 +196,41 @@ var GetAjaxData = function(){ | ||
| 196 | 196 | ||
| 197 | }); | 197 | }); |
| 198 | 198 | ||
| 199 | + }, | ||
| 200 | + | ||
| 201 | + // 编辑线路走向保存 | ||
| 202 | + inoutSectionUpdate:function(section,callback) { | ||
| 203 | + $post('/inout/sectionUpdate',section,function(data) { | ||
| 204 | + callback && callback(data); | ||
| 205 | + }) | ||
| 206 | + }, | ||
| 207 | + | ||
| 208 | + // 生成线路走向 | ||
| 209 | + inoutSectionSave:function(section,callback){ | ||
| 210 | + $post('/inout/sectionSave',section,function(data) { | ||
| 211 | + callback && callback(data); | ||
| 212 | + }) | ||
| 213 | + }, | ||
| 214 | + | ||
| 215 | + // 根据线路查找进出场的起终点信息 | ||
| 216 | + getStartEndByLine: function (lineId, version, cb) { | ||
| 217 | + $get('/inout/getStartEndByLine', {lineId : lineId, version : version}, function (r) { | ||
| 218 | + return cb && cb(r); | ||
| 219 | + }); | ||
| 220 | + }, | ||
| 221 | + | ||
| 222 | + // 根据起终点查找对应的路段信息 | ||
| 223 | + getRouteByStartEnd: function (lineId, version, start, end, cb) { | ||
| 224 | + $get('/inout/getRouteByStartEnd', {lineId : lineId, version : version, start : start, end : end}, function (r) { | ||
| 225 | + return cb && cb(r); | ||
| 226 | + }); | ||
| 227 | + }, | ||
| 228 | + | ||
| 229 | + // 根据ID查询路段信息. | ||
| 230 | + getRouteInfoById : function(sectionRouteId,callback){ | ||
| 231 | + $get('/inout/' + sectionRouteId,{},function(r) { | ||
| 232 | + return callback && callback(r); | ||
| 233 | + }); | ||
| 199 | } | 234 | } |
| 200 | }; | 235 | }; |
| 201 | return ajaxData; | 236 | return ajaxData; |
src/main/resources/static/pages/base/stationroute/js/stationroute-list-events.js
| 1 | -$(function(){ | ||
| 2 | - | ||
| 3 | - // 上行方向(0:上行;1:下行) | ||
| 4 | - var directionUpValue = $('#stationUp').data('direction'); | ||
| 5 | - | ||
| 6 | - // 下行方向 (0:上行;1:下行) | ||
| 7 | - var directionDownValue = $('.downSystem').data('direction'); | ||
| 8 | - | ||
| 9 | - | ||
| 10 | - | ||
| 11 | - // 系统规划上行站点点击事件 | ||
| 12 | - $('.upSystem').on('click',function() { | ||
| 13 | - // 隐藏上行规划 | ||
| 14 | - $('#upToolsMobal').hide(); | ||
| 15 | - // 弹出正在加载层 | ||
| 16 | - var i = layer.load(0,{offset:['200px', '280px']}); | ||
| 17 | - /** 修正线路名称 @param:<directionUpValue:方向(上行)> */ | ||
| 18 | - PublicFunctions.lineNameIsHaveInterval(directionUpValue); | ||
| 19 | - | ||
| 20 | - }); | ||
| 21 | - | ||
| 22 | - // 上行站点其它规划点击事件 | ||
| 23 | - $('.upManual').on('click',function() { | ||
| 24 | - // 加载模板手动添加站点页面 | ||
| 25 | - $.get('addstationstemplate.html', function(m){ | ||
| 26 | - $(pjaxContainer).append(m); | ||
| 27 | - $('#add_station_template_mobal').trigger('AddStationTempMobal.show', [WorldsBMap,GetAjaxData,directionUpValue,LineObj,PublicFunctions]); | ||
| 28 | - }); | ||
| 29 | - /*// 加载其它规划选择弹出层mobal页面 | ||
| 30 | - $.get('add_manual_select.html', function(m){ | ||
| 31 | - $(pjaxContainer).append(m); | ||
| 32 | - $('#add_manual_mobal').trigger('AddManualMobal.show', [WorldsBMap,GetAjaxData,directionUpValue,LineObj,PublicFunctions]); | ||
| 33 | - });*/ | ||
| 34 | - | ||
| 35 | - }); | ||
| 36 | - $('.gpsRoute').on('click',function() { | ||
| 37 | - var Line = LineObj.getLineObj(); | ||
| 38 | - // 加载其它规划选择弹出层mobal页面 | ||
| 39 | - $.get('editRoute.html', function(m){ | ||
| 40 | - $(pjaxContainer).append(m); | ||
| 41 | - $('#edit_route_mobal').trigger('editRouteMobal.show', [WorldsBMap,GetAjaxData,Line,PublicFunctions]); | ||
| 42 | - }); | ||
| 43 | - }); | ||
| 44 | - | ||
| 45 | - // 上行站点新增事件 | ||
| 46 | - $('.module_tools #addUpStation').on('click', function() { | ||
| 47 | - /** 设置新增站点对象方向属性值 @param:<directionUpValue:方向(0:上行;1:下行)> */ | ||
| 48 | - AddStationObj.setAddStationDiraction(directionUpValue); | ||
| 49 | - // 加载选择新增方式mobal | ||
| 50 | - $.get('add_select.html', function(m){ | ||
| 51 | - $(pjaxContainer).append(m); | ||
| 52 | - $('#add_select_mobal').trigger('AddSelectMobal.show', [WorldsBMap,DrawingManagerObj,GetAjaxData,AddStationObj,LineObj,PublicFunctions]); | ||
| 53 | - }); | ||
| 54 | - }); | ||
| 55 | - | ||
| 56 | - // 修改上行站点mobal页面 | ||
| 57 | - $('.module_tools #editUpStation').on('click', function(){ | ||
| 58 | - var sel = PublicFunctions.getCurrSelNode(directionUpValue); | ||
| 59 | - if(sel.length==0 || sel[0].original.chaildredType !='station'){ | ||
| 60 | - layer.msg('请先选择要编辑的上行站点!'); | ||
| 61 | - return; | ||
| 62 | - } | ||
| 63 | - $.get('edit_select.html', function(m){ | ||
| 64 | - $(pjaxContainer).append(m); | ||
| 65 | - $('#edit_select_mobal').trigger('editSelectMobal_show', [WorldsBMap,DrawingManagerObj,GetAjaxData,EditStationObj,LineObj,PublicFunctions,directionUpValue]); | ||
| 66 | - }); | ||
| 67 | - }); | ||
| 68 | - | ||
| 69 | - // 撤销上行站点 | ||
| 70 | - $('.module_tools #deleteUpStation').on('click', function() { | ||
| 71 | - PublicFunctions.stationRevoke(directionUpValue); | ||
| 72 | - }); | ||
| 73 | - | ||
| 74 | - // 上行批量撤销事件 | ||
| 75 | - $('.module_tools #batchUpDelete').on('click', function() { | ||
| 76 | - var Line = LineObj.getLineObj(); | ||
| 77 | - /** 设置批量删除的线路方向 @param:<directionUpValue:方向(0:上行;1:下行)> */ | ||
| 78 | - DeleteBatchObj.setDeteleBatchDiraction(directionUpValue); | ||
| 79 | - // 加载选择新增方式mobal | ||
| 80 | - $.get('delete_select.html', function(m){ | ||
| 81 | - $(pjaxContainer).append(m); | ||
| 82 | - $('#delete_select_mobal').trigger('deleteSelectMobal.show',[GetAjaxData,Line,PublicFunctions,DeleteBatchObj]); | ||
| 83 | - }); | ||
| 84 | - }); | ||
| 85 | - | ||
| 86 | - // 切换上下行. | ||
| 87 | - $('.retweet').on('click',function() { | ||
| 88 | - layer.confirm('您是否确定将【上、下】行站点和路段进行对换!', { | ||
| 89 | - btn : [ '确认提示并提交', '取消' ] | ||
| 90 | - },function () { | ||
| 91 | - // 关闭所有提示弹出层. | ||
| 92 | - layer.closeAll(); | ||
| 93 | - // 弹出提示层. | ||
| 94 | - var index = layer.load(1, { | ||
| 95 | - shade: [0.1,'#fff'] // 透明度的白色背景 | ||
| 96 | - }); | ||
| 97 | - var Line = LineObj.getLineObj(); | ||
| 98 | - $post('/stationroute/updSwitchDir?lineIds='+ Line.id + "&status=" + $($("#versions").find("option:selected")[0]).attr("status") ,null,function(data) { | ||
| 99 | - layer.close(index); | ||
| 100 | - if(data.status=='SUCCESS') { | ||
| 101 | - // 弹出操作成功提示消息 | ||
| 102 | - layer.msg('操作成功...'); | ||
| 103 | - }else { | ||
| 104 | - // 弹出操作失败提示消息 | ||
| 105 | - layer.msg('操作成功...'); | ||
| 106 | - } | ||
| 107 | - WorldsBMap.clearMarkAndOverlays(); | ||
| 108 | - $('#stationDown').removeClass('active'); | ||
| 109 | - $('#stationDown').removeClass('in'); | ||
| 110 | - $('#stationDown').addClass('fade'); | ||
| 111 | - $('#stationUp').addClass('active in'); | ||
| 112 | - $('#downLine').parent().removeClass('active'); | ||
| 113 | - $('#upLine').parent().addClass('active'); | ||
| 114 | - // 刷新左边树 | ||
| 115 | - PublicFunctions.resjtreeDate(Line.id,0,$("#versions").val()); | ||
| 116 | - /** 查询上行路段信息 @param:<Line.id:线路Id;0:上行> @return:data:路段数据 */ | ||
| 117 | -// GetAjaxData.getSectionRouteInfo(Line.id,0,function(data) { | ||
| 118 | -// /** 在地图上画出线路走向 @param:<Line.id:线路Id;0:上行;data:路段数据> */ | ||
| 119 | -// PublicFunctions.linePanlThree(Line.id,data,0); | ||
| 120 | -// }); | ||
| 121 | - }); | ||
| 122 | - }); | ||
| 123 | - }); | ||
| 124 | - | ||
| 125 | - $('#wrenchUpDis').on('click',function() { | ||
| 126 | - var Line = LineObj.getLineObj(); | ||
| 127 | - GetAjaxData.getStation(Line.id,directionUpValue,$("#versions").val(),function(rd) { | ||
| 128 | - // 加载其它规划选择弹出层mobal页面 | ||
| 129 | - $.get('tzzj.html', function(m){ | ||
| 130 | - $(pjaxContainer).append(m); | ||
| 131 | - $('#tzzj_mobal').trigger('tzzjMobal.show', [WorldsBMap,GetAjaxData,0,Line.id,PublicFunctions,rd[0].children[0].children]); | ||
| 132 | - }); | ||
| 133 | - }); | ||
| 134 | - }) | ||
| 135 | - | ||
| 136 | - $('#wrenchDownDis').on('click',function() { | ||
| 137 | - var Line = LineObj.getLineObj(); | ||
| 138 | - GetAjaxData.getStation(Line.id,directionDownValue,$("#versions").val(),function(rd) { | ||
| 139 | - // 加载其它规划选择弹出层mobal页面 | ||
| 140 | - $.get('tzzj.html', function(m){ | ||
| 141 | - $(pjaxContainer).append(m); | ||
| 142 | - $('#tzzj_mobal').trigger('tzzjMobal.show', [WorldsBMap,GetAjaxData,1,Line.id,PublicFunctions,rd[0].children[0].children]); | ||
| 143 | - }); | ||
| 144 | - }); | ||
| 145 | - }); | ||
| 146 | - | ||
| 147 | - $('#quoteDown').on('click',function() { | ||
| 148 | - // 弹出提示层. | ||
| 149 | - var index = layer.load(1, { | ||
| 150 | - shade: [0.1,'#fff'] // 透明度的白色背景 | ||
| 151 | - }); | ||
| 152 | - var Line = LineObj.getLineObj(); | ||
| 153 | - var params = {'lineId':Line.id ,'dir':1,'toDir':0,status:$($("#versions").find("option:selected")[0]).attr("status")} ; | ||
| 154 | - quote(params,index); | ||
| 155 | - }); | ||
| 156 | - | ||
| 157 | - $('#quoteUp').on('click',function() { | ||
| 158 | - // 弹出提示层. | ||
| 159 | - var index = layer.load(1, { | ||
| 160 | - shade: [0.1,'#fff'] // 透明度的白色背景 | ||
| 161 | - }); | ||
| 162 | - var Line = LineObj.getLineObj(); | ||
| 163 | - console.log($($("#versions").find("option:selected")[0]).attr("status")); | ||
| 164 | - var params = {'lineId':Line.id ,'dir':0,'toDir':1,status:$($("#versions").find("option:selected")[0]).attr("status")}; | ||
| 165 | - quote(params,index); | ||
| 166 | - }); | ||
| 167 | - | ||
| 168 | - $('#batchUpdateIndustryCode').on('click',function() { | ||
| 169 | - var Line = LineObj.getLineObj(); | ||
| 170 | - // 加载其它规划选择弹出层mobal页面 | ||
| 171 | - $.get('batch_update_industryCode.html', function(m){ | ||
| 172 | - $(pjaxContainer).append(m); | ||
| 173 | - $('#batch_update_industryCode_mobal').trigger('batch_update_industryCodeMobal.show', [WorldsBMap,GetAjaxData,0,Line.id,PublicFunctions]); | ||
| 174 | - }); | ||
| 175 | - }); | ||
| 176 | - $('#batchDowndateIndustryCode').on('click',function() { | ||
| 177 | - var Line = LineObj.getLineObj(); | ||
| 178 | - // 加载其它规划选择弹出层mobal页面 | ||
| 179 | - $.get('batch_update_industryCode.html', function(m){ | ||
| 180 | - $(pjaxContainer).append(m); | ||
| 181 | - $('#batch_update_industryCode_mobal').trigger('batch_update_industryCodeMobal.show', [WorldsBMap,GetAjaxData,1,Line.id,PublicFunctions]); | ||
| 182 | - }); | ||
| 183 | - }); | ||
| 184 | - | ||
| 185 | - function quote(params,index) { | ||
| 186 | - $post('/sectionroute/quoteSection',params,function(data) { | ||
| 187 | - layer.close(index); | ||
| 188 | - if(data.status=='SUCCESS') { | ||
| 189 | - // 弹出操作成功提示消息 | ||
| 190 | - layer.msg('操作成功...'); | ||
| 191 | - }else { | ||
| 192 | - // 弹出操作失败提示消息 | ||
| 193 | - layer.msg('操作成功...'); | ||
| 194 | - } | ||
| 195 | - WorldsBMap.clearMarkAndOverlays(); | ||
| 196 | - | ||
| 197 | - var dir = params.dir; | ||
| 198 | - if(dir == 0){ | ||
| 199 | - dir = 1; | ||
| 200 | - }else{ | ||
| 201 | - dir = 0; | ||
| 202 | - } | ||
| 203 | - // 刷新左边树 | ||
| 204 | - PublicFunctions.resjtreeDate(params.lineId,dir,$("#versions").val()); | ||
| 205 | - /** 查询上行路段信息 @param:<Line.id:线路Id;0:上行> @return:data:路段数据 */ | ||
| 206 | -// GetAjaxData.getSectionRouteInfo(params.lineId,params.dir,function(data) { | ||
| 207 | -// /** 在地图上画出线路走向 @param:<Line.id:线路Id;0:上行;data:路段数据> */ | ||
| 208 | -// PublicFunctions.linePanlThree(params.lineId,data,params.dir); | ||
| 209 | -// }); | ||
| 210 | - }); | ||
| 211 | - } | ||
| 212 | - // 编辑线路上行走向 | ||
| 213 | - $('.module_tools #editUplineTrend').on('click', function() {PublicFunctions.editLinePlan(directionUpValue);}); | ||
| 214 | - | ||
| 215 | - // 线路上行 | ||
| 216 | - $('#leftUpOrDown #upLine').on('click', function(){ | ||
| 217 | - var lineIdEvents = LineObj.getLineObj(); | ||
| 218 | - | ||
| 219 | - var val = $("#versions").val(); | ||
| 220 | - | ||
| 221 | - /** 初始化上行树 @param:<Line.id:线路Id;0:上行> */ | ||
| 222 | - PublicFunctions.resjtreeDate(lineIdEvents.id,'0',val); | ||
| 223 | - | ||
| 224 | - }); | ||
| 225 | - | ||
| 226 | - // 系统规划下行站点 | ||
| 227 | - $('.downSystem').on('click',function() { | ||
| 228 | - // 隐藏下行规划 | ||
| 229 | - $('#downToolsMobal').hide(); | ||
| 230 | - // 弹出正在加载层 | ||
| 231 | - var i = layer.load(0,{offset:['200px', '280px']}); | ||
| 232 | - /** 修正线路名称 @param:<directionUpValue:方向(上行)> */ | ||
| 233 | - PublicFunctions.lineNameIsHaveInterval(directionDownValue); | ||
| 234 | - }); | ||
| 235 | - | ||
| 236 | - // 下行站点其它规划点击事件 | ||
| 237 | - $('.downManual').on('click',function() { | ||
| 238 | - // 加载模板手动添加站点页面 | ||
| 239 | - $.get('addstationstemplate.html', function(m){ | ||
| 240 | - $(pjaxContainer).append(m); | ||
| 241 | - $('#add_station_template_mobal').trigger('AddStationTempMobal.show', [WorldsBMap,GetAjaxData,directionDownValue,LineObj,PublicFunctions]); | ||
| 242 | - }); | ||
| 243 | - /*// 加载其它规划选择弹出层mobal页面 | ||
| 244 | - $.get('add_manual_select.html', function(m){ | ||
| 245 | - $(pjaxContainer).append(m); | ||
| 246 | - $('#add_manual_mobal').trigger('AddManualMobal.show', [WorldsBMap,GetAjaxData,directionDownValue,LineObj,PublicFunctions]); | ||
| 247 | - });*/ | ||
| 248 | - }); | ||
| 249 | - | ||
| 250 | - // 下行站点新增事件 | ||
| 251 | - $('.module_tools #addDownStation').on('click', function() { | ||
| 252 | - /** 设置新增站点对象方向属性值 @param:<directionUpValue:方向(0:上行;1:下行)> */ | ||
| 253 | - AddStationObj.setAddStationDiraction(directionDownValue); | ||
| 254 | - // 加载选择新增方式mobal | ||
| 255 | - $.get('add_select.html', function(m){ | ||
| 256 | - $(pjaxContainer).append(m); | ||
| 257 | - $('#add_select_mobal').trigger('AddSelectMobal.show', [WorldsBMap,DrawingManagerObj,GetAjaxData,AddStationObj,LineObj,PublicFunctions]); | ||
| 258 | - }); | ||
| 259 | - }); | ||
| 260 | - | ||
| 261 | - // 修改下行站点mobal页面 | ||
| 262 | - $('.module_tools #editDownStation').on('click', function(){ | ||
| 263 | - var sel = PublicFunctions.getCurrSelNode(directionDownValue); | ||
| 264 | - if(sel.length==0 || sel[0].original.chaildredType !='station'){ | ||
| 265 | - layer.msg('请先选择要编辑的下行站点!'); | ||
| 266 | - return; | ||
| 267 | - } | ||
| 268 | - $.get('edit_select.html', function(m){ | ||
| 269 | - $(pjaxContainer).append(m); | ||
| 270 | - $('#edit_select_mobal').trigger('editSelectMobal_show', [WorldsBMap,DrawingManagerObj,GetAjaxData,EditStationObj,LineObj,PublicFunctions,directionDownValue]); | ||
| 271 | - }); | ||
| 272 | - }); | ||
| 273 | - | ||
| 274 | - // 撤销下行站点 | ||
| 275 | - $('.module_tools #deleteDownStation').on('click', function() { | ||
| 276 | - PublicFunctions.stationRevoke(directionDownValue); | ||
| 277 | - }); | ||
| 278 | - | ||
| 279 | - // 下行批量撤销事件 | ||
| 280 | - $('.module_tools #batchDownDelete').on('click', function() { | ||
| 281 | - var Line = LineObj.getLineObj(); | ||
| 282 | - /** 设置批量删除的线路方向 @param:<directionDownValue:方向(0:上行;1:下行)> */ | ||
| 283 | - DeleteBatchObj.setDeteleBatchDiraction(directionDownValue); | ||
| 284 | - // 加载选择新增方式mobal | ||
| 285 | - $.get('delete_select.html', function(m){ | ||
| 286 | - $(pjaxContainer).append(m); | ||
| 287 | - $('#delete_select_mobal').trigger('deleteSelectMobal.show',[GetAjaxData,Line,PublicFunctions,DeleteBatchObj]); | ||
| 288 | - }); | ||
| 289 | - }); | ||
| 290 | - | ||
| 291 | - // 编辑线路下行走向 | ||
| 292 | - $('.module_tools #editDownlineTrend').on('click', function() { | ||
| 293 | - PublicFunctions.editLinePlan(directionDownValue); | ||
| 294 | - }); | ||
| 295 | - | ||
| 296 | - // 线路下行 | ||
| 297 | - $('#leftUpOrDown #downLine').on('click', function(){ | ||
| 298 | - var lineIdEvents = LineObj.getLineObj(); | ||
| 299 | - | ||
| 300 | - | ||
| 301 | - var val = $("#versions").val(); | ||
| 302 | - /** 初始化下行树 @param:<Line.id:线路Id;1:下行> */ | ||
| 303 | - PublicFunctions.resjtreeDate(lineIdEvents.id,'1',val); | ||
| 304 | - }); | ||
| 305 | - | ||
| 306 | - // 生成行单 | ||
| 307 | - $('.module_tools #createUsingSingle').on('click', function() { | ||
| 308 | - var lineIdEvents = LineObj.getLineObj(); | ||
| 309 | - var params = {lineId:lineIdEvents.id}; | ||
| 310 | - GetAjaxData.createUsingSingle(params,function(data) { | ||
| 311 | - if(data.status=='SUCCESS') { | ||
| 312 | - // 弹出生成成功提示消息 | ||
| 313 | - layer.msg('生成成功...'); | ||
| 314 | - }else { | ||
| 315 | - // 弹出生成失败提示消息 | ||
| 316 | - layer.msg('生成失败...'); | ||
| 317 | - } | ||
| 318 | - }); | ||
| 319 | - }); | ||
| 320 | - $('#scrllmouseEvent').on('mousemove',function() { | ||
| 321 | - $('.defeat-scroll').css('overflow','auto'); | ||
| 322 | - }).on('mouseleave',function() { | ||
| 323 | - $('.defeat-scroll').css('overflow','hidden'); | ||
| 324 | - }); | ||
| 325 | - | ||
| 326 | - $(".match_station_bnt").on("click",function () { | ||
| 327 | - var index = layer.open({ | ||
| 328 | - title: '提示', | ||
| 329 | - content:'是否匹配外部上下行站点行业编码!', | ||
| 330 | - // type: 1, | ||
| 331 | - // area: ['600px', '360px'], | ||
| 332 | - // scrollbar: false, | ||
| 333 | - | ||
| 334 | - btn:['确定','取消'], | ||
| 335 | - yes: function(index){ | ||
| 336 | - var lineId = LineObj.getLineObj().id; | ||
| 337 | - GetAjaxData.matchIndustryCode(lineId,function (rs) { | ||
| 338 | - // $post("/stationroute/matchIndustryCode",{"lineId":lineId},function (rs) { | ||
| 339 | - if(rs.status == "SUCCESS"){ | ||
| 340 | - var map = new Map(); | ||
| 341 | - var upMatch = rs.upMatch, downMatch = rs.downMatch; | ||
| 342 | - if(upMatch !=null && upMatch.length>0){ | ||
| 343 | - map.set("up",upMatch); | ||
| 344 | - } | ||
| 345 | - if(downMatch !=null && downMatch.length>0){ | ||
| 346 | - map.set("down",downMatch); | ||
| 347 | - } | ||
| 348 | - if(map.size>0){ | ||
| 349 | - $('.portlet-title .match_station').addClass('hidden'); | ||
| 350 | - PublicFunctions.resjtreeDate(lineId,0,$("#versions").val()); | ||
| 351 | - /** 查询上行路段信息 @param:<Line.id:线路Id;0:上行> @return:data:路段数据 */ | ||
| 352 | -// GetAjaxData.getSectionRouteInfo(lineId,0,function(data) { | ||
| 353 | -// /** 在地图上画出线路走向 @param:<Line.id:线路Id;0:上行;data:路段数据> */ | ||
| 354 | -// PublicFunctions.linePanlThree(lineId,data,0); | ||
| 355 | -// }); | ||
| 356 | - $('#stationDown').removeClass('active'); | ||
| 357 | - $('#stationDown').removeClass('in'); | ||
| 358 | - $('#stationDown').addClass('fade'); | ||
| 359 | - $('#stationUp').addClass('active in'); | ||
| 360 | - $('#downLine').parent().removeClass('active'); | ||
| 361 | - $('#upLine').parent().addClass('active'); | ||
| 362 | - $.get('match_station_industryCode.html', function(m){ | ||
| 363 | - $(pjaxContainer).append(m); | ||
| 364 | - $('#match_station_industryCode_mobal').trigger('match_station_industryCodeMobal.show', map); | ||
| 365 | - }); | ||
| 366 | - } else { | ||
| 367 | - layer.msg("没有匹配到外部站点数据,请手动添加!") | ||
| 368 | - } | ||
| 369 | - } else | ||
| 370 | - layer.msg("匹配出错,请手动添加!") | ||
| 371 | - }); | ||
| 372 | - layer.close(index); | ||
| 373 | - }, | ||
| 374 | - btn2:function(){ | ||
| 375 | - layer.closeAll(index); //关闭当前窗口 | ||
| 376 | - } | ||
| 377 | - }); | ||
| 378 | - }) | 1 | +$(function(){ |
| 2 | + | ||
| 3 | + // 上行方向(0:上行;1:下行) | ||
| 4 | + var directionUpValue = $('#stationUp').data('direction'); | ||
| 5 | + | ||
| 6 | + // 下行方向 (0:上行;1:下行) | ||
| 7 | + var directionDownValue = $('.downSystem').data('direction'); | ||
| 8 | + | ||
| 9 | + | ||
| 10 | + | ||
| 11 | + // 系统规划上行站点点击事件 | ||
| 12 | + $('.upSystem').on('click',function() { | ||
| 13 | + // 隐藏上行规划 | ||
| 14 | + $('#upToolsMobal').hide(); | ||
| 15 | + // 弹出正在加载层 | ||
| 16 | + var i = layer.load(0,{offset:['200px', '280px']}); | ||
| 17 | + /** 修正线路名称 @param:<directionUpValue:方向(上行)> */ | ||
| 18 | + PublicFunctions.lineNameIsHaveInterval(directionUpValue); | ||
| 19 | + | ||
| 20 | + }); | ||
| 21 | + | ||
| 22 | + // 上行站点其它规划点击事件 | ||
| 23 | + $('.upManual').on('click',function() { | ||
| 24 | + // 加载模板手动添加站点页面 | ||
| 25 | + $.get('addstationstemplate.html', function(m){ | ||
| 26 | + $(pjaxContainer).append(m); | ||
| 27 | + $('#add_station_template_mobal').trigger('AddStationTempMobal.show', [WorldsBMap,GetAjaxData,directionUpValue,LineObj,PublicFunctions]); | ||
| 28 | + }); | ||
| 29 | + /*// 加载其它规划选择弹出层mobal页面 | ||
| 30 | + $.get('add_manual_select.html', function(m){ | ||
| 31 | + $(pjaxContainer).append(m); | ||
| 32 | + $('#add_manual_mobal').trigger('AddManualMobal.show', [WorldsBMap,GetAjaxData,directionUpValue,LineObj,PublicFunctions]); | ||
| 33 | + });*/ | ||
| 34 | + | ||
| 35 | + }); | ||
| 36 | + $('.gpsRoute').on('click',function() { | ||
| 37 | + var Line = LineObj.getLineObj(); | ||
| 38 | + // 加载其它规划选择弹出层mobal页面 | ||
| 39 | + $.get('editRoute.html', function(m){ | ||
| 40 | + $(pjaxContainer).append(m); | ||
| 41 | + $('#edit_route_mobal').trigger('editRouteMobal.show', [WorldsBMap,GetAjaxData,Line,PublicFunctions]); | ||
| 42 | + }); | ||
| 43 | + }); | ||
| 44 | + | ||
| 45 | + // 上行站点新增事件 | ||
| 46 | + $('.module_tools #addUpStation').on('click', function() { | ||
| 47 | + /** 设置新增站点对象方向属性值 @param:<directionUpValue:方向(0:上行;1:下行)> */ | ||
| 48 | + AddStationObj.setAddStationDiraction(directionUpValue); | ||
| 49 | + // 加载选择新增方式mobal | ||
| 50 | + $.get('add_select.html', function(m){ | ||
| 51 | + $(pjaxContainer).append(m); | ||
| 52 | + $('#add_select_mobal').trigger('AddSelectMobal.show', [WorldsBMap,DrawingManagerObj,GetAjaxData,AddStationObj,LineObj,PublicFunctions]); | ||
| 53 | + }); | ||
| 54 | + }); | ||
| 55 | + | ||
| 56 | + // 修改上行站点mobal页面 | ||
| 57 | + $('.module_tools #editUpStation').on('click', function(){ | ||
| 58 | + var sel = PublicFunctions.getCurrSelNode(directionUpValue); | ||
| 59 | + if(sel.length==0 || sel[0].original.chaildredType !='station'){ | ||
| 60 | + layer.msg('请先选择要编辑的上行站点!'); | ||
| 61 | + return; | ||
| 62 | + } | ||
| 63 | + $.get('edit_select.html', function(m){ | ||
| 64 | + $(pjaxContainer).append(m); | ||
| 65 | + $('#edit_select_mobal').trigger('editSelectMobal_show', [WorldsBMap,DrawingManagerObj,GetAjaxData,EditStationObj,LineObj,PublicFunctions,directionUpValue]); | ||
| 66 | + }); | ||
| 67 | + }); | ||
| 68 | + | ||
| 69 | + // 撤销上行站点 | ||
| 70 | + $('.module_tools #deleteUpStation').on('click', function() { | ||
| 71 | + PublicFunctions.stationRevoke(directionUpValue); | ||
| 72 | + }); | ||
| 73 | + | ||
| 74 | + // 上行批量撤销事件 | ||
| 75 | + $('.module_tools #batchUpDelete').on('click', function() { | ||
| 76 | + var Line = LineObj.getLineObj(); | ||
| 77 | + /** 设置批量删除的线路方向 @param:<directionUpValue:方向(0:上行;1:下行)> */ | ||
| 78 | + DeleteBatchObj.setDeteleBatchDiraction(directionUpValue); | ||
| 79 | + // 加载选择新增方式mobal | ||
| 80 | + $.get('delete_select.html', function(m){ | ||
| 81 | + $(pjaxContainer).append(m); | ||
| 82 | + $('#delete_select_mobal').trigger('deleteSelectMobal.show',[GetAjaxData,Line,PublicFunctions,DeleteBatchObj]); | ||
| 83 | + }); | ||
| 84 | + }); | ||
| 85 | + | ||
| 86 | + // 切换上下行. | ||
| 87 | + $('.retweet').on('click',function() { | ||
| 88 | + layer.confirm('您是否确定将【上、下】行站点和路段进行对换!', { | ||
| 89 | + btn : [ '确认提示并提交', '取消' ] | ||
| 90 | + },function () { | ||
| 91 | + // 关闭所有提示弹出层. | ||
| 92 | + layer.closeAll(); | ||
| 93 | + // 弹出提示层. | ||
| 94 | + var index = layer.load(1, { | ||
| 95 | + shade: [0.1,'#fff'] // 透明度的白色背景 | ||
| 96 | + }); | ||
| 97 | + var Line = LineObj.getLineObj(); | ||
| 98 | + $post('/stationroute/updSwitchDir?lineIds='+ Line.id + "&status=" + $($("#versions").find("option:selected")[0]).attr("status") ,null,function(data) { | ||
| 99 | + layer.close(index); | ||
| 100 | + if(data.status=='SUCCESS') { | ||
| 101 | + // 弹出操作成功提示消息 | ||
| 102 | + layer.msg('操作成功...'); | ||
| 103 | + }else { | ||
| 104 | + // 弹出操作失败提示消息 | ||
| 105 | + layer.msg('操作成功...'); | ||
| 106 | + } | ||
| 107 | + WorldsBMap.clearMarkAndOverlays(); | ||
| 108 | + $('#stationDown').removeClass('active'); | ||
| 109 | + $('#stationDown').removeClass('in'); | ||
| 110 | + $('#stationDown').addClass('fade'); | ||
| 111 | + $('#stationUp').addClass('active in'); | ||
| 112 | + $('#downLine').parent().removeClass('active'); | ||
| 113 | + $('#upLine').parent().addClass('active'); | ||
| 114 | + // 刷新左边树 | ||
| 115 | + PublicFunctions.resjtreeDate(Line.id,0,$("#versions").val()); | ||
| 116 | + /** 查询上行路段信息 @param:<Line.id:线路Id;0:上行> @return:data:路段数据 */ | ||
| 117 | +// GetAjaxData.getSectionRouteInfo(Line.id,0,function(data) { | ||
| 118 | +// /** 在地图上画出线路走向 @param:<Line.id:线路Id;0:上行;data:路段数据> */ | ||
| 119 | +// PublicFunctions.linePanlThree(Line.id,data,0); | ||
| 120 | +// }); | ||
| 121 | + }); | ||
| 122 | + }); | ||
| 123 | + }); | ||
| 124 | + | ||
| 125 | + $('#wrenchUpDis').on('click',function() { | ||
| 126 | + var Line = LineObj.getLineObj(); | ||
| 127 | + GetAjaxData.getStation(Line.id,directionUpValue,$("#versions").val(),function(rd) { | ||
| 128 | + // 加载其它规划选择弹出层mobal页面 | ||
| 129 | + $.get('tzzj.html', function(m){ | ||
| 130 | + $(pjaxContainer).append(m); | ||
| 131 | + $('#tzzj_mobal').trigger('tzzjMobal.show', [WorldsBMap,GetAjaxData,0,Line.id,PublicFunctions,rd[0].children[0].children]); | ||
| 132 | + }); | ||
| 133 | + }); | ||
| 134 | + }) | ||
| 135 | + | ||
| 136 | + $('#wrenchDownDis').on('click',function() { | ||
| 137 | + var Line = LineObj.getLineObj(); | ||
| 138 | + GetAjaxData.getStation(Line.id,directionDownValue,$("#versions").val(),function(rd) { | ||
| 139 | + // 加载其它规划选择弹出层mobal页面 | ||
| 140 | + $.get('tzzj.html', function(m){ | ||
| 141 | + $(pjaxContainer).append(m); | ||
| 142 | + $('#tzzj_mobal').trigger('tzzjMobal.show', [WorldsBMap,GetAjaxData,1,Line.id,PublicFunctions,rd[0].children[0].children]); | ||
| 143 | + }); | ||
| 144 | + }); | ||
| 145 | + }); | ||
| 146 | + | ||
| 147 | + $('#quoteDown').on('click',function() { | ||
| 148 | + // 弹出提示层. | ||
| 149 | + var index = layer.load(1, { | ||
| 150 | + shade: [0.1,'#fff'] // 透明度的白色背景 | ||
| 151 | + }); | ||
| 152 | + var Line = LineObj.getLineObj(); | ||
| 153 | + var params = {'lineId':Line.id ,'dir':1,'toDir':0,status:$($("#versions").find("option:selected")[0]).attr("status")} ; | ||
| 154 | + quote(params,index); | ||
| 155 | + }); | ||
| 156 | + | ||
| 157 | + $('#quoteUp').on('click',function() { | ||
| 158 | + // 弹出提示层. | ||
| 159 | + var index = layer.load(1, { | ||
| 160 | + shade: [0.1,'#fff'] // 透明度的白色背景 | ||
| 161 | + }); | ||
| 162 | + var Line = LineObj.getLineObj(); | ||
| 163 | + console.log($($("#versions").find("option:selected")[0]).attr("status")); | ||
| 164 | + var params = {'lineId':Line.id ,'dir':0,'toDir':1,status:$($("#versions").find("option:selected")[0]).attr("status")}; | ||
| 165 | + quote(params,index); | ||
| 166 | + }); | ||
| 167 | + | ||
| 168 | + $('#batchUpdateIndustryCode').on('click',function() { | ||
| 169 | + var Line = LineObj.getLineObj(); | ||
| 170 | + // 加载其它规划选择弹出层mobal页面 | ||
| 171 | + $.get('batch_update_industryCode.html', function(m){ | ||
| 172 | + $(pjaxContainer).append(m); | ||
| 173 | + $('#batch_update_industryCode_mobal').trigger('batch_update_industryCodeMobal.show', [WorldsBMap,GetAjaxData,0,Line.id,PublicFunctions]); | ||
| 174 | + }); | ||
| 175 | + }); | ||
| 176 | + $('#batchDowndateIndustryCode').on('click',function() { | ||
| 177 | + var Line = LineObj.getLineObj(); | ||
| 178 | + // 加载其它规划选择弹出层mobal页面 | ||
| 179 | + $.get('batch_update_industryCode.html', function(m){ | ||
| 180 | + $(pjaxContainer).append(m); | ||
| 181 | + $('#batch_update_industryCode_mobal').trigger('batch_update_industryCodeMobal.show', [WorldsBMap,GetAjaxData,1,Line.id,PublicFunctions]); | ||
| 182 | + }); | ||
| 183 | + }); | ||
| 184 | + | ||
| 185 | + function quote(params,index) { | ||
| 186 | + $post('/sectionroute/quoteSection',params,function(data) { | ||
| 187 | + layer.close(index); | ||
| 188 | + if(data.status=='SUCCESS') { | ||
| 189 | + // 弹出操作成功提示消息 | ||
| 190 | + layer.msg('操作成功...'); | ||
| 191 | + }else { | ||
| 192 | + // 弹出操作失败提示消息 | ||
| 193 | + layer.msg('操作成功...'); | ||
| 194 | + } | ||
| 195 | + WorldsBMap.clearMarkAndOverlays(); | ||
| 196 | + | ||
| 197 | + var dir = params.dir; | ||
| 198 | + if(dir == 0){ | ||
| 199 | + dir = 1; | ||
| 200 | + }else{ | ||
| 201 | + dir = 0; | ||
| 202 | + } | ||
| 203 | + // 刷新左边树 | ||
| 204 | + PublicFunctions.resjtreeDate(params.lineId,dir,$("#versions").val()); | ||
| 205 | + /** 查询上行路段信息 @param:<Line.id:线路Id;0:上行> @return:data:路段数据 */ | ||
| 206 | +// GetAjaxData.getSectionRouteInfo(params.lineId,params.dir,function(data) { | ||
| 207 | +// /** 在地图上画出线路走向 @param:<Line.id:线路Id;0:上行;data:路段数据> */ | ||
| 208 | +// PublicFunctions.linePanlThree(params.lineId,data,params.dir); | ||
| 209 | +// }); | ||
| 210 | + }); | ||
| 211 | + } | ||
| 212 | + // 编辑线路上行走向 | ||
| 213 | + $('.module_tools #editUplineTrend').on('click', function() {PublicFunctions.editLinePlan(directionUpValue);}); | ||
| 214 | + | ||
| 215 | + // 线路上行 | ||
| 216 | + $('#leftUpOrDown #upLine').on('click', function(){ | ||
| 217 | + var lineIdEvents = LineObj.getLineObj(); | ||
| 218 | + | ||
| 219 | + var val = $("#versions").val(); | ||
| 220 | + | ||
| 221 | + /** 初始化上行树 @param:<Line.id:线路Id;0:上行> */ | ||
| 222 | + PublicFunctions.resjtreeDate(lineIdEvents.id,'0',val); | ||
| 223 | + | ||
| 224 | + }); | ||
| 225 | + | ||
| 226 | + // 系统规划下行站点 | ||
| 227 | + $('.downSystem').on('click',function() { | ||
| 228 | + // 隐藏下行规划 | ||
| 229 | + $('#downToolsMobal').hide(); | ||
| 230 | + // 弹出正在加载层 | ||
| 231 | + var i = layer.load(0,{offset:['200px', '280px']}); | ||
| 232 | + /** 修正线路名称 @param:<directionUpValue:方向(上行)> */ | ||
| 233 | + PublicFunctions.lineNameIsHaveInterval(directionDownValue); | ||
| 234 | + }); | ||
| 235 | + | ||
| 236 | + // 下行站点其它规划点击事件 | ||
| 237 | + $('.downManual').on('click',function() { | ||
| 238 | + // 加载模板手动添加站点页面 | ||
| 239 | + $.get('addstationstemplate.html', function(m){ | ||
| 240 | + $(pjaxContainer).append(m); | ||
| 241 | + $('#add_station_template_mobal').trigger('AddStationTempMobal.show', [WorldsBMap,GetAjaxData,directionDownValue,LineObj,PublicFunctions]); | ||
| 242 | + }); | ||
| 243 | + /*// 加载其它规划选择弹出层mobal页面 | ||
| 244 | + $.get('add_manual_select.html', function(m){ | ||
| 245 | + $(pjaxContainer).append(m); | ||
| 246 | + $('#add_manual_mobal').trigger('AddManualMobal.show', [WorldsBMap,GetAjaxData,directionDownValue,LineObj,PublicFunctions]); | ||
| 247 | + });*/ | ||
| 248 | + }); | ||
| 249 | + | ||
| 250 | + // 下行站点新增事件 | ||
| 251 | + $('.module_tools #addDownStation').on('click', function() { | ||
| 252 | + /** 设置新增站点对象方向属性值 @param:<directionUpValue:方向(0:上行;1:下行)> */ | ||
| 253 | + AddStationObj.setAddStationDiraction(directionDownValue); | ||
| 254 | + // 加载选择新增方式mobal | ||
| 255 | + $.get('add_select.html', function(m){ | ||
| 256 | + $(pjaxContainer).append(m); | ||
| 257 | + $('#add_select_mobal').trigger('AddSelectMobal.show', [WorldsBMap,DrawingManagerObj,GetAjaxData,AddStationObj,LineObj,PublicFunctions]); | ||
| 258 | + }); | ||
| 259 | + }); | ||
| 260 | + | ||
| 261 | + // 修改下行站点mobal页面 | ||
| 262 | + $('.module_tools #editDownStation').on('click', function(){ | ||
| 263 | + var sel = PublicFunctions.getCurrSelNode(directionDownValue); | ||
| 264 | + if(sel.length==0 || sel[0].original.chaildredType !='station'){ | ||
| 265 | + layer.msg('请先选择要编辑的下行站点!'); | ||
| 266 | + return; | ||
| 267 | + } | ||
| 268 | + $.get('edit_select.html', function(m){ | ||
| 269 | + $(pjaxContainer).append(m); | ||
| 270 | + $('#edit_select_mobal').trigger('editSelectMobal_show', [WorldsBMap,DrawingManagerObj,GetAjaxData,EditStationObj,LineObj,PublicFunctions,directionDownValue]); | ||
| 271 | + }); | ||
| 272 | + }); | ||
| 273 | + | ||
| 274 | + // 撤销下行站点 | ||
| 275 | + $('.module_tools #deleteDownStation').on('click', function() { | ||
| 276 | + PublicFunctions.stationRevoke(directionDownValue); | ||
| 277 | + }); | ||
| 278 | + | ||
| 279 | + // 下行批量撤销事件 | ||
| 280 | + $('.module_tools #batchDownDelete').on('click', function() { | ||
| 281 | + var Line = LineObj.getLineObj(); | ||
| 282 | + /** 设置批量删除的线路方向 @param:<directionDownValue:方向(0:上行;1:下行)> */ | ||
| 283 | + DeleteBatchObj.setDeteleBatchDiraction(directionDownValue); | ||
| 284 | + // 加载选择新增方式mobal | ||
| 285 | + $.get('delete_select.html', function(m){ | ||
| 286 | + $(pjaxContainer).append(m); | ||
| 287 | + $('#delete_select_mobal').trigger('deleteSelectMobal.show',[GetAjaxData,Line,PublicFunctions,DeleteBatchObj]); | ||
| 288 | + }); | ||
| 289 | + }); | ||
| 290 | + | ||
| 291 | + // 编辑线路下行走向 | ||
| 292 | + $('.module_tools #editDownlineTrend').on('click', function() { | ||
| 293 | + PublicFunctions.editLinePlan(directionDownValue); | ||
| 294 | + }); | ||
| 295 | + | ||
| 296 | + // 线路下行 | ||
| 297 | + $('#leftUpOrDown #downLine').on('click', function(){ | ||
| 298 | + var lineIdEvents = LineObj.getLineObj(); | ||
| 299 | + | ||
| 300 | + | ||
| 301 | + var val = $("#versions").val(); | ||
| 302 | + /** 初始化下行树 @param:<Line.id:线路Id;1:下行> */ | ||
| 303 | + PublicFunctions.resjtreeDate(lineIdEvents.id,'1',val); | ||
| 304 | + }); | ||
| 305 | + | ||
| 306 | + // 生成行单 | ||
| 307 | + $('.module_tools #createUsingSingle').on('click', function() { | ||
| 308 | + var lineIdEvents = LineObj.getLineObj(); | ||
| 309 | + var params = {lineId:lineIdEvents.id}; | ||
| 310 | + GetAjaxData.createUsingSingle(params,function(data) { | ||
| 311 | + if(data.status=='SUCCESS') { | ||
| 312 | + // 弹出生成成功提示消息 | ||
| 313 | + layer.msg('生成成功...'); | ||
| 314 | + }else { | ||
| 315 | + // 弹出生成失败提示消息 | ||
| 316 | + layer.msg('生成失败...'); | ||
| 317 | + } | ||
| 318 | + }); | ||
| 319 | + }); | ||
| 320 | + $('#scrllmouseEvent').on('mousemove',function() { | ||
| 321 | + $('.defeat-scroll').css('overflow','auto'); | ||
| 322 | + }).on('mouseleave',function() { | ||
| 323 | + $('.defeat-scroll').css('overflow','hidden'); | ||
| 324 | + }); | ||
| 325 | + | ||
| 326 | + $(".match_station_bnt").on("click",function () { | ||
| 327 | + var index = layer.open({ | ||
| 328 | + title: '提示', | ||
| 329 | + content:'是否匹配外部上下行站点行业编码!', | ||
| 330 | + // type: 1, | ||
| 331 | + // area: ['600px', '360px'], | ||
| 332 | + // scrollbar: false, | ||
| 333 | + | ||
| 334 | + btn:['确定','取消'], | ||
| 335 | + yes: function(index){ | ||
| 336 | + var lineId = LineObj.getLineObj().id; | ||
| 337 | + GetAjaxData.matchIndustryCode(lineId,function (rs) { | ||
| 338 | + // $post("/stationroute/matchIndustryCode",{"lineId":lineId},function (rs) { | ||
| 339 | + if(rs.status == "SUCCESS"){ | ||
| 340 | + var map = new Map(); | ||
| 341 | + var upMatch = rs.upMatch, downMatch = rs.downMatch; | ||
| 342 | + if(upMatch !=null && upMatch.length>0){ | ||
| 343 | + map.set("up",upMatch); | ||
| 344 | + } | ||
| 345 | + if(downMatch !=null && downMatch.length>0){ | ||
| 346 | + map.set("down",downMatch); | ||
| 347 | + } | ||
| 348 | + if(map.size>0){ | ||
| 349 | + $('.portlet-title .match_station').addClass('hidden'); | ||
| 350 | + PublicFunctions.resjtreeDate(lineId,0,$("#versions").val()); | ||
| 351 | + /** 查询上行路段信息 @param:<Line.id:线路Id;0:上行> @return:data:路段数据 */ | ||
| 352 | +// GetAjaxData.getSectionRouteInfo(lineId,0,function(data) { | ||
| 353 | +// /** 在地图上画出线路走向 @param:<Line.id:线路Id;0:上行;data:路段数据> */ | ||
| 354 | +// PublicFunctions.linePanlThree(lineId,data,0); | ||
| 355 | +// }); | ||
| 356 | + $('#stationDown').removeClass('active'); | ||
| 357 | + $('#stationDown').removeClass('in'); | ||
| 358 | + $('#stationDown').addClass('fade'); | ||
| 359 | + $('#stationUp').addClass('active in'); | ||
| 360 | + $('#downLine').parent().removeClass('active'); | ||
| 361 | + $('#upLine').parent().addClass('active'); | ||
| 362 | + $.get('match_station_industryCode.html', function(m){ | ||
| 363 | + $(pjaxContainer).append(m); | ||
| 364 | + $('#match_station_industryCode_mobal').trigger('match_station_industryCodeMobal.show', map); | ||
| 365 | + }); | ||
| 366 | + } else { | ||
| 367 | + layer.msg("没有匹配到外部站点数据,请手动添加!") | ||
| 368 | + } | ||
| 369 | + } else | ||
| 370 | + layer.msg("匹配出错,请手动添加!") | ||
| 371 | + }); | ||
| 372 | + layer.close(index); | ||
| 373 | + }, | ||
| 374 | + btn2:function(){ | ||
| 375 | + layer.closeAll(index); //关闭当前窗口 | ||
| 376 | + } | ||
| 377 | + }); | ||
| 378 | + }) | ||
| 379 | + | ||
| 380 | + // 进出场规划 | ||
| 381 | + $('#leftUpOrDown #inoutLine').on('click', function(){ | ||
| 382 | + var lineIdEvents = LineObj.getLineObj(); | ||
| 383 | + | ||
| 384 | + var val = $("#versions").val(); | ||
| 385 | + | ||
| 386 | + /** 初始化上行树 @param:<Line.id:线路Id;0:上行> */ | ||
| 387 | + PublicFunctions.resjtreeDate(lineIdEvents.id,'3',val); | ||
| 388 | + | ||
| 389 | + }); | ||
| 379 | }); | 390 | }); |
| 380 | \ No newline at end of file | 391 | \ No newline at end of file |
src/main/resources/static/pages/base/stationroute/js/stationroute-list-function.js
| @@ -25,6 +25,7 @@ | @@ -25,6 +25,7 @@ | ||
| 25 | */ | 25 | */ |
| 26 | 26 | ||
| 27 | var PublicFunctions = function () { | 27 | var PublicFunctions = function () { |
| 28 | + var mapData = {}; | ||
| 28 | var PubFun = { | 29 | var PubFun = { |
| 29 | /** 初始化线路标题与ID */ | 30 | /** 初始化线路标题与ID */ |
| 30 | setTiteText : function(lineId) { | 31 | setTiteText : function(lineId) { |
| @@ -55,12 +56,131 @@ var PublicFunctions = function () { | @@ -55,12 +56,131 @@ var PublicFunctions = function () { | ||
| 55 | // 返回Obj | 56 | // 返回Obj |
| 56 | return array; | 57 | return array; |
| 57 | }, | 58 | }, |
| 59 | + startOrEndPoint: function(points, carpark) { | ||
| 60 | + var harr = new Array, i = 0; | ||
| 61 | + for (i = 0;i < points.length;i++) { | ||
| 62 | + harr.push('<option value="', points[i].stationCode, '_station">', points[i].stationName, '</option>'); | ||
| 63 | + points[i].bdPoint = points[i].station.bJwpoints; | ||
| 64 | + points[i].bdPoints = points[i].station.bdPolygon; | ||
| 65 | + points[i].shapesType = points[i].station.shapesType; | ||
| 66 | + points[i].radius = points[i].station.radius; | ||
| 67 | + mapData[points[i].stationCode + '_station'] = points[i]; | ||
| 68 | + } | ||
| 69 | + harr.push('<option value="', carpark.parkCode, '_park">', carpark.parkName, '</option>'); | ||
| 70 | + carpark.bdPoint = carpark.bCenterPoint; | ||
| 71 | + carpark.bdPoints = carpark.bParkPoint; | ||
| 72 | + carpark.stationName = carpark.parkName; | ||
| 73 | + mapData[carpark.parkCode + '_park'] = carpark; | ||
| 74 | + | ||
| 75 | + return harr.join(''); | ||
| 76 | + }, | ||
| 58 | /** @param id:线路ID ;directionData:方向 */ | 77 | /** @param id:线路ID ;directionData:方向 */ |
| 59 | resjtreeDate : function(id,directionData,version){ | 78 | resjtreeDate : function(id,directionData,version){ |
| 60 | 79 | ||
| 61 | if(!version){ | 80 | if(!version){ |
| 62 | version = $("#versions").val(); | 81 | version = $("#versions").val(); |
| 63 | } | 82 | } |
| 83 | + | ||
| 84 | + var status = $($("#versions").find("option:selected")[0]).attr("status"); | ||
| 85 | + if (directionData == 3) { | ||
| 86 | + // 隐藏上行规划 | ||
| 87 | + $('#upToolsMobal').hide(); | ||
| 88 | + // 隐藏上行树 | ||
| 89 | + $('#uptreeMobal').hide(); | ||
| 90 | + // 隐藏下行规划 | ||
| 91 | + $('#downToolsMobal').hide(); | ||
| 92 | + // 隐藏下行树 | ||
| 93 | + $('#DowntreeMobal').hide(); | ||
| 94 | + // | ||
| 95 | + $('#InoutCarparktreeMobal .table-toolbar').hide(); | ||
| 96 | + | ||
| 97 | + GetAjaxData.getStartEndByLine(id, version, function (result) { | ||
| 98 | + if (result.data) { | ||
| 99 | + $('#InoutCarparktreeMobal').show(); | ||
| 100 | + var formHtml = template('inout-carpark-search-form'); | ||
| 101 | + $('.inout-search').html(formHtml); | ||
| 102 | + | ||
| 103 | + $('#startPoint').html(PubFun.startOrEndPoint(result.data.start, result.data.carpark)); | ||
| 104 | + $('#endPoint').html(PubFun.startOrEndPoint(result.data.end, result.data.carpark)); | ||
| 105 | + $('#startPoint').on('change', function () { | ||
| 106 | + $('#InoutCarparktreeMobal .table-toolbar').hide(); | ||
| 107 | + }); | ||
| 108 | + $('#endPoint').on('change', function () { | ||
| 109 | + $('#InoutCarparktreeMobal .table-toolbar').hide(); | ||
| 110 | + }); | ||
| 111 | + $('#inoutSearch').on('click', function () { | ||
| 112 | + var start = $('#startPoint').val().split('_'), end = $('#endPoint').val().split('_'); | ||
| 113 | + if (start[1] == end[1]) { | ||
| 114 | + layer.msg('进出场的站点不可能同时为站点或停车场'); | ||
| 115 | + return; | ||
| 116 | + } | ||
| 117 | + | ||
| 118 | + $('#inout_carpark_tree').show(); | ||
| 119 | + $('#InoutCarparktreeMobal .table-toolbar').show(); | ||
| 120 | + | ||
| 121 | + GetAjaxData.getRouteByStartEnd(id, version, start[0], end[0], (result1) => { | ||
| 122 | + var routes = result1.data.routes, rootNode; | ||
| 123 | + WorldsBMap.clearMarkAndOverlays(); | ||
| 124 | + var startPoint = mapData[start.join('_')], endPoint = mapData[end.join('_')], point, points; | ||
| 125 | + if (startPoint.shapesType === 'r') { | ||
| 126 | + point = startPoint.bdPoint.split(' '); | ||
| 127 | + WorldsBMap.drawCircle({lng : point[0], lat : point[1]}, startPoint.radius, startPoint.stationName, true); | ||
| 128 | + } else if (startPoint.shapesType === 'd') { | ||
| 129 | + points = startPoint.bdPoints; | ||
| 130 | + points = points.replace('POLYGON ((', '').replace('POLYGON((', '').replaceAll(', ', ',').replace('))', ''); | ||
| 131 | + points = points.split(',') | ||
| 132 | + WorldsBMap.drawPolygon(points, startPoint.stationName, true); | ||
| 133 | + } | ||
| 134 | + | ||
| 135 | + if (endPoint.shapesType === 'r') { | ||
| 136 | + point = endPoint.bdPoint.split(' '); | ||
| 137 | + WorldsBMap.drawCircle({lng : point[0], lat : point[1]}, endPoint.radius, endPoint.stationName, true); | ||
| 138 | + } else if (endPoint.shapesType === 'd') { | ||
| 139 | + points = endPoint.bdPoints; | ||
| 140 | + points = points.replace('POLYGON ((', '').replace('POLYGON((', '').replaceAll(', ', ',').replace('))', ''); | ||
| 141 | + points = points.split(',') | ||
| 142 | + WorldsBMap.drawPolygon(points, endPoint.stationName, true); | ||
| 143 | + } | ||
| 144 | + | ||
| 145 | + rootNode = {id: -1, pId: null, name: '路段', text: '路段', icon: null, groupType: 2, container : 'pjax-container', enable : true, children: routes}; | ||
| 146 | + if (routes.length > 0) { | ||
| 147 | + for (let i = 0,route;i < routes.length;i++) { | ||
| 148 | + route = routes[i]; | ||
| 149 | + route.pId = 1; | ||
| 150 | + route.name = route.section.sectionName; | ||
| 151 | + route.text = route.section.sectionName; | ||
| 152 | + route.icon = null; | ||
| 153 | + route.groupType = 3; | ||
| 154 | + route.chaildredType = 'section'; | ||
| 155 | + route.enable = true; | ||
| 156 | + route.lineId = id; | ||
| 157 | + route.lineCode = id; | ||
| 158 | + route.versions = version; | ||
| 159 | + route.dir = 3; | ||
| 160 | + route.start = start[0]; | ||
| 161 | + route.end = end[0]; | ||
| 162 | + route.sectionrouteId = route.id; | ||
| 163 | + route.sectionName = route.section.sectionName; | ||
| 164 | + route.sectionBsectionVector = route.section.bsectionVector; | ||
| 165 | + points = route.section.bsectionVector.replace('LINESTRING(', '').replace(')', ''); | ||
| 166 | + points = points.split(','); | ||
| 167 | + WorldsBMap.drawPolyLine(points, route, start[0], end[0]); | ||
| 168 | + } | ||
| 169 | + } else { | ||
| 170 | + rootNode.children = [{id: 0, pId: -1, name: '添加路段', text: '添加路段', lineId: id, lineCode: id, versions: version, dir: 3, start: start[0], end: end[0], icon: null, groupType: 3, container : 'pjax-container', enable : true, chaildredType: status > 0 ? 'addSection' : '', sectionBsectionVector: 'LINESTRING(' + startPoint.bdPoint + ')'}]; | ||
| 171 | + } | ||
| 172 | + StationTreeData.inoutInit([rootNode]); | ||
| 173 | + StationTreeData.inoutreloadeTree([rootNode]); | ||
| 174 | + }); | ||
| 175 | + }); | ||
| 176 | + } else { | ||
| 177 | + layer.msg(result.msg); | ||
| 178 | + } | ||
| 179 | + }); | ||
| 180 | + } else { | ||
| 181 | + $('#InoutCarparktreeMobal').hide(); | ||
| 182 | + $('#inout_carpark_tree').hide(); | ||
| 183 | + } | ||
| 64 | 184 | ||
| 65 | // 获取树数据 | 185 | // 获取树数据 |
| 66 | GetAjaxData.getStation(id,directionData,version,function(treeDateJson) { | 186 | GetAjaxData.getStation(id,directionData,version,function(treeDateJson) { |
| @@ -77,7 +197,7 @@ var PublicFunctions = function () { | @@ -77,7 +197,7 @@ var PublicFunctions = function () { | ||
| 77 | // 刷新树 | 197 | // 刷新树 |
| 78 | StationTreeData.upreloadeTree(treeDateJson); | 198 | StationTreeData.upreloadeTree(treeDateJson); |
| 79 | }else { | 199 | }else { |
| 80 | - if ($($("#versions").find("option:selected")[0]).attr("status") > 0) { | 200 | + if (status > 0) { |
| 81 | // 显示上行规划 | 201 | // 显示上行规划 |
| 82 | $('#upToolsMobal').show(); | 202 | $('#upToolsMobal').show(); |
| 83 | }else{ | 203 | }else{ |
| @@ -99,7 +219,7 @@ var PublicFunctions = function () { | @@ -99,7 +219,7 @@ var PublicFunctions = function () { | ||
| 99 | // 跟新树 | 219 | // 跟新树 |
| 100 | StationTreeData.dwonreloadeTree(treeDateJson); | 220 | StationTreeData.dwonreloadeTree(treeDateJson); |
| 101 | }else { | 221 | }else { |
| 102 | - if ($($("#versions").find("option:selected")[0]).attr("status") > 0) { | 222 | + if (status > 0) { |
| 103 | // 显示下行规划 | 223 | // 显示下行规划 |
| 104 | $('#downToolsMobal').show(); | 224 | $('#downToolsMobal').show(); |
| 105 | }else{ | 225 | }else{ |
| @@ -461,6 +581,7 @@ var PublicFunctions = function () { | @@ -461,6 +581,7 @@ var PublicFunctions = function () { | ||
| 461 | /** 在地图上画出线路走向 @param:<Line.id:线路Id;0:上行;data:路段数据> */ | 581 | /** 在地图上画出线路走向 @param:<Line.id:线路Id;0:上行;data:路段数据> */ |
| 462 | linePanlThree : function(lineId,data,direction,version,callback) { | 582 | linePanlThree : function(lineId,data,direction,version,callback) { |
| 463 | /** 获取站点路由信息 @param:<Line.id:线路Id;0:上行> @return:<resultdata:站点路由数据> */ | 583 | /** 获取站点路由信息 @param:<Line.id:线路Id;0:上行> @return:<resultdata:站点路由数据> */ |
| 584 | + debugger | ||
| 464 | var polyline_center; | 585 | var polyline_center; |
| 465 | GetAjaxData.getStationRoutePoint(lineId,direction,version,function(resultdata) { | 586 | GetAjaxData.getStationRoutePoint(lineId,direction,version,function(resultdata) { |
| 466 | WorldsBMap.clearMarkAndOverlays(); | 587 | WorldsBMap.clearMarkAndOverlays(); |
| @@ -536,6 +657,7 @@ var PublicFunctions = function () { | @@ -536,6 +657,7 @@ var PublicFunctions = function () { | ||
| 536 | }, | 657 | }, |
| 537 | // 地图处于编辑状态 | 658 | // 地图处于编辑状态 |
| 538 | editMapStatus : function (dir) { | 659 | editMapStatus : function (dir) { |
| 660 | + debugger | ||
| 539 | WorldsBMap.setMap_status(1); | 661 | WorldsBMap.setMap_status(1); |
| 540 | // 有方向就显示退出编辑模式按钮 | 662 | // 有方向就显示退出编辑模式按钮 |
| 541 | if(dir!=null && dir!='null'){ | 663 | if(dir!=null && dir!='null'){ |
src/main/resources/static/pages/base/stationroute/js/stationroute-list-map.js
| @@ -31,6 +31,8 @@ window.WorldsBMap = function () { | @@ -31,6 +31,8 @@ window.WorldsBMap = function () { | ||
| 31 | sectionArray = [], stationArray = new Map(), | 31 | sectionArray = [], stationArray = new Map(), |
| 32 | map_status = 0,drawingManager,topOverlay; | 32 | map_status = 0,drawingManager,topOverlay; |
| 33 | 33 | ||
| 34 | + let currentSection = {}; | ||
| 35 | + | ||
| 34 | /** | 36 | /** |
| 35 | * 编辑缓冲区 | 37 | * 编辑缓冲区 |
| 36 | * stationMarkers: 站点图标集合 | 38 | * stationMarkers: 站点图标集合 |
| @@ -533,7 +535,7 @@ window.WorldsBMap = function () { | @@ -533,7 +535,7 @@ window.WorldsBMap = function () { | ||
| 533 | }, | 535 | }, |
| 534 | 536 | ||
| 535 | /** 在地图上画点 @param:<point_center:中心坐标点> */ | 537 | /** 在地图上画点 @param:<point_center:中心坐标点> */ |
| 536 | - drawingUpStationPoint: function (station, s) { | 538 | + drawingUpStationPoint: function (station, s, isView) { |
| 537 | // 中心点坐标字符串 | 539 | // 中心点坐标字符串 |
| 538 | var bJwpointsStr = station.stationJwpoints; | 540 | var bJwpointsStr = station.stationJwpoints; |
| 539 | var stationName = station.stationRouteName; | 541 | var stationName = station.stationRouteName; |
| @@ -558,7 +560,7 @@ window.WorldsBMap = function () { | @@ -558,7 +560,7 @@ window.WorldsBMap = function () { | ||
| 558 | myRichMarker1.ct_source = '1'; | 560 | myRichMarker1.ct_source = '1'; |
| 559 | mapBValue.addOverlay(myRichMarker1); | 561 | mapBValue.addOverlay(myRichMarker1); |
| 560 | myRichMarker1.addEventListener('click', function () { | 562 | myRichMarker1.addEventListener('click', function () { |
| 561 | - if(map_status != 1) | 563 | + if(map_status != 1 && !isView) |
| 562 | WorldsBMap.openStationInfoWin(station); | 564 | WorldsBMap.openStationInfoWin(station); |
| 563 | }); | 565 | }); |
| 564 | stationArray[station.stationRouteId] = station; | 566 | stationArray[station.stationRouteId] = station; |
| @@ -922,8 +924,15 @@ window.WorldsBMap = function () { | @@ -922,8 +924,15 @@ window.WorldsBMap = function () { | ||
| 922 | focusSection: function(sectionRoudId) { | 924 | focusSection: function(sectionRoudId) { |
| 923 | for (var i = 0, p; p = sectionArray[i++];) { | 925 | for (var i = 0, p; p = sectionArray[i++];) { |
| 924 | if (p.data.sectionrouteId == sectionRoudId) { | 926 | if (p.data.sectionrouteId == sectionRoudId) { |
| 925 | - WorldsBMap.openSectionInfoWin(p); | ||
| 926 | - break; | 927 | + switch (p.data.dir) { |
| 928 | + case 3: | ||
| 929 | + WorldsBMap.openSectionInfoWin_inout(p); | ||
| 930 | + break; | ||
| 931 | + default: | ||
| 932 | + WorldsBMap.openSectionInfoWin(p); | ||
| 933 | + break; | ||
| 934 | + } | ||
| 935 | + | ||
| 927 | } | 936 | } |
| 928 | } | 937 | } |
| 929 | }, | 938 | }, |
| @@ -1026,23 +1035,44 @@ window.WorldsBMap = function () { | @@ -1026,23 +1035,44 @@ window.WorldsBMap = function () { | ||
| 1026 | params.destroy = 0; | 1035 | params.destroy = 0; |
| 1027 | params.directions = dir; | 1036 | params.directions = dir; |
| 1028 | params.descriptions = ''; | 1037 | params.descriptions = ''; |
| 1038 | + params.start = stecion.start; | ||
| 1039 | + params.end = stecion.end; | ||
| 1029 | 1040 | ||
| 1030 | params.status=$($("#versions").find("option:selected")[0]).attr("status"); | 1041 | params.status=$($("#versions").find("option:selected")[0]).attr("status"); |
| 1031 | - GetAjaxData.sectionSave(params, function (result) { | ||
| 1032 | - if(result.status =="SUCCESS"){ | ||
| 1033 | - $('.main_left_panel_m_layer').hide(); | ||
| 1034 | - $(btn).parents('.buffer_edit_body').parent().remove(); | ||
| 1035 | - PublicFunctions.editMapStatusRemove(); | ||
| 1036 | - PublicFunctions.resjtreeDate(lineId,dir,$("#versions").val()); | ||
| 1037 | - PublicFunctions.editAChangeCssRemoveDisabled(); | 1042 | + if (dir == 3) { |
| 1043 | + GetAjaxData.inoutSectionSave(params, function (result) { | ||
| 1044 | + if(result.status =="SUCCESS"){ | ||
| 1045 | + $('.main_left_panel_m_layer').hide(); | ||
| 1046 | + $(btn).parents('.buffer_edit_body').parent().remove(); | ||
| 1047 | + PublicFunctions.editMapStatusRemove(); | ||
| 1048 | + //PublicFunctions.resjtreeDate(lineId,dir,$("#versions").val()); | ||
| 1049 | + $('#inoutSearch').click(); | ||
| 1050 | + PublicFunctions.editAChangeCssRemoveDisabled(); | ||
| 1038 | // GetAjaxData.getSectionRouteInfo(lineId,dir,function(data) { | 1051 | // GetAjaxData.getSectionRouteInfo(lineId,dir,function(data) { |
| 1039 | // PublicFunctions.linePanlThree(lineId,data,dir); | 1052 | // PublicFunctions.linePanlThree(lineId,data,dir); |
| 1040 | // }); | 1053 | // }); |
| 1041 | - layer.msg("添加成功!"); | ||
| 1042 | - } else if(result.status =="ERROR") { | ||
| 1043 | - layer.msg("添加失败!"); | ||
| 1044 | - } | ||
| 1045 | - }); | 1054 | + layer.msg("添加成功!"); |
| 1055 | + } else if(result.status =="ERROR") { | ||
| 1056 | + layer.msg("添加失败!"); | ||
| 1057 | + } | ||
| 1058 | + }); | ||
| 1059 | + } else { | ||
| 1060 | + GetAjaxData.sectionSave(params, function (result) { | ||
| 1061 | + if(result.status =="SUCCESS"){ | ||
| 1062 | + $('.main_left_panel_m_layer').hide(); | ||
| 1063 | + $(btn).parents('.buffer_edit_body').parent().remove(); | ||
| 1064 | + PublicFunctions.editMapStatusRemove(); | ||
| 1065 | + PublicFunctions.resjtreeDate(lineId,dir,$("#versions").val()); | ||
| 1066 | + PublicFunctions.editAChangeCssRemoveDisabled(); | ||
| 1067 | +// GetAjaxData.getSectionRouteInfo(lineId,dir,function(data) { | ||
| 1068 | +// PublicFunctions.linePanlThree(lineId,data,dir); | ||
| 1069 | +// }); | ||
| 1070 | + layer.msg("添加成功!"); | ||
| 1071 | + } else if(result.status =="ERROR") { | ||
| 1072 | + layer.msg("添加失败!"); | ||
| 1073 | + } | ||
| 1074 | + }); | ||
| 1075 | + } | ||
| 1046 | }); | 1076 | }); |
| 1047 | } else if(!sectionName){ | 1077 | } else if(!sectionName){ |
| 1048 | layer.msg('请填写路段名字!'); | 1078 | layer.msg('请填写路段名字!'); |
| @@ -1322,6 +1352,7 @@ window.WorldsBMap = function () { | @@ -1322,6 +1352,7 @@ window.WorldsBMap = function () { | ||
| 1322 | // 清楚地图覆盖物 | 1352 | // 清楚地图覆盖物 |
| 1323 | mapBValue.clearOverlays(); | 1353 | mapBValue.clearOverlays(); |
| 1324 | mapBValue.removeOverlay(); | 1354 | mapBValue.removeOverlay(); |
| 1355 | + sectionArray = []; | ||
| 1325 | }, | 1356 | }, |
| 1326 | clearMark: function () { | 1357 | clearMark: function () { |
| 1327 | // 清楚地图覆盖物 | 1358 | // 清楚地图覆盖物 |
| @@ -1458,6 +1489,338 @@ window.WorldsBMap = function () { | @@ -1458,6 +1489,338 @@ window.WorldsBMap = function () { | ||
| 1458 | })(); | 1489 | })(); |
| 1459 | 1490 | ||
| 1460 | }, | 1491 | }, |
| 1492 | + | ||
| 1493 | + /** | ||
| 1494 | + * 画圆 | ||
| 1495 | + * point(lng,lat) 中心点 | ||
| 1496 | + * radius 半径(m) | ||
| 1497 | + * isMark 是否加站名 | ||
| 1498 | + */ | ||
| 1499 | + drawCircle: function (point, radius, stationName, isMark) { | ||
| 1500 | + let center = new BMap.Point(point.lng, point.lat); | ||
| 1501 | + let circle = new BMap.Circle(center, radius ,{strokeColor:"blue", strokeWeight:2, strokeOpacity:0.5}); | ||
| 1502 | + mapBValue.addOverlay(circle); | ||
| 1503 | + if (isMark) { | ||
| 1504 | + let html = '<div style="position: absolute; margin: 0pt; padding: 0pt; width: 160px; height: 26px; left: -3px; top: -30px; overflow: hidden;">' | ||
| 1505 | + + '<img class="rm3_image" style="border:none;left:0px; top:0px; position:absolute;" src="/pages/base/stationroute/css/img/back160.png">' | ||
| 1506 | + + '</div>' | ||
| 1507 | + + '<label class=" BMapLabel" unselectable="on" style="position: absolute; -moz-user-select: none; display: inline; cursor: inherit; border: 0px none; padding: 2px 1px 1px; white-space: nowrap; font: 12px arial,simsun; z-index: 80; color: rgb(255, 102, 0); left: 20px; top: -30px;">' + stationName + '</label>'; | ||
| 1508 | + | ||
| 1509 | + let myRichMarker = new BMapLib.RichMarker(html, center, { | ||
| 1510 | + "title": stationName, | ||
| 1511 | + "anchor": new BMap.Size(-10, 8), | ||
| 1512 | + "enableDragging": true | ||
| 1513 | + }); | ||
| 1514 | + myRichMarker.disableDragging(); | ||
| 1515 | + myRichMarker.ct_source = '1'; | ||
| 1516 | + mapBValue.addOverlay(myRichMarker); | ||
| 1517 | + } | ||
| 1518 | + }, | ||
| 1519 | + | ||
| 1520 | + /** | ||
| 1521 | + * 画多边形 | ||
| 1522 | + * points 点数组 | ||
| 1523 | + */ | ||
| 1524 | + drawPolygon: function (points, stationName, isMark) { | ||
| 1525 | + let bdPoints = new Array(), i = 0, point; | ||
| 1526 | + for (i = 0;i < points.length;i++) { | ||
| 1527 | + point = points[i].split(' '); | ||
| 1528 | + bdPoints.push(new BMap.Point(point[0], point[1])); | ||
| 1529 | + } | ||
| 1530 | + let polygon = new BMap.Polygon(bdPoints), center = bdPoints[0]; | ||
| 1531 | + mapBValue.addOverlay(polygon); | ||
| 1532 | + if (isMark) { | ||
| 1533 | + let html = '<div style="position: absolute; margin: 0pt; padding: 0pt; width: 160px; height: 26px; left: -3px; top: -30px; overflow: hidden;">' | ||
| 1534 | + + '<img class="rm3_image" style="border:none;left:0px; top:0px; position:absolute;" src="/pages/base/stationroute/css/img/back160.png">' | ||
| 1535 | + + '</div>' | ||
| 1536 | + + '<label class=" BMapLabel" unselectable="on" style="position: absolute; -moz-user-select: none; display: inline; cursor: inherit; border: 0px none; padding: 2px 1px 1px; white-space: nowrap; font: 12px arial,simsun; z-index: 80; color: rgb(255, 102, 0); left: 20px; top: -30px;">' + stationName + '</label>'; | ||
| 1537 | + | ||
| 1538 | + let myRichMarker = new BMapLib.RichMarker(html, center, { | ||
| 1539 | + "title": stationName, | ||
| 1540 | + "anchor": new BMap.Size(-10, 8), | ||
| 1541 | + "enableDragging": true | ||
| 1542 | + }); | ||
| 1543 | + myRichMarker.disableDragging(); | ||
| 1544 | + myRichMarker.ct_source = '1'; | ||
| 1545 | + mapBValue.addOverlay(myRichMarker); | ||
| 1546 | + } | ||
| 1547 | + }, | ||
| 1548 | + | ||
| 1549 | + drawPolyLine: function (points, data, start, end) { | ||
| 1550 | + debugger | ||
| 1551 | + let bdPoints = new Array(), i = 0, point, polyline; | ||
| 1552 | + for (i = 0;i < points.length;i++) { | ||
| 1553 | + point = points[i].split(' '); | ||
| 1554 | + bdPoints.push(new BMap.Point(point[0], point[1])); | ||
| 1555 | + } | ||
| 1556 | + // 创建线路走向 | ||
| 1557 | + polyline = new BMap.Polyline(bdPoints, { | ||
| 1558 | + strokeColor: 'red', | ||
| 1559 | + strokeWeight: 6, | ||
| 1560 | + strokeOpacity: 0.7 | ||
| 1561 | + }); | ||
| 1562 | + | ||
| 1563 | + polyline.data = data; | ||
| 1564 | + polyline.start = start; | ||
| 1565 | + polyline.end = end; | ||
| 1566 | + polyline.ct_source = '1'; | ||
| 1567 | + // 把折线添加到地图上 | ||
| 1568 | + mapBValue.addOverlay(polyline); | ||
| 1569 | + // 聚焦事件 | ||
| 1570 | + polyline.addEventListener('mousemove', function (e) { | ||
| 1571 | + if (this != editPolyline) | ||
| 1572 | + this.setStrokeColor("#20bd26"); | ||
| 1573 | + }); | ||
| 1574 | + // 失去焦点 | ||
| 1575 | + polyline.addEventListener('mouseout', function (e) { | ||
| 1576 | + if (this != editPolyline && this != road_win_show_p) | ||
| 1577 | + this.setStrokeColor("red"); | ||
| 1578 | + }); | ||
| 1579 | + // 添加单击事件 | ||
| 1580 | + polyline.addEventListener('onclick', function (e) { | ||
| 1581 | + // 打开信息窗口 | ||
| 1582 | + if (map_status != 1) | ||
| 1583 | + WorldsBMap.openSectionInfoWin_inout(this); | ||
| 1584 | + }); | ||
| 1585 | + // 添加右击事件 | ||
| 1586 | + polyline.addEventListener('rightclick', function (e) { | ||
| 1587 | + if (currentSection.enableEditing) { | ||
| 1588 | + this.disableEditing(); | ||
| 1589 | + WorldsBMap.saveSection_inout(this); | ||
| 1590 | + } | ||
| 1591 | + }); | ||
| 1592 | + sectionArray.push(polyline); | ||
| 1593 | + }, | ||
| 1594 | + | ||
| 1595 | + // 打开路段信息窗口 | ||
| 1596 | + openSectionInfoWin_inout: function(p) { | ||
| 1597 | + var section = p.data; | ||
| 1598 | + var dir = section.sectionrouteDirections; | ||
| 1599 | + var width = WorldsBMap.strGetLength(section.sectionName) * 10; | ||
| 1600 | + // 信息窗口参数属性 | ||
| 1601 | + var opts = { | ||
| 1602 | + // 信息窗口宽度 | ||
| 1603 | + width: (width < 200 ? 200 : width), | ||
| 1604 | + // 信息窗口高度 | ||
| 1605 | + height: 150, | ||
| 1606 | + //设置不允许信窗发送短息 | ||
| 1607 | + enableMessage: false, | ||
| 1608 | + //是否开启点击地图关闭信息窗口 | ||
| 1609 | + enableCloseOnClick: false, | ||
| 1610 | + // 是否开启信息窗口打开时地图自动移动(默认开启)。(自 1.1 新增) | ||
| 1611 | + enableAutoPan: false | ||
| 1612 | + }; | ||
| 1613 | + var htm = '<span style="color: #ff8355;font-size: 18px;">' + section.sectionName + '</span>' + | ||
| 1614 | + '<span class="help-block" >路段编码:' + section.sectionCode + '</span>' + | ||
| 1615 | + '<span class="help-block" >路段序号:' + section.sectionrouteCode + '</span>' + | ||
| 1616 | + '<span class="help-block" >版本号  :' + section.versions + '</span>' + | ||
| 1617 | + '<div >'; | ||
| 1618 | + | ||
| 1619 | + if($($("#versions").find("option:selected")[0]).attr("status") > 0){ | ||
| 1620 | + htm += '<button class="info_win_btn" id="editStation" onclick="WorldsBMap.editSection_inout(' + section.sectionrouteId +','+dir+ ')">修改</button>' + | ||
| 1621 | + '<button class="info_win_btn" id="addBetweenStationRoad" onclick="WorldsBMap.destroySection_inout('+ section.sectionrouteId + ','+section.sectionrouteLine+','+section.sectionrouteDirections+')">撤销</button>' + | ||
| 1622 | + '<button class="info_win_btn" id="addSectionAfter" onclick="WorldsBMap.addSectionAfter_inout('+section.sectionrouteId+')">添加路段(之后)</button>' + | ||
| 1623 | + '</div>'; | ||
| 1624 | + } | ||
| 1625 | + | ||
| 1626 | + // 创建信息窗口 | ||
| 1627 | + var infoWindow_target = new BMap.InfoWindow(htm, opts); | ||
| 1628 | + // 切割段折线坐标字符串 | ||
| 1629 | + var sectionStr = section.sectionBsectionVector.substring(11, section.sectionBsectionVector.length - 1); | ||
| 1630 | + // 分割折线坐标字符串 | ||
| 1631 | + var lineArray = sectionStr.split(','); | ||
| 1632 | + var sectionArray = []; | ||
| 1633 | + for (var i = 0; i < lineArray.length; i++) { | ||
| 1634 | + sectionArray.push(new BMap.Point(lineArray[i].split(' ')[0], lineArray[i].split(' ')[1])); | ||
| 1635 | + } | ||
| 1636 | + // 计算中间点 | ||
| 1637 | + var index = parseInt(sectionArray.length / 2); | ||
| 1638 | + var centerPoint = sectionArray[index]; | ||
| 1639 | + //close event | ||
| 1640 | + infoWindow_target.addEventListener('close', function (e) { | ||
| 1641 | + p.setStrokeColor("red"); | ||
| 1642 | + road_win_show_p = null; | ||
| 1643 | + }); | ||
| 1644 | + //open event | ||
| 1645 | + infoWindow_target.addEventListener('open', function (e) { | ||
| 1646 | + p.setStrokeColor("#20bd26"); | ||
| 1647 | + road_win_show_p = p; | ||
| 1648 | + }); | ||
| 1649 | + //开启信息窗口 | ||
| 1650 | + mapBValue.openInfoWindow(infoWindow_target, centerPoint); | ||
| 1651 | + mapBValue.panTo(centerPoint); | ||
| 1652 | + }, | ||
| 1653 | + | ||
| 1654 | + /** | ||
| 1655 | + * 进出场路段设置为编辑状态 | ||
| 1656 | + */ | ||
| 1657 | + editSection_inout: function(sectionRoudId) { | ||
| 1658 | + layer.confirm('进入编辑状态', { | ||
| 1659 | + btn : [ '确定','返回' ], icon: 3, title:'提示' | ||
| 1660 | + }, function() { | ||
| 1661 | + PublicFunctions.editMapStatus(dir); | ||
| 1662 | + layer.msg('双击保存路段'); | ||
| 1663 | + var p; | ||
| 1664 | + for (var i = 0; p = sectionArray[i++];) { | ||
| 1665 | + if (p.data.sectionrouteId == sectionRoudId) { | ||
| 1666 | + mapBValue.closeInfoWindow();//关闭infoWindow | ||
| 1667 | + p.enableEditing(); | ||
| 1668 | + p.setStrokeColor('blue'); | ||
| 1669 | + editPolyline = p; | ||
| 1670 | + break; | ||
| 1671 | + } | ||
| 1672 | + } | ||
| 1673 | + // 路段中间点为中心 | ||
| 1674 | + var section = p.data; | ||
| 1675 | + var sectionStr = section.sectionBsectionVector.substring(11, section.sectionBsectionVector.length - 1); | ||
| 1676 | + // 分割折线坐标字符串 | ||
| 1677 | + var lineArray = sectionStr.split(','); | ||
| 1678 | + var sectionPointArray = []; | ||
| 1679 | + for (var i = 0; i < lineArray.length; i++) { | ||
| 1680 | + sectionPointArray.push(new BMap.Point(lineArray[i].split(' ')[0], lineArray[i].split(' ')[1])); | ||
| 1681 | + } | ||
| 1682 | + // 计算中间点 | ||
| 1683 | + var index = parseInt(sectionPointArray.length / 2); | ||
| 1684 | + var centerPoint = sectionPointArray[index]; | ||
| 1685 | + mapBValue.centerAndZoom(centerPoint, 17); | ||
| 1686 | + // var c = p.ia[Math.floor(p.ia.length/2)]; | ||
| 1687 | + // mapBValue.centerAndZoom(new BMap.Point(c.lng, c.lat), 18); | ||
| 1688 | + p.addEventListener('dblclick', function () { | ||
| 1689 | + /** 设置修改路段集合对象为空 */ | ||
| 1690 | + editPolyline = ''; | ||
| 1691 | + PublicFunctions.editMapStatusRemove(); | ||
| 1692 | + $.get('editsection_inout.html', function(m){ | ||
| 1693 | + $('body').append(m); | ||
| 1694 | + $('#edit_section_mobal').trigger('editSectionMobal_show', [WorldsBMap,GetAjaxData,p,PublicFunctions]); | ||
| 1695 | + }); | ||
| 1696 | + }); | ||
| 1697 | + }); | ||
| 1698 | + }, | ||
| 1699 | + | ||
| 1700 | + // 撤销路段 | ||
| 1701 | + destroySection_inout : function(sectionRoudId) { | ||
| 1702 | + layer.confirm('你确定要撤销此路段吗?', { | ||
| 1703 | + btn : [ '撤销','返回' ], icon: 3, title:'提示' | ||
| 1704 | + }, function(){ | ||
| 1705 | + var status = $($("#versions").find("option:selected")[0]).attr("status"); | ||
| 1706 | + $.post('/inout/destroy',{'id': sectionRoudId,status:status},function(resuntDate) { | ||
| 1707 | + if (resuntDate.status == 'SUCCESS') { | ||
| 1708 | + // 弹出添加成功提示消息 | ||
| 1709 | + layer.msg('撤销成功!'); | ||
| 1710 | + } else { | ||
| 1711 | + // 弹出添加失败提示消息 | ||
| 1712 | + layer.msg('撤销失败!'); | ||
| 1713 | + } | ||
| 1714 | + // 刷新左边树 | ||
| 1715 | + $('#inoutSearch').click(); | ||
| 1716 | + /** 查询路段信息 @param:<Line.id:线路Id;delBatch.dir:方向> @return:data:路段数据 */ | ||
| 1717 | +// GetAjaxData.getSectionRouteInfo(lineId,dir,function(data) { | ||
| 1718 | +// /** 在地图上画出线路走向 @param:<Line.id:线路Id;delBatch.dir:方向;data:路段数据> */ | ||
| 1719 | +// PublicFunctions.linePanlThree(lineId,data,dir); | ||
| 1720 | +// }); | ||
| 1721 | + }); | ||
| 1722 | + }); | ||
| 1723 | + }, | ||
| 1724 | + | ||
| 1725 | + // 添加在路段之后 | ||
| 1726 | + addSectionAfter_inout : function(sectionRoudId) { | ||
| 1727 | + //order = after before; | ||
| 1728 | + var beforeSection; | ||
| 1729 | + // 关闭信息窗口 | ||
| 1730 | + mapBValue.closeInfoWindow(); | ||
| 1731 | + PublicFunctions.editMapStatus(); | ||
| 1732 | + // 把数据填充到模版中 | ||
| 1733 | + var addSectionHTML = template('add_draw_polyline-temp',{ 'id': sectionRoudId}); | ||
| 1734 | + $('body .mian-portlet-body').append(addSectionHTML); | ||
| 1735 | + //暂停和开始绘制 | ||
| 1736 | + $('.draw_polyline_switch>a').on('click', function () { | ||
| 1737 | + var t = $(this).text(); | ||
| 1738 | + if(t=='暂停绘制'){ | ||
| 1739 | + WorldsBMap.exitDrawStatus(); | ||
| 1740 | + $(this).text('开始绘制'); | ||
| 1741 | + } | ||
| 1742 | + else{ | ||
| 1743 | + WorldsBMap.openDrawStatus(); | ||
| 1744 | + $(this).text('暂停绘制'); | ||
| 1745 | + } | ||
| 1746 | + }); | ||
| 1747 | + | ||
| 1748 | + //取消 | ||
| 1749 | + $('#addSectionCancelBtn').on('click', function () { | ||
| 1750 | + $('.main_left_panel_m_layer').hide(); | ||
| 1751 | + $(this).parents('.buffer_edit_body').parent().remove(); | ||
| 1752 | + WorldsBMap.exitDrawStatus(); | ||
| 1753 | + PublicFunctions.editMapStatusRemove(); | ||
| 1754 | + }); | ||
| 1755 | + GetAjaxData.getRouteInfoById(sectionRoudId, function(data){ | ||
| 1756 | + beforeSection = data; | ||
| 1757 | + beforeSection.sectionBsectionVector = beforeSection.section.bsectionVector; | ||
| 1758 | + WorldsBMap.showAddSectionPanel(beforeSection); | ||
| 1759 | + }); | ||
| 1760 | + | ||
| 1761 | + //确定 | ||
| 1762 | + $('#addSectionSbmintBtn').on('click', function () { | ||
| 1763 | + var btn = this; | ||
| 1764 | + $('#addSectionSbmintBtn').addClass("disabled"); | ||
| 1765 | + var sectionName = $('#sectionNameInput').val(); | ||
| 1766 | + var bsectionVector = $('#bsectionVectorInput').val(); | ||
| 1767 | + var params = {}; | ||
| 1768 | + if(sectionName && bsectionVector) { | ||
| 1769 | + WorldsBMap.exitDrawStatus(); | ||
| 1770 | + GetAjaxData.getSectionCode(function(sectionCode) { | ||
| 1771 | + params.lineId = beforeSection.line.id; | ||
| 1772 | + params.lineCode = beforeSection.lineCode; | ||
| 1773 | + params.sectionCode = sectionCode;// 设值路段编码. | ||
| 1774 | + params.sectionName = sectionName; | ||
| 1775 | + params.roadCoding = ''; | ||
| 1776 | + params.dbType = 'b'; | ||
| 1777 | + params.bsectionVector = bsectionVector; | ||
| 1778 | + params.sectionrouteCode = beforeSection.sectionrouteCode+"_0"; | ||
| 1779 | + params.sectionTime = 0; | ||
| 1780 | + params.sectionDistance = 60; | ||
| 1781 | + params.speedLimit = 0; | ||
| 1782 | + params.versions = beforeSection.versions; | ||
| 1783 | + params.destroy = 0; | ||
| 1784 | + params.directions = beforeSection.directions; | ||
| 1785 | + params.descriptions = ''; | ||
| 1786 | + params.start = beforeSection.start; | ||
| 1787 | + params.end = beforeSection.end; | ||
| 1788 | + params.status=$($("#versions").find("option:selected")[0]).attr("status"); | ||
| 1789 | + | ||
| 1790 | + GetAjaxData.inoutSectionSave(params, function (result) { | ||
| 1791 | + if(result.status =="SUCCESS"){ | ||
| 1792 | + $('.main_left_panel_m_layer').hide(); | ||
| 1793 | + $(btn).parents('.buffer_edit_body').parent().remove(); | ||
| 1794 | + PublicFunctions.editMapStatusRemove(); | ||
| 1795 | + $('#inoutSearch').click(); | ||
| 1796 | + PublicFunctions.editAChangeCssRemoveDisabled(); | ||
| 1797 | +// GetAjaxData.getSectionRouteInfo(lineId,dir,function(data) { | ||
| 1798 | +// PublicFunctions.linePanlThree(lineId,data,dir); | ||
| 1799 | +// }); | ||
| 1800 | + layer.msg("添加成功!"); | ||
| 1801 | + } else if(result.status =="ERROR") { | ||
| 1802 | + layer.msg("添加失败!"); | ||
| 1803 | + } | ||
| 1804 | + }); | ||
| 1805 | + }); | ||
| 1806 | + } else if(!sectionName){ | ||
| 1807 | + layer.msg('请填写路段名字!'); | ||
| 1808 | + } else if(!bsectionVector) | ||
| 1809 | + layer.msg('请先绘制路段!'); | ||
| 1810 | + setTimeout(function () { | ||
| 1811 | + $("#addSectionSbmintBtn").removeClass("disabled"); | ||
| 1812 | + },1000); | ||
| 1813 | + }); | ||
| 1814 | + }, | ||
| 1815 | + /** | ||
| 1816 | + * 保存进出场路段 | ||
| 1817 | + */ | ||
| 1818 | + saveSection_inout: function () { | ||
| 1819 | + $.get('editsection_inout.html', function(m){ | ||
| 1820 | + $('body').append(m); | ||
| 1821 | + $('#edit_section_mobal').trigger('editSectionMobal_show', [WorldsBMap,GetAjaxData,currentSection,PublicFunctions]); | ||
| 1822 | + }); | ||
| 1823 | + }, | ||
| 1461 | }; | 1824 | }; |
| 1462 | 1825 | ||
| 1463 | return Bmap; | 1826 | return Bmap; |
src/main/resources/static/pages/base/stationroute/js/stationroute-list-reload.js
| 1 | -/** | ||
| 2 | - * reload事件 | ||
| 3 | - * | ||
| 4 | - * | ||
| 5 | - */ | ||
| 6 | - | ||
| 7 | -$(function() { | ||
| 8 | - | ||
| 9 | - // 关闭左侧栏 | ||
| 10 | - if (!$('body').hasClass('page-sidebar-closed')) { | ||
| 11 | - $('.menu-toggler.sidebar-toggler').click(); | ||
| 12 | - } | ||
| 13 | - // 获取参数线路ID | ||
| 14 | - var idAndDir = $.url().param('no'); | ||
| 15 | - var param = idAndDir.split(","); | ||
| 16 | - var dir = 0, id; | ||
| 17 | - if (param.length == 1) { | ||
| 18 | - id = param[0]; | ||
| 19 | - } else { | ||
| 20 | - id = param[0]; | ||
| 21 | - dir = param[1]; | ||
| 22 | - } | ||
| 23 | - if (dir == 1) { | ||
| 24 | - $('#stationUp').removeClass('active'); | ||
| 25 | - $('#stationUp').removeClass('in'); | ||
| 26 | - $('#stationUp').addClass('fade'); | ||
| 27 | - $('#stationDown').addClass('active in'); | ||
| 28 | - $('#upLine').parent().removeClass('active'); | ||
| 29 | - $('#downLine').parent().addClass('active'); | ||
| 30 | - } | ||
| 31 | - // 如果线路ID不为空 | ||
| 32 | - if (id) { | ||
| 33 | - var styleOptions = { | ||
| 34 | - strokeColor : "blue",// 边线颜色。 | ||
| 35 | - fillColor : "blue",// 填充颜色。当参数为空时,圆形将没有填充效果。 | ||
| 36 | - strokeWeight : 3,// 边线的宽度,以像素为单位。 | ||
| 37 | - strokeOpacity : 0.8,// 边线透明度,取值范围0 - 1。 | ||
| 38 | - fillOpacity : 0.6,// 填充的透明度,取值范围0 - 1。 | ||
| 39 | - strokeStyle : 'solid' // 边线的样式,solid或dashed。 | ||
| 40 | - }; | ||
| 41 | - | ||
| 42 | - // 等候500毫秒执行 | ||
| 43 | - setTimeout(function() { | ||
| 44 | - | ||
| 45 | - /** | ||
| 46 | - * 初始化线路对象,这里只初始化线路Id属性 | ||
| 47 | - * | ||
| 48 | - * @param:<id:线路ID> | ||
| 49 | - * @return:Line | ||
| 50 | - */ | ||
| 51 | - var Line = LineObj.init(id); | ||
| 52 | - | ||
| 53 | - $("#versions").change( | ||
| 54 | - function() { | ||
| 55 | - var val = $(this).val(); | ||
| 56 | - | ||
| 57 | - /** | ||
| 58 | - * 初始化上行树 | ||
| 59 | - * | ||
| 60 | - * @param:<Line.id:线路Id;0:上行> | ||
| 61 | - */ | ||
| 62 | - PublicFunctions.resjtreeDate(Line.id, '0', val); | ||
| 63 | - | ||
| 64 | - | ||
| 65 | - LineObj.setStatus($($("#versions").find("option:selected")[0]).attr("status")); | ||
| 66 | - /** | ||
| 67 | - * 初始化下行树 | ||
| 68 | - * | ||
| 69 | - * @param:<Line.id:线路Id;1:下行> | ||
| 70 | - */ | ||
| 71 | - // PublicFunctions.resjtreeDate(Line.id,'1',val); | ||
| 72 | - $('#stationDown').removeClass('active'); | ||
| 73 | - $('#stationDown').removeClass('in'); | ||
| 74 | - $('#stationDown').addClass('fade'); | ||
| 75 | - $('#stationUp').addClass('active in'); | ||
| 76 | - $('#downLine').parent().removeClass('active'); | ||
| 77 | - $('#upLine').parent().addClass('active'); | ||
| 78 | - | ||
| 79 | - if ($($("#versions").find("option:selected")[0]).attr("status") > 0) { | ||
| 80 | - $(".table-toolbar").show(); | ||
| 81 | - } else { | ||
| 82 | - $(".table-toolbar").hide(); | ||
| 83 | - } | ||
| 84 | - | ||
| 85 | - }); | ||
| 86 | - | ||
| 87 | - /** | ||
| 88 | - * 初始化线路标题 | ||
| 89 | - * | ||
| 90 | - * @param:<Line.id:线路ID> | ||
| 91 | - */ | ||
| 92 | - PublicFunctions.setTiteText(Line.id); | ||
| 93 | - | ||
| 94 | - /** | ||
| 95 | - * 初始化地图对象map | ||
| 96 | - * | ||
| 97 | - * @return:Map对象 | ||
| 98 | - */ | ||
| 99 | - var map_ = WorldsBMap.init(); | ||
| 100 | - | ||
| 101 | - /** | ||
| 102 | - * 初始化绘图工具类 | ||
| 103 | - * | ||
| 104 | - * @param:<map_:map对象;styleOptions:绘图样式对象> | ||
| 105 | - * @return:DrawingManager对象 | ||
| 106 | - */ | ||
| 107 | - var drawingManager_ = DrawingManagerObj.init(map_, styleOptions); | ||
| 108 | - | ||
| 109 | - GetAjaxData.getAllLineVersions(Line.id, function(data) { | ||
| 110 | - | ||
| 111 | - $("#versions option").remove(); | ||
| 112 | - | ||
| 113 | - var reqData = false; | ||
| 114 | - | ||
| 115 | - for (var i = 0; i < data.length; i++) { | ||
| 116 | - | ||
| 117 | - var ver = data[i]; | ||
| 118 | - | ||
| 119 | - if (ver.status == 1) { | ||
| 120 | - | ||
| 121 | - /** | ||
| 122 | - * 初始化上行树 | ||
| 123 | - * | ||
| 124 | - * @param:<Line.id:线路Id;0:上行> | ||
| 125 | - */ | ||
| 126 | - PublicFunctions | ||
| 127 | - .TreeUpOrDown(Line.id, '0', ver.versions); | ||
| 128 | - | ||
| 129 | - /** | ||
| 130 | - * 初始化下行树 | ||
| 131 | - * | ||
| 132 | - * @param:<Line.id:线路Id;1:下行> | ||
| 133 | - */ | ||
| 134 | - PublicFunctions | ||
| 135 | - .TreeUpOrDown(Line.id, '1', ver.versions); | ||
| 136 | - | ||
| 137 | - reqData = true; | ||
| 138 | - | ||
| 139 | - var option = "<option value=" + ver.versions | ||
| 140 | - + " status=" + ver.status + " selected>" | ||
| 141 | - + ver.name + " (" + ver.versions + ")" | ||
| 142 | - + "</option>" | ||
| 143 | - $("#versions").append(option); | ||
| 144 | - LineObj.setStatus(ver.status); | ||
| 145 | - continue; | ||
| 146 | - } | ||
| 147 | - | ||
| 148 | - var option = "<option value=" + ver.versions + " status=" | ||
| 149 | - + ver.status + ">" + ver.name + " (" + ver.versions | ||
| 150 | - + ")" + "</option>" | ||
| 151 | - $("#versions").append(option); | ||
| 152 | - } | ||
| 153 | - | ||
| 154 | - if (!reqData) { | ||
| 155 | - for (var i = 0; i < data.length; i++) { | ||
| 156 | - if (ver.status == 2) { | ||
| 157 | - | ||
| 158 | - /** | ||
| 159 | - * 初始化上行树 | ||
| 160 | - * | ||
| 161 | - * @param:<Line.id:线路Id;0:上行> | ||
| 162 | - */ | ||
| 163 | - PublicFunctions.TreeUpOrDown(Line.id, '0', | ||
| 164 | - ver.versions); | ||
| 165 | - | ||
| 166 | - /** | ||
| 167 | - * 初始化下行树 | ||
| 168 | - * | ||
| 169 | - * @param:<Line.id:线路Id;1:下行> | ||
| 170 | - */ | ||
| 171 | - PublicFunctions.TreeUpOrDown(Line.id, '1', | ||
| 172 | - ver.versions); | ||
| 173 | - | ||
| 174 | - GetAjaxData.getSectionRouteInfo(Line.id, dir, | ||
| 175 | - ver.versions, function(data) { | ||
| 176 | - /** | ||
| 177 | - * 在地图上画出线路走向 | ||
| 178 | - * | ||
| 179 | - * @param:<Line.id:线路Id;0:上行;data:路段数据> | ||
| 180 | - */ | ||
| 181 | - PublicFunctions.linePanlThree(Line.id, | ||
| 182 | - data, dir, function( | ||
| 183 | - polyline_center) { | ||
| 184 | - var map = WorldsBMap | ||
| 185 | - .getmapBValue(); | ||
| 186 | - map.panTo(polyline_center); | ||
| 187 | - }); | ||
| 188 | - | ||
| 189 | - }); | ||
| 190 | - reqData = true; | ||
| 191 | - | ||
| 192 | - LineObj.setStatus(ver.status); | ||
| 193 | - break; | ||
| 194 | - } | ||
| 195 | - } | ||
| 196 | - | ||
| 197 | - } | ||
| 198 | - | ||
| 199 | - }); | ||
| 200 | - | ||
| 201 | - GetAjaxData.getLineMatchStationIsUpdate(Line.id, function(data) { | ||
| 202 | - if (data.status == 'SUCCESS' && data.data == "1") { | ||
| 203 | - $('.portlet-title .match_station').removeClass('hidden'); | ||
| 204 | - } | ||
| 205 | - }); | ||
| 206 | - | ||
| 207 | - $('#esc_edit_div').on( | ||
| 208 | - 'click', | ||
| 209 | - function() { | ||
| 210 | - var index = layer.open({ | ||
| 211 | - title : '退出提示', | ||
| 212 | - content : '退出编辑模式后,当前没有保存的所有操作将被还原,确定要退出吗!', | ||
| 213 | - // type: 1, | ||
| 214 | - // area: ['600px', '360px'], | ||
| 215 | - // scrollbar: false, | ||
| 216 | - | ||
| 217 | - btn : [ '确定', '取消' ], | ||
| 218 | - yes : function(index) { | ||
| 219 | - | ||
| 220 | - // 刷新左边树 | ||
| 221 | - | ||
| 222 | - | ||
| 223 | - var dir = WorldsBMap.getDir(); | ||
| 224 | - | ||
| 225 | - PublicFunctions.resjtreeDate(Line.id,dir,$("#versions").val()); | ||
| 226 | - // PublicFunctions.resjtreeDate(Line.id,dir); | ||
| 227 | - // 查询路段信息 @param:<Line.id:线路Id;delBatch.dir:方向> | ||
| 228 | - // @return:data:路段数据 | ||
| 229 | -// GetAjaxData.getSectionRouteInfo(Line.id, dir, | ||
| 230 | -// function(data) { | ||
| 231 | -// // 在地图上画出线路走向 | ||
| 232 | -// // @param:<Line.id:线路Id;delBatch.dir:方向;data:路段数据> | ||
| 233 | -// PublicFunctions.linePanlThree( | ||
| 234 | -// Line.id, data, dir); | ||
| 235 | -// }); | ||
| 236 | - PublicFunctions.editMapStatusRemove(); | ||
| 237 | - layer.msg("已退出编辑模式!"); | ||
| 238 | - layer.close(index); | ||
| 239 | - }, | ||
| 240 | - btn2 : function() { | ||
| 241 | - layer.closeAll(index); // 关闭当前窗口 | ||
| 242 | - layer.msg("您没有退出编辑模式,请继续完成您未完成的操作!") | ||
| 243 | - } | ||
| 244 | - }); | ||
| 245 | - }); | ||
| 246 | - }, 500); | ||
| 247 | - | ||
| 248 | - } else { | ||
| 249 | - | ||
| 250 | - // 缺少ID | ||
| 251 | - layer.confirm('【ID缺失,请点击返回,重新进行操作】', { | ||
| 252 | - btn : [ '返回' ], | ||
| 253 | - icon : 3, | ||
| 254 | - title : '提示' | ||
| 255 | - }, function(index) { | ||
| 256 | - | ||
| 257 | - // 关闭提示弹出层 | ||
| 258 | - layer.close(index); | ||
| 259 | - | ||
| 260 | - // 返回线路list页面 | ||
| 261 | - loadPage('/pages/base/line/list.html'); | ||
| 262 | - | ||
| 263 | - }); | ||
| 264 | - | ||
| 265 | - } | ||
| 266 | - $('.green-seagreen dropdown-toggle').click(function() { | ||
| 267 | - $('.dropdown-menu').css("display", "block"); | ||
| 268 | - }); | 1 | +/** |
| 2 | + * reload事件 | ||
| 3 | + * | ||
| 4 | + * | ||
| 5 | + */ | ||
| 6 | + | ||
| 7 | +$(function() { | ||
| 8 | + | ||
| 9 | + // 关闭左侧栏 | ||
| 10 | + if (!$('body').hasClass('page-sidebar-closed')) { | ||
| 11 | + $('.menu-toggler.sidebar-toggler').click(); | ||
| 12 | + } | ||
| 13 | + // 获取参数线路ID | ||
| 14 | + var idAndDir = $.url().param('no'); | ||
| 15 | + var param = idAndDir.split(","); | ||
| 16 | + var dir = 0, id; | ||
| 17 | + if (param.length == 1) { | ||
| 18 | + id = param[0]; | ||
| 19 | + } else { | ||
| 20 | + id = param[0]; | ||
| 21 | + dir = param[1]; | ||
| 22 | + } | ||
| 23 | + if (dir == 1) { | ||
| 24 | + $('#stationUp').removeClass('active'); | ||
| 25 | + $('#stationUp').removeClass('in'); | ||
| 26 | + $('#stationUp').addClass('fade'); | ||
| 27 | + $('#stationDown').addClass('active in'); | ||
| 28 | + $('#upLine').parent().removeClass('active'); | ||
| 29 | + $('#downLine').parent().addClass('active'); | ||
| 30 | + } | ||
| 31 | + // 如果线路ID不为空 | ||
| 32 | + if (id) { | ||
| 33 | + var styleOptions = { | ||
| 34 | + strokeColor : "blue",// 边线颜色。 | ||
| 35 | + fillColor : "blue",// 填充颜色。当参数为空时,圆形将没有填充效果。 | ||
| 36 | + strokeWeight : 3,// 边线的宽度,以像素为单位。 | ||
| 37 | + strokeOpacity : 0.8,// 边线透明度,取值范围0 - 1。 | ||
| 38 | + fillOpacity : 0.6,// 填充的透明度,取值范围0 - 1。 | ||
| 39 | + strokeStyle : 'solid' // 边线的样式,solid或dashed。 | ||
| 40 | + }; | ||
| 41 | + | ||
| 42 | + // 等候500毫秒执行 | ||
| 43 | + setTimeout(function() { | ||
| 44 | + | ||
| 45 | + /** | ||
| 46 | + * 初始化线路对象,这里只初始化线路Id属性 | ||
| 47 | + * | ||
| 48 | + * @param:<id:线路ID> | ||
| 49 | + * @return:Line | ||
| 50 | + */ | ||
| 51 | + var Line = LineObj.init(id); | ||
| 52 | + | ||
| 53 | + $("#versions").change( | ||
| 54 | + function() { | ||
| 55 | + var val = $(this).val(); | ||
| 56 | + | ||
| 57 | + /** | ||
| 58 | + * 初始化上行树 | ||
| 59 | + * | ||
| 60 | + * @param:<Line.id:线路Id;0:上行> | ||
| 61 | + */ | ||
| 62 | + PublicFunctions.resjtreeDate(Line.id, '0', val); | ||
| 63 | + | ||
| 64 | + | ||
| 65 | + LineObj.setStatus($($("#versions").find("option:selected")[0]).attr("status")); | ||
| 66 | + /** | ||
| 67 | + * 初始化下行树 | ||
| 68 | + * | ||
| 69 | + * @param:<Line.id:线路Id;1:下行> | ||
| 70 | + */ | ||
| 71 | + // PublicFunctions.resjtreeDate(Line.id,'1',val); | ||
| 72 | + $('#stationDown').removeClass('active'); | ||
| 73 | + $('#stationDown').removeClass('in'); | ||
| 74 | + $('#stationDown').addClass('fade'); | ||
| 75 | + $('#inoutCarpark').removeClass('active'); | ||
| 76 | + $('#inoutCarpark').removeClass('in'); | ||
| 77 | + $('#inoutCarpark').addClass('fade'); | ||
| 78 | + $('#stationUp').addClass('active in'); | ||
| 79 | + $('#downLine').parent().removeClass('active'); | ||
| 80 | + $('#inoutLine').parent().removeClass('active'); | ||
| 81 | + $('#upLine').parent().addClass('active'); | ||
| 82 | + | ||
| 83 | + if ($($("#versions").find("option:selected")[0]).attr("status") > 0) { | ||
| 84 | + $(".table-toolbar").show(); | ||
| 85 | + } else { | ||
| 86 | + $(".table-toolbar").hide(); | ||
| 87 | + } | ||
| 88 | + | ||
| 89 | + }); | ||
| 90 | + | ||
| 91 | + /** | ||
| 92 | + * 初始化线路标题 | ||
| 93 | + * | ||
| 94 | + * @param:<Line.id:线路ID> | ||
| 95 | + */ | ||
| 96 | + PublicFunctions.setTiteText(Line.id); | ||
| 97 | + | ||
| 98 | + /** | ||
| 99 | + * 初始化地图对象map | ||
| 100 | + * | ||
| 101 | + * @return:Map对象 | ||
| 102 | + */ | ||
| 103 | + var map_ = WorldsBMap.init(); | ||
| 104 | + | ||
| 105 | + /** | ||
| 106 | + * 初始化绘图工具类 | ||
| 107 | + * | ||
| 108 | + * @param:<map_:map对象;styleOptions:绘图样式对象> | ||
| 109 | + * @return:DrawingManager对象 | ||
| 110 | + */ | ||
| 111 | + var drawingManager_ = DrawingManagerObj.init(map_, styleOptions); | ||
| 112 | + | ||
| 113 | + GetAjaxData.getAllLineVersions(Line.id, function(data) { | ||
| 114 | + | ||
| 115 | + $("#versions option").remove(); | ||
| 116 | + | ||
| 117 | + var reqData = false; | ||
| 118 | + | ||
| 119 | + for (var i = 0; i < data.length; i++) { | ||
| 120 | + | ||
| 121 | + var ver = data[i]; | ||
| 122 | + | ||
| 123 | + if (ver.status == 1) { | ||
| 124 | + | ||
| 125 | + /** | ||
| 126 | + * 初始化上行树 | ||
| 127 | + * | ||
| 128 | + * @param:<Line.id:线路Id;0:上行> | ||
| 129 | + */ | ||
| 130 | + PublicFunctions | ||
| 131 | + .TreeUpOrDown(Line.id, '0', ver.versions); | ||
| 132 | + | ||
| 133 | + /** | ||
| 134 | + * 初始化下行树 | ||
| 135 | + * | ||
| 136 | + * @param:<Line.id:线路Id;1:下行> | ||
| 137 | + */ | ||
| 138 | + PublicFunctions | ||
| 139 | + .TreeUpOrDown(Line.id, '1', ver.versions); | ||
| 140 | + | ||
| 141 | + reqData = true; | ||
| 142 | + | ||
| 143 | + var option = "<option value=" + ver.versions | ||
| 144 | + + " status=" + ver.status + " selected>" | ||
| 145 | + + ver.name + " (" + ver.versions + ")" | ||
| 146 | + + "</option>" | ||
| 147 | + $("#versions").append(option); | ||
| 148 | + LineObj.setStatus(ver.status); | ||
| 149 | + continue; | ||
| 150 | + } | ||
| 151 | + | ||
| 152 | + var option = "<option value=" + ver.versions + " status=" | ||
| 153 | + + ver.status + ">" + ver.name + " (" + ver.versions | ||
| 154 | + + ")" + "</option>" | ||
| 155 | + $("#versions").append(option); | ||
| 156 | + } | ||
| 157 | + | ||
| 158 | + if (!reqData) { | ||
| 159 | + for (var i = 0; i < data.length; i++) { | ||
| 160 | + if (ver.status == 2) { | ||
| 161 | + | ||
| 162 | + /** | ||
| 163 | + * 初始化上行树 | ||
| 164 | + * | ||
| 165 | + * @param:<Line.id:线路Id;0:上行> | ||
| 166 | + */ | ||
| 167 | + PublicFunctions.TreeUpOrDown(Line.id, '0', | ||
| 168 | + ver.versions); | ||
| 169 | + | ||
| 170 | + /** | ||
| 171 | + * 初始化下行树 | ||
| 172 | + * | ||
| 173 | + * @param:<Line.id:线路Id;1:下行> | ||
| 174 | + */ | ||
| 175 | + PublicFunctions.TreeUpOrDown(Line.id, '1', | ||
| 176 | + ver.versions); | ||
| 177 | + | ||
| 178 | + GetAjaxData.getSectionRouteInfo(Line.id, dir, | ||
| 179 | + ver.versions, function(data) { | ||
| 180 | + /** | ||
| 181 | + * 在地图上画出线路走向 | ||
| 182 | + * | ||
| 183 | + * @param:<Line.id:线路Id;0:上行;data:路段数据> | ||
| 184 | + */ | ||
| 185 | + PublicFunctions.linePanlThree(Line.id, | ||
| 186 | + data, dir, function( | ||
| 187 | + polyline_center) { | ||
| 188 | + var map = WorldsBMap | ||
| 189 | + .getmapBValue(); | ||
| 190 | + map.panTo(polyline_center); | ||
| 191 | + }); | ||
| 192 | + | ||
| 193 | + }); | ||
| 194 | + reqData = true; | ||
| 195 | + | ||
| 196 | + LineObj.setStatus(ver.status); | ||
| 197 | + break; | ||
| 198 | + } | ||
| 199 | + } | ||
| 200 | + | ||
| 201 | + } | ||
| 202 | + | ||
| 203 | + }); | ||
| 204 | + | ||
| 205 | + GetAjaxData.getLineMatchStationIsUpdate(Line.id, function(data) { | ||
| 206 | + if (data.status == 'SUCCESS' && data.data == "1") { | ||
| 207 | + $('.portlet-title .match_station').removeClass('hidden'); | ||
| 208 | + } | ||
| 209 | + }); | ||
| 210 | + | ||
| 211 | + $('#esc_edit_div').on( | ||
| 212 | + 'click', | ||
| 213 | + function() { | ||
| 214 | + var index = layer.open({ | ||
| 215 | + title : '退出提示', | ||
| 216 | + content : '退出编辑模式后,当前没有保存的所有操作将被还原,确定要退出吗!', | ||
| 217 | + // type: 1, | ||
| 218 | + // area: ['600px', '360px'], | ||
| 219 | + // scrollbar: false, | ||
| 220 | + | ||
| 221 | + btn : [ '确定', '取消' ], | ||
| 222 | + yes : function(index) { | ||
| 223 | + | ||
| 224 | + // 刷新左边树 | ||
| 225 | + | ||
| 226 | + | ||
| 227 | + var dir = WorldsBMap.getDir(); | ||
| 228 | + | ||
| 229 | + PublicFunctions.resjtreeDate(Line.id,dir,$("#versions").val()); | ||
| 230 | + // PublicFunctions.resjtreeDate(Line.id,dir); | ||
| 231 | + // 查询路段信息 @param:<Line.id:线路Id;delBatch.dir:方向> | ||
| 232 | + // @return:data:路段数据 | ||
| 233 | +// GetAjaxData.getSectionRouteInfo(Line.id, dir, | ||
| 234 | +// function(data) { | ||
| 235 | +// // 在地图上画出线路走向 | ||
| 236 | +// // @param:<Line.id:线路Id;delBatch.dir:方向;data:路段数据> | ||
| 237 | +// PublicFunctions.linePanlThree( | ||
| 238 | +// Line.id, data, dir); | ||
| 239 | +// }); | ||
| 240 | + PublicFunctions.editMapStatusRemove(); | ||
| 241 | + layer.msg("已退出编辑模式!"); | ||
| 242 | + layer.close(index); | ||
| 243 | + }, | ||
| 244 | + btn2 : function() { | ||
| 245 | + layer.closeAll(index); // 关闭当前窗口 | ||
| 246 | + layer.msg("您没有退出编辑模式,请继续完成您未完成的操作!") | ||
| 247 | + } | ||
| 248 | + }); | ||
| 249 | + }); | ||
| 250 | + }, 500); | ||
| 251 | + | ||
| 252 | + } else { | ||
| 253 | + | ||
| 254 | + // 缺少ID | ||
| 255 | + layer.confirm('【ID缺失,请点击返回,重新进行操作】', { | ||
| 256 | + btn : [ '返回' ], | ||
| 257 | + icon : 3, | ||
| 258 | + title : '提示' | ||
| 259 | + }, function(index) { | ||
| 260 | + | ||
| 261 | + // 关闭提示弹出层 | ||
| 262 | + layer.close(index); | ||
| 263 | + | ||
| 264 | + // 返回线路list页面 | ||
| 265 | + loadPage('/pages/base/line/list.html'); | ||
| 266 | + | ||
| 267 | + }); | ||
| 268 | + | ||
| 269 | + } | ||
| 270 | + $('.green-seagreen dropdown-toggle').click(function() { | ||
| 271 | + $('.dropdown-menu').css("display", "block"); | ||
| 272 | + }); | ||
| 269 | }); | 273 | }); |
| 270 | \ No newline at end of file | 274 | \ No newline at end of file |
src/main/resources/static/pages/base/stationroute/js/stationroute-list-treedata.js
| 1 | -/** | ||
| 2 | - * | ||
| 3 | - * 左边树Obj : StationTreeData | ||
| 4 | - * | ||
| 5 | - * - - - - - - 》 upInit : 初始化上行树 | ||
| 6 | - * | ||
| 7 | - * - - - - - - 》 downInit : 初始化下行树 | ||
| 8 | - * | ||
| 9 | - * - - - - - - 》 upreloadeTree : 刷行上行树 | ||
| 10 | - * | ||
| 11 | - * - - - - - - 》 dwonreloadeTree : 刷行下行树 | ||
| 12 | - */ | ||
| 13 | - | ||
| 14 | -var StationTreeData = function(){ | ||
| 15 | - | ||
| 16 | - function parmasObj() { | ||
| 17 | - | ||
| 18 | - AddStationObj.setAddStation({}); | ||
| 19 | - | ||
| 20 | - EditStationObj.setEitdStation({}); | ||
| 21 | - | ||
| 22 | - EditSectionObj.setEitdSection({}); | ||
| 23 | - | ||
| 24 | - } | ||
| 25 | - | ||
| 26 | - function TreeOnclickEvent(treeOjb) { | ||
| 27 | - if(treeOjb==null) | ||
| 28 | - return; | ||
| 29 | - // 节点个数 | ||
| 30 | - var len = treeOjb.length; | ||
| 31 | - if(len<0) { | ||
| 32 | - return; | ||
| 33 | - } | ||
| 34 | - | ||
| 35 | - // 获取数据 | ||
| 36 | - var stationData = treeOjb[0].original; | ||
| 37 | - // 选中的节点类型 | ||
| 38 | - var chaildredType_ = stationData.chaildredType; | ||
| 39 | - | ||
| 40 | - if(chaildredType_ == "section") { | ||
| 41 | - WorldsBMap.focusSection(stationData.sectionrouteId); | ||
| 42 | - } else if(chaildredType_ == "station") { | ||
| 43 | - WorldsBMap.openStationInfoWin(stationData); | ||
| 44 | - } else if(chaildredType_ == "addSection") { | ||
| 45 | - WorldsBMap.addSection(stationData); | ||
| 46 | - } | ||
| 47 | - } | ||
| 48 | - var stationTree = { | ||
| 49 | - upInit : function(treeDateJson) { | ||
| 50 | - // 如果不为空 | ||
| 51 | - if(treeDateJson) { | ||
| 52 | - // 加载树load事件 | ||
| 53 | - $('#station_Up_tree').on('loaded.jstree', function(e, data){ | ||
| 54 | - // 展开树 | ||
| 55 | - $.jstree.reference("#station_Up_tree").open_all(); | ||
| 56 | - }).jstree({ | ||
| 57 | - 'core' : { | ||
| 58 | - 'themes' : { | ||
| 59 | - 'responsive': false | ||
| 60 | - }, | ||
| 61 | - | ||
| 62 | - 'data': treeDateJson, | ||
| 63 | - | ||
| 64 | - 'multiple':false | ||
| 65 | - | ||
| 66 | - }, | ||
| 67 | - | ||
| 68 | - 'types' : { | ||
| 69 | - | ||
| 70 | - "default" : { | ||
| 71 | - | ||
| 72 | - "icon" : false | ||
| 73 | - | ||
| 74 | - }, | ||
| 75 | - | ||
| 76 | - 'enable_true' : { | ||
| 77 | - | ||
| 78 | - "icon" : 'fa fa-check icon-lg' | ||
| 79 | - | ||
| 80 | - }, | ||
| 81 | - | ||
| 82 | - 'enable_false' : { | ||
| 83 | - | ||
| 84 | - 'icon' : 'fa fa-close icon-lg' | ||
| 85 | - | ||
| 86 | - }, | ||
| 87 | - | ||
| 88 | - 'group':{ | ||
| 89 | - | ||
| 90 | - 'icon' : 'fa fa-object-group icon-lg' | ||
| 91 | - | ||
| 92 | - } | ||
| 93 | - }, | ||
| 94 | - | ||
| 95 | - 'plugins': ['types'] | ||
| 96 | - | ||
| 97 | - // 树节点单击事件 | ||
| 98 | - }).bind('click.jstree', function(event) { | ||
| 99 | - // 获取上行选中树节点 | ||
| 100 | - var treeOjb = $.jstree.reference("#station_Up_tree").get_selected(true); | ||
| 101 | - TreeOnclickEvent(treeOjb); | ||
| 102 | - | ||
| 103 | - }); | ||
| 104 | - } | ||
| 105 | - }, | ||
| 106 | - downInit : function(treeDateJson) { | ||
| 107 | - // 如果不为空 | ||
| 108 | - if(treeDateJson) { | ||
| 109 | - // 树初始化load事件 | ||
| 110 | - $('#station_Down_tree').on('loaded.jstree', function(e, data){ | ||
| 111 | - // 展开树 | ||
| 112 | - $.jstree.reference("#station_Down_tree").open_all(); | ||
| 113 | - }).jstree({ | ||
| 114 | - 'core' : { | ||
| 115 | - 'themes' : { | ||
| 116 | - | ||
| 117 | - 'responsive': false | ||
| 118 | - | ||
| 119 | - }, | ||
| 120 | - | ||
| 121 | - 'data': treeDateJson, | ||
| 122 | - | ||
| 123 | - 'multiple':false | ||
| 124 | - | ||
| 125 | - }, | ||
| 126 | - | ||
| 127 | - 'types' : { | ||
| 128 | - | ||
| 129 | - "default" : { | ||
| 130 | - | ||
| 131 | - "icon" : false | ||
| 132 | - | ||
| 133 | - }, | ||
| 134 | - | ||
| 135 | - 'enable_true' : { | ||
| 136 | - | ||
| 137 | - "icon" : 'fa fa-check icon-lg' | ||
| 138 | - | ||
| 139 | - }, | ||
| 140 | - | ||
| 141 | - 'enable_false' : { | ||
| 142 | - | ||
| 143 | - 'icon' : 'fa fa-close icon-lg' | ||
| 144 | - | ||
| 145 | - }, | ||
| 146 | - | ||
| 147 | - 'group':{ | ||
| 148 | - | ||
| 149 | - 'icon' : 'fa fa-object-group icon-lg' | ||
| 150 | - | ||
| 151 | - } | ||
| 152 | - }, | ||
| 153 | - 'plugins': ['types'] | ||
| 154 | - // 树节点单击事件 | ||
| 155 | - }).bind('click.jstree', function(event) { | ||
| 156 | - // 获取下行选中树节点 | ||
| 157 | - var treeOjb = $.jstree.reference("#station_Down_tree").get_selected(true); | ||
| 158 | - TreeOnclickEvent(treeOjb); | ||
| 159 | - }); | ||
| 160 | - } | ||
| 161 | - }, | ||
| 162 | - upreloadeTree : function (treeDateJson) { | ||
| 163 | - // 获取上行树 | ||
| 164 | - var tree = $.jstree.reference('#station_Up_tree'); | ||
| 165 | - // 赋值数据 | ||
| 166 | - tree.settings.core.data = treeDateJson; | ||
| 167 | - // 刷新上行树 | ||
| 168 | - tree.refresh(); | ||
| 169 | - // 展开树 | ||
| 170 | - setTimeout(function () { | ||
| 171 | - tree.open_all(); | ||
| 172 | - },500); | ||
| 173 | - }, | ||
| 174 | - dwonreloadeTree : function (treeDateJson) { | ||
| 175 | - // 获取下行树 | ||
| 176 | - var tree = $.jstree.reference('#station_Down_tree'); | ||
| 177 | - // 赋值数据 | ||
| 178 | - tree.settings.core.data = treeDateJson; | ||
| 179 | - // 刷行下行树 | ||
| 180 | - tree.refresh(); | ||
| 181 | - // 展开树 | ||
| 182 | - setTimeout(function () { | ||
| 183 | - tree.open_all(); | ||
| 184 | - },500); | ||
| 185 | - } | ||
| 186 | - } | ||
| 187 | - | ||
| 188 | - return stationTree; | ||
| 189 | - | 1 | +/** |
| 2 | + * | ||
| 3 | + * 左边树Obj : StationTreeData | ||
| 4 | + * | ||
| 5 | + * - - - - - - 》 upInit : 初始化上行树 | ||
| 6 | + * | ||
| 7 | + * - - - - - - 》 downInit : 初始化下行树 | ||
| 8 | + * | ||
| 9 | + * - - - - - - 》 upreloadeTree : 刷行上行树 | ||
| 10 | + * | ||
| 11 | + * - - - - - - 》 dwonreloadeTree : 刷行下行树 | ||
| 12 | + */ | ||
| 13 | + | ||
| 14 | +var StationTreeData = function(){ | ||
| 15 | + | ||
| 16 | + function parmasObj() { | ||
| 17 | + | ||
| 18 | + AddStationObj.setAddStation({}); | ||
| 19 | + | ||
| 20 | + EditStationObj.setEitdStation({}); | ||
| 21 | + | ||
| 22 | + EditSectionObj.setEitdSection({}); | ||
| 23 | + | ||
| 24 | + } | ||
| 25 | + | ||
| 26 | + function TreeOnclickEvent(treeOjb) { | ||
| 27 | + if(treeOjb==null) | ||
| 28 | + return; | ||
| 29 | + // 节点个数 | ||
| 30 | + var len = treeOjb.length; | ||
| 31 | + if(len<0) { | ||
| 32 | + return; | ||
| 33 | + } | ||
| 34 | + | ||
| 35 | + // 获取数据 | ||
| 36 | + var stationData = treeOjb[0].original; | ||
| 37 | + // 选中的节点类型 | ||
| 38 | + var chaildredType_ = stationData.chaildredType; | ||
| 39 | + | ||
| 40 | + if(chaildredType_ == "section") { | ||
| 41 | + WorldsBMap.focusSection(stationData.sectionrouteId); | ||
| 42 | + } else if(chaildredType_ == "station") { | ||
| 43 | + WorldsBMap.openStationInfoWin(stationData); | ||
| 44 | + } else if(chaildredType_ == "addSection") { | ||
| 45 | + WorldsBMap.addSection(stationData); | ||
| 46 | + } | ||
| 47 | + } | ||
| 48 | + var stationTree = { | ||
| 49 | + upInit : function(treeDateJson) { | ||
| 50 | + // 如果不为空 | ||
| 51 | + if(treeDateJson) { | ||
| 52 | + // 加载树load事件 | ||
| 53 | + $('#station_Up_tree').on('loaded.jstree', function(e, data){ | ||
| 54 | + // 展开树 | ||
| 55 | + $.jstree.reference("#station_Up_tree").open_all(); | ||
| 56 | + }).jstree({ | ||
| 57 | + 'core' : { | ||
| 58 | + 'themes' : { | ||
| 59 | + 'responsive': false | ||
| 60 | + }, | ||
| 61 | + | ||
| 62 | + 'data': treeDateJson, | ||
| 63 | + | ||
| 64 | + 'multiple':false | ||
| 65 | + | ||
| 66 | + }, | ||
| 67 | + | ||
| 68 | + 'types' : { | ||
| 69 | + | ||
| 70 | + "default" : { | ||
| 71 | + | ||
| 72 | + "icon" : false | ||
| 73 | + | ||
| 74 | + }, | ||
| 75 | + | ||
| 76 | + 'enable_true' : { | ||
| 77 | + | ||
| 78 | + "icon" : 'fa fa-check icon-lg' | ||
| 79 | + | ||
| 80 | + }, | ||
| 81 | + | ||
| 82 | + 'enable_false' : { | ||
| 83 | + | ||
| 84 | + 'icon' : 'fa fa-close icon-lg' | ||
| 85 | + | ||
| 86 | + }, | ||
| 87 | + | ||
| 88 | + 'group':{ | ||
| 89 | + | ||
| 90 | + 'icon' : 'fa fa-object-group icon-lg' | ||
| 91 | + | ||
| 92 | + } | ||
| 93 | + }, | ||
| 94 | + | ||
| 95 | + 'plugins': ['types'] | ||
| 96 | + | ||
| 97 | + // 树节点单击事件 | ||
| 98 | + }).bind('click.jstree', function(event) { | ||
| 99 | + // 获取上行选中树节点 | ||
| 100 | + var treeOjb = $.jstree.reference("#station_Up_tree").get_selected(true); | ||
| 101 | + TreeOnclickEvent(treeOjb); | ||
| 102 | + | ||
| 103 | + }); | ||
| 104 | + } | ||
| 105 | + }, | ||
| 106 | + downInit : function(treeDateJson) { | ||
| 107 | + // 如果不为空 | ||
| 108 | + if(treeDateJson) { | ||
| 109 | + // 树初始化load事件 | ||
| 110 | + $('#station_Down_tree').on('loaded.jstree', function(e, data){ | ||
| 111 | + // 展开树 | ||
| 112 | + $.jstree.reference("#station_Down_tree").open_all(); | ||
| 113 | + }).jstree({ | ||
| 114 | + 'core' : { | ||
| 115 | + 'themes' : { | ||
| 116 | + | ||
| 117 | + 'responsive': false | ||
| 118 | + | ||
| 119 | + }, | ||
| 120 | + | ||
| 121 | + 'data': treeDateJson, | ||
| 122 | + | ||
| 123 | + 'multiple':false | ||
| 124 | + | ||
| 125 | + }, | ||
| 126 | + | ||
| 127 | + 'types' : { | ||
| 128 | + | ||
| 129 | + "default" : { | ||
| 130 | + | ||
| 131 | + "icon" : false | ||
| 132 | + | ||
| 133 | + }, | ||
| 134 | + | ||
| 135 | + 'enable_true' : { | ||
| 136 | + | ||
| 137 | + "icon" : 'fa fa-check icon-lg' | ||
| 138 | + | ||
| 139 | + }, | ||
| 140 | + | ||
| 141 | + 'enable_false' : { | ||
| 142 | + | ||
| 143 | + 'icon' : 'fa fa-close icon-lg' | ||
| 144 | + | ||
| 145 | + }, | ||
| 146 | + | ||
| 147 | + 'group':{ | ||
| 148 | + | ||
| 149 | + 'icon' : 'fa fa-object-group icon-lg' | ||
| 150 | + | ||
| 151 | + } | ||
| 152 | + }, | ||
| 153 | + 'plugins': ['types'] | ||
| 154 | + // 树节点单击事件 | ||
| 155 | + }).bind('click.jstree', function(event) { | ||
| 156 | + // 获取下行选中树节点 | ||
| 157 | + var treeOjb = $.jstree.reference("#station_Down_tree").get_selected(true); | ||
| 158 | + TreeOnclickEvent(treeOjb); | ||
| 159 | + }); | ||
| 160 | + } | ||
| 161 | + }, | ||
| 162 | + inoutInit : function(treeDateJson) { | ||
| 163 | + // 如果不为空 | ||
| 164 | + if(treeDateJson) { | ||
| 165 | + // 树初始化load事件 | ||
| 166 | + $('#inout_carpark_tree').on('loaded.jstree', function(e, data){ | ||
| 167 | + // 展开树 | ||
| 168 | + $.jstree.reference("#inout_carpark_tree").open_all(); | ||
| 169 | + }).jstree({ | ||
| 170 | + 'core' : { | ||
| 171 | + 'themes' : { | ||
| 172 | + 'responsive': false | ||
| 173 | + }, | ||
| 174 | + 'data': treeDateJson, | ||
| 175 | + 'multiple':false | ||
| 176 | + }, | ||
| 177 | + 'types' : { | ||
| 178 | + "default" : { | ||
| 179 | + "icon" : false | ||
| 180 | + }, | ||
| 181 | + 'enable_true' : { | ||
| 182 | + "icon" : 'fa fa-check icon-lg' | ||
| 183 | + }, | ||
| 184 | + 'enable_false' : { | ||
| 185 | + 'icon' : 'fa fa-close icon-lg' | ||
| 186 | + }, | ||
| 187 | + 'group':{ | ||
| 188 | + 'icon' : 'fa fa-object-group icon-lg' | ||
| 189 | + } | ||
| 190 | + }, | ||
| 191 | + 'plugins': ['types'] | ||
| 192 | + // 树节点单击事件 | ||
| 193 | + }).bind('click.jstree', function(event) { | ||
| 194 | + // 获取下行选中树节点 | ||
| 195 | + var treeOjb = $.jstree.reference("#inout_carpark_tree").get_selected(true); | ||
| 196 | + TreeOnclickEvent(treeOjb); | ||
| 197 | + }); | ||
| 198 | + } | ||
| 199 | + }, | ||
| 200 | + upreloadeTree : function (treeDateJson) { | ||
| 201 | + // 获取上行树 | ||
| 202 | + var tree = $.jstree.reference('#station_Up_tree'); | ||
| 203 | + // 赋值数据 | ||
| 204 | + tree.settings.core.data = treeDateJson; | ||
| 205 | + // 刷新上行树 | ||
| 206 | + tree.refresh(); | ||
| 207 | + // 展开树 | ||
| 208 | + setTimeout(function () { | ||
| 209 | + tree.open_all(); | ||
| 210 | + },500); | ||
| 211 | + }, | ||
| 212 | + dwonreloadeTree : function (treeDateJson) { | ||
| 213 | + // 获取下行树 | ||
| 214 | + var tree = $.jstree.reference('#station_Down_tree'); | ||
| 215 | + // 赋值数据 | ||
| 216 | + tree.settings.core.data = treeDateJson; | ||
| 217 | + // 刷行下行树 | ||
| 218 | + tree.refresh(); | ||
| 219 | + // 展开树 | ||
| 220 | + setTimeout(function () { | ||
| 221 | + tree.open_all(); | ||
| 222 | + },500); | ||
| 223 | + }, | ||
| 224 | + inoutreloadeTree : function (treeDateJson) { | ||
| 225 | + // 获取下行树 | ||
| 226 | + var tree = $.jstree.reference('#inout_carpark_tree'); | ||
| 227 | + // 赋值数据 | ||
| 228 | + tree.settings.core.data = treeDateJson; | ||
| 229 | + // 刷行下行树 | ||
| 230 | + tree.refresh(); | ||
| 231 | + // 展开树 | ||
| 232 | + setTimeout(function () { | ||
| 233 | + tree.open_all(); | ||
| 234 | + },500); | ||
| 235 | + } | ||
| 236 | + } | ||
| 237 | + | ||
| 238 | + return stationTree; | ||
| 239 | + | ||
| 190 | }(); | 240 | }(); |
| 191 | \ No newline at end of file | 241 | \ No newline at end of file |
src/main/resources/static/pages/base/stationroute/list.html
| 1 | -<link href="/pages/base/stationroute/css/bmap_base.css" rel="stylesheet" type="text/css" /> | ||
| 2 | -<link rel="stylesheet" href="/assets/plugins/layer-v2.4/layer/skin/layer.css"> | ||
| 3 | - | ||
| 4 | -<div class="mian-portlet-body"> | ||
| 5 | - <!-- 地图 --> | ||
| 6 | - <div id="bmap_basic" class="bmaps"></div> | ||
| 7 | - <!-- 搜索框 --> | ||
| 8 | - | ||
| 9 | - <div class="search_panel"> | ||
| 10 | - <div class="search_input_panel"> | ||
| 11 | - <input class="search_input" type="text" placeholder="输入位置搜索" id="searchInput"> | ||
| 12 | - <span class="fa fa-close fa-lg clear hide" aria-hidden="true"></span > | ||
| 13 | - </div> | ||
| 14 | - <div class="search_button_panel"> | ||
| 15 | - <button class="fa fa-search fa-lg search_button" > | ||
| 16 | - </button > | ||
| 17 | - </div> | ||
| 18 | - </div> | ||
| 19 | - <div class="esc_edit_div" id="esc_edit_div" style="display: none"> | ||
| 20 | - <button class="esc_edit_btn" >退出编辑模式 | ||
| 21 | - </button > | ||
| 22 | - </div> | ||
| 23 | - <!-- 搜索下拉框--> | ||
| 24 | - <div id="searchResultPanel" style="border:1px solid #C0C0C0;width:150px;height:auto; display:none;z-index: 199;"></div> | ||
| 25 | - <!-- 路径规划路段 --> | ||
| 26 | - <input class="hand" id="routePlanning" /> | ||
| 27 | - <div class="portlet box protlet-box"> | ||
| 28 | - <div class="protlet-box-layer"></div> | ||
| 29 | - <!-- 左边标题栏 --> | ||
| 30 | - <div class="portlet-title"> | ||
| 31 | - <div class="caption"> | ||
| 32 | - <!-- 途径站点 --> | ||
| 33 | - </div> | ||
| 34 | - | ||
| 35 | - <div class="versions" style="float:right;"> | ||
| 36 | - <select id="versions" style="height:30px;width:200px;margin-top:5px;"> </select> | ||
| 37 | - </div> | ||
| 38 | - | ||
| 39 | - | ||
| 40 | - <div class="match_station hidden"> | ||
| 41 | - <!--<div class="match_station hidden">--> | ||
| 42 | - <a class="match_station_bnt ">检测到外部站点行业编码有更新</a> | ||
| 43 | - </div> | ||
| 44 | - | ||
| 45 | - <!--<div class="tools"> | ||
| 46 | - <a href="javascript:;" class="collapse" data-original-title="" title=""> </a> | ||
| 47 | - </div>--> | ||
| 48 | - </div> | ||
| 49 | - <!-- 左边栏 --> | ||
| 50 | - <div class="portlet-body" id="scrllmouseEvent" style="border: 1px solid rgb(255, 255, 255); display: block;min-height: 520px;"> | ||
| 51 | - <div class="row"> | ||
| 52 | - <!-- 上下行栏 --> | ||
| 53 | - <div class="col-md-3 col-sm-3 col-xs-3"> | ||
| 54 | - <ul class="nav nav-tabs tabs-left" id="leftUpOrDown"> | ||
| 55 | - <li class="active"> | ||
| 56 | - <a href="#stationUp" data-toggle="tab" id="upLine" aria-expanded="true"> 上行 </a> | ||
| 57 | - </li> | ||
| 58 | - <li class=""> | ||
| 59 | - <a href="#stationDown" data-toggle="tab" id="downLine" aria-expanded="false"> 下行 </a> | ||
| 60 | - </li> | ||
| 61 | - </ul> | ||
| 62 | - </div> | ||
| 63 | - <div class="col-md-9 col-sm-9 col-xs-9"> | ||
| 64 | - <div class="tab-content"> | ||
| 65 | - <!-- 左边栏上行 --> | ||
| 66 | - <div class="tab-pane active in" id="stationUp" data-direction="0"> | ||
| 67 | - <div class="portlet-body" id="uptreeMobal" style="display: none"> | ||
| 68 | - <div class="table-toolbar"> | ||
| 69 | - <div class="row"> | ||
| 70 | - | ||
| 71 | - <div class="col-md-6" style="float: right;"> | ||
| 72 | - <div class="btn-group" style="float: right;"> | ||
| 73 | - <div class="actions module_tools"> | ||
| 74 | - <div class="btn-group"> | ||
| 75 | - <!-- <a class="btn green-haze btn-outline btn-circle btn-sm" style="background-color:#3B3F51;border-color:#FFFFFF;color:#FFFFFF" href="javascript:;" data-toggle="dropdown" data-hover="dropdown" data-close-others="true" aria-expanded="true"> 工具 | ||
| 76 | - <i class="fa fa-angle-down"></i> | ||
| 77 | - </a> --> | ||
| 78 | - <a href="javascript:" class="btn white btn-outline btn-circle" style="border-color: #3B3F51;color: #3B3F51;" data-toggle="dropdown" aria-expanded="false"> | ||
| 79 | - <i class="fa fa-share"></i> | ||
| 80 | - <span>上行操作</span> | ||
| 81 | - <i class="fa fa-angle-down"></i> | ||
| 82 | - </a> | ||
| 83 | - <ul class="dropdown-menu pull-right" style="min-width:100px"> | ||
| 84 | - <li> | ||
| 85 | - <a href="javascript:;" id="addUpStation"><i class="fa fa-plus"></i> 添加站点</a> | ||
| 86 | - </li> | ||
| 87 | - <li class="divider"> </li> | ||
| 88 | - <!--<li> | ||
| 89 | - <a href="javascript:;" id="editUpStation"><i class="fa fa-pencil"></i> 修改站点</a> | ||
| 90 | - </li> | ||
| 91 | - <li class="divider"> </li> | ||
| 92 | - <li> | ||
| 93 | - <a href="javascript:;" id="deleteUpStation"><i class="fa fa-close"></i> 撤销站点</a> | ||
| 94 | - </li> | ||
| 95 | - <li class="divider"> </li> | ||
| 96 | - <li> | ||
| 97 | - <a href="javascript:;" id="addUpSection"><i class="fa fa-plus"></i> 添加路段</a> | ||
| 98 | - </li> | ||
| 99 | - <li class="divider"> </li>--> | ||
| 100 | - <li> | ||
| 101 | - <a href="javascript:;" id="batchUpDelete"><i class="fa fa-trash-o"></i> 批量撤销</a> | ||
| 102 | - </li> | ||
| 103 | - <li class="divider"> </li> | ||
| 104 | - <li> | ||
| 105 | - <a href="javascript:;" class="retweet"><i class="fa fa-retweet"></i> 切换上下行</a> | ||
| 106 | - </li> | ||
| 107 | - <li class="divider"> </li> | ||
| 108 | - <li> | ||
| 109 | - <a href="javascript:;" id="wrenchUpDis"><i class="fa fa-wrench"></i> 设置上行站距</a> | ||
| 110 | - </li> | ||
| 111 | - <li class="divider"> </li> | ||
| 112 | - <li> | ||
| 113 | - <a href="javascript:;" id="batchUpdateIndustryCode"><i class="fa fa-wrench"></i> 设置站点行业编码</a> | ||
| 114 | - </li> | ||
| 115 | - <li class="divider"> </li> | ||
| 116 | - <li> | ||
| 117 | - <a href="javascript:;" id="quoteDown"><i class="fa fa-long-arrow-down"></i> 引用下行路段</a> | ||
| 118 | - </li> | ||
| 119 | - <!-- <li class="divider"> </li> | ||
| 120 | - <!-- <li> | ||
| 121 | - <a href="javascript:;" id="editUplineTrend"><i class="fa fa-edit"></i> 编辑走向</a> | ||
| 122 | - </li> --> | ||
| 123 | - <!-- <li> | ||
| 124 | - <a href="javascript:;" id="createUsingSingle"><i class="fa fa-edit"></i> 生成行单</a> | ||
| 125 | - </li> --> | ||
| 126 | - </ul> | ||
| 127 | - </div> | ||
| 128 | - </div> | ||
| 129 | - </div> | ||
| 130 | - </div> | ||
| 131 | - </div> | ||
| 132 | - </div> | ||
| 133 | - <!-- 树 --> | ||
| 134 | - <div class="portlet-body" > | ||
| 135 | - <div id="station_Up_tree" class="defeat-scroll" style="height: auto;max-height: 500px;"></div> | ||
| 136 | - </div> | ||
| 137 | - </div> | ||
| 138 | - <!-- 无上行站点添加方式 --> | ||
| 139 | - <div id="upToolsMobal" class="portlet-body" style="display:none"> | ||
| 140 | - <div class="row"> | ||
| 141 | - <div class="col-md-6" style="float: right;"> | ||
| 142 | - <div class="btn-group" style="float: right;"> | ||
| 143 | - <div class="actions"> | ||
| 144 | - <a href="javascript:" class="btn white btn-outline btn-circle" style="border-color: #3B3F51;color: #3B3F51;" data-toggle="dropdown" aria-expanded="false"> | ||
| 145 | - <i class="fa fa-share"></i> | ||
| 146 | - <span>上行规划选择</span> | ||
| 147 | - <i class="fa fa-angle-down"></i> | ||
| 148 | - </a> | ||
| 149 | - <ul class="dropdown-menu pull-right" style="min-width:100px"> | ||
| 150 | - <li> | ||
| 151 | - <a class="upManual" href="javascript:;" data-direction="0" data-pjax><i class="fa fa-pencil"></i> 手动添加站点</a> | ||
| 152 | - </li> | ||
| 153 | - <li class="divider"> </li> | ||
| 154 | - <li> | ||
| 155 | - <a class="upSystem" href="javascript:;" data-direction="0" data-pjax><i class="fa fa-wrench"></i> 系统规划</a> | ||
| 156 | - </li> | ||
| 157 | - <li class="divider"> </li> | ||
| 158 | - <li> | ||
| 159 | - <a class="gpsRoute" href="javascript:;" data-direction="0" data-pjax><i class="fa fa-wrench"></i> 测点生成</a> | ||
| 160 | - </li> | ||
| 161 | - </ul> | ||
| 162 | - </div> | ||
| 163 | - </div> | ||
| 164 | - </div> | ||
| 165 | - </div> | ||
| 166 | - <div class="row" style="margin-top: 10px;"> | ||
| 167 | - <div class="col-md-12"> | ||
| 168 | - <!-- 提示 --> | ||
| 169 | - <div class="alert alert-warning" style="background-color: #3b3f51;border-color: #FFFFFF;color: #ffffff;border-radius: 6px !important;"> | ||
| 170 | - <strong>系统未初始化该线路上行站点!</strong> 请从上方【上行规划选择】里选择任意一种方式规划该线路上行站点. | ||
| 171 | - </div> | ||
| 172 | - </div> | ||
| 173 | - </div> | ||
| 174 | - </div> | ||
| 175 | - | ||
| 176 | - </div> | ||
| 177 | - | ||
| 178 | - <!-- 下行 --> | ||
| 179 | - <div class="tab-pane fade" id="stationDown" data-direction="1"> | ||
| 180 | - <div class="portlet-body" id="DowntreeMobal" style="display: none"> | ||
| 181 | - <div class="table-toolbar"> | ||
| 182 | - <div class="row"> | ||
| 183 | - <div class="col-md-6" style="float: right;"> | ||
| 184 | - <div class="btn-group" style="float: right;"> | ||
| 185 | - <div class="actions module_tools"> | ||
| 186 | - <div class="btn-group"> | ||
| 187 | - <!-- <a class="btn green-haze btn-outline btn-circle btn-sm" style="background-color:#3B3F51;border-color:#FFFFFF;color:#FFFFFF" href="javascript:;" data-toggle="dropdown" data-hover="dropdown" data-close-others="true" aria-expanded="true"> 工具 | ||
| 188 | - <i class="fa fa-angle-down"></i> | ||
| 189 | - </a> --> | ||
| 190 | - <a href="javascript:" class="btn white btn-outline btn-circle" style="border-color: #3B3F51;color: #3B3F51;" data-toggle="dropdown" aria-expanded="false"> | ||
| 191 | - <i class="fa fa-share"></i> | ||
| 192 | - <span>下行操作</span> | ||
| 193 | - <i class="fa fa-angle-down"></i> | ||
| 194 | - </a> | ||
| 195 | - <ul class="dropdown-menu pull-right" style="min-width:100px"> | ||
| 196 | - <li> | ||
| 197 | - <a href="javascript:;" id="addDownStation"><i class="fa fa-plus"></i> 添加站点</a> | ||
| 198 | - </li> | ||
| 199 | - <li class="divider"> </li> | ||
| 200 | - <!--<li> | ||
| 201 | - <a href="javascript:;" id="editDownStation"><i class="fa fa-pencil"></i> 修改站点</a> | ||
| 202 | - </li> | ||
| 203 | - <li class="divider"> </li> | ||
| 204 | - <li> | ||
| 205 | - <a href="javascript:;" id="deleteDownStation"><i class="fa fa-close"></i> 撤销站点</a> | ||
| 206 | - </li> | ||
| 207 | - <li class="divider"> </li> | ||
| 208 | - <li> | ||
| 209 | - <a href="javascript:;" id="addDownSection"><i class="fa fa-plus"></i> 添加路段</a> | ||
| 210 | - </li> | ||
| 211 | - <li class="divider"> </li>--> | ||
| 212 | - <li> | ||
| 213 | - <a href="javascript:;" id="batchDownDelete"><i class="fa fa-trash-o"></i> 批量撤销</a> | ||
| 214 | - </li> | ||
| 215 | - <li class="divider"> </li> | ||
| 216 | - <li> | ||
| 217 | - <a href="javascript:;" class="retweet"><i class="fa fa-retweet"></i> 切换上下行</a> | ||
| 218 | - </li> | ||
| 219 | - <li class="divider"> </li> | ||
| 220 | - <li> | ||
| 221 | - <a href="javascript:;" id="wrenchDownDis"><i class="fa fa-wrench"></i> 设置下行站距</a> | ||
| 222 | - </li> | ||
| 223 | - <li class="divider"> </li> | ||
| 224 | - <li> | ||
| 225 | - <a href="javascript:;" id="batchDowndateIndustryCode"><i class="fa fa-wrench"></i> 设置站点行业编码</a> | ||
| 226 | - </li> | ||
| 227 | - <li class="divider"> </li> | ||
| 228 | - <li> | ||
| 229 | - <a href="javascript:;" id="quoteUp"><i class="fa fa-long-arrow-up"></i> 引用上行路段</a> | ||
| 230 | - </li> | ||
| 231 | - <!-- <li> | ||
| 232 | - <a href="javascript:;" id="editDownlineTrend"><i class="fa fa-close"></i> 编辑走向</a> | ||
| 233 | - </li> --> | ||
| 234 | - </ul> | ||
| 235 | - </div> | ||
| 236 | - </div> | ||
| 237 | - </div> | ||
| 238 | - </div> | ||
| 239 | - </div> | ||
| 240 | - </div> | ||
| 241 | - <!-- 树 --> | ||
| 242 | - <div class="portlet-body"> | ||
| 243 | - <div id="station_Down_tree" class="defeat-scroll" style="height: auto;max-height: 500px;"></div> | ||
| 244 | - </div> | ||
| 245 | - </div> | ||
| 246 | - <!-- 无上行站点添加方式 --> | ||
| 247 | - <div id="downToolsMobal" class="portlet-body" style="display:none"> | ||
| 248 | - <div class="row"> | ||
| 249 | - <div class="col-md-6" style="float: right;"> | ||
| 250 | - <div class="btn-group" style="float: right;"> | ||
| 251 | - <div class="actions"> | ||
| 252 | - <a href="javascript:" class="btn white btn-outline btn-circle" style="border-color: #3B3F51;color: #3B3F51;" data-toggle="dropdown" aria-expanded="false"> | ||
| 253 | - <i class="fa fa-share"></i> | ||
| 254 | - <span>下行规划选择</span> | ||
| 255 | - <i class="fa fa-angle-down"></i> | ||
| 256 | - </a> | ||
| 257 | - <ul class="dropdown-menu pull-right" style="min-width:100px"> | ||
| 258 | - <li> | ||
| 259 | - <a class="downManual" href="javascript:;" data-direction="1" data-pjax><i class="fa fa-pencil"></i> 手动添加站点</a> | ||
| 260 | - </li> | ||
| 261 | - <li class="divider"> </li> | ||
| 262 | - <li> | ||
| 263 | - <a class="downSystem" href="javascript:;" data-direction="1" data-pjax><i class="fa fa-wrench"></i> 系统规划</a> | ||
| 264 | - </li> | ||
| 265 | - <li class="divider"> </li> | ||
| 266 | - <li> | ||
| 267 | - <a class="gpsRoute" href="javascript:;" data-direction="1" data-pjax><i class="fa fa-wrench"></i> 测点生成</a> | ||
| 268 | - </li> | ||
| 269 | - </ul> | ||
| 270 | - </div> | ||
| 271 | - </div> | ||
| 272 | - </div> | ||
| 273 | - </div> | ||
| 274 | - <div class="row" style="margin-top: 10px;"> | ||
| 275 | - <div class="col-md-12"> | ||
| 276 | - <!-- 提示 --> | ||
| 277 | - <div class="alert alert-warning" style="background-color: #3b3f51;border-color: #FFFFFF;color: #ffffff;border-radius: 6px !important;"> | ||
| 278 | - <strong>系统未初始化该线路下行站点!</strong> 请从上方【下行规划选择】里选择任意一种方式规划该线路下行站点. | ||
| 279 | - </div> | ||
| 280 | - </div> | ||
| 281 | - </div> | ||
| 282 | - </div> | ||
| 283 | - </div> | ||
| 284 | - </div> | ||
| 285 | - </div> | ||
| 286 | - </div> | ||
| 287 | - </div> | ||
| 288 | - </div> | ||
| 289 | -</div> | ||
| 290 | -<!-- 线路类 --> | ||
| 291 | -<script src="/pages/base/stationroute/js/line.js"></script> | ||
| 292 | -<!-- 新增站点对象类 --> | ||
| 293 | -<script src="/pages/base/stationroute/js/addstationobj.js"></script> | ||
| 294 | -<!-- 修改站点对象类 --> | ||
| 295 | -<script src="/pages/base/stationroute/js/editstationobj.js"></script> | ||
| 296 | -<!-- 修改路段对象类 --> | ||
| 297 | -<script src="/pages/base/stationroute/js/editsection.js"></script> | ||
| 298 | -<!-- 批量撤销对象类 --> | ||
| 299 | -<script src="/pages/base/stationroute/js/deletebatch.js"></script> | ||
| 300 | -<!-- 绘图类 --> | ||
| 301 | -<script src="/pages/base/stationroute/js/drawingManager.js"></script> | ||
| 302 | -<!-- 地图类 --> | ||
| 303 | -<script src="/pages/base/stationroute/js/stationroute-list-map.js"></script> | ||
| 304 | -<!-- 函数与方法 --> | ||
| 305 | -<script src="/pages/base/stationroute/js/stationroute-list-function.js"></script> | ||
| 306 | -<!-- ajax请求类 --> | ||
| 307 | -<script src="/pages/base/stationroute/js/stationroute-ajax-getdata.js"></script> | ||
| 308 | -<!-- 树对类 --> | ||
| 309 | -<script src="/pages/base/stationroute/js/stationroute-list-treedata.js"></script> | ||
| 310 | -<!-- reload事件 --> | ||
| 311 | -<script src="/pages/base/stationroute/js/stationroute-list-reload.js"></script> | ||
| 312 | -<!-- 事件监听 --> | ||
| 313 | -<script src="/pages/base/stationroute/js/stationroute-list-events.js"></script> | ||
| 314 | - | ||
| 315 | -<script id="add_draw_polyline-temp" type="text/html"> | ||
| 316 | - <div class="add_road_search_point_wrap "> | ||
| 317 | - <div class="buffer_edit_body" > | ||
| 318 | - <div class="_title">绘制路段</div> | ||
| 319 | - <div class="form-horizontal" id="add_station_form"> | ||
| 320 | - <input type="hidden" value="{{id}}" name="id"> | ||
| 321 | - <input type="hidden" id="bsectionVectorInput"> <!--路段--> | ||
| 322 | - | ||
| 323 | - <div class="form-group"> | ||
| 324 | - <div class="col-md-12"> | ||
| 325 | - <input type="text" class="input-medium" name="sectionName" id="sectionNameInput" placeholder="路段名"> | ||
| 326 | - </div> | ||
| 327 | - </div> | ||
| 328 | - | ||
| 329 | - <div class="form-group"> | ||
| 330 | - <div class="col-md-5"> | ||
| 331 | - <span class="draw_polyline_switch"><a>暂停绘制</a></span> | ||
| 332 | - </div> | ||
| 333 | - <div class="col-md-6 btns"> | ||
| 334 | - <button class="sbmint-btn btn-sm" id="addSectionSbmintBtn">确定</button> | ||
| 335 | - <button class="cancel-btn btn-sm" id="addSectionCancelBtn">取消</button> | ||
| 336 | - </div> | ||
| 337 | - </div> | ||
| 338 | - </div> | ||
| 339 | - </div> | ||
| 340 | - </div> | ||
| 341 | -</script> | ||
| 342 | - | ||
| 343 | -<script type="text/javascript"> | ||
| 344 | - setTimeout(function () { | ||
| 345 | - // 百度地图API功能 | ||
| 346 | - function G(id) { | ||
| 347 | - return document.getElementById(id); | ||
| 348 | - } | ||
| 349 | - | ||
| 350 | - var myMap = WorldsBMap.getmapBValue(); | ||
| 351 | - | ||
| 352 | - var ac = new BMap.Autocomplete( //建立一个自动完成的对象 | ||
| 353 | - {"input" : "searchInput" | ||
| 354 | - ,"location" : myMap | ||
| 355 | - }); | ||
| 356 | - | ||
| 357 | - ac.addEventListener("onhighlight", function(e) { //鼠标放在下拉列表上的事件 | ||
| 358 | - var str = ""; | ||
| 359 | - var _value = e.fromitem.value; | ||
| 360 | - var value = ""; | ||
| 361 | - if (e.fromitem.index > -1) { | ||
| 362 | - value = _value.province + _value.city + _value.district + _value.street + _value.business; | ||
| 363 | - } | ||
| 364 | - str = "FromItem<br />index = " + e.fromitem.index + "<br />value = " + value; | ||
| 365 | - | ||
| 366 | - value = ""; | ||
| 367 | - if (e.toitem.index > -1) { | ||
| 368 | - _value = e.toitem.value; | ||
| 369 | - value = _value.province + _value.city + _value.district + _value.street + _value.business; | ||
| 370 | - } | ||
| 371 | - str += "<br />ToItem<br />index = " + e.toitem.index + "<br />value = " + value; | ||
| 372 | - G("searchResultPanel").innerHTML = str; | ||
| 373 | - }); | ||
| 374 | - | ||
| 375 | - var myValue; | ||
| 376 | - ac.addEventListener("onconfirm", function(e) { //鼠标点击下拉列表后的事件 | ||
| 377 | - var _value = e.item.value; | ||
| 378 | - myValue = _value.province + _value.city + _value.district + _value.street + _value.business; | ||
| 379 | - G("searchResultPanel").innerHTML ="onconfirm<br />index = " + e.item.index + "<br />myValue = " + myValue; | ||
| 380 | - | ||
| 381 | - setPlace(); | ||
| 382 | - }); | ||
| 383 | - | ||
| 384 | - function setPlace(){ | ||
| 385 | - // myMap.clearOverlays(); //清除地图上所有覆盖物 | ||
| 386 | - var local = new BMap.LocalSearch(myMap, { //智能搜索 | ||
| 387 | - onSearchComplete: myFun | ||
| 388 | - }); | ||
| 389 | - function myFun(){ | ||
| 390 | - var pp = local.getResults().getPoi(0) == undefined? null:local.getResults().getPoi(0).point; | ||
| 391 | - if(pp) { | ||
| 392 | - myMap.centerAndZoom(pp, 20); | ||
| 393 | - myMap.addOverlay(new BMap.Marker(pp)); //添加标注 | ||
| 394 | - } else { | ||
| 395 | - layer.msg('找不到您输入的位置!') | ||
| 396 | - } | ||
| 397 | - } | ||
| 398 | - local.search(myValue); | ||
| 399 | - } | ||
| 400 | - $("#searchInput").on('input propertychange change', function () { | ||
| 401 | - if($("#searchInput").val() != null && $("#searchInput").val() != "") | ||
| 402 | - $('.search_panel .clear').removeClass('hide'); | ||
| 403 | - else { | ||
| 404 | - // WorldsBMap.clearOtherOverlay(); | ||
| 405 | - $('.search_panel .clear').addClass('hide'); | ||
| 406 | - } | ||
| 407 | - }); | ||
| 408 | - | ||
| 409 | - $('.search_panel .clear').on('click',function () { | ||
| 410 | - // WorldsBMap.clearOtherOverlay(); | ||
| 411 | - $("#searchInput").val(''); | ||
| 412 | - $("#searchInput").change(); | ||
| 413 | - }); | ||
| 414 | - $('.search_panel .search_button').on('click',function () { | ||
| 415 | - myValue = $("#searchInput").val(); | ||
| 416 | - setPlace(); | ||
| 417 | - }); | ||
| 418 | - },1000); | 1 | +<link href="/pages/base/stationroute/css/bmap_base.css" rel="stylesheet" type="text/css" /> |
| 2 | +<link rel="stylesheet" href="/assets/plugins/layer-v2.4/layer/skin/layer.css"> | ||
| 3 | + | ||
| 4 | +<div class="mian-portlet-body"> | ||
| 5 | + <!-- 地图 --> | ||
| 6 | + <div id="bmap_basic" class="bmaps"></div> | ||
| 7 | + <!-- 搜索框 --> | ||
| 8 | + | ||
| 9 | + <div class="search_panel"> | ||
| 10 | + <div class="search_input_panel"> | ||
| 11 | + <input class="search_input" type="text" placeholder="输入位置搜索" id="searchInput"> | ||
| 12 | + <span class="fa fa-close fa-lg clear hide" aria-hidden="true"></span > | ||
| 13 | + </div> | ||
| 14 | + <div class="search_button_panel"> | ||
| 15 | + <button class="fa fa-search fa-lg search_button" > | ||
| 16 | + </button > | ||
| 17 | + </div> | ||
| 18 | + </div> | ||
| 19 | + <div class="esc_edit_div" id="esc_edit_div" style="display: none"> | ||
| 20 | + <button class="esc_edit_btn" >退出编辑模式 | ||
| 21 | + </button > | ||
| 22 | + </div> | ||
| 23 | + <!-- 搜索下拉框--> | ||
| 24 | + <div id="searchResultPanel" style="border:1px solid #C0C0C0;width:150px;height:auto; display:none;z-index: 199;"></div> | ||
| 25 | + <!-- 路径规划路段 --> | ||
| 26 | + <input class="hand" id="routePlanning" /> | ||
| 27 | + <div class="portlet box protlet-box"> | ||
| 28 | + <div class="protlet-box-layer"></div> | ||
| 29 | + <!-- 左边标题栏 --> | ||
| 30 | + <div class="portlet-title"> | ||
| 31 | + <div class="caption"> | ||
| 32 | + <!-- 途径站点 --> | ||
| 33 | + </div> | ||
| 34 | + | ||
| 35 | + <div class="versions" style="float:right;"> | ||
| 36 | + <select id="versions" style="height:30px;width:200px;margin-top:5px;"> </select> | ||
| 37 | + </div> | ||
| 38 | + | ||
| 39 | + | ||
| 40 | + <div class="match_station hidden"> | ||
| 41 | + <!--<div class="match_station hidden">--> | ||
| 42 | + <a class="match_station_bnt ">检测到外部站点行业编码有更新</a> | ||
| 43 | + </div> | ||
| 44 | + | ||
| 45 | + <!--<div class="tools"> | ||
| 46 | + <a href="javascript:;" class="collapse" data-original-title="" title=""> </a> | ||
| 47 | + </div>--> | ||
| 48 | + </div> | ||
| 49 | + <!-- 左边栏 --> | ||
| 50 | + <div class="portlet-body" id="scrllmouseEvent" style="border: 1px solid rgb(255, 255, 255); display: block;min-height: 520px;"> | ||
| 51 | + <div class="row"> | ||
| 52 | + <!-- 上下行栏 --> | ||
| 53 | + <div class="col-md-3 col-sm-3 col-xs-3"> | ||
| 54 | + <ul class="nav nav-tabs tabs-left" id="leftUpOrDown"> | ||
| 55 | + <li class="active"> | ||
| 56 | + <a href="#stationUp" data-toggle="tab" id="upLine" aria-expanded="true"> 上行 </a> | ||
| 57 | + </li> | ||
| 58 | + <li class=""> | ||
| 59 | + <a href="#stationDown" data-toggle="tab" id="downLine" aria-expanded="false"> 下行 </a> | ||
| 60 | + </li> | ||
| 61 | + <li class=""> | ||
| 62 | + <a href="#inoutCarpark" data-toggle="tab" id="inoutLine" aria-expanded="false"> 进出场路径 </a> | ||
| 63 | + </li> | ||
| 64 | + </ul> | ||
| 65 | + </div> | ||
| 66 | + <div class="col-md-9 col-sm-9 col-xs-9"> | ||
| 67 | + <div class="tab-content"> | ||
| 68 | + <!-- 左边栏上行 --> | ||
| 69 | + <div class="tab-pane active in" id="stationUp" data-direction="0"> | ||
| 70 | + <div class="portlet-body" id="uptreeMobal" style="display: none"> | ||
| 71 | + <div class="table-toolbar"> | ||
| 72 | + <div class="row"> | ||
| 73 | + | ||
| 74 | + <div class="col-md-6" style="float: right;"> | ||
| 75 | + <div class="btn-group" style="float: right;"> | ||
| 76 | + <div class="actions module_tools"> | ||
| 77 | + <div class="btn-group"> | ||
| 78 | + <!-- <a class="btn green-haze btn-outline btn-circle btn-sm" style="background-color:#3B3F51;border-color:#FFFFFF;color:#FFFFFF" href="javascript:;" data-toggle="dropdown" data-hover="dropdown" data-close-others="true" aria-expanded="true"> 工具 | ||
| 79 | + <i class="fa fa-angle-down"></i> | ||
| 80 | + </a> --> | ||
| 81 | + <a href="javascript:" class="btn white btn-outline btn-circle" style="border-color: #3B3F51;color: #3B3F51;" data-toggle="dropdown" aria-expanded="false"> | ||
| 82 | + <i class="fa fa-share"></i> | ||
| 83 | + <span>上行操作</span> | ||
| 84 | + <i class="fa fa-angle-down"></i> | ||
| 85 | + </a> | ||
| 86 | + <ul class="dropdown-menu pull-right" style="min-width:100px"> | ||
| 87 | + <li> | ||
| 88 | + <a href="javascript:;" id="addUpStation"><i class="fa fa-plus"></i> 添加站点</a> | ||
| 89 | + </li> | ||
| 90 | + <li class="divider"> </li> | ||
| 91 | + <!--<li> | ||
| 92 | + <a href="javascript:;" id="editUpStation"><i class="fa fa-pencil"></i> 修改站点</a> | ||
| 93 | + </li> | ||
| 94 | + <li class="divider"> </li> | ||
| 95 | + <li> | ||
| 96 | + <a href="javascript:;" id="deleteUpStation"><i class="fa fa-close"></i> 撤销站点</a> | ||
| 97 | + </li> | ||
| 98 | + <li class="divider"> </li> | ||
| 99 | + <li> | ||
| 100 | + <a href="javascript:;" id="addUpSection"><i class="fa fa-plus"></i> 添加路段</a> | ||
| 101 | + </li> | ||
| 102 | + <li class="divider"> </li>--> | ||
| 103 | + <li> | ||
| 104 | + <a href="javascript:;" id="batchUpDelete"><i class="fa fa-trash-o"></i> 批量撤销</a> | ||
| 105 | + </li> | ||
| 106 | + <li class="divider"> </li> | ||
| 107 | + <li> | ||
| 108 | + <a href="javascript:;" class="retweet"><i class="fa fa-retweet"></i> 切换上下行</a> | ||
| 109 | + </li> | ||
| 110 | + <li class="divider"> </li> | ||
| 111 | + <li> | ||
| 112 | + <a href="javascript:;" id="wrenchUpDis"><i class="fa fa-wrench"></i> 设置上行站距</a> | ||
| 113 | + </li> | ||
| 114 | + <li class="divider"> </li> | ||
| 115 | + <li> | ||
| 116 | + <a href="javascript:;" id="batchUpdateIndustryCode"><i class="fa fa-wrench"></i> 设置站点行业编码</a> | ||
| 117 | + </li> | ||
| 118 | + <li class="divider"> </li> | ||
| 119 | + <li> | ||
| 120 | + <a href="javascript:;" id="quoteDown"><i class="fa fa-long-arrow-down"></i> 引用下行路段</a> | ||
| 121 | + </li> | ||
| 122 | + <!-- <li class="divider"> </li> | ||
| 123 | + <!-- <li> | ||
| 124 | + <a href="javascript:;" id="editUplineTrend"><i class="fa fa-edit"></i> 编辑走向</a> | ||
| 125 | + </li> --> | ||
| 126 | + <!-- <li> | ||
| 127 | + <a href="javascript:;" id="createUsingSingle"><i class="fa fa-edit"></i> 生成行单</a> | ||
| 128 | + </li> --> | ||
| 129 | + </ul> | ||
| 130 | + </div> | ||
| 131 | + </div> | ||
| 132 | + </div> | ||
| 133 | + </div> | ||
| 134 | + </div> | ||
| 135 | + </div> | ||
| 136 | + <!-- 树 --> | ||
| 137 | + <div class="portlet-body" > | ||
| 138 | + <div id="station_Up_tree" class="defeat-scroll" style="height: auto;max-height: 500px;"></div> | ||
| 139 | + </div> | ||
| 140 | + </div> | ||
| 141 | + <!-- 无上行站点添加方式 --> | ||
| 142 | + <div id="upToolsMobal" class="portlet-body" style="display:none"> | ||
| 143 | + <div class="row"> | ||
| 144 | + <div class="col-md-6" style="float: right;"> | ||
| 145 | + <div class="btn-group" style="float: right;"> | ||
| 146 | + <div class="actions"> | ||
| 147 | + <a href="javascript:" class="btn white btn-outline btn-circle" style="border-color: #3B3F51;color: #3B3F51;" data-toggle="dropdown" aria-expanded="false"> | ||
| 148 | + <i class="fa fa-share"></i> | ||
| 149 | + <span>上行规划选择</span> | ||
| 150 | + <i class="fa fa-angle-down"></i> | ||
| 151 | + </a> | ||
| 152 | + <ul class="dropdown-menu pull-right" style="min-width:100px"> | ||
| 153 | + <li> | ||
| 154 | + <a class="upManual" href="javascript:;" data-direction="0" data-pjax><i class="fa fa-pencil"></i> 手动添加站点</a> | ||
| 155 | + </li> | ||
| 156 | + <li class="divider"> </li> | ||
| 157 | + <li> | ||
| 158 | + <a class="upSystem" href="javascript:;" data-direction="0" data-pjax><i class="fa fa-wrench"></i> 系统规划</a> | ||
| 159 | + </li> | ||
| 160 | + <li class="divider"> </li> | ||
| 161 | + <li> | ||
| 162 | + <a class="gpsRoute" href="javascript:;" data-direction="0" data-pjax><i class="fa fa-wrench"></i> 测点生成</a> | ||
| 163 | + </li> | ||
| 164 | + </ul> | ||
| 165 | + </div> | ||
| 166 | + </div> | ||
| 167 | + </div> | ||
| 168 | + </div> | ||
| 169 | + <div class="row" style="margin-top: 10px;"> | ||
| 170 | + <div class="col-md-12"> | ||
| 171 | + <!-- 提示 --> | ||
| 172 | + <div class="alert alert-warning" style="background-color: #3b3f51;border-color: #FFFFFF;color: #ffffff;border-radius: 6px !important;"> | ||
| 173 | + <strong>系统未初始化该线路上行站点!</strong> 请从上方【上行规划选择】里选择任意一种方式规划该线路上行站点. | ||
| 174 | + </div> | ||
| 175 | + </div> | ||
| 176 | + </div> | ||
| 177 | + </div> | ||
| 178 | + | ||
| 179 | + </div> | ||
| 180 | + | ||
| 181 | + <!-- 下行 --> | ||
| 182 | + <div class="tab-pane fade" id="stationDown" data-direction="1"> | ||
| 183 | + <div class="portlet-body" id="DowntreeMobal" style="display: none"> | ||
| 184 | + <div class="table-toolbar"> | ||
| 185 | + <div class="row"> | ||
| 186 | + <div class="col-md-6" style="float: right;"> | ||
| 187 | + <div class="btn-group" style="float: right;"> | ||
| 188 | + <div class="actions module_tools"> | ||
| 189 | + <div class="btn-group"> | ||
| 190 | + <!-- <a class="btn green-haze btn-outline btn-circle btn-sm" style="background-color:#3B3F51;border-color:#FFFFFF;color:#FFFFFF" href="javascript:;" data-toggle="dropdown" data-hover="dropdown" data-close-others="true" aria-expanded="true"> 工具 | ||
| 191 | + <i class="fa fa-angle-down"></i> | ||
| 192 | + </a> --> | ||
| 193 | + <a href="javascript:" class="btn white btn-outline btn-circle" style="border-color: #3B3F51;color: #3B3F51;" data-toggle="dropdown" aria-expanded="false"> | ||
| 194 | + <i class="fa fa-share"></i> | ||
| 195 | + <span>下行操作</span> | ||
| 196 | + <i class="fa fa-angle-down"></i> | ||
| 197 | + </a> | ||
| 198 | + <ul class="dropdown-menu pull-right" style="min-width:100px"> | ||
| 199 | + <li> | ||
| 200 | + <a href="javascript:;" id="addDownStation"><i class="fa fa-plus"></i> 添加站点</a> | ||
| 201 | + </li> | ||
| 202 | + <li class="divider"> </li> | ||
| 203 | + <!--<li> | ||
| 204 | + <a href="javascript:;" id="editDownStation"><i class="fa fa-pencil"></i> 修改站点</a> | ||
| 205 | + </li> | ||
| 206 | + <li class="divider"> </li> | ||
| 207 | + <li> | ||
| 208 | + <a href="javascript:;" id="deleteDownStation"><i class="fa fa-close"></i> 撤销站点</a> | ||
| 209 | + </li> | ||
| 210 | + <li class="divider"> </li> | ||
| 211 | + <li> | ||
| 212 | + <a href="javascript:;" id="addDownSection"><i class="fa fa-plus"></i> 添加路段</a> | ||
| 213 | + </li> | ||
| 214 | + <li class="divider"> </li>--> | ||
| 215 | + <li> | ||
| 216 | + <a href="javascript:;" id="batchDownDelete"><i class="fa fa-trash-o"></i> 批量撤销</a> | ||
| 217 | + </li> | ||
| 218 | + <li class="divider"> </li> | ||
| 219 | + <li> | ||
| 220 | + <a href="javascript:;" class="retweet"><i class="fa fa-retweet"></i> 切换上下行</a> | ||
| 221 | + </li> | ||
| 222 | + <li class="divider"> </li> | ||
| 223 | + <li> | ||
| 224 | + <a href="javascript:;" id="wrenchDownDis"><i class="fa fa-wrench"></i> 设置下行站距</a> | ||
| 225 | + </li> | ||
| 226 | + <li class="divider"> </li> | ||
| 227 | + <li> | ||
| 228 | + <a href="javascript:;" id="batchDowndateIndustryCode"><i class="fa fa-wrench"></i> 设置站点行业编码</a> | ||
| 229 | + </li> | ||
| 230 | + <li class="divider"> </li> | ||
| 231 | + <li> | ||
| 232 | + <a href="javascript:;" id="quoteUp"><i class="fa fa-long-arrow-up"></i> 引用上行路段</a> | ||
| 233 | + </li> | ||
| 234 | + <!-- <li> | ||
| 235 | + <a href="javascript:;" id="editDownlineTrend"><i class="fa fa-close"></i> 编辑走向</a> | ||
| 236 | + </li> --> | ||
| 237 | + </ul> | ||
| 238 | + </div> | ||
| 239 | + </div> | ||
| 240 | + </div> | ||
| 241 | + </div> | ||
| 242 | + </div> | ||
| 243 | + </div> | ||
| 244 | + <!-- 树 --> | ||
| 245 | + <div class="portlet-body"> | ||
| 246 | + <div id="station_Down_tree" class="defeat-scroll" style="height: auto;max-height: 500px;"></div> | ||
| 247 | + </div> | ||
| 248 | + </div> | ||
| 249 | + <!-- 无上行站点添加方式 --> | ||
| 250 | + <div id="downToolsMobal" class="portlet-body" style="display:none"> | ||
| 251 | + <div class="row"> | ||
| 252 | + <div class="col-md-6" style="float: right;"> | ||
| 253 | + <div class="btn-group" style="float: right;"> | ||
| 254 | + <div class="actions"> | ||
| 255 | + <a href="javascript:" class="btn white btn-outline btn-circle" style="border-color: #3B3F51;color: #3B3F51;" data-toggle="dropdown" aria-expanded="false"> | ||
| 256 | + <i class="fa fa-share"></i> | ||
| 257 | + <span>下行规划选择</span> | ||
| 258 | + <i class="fa fa-angle-down"></i> | ||
| 259 | + </a> | ||
| 260 | + <ul class="dropdown-menu pull-right" style="min-width:100px"> | ||
| 261 | + <li> | ||
| 262 | + <a class="downManual" href="javascript:;" data-direction="1" data-pjax><i class="fa fa-pencil"></i> 手动添加站点</a> | ||
| 263 | + </li> | ||
| 264 | + <li class="divider"> </li> | ||
| 265 | + <li> | ||
| 266 | + <a class="downSystem" href="javascript:;" data-direction="1" data-pjax><i class="fa fa-wrench"></i> 系统规划</a> | ||
| 267 | + </li> | ||
| 268 | + <li class="divider"> </li> | ||
| 269 | + <li> | ||
| 270 | + <a class="gpsRoute" href="javascript:;" data-direction="1" data-pjax><i class="fa fa-wrench"></i> 测点生成</a> | ||
| 271 | + </li> | ||
| 272 | + </ul> | ||
| 273 | + </div> | ||
| 274 | + </div> | ||
| 275 | + </div> | ||
| 276 | + </div> | ||
| 277 | + <div class="row" style="margin-top: 10px;"> | ||
| 278 | + <div class="col-md-12"> | ||
| 279 | + <!-- 提示 --> | ||
| 280 | + <div class="alert alert-warning" style="background-color: #3b3f51;border-color: #FFFFFF;color: #ffffff;border-radius: 6px !important;"> | ||
| 281 | + <strong>系统未初始化该线路下行站点!</strong> 请从上方【下行规划选择】里选择任意一种方式规划该线路下行站点. | ||
| 282 | + </div> | ||
| 283 | + </div> | ||
| 284 | + </div> | ||
| 285 | + </div> | ||
| 286 | + </div> | ||
| 287 | + | ||
| 288 | + <!-- 进出场路径 --> | ||
| 289 | + <div class="tab-pane fade" id="inoutCarpark" data-direction="3"> | ||
| 290 | + <div class="portlet-body" id="InoutCarparktreeMobal"> | ||
| 291 | + <div class="table-toolbar"> | ||
| 292 | + <div class="row"> | ||
| 293 | + <div class="col-md-6" style="float: right;"> | ||
| 294 | + <div class="btn-group" style="float: right;"> | ||
| 295 | + <div class="actions module_tools"> | ||
| 296 | + <div class="btn-group"> | ||
| 297 | + <!-- <a class="btn green-haze btn-outline btn-circle btn-sm" style="background-color:#3B3F51;border-color:#FFFFFF;color:#FFFFFF" href="javascript:;" data-toggle="dropdown" data-hover="dropdown" data-close-others="true" aria-expanded="true"> 工具 | ||
| 298 | + <i class="fa fa-angle-down"></i> | ||
| 299 | + </a> --> | ||
| 300 | + <a href="javascript:" class="btn white btn-outline btn-circle" style="border-color: #3B3F51;color: #3B3F51;" data-toggle="dropdown" aria-expanded="false"> | ||
| 301 | + <i class="fa fa-share"></i> | ||
| 302 | + <span>进出场路径规划</span> | ||
| 303 | + <i class="fa fa-angle-down"></i> | ||
| 304 | + </a> | ||
| 305 | + <ul class="dropdown-menu pull-right" style="min-width:100px"> | ||
| 306 | + <li> | ||
| 307 | + <a href="javascript:;" id="historyGps"><i class="fa fa-wrench"></i> 历史GPS路径规划</a> | ||
| 308 | + </li> | ||
| 309 | + </ul> | ||
| 310 | + </div> | ||
| 311 | + </div> | ||
| 312 | + </div> | ||
| 313 | + </div> | ||
| 314 | + </div> | ||
| 315 | + </div> | ||
| 316 | + <!-- 树 --> | ||
| 317 | + <div class="portlet-body inout-search"></div> | ||
| 318 | + <div class="portlet-body"> | ||
| 319 | + <div id="inout_carpark_tree" class="defeat-scroll" style="height: auto;max-height: 500px;"></div> | ||
| 320 | + </div> | ||
| 321 | + </div> | ||
| 322 | + </div> | ||
| 323 | + </div> | ||
| 324 | + </div> | ||
| 325 | + </div> | ||
| 326 | + </div> | ||
| 327 | + </div> | ||
| 328 | +</div> | ||
| 329 | +<!-- 线路类 --> | ||
| 330 | +<script src="/pages/base/stationroute/js/line.js"></script> | ||
| 331 | +<!-- 新增站点对象类 --> | ||
| 332 | +<script src="/pages/base/stationroute/js/addstationobj.js"></script> | ||
| 333 | +<!-- 修改站点对象类 --> | ||
| 334 | +<script src="/pages/base/stationroute/js/editstationobj.js"></script> | ||
| 335 | +<!-- 修改路段对象类 --> | ||
| 336 | +<script src="/pages/base/stationroute/js/editsection.js"></script> | ||
| 337 | +<!-- 批量撤销对象类 --> | ||
| 338 | +<script src="/pages/base/stationroute/js/deletebatch.js"></script> | ||
| 339 | +<!-- 绘图类 --> | ||
| 340 | +<script src="/pages/base/stationroute/js/drawingManager.js"></script> | ||
| 341 | +<!-- 地图类 --> | ||
| 342 | +<script src="/pages/base/stationroute/js/stationroute-list-map.js"></script> | ||
| 343 | +<!-- 函数与方法 --> | ||
| 344 | +<script src="/pages/base/stationroute/js/stationroute-list-function.js"></script> | ||
| 345 | +<!-- ajax请求类 --> | ||
| 346 | +<script src="/pages/base/stationroute/js/stationroute-ajax-getdata.js"></script> | ||
| 347 | +<!-- 树对类 --> | ||
| 348 | +<script src="/pages/base/stationroute/js/stationroute-list-treedata.js"></script> | ||
| 349 | +<!-- reload事件 --> | ||
| 350 | +<script src="/pages/base/stationroute/js/stationroute-list-reload.js"></script> | ||
| 351 | +<!-- 事件监听 --> | ||
| 352 | +<script src="/pages/base/stationroute/js/stationroute-list-events.js"></script> | ||
| 353 | + | ||
| 354 | +<script id="add_draw_polyline-temp" type="text/html"> | ||
| 355 | + <div class="add_road_search_point_wrap "> | ||
| 356 | + <div class="buffer_edit_body" > | ||
| 357 | + <div class="_title">绘制路段</div> | ||
| 358 | + <div class="form-horizontal" id="add_station_form"> | ||
| 359 | + <input type="hidden" value="{{id}}" name="id"> | ||
| 360 | + <input type="hidden" id="bsectionVectorInput"> <!--路段--> | ||
| 361 | + | ||
| 362 | + <div class="form-group"> | ||
| 363 | + <div class="col-md-12"> | ||
| 364 | + <input type="text" class="input-medium" name="sectionName" id="sectionNameInput" placeholder="路段名"> | ||
| 365 | + </div> | ||
| 366 | + </div> | ||
| 367 | + | ||
| 368 | + <div class="form-group"> | ||
| 369 | + <div class="col-md-5"> | ||
| 370 | + <span class="draw_polyline_switch"><a>暂停绘制</a></span> | ||
| 371 | + </div> | ||
| 372 | + <div class="col-md-6 btns"> | ||
| 373 | + <button class="sbmint-btn btn-sm" id="addSectionSbmintBtn">确定</button> | ||
| 374 | + <button class="cancel-btn btn-sm" id="addSectionCancelBtn">取消</button> | ||
| 375 | + </div> | ||
| 376 | + </div> | ||
| 377 | + </div> | ||
| 378 | + </div> | ||
| 379 | + </div> | ||
| 380 | +</script> | ||
| 381 | + | ||
| 382 | +<script id="inout-carpark-search-form" type="text/html"> | ||
| 383 | + <div class="form-horizontal"> | ||
| 384 | + <div class="form-group"> | ||
| 385 | + <div class="col-md-3 col-sm-3 col-xs-3"> | ||
| 386 | + <label class="uk-form-label">起点</label> | ||
| 387 | + </div> | ||
| 388 | + <div class="col-md-9 col-sm-9 col-xs-9"> | ||
| 389 | + <select class="form-control" name="startPoint" id="startPoint"></select> | ||
| 390 | + </div> | ||
| 391 | + </div> | ||
| 392 | + <div class="form-group"> | ||
| 393 | + <div class="col-md-3 col-sm-3 col-xs-3"> | ||
| 394 | + <label class="uk-form-label">终点</label> | ||
| 395 | + </div> | ||
| 396 | + <div class="col-md-9 col-sm-9 col-xs-9"> | ||
| 397 | + <select class="form-control" name="endPoint" id="endPoint"></select> | ||
| 398 | + </div> | ||
| 399 | + </div> | ||
| 400 | + <div class="form-group"> | ||
| 401 | + <div class="col-md-6"></div> | ||
| 402 | + <div class="col-md-6 btns"> | ||
| 403 | + <button class="btn-sm" style="float: right;" id="inoutSearch">搜索</button> | ||
| 404 | + </div> | ||
| 405 | + </div> | ||
| 406 | + </div> | ||
| 407 | +</script> | ||
| 408 | + | ||
| 409 | +<script type="text/javascript"> | ||
| 410 | + setTimeout(function () { | ||
| 411 | + // 百度地图API功能 | ||
| 412 | + function G(id) { | ||
| 413 | + return document.getElementById(id); | ||
| 414 | + } | ||
| 415 | + | ||
| 416 | + var myMap = WorldsBMap.getmapBValue(); | ||
| 417 | + | ||
| 418 | + var ac = new BMap.Autocomplete( //建立一个自动完成的对象 | ||
| 419 | + {"input" : "searchInput" | ||
| 420 | + ,"location" : myMap | ||
| 421 | + }); | ||
| 422 | + | ||
| 423 | + ac.addEventListener("onhighlight", function(e) { //鼠标放在下拉列表上的事件 | ||
| 424 | + var str = ""; | ||
| 425 | + var _value = e.fromitem.value; | ||
| 426 | + var value = ""; | ||
| 427 | + if (e.fromitem.index > -1) { | ||
| 428 | + value = _value.province + _value.city + _value.district + _value.street + _value.business; | ||
| 429 | + } | ||
| 430 | + str = "FromItem<br />index = " + e.fromitem.index + "<br />value = " + value; | ||
| 431 | + | ||
| 432 | + value = ""; | ||
| 433 | + if (e.toitem.index > -1) { | ||
| 434 | + _value = e.toitem.value; | ||
| 435 | + value = _value.province + _value.city + _value.district + _value.street + _value.business; | ||
| 436 | + } | ||
| 437 | + str += "<br />ToItem<br />index = " + e.toitem.index + "<br />value = " + value; | ||
| 438 | + G("searchResultPanel").innerHTML = str; | ||
| 439 | + }); | ||
| 440 | + | ||
| 441 | + var myValue; | ||
| 442 | + ac.addEventListener("onconfirm", function(e) { //鼠标点击下拉列表后的事件 | ||
| 443 | + var _value = e.item.value; | ||
| 444 | + myValue = _value.province + _value.city + _value.district + _value.street + _value.business; | ||
| 445 | + G("searchResultPanel").innerHTML ="onconfirm<br />index = " + e.item.index + "<br />myValue = " + myValue; | ||
| 446 | + | ||
| 447 | + setPlace(); | ||
| 448 | + }); | ||
| 449 | + | ||
| 450 | + function setPlace(){ | ||
| 451 | + // myMap.clearOverlays(); //清除地图上所有覆盖物 | ||
| 452 | + var local = new BMap.LocalSearch(myMap, { //智能搜索 | ||
| 453 | + onSearchComplete: myFun | ||
| 454 | + }); | ||
| 455 | + function myFun(){ | ||
| 456 | + var pp = local.getResults().getPoi(0) == undefined? null:local.getResults().getPoi(0).point; | ||
| 457 | + if(pp) { | ||
| 458 | + myMap.centerAndZoom(pp, 20); | ||
| 459 | + myMap.addOverlay(new BMap.Marker(pp)); //添加标注 | ||
| 460 | + } else { | ||
| 461 | + layer.msg('找不到您输入的位置!') | ||
| 462 | + } | ||
| 463 | + } | ||
| 464 | + local.search(myValue); | ||
| 465 | + } | ||
| 466 | + $("#searchInput").on('input propertychange change', function () { | ||
| 467 | + if($("#searchInput").val() != null && $("#searchInput").val() != "") | ||
| 468 | + $('.search_panel .clear').removeClass('hide'); | ||
| 469 | + else { | ||
| 470 | + // WorldsBMap.clearOtherOverlay(); | ||
| 471 | + $('.search_panel .clear').addClass('hide'); | ||
| 472 | + } | ||
| 473 | + }); | ||
| 474 | + | ||
| 475 | + $('.search_panel .clear').on('click',function () { | ||
| 476 | + // WorldsBMap.clearOtherOverlay(); | ||
| 477 | + $("#searchInput").val(''); | ||
| 478 | + $("#searchInput").change(); | ||
| 479 | + }); | ||
| 480 | + $('.search_panel .search_button').on('click',function () { | ||
| 481 | + myValue = $("#searchInput").val(); | ||
| 482 | + setPlace(); | ||
| 483 | + }); | ||
| 484 | + | ||
| 485 | + $('#historyGps').on('click', function() { | ||
| 486 | + $.get('/pages/base/stationroute/list_template.html', function (content) { | ||
| 487 | + window.layerIdx = layer.open({ | ||
| 488 | + type: 1, | ||
| 489 | + move: false, | ||
| 490 | + area: ['800px', '600px'], | ||
| 491 | + content: content, | ||
| 492 | + title: '选择班次(为前一天班次,请选择GPS自动完成的班次)', | ||
| 493 | + shift: 5, | ||
| 494 | + scrollbar: false, | ||
| 495 | + success: function () { | ||
| 496 | + } | ||
| 497 | + }); | ||
| 498 | + }); | ||
| 499 | + }); | ||
| 500 | + },1000); | ||
| 419 | </script> | 501 | </script> |
| 420 | \ No newline at end of file | 502 | \ No newline at end of file |
src/main/resources/static/pages/base/stationroute/list_template.html
0 → 100644
| 1 | +<div className="row"> | ||
| 2 | + <div className="col-md-12"> | ||
| 3 | + <!-- BEGIN VALIDATION STATES--> | ||
| 4 | + <div className="portlet light portlet-fit portlet-form bordered"> | ||
| 5 | + <div className="portlet-body"> | ||
| 6 | + <div class="table-container" style="margin-top: 10px"> | ||
| 7 | + <table class="table table-striped table-bordered table-hover table-checkable" id="datatable_waybill_choose"> | ||
| 8 | + <thead> | ||
| 9 | + <tr role="row" class="heading"> | ||
| 10 | + <th width="10%">序号</th> | ||
| 11 | + <th width="18%">线路名称</th> | ||
| 12 | + <th width="18%">起点</th> | ||
| 13 | + <th width="18%">终点</th> | ||
| 14 | + <th width="18%">实际发车时间</th> | ||
| 15 | + <th width="18%">实际到达时间</th> | ||
| 16 | + </tr> | ||
| 17 | + </thead> | ||
| 18 | + <tbody></tbody> | ||
| 19 | + </table> | ||
| 20 | + </div> | ||
| 21 | + </div> | ||
| 22 | + </div> | ||
| 23 | + </div> | ||
| 24 | +</div> | ||
| 25 | +<script type="text/html" id="waybill_choose_template"> | ||
| 26 | + {{each list as obj i }} | ||
| 27 | + <tr> | ||
| 28 | + <td style="vertical-align: middle;"> | ||
| 29 | + <input type="radio" class="group-checkable icheck" name="waybillRadio" data-id="{{obj.id}}"> | ||
| 30 | + </td> | ||
| 31 | + <td style="vertical-align: middle;"> | ||
| 32 | + {{obj.xlName}} | ||
| 33 | + </td> | ||
| 34 | + <td> | ||
| 35 | + {{obj.qdzName}} | ||
| 36 | + </td> | ||
| 37 | + <td> | ||
| 38 | + {{obj.zdzName}} | ||
| 39 | + </td> | ||
| 40 | + <td> | ||
| 41 | + {{obj.fcsjActual}} | ||
| 42 | + </td> | ||
| 43 | + <td> | ||
| 44 | + {{obj.zdsjActual}} | ||
| 45 | + </td> | ||
| 46 | + </tr> | ||
| 47 | + {{/each}} | ||
| 48 | + {{if list.length == 0}} | ||
| 49 | + <tr> | ||
| 50 | + <td colspan="6"><h6 class="muted">没有找到相关数据</h6></td> | ||
| 51 | + </tr> | ||
| 52 | + {{/if}} | ||
| 53 | +</script> | ||
| 54 | +<script> | ||
| 55 | + $(function () { | ||
| 56 | + // 异步请求获取表格数据 | ||
| 57 | + var params = {}; | ||
| 58 | + params.qdzCode_eq = $('#startPoint').val().split('_')[0]; | ||
| 59 | + params.zdzCode_eq = $('#endPoint').val().split('_')[0]; | ||
| 60 | + params.xlBm_eq = LineObj.getLineObj().id; | ||
| 61 | + $.ajax({ | ||
| 62 | + url: "/real_control_v2/assets/imgs/time.gif", | ||
| 63 | + type: "HEAD", | ||
| 64 | + async: false, | ||
| 65 | + success: function(result,status,xhr) { | ||
| 66 | + params.scheduleDateStr_eq = moment(xhr.getResponseHeader("Date")).add(-1, 'days').format('YYYY-MM-DD'); | ||
| 67 | + } | ||
| 68 | + }) | ||
| 69 | + $.get('/realSchedule/all',params,function(result){ | ||
| 70 | + // 把数据填充到模版中 | ||
| 71 | + var tbodyHtml = template('waybill_choose_template',{list:result}); | ||
| 72 | + // 把渲染好的模版html文本追加到表格中 | ||
| 73 | + $('#datatable_waybill_choose tbody').html(tbodyHtml); | ||
| 74 | + $("input[name='waybillRadio']").change(function () { | ||
| 75 | + $.post('/inout/pathPlaningByHistory', {schId: $(this).data('id'), version: $("#versions").val()}, function (result1) { | ||
| 76 | + layer.msg('路径规划已完成'); | ||
| 77 | + // 刷新左边树 | ||
| 78 | + $('#inoutSearch').click(); | ||
| 79 | + layer.close(window.layerIdx); | ||
| 80 | + }); | ||
| 81 | + }); | ||
| 82 | + }); | ||
| 83 | + }); | ||
| 84 | +</script> | ||
| 0 | \ No newline at end of file | 85 | \ No newline at end of file |
src/main/resources/static/pages/forms/budget/budgetAmounts.html
| @@ -269,6 +269,39 @@ | @@ -269,6 +269,39 @@ | ||
| 269 | params['type'] = "query"; | 269 | params['type'] = "query"; |
| 270 | var i = layer.load(2); | 270 | var i = layer.load(2); |
| 271 | $post('/budget/budgetAmounts',params,function(result){ | 271 | $post('/budget/budgetAmounts',params,function(result){ |
| 272 | +// $(result).each(function(ii, ee){ | ||
| 273 | +// for(var kk in ee){ | ||
| 274 | +// if(kk != "key" && kk != "dataList" && kk.indexOf("com") < 0 && parseFloat(ee[kk])){ | ||
| 275 | +// var bb = "", cc = ee[kk] + ""; | ||
| 276 | +// if(cc.indexOf("%") > -1){ | ||
| 277 | +// bb = "%"; | ||
| 278 | +// } | ||
| 279 | +// var dd = 0; | ||
| 280 | +// $(ee.dataList).each(function(jj, ff){ | ||
| 281 | +// if(parseFloat(ff[kk])){ | ||
| 282 | +// dd += parseFloat(ff[kk]); | ||
| 283 | +// } | ||
| 284 | +// }); | ||
| 285 | +// var aa = parseFloat(dd); | ||
| 286 | +// ee[kk] = parseFloat(aa.toFixed(3))+bb; | ||
| 287 | +// } | ||
| 288 | +// } | ||
| 289 | +// for(var yy = 0; yy <= 12; yy++){ | ||
| 290 | +// var mon = "mon"+yy, bud = "bud"+yy, com = "com"+yy; | ||
| 291 | +// if(yy == 0){ | ||
| 292 | +// mon = "monAll"; | ||
| 293 | +// bud = "formal"; | ||
| 294 | +// com = "complete"; | ||
| 295 | +// } | ||
| 296 | +// if(ee[mon] > 0 && parseFloat(ee[mon]) && parseFloat(ee[bud])){ | ||
| 297 | +// var comV = (parseFloat(ee[mon]) / parseFloat(ee[bud]) * 100).toFixed(2) + "%"; | ||
| 298 | +// ee[com] = comV; | ||
| 299 | +// } else { | ||
| 300 | +// ee[com] = "0%"; | ||
| 301 | +// } | ||
| 302 | + | ||
| 303 | +// } | ||
| 304 | +// }); | ||
| 272 | layer.close(i); | 305 | layer.close(i); |
| 273 | // 把数据填充到模版中 | 306 | // 把数据填充到模版中 |
| 274 | var tbodyHtml = template('budget_amounts',{list:result}); | 307 | var tbodyHtml = template('budget_amounts',{list:result}); |
| @@ -292,6 +325,18 @@ | @@ -292,6 +325,18 @@ | ||
| 292 | $.each(resList, function(i, g){ | 325 | $.each(resList, function(i, g){ |
| 293 | if(key == g.key){ | 326 | if(key == g.key){ |
| 294 | var dataList = g.dataList; | 327 | var dataList = g.dataList; |
| 328 | +// $(dataList).each(function(ii, ee){ | ||
| 329 | +// for(var kk in ee){ | ||
| 330 | +// if(kk != "xlName" && parseFloat(ee[kk])){ | ||
| 331 | +// var bb = "", cc = ee[kk] + ""; | ||
| 332 | +// if(cc.indexOf("%") > -1){ | ||
| 333 | +// bb = "%"; | ||
| 334 | +// } | ||
| 335 | +// var aa = parseFloat(ee[kk]); | ||
| 336 | +// ee[kk] = parseFloat(aa.toFixed(3))+bb; | ||
| 337 | +// } | ||
| 338 | +// } | ||
| 339 | +// }); | ||
| 295 | var tbodyHtml = template('budget_amounts_dataList', {list:dataList}); | 340 | var tbodyHtml = template('budget_amounts_dataList', {list:dataList}); |
| 296 | $("#datas_hidden").removeClass("hidden"); | 341 | $("#datas_hidden").removeClass("hidden"); |
| 297 | $("#datas_hidden").height($(window).height()-280); | 342 | $("#datas_hidden").height($(window).height()-280); |
src/main/resources/static/pages/forms/budget/budgetMileage.html
| @@ -267,6 +267,39 @@ | @@ -267,6 +267,39 @@ | ||
| 267 | params['type'] = "query"; | 267 | params['type'] = "query"; |
| 268 | var i = layer.load(2); | 268 | var i = layer.load(2); |
| 269 | $post('/budget/budgetMileage',params,function(result){ | 269 | $post('/budget/budgetMileage',params,function(result){ |
| 270 | +// $(result).each(function(ii, ee){ | ||
| 271 | +// for(var kk in ee){ | ||
| 272 | +// if(kk != "key" && kk != "dataList" && kk.indexOf("com") < 0 && parseFloat(ee[kk])){ | ||
| 273 | +// var bb = "", cc = ee[kk] + ""; | ||
| 274 | +// if(cc.indexOf("%") > -1){ | ||
| 275 | +// bb = "%"; | ||
| 276 | +// } | ||
| 277 | +// var dd = 0; | ||
| 278 | +// $(ee.dataList).each(function(jj, ff){ | ||
| 279 | +// if(parseFloat(ff[kk])){ | ||
| 280 | +// dd += parseFloat(ff[kk]); | ||
| 281 | +// } | ||
| 282 | +// }); | ||
| 283 | +// var aa = parseFloat(dd); | ||
| 284 | +// ee[kk] = parseFloat(aa.toFixed(3))+bb; | ||
| 285 | +// } | ||
| 286 | +// } | ||
| 287 | +// for(var yy = 0; yy <= 12; yy++){ | ||
| 288 | +// var mon = "mon"+yy, bud = "bud"+yy, com = "com"+yy; | ||
| 289 | +// if(yy == 0){ | ||
| 290 | +// mon = "monAll"; | ||
| 291 | +// bud = "formal"; | ||
| 292 | +// com = "complete"; | ||
| 293 | +// } | ||
| 294 | +// if(ee[mon] > 0 && parseFloat(ee[mon]) && parseFloat(ee[bud])){ | ||
| 295 | +// var comV = (parseFloat(ee[mon]) / parseFloat(ee[bud]) * 100).toFixed(2) + "%"; | ||
| 296 | +// ee[com] = comV; | ||
| 297 | +// } else { | ||
| 298 | +// ee[com] = "0%"; | ||
| 299 | +// } | ||
| 300 | + | ||
| 301 | +// } | ||
| 302 | +// }); | ||
| 270 | layer.close(i); | 303 | layer.close(i); |
| 271 | // 把数据填充到模版中 | 304 | // 把数据填充到模版中 |
| 272 | var tbodyHtml = template('budget_mileage',{list:result}); | 305 | var tbodyHtml = template('budget_mileage',{list:result}); |
| @@ -290,6 +323,18 @@ | @@ -290,6 +323,18 @@ | ||
| 290 | $.each(resList, function(i, g){ | 323 | $.each(resList, function(i, g){ |
| 291 | if(key == g.key){ | 324 | if(key == g.key){ |
| 292 | var dataList = g.dataList; | 325 | var dataList = g.dataList; |
| 326 | +// $(dataList).each(function(ii, ee){ | ||
| 327 | +// for(var kk in ee){ | ||
| 328 | +// if(kk != "xlName" && parseFloat(ee[kk])){ | ||
| 329 | +// var bb = "", cc = ee[kk] + ""; | ||
| 330 | +// if(cc.indexOf("%") > -1){ | ||
| 331 | +// bb = "%"; | ||
| 332 | +// } | ||
| 333 | +// var aa = parseFloat(ee[kk]); | ||
| 334 | +// ee[kk] = parseFloat(aa.toFixed(3))+bb; | ||
| 335 | +// } | ||
| 336 | +// } | ||
| 337 | +// }); | ||
| 293 | var tbodyHtml = template('budget_mileage_dataList', {list:dataList}); | 338 | var tbodyHtml = template('budget_mileage_dataList', {list:dataList}); |
| 294 | $("#datas_hidden").removeClass("hidden"); | 339 | $("#datas_hidden").removeClass("hidden"); |
| 295 | $("#datas_hidden").height($(window).height()-280); | 340 | $("#datas_hidden").height($(window).height()-280); |
src/main/resources/static/pages/forms/budget/budgetPerson.html
| @@ -267,6 +267,39 @@ | @@ -267,6 +267,39 @@ | ||
| 267 | params['type'] = "query"; | 267 | params['type'] = "query"; |
| 268 | var i = layer.load(2); | 268 | var i = layer.load(2); |
| 269 | $post('/budget/budgetPerson',params,function(result){ | 269 | $post('/budget/budgetPerson',params,function(result){ |
| 270 | +// $(result).each(function(ii, ee){ | ||
| 271 | +// for(var kk in ee){ | ||
| 272 | +// if(kk != "key" && kk != "dataList" && kk.indexOf("com") < 0 && parseFloat(ee[kk])){ | ||
| 273 | +// var bb = "", cc = ee[kk] + ""; | ||
| 274 | +// if(cc.indexOf("%") > -1){ | ||
| 275 | +// bb = "%"; | ||
| 276 | +// } | ||
| 277 | +// var dd = 0; | ||
| 278 | +// $(ee.dataList).each(function(jj, ff){ | ||
| 279 | +// if(parseFloat(ff[kk])){ | ||
| 280 | +// dd += parseFloat(ff[kk]); | ||
| 281 | +// } | ||
| 282 | +// }); | ||
| 283 | +// var aa = parseFloat(dd); | ||
| 284 | +// ee[kk] = parseFloat(aa.toFixed(3))+bb; | ||
| 285 | +// } | ||
| 286 | +// } | ||
| 287 | +// for(var yy = 0; yy <= 12; yy++){ | ||
| 288 | +// var mon = "mon"+yy, bud = "bud"+yy, com = "com"+yy; | ||
| 289 | +// if(yy == 0){ | ||
| 290 | +// mon = "monAll"; | ||
| 291 | +// bud = "formal"; | ||
| 292 | +// com = "complete"; | ||
| 293 | +// } | ||
| 294 | +// if(ee[mon] > 0 && parseFloat(ee[mon]) && parseFloat(ee[bud])){ | ||
| 295 | +// var comV = (parseFloat(ee[mon]) / parseFloat(ee[bud]) * 100).toFixed(2) + "%"; | ||
| 296 | +// ee[com] = comV; | ||
| 297 | +// } else { | ||
| 298 | +// ee[com] = "0%"; | ||
| 299 | +// } | ||
| 300 | + | ||
| 301 | +// } | ||
| 302 | +// }); | ||
| 270 | layer.close(i); | 303 | layer.close(i); |
| 271 | // 把数据填充到模版中 | 304 | // 把数据填充到模版中 |
| 272 | var tbodyHtml = template('budget_person',{list:result}); | 305 | var tbodyHtml = template('budget_person',{list:result}); |
| @@ -290,6 +323,18 @@ | @@ -290,6 +323,18 @@ | ||
| 290 | $.each(resList, function(i, g){ | 323 | $.each(resList, function(i, g){ |
| 291 | if(key == g.key){ | 324 | if(key == g.key){ |
| 292 | var dataList = g.dataList; | 325 | var dataList = g.dataList; |
| 326 | +// $(dataList).each(function(ii, ee){ | ||
| 327 | +// for(var kk in ee){ | ||
| 328 | +// if(kk != "xlName" && parseFloat(ee[kk])){ | ||
| 329 | +// var bb = "", cc = ee[kk] + ""; | ||
| 330 | +// if(cc.indexOf("%") > -1){ | ||
| 331 | +// bb = "%"; | ||
| 332 | +// } | ||
| 333 | +// var aa = parseFloat(ee[kk]); | ||
| 334 | +// ee[kk] = parseFloat(aa.toFixed(3))+bb; | ||
| 335 | +// } | ||
| 336 | +// } | ||
| 337 | +// }); | ||
| 293 | var tbodyHtml = template('budget_person_dataList', {list:dataList}); | 338 | var tbodyHtml = template('budget_person_dataList', {list:dataList}); |
| 294 | $("#datas_hidden").removeClass("hidden"); | 339 | $("#datas_hidden").removeClass("hidden"); |
| 295 | $("#datas_hidden").height($(window).height()-280); | 340 | $("#datas_hidden").height($(window).height()-280); |
src/main/resources/static/pages/forms/budget/budgetSum.html
| @@ -277,6 +277,39 @@ | @@ -277,6 +277,39 @@ | ||
| 277 | params['type'] = "query"; | 277 | params['type'] = "query"; |
| 278 | var i = layer.load(2); | 278 | var i = layer.load(2); |
| 279 | $post('/budget/budgetSum',params,function(result){ | 279 | $post('/budget/budgetSum',params,function(result){ |
| 280 | +// $(result).each(function(ii, ee){ | ||
| 281 | +// for(var kk in ee){ | ||
| 282 | +// if(kk != "key" && kk != "dataList" && kk.indexOf("com") < 0 && parseFloat(ee[kk])){ | ||
| 283 | +// var bb = "", cc = ee[kk] + ""; | ||
| 284 | +// if(cc.indexOf("%") > -1){ | ||
| 285 | +// bb = "%"; | ||
| 286 | +// } | ||
| 287 | +// var dd = 0; | ||
| 288 | +// $(ee.dataList).each(function(jj, ff){ | ||
| 289 | +// if(parseFloat(ff[kk])){ | ||
| 290 | +// dd += parseFloat(ff[kk]); | ||
| 291 | +// } | ||
| 292 | +// }); | ||
| 293 | +// var aa = parseFloat(dd); | ||
| 294 | +// ee[kk] = parseFloat(aa.toFixed(3))+bb; | ||
| 295 | +// } | ||
| 296 | +// } | ||
| 297 | +// for(var yy = 0; yy <= 12; yy++){ | ||
| 298 | +// var mon = "mon"+yy, bud = "bud"+yy, com = "com"+yy; | ||
| 299 | +// if(yy == 0){ | ||
| 300 | +// mon = "monAll"; | ||
| 301 | +// bud = "formal"; | ||
| 302 | +// com = "complete"; | ||
| 303 | +// } | ||
| 304 | +// if(ee[mon] > 0 && parseFloat(ee[mon]) && parseFloat(ee[bud])){ | ||
| 305 | +// var comV = (parseFloat(ee[mon]) / parseFloat(ee[bud]) * 100).toFixed(2) + "%"; | ||
| 306 | +// ee[com] = comV; | ||
| 307 | +// } else { | ||
| 308 | +// ee[com] = "0%"; | ||
| 309 | +// } | ||
| 310 | + | ||
| 311 | +// } | ||
| 312 | +// }); | ||
| 280 | layer.close(i); | 313 | layer.close(i); |
| 281 | // 把数据填充到模版中 | 314 | // 把数据填充到模版中 |
| 282 | var tbodyHtml = template('budget_sum',{list:result}); | 315 | var tbodyHtml = template('budget_sum',{list:result}); |
| @@ -300,6 +333,18 @@ | @@ -300,6 +333,18 @@ | ||
| 300 | $.each(resList, function(i, g){ | 333 | $.each(resList, function(i, g){ |
| 301 | if(key == g.key){ | 334 | if(key == g.key){ |
| 302 | var dataList = g.dataList; | 335 | var dataList = g.dataList; |
| 336 | +// $(dataList).each(function(ii, ee){ | ||
| 337 | +// for(var kk in ee){ | ||
| 338 | +// if(kk != "xlName" && parseFloat(ee[kk])){ | ||
| 339 | +// var bb = "", cc = ee[kk] + ""; | ||
| 340 | +// if(cc.indexOf("%") > -1){ | ||
| 341 | +// bb = "%"; | ||
| 342 | +// } | ||
| 343 | +// var aa = parseFloat(ee[kk]); | ||
| 344 | +// ee[kk] = parseFloat(aa.toFixed(3))+bb; | ||
| 345 | +// } | ||
| 346 | +// } | ||
| 347 | +// }); | ||
| 303 | var tbodyHtml = template('budget_sum_dataList', {list:dataList}); | 348 | var tbodyHtml = template('budget_sum_dataList', {list:dataList}); |
| 304 | $("#datas_hidden").removeClass("hidden"); | 349 | $("#datas_hidden").removeClass("hidden"); |
| 305 | $("#datas_hidden").height($(window).height()-280); | 350 | $("#datas_hidden").height($(window).height()-280); |
src/main/resources/static/pages/forms/export/import_budget.xls
No preview for this file type
src/main/resources/static/pages/home.html
| 1 | -<style> | ||
| 2 | - .system_change_log{ | ||
| 3 | - background: #fff; | ||
| 4 | - color: #666; | ||
| 5 | - box-shadow: 0 5px 15px rgba(0,0,0,0.08); | ||
| 6 | - height: calc(100% + 10px); | ||
| 7 | - margin-top: -10px; | ||
| 8 | - font-size: 14px; | ||
| 9 | - padding: 10px 0 0 15px; | ||
| 10 | - overflow: auto; | ||
| 11 | - } | ||
| 12 | - .system_change_log>ul{ | ||
| 13 | - margin:0px; | ||
| 14 | - list-style:none; | ||
| 15 | - } | ||
| 16 | - | ||
| 17 | - .system_change_log>ul>li.sub_title{ | ||
| 18 | - text-indent: 0; | ||
| 19 | - } | ||
| 20 | - | ||
| 21 | - .system_change_log>ul>li.sub_title>h6{ | ||
| 22 | - font-size: 12px; | ||
| 23 | - font-family: 微软雅黑; | ||
| 24 | - color: #000; | ||
| 25 | - margin-top: 8px; | ||
| 26 | - margin-bottom: 8px; | ||
| 27 | - } | ||
| 28 | - | ||
| 29 | - .system_change_log>ul>li{ | ||
| 30 | - margin: 5px 0; | ||
| 31 | - text-indent: 25px; | ||
| 32 | - } | ||
| 33 | - | ||
| 34 | - .system_change_log .label{ | ||
| 35 | - width: 55px; | ||
| 36 | - display: inline-block; | ||
| 37 | - padding: 0 10px; | ||
| 38 | - line-height: 1.5; | ||
| 39 | - font-size: 12px; | ||
| 40 | - color: #fff; | ||
| 41 | - vertical-align: middle; | ||
| 42 | - white-space: nowrap; | ||
| 43 | - border-radius: 2px !important; | ||
| 44 | - text-transform: uppercase; | ||
| 45 | - text-align: center; | ||
| 46 | - text-indent: 3px; | ||
| 47 | - margin-right: 15px; | ||
| 48 | - } | ||
| 49 | - .system_change_log .label.s_c_add{ | ||
| 50 | - background-color: #32d296; | ||
| 51 | - } | ||
| 52 | - | ||
| 53 | - .system_change_log .label.s_c_change{ | ||
| 54 | - background-color: #1e87f0; | ||
| 55 | - } | ||
| 56 | - | ||
| 57 | - .system_change_log .label.s_c_remove{ | ||
| 58 | - background-color: #faa05a; | ||
| 59 | - } | ||
| 60 | -</style> | ||
| 61 | -<div class="system_change_log"> | ||
| 62 | - <h2 style="text-indent: 35px;margin: 10px 0 5px;">2021-01-07 更新说明 Changelog</h2> | ||
| 63 | - <br><br> | ||
| 64 | - <ul > | ||
| 65 | - <li class="sub_title"><h6>报表</h6></li> | ||
| 66 | - <li><span class="label s_c_change">修改</span>1.rfid线路签卡率报表中添加自编号和路牌字段</li> | ||
| 67 | - <li><span class="label s_c_change">修改</span>2.烂班明细统计,增加直属公司所有分公司、烂班原因筛选条件</li> | ||
| 68 | - <li class="sub_title"><h6>基础信息</h6></li> | ||
| 69 | - <li><span class="label s_c_change">修改</span>1.基础信息->线路->站点详情,可查看历史版本,编辑当前和待更新版本</li> | ||
| 70 | - <li class="sub_title"><h6>线调</h6></li> | ||
| 71 | - <li><span class="label s_c_change">修改</span>1.线调->地图,点击某个设备"拨打电话"</li> | ||
| 72 | - <li><span class="label s_c_change">修改</span>2.线调->实发调整,加入调整说明下拉框,调整说明进入备注信息</li> | ||
| 73 | - <li><span class="label s_c_change">修改</span>3.烂班原因加入'路救'类型</li> | ||
| 74 | - <li><span class="label s_c_change">新增</span>4.新增临时功能线路调度->临时节点->花博线计划班次导出,用于按日期导出花博线计划班次</li> | ||
| 75 | - </ul> | ||
| 76 | - | ||
| 77 | -</div> | ||
| 78 | - | ||
| 79 | -<script type="text/javascript"> | ||
| 80 | - $.ajax({ | ||
| 81 | - url: '/eci/validate_get_destroy_info', | ||
| 82 | - dataType: "json", | ||
| 83 | - success: function(rs) { | ||
| 84 | - if (rs && rs.status === "SUCCESS") { | ||
| 85 | - if (rs.data && rs.data.length && rs.data.length > 0) { | ||
| 86 | - var htmlText = ""; | ||
| 87 | - var wrapData = []; | ||
| 88 | - if (rs.data.length > 8) { | ||
| 89 | - htmlText = "<span style='font-weight: bold; font-style: italic; '>部分停用信息如下:</span></br>"; | ||
| 90 | - wrapData = rs.data.slice(0, 8); | ||
| 91 | - } else { | ||
| 92 | - htmlText = "<span style='font-weight: bold; font-style: italic; '>所有停用信息如下:</span></br>"; | ||
| 93 | - wrapData = rs.data; | ||
| 94 | - } | ||
| 95 | - $.each(wrapData, function(index, value) { | ||
| 96 | - wrapData[index] = "<span style='font-size: 14px;'>" + value + "</span>"; | ||
| 97 | - }); | ||
| 98 | - | ||
| 99 | - htmlText += wrapData.join("</br>"); | ||
| 100 | - | ||
| 101 | - swal({ | ||
| 102 | - title: "排班人员停用信息", | ||
| 103 | - text: htmlText, | ||
| 104 | - html: true, | ||
| 105 | - type: "warning", | ||
| 106 | - showCancelButton: true, | ||
| 107 | - cancelButtonText: "关闭", | ||
| 108 | - confirmButtonColor: "#3598dc", | ||
| 109 | - confirmButtonText: "下载所有停用信息", | ||
| 110 | - closeOnConfirm: false | ||
| 111 | - | ||
| 112 | - }, function() { | ||
| 113 | - window.location.href = "/eci/validate_get_destroy_info/download"; | ||
| 114 | - }); | ||
| 115 | - } | ||
| 116 | - } | ||
| 117 | - } | ||
| 118 | - }); | ||
| 119 | - | ||
| 120 | -</script> | 1 | +<style> |
| 2 | + .system_change_log{ | ||
| 3 | + background: #fff; | ||
| 4 | + color: #666; | ||
| 5 | + box-shadow: 0 5px 15px rgba(0,0,0,0.08); | ||
| 6 | + height: calc(100% + 10px); | ||
| 7 | + margin-top: -10px; | ||
| 8 | + font-size: 14px; | ||
| 9 | + padding: 10px 0 0 15px; | ||
| 10 | + overflow: auto; | ||
| 11 | + } | ||
| 12 | + .system_change_log>ul{ | ||
| 13 | + margin:0px; | ||
| 14 | + list-style:none; | ||
| 15 | + } | ||
| 16 | + | ||
| 17 | + .system_change_log>ul>li.sub_title{ | ||
| 18 | + text-indent: 0; | ||
| 19 | + } | ||
| 20 | + | ||
| 21 | + .system_change_log>ul>li.sub_title>h6{ | ||
| 22 | + font-size: 12px; | ||
| 23 | + font-family: 微软雅黑; | ||
| 24 | + color: #000; | ||
| 25 | + margin-top: 8px; | ||
| 26 | + margin-bottom: 8px; | ||
| 27 | + } | ||
| 28 | + | ||
| 29 | + .system_change_log>ul>li{ | ||
| 30 | + margin: 5px 0; | ||
| 31 | + text-indent: 25px; | ||
| 32 | + } | ||
| 33 | + | ||
| 34 | + .system_change_log .label{ | ||
| 35 | + width: 55px; | ||
| 36 | + display: inline-block; | ||
| 37 | + padding: 0 10px; | ||
| 38 | + line-height: 1.5; | ||
| 39 | + font-size: 12px; | ||
| 40 | + color: #fff; | ||
| 41 | + vertical-align: middle; | ||
| 42 | + white-space: nowrap; | ||
| 43 | + border-radius: 2px !important; | ||
| 44 | + text-transform: uppercase; | ||
| 45 | + text-align: center; | ||
| 46 | + text-indent: 3px; | ||
| 47 | + margin-right: 15px; | ||
| 48 | + } | ||
| 49 | + .system_change_log .label.s_c_add{ | ||
| 50 | + background-color: #32d296; | ||
| 51 | + } | ||
| 52 | + | ||
| 53 | + .system_change_log .label.s_c_change{ | ||
| 54 | + background-color: #1e87f0; | ||
| 55 | + } | ||
| 56 | + | ||
| 57 | + .system_change_log .label.s_c_remove{ | ||
| 58 | + background-color: #faa05a; | ||
| 59 | + } | ||
| 60 | +</style> | ||
| 61 | +<div class="system_change_log"> | ||
| 62 | + <h2 style="text-indent: 35px;margin: 10px 0 5px;">2022-06-13 更新说明 Changelog</h2> | ||
| 63 | + <br><br> | ||
| 64 | + <ul > | ||
| 65 | + <li class="sub_title"><h6>报表</h6></li> | ||
| 66 | + <li><span class="label s_c_change">修改</span>1.统计报表->路单线路明细月报、年报 中耗电统计值偏离的问题</li> | ||
| 67 | + <li><span class="label s_c_change">修改</span>2.统计报表->"(班次)到离站"报表,新增历史站点版本数据查询,解决站点顺序的问题</li> | ||
| 68 | + <li class="sub_title"><h6>基础信息</h6></li> | ||
| 69 | + <li><span class="label s_c_change">修改</span>1.调度系统车辆信息与车辆库车辆信息保持同步,调度系统取消车辆的新增、编辑功能</li> | ||
| 70 | + <li><span class="label s_c_change">修改</span>2.调度系统人员信息与人事系统人员信息保持同步,调度系统取消人员的新增、编辑功能</li> | ||
| 71 | + <li class="sub_title"><h6>运管处</h6></li> | ||
| 72 | + <li><span class="label s_c_change">修改</span>1.电子路单上传至运管处时采用多次上传降低上传失败率</li> | ||
| 73 | + <li class="sub_title"><h6>线调</h6></li> | ||
| 74 | + <li><span class="label s_c_change">修改</span>1.线调->车载设备->设备管理 中"最后GPS时间"列显示异常修正</li> | ||
| 75 | + <li><span class="label s_c_change">修改</span>2.无排班线路添加"临加班次"功能</li> | ||
| 76 | + </ul> | ||
| 77 | + | ||
| 78 | +</div> | ||
| 79 | + | ||
| 80 | +<script type="text/javascript"> | ||
| 81 | + $.ajax({ | ||
| 82 | + url: '/eci/validate_get_destroy_info', | ||
| 83 | + dataType: "json", | ||
| 84 | + success: function(rs) { | ||
| 85 | + if (rs && rs.status === "SUCCESS") { | ||
| 86 | + if (rs.data && rs.data.length && rs.data.length > 0) { | ||
| 87 | + var htmlText = ""; | ||
| 88 | + var wrapData = []; | ||
| 89 | + if (rs.data.length > 8) { | ||
| 90 | + htmlText = "<span style='font-weight: bold; font-style: italic; '>部分停用信息如下:</span></br>"; | ||
| 91 | + wrapData = rs.data.slice(0, 8); | ||
| 92 | + } else { | ||
| 93 | + htmlText = "<span style='font-weight: bold; font-style: italic; '>所有停用信息如下:</span></br>"; | ||
| 94 | + wrapData = rs.data; | ||
| 95 | + } | ||
| 96 | + $.each(wrapData, function(index, value) { | ||
| 97 | + wrapData[index] = "<span style='font-size: 14px;'>" + value + "</span>"; | ||
| 98 | + }); | ||
| 99 | + | ||
| 100 | + htmlText += wrapData.join("</br>"); | ||
| 101 | + | ||
| 102 | + swal({ | ||
| 103 | + title: "排班人员停用信息", | ||
| 104 | + text: htmlText, | ||
| 105 | + html: true, | ||
| 106 | + type: "warning", | ||
| 107 | + showCancelButton: true, | ||
| 108 | + cancelButtonText: "关闭", | ||
| 109 | + confirmButtonColor: "#3598dc", | ||
| 110 | + confirmButtonText: "下载所有停用信息", | ||
| 111 | + closeOnConfirm: false | ||
| 112 | + | ||
| 113 | + }, function() { | ||
| 114 | + window.location.href = "/eci/validate_get_destroy_info/download"; | ||
| 115 | + }); | ||
| 116 | + } | ||
| 117 | + } | ||
| 118 | + } | ||
| 119 | + }); | ||
| 120 | + | ||
| 121 | +</script> |
src/main/resources/static/pages/oil/list_ph.html
| @@ -652,6 +652,7 @@ onkeyup="this.value=this.value.replace(/[^(\d||/.)]/g,'').replace('.','$#$').rep | @@ -652,6 +652,7 @@ onkeyup="this.value=this.value.replace(/[^(\d||/.)]/g,'').replace('.','$#$').rep | ||
| 652 | layer.msg('只能操作一天内数据.'); | 652 | layer.msg('只能操作一天内数据.'); |
| 653 | }else{ | 653 | }else{ |
| 654 | var i = layer.load(2); | 654 | var i = layer.load(2); |
| 655 | + params["fgsdm_like"] = ''; | ||
| 655 | $get('/ylb/obtain', params, function () { | 656 | $get('/ylb/obtain', params, function () { |
| 656 | layer.close(i); | 657 | layer.close(i); |
| 657 | jsDoQuery(params, true); | 658 | jsDoQuery(params, true); |
src/main/resources/static/pages/oil/modifyRights.html
0 → 100644
| 1 | +<div class="page-head"> | ||
| 2 | + <div class="page-title"> | ||
| 3 | + <h1>进出站油电信息编辑</h1> | ||
| 4 | + </div> | ||
| 5 | +</div> | ||
| 6 | + | ||
| 7 | +<ul class="page-breadcrumb breadcrumb"> | ||
| 8 | + <li><span class="active">编辑权限</span></li> | ||
| 9 | +</ul> | ||
| 10 | + | ||
| 11 | +<div class="portlet light bordered"> | ||
| 12 | + <div class="portlet-title"> | ||
| 13 | + <div class="caption"> | ||
| 14 | + <i class="icon-equalizer font-red-sunglo"></i> <span | ||
| 15 | + class="caption-subject font-red-sunglo bold uppercase"></span> | ||
| 16 | + </div> | ||
| 17 | + </div> | ||
| 18 | + <div class="portlet-body form"> | ||
| 19 | + <form action="/addYlb" class="form-horizontal" id="ylb_add_form" > | ||
| 20 | + | ||
| 21 | + <div class="alert alert-danger display-hide"> | ||
| 22 | + <button class="close" data-close="alert"></button> | ||
| 23 | + 您的输入有误,请检查下面的输入项 | ||
| 24 | + </div> | ||
| 25 | + <input type="hidden" value="0" name="yhlx" /> | ||
| 26 | + <div class="form-body"> | ||
| 27 | + <div class="form-group"> | ||
| 28 | + <label class="col-md-3 control-label">修改历史油/电权限:</label> | ||
| 29 | + <div class="col-md-2"> | ||
| 30 | + <input type="text" class="form-control" name="modify_rights" id="modify_rights" readonly="readonly"> | ||
| 31 | + </div> | ||
| 32 | + <button type="button" class="btn green" id="change" >修改</button> | ||
| 33 | + </div> | ||
| 34 | + </div> | ||
| 35 | + </form> | ||
| 36 | + <!-- END FORM--> | ||
| 37 | + </div> | ||
| 38 | +</div> | ||
| 39 | +<script> | ||
| 40 | +(function(){ | ||
| 41 | + | ||
| 42 | + function getModifyRights(){ | ||
| 43 | + $get('/ylb/getModifyRights',"",function(result){ | ||
| 44 | + $("#modify_rights").val(result.text); | ||
| 45 | + }); | ||
| 46 | + } | ||
| 47 | + getModifyRights(); | ||
| 48 | + | ||
| 49 | + $("#change").on('click', function () { | ||
| 50 | + var par={}; | ||
| 51 | + par["modify_rights"] = $("#modify_rights").val(); | ||
| 52 | + $get('/ylb/modifyRightsChange',par,function(result){ | ||
| 53 | + layer.msg(result.text); | ||
| 54 | + getModifyRights(); | ||
| 55 | + }); | ||
| 56 | + }); | ||
| 57 | + | ||
| 58 | +})(); | ||
| 59 | +</script> | ||
| 0 | \ No newline at end of file | 60 | \ No newline at end of file |
src/main/resources/static/pages/report/inoutstation.html
| @@ -67,7 +67,7 @@ | @@ -67,7 +67,7 @@ | ||
| 67 | <input class="form-control" type="text" id="date2" style="width: 180px;"/> | 67 | <input class="form-control" type="text" id="date2" style="width: 180px;"/> |
| 68 | <span class="item-label" style="width: 80px;">站点: </span> | 68 | <span class="item-label" style="width: 80px;">站点: </span> |
| 69 | <select class="form-control sreach-zd" id="zdlx" > | 69 | <select class="form-control sreach-zd" id="zdlx" > |
| 70 | - <option value="">请选择</option> | 70 | + <option value=" ">请选择</option> |
| 71 | <option value="0">上行</option> | 71 | <option value="0">上行</option> |
| 72 | <option value="1">下行</option> | 72 | <option value="1">下行</option> |
| 73 | </select> | 73 | </select> |
| @@ -188,6 +188,19 @@ | @@ -188,6 +188,19 @@ | ||
| 188 | locale : 'zh-cn' | 188 | locale : 'zh-cn' |
| 189 | }); | 189 | }); |
| 190 | 190 | ||
| 191 | + var d = new Date(); | ||
| 192 | + d.setTime(d.getTime()); | ||
| 193 | + var year = d.getFullYear(); | ||
| 194 | + var month = d.getMonth() + 1; | ||
| 195 | + var day = d.getDate(); | ||
| 196 | + if(month < 10) | ||
| 197 | + month = "0" + month; | ||
| 198 | + if(day < 10) | ||
| 199 | + day = "0" + day; | ||
| 200 | + var dt = year + "-" + month + "-" + day; | ||
| 201 | + $("#date").val(dt); | ||
| 202 | + $("#date1,#date2").val(dt + " 00:00"); | ||
| 203 | + | ||
| 191 | 204 | ||
| 192 | /* $.get('/basic/lineCode2Name',function(result){ | 205 | /* $.get('/basic/lineCode2Name',function(result){ |
| 193 | var data=[]; | 206 | var data=[]; |
| @@ -444,22 +457,26 @@ | @@ -444,22 +457,26 @@ | ||
| 444 | }); | 457 | }); |
| 445 | } | 458 | } |
| 446 | }) | 459 | }) |
| 460 | + | ||
| 447 | $(".sreach-zd").on("change",initZd); | 461 | $(".sreach-zd").on("change",initZd); |
| 462 | + $("#date1,#date2").on("blur",initZd); | ||
| 448 | var status=false; | 463 | var status=false; |
| 449 | 464 | ||
| 450 | function initZd(){ | 465 | function initZd(){ |
| 451 | var line = $("#line").val(); | 466 | var line = $("#line").val(); |
| 452 | var zdlx = $("#zdlx").val(); | 467 | var zdlx = $("#zdlx").val(); |
| 453 | - console.log(line+"===="+zdlx); | ||
| 454 | - if(line==null|| line =="" || zdlx ==null || zdlx==""){ | 468 | + var date1 = $("#date1").val(); |
| 469 | + var date2 = $("#date2").val(); | ||
| 470 | + if(line==null || line=="" || zdlx==null || zdlx=="" | ||
| 471 | + || date1==null || date1 =="" || date2==null || date2==""){ | ||
| 455 | }else{ | 472 | }else{ |
| 456 | - $.get('/report/sreachZd',{line: line,zdlx:zdlx},function(result){ | 473 | + $.get('/report/sreachZd',{line:line,zdlx:zdlx,date1:date1,date2:date2},function(result){ |
| 457 | var zdList=result; | 474 | var zdList=result; |
| 458 | if(status){ | 475 | if(status){ |
| 459 | $("#zd").select2("destroy").html(''); | 476 | $("#zd").select2("destroy").html(''); |
| 460 | } | 477 | } |
| 461 | var datas=[]; | 478 | var datas=[]; |
| 462 | - datas.push({id:" ",text:"全部"}); | 479 | + datas.push({id:" ",text:"请选择..."}); |
| 463 | for(var i=0;i<zdList.length;i++){ | 480 | for(var i=0;i<zdList.length;i++){ |
| 464 | datas.push({id: zdList[i]["id"], text: zdList[i]["text"]}); | 481 | datas.push({id: zdList[i]["id"], text: zdList[i]["text"]}); |
| 465 | } | 482 | } |
src/main/resources/static/pages/scheduleApp/module/basicInfo/deviceInfoManage/list.html
| @@ -5,7 +5,7 @@ | @@ -5,7 +5,7 @@ | ||
| 5 | border-color: #32c5d2; | 5 | border-color: #32c5d2; |
| 6 | } | 6 | } |
| 7 | .btn-group > .dropdown-menu:before { | 7 | .btn-group > .dropdown-menu:before { |
| 8 | - border-bottom-color: #32c5d2; | 8 | + border-bottom-color: #32c5d2; |
| 9 | } | 9 | } |
| 10 | </style> | 10 | </style> |
| 11 | 11 | ||
| @@ -21,6 +21,7 @@ | @@ -21,6 +21,7 @@ | ||
| 21 | <th>旧设备编号</th> | 21 | <th>旧设备编号</th> |
| 22 | <th>新设备编号</th> | 22 | <th>新设备编号</th> |
| 23 | <th style="width: 180px;">操作人/操作时间</th> | 23 | <th style="width: 180px;">操作人/操作时间</th> |
| 24 | + <th style="width: 80px;" >状态</th> | ||
| 24 | <th style="width: 150pt;">操作</th> | 25 | <th style="width: 150pt;">操作</th> |
| 25 | </tr> | 26 | </tr> |
| 26 | <tr role="row" class="filter"> | 27 | <tr role="row" class="filter"> |
| @@ -47,6 +48,11 @@ | @@ -47,6 +48,11 @@ | ||
| 47 | <td></td> | 48 | <td></td> |
| 48 | <td></td> | 49 | <td></td> |
| 49 | <td> | 50 | <td> |
| 51 | + <label class="checkbox-inline input"> | ||
| 52 | + <input type="checkbox" ng-model="ctrl.searchCondition()['isCancel_eq']" />报废车 | ||
| 53 | + </label> | ||
| 54 | + </td> | ||
| 55 | + <td> | ||
| 50 | <div class="btn-group"> | 56 | <div class="btn-group"> |
| 51 | <button class="btn btn-sm green btn-outline filter-submit margin-bottom" style="margin-right: 0;" | 57 | <button class="btn btn-sm green btn-outline filter-submit margin-bottom" style="margin-right: 0;" |
| 52 | ng-click="ctrl.doPage()"> | 58 | ng-click="ctrl.doPage()"> |
| @@ -113,6 +119,9 @@ | @@ -113,6 +119,9 @@ | ||
| 113 | 119 | ||
| 114 | </td> | 120 | </td> |
| 115 | <td> | 121 | <td> |
| 122 | + <span ng-bind="info.isCancel | dict:'truefalseType':'未知' "></span> | ||
| 123 | + </td> | ||
| 124 | + <td> | ||
| 116 | <!--<a href="details.html?lineId={{obj.id}}" class="btn default blue-stripe btn-sm"> 详细 </a>--> | 125 | <!--<a href="details.html?lineId={{obj.id}}" class="btn default blue-stripe btn-sm"> 详细 </a>--> |
| 117 | <!--<a href="edit.html?lineId={{obj.id}}" class="btn default blue-stripe btn-sm"> 修改 </a>--> | 126 | <!--<a href="edit.html?lineId={{obj.id}}" class="btn default blue-stripe btn-sm"> 修改 </a>--> |
| 118 | <a ui-sref="deviceInfoManage_detail({id: info.id})" class="btn btn-info btn-sm"> 详细 </a> | 127 | <a ui-sref="deviceInfoManage_detail({id: info.id})" class="btn btn-info btn-sm"> 详细 </a> |
src/main/resources/static/pages/scheduleApp/module/basicInfo/vehicleDataSyncManage/form.html
| @@ -35,14 +35,25 @@ | @@ -35,14 +35,25 @@ | ||
| 35 | <div class="form-body"> | 35 | <div class="form-body"> |
| 36 | 36 | ||
| 37 | <div class="form-group"> | 37 | <div class="form-group"> |
| 38 | + <label class="col-md-2 control-label">同步类型:</label> | ||
| 39 | + <div class="col-md-3"> | ||
| 40 | + <sa-Radiogroup model="ctrl.vsTaskType" dicgroup="vsTaskType" ></sa-Radiogroup> | ||
| 41 | + </div> | ||
| 42 | + </div> | ||
| 43 | + | ||
| 44 | + <div class="form-group" ng-if="ctrl.vsTaskType === 'singleV'"> | ||
| 38 | <label class="col-md-2 control-label">车辆自编号:</label> | 45 | <label class="col-md-2 control-label">车辆自编号:</label> |
| 39 | <div class="col-md-4"> | 46 | <div class="col-md-4"> |
| 40 | - <input type="text" class="form-control" ng-model="ctrl.dataSyncTask.paramClzbh" | 47 | + <input type="text" class="form-control" required name="paramClzbh" ng-model="ctrl.dataSyncTask.paramClzbh" |
| 41 | placeholder="请输入车辆自编号"/> | 48 | placeholder="请输入车辆自编号"/> |
| 42 | </div> | 49 | </div> |
| 50 | + <!-- 隐藏块,显示验证信息 --> | ||
| 51 | + <div class="alert alert-danger well-sm" ng-show="myForm.paramClzbh.$error.required"> | ||
| 52 | + 车辆自编号必须填写 | ||
| 53 | + </div> | ||
| 43 | </div> | 54 | </div> |
| 44 | 55 | ||
| 45 | - <div class="form-group has-success has-feedback"> | 56 | + <div class="form-group has-success has-feedback" ng-if="ctrl.vsTaskType === 'periodT'"> |
| 46 | <label class="col-md-2 control-label">开始日期*:</label> | 57 | <label class="col-md-2 control-label">开始日期*:</label> |
| 47 | <div class="col-md-3"> | 58 | <div class="col-md-3"> |
| 48 | <div class="input-group"> | 59 | <div class="input-group"> |
| @@ -64,7 +75,7 @@ | @@ -64,7 +75,7 @@ | ||
| 64 | </div> | 75 | </div> |
| 65 | </div> | 76 | </div> |
| 66 | 77 | ||
| 67 | - <div class="form-group has-success has-feedback"> | 78 | + <div class="form-group has-success has-feedback" ng-if="ctrl.vsTaskType === 'periodT'"> |
| 68 | <label class="col-md-2 control-label">结束日期*:</label> | 79 | <label class="col-md-2 control-label">结束日期*:</label> |
| 69 | <div class="col-md-3"> | 80 | <div class="col-md-3"> |
| 70 | <div class="input-group"> | 81 | <div class="input-group"> |
src/main/resources/static/pages/scheduleApp/module/basicInfo/vehicleDataSyncManage/module.js
| @@ -188,6 +188,9 @@ angular.module('ScheduleApp').controller( | @@ -188,6 +188,9 @@ angular.module('ScheduleApp').controller( | ||
| 188 | var self = this; | 188 | var self = this; |
| 189 | var Task = service.getAddTaskClass(); | 189 | var Task = service.getAddTaskClass(); |
| 190 | 190 | ||
| 191 | + // 同步任务类型 | ||
| 192 | + self.vsTaskType = "singleV"; | ||
| 193 | + | ||
| 191 | // 日期 日期控件开关 | 194 | // 日期 日期控件开关 |
| 192 | self.paramFrom = false; | 195 | self.paramFrom = false; |
| 193 | self.paramFrom_open = function() { | 196 | self.paramFrom_open = function() { |
| @@ -204,6 +207,14 @@ angular.module('ScheduleApp').controller( | @@ -204,6 +207,14 @@ angular.module('ScheduleApp').controller( | ||
| 204 | 207 | ||
| 205 | // 提交方法 | 208 | // 提交方法 |
| 206 | self.submit = function() { | 209 | self.submit = function() { |
| 210 | + // 根据同步任务类型做数据处理(和后台etl判定逻辑对应) | ||
| 211 | + if (self.vsTaskType === "singleV") { | ||
| 212 | + self.dataSyncTask.paramFrom = null; | ||
| 213 | + self.dataSyncTask.paramTo = null; | ||
| 214 | + } else if (self.vsTaskType === "periodT") { | ||
| 215 | + self.dataSyncTask.paramClzbh = null; | ||
| 216 | + } | ||
| 217 | + | ||
| 207 | console.log(self.dataSyncTask); | 218 | console.log(self.dataSyncTask); |
| 208 | 219 | ||
| 209 | self.dataSyncTask.$save(function() { | 220 | self.dataSyncTask.$save(function() { |
src/main/resources/static/pages/scheduleApp/module/common/dts2/scheduleplan/saScpdate.js
| @@ -125,6 +125,7 @@ angular.module('ScheduleApp').directive( | @@ -125,6 +125,7 @@ angular.module('ScheduleApp').directive( | ||
| 125 | scope[ctrlAs].$$ds = []; | 125 | scope[ctrlAs].$$ds = []; |
| 126 | 126 | ||
| 127 | var errorTTInfos = 0; | 127 | var errorTTInfos = 0; |
| 128 | + var errorLpCount = 0; | ||
| 128 | 129 | ||
| 129 | if (result && result.data && result.data.infos && result.data.infos.length > 0) { | 130 | if (result && result.data && result.data.infos && result.data.infos.length > 0) { |
| 130 | angular.forEach(result.data.infos, function(obj) { | 131 | angular.forEach(result.data.infos, function(obj) { |
| @@ -140,6 +141,8 @@ angular.module('ScheduleApp').directive( | @@ -140,6 +141,8 @@ angular.module('ScheduleApp').directive( | ||
| 140 | yybc: obj.yybc, | 141 | yybc: obj.yybc, |
| 141 | 142 | ||
| 142 | errorbc: obj.errorbc, | 143 | errorbc: obj.errorbc, |
| 144 | + errorlpCount: obj.errorlpCount, | ||
| 145 | + errorlpInfo: obj.errorlpInfo, | ||
| 143 | 146 | ||
| 144 | lineVersion: obj.lineVersion | 147 | lineVersion: obj.lineVersion |
| 145 | 148 | ||
| @@ -147,6 +150,8 @@ angular.module('ScheduleApp').directive( | @@ -147,6 +150,8 @@ angular.module('ScheduleApp').directive( | ||
| 147 | 150 | ||
| 148 | if (obj.errorbc > 0) { | 151 | if (obj.errorbc > 0) { |
| 149 | errorTTInfos ++; | 152 | errorTTInfos ++; |
| 153 | + } else if (obj.errorlpCount > 0) { | ||
| 154 | + errorLpCount ++; | ||
| 150 | } else { | 155 | } else { |
| 151 | ttinfonames.push(obj.ttname); | 156 | ttinfonames.push(obj.ttname); |
| 152 | ttinfoids.push(obj.ttid); | 157 | ttinfoids.push(obj.ttid); |
| @@ -156,6 +161,9 @@ angular.module('ScheduleApp').directive( | @@ -156,6 +161,9 @@ angular.module('ScheduleApp').directive( | ||
| 156 | if (errorTTInfos > 0) { | 161 | if (errorTTInfos > 0) { |
| 157 | scope[ctrlAs].$$internalmodel = undefined; | 162 | scope[ctrlAs].$$internalmodel = undefined; |
| 158 | scope[ctrlAs].error = "时刻表有错误班次"; | 163 | scope[ctrlAs].error = "时刻表有错误班次"; |
| 164 | + } else if (errorLpCount > 0) { | ||
| 165 | + scope[ctrlAs].$$internalmodel = undefined; | ||
| 166 | + scope[ctrlAs].error = "时刻表有错误路牌"; | ||
| 159 | } else { | 167 | } else { |
| 160 | scope[ctrlAs].$$internalmodel = "ok"; | 168 | scope[ctrlAs].$$internalmodel = "ok"; |
| 161 | scope[ctrlAs].ttinfonames = ttinfonames.join(","); | 169 | scope[ctrlAs].ttinfonames = ttinfonames.join(","); |
| @@ -228,4 +236,4 @@ angular.module('ScheduleApp').directive( | @@ -228,4 +236,4 @@ angular.module('ScheduleApp').directive( | ||
| 228 | }; | 236 | }; |
| 229 | } | 237 | } |
| 230 | ] | 238 | ] |
| 231 | -); | ||
| 232 | \ No newline at end of file | 239 | \ No newline at end of file |
| 240 | +); |
src/main/resources/static/pages/scheduleApp/module/common/dts2/scheduleplan/saScpdateTemplate.html
| @@ -56,6 +56,8 @@ | @@ -56,6 +56,8 @@ | ||
| 56 | <div><span ng-bind="info.ttname"></span></div> | 56 | <div><span ng-bind="info.ttname"></span></div> |
| 57 | <div><span>统计班次:{{info.allbc}}个,出场:{{info.outbc}}个,进场:{{info.inbc}}个,营运:{{info.yybc}}个</span></div> | 57 | <div><span>统计班次:{{info.allbc}}个,出场:{{info.outbc}}个,进场:{{info.inbc}}个,营运:{{info.yybc}}个</span></div> |
| 58 | <div><span>异常班次:{{info.errorbc}}个</span></div> | 58 | <div><span>异常班次:{{info.errorbc}}个</span></div> |
| 59 | + <div><span>异常路牌:{{info.errorlpCount}}个</span></div> | ||
| 60 | + <div><span>异常路牌描述:{{info.errorlpInfo.join(",")}}</span></div> | ||
| 59 | </script> | 61 | </script> |
| 60 | 62 | ||
| 61 | <div ng-repeat="info in $saScpdateCtrl.$$ds track by $index"> | 63 | <div ng-repeat="info in $saScpdateCtrl.$$ds track by $index"> |
| @@ -68,8 +70,8 @@ | @@ -68,8 +70,8 @@ | ||
| 68 | {{info.ttname}} | 70 | {{info.ttname}} |
| 69 | </a> | 71 | </a> |
| 70 | </h3> | 72 | </h3> |
| 71 | - <span class="glyphicon glyphicon-ok" aria-hidden="true" ng-if="info.errorbc == 0"></span> | ||
| 72 | - <span class="glyphicon glyphicon-remove" aria-hidden="true" ng-if="info.errorbc > 0"></span> | 73 | + <span class="glyphicon glyphicon-ok" aria-hidden="true" ng-if="info.errorbc == 0 && info.errorlpCount == 0"></span> |
| 74 | + <span class="glyphicon glyphicon-remove" aria-hidden="true" ng-if="info.errorbc > 0 || info.errorlpCount > 0"></span> | ||
| 73 | </div> | 75 | </div> |
| 74 | </div> | 76 | </div> |
| 75 | </div> | 77 | </div> |
| @@ -78,4 +80,4 @@ | @@ -78,4 +80,4 @@ | ||
| 78 | 80 | ||
| 79 | 81 | ||
| 80 | 82 | ||
| 81 | -</div> | ||
| 82 | \ No newline at end of file | 83 | \ No newline at end of file |
| 84 | +</div> |
src/main/resources/static/pages/scheduleApp/module/common/prj-common-directive.js
| @@ -5146,6 +5146,7 @@ angular.module('ScheduleApp').directive( | @@ -5146,6 +5146,7 @@ angular.module('ScheduleApp').directive( | ||
| 5146 | scope[ctrlAs].$$ds = []; | 5146 | scope[ctrlAs].$$ds = []; |
| 5147 | 5147 | ||
| 5148 | var errorTTInfos = 0; | 5148 | var errorTTInfos = 0; |
| 5149 | + var errorLpCount = 0; | ||
| 5149 | 5150 | ||
| 5150 | if (result && result.data && result.data.infos && result.data.infos.length > 0) { | 5151 | if (result && result.data && result.data.infos && result.data.infos.length > 0) { |
| 5151 | angular.forEach(result.data.infos, function(obj) { | 5152 | angular.forEach(result.data.infos, function(obj) { |
| @@ -5161,6 +5162,8 @@ angular.module('ScheduleApp').directive( | @@ -5161,6 +5162,8 @@ angular.module('ScheduleApp').directive( | ||
| 5161 | yybc: obj.yybc, | 5162 | yybc: obj.yybc, |
| 5162 | 5163 | ||
| 5163 | errorbc: obj.errorbc, | 5164 | errorbc: obj.errorbc, |
| 5165 | + errorlpCount: obj.errorlpCount, | ||
| 5166 | + errorlpInfo: obj.errorlpInfo, | ||
| 5164 | 5167 | ||
| 5165 | lineVersion: obj.lineVersion | 5168 | lineVersion: obj.lineVersion |
| 5166 | 5169 | ||
| @@ -5168,6 +5171,8 @@ angular.module('ScheduleApp').directive( | @@ -5168,6 +5171,8 @@ angular.module('ScheduleApp').directive( | ||
| 5168 | 5171 | ||
| 5169 | if (obj.errorbc > 0) { | 5172 | if (obj.errorbc > 0) { |
| 5170 | errorTTInfos ++; | 5173 | errorTTInfos ++; |
| 5174 | + } else if (obj.errorlpCount > 0) { | ||
| 5175 | + errorLpCount ++; | ||
| 5171 | } else { | 5176 | } else { |
| 5172 | ttinfonames.push(obj.ttname); | 5177 | ttinfonames.push(obj.ttname); |
| 5173 | ttinfoids.push(obj.ttid); | 5178 | ttinfoids.push(obj.ttid); |
| @@ -5177,6 +5182,9 @@ angular.module('ScheduleApp').directive( | @@ -5177,6 +5182,9 @@ angular.module('ScheduleApp').directive( | ||
| 5177 | if (errorTTInfos > 0) { | 5182 | if (errorTTInfos > 0) { |
| 5178 | scope[ctrlAs].$$internalmodel = undefined; | 5183 | scope[ctrlAs].$$internalmodel = undefined; |
| 5179 | scope[ctrlAs].error = "时刻表有错误班次"; | 5184 | scope[ctrlAs].error = "时刻表有错误班次"; |
| 5185 | + } else if (errorLpCount > 0) { | ||
| 5186 | + scope[ctrlAs].$$internalmodel = undefined; | ||
| 5187 | + scope[ctrlAs].error = "时刻表有错误路牌"; | ||
| 5180 | } else { | 5188 | } else { |
| 5181 | scope[ctrlAs].$$internalmodel = "ok"; | 5189 | scope[ctrlAs].$$internalmodel = "ok"; |
| 5182 | scope[ctrlAs].ttinfonames = ttinfonames.join(","); | 5190 | scope[ctrlAs].ttinfonames = ttinfonames.join(","); |
| @@ -5249,7 +5257,8 @@ angular.module('ScheduleApp').directive( | @@ -5249,7 +5257,8 @@ angular.module('ScheduleApp').directive( | ||
| 5249 | }; | 5257 | }; |
| 5250 | } | 5258 | } |
| 5251 | ] | 5259 | ] |
| 5252 | -); | 5260 | +); |
| 5261 | + | ||
| 5253 | /** | 5262 | /** |
| 5254 | * saSrule指令(非通用指令,只在排班计划form中使用)。 | 5263 | * saSrule指令(非通用指令,只在排班计划form中使用)。 |
| 5255 | * 属性如下: | 5264 | * 属性如下: |
src/main/resources/static/pages/trafficManage/js/timeTempletUpload.js
| 1 | -/** | ||
| 2 | - * | ||
| 3 | - * @JSName : timeTempletUpload.js(运管处js) | ||
| 4 | - * | ||
| 5 | - * @Author : bsth@zq | ||
| 6 | - * | ||
| 7 | - * @Description : TODO(运管功能公共js) | ||
| 8 | - * | ||
| 9 | - * @Data : 2016年6月29日 上午9:21:17 | ||
| 10 | - * | ||
| 11 | - * @Version 公交调度系统BS版 0.1 | ||
| 12 | - * | ||
| 13 | - */ | ||
| 14 | - | ||
| 15 | -(function(){ | ||
| 16 | - | ||
| 17 | - function getComp(cb) { | ||
| 18 | - $.get('/user/companyData',null,function(rs) { | ||
| 19 | - return cb && cb(rs); | ||
| 20 | - }); | ||
| 21 | - } | ||
| 22 | - | ||
| 23 | - initLineSelect2(); | ||
| 24 | - | ||
| 25 | - function initLineSelect2(compD) { | ||
| 26 | - getComp(function(rs) { | ||
| 27 | - var params = {}; | ||
| 28 | - if(rs.length>0) { | ||
| 29 | - var compA = new Array(); | ||
| 30 | - for(var c = 0 ; c<rs.length;c++) { | ||
| 31 | - var comC = rs[c].companyCode; | ||
| 32 | - var child = rs[c].children; | ||
| 33 | - if(child.length>0) { | ||
| 34 | - for(var d = 0 ;d< child.length;d++) { | ||
| 35 | - compA.push(comC + '_' + child[d].code); | ||
| 36 | - } | ||
| 37 | - }else { | ||
| 38 | - compA.push(comC); | ||
| 39 | - } | ||
| 40 | - } | ||
| 41 | - params.cgsbm_in = compA.toString(); | ||
| 42 | - } | ||
| 43 | - params["remove_ne"] = 1; | ||
| 44 | - // 填充线路拉框选择值 | ||
| 45 | - $get('/line/all', params, function(array){ | ||
| 46 | - var len_ = array.length,paramsD = new Array(); | ||
| 47 | - if(len_>0) { | ||
| 48 | - $.each(array, function(i, g){ | ||
| 49 | - if(g.name!='' || g.name != null) { | ||
| 50 | - paramsD.push({'id':g.id ,'text':g.name}); | ||
| 51 | - } | ||
| 52 | - }); | ||
| 53 | - initPinYinSelect2($('#line'),paramsD,function(selector) { | ||
| 54 | - selector.select2("val", storage.xlName_AgursData); | ||
| 55 | - }); | ||
| 56 | - } | ||
| 57 | - }); | ||
| 58 | - }); | ||
| 59 | - } | ||
| 60 | - | ||
| 61 | - | ||
| 62 | - // 绑定查询事件 | ||
| 63 | - $("#search").click(searchM); | ||
| 64 | - // 绑定上传事件 | ||
| 65 | - $("#upload").click(uploadM); | ||
| 66 | - // 绑定全部移到右边事件 | ||
| 67 | - $("#to_right").click(function() { | ||
| 68 | - $("#left_div tbody tr:not(.muted)").click(); | ||
| 69 | - }); | ||
| 70 | - // 绑定全部移到左边事件 | ||
| 71 | - $("#to_left").click(function() { | ||
| 72 | - $("#right_div tbody tr:not(.muted)").click(); | ||
| 73 | - }); | ||
| 74 | - // 查询方法 | ||
| 75 | - function searchM() { | ||
| 76 | - // 清空已选定列表 | ||
| 77 | - $("#right_div table tbody").empty(); | ||
| 78 | - var params = {}; | ||
| 79 | - // 取得输入框的值 | ||
| 80 | - var inputs = $(".param input,select"); | ||
| 81 | - // 遍历数组 | ||
| 82 | - $.each(inputs, function(i, element) { | ||
| 83 | - if($(element).attr("type") == 'checkbox'){ | ||
| 84 | - if($(element).is(':checked')){ | ||
| 85 | - params[$(element).attr("name")] = $(element).val(); | ||
| 86 | - } | ||
| 87 | - }else{ | ||
| 88 | - params[$(element).attr("name")] = $(element).val(); | ||
| 89 | - } | ||
| 90 | - }); | ||
| 91 | - //params["isCancel_ne"] = true;// 过滤作废时刻表 | ||
| 92 | - var i = layer.load(2); | ||
| 93 | - $get('/tic_ec', params, function(data) { | ||
| 94 | - var content = data.data.content; | ||
| 95 | - _dateFormat(content); | ||
| 96 | - var bodyHtm = template('timeTemplet_list_temp', { | ||
| 97 | - list : content | ||
| 98 | - }); | ||
| 99 | - $("#left_div table tbody").empty(); | ||
| 100 | - $("#left_div table tbody").append(bodyHtm); | ||
| 101 | - $("#left_div tbody tr:not(.muted)").click(_click); | ||
| 102 | - layer.close(i); | ||
| 103 | - }); | ||
| 104 | - } | ||
| 105 | - | ||
| 106 | - // 上传方法 | ||
| 107 | - function uploadM() { | ||
| 108 | - | ||
| 109 | - // 取得输入框的值 | ||
| 110 | - var trs = $("#right_div tbody tr input"); | ||
| 111 | - if (trs.length == 0) { | ||
| 112 | - alert("请选择模板"); | ||
| 113 | - return; | ||
| 114 | - } | ||
| 115 | - var ids ="0,"; | ||
| 116 | - // 遍历数组 | ||
| 117 | - $.each(trs, function(i, element) { | ||
| 118 | - ids +=$(element).val()+","; | ||
| 119 | - }); | ||
| 120 | - var params = {"ids":ids}; | ||
| 121 | - $.ajax({ | ||
| 122 | - type: 'get',url: '/trmg/setSKB', | ||
| 123 | - data: params ,dataType:'text', | ||
| 124 | - success:function(data) { | ||
| 125 | - alert(data); | ||
| 126 | - }, error : function() { | ||
| 127 | - alert("操作失败"); | ||
| 128 | - } | ||
| 129 | - | ||
| 130 | - }); | ||
| 131 | - } | ||
| 132 | - | ||
| 133 | - // 表格行的单击事件 | ||
| 134 | - function _click() { | ||
| 135 | - var tmpTr = $(this).clone(); | ||
| 136 | - tmpTr.unbind("click").click(_click); | ||
| 137 | - // 判断父DIV的ID | ||
| 138 | - if ($(this).closest(".table-container").attr("id") == "left_div") { | ||
| 139 | - // 把要移动行的class=".seq"的HTML的内容设成另一分类的最后一个序号 | ||
| 140 | - $(".seq", tmpTr).html( | ||
| 141 | - $("#right_div tbody tr:not(.muted)").length + 1); | ||
| 142 | - $("#right_div tbody").append(tmpTr); | ||
| 143 | - nextAllChildSeqMinusOne($(this)); | ||
| 144 | - } else { | ||
| 145 | - // 把要移动行的class=".seq"的HTML的内容设成另一分类的最后一个序号 | ||
| 146 | - $(".seq", tmpTr).html( | ||
| 147 | - $("#left_div tbody tr:not(.muted)").length + 1); | ||
| 148 | - $("#left_div tbody").append(tmpTr); | ||
| 149 | - nextAllChildSeqMinusOne($(this)); | ||
| 150 | - } | ||
| 151 | - $(this).remove(); | ||
| 152 | - } | ||
| 153 | - | ||
| 154 | - // 后面所有兄弟节点的中class=".seq"的HTML的内容自减 1 | ||
| 155 | - function nextAllChildSeqMinusOne(theElement) { | ||
| 156 | - $.each(theElement.nextAll(), function(i, e) { | ||
| 157 | - $(".seq", e).html($(".seq", e).html() - 1); | ||
| 158 | - }); | ||
| 159 | - } | ||
| 160 | - // 保存左边空表格 | ||
| 161 | - var leftDivTemplate = $("#left_div table").clone(true); | ||
| 162 | - // 把左边表格的格式复制到右边 | ||
| 163 | - $("#right_div").append(leftDivTemplate); | ||
| 164 | - //转换时间格式 | ||
| 165 | - function _dateFormat(list) { | ||
| 166 | - var fs = 'YYYY-MM-DD HH:mm'; | ||
| 167 | - $.each(list, function(i, obj) { | ||
| 168 | - obj.qyrq = moment(obj.qyrq).format(fs); | ||
| 169 | - }); | ||
| 170 | - } | ||
| 171 | - | ||
| 172 | - // 绑定查询事件 | ||
| 173 | - $("#setCL").click(setCLF); | ||
| 174 | - var params = {}; | ||
| 175 | - function setCLF() { | ||
| 176 | - $.ajax({ | ||
| 177 | - type: 'get',url: '/trmg/setCL', | ||
| 178 | - data: params ,dataType:'text', | ||
| 179 | - success:function(data) { | ||
| 180 | - alert(data); | ||
| 181 | - }, error : function() { | ||
| 182 | - alert("操作失败"); | ||
| 183 | - } | ||
| 184 | - | ||
| 185 | - }); | ||
| 186 | - } | ||
| 187 | - | ||
| 188 | - // 绑定查询事件 | ||
| 189 | - $("#setSJ").click(setSJF); | ||
| 190 | - var params = {}; | ||
| 191 | - function setSJF() { | ||
| 192 | - $.ajax({ | ||
| 193 | - type: 'get',url: '/trmg/setSJ', | ||
| 194 | - data: params ,dataType:'text', | ||
| 195 | - success:function(data) { | ||
| 196 | - alert(data); | ||
| 197 | - }, error : function() { | ||
| 198 | - alert("操作失败"); | ||
| 199 | - } | ||
| 200 | - | ||
| 201 | - }); | ||
| 202 | - } | ||
| 203 | - | ||
| 204 | - // 绑定查询事件 | ||
| 205 | - $("#setLD").click(setLDF); | ||
| 206 | - var params = {}; | ||
| 207 | - function setLDF() { | ||
| 208 | - $.ajax({ | ||
| 209 | - type: 'get',url: '/trmg/setLD', | ||
| 210 | - data: params ,dataType:'text', | ||
| 211 | - success:function(data) { | ||
| 212 | - alert(data); | ||
| 213 | - }, error : function() { | ||
| 214 | - alert("操作失败"); | ||
| 215 | - } | ||
| 216 | - | ||
| 217 | - }); | ||
| 218 | - } | ||
| 219 | - | ||
| 220 | - // 绑定查询事件 | ||
| 221 | - $("#setLDFile").click(setLDFileF); | ||
| 222 | - var params = {}; | ||
| 223 | - function setLDFileF() { | ||
| 224 | - $.ajax({ | ||
| 225 | - type: 'get',url: '/trmg/setLDFile', | ||
| 226 | - data: params ,dataType:'text', | ||
| 227 | - success:function(data) { | ||
| 228 | - alert(data); | ||
| 229 | - }, error : function() { | ||
| 230 | - alert("操作失败"); | ||
| 231 | - } | ||
| 232 | - | ||
| 233 | - }); | ||
| 234 | - } | ||
| 235 | - | ||
| 236 | - // 绑定查询事件 | ||
| 237 | - $("#setLCYH").click(setLCYHF); | ||
| 238 | - var params = {}; | ||
| 239 | - function setLCYHF() { | ||
| 240 | - $.ajax({ | ||
| 241 | - type: 'get',url: '/trmg/setLCYH', | ||
| 242 | - data: params ,dataType:'text', | ||
| 243 | - success:function(data) { | ||
| 244 | - alert(data); | ||
| 245 | - }, error : function() { | ||
| 246 | - alert("操作失败"); | ||
| 247 | - } | ||
| 248 | - | ||
| 249 | - }); | ||
| 250 | - } | ||
| 251 | - | ||
| 252 | - // 绑定查询事件 | ||
| 253 | - $("#setDDRB").click(setDDRBF); | ||
| 254 | - var params = {}; | ||
| 255 | - function setDDRBF() { | ||
| 256 | - $.ajax({ | ||
| 257 | - type: 'get',url: '/trmg/setDDRB', | ||
| 258 | - data: params ,dataType:'text', | ||
| 259 | - success:function(data) { | ||
| 260 | - alert(data); | ||
| 261 | - }, error : function() { | ||
| 262 | - alert("操作失败"); | ||
| 263 | - } | ||
| 264 | - | ||
| 265 | - }); | ||
| 266 | - } | ||
| 267 | - | ||
| 268 | - // 绑定查询事件 | ||
| 269 | - $("#setJHBC").click(setJHBCF); | ||
| 270 | - var params = {}; | ||
| 271 | - function setJHBCF() { | ||
| 272 | - $.ajax({ | ||
| 273 | - type: 'get',url: '/trmg/setJHBC', | ||
| 274 | - data: params ,dataType:'text', | ||
| 275 | - success:function(data) { | ||
| 276 | - alert(data); | ||
| 277 | - }, error : function() { | ||
| 278 | - alert("操作失败"); | ||
| 279 | - } | ||
| 280 | - | ||
| 281 | - }); | ||
| 282 | - } | ||
| 283 | - | ||
| 284 | - // 绑定查询事件 | ||
| 285 | - $("#setXLPC").click(setXLPCF); | ||
| 286 | - var params = {}; | ||
| 287 | - function setXLPCF() { | ||
| 288 | - $.ajax({ | ||
| 289 | - type: 'get',url: '/trmg/setXLPC', | ||
| 290 | - data: params ,dataType:'text', | ||
| 291 | - success:function(data) { | ||
| 292 | - alert(data); | ||
| 293 | - }, error : function() { | ||
| 294 | - alert("操作失败"); | ||
| 295 | - } | ||
| 296 | - | ||
| 297 | - }); | ||
| 298 | - } | ||
| 299 | - | ||
| 300 | - | ||
| 301 | - // 绑定查询事件 | ||
| 302 | - $("#setCS").click(setCSF); | ||
| 303 | - var params = {}; | ||
| 304 | - function setCSF() { | ||
| 305 | - $.ajax({ | ||
| 306 | - type: 'get',url: '/trmg/setCS', | ||
| 307 | - data: params ,dataType:'text', | ||
| 308 | - success:function(data) { | ||
| 309 | - alert(data); | ||
| 310 | - }, error : function() { | ||
| 311 | - alert("操作失败"); | ||
| 312 | - } | ||
| 313 | - | ||
| 314 | - }); | ||
| 315 | - } | ||
| 316 | - | ||
| 317 | - // 绑定查询事件 | ||
| 318 | - $("#downloadAllDataFile").click(getDownLoadAllDataFileF); | ||
| 319 | - var params = {}; | ||
| 320 | - function getDownLoadAllDataFileF() { | ||
| 321 | - $.ajax({ | ||
| 322 | - type: 'get',url: '/trmg/getDownLoadAllDataFile', | ||
| 323 | - data: params ,dataType:'text', | ||
| 324 | - success:function(data) { | ||
| 325 | - alert(data); | ||
| 326 | - }, error : function() { | ||
| 327 | - alert("操作失败"); | ||
| 328 | - } | ||
| 329 | - | ||
| 330 | - }); | ||
| 331 | - } | ||
| 332 | - | 1 | +/** |
| 2 | + * | ||
| 3 | + * @JSName : timeTempletUpload.js(运管处js) | ||
| 4 | + * | ||
| 5 | + * @Author : bsth@zq | ||
| 6 | + * | ||
| 7 | + * @Description : TODO(运管功能公共js) | ||
| 8 | + * | ||
| 9 | + * @Data : 2016年6月29日 上午9:21:17 | ||
| 10 | + * | ||
| 11 | + * @Version 公交调度系统BS版 0.1 | ||
| 12 | + * | ||
| 13 | + */ | ||
| 14 | + | ||
| 15 | +(function(){ | ||
| 16 | + function getDate(cb) { | ||
| 17 | + $.ajax({ | ||
| 18 | + url: "/real_control_v2/assets/imgs/time.gif", | ||
| 19 | + type: "HEAD" | ||
| 20 | + }).done(function (data, textStatus, jqXHR) { | ||
| 21 | + cb(jqXHR && jqXHR.getResponseHeader("Date")) | ||
| 22 | + }).fail(function (jqXHR, textStatus, errorThrown) { | ||
| 23 | + cb(jqXHR && jqXHR.getResponseHeader("Date")) | ||
| 24 | + }) | ||
| 25 | + } | ||
| 26 | + | ||
| 27 | + function getComp(cb) { | ||
| 28 | + $.get('/user/companyData',null,function(rs) { | ||
| 29 | + return cb && cb(rs); | ||
| 30 | + }); | ||
| 31 | + } | ||
| 32 | + | ||
| 33 | + initLineSelect2(); | ||
| 34 | + | ||
| 35 | + function initLineSelect2(compD) { | ||
| 36 | + getComp(function(rs) { | ||
| 37 | + var params = {}; | ||
| 38 | + if(rs.length>0) { | ||
| 39 | + var compA = new Array(); | ||
| 40 | + for(var c = 0 ; c<rs.length;c++) { | ||
| 41 | + var comC = rs[c].companyCode; | ||
| 42 | + var child = rs[c].children; | ||
| 43 | + if(child.length>0) { | ||
| 44 | + for(var d = 0 ;d< child.length;d++) { | ||
| 45 | + compA.push(comC + '_' + child[d].code); | ||
| 46 | + } | ||
| 47 | + }else { | ||
| 48 | + compA.push(comC); | ||
| 49 | + } | ||
| 50 | + } | ||
| 51 | + params.cgsbm_in = compA.toString(); | ||
| 52 | + } | ||
| 53 | + params["remove_ne"] = 1; | ||
| 54 | + // 填充线路拉框选择值 | ||
| 55 | + $get('/line/all', params, function(array){ | ||
| 56 | + var len_ = array.length,paramsD = new Array(); | ||
| 57 | + if(len_>0) { | ||
| 58 | + $.each(array, function(i, g){ | ||
| 59 | + if(g.name!='' || g.name != null) { | ||
| 60 | + paramsD.push({'id':g.id ,'text':g.name}); | ||
| 61 | + } | ||
| 62 | + }); | ||
| 63 | + initPinYinSelect2($('#line'),paramsD,function(selector) { | ||
| 64 | + selector.select2("val", storage.xlName_AgursData); | ||
| 65 | + }); | ||
| 66 | + } | ||
| 67 | + }); | ||
| 68 | + }); | ||
| 69 | + } | ||
| 70 | + | ||
| 71 | + | ||
| 72 | + // 绑定查询事件 | ||
| 73 | + $("#search").click(searchM); | ||
| 74 | + // 绑定上传事件 | ||
| 75 | + $("#upload").click(uploadM); | ||
| 76 | + // 绑定全部移到右边事件 | ||
| 77 | + $("#to_right").click(function() { | ||
| 78 | + $("#left_div tbody tr:not(.muted)").dblclick(); | ||
| 79 | + }); | ||
| 80 | + // 绑定全部移到左边事件 | ||
| 81 | + $("#to_left").click(function() { | ||
| 82 | + $("#right_div tbody tr:not(.muted)").dblclick(); | ||
| 83 | + }); | ||
| 84 | + // 查询方法 | ||
| 85 | + function searchM() { | ||
| 86 | + // 清空已选定列表 | ||
| 87 | + $("#right_div table tbody").empty(); | ||
| 88 | + var params = {}; | ||
| 89 | + // 取得输入框的值 | ||
| 90 | + var inputs = $(".param input,select"); | ||
| 91 | + // 遍历数组 | ||
| 92 | + $.each(inputs, function(i, element) { | ||
| 93 | + if($(element).attr("type") == 'checkbox'){ | ||
| 94 | + if($(element).is(':checked')){ | ||
| 95 | + params[$(element).attr("name")] = $(element).val(); | ||
| 96 | + } | ||
| 97 | + }else{ | ||
| 98 | + params[$(element).attr("name")] = $(element).val(); | ||
| 99 | + } | ||
| 100 | + }); | ||
| 101 | + //params["isCancel_ne"] = true;// 过滤作废时刻表 | ||
| 102 | + var i = layer.load(2); | ||
| 103 | + $get('/tic_ec', params, function(data) { | ||
| 104 | + var content = data.data.content; | ||
| 105 | + _dateFormat(content); | ||
| 106 | + var bodyHtm = template('timeTemplet_list_temp', { | ||
| 107 | + list : content | ||
| 108 | + }); | ||
| 109 | + $("#left_div table tbody").empty(); | ||
| 110 | + $("#left_div table tbody").append(bodyHtm); | ||
| 111 | + $("#left_div tbody tr:not(.muted)").dblclick(_dblclick); | ||
| 112 | + $('.datetime').datetimepicker({ | ||
| 113 | + format : 'YYYY-MM-DD', | ||
| 114 | + locale: 'zh-cn', | ||
| 115 | + minDate: moment().add(1,'days').toString() | ||
| 116 | + }); | ||
| 117 | + layer.close(i); | ||
| 118 | + }); | ||
| 119 | + } | ||
| 120 | + | ||
| 121 | + // 表格行的单击事件 | ||
| 122 | + function _dblclick() { | ||
| 123 | + if ($('.datetime').data("DateTimePicker")) { | ||
| 124 | + $('.datetime').data("DateTimePicker").destroy(); | ||
| 125 | + } | ||
| 126 | + var tmpTr = $(this).clone(); | ||
| 127 | + tmpTr.unbind("dblclick").dblclick(_dblclick); | ||
| 128 | + // 判断父DIV的ID | ||
| 129 | + if ($(this).closest(".table-container").attr("id") == "left_div") { | ||
| 130 | + // 把要移动行的class=".seq"的HTML的内容设成另一分类的最后一个序号 | ||
| 131 | + $(".seq", tmpTr).html( | ||
| 132 | + $("#right_div tbody tr:not(.muted)").length + 1); | ||
| 133 | + $("#right_div tbody").append(tmpTr); | ||
| 134 | + nextAllChildSeqMinusOne($(this)); | ||
| 135 | + } else { | ||
| 136 | + // 把要移动行的class=".seq"的HTML的内容设成另一分类的最后一个序号 | ||
| 137 | + $(".seq", tmpTr).html( | ||
| 138 | + $("#left_div tbody tr:not(.muted)").length + 1); | ||
| 139 | + $("#left_div tbody").append(tmpTr); | ||
| 140 | + nextAllChildSeqMinusOne($(this)); | ||
| 141 | + } | ||
| 142 | + $('#left_div .datetime').attr('disabled', false).datetimepicker({format : 'YYYY-MM-DD', locale: 'zh-cn', minDate: moment().add(1,'days').toString()}); | ||
| 143 | + $('#right_div .datetime').attr('disabled', true); | ||
| 144 | + //$("#left_div .datetime") | ||
| 145 | + $(this).remove(); | ||
| 146 | + } | ||
| 147 | + | ||
| 148 | + // 上传方法 | ||
| 149 | + function uploadM() { | ||
| 150 | + | ||
| 151 | + // 取得输入框的值 | ||
| 152 | + var trs = $("#right_div tbody tr input[name='tid']"), trs1 = $("#right_div tbody tr input[name='tqyrq']"); | ||
| 153 | + if (trs.length == 0) { | ||
| 154 | + alert("请选择模板"); | ||
| 155 | + return; | ||
| 156 | + } | ||
| 157 | + var ids ="0,",qyrqs = "0,"; | ||
| 158 | + // 遍历数组 | ||
| 159 | + $.each(trs, function(i, element) { | ||
| 160 | + ids +=$(element).val()+","; | ||
| 161 | + }); | ||
| 162 | + $.each(trs1, function(i, element) { | ||
| 163 | + qyrqs +=$(element).val()+","; | ||
| 164 | + }); | ||
| 165 | + var params = {"ids":ids, "qyrqs":qyrqs}; | ||
| 166 | + $.ajax({ | ||
| 167 | + type: 'get',url: '/trmg/setSKB', | ||
| 168 | + data: params ,dataType:'text', | ||
| 169 | + success:function(data) { | ||
| 170 | + alert(data); | ||
| 171 | + }, error : function() { | ||
| 172 | + alert("操作失败"); | ||
| 173 | + } | ||
| 174 | + | ||
| 175 | + }); | ||
| 176 | + } | ||
| 177 | + | ||
| 178 | + // 后面所有兄弟节点的中class=".seq"的HTML的内容自减 1 | ||
| 179 | + function nextAllChildSeqMinusOne(theElement) { | ||
| 180 | + $.each(theElement.nextAll(), function(i, e) { | ||
| 181 | + $(".seq", e).html($(".seq", e).html() - 1); | ||
| 182 | + }); | ||
| 183 | + } | ||
| 184 | + // 保存左边空表格 | ||
| 185 | + var leftDivTemplate = $("#left_div table").clone(true); | ||
| 186 | + // 把左边表格的格式复制到右边 | ||
| 187 | + $("#right_div").append(leftDivTemplate); | ||
| 188 | + //转换时间格式 | ||
| 189 | + function _dateFormat(list) { | ||
| 190 | + var fs = 'YYYY-MM-DD HH:mm'; | ||
| 191 | + $.each(list, function(i, obj) { | ||
| 192 | + obj.qyrq = moment(obj.qyrq).format(fs); | ||
| 193 | + }); | ||
| 194 | + } | ||
| 195 | + | ||
| 196 | + // 绑定查询事件 | ||
| 197 | + $("#setCL").click(setCLF); | ||
| 198 | + var params = {}; | ||
| 199 | + function setCLF() { | ||
| 200 | + $.ajax({ | ||
| 201 | + type: 'get',url: '/trmg/setCL', | ||
| 202 | + data: params ,dataType:'text', | ||
| 203 | + success:function(data) { | ||
| 204 | + alert(data); | ||
| 205 | + }, error : function() { | ||
| 206 | + alert("操作失败"); | ||
| 207 | + } | ||
| 208 | + | ||
| 209 | + }); | ||
| 210 | + } | ||
| 211 | + | ||
| 212 | + // 绑定查询事件 | ||
| 213 | + $("#setSJ").click(setSJF); | ||
| 214 | + var params = {}; | ||
| 215 | + function setSJF() { | ||
| 216 | + $.ajax({ | ||
| 217 | + type: 'get',url: '/trmg/setSJ', | ||
| 218 | + data: params ,dataType:'text', | ||
| 219 | + success:function(data) { | ||
| 220 | + alert(data); | ||
| 221 | + }, error : function() { | ||
| 222 | + alert("操作失败"); | ||
| 223 | + } | ||
| 224 | + | ||
| 225 | + }); | ||
| 226 | + } | ||
| 227 | + | ||
| 228 | + // 绑定查询事件 | ||
| 229 | + $("#setLD").click(setLDF); | ||
| 230 | + var params = {}; | ||
| 231 | + function setLDF() { | ||
| 232 | + $.ajax({ | ||
| 233 | + type: 'get',url: '/trmg/setLD', | ||
| 234 | + data: params ,dataType:'text', | ||
| 235 | + success:function(data) { | ||
| 236 | + alert(data); | ||
| 237 | + }, error : function() { | ||
| 238 | + alert("操作失败"); | ||
| 239 | + } | ||
| 240 | + | ||
| 241 | + }); | ||
| 242 | + } | ||
| 243 | + | ||
| 244 | + // 绑定查询事件 | ||
| 245 | + $("#setLDFile").click(setLDFileF); | ||
| 246 | + var params = {}; | ||
| 247 | + function setLDFileF() { | ||
| 248 | + $.ajax({ | ||
| 249 | + type: 'get',url: '/trmg/setLDFile', | ||
| 250 | + data: params ,dataType:'text', | ||
| 251 | + success:function(data) { | ||
| 252 | + alert(data); | ||
| 253 | + }, error : function() { | ||
| 254 | + alert("操作失败"); | ||
| 255 | + } | ||
| 256 | + | ||
| 257 | + }); | ||
| 258 | + } | ||
| 259 | + | ||
| 260 | + // 绑定查询事件 | ||
| 261 | + $("#setLCYH").click(setLCYHF); | ||
| 262 | + var params = {}; | ||
| 263 | + function setLCYHF() { | ||
| 264 | + $.ajax({ | ||
| 265 | + type: 'get',url: '/trmg/setLCYH', | ||
| 266 | + data: params ,dataType:'text', | ||
| 267 | + success:function(data) { | ||
| 268 | + alert(data); | ||
| 269 | + }, error : function() { | ||
| 270 | + alert("操作失败"); | ||
| 271 | + } | ||
| 272 | + | ||
| 273 | + }); | ||
| 274 | + } | ||
| 275 | + | ||
| 276 | + // 绑定查询事件 | ||
| 277 | + $("#setDDRB").click(setDDRBF); | ||
| 278 | + var params = {}; | ||
| 279 | + function setDDRBF() { | ||
| 280 | + $.ajax({ | ||
| 281 | + type: 'get',url: '/trmg/setDDRB', | ||
| 282 | + data: params ,dataType:'text', | ||
| 283 | + success:function(data) { | ||
| 284 | + alert(data); | ||
| 285 | + }, error : function() { | ||
| 286 | + alert("操作失败"); | ||
| 287 | + } | ||
| 288 | + | ||
| 289 | + }); | ||
| 290 | + } | ||
| 291 | + | ||
| 292 | + // 绑定查询事件 | ||
| 293 | + $("#setJHBC").click(setJHBCF); | ||
| 294 | + var params = {}; | ||
| 295 | + function setJHBCF() { | ||
| 296 | + $.ajax({ | ||
| 297 | + type: 'get',url: '/trmg/setJHBC', | ||
| 298 | + data: params ,dataType:'text', | ||
| 299 | + success:function(data) { | ||
| 300 | + alert(data); | ||
| 301 | + }, error : function() { | ||
| 302 | + alert("操作失败"); | ||
| 303 | + } | ||
| 304 | + | ||
| 305 | + }); | ||
| 306 | + } | ||
| 307 | + | ||
| 308 | + // 绑定查询事件 | ||
| 309 | + $("#setXLPC").click(setXLPCF); | ||
| 310 | + var params = {}; | ||
| 311 | + function setXLPCF() { | ||
| 312 | + $.ajax({ | ||
| 313 | + type: 'get',url: '/trmg/setXLPC', | ||
| 314 | + data: params ,dataType:'text', | ||
| 315 | + success:function(data) { | ||
| 316 | + alert(data); | ||
| 317 | + }, error : function() { | ||
| 318 | + alert("操作失败"); | ||
| 319 | + } | ||
| 320 | + | ||
| 321 | + }); | ||
| 322 | + } | ||
| 323 | + | ||
| 324 | + | ||
| 325 | + // 绑定查询事件 | ||
| 326 | + $("#setCS").click(setCSF); | ||
| 327 | + var params = {}; | ||
| 328 | + function setCSF() { | ||
| 329 | + $.ajax({ | ||
| 330 | + type: 'get',url: '/trmg/setCS', | ||
| 331 | + data: params ,dataType:'text', | ||
| 332 | + success:function(data) { | ||
| 333 | + alert(data); | ||
| 334 | + }, error : function() { | ||
| 335 | + alert("操作失败"); | ||
| 336 | + } | ||
| 337 | + | ||
| 338 | + }); | ||
| 339 | + } | ||
| 340 | + | ||
| 341 | + // 绑定查询事件 | ||
| 342 | + $("#downloadAllDataFile").click(getDownLoadAllDataFileF); | ||
| 343 | + var params = {}; | ||
| 344 | + function getDownLoadAllDataFileF() { | ||
| 345 | + $.ajax({ | ||
| 346 | + type: 'get',url: '/trmg/getDownLoadAllDataFile', | ||
| 347 | + data: params ,dataType:'text', | ||
| 348 | + success:function(data) { | ||
| 349 | + alert(data); | ||
| 350 | + }, error : function() { | ||
| 351 | + alert("操作失败"); | ||
| 352 | + } | ||
| 353 | + | ||
| 354 | + }); | ||
| 355 | + } | ||
| 356 | + | ||
| 333 | })(); | 357 | })(); |
| 334 | \ No newline at end of file | 358 | \ No newline at end of file |
src/main/resources/static/pages/trafficManage/timeTempletUpload.html
| 1 | -<link href="css/trafficManage.css" rel="stylesheet" type="text/css" /> | ||
| 2 | -<ul class="page-breadcrumb breadcrumb"> | ||
| 3 | - <li><a href="/pages/home.html" data-pjax>首页</a> <i | ||
| 4 | - class="fa fa-circle"></i></li> | ||
| 5 | - <li><span class="active">运维管理</span> <i class="fa fa-circle"></i></li> | ||
| 6 | - <li><span class="active">时刻模板上传</span></li> | ||
| 7 | -</ul> | ||
| 8 | -<div class="tab_line"> | ||
| 9 | - <div class="col-md-12"> | ||
| 10 | - <form class="form-inline" action=""> | ||
| 11 | - <div style="display: inline-block;" class="param"> | ||
| 12 | - <span class="item-label" style="width: 80px;">线路: </span> | ||
| 13 | - <select class="form-control" name="xl.id_eq" id="line" style="width: 180px;"></select> | ||
| 14 | - </div> | ||
| 15 | - <div style="display: inline-block;margin-left: 15px;" class="param"> | ||
| 16 | - <span class="item-label" style="width: 80px;">模板名称(关键字): </span> | ||
| 17 | - <input class="form-control" type="text" id="tempName" name="name_like" style="width: 180px;"/> | ||
| 18 | - </div> | ||
| 19 | - <div style="display: inline-block;margin-left: 15px;" class="param"> | ||
| 20 | - <input type="checkbox" class="group-checkable icheck" name="isEnableDisTemplate_eq" value="true" checked> 是否启用 | ||
| 21 | - </div> | ||
| 22 | - <div class="form-group" style="display: inline-block;margin-left: 15px;"> | ||
| 23 | - <input class="btn btn-default" type="button" id="search" value="查询"/> | ||
| 24 | - <input class="btn btn-default" type="button" id="upload" value="上传"/> | ||
| 25 | - <!-- <input class="btn btn-default" type="button" id="setXL" value="上传线路"/> | ||
| 26 | - <input class="btn btn-default" type="button" id="setCL" value="上传车辆"/> | ||
| 27 | - <input class="btn btn-default" type="button" id="setSJ" value="上传司机"/> | ||
| 28 | - <input class="btn btn-default" type="button" id="setCS" value="超速"/> | ||
| 29 | - <input class="btn btn-default" type="button" id="setXLPC" value="线路人员车辆"/> | ||
| 30 | - <input class="btn btn-default" type="button" id="setJHBC" value="线路计划班次表"/> --> | ||
| 31 | - </div> | ||
| 32 | - </form> | ||
| 33 | - </div> | ||
| 34 | - <!-- Begin: left-div --> | ||
| 35 | - <div class="col-md-5 panel-wrap" style="height: 60%;"> | ||
| 36 | - <div class="_panel"> | ||
| 37 | - <div class="_head" style="color: #2765A7;">待选线路模板列表</div> | ||
| 38 | - <div class="table-container" id="left_div"> | ||
| 39 | - <table | ||
| 40 | - class="table table-striped table-bordered table-advance pb-table head"> | ||
| 41 | - <thead> | ||
| 42 | - <tr> | ||
| 43 | - <th width="5%">#</th> | ||
| 44 | - <th width="20%">线路名称</th> | ||
| 45 | - <th width="15%">模板ID</th> | ||
| 46 | - <th width="25%">模板名称</th> | ||
| 47 | - <th>启用日期</th> | ||
| 48 | - </tr> | ||
| 49 | - </thead> | ||
| 50 | - <tbody> | ||
| 51 | - </tbody> | ||
| 52 | - </table> | ||
| 53 | - </div> | ||
| 54 | - </div> | ||
| 55 | - </div> | ||
| 56 | - <div class="col-md-2" style="height: 60%;"> | ||
| 57 | - <ul class="breadcruma divVerHorCenter"> | ||
| 58 | - <li><a class="btn btn-circle blue btn-outline" id="to_right">>></a></li> | ||
| 59 | - <li><a class="btn btn-circle blue btn-outline" id="to_left"><<</a></li> | ||
| 60 | - </ul> | ||
| 61 | - </div> | ||
| 62 | - <!-- End: left-div --> | ||
| 63 | - <!-- Begin: right-div --> | ||
| 64 | - <div class="col-md-5 panel-wrap" style="height: 60%;"> | ||
| 65 | - <div class="_panel"> | ||
| 66 | - <div class="_head" style="color: #2765A7;">已选线路模板列表</div> | ||
| 67 | - <div class="table-container" id="right_div"></div> | ||
| 68 | - </div> | ||
| 69 | - </div> | ||
| 70 | - <!-- End: right-div --> | ||
| 71 | -</div> | ||
| 72 | -<script id="timeTemplet_list_temp" type="text/html"> | ||
| 73 | -{{each list as obj i}} | ||
| 74 | -<tr> | ||
| 75 | - <td class="seq" style="vertical-align: middle;"> | ||
| 76 | - {{i+1}} | ||
| 77 | - </td> | ||
| 78 | - <td> | ||
| 79 | - {{obj.xl.name}} | ||
| 80 | - </td> | ||
| 81 | - <td class="ttInfoId"> | ||
| 82 | - {{obj.id}} | ||
| 83 | - <input type="hidden" value="{{obj.id}}"/> | ||
| 84 | - </td> | ||
| 85 | - <td> | ||
| 86 | - {{obj.name}} | ||
| 87 | - </td> | ||
| 88 | - <td > | ||
| 89 | - {{obj.qyrq}} | ||
| 90 | - </td> | ||
| 91 | -</tr> | ||
| 92 | -{{/each}} | ||
| 93 | -{{if list.length == 0}} | ||
| 94 | -<tr class="muted"> | ||
| 95 | - <td colspan=5 style="text-align: center;"><h6>没有找到相关数据</h6></td> | ||
| 96 | -</tr> | ||
| 97 | -{{/if}} | ||
| 98 | - </script> | 1 | +<link href="css/trafficManage.css" rel="stylesheet" type="text/css" /> |
| 2 | +<ul class="page-breadcrumb breadcrumb"> | ||
| 3 | + <li><a href="/pages/home.html" data-pjax>首页</a> <i | ||
| 4 | + class="fa fa-circle"></i></li> | ||
| 5 | + <li><span class="active">运维管理</span> <i class="fa fa-circle"></i></li> | ||
| 6 | + <li><span class="active">时刻模板上传</span></li> | ||
| 7 | +</ul> | ||
| 8 | +<div class="tab_line"> | ||
| 9 | + <div class="col-md-12"> | ||
| 10 | + <form class="form-inline" action=""> | ||
| 11 | + <div style="display: inline-block;" class="param"> | ||
| 12 | + <span class="item-label" style="width: 80px;">线路: </span> | ||
| 13 | + <select class="form-control" name="xl.id_eq" id="line" style="width: 180px;"></select> | ||
| 14 | + </div> | ||
| 15 | + <div style="display: inline-block;margin-left: 15px;" class="param"> | ||
| 16 | + <span class="item-label" style="width: 80px;">模板名称(关键字): </span> | ||
| 17 | + <input class="form-control" type="text" id="tempName" name="name_like" style="width: 180px;"/> | ||
| 18 | + </div> | ||
| 19 | + <div style="display: inline-block;margin-left: 15px;" class="param"> | ||
| 20 | + <input type="checkbox" class="group-checkable icheck" name="isEnableDisTemplate_eq" value="true" checked> 是否启用 | ||
| 21 | + </div> | ||
| 22 | + <div class="form-group" style="display: inline-block;margin-left: 15px;"> | ||
| 23 | + <input class="btn btn-default" type="button" id="search" value="查询"/> | ||
| 24 | + <input class="btn btn-default" type="button" id="upload" value="上传"/> | ||
| 25 | + <!-- <input class="btn btn-default" type="button" id="setXL" value="上传线路"/> | ||
| 26 | + <input class="btn btn-default" type="button" id="setCL" value="上传车辆"/> | ||
| 27 | + <input class="btn btn-default" type="button" id="setSJ" value="上传司机"/> | ||
| 28 | + <input class="btn btn-default" type="button" id="setCS" value="超速"/> | ||
| 29 | + <input class="btn btn-default" type="button" id="setXLPC" value="线路人员车辆"/> | ||
| 30 | + <input class="btn btn-default" type="button" id="setJHBC" value="线路计划班次表"/> --> | ||
| 31 | + </div> | ||
| 32 | + </form> | ||
| 33 | + </div> | ||
| 34 | + <!-- Begin: left-div --> | ||
| 35 | + <div class="col-md-5 panel-wrap" style="height: 60%;"> | ||
| 36 | + <div class="_panel"> | ||
| 37 | + <div class="_head" style="color: #2765A7;">待选线路模板列表</div> | ||
| 38 | + <div class="table-container" id="left_div"> | ||
| 39 | + <table | ||
| 40 | + class="table table-striped table-bordered table-advance pb-table head"> | ||
| 41 | + <thead> | ||
| 42 | + <tr> | ||
| 43 | + <th width="5%">#</th> | ||
| 44 | + <th width="20%">线路名称</th> | ||
| 45 | + <th width="15%">模板ID</th> | ||
| 46 | + <th width="25%">模板名称</th> | ||
| 47 | + <th>灾备系统启用日期</th> | ||
| 48 | + </tr> | ||
| 49 | + </thead> | ||
| 50 | + <tbody> | ||
| 51 | + </tbody> | ||
| 52 | + </table> | ||
| 53 | + </div> | ||
| 54 | + </div> | ||
| 55 | + </div> | ||
| 56 | + <div class="col-md-2" style="height: 60%;"> | ||
| 57 | + <ul class="breadcruma divVerHorCenter"> | ||
| 58 | + <li><a class="btn btn-circle blue btn-outline" id="to_right">>></a></li> | ||
| 59 | + <li><a class="btn btn-circle blue btn-outline" id="to_left"><<</a></li> | ||
| 60 | + </ul> | ||
| 61 | + </div> | ||
| 62 | + <!-- End: left-div --> | ||
| 63 | + <!-- Begin: right-div --> | ||
| 64 | + <div class="col-md-5 panel-wrap" style="height: 60%;"> | ||
| 65 | + <div class="_panel"> | ||
| 66 | + <div class="_head" style="color: #2765A7;">已选线路模板列表</div> | ||
| 67 | + <div class="table-container" id="right_div"></div> | ||
| 68 | + </div> | ||
| 69 | + </div> | ||
| 70 | + <!-- End: right-div --> | ||
| 71 | +</div> | ||
| 72 | +<script id="timeTemplet_list_temp" type="text/html"> | ||
| 73 | +{{each list as obj i}} | ||
| 74 | +<tr> | ||
| 75 | + <td class="seq" style="vertical-align: middle;"> | ||
| 76 | + {{i+1}} | ||
| 77 | + </td> | ||
| 78 | + <td> | ||
| 79 | + {{obj.xl.name}} | ||
| 80 | + </td> | ||
| 81 | + <td class="ttInfoId"> | ||
| 82 | + {{obj.id}} | ||
| 83 | + <input name="tid" type="hidden" value="{{obj.id}}"/> | ||
| 84 | + </td> | ||
| 85 | + <td> | ||
| 86 | + {{obj.name}} | ||
| 87 | + </td> | ||
| 88 | + <td > | ||
| 89 | + <input name="tqyrq" type="text" value="{{obj.qyrq}}" class="datetime" style="border: 0px;"/> | ||
| 90 | + </td> | ||
| 91 | +</tr> | ||
| 92 | +{{/each}} | ||
| 93 | +{{if list.length == 0}} | ||
| 94 | +<tr class="muted"> | ||
| 95 | + <td colspan=5 style="text-align: center;"><h6>没有找到相关数据</h6></td> | ||
| 96 | +</tr> | ||
| 97 | +{{/if}} | ||
| 98 | + </script> | ||
| 99 | <script src="./js/timeTempletUpload.js"></script> | 99 | <script src="./js/timeTempletUpload.js"></script> |
| 100 | \ No newline at end of file | 100 | \ No newline at end of file |
src/main/resources/static/real_control_v2/main.html
| @@ -110,12 +110,12 @@ | @@ -110,12 +110,12 @@ | ||
| 110 | </script> | 110 | </script> |
| 111 | 111 | ||
| 112 | <!-- 地图相关 --> | 112 | <!-- 地图相关 --> |
| 113 | -<script src="http://api.map.baidu.com/api?v=2.0&ak=IGGrr4UjwIYzatoCRFKEL8sT"></script> | ||
| 114 | -<script src="http://api.map.baidu.com/library/TrafficControl/1.4/src/TrafficControl_min.js"></script> | 113 | +<script src="//api.map.baidu.com/api?v=2.0&ak=IGGrr4UjwIYzatoCRFKEL8sT"></script> |
| 114 | +<script src="//api.map.baidu.com/library/TrafficControl/1.4/src/TrafficControl_min.js"></script> | ||
| 115 | <script src="/assets/js/baidu//MarkerClusterer.js" merge="plugins"></script> | 115 | <script src="/assets/js/baidu//MarkerClusterer.js" merge="plugins"></script> |
| 116 | <script src="/assets/js/TransGPS.js" merge="plugins"></script> | 116 | <script src="/assets/js/TransGPS.js" merge="plugins"></script> |
| 117 | <!-- 高德 --> | 117 | <!-- 高德 --> |
| 118 | -<script src="http://webapi.amap.com/maps?v=1.3&key=16cb1c5043847e09ef9edafdd77befda"></script> | 118 | +<script src="//webapi.amap.com/maps?v=1.3&key=16cb1c5043847e09ef9edafdd77befda"></script> |
| 119 | <!-- jquery --> | 119 | <!-- jquery --> |
| 120 | <script src="/real_control_v2/assets/js/jquery.min.js"></script> | 120 | <script src="/real_control_v2/assets/js/jquery.min.js"></script> |
| 121 | <!-- jquery actual --> | 121 | <!-- jquery actual --> |
| @@ -266,7 +266,7 @@ | @@ -266,7 +266,7 @@ | ||
| 266 | </div> | 266 | </div> |
| 267 | </div> | 267 | </div> |
| 268 | <div class="uk-form-row"> | 268 | <div class="uk-form-row"> |
| 269 | - <label class="uk-form-label" ">分机号:</label> | 269 | + <label class="uk-form-label">分机号:</label> |
| 270 | <div class="uk-form-controls"> | 270 | <div class="uk-form-controls"> |
| 271 | <input type="text" name="dn" value="" > | 271 | <input type="text" name="dn" value="" > |
| 272 | </div> | 272 | </div> |