Commit 89c1fc5a29b96f519766f9272f18eb81199dd8b1
Merge branch 'pudong_jdk8' of http://61.169.120.202:8888/panzhaov5/bsth_control into pudong_jdk8
Showing
36 changed files
with
8796 additions
and
8440 deletions
src/main/java/com/bsth/common/SystemParamKeys.java
| ... | ... | @@ -7,6 +7,8 @@ public class SystemParamKeys { |
| 7 | 7 | |
| 8 | 8 | public static final String SPECIAL_ROLES = "special.roles"; |
| 9 | 9 | |
| 10 | + public static final String SPECIAL_DAYS = "special.days"; | |
| 11 | + | |
| 10 | 12 | public static final String URL_HTTP_GPS_REAL_CACHE = "url.http.gps.real.cache"; |
| 11 | 13 | |
| 12 | 14 | public static final String URL_HTTP_GPS_REAL = "url.http.gps.real"; | ... | ... |
src/main/java/com/bsth/controller/GeoPremiseController.java
| ... | ... | @@ -3,6 +3,7 @@ package com.bsth.controller; |
| 3 | 3 | import com.bsth.common.ResponseCode; |
| 4 | 4 | import com.bsth.entity.GeoPremise; |
| 5 | 5 | import com.bsth.service.GeoPremiseService; |
| 6 | +import com.bsth.util.GeoConverter; | |
| 6 | 7 | import org.springframework.beans.factory.annotation.Autowired; |
| 7 | 8 | import org.springframework.web.bind.annotation.RequestMapping; |
| 8 | 9 | import org.springframework.web.bind.annotation.RequestMethod; |
| ... | ... | @@ -26,6 +27,8 @@ public class GeoPremiseController extends BaseController<GeoPremise, Integer> { |
| 26 | 27 | public Map<String, Object> save(GeoPremise geoPremise) { |
| 27 | 28 | Map<String, Object> result = new HashMap<>(); |
| 28 | 29 | try { |
| 30 | + String coords = geoPremise.getCoords(); | |
| 31 | + geoPremise.setCoordsWgs(GeoConverter.polygonBd2wgs(String.format("POLYGON((%s))", coords)).toString().replace("POLYGON((", "").replace("))", "")); | |
| 29 | 32 | result.putAll(geoPremiseService.save(geoPremise)); |
| 30 | 33 | result.put("status", ResponseCode.SUCCESS); |
| 31 | 34 | } catch (Exception e) { | ... | ... |
src/main/java/com/bsth/controller/realcontrol/AdminUtilsController.java
| ... | ... | @@ -8,7 +8,6 @@ import com.bsth.data.BasicData; |
| 8 | 8 | import com.bsth.security.SsoConfig; |
| 9 | 9 | import com.bsth.service.SectionService; |
| 10 | 10 | import com.bsth.service.StationService; |
| 11 | -import com.bsth.data.SystemParamCache; | |
| 12 | 11 | import com.bsth.data.directive.DayOfDirectives; |
| 13 | 12 | import com.bsth.data.directive.DirectivesPstThread; |
| 14 | 13 | import com.bsth.data.directive.GatewayHttpUtils; | ... | ... |
src/main/java/com/bsth/controller/realcontrol/BasicDataController.java
| 1 | -package com.bsth.controller.realcontrol; | |
| 2 | - | |
| 3 | -import com.alibaba.fastjson.serializer.PropertyFilter; | |
| 4 | -import com.bsth.common.ResponseCode; | |
| 5 | -import com.bsth.data.BasicData; | |
| 6 | -import com.bsth.data.Station2ParkBuffer; | |
| 7 | -import com.bsth.data.pinyin.PersionPinYin; | |
| 8 | -import com.bsth.data.pinyin.PersionPinYinBuffer; | |
| 9 | -import com.bsth.entity.Line; | |
| 10 | -import com.bsth.entity.realcontrol.StationToPark; | |
| 11 | -import com.google.common.base.Splitter; | |
| 12 | -import com.google.common.collect.ArrayListMultimap; | |
| 13 | -import com.google.common.collect.BiMap; | |
| 14 | -import org.slf4j.Logger; | |
| 15 | -import org.slf4j.LoggerFactory; | |
| 16 | -import org.springframework.beans.factory.annotation.Autowired; | |
| 17 | -import org.springframework.web.bind.annotation.RequestMapping; | |
| 18 | -import org.springframework.web.bind.annotation.RequestMethod; | |
| 19 | -import org.springframework.web.bind.annotation.RequestParam; | |
| 20 | -import org.springframework.web.bind.annotation.RestController; | |
| 21 | - | |
| 22 | -import java.util.*; | |
| 23 | - | |
| 24 | -@RestController | |
| 25 | -@RequestMapping("/basic") | |
| 26 | -public class BasicDataController { | |
| 27 | - | |
| 28 | - @Autowired | |
| 29 | - BasicData.BasicDataLoader dataLoader; | |
| 30 | - | |
| 31 | - @Autowired | |
| 32 | - BasicData basicData; | |
| 33 | - | |
| 34 | - Logger logger = LoggerFactory.getLogger(this.getClass()); | |
| 35 | - | |
| 36 | - @Autowired | |
| 37 | - Station2ParkBuffer station2ParkBuffer; | |
| 38 | - | |
| 39 | - @Autowired | |
| 40 | - PersionPinYinBuffer persionPinYinBuffer; | |
| 41 | - | |
| 42 | - @RequestMapping("/cars") | |
| 43 | - public Iterable<String> findAllNbbm(Map<String, Object> map){ | |
| 44 | - return BasicData.deviceId2NbbmMap.values(); | |
| 45 | - } | |
| 46 | - | |
| 47 | - @RequestMapping("/nbbm2deviceId") | |
| 48 | - public Map<String, String> nbbm2deviceId(Map<String, Object> map){ | |
| 49 | - return BasicData.deviceId2NbbmMap.inverse(); | |
| 50 | - } | |
| 51 | - | |
| 52 | - @RequestMapping("/lineCode2Name") | |
| 53 | - public Map<String, String> findLineCodeMap(){ | |
| 54 | - return BasicData.lineCode2NameMap; | |
| 55 | - } | |
| 56 | - | |
| 57 | - @RequestMapping("/parks") | |
| 58 | - public Map<String, String> findParks(){ | |
| 59 | - Map<String, String> rs = new HashMap<>(); | |
| 60 | - List<String> codes = BasicData.parkCodeList; | |
| 61 | - for(String code : codes){ | |
| 62 | - rs.put(code, BasicData.stationCode2NameMap.get(code)); | |
| 63 | - } | |
| 64 | - return rs; | |
| 65 | - } | |
| 66 | - | |
| 67 | - /*@RequestMapping("/personnel") | |
| 68 | - public Map<String, Object> findPersonnelInfo(){ | |
| 69 | - Map<String, Object> rs = new HashMap<>(); | |
| 70 | - PersonnelFieldFilter filter=new PersonnelFieldFilter(); | |
| 71 | - //驾驶员 | |
| 72 | - rs.put("jsy", JSON.parse(JSON.toJSONString(BasicData.jsyMap.values(), filter))); | |
| 73 | - //售票员 | |
| 74 | - rs.put("spy", JSON.parse(JSON.toJSONString(BasicData.spyMap.values(), filter)));*//* | |
| 75 | - return rs; | |
| 76 | - }*/ | |
| 77 | - | |
| 78 | - @RequestMapping(value = "/all_personnel_py", method = RequestMethod.GET) | |
| 79 | - public List<PersionPinYin> findAll_PY(){ | |
| 80 | - return persionPinYinBuffer.getAll(); | |
| 81 | - } | |
| 82 | - | |
| 83 | - @RequestMapping("/all_personnel") | |
| 84 | - public Map<String, String> all_personnel(){ | |
| 85 | - return BasicData.allPerson; | |
| 86 | - } | |
| 87 | - | |
| 88 | - | |
| 89 | - public class PersonnelFieldFilter implements PropertyFilter{ | |
| 90 | - | |
| 91 | - String[] whiteList=new String[]{"jobCode", "personnelName", "brancheCompany"}; | |
| 92 | - @Override | |
| 93 | - public boolean apply(Object object, String name, Object value) { | |
| 94 | - for(String f : whiteList){ | |
| 95 | - if(name.equals(f)) | |
| 96 | - return true; | |
| 97 | - } | |
| 98 | - return false; | |
| 99 | - } | |
| 100 | - } | |
| 101 | - | |
| 102 | - /** | |
| 103 | - * 刷新车辆和设备号对照数据 | |
| 104 | - * @return | |
| 105 | - */ | |
| 106 | - @RequestMapping(value = "/refresh_nbbm2Device", method = RequestMethod.POST) | |
| 107 | - public Map<String, Object> refreshNbbm2DeviceId(){ | |
| 108 | - Map<String, Object> rs = new HashMap<>(); | |
| 109 | - try { | |
| 110 | - dataLoader.loadDeviceInfo(); | |
| 111 | - rs.put("status", ResponseCode.SUCCESS); | |
| 112 | - }catch (Exception e){ | |
| 113 | - rs.put("status", ResponseCode.ERROR); | |
| 114 | - rs.put("msg", e.getMessage()); | |
| 115 | - logger.error("", e); | |
| 116 | - } | |
| 117 | - return rs; | |
| 118 | - } | |
| 119 | - | |
| 120 | - /** | |
| 121 | - * 刷新员工对照数据 | |
| 122 | - * @return | |
| 123 | - */ | |
| 124 | - @RequestMapping(value = "/refresh_person_data", method = RequestMethod.POST) | |
| 125 | - public Map<String, Object> refreshPersonData(){ | |
| 126 | - Map<String, Object> rs = new HashMap<>(); | |
| 127 | - try { | |
| 128 | - dataLoader.loadPersonnelInfo(); | |
| 129 | - rs.put("status", ResponseCode.SUCCESS); | |
| 130 | - }catch (Exception e){ | |
| 131 | - rs.put("status", ResponseCode.ERROR); | |
| 132 | - rs.put("msg", e.getMessage()); | |
| 133 | - logger.error("", e); | |
| 134 | - } | |
| 135 | - return rs; | |
| 136 | - } | |
| 137 | - | |
| 138 | - /** | |
| 139 | - * 车辆自编号和车牌号对照 | |
| 140 | - * @return | |
| 141 | - */ | |
| 142 | - @RequestMapping("/nbbm2PlateNo") | |
| 143 | - public Map<String, String> nbbm2PlateNo(){ | |
| 144 | - return basicData.nbbmCompanyPlateMap; | |
| 145 | - } | |
| 146 | - | |
| 147 | - | |
| 148 | - /** | |
| 149 | - * 获取线路配车信息 | |
| 150 | - * @return | |
| 151 | - */ | |
| 152 | - @RequestMapping("/ccInfo") | |
| 153 | - public Map<String, Collection<String>> ccInfo(){ | |
| 154 | - | |
| 155 | - ArrayListMultimap<String, String> listMultimap = ArrayListMultimap.create(); | |
| 156 | - Set<String> ks = BasicData.nbbm2LineMap.keySet(); | |
| 157 | - | |
| 158 | - Line line; | |
| 159 | - for(String nbbm : ks){ | |
| 160 | - line = BasicData.nbbm2LineMap.get(nbbm); | |
| 161 | - listMultimap.put(line.getLineCode(), nbbm); | |
| 162 | - } | |
| 163 | - return listMultimap.asMap(); | |
| 164 | - } | |
| 165 | - | |
| 166 | - /** | |
| 167 | - * 获取车辆信息 | |
| 168 | - * @return | |
| 169 | - */ | |
| 170 | - @RequestMapping("/ccInfo/lineArray") | |
| 171 | - public List<Map<String, String>> ccInfoByLine(@RequestParam String idx){ | |
| 172 | - List<String> lines = Splitter.on(",").splitToList(idx); | |
| 173 | - List<Map<String, String>> rs = new ArrayList<>(); | |
| 174 | - Map<String, String> map; | |
| 175 | - | |
| 176 | - //ArrayListMultimap<String, String> listMultimap = ArrayListMultimap.create(); | |
| 177 | - Set<String> ks = BasicData.nbbm2LineMap.keySet(); | |
| 178 | - BiMap<String,String> nbbm2deviceMap = BasicData.deviceId2NbbmMap.inverse(); | |
| 179 | - | |
| 180 | - Line line; | |
| 181 | - for(String nbbm : ks){ | |
| 182 | - line = BasicData.nbbm2LineMap.get(nbbm); | |
| 183 | - if(lines.contains(line.getLineCode())){ | |
| 184 | - map = new HashMap<>(); | |
| 185 | - map.put("nbbm", nbbm); | |
| 186 | - map.put("deviceId", nbbm2deviceMap.get(nbbm)); | |
| 187 | - map.put("lineName", line.getName()); | |
| 188 | - map.put("lineCode", line.getLineCode()); | |
| 189 | - rs.add(map); | |
| 190 | - } | |
| 191 | - } | |
| 192 | - return rs; | |
| 193 | - } | |
| 194 | - | |
| 195 | - /** | |
| 196 | - * 获取站点和停车场历时公里对照表 | |
| 197 | - * @param idx | |
| 198 | - * @return | |
| 199 | - */ | |
| 200 | - @RequestMapping("/station2ParkData") | |
| 201 | - public Map<String, Collection<StationToPark>> findStation2ParkData(@RequestParam String idx){ | |
| 202 | - List<String> lines = Splitter.on(",").splitToList(idx); | |
| 203 | - ArrayListMultimap<String, StationToPark> rs = ArrayListMultimap.create(); | |
| 204 | - | |
| 205 | - for(String lineCode : lines){ | |
| 206 | - rs.putAll(lineCode, Station2ParkBuffer.get(lineCode)); | |
| 207 | - } | |
| 208 | - return rs.asMap(); | |
| 209 | - } | |
| 210 | - | |
| 211 | - @RequestMapping(value = "/deleteStation2Park", method = RequestMethod.POST) | |
| 212 | - public Map<String, Object> deleteStation2Park(@RequestParam String lineCode,@RequestParam Integer id){ | |
| 213 | - return station2ParkBuffer.delete(lineCode, id); | |
| 214 | - } | |
| 215 | -} | |
| 1 | +package com.bsth.controller.realcontrol; | |
| 2 | + | |
| 3 | +import com.alibaba.fastjson.serializer.PropertyFilter; | |
| 4 | +import com.bsth.common.ResponseCode; | |
| 5 | +import com.bsth.data.BasicData; | |
| 6 | +import com.bsth.data.Station2ParkBuffer; | |
| 7 | +import com.bsth.data.pinyin.PersionPinYin; | |
| 8 | +import com.bsth.data.pinyin.PersionPinYinBuffer; | |
| 9 | +import com.bsth.entity.Line; | |
| 10 | +import com.bsth.entity.Personnel; | |
| 11 | +import com.bsth.entity.realcontrol.StationToPark; | |
| 12 | +import com.google.common.base.Splitter; | |
| 13 | +import com.google.common.collect.ArrayListMultimap; | |
| 14 | +import com.google.common.collect.BiMap; | |
| 15 | +import org.slf4j.Logger; | |
| 16 | +import org.slf4j.LoggerFactory; | |
| 17 | +import org.springframework.beans.factory.annotation.Autowired; | |
| 18 | +import org.springframework.web.bind.annotation.RequestMapping; | |
| 19 | +import org.springframework.web.bind.annotation.RequestMethod; | |
| 20 | +import org.springframework.web.bind.annotation.RequestParam; | |
| 21 | +import org.springframework.web.bind.annotation.RestController; | |
| 22 | + | |
| 23 | +import java.util.*; | |
| 24 | + | |
| 25 | +@RestController | |
| 26 | +@RequestMapping("/basic") | |
| 27 | +public class BasicDataController { | |
| 28 | + | |
| 29 | + @Autowired | |
| 30 | + BasicData.BasicDataLoader dataLoader; | |
| 31 | + | |
| 32 | + @Autowired | |
| 33 | + BasicData basicData; | |
| 34 | + | |
| 35 | + Logger logger = LoggerFactory.getLogger(this.getClass()); | |
| 36 | + | |
| 37 | + @Autowired | |
| 38 | + Station2ParkBuffer station2ParkBuffer; | |
| 39 | + | |
| 40 | + @Autowired | |
| 41 | + PersionPinYinBuffer persionPinYinBuffer; | |
| 42 | + | |
| 43 | + @RequestMapping("/cars") | |
| 44 | + public Iterable<String> findAllNbbm(Map<String, Object> map){ | |
| 45 | + return BasicData.deviceId2NbbmMap.values(); | |
| 46 | + } | |
| 47 | + | |
| 48 | + @RequestMapping("/nbbm2deviceId") | |
| 49 | + public Map<String, String> nbbm2deviceId(Map<String, Object> map){ | |
| 50 | + return BasicData.deviceId2NbbmMap.inverse(); | |
| 51 | + } | |
| 52 | + | |
| 53 | + @RequestMapping("/lineCode2Name") | |
| 54 | + public Map<String, String> findLineCodeMap(){ | |
| 55 | + return BasicData.lineCode2NameMap; | |
| 56 | + } | |
| 57 | + | |
| 58 | + @RequestMapping("/parks") | |
| 59 | + public Map<String, String> findParks(){ | |
| 60 | + Map<String, String> rs = new HashMap<>(); | |
| 61 | + List<String> codes = BasicData.parkCodeList; | |
| 62 | + for(String code : codes){ | |
| 63 | + rs.put(code, BasicData.stationCode2NameMap.get(code)); | |
| 64 | + } | |
| 65 | + return rs; | |
| 66 | + } | |
| 67 | + | |
| 68 | + /*@RequestMapping("/personnel") | |
| 69 | + public Map<String, Object> findPersonnelInfo(){ | |
| 70 | + Map<String, Object> rs = new HashMap<>(); | |
| 71 | + PersonnelFieldFilter filter=new PersonnelFieldFilter(); | |
| 72 | + //驾驶员 | |
| 73 | + rs.put("jsy", JSON.parse(JSON.toJSONString(BasicData.jsyMap.values(), filter))); | |
| 74 | + //售票员 | |
| 75 | + rs.put("spy", JSON.parse(JSON.toJSONString(BasicData.spyMap.values(), filter)));*//* | |
| 76 | + return rs; | |
| 77 | + }*/ | |
| 78 | + | |
| 79 | + @RequestMapping(value = "/all_personnel_py", method = RequestMethod.GET) | |
| 80 | + public List<PersionPinYin> findAll_PY(){ | |
| 81 | + return persionPinYinBuffer.getAll(); | |
| 82 | + } | |
| 83 | + | |
| 84 | + @RequestMapping("/all_personnel") | |
| 85 | + public Map<String, String> all_personnel(){ | |
| 86 | + return BasicData.allPerson; | |
| 87 | + } | |
| 88 | + | |
| 89 | + @RequestMapping("/allPersonnelMobile") | |
| 90 | + public Map<String, String> allPersonnelMobile(){ | |
| 91 | + Map<String, String> result = new HashMap<>(); | |
| 92 | + for (Personnel personnel : BasicData.perMap.values()) { | |
| 93 | + result.put(personnel.getJobCode(), personnel.getMobile()); | |
| 94 | + } | |
| 95 | + | |
| 96 | + return result; | |
| 97 | + } | |
| 98 | + | |
| 99 | + public class PersonnelFieldFilter implements PropertyFilter{ | |
| 100 | + | |
| 101 | + String[] whiteList=new String[]{"jobCode", "personnelName", "brancheCompany"}; | |
| 102 | + @Override | |
| 103 | + public boolean apply(Object object, String name, Object value) { | |
| 104 | + for(String f : whiteList){ | |
| 105 | + if(name.equals(f)) | |
| 106 | + return true; | |
| 107 | + } | |
| 108 | + return false; | |
| 109 | + } | |
| 110 | + } | |
| 111 | + | |
| 112 | + /** | |
| 113 | + * 刷新车辆和设备号对照数据 | |
| 114 | + * @return | |
| 115 | + */ | |
| 116 | + @RequestMapping(value = "/refresh_nbbm2Device", method = RequestMethod.POST) | |
| 117 | + public Map<String, Object> refreshNbbm2DeviceId(){ | |
| 118 | + Map<String, Object> rs = new HashMap<>(); | |
| 119 | + try { | |
| 120 | + dataLoader.loadDeviceInfo(); | |
| 121 | + rs.put("status", ResponseCode.SUCCESS); | |
| 122 | + }catch (Exception e){ | |
| 123 | + rs.put("status", ResponseCode.ERROR); | |
| 124 | + rs.put("msg", e.getMessage()); | |
| 125 | + logger.error("", e); | |
| 126 | + } | |
| 127 | + return rs; | |
| 128 | + } | |
| 129 | + | |
| 130 | + /** | |
| 131 | + * 刷新员工对照数据 | |
| 132 | + * @return | |
| 133 | + */ | |
| 134 | + @RequestMapping(value = "/refresh_person_data", method = RequestMethod.POST) | |
| 135 | + public Map<String, Object> refreshPersonData(){ | |
| 136 | + Map<String, Object> rs = new HashMap<>(); | |
| 137 | + try { | |
| 138 | + dataLoader.loadPersonnelInfo(); | |
| 139 | + rs.put("status", ResponseCode.SUCCESS); | |
| 140 | + }catch (Exception e){ | |
| 141 | + rs.put("status", ResponseCode.ERROR); | |
| 142 | + rs.put("msg", e.getMessage()); | |
| 143 | + logger.error("", e); | |
| 144 | + } | |
| 145 | + return rs; | |
| 146 | + } | |
| 147 | + | |
| 148 | + /** | |
| 149 | + * 车辆自编号和车牌号对照 | |
| 150 | + * @return | |
| 151 | + */ | |
| 152 | + @RequestMapping("/nbbm2PlateNo") | |
| 153 | + public Map<String, String> nbbm2PlateNo(){ | |
| 154 | + return basicData.nbbmCompanyPlateMap; | |
| 155 | + } | |
| 156 | + | |
| 157 | + | |
| 158 | + /** | |
| 159 | + * 获取线路配车信息 | |
| 160 | + * @return | |
| 161 | + */ | |
| 162 | + @RequestMapping("/ccInfo") | |
| 163 | + public Map<String, Collection<String>> ccInfo(){ | |
| 164 | + | |
| 165 | + ArrayListMultimap<String, String> listMultimap = ArrayListMultimap.create(); | |
| 166 | + Set<String> ks = BasicData.nbbm2LineMap.keySet(); | |
| 167 | + | |
| 168 | + Line line; | |
| 169 | + for(String nbbm : ks){ | |
| 170 | + line = BasicData.nbbm2LineMap.get(nbbm); | |
| 171 | + listMultimap.put(line.getLineCode(), nbbm); | |
| 172 | + } | |
| 173 | + return listMultimap.asMap(); | |
| 174 | + } | |
| 175 | + | |
| 176 | + /** | |
| 177 | + * 获取车辆信息 | |
| 178 | + * @return | |
| 179 | + */ | |
| 180 | + @RequestMapping("/ccInfo/lineArray") | |
| 181 | + public List<Map<String, String>> ccInfoByLine(@RequestParam String idx){ | |
| 182 | + List<String> lines = Splitter.on(",").splitToList(idx); | |
| 183 | + List<Map<String, String>> rs = new ArrayList<>(); | |
| 184 | + Map<String, String> map; | |
| 185 | + | |
| 186 | + //ArrayListMultimap<String, String> listMultimap = ArrayListMultimap.create(); | |
| 187 | + Set<String> ks = BasicData.nbbm2LineMap.keySet(); | |
| 188 | + BiMap<String,String> nbbm2deviceMap = BasicData.deviceId2NbbmMap.inverse(); | |
| 189 | + | |
| 190 | + Line line; | |
| 191 | + for(String nbbm : ks){ | |
| 192 | + line = BasicData.nbbm2LineMap.get(nbbm); | |
| 193 | + if(lines.contains(line.getLineCode())){ | |
| 194 | + map = new HashMap<>(); | |
| 195 | + map.put("nbbm", nbbm); | |
| 196 | + map.put("deviceId", nbbm2deviceMap.get(nbbm)); | |
| 197 | + map.put("lineName", line.getName()); | |
| 198 | + map.put("lineCode", line.getLineCode()); | |
| 199 | + rs.add(map); | |
| 200 | + } | |
| 201 | + } | |
| 202 | + return rs; | |
| 203 | + } | |
| 204 | + | |
| 205 | + /** | |
| 206 | + * 获取站点和停车场历时公里对照表 | |
| 207 | + * @param idx | |
| 208 | + * @return | |
| 209 | + */ | |
| 210 | + @RequestMapping("/station2ParkData") | |
| 211 | + public Map<String, Collection<StationToPark>> findStation2ParkData(@RequestParam String idx){ | |
| 212 | + List<String> lines = Splitter.on(",").splitToList(idx); | |
| 213 | + ArrayListMultimap<String, StationToPark> rs = ArrayListMultimap.create(); | |
| 214 | + | |
| 215 | + for(String lineCode : lines){ | |
| 216 | + rs.putAll(lineCode, Station2ParkBuffer.get(lineCode)); | |
| 217 | + } | |
| 218 | + return rs.asMap(); | |
| 219 | + } | |
| 220 | + | |
| 221 | + @RequestMapping(value = "/deleteStation2Park", method = RequestMethod.POST) | |
| 222 | + public Map<String, Object> deleteStation2Park(@RequestParam String lineCode,@RequestParam Integer id){ | |
| 223 | + return station2ParkBuffer.delete(lineCode, id); | |
| 224 | + } | |
| 225 | +} | ... | ... |
src/main/java/com/bsth/controller/realcontrol/dto/StationSpatialData.java
| 1 | -package com.bsth.controller.realcontrol.dto; | |
| 2 | - | |
| 3 | -/** | |
| 4 | - * Created by panzhao on 2016/11/23. | |
| 5 | - */ | |
| 6 | -public class StationSpatialData { | |
| 7 | - | |
| 8 | - private String lineCode; | |
| 9 | - | |
| 10 | - private String stationName; | |
| 11 | - | |
| 12 | - private String stationCode; | |
| 13 | - | |
| 14 | - private String stationMark; | |
| 15 | - | |
| 16 | - private int directions; | |
| 17 | - | |
| 18 | - private Float distances; | |
| 19 | - | |
| 20 | - private Float toTime; | |
| 21 | - | |
| 22 | - private Integer versions; | |
| 23 | - | |
| 24 | - private Float gLonx; | |
| 25 | - | |
| 26 | - private Float gLaty; | |
| 27 | - | |
| 28 | - private Float radius; | |
| 29 | - | |
| 30 | - private String shapesType; | |
| 31 | - | |
| 32 | - private String gPolygonGrid; | |
| 33 | - | |
| 34 | - private Integer stationRouteCode; | |
| 35 | - | |
| 36 | - public String getLineCode() { | |
| 37 | - return lineCode; | |
| 38 | - } | |
| 39 | - | |
| 40 | - public void setLineCode(String lineCode) { | |
| 41 | - this.lineCode = lineCode; | |
| 42 | - } | |
| 43 | - | |
| 44 | - public String getStationName() { | |
| 45 | - return stationName; | |
| 46 | - } | |
| 47 | - | |
| 48 | - public void setStationName(String stationName) { | |
| 49 | - this.stationName = stationName; | |
| 50 | - } | |
| 51 | - | |
| 52 | - public String getStationCode() { | |
| 53 | - return stationCode; | |
| 54 | - } | |
| 55 | - | |
| 56 | - public void setStationCode(String stationCode) { | |
| 57 | - this.stationCode = stationCode; | |
| 58 | - } | |
| 59 | - | |
| 60 | - public String getStationMark() { | |
| 61 | - return stationMark; | |
| 62 | - } | |
| 63 | - | |
| 64 | - public void setStationMark(String stationMark) { | |
| 65 | - this.stationMark = stationMark; | |
| 66 | - } | |
| 67 | - | |
| 68 | - public int getDirections() { | |
| 69 | - return directions; | |
| 70 | - } | |
| 71 | - | |
| 72 | - public void setDirections(int directions) { | |
| 73 | - this.directions = directions; | |
| 74 | - } | |
| 75 | - | |
| 76 | - public Float getDistances() { | |
| 77 | - return distances; | |
| 78 | - } | |
| 79 | - | |
| 80 | - public void setDistances(Float distances) { | |
| 81 | - this.distances = distances; | |
| 82 | - } | |
| 83 | - | |
| 84 | - public Float getToTime() { | |
| 85 | - return toTime; | |
| 86 | - } | |
| 87 | - | |
| 88 | - public void setToTime(Float toTime) { | |
| 89 | - this.toTime = toTime; | |
| 90 | - } | |
| 91 | - | |
| 92 | - public Integer getVersions() { | |
| 93 | - return versions; | |
| 94 | - } | |
| 95 | - | |
| 96 | - public void setVersions(Integer versions) { | |
| 97 | - this.versions = versions; | |
| 98 | - } | |
| 99 | - | |
| 100 | - public Float getgLonx() { | |
| 101 | - return gLonx; | |
| 102 | - } | |
| 103 | - | |
| 104 | - public void setgLonx(Float gLonx) { | |
| 105 | - this.gLonx = gLonx; | |
| 106 | - } | |
| 107 | - | |
| 108 | - public Float getgLaty() { | |
| 109 | - return gLaty; | |
| 110 | - } | |
| 111 | - | |
| 112 | - public void setgLaty(Float gLaty) { | |
| 113 | - this.gLaty = gLaty; | |
| 114 | - } | |
| 115 | - | |
| 116 | - public Float getRadius() { | |
| 117 | - return radius; | |
| 118 | - } | |
| 119 | - | |
| 120 | - public void setRadius(Float radius) { | |
| 121 | - this.radius = radius; | |
| 122 | - } | |
| 123 | - | |
| 124 | - public String getShapesType() { | |
| 125 | - return shapesType; | |
| 126 | - } | |
| 127 | - | |
| 128 | - public void setShapesType(String shapesType) { | |
| 129 | - this.shapesType = shapesType; | |
| 130 | - } | |
| 131 | - | |
| 132 | - public String getgPolygonGrid() { | |
| 133 | - return gPolygonGrid; | |
| 134 | - } | |
| 135 | - | |
| 136 | - public void setgPolygonGrid(String gPolygonGrid) { | |
| 137 | - this.gPolygonGrid = gPolygonGrid; | |
| 138 | - } | |
| 139 | - | |
| 140 | - public Integer getStationRouteCode() { | |
| 141 | - return stationRouteCode; | |
| 142 | - } | |
| 143 | - | |
| 144 | - public void setStationRouteCode(Integer stationRouteCode) { | |
| 145 | - this.stationRouteCode = stationRouteCode; | |
| 146 | - } | |
| 147 | -} | |
| 1 | +package com.bsth.controller.realcontrol.dto; | |
| 2 | + | |
| 3 | +/** | |
| 4 | + * Created by panzhao on 2016/11/23. | |
| 5 | + */ | |
| 6 | +public class StationSpatialData { | |
| 7 | + | |
| 8 | + private Integer stationRouteId; | |
| 9 | + | |
| 10 | + private String lineCode; | |
| 11 | + | |
| 12 | + private String stationName; | |
| 13 | + | |
| 14 | + private String stationCode; | |
| 15 | + | |
| 16 | + private String stationMark; | |
| 17 | + | |
| 18 | + private int directions; | |
| 19 | + | |
| 20 | + private Float distances; | |
| 21 | + | |
| 22 | + private Float toTime; | |
| 23 | + | |
| 24 | + private Integer versions; | |
| 25 | + | |
| 26 | + private Float gLonx; | |
| 27 | + | |
| 28 | + private Float gLaty; | |
| 29 | + | |
| 30 | + private Float radius; | |
| 31 | + | |
| 32 | + private String shapesType; | |
| 33 | + | |
| 34 | + private String gPolygonGrid; | |
| 35 | + | |
| 36 | + private Integer stationRouteCode; | |
| 37 | + | |
| 38 | + public Integer getStationRouteId() { | |
| 39 | + return stationRouteId; | |
| 40 | + } | |
| 41 | + | |
| 42 | + public void setStationRouteId(Integer stationRouteId) { | |
| 43 | + this.stationRouteId = stationRouteId; | |
| 44 | + } | |
| 45 | + | |
| 46 | + public String getLineCode() { | |
| 47 | + return lineCode; | |
| 48 | + } | |
| 49 | + | |
| 50 | + public void setLineCode(String lineCode) { | |
| 51 | + this.lineCode = lineCode; | |
| 52 | + } | |
| 53 | + | |
| 54 | + public String getStationName() { | |
| 55 | + return stationName; | |
| 56 | + } | |
| 57 | + | |
| 58 | + public void setStationName(String stationName) { | |
| 59 | + this.stationName = stationName; | |
| 60 | + } | |
| 61 | + | |
| 62 | + public String getStationCode() { | |
| 63 | + return stationCode; | |
| 64 | + } | |
| 65 | + | |
| 66 | + public void setStationCode(String stationCode) { | |
| 67 | + this.stationCode = stationCode; | |
| 68 | + } | |
| 69 | + | |
| 70 | + public String getStationMark() { | |
| 71 | + return stationMark; | |
| 72 | + } | |
| 73 | + | |
| 74 | + public void setStationMark(String stationMark) { | |
| 75 | + this.stationMark = stationMark; | |
| 76 | + } | |
| 77 | + | |
| 78 | + public int getDirections() { | |
| 79 | + return directions; | |
| 80 | + } | |
| 81 | + | |
| 82 | + public void setDirections(int directions) { | |
| 83 | + this.directions = directions; | |
| 84 | + } | |
| 85 | + | |
| 86 | + public Float getDistances() { | |
| 87 | + return distances; | |
| 88 | + } | |
| 89 | + | |
| 90 | + public void setDistances(Float distances) { | |
| 91 | + this.distances = distances; | |
| 92 | + } | |
| 93 | + | |
| 94 | + public Float getToTime() { | |
| 95 | + return toTime; | |
| 96 | + } | |
| 97 | + | |
| 98 | + public void setToTime(Float toTime) { | |
| 99 | + this.toTime = toTime; | |
| 100 | + } | |
| 101 | + | |
| 102 | + public Integer getVersions() { | |
| 103 | + return versions; | |
| 104 | + } | |
| 105 | + | |
| 106 | + public void setVersions(Integer versions) { | |
| 107 | + this.versions = versions; | |
| 108 | + } | |
| 109 | + | |
| 110 | + public Float getgLonx() { | |
| 111 | + return gLonx; | |
| 112 | + } | |
| 113 | + | |
| 114 | + public void setgLonx(Float gLonx) { | |
| 115 | + this.gLonx = gLonx; | |
| 116 | + } | |
| 117 | + | |
| 118 | + public Float getgLaty() { | |
| 119 | + return gLaty; | |
| 120 | + } | |
| 121 | + | |
| 122 | + public void setgLaty(Float gLaty) { | |
| 123 | + this.gLaty = gLaty; | |
| 124 | + } | |
| 125 | + | |
| 126 | + public Float getRadius() { | |
| 127 | + return radius; | |
| 128 | + } | |
| 129 | + | |
| 130 | + public void setRadius(Float radius) { | |
| 131 | + this.radius = radius; | |
| 132 | + } | |
| 133 | + | |
| 134 | + public String getShapesType() { | |
| 135 | + return shapesType; | |
| 136 | + } | |
| 137 | + | |
| 138 | + public void setShapesType(String shapesType) { | |
| 139 | + this.shapesType = shapesType; | |
| 140 | + } | |
| 141 | + | |
| 142 | + public String getgPolygonGrid() { | |
| 143 | + return gPolygonGrid; | |
| 144 | + } | |
| 145 | + | |
| 146 | + public void setgPolygonGrid(String gPolygonGrid) { | |
| 147 | + this.gPolygonGrid = gPolygonGrid; | |
| 148 | + } | |
| 149 | + | |
| 150 | + public Integer getStationRouteCode() { | |
| 151 | + return stationRouteCode; | |
| 152 | + } | |
| 153 | + | |
| 154 | + public void setStationRouteCode(Integer stationRouteCode) { | |
| 155 | + this.stationRouteCode = stationRouteCode; | |
| 156 | + } | |
| 157 | +} | ... | ... |
src/main/java/com/bsth/controller/schedule/basicinfo/legacy/EmployeeController.java
| ... | ... | @@ -3,6 +3,7 @@ package com.bsth.controller.schedule.basicinfo.legacy; |
| 3 | 3 | import com.bsth.common.ResponseCode; |
| 4 | 4 | import com.bsth.controller.schedule.BController; |
| 5 | 5 | import com.bsth.controller.schedule.basicinfo.EmployeeController_facade; |
| 6 | +import com.bsth.data.pinyin.PersionPinYin; | |
| 6 | 7 | import com.bsth.entity.Personnel; |
| 7 | 8 | import com.bsth.service.schedule.EmployeeService; |
| 8 | 9 | import com.bsth.service.schedule.exception.ScheduleException; |
| ... | ... | @@ -14,6 +15,7 @@ import org.springframework.web.bind.annotation.RequestParam; |
| 14 | 15 | import org.springframework.web.bind.annotation.RestController; |
| 15 | 16 | |
| 16 | 17 | import java.util.HashMap; |
| 18 | +import java.util.List; | |
| 17 | 19 | import java.util.Map; |
| 18 | 20 | |
| 19 | 21 | /** |
| ... | ... | @@ -45,4 +47,9 @@ public class EmployeeController extends BController<Personnel, Integer> { |
| 45 | 47 | |
| 46 | 48 | return rtn; |
| 47 | 49 | } |
| 50 | + | |
| 51 | + @RequestMapping(value = "/all_py", method = RequestMethod.GET) | |
| 52 | + public List<PersionPinYin> findAll_PY(){ | |
| 53 | + return this.employeeService.findAll_PY(); | |
| 54 | + } | |
| 48 | 55 | } | ... | ... |
src/main/java/com/bsth/controller/schedule/datasync/VehicleDataSyncController.java
| ... | ... | @@ -63,14 +63,16 @@ public class VehicleDataSyncController extends BController<VehicleDataSyncTask, |
| 63 | 63 | public ApiResult refreshBuffer() { |
| 64 | 64 | try { |
| 65 | 65 | // 1、刷新车辆同步ETL文件 |
| 66 | - // 注意:使用Kettle内部的相关类清除指定ktr的缓存 | |
| 67 | - File ktrFile = new File(this.getClass().getResource( | |
| 68 | - dataToolsProperties.getVehicleDatasyncktr()).toURI()); | |
| 69 | - FileObject fileObject = KettleVFS.getFileObject(ktrFile.getAbsolutePath()); | |
| 70 | - FileSystem fileSystem = fileObject.getFileSystem(); | |
| 71 | - FilesCache filesCache = KettleVFS.getInstance().getFileSystemManager().getFilesCache(); | |
| 72 | -// System.out.println(filesCache.getFile(fileSystem, fileObject.getName())); | |
| 73 | - filesCache.removeFile(fileSystem, fileObject.getName()); | |
| 66 | + etlCacheRefresh(dataToolsProperties.getVehicleDatasyncktr()); | |
| 67 | + // 2、刷新人员配置导入导出ETL文件 | |
| 68 | + etlCacheRefresh(dataToolsProperties.getEmployeesconfigDatainputktr()); | |
| 69 | + etlCacheRefresh(dataToolsProperties.getEmployeesconfigDataoutputktr()); | |
| 70 | + // 3、刷新车辆配置导入导出ETL文件 | |
| 71 | + etlCacheRefresh(dataToolsProperties.getCarsconfigDatainputktr()); | |
| 72 | + etlCacheRefresh(dataToolsProperties.getCarsconfigDataoutputktr()); | |
| 73 | + // 4、刷新规则导入导出ETL文件 | |
| 74 | + etlCacheRefresh(dataToolsProperties.getScheduleruleDatainputktr()); | |
| 75 | + etlCacheRefresh(dataToolsProperties.getScheduleruleOutput()); | |
| 74 | 76 | |
| 75 | 77 | return ApiResult.success( |
| 76 | 78 | "200", |
| ... | ... | @@ -84,6 +86,16 @@ public class VehicleDataSyncController extends BController<VehicleDataSyncTask, |
| 84 | 86 | } |
| 85 | 87 | } |
| 86 | 88 | |
| 89 | + private void etlCacheRefresh(String ktrPath) throws Exception { | |
| 90 | + // 注意:使用Kettle内部的相关类清除指定ktr的缓存 | |
| 91 | + File ktrFile = new File(this.getClass().getResource(ktrPath).toURI()); | |
| 92 | + FileObject fileObject = KettleVFS.getFileObject(ktrFile.getAbsolutePath()); | |
| 93 | + FileSystem fileSystem = fileObject.getFileSystem(); | |
| 94 | + FilesCache filesCache = KettleVFS.getInstance().getFileSystemManager().getFilesCache(); | |
| 95 | +// System.out.println(filesCache.getFile(fileSystem, fileObject.getName())); | |
| 96 | + filesCache.removeFile(fileSystem, fileObject.getName()); | |
| 97 | + } | |
| 98 | + | |
| 87 | 99 | /** |
| 88 | 100 | * 手动添加同步任务。 |
| 89 | 101 | * @param vehicleDataSyncTaskRequest | ... | ... |
src/main/java/com/bsth/data/SystemParamCache.java
| ... | ... | @@ -21,6 +21,10 @@ public class SystemParamCache implements InitializingBean { |
| 21 | 21 | return systemParamService1.getValue(SystemParamKeys.SPECIAL_ROLES); |
| 22 | 22 | } |
| 23 | 23 | |
| 24 | + public static String getSpecialDays() { | |
| 25 | + return systemParamService1.getValue(SystemParamKeys.SPECIAL_DAYS); | |
| 26 | + } | |
| 27 | + | |
| 24 | 28 | public static String getUrlHttpGpsRealCache() { |
| 25 | 29 | return systemParamService1.getValue(SystemParamKeys.URL_HTTP_GPS_REAL_CACHE); |
| 26 | 30 | } | ... | ... |
src/main/java/com/bsth/data/gpsdata_v2/cache/GeoCacheData.java
| ... | ... | @@ -233,7 +233,7 @@ public class GeoCacheData { |
| 233 | 233 | private void loadPremiseGeoData() { |
| 234 | 234 | ArrayListMultimap<String, PreconditionGeo> premiseGeoMapCopy = ArrayListMultimap.create(); |
| 235 | 235 | |
| 236 | - String sql = "select * from bsth_f_geo_premise"; | |
| 236 | + String sql = "SELECT name, station_code, line_code, up_down, coords_wgs AS coords FROM bsth_f_geo_premise"; | |
| 237 | 237 | List<PreconditionGeo> list = jdbcTemplate.query(sql, BeanPropertyRowMapper.newInstance(PreconditionGeo.class)); |
| 238 | 238 | |
| 239 | 239 | List<String> coordList; | ... | ... |
src/main/java/com/bsth/entity/GeoPremise.java
| ... | ... | @@ -37,6 +37,11 @@ public class GeoPremise { |
| 37 | 37 | */ |
| 38 | 38 | private String coords; |
| 39 | 39 | |
| 40 | + /** | |
| 41 | + * wgs84坐标 | |
| 42 | + */ | |
| 43 | + private String coordsWgs; | |
| 44 | + | |
| 40 | 45 | public Integer getId() { |
| 41 | 46 | return id; |
| 42 | 47 | } |
| ... | ... | @@ -84,4 +89,12 @@ public class GeoPremise { |
| 84 | 89 | public void setCoords(String coords) { |
| 85 | 90 | this.coords = coords; |
| 86 | 91 | } |
| 92 | + | |
| 93 | + public String getCoordsWgs() { | |
| 94 | + return coordsWgs; | |
| 95 | + } | |
| 96 | + | |
| 97 | + public void setCoordsWgs(String coordsWgs) { | |
| 98 | + this.coordsWgs = coordsWgs; | |
| 99 | + } | |
| 87 | 100 | } | ... | ... |
src/main/java/com/bsth/entity/Personnel.java
| ... | ... | @@ -79,6 +79,11 @@ public class Personnel extends BEntity { |
| 79 | 79 | private String remark; |
| 80 | 80 | |
| 81 | 81 | /** |
| 82 | + * 移动电话 | |
| 83 | + */ | |
| 84 | + private String mobile; | |
| 85 | + | |
| 86 | + /** | |
| 82 | 87 | * 0为不锁定 1为锁定 |
| 83 | 88 | * 因人员与金蝶同步 但存在调度需要独立添加人员并不会被同步掉的情况 |
| 84 | 89 | */ |
| ... | ... | @@ -285,6 +290,14 @@ public class Personnel extends BEntity { |
| 285 | 290 | this.destroy = destroy; |
| 286 | 291 | } |
| 287 | 292 | |
| 293 | + public String getMobile() { | |
| 294 | + return mobile; | |
| 295 | + } | |
| 296 | + | |
| 297 | + public void setMobile(String mobile) { | |
| 298 | + this.mobile = mobile; | |
| 299 | + } | |
| 300 | + | |
| 288 | 301 | public Integer getLocked() { |
| 289 | 302 | return locked; |
| 290 | 303 | } | ... | ... |
src/main/java/com/bsth/service/impl/LsStationRouteServiceImpl.java
| ... | ... | @@ -208,6 +208,11 @@ public class LsStationRouteServiceImpl extends BaseServiceImpl<LsStationRoute, I |
| 208 | 208 | stationRoute.setStationCode(stationRoute.getStation().getStationCode()); |
| 209 | 209 | |
| 210 | 210 | Station station = stationRoute.getStation(); |
| 211 | + stationRoute.setCenterPointWkt(station.getCenterPointWkt()); | |
| 212 | + if (!StringUtils.isEmpty(stationRoute.getCenterPointWkt())) { | |
| 213 | + centerPoint(stationRoute); | |
| 214 | + } | |
| 215 | + | |
| 211 | 216 | if (station.getId() == null) { |
| 212 | 217 | station.setId(currentId + count); |
| 213 | 218 | station.setStationCode(station.getId().toString()); |
| ... | ... | @@ -252,10 +257,15 @@ public class LsStationRouteServiceImpl extends BaseServiceImpl<LsStationRoute, I |
| 252 | 257 | Integer currentVersion = lineVersionsRepository.findCurrentVersion(line.getId()); |
| 253 | 258 | boolean isPresent = stationRepository.findById(station.getId()).isPresent(); |
| 254 | 259 | stationRoute.setLineCode(line.getLineCode()); |
| 260 | + stationRoute.setCenterPointWkt(station.getCenterPointWkt()); | |
| 255 | 261 | if (stationRoute.getVersions() < currentVersion) { |
| 256 | 262 | throw new IllegalArgumentException("历史版本不可变更"); |
| 257 | 263 | } |
| 258 | 264 | |
| 265 | + if (!StringUtils.isEmpty(stationRoute.getCenterPointWkt())) { | |
| 266 | + centerPoint(stationRoute); | |
| 267 | + } | |
| 268 | + | |
| 259 | 269 | // 中心点坐标信息 |
| 260 | 270 | if (!isPresent) { |
| 261 | 271 | centerPoint(station); | ... | ... |
src/main/java/com/bsth/service/realcontrol/impl/ChildTaskPlanServiceImpl.java
| ... | ... | @@ -11,7 +11,11 @@ import com.bsth.repository.realcontrol.ChildTaskPlanRepository; |
| 11 | 11 | import com.bsth.repository.realcontrol.ScheduleRealInfoRepository; |
| 12 | 12 | import com.bsth.service.impl.BaseServiceImpl; |
| 13 | 13 | import com.bsth.service.realcontrol.ChildTaskPlanService; |
| 14 | +import com.bsth.util.PrivilegeUtils; | |
| 14 | 15 | import org.apache.commons.lang3.StringUtils; |
| 16 | +import org.joda.time.DateTime; | |
| 17 | +import org.joda.time.format.DateTimeFormat; | |
| 18 | +import org.joda.time.format.DateTimeFormatter; | |
| 15 | 19 | import org.slf4j.Logger; |
| 16 | 20 | import org.slf4j.LoggerFactory; |
| 17 | 21 | import org.springframework.beans.factory.annotation.Autowired; |
| ... | ... | @@ -231,7 +235,15 @@ public class ChildTaskPlanServiceImpl extends BaseServiceImpl<ChildTaskPlan, Lon |
| 231 | 235 | public Map<String, Object> saveHistory(ChildTaskPlan t) { |
| 232 | 236 | Map<String, Object> rs = new HashMap(); |
| 233 | 237 | try { |
| 234 | - ScheduleRealInfo sch = t.getSchedule(); | |
| 238 | + ScheduleRealInfo sch = scheduleRealInfoRepository.findById(t.getSchedule().getId()).get(); | |
| 239 | + // 检查调度日期 | |
| 240 | + DateTimeFormatter formatter = DateTimeFormat.forPattern("yyyy-MM-dd"); | |
| 241 | + long today = formatter.parseMillis(new DateTime().toString("yyyy-MM-dd")), scheduleDate = formatter.parseMillis(sch.getScheduleDateStr()); | |
| 242 | + if (today < scheduleDate || today - scheduleDate > 86400000 * PrivilegeUtils.getHistoryEditDays()) { | |
| 243 | + rs.put("status", ResponseCode.ERROR); | |
| 244 | + rs.put("msg", "无效的调度日期"); | |
| 245 | + return rs; | |
| 246 | + } | |
| 235 | 247 | //保存起终点名称 |
| 236 | 248 | String prefix = sch.getXlBm() + "_" + sch.getXlDir() + "_"; |
| 237 | 249 | if(StringUtils.isEmpty(t.getStartStationName())) |
| ... | ... | @@ -253,6 +265,25 @@ public class ChildTaskPlanServiceImpl extends BaseServiceImpl<ChildTaskPlan, Lon |
| 253 | 265 | |
| 254 | 266 | @Override |
| 255 | 267 | public Map<String, Object> delHistory(Long id) { |
| 256 | - return super.delete(id); | |
| 268 | + Map<String, Object> rs = new HashMap(); | |
| 269 | + try { | |
| 270 | + ScheduleRealInfo sch = childTaskPlanRepository.findById(id).get().getSchedule(); | |
| 271 | + // 检查调度日期 | |
| 272 | + DateTimeFormatter formatter = DateTimeFormat.forPattern("yyyy-MM-dd"); | |
| 273 | + long today = formatter.parseMillis(new DateTime().toString("yyyy-MM-dd")), scheduleDate = formatter.parseMillis(sch.getScheduleDateStr()); | |
| 274 | + if (today < scheduleDate || today - scheduleDate > 86400000 * PrivilegeUtils.getHistoryEditDays()) { | |
| 275 | + rs.put("status", ResponseCode.ERROR); | |
| 276 | + rs.put("msg", "无效的调度日期"); | |
| 277 | + return rs; | |
| 278 | + } | |
| 279 | + | |
| 280 | + return super.delete(id); | |
| 281 | + } catch (Exception e) { | |
| 282 | + logger.error("", e); | |
| 283 | + rs.put("status", ResponseCode.ERROR); | |
| 284 | + rs.put("msg", e.getMessage()); | |
| 285 | + } | |
| 286 | + | |
| 287 | + return rs; | |
| 257 | 288 | } |
| 258 | 289 | } | ... | ... |
src/main/java/com/bsth/service/realcontrol/impl/RealMapServiceImpl.java
| ... | ... | @@ -42,7 +42,7 @@ public class RealMapServiceImpl implements RealMapService { |
| 42 | 42 | } |
| 43 | 43 | inStr = " (" + inStr.substring(1) + ")"; |
| 44 | 44 | |
| 45 | - String sql = "select r.LINE_CODE,r.STATION_NAME,r.STATION_CODE,r.STATION_MARK,r.DIRECTIONS,r.DISTANCES,r.TO_TIME, r.VERSIONS,ST_X(s.CENTER_POINT_WGS) G_LONX,ST_Y(s.CENTER_POINT_WGS) G_LATY,r.RADIUS,r.SHAPED_TYPE shapes_type,ST_AsText(r.BUFFER_POLYGON_WGS) as G_POLYGON_GRID, r.STATION_ROUTE_CODE from bsth_c_stationroute r inner join bsth_c_station s on r.station=s.id where r.line_code in " + inStr + " and r.destroy=0"; | |
| 45 | + String sql = "select r.ID STATION_ROUTE_ID,r.LINE_CODE,r.STATION_NAME,r.STATION_CODE,r.STATION_MARK,r.DIRECTIONS,r.DISTANCES,r.TO_TIME, r.VERSIONS,ST_X(s.CENTER_POINT_WGS) G_LONX,ST_Y(s.CENTER_POINT_WGS) G_LATY,r.RADIUS,r.SHAPED_TYPE shapes_type,ST_AsText(r.BUFFER_POLYGON_WGS) as G_POLYGON_GRID, r.STATION_ROUTE_CODE from bsth_c_stationroute r inner join bsth_c_station s on r.station=s.id where r.line_code in " + inStr + " and r.destroy=0"; | |
| 46 | 46 | |
| 47 | 47 | List<StationSpatialData> list = jdbcTemplate.query(sql, new BeanPropertyRowMapper(StationSpatialData.class)); |
| 48 | 48 | rs.put("status", ResponseCode.SUCCESS); | ... | ... |
src/main/java/com/bsth/service/realcontrol/impl/ScheduleRealInfoServiceImpl.java
| 1 | -package com.bsth.service.realcontrol.impl; | |
| 2 | - | |
| 3 | -import java.io.*; | |
| 4 | -import java.lang.reflect.Field; | |
| 5 | -import java.math.BigDecimal; | |
| 6 | -import java.net.HttpURLConnection; | |
| 7 | -import java.net.MalformedURLException; | |
| 8 | -import java.net.URL; | |
| 9 | -import java.sql.ResultSet; | |
| 10 | -import java.sql.SQLException; | |
| 11 | -import java.text.DecimalFormat; | |
| 12 | -import java.text.ParseException; | |
| 13 | -import java.text.SimpleDateFormat; | |
| 14 | -import java.util.ArrayList; | |
| 15 | -import java.util.Calendar; | |
| 16 | -import java.util.Collection; | |
| 17 | -import java.util.Collections; | |
| 18 | -import java.util.Comparator; | |
| 19 | -import java.util.Date; | |
| 20 | -import java.util.GregorianCalendar; | |
| 21 | -import java.util.HashMap; | |
| 22 | -import java.util.HashSet; | |
| 23 | -import java.util.Iterator; | |
| 24 | -import java.util.List; | |
| 25 | -import java.util.Map; | |
| 26 | -import java.util.Queue; | |
| 27 | -import java.util.Set; | |
| 28 | -import java.util.concurrent.*; | |
| 29 | -import java.util.regex.Pattern; | |
| 30 | - | |
| 31 | -import com.bsth.entity.*; | |
| 32 | -import com.bsth.util.*; | |
| 33 | -import com.bsth.data.SystemParamCache; | |
| 34 | -import org.apache.commons.io.IOUtils; | |
| 35 | -import org.apache.commons.lang3.StringEscapeUtils; | |
| 36 | -import org.apache.commons.lang3.StringUtils; | |
| 37 | -import org.joda.time.DateTime; | |
| 38 | -import org.joda.time.format.DateTimeFormat; | |
| 39 | -import org.joda.time.format.DateTimeFormatter; | |
| 40 | -import org.slf4j.Logger; | |
| 41 | -import org.slf4j.LoggerFactory; | |
| 42 | -import org.springframework.beans.factory.DisposableBean; | |
| 43 | -import org.springframework.beans.factory.InitializingBean; | |
| 44 | -import org.springframework.beans.factory.annotation.Autowired; | |
| 45 | -import org.springframework.jdbc.core.BeanPropertyRowMapper; | |
| 46 | -import org.springframework.jdbc.core.JdbcTemplate; | |
| 47 | -import org.springframework.jdbc.core.RowMapper; | |
| 48 | -import org.springframework.stereotype.Service; | |
| 49 | -import org.springframework.transaction.annotation.Transactional; | |
| 50 | - | |
| 51 | -import com.alibaba.fastjson.JSON; | |
| 52 | -import com.alibaba.fastjson.JSONArray; | |
| 53 | -import com.alibaba.fastjson.JSONObject; | |
| 54 | -import com.bsth.common.Constants; | |
| 55 | -import com.bsth.common.ResponseCode; | |
| 56 | -import com.bsth.controller.realcontrol.dto.ChangePersonCar; | |
| 57 | -import com.bsth.controller.realcontrol.dto.DfsjChange; | |
| 58 | -import com.bsth.controller.realcontrol.dto.LpData; | |
| 59 | -import com.bsth.data.BasicData; | |
| 60 | -import com.bsth.data.LineConfigData; | |
| 61 | -import com.bsth.data.Station2ParkBuffer; | |
| 62 | -import com.bsth.data.schedule.DayOfSchedule; | |
| 63 | -import com.bsth.data.schedule.SchAttrCalculator; | |
| 64 | -import com.bsth.data.schedule.ScheduleComparator; | |
| 65 | -import com.bsth.data.schedule.edit_logs.FormLogger; | |
| 66 | -import com.bsth.data.schedule.edit_logs.ScheduleModifyLogger; | |
| 67 | -import com.bsth.data.schedule.edit_logs.loggers.AfterwardsLogger; | |
| 68 | -import com.bsth.data.schedule.edit_logs.loggers.FcxxwtLogger; | |
| 69 | -import com.bsth.data.schedule.edit_logs.service.dto.SchEditInfoDto; | |
| 70 | -import com.bsth.data.schedule.late_adjust.LateAdjustHandle; | |
| 71 | -import com.bsth.data.utils.CustomStringUtils; | |
| 72 | -import com.bsth.entity.calc.CalcInterval; | |
| 73 | -import com.bsth.entity.calc.CalcStatistics; | |
| 74 | -import com.bsth.entity.oil.Dlb; | |
| 75 | -import com.bsth.entity.oil.Qlb; | |
| 76 | -import com.bsth.entity.oil.Ylb; | |
| 77 | -import com.bsth.entity.oil.Ylxxb; | |
| 78 | -import com.bsth.entity.realcontrol.ChildTaskPlan; | |
| 79 | -import com.bsth.entity.realcontrol.LineConfig; | |
| 80 | -import com.bsth.entity.realcontrol.ScheduleRealInfo; | |
| 81 | -import com.bsth.entity.realcontrol.SvgAttribute; | |
| 82 | -import com.bsth.entity.report.MileageReport; | |
| 83 | -import com.bsth.entity.report.RepairReport; | |
| 84 | -import com.bsth.entity.report.ScheduleCorrectionReport; | |
| 85 | -import com.bsth.entity.schedule.CarConfigInfo; | |
| 86 | -import com.bsth.entity.schedule.EmployeeConfigInfo; | |
| 87 | -import com.bsth.entity.schedule.GuideboardInfo; | |
| 88 | -import com.bsth.entity.schedule.SchedulePlanInfo; | |
| 89 | -import com.bsth.entity.sys.Dictionary; | |
| 90 | -import com.bsth.entity.sys.DutyEmployee; | |
| 91 | -import com.bsth.entity.sys.SysUser; | |
| 92 | -import com.bsth.repository.BusinessRepository; | |
| 93 | -import com.bsth.repository.CarDeviceRepository; | |
| 94 | -import com.bsth.repository.CarsRepository; | |
| 95 | -import com.bsth.repository.LineRepository; | |
| 96 | -import com.bsth.repository.RepairReportRepository; | |
| 97 | -import com.bsth.repository.calc.CalcIntervalRepository; | |
| 98 | -import com.bsth.repository.oil.DlbRepository; | |
| 99 | -import com.bsth.repository.oil.QlbRepository; | |
| 100 | -import com.bsth.repository.oil.YlbRepository; | |
| 101 | -import com.bsth.repository.oil.YlxxbRepository; | |
| 102 | -import com.bsth.repository.realcontrol.ChildTaskPlanRepository; | |
| 103 | -import com.bsth.repository.realcontrol.ScheduleRealInfoRepository; | |
| 104 | -import com.bsth.repository.realcontrol.SvgAttributeRepository; | |
| 105 | -import com.bsth.repository.schedule.CarConfigInfoRepository; | |
| 106 | -import com.bsth.repository.schedule.EmployeeConfigInfoRepository; | |
| 107 | -import com.bsth.repository.schedule.GuideboardInfoRepository; | |
| 108 | -import com.bsth.security.util.SecurityUtils; | |
| 109 | -import com.bsth.service.LineService; | |
| 110 | -import com.bsth.service.SectionRouteService; | |
| 111 | -import com.bsth.service.calc.CalcWaybillService; | |
| 112 | -import com.bsth.service.directive.DirectiveService; | |
| 113 | -import com.bsth.service.impl.BaseServiceImpl; | |
| 114 | -import com.bsth.service.realcontrol.ScheduleRealInfoService; | |
| 115 | -import com.bsth.service.report.CulateMileageService; | |
| 116 | -import com.bsth.service.report.ReportService; | |
| 117 | -import com.bsth.service.schedule.SchedulePlanInfoService; | |
| 118 | -import com.bsth.service.sys.DictionaryService; | |
| 119 | -import com.bsth.service.sys.DutyEmployeeService; | |
| 120 | -import com.bsth.util.Arith; | |
| 121 | -import com.bsth.util.ComparableChild; | |
| 122 | -import com.bsth.util.ComparableLp; | |
| 123 | -import com.bsth.util.ComparableReal; | |
| 124 | -import com.bsth.util.DateUtils; | |
| 125 | -import com.bsth.util.ReportRelatedUtils; | |
| 126 | -import com.bsth.util.ReportUtils; | |
| 127 | -import com.bsth.util.TimeUtils; | |
| 128 | -import com.bsth.util.CoordinateConverter; | |
| 129 | -import com.bsth.websocket.handler.SendUtils; | |
| 130 | -import com.fasterxml.jackson.databind.ObjectMapper; | |
| 131 | -import com.github.stuxuhai.jpinyin.PinyinException; | |
| 132 | -import com.github.stuxuhai.jpinyin.PinyinFormat; | |
| 133 | -import com.github.stuxuhai.jpinyin.PinyinHelper; | |
| 134 | -import com.google.common.base.Splitter; | |
| 135 | -import com.google.common.collect.Lists; | |
| 136 | - | |
| 137 | -@Service | |
| 138 | -public class ScheduleRealInfoServiceImpl extends BaseServiceImpl<ScheduleRealInfo, Long> | |
| 139 | - implements ScheduleRealInfoService, InitializingBean, DisposableBean { | |
| 140 | - @Autowired | |
| 141 | - JdbcTemplate jdbcTemplate; | |
| 142 | - @Autowired | |
| 143 | - ScheduleRealInfoRepository scheduleRealInfoRepository; | |
| 144 | - | |
| 145 | - @Autowired | |
| 146 | - EmployeeConfigInfoRepository employeeConfigInfoRepository; | |
| 147 | - | |
| 148 | - @Autowired | |
| 149 | - CarConfigInfoRepository carConfigInfoRepository; | |
| 150 | - | |
| 151 | - @Autowired | |
| 152 | - SectionRouteService sectionRouteService; | |
| 153 | - | |
| 154 | - @Autowired | |
| 155 | - CulateMileageService culateMieageService; | |
| 156 | - | |
| 157 | - @Autowired | |
| 158 | - DictionaryService dictionaryService; | |
| 159 | - | |
| 160 | - @Autowired | |
| 161 | - CalcWaybillService calcWaybillService; | |
| 162 | - | |
| 163 | - @Autowired | |
| 164 | - CalcIntervalRepository calcIntervalRepository; | |
| 165 | - | |
| 166 | - @Autowired | |
| 167 | - LineRepository lineRepository; | |
| 168 | - @Autowired | |
| 169 | - LineService lineService; | |
| 170 | - @Autowired | |
| 171 | - GuideboardInfoRepository guideboardInfoRepository; | |
| 172 | - | |
| 173 | - @Autowired | |
| 174 | - ChildTaskPlanRepository cTaskPlanRepository; | |
| 175 | - | |
| 176 | - @Autowired | |
| 177 | - SendUtils sendUtils; | |
| 178 | - | |
| 179 | - @Autowired | |
| 180 | - DayOfSchedule dayOfSchedule; | |
| 181 | - | |
| 182 | - @Autowired | |
| 183 | - SchAttrCalculator schAttrCalculator; | |
| 184 | - | |
| 185 | - @Autowired | |
| 186 | - LineConfigData lineConfigData; | |
| 187 | - | |
| 188 | - @Autowired | |
| 189 | - DutyEmployeeService dutyEmployeeService; | |
| 190 | - | |
| 191 | - @Autowired | |
| 192 | - YlxxbRepository ylxxbRepository; | |
| 193 | - | |
| 194 | - @Autowired | |
| 195 | - YlbRepository ylbRepository; | |
| 196 | - | |
| 197 | - @Autowired | |
| 198 | - DlbRepository dlbRepository; | |
| 199 | - | |
| 200 | - @Autowired | |
| 201 | - QlbRepository qlbRepository; | |
| 202 | - | |
| 203 | - @Autowired | |
| 204 | - ReportService reposrService; | |
| 205 | - | |
| 206 | - @Autowired | |
| 207 | - CulateMileageService culateService; | |
| 208 | - | |
| 209 | - @Autowired | |
| 210 | - FormLogger schModifyLog; | |
| 211 | - | |
| 212 | - @Autowired | |
| 213 | - DirectiveService directiveService; | |
| 214 | - | |
| 215 | - @Autowired | |
| 216 | - CarDeviceRepository carDeviceRepository; | |
| 217 | - | |
| 218 | - @Autowired | |
| 219 | - CarsRepository carsRepository; | |
| 220 | - | |
| 221 | - @Autowired | |
| 222 | - BusinessRepository businessRepository; | |
| 223 | - | |
| 224 | - @Autowired | |
| 225 | - RepairReportRepository repairReportRepository; | |
| 226 | - | |
| 227 | - private final static Logger logger = LoggerFactory.getLogger(ScheduleRealInfoServiceImpl.class); | |
| 228 | - | |
| 229 | - SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"), | |
| 230 | - sdfSimple = new SimpleDateFormat("yyyyMMdd"); | |
| 231 | - | |
| 232 | - public static Map<String,String> DIRMAP = new ConcurrentHashMap<>(); // dvr电话 | |
| 233 | - private Queue<RepairReport> queue = new ConcurrentLinkedQueue<>(); | |
| 234 | - | |
| 235 | - private ScheduledExecutorService exec = Executors.newSingleThreadScheduledExecutor(new ThreadFactory() { | |
| 236 | - | |
| 237 | - @Override | |
| 238 | - public Thread newThread(Runnable r) { | |
| 239 | - // TODO Auto-generated method stub | |
| 240 | - Thread t = new Thread(r); | |
| 241 | - t.setName("RepairReportReissuer"); | |
| 242 | - | |
| 243 | - return t; | |
| 244 | - } | |
| 245 | - }); | |
| 246 | - | |
| 247 | - | |
| 248 | - | |
| 249 | - private static Map<String, String> report2repair = new HashMap<String, String>(); | |
| 250 | - | |
| 251 | - static { | |
| 252 | - report2repair.put("9101", "9109"); | |
| 253 | - report2repair.put("9102", "9102"); | |
| 254 | - report2repair.put("9103", "9103"); | |
| 255 | - report2repair.put("9104", "9104"); | |
| 256 | - report2repair.put("9109", "9109"); | |
| 257 | - report2repair.put("9201", "9201"); | |
| 258 | - report2repair.put("9202", "9202"); | |
| 259 | - report2repair.put("9203", "9203"); | |
| 260 | - report2repair.put("9204", "9204"); | |
| 261 | - report2repair.put("9209", "9209"); | |
| 262 | - report2repair.put("9301", "9301"); | |
| 263 | - report2repair.put("9302", "9302"); | |
| 264 | - report2repair.put("9303", "9303"); | |
| 265 | - report2repair.put("9304", "9304"); | |
| 266 | - report2repair.put("9305", "9305"); | |
| 267 | - report2repair.put("9306", "9306"); | |
| 268 | - report2repair.put("9309", "9309"); | |
| 269 | - } | |
| 270 | - | |
| 271 | - | |
| 272 | - /** | |
| 273 | - * 校验人车 和 班次的公司和分公司归属 | |
| 274 | - * | |
| 275 | - * @param schId | |
| 276 | - * @param jGh | |
| 277 | - * @param sGh | |
| 278 | - * @param nbbm | |
| 279 | - * @return -2 跨营运公司,校验不过 | |
| 280 | - * -1 跨分公司,二次确认 | |
| 281 | - * 1 校验通过 | |
| 282 | - */ | |
| 283 | - @Override | |
| 284 | - public Map<String, Object> checkPCFgsAscription(Long schId, String jGh, String sGh, String nbbm) { | |
| 285 | - Map<String, Object> rs = new HashMap<>(); | |
| 286 | - try { | |
| 287 | - rs.put("status", ResponseCode.SUCCESS); | |
| 288 | - rs.put("checkStatus", -2); | |
| 289 | - | |
| 290 | - String msg = null; | |
| 291 | - ScheduleRealInfo sch = dayOfSchedule.get(schId); | |
| 292 | - String gsbm = sch.getGsBm(), fgsbm = sch.getFgsBm(); | |
| 293 | - | |
| 294 | - if (nbbm != null && !carExist(gsbm, nbbm)) { | |
| 295 | - msg = sch.getGsName() + "没有自编号为" + "[" + nbbm + "]的车辆"; | |
| 296 | - rs.put("msg", msg); | |
| 297 | - return rs; | |
| 298 | - } | |
| 299 | - | |
| 300 | - if (nbbm != null && !sch.getGsBm().equals(BasicData.nbbm2CompanyCodeMap.get(nbbm))) { | |
| 301 | - rs.put("msg", sch.getXlName() + "所属的公司编码下找不到自编号为【" + nbbm + "】的车辆"); | |
| 302 | - return rs; | |
| 303 | - } | |
| 304 | - | |
| 305 | - if (nbbm != null && !(fgsbm + "_" + gsbm).equals(BasicData.nbbm2FgsCompanyCodeMap.get(nbbm))) { | |
| 306 | - | |
| 307 | - String clFgsName = BasicData.businessFgsCodeNameMap.get(BasicData.nbbm2FgsCompanyCodeMap.get(nbbm)); | |
| 308 | - | |
| 309 | - msg = ("【" + nbbm + "】" + "是" + clFgsName + "的车辆!"); | |
| 310 | - rs.put("msg", msg); | |
| 311 | - rs.put("checkStatus", -1); | |
| 312 | - return rs; | |
| 313 | - } | |
| 314 | - | |
| 315 | - if(null != jGh && !"/".equals(StringUtils.trim(jGh))){ | |
| 316 | - Personnel jsy = BasicData.perMap.get(gsbm + "-" + jGh); | |
| 317 | - | |
| 318 | - if (null == jsy) { | |
| 319 | - msg = "【驾驶员】:" + sch.getGsName() + "暂无工号为" + "【" + jGh + "】的人员"; | |
| 320 | - rs.put("msg", msg); | |
| 321 | - return rs; | |
| 322 | - } | |
| 323 | - else if (!fgsbm.equals(jsy.getBrancheCompanyCode())) { | |
| 324 | - //校验分公司 | |
| 325 | - msg = ("【驾驶员】:" + jGh + "/" + jsy.getPersonnelName() + "是" + jsy.getBrancheCompany() + "的人员"); | |
| 326 | - rs.put("msg", msg); | |
| 327 | - rs.put("checkStatus", -1); | |
| 328 | - return rs; | |
| 329 | - } | |
| 330 | - } | |
| 331 | - | |
| 332 | - if (null != sGh && !"/".equals(StringUtils.trim(sGh))) { | |
| 333 | - Personnel spy = BasicData.perMap.get(gsbm + "-" + sGh); | |
| 334 | - if (null == spy) { | |
| 335 | - msg = "【售票员】: " + sch.getGsName() + "暂无工号为" + "【" + sGh + "】的人员"; | |
| 336 | - rs.put("msg", msg); | |
| 337 | - return rs; | |
| 338 | - } | |
| 339 | - else if (!fgsbm.equals(spy.getBrancheCompanyCode())) { | |
| 340 | - msg = ("【售票员】: " + sGh + "/" + spy.getPersonnelName() + "是" + spy.getBrancheCompany() + "的人员"); | |
| 341 | - rs.put("msg", msg); | |
| 342 | - rs.put("checkStatus", -1); | |
| 343 | - return rs; | |
| 344 | - } | |
| 345 | - } | |
| 346 | - | |
| 347 | - rs.put("checkStatus", 1); | |
| 348 | - } catch (Exception e) { | |
| 349 | - logger.error("", e); | |
| 350 | - rs.put("status", ResponseCode.ERROR); | |
| 351 | - } | |
| 352 | - return rs; | |
| 353 | - } | |
| 354 | - | |
| 355 | - | |
| 356 | - /** | |
| 357 | - * 车辆是否存在 | |
| 358 | - * | |
| 359 | - * @param gsbm 公司编码 | |
| 360 | - * @param nbbm 车辆自编号 | |
| 361 | - * @return | |
| 362 | - */ | |
| 363 | - private boolean carExist(String gsbm, String nbbm) { | |
| 364 | - return BasicData.nbbm2CompanyCodeMap.containsKey(nbbm); | |
| 365 | - } | |
| 366 | - | |
| 367 | - /** | |
| 368 | - * 获取人员姓名 | |
| 369 | - * | |
| 370 | - * @param gsbm 公司编码 | |
| 371 | - * @param gh 人员工号 | |
| 372 | - * @return | |
| 373 | - */ | |
| 374 | - private String getPersonName(String gsbm, String gh) { | |
| 375 | - return BasicData.allPerson.get(gsbm + '-' + gh); | |
| 376 | - } | |
| 377 | - | |
| 378 | - @Override | |
| 379 | - public Iterable<ScheduleRealInfo> list(Map<String, Object> map) { | |
| 380 | - Iterator<ScheduleRealInfo> iterator = super.list(map).iterator(); | |
| 381 | - Set<ScheduleRealInfo> set = new HashSet<>(100); | |
| 382 | - | |
| 383 | - DateTimeFormatter fmtyyyyMMddHHmm = DateTimeFormat.forPattern("yyyy-MM-ddHH:mm"); | |
| 384 | - //计算时间戳 | |
| 385 | - ScheduleRealInfo sch; | |
| 386 | - while (iterator.hasNext()) { | |
| 387 | - sch = iterator.next(); | |
| 388 | - //待发时间戳 | |
| 389 | - sch.setDfsjT(fmtyyyyMMddHHmm.parseMillis(sch.getRealExecDate() + sch.getDfsj())); | |
| 390 | - //实发时间戳 | |
| 391 | - if (StringUtils.isNotEmpty(sch.getFcsjActual())) { | |
| 392 | - sch.setFcsjActualTime(fmtyyyyMMddHHmm.parseMillis(sch.getRealExecDate() + sch.getFcsjActual())); | |
| 393 | - } | |
| 394 | - set.add(sch); | |
| 395 | - } | |
| 396 | - return set; | |
| 397 | - } | |
| 398 | - | |
| 399 | - @Override | |
| 400 | - public Map<String, Collection<ScheduleRealInfo>> findByLines(String lines) { | |
| 401 | - List<String> lineList = Lists.newArrayList(Splitter.on(',').trimResults().omitEmptyStrings().split(lines)); | |
| 402 | - | |
| 403 | - /*Multimap<String, ScheduleRealInfo> mMap = ArrayListMultimap.create(); | |
| 404 | - | |
| 405 | - for (String lineCode : lineList) { | |
| 406 | - mMap.putAll(lineCode, dayOfSchedule.findByLineCode(lineCode)); | |
| 407 | - }*/ | |
| 408 | - return dayOfSchedule.findByLineCodes(lineList); | |
| 409 | - } | |
| 410 | - | |
| 411 | - private final static long DAY_TIME = 1000 * 60 * 60 * 24L; | |
| 412 | - | |
| 413 | - private static int BUF_SIZE = 1024; | |
| 414 | - | |
| 415 | - private static DateTimeFormatter fmtyyyyMMdd = DateTimeFormat.forPattern("yyyy-MM-dd"); | |
| 416 | - private static DateTimeFormatter fmtHHmm = DateTimeFormat.forPattern("HH:mm"); | |
| 417 | - | |
| 418 | - @Override | |
| 419 | - public Map<String, Object> outgoAdjust(Long id, String remarks, String dfsj, String bcType, String opType, String userId) { | |
| 420 | - Map<String, Object> map = new HashMap<>(); | |
| 421 | - try { | |
| 422 | - | |
| 423 | - ScheduleRealInfo schedule = dayOfSchedule.get(id); | |
| 424 | - | |
| 425 | - if (schedule.getStatus() > 0) { | |
| 426 | - map.put("status", ResponseCode.SUCCESS); | |
| 427 | - map.put("flag", "4008"); | |
| 428 | - map.put("t", schedule); | |
| 429 | - return map; | |
| 430 | - } | |
| 431 | - | |
| 432 | - LineConfig config = lineConfigData.get(schedule.getXlBm()); | |
| 433 | - //小于线路开始运营时间,则默认跨过24点 | |
| 434 | - if (dfsj.compareTo(config.getStartOpt()) < 0) { | |
| 435 | - schedule.setRealExecDate(fmtyyyyMMdd.print(schedule.getScheduleDate().getTime() + DAY_TIME)); | |
| 436 | - } else { | |
| 437 | - schedule.setRealExecDate(schedule.getScheduleDateStr()); | |
| 438 | - } | |
| 439 | - | |
| 440 | - //记录日志 | |
| 441 | - ScheduleModifyLogger.dftz(schedule, opType, schedule.getDfsj(), dfsj, remarks, userId); | |
| 442 | - | |
| 443 | - schedule.setDfsjAll(dfsj); | |
| 444 | - schedule.setDfAuto(false); | |
| 445 | - if ("1".equals(opType)) | |
| 446 | - schedule.setRemarks(remarks); | |
| 447 | - | |
| 448 | - List<ScheduleRealInfo> ts = new ArrayList<>(); | |
| 449 | - ts.add(schedule); | |
| 450 | - //调整终点时间和下一个班次的应到时间 | |
| 451 | - //schedule.calcEndTime(); | |
| 452 | - /*ScheduleRealInfo nextSch = dayOfSchedule.nextByLp2(schedule); | |
| 453 | - if (null != nextSch) { | |
| 454 | - nextSch.setQdzArrDatejh(schedule.getZdsj()); | |
| 455 | - ts.add(nextSch); | |
| 456 | - }*/ | |
| 457 | - | |
| 458 | - //调整班次类型 | |
| 459 | - if (StringUtils.isNotEmpty(bcType) && !bcType.equals(schedule.getBcType())) { | |
| 460 | - if ((schedule.getBcType().equals("major") | |
| 461 | - || schedule.getBcType().equals("venting")) | |
| 462 | - && bcType.equals("normal")) { | |
| 463 | - //清空备注 | |
| 464 | - schedule.setRemarks(""); | |
| 465 | - } | |
| 466 | - schedule.setBcType(bcType); | |
| 467 | - } | |
| 468 | - | |
| 469 | - //如果正在执行该班次 | |
| 470 | - //ScheduleRealInfo exec = dayOfSchedule.executeCurr(schedule.getClZbh()); | |
| 471 | - //if(exec != null && exec == schedule){ | |
| 472 | - //重新计算正在执行班次 | |
| 473 | - dayOfSchedule.reCalcExecPlan(schedule.getClZbh()); | |
| 474 | - //} | |
| 475 | - | |
| 476 | - //重新计算是否误点 | |
| 477 | - schedule.reCalcLate(); | |
| 478 | - //取消应发未到标记,不再自动调整待发 | |
| 479 | - //if(schedule.isLate2()){ | |
| 480 | - // schedule.setLate2(false); | |
| 481 | - //LateAdjustHandle.remove(schedule); | |
| 482 | - //} | |
| 483 | - | |
| 484 | - try { | |
| 485 | - if (!schedule.getDirectiveState().equals(-1) && schedule.getStatus() == 0) { | |
| 486 | - //重新下发调度指令 | |
| 487 | - directiveService.send60Dispatch(schedule.getId(), "待发@系统"); | |
| 488 | - } | |
| 489 | - } catch (Exception e) { | |
| 490 | - logger.error("", e); | |
| 491 | - } | |
| 492 | - | |
| 493 | - // 持久化到数据库 | |
| 494 | - dayOfSchedule.save(schedule); | |
| 495 | - | |
| 496 | - map.put("status", ResponseCode.SUCCESS); | |
| 497 | - map.put("ts", ts); | |
| 498 | - } catch (Exception e) { | |
| 499 | - logger.error("", e); | |
| 500 | - map.put("status", ResponseCode.ERROR); | |
| 501 | - } | |
| 502 | - return map; | |
| 503 | - } | |
| 504 | - | |
| 505 | - @Override | |
| 506 | - public Map<String, Object> destroy(String idsStr, String remarks, String reason, String userId) { | |
| 507 | - | |
| 508 | - Map<String, Object> map = new HashMap<>(); | |
| 509 | - List<ScheduleRealInfo> rsList = new ArrayList<>(); | |
| 510 | - map.put("ts", rsList); | |
| 511 | - try { | |
| 512 | - List<String> idList = Lists.newArrayList(Splitter.on(',').trimResults().omitEmptyStrings().split(idsStr)); | |
| 513 | - | |
| 514 | - ScheduleRealInfo schedule = null; | |
| 515 | - for (String id : idList) { | |
| 516 | - schedule = dayOfSchedule.get(Long.parseLong(id)); | |
| 517 | - if (schedule.isDestroy()) { | |
| 518 | - map.put("status", ResponseCode.ERROR); | |
| 519 | - map.put("msg", "不必要的重复烂班!"); | |
| 520 | - return map; | |
| 521 | - } | |
| 522 | - //记录日志 | |
| 523 | - ScheduleModifyLogger.jhlb(schedule, remarks, userId); | |
| 524 | - | |
| 525 | - schedule.setAdjustExps(reason); | |
| 526 | - schedule.destroy(); | |
| 527 | - schedule.addRemarks(remarks); | |
| 528 | - | |
| 529 | - dayOfSchedule.save(schedule); | |
| 530 | - rsList.add(schedule); | |
| 531 | - } | |
| 532 | - | |
| 533 | - //重新计算当前执行班次 | |
| 534 | - dayOfSchedule.reCalcExecPlan(schedule.getClZbh()); | |
| 535 | - | |
| 536 | - map.put("status", ResponseCode.SUCCESS); | |
| 537 | - } catch (Exception e) { | |
| 538 | - logger.error("", e); | |
| 539 | - map.put("status", ResponseCode.ERROR); | |
| 540 | - } | |
| 541 | - return map; | |
| 542 | - } | |
| 543 | - | |
| 544 | - // 线路id获取驾驶员 | |
| 545 | - @Override | |
| 546 | - public List<Map<String, String>> findDriverByLine(String lineCode) { | |
| 547 | - List<EmployeeConfigInfo> list = employeeConfigInfoRepository.findBylineCode(lineCode); | |
| 548 | - | |
| 549 | - List<Map<String, String>> rsList = new ArrayList<>(); | |
| 550 | - Map<String, String> map = null; | |
| 551 | - Personnel driver = null; | |
| 552 | - String code = null; | |
| 553 | - | |
| 554 | - for (EmployeeConfigInfo employee : list) { | |
| 555 | - driver = employee.getJsy(); | |
| 556 | - if (driver != null) { | |
| 557 | - map = new HashMap<>(); | |
| 558 | - code = driver.getJobCode(); | |
| 559 | - map.put("id", code + "/" + driver.getPersonnelName()); | |
| 560 | - map.put("text", code + "/" + driver.getPersonnelName()); | |
| 561 | - rsList.add(map); | |
| 562 | - } | |
| 563 | - } | |
| 564 | - return rsList; | |
| 565 | - } | |
| 566 | - | |
| 567 | - // 线路id获取售票员 | |
| 568 | - @Override | |
| 569 | - public List<Map<String, String>> findConductorByLine(String lineCode) { | |
| 570 | - List<EmployeeConfigInfo> list = employeeConfigInfoRepository.findBylineCode(lineCode); | |
| 571 | - | |
| 572 | - List<Map<String, String>> rsList = new ArrayList<>(); | |
| 573 | - Map<String, String> map = null; | |
| 574 | - Personnel conductor = null; | |
| 575 | - String code = null; | |
| 576 | - | |
| 577 | - for (EmployeeConfigInfo employee : list) { | |
| 578 | - conductor = employee.getSpy(); | |
| 579 | - if (conductor != null) { | |
| 580 | - code = conductor.getJobCode(); | |
| 581 | - map = new HashMap<>(); | |
| 582 | - map.put("id", code + "/" + conductor.getPersonnelName()); | |
| 583 | - map.put("text", code + "/" + conductor.getPersonnelName()); | |
| 584 | - rsList.add(map); | |
| 585 | - } | |
| 586 | - } | |
| 587 | - return rsList; | |
| 588 | - } | |
| 589 | - | |
| 590 | - @Override | |
| 591 | - public List<Map<String, String>> findCarByLine(String lineCode) { | |
| 592 | - | |
| 593 | - List<CarConfigInfo> list = carConfigInfoRepository.findBylineCode(lineCode); | |
| 594 | - | |
| 595 | - List<Map<String, String>> rsList = new ArrayList<>(); | |
| 596 | - Map<String, String> map = null; | |
| 597 | - Cars car = null; | |
| 598 | - String code = null; | |
| 599 | - | |
| 600 | - for (CarConfigInfo cci : list) { | |
| 601 | - car = cci.getCl(); | |
| 602 | - if (car != null) { | |
| 603 | - code = car.getInsideCode(); | |
| 604 | - map = new HashMap<>(); | |
| 605 | - map.put("id", code); | |
| 606 | - map.put("text", code); | |
| 607 | - rsList.add(map); | |
| 608 | - } | |
| 609 | - } | |
| 610 | - return rsList; | |
| 611 | - } | |
| 612 | - | |
| 613 | - /** | |
| 614 | - * 添加到历史库 | |
| 615 | - * | |
| 616 | - * @param t | |
| 617 | - * @return | |
| 618 | - */ | |
| 619 | - @Override | |
| 620 | - public Map<String, Object> addToHistory(ScheduleRealInfo t) { | |
| 621 | - Map<String, Object> rs = new HashMap<>(); | |
| 622 | - try { | |
| 623 | - // 检查调度日期 | |
| 624 | - DateTimeFormatter formatter = DateTimeFormat.forPattern("yyyy-MM-dd"); | |
| 625 | - long today = formatter.parseMillis(new DateTime().toString("yyyy-MM-dd")), scheduleDate = formatter.parseMillis(t.getScheduleDateStr()); | |
| 626 | - String clZbh = t.getClZbh(), lpName = t.getLpName(); | |
| 627 | - if (today < scheduleDate || today - scheduleDate > 86400000 * PrivilegeUtils.getHistoryEditDays()) { | |
| 628 | - rs.put("status", ResponseCode.ERROR); | |
| 629 | - rs.put("msg", "无效的调度日期"); | |
| 630 | - return rs; | |
| 631 | - } | |
| 632 | - if (StringUtils.isEmpty(lpName) || StringUtils.isEmpty(lpName.trim())) { | |
| 633 | - rs.put("status", ResponseCode.ERROR); | |
| 634 | - rs.put("msg", "路牌信息缺失"); | |
| 635 | - return rs; | |
| 636 | - } | |
| 637 | - if (!carExist(t.getGsBm(), clZbh)) { | |
| 638 | - rs.put("msg", "车辆 " + clZbh + " <a href=\"/#/busInfoManage\" target=_blank>车辆基础信息</a> 里找不到!"); | |
| 639 | - rs.put("status", ResponseCode.ERROR); | |
| 640 | - return rs; | |
| 641 | - } | |
| 642 | - | |
| 643 | - SysUser user = SecurityUtils.getCurrentUser(); | |
| 644 | - //String schDate = DayOfSchedule.currSchDateMap.get(t.getXlBm()); | |
| 645 | - | |
| 646 | - SimpleDateFormat sdfyyyyMMdd = new SimpleDateFormat("yyyy-MM-dd"), sdfyyyyMMddHHmm = new SimpleDateFormat("yyyy-MM-ddHH:mm"); | |
| 647 | - | |
| 648 | - if (StringUtils.isEmpty(t.getjGh())) { | |
| 649 | - rs.put("status", ResponseCode.ERROR); | |
| 650 | - rs.put("msg", "驾驶员工号不能为空!"); | |
| 651 | - return rs; | |
| 652 | - } | |
| 653 | - //截取驾驶员工号 | |
| 654 | - if (t.getjGh().indexOf("-") != -1) { | |
| 655 | - t.setjGh(t.getjGh().split("-")[1]); | |
| 656 | - } | |
| 657 | - //检查驾驶员工号 | |
| 658 | - String jName = getPersonName(t.getGsBm(), t.getjGh()); | |
| 659 | - if (StringUtils.isEmpty(jName)) { | |
| 660 | - rs.put("msg", t.getXlName() + "所属的公司编码下找不到工号为【" + t.getjGh() + "】的驾驶员"); | |
| 661 | - rs.put("status", ResponseCode.ERROR); | |
| 662 | - return rs; | |
| 663 | - } else if (StringUtils.isEmpty(t.getjName())) { | |
| 664 | - t.setjName(jName);//补上驾驶员名称 | |
| 665 | - } | |
| 666 | - | |
| 667 | - //有售票员 | |
| 668 | - if (StringUtils.isNotEmpty(t.getsGh())) { | |
| 669 | - String sName = getPersonName(t.getGsBm(), t.getsGh()); | |
| 670 | - if (StringUtils.isEmpty(sName)) { | |
| 671 | - rs.put("msg", t.getXlName() + "所属的公司编码下找不到工号为【" + t.getjGh() + "】的售票员"); | |
| 672 | - rs.put("status", ResponseCode.ERROR); | |
| 673 | - return rs; | |
| 674 | - } else if (StringUtils.isEmpty(t.getsName())) { | |
| 675 | - t.setsName(sName);//补上售票员名称 | |
| 676 | - } | |
| 677 | - } else { | |
| 678 | - t.setsGh(""); | |
| 679 | - t.setsName(""); | |
| 680 | - } | |
| 681 | - | |
| 682 | - //公司 和 分公司名称 | |
| 683 | - t.setGsName(BasicData.businessCodeNameMap.get(t.getGsBm())); | |
| 684 | - t.setFgsName(BasicData.businessFgsCodeNameMap.get(t.getFgsBm()+ "_" + t.getGsBm() )); | |
| 685 | - | |
| 686 | - //t.setScheduleDateStr(schDate); | |
| 687 | - t.setScheduleDate(sdfyyyyMMdd.parse(t.getScheduleDateStr())); | |
| 688 | - t.setRealExecDate(t.getScheduleDateStr()); | |
| 689 | - t.setCreateBy(user); | |
| 690 | - t.setSflj(true); | |
| 691 | - t.setLate(false); | |
| 692 | - t.setDfsj(t.getFcsj()); | |
| 693 | - t.setZdsjT(sdfyyyyMMddHHmm.parse(t.getScheduleDateStr() + t.getZdsj()).getTime()); | |
| 694 | - t.setJhlcOrig(t.getJhlc()); | |
| 695 | - | |
| 696 | - //班次历时 | |
| 697 | - t.setBcsj(DateUtils.calcHHmmDiff(t.getFcsj(), t.getZdsj()) / 1000 / 60); | |
| 698 | - | |
| 699 | - //起终点名称 | |
| 700 | - String prefix = t.getXlBm() + "_" + t.getXlDir() + "_"; | |
| 701 | - t.setQdzName(BasicData.getStationNameByCode(t.getQdzCode(), prefix)); | |
| 702 | - t.setZdzName(BasicData.getStationNameByCode(t.getZdzCode(), prefix)); | |
| 703 | - | |
| 704 | - //计算班次实际执行时间 | |
| 705 | - schAttrCalculator.calcRealDate(t).calcAllTimeByFcsj(t); | |
| 706 | - //处理计达跨24点 | |
| 707 | - LineConfig conf = lineConfigData.get(t.getXlBm()); | |
| 708 | - if (t.getZdsj().compareTo(conf.getStartOpt()) < 0) { | |
| 709 | - t.setZdsjT(sdfyyyyMMddHHmm.parse(t.getScheduleDateStr() + t.getZdsj()).getTime() + (1000 * 60 * 60 * 24)); | |
| 710 | - } | |
| 711 | - if (t.getZdsjT() < t.getFcsjT()) { | |
| 712 | - rs.put("status", ResponseCode.ERROR); | |
| 713 | - rs.put("msg", "起终点时间异常!"); | |
| 714 | - return rs; | |
| 715 | - } | |
| 716 | - | |
| 717 | - t.setId(dayOfSchedule.getId()); | |
| 718 | - //实时入库 | |
| 719 | - rs = super.save(t); | |
| 720 | - } catch (Exception e) { | |
| 721 | - logger.error("", e); | |
| 722 | - rs.put("status", ResponseCode.ERROR); | |
| 723 | - } | |
| 724 | - return rs; | |
| 725 | - } | |
| 726 | - | |
| 727 | - | |
| 728 | - /** | |
| 729 | - * 临加班次 | |
| 730 | - */ | |
| 731 | - @Override | |
| 732 | - public Map<String, Object> save(ScheduleRealInfo sch) { | |
| 733 | - Map<String, Object> rs = new HashMap<>(); | |
| 734 | - try { | |
| 735 | - String clZbh = sch.getClZbh(), lpName = sch.getLpName(); | |
| 736 | - if (StringUtils.isEmpty(lpName) || StringUtils.isEmpty(lpName.trim())) { | |
| 737 | - rs.put("status", ResponseCode.ERROR); | |
| 738 | - rs.put("msg", "路牌信息缺失"); | |
| 739 | - return rs; | |
| 740 | - } | |
| 741 | - if (StringUtils.isNotEmpty(clZbh)) { | |
| 742 | - //检测 | |
| 743 | - if (!carExist(sch.getGsBm(), clZbh)) { | |
| 744 | - rs.put("status", ResponseCode.ERROR); | |
| 745 | - rs.put("msg", "车辆 " + clZbh + " 不存在!"); | |
| 746 | - return rs; | |
| 747 | - } else if (!sch.getGsBm().equals(BasicData.nbbm2CompanyCodeMap.get(clZbh))) { | |
| 748 | - rs.put("status", ResponseCode.ERROR); | |
| 749 | - rs.put("msg", sch.getXlName() + "所属的公司编码下找不到自编号为【" + clZbh + "】的车辆"); | |
| 750 | - return rs; | |
| 751 | - } | |
| 752 | - } | |
| 753 | - | |
| 754 | - SysUser user = SecurityUtils.getCurrentUser(); | |
| 755 | - String schDate = DayOfSchedule.currSchDateMap.get(sch.getXlBm()); | |
| 756 | - | |
| 757 | - SimpleDateFormat sdfyyyyMMdd = new SimpleDateFormat("yyyy-MM-dd"), sdfyyyyMMddHHmm = new SimpleDateFormat("yyyy-MM-ddHH:mm"); | |
| 758 | - | |
| 759 | - if (StringUtils.isEmpty(sch.getjGh())) { | |
| 760 | - rs.put("status", ResponseCode.ERROR); | |
| 761 | - rs.put("msg", "驾驶员工号不能为空!"); | |
| 762 | - return rs; | |
| 763 | - } | |
| 764 | - //截取驾驶员工号 | |
| 765 | - if (sch.getjGh().indexOf("-") != -1) { | |
| 766 | - sch.setjGh(sch.getjGh().split("-")[1]); | |
| 767 | - } | |
| 768 | - //检查驾驶员工号 | |
| 769 | - String jName = getPersonName(sch.getGsBm(), sch.getjGh()); | |
| 770 | - if (StringUtils.isEmpty(jName)) { | |
| 771 | - rs.put("msg", sch.getXlName() + "所属的公司编码下找不到工号为【" + sch.getjGh() + "】的驾驶员"); | |
| 772 | - rs.put("status", ResponseCode.ERROR); | |
| 773 | - return rs; | |
| 774 | - } else if (StringUtils.isEmpty(sch.getjName())) { | |
| 775 | - sch.setjName(jName);//补上驾驶员名称 | |
| 776 | - } | |
| 777 | - | |
| 778 | - //有售票员 | |
| 779 | - if (StringUtils.isNotEmpty(sch.getsGh())) { | |
| 780 | - String sName = getPersonName(sch.getGsBm(), sch.getsGh()); | |
| 781 | - if (StringUtils.isEmpty(sName)) { | |
| 782 | - rs.put("msg", sch.getXlName() + "所属的公司编码下找不到工号为【" + sch.getjGh() + "】的售票员"); | |
| 783 | - rs.put("status", ResponseCode.ERROR); | |
| 784 | - return rs; | |
| 785 | - } else if (StringUtils.isEmpty(sch.getsName())) { | |
| 786 | - sch.setsName(sName);//补上售票员名称 | |
| 787 | - } | |
| 788 | - } else { | |
| 789 | - sch.setsGh(""); | |
| 790 | - sch.setsName(""); | |
| 791 | - } | |
| 792 | - | |
| 793 | - //公司 和 分公司名称 | |
| 794 | - sch.setGsName(BasicData.businessCodeNameMap.get(sch.getGsBm())); | |
| 795 | - sch.setFgsName(BasicData.businessFgsCodeNameMap.get(sch.getFgsBm() + "_" + sch.getGsBm())); | |
| 796 | - sch.setCreateDate(new Date()); | |
| 797 | - sch.setScheduleDateStr(schDate); | |
| 798 | - sch.setScheduleDate(sdfyyyyMMdd.parse(schDate)); | |
| 799 | - sch.setRealExecDate(schDate); | |
| 800 | - | |
| 801 | - sch.setCreateBy(user); | |
| 802 | - sch.setSflj(true); | |
| 803 | - sch.setLate(false); | |
| 804 | - sch.setDfsj(sch.getFcsj()); | |
| 805 | - sch.setZdsjT(sdfyyyyMMddHHmm.parse(schDate + sch.getZdsj()).getTime()); | |
| 806 | - sch.setJhlcOrig(sch.getJhlc()); | |
| 807 | - sch.setCreateDate(new Date()); | |
| 808 | - sch.setUpdateDate(new Date()); | |
| 809 | - sch.setSpId(-1L); | |
| 810 | - //起终点名称 | |
| 811 | - String prefix = sch.getXlBm() + "_" + sch.getXlDir() + "_"; | |
| 812 | - sch.setQdzName(BasicData.getStationNameByCode(sch.getQdzCode(), prefix)); | |
| 813 | - sch.setZdzName(BasicData.getStationNameByCode(sch.getZdzCode(), prefix)); | |
| 814 | - | |
| 815 | - //计算班次实际执行时间 | |
| 816 | - schAttrCalculator.calcRealDate(sch).calcAllTimeByFcsj(sch); | |
| 817 | - | |
| 818 | - //处理计达跨24点 | |
| 819 | - LineConfig conf = lineConfigData.get(sch.getXlBm()); | |
| 820 | - if (sch.getZdsj().compareTo(conf.getStartOpt()) < 0) { | |
| 821 | - sch.setZdsjT(sdfyyyyMMddHHmm.parse(sch.getScheduleDateStr() + sch.getZdsj()).getTime() + (1000 * 60 * 60 * 24)); | |
| 822 | - } | |
| 823 | - | |
| 824 | - //班次历时 | |
| 825 | - sch.setBcsj((int) ((sch.getZdsjT() - sch.getDfsjT()) / 1000 / 60)); | |
| 826 | - if (sch.getZdsjT() < sch.getFcsjT()) { | |
| 827 | - rs.put("status", ResponseCode.ERROR); | |
| 828 | - rs.put("msg", "起终点时间异常!"); | |
| 829 | - return rs; | |
| 830 | - } | |
| 831 | - | |
| 832 | - sch.setId(dayOfSchedule.getId()); | |
| 833 | - //实时入库 | |
| 834 | - super.save(sch); | |
| 835 | - | |
| 836 | - // 加入缓存 | |
| 837 | - dayOfSchedule.put(sch); | |
| 838 | - | |
| 839 | - //更新起点应到时间 | |
| 840 | - List<ScheduleRealInfo> ts = dayOfSchedule.updateQdzTimePlan(sch); | |
| 841 | - | |
| 842 | - //重新计算车辆当前执行班次 | |
| 843 | - dayOfSchedule.reCalcExecPlan(sch.getClZbh()); | |
| 844 | - | |
| 845 | - //记录站到场历时数据 | |
| 846 | - Station2ParkBuffer.put(sch); | |
| 847 | - | |
| 848 | - rs.put("ts", ts); | |
| 849 | - rs.put("t", sch); | |
| 850 | - } catch (Exception e) { | |
| 851 | - logger.error("", e); | |
| 852 | - rs.put("status", ResponseCode.ERROR); | |
| 853 | - } | |
| 854 | - return rs; | |
| 855 | - } | |
| 856 | - | |
| 857 | - /** | |
| 858 | - * 删除历史表临加班次 | |
| 859 | - * | |
| 860 | - * @param id | |
| 861 | - * @return | |
| 862 | - */ | |
| 863 | - @Override | |
| 864 | - public Map<String, Object> deleteToHistory(Long id) { | |
| 865 | - Map<String, Object> rs = new HashMap<>(); | |
| 866 | - rs.put("status", ResponseCode.ERROR); | |
| 867 | - | |
| 868 | - try { | |
| 869 | - ScheduleRealInfo sch = super.findById(id); | |
| 870 | - if (sch == null) { | |
| 871 | - rs.put("msg", "无效的id号"); | |
| 872 | - return rs; | |
| 873 | - } | |
| 874 | - | |
| 875 | - if (!sch.isSflj()) { | |
| 876 | - rs.put("msg", "你只能删除临加班次"); | |
| 877 | - return rs; | |
| 878 | - } | |
| 879 | - | |
| 880 | - //解除和调度指令的外键约束 | |
| 881 | - jdbcTemplate.update(Constants.REMOVE_DIRECTIVE_SCH_FK, id); | |
| 882 | - | |
| 883 | - //数据库删除 | |
| 884 | - rs = super.delete(id); | |
| 885 | - } catch (Exception e) { | |
| 886 | - logger.error("", e); | |
| 887 | - rs.put("msg", e.getMessage()); | |
| 888 | - } | |
| 889 | - | |
| 890 | - return rs; | |
| 891 | - } | |
| 892 | - | |
| 893 | - @Override | |
| 894 | - public Map<String, Object> delete(Long id) { | |
| 895 | - Map<String, Object> rs = new HashMap<>(); | |
| 896 | - rs.put("status", ResponseCode.ERROR); | |
| 897 | - | |
| 898 | - ScheduleRealInfo sch = null; | |
| 899 | - try { | |
| 900 | - sch = dayOfSchedule.get(id); | |
| 901 | - if (sch == null) { | |
| 902 | - rs.put("msg", "无效的id号"); | |
| 903 | - return rs; | |
| 904 | - } | |
| 905 | - | |
| 906 | - if (!sch.isSflj()) { | |
| 907 | - rs.put("msg", "你只能删除临加班次"); | |
| 908 | - return rs; | |
| 909 | - } | |
| 910 | - | |
| 911 | - sch.setDeleted(true); | |
| 912 | - //解除和调度指令的外键约束 | |
| 913 | - jdbcTemplate.update(Constants.REMOVE_DIRECTIVE_SCH_FK, id); | |
| 914 | - | |
| 915 | - //数据库删除 | |
| 916 | - rs = super.delete(id); | |
| 917 | - if (rs.get("status").equals(ResponseCode.SUCCESS)) { | |
| 918 | - dayOfSchedule.delete(sch); | |
| 919 | - //更新起点应到时间 | |
| 920 | - List<ScheduleRealInfo> ts = dayOfSchedule.updateQdzTimePlan(sch); | |
| 921 | - rs.put("ts", ts); | |
| 922 | - rs.put("delete", sch); | |
| 923 | - } else | |
| 924 | - sch.setDeleted(false); | |
| 925 | - } catch (Exception e) { | |
| 926 | - logger.error("", e); | |
| 927 | - rs.put("msg", e.getMessage()); | |
| 928 | - sch.setDeleted(false); | |
| 929 | - } | |
| 930 | - | |
| 931 | - return rs; | |
| 932 | - } | |
| 933 | - | |
| 934 | - @Override | |
| 935 | - public List<Map<String, String>> sreachVehic(String nbbm) { | |
| 936 | - // 转大写 | |
| 937 | - nbbm = nbbm.toUpperCase(); | |
| 938 | - | |
| 939 | - List<Map<String, String>> list = new ArrayList<>(); | |
| 940 | - Map<String, String> map; | |
| 941 | - Set<String> allSet = BasicData.nbbm2CompanyCodeMap.keySet(); | |
| 942 | - | |
| 943 | - Line line; | |
| 944 | - for (String k : allSet) { | |
| 945 | - if (k.indexOf(nbbm) != -1) { | |
| 946 | - // 所属线路 | |
| 947 | - map = new HashMap<>(); | |
| 948 | - line = BasicData.nbbm2LineMap.get(k); | |
| 949 | - map.put("id", k); | |
| 950 | - map.put("text", k); | |
| 951 | - if (null != line) { | |
| 952 | - map.put("lineName", line.getName()); | |
| 953 | - map.put("lineCode", line.getLineCode()); | |
| 954 | - } | |
| 955 | - | |
| 956 | - list.add(map); | |
| 957 | - } | |
| 958 | - | |
| 959 | - if (list.size() > 20) | |
| 960 | - break; | |
| 961 | - } | |
| 962 | - return list; | |
| 963 | - } | |
| 964 | - | |
| 965 | - @Override | |
| 966 | - public void adjustCar(ScheduleRealInfo schedule, String car) { | |
| 967 | - schedule.setClZbh(car); | |
| 968 | - } | |
| 969 | - | |
| 970 | - @Override | |
| 971 | - public void adjustDriver(ScheduleRealInfo schedule, String driver, String driverName) { | |
| 972 | - if (driver.indexOf("-") != -1) | |
| 973 | - driver = driver.split("-")[1]; | |
| 974 | - schedule.setjGh(driver); | |
| 975 | - schedule.setjName(driverName); | |
| 976 | - } | |
| 977 | - | |
| 978 | - @Override | |
| 979 | - public void adjustConductor(ScheduleRealInfo schedule, String conductor, String conductorName) { | |
| 980 | - if (conductor.indexOf("-") != -1) | |
| 981 | - conductor = conductor.split("-")[1]; | |
| 982 | - schedule.setsGh(conductor); | |
| 983 | - schedule.setsName(conductorName); | |
| 984 | - } | |
| 985 | - | |
| 986 | - @Override | |
| 987 | - public List<ScheduleRealInfo> queryUserInfo(String line, String date, String state) { | |
| 988 | - List<ScheduleRealInfo> scheduleRealInfos = new ArrayList<>(); | |
| 989 | - List<Object[]> objects = null; | |
| 990 | - if (state.equals("2")) { | |
| 991 | - objects = scheduleRealInfoRepository.queryUserInfo2(line, date); | |
| 992 | - for (Object[] objs : objects) { | |
| 993 | - ScheduleRealInfo scheduleRealInfo = new ScheduleRealInfo(); | |
| 994 | - scheduleRealInfo.setId((Long)objs[0]); | |
| 995 | - scheduleRealInfo.setjGh((String)objs[1]); | |
| 996 | - scheduleRealInfo.setClZbh((String)objs[2]); | |
| 997 | - scheduleRealInfo.setLpName((String)objs[3]); | |
| 998 | - scheduleRealInfo.setjName((String)objs[4]); | |
| 999 | - | |
| 1000 | - scheduleRealInfos.add(scheduleRealInfo); | |
| 1001 | - } | |
| 1002 | - } else { | |
| 1003 | - objects = scheduleRealInfoRepository.queryUserInfo3(line, date); | |
| 1004 | - for (Object[] objs : objects) { | |
| 1005 | - ScheduleRealInfo scheduleRealInfo = new ScheduleRealInfo(); | |
| 1006 | - scheduleRealInfo.setId((Long)objs[0]); | |
| 1007 | - scheduleRealInfo.setClZbh((String)objs[1]); | |
| 1008 | - | |
| 1009 | - scheduleRealInfos.add(scheduleRealInfo); | |
| 1010 | - } | |
| 1011 | - } | |
| 1012 | - | |
| 1013 | - return scheduleRealInfos; | |
| 1014 | - } | |
| 1015 | - | |
| 1016 | - @Override | |
| 1017 | - public List<ScheduleRealInfo> queryUserInfoPx(String line, String date, String state, String type) { | |
| 1018 | -// List<ScheduleRealInfo> list=new ArrayList<ScheduleRealInfo>(); | |
| 1019 | - state = state + ""; | |
| 1020 | - String lpname = state; | |
| 1021 | - String px = type; | |
| 1022 | - if (state.equals("lpName")) { | |
| 1023 | - state = state + "+1"; | |
| 1024 | - type = "ASC"; | |
| 1025 | - } | |
| 1026 | - String minfcsj = "02:00"; | |
| 1027 | - List<Line> lineList = lineRepository.findLineByCode(line); | |
| 1028 | - if (lineList.size() > 0) { | |
| 1029 | - String sqlMinYysj = "select start_opt from bsth_c_line_config where " | |
| 1030 | - + " id = (" | |
| 1031 | - + "select max(id) from bsth_c_line_config where line ='" + lineList.get(0).getId() + "'" | |
| 1032 | - + ")"; | |
| 1033 | - minfcsj = jdbcTemplate.queryForObject(sqlMinYysj, String.class); | |
| 1034 | - } | |
| 1035 | - String sqlPlan = "select * from (select * from (" | |
| 1036 | - + " select min(s.id) as id,s.j_Gh as jGh,s.cl_Zbh as clZbh, " | |
| 1037 | - + " s.lp_Name as lpName,min(s.j_Name) as jName,max(s.schedule_date_str) as dateStr ," | |
| 1038 | - + " min(s.fcsj) as fcsj,1 as px from bsth_c_s_sp_info_real s where " | |
| 1039 | - + " s.xl_Bm = '" + line + "' and s.schedule_date_str ='" + date + "'" | |
| 1040 | - + " GROUP BY s.j_Gh,s.cl_Zbh,s.lp_Name) x where x.fcsj >'" + minfcsj + "'" | |
| 1041 | - + " UNION " | |
| 1042 | - + " select * from ( select min(s.id) as id,s.j_Gh as jGh,s.cl_Zbh as clZbh, " | |
| 1043 | - + " s.lp_Name as lpName,min(s.j_Name) as jName, max(s.schedule_date_str) as dateStr," | |
| 1044 | - + " min(s.fcsj) as fcsj,2 as px from bsth_c_s_sp_info_real s " | |
| 1045 | - + " where s.xl_Bm = '" + line + "' and s.schedule_date_str ='" + date + "'" | |
| 1046 | - + " GROUP BY s.j_Gh,s.cl_Zbh,s.lp_Name" | |
| 1047 | - + " ) y where y.fcsj <='" + minfcsj + "') z order by (" + state + "),dateStr,px,fcsj " + type; | |
| 1048 | - List<ScheduleRealInfo> list = jdbcTemplate.query(sqlPlan, | |
| 1049 | - new RowMapper<ScheduleRealInfo>() { | |
| 1050 | - @Override | |
| 1051 | - public ScheduleRealInfo mapRow(ResultSet rs, int rowNum) throws SQLException { | |
| 1052 | - ScheduleRealInfo t = new ScheduleRealInfo(); | |
| 1053 | - t.setId(rs.getLong("id")); | |
| 1054 | - t.setjGh(rs.getString("jGh")); | |
| 1055 | - t.setClZbh(rs.getString("clZbh")); | |
| 1056 | - t.setLpName(rs.getString("lpName")); | |
| 1057 | - t.setjName(rs.getString("jName")); | |
| 1058 | - t.setFcsj(rs.getString("fcsj")); | |
| 1059 | - return t; | |
| 1060 | - } | |
| 1061 | - }); | |
| 1062 | - if (lpname.equals("lpName")) { | |
| 1063 | - | |
| 1064 | - List<ScheduleRealInfo> listNew = new ArrayList<ScheduleRealInfo>(); | |
| 1065 | - Pattern pattern = Pattern.compile("^[-\\+]?[\\d]*$"); | |
| 1066 | -// if (px.equals("desc")) { | |
| 1067 | - int zt = 0; | |
| 1068 | - for (int l = 0; l < 2; l++) { | |
| 1069 | - for (int i = 0; i < list.size(); i++) { | |
| 1070 | - ScheduleRealInfo t = list.get(i); | |
| 1071 | - if (t.getLpName().indexOf("+") != -1) { | |
| 1072 | - if (zt == 0) { | |
| 1073 | - listNew.add(t); | |
| 1074 | - } | |
| 1075 | - } else if (pattern.matcher(t.getLpName()).matches()) { | |
| 1076 | - if (zt == 1) { | |
| 1077 | - listNew.add(t); | |
| 1078 | - } | |
| 1079 | - } else { | |
| 1080 | - continue; | |
| 1081 | - } | |
| 1082 | - } | |
| 1083 | - zt++; | |
| 1084 | - } | |
| 1085 | - | |
| 1086 | - Collections.sort(list, new ComparableLp()); | |
| 1087 | - for (int i = 0; i < list.size(); i++) { | |
| 1088 | - ScheduleRealInfo t = list.get(i); | |
| 1089 | - if (t.getLpName().indexOf("+") != -1) { | |
| 1090 | - continue; | |
| 1091 | - } else if (pattern.matcher(t.getLpName()).matches()) { | |
| 1092 | - continue; | |
| 1093 | - } else { | |
| 1094 | - listNew.add(t); | |
| 1095 | - } | |
| 1096 | - } | |
| 1097 | - return listNew; | |
| 1098 | - } else { | |
| 1099 | - return list; | |
| 1100 | - } | |
| 1101 | - | |
| 1102 | - } | |
| 1103 | - | |
| 1104 | - /** | |
| 1105 | - * | |
| 1106 | - */ | |
| 1107 | - @Override | |
| 1108 | - public List<ScheduleRealInfo> exportWaybill(String jName,String jGh, String clZbh, String lpName, String date, String line) { | |
| 1109 | - ReportUtils ee = new ReportUtils(); | |
| 1110 | - ReportRelatedUtils rru = new ReportRelatedUtils(); | |
| 1111 | - List<Iterator<?>> list = new ArrayList<Iterator<?>>(); | |
| 1112 | - List<ScheduleRealInfo> scheduleRealInfos = scheduleRealInfoRepository.queryListWaybillXcld(jGh, clZbh, lpName, date, line); | |
| 1113 | - List<Map<String, Object>> listMap = new ArrayList<Map<String, Object>>(); | |
| 1114 | -// List<ScheduleRealInfo> scheduleRealInfos=scheduleRealInfoRepository.queryListWaybillXcld(jName, clZbh, lpName, date, line); | |
| 1115 | - List<ScheduleRealInfo> lists = new ArrayList<ScheduleRealInfo>(); | |
| 1116 | - for (int i = 0; i < scheduleRealInfos.size(); i++) { | |
| 1117 | - ScheduleRealInfo s = scheduleRealInfos.get(i); | |
| 1118 | - Set<ChildTaskPlan> cts = s.getcTasks(); | |
| 1119 | - if (cts != null && cts.size() > 0) { | |
| 1120 | - lists.add(s); | |
| 1121 | - } else { | |
| 1122 | - if (s.getZdsjActual() != null && s.getFcsjActual() != null) { | |
| 1123 | - lists.add(s); | |
| 1124 | - } | |
| 1125 | - } | |
| 1126 | - } | |
| 1127 | - DecimalFormat format = new DecimalFormat("0.00"); | |
| 1128 | -// int cjbc = scheduleRealInfoRepository.findCjbc(jName, clZbh, lpName); | |
| 1129 | -// int ljbc = scheduleRealInfoRepository.findLjbc(jName, clZbh, lpName); | |
| 1130 | - //计算里程和班次数,并放入Map里 | |
| 1131 | - Map<String, Object> map = this.MapById(scheduleRealInfos.get(0).getId()); | |
| 1132 | - | |
| 1133 | - map.put("jhlc", Arith.add(culateMieageService.culateJhgl(scheduleRealInfos), culateMieageService.culateJhJccgl(scheduleRealInfos))); | |
| 1134 | - map.put("remMileage", culateMieageService.culateLbgl(scheduleRealInfos)); | |
| 1135 | - map.put("addMileage", culateMieageService.culateLjgl(lists)); | |
| 1136 | - double yygl = Arith.add(culateMieageService.culateSjgl(lists), culateMieageService.culateLjgl(lists)); | |
| 1137 | - map.put("yygl", yygl); | |
| 1138 | - double ksgl = Arith.add(culateMieageService.culateKsgl(scheduleRealInfos), culateMieageService.culateJccgl(lists)); | |
| 1139 | - map.put("ksgl", ksgl); | |
| 1140 | - map.put("realMileage", Arith.add(yygl, ksgl)); | |
| 1141 | - map.put("jhbc", culateMieageService.culateJhbc(scheduleRealInfos, "")); | |
| 1142 | - map.put("cjbc", culateMieageService.culateLbbc(scheduleRealInfos)); | |
| 1143 | - map.put("ljbc", culateMieageService.culateLjbc(lists, "")); | |
| 1144 | - int sjbc = culateMieageService.culateLjbc(lists, "") + culateMieageService.culateSjbc(lists, ""); | |
| 1145 | - map.put("sjbc", sjbc); | |
| 1146 | -// map=new HashMap<String,Object>(); | |
| 1147 | - | |
| 1148 | - SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm"); | |
| 1149 | - String minfcsj = "02:00"; | |
| 1150 | - List<Line> lineList = lineRepository.findLineByCode(line); | |
| 1151 | - if (lineList.size() > 0) { | |
| 1152 | - String sqlMinYysj = "select start_opt from bsth_c_line_config where " | |
| 1153 | - + " id = (" | |
| 1154 | - + "select max(id) from bsth_c_line_config where line ='" + lineList.get(0).getId() + "'" | |
| 1155 | - + ")"; | |
| 1156 | - minfcsj = jdbcTemplate.queryForObject(sqlMinYysj, String.class); | |
| 1157 | - } | |
| 1158 | - String[] minSjs = minfcsj.split(":"); | |
| 1159 | - Long minSj = Long.parseLong(minSjs[0]) * 60 + Long.parseLong(minSjs[1]); | |
| 1160 | - | |
| 1161 | - | |
| 1162 | - for (int i = 0; i < scheduleRealInfos.size(); i++) { | |
| 1163 | - ScheduleRealInfo s = scheduleRealInfos.get(i); | |
| 1164 | - String[] fcsj = s.getFcsj().split(":"); | |
| 1165 | - Long fcsjL = Long.parseLong(fcsj[0]) * 60 + Long.parseLong(fcsj[1]); | |
| 1166 | - | |
| 1167 | - Long fscjT = 0L; | |
| 1168 | - if (fcsjL < minSj) { | |
| 1169 | - Calendar calendar = new GregorianCalendar(); | |
| 1170 | - calendar.setTime(s.getScheduleDate()); | |
| 1171 | - calendar.add(calendar.DATE, 1); | |
| 1172 | - s.setScheduleDate(calendar.getTime()); | |
| 1173 | - try { | |
| 1174 | - fscjT = sdf.parse(sdf.format(s.getScheduleDate()) + " " + s.getFcsj()).getTime(); | |
| 1175 | - } catch (ParseException e) { | |
| 1176 | - // TODO Auto-generated catch block | |
| 1177 | - e.printStackTrace(); | |
| 1178 | - } | |
| 1179 | - | |
| 1180 | - } else { | |
| 1181 | - try { | |
| 1182 | - fscjT = sdf.parse(s.getScheduleDateStr() + " " + s.getFcsj()).getTime(); | |
| 1183 | - } catch (ParseException e) { | |
| 1184 | - // TODO Auto-generated catch block | |
| 1185 | - e.printStackTrace(); | |
| 1186 | - } | |
| 1187 | - ; | |
| 1188 | - } | |
| 1189 | - s.setFcsjT(fscjT); | |
| 1190 | - } | |
| 1191 | - List<ScheduleRealInfo> listSchedule = new ArrayList<ScheduleRealInfo>(); | |
| 1192 | - Collections.sort(scheduleRealInfos, new ComparableReal()); | |
| 1193 | - for (int i = 0; i < scheduleRealInfos.size(); i++) { | |
| 1194 | - ScheduleRealInfo s = scheduleRealInfos.get(i); | |
| 1195 | - s.setAdjustExps(i + 1 + ""); | |
| 1196 | - String remarks = ""; | |
| 1197 | - if (s.getRemarks() != null) { | |
| 1198 | - remarks += s.getRemarks(); | |
| 1199 | - } | |
| 1200 | - | |
| 1201 | - Set<ChildTaskPlan> childTaskPlans = s.getcTasks(); | |
| 1202 | - if (!childTaskPlans.isEmpty()) { | |
| 1203 | - s.setFcsjActual(""); | |
| 1204 | - s.setZdsjActual(""); | |
| 1205 | - s.setJhlc(0.0); | |
| 1206 | - } | |
| 1207 | - | |
| 1208 | - if (s.isDestroy()) { | |
| 1209 | - s.setFcsjActual(""); | |
| 1210 | - s.setZdsjActual(""); | |
| 1211 | - s.setJhlc(0.0); | |
| 1212 | - remarks += "(烂班)"; | |
| 1213 | - s.setRemarks(remarks); | |
| 1214 | - } | |
| 1215 | - | |
| 1216 | - listSchedule.add(s); | |
| 1217 | - //计算营运里程,空驶里程 | |
| 1218 | - if (!childTaskPlans.isEmpty()) { | |
| 1219 | -// Iterator<ChildTaskPlan> it = childTaskPlans.iterator(); | |
| 1220 | - List<ChildTaskPlan> listit = new ArrayList<ChildTaskPlan>(childTaskPlans); | |
| 1221 | - Collections.sort(listit, new ComparableChild()); | |
| 1222 | - for (int j = 0; j < listit.size(); j++) { | |
| 1223 | - ScheduleRealInfo t = new ScheduleRealInfo(); | |
| 1224 | - ChildTaskPlan childTaskPlan = listit.get(j); | |
| 1225 | - if (childTaskPlan.isDestroy()) { | |
| 1226 | - t.setFcsjActual(""); | |
| 1227 | - t.setZdsjActual(""); | |
| 1228 | - t.setJhlc(0.0); | |
| 1229 | - } else { | |
| 1230 | - t.setFcsjActual(childTaskPlan.getStartDate()); | |
| 1231 | - t.setZdsjActual(childTaskPlan.getEndDate()); | |
| 1232 | - t.setJhlc(Double.parseDouble(String.valueOf(childTaskPlan.getMileage()))); | |
| 1233 | - } | |
| 1234 | - t.setQdzName(childTaskPlan.getStartStationName()); | |
| 1235 | - t.setZdzName(childTaskPlan.getEndStationName()); | |
| 1236 | - t.setRemarks(childTaskPlan.getRemarks()); | |
| 1237 | - t.setAdjustExps("子"); | |
| 1238 | - t.setjGh(""); | |
| 1239 | - t.setjName(""); | |
| 1240 | - t.setsGh(""); | |
| 1241 | - t.setsName(""); | |
| 1242 | - listSchedule.add(t); | |
| 1243 | - } | |
| 1244 | - } | |
| 1245 | - } | |
| 1246 | - Map<String, Object> maps; | |
| 1247 | - for (ScheduleRealInfo scheduleRealInfo : listSchedule) { | |
| 1248 | - maps = new HashMap<String, Object>(); | |
| 1249 | - try { | |
| 1250 | - scheduleRealInfo.setjName(scheduleRealInfo.getjGh() + scheduleRealInfo.getjName()); | |
| 1251 | - scheduleRealInfo.setsName(scheduleRealInfo.getsGh() + scheduleRealInfo.getsName()); | |
| 1252 | - maps = rru.getMapValue(scheduleRealInfo); | |
| 1253 | - maps.put("bcs", scheduleRealInfo.getAdjustExps()); | |
| 1254 | - String zdsj = scheduleRealInfo.getZdsj(); | |
| 1255 | - String zdsjActual = scheduleRealInfo.getZdsjActual(); | |
| 1256 | - if (zdsj != null && zdsjActual != null && | |
| 1257 | - !zdsj.equals(zdsjActual) && | |
| 1258 | - !zdsj.equals("") && | |
| 1259 | - !zdsjActual.equals("")) { | |
| 1260 | - int zdsjT = Integer.valueOf(zdsj.split(":")[0]) * 60 + Integer.valueOf(zdsj.split(":")[1]); | |
| 1261 | - int zdsjAT = Integer.valueOf(zdsjActual.split(":")[0]) * 60 + Integer.valueOf(zdsjActual.split(":")[1]); | |
| 1262 | - if (zdsj.compareTo(zdsjActual) > 0) { | |
| 1263 | - if (zdsjT - zdsjAT > 1000) { | |
| 1264 | - maps.put("fast", ""); | |
| 1265 | - maps.put("slow", zdsjAT - zdsjT + 1440); | |
| 1266 | - } else { | |
| 1267 | - maps.put("fast", TimeUtils.getTimeDifference(zdsj, zdsjActual)); | |
| 1268 | - maps.put("slow", ""); | |
| 1269 | - } | |
| 1270 | - } else { | |
| 1271 | - if (zdsjAT - zdsjT > 1000) { | |
| 1272 | - maps.put("fast", zdsjT - zdsjAT + 1440); | |
| 1273 | - maps.put("slow", ""); | |
| 1274 | - } else { | |
| 1275 | - maps.put("fast", ""); | |
| 1276 | - maps.put("slow", TimeUtils.getTimeDifference(zdsj, zdsjActual)); | |
| 1277 | - } | |
| 1278 | - } | |
| 1279 | - } else { | |
| 1280 | - maps.put("fast", ""); | |
| 1281 | - maps.put("slow", ""); | |
| 1282 | - } | |
| 1283 | - listMap.add(maps); | |
| 1284 | - } catch (Exception e) { | |
| 1285 | - e.printStackTrace(); | |
| 1286 | - } | |
| 1287 | - } | |
| 1288 | - | |
| 1289 | - String xls = ""; | |
| 1290 | - if (map.get("type").toString().equals("0")) { | |
| 1291 | - xls = "waybill_minhang.xls"; | |
| 1292 | - } else { | |
| 1293 | - xls = "waybill_minhang_dl.xls"; | |
| 1294 | - } | |
| 1295 | - | |
| 1296 | - | |
| 1297 | - String path = this.getClass().getResource("/").getPath() + "static/pages/forms/"; | |
| 1298 | - | |
| 1299 | - list.add(listMap.iterator()); | |
| 1300 | - ee.excelReplace(list, new Object[]{scheduleRealInfos.get(0), map}, path + "mould/" + xls, | |
| 1301 | - path + "export/" + date + "-" + jName + "-" + clZbh + "-" + lpName + "-行车路单.xls"); | |
| 1302 | - return scheduleRealInfos; | |
| 1303 | - } | |
| 1304 | - | |
| 1305 | - @Override | |
| 1306 | - public List<Map<String, Object>> dailyInfo(String line, String date, String type) { | |
| 1307 | - DecimalFormat format = new DecimalFormat("0.00"); | |
| 1308 | - ReportUtils ee = new ReportUtils(); | |
| 1309 | - List<Iterator<?>> listI = new ArrayList<Iterator<?>>(); | |
| 1310 | - List<Map<String, Object>> list = scheduleRealInfoRepository.dailyInfo(line, date); | |
| 1311 | - | |
| 1312 | - double totalZGL = 0, totalKSGL = 0, totalYH = 0; | |
| 1313 | - int totalBCS = 0; | |
| 1314 | - for (int i = 0; i < list.size(); i++) { | |
| 1315 | - String zgl = format.format(Double.parseDouble(list.get(i).get("zgl") == null ? "0" : list.get(i).get("zgl").toString())); | |
| 1316 | - String ksgl = format.format(Double.parseDouble(list.get(i).get("ksgl") == null ? "0" : list.get(i).get("ksgl").toString())); | |
| 1317 | - if (type.equals("export")) { | |
| 1318 | - totalZGL += Double.parseDouble(zgl); | |
| 1319 | - totalKSGL += Double.parseDouble(ksgl); | |
| 1320 | - totalBCS += Integer.parseInt(list.get(i).get("bcs").toString()); | |
| 1321 | - } | |
| 1322 | - list.get(i).put("zgl", zgl); | |
| 1323 | - list.get(i).put("ksgl", ksgl); | |
| 1324 | - } | |
| 1325 | - if (type.equals("export")) { | |
| 1326 | - Map<String, Object> map = new HashMap<String, Object>(); | |
| 1327 | - map.put("line", line); | |
| 1328 | - map.put("date", date); | |
| 1329 | - map.put("totalZGL", totalZGL); | |
| 1330 | - map.put("totalKSGL", totalKSGL); | |
| 1331 | - map.put("totalYH", totalYH); | |
| 1332 | - map.put("totalBCS", totalBCS); | |
| 1333 | - | |
| 1334 | - String path = this.getClass().getResource("/").getPath() + "static/pages/forms/"; | |
| 1335 | - | |
| 1336 | - listI.add(list.iterator()); | |
| 1337 | - try { | |
| 1338 | - ee.excelReplace(listI, new Object[]{map}, path + "mould/daily.xls", | |
| 1339 | - path + "export/班次日报" + sdfSimple.format(sdfMonth.parse(date)) + ".xls"); | |
| 1340 | - } catch (ParseException e) { | |
| 1341 | - e.printStackTrace(); | |
| 1342 | - } | |
| 1343 | - } | |
| 1344 | - return list; | |
| 1345 | - } | |
| 1346 | - | |
| 1347 | - @Override | |
| 1348 | - public List<Object[]> historyMessage(String line, String date, String code, String type) { | |
| 1349 | - SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); | |
| 1350 | - | |
| 1351 | - long d = 0; | |
| 1352 | - long t = 0; | |
| 1353 | - if (date.length() > 0) { | |
| 1354 | - try { | |
| 1355 | - d = sdf.parse(date + " 00:00:00").getTime(); | |
| 1356 | - t = sdf.parse(date + " 23:59:59").getTime(); | |
| 1357 | - } catch (ParseException e) { | |
| 1358 | - // TODO Auto-generated catch block | |
| 1359 | - e.printStackTrace(); | |
| 1360 | - } | |
| 1361 | - | |
| 1362 | - } | |
| 1363 | - String device = ""; | |
| 1364 | - String device2 =""; | |
| 1365 | - long qyrqTime=0l; | |
| 1366 | - if (!code.equals("")) { | |
| 1367 | - try { | |
| 1368 | - List<CarDevice> deviceList=carDeviceRepository.findCarCode(code, sdf.parse(date+ " 00:00:00")); | |
| 1369 | - if(deviceList.size()>0){ | |
| 1370 | - device=deviceList.get(0).getOldDeviceNo(); | |
| 1371 | - Date qyrq=deviceList.get(0).getQyrq(); | |
| 1372 | - qyrqTime=qyrq.getTime(); | |
| 1373 | - if(qyrqTime<t){ | |
| 1374 | - device2=deviceList.get(0).getNewDeviceNo(); | |
| 1375 | - } | |
| 1376 | - }else{ | |
| 1377 | - device = BasicData.deviceId2NbbmMap.inverse().get(code); | |
| 1378 | - } | |
| 1379 | - } catch (ParseException e) { | |
| 1380 | - // TODO Auto-generated catch block | |
| 1381 | - e.printStackTrace(); | |
| 1382 | - } | |
| 1383 | - } | |
| 1384 | - List<Object[]> list=new ArrayList<Object[]>(); | |
| 1385 | - | |
| 1386 | - device = device.replaceAll("BF-", ""); | |
| 1387 | - List<Object[]> list0 =scheduleRealInfoRepository.historyMessage(line, device, d, t); | |
| 1388 | - for (Object[] obj : list0) { | |
| 1389 | - if (obj != null) { | |
| 1390 | - if(code.equals("")){ | |
| 1391 | - if (BasicData.deviceId2NbbmMap.get(obj[0].toString()) == null) { | |
| 1392 | - List<CarDevice> carDeviceList = new ArrayList<CarDevice>(); | |
| 1393 | - try { | |
| 1394 | - carDeviceList = carDeviceRepository.findCarDevice(obj[0].toString(), new Date(Long.parseLong(obj[3].toString()))); | |
| 1395 | - //启用日期大于营运日期 还是根据旧设备号查询 | |
| 1396 | - if(carDeviceList.size()==0){ | |
| 1397 | - carDeviceList = carDeviceRepository.findCarOldDevice(obj[0].toString(), new Date(Long.parseLong(obj[3].toString()))); | |
| 1398 | - } | |
| 1399 | - } catch (Exception e) { | |
| 1400 | - // TODO Auto-generated catch block | |
| 1401 | - e.printStackTrace(); | |
| 1402 | - } | |
| 1403 | - if (carDeviceList.size() > 0) { | |
| 1404 | - obj[0] = carDeviceList.get(0).getClZbh(); | |
| 1405 | - } else { | |
| 1406 | - obj[0] = BasicData.deviceId2NbbmMap.get(obj[0].toString()); | |
| 1407 | - } | |
| 1408 | - } else { | |
| 1409 | - obj[0] = BasicData.deviceId2NbbmMap.get(obj[0].toString()); | |
| 1410 | - } | |
| 1411 | - }else{ | |
| 1412 | - obj[0]=code; | |
| 1413 | - } | |
| 1414 | - | |
| 1415 | - obj[3] = sdf.format(new Date(Long.parseLong(obj[3].toString()))); | |
| 1416 | - obj[4] = BasicData.lineCode2NameMap.get(line); | |
| 1417 | - } | |
| 1418 | - } | |
| 1419 | - list.addAll(list0); | |
| 1420 | - if(!device2.equals("")){ | |
| 1421 | - device2.replaceAll("BF-", ""); | |
| 1422 | - List<Object[]> list1 =scheduleRealInfoRepository.historyMessage(line, device2, d, t); | |
| 1423 | - for (Object[] obj : list1) { | |
| 1424 | - if (obj != null) { | |
| 1425 | - obj[0] =code; | |
| 1426 | - obj[3] = sdf.format(new Date(Long.parseLong(obj[3].toString()))); | |
| 1427 | - obj[4] = BasicData.lineCode2NameMap.get(line); | |
| 1428 | - } | |
| 1429 | - } | |
| 1430 | - list.addAll(list1); | |
| 1431 | - } | |
| 1432 | - | |
| 1433 | - if (type != null && type.length() != 0 && type.equals("export")) { | |
| 1434 | - String lineName = BasicData.lineCode2NameMap.get(line); | |
| 1435 | - SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"), | |
| 1436 | - sdfSimple = new SimpleDateFormat("yyyyMMdd"); | |
| 1437 | - List<Iterator<?>> listI = new ArrayList<Iterator<?>>(); | |
| 1438 | - Map<String, Object> m = new HashMap<String, Object>(); | |
| 1439 | - ReportUtils ee = new ReportUtils(); | |
| 1440 | - List<Map<String, Object>> newList = new ArrayList<Map<String, Object>>(); | |
| 1441 | - for (int i = 0; i < list.size(); i++) { | |
| 1442 | - Map<String, Object> map = new HashMap<String, Object>(); | |
| 1443 | - Object[] obj = list.get(i); | |
| 1444 | - map.put("num", i + 1); | |
| 1445 | - map.put("line", obj[4]); | |
| 1446 | - map.put("clZbh", obj[0]); | |
| 1447 | - map.put("sender", obj[1]); | |
| 1448 | - map.put("date", obj[3]); | |
| 1449 | - map.put("text", obj[2]); | |
| 1450 | - map.put("reply46", "0".equals(obj[5]+"")?"是":""); | |
| 1451 | - map.put("reply47", "0".equals(obj[6]+"")?"是":""); | |
| 1452 | - newList.add(map); | |
| 1453 | - } | |
| 1454 | - try { | |
| 1455 | - listI.add(newList.iterator()); | |
| 1456 | - String path = this.getClass().getResource("/").getPath() + "static/pages/forms/"; | |
| 1457 | - ee.excelReplace(listI, new Object[]{m}, path + "mould/historyMessage.xls", | |
| 1458 | - path + "export/" + sdfSimple.format(sdfMonth.parse(date)) | |
| 1459 | - + "-" + lineName + "-调度历史消息.xls"); | |
| 1460 | - } catch (Exception e) { | |
| 1461 | - // TODO: handle exception | |
| 1462 | - e.printStackTrace(); | |
| 1463 | - } | |
| 1464 | - } | |
| 1465 | - | |
| 1466 | - if (type != null && type.length() != 0 && type.equals("export_msg")) { | |
| 1467 | - SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"), | |
| 1468 | - sdfSimple = new SimpleDateFormat("yyyyMMdd"); | |
| 1469 | - List<Iterator<?>> listI = new ArrayList<Iterator<?>>(); | |
| 1470 | - Map<String, Object> m = new HashMap<String, Object>(); | |
| 1471 | - ReportUtils ee = new ReportUtils(); | |
| 1472 | - List<Map<String, Object>> newList = new ArrayList<Map<String, Object>>(); | |
| 1473 | - for (int i = 0; i < list.size(); i++) { | |
| 1474 | - Map<String, Object> map = new HashMap<String, Object>(); | |
| 1475 | - Object[] obj = list.get(i); | |
| 1476 | - map.put("num", i + 1); | |
| 1477 | - map.put("line", obj[4]); | |
| 1478 | - map.put("clZbh", obj[0]); | |
| 1479 | - map.put("sender", obj[1]); | |
| 1480 | - map.put("date", obj[3]); | |
| 1481 | - map.put("text", obj[2]); | |
| 1482 | - newList.add(map); | |
| 1483 | - } | |
| 1484 | - try { | |
| 1485 | - listI.add(newList.iterator()); | |
| 1486 | - String path = this.getClass().getResource("/").getPath() + "static/pages/forms/"; | |
| 1487 | - ee.excelReplace(listI, new Object[]{m}, path + "mould/message.xls", | |
| 1488 | - path + "export/调度消息分析" + sdfSimple.format(sdfMonth.parse(date)) + ".xls"); | |
| 1489 | - } catch (Exception e) { | |
| 1490 | - // TODO: handle exception | |
| 1491 | - e.printStackTrace(); | |
| 1492 | - } | |
| 1493 | - } | |
| 1494 | - return list; | |
| 1495 | - } | |
| 1496 | - | |
| 1497 | - @Override | |
| 1498 | - public Map<Integer, Integer> trustStatus(String lineStr) { | |
| 1499 | - List<String> lineList = Lists.newArrayList(Splitter.on(',').trimResults().omitEmptyStrings().split(lineStr)); | |
| 1500 | - | |
| 1501 | - Map<Integer, Integer> map = new HashMap<>(); | |
| 1502 | - return map; | |
| 1503 | - } | |
| 1504 | - | |
| 1505 | - @Override | |
| 1506 | - public Map<String, Object> realOutAdjust(Map<String, String> map) { | |
| 1507 | - Map<String, Object> rs = new HashMap<>(); | |
| 1508 | - List<ScheduleRealInfo> ts = new ArrayList<>(); | |
| 1509 | - try { | |
| 1510 | - // 维修上报 | |
| 1511 | - if (StringUtils.isNotBlank(map.get("reportTypes"))) { | |
| 1512 | - Map<String, Object> param = new HashMap<String, Object>(); | |
| 1513 | - param.putAll(map); | |
| 1514 | - rs = repairReport(param, false); | |
| 1515 | - } | |
| 1516 | - | |
| 1517 | - Long id = Long.parseLong(map.get("id")); | |
| 1518 | - String remarks = map.get("remarks"), fcsjActual = map.get("fcsjActual"); | |
| 1519 | - | |
| 1520 | - ScheduleRealInfo sch = dayOfSchedule.get(id); | |
| 1521 | - | |
| 1522 | - LineConfig config = lineConfigData.get(sch.getXlBm()); | |
| 1523 | - //小于线路开始运营时间,则默认跨过24点 | |
| 1524 | - if (fcsjActual.compareTo(config.getStartOpt()) < 0) { | |
| 1525 | - sch.setRealExecDate(fmtyyyyMMdd.print(sch.getScheduleDate().getTime() + DAY_TIME)); | |
| 1526 | - } else { | |
| 1527 | - sch.setRealExecDate(sch.getScheduleDateStr()); | |
| 1528 | - } | |
| 1529 | - | |
| 1530 | - //日志记录 | |
| 1531 | - ScheduleModifyLogger.sftz(sch, fcsjActual, remarks); | |
| 1532 | - | |
| 1533 | - sch.setFcsjActualAll(fcsjActual); | |
| 1534 | - sch.setRemarks(remarks); | |
| 1535 | - sch.calcStatus(); | |
| 1536 | - //if(sch.isLate2()){ | |
| 1537 | - //取消应发未到标记 | |
| 1538 | - // sch.setLate2(false); | |
| 1539 | - LateAdjustHandle.remove(sch); | |
| 1540 | - //} | |
| 1541 | - | |
| 1542 | - dayOfSchedule.save(sch); | |
| 1543 | - | |
| 1544 | - ts.add(sch); | |
| 1545 | - | |
| 1546 | - rs.put("status", ResponseCode.SUCCESS); | |
| 1547 | - rs.put("ts", ts); | |
| 1548 | - | |
| 1549 | - //通知页面刷新 | |
| 1550 | - sendUtils.refreshSch(ts); | |
| 1551 | - } catch (Exception e) { | |
| 1552 | - logger.error("", e); | |
| 1553 | - rs.put("status", ResponseCode.ERROR); | |
| 1554 | - } | |
| 1555 | - | |
| 1556 | - return rs; | |
| 1557 | - } | |
| 1558 | - | |
| 1559 | - @Override | |
| 1560 | - public Map<String, Object> revokeDestroy(Long id) { | |
| 1561 | - Map<String, Object> rs = new HashMap<>(); | |
| 1562 | - try { | |
| 1563 | - ScheduleRealInfo sch = dayOfSchedule.get(id); | |
| 1564 | - if (sch.getStatus() != -1) { | |
| 1565 | - rs.put("status", ResponseCode.ERROR); | |
| 1566 | - rs.put("msg", "未烂班,无法撤销!"); | |
| 1567 | - } else { | |
| 1568 | - //日志记录 | |
| 1569 | - ScheduleModifyLogger.cxlb(sch); | |
| 1570 | - | |
| 1571 | - sch.setStatus(0); | |
| 1572 | - sch.setRemarks("");//清空备注 | |
| 1573 | - sch.setJhlc(sch.getJhlcOrig()); | |
| 1574 | - | |
| 1575 | - //入库 | |
| 1576 | - dayOfSchedule.save(sch); | |
| 1577 | - //重新计算当前执行班次 | |
| 1578 | - dayOfSchedule.reCalcExecPlan(sch.getClZbh()); | |
| 1579 | - rs.put("status", ResponseCode.SUCCESS); | |
| 1580 | - rs.put("t", sch); | |
| 1581 | - | |
| 1582 | - } | |
| 1583 | - } catch (Exception e) { | |
| 1584 | - logger.error("", e); | |
| 1585 | - rs.put("status", ResponseCode.ERROR); | |
| 1586 | - } | |
| 1587 | - return rs; | |
| 1588 | - } | |
| 1589 | - | |
| 1590 | - @Override | |
| 1591 | - public Map<String, Object> revokeRealOutgo(Long id) { | |
| 1592 | - Map<String, Object> rs = new HashMap<>(); | |
| 1593 | - List<ScheduleRealInfo> ts = new ArrayList<>(); | |
| 1594 | - | |
| 1595 | - try { | |
| 1596 | - ScheduleRealInfo sch = dayOfSchedule.get(id); | |
| 1597 | - if (sch.getFcsjActual() == null) { | |
| 1598 | - rs.put("status", ResponseCode.ERROR); | |
| 1599 | - rs.put("msg", "无实发时间,无法撤销!"); | |
| 1600 | - } else { | |
| 1601 | - //日志记录 | |
| 1602 | - ScheduleModifyLogger.cxsf(sch); | |
| 1603 | - | |
| 1604 | - sch.clearFcsjActual(); | |
| 1605 | - rs.put("status", ResponseCode.SUCCESS); | |
| 1606 | - | |
| 1607 | - ts.add(sch); | |
| 1608 | - rs.put("ts", ts); | |
| 1609 | - | |
| 1610 | - dayOfSchedule.save(sch); | |
| 1611 | - | |
| 1612 | - } | |
| 1613 | - } catch (Exception e) { | |
| 1614 | - logger.error("", e); | |
| 1615 | - rs.put("status", ResponseCode.ERROR); | |
| 1616 | - } | |
| 1617 | - return rs; | |
| 1618 | - } | |
| 1619 | - | |
| 1620 | - @Override | |
| 1621 | - public Map<String, Object> spaceAdjust(Long[] ids, Integer space) { | |
| 1622 | - | |
| 1623 | - List<ScheduleRealInfo> list = new ArrayList<>(), ts = new ArrayList<>(), tempTs = null; | |
| 1624 | - Map<String, Object> rs = new HashMap<>(), tempRs = new HashMap<>(); | |
| 1625 | - try { | |
| 1626 | - ScheduleRealInfo sch, next; | |
| 1627 | - for (Long id : ids) { | |
| 1628 | - sch = dayOfSchedule.get(id); | |
| 1629 | - if (null != sch) | |
| 1630 | - list.add(sch); | |
| 1631 | - } | |
| 1632 | - | |
| 1633 | - int size = list.size(); | |
| 1634 | - if (size == 0) { | |
| 1635 | - rs.put("status", ResponseCode.ERROR); | |
| 1636 | - } else { | |
| 1637 | - // 按发车时间排序 | |
| 1638 | - Collections.sort(list, new ScheduleComparator.FCSJ()); | |
| 1639 | - | |
| 1640 | - // 以第一个实际发车/待发时间为起点,调整间隔 | |
| 1641 | - sch = list.get(0); | |
| 1642 | - Long st = sch.getFcsjActualTime() == null ? sch.getDfsjT() : sch.getFcsjActualTime(), plus = space * 60 * 1000L; | |
| 1643 | - | |
| 1644 | - for (int i = 1; i < size; i++) { | |
| 1645 | - st += plus; | |
| 1646 | - sch = list.get(i); | |
| 1647 | - | |
| 1648 | - //调整待发 | |
| 1649 | - tempRs = outgoAdjust(sch.getId(), null, fmtHHmm.print(st), null, "3", null); | |
| 1650 | - | |
| 1651 | - if (null != tempRs && tempRs.get("ts") != null) | |
| 1652 | - tempTs = (List<ScheduleRealInfo>) tempRs.get("ts"); | |
| 1653 | - | |
| 1654 | - ts.addAll(tempTs); | |
| 1655 | - } | |
| 1656 | - | |
| 1657 | - rs.put("status", ResponseCode.SUCCESS); | |
| 1658 | - //返回最后一个班次,页面会全量刷新 | |
| 1659 | - rs.put("ts", ts); | |
| 1660 | - } | |
| 1661 | - | |
| 1662 | - } catch (Exception e) { | |
| 1663 | - logger.error("", e); | |
| 1664 | - rs.put("status", ResponseCode.ERROR); | |
| 1665 | - } | |
| 1666 | - return rs; | |
| 1667 | - } | |
| 1668 | - | |
| 1669 | - private static DateTimeFormatter fmtyyyyMMddHHmm = DateTimeFormat.forPattern("yyyy-MM-ddHH:mm"); | |
| 1670 | - | |
| 1671 | - @Transactional | |
| 1672 | - @Override | |
| 1673 | - public Map<String, Object> schInfoFineTune(Map<String, String> map) { | |
| 1674 | - Map<String, Object> rs = new HashMap<>(); | |
| 1675 | - List<ScheduleRealInfo> ts = new ArrayList<>(); | |
| 1676 | - try { | |
| 1677 | - // 维修上报 | |
| 1678 | - if (StringUtils.isNotBlank(map.get("reportTypes"))) { | |
| 1679 | - Map<String, Object> param = new HashMap<String, Object>(); | |
| 1680 | - param.putAll(map); | |
| 1681 | - rs = repairReport(param, false); | |
| 1682 | - } | |
| 1683 | - | |
| 1684 | - Long id = Long.parseLong(map.get("id")); | |
| 1685 | - String remarks = map.get("remarks"); | |
| 1686 | - | |
| 1687 | - ScheduleRealInfo sch = dayOfSchedule.get(id); | |
| 1688 | - | |
| 1689 | - if (null == sch) { | |
| 1690 | - rs.put("status", ResponseCode.ERROR); | |
| 1691 | - rs.put("msg", "不存在的班次!"); | |
| 1692 | - return rs; | |
| 1693 | - } | |
| 1694 | - | |
| 1695 | - //日志记录器 | |
| 1696 | - FcxxwtLogger fLog = FcxxwtLogger.start(sch, remarks); | |
| 1697 | - | |
| 1698 | - String clZbh = map.get("clZbh"); | |
| 1699 | - String jsy = map.get("jsy"); | |
| 1700 | - if (!clZbh.equals(sch.getClZbh()) | |
| 1701 | - || !jsy.equals(sch.getjGh() + "/" + sch.getjName())) | |
| 1702 | - schModifyLog.saveChangetochange(sch, clZbh, jsy);//为换人换车情况表写入数据 | |
| 1703 | - /** | |
| 1704 | - * 换车 | |
| 1705 | - */ | |
| 1706 | - if (StringUtils.isNotEmpty(clZbh) && !clZbh.equals(sch.getClZbh())) { | |
| 1707 | - //换车 | |
| 1708 | - if (!carExist(sch.getGsBm(), clZbh)) { | |
| 1709 | - rs.put("status", ResponseCode.ERROR); | |
| 1710 | - rs.put("msg", "车辆 " + clZbh + " 不存在!"); | |
| 1711 | - return rs; | |
| 1712 | - } else if (!sch.getGsBm().equals(BasicData.nbbm2CompanyCodeMap.get(clZbh))) { | |
| 1713 | - rs.put("status", ResponseCode.ERROR); | |
| 1714 | - rs.put("msg", sch.getXlName() + "所属的公司编码下找不到自编号为【" + clZbh + "】的车辆"); | |
| 1715 | - return rs; | |
| 1716 | - } else { | |
| 1717 | - fLog.log("换车", sch.getClZbh(), clZbh); | |
| 1718 | - dayOfSchedule.changeCar(sch, clZbh); | |
| 1719 | - } | |
| 1720 | - } | |
| 1721 | - | |
| 1722 | - if(StringUtils.isBlank(jsy) || "/".equals(StringUtils.trim(jsy))){ | |
| 1723 | - rs.put("status", ResponseCode.ERROR); | |
| 1724 | - rs.put("msg", "无效的参数【驾驶员】"); | |
| 1725 | - return rs; | |
| 1726 | - } | |
| 1727 | - | |
| 1728 | - /** | |
| 1729 | - * 换驾驶员 | |
| 1730 | - */ | |
| 1731 | - if (StringUtils.isNotEmpty(jsy)) { | |
| 1732 | - String jGh = jsy.split("/")[0]; | |
| 1733 | - String jName = getPersonName(sch.getGsBm(), jGh); | |
| 1734 | - if (StringUtils.isEmpty(jName)) { | |
| 1735 | - rs.put("msg", sch.getXlName() + "所属的公司编码下找不到工号为【" + jGh + "】的驾驶员"); | |
| 1736 | - rs.put("status", ResponseCode.ERROR); | |
| 1737 | - return rs; | |
| 1738 | - } else if (!jGh.equals(sch.getjGh())) { | |
| 1739 | - fLog.log("换驾驶员", sch.getjGh() + "/" + sch.getjName(), jsy); | |
| 1740 | - persoChange(sch, jGh); | |
| 1741 | - } | |
| 1742 | - } | |
| 1743 | - | |
| 1744 | - /** | |
| 1745 | - * 换售票员 | |
| 1746 | - */ | |
| 1747 | - String spy = map.get("spy"); | |
| 1748 | - if (StringUtils.isNotEmpty(spy) && !StringUtils.trim(spy).equals("/")) { | |
| 1749 | - String sGh = spy.split("/")[0]; | |
| 1750 | - | |
| 1751 | - String sName = getPersonName(sch.getGsBm(), sGh); | |
| 1752 | - if (StringUtils.isEmpty(sName)) { | |
| 1753 | - rs.put("msg", sch.getXlName() + "所属的公司编码下找不到工号为【" + sGh + "】的售票员"); | |
| 1754 | - rs.put("status", ResponseCode.ERROR); | |
| 1755 | - return rs; | |
| 1756 | - } else if (!sGh.equals(sch.getsGh())) { | |
| 1757 | - fLog.log("换售票员", sch.getsGh() + "/" + sch.getsName(), spy); | |
| 1758 | - persoChangeSPY(sch, sGh); | |
| 1759 | - } | |
| 1760 | - } else if (StringUtils.isNotEmpty(sch.getsGh())) { | |
| 1761 | - fLog.log("撤销售票员"); | |
| 1762 | - sch.setsGh(""); | |
| 1763 | - sch.setsName(""); | |
| 1764 | - } | |
| 1765 | - | |
| 1766 | - LineConfig config = lineConfigData.get(sch.getXlBm()); | |
| 1767 | - /** | |
| 1768 | - * 调整实发 | |
| 1769 | - */ | |
| 1770 | - String fcsjActual = map.get("fcsjActual"); | |
| 1771 | - if (StringUtils.isNotBlank(fcsjActual) | |
| 1772 | - && !fcsjActual.equals(sch.getFcsjActual())) { | |
| 1773 | - | |
| 1774 | - //long t = 0L; | |
| 1775 | - //小于线路开始运营时间,则默认跨过24点 | |
| 1776 | - long t = schAttrCalculator.getTime(sch.getScheduleDateStr(), fcsjActual, config); | |
| 1777 | - /* if (fcsjActual.compareTo(config.getStartOpt()) < 0) | |
| 1778 | - t = fmtyyyyMMddHHmm.parseMillis(fmtyyyyMMdd.print(sch.getScheduleDate().getTime() + DAY_TIME) + fcsjActual); | |
| 1779 | - else | |
| 1780 | - t = fmtyyyyMMddHHmm.parseMillis(sch.getScheduleDateStr() + fcsjActual);*/ | |
| 1781 | - | |
| 1782 | - fLog.log("调整实发时间", sch.getFcsjActual(), fcsjActual); | |
| 1783 | - sch.setFcsjActualAll(t); | |
| 1784 | - //取消应发未到标记 | |
| 1785 | - //if(sch.isLate2()){ | |
| 1786 | - // sch.setLate2(false); | |
| 1787 | - LateAdjustHandle.remove(sch); | |
| 1788 | - //} | |
| 1789 | - } else if (StringUtils.isNotEmpty(sch.getFcsjActual()) && StringUtils.isEmpty(fcsjActual)) { | |
| 1790 | - fLog.log("撤销实发时间", sch.getFcsjActual(), ""); | |
| 1791 | - //撤销实发 | |
| 1792 | - revokeRealOutgo(sch.getId()); | |
| 1793 | - } | |
| 1794 | - | |
| 1795 | - /** | |
| 1796 | - * 调整实达 | |
| 1797 | - */ | |
| 1798 | - String zdsjActual = map.get("zdsjActual"); | |
| 1799 | - if (StringUtils.isNotBlank(zdsjActual) | |
| 1800 | - && !zdsjActual.equals(sch.getZdsjActual())) { | |
| 1801 | - | |
| 1802 | - //调整实达 | |
| 1803 | - fLog.log("调整实达时间", sch.getZdsjActual(), zdsjActual); | |
| 1804 | - | |
| 1805 | - long t = schAttrCalculator.getTime(sch.getScheduleDateStr(), zdsjActual, config); | |
| 1806 | - sch.setZdsjActualAll(t); | |
| 1807 | - //路牌下一班起点到达时间 | |
| 1808 | - ScheduleRealInfo next = dayOfSchedule.nextByLp2(sch); | |
| 1809 | - if (null != next) { | |
| 1810 | - next.setQdzArrDatesj(zdsjActual); | |
| 1811 | - next.setLate2(false); | |
| 1812 | - ts.add(next); | |
| 1813 | - } | |
| 1814 | - | |
| 1815 | - //重新计算车辆执行班次 | |
| 1816 | - dayOfSchedule.reCalcExecPlan(sch.getClZbh()); | |
| 1817 | - //取消应发未到标记 | |
| 1818 | - LateAdjustHandle.remove(sch); | |
| 1819 | - } else if (StringUtils.isNotEmpty(sch.getZdsjActual()) && StringUtils.isEmpty(zdsjActual)) { | |
| 1820 | - //清除实达时间 | |
| 1821 | - fLog.log("撤销实达时间", sch.getZdsjActual(), ""); | |
| 1822 | - sch.clearZdsjActual(); | |
| 1823 | - //清除路牌下一班起点到达时间 | |
| 1824 | - ScheduleRealInfo next = dayOfSchedule.nextByLp(sch); | |
| 1825 | - if (null != next) { | |
| 1826 | - next.setQdzArrDatesj(null); | |
| 1827 | - ts.add(next); | |
| 1828 | - } | |
| 1829 | - //重新计算车辆执行班次 | |
| 1830 | - dayOfSchedule.reCalcExecPlan(sch.getClZbh()); | |
| 1831 | - } | |
| 1832 | - | |
| 1833 | - /** | |
| 1834 | - * 备注 | |
| 1835 | - */ | |
| 1836 | - sch.setRemarks(remarks); | |
| 1837 | - | |
| 1838 | - /** | |
| 1839 | - * 烂班 | |
| 1840 | - */ | |
| 1841 | - if (map.get("status") != null | |
| 1842 | - && Integer.parseInt(map.get("status").toString()) == -1) { | |
| 1843 | - destroy(sch.getId() + "", "", map.get("adjustExps").toString(), null); | |
| 1844 | - fLog.log("烂班"); | |
| 1845 | - } | |
| 1846 | - | |
| 1847 | - /** | |
| 1848 | - * 修改班次里程 | |
| 1849 | - */ | |
| 1850 | - String jhlc = map.get("jhlc"); | |
| 1851 | - if (StringUtils.isNotEmpty(jhlc)) { | |
| 1852 | - double jhlcNum = Double.parseDouble(jhlc); | |
| 1853 | - //烂班 | |
| 1854 | - if (jhlcNum == 0 && sch.getJhlcOrig() != 0 && !sch._isInout() && !sch.isDestroy()) { | |
| 1855 | - destroy(sch.getId() + "", "", map.get("adjustExps").toString(), null); | |
| 1856 | - fLog.log("里程设置为0,自动烂班"); | |
| 1857 | - } else if (jhlcNum != sch.getJhlc()) { | |
| 1858 | - fLog.log("设置里程", sch.getJhlc(), jhlcNum); | |
| 1859 | - sch.setJhlc(jhlcNum); | |
| 1860 | - //临加班次,实际计划一起改 | |
| 1861 | - if (sch.isSflj()) | |
| 1862 | - sch.setJhlcOrig(jhlcNum); | |
| 1863 | - } | |
| 1864 | - } | |
| 1865 | - | |
| 1866 | - /** | |
| 1867 | - * 修改班次类型 | |
| 1868 | - */ | |
| 1869 | - String bcType = map.get("bcType"); | |
| 1870 | - if (StringUtils.isNotEmpty(bcType) && !bcType.equals(sch.getBcType())) { | |
| 1871 | - fLog.log("修改班次类型", sch.getBcType(), bcType); | |
| 1872 | - sch.setBcType(bcType); | |
| 1873 | - } | |
| 1874 | - | |
| 1875 | - //重新计算班次状态 | |
| 1876 | - sch.calcStatus(); | |
| 1877 | - dayOfSchedule.save(sch); | |
| 1878 | - //页面需要更新的班次信息 | |
| 1879 | - ts.add(sch); | |
| 1880 | - | |
| 1881 | - rs.put("status", ResponseCode.SUCCESS); | |
| 1882 | - rs.put("ts", ts); | |
| 1883 | - | |
| 1884 | - //日志记录结束 | |
| 1885 | - fLog.end(); | |
| 1886 | - } catch (Exception e) { | |
| 1887 | - logger.error("", e); | |
| 1888 | - rs.put("status", ResponseCode.ERROR); | |
| 1889 | - } | |
| 1890 | - return rs; | |
| 1891 | - } | |
| 1892 | - | |
| 1893 | - @Override | |
| 1894 | - public Map<String, Object> outgoAdjustAll(String params) { | |
| 1895 | - Map<String, Object> rs = new HashMap<>(); | |
| 1896 | - try { | |
| 1897 | - JSONArray jsonArray = JSONArray.parseArray(params); | |
| 1898 | - | |
| 1899 | - ScheduleRealInfo schedule = null; | |
| 1900 | - JSONObject jsonObj; | |
| 1901 | - String dfsj; | |
| 1902 | - long id; | |
| 1903 | - for (int i = 0; i < jsonArray.size(); i++) { | |
| 1904 | - jsonObj = jsonArray.getJSONObject(i); | |
| 1905 | - dfsj = jsonObj.getString("t"); | |
| 1906 | - id = jsonObj.getLong("id"); | |
| 1907 | - schedule = dayOfSchedule.get(id); | |
| 1908 | - | |
| 1909 | - if (schedule != null) | |
| 1910 | - outgoAdjust(id, null, dfsj, null, "2", null); | |
| 1911 | - } | |
| 1912 | - | |
| 1913 | - rs.put("status", ResponseCode.SUCCESS); | |
| 1914 | - //将更新的最后一个班次返回,页面会做全量刷新 | |
| 1915 | - rs.put("t", schedule); | |
| 1916 | - } catch (Exception e) { | |
| 1917 | - logger.error("", e); | |
| 1918 | - rs.put("status", ResponseCode.ERROR); | |
| 1919 | - } | |
| 1920 | - return rs; | |
| 1921 | - } | |
| 1922 | - | |
| 1923 | - @Override | |
| 1924 | - public Map<String, Object> findRouteByLine(String lineCode) { | |
| 1925 | - Map<String, Object> map = new HashMap<>(); | |
| 1926 | - //上行 | |
| 1927 | - Integer lineId = BasicData.lineId2CodeMap.inverse().get(lineCode); | |
| 1928 | - map.put("line.id_eq", lineId); | |
| 1929 | - map.put("directions_eq", 0); | |
| 1930 | - List<Map<String, Object>> upList = sectionRouteService.getSectionRoute(map); | |
| 1931 | - | |
| 1932 | - //下行 | |
| 1933 | - map.put("directions_eq", 1); | |
| 1934 | - List<Map<String, Object>> downList = sectionRouteService.getSectionRoute(map); | |
| 1935 | - | |
| 1936 | - Map<String, Object> rs = new HashMap<>(); | |
| 1937 | - | |
| 1938 | - String upVectors = "", vec; | |
| 1939 | - //拼接上行路段 | |
| 1940 | - for (Map<String, Object> temp : upList) { | |
| 1941 | - vec = temp.get("sectionBsectionVector").toString(); | |
| 1942 | - upVectors += vec.subSequence(11, vec.length() - 2) + " "; | |
| 1943 | - } | |
| 1944 | - | |
| 1945 | - //拼接下行路段 | |
| 1946 | - String downVectors = ""; | |
| 1947 | - for (Map<String, Object> temp : downList) {//LINESTRING( | |
| 1948 | - vec = temp.get("sectionBsectionVector").toString(); | |
| 1949 | - downVectors += vec.subSequence(11, vec.length() - 2) + " "; | |
| 1950 | - } | |
| 1951 | - | |
| 1952 | - | |
| 1953 | - rs.put("up", upVectors); | |
| 1954 | - //上行gcj | |
| 1955 | - rs.put("up_gcj", BdToGcjString(upVectors)); | |
| 1956 | - rs.put("down", downVectors); | |
| 1957 | - //下行gcj | |
| 1958 | - rs.put("down_gcj", BdToGcjString(downVectors)); | |
| 1959 | - rs.put("lineId", lineId); | |
| 1960 | - | |
| 1961 | - return rs; | |
| 1962 | - } | |
| 1963 | - | |
| 1964 | - /** | |
| 1965 | - * @param @param bdStr | |
| 1966 | - * @throws | |
| 1967 | - * @Title: BdToGcjString | |
| 1968 | - * @Description: TODO(将百度路由字符串 转 成GCJ 字符串) | |
| 1969 | - */ | |
| 1970 | - public String BdToGcjString(String bdStr) { | |
| 1971 | - String[] array = bdStr.split(","), subArray; | |
| 1972 | - if (array.length == 0 || bdStr.length() < 2) | |
| 1973 | - return ""; | |
| 1974 | - | |
| 1975 | - String gcjStr = ""; | |
| 1976 | - CoordinateConverter.Location location; | |
| 1977 | - for (String crd : array) { | |
| 1978 | - subArray = crd.split(" "); | |
| 1979 | - if (subArray.length != 2) | |
| 1980 | - continue; | |
| 1981 | - location = CoordinateConverter.bd_decrypt(CoordinateConverter.LocationMake(Double.parseDouble(subArray[0]), Double.parseDouble(subArray[1]))); | |
| 1982 | - | |
| 1983 | - gcjStr += location.getLng() + " " + location.getLat() + ","; | |
| 1984 | - } | |
| 1985 | - | |
| 1986 | - return gcjStr.substring(0, gcjStr.length() - 1); | |
| 1987 | - } | |
| 1988 | - | |
| 1989 | - public List<Map<String, String>> findLine(String line) { | |
| 1990 | - List<Line> listLine = lineRepository.findLine("%" + line + "%"); | |
| 1991 | - List<Map<String, String>> list = new ArrayList<Map<String, String>>(); | |
| 1992 | - Map<String, String> map; | |
| 1993 | - for (Line temp : listLine) { | |
| 1994 | - if (temp != null) { | |
| 1995 | - String xlName = temp.getName(); | |
| 1996 | - if (xlName.indexOf(line) != -1) { | |
| 1997 | - map = new HashMap<String, String>(); | |
| 1998 | - map.put("id", temp.getLineCode()); | |
| 1999 | - map.put("text", xlName); | |
| 2000 | - list.add(map); | |
| 2001 | - } | |
| 2002 | - } | |
| 2003 | - } | |
| 2004 | - return list; | |
| 2005 | - } | |
| 2006 | - | |
| 2007 | - public List<Map<String, String>> findLpName(String lpName) { | |
| 2008 | - List<GuideboardInfo> listLpName = guideboardInfoRepository.findLpName("%" + lpName + "%"); | |
| 2009 | - List<Map<String, String>> list = new ArrayList<Map<String, String>>(); | |
| 2010 | - Map<String, String> map; | |
| 2011 | - for (GuideboardInfo temp : listLpName) { | |
| 2012 | - if (temp != null) { | |
| 2013 | - String lp = temp.getLpName(); | |
| 2014 | - if (lp.indexOf(lpName) != -1) { | |
| 2015 | - map = new HashMap<String, String>(); | |
| 2016 | - map.put("id", lp); | |
| 2017 | - map.put("text", lp); | |
| 2018 | - list.add(map); | |
| 2019 | - } | |
| 2020 | - } | |
| 2021 | - } | |
| 2022 | - return list; | |
| 2023 | - } | |
| 2024 | - | |
| 2025 | - @Override | |
| 2026 | - public Map<String, Object> findKMBC2(String jName, String clZbh, String date) { | |
| 2027 | - List<ScheduleRealInfo> list = scheduleRealInfoRepository.queryListWaybill3(jName, clZbh, date, "", ""); | |
| 2028 | - | |
| 2029 | - DecimalFormat format = new DecimalFormat("0.00"); | |
| 2030 | -// int cjbc = scheduleRealInfoRepository.findCjbc(jName, clZbh, lpName); | |
| 2031 | -// int ljbc = scheduleRealInfoRepository.findLjbc(jName, clZbh, lpName); | |
| 2032 | - int jhbc = 0, cjbc = 0, ljbc = 0; | |
| 2033 | - double jhlc = 0, yygl = 0, ksgl = 0, tempJhlc = 0; | |
| 2034 | - float addMileage = 0l, remMileage = 0l; | |
| 2035 | - String j_Name = ""; | |
| 2036 | - Map<String, Object> map = new HashMap<String, Object>(); | |
| 2037 | - for (ScheduleRealInfo scheduleRealInfo : list) { | |
| 2038 | - if (scheduleRealInfo != null) { | |
| 2039 | - j_Name = scheduleRealInfo.getjName(); | |
| 2040 | - //计划里程(主任务过滤掉临加班次), | |
| 2041 | - //烂班里程(主任务烂班), | |
| 2042 | - //临加里程(主任务临加), | |
| 2043 | - //计划班次,烂班班次,增加班次 | |
| 2044 | - tempJhlc = scheduleRealInfo.getJhlc() == null ? 0 : scheduleRealInfo.getJhlc(); | |
| 2045 | - if (scheduleRealInfo.isSflj()) { | |
| 2046 | - addMileage += tempJhlc; | |
| 2047 | - ljbc++; | |
| 2048 | - } else { | |
| 2049 | - jhlc += tempJhlc; | |
| 2050 | - jhbc++; | |
| 2051 | - if (scheduleRealInfo.getStatus() == -1) { | |
| 2052 | - remMileage += tempJhlc; | |
| 2053 | - cjbc++; | |
| 2054 | - } | |
| 2055 | - } | |
| 2056 | - Set<ChildTaskPlan> childTaskPlans = scheduleRealInfo.getcTasks(); | |
| 2057 | - //计算营运里程,空驶里程 | |
| 2058 | - if (childTaskPlans.isEmpty()) { | |
| 2059 | - if (scheduleRealInfo.getBcType().equals("in") || scheduleRealInfo.getBcType().equals("out") | |
| 2060 | - || scheduleRealInfo.getBcType().equals("venting")) { | |
| 2061 | - ksgl += tempJhlc; | |
| 2062 | - } else { | |
| 2063 | - yygl += tempJhlc; | |
| 2064 | - } | |
| 2065 | - } else { | |
| 2066 | - Iterator<ChildTaskPlan> it = childTaskPlans.iterator(); | |
| 2067 | - while (it.hasNext()) { | |
| 2068 | - ChildTaskPlan childTaskPlan = it.next(); | |
| 2069 | - if (childTaskPlan.getMileageType().equals("empty")) { | |
| 2070 | - ksgl += childTaskPlan.getMileage() == null ? 0 : childTaskPlan.getMileage(); | |
| 2071 | - } else { | |
| 2072 | - yygl += childTaskPlan.getMileage() == null ? 0 : childTaskPlan.getMileage(); | |
| 2073 | - } | |
| 2074 | - } | |
| 2075 | - } | |
| 2076 | - } | |
| 2077 | - } | |
| 2078 | - map.put("j_name", j_Name); | |
| 2079 | - map.put("jhlc", format.format(jhlc)); | |
| 2080 | - map.put("remMileage", format.format(remMileage)); | |
| 2081 | - map.put("addMileage", format.format(addMileage)); | |
| 2082 | - map.put("yygl", format.format(yygl)); | |
| 2083 | - map.put("ksgl", format.format(ksgl)); | |
| 2084 | - map.put("realMileage", format.format(yygl + ksgl)); | |
| 2085 | - map.put("jhbc", jhbc); | |
| 2086 | - map.put("cjbc", cjbc); | |
| 2087 | - map.put("ljbc", ljbc); | |
| 2088 | - map.put("sjbc", jhbc - cjbc + ljbc); | |
| 2089 | - return map; | |
| 2090 | - } | |
| 2091 | - | |
| 2092 | - | |
| 2093 | - public Map<String, Object> findKMBC(String jGh, String clZbh, | |
| 2094 | - String lpName, String date, String line) { | |
| 2095 | - Map<String, Object> map = new HashMap<String, Object>(); | |
| 2096 | - List<ScheduleRealInfo> list = scheduleRealInfoRepository.queryListWaybillXcld(jGh, clZbh, lpName, date, line); | |
| 2097 | - List<ScheduleRealInfo> lists = new ArrayList<ScheduleRealInfo>(); | |
| 2098 | - for (int i = 0; i < list.size(); i++) { | |
| 2099 | - ScheduleRealInfo s = list.get(i); | |
| 2100 | - Set<ChildTaskPlan> cts = s.getcTasks(); | |
| 2101 | - if (cts != null && cts.size() > 0) { | |
| 2102 | - lists.add(s); | |
| 2103 | - } else { | |
| 2104 | - if (s.getFcsjActual() != null && s.getZdsjActual() != null) { | |
| 2105 | - lists.add(s); | |
| 2106 | - } | |
| 2107 | - } | |
| 2108 | - } | |
| 2109 | - map.put("jhbc", culateService.culateJhbc(list, ""));//计划班次 | |
| 2110 | - map.put("jhlc", Arith.add(culateService.culateJhgl(list), | |
| 2111 | - culateService.culateJhJccgl(list))); //计划总里程 | |
| 2112 | - map.put("cjbc", culateService.culateLbbc(list));//烂班班次 | |
| 2113 | - map.put("remMileage", culateService.culateLbgl(list)); //烂班公里 | |
| 2114 | - map.put("ljbc", culateService.culateLjbc(lists, ""));//临加班次 | |
| 2115 | - double ljgl = culateService.culateLjgl(lists); | |
| 2116 | - map.put("addMileage", ljgl); //临加公里 | |
| 2117 | - map.put("sjbc", culateService.culateSjbc(lists, "") + culateService.culateLjbc(lists, "")); | |
| 2118 | - double ksgl = culateService.culateKsgl(list);//子任务空驶公里 | |
| 2119 | - double jccgl = culateService.culateJccgl(lists);//空驶班次公里 | |
| 2120 | - map.put("ksgl", ksgl);//空驶公里 | |
| 2121 | - double sjgl = culateService.culateSjgl(lists);//实际营运公里 | |
| 2122 | - map.put("realMileage", Arith.add(Arith.add(ksgl, jccgl), Arith.add(sjgl, ljgl)));//总公里 | |
| 2123 | - map.put("zkslc", Arith.add(ksgl, jccgl)); | |
| 2124 | - map.put("jcclc", jccgl); | |
| 2125 | - map.put("yygl", Arith.add(sjgl, ljgl)); //总营运公里 | |
| 2126 | - return map; | |
| 2127 | - } | |
| 2128 | - | |
| 2129 | - public Map<String, Object> findKMBC_mh_2(String jGh, String clZbh, | |
| 2130 | - String lpName, String date, String line) { | |
| 2131 | - Map<String, Object> map = new HashMap<String, Object>(); | |
| 2132 | - List<ScheduleRealInfo> list = scheduleRealInfoRepository.queryListWaybillXcld(jGh, clZbh, lpName, date, line); | |
| 2133 | - List<ScheduleRealInfo> lists = new ArrayList<ScheduleRealInfo>(); | |
| 2134 | - for (int i = 0; i < list.size(); i++) { | |
| 2135 | - ScheduleRealInfo s = list.get(i); | |
| 2136 | - if (s.isDestroy() && s.isReissue()) { | |
| 2137 | - s.setRemark(""); | |
| 2138 | - s.setFcsjActual(s.getDfsj()); | |
| 2139 | - s.setZdsjActual(s.getZdsj()); | |
| 2140 | - s.setStatus(2); | |
| 2141 | - s.setJhlc(s.getJhlcOrig()); | |
| 2142 | - } | |
| 2143 | - | |
| 2144 | - Set<ChildTaskPlan> cts = s.getcTasks(); | |
| 2145 | - if (cts != null && cts.size() > 0) { | |
| 2146 | - lists.add(s); | |
| 2147 | - } else { | |
| 2148 | - if (s.getZdsjActual() != null && s.getFcsjActual() != null) { | |
| 2149 | - lists.add(s); | |
| 2150 | - } | |
| 2151 | - } | |
| 2152 | - } | |
| 2153 | - double ksgl = culateService.culateKsgl(list); | |
| 2154 | - double sjgl = culateService.culateSjgl(lists); | |
| 2155 | - double jccgl = culateService.culateJccgl(lists); | |
| 2156 | - double ljgl = culateService.culateLjgl(lists); | |
| 2157 | - | |
| 2158 | - map.put("jhlc", Arith.add(culateService.culateJhgl(list), culateService.culateJhJccgl(list))); //计划里程 | |
| 2159 | - map.put("remMileage", culateService.culateLbgl(list)); //烂班公里 | |
| 2160 | - map.put("addMileage", ljgl); //临加公里 | |
| 2161 | - map.put("yygl", Arith.add(sjgl, ljgl)); //实际公里 | |
| 2162 | - map.put("ksgl", ksgl);//空驶公里 | |
| 2163 | - map.put("realMileage", Arith.add(Arith.add(ksgl, jccgl), Arith.add(sjgl, ljgl))); | |
| 2164 | -// map.put("realMileage", format.format(yygl + ksgl + jcclc+addMileage)); | |
| 2165 | - map.put("jhbc", culateService.culateJhbc(list, "")); | |
| 2166 | - map.put("cjbc", culateService.culateLbbc(list)); | |
| 2167 | - map.put("ljbc", culateService.culateLjbc(lists, "")); | |
| 2168 | - map.put("sjbc", culateService.culateJhbc(lists, "") - culateService.culateLbbc(lists) + culateService.culateLjbc(lists, "")); | |
| 2169 | - map.put("jcclc", jccgl); | |
| 2170 | - map.put("zkslc", Arith.add(ksgl, jccgl)); | |
| 2171 | -// map.put("zkslc", format.format(ksgl + jcclc+addMileageJc)); | |
| 2172 | - return map; | |
| 2173 | - } | |
| 2174 | - | |
| 2175 | - | |
| 2176 | - @Override | |
| 2177 | - public List<Map<String, Object>> accountPx(String line, String date, | |
| 2178 | - String code, String xlName, String px) { | |
| 2179 | -// List<Object[]> lsitObj = scheduleRealInfoRepository.accountPx(line, date, code,px); | |
| 2180 | - SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); | |
| 2181 | - if (!code.trim().equals("")) { | |
| 2182 | - code = BasicData.deviceId2NbbmMap.inverse().get(code); | |
| 2183 | - } | |
| 2184 | - String fgs = ""; | |
| 2185 | - List<Line> lineList = lineRepository.findLineByCode(line); | |
| 2186 | - if (lineList.size() > 0) { | |
| 2187 | - Line l = lineList.get(0); | |
| 2188 | - fgs = BasicData.businessFgsCodeNameMap.get(l.getBrancheCompany() + "_" + l.getCompany()); | |
| 2189 | - } | |
| 2190 | - List<Map<String, Object>> listMap = new ArrayList<Map<String, Object>>(); | |
| 2191 | - String sql = "SELECT request_code,FROM_UNIXTIME(TIMESTAMP / 1000,'%Y-%m-%d %T') as TIMESTAMP ," | |
| 2192 | - + " device_id FROM bsth_v_report_80 WHERE " | |
| 2193 | - + " FROM_UNIXTIME( TIMESTAMP / 1000,'%Y-%m-%d') = '" + date + "' AND" | |
| 2194 | - + " line_id = '" + line + "' and device_id like '%" + code + "%'"; | |
| 2195 | - Map<String, Object> map; | |
| 2196 | - List<Object[]> lsitObj = jdbcTemplate.query(sql, | |
| 2197 | - new RowMapper<Object[]>() { | |
| 2198 | - @Override | |
| 2199 | - public Object[] mapRow(ResultSet rs, int rowNum) throws SQLException { | |
| 2200 | - Object[] t = new Object[3]; | |
| 2201 | - t[0] = rs.getString("request_code"); | |
| 2202 | - t[1] = rs.getString("TIMESTAMP"); | |
| 2203 | - t[2] = rs.getString("device_id"); | |
| 2204 | - return t; | |
| 2205 | - } | |
| 2206 | - }); | |
| 2207 | - int i = 1; | |
| 2208 | - for (Object[] obj : lsitObj) { | |
| 2209 | - if (obj != null) { | |
| 2210 | - map = new HashMap<String, Object>(); | |
| 2211 | - map.put("num", i++); | |
| 2212 | - map.put("xlName", xlName); | |
| 2213 | - if (BasicData.deviceId2NbbmMap.get(obj[2]) == null) { | |
| 2214 | - List<CarDevice> carDeviceList = new ArrayList<CarDevice>(); | |
| 2215 | - try { | |
| 2216 | - carDeviceList = carDeviceRepository.findCarDevice(obj[2].toString(), sdf.parse(obj[1].toString())); | |
| 2217 | - } catch (Exception e) { | |
| 2218 | - // TODO Auto-generated catch block | |
| 2219 | - e.printStackTrace(); | |
| 2220 | - } | |
| 2221 | - if (carDeviceList.size() > 0) { | |
| 2222 | - map.put("clZbh", carDeviceList.get(0).getClZbh()); | |
| 2223 | - | |
| 2224 | - } else { | |
| 2225 | - map.put("clZbh", BasicData.deviceId2NbbmMap.get(obj[2])); | |
| 2226 | - } | |
| 2227 | - } else { | |
| 2228 | - map.put("clZbh", BasicData.deviceId2NbbmMap.get(obj[2])); | |
| 2229 | - | |
| 2230 | - } | |
| 2231 | - map.put("company", fgs); | |
| 2232 | - map.put("requestType", "0x" + Integer.toHexString(Integer.parseInt(obj[0] + "")).toUpperCase()); | |
| 2233 | - map.put("requestTime", obj[1]); | |
| 2234 | - listMap.add(map); | |
| 2235 | - } | |
| 2236 | - } | |
| 2237 | - if (listMap.size() > 1) { | |
| 2238 | - if (px.equals("asc")) { | |
| 2239 | - Collections.sort(listMap, new AccountMap()); | |
| 2240 | - } else { | |
| 2241 | - Collections.sort(listMap, new AccountMap2()); | |
| 2242 | - } | |
| 2243 | - } | |
| 2244 | - return listMap; | |
| 2245 | - } | |
| 2246 | - | |
| 2247 | - @Override | |
| 2248 | - public List<Map<String, Object>> account(String line, String date, | |
| 2249 | - String code, String xlName, String type) { | |
| 2250 | - if (!code.trim().equals("")) { | |
| 2251 | - code = BasicData.deviceId2NbbmMap.inverse().get(code); | |
| 2252 | - } | |
| 2253 | - String fgs = ""; | |
| 2254 | - List<Line> lineList = lineRepository.findLineByCode(line); | |
| 2255 | - if (lineList.size() > 0) { | |
| 2256 | - Line l = lineList.get(0); | |
| 2257 | - fgs = BasicData.businessFgsCodeNameMap.get(l.getBrancheCompany() + "_" + l.getCompany()); | |
| 2258 | - } | |
| 2259 | - SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); | |
| 2260 | - List<Object[]> lsitObj = scheduleRealInfoRepository.account(line, date, code); | |
| 2261 | - List<Map<String, Object>> listMap = new ArrayList<Map<String, Object>>(); | |
| 2262 | - Map<String, Object> map; | |
| 2263 | - int i = 1; | |
| 2264 | - for (Object[] obj : lsitObj) { | |
| 2265 | - if (obj != null) { | |
| 2266 | - map = new HashMap<String, Object>(); | |
| 2267 | - map.put("num", i++); | |
| 2268 | - map.put("xlName", xlName); | |
| 2269 | - if (BasicData.deviceId2NbbmMap.get(obj[2]) == null) { | |
| 2270 | - List<CarDevice> carDeviceList = new ArrayList<CarDevice>(); | |
| 2271 | - try { | |
| 2272 | - carDeviceList = carDeviceRepository.findCarDevice(obj[2].toString(), sdf.parse(obj[1].toString())); | |
| 2273 | - } catch (Exception e) { | |
| 2274 | - // TODO Auto-generated catch block | |
| 2275 | - e.printStackTrace(); | |
| 2276 | - } | |
| 2277 | - if (carDeviceList.size() > 0) { | |
| 2278 | - map.put("clZbh", carDeviceList.get(0).getClZbh()); | |
| 2279 | - | |
| 2280 | - } else { | |
| 2281 | - map.put("clZbh", BasicData.deviceId2NbbmMap.get(obj[2])); | |
| 2282 | - } | |
| 2283 | - } else { | |
| 2284 | - map.put("clZbh", BasicData.deviceId2NbbmMap.get(obj[2])); | |
| 2285 | - | |
| 2286 | - } | |
| 2287 | - map.put("company", fgs); | |
| 2288 | - map.put("requestType", "0x" + Integer.toHexString(Integer.parseInt(obj[0] + "")).toUpperCase()); | |
| 2289 | - map.put("requestTime", obj[1]); | |
| 2290 | - listMap.add(map); | |
| 2291 | - } | |
| 2292 | - } | |
| 2293 | - | |
| 2294 | - if (type != null && type.length() != 0 && type.equals("export")) { | |
| 2295 | - SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"), | |
| 2296 | - sdfSimple = new SimpleDateFormat("yyyyMMdd"); | |
| 2297 | - List<Iterator<?>> listI = new ArrayList<Iterator<?>>(); | |
| 2298 | - Map<String, Object> m = new HashMap<String, Object>(); | |
| 2299 | - ReportUtils ee = new ReportUtils(); | |
| 2300 | - Map<String, Object> typeMap = new HashMap<String, Object>(); | |
| 2301 | - typeMap.put("0xA1", "请求恢复运营"); | |
| 2302 | - typeMap.put("0xA2", "申请调档"); | |
| 2303 | - typeMap.put("0xA3", "出场请求"); | |
| 2304 | - typeMap.put("0xA5", "进场请求"); | |
| 2305 | - typeMap.put("0xA7", "加油请求"); | |
| 2306 | - typeMap.put("0x50", "车辆故障"); | |
| 2307 | - typeMap.put("0x70", "路阻报告"); | |
| 2308 | - typeMap.put("0x60", "事故报告"); | |
| 2309 | - typeMap.put("0x11", "扣证纠纷"); | |
| 2310 | - typeMap.put("0x12", "报警"); | |
| 2311 | - for (Map<String, Object> map1 : listMap) { | |
| 2312 | - map1.put("requestText", typeMap.get(map1.get("requestType"))); | |
| 2313 | - } | |
| 2314 | - try { | |
| 2315 | - listI.add(listMap.iterator()); | |
| 2316 | - String path = this.getClass().getResource("/").getPath() + "static/pages/forms/"; | |
| 2317 | - ee.excelReplace(listI, new Object[]{m}, path + "mould/account.xls", | |
| 2318 | - path + "export/" + sdfSimple.format(sdfMonth.parse(date)) | |
| 2319 | - + "-" + xlName + "-驾驶员请求台账.xls"); | |
| 2320 | - } catch (Exception e) { | |
| 2321 | - // TODO: handle exception | |
| 2322 | - e.printStackTrace(); | |
| 2323 | - } | |
| 2324 | - } | |
| 2325 | - | |
| 2326 | - return listMap; | |
| 2327 | - } | |
| 2328 | - | |
| 2329 | - @Override | |
| 2330 | - public List<SchEditInfoDto> correctForm(String line, String date, String endDate, | |
| 2331 | - String lpName, String code, String type, String changType) { | |
| 2332 | - | |
| 2333 | -// var types = {'DFTZ': '待发调整', 'FCXXWT':'发车信息微调', 'JHLB': '计划烂班', 'CXLB': '撤销烂班', | |
| 2334 | -// 'CXZX': '撤销执行', 'CXSF': '撤销实发', 'SFTZ': '实发调整', 'TZRC': '调整人车'}; | |
| 2335 | - Map<String, Object> map = new HashMap<String, Object>(); | |
| 2336 | - map.put("DFTZ", "待发调整"); | |
| 2337 | - map.put("FCXXWT", "发车信息微调"); | |
| 2338 | - map.put("JHLB", "计划烂班"); | |
| 2339 | - map.put("CXLB", "撤销烂班"); | |
| 2340 | - map.put("CXZX", "撤销执行"); | |
| 2341 | - map.put("CXSF", "撤销实发"); | |
| 2342 | - map.put("SFTZ", "实发调整"); | |
| 2343 | - map.put("TZRC", "调整人车"); | |
| 2344 | - | |
| 2345 | - SimpleDateFormat sdf1 = new SimpleDateFormat("HH:mm"); | |
| 2346 | - SimpleDateFormat sdf2 = new SimpleDateFormat("yyyy-MM-dd HH:mm"); | |
| 2347 | - String cont = ""; | |
| 2348 | - cont = " and xl_bm ='" + line + "'"; | |
| 2349 | - if (!lpName.equals("")) { | |
| 2350 | - cont += " and lp_name = '" + lpName + "'"; | |
| 2351 | - } | |
| 2352 | - if (!code.equals("")) { | |
| 2353 | - cont += " and cl_zbh ='" + code + "'"; | |
| 2354 | - } | |
| 2355 | - String sql = "select t1.*, t2.real_exec_date," | |
| 2356 | - + "t2.fcsj,t2.lp_name,t2.cl_zbh,t2.j_gh,t2.j_name," | |
| 2357 | - + "t2.xl_dir,t2.real_exec_date from (select * from " | |
| 2358 | - + "logger_sch_modify where rq BETWEEN ? and ? and line_code=? )" | |
| 2359 | - + " t1 INNER JOIN bsth_c_s_sp_info_real t2 on " | |
| 2360 | - + "t1.sch_id=t2.id where 1=1 " + cont; | |
| 2361 | - | |
| 2362 | - List<SchEditInfoDto> list = jdbcTemplate.query(sql, | |
| 2363 | - new BeanPropertyRowMapper(SchEditInfoDto.class), date, endDate, line); | |
| 2364 | - List<SchEditInfoDto> lists = new ArrayList<SchEditInfoDto>(); | |
| 2365 | - for (int i = 0; i < list.size(); i++) { | |
| 2366 | - Long fcsjs = 0l; | |
| 2367 | - Long updsj = 0l; | |
| 2368 | - SchEditInfoDto t = list.get(i); | |
| 2369 | - if (map.get(t.getType()) != null) { | |
| 2370 | - | |
| 2371 | - if (changType.equals("")) { | |
| 2372 | - t.setType2(t.getUser() + "于" + t.getTimeStr() + "进行" + map.get(t.getType()).toString() + ";"); | |
| 2373 | - } else { | |
| 2374 | - String fcsj = ""; | |
| 2375 | - String updtime = ""; | |
| 2376 | - try { | |
| 2377 | - fcsj = sdf1.format(sdf1.parse(t.getFcsj())); | |
| 2378 | - updtime = sdf1.format(sdf1.parse(t.getTimeStr())); | |
| 2379 | - fcsjs = sdf2.parse(t.getRealExecDate() + " " + fcsj).getTime(); | |
| 2380 | - updsj = sdf2.parse(t.getRq() + " " + updtime).getTime(); | |
| 2381 | - } catch (ParseException e) { | |
| 2382 | - // TODO Auto-generated catch block | |
| 2383 | - e.printStackTrace(); | |
| 2384 | - } | |
| 2385 | - if (changType.equals("1")) { | |
| 2386 | - if (fcsjs > updsj) { | |
| 2387 | - t.setType2(t.getUser() + "于" + t.getTimeStr() + "进行" + map.get(t.getType()).toString() + ";"); | |
| 2388 | - } else { | |
| 2389 | - t.setType2(""); | |
| 2390 | - } | |
| 2391 | - } else if (changType.equals("2")) { | |
| 2392 | - if (fcsjs < updsj) { | |
| 2393 | - t.setType2(t.getUser() + "于" + t.getTimeStr() + "进行" + map.get(t.getType()).toString() + ";"); | |
| 2394 | - } else { | |
| 2395 | - t.setType2(""); | |
| 2396 | - } | |
| 2397 | - } | |
| 2398 | - } | |
| 2399 | - } else { | |
| 2400 | - t.setType2(""); | |
| 2401 | - } | |
| 2402 | - boolean fage = true; | |
| 2403 | - for (int j = 0; j < lists.size(); j++) { | |
| 2404 | - SchEditInfoDto s = lists.get(j); | |
| 2405 | - if (s.getSchId() == t.getSchId()) { | |
| 2406 | - s.setType2(s.getType2() + " " + t.getType2()); | |
| 2407 | - fage = false; | |
| 2408 | - } | |
| 2409 | - } | |
| 2410 | - | |
| 2411 | - if (fage) { | |
| 2412 | - if (changType.equals("")) { | |
| 2413 | - lists.add(t); | |
| 2414 | - } else { | |
| 2415 | - if (changType.equals("1")) { | |
| 2416 | - if (fcsjs > updsj) { | |
| 2417 | - lists.add(t); | |
| 2418 | - } | |
| 2419 | - } else if (changType.equals("2")) { | |
| 2420 | - if (fcsjs < updsj) { | |
| 2421 | - lists.add(t); | |
| 2422 | - } | |
| 2423 | - } | |
| 2424 | - } | |
| 2425 | - } | |
| 2426 | - } | |
| 2427 | - | |
| 2428 | - if (type != null && type.length() != 0 && type.equals("export")) { | |
| 2429 | - SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"), | |
| 2430 | - sdfSimple = new SimpleDateFormat("yyyyMMdd"); | |
| 2431 | - List<Iterator<?>> listI = new ArrayList<Iterator<?>>(); | |
| 2432 | - Map<String, Object> m = new HashMap<String, Object>(); | |
| 2433 | - m.put("dates", date); | |
| 2434 | - ReportUtils ee = new ReportUtils(); | |
| 2435 | - List<Map<String, Object>> tempList = new ArrayList<Map<String, Object>>(); | |
| 2436 | - SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); | |
| 2437 | - for (SchEditInfoDto d : lists) { | |
| 2438 | - Map<String, Object> tempMap = new HashMap<String, Object>(); | |
| 2439 | - tempMap.put("lpName", d.getLpName()); | |
| 2440 | - tempMap.put("rq", d.getRq()); | |
| 2441 | - tempMap.put("clZbh", d.getClZbh()); | |
| 2442 | - tempMap.put("jName", d.getjName() + "/" + d.getjGh()); | |
| 2443 | - tempMap.put("fcsj", d.getFcsj()); | |
| 2444 | - tempMap.put("type", d.getType2()); | |
| 2445 | - tempList.add(tempMap); | |
| 2446 | - } | |
| 2447 | - try { | |
| 2448 | - String dateTime = sdfSimple.format(sdfMonth.parse(date)); | |
| 2449 | - if(!endDate.equals(date)){ | |
| 2450 | - dateTime += "-" + sdfSimple.format(sdfMonth.parse(endDate)); | |
| 2451 | - } | |
| 2452 | - String lineName = BasicData.lineCode2NameMap.get(line); | |
| 2453 | - listI.add(tempList.iterator()); | |
| 2454 | - String path = this.getClass().getResource("/").getPath() + "static/pages/forms/"; | |
| 2455 | - ee.excelReplace(listI, new Object[]{m}, path + "mould/correctForm.xls", | |
| 2456 | - path + "export/" + dateTime + "-" + lineName + "-修正报表.xls"); | |
| 2457 | - } catch (Exception e) { | |
| 2458 | - // TODO: handle exception | |
| 2459 | - e.printStackTrace(); | |
| 2460 | - } | |
| 2461 | -// Map<String, Object> maps = tempList.get(tempList.size() - 1); | |
| 2462 | - } | |
| 2463 | - return lists; | |
| 2464 | - } | |
| 2465 | - | |
| 2466 | - @Override | |
| 2467 | - public List<ScheduleRealInfo> queryListWaybill(String jGh, String clZbh, | |
| 2468 | - String lpName, String date, String line) { | |
| 2469 | - List<ScheduleRealInfo> listSchedule = new ArrayList<ScheduleRealInfo>(); | |
| 2470 | - List<ScheduleRealInfo> list = null; | |
| 2471 | - list = scheduleRealInfoRepository.queryListWaybillXcld(jGh, clZbh, lpName, date, line); | |
| 2472 | - SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm"); | |
| 2473 | - String minfcsj = "02:00"; | |
| 2474 | - List<Line> lineList = lineRepository.findLineByCode(line); | |
| 2475 | - if (lineList.size() > 0) { | |
| 2476 | - String sqlMinYysj = "select start_opt from bsth_c_line_config where " | |
| 2477 | - + " id = (" | |
| 2478 | - + "select max(id) from bsth_c_line_config where line ='" + lineList.get(0).getId() + "'" | |
| 2479 | - + ")"; | |
| 2480 | - minfcsj = jdbcTemplate.queryForObject(sqlMinYysj, String.class); | |
| 2481 | - } | |
| 2482 | - String[] minSjs = minfcsj.split(":"); | |
| 2483 | - Long minSj = Long.parseLong(minSjs[0]) * 60 + Long.parseLong(minSjs[1]); | |
| 2484 | - | |
| 2485 | - for (int i = 0; i < list.size(); i++) { | |
| 2486 | - ScheduleRealInfo s = list.get(i); | |
| 2487 | - if (s.getBcType().equals("out")) { | |
| 2488 | - s.setRemark("1"); | |
| 2489 | - } else if (s.getBcType().equals("in")) { | |
| 2490 | - s.setRemark("3"); | |
| 2491 | - } else { | |
| 2492 | - s.setRemark("2"); | |
| 2493 | - } | |
| 2494 | - String[] fcsj = s.getFcsj().split(":"); | |
| 2495 | - Long fcsjL = Long.parseLong(fcsj[0]) * 60 + Long.parseLong(fcsj[1]); | |
| 2496 | - | |
| 2497 | - Long fscjT = 0L; | |
| 2498 | - if (fcsjL < minSj) { | |
| 2499 | - Calendar calendar = new GregorianCalendar(); | |
| 2500 | - calendar.setTime(s.getScheduleDate()); | |
| 2501 | - calendar.add(calendar.DATE, 1); | |
| 2502 | - s.setScheduleDate(calendar.getTime()); | |
| 2503 | - try { | |
| 2504 | - fscjT = sdf.parse(sdf.format(s.getScheduleDate()) + " " + s.getFcsj()).getTime(); | |
| 2505 | - } catch (ParseException e) { | |
| 2506 | - // TODO Auto-generated catch block | |
| 2507 | - e.printStackTrace(); | |
| 2508 | - } | |
| 2509 | - | |
| 2510 | - } else { | |
| 2511 | - try { | |
| 2512 | - fscjT = sdf.parse(s.getScheduleDateStr() + " " + s.getFcsj()).getTime(); | |
| 2513 | - } catch (ParseException e) { | |
| 2514 | - // TODO Auto-generated catch block | |
| 2515 | - e.printStackTrace(); | |
| 2516 | - } | |
| 2517 | - ; | |
| 2518 | - } | |
| 2519 | - s.setFcsjT(fscjT); | |
| 2520 | - } | |
| 2521 | - Collections.sort(list, new compareFcsjType()); | |
| 2522 | - for (int i = 0; i < list.size(); i++) { | |
| 2523 | - ScheduleRealInfo s = list.get(i); | |
| 2524 | - s.setAdjustExps(i + 1 + ""); | |
| 2525 | - String remarks = ""; | |
| 2526 | - if (s.getRemarks() != null) { | |
| 2527 | - remarks += s.getRemarks(); | |
| 2528 | - } | |
| 2529 | - | |
| 2530 | - Set<ChildTaskPlan> childTaskPlans = s.getcTasks(); | |
| 2531 | - if (!childTaskPlans.isEmpty()) { | |
| 2532 | - s.setFcsjActual(""); | |
| 2533 | - s.setZdsjActual(""); | |
| 2534 | - s.setJhlc(0.0); | |
| 2535 | - } | |
| 2536 | - | |
| 2537 | - if (s.isDestroy()) { | |
| 2538 | - s.setFcsjActual(""); | |
| 2539 | - s.setZdsjActual(""); | |
| 2540 | - s.setJhlc(0.0); | |
| 2541 | - remarks += "(烂班)"; | |
| 2542 | - s.setRemarks(remarks); | |
| 2543 | - } | |
| 2544 | - | |
| 2545 | - listSchedule.add(s); | |
| 2546 | - //计算营运里程,空驶里程 | |
| 2547 | - if (!childTaskPlans.isEmpty()) { | |
| 2548 | -// Iterator<ChildTaskPlan> it = childTaskPlans.iterator(); | |
| 2549 | - List<ChildTaskPlan> listit = new ArrayList<ChildTaskPlan>(childTaskPlans); | |
| 2550 | - Collections.sort(listit, new ComparableChild()); | |
| 2551 | - for (int j = 0; j < listit.size(); j++) { | |
| 2552 | - ScheduleRealInfo t = new ScheduleRealInfo(); | |
| 2553 | - ChildTaskPlan childTaskPlan = listit.get(j); | |
| 2554 | - if (childTaskPlan.getCcId() == null) { | |
| 2555 | - if (childTaskPlan.isDestroy()) { | |
| 2556 | - t.setFcsjActual(""); | |
| 2557 | - t.setZdsjActual(""); | |
| 2558 | - t.setJhlc(0.0); | |
| 2559 | - } else { | |
| 2560 | - t.setFcsjActual(childTaskPlan.getStartDate()); | |
| 2561 | - t.setZdsjActual(childTaskPlan.getEndDate()); | |
| 2562 | - t.setJhlc(Double.parseDouble(String.valueOf(childTaskPlan.getMileage()))); | |
| 2563 | - } | |
| 2564 | - t.setFcsj(childTaskPlan.getStartDate()); | |
| 2565 | - t.setZdsj(childTaskPlan.getEndDate()); | |
| 2566 | - t.setQdzName(childTaskPlan.getStartStationName()); | |
| 2567 | - t.setZdzName(childTaskPlan.getEndStationName()); | |
| 2568 | - t.setRemarks(childTaskPlan.getRemarks()); | |
| 2569 | - t.setAdjustExps("子"); | |
| 2570 | - listSchedule.add(t); | |
| 2571 | - } | |
| 2572 | - } | |
| 2573 | - } | |
| 2574 | - } | |
| 2575 | - | |
| 2576 | - return listSchedule; | |
| 2577 | - } | |
| 2578 | - | |
| 2579 | - @Override | |
| 2580 | - public List<ScheduleRealInfo> queryListWaybill2(String jName, String clZbh, | |
| 2581 | - String lpName, String date, String line) { | |
| 2582 | - List<ScheduleRealInfo> listSchedule = new ArrayList<ScheduleRealInfo>(); | |
| 2583 | - List<ScheduleRealInfo> list = null; | |
| 2584 | - list = scheduleRealInfoRepository.queryListWaybill(jName, clZbh, lpName, date, line); | |
| 2585 | - SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm"); | |
| 2586 | - String minfcsj = "02:00"; | |
| 2587 | - List<Line> lineList = lineRepository.findLineByCode(line); | |
| 2588 | - if (lineList.size() > 0) { | |
| 2589 | - String sqlMinYysj = "select start_opt from bsth_c_line_config where " | |
| 2590 | - + " id = (" | |
| 2591 | - + "select max(id) from bsth_c_line_config where line ='" + lineList.get(0).getId() + "'" | |
| 2592 | - + ")"; | |
| 2593 | - minfcsj = jdbcTemplate.queryForObject(sqlMinYysj, String.class); | |
| 2594 | - } | |
| 2595 | - String[] minSjs = minfcsj.split(":"); | |
| 2596 | - Long minSj = Long.parseLong(minSjs[0]) * 60 + Long.parseLong(minSjs[1]); | |
| 2597 | - | |
| 2598 | - for (int i = 0; i < list.size(); i++) { | |
| 2599 | - ScheduleRealInfo s = list.get(i); | |
| 2600 | - String[] fcsj = s.getFcsj().split(":"); | |
| 2601 | - Long fcsjL = Long.parseLong(fcsj[0]) * 60 + Long.parseLong(fcsj[1]); | |
| 2602 | - | |
| 2603 | - Long fscjT = 0L; | |
| 2604 | - if (fcsjL < minSj) { | |
| 2605 | - Calendar calendar = new GregorianCalendar(); | |
| 2606 | - calendar.setTime(s.getScheduleDate()); | |
| 2607 | - calendar.add(calendar.DATE, 1); | |
| 2608 | - s.setScheduleDate(calendar.getTime()); | |
| 2609 | - try { | |
| 2610 | - fscjT = sdf.parse(sdf.format(s.getScheduleDate()) + " " + s.getFcsj()).getTime(); | |
| 2611 | - } catch (ParseException e) { | |
| 2612 | - // TODO Auto-generated catch block | |
| 2613 | - e.printStackTrace(); | |
| 2614 | - } | |
| 2615 | - | |
| 2616 | - } else { | |
| 2617 | - try { | |
| 2618 | - fscjT = sdf.parse(s.getScheduleDateStr() + " " + s.getFcsj()).getTime(); | |
| 2619 | - } catch (ParseException e) { | |
| 2620 | - // TODO Auto-generated catch block | |
| 2621 | - e.printStackTrace(); | |
| 2622 | - } | |
| 2623 | - ; | |
| 2624 | - } | |
| 2625 | - s.setFcsjT(fscjT); | |
| 2626 | - } | |
| 2627 | - Collections.sort(list, new ComparableReal()); | |
| 2628 | - for (int i = 0; i < list.size(); i++) { | |
| 2629 | - ScheduleRealInfo s = list.get(i); | |
| 2630 | - s.setAdjustExps(i + 1 + ""); | |
| 2631 | - String remarks = ""; | |
| 2632 | - if (s.getRemarks() != null) { | |
| 2633 | - remarks += s.getRemarks(); | |
| 2634 | - } | |
| 2635 | - | |
| 2636 | - Set<ChildTaskPlan> childTaskPlans = s.getcTasks(); | |
| 2637 | - if (!childTaskPlans.isEmpty()) { | |
| 2638 | - s.setFcsjActual(""); | |
| 2639 | - s.setZdsjActual(""); | |
| 2640 | - s.setJhlc(0.0); | |
| 2641 | - } | |
| 2642 | - | |
| 2643 | - if (s.isDestroy()) { | |
| 2644 | - if (s.isReissue()) { | |
| 2645 | - s.setFcsjActual(s.getDfsj()); | |
| 2646 | - s.setZdsjActual(s.getZdsj()); | |
| 2647 | - s.setRemarks(""); | |
| 2648 | - s.setStatus(2); | |
| 2649 | - s.setJhlc(s.getJhlcOrig()); | |
| 2650 | - } else { | |
| 2651 | - s.setFcsjActual(""); | |
| 2652 | - s.setZdsjActual(""); | |
| 2653 | - s.setJhlc(0.0); | |
| 2654 | - remarks += "(烂班)"; | |
| 2655 | - s.setRemarks(remarks); | |
| 2656 | - } | |
| 2657 | - } | |
| 2658 | - | |
| 2659 | - listSchedule.add(s); | |
| 2660 | - //计算营运里程,空驶里程 | |
| 2661 | - if (!childTaskPlans.isEmpty()) { | |
| 2662 | -// Iterator<ChildTaskPlan> it = childTaskPlans.iterator(); | |
| 2663 | - List<ChildTaskPlan> listit = new ArrayList<ChildTaskPlan>(childTaskPlans); | |
| 2664 | - Collections.sort(listit, new ComparableChild()); | |
| 2665 | - for (int j = 0; j < listit.size(); j++) { | |
| 2666 | - ScheduleRealInfo t = new ScheduleRealInfo(); | |
| 2667 | - ChildTaskPlan childTaskPlan = listit.get(j); | |
| 2668 | - if (childTaskPlan.isDestroy()) { | |
| 2669 | - t.setFcsjActual(""); | |
| 2670 | - t.setZdsjActual(""); | |
| 2671 | - t.setJhlc(0.0); | |
| 2672 | - } else { | |
| 2673 | - t.setFcsjActual(childTaskPlan.getStartDate()); | |
| 2674 | - t.setZdsjActual(childTaskPlan.getEndDate()); | |
| 2675 | - t.setJhlc(Double.parseDouble(String.valueOf(childTaskPlan.getMileage()))); | |
| 2676 | - } | |
| 2677 | - t.setQdzName(childTaskPlan.getStartStationName()); | |
| 2678 | - t.setZdzName(childTaskPlan.getEndStationName()); | |
| 2679 | - t.setRemarks(childTaskPlan.getRemarks()); | |
| 2680 | - t.setAdjustExps("子"); | |
| 2681 | - listSchedule.add(t); | |
| 2682 | - } | |
| 2683 | - } | |
| 2684 | - } | |
| 2685 | - | |
| 2686 | - return listSchedule; | |
| 2687 | - } | |
| 2688 | - | |
| 2689 | - @Override | |
| 2690 | - public Map<String, Object> removeChildTask(Long taskId) { | |
| 2691 | - Map<String, Object> rs = new HashMap<>(); | |
| 2692 | - ChildTaskPlan chTask = cTaskPlanRepository.findById(taskId).get(); | |
| 2693 | - | |
| 2694 | - ScheduleRealInfo sch = dayOfSchedule.get(chTask.getSchedule().getId()); | |
| 2695 | - try { | |
| 2696 | - | |
| 2697 | - sch.getcTasks().remove(chTask); | |
| 2698 | - scheduleRealInfoRepository.save(sch); | |
| 2699 | - rs.put("status", ResponseCode.SUCCESS); | |
| 2700 | - } catch (Exception e) { | |
| 2701 | - logger.error("", e); | |
| 2702 | - rs.put("status", ResponseCode.ERROR); | |
| 2703 | - } | |
| 2704 | - return rs; | |
| 2705 | - } | |
| 2706 | - | |
| 2707 | - @Override | |
| 2708 | - public List<Map<String, Object>> statisticsDaily(String line, String date, | |
| 2709 | - String xlName, String type) { | |
| 2710 | - List<Map<String, Object>> lMap = new ArrayList<Map<String, Object>>(); | |
| 2711 | - List<ScheduleRealInfo> list_s = scheduleRealInfoRepository.scheduleByDateAndLine2(line, date); | |
| 2712 | - List<ScheduleRealInfo> lists = new ArrayList<ScheduleRealInfo>(); | |
| 2713 | - for (int i = 0; i < list_s.size(); i++) { | |
| 2714 | - ScheduleRealInfo s = list_s.get(i); | |
| 2715 | - Set<ChildTaskPlan> cts = s.getcTasks(); | |
| 2716 | - if (cts != null && cts.size() > 0) { | |
| 2717 | - lists.add(s); | |
| 2718 | - } else { | |
| 2719 | - if (s.getZdsjActual() != null && s.getFcsjActual() != null) { | |
| 2720 | - lists.add(s); | |
| 2721 | - } | |
| 2722 | - } | |
| 2723 | - } | |
| 2724 | - Map<String, Object> map = new HashMap<String, Object>(); | |
| 2725 | - map.put("xlName", xlName); | |
| 2726 | - double jhlc = culateService.culateJhgl(list_s); | |
| 2727 | - map.put("jhlc", jhlc); | |
| 2728 | - map.put("sjgl", Arith.add(culateService.culateSjgl(lists), culateService.culateLjgl(lists))); | |
| 2729 | - double lbgl = culateService.culateLbgl(list_s); | |
| 2730 | - map.put("ssgl", lbgl); | |
| 2731 | - map.put("ssgl_lz", culateService.culateCJLC(list_s, "路阻")); | |
| 2732 | - map.put("ssgl_dm", culateService.culateCJLC(list_s, "吊慢")); | |
| 2733 | - map.put("ssgl_gz", culateService.culateCJLC(list_s, "故障")); | |
| 2734 | - map.put("ssgl_jf", culateService.culateCJLC(list_s, "纠纷")); | |
| 2735 | - map.put("ssgl_zs", culateService.culateCJLC(list_s, "肇事")); | |
| 2736 | - map.put("ssgl_qr", culateService.culateCJLC(list_s, "缺人")); | |
| 2737 | - map.put("ssgl_qc", culateService.culateCJLC(list_s, "缺车")); | |
| 2738 | - map.put("ssgl_kx", culateService.culateCJLC(list_s, "客稀")); | |
| 2739 | - map.put("ssgl_qh", culateService.culateCJLC(list_s, "气候")); | |
| 2740 | - map.put("ssgl_yw", culateService.culateCJLC(list_s, "援外")); | |
| 2741 | - map.put("ssgl_ljpm", culateService.culateCJLC(list_s, "路救抛锚")); | |
| 2742 | - double ssgl_pc = culateService.culateCJLC(list_s, "配车"); | |
| 2743 | - double ssgl_by = culateService.culateCJLC(list_s, "保养"); | |
| 2744 | - double ssgl_cj = culateService.culateCJLC(list_s, "抽减"); | |
| 2745 | - double ssgl_qt = culateService.culateCJLC(list_s, "其他"); | |
| 2746 | - map.put("ssgl_other", Arith.add(Arith.add(ssgl_pc, ssgl_by), Arith.add(ssgl_cj, ssgl_qt))); | |
| 2747 | - map.put("ssbc", culateService.culateLbbc(list_s)); | |
| 2748 | - double ljgl = culateService.culateLjgl(lists); | |
| 2749 | - map.put("ljgl", ljgl); | |
| 2750 | - map.put("jhbc", culateService.culateJhbc(list_s, "")); | |
| 2751 | - map.put("jhbc_m", culateService.culateJhbc(list_s, "zgf")); | |
| 2752 | - map.put("jhbc_a", culateService.culateJhbc(list_s, "wgf")); | |
| 2753 | - map.put("sjbc", culateService.culateSjbc(lists, "")); | |
| 2754 | - map.put("sjbc_m", culateService.culateSjbc(lists, "zgf")); | |
| 2755 | - map.put("sjbc_a", culateService.culateSjbc(lists, "wgf")); | |
| 2756 | - map.put("ljbc", culateService.culateLjbc(lists, "")); | |
| 2757 | - map.put("ljbc_m", culateService.culateLjbc(lists, "zgf")); | |
| 2758 | - map.put("ljbc_a", culateService.culateLjbc(lists, "wgf")); | |
| 2759 | - map.put("fzbc", culateService.culateFzbc(lists, "")); | |
| 2760 | - map.put("fzbc_m", culateService.culateFzbc(lists, "zgf")); | |
| 2761 | - map.put("fzbc_a", culateService.culateFzbc(lists, "wgf")); | |
| 2762 | - map.put("dtbc", 0); | |
| 2763 | - map.put("dtbc_m", 0); | |
| 2764 | - map.put("dtbc_a", 0); | |
| 2765 | - List<CalcInterval> intervalList=calcIntervalRepository.selectByDateAndLine(line, date,""); | |
| 2766 | - if(intervalList.size()>0){ | |
| 2767 | - CalcInterval c=intervalList.get(0); | |
| 2768 | - map.put("djg",c.getDjgAll()); | |
| 2769 | - map.put("djg_m", c.getDjgZgf()); | |
| 2770 | - map.put("djg_a", c.getDjgWgf()); | |
| 2771 | - map.put("djg_time", c.getDjgTime()); | |
| 2772 | - }else{ | |
| 2773 | - Map<String, Object> m = culateService.culateDjg(list_s, line); | |
| 2774 | - map.put("djg", m.get("djgcsq")); | |
| 2775 | - map.put("djg_m", m.get("djgcsz")); | |
| 2776 | - map.put("djg_a", m.get("djgcsw")); | |
| 2777 | - map.put("djg_time", m.get("djgsj")); | |
| 2778 | - } | |
| 2779 | - | |
| 2780 | - map.put("jls", Arith.sub(Arith.add(jhlc, ljgl), lbgl)); | |
| 2781 | - lMap.add(map); | |
| 2782 | - | |
| 2783 | - if (date.length() == 10) { | |
| 2784 | - List<DutyEmployee> list = dutyEmployeeService.getDutyEmployee(line, date + "00:01", date + "23:59"); | |
| 2785 | - String dbdp = ""; | |
| 2786 | - try { | |
| 2787 | - for (int i = 0; i < list.size(); i++) { | |
| 2788 | - DutyEmployee t = list.get(i); | |
| 2789 | - if (dbdp.indexOf(t.getuName()) == -1) { | |
| 2790 | - if (!(dbdp.length() > 0)) { | |
| 2791 | - dbdp = t.getuName(); | |
| 2792 | - } else { | |
| 2793 | - dbdp += "," + t.getuName(); | |
| 2794 | - } | |
| 2795 | - } | |
| 2796 | - } | |
| 2797 | - } catch (Exception e) { | |
| 2798 | - // TODO: handle exception | |
| 2799 | - e.printStackTrace(); | |
| 2800 | - } | |
| 2801 | - map.put("dbdp", dbdp); | |
| 2802 | - } | |
| 2803 | - | |
| 2804 | - return lMap; | |
| 2805 | - } | |
| 2806 | - | |
| 2807 | - @Override | |
| 2808 | - public List<Map<String, Object>> statisticsDaily_mh_2(String line, String date, | |
| 2809 | - String xlName, String type) { | |
| 2810 | - List<Map<String, Object>> lMap = new ArrayList<Map<String, Object>>(); | |
| 2811 | - List<ScheduleRealInfo> list_s = scheduleRealInfoRepository.scheduleByDateAndLine2(line, date); | |
| 2812 | - List<ScheduleRealInfo> lists = new ArrayList<ScheduleRealInfo>(); | |
| 2813 | - for (int i = 0; i < list_s.size(); i++) { | |
| 2814 | - ScheduleRealInfo s = list_s.get(i); | |
| 2815 | - if (s.isDestroy() && s.isReissue()) { | |
| 2816 | - s.setRemark(""); | |
| 2817 | - s.setFcsjActual(s.getDfsj()); | |
| 2818 | - s.setZdsjActual(s.getZdsj()); | |
| 2819 | - s.setStatus(2); | |
| 2820 | - s.setJhlc(s.getJhlcOrig()); | |
| 2821 | - } | |
| 2822 | - | |
| 2823 | - Set<ChildTaskPlan> cts = s.getcTasks(); | |
| 2824 | - if (cts != null && cts.size() > 0) { | |
| 2825 | - lists.add(s); | |
| 2826 | - } else { | |
| 2827 | - if (s.getZdsjActual() != null && s.getFcsjActual() != null) { | |
| 2828 | - lists.add(s); | |
| 2829 | - } | |
| 2830 | - } | |
| 2831 | - } | |
| 2832 | - Map<String, Object> map = new HashMap<String, Object>(); | |
| 2833 | - map.put("xlName", xlName); | |
| 2834 | - double jhlc = culateService.culateJhgl(list_s); | |
| 2835 | - map.put("jhlc", jhlc); | |
| 2836 | - map.put("sjgl", Arith.add(culateService.culateSjgl(lists), culateService.culateLjgl(lists))); | |
| 2837 | - double lbgl = culateService.culateLbgl(list_s); | |
| 2838 | - map.put("ssgl", lbgl); | |
| 2839 | - map.put("ssgl_lz", culateService.culateCJLC(list_s, "路阻")); | |
| 2840 | - map.put("ssgl_dm", culateService.culateCJLC(list_s, "吊慢")); | |
| 2841 | - map.put("ssgl_gz", culateService.culateCJLC(list_s, "故障")); | |
| 2842 | - map.put("ssgl_jf", culateService.culateCJLC(list_s, "纠纷")); | |
| 2843 | - map.put("ssgl_zs", culateService.culateCJLC(list_s, "肇事")); | |
| 2844 | - map.put("ssgl_qr", culateService.culateCJLC(list_s, "缺人")); | |
| 2845 | - map.put("ssgl_qc", culateService.culateCJLC(list_s, "缺车")); | |
| 2846 | - map.put("ssgl_kx", culateService.culateCJLC(list_s, "客稀")); | |
| 2847 | - map.put("ssgl_qh", culateService.culateCJLC(list_s, "气候")); | |
| 2848 | - map.put("ssgl_yw", culateService.culateCJLC(list_s, "援外")); | |
| 2849 | - map.put("ssgl_ljpm", culateService.culateCJLC(list_s, "路救抛锚")); | |
| 2850 | - double ssgl_pc = culateService.culateCJLC(list_s, "配车"); | |
| 2851 | - double ssgl_by = culateService.culateCJLC(list_s, "保养"); | |
| 2852 | - double ssgl_cj = culateService.culateCJLC(list_s, "抽减"); | |
| 2853 | - double ssgl_qt = culateService.culateCJLC(list_s, "其他"); | |
| 2854 | - map.put("ssgl_other", Arith.add(Arith.add(ssgl_pc, ssgl_by), Arith.add(ssgl_cj, ssgl_qt))); | |
| 2855 | - map.put("ssbc", culateService.culateLbbc(list_s)); | |
| 2856 | - double ljgl = culateService.culateLjgl(lists); | |
| 2857 | - map.put("ljgl", ljgl); | |
| 2858 | - map.put("jhbc", culateService.culateJhbc(list_s, "")); | |
| 2859 | - map.put("jhbc_m", culateService.culateJhbc(list_s, "zgf")); | |
| 2860 | - map.put("jhbc_a", culateService.culateJhbc(list_s, "wgf")); | |
| 2861 | - map.put("sjbc", culateService.culateSjbc(lists, "")); | |
| 2862 | - map.put("sjbc_m", culateService.culateSjbc(lists, "zgf")); | |
| 2863 | - map.put("sjbc_a", culateService.culateSjbc(lists, "wgf")); | |
| 2864 | - map.put("ljbc", culateService.culateLjbc(lists, "")); | |
| 2865 | - map.put("ljbc_m", culateService.culateLjbc(lists, "zgf")); | |
| 2866 | - map.put("ljbc_a", culateService.culateLjbc(lists, "wgf")); | |
| 2867 | - map.put("fzbc", culateService.culateFzbc(lists, "")); | |
| 2868 | - map.put("fzbc_m", culateService.culateFzbc(lists, "zgf")); | |
| 2869 | - map.put("fzbc_a", culateService.culateFzbc(lists, "wgf")); | |
| 2870 | - map.put("dtbc", 0); | |
| 2871 | - map.put("dtbc_m", 0); | |
| 2872 | - map.put("dtbc_a", 0); | |
| 2873 | - map.put("djg", 0); | |
| 2874 | - map.put("djg_m", 0); | |
| 2875 | - map.put("djg_a", 0); | |
| 2876 | - map.put("djg_time", 0); | |
| 2877 | - map.put("jls", Arith.sub(Arith.add(jhlc, ljgl), lbgl)); | |
| 2878 | - lMap.add(map); | |
| 2879 | - return lMap; | |
| 2880 | - } | |
| 2881 | - | |
| 2882 | - public final Map<String, Object> staticTj(List<ScheduleRealInfo> list,Map<String, Object> m) { | |
| 2883 | - | |
| 2884 | - List<ScheduleRealInfo> lists = new ArrayList<ScheduleRealInfo>(); | |
| 2885 | - for (int i = 0; i < list.size(); i++) { | |
| 2886 | - ScheduleRealInfo s = list.get(i); | |
| 2887 | - Set<ChildTaskPlan> cts = s.getcTasks(); | |
| 2888 | - if (cts != null && cts.size() > 0) { | |
| 2889 | - lists.add(s); | |
| 2890 | - } else { | |
| 2891 | - if (s.getZdsjActual() != null && s.getFcsjActual() != null) { | |
| 2892 | - lists.add(s); | |
| 2893 | - } | |
| 2894 | - } | |
| 2895 | - } | |
| 2896 | - Map<String, Object> map = new HashMap<String, Object>(); | |
| 2897 | - if (list.size() > 0) { | |
| 2898 | - map.put("gsBm", list.get(0).getGsBm()); | |
| 2899 | - map.put("fgsBm", list.get(0).getFgsBm()); | |
| 2900 | - map.put("xlBm", list.get(0).getXlBm()); | |
| 2901 | - map.put("xlName", list.get(0).getXlName()); | |
| 2902 | - map.put("fgsName", list.get(0).getFgsName()); | |
| 2903 | - map.put("gsName", list.get(0).getGsName()); | |
| 2904 | - | |
| 2905 | - try { | |
| 2906 | - map.put("xlNamePy", PinyinHelper.convertToPinyinString(list.get(0).getGsBm()+list.get(0).getFgsBm()+list.get(0).getXlName(), "", PinyinFormat.WITHOUT_TONE)); | |
| 2907 | - } catch (PinyinException e) { | |
| 2908 | - // TODO Auto-generated catch block | |
| 2909 | - e.printStackTrace(); | |
| 2910 | - } | |
| 2911 | - double jhyygl = culateService.culateJhgl(list);//计划营运公里 | |
| 2912 | - double jhjcclc = culateService.culateJhJccgl(list);//计划进出场公里(计划空驶公里) | |
| 2913 | - map.put("jhlc", jhyygl); | |
| 2914 | - map.put("jcclc", jhjcclc); | |
| 2915 | - map.put("jhzlc", Arith.add(jhyygl, jhjcclc)); | |
| 2916 | - double ljks=culateService.culateLjksgl(lists); | |
| 2917 | - map.put("ljks", ljks); | |
| 2918 | - double ljgl = culateService.culateLjgl(lists); | |
| 2919 | - double sjyygl = culateService.culateSjgl(lists); | |
| 2920 | - double zyygl = Arith.add(sjyygl, ljgl); | |
| 2921 | - | |
| 2922 | - double sjjccgl = culateService.culateJccgl(lists); | |
| 2923 | - double sjksgl = culateService.culateKsgl(lists); | |
| 2924 | - double zksgl = Arith.add(sjjccgl, sjksgl); | |
| 2925 | - map.put("sjzgl", Arith.add(zyygl, zksgl)); | |
| 2926 | - map.put("sjgl", zyygl); | |
| 2927 | - map.put("sjksgl", zksgl); | |
| 2928 | - double ssgl = culateService.culateLbgl(list); | |
| 2929 | - map.put("ssgl", ssgl); | |
| 2930 | - | |
| 2931 | - //计划+临加-少驶=实驶 | |
| 2932 | - double jl = Arith.sub(Arith.add(jhyygl, ljgl), ssgl); | |
| 2933 | - if (jl == zyygl) { | |
| 2934 | - map.put("zt", 0); | |
| 2935 | - } else { | |
| 2936 | - map.put("zt", 1); | |
| 2937 | - } | |
| 2938 | - | |
| 2939 | - map.put("ssgl_lz", culateService.culateCJLC(list, "路阻")); | |
| 2940 | - map.put("ssgl_dm", culateService.culateCJLC(list, "吊慢")); | |
| 2941 | - map.put("ssgl_gz", culateService.culateCJLC(list, "故障")); | |
| 2942 | - map.put("ssgl_jf", culateService.culateCJLC(list, "纠纷")); | |
| 2943 | - map.put("ssgl_zs", culateService.culateCJLC(list, "肇事")); | |
| 2944 | - map.put("ssgl_qr", culateService.culateCJLC(list, "缺人")); | |
| 2945 | - map.put("ssgl_qc", culateService.culateCJLC(list, "缺车")); | |
| 2946 | - map.put("ssgl_kx", culateService.culateCJLC(list, "客稀")); | |
| 2947 | - map.put("ssgl_qh", culateService.culateCJLC(list, "气候")); | |
| 2948 | - map.put("ssgl_yw", culateService.culateCJLC(list, "援外")); | |
| 2949 | - map.put("ssgl_ljpm", culateService.culateCJLC(list, "路救抛锚")); | |
| 2950 | - double ssgl_pc = culateService.culateCJLC(list, "配车"); | |
| 2951 | - double ssgl_by = culateService.culateCJLC(list, "保养"); | |
| 2952 | - double ssgl_cj = culateService.culateCJLC(list, "抽减"); | |
| 2953 | - double ssgl_qt = culateService.culateCJLC(list, "其他"); | |
| 2954 | - map.put("ssgl_other", Arith.add(Arith.add(ssgl_pc, ssgl_by), Arith.add(ssgl_cj, ssgl_qt))); | |
| 2955 | - map.put("ssbc", culateService.culateLbbc(list)); | |
| 2956 | - map.put("ljgl", ljgl); | |
| 2957 | - map.put("jhbc", culateService.culateJhbc(list, "")); | |
| 2958 | - map.put("jhbc_m", culateService.culateJhbc(list, "zgf")); | |
| 2959 | - map.put("jhbc_a", culateService.culateJhbc(list, "wgf")); | |
| 2960 | - map.put("sjbc", culateService.culateSjbc(lists, "")); | |
| 2961 | - map.put("sjbc_m", culateService.culateSjbc(lists, "zgf")); | |
| 2962 | - map.put("sjbc_a", culateService.culateSjbc(lists, "wgf")); | |
| 2963 | - map.put("ljbc", culateService.culateLjbc(lists, "")); | |
| 2964 | - map.put("ljbc_m", culateService.culateLjbc(lists, "zgf")); | |
| 2965 | - map.put("ljbc_a", culateService.culateLjbc(lists, "wgf")); | |
| 2966 | - map.put("fzbc", culateService.culateFzbc(lists, "")); | |
| 2967 | - map.put("fzbc_m", culateService.culateFzbc(lists, "zgf")); | |
| 2968 | - map.put("fzbc_a", culateService.culateFzbc(lists, "wgf")); | |
| 2969 | - map.put("dtbc", 0); | |
| 2970 | - map.put("dtbc_m", 0); | |
| 2971 | - map.put("dtbc_a", 0); | |
| 2972 | - if(m.get("xl")==null){ | |
| 2973 | - Map<String, Object> m_ = culateService.culateDjg(lists, list.get(0).getXlBm()); | |
| 2974 | - map.put("djg", m_.get("djgcsq")); | |
| 2975 | - map.put("djg_m", m_.get("djgcsz")); | |
| 2976 | - map.put("djg_a", m_.get("djgcsw")); | |
| 2977 | - map.put("djg_time", m_.get("djgsj")); | |
| 2978 | - }else{ | |
| 2979 | - map.put("djg", m.get("djgAll")==null?"0":m.get("djgAll")); | |
| 2980 | - map.put("djg_m", m.get("djgZgf")==null?"0":m.get("djgZgf")); | |
| 2981 | - map.put("djg_a", m.get("djgWgf")==null?"0":m.get("djgWgf")); | |
| 2982 | - map.put("djg_time", m.get("djgTime")==null?"0":m.get("djgTime")); | |
| 2983 | - } | |
| 2984 | - } | |
| 2985 | - return map; | |
| 2986 | - } | |
| 2987 | - | |
| 2988 | - @Override | |
| 2989 | - public List<Map<String, Object>> dispatchDailySum(String date, String date2, String nature, String type) { | |
| 2990 | - List<Map<String, Object>> resList = new ArrayList<Map<String, Object>>(); | |
| 2991 | - | |
| 2992 | -// List<Map<String, Object>> list = statisticsDailyTj("", "", "", date, date2, "", "query", nature); | |
| 2993 | - List<CalcStatistics> calc = calcWaybillService.calcStatisticsDaily("", "", "", date, date2, "", "query", nature); | |
| 2994 | - List<Map<String, Object>> list = new ArrayList<Map<String, Object>>(); | |
| 2995 | - try { | |
| 2996 | - List<Map<String, Object>> tempList = new ArrayList<Map<String, Object>>(); | |
| 2997 | - for(CalcStatistics c : calc){ | |
| 2998 | - Map<String, Object> m = new HashMap<>(); | |
| 2999 | - Field[] fields = c.getClass().getDeclaredFields(); | |
| 3000 | - for(Field f : fields){ | |
| 3001 | - f.setAccessible(true); | |
| 3002 | - String key = new String(f.getName()); | |
| 3003 | - m.put(key, f.get(c)); | |
| 3004 | - } | |
| 3005 | - tempList.add(m); | |
| 3006 | - } | |
| 3007 | - list = tempList; | |
| 3008 | - } catch (Exception e) { | |
| 3009 | - // TODO: handle exception | |
| 3010 | - e.printStackTrace(); | |
| 3011 | - } | |
| 3012 | - | |
| 3013 | - List<Business> allBusiness = businessRepository.getOrder(); | |
| 3014 | - Set<String> gsFgsSet = new HashSet<String>(); // 有排序编号的公司,防止乱序或者合计值出问题。 | |
| 3015 | - for(Business b : allBusiness){ | |
| 3016 | - gsFgsSet.add(b.getUpCode() + "_" + b.getBusinessCode()); | |
| 3017 | - gsFgsSet.add(b.getBusinessCode()); | |
| 3018 | - } | |
| 3019 | - | |
| 3020 | - Map<String, Map<String, Object>> keyMap = new HashMap<String, Map<String, Object>>(); | |
| 3021 | - List<String> keyList = new ArrayList<String>(); | |
| 3022 | - | |
| 3023 | - Map<String, Object> hj = new HashMap<String, Object>(); // 合计 | |
| 3024 | - hj.put("gsName", "合计"); | |
| 3025 | - hj.put("fgsBm", " "); | |
| 3026 | - | |
| 3027 | - for(Map<String, Object> m : list){ | |
| 3028 | - m.put("gsBm", m.get("gsdm")); | |
| 3029 | - m.put("fgsBm", m.get("fgsdm")); | |
| 3030 | - if(m.get("gsBm") != null && m.get("fgsBm") != null | |
| 3031 | - && m.get("gsBm").toString().trim().length() > 0 | |
| 3032 | - && m.get("fgsBm").toString().trim().length() > 0){ | |
| 3033 | - String gsBm = m.get("gsBm").toString().trim(); | |
| 3034 | - String fgsBm = m.get("fgsBm").toString().trim(); | |
| 3035 | - String key = gsBm + "_" + fgsBm; // 分公司key | |
| 3036 | - String key2 = gsBm + "_sum"; // 直属公司key | |
| 3037 | - if(!gsFgsSet.contains(key) && !gsFgsSet.contains(gsBm)){ | |
| 3038 | - continue; | |
| 3039 | - } | |
| 3040 | - if(!keyMap.containsKey(key)){ // 每个分公司一条 | |
| 3041 | - Map<String, Object> t = new HashMap<String, Object>(); | |
| 3042 | - t.put("gsName", m.get("gsName")); | |
| 3043 | - t.put("fgsName", m.get("fgsName")); | |
| 3044 | - t.put("key", key); | |
| 3045 | - keyMap.put(key, t); | |
| 3046 | - keyList.add(key); | |
| 3047 | - if(!keyMap.containsKey(key2)){ // 直属公司小计 | |
| 3048 | - Map<String, Object> t2 = new HashMap<String, Object>(); | |
| 3049 | - t2.put("gsName", m.get("gsName")); | |
| 3050 | - t2.put("fgsName", "小计"); | |
| 3051 | - t2.put("key", key2); | |
| 3052 | - keyMap.put(key2, t2); | |
| 3053 | - keyList.add(key2); | |
| 3054 | - } | |
| 3055 | - } | |
| 3056 | - Map<String, Object> t = keyMap.get(key); | |
| 3057 | - Map<String, Object> t2 = keyMap.get(key2); | |
| 3058 | - for(String s : m.keySet()){ | |
| 3059 | - if("gsName,fgsName,key".contains(s)){ | |
| 3060 | - continue; | |
| 3061 | - } | |
| 3062 | - try { | |
| 3063 | - if(t.containsKey(s)){ // 分公司 | |
| 3064 | - t.put(s, new BigDecimal(t.get(s).toString()).add(new BigDecimal(m.get(s).toString()))); | |
| 3065 | - } else { | |
| 3066 | - t.put(s, m.get(s).toString()); | |
| 3067 | - } | |
| 3068 | - if(t2.containsKey(s)){ // 直属公司 | |
| 3069 | - t2.put(s, new BigDecimal(t2.get(s).toString()).add(new BigDecimal(m.get(s).toString()))); | |
| 3070 | - } else { | |
| 3071 | - t2.put(s, m.get(s).toString()); | |
| 3072 | - } | |
| 3073 | - if(hj.containsKey(s)){ // 合计 | |
| 3074 | - hj.put(s, new BigDecimal(hj.get(s).toString()).add(new BigDecimal(m.get(s).toString()))); | |
| 3075 | - } else { | |
| 3076 | - hj.put(s, m.get(s).toString()); | |
| 3077 | - } | |
| 3078 | - } catch (Exception e) { | |
| 3079 | - // TODO: handle exception | |
| 3080 | - continue; | |
| 3081 | - } | |
| 3082 | - } | |
| 3083 | - } | |
| 3084 | - } | |
| 3085 | - | |
| 3086 | - for(Business b : allBusiness){ // 根据公司排序插入返回对象 | |
| 3087 | - String gs = b.getBusinessCode(); | |
| 3088 | - String gsfgs = b.getUpCode() + "_" + b.getBusinessCode(); | |
| 3089 | - for(String key : keyList){ | |
| 3090 | - if(key.equals(gsfgs)){ | |
| 3091 | - resList.add(keyMap.get(key)); | |
| 3092 | - break; | |
| 3093 | - } else if(key.replaceAll("_sum", "").equals(gs)){ | |
| 3094 | - resList.add(keyMap.get(key)); | |
| 3095 | - break; | |
| 3096 | - } | |
| 3097 | - } | |
| 3098 | - } | |
| 3099 | - resList.add(hj); | |
| 3100 | - | |
| 3101 | - for(Map<String, Object> m : resList){ | |
| 3102 | - try { | |
| 3103 | - m.put("jhzlc", m.get("jhzlc")); | |
| 3104 | - m.put("jhlc", m.get("jhyylc")); | |
| 3105 | - m.put("jcclc", m.get("jhkslc")); | |
| 3106 | - m.put("sjzgl", m.get("sjzlc")); | |
| 3107 | - m.put("sjgl", m.get("sjyylc")); | |
| 3108 | - m.put("sjksgl", m.get("sjkslc")); | |
| 3109 | - m.put("ssbc", m.get("ssbc")); | |
| 3110 | - m.put("ssgl", m.get("sslc")); | |
| 3111 | - m.put("ssgl_lz", m.get("lzlc")); | |
| 3112 | - m.put("ssgl_dm", m.get("dmlc")); | |
| 3113 | - m.put("ssgl_gz", m.get("gzlc")); | |
| 3114 | - m.put("ssgl_jf", m.get("jflc")); | |
| 3115 | - m.put("ssgl_zs", m.get("zslc")); | |
| 3116 | - m.put("ssgl_qr", m.get("qrlc")); | |
| 3117 | - m.put("ssgl_qc", m.get("qclc")); | |
| 3118 | - m.put("ssgl_kx", m.get("kxlc")); | |
| 3119 | - m.put("ssgl_qh", m.get("qhlc")); | |
| 3120 | - m.put("ssgl_yw", m.get("ywlc")); | |
| 3121 | - m.put("ssgl_ljpm", m.get("ljpmlc")); | |
| 3122 | - m.put("ssgl_other", m.get("qtlc")); | |
| 3123 | - m.put("ljgl", m.get("ljlc")); | |
| 3124 | - m.put("ljks", m.get("ljkslc")); | |
| 3125 | - m.put("jhbc", m.get("jhbcq")); | |
| 3126 | - m.put("jhbc_m", m.get("jhbcz")); | |
| 3127 | - m.put("jhbc_a", m.get("jhbcw")); | |
| 3128 | - m.put("sjbc", m.get("sjbcq")); | |
| 3129 | - m.put("sjbc_m", m.get("sjbcz")); | |
| 3130 | - m.put("sjbc_a", m.get("sjbcw")); | |
| 3131 | - m.put("ljbc", m.get("ljbcq")); | |
| 3132 | - m.put("ljbc_m", m.get("ljbcz")); | |
| 3133 | - m.put("ljbc_a", m.get("ljbcw")); | |
| 3134 | - m.put("fzbc", m.get("fzbcq")); | |
| 3135 | - m.put("fzbc_m", m.get("fzbcz")); | |
| 3136 | - m.put("fzbc_a", m.get("fzbcw")); | |
| 3137 | - m.put("dtbc", m.get("dtbcq")); | |
| 3138 | - m.put("dtbc_m", m.get("dtbcz")); | |
| 3139 | - m.put("dtbc_a", m.get("dtbcw")); | |
| 3140 | - m.put("djg", m.get("djgq")); | |
| 3141 | - m.put("djg_m", m.get("djgz")); | |
| 3142 | - m.put("djg_a", m.get("djgw")); | |
| 3143 | - m.put("djg_time", m.get("djgsj")); | |
| 3144 | - m.put("ljzgl", new BigDecimal(m.get("ljgl").toString()).add(new BigDecimal(m.get("ljks").toString()))); | |
| 3145 | - } catch (Exception e) { | |
| 3146 | - // TODO: handle exception | |
| 3147 | - m.put("ljzgl", ""); | |
| 3148 | - continue; | |
| 3149 | - } | |
| 3150 | - } | |
| 3151 | - | |
| 3152 | - if (type != null && type.length() != 0 && type.equals("export")) { | |
| 3153 | - SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"), | |
| 3154 | - sdfSimple = new SimpleDateFormat("yyyyMMdd"); | |
| 3155 | - List<Iterator<?>> listI = new ArrayList<Iterator<?>>(); | |
| 3156 | - Map<String, Object> m = new HashMap<String, Object>(); | |
| 3157 | - ReportUtils ee = new ReportUtils(); | |
| 3158 | - try { | |
| 3159 | - String dateTime = ""; | |
| 3160 | - if (date.equals(date2)) { | |
| 3161 | - m.put("date", date); | |
| 3162 | - dateTime = sdfSimple.format(sdfMonth.parse(date)); | |
| 3163 | - } else { | |
| 3164 | - m.put("date", date + "至" + date2); | |
| 3165 | - dateTime = sdfSimple.format(sdfMonth.parse(date)) | |
| 3166 | - + "-" + sdfSimple.format(sdfMonth.parse(date2)); | |
| 3167 | - } | |
| 3168 | - listI.add(resList.iterator()); | |
| 3169 | - String path = this.getClass().getResource("/").getPath() + "static/pages/forms/"; | |
| 3170 | - ee.excelReplace(listI, new Object[]{m}, path + "mould/dispatchDailySum.xls", | |
| 3171 | - path + "export/" + dateTime + "-调度日报汇总表.xls"); | |
| 3172 | - } catch (Exception e) { | |
| 3173 | - // TODO: handle exception | |
| 3174 | - //e.printStackTrace(); | |
| 3175 | - logger.info("", e); | |
| 3176 | - } | |
| 3177 | - } | |
| 3178 | - | |
| 3179 | - return resList; | |
| 3180 | - } | |
| 3181 | - | |
| 3182 | - @Override | |
| 3183 | - public List<Map<String, Object>> statisticsDailyTj(String gsdm, String fgsdm, String line, String date, String date2, | |
| 3184 | - String xlName, String type,String nature) { | |
| 3185 | - List<ScheduleRealInfo> listAll = new ArrayList<ScheduleRealInfo>(); | |
| 3186 | - List<ScheduleRealInfo> list_s = new ArrayList<ScheduleRealInfo>(); | |
| 3187 | - List<ScheduleRealInfo> lists = new ArrayList<ScheduleRealInfo>(); | |
| 3188 | - List<Object[]> listInterval=new ArrayList<Object[]>(); | |
| 3189 | - line = line.trim(); | |
| 3190 | - if(gsdm.equals("") && fgsdm.equals("") && line.equals("")){ | |
| 3191 | - //查询所有公司 | |
| 3192 | - listAll = scheduleRealInfoRepository.scheduleByDateAndLineTj3(date, date2); | |
| 3193 | - listInterval = calcIntervalRepository.countByDate(date, date2); | |
| 3194 | - } else if (line.equals("")) { | |
| 3195 | - //查询所有线路 | |
| 3196 | - listAll = scheduleRealInfoRepository.scheduleByDateAndLineTj(line, date, date2, gsdm, fgsdm); | |
| 3197 | - listInterval = calcIntervalRepository.countByDateAndLine(gsdm, fgsdm, date, date2); | |
| 3198 | - } else { | |
| 3199 | - //查询单条线路 | |
| 3200 | - listAll = scheduleRealInfoRepository.scheduleByDateAndLineTj2(line, date, date2); | |
| 3201 | - listInterval = calcIntervalRepository.countByDateAndLine(line, date, date2); | |
| 3202 | - } | |
| 3203 | - Map<String, Map<String,Object>> mapInterval=new HashMap<String, Map<String,Object>>(); | |
| 3204 | - for (int i = 0; i < listInterval.size(); i++) { | |
| 3205 | - Object[] interval=listInterval.get(i); | |
| 3206 | - String gs=interval[0].toString(); | |
| 3207 | - String fgs=interval[1].toString(); | |
| 3208 | - String xl=interval[2].toString(); | |
| 3209 | - Map<String, Object> m=new HashMap<String,Object>(); | |
| 3210 | - m.put("gs", gs); | |
| 3211 | - m.put("fgs", fgs); | |
| 3212 | - m.put("xl", xl); | |
| 3213 | - m.put("djgAll", interval[3]); | |
| 3214 | - m.put("djgZgf", interval[6]); | |
| 3215 | - m.put("djgWgf", interval[7]); | |
| 3216 | - m.put("djgTime", interval[8]); | |
| 3217 | - mapInterval.put(gs+"-"+fgs+"-"+xl, m); | |
| 3218 | - } | |
| 3219 | - Map<String, Boolean> lineMap=lineService.lineNature(); | |
| 3220 | - List<ScheduleRealInfo> list=new ArrayList<ScheduleRealInfo>(); | |
| 3221 | - for (int i = 0; i < listAll.size(); i++) { | |
| 3222 | - ScheduleRealInfo s=listAll.get(i); | |
| 3223 | - if (nature.equals("0")) { | |
| 3224 | - list.add(s); | |
| 3225 | - }else if(nature.equals("1")){ | |
| 3226 | - if(lineMap.get(s.getXlBm())){ | |
| 3227 | - list.add(s); | |
| 3228 | - } | |
| 3229 | - }else{ | |
| 3230 | - if(!lineMap.get(s.getXlBm())){ | |
| 3231 | - list.add(s); | |
| 3232 | - } | |
| 3233 | - } | |
| 3234 | - } | |
| 3235 | - for (int i = 0; i < list.size(); i++) { | |
| 3236 | - ScheduleRealInfo s = list.get(i); | |
| 3237 | - Set<ChildTaskPlan> cts = s.getcTasks(); | |
| 3238 | - if (cts != null && cts.size() > 0) { | |
| 3239 | - list_s.add(s); | |
| 3240 | - } else { | |
| 3241 | - if (s.getZdsjActual() != null && s.getFcsjActual() != null) { | |
| 3242 | - list_s.add(s); | |
| 3243 | - } | |
| 3244 | - } | |
| 3245 | - } | |
| 3246 | - List<Map<String, Object>> lMap = new ArrayList<Map<String, Object>>(); | |
| 3247 | - for (int i = 0; i < list.size(); i++) { | |
| 3248 | - if (i < list.size() - 1) { | |
| 3249 | - if ((list.get(i+1).getGsBm()+"/"+list.get(i+1).getFgsBm()+"/"+list.get(i+1).getXlBm()).equals( | |
| 3250 | - list.get(i).getGsBm()+"/"+list.get(i).getFgsBm()+"/"+list.get(i).getXlBm())) { | |
| 3251 | - lists.add(list.get(i)); | |
| 3252 | - } else { | |
| 3253 | - lists.add(list.get(i)); | |
| 3254 | - Map<String, Object> mm=new HashMap<String,Object>(); | |
| 3255 | - if(mapInterval.get(lists.get(0).getGsBm()+"-"+lists.get(0).getFgsBm()+"-"+lists.get(0).getXlBm())!=null){ | |
| 3256 | - mm=mapInterval.get(lists.get(0).getGsBm()+"-"+lists.get(0).getFgsBm()+"-"+lists.get(0).getXlBm()); | |
| 3257 | - } | |
| 3258 | - Map<String, Object> map = staticTj(lists,mm); | |
| 3259 | - lMap.add(map); | |
| 3260 | - lists = new ArrayList<ScheduleRealInfo>(); | |
| 3261 | - } | |
| 3262 | - } else { | |
| 3263 | - if ((list.get(i).getGsBm()+"/"+list.get(i).getFgsBm()+"/"+list.get(i).getXlBm()).equals( | |
| 3264 | - list.get(i-1).getGsBm()+"/"+list.get(i-1).getFgsBm()+"/"+list.get(i-1).getXlBm())) { | |
| 3265 | - lists.add(list.get(i)); | |
| 3266 | - Map<String, Object> mm=new HashMap<String,Object>(); | |
| 3267 | - if(mapInterval.get(lists.get(0).getGsBm()+"-"+lists.get(0).getFgsBm()+"-"+lists.get(0).getXlBm())!=null){ | |
| 3268 | - mm=mapInterval.get(lists.get(0).getGsBm()+"-"+lists.get(0).getFgsBm()+"-"+lists.get(0).getXlBm()); | |
| 3269 | - } | |
| 3270 | - Map<String, Object> map = staticTj(lists,mm); | |
| 3271 | - lMap.add(map); | |
| 3272 | - } else { | |
| 3273 | - lists = new ArrayList<ScheduleRealInfo>(); | |
| 3274 | - lists.add(list.get(i)); | |
| 3275 | - Map<String, Object> mm=new HashMap<String,Object>(); | |
| 3276 | - if(mapInterval.get(lists.get(0).getGsBm()+"-"+lists.get(0).getFgsBm()+"-"+lists.get(0).getXlBm())!=null){ | |
| 3277 | - mm=mapInterval.get(lists.get(0).getGsBm()+"-"+lists.get(0).getFgsBm()+"-"+lists.get(0).getXlBm()); | |
| 3278 | - } | |
| 3279 | - Map<String, Object> map = staticTj(lists,mm); | |
| 3280 | - lMap.add(map); | |
| 3281 | - } | |
| 3282 | - } | |
| 3283 | - } | |
| 3284 | - | |
| 3285 | - Collections.sort(lMap, new AccountXlbm()); | |
| 3286 | - Map<String, Object> map = new HashMap<String, Object>(); | |
| 3287 | - map.put("xlName", "合计"); | |
| 3288 | - map.put("fgsName", ""); | |
| 3289 | - map.put("gsName", ""); | |
| 3290 | - double jhyygl = culateService.culateJhgl(list);//计划营运公里 | |
| 3291 | - double jhjcclc = culateService.culateJhJccgl(list);//计划进出场公里(计划空驶公里) | |
| 3292 | - map.put("jhlc", jhyygl); | |
| 3293 | - map.put("jcclc", jhjcclc); | |
| 3294 | - map.put("jhzlc", Arith.add(jhyygl, jhjcclc)); | |
| 3295 | - | |
| 3296 | - double ljgl = culateService.culateLjgl(list_s); | |
| 3297 | - double sjyygl = culateService.culateSjgl(list_s); | |
| 3298 | - double zyygl = Arith.add(sjyygl, ljgl); | |
| 3299 | - double ljks=culateService.culateLjksgl(list_s); | |
| 3300 | - map.put("ljks", ljks); | |
| 3301 | - double sjjccgl = culateService.culateJccgl(list_s); | |
| 3302 | - double sjksgl = culateService.culateKsgl(list_s); | |
| 3303 | - double zksgl = Arith.add(sjjccgl, sjksgl); | |
| 3304 | - map.put("sjzgl", Arith.add(zyygl, zksgl)); | |
| 3305 | - map.put("sjgl", zyygl); | |
| 3306 | - map.put("sjksgl", zksgl); | |
| 3307 | - | |
| 3308 | - double ssgl = culateService.culateLbgl(list); | |
| 3309 | - map.put("ssgl", ssgl); | |
| 3310 | - //计划+临加-少驶=实驶 | |
| 3311 | - double jl = Arith.sub(Arith.add(jhyygl, ljgl), ssgl); | |
| 3312 | - if (jl == zyygl) { | |
| 3313 | - map.put("zt", 0); | |
| 3314 | - } else { | |
| 3315 | - map.put("zt", 1); | |
| 3316 | - } | |
| 3317 | - map.put("ssgl_lz", culateService.culateCJLC(list, "路阻")); | |
| 3318 | - map.put("ssgl_dm", culateService.culateCJLC(list, "吊慢")); | |
| 3319 | - map.put("ssgl_gz", culateService.culateCJLC(list, "故障")); | |
| 3320 | - map.put("ssgl_jf", culateService.culateCJLC(list, "纠纷")); | |
| 3321 | - map.put("ssgl_zs", culateService.culateCJLC(list, "肇事")); | |
| 3322 | - map.put("ssgl_qr", culateService.culateCJLC(list, "缺人")); | |
| 3323 | - map.put("ssgl_qc", culateService.culateCJLC(list, "缺车")); | |
| 3324 | - map.put("ssgl_kx", culateService.culateCJLC(list, "客稀")); | |
| 3325 | - map.put("ssgl_qh", culateService.culateCJLC(list, "气候")); | |
| 3326 | - map.put("ssgl_yw", culateService.culateCJLC(list, "援外")); | |
| 3327 | - map.put("ssgl_ljpm", culateService.culateCJLC(list, "路救抛锚")); | |
| 3328 | - double ssgl_pc = culateService.culateCJLC(list, "配车"); | |
| 3329 | - double ssgl_by = culateService.culateCJLC(list, "保养"); | |
| 3330 | - double ssgl_cj = culateService.culateCJLC(list, "抽减"); | |
| 3331 | - double ssgl_qt = culateService.culateCJLC(list, "其他"); | |
| 3332 | - map.put("ssgl_other", Arith.add(Arith.add(ssgl_pc, ssgl_by), Arith.add(ssgl_cj, ssgl_qt))); | |
| 3333 | - | |
| 3334 | - map.put("ssbc", culateService.culateLbbc(list)); | |
| 3335 | - map.put("ljgl", ljgl); | |
| 3336 | - map.put("jhbc", culateService.culateJhbc(list, "")); | |
| 3337 | - map.put("jhbc_m", culateService.culateJhbc(list, "zgf")); | |
| 3338 | - map.put("jhbc_a", culateService.culateJhbc(list, "wgf")); | |
| 3339 | - map.put("sjbc", culateService.culateSjbc(list_s, "")); | |
| 3340 | - map.put("sjbc_m", culateService.culateSjbc(list_s, "zgf")); | |
| 3341 | - map.put("sjbc_a", culateService.culateSjbc(list_s, "wgf")); | |
| 3342 | - map.put("ljbc", culateService.culateLjbc(list_s, "")); | |
| 3343 | - map.put("ljbc_m", culateService.culateLjbc(list_s, "zgf")); | |
| 3344 | - map.put("ljbc_a", culateService.culateLjbc(list_s, "wgf")); | |
| 3345 | - map.put("fzbc", culateService.culateFzbc(list_s, "")); | |
| 3346 | - map.put("fzbc_m", culateService.culateFzbc(list_s, "zgf")); | |
| 3347 | - map.put("fzbc_a", culateService.culateFzbc(list_s, "wgf")); | |
| 3348 | - map.put("dtbc", 0); | |
| 3349 | - map.put("dtbc_m", 0); | |
| 3350 | - map.put("dtbc_a", 0); | |
| 3351 | - if (list.size() > 0) { | |
| 3352 | - int djg = 0, djg_m = 0, djg_a = 0, djg_time = 0; | |
| 3353 | - for (Map<String, Object> m : lMap) { | |
| 3354 | - if (m.containsKey("djg") && m.get("djg") != null) | |
| 3355 | - djg += Integer.valueOf(m.get("djg").toString()); | |
| 3356 | - if (m.containsKey("djg_m") && m.get("djg_m") != null) | |
| 3357 | - djg_m += Integer.valueOf(m.get("djg_m").toString()); | |
| 3358 | - if (m.containsKey("djg_a") && m.get("djg_a") != null) | |
| 3359 | - djg_a += Integer.valueOf(m.get("djg_a").toString()); | |
| 3360 | - if (m.containsKey("djg_time") && m.get("djg_time") != null) { | |
| 3361 | - int t = Integer.valueOf(m.get("djg_time").toString()); | |
| 3362 | - if (t > djg_time) | |
| 3363 | - djg_time = t; | |
| 3364 | - } | |
| 3365 | - } | |
| 3366 | - map.put("djg", djg); | |
| 3367 | - map.put("djg_m", djg_m); | |
| 3368 | - map.put("djg_a", djg_a); | |
| 3369 | - map.put("djg_time", djg_time); | |
| 3370 | -// Map<String, Object> m_=culateService.culateDjg(list_s, list.get(0).getXlBm()); | |
| 3371 | -// map.put("djg", m_.get("djgcsq")); | |
| 3372 | -// map.put("djg_m", m_.get("djgcsz")); | |
| 3373 | -// map.put("djg_a", m_.get("djgcsw")); | |
| 3374 | -// map.put("djg_time", m_.get("djgsj")); | |
| 3375 | - } else { | |
| 3376 | - map.put("djg", "0"); | |
| 3377 | - map.put("djg_m", "0"); | |
| 3378 | - map.put("djg_a", "0"); | |
| 3379 | - map.put("djg_time", "0"); | |
| 3380 | - } | |
| 3381 | - lMap.add(map); | |
| 3382 | - | |
| 3383 | - if (type != null && type.length() != 0 && type.equals("export")) { | |
| 3384 | - SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"), | |
| 3385 | - sdfSimple = new SimpleDateFormat("yyyyMMdd"); | |
| 3386 | - List<Iterator<?>> listI = new ArrayList<Iterator<?>>(); | |
| 3387 | - Map<String, Object> m = new HashMap<String, Object>(); | |
| 3388 | - m.put("date", date + "至" + date2); | |
| 3389 | - ReportUtils ee = new ReportUtils(); | |
| 3390 | - try { | |
| 3391 | - String dateTime = ""; | |
| 3392 | - if (date.equals(date2)) { | |
| 3393 | - dateTime = sdfSimple.format(sdfMonth.parse(date)); | |
| 3394 | - } else { | |
| 3395 | - dateTime = sdfSimple.format(sdfMonth.parse(date)) | |
| 3396 | - + "-" + sdfSimple.format(sdfMonth.parse(date2)); | |
| 3397 | - } | |
| 3398 | - listI.add(lMap.iterator()); | |
| 3399 | - String path = this.getClass().getResource("/").getPath() + "static/pages/forms/"; | |
| 3400 | - ee.excelReplace(listI, new Object[]{m}, path + "mould/statisticsDaily_2.xls", | |
| 3401 | - path + "export/" + dateTime + "-" + xlName + "-统计日报.xls"); | |
| 3402 | - } catch (Exception e) { | |
| 3403 | - // TODO: handle exception | |
| 3404 | - //e.printStackTrace(); | |
| 3405 | - logger.info("", e); | |
| 3406 | - } | |
| 3407 | - } | |
| 3408 | - | |
| 3409 | - if (type != null && type.length() != 0 && type.equals("exportAll")) { | |
| 3410 | - List<Map<String, Object>> tempList = new ArrayList<Map<String, Object>>(); | |
| 3411 | - Map<String, Map<String, Object>> tempMap = new HashMap<String, Map<String, Object>>(); | |
| 3412 | - List<Map<String, Object>> removeList = new ArrayList<Map<String, Object>>(); | |
| 3413 | - for(Map<String, Object> m : lMap){ | |
| 3414 | - if(m.get("gsName") != null && m.get("gsName").toString().trim().length() > 0 | |
| 3415 | - && m.get("gsName").toString().trim().contains("临港")){ | |
| 3416 | - removeList.add(m); | |
| 3417 | - } | |
| 3418 | - } | |
| 3419 | - for(Map<String, Object> m : removeList){ | |
| 3420 | - lMap.remove(m); | |
| 3421 | - } | |
| 3422 | - for(Map<String, Object> m : lMap){ | |
| 3423 | - if(m.get("gsName") != null && m.get("gsName").toString().trim().length() > 0){ | |
| 3424 | - String gsName = m.get("gsName").toString().trim(); | |
| 3425 | - Map<String, Object> temp = new HashMap<String, Object>(); | |
| 3426 | - if(tempMap.get(gsName) != null){ | |
| 3427 | - temp = tempMap.get(gsName); | |
| 3428 | - } else { | |
| 3429 | - temp.put("gsName", gsName); | |
| 3430 | - temp.put("fgsName", "小计"); | |
| 3431 | - temp.put("xlName", ""); | |
| 3432 | - tempList.add(temp); | |
| 3433 | - tempMap.put(gsName, temp); | |
| 3434 | - } | |
| 3435 | - for(String key : m.keySet()){ | |
| 3436 | - try { | |
| 3437 | - temp.put(key, new BigDecimal(m.get(key).toString()).add( | |
| 3438 | - new BigDecimal(temp.get(key)!=null?temp.get(key).toString():"0"))); | |
| 3439 | - } catch (Exception e) { | |
| 3440 | - // TODO: handle exception | |
| 3441 | - } | |
| 3442 | - } | |
| 3443 | - } | |
| 3444 | - } | |
| 3445 | - lMap.addAll(lMap.size()>0?lMap.size()-1:0, tempList); | |
| 3446 | - | |
| 3447 | - SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"), | |
| 3448 | - sdfSimple = new SimpleDateFormat("yyyyMMdd"); | |
| 3449 | - List<Iterator<?>> listI = new ArrayList<Iterator<?>>(); | |
| 3450 | - Map<String, Object> m = new HashMap<String, Object>(); | |
| 3451 | - m.put("date", date + "至" + date2); | |
| 3452 | - ReportUtils ee = new ReportUtils(); | |
| 3453 | - try { | |
| 3454 | - String dateTime = ""; | |
| 3455 | - if (date.equals(date2)) { | |
| 3456 | - dateTime = sdfSimple.format(sdfMonth.parse(date)); | |
| 3457 | - } else { | |
| 3458 | - dateTime = sdfSimple.format(sdfMonth.parse(date)) | |
| 3459 | - + "-" + sdfSimple.format(sdfMonth.parse(date2)); | |
| 3460 | - } | |
| 3461 | - listI.add(lMap.iterator()); | |
| 3462 | - String path = this.getClass().getResource("/").getPath() + "static/pages/forms/"; | |
| 3463 | - ee.excelReplace(listI, new Object[]{m}, path + "mould/statisticsDaily_4.xls", | |
| 3464 | - path + "export/" + dateTime + "-全部公司-统计日报.xls"); | |
| 3465 | - } catch (Exception e) { | |
| 3466 | - // TODO: handle exception | |
| 3467 | - //e.printStackTrace(); | |
| 3468 | - logger.info("", e); | |
| 3469 | - } | |
| 3470 | - } | |
| 3471 | - | |
| 3472 | - return lMap; | |
| 3473 | - } | |
| 3474 | - | |
| 3475 | - @Override | |
| 3476 | - public List<Map<String, Object>> statisticsDailyTjHb(String gsdm, String fgsdm, String line, String date, String date2, | |
| 3477 | - String xlName, String type,String nature) { | |
| 3478 | - List<ScheduleRealInfo> listAll = new ArrayList<ScheduleRealInfo>(); | |
| 3479 | - List<ScheduleRealInfo> list_s = new ArrayList<ScheduleRealInfo>(); | |
| 3480 | - List<ScheduleRealInfo> lists = new ArrayList<ScheduleRealInfo>(); | |
| 3481 | - List<Object[]> listInterval=new ArrayList<Object[]>(); | |
| 3482 | - | |
| 3483 | - line = line.trim(); | |
| 3484 | - if (line.equals("")) { | |
| 3485 | - //查询所有线路 | |
| 3486 | - listAll = scheduleRealInfoRepository.scheduleByDateAndLineTj(line, date, date2, gsdm, fgsdm); | |
| 3487 | - listInterval = calcIntervalRepository.countByDateAndLine(gsdm, fgsdm, date, date2); | |
| 3488 | - } else { | |
| 3489 | - //查询单条线路 | |
| 3490 | - listAll = scheduleRealInfoRepository.scheduleByDateAndLineTj2(line, date, date2); | |
| 3491 | - listInterval = calcIntervalRepository.countByDateAndLine(line, date, date2); | |
| 3492 | - } | |
| 3493 | - Map<String, Map<String,Object>> mapInterval=new HashMap<>(); | |
| 3494 | - for (int i = 0; i < listInterval.size(); i++) { | |
| 3495 | - Object[] interval=listInterval.get(i); | |
| 3496 | - String gs=interval[0].toString(); | |
| 3497 | - String fgs=interval[1].toString(); | |
| 3498 | - String xl=interval[2].toString(); | |
| 3499 | - Map<String, Object> m=new HashMap<String,Object>(); | |
| 3500 | - m.put("gs", gs); | |
| 3501 | - m.put("fgs", fgs); | |
| 3502 | - m.put("xl", xl); | |
| 3503 | - m.put("djgAll", interval[3]); | |
| 3504 | - m.put("djgZgf", interval[6]); | |
| 3505 | - m.put("djgWgf", interval[7]); | |
| 3506 | - m.put("djgTime", interval[8]); | |
| 3507 | - mapInterval.put(gs+"-"+fgs+"-"+xl, m); | |
| 3508 | - } | |
| 3509 | - | |
| 3510 | - Map<String, Boolean> lineMap=lineService.lineNature(); | |
| 3511 | - List<ScheduleRealInfo> list=new ArrayList<ScheduleRealInfo>(); | |
| 3512 | - for (int i = 0; i < listAll.size(); i++) { | |
| 3513 | - ScheduleRealInfo s=listAll.get(i); | |
| 3514 | - if (nature.equals("0")) { | |
| 3515 | - list.add(s); | |
| 3516 | - }else if(nature.equals("1")){ | |
| 3517 | - if(lineMap.get(s.getXlBm())){ | |
| 3518 | - list.add(s); | |
| 3519 | - } | |
| 3520 | - }else{ | |
| 3521 | - if(!lineMap.get(s.getXlBm())){ | |
| 3522 | - list.add(s); | |
| 3523 | - } | |
| 3524 | - } | |
| 3525 | - } | |
| 3526 | - for (int i = 0; i < list.size(); i++) { | |
| 3527 | - ScheduleRealInfo s = list.get(i); | |
| 3528 | - Set<ChildTaskPlan> cts = s.getcTasks(); | |
| 3529 | - if (cts != null && cts.size() > 0) { | |
| 3530 | - list_s.add(s); | |
| 3531 | - } else { | |
| 3532 | - if (s.getZdsjActual() != null && s.getFcsjActual() != null) { | |
| 3533 | - list_s.add(s); | |
| 3534 | - } | |
| 3535 | - } | |
| 3536 | - } | |
| 3537 | - List<Map<String, Object>> lMap = new ArrayList<Map<String, Object>>(); | |
| 3538 | - for (int i = 0; i < list.size(); i++) { | |
| 3539 | - if (i < list.size() - 1) { | |
| 3540 | - if ((list.get(i + 1).getFgsBm()+list.get(i + 1).getXlBm()).equals(list.get(i).getFgsBm()+list.get(i).getXlBm())) { | |
| 3541 | - lists.add(list.get(i)); | |
| 3542 | - } else { | |
| 3543 | - lists.add(list.get(i)); | |
| 3544 | - Map<String, Object> mm=new HashMap<String,Object>(); | |
| 3545 | - if(mapInterval.get(lists.get(0).getGsBm()+"-"+lists.get(0).getFgsBm()+"-"+lists.get(0).getXlBm())!=null){ | |
| 3546 | - mm=mapInterval.get(lists.get(0).getGsBm()+"-"+lists.get(0).getFgsBm()+"-"+lists.get(0).getXlBm()); | |
| 3547 | - } | |
| 3548 | - Map<String, Object> map = staticTj(lists,mm); | |
| 3549 | - lMap.add(map); | |
| 3550 | - lists = new ArrayList<ScheduleRealInfo>(); | |
| 3551 | - } | |
| 3552 | - } else { | |
| 3553 | - if ((list.get(i).getFgsBm()+list.get(i).getXlBm()).equals(list.get(i - 1).getFgsBm()+list.get(i - 1).getXlBm())) { | |
| 3554 | - lists.add(list.get(i)); | |
| 3555 | - Map<String, Object> mm=new HashMap<String,Object>(); | |
| 3556 | - if(mapInterval.get(lists.get(0).getGsBm()+"-"+lists.get(0).getFgsBm()+"-"+lists.get(0).getXlBm())!=null){ | |
| 3557 | - mm=mapInterval.get(lists.get(0).getGsBm()+"-"+lists.get(0).getFgsBm()+"-"+lists.get(0).getXlBm()); | |
| 3558 | - } | |
| 3559 | - Map<String, Object> map = staticTj(lists,mm); | |
| 3560 | - lMap.add(map); | |
| 3561 | - } else { | |
| 3562 | - lists = new ArrayList<ScheduleRealInfo>(); | |
| 3563 | - lists.add(list.get(i)); | |
| 3564 | - Map<String, Object> mm=new HashMap<String,Object>(); | |
| 3565 | - if(mapInterval.get(lists.get(0).getGsBm()+"-"+lists.get(0).getFgsBm()+"-"+lists.get(0).getXlBm())!=null){ | |
| 3566 | - mm=mapInterval.get(lists.get(0).getGsBm()+"-"+lists.get(0).getFgsBm()+"-"+lists.get(0).getXlBm()); | |
| 3567 | - } | |
| 3568 | - Map<String, Object> map = staticTj(lists,mm); | |
| 3569 | - lMap.add(map); | |
| 3570 | - } | |
| 3571 | - } | |
| 3572 | - } | |
| 3573 | - | |
| 3574 | - Collections.sort(lMap, new AccountXlbm()); | |
| 3575 | - Map<String, Object> map = new HashMap<String, Object>(); | |
| 3576 | - map.put("xlBm", "hj"); | |
| 3577 | - map.put("xlName", "合计"); | |
| 3578 | - map.put("fgsBm", ""); | |
| 3579 | - map.put("fgsName", ""); | |
| 3580 | - map.put("gsBm", ""); | |
| 3581 | - double jhyygl = culateService.culateJhgl(list);//计划营运公里 | |
| 3582 | - double jhjcclc = culateService.culateJhJccgl(list);//计划进出场公里(计划空驶公里) | |
| 3583 | - map.put("jhlc", jhyygl); | |
| 3584 | - map.put("jcclc", jhjcclc); | |
| 3585 | - map.put("jhzlc", Arith.add(jhyygl, jhjcclc)); | |
| 3586 | - | |
| 3587 | - double ljgl = culateService.culateLjgl(list_s); | |
| 3588 | - double sjyygl = culateService.culateSjgl(list_s); | |
| 3589 | - double zyygl = Arith.add(sjyygl, ljgl); | |
| 3590 | - double ljks=culateService.culateLjksgl(list_s); | |
| 3591 | - map.put("ljks", ljks); | |
| 3592 | - double sjjccgl = culateService.culateJccgl(list_s); | |
| 3593 | - double sjksgl = culateService.culateKsgl(list_s); | |
| 3594 | - double zksgl = Arith.add(sjjccgl, sjksgl); | |
| 3595 | - map.put("sjzgl", Arith.add(zyygl, zksgl)); | |
| 3596 | - map.put("sjgl", zyygl); | |
| 3597 | - map.put("sjksgl", zksgl); | |
| 3598 | - | |
| 3599 | - double ssgl = culateService.culateLbgl(list); | |
| 3600 | - map.put("ssgl", ssgl); | |
| 3601 | - //计划+临加-少驶=实驶 | |
| 3602 | - double jl = Arith.sub(Arith.add(jhyygl, ljgl), ssgl); | |
| 3603 | - if (jl == zyygl) { | |
| 3604 | - map.put("zt", 0); | |
| 3605 | - } else { | |
| 3606 | - map.put("zt", 1); | |
| 3607 | - } | |
| 3608 | - map.put("ssgl_lz", culateService.culateCJLC(list, "路阻")); | |
| 3609 | - map.put("ssgl_dm", culateService.culateCJLC(list, "吊慢")); | |
| 3610 | - map.put("ssgl_gz", culateService.culateCJLC(list, "故障")); | |
| 3611 | - map.put("ssgl_jf", culateService.culateCJLC(list, "纠纷")); | |
| 3612 | - map.put("ssgl_zs", culateService.culateCJLC(list, "肇事")); | |
| 3613 | - map.put("ssgl_qr", culateService.culateCJLC(list, "缺人")); | |
| 3614 | - map.put("ssgl_qc", culateService.culateCJLC(list, "缺车")); | |
| 3615 | - map.put("ssgl_kx", culateService.culateCJLC(list, "客稀")); | |
| 3616 | - map.put("ssgl_qh", culateService.culateCJLC(list, "气候")); | |
| 3617 | - map.put("ssgl_yw", culateService.culateCJLC(list, "援外")); | |
| 3618 | - map.put("ssgl_ljpm", culateService.culateCJLC(list, "路救抛锚")); | |
| 3619 | - double ssgl_pc = culateService.culateCJLC(list, "配车"); | |
| 3620 | - double ssgl_by = culateService.culateCJLC(list, "保养"); | |
| 3621 | - double ssgl_cj = culateService.culateCJLC(list, "抽减"); | |
| 3622 | - double ssgl_qt = culateService.culateCJLC(list, "其他"); | |
| 3623 | - map.put("ssgl_other", Arith.add(Arith.add(ssgl_pc, ssgl_by), Arith.add(ssgl_cj, ssgl_qt))); | |
| 3624 | - | |
| 3625 | - map.put("ssbc", culateService.culateLbbc(list)); | |
| 3626 | - map.put("ljgl", ljgl); | |
| 3627 | - map.put("jhbc", culateService.culateJhbc(list, "")); | |
| 3628 | - map.put("jhbc_m", culateService.culateJhbc(list, "zgf")); | |
| 3629 | - map.put("jhbc_a", culateService.culateJhbc(list, "wgf")); | |
| 3630 | - map.put("sjbc", culateService.culateSjbc(list_s, "")); | |
| 3631 | - map.put("sjbc_m", culateService.culateSjbc(list_s, "zgf")); | |
| 3632 | - map.put("sjbc_a", culateService.culateSjbc(list_s, "wgf")); | |
| 3633 | - map.put("ljbc", culateService.culateLjbc(list_s, "")); | |
| 3634 | - map.put("ljbc_m", culateService.culateLjbc(list_s, "zgf")); | |
| 3635 | - map.put("ljbc_a", culateService.culateLjbc(list_s, "wgf")); | |
| 3636 | - map.put("fzbc", culateService.culateFzbc(list_s, "")); | |
| 3637 | - map.put("fzbc_m", culateService.culateFzbc(list_s, "zgf")); | |
| 3638 | - map.put("fzbc_a", culateService.culateFzbc(list_s, "wgf")); | |
| 3639 | - map.put("dtbc", 0); | |
| 3640 | - map.put("dtbc_m", 0); | |
| 3641 | - map.put("dtbc_a", 0); | |
| 3642 | - if (list.size() > 0) { | |
| 3643 | - int djg = 0, djg_m = 0, djg_a = 0, djg_time = 0; | |
| 3644 | - for (Map<String, Object> m : lMap) { | |
| 3645 | - if (m.containsKey("djg") && m.get("djg") != null) | |
| 3646 | - djg += Integer.valueOf(m.get("djg").toString()); | |
| 3647 | - if (m.containsKey("djg_m") && m.get("djg_m") != null) | |
| 3648 | - djg_m += Integer.valueOf(m.get("djg_m").toString()); | |
| 3649 | - if (m.containsKey("djg_a") && m.get("djg_a") != null) | |
| 3650 | - djg_a += Integer.valueOf(m.get("djg_a").toString()); | |
| 3651 | - if (m.containsKey("djg_time") && m.get("djg_time") != null) { | |
| 3652 | - int t = Integer.valueOf(m.get("djg_time").toString()); | |
| 3653 | - if (t > djg_time) | |
| 3654 | - djg_time = t; | |
| 3655 | - } | |
| 3656 | - } | |
| 3657 | - map.put("djg", djg); | |
| 3658 | - map.put("djg_m", djg_m); | |
| 3659 | - map.put("djg_a", djg_a); | |
| 3660 | - map.put("djg_time", djg_time); | |
| 3661 | - } else { | |
| 3662 | - map.put("djg", "0"); | |
| 3663 | - map.put("djg_m", "0"); | |
| 3664 | - map.put("djg_a", "0"); | |
| 3665 | - map.put("djg_time", "0"); | |
| 3666 | - } | |
| 3667 | - lMap.add(map); | |
| 3668 | - return lMap; | |
| 3669 | - } | |
| 3670 | - | |
| 3671 | - @Override | |
| 3672 | - public Map<String, Object> scheduleDaily(String line, String date) { | |
| 3673 | - Map<String, String> tempMap = null; | |
| 3674 | - List<ScheduleRealInfo> scheduleRealInfos = scheduleRealInfoRepository.scheduleByDateAndLine(line, date); | |
| 3675 | - Map<String, Object> map = new HashMap<String, Object>(); | |
| 3676 | - Double jhlc = 0.00; | |
| 3677 | - Float sjgl = 0f, ssgl = 0f, ssgl_lz = 0f, ssgl_dm = 0f, ssgl_gz = 0f, ssgl_jf = 0f, ssgl_zs = 0f, | |
| 3678 | - ssgl_qr = 0f, ssgl_qc = 0f, ssgl_kx = 0f, ssgl_qh = 0f, ssgl_yw = 0f, ssgl_ljpm = 0f, | |
| 3679 | - ssgl_other = 0f, ljgl = 0f; | |
| 3680 | - int jhbc = 0; | |
| 3681 | - for (ScheduleRealInfo scheduleRealInfo : scheduleRealInfos) { | |
| 3682 | - if (scheduleRealInfo != null) { | |
| 3683 | - //计算里程(包括子任务) | |
| 3684 | - jhlc += scheduleRealInfo.getJhlc(); | |
| 3685 | - Set<ChildTaskPlan> childTaskPlans = scheduleRealInfo.getcTasks(); | |
| 3686 | - if (!childTaskPlans.isEmpty()) { | |
| 3687 | - Iterator<ChildTaskPlan> it = childTaskPlans.iterator(); | |
| 3688 | - while (it.hasNext()) { | |
| 3689 | - ChildTaskPlan childTaskPlan = it.next(); | |
| 3690 | - //是否烂班,烂班就是少驶 | |
| 3691 | - if (!childTaskPlan.isDestroy()) { | |
| 3692 | - sjgl += childTaskPlan.getMileage(); | |
| 3693 | - } else { | |
| 3694 | - ssgl += childTaskPlan.getMileage(); | |
| 3695 | - if (childTaskPlan.getDestroyReason().equals("路阻")) { | |
| 3696 | - ssgl_lz += childTaskPlan.getMileage(); | |
| 3697 | - } else if (childTaskPlan.getDestroyReason().equals("吊慢")) { | |
| 3698 | - ssgl_dm += childTaskPlan.getMileage(); | |
| 3699 | - } else if (childTaskPlan.getDestroyReason().equals("故障")) { | |
| 3700 | - ssgl_gz += childTaskPlan.getMileage(); | |
| 3701 | - } else if (childTaskPlan.getDestroyReason().equals("纠纷")) { | |
| 3702 | - ssgl_jf += childTaskPlan.getMileage(); | |
| 3703 | - } else if (childTaskPlan.getDestroyReason().equals("肇事")) { | |
| 3704 | - ssgl_zs += childTaskPlan.getMileage(); | |
| 3705 | - } else if (childTaskPlan.getDestroyReason().equals("缺人")) { | |
| 3706 | - ssgl_qr += childTaskPlan.getMileage(); | |
| 3707 | - } else if (childTaskPlan.getDestroyReason().equals("缺车")) { | |
| 3708 | - ssgl_qc += childTaskPlan.getMileage(); | |
| 3709 | - } else if (childTaskPlan.getDestroyReason().equals("客稀")) { | |
| 3710 | - ssgl_kx += childTaskPlan.getMileage(); | |
| 3711 | - } else if (childTaskPlan.getDestroyReason().equals("气候")) { | |
| 3712 | - ssgl_qh += childTaskPlan.getMileage(); | |
| 3713 | - } else if (childTaskPlan.getDestroyReason().equals("援外")) { | |
| 3714 | - ssgl_yw += childTaskPlan.getMileage(); | |
| 3715 | - } else if (childTaskPlan.getDestroyReason().equals("路救抛锚")) { | |
| 3716 | - ssgl_ljpm += childTaskPlan.getMileage(); | |
| 3717 | - } else { | |
| 3718 | - ssgl_other += childTaskPlan.getMileage(); | |
| 3719 | - } | |
| 3720 | - } | |
| 3721 | - //临加公里 | |
| 3722 | - if (childTaskPlan.getType1().equals("临加")) { | |
| 3723 | - ljgl += childTaskPlan.getMileage(); | |
| 3724 | - } | |
| 3725 | - } | |
| 3726 | - } | |
| 3727 | - //班次 | |
| 3728 | - scheduleRealInfo.getFcsjT(); | |
| 3729 | - scheduleRealInfo.getFcsjActualTime(); | |
| 3730 | - } | |
| 3731 | - } | |
| 3732 | - map.put("jhlc", jhlc); | |
| 3733 | - map.put("sjgl", sjgl); | |
| 3734 | - map.put("ssgl", ssgl); | |
| 3735 | - map.put("ssgl_lz", ssgl_lz); | |
| 3736 | - map.put("ssgl_dm", ssgl_dm); | |
| 3737 | - map.put("ssgl_gz", ssgl_gz); | |
| 3738 | - map.put("ssgl_jf", ssgl_jf); | |
| 3739 | - map.put("ssgl_zs", ssgl_zs); | |
| 3740 | - map.put("ssgl_qr", ssgl_qr); | |
| 3741 | - map.put("ssgl_qc", ssgl_qc); | |
| 3742 | - map.put("ssgl_kx", ssgl_kx); | |
| 3743 | - map.put("ssgl_qh", ssgl_qh); | |
| 3744 | - map.put("ssgl_yw", ssgl_yw); | |
| 3745 | - map.put("ssgl_ljpm", ssgl_ljpm); | |
| 3746 | - map.put("ssgl_other", ssgl_other); | |
| 3747 | - map.put("ljgl", ljgl); | |
| 3748 | - | |
| 3749 | - map.put("jhbc", scheduleRealInfos.size()); | |
| 3750 | - return null; | |
| 3751 | - } | |
| 3752 | - | |
| 3753 | - @Override | |
| 3754 | - public int countByLineCodeAndDate(String xlBm, String schDate) { | |
| 3755 | - return scheduleRealInfoRepository.countByLineCodeAndDate(xlBm + "", schDate); | |
| 3756 | - } | |
| 3757 | - | |
| 3758 | - @Override | |
| 3759 | - public List<ScheduleRealInfo> findByLineCodeAndDate(String xlBm, String schDate) { | |
| 3760 | - return scheduleRealInfoRepository.findByLineCodeAndDate(xlBm + "", schDate); | |
| 3761 | - } | |
| 3762 | - | |
| 3763 | - @Override | |
| 3764 | - public void deleteByLineCodeAndDate(String xlBm, String schDate) { | |
| 3765 | - scheduleRealInfoRepository.deleteByLineCodeAndDate(xlBm + "", schDate); | |
| 3766 | - } | |
| 3767 | - | |
| 3768 | - @Override | |
| 3769 | - public Long getMaxId() { | |
| 3770 | - return scheduleRealInfoRepository.getMaxId(); | |
| 3771 | - } | |
| 3772 | - | |
| 3773 | - @Override | |
| 3774 | - public List<ScheduleRealInfo> realScheduleList(String line, String date) { | |
| 3775 | - List<ScheduleRealInfo> list = new ArrayList<ScheduleRealInfo>(); | |
| 3776 | - String lpName = "lpName"; | |
| 3777 | - String zdsj = ""; | |
| 3778 | - String zdsjActual = ""; | |
| 3779 | - String zdsj1 = ""; | |
| 3780 | - String zdsjActual1 = ""; | |
| 3781 | - List<ScheduleRealInfo> listInfo = scheduleRealInfoRepository.scheduleDdrb(line, date); | |
| 3782 | - | |
| 3783 | - /* | |
| 3784 | - * 对计划发车时间相同的班次进行排序 out最前 in最后 | |
| 3785 | - */ | |
| 3786 | - SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm"); | |
| 3787 | - SimpleDateFormat sdfnyr =new SimpleDateFormat("yyyy-MM-dd"); | |
| 3788 | - String minfcsj = "02:00"; | |
| 3789 | - List<Line> lineList = lineRepository.findLineByCode(line); | |
| 3790 | - if (lineList.size() > 0) { | |
| 3791 | - String sqlMinYysj = "select start_opt from bsth_c_line_config where " | |
| 3792 | - + " id = (" | |
| 3793 | - + "select max(id) from bsth_c_line_config where line ='" + lineList.get(0).getId() + "'" | |
| 3794 | - + ")"; | |
| 3795 | - minfcsj = jdbcTemplate.queryForObject(sqlMinYysj, String.class); | |
| 3796 | - } | |
| 3797 | - String[] minSjs = minfcsj.split(":"); | |
| 3798 | - Long minSj = Long.parseLong(minSjs[0]) * 60 + Long.parseLong(minSjs[1]); | |
| 3799 | - for (int i = 0; i < listInfo.size(); i++) { | |
| 3800 | - ScheduleRealInfo s = listInfo.get(i); | |
| 3801 | - if (s.getBcType().equals("out")) { | |
| 3802 | - s.setRemark("1"); | |
| 3803 | - } else if (s.getBcType().equals("in")) { | |
| 3804 | - s.setRemark("3"); | |
| 3805 | - } else { | |
| 3806 | - s.setRemark("2"); | |
| 3807 | - } | |
| 3808 | - String[] fcsj = s.getFcsj().split(":"); | |
| 3809 | - Long fcsjL = Long.parseLong(fcsj[0]) * 60 + Long.parseLong(fcsj[1]); | |
| 3810 | - | |
| 3811 | - Long fscjT = 0L; | |
| 3812 | - if (fcsjL < minSj) { | |
| 3813 | - Calendar calendar = new GregorianCalendar(); | |
| 3814 | - calendar.setTime(s.getScheduleDate()); | |
| 3815 | - calendar.add(calendar.DATE, 1); | |
| 3816 | - Date date_sch= calendar.getTime(); | |
| 3817 | - try { | |
| 3818 | - fscjT = sdf.parse(sdfnyr.format(date_sch) + " " + s.getFcsj()).getTime(); | |
| 3819 | - } catch (ParseException e) { | |
| 3820 | - // TODO Auto-generated catch block | |
| 3821 | - e.printStackTrace(); | |
| 3822 | - } | |
| 3823 | - | |
| 3824 | - } else { | |
| 3825 | - try { | |
| 3826 | - fscjT = sdf.parse(s.getScheduleDateStr() + " " + s.getFcsj()).getTime(); | |
| 3827 | - } catch (ParseException e) { | |
| 3828 | - // TODO Auto-generated catch block | |
| 3829 | - e.printStackTrace(); | |
| 3830 | - }; | |
| 3831 | - } | |
| 3832 | - s.setFcsjT(fscjT); | |
| 3833 | - } | |
| 3834 | - List<ScheduleRealInfo> listInfo2=new ArrayList<ScheduleRealInfo>(); | |
| 3835 | - listInfo2.addAll(listInfo); | |
| 3836 | - Collections.sort(listInfo, new compareLpFcsjType()); | |
| 3837 | - Collections.sort(listInfo2,new compareDirLpFcsjType()); | |
| 3838 | - for (int i = 0; i < listInfo.size(); i++) { | |
| 3839 | - ScheduleRealInfo t = listInfo.get(i); | |
| 3840 | - if (!lpName.equals(t.getLpName())) { | |
| 3841 | - zdsjActual = t.getZdsjActual(); | |
| 3842 | - zdsj = t.getZdsj(); | |
| 3843 | - t.setZdsjActual(""); | |
| 3844 | - t.setZdsj(""); | |
| 3845 | - } else { | |
| 3846 | - zdsj1 = t.getZdsj(); | |
| 3847 | - zdsjActual1 = t.getZdsjActual(); | |
| 3848 | - t.setZdsjActual(zdsjActual); | |
| 3849 | - t.setZdsj(zdsj); | |
| 3850 | - zdsj = zdsj1; | |
| 3851 | - zdsjActual = zdsjActual1; | |
| 3852 | - } | |
| 3853 | - lpName = t.getLpName(); | |
| 3854 | - list.add(t); | |
| 3855 | - } | |
| 3856 | -/* | |
| 3857 | - List<ScheduleRealInfo> listInfo2 = scheduleRealInfoRepository.scheduleDdrb2(line, date); | |
| 3858 | - for (int i = 0; i < listInfo2.size(); i++) { | |
| 3859 | - ScheduleRealInfo s = listInfo2.get(i); | |
| 3860 | - if (s.getBcType().equals("out")) { | |
| 3861 | - s.setRemark("1"); | |
| 3862 | - } else if (s.getBcType().equals("in")) { | |
| 3863 | - s.setRemark("3"); | |
| 3864 | - } else { | |
| 3865 | - s.setRemark("2"); | |
| 3866 | - } | |
| 3867 | - String[] fcsj = s.getFcsj().split(":"); | |
| 3868 | - Long fcsjL = Long.parseLong(fcsj[0]) * 60 + Long.parseLong(fcsj[1]); | |
| 3869 | - | |
| 3870 | - Long fscjT = 0L; | |
| 3871 | - if (fcsjL < minSj) { | |
| 3872 | - Calendar calendar = new GregorianCalendar(); | |
| 3873 | - calendar.setTime(s.getScheduleDate()); | |
| 3874 | - calendar.add(calendar.DATE, 1); | |
| 3875 | - s.setScheduleDate(calendar.getTime()); | |
| 3876 | - try { | |
| 3877 | - fscjT = sdf.parse(sdf.format(s.getScheduleDate()) + " " + s.getFcsj()).getTime(); | |
| 3878 | - } catch (ParseException e) { | |
| 3879 | - // TODO Auto-generated catch block | |
| 3880 | - e.printStackTrace(); | |
| 3881 | - } | |
| 3882 | - | |
| 3883 | - } else { | |
| 3884 | - try { | |
| 3885 | - fscjT = sdf.parse(s.getScheduleDateStr() + " " + s.getFcsj()).getTime(); | |
| 3886 | - } catch (ParseException e) { | |
| 3887 | - // TODO Auto-generated catch block | |
| 3888 | - e.printStackTrace(); | |
| 3889 | - } | |
| 3890 | - ; | |
| 3891 | - } | |
| 3892 | - s.setFcsjT(fscjT); | |
| 3893 | - }*/ | |
| 3894 | - List<ScheduleRealInfo> xList = new ArrayList<ScheduleRealInfo>(); | |
| 3895 | - List<ScheduleRealInfo> yList = new ArrayList<ScheduleRealInfo>(); | |
| 3896 | - List<ScheduleRealInfo> zList = new ArrayList<ScheduleRealInfo>(); | |
| 3897 | - List<ScheduleRealInfo> newList = new ArrayList<ScheduleRealInfo>(); | |
| 3898 | - if (listInfo2.size() > 0) { | |
| 3899 | - int a = listInfo2.size() % 3; | |
| 3900 | - int b = listInfo2.size() / 3; | |
| 3901 | - int x = 0, y = 0; | |
| 3902 | - if (a == 2) { | |
| 3903 | - x = b + 1; | |
| 3904 | - y = x * 2; | |
| 3905 | - } else if (a == 1) { | |
| 3906 | - x = b + 1; | |
| 3907 | - y = x * 2 - 1; | |
| 3908 | - } else { | |
| 3909 | - x = b; | |
| 3910 | - y = 2 * x; | |
| 3911 | - | |
| 3912 | - } | |
| 3913 | - for (int i = 0; i < listInfo2.size(); i++) { | |
| 3914 | - ScheduleRealInfo s = listInfo2.get(i); | |
| 3915 | - if (i + 1 <= x) { | |
| 3916 | - xList.add(s); | |
| 3917 | - } else if ((i + 1) > x && (i + 1) <= y) { | |
| 3918 | - yList.add(s); | |
| 3919 | - } else { | |
| 3920 | - zList.add(s); | |
| 3921 | - } | |
| 3922 | - } | |
| 3923 | - for (int i = 0; i < x; i++) { | |
| 3924 | - newList.add(xList.get(i)); | |
| 3925 | - if (yList.size() > i) { | |
| 3926 | - newList.add(yList.get(i)); | |
| 3927 | - } else { | |
| 3928 | - newList.add(new ScheduleRealInfo()); | |
| 3929 | - } | |
| 3930 | - if (zList.size() > i) { | |
| 3931 | - newList.add(zList.get(i)); | |
| 3932 | - } else { | |
| 3933 | - newList.add(new ScheduleRealInfo()); | |
| 3934 | - } | |
| 3935 | - | |
| 3936 | - } | |
| 3937 | - } | |
| 3938 | - for (int i = 0; i < newList.size(); i++) { | |
| 3939 | - ScheduleRealInfo t1 = newList.get(i); | |
| 3940 | - for (int j = 0; j < list.size(); j++) { | |
| 3941 | - ScheduleRealInfo t2 = list.get(j); | |
| 3942 | - if (t1.getId() == t2.getId()) { | |
| 3943 | - t1 = t2; | |
| 3944 | - } | |
| 3945 | - } | |
| 3946 | - } | |
| 3947 | - | |
| 3948 | - for (int i = 0; i < newList.size(); i++) { | |
| 3949 | - ScheduleRealInfo t1 = newList.get(i); | |
| 3950 | - String reamrks1 = t1.getRemarks() == null ? "" : t1.getRemarks(); | |
| 3951 | - if (reamrks1.length() > 4) { | |
| 3952 | - t1.setRemarks(reamrks1.substring(0, 4)); | |
| 3953 | - t1.setRemark(reamrks1); | |
| 3954 | - } else { | |
| 3955 | - t1.setRemark(reamrks1); | |
| 3956 | - } | |
| 3957 | - } | |
| 3958 | - return newList; | |
| 3959 | - } | |
| 3960 | - | |
| 3961 | - @Override | |
| 3962 | - public List<ScheduleRealInfo> realScheduleList_zrw(String line, String date) { | |
| 3963 | - List<ScheduleRealInfo> list = new ArrayList<ScheduleRealInfo>(); | |
| 3964 | - String lpName = "lpName"; | |
| 3965 | - String zdsj = ""; | |
| 3966 | - String zdsjActual = ""; | |
| 3967 | - String zdsj1 = ""; | |
| 3968 | - String zdsjActual1 = ""; | |
| 3969 | - List<ScheduleRealInfo> listInfo = scheduleRealInfoRepository.scheduleDdrb(line, date); | |
| 3970 | - | |
| 3971 | - /* | |
| 3972 | - * 对计划发车时间相同的班次进行排序 out最前 in最后 | |
| 3973 | - */ | |
| 3974 | - SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm"); | |
| 3975 | - SimpleDateFormat sdfnyr = new SimpleDateFormat("yyyy-MM-dd"); | |
| 3976 | - | |
| 3977 | - String minfcsj = "02:00"; | |
| 3978 | - List<Line> lineList = lineRepository.findLineByCode(line); | |
| 3979 | - if (lineList.size() > 0) { | |
| 3980 | - String sqlMinYysj = "select start_opt from bsth_c_line_config where " | |
| 3981 | - + " id = (" | |
| 3982 | - + "select max(id) from bsth_c_line_config where line ='" + lineList.get(0).getId() + "'" | |
| 3983 | - + ")"; | |
| 3984 | - minfcsj = jdbcTemplate.queryForObject(sqlMinYysj, String.class); | |
| 3985 | - } | |
| 3986 | - String[] minSjs = minfcsj.split(":"); | |
| 3987 | - Long minSj = Long.parseLong(minSjs[0]) * 60 + Long.parseLong(minSjs[1]); | |
| 3988 | - for (int i = 0; i < listInfo.size(); i++) { | |
| 3989 | - ScheduleRealInfo s = listInfo.get(i); | |
| 3990 | - if (s.getBcType().equals("out")) { | |
| 3991 | - s.setRemark("1"); | |
| 3992 | - } else if (s.getBcType().equals("in")) { | |
| 3993 | - s.setRemark("3"); | |
| 3994 | - } else { | |
| 3995 | - s.setRemark("2"); | |
| 3996 | - } | |
| 3997 | - String[] fcsj = s.getFcsj().split(":"); | |
| 3998 | - Long fcsjL = Long.parseLong(fcsj[0]) * 60 + Long.parseLong(fcsj[1]); | |
| 3999 | - | |
| 4000 | - Long fscjT = 0L; | |
| 4001 | - if (fcsjL < minSj) { | |
| 4002 | - Calendar calendar = new GregorianCalendar(); | |
| 4003 | - calendar.setTime(s.getScheduleDate()); | |
| 4004 | - calendar.add(calendar.DATE, 1); | |
| 4005 | - Date date_sch=calendar.getTime(); | |
| 4006 | - try { | |
| 4007 | - fscjT = sdf.parse(sdfnyr.format(date_sch) + " " + s.getFcsj()).getTime(); | |
| 4008 | - } catch (ParseException e) { | |
| 4009 | - // TODO Auto-generated catch block | |
| 4010 | - e.printStackTrace(); | |
| 4011 | - } | |
| 4012 | - | |
| 4013 | - } else { | |
| 4014 | - try { | |
| 4015 | - fscjT = sdf.parse(s.getScheduleDateStr() + " " + s.getFcsj()).getTime(); | |
| 4016 | - } catch (ParseException e) { | |
| 4017 | - // TODO Auto-generated catch block | |
| 4018 | - e.printStackTrace(); | |
| 4019 | - } | |
| 4020 | - ; | |
| 4021 | - } | |
| 4022 | - s.setFcsjT(fscjT); | |
| 4023 | - } | |
| 4024 | - | |
| 4025 | -// Collections.sort(listInfo, new compareLpFcsjType()); | |
| 4026 | - List<ScheduleRealInfo> listInfo2=new ArrayList<ScheduleRealInfo>(); | |
| 4027 | - | |
| 4028 | - Collections.sort(listInfo, new compareLpFcsjType()); | |
| 4029 | - for (int i = 0; i < listInfo.size(); i++) { | |
| 4030 | - ScheduleRealInfo t = listInfo.get(i); | |
| 4031 | - if (!lpName.equals(t.getLpName())) { | |
| 4032 | - zdsjActual = t.getZdsjActual(); | |
| 4033 | - zdsj = t.getZdsj(); | |
| 4034 | - t.setZdsjActual(""); | |
| 4035 | - t.setZdsj(""); | |
| 4036 | - } else { | |
| 4037 | - zdsj1 = t.getZdsj(); | |
| 4038 | - zdsjActual1 = t.getZdsjActual(); | |
| 4039 | - t.setZdsjActual(zdsjActual); | |
| 4040 | - t.setZdsj(zdsj); | |
| 4041 | - zdsj = zdsj1; | |
| 4042 | - zdsjActual = zdsjActual1; | |
| 4043 | - } | |
| 4044 | - | |
| 4045 | - | |
| 4046 | - | |
| 4047 | - lpName = t.getLpName(); | |
| 4048 | - listInfo2.add(t); | |
| 4049 | - | |
| 4050 | - } | |
| 4051 | - | |
| 4052 | - Collections.sort(listInfo2,new compareDirLpFcsjType()); | |
| 4053 | - for (int i = 0; i < listInfo2.size(); i++) { | |
| 4054 | - ScheduleRealInfo t=listInfo2.get(i); | |
| 4055 | - list.add(t); | |
| 4056 | - Set<ChildTaskPlan> childTaskPlans = t.getcTasks(); | |
| 4057 | - //计算营运里程,空驶里程 | |
| 4058 | - if (!childTaskPlans.isEmpty()) { | |
| 4059 | - List<ChildTaskPlan> listit = new ArrayList<ChildTaskPlan>(childTaskPlans); | |
| 4060 | - Collections.sort(listit, new ComparableChild()); | |
| 4061 | - for (int j = 0; j < listit.size(); j++) { | |
| 4062 | - ScheduleRealInfo s = new ScheduleRealInfo(); | |
| 4063 | - ChildTaskPlan childTaskPlan = listit.get(j); | |
| 4064 | - if (childTaskPlan.getCcId() == null) { | |
| 4065 | - if (childTaskPlan.isDestroy()) { | |
| 4066 | - s.setFcsjActual(""); | |
| 4067 | - s.setZdsjActual(""); | |
| 4068 | - } else { | |
| 4069 | - s.setFcsjActual(childTaskPlan.getStartDate()); | |
| 4070 | - s.setZdsjActual(""); | |
| 4071 | - s.setJhlc(Double.parseDouble(String.valueOf(childTaskPlan.getMileage()))); | |
| 4072 | - } | |
| 4073 | - s.setFcsj(childTaskPlan.getStartDate()); | |
| 4074 | - s.setZdsj(""); | |
| 4075 | - s.setQdzName(childTaskPlan.getStartStationName()); | |
| 4076 | - s.setZdzName(childTaskPlan.getEndStationName()); | |
| 4077 | - s.setRemarks(childTaskPlan.getRemarks()); | |
| 4078 | - s.setAdjustExps("子"); | |
| 4079 | - s.setLpName(""); | |
| 4080 | - list.add(s); | |
| 4081 | - } | |
| 4082 | - } | |
| 4083 | - } | |
| 4084 | - } | |
| 4085 | - List<ScheduleRealInfo> xList = new ArrayList<ScheduleRealInfo>(); | |
| 4086 | - List<ScheduleRealInfo> yList = new ArrayList<ScheduleRealInfo>(); | |
| 4087 | - List<ScheduleRealInfo> zList = new ArrayList<ScheduleRealInfo>(); | |
| 4088 | - List<ScheduleRealInfo> newList = new ArrayList<ScheduleRealInfo>(); | |
| 4089 | - if (list.size() > 0) { | |
| 4090 | - int a = list.size() % 3; | |
| 4091 | - int b = list.size() / 3; | |
| 4092 | - int x = 0, y = 0; | |
| 4093 | - if (a == 2) { | |
| 4094 | - x = b + 1; | |
| 4095 | - y = x * 2; | |
| 4096 | - } else if (a == 1) { | |
| 4097 | - x = b + 1; | |
| 4098 | - y = x * 2 - 1; | |
| 4099 | - } else { | |
| 4100 | - x = b; | |
| 4101 | - y = 2 * x; | |
| 4102 | - | |
| 4103 | - } | |
| 4104 | - for (int i = 0; i < list.size(); i++) { | |
| 4105 | - ScheduleRealInfo s = list.get(i); | |
| 4106 | - if (i + 1 <= x) { | |
| 4107 | - xList.add(s); | |
| 4108 | - } else if ((i + 1) > x && (i + 1) <= y) { | |
| 4109 | - yList.add(s); | |
| 4110 | - } else { | |
| 4111 | - zList.add(s); | |
| 4112 | - } | |
| 4113 | - } | |
| 4114 | - for (int i = 0; i < x; i++) { | |
| 4115 | - newList.add(xList.get(i)); | |
| 4116 | - if (yList.size() > i) { | |
| 4117 | - newList.add(yList.get(i)); | |
| 4118 | - } else { | |
| 4119 | - newList.add(new ScheduleRealInfo()); | |
| 4120 | - } | |
| 4121 | - if (zList.size() > i) { | |
| 4122 | - newList.add(zList.get(i)); | |
| 4123 | - } else { | |
| 4124 | - newList.add(new ScheduleRealInfo()); | |
| 4125 | - } | |
| 4126 | - | |
| 4127 | - } | |
| 4128 | - } | |
| 4129 | - /* for (int i = 0; i < newList.size(); i++) { | |
| 4130 | - ScheduleRealInfo t1 = newList.get(i); | |
| 4131 | - for (int j = 0; j < list.size(); j++) { | |
| 4132 | - ScheduleRealInfo t2 = list.get(j); | |
| 4133 | - if (t1.getId() == t2.getId()) { | |
| 4134 | - t1 = t2; | |
| 4135 | - } | |
| 4136 | - } | |
| 4137 | - }*/ | |
| 4138 | - | |
| 4139 | - for (int i = 0; i < newList.size(); i++) { | |
| 4140 | - ScheduleRealInfo t1 = newList.get(i); | |
| 4141 | - String reamrks1 = t1.getRemarks() == null ? "" : t1.getRemarks(); | |
| 4142 | - if (reamrks1.length() > 4) { | |
| 4143 | - t1.setRemarks(reamrks1.substring(0, 4)); | |
| 4144 | - t1.setRemark(reamrks1); | |
| 4145 | - } else { | |
| 4146 | - t1.setRemark(reamrks1); | |
| 4147 | - } | |
| 4148 | - } | |
| 4149 | - return newList; | |
| 4150 | - } | |
| 4151 | - | |
| 4152 | - @Override | |
| 4153 | - public List<ScheduleRealInfo> realScheduleList_mh_2(String line, String date) { | |
| 4154 | - List<ScheduleRealInfo> list = new ArrayList<ScheduleRealInfo>(); | |
| 4155 | - String lpName = "lpName"; | |
| 4156 | - String zdsj = ""; | |
| 4157 | - String zdsjActual = ""; | |
| 4158 | - String zdsj1 = ""; | |
| 4159 | - String zdsjActual1 = ""; | |
| 4160 | - List<ScheduleRealInfo> listInfo = scheduleRealInfoRepository.scheduleByDateAndLineQp(line, date); | |
| 4161 | - | |
| 4162 | - for (ScheduleRealInfo s : listInfo) { | |
| 4163 | - if (s.isDestroy() && s.isReissue()) { | |
| 4164 | - s.setRemark(""); | |
| 4165 | - s.setFcsjActual(s.getDfsj()); | |
| 4166 | - s.setZdsjActual(s.getZdsj()); | |
| 4167 | - s.setStatus(2); | |
| 4168 | - s.setJhlc(s.getJhlcOrig()); | |
| 4169 | - } | |
| 4170 | - } | |
| 4171 | - | |
| 4172 | - for (int i = 0; i < listInfo.size(); i++) { | |
| 4173 | - ScheduleRealInfo t = listInfo.get(i); | |
| 4174 | - if (!lpName.equals(t.getLpName())) { | |
| 4175 | - zdsjActual = t.getZdsjActual(); | |
| 4176 | - zdsj = t.getZdsj(); | |
| 4177 | - t.setZdsjActual(""); | |
| 4178 | - t.setZdsj(""); | |
| 4179 | - } else { | |
| 4180 | - zdsj1 = t.getZdsj(); | |
| 4181 | - zdsjActual1 = t.getZdsjActual(); | |
| 4182 | - t.setZdsjActual(zdsjActual); | |
| 4183 | - t.setZdsj(zdsj); | |
| 4184 | - zdsj = zdsj1; | |
| 4185 | - zdsjActual = zdsjActual1; | |
| 4186 | - } | |
| 4187 | - lpName = t.getLpName(); | |
| 4188 | - list.add(t); | |
| 4189 | - } | |
| 4190 | - | |
| 4191 | - List<ScheduleRealInfo> listInfo2 = scheduleRealInfoRepository.scheduleByDateAndLineQp2(line, date); | |
| 4192 | - List<ScheduleRealInfo> xList = new ArrayList<ScheduleRealInfo>(); | |
| 4193 | - List<ScheduleRealInfo> yList = new ArrayList<ScheduleRealInfo>(); | |
| 4194 | - List<ScheduleRealInfo> zList = new ArrayList<ScheduleRealInfo>(); | |
| 4195 | - List<ScheduleRealInfo> newList = new ArrayList<ScheduleRealInfo>(); | |
| 4196 | - if (listInfo2.size() > 0) { | |
| 4197 | - int a = listInfo2.size() % 3; | |
| 4198 | - int b = listInfo2.size() / 3; | |
| 4199 | - int x = 0, y = 0; | |
| 4200 | - if (a == 2) { | |
| 4201 | - x = b + 1; | |
| 4202 | - y = x * 2; | |
| 4203 | - } else if (b == 1) { | |
| 4204 | - x = b + 1; | |
| 4205 | - y = x * 2 - 1; | |
| 4206 | - } else { | |
| 4207 | - x = b; | |
| 4208 | - y = 2 * x; | |
| 4209 | - | |
| 4210 | - } | |
| 4211 | - for (int i = 0; i < listInfo2.size(); i++) { | |
| 4212 | - ScheduleRealInfo s = listInfo2.get(i); | |
| 4213 | - if (i + 1 <= x) { | |
| 4214 | - xList.add(s); | |
| 4215 | - } else if ((i + 1) > x && (i + 1) <= y) { | |
| 4216 | - yList.add(s); | |
| 4217 | - } else { | |
| 4218 | - zList.add(s); | |
| 4219 | - } | |
| 4220 | - } | |
| 4221 | - for (int i = 0; i < x; i++) { | |
| 4222 | - newList.add(xList.get(i)); | |
| 4223 | - if (yList.size() > i) { | |
| 4224 | - newList.add(yList.get(i)); | |
| 4225 | - } else { | |
| 4226 | - newList.add(new ScheduleRealInfo()); | |
| 4227 | - } | |
| 4228 | - if (zList.size() > i) { | |
| 4229 | - newList.add(zList.get(i)); | |
| 4230 | - } else { | |
| 4231 | - newList.add(new ScheduleRealInfo()); | |
| 4232 | - } | |
| 4233 | - | |
| 4234 | - } | |
| 4235 | - } | |
| 4236 | - for (int i = 0; i < newList.size(); i++) { | |
| 4237 | - ScheduleRealInfo t1 = newList.get(i); | |
| 4238 | - for (int j = 0; j < list.size(); j++) { | |
| 4239 | - ScheduleRealInfo t2 = list.get(j); | |
| 4240 | - if (t1.getId() == t2.getId()) { | |
| 4241 | - t1 = t2; | |
| 4242 | - } | |
| 4243 | - } | |
| 4244 | - } | |
| 4245 | - return newList; | |
| 4246 | - } | |
| 4247 | - | |
| 4248 | - @Override | |
| 4249 | - public List<ScheduleRealInfo> realScheduleListQp(String line, String date) { | |
| 4250 | - List<ScheduleRealInfo> list = new ArrayList<ScheduleRealInfo>(); | |
| 4251 | - String lpName = "lpName"; | |
| 4252 | - String zdsj = ""; | |
| 4253 | - String zdsjActual = ""; | |
| 4254 | - String zdsj1 = ""; | |
| 4255 | - String zdsjActual1 = ""; | |
| 4256 | - List<ScheduleRealInfo> listInfo = scheduleRealInfoRepository.scheduleByDateAndLineQp(line, date); | |
| 4257 | - for (int i = 0; i < listInfo.size(); i++) { | |
| 4258 | - ScheduleRealInfo t = listInfo.get(i); | |
| 4259 | - if (!lpName.equals(t.getLpName())) { | |
| 4260 | - zdsjActual = t.getZdsjActual(); | |
| 4261 | - zdsj = t.getZdsj(); | |
| 4262 | - t.setZdsjActual(""); | |
| 4263 | - t.setZdsj(""); | |
| 4264 | - } else { | |
| 4265 | - zdsj1 = t.getZdsj(); | |
| 4266 | - zdsjActual1 = t.getZdsjActual(); | |
| 4267 | - t.setZdsjActual(zdsjActual); | |
| 4268 | - t.setZdsj(zdsj); | |
| 4269 | - zdsj = zdsj1; | |
| 4270 | - zdsjActual = zdsjActual1; | |
| 4271 | - } | |
| 4272 | - | |
| 4273 | - lpName = t.getLpName(); | |
| 4274 | - list.add(t); | |
| 4275 | - } | |
| 4276 | - return list; | |
| 4277 | - } | |
| 4278 | - | |
| 4279 | - public List<Map<String, Object>> yesterdayDataList(String line, String date, String gsbm, String fgsbm, String jGh, String nbbm) { | |
| 4280 | - List<Map<String, Object>> yesterdayDataList = new ArrayList<Map<String, Object>>(); | |
| 4281 | - if (line.equals("")) { | |
| 4282 | - yesterdayDataList = scheduleRealInfoRepository.yesterdayDataList(line, date, gsbm, fgsbm, nbbm); | |
| 4283 | - } else { | |
| 4284 | - yesterdayDataList = scheduleRealInfoRepository.yesterdayDataList_eq(line, date, gsbm, fgsbm, nbbm); | |
| 4285 | - } | |
| 4286 | - List<ScheduleRealInfo> lists = scheduleRealInfoRepository.queryListWaybill3(jGh, nbbm, date, gsbm, fgsbm); | |
| 4287 | - for (int x = 0; x < yesterdayDataList.size(); x++) { | |
| 4288 | - String jsy = yesterdayDataList.get(x).get("jGh").toString(); | |
| 4289 | - String clZbh = yesterdayDataList.get(x).get("clZbh").toString(); | |
| 4290 | - String xlbm = yesterdayDataList.get(x).get("xlBm").toString(); | |
| 4291 | - String lp = yesterdayDataList.get(x).get("lpName").toString(); | |
| 4292 | - String realExecDate=yesterdayDataList.get(x).get("realExecDate").toString(); | |
| 4293 | - String fcsj[] =realExecDate.split(" "); | |
| 4294 | - //取出最小计划发车时间 | |
| 4295 | - yesterdayDataList.get(x).put("fcsj", fcsj[1]); | |
| 4296 | - Map<String, Object> map = new HashMap<String, Object>(); | |
| 4297 | - boolean fage = true; | |
| 4298 | - String company = ""; | |
| 4299 | - String bCompany = ""; | |
| 4300 | - String lineName=""; | |
| 4301 | - String jName=""; | |
| 4302 | - List<ScheduleRealInfo> listS = new ArrayList<ScheduleRealInfo>(); | |
| 4303 | - for (ScheduleRealInfo scheduleRealInfo : lists) { | |
| 4304 | - if (scheduleRealInfo.getjGh().equals(jsy) | |
| 4305 | - && scheduleRealInfo.getClZbh().equals(clZbh) | |
| 4306 | - && scheduleRealInfo.getXlBm().equals(xlbm) | |
| 4307 | - && scheduleRealInfo.getLpName().equals(lp)) { | |
| 4308 | - if (fage) { | |
| 4309 | - //根据线路代码获取公司 | |
| 4310 | - company = scheduleRealInfo.getGsBm(); | |
| 4311 | - bCompany = scheduleRealInfo.getFgsBm(); | |
| 4312 | - lineName = scheduleRealInfo.getXlName(); | |
| 4313 | - jName= scheduleRealInfo.getjName(); | |
| 4314 | - fage = false; | |
| 4315 | - } | |
| 4316 | - Set<ChildTaskPlan> cts = scheduleRealInfo.getcTasks(); | |
| 4317 | - if (cts != null && cts.size() > 0) { | |
| 4318 | - listS.add(scheduleRealInfo); | |
| 4319 | - } else { | |
| 4320 | - if (scheduleRealInfo.getZdsjActual() != null && scheduleRealInfo.getFcsjActual() != null) { | |
| 4321 | - listS.add(scheduleRealInfo); | |
| 4322 | - } | |
| 4323 | - } | |
| 4324 | - } | |
| 4325 | - } | |
| 4326 | - yesterdayDataList.get(x).put("company", company); | |
| 4327 | - yesterdayDataList.get(x).put("bCompany", bCompany); | |
| 4328 | - yesterdayDataList.get(x).put("lineName", lineName); | |
| 4329 | - yesterdayDataList.get(x).put("jName", jName); | |
| 4330 | - Double ljgl = culateMieageService.culateLjgl(listS); | |
| 4331 | - Double sjgl = culateMieageService.culateSjgl(listS); | |
| 4332 | - Double ksgl = culateMieageService.culateKsgl(listS); | |
| 4333 | - Double jccgl = culateMieageService.culateJccgl(listS); | |
| 4334 | - Double zyygl = Arith.add(sjgl, ljgl); | |
| 4335 | - Double zksgl = Arith.add(ksgl, jccgl); | |
| 4336 | - Double zlc = Arith.add(zyygl, zksgl); | |
| 4337 | - yesterdayDataList.get(x).put("totalKilometers", zlc); | |
| 4338 | - | |
| 4339 | - } | |
| 4340 | - //增加顺序号 | |
| 4341 | - for (int i = 0; i < yesterdayDataList.size(); i++) { | |
| 4342 | - if (i == 0) { | |
| 4343 | - yesterdayDataList.get(i).put("seqNumber", 1); | |
| 4344 | - } else { | |
| 4345 | - if (yesterdayDataList.get(i - 1).get("clZbh").equals(yesterdayDataList.get(i).get("clZbh"))) { | |
| 4346 | - yesterdayDataList.get(i).put("seqNumber", 1 + (int) yesterdayDataList.get(i - 1).get("seqNumber")); | |
| 4347 | - } else { | |
| 4348 | - yesterdayDataList.get(i).put("seqNumber", 1); | |
| 4349 | - } | |
| 4350 | - } | |
| 4351 | - } | |
| 4352 | - | |
| 4353 | - return yesterdayDataList; | |
| 4354 | - } | |
| 4355 | - | |
| 4356 | - /** | |
| 4357 | - * 批量调整人车 | |
| 4358 | - */ | |
| 4359 | - @Override | |
| 4360 | - public Map<String, Object> multi_tzrc(List<ChangePersonCar> cpcs, String userId) { | |
| 4361 | - Map<String, Object> rs = new HashMap<>(); | |
| 4362 | - Set<ScheduleRealInfo> set = new HashSet<>(); | |
| 4363 | - | |
| 4364 | - ScheduleRealInfo sch; | |
| 4365 | - | |
| 4366 | - String jGh = null, jName, sGh, sName; | |
| 4367 | - for (ChangePersonCar cpc : cpcs) { | |
| 4368 | - | |
| 4369 | - sch = dayOfSchedule.get(cpc.getSchId()); | |
| 4370 | - if (sch == null) | |
| 4371 | - continue; | |
| 4372 | - | |
| 4373 | - if (cpc.getClZbh() != null) { | |
| 4374 | - if (!carExist(sch.getGsBm(), cpc.getClZbh())) { | |
| 4375 | - rs.put("msg", "车辆 " + cpc.getClZbh() + " <a href=\"/#/busInfoManage\" target=_blank>车辆基础信息</a> 里找不到!"); | |
| 4376 | - rs.put("status", ResponseCode.ERROR); | |
| 4377 | - return rs; | |
| 4378 | - } else if (!sch.getGsBm().equals(BasicData.nbbm2CompanyCodeMap.get(cpc.getClZbh()))) { | |
| 4379 | - rs.put("msg", sch.getXlName() + "所属的公司编码下找不到自编号为【" + cpc.getClZbh() + "】的车辆"); | |
| 4380 | - rs.put("status", ResponseCode.ERROR); | |
| 4381 | - return rs; | |
| 4382 | - } | |
| 4383 | - } | |
| 4384 | - | |
| 4385 | - if (StringUtils.isNotEmpty(cpc.getJsy())) { | |
| 4386 | - try{ | |
| 4387 | - jGh = cpc.getJsy().split("/")[0]; | |
| 4388 | - }catch (Exception e){ | |
| 4389 | - logger.error("", e); | |
| 4390 | - rs.put("msg", "驾驶员参数异常!!"); | |
| 4391 | - rs.put("status", ResponseCode.ERROR); | |
| 4392 | - return rs; | |
| 4393 | - } | |
| 4394 | - | |
| 4395 | - jName = getPersonName(sch.getGsBm(), jGh); | |
| 4396 | - if (StringUtils.isEmpty(jName)) { | |
| 4397 | - rs.put("msg", sch.getXlName() + "所属的公司编码下找不到工号为【" + jGh + "】的驾驶员"); | |
| 4398 | - rs.put("status", ResponseCode.ERROR); | |
| 4399 | - return rs; | |
| 4400 | - } | |
| 4401 | - } | |
| 4402 | - | |
| 4403 | - | |
| 4404 | - //为换人换车情况表写入数据 | |
| 4405 | - schModifyLog.saveChangetochange(sch, cpc, userId); | |
| 4406 | - //日志记录 | |
| 4407 | - ScheduleModifyLogger.tzrc(sch, cpc, userId); | |
| 4408 | - | |
| 4409 | - //换驾驶员 | |
| 4410 | - if (StringUtils.isNotEmpty(cpc.getJsy())) { | |
| 4411 | - //换驾驶员 | |
| 4412 | - if (persoChange(sch, jGh)) | |
| 4413 | - set.add(sch); | |
| 4414 | - } | |
| 4415 | - | |
| 4416 | - //换售票员 | |
| 4417 | - if (StringUtils.isNotEmpty(cpc.getSpy()) | |
| 4418 | - && !"/".equals(StringUtils.trim(cpc.getSpy()))) { | |
| 4419 | - | |
| 4420 | - sGh = cpc.getSpy().split("/")[0]; | |
| 4421 | - sName = getPersonName(sch.getGsBm(), sGh); | |
| 4422 | - if (StringUtils.isEmpty(sName)) { | |
| 4423 | - rs.put("msg", sch.getXlName() + "所属的公司编码下找不到工号为【" + sGh + "】的售票员"); | |
| 4424 | - rs.put("status", ResponseCode.ERROR); | |
| 4425 | - return rs; | |
| 4426 | - } | |
| 4427 | - | |
| 4428 | - /*if(!sGh.equals(sch.getsGh())) | |
| 4429 | - sb.append(sch.getsGh() + " 换 " + sGh + ";");*/ | |
| 4430 | - if (persoChangeSPY(sch, sGh)) | |
| 4431 | - set.add(sch); | |
| 4432 | - } else if (StringUtils.isNotEmpty(sch.getsGh())) { | |
| 4433 | - sch.setsGh(""); | |
| 4434 | - sch.setsName(""); | |
| 4435 | - } | |
| 4436 | - | |
| 4437 | - //换车 | |
| 4438 | - if (StringUtils.isNotEmpty(cpc.getClZbh()) && !cpc.getClZbh().equals(sch.getClZbh())) { | |
| 4439 | - //sb.append(sch.getClZbh() + " 换 " + cpc.getClZbh() + ";"); | |
| 4440 | - set.add(sch); | |
| 4441 | - set.addAll(dayOfSchedule.changeCar(sch, cpc.getClZbh())); | |
| 4442 | - } | |
| 4443 | - | |
| 4444 | - /*if(sb.length() > 0) | |
| 4445 | - sch.setRemarks(sb.toString());*/ | |
| 4446 | - | |
| 4447 | - dayOfSchedule.save(sch); | |
| 4448 | - set.add(sch); | |
| 4449 | - | |
| 4450 | - } | |
| 4451 | - rs.put("ts", set); | |
| 4452 | - rs.put("status", ResponseCode.SUCCESS); | |
| 4453 | - return rs; | |
| 4454 | - } | |
| 4455 | - | |
| 4456 | - /** | |
| 4457 | - * @Title: persoChange | |
| 4458 | - * @Description: TODO(班次换驾驶员) | |
| 4459 | - */ | |
| 4460 | - public boolean persoChange(ScheduleRealInfo sch, String jGh) { | |
| 4461 | - if (sch.getjGh().equals(jGh)) | |
| 4462 | - return false; | |
| 4463 | - String jName = getPersonName(sch.getGsBm(), jGh); | |
| 4464 | - if (StringUtils.isNotEmpty(jName)) { | |
| 4465 | - | |
| 4466 | - if (jGh.indexOf("-") != -1) | |
| 4467 | - sch.setjGh(jGh.substring(jGh.indexOf("-") + 1)); | |
| 4468 | - else | |
| 4469 | - sch.setjGh(jGh); | |
| 4470 | - | |
| 4471 | - sch.setjName(jName); | |
| 4472 | - return true; | |
| 4473 | - } | |
| 4474 | - return false; | |
| 4475 | - } | |
| 4476 | - | |
| 4477 | - /** | |
| 4478 | - * @Title: persoChange | |
| 4479 | - * @Description: TODO(班次换售票员) | |
| 4480 | - */ | |
| 4481 | - public boolean persoChangeSPY(ScheduleRealInfo sch, String sGh) { | |
| 4482 | - if (sch.getsGh().equals(sGh)) | |
| 4483 | - return false; | |
| 4484 | - String sName = getPersonName(sch.getGsBm(), sGh); | |
| 4485 | - if (StringUtils.isNotEmpty(sName)) { | |
| 4486 | - if (sGh.indexOf("-") != -1) | |
| 4487 | - sch.setsGh(sGh.substring(sGh.indexOf("-") + 1)); | |
| 4488 | - else | |
| 4489 | - sch.setsGh(sGh); | |
| 4490 | - sch.setsName(sName); | |
| 4491 | - return true; | |
| 4492 | - } | |
| 4493 | - return false; | |
| 4494 | - } | |
| 4495 | - | |
| 4496 | - /** | |
| 4497 | - * 批量待发调整 | |
| 4498 | - */ | |
| 4499 | - @Override | |
| 4500 | - public Map<String, Object> multi_dftz(List<DfsjChange> dfsjcs) { | |
| 4501 | - Map<String, Object> rs = new HashMap<>(), tempMap = new HashMap<>(); | |
| 4502 | - List<ScheduleRealInfo> list = new ArrayList<>(); | |
| 4503 | - | |
| 4504 | - for (DfsjChange dc : dfsjcs) { | |
| 4505 | - if (StringUtils.isEmpty(dc.getOld_dfsj()) || StringUtils.isEmpty(dc.getNew_dfsj())) | |
| 4506 | - continue; | |
| 4507 | - | |
| 4508 | - tempMap = outgoAdjust(dc.getSchId(), "", dc.getNew_dfsj(), null, "2", null); | |
| 4509 | - | |
| 4510 | - if (tempMap.get("status").equals(ResponseCode.SUCCESS)) { | |
| 4511 | - list.addAll((Collection<? extends ScheduleRealInfo>) tempMap.get("ts")); | |
| 4512 | - } | |
| 4513 | - } | |
| 4514 | - | |
| 4515 | - rs.put("status", ResponseCode.SUCCESS); | |
| 4516 | - rs.put("ts", list); | |
| 4517 | - return rs; | |
| 4518 | - } | |
| 4519 | - | |
| 4520 | - | |
| 4521 | - @Override | |
| 4522 | - public Map<String, Object> findKMBC1(String jName, String clZbh, | |
| 4523 | - String date, String enddate) { | |
| 4524 | - List<ScheduleRealInfo> list = scheduleRealInfoRepository.queryListWaybill4(jName, clZbh, date, enddate); | |
| 4525 | - DecimalFormat format = new DecimalFormat("0.00"); | |
| 4526 | -// int cjbc = scheduleRealInfoRepository.findCjbc(jName, clZbh, lpName); | |
| 4527 | -// int ljbc = scheduleRealInfoRepository.findLjbc(jName, clZbh, lpName); | |
| 4528 | - int jhbc = 0, cjbc = 0, ljbc = 0; | |
| 4529 | - double jhlc = 0, yygl = 0, ksgl = 0, tempJhlc = 0; | |
| 4530 | - float addMileage = 0l, remMileage = 0l; | |
| 4531 | - Map<String, Object> map = new HashMap<String, Object>(); | |
| 4532 | - for (ScheduleRealInfo scheduleRealInfo : list) { | |
| 4533 | - if (scheduleRealInfo != null) { | |
| 4534 | - //计划里程(主任务过滤掉临加班次), | |
| 4535 | - //烂班里程(主任务烂班), | |
| 4536 | - //临加里程(主任务临加), | |
| 4537 | - //计划班次,烂班班次,增加班次 | |
| 4538 | - tempJhlc = scheduleRealInfo.getJhlc() == null ? 0 : scheduleRealInfo.getJhlc(); | |
| 4539 | - if (scheduleRealInfo.isSflj()) { | |
| 4540 | - addMileage += tempJhlc; | |
| 4541 | - ljbc++; | |
| 4542 | - } else { | |
| 4543 | - jhlc += tempJhlc; | |
| 4544 | - jhbc++; | |
| 4545 | - if (scheduleRealInfo.getStatus() == -1) { | |
| 4546 | - remMileage += tempJhlc; | |
| 4547 | - cjbc++; | |
| 4548 | - } | |
| 4549 | - } | |
| 4550 | - Set<ChildTaskPlan> childTaskPlans = scheduleRealInfo.getcTasks(); | |
| 4551 | - //计算营运里程,空驶里程 | |
| 4552 | - if (childTaskPlans.isEmpty()) { | |
| 4553 | - if (scheduleRealInfo.getBcType().equals("in") || scheduleRealInfo.getBcType().equals("out") | |
| 4554 | - || scheduleRealInfo.getBcType().equals("venting")) { | |
| 4555 | - ksgl += tempJhlc; | |
| 4556 | - } else { | |
| 4557 | - yygl += tempJhlc; | |
| 4558 | - } | |
| 4559 | - } else { | |
| 4560 | - Iterator<ChildTaskPlan> it = childTaskPlans.iterator(); | |
| 4561 | - while (it.hasNext()) { | |
| 4562 | - ChildTaskPlan childTaskPlan = it.next(); | |
| 4563 | - if (childTaskPlan.getMileageType().equals("empty")) { | |
| 4564 | - ksgl += childTaskPlan.getMileage() == null ? 0 : childTaskPlan.getMileage(); | |
| 4565 | - } else { | |
| 4566 | - yygl += childTaskPlan.getMileage() == null ? 0 : childTaskPlan.getMileage(); | |
| 4567 | - } | |
| 4568 | - } | |
| 4569 | - } | |
| 4570 | - } | |
| 4571 | - } | |
| 4572 | - map.put("jhlc", format.format(jhlc)); | |
| 4573 | - map.put("remMileage", format.format(remMileage)); | |
| 4574 | - map.put("addMileage", format.format(addMileage)); | |
| 4575 | - map.put("yygl", format.format(yygl)); | |
| 4576 | - map.put("ksgl", format.format(ksgl)); | |
| 4577 | - map.put("realMileage", format.format(yygl + ksgl)); | |
| 4578 | - map.put("jhbc", jhbc); | |
| 4579 | - map.put("cjbc", cjbc); | |
| 4580 | - map.put("ljbc", ljbc); | |
| 4581 | - map.put("sjbc", jhbc - cjbc + ljbc); | |
| 4582 | - return map; | |
| 4583 | - } | |
| 4584 | - | |
| 4585 | - /** | |
| 4586 | - * 调整班次类型 | |
| 4587 | - * | |
| 4588 | - * @param id | |
| 4589 | - * @param bcType | |
| 4590 | - * @param remarks | |
| 4591 | - * @return | |
| 4592 | - */ | |
| 4593 | - @Override | |
| 4594 | - public Map<String, Object> changeBcType(Long id, String bcType, String remarks, String majorStationName) { | |
| 4595 | - Map<String, Object> rs = new HashMap<>(); | |
| 4596 | - | |
| 4597 | - try { | |
| 4598 | - ScheduleRealInfo sch = dayOfSchedule.get(id); | |
| 4599 | - if (sch != null) { | |
| 4600 | - sch.setBcType(bcType); | |
| 4601 | - sch.setRemarks(remarks); | |
| 4602 | - rs.put("status", ResponseCode.SUCCESS); | |
| 4603 | - rs.put("t", sch); | |
| 4604 | - | |
| 4605 | - if ("major".equals(bcType)) { | |
| 4606 | - sch.setMajorStationName(majorStationName); | |
| 4607 | - } | |
| 4608 | - | |
| 4609 | - dayOfSchedule.save(sch); | |
| 4610 | - } | |
| 4611 | - } catch (Exception e) { | |
| 4612 | - logger.error("", e); | |
| 4613 | - rs.put("status", ResponseCode.ERROR); | |
| 4614 | - } | |
| 4615 | - | |
| 4616 | - return rs; | |
| 4617 | - } | |
| 4618 | - | |
| 4619 | - @Override | |
| 4620 | - public Map<String, Object> historySave(ScheduleRealInfo sch) { | |
| 4621 | - Map<String, Object> rs = new HashMap<>(); | |
| 4622 | - rs.put("status", ResponseCode.ERROR); | |
| 4623 | - | |
| 4624 | - ScheduleRealInfo oldSch = super.findById(sch.getId()); | |
| 4625 | - // 检查调度日期 | |
| 4626 | - DateTimeFormatter formatter = DateTimeFormat.forPattern("yyyy-MM-dd"); | |
| 4627 | - long today = formatter.parseMillis(new DateTime().toString("yyyy-MM-dd")), scheduleDate = formatter.parseMillis(oldSch.getScheduleDateStr()); | |
| 4628 | - if (today < scheduleDate || today - scheduleDate > 86400000 * PrivilegeUtils.getHistoryEditDays()) { | |
| 4629 | - rs.put("status", ResponseCode.ERROR); | |
| 4630 | - rs.put("msg", "无效的调度日期"); | |
| 4631 | - return rs; | |
| 4632 | - } | |
| 4633 | - //事后日志记录 | |
| 4634 | - AfterwardsLogger aflog = AfterwardsLogger.start(oldSch, "事后调整"); | |
| 4635 | - | |
| 4636 | - //换车 | |
| 4637 | - if (StringUtils.isNotEmpty(sch.getClZbh()) && !oldSch.getClZbh().equals(sch.getClZbh())) { | |
| 4638 | - if (!carExist(oldSch.getGsBm(), sch.getClZbh())) { | |
| 4639 | - rs.put("msg", "车辆 " + sch.getClZbh() + " 不存在!"); | |
| 4640 | - return rs; | |
| 4641 | - } else { | |
| 4642 | - aflog.log("换车", oldSch.getClZbh(), sch.getClZbh()); | |
| 4643 | - oldSch.setClZbh(sch.getClZbh()); | |
| 4644 | - } | |
| 4645 | - } | |
| 4646 | - | |
| 4647 | - //换驾驶员 | |
| 4648 | - if (StringUtils.isNotEmpty(sch.getjGh()) && !oldSch.getjGh().equals(sch.getjGh())) { | |
| 4649 | - String jName = getPersonName(oldSch.getGsBm(), sch.getjGh()); | |
| 4650 | - if (StringUtils.isEmpty(jName)) { | |
| 4651 | - rs.put("msg", oldSch.getXlName() + "所属的公司编码下找不到工号为【" + sch.getjGh() + "】的驾驶员"); | |
| 4652 | - return rs; | |
| 4653 | - } | |
| 4654 | - aflog.log("换驾驶员", oldSch.getjGh() + "/" + oldSch.getjName(), sch.getjGh() + "/" + sch.getjName()); | |
| 4655 | - persoChange(oldSch, sch.getjGh()); | |
| 4656 | - } | |
| 4657 | - | |
| 4658 | - //换售票员 | |
| 4659 | - if (StringUtils.isNotEmpty(sch.getsGh()) && !oldSch.getsGh().equals(sch.getsGh())) { | |
| 4660 | - String sName = getPersonName(oldSch.getGsBm(), sch.getsGh()); | |
| 4661 | - if (StringUtils.isEmpty(sName)) { | |
| 4662 | - rs.put("msg", sch.getXlName() + "所属的公司编码下找不到工号为【" + sch.getsGh() + "】的售票员"); | |
| 4663 | - return rs; | |
| 4664 | - } | |
| 4665 | - aflog.log("换售票员", oldSch.getsGh() + "/" + oldSch.getsName(), sch.getsGh() + "/" + sch.getsName()); | |
| 4666 | - persoChangeSPY(oldSch, sch.getsGh()); | |
| 4667 | - } | |
| 4668 | - | |
| 4669 | - //烂班 | |
| 4670 | - boolean dest1 = oldSch.getStatus() == -1; | |
| 4671 | - boolean dest2 = sch.getStatus() == -1; | |
| 4672 | - if (!dest1 && dest2) { | |
| 4673 | - oldSch.destroy(); | |
| 4674 | - aflog.log("烂班"); | |
| 4675 | - } else if (dest1 && !dest2) { | |
| 4676 | - //撤销烂班 | |
| 4677 | - oldSch.setJhlc(oldSch.getJhlcOrig()); | |
| 4678 | - oldSch.setStatus(0); | |
| 4679 | - oldSch.calcStatus(); | |
| 4680 | - oldSch.setAdjustExps(null); | |
| 4681 | - aflog.log("撤销烂班"); | |
| 4682 | - } | |
| 4683 | - | |
| 4684 | - oldSch.setAdjustExps(sch.getAdjustExps()); | |
| 4685 | - | |
| 4686 | - /** | |
| 4687 | - * 修改班次里程 | |
| 4688 | - */ | |
| 4689 | - if (!oldSch.getJhlc().equals(sch.getJhlc())) { | |
| 4690 | - double jhlcNum = sch.getJhlc(); | |
| 4691 | - aflog.log("修改班次里程", oldSch.getJhlc(), jhlcNum); | |
| 4692 | - //烂班 | |
| 4693 | - if (jhlcNum == 0 && oldSch.getJhlcOrig() != 0) | |
| 4694 | - oldSch.destroy(); | |
| 4695 | - else { | |
| 4696 | - oldSch.setJhlc(jhlcNum); | |
| 4697 | - //临加班次,实际计划一起改 | |
| 4698 | - if (oldSch.isSflj()) | |
| 4699 | - oldSch.setJhlcOrig(jhlcNum); | |
| 4700 | - } | |
| 4701 | - } | |
| 4702 | - | |
| 4703 | - //待发时间 | |
| 4704 | - if (!CustomStringUtils.equals(oldSch.getDfsj(), sch.getDfsj())) { | |
| 4705 | - aflog.log("修改待发时间", oldSch.getDfsj(), sch.getDfsj()); | |
| 4706 | - oldSch.setDfsj(sch.getDfsj()); | |
| 4707 | - } | |
| 4708 | - //实发时间 | |
| 4709 | - if (!CustomStringUtils.equals(oldSch.getFcsjActual(), sch.getFcsjActual())) { | |
| 4710 | - aflog.log("修改实发时间", oldSch.getFcsjActual(), sch.getFcsjActual()); | |
| 4711 | - oldSch.setFcsjActual(sch.getFcsjActual()); | |
| 4712 | - } | |
| 4713 | - //实际终点 | |
| 4714 | - if (!CustomStringUtils.equals(oldSch.getZdsjActual(), sch.getZdsjActual())) { | |
| 4715 | - aflog.log("修改实达时间", oldSch.getZdsjActual(), sch.getZdsjActual()); | |
| 4716 | - oldSch.setZdsjActual(sch.getZdsjActual()); | |
| 4717 | - } | |
| 4718 | - | |
| 4719 | - //备注 | |
| 4720 | - if (!CustomStringUtils.equals(oldSch.getRemarks(), sch.getRemarks())) { | |
| 4721 | - aflog.log("修改备注", oldSch.getRemarks(), sch.getRemarks()); | |
| 4722 | - oldSch.setRemarks(sch.getRemarks()); | |
| 4723 | - } | |
| 4724 | - | |
| 4725 | - scheduleRealInfoRepository.save(oldSch); | |
| 4726 | - | |
| 4727 | - aflog.end(); | |
| 4728 | - rs.put("status", ResponseCode.SUCCESS); | |
| 4729 | - return rs; | |
| 4730 | - } | |
| 4731 | - | |
| 4732 | - @Autowired | |
| 4733 | - SvgAttributeRepository svgAttributeRepository; | |
| 4734 | - | |
| 4735 | - @Override | |
| 4736 | - public Map<String, Object> svgAttr(String jsonStr) { | |
| 4737 | - Map<String, Object> rs = new HashMap<>(); | |
| 4738 | - | |
| 4739 | - try { | |
| 4740 | - JSONObject jObj = JSONObject.parseObject(StringEscapeUtils.unescapeHtml4(jsonStr)); | |
| 4741 | - | |
| 4742 | - SvgAttribute svgAttribute = new SvgAttribute(); | |
| 4743 | - svgAttribute.setLineCode(jObj.getString("lineCode")); | |
| 4744 | - svgAttribute.setHideStations(jObj.getString("hideStations")); | |
| 4745 | - svgAttribute.setNicknames(jObj.getString("nicknames")); | |
| 4746 | - svgAttributeRepository.save(svgAttribute); | |
| 4747 | - | |
| 4748 | - rs.put("t", svgAttribute); | |
| 4749 | - rs.put("status", ResponseCode.SUCCESS); | |
| 4750 | - } catch (Exception e) { | |
| 4751 | - logger.error("", e); | |
| 4752 | - rs.put("status", ResponseCode.ERROR); | |
| 4753 | - } | |
| 4754 | - return rs; | |
| 4755 | - } | |
| 4756 | - | |
| 4757 | - @Override | |
| 4758 | - public Map<String, Object> findSvgAttr(String idx) { | |
| 4759 | - Map<String, Object> rs = new HashMap<>(); | |
| 4760 | - try { | |
| 4761 | - List<String> lineCodes = Splitter.on(",").splitToList(idx); | |
| 4762 | - List<SvgAttribute> list = svgAttributeRepository.findSvgAttr(lineCodes); | |
| 4763 | - | |
| 4764 | - rs.put("status", ResponseCode.SUCCESS); | |
| 4765 | - rs.put("list", list); | |
| 4766 | - } catch (Exception e) { | |
| 4767 | - logger.error("", e); | |
| 4768 | - rs.put("status", ResponseCode.ERROR); | |
| 4769 | - } | |
| 4770 | - return rs; | |
| 4771 | - } | |
| 4772 | - | |
| 4773 | - @Override | |
| 4774 | - public Map<String, Object> addRemarks(Long id, String remarks) { | |
| 4775 | - Map<String, Object> rs = new HashMap<>(); | |
| 4776 | - try { | |
| 4777 | - ScheduleRealInfo sch = dayOfSchedule.get(id); | |
| 4778 | - sch.addRemarks(remarks); | |
| 4779 | - | |
| 4780 | - rs.put("status", ResponseCode.SUCCESS); | |
| 4781 | - rs.put("t", sch); | |
| 4782 | - } catch (Exception e) { | |
| 4783 | - logger.error("", e); | |
| 4784 | - rs.put("status", ResponseCode.ERROR); | |
| 4785 | - } | |
| 4786 | - return rs; | |
| 4787 | - } | |
| 4788 | - | |
| 4789 | - @Override | |
| 4790 | - public List<Map<String, Object>> yesterdayDataList(String line) { | |
| 4791 | - // TODO Auto-generated method stub | |
| 4792 | - return null; | |
| 4793 | - } | |
| 4794 | - | |
| 4795 | - @Override | |
| 4796 | - public List<ScheduleRealInfo> exportWaybillQp(String clZbh, String date, String line) { | |
| 4797 | - // TODO Auto-generated method stub | |
| 4798 | - ReportUtils ee = new ReportUtils(); | |
| 4799 | - ReportRelatedUtils rru = new ReportRelatedUtils(); | |
| 4800 | - List<Iterator<?>> list = new ArrayList<Iterator<?>>(); | |
| 4801 | - List<ScheduleRealInfo> scheduleRealInfos = scheduleRealInfoRepository.queryListWaybill2(clZbh, date, line); | |
| 4802 | - List<Map<String, Object>> listMap = new ArrayList<Map<String, Object>>(); | |
| 4803 | - | |
| 4804 | - DecimalFormat format = new DecimalFormat("0.00"); | |
| 4805 | -// int cjbc = scheduleRealInfoRepository.findCjbc(jName, clZbh, lpName); | |
| 4806 | -// int ljbc = scheduleRealInfoRepository.findLjbc(jName, clZbh, lpName); | |
| 4807 | - int jhbc = 0, cjbc = 0, ljbc = 0; | |
| 4808 | - double jhlc = 0, yygl = 0, ksgl = 0, tempJhlc = 0, jcclc = 0; | |
| 4809 | - float addMileage = 0l, remMileage = 0l, addgl = 0, remgl = 0; | |
| 4810 | - int xyz = 1; | |
| 4811 | - Map<String, Object> map; | |
| 4812 | - for (ScheduleRealInfo scheduleRealInfo : scheduleRealInfos) { | |
| 4813 | - if (scheduleRealInfo != null) { | |
| 4814 | - //计算计划里程(主任务过滤掉临加班次),烂班里程,临加里程,计划班次,烂班班次,增加班次 | |
| 4815 | - //计划里程(主任务过滤掉临加班次), | |
| 4816 | - //烂班里程(主任务烂班), | |
| 4817 | - //临加里程(主任务临加), | |
| 4818 | - //计划班次,烂班班次,增加班次 | |
| 4819 | - double jh = 0, sj = 0; | |
| 4820 | - tempJhlc = scheduleRealInfo.getJhlc() == null ? 0 : scheduleRealInfo.getJhlc(); | |
| 4821 | - if (scheduleRealInfo.isSflj()) { | |
| 4822 | - ljbc++; | |
| 4823 | - } else { | |
| 4824 | - if (!(scheduleRealInfo.getBcType().equals("in") | |
| 4825 | - || scheduleRealInfo.getBcType().equals("out"))) { | |
| 4826 | - jhbc++; | |
| 4827 | - jh += tempJhlc; | |
| 4828 | - } | |
| 4829 | - if (scheduleRealInfo.getStatus() == -1) { | |
| 4830 | - remMileage += tempJhlc; | |
| 4831 | - cjbc++; | |
| 4832 | - } | |
| 4833 | - } | |
| 4834 | - Set<ChildTaskPlan> childTaskPlans = scheduleRealInfo.getcTasks(); | |
| 4835 | - //计算营运里程,空驶里程 | |
| 4836 | - if (childTaskPlans.isEmpty()) { | |
| 4837 | - if (scheduleRealInfo.getBcType().equals("in") || scheduleRealInfo.getBcType().equals("out") | |
| 4838 | - ) { | |
| 4839 | - jcclc += tempJhlc; | |
| 4840 | - } else { | |
| 4841 | - if (scheduleRealInfo.getStatus() != -1) { | |
| 4842 | - if (scheduleRealInfo.isSflj()) { | |
| 4843 | - addMileage += tempJhlc; | |
| 4844 | - } | |
| 4845 | - sj += tempJhlc; | |
| 4846 | - } | |
| 4847 | - } | |
| 4848 | - } else { | |
| 4849 | - Iterator<ChildTaskPlan> it = childTaskPlans.iterator(); | |
| 4850 | - while (it.hasNext()) { | |
| 4851 | - ChildTaskPlan childTaskPlan = it.next(); | |
| 4852 | - if (childTaskPlan.getMileageType().equals("empty")) { | |
| 4853 | - if (childTaskPlan.isDestroy()) { | |
| 4854 | - remMileage += childTaskPlan.getMileage() == null ? 0 : childTaskPlan.getMileage(); | |
| 4855 | - } else { | |
| 4856 | - if (scheduleRealInfo.isSflj()) { | |
| 4857 | - addMileage += tempJhlc; | |
| 4858 | - } | |
| 4859 | - ksgl += childTaskPlan.getMileage() == null ? 0 : childTaskPlan.getMileage(); | |
| 4860 | - } | |
| 4861 | - } else { | |
| 4862 | - if (childTaskPlan.isDestroy()) { | |
| 4863 | - remMileage += childTaskPlan.getMileage() == null ? 0 : childTaskPlan.getMileage(); | |
| 4864 | -// cjbc++; | |
| 4865 | - } else { | |
| 4866 | - if (scheduleRealInfo.isSflj()) { | |
| 4867 | - addMileage += tempJhlc; | |
| 4868 | - } | |
| 4869 | - sj += childTaskPlan.getMileage() == null ? 0 : childTaskPlan.getMileage(); | |
| 4870 | - } | |
| 4871 | - } | |
| 4872 | - } | |
| 4873 | - } | |
| 4874 | - | |
| 4875 | - if (!(scheduleRealInfo.getBcType().equals("in") || scheduleRealInfo.getBcType().equals("out"))) { | |
| 4876 | - map = new HashMap<String, Object>(); | |
| 4877 | - try { | |
| 4878 | - scheduleRealInfo.setBcs(xyz); | |
| 4879 | - xyz++; | |
| 4880 | - Set<ChildTaskPlan> cs = scheduleRealInfo.getcTasks(); | |
| 4881 | - Double sjlc = 0.0; | |
| 4882 | - if (!cs.isEmpty()) { | |
| 4883 | - Iterator<ChildTaskPlan> it = cs.iterator(); | |
| 4884 | - while (it.hasNext()) { | |
| 4885 | - ChildTaskPlan c = it.next(); | |
| 4886 | - if (!c.isDestroy()) { | |
| 4887 | - sjlc += c.getMileage() == null ? 0 : c.getMileage(); | |
| 4888 | - } | |
| 4889 | - | |
| 4890 | - } | |
| 4891 | - } else { | |
| 4892 | - if (scheduleRealInfo.getStatus() != -1) { | |
| 4893 | - sjlc = scheduleRealInfo.getJhlc(); | |
| 4894 | - } | |
| 4895 | - } | |
| 4896 | - scheduleRealInfo.setjName(scheduleRealInfo.getjGh() + scheduleRealInfo.getjName()); | |
| 4897 | - scheduleRealInfo.setsName(scheduleRealInfo.getsGh() + scheduleRealInfo.getsName()); | |
| 4898 | - scheduleRealInfo.setSjlc(format.format(sjlc)); | |
| 4899 | - map = rru.getMapValue(scheduleRealInfo); | |
| 4900 | - String zdsj = scheduleRealInfo.getZdsj(); | |
| 4901 | - String zdsjActual = scheduleRealInfo.getZdsjActual(); | |
| 4902 | - if (zdsj != null && zdsjActual != null && | |
| 4903 | - !zdsj.equals(zdsjActual)) { | |
| 4904 | - int zdsjT = Integer.valueOf(zdsj.split(":")[0]) * 60 + Integer.valueOf(zdsj.split(":")[1]); | |
| 4905 | - int zdsjAT = Integer.valueOf(zdsjActual.split(":")[0]) * 60 + Integer.valueOf(zdsjActual.split(":")[1]); | |
| 4906 | - if (zdsj.compareTo(zdsjActual) > 0) { | |
| 4907 | - if (zdsjT - zdsjAT > 1000) { | |
| 4908 | - map.put("fast", ""); | |
| 4909 | - map.put("slow", zdsjAT - zdsjT + 1440); | |
| 4910 | - } else { | |
| 4911 | - map.put("fast", TimeUtils.getTimeDifference(zdsj, zdsjActual)); | |
| 4912 | - map.put("slow", ""); | |
| 4913 | - } | |
| 4914 | - } else { | |
| 4915 | - if (zdsjAT - zdsjT > 1000) { | |
| 4916 | - map.put("fast", zdsjT - zdsjAT + 1440); | |
| 4917 | - map.put("slow", ""); | |
| 4918 | - } else { | |
| 4919 | - map.put("fast", ""); | |
| 4920 | - map.put("slow", TimeUtils.getTimeDifference(zdsj, zdsjActual)); | |
| 4921 | - } | |
| 4922 | - } | |
| 4923 | - } else { | |
| 4924 | - map.put("fast", ""); | |
| 4925 | - map.put("slow", ""); | |
| 4926 | - } | |
| 4927 | - listMap.add(map); | |
| 4928 | - } catch (Exception e) { | |
| 4929 | - e.printStackTrace(); | |
| 4930 | - } | |
| 4931 | - } | |
| 4932 | - jhlc += jh; | |
| 4933 | - yygl += sj; | |
| 4934 | - if (jh > sj) { | |
| 4935 | - remgl += jh - sj; | |
| 4936 | - } else { | |
| 4937 | - addgl += sj - jh; | |
| 4938 | - } | |
| 4939 | - } | |
| 4940 | - } | |
| 4941 | - | |
| 4942 | - | |
| 4943 | - List<Ylxxb> listYlxxb = ylxxbRepository.queryListYlxxb(clZbh, date); | |
| 4944 | - Double jzl = 0.0; | |
| 4945 | - for (int t = 0; t < listYlxxb.size(); t++) { | |
| 4946 | - Ylxxb y = listYlxxb.get(t); | |
| 4947 | - jzl += y.getJzl(); | |
| 4948 | - } | |
| 4949 | - | |
| 4950 | - //计算里程和班次数,并放入Map里 | |
| 4951 | - map = findKMBCQp(clZbh, date, line); | |
| 4952 | - map.put("jzl", jzl); | |
| 4953 | -// map.put("jhlc", format.format(jhlc + jcclc)); | |
| 4954 | -// map.put("yygljh", format.format(jhlc)); | |
| 4955 | -// map.put("ssgl", format.format(remMileage)); | |
| 4956 | -// map.put("ksgl", format.format(ksgl)); | |
| 4957 | -// map.put("yyglsj", format.format(yygl)); | |
| 4958 | -// map.put("jhbc", jhbc); | |
| 4959 | -// map.put("jcclc", jcclc); | |
| 4960 | -// | |
| 4961 | -// map.put("ljgl", format.format(addMileage)); | |
| 4962 | -// map.put("ssbc", cjbc); | |
| 4963 | -// map.put("ysgl", format.format(yygl)); | |
| 4964 | -// map.put("sjbc", jhbc - cjbc + ljbc); | |
| 4965 | -// map.put("zgl", format.format(yygl + ksgl + jcclc)); | |
| 4966 | -// map.put("ljbc", ljbc); | |
| 4967 | - | |
| 4968 | - String zdp = "", zwdp = "", wdp = ""; | |
| 4969 | - SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm"); | |
| 4970 | - List<DutyEmployee> listDtuy = dutyEmployeeService.getDutyEmployee(line, date + "00:00", date + "23:59"); | |
| 4971 | - try { | |
| 4972 | - Long fcsj1 = sdf.parse(date + " 03:00").getTime(); | |
| 4973 | - Long fcsj2 = sdf.parse(date + " 11:00").getTime(); | |
| 4974 | - Long fcsj3 = sdf.parse(date + " 22:00").getTime(); | |
| 4975 | - for (int i = 0; i < listDtuy.size(); i++) { | |
| 4976 | - DutyEmployee t = listDtuy.get(i); | |
| 4977 | - Long ts = t.getTs(); | |
| 4978 | - if (ts > fcsj1 && ts < fcsj2) { | |
| 4979 | - if (zdp.indexOf(t.getuName()) == -1) { | |
| 4980 | - zdp += t.getuName() + ","; | |
| 4981 | - | |
| 4982 | - } | |
| 4983 | - } else if (ts > fcsj2 && ts < fcsj3) { | |
| 4984 | - if (zwdp.indexOf(t.getuName()) == -1) { | |
| 4985 | - zwdp += t.getuName() + ","; | |
| 4986 | - } | |
| 4987 | - } else { | |
| 4988 | - if (wdp.indexOf(t.getuName()) == -1) { | |
| 4989 | - wdp += t.getuName() + ","; | |
| 4990 | - } | |
| 4991 | - } | |
| 4992 | - } | |
| 4993 | - } catch (ParseException e) { | |
| 4994 | - // TODO Auto-generated catch block | |
| 4995 | - e.printStackTrace(); | |
| 4996 | - } | |
| 4997 | - map.put("zdp", zdp); | |
| 4998 | - map.put("zwdp", zwdp); | |
| 4999 | - map.put("wdp", wdp); | |
| 5000 | - String path = this.getClass().getResource("/").getPath() + "static/pages/forms/"; | |
| 5001 | - list.add(listMap.iterator()); | |
| 5002 | - ee.excelReplace(list, new Object[]{scheduleRealInfos.get(0), map}, path + "mould/waybill_qingpu.xls", | |
| 5003 | - path + "export/" + date + "-" + clZbh + "-行车路单.xls"); | |
| 5004 | - | |
| 5005 | - return scheduleRealInfos; | |
| 5006 | - } | |
| 5007 | - | |
| 5008 | - @Override | |
| 5009 | - public Map<String, Object> findKMBCQp(String clZbh, String date, String line) { | |
| 5010 | - // TODO Auto-generated method stub | |
| 5011 | - List<ScheduleRealInfo> lists = scheduleRealInfoRepository.queryListWaybill2(clZbh, date, line); | |
| 5012 | - DecimalFormat format = new DecimalFormat("0.00"); | |
| 5013 | -// int cjbc = scheduleRealInfoRepository.findCjbc(jName, clZbh, lpName); | |
| 5014 | -// int ljbc = scheduleRealInfoRepository.findLjbc(jName, clZbh, lpName); | |
| 5015 | - int jhbc = 0, cjbc = 0, ljbc = 0, sjbc = 0; | |
| 5016 | - double jhlc = 0, yygl = 0, ksgl = 0, tempJhlc = 0, jcclc = 0, ljjcclc = 0, jhjcclc = 0; | |
| 5017 | - double addMileage = 0, remMileage = 0, addgl = 0, remgl = 0; | |
| 5018 | - Map<String, Object> map = new HashMap<String, Object>(); | |
| 5019 | - jhlc = culateMieageService.culateJhgl(lists); | |
| 5020 | - jcclc = culateMieageService.culateJccgl(lists); | |
| 5021 | - jhjcclc = culateMieageService.culateJhJccgl(lists); | |
| 5022 | - remMileage = culateMieageService.culateLbgl(lists); | |
| 5023 | - ksgl = culateMieageService.culateKsgl(lists); | |
| 5024 | - yygl = culateMieageService.culateSjgl(lists); | |
| 5025 | - jhbc = culateMieageService.culateJhbc(lists, ""); | |
| 5026 | - addMileage = culateMieageService.culateLjgl(lists); | |
| 5027 | - cjbc = culateMieageService.culateLbbc(lists); | |
| 5028 | - sjbc = culateMieageService.culateSjbc(lists, ""); | |
| 5029 | - ljbc = culateMieageService.culateLjbc(lists, ""); | |
| 5030 | - double zyygl = Arith.add(yygl, addMileage); | |
| 5031 | - double zksgl = Arith.add(ksgl, jcclc); | |
| 5032 | - map.put("jhlc", Arith.add(jhlc, jhjcclc)); | |
| 5033 | - map.put("yygljh", jhlc); | |
| 5034 | - map.put("ssgl", remMileage); | |
| 5035 | - map.put("ksgl", ksgl); | |
| 5036 | - map.put("yyglsj", Arith.add(yygl, addMileage)); | |
| 5037 | - map.put("jcclc", jcclc); | |
| 5038 | - map.put("jhbc", jhbc); | |
| 5039 | - map.put("ljgl", addMileage); | |
| 5040 | - map.put("ssbc", cjbc); | |
| 5041 | - map.put("ysgl", Arith.add(yygl, addMileage)); | |
| 5042 | - map.put("sjbc", sjbc); | |
| 5043 | - map.put("zgl", Arith.add(zyygl, zksgl)); | |
| 5044 | - map.put("ljbc", ljbc); | |
| 5045 | - | |
| 5046 | - return map; | |
| 5047 | - } | |
| 5048 | - | |
| 5049 | - @Override | |
| 5050 | - public List<ScheduleRealInfo> queryListWaybillQp(String clZbh, String date, String line) { | |
| 5051 | - // TODO Auto-generated method stub | |
| 5052 | - DecimalFormat format = new DecimalFormat("0.00"); | |
| 5053 | - List<ScheduleRealInfo> list = null; | |
| 5054 | - list = scheduleRealInfoRepository.queryListWaybill2(clZbh, date, line); | |
| 5055 | - List<ScheduleRealInfo> newList = new ArrayList<ScheduleRealInfo>(); | |
| 5056 | - for (int i = 0; i < list.size(); i++) { | |
| 5057 | - ScheduleRealInfo s = list.get(i); | |
| 5058 | - if (!(s.getBcType().equals("in") || s.getBcType().equals("out"))) { | |
| 5059 | - String remarks = ""; | |
| 5060 | - Double sjlc = 0.0; | |
| 5061 | - if (s.getRemarks() != null) { | |
| 5062 | - remarks += s.getRemarks(); | |
| 5063 | - } | |
| 5064 | - Set<ChildTaskPlan> childTaskPlans = s.getcTasks(); | |
| 5065 | - if (!childTaskPlans.isEmpty()) { | |
| 5066 | - Iterator<ChildTaskPlan> it = childTaskPlans.iterator(); | |
| 5067 | - while (it.hasNext()) { | |
| 5068 | - ChildTaskPlan c = it.next(); | |
| 5069 | - if (c.getRemarks() != null && c.getRemarks().length() > 0) { | |
| 5070 | - if (remarks.indexOf(c.getRemarks()) == -1) { | |
| 5071 | - remarks += c.getRemarks(); | |
| 5072 | - } | |
| 5073 | - } | |
| 5074 | - | |
| 5075 | - if (!c.isDestroy()) { | |
| 5076 | - if (c.getMileageType().equals("service")) { | |
| 5077 | - sjlc += c.getMileage() == null ? 0 : c.getMileage(); | |
| 5078 | - } | |
| 5079 | - } | |
| 5080 | - | |
| 5081 | - } | |
| 5082 | - } else { | |
| 5083 | - if (s.getStatus() != -1) { | |
| 5084 | - sjlc = s.getJhlc(); | |
| 5085 | - } | |
| 5086 | - } | |
| 5087 | - s.setSjlc(format.format(sjlc)); | |
| 5088 | - s.setRemarks(remarks); | |
| 5089 | - newList.add(s); | |
| 5090 | - } | |
| 5091 | - | |
| 5092 | - } | |
| 5093 | - | |
| 5094 | - return newList; | |
| 5095 | - } | |
| 5096 | - | |
| 5097 | - @Override | |
| 5098 | - public Map<String, Object> MapById(Long id) { | |
| 5099 | - // TODO Auto-generated method stub | |
| 5100 | - Map<String, Object> dMap=new HashMap<>(); | |
| 5101 | - dMap.put("dGroup_eq", "oilType"); | |
| 5102 | - Iterator<Dictionary> it= dictionaryService.list(dMap).iterator(); | |
| 5103 | - while (it.hasNext()) { | |
| 5104 | - Dictionary d=it.next(); | |
| 5105 | - dMap.put(d.getdCode(), d.getdName()); | |
| 5106 | - } | |
| 5107 | - Map<String, Object> map = new HashMap<String, Object>(); | |
| 5108 | - SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm"); | |
| 5109 | - ScheduleRealInfo s = scheduleRealInfoRepository.scheduleById(id); | |
| 5110 | - String xlbm = s.getXlBm(); | |
| 5111 | - String fcrq = s.getScheduleDateStr(); | |
| 5112 | - | |
| 5113 | - int type = 2; | |
| 5114 | - Double ccyl = 0.0; | |
| 5115 | - Double jcyl = 0.0; | |
| 5116 | - Double yh = 0.0; | |
| 5117 | - Double jzl = 0.0; | |
| 5118 | - Double zlc = 0.0; | |
| 5119 | - String rylx=""; | |
| 5120 | - int hyd = 0; | |
| 5121 | - Double czql = 0.0, jzql = 0.0, hq = 0.0, jql = 0.0; | |
| 5122 | - List<Cars> listCars = carsRepository.findCarsByCode(s.getClZbh()); | |
| 5123 | - if (listCars.size() > 0) { | |
| 5124 | - if (listCars.get(0).getSfdc() != null) { | |
| 5125 | - if (listCars.get(0).getSfdc()) { | |
| 5126 | - List<Dlb> listDlb = dlbRepository.queryListDlb(fcrq, s.getClZbh(), s.getjGh(), xlbm); | |
| 5127 | - type = 1; | |
| 5128 | - for (int i = 0; i < listDlb.size(); i++) { | |
| 5129 | - Dlb d = listDlb.get(i); | |
| 5130 | - if (d.getLp() == null) { | |
| 5131 | - ccyl = Arith.add(ccyl, d.getCzcd()); | |
| 5132 | - jcyl = Arith.add(jcyl, d.getJzcd()); | |
| 5133 | - yh = Arith.add(yh, d.getHd()); | |
| 5134 | - jzl = Arith.add(jzl, d.getCdl()); | |
| 5135 | - zlc = Arith.add(zlc, d.getZlc()); | |
| 5136 | - } else { | |
| 5137 | - if (d.getLp().equals(s.getLpName())) { | |
| 5138 | - ccyl = Arith.add(ccyl, d.getCzcd()); | |
| 5139 | - jcyl = Arith.add(jcyl, d.getJzcd()); | |
| 5140 | - yh = Arith.add(yh, d.getHd()); | |
| 5141 | - jzl = Arith.add(jzl, d.getCdl()); | |
| 5142 | - zlc = Arith.add(zlc, d.getZlc()); | |
| 5143 | - } | |
| 5144 | - } | |
| 5145 | - | |
| 5146 | - } | |
| 5147 | - } else { | |
| 5148 | - List<Ylb> listYlb = ylbRepository.queryListYlb(fcrq, s.getClZbh(), s.getjGh(), xlbm); | |
| 5149 | - type = 0; | |
| 5150 | - for (int i = 0; i < listYlb.size(); i++) { | |
| 5151 | - Ylb y = listYlb.get(i); | |
| 5152 | - if (y.getLp() == null) { | |
| 5153 | - ccyl = Arith.add(ccyl, y.getCzyl()); | |
| 5154 | - jcyl = Arith.add(jcyl, y.getJzyl()); | |
| 5155 | - yh = Arith.add(yh, y.getYh()); | |
| 5156 | - jzl = Arith.add(jzl, y.getJzl()); | |
| 5157 | - zlc = Arith.add(zlc, y.getZlc()); | |
| 5158 | - if(dMap.get(y.getRylx())!=null) | |
| 5159 | - rylx =dMap.get(y.getRylx()).toString(); | |
| 5160 | - } else { | |
| 5161 | - if (y.getLp().equals(s.getLpName())) { | |
| 5162 | - ccyl = Arith.add(ccyl, y.getCzyl()); | |
| 5163 | - jcyl = Arith.add(jcyl, y.getJzyl()); | |
| 5164 | - yh = Arith.add(yh, y.getYh()); | |
| 5165 | - jzl = Arith.add(jzl, y.getJzl()); | |
| 5166 | - zlc = Arith.add(zlc, y.getZlc()); | |
| 5167 | - if(dMap.get(y.getRylx())!=null) | |
| 5168 | - rylx =dMap.get(y.getRylx()).toString(); | |
| 5169 | - } | |
| 5170 | - } | |
| 5171 | - } | |
| 5172 | - } | |
| 5173 | - } | |
| 5174 | - if(listCars.get(0).getHydrogen() != null && listCars.get(0).getHydrogen()){ | |
| 5175 | - List<Qlb> listQlb = qlbRepository.queryListQlb(fcrq, s.getClZbh(), s.getjGh(), xlbm); | |
| 5176 | - hyd = 1; | |
| 5177 | - for (int i = 0; i < listQlb.size(); i++) { | |
| 5178 | - Qlb h = listQlb.get(i); | |
| 5179 | - if (h.getLp() == null) { | |
| 5180 | - czql = Arith.add(czql, h.getCzcl()); | |
| 5181 | - jzql = Arith.add(jzql, h.getJzcl()); | |
| 5182 | - hq = Arith.add(hq, h.getHn()); | |
| 5183 | - jql = Arith.add(jql, h.getJql()); | |
| 5184 | - } else { | |
| 5185 | - if (h.getLp().equals(s.getLpName())) { | |
| 5186 | - czql = Arith.add(czql, h.getCzcl()); | |
| 5187 | - jzql = Arith.add(jzql, h.getJzcl()); | |
| 5188 | - hq = Arith.add(hq, h.getHn()); | |
| 5189 | - jql = Arith.add(jql, h.getJql()); | |
| 5190 | - } | |
| 5191 | - } | |
| 5192 | - } | |
| 5193 | - } | |
| 5194 | - } | |
| 5195 | - | |
| 5196 | - map.put("hyd", hyd); | |
| 5197 | - map.put("czcl", czql); | |
| 5198 | - map.put("jzcl", jzql); | |
| 5199 | - map.put("hn", hq); | |
| 5200 | - map.put("jql", jql); | |
| 5201 | - | |
| 5202 | - map.put("rylx", "加注类别:"+rylx); | |
| 5203 | - map.put("jzl", jzl); | |
| 5204 | - map.put("yh", yh); | |
| 5205 | - map.put("ccyl", ccyl); | |
| 5206 | - map.put("jcyl", jcyl); | |
| 5207 | - map.put("type", type); | |
| 5208 | - map.put("zlc", zlc); | |
| 5209 | - map.put("xlName", s.getXlName()); | |
| 5210 | - map.put("clZbh", s.getClZbh()); | |
| 5211 | - map.put("plate", BasicData.nbbmCompanyPlateMap.get(s.getClZbh())); | |
| 5212 | - map.put("fcsjActual", s.getFcsjActual()); | |
| 5213 | - map.put("zdzName", s.getZdzName()); | |
| 5214 | - map.put("scheduleDate", s.getScheduleDateStr()); | |
| 5215 | - map.put("lpName", s.getLpName()); | |
| 5216 | - String zdp = "", zwdp = "", wdp = ""; | |
| 5217 | - String zdpT = "", zwdpT = "", wdpT = ""; | |
| 5218 | - String dbdp = ""; | |
| 5219 | - List<DutyEmployee> list = dutyEmployeeService.getDutyEmployee(xlbm, fcrq + "00:01", fcrq + "23:59"); | |
| 5220 | - try { | |
| 5221 | - Long fcsj1 = sdf.parse(fcrq + " 00:01").getTime(); | |
| 5222 | - Long fcsj2 = sdf.parse(fcrq + " 11:00").getTime(); | |
| 5223 | - Long fcsj3 = sdf.parse(fcrq + " 23:59").getTime(); | |
| 5224 | - for (int i = 0; i < list.size(); i++) { | |
| 5225 | - DutyEmployee t = list.get(i); | |
| 5226 | - if (dbdp.indexOf(t.getuName()) == -1) { | |
| 5227 | - if (!(dbdp.length() > 0)) { | |
| 5228 | - dbdp = t.getuName(); | |
| 5229 | - } else { | |
| 5230 | - dbdp += "," + t.getuName(); | |
| 5231 | - } | |
| 5232 | - } | |
| 5233 | - Long ts = t.getTs(); | |
| 5234 | - if (ts > fcsj1 && ts < fcsj2) { | |
| 5235 | - if (zdp.indexOf(t.getuName()) == -1) { | |
| 5236 | - if (!(zdp.length() > 0)) { | |
| 5237 | - zdpT = t.getuName() + "..."; | |
| 5238 | - } | |
| 5239 | - zdp += t.getuName() + ","; | |
| 5240 | - | |
| 5241 | - } | |
| 5242 | - } else if (ts > fcsj2 && ts < fcsj3) { | |
| 5243 | - if (zwdp.indexOf(t.getuName()) == -1) { | |
| 5244 | - if (!(zwdp.length() > 0)) { | |
| 5245 | - zwdpT = t.getuName() + "..."; | |
| 5246 | - } | |
| 5247 | - zwdp += t.getuName() + ","; | |
| 5248 | - } | |
| 5249 | - } else { | |
| 5250 | - if (wdp.indexOf(t.getuName()) == -1) { | |
| 5251 | - if (!(wdp.length() > 0)) { | |
| 5252 | - wdpT = t.getuName() + "..."; | |
| 5253 | - } | |
| 5254 | - wdp += t.getuName() + ","; | |
| 5255 | - } | |
| 5256 | - } | |
| 5257 | - } | |
| 5258 | - } catch (ParseException e) { | |
| 5259 | - // TODO Auto-generated catch block | |
| 5260 | - e.printStackTrace(); | |
| 5261 | - } | |
| 5262 | - map.put("zdp", zdp); | |
| 5263 | - map.put("zwdp", zwdp); | |
| 5264 | - map.put("wdp", wdp); | |
| 5265 | - map.put("zdpT", zdpT); | |
| 5266 | - map.put("zwdpT", zwdpT); | |
| 5267 | - map.put("wdpT", wdpT); | |
| 5268 | - map.put("dbdp", dbdp); | |
| 5269 | - return map; | |
| 5270 | - } | |
| 5271 | - | |
| 5272 | - @Override | |
| 5273 | - public Map<String, Object> MapByIdQp(Long id) { | |
| 5274 | - // TODO Auto-generated method stub | |
| 5275 | - Map<String, Object> map = new HashMap<String, Object>(); | |
| 5276 | - SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm"); | |
| 5277 | - ScheduleRealInfo s = scheduleRealInfoRepository.scheduleById(id); | |
| 5278 | - String xlbm = s.getXlBm(); | |
| 5279 | - String fcrq = s.getScheduleDateStr(); | |
| 5280 | - | |
| 5281 | - int type = 0; | |
| 5282 | - Double ccyl = 0.0; | |
| 5283 | - Double jcyl = 0.0; | |
| 5284 | - Double yh = 0.0; | |
| 5285 | - Double jzl = 0.0; | |
| 5286 | - Double zlc = 0.0; | |
| 5287 | -// List<Ylb> listYlb = ylbRepository.queryListYlb(fcrq, s.getClZbh(), s.getjGh(),xlbm); | |
| 5288 | -// List<Dlb> listDlb = dlbRepository.queryListDlb(fcrq, s.getClZbh(), s.getjGh(),xlbm); | |
| 5289 | -// if(listYlb.size()>0){ | |
| 5290 | -// type=0; | |
| 5291 | -// for (int i = 0; i < listYlb.size(); i++) { | |
| 5292 | -// Ylb y = listYlb.get(i); | |
| 5293 | -// if(y.getLp()==null){ | |
| 5294 | -// ccyl=Arith.add(ccyl, y.getCzyl()); | |
| 5295 | -// jcyl=Arith.add(jcyl, y.getJzyl()); | |
| 5296 | -// yh =Arith.add(yh ,y.getYh()); | |
| 5297 | -// jzl =Arith.add(jzl, y.getJzl()); | |
| 5298 | -// zlc =Arith.add(zlc, y.getZlc()); | |
| 5299 | -// }else{ | |
| 5300 | -// if(y.getLp().equals(s.getLpName())){ | |
| 5301 | -// ccyl=Arith.add(ccyl, y.getCzyl()); | |
| 5302 | -// jcyl=Arith.add(jcyl, y.getJzyl()); | |
| 5303 | -// yh =Arith.add(yh ,y.getYh()); | |
| 5304 | -// jzl =Arith.add(jzl, y.getJzl()); | |
| 5305 | -// zlc =Arith.add(zlc, y.getZlc()); | |
| 5306 | -// } | |
| 5307 | -// } | |
| 5308 | -// | |
| 5309 | -// } | |
| 5310 | -// }else{ | |
| 5311 | -// type=1; | |
| 5312 | -// for (int i = 0; i < listDlb.size(); i++) { | |
| 5313 | -// Dlb d=listDlb.get(i); | |
| 5314 | -// if(d.getLp()==null){ | |
| 5315 | -// ccyl=Arith.add(ccyl, d.getCzcd()); | |
| 5316 | -// jcyl=Arith.add(jcyl, d.getJzcd()); | |
| 5317 | -// yh =Arith.add(yh ,d.getHd()); | |
| 5318 | -// jzl =Arith.add(jzl, d.getCdl()); | |
| 5319 | -// zlc =Arith.add(zlc, d.getZlc()); | |
| 5320 | -// }else{ | |
| 5321 | -// if(d.getLp().equals(s.getLpName())){ | |
| 5322 | -// ccyl=Arith.add(ccyl, d.getCzcd()); | |
| 5323 | -// jcyl=Arith.add(jcyl, d.getJzcd()); | |
| 5324 | -// yh =Arith.add(yh ,d.getHd()); | |
| 5325 | -// jzl =Arith.add(jzl, d.getCdl()); | |
| 5326 | -// zlc =Arith.add(zlc, d.getZlc()); | |
| 5327 | -// } | |
| 5328 | -// } | |
| 5329 | -// | |
| 5330 | -// } | |
| 5331 | -// } | |
| 5332 | - | |
| 5333 | - List<Ylxxb> listylxxb = ylxxbRepository.queryListYlxxb(s.getClZbh(), fcrq); | |
| 5334 | - for (int i = 0; i < listylxxb.size(); i++) { | |
| 5335 | - Ylxxb t = listylxxb.get(i); | |
| 5336 | - jzl = Arith.add(jzl, t.getJzl()); | |
| 5337 | - } | |
| 5338 | - map.put("jzl", jzl); | |
| 5339 | - map.put("yh", yh); | |
| 5340 | - map.put("ccyl", ccyl); | |
| 5341 | - map.put("jcyl", jcyl); | |
| 5342 | - map.put("type", type); | |
| 5343 | - map.put("zlc", zlc); | |
| 5344 | - map.put("xlName", s.getXlName()); | |
| 5345 | - map.put("clZbh", s.getClZbh()); | |
| 5346 | - map.put("plate", BasicData.nbbmCompanyPlateMap.get(s.getClZbh())); | |
| 5347 | - map.put("fcsjActual", s.getFcsjActual()); | |
| 5348 | - map.put("zdzName", s.getZdzName()); | |
| 5349 | - map.put("scheduleDate", s.getScheduleDateStr()); | |
| 5350 | - map.put("lpName", s.getLpName()); | |
| 5351 | - String zdp = "", zwdp = "", wdp = ""; | |
| 5352 | - String zdpT = "", zwdpT = "", wdpT = ""; | |
| 5353 | - String dbdp = ""; | |
| 5354 | - List<DutyEmployee> list = dutyEmployeeService.getDutyEmployee(xlbm, fcrq + "00:01", fcrq + "23:59"); | |
| 5355 | - try { | |
| 5356 | - Long fcsj1 = sdf.parse(fcrq + " 00:01").getTime(); | |
| 5357 | - Long fcsj2 = sdf.parse(fcrq + " 11:00").getTime(); | |
| 5358 | - Long fcsj3 = sdf.parse(fcrq + " 23:59").getTime(); | |
| 5359 | - for (int i = 0; i < list.size(); i++) { | |
| 5360 | - DutyEmployee t = list.get(i); | |
| 5361 | - if (dbdp.indexOf(t.getuName()) == -1) { | |
| 5362 | - if (!(dbdp.length() > 0)) { | |
| 5363 | - dbdp = t.getuName(); | |
| 5364 | - } else { | |
| 5365 | - dbdp += "," + t.getuName(); | |
| 5366 | - } | |
| 5367 | - } | |
| 5368 | - Long ts = t.getTs(); | |
| 5369 | - if (ts > fcsj1 && ts < fcsj2) { | |
| 5370 | - if (zdp.indexOf(t.getuName()) == -1) { | |
| 5371 | - if (!(zdp.length() > 0)) { | |
| 5372 | - zdpT = t.getuName() + "..."; | |
| 5373 | - } | |
| 5374 | - zdp += t.getuName() + ","; | |
| 5375 | - | |
| 5376 | - } | |
| 5377 | - } else if (ts > fcsj2 && ts < fcsj3) { | |
| 5378 | - if (zwdp.indexOf(t.getuName()) == -1) { | |
| 5379 | - if (!(zwdp.length() > 0)) { | |
| 5380 | - zwdpT = t.getuName() + "..."; | |
| 5381 | - } | |
| 5382 | - zwdp += t.getuName() + ","; | |
| 5383 | - } | |
| 5384 | - } else { | |
| 5385 | - if (wdp.indexOf(t.getuName()) == -1) { | |
| 5386 | - if (!(wdp.length() > 0)) { | |
| 5387 | - wdpT = t.getuName() + "..."; | |
| 5388 | - } | |
| 5389 | - wdp += t.getuName() + ","; | |
| 5390 | - } | |
| 5391 | - } | |
| 5392 | - } | |
| 5393 | - } catch (ParseException e) { | |
| 5394 | - // TODO Auto-generated catch block | |
| 5395 | - e.printStackTrace(); | |
| 5396 | - } | |
| 5397 | - map.put("zdp", zdp); | |
| 5398 | - map.put("zwdp", zwdp); | |
| 5399 | - map.put("wdp", wdp); | |
| 5400 | - map.put("zdpT", zdpT); | |
| 5401 | - map.put("zwdpT", zwdpT); | |
| 5402 | - map.put("wdpT", wdpT); | |
| 5403 | - map.put("dbdp", dbdp); | |
| 5404 | - return map; | |
| 5405 | - } | |
| 5406 | - | |
| 5407 | - @Override | |
| 5408 | - public List<Map<String, Object>> scheduleDailyQp(String line, String date) { | |
| 5409 | - // TODO Auto-generated method stub | |
| 5410 | - List<Map<String, Object>> list = new ArrayList<Map<String, Object>>(); | |
| 5411 | - List<ScheduleRealInfo> scheduleRealInfos = scheduleRealInfoRepository.scheduleDailyQp(line, date); | |
| 5412 | - Map<String, Object> map = null; | |
| 5413 | - String lp = "lp"; | |
| 5414 | - String jgh = "jgh"; | |
| 5415 | - String clzbh = "clzbh"; | |
| 5416 | - int bcs = 0; | |
| 5417 | - String thclzbh = ""; | |
| 5418 | - String sgh = "sgh"; | |
| 5419 | - for (int i = 0; i < scheduleRealInfos.size(); i++) { | |
| 5420 | - ScheduleRealInfo scheduleRealInfo = scheduleRealInfos.get(i); | |
| 5421 | - if (scheduleRealInfo.getLpName().equals(lp)) { | |
| 5422 | - bcs++; | |
| 5423 | - String fcsj = scheduleRealInfo.getFcsj(); | |
| 5424 | - | |
| 5425 | - if (!clzbh.equals(scheduleRealInfo.getClZbh())) { | |
| 5426 | - clzbh = scheduleRealInfo.getClZbh(); | |
| 5427 | - if (thclzbh == "") { | |
| 5428 | - thclzbh += scheduleRealInfo.getClZbh() + ","; | |
| 5429 | - } else { | |
| 5430 | - thclzbh += scheduleRealInfo.getClZbh(); | |
| 5431 | - } | |
| 5432 | - map.put("thclzbh", thclzbh); | |
| 5433 | - } | |
| 5434 | - | |
| 5435 | - if (!jgh.equals(scheduleRealInfo.getjGh())) { | |
| 5436 | - jgh = scheduleRealInfo.getjGh(); | |
| 5437 | - if (map.get("jjb2") != null) { | |
| 5438 | - map.put("jjb3", scheduleRealInfo.getjGh() + "/" + | |
| 5439 | - scheduleRealInfo.getFcsjActual()); | |
| 5440 | - | |
| 5441 | - } else { | |
| 5442 | - map.put("jjb2", scheduleRealInfo.getjGh() + "/" + | |
| 5443 | - scheduleRealInfo.getFcsjActual()); | |
| 5444 | - } | |
| 5445 | - | |
| 5446 | - } | |
| 5447 | - | |
| 5448 | - if (scheduleRealInfo.getsGh() != null) { | |
| 5449 | - if (!scheduleRealInfo.getsGh().equals(sgh)) { | |
| 5450 | - sgh = scheduleRealInfo.getsGh() == null ? "" : scheduleRealInfo.getsGh(); | |
| 5451 | - if (!sgh.equals("")) { | |
| 5452 | - if (map.get("sjb1") != null) { | |
| 5453 | - if (map.get("sjb2") != null) { | |
| 5454 | - map.put("sjb3", scheduleRealInfo.getsGh() + "/" + | |
| 5455 | - scheduleRealInfo.getFcsjActual()); | |
| 5456 | - } else { | |
| 5457 | - map.put("sjb2", scheduleRealInfo.getsGh() + "/" + | |
| 5458 | - scheduleRealInfo.getFcsjActual()); | |
| 5459 | - } | |
| 5460 | - } else { | |
| 5461 | - map.put("sjb1", scheduleRealInfo.getsGh() + "/" + | |
| 5462 | - scheduleRealInfo.getFcsjActual()); | |
| 5463 | - } | |
| 5464 | - } | |
| 5465 | - } | |
| 5466 | - } | |
| 5467 | - if (scheduleRealInfo.getFcsjActual() != null) { | |
| 5468 | - String fcsjs[] = fcsj.split(":"); | |
| 5469 | - String fcsjActuals[] = scheduleRealInfo.getFcsjActual().split(":"); | |
| 5470 | - int a = Integer.parseInt(fcsjActuals[0]) * 60 + Integer.parseInt(fcsjActuals[1]); | |
| 5471 | - int b = Integer.parseInt(fcsjs[0]) * 60 + Integer.parseInt(fcsjs[1]); | |
| 5472 | - map.put("cz" + bcs, b - a); | |
| 5473 | - } else { | |
| 5474 | - map.put("cz" + bcs, "无"); | |
| 5475 | - } | |
| 5476 | - map.put("lp", scheduleRealInfo.getLpName()); | |
| 5477 | - map.put("dd" + bcs, scheduleRealInfo.getZdsjActual()); | |
| 5478 | - map.put("kc" + bcs, scheduleRealInfo.getFcsjActual()); | |
| 5479 | - | |
| 5480 | - if (i < scheduleRealInfos.size() - 1) { | |
| 5481 | - if (!scheduleRealInfos.get(i + 1).getLpName().equals | |
| 5482 | - (scheduleRealInfos.get(i).getLpName())) { | |
| 5483 | - list.add(map); | |
| 5484 | - lp = "lp"; | |
| 5485 | - jgh = "jgh"; | |
| 5486 | - clzbh = "clzbh"; | |
| 5487 | - bcs = 0; | |
| 5488 | - thclzbh = ""; | |
| 5489 | - sgh = "sgh"; | |
| 5490 | - } | |
| 5491 | - } else { | |
| 5492 | - list.add(map); | |
| 5493 | - } | |
| 5494 | - } else { | |
| 5495 | - bcs = 1; | |
| 5496 | - map = new HashMap<String, Object>(); | |
| 5497 | - lp = scheduleRealInfo.getLpName(); | |
| 5498 | - jgh = scheduleRealInfo.getjGh(); | |
| 5499 | - clzbh = scheduleRealInfo.getClZbh(); | |
| 5500 | - if (scheduleRealInfo.getsGh() != null) { | |
| 5501 | - sgh = scheduleRealInfo.getsGh(); | |
| 5502 | - map.put("sjb1", scheduleRealInfo.getsGh() + "/" + | |
| 5503 | - scheduleRealInfo.getFcsjActual()); | |
| 5504 | - } | |
| 5505 | - String fcsj = scheduleRealInfo.getFcsj(); | |
| 5506 | - scheduleRealInfo.getFcsjActual(); | |
| 5507 | - map.put("jjb1", jgh + "/" + scheduleRealInfo.getFcsjActual()); | |
| 5508 | - map.put("cccl", clzbh); | |
| 5509 | - | |
| 5510 | - if (scheduleRealInfo.getFcsjActual() != null) { | |
| 5511 | - String fcsjs[] = fcsj.split(":"); | |
| 5512 | - String fcsjActuals[] = scheduleRealInfo.getFcsjActual().split(":"); | |
| 5513 | - int a = Integer.parseInt(fcsjActuals[0]) * 60 + Integer.parseInt(fcsjActuals[1]); | |
| 5514 | - int b = Integer.parseInt(fcsjs[0]) * 60 + Integer.parseInt(fcsjs[1]); | |
| 5515 | - map.put("cz" + bcs, b - a); | |
| 5516 | - } else { | |
| 5517 | - map.put("cz" + bcs, "无"); | |
| 5518 | - } | |
| 5519 | - | |
| 5520 | - | |
| 5521 | - map.put("lp", scheduleRealInfo.getLpName()); | |
| 5522 | - map.put("dd" + bcs, scheduleRealInfo.getZdsjActual()); | |
| 5523 | - map.put("kc" + bcs, scheduleRealInfo.getFcsjActual()); | |
| 5524 | - | |
| 5525 | - if (i < scheduleRealInfos.size() - 1) { | |
| 5526 | - if (!scheduleRealInfos.get(i + 1).getLpName().equals | |
| 5527 | - (scheduleRealInfos.get(i).getLpName())) { | |
| 5528 | - list.add(map); | |
| 5529 | - lp = "lp"; | |
| 5530 | - jgh = "jgh"; | |
| 5531 | - clzbh = "clzbh"; | |
| 5532 | - bcs = 0; | |
| 5533 | - thclzbh = ""; | |
| 5534 | - sgh = "sgh"; | |
| 5535 | - } | |
| 5536 | - } else { | |
| 5537 | - list.add(map); | |
| 5538 | - } | |
| 5539 | - } | |
| 5540 | - | |
| 5541 | - } | |
| 5542 | - return list; | |
| 5543 | - } | |
| 5544 | - | |
| 5545 | - | |
| 5546 | - @Override | |
| 5547 | - public List<Map<String, Object>> scheduleDailyExport(Map<String, Object> map) { | |
| 5548 | - String line = map.get("line").toString(); | |
| 5549 | - String date = map.get("date").toString(); | |
| 5550 | - String xlName = map.get("xlName").toString(); | |
| 5551 | - String state = map.get("state").toString(); | |
| 5552 | - String type = map.get("type").toString(); | |
| 5553 | - String genre =map.get("genre").toString(); | |
| 5554 | - String df=""; | |
| 5555 | - if(map.get("df")!=null){ | |
| 5556 | - df=map.get("df").toString(); | |
| 5557 | - } | |
| 5558 | - | |
| 5559 | - List<Map<String, Object>> dataList2 = new ArrayList<Map<String, Object>>(); | |
| 5560 | - List<Map<String, Object>> dataList3 = new ArrayList<Map<String, Object>>(); | |
| 5561 | - List<Map<String, Object>> list1 = this.statisticsDaily(line, date, xlName, null); | |
| 5562 | - List<ScheduleRealInfo> list2 = this.queryUserInfo(line, date, state); | |
| 5563 | - List<ScheduleRealInfo> list3 = new ArrayList<ScheduleRealInfo>(); | |
| 5564 | - if(genre.equals("qp")) | |
| 5565 | - list3=this.realScheduleListQp(line, date); | |
| 5566 | - else if(genre.equals("zrw")) | |
| 5567 | - list3=this.realScheduleList_zrw(line, date); | |
| 5568 | - else | |
| 5569 | - list3=this.realScheduleList(line, date); | |
| 5570 | - Map<String, Object> nMap = new HashMap<String, Object>(); | |
| 5571 | - nMap.put("date", xlName + date); | |
| 5572 | - nMap.put("jls", list1.get(0).get("jls")); | |
| 5573 | - nMap.put("sjgl", list1.get(0).get("sjgl")); | |
| 5574 | - | |
| 5575 | - int size = 0; | |
| 5576 | - Map<String, Object> tempMap = new HashMap<String, Object>(); | |
| 5577 | - for (int i = 0; i < list2.size(); i++) { | |
| 5578 | - ScheduleRealInfo s = list2.get(i); | |
| 5579 | - if (size == 5) { | |
| 5580 | - size = 0; | |
| 5581 | - dataList2.add(tempMap); | |
| 5582 | - tempMap = new HashMap<String, Object>(); | |
| 5583 | - } | |
| 5584 | - tempMap.put("lp" + size, s.getLpName()); | |
| 5585 | - tempMap.put("ch" + size, s.getClZbh()); | |
| 5586 | - tempMap.put("jz" + size, s.getjGh() + "/" + s.getjName()); | |
| 5587 | - tempMap.put("sz" + size, ""); | |
| 5588 | - tempMap.put("jw" + size, ""); | |
| 5589 | - tempMap.put("sw" + size, ""); | |
| 5590 | - | |
| 5591 | - size++; | |
| 5592 | - } | |
| 5593 | - if (size < 5) { | |
| 5594 | - for (; size < 5; size++) { | |
| 5595 | - tempMap.put("lp" + size, ""); | |
| 5596 | - tempMap.put("ch" + size, ""); | |
| 5597 | - tempMap.put("jz" + size, ""); | |
| 5598 | - tempMap.put("sz" + size, ""); | |
| 5599 | - tempMap.put("jw" + size, ""); | |
| 5600 | - tempMap.put("sw" + size, ""); | |
| 5601 | - } | |
| 5602 | - } | |
| 5603 | - | |
| 5604 | - dataList2.add(tempMap); | |
| 5605 | - | |
| 5606 | - size = 0; | |
| 5607 | - tempMap = new HashMap<String, Object>(); | |
| 5608 | - for (ScheduleRealInfo schedule : list3) { | |
| 5609 | - int x = size % 3; | |
| 5610 | - if (x == 0 && size > 0) { | |
| 5611 | - dataList3.add(tempMap); | |
| 5612 | - tempMap = new HashMap<String, Object>(); | |
| 5613 | - } | |
| 5614 | - tempMap.put("lpName" + x, schedule.getLpName()); | |
| 5615 | - tempMap.put("qdzName" + x, schedule.getQdzName()); | |
| 5616 | - tempMap.put("zdsj" + x, schedule.getZdsj()); | |
| 5617 | - String zdsjActual = schedule.getZdsjActual() != null ? schedule.getZdsjActual() : ""; | |
| 5618 | - tempMap.put("zdsjActual" + x, zdsjActual); | |
| 5619 | - | |
| 5620 | - String zdsjk = ""; | |
| 5621 | - String zdsjm = ""; | |
| 5622 | - if (!zdsjActual.equals("")) { | |
| 5623 | - String[] zdsj_s = schedule.getZdsj().split(":"); | |
| 5624 | - String[] zdsjActual_s = zdsjActual.split(":"); | |
| 5625 | - Long zdsj_ = Long.parseLong(zdsj_s[0]) * 60 + Long.parseLong(zdsj_s[1]); | |
| 5626 | - Long zdsjActual_ = Long.parseLong(zdsjActual_s[0]) * 60 + Long.parseLong(zdsjActual_s[1]); | |
| 5627 | - if ((zdsj_ - zdsjActual_) > 0) { | |
| 5628 | - if(zdsj_ - zdsjActual_>1200){ | |
| 5629 | - zdsjm=String.valueOf(1440-(zdsj_-zdsjActual_)); | |
| 5630 | - }else{ | |
| 5631 | - zdsjk = String.valueOf(zdsj_ - zdsjActual_); | |
| 5632 | - } | |
| 5633 | - } else { | |
| 5634 | - if(zdsjActual_ - zdsj_>1200){ | |
| 5635 | - zdsjk =String.valueOf(1440-(zdsjActual_ - zdsj_)); | |
| 5636 | - }else{ | |
| 5637 | - zdsjm = String.valueOf(zdsjActual_ - zdsj_); | |
| 5638 | - } | |
| 5639 | - } | |
| 5640 | - } | |
| 5641 | - tempMap.put("zdsjk" + x, zdsjk); | |
| 5642 | - tempMap.put("zdsjm" + x, zdsjm.equals("0")?"":zdsjm); | |
| 5643 | - tempMap.put("fcsj" + x, schedule.getFcsj()); | |
| 5644 | - String fcsjActural = schedule.getFcsjActual() != null ? schedule.getFcsjActual() : ""; | |
| 5645 | - String bcType = schedule.getBcType() != null ? schedule.getBcType() : ""; | |
| 5646 | - String fcsjActuralstr = ""; | |
| 5647 | - if (bcType.equals("in")) { | |
| 5648 | - fcsjActuralstr = fcsjActural + "(进)"; | |
| 5649 | - } else if (bcType.equals("out")) { | |
| 5650 | - fcsjActuralstr = fcsjActural + "(出)"; | |
| 5651 | - } else { | |
| 5652 | - fcsjActuralstr = fcsjActural; | |
| 5653 | - } | |
| 5654 | - tempMap.put("fcsjActual" + x, fcsjActuralstr); | |
| 5655 | - String fcsjk = ""; | |
| 5656 | - String fcsjm = ""; | |
| 5657 | - String dfsjk =""; | |
| 5658 | - String dfsjm=""; | |
| 5659 | - if (!fcsjActural.equals("")) { | |
| 5660 | - String[] fcsj_s = schedule.getFcsj().split(":"); | |
| 5661 | - String[] fcsjActural_s = fcsjActural.split(":"); | |
| 5662 | - Long fcsj_ = Long.parseLong(fcsj_s[0]) * 60 + Long.parseLong(fcsj_s[1]); | |
| 5663 | - Long fcsjActural_ = Long.parseLong(fcsjActural_s[0]) * 60 + Long.parseLong(fcsjActural_s[1]); | |
| 5664 | - if ((fcsj_ - fcsjActural_) > 0) { | |
| 5665 | - if(fcsj_ - fcsjActural_>1200){ | |
| 5666 | - fcsjm=String.valueOf(1440-(fcsj_ - fcsjActural_)); | |
| 5667 | - }else{ | |
| 5668 | - fcsjk = String.valueOf(fcsj_ - fcsjActural_); | |
| 5669 | - } | |
| 5670 | - } else { | |
| 5671 | - if(fcsjActural_ - fcsj_>1200){ | |
| 5672 | - fcsjk =String.valueOf(1440-(fcsjActural_ - fcsj_)); | |
| 5673 | - } | |
| 5674 | - else{ | |
| 5675 | - fcsjm = String.valueOf(fcsjActural_ - fcsj_); | |
| 5676 | - } | |
| 5677 | - } | |
| 5678 | - if(df.equals("df")){ | |
| 5679 | - String[] dfsj_s =schedule.getDfsj().split(":"); | |
| 5680 | - Long dfsj_ = Long.parseLong(dfsj_s[0]) * 60 + Long.parseLong(dfsj_s[1]); | |
| 5681 | - if ((dfsj_ - fcsjActural_) > 0) { | |
| 5682 | - if(dfsj_ - fcsjActural_>1200){ | |
| 5683 | - dfsjm=String.valueOf(1440-(dfsj_ - fcsjActural_)); | |
| 5684 | - }else{ | |
| 5685 | - dfsjk = String.valueOf(dfsj_ - fcsjActural_); | |
| 5686 | - } | |
| 5687 | - } else { | |
| 5688 | - if(fcsjActural_ - dfsj_>1200){ | |
| 5689 | - dfsjk= String.valueOf(1440-(fcsjActural_ - dfsj_)); | |
| 5690 | - }else{ | |
| 5691 | - dfsjm = String.valueOf(fcsjActural_ - dfsj_); | |
| 5692 | - } | |
| 5693 | - } | |
| 5694 | - } | |
| 5695 | - } | |
| 5696 | - if(df.equals("df")){ | |
| 5697 | - tempMap.put("dfsj"+x,schedule.getDfsj()); | |
| 5698 | - tempMap.put("dfsjk" + x, dfsjk); | |
| 5699 | - tempMap.put("dfsjm" + x, dfsjm.equals("0")?"":dfsjm); | |
| 5700 | - } | |
| 5701 | - tempMap.put("fcsjk" + x, fcsjk); | |
| 5702 | - tempMap.put("fcsjm" + x, fcsjm.equals("0")?"":fcsjm); | |
| 5703 | - tempMap.put("remarks" + x, schedule.getRemark() != null ? schedule.getRemark() : ""); | |
| 5704 | - | |
| 5705 | - size++; | |
| 5706 | - } | |
| 5707 | - if (tempMap.get("lpName0") != null) { | |
| 5708 | - if (tempMap.get("lpName1") == null) { | |
| 5709 | - tempMap.put("lpName1", ""); | |
| 5710 | - tempMap.put("qdzName1", ""); | |
| 5711 | - tempMap.put("zdsj1", ""); | |
| 5712 | - tempMap.put("zdsjActual1", ""); | |
| 5713 | - tempMap.put("zdsjk1", ""); | |
| 5714 | - tempMap.put("zdsjm1", ""); | |
| 5715 | - tempMap.put("fcsj1", ""); | |
| 5716 | - tempMap.put("fcsjActual1", ""); | |
| 5717 | - tempMap.put("fcsjk1", ""); | |
| 5718 | - tempMap.put("fcsjm1", ""); | |
| 5719 | - if(df.equals("df")){ | |
| 5720 | - tempMap.put("dfsj1",""); | |
| 5721 | - tempMap.put("dfsjk1" , ""); | |
| 5722 | - tempMap.put("dfsjm1" , ""); | |
| 5723 | - } | |
| 5724 | - tempMap.put("remarks1", ""); | |
| 5725 | - } | |
| 5726 | - if (tempMap.get("lpName2") == null) { | |
| 5727 | - tempMap.put("lpName2", ""); | |
| 5728 | - tempMap.put("qdzName2", ""); | |
| 5729 | - tempMap.put("zdsj2", ""); | |
| 5730 | - tempMap.put("zdsjActual2", ""); | |
| 5731 | - tempMap.put("zdsjk2", ""); | |
| 5732 | - tempMap.put("zdsjm2", ""); | |
| 5733 | - tempMap.put("fcsj2", ""); | |
| 5734 | - tempMap.put("fcsjActual2", ""); | |
| 5735 | - tempMap.put("fcsjk2", ""); | |
| 5736 | - tempMap.put("fcsjm2", ""); | |
| 5737 | - if(df.equals("df")){ | |
| 5738 | - tempMap.put("dfsj2",""); | |
| 5739 | - tempMap.put("dfsjk2" , ""); | |
| 5740 | - tempMap.put("dfsjm2" , ""); | |
| 5741 | - } | |
| 5742 | - tempMap.put("remarks2", ""); | |
| 5743 | - } | |
| 5744 | - dataList3.add(tempMap); | |
| 5745 | - } | |
| 5746 | - | |
| 5747 | - if (date.length() == 10) { | |
| 5748 | - List<DutyEmployee> list = dutyEmployeeService.getDutyEmployee(line, date + "00:01", date + "23:59"); | |
| 5749 | - String dbdp = ""; | |
| 5750 | - try { | |
| 5751 | - for (int i = 0; i < list.size(); i++) { | |
| 5752 | - DutyEmployee t = list.get(i); | |
| 5753 | - if (dbdp.indexOf(t.getuName()) == -1) { | |
| 5754 | - if (!(dbdp.length() > 0)) { | |
| 5755 | - dbdp = t.getuName(); | |
| 5756 | - } else { | |
| 5757 | - dbdp += "," + t.getuName(); | |
| 5758 | - } | |
| 5759 | - } | |
| 5760 | - } | |
| 5761 | - } catch (Exception e) { | |
| 5762 | - // TODO: handle exception | |
| 5763 | - e.printStackTrace(); | |
| 5764 | - } | |
| 5765 | - nMap.put("dbdp", dbdp); | |
| 5766 | - } | |
| 5767 | - | |
| 5768 | - if (type.equals("export")) { | |
| 5769 | - String lineName = ""; | |
| 5770 | - if (map.containsKey("lineName")) | |
| 5771 | - lineName = "-" + map.get("lineName").toString() + "-"; | |
| 5772 | - SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"), | |
| 5773 | - sdfSimple = new SimpleDateFormat("yyyyMMdd"); | |
| 5774 | - Map<String, Object> m = new HashMap<String, Object>(); | |
| 5775 | - List<Iterator<?>> listI = new ArrayList<Iterator<?>>(); | |
| 5776 | - ReportUtils ee = new ReportUtils(); | |
| 5777 | - try { | |
| 5778 | - listI.add(list1.iterator()); | |
| 5779 | - listI.add(dataList2.iterator()); | |
| 5780 | - listI.add(dataList3.iterator()); | |
| 5781 | - String path = this.getClass().getResource("/").getPath() + "static/pages/forms/"; | |
| 5782 | - String sourcePath = path + "mould/scheduleDaily.xls"; | |
| 5783 | - if (date.length() == 7) { | |
| 5784 | - sdfMonth = new SimpleDateFormat("yyyy-MM"); | |
| 5785 | - sdfSimple = new SimpleDateFormat("yyyyMM"); | |
| 5786 | - sourcePath = path + "mould/scheduleDaily_m.xls"; | |
| 5787 | - } | |
| 5788 | - if(df.equals("df")){ | |
| 5789 | - sourcePath =path + "mould/scheduleDaily_df.xls"; | |
| 5790 | - } | |
| 5791 | - ee.excelReplace(listI, new Object[]{nMap}, sourcePath, | |
| 5792 | - path + "export/" + sdfSimple.format(sdfMonth.parse(date)) + lineName + "调度日报.xls"); | |
| 5793 | - } catch (Exception e) { | |
| 5794 | - // TODO: handle exception | |
| 5795 | - e.printStackTrace(); | |
| 5796 | - } | |
| 5797 | - } | |
| 5798 | - | |
| 5799 | - return new ArrayList<Map<String, Object>>(); | |
| 5800 | - } | |
| 5801 | - | |
| 5802 | - public void exportWaybill_pl(List<ScheduleRealInfo> listpl, | |
| 5803 | - String date, String jName, String clZbh, String lpName) { | |
| 5804 | - ReportUtils ee = new ReportUtils(); | |
| 5805 | - ReportRelatedUtils rru = new ReportRelatedUtils(); | |
| 5806 | - List<Iterator<?>> list = new ArrayList<Iterator<?>>(); | |
| 5807 | - List<ScheduleRealInfo> scheduleRealInfos = listpl; | |
| 5808 | - List<Map<String, Object>> listMap = new ArrayList<Map<String, Object>>(); | |
| 5809 | -// List<ScheduleRealInfo> scheduleRealInfos=scheduleRealInfoRepository.queryListWaybillXcld(jName, clZbh, lpName, date, line); | |
| 5810 | - List<ScheduleRealInfo> lists = new ArrayList<ScheduleRealInfo>(); | |
| 5811 | - for (int i = 0; i < scheduleRealInfos.size(); i++) { | |
| 5812 | - ScheduleRealInfo s = scheduleRealInfos.get(i); | |
| 5813 | - Set<ChildTaskPlan> cts = s.getcTasks(); | |
| 5814 | - if (cts != null && cts.size() > 0) { | |
| 5815 | - lists.add(s); | |
| 5816 | - } else { | |
| 5817 | - if (s.getZdsjActual() != null && s.getFcsjActual() != null) { | |
| 5818 | - lists.add(s); | |
| 5819 | - } | |
| 5820 | - } | |
| 5821 | - } | |
| 5822 | - DecimalFormat format = new DecimalFormat("0.00"); | |
| 5823 | -// int cjbc = scheduleRealInfoRepository.findCjbc(jName, clZbh, lpName); | |
| 5824 | -// int ljbc = scheduleRealInfoRepository.findLjbc(jName, clZbh, lpName); | |
| 5825 | - //计算里程和班次数,并放入Map里 | |
| 5826 | - Map<String, Object> map = this.MapById(scheduleRealInfos.get(0).getId()); | |
| 5827 | - | |
| 5828 | - map.put("jhlc", Arith.add(culateMieageService.culateJhgl(scheduleRealInfos), culateMieageService.culateJhJccgl(scheduleRealInfos))); | |
| 5829 | - map.put("remMileage", culateMieageService.culateLbgl(scheduleRealInfos)); | |
| 5830 | - map.put("addMileage", culateMieageService.culateLjgl(lists)); | |
| 5831 | - double yygl = Arith.add(culateMieageService.culateSjgl(lists), culateMieageService.culateLjgl(lists)); | |
| 5832 | - map.put("yygl", yygl); | |
| 5833 | - double ksgl = Arith.add(culateMieageService.culateKsgl(scheduleRealInfos), culateMieageService.culateJccgl(lists)); | |
| 5834 | - map.put("ksgl", ksgl); | |
| 5835 | - map.put("realMileage", Arith.add(yygl, ksgl)); | |
| 5836 | - map.put("jhbc", culateMieageService.culateJhbc(scheduleRealInfos, "")); | |
| 5837 | - map.put("cjbc", culateMieageService.culateLbbc(scheduleRealInfos)); | |
| 5838 | - map.put("ljbc", culateMieageService.culateLjbc(lists, "")); | |
| 5839 | - int sjbc = culateMieageService.culateLjbc(lists, "") + culateMieageService.culateSjbc(lists, ""); | |
| 5840 | - map.put("sjbc", sjbc); | |
| 5841 | -// map=new HashMap<String,Object>(); | |
| 5842 | - | |
| 5843 | - SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm"); | |
| 5844 | - String minfcsj = "02:00"; | |
| 5845 | - List<Line> lineList = lineRepository.findLineByCode(listpl.get(0).getXlBm()); | |
| 5846 | - if (lineList.size() > 0) { | |
| 5847 | - String sqlMinYysj = "select start_opt from bsth_c_line_config where " | |
| 5848 | - + " id = (" | |
| 5849 | - + "select max(id) from bsth_c_line_config where line ='" + lineList.get(0).getId() + "'" | |
| 5850 | - + ")"; | |
| 5851 | - minfcsj = jdbcTemplate.queryForObject(sqlMinYysj, String.class); | |
| 5852 | - } | |
| 5853 | - String[] minSjs = minfcsj.split(":"); | |
| 5854 | - Long minSj = Long.parseLong(minSjs[0]) * 60 + Long.parseLong(minSjs[1]); | |
| 5855 | - | |
| 5856 | - | |
| 5857 | - for (int i = 0; i < scheduleRealInfos.size(); i++) { | |
| 5858 | - ScheduleRealInfo s = scheduleRealInfos.get(i); | |
| 5859 | - String[] fcsj = s.getFcsj().split(":"); | |
| 5860 | - Long fcsjL = Long.parseLong(fcsj[0]) * 60 + Long.parseLong(fcsj[1]); | |
| 5861 | - | |
| 5862 | - Long fscjT = 0L; | |
| 5863 | - if (fcsjL < minSj) { | |
| 5864 | - Calendar calendar = new GregorianCalendar(); | |
| 5865 | - calendar.setTime(s.getScheduleDate()); | |
| 5866 | - calendar.add(calendar.DATE, 1); | |
| 5867 | - s.setScheduleDate(calendar.getTime()); | |
| 5868 | - try { | |
| 5869 | - fscjT = sdf.parse(sdf.format(s.getScheduleDate()) + " " + s.getFcsj()).getTime(); | |
| 5870 | - } catch (ParseException e) { | |
| 5871 | - // TODO Auto-generated catch block | |
| 5872 | - e.printStackTrace(); | |
| 5873 | - } | |
| 5874 | - | |
| 5875 | - } else { | |
| 5876 | - try { | |
| 5877 | - fscjT = sdf.parse(s.getScheduleDateStr() + " " + s.getFcsj()).getTime(); | |
| 5878 | - } catch (ParseException e) { | |
| 5879 | - // TODO Auto-generated catch block | |
| 5880 | - e.printStackTrace(); | |
| 5881 | - } | |
| 5882 | - ; | |
| 5883 | - } | |
| 5884 | - s.setFcsjT(fscjT); | |
| 5885 | - } | |
| 5886 | - List<ScheduleRealInfo> listSchedule = new ArrayList<ScheduleRealInfo>(); | |
| 5887 | - Collections.sort(scheduleRealInfos, new ComparableReal()); | |
| 5888 | - for (int i = 0; i < scheduleRealInfos.size(); i++) { | |
| 5889 | - ScheduleRealInfo s = scheduleRealInfos.get(i); | |
| 5890 | - s.setAdjustExps(i + 1 + ""); | |
| 5891 | - String remarks = ""; | |
| 5892 | - if (s.getRemarks() != null) { | |
| 5893 | - remarks += s.getRemarks(); | |
| 5894 | - } | |
| 5895 | - | |
| 5896 | - Set<ChildTaskPlan> childTaskPlans = s.getcTasks(); | |
| 5897 | - if (!childTaskPlans.isEmpty()) { | |
| 5898 | - s.setFcsjActual(""); | |
| 5899 | - s.setZdsjActual(""); | |
| 5900 | - s.setJhlc(0.0); | |
| 5901 | - } | |
| 5902 | - | |
| 5903 | - if (s.isDestroy()) { | |
| 5904 | - s.setFcsjActual(""); | |
| 5905 | - s.setZdsjActual(""); | |
| 5906 | - s.setJhlc(0.0); | |
| 5907 | - remarks += "(烂班)"; | |
| 5908 | - s.setRemarks(remarks); | |
| 5909 | - } | |
| 5910 | - | |
| 5911 | - listSchedule.add(s); | |
| 5912 | - //计算营运里程,空驶里程 | |
| 5913 | - if (!childTaskPlans.isEmpty()) { | |
| 5914 | -// Iterator<ChildTaskPlan> it = childTaskPlans.iterator(); | |
| 5915 | - List<ChildTaskPlan> listit = new ArrayList<ChildTaskPlan>(childTaskPlans); | |
| 5916 | - Collections.sort(listit, new ComparableChild()); | |
| 5917 | - for (int j = 0; j < listit.size(); j++) { | |
| 5918 | - ScheduleRealInfo t = new ScheduleRealInfo(); | |
| 5919 | - ChildTaskPlan childTaskPlan = listit.get(j); | |
| 5920 | - if (childTaskPlan.isDestroy()) { | |
| 5921 | - t.setFcsjActual(""); | |
| 5922 | - t.setZdsjActual(""); | |
| 5923 | - t.setJhlc(0.0); | |
| 5924 | - } else { | |
| 5925 | - t.setFcsjActual(childTaskPlan.getStartDate()); | |
| 5926 | - t.setZdsjActual(childTaskPlan.getEndDate()); | |
| 5927 | - t.setJhlc(Double.parseDouble(String.valueOf(childTaskPlan.getMileage()))); | |
| 5928 | - } | |
| 5929 | - t.setQdzName(childTaskPlan.getStartStationName()); | |
| 5930 | - t.setZdzName(childTaskPlan.getEndStationName()); | |
| 5931 | - t.setRemarks(childTaskPlan.getRemarks()); | |
| 5932 | - t.setAdjustExps("子"); | |
| 5933 | - t.setjGh(""); | |
| 5934 | - t.setjName(""); | |
| 5935 | - t.setsGh(""); | |
| 5936 | - t.setsName(""); | |
| 5937 | - listSchedule.add(t); | |
| 5938 | - } | |
| 5939 | - } | |
| 5940 | - } | |
| 5941 | - Map<String, Object> maps; | |
| 5942 | - for (ScheduleRealInfo scheduleRealInfo : listSchedule) { | |
| 5943 | - maps = new HashMap<String, Object>(); | |
| 5944 | - try { | |
| 5945 | - scheduleRealInfo.setjName(scheduleRealInfo.getjGh() + scheduleRealInfo.getjName()); | |
| 5946 | - scheduleRealInfo.setsName(scheduleRealInfo.getsGh() + scheduleRealInfo.getsName()); | |
| 5947 | - maps = rru.getMapValue(scheduleRealInfo); | |
| 5948 | - maps.put("bcs", scheduleRealInfo.getAdjustExps()); | |
| 5949 | - String zdsj = scheduleRealInfo.getZdsj(); | |
| 5950 | - String zdsjActual = scheduleRealInfo.getZdsjActual(); | |
| 5951 | - if (zdsj != null && zdsjActual != null && | |
| 5952 | - !zdsj.equals(zdsjActual) && | |
| 5953 | - !zdsj.equals("") && | |
| 5954 | - !zdsjActual.equals("")) { | |
| 5955 | - int zdsjT = Integer.valueOf(zdsj.split(":")[0]) * 60 + Integer.valueOf(zdsj.split(":")[1]); | |
| 5956 | - int zdsjAT = Integer.valueOf(zdsjActual.split(":")[0]) * 60 + Integer.valueOf(zdsjActual.split(":")[1]); | |
| 5957 | - if (zdsj.compareTo(zdsjActual) > 0) { | |
| 5958 | - if (zdsjT - zdsjAT > 1000) { | |
| 5959 | - maps.put("fast", ""); | |
| 5960 | - maps.put("slow", zdsjAT - zdsjT + 1440); | |
| 5961 | - } else { | |
| 5962 | - maps.put("fast", TimeUtils.getTimeDifference(zdsj, zdsjActual)); | |
| 5963 | - maps.put("slow", ""); | |
| 5964 | - } | |
| 5965 | - } else { | |
| 5966 | - if (zdsjAT - zdsjT > 1000) { | |
| 5967 | - maps.put("fast", zdsjT - zdsjAT + 1440); | |
| 5968 | - maps.put("slow", ""); | |
| 5969 | - } else { | |
| 5970 | - maps.put("fast", ""); | |
| 5971 | - maps.put("slow", TimeUtils.getTimeDifference(zdsj, zdsjActual)); | |
| 5972 | - } | |
| 5973 | - } | |
| 5974 | - } else { | |
| 5975 | - maps.put("fast", ""); | |
| 5976 | - maps.put("slow", ""); | |
| 5977 | - } | |
| 5978 | - listMap.add(maps); | |
| 5979 | - } catch (Exception e) { | |
| 5980 | - e.printStackTrace(); | |
| 5981 | - } | |
| 5982 | - } | |
| 5983 | - | |
| 5984 | - | |
| 5985 | - String path = this.getClass().getResource("/").getPath() + "static/pages/forms/"; | |
| 5986 | - list.add(listMap.iterator()); | |
| 5987 | - String xls = ""; | |
| 5988 | - if (map.get("type").toString().equals("0")) { | |
| 5989 | - xls = "waybill_minhang.xls"; | |
| 5990 | - } else { | |
| 5991 | - xls = "waybill_minhang_dl.xls"; | |
| 5992 | - } | |
| 5993 | - map.put("sheetName", jName + "-" + clZbh + "-" + lpName); | |
| 5994 | - ee.excelReplace(list, new Object[]{map}, path + "mould/" + xls, | |
| 5995 | - path + "export/" + date + "-" + jName + "-" + clZbh + "-" + lpName + "-行车路单.xls"); | |
| 5996 | - } | |
| 5997 | - | |
| 5998 | - @Override | |
| 5999 | - public Map<String, Object> exportWaybillMore(Map<String, Object> map) { | |
| 6000 | - String date = map.get("date").toString(); | |
| 6001 | - String line = map.get("line").toString(); | |
| 6002 | - ReportUtils ee = new ReportUtils(); | |
| 6003 | - List<List> lists = JSON.parseArray(map.get("strs").toString(), List.class); | |
| 6004 | - String path = this.getClass().getResource("/").getPath() + "static/pages/forms/export/"; | |
| 6005 | - SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"), | |
| 6006 | - sdfSimple = new SimpleDateFormat("yyyyMMdd"); | |
| 6007 | - int num = 0; | |
| 6008 | - File file = null; | |
| 6009 | - try { | |
| 6010 | - while (true) { | |
| 6011 | - String fileUrl = path + "行车路单" + sdfSimple.format(sdfMonth.parse(date)); | |
| 6012 | -// file = new File(fileUrl + (num == 0 ? "/" : "(" + num + ")/")); //新建文件夹 | |
| 6013 | - file = new File(fileUrl + (num == 0 ? ".xls" : "(" + num + ").xls")); //新建excel文件 | |
| 6014 | - if (file.exists()) { //判断是否已存在重名 | |
| 6015 | - num++; | |
| 6016 | - } else { | |
| 6017 | - break; | |
| 6018 | - } | |
| 6019 | - } | |
| 6020 | -// file.mkdirs(); //创建 | |
| 6021 | - List<ScheduleRealInfo> lists_line = scheduleRealInfoRepository.scheduleByDateAndLineTjrb(line, date); | |
| 6022 | - List<File> files = new ArrayList<File>(); | |
| 6023 | - for (List<String> list : lists) { | |
| 6024 | - List<ScheduleRealInfo> newList = new ArrayList<ScheduleRealInfo>(); | |
| 6025 | - String jName = list.get(0); | |
| 6026 | - String clZbh = list.get(1); | |
| 6027 | - String lpName = list.get(2); | |
| 6028 | - String jGh = list.get(3); | |
| 6029 | - for (int i = 0; i < lists_line.size(); i++) { | |
| 6030 | - ScheduleRealInfo s = lists_line.get(i); | |
| 6031 | - if (s.getjGh().equals(jGh) && s.getClZbh().equals(clZbh) && s.getLpName().equals(lpName)) { | |
| 6032 | - newList.add(s); | |
| 6033 | - } | |
| 6034 | - } | |
| 6035 | - this.exportWaybill_pl(newList, date, jName, clZbh, lpName); | |
| 6036 | - File temp = new File(path + date + "-" + jName + "-" + clZbh + "-" + lpName + "-行车路单.xls"); | |
| 6037 | - String fileName = file.getName(); | |
| 6038 | - files.add(temp); | |
| 6039 | - } | |
| 6040 | - for (int i = 1; i < files.size(); i++) { | |
| 6041 | - File file1 = files.get(0); | |
| 6042 | - File file2 = files.get(i); | |
| 6043 | - ee.copySheetByFile(file2, file1, 0, 145); | |
| 6044 | - } | |
| 6045 | - File newFile = files.get(0); | |
| 6046 | - newFile.renameTo(file); | |
| 6047 | -// temp.renameTo(new File(path + fileName + "/" + temp.getName())); | |
| 6048 | -// File[] listFiles = file.listFiles(); | |
| 6049 | -// ZipOutputStream zos = new ZipOutputStream(new BufferedOutputStream(new FileOutputStream(path + file.getName() + ".zip"))); | |
| 6050 | -//// zos.setEncoding("gbk"); | |
| 6051 | -//// zos.putNextEntry(new ZipEntry(fileName + "/")); | |
| 6052 | -// for (int i = 0; i < listFiles.length; i++) { | |
| 6053 | -// zos.putNextEntry(new ZipEntry(fileName + "/" + listFiles[i].getName())); | |
| 6054 | -// BufferedInputStream bis = new BufferedInputStream(new FileInputStream(listFiles[i])); | |
| 6055 | -// BufferedOutputStream bos = new BufferedOutputStream(zos); | |
| 6056 | -// int bytesRead = 0; | |
| 6057 | -// for (byte[] buffer = new byte[BUF_SIZE]; ((bytesRead = bis.read(buffer, 0, BUF_SIZE)) != -1); ) { | |
| 6058 | -//// zos.write(buffer, 0, bytesRead); | |
| 6059 | -//// zos.flush(); | |
| 6060 | -// bos.write(buffer, 0, bytesRead); | |
| 6061 | -// bos.flush(); | |
| 6062 | -// } | |
| 6063 | -//// bos.close(); | |
| 6064 | -// bis.close(); | |
| 6065 | -// } | |
| 6066 | -// zos.close(); | |
| 6067 | -// } | |
| 6068 | - | |
| 6069 | - } catch (Exception e) { | |
| 6070 | - // TODO: handle exception | |
| 6071 | - e.printStackTrace(); | |
| 6072 | - } | |
| 6073 | - | |
| 6074 | - map.put("fileName", file.getName()); | |
| 6075 | - return map; | |
| 6076 | - } | |
| 6077 | - | |
| 6078 | - @Autowired | |
| 6079 | - SchedulePlanInfoService schPlanService; | |
| 6080 | - | |
| 6081 | - @Override | |
| 6082 | - public List<SchedulePlanInfo> currentSchedulePlan(String lineCode) { | |
| 6083 | - List<SchedulePlanInfo> rs = dayOfSchedule.schedulePlanMap.get(lineCode); | |
| 6084 | - | |
| 6085 | - if (rs == null || rs.size() == 0) { | |
| 6086 | - //尝试刷新内存 | |
| 6087 | - Map<String, Object> data = new HashMap<>(); | |
| 6088 | - data.put("scheduleDate_eq", dayOfSchedule.currSchDateMap.get(lineCode)); | |
| 6089 | - data.put("xlBm_eq", lineCode); | |
| 6090 | - List<SchedulePlanInfo> planItr = dayOfSchedule.cleanSchPlanItr(schPlanService.list(data).iterator()); | |
| 6091 | - | |
| 6092 | - if (planItr.size() > 0) { | |
| 6093 | - dayOfSchedule.schedulePlanMap.put(lineCode, planItr); | |
| 6094 | - return planItr; | |
| 6095 | - } | |
| 6096 | - } | |
| 6097 | - return rs; | |
| 6098 | - } | |
| 6099 | - | |
| 6100 | - | |
| 6101 | - @Override | |
| 6102 | - public Map<String, Object> lpChangeMulti(String leftIdx, String rightIdx, int type) { | |
| 6103 | - Map<String, Object> rs = new HashMap<>(); | |
| 6104 | - Set<ScheduleRealInfo> ts = new HashSet<>(); | |
| 6105 | - try { | |
| 6106 | - List<String> leftList = Splitter.on(",").splitToList(leftIdx); | |
| 6107 | - List<String> rightList = Splitter.on(",").splitToList(rightIdx); | |
| 6108 | - Set<String> lpSet = new HashSet<>(); | |
| 6109 | - Set<String> carSet = new HashSet<>(); | |
| 6110 | - | |
| 6111 | - List<ScheduleRealInfo> largeList, smallList; | |
| 6112 | - if (leftList.size() > rightList.size()) { | |
| 6113 | - largeList = getByIdx(leftList); | |
| 6114 | - smallList = getByIdx(rightList); | |
| 6115 | - } else { | |
| 6116 | - largeList = getByIdx(rightList); | |
| 6117 | - smallList = getByIdx(leftList); | |
| 6118 | - } | |
| 6119 | - | |
| 6120 | - ScheduleRealInfo leftSch, rightSch = null; | |
| 6121 | - for (int i = 0; i < largeList.size(); i++) { | |
| 6122 | - leftSch = largeList.get(i); | |
| 6123 | - leftSch.setLpChange(1); | |
| 6124 | - if (i < smallList.size()) { | |
| 6125 | - rightSch = smallList.get(i); | |
| 6126 | - rightSch.setLpChange(1); | |
| 6127 | - ts.add(rightSch); | |
| 6128 | - } else { | |
| 6129 | - //不对称时多出来的 | |
| 6130 | - lpChangeByLeft(leftSch, largeList.get(i - 1), type); | |
| 6131 | - ts.add(leftSch); | |
| 6132 | - lpSet.add(leftSch.getXlBm() + "_" + leftSch.getLpName()); | |
| 6133 | - continue; | |
| 6134 | - } | |
| 6135 | - | |
| 6136 | - //调换路牌 | |
| 6137 | - lpChange(leftSch, rightSch, type); | |
| 6138 | - ts.add(leftSch); | |
| 6139 | - | |
| 6140 | - lpSet.add(leftSch.getXlBm() + "_" + leftSch.getLpName()); | |
| 6141 | - lpSet.add(rightSch.getXlBm() + "_" + rightSch.getLpName()); | |
| 6142 | - | |
| 6143 | - carSet.add(leftSch.getClZbh()); | |
| 6144 | - carSet.add(rightSch.getClZbh()); | |
| 6145 | - scheduleRealInfoRepository.updateLpChange(leftSch.getId()); | |
| 6146 | - scheduleRealInfoRepository.updateLpChange(rightSch.getId()); | |
| 6147 | - } | |
| 6148 | - | |
| 6149 | - //重新计算路牌的起点应到时间 | |
| 6150 | - for (String lpName : lpSet) { | |
| 6151 | - ts.addAll(dayOfSchedule.updateQdzTimePlan(lpName)); | |
| 6152 | - } | |
| 6153 | - | |
| 6154 | - //重新就算车辆当前执行班次 | |
| 6155 | - for(String nbbm : carSet){ | |
| 6156 | - dayOfSchedule.reCalcExecPlan(nbbm); | |
| 6157 | - } | |
| 6158 | - | |
| 6159 | - | |
| 6160 | - for (ScheduleRealInfo sch : ts) { | |
| 6161 | - dayOfSchedule.save(sch); | |
| 6162 | - } | |
| 6163 | - | |
| 6164 | - rs.put("status", ResponseCode.SUCCESS); | |
| 6165 | - rs.put("ts", ts); | |
| 6166 | - } catch (Exception e) { | |
| 6167 | - logger.error("", e); | |
| 6168 | - rs.put("status", ResponseCode.ERROR); | |
| 6169 | - rs.put("msg", e.getMessage()); | |
| 6170 | - } | |
| 6171 | - | |
| 6172 | - return rs; | |
| 6173 | - } | |
| 6174 | - | |
| 6175 | - private List<ScheduleRealInfo> getByIdx(List<String> idList) { | |
| 6176 | - List<ScheduleRealInfo> list = new ArrayList<>(); | |
| 6177 | - for (String id : idList) { | |
| 6178 | - list.add(dayOfSchedule.get(Long.parseLong(id))); | |
| 6179 | - } | |
| 6180 | - return list; | |
| 6181 | - } | |
| 6182 | - | |
| 6183 | - @Override | |
| 6184 | - public void lpChange(ScheduleRealInfo leftSch, ScheduleRealInfo rightSch, int type) { | |
| 6185 | - //释放班次映射 | |
| 6186 | - if (type > 0) { | |
| 6187 | - dayOfSchedule.removeNbbm2SchMapp(leftSch); | |
| 6188 | - dayOfSchedule.removeNbbm2SchMapp(rightSch); | |
| 6189 | - } | |
| 6190 | - | |
| 6191 | - //对调数据 | |
| 6192 | - LpData leftData = new LpData(leftSch); | |
| 6193 | - LpData rightData = new LpData(rightSch); | |
| 6194 | - | |
| 6195 | - leftData.appendTo(rightSch, type); | |
| 6196 | - rightData.appendTo(leftSch, type); | |
| 6197 | - | |
| 6198 | - if (type > 0) { | |
| 6199 | - //重新映射 | |
| 6200 | - dayOfSchedule.addNbbm2SchMapp(leftSch); | |
| 6201 | - dayOfSchedule.addNbbm2SchMapp(rightSch); | |
| 6202 | - } | |
| 6203 | - } | |
| 6204 | - | |
| 6205 | - /** | |
| 6206 | - * 更换左边班次的路牌,右边不变 | |
| 6207 | - * | |
| 6208 | - * @param leftSch | |
| 6209 | - * @param rightSch | |
| 6210 | - * @param type | |
| 6211 | - */ | |
| 6212 | - public void lpChangeByLeft(ScheduleRealInfo leftSch, ScheduleRealInfo rightSch, int type) { | |
| 6213 | - //释放班次映射 | |
| 6214 | - if (type > 0) | |
| 6215 | - dayOfSchedule.removeNbbm2SchMapp(leftSch); | |
| 6216 | - | |
| 6217 | - LpData rightData = new LpData(rightSch); | |
| 6218 | - rightData.appendTo(leftSch, type); | |
| 6219 | - | |
| 6220 | - //重新映射 | |
| 6221 | - if (type > 0) | |
| 6222 | - dayOfSchedule.addNbbm2SchMapp(leftSch); | |
| 6223 | - | |
| 6224 | - } | |
| 6225 | - | |
| 6226 | - @Override | |
| 6227 | - public Map<String, Object> revokeRealArrive(Long id) { | |
| 6228 | - Map<String, Object> rs = new HashMap<>(); | |
| 6229 | - List<ScheduleRealInfo> ts = new ArrayList<>(); | |
| 6230 | - | |
| 6231 | - try { | |
| 6232 | - ScheduleRealInfo sch = dayOfSchedule.get(id); | |
| 6233 | - if (sch.getZdsjActual() == null && sch.getFcsjActual() == null) { | |
| 6234 | - rs.put("status", ResponseCode.ERROR); | |
| 6235 | - rs.put("msg", "班次未执行,无法撤销!"); | |
| 6236 | - } else { | |
| 6237 | - //日志记录 | |
| 6238 | - ScheduleModifyLogger.cxzx(sch); | |
| 6239 | - | |
| 6240 | - sch.clearFcsjActual(); | |
| 6241 | - sch.clearZdsjActual(); | |
| 6242 | - //清除路牌下一个班的起点到达时间 | |
| 6243 | - ScheduleRealInfo next = dayOfSchedule.nextByLp(sch); | |
| 6244 | - if (null != next) { | |
| 6245 | - next.setQdzArrDatesj(null); | |
| 6246 | - ts.add(next); | |
| 6247 | - } | |
| 6248 | - | |
| 6249 | - rs.put("status", ResponseCode.SUCCESS); | |
| 6250 | - | |
| 6251 | - ts.add(sch); | |
| 6252 | - rs.put("ts", ts); | |
| 6253 | - | |
| 6254 | - dayOfSchedule.save(sch); | |
| 6255 | - //重新计算当前执行班次 | |
| 6256 | - dayOfSchedule.reCalcExecPlan(sch.getClZbh()); | |
| 6257 | - | |
| 6258 | - } | |
| 6259 | - } catch (Exception e) { | |
| 6260 | - logger.error("", e); | |
| 6261 | - rs.put("status", ResponseCode.ERROR); | |
| 6262 | - } | |
| 6263 | - return rs; | |
| 6264 | - } | |
| 6265 | - | |
| 6266 | - @Override | |
| 6267 | - public Map<String, Object> lateAdjust(String idx, float minute) { | |
| 6268 | - Map<String, Object> rs = new HashMap<>(); | |
| 6269 | - try { | |
| 6270 | - int count = 0; | |
| 6271 | - List<ScheduleRealInfo> list = new ArrayList<>(); | |
| 6272 | - List<String> ids = Splitter.on(",").trimResults().omitEmptyStrings().splitToList(idx); | |
| 6273 | - | |
| 6274 | - ScheduleRealInfo sch; | |
| 6275 | - for (String id : ids) { | |
| 6276 | - sch = dayOfSchedule.get(Long.parseLong(id)); | |
| 6277 | - if (sch != null && sch.getStatus() == 0) { | |
| 6278 | - if (minute > 0) { | |
| 6279 | - sch.setLateMinute(minute); | |
| 6280 | - } else if (minute == 0) { | |
| 6281 | - LateAdjustHandle.remove(sch); | |
| 6282 | - } | |
| 6283 | - count++; | |
| 6284 | - list.add(sch); | |
| 6285 | - } | |
| 6286 | - } | |
| 6287 | - | |
| 6288 | - rs.put("status", ResponseCode.SUCCESS); | |
| 6289 | - rs.put("count", count); | |
| 6290 | - rs.put("ts", list); | |
| 6291 | - } catch (Exception e) { | |
| 6292 | - logger.error("", e); | |
| 6293 | - rs.put("status", ResponseCode.ERROR); | |
| 6294 | - rs.put("msg", e.getMessage()); | |
| 6295 | - } | |
| 6296 | - | |
| 6297 | - return rs; | |
| 6298 | - } | |
| 6299 | - | |
| 6300 | - @Override | |
| 6301 | - public List<ScheduleRealInfo> allLate2(String idx) { | |
| 6302 | - List<ScheduleRealInfo> rs = new ArrayList<>(); | |
| 6303 | - List<String> ids = Splitter.on(",").trimResults().omitEmptyStrings().splitToList(idx); | |
| 6304 | - | |
| 6305 | - Collection<ScheduleRealInfo> all = LateAdjustHandle.allLateSch(); | |
| 6306 | - for (ScheduleRealInfo sch : all) { | |
| 6307 | - if (ids.indexOf(sch.getXlBm()) != -1) { | |
| 6308 | - rs.add(sch); | |
| 6309 | - } | |
| 6310 | - } | |
| 6311 | - return rs; | |
| 6312 | - } | |
| 6313 | - | |
| 6314 | - | |
| 6315 | - @Override | |
| 6316 | - public List<Map<String, Object>> mileageReport(String gsdm, | |
| 6317 | - String fgsdm, String line, String date, String date2) { | |
| 6318 | - | |
| 6319 | - String sql = "select * from calc_mileage where 1=1 "; | |
| 6320 | - if (!line.equals(" ")) { | |
| 6321 | - sql = sql + " and line_code='" + line + "' "; | |
| 6322 | - } | |
| 6323 | - sql = sql + " and DATE_FORMAT(rq,'%Y-%m-%d') between '" + date + "' and '" + date2 + "'"; | |
| 6324 | - if (!gsdm.equals(" ")) { | |
| 6325 | - sql = sql + " and company_id=" + gsdm; | |
| 6326 | - } | |
| 6327 | - if (!gsdm.equals(" ")) { | |
| 6328 | - sql = sql + " and sub_company_id=" + fgsdm; | |
| 6329 | - } | |
| 6330 | - sql = sql + " order by line_code"; | |
| 6331 | - List<MileageReport> list = jdbcTemplate.query(sql, | |
| 6332 | - new RowMapper<MileageReport>() { | |
| 6333 | - @Override | |
| 6334 | - public MileageReport mapRow(ResultSet rs, int rowNum) throws SQLException { | |
| 6335 | - MileageReport mr = new MileageReport(); | |
| 6336 | - mr.setCompanyName(rs.getString("company_name")); | |
| 6337 | - mr.setSubCompanyName(rs.getString("sub_company_name")); | |
| 6338 | - mr.setLineName(rs.getString("line_name")); | |
| 6339 | - mr.setSjyygl(rs.getDouble("sjyygl")); | |
| 6340 | - mr.setSjksgl(rs.getDouble("sjksgl")); | |
| 6341 | - mr.setZgl(rs.getDouble("zyygl")); | |
| 6342 | - mr.setZddfgl(rs.getDouble("zddfgl")); | |
| 6343 | - mr.setSddfgl(rs.getDouble("sddfgl")); | |
| 6344 | - mr.setWqwxhgl(rs.getDouble("wqwxhgl")); | |
| 6345 | - mr.setBfwxhgl(rs.getDouble("bfwxhgl")); | |
| 6346 | - mr.setPygl(rs.getDouble("pygl")); | |
| 6347 | - mr.setLjgl(rs.getDouble("ljgl")); | |
| 6348 | - mr.setZrwgl(rs.getDouble("zrwgl")); | |
| 6349 | - mr.setOther(rs.getString("other")); | |
| 6350 | - return mr; | |
| 6351 | - } | |
| 6352 | - }); | |
| 6353 | - List<Map<String, Object>> lMap = new ArrayList<Map<String, Object>>(); | |
| 6354 | - double sjyygl = 0.0; | |
| 6355 | - double sjksgl = 0.0; | |
| 6356 | - double zgl = 0.0; | |
| 6357 | - double sddfgl = 0.0; | |
| 6358 | - double zddfgl = 0.0; | |
| 6359 | - double wqwxhgl = 0.0; | |
| 6360 | - double bfwxhgl = 0.0; | |
| 6361 | - double pygl = 0.0; | |
| 6362 | - double ljgl = 0.0; | |
| 6363 | - double zrwgl = 0.0; | |
| 6364 | - for (MileageReport mr : list) { | |
| 6365 | - Map<String, Object> resMap = new HashMap<String, Object>(); | |
| 6366 | - resMap.put("gsName", mr.getCompanyName()); | |
| 6367 | - resMap.put("fgsName", mr.getSubCompanyName()); | |
| 6368 | - resMap.put("xlName", mr.getLineName()); | |
| 6369 | - resMap.put("sjyygl", mr.getSjyygl()); | |
| 6370 | - resMap.put("sjksgl", mr.getSjksgl()); | |
| 6371 | - resMap.put("zgl", mr.getZgl()); | |
| 6372 | - resMap.put("sddfgl", mr.getSddfgl()); | |
| 6373 | - resMap.put("zddfgl", mr.getZddfgl()); | |
| 6374 | - resMap.put("wqwxhgl", mr.getWqwxhgl()); | |
| 6375 | - resMap.put("bfwxhgl", mr.getBfwxhgl()); | |
| 6376 | - resMap.put("pygl", mr.getPygl()); | |
| 6377 | - resMap.put("ljgl", mr.getLjgl()); | |
| 6378 | - resMap.put("zrwgl", mr.getZrwgl()); | |
| 6379 | - resMap.put("other", mr.getOther()); | |
| 6380 | - lMap.add(resMap); | |
| 6381 | - sjyygl = Arith.add(sjyygl, mr.getSjyygl()); | |
| 6382 | - sjksgl = Arith.add(sjksgl, mr.getSjksgl()); | |
| 6383 | - zgl = Arith.add(zgl, mr.getZgl()); | |
| 6384 | - sddfgl = Arith.add(sddfgl, mr.getSddfgl()); | |
| 6385 | - zddfgl = Arith.add(zddfgl, mr.getZddfgl()); | |
| 6386 | - wqwxhgl = Arith.add(wqwxhgl, mr.getWqwxhgl()); | |
| 6387 | - bfwxhgl = Arith.add(bfwxhgl, mr.getBfwxhgl()); | |
| 6388 | - pygl = Arith.add(pygl, mr.getPygl()); | |
| 6389 | - ljgl = Arith.add(ljgl, mr.getLjgl()); | |
| 6390 | - zrwgl = Arith.add(zrwgl, mr.getZrwgl()); | |
| 6391 | - } | |
| 6392 | - Map<String, Object> resMap = new HashMap<String, Object>(); | |
| 6393 | - resMap.put("xlName", "合计"); | |
| 6394 | - resMap.put("sjyygl", sjyygl); | |
| 6395 | - resMap.put("sjksgl", sjksgl); | |
| 6396 | - resMap.put("zgl", zgl); | |
| 6397 | - resMap.put("sddfgl", sddfgl); | |
| 6398 | - resMap.put("zddfgl", zddfgl); | |
| 6399 | - resMap.put("wqwxhgl", wqwxhgl); | |
| 6400 | - resMap.put("bfwxhgl", bfwxhgl); | |
| 6401 | - resMap.put("pygl", pygl); | |
| 6402 | - resMap.put("ljgl", ljgl); | |
| 6403 | - resMap.put("zrwgl", zrwgl); | |
| 6404 | - resMap.put("other", null); | |
| 6405 | - lMap.add(resMap); | |
| 6406 | - return lMap; | |
| 6407 | - } | |
| 6408 | - | |
| 6409 | - @Override | |
| 6410 | - public List<Map<String, Object>> scheduleCorrectionReport(String gsdm, | |
| 6411 | - String fgsdm, String line, String date, String date2) { | |
| 6412 | - | |
| 6413 | - String sql = "select * from calc_schedule where 1=1 "; | |
| 6414 | - if (!line.equals(" ")) { | |
| 6415 | - sql = sql + " and line_code='" + line + "' "; | |
| 6416 | - } | |
| 6417 | - sql = sql + " and DATE_FORMAT(rq,'%Y-%m-%d') between '" + date + "' and '" + date2 + "'"; | |
| 6418 | - if (!gsdm.equals(" ")) { | |
| 6419 | - sql = sql + " and company_id=" + gsdm; | |
| 6420 | - } | |
| 6421 | - if (!gsdm.equals(" ")) { | |
| 6422 | - sql = sql + " and sub_company_id=" + fgsdm; | |
| 6423 | - } | |
| 6424 | - sql = sql + " order by line_code"; | |
| 6425 | - List<ScheduleCorrectionReport> list = jdbcTemplate.query(sql, | |
| 6426 | - new RowMapper<ScheduleCorrectionReport>() { | |
| 6427 | - @Override | |
| 6428 | - public ScheduleCorrectionReport mapRow(ResultSet rs, int rowNum) throws SQLException { | |
| 6429 | - ScheduleCorrectionReport sReport = new ScheduleCorrectionReport(); | |
| 6430 | - sReport.setCompanyName(rs.getString("company_name")); | |
| 6431 | - sReport.setSubCompanyName(rs.getString("sub_company_name")); | |
| 6432 | - sReport.setLineName(rs.getString("line_name")); | |
| 6433 | - sReport.setSjyybc(rs.getInt("sjyybc")); | |
| 6434 | - sReport.setSjksbc(rs.getInt("sjksbc")); | |
| 6435 | - sReport.setZbc(rs.getInt("zyybc")); | |
| 6436 | - sReport.setZddfbc(rs.getInt("zddfbc")); | |
| 6437 | - sReport.setSddfbc(rs.getInt("sddfbc")); | |
| 6438 | - sReport.setWqwxhbc(rs.getInt("wqwxhbc")); | |
| 6439 | - sReport.setBfwxhbc(rs.getInt("bfwxhbc")); | |
| 6440 | - sReport.setPybc(rs.getInt("pybc")); | |
| 6441 | - sReport.setLjbc(rs.getInt("ljbc")); | |
| 6442 | - sReport.setZrwbc(rs.getInt("zrwbc")); | |
| 6443 | - sReport.setOther(rs.getString("other")); | |
| 6444 | - return sReport; | |
| 6445 | - } | |
| 6446 | - }); | |
| 6447 | - List<Map<String, Object>> lMap = new ArrayList<Map<String, Object>>(); | |
| 6448 | - int sjyybc = 0; | |
| 6449 | - int sjksbc = 0; | |
| 6450 | - int zbc = 0; | |
| 6451 | - int sddfbc = 0; | |
| 6452 | - int zddfbc = 0; | |
| 6453 | - int wqwxhbc = 0; | |
| 6454 | - int bfwxhbc = 0; | |
| 6455 | - int pybc = 0; | |
| 6456 | - int ljbc = 0; | |
| 6457 | - int zrwbc = 0; | |
| 6458 | - for (ScheduleCorrectionReport sReport : list) { | |
| 6459 | - Map<String, Object> resMap = new HashMap<String, Object>(); | |
| 6460 | - resMap.put("gsName", sReport.getCompanyName()); | |
| 6461 | - resMap.put("fgsName", sReport.getSubCompanyName()); | |
| 6462 | - resMap.put("xlName", sReport.getLineName()); | |
| 6463 | - resMap.put("sjyybc", sReport.getSjyybc()); | |
| 6464 | - resMap.put("sjksbc", sReport.getSjksbc()); | |
| 6465 | - resMap.put("zbc", sReport.getZbc()); | |
| 6466 | - resMap.put("sddfbc", sReport.getSddfbc()); | |
| 6467 | - resMap.put("zddfbc", sReport.getZddfbc()); | |
| 6468 | - resMap.put("wqwxhbc", sReport.getWqwxhbc()); | |
| 6469 | - resMap.put("bfwxhbc", sReport.getBfwxhbc()); | |
| 6470 | - resMap.put("pybc", sReport.getPybc()); | |
| 6471 | - resMap.put("ljbc", sReport.getLjbc()); | |
| 6472 | - resMap.put("zrwbc", sReport.getZrwbc()); | |
| 6473 | - resMap.put("other", sReport.getOther()); | |
| 6474 | - lMap.add(resMap); | |
| 6475 | - sjyybc = sjyybc + sReport.getSjyybc(); | |
| 6476 | - sjksbc = sjksbc + sReport.getSjksbc(); | |
| 6477 | - zbc = zbc + sReport.getZbc(); | |
| 6478 | - sddfbc = sddfbc + sReport.getSddfbc(); | |
| 6479 | - zddfbc = zddfbc + sReport.getZddfbc(); | |
| 6480 | - wqwxhbc = wqwxhbc + sReport.getWqwxhbc(); | |
| 6481 | - bfwxhbc = bfwxhbc + sReport.getBfwxhbc(); | |
| 6482 | - pybc = pybc + sReport.getPybc(); | |
| 6483 | - ljbc = ljbc + sReport.getLjbc(); | |
| 6484 | - zrwbc = zrwbc + sReport.getZrwbc(); | |
| 6485 | - } | |
| 6486 | - Map<String, Object> resMap = new HashMap<String, Object>(); | |
| 6487 | - resMap.put("xlName", "合计"); | |
| 6488 | - resMap.put("sjyybc", sjyybc); | |
| 6489 | - resMap.put("sjksbc", sjksbc); | |
| 6490 | - resMap.put("zbc", zbc); | |
| 6491 | - resMap.put("sddfbc", sddfbc); | |
| 6492 | - resMap.put("zddfbc", zddfbc); | |
| 6493 | - resMap.put("wqwxhbc", wqwxhbc); | |
| 6494 | - resMap.put("bfwxhbc", bfwxhbc); | |
| 6495 | - resMap.put("pybc", pybc); | |
| 6496 | - resMap.put("ljbc", ljbc); | |
| 6497 | - resMap.put("zrwbc", zrwbc); | |
| 6498 | - resMap.put("other", null); | |
| 6499 | - lMap.add(resMap); | |
| 6500 | - return lMap; | |
| 6501 | - } | |
| 6502 | - | |
| 6503 | - @Override | |
| 6504 | - public Integer isCircleQdz(String clzbh, String sdr, String xlbm, String qdzCode) { | |
| 6505 | - SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); | |
| 6506 | - String time =sdf.format(Long.parseLong(sdr)); | |
| 6507 | - | |
| 6508 | - Long num=scheduleRealInfoRepository.isCircleQdz(clzbh, time, xlbm, qdzCode); | |
| 6509 | - Integer num2=num==0L?0:1; | |
| 6510 | - return num2; | |
| 6511 | - } | |
| 6512 | - | |
| 6513 | - @SuppressWarnings("unchecked") | |
| 6514 | - private static Map<String, Object> request(String url) { | |
| 6515 | - Map<String, Object> res = new HashMap<>(); | |
| 6516 | - try { | |
| 6517 | - StringBuilder sb = HttpClientUtils.post(url, null); | |
| 6518 | - if (sb != null) { | |
| 6519 | - Map<String, Object> response = new ObjectMapper().readValue(sb.toString(), Map.class); | |
| 6520 | - if (!"报修成功".equals(response.get("msg"))) { | |
| 6521 | - res.put("status", ResponseCode.ERROR); | |
| 6522 | - res.putAll(response); | |
| 6523 | - } | |
| 6524 | - } else { | |
| 6525 | - res.put("status", ResponseCode.ERROR); | |
| 6526 | - res.put("msg", "调用上报接口异常"); | |
| 6527 | - } | |
| 6528 | - } catch (Exception e) { | |
| 6529 | - // TODO Auto-generated catch block | |
| 6530 | - logger.error("维修上报异常", e); | |
| 6531 | - res.put("status", ResponseCode.ERROR); | |
| 6532 | - res.put("msg", "调用上报接口异常"); | |
| 6533 | - } | |
| 6534 | - | |
| 6535 | - return res; | |
| 6536 | - } | |
| 6537 | - | |
| 6538 | - /** | |
| 6539 | - ** 维修记录上报 | |
| 6540 | - * @param param 参数信息 | |
| 6541 | - * @param isActive 主/被动上报 | |
| 6542 | - */ | |
| 6543 | - @Override | |
| 6544 | - @Transactional | |
| 6545 | - public Map<String, Object> repairReport(Map<String, Object> param, boolean isActive) { | |
| 6546 | - Map<String, Object> res = new HashMap<String, Object>(); | |
| 6547 | - res.put("status", ResponseCode.SUCCESS); | |
| 6548 | - // 获取实际排班信息 | |
| 6549 | - Long id = Long.parseLong((String)param.get("id")); | |
| 6550 | - ScheduleRealInfo sch = dayOfSchedule.get(id); | |
| 6551 | - | |
| 6552 | - if (null == sch) { | |
| 6553 | - res.put("status", ResponseCode.ERROR); | |
| 6554 | - res.put("msg", "不存在的班次!"); | |
| 6555 | - | |
| 6556 | - return res; | |
| 6557 | - } | |
| 6558 | - | |
| 6559 | - int reportState = -1; | |
| 6560 | - SysUser user = SecurityUtils.getCurrentUser(); | |
| 6561 | - String reportUser = user.getUserName(), reportName = user.getName(), incode = (String)param.get("clZbh"), reportTypes = (String)param.get("reportTypes"), repairTypes = reportType2RepairType(reportTypes); | |
| 6562 | - // 分公司保存格式 分公司编码_公司编码 | |
| 6563 | - String val = BasicData.nbbm2FgsCompanyCodeMap.get(incode); | |
| 6564 | - String[] arr = val.split("_"); | |
| 6565 | - StringBuilder url = new StringBuilder(SystemParamCache.getUrlHttpReport(arr[1])); | |
| 6566 | - url.append("?nbbm=").append(incode).append("&bxy=").append(reportUser).append("&bxbm=").append(repairTypes).append("&fgs=").append(arr[0]); | |
| 6567 | - | |
| 6568 | - int count = repairReportRepository.repairReportBySch(id, isActive ? 1 : 0); | |
| 6569 | - if (count > 0) return res; | |
| 6570 | - RepairReport lrr = dayOfSchedule.getLastestRepairReport(incode); | |
| 6571 | - // 非主动上报并且无上报记录或上次已上报 则不用上报 | |
| 6572 | - if (!isActive && (lrr == null || lrr.getReportState() != 0)) { | |
| 6573 | - reportState = 0; | |
| 6574 | - } else { | |
| 6575 | - res = request(url.toString()); | |
| 6576 | - if (ResponseCode.SUCCESS.equals(res.get("status"))) reportState = 1; | |
| 6577 | - } | |
| 6578 | - // 持久化此次上报记录 | |
| 6579 | - RepairReport rr = new RepairReport(); | |
| 6580 | - rr.setLineId(sch.getXlBm()); | |
| 6581 | - rr.setLineName(sch.getXlName()); | |
| 6582 | - rr.setReportUser(reportUser); | |
| 6583 | - rr.setReportName(reportName); | |
| 6584 | - rr.setSchId(id); | |
| 6585 | - rr.setIncode(incode); | |
| 6586 | - rr.setDepartureTime(sch.getFcsj()); | |
| 6587 | - rr.setRepairType(repairTypes); | |
| 6588 | - rr.setReportType(reportTypes); | |
| 6589 | - rr.setReportDate(new Date()); | |
| 6590 | - rr.setReportState(reportState); | |
| 6591 | - rr.setReportMode(isActive ? 1 : 0); | |
| 6592 | - rr = repairReportRepository.save(rr); | |
| 6593 | - dayOfSchedule.setLastestRepairReport(rr); | |
| 6594 | - // 如果上报失败,放到重传队列 | |
| 6595 | - if (rr.getReportState() == -1) queue.add(rr); | |
| 6596 | - | |
| 6597 | - return res; | |
| 6598 | - } | |
| 6599 | - | |
| 6600 | - private void repairReport(RepairReport rr) { | |
| 6601 | - int reportState = -1; | |
| 6602 | - // 分公司保存格式 分公司编码_公司编码 | |
| 6603 | - String val = BasicData.nbbm2FgsCompanyCodeMap.get(rr.getIncode()); | |
| 6604 | - String[] arr = val.split("_"); | |
| 6605 | - StringBuilder url = new StringBuilder(SystemParamCache.getUrlHttpReport(arr[1])); | |
| 6606 | - url.append("?nbbm=").append(rr.getIncode()).append("&bxy=").append(rr.getReportUser()).append("&bxbm=").append(rr.getRepairType()).append("&fgs=").append(arr[0]); | |
| 6607 | - | |
| 6608 | - Map<String, Object> res = request(url.toString()); | |
| 6609 | - if (ResponseCode.SUCCESS.equals(res.get("status"))) reportState = 1; | |
| 6610 | - if (reportState == 1) { | |
| 6611 | - rr.setReportState(1); | |
| 6612 | - repairReportRepository.save(rr); | |
| 6613 | - } | |
| 6614 | - } | |
| 6615 | - | |
| 6616 | - /** | |
| 6617 | - ** 业务类型转报修类型 | |
| 6618 | - */ | |
| 6619 | - private String reportType2RepairType(String reportType) { | |
| 6620 | - String[] reportTypes = reportType.split(";"); | |
| 6621 | - List<String> repairTypes = new ArrayList<>(); | |
| 6622 | - for (String rt : reportTypes) { | |
| 6623 | - repairTypes.add(report2repair.get(rt)); | |
| 6624 | - } | |
| 6625 | - | |
| 6626 | - return StringUtils.join(repairTypes, ";"); | |
| 6627 | - } | |
| 6628 | - | |
| 6629 | - @Override | |
| 6630 | - public List<RepairReport> repairReportList(String lineId, String date, String incode, String type) { | |
| 6631 | - List<RepairReport> result = new ArrayList<RepairReport>(); | |
| 6632 | - SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); | |
| 6633 | - | |
| 6634 | - Date start = null, end = null; | |
| 6635 | - if (date.length() > 0) { | |
| 6636 | - try { | |
| 6637 | - start = sdf.parse(date + " 00:00:00"); | |
| 6638 | - end = sdf.parse(date + " 23:59:59"); | |
| 6639 | - } catch (ParseException e) { | |
| 6640 | - // TODO Auto-generated catch block | |
| 6641 | - e.printStackTrace(); | |
| 6642 | - } | |
| 6643 | - | |
| 6644 | - } | |
| 6645 | - | |
| 6646 | - result = repairReportRepository.repairReportList(lineId, start, end, incode); | |
| 6647 | - Map<String, Object> dMap=new HashMap<>(); | |
| 6648 | - dMap.put("dGroup_eq", "repairtype"); | |
| 6649 | - Map<String, String> code2name = new HashMap<String, String>(); | |
| 6650 | - for (Dictionary dic : dictionaryService.list(dMap)) { | |
| 6651 | - code2name.put(dic.getdCode(), dic.getdName()); | |
| 6652 | - } | |
| 6653 | - for (RepairReport rr : result) { | |
| 6654 | - String reportType = rr.getReportType(); | |
| 6655 | - String[] types = reportType.split(";"); | |
| 6656 | - StringBuilder sb = new StringBuilder(); | |
| 6657 | - | |
| 6658 | - for (String t : types) { | |
| 6659 | - sb.append(code2name.get(t)).append(";"); | |
| 6660 | - } | |
| 6661 | - | |
| 6662 | - rr.setRepairType(sb.toString()); | |
| 6663 | - rr.setReportDateStr(sdf.format(rr.getReportDate())); | |
| 6664 | - switch (rr.getReportState()) { | |
| 6665 | - case 0: | |
| 6666 | - rr.setReportStateStr("不报"); | |
| 6667 | - break; | |
| 6668 | - case 1: | |
| 6669 | - rr.setReportStateStr("上报成功"); | |
| 6670 | - break; | |
| 6671 | - case -1: | |
| 6672 | - rr.setReportStateStr("上报失败"); | |
| 6673 | - break; | |
| 6674 | - default: | |
| 6675 | - break; | |
| 6676 | - } | |
| 6677 | - } | |
| 6678 | - | |
| 6679 | - if ("export".equals(type)) { | |
| 6680 | - String lineName = BasicData.lineCode2NameMap.get(lineId); | |
| 6681 | - SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"), | |
| 6682 | - sdfSimple = new SimpleDateFormat("yyyyMMdd"); | |
| 6683 | - List<Iterator<?>> listI = new ArrayList<Iterator<?>>(); | |
| 6684 | - Map<String, Object> m = new HashMap<String, Object>(); | |
| 6685 | - ReportUtils ee = new ReportUtils(); | |
| 6686 | - List<Map<String, Object>> newList = new ArrayList<Map<String, Object>>(); | |
| 6687 | - for (int i = 0; i < result.size(); i++) { | |
| 6688 | - Map<String, Object> map = new HashMap<String, Object>(); | |
| 6689 | - RepairReport rr = result.get(i); | |
| 6690 | - map.put("row", i + 1); | |
| 6691 | - map.put("lineId", rr.getLineName()); | |
| 6692 | - map.put("incode", rr.getIncode()); | |
| 6693 | - map.put("departureTime", rr.getDepartureTime()); | |
| 6694 | - map.put("reportUser", rr.getReportUser()); | |
| 6695 | - map.put("reportDateStr", rr.getReportDate()); | |
| 6696 | - map.put("repairType", rr.getRepairType()); | |
| 6697 | - map.put("reportStateStr", rr.getReportStateStr()); | |
| 6698 | - newList.add(map); | |
| 6699 | - } | |
| 6700 | - try { | |
| 6701 | - listI.add(newList.iterator()); | |
| 6702 | - String path = this.getClass().getResource("/").getPath() + "static/pages/forms/"; | |
| 6703 | - ee.excelReplace(listI, new Object[]{m}, path + "mould/repairReport.xls", | |
| 6704 | - path + "export/" + sdfSimple.format(sdfMonth.parse(date)) | |
| 6705 | - + "-" + lineName + "-维修上报记录.xls"); | |
| 6706 | - } catch (Exception e) { | |
| 6707 | - // TODO: handle exception | |
| 6708 | - e.printStackTrace(); | |
| 6709 | - } | |
| 6710 | - } | |
| 6711 | - | |
| 6712 | - return result; | |
| 6713 | - } | |
| 6714 | - | |
| 6715 | - @Override | |
| 6716 | - public Map<String, String> getLevelsByLines(List<String> lines) { | |
| 6717 | - Map<String, String> result = new HashMap<String, String>(), currSchDate = dayOfSchedule.getCurrSchDate(); | |
| 6718 | - for (String line : lines) { | |
| 6719 | - String level = BasicData.lineDate2Level.get(line + "_" + currSchDate.get(line)); | |
| 6720 | - result.put(line, level == null ? "" : level); | |
| 6721 | - } | |
| 6722 | - | |
| 6723 | - return result; | |
| 6724 | - } | |
| 6725 | - | |
| 6726 | - | |
| 6727 | - @Override | |
| 6728 | - public void destroy() throws Exception { | |
| 6729 | - // TODO Auto-generated method stub | |
| 6730 | - exec.shutdown(); | |
| 6731 | - } | |
| 6732 | - | |
| 6733 | - | |
| 6734 | - @Override | |
| 6735 | - public void afterPropertiesSet() throws Exception { | |
| 6736 | - // TODO Auto-generated method stub | |
| 6737 | - // 维修上报重发调度 | |
| 6738 | - exec.scheduleAtFixedRate(new Runnable() { | |
| 6739 | - | |
| 6740 | - @Override | |
| 6741 | - public void run() { | |
| 6742 | - // TODO Auto-generated method stub | |
| 6743 | - try { | |
| 6744 | - Iterator<RepairReport> it = queue.iterator(); | |
| 6745 | - while (it.hasNext()) { | |
| 6746 | - RepairReport rr = it.next(); | |
| 6747 | - repairReport(rr); | |
| 6748 | - if (rr.getReportState() == 1 || System.currentTimeMillis() - rr.getReportDate().getTime() > 86400000) queue.remove(rr); | |
| 6749 | - } | |
| 6750 | - } catch (Exception e) { | |
| 6751 | - logger.error("维修上报重发错误", e); | |
| 6752 | - } | |
| 6753 | - } | |
| 6754 | - }, 30, 30, TimeUnit.MINUTES); | |
| 6755 | - | |
| 6756 | - //// --- | |
| 6757 | - exec.scheduleWithFixedDelay(new Runnable() { | |
| 6758 | - @Override | |
| 6759 | - public void run() { | |
| 6760 | - Map<String, Object> res = new HashMap<>(); | |
| 6761 | - InputStream in = null; | |
| 6762 | - String url ="http://211.95.61.66:9008/modules/tSafedrivingCs/DSMBHforCLBH"; | |
| 6763 | - | |
| 6764 | - try { | |
| 6765 | - HttpURLConnection con = (HttpURLConnection)new URL(url.toString()).openConnection(); | |
| 6766 | - con.setDoInput(true); | |
| 6767 | - con.setRequestMethod("POST"); | |
| 6768 | - con.setConnectTimeout(5000); | |
| 6769 | - con.setReadTimeout(5000); | |
| 6770 | - con.setRequestProperty("keep-alive", "true"); | |
| 6771 | - con.setRequestProperty("accept", "*/*"); | |
| 6772 | - con.setRequestProperty("content-type", "application/x-www-form-urlencoded"); | |
| 6773 | - con.connect(); | |
| 6774 | - | |
| 6775 | - if (con.getResponseCode() == 200) { | |
| 6776 | - in = con.getInputStream(); | |
| 6777 | - ByteArrayOutputStream bout = new ByteArrayOutputStream(); | |
| 6778 | - IOUtils.copy(in, bout); | |
| 6779 | - DIRMAP = new ObjectMapper().readValue(bout.toByteArray(), Map.class); | |
| 6780 | - } | |
| 6781 | - logger.info("IP打电话接口查询完成"); | |
| 6782 | - } catch (MalformedURLException e) { | |
| 6783 | - // TODO Auto-generated catch block | |
| 6784 | - e.printStackTrace(); | |
| 6785 | - logger.error("IP打电话接口出错",e); | |
| 6786 | - } catch (IOException e) { | |
| 6787 | - // TODO Auto-generated catch block | |
| 6788 | - e.printStackTrace(); | |
| 6789 | - } | |
| 6790 | - | |
| 6791 | - } | |
| 6792 | - }, 0, 10, TimeUnit.MINUTES); | |
| 6793 | - } | |
| 6794 | -} | |
| 6795 | - | |
| 6796 | -class AccountMap implements Comparator<Map<String, Object>> { | |
| 6797 | - @Override | |
| 6798 | - public int compare(Map<String, Object> o1, Map<String, Object> o2) { | |
| 6799 | - // TODO Auto-generated method stub | |
| 6800 | - return o1.get("clZbh").toString().compareTo(o2.get("clZbh").toString()); | |
| 6801 | - } | |
| 6802 | -} | |
| 6803 | - | |
| 6804 | -class AccountMap2 implements Comparator<Map<String, Object>> { | |
| 6805 | - @Override | |
| 6806 | - public int compare(Map<String, Object> o1, Map<String, Object> o2) { | |
| 6807 | - // TODO Auto-generated method stub | |
| 6808 | - return o2.get("clZbh").toString().compareTo(o1.get("clZbh").toString()); | |
| 6809 | - } | |
| 6810 | -} | |
| 6811 | - | |
| 6812 | -class AccountXlbm implements Comparator<Map<String, Object>> { | |
| 6813 | - @Override | |
| 6814 | - public int compare(Map<String, Object> o1, Map<String, Object> o2) { | |
| 6815 | - // TODO Auto-generated method stub | |
| 6816 | -// PinyinHelper.convertToPinyinString(ppy.getName(), | |
| 6817 | -// "" , PinyinFormat.WITHOUT_TONE) | |
| 6818 | - return o1.get("xlNamePy").toString().compareTo( | |
| 6819 | - o2.get("xlNamePy").toString()); | |
| 6820 | - } | |
| 6821 | -} | |
| 6822 | - | |
| 6823 | -class compareLpFcsjType implements Comparator<ScheduleRealInfo> { | |
| 6824 | - @Override | |
| 6825 | - public int compare(ScheduleRealInfo o1, ScheduleRealInfo o2) { | |
| 6826 | - // TODO Auto-generated method stub | |
| 6827 | - return (o1.getLpName()+o1.getFcsjT() + o1.getRemark()).compareTo(o2.getLpName()+o2.getFcsjT() + o2.getRemark()); | |
| 6828 | - } | |
| 6829 | - | |
| 6830 | -} | |
| 6831 | - | |
| 6832 | -class compareDirLpFcsjType implements Comparator<ScheduleRealInfo> { | |
| 6833 | - @Override | |
| 6834 | - public int compare(ScheduleRealInfo o1, ScheduleRealInfo o2) { | |
| 6835 | - // TODO Auto-generated method stub | |
| 6836 | - return (o1.getXlDir()+o1.getFcsjT() + o1.getRemark()+o1.getLpName()).compareTo(o2.getXlDir()+o2.getFcsjT() + o2.getRemark()+o2.getLpName()); | |
| 6837 | - } | |
| 6838 | - | |
| 6839 | -} | |
| 6840 | -class compareFcsjType implements Comparator<ScheduleRealInfo> { | |
| 6841 | - @Override | |
| 6842 | - public int compare(ScheduleRealInfo o1, ScheduleRealInfo o2) { | |
| 6843 | - // TODO Auto-generated method stub | |
| 6844 | - return (o1.getFcsjT() + o1.getRemark()).compareTo(o2.getFcsjT() + o2.getRemark()); | |
| 6845 | - } | |
| 6846 | - | |
| 6847 | -} | |
| 1 | +package com.bsth.service.realcontrol.impl; | |
| 2 | + | |
| 3 | +import java.io.*; | |
| 4 | +import java.lang.reflect.Field; | |
| 5 | +import java.math.BigDecimal; | |
| 6 | +import java.net.HttpURLConnection; | |
| 7 | +import java.net.MalformedURLException; | |
| 8 | +import java.net.URL; | |
| 9 | +import java.sql.ResultSet; | |
| 10 | +import java.sql.SQLException; | |
| 11 | +import java.text.DecimalFormat; | |
| 12 | +import java.text.ParseException; | |
| 13 | +import java.text.SimpleDateFormat; | |
| 14 | +import java.util.ArrayList; | |
| 15 | +import java.util.Calendar; | |
| 16 | +import java.util.Collection; | |
| 17 | +import java.util.Collections; | |
| 18 | +import java.util.Comparator; | |
| 19 | +import java.util.Date; | |
| 20 | +import java.util.GregorianCalendar; | |
| 21 | +import java.util.HashMap; | |
| 22 | +import java.util.HashSet; | |
| 23 | +import java.util.Iterator; | |
| 24 | +import java.util.List; | |
| 25 | +import java.util.Map; | |
| 26 | +import java.util.Queue; | |
| 27 | +import java.util.Set; | |
| 28 | +import java.util.concurrent.*; | |
| 29 | +import java.util.regex.Pattern; | |
| 30 | + | |
| 31 | +import com.bsth.entity.*; | |
| 32 | +import com.bsth.util.*; | |
| 33 | +import com.bsth.data.SystemParamCache; | |
| 34 | +import org.apache.commons.io.IOUtils; | |
| 35 | +import org.apache.commons.lang3.StringEscapeUtils; | |
| 36 | +import org.apache.commons.lang3.StringUtils; | |
| 37 | +import org.joda.time.DateTime; | |
| 38 | +import org.joda.time.format.DateTimeFormat; | |
| 39 | +import org.joda.time.format.DateTimeFormatter; | |
| 40 | +import org.slf4j.Logger; | |
| 41 | +import org.slf4j.LoggerFactory; | |
| 42 | +import org.springframework.beans.factory.DisposableBean; | |
| 43 | +import org.springframework.beans.factory.InitializingBean; | |
| 44 | +import org.springframework.beans.factory.annotation.Autowired; | |
| 45 | +import org.springframework.jdbc.core.BeanPropertyRowMapper; | |
| 46 | +import org.springframework.jdbc.core.JdbcTemplate; | |
| 47 | +import org.springframework.jdbc.core.RowMapper; | |
| 48 | +import org.springframework.stereotype.Service; | |
| 49 | +import org.springframework.transaction.annotation.Transactional; | |
| 50 | + | |
| 51 | +import com.alibaba.fastjson.JSON; | |
| 52 | +import com.alibaba.fastjson.JSONArray; | |
| 53 | +import com.alibaba.fastjson.JSONObject; | |
| 54 | +import com.bsth.common.Constants; | |
| 55 | +import com.bsth.common.ResponseCode; | |
| 56 | +import com.bsth.controller.realcontrol.dto.ChangePersonCar; | |
| 57 | +import com.bsth.controller.realcontrol.dto.DfsjChange; | |
| 58 | +import com.bsth.controller.realcontrol.dto.LpData; | |
| 59 | +import com.bsth.data.BasicData; | |
| 60 | +import com.bsth.data.LineConfigData; | |
| 61 | +import com.bsth.data.Station2ParkBuffer; | |
| 62 | +import com.bsth.data.schedule.DayOfSchedule; | |
| 63 | +import com.bsth.data.schedule.SchAttrCalculator; | |
| 64 | +import com.bsth.data.schedule.ScheduleComparator; | |
| 65 | +import com.bsth.data.schedule.edit_logs.FormLogger; | |
| 66 | +import com.bsth.data.schedule.edit_logs.ScheduleModifyLogger; | |
| 67 | +import com.bsth.data.schedule.edit_logs.loggers.AfterwardsLogger; | |
| 68 | +import com.bsth.data.schedule.edit_logs.loggers.FcxxwtLogger; | |
| 69 | +import com.bsth.data.schedule.edit_logs.service.dto.SchEditInfoDto; | |
| 70 | +import com.bsth.data.schedule.late_adjust.LateAdjustHandle; | |
| 71 | +import com.bsth.data.utils.CustomStringUtils; | |
| 72 | +import com.bsth.entity.calc.CalcInterval; | |
| 73 | +import com.bsth.entity.calc.CalcStatistics; | |
| 74 | +import com.bsth.entity.oil.Dlb; | |
| 75 | +import com.bsth.entity.oil.Qlb; | |
| 76 | +import com.bsth.entity.oil.Ylb; | |
| 77 | +import com.bsth.entity.oil.Ylxxb; | |
| 78 | +import com.bsth.entity.realcontrol.ChildTaskPlan; | |
| 79 | +import com.bsth.entity.realcontrol.LineConfig; | |
| 80 | +import com.bsth.entity.realcontrol.ScheduleRealInfo; | |
| 81 | +import com.bsth.entity.realcontrol.SvgAttribute; | |
| 82 | +import com.bsth.entity.report.MileageReport; | |
| 83 | +import com.bsth.entity.report.RepairReport; | |
| 84 | +import com.bsth.entity.report.ScheduleCorrectionReport; | |
| 85 | +import com.bsth.entity.schedule.CarConfigInfo; | |
| 86 | +import com.bsth.entity.schedule.EmployeeConfigInfo; | |
| 87 | +import com.bsth.entity.schedule.GuideboardInfo; | |
| 88 | +import com.bsth.entity.schedule.SchedulePlanInfo; | |
| 89 | +import com.bsth.entity.sys.Dictionary; | |
| 90 | +import com.bsth.entity.sys.DutyEmployee; | |
| 91 | +import com.bsth.entity.sys.SysUser; | |
| 92 | +import com.bsth.repository.BusinessRepository; | |
| 93 | +import com.bsth.repository.CarDeviceRepository; | |
| 94 | +import com.bsth.repository.CarsRepository; | |
| 95 | +import com.bsth.repository.LineRepository; | |
| 96 | +import com.bsth.repository.RepairReportRepository; | |
| 97 | +import com.bsth.repository.calc.CalcIntervalRepository; | |
| 98 | +import com.bsth.repository.oil.DlbRepository; | |
| 99 | +import com.bsth.repository.oil.QlbRepository; | |
| 100 | +import com.bsth.repository.oil.YlbRepository; | |
| 101 | +import com.bsth.repository.oil.YlxxbRepository; | |
| 102 | +import com.bsth.repository.realcontrol.ChildTaskPlanRepository; | |
| 103 | +import com.bsth.repository.realcontrol.ScheduleRealInfoRepository; | |
| 104 | +import com.bsth.repository.realcontrol.SvgAttributeRepository; | |
| 105 | +import com.bsth.repository.schedule.CarConfigInfoRepository; | |
| 106 | +import com.bsth.repository.schedule.EmployeeConfigInfoRepository; | |
| 107 | +import com.bsth.repository.schedule.GuideboardInfoRepository; | |
| 108 | +import com.bsth.security.util.SecurityUtils; | |
| 109 | +import com.bsth.service.LineService; | |
| 110 | +import com.bsth.service.SectionRouteService; | |
| 111 | +import com.bsth.service.calc.CalcWaybillService; | |
| 112 | +import com.bsth.service.directive.DirectiveService; | |
| 113 | +import com.bsth.service.impl.BaseServiceImpl; | |
| 114 | +import com.bsth.service.realcontrol.ScheduleRealInfoService; | |
| 115 | +import com.bsth.service.report.CulateMileageService; | |
| 116 | +import com.bsth.service.report.ReportService; | |
| 117 | +import com.bsth.service.schedule.SchedulePlanInfoService; | |
| 118 | +import com.bsth.service.sys.DictionaryService; | |
| 119 | +import com.bsth.service.sys.DutyEmployeeService; | |
| 120 | +import com.bsth.util.Arith; | |
| 121 | +import com.bsth.util.ComparableChild; | |
| 122 | +import com.bsth.util.ComparableLp; | |
| 123 | +import com.bsth.util.ComparableReal; | |
| 124 | +import com.bsth.util.DateUtils; | |
| 125 | +import com.bsth.util.ReportRelatedUtils; | |
| 126 | +import com.bsth.util.ReportUtils; | |
| 127 | +import com.bsth.util.TimeUtils; | |
| 128 | +import com.bsth.util.CoordinateConverter; | |
| 129 | +import com.bsth.websocket.handler.SendUtils; | |
| 130 | +import com.fasterxml.jackson.databind.ObjectMapper; | |
| 131 | +import com.github.stuxuhai.jpinyin.PinyinException; | |
| 132 | +import com.github.stuxuhai.jpinyin.PinyinFormat; | |
| 133 | +import com.github.stuxuhai.jpinyin.PinyinHelper; | |
| 134 | +import com.google.common.base.Splitter; | |
| 135 | +import com.google.common.collect.Lists; | |
| 136 | + | |
| 137 | +@Service | |
| 138 | +public class ScheduleRealInfoServiceImpl extends BaseServiceImpl<ScheduleRealInfo, Long> | |
| 139 | + implements ScheduleRealInfoService, InitializingBean, DisposableBean { | |
| 140 | + @Autowired | |
| 141 | + JdbcTemplate jdbcTemplate; | |
| 142 | + @Autowired | |
| 143 | + ScheduleRealInfoRepository scheduleRealInfoRepository; | |
| 144 | + | |
| 145 | + @Autowired | |
| 146 | + EmployeeConfigInfoRepository employeeConfigInfoRepository; | |
| 147 | + | |
| 148 | + @Autowired | |
| 149 | + CarConfigInfoRepository carConfigInfoRepository; | |
| 150 | + | |
| 151 | + @Autowired | |
| 152 | + SectionRouteService sectionRouteService; | |
| 153 | + | |
| 154 | + @Autowired | |
| 155 | + CulateMileageService culateMieageService; | |
| 156 | + | |
| 157 | + @Autowired | |
| 158 | + DictionaryService dictionaryService; | |
| 159 | + | |
| 160 | + @Autowired | |
| 161 | + CalcWaybillService calcWaybillService; | |
| 162 | + | |
| 163 | + @Autowired | |
| 164 | + CalcIntervalRepository calcIntervalRepository; | |
| 165 | + | |
| 166 | + @Autowired | |
| 167 | + LineRepository lineRepository; | |
| 168 | + @Autowired | |
| 169 | + LineService lineService; | |
| 170 | + @Autowired | |
| 171 | + GuideboardInfoRepository guideboardInfoRepository; | |
| 172 | + | |
| 173 | + @Autowired | |
| 174 | + ChildTaskPlanRepository cTaskPlanRepository; | |
| 175 | + | |
| 176 | + @Autowired | |
| 177 | + SendUtils sendUtils; | |
| 178 | + | |
| 179 | + @Autowired | |
| 180 | + DayOfSchedule dayOfSchedule; | |
| 181 | + | |
| 182 | + @Autowired | |
| 183 | + SchAttrCalculator schAttrCalculator; | |
| 184 | + | |
| 185 | + @Autowired | |
| 186 | + LineConfigData lineConfigData; | |
| 187 | + | |
| 188 | + @Autowired | |
| 189 | + DutyEmployeeService dutyEmployeeService; | |
| 190 | + | |
| 191 | + @Autowired | |
| 192 | + YlxxbRepository ylxxbRepository; | |
| 193 | + | |
| 194 | + @Autowired | |
| 195 | + YlbRepository ylbRepository; | |
| 196 | + | |
| 197 | + @Autowired | |
| 198 | + DlbRepository dlbRepository; | |
| 199 | + | |
| 200 | + @Autowired | |
| 201 | + QlbRepository qlbRepository; | |
| 202 | + | |
| 203 | + @Autowired | |
| 204 | + ReportService reposrService; | |
| 205 | + | |
| 206 | + @Autowired | |
| 207 | + CulateMileageService culateService; | |
| 208 | + | |
| 209 | + @Autowired | |
| 210 | + FormLogger schModifyLog; | |
| 211 | + | |
| 212 | + @Autowired | |
| 213 | + DirectiveService directiveService; | |
| 214 | + | |
| 215 | + @Autowired | |
| 216 | + CarDeviceRepository carDeviceRepository; | |
| 217 | + | |
| 218 | + @Autowired | |
| 219 | + CarsRepository carsRepository; | |
| 220 | + | |
| 221 | + @Autowired | |
| 222 | + BusinessRepository businessRepository; | |
| 223 | + | |
| 224 | + @Autowired | |
| 225 | + RepairReportRepository repairReportRepository; | |
| 226 | + | |
| 227 | + private final static Logger logger = LoggerFactory.getLogger(ScheduleRealInfoServiceImpl.class); | |
| 228 | + | |
| 229 | + SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"), | |
| 230 | + sdfSimple = new SimpleDateFormat("yyyyMMdd"); | |
| 231 | + | |
| 232 | + public static Map<String,String> DIRMAP = new ConcurrentHashMap<>(); // dvr电话 | |
| 233 | + private Queue<RepairReport> queue = new ConcurrentLinkedQueue<>(); | |
| 234 | + | |
| 235 | + private ScheduledExecutorService exec = Executors.newSingleThreadScheduledExecutor(new ThreadFactory() { | |
| 236 | + | |
| 237 | + @Override | |
| 238 | + public Thread newThread(Runnable r) { | |
| 239 | + // TODO Auto-generated method stub | |
| 240 | + Thread t = new Thread(r); | |
| 241 | + t.setName("RepairReportReissuer"); | |
| 242 | + | |
| 243 | + return t; | |
| 244 | + } | |
| 245 | + }); | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + private static Map<String, String> report2repair = new HashMap<String, String>(); | |
| 250 | + | |
| 251 | + static { | |
| 252 | + report2repair.put("9101", "9109"); | |
| 253 | + report2repair.put("9102", "9102"); | |
| 254 | + report2repair.put("9103", "9103"); | |
| 255 | + report2repair.put("9104", "9104"); | |
| 256 | + report2repair.put("9109", "9109"); | |
| 257 | + report2repair.put("9201", "9201"); | |
| 258 | + report2repair.put("9202", "9202"); | |
| 259 | + report2repair.put("9203", "9203"); | |
| 260 | + report2repair.put("9204", "9204"); | |
| 261 | + report2repair.put("9209", "9209"); | |
| 262 | + report2repair.put("9301", "9301"); | |
| 263 | + report2repair.put("9302", "9302"); | |
| 264 | + report2repair.put("9303", "9303"); | |
| 265 | + report2repair.put("9304", "9304"); | |
| 266 | + report2repair.put("9305", "9305"); | |
| 267 | + report2repair.put("9306", "9306"); | |
| 268 | + report2repair.put("9309", "9309"); | |
| 269 | + } | |
| 270 | + | |
| 271 | + | |
| 272 | + /** | |
| 273 | + * 校验人车 和 班次的公司和分公司归属 | |
| 274 | + * | |
| 275 | + * @param schId | |
| 276 | + * @param jGh | |
| 277 | + * @param sGh | |
| 278 | + * @param nbbm | |
| 279 | + * @return -2 跨营运公司,校验不过 | |
| 280 | + * -1 跨分公司,二次确认 | |
| 281 | + * 1 校验通过 | |
| 282 | + */ | |
| 283 | + @Override | |
| 284 | + public Map<String, Object> checkPCFgsAscription(Long schId, String jGh, String sGh, String nbbm) { | |
| 285 | + Map<String, Object> rs = new HashMap<>(); | |
| 286 | + try { | |
| 287 | + rs.put("status", ResponseCode.SUCCESS); | |
| 288 | + rs.put("checkStatus", -2); | |
| 289 | + | |
| 290 | + String msg = null; | |
| 291 | + ScheduleRealInfo sch = dayOfSchedule.get(schId); | |
| 292 | + String gsbm = sch.getGsBm(), fgsbm = sch.getFgsBm(); | |
| 293 | + | |
| 294 | + if (nbbm != null && !carExist(gsbm, nbbm)) { | |
| 295 | + msg = sch.getGsName() + "没有自编号为" + "[" + nbbm + "]的车辆"; | |
| 296 | + rs.put("msg", msg); | |
| 297 | + return rs; | |
| 298 | + } | |
| 299 | + | |
| 300 | + if (nbbm != null && !sch.getGsBm().equals(BasicData.nbbm2CompanyCodeMap.get(nbbm))) { | |
| 301 | + rs.put("msg", sch.getXlName() + "所属的公司编码下找不到自编号为【" + nbbm + "】的车辆"); | |
| 302 | + return rs; | |
| 303 | + } | |
| 304 | + | |
| 305 | + if (nbbm != null && !(fgsbm + "_" + gsbm).equals(BasicData.nbbm2FgsCompanyCodeMap.get(nbbm))) { | |
| 306 | + | |
| 307 | + String clFgsName = BasicData.businessFgsCodeNameMap.get(BasicData.nbbm2FgsCompanyCodeMap.get(nbbm)); | |
| 308 | + | |
| 309 | + msg = ("【" + nbbm + "】" + "是" + clFgsName + "的车辆!"); | |
| 310 | + rs.put("msg", msg); | |
| 311 | + rs.put("checkStatus", -1); | |
| 312 | + return rs; | |
| 313 | + } | |
| 314 | + | |
| 315 | + if(null != jGh && !"/".equals(StringUtils.trim(jGh))){ | |
| 316 | + Personnel jsy = BasicData.perMap.get(gsbm + "-" + jGh); | |
| 317 | + | |
| 318 | + if (null == jsy) { | |
| 319 | + msg = "【驾驶员】:" + sch.getGsName() + "暂无工号为" + "【" + jGh + "】的人员"; | |
| 320 | + rs.put("msg", msg); | |
| 321 | + return rs; | |
| 322 | + } | |
| 323 | + else if (!fgsbm.equals(jsy.getBrancheCompanyCode())) { | |
| 324 | + //校验分公司 | |
| 325 | + msg = ("【驾驶员】:" + jGh + "/" + jsy.getPersonnelName() + "是" + jsy.getBrancheCompany() + "的人员"); | |
| 326 | + rs.put("msg", msg); | |
| 327 | + rs.put("checkStatus", -1); | |
| 328 | + return rs; | |
| 329 | + } | |
| 330 | + } | |
| 331 | + | |
| 332 | + if (null != sGh && !"/".equals(StringUtils.trim(sGh))) { | |
| 333 | + Personnel spy = BasicData.perMap.get(gsbm + "-" + sGh); | |
| 334 | + if (null == spy) { | |
| 335 | + msg = "【售票员】: " + sch.getGsName() + "暂无工号为" + "【" + sGh + "】的人员"; | |
| 336 | + rs.put("msg", msg); | |
| 337 | + return rs; | |
| 338 | + } | |
| 339 | + else if (!fgsbm.equals(spy.getBrancheCompanyCode())) { | |
| 340 | + msg = ("【售票员】: " + sGh + "/" + spy.getPersonnelName() + "是" + spy.getBrancheCompany() + "的人员"); | |
| 341 | + rs.put("msg", msg); | |
| 342 | + rs.put("checkStatus", -1); | |
| 343 | + return rs; | |
| 344 | + } | |
| 345 | + } | |
| 346 | + | |
| 347 | + rs.put("checkStatus", 1); | |
| 348 | + } catch (Exception e) { | |
| 349 | + logger.error("", e); | |
| 350 | + rs.put("status", ResponseCode.ERROR); | |
| 351 | + } | |
| 352 | + return rs; | |
| 353 | + } | |
| 354 | + | |
| 355 | + | |
| 356 | + /** | |
| 357 | + * 车辆是否存在 | |
| 358 | + * | |
| 359 | + * @param gsbm 公司编码 | |
| 360 | + * @param nbbm 车辆自编号 | |
| 361 | + * @return | |
| 362 | + */ | |
| 363 | + private boolean carExist(String gsbm, String nbbm) { | |
| 364 | + return BasicData.nbbm2CompanyCodeMap.containsKey(nbbm); | |
| 365 | + } | |
| 366 | + | |
| 367 | + /** | |
| 368 | + * 获取人员姓名 | |
| 369 | + * | |
| 370 | + * @param gsbm 公司编码 | |
| 371 | + * @param gh 人员工号 | |
| 372 | + * @return | |
| 373 | + */ | |
| 374 | + private String getPersonName(String gsbm, String gh) { | |
| 375 | + return BasicData.allPerson.get(gsbm + '-' + gh); | |
| 376 | + } | |
| 377 | + | |
| 378 | + @Override | |
| 379 | + public Iterable<ScheduleRealInfo> list(Map<String, Object> map) { | |
| 380 | + Iterator<ScheduleRealInfo> iterator = super.list(map).iterator(); | |
| 381 | + Set<ScheduleRealInfo> set = new HashSet<>(100); | |
| 382 | + | |
| 383 | + DateTimeFormatter fmtyyyyMMddHHmm = DateTimeFormat.forPattern("yyyy-MM-ddHH:mm"); | |
| 384 | + //计算时间戳 | |
| 385 | + ScheduleRealInfo sch; | |
| 386 | + while (iterator.hasNext()) { | |
| 387 | + sch = iterator.next(); | |
| 388 | + //待发时间戳 | |
| 389 | + sch.setDfsjT(fmtyyyyMMddHHmm.parseMillis(sch.getRealExecDate() + sch.getDfsj())); | |
| 390 | + //实发时间戳 | |
| 391 | + if (StringUtils.isNotEmpty(sch.getFcsjActual())) { | |
| 392 | + sch.setFcsjActualTime(fmtyyyyMMddHHmm.parseMillis(sch.getRealExecDate() + sch.getFcsjActual())); | |
| 393 | + } | |
| 394 | + set.add(sch); | |
| 395 | + } | |
| 396 | + return set; | |
| 397 | + } | |
| 398 | + | |
| 399 | + @Override | |
| 400 | + public Map<String, Collection<ScheduleRealInfo>> findByLines(String lines) { | |
| 401 | + List<String> lineList = Lists.newArrayList(Splitter.on(',').trimResults().omitEmptyStrings().split(lines)); | |
| 402 | + | |
| 403 | + /*Multimap<String, ScheduleRealInfo> mMap = ArrayListMultimap.create(); | |
| 404 | + | |
| 405 | + for (String lineCode : lineList) { | |
| 406 | + mMap.putAll(lineCode, dayOfSchedule.findByLineCode(lineCode)); | |
| 407 | + }*/ | |
| 408 | + return dayOfSchedule.findByLineCodes(lineList); | |
| 409 | + } | |
| 410 | + | |
| 411 | + private final static long DAY_TIME = 1000 * 60 * 60 * 24L; | |
| 412 | + | |
| 413 | + private static int BUF_SIZE = 1024; | |
| 414 | + | |
| 415 | + private static DateTimeFormatter fmtyyyyMMdd = DateTimeFormat.forPattern("yyyy-MM-dd"); | |
| 416 | + private static DateTimeFormatter fmtHHmm = DateTimeFormat.forPattern("HH:mm"); | |
| 417 | + | |
| 418 | + @Override | |
| 419 | + public Map<String, Object> outgoAdjust(Long id, String remarks, String dfsj, String bcType, String opType, String userId) { | |
| 420 | + Map<String, Object> map = new HashMap<>(); | |
| 421 | + try { | |
| 422 | + | |
| 423 | + ScheduleRealInfo schedule = dayOfSchedule.get(id); | |
| 424 | + | |
| 425 | + if (schedule.getStatus() > 0) { | |
| 426 | + map.put("status", ResponseCode.SUCCESS); | |
| 427 | + map.put("flag", "4008"); | |
| 428 | + map.put("t", schedule); | |
| 429 | + return map; | |
| 430 | + } | |
| 431 | + | |
| 432 | + LineConfig config = lineConfigData.get(schedule.getXlBm()); | |
| 433 | + //小于线路开始运营时间,则默认跨过24点 | |
| 434 | + if (dfsj.compareTo(config.getStartOpt()) < 0) { | |
| 435 | + schedule.setRealExecDate(fmtyyyyMMdd.print(schedule.getScheduleDate().getTime() + DAY_TIME)); | |
| 436 | + } else { | |
| 437 | + schedule.setRealExecDate(schedule.getScheduleDateStr()); | |
| 438 | + } | |
| 439 | + | |
| 440 | + //记录日志 | |
| 441 | + ScheduleModifyLogger.dftz(schedule, opType, schedule.getDfsj(), dfsj, remarks, userId); | |
| 442 | + | |
| 443 | + schedule.setDfsjAll(dfsj); | |
| 444 | + schedule.setDfAuto(false); | |
| 445 | + if ("1".equals(opType)) | |
| 446 | + schedule.setRemarks(remarks); | |
| 447 | + | |
| 448 | + List<ScheduleRealInfo> ts = new ArrayList<>(); | |
| 449 | + ts.add(schedule); | |
| 450 | + //调整终点时间和下一个班次的应到时间 | |
| 451 | + //schedule.calcEndTime(); | |
| 452 | + /*ScheduleRealInfo nextSch = dayOfSchedule.nextByLp2(schedule); | |
| 453 | + if (null != nextSch) { | |
| 454 | + nextSch.setQdzArrDatejh(schedule.getZdsj()); | |
| 455 | + ts.add(nextSch); | |
| 456 | + }*/ | |
| 457 | + | |
| 458 | + //调整班次类型 | |
| 459 | + if (StringUtils.isNotEmpty(bcType) && !bcType.equals(schedule.getBcType())) { | |
| 460 | + if ((schedule.getBcType().equals("major") | |
| 461 | + || schedule.getBcType().equals("venting")) | |
| 462 | + && bcType.equals("normal")) { | |
| 463 | + //清空备注 | |
| 464 | + schedule.setRemarks(""); | |
| 465 | + } | |
| 466 | + schedule.setBcType(bcType); | |
| 467 | + } | |
| 468 | + | |
| 469 | + //如果正在执行该班次 | |
| 470 | + //ScheduleRealInfo exec = dayOfSchedule.executeCurr(schedule.getClZbh()); | |
| 471 | + //if(exec != null && exec == schedule){ | |
| 472 | + //重新计算正在执行班次 | |
| 473 | + dayOfSchedule.reCalcExecPlan(schedule.getClZbh()); | |
| 474 | + //} | |
| 475 | + | |
| 476 | + //重新计算是否误点 | |
| 477 | + schedule.reCalcLate(); | |
| 478 | + //取消应发未到标记,不再自动调整待发 | |
| 479 | + //if(schedule.isLate2()){ | |
| 480 | + // schedule.setLate2(false); | |
| 481 | + //LateAdjustHandle.remove(schedule); | |
| 482 | + //} | |
| 483 | + | |
| 484 | + try { | |
| 485 | + if (!schedule.getDirectiveState().equals(-1) && schedule.getStatus() == 0) { | |
| 486 | + //重新下发调度指令 | |
| 487 | + directiveService.send60Dispatch(schedule.getId(), "待发@系统"); | |
| 488 | + } | |
| 489 | + } catch (Exception e) { | |
| 490 | + logger.error("", e); | |
| 491 | + } | |
| 492 | + | |
| 493 | + // 持久化到数据库 | |
| 494 | + dayOfSchedule.save(schedule); | |
| 495 | + | |
| 496 | + map.put("status", ResponseCode.SUCCESS); | |
| 497 | + map.put("ts", ts); | |
| 498 | + } catch (Exception e) { | |
| 499 | + logger.error("", e); | |
| 500 | + map.put("status", ResponseCode.ERROR); | |
| 501 | + } | |
| 502 | + return map; | |
| 503 | + } | |
| 504 | + | |
| 505 | + @Override | |
| 506 | + public Map<String, Object> destroy(String idsStr, String remarks, String reason, String userId) { | |
| 507 | + | |
| 508 | + Map<String, Object> map = new HashMap<>(); | |
| 509 | + List<ScheduleRealInfo> rsList = new ArrayList<>(); | |
| 510 | + map.put("ts", rsList); | |
| 511 | + try { | |
| 512 | + List<String> idList = Lists.newArrayList(Splitter.on(',').trimResults().omitEmptyStrings().split(idsStr)); | |
| 513 | + | |
| 514 | + ScheduleRealInfo schedule = null; | |
| 515 | + for (String id : idList) { | |
| 516 | + schedule = dayOfSchedule.get(Long.parseLong(id)); | |
| 517 | + if (schedule.isDestroy()) { | |
| 518 | + map.put("status", ResponseCode.ERROR); | |
| 519 | + map.put("msg", "不必要的重复烂班!"); | |
| 520 | + return map; | |
| 521 | + } | |
| 522 | + //记录日志 | |
| 523 | + ScheduleModifyLogger.jhlb(schedule, remarks, userId); | |
| 524 | + | |
| 525 | + schedule.setAdjustExps(reason); | |
| 526 | + schedule.destroy(); | |
| 527 | + schedule.addRemarks(remarks); | |
| 528 | + | |
| 529 | + dayOfSchedule.save(schedule); | |
| 530 | + rsList.add(schedule); | |
| 531 | + } | |
| 532 | + | |
| 533 | + //重新计算当前执行班次 | |
| 534 | + dayOfSchedule.reCalcExecPlan(schedule.getClZbh()); | |
| 535 | + | |
| 536 | + map.put("status", ResponseCode.SUCCESS); | |
| 537 | + } catch (Exception e) { | |
| 538 | + logger.error("", e); | |
| 539 | + map.put("status", ResponseCode.ERROR); | |
| 540 | + } | |
| 541 | + return map; | |
| 542 | + } | |
| 543 | + | |
| 544 | + // 线路id获取驾驶员 | |
| 545 | + @Override | |
| 546 | + public List<Map<String, String>> findDriverByLine(String lineCode) { | |
| 547 | + List<EmployeeConfigInfo> list = employeeConfigInfoRepository.findBylineCode(lineCode); | |
| 548 | + | |
| 549 | + List<Map<String, String>> rsList = new ArrayList<>(); | |
| 550 | + Map<String, String> map = null; | |
| 551 | + Personnel driver = null; | |
| 552 | + String code = null; | |
| 553 | + | |
| 554 | + for (EmployeeConfigInfo employee : list) { | |
| 555 | + driver = employee.getJsy(); | |
| 556 | + if (driver != null) { | |
| 557 | + map = new HashMap<>(); | |
| 558 | + code = driver.getJobCode(); | |
| 559 | + map.put("id", code + "/" + driver.getPersonnelName()); | |
| 560 | + map.put("text", code + "/" + driver.getPersonnelName()); | |
| 561 | + rsList.add(map); | |
| 562 | + } | |
| 563 | + } | |
| 564 | + return rsList; | |
| 565 | + } | |
| 566 | + | |
| 567 | + // 线路id获取售票员 | |
| 568 | + @Override | |
| 569 | + public List<Map<String, String>> findConductorByLine(String lineCode) { | |
| 570 | + List<EmployeeConfigInfo> list = employeeConfigInfoRepository.findBylineCode(lineCode); | |
| 571 | + | |
| 572 | + List<Map<String, String>> rsList = new ArrayList<>(); | |
| 573 | + Map<String, String> map = null; | |
| 574 | + Personnel conductor = null; | |
| 575 | + String code = null; | |
| 576 | + | |
| 577 | + for (EmployeeConfigInfo employee : list) { | |
| 578 | + conductor = employee.getSpy(); | |
| 579 | + if (conductor != null) { | |
| 580 | + code = conductor.getJobCode(); | |
| 581 | + map = new HashMap<>(); | |
| 582 | + map.put("id", code + "/" + conductor.getPersonnelName()); | |
| 583 | + map.put("text", code + "/" + conductor.getPersonnelName()); | |
| 584 | + rsList.add(map); | |
| 585 | + } | |
| 586 | + } | |
| 587 | + return rsList; | |
| 588 | + } | |
| 589 | + | |
| 590 | + @Override | |
| 591 | + public List<Map<String, String>> findCarByLine(String lineCode) { | |
| 592 | + | |
| 593 | + List<CarConfigInfo> list = carConfigInfoRepository.findBylineCode(lineCode); | |
| 594 | + | |
| 595 | + List<Map<String, String>> rsList = new ArrayList<>(); | |
| 596 | + Map<String, String> map = null; | |
| 597 | + Cars car = null; | |
| 598 | + String code = null; | |
| 599 | + | |
| 600 | + for (CarConfigInfo cci : list) { | |
| 601 | + car = cci.getCl(); | |
| 602 | + if (car != null) { | |
| 603 | + code = car.getInsideCode(); | |
| 604 | + map = new HashMap<>(); | |
| 605 | + map.put("id", code); | |
| 606 | + map.put("text", code); | |
| 607 | + rsList.add(map); | |
| 608 | + } | |
| 609 | + } | |
| 610 | + return rsList; | |
| 611 | + } | |
| 612 | + | |
| 613 | + /** | |
| 614 | + * 添加到历史库 | |
| 615 | + * | |
| 616 | + * @param t | |
| 617 | + * @return | |
| 618 | + */ | |
| 619 | + @Override | |
| 620 | + public Map<String, Object> addToHistory(ScheduleRealInfo t) { | |
| 621 | + Map<String, Object> rs = new HashMap<>(); | |
| 622 | + try { | |
| 623 | + // 检查调度日期 | |
| 624 | + DateTimeFormatter formatter = DateTimeFormat.forPattern("yyyy-MM-dd"); | |
| 625 | + long today = formatter.parseMillis(new DateTime().toString("yyyy-MM-dd")), scheduleDate = formatter.parseMillis(t.getScheduleDateStr()); | |
| 626 | + String clZbh = t.getClZbh(), lpName = t.getLpName(); | |
| 627 | + if (today < scheduleDate || today - scheduleDate > 86400000 * PrivilegeUtils.getHistoryEditDays()) { | |
| 628 | + rs.put("status", ResponseCode.ERROR); | |
| 629 | + rs.put("msg", "无效的调度日期"); | |
| 630 | + return rs; | |
| 631 | + } | |
| 632 | + if (StringUtils.isEmpty(lpName) || StringUtils.isEmpty(lpName.trim())) { | |
| 633 | + rs.put("status", ResponseCode.ERROR); | |
| 634 | + rs.put("msg", "路牌信息缺失"); | |
| 635 | + return rs; | |
| 636 | + } | |
| 637 | + if (!carExist(t.getGsBm(), clZbh)) { | |
| 638 | + rs.put("msg", "车辆 " + clZbh + " <a href=\"/#/busInfoManage\" target=_blank>车辆基础信息</a> 里找不到!"); | |
| 639 | + rs.put("status", ResponseCode.ERROR); | |
| 640 | + return rs; | |
| 641 | + } | |
| 642 | + | |
| 643 | + SysUser user = SecurityUtils.getCurrentUser(); | |
| 644 | + //String schDate = DayOfSchedule.currSchDateMap.get(t.getXlBm()); | |
| 645 | + | |
| 646 | + SimpleDateFormat sdfyyyyMMdd = new SimpleDateFormat("yyyy-MM-dd"), sdfyyyyMMddHHmm = new SimpleDateFormat("yyyy-MM-ddHH:mm"); | |
| 647 | + | |
| 648 | + if (StringUtils.isEmpty(t.getjGh())) { | |
| 649 | + rs.put("status", ResponseCode.ERROR); | |
| 650 | + rs.put("msg", "驾驶员工号不能为空!"); | |
| 651 | + return rs; | |
| 652 | + } | |
| 653 | + //截取驾驶员工号 | |
| 654 | + if (t.getjGh().indexOf("-") != -1) { | |
| 655 | + t.setjGh(t.getjGh().split("-")[1]); | |
| 656 | + } | |
| 657 | + //检查驾驶员工号 | |
| 658 | + String jName = getPersonName(t.getGsBm(), t.getjGh()); | |
| 659 | + if (StringUtils.isEmpty(jName)) { | |
| 660 | + rs.put("msg", t.getXlName() + "所属的公司编码下找不到工号为【" + t.getjGh() + "】的驾驶员"); | |
| 661 | + rs.put("status", ResponseCode.ERROR); | |
| 662 | + return rs; | |
| 663 | + } else if (StringUtils.isEmpty(t.getjName())) { | |
| 664 | + t.setjName(jName);//补上驾驶员名称 | |
| 665 | + } | |
| 666 | + | |
| 667 | + //有售票员 | |
| 668 | + if (StringUtils.isNotEmpty(t.getsGh())) { | |
| 669 | + String sName = getPersonName(t.getGsBm(), t.getsGh()); | |
| 670 | + if (StringUtils.isEmpty(sName)) { | |
| 671 | + rs.put("msg", t.getXlName() + "所属的公司编码下找不到工号为【" + t.getjGh() + "】的售票员"); | |
| 672 | + rs.put("status", ResponseCode.ERROR); | |
| 673 | + return rs; | |
| 674 | + } else if (StringUtils.isEmpty(t.getsName())) { | |
| 675 | + t.setsName(sName);//补上售票员名称 | |
| 676 | + } | |
| 677 | + } else { | |
| 678 | + t.setsGh(""); | |
| 679 | + t.setsName(""); | |
| 680 | + } | |
| 681 | + | |
| 682 | + //公司 和 分公司名称 | |
| 683 | + t.setGsName(BasicData.businessCodeNameMap.get(t.getGsBm())); | |
| 684 | + t.setFgsName(BasicData.businessFgsCodeNameMap.get(t.getFgsBm()+ "_" + t.getGsBm() )); | |
| 685 | + | |
| 686 | + //t.setScheduleDateStr(schDate); | |
| 687 | + t.setScheduleDate(sdfyyyyMMdd.parse(t.getScheduleDateStr())); | |
| 688 | + t.setRealExecDate(t.getScheduleDateStr()); | |
| 689 | + t.setCreateBy(user); | |
| 690 | + t.setSflj(true); | |
| 691 | + t.setLate(false); | |
| 692 | + t.setDfsj(t.getFcsj()); | |
| 693 | + t.setZdsjT(sdfyyyyMMddHHmm.parse(t.getScheduleDateStr() + t.getZdsj()).getTime()); | |
| 694 | + t.setJhlcOrig(t.getJhlc()); | |
| 695 | + | |
| 696 | + //班次历时 | |
| 697 | + t.setBcsj(DateUtils.calcHHmmDiff(t.getFcsj(), t.getZdsj()) / 1000 / 60); | |
| 698 | + | |
| 699 | + //起终点名称 | |
| 700 | + String prefix = t.getXlBm() + "_" + t.getXlDir() + "_"; | |
| 701 | + t.setQdzName(BasicData.getStationNameByCode(t.getQdzCode(), prefix)); | |
| 702 | + t.setZdzName(BasicData.getStationNameByCode(t.getZdzCode(), prefix)); | |
| 703 | + | |
| 704 | + //计算班次实际执行时间 | |
| 705 | + schAttrCalculator.calcRealDate(t).calcAllTimeByFcsj(t); | |
| 706 | + //处理计达跨24点 | |
| 707 | + LineConfig conf = lineConfigData.get(t.getXlBm()); | |
| 708 | + if (t.getZdsj().compareTo(conf.getStartOpt()) < 0) { | |
| 709 | + t.setZdsjT(sdfyyyyMMddHHmm.parse(t.getScheduleDateStr() + t.getZdsj()).getTime() + (1000 * 60 * 60 * 24)); | |
| 710 | + } | |
| 711 | + if (t.getZdsjT() < t.getFcsjT()) { | |
| 712 | + rs.put("status", ResponseCode.ERROR); | |
| 713 | + rs.put("msg", "起终点时间异常!"); | |
| 714 | + return rs; | |
| 715 | + } | |
| 716 | + | |
| 717 | + t.setId(dayOfSchedule.getId()); | |
| 718 | + //实时入库 | |
| 719 | + rs = super.save(t); | |
| 720 | + } catch (Exception e) { | |
| 721 | + logger.error("", e); | |
| 722 | + rs.put("status", ResponseCode.ERROR); | |
| 723 | + } | |
| 724 | + return rs; | |
| 725 | + } | |
| 726 | + | |
| 727 | + | |
| 728 | + /** | |
| 729 | + * 临加班次 | |
| 730 | + */ | |
| 731 | + @Override | |
| 732 | + public Map<String, Object> save(ScheduleRealInfo sch) { | |
| 733 | + Map<String, Object> rs = new HashMap<>(); | |
| 734 | + try { | |
| 735 | + String clZbh = sch.getClZbh(), lpName = sch.getLpName(); | |
| 736 | + if (StringUtils.isEmpty(lpName) || StringUtils.isEmpty(lpName.trim())) { | |
| 737 | + rs.put("status", ResponseCode.ERROR); | |
| 738 | + rs.put("msg", "路牌信息缺失"); | |
| 739 | + return rs; | |
| 740 | + } | |
| 741 | + if (StringUtils.isNotEmpty(clZbh)) { | |
| 742 | + //检测 | |
| 743 | + if (!carExist(sch.getGsBm(), clZbh)) { | |
| 744 | + rs.put("status", ResponseCode.ERROR); | |
| 745 | + rs.put("msg", "车辆 " + clZbh + " 不存在!"); | |
| 746 | + return rs; | |
| 747 | + } else if (!sch.getGsBm().equals(BasicData.nbbm2CompanyCodeMap.get(clZbh))) { | |
| 748 | + rs.put("status", ResponseCode.ERROR); | |
| 749 | + rs.put("msg", sch.getXlName() + "所属的公司编码下找不到自编号为【" + clZbh + "】的车辆"); | |
| 750 | + return rs; | |
| 751 | + } | |
| 752 | + } | |
| 753 | + | |
| 754 | + SysUser user = SecurityUtils.getCurrentUser(); | |
| 755 | + String schDate = DayOfSchedule.currSchDateMap.get(sch.getXlBm()); | |
| 756 | + | |
| 757 | + SimpleDateFormat sdfyyyyMMdd = new SimpleDateFormat("yyyy-MM-dd"), sdfyyyyMMddHHmm = new SimpleDateFormat("yyyy-MM-ddHH:mm"); | |
| 758 | + | |
| 759 | + if (StringUtils.isEmpty(sch.getjGh())) { | |
| 760 | + rs.put("status", ResponseCode.ERROR); | |
| 761 | + rs.put("msg", "驾驶员工号不能为空!"); | |
| 762 | + return rs; | |
| 763 | + } | |
| 764 | + //截取驾驶员工号 | |
| 765 | + if (sch.getjGh().indexOf("-") != -1) { | |
| 766 | + sch.setjGh(sch.getjGh().split("-")[1]); | |
| 767 | + } | |
| 768 | + //检查驾驶员工号 | |
| 769 | + String jName = getPersonName(sch.getGsBm(), sch.getjGh()); | |
| 770 | + if (StringUtils.isEmpty(jName)) { | |
| 771 | + rs.put("msg", sch.getXlName() + "所属的公司编码下找不到工号为【" + sch.getjGh() + "】的驾驶员"); | |
| 772 | + rs.put("status", ResponseCode.ERROR); | |
| 773 | + return rs; | |
| 774 | + } else if (StringUtils.isEmpty(sch.getjName())) { | |
| 775 | + sch.setjName(jName);//补上驾驶员名称 | |
| 776 | + } | |
| 777 | + | |
| 778 | + //有售票员 | |
| 779 | + if (StringUtils.isNotEmpty(sch.getsGh())) { | |
| 780 | + String sName = getPersonName(sch.getGsBm(), sch.getsGh()); | |
| 781 | + if (StringUtils.isEmpty(sName)) { | |
| 782 | + rs.put("msg", sch.getXlName() + "所属的公司编码下找不到工号为【" + sch.getjGh() + "】的售票员"); | |
| 783 | + rs.put("status", ResponseCode.ERROR); | |
| 784 | + return rs; | |
| 785 | + } else if (StringUtils.isEmpty(sch.getsName())) { | |
| 786 | + sch.setsName(sName);//补上售票员名称 | |
| 787 | + } | |
| 788 | + } else { | |
| 789 | + sch.setsGh(""); | |
| 790 | + sch.setsName(""); | |
| 791 | + } | |
| 792 | + | |
| 793 | + //公司 和 分公司名称 | |
| 794 | + sch.setGsName(BasicData.businessCodeNameMap.get(sch.getGsBm())); | |
| 795 | + sch.setFgsName(BasicData.businessFgsCodeNameMap.get(sch.getFgsBm() + "_" + sch.getGsBm())); | |
| 796 | + sch.setCreateDate(new Date()); | |
| 797 | + sch.setScheduleDateStr(schDate); | |
| 798 | + sch.setScheduleDate(sdfyyyyMMdd.parse(schDate)); | |
| 799 | + sch.setRealExecDate(schDate); | |
| 800 | + | |
| 801 | + sch.setCreateBy(user); | |
| 802 | + sch.setSflj(true); | |
| 803 | + sch.setLate(false); | |
| 804 | + sch.setDfsj(sch.getFcsj()); | |
| 805 | + sch.setZdsjT(sdfyyyyMMddHHmm.parse(schDate + sch.getZdsj()).getTime()); | |
| 806 | + sch.setJhlcOrig(sch.getJhlc()); | |
| 807 | + sch.setCreateDate(new Date()); | |
| 808 | + sch.setUpdateDate(new Date()); | |
| 809 | + sch.setSpId(-1L); | |
| 810 | + //起终点名称 | |
| 811 | + String prefix = sch.getXlBm() + "_" + sch.getXlDir() + "_"; | |
| 812 | + sch.setQdzName(BasicData.getStationNameByCode(sch.getQdzCode(), prefix)); | |
| 813 | + sch.setZdzName(BasicData.getStationNameByCode(sch.getZdzCode(), prefix)); | |
| 814 | + | |
| 815 | + //计算班次实际执行时间 | |
| 816 | + schAttrCalculator.calcRealDate(sch).calcAllTimeByFcsj(sch); | |
| 817 | + | |
| 818 | + //处理计达跨24点 | |
| 819 | + LineConfig conf = lineConfigData.get(sch.getXlBm()); | |
| 820 | + if (sch.getZdsj().compareTo(conf.getStartOpt()) < 0) { | |
| 821 | + sch.setZdsjT(sdfyyyyMMddHHmm.parse(sch.getScheduleDateStr() + sch.getZdsj()).getTime() + (1000 * 60 * 60 * 24)); | |
| 822 | + } | |
| 823 | + | |
| 824 | + //班次历时 | |
| 825 | + sch.setBcsj((int) ((sch.getZdsjT() - sch.getDfsjT()) / 1000 / 60)); | |
| 826 | + if (sch.getZdsjT() < sch.getFcsjT()) { | |
| 827 | + rs.put("status", ResponseCode.ERROR); | |
| 828 | + rs.put("msg", "起终点时间异常!"); | |
| 829 | + return rs; | |
| 830 | + } | |
| 831 | + | |
| 832 | + sch.setId(dayOfSchedule.getId()); | |
| 833 | + //实时入库 | |
| 834 | + super.save(sch); | |
| 835 | + | |
| 836 | + // 加入缓存 | |
| 837 | + dayOfSchedule.put(sch); | |
| 838 | + | |
| 839 | + //更新起点应到时间 | |
| 840 | + List<ScheduleRealInfo> ts = dayOfSchedule.updateQdzTimePlan(sch); | |
| 841 | + | |
| 842 | + //重新计算车辆当前执行班次 | |
| 843 | + dayOfSchedule.reCalcExecPlan(sch.getClZbh()); | |
| 844 | + | |
| 845 | + //记录站到场历时数据 | |
| 846 | + Station2ParkBuffer.put(sch); | |
| 847 | + | |
| 848 | + rs.put("ts", ts); | |
| 849 | + rs.put("t", sch); | |
| 850 | + } catch (Exception e) { | |
| 851 | + logger.error("", e); | |
| 852 | + rs.put("status", ResponseCode.ERROR); | |
| 853 | + } | |
| 854 | + return rs; | |
| 855 | + } | |
| 856 | + | |
| 857 | + /** | |
| 858 | + * 删除历史表临加班次 | |
| 859 | + * | |
| 860 | + * @param id | |
| 861 | + * @return | |
| 862 | + */ | |
| 863 | + @Override | |
| 864 | + public Map<String, Object> deleteToHistory(Long id) { | |
| 865 | + Map<String, Object> rs = new HashMap<>(); | |
| 866 | + rs.put("status", ResponseCode.ERROR); | |
| 867 | + | |
| 868 | + try { | |
| 869 | + ScheduleRealInfo sch = super.findById(id); | |
| 870 | + if (sch == null) { | |
| 871 | + rs.put("msg", "无效的id号"); | |
| 872 | + return rs; | |
| 873 | + } | |
| 874 | + | |
| 875 | + if (!sch.isSflj()) { | |
| 876 | + rs.put("msg", "你只能删除临加班次"); | |
| 877 | + return rs; | |
| 878 | + } | |
| 879 | + | |
| 880 | + //解除和调度指令的外键约束 | |
| 881 | + jdbcTemplate.update(Constants.REMOVE_DIRECTIVE_SCH_FK, id); | |
| 882 | + | |
| 883 | + //数据库删除 | |
| 884 | + rs = super.delete(id); | |
| 885 | + } catch (Exception e) { | |
| 886 | + logger.error("", e); | |
| 887 | + rs.put("msg", e.getMessage()); | |
| 888 | + } | |
| 889 | + | |
| 890 | + return rs; | |
| 891 | + } | |
| 892 | + | |
| 893 | + @Override | |
| 894 | + public Map<String, Object> delete(Long id) { | |
| 895 | + Map<String, Object> rs = new HashMap<>(); | |
| 896 | + rs.put("status", ResponseCode.ERROR); | |
| 897 | + | |
| 898 | + ScheduleRealInfo sch = null; | |
| 899 | + try { | |
| 900 | + sch = dayOfSchedule.get(id); | |
| 901 | + if (sch == null) { | |
| 902 | + rs.put("msg", "无效的id号"); | |
| 903 | + return rs; | |
| 904 | + } | |
| 905 | + | |
| 906 | + if (!sch.isSflj()) { | |
| 907 | + rs.put("msg", "你只能删除临加班次"); | |
| 908 | + return rs; | |
| 909 | + } | |
| 910 | + | |
| 911 | + sch.setDeleted(true); | |
| 912 | + //解除和调度指令的外键约束 | |
| 913 | + jdbcTemplate.update(Constants.REMOVE_DIRECTIVE_SCH_FK, id); | |
| 914 | + | |
| 915 | + //数据库删除 | |
| 916 | + rs = super.delete(id); | |
| 917 | + if (rs.get("status").equals(ResponseCode.SUCCESS)) { | |
| 918 | + dayOfSchedule.delete(sch); | |
| 919 | + //更新起点应到时间 | |
| 920 | + List<ScheduleRealInfo> ts = dayOfSchedule.updateQdzTimePlan(sch); | |
| 921 | + rs.put("ts", ts); | |
| 922 | + rs.put("delete", sch); | |
| 923 | + } else | |
| 924 | + sch.setDeleted(false); | |
| 925 | + } catch (Exception e) { | |
| 926 | + logger.error("", e); | |
| 927 | + rs.put("msg", e.getMessage()); | |
| 928 | + sch.setDeleted(false); | |
| 929 | + } | |
| 930 | + | |
| 931 | + return rs; | |
| 932 | + } | |
| 933 | + | |
| 934 | + @Override | |
| 935 | + public List<Map<String, String>> sreachVehic(String nbbm) { | |
| 936 | + // 转大写 | |
| 937 | + nbbm = nbbm.toUpperCase(); | |
| 938 | + | |
| 939 | + List<Map<String, String>> list = new ArrayList<>(); | |
| 940 | + Map<String, String> map; | |
| 941 | + Set<String> allSet = BasicData.nbbm2CompanyCodeMap.keySet(); | |
| 942 | + | |
| 943 | + Line line; | |
| 944 | + for (String k : allSet) { | |
| 945 | + if (k.indexOf(nbbm) != -1) { | |
| 946 | + // 所属线路 | |
| 947 | + map = new HashMap<>(); | |
| 948 | + line = BasicData.nbbm2LineMap.get(k); | |
| 949 | + map.put("id", k); | |
| 950 | + map.put("text", k); | |
| 951 | + if (null != line) { | |
| 952 | + map.put("lineName", line.getName()); | |
| 953 | + map.put("lineCode", line.getLineCode()); | |
| 954 | + } | |
| 955 | + | |
| 956 | + list.add(map); | |
| 957 | + } | |
| 958 | + | |
| 959 | + if (list.size() > 20) | |
| 960 | + break; | |
| 961 | + } | |
| 962 | + return list; | |
| 963 | + } | |
| 964 | + | |
| 965 | + @Override | |
| 966 | + public void adjustCar(ScheduleRealInfo schedule, String car) { | |
| 967 | + schedule.setClZbh(car); | |
| 968 | + } | |
| 969 | + | |
| 970 | + @Override | |
| 971 | + public void adjustDriver(ScheduleRealInfo schedule, String driver, String driverName) { | |
| 972 | + if (driver.indexOf("-") != -1) | |
| 973 | + driver = driver.split("-")[1]; | |
| 974 | + schedule.setjGh(driver); | |
| 975 | + schedule.setjName(driverName); | |
| 976 | + } | |
| 977 | + | |
| 978 | + @Override | |
| 979 | + public void adjustConductor(ScheduleRealInfo schedule, String conductor, String conductorName) { | |
| 980 | + if (conductor.indexOf("-") != -1) | |
| 981 | + conductor = conductor.split("-")[1]; | |
| 982 | + schedule.setsGh(conductor); | |
| 983 | + schedule.setsName(conductorName); | |
| 984 | + } | |
| 985 | + | |
| 986 | + @Override | |
| 987 | + public List<ScheduleRealInfo> queryUserInfo(String line, String date, String state) { | |
| 988 | + List<ScheduleRealInfo> scheduleRealInfos = new ArrayList<>(); | |
| 989 | + List<Object[]> objects = null; | |
| 990 | + if (state.equals("2")) { | |
| 991 | + objects = scheduleRealInfoRepository.queryUserInfo2(line, date); | |
| 992 | + for (Object[] objs : objects) { | |
| 993 | + ScheduleRealInfo scheduleRealInfo = new ScheduleRealInfo(); | |
| 994 | + scheduleRealInfo.setId((Long)objs[0]); | |
| 995 | + scheduleRealInfo.setjGh((String)objs[1]); | |
| 996 | + scheduleRealInfo.setClZbh((String)objs[2]); | |
| 997 | + scheduleRealInfo.setLpName((String)objs[3]); | |
| 998 | + scheduleRealInfo.setjName((String)objs[4]); | |
| 999 | + | |
| 1000 | + scheduleRealInfos.add(scheduleRealInfo); | |
| 1001 | + } | |
| 1002 | + } else { | |
| 1003 | + objects = scheduleRealInfoRepository.queryUserInfo3(line, date); | |
| 1004 | + for (Object[] objs : objects) { | |
| 1005 | + ScheduleRealInfo scheduleRealInfo = new ScheduleRealInfo(); | |
| 1006 | + scheduleRealInfo.setId((Long)objs[0]); | |
| 1007 | + scheduleRealInfo.setClZbh((String)objs[1]); | |
| 1008 | + | |
| 1009 | + scheduleRealInfos.add(scheduleRealInfo); | |
| 1010 | + } | |
| 1011 | + } | |
| 1012 | + | |
| 1013 | + return scheduleRealInfos; | |
| 1014 | + } | |
| 1015 | + | |
| 1016 | + @Override | |
| 1017 | + public List<ScheduleRealInfo> queryUserInfoPx(String line, String date, String state, String type) { | |
| 1018 | +// List<ScheduleRealInfo> list=new ArrayList<ScheduleRealInfo>(); | |
| 1019 | + state = state + ""; | |
| 1020 | + String lpname = state; | |
| 1021 | + String px = type; | |
| 1022 | + if (state.equals("lpName")) { | |
| 1023 | + state = state + "+1"; | |
| 1024 | + type = "ASC"; | |
| 1025 | + } | |
| 1026 | + String minfcsj = "02:00"; | |
| 1027 | + List<Line> lineList = lineRepository.findLineByCode(line); | |
| 1028 | + if (lineList.size() > 0) { | |
| 1029 | + String sqlMinYysj = "select start_opt from bsth_c_line_config where " | |
| 1030 | + + " id = (" | |
| 1031 | + + "select max(id) from bsth_c_line_config where line ='" + lineList.get(0).getId() + "'" | |
| 1032 | + + ")"; | |
| 1033 | + minfcsj = jdbcTemplate.queryForObject(sqlMinYysj, String.class); | |
| 1034 | + } | |
| 1035 | + String sqlPlan = "select * from (select * from (" | |
| 1036 | + + " select min(s.id) as id,s.j_Gh as jGh,s.cl_Zbh as clZbh, " | |
| 1037 | + + " s.lp_Name as lpName,min(s.j_Name) as jName,max(s.schedule_date_str) as dateStr ," | |
| 1038 | + + " min(s.fcsj) as fcsj,1 as px from bsth_c_s_sp_info_real s where " | |
| 1039 | + + " s.xl_Bm = '" + line + "' and s.schedule_date_str ='" + date + "'" | |
| 1040 | + + " GROUP BY s.j_Gh,s.cl_Zbh,s.lp_Name) x where x.fcsj >'" + minfcsj + "'" | |
| 1041 | + + " UNION " | |
| 1042 | + + " select * from ( select min(s.id) as id,s.j_Gh as jGh,s.cl_Zbh as clZbh, " | |
| 1043 | + + " s.lp_Name as lpName,min(s.j_Name) as jName, max(s.schedule_date_str) as dateStr," | |
| 1044 | + + " min(s.fcsj) as fcsj,2 as px from bsth_c_s_sp_info_real s " | |
| 1045 | + + " where s.xl_Bm = '" + line + "' and s.schedule_date_str ='" + date + "'" | |
| 1046 | + + " GROUP BY s.j_Gh,s.cl_Zbh,s.lp_Name" | |
| 1047 | + + " ) y where y.fcsj <='" + minfcsj + "') z order by (" + state + "),dateStr,px,fcsj " + type; | |
| 1048 | + List<ScheduleRealInfo> list = jdbcTemplate.query(sqlPlan, | |
| 1049 | + new RowMapper<ScheduleRealInfo>() { | |
| 1050 | + @Override | |
| 1051 | + public ScheduleRealInfo mapRow(ResultSet rs, int rowNum) throws SQLException { | |
| 1052 | + ScheduleRealInfo t = new ScheduleRealInfo(); | |
| 1053 | + t.setId(rs.getLong("id")); | |
| 1054 | + t.setjGh(rs.getString("jGh")); | |
| 1055 | + t.setClZbh(rs.getString("clZbh")); | |
| 1056 | + t.setLpName(rs.getString("lpName")); | |
| 1057 | + t.setjName(rs.getString("jName")); | |
| 1058 | + t.setFcsj(rs.getString("fcsj")); | |
| 1059 | + return t; | |
| 1060 | + } | |
| 1061 | + }); | |
| 1062 | + if (lpname.equals("lpName")) { | |
| 1063 | + | |
| 1064 | + List<ScheduleRealInfo> listNew = new ArrayList<ScheduleRealInfo>(); | |
| 1065 | + Pattern pattern = Pattern.compile("^[-\\+]?[\\d]*$"); | |
| 1066 | +// if (px.equals("desc")) { | |
| 1067 | + int zt = 0; | |
| 1068 | + for (int l = 0; l < 2; l++) { | |
| 1069 | + for (int i = 0; i < list.size(); i++) { | |
| 1070 | + ScheduleRealInfo t = list.get(i); | |
| 1071 | + if (t.getLpName().indexOf("+") != -1) { | |
| 1072 | + if (zt == 0) { | |
| 1073 | + listNew.add(t); | |
| 1074 | + } | |
| 1075 | + } else if (pattern.matcher(t.getLpName()).matches()) { | |
| 1076 | + if (zt == 1) { | |
| 1077 | + listNew.add(t); | |
| 1078 | + } | |
| 1079 | + } else { | |
| 1080 | + continue; | |
| 1081 | + } | |
| 1082 | + } | |
| 1083 | + zt++; | |
| 1084 | + } | |
| 1085 | + | |
| 1086 | + Collections.sort(list, new ComparableLp()); | |
| 1087 | + for (int i = 0; i < list.size(); i++) { | |
| 1088 | + ScheduleRealInfo t = list.get(i); | |
| 1089 | + if (t.getLpName().indexOf("+") != -1) { | |
| 1090 | + continue; | |
| 1091 | + } else if (pattern.matcher(t.getLpName()).matches()) { | |
| 1092 | + continue; | |
| 1093 | + } else { | |
| 1094 | + listNew.add(t); | |
| 1095 | + } | |
| 1096 | + } | |
| 1097 | + return listNew; | |
| 1098 | + } else { | |
| 1099 | + return list; | |
| 1100 | + } | |
| 1101 | + | |
| 1102 | + } | |
| 1103 | + | |
| 1104 | + /** | |
| 1105 | + * | |
| 1106 | + */ | |
| 1107 | + @Override | |
| 1108 | + public List<ScheduleRealInfo> exportWaybill(String jName,String jGh, String clZbh, String lpName, String date, String line) { | |
| 1109 | + ReportUtils ee = new ReportUtils(); | |
| 1110 | + ReportRelatedUtils rru = new ReportRelatedUtils(); | |
| 1111 | + List<Iterator<?>> list = new ArrayList<Iterator<?>>(); | |
| 1112 | + List<ScheduleRealInfo> scheduleRealInfos = scheduleRealInfoRepository.queryListWaybillXcld(jGh, clZbh, lpName, date, line); | |
| 1113 | + List<Map<String, Object>> listMap = new ArrayList<Map<String, Object>>(); | |
| 1114 | +// List<ScheduleRealInfo> scheduleRealInfos=scheduleRealInfoRepository.queryListWaybillXcld(jName, clZbh, lpName, date, line); | |
| 1115 | + List<ScheduleRealInfo> lists = new ArrayList<ScheduleRealInfo>(); | |
| 1116 | + for (int i = 0; i < scheduleRealInfos.size(); i++) { | |
| 1117 | + ScheduleRealInfo s = scheduleRealInfos.get(i); | |
| 1118 | + Set<ChildTaskPlan> cts = s.getcTasks(); | |
| 1119 | + if (cts != null && cts.size() > 0) { | |
| 1120 | + lists.add(s); | |
| 1121 | + } else { | |
| 1122 | + if (s.getZdsjActual() != null && s.getFcsjActual() != null) { | |
| 1123 | + lists.add(s); | |
| 1124 | + } | |
| 1125 | + } | |
| 1126 | + } | |
| 1127 | + DecimalFormat format = new DecimalFormat("0.00"); | |
| 1128 | +// int cjbc = scheduleRealInfoRepository.findCjbc(jName, clZbh, lpName); | |
| 1129 | +// int ljbc = scheduleRealInfoRepository.findLjbc(jName, clZbh, lpName); | |
| 1130 | + //计算里程和班次数,并放入Map里 | |
| 1131 | + Map<String, Object> map = this.MapById(scheduleRealInfos.get(0).getId()); | |
| 1132 | + | |
| 1133 | + map.put("jhlc", Arith.add(culateMieageService.culateJhgl(scheduleRealInfos), culateMieageService.culateJhJccgl(scheduleRealInfos))); | |
| 1134 | + map.put("remMileage", culateMieageService.culateLbgl(scheduleRealInfos)); | |
| 1135 | + map.put("addMileage", culateMieageService.culateLjgl(lists)); | |
| 1136 | + double yygl = Arith.add(culateMieageService.culateSjgl(lists), culateMieageService.culateLjgl(lists)); | |
| 1137 | + map.put("yygl", yygl); | |
| 1138 | + double ksgl = Arith.add(culateMieageService.culateKsgl(scheduleRealInfos), culateMieageService.culateJccgl(lists)); | |
| 1139 | + map.put("ksgl", ksgl); | |
| 1140 | + map.put("realMileage", Arith.add(yygl, ksgl)); | |
| 1141 | + map.put("jhbc", culateMieageService.culateJhbc(scheduleRealInfos, "")); | |
| 1142 | + map.put("cjbc", culateMieageService.culateLbbc(scheduleRealInfos)); | |
| 1143 | + map.put("ljbc", culateMieageService.culateLjbc(lists, "")); | |
| 1144 | + int sjbc = culateMieageService.culateLjbc(lists, "") + culateMieageService.culateSjbc(lists, ""); | |
| 1145 | + map.put("sjbc", sjbc); | |
| 1146 | +// map=new HashMap<String,Object>(); | |
| 1147 | + | |
| 1148 | + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm"); | |
| 1149 | + String minfcsj = "02:00"; | |
| 1150 | + List<Line> lineList = lineRepository.findLineByCode(line); | |
| 1151 | + if (lineList.size() > 0) { | |
| 1152 | + String sqlMinYysj = "select start_opt from bsth_c_line_config where " | |
| 1153 | + + " id = (" | |
| 1154 | + + "select max(id) from bsth_c_line_config where line ='" + lineList.get(0).getId() + "'" | |
| 1155 | + + ")"; | |
| 1156 | + minfcsj = jdbcTemplate.queryForObject(sqlMinYysj, String.class); | |
| 1157 | + } | |
| 1158 | + String[] minSjs = minfcsj.split(":"); | |
| 1159 | + Long minSj = Long.parseLong(minSjs[0]) * 60 + Long.parseLong(minSjs[1]); | |
| 1160 | + | |
| 1161 | + | |
| 1162 | + for (int i = 0; i < scheduleRealInfos.size(); i++) { | |
| 1163 | + ScheduleRealInfo s = scheduleRealInfos.get(i); | |
| 1164 | + String[] fcsj = s.getFcsj().split(":"); | |
| 1165 | + Long fcsjL = Long.parseLong(fcsj[0]) * 60 + Long.parseLong(fcsj[1]); | |
| 1166 | + | |
| 1167 | + Long fscjT = 0L; | |
| 1168 | + if (fcsjL < minSj) { | |
| 1169 | + Calendar calendar = new GregorianCalendar(); | |
| 1170 | + calendar.setTime(s.getScheduleDate()); | |
| 1171 | + calendar.add(calendar.DATE, 1); | |
| 1172 | + s.setScheduleDate(calendar.getTime()); | |
| 1173 | + try { | |
| 1174 | + fscjT = sdf.parse(sdf.format(s.getScheduleDate()) + " " + s.getFcsj()).getTime(); | |
| 1175 | + } catch (ParseException e) { | |
| 1176 | + // TODO Auto-generated catch block | |
| 1177 | + e.printStackTrace(); | |
| 1178 | + } | |
| 1179 | + | |
| 1180 | + } else { | |
| 1181 | + try { | |
| 1182 | + fscjT = sdf.parse(s.getScheduleDateStr() + " " + s.getFcsj()).getTime(); | |
| 1183 | + } catch (ParseException e) { | |
| 1184 | + // TODO Auto-generated catch block | |
| 1185 | + e.printStackTrace(); | |
| 1186 | + } | |
| 1187 | + ; | |
| 1188 | + } | |
| 1189 | + s.setFcsjT(fscjT); | |
| 1190 | + } | |
| 1191 | + List<ScheduleRealInfo> listSchedule = new ArrayList<ScheduleRealInfo>(); | |
| 1192 | + Collections.sort(scheduleRealInfos, new ComparableReal()); | |
| 1193 | + for (int i = 0; i < scheduleRealInfos.size(); i++) { | |
| 1194 | + ScheduleRealInfo s = scheduleRealInfos.get(i); | |
| 1195 | + s.setAdjustExps(i + 1 + ""); | |
| 1196 | + String remarks = ""; | |
| 1197 | + if (s.getRemarks() != null) { | |
| 1198 | + remarks += s.getRemarks(); | |
| 1199 | + } | |
| 1200 | + | |
| 1201 | + Set<ChildTaskPlan> childTaskPlans = s.getcTasks(); | |
| 1202 | + if (!childTaskPlans.isEmpty()) { | |
| 1203 | + s.setFcsjActual(""); | |
| 1204 | + s.setZdsjActual(""); | |
| 1205 | + s.setJhlc(0.0); | |
| 1206 | + } | |
| 1207 | + | |
| 1208 | + if (s.isDestroy()) { | |
| 1209 | + s.setFcsjActual(""); | |
| 1210 | + s.setZdsjActual(""); | |
| 1211 | + s.setJhlc(0.0); | |
| 1212 | + remarks += "(烂班)"; | |
| 1213 | + s.setRemarks(remarks); | |
| 1214 | + } | |
| 1215 | + | |
| 1216 | + listSchedule.add(s); | |
| 1217 | + //计算营运里程,空驶里程 | |
| 1218 | + if (!childTaskPlans.isEmpty()) { | |
| 1219 | +// Iterator<ChildTaskPlan> it = childTaskPlans.iterator(); | |
| 1220 | + List<ChildTaskPlan> listit = new ArrayList<ChildTaskPlan>(childTaskPlans); | |
| 1221 | + Collections.sort(listit, new ComparableChild()); | |
| 1222 | + for (int j = 0; j < listit.size(); j++) { | |
| 1223 | + ScheduleRealInfo t = new ScheduleRealInfo(); | |
| 1224 | + ChildTaskPlan childTaskPlan = listit.get(j); | |
| 1225 | + if (childTaskPlan.isDestroy()) { | |
| 1226 | + t.setFcsjActual(""); | |
| 1227 | + t.setZdsjActual(""); | |
| 1228 | + t.setJhlc(0.0); | |
| 1229 | + } else { | |
| 1230 | + t.setFcsjActual(childTaskPlan.getStartDate()); | |
| 1231 | + t.setZdsjActual(childTaskPlan.getEndDate()); | |
| 1232 | + t.setJhlc(Double.parseDouble(String.valueOf(childTaskPlan.getMileage()))); | |
| 1233 | + } | |
| 1234 | + t.setQdzName(childTaskPlan.getStartStationName()); | |
| 1235 | + t.setZdzName(childTaskPlan.getEndStationName()); | |
| 1236 | + t.setRemarks(childTaskPlan.getRemarks()); | |
| 1237 | + t.setAdjustExps("子"); | |
| 1238 | + t.setjGh(""); | |
| 1239 | + t.setjName(""); | |
| 1240 | + t.setsGh(""); | |
| 1241 | + t.setsName(""); | |
| 1242 | + listSchedule.add(t); | |
| 1243 | + } | |
| 1244 | + } | |
| 1245 | + } | |
| 1246 | + Map<String, Object> maps; | |
| 1247 | + for (ScheduleRealInfo scheduleRealInfo : listSchedule) { | |
| 1248 | + maps = new HashMap<String, Object>(); | |
| 1249 | + try { | |
| 1250 | + scheduleRealInfo.setjName(scheduleRealInfo.getjGh() + scheduleRealInfo.getjName()); | |
| 1251 | + scheduleRealInfo.setsName(scheduleRealInfo.getsGh() + scheduleRealInfo.getsName()); | |
| 1252 | + maps = rru.getMapValue(scheduleRealInfo); | |
| 1253 | + maps.put("bcs", scheduleRealInfo.getAdjustExps()); | |
| 1254 | + String zdsj = scheduleRealInfo.getZdsj(); | |
| 1255 | + String zdsjActual = scheduleRealInfo.getZdsjActual(); | |
| 1256 | + if (zdsj != null && zdsjActual != null && | |
| 1257 | + !zdsj.equals(zdsjActual) && | |
| 1258 | + !zdsj.equals("") && | |
| 1259 | + !zdsjActual.equals("")) { | |
| 1260 | + int zdsjT = Integer.valueOf(zdsj.split(":")[0]) * 60 + Integer.valueOf(zdsj.split(":")[1]); | |
| 1261 | + int zdsjAT = Integer.valueOf(zdsjActual.split(":")[0]) * 60 + Integer.valueOf(zdsjActual.split(":")[1]); | |
| 1262 | + if (zdsj.compareTo(zdsjActual) > 0) { | |
| 1263 | + if (zdsjT - zdsjAT > 1000) { | |
| 1264 | + maps.put("fast", ""); | |
| 1265 | + maps.put("slow", zdsjAT - zdsjT + 1440); | |
| 1266 | + } else { | |
| 1267 | + maps.put("fast", TimeUtils.getTimeDifference(zdsj, zdsjActual)); | |
| 1268 | + maps.put("slow", ""); | |
| 1269 | + } | |
| 1270 | + } else { | |
| 1271 | + if (zdsjAT - zdsjT > 1000) { | |
| 1272 | + maps.put("fast", zdsjT - zdsjAT + 1440); | |
| 1273 | + maps.put("slow", ""); | |
| 1274 | + } else { | |
| 1275 | + maps.put("fast", ""); | |
| 1276 | + maps.put("slow", TimeUtils.getTimeDifference(zdsj, zdsjActual)); | |
| 1277 | + } | |
| 1278 | + } | |
| 1279 | + } else { | |
| 1280 | + maps.put("fast", ""); | |
| 1281 | + maps.put("slow", ""); | |
| 1282 | + } | |
| 1283 | + listMap.add(maps); | |
| 1284 | + } catch (Exception e) { | |
| 1285 | + e.printStackTrace(); | |
| 1286 | + } | |
| 1287 | + } | |
| 1288 | + | |
| 1289 | + String xls = ""; | |
| 1290 | + if (map.get("type").toString().equals("0")) { | |
| 1291 | + xls = "waybill_minhang.xls"; | |
| 1292 | + } else { | |
| 1293 | + xls = "waybill_minhang_dl.xls"; | |
| 1294 | + } | |
| 1295 | + | |
| 1296 | + | |
| 1297 | + String path = this.getClass().getResource("/").getPath() + "static/pages/forms/"; | |
| 1298 | + | |
| 1299 | + list.add(listMap.iterator()); | |
| 1300 | + ee.excelReplace(list, new Object[]{scheduleRealInfos.get(0), map}, path + "mould/" + xls, | |
| 1301 | + path + "export/" + date + "-" + jName + "-" + clZbh + "-" + lpName + "-行车路单.xls"); | |
| 1302 | + return scheduleRealInfos; | |
| 1303 | + } | |
| 1304 | + | |
| 1305 | + @Override | |
| 1306 | + public List<Map<String, Object>> dailyInfo(String line, String date, String type) { | |
| 1307 | + DecimalFormat format = new DecimalFormat("0.00"); | |
| 1308 | + ReportUtils ee = new ReportUtils(); | |
| 1309 | + List<Iterator<?>> listI = new ArrayList<Iterator<?>>(); | |
| 1310 | + List<Map<String, Object>> list = scheduleRealInfoRepository.dailyInfo(line, date); | |
| 1311 | + | |
| 1312 | + double totalZGL = 0, totalKSGL = 0, totalYH = 0; | |
| 1313 | + int totalBCS = 0; | |
| 1314 | + for (int i = 0; i < list.size(); i++) { | |
| 1315 | + String zgl = format.format(Double.parseDouble(list.get(i).get("zgl") == null ? "0" : list.get(i).get("zgl").toString())); | |
| 1316 | + String ksgl = format.format(Double.parseDouble(list.get(i).get("ksgl") == null ? "0" : list.get(i).get("ksgl").toString())); | |
| 1317 | + if (type.equals("export")) { | |
| 1318 | + totalZGL += Double.parseDouble(zgl); | |
| 1319 | + totalKSGL += Double.parseDouble(ksgl); | |
| 1320 | + totalBCS += Integer.parseInt(list.get(i).get("bcs").toString()); | |
| 1321 | + } | |
| 1322 | + list.get(i).put("zgl", zgl); | |
| 1323 | + list.get(i).put("ksgl", ksgl); | |
| 1324 | + } | |
| 1325 | + if (type.equals("export")) { | |
| 1326 | + Map<String, Object> map = new HashMap<String, Object>(); | |
| 1327 | + map.put("line", line); | |
| 1328 | + map.put("date", date); | |
| 1329 | + map.put("totalZGL", totalZGL); | |
| 1330 | + map.put("totalKSGL", totalKSGL); | |
| 1331 | + map.put("totalYH", totalYH); | |
| 1332 | + map.put("totalBCS", totalBCS); | |
| 1333 | + | |
| 1334 | + String path = this.getClass().getResource("/").getPath() + "static/pages/forms/"; | |
| 1335 | + | |
| 1336 | + listI.add(list.iterator()); | |
| 1337 | + try { | |
| 1338 | + ee.excelReplace(listI, new Object[]{map}, path + "mould/daily.xls", | |
| 1339 | + path + "export/班次日报" + sdfSimple.format(sdfMonth.parse(date)) + ".xls"); | |
| 1340 | + } catch (ParseException e) { | |
| 1341 | + e.printStackTrace(); | |
| 1342 | + } | |
| 1343 | + } | |
| 1344 | + return list; | |
| 1345 | + } | |
| 1346 | + | |
| 1347 | + @Override | |
| 1348 | + public List<Object[]> historyMessage(String line, String date, String code, String type) { | |
| 1349 | + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); | |
| 1350 | + | |
| 1351 | + long d = 0; | |
| 1352 | + long t = 0; | |
| 1353 | + if (date.length() > 0) { | |
| 1354 | + try { | |
| 1355 | + d = sdf.parse(date + " 00:00:00").getTime(); | |
| 1356 | + t = sdf.parse(date + " 23:59:59").getTime(); | |
| 1357 | + } catch (ParseException e) { | |
| 1358 | + // TODO Auto-generated catch block | |
| 1359 | + e.printStackTrace(); | |
| 1360 | + } | |
| 1361 | + | |
| 1362 | + } | |
| 1363 | + String device = ""; | |
| 1364 | + String device2 =""; | |
| 1365 | + long qyrqTime=0l; | |
| 1366 | + if (!code.equals("")) { | |
| 1367 | + try { | |
| 1368 | + List<CarDevice> deviceList=carDeviceRepository.findCarCode(code, sdf.parse(date+ " 00:00:00")); | |
| 1369 | + if(deviceList.size()>0){ | |
| 1370 | + device=deviceList.get(0).getOldDeviceNo(); | |
| 1371 | + Date qyrq=deviceList.get(0).getQyrq(); | |
| 1372 | + qyrqTime=qyrq.getTime(); | |
| 1373 | + if(qyrqTime<t){ | |
| 1374 | + device2=deviceList.get(0).getNewDeviceNo(); | |
| 1375 | + } | |
| 1376 | + }else{ | |
| 1377 | + device = BasicData.deviceId2NbbmMap.inverse().get(code); | |
| 1378 | + } | |
| 1379 | + } catch (ParseException e) { | |
| 1380 | + // TODO Auto-generated catch block | |
| 1381 | + e.printStackTrace(); | |
| 1382 | + } | |
| 1383 | + } | |
| 1384 | + List<Object[]> list=new ArrayList<Object[]>(); | |
| 1385 | + | |
| 1386 | + device = device.replaceAll("BF-", ""); | |
| 1387 | + List<Object[]> list0 =scheduleRealInfoRepository.historyMessage(line, device, d, t); | |
| 1388 | + for (Object[] obj : list0) { | |
| 1389 | + if (obj != null) { | |
| 1390 | + if(code.equals("")){ | |
| 1391 | + if (BasicData.deviceId2NbbmMap.get(obj[0].toString()) == null) { | |
| 1392 | + List<CarDevice> carDeviceList = new ArrayList<CarDevice>(); | |
| 1393 | + try { | |
| 1394 | + carDeviceList = carDeviceRepository.findCarDevice(obj[0].toString(), new Date(Long.parseLong(obj[3].toString()))); | |
| 1395 | + //启用日期大于营运日期 还是根据旧设备号查询 | |
| 1396 | + if(carDeviceList.size()==0){ | |
| 1397 | + carDeviceList = carDeviceRepository.findCarOldDevice(obj[0].toString(), new Date(Long.parseLong(obj[3].toString()))); | |
| 1398 | + } | |
| 1399 | + } catch (Exception e) { | |
| 1400 | + // TODO Auto-generated catch block | |
| 1401 | + e.printStackTrace(); | |
| 1402 | + } | |
| 1403 | + if (carDeviceList.size() > 0) { | |
| 1404 | + obj[0] = carDeviceList.get(0).getClZbh(); | |
| 1405 | + } else { | |
| 1406 | + obj[0] = BasicData.deviceId2NbbmMap.get(obj[0].toString()); | |
| 1407 | + } | |
| 1408 | + } else { | |
| 1409 | + obj[0] = BasicData.deviceId2NbbmMap.get(obj[0].toString()); | |
| 1410 | + } | |
| 1411 | + }else{ | |
| 1412 | + obj[0]=code; | |
| 1413 | + } | |
| 1414 | + | |
| 1415 | + obj[3] = sdf.format(new Date(Long.parseLong(obj[3].toString()))); | |
| 1416 | + obj[4] = BasicData.lineCode2NameMap.get(line); | |
| 1417 | + } | |
| 1418 | + } | |
| 1419 | + list.addAll(list0); | |
| 1420 | + if(!device2.equals("")){ | |
| 1421 | + device2.replaceAll("BF-", ""); | |
| 1422 | + List<Object[]> list1 =scheduleRealInfoRepository.historyMessage(line, device2, d, t); | |
| 1423 | + for (Object[] obj : list1) { | |
| 1424 | + if (obj != null) { | |
| 1425 | + obj[0] =code; | |
| 1426 | + obj[3] = sdf.format(new Date(Long.parseLong(obj[3].toString()))); | |
| 1427 | + obj[4] = BasicData.lineCode2NameMap.get(line); | |
| 1428 | + } | |
| 1429 | + } | |
| 1430 | + list.addAll(list1); | |
| 1431 | + } | |
| 1432 | + | |
| 1433 | + if (type != null && type.length() != 0 && type.equals("export")) { | |
| 1434 | + String lineName = BasicData.lineCode2NameMap.get(line); | |
| 1435 | + SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"), | |
| 1436 | + sdfSimple = new SimpleDateFormat("yyyyMMdd"); | |
| 1437 | + List<Iterator<?>> listI = new ArrayList<Iterator<?>>(); | |
| 1438 | + Map<String, Object> m = new HashMap<String, Object>(); | |
| 1439 | + ReportUtils ee = new ReportUtils(); | |
| 1440 | + List<Map<String, Object>> newList = new ArrayList<Map<String, Object>>(); | |
| 1441 | + for (int i = 0; i < list.size(); i++) { | |
| 1442 | + Map<String, Object> map = new HashMap<String, Object>(); | |
| 1443 | + Object[] obj = list.get(i); | |
| 1444 | + map.put("num", i + 1); | |
| 1445 | + map.put("line", obj[4]); | |
| 1446 | + map.put("clZbh", obj[0]); | |
| 1447 | + map.put("sender", obj[1]); | |
| 1448 | + map.put("date", obj[3]); | |
| 1449 | + map.put("text", obj[2]); | |
| 1450 | + map.put("reply46", "0".equals(obj[5]+"")?"是":""); | |
| 1451 | + map.put("reply47", "0".equals(obj[6]+"")?"是":""); | |
| 1452 | + newList.add(map); | |
| 1453 | + } | |
| 1454 | + try { | |
| 1455 | + listI.add(newList.iterator()); | |
| 1456 | + String path = this.getClass().getResource("/").getPath() + "static/pages/forms/"; | |
| 1457 | + ee.excelReplace(listI, new Object[]{m}, path + "mould/historyMessage.xls", | |
| 1458 | + path + "export/" + sdfSimple.format(sdfMonth.parse(date)) | |
| 1459 | + + "-" + lineName + "-调度历史消息.xls"); | |
| 1460 | + } catch (Exception e) { | |
| 1461 | + // TODO: handle exception | |
| 1462 | + e.printStackTrace(); | |
| 1463 | + } | |
| 1464 | + } | |
| 1465 | + | |
| 1466 | + if (type != null && type.length() != 0 && type.equals("export_msg")) { | |
| 1467 | + SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"), | |
| 1468 | + sdfSimple = new SimpleDateFormat("yyyyMMdd"); | |
| 1469 | + List<Iterator<?>> listI = new ArrayList<Iterator<?>>(); | |
| 1470 | + Map<String, Object> m = new HashMap<String, Object>(); | |
| 1471 | + ReportUtils ee = new ReportUtils(); | |
| 1472 | + List<Map<String, Object>> newList = new ArrayList<Map<String, Object>>(); | |
| 1473 | + for (int i = 0; i < list.size(); i++) { | |
| 1474 | + Map<String, Object> map = new HashMap<String, Object>(); | |
| 1475 | + Object[] obj = list.get(i); | |
| 1476 | + map.put("num", i + 1); | |
| 1477 | + map.put("line", obj[4]); | |
| 1478 | + map.put("clZbh", obj[0]); | |
| 1479 | + map.put("sender", obj[1]); | |
| 1480 | + map.put("date", obj[3]); | |
| 1481 | + map.put("text", obj[2]); | |
| 1482 | + newList.add(map); | |
| 1483 | + } | |
| 1484 | + try { | |
| 1485 | + listI.add(newList.iterator()); | |
| 1486 | + String path = this.getClass().getResource("/").getPath() + "static/pages/forms/"; | |
| 1487 | + ee.excelReplace(listI, new Object[]{m}, path + "mould/message.xls", | |
| 1488 | + path + "export/调度消息分析" + sdfSimple.format(sdfMonth.parse(date)) + ".xls"); | |
| 1489 | + } catch (Exception e) { | |
| 1490 | + // TODO: handle exception | |
| 1491 | + e.printStackTrace(); | |
| 1492 | + } | |
| 1493 | + } | |
| 1494 | + return list; | |
| 1495 | + } | |
| 1496 | + | |
| 1497 | + @Override | |
| 1498 | + public Map<Integer, Integer> trustStatus(String lineStr) { | |
| 1499 | + List<String> lineList = Lists.newArrayList(Splitter.on(',').trimResults().omitEmptyStrings().split(lineStr)); | |
| 1500 | + | |
| 1501 | + Map<Integer, Integer> map = new HashMap<>(); | |
| 1502 | + return map; | |
| 1503 | + } | |
| 1504 | + | |
| 1505 | + @Override | |
| 1506 | + public Map<String, Object> realOutAdjust(Map<String, String> map) { | |
| 1507 | + Map<String, Object> rs = new HashMap<>(); | |
| 1508 | + List<ScheduleRealInfo> ts = new ArrayList<>(); | |
| 1509 | + try { | |
| 1510 | + // 维修上报 | |
| 1511 | + if (StringUtils.isNotBlank(map.get("reportTypes"))) { | |
| 1512 | + Map<String, Object> param = new HashMap<String, Object>(); | |
| 1513 | + param.putAll(map); | |
| 1514 | + rs = repairReport(param, false); | |
| 1515 | + } | |
| 1516 | + | |
| 1517 | + Long id = Long.parseLong(map.get("id")); | |
| 1518 | + String remarks = map.get("remarks"), fcsjActual = map.get("fcsjActual"); | |
| 1519 | + | |
| 1520 | + ScheduleRealInfo sch = dayOfSchedule.get(id); | |
| 1521 | + | |
| 1522 | + LineConfig config = lineConfigData.get(sch.getXlBm()); | |
| 1523 | + //小于线路开始运营时间,则默认跨过24点 | |
| 1524 | + if (fcsjActual.compareTo(config.getStartOpt()) < 0) { | |
| 1525 | + sch.setRealExecDate(fmtyyyyMMdd.print(sch.getScheduleDate().getTime() + DAY_TIME)); | |
| 1526 | + } else { | |
| 1527 | + sch.setRealExecDate(sch.getScheduleDateStr()); | |
| 1528 | + } | |
| 1529 | + | |
| 1530 | + //日志记录 | |
| 1531 | + ScheduleModifyLogger.sftz(sch, fcsjActual, remarks); | |
| 1532 | + | |
| 1533 | + sch.setFcsjActualAll(fcsjActual); | |
| 1534 | + sch.setRemarks(remarks); | |
| 1535 | + sch.calcStatus(); | |
| 1536 | + //if(sch.isLate2()){ | |
| 1537 | + //取消应发未到标记 | |
| 1538 | + // sch.setLate2(false); | |
| 1539 | + LateAdjustHandle.remove(sch); | |
| 1540 | + //} | |
| 1541 | + | |
| 1542 | + dayOfSchedule.save(sch); | |
| 1543 | + | |
| 1544 | + ts.add(sch); | |
| 1545 | + | |
| 1546 | + rs.put("status", ResponseCode.SUCCESS); | |
| 1547 | + rs.put("ts", ts); | |
| 1548 | + | |
| 1549 | + //通知页面刷新 | |
| 1550 | + sendUtils.refreshSch(ts); | |
| 1551 | + } catch (Exception e) { | |
| 1552 | + logger.error("", e); | |
| 1553 | + rs.put("status", ResponseCode.ERROR); | |
| 1554 | + } | |
| 1555 | + | |
| 1556 | + return rs; | |
| 1557 | + } | |
| 1558 | + | |
| 1559 | + @Override | |
| 1560 | + public Map<String, Object> revokeDestroy(Long id) { | |
| 1561 | + Map<String, Object> rs = new HashMap<>(); | |
| 1562 | + try { | |
| 1563 | + ScheduleRealInfo sch = dayOfSchedule.get(id); | |
| 1564 | + if (sch.getStatus() != -1) { | |
| 1565 | + rs.put("status", ResponseCode.ERROR); | |
| 1566 | + rs.put("msg", "未烂班,无法撤销!"); | |
| 1567 | + } else { | |
| 1568 | + //日志记录 | |
| 1569 | + ScheduleModifyLogger.cxlb(sch); | |
| 1570 | + | |
| 1571 | + sch.setStatus(0); | |
| 1572 | + sch.setRemarks("");//清空备注 | |
| 1573 | + sch.setJhlc(sch.getJhlcOrig()); | |
| 1574 | + | |
| 1575 | + //入库 | |
| 1576 | + dayOfSchedule.save(sch); | |
| 1577 | + //重新计算当前执行班次 | |
| 1578 | + dayOfSchedule.reCalcExecPlan(sch.getClZbh()); | |
| 1579 | + rs.put("status", ResponseCode.SUCCESS); | |
| 1580 | + rs.put("t", sch); | |
| 1581 | + | |
| 1582 | + } | |
| 1583 | + } catch (Exception e) { | |
| 1584 | + logger.error("", e); | |
| 1585 | + rs.put("status", ResponseCode.ERROR); | |
| 1586 | + } | |
| 1587 | + return rs; | |
| 1588 | + } | |
| 1589 | + | |
| 1590 | + @Override | |
| 1591 | + public Map<String, Object> revokeRealOutgo(Long id) { | |
| 1592 | + Map<String, Object> rs = new HashMap<>(); | |
| 1593 | + List<ScheduleRealInfo> ts = new ArrayList<>(); | |
| 1594 | + | |
| 1595 | + try { | |
| 1596 | + ScheduleRealInfo sch = dayOfSchedule.get(id); | |
| 1597 | + if (sch.getFcsjActual() == null) { | |
| 1598 | + rs.put("status", ResponseCode.ERROR); | |
| 1599 | + rs.put("msg", "无实发时间,无法撤销!"); | |
| 1600 | + } else { | |
| 1601 | + //日志记录 | |
| 1602 | + ScheduleModifyLogger.cxsf(sch); | |
| 1603 | + | |
| 1604 | + sch.clearFcsjActual(); | |
| 1605 | + rs.put("status", ResponseCode.SUCCESS); | |
| 1606 | + | |
| 1607 | + ts.add(sch); | |
| 1608 | + rs.put("ts", ts); | |
| 1609 | + | |
| 1610 | + dayOfSchedule.save(sch); | |
| 1611 | + | |
| 1612 | + } | |
| 1613 | + } catch (Exception e) { | |
| 1614 | + logger.error("", e); | |
| 1615 | + rs.put("status", ResponseCode.ERROR); | |
| 1616 | + } | |
| 1617 | + return rs; | |
| 1618 | + } | |
| 1619 | + | |
| 1620 | + @Override | |
| 1621 | + public Map<String, Object> spaceAdjust(Long[] ids, Integer space) { | |
| 1622 | + | |
| 1623 | + List<ScheduleRealInfo> list = new ArrayList<>(), ts = new ArrayList<>(), tempTs = null; | |
| 1624 | + Map<String, Object> rs = new HashMap<>(), tempRs = new HashMap<>(); | |
| 1625 | + try { | |
| 1626 | + ScheduleRealInfo sch, next; | |
| 1627 | + for (Long id : ids) { | |
| 1628 | + sch = dayOfSchedule.get(id); | |
| 1629 | + if (null != sch) | |
| 1630 | + list.add(sch); | |
| 1631 | + } | |
| 1632 | + | |
| 1633 | + int size = list.size(); | |
| 1634 | + if (size == 0) { | |
| 1635 | + rs.put("status", ResponseCode.ERROR); | |
| 1636 | + } else { | |
| 1637 | + // 按发车时间排序 | |
| 1638 | + Collections.sort(list, new ScheduleComparator.FCSJ()); | |
| 1639 | + | |
| 1640 | + // 以第一个实际发车/待发时间为起点,调整间隔 | |
| 1641 | + sch = list.get(0); | |
| 1642 | + Long st = sch.getFcsjActualTime() == null ? sch.getDfsjT() : sch.getFcsjActualTime(), plus = space * 60 * 1000L; | |
| 1643 | + | |
| 1644 | + for (int i = 1; i < size; i++) { | |
| 1645 | + st += plus; | |
| 1646 | + sch = list.get(i); | |
| 1647 | + | |
| 1648 | + //调整待发 | |
| 1649 | + tempRs = outgoAdjust(sch.getId(), null, fmtHHmm.print(st), null, "3", null); | |
| 1650 | + | |
| 1651 | + if (null != tempRs && tempRs.get("ts") != null) | |
| 1652 | + tempTs = (List<ScheduleRealInfo>) tempRs.get("ts"); | |
| 1653 | + | |
| 1654 | + ts.addAll(tempTs); | |
| 1655 | + } | |
| 1656 | + | |
| 1657 | + rs.put("status", ResponseCode.SUCCESS); | |
| 1658 | + //返回最后一个班次,页面会全量刷新 | |
| 1659 | + rs.put("ts", ts); | |
| 1660 | + } | |
| 1661 | + | |
| 1662 | + } catch (Exception e) { | |
| 1663 | + logger.error("", e); | |
| 1664 | + rs.put("status", ResponseCode.ERROR); | |
| 1665 | + } | |
| 1666 | + return rs; | |
| 1667 | + } | |
| 1668 | + | |
| 1669 | + private static DateTimeFormatter fmtyyyyMMddHHmm = DateTimeFormat.forPattern("yyyy-MM-ddHH:mm"); | |
| 1670 | + | |
| 1671 | + @Transactional | |
| 1672 | + @Override | |
| 1673 | + public Map<String, Object> schInfoFineTune(Map<String, String> map) { | |
| 1674 | + Map<String, Object> rs = new HashMap<>(); | |
| 1675 | + List<ScheduleRealInfo> ts = new ArrayList<>(); | |
| 1676 | + try { | |
| 1677 | + // 维修上报 | |
| 1678 | + if (StringUtils.isNotBlank(map.get("reportTypes"))) { | |
| 1679 | + Map<String, Object> param = new HashMap<String, Object>(); | |
| 1680 | + param.putAll(map); | |
| 1681 | + rs = repairReport(param, false); | |
| 1682 | + } | |
| 1683 | + | |
| 1684 | + Long id = Long.parseLong(map.get("id")); | |
| 1685 | + String remarks = map.get("remarks"); | |
| 1686 | + | |
| 1687 | + ScheduleRealInfo sch = dayOfSchedule.get(id); | |
| 1688 | + | |
| 1689 | + if (null == sch) { | |
| 1690 | + rs.put("status", ResponseCode.ERROR); | |
| 1691 | + rs.put("msg", "不存在的班次!"); | |
| 1692 | + return rs; | |
| 1693 | + } | |
| 1694 | + | |
| 1695 | + //日志记录器 | |
| 1696 | + FcxxwtLogger fLog = FcxxwtLogger.start(sch, remarks); | |
| 1697 | + | |
| 1698 | + String clZbh = map.get("clZbh"); | |
| 1699 | + String jsy = map.get("jsy"); | |
| 1700 | + if (!clZbh.equals(sch.getClZbh()) | |
| 1701 | + || !jsy.equals(sch.getjGh() + "/" + sch.getjName())) | |
| 1702 | + schModifyLog.saveChangetochange(sch, clZbh, jsy);//为换人换车情况表写入数据 | |
| 1703 | + /** | |
| 1704 | + * 换车 | |
| 1705 | + */ | |
| 1706 | + if (StringUtils.isNotEmpty(clZbh) && !clZbh.equals(sch.getClZbh())) { | |
| 1707 | + //换车 | |
| 1708 | + if (!carExist(sch.getGsBm(), clZbh)) { | |
| 1709 | + rs.put("status", ResponseCode.ERROR); | |
| 1710 | + rs.put("msg", "车辆 " + clZbh + " 不存在!"); | |
| 1711 | + return rs; | |
| 1712 | + } else if (!sch.getGsBm().equals(BasicData.nbbm2CompanyCodeMap.get(clZbh))) { | |
| 1713 | + rs.put("status", ResponseCode.ERROR); | |
| 1714 | + rs.put("msg", sch.getXlName() + "所属的公司编码下找不到自编号为【" + clZbh + "】的车辆"); | |
| 1715 | + return rs; | |
| 1716 | + } else { | |
| 1717 | + fLog.log("换车", sch.getClZbh(), clZbh); | |
| 1718 | + dayOfSchedule.changeCar(sch, clZbh); | |
| 1719 | + } | |
| 1720 | + } | |
| 1721 | + | |
| 1722 | + if(StringUtils.isBlank(jsy) || "/".equals(StringUtils.trim(jsy))){ | |
| 1723 | + rs.put("status", ResponseCode.ERROR); | |
| 1724 | + rs.put("msg", "无效的参数【驾驶员】"); | |
| 1725 | + return rs; | |
| 1726 | + } | |
| 1727 | + | |
| 1728 | + /** | |
| 1729 | + * 换驾驶员 | |
| 1730 | + */ | |
| 1731 | + if (StringUtils.isNotEmpty(jsy)) { | |
| 1732 | + String jGh = jsy.split("/")[0]; | |
| 1733 | + String jName = getPersonName(sch.getGsBm(), jGh); | |
| 1734 | + if (StringUtils.isEmpty(jName)) { | |
| 1735 | + rs.put("msg", sch.getXlName() + "所属的公司编码下找不到工号为【" + jGh + "】的驾驶员"); | |
| 1736 | + rs.put("status", ResponseCode.ERROR); | |
| 1737 | + return rs; | |
| 1738 | + } else if (!jGh.equals(sch.getjGh())) { | |
| 1739 | + fLog.log("换驾驶员", sch.getjGh() + "/" + sch.getjName(), jsy); | |
| 1740 | + persoChange(sch, jGh); | |
| 1741 | + } | |
| 1742 | + } | |
| 1743 | + | |
| 1744 | + /** | |
| 1745 | + * 换售票员 | |
| 1746 | + */ | |
| 1747 | + String spy = map.get("spy"); | |
| 1748 | + if (StringUtils.isNotEmpty(spy) && !StringUtils.trim(spy).equals("/")) { | |
| 1749 | + String sGh = spy.split("/")[0]; | |
| 1750 | + | |
| 1751 | + String sName = getPersonName(sch.getGsBm(), sGh); | |
| 1752 | + if (StringUtils.isEmpty(sName)) { | |
| 1753 | + rs.put("msg", sch.getXlName() + "所属的公司编码下找不到工号为【" + sGh + "】的售票员"); | |
| 1754 | + rs.put("status", ResponseCode.ERROR); | |
| 1755 | + return rs; | |
| 1756 | + } else if (!sGh.equals(sch.getsGh())) { | |
| 1757 | + fLog.log("换售票员", sch.getsGh() + "/" + sch.getsName(), spy); | |
| 1758 | + persoChangeSPY(sch, sGh); | |
| 1759 | + } | |
| 1760 | + } else if (StringUtils.isNotEmpty(sch.getsGh())) { | |
| 1761 | + fLog.log("撤销售票员"); | |
| 1762 | + sch.setsGh(""); | |
| 1763 | + sch.setsName(""); | |
| 1764 | + } | |
| 1765 | + | |
| 1766 | + LineConfig config = lineConfigData.get(sch.getXlBm()); | |
| 1767 | + /** | |
| 1768 | + * 调整实发 | |
| 1769 | + */ | |
| 1770 | + String fcsjActual = map.get("fcsjActual"); | |
| 1771 | + if (StringUtils.isNotBlank(fcsjActual) | |
| 1772 | + && !fcsjActual.equals(sch.getFcsjActual())) { | |
| 1773 | + | |
| 1774 | + //long t = 0L; | |
| 1775 | + //小于线路开始运营时间,则默认跨过24点 | |
| 1776 | + long t = schAttrCalculator.getTime(sch.getScheduleDateStr(), fcsjActual, config); | |
| 1777 | + /* if (fcsjActual.compareTo(config.getStartOpt()) < 0) | |
| 1778 | + t = fmtyyyyMMddHHmm.parseMillis(fmtyyyyMMdd.print(sch.getScheduleDate().getTime() + DAY_TIME) + fcsjActual); | |
| 1779 | + else | |
| 1780 | + t = fmtyyyyMMddHHmm.parseMillis(sch.getScheduleDateStr() + fcsjActual);*/ | |
| 1781 | + | |
| 1782 | + fLog.log("调整实发时间", sch.getFcsjActual(), fcsjActual); | |
| 1783 | + sch.setFcsjActualAll(t); | |
| 1784 | + //取消应发未到标记 | |
| 1785 | + //if(sch.isLate2()){ | |
| 1786 | + // sch.setLate2(false); | |
| 1787 | + LateAdjustHandle.remove(sch); | |
| 1788 | + //} | |
| 1789 | + } else if (StringUtils.isNotEmpty(sch.getFcsjActual()) && StringUtils.isEmpty(fcsjActual)) { | |
| 1790 | + fLog.log("撤销实发时间", sch.getFcsjActual(), ""); | |
| 1791 | + //撤销实发 | |
| 1792 | + revokeRealOutgo(sch.getId()); | |
| 1793 | + } | |
| 1794 | + | |
| 1795 | + /** | |
| 1796 | + * 调整实达 | |
| 1797 | + */ | |
| 1798 | + String zdsjActual = map.get("zdsjActual"); | |
| 1799 | + if (StringUtils.isNotBlank(zdsjActual) | |
| 1800 | + && !zdsjActual.equals(sch.getZdsjActual())) { | |
| 1801 | + | |
| 1802 | + //调整实达 | |
| 1803 | + fLog.log("调整实达时间", sch.getZdsjActual(), zdsjActual); | |
| 1804 | + | |
| 1805 | + long t = schAttrCalculator.getTime(sch.getScheduleDateStr(), zdsjActual, config); | |
| 1806 | + sch.setZdsjActualAll(t); | |
| 1807 | + //路牌下一班起点到达时间 | |
| 1808 | + ScheduleRealInfo next = dayOfSchedule.nextByLp2(sch); | |
| 1809 | + if (null != next) { | |
| 1810 | + next.setQdzArrDatesj(zdsjActual); | |
| 1811 | + next.setLate2(false); | |
| 1812 | + ts.add(next); | |
| 1813 | + } | |
| 1814 | + | |
| 1815 | + //重新计算车辆执行班次 | |
| 1816 | + dayOfSchedule.reCalcExecPlan(sch.getClZbh()); | |
| 1817 | + //取消应发未到标记 | |
| 1818 | + LateAdjustHandle.remove(sch); | |
| 1819 | + } else if (StringUtils.isNotEmpty(sch.getZdsjActual()) && StringUtils.isEmpty(zdsjActual)) { | |
| 1820 | + //清除实达时间 | |
| 1821 | + fLog.log("撤销实达时间", sch.getZdsjActual(), ""); | |
| 1822 | + sch.clearZdsjActual(); | |
| 1823 | + //清除路牌下一班起点到达时间 | |
| 1824 | + ScheduleRealInfo next = dayOfSchedule.nextByLp(sch); | |
| 1825 | + if (null != next) { | |
| 1826 | + next.setQdzArrDatesj(null); | |
| 1827 | + ts.add(next); | |
| 1828 | + } | |
| 1829 | + //重新计算车辆执行班次 | |
| 1830 | + dayOfSchedule.reCalcExecPlan(sch.getClZbh()); | |
| 1831 | + } | |
| 1832 | + | |
| 1833 | + /** | |
| 1834 | + * 备注 | |
| 1835 | + */ | |
| 1836 | + sch.setRemarks(remarks); | |
| 1837 | + | |
| 1838 | + /** | |
| 1839 | + * 烂班 | |
| 1840 | + */ | |
| 1841 | + if (map.get("status") != null | |
| 1842 | + && Integer.parseInt(map.get("status").toString()) == -1) { | |
| 1843 | + destroy(sch.getId() + "", "", map.get("adjustExps").toString(), null); | |
| 1844 | + fLog.log("烂班"); | |
| 1845 | + } | |
| 1846 | + | |
| 1847 | + /** | |
| 1848 | + * 修改班次里程 | |
| 1849 | + */ | |
| 1850 | + String jhlc = map.get("jhlc"); | |
| 1851 | + if (StringUtils.isNotEmpty(jhlc)) { | |
| 1852 | + double jhlcNum = Double.parseDouble(jhlc); | |
| 1853 | + //烂班 | |
| 1854 | + if (jhlcNum == 0 && sch.getJhlcOrig() != 0 && !sch._isInout() && !sch.isDestroy()) { | |
| 1855 | + destroy(sch.getId() + "", "", map.get("adjustExps").toString(), null); | |
| 1856 | + fLog.log("里程设置为0,自动烂班"); | |
| 1857 | + } else if (jhlcNum != sch.getJhlc()) { | |
| 1858 | + fLog.log("设置里程", sch.getJhlc(), jhlcNum); | |
| 1859 | + sch.setJhlc(jhlcNum); | |
| 1860 | + //临加班次,实际计划一起改 | |
| 1861 | + if (sch.isSflj()) | |
| 1862 | + sch.setJhlcOrig(jhlcNum); | |
| 1863 | + } | |
| 1864 | + } | |
| 1865 | + | |
| 1866 | + /** | |
| 1867 | + * 修改班次类型 | |
| 1868 | + */ | |
| 1869 | + String bcType = map.get("bcType"); | |
| 1870 | + if (StringUtils.isNotEmpty(bcType) && !bcType.equals(sch.getBcType())) { | |
| 1871 | + fLog.log("修改班次类型", sch.getBcType(), bcType); | |
| 1872 | + sch.setBcType(bcType); | |
| 1873 | + } | |
| 1874 | + | |
| 1875 | + //重新计算班次状态 | |
| 1876 | + sch.calcStatus(); | |
| 1877 | + dayOfSchedule.save(sch); | |
| 1878 | + //页面需要更新的班次信息 | |
| 1879 | + ts.add(sch); | |
| 1880 | + | |
| 1881 | + rs.put("status", ResponseCode.SUCCESS); | |
| 1882 | + rs.put("ts", ts); | |
| 1883 | + | |
| 1884 | + //日志记录结束 | |
| 1885 | + fLog.end(); | |
| 1886 | + } catch (Exception e) { | |
| 1887 | + logger.error("", e); | |
| 1888 | + rs.put("status", ResponseCode.ERROR); | |
| 1889 | + } | |
| 1890 | + return rs; | |
| 1891 | + } | |
| 1892 | + | |
| 1893 | + @Override | |
| 1894 | + public Map<String, Object> outgoAdjustAll(String params) { | |
| 1895 | + Map<String, Object> rs = new HashMap<>(); | |
| 1896 | + try { | |
| 1897 | + JSONArray jsonArray = JSONArray.parseArray(params); | |
| 1898 | + | |
| 1899 | + ScheduleRealInfo schedule = null; | |
| 1900 | + JSONObject jsonObj; | |
| 1901 | + String dfsj; | |
| 1902 | + long id; | |
| 1903 | + for (int i = 0; i < jsonArray.size(); i++) { | |
| 1904 | + jsonObj = jsonArray.getJSONObject(i); | |
| 1905 | + dfsj = jsonObj.getString("t"); | |
| 1906 | + id = jsonObj.getLong("id"); | |
| 1907 | + schedule = dayOfSchedule.get(id); | |
| 1908 | + | |
| 1909 | + if (schedule != null) | |
| 1910 | + outgoAdjust(id, null, dfsj, null, "2", null); | |
| 1911 | + } | |
| 1912 | + | |
| 1913 | + rs.put("status", ResponseCode.SUCCESS); | |
| 1914 | + //将更新的最后一个班次返回,页面会做全量刷新 | |
| 1915 | + rs.put("t", schedule); | |
| 1916 | + } catch (Exception e) { | |
| 1917 | + logger.error("", e); | |
| 1918 | + rs.put("status", ResponseCode.ERROR); | |
| 1919 | + } | |
| 1920 | + return rs; | |
| 1921 | + } | |
| 1922 | + | |
| 1923 | + @Override | |
| 1924 | + public Map<String, Object> findRouteByLine(String lineCode) { | |
| 1925 | + Map<String, Object> map = new HashMap<>(); | |
| 1926 | + //上行 | |
| 1927 | + Integer lineId = BasicData.lineId2CodeMap.inverse().get(lineCode); | |
| 1928 | + map.put("line.id_eq", lineId); | |
| 1929 | + map.put("directions_eq", 0); | |
| 1930 | + List<Map<String, Object>> upList = sectionRouteService.getSectionRoute(map); | |
| 1931 | + | |
| 1932 | + //下行 | |
| 1933 | + map.put("directions_eq", 1); | |
| 1934 | + List<Map<String, Object>> downList = sectionRouteService.getSectionRoute(map); | |
| 1935 | + | |
| 1936 | + Map<String, Object> rs = new HashMap<>(); | |
| 1937 | + | |
| 1938 | + String upVectors = "", vec; | |
| 1939 | + //拼接上行路段 | |
| 1940 | + for (Map<String, Object> temp : upList) { | |
| 1941 | + vec = temp.get("sectionBsectionVector").toString(); | |
| 1942 | + upVectors += vec.subSequence(11, vec.length() - 2) + " "; | |
| 1943 | + } | |
| 1944 | + | |
| 1945 | + //拼接下行路段 | |
| 1946 | + String downVectors = ""; | |
| 1947 | + for (Map<String, Object> temp : downList) {//LINESTRING( | |
| 1948 | + vec = temp.get("sectionBsectionVector").toString(); | |
| 1949 | + downVectors += vec.subSequence(11, vec.length() - 2) + " "; | |
| 1950 | + } | |
| 1951 | + | |
| 1952 | + | |
| 1953 | + rs.put("up", upVectors); | |
| 1954 | + //上行gcj | |
| 1955 | + rs.put("up_gcj", BdToGcjString(upVectors)); | |
| 1956 | + rs.put("down", downVectors); | |
| 1957 | + //下行gcj | |
| 1958 | + rs.put("down_gcj", BdToGcjString(downVectors)); | |
| 1959 | + rs.put("lineId", lineId); | |
| 1960 | + | |
| 1961 | + return rs; | |
| 1962 | + } | |
| 1963 | + | |
| 1964 | + /** | |
| 1965 | + * @param @param bdStr | |
| 1966 | + * @throws | |
| 1967 | + * @Title: BdToGcjString | |
| 1968 | + * @Description: TODO(将百度路由字符串 转 成GCJ 字符串) | |
| 1969 | + */ | |
| 1970 | + public String BdToGcjString(String bdStr) { | |
| 1971 | + String[] array = bdStr.split(","), subArray; | |
| 1972 | + if (array.length == 0 || bdStr.length() < 2) | |
| 1973 | + return ""; | |
| 1974 | + | |
| 1975 | + String gcjStr = ""; | |
| 1976 | + CoordinateConverter.Location location; | |
| 1977 | + for (String crd : array) { | |
| 1978 | + subArray = crd.split(" "); | |
| 1979 | + if (subArray.length != 2) | |
| 1980 | + continue; | |
| 1981 | + location = CoordinateConverter.bd_decrypt(CoordinateConverter.LocationMake(Double.parseDouble(subArray[0]), Double.parseDouble(subArray[1]))); | |
| 1982 | + | |
| 1983 | + gcjStr += location.getLng() + " " + location.getLat() + ","; | |
| 1984 | + } | |
| 1985 | + | |
| 1986 | + return gcjStr.substring(0, gcjStr.length() - 1); | |
| 1987 | + } | |
| 1988 | + | |
| 1989 | + public List<Map<String, String>> findLine(String line) { | |
| 1990 | + List<Line> listLine = lineRepository.findLine("%" + line + "%"); | |
| 1991 | + List<Map<String, String>> list = new ArrayList<Map<String, String>>(); | |
| 1992 | + Map<String, String> map; | |
| 1993 | + for (Line temp : listLine) { | |
| 1994 | + if (temp != null) { | |
| 1995 | + String xlName = temp.getName(); | |
| 1996 | + if (xlName.indexOf(line) != -1) { | |
| 1997 | + map = new HashMap<String, String>(); | |
| 1998 | + map.put("id", temp.getLineCode()); | |
| 1999 | + map.put("text", xlName); | |
| 2000 | + list.add(map); | |
| 2001 | + } | |
| 2002 | + } | |
| 2003 | + } | |
| 2004 | + return list; | |
| 2005 | + } | |
| 2006 | + | |
| 2007 | + public List<Map<String, String>> findLpName(String lpName) { | |
| 2008 | + List<GuideboardInfo> listLpName = guideboardInfoRepository.findLpName("%" + lpName + "%"); | |
| 2009 | + List<Map<String, String>> list = new ArrayList<Map<String, String>>(); | |
| 2010 | + Map<String, String> map; | |
| 2011 | + for (GuideboardInfo temp : listLpName) { | |
| 2012 | + if (temp != null) { | |
| 2013 | + String lp = temp.getLpName(); | |
| 2014 | + if (lp.indexOf(lpName) != -1) { | |
| 2015 | + map = new HashMap<String, String>(); | |
| 2016 | + map.put("id", lp); | |
| 2017 | + map.put("text", lp); | |
| 2018 | + list.add(map); | |
| 2019 | + } | |
| 2020 | + } | |
| 2021 | + } | |
| 2022 | + return list; | |
| 2023 | + } | |
| 2024 | + | |
| 2025 | + @Override | |
| 2026 | + public Map<String, Object> findKMBC2(String jName, String clZbh, String date) { | |
| 2027 | + List<ScheduleRealInfo> list = scheduleRealInfoRepository.queryListWaybill3(jName, clZbh, date, "", ""); | |
| 2028 | + | |
| 2029 | + DecimalFormat format = new DecimalFormat("0.00"); | |
| 2030 | +// int cjbc = scheduleRealInfoRepository.findCjbc(jName, clZbh, lpName); | |
| 2031 | +// int ljbc = scheduleRealInfoRepository.findLjbc(jName, clZbh, lpName); | |
| 2032 | + int jhbc = 0, cjbc = 0, ljbc = 0; | |
| 2033 | + double jhlc = 0, yygl = 0, ksgl = 0, tempJhlc = 0; | |
| 2034 | + float addMileage = 0l, remMileage = 0l; | |
| 2035 | + String j_Name = ""; | |
| 2036 | + Map<String, Object> map = new HashMap<String, Object>(); | |
| 2037 | + for (ScheduleRealInfo scheduleRealInfo : list) { | |
| 2038 | + if (scheduleRealInfo != null) { | |
| 2039 | + j_Name = scheduleRealInfo.getjName(); | |
| 2040 | + //计划里程(主任务过滤掉临加班次), | |
| 2041 | + //烂班里程(主任务烂班), | |
| 2042 | + //临加里程(主任务临加), | |
| 2043 | + //计划班次,烂班班次,增加班次 | |
| 2044 | + tempJhlc = scheduleRealInfo.getJhlc() == null ? 0 : scheduleRealInfo.getJhlc(); | |
| 2045 | + if (scheduleRealInfo.isSflj()) { | |
| 2046 | + addMileage += tempJhlc; | |
| 2047 | + ljbc++; | |
| 2048 | + } else { | |
| 2049 | + jhlc += tempJhlc; | |
| 2050 | + jhbc++; | |
| 2051 | + if (scheduleRealInfo.getStatus() == -1) { | |
| 2052 | + remMileage += tempJhlc; | |
| 2053 | + cjbc++; | |
| 2054 | + } | |
| 2055 | + } | |
| 2056 | + Set<ChildTaskPlan> childTaskPlans = scheduleRealInfo.getcTasks(); | |
| 2057 | + //计算营运里程,空驶里程 | |
| 2058 | + if (childTaskPlans.isEmpty()) { | |
| 2059 | + if (scheduleRealInfo.getBcType().equals("in") || scheduleRealInfo.getBcType().equals("out") | |
| 2060 | + || scheduleRealInfo.getBcType().equals("venting")) { | |
| 2061 | + ksgl += tempJhlc; | |
| 2062 | + } else { | |
| 2063 | + yygl += tempJhlc; | |
| 2064 | + } | |
| 2065 | + } else { | |
| 2066 | + Iterator<ChildTaskPlan> it = childTaskPlans.iterator(); | |
| 2067 | + while (it.hasNext()) { | |
| 2068 | + ChildTaskPlan childTaskPlan = it.next(); | |
| 2069 | + if (childTaskPlan.getMileageType().equals("empty")) { | |
| 2070 | + ksgl += childTaskPlan.getMileage() == null ? 0 : childTaskPlan.getMileage(); | |
| 2071 | + } else { | |
| 2072 | + yygl += childTaskPlan.getMileage() == null ? 0 : childTaskPlan.getMileage(); | |
| 2073 | + } | |
| 2074 | + } | |
| 2075 | + } | |
| 2076 | + } | |
| 2077 | + } | |
| 2078 | + map.put("j_name", j_Name); | |
| 2079 | + map.put("jhlc", format.format(jhlc)); | |
| 2080 | + map.put("remMileage", format.format(remMileage)); | |
| 2081 | + map.put("addMileage", format.format(addMileage)); | |
| 2082 | + map.put("yygl", format.format(yygl)); | |
| 2083 | + map.put("ksgl", format.format(ksgl)); | |
| 2084 | + map.put("realMileage", format.format(yygl + ksgl)); | |
| 2085 | + map.put("jhbc", jhbc); | |
| 2086 | + map.put("cjbc", cjbc); | |
| 2087 | + map.put("ljbc", ljbc); | |
| 2088 | + map.put("sjbc", jhbc - cjbc + ljbc); | |
| 2089 | + return map; | |
| 2090 | + } | |
| 2091 | + | |
| 2092 | + | |
| 2093 | + public Map<String, Object> findKMBC(String jGh, String clZbh, | |
| 2094 | + String lpName, String date, String line) { | |
| 2095 | + Map<String, Object> map = new HashMap<String, Object>(); | |
| 2096 | + List<ScheduleRealInfo> list = scheduleRealInfoRepository.queryListWaybillXcld(jGh, clZbh, lpName, date, line); | |
| 2097 | + List<ScheduleRealInfo> lists = new ArrayList<ScheduleRealInfo>(); | |
| 2098 | + for (int i = 0; i < list.size(); i++) { | |
| 2099 | + ScheduleRealInfo s = list.get(i); | |
| 2100 | + Set<ChildTaskPlan> cts = s.getcTasks(); | |
| 2101 | + if (cts != null && cts.size() > 0) { | |
| 2102 | + lists.add(s); | |
| 2103 | + } else { | |
| 2104 | + if (s.getFcsjActual() != null && s.getZdsjActual() != null) { | |
| 2105 | + lists.add(s); | |
| 2106 | + } | |
| 2107 | + } | |
| 2108 | + } | |
| 2109 | + map.put("jhbc", culateService.culateJhbc(list, ""));//计划班次 | |
| 2110 | + map.put("jhlc", Arith.add(culateService.culateJhgl(list), | |
| 2111 | + culateService.culateJhJccgl(list))); //计划总里程 | |
| 2112 | + map.put("cjbc", culateService.culateLbbc(list));//烂班班次 | |
| 2113 | + map.put("remMileage", culateService.culateLbgl(list)); //烂班公里 | |
| 2114 | + map.put("ljbc", culateService.culateLjbc(lists, ""));//临加班次 | |
| 2115 | + double ljgl = culateService.culateLjgl(lists); | |
| 2116 | + map.put("addMileage", ljgl); //临加公里 | |
| 2117 | + map.put("sjbc", culateService.culateSjbc(lists, "") + culateService.culateLjbc(lists, "")); | |
| 2118 | + double ksgl = culateService.culateKsgl(list);//子任务空驶公里 | |
| 2119 | + double jccgl = culateService.culateJccgl(lists);//空驶班次公里 | |
| 2120 | + map.put("ksgl", ksgl);//空驶公里 | |
| 2121 | + double sjgl = culateService.culateSjgl(lists);//实际营运公里 | |
| 2122 | + map.put("realMileage", Arith.add(Arith.add(ksgl, jccgl), Arith.add(sjgl, ljgl)));//总公里 | |
| 2123 | + map.put("zkslc", Arith.add(ksgl, jccgl)); | |
| 2124 | + map.put("jcclc", jccgl); | |
| 2125 | + map.put("yygl", Arith.add(sjgl, ljgl)); //总营运公里 | |
| 2126 | + return map; | |
| 2127 | + } | |
| 2128 | + | |
| 2129 | + public Map<String, Object> findKMBC_mh_2(String jGh, String clZbh, | |
| 2130 | + String lpName, String date, String line) { | |
| 2131 | + Map<String, Object> map = new HashMap<String, Object>(); | |
| 2132 | + List<ScheduleRealInfo> list = scheduleRealInfoRepository.queryListWaybillXcld(jGh, clZbh, lpName, date, line); | |
| 2133 | + List<ScheduleRealInfo> lists = new ArrayList<ScheduleRealInfo>(); | |
| 2134 | + for (int i = 0; i < list.size(); i++) { | |
| 2135 | + ScheduleRealInfo s = list.get(i); | |
| 2136 | + if (s.isDestroy() && s.isReissue()) { | |
| 2137 | + s.setRemark(""); | |
| 2138 | + s.setFcsjActual(s.getDfsj()); | |
| 2139 | + s.setZdsjActual(s.getZdsj()); | |
| 2140 | + s.setStatus(2); | |
| 2141 | + s.setJhlc(s.getJhlcOrig()); | |
| 2142 | + } | |
| 2143 | + | |
| 2144 | + Set<ChildTaskPlan> cts = s.getcTasks(); | |
| 2145 | + if (cts != null && cts.size() > 0) { | |
| 2146 | + lists.add(s); | |
| 2147 | + } else { | |
| 2148 | + if (s.getZdsjActual() != null && s.getFcsjActual() != null) { | |
| 2149 | + lists.add(s); | |
| 2150 | + } | |
| 2151 | + } | |
| 2152 | + } | |
| 2153 | + double ksgl = culateService.culateKsgl(list); | |
| 2154 | + double sjgl = culateService.culateSjgl(lists); | |
| 2155 | + double jccgl = culateService.culateJccgl(lists); | |
| 2156 | + double ljgl = culateService.culateLjgl(lists); | |
| 2157 | + | |
| 2158 | + map.put("jhlc", Arith.add(culateService.culateJhgl(list), culateService.culateJhJccgl(list))); //计划里程 | |
| 2159 | + map.put("remMileage", culateService.culateLbgl(list)); //烂班公里 | |
| 2160 | + map.put("addMileage", ljgl); //临加公里 | |
| 2161 | + map.put("yygl", Arith.add(sjgl, ljgl)); //实际公里 | |
| 2162 | + map.put("ksgl", ksgl);//空驶公里 | |
| 2163 | + map.put("realMileage", Arith.add(Arith.add(ksgl, jccgl), Arith.add(sjgl, ljgl))); | |
| 2164 | +// map.put("realMileage", format.format(yygl + ksgl + jcclc+addMileage)); | |
| 2165 | + map.put("jhbc", culateService.culateJhbc(list, "")); | |
| 2166 | + map.put("cjbc", culateService.culateLbbc(list)); | |
| 2167 | + map.put("ljbc", culateService.culateLjbc(lists, "")); | |
| 2168 | + map.put("sjbc", culateService.culateJhbc(lists, "") - culateService.culateLbbc(lists) + culateService.culateLjbc(lists, "")); | |
| 2169 | + map.put("jcclc", jccgl); | |
| 2170 | + map.put("zkslc", Arith.add(ksgl, jccgl)); | |
| 2171 | +// map.put("zkslc", format.format(ksgl + jcclc+addMileageJc)); | |
| 2172 | + return map; | |
| 2173 | + } | |
| 2174 | + | |
| 2175 | + | |
| 2176 | + @Override | |
| 2177 | + public List<Map<String, Object>> accountPx(String line, String date, | |
| 2178 | + String code, String xlName, String px) { | |
| 2179 | +// List<Object[]> lsitObj = scheduleRealInfoRepository.accountPx(line, date, code,px); | |
| 2180 | + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); | |
| 2181 | + if (!code.trim().equals("")) { | |
| 2182 | + code = BasicData.deviceId2NbbmMap.inverse().get(code); | |
| 2183 | + } | |
| 2184 | + String fgs = ""; | |
| 2185 | + List<Line> lineList = lineRepository.findLineByCode(line); | |
| 2186 | + if (lineList.size() > 0) { | |
| 2187 | + Line l = lineList.get(0); | |
| 2188 | + fgs = BasicData.businessFgsCodeNameMap.get(l.getBrancheCompany() + "_" + l.getCompany()); | |
| 2189 | + } | |
| 2190 | + List<Map<String, Object>> listMap = new ArrayList<Map<String, Object>>(); | |
| 2191 | + String sql = "SELECT request_code,FROM_UNIXTIME(TIMESTAMP / 1000,'%Y-%m-%d %T') as TIMESTAMP ," | |
| 2192 | + + " device_id FROM bsth_v_report_80 WHERE " | |
| 2193 | + + " FROM_UNIXTIME( TIMESTAMP / 1000,'%Y-%m-%d') = '" + date + "' AND" | |
| 2194 | + + " line_id = '" + line + "' and device_id like '%" + code + "%'"; | |
| 2195 | + Map<String, Object> map; | |
| 2196 | + List<Object[]> lsitObj = jdbcTemplate.query(sql, | |
| 2197 | + new RowMapper<Object[]>() { | |
| 2198 | + @Override | |
| 2199 | + public Object[] mapRow(ResultSet rs, int rowNum) throws SQLException { | |
| 2200 | + Object[] t = new Object[3]; | |
| 2201 | + t[0] = rs.getString("request_code"); | |
| 2202 | + t[1] = rs.getString("TIMESTAMP"); | |
| 2203 | + t[2] = rs.getString("device_id"); | |
| 2204 | + return t; | |
| 2205 | + } | |
| 2206 | + }); | |
| 2207 | + int i = 1; | |
| 2208 | + for (Object[] obj : lsitObj) { | |
| 2209 | + if (obj != null) { | |
| 2210 | + map = new HashMap<String, Object>(); | |
| 2211 | + map.put("num", i++); | |
| 2212 | + map.put("xlName", xlName); | |
| 2213 | + if (BasicData.deviceId2NbbmMap.get(obj[2]) == null) { | |
| 2214 | + List<CarDevice> carDeviceList = new ArrayList<CarDevice>(); | |
| 2215 | + try { | |
| 2216 | + carDeviceList = carDeviceRepository.findCarDevice(obj[2].toString(), sdf.parse(obj[1].toString())); | |
| 2217 | + } catch (Exception e) { | |
| 2218 | + // TODO Auto-generated catch block | |
| 2219 | + e.printStackTrace(); | |
| 2220 | + } | |
| 2221 | + if (carDeviceList.size() > 0) { | |
| 2222 | + map.put("clZbh", carDeviceList.get(0).getClZbh()); | |
| 2223 | + | |
| 2224 | + } else { | |
| 2225 | + map.put("clZbh", BasicData.deviceId2NbbmMap.get(obj[2])); | |
| 2226 | + } | |
| 2227 | + } else { | |
| 2228 | + map.put("clZbh", BasicData.deviceId2NbbmMap.get(obj[2])); | |
| 2229 | + | |
| 2230 | + } | |
| 2231 | + map.put("company", fgs); | |
| 2232 | + map.put("requestType", "0x" + Integer.toHexString(Integer.parseInt(obj[0] + "")).toUpperCase()); | |
| 2233 | + map.put("requestTime", obj[1]); | |
| 2234 | + listMap.add(map); | |
| 2235 | + } | |
| 2236 | + } | |
| 2237 | + if (listMap.size() > 1) { | |
| 2238 | + if (px.equals("asc")) { | |
| 2239 | + Collections.sort(listMap, new AccountMap()); | |
| 2240 | + } else { | |
| 2241 | + Collections.sort(listMap, new AccountMap2()); | |
| 2242 | + } | |
| 2243 | + } | |
| 2244 | + return listMap; | |
| 2245 | + } | |
| 2246 | + | |
| 2247 | + @Override | |
| 2248 | + public List<Map<String, Object>> account(String line, String date, | |
| 2249 | + String code, String xlName, String type) { | |
| 2250 | + if (!code.trim().equals("")) { | |
| 2251 | + code = BasicData.deviceId2NbbmMap.inverse().get(code); | |
| 2252 | + } | |
| 2253 | + String fgs = ""; | |
| 2254 | + List<Line> lineList = lineRepository.findLineByCode(line); | |
| 2255 | + if (lineList.size() > 0) { | |
| 2256 | + Line l = lineList.get(0); | |
| 2257 | + fgs = BasicData.businessFgsCodeNameMap.get(l.getBrancheCompany() + "_" + l.getCompany()); | |
| 2258 | + } | |
| 2259 | + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); | |
| 2260 | + List<Object[]> lsitObj = scheduleRealInfoRepository.account(line, date, code); | |
| 2261 | + List<Map<String, Object>> listMap = new ArrayList<Map<String, Object>>(); | |
| 2262 | + Map<String, Object> map; | |
| 2263 | + int i = 1; | |
| 2264 | + for (Object[] obj : lsitObj) { | |
| 2265 | + if (obj != null) { | |
| 2266 | + map = new HashMap<String, Object>(); | |
| 2267 | + map.put("num", i++); | |
| 2268 | + map.put("xlName", xlName); | |
| 2269 | + if (BasicData.deviceId2NbbmMap.get(obj[2]) == null) { | |
| 2270 | + List<CarDevice> carDeviceList = new ArrayList<CarDevice>(); | |
| 2271 | + try { | |
| 2272 | + carDeviceList = carDeviceRepository.findCarDevice(obj[2].toString(), sdf.parse(obj[1].toString())); | |
| 2273 | + } catch (Exception e) { | |
| 2274 | + // TODO Auto-generated catch block | |
| 2275 | + e.printStackTrace(); | |
| 2276 | + } | |
| 2277 | + if (carDeviceList.size() > 0) { | |
| 2278 | + map.put("clZbh", carDeviceList.get(0).getClZbh()); | |
| 2279 | + | |
| 2280 | + } else { | |
| 2281 | + map.put("clZbh", BasicData.deviceId2NbbmMap.get(obj[2])); | |
| 2282 | + } | |
| 2283 | + } else { | |
| 2284 | + map.put("clZbh", BasicData.deviceId2NbbmMap.get(obj[2])); | |
| 2285 | + | |
| 2286 | + } | |
| 2287 | + map.put("company", fgs); | |
| 2288 | + map.put("requestType", "0x" + Integer.toHexString(Integer.parseInt(obj[0] + "")).toUpperCase()); | |
| 2289 | + map.put("requestTime", obj[1]); | |
| 2290 | + listMap.add(map); | |
| 2291 | + } | |
| 2292 | + } | |
| 2293 | + | |
| 2294 | + if (type != null && type.length() != 0 && type.equals("export")) { | |
| 2295 | + SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"), | |
| 2296 | + sdfSimple = new SimpleDateFormat("yyyyMMdd"); | |
| 2297 | + List<Iterator<?>> listI = new ArrayList<Iterator<?>>(); | |
| 2298 | + Map<String, Object> m = new HashMap<String, Object>(); | |
| 2299 | + ReportUtils ee = new ReportUtils(); | |
| 2300 | + Map<String, Object> typeMap = new HashMap<String, Object>(); | |
| 2301 | + typeMap.put("0xA1", "请求恢复运营"); | |
| 2302 | + typeMap.put("0xA2", "申请调档"); | |
| 2303 | + typeMap.put("0xA3", "出场请求"); | |
| 2304 | + typeMap.put("0xA5", "进场请求"); | |
| 2305 | + typeMap.put("0xA7", "加油请求"); | |
| 2306 | + typeMap.put("0x50", "车辆故障"); | |
| 2307 | + typeMap.put("0x70", "路阻报告"); | |
| 2308 | + typeMap.put("0x60", "事故报告"); | |
| 2309 | + typeMap.put("0x11", "扣证纠纷"); | |
| 2310 | + typeMap.put("0x12", "报警"); | |
| 2311 | + for (Map<String, Object> map1 : listMap) { | |
| 2312 | + map1.put("requestText", typeMap.get(map1.get("requestType"))); | |
| 2313 | + } | |
| 2314 | + try { | |
| 2315 | + listI.add(listMap.iterator()); | |
| 2316 | + String path = this.getClass().getResource("/").getPath() + "static/pages/forms/"; | |
| 2317 | + ee.excelReplace(listI, new Object[]{m}, path + "mould/account.xls", | |
| 2318 | + path + "export/" + sdfSimple.format(sdfMonth.parse(date)) | |
| 2319 | + + "-" + xlName + "-驾驶员请求台账.xls"); | |
| 2320 | + } catch (Exception e) { | |
| 2321 | + // TODO: handle exception | |
| 2322 | + e.printStackTrace(); | |
| 2323 | + } | |
| 2324 | + } | |
| 2325 | + | |
| 2326 | + return listMap; | |
| 2327 | + } | |
| 2328 | + | |
| 2329 | + @Override | |
| 2330 | + public List<SchEditInfoDto> correctForm(String line, String date, String endDate, | |
| 2331 | + String lpName, String code, String type, String changType) { | |
| 2332 | + | |
| 2333 | +// var types = {'DFTZ': '待发调整', 'FCXXWT':'发车信息微调', 'JHLB': '计划烂班', 'CXLB': '撤销烂班', | |
| 2334 | +// 'CXZX': '撤销执行', 'CXSF': '撤销实发', 'SFTZ': '实发调整', 'TZRC': '调整人车'}; | |
| 2335 | + Map<String, Object> map = new HashMap<String, Object>(); | |
| 2336 | + map.put("DFTZ", "待发调整"); | |
| 2337 | + map.put("FCXXWT", "发车信息微调"); | |
| 2338 | + map.put("JHLB", "计划烂班"); | |
| 2339 | + map.put("CXLB", "撤销烂班"); | |
| 2340 | + map.put("CXZX", "撤销执行"); | |
| 2341 | + map.put("CXSF", "撤销实发"); | |
| 2342 | + map.put("SFTZ", "实发调整"); | |
| 2343 | + map.put("TZRC", "调整人车"); | |
| 2344 | + | |
| 2345 | + SimpleDateFormat sdf1 = new SimpleDateFormat("HH:mm"); | |
| 2346 | + SimpleDateFormat sdf2 = new SimpleDateFormat("yyyy-MM-dd HH:mm"); | |
| 2347 | + String cont = ""; | |
| 2348 | + cont = " and xl_bm ='" + line + "'"; | |
| 2349 | + if (!lpName.equals("")) { | |
| 2350 | + cont += " and lp_name = '" + lpName + "'"; | |
| 2351 | + } | |
| 2352 | + if (!code.equals("")) { | |
| 2353 | + cont += " and cl_zbh ='" + code + "'"; | |
| 2354 | + } | |
| 2355 | + String sql = "select t1.*, t2.real_exec_date," | |
| 2356 | + + "t2.fcsj,t2.lp_name,t2.cl_zbh,t2.j_gh,t2.j_name," | |
| 2357 | + + "t2.xl_dir,t2.real_exec_date from (select * from " | |
| 2358 | + + "logger_sch_modify where rq BETWEEN ? and ? and line_code=? )" | |
| 2359 | + + " t1 INNER JOIN bsth_c_s_sp_info_real t2 on " | |
| 2360 | + + "t1.sch_id=t2.id where 1=1 " + cont; | |
| 2361 | + | |
| 2362 | + List<SchEditInfoDto> list = jdbcTemplate.query(sql, | |
| 2363 | + new BeanPropertyRowMapper(SchEditInfoDto.class), date, endDate, line); | |
| 2364 | + List<SchEditInfoDto> lists = new ArrayList<SchEditInfoDto>(); | |
| 2365 | + for (int i = 0; i < list.size(); i++) { | |
| 2366 | + Long fcsjs = 0l; | |
| 2367 | + Long updsj = 0l; | |
| 2368 | + SchEditInfoDto t = list.get(i); | |
| 2369 | + if (map.get(t.getType()) != null) { | |
| 2370 | + | |
| 2371 | + if (changType.equals("")) { | |
| 2372 | + t.setType2(t.getUser() + "于" + t.getTimeStr() + "进行" + map.get(t.getType()).toString() + ";"); | |
| 2373 | + } else { | |
| 2374 | + String fcsj = ""; | |
| 2375 | + String updtime = ""; | |
| 2376 | + try { | |
| 2377 | + fcsj = sdf1.format(sdf1.parse(t.getFcsj())); | |
| 2378 | + updtime = sdf1.format(sdf1.parse(t.getTimeStr())); | |
| 2379 | + fcsjs = sdf2.parse(t.getRealExecDate() + " " + fcsj).getTime(); | |
| 2380 | + updsj = sdf2.parse(t.getRq() + " " + updtime).getTime(); | |
| 2381 | + } catch (ParseException e) { | |
| 2382 | + // TODO Auto-generated catch block | |
| 2383 | + e.printStackTrace(); | |
| 2384 | + } | |
| 2385 | + if (changType.equals("1")) { | |
| 2386 | + if (fcsjs > updsj) { | |
| 2387 | + t.setType2(t.getUser() + "于" + t.getTimeStr() + "进行" + map.get(t.getType()).toString() + ";"); | |
| 2388 | + } else { | |
| 2389 | + t.setType2(""); | |
| 2390 | + } | |
| 2391 | + } else if (changType.equals("2")) { | |
| 2392 | + if (fcsjs < updsj) { | |
| 2393 | + t.setType2(t.getUser() + "于" + t.getTimeStr() + "进行" + map.get(t.getType()).toString() + ";"); | |
| 2394 | + } else { | |
| 2395 | + t.setType2(""); | |
| 2396 | + } | |
| 2397 | + } | |
| 2398 | + } | |
| 2399 | + } else { | |
| 2400 | + t.setType2(""); | |
| 2401 | + } | |
| 2402 | + boolean fage = true; | |
| 2403 | + for (int j = 0; j < lists.size(); j++) { | |
| 2404 | + SchEditInfoDto s = lists.get(j); | |
| 2405 | + if (s.getSchId() == t.getSchId()) { | |
| 2406 | + s.setType2(s.getType2() + " " + t.getType2()); | |
| 2407 | + fage = false; | |
| 2408 | + } | |
| 2409 | + } | |
| 2410 | + | |
| 2411 | + if (fage) { | |
| 2412 | + if (changType.equals("")) { | |
| 2413 | + lists.add(t); | |
| 2414 | + } else { | |
| 2415 | + if (changType.equals("1")) { | |
| 2416 | + if (fcsjs > updsj) { | |
| 2417 | + lists.add(t); | |
| 2418 | + } | |
| 2419 | + } else if (changType.equals("2")) { | |
| 2420 | + if (fcsjs < updsj) { | |
| 2421 | + lists.add(t); | |
| 2422 | + } | |
| 2423 | + } | |
| 2424 | + } | |
| 2425 | + } | |
| 2426 | + } | |
| 2427 | + | |
| 2428 | + if (type != null && type.length() != 0 && type.equals("export")) { | |
| 2429 | + SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"), | |
| 2430 | + sdfSimple = new SimpleDateFormat("yyyyMMdd"); | |
| 2431 | + List<Iterator<?>> listI = new ArrayList<Iterator<?>>(); | |
| 2432 | + Map<String, Object> m = new HashMap<String, Object>(); | |
| 2433 | + m.put("dates", date); | |
| 2434 | + ReportUtils ee = new ReportUtils(); | |
| 2435 | + List<Map<String, Object>> tempList = new ArrayList<Map<String, Object>>(); | |
| 2436 | + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); | |
| 2437 | + for (SchEditInfoDto d : lists) { | |
| 2438 | + Map<String, Object> tempMap = new HashMap<String, Object>(); | |
| 2439 | + tempMap.put("lpName", d.getLpName()); | |
| 2440 | + tempMap.put("rq", d.getRq()); | |
| 2441 | + tempMap.put("clZbh", d.getClZbh()); | |
| 2442 | + tempMap.put("jName", d.getjName() + "/" + d.getjGh()); | |
| 2443 | + tempMap.put("fcsj", d.getFcsj()); | |
| 2444 | + tempMap.put("type", d.getType2()); | |
| 2445 | + tempList.add(tempMap); | |
| 2446 | + } | |
| 2447 | + try { | |
| 2448 | + String dateTime = sdfSimple.format(sdfMonth.parse(date)); | |
| 2449 | + if(!endDate.equals(date)){ | |
| 2450 | + dateTime += "-" + sdfSimple.format(sdfMonth.parse(endDate)); | |
| 2451 | + } | |
| 2452 | + String lineName = BasicData.lineCode2NameMap.get(line); | |
| 2453 | + listI.add(tempList.iterator()); | |
| 2454 | + String path = this.getClass().getResource("/").getPath() + "static/pages/forms/"; | |
| 2455 | + ee.excelReplace(listI, new Object[]{m}, path + "mould/correctForm.xls", | |
| 2456 | + path + "export/" + dateTime + "-" + lineName + "-修正报表.xls"); | |
| 2457 | + } catch (Exception e) { | |
| 2458 | + // TODO: handle exception | |
| 2459 | + e.printStackTrace(); | |
| 2460 | + } | |
| 2461 | +// Map<String, Object> maps = tempList.get(tempList.size() - 1); | |
| 2462 | + } | |
| 2463 | + return lists; | |
| 2464 | + } | |
| 2465 | + | |
| 2466 | + @Override | |
| 2467 | + public List<ScheduleRealInfo> queryListWaybill(String jGh, String clZbh, | |
| 2468 | + String lpName, String date, String line) { | |
| 2469 | + List<ScheduleRealInfo> listSchedule = new ArrayList<ScheduleRealInfo>(); | |
| 2470 | + List<ScheduleRealInfo> list = null; | |
| 2471 | + list = scheduleRealInfoRepository.queryListWaybillXcld(jGh, clZbh, lpName, date, line); | |
| 2472 | + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm"); | |
| 2473 | + String minfcsj = "02:00"; | |
| 2474 | + List<Line> lineList = lineRepository.findLineByCode(line); | |
| 2475 | + if (lineList.size() > 0) { | |
| 2476 | + String sqlMinYysj = "select start_opt from bsth_c_line_config where " | |
| 2477 | + + " id = (" | |
| 2478 | + + "select max(id) from bsth_c_line_config where line ='" + lineList.get(0).getId() + "'" | |
| 2479 | + + ")"; | |
| 2480 | + minfcsj = jdbcTemplate.queryForObject(sqlMinYysj, String.class); | |
| 2481 | + } | |
| 2482 | + String[] minSjs = minfcsj.split(":"); | |
| 2483 | + Long minSj = Long.parseLong(minSjs[0]) * 60 + Long.parseLong(minSjs[1]); | |
| 2484 | + | |
| 2485 | + for (int i = 0; i < list.size(); i++) { | |
| 2486 | + ScheduleRealInfo s = list.get(i); | |
| 2487 | + if (s.getBcType().equals("out")) { | |
| 2488 | + s.setRemark("1"); | |
| 2489 | + } else if (s.getBcType().equals("in")) { | |
| 2490 | + s.setRemark("3"); | |
| 2491 | + } else { | |
| 2492 | + s.setRemark("2"); | |
| 2493 | + } | |
| 2494 | + String[] fcsj = s.getFcsj().split(":"); | |
| 2495 | + Long fcsjL = Long.parseLong(fcsj[0]) * 60 + Long.parseLong(fcsj[1]); | |
| 2496 | + | |
| 2497 | + Long fscjT = 0L; | |
| 2498 | + if (fcsjL < minSj) { | |
| 2499 | + Calendar calendar = new GregorianCalendar(); | |
| 2500 | + calendar.setTime(s.getScheduleDate()); | |
| 2501 | + calendar.add(calendar.DATE, 1); | |
| 2502 | + s.setScheduleDate(calendar.getTime()); | |
| 2503 | + try { | |
| 2504 | + fscjT = sdf.parse(sdf.format(s.getScheduleDate()) + " " + s.getFcsj()).getTime(); | |
| 2505 | + } catch (ParseException e) { | |
| 2506 | + // TODO Auto-generated catch block | |
| 2507 | + e.printStackTrace(); | |
| 2508 | + } | |
| 2509 | + | |
| 2510 | + } else { | |
| 2511 | + try { | |
| 2512 | + fscjT = sdf.parse(s.getScheduleDateStr() + " " + s.getFcsj()).getTime(); | |
| 2513 | + } catch (ParseException e) { | |
| 2514 | + // TODO Auto-generated catch block | |
| 2515 | + e.printStackTrace(); | |
| 2516 | + } | |
| 2517 | + ; | |
| 2518 | + } | |
| 2519 | + s.setFcsjT(fscjT); | |
| 2520 | + } | |
| 2521 | + Collections.sort(list, new compareFcsjType()); | |
| 2522 | + for (int i = 0; i < list.size(); i++) { | |
| 2523 | + ScheduleRealInfo s = list.get(i); | |
| 2524 | + s.setAdjustExps(i + 1 + ""); | |
| 2525 | + String remarks = ""; | |
| 2526 | + if (s.getRemarks() != null) { | |
| 2527 | + remarks += s.getRemarks(); | |
| 2528 | + } | |
| 2529 | + | |
| 2530 | + Set<ChildTaskPlan> childTaskPlans = s.getcTasks(); | |
| 2531 | + if (!childTaskPlans.isEmpty()) { | |
| 2532 | + s.setFcsjActual(""); | |
| 2533 | + s.setZdsjActual(""); | |
| 2534 | + s.setJhlc(0.0); | |
| 2535 | + } | |
| 2536 | + | |
| 2537 | + if (s.isDestroy()) { | |
| 2538 | + s.setFcsjActual(""); | |
| 2539 | + s.setZdsjActual(""); | |
| 2540 | + s.setJhlc(0.0); | |
| 2541 | + remarks += "(烂班)"; | |
| 2542 | + s.setRemarks(remarks); | |
| 2543 | + } | |
| 2544 | + | |
| 2545 | + listSchedule.add(s); | |
| 2546 | + //计算营运里程,空驶里程 | |
| 2547 | + if (!childTaskPlans.isEmpty()) { | |
| 2548 | +// Iterator<ChildTaskPlan> it = childTaskPlans.iterator(); | |
| 2549 | + List<ChildTaskPlan> listit = new ArrayList<ChildTaskPlan>(childTaskPlans); | |
| 2550 | + Collections.sort(listit, new ComparableChild()); | |
| 2551 | + for (int j = 0; j < listit.size(); j++) { | |
| 2552 | + ScheduleRealInfo t = new ScheduleRealInfo(); | |
| 2553 | + ChildTaskPlan childTaskPlan = listit.get(j); | |
| 2554 | + if (childTaskPlan.getCcId() == null) { | |
| 2555 | + if (childTaskPlan.isDestroy()) { | |
| 2556 | + t.setFcsjActual(""); | |
| 2557 | + t.setZdsjActual(""); | |
| 2558 | + t.setJhlc(0.0); | |
| 2559 | + } else { | |
| 2560 | + t.setFcsjActual(childTaskPlan.getStartDate()); | |
| 2561 | + t.setZdsjActual(childTaskPlan.getEndDate()); | |
| 2562 | + t.setJhlc(Double.parseDouble(String.valueOf(childTaskPlan.getMileage()))); | |
| 2563 | + } | |
| 2564 | + t.setFcsj(childTaskPlan.getStartDate()); | |
| 2565 | + t.setZdsj(childTaskPlan.getEndDate()); | |
| 2566 | + t.setQdzName(childTaskPlan.getStartStationName()); | |
| 2567 | + t.setZdzName(childTaskPlan.getEndStationName()); | |
| 2568 | + t.setRemarks(childTaskPlan.getRemarks()); | |
| 2569 | + t.setAdjustExps("子"); | |
| 2570 | + listSchedule.add(t); | |
| 2571 | + } | |
| 2572 | + } | |
| 2573 | + } | |
| 2574 | + } | |
| 2575 | + | |
| 2576 | + return listSchedule; | |
| 2577 | + } | |
| 2578 | + | |
| 2579 | + @Override | |
| 2580 | + public List<ScheduleRealInfo> queryListWaybill2(String jName, String clZbh, | |
| 2581 | + String lpName, String date, String line) { | |
| 2582 | + List<ScheduleRealInfo> listSchedule = new ArrayList<ScheduleRealInfo>(); | |
| 2583 | + List<ScheduleRealInfo> list = null; | |
| 2584 | + list = scheduleRealInfoRepository.queryListWaybill(jName, clZbh, lpName, date, line); | |
| 2585 | + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm"); | |
| 2586 | + String minfcsj = "02:00"; | |
| 2587 | + List<Line> lineList = lineRepository.findLineByCode(line); | |
| 2588 | + if (lineList.size() > 0) { | |
| 2589 | + String sqlMinYysj = "select start_opt from bsth_c_line_config where " | |
| 2590 | + + " id = (" | |
| 2591 | + + "select max(id) from bsth_c_line_config where line ='" + lineList.get(0).getId() + "'" | |
| 2592 | + + ")"; | |
| 2593 | + minfcsj = jdbcTemplate.queryForObject(sqlMinYysj, String.class); | |
| 2594 | + } | |
| 2595 | + String[] minSjs = minfcsj.split(":"); | |
| 2596 | + Long minSj = Long.parseLong(minSjs[0]) * 60 + Long.parseLong(minSjs[1]); | |
| 2597 | + | |
| 2598 | + for (int i = 0; i < list.size(); i++) { | |
| 2599 | + ScheduleRealInfo s = list.get(i); | |
| 2600 | + String[] fcsj = s.getFcsj().split(":"); | |
| 2601 | + Long fcsjL = Long.parseLong(fcsj[0]) * 60 + Long.parseLong(fcsj[1]); | |
| 2602 | + | |
| 2603 | + Long fscjT = 0L; | |
| 2604 | + if (fcsjL < minSj) { | |
| 2605 | + Calendar calendar = new GregorianCalendar(); | |
| 2606 | + calendar.setTime(s.getScheduleDate()); | |
| 2607 | + calendar.add(calendar.DATE, 1); | |
| 2608 | + s.setScheduleDate(calendar.getTime()); | |
| 2609 | + try { | |
| 2610 | + fscjT = sdf.parse(sdf.format(s.getScheduleDate()) + " " + s.getFcsj()).getTime(); | |
| 2611 | + } catch (ParseException e) { | |
| 2612 | + // TODO Auto-generated catch block | |
| 2613 | + e.printStackTrace(); | |
| 2614 | + } | |
| 2615 | + | |
| 2616 | + } else { | |
| 2617 | + try { | |
| 2618 | + fscjT = sdf.parse(s.getScheduleDateStr() + " " + s.getFcsj()).getTime(); | |
| 2619 | + } catch (ParseException e) { | |
| 2620 | + // TODO Auto-generated catch block | |
| 2621 | + e.printStackTrace(); | |
| 2622 | + } | |
| 2623 | + ; | |
| 2624 | + } | |
| 2625 | + s.setFcsjT(fscjT); | |
| 2626 | + } | |
| 2627 | + Collections.sort(list, new ComparableReal()); | |
| 2628 | + for (int i = 0; i < list.size(); i++) { | |
| 2629 | + ScheduleRealInfo s = list.get(i); | |
| 2630 | + s.setAdjustExps(i + 1 + ""); | |
| 2631 | + String remarks = ""; | |
| 2632 | + if (s.getRemarks() != null) { | |
| 2633 | + remarks += s.getRemarks(); | |
| 2634 | + } | |
| 2635 | + | |
| 2636 | + Set<ChildTaskPlan> childTaskPlans = s.getcTasks(); | |
| 2637 | + if (!childTaskPlans.isEmpty()) { | |
| 2638 | + s.setFcsjActual(""); | |
| 2639 | + s.setZdsjActual(""); | |
| 2640 | + s.setJhlc(0.0); | |
| 2641 | + } | |
| 2642 | + | |
| 2643 | + if (s.isDestroy()) { | |
| 2644 | + if (s.isReissue()) { | |
| 2645 | + s.setFcsjActual(s.getDfsj()); | |
| 2646 | + s.setZdsjActual(s.getZdsj()); | |
| 2647 | + s.setRemarks(""); | |
| 2648 | + s.setStatus(2); | |
| 2649 | + s.setJhlc(s.getJhlcOrig()); | |
| 2650 | + } else { | |
| 2651 | + s.setFcsjActual(""); | |
| 2652 | + s.setZdsjActual(""); | |
| 2653 | + s.setJhlc(0.0); | |
| 2654 | + remarks += "(烂班)"; | |
| 2655 | + s.setRemarks(remarks); | |
| 2656 | + } | |
| 2657 | + } | |
| 2658 | + | |
| 2659 | + listSchedule.add(s); | |
| 2660 | + //计算营运里程,空驶里程 | |
| 2661 | + if (!childTaskPlans.isEmpty()) { | |
| 2662 | +// Iterator<ChildTaskPlan> it = childTaskPlans.iterator(); | |
| 2663 | + List<ChildTaskPlan> listit = new ArrayList<ChildTaskPlan>(childTaskPlans); | |
| 2664 | + Collections.sort(listit, new ComparableChild()); | |
| 2665 | + for (int j = 0; j < listit.size(); j++) { | |
| 2666 | + ScheduleRealInfo t = new ScheduleRealInfo(); | |
| 2667 | + ChildTaskPlan childTaskPlan = listit.get(j); | |
| 2668 | + if (childTaskPlan.isDestroy()) { | |
| 2669 | + t.setFcsjActual(""); | |
| 2670 | + t.setZdsjActual(""); | |
| 2671 | + t.setJhlc(0.0); | |
| 2672 | + } else { | |
| 2673 | + t.setFcsjActual(childTaskPlan.getStartDate()); | |
| 2674 | + t.setZdsjActual(childTaskPlan.getEndDate()); | |
| 2675 | + t.setJhlc(Double.parseDouble(String.valueOf(childTaskPlan.getMileage()))); | |
| 2676 | + } | |
| 2677 | + t.setQdzName(childTaskPlan.getStartStationName()); | |
| 2678 | + t.setZdzName(childTaskPlan.getEndStationName()); | |
| 2679 | + t.setRemarks(childTaskPlan.getRemarks()); | |
| 2680 | + t.setAdjustExps("子"); | |
| 2681 | + listSchedule.add(t); | |
| 2682 | + } | |
| 2683 | + } | |
| 2684 | + } | |
| 2685 | + | |
| 2686 | + return listSchedule; | |
| 2687 | + } | |
| 2688 | + | |
| 2689 | + @Override | |
| 2690 | + public Map<String, Object> removeChildTask(Long taskId) { | |
| 2691 | + Map<String, Object> rs = new HashMap<>(); | |
| 2692 | + ChildTaskPlan chTask = cTaskPlanRepository.findById(taskId).get(); | |
| 2693 | + | |
| 2694 | + ScheduleRealInfo sch = dayOfSchedule.get(chTask.getSchedule().getId()); | |
| 2695 | + try { | |
| 2696 | + | |
| 2697 | + sch.getcTasks().remove(chTask); | |
| 2698 | + scheduleRealInfoRepository.save(sch); | |
| 2699 | + rs.put("status", ResponseCode.SUCCESS); | |
| 2700 | + } catch (Exception e) { | |
| 2701 | + logger.error("", e); | |
| 2702 | + rs.put("status", ResponseCode.ERROR); | |
| 2703 | + } | |
| 2704 | + return rs; | |
| 2705 | + } | |
| 2706 | + | |
| 2707 | + @Override | |
| 2708 | + public List<Map<String, Object>> statisticsDaily(String line, String date, | |
| 2709 | + String xlName, String type) { | |
| 2710 | + List<Map<String, Object>> lMap = new ArrayList<Map<String, Object>>(); | |
| 2711 | + List<ScheduleRealInfo> list_s = scheduleRealInfoRepository.scheduleByDateAndLine2(line, date); | |
| 2712 | + List<ScheduleRealInfo> lists = new ArrayList<ScheduleRealInfo>(); | |
| 2713 | + for (int i = 0; i < list_s.size(); i++) { | |
| 2714 | + ScheduleRealInfo s = list_s.get(i); | |
| 2715 | + Set<ChildTaskPlan> cts = s.getcTasks(); | |
| 2716 | + if (cts != null && cts.size() > 0) { | |
| 2717 | + lists.add(s); | |
| 2718 | + } else { | |
| 2719 | + if (s.getZdsjActual() != null && s.getFcsjActual() != null) { | |
| 2720 | + lists.add(s); | |
| 2721 | + } | |
| 2722 | + } | |
| 2723 | + } | |
| 2724 | + Map<String, Object> map = new HashMap<String, Object>(); | |
| 2725 | + map.put("xlName", xlName); | |
| 2726 | + double jhlc = culateService.culateJhgl(list_s); | |
| 2727 | + map.put("jhlc", jhlc); | |
| 2728 | + map.put("sjgl", Arith.add(culateService.culateSjgl(lists), culateService.culateLjgl(lists))); | |
| 2729 | + double lbgl = culateService.culateLbgl(list_s); | |
| 2730 | + map.put("ssgl", lbgl); | |
| 2731 | + map.put("ssgl_lz", culateService.culateCJLC(list_s, "路阻")); | |
| 2732 | + map.put("ssgl_dm", culateService.culateCJLC(list_s, "吊慢")); | |
| 2733 | + map.put("ssgl_gz", culateService.culateCJLC(list_s, "故障")); | |
| 2734 | + map.put("ssgl_jf", culateService.culateCJLC(list_s, "纠纷")); | |
| 2735 | + map.put("ssgl_zs", culateService.culateCJLC(list_s, "肇事")); | |
| 2736 | + map.put("ssgl_qr", culateService.culateCJLC(list_s, "缺人")); | |
| 2737 | + map.put("ssgl_qc", culateService.culateCJLC(list_s, "缺车")); | |
| 2738 | + map.put("ssgl_kx", culateService.culateCJLC(list_s, "客稀")); | |
| 2739 | + map.put("ssgl_qh", culateService.culateCJLC(list_s, "气候")); | |
| 2740 | + map.put("ssgl_yw", culateService.culateCJLC(list_s, "援外")); | |
| 2741 | + map.put("ssgl_ljpm", culateService.culateCJLC(list_s, "路救抛锚")); | |
| 2742 | + double ssgl_pc = culateService.culateCJLC(list_s, "配车"); | |
| 2743 | + double ssgl_by = culateService.culateCJLC(list_s, "保养"); | |
| 2744 | + double ssgl_cj = culateService.culateCJLC(list_s, "抽减"); | |
| 2745 | + double ssgl_qt = culateService.culateCJLC(list_s, "其他"); | |
| 2746 | + map.put("ssgl_other", Arith.add(Arith.add(ssgl_pc, ssgl_by), Arith.add(ssgl_cj, ssgl_qt))); | |
| 2747 | + map.put("ssbc", culateService.culateLbbc(list_s)); | |
| 2748 | + double ljgl = culateService.culateLjgl(lists); | |
| 2749 | + map.put("ljgl", ljgl); | |
| 2750 | + map.put("jhbc", culateService.culateJhbc(list_s, "")); | |
| 2751 | + map.put("jhbc_m", culateService.culateJhbc(list_s, "zgf")); | |
| 2752 | + map.put("jhbc_a", culateService.culateJhbc(list_s, "wgf")); | |
| 2753 | + map.put("sjbc", culateService.culateSjbc(lists, "")); | |
| 2754 | + map.put("sjbc_m", culateService.culateSjbc(lists, "zgf")); | |
| 2755 | + map.put("sjbc_a", culateService.culateSjbc(lists, "wgf")); | |
| 2756 | + map.put("ljbc", culateService.culateLjbc(lists, "")); | |
| 2757 | + map.put("ljbc_m", culateService.culateLjbc(lists, "zgf")); | |
| 2758 | + map.put("ljbc_a", culateService.culateLjbc(lists, "wgf")); | |
| 2759 | + map.put("fzbc", culateService.culateFzbc(lists, "")); | |
| 2760 | + map.put("fzbc_m", culateService.culateFzbc(lists, "zgf")); | |
| 2761 | + map.put("fzbc_a", culateService.culateFzbc(lists, "wgf")); | |
| 2762 | + map.put("dtbc", 0); | |
| 2763 | + map.put("dtbc_m", 0); | |
| 2764 | + map.put("dtbc_a", 0); | |
| 2765 | + List<CalcInterval> intervalList=calcIntervalRepository.selectByDateAndLine(line, date,""); | |
| 2766 | + if(intervalList.size()>0){ | |
| 2767 | + CalcInterval c=intervalList.get(0); | |
| 2768 | + map.put("djg",c.getDjgAll()); | |
| 2769 | + map.put("djg_m", c.getDjgZgf()); | |
| 2770 | + map.put("djg_a", c.getDjgWgf()); | |
| 2771 | + map.put("djg_time", c.getDjgTime()); | |
| 2772 | + }else{ | |
| 2773 | + Map<String, Object> m = culateService.culateDjg(list_s, line); | |
| 2774 | + map.put("djg", m.get("djgcsq")); | |
| 2775 | + map.put("djg_m", m.get("djgcsz")); | |
| 2776 | + map.put("djg_a", m.get("djgcsw")); | |
| 2777 | + map.put("djg_time", m.get("djgsj")); | |
| 2778 | + } | |
| 2779 | + | |
| 2780 | + map.put("jls", Arith.sub(Arith.add(jhlc, ljgl), lbgl)); | |
| 2781 | + lMap.add(map); | |
| 2782 | + | |
| 2783 | + if (date.length() == 10) { | |
| 2784 | + List<DutyEmployee> list = dutyEmployeeService.getDutyEmployee(line, date + "00:01", date + "23:59"); | |
| 2785 | + String dbdp = ""; | |
| 2786 | + try { | |
| 2787 | + for (int i = 0; i < list.size(); i++) { | |
| 2788 | + DutyEmployee t = list.get(i); | |
| 2789 | + if (dbdp.indexOf(t.getuName()) == -1) { | |
| 2790 | + if (!(dbdp.length() > 0)) { | |
| 2791 | + dbdp = t.getuName(); | |
| 2792 | + } else { | |
| 2793 | + dbdp += "," + t.getuName(); | |
| 2794 | + } | |
| 2795 | + } | |
| 2796 | + } | |
| 2797 | + } catch (Exception e) { | |
| 2798 | + // TODO: handle exception | |
| 2799 | + e.printStackTrace(); | |
| 2800 | + } | |
| 2801 | + map.put("dbdp", dbdp); | |
| 2802 | + } | |
| 2803 | + | |
| 2804 | + return lMap; | |
| 2805 | + } | |
| 2806 | + | |
| 2807 | + @Override | |
| 2808 | + public List<Map<String, Object>> statisticsDaily_mh_2(String line, String date, | |
| 2809 | + String xlName, String type) { | |
| 2810 | + List<Map<String, Object>> lMap = new ArrayList<Map<String, Object>>(); | |
| 2811 | + List<ScheduleRealInfo> list_s = scheduleRealInfoRepository.scheduleByDateAndLine2(line, date); | |
| 2812 | + List<ScheduleRealInfo> lists = new ArrayList<ScheduleRealInfo>(); | |
| 2813 | + for (int i = 0; i < list_s.size(); i++) { | |
| 2814 | + ScheduleRealInfo s = list_s.get(i); | |
| 2815 | + if (s.isDestroy() && s.isReissue()) { | |
| 2816 | + s.setRemark(""); | |
| 2817 | + s.setFcsjActual(s.getDfsj()); | |
| 2818 | + s.setZdsjActual(s.getZdsj()); | |
| 2819 | + s.setStatus(2); | |
| 2820 | + s.setJhlc(s.getJhlcOrig()); | |
| 2821 | + } | |
| 2822 | + | |
| 2823 | + Set<ChildTaskPlan> cts = s.getcTasks(); | |
| 2824 | + if (cts != null && cts.size() > 0) { | |
| 2825 | + lists.add(s); | |
| 2826 | + } else { | |
| 2827 | + if (s.getZdsjActual() != null && s.getFcsjActual() != null) { | |
| 2828 | + lists.add(s); | |
| 2829 | + } | |
| 2830 | + } | |
| 2831 | + } | |
| 2832 | + Map<String, Object> map = new HashMap<String, Object>(); | |
| 2833 | + map.put("xlName", xlName); | |
| 2834 | + double jhlc = culateService.culateJhgl(list_s); | |
| 2835 | + map.put("jhlc", jhlc); | |
| 2836 | + map.put("sjgl", Arith.add(culateService.culateSjgl(lists), culateService.culateLjgl(lists))); | |
| 2837 | + double lbgl = culateService.culateLbgl(list_s); | |
| 2838 | + map.put("ssgl", lbgl); | |
| 2839 | + map.put("ssgl_lz", culateService.culateCJLC(list_s, "路阻")); | |
| 2840 | + map.put("ssgl_dm", culateService.culateCJLC(list_s, "吊慢")); | |
| 2841 | + map.put("ssgl_gz", culateService.culateCJLC(list_s, "故障")); | |
| 2842 | + map.put("ssgl_jf", culateService.culateCJLC(list_s, "纠纷")); | |
| 2843 | + map.put("ssgl_zs", culateService.culateCJLC(list_s, "肇事")); | |
| 2844 | + map.put("ssgl_qr", culateService.culateCJLC(list_s, "缺人")); | |
| 2845 | + map.put("ssgl_qc", culateService.culateCJLC(list_s, "缺车")); | |
| 2846 | + map.put("ssgl_kx", culateService.culateCJLC(list_s, "客稀")); | |
| 2847 | + map.put("ssgl_qh", culateService.culateCJLC(list_s, "气候")); | |
| 2848 | + map.put("ssgl_yw", culateService.culateCJLC(list_s, "援外")); | |
| 2849 | + map.put("ssgl_ljpm", culateService.culateCJLC(list_s, "路救抛锚")); | |
| 2850 | + double ssgl_pc = culateService.culateCJLC(list_s, "配车"); | |
| 2851 | + double ssgl_by = culateService.culateCJLC(list_s, "保养"); | |
| 2852 | + double ssgl_cj = culateService.culateCJLC(list_s, "抽减"); | |
| 2853 | + double ssgl_qt = culateService.culateCJLC(list_s, "其他"); | |
| 2854 | + map.put("ssgl_other", Arith.add(Arith.add(ssgl_pc, ssgl_by), Arith.add(ssgl_cj, ssgl_qt))); | |
| 2855 | + map.put("ssbc", culateService.culateLbbc(list_s)); | |
| 2856 | + double ljgl = culateService.culateLjgl(lists); | |
| 2857 | + map.put("ljgl", ljgl); | |
| 2858 | + map.put("jhbc", culateService.culateJhbc(list_s, "")); | |
| 2859 | + map.put("jhbc_m", culateService.culateJhbc(list_s, "zgf")); | |
| 2860 | + map.put("jhbc_a", culateService.culateJhbc(list_s, "wgf")); | |
| 2861 | + map.put("sjbc", culateService.culateSjbc(lists, "")); | |
| 2862 | + map.put("sjbc_m", culateService.culateSjbc(lists, "zgf")); | |
| 2863 | + map.put("sjbc_a", culateService.culateSjbc(lists, "wgf")); | |
| 2864 | + map.put("ljbc", culateService.culateLjbc(lists, "")); | |
| 2865 | + map.put("ljbc_m", culateService.culateLjbc(lists, "zgf")); | |
| 2866 | + map.put("ljbc_a", culateService.culateLjbc(lists, "wgf")); | |
| 2867 | + map.put("fzbc", culateService.culateFzbc(lists, "")); | |
| 2868 | + map.put("fzbc_m", culateService.culateFzbc(lists, "zgf")); | |
| 2869 | + map.put("fzbc_a", culateService.culateFzbc(lists, "wgf")); | |
| 2870 | + map.put("dtbc", 0); | |
| 2871 | + map.put("dtbc_m", 0); | |
| 2872 | + map.put("dtbc_a", 0); | |
| 2873 | + map.put("djg", 0); | |
| 2874 | + map.put("djg_m", 0); | |
| 2875 | + map.put("djg_a", 0); | |
| 2876 | + map.put("djg_time", 0); | |
| 2877 | + map.put("jls", Arith.sub(Arith.add(jhlc, ljgl), lbgl)); | |
| 2878 | + lMap.add(map); | |
| 2879 | + return lMap; | |
| 2880 | + } | |
| 2881 | + | |
| 2882 | + public final Map<String, Object> staticTj(List<ScheduleRealInfo> list,Map<String, Object> m) { | |
| 2883 | + | |
| 2884 | + List<ScheduleRealInfo> lists = new ArrayList<ScheduleRealInfo>(); | |
| 2885 | + for (int i = 0; i < list.size(); i++) { | |
| 2886 | + ScheduleRealInfo s = list.get(i); | |
| 2887 | + Set<ChildTaskPlan> cts = s.getcTasks(); | |
| 2888 | + if (cts != null && cts.size() > 0) { | |
| 2889 | + lists.add(s); | |
| 2890 | + } else { | |
| 2891 | + if (s.getZdsjActual() != null && s.getFcsjActual() != null) { | |
| 2892 | + lists.add(s); | |
| 2893 | + } | |
| 2894 | + } | |
| 2895 | + } | |
| 2896 | + Map<String, Object> map = new HashMap<String, Object>(); | |
| 2897 | + if (list.size() > 0) { | |
| 2898 | + map.put("gsBm", list.get(0).getGsBm()); | |
| 2899 | + map.put("fgsBm", list.get(0).getFgsBm()); | |
| 2900 | + map.put("xlBm", list.get(0).getXlBm()); | |
| 2901 | + map.put("xlName", list.get(0).getXlName()); | |
| 2902 | + map.put("fgsName", list.get(0).getFgsName()); | |
| 2903 | + map.put("gsName", list.get(0).getGsName()); | |
| 2904 | + | |
| 2905 | + try { | |
| 2906 | + map.put("xlNamePy", PinyinHelper.convertToPinyinString(list.get(0).getGsBm()+list.get(0).getFgsBm()+list.get(0).getXlName(), "", PinyinFormat.WITHOUT_TONE)); | |
| 2907 | + } catch (PinyinException e) { | |
| 2908 | + // TODO Auto-generated catch block | |
| 2909 | + e.printStackTrace(); | |
| 2910 | + } | |
| 2911 | + double jhyygl = culateService.culateJhgl(list);//计划营运公里 | |
| 2912 | + double jhjcclc = culateService.culateJhJccgl(list);//计划进出场公里(计划空驶公里) | |
| 2913 | + map.put("jhlc", jhyygl); | |
| 2914 | + map.put("jcclc", jhjcclc); | |
| 2915 | + map.put("jhzlc", Arith.add(jhyygl, jhjcclc)); | |
| 2916 | + double ljks=culateService.culateLjksgl(lists); | |
| 2917 | + map.put("ljks", ljks); | |
| 2918 | + double ljgl = culateService.culateLjgl(lists); | |
| 2919 | + double sjyygl = culateService.culateSjgl(lists); | |
| 2920 | + double zyygl = Arith.add(sjyygl, ljgl); | |
| 2921 | + | |
| 2922 | + double sjjccgl = culateService.culateJccgl(lists); | |
| 2923 | + double sjksgl = culateService.culateKsgl(lists); | |
| 2924 | + double zksgl = Arith.add(sjjccgl, sjksgl); | |
| 2925 | + map.put("sjzgl", Arith.add(zyygl, zksgl)); | |
| 2926 | + map.put("sjgl", zyygl); | |
| 2927 | + map.put("sjksgl", zksgl); | |
| 2928 | + double ssgl = culateService.culateLbgl(list); | |
| 2929 | + map.put("ssgl", ssgl); | |
| 2930 | + | |
| 2931 | + //计划+临加-少驶=实驶 | |
| 2932 | + double jl = Arith.sub(Arith.add(jhyygl, ljgl), ssgl); | |
| 2933 | + if (jl == zyygl) { | |
| 2934 | + map.put("zt", 0); | |
| 2935 | + } else { | |
| 2936 | + map.put("zt", 1); | |
| 2937 | + } | |
| 2938 | + | |
| 2939 | + map.put("ssgl_lz", culateService.culateCJLC(list, "路阻")); | |
| 2940 | + map.put("ssgl_dm", culateService.culateCJLC(list, "吊慢")); | |
| 2941 | + map.put("ssgl_gz", culateService.culateCJLC(list, "故障")); | |
| 2942 | + map.put("ssgl_jf", culateService.culateCJLC(list, "纠纷")); | |
| 2943 | + map.put("ssgl_zs", culateService.culateCJLC(list, "肇事")); | |
| 2944 | + map.put("ssgl_qr", culateService.culateCJLC(list, "缺人")); | |
| 2945 | + map.put("ssgl_qc", culateService.culateCJLC(list, "缺车")); | |
| 2946 | + map.put("ssgl_kx", culateService.culateCJLC(list, "客稀")); | |
| 2947 | + map.put("ssgl_qh", culateService.culateCJLC(list, "气候")); | |
| 2948 | + map.put("ssgl_yw", culateService.culateCJLC(list, "援外")); | |
| 2949 | + map.put("ssgl_ljpm", culateService.culateCJLC(list, "路救抛锚")); | |
| 2950 | + double ssgl_pc = culateService.culateCJLC(list, "配车"); | |
| 2951 | + double ssgl_by = culateService.culateCJLC(list, "保养"); | |
| 2952 | + double ssgl_cj = culateService.culateCJLC(list, "抽减"); | |
| 2953 | + double ssgl_qt = culateService.culateCJLC(list, "其他"); | |
| 2954 | + map.put("ssgl_other", Arith.add(Arith.add(ssgl_pc, ssgl_by), Arith.add(ssgl_cj, ssgl_qt))); | |
| 2955 | + map.put("ssbc", culateService.culateLbbc(list)); | |
| 2956 | + map.put("ljgl", ljgl); | |
| 2957 | + map.put("jhbc", culateService.culateJhbc(list, "")); | |
| 2958 | + map.put("jhbc_m", culateService.culateJhbc(list, "zgf")); | |
| 2959 | + map.put("jhbc_a", culateService.culateJhbc(list, "wgf")); | |
| 2960 | + map.put("sjbc", culateService.culateSjbc(lists, "")); | |
| 2961 | + map.put("sjbc_m", culateService.culateSjbc(lists, "zgf")); | |
| 2962 | + map.put("sjbc_a", culateService.culateSjbc(lists, "wgf")); | |
| 2963 | + map.put("ljbc", culateService.culateLjbc(lists, "")); | |
| 2964 | + map.put("ljbc_m", culateService.culateLjbc(lists, "zgf")); | |
| 2965 | + map.put("ljbc_a", culateService.culateLjbc(lists, "wgf")); | |
| 2966 | + map.put("fzbc", culateService.culateFzbc(lists, "")); | |
| 2967 | + map.put("fzbc_m", culateService.culateFzbc(lists, "zgf")); | |
| 2968 | + map.put("fzbc_a", culateService.culateFzbc(lists, "wgf")); | |
| 2969 | + map.put("dtbc", 0); | |
| 2970 | + map.put("dtbc_m", 0); | |
| 2971 | + map.put("dtbc_a", 0); | |
| 2972 | + if(m.get("xl")==null){ | |
| 2973 | + Map<String, Object> m_ = culateService.culateDjg(lists, list.get(0).getXlBm()); | |
| 2974 | + map.put("djg", m_.get("djgcsq")); | |
| 2975 | + map.put("djg_m", m_.get("djgcsz")); | |
| 2976 | + map.put("djg_a", m_.get("djgcsw")); | |
| 2977 | + map.put("djg_time", m_.get("djgsj")); | |
| 2978 | + }else{ | |
| 2979 | + map.put("djg", m.get("djgAll")==null?"0":m.get("djgAll")); | |
| 2980 | + map.put("djg_m", m.get("djgZgf")==null?"0":m.get("djgZgf")); | |
| 2981 | + map.put("djg_a", m.get("djgWgf")==null?"0":m.get("djgWgf")); | |
| 2982 | + map.put("djg_time", m.get("djgTime")==null?"0":m.get("djgTime")); | |
| 2983 | + } | |
| 2984 | + } | |
| 2985 | + return map; | |
| 2986 | + } | |
| 2987 | + | |
| 2988 | + @Override | |
| 2989 | + public List<Map<String, Object>> dispatchDailySum(String date, String date2, String nature, String type) { | |
| 2990 | + List<Map<String, Object>> resList = new ArrayList<Map<String, Object>>(); | |
| 2991 | + | |
| 2992 | +// List<Map<String, Object>> list = statisticsDailyTj("", "", "", date, date2, "", "query", nature); | |
| 2993 | + List<CalcStatistics> calc = calcWaybillService.calcStatisticsDaily("", "", "", date, date2, "", "query", nature); | |
| 2994 | + List<Map<String, Object>> list = new ArrayList<Map<String, Object>>(); | |
| 2995 | + try { | |
| 2996 | + List<Map<String, Object>> tempList = new ArrayList<Map<String, Object>>(); | |
| 2997 | + for(CalcStatistics c : calc){ | |
| 2998 | + Map<String, Object> m = new HashMap<>(); | |
| 2999 | + Field[] fields = c.getClass().getDeclaredFields(); | |
| 3000 | + for(Field f : fields){ | |
| 3001 | + f.setAccessible(true); | |
| 3002 | + String key = new String(f.getName()); | |
| 3003 | + m.put(key, f.get(c)); | |
| 3004 | + } | |
| 3005 | + tempList.add(m); | |
| 3006 | + } | |
| 3007 | + list = tempList; | |
| 3008 | + } catch (Exception e) { | |
| 3009 | + // TODO: handle exception | |
| 3010 | + e.printStackTrace(); | |
| 3011 | + } | |
| 3012 | + | |
| 3013 | + List<Business> allBusiness = businessRepository.getOrder(); | |
| 3014 | + Set<String> gsFgsSet = new HashSet<String>(); // 有排序编号的公司,防止乱序或者合计值出问题。 | |
| 3015 | + for(Business b : allBusiness){ | |
| 3016 | + gsFgsSet.add(b.getUpCode() + "_" + b.getBusinessCode()); | |
| 3017 | + gsFgsSet.add(b.getBusinessCode()); | |
| 3018 | + } | |
| 3019 | + | |
| 3020 | + Map<String, Map<String, Object>> keyMap = new HashMap<String, Map<String, Object>>(); | |
| 3021 | + List<String> keyList = new ArrayList<String>(); | |
| 3022 | + | |
| 3023 | + Map<String, Object> hj = new HashMap<String, Object>(); // 合计 | |
| 3024 | + hj.put("gsName", "合计"); | |
| 3025 | + hj.put("fgsBm", " "); | |
| 3026 | + | |
| 3027 | + for(Map<String, Object> m : list){ | |
| 3028 | + m.put("gsBm", m.get("gsdm")); | |
| 3029 | + m.put("fgsBm", m.get("fgsdm")); | |
| 3030 | + if(m.get("gsBm") != null && m.get("fgsBm") != null | |
| 3031 | + && m.get("gsBm").toString().trim().length() > 0 | |
| 3032 | + && m.get("fgsBm").toString().trim().length() > 0){ | |
| 3033 | + String gsBm = m.get("gsBm").toString().trim(); | |
| 3034 | + String fgsBm = m.get("fgsBm").toString().trim(); | |
| 3035 | + String key = gsBm + "_" + fgsBm; // 分公司key | |
| 3036 | + String key2 = gsBm + "_sum"; // 直属公司key | |
| 3037 | + if(!gsFgsSet.contains(key) && !gsFgsSet.contains(gsBm)){ | |
| 3038 | + continue; | |
| 3039 | + } | |
| 3040 | + if(!keyMap.containsKey(key)){ // 每个分公司一条 | |
| 3041 | + Map<String, Object> t = new HashMap<String, Object>(); | |
| 3042 | + t.put("gsName", m.get("gsName")); | |
| 3043 | + t.put("fgsName", m.get("fgsName")); | |
| 3044 | + t.put("key", key); | |
| 3045 | + keyMap.put(key, t); | |
| 3046 | + keyList.add(key); | |
| 3047 | + if(!keyMap.containsKey(key2)){ // 直属公司小计 | |
| 3048 | + Map<String, Object> t2 = new HashMap<String, Object>(); | |
| 3049 | + t2.put("gsName", m.get("gsName")); | |
| 3050 | + t2.put("fgsName", "小计"); | |
| 3051 | + t2.put("key", key2); | |
| 3052 | + keyMap.put(key2, t2); | |
| 3053 | + keyList.add(key2); | |
| 3054 | + } | |
| 3055 | + } | |
| 3056 | + Map<String, Object> t = keyMap.get(key); | |
| 3057 | + Map<String, Object> t2 = keyMap.get(key2); | |
| 3058 | + for(String s : m.keySet()){ | |
| 3059 | + if("gsName,fgsName,key".contains(s)){ | |
| 3060 | + continue; | |
| 3061 | + } | |
| 3062 | + try { | |
| 3063 | + if(t.containsKey(s)){ // 分公司 | |
| 3064 | + t.put(s, new BigDecimal(t.get(s).toString()).add(new BigDecimal(m.get(s).toString()))); | |
| 3065 | + } else { | |
| 3066 | + t.put(s, m.get(s).toString()); | |
| 3067 | + } | |
| 3068 | + if(t2.containsKey(s)){ // 直属公司 | |
| 3069 | + t2.put(s, new BigDecimal(t2.get(s).toString()).add(new BigDecimal(m.get(s).toString()))); | |
| 3070 | + } else { | |
| 3071 | + t2.put(s, m.get(s).toString()); | |
| 3072 | + } | |
| 3073 | + if(hj.containsKey(s)){ // 合计 | |
| 3074 | + hj.put(s, new BigDecimal(hj.get(s).toString()).add(new BigDecimal(m.get(s).toString()))); | |
| 3075 | + } else { | |
| 3076 | + hj.put(s, m.get(s).toString()); | |
| 3077 | + } | |
| 3078 | + } catch (Exception e) { | |
| 3079 | + // TODO: handle exception | |
| 3080 | + continue; | |
| 3081 | + } | |
| 3082 | + } | |
| 3083 | + } | |
| 3084 | + } | |
| 3085 | + | |
| 3086 | + for(Business b : allBusiness){ // 根据公司排序插入返回对象 | |
| 3087 | + String gs = b.getBusinessCode(); | |
| 3088 | + String gsfgs = b.getUpCode() + "_" + b.getBusinessCode(); | |
| 3089 | + for(String key : keyList){ | |
| 3090 | + if(key.equals(gsfgs)){ | |
| 3091 | + resList.add(keyMap.get(key)); | |
| 3092 | + break; | |
| 3093 | + } else if(key.replaceAll("_sum", "").equals(gs)){ | |
| 3094 | + resList.add(keyMap.get(key)); | |
| 3095 | + break; | |
| 3096 | + } | |
| 3097 | + } | |
| 3098 | + } | |
| 3099 | + resList.add(hj); | |
| 3100 | + | |
| 3101 | + for(Map<String, Object> m : resList){ | |
| 3102 | + try { | |
| 3103 | + m.put("jhzlc", m.get("jhzlc")); | |
| 3104 | + m.put("jhlc", m.get("jhyylc")); | |
| 3105 | + m.put("jcclc", m.get("jhkslc")); | |
| 3106 | + m.put("sjzgl", m.get("sjzlc")); | |
| 3107 | + m.put("sjgl", m.get("sjyylc")); | |
| 3108 | + m.put("sjksgl", m.get("sjkslc")); | |
| 3109 | + m.put("ssbc", m.get("ssbc")); | |
| 3110 | + m.put("ssgl", m.get("sslc")); | |
| 3111 | + m.put("ssgl_lz", m.get("lzlc")); | |
| 3112 | + m.put("ssgl_dm", m.get("dmlc")); | |
| 3113 | + m.put("ssgl_gz", m.get("gzlc")); | |
| 3114 | + m.put("ssgl_jf", m.get("jflc")); | |
| 3115 | + m.put("ssgl_zs", m.get("zslc")); | |
| 3116 | + m.put("ssgl_qr", m.get("qrlc")); | |
| 3117 | + m.put("ssgl_qc", m.get("qclc")); | |
| 3118 | + m.put("ssgl_kx", m.get("kxlc")); | |
| 3119 | + m.put("ssgl_qh", m.get("qhlc")); | |
| 3120 | + m.put("ssgl_yw", m.get("ywlc")); | |
| 3121 | + m.put("ssgl_ljpm", m.get("ljpmlc")); | |
| 3122 | + m.put("ssgl_other", m.get("qtlc")); | |
| 3123 | + m.put("ljgl", m.get("ljlc")); | |
| 3124 | + m.put("ljks", m.get("ljkslc")); | |
| 3125 | + m.put("jhbc", m.get("jhbcq")); | |
| 3126 | + m.put("jhbc_m", m.get("jhbcz")); | |
| 3127 | + m.put("jhbc_a", m.get("jhbcw")); | |
| 3128 | + m.put("sjbc", m.get("sjbcq")); | |
| 3129 | + m.put("sjbc_m", m.get("sjbcz")); | |
| 3130 | + m.put("sjbc_a", m.get("sjbcw")); | |
| 3131 | + m.put("ljbc", m.get("ljbcq")); | |
| 3132 | + m.put("ljbc_m", m.get("ljbcz")); | |
| 3133 | + m.put("ljbc_a", m.get("ljbcw")); | |
| 3134 | + m.put("fzbc", m.get("fzbcq")); | |
| 3135 | + m.put("fzbc_m", m.get("fzbcz")); | |
| 3136 | + m.put("fzbc_a", m.get("fzbcw")); | |
| 3137 | + m.put("dtbc", m.get("dtbcq")); | |
| 3138 | + m.put("dtbc_m", m.get("dtbcz")); | |
| 3139 | + m.put("dtbc_a", m.get("dtbcw")); | |
| 3140 | + m.put("djg", m.get("djgq")); | |
| 3141 | + m.put("djg_m", m.get("djgz")); | |
| 3142 | + m.put("djg_a", m.get("djgw")); | |
| 3143 | + m.put("djg_time", m.get("djgsj")); | |
| 3144 | + m.put("ljzgl", new BigDecimal(m.get("ljgl").toString()).add(new BigDecimal(m.get("ljks").toString()))); | |
| 3145 | + } catch (Exception e) { | |
| 3146 | + // TODO: handle exception | |
| 3147 | + m.put("ljzgl", ""); | |
| 3148 | + continue; | |
| 3149 | + } | |
| 3150 | + } | |
| 3151 | + | |
| 3152 | + if (type != null && type.length() != 0 && type.equals("export")) { | |
| 3153 | + SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"), | |
| 3154 | + sdfSimple = new SimpleDateFormat("yyyyMMdd"); | |
| 3155 | + List<Iterator<?>> listI = new ArrayList<Iterator<?>>(); | |
| 3156 | + Map<String, Object> m = new HashMap<String, Object>(); | |
| 3157 | + ReportUtils ee = new ReportUtils(); | |
| 3158 | + try { | |
| 3159 | + String dateTime = ""; | |
| 3160 | + if (date.equals(date2)) { | |
| 3161 | + m.put("date", date); | |
| 3162 | + dateTime = sdfSimple.format(sdfMonth.parse(date)); | |
| 3163 | + } else { | |
| 3164 | + m.put("date", date + "至" + date2); | |
| 3165 | + dateTime = sdfSimple.format(sdfMonth.parse(date)) | |
| 3166 | + + "-" + sdfSimple.format(sdfMonth.parse(date2)); | |
| 3167 | + } | |
| 3168 | + listI.add(resList.iterator()); | |
| 3169 | + String path = this.getClass().getResource("/").getPath() + "static/pages/forms/"; | |
| 3170 | + ee.excelReplace(listI, new Object[]{m}, path + "mould/dispatchDailySum.xls", | |
| 3171 | + path + "export/" + dateTime + "-调度日报汇总表.xls"); | |
| 3172 | + } catch (Exception e) { | |
| 3173 | + // TODO: handle exception | |
| 3174 | + //e.printStackTrace(); | |
| 3175 | + logger.info("", e); | |
| 3176 | + } | |
| 3177 | + } | |
| 3178 | + | |
| 3179 | + return resList; | |
| 3180 | + } | |
| 3181 | + | |
| 3182 | + @Override | |
| 3183 | + public List<Map<String, Object>> statisticsDailyTj(String gsdm, String fgsdm, String line, String date, String date2, | |
| 3184 | + String xlName, String type,String nature) { | |
| 3185 | + List<ScheduleRealInfo> listAll = new ArrayList<ScheduleRealInfo>(); | |
| 3186 | + List<ScheduleRealInfo> list_s = new ArrayList<ScheduleRealInfo>(); | |
| 3187 | + List<ScheduleRealInfo> lists = new ArrayList<ScheduleRealInfo>(); | |
| 3188 | + List<Object[]> listInterval=new ArrayList<Object[]>(); | |
| 3189 | + line = line.trim(); | |
| 3190 | + if(gsdm.equals("") && fgsdm.equals("") && line.equals("")){ | |
| 3191 | + //查询所有公司 | |
| 3192 | + listAll = scheduleRealInfoRepository.scheduleByDateAndLineTj3(date, date2); | |
| 3193 | + listInterval = calcIntervalRepository.countByDate(date, date2); | |
| 3194 | + } else if (line.equals("")) { | |
| 3195 | + //查询所有线路 | |
| 3196 | + listAll = scheduleRealInfoRepository.scheduleByDateAndLineTj(line, date, date2, gsdm, fgsdm); | |
| 3197 | + listInterval = calcIntervalRepository.countByDateAndLine(gsdm, fgsdm, date, date2); | |
| 3198 | + } else { | |
| 3199 | + //查询单条线路 | |
| 3200 | + listAll = scheduleRealInfoRepository.scheduleByDateAndLineTj2(line, date, date2); | |
| 3201 | + listInterval = calcIntervalRepository.countByDateAndLine(line, date, date2); | |
| 3202 | + } | |
| 3203 | + Map<String, Map<String,Object>> mapInterval=new HashMap<String, Map<String,Object>>(); | |
| 3204 | + for (int i = 0; i < listInterval.size(); i++) { | |
| 3205 | + Object[] interval=listInterval.get(i); | |
| 3206 | + String gs=interval[0].toString(); | |
| 3207 | + String fgs=interval[1].toString(); | |
| 3208 | + String xl=interval[2].toString(); | |
| 3209 | + Map<String, Object> m=new HashMap<String,Object>(); | |
| 3210 | + m.put("gs", gs); | |
| 3211 | + m.put("fgs", fgs); | |
| 3212 | + m.put("xl", xl); | |
| 3213 | + m.put("djgAll", interval[3]); | |
| 3214 | + m.put("djgZgf", interval[6]); | |
| 3215 | + m.put("djgWgf", interval[7]); | |
| 3216 | + m.put("djgTime", interval[8]); | |
| 3217 | + mapInterval.put(gs+"-"+fgs+"-"+xl, m); | |
| 3218 | + } | |
| 3219 | + Map<String, Boolean> lineMap=lineService.lineNature(); | |
| 3220 | + List<ScheduleRealInfo> list=new ArrayList<ScheduleRealInfo>(); | |
| 3221 | + for (int i = 0; i < listAll.size(); i++) { | |
| 3222 | + ScheduleRealInfo s=listAll.get(i); | |
| 3223 | + if (nature.equals("0")) { | |
| 3224 | + list.add(s); | |
| 3225 | + }else if(nature.equals("1")){ | |
| 3226 | + if(lineMap.get(s.getXlBm())){ | |
| 3227 | + list.add(s); | |
| 3228 | + } | |
| 3229 | + }else{ | |
| 3230 | + if(!lineMap.get(s.getXlBm())){ | |
| 3231 | + list.add(s); | |
| 3232 | + } | |
| 3233 | + } | |
| 3234 | + } | |
| 3235 | + for (int i = 0; i < list.size(); i++) { | |
| 3236 | + ScheduleRealInfo s = list.get(i); | |
| 3237 | + Set<ChildTaskPlan> cts = s.getcTasks(); | |
| 3238 | + if (cts != null && cts.size() > 0) { | |
| 3239 | + list_s.add(s); | |
| 3240 | + } else { | |
| 3241 | + if (s.getZdsjActual() != null && s.getFcsjActual() != null) { | |
| 3242 | + list_s.add(s); | |
| 3243 | + } | |
| 3244 | + } | |
| 3245 | + } | |
| 3246 | + List<Map<String, Object>> lMap = new ArrayList<Map<String, Object>>(); | |
| 3247 | + for (int i = 0; i < list.size(); i++) { | |
| 3248 | + if (i < list.size() - 1) { | |
| 3249 | + if ((list.get(i+1).getGsBm()+"/"+list.get(i+1).getFgsBm()+"/"+list.get(i+1).getXlBm()).equals( | |
| 3250 | + list.get(i).getGsBm()+"/"+list.get(i).getFgsBm()+"/"+list.get(i).getXlBm())) { | |
| 3251 | + lists.add(list.get(i)); | |
| 3252 | + } else { | |
| 3253 | + lists.add(list.get(i)); | |
| 3254 | + Map<String, Object> mm=new HashMap<String,Object>(); | |
| 3255 | + if(mapInterval.get(lists.get(0).getGsBm()+"-"+lists.get(0).getFgsBm()+"-"+lists.get(0).getXlBm())!=null){ | |
| 3256 | + mm=mapInterval.get(lists.get(0).getGsBm()+"-"+lists.get(0).getFgsBm()+"-"+lists.get(0).getXlBm()); | |
| 3257 | + } | |
| 3258 | + Map<String, Object> map = staticTj(lists,mm); | |
| 3259 | + lMap.add(map); | |
| 3260 | + lists = new ArrayList<ScheduleRealInfo>(); | |
| 3261 | + } | |
| 3262 | + } else { | |
| 3263 | + if ((list.get(i).getGsBm()+"/"+list.get(i).getFgsBm()+"/"+list.get(i).getXlBm()).equals( | |
| 3264 | + list.get(i-1).getGsBm()+"/"+list.get(i-1).getFgsBm()+"/"+list.get(i-1).getXlBm())) { | |
| 3265 | + lists.add(list.get(i)); | |
| 3266 | + Map<String, Object> mm=new HashMap<String,Object>(); | |
| 3267 | + if(mapInterval.get(lists.get(0).getGsBm()+"-"+lists.get(0).getFgsBm()+"-"+lists.get(0).getXlBm())!=null){ | |
| 3268 | + mm=mapInterval.get(lists.get(0).getGsBm()+"-"+lists.get(0).getFgsBm()+"-"+lists.get(0).getXlBm()); | |
| 3269 | + } | |
| 3270 | + Map<String, Object> map = staticTj(lists,mm); | |
| 3271 | + lMap.add(map); | |
| 3272 | + } else { | |
| 3273 | + lists = new ArrayList<ScheduleRealInfo>(); | |
| 3274 | + lists.add(list.get(i)); | |
| 3275 | + Map<String, Object> mm=new HashMap<String,Object>(); | |
| 3276 | + if(mapInterval.get(lists.get(0).getGsBm()+"-"+lists.get(0).getFgsBm()+"-"+lists.get(0).getXlBm())!=null){ | |
| 3277 | + mm=mapInterval.get(lists.get(0).getGsBm()+"-"+lists.get(0).getFgsBm()+"-"+lists.get(0).getXlBm()); | |
| 3278 | + } | |
| 3279 | + Map<String, Object> map = staticTj(lists,mm); | |
| 3280 | + lMap.add(map); | |
| 3281 | + } | |
| 3282 | + } | |
| 3283 | + } | |
| 3284 | + | |
| 3285 | + Collections.sort(lMap, new AccountXlbm()); | |
| 3286 | + Map<String, Object> map = new HashMap<String, Object>(); | |
| 3287 | + map.put("xlName", "合计"); | |
| 3288 | + map.put("fgsName", ""); | |
| 3289 | + map.put("gsName", ""); | |
| 3290 | + double jhyygl = culateService.culateJhgl(list);//计划营运公里 | |
| 3291 | + double jhjcclc = culateService.culateJhJccgl(list);//计划进出场公里(计划空驶公里) | |
| 3292 | + map.put("jhlc", jhyygl); | |
| 3293 | + map.put("jcclc", jhjcclc); | |
| 3294 | + map.put("jhzlc", Arith.add(jhyygl, jhjcclc)); | |
| 3295 | + | |
| 3296 | + double ljgl = culateService.culateLjgl(list_s); | |
| 3297 | + double sjyygl = culateService.culateSjgl(list_s); | |
| 3298 | + double zyygl = Arith.add(sjyygl, ljgl); | |
| 3299 | + double ljks=culateService.culateLjksgl(list_s); | |
| 3300 | + map.put("ljks", ljks); | |
| 3301 | + double sjjccgl = culateService.culateJccgl(list_s); | |
| 3302 | + double sjksgl = culateService.culateKsgl(list_s); | |
| 3303 | + double zksgl = Arith.add(sjjccgl, sjksgl); | |
| 3304 | + map.put("sjzgl", Arith.add(zyygl, zksgl)); | |
| 3305 | + map.put("sjgl", zyygl); | |
| 3306 | + map.put("sjksgl", zksgl); | |
| 3307 | + | |
| 3308 | + double ssgl = culateService.culateLbgl(list); | |
| 3309 | + map.put("ssgl", ssgl); | |
| 3310 | + //计划+临加-少驶=实驶 | |
| 3311 | + double jl = Arith.sub(Arith.add(jhyygl, ljgl), ssgl); | |
| 3312 | + if (jl == zyygl) { | |
| 3313 | + map.put("zt", 0); | |
| 3314 | + } else { | |
| 3315 | + map.put("zt", 1); | |
| 3316 | + } | |
| 3317 | + map.put("ssgl_lz", culateService.culateCJLC(list, "路阻")); | |
| 3318 | + map.put("ssgl_dm", culateService.culateCJLC(list, "吊慢")); | |
| 3319 | + map.put("ssgl_gz", culateService.culateCJLC(list, "故障")); | |
| 3320 | + map.put("ssgl_jf", culateService.culateCJLC(list, "纠纷")); | |
| 3321 | + map.put("ssgl_zs", culateService.culateCJLC(list, "肇事")); | |
| 3322 | + map.put("ssgl_qr", culateService.culateCJLC(list, "缺人")); | |
| 3323 | + map.put("ssgl_qc", culateService.culateCJLC(list, "缺车")); | |
| 3324 | + map.put("ssgl_kx", culateService.culateCJLC(list, "客稀")); | |
| 3325 | + map.put("ssgl_qh", culateService.culateCJLC(list, "气候")); | |
| 3326 | + map.put("ssgl_yw", culateService.culateCJLC(list, "援外")); | |
| 3327 | + map.put("ssgl_ljpm", culateService.culateCJLC(list, "路救抛锚")); | |
| 3328 | + double ssgl_pc = culateService.culateCJLC(list, "配车"); | |
| 3329 | + double ssgl_by = culateService.culateCJLC(list, "保养"); | |
| 3330 | + double ssgl_cj = culateService.culateCJLC(list, "抽减"); | |
| 3331 | + double ssgl_qt = culateService.culateCJLC(list, "其他"); | |
| 3332 | + map.put("ssgl_other", Arith.add(Arith.add(ssgl_pc, ssgl_by), Arith.add(ssgl_cj, ssgl_qt))); | |
| 3333 | + | |
| 3334 | + map.put("ssbc", culateService.culateLbbc(list)); | |
| 3335 | + map.put("ljgl", ljgl); | |
| 3336 | + map.put("jhbc", culateService.culateJhbc(list, "")); | |
| 3337 | + map.put("jhbc_m", culateService.culateJhbc(list, "zgf")); | |
| 3338 | + map.put("jhbc_a", culateService.culateJhbc(list, "wgf")); | |
| 3339 | + map.put("sjbc", culateService.culateSjbc(list_s, "")); | |
| 3340 | + map.put("sjbc_m", culateService.culateSjbc(list_s, "zgf")); | |
| 3341 | + map.put("sjbc_a", culateService.culateSjbc(list_s, "wgf")); | |
| 3342 | + map.put("ljbc", culateService.culateLjbc(list_s, "")); | |
| 3343 | + map.put("ljbc_m", culateService.culateLjbc(list_s, "zgf")); | |
| 3344 | + map.put("ljbc_a", culateService.culateLjbc(list_s, "wgf")); | |
| 3345 | + map.put("fzbc", culateService.culateFzbc(list_s, "")); | |
| 3346 | + map.put("fzbc_m", culateService.culateFzbc(list_s, "zgf")); | |
| 3347 | + map.put("fzbc_a", culateService.culateFzbc(list_s, "wgf")); | |
| 3348 | + map.put("dtbc", 0); | |
| 3349 | + map.put("dtbc_m", 0); | |
| 3350 | + map.put("dtbc_a", 0); | |
| 3351 | + if (list.size() > 0) { | |
| 3352 | + int djg = 0, djg_m = 0, djg_a = 0, djg_time = 0; | |
| 3353 | + for (Map<String, Object> m : lMap) { | |
| 3354 | + if (m.containsKey("djg") && m.get("djg") != null) | |
| 3355 | + djg += Integer.valueOf(m.get("djg").toString()); | |
| 3356 | + if (m.containsKey("djg_m") && m.get("djg_m") != null) | |
| 3357 | + djg_m += Integer.valueOf(m.get("djg_m").toString()); | |
| 3358 | + if (m.containsKey("djg_a") && m.get("djg_a") != null) | |
| 3359 | + djg_a += Integer.valueOf(m.get("djg_a").toString()); | |
| 3360 | + if (m.containsKey("djg_time") && m.get("djg_time") != null) { | |
| 3361 | + int t = Integer.valueOf(m.get("djg_time").toString()); | |
| 3362 | + if (t > djg_time) | |
| 3363 | + djg_time = t; | |
| 3364 | + } | |
| 3365 | + } | |
| 3366 | + map.put("djg", djg); | |
| 3367 | + map.put("djg_m", djg_m); | |
| 3368 | + map.put("djg_a", djg_a); | |
| 3369 | + map.put("djg_time", djg_time); | |
| 3370 | +// Map<String, Object> m_=culateService.culateDjg(list_s, list.get(0).getXlBm()); | |
| 3371 | +// map.put("djg", m_.get("djgcsq")); | |
| 3372 | +// map.put("djg_m", m_.get("djgcsz")); | |
| 3373 | +// map.put("djg_a", m_.get("djgcsw")); | |
| 3374 | +// map.put("djg_time", m_.get("djgsj")); | |
| 3375 | + } else { | |
| 3376 | + map.put("djg", "0"); | |
| 3377 | + map.put("djg_m", "0"); | |
| 3378 | + map.put("djg_a", "0"); | |
| 3379 | + map.put("djg_time", "0"); | |
| 3380 | + } | |
| 3381 | + lMap.add(map); | |
| 3382 | + | |
| 3383 | + if (type != null && type.length() != 0 && type.equals("export")) { | |
| 3384 | + SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"), | |
| 3385 | + sdfSimple = new SimpleDateFormat("yyyyMMdd"); | |
| 3386 | + List<Iterator<?>> listI = new ArrayList<Iterator<?>>(); | |
| 3387 | + Map<String, Object> m = new HashMap<String, Object>(); | |
| 3388 | + m.put("date", date + "至" + date2); | |
| 3389 | + ReportUtils ee = new ReportUtils(); | |
| 3390 | + try { | |
| 3391 | + String dateTime = ""; | |
| 3392 | + if (date.equals(date2)) { | |
| 3393 | + dateTime = sdfSimple.format(sdfMonth.parse(date)); | |
| 3394 | + } else { | |
| 3395 | + dateTime = sdfSimple.format(sdfMonth.parse(date)) | |
| 3396 | + + "-" + sdfSimple.format(sdfMonth.parse(date2)); | |
| 3397 | + } | |
| 3398 | + listI.add(lMap.iterator()); | |
| 3399 | + String path = this.getClass().getResource("/").getPath() + "static/pages/forms/"; | |
| 3400 | + ee.excelReplace(listI, new Object[]{m}, path + "mould/statisticsDaily_2.xls", | |
| 3401 | + path + "export/" + dateTime + "-" + xlName + "-统计日报.xls"); | |
| 3402 | + } catch (Exception e) { | |
| 3403 | + // TODO: handle exception | |
| 3404 | + //e.printStackTrace(); | |
| 3405 | + logger.info("", e); | |
| 3406 | + } | |
| 3407 | + } | |
| 3408 | + | |
| 3409 | + if (type != null && type.length() != 0 && type.equals("exportAll")) { | |
| 3410 | + List<Map<String, Object>> tempList = new ArrayList<Map<String, Object>>(); | |
| 3411 | + Map<String, Map<String, Object>> tempMap = new HashMap<String, Map<String, Object>>(); | |
| 3412 | + List<Map<String, Object>> removeList = new ArrayList<Map<String, Object>>(); | |
| 3413 | + for(Map<String, Object> m : lMap){ | |
| 3414 | + if(m.get("gsName") != null && m.get("gsName").toString().trim().length() > 0 | |
| 3415 | + && m.get("gsName").toString().trim().contains("临港")){ | |
| 3416 | + removeList.add(m); | |
| 3417 | + } | |
| 3418 | + } | |
| 3419 | + for(Map<String, Object> m : removeList){ | |
| 3420 | + lMap.remove(m); | |
| 3421 | + } | |
| 3422 | + for(Map<String, Object> m : lMap){ | |
| 3423 | + if(m.get("gsName") != null && m.get("gsName").toString().trim().length() > 0){ | |
| 3424 | + String gsName = m.get("gsName").toString().trim(); | |
| 3425 | + Map<String, Object> temp = new HashMap<String, Object>(); | |
| 3426 | + if(tempMap.get(gsName) != null){ | |
| 3427 | + temp = tempMap.get(gsName); | |
| 3428 | + } else { | |
| 3429 | + temp.put("gsName", gsName); | |
| 3430 | + temp.put("fgsName", "小计"); | |
| 3431 | + temp.put("xlName", ""); | |
| 3432 | + tempList.add(temp); | |
| 3433 | + tempMap.put(gsName, temp); | |
| 3434 | + } | |
| 3435 | + for(String key : m.keySet()){ | |
| 3436 | + try { | |
| 3437 | + temp.put(key, new BigDecimal(m.get(key).toString()).add( | |
| 3438 | + new BigDecimal(temp.get(key)!=null?temp.get(key).toString():"0"))); | |
| 3439 | + } catch (Exception e) { | |
| 3440 | + // TODO: handle exception | |
| 3441 | + } | |
| 3442 | + } | |
| 3443 | + } | |
| 3444 | + } | |
| 3445 | + lMap.addAll(lMap.size()>0?lMap.size()-1:0, tempList); | |
| 3446 | + | |
| 3447 | + SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"), | |
| 3448 | + sdfSimple = new SimpleDateFormat("yyyyMMdd"); | |
| 3449 | + List<Iterator<?>> listI = new ArrayList<Iterator<?>>(); | |
| 3450 | + Map<String, Object> m = new HashMap<String, Object>(); | |
| 3451 | + m.put("date", date + "至" + date2); | |
| 3452 | + ReportUtils ee = new ReportUtils(); | |
| 3453 | + try { | |
| 3454 | + String dateTime = ""; | |
| 3455 | + if (date.equals(date2)) { | |
| 3456 | + dateTime = sdfSimple.format(sdfMonth.parse(date)); | |
| 3457 | + } else { | |
| 3458 | + dateTime = sdfSimple.format(sdfMonth.parse(date)) | |
| 3459 | + + "-" + sdfSimple.format(sdfMonth.parse(date2)); | |
| 3460 | + } | |
| 3461 | + listI.add(lMap.iterator()); | |
| 3462 | + String path = this.getClass().getResource("/").getPath() + "static/pages/forms/"; | |
| 3463 | + ee.excelReplace(listI, new Object[]{m}, path + "mould/statisticsDaily_4.xls", | |
| 3464 | + path + "export/" + dateTime + "-全部公司-统计日报.xls"); | |
| 3465 | + } catch (Exception e) { | |
| 3466 | + // TODO: handle exception | |
| 3467 | + //e.printStackTrace(); | |
| 3468 | + logger.info("", e); | |
| 3469 | + } | |
| 3470 | + } | |
| 3471 | + | |
| 3472 | + return lMap; | |
| 3473 | + } | |
| 3474 | + | |
| 3475 | + @Override | |
| 3476 | + public List<Map<String, Object>> statisticsDailyTjHb(String gsdm, String fgsdm, String line, String date, String date2, | |
| 3477 | + String xlName, String type,String nature) { | |
| 3478 | + List<ScheduleRealInfo> listAll = new ArrayList<ScheduleRealInfo>(); | |
| 3479 | + List<ScheduleRealInfo> list_s = new ArrayList<ScheduleRealInfo>(); | |
| 3480 | + List<ScheduleRealInfo> lists = new ArrayList<ScheduleRealInfo>(); | |
| 3481 | + List<Object[]> listInterval=new ArrayList<Object[]>(); | |
| 3482 | + | |
| 3483 | + line = line.trim(); | |
| 3484 | + if (line.equals("")) { | |
| 3485 | + //查询所有线路 | |
| 3486 | + listAll = scheduleRealInfoRepository.scheduleByDateAndLineTj(line, date, date2, gsdm, fgsdm); | |
| 3487 | + listInterval = calcIntervalRepository.countByDateAndLine(gsdm, fgsdm, date, date2); | |
| 3488 | + } else { | |
| 3489 | + //查询单条线路 | |
| 3490 | + listAll = scheduleRealInfoRepository.scheduleByDateAndLineTj2(line, date, date2); | |
| 3491 | + listInterval = calcIntervalRepository.countByDateAndLine(line, date, date2); | |
| 3492 | + } | |
| 3493 | + Map<String, Map<String,Object>> mapInterval=new HashMap<>(); | |
| 3494 | + for (int i = 0; i < listInterval.size(); i++) { | |
| 3495 | + Object[] interval=listInterval.get(i); | |
| 3496 | + String gs=interval[0].toString(); | |
| 3497 | + String fgs=interval[1].toString(); | |
| 3498 | + String xl=interval[2].toString(); | |
| 3499 | + Map<String, Object> m=new HashMap<String,Object>(); | |
| 3500 | + m.put("gs", gs); | |
| 3501 | + m.put("fgs", fgs); | |
| 3502 | + m.put("xl", xl); | |
| 3503 | + m.put("djgAll", interval[3]); | |
| 3504 | + m.put("djgZgf", interval[6]); | |
| 3505 | + m.put("djgWgf", interval[7]); | |
| 3506 | + m.put("djgTime", interval[8]); | |
| 3507 | + mapInterval.put(gs+"-"+fgs+"-"+xl, m); | |
| 3508 | + } | |
| 3509 | + | |
| 3510 | + Map<String, Boolean> lineMap=lineService.lineNature(); | |
| 3511 | + List<ScheduleRealInfo> list=new ArrayList<ScheduleRealInfo>(); | |
| 3512 | + for (int i = 0; i < listAll.size(); i++) { | |
| 3513 | + ScheduleRealInfo s=listAll.get(i); | |
| 3514 | + if (nature.equals("0")) { | |
| 3515 | + list.add(s); | |
| 3516 | + }else if(nature.equals("1")){ | |
| 3517 | + if(lineMap.get(s.getXlBm())){ | |
| 3518 | + list.add(s); | |
| 3519 | + } | |
| 3520 | + }else{ | |
| 3521 | + if(!lineMap.get(s.getXlBm())){ | |
| 3522 | + list.add(s); | |
| 3523 | + } | |
| 3524 | + } | |
| 3525 | + } | |
| 3526 | + for (int i = 0; i < list.size(); i++) { | |
| 3527 | + ScheduleRealInfo s = list.get(i); | |
| 3528 | + Set<ChildTaskPlan> cts = s.getcTasks(); | |
| 3529 | + if (cts != null && cts.size() > 0) { | |
| 3530 | + list_s.add(s); | |
| 3531 | + } else { | |
| 3532 | + if (s.getZdsjActual() != null && s.getFcsjActual() != null) { | |
| 3533 | + list_s.add(s); | |
| 3534 | + } | |
| 3535 | + } | |
| 3536 | + } | |
| 3537 | + List<Map<String, Object>> lMap = new ArrayList<Map<String, Object>>(); | |
| 3538 | + for (int i = 0; i < list.size(); i++) { | |
| 3539 | + if (i < list.size() - 1) { | |
| 3540 | + if ((list.get(i + 1).getFgsBm()+list.get(i + 1).getXlBm()).equals(list.get(i).getFgsBm()+list.get(i).getXlBm())) { | |
| 3541 | + lists.add(list.get(i)); | |
| 3542 | + } else { | |
| 3543 | + lists.add(list.get(i)); | |
| 3544 | + Map<String, Object> mm=new HashMap<String,Object>(); | |
| 3545 | + if(mapInterval.get(lists.get(0).getGsBm()+"-"+lists.get(0).getFgsBm()+"-"+lists.get(0).getXlBm())!=null){ | |
| 3546 | + mm=mapInterval.get(lists.get(0).getGsBm()+"-"+lists.get(0).getFgsBm()+"-"+lists.get(0).getXlBm()); | |
| 3547 | + } | |
| 3548 | + Map<String, Object> map = staticTj(lists,mm); | |
| 3549 | + lMap.add(map); | |
| 3550 | + lists = new ArrayList<ScheduleRealInfo>(); | |
| 3551 | + } | |
| 3552 | + } else { | |
| 3553 | + if ((list.get(i).getFgsBm()+list.get(i).getXlBm()).equals(list.get(i - 1).getFgsBm()+list.get(i - 1).getXlBm())) { | |
| 3554 | + lists.add(list.get(i)); | |
| 3555 | + Map<String, Object> mm=new HashMap<String,Object>(); | |
| 3556 | + if(mapInterval.get(lists.get(0).getGsBm()+"-"+lists.get(0).getFgsBm()+"-"+lists.get(0).getXlBm())!=null){ | |
| 3557 | + mm=mapInterval.get(lists.get(0).getGsBm()+"-"+lists.get(0).getFgsBm()+"-"+lists.get(0).getXlBm()); | |
| 3558 | + } | |
| 3559 | + Map<String, Object> map = staticTj(lists,mm); | |
| 3560 | + lMap.add(map); | |
| 3561 | + } else { | |
| 3562 | + lists = new ArrayList<ScheduleRealInfo>(); | |
| 3563 | + lists.add(list.get(i)); | |
| 3564 | + Map<String, Object> mm=new HashMap<String,Object>(); | |
| 3565 | + if(mapInterval.get(lists.get(0).getGsBm()+"-"+lists.get(0).getFgsBm()+"-"+lists.get(0).getXlBm())!=null){ | |
| 3566 | + mm=mapInterval.get(lists.get(0).getGsBm()+"-"+lists.get(0).getFgsBm()+"-"+lists.get(0).getXlBm()); | |
| 3567 | + } | |
| 3568 | + Map<String, Object> map = staticTj(lists,mm); | |
| 3569 | + lMap.add(map); | |
| 3570 | + } | |
| 3571 | + } | |
| 3572 | + } | |
| 3573 | + | |
| 3574 | + Collections.sort(lMap, new AccountXlbm()); | |
| 3575 | + Map<String, Object> map = new HashMap<String, Object>(); | |
| 3576 | + map.put("xlBm", "hj"); | |
| 3577 | + map.put("xlName", "合计"); | |
| 3578 | + map.put("fgsBm", ""); | |
| 3579 | + map.put("fgsName", ""); | |
| 3580 | + map.put("gsBm", ""); | |
| 3581 | + double jhyygl = culateService.culateJhgl(list);//计划营运公里 | |
| 3582 | + double jhjcclc = culateService.culateJhJccgl(list);//计划进出场公里(计划空驶公里) | |
| 3583 | + map.put("jhlc", jhyygl); | |
| 3584 | + map.put("jcclc", jhjcclc); | |
| 3585 | + map.put("jhzlc", Arith.add(jhyygl, jhjcclc)); | |
| 3586 | + | |
| 3587 | + double ljgl = culateService.culateLjgl(list_s); | |
| 3588 | + double sjyygl = culateService.culateSjgl(list_s); | |
| 3589 | + double zyygl = Arith.add(sjyygl, ljgl); | |
| 3590 | + double ljks=culateService.culateLjksgl(list_s); | |
| 3591 | + map.put("ljks", ljks); | |
| 3592 | + double sjjccgl = culateService.culateJccgl(list_s); | |
| 3593 | + double sjksgl = culateService.culateKsgl(list_s); | |
| 3594 | + double zksgl = Arith.add(sjjccgl, sjksgl); | |
| 3595 | + map.put("sjzgl", Arith.add(zyygl, zksgl)); | |
| 3596 | + map.put("sjgl", zyygl); | |
| 3597 | + map.put("sjksgl", zksgl); | |
| 3598 | + | |
| 3599 | + double ssgl = culateService.culateLbgl(list); | |
| 3600 | + map.put("ssgl", ssgl); | |
| 3601 | + //计划+临加-少驶=实驶 | |
| 3602 | + double jl = Arith.sub(Arith.add(jhyygl, ljgl), ssgl); | |
| 3603 | + if (jl == zyygl) { | |
| 3604 | + map.put("zt", 0); | |
| 3605 | + } else { | |
| 3606 | + map.put("zt", 1); | |
| 3607 | + } | |
| 3608 | + map.put("ssgl_lz", culateService.culateCJLC(list, "路阻")); | |
| 3609 | + map.put("ssgl_dm", culateService.culateCJLC(list, "吊慢")); | |
| 3610 | + map.put("ssgl_gz", culateService.culateCJLC(list, "故障")); | |
| 3611 | + map.put("ssgl_jf", culateService.culateCJLC(list, "纠纷")); | |
| 3612 | + map.put("ssgl_zs", culateService.culateCJLC(list, "肇事")); | |
| 3613 | + map.put("ssgl_qr", culateService.culateCJLC(list, "缺人")); | |
| 3614 | + map.put("ssgl_qc", culateService.culateCJLC(list, "缺车")); | |
| 3615 | + map.put("ssgl_kx", culateService.culateCJLC(list, "客稀")); | |
| 3616 | + map.put("ssgl_qh", culateService.culateCJLC(list, "气候")); | |
| 3617 | + map.put("ssgl_yw", culateService.culateCJLC(list, "援外")); | |
| 3618 | + map.put("ssgl_ljpm", culateService.culateCJLC(list, "路救抛锚")); | |
| 3619 | + double ssgl_pc = culateService.culateCJLC(list, "配车"); | |
| 3620 | + double ssgl_by = culateService.culateCJLC(list, "保养"); | |
| 3621 | + double ssgl_cj = culateService.culateCJLC(list, "抽减"); | |
| 3622 | + double ssgl_qt = culateService.culateCJLC(list, "其他"); | |
| 3623 | + map.put("ssgl_other", Arith.add(Arith.add(ssgl_pc, ssgl_by), Arith.add(ssgl_cj, ssgl_qt))); | |
| 3624 | + | |
| 3625 | + map.put("ssbc", culateService.culateLbbc(list)); | |
| 3626 | + map.put("ljgl", ljgl); | |
| 3627 | + map.put("jhbc", culateService.culateJhbc(list, "")); | |
| 3628 | + map.put("jhbc_m", culateService.culateJhbc(list, "zgf")); | |
| 3629 | + map.put("jhbc_a", culateService.culateJhbc(list, "wgf")); | |
| 3630 | + map.put("sjbc", culateService.culateSjbc(list_s, "")); | |
| 3631 | + map.put("sjbc_m", culateService.culateSjbc(list_s, "zgf")); | |
| 3632 | + map.put("sjbc_a", culateService.culateSjbc(list_s, "wgf")); | |
| 3633 | + map.put("ljbc", culateService.culateLjbc(list_s, "")); | |
| 3634 | + map.put("ljbc_m", culateService.culateLjbc(list_s, "zgf")); | |
| 3635 | + map.put("ljbc_a", culateService.culateLjbc(list_s, "wgf")); | |
| 3636 | + map.put("fzbc", culateService.culateFzbc(list_s, "")); | |
| 3637 | + map.put("fzbc_m", culateService.culateFzbc(list_s, "zgf")); | |
| 3638 | + map.put("fzbc_a", culateService.culateFzbc(list_s, "wgf")); | |
| 3639 | + map.put("dtbc", 0); | |
| 3640 | + map.put("dtbc_m", 0); | |
| 3641 | + map.put("dtbc_a", 0); | |
| 3642 | + if (list.size() > 0) { | |
| 3643 | + int djg = 0, djg_m = 0, djg_a = 0, djg_time = 0; | |
| 3644 | + for (Map<String, Object> m : lMap) { | |
| 3645 | + if (m.containsKey("djg") && m.get("djg") != null) | |
| 3646 | + djg += Integer.valueOf(m.get("djg").toString()); | |
| 3647 | + if (m.containsKey("djg_m") && m.get("djg_m") != null) | |
| 3648 | + djg_m += Integer.valueOf(m.get("djg_m").toString()); | |
| 3649 | + if (m.containsKey("djg_a") && m.get("djg_a") != null) | |
| 3650 | + djg_a += Integer.valueOf(m.get("djg_a").toString()); | |
| 3651 | + if (m.containsKey("djg_time") && m.get("djg_time") != null) { | |
| 3652 | + int t = Integer.valueOf(m.get("djg_time").toString()); | |
| 3653 | + if (t > djg_time) | |
| 3654 | + djg_time = t; | |
| 3655 | + } | |
| 3656 | + } | |
| 3657 | + map.put("djg", djg); | |
| 3658 | + map.put("djg_m", djg_m); | |
| 3659 | + map.put("djg_a", djg_a); | |
| 3660 | + map.put("djg_time", djg_time); | |
| 3661 | + } else { | |
| 3662 | + map.put("djg", "0"); | |
| 3663 | + map.put("djg_m", "0"); | |
| 3664 | + map.put("djg_a", "0"); | |
| 3665 | + map.put("djg_time", "0"); | |
| 3666 | + } | |
| 3667 | + lMap.add(map); | |
| 3668 | + return lMap; | |
| 3669 | + } | |
| 3670 | + | |
| 3671 | + @Override | |
| 3672 | + public Map<String, Object> scheduleDaily(String line, String date) { | |
| 3673 | + Map<String, String> tempMap = null; | |
| 3674 | + List<ScheduleRealInfo> scheduleRealInfos = scheduleRealInfoRepository.scheduleByDateAndLine(line, date); | |
| 3675 | + Map<String, Object> map = new HashMap<String, Object>(); | |
| 3676 | + Double jhlc = 0.00; | |
| 3677 | + Float sjgl = 0f, ssgl = 0f, ssgl_lz = 0f, ssgl_dm = 0f, ssgl_gz = 0f, ssgl_jf = 0f, ssgl_zs = 0f, | |
| 3678 | + ssgl_qr = 0f, ssgl_qc = 0f, ssgl_kx = 0f, ssgl_qh = 0f, ssgl_yw = 0f, ssgl_ljpm = 0f, | |
| 3679 | + ssgl_other = 0f, ljgl = 0f; | |
| 3680 | + int jhbc = 0; | |
| 3681 | + for (ScheduleRealInfo scheduleRealInfo : scheduleRealInfos) { | |
| 3682 | + if (scheduleRealInfo != null) { | |
| 3683 | + //计算里程(包括子任务) | |
| 3684 | + jhlc += scheduleRealInfo.getJhlc(); | |
| 3685 | + Set<ChildTaskPlan> childTaskPlans = scheduleRealInfo.getcTasks(); | |
| 3686 | + if (!childTaskPlans.isEmpty()) { | |
| 3687 | + Iterator<ChildTaskPlan> it = childTaskPlans.iterator(); | |
| 3688 | + while (it.hasNext()) { | |
| 3689 | + ChildTaskPlan childTaskPlan = it.next(); | |
| 3690 | + //是否烂班,烂班就是少驶 | |
| 3691 | + if (!childTaskPlan.isDestroy()) { | |
| 3692 | + sjgl += childTaskPlan.getMileage(); | |
| 3693 | + } else { | |
| 3694 | + ssgl += childTaskPlan.getMileage(); | |
| 3695 | + if (childTaskPlan.getDestroyReason().equals("路阻")) { | |
| 3696 | + ssgl_lz += childTaskPlan.getMileage(); | |
| 3697 | + } else if (childTaskPlan.getDestroyReason().equals("吊慢")) { | |
| 3698 | + ssgl_dm += childTaskPlan.getMileage(); | |
| 3699 | + } else if (childTaskPlan.getDestroyReason().equals("故障")) { | |
| 3700 | + ssgl_gz += childTaskPlan.getMileage(); | |
| 3701 | + } else if (childTaskPlan.getDestroyReason().equals("纠纷")) { | |
| 3702 | + ssgl_jf += childTaskPlan.getMileage(); | |
| 3703 | + } else if (childTaskPlan.getDestroyReason().equals("肇事")) { | |
| 3704 | + ssgl_zs += childTaskPlan.getMileage(); | |
| 3705 | + } else if (childTaskPlan.getDestroyReason().equals("缺人")) { | |
| 3706 | + ssgl_qr += childTaskPlan.getMileage(); | |
| 3707 | + } else if (childTaskPlan.getDestroyReason().equals("缺车")) { | |
| 3708 | + ssgl_qc += childTaskPlan.getMileage(); | |
| 3709 | + } else if (childTaskPlan.getDestroyReason().equals("客稀")) { | |
| 3710 | + ssgl_kx += childTaskPlan.getMileage(); | |
| 3711 | + } else if (childTaskPlan.getDestroyReason().equals("气候")) { | |
| 3712 | + ssgl_qh += childTaskPlan.getMileage(); | |
| 3713 | + } else if (childTaskPlan.getDestroyReason().equals("援外")) { | |
| 3714 | + ssgl_yw += childTaskPlan.getMileage(); | |
| 3715 | + } else if (childTaskPlan.getDestroyReason().equals("路救抛锚")) { | |
| 3716 | + ssgl_ljpm += childTaskPlan.getMileage(); | |
| 3717 | + } else { | |
| 3718 | + ssgl_other += childTaskPlan.getMileage(); | |
| 3719 | + } | |
| 3720 | + } | |
| 3721 | + //临加公里 | |
| 3722 | + if (childTaskPlan.getType1().equals("临加")) { | |
| 3723 | + ljgl += childTaskPlan.getMileage(); | |
| 3724 | + } | |
| 3725 | + } | |
| 3726 | + } | |
| 3727 | + //班次 | |
| 3728 | + scheduleRealInfo.getFcsjT(); | |
| 3729 | + scheduleRealInfo.getFcsjActualTime(); | |
| 3730 | + } | |
| 3731 | + } | |
| 3732 | + map.put("jhlc", jhlc); | |
| 3733 | + map.put("sjgl", sjgl); | |
| 3734 | + map.put("ssgl", ssgl); | |
| 3735 | + map.put("ssgl_lz", ssgl_lz); | |
| 3736 | + map.put("ssgl_dm", ssgl_dm); | |
| 3737 | + map.put("ssgl_gz", ssgl_gz); | |
| 3738 | + map.put("ssgl_jf", ssgl_jf); | |
| 3739 | + map.put("ssgl_zs", ssgl_zs); | |
| 3740 | + map.put("ssgl_qr", ssgl_qr); | |
| 3741 | + map.put("ssgl_qc", ssgl_qc); | |
| 3742 | + map.put("ssgl_kx", ssgl_kx); | |
| 3743 | + map.put("ssgl_qh", ssgl_qh); | |
| 3744 | + map.put("ssgl_yw", ssgl_yw); | |
| 3745 | + map.put("ssgl_ljpm", ssgl_ljpm); | |
| 3746 | + map.put("ssgl_other", ssgl_other); | |
| 3747 | + map.put("ljgl", ljgl); | |
| 3748 | + | |
| 3749 | + map.put("jhbc", scheduleRealInfos.size()); | |
| 3750 | + return null; | |
| 3751 | + } | |
| 3752 | + | |
| 3753 | + @Override | |
| 3754 | + public int countByLineCodeAndDate(String xlBm, String schDate) { | |
| 3755 | + return scheduleRealInfoRepository.countByLineCodeAndDate(xlBm + "", schDate); | |
| 3756 | + } | |
| 3757 | + | |
| 3758 | + @Override | |
| 3759 | + public List<ScheduleRealInfo> findByLineCodeAndDate(String xlBm, String schDate) { | |
| 3760 | + return scheduleRealInfoRepository.findByLineCodeAndDate(xlBm + "", schDate); | |
| 3761 | + } | |
| 3762 | + | |
| 3763 | + @Override | |
| 3764 | + public void deleteByLineCodeAndDate(String xlBm, String schDate) { | |
| 3765 | + scheduleRealInfoRepository.deleteByLineCodeAndDate(xlBm + "", schDate); | |
| 3766 | + } | |
| 3767 | + | |
| 3768 | + @Override | |
| 3769 | + public Long getMaxId() { | |
| 3770 | + return scheduleRealInfoRepository.getMaxId(); | |
| 3771 | + } | |
| 3772 | + | |
| 3773 | + @Override | |
| 3774 | + public List<ScheduleRealInfo> realScheduleList(String line, String date) { | |
| 3775 | + List<ScheduleRealInfo> list = new ArrayList<ScheduleRealInfo>(); | |
| 3776 | + String lpName = "lpName"; | |
| 3777 | + String zdsj = ""; | |
| 3778 | + String zdsjActual = ""; | |
| 3779 | + String zdsj1 = ""; | |
| 3780 | + String zdsjActual1 = ""; | |
| 3781 | + List<ScheduleRealInfo> listInfo = scheduleRealInfoRepository.scheduleDdrb(line, date); | |
| 3782 | + | |
| 3783 | + /* | |
| 3784 | + * 对计划发车时间相同的班次进行排序 out最前 in最后 | |
| 3785 | + */ | |
| 3786 | + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm"); | |
| 3787 | + SimpleDateFormat sdfnyr =new SimpleDateFormat("yyyy-MM-dd"); | |
| 3788 | + String minfcsj = "02:00"; | |
| 3789 | + List<Line> lineList = lineRepository.findLineByCode(line); | |
| 3790 | + if (lineList.size() > 0) { | |
| 3791 | + String sqlMinYysj = "select start_opt from bsth_c_line_config where " | |
| 3792 | + + " id = (" | |
| 3793 | + + "select max(id) from bsth_c_line_config where line ='" + lineList.get(0).getId() + "'" | |
| 3794 | + + ")"; | |
| 3795 | + minfcsj = jdbcTemplate.queryForObject(sqlMinYysj, String.class); | |
| 3796 | + } | |
| 3797 | + String[] minSjs = minfcsj.split(":"); | |
| 3798 | + Long minSj = Long.parseLong(minSjs[0]) * 60 + Long.parseLong(minSjs[1]); | |
| 3799 | + for (int i = 0; i < listInfo.size(); i++) { | |
| 3800 | + ScheduleRealInfo s = listInfo.get(i); | |
| 3801 | + if (s.getBcType().equals("out")) { | |
| 3802 | + s.setRemark("1"); | |
| 3803 | + } else if (s.getBcType().equals("in")) { | |
| 3804 | + s.setRemark("3"); | |
| 3805 | + } else { | |
| 3806 | + s.setRemark("2"); | |
| 3807 | + } | |
| 3808 | + String[] fcsj = s.getFcsj().split(":"); | |
| 3809 | + Long fcsjL = Long.parseLong(fcsj[0]) * 60 + Long.parseLong(fcsj[1]); | |
| 3810 | + | |
| 3811 | + Long fscjT = 0L; | |
| 3812 | + if (fcsjL < minSj) { | |
| 3813 | + Calendar calendar = new GregorianCalendar(); | |
| 3814 | + calendar.setTime(s.getScheduleDate()); | |
| 3815 | + calendar.add(calendar.DATE, 1); | |
| 3816 | + Date date_sch= calendar.getTime(); | |
| 3817 | + try { | |
| 3818 | + fscjT = sdf.parse(sdfnyr.format(date_sch) + " " + s.getFcsj()).getTime(); | |
| 3819 | + } catch (ParseException e) { | |
| 3820 | + // TODO Auto-generated catch block | |
| 3821 | + e.printStackTrace(); | |
| 3822 | + } | |
| 3823 | + | |
| 3824 | + } else { | |
| 3825 | + try { | |
| 3826 | + fscjT = sdf.parse(s.getScheduleDateStr() + " " + s.getFcsj()).getTime(); | |
| 3827 | + } catch (ParseException e) { | |
| 3828 | + // TODO Auto-generated catch block | |
| 3829 | + e.printStackTrace(); | |
| 3830 | + }; | |
| 3831 | + } | |
| 3832 | + s.setFcsjT(fscjT); | |
| 3833 | + } | |
| 3834 | + List<ScheduleRealInfo> listInfo2=new ArrayList<ScheduleRealInfo>(); | |
| 3835 | + listInfo2.addAll(listInfo); | |
| 3836 | + Collections.sort(listInfo, new compareLpFcsjType()); | |
| 3837 | + Collections.sort(listInfo2,new compareDirLpFcsjType()); | |
| 3838 | + for (int i = 0; i < listInfo.size(); i++) { | |
| 3839 | + ScheduleRealInfo t = listInfo.get(i); | |
| 3840 | + if (!lpName.equals(t.getLpName())) { | |
| 3841 | + zdsjActual = t.getZdsjActual(); | |
| 3842 | + zdsj = t.getZdsj(); | |
| 3843 | + t.setZdsjActual(""); | |
| 3844 | + t.setZdsj(""); | |
| 3845 | + } else { | |
| 3846 | + zdsj1 = t.getZdsj(); | |
| 3847 | + zdsjActual1 = t.getZdsjActual(); | |
| 3848 | + t.setZdsjActual(zdsjActual); | |
| 3849 | + t.setZdsj(zdsj); | |
| 3850 | + zdsj = zdsj1; | |
| 3851 | + zdsjActual = zdsjActual1; | |
| 3852 | + } | |
| 3853 | + lpName = t.getLpName(); | |
| 3854 | + list.add(t); | |
| 3855 | + } | |
| 3856 | +/* | |
| 3857 | + List<ScheduleRealInfo> listInfo2 = scheduleRealInfoRepository.scheduleDdrb2(line, date); | |
| 3858 | + for (int i = 0; i < listInfo2.size(); i++) { | |
| 3859 | + ScheduleRealInfo s = listInfo2.get(i); | |
| 3860 | + if (s.getBcType().equals("out")) { | |
| 3861 | + s.setRemark("1"); | |
| 3862 | + } else if (s.getBcType().equals("in")) { | |
| 3863 | + s.setRemark("3"); | |
| 3864 | + } else { | |
| 3865 | + s.setRemark("2"); | |
| 3866 | + } | |
| 3867 | + String[] fcsj = s.getFcsj().split(":"); | |
| 3868 | + Long fcsjL = Long.parseLong(fcsj[0]) * 60 + Long.parseLong(fcsj[1]); | |
| 3869 | + | |
| 3870 | + Long fscjT = 0L; | |
| 3871 | + if (fcsjL < minSj) { | |
| 3872 | + Calendar calendar = new GregorianCalendar(); | |
| 3873 | + calendar.setTime(s.getScheduleDate()); | |
| 3874 | + calendar.add(calendar.DATE, 1); | |
| 3875 | + s.setScheduleDate(calendar.getTime()); | |
| 3876 | + try { | |
| 3877 | + fscjT = sdf.parse(sdf.format(s.getScheduleDate()) + " " + s.getFcsj()).getTime(); | |
| 3878 | + } catch (ParseException e) { | |
| 3879 | + // TODO Auto-generated catch block | |
| 3880 | + e.printStackTrace(); | |
| 3881 | + } | |
| 3882 | + | |
| 3883 | + } else { | |
| 3884 | + try { | |
| 3885 | + fscjT = sdf.parse(s.getScheduleDateStr() + " " + s.getFcsj()).getTime(); | |
| 3886 | + } catch (ParseException e) { | |
| 3887 | + // TODO Auto-generated catch block | |
| 3888 | + e.printStackTrace(); | |
| 3889 | + } | |
| 3890 | + ; | |
| 3891 | + } | |
| 3892 | + s.setFcsjT(fscjT); | |
| 3893 | + }*/ | |
| 3894 | + List<ScheduleRealInfo> xList = new ArrayList<ScheduleRealInfo>(); | |
| 3895 | + List<ScheduleRealInfo> yList = new ArrayList<ScheduleRealInfo>(); | |
| 3896 | + List<ScheduleRealInfo> zList = new ArrayList<ScheduleRealInfo>(); | |
| 3897 | + List<ScheduleRealInfo> newList = new ArrayList<ScheduleRealInfo>(); | |
| 3898 | + if (listInfo2.size() > 0) { | |
| 3899 | + int a = listInfo2.size() % 3; | |
| 3900 | + int b = listInfo2.size() / 3; | |
| 3901 | + int x = 0, y = 0; | |
| 3902 | + if (a == 2) { | |
| 3903 | + x = b + 1; | |
| 3904 | + y = x * 2; | |
| 3905 | + } else if (a == 1) { | |
| 3906 | + x = b + 1; | |
| 3907 | + y = x * 2 - 1; | |
| 3908 | + } else { | |
| 3909 | + x = b; | |
| 3910 | + y = 2 * x; | |
| 3911 | + | |
| 3912 | + } | |
| 3913 | + for (int i = 0; i < listInfo2.size(); i++) { | |
| 3914 | + ScheduleRealInfo s = listInfo2.get(i); | |
| 3915 | + if (i + 1 <= x) { | |
| 3916 | + xList.add(s); | |
| 3917 | + } else if ((i + 1) > x && (i + 1) <= y) { | |
| 3918 | + yList.add(s); | |
| 3919 | + } else { | |
| 3920 | + zList.add(s); | |
| 3921 | + } | |
| 3922 | + } | |
| 3923 | + for (int i = 0; i < x; i++) { | |
| 3924 | + newList.add(xList.get(i)); | |
| 3925 | + if (yList.size() > i) { | |
| 3926 | + newList.add(yList.get(i)); | |
| 3927 | + } else { | |
| 3928 | + newList.add(new ScheduleRealInfo()); | |
| 3929 | + } | |
| 3930 | + if (zList.size() > i) { | |
| 3931 | + newList.add(zList.get(i)); | |
| 3932 | + } else { | |
| 3933 | + newList.add(new ScheduleRealInfo()); | |
| 3934 | + } | |
| 3935 | + | |
| 3936 | + } | |
| 3937 | + } | |
| 3938 | + for (int i = 0; i < newList.size(); i++) { | |
| 3939 | + ScheduleRealInfo t1 = newList.get(i); | |
| 3940 | + for (int j = 0; j < list.size(); j++) { | |
| 3941 | + ScheduleRealInfo t2 = list.get(j); | |
| 3942 | + if (t1.getId() == t2.getId()) { | |
| 3943 | + t1 = t2; | |
| 3944 | + } | |
| 3945 | + } | |
| 3946 | + } | |
| 3947 | + | |
| 3948 | + for (int i = 0; i < newList.size(); i++) { | |
| 3949 | + ScheduleRealInfo t1 = newList.get(i); | |
| 3950 | + String reamrks1 = t1.getRemarks() == null ? "" : t1.getRemarks(); | |
| 3951 | + if (reamrks1.length() > 4) { | |
| 3952 | + t1.setRemarks(reamrks1.substring(0, 4)); | |
| 3953 | + t1.setRemark(reamrks1); | |
| 3954 | + } else { | |
| 3955 | + t1.setRemark(reamrks1); | |
| 3956 | + } | |
| 3957 | + } | |
| 3958 | + return newList; | |
| 3959 | + } | |
| 3960 | + | |
| 3961 | + @Override | |
| 3962 | + public List<ScheduleRealInfo> realScheduleList_zrw(String line, String date) { | |
| 3963 | + List<ScheduleRealInfo> list = new ArrayList<ScheduleRealInfo>(); | |
| 3964 | + String lpName = "lpName"; | |
| 3965 | + String zdsj = ""; | |
| 3966 | + String zdsjActual = ""; | |
| 3967 | + String zdsj1 = ""; | |
| 3968 | + String zdsjActual1 = ""; | |
| 3969 | + List<ScheduleRealInfo> listInfo = scheduleRealInfoRepository.scheduleDdrb(line, date); | |
| 3970 | + | |
| 3971 | + /* | |
| 3972 | + * 对计划发车时间相同的班次进行排序 out最前 in最后 | |
| 3973 | + */ | |
| 3974 | + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm"); | |
| 3975 | + SimpleDateFormat sdfnyr = new SimpleDateFormat("yyyy-MM-dd"); | |
| 3976 | + | |
| 3977 | + String minfcsj = "02:00"; | |
| 3978 | + List<Line> lineList = lineRepository.findLineByCode(line); | |
| 3979 | + if (lineList.size() > 0) { | |
| 3980 | + String sqlMinYysj = "select start_opt from bsth_c_line_config where " | |
| 3981 | + + " id = (" | |
| 3982 | + + "select max(id) from bsth_c_line_config where line ='" + lineList.get(0).getId() + "'" | |
| 3983 | + + ")"; | |
| 3984 | + minfcsj = jdbcTemplate.queryForObject(sqlMinYysj, String.class); | |
| 3985 | + } | |
| 3986 | + String[] minSjs = minfcsj.split(":"); | |
| 3987 | + Long minSj = Long.parseLong(minSjs[0]) * 60 + Long.parseLong(minSjs[1]); | |
| 3988 | + for (int i = 0; i < listInfo.size(); i++) { | |
| 3989 | + ScheduleRealInfo s = listInfo.get(i); | |
| 3990 | + if (s.getBcType().equals("out")) { | |
| 3991 | + s.setRemark("1"); | |
| 3992 | + } else if (s.getBcType().equals("in")) { | |
| 3993 | + s.setRemark("3"); | |
| 3994 | + } else { | |
| 3995 | + s.setRemark("2"); | |
| 3996 | + } | |
| 3997 | + String[] fcsj = s.getFcsj().split(":"); | |
| 3998 | + Long fcsjL = Long.parseLong(fcsj[0]) * 60 + Long.parseLong(fcsj[1]); | |
| 3999 | + | |
| 4000 | + Long fscjT = 0L; | |
| 4001 | + if (fcsjL < minSj) { | |
| 4002 | + Calendar calendar = new GregorianCalendar(); | |
| 4003 | + calendar.setTime(s.getScheduleDate()); | |
| 4004 | + calendar.add(calendar.DATE, 1); | |
| 4005 | + Date date_sch=calendar.getTime(); | |
| 4006 | + try { | |
| 4007 | + fscjT = sdf.parse(sdfnyr.format(date_sch) + " " + s.getFcsj()).getTime(); | |
| 4008 | + } catch (ParseException e) { | |
| 4009 | + // TODO Auto-generated catch block | |
| 4010 | + e.printStackTrace(); | |
| 4011 | + } | |
| 4012 | + | |
| 4013 | + } else { | |
| 4014 | + try { | |
| 4015 | + fscjT = sdf.parse(s.getScheduleDateStr() + " " + s.getFcsj()).getTime(); | |
| 4016 | + } catch (ParseException e) { | |
| 4017 | + // TODO Auto-generated catch block | |
| 4018 | + e.printStackTrace(); | |
| 4019 | + } | |
| 4020 | + ; | |
| 4021 | + } | |
| 4022 | + s.setFcsjT(fscjT); | |
| 4023 | + } | |
| 4024 | + | |
| 4025 | +// Collections.sort(listInfo, new compareLpFcsjType()); | |
| 4026 | + List<ScheduleRealInfo> listInfo2=new ArrayList<ScheduleRealInfo>(); | |
| 4027 | + | |
| 4028 | + Collections.sort(listInfo, new compareLpFcsjType()); | |
| 4029 | + for (int i = 0; i < listInfo.size(); i++) { | |
| 4030 | + ScheduleRealInfo t = listInfo.get(i); | |
| 4031 | + if (!lpName.equals(t.getLpName())) { | |
| 4032 | + zdsjActual = t.getZdsjActual(); | |
| 4033 | + zdsj = t.getZdsj(); | |
| 4034 | + t.setZdsjActual(""); | |
| 4035 | + t.setZdsj(""); | |
| 4036 | + } else { | |
| 4037 | + zdsj1 = t.getZdsj(); | |
| 4038 | + zdsjActual1 = t.getZdsjActual(); | |
| 4039 | + t.setZdsjActual(zdsjActual); | |
| 4040 | + t.setZdsj(zdsj); | |
| 4041 | + zdsj = zdsj1; | |
| 4042 | + zdsjActual = zdsjActual1; | |
| 4043 | + } | |
| 4044 | + | |
| 4045 | + | |
| 4046 | + | |
| 4047 | + lpName = t.getLpName(); | |
| 4048 | + listInfo2.add(t); | |
| 4049 | + | |
| 4050 | + } | |
| 4051 | + | |
| 4052 | + Collections.sort(listInfo2,new compareDirLpFcsjType()); | |
| 4053 | + for (int i = 0; i < listInfo2.size(); i++) { | |
| 4054 | + ScheduleRealInfo t=listInfo2.get(i); | |
| 4055 | + list.add(t); | |
| 4056 | + Set<ChildTaskPlan> childTaskPlans = t.getcTasks(); | |
| 4057 | + //计算营运里程,空驶里程 | |
| 4058 | + if (!childTaskPlans.isEmpty()) { | |
| 4059 | + List<ChildTaskPlan> listit = new ArrayList<ChildTaskPlan>(childTaskPlans); | |
| 4060 | + Collections.sort(listit, new ComparableChild()); | |
| 4061 | + for (int j = 0; j < listit.size(); j++) { | |
| 4062 | + ScheduleRealInfo s = new ScheduleRealInfo(); | |
| 4063 | + ChildTaskPlan childTaskPlan = listit.get(j); | |
| 4064 | + if (childTaskPlan.getCcId() == null) { | |
| 4065 | + if (childTaskPlan.isDestroy()) { | |
| 4066 | + s.setFcsjActual(""); | |
| 4067 | + s.setZdsjActual(""); | |
| 4068 | + } else { | |
| 4069 | + s.setFcsjActual(childTaskPlan.getStartDate()); | |
| 4070 | + s.setZdsjActual(""); | |
| 4071 | + s.setJhlc(Double.parseDouble(String.valueOf(childTaskPlan.getMileage()))); | |
| 4072 | + } | |
| 4073 | + s.setFcsj(childTaskPlan.getStartDate()); | |
| 4074 | + s.setZdsj(""); | |
| 4075 | + s.setQdzName(childTaskPlan.getStartStationName()); | |
| 4076 | + s.setZdzName(childTaskPlan.getEndStationName()); | |
| 4077 | + s.setRemarks(childTaskPlan.getRemarks()); | |
| 4078 | + s.setAdjustExps("子"); | |
| 4079 | + s.setLpName(""); | |
| 4080 | + list.add(s); | |
| 4081 | + } | |
| 4082 | + } | |
| 4083 | + } | |
| 4084 | + } | |
| 4085 | + List<ScheduleRealInfo> xList = new ArrayList<ScheduleRealInfo>(); | |
| 4086 | + List<ScheduleRealInfo> yList = new ArrayList<ScheduleRealInfo>(); | |
| 4087 | + List<ScheduleRealInfo> zList = new ArrayList<ScheduleRealInfo>(); | |
| 4088 | + List<ScheduleRealInfo> newList = new ArrayList<ScheduleRealInfo>(); | |
| 4089 | + if (list.size() > 0) { | |
| 4090 | + int a = list.size() % 3; | |
| 4091 | + int b = list.size() / 3; | |
| 4092 | + int x = 0, y = 0; | |
| 4093 | + if (a == 2) { | |
| 4094 | + x = b + 1; | |
| 4095 | + y = x * 2; | |
| 4096 | + } else if (a == 1) { | |
| 4097 | + x = b + 1; | |
| 4098 | + y = x * 2 - 1; | |
| 4099 | + } else { | |
| 4100 | + x = b; | |
| 4101 | + y = 2 * x; | |
| 4102 | + | |
| 4103 | + } | |
| 4104 | + for (int i = 0; i < list.size(); i++) { | |
| 4105 | + ScheduleRealInfo s = list.get(i); | |
| 4106 | + if (i + 1 <= x) { | |
| 4107 | + xList.add(s); | |
| 4108 | + } else if ((i + 1) > x && (i + 1) <= y) { | |
| 4109 | + yList.add(s); | |
| 4110 | + } else { | |
| 4111 | + zList.add(s); | |
| 4112 | + } | |
| 4113 | + } | |
| 4114 | + for (int i = 0; i < x; i++) { | |
| 4115 | + newList.add(xList.get(i)); | |
| 4116 | + if (yList.size() > i) { | |
| 4117 | + newList.add(yList.get(i)); | |
| 4118 | + } else { | |
| 4119 | + newList.add(new ScheduleRealInfo()); | |
| 4120 | + } | |
| 4121 | + if (zList.size() > i) { | |
| 4122 | + newList.add(zList.get(i)); | |
| 4123 | + } else { | |
| 4124 | + newList.add(new ScheduleRealInfo()); | |
| 4125 | + } | |
| 4126 | + | |
| 4127 | + } | |
| 4128 | + } | |
| 4129 | + /* for (int i = 0; i < newList.size(); i++) { | |
| 4130 | + ScheduleRealInfo t1 = newList.get(i); | |
| 4131 | + for (int j = 0; j < list.size(); j++) { | |
| 4132 | + ScheduleRealInfo t2 = list.get(j); | |
| 4133 | + if (t1.getId() == t2.getId()) { | |
| 4134 | + t1 = t2; | |
| 4135 | + } | |
| 4136 | + } | |
| 4137 | + }*/ | |
| 4138 | + | |
| 4139 | + for (int i = 0; i < newList.size(); i++) { | |
| 4140 | + ScheduleRealInfo t1 = newList.get(i); | |
| 4141 | + String reamrks1 = t1.getRemarks() == null ? "" : t1.getRemarks(); | |
| 4142 | + if (reamrks1.length() > 4) { | |
| 4143 | + t1.setRemarks(reamrks1.substring(0, 4)); | |
| 4144 | + t1.setRemark(reamrks1); | |
| 4145 | + } else { | |
| 4146 | + t1.setRemark(reamrks1); | |
| 4147 | + } | |
| 4148 | + } | |
| 4149 | + return newList; | |
| 4150 | + } | |
| 4151 | + | |
| 4152 | + @Override | |
| 4153 | + public List<ScheduleRealInfo> realScheduleList_mh_2(String line, String date) { | |
| 4154 | + List<ScheduleRealInfo> list = new ArrayList<ScheduleRealInfo>(); | |
| 4155 | + String lpName = "lpName"; | |
| 4156 | + String zdsj = ""; | |
| 4157 | + String zdsjActual = ""; | |
| 4158 | + String zdsj1 = ""; | |
| 4159 | + String zdsjActual1 = ""; | |
| 4160 | + List<ScheduleRealInfo> listInfo = scheduleRealInfoRepository.scheduleByDateAndLineQp(line, date); | |
| 4161 | + | |
| 4162 | + for (ScheduleRealInfo s : listInfo) { | |
| 4163 | + if (s.isDestroy() && s.isReissue()) { | |
| 4164 | + s.setRemark(""); | |
| 4165 | + s.setFcsjActual(s.getDfsj()); | |
| 4166 | + s.setZdsjActual(s.getZdsj()); | |
| 4167 | + s.setStatus(2); | |
| 4168 | + s.setJhlc(s.getJhlcOrig()); | |
| 4169 | + } | |
| 4170 | + } | |
| 4171 | + | |
| 4172 | + for (int i = 0; i < listInfo.size(); i++) { | |
| 4173 | + ScheduleRealInfo t = listInfo.get(i); | |
| 4174 | + if (!lpName.equals(t.getLpName())) { | |
| 4175 | + zdsjActual = t.getZdsjActual(); | |
| 4176 | + zdsj = t.getZdsj(); | |
| 4177 | + t.setZdsjActual(""); | |
| 4178 | + t.setZdsj(""); | |
| 4179 | + } else { | |
| 4180 | + zdsj1 = t.getZdsj(); | |
| 4181 | + zdsjActual1 = t.getZdsjActual(); | |
| 4182 | + t.setZdsjActual(zdsjActual); | |
| 4183 | + t.setZdsj(zdsj); | |
| 4184 | + zdsj = zdsj1; | |
| 4185 | + zdsjActual = zdsjActual1; | |
| 4186 | + } | |
| 4187 | + lpName = t.getLpName(); | |
| 4188 | + list.add(t); | |
| 4189 | + } | |
| 4190 | + | |
| 4191 | + List<ScheduleRealInfo> listInfo2 = scheduleRealInfoRepository.scheduleByDateAndLineQp2(line, date); | |
| 4192 | + List<ScheduleRealInfo> xList = new ArrayList<ScheduleRealInfo>(); | |
| 4193 | + List<ScheduleRealInfo> yList = new ArrayList<ScheduleRealInfo>(); | |
| 4194 | + List<ScheduleRealInfo> zList = new ArrayList<ScheduleRealInfo>(); | |
| 4195 | + List<ScheduleRealInfo> newList = new ArrayList<ScheduleRealInfo>(); | |
| 4196 | + if (listInfo2.size() > 0) { | |
| 4197 | + int a = listInfo2.size() % 3; | |
| 4198 | + int b = listInfo2.size() / 3; | |
| 4199 | + int x = 0, y = 0; | |
| 4200 | + if (a == 2) { | |
| 4201 | + x = b + 1; | |
| 4202 | + y = x * 2; | |
| 4203 | + } else if (b == 1) { | |
| 4204 | + x = b + 1; | |
| 4205 | + y = x * 2 - 1; | |
| 4206 | + } else { | |
| 4207 | + x = b; | |
| 4208 | + y = 2 * x; | |
| 4209 | + | |
| 4210 | + } | |
| 4211 | + for (int i = 0; i < listInfo2.size(); i++) { | |
| 4212 | + ScheduleRealInfo s = listInfo2.get(i); | |
| 4213 | + if (i + 1 <= x) { | |
| 4214 | + xList.add(s); | |
| 4215 | + } else if ((i + 1) > x && (i + 1) <= y) { | |
| 4216 | + yList.add(s); | |
| 4217 | + } else { | |
| 4218 | + zList.add(s); | |
| 4219 | + } | |
| 4220 | + } | |
| 4221 | + for (int i = 0; i < x; i++) { | |
| 4222 | + newList.add(xList.get(i)); | |
| 4223 | + if (yList.size() > i) { | |
| 4224 | + newList.add(yList.get(i)); | |
| 4225 | + } else { | |
| 4226 | + newList.add(new ScheduleRealInfo()); | |
| 4227 | + } | |
| 4228 | + if (zList.size() > i) { | |
| 4229 | + newList.add(zList.get(i)); | |
| 4230 | + } else { | |
| 4231 | + newList.add(new ScheduleRealInfo()); | |
| 4232 | + } | |
| 4233 | + | |
| 4234 | + } | |
| 4235 | + } | |
| 4236 | + for (int i = 0; i < newList.size(); i++) { | |
| 4237 | + ScheduleRealInfo t1 = newList.get(i); | |
| 4238 | + for (int j = 0; j < list.size(); j++) { | |
| 4239 | + ScheduleRealInfo t2 = list.get(j); | |
| 4240 | + if (t1.getId() == t2.getId()) { | |
| 4241 | + t1 = t2; | |
| 4242 | + } | |
| 4243 | + } | |
| 4244 | + } | |
| 4245 | + return newList; | |
| 4246 | + } | |
| 4247 | + | |
| 4248 | + @Override | |
| 4249 | + public List<ScheduleRealInfo> realScheduleListQp(String line, String date) { | |
| 4250 | + List<ScheduleRealInfo> list = new ArrayList<ScheduleRealInfo>(); | |
| 4251 | + String lpName = "lpName"; | |
| 4252 | + String zdsj = ""; | |
| 4253 | + String zdsjActual = ""; | |
| 4254 | + String zdsj1 = ""; | |
| 4255 | + String zdsjActual1 = ""; | |
| 4256 | + List<ScheduleRealInfo> listInfo = scheduleRealInfoRepository.scheduleByDateAndLineQp(line, date); | |
| 4257 | + for (int i = 0; i < listInfo.size(); i++) { | |
| 4258 | + ScheduleRealInfo t = listInfo.get(i); | |
| 4259 | + if (!lpName.equals(t.getLpName())) { | |
| 4260 | + zdsjActual = t.getZdsjActual(); | |
| 4261 | + zdsj = t.getZdsj(); | |
| 4262 | + t.setZdsjActual(""); | |
| 4263 | + t.setZdsj(""); | |
| 4264 | + } else { | |
| 4265 | + zdsj1 = t.getZdsj(); | |
| 4266 | + zdsjActual1 = t.getZdsjActual(); | |
| 4267 | + t.setZdsjActual(zdsjActual); | |
| 4268 | + t.setZdsj(zdsj); | |
| 4269 | + zdsj = zdsj1; | |
| 4270 | + zdsjActual = zdsjActual1; | |
| 4271 | + } | |
| 4272 | + | |
| 4273 | + lpName = t.getLpName(); | |
| 4274 | + list.add(t); | |
| 4275 | + } | |
| 4276 | + return list; | |
| 4277 | + } | |
| 4278 | + | |
| 4279 | + public List<Map<String, Object>> yesterdayDataList(String line, String date, String gsbm, String fgsbm, String jGh, String nbbm) { | |
| 4280 | + List<Map<String, Object>> yesterdayDataList = new ArrayList<Map<String, Object>>(); | |
| 4281 | + if (line.equals("")) { | |
| 4282 | + yesterdayDataList = scheduleRealInfoRepository.yesterdayDataList(line, date, gsbm, fgsbm, nbbm); | |
| 4283 | + } else { | |
| 4284 | + yesterdayDataList = scheduleRealInfoRepository.yesterdayDataList_eq(line, date, gsbm, fgsbm, nbbm); | |
| 4285 | + } | |
| 4286 | + List<ScheduleRealInfo> lists = scheduleRealInfoRepository.queryListWaybill3(jGh, nbbm, date, gsbm, fgsbm); | |
| 4287 | + for (int x = 0; x < yesterdayDataList.size(); x++) { | |
| 4288 | + String jsy = yesterdayDataList.get(x).get("jGh").toString(); | |
| 4289 | + String clZbh = yesterdayDataList.get(x).get("clZbh").toString(); | |
| 4290 | + String xlbm = yesterdayDataList.get(x).get("xlBm").toString(); | |
| 4291 | + String lp = yesterdayDataList.get(x).get("lpName").toString(); | |
| 4292 | + String realExecDate=yesterdayDataList.get(x).get("realExecDate").toString(); | |
| 4293 | + String fcsj[] =realExecDate.split(" "); | |
| 4294 | + //取出最小计划发车时间 | |
| 4295 | + yesterdayDataList.get(x).put("fcsj", fcsj[1]); | |
| 4296 | + Map<String, Object> map = new HashMap<String, Object>(); | |
| 4297 | + boolean fage = true; | |
| 4298 | + String company = ""; | |
| 4299 | + String bCompany = ""; | |
| 4300 | + String lineName=""; | |
| 4301 | + String jName=""; | |
| 4302 | + List<ScheduleRealInfo> listS = new ArrayList<ScheduleRealInfo>(); | |
| 4303 | + for (ScheduleRealInfo scheduleRealInfo : lists) { | |
| 4304 | + if (scheduleRealInfo.getjGh().equals(jsy) | |
| 4305 | + && scheduleRealInfo.getClZbh().equals(clZbh) | |
| 4306 | + && scheduleRealInfo.getXlBm().equals(xlbm) | |
| 4307 | + && scheduleRealInfo.getLpName().equals(lp)) { | |
| 4308 | + if (fage) { | |
| 4309 | + //根据线路代码获取公司 | |
| 4310 | + company = scheduleRealInfo.getGsBm(); | |
| 4311 | + bCompany = scheduleRealInfo.getFgsBm(); | |
| 4312 | + lineName = scheduleRealInfo.getXlName(); | |
| 4313 | + jName= scheduleRealInfo.getjName(); | |
| 4314 | + fage = false; | |
| 4315 | + } | |
| 4316 | + Set<ChildTaskPlan> cts = scheduleRealInfo.getcTasks(); | |
| 4317 | + if (cts != null && cts.size() > 0) { | |
| 4318 | + listS.add(scheduleRealInfo); | |
| 4319 | + } else { | |
| 4320 | + if (scheduleRealInfo.getZdsjActual() != null && scheduleRealInfo.getFcsjActual() != null) { | |
| 4321 | + listS.add(scheduleRealInfo); | |
| 4322 | + } | |
| 4323 | + } | |
| 4324 | + } | |
| 4325 | + } | |
| 4326 | + yesterdayDataList.get(x).put("company", company); | |
| 4327 | + yesterdayDataList.get(x).put("bCompany", bCompany); | |
| 4328 | + yesterdayDataList.get(x).put("lineName", lineName); | |
| 4329 | + yesterdayDataList.get(x).put("jName", jName); | |
| 4330 | + Double ljgl = culateMieageService.culateLjgl(listS); | |
| 4331 | + Double sjgl = culateMieageService.culateSjgl(listS); | |
| 4332 | + Double ksgl = culateMieageService.culateKsgl(listS); | |
| 4333 | + Double jccgl = culateMieageService.culateJccgl(listS); | |
| 4334 | + Double zyygl = Arith.add(sjgl, ljgl); | |
| 4335 | + Double zksgl = Arith.add(ksgl, jccgl); | |
| 4336 | + Double zlc = Arith.add(zyygl, zksgl); | |
| 4337 | + yesterdayDataList.get(x).put("totalKilometers", zlc); | |
| 4338 | + | |
| 4339 | + } | |
| 4340 | + //增加顺序号 | |
| 4341 | + for (int i = 0; i < yesterdayDataList.size(); i++) { | |
| 4342 | + if (i == 0) { | |
| 4343 | + yesterdayDataList.get(i).put("seqNumber", 1); | |
| 4344 | + } else { | |
| 4345 | + if (yesterdayDataList.get(i - 1).get("clZbh").equals(yesterdayDataList.get(i).get("clZbh"))) { | |
| 4346 | + yesterdayDataList.get(i).put("seqNumber", 1 + (int) yesterdayDataList.get(i - 1).get("seqNumber")); | |
| 4347 | + } else { | |
| 4348 | + yesterdayDataList.get(i).put("seqNumber", 1); | |
| 4349 | + } | |
| 4350 | + } | |
| 4351 | + } | |
| 4352 | + | |
| 4353 | + return yesterdayDataList; | |
| 4354 | + } | |
| 4355 | + | |
| 4356 | + /** | |
| 4357 | + * 批量调整人车 | |
| 4358 | + */ | |
| 4359 | + @Override | |
| 4360 | + public Map<String, Object> multi_tzrc(List<ChangePersonCar> cpcs, String userId) { | |
| 4361 | + Map<String, Object> rs = new HashMap<>(); | |
| 4362 | + Set<ScheduleRealInfo> set = new HashSet<>(); | |
| 4363 | + | |
| 4364 | + ScheduleRealInfo sch; | |
| 4365 | + | |
| 4366 | + String jGh = null, jName, sGh, sName; | |
| 4367 | + for (ChangePersonCar cpc : cpcs) { | |
| 4368 | + | |
| 4369 | + sch = dayOfSchedule.get(cpc.getSchId()); | |
| 4370 | + if (sch == null) | |
| 4371 | + continue; | |
| 4372 | + | |
| 4373 | + if (cpc.getClZbh() != null) { | |
| 4374 | + if (!carExist(sch.getGsBm(), cpc.getClZbh())) { | |
| 4375 | + rs.put("msg", "车辆 " + cpc.getClZbh() + " <a href=\"/#/busInfoManage\" target=_blank>车辆基础信息</a> 里找不到!"); | |
| 4376 | + rs.put("status", ResponseCode.ERROR); | |
| 4377 | + return rs; | |
| 4378 | + } else if (!sch.getGsBm().equals(BasicData.nbbm2CompanyCodeMap.get(cpc.getClZbh()))) { | |
| 4379 | + rs.put("msg", sch.getXlName() + "所属的公司编码下找不到自编号为【" + cpc.getClZbh() + "】的车辆"); | |
| 4380 | + rs.put("status", ResponseCode.ERROR); | |
| 4381 | + return rs; | |
| 4382 | + } | |
| 4383 | + } | |
| 4384 | + | |
| 4385 | + if (StringUtils.isNotEmpty(cpc.getJsy())) { | |
| 4386 | + try{ | |
| 4387 | + jGh = cpc.getJsy().split("/")[0]; | |
| 4388 | + }catch (Exception e){ | |
| 4389 | + logger.error("", e); | |
| 4390 | + rs.put("msg", "驾驶员参数异常!!"); | |
| 4391 | + rs.put("status", ResponseCode.ERROR); | |
| 4392 | + return rs; | |
| 4393 | + } | |
| 4394 | + | |
| 4395 | + jName = getPersonName(sch.getGsBm(), jGh); | |
| 4396 | + if (StringUtils.isEmpty(jName)) { | |
| 4397 | + rs.put("msg", sch.getXlName() + "所属的公司编码下找不到工号为【" + jGh + "】的驾驶员"); | |
| 4398 | + rs.put("status", ResponseCode.ERROR); | |
| 4399 | + return rs; | |
| 4400 | + } | |
| 4401 | + } | |
| 4402 | + | |
| 4403 | + | |
| 4404 | + //为换人换车情况表写入数据 | |
| 4405 | + schModifyLog.saveChangetochange(sch, cpc, userId); | |
| 4406 | + //日志记录 | |
| 4407 | + ScheduleModifyLogger.tzrc(sch, cpc, userId); | |
| 4408 | + | |
| 4409 | + //换驾驶员 | |
| 4410 | + if (StringUtils.isNotEmpty(cpc.getJsy())) { | |
| 4411 | + //换驾驶员 | |
| 4412 | + if (persoChange(sch, jGh)) | |
| 4413 | + set.add(sch); | |
| 4414 | + } | |
| 4415 | + | |
| 4416 | + //换售票员 | |
| 4417 | + if (StringUtils.isNotEmpty(cpc.getSpy()) | |
| 4418 | + && !"/".equals(StringUtils.trim(cpc.getSpy()))) { | |
| 4419 | + | |
| 4420 | + sGh = cpc.getSpy().split("/")[0]; | |
| 4421 | + sName = getPersonName(sch.getGsBm(), sGh); | |
| 4422 | + if (StringUtils.isEmpty(sName)) { | |
| 4423 | + rs.put("msg", sch.getXlName() + "所属的公司编码下找不到工号为【" + sGh + "】的售票员"); | |
| 4424 | + rs.put("status", ResponseCode.ERROR); | |
| 4425 | + return rs; | |
| 4426 | + } | |
| 4427 | + | |
| 4428 | + /*if(!sGh.equals(sch.getsGh())) | |
| 4429 | + sb.append(sch.getsGh() + " 换 " + sGh + ";");*/ | |
| 4430 | + if (persoChangeSPY(sch, sGh)) | |
| 4431 | + set.add(sch); | |
| 4432 | + } else if (StringUtils.isNotEmpty(sch.getsGh())) { | |
| 4433 | + sch.setsGh(""); | |
| 4434 | + sch.setsName(""); | |
| 4435 | + } | |
| 4436 | + | |
| 4437 | + //换车 | |
| 4438 | + if (StringUtils.isNotEmpty(cpc.getClZbh()) && !cpc.getClZbh().equals(sch.getClZbh())) { | |
| 4439 | + //sb.append(sch.getClZbh() + " 换 " + cpc.getClZbh() + ";"); | |
| 4440 | + set.add(sch); | |
| 4441 | + set.addAll(dayOfSchedule.changeCar(sch, cpc.getClZbh())); | |
| 4442 | + } | |
| 4443 | + | |
| 4444 | + /*if(sb.length() > 0) | |
| 4445 | + sch.setRemarks(sb.toString());*/ | |
| 4446 | + | |
| 4447 | + dayOfSchedule.save(sch); | |
| 4448 | + set.add(sch); | |
| 4449 | + | |
| 4450 | + } | |
| 4451 | + rs.put("ts", set); | |
| 4452 | + rs.put("status", ResponseCode.SUCCESS); | |
| 4453 | + return rs; | |
| 4454 | + } | |
| 4455 | + | |
| 4456 | + /** | |
| 4457 | + * @Title: persoChange | |
| 4458 | + * @Description: TODO(班次换驾驶员) | |
| 4459 | + */ | |
| 4460 | + public boolean persoChange(ScheduleRealInfo sch, String jGh) { | |
| 4461 | + if (sch.getjGh().equals(jGh)) | |
| 4462 | + return false; | |
| 4463 | + String jName = getPersonName(sch.getGsBm(), jGh); | |
| 4464 | + if (StringUtils.isNotEmpty(jName)) { | |
| 4465 | + | |
| 4466 | + if (jGh.indexOf("-") != -1) | |
| 4467 | + sch.setjGh(jGh.substring(jGh.indexOf("-") + 1)); | |
| 4468 | + else | |
| 4469 | + sch.setjGh(jGh); | |
| 4470 | + | |
| 4471 | + sch.setjName(jName); | |
| 4472 | + return true; | |
| 4473 | + } | |
| 4474 | + return false; | |
| 4475 | + } | |
| 4476 | + | |
| 4477 | + /** | |
| 4478 | + * @Title: persoChange | |
| 4479 | + * @Description: TODO(班次换售票员) | |
| 4480 | + */ | |
| 4481 | + public boolean persoChangeSPY(ScheduleRealInfo sch, String sGh) { | |
| 4482 | + if (sch.getsGh().equals(sGh)) | |
| 4483 | + return false; | |
| 4484 | + String sName = getPersonName(sch.getGsBm(), sGh); | |
| 4485 | + if (StringUtils.isNotEmpty(sName)) { | |
| 4486 | + if (sGh.indexOf("-") != -1) | |
| 4487 | + sch.setsGh(sGh.substring(sGh.indexOf("-") + 1)); | |
| 4488 | + else | |
| 4489 | + sch.setsGh(sGh); | |
| 4490 | + sch.setsName(sName); | |
| 4491 | + return true; | |
| 4492 | + } | |
| 4493 | + return false; | |
| 4494 | + } | |
| 4495 | + | |
| 4496 | + /** | |
| 4497 | + * 批量待发调整 | |
| 4498 | + */ | |
| 4499 | + @Override | |
| 4500 | + public Map<String, Object> multi_dftz(List<DfsjChange> dfsjcs) { | |
| 4501 | + Map<String, Object> rs = new HashMap<>(), tempMap = new HashMap<>(); | |
| 4502 | + List<ScheduleRealInfo> list = new ArrayList<>(); | |
| 4503 | + | |
| 4504 | + for (DfsjChange dc : dfsjcs) { | |
| 4505 | + if (StringUtils.isEmpty(dc.getOld_dfsj()) || StringUtils.isEmpty(dc.getNew_dfsj())) | |
| 4506 | + continue; | |
| 4507 | + | |
| 4508 | + tempMap = outgoAdjust(dc.getSchId(), "", dc.getNew_dfsj(), null, "2", null); | |
| 4509 | + | |
| 4510 | + if (tempMap.get("status").equals(ResponseCode.SUCCESS)) { | |
| 4511 | + list.addAll((Collection<? extends ScheduleRealInfo>) tempMap.get("ts")); | |
| 4512 | + } | |
| 4513 | + } | |
| 4514 | + | |
| 4515 | + rs.put("status", ResponseCode.SUCCESS); | |
| 4516 | + rs.put("ts", list); | |
| 4517 | + return rs; | |
| 4518 | + } | |
| 4519 | + | |
| 4520 | + | |
| 4521 | + @Override | |
| 4522 | + public Map<String, Object> findKMBC1(String jName, String clZbh, | |
| 4523 | + String date, String enddate) { | |
| 4524 | + List<ScheduleRealInfo> list = scheduleRealInfoRepository.queryListWaybill4(jName, clZbh, date, enddate); | |
| 4525 | + DecimalFormat format = new DecimalFormat("0.00"); | |
| 4526 | +// int cjbc = scheduleRealInfoRepository.findCjbc(jName, clZbh, lpName); | |
| 4527 | +// int ljbc = scheduleRealInfoRepository.findLjbc(jName, clZbh, lpName); | |
| 4528 | + int jhbc = 0, cjbc = 0, ljbc = 0; | |
| 4529 | + double jhlc = 0, yygl = 0, ksgl = 0, tempJhlc = 0; | |
| 4530 | + float addMileage = 0l, remMileage = 0l; | |
| 4531 | + Map<String, Object> map = new HashMap<String, Object>(); | |
| 4532 | + for (ScheduleRealInfo scheduleRealInfo : list) { | |
| 4533 | + if (scheduleRealInfo != null) { | |
| 4534 | + //计划里程(主任务过滤掉临加班次), | |
| 4535 | + //烂班里程(主任务烂班), | |
| 4536 | + //临加里程(主任务临加), | |
| 4537 | + //计划班次,烂班班次,增加班次 | |
| 4538 | + tempJhlc = scheduleRealInfo.getJhlc() == null ? 0 : scheduleRealInfo.getJhlc(); | |
| 4539 | + if (scheduleRealInfo.isSflj()) { | |
| 4540 | + addMileage += tempJhlc; | |
| 4541 | + ljbc++; | |
| 4542 | + } else { | |
| 4543 | + jhlc += tempJhlc; | |
| 4544 | + jhbc++; | |
| 4545 | + if (scheduleRealInfo.getStatus() == -1) { | |
| 4546 | + remMileage += tempJhlc; | |
| 4547 | + cjbc++; | |
| 4548 | + } | |
| 4549 | + } | |
| 4550 | + Set<ChildTaskPlan> childTaskPlans = scheduleRealInfo.getcTasks(); | |
| 4551 | + //计算营运里程,空驶里程 | |
| 4552 | + if (childTaskPlans.isEmpty()) { | |
| 4553 | + if (scheduleRealInfo.getBcType().equals("in") || scheduleRealInfo.getBcType().equals("out") | |
| 4554 | + || scheduleRealInfo.getBcType().equals("venting")) { | |
| 4555 | + ksgl += tempJhlc; | |
| 4556 | + } else { | |
| 4557 | + yygl += tempJhlc; | |
| 4558 | + } | |
| 4559 | + } else { | |
| 4560 | + Iterator<ChildTaskPlan> it = childTaskPlans.iterator(); | |
| 4561 | + while (it.hasNext()) { | |
| 4562 | + ChildTaskPlan childTaskPlan = it.next(); | |
| 4563 | + if (childTaskPlan.getMileageType().equals("empty")) { | |
| 4564 | + ksgl += childTaskPlan.getMileage() == null ? 0 : childTaskPlan.getMileage(); | |
| 4565 | + } else { | |
| 4566 | + yygl += childTaskPlan.getMileage() == null ? 0 : childTaskPlan.getMileage(); | |
| 4567 | + } | |
| 4568 | + } | |
| 4569 | + } | |
| 4570 | + } | |
| 4571 | + } | |
| 4572 | + map.put("jhlc", format.format(jhlc)); | |
| 4573 | + map.put("remMileage", format.format(remMileage)); | |
| 4574 | + map.put("addMileage", format.format(addMileage)); | |
| 4575 | + map.put("yygl", format.format(yygl)); | |
| 4576 | + map.put("ksgl", format.format(ksgl)); | |
| 4577 | + map.put("realMileage", format.format(yygl + ksgl)); | |
| 4578 | + map.put("jhbc", jhbc); | |
| 4579 | + map.put("cjbc", cjbc); | |
| 4580 | + map.put("ljbc", ljbc); | |
| 4581 | + map.put("sjbc", jhbc - cjbc + ljbc); | |
| 4582 | + return map; | |
| 4583 | + } | |
| 4584 | + | |
| 4585 | + /** | |
| 4586 | + * 调整班次类型 | |
| 4587 | + * | |
| 4588 | + * @param id | |
| 4589 | + * @param bcType | |
| 4590 | + * @param remarks | |
| 4591 | + * @return | |
| 4592 | + */ | |
| 4593 | + @Override | |
| 4594 | + public Map<String, Object> changeBcType(Long id, String bcType, String remarks, String majorStationName) { | |
| 4595 | + Map<String, Object> rs = new HashMap<>(); | |
| 4596 | + | |
| 4597 | + try { | |
| 4598 | + ScheduleRealInfo sch = dayOfSchedule.get(id); | |
| 4599 | + if (sch != null) { | |
| 4600 | + sch.setBcType(bcType); | |
| 4601 | + sch.setRemarks(remarks); | |
| 4602 | + rs.put("status", ResponseCode.SUCCESS); | |
| 4603 | + rs.put("t", sch); | |
| 4604 | + | |
| 4605 | + if ("major".equals(bcType)) { | |
| 4606 | + sch.setMajorStationName(majorStationName); | |
| 4607 | + } | |
| 4608 | + | |
| 4609 | + dayOfSchedule.save(sch); | |
| 4610 | + } | |
| 4611 | + } catch (Exception e) { | |
| 4612 | + logger.error("", e); | |
| 4613 | + rs.put("status", ResponseCode.ERROR); | |
| 4614 | + } | |
| 4615 | + | |
| 4616 | + return rs; | |
| 4617 | + } | |
| 4618 | + | |
| 4619 | + @Override | |
| 4620 | + public Map<String, Object> historySave(ScheduleRealInfo sch) { | |
| 4621 | + Map<String, Object> rs = new HashMap<>(); | |
| 4622 | + rs.put("status", ResponseCode.ERROR); | |
| 4623 | + | |
| 4624 | + ScheduleRealInfo oldSch = super.findById(sch.getId()); | |
| 4625 | + // 检查调度日期 | |
| 4626 | + DateTimeFormatter formatter = DateTimeFormat.forPattern("yyyy-MM-dd"); | |
| 4627 | + long today = formatter.parseMillis(new DateTime().toString("yyyy-MM-dd")), scheduleDate = formatter.parseMillis(oldSch.getScheduleDateStr()); | |
| 4628 | + if (today < scheduleDate || today - scheduleDate > 86400000 * PrivilegeUtils.getHistoryEditDays()) { | |
| 4629 | + rs.put("status", ResponseCode.ERROR); | |
| 4630 | + rs.put("msg", "无效的调度日期"); | |
| 4631 | + return rs; | |
| 4632 | + } | |
| 4633 | + //事后日志记录 | |
| 4634 | + AfterwardsLogger aflog = AfterwardsLogger.start(oldSch, "事后调整"); | |
| 4635 | + | |
| 4636 | + //换车 | |
| 4637 | + if (StringUtils.isNotEmpty(sch.getClZbh()) && !oldSch.getClZbh().equals(sch.getClZbh())) { | |
| 4638 | + if (!carExist(oldSch.getGsBm(), sch.getClZbh())) { | |
| 4639 | + rs.put("msg", "车辆 " + sch.getClZbh() + " 不存在!"); | |
| 4640 | + return rs; | |
| 4641 | + } else { | |
| 4642 | + aflog.log("换车", oldSch.getClZbh(), sch.getClZbh()); | |
| 4643 | + oldSch.setClZbh(sch.getClZbh()); | |
| 4644 | + } | |
| 4645 | + } | |
| 4646 | + | |
| 4647 | + //换驾驶员 | |
| 4648 | + if (StringUtils.isNotEmpty(sch.getjGh()) && !oldSch.getjGh().equals(sch.getjGh())) { | |
| 4649 | + String jName = getPersonName(oldSch.getGsBm(), sch.getjGh()); | |
| 4650 | + if (StringUtils.isEmpty(jName)) { | |
| 4651 | + rs.put("msg", oldSch.getXlName() + "所属的公司编码下找不到工号为【" + sch.getjGh() + "】的驾驶员"); | |
| 4652 | + return rs; | |
| 4653 | + } | |
| 4654 | + aflog.log("换驾驶员", oldSch.getjGh() + "/" + oldSch.getjName(), sch.getjGh() + "/" + sch.getjName()); | |
| 4655 | + persoChange(oldSch, sch.getjGh()); | |
| 4656 | + } | |
| 4657 | + | |
| 4658 | + //换售票员 | |
| 4659 | + if (StringUtils.isNotEmpty(sch.getsGh()) && !oldSch.getsGh().equals(sch.getsGh())) { | |
| 4660 | + String sName = getPersonName(oldSch.getGsBm(), sch.getsGh()); | |
| 4661 | + if (StringUtils.isEmpty(sName)) { | |
| 4662 | + rs.put("msg", sch.getXlName() + "所属的公司编码下找不到工号为【" + sch.getsGh() + "】的售票员"); | |
| 4663 | + return rs; | |
| 4664 | + } | |
| 4665 | + aflog.log("换售票员", oldSch.getsGh() + "/" + oldSch.getsName(), sch.getsGh() + "/" + sch.getsName()); | |
| 4666 | + persoChangeSPY(oldSch, sch.getsGh()); | |
| 4667 | + } | |
| 4668 | + | |
| 4669 | + //烂班 | |
| 4670 | + boolean dest1 = oldSch.getStatus() == -1; | |
| 4671 | + boolean dest2 = sch.getStatus() == -1; | |
| 4672 | + if (!dest1 && dest2) { | |
| 4673 | + oldSch.destroy(); | |
| 4674 | + aflog.log("烂班"); | |
| 4675 | + } else if (dest1 && !dest2) { | |
| 4676 | + //撤销烂班 | |
| 4677 | + oldSch.setJhlc(oldSch.getJhlcOrig()); | |
| 4678 | + oldSch.setStatus(0); | |
| 4679 | + oldSch.calcStatus(); | |
| 4680 | + oldSch.setAdjustExps(null); | |
| 4681 | + aflog.log("撤销烂班"); | |
| 4682 | + } | |
| 4683 | + | |
| 4684 | + oldSch.setAdjustExps(sch.getAdjustExps()); | |
| 4685 | + | |
| 4686 | + /** | |
| 4687 | + * 修改班次里程 | |
| 4688 | + */ | |
| 4689 | + if (!oldSch.getJhlc().equals(sch.getJhlc())) { | |
| 4690 | + double jhlcNum = sch.getJhlc(); | |
| 4691 | + aflog.log("修改班次里程", oldSch.getJhlc(), jhlcNum); | |
| 4692 | + //烂班 | |
| 4693 | + if (jhlcNum == 0 && oldSch.getJhlcOrig() != 0) | |
| 4694 | + oldSch.destroy(); | |
| 4695 | + else { | |
| 4696 | + oldSch.setJhlc(jhlcNum); | |
| 4697 | + //临加班次,实际计划一起改 | |
| 4698 | + if (oldSch.isSflj()) | |
| 4699 | + oldSch.setJhlcOrig(jhlcNum); | |
| 4700 | + } | |
| 4701 | + } | |
| 4702 | + | |
| 4703 | + //待发时间 | |
| 4704 | + if (!CustomStringUtils.equals(oldSch.getDfsj(), sch.getDfsj())) { | |
| 4705 | + aflog.log("修改待发时间", oldSch.getDfsj(), sch.getDfsj()); | |
| 4706 | + oldSch.setDfsj(sch.getDfsj()); | |
| 4707 | + } | |
| 4708 | + //实发时间 | |
| 4709 | + if (!CustomStringUtils.equals(oldSch.getFcsjActual(), sch.getFcsjActual())) { | |
| 4710 | + aflog.log("修改实发时间", oldSch.getFcsjActual(), sch.getFcsjActual()); | |
| 4711 | + oldSch.setFcsjActual(sch.getFcsjActual()); | |
| 4712 | + } | |
| 4713 | + //实际终点 | |
| 4714 | + if (!CustomStringUtils.equals(oldSch.getZdsjActual(), sch.getZdsjActual())) { | |
| 4715 | + aflog.log("修改实达时间", oldSch.getZdsjActual(), sch.getZdsjActual()); | |
| 4716 | + oldSch.setZdsjActual(sch.getZdsjActual()); | |
| 4717 | + } | |
| 4718 | + | |
| 4719 | + //备注 | |
| 4720 | + if (!CustomStringUtils.equals(oldSch.getRemarks(), sch.getRemarks())) { | |
| 4721 | + aflog.log("修改备注", oldSch.getRemarks(), sch.getRemarks()); | |
| 4722 | + oldSch.setRemarks(sch.getRemarks()); | |
| 4723 | + } | |
| 4724 | + | |
| 4725 | + scheduleRealInfoRepository.save(oldSch); | |
| 4726 | + | |
| 4727 | + aflog.end(); | |
| 4728 | + rs.put("status", ResponseCode.SUCCESS); | |
| 4729 | + return rs; | |
| 4730 | + } | |
| 4731 | + | |
| 4732 | + @Autowired | |
| 4733 | + SvgAttributeRepository svgAttributeRepository; | |
| 4734 | + | |
| 4735 | + @Override | |
| 4736 | + public Map<String, Object> svgAttr(String jsonStr) { | |
| 4737 | + Map<String, Object> rs = new HashMap<>(); | |
| 4738 | + | |
| 4739 | + try { | |
| 4740 | + JSONObject jObj = JSONObject.parseObject(StringEscapeUtils.unescapeHtml4(jsonStr)); | |
| 4741 | + | |
| 4742 | + SvgAttribute svgAttribute = new SvgAttribute(); | |
| 4743 | + svgAttribute.setLineCode(jObj.getString("lineCode")); | |
| 4744 | + svgAttribute.setHideStations(jObj.getString("hideStations")); | |
| 4745 | + svgAttribute.setNicknames(jObj.getString("nicknames")); | |
| 4746 | + svgAttributeRepository.save(svgAttribute); | |
| 4747 | + | |
| 4748 | + rs.put("t", svgAttribute); | |
| 4749 | + rs.put("status", ResponseCode.SUCCESS); | |
| 4750 | + } catch (Exception e) { | |
| 4751 | + logger.error("", e); | |
| 4752 | + rs.put("status", ResponseCode.ERROR); | |
| 4753 | + } | |
| 4754 | + return rs; | |
| 4755 | + } | |
| 4756 | + | |
| 4757 | + @Override | |
| 4758 | + public Map<String, Object> findSvgAttr(String idx) { | |
| 4759 | + Map<String, Object> rs = new HashMap<>(); | |
| 4760 | + try { | |
| 4761 | + List<String> lineCodes = Splitter.on(",").splitToList(idx); | |
| 4762 | + List<SvgAttribute> list = svgAttributeRepository.findSvgAttr(lineCodes); | |
| 4763 | + | |
| 4764 | + rs.put("status", ResponseCode.SUCCESS); | |
| 4765 | + rs.put("list", list); | |
| 4766 | + } catch (Exception e) { | |
| 4767 | + logger.error("", e); | |
| 4768 | + rs.put("status", ResponseCode.ERROR); | |
| 4769 | + } | |
| 4770 | + return rs; | |
| 4771 | + } | |
| 4772 | + | |
| 4773 | + @Override | |
| 4774 | + public Map<String, Object> addRemarks(Long id, String remarks) { | |
| 4775 | + Map<String, Object> rs = new HashMap<>(); | |
| 4776 | + try { | |
| 4777 | + ScheduleRealInfo sch = dayOfSchedule.get(id); | |
| 4778 | + sch.addRemarks(remarks); | |
| 4779 | + | |
| 4780 | + rs.put("status", ResponseCode.SUCCESS); | |
| 4781 | + rs.put("t", sch); | |
| 4782 | + } catch (Exception e) { | |
| 4783 | + logger.error("", e); | |
| 4784 | + rs.put("status", ResponseCode.ERROR); | |
| 4785 | + } | |
| 4786 | + return rs; | |
| 4787 | + } | |
| 4788 | + | |
| 4789 | + @Override | |
| 4790 | + public List<Map<String, Object>> yesterdayDataList(String line) { | |
| 4791 | + // TODO Auto-generated method stub | |
| 4792 | + return null; | |
| 4793 | + } | |
| 4794 | + | |
| 4795 | + @Override | |
| 4796 | + public List<ScheduleRealInfo> exportWaybillQp(String clZbh, String date, String line) { | |
| 4797 | + // TODO Auto-generated method stub | |
| 4798 | + ReportUtils ee = new ReportUtils(); | |
| 4799 | + ReportRelatedUtils rru = new ReportRelatedUtils(); | |
| 4800 | + List<Iterator<?>> list = new ArrayList<Iterator<?>>(); | |
| 4801 | + List<ScheduleRealInfo> scheduleRealInfos = scheduleRealInfoRepository.queryListWaybill2(clZbh, date, line); | |
| 4802 | + List<Map<String, Object>> listMap = new ArrayList<Map<String, Object>>(); | |
| 4803 | + | |
| 4804 | + DecimalFormat format = new DecimalFormat("0.00"); | |
| 4805 | +// int cjbc = scheduleRealInfoRepository.findCjbc(jName, clZbh, lpName); | |
| 4806 | +// int ljbc = scheduleRealInfoRepository.findLjbc(jName, clZbh, lpName); | |
| 4807 | + int jhbc = 0, cjbc = 0, ljbc = 0; | |
| 4808 | + double jhlc = 0, yygl = 0, ksgl = 0, tempJhlc = 0, jcclc = 0; | |
| 4809 | + float addMileage = 0l, remMileage = 0l, addgl = 0, remgl = 0; | |
| 4810 | + int xyz = 1; | |
| 4811 | + Map<String, Object> map; | |
| 4812 | + for (ScheduleRealInfo scheduleRealInfo : scheduleRealInfos) { | |
| 4813 | + if (scheduleRealInfo != null) { | |
| 4814 | + //计算计划里程(主任务过滤掉临加班次),烂班里程,临加里程,计划班次,烂班班次,增加班次 | |
| 4815 | + //计划里程(主任务过滤掉临加班次), | |
| 4816 | + //烂班里程(主任务烂班), | |
| 4817 | + //临加里程(主任务临加), | |
| 4818 | + //计划班次,烂班班次,增加班次 | |
| 4819 | + double jh = 0, sj = 0; | |
| 4820 | + tempJhlc = scheduleRealInfo.getJhlc() == null ? 0 : scheduleRealInfo.getJhlc(); | |
| 4821 | + if (scheduleRealInfo.isSflj()) { | |
| 4822 | + ljbc++; | |
| 4823 | + } else { | |
| 4824 | + if (!(scheduleRealInfo.getBcType().equals("in") | |
| 4825 | + || scheduleRealInfo.getBcType().equals("out"))) { | |
| 4826 | + jhbc++; | |
| 4827 | + jh += tempJhlc; | |
| 4828 | + } | |
| 4829 | + if (scheduleRealInfo.getStatus() == -1) { | |
| 4830 | + remMileage += tempJhlc; | |
| 4831 | + cjbc++; | |
| 4832 | + } | |
| 4833 | + } | |
| 4834 | + Set<ChildTaskPlan> childTaskPlans = scheduleRealInfo.getcTasks(); | |
| 4835 | + //计算营运里程,空驶里程 | |
| 4836 | + if (childTaskPlans.isEmpty()) { | |
| 4837 | + if (scheduleRealInfo.getBcType().equals("in") || scheduleRealInfo.getBcType().equals("out") | |
| 4838 | + ) { | |
| 4839 | + jcclc += tempJhlc; | |
| 4840 | + } else { | |
| 4841 | + if (scheduleRealInfo.getStatus() != -1) { | |
| 4842 | + if (scheduleRealInfo.isSflj()) { | |
| 4843 | + addMileage += tempJhlc; | |
| 4844 | + } | |
| 4845 | + sj += tempJhlc; | |
| 4846 | + } | |
| 4847 | + } | |
| 4848 | + } else { | |
| 4849 | + Iterator<ChildTaskPlan> it = childTaskPlans.iterator(); | |
| 4850 | + while (it.hasNext()) { | |
| 4851 | + ChildTaskPlan childTaskPlan = it.next(); | |
| 4852 | + if (childTaskPlan.getMileageType().equals("empty")) { | |
| 4853 | + if (childTaskPlan.isDestroy()) { | |
| 4854 | + remMileage += childTaskPlan.getMileage() == null ? 0 : childTaskPlan.getMileage(); | |
| 4855 | + } else { | |
| 4856 | + if (scheduleRealInfo.isSflj()) { | |
| 4857 | + addMileage += tempJhlc; | |
| 4858 | + } | |
| 4859 | + ksgl += childTaskPlan.getMileage() == null ? 0 : childTaskPlan.getMileage(); | |
| 4860 | + } | |
| 4861 | + } else { | |
| 4862 | + if (childTaskPlan.isDestroy()) { | |
| 4863 | + remMileage += childTaskPlan.getMileage() == null ? 0 : childTaskPlan.getMileage(); | |
| 4864 | +// cjbc++; | |
| 4865 | + } else { | |
| 4866 | + if (scheduleRealInfo.isSflj()) { | |
| 4867 | + addMileage += tempJhlc; | |
| 4868 | + } | |
| 4869 | + sj += childTaskPlan.getMileage() == null ? 0 : childTaskPlan.getMileage(); | |
| 4870 | + } | |
| 4871 | + } | |
| 4872 | + } | |
| 4873 | + } | |
| 4874 | + | |
| 4875 | + if (!(scheduleRealInfo.getBcType().equals("in") || scheduleRealInfo.getBcType().equals("out"))) { | |
| 4876 | + map = new HashMap<String, Object>(); | |
| 4877 | + try { | |
| 4878 | + scheduleRealInfo.setBcs(xyz); | |
| 4879 | + xyz++; | |
| 4880 | + Set<ChildTaskPlan> cs = scheduleRealInfo.getcTasks(); | |
| 4881 | + Double sjlc = 0.0; | |
| 4882 | + if (!cs.isEmpty()) { | |
| 4883 | + Iterator<ChildTaskPlan> it = cs.iterator(); | |
| 4884 | + while (it.hasNext()) { | |
| 4885 | + ChildTaskPlan c = it.next(); | |
| 4886 | + if (!c.isDestroy()) { | |
| 4887 | + sjlc += c.getMileage() == null ? 0 : c.getMileage(); | |
| 4888 | + } | |
| 4889 | + | |
| 4890 | + } | |
| 4891 | + } else { | |
| 4892 | + if (scheduleRealInfo.getStatus() != -1) { | |
| 4893 | + sjlc = scheduleRealInfo.getJhlc(); | |
| 4894 | + } | |
| 4895 | + } | |
| 4896 | + scheduleRealInfo.setjName(scheduleRealInfo.getjGh() + scheduleRealInfo.getjName()); | |
| 4897 | + scheduleRealInfo.setsName(scheduleRealInfo.getsGh() + scheduleRealInfo.getsName()); | |
| 4898 | + scheduleRealInfo.setSjlc(format.format(sjlc)); | |
| 4899 | + map = rru.getMapValue(scheduleRealInfo); | |
| 4900 | + String zdsj = scheduleRealInfo.getZdsj(); | |
| 4901 | + String zdsjActual = scheduleRealInfo.getZdsjActual(); | |
| 4902 | + if (zdsj != null && zdsjActual != null && | |
| 4903 | + !zdsj.equals(zdsjActual)) { | |
| 4904 | + int zdsjT = Integer.valueOf(zdsj.split(":")[0]) * 60 + Integer.valueOf(zdsj.split(":")[1]); | |
| 4905 | + int zdsjAT = Integer.valueOf(zdsjActual.split(":")[0]) * 60 + Integer.valueOf(zdsjActual.split(":")[1]); | |
| 4906 | + if (zdsj.compareTo(zdsjActual) > 0) { | |
| 4907 | + if (zdsjT - zdsjAT > 1000) { | |
| 4908 | + map.put("fast", ""); | |
| 4909 | + map.put("slow", zdsjAT - zdsjT + 1440); | |
| 4910 | + } else { | |
| 4911 | + map.put("fast", TimeUtils.getTimeDifference(zdsj, zdsjActual)); | |
| 4912 | + map.put("slow", ""); | |
| 4913 | + } | |
| 4914 | + } else { | |
| 4915 | + if (zdsjAT - zdsjT > 1000) { | |
| 4916 | + map.put("fast", zdsjT - zdsjAT + 1440); | |
| 4917 | + map.put("slow", ""); | |
| 4918 | + } else { | |
| 4919 | + map.put("fast", ""); | |
| 4920 | + map.put("slow", TimeUtils.getTimeDifference(zdsj, zdsjActual)); | |
| 4921 | + } | |
| 4922 | + } | |
| 4923 | + } else { | |
| 4924 | + map.put("fast", ""); | |
| 4925 | + map.put("slow", ""); | |
| 4926 | + } | |
| 4927 | + listMap.add(map); | |
| 4928 | + } catch (Exception e) { | |
| 4929 | + e.printStackTrace(); | |
| 4930 | + } | |
| 4931 | + } | |
| 4932 | + jhlc += jh; | |
| 4933 | + yygl += sj; | |
| 4934 | + if (jh > sj) { | |
| 4935 | + remgl += jh - sj; | |
| 4936 | + } else { | |
| 4937 | + addgl += sj - jh; | |
| 4938 | + } | |
| 4939 | + } | |
| 4940 | + } | |
| 4941 | + | |
| 4942 | + | |
| 4943 | + List<Ylxxb> listYlxxb = ylxxbRepository.queryListYlxxb(clZbh, date); | |
| 4944 | + Double jzl = 0.0; | |
| 4945 | + for (int t = 0; t < listYlxxb.size(); t++) { | |
| 4946 | + Ylxxb y = listYlxxb.get(t); | |
| 4947 | + jzl += y.getJzl(); | |
| 4948 | + } | |
| 4949 | + | |
| 4950 | + //计算里程和班次数,并放入Map里 | |
| 4951 | + map = findKMBCQp(clZbh, date, line); | |
| 4952 | + map.put("jzl", jzl); | |
| 4953 | +// map.put("jhlc", format.format(jhlc + jcclc)); | |
| 4954 | +// map.put("yygljh", format.format(jhlc)); | |
| 4955 | +// map.put("ssgl", format.format(remMileage)); | |
| 4956 | +// map.put("ksgl", format.format(ksgl)); | |
| 4957 | +// map.put("yyglsj", format.format(yygl)); | |
| 4958 | +// map.put("jhbc", jhbc); | |
| 4959 | +// map.put("jcclc", jcclc); | |
| 4960 | +// | |
| 4961 | +// map.put("ljgl", format.format(addMileage)); | |
| 4962 | +// map.put("ssbc", cjbc); | |
| 4963 | +// map.put("ysgl", format.format(yygl)); | |
| 4964 | +// map.put("sjbc", jhbc - cjbc + ljbc); | |
| 4965 | +// map.put("zgl", format.format(yygl + ksgl + jcclc)); | |
| 4966 | +// map.put("ljbc", ljbc); | |
| 4967 | + | |
| 4968 | + String zdp = "", zwdp = "", wdp = ""; | |
| 4969 | + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm"); | |
| 4970 | + List<DutyEmployee> listDtuy = dutyEmployeeService.getDutyEmployee(line, date + "00:00", date + "23:59"); | |
| 4971 | + try { | |
| 4972 | + Long fcsj1 = sdf.parse(date + " 03:00").getTime(); | |
| 4973 | + Long fcsj2 = sdf.parse(date + " 11:00").getTime(); | |
| 4974 | + Long fcsj3 = sdf.parse(date + " 22:00").getTime(); | |
| 4975 | + for (int i = 0; i < listDtuy.size(); i++) { | |
| 4976 | + DutyEmployee t = listDtuy.get(i); | |
| 4977 | + Long ts = t.getTs(); | |
| 4978 | + if (ts > fcsj1 && ts < fcsj2) { | |
| 4979 | + if (zdp.indexOf(t.getuName()) == -1) { | |
| 4980 | + zdp += t.getuName() + ","; | |
| 4981 | + | |
| 4982 | + } | |
| 4983 | + } else if (ts > fcsj2 && ts < fcsj3) { | |
| 4984 | + if (zwdp.indexOf(t.getuName()) == -1) { | |
| 4985 | + zwdp += t.getuName() + ","; | |
| 4986 | + } | |
| 4987 | + } else { | |
| 4988 | + if (wdp.indexOf(t.getuName()) == -1) { | |
| 4989 | + wdp += t.getuName() + ","; | |
| 4990 | + } | |
| 4991 | + } | |
| 4992 | + } | |
| 4993 | + } catch (ParseException e) { | |
| 4994 | + // TODO Auto-generated catch block | |
| 4995 | + e.printStackTrace(); | |
| 4996 | + } | |
| 4997 | + map.put("zdp", zdp); | |
| 4998 | + map.put("zwdp", zwdp); | |
| 4999 | + map.put("wdp", wdp); | |
| 5000 | + String path = this.getClass().getResource("/").getPath() + "static/pages/forms/"; | |
| 5001 | + list.add(listMap.iterator()); | |
| 5002 | + ee.excelReplace(list, new Object[]{scheduleRealInfos.get(0), map}, path + "mould/waybill_qingpu.xls", | |
| 5003 | + path + "export/" + date + "-" + clZbh + "-行车路单.xls"); | |
| 5004 | + | |
| 5005 | + return scheduleRealInfos; | |
| 5006 | + } | |
| 5007 | + | |
| 5008 | + @Override | |
| 5009 | + public Map<String, Object> findKMBCQp(String clZbh, String date, String line) { | |
| 5010 | + // TODO Auto-generated method stub | |
| 5011 | + List<ScheduleRealInfo> lists = scheduleRealInfoRepository.queryListWaybill2(clZbh, date, line); | |
| 5012 | + DecimalFormat format = new DecimalFormat("0.00"); | |
| 5013 | +// int cjbc = scheduleRealInfoRepository.findCjbc(jName, clZbh, lpName); | |
| 5014 | +// int ljbc = scheduleRealInfoRepository.findLjbc(jName, clZbh, lpName); | |
| 5015 | + int jhbc = 0, cjbc = 0, ljbc = 0, sjbc = 0; | |
| 5016 | + double jhlc = 0, yygl = 0, ksgl = 0, tempJhlc = 0, jcclc = 0, ljjcclc = 0, jhjcclc = 0; | |
| 5017 | + double addMileage = 0, remMileage = 0, addgl = 0, remgl = 0; | |
| 5018 | + Map<String, Object> map = new HashMap<String, Object>(); | |
| 5019 | + jhlc = culateMieageService.culateJhgl(lists); | |
| 5020 | + jcclc = culateMieageService.culateJccgl(lists); | |
| 5021 | + jhjcclc = culateMieageService.culateJhJccgl(lists); | |
| 5022 | + remMileage = culateMieageService.culateLbgl(lists); | |
| 5023 | + ksgl = culateMieageService.culateKsgl(lists); | |
| 5024 | + yygl = culateMieageService.culateSjgl(lists); | |
| 5025 | + jhbc = culateMieageService.culateJhbc(lists, ""); | |
| 5026 | + addMileage = culateMieageService.culateLjgl(lists); | |
| 5027 | + cjbc = culateMieageService.culateLbbc(lists); | |
| 5028 | + sjbc = culateMieageService.culateSjbc(lists, ""); | |
| 5029 | + ljbc = culateMieageService.culateLjbc(lists, ""); | |
| 5030 | + double zyygl = Arith.add(yygl, addMileage); | |
| 5031 | + double zksgl = Arith.add(ksgl, jcclc); | |
| 5032 | + map.put("jhlc", Arith.add(jhlc, jhjcclc)); | |
| 5033 | + map.put("yygljh", jhlc); | |
| 5034 | + map.put("ssgl", remMileage); | |
| 5035 | + map.put("ksgl", ksgl); | |
| 5036 | + map.put("yyglsj", Arith.add(yygl, addMileage)); | |
| 5037 | + map.put("jcclc", jcclc); | |
| 5038 | + map.put("jhbc", jhbc); | |
| 5039 | + map.put("ljgl", addMileage); | |
| 5040 | + map.put("ssbc", cjbc); | |
| 5041 | + map.put("ysgl", Arith.add(yygl, addMileage)); | |
| 5042 | + map.put("sjbc", sjbc); | |
| 5043 | + map.put("zgl", Arith.add(zyygl, zksgl)); | |
| 5044 | + map.put("ljbc", ljbc); | |
| 5045 | + | |
| 5046 | + return map; | |
| 5047 | + } | |
| 5048 | + | |
| 5049 | + @Override | |
| 5050 | + public List<ScheduleRealInfo> queryListWaybillQp(String clZbh, String date, String line) { | |
| 5051 | + // TODO Auto-generated method stub | |
| 5052 | + DecimalFormat format = new DecimalFormat("0.00"); | |
| 5053 | + List<ScheduleRealInfo> list = null; | |
| 5054 | + list = scheduleRealInfoRepository.queryListWaybill2(clZbh, date, line); | |
| 5055 | + List<ScheduleRealInfo> newList = new ArrayList<ScheduleRealInfo>(); | |
| 5056 | + for (int i = 0; i < list.size(); i++) { | |
| 5057 | + ScheduleRealInfo s = list.get(i); | |
| 5058 | + if (!(s.getBcType().equals("in") || s.getBcType().equals("out"))) { | |
| 5059 | + String remarks = ""; | |
| 5060 | + Double sjlc = 0.0; | |
| 5061 | + if (s.getRemarks() != null) { | |
| 5062 | + remarks += s.getRemarks(); | |
| 5063 | + } | |
| 5064 | + Set<ChildTaskPlan> childTaskPlans = s.getcTasks(); | |
| 5065 | + if (!childTaskPlans.isEmpty()) { | |
| 5066 | + Iterator<ChildTaskPlan> it = childTaskPlans.iterator(); | |
| 5067 | + while (it.hasNext()) { | |
| 5068 | + ChildTaskPlan c = it.next(); | |
| 5069 | + if (c.getRemarks() != null && c.getRemarks().length() > 0) { | |
| 5070 | + if (remarks.indexOf(c.getRemarks()) == -1) { | |
| 5071 | + remarks += c.getRemarks(); | |
| 5072 | + } | |
| 5073 | + } | |
| 5074 | + | |
| 5075 | + if (!c.isDestroy()) { | |
| 5076 | + if (c.getMileageType().equals("service")) { | |
| 5077 | + sjlc += c.getMileage() == null ? 0 : c.getMileage(); | |
| 5078 | + } | |
| 5079 | + } | |
| 5080 | + | |
| 5081 | + } | |
| 5082 | + } else { | |
| 5083 | + if (s.getStatus() != -1) { | |
| 5084 | + sjlc = s.getJhlc(); | |
| 5085 | + } | |
| 5086 | + } | |
| 5087 | + s.setSjlc(format.format(sjlc)); | |
| 5088 | + s.setRemarks(remarks); | |
| 5089 | + newList.add(s); | |
| 5090 | + } | |
| 5091 | + | |
| 5092 | + } | |
| 5093 | + | |
| 5094 | + return newList; | |
| 5095 | + } | |
| 5096 | + | |
| 5097 | + @Override | |
| 5098 | + public Map<String, Object> MapById(Long id) { | |
| 5099 | + // TODO Auto-generated method stub | |
| 5100 | + Map<String, Object> dMap=new HashMap<>(); | |
| 5101 | + dMap.put("dGroup_eq", "oilType"); | |
| 5102 | + Iterator<Dictionary> it= dictionaryService.list(dMap).iterator(); | |
| 5103 | + while (it.hasNext()) { | |
| 5104 | + Dictionary d=it.next(); | |
| 5105 | + dMap.put(d.getdCode(), d.getdName()); | |
| 5106 | + } | |
| 5107 | + Map<String, Object> map = new HashMap<String, Object>(); | |
| 5108 | + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm"); | |
| 5109 | + ScheduleRealInfo s = scheduleRealInfoRepository.scheduleById(id); | |
| 5110 | + String xlbm = s.getXlBm(); | |
| 5111 | + String fcrq = s.getScheduleDateStr(); | |
| 5112 | + | |
| 5113 | + int type = 2; | |
| 5114 | + Double ccyl = 0.0; | |
| 5115 | + Double jcyl = 0.0; | |
| 5116 | + Double yh = 0.0; | |
| 5117 | + Double jzl = 0.0; | |
| 5118 | + Double zlc = 0.0; | |
| 5119 | + String rylx=""; | |
| 5120 | + int hyd = 0; | |
| 5121 | + Double czql = 0.0, jzql = 0.0, hq = 0.0, jql = 0.0; | |
| 5122 | + List<Cars> listCars = carsRepository.findCarsByCode(s.getClZbh()); | |
| 5123 | + if (listCars.size() > 0) { | |
| 5124 | + if (listCars.get(0).getSfdc() != null) { | |
| 5125 | + if (listCars.get(0).getSfdc()) { | |
| 5126 | + List<Dlb> listDlb = dlbRepository.queryListDlb(fcrq, s.getClZbh(), s.getjGh(), xlbm); | |
| 5127 | + type = 1; | |
| 5128 | + for (int i = 0; i < listDlb.size(); i++) { | |
| 5129 | + Dlb d = listDlb.get(i); | |
| 5130 | + if (d.getLp() == null) { | |
| 5131 | + ccyl = Arith.add(ccyl, d.getCzcd()); | |
| 5132 | + jcyl = Arith.add(jcyl, d.getJzcd()); | |
| 5133 | + yh = Arith.add(yh, d.getHd()); | |
| 5134 | + jzl = Arith.add(jzl, d.getCdl()); | |
| 5135 | + zlc = Arith.add(zlc, d.getZlc()); | |
| 5136 | + } else { | |
| 5137 | + if (d.getLp().equals(s.getLpName())) { | |
| 5138 | + ccyl = Arith.add(ccyl, d.getCzcd()); | |
| 5139 | + jcyl = Arith.add(jcyl, d.getJzcd()); | |
| 5140 | + yh = Arith.add(yh, d.getHd()); | |
| 5141 | + jzl = Arith.add(jzl, d.getCdl()); | |
| 5142 | + zlc = Arith.add(zlc, d.getZlc()); | |
| 5143 | + } | |
| 5144 | + } | |
| 5145 | + | |
| 5146 | + } | |
| 5147 | + } else { | |
| 5148 | + List<Ylb> listYlb = ylbRepository.queryListYlb(fcrq, s.getClZbh(), s.getjGh(), xlbm); | |
| 5149 | + type = 0; | |
| 5150 | + for (int i = 0; i < listYlb.size(); i++) { | |
| 5151 | + Ylb y = listYlb.get(i); | |
| 5152 | + if (y.getLp() == null) { | |
| 5153 | + ccyl = Arith.add(ccyl, y.getCzyl()); | |
| 5154 | + jcyl = Arith.add(jcyl, y.getJzyl()); | |
| 5155 | + yh = Arith.add(yh, y.getYh()); | |
| 5156 | + jzl = Arith.add(jzl, y.getJzl()); | |
| 5157 | + zlc = Arith.add(zlc, y.getZlc()); | |
| 5158 | + if(dMap.get(y.getRylx())!=null) | |
| 5159 | + rylx =dMap.get(y.getRylx()).toString(); | |
| 5160 | + } else { | |
| 5161 | + if (y.getLp().equals(s.getLpName())) { | |
| 5162 | + ccyl = Arith.add(ccyl, y.getCzyl()); | |
| 5163 | + jcyl = Arith.add(jcyl, y.getJzyl()); | |
| 5164 | + yh = Arith.add(yh, y.getYh()); | |
| 5165 | + jzl = Arith.add(jzl, y.getJzl()); | |
| 5166 | + zlc = Arith.add(zlc, y.getZlc()); | |
| 5167 | + if(dMap.get(y.getRylx())!=null) | |
| 5168 | + rylx =dMap.get(y.getRylx()).toString(); | |
| 5169 | + } | |
| 5170 | + } | |
| 5171 | + } | |
| 5172 | + } | |
| 5173 | + } | |
| 5174 | + if(listCars.get(0).getHydrogen() != null && listCars.get(0).getHydrogen()){ | |
| 5175 | + List<Qlb> listQlb = qlbRepository.queryListQlb(fcrq, s.getClZbh(), s.getjGh(), xlbm); | |
| 5176 | + hyd = 1; | |
| 5177 | + for (int i = 0; i < listQlb.size(); i++) { | |
| 5178 | + Qlb h = listQlb.get(i); | |
| 5179 | + if (h.getLp() == null) { | |
| 5180 | + czql = Arith.add(czql, h.getCzcl()); | |
| 5181 | + jzql = Arith.add(jzql, h.getJzcl()); | |
| 5182 | + hq = Arith.add(hq, h.getHn()); | |
| 5183 | + jql = Arith.add(jql, h.getJql()); | |
| 5184 | + } else { | |
| 5185 | + if (h.getLp().equals(s.getLpName())) { | |
| 5186 | + czql = Arith.add(czql, h.getCzcl()); | |
| 5187 | + jzql = Arith.add(jzql, h.getJzcl()); | |
| 5188 | + hq = Arith.add(hq, h.getHn()); | |
| 5189 | + jql = Arith.add(jql, h.getJql()); | |
| 5190 | + } | |
| 5191 | + } | |
| 5192 | + } | |
| 5193 | + } | |
| 5194 | + } | |
| 5195 | + | |
| 5196 | + map.put("hyd", hyd); | |
| 5197 | + map.put("czcl", czql); | |
| 5198 | + map.put("jzcl", jzql); | |
| 5199 | + map.put("hn", hq); | |
| 5200 | + map.put("jql", jql); | |
| 5201 | + | |
| 5202 | + map.put("rylx", "加注类别:"+rylx); | |
| 5203 | + map.put("jzl", jzl); | |
| 5204 | + map.put("yh", yh); | |
| 5205 | + map.put("ccyl", ccyl); | |
| 5206 | + map.put("jcyl", jcyl); | |
| 5207 | + map.put("type", type); | |
| 5208 | + map.put("zlc", zlc); | |
| 5209 | + map.put("xlName", s.getXlName()); | |
| 5210 | + map.put("clZbh", s.getClZbh()); | |
| 5211 | + map.put("plate", BasicData.nbbmCompanyPlateMap.get(s.getClZbh())); | |
| 5212 | + map.put("fcsjActual", s.getFcsjActual()); | |
| 5213 | + map.put("zdzName", s.getZdzName()); | |
| 5214 | + map.put("scheduleDate", s.getScheduleDateStr()); | |
| 5215 | + map.put("lpName", s.getLpName()); | |
| 5216 | + String zdp = "", zwdp = "", wdp = ""; | |
| 5217 | + String zdpT = "", zwdpT = "", wdpT = ""; | |
| 5218 | + String dbdp = ""; | |
| 5219 | + List<DutyEmployee> list = dutyEmployeeService.getDutyEmployee(xlbm, fcrq + "00:01", fcrq + "23:59"); | |
| 5220 | + try { | |
| 5221 | + Long fcsj1 = sdf.parse(fcrq + " 00:01").getTime(); | |
| 5222 | + Long fcsj2 = sdf.parse(fcrq + " 11:00").getTime(); | |
| 5223 | + Long fcsj3 = sdf.parse(fcrq + " 23:59").getTime(); | |
| 5224 | + for (int i = 0; i < list.size(); i++) { | |
| 5225 | + DutyEmployee t = list.get(i); | |
| 5226 | + if (dbdp.indexOf(t.getuName()) == -1) { | |
| 5227 | + if (!(dbdp.length() > 0)) { | |
| 5228 | + dbdp = t.getuName(); | |
| 5229 | + } else { | |
| 5230 | + dbdp += "," + t.getuName(); | |
| 5231 | + } | |
| 5232 | + } | |
| 5233 | + Long ts = t.getTs(); | |
| 5234 | + if (ts > fcsj1 && ts < fcsj2) { | |
| 5235 | + if (zdp.indexOf(t.getuName()) == -1) { | |
| 5236 | + if (!(zdp.length() > 0)) { | |
| 5237 | + zdpT = t.getuName() + "..."; | |
| 5238 | + } | |
| 5239 | + zdp += t.getuName() + ","; | |
| 5240 | + | |
| 5241 | + } | |
| 5242 | + } else if (ts > fcsj2 && ts < fcsj3) { | |
| 5243 | + if (zwdp.indexOf(t.getuName()) == -1) { | |
| 5244 | + if (!(zwdp.length() > 0)) { | |
| 5245 | + zwdpT = t.getuName() + "..."; | |
| 5246 | + } | |
| 5247 | + zwdp += t.getuName() + ","; | |
| 5248 | + } | |
| 5249 | + } else { | |
| 5250 | + if (wdp.indexOf(t.getuName()) == -1) { | |
| 5251 | + if (!(wdp.length() > 0)) { | |
| 5252 | + wdpT = t.getuName() + "..."; | |
| 5253 | + } | |
| 5254 | + wdp += t.getuName() + ","; | |
| 5255 | + } | |
| 5256 | + } | |
| 5257 | + } | |
| 5258 | + } catch (ParseException e) { | |
| 5259 | + // TODO Auto-generated catch block | |
| 5260 | + e.printStackTrace(); | |
| 5261 | + } | |
| 5262 | + map.put("zdp", zdp); | |
| 5263 | + map.put("zwdp", zwdp); | |
| 5264 | + map.put("wdp", wdp); | |
| 5265 | + map.put("zdpT", zdpT); | |
| 5266 | + map.put("zwdpT", zwdpT); | |
| 5267 | + map.put("wdpT", wdpT); | |
| 5268 | + map.put("dbdp", dbdp); | |
| 5269 | + return map; | |
| 5270 | + } | |
| 5271 | + | |
| 5272 | + @Override | |
| 5273 | + public Map<String, Object> MapByIdQp(Long id) { | |
| 5274 | + // TODO Auto-generated method stub | |
| 5275 | + Map<String, Object> map = new HashMap<String, Object>(); | |
| 5276 | + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm"); | |
| 5277 | + ScheduleRealInfo s = scheduleRealInfoRepository.scheduleById(id); | |
| 5278 | + String xlbm = s.getXlBm(); | |
| 5279 | + String fcrq = s.getScheduleDateStr(); | |
| 5280 | + | |
| 5281 | + int type = 0; | |
| 5282 | + Double ccyl = 0.0; | |
| 5283 | + Double jcyl = 0.0; | |
| 5284 | + Double yh = 0.0; | |
| 5285 | + Double jzl = 0.0; | |
| 5286 | + Double zlc = 0.0; | |
| 5287 | +// List<Ylb> listYlb = ylbRepository.queryListYlb(fcrq, s.getClZbh(), s.getjGh(),xlbm); | |
| 5288 | +// List<Dlb> listDlb = dlbRepository.queryListDlb(fcrq, s.getClZbh(), s.getjGh(),xlbm); | |
| 5289 | +// if(listYlb.size()>0){ | |
| 5290 | +// type=0; | |
| 5291 | +// for (int i = 0; i < listYlb.size(); i++) { | |
| 5292 | +// Ylb y = listYlb.get(i); | |
| 5293 | +// if(y.getLp()==null){ | |
| 5294 | +// ccyl=Arith.add(ccyl, y.getCzyl()); | |
| 5295 | +// jcyl=Arith.add(jcyl, y.getJzyl()); | |
| 5296 | +// yh =Arith.add(yh ,y.getYh()); | |
| 5297 | +// jzl =Arith.add(jzl, y.getJzl()); | |
| 5298 | +// zlc =Arith.add(zlc, y.getZlc()); | |
| 5299 | +// }else{ | |
| 5300 | +// if(y.getLp().equals(s.getLpName())){ | |
| 5301 | +// ccyl=Arith.add(ccyl, y.getCzyl()); | |
| 5302 | +// jcyl=Arith.add(jcyl, y.getJzyl()); | |
| 5303 | +// yh =Arith.add(yh ,y.getYh()); | |
| 5304 | +// jzl =Arith.add(jzl, y.getJzl()); | |
| 5305 | +// zlc =Arith.add(zlc, y.getZlc()); | |
| 5306 | +// } | |
| 5307 | +// } | |
| 5308 | +// | |
| 5309 | +// } | |
| 5310 | +// }else{ | |
| 5311 | +// type=1; | |
| 5312 | +// for (int i = 0; i < listDlb.size(); i++) { | |
| 5313 | +// Dlb d=listDlb.get(i); | |
| 5314 | +// if(d.getLp()==null){ | |
| 5315 | +// ccyl=Arith.add(ccyl, d.getCzcd()); | |
| 5316 | +// jcyl=Arith.add(jcyl, d.getJzcd()); | |
| 5317 | +// yh =Arith.add(yh ,d.getHd()); | |
| 5318 | +// jzl =Arith.add(jzl, d.getCdl()); | |
| 5319 | +// zlc =Arith.add(zlc, d.getZlc()); | |
| 5320 | +// }else{ | |
| 5321 | +// if(d.getLp().equals(s.getLpName())){ | |
| 5322 | +// ccyl=Arith.add(ccyl, d.getCzcd()); | |
| 5323 | +// jcyl=Arith.add(jcyl, d.getJzcd()); | |
| 5324 | +// yh =Arith.add(yh ,d.getHd()); | |
| 5325 | +// jzl =Arith.add(jzl, d.getCdl()); | |
| 5326 | +// zlc =Arith.add(zlc, d.getZlc()); | |
| 5327 | +// } | |
| 5328 | +// } | |
| 5329 | +// | |
| 5330 | +// } | |
| 5331 | +// } | |
| 5332 | + | |
| 5333 | + List<Ylxxb> listylxxb = ylxxbRepository.queryListYlxxb(s.getClZbh(), fcrq); | |
| 5334 | + for (int i = 0; i < listylxxb.size(); i++) { | |
| 5335 | + Ylxxb t = listylxxb.get(i); | |
| 5336 | + jzl = Arith.add(jzl, t.getJzl()); | |
| 5337 | + } | |
| 5338 | + map.put("jzl", jzl); | |
| 5339 | + map.put("yh", yh); | |
| 5340 | + map.put("ccyl", ccyl); | |
| 5341 | + map.put("jcyl", jcyl); | |
| 5342 | + map.put("type", type); | |
| 5343 | + map.put("zlc", zlc); | |
| 5344 | + map.put("xlName", s.getXlName()); | |
| 5345 | + map.put("clZbh", s.getClZbh()); | |
| 5346 | + map.put("plate", BasicData.nbbmCompanyPlateMap.get(s.getClZbh())); | |
| 5347 | + map.put("fcsjActual", s.getFcsjActual()); | |
| 5348 | + map.put("zdzName", s.getZdzName()); | |
| 5349 | + map.put("scheduleDate", s.getScheduleDateStr()); | |
| 5350 | + map.put("lpName", s.getLpName()); | |
| 5351 | + String zdp = "", zwdp = "", wdp = ""; | |
| 5352 | + String zdpT = "", zwdpT = "", wdpT = ""; | |
| 5353 | + String dbdp = ""; | |
| 5354 | + List<DutyEmployee> list = dutyEmployeeService.getDutyEmployee(xlbm, fcrq + "00:01", fcrq + "23:59"); | |
| 5355 | + try { | |
| 5356 | + Long fcsj1 = sdf.parse(fcrq + " 00:01").getTime(); | |
| 5357 | + Long fcsj2 = sdf.parse(fcrq + " 11:00").getTime(); | |
| 5358 | + Long fcsj3 = sdf.parse(fcrq + " 23:59").getTime(); | |
| 5359 | + for (int i = 0; i < list.size(); i++) { | |
| 5360 | + DutyEmployee t = list.get(i); | |
| 5361 | + if (dbdp.indexOf(t.getuName()) == -1) { | |
| 5362 | + if (!(dbdp.length() > 0)) { | |
| 5363 | + dbdp = t.getuName(); | |
| 5364 | + } else { | |
| 5365 | + dbdp += "," + t.getuName(); | |
| 5366 | + } | |
| 5367 | + } | |
| 5368 | + Long ts = t.getTs(); | |
| 5369 | + if (ts > fcsj1 && ts < fcsj2) { | |
| 5370 | + if (zdp.indexOf(t.getuName()) == -1) { | |
| 5371 | + if (!(zdp.length() > 0)) { | |
| 5372 | + zdpT = t.getuName() + "..."; | |
| 5373 | + } | |
| 5374 | + zdp += t.getuName() + ","; | |
| 5375 | + | |
| 5376 | + } | |
| 5377 | + } else if (ts > fcsj2 && ts < fcsj3) { | |
| 5378 | + if (zwdp.indexOf(t.getuName()) == -1) { | |
| 5379 | + if (!(zwdp.length() > 0)) { | |
| 5380 | + zwdpT = t.getuName() + "..."; | |
| 5381 | + } | |
| 5382 | + zwdp += t.getuName() + ","; | |
| 5383 | + } | |
| 5384 | + } else { | |
| 5385 | + if (wdp.indexOf(t.getuName()) == -1) { | |
| 5386 | + if (!(wdp.length() > 0)) { | |
| 5387 | + wdpT = t.getuName() + "..."; | |
| 5388 | + } | |
| 5389 | + wdp += t.getuName() + ","; | |
| 5390 | + } | |
| 5391 | + } | |
| 5392 | + } | |
| 5393 | + } catch (ParseException e) { | |
| 5394 | + // TODO Auto-generated catch block | |
| 5395 | + e.printStackTrace(); | |
| 5396 | + } | |
| 5397 | + map.put("zdp", zdp); | |
| 5398 | + map.put("zwdp", zwdp); | |
| 5399 | + map.put("wdp", wdp); | |
| 5400 | + map.put("zdpT", zdpT); | |
| 5401 | + map.put("zwdpT", zwdpT); | |
| 5402 | + map.put("wdpT", wdpT); | |
| 5403 | + map.put("dbdp", dbdp); | |
| 5404 | + return map; | |
| 5405 | + } | |
| 5406 | + | |
| 5407 | + @Override | |
| 5408 | + public List<Map<String, Object>> scheduleDailyQp(String line, String date) { | |
| 5409 | + // TODO Auto-generated method stub | |
| 5410 | + List<Map<String, Object>> list = new ArrayList<Map<String, Object>>(); | |
| 5411 | + List<ScheduleRealInfo> scheduleRealInfos = scheduleRealInfoRepository.scheduleDailyQp(line, date); | |
| 5412 | + Map<String, Object> map = null; | |
| 5413 | + String lp = "lp"; | |
| 5414 | + String jgh = "jgh"; | |
| 5415 | + String clzbh = "clzbh"; | |
| 5416 | + int bcs = 0; | |
| 5417 | + String thclzbh = ""; | |
| 5418 | + String sgh = "sgh"; | |
| 5419 | + for (int i = 0; i < scheduleRealInfos.size(); i++) { | |
| 5420 | + ScheduleRealInfo scheduleRealInfo = scheduleRealInfos.get(i); | |
| 5421 | + if (scheduleRealInfo.getLpName().equals(lp)) { | |
| 5422 | + bcs++; | |
| 5423 | + String fcsj = scheduleRealInfo.getFcsj(); | |
| 5424 | + | |
| 5425 | + if (!clzbh.equals(scheduleRealInfo.getClZbh())) { | |
| 5426 | + clzbh = scheduleRealInfo.getClZbh(); | |
| 5427 | + if (thclzbh == "") { | |
| 5428 | + thclzbh += scheduleRealInfo.getClZbh() + ","; | |
| 5429 | + } else { | |
| 5430 | + thclzbh += scheduleRealInfo.getClZbh(); | |
| 5431 | + } | |
| 5432 | + map.put("thclzbh", thclzbh); | |
| 5433 | + } | |
| 5434 | + | |
| 5435 | + if (!jgh.equals(scheduleRealInfo.getjGh())) { | |
| 5436 | + jgh = scheduleRealInfo.getjGh(); | |
| 5437 | + if (map.get("jjb2") != null) { | |
| 5438 | + map.put("jjb3", scheduleRealInfo.getjGh() + "/" + | |
| 5439 | + scheduleRealInfo.getFcsjActual()); | |
| 5440 | + | |
| 5441 | + } else { | |
| 5442 | + map.put("jjb2", scheduleRealInfo.getjGh() + "/" + | |
| 5443 | + scheduleRealInfo.getFcsjActual()); | |
| 5444 | + } | |
| 5445 | + | |
| 5446 | + } | |
| 5447 | + | |
| 5448 | + if (scheduleRealInfo.getsGh() != null) { | |
| 5449 | + if (!scheduleRealInfo.getsGh().equals(sgh)) { | |
| 5450 | + sgh = scheduleRealInfo.getsGh() == null ? "" : scheduleRealInfo.getsGh(); | |
| 5451 | + if (!sgh.equals("")) { | |
| 5452 | + if (map.get("sjb1") != null) { | |
| 5453 | + if (map.get("sjb2") != null) { | |
| 5454 | + map.put("sjb3", scheduleRealInfo.getsGh() + "/" + | |
| 5455 | + scheduleRealInfo.getFcsjActual()); | |
| 5456 | + } else { | |
| 5457 | + map.put("sjb2", scheduleRealInfo.getsGh() + "/" + | |
| 5458 | + scheduleRealInfo.getFcsjActual()); | |
| 5459 | + } | |
| 5460 | + } else { | |
| 5461 | + map.put("sjb1", scheduleRealInfo.getsGh() + "/" + | |
| 5462 | + scheduleRealInfo.getFcsjActual()); | |
| 5463 | + } | |
| 5464 | + } | |
| 5465 | + } | |
| 5466 | + } | |
| 5467 | + if (scheduleRealInfo.getFcsjActual() != null) { | |
| 5468 | + String fcsjs[] = fcsj.split(":"); | |
| 5469 | + String fcsjActuals[] = scheduleRealInfo.getFcsjActual().split(":"); | |
| 5470 | + int a = Integer.parseInt(fcsjActuals[0]) * 60 + Integer.parseInt(fcsjActuals[1]); | |
| 5471 | + int b = Integer.parseInt(fcsjs[0]) * 60 + Integer.parseInt(fcsjs[1]); | |
| 5472 | + map.put("cz" + bcs, b - a); | |
| 5473 | + } else { | |
| 5474 | + map.put("cz" + bcs, "无"); | |
| 5475 | + } | |
| 5476 | + map.put("lp", scheduleRealInfo.getLpName()); | |
| 5477 | + map.put("dd" + bcs, scheduleRealInfo.getZdsjActual()); | |
| 5478 | + map.put("kc" + bcs, scheduleRealInfo.getFcsjActual()); | |
| 5479 | + | |
| 5480 | + if (i < scheduleRealInfos.size() - 1) { | |
| 5481 | + if (!scheduleRealInfos.get(i + 1).getLpName().equals | |
| 5482 | + (scheduleRealInfos.get(i).getLpName())) { | |
| 5483 | + list.add(map); | |
| 5484 | + lp = "lp"; | |
| 5485 | + jgh = "jgh"; | |
| 5486 | + clzbh = "clzbh"; | |
| 5487 | + bcs = 0; | |
| 5488 | + thclzbh = ""; | |
| 5489 | + sgh = "sgh"; | |
| 5490 | + } | |
| 5491 | + } else { | |
| 5492 | + list.add(map); | |
| 5493 | + } | |
| 5494 | + } else { | |
| 5495 | + bcs = 1; | |
| 5496 | + map = new HashMap<String, Object>(); | |
| 5497 | + lp = scheduleRealInfo.getLpName(); | |
| 5498 | + jgh = scheduleRealInfo.getjGh(); | |
| 5499 | + clzbh = scheduleRealInfo.getClZbh(); | |
| 5500 | + if (scheduleRealInfo.getsGh() != null) { | |
| 5501 | + sgh = scheduleRealInfo.getsGh(); | |
| 5502 | + map.put("sjb1", scheduleRealInfo.getsGh() + "/" + | |
| 5503 | + scheduleRealInfo.getFcsjActual()); | |
| 5504 | + } | |
| 5505 | + String fcsj = scheduleRealInfo.getFcsj(); | |
| 5506 | + scheduleRealInfo.getFcsjActual(); | |
| 5507 | + map.put("jjb1", jgh + "/" + scheduleRealInfo.getFcsjActual()); | |
| 5508 | + map.put("cccl", clzbh); | |
| 5509 | + | |
| 5510 | + if (scheduleRealInfo.getFcsjActual() != null) { | |
| 5511 | + String fcsjs[] = fcsj.split(":"); | |
| 5512 | + String fcsjActuals[] = scheduleRealInfo.getFcsjActual().split(":"); | |
| 5513 | + int a = Integer.parseInt(fcsjActuals[0]) * 60 + Integer.parseInt(fcsjActuals[1]); | |
| 5514 | + int b = Integer.parseInt(fcsjs[0]) * 60 + Integer.parseInt(fcsjs[1]); | |
| 5515 | + map.put("cz" + bcs, b - a); | |
| 5516 | + } else { | |
| 5517 | + map.put("cz" + bcs, "无"); | |
| 5518 | + } | |
| 5519 | + | |
| 5520 | + | |
| 5521 | + map.put("lp", scheduleRealInfo.getLpName()); | |
| 5522 | + map.put("dd" + bcs, scheduleRealInfo.getZdsjActual()); | |
| 5523 | + map.put("kc" + bcs, scheduleRealInfo.getFcsjActual()); | |
| 5524 | + | |
| 5525 | + if (i < scheduleRealInfos.size() - 1) { | |
| 5526 | + if (!scheduleRealInfos.get(i + 1).getLpName().equals | |
| 5527 | + (scheduleRealInfos.get(i).getLpName())) { | |
| 5528 | + list.add(map); | |
| 5529 | + lp = "lp"; | |
| 5530 | + jgh = "jgh"; | |
| 5531 | + clzbh = "clzbh"; | |
| 5532 | + bcs = 0; | |
| 5533 | + thclzbh = ""; | |
| 5534 | + sgh = "sgh"; | |
| 5535 | + } | |
| 5536 | + } else { | |
| 5537 | + list.add(map); | |
| 5538 | + } | |
| 5539 | + } | |
| 5540 | + | |
| 5541 | + } | |
| 5542 | + return list; | |
| 5543 | + } | |
| 5544 | + | |
| 5545 | + | |
| 5546 | + @Override | |
| 5547 | + public List<Map<String, Object>> scheduleDailyExport(Map<String, Object> map) { | |
| 5548 | + String line = map.get("line").toString(); | |
| 5549 | + String date = map.get("date").toString(); | |
| 5550 | + String xlName = map.get("xlName").toString(); | |
| 5551 | + String state = map.get("state").toString(); | |
| 5552 | + String type = map.get("type").toString(); | |
| 5553 | + String genre =map.get("genre").toString(); | |
| 5554 | + String df=""; | |
| 5555 | + if(map.get("df")!=null){ | |
| 5556 | + df=map.get("df").toString(); | |
| 5557 | + } | |
| 5558 | + | |
| 5559 | + List<Map<String, Object>> dataList2 = new ArrayList<Map<String, Object>>(); | |
| 5560 | + List<Map<String, Object>> dataList3 = new ArrayList<Map<String, Object>>(); | |
| 5561 | + List<Map<String, Object>> list1 = this.statisticsDaily(line, date, xlName, null); | |
| 5562 | + List<ScheduleRealInfo> list2 = this.queryUserInfo(line, date, state); | |
| 5563 | + List<ScheduleRealInfo> list3 = new ArrayList<ScheduleRealInfo>(); | |
| 5564 | + if(genre.equals("qp")) | |
| 5565 | + list3=this.realScheduleListQp(line, date); | |
| 5566 | + else if(genre.equals("zrw")) | |
| 5567 | + list3=this.realScheduleList_zrw(line, date); | |
| 5568 | + else | |
| 5569 | + list3=this.realScheduleList(line, date); | |
| 5570 | + Map<String, Object> nMap = new HashMap<String, Object>(); | |
| 5571 | + nMap.put("date", xlName + date); | |
| 5572 | + nMap.put("jls", list1.get(0).get("jls")); | |
| 5573 | + nMap.put("sjgl", list1.get(0).get("sjgl")); | |
| 5574 | + | |
| 5575 | + int size = 0; | |
| 5576 | + Map<String, Object> tempMap = new HashMap<String, Object>(); | |
| 5577 | + for (int i = 0; i < list2.size(); i++) { | |
| 5578 | + ScheduleRealInfo s = list2.get(i); | |
| 5579 | + if (size == 5) { | |
| 5580 | + size = 0; | |
| 5581 | + dataList2.add(tempMap); | |
| 5582 | + tempMap = new HashMap<String, Object>(); | |
| 5583 | + } | |
| 5584 | + tempMap.put("lp" + size, s.getLpName()); | |
| 5585 | + tempMap.put("ch" + size, s.getClZbh()); | |
| 5586 | + tempMap.put("jz" + size, s.getjGh() + "/" + s.getjName()); | |
| 5587 | + tempMap.put("sz" + size, ""); | |
| 5588 | + tempMap.put("jw" + size, ""); | |
| 5589 | + tempMap.put("sw" + size, ""); | |
| 5590 | + | |
| 5591 | + size++; | |
| 5592 | + } | |
| 5593 | + if (size < 5) { | |
| 5594 | + for (; size < 5; size++) { | |
| 5595 | + tempMap.put("lp" + size, ""); | |
| 5596 | + tempMap.put("ch" + size, ""); | |
| 5597 | + tempMap.put("jz" + size, ""); | |
| 5598 | + tempMap.put("sz" + size, ""); | |
| 5599 | + tempMap.put("jw" + size, ""); | |
| 5600 | + tempMap.put("sw" + size, ""); | |
| 5601 | + } | |
| 5602 | + } | |
| 5603 | + | |
| 5604 | + dataList2.add(tempMap); | |
| 5605 | + | |
| 5606 | + size = 0; | |
| 5607 | + tempMap = new HashMap<String, Object>(); | |
| 5608 | + for (ScheduleRealInfo schedule : list3) { | |
| 5609 | + int x = size % 3; | |
| 5610 | + if (x == 0 && size > 0) { | |
| 5611 | + dataList3.add(tempMap); | |
| 5612 | + tempMap = new HashMap<String, Object>(); | |
| 5613 | + } | |
| 5614 | + tempMap.put("lpName" + x, schedule.getLpName()); | |
| 5615 | + tempMap.put("qdzName" + x, schedule.getQdzName()); | |
| 5616 | + tempMap.put("zdsj" + x, schedule.getZdsj()); | |
| 5617 | + String zdsjActual = schedule.getZdsjActual() != null ? schedule.getZdsjActual() : ""; | |
| 5618 | + tempMap.put("zdsjActual" + x, zdsjActual); | |
| 5619 | + | |
| 5620 | + String zdsjk = ""; | |
| 5621 | + String zdsjm = ""; | |
| 5622 | + if (!zdsjActual.equals("")) { | |
| 5623 | + String[] zdsj_s = schedule.getZdsj().split(":"); | |
| 5624 | + String[] zdsjActual_s = zdsjActual.split(":"); | |
| 5625 | + Long zdsj_ = Long.parseLong(zdsj_s[0]) * 60 + Long.parseLong(zdsj_s[1]); | |
| 5626 | + Long zdsjActual_ = Long.parseLong(zdsjActual_s[0]) * 60 + Long.parseLong(zdsjActual_s[1]); | |
| 5627 | + if ((zdsj_ - zdsjActual_) > 0) { | |
| 5628 | + if(zdsj_ - zdsjActual_>1200){ | |
| 5629 | + zdsjm=String.valueOf(1440-(zdsj_-zdsjActual_)); | |
| 5630 | + }else{ | |
| 5631 | + zdsjk = String.valueOf(zdsj_ - zdsjActual_); | |
| 5632 | + } | |
| 5633 | + } else { | |
| 5634 | + if(zdsjActual_ - zdsj_>1200){ | |
| 5635 | + zdsjk =String.valueOf(1440-(zdsjActual_ - zdsj_)); | |
| 5636 | + }else{ | |
| 5637 | + zdsjm = String.valueOf(zdsjActual_ - zdsj_); | |
| 5638 | + } | |
| 5639 | + } | |
| 5640 | + } | |
| 5641 | + tempMap.put("zdsjk" + x, zdsjk); | |
| 5642 | + tempMap.put("zdsjm" + x, zdsjm.equals("0")?"":zdsjm); | |
| 5643 | + tempMap.put("fcsj" + x, schedule.getFcsj()); | |
| 5644 | + String fcsjActural = schedule.getFcsjActual() != null ? schedule.getFcsjActual() : ""; | |
| 5645 | + String bcType = schedule.getBcType() != null ? schedule.getBcType() : ""; | |
| 5646 | + String fcsjActuralstr = ""; | |
| 5647 | + if (bcType.equals("in")) { | |
| 5648 | + fcsjActuralstr = fcsjActural + "(进)"; | |
| 5649 | + } else if (bcType.equals("out")) { | |
| 5650 | + fcsjActuralstr = fcsjActural + "(出)"; | |
| 5651 | + } else { | |
| 5652 | + fcsjActuralstr = fcsjActural; | |
| 5653 | + } | |
| 5654 | + tempMap.put("fcsjActual" + x, fcsjActuralstr); | |
| 5655 | + String fcsjk = ""; | |
| 5656 | + String fcsjm = ""; | |
| 5657 | + String dfsjk =""; | |
| 5658 | + String dfsjm=""; | |
| 5659 | + if (!fcsjActural.equals("")) { | |
| 5660 | + String[] fcsj_s = schedule.getFcsj().split(":"); | |
| 5661 | + String[] fcsjActural_s = fcsjActural.split(":"); | |
| 5662 | + Long fcsj_ = Long.parseLong(fcsj_s[0]) * 60 + Long.parseLong(fcsj_s[1]); | |
| 5663 | + Long fcsjActural_ = Long.parseLong(fcsjActural_s[0]) * 60 + Long.parseLong(fcsjActural_s[1]); | |
| 5664 | + if ((fcsj_ - fcsjActural_) > 0) { | |
| 5665 | + if(fcsj_ - fcsjActural_>1200){ | |
| 5666 | + fcsjm=String.valueOf(1440-(fcsj_ - fcsjActural_)); | |
| 5667 | + }else{ | |
| 5668 | + fcsjk = String.valueOf(fcsj_ - fcsjActural_); | |
| 5669 | + } | |
| 5670 | + } else { | |
| 5671 | + if(fcsjActural_ - fcsj_>1200){ | |
| 5672 | + fcsjk =String.valueOf(1440-(fcsjActural_ - fcsj_)); | |
| 5673 | + } | |
| 5674 | + else{ | |
| 5675 | + fcsjm = String.valueOf(fcsjActural_ - fcsj_); | |
| 5676 | + } | |
| 5677 | + } | |
| 5678 | + if(df.equals("df")){ | |
| 5679 | + String[] dfsj_s =schedule.getDfsj().split(":"); | |
| 5680 | + Long dfsj_ = Long.parseLong(dfsj_s[0]) * 60 + Long.parseLong(dfsj_s[1]); | |
| 5681 | + if ((dfsj_ - fcsjActural_) > 0) { | |
| 5682 | + if(dfsj_ - fcsjActural_>1200){ | |
| 5683 | + dfsjm=String.valueOf(1440-(dfsj_ - fcsjActural_)); | |
| 5684 | + }else{ | |
| 5685 | + dfsjk = String.valueOf(dfsj_ - fcsjActural_); | |
| 5686 | + } | |
| 5687 | + } else { | |
| 5688 | + if(fcsjActural_ - dfsj_>1200){ | |
| 5689 | + dfsjk= String.valueOf(1440-(fcsjActural_ - dfsj_)); | |
| 5690 | + }else{ | |
| 5691 | + dfsjm = String.valueOf(fcsjActural_ - dfsj_); | |
| 5692 | + } | |
| 5693 | + } | |
| 5694 | + } | |
| 5695 | + } | |
| 5696 | + if(df.equals("df")){ | |
| 5697 | + tempMap.put("dfsj"+x,schedule.getDfsj()); | |
| 5698 | + tempMap.put("dfsjk" + x, dfsjk); | |
| 5699 | + tempMap.put("dfsjm" + x, dfsjm.equals("0")?"":dfsjm); | |
| 5700 | + } | |
| 5701 | + tempMap.put("fcsjk" + x, fcsjk); | |
| 5702 | + tempMap.put("fcsjm" + x, fcsjm.equals("0")?"":fcsjm); | |
| 5703 | + tempMap.put("remarks" + x, schedule.getRemark() != null ? schedule.getRemark() : ""); | |
| 5704 | + | |
| 5705 | + size++; | |
| 5706 | + } | |
| 5707 | + if (tempMap.get("lpName0") != null) { | |
| 5708 | + if (tempMap.get("lpName1") == null) { | |
| 5709 | + tempMap.put("lpName1", ""); | |
| 5710 | + tempMap.put("qdzName1", ""); | |
| 5711 | + tempMap.put("zdsj1", ""); | |
| 5712 | + tempMap.put("zdsjActual1", ""); | |
| 5713 | + tempMap.put("zdsjk1", ""); | |
| 5714 | + tempMap.put("zdsjm1", ""); | |
| 5715 | + tempMap.put("fcsj1", ""); | |
| 5716 | + tempMap.put("fcsjActual1", ""); | |
| 5717 | + tempMap.put("fcsjk1", ""); | |
| 5718 | + tempMap.put("fcsjm1", ""); | |
| 5719 | + if(df.equals("df")){ | |
| 5720 | + tempMap.put("dfsj1",""); | |
| 5721 | + tempMap.put("dfsjk1" , ""); | |
| 5722 | + tempMap.put("dfsjm1" , ""); | |
| 5723 | + } | |
| 5724 | + tempMap.put("remarks1", ""); | |
| 5725 | + } | |
| 5726 | + if (tempMap.get("lpName2") == null) { | |
| 5727 | + tempMap.put("lpName2", ""); | |
| 5728 | + tempMap.put("qdzName2", ""); | |
| 5729 | + tempMap.put("zdsj2", ""); | |
| 5730 | + tempMap.put("zdsjActual2", ""); | |
| 5731 | + tempMap.put("zdsjk2", ""); | |
| 5732 | + tempMap.put("zdsjm2", ""); | |
| 5733 | + tempMap.put("fcsj2", ""); | |
| 5734 | + tempMap.put("fcsjActual2", ""); | |
| 5735 | + tempMap.put("fcsjk2", ""); | |
| 5736 | + tempMap.put("fcsjm2", ""); | |
| 5737 | + if(df.equals("df")){ | |
| 5738 | + tempMap.put("dfsj2",""); | |
| 5739 | + tempMap.put("dfsjk2" , ""); | |
| 5740 | + tempMap.put("dfsjm2" , ""); | |
| 5741 | + } | |
| 5742 | + tempMap.put("remarks2", ""); | |
| 5743 | + } | |
| 5744 | + dataList3.add(tempMap); | |
| 5745 | + } | |
| 5746 | + | |
| 5747 | + if (date.length() == 10) { | |
| 5748 | + List<DutyEmployee> list = dutyEmployeeService.getDutyEmployee(line, date + "00:01", date + "23:59"); | |
| 5749 | + String dbdp = ""; | |
| 5750 | + try { | |
| 5751 | + for (int i = 0; i < list.size(); i++) { | |
| 5752 | + DutyEmployee t = list.get(i); | |
| 5753 | + if (dbdp.indexOf(t.getuName()) == -1) { | |
| 5754 | + if (!(dbdp.length() > 0)) { | |
| 5755 | + dbdp = t.getuName(); | |
| 5756 | + } else { | |
| 5757 | + dbdp += "," + t.getuName(); | |
| 5758 | + } | |
| 5759 | + } | |
| 5760 | + } | |
| 5761 | + } catch (Exception e) { | |
| 5762 | + // TODO: handle exception | |
| 5763 | + e.printStackTrace(); | |
| 5764 | + } | |
| 5765 | + nMap.put("dbdp", dbdp); | |
| 5766 | + } | |
| 5767 | + | |
| 5768 | + if (type.equals("export")) { | |
| 5769 | + String lineName = ""; | |
| 5770 | + if (map.containsKey("lineName")) | |
| 5771 | + lineName = "-" + map.get("lineName").toString() + "-"; | |
| 5772 | + SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"), | |
| 5773 | + sdfSimple = new SimpleDateFormat("yyyyMMdd"); | |
| 5774 | + Map<String, Object> m = new HashMap<String, Object>(); | |
| 5775 | + List<Iterator<?>> listI = new ArrayList<Iterator<?>>(); | |
| 5776 | + ReportUtils ee = new ReportUtils(); | |
| 5777 | + try { | |
| 5778 | + listI.add(list1.iterator()); | |
| 5779 | + listI.add(dataList2.iterator()); | |
| 5780 | + listI.add(dataList3.iterator()); | |
| 5781 | + String path = this.getClass().getResource("/").getPath() + "static/pages/forms/"; | |
| 5782 | + String sourcePath = path + "mould/scheduleDaily.xls"; | |
| 5783 | + if (date.length() == 7) { | |
| 5784 | + sdfMonth = new SimpleDateFormat("yyyy-MM"); | |
| 5785 | + sdfSimple = new SimpleDateFormat("yyyyMM"); | |
| 5786 | + sourcePath = path + "mould/scheduleDaily_m.xls"; | |
| 5787 | + } | |
| 5788 | + if(df.equals("df")){ | |
| 5789 | + sourcePath =path + "mould/scheduleDaily_df.xls"; | |
| 5790 | + } | |
| 5791 | + ee.excelReplace(listI, new Object[]{nMap}, sourcePath, | |
| 5792 | + path + "export/" + sdfSimple.format(sdfMonth.parse(date)) + lineName + "调度日报.xls"); | |
| 5793 | + } catch (Exception e) { | |
| 5794 | + // TODO: handle exception | |
| 5795 | + e.printStackTrace(); | |
| 5796 | + } | |
| 5797 | + } | |
| 5798 | + | |
| 5799 | + return new ArrayList<Map<String, Object>>(); | |
| 5800 | + } | |
| 5801 | + | |
| 5802 | + public void exportWaybill_pl(List<ScheduleRealInfo> listpl, | |
| 5803 | + String date, String jName, String clZbh, String lpName) { | |
| 5804 | + ReportUtils ee = new ReportUtils(); | |
| 5805 | + ReportRelatedUtils rru = new ReportRelatedUtils(); | |
| 5806 | + List<Iterator<?>> list = new ArrayList<Iterator<?>>(); | |
| 5807 | + List<ScheduleRealInfo> scheduleRealInfos = listpl; | |
| 5808 | + List<Map<String, Object>> listMap = new ArrayList<Map<String, Object>>(); | |
| 5809 | +// List<ScheduleRealInfo> scheduleRealInfos=scheduleRealInfoRepository.queryListWaybillXcld(jName, clZbh, lpName, date, line); | |
| 5810 | + List<ScheduleRealInfo> lists = new ArrayList<ScheduleRealInfo>(); | |
| 5811 | + for (int i = 0; i < scheduleRealInfos.size(); i++) { | |
| 5812 | + ScheduleRealInfo s = scheduleRealInfos.get(i); | |
| 5813 | + Set<ChildTaskPlan> cts = s.getcTasks(); | |
| 5814 | + if (cts != null && cts.size() > 0) { | |
| 5815 | + lists.add(s); | |
| 5816 | + } else { | |
| 5817 | + if (s.getZdsjActual() != null && s.getFcsjActual() != null) { | |
| 5818 | + lists.add(s); | |
| 5819 | + } | |
| 5820 | + } | |
| 5821 | + } | |
| 5822 | + DecimalFormat format = new DecimalFormat("0.00"); | |
| 5823 | +// int cjbc = scheduleRealInfoRepository.findCjbc(jName, clZbh, lpName); | |
| 5824 | +// int ljbc = scheduleRealInfoRepository.findLjbc(jName, clZbh, lpName); | |
| 5825 | + //计算里程和班次数,并放入Map里 | |
| 5826 | + Map<String, Object> map = this.MapById(scheduleRealInfos.get(0).getId()); | |
| 5827 | + | |
| 5828 | + map.put("jhlc", Arith.add(culateMieageService.culateJhgl(scheduleRealInfos), culateMieageService.culateJhJccgl(scheduleRealInfos))); | |
| 5829 | + map.put("remMileage", culateMieageService.culateLbgl(scheduleRealInfos)); | |
| 5830 | + map.put("addMileage", culateMieageService.culateLjgl(lists)); | |
| 5831 | + double yygl = Arith.add(culateMieageService.culateSjgl(lists), culateMieageService.culateLjgl(lists)); | |
| 5832 | + map.put("yygl", yygl); | |
| 5833 | + double ksgl = Arith.add(culateMieageService.culateKsgl(scheduleRealInfos), culateMieageService.culateJccgl(lists)); | |
| 5834 | + map.put("ksgl", ksgl); | |
| 5835 | + map.put("realMileage", Arith.add(yygl, ksgl)); | |
| 5836 | + map.put("jhbc", culateMieageService.culateJhbc(scheduleRealInfos, "")); | |
| 5837 | + map.put("cjbc", culateMieageService.culateLbbc(scheduleRealInfos)); | |
| 5838 | + map.put("ljbc", culateMieageService.culateLjbc(lists, "")); | |
| 5839 | + int sjbc = culateMieageService.culateLjbc(lists, "") + culateMieageService.culateSjbc(lists, ""); | |
| 5840 | + map.put("sjbc", sjbc); | |
| 5841 | +// map=new HashMap<String,Object>(); | |
| 5842 | + | |
| 5843 | + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm"); | |
| 5844 | + String minfcsj = "02:00"; | |
| 5845 | + List<Line> lineList = lineRepository.findLineByCode(listpl.get(0).getXlBm()); | |
| 5846 | + if (lineList.size() > 0) { | |
| 5847 | + String sqlMinYysj = "select start_opt from bsth_c_line_config where " | |
| 5848 | + + " id = (" | |
| 5849 | + + "select max(id) from bsth_c_line_config where line ='" + lineList.get(0).getId() + "'" | |
| 5850 | + + ")"; | |
| 5851 | + minfcsj = jdbcTemplate.queryForObject(sqlMinYysj, String.class); | |
| 5852 | + } | |
| 5853 | + String[] minSjs = minfcsj.split(":"); | |
| 5854 | + Long minSj = Long.parseLong(minSjs[0]) * 60 + Long.parseLong(minSjs[1]); | |
| 5855 | + | |
| 5856 | + | |
| 5857 | + for (int i = 0; i < scheduleRealInfos.size(); i++) { | |
| 5858 | + ScheduleRealInfo s = scheduleRealInfos.get(i); | |
| 5859 | + String[] fcsj = s.getFcsj().split(":"); | |
| 5860 | + Long fcsjL = Long.parseLong(fcsj[0]) * 60 + Long.parseLong(fcsj[1]); | |
| 5861 | + | |
| 5862 | + Long fscjT = 0L; | |
| 5863 | + if (fcsjL < minSj) { | |
| 5864 | + Calendar calendar = new GregorianCalendar(); | |
| 5865 | + calendar.setTime(s.getScheduleDate()); | |
| 5866 | + calendar.add(calendar.DATE, 1); | |
| 5867 | + s.setScheduleDate(calendar.getTime()); | |
| 5868 | + try { | |
| 5869 | + fscjT = sdf.parse(sdf.format(s.getScheduleDate()) + " " + s.getFcsj()).getTime(); | |
| 5870 | + } catch (ParseException e) { | |
| 5871 | + // TODO Auto-generated catch block | |
| 5872 | + e.printStackTrace(); | |
| 5873 | + } | |
| 5874 | + | |
| 5875 | + } else { | |
| 5876 | + try { | |
| 5877 | + fscjT = sdf.parse(s.getScheduleDateStr() + " " + s.getFcsj()).getTime(); | |
| 5878 | + } catch (ParseException e) { | |
| 5879 | + // TODO Auto-generated catch block | |
| 5880 | + e.printStackTrace(); | |
| 5881 | + } | |
| 5882 | + ; | |
| 5883 | + } | |
| 5884 | + s.setFcsjT(fscjT); | |
| 5885 | + } | |
| 5886 | + List<ScheduleRealInfo> listSchedule = new ArrayList<ScheduleRealInfo>(); | |
| 5887 | + Collections.sort(scheduleRealInfos, new ComparableReal()); | |
| 5888 | + for (int i = 0; i < scheduleRealInfos.size(); i++) { | |
| 5889 | + ScheduleRealInfo s = scheduleRealInfos.get(i); | |
| 5890 | + s.setAdjustExps(i + 1 + ""); | |
| 5891 | + String remarks = ""; | |
| 5892 | + if (s.getRemarks() != null) { | |
| 5893 | + remarks += s.getRemarks(); | |
| 5894 | + } | |
| 5895 | + | |
| 5896 | + Set<ChildTaskPlan> childTaskPlans = s.getcTasks(); | |
| 5897 | + if (!childTaskPlans.isEmpty()) { | |
| 5898 | + s.setFcsjActual(""); | |
| 5899 | + s.setZdsjActual(""); | |
| 5900 | + s.setJhlc(0.0); | |
| 5901 | + } | |
| 5902 | + | |
| 5903 | + if (s.isDestroy()) { | |
| 5904 | + s.setFcsjActual(""); | |
| 5905 | + s.setZdsjActual(""); | |
| 5906 | + s.setJhlc(0.0); | |
| 5907 | + remarks += "(烂班)"; | |
| 5908 | + s.setRemarks(remarks); | |
| 5909 | + } | |
| 5910 | + | |
| 5911 | + listSchedule.add(s); | |
| 5912 | + //计算营运里程,空驶里程 | |
| 5913 | + if (!childTaskPlans.isEmpty()) { | |
| 5914 | +// Iterator<ChildTaskPlan> it = childTaskPlans.iterator(); | |
| 5915 | + List<ChildTaskPlan> listit = new ArrayList<ChildTaskPlan>(childTaskPlans); | |
| 5916 | + Collections.sort(listit, new ComparableChild()); | |
| 5917 | + for (int j = 0; j < listit.size(); j++) { | |
| 5918 | + ScheduleRealInfo t = new ScheduleRealInfo(); | |
| 5919 | + ChildTaskPlan childTaskPlan = listit.get(j); | |
| 5920 | + if (childTaskPlan.isDestroy()) { | |
| 5921 | + t.setFcsjActual(""); | |
| 5922 | + t.setZdsjActual(""); | |
| 5923 | + t.setJhlc(0.0); | |
| 5924 | + } else { | |
| 5925 | + t.setFcsjActual(childTaskPlan.getStartDate()); | |
| 5926 | + t.setZdsjActual(childTaskPlan.getEndDate()); | |
| 5927 | + t.setJhlc(Double.parseDouble(String.valueOf(childTaskPlan.getMileage()))); | |
| 5928 | + } | |
| 5929 | + t.setQdzName(childTaskPlan.getStartStationName()); | |
| 5930 | + t.setZdzName(childTaskPlan.getEndStationName()); | |
| 5931 | + t.setRemarks(childTaskPlan.getRemarks()); | |
| 5932 | + t.setAdjustExps("子"); | |
| 5933 | + t.setjGh(""); | |
| 5934 | + t.setjName(""); | |
| 5935 | + t.setsGh(""); | |
| 5936 | + t.setsName(""); | |
| 5937 | + listSchedule.add(t); | |
| 5938 | + } | |
| 5939 | + } | |
| 5940 | + } | |
| 5941 | + Map<String, Object> maps; | |
| 5942 | + for (ScheduleRealInfo scheduleRealInfo : listSchedule) { | |
| 5943 | + maps = new HashMap<String, Object>(); | |
| 5944 | + try { | |
| 5945 | + scheduleRealInfo.setjName(scheduleRealInfo.getjGh() + scheduleRealInfo.getjName()); | |
| 5946 | + scheduleRealInfo.setsName(scheduleRealInfo.getsGh() + scheduleRealInfo.getsName()); | |
| 5947 | + maps = rru.getMapValue(scheduleRealInfo); | |
| 5948 | + maps.put("bcs", scheduleRealInfo.getAdjustExps()); | |
| 5949 | + String zdsj = scheduleRealInfo.getZdsj(); | |
| 5950 | + String zdsjActual = scheduleRealInfo.getZdsjActual(); | |
| 5951 | + if (zdsj != null && zdsjActual != null && | |
| 5952 | + !zdsj.equals(zdsjActual) && | |
| 5953 | + !zdsj.equals("") && | |
| 5954 | + !zdsjActual.equals("")) { | |
| 5955 | + int zdsjT = Integer.valueOf(zdsj.split(":")[0]) * 60 + Integer.valueOf(zdsj.split(":")[1]); | |
| 5956 | + int zdsjAT = Integer.valueOf(zdsjActual.split(":")[0]) * 60 + Integer.valueOf(zdsjActual.split(":")[1]); | |
| 5957 | + if (zdsj.compareTo(zdsjActual) > 0) { | |
| 5958 | + if (zdsjT - zdsjAT > 1000) { | |
| 5959 | + maps.put("fast", ""); | |
| 5960 | + maps.put("slow", zdsjAT - zdsjT + 1440); | |
| 5961 | + } else { | |
| 5962 | + maps.put("fast", TimeUtils.getTimeDifference(zdsj, zdsjActual)); | |
| 5963 | + maps.put("slow", ""); | |
| 5964 | + } | |
| 5965 | + } else { | |
| 5966 | + if (zdsjAT - zdsjT > 1000) { | |
| 5967 | + maps.put("fast", zdsjT - zdsjAT + 1440); | |
| 5968 | + maps.put("slow", ""); | |
| 5969 | + } else { | |
| 5970 | + maps.put("fast", ""); | |
| 5971 | + maps.put("slow", TimeUtils.getTimeDifference(zdsj, zdsjActual)); | |
| 5972 | + } | |
| 5973 | + } | |
| 5974 | + } else { | |
| 5975 | + maps.put("fast", ""); | |
| 5976 | + maps.put("slow", ""); | |
| 5977 | + } | |
| 5978 | + listMap.add(maps); | |
| 5979 | + } catch (Exception e) { | |
| 5980 | + e.printStackTrace(); | |
| 5981 | + } | |
| 5982 | + } | |
| 5983 | + | |
| 5984 | + | |
| 5985 | + String path = this.getClass().getResource("/").getPath() + "static/pages/forms/"; | |
| 5986 | + list.add(listMap.iterator()); | |
| 5987 | + String xls = ""; | |
| 5988 | + if (map.get("type").toString().equals("0")) { | |
| 5989 | + xls = "waybill_minhang.xls"; | |
| 5990 | + } else { | |
| 5991 | + xls = "waybill_minhang_dl.xls"; | |
| 5992 | + } | |
| 5993 | + map.put("sheetName", jName + "-" + clZbh + "-" + lpName); | |
| 5994 | + ee.excelReplace(list, new Object[]{map}, path + "mould/" + xls, | |
| 5995 | + path + "export/" + date + "-" + jName + "-" + clZbh + "-" + lpName + "-行车路单.xls"); | |
| 5996 | + } | |
| 5997 | + | |
| 5998 | + @Override | |
| 5999 | + public Map<String, Object> exportWaybillMore(Map<String, Object> map) { | |
| 6000 | + String date = map.get("date").toString(); | |
| 6001 | + String line = map.get("line").toString(); | |
| 6002 | + ReportUtils ee = new ReportUtils(); | |
| 6003 | + List<List> lists = JSON.parseArray(map.get("strs").toString(), List.class); | |
| 6004 | + String path = this.getClass().getResource("/").getPath() + "static/pages/forms/export/"; | |
| 6005 | + SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"), | |
| 6006 | + sdfSimple = new SimpleDateFormat("yyyyMMdd"); | |
| 6007 | + int num = 0; | |
| 6008 | + File file = null; | |
| 6009 | + try { | |
| 6010 | + while (true) { | |
| 6011 | + String fileUrl = path + "行车路单" + sdfSimple.format(sdfMonth.parse(date)); | |
| 6012 | +// file = new File(fileUrl + (num == 0 ? "/" : "(" + num + ")/")); //新建文件夹 | |
| 6013 | + file = new File(fileUrl + (num == 0 ? ".xls" : "(" + num + ").xls")); //新建excel文件 | |
| 6014 | + if (file.exists()) { //判断是否已存在重名 | |
| 6015 | + num++; | |
| 6016 | + } else { | |
| 6017 | + break; | |
| 6018 | + } | |
| 6019 | + } | |
| 6020 | +// file.mkdirs(); //创建 | |
| 6021 | + List<ScheduleRealInfo> lists_line = scheduleRealInfoRepository.scheduleByDateAndLineTjrb(line, date); | |
| 6022 | + List<File> files = new ArrayList<File>(); | |
| 6023 | + for (List<String> list : lists) { | |
| 6024 | + List<ScheduleRealInfo> newList = new ArrayList<ScheduleRealInfo>(); | |
| 6025 | + String jName = list.get(0); | |
| 6026 | + String clZbh = list.get(1); | |
| 6027 | + String lpName = list.get(2); | |
| 6028 | + String jGh = list.get(3); | |
| 6029 | + for (int i = 0; i < lists_line.size(); i++) { | |
| 6030 | + ScheduleRealInfo s = lists_line.get(i); | |
| 6031 | + if (s.getjGh().equals(jGh) && s.getClZbh().equals(clZbh) && s.getLpName().equals(lpName)) { | |
| 6032 | + newList.add(s); | |
| 6033 | + } | |
| 6034 | + } | |
| 6035 | + this.exportWaybill_pl(newList, date, jName, clZbh, lpName); | |
| 6036 | + File temp = new File(path + date + "-" + jName + "-" + clZbh + "-" + lpName + "-行车路单.xls"); | |
| 6037 | + String fileName = file.getName(); | |
| 6038 | + files.add(temp); | |
| 6039 | + } | |
| 6040 | + for (int i = 1; i < files.size(); i++) { | |
| 6041 | + File file1 = files.get(0); | |
| 6042 | + File file2 = files.get(i); | |
| 6043 | + ee.copySheetByFile(file2, file1, 0, 145); | |
| 6044 | + } | |
| 6045 | + File newFile = files.get(0); | |
| 6046 | + newFile.renameTo(file); | |
| 6047 | +// temp.renameTo(new File(path + fileName + "/" + temp.getName())); | |
| 6048 | +// File[] listFiles = file.listFiles(); | |
| 6049 | +// ZipOutputStream zos = new ZipOutputStream(new BufferedOutputStream(new FileOutputStream(path + file.getName() + ".zip"))); | |
| 6050 | +//// zos.setEncoding("gbk"); | |
| 6051 | +//// zos.putNextEntry(new ZipEntry(fileName + "/")); | |
| 6052 | +// for (int i = 0; i < listFiles.length; i++) { | |
| 6053 | +// zos.putNextEntry(new ZipEntry(fileName + "/" + listFiles[i].getName())); | |
| 6054 | +// BufferedInputStream bis = new BufferedInputStream(new FileInputStream(listFiles[i])); | |
| 6055 | +// BufferedOutputStream bos = new BufferedOutputStream(zos); | |
| 6056 | +// int bytesRead = 0; | |
| 6057 | +// for (byte[] buffer = new byte[BUF_SIZE]; ((bytesRead = bis.read(buffer, 0, BUF_SIZE)) != -1); ) { | |
| 6058 | +//// zos.write(buffer, 0, bytesRead); | |
| 6059 | +//// zos.flush(); | |
| 6060 | +// bos.write(buffer, 0, bytesRead); | |
| 6061 | +// bos.flush(); | |
| 6062 | +// } | |
| 6063 | +//// bos.close(); | |
| 6064 | +// bis.close(); | |
| 6065 | +// } | |
| 6066 | +// zos.close(); | |
| 6067 | +// } | |
| 6068 | + | |
| 6069 | + } catch (Exception e) { | |
| 6070 | + // TODO: handle exception | |
| 6071 | + e.printStackTrace(); | |
| 6072 | + } | |
| 6073 | + | |
| 6074 | + map.put("fileName", file.getName()); | |
| 6075 | + return map; | |
| 6076 | + } | |
| 6077 | + | |
| 6078 | + @Autowired | |
| 6079 | + SchedulePlanInfoService schPlanService; | |
| 6080 | + | |
| 6081 | + @Override | |
| 6082 | + public List<SchedulePlanInfo> currentSchedulePlan(String lineCode) { | |
| 6083 | + List<SchedulePlanInfo> rs = dayOfSchedule.schedulePlanMap.get(lineCode); | |
| 6084 | + | |
| 6085 | + if (rs == null || rs.size() == 0) { | |
| 6086 | + //尝试刷新内存 | |
| 6087 | + Map<String, Object> data = new HashMap<>(); | |
| 6088 | + data.put("scheduleDate_eq", dayOfSchedule.currSchDateMap.get(lineCode)); | |
| 6089 | + data.put("xlBm_eq", lineCode); | |
| 6090 | + List<SchedulePlanInfo> planItr = dayOfSchedule.cleanSchPlanItr(schPlanService.list(data).iterator()); | |
| 6091 | + | |
| 6092 | + if (planItr.size() > 0) { | |
| 6093 | + dayOfSchedule.schedulePlanMap.put(lineCode, planItr); | |
| 6094 | + return planItr; | |
| 6095 | + } | |
| 6096 | + } | |
| 6097 | + return rs; | |
| 6098 | + } | |
| 6099 | + | |
| 6100 | + | |
| 6101 | + @Override | |
| 6102 | + public Map<String, Object> lpChangeMulti(String leftIdx, String rightIdx, int type) { | |
| 6103 | + Map<String, Object> rs = new HashMap<>(); | |
| 6104 | + Set<ScheduleRealInfo> ts = new HashSet<>(); | |
| 6105 | + try { | |
| 6106 | + List<String> leftList = Splitter.on(",").splitToList(leftIdx); | |
| 6107 | + List<String> rightList = Splitter.on(",").splitToList(rightIdx); | |
| 6108 | + Set<String> lpSet = new HashSet<>(); | |
| 6109 | + Set<String> carSet = new HashSet<>(); | |
| 6110 | + | |
| 6111 | + List<ScheduleRealInfo> largeList, smallList; | |
| 6112 | + if (leftList.size() > rightList.size()) { | |
| 6113 | + largeList = getByIdx(leftList); | |
| 6114 | + smallList = getByIdx(rightList); | |
| 6115 | + } else { | |
| 6116 | + largeList = getByIdx(rightList); | |
| 6117 | + smallList = getByIdx(leftList); | |
| 6118 | + } | |
| 6119 | + | |
| 6120 | + ScheduleRealInfo leftSch, rightSch = null; | |
| 6121 | + for (int i = 0; i < largeList.size(); i++) { | |
| 6122 | + leftSch = largeList.get(i); | |
| 6123 | + leftSch.setLpChange(1); | |
| 6124 | + if (i < smallList.size()) { | |
| 6125 | + rightSch = smallList.get(i); | |
| 6126 | + rightSch.setLpChange(1); | |
| 6127 | + ts.add(rightSch); | |
| 6128 | + } else { | |
| 6129 | + //不对称时多出来的 | |
| 6130 | + lpChangeByLeft(leftSch, largeList.get(i - 1), type); | |
| 6131 | + ts.add(leftSch); | |
| 6132 | + lpSet.add(leftSch.getXlBm() + "_" + leftSch.getLpName()); | |
| 6133 | + continue; | |
| 6134 | + } | |
| 6135 | + | |
| 6136 | + //调换路牌 | |
| 6137 | + lpChange(leftSch, rightSch, type); | |
| 6138 | + ts.add(leftSch); | |
| 6139 | + | |
| 6140 | + lpSet.add(leftSch.getXlBm() + "_" + leftSch.getLpName()); | |
| 6141 | + lpSet.add(rightSch.getXlBm() + "_" + rightSch.getLpName()); | |
| 6142 | + | |
| 6143 | + carSet.add(leftSch.getClZbh()); | |
| 6144 | + carSet.add(rightSch.getClZbh()); | |
| 6145 | + scheduleRealInfoRepository.updateLpChange(leftSch.getId()); | |
| 6146 | + scheduleRealInfoRepository.updateLpChange(rightSch.getId()); | |
| 6147 | + } | |
| 6148 | + | |
| 6149 | + //重新计算路牌的起点应到时间 | |
| 6150 | + for (String lpName : lpSet) { | |
| 6151 | + ts.addAll(dayOfSchedule.updateQdzTimePlan(lpName)); | |
| 6152 | + } | |
| 6153 | + | |
| 6154 | + //重新就算车辆当前执行班次 | |
| 6155 | + for(String nbbm : carSet){ | |
| 6156 | + dayOfSchedule.reCalcExecPlan(nbbm); | |
| 6157 | + } | |
| 6158 | + | |
| 6159 | + | |
| 6160 | + for (ScheduleRealInfo sch : ts) { | |
| 6161 | + dayOfSchedule.save(sch); | |
| 6162 | + } | |
| 6163 | + | |
| 6164 | + rs.put("status", ResponseCode.SUCCESS); | |
| 6165 | + rs.put("ts", ts); | |
| 6166 | + } catch (Exception e) { | |
| 6167 | + logger.error("", e); | |
| 6168 | + rs.put("status", ResponseCode.ERROR); | |
| 6169 | + rs.put("msg", e.getMessage()); | |
| 6170 | + } | |
| 6171 | + | |
| 6172 | + return rs; | |
| 6173 | + } | |
| 6174 | + | |
| 6175 | + private List<ScheduleRealInfo> getByIdx(List<String> idList) { | |
| 6176 | + List<ScheduleRealInfo> list = new ArrayList<>(); | |
| 6177 | + for (String id : idList) { | |
| 6178 | + list.add(dayOfSchedule.get(Long.parseLong(id))); | |
| 6179 | + } | |
| 6180 | + return list; | |
| 6181 | + } | |
| 6182 | + | |
| 6183 | + @Override | |
| 6184 | + public void lpChange(ScheduleRealInfo leftSch, ScheduleRealInfo rightSch, int type) { | |
| 6185 | + //释放班次映射 | |
| 6186 | + if (type > 0) { | |
| 6187 | + dayOfSchedule.removeNbbm2SchMapp(leftSch); | |
| 6188 | + dayOfSchedule.removeNbbm2SchMapp(rightSch); | |
| 6189 | + } | |
| 6190 | + | |
| 6191 | + //对调数据 | |
| 6192 | + LpData leftData = new LpData(leftSch); | |
| 6193 | + LpData rightData = new LpData(rightSch); | |
| 6194 | + | |
| 6195 | + leftData.appendTo(rightSch, type); | |
| 6196 | + rightData.appendTo(leftSch, type); | |
| 6197 | + | |
| 6198 | + if (type > 0) { | |
| 6199 | + //重新映射 | |
| 6200 | + dayOfSchedule.addNbbm2SchMapp(leftSch); | |
| 6201 | + dayOfSchedule.addNbbm2SchMapp(rightSch); | |
| 6202 | + } | |
| 6203 | + } | |
| 6204 | + | |
| 6205 | + /** | |
| 6206 | + * 更换左边班次的路牌,右边不变 | |
| 6207 | + * | |
| 6208 | + * @param leftSch | |
| 6209 | + * @param rightSch | |
| 6210 | + * @param type | |
| 6211 | + */ | |
| 6212 | + public void lpChangeByLeft(ScheduleRealInfo leftSch, ScheduleRealInfo rightSch, int type) { | |
| 6213 | + //释放班次映射 | |
| 6214 | + if (type > 0) | |
| 6215 | + dayOfSchedule.removeNbbm2SchMapp(leftSch); | |
| 6216 | + | |
| 6217 | + LpData rightData = new LpData(rightSch); | |
| 6218 | + rightData.appendTo(leftSch, type); | |
| 6219 | + | |
| 6220 | + //重新映射 | |
| 6221 | + if (type > 0) | |
| 6222 | + dayOfSchedule.addNbbm2SchMapp(leftSch); | |
| 6223 | + | |
| 6224 | + } | |
| 6225 | + | |
| 6226 | + @Override | |
| 6227 | + public Map<String, Object> revokeRealArrive(Long id) { | |
| 6228 | + Map<String, Object> rs = new HashMap<>(); | |
| 6229 | + List<ScheduleRealInfo> ts = new ArrayList<>(); | |
| 6230 | + | |
| 6231 | + try { | |
| 6232 | + ScheduleRealInfo sch = dayOfSchedule.get(id); | |
| 6233 | + if (sch.getZdsjActual() == null && sch.getFcsjActual() == null) { | |
| 6234 | + rs.put("status", ResponseCode.ERROR); | |
| 6235 | + rs.put("msg", "班次未执行,无法撤销!"); | |
| 6236 | + } else { | |
| 6237 | + //日志记录 | |
| 6238 | + ScheduleModifyLogger.cxzx(sch); | |
| 6239 | + | |
| 6240 | + sch.clearFcsjActual(); | |
| 6241 | + sch.clearZdsjActual(); | |
| 6242 | + //清除路牌下一个班的起点到达时间 | |
| 6243 | + ScheduleRealInfo next = dayOfSchedule.nextByLp(sch); | |
| 6244 | + if (null != next) { | |
| 6245 | + next.setQdzArrDatesj(null); | |
| 6246 | + ts.add(next); | |
| 6247 | + } | |
| 6248 | + | |
| 6249 | + rs.put("status", ResponseCode.SUCCESS); | |
| 6250 | + | |
| 6251 | + ts.add(sch); | |
| 6252 | + rs.put("ts", ts); | |
| 6253 | + | |
| 6254 | + dayOfSchedule.save(sch); | |
| 6255 | + //重新计算当前执行班次 | |
| 6256 | + dayOfSchedule.reCalcExecPlan(sch.getClZbh()); | |
| 6257 | + | |
| 6258 | + } | |
| 6259 | + } catch (Exception e) { | |
| 6260 | + logger.error("", e); | |
| 6261 | + rs.put("status", ResponseCode.ERROR); | |
| 6262 | + } | |
| 6263 | + return rs; | |
| 6264 | + } | |
| 6265 | + | |
| 6266 | + @Override | |
| 6267 | + public Map<String, Object> lateAdjust(String idx, float minute) { | |
| 6268 | + Map<String, Object> rs = new HashMap<>(); | |
| 6269 | + try { | |
| 6270 | + int count = 0; | |
| 6271 | + List<ScheduleRealInfo> list = new ArrayList<>(); | |
| 6272 | + List<String> ids = Splitter.on(",").trimResults().omitEmptyStrings().splitToList(idx); | |
| 6273 | + | |
| 6274 | + ScheduleRealInfo sch; | |
| 6275 | + for (String id : ids) { | |
| 6276 | + sch = dayOfSchedule.get(Long.parseLong(id)); | |
| 6277 | + if (sch != null && sch.getStatus() == 0) { | |
| 6278 | + if (minute > 0) { | |
| 6279 | + sch.setLateMinute(minute); | |
| 6280 | + } else if (minute == 0) { | |
| 6281 | + LateAdjustHandle.remove(sch); | |
| 6282 | + } | |
| 6283 | + count++; | |
| 6284 | + list.add(sch); | |
| 6285 | + } | |
| 6286 | + } | |
| 6287 | + | |
| 6288 | + rs.put("status", ResponseCode.SUCCESS); | |
| 6289 | + rs.put("count", count); | |
| 6290 | + rs.put("ts", list); | |
| 6291 | + } catch (Exception e) { | |
| 6292 | + logger.error("", e); | |
| 6293 | + rs.put("status", ResponseCode.ERROR); | |
| 6294 | + rs.put("msg", e.getMessage()); | |
| 6295 | + } | |
| 6296 | + | |
| 6297 | + return rs; | |
| 6298 | + } | |
| 6299 | + | |
| 6300 | + @Override | |
| 6301 | + public List<ScheduleRealInfo> allLate2(String idx) { | |
| 6302 | + List<ScheduleRealInfo> rs = new ArrayList<>(); | |
| 6303 | + List<String> ids = Splitter.on(",").trimResults().omitEmptyStrings().splitToList(idx); | |
| 6304 | + | |
| 6305 | + Collection<ScheduleRealInfo> all = LateAdjustHandle.allLateSch(); | |
| 6306 | + for (ScheduleRealInfo sch : all) { | |
| 6307 | + if (ids.indexOf(sch.getXlBm()) != -1) { | |
| 6308 | + rs.add(sch); | |
| 6309 | + } | |
| 6310 | + } | |
| 6311 | + return rs; | |
| 6312 | + } | |
| 6313 | + | |
| 6314 | + | |
| 6315 | + @Override | |
| 6316 | + public List<Map<String, Object>> mileageReport(String gsdm, | |
| 6317 | + String fgsdm, String line, String date, String date2) { | |
| 6318 | + | |
| 6319 | + String sql = "select * from calc_mileage where 1=1 "; | |
| 6320 | + if (!line.equals(" ")) { | |
| 6321 | + sql = sql + " and line_code='" + line + "' "; | |
| 6322 | + } | |
| 6323 | + sql = sql + " and DATE_FORMAT(rq,'%Y-%m-%d') between '" + date + "' and '" + date2 + "'"; | |
| 6324 | + if (!gsdm.equals(" ")) { | |
| 6325 | + sql = sql + " and company_id=" + gsdm; | |
| 6326 | + } | |
| 6327 | + if (!gsdm.equals(" ")) { | |
| 6328 | + sql = sql + " and sub_company_id=" + fgsdm; | |
| 6329 | + } | |
| 6330 | + sql = sql + " order by line_code"; | |
| 6331 | + List<MileageReport> list = jdbcTemplate.query(sql, | |
| 6332 | + new RowMapper<MileageReport>() { | |
| 6333 | + @Override | |
| 6334 | + public MileageReport mapRow(ResultSet rs, int rowNum) throws SQLException { | |
| 6335 | + MileageReport mr = new MileageReport(); | |
| 6336 | + mr.setCompanyName(rs.getString("company_name")); | |
| 6337 | + mr.setSubCompanyName(rs.getString("sub_company_name")); | |
| 6338 | + mr.setLineName(rs.getString("line_name")); | |
| 6339 | + mr.setSjyygl(rs.getDouble("sjyygl")); | |
| 6340 | + mr.setSjksgl(rs.getDouble("sjksgl")); | |
| 6341 | + mr.setZgl(rs.getDouble("zyygl")); | |
| 6342 | + mr.setZddfgl(rs.getDouble("zddfgl")); | |
| 6343 | + mr.setSddfgl(rs.getDouble("sddfgl")); | |
| 6344 | + mr.setWqwxhgl(rs.getDouble("wqwxhgl")); | |
| 6345 | + mr.setBfwxhgl(rs.getDouble("bfwxhgl")); | |
| 6346 | + mr.setPygl(rs.getDouble("pygl")); | |
| 6347 | + mr.setLjgl(rs.getDouble("ljgl")); | |
| 6348 | + mr.setZrwgl(rs.getDouble("zrwgl")); | |
| 6349 | + mr.setOther(rs.getString("other")); | |
| 6350 | + return mr; | |
| 6351 | + } | |
| 6352 | + }); | |
| 6353 | + List<Map<String, Object>> lMap = new ArrayList<Map<String, Object>>(); | |
| 6354 | + double sjyygl = 0.0; | |
| 6355 | + double sjksgl = 0.0; | |
| 6356 | + double zgl = 0.0; | |
| 6357 | + double sddfgl = 0.0; | |
| 6358 | + double zddfgl = 0.0; | |
| 6359 | + double wqwxhgl = 0.0; | |
| 6360 | + double bfwxhgl = 0.0; | |
| 6361 | + double pygl = 0.0; | |
| 6362 | + double ljgl = 0.0; | |
| 6363 | + double zrwgl = 0.0; | |
| 6364 | + for (MileageReport mr : list) { | |
| 6365 | + Map<String, Object> resMap = new HashMap<String, Object>(); | |
| 6366 | + resMap.put("gsName", mr.getCompanyName()); | |
| 6367 | + resMap.put("fgsName", mr.getSubCompanyName()); | |
| 6368 | + resMap.put("xlName", mr.getLineName()); | |
| 6369 | + resMap.put("sjyygl", mr.getSjyygl()); | |
| 6370 | + resMap.put("sjksgl", mr.getSjksgl()); | |
| 6371 | + resMap.put("zgl", mr.getZgl()); | |
| 6372 | + resMap.put("sddfgl", mr.getSddfgl()); | |
| 6373 | + resMap.put("zddfgl", mr.getZddfgl()); | |
| 6374 | + resMap.put("wqwxhgl", mr.getWqwxhgl()); | |
| 6375 | + resMap.put("bfwxhgl", mr.getBfwxhgl()); | |
| 6376 | + resMap.put("pygl", mr.getPygl()); | |
| 6377 | + resMap.put("ljgl", mr.getLjgl()); | |
| 6378 | + resMap.put("zrwgl", mr.getZrwgl()); | |
| 6379 | + resMap.put("other", mr.getOther()); | |
| 6380 | + lMap.add(resMap); | |
| 6381 | + sjyygl = Arith.add(sjyygl, mr.getSjyygl()); | |
| 6382 | + sjksgl = Arith.add(sjksgl, mr.getSjksgl()); | |
| 6383 | + zgl = Arith.add(zgl, mr.getZgl()); | |
| 6384 | + sddfgl = Arith.add(sddfgl, mr.getSddfgl()); | |
| 6385 | + zddfgl = Arith.add(zddfgl, mr.getZddfgl()); | |
| 6386 | + wqwxhgl = Arith.add(wqwxhgl, mr.getWqwxhgl()); | |
| 6387 | + bfwxhgl = Arith.add(bfwxhgl, mr.getBfwxhgl()); | |
| 6388 | + pygl = Arith.add(pygl, mr.getPygl()); | |
| 6389 | + ljgl = Arith.add(ljgl, mr.getLjgl()); | |
| 6390 | + zrwgl = Arith.add(zrwgl, mr.getZrwgl()); | |
| 6391 | + } | |
| 6392 | + Map<String, Object> resMap = new HashMap<String, Object>(); | |
| 6393 | + resMap.put("xlName", "合计"); | |
| 6394 | + resMap.put("sjyygl", sjyygl); | |
| 6395 | + resMap.put("sjksgl", sjksgl); | |
| 6396 | + resMap.put("zgl", zgl); | |
| 6397 | + resMap.put("sddfgl", sddfgl); | |
| 6398 | + resMap.put("zddfgl", zddfgl); | |
| 6399 | + resMap.put("wqwxhgl", wqwxhgl); | |
| 6400 | + resMap.put("bfwxhgl", bfwxhgl); | |
| 6401 | + resMap.put("pygl", pygl); | |
| 6402 | + resMap.put("ljgl", ljgl); | |
| 6403 | + resMap.put("zrwgl", zrwgl); | |
| 6404 | + resMap.put("other", null); | |
| 6405 | + lMap.add(resMap); | |
| 6406 | + return lMap; | |
| 6407 | + } | |
| 6408 | + | |
| 6409 | + @Override | |
| 6410 | + public List<Map<String, Object>> scheduleCorrectionReport(String gsdm, | |
| 6411 | + String fgsdm, String line, String date, String date2) { | |
| 6412 | + | |
| 6413 | + String sql = "select * from calc_schedule where 1=1 "; | |
| 6414 | + if (!line.equals(" ")) { | |
| 6415 | + sql = sql + " and line_code='" + line + "' "; | |
| 6416 | + } | |
| 6417 | + sql = sql + " and DATE_FORMAT(rq,'%Y-%m-%d') between '" + date + "' and '" + date2 + "'"; | |
| 6418 | + if (!gsdm.equals(" ")) { | |
| 6419 | + sql = sql + " and company_id=" + gsdm; | |
| 6420 | + } | |
| 6421 | + if (!gsdm.equals(" ")) { | |
| 6422 | + sql = sql + " and sub_company_id=" + fgsdm; | |
| 6423 | + } | |
| 6424 | + sql = sql + " order by line_code"; | |
| 6425 | + List<ScheduleCorrectionReport> list = jdbcTemplate.query(sql, | |
| 6426 | + new RowMapper<ScheduleCorrectionReport>() { | |
| 6427 | + @Override | |
| 6428 | + public ScheduleCorrectionReport mapRow(ResultSet rs, int rowNum) throws SQLException { | |
| 6429 | + ScheduleCorrectionReport sReport = new ScheduleCorrectionReport(); | |
| 6430 | + sReport.setCompanyName(rs.getString("company_name")); | |
| 6431 | + sReport.setSubCompanyName(rs.getString("sub_company_name")); | |
| 6432 | + sReport.setLineName(rs.getString("line_name")); | |
| 6433 | + sReport.setSjyybc(rs.getInt("sjyybc")); | |
| 6434 | + sReport.setSjksbc(rs.getInt("sjksbc")); | |
| 6435 | + sReport.setZbc(rs.getInt("zyybc")); | |
| 6436 | + sReport.setZddfbc(rs.getInt("zddfbc")); | |
| 6437 | + sReport.setSddfbc(rs.getInt("sddfbc")); | |
| 6438 | + sReport.setWqwxhbc(rs.getInt("wqwxhbc")); | |
| 6439 | + sReport.setBfwxhbc(rs.getInt("bfwxhbc")); | |
| 6440 | + sReport.setPybc(rs.getInt("pybc")); | |
| 6441 | + sReport.setLjbc(rs.getInt("ljbc")); | |
| 6442 | + sReport.setZrwbc(rs.getInt("zrwbc")); | |
| 6443 | + sReport.setOther(rs.getString("other")); | |
| 6444 | + return sReport; | |
| 6445 | + } | |
| 6446 | + }); | |
| 6447 | + List<Map<String, Object>> lMap = new ArrayList<Map<String, Object>>(); | |
| 6448 | + int sjyybc = 0; | |
| 6449 | + int sjksbc = 0; | |
| 6450 | + int zbc = 0; | |
| 6451 | + int sddfbc = 0; | |
| 6452 | + int zddfbc = 0; | |
| 6453 | + int wqwxhbc = 0; | |
| 6454 | + int bfwxhbc = 0; | |
| 6455 | + int pybc = 0; | |
| 6456 | + int ljbc = 0; | |
| 6457 | + int zrwbc = 0; | |
| 6458 | + for (ScheduleCorrectionReport sReport : list) { | |
| 6459 | + Map<String, Object> resMap = new HashMap<String, Object>(); | |
| 6460 | + resMap.put("gsName", sReport.getCompanyName()); | |
| 6461 | + resMap.put("fgsName", sReport.getSubCompanyName()); | |
| 6462 | + resMap.put("xlName", sReport.getLineName()); | |
| 6463 | + resMap.put("sjyybc", sReport.getSjyybc()); | |
| 6464 | + resMap.put("sjksbc", sReport.getSjksbc()); | |
| 6465 | + resMap.put("zbc", sReport.getZbc()); | |
| 6466 | + resMap.put("sddfbc", sReport.getSddfbc()); | |
| 6467 | + resMap.put("zddfbc", sReport.getZddfbc()); | |
| 6468 | + resMap.put("wqwxhbc", sReport.getWqwxhbc()); | |
| 6469 | + resMap.put("bfwxhbc", sReport.getBfwxhbc()); | |
| 6470 | + resMap.put("pybc", sReport.getPybc()); | |
| 6471 | + resMap.put("ljbc", sReport.getLjbc()); | |
| 6472 | + resMap.put("zrwbc", sReport.getZrwbc()); | |
| 6473 | + resMap.put("other", sReport.getOther()); | |
| 6474 | + lMap.add(resMap); | |
| 6475 | + sjyybc = sjyybc + sReport.getSjyybc(); | |
| 6476 | + sjksbc = sjksbc + sReport.getSjksbc(); | |
| 6477 | + zbc = zbc + sReport.getZbc(); | |
| 6478 | + sddfbc = sddfbc + sReport.getSddfbc(); | |
| 6479 | + zddfbc = zddfbc + sReport.getZddfbc(); | |
| 6480 | + wqwxhbc = wqwxhbc + sReport.getWqwxhbc(); | |
| 6481 | + bfwxhbc = bfwxhbc + sReport.getBfwxhbc(); | |
| 6482 | + pybc = pybc + sReport.getPybc(); | |
| 6483 | + ljbc = ljbc + sReport.getLjbc(); | |
| 6484 | + zrwbc = zrwbc + sReport.getZrwbc(); | |
| 6485 | + } | |
| 6486 | + Map<String, Object> resMap = new HashMap<String, Object>(); | |
| 6487 | + resMap.put("xlName", "合计"); | |
| 6488 | + resMap.put("sjyybc", sjyybc); | |
| 6489 | + resMap.put("sjksbc", sjksbc); | |
| 6490 | + resMap.put("zbc", zbc); | |
| 6491 | + resMap.put("sddfbc", sddfbc); | |
| 6492 | + resMap.put("zddfbc", zddfbc); | |
| 6493 | + resMap.put("wqwxhbc", wqwxhbc); | |
| 6494 | + resMap.put("bfwxhbc", bfwxhbc); | |
| 6495 | + resMap.put("pybc", pybc); | |
| 6496 | + resMap.put("ljbc", ljbc); | |
| 6497 | + resMap.put("zrwbc", zrwbc); | |
| 6498 | + resMap.put("other", null); | |
| 6499 | + lMap.add(resMap); | |
| 6500 | + return lMap; | |
| 6501 | + } | |
| 6502 | + | |
| 6503 | + @Override | |
| 6504 | + public Integer isCircleQdz(String clzbh, String sdr, String xlbm, String qdzCode) { | |
| 6505 | + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); | |
| 6506 | + String time =sdf.format(Long.parseLong(sdr)); | |
| 6507 | + | |
| 6508 | + Long num=scheduleRealInfoRepository.isCircleQdz(clzbh, time, xlbm, qdzCode); | |
| 6509 | + Integer num2=num==0L?0:1; | |
| 6510 | + return num2; | |
| 6511 | + } | |
| 6512 | + | |
| 6513 | + @SuppressWarnings("unchecked") | |
| 6514 | + private static Map<String, Object> request(String url) { | |
| 6515 | + Map<String, Object> res = new HashMap<>(); | |
| 6516 | + res.put("status", ResponseCode.SUCCESS); | |
| 6517 | + try { | |
| 6518 | + StringBuilder sb = HttpClientUtils.post(url, null); | |
| 6519 | + if (sb != null) { | |
| 6520 | + Map<String, Object> response = new ObjectMapper().readValue(sb.toString(), Map.class); | |
| 6521 | + if (!"报修成功".equals(response.get("msg"))) { | |
| 6522 | + res.put("status", ResponseCode.ERROR); | |
| 6523 | + res.putAll(response); | |
| 6524 | + } | |
| 6525 | + } else { | |
| 6526 | + res.put("status", ResponseCode.ERROR); | |
| 6527 | + res.put("msg", "调用上报接口异常"); | |
| 6528 | + } | |
| 6529 | + } catch (Exception e) { | |
| 6530 | + // TODO Auto-generated catch block | |
| 6531 | + logger.error("维修上报异常", e); | |
| 6532 | + res.put("status", ResponseCode.ERROR); | |
| 6533 | + res.put("msg", "调用上报接口异常"); | |
| 6534 | + } | |
| 6535 | + | |
| 6536 | + return res; | |
| 6537 | + } | |
| 6538 | + | |
| 6539 | + /** | |
| 6540 | + ** 维修记录上报 | |
| 6541 | + * @param param 参数信息 | |
| 6542 | + * @param isActive 主/被动上报 | |
| 6543 | + */ | |
| 6544 | + @Override | |
| 6545 | + @Transactional | |
| 6546 | + public Map<String, Object> repairReport(Map<String, Object> param, boolean isActive) { | |
| 6547 | + Map<String, Object> res = new HashMap<String, Object>(); | |
| 6548 | + res.put("status", ResponseCode.SUCCESS); | |
| 6549 | + // 获取实际排班信息 | |
| 6550 | + Long id = Long.parseLong((String)param.get("id")); | |
| 6551 | + ScheduleRealInfo sch = dayOfSchedule.get(id); | |
| 6552 | + | |
| 6553 | + if (null == sch) { | |
| 6554 | + res.put("status", ResponseCode.ERROR); | |
| 6555 | + res.put("msg", "不存在的班次!"); | |
| 6556 | + | |
| 6557 | + return res; | |
| 6558 | + } | |
| 6559 | + | |
| 6560 | + int reportState = -1; | |
| 6561 | + SysUser user = SecurityUtils.getCurrentUser(); | |
| 6562 | + String reportUser = user.getUserName(), reportName = user.getName(), incode = (String)param.get("clZbh"), reportTypes = (String)param.get("reportTypes"), repairTypes = reportType2RepairType(reportTypes); | |
| 6563 | + // 分公司保存格式 分公司编码_公司编码 | |
| 6564 | + String val = BasicData.nbbm2FgsCompanyCodeMap.get(incode); | |
| 6565 | + String[] arr = val.split("_"); | |
| 6566 | + StringBuilder url = new StringBuilder(SystemParamCache.getUrlHttpReport(arr[1])); | |
| 6567 | + url.append("?nbbm=").append(incode).append("&bxy=").append(reportUser).append("&bxbm=").append(repairTypes).append("&fgs=").append(arr[0]); | |
| 6568 | + | |
| 6569 | + int count = repairReportRepository.repairReportBySch(id, isActive ? 1 : 0); | |
| 6570 | + if (count > 0) return res; | |
| 6571 | + RepairReport lrr = dayOfSchedule.getLastestRepairReport(incode); | |
| 6572 | + // 非主动上报并且无上报记录或上次已上报 则不用上报 | |
| 6573 | + if (!isActive && (lrr == null || lrr.getReportState() != 0)) { | |
| 6574 | + reportState = 0; | |
| 6575 | + } else { | |
| 6576 | + res = request(url.toString()); | |
| 6577 | + if (ResponseCode.SUCCESS.equals(res.get("status"))) reportState = 1; | |
| 6578 | + } | |
| 6579 | + // 持久化此次上报记录 | |
| 6580 | + RepairReport rr = new RepairReport(); | |
| 6581 | + rr.setLineId(sch.getXlBm()); | |
| 6582 | + rr.setLineName(sch.getXlName()); | |
| 6583 | + rr.setReportUser(reportUser); | |
| 6584 | + rr.setReportName(reportName); | |
| 6585 | + rr.setSchId(id); | |
| 6586 | + rr.setIncode(incode); | |
| 6587 | + rr.setDepartureTime(sch.getFcsj()); | |
| 6588 | + rr.setRepairType(repairTypes); | |
| 6589 | + rr.setReportType(reportTypes); | |
| 6590 | + rr.setReportDate(new Date()); | |
| 6591 | + rr.setReportState(reportState); | |
| 6592 | + rr.setReportMode(isActive ? 1 : 0); | |
| 6593 | + rr = repairReportRepository.save(rr); | |
| 6594 | + dayOfSchedule.setLastestRepairReport(rr); | |
| 6595 | + // 如果上报失败,放到重传队列 | |
| 6596 | + if (rr.getReportState() == -1) queue.add(rr); | |
| 6597 | + | |
| 6598 | + return res; | |
| 6599 | + } | |
| 6600 | + | |
| 6601 | + private void repairReport(RepairReport rr) { | |
| 6602 | + int reportState = -1; | |
| 6603 | + // 分公司保存格式 分公司编码_公司编码 | |
| 6604 | + String val = BasicData.nbbm2FgsCompanyCodeMap.get(rr.getIncode()); | |
| 6605 | + String[] arr = val.split("_"); | |
| 6606 | + StringBuilder url = new StringBuilder(SystemParamCache.getUrlHttpReport(arr[1])); | |
| 6607 | + url.append("?nbbm=").append(rr.getIncode()).append("&bxy=").append(rr.getReportUser()).append("&bxbm=").append(rr.getRepairType()).append("&fgs=").append(arr[0]); | |
| 6608 | + | |
| 6609 | + Map<String, Object> res = request(url.toString()); | |
| 6610 | + if (ResponseCode.SUCCESS.equals(res.get("status"))) reportState = 1; | |
| 6611 | + if (reportState == 1) { | |
| 6612 | + rr.setReportState(1); | |
| 6613 | + repairReportRepository.save(rr); | |
| 6614 | + } | |
| 6615 | + } | |
| 6616 | + | |
| 6617 | + /** | |
| 6618 | + ** 业务类型转报修类型 | |
| 6619 | + */ | |
| 6620 | + private String reportType2RepairType(String reportType) { | |
| 6621 | + String[] reportTypes = reportType.split(";"); | |
| 6622 | + List<String> repairTypes = new ArrayList<>(); | |
| 6623 | + for (String rt : reportTypes) { | |
| 6624 | + repairTypes.add(report2repair.get(rt)); | |
| 6625 | + } | |
| 6626 | + | |
| 6627 | + return StringUtils.join(repairTypes, ";"); | |
| 6628 | + } | |
| 6629 | + | |
| 6630 | + @Override | |
| 6631 | + public List<RepairReport> repairReportList(String lineId, String date, String incode, String type) { | |
| 6632 | + List<RepairReport> result = new ArrayList<RepairReport>(); | |
| 6633 | + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); | |
| 6634 | + | |
| 6635 | + Date start = null, end = null; | |
| 6636 | + if (date.length() > 0) { | |
| 6637 | + try { | |
| 6638 | + start = sdf.parse(date + " 00:00:00"); | |
| 6639 | + end = sdf.parse(date + " 23:59:59"); | |
| 6640 | + } catch (ParseException e) { | |
| 6641 | + // TODO Auto-generated catch block | |
| 6642 | + e.printStackTrace(); | |
| 6643 | + } | |
| 6644 | + | |
| 6645 | + } | |
| 6646 | + | |
| 6647 | + result = repairReportRepository.repairReportList(lineId, start, end, incode); | |
| 6648 | + Map<String, Object> dMap=new HashMap<>(); | |
| 6649 | + dMap.put("dGroup_eq", "repairtype"); | |
| 6650 | + Map<String, String> code2name = new HashMap<String, String>(); | |
| 6651 | + for (Dictionary dic : dictionaryService.list(dMap)) { | |
| 6652 | + code2name.put(dic.getdCode(), dic.getdName()); | |
| 6653 | + } | |
| 6654 | + for (RepairReport rr : result) { | |
| 6655 | + String reportType = rr.getReportType(); | |
| 6656 | + String[] types = reportType.split(";"); | |
| 6657 | + StringBuilder sb = new StringBuilder(); | |
| 6658 | + | |
| 6659 | + for (String t : types) { | |
| 6660 | + sb.append(code2name.get(t)).append(";"); | |
| 6661 | + } | |
| 6662 | + | |
| 6663 | + rr.setRepairType(sb.toString()); | |
| 6664 | + rr.setReportDateStr(sdf.format(rr.getReportDate())); | |
| 6665 | + switch (rr.getReportState()) { | |
| 6666 | + case 0: | |
| 6667 | + rr.setReportStateStr("不报"); | |
| 6668 | + break; | |
| 6669 | + case 1: | |
| 6670 | + rr.setReportStateStr("上报成功"); | |
| 6671 | + break; | |
| 6672 | + case -1: | |
| 6673 | + rr.setReportStateStr("上报失败"); | |
| 6674 | + break; | |
| 6675 | + default: | |
| 6676 | + break; | |
| 6677 | + } | |
| 6678 | + } | |
| 6679 | + | |
| 6680 | + if ("export".equals(type)) { | |
| 6681 | + String lineName = BasicData.lineCode2NameMap.get(lineId); | |
| 6682 | + SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"), | |
| 6683 | + sdfSimple = new SimpleDateFormat("yyyyMMdd"); | |
| 6684 | + List<Iterator<?>> listI = new ArrayList<Iterator<?>>(); | |
| 6685 | + Map<String, Object> m = new HashMap<String, Object>(); | |
| 6686 | + ReportUtils ee = new ReportUtils(); | |
| 6687 | + List<Map<String, Object>> newList = new ArrayList<Map<String, Object>>(); | |
| 6688 | + for (int i = 0; i < result.size(); i++) { | |
| 6689 | + Map<String, Object> map = new HashMap<String, Object>(); | |
| 6690 | + RepairReport rr = result.get(i); | |
| 6691 | + map.put("row", i + 1); | |
| 6692 | + map.put("lineId", rr.getLineName()); | |
| 6693 | + map.put("incode", rr.getIncode()); | |
| 6694 | + map.put("departureTime", rr.getDepartureTime()); | |
| 6695 | + map.put("reportUser", rr.getReportUser()); | |
| 6696 | + map.put("reportDateStr", rr.getReportDate()); | |
| 6697 | + map.put("repairType", rr.getRepairType()); | |
| 6698 | + map.put("reportStateStr", rr.getReportStateStr()); | |
| 6699 | + newList.add(map); | |
| 6700 | + } | |
| 6701 | + try { | |
| 6702 | + listI.add(newList.iterator()); | |
| 6703 | + String path = this.getClass().getResource("/").getPath() + "static/pages/forms/"; | |
| 6704 | + ee.excelReplace(listI, new Object[]{m}, path + "mould/repairReport.xls", | |
| 6705 | + path + "export/" + sdfSimple.format(sdfMonth.parse(date)) | |
| 6706 | + + "-" + lineName + "-维修上报记录.xls"); | |
| 6707 | + } catch (Exception e) { | |
| 6708 | + // TODO: handle exception | |
| 6709 | + e.printStackTrace(); | |
| 6710 | + } | |
| 6711 | + } | |
| 6712 | + | |
| 6713 | + return result; | |
| 6714 | + } | |
| 6715 | + | |
| 6716 | + @Override | |
| 6717 | + public Map<String, String> getLevelsByLines(List<String> lines) { | |
| 6718 | + Map<String, String> result = new HashMap<String, String>(), currSchDate = dayOfSchedule.getCurrSchDate(); | |
| 6719 | + for (String line : lines) { | |
| 6720 | + String level = BasicData.lineDate2Level.get(line + "_" + currSchDate.get(line)); | |
| 6721 | + result.put(line, level == null ? "" : level); | |
| 6722 | + } | |
| 6723 | + | |
| 6724 | + return result; | |
| 6725 | + } | |
| 6726 | + | |
| 6727 | + | |
| 6728 | + @Override | |
| 6729 | + public void destroy() throws Exception { | |
| 6730 | + // TODO Auto-generated method stub | |
| 6731 | + exec.shutdown(); | |
| 6732 | + } | |
| 6733 | + | |
| 6734 | + | |
| 6735 | + @Override | |
| 6736 | + public void afterPropertiesSet() throws Exception { | |
| 6737 | + // TODO Auto-generated method stub | |
| 6738 | + // 维修上报重发调度 | |
| 6739 | + exec.scheduleAtFixedRate(new Runnable() { | |
| 6740 | + | |
| 6741 | + @Override | |
| 6742 | + public void run() { | |
| 6743 | + // TODO Auto-generated method stub | |
| 6744 | + try { | |
| 6745 | + Iterator<RepairReport> it = queue.iterator(); | |
| 6746 | + while (it.hasNext()) { | |
| 6747 | + RepairReport rr = it.next(); | |
| 6748 | + repairReport(rr); | |
| 6749 | + if (rr.getReportState() == 1 || System.currentTimeMillis() - rr.getReportDate().getTime() > 86400000) queue.remove(rr); | |
| 6750 | + } | |
| 6751 | + } catch (Exception e) { | |
| 6752 | + logger.error("维修上报重发错误", e); | |
| 6753 | + } | |
| 6754 | + } | |
| 6755 | + }, 30, 30, TimeUnit.MINUTES); | |
| 6756 | + | |
| 6757 | + //// --- | |
| 6758 | + exec.scheduleWithFixedDelay(new Runnable() { | |
| 6759 | + @Override | |
| 6760 | + public void run() { | |
| 6761 | + Map<String, Object> res = new HashMap<>(); | |
| 6762 | + InputStream in = null; | |
| 6763 | + String url ="http://211.95.61.66:9008/modules/tSafedrivingCs/DSMBHforCLBH"; | |
| 6764 | + | |
| 6765 | + try { | |
| 6766 | + HttpURLConnection con = (HttpURLConnection)new URL(url.toString()).openConnection(); | |
| 6767 | + con.setDoInput(true); | |
| 6768 | + con.setRequestMethod("POST"); | |
| 6769 | + con.setConnectTimeout(5000); | |
| 6770 | + con.setReadTimeout(5000); | |
| 6771 | + con.setRequestProperty("keep-alive", "true"); | |
| 6772 | + con.setRequestProperty("accept", "*/*"); | |
| 6773 | + con.setRequestProperty("content-type", "application/x-www-form-urlencoded"); | |
| 6774 | + con.connect(); | |
| 6775 | + | |
| 6776 | + if (con.getResponseCode() == 200) { | |
| 6777 | + in = con.getInputStream(); | |
| 6778 | + ByteArrayOutputStream bout = new ByteArrayOutputStream(); | |
| 6779 | + IOUtils.copy(in, bout); | |
| 6780 | + DIRMAP = new ObjectMapper().readValue(bout.toByteArray(), Map.class); | |
| 6781 | + } | |
| 6782 | + logger.info("IP打电话接口查询完成"); | |
| 6783 | + } catch (MalformedURLException e) { | |
| 6784 | + // TODO Auto-generated catch block | |
| 6785 | + e.printStackTrace(); | |
| 6786 | + logger.error("IP打电话接口出错",e); | |
| 6787 | + } catch (IOException e) { | |
| 6788 | + // TODO Auto-generated catch block | |
| 6789 | + e.printStackTrace(); | |
| 6790 | + } | |
| 6791 | + | |
| 6792 | + } | |
| 6793 | + }, 0, 10, TimeUnit.MINUTES); | |
| 6794 | + } | |
| 6795 | +} | |
| 6796 | + | |
| 6797 | +class AccountMap implements Comparator<Map<String, Object>> { | |
| 6798 | + @Override | |
| 6799 | + public int compare(Map<String, Object> o1, Map<String, Object> o2) { | |
| 6800 | + // TODO Auto-generated method stub | |
| 6801 | + return o1.get("clZbh").toString().compareTo(o2.get("clZbh").toString()); | |
| 6802 | + } | |
| 6803 | +} | |
| 6804 | + | |
| 6805 | +class AccountMap2 implements Comparator<Map<String, Object>> { | |
| 6806 | + @Override | |
| 6807 | + public int compare(Map<String, Object> o1, Map<String, Object> o2) { | |
| 6808 | + // TODO Auto-generated method stub | |
| 6809 | + return o2.get("clZbh").toString().compareTo(o1.get("clZbh").toString()); | |
| 6810 | + } | |
| 6811 | +} | |
| 6812 | + | |
| 6813 | +class AccountXlbm implements Comparator<Map<String, Object>> { | |
| 6814 | + @Override | |
| 6815 | + public int compare(Map<String, Object> o1, Map<String, Object> o2) { | |
| 6816 | + // TODO Auto-generated method stub | |
| 6817 | +// PinyinHelper.convertToPinyinString(ppy.getName(), | |
| 6818 | +// "" , PinyinFormat.WITHOUT_TONE) | |
| 6819 | + return o1.get("xlNamePy").toString().compareTo( | |
| 6820 | + o2.get("xlNamePy").toString()); | |
| 6821 | + } | |
| 6822 | +} | |
| 6823 | + | |
| 6824 | +class compareLpFcsjType implements Comparator<ScheduleRealInfo> { | |
| 6825 | + @Override | |
| 6826 | + public int compare(ScheduleRealInfo o1, ScheduleRealInfo o2) { | |
| 6827 | + // TODO Auto-generated method stub | |
| 6828 | + return (o1.getLpName()+o1.getFcsjT() + o1.getRemark()).compareTo(o2.getLpName()+o2.getFcsjT() + o2.getRemark()); | |
| 6829 | + } | |
| 6830 | + | |
| 6831 | +} | |
| 6832 | + | |
| 6833 | +class compareDirLpFcsjType implements Comparator<ScheduleRealInfo> { | |
| 6834 | + @Override | |
| 6835 | + public int compare(ScheduleRealInfo o1, ScheduleRealInfo o2) { | |
| 6836 | + // TODO Auto-generated method stub | |
| 6837 | + return (o1.getXlDir()+o1.getFcsjT() + o1.getRemark()+o1.getLpName()).compareTo(o2.getXlDir()+o2.getFcsjT() + o2.getRemark()+o2.getLpName()); | |
| 6838 | + } | |
| 6839 | + | |
| 6840 | +} | |
| 6841 | +class compareFcsjType implements Comparator<ScheduleRealInfo> { | |
| 6842 | + @Override | |
| 6843 | + public int compare(ScheduleRealInfo o1, ScheduleRealInfo o2) { | |
| 6844 | + // TODO Auto-generated method stub | |
| 6845 | + return (o1.getFcsjT() + o1.getRemark()).compareTo(o2.getFcsjT() + o2.getRemark()); | |
| 6846 | + } | |
| 6847 | + | |
| 6848 | +} | ... | ... |
src/main/java/com/bsth/service/schedule/EmployeeService.java
| 1 | 1 | package com.bsth.service.schedule; |
| 2 | 2 | |
| 3 | +import com.bsth.data.pinyin.PersionPinYin; | |
| 3 | 4 | import com.bsth.entity.Personnel; |
| 4 | 5 | import com.bsth.service.schedule.exception.ScheduleException; |
| 5 | 6 | |
| 7 | +import java.util.List; | |
| 8 | + | |
| 6 | 9 | /** |
| 7 | 10 | * Created by xu on 16/12/15. |
| 8 | 11 | */ |
| 9 | 12 | public interface EmployeeService extends BService<Personnel, Integer> { |
| 10 | 13 | public void validate_gh(Personnel personnel) throws ScheduleException; |
| 14 | + public List<PersionPinYin> findAll_PY(); | |
| 11 | 15 | } | ... | ... |
src/main/java/com/bsth/service/schedule/impl/EmployeeServiceImpl.java
| 1 | 1 | package com.bsth.service.schedule.impl; |
| 2 | 2 | |
| 3 | +import com.bsth.data.pinyin.PersionPinYin; | |
| 3 | 4 | import com.bsth.entity.Personnel; |
| 4 | 5 | import com.bsth.service.schedule.EmployeeService; |
| 5 | 6 | import com.bsth.service.schedule.exception.ScheduleException; |
| 6 | 7 | import com.bsth.service.schedule.utils.DataToolsFile; |
| 7 | 8 | import com.bsth.service.schedule.utils.DataToolsService; |
| 9 | +import com.github.stuxuhai.jpinyin.PinyinException; | |
| 10 | +import com.github.stuxuhai.jpinyin.PinyinFormat; | |
| 11 | +import com.github.stuxuhai.jpinyin.PinyinHelper; | |
| 8 | 12 | import org.springframework.beans.factory.annotation.Autowired; |
| 9 | 13 | import org.springframework.beans.factory.annotation.Qualifier; |
| 10 | 14 | import org.springframework.stereotype.Service; |
| ... | ... | @@ -12,7 +16,9 @@ import org.springframework.transaction.annotation.Transactional; |
| 12 | 16 | import org.springframework.util.CollectionUtils; |
| 13 | 17 | |
| 14 | 18 | import java.io.File; |
| 19 | +import java.util.ArrayList; | |
| 15 | 20 | import java.util.HashMap; |
| 21 | +import java.util.List; | |
| 16 | 22 | import java.util.Map; |
| 17 | 23 | |
| 18 | 24 | /** |
| ... | ... | @@ -53,4 +59,34 @@ public class EmployeeServiceImpl extends BServiceImpl<Personnel, Integer> implem |
| 53 | 59 | throw new ScheduleException("相同公司工号重复"); |
| 54 | 60 | } |
| 55 | 61 | } |
| 62 | + | |
| 63 | + @Override | |
| 64 | + public List<PersionPinYin> findAll_PY() { | |
| 65 | + // 1、查找未作废的人员基础信息 | |
| 66 | + Map<String, Object> param = new HashMap<>(); | |
| 67 | + param.put("destroy_eq", 0); | |
| 68 | + List<Personnel> personnelList = this.list(param); | |
| 69 | + | |
| 70 | + List<PersionPinYin> persionPinYinList = new ArrayList<>(); | |
| 71 | + for (Personnel p : personnelList) { | |
| 72 | + PersionPinYin ppy = new PersionPinYin(); | |
| 73 | + ppy.setId(p.getId()); | |
| 74 | + ppy.setCompanyId(p.getCompanyCode()); | |
| 75 | + ppy.setFgsCompanyId(p.getBrancheCompanyCode()); | |
| 76 | + ppy.setName(p.getPersonnelName()); | |
| 77 | + ppy.setWorkId(p.getJobCode()); | |
| 78 | + try { | |
| 79 | + ppy.setFullChars(PinyinHelper.convertToPinyinString(ppy.getName(), "" , PinyinFormat.WITHOUT_TONE)); | |
| 80 | + ppy.setCamelChars(PinyinHelper.getShortPinyin(ppy.getName())); | |
| 81 | + }catch (PinyinException pye) { | |
| 82 | + System.out.println("拼音转换出现异常," + ppy.getName()); | |
| 83 | + pye.printStackTrace(); | |
| 84 | + continue; | |
| 85 | + } | |
| 86 | + persionPinYinList.add(ppy); | |
| 87 | + | |
| 88 | + } | |
| 89 | + | |
| 90 | + return persionPinYinList; | |
| 91 | + } | |
| 56 | 92 | } | ... | ... |
src/main/java/com/bsth/util/PrivilegeUtils.java
| ... | ... | @@ -21,7 +21,7 @@ public class PrivilegeUtils { |
| 21 | 21 | if (specialRoles != null) { |
| 22 | 22 | for (Role role : roles) { |
| 23 | 23 | if (specialRoles.contains(String.format(",%s,", role.getCodeName()))) { |
| 24 | - days = 6; | |
| 24 | + days = Integer.parseInt(SystemParamCache.getSpecialDays()); | |
| 25 | 25 | } |
| 26 | 26 | } |
| 27 | 27 | } | ... | ... |
src/main/resources/datatools/config-test.properties
| ... | ... | @@ -15,13 +15,13 @@ datatools.kvars_dbdname=control |
| 15 | 15 | |
| 16 | 16 | # 3、上传数据配置信息 |
| 17 | 17 | # 上传文件目录配置(根据不同的环境需要修正) |
| 18 | -datatools.fileupload_dir=/home/bsth_control_u_d_files | |
| 18 | +datatools.fileupload_dir=/Users/xu/resource/project_code/runtime_temp/bsth_control_u_d_files | |
| 19 | 19 | # ktr转换文件,中配置的错误输出目录(根据不同的环境需要修正) |
| 20 | -datatools.trans_errordir=/home/bsth_control_u_d_files/erroroutput | |
| 20 | +datatools.trans_errordir=/Users/xu/resource/project_code/runtime_temp/bsth_control_u_d_files/erroroutput | |
| 21 | 21 | # 临时输出文件目录 |
| 22 | -datatools.trans_tempdir=/home/bsth_control_u_d_files/temp | |
| 22 | +datatools.trans_tempdir=/Users/xu/resource/project_code/runtime_temp/bsth_control_u_d_files/temp | |
| 23 | 23 | # 模版文件目录 |
| 24 | -datatools.trans_templatedir=/home/bsth_control_u_d_files/template | |
| 24 | +datatools.trans_templatedir=/Users/xu/resource/project_code/runtime_temp/bsth_control_u_d_files/template | |
| 25 | 25 | |
| 26 | 26 | ##---------------------------- 导入数据ktr ----------------------------## |
| 27 | 27 | # 车辆信息导入ktr转换 |
| ... | ... | @@ -57,7 +57,7 @@ datatools.schedulerule_datainputktr=/datatools/ktrs/scheduleRuleDataInput.ktr |
| 57 | 57 | |
| 58 | 58 | # 4、数据导出配置信息 |
| 59 | 59 | # 导出数据文件目录配置(根据不同的环境需要修正) |
| 60 | -datatools.fileoutput_dir=/home/bsth_control_u_d_files | |
| 60 | +datatools.fileoutput_dir=/Users/xu/resource/project_code/runtime_temp/bsth_control_u_d_files | |
| 61 | 61 | |
| 62 | 62 | ##---------------------------- 导出数据ktr -----------------------------## |
| 63 | 63 | # 车辆信息导出ktr转换 | ... | ... |
src/main/resources/datatools/ktrs/employeesConfigDataInput.ktr
| ... | ... | @@ -412,6 +412,33 @@ |
| 412 | 412 | </attributes> |
| 413 | 413 | </connection> |
| 414 | 414 | <connection> |
| 415 | + <name>test_control_local</name> | |
| 416 | + <server>localhost</server> | |
| 417 | + <type>MYSQL</type> | |
| 418 | + <access>Native</access> | |
| 419 | + <database>test_control</database> | |
| 420 | + <port>3306</port> | |
| 421 | + <username>root</username> | |
| 422 | + <password>Encrypted </password> | |
| 423 | + <servername/> | |
| 424 | + <data_tablespace/> | |
| 425 | + <index_tablespace/> | |
| 426 | + <attributes> | |
| 427 | + <attribute><code>EXTRA_OPTION_MYSQL.defaultFetchSize</code><attribute>500</attribute></attribute> | |
| 428 | + <attribute><code>EXTRA_OPTION_MYSQL.useCursorFetch</code><attribute>true</attribute></attribute> | |
| 429 | + <attribute><code>FORCE_IDENTIFIERS_TO_LOWERCASE</code><attribute>N</attribute></attribute> | |
| 430 | + <attribute><code>FORCE_IDENTIFIERS_TO_UPPERCASE</code><attribute>N</attribute></attribute> | |
| 431 | + <attribute><code>IS_CLUSTERED</code><attribute>N</attribute></attribute> | |
| 432 | + <attribute><code>PORT_NUMBER</code><attribute>3306</attribute></attribute> | |
| 433 | + <attribute><code>PRESERVE_RESERVED_WORD_CASE</code><attribute>N</attribute></attribute> | |
| 434 | + <attribute><code>QUOTE_ALL_FIELDS</code><attribute>N</attribute></attribute> | |
| 435 | + <attribute><code>STREAM_RESULTS</code><attribute>Y</attribute></attribute> | |
| 436 | + <attribute><code>SUPPORTS_BOOLEAN_DATA_TYPE</code><attribute>Y</attribute></attribute> | |
| 437 | + <attribute><code>SUPPORTS_TIMESTAMP_DATA_TYPE</code><attribute>Y</attribute></attribute> | |
| 438 | + <attribute><code>USE_POOLING</code><attribute>N</attribute></attribute> | |
| 439 | + </attributes> | |
| 440 | + </connection> | |
| 441 | + <connection> | |
| 415 | 442 | <name>test_control(本机)</name> |
| 416 | 443 | <server>127.0.0.1</server> |
| 417 | 444 | <type>MYSQL</type> |
| ... | ... | @@ -424,6 +451,62 @@ |
| 424 | 451 | <data_tablespace/> |
| 425 | 452 | <index_tablespace/> |
| 426 | 453 | <attributes> |
| 454 | + <attribute><code>EXTRA_OPTION_MYSQL.characterEncoding</code><attribute>utf8</attribute></attribute> | |
| 455 | + <attribute><code>EXTRA_OPTION_MYSQL.defaultFetchSize</code><attribute>500</attribute></attribute> | |
| 456 | + <attribute><code>EXTRA_OPTION_MYSQL.useCursorFetch</code><attribute>true</attribute></attribute> | |
| 457 | + <attribute><code>FORCE_IDENTIFIERS_TO_LOWERCASE</code><attribute>N</attribute></attribute> | |
| 458 | + <attribute><code>FORCE_IDENTIFIERS_TO_UPPERCASE</code><attribute>N</attribute></attribute> | |
| 459 | + <attribute><code>IS_CLUSTERED</code><attribute>N</attribute></attribute> | |
| 460 | + <attribute><code>PORT_NUMBER</code><attribute>3306</attribute></attribute> | |
| 461 | + <attribute><code>PRESERVE_RESERVED_WORD_CASE</code><attribute>N</attribute></attribute> | |
| 462 | + <attribute><code>QUOTE_ALL_FIELDS</code><attribute>N</attribute></attribute> | |
| 463 | + <attribute><code>STREAM_RESULTS</code><attribute>Y</attribute></attribute> | |
| 464 | + <attribute><code>SUPPORTS_BOOLEAN_DATA_TYPE</code><attribute>Y</attribute></attribute> | |
| 465 | + <attribute><code>SUPPORTS_TIMESTAMP_DATA_TYPE</code><attribute>Y</attribute></attribute> | |
| 466 | + <attribute><code>USE_POOLING</code><attribute>N</attribute></attribute> | |
| 467 | + </attributes> | |
| 468 | + </connection> | |
| 469 | + <connection> | |
| 470 | + <name>wzk_mysql_jndi</name> | |
| 471 | + <server/> | |
| 472 | + <type>MYSQL</type> | |
| 473 | + <access>JNDI</access> | |
| 474 | + <database>wzk_mysql</database> | |
| 475 | + <port>1521</port> | |
| 476 | + <username/> | |
| 477 | + <password>Encrypted </password> | |
| 478 | + <servername/> | |
| 479 | + <data_tablespace/> | |
| 480 | + <index_tablespace/> | |
| 481 | + <attributes> | |
| 482 | + <attribute><code>EXTRA_OPTION_MYSQL.defaultFetchSize</code><attribute>500</attribute></attribute> | |
| 483 | + <attribute><code>EXTRA_OPTION_MYSQL.useCursorFetch</code><attribute>true</attribute></attribute> | |
| 484 | + <attribute><code>FORCE_IDENTIFIERS_TO_LOWERCASE</code><attribute>N</attribute></attribute> | |
| 485 | + <attribute><code>FORCE_IDENTIFIERS_TO_UPPERCASE</code><attribute>N</attribute></attribute> | |
| 486 | + <attribute><code>IS_CLUSTERED</code><attribute>N</attribute></attribute> | |
| 487 | + <attribute><code>PORT_NUMBER</code><attribute>1521</attribute></attribute> | |
| 488 | + <attribute><code>PRESERVE_RESERVED_WORD_CASE</code><attribute>N</attribute></attribute> | |
| 489 | + <attribute><code>QUOTE_ALL_FIELDS</code><attribute>N</attribute></attribute> | |
| 490 | + <attribute><code>STREAM_RESULTS</code><attribute>Y</attribute></attribute> | |
| 491 | + <attribute><code>SUPPORTS_BOOLEAN_DATA_TYPE</code><attribute>Y</attribute></attribute> | |
| 492 | + <attribute><code>SUPPORTS_TIMESTAMP_DATA_TYPE</code><attribute>Y</attribute></attribute> | |
| 493 | + <attribute><code>USE_POOLING</code><attribute>N</attribute></attribute> | |
| 494 | + </attributes> | |
| 495 | + </connection> | |
| 496 | + <connection> | |
| 497 | + <name>wzk(本机)</name> | |
| 498 | + <server>localhost</server> | |
| 499 | + <type>MYSQL</type> | |
| 500 | + <access>Native</access> | |
| 501 | + <database>pdgj_wzk_sys</database> | |
| 502 | + <port>3306</port> | |
| 503 | + <username>root</username> | |
| 504 | + <password>Encrypted </password> | |
| 505 | + <servername/> | |
| 506 | + <data_tablespace/> | |
| 507 | + <index_tablespace/> | |
| 508 | + <attributes> | |
| 509 | + <attribute><code>EXTRA_OPTION_MYSQL.characterEncoding</code><attribute>utf8</attribute></attribute> | |
| 427 | 510 | <attribute><code>EXTRA_OPTION_MYSQL.defaultFetchSize</code><attribute>500</attribute></attribute> |
| 428 | 511 | <attribute><code>EXTRA_OPTION_MYSQL.useCursorFetch</code><attribute>true</attribute></attribute> |
| 429 | 512 | <attribute><code>FORCE_IDENTIFIERS_TO_LOWERCASE</code><attribute>N</attribute></attribute> |
| ... | ... | @@ -591,7 +674,7 @@ |
| 591 | 674 | </connection> |
| 592 | 675 | <connection> |
| 593 | 676 | <name>公司ygjw</name> |
| 594 | - <server>192.168.168.1</server> | |
| 677 | + <server>192.168.168.178</server> | |
| 595 | 678 | <type>ORACLE</type> |
| 596 | 679 | <access>Native</access> |
| 597 | 680 | <database>orcl</database> |
| ... | ... | @@ -613,16 +696,134 @@ |
| 613 | 696 | <attribute><code>USE_POOLING</code><attribute>N</attribute></attribute> |
| 614 | 697 | </attributes> |
| 615 | 698 | </connection> |
| 699 | + <connection> | |
| 700 | + <name>公司机务_pdgj</name> | |
| 701 | + <server>192.168.168.178</server> | |
| 702 | + <type>ORACLE</type> | |
| 703 | + <access>Native</access> | |
| 704 | + <database>orcl</database> | |
| 705 | + <port>1521</port> | |
| 706 | + <username>pdgj</username> | |
| 707 | + <password>Encrypted 2be98afc86aa7f2e4cb79ce10ce96a8d0</password> | |
| 708 | + <servername/> | |
| 709 | + <data_tablespace/> | |
| 710 | + <index_tablespace/> | |
| 711 | + <attributes> | |
| 712 | + <attribute><code>FORCE_IDENTIFIERS_TO_LOWERCASE</code><attribute>N</attribute></attribute> | |
| 713 | + <attribute><code>FORCE_IDENTIFIERS_TO_UPPERCASE</code><attribute>N</attribute></attribute> | |
| 714 | + <attribute><code>IS_CLUSTERED</code><attribute>N</attribute></attribute> | |
| 715 | + <attribute><code>PORT_NUMBER</code><attribute>1521</attribute></attribute> | |
| 716 | + <attribute><code>PRESERVE_RESERVED_WORD_CASE</code><attribute>N</attribute></attribute> | |
| 717 | + <attribute><code>QUOTE_ALL_FIELDS</code><attribute>N</attribute></attribute> | |
| 718 | + <attribute><code>SUPPORTS_BOOLEAN_DATA_TYPE</code><attribute>Y</attribute></attribute> | |
| 719 | + <attribute><code>SUPPORTS_TIMESTAMP_DATA_TYPE</code><attribute>Y</attribute></attribute> | |
| 720 | + <attribute><code>USE_POOLING</code><attribute>N</attribute></attribute> | |
| 721 | + </attributes> | |
| 722 | + </connection> | |
| 723 | + <connection> | |
| 724 | + <name>外网vpn临港机务oracle</name> | |
| 725 | + <server>10.10.150.114</server> | |
| 726 | + <type>ORACLE</type> | |
| 727 | + <access>Native</access> | |
| 728 | + <database>helowin</database> | |
| 729 | + <port>1521</port> | |
| 730 | + <username>lgjw</username> | |
| 731 | + <password>Encrypted 2be98afc86aa7f2e4cb79ce10d295a5cd</password> | |
| 732 | + <servername/> | |
| 733 | + <data_tablespace/> | |
| 734 | + <index_tablespace/> | |
| 735 | + <attributes> | |
| 736 | + <attribute><code>FORCE_IDENTIFIERS_TO_LOWERCASE</code><attribute>N</attribute></attribute> | |
| 737 | + <attribute><code>FORCE_IDENTIFIERS_TO_UPPERCASE</code><attribute>N</attribute></attribute> | |
| 738 | + <attribute><code>IS_CLUSTERED</code><attribute>N</attribute></attribute> | |
| 739 | + <attribute><code>PORT_NUMBER</code><attribute>1521</attribute></attribute> | |
| 740 | + <attribute><code>PRESERVE_RESERVED_WORD_CASE</code><attribute>N</attribute></attribute> | |
| 741 | + <attribute><code>QUOTE_ALL_FIELDS</code><attribute>N</attribute></attribute> | |
| 742 | + <attribute><code>SUPPORTS_BOOLEAN_DATA_TYPE</code><attribute>Y</attribute></attribute> | |
| 743 | + <attribute><code>SUPPORTS_TIMESTAMP_DATA_TYPE</code><attribute>Y</attribute></attribute> | |
| 744 | + <attribute><code>USE_POOLING</code><attribute>N</attribute></attribute> | |
| 745 | + </attributes> | |
| 746 | + </connection> | |
| 747 | + <connection> | |
| 748 | + <name>外网南汇机务oracle</name> | |
| 749 | + <server>58.247.254.118</server> | |
| 750 | + <type>ORACLE</type> | |
| 751 | + <access>Native</access> | |
| 752 | + <database>orcl</database> | |
| 753 | + <port>15211</port> | |
| 754 | + <username>nhjw</username> | |
| 755 | + <password>Encrypted 2be98afc86aa7f2e4cb79ce10d09aa5cd</password> | |
| 756 | + <servername/> | |
| 757 | + <data_tablespace/> | |
| 758 | + <index_tablespace/> | |
| 759 | + <attributes> | |
| 760 | + <attribute><code>FORCE_IDENTIFIERS_TO_LOWERCASE</code><attribute>N</attribute></attribute> | |
| 761 | + <attribute><code>FORCE_IDENTIFIERS_TO_UPPERCASE</code><attribute>N</attribute></attribute> | |
| 762 | + <attribute><code>IS_CLUSTERED</code><attribute>N</attribute></attribute> | |
| 763 | + <attribute><code>PORT_NUMBER</code><attribute>15211</attribute></attribute> | |
| 764 | + <attribute><code>PRESERVE_RESERVED_WORD_CASE</code><attribute>N</attribute></attribute> | |
| 765 | + <attribute><code>QUOTE_ALL_FIELDS</code><attribute>N</attribute></attribute> | |
| 766 | + <attribute><code>SUPPORTS_BOOLEAN_DATA_TYPE</code><attribute>Y</attribute></attribute> | |
| 767 | + <attribute><code>SUPPORTS_TIMESTAMP_DATA_TYPE</code><attribute>Y</attribute></attribute> | |
| 768 | + <attribute><code>USE_POOLING</code><attribute>N</attribute></attribute> | |
| 769 | + </attributes> | |
| 770 | + </connection> | |
| 771 | + <connection> | |
| 772 | + <name>外网杨高机务oracle</name> | |
| 773 | + <server>58.247.254.118</server> | |
| 774 | + <type>ORACLE</type> | |
| 775 | + <access>Native</access> | |
| 776 | + <database>orcl</database> | |
| 777 | + <port>15211</port> | |
| 778 | + <username>ygjw</username> | |
| 779 | + <password>Encrypted 2be98afc86aa7f2e4cb79ce10c795a5cd</password> | |
| 780 | + <servername/> | |
| 781 | + <data_tablespace/> | |
| 782 | + <index_tablespace/> | |
| 783 | + <attributes> | |
| 784 | + <attribute><code>FORCE_IDENTIFIERS_TO_LOWERCASE</code><attribute>N</attribute></attribute> | |
| 785 | + <attribute><code>FORCE_IDENTIFIERS_TO_UPPERCASE</code><attribute>N</attribute></attribute> | |
| 786 | + <attribute><code>IS_CLUSTERED</code><attribute>N</attribute></attribute> | |
| 787 | + <attribute><code>PORT_NUMBER</code><attribute>15211</attribute></attribute> | |
| 788 | + <attribute><code>PRESERVE_RESERVED_WORD_CASE</code><attribute>N</attribute></attribute> | |
| 789 | + <attribute><code>QUOTE_ALL_FIELDS</code><attribute>N</attribute></attribute> | |
| 790 | + <attribute><code>SUPPORTS_BOOLEAN_DATA_TYPE</code><attribute>Y</attribute></attribute> | |
| 791 | + <attribute><code>SUPPORTS_TIMESTAMP_DATA_TYPE</code><attribute>Y</attribute></attribute> | |
| 792 | + <attribute><code>USE_POOLING</code><attribute>N</attribute></attribute> | |
| 793 | + </attributes> | |
| 794 | + </connection> | |
| 795 | + <connection> | |
| 796 | + <name>外网金高机务oracle</name> | |
| 797 | + <server>58.247.254.118</server> | |
| 798 | + <type>ORACLE</type> | |
| 799 | + <access>Native</access> | |
| 800 | + <database>orcl</database> | |
| 801 | + <port>15211</port> | |
| 802 | + <username>jwgl</username> | |
| 803 | + <password>Encrypted 2be98afc86aa7f2e4cb79ce10d485a8d6</password> | |
| 804 | + <servername/> | |
| 805 | + <data_tablespace/> | |
| 806 | + <index_tablespace/> | |
| 807 | + <attributes> | |
| 808 | + <attribute><code>FORCE_IDENTIFIERS_TO_LOWERCASE</code><attribute>N</attribute></attribute> | |
| 809 | + <attribute><code>FORCE_IDENTIFIERS_TO_UPPERCASE</code><attribute>N</attribute></attribute> | |
| 810 | + <attribute><code>IS_CLUSTERED</code><attribute>N</attribute></attribute> | |
| 811 | + <attribute><code>PORT_NUMBER</code><attribute>15211</attribute></attribute> | |
| 812 | + <attribute><code>PRESERVE_RESERVED_WORD_CASE</code><attribute>N</attribute></attribute> | |
| 813 | + <attribute><code>QUOTE_ALL_FIELDS</code><attribute>N</attribute></attribute> | |
| 814 | + <attribute><code>SUPPORTS_BOOLEAN_DATA_TYPE</code><attribute>Y</attribute></attribute> | |
| 815 | + <attribute><code>SUPPORTS_TIMESTAMP_DATA_TYPE</code><attribute>Y</attribute></attribute> | |
| 816 | + <attribute><code>USE_POOLING</code><attribute>N</attribute></attribute> | |
| 817 | + </attributes> | |
| 818 | + </connection> | |
| 616 | 819 | <order> |
| 617 | 820 | <hop> <from>插入/更新bsth_c_s_ecinfo</from><to>错误输出</to><enabled>Y</enabled> </hop> |
| 618 | 821 | <hop> <from>获取变量</from><to>原始系统导出的Excel输入</to><enabled>Y</enabled> </hop> |
| 619 | 822 | <hop> <from>原始系统导出的Excel输入</from><to>启用被数据flag</to><enabled>Y</enabled> </hop> |
| 620 | 823 | <hop> <from>启用被数据flag</from><to>线路id查询</to><enabled>Y</enabled> </hop> |
| 621 | - <hop> <from>线路id查询</from><to>过滤线路id为空记录</to><enabled>Y</enabled> </hop> | |
| 622 | - <hop> <from>驾驶员id查找</from><to>过滤驾驶员id为空记录</to><enabled>Y</enabled> </hop> | |
| 623 | - <hop> <from>过滤驾驶员id为空记录</from><to>售票员id查找</to><enabled>Y</enabled> </hop> | |
| 824 | + <hop> <from>线路id查询</from><to>驾驶员id查找</to><enabled>Y</enabled> </hop> | |
| 825 | + <hop> <from>驾驶员id查找</from><to>售票员id查找</to><enabled>Y</enabled> </hop> | |
| 624 | 826 | <hop> <from>售票员id查找</from><to>插入/更新bsth_c_s_ecinfo</to><enabled>Y</enabled> </hop> |
| 625 | - <hop> <from>过滤线路id为空记录</from><to>驾驶员id查找</to><enabled>Y</enabled> </hop> | |
| 626 | 827 | </order> |
| 627 | 828 | <step> |
| 628 | 829 | <name>原始系统导出的Excel输入</name> |
| ... | ... | @@ -810,11 +1011,15 @@ |
| 810 | 1011 | </partitioning> |
| 811 | 1012 | <connection>control_jndi</connection> |
| 812 | 1013 | <rowlimit>1</rowlimit> |
| 813 | - <sql>select id as sid from bsth_c_personnel
where job_codeori = ? and personnel_name = ?</sql> | |
| 1014 | + <sql>select id as sid from bsth_c_personnel
where job_code = concat(?, '-', ?) and personnel_name = ? and destroy = 0</sql> | |
| 814 | 1015 | <outer_join>Y</outer_join> |
| 815 | 1016 | <replace_vars>N</replace_vars> |
| 816 | 1017 | <parameter> |
| 817 | 1018 | <field> |
| 1019 | + <name>company_code</name> | |
| 1020 | + <type>String</type> | |
| 1021 | + </field> | |
| 1022 | + <field> | |
| 818 | 1023 | <name>售票员工号</name> |
| 819 | 1024 | <type>String</type> |
| 820 | 1025 | </field> |
| ... | ... | @@ -825,8 +1030,8 @@ |
| 825 | 1030 | </parameter> |
| 826 | 1031 | <cluster_schema/> |
| 827 | 1032 | <remotesteps> <input> </input> <output> </output> </remotesteps> <GUI> |
| 828 | - <xloc>830</xloc> | |
| 829 | - <yloc>45</yloc> | |
| 1033 | + <xloc>595</xloc> | |
| 1034 | + <yloc>55</yloc> | |
| 830 | 1035 | <draw>Y</draw> |
| 831 | 1036 | </GUI> |
| 832 | 1037 | </step> |
| ... | ... | @@ -894,8 +1099,8 @@ |
| 894 | 1099 | </lookup> |
| 895 | 1100 | <cluster_schema/> |
| 896 | 1101 | <remotesteps> <input> </input> <output> </output> </remotesteps> <GUI> |
| 897 | - <xloc>833</xloc> | |
| 898 | - <yloc>198</yloc> | |
| 1102 | + <xloc>597</xloc> | |
| 1103 | + <yloc>162</yloc> | |
| 899 | 1104 | <draw>Y</draw> |
| 900 | 1105 | </GUI> |
| 901 | 1106 | </step> |
| ... | ... | @@ -939,11 +1144,17 @@ |
| 939 | 1144 | <default/> |
| 940 | 1145 | <type>Integer</type> |
| 941 | 1146 | </value> |
| 1147 | + <value> | |
| 1148 | + <name>company</name> | |
| 1149 | + <rename>company_code</rename> | |
| 1150 | + <default/> | |
| 1151 | + <type>String</type> | |
| 1152 | + </value> | |
| 942 | 1153 | </lookup> |
| 943 | 1154 | <cluster_schema/> |
| 944 | 1155 | <remotesteps> <input> </input> <output> </output> </remotesteps> <GUI> |
| 945 | - <xloc>397</xloc> | |
| 946 | - <yloc>144</yloc> | |
| 1156 | + <xloc>373</xloc> | |
| 1157 | + <yloc>53</yloc> | |
| 947 | 1158 | <draw>Y</draw> |
| 948 | 1159 | </GUI> |
| 949 | 1160 | </step> |
| ... | ... | @@ -994,64 +1205,6 @@ |
| 994 | 1205 | </step> |
| 995 | 1206 | |
| 996 | 1207 | <step> |
| 997 | - <name>过滤线路id为空记录</name> | |
| 998 | - <type>FilterRows</type> | |
| 999 | - <description/> | |
| 1000 | - <distribute>Y</distribute> | |
| 1001 | - <custom_distribution/> | |
| 1002 | - <copies>1</copies> | |
| 1003 | - <partitioning> | |
| 1004 | - <method>none</method> | |
| 1005 | - <schema_name/> | |
| 1006 | - </partitioning> | |
| 1007 | -<send_true_to/> | |
| 1008 | -<send_false_to/> | |
| 1009 | - <compare> | |
| 1010 | -<condition> | |
| 1011 | - <negated>N</negated> | |
| 1012 | - <leftvalue>xlid</leftvalue> | |
| 1013 | - <function>IS NOT NULL</function> | |
| 1014 | - <rightvalue/> | |
| 1015 | - </condition> | |
| 1016 | - </compare> | |
| 1017 | - <cluster_schema/> | |
| 1018 | - <remotesteps> <input> </input> <output> </output> </remotesteps> <GUI> | |
| 1019 | - <xloc>395</xloc> | |
| 1020 | - <yloc>49</yloc> | |
| 1021 | - <draw>Y</draw> | |
| 1022 | - </GUI> | |
| 1023 | - </step> | |
| 1024 | - | |
| 1025 | - <step> | |
| 1026 | - <name>过滤驾驶员id为空记录</name> | |
| 1027 | - <type>FilterRows</type> | |
| 1028 | - <description/> | |
| 1029 | - <distribute>Y</distribute> | |
| 1030 | - <custom_distribution/> | |
| 1031 | - <copies>1</copies> | |
| 1032 | - <partitioning> | |
| 1033 | - <method>none</method> | |
| 1034 | - <schema_name/> | |
| 1035 | - </partitioning> | |
| 1036 | -<send_true_to>售票员id查找</send_true_to> | |
| 1037 | -<send_false_to/> | |
| 1038 | - <compare> | |
| 1039 | -<condition> | |
| 1040 | - <negated>N</negated> | |
| 1041 | - <leftvalue>jid</leftvalue> | |
| 1042 | - <function>IS NOT NULL</function> | |
| 1043 | - <rightvalue/> | |
| 1044 | - </condition> | |
| 1045 | - </compare> | |
| 1046 | - <cluster_schema/> | |
| 1047 | - <remotesteps> <input> </input> <output> </output> </remotesteps> <GUI> | |
| 1048 | - <xloc>604</xloc> | |
| 1049 | - <yloc>46</yloc> | |
| 1050 | - <draw>Y</draw> | |
| 1051 | - </GUI> | |
| 1052 | - </step> | |
| 1053 | - | |
| 1054 | - <step> | |
| 1055 | 1208 | <name>错误输出</name> |
| 1056 | 1209 | <type>ExcelOutput</type> |
| 1057 | 1210 | <description/> |
| ... | ... | @@ -1182,8 +1335,8 @@ |
| 1182 | 1335 | </custom> |
| 1183 | 1336 | <cluster_schema/> |
| 1184 | 1337 | <remotesteps> <input> </input> <output> </output> </remotesteps> <GUI> |
| 1185 | - <xloc>833</xloc> | |
| 1186 | - <yloc>321</yloc> | |
| 1338 | + <xloc>597</xloc> | |
| 1339 | + <yloc>285</yloc> | |
| 1187 | 1340 | <draw>Y</draw> |
| 1188 | 1341 | </GUI> |
| 1189 | 1342 | </step> |
| ... | ... | @@ -1201,11 +1354,15 @@ |
| 1201 | 1354 | </partitioning> |
| 1202 | 1355 | <connection>control_jndi</connection> |
| 1203 | 1356 | <rowlimit>1</rowlimit> |
| 1204 | - <sql>select id as jid from bsth_c_personnel
where job_codeori = ? and personnel_name = ?</sql> | |
| 1357 | + <sql>select id as jid from bsth_c_personnel
where job_code = concat(?, '-', ?) and personnel_name = ? and destroy = 0</sql> | |
| 1205 | 1358 | <outer_join>Y</outer_join> |
| 1206 | 1359 | <replace_vars>N</replace_vars> |
| 1207 | 1360 | <parameter> |
| 1208 | 1361 | <field> |
| 1362 | + <name>company_code</name> | |
| 1363 | + <type>String</type> | |
| 1364 | + </field> | |
| 1365 | + <field> | |
| 1209 | 1366 | <name>驾驶员工号</name> |
| 1210 | 1367 | <type>String</type> |
| 1211 | 1368 | </field> |
| ... | ... | @@ -1216,8 +1373,8 @@ |
| 1216 | 1373 | </parameter> |
| 1217 | 1374 | <cluster_schema/> |
| 1218 | 1375 | <remotesteps> <input> </input> <output> </output> </remotesteps> <GUI> |
| 1219 | - <xloc>603</xloc> | |
| 1220 | - <yloc>142</yloc> | |
| 1376 | + <xloc>488</xloc> | |
| 1377 | + <yloc>54</yloc> | |
| 1221 | 1378 | <draw>Y</draw> |
| 1222 | 1379 | </GUI> |
| 1223 | 1380 | </step> | ... | ... |
src/main/resources/static/pages/history_sch/edit/history_sch_maintain.html
| 1 | -<div class="uk-modal " id="history-sch-maintain-modal" style=""> | |
| 2 | - <div class="uk-modal-dialog" style="width: 95%;margin: 20px auto;"> | |
| 3 | - <a href="" class="uk-modal-close uk-close"></a> | |
| 4 | - <div class="uk-modal-header"> | |
| 5 | - <h2>历史路单维护</h2> | |
| 6 | - </div> | |
| 7 | - | |
| 8 | - <div style="padding-left: 12px;margin: 20px 0"> | |
| 9 | - <ul class="uk-subnav uk-subnav-pill h-s-time"> | |
| 10 | - </ul> | |
| 11 | - </div> | |
| 12 | - | |
| 13 | - <div class="uk-panel uk-panel-box uk-panel-box-primary"> | |
| 14 | - <form class="uk-form search-form"> | |
| 15 | - <fieldset data-uk-margin> | |
| 16 | - <span class="horizontal-field">公司</span> | |
| 17 | - <select name="companyId" style="width: 110px;"></select> | |
| 18 | - <span class="horizontal-field">分公司</span> | |
| 19 | - <select name="subCompanyId" style="width: 110px;"></select> | |
| 20 | - <span class="horizontal-field">线路</span> | |
| 21 | - <select name="xlBm_eq" style="width: 120px;"></select> | |
| 22 | - <span class="horizontal-field">路牌</span> | |
| 23 | - <select name="lpName_eq" style="width: 80px;"></select> | |
| 24 | - <span class="horizontal-field">上下行</span> | |
| 25 | - <select name="xlDir_eq"> | |
| 26 | - <option value="">全部</option> | |
| 27 | - <option value="0">上行</option> | |
| 28 | - <option value="1">下行</option> | |
| 29 | - </select> | |
| 30 | - | |
| 31 | - <span class="horizontal-field">车辆</span> | |
| 32 | - <div class="uk-autocomplete uk-form autocomplete-cars"> | |
| 33 | - <input type="text" name="clZbh_like" placeholder="自编号" style="width: 80px;"> | |
| 34 | - </div> | |
| 35 | - <span class="horizontal-field">驾驶员</span> | |
| 36 | - <div class="uk-autocomplete uk-form autocomplete-jsy"> | |
| 37 | - <input type="text" name="jGh_like" placeholder="驾驶员" style="width: 80px;"> | |
| 38 | - </div> | |
| 39 | - <button class="uk-button">检索</button> | |
| 40 | - <a class="add_lp_link" title="先点击检索后再临加路牌"><i class="uk-icon-plus"></i> 临加路牌</a> | |
| 41 | - <button id="reCountBtn" class="uk-button uk-button-danger uk-button-mini" style="position: absolute;right: 12px;bottom: 14px;"> | |
| 42 | - 重新统计</button> | |
| 43 | - </fieldset> | |
| 44 | - </form> | |
| 45 | - </div> | |
| 46 | - | |
| 47 | - <div class="ct_table_wrap ct_table_no_border history-sch-wrap" style="height: 510px;"> | |
| 48 | - <div class="ct_table history-sch-table"> | |
| 49 | - <div class="ct_table_head"> | |
| 50 | - <dl> | |
| 51 | - <dt>序号</dt> | |
| 52 | - <dt>路牌</dt> | |
| 53 | - <dt>车辆</dt> | |
| 54 | - <dt>驾驶员</dt> | |
| 55 | - <dt>起点</dt> | |
| 56 | - <dt>终点</dt> | |
| 57 | - <dt>计发</dt> | |
| 58 | - <dt>待发</dt> | |
| 59 | - <dt>实发</dt> | |
| 60 | - <dt>终点实达</dt> | |
| 61 | - <dt>备注</dt> | |
| 62 | - </dl> | |
| 63 | - </div> | |
| 64 | - <div class="ct_table_body"> | |
| 65 | - </div> | |
| 66 | - </div> | |
| 67 | - </div> | |
| 68 | - | |
| 69 | - <div class="load-panel"> | |
| 70 | - <i class="uk-icon-spinner uk-icon-spin"></i> | |
| 71 | - 正在加载数据 | |
| 72 | - </div> | |
| 73 | - </div> | |
| 74 | - | |
| 75 | - <script id="history-sch-maintain-table-temp" type="text/html"> | |
| 76 | - {{each list as sch i}} | |
| 77 | - <dl data-id="{{sch.id}}"> | |
| 78 | - <dd>{{i + 1}}</dd> | |
| 79 | - <dd>{{sch.lpName}}</dd> | |
| 80 | - <dd>{{sch.clZbh}}</dd> | |
| 81 | - <dd>{{sch.jGh}}/{{sch.jName}}</dd> | |
| 82 | - <dd title="{{sch.qdzName}}">{{sch.qdzName}}</dd> | |
| 83 | - <dd title="{{sch.zdzName}}">{{sch.zdzName}}</dd> | |
| 84 | - <dd>{{sch.fcsj}} | |
| 85 | - {{if sch.bcType == "out"}} | |
| 86 | - <span class="uk-badge uk-badge-success">出场</span> | |
| 87 | - {{else if sch.bcType == "in"}} | |
| 88 | - <span class="uk-badge uk-badge-warning">进场</span> | |
| 89 | - {{else if sch.bcType == "venting"}} | |
| 90 | - <span class="uk-badge uk-badge-danger">直放</span> | |
| 91 | - {{else if sch.bcType == "major"}} | |
| 92 | - <span class="uk-badge uk-badge-danger">放站</span> | |
| 93 | - {{else if sch.bcType == "region"}} | |
| 94 | - <span class="uk-badge sch_region">区间</span> | |
| 95 | - {{else if sch.bcType == "ldks"}} | |
| 96 | - <span class="uk-badge sch_ldks">空驶</span> | |
| 97 | - {{/if}} | |
| 98 | - {{if sch.sflj}} | |
| 99 | - <span class="uk-badge uk-badge-danger">临加</span> | |
| 100 | - {{/if}} | |
| 101 | - {{if sch.cTasks.length > 0}} | |
| 102 | - <span class="uk-badge uk-badge-notification">{{sch.cTasks.length}}</span> | |
| 103 | - {{/if}}</dd> | |
| 104 | - <dd> | |
| 105 | - {{sch.dfsj}} | |
| 106 | - {{if sch.status==-1}} | |
| 107 | - <span class="uk-badge uk-badge-danger">烂班</span> | |
| 108 | - {{/if}} | |
| 109 | - </dd> | |
| 110 | - <dd>{{sch.fcsjActual}}<span class="fcsj-diff">{{sch.fcsj_diff}}</span></dd> | |
| 111 | - <dd>{{sch.zdsjActual}}</dd> | |
| 112 | - <dd title="{{sch.remarks}}">{{sch.remarks}}</dd> | |
| 113 | - </dl> | |
| 114 | - {{/each}} | |
| 115 | - </script> | |
| 116 | - | |
| 117 | - <script> | |
| 118 | - (function () { | |
| 119 | - var modal = '#history-sch-maintain-modal'; | |
| 120 | - | |
| 121 | - //滚动条 | |
| 122 | - $('.history-sch-wrap', modal).perfectScrollbar({suppressScrollX: true}); | |
| 123 | - //history-sch-wrap | |
| 124 | - $(modal).on('init', function (e, data) { | |
| 125 | - e.stopPropagation(); | |
| 126 | - $.get('/realSchedule/dateArray', function (rs) { | |
| 127 | - //日期tab | |
| 128 | - var tsStr = ''; | |
| 129 | - $.each(rs, function (i) { | |
| 130 | - tsStr += '<li ' + (i == 0 ? 'class="uk-active"' : '') + '><a>' + this + '</a></li>'; | |
| 131 | - }); | |
| 132 | - | |
| 133 | - $('.h-s-time', modal).html(tsStr); | |
| 134 | - clearLpSelect(); | |
| 135 | - //reLoadLp=true; | |
| 136 | - //jsQuery(); | |
| 137 | - }); | |
| 138 | - }); | |
| 139 | - | |
| 140 | - $(modal).on('refresh', function (e, data) { | |
| 141 | - if(data){ | |
| 142 | - var lpName = data.lpName; | |
| 143 | - if(is_new_temp_lp(lpName)){ | |
| 144 | - $('[name=lpName_eq]', modal).append('<option value="'+lpName+'" selected>'+lpName+'</option>'); | |
| 145 | - } | |
| 146 | - } | |
| 147 | - jsQuery(); | |
| 148 | - }); | |
| 149 | - | |
| 150 | - $(modal).on('click', '.h-s-time li,.h-s-line li', function () { | |
| 151 | - if(loading) | |
| 152 | - return; | |
| 153 | - $(this).parent().find('li.uk-active').removeClass('uk-active'); | |
| 154 | - $(this).addClass('uk-active'); | |
| 155 | - clearLpSelect(); | |
| 156 | - //检索之前将滚动条置顶 | |
| 157 | - $('.history-sch-wrap', modal)[0].scrollTop = 0; | |
| 158 | - jsQuery(); | |
| 159 | - }); | |
| 160 | - | |
| 161 | - $('.search-form', modal).on('submit', function (e) { | |
| 162 | - try { | |
| 163 | - //检索之前将滚动条置顶 | |
| 164 | - $('.history-sch-wrap', modal)[0].scrollTop = 0; | |
| 165 | - jsQuery(); | |
| 166 | - }catch(e){ | |
| 167 | - console.log(e); | |
| 168 | - } | |
| 169 | - return false; | |
| 170 | - }); | |
| 171 | - | |
| 172 | - var reLoadLp; | |
| 173 | - var nbbmArray,jsyArray,lpArray,loading; | |
| 174 | - var schArray;//主键映射 | |
| 175 | - function jsQuery(cb) { | |
| 176 | - var data = $('.search-form', modal).serializeJSON(); | |
| 177 | - data.companyId=null; | |
| 178 | - data.subCompanyId=null; | |
| 179 | - var rq = $('.h-s-time li.uk-active', modal).text(); | |
| 180 | - data.scheduleDateStr_eq = rq; | |
| 181 | - if(!data.xlBm_eq) | |
| 182 | - return notify_err('请选择线路...'); | |
| 183 | - if(data.jGh_like.indexOf('/')!=-1){ | |
| 184 | - var jsy=data.jGh_like.split('/'); | |
| 185 | - data.jGh_like=jsy[0]; | |
| 186 | - data.jName_like=jsy[1]; | |
| 187 | - } | |
| 188 | - | |
| 189 | - $('.load-panel', modal).show(); | |
| 190 | - loading=true; | |
| 191 | - $.get('/realSchedule/all', data, function (rs) { | |
| 192 | - rs.sort(schedule_sort); | |
| 193 | - //可搜索的车辆自编号和驾驶员 | |
| 194 | - nbbmArray=[]; | |
| 195 | - jsyArray=[]; | |
| 196 | - lpArray = []; | |
| 197 | - schArray = {}; | |
| 198 | - $.each(rs, function () { | |
| 199 | - nbbmArray.push({value: this.clZbh}); | |
| 200 | - jsyArray.push({value: this.jGh+'/'+this.jName, | |
| 201 | - fullChars: pinyin.getFullChars(this.jName).toUpperCase(), | |
| 202 | - camelChars: pinyin.getCamelChars(this.jName)}); | |
| 203 | - lpArray.push({value: this.lpName}); | |
| 204 | - calc_sch_real_shift(this); | |
| 205 | - schArray[this.id] = this; | |
| 206 | - }); | |
| 207 | - | |
| 208 | - var tbodyStr = template('history-sch-maintain-table-temp', {list: rs}); | |
| 209 | - $('.history-sch-table .ct_table_body', modal).html(tbodyStr); | |
| 210 | - //value | |
| 211 | - nbbmArray=distinctByField(nbbmArray); | |
| 212 | - jsyArray=distinctByField(jsyArray); | |
| 213 | - lpArray=distinctByField(lpArray); | |
| 214 | - | |
| 215 | - if(reLoadLp){ | |
| 216 | - //路牌下拉框 | |
| 217 | - var ops = '<option value="">全部</option>'; | |
| 218 | - $.each(lpArray, function () { | |
| 219 | - ops += '<option value="'+this.value+'">'+this.value+'</option>'; | |
| 220 | - }); | |
| 221 | - $('[name=lpName_eq]', modal).html(ops); | |
| 222 | - reLoadLp = false; | |
| 223 | - } | |
| 224 | - | |
| 225 | - //lpName_eq | |
| 226 | - $('.load-panel', modal).hide(); | |
| 227 | - loading=false; | |
| 228 | - | |
| 229 | - //更新滚动条高度 | |
| 230 | - $('.history-sch-wrap', modal).perfectScrollbar('update'); | |
| 231 | - | |
| 232 | - cb && cb(); | |
| 233 | - | |
| 234 | - //初始化依赖数据 | |
| 235 | - gb_data_basic.initData(data.xlBm_eq); | |
| 236 | - }); | |
| 237 | - } | |
| 238 | - | |
| 239 | - function clearLpSelect() { | |
| 240 | - $('[name=lpName_eq]', modal).val('').html(''); | |
| 241 | - reLoadLp = true; | |
| 242 | - } | |
| 243 | - | |
| 244 | - //nbbm autocomplete | |
| 245 | - var carAutoCom=$('.autocomplete-cars', modal); | |
| 246 | - UIkit.autocomplete(carAutoCom, { | |
| 247 | - minLength: 1, | |
| 248 | - delay: 50, | |
| 249 | - source: function(release) { | |
| 250 | - var q = $('input', carAutoCom).val().toUpperCase() | |
| 251 | - ,rs = [], | |
| 252 | - count = 0; | |
| 253 | - $.each(nbbmArray, function () { | |
| 254 | - if(this.value.indexOf(q) != -1){ | |
| 255 | - rs.push(this); | |
| 256 | - count++; | |
| 257 | - } | |
| 258 | - if (count >= 15) | |
| 259 | - return false; | |
| 260 | - }); | |
| 261 | - release && release(rs); | |
| 262 | - } | |
| 263 | - }); | |
| 264 | - | |
| 265 | - //jsy autocomplete | |
| 266 | - var jsyAutoCom=$('.autocomplete-jsy', modal); | |
| 267 | - UIkit.autocomplete(jsyAutoCom, { | |
| 268 | - minLength: 1, | |
| 269 | - delay: 50, | |
| 270 | - source: function(release) { | |
| 271 | - var q = $('input', jsyAutoCom).val().toUpperCase() | |
| 272 | - ,rs = [], | |
| 273 | - count = 0; | |
| 274 | - | |
| 275 | - $.each(jsyArray, function() { | |
| 276 | - if (this.value.indexOf(q) != -1 || this.fullChars.indexOf(q) != -1 || this.camelChars.indexOf(q) != -1){ | |
| 277 | - rs.push(this); | |
| 278 | - count++; | |
| 279 | - } | |
| 280 | - | |
| 281 | - if (count >= 10) | |
| 282 | - return false; | |
| 283 | - }); | |
| 284 | - release && release(rs); | |
| 285 | - } | |
| 286 | - }); | |
| 287 | - | |
| 288 | - function schedule_sort(s1, s2) { | |
| 289 | - return (s1.realExecDate+s1.fcsj).localeCompare(s2.realExecDate+s2.fcsj); | |
| 290 | - } | |
| 291 | - | |
| 292 | - function distinctByField(arr, f){ | |
| 293 | - if(!f) | |
| 294 | - f = 'value'; | |
| 295 | - var rs = {}; | |
| 296 | - $.each(arr, function () { | |
| 297 | - rs[this[f]]=this; | |
| 298 | - }); | |
| 299 | - return gb_common.get_vals(rs); | |
| 300 | - } | |
| 301 | - | |
| 302 | - gb_ct_table.fixedHead($('.ct_table_wrap', modal)); | |
| 303 | - | |
| 304 | - //班次点击 | |
| 305 | - $(modal).on('click contextmenu', '.history-sch-table .ct_table_body dl', function() { | |
| 306 | - $(this).parent().find('.active').removeClass('active'); | |
| 307 | - $(this).addClass('active'); | |
| 308 | - }); | |
| 309 | - | |
| 310 | - var modal_opts = {center: false,bgclose: false, modal: false}; | |
| 311 | - var folder = '/real_control_v2/fragments/north/nav/history_sch'; | |
| 312 | - var callbackHandler={ | |
| 313 | - edit: function(id){ | |
| 314 | - open_modal(folder + '/editor.html', {id: id, parentModal: modal}, modal_opts); | |
| 315 | - }, | |
| 316 | - add: function (id) { | |
| 317 | - open_modal(folder + '/h_add_temp_sch.html', { | |
| 318 | - sch: schArray[id] | |
| 319 | - }, modal_opts); | |
| 320 | - }, | |
| 321 | - delete: function (id) { | |
| 322 | - var sch = schArray[id]; | |
| 323 | - if (!sch || !sch.sflj) | |
| 324 | - return notify_err('只能删除临加班次!'); | |
| 325 | - var str = '<h3>确定要删除临加班次<span style="color:red;margin: 0 5px;">' + sch.clZbh + '( ' + sch.dfsj + ' )</span>?</h3><h5 style="color: #6c6c6c;font-size: 12px;">班次删除后,调度指令会保留</h5>'; | |
| 326 | - alt_confirm(str, function () { | |
| 327 | - gb_common.$del('/realSchedule/history/' + sch.id, function (rs) { | |
| 328 | - if($('.history-sch-table .ct_table_body dl', modal).length == 1){ | |
| 329 | - $('[name=lpName_eq]', modal).val(''); | |
| 330 | - reLoadLp = true; | |
| 331 | - } | |
| 332 | - | |
| 333 | - jsQuery(); | |
| 334 | - }); | |
| 335 | - }, '确定删除'); | |
| 336 | - } | |
| 337 | - }; | |
| 338 | - | |
| 339 | - //计算实发时间差值 | |
| 340 | - var calc_sch_real_shift = function (sch) { | |
| 341 | - if (sch.fcsjActualTime) { | |
| 342 | - var diff = parseInt((sch.fcsjActualTime - sch.dfsjT) / 1000 / 60); | |
| 343 | - if (diff > 0) | |
| 344 | - sch.fcsj_diff = '( +' + diff + ' )'; | |
| 345 | - else if (diff < 0) | |
| 346 | - sch.fcsj_diff = '( ' + diff + ' )'; | |
| 347 | - else | |
| 348 | - sch.fcsj_diff = ''; | |
| 349 | - } | |
| 350 | - }; | |
| 351 | - | |
| 352 | - //右键菜单 | |
| 353 | - $.contextMenu({ | |
| 354 | - selector: modal+' .history-sch-table .ct_table_body dl', | |
| 355 | - className: 'schedule-ct-menu', | |
| 356 | - callback: function(key, options) { | |
| 357 | - var id = $('.context-menu-active', modal).data('id'); | |
| 358 | - callbackHandler[key] && callbackHandler[key](id); | |
| 359 | - }, | |
| 360 | - items: { | |
| 361 | - 'edit': { | |
| 362 | - name: '编辑' | |
| 363 | - }, | |
| 364 | - 'add': { | |
| 365 | - name: '新增临加班次' | |
| 366 | - }, | |
| 367 | - 'delete':{ | |
| 368 | - name: '删除' | |
| 369 | - } | |
| 370 | - } | |
| 371 | - }); | |
| 372 | - | |
| 373 | - //临加路牌 | |
| 374 | - $('.add_lp_link', modal).on('click', function () { | |
| 375 | - var index = 0, max; | |
| 376 | - $.each(lpArray, function (i, obj) { | |
| 377 | - var lp = obj.value; | |
| 378 | - if (lp.indexOf('临') != -1) { | |
| 379 | - max = lp.substr(lp.indexOf('临') + 1); | |
| 380 | - if (!isNaN(max)) | |
| 381 | - index = parseInt(max); | |
| 382 | - } | |
| 383 | - }); | |
| 384 | - | |
| 385 | - var lpName = '临' + (index + 1); | |
| 386 | - var lineSelect = $('[name=xlBm_eq]', modal); | |
| 387 | - var rq = $('.h-s-time li.uk-active', modal).text(), | |
| 388 | - lineName = lineSelect[0].options[lineSelect[0].selectedIndex].text,//$('.h-s-line li.uk-active', modal).text(), | |
| 389 | - lineCode = lineSelect.val(); | |
| 390 | - | |
| 391 | - var sch = { | |
| 392 | - scheduleDateStr: rq, | |
| 393 | - xlBm: lineCode, | |
| 394 | - xlName: lineName, | |
| 395 | - lpName: lpName | |
| 396 | - }; | |
| 397 | - | |
| 398 | - open_modal(folder + '/h_add_temp_sch.html', { | |
| 399 | - sch: sch | |
| 400 | - }, modal_opts); | |
| 401 | - }); | |
| 402 | - | |
| 403 | - /** | |
| 404 | - * 是否是临加路牌 | |
| 405 | - * @param lpName | |
| 406 | - */ | |
| 407 | - function is_new_temp_lp(lpName) { | |
| 408 | - if(lpName.indexOf('临') ==-1) | |
| 409 | - return false; | |
| 410 | - | |
| 411 | - for(var i=0,obj;obj=lpArray[i++];){ | |
| 412 | - if(obj.value==lpName) | |
| 413 | - return false; | |
| 414 | - } | |
| 415 | - | |
| 416 | - return true; | |
| 417 | - } | |
| 418 | - | |
| 419 | - | |
| 420 | - var f = $('.search-form', modal); | |
| 421 | - var ep = EventProxy.create('query_comps', 'query_lines', function () { | |
| 422 | - $('[name=companyId]', f).trigger('change');//公司change | |
| 423 | - }); | |
| 424 | - var comps; | |
| 425 | - //构建公司级联下拉框 | |
| 426 | - $.get('/user/companyData', function (rs) { | |
| 427 | - comps = rs; | |
| 428 | - var opts = ''; | |
| 429 | - for(var i=0,obj;obj=comps[i++];){ | |
| 430 | - opts += '<option value="'+obj.companyCode+'">'+obj.companyName+'</option>'; | |
| 431 | - } | |
| 432 | - $('[name=companyId]', f).html(opts); | |
| 433 | - ep.emit('query_comps'); | |
| 434 | - }); | |
| 435 | - var lineMapps; | |
| 436 | - //加载线路信息 | |
| 437 | - $.get('/line/all', {'destroy_eq': 0}, function (rs) { | |
| 438 | - rs.sort(function (a, b) { | |
| 439 | - return a.name.localeCompare(b.name); | |
| 440 | - }); | |
| 441 | - lineMapps={}; | |
| 442 | - var k; | |
| 443 | - $.each(rs, function () { | |
| 444 | - k = this.company+'_'+this.brancheCompany; | |
| 445 | - if(!lineMapps[k]) | |
| 446 | - lineMapps[k]=[]; | |
| 447 | - lineMapps[k].push(this); | |
| 448 | - }); | |
| 449 | - | |
| 450 | - ep.emit('query_lines'); | |
| 451 | - }); | |
| 452 | - | |
| 453 | - $('[name=companyId]', f).on('change', function () { | |
| 454 | - var code = $(this).val(), subs=[]; | |
| 455 | - $.each(comps, function () { | |
| 456 | - if(this.companyCode==code) | |
| 457 | - subs=this.children; | |
| 458 | - }); | |
| 459 | - | |
| 460 | - var opts=''; | |
| 461 | - $.each(subs, function () { | |
| 462 | - opts += '<option value="'+this.code+'">'+this.name+'</option>'; | |
| 463 | - }); | |
| 464 | - $('[name=subCompanyId]', f).html(opts).trigger('change'); | |
| 465 | - }); | |
| 466 | - | |
| 467 | - $('[name=subCompanyId]', f).on('change', function () { | |
| 468 | - var k = $('[name=companyId]', f).val() + '_' + $(this).val(); | |
| 469 | - var array = lineMapps[k]; | |
| 470 | - var opts = ''; | |
| 471 | - if(array){ | |
| 472 | - $.each(array, function () { | |
| 473 | - opts += '<option value="'+this.lineCode+'">'+this.name+'</option>'; | |
| 474 | - }); | |
| 475 | - } | |
| 476 | - $('[name=xlBm_eq]', f).html(opts); | |
| 477 | - }); | |
| 478 | - | |
| 479 | - $('[name=xlBm_eq]', f).on('change', clearLpSelect); | |
| 480 | - //clearLpSelect | |
| 481 | - | |
| 482 | - | |
| 483 | - /** | |
| 484 | - * 重新统计 | |
| 485 | - */ | |
| 486 | - $('#reCountBtn', modal).on('click', function () { | |
| 487 | - var lineSelect = $('[name=xlBm_eq]', modal); | |
| 488 | - var rq = $('.h-s-time li.uk-active', modal).text(), | |
| 489 | - lineName = lineSelect[0].options[lineSelect[0].selectedIndex].text,//$('.h-s-line li.uk-active', modal).text(), | |
| 490 | - lineCode = lineSelect.val(); | |
| 491 | - | |
| 492 | - var that = this; | |
| 493 | - alt_confirm('确定要重新统计 ' + lineName + '('+rq+')的数据吗?',function () { | |
| 494 | - $(that).attr('disabled', 'disabled'); | |
| 495 | - $(that).prepend('<i class="uk-icon-spinner uk-icon-spin"></i>'); | |
| 496 | - | |
| 497 | - | |
| 498 | - var reCountEp = EventProxy.create('ylbUpdate', 'calcWaybill', 'scheduleDetail', function () { | |
| 499 | - $('i.uk-icon-spin', that).remove(); | |
| 500 | - $(that).removeAttr('disabled'); | |
| 501 | - notify_succ('重新统计成功!'); | |
| 502 | - }); | |
| 503 | - | |
| 504 | - //统计路单 -娄高峰 | |
| 505 | - gb_common.$get('/calcWaybill/generateNew', {date:rq, line: lineCode}, function () { | |
| 506 | - reCountEp.emitLater('calcWaybill'); | |
| 507 | - }); | |
| 508 | - | |
| 509 | - //统计油 -廖磊 | |
| 510 | - gb_common.$post('/ylb/updateHistory', {date:rq, line: lineCode}, function () { | |
| 511 | - reCountEp.emitLater('ylbUpdate'); | |
| 512 | - }); | |
| 513 | - | |
| 514 | - //重新统计班次明细 | |
| 515 | - gb_common.$post('/sch/reCalc/scheduleDetail', {date:rq, line: lineCode}, function () { | |
| 516 | - reCountEp.emitLater('scheduleDetail'); | |
| 517 | - }); | |
| 518 | - | |
| 519 | - }, '我确定'); | |
| 520 | - }); | |
| 521 | - })(); | |
| 522 | - </script> | |
| 1 | +<div class="uk-modal " id="history-sch-maintain-modal" style=""> | |
| 2 | + <div class="uk-modal-dialog" style="width: 95%;margin: 20px auto;"> | |
| 3 | + <a href="" class="uk-modal-close uk-close"></a> | |
| 4 | + <div class="uk-modal-header"> | |
| 5 | + <h2>历史路单维护</h2> | |
| 6 | + </div> | |
| 7 | + | |
| 8 | + <div style="padding-left: 12px;margin: 20px 0"> | |
| 9 | + <ul class="uk-subnav uk-subnav-pill h-s-time"> | |
| 10 | + </ul> | |
| 11 | + </div> | |
| 12 | + | |
| 13 | + <div class="uk-panel uk-panel-box uk-panel-box-primary"> | |
| 14 | + <form class="uk-form search-form"> | |
| 15 | + <input type="hidden" name="lineId"/> | |
| 16 | + <fieldset data-uk-margin> | |
| 17 | + <span class="horizontal-field">公司</span> | |
| 18 | + <select name="companyId" style="width: 110px;"></select> | |
| 19 | + <span class="horizontal-field">分公司</span> | |
| 20 | + <select name="subCompanyId" style="width: 110px;"></select> | |
| 21 | + <span class="horizontal-field">线路</span> | |
| 22 | + <select name="xlBm_eq" style="width: 120px;"></select> | |
| 23 | + <span class="horizontal-field">路牌</span> | |
| 24 | + <select name="lpName_eq" style="width: 80px;"></select> | |
| 25 | + <span class="horizontal-field">上下行</span> | |
| 26 | + <select name="xlDir_eq"> | |
| 27 | + <option value="">全部</option> | |
| 28 | + <option value="0">上行</option> | |
| 29 | + <option value="1">下行</option> | |
| 30 | + </select> | |
| 31 | + | |
| 32 | + <span class="horizontal-field">车辆</span> | |
| 33 | + <div class="uk-autocomplete uk-form autocomplete-cars"> | |
| 34 | + <input type="text" name="clZbh_like" placeholder="自编号" style="width: 80px;"> | |
| 35 | + </div> | |
| 36 | + <span class="horizontal-field">驾驶员</span> | |
| 37 | + <div class="uk-autocomplete uk-form autocomplete-jsy"> | |
| 38 | + <input type="text" name="jGh_like" placeholder="驾驶员" style="width: 80px;"> | |
| 39 | + </div> | |
| 40 | + <button class="uk-button">检索</button> | |
| 41 | + <a class="add_lp_link" title="先点击检索后再临加路牌"><i class="uk-icon-plus"></i> 临加路牌</a> | |
| 42 | + <button id="reCountBtn" class="uk-button uk-button-danger uk-button-mini" style="position: absolute;right: 12px;bottom: 14px;"> | |
| 43 | + 重新统计</button> | |
| 44 | + </fieldset> | |
| 45 | + </form> | |
| 46 | + </div> | |
| 47 | + | |
| 48 | + <div class="ct_table_wrap ct_table_no_border history-sch-wrap" style="height: 510px;"> | |
| 49 | + <div class="ct_table history-sch-table"> | |
| 50 | + <div class="ct_table_head"> | |
| 51 | + <dl> | |
| 52 | + <dt>序号</dt> | |
| 53 | + <dt>路牌</dt> | |
| 54 | + <dt>车辆</dt> | |
| 55 | + <dt>驾驶员</dt> | |
| 56 | + <dt>起点</dt> | |
| 57 | + <dt>终点</dt> | |
| 58 | + <dt>计发</dt> | |
| 59 | + <dt>待发</dt> | |
| 60 | + <dt>实发</dt> | |
| 61 | + <dt>终点实达</dt> | |
| 62 | + <dt>备注</dt> | |
| 63 | + </dl> | |
| 64 | + </div> | |
| 65 | + <div class="ct_table_body"> | |
| 66 | + </div> | |
| 67 | + </div> | |
| 68 | + </div> | |
| 69 | + | |
| 70 | + <div class="load-panel"> | |
| 71 | + <i class="uk-icon-spinner uk-icon-spin"></i> | |
| 72 | + 正在加载数据 | |
| 73 | + </div> | |
| 74 | + </div> | |
| 75 | + | |
| 76 | + <script id="history-sch-maintain-table-temp" type="text/html"> | |
| 77 | + {{each list as sch i}} | |
| 78 | + <dl data-id="{{sch.id}}"> | |
| 79 | + <dd>{{i + 1}}</dd> | |
| 80 | + <dd>{{sch.lpName}}</dd> | |
| 81 | + <dd>{{sch.clZbh}}</dd> | |
| 82 | + <dd>{{sch.jGh}}/{{sch.jName}}</dd> | |
| 83 | + <dd title="{{sch.qdzName}}">{{sch.qdzName}}</dd> | |
| 84 | + <dd title="{{sch.zdzName}}">{{sch.zdzName}}</dd> | |
| 85 | + <dd>{{sch.fcsj}} | |
| 86 | + {{if sch.bcType == "out"}} | |
| 87 | + <span class="uk-badge uk-badge-success">出场</span> | |
| 88 | + {{else if sch.bcType == "in"}} | |
| 89 | + <span class="uk-badge uk-badge-warning">进场</span> | |
| 90 | + {{else if sch.bcType == "venting"}} | |
| 91 | + <span class="uk-badge uk-badge-danger">直放</span> | |
| 92 | + {{else if sch.bcType == "major"}} | |
| 93 | + <span class="uk-badge uk-badge-danger">放站</span> | |
| 94 | + {{else if sch.bcType == "region"}} | |
| 95 | + <span class="uk-badge sch_region">区间</span> | |
| 96 | + {{else if sch.bcType == "ldks"}} | |
| 97 | + <span class="uk-badge sch_ldks">空驶</span> | |
| 98 | + {{/if}} | |
| 99 | + {{if sch.sflj}} | |
| 100 | + <span class="uk-badge uk-badge-danger">临加</span> | |
| 101 | + {{/if}} | |
| 102 | + {{if sch.cTasks.length > 0}} | |
| 103 | + <span class="uk-badge uk-badge-notification">{{sch.cTasks.length}}</span> | |
| 104 | + {{/if}}</dd> | |
| 105 | + <dd> | |
| 106 | + {{sch.dfsj}} | |
| 107 | + {{if sch.status==-1}} | |
| 108 | + <span class="uk-badge uk-badge-danger">烂班</span> | |
| 109 | + {{/if}} | |
| 110 | + </dd> | |
| 111 | + <dd>{{sch.fcsjActual}}<span class="fcsj-diff">{{sch.fcsj_diff}}</span></dd> | |
| 112 | + <dd>{{sch.zdsjActual}}</dd> | |
| 113 | + <dd title="{{sch.remarks}}">{{sch.remarks}}</dd> | |
| 114 | + </dl> | |
| 115 | + {{/each}} | |
| 116 | + </script> | |
| 117 | + | |
| 118 | + <script> | |
| 119 | + (function () { | |
| 120 | + var modal = '#history-sch-maintain-modal'; | |
| 121 | + | |
| 122 | + //滚动条 | |
| 123 | + $('.history-sch-wrap', modal).perfectScrollbar({suppressScrollX: true}); | |
| 124 | + //history-sch-wrap | |
| 125 | + $(modal).on('init', function (e, data) { | |
| 126 | + e.stopPropagation(); | |
| 127 | + $.get('/realSchedule/dateArray', function (rs) { | |
| 128 | + //日期tab | |
| 129 | + var tsStr = ''; | |
| 130 | + $.each(rs, function (i) { | |
| 131 | + tsStr += '<li ' + (i == 0 ? 'class="uk-active"' : '') + '><a>' + this + '</a></li>'; | |
| 132 | + }); | |
| 133 | + | |
| 134 | + $('.h-s-time', modal).html(tsStr); | |
| 135 | + clearLpSelect(); | |
| 136 | + //reLoadLp=true; | |
| 137 | + //jsQuery(); | |
| 138 | + }); | |
| 139 | + }); | |
| 140 | + | |
| 141 | + $(modal).on('refresh', function (e, data) { | |
| 142 | + if(data){ | |
| 143 | + var lpName = data.lpName; | |
| 144 | + if(is_new_temp_lp(lpName)){ | |
| 145 | + $('[name=lpName_eq]', modal).append('<option value="'+lpName+'" selected>'+lpName+'</option>'); | |
| 146 | + } | |
| 147 | + } | |
| 148 | + jsQuery(); | |
| 149 | + }); | |
| 150 | + | |
| 151 | + $(modal).on('click', '.h-s-time li,.h-s-line li', function () { | |
| 152 | + if(loading) | |
| 153 | + return; | |
| 154 | + $(this).parent().find('li.uk-active').removeClass('uk-active'); | |
| 155 | + $(this).addClass('uk-active'); | |
| 156 | + clearLpSelect(); | |
| 157 | + //检索之前将滚动条置顶 | |
| 158 | + $('.history-sch-wrap', modal)[0].scrollTop = 0; | |
| 159 | + jsQuery(); | |
| 160 | + }); | |
| 161 | + | |
| 162 | + $('.search-form', modal).on('submit', function (e) { | |
| 163 | + try { | |
| 164 | + //检索之前将滚动条置顶 | |
| 165 | + $('.history-sch-wrap', modal)[0].scrollTop = 0; | |
| 166 | + jsQuery(); | |
| 167 | + }catch(e){ | |
| 168 | + console.log(e); | |
| 169 | + } | |
| 170 | + return false; | |
| 171 | + }); | |
| 172 | + | |
| 173 | + var reLoadLp; | |
| 174 | + var nbbmArray,jsyArray,lpArray,loading; | |
| 175 | + var schArray;//主键映射 | |
| 176 | + function jsQuery(cb) { | |
| 177 | + var data = $('.search-form', modal).serializeJSON(); | |
| 178 | + data.companyId=null; | |
| 179 | + data.subCompanyId=null; | |
| 180 | + var rq = $('.h-s-time li.uk-active', modal).text(); | |
| 181 | + data.scheduleDateStr_eq = rq; | |
| 182 | + if(!data.xlBm_eq) | |
| 183 | + return notify_err('请选择线路...'); | |
| 184 | + if(data.jGh_like.indexOf('/')!=-1){ | |
| 185 | + var jsy=data.jGh_like.split('/'); | |
| 186 | + data.jGh_like=jsy[0]; | |
| 187 | + data.jName_like=jsy[1]; | |
| 188 | + } | |
| 189 | + | |
| 190 | + $('.load-panel', modal).show(); | |
| 191 | + loading=true; | |
| 192 | + $.get('/realSchedule/all', data, function (rs) { | |
| 193 | + rs.sort(schedule_sort); | |
| 194 | + //可搜索的车辆自编号和驾驶员 | |
| 195 | + nbbmArray=[]; | |
| 196 | + jsyArray=[]; | |
| 197 | + lpArray = []; | |
| 198 | + schArray = {}; | |
| 199 | + $.each(rs, function () { | |
| 200 | + nbbmArray.push({value: this.clZbh}); | |
| 201 | + jsyArray.push({value: this.jGh+'/'+this.jName, | |
| 202 | + fullChars: pinyin.getFullChars(this.jName).toUpperCase(), | |
| 203 | + camelChars: pinyin.getCamelChars(this.jName)}); | |
| 204 | + lpArray.push({value: this.lpName}); | |
| 205 | + calc_sch_real_shift(this); | |
| 206 | + schArray[this.id] = this; | |
| 207 | + }); | |
| 208 | + | |
| 209 | + var tbodyStr = template('history-sch-maintain-table-temp', {list: rs}); | |
| 210 | + $('.history-sch-table .ct_table_body', modal).html(tbodyStr); | |
| 211 | + //value | |
| 212 | + nbbmArray=distinctByField(nbbmArray); | |
| 213 | + jsyArray=distinctByField(jsyArray); | |
| 214 | + lpArray=distinctByField(lpArray); | |
| 215 | + | |
| 216 | + if(reLoadLp){ | |
| 217 | + //路牌下拉框 | |
| 218 | + var ops = '<option value="">全部</option>'; | |
| 219 | + $.each(lpArray, function () { | |
| 220 | + ops += '<option value="'+this.value+'">'+this.value+'</option>'; | |
| 221 | + }); | |
| 222 | + $('[name=lpName_eq]', modal).html(ops); | |
| 223 | + reLoadLp = false; | |
| 224 | + } | |
| 225 | + | |
| 226 | + //lpName_eq | |
| 227 | + $('.load-panel', modal).hide(); | |
| 228 | + loading=false; | |
| 229 | + | |
| 230 | + //更新滚动条高度 | |
| 231 | + $('.history-sch-wrap', modal).perfectScrollbar('update'); | |
| 232 | + | |
| 233 | + cb && cb(); | |
| 234 | + | |
| 235 | + //初始化依赖数据 | |
| 236 | + gb_data_basic.initData(data.xlBm_eq, data.lineId); | |
| 237 | + }); | |
| 238 | + } | |
| 239 | + | |
| 240 | + function clearLpSelect() { | |
| 241 | + $('[name=lpName_eq]', modal).val('').html(''); | |
| 242 | + $('[name=lineId]', modal).val($(this).data('id')); | |
| 243 | + reLoadLp = true; | |
| 244 | + } | |
| 245 | + | |
| 246 | + //nbbm autocomplete | |
| 247 | + var carAutoCom=$('.autocomplete-cars', modal); | |
| 248 | + UIkit.autocomplete(carAutoCom, { | |
| 249 | + minLength: 1, | |
| 250 | + delay: 50, | |
| 251 | + source: function(release) { | |
| 252 | + var q = $('input', carAutoCom).val().toUpperCase() | |
| 253 | + ,rs = [], | |
| 254 | + count = 0; | |
| 255 | + $.each(nbbmArray, function () { | |
| 256 | + if(this.value.indexOf(q) != -1){ | |
| 257 | + rs.push(this); | |
| 258 | + count++; | |
| 259 | + } | |
| 260 | + if (count >= 15) | |
| 261 | + return false; | |
| 262 | + }); | |
| 263 | + release && release(rs); | |
| 264 | + } | |
| 265 | + }); | |
| 266 | + | |
| 267 | + //jsy autocomplete | |
| 268 | + var jsyAutoCom=$('.autocomplete-jsy', modal); | |
| 269 | + UIkit.autocomplete(jsyAutoCom, { | |
| 270 | + minLength: 1, | |
| 271 | + delay: 50, | |
| 272 | + source: function(release) { | |
| 273 | + var q = $('input', jsyAutoCom).val().toUpperCase() | |
| 274 | + ,rs = [], | |
| 275 | + count = 0; | |
| 276 | + | |
| 277 | + $.each(jsyArray, function() { | |
| 278 | + if (this.value.indexOf(q) != -1 || this.fullChars.indexOf(q) != -1 || this.camelChars.indexOf(q) != -1){ | |
| 279 | + rs.push(this); | |
| 280 | + count++; | |
| 281 | + } | |
| 282 | + | |
| 283 | + if (count >= 10) | |
| 284 | + return false; | |
| 285 | + }); | |
| 286 | + release && release(rs); | |
| 287 | + } | |
| 288 | + }); | |
| 289 | + | |
| 290 | + function schedule_sort(s1, s2) { | |
| 291 | + return (s1.realExecDate+s1.fcsj).localeCompare(s2.realExecDate+s2.fcsj); | |
| 292 | + } | |
| 293 | + | |
| 294 | + function distinctByField(arr, f){ | |
| 295 | + if(!f) | |
| 296 | + f = 'value'; | |
| 297 | + var rs = {}; | |
| 298 | + $.each(arr, function () { | |
| 299 | + rs[this[f]]=this; | |
| 300 | + }); | |
| 301 | + return gb_common.get_vals(rs); | |
| 302 | + } | |
| 303 | + | |
| 304 | + gb_ct_table.fixedHead($('.ct_table_wrap', modal)); | |
| 305 | + | |
| 306 | + //班次点击 | |
| 307 | + $(modal).on('click contextmenu', '.history-sch-table .ct_table_body dl', function() { | |
| 308 | + $(this).parent().find('.active').removeClass('active'); | |
| 309 | + $(this).addClass('active'); | |
| 310 | + }); | |
| 311 | + | |
| 312 | + var modal_opts = {center: false,bgclose: false, modal: false}; | |
| 313 | + var folder = '/real_control_v2/fragments/north/nav/history_sch'; | |
| 314 | + var callbackHandler={ | |
| 315 | + edit: function(id){ | |
| 316 | + open_modal(folder + '/editor.html', {id: id, parentModal: modal}, modal_opts); | |
| 317 | + }, | |
| 318 | + add: function (id) { | |
| 319 | + open_modal(folder + '/h_add_temp_sch.html', { | |
| 320 | + sch: schArray[id] | |
| 321 | + }, modal_opts); | |
| 322 | + }, | |
| 323 | + delete: function (id) { | |
| 324 | + var sch = schArray[id]; | |
| 325 | + if (!sch || !sch.sflj) | |
| 326 | + return notify_err('只能删除临加班次!'); | |
| 327 | + var str = '<h3>确定要删除临加班次<span style="color:red;margin: 0 5px;">' + sch.clZbh + '( ' + sch.dfsj + ' )</span>?</h3><h5 style="color: #6c6c6c;font-size: 12px;">班次删除后,调度指令会保留</h5>'; | |
| 328 | + alt_confirm(str, function () { | |
| 329 | + gb_common.$del('/realSchedule/history/' + sch.id, function (rs) { | |
| 330 | + if($('.history-sch-table .ct_table_body dl', modal).length == 1){ | |
| 331 | + $('[name=lpName_eq]', modal).val(''); | |
| 332 | + reLoadLp = true; | |
| 333 | + } | |
| 334 | + | |
| 335 | + jsQuery(); | |
| 336 | + }); | |
| 337 | + }, '确定删除'); | |
| 338 | + } | |
| 339 | + }; | |
| 340 | + | |
| 341 | + //计算实发时间差值 | |
| 342 | + var calc_sch_real_shift = function (sch) { | |
| 343 | + if (sch.fcsjActualTime) { | |
| 344 | + var diff = parseInt((sch.fcsjActualTime - sch.dfsjT) / 1000 / 60); | |
| 345 | + if (diff > 0) | |
| 346 | + sch.fcsj_diff = '( +' + diff + ' )'; | |
| 347 | + else if (diff < 0) | |
| 348 | + sch.fcsj_diff = '( ' + diff + ' )'; | |
| 349 | + else | |
| 350 | + sch.fcsj_diff = ''; | |
| 351 | + } | |
| 352 | + }; | |
| 353 | + | |
| 354 | + //右键菜单 | |
| 355 | + $.contextMenu({ | |
| 356 | + selector: modal+' .history-sch-table .ct_table_body dl', | |
| 357 | + className: 'schedule-ct-menu', | |
| 358 | + callback: function(key, options) { | |
| 359 | + var id = $('.context-menu-active', modal).data('id'); | |
| 360 | + callbackHandler[key] && callbackHandler[key](id); | |
| 361 | + }, | |
| 362 | + items: { | |
| 363 | + 'edit': { | |
| 364 | + name: '编辑' | |
| 365 | + }, | |
| 366 | + 'add': { | |
| 367 | + name: '新增临加班次' | |
| 368 | + }, | |
| 369 | + 'delete':{ | |
| 370 | + name: '删除' | |
| 371 | + } | |
| 372 | + } | |
| 373 | + }); | |
| 374 | + | |
| 375 | + //临加路牌 | |
| 376 | + $('.add_lp_link', modal).on('click', function () { | |
| 377 | + var index = 0, max; | |
| 378 | + $.each(lpArray, function (i, obj) { | |
| 379 | + var lp = obj.value; | |
| 380 | + if (lp.indexOf('临') != -1) { | |
| 381 | + max = lp.substr(lp.indexOf('临') + 1); | |
| 382 | + if (!isNaN(max)) | |
| 383 | + index = parseInt(max); | |
| 384 | + } | |
| 385 | + }); | |
| 386 | + | |
| 387 | + var lpName = '临' + (index + 1); | |
| 388 | + var lineSelect = $('[name=xlBm_eq]', modal); | |
| 389 | + var rq = $('.h-s-time li.uk-active', modal).text(), | |
| 390 | + lineName = lineSelect[0].options[lineSelect[0].selectedIndex].text,//$('.h-s-line li.uk-active', modal).text(), | |
| 391 | + lineCode = lineSelect.val(); | |
| 392 | + | |
| 393 | + var sch = { | |
| 394 | + scheduleDateStr: rq, | |
| 395 | + xlBm: lineCode, | |
| 396 | + xlName: lineName, | |
| 397 | + lpName: lpName | |
| 398 | + }; | |
| 399 | + | |
| 400 | + open_modal(folder + '/h_add_temp_sch.html', { | |
| 401 | + sch: sch | |
| 402 | + }, modal_opts); | |
| 403 | + }); | |
| 404 | + | |
| 405 | + /** | |
| 406 | + * 是否是临加路牌 | |
| 407 | + * @param lpName | |
| 408 | + */ | |
| 409 | + function is_new_temp_lp(lpName) { | |
| 410 | + if(lpName.indexOf('临') ==-1) | |
| 411 | + return false; | |
| 412 | + | |
| 413 | + for(var i=0,obj;obj=lpArray[i++];){ | |
| 414 | + if(obj.value==lpName) | |
| 415 | + return false; | |
| 416 | + } | |
| 417 | + | |
| 418 | + return true; | |
| 419 | + } | |
| 420 | + | |
| 421 | + | |
| 422 | + var f = $('.search-form', modal); | |
| 423 | + var ep = EventProxy.create('query_comps', 'query_lines', function () { | |
| 424 | + $('[name=companyId]', f).trigger('change');//公司change | |
| 425 | + }); | |
| 426 | + var comps; | |
| 427 | + //构建公司级联下拉框 | |
| 428 | + $.get('/user/companyData', function (rs) { | |
| 429 | + comps = rs; | |
| 430 | + var opts = ''; | |
| 431 | + for(var i=0,obj;obj=comps[i++];){ | |
| 432 | + opts += '<option value="'+obj.companyCode+'">'+obj.companyName+'</option>'; | |
| 433 | + } | |
| 434 | + $('[name=companyId]', f).html(opts); | |
| 435 | + ep.emit('query_comps'); | |
| 436 | + }); | |
| 437 | + var lineMapps; | |
| 438 | + //加载线路信息 | |
| 439 | + $.get('/line/all', {'destroy_eq': 0}, function (rs) { | |
| 440 | + rs.sort(function (a, b) { | |
| 441 | + return a.name.localeCompare(b.name); | |
| 442 | + }); | |
| 443 | + lineMapps={}; | |
| 444 | + var k; | |
| 445 | + $.each(rs, function () { | |
| 446 | + k = this.company+'_'+this.brancheCompany; | |
| 447 | + if(!lineMapps[k]) | |
| 448 | + lineMapps[k]=[]; | |
| 449 | + lineMapps[k].push(this); | |
| 450 | + }); | |
| 451 | + | |
| 452 | + ep.emit('query_lines'); | |
| 453 | + }); | |
| 454 | + | |
| 455 | + $('[name=companyId]', f).on('change', function () { | |
| 456 | + var code = $(this).val(), subs=[]; | |
| 457 | + $.each(comps, function () { | |
| 458 | + if(this.companyCode==code) | |
| 459 | + subs=this.children; | |
| 460 | + }); | |
| 461 | + | |
| 462 | + var opts=''; | |
| 463 | + $.each(subs, function () { | |
| 464 | + opts += '<option value="'+this.code+'">'+this.name+'</option>'; | |
| 465 | + }); | |
| 466 | + $('[name=subCompanyId]', f).html(opts).trigger('change'); | |
| 467 | + }); | |
| 468 | + | |
| 469 | + $('[name=subCompanyId]', f).on('change', function () { | |
| 470 | + var k = $('[name=companyId]', f).val() + '_' + $(this).val(); | |
| 471 | + var array = lineMapps[k]; | |
| 472 | + var opts = ''; | |
| 473 | + if(array){ | |
| 474 | + $.each(array, function () { | |
| 475 | + opts += '<option value="'+this.lineCode+'" data-id="' + this.id + '">'+this.name+'</option>'; | |
| 476 | + }); | |
| 477 | + } | |
| 478 | + $('[name=xlBm_eq]', f).html(opts); | |
| 479 | + }); | |
| 480 | + | |
| 481 | + $('[name=xlBm_eq]', f).on('change', clearLpSelect); | |
| 482 | + //clearLpSelect | |
| 483 | + | |
| 484 | + | |
| 485 | + /** | |
| 486 | + * 重新统计 | |
| 487 | + */ | |
| 488 | + $('#reCountBtn', modal).on('click', function () { | |
| 489 | + var lineSelect = $('[name=xlBm_eq]', modal); | |
| 490 | + var rq = $('.h-s-time li.uk-active', modal).text(), | |
| 491 | + lineName = lineSelect[0].options[lineSelect[0].selectedIndex].text,//$('.h-s-line li.uk-active', modal).text(), | |
| 492 | + lineCode = lineSelect.val(); | |
| 493 | + | |
| 494 | + var that = this; | |
| 495 | + alt_confirm('确定要重新统计 ' + lineName + '('+rq+')的数据吗?',function () { | |
| 496 | + $(that).attr('disabled', 'disabled'); | |
| 497 | + $(that).prepend('<i class="uk-icon-spinner uk-icon-spin"></i>'); | |
| 498 | + | |
| 499 | + | |
| 500 | + var reCountEp = EventProxy.create('ylbUpdate', 'calcWaybill', 'scheduleDetail', function () { | |
| 501 | + $('i.uk-icon-spin', that).remove(); | |
| 502 | + $(that).removeAttr('disabled'); | |
| 503 | + notify_succ('重新统计成功!'); | |
| 504 | + }); | |
| 505 | + | |
| 506 | + //统计路单 -娄高峰 | |
| 507 | + gb_common.$get('/calcWaybill/generateNew', {date:rq, line: lineCode}, function () { | |
| 508 | + reCountEp.emitLater('calcWaybill'); | |
| 509 | + }); | |
| 510 | + | |
| 511 | + //统计油 -廖磊 | |
| 512 | + gb_common.$post('/ylb/updateHistory', {date:rq, line: lineCode}, function () { | |
| 513 | + reCountEp.emitLater('ylbUpdate'); | |
| 514 | + }); | |
| 515 | + | |
| 516 | + //重新统计班次明细 | |
| 517 | + gb_common.$post('/sch/reCalc/scheduleDetail', {date:rq, line: lineCode}, function () { | |
| 518 | + reCountEp.emitLater('scheduleDetail'); | |
| 519 | + }); | |
| 520 | + | |
| 521 | + }, '我确定'); | |
| 522 | + }); | |
| 523 | + })(); | |
| 524 | + </script> | |
| 523 | 525 | </div> |
| 524 | 526 | \ No newline at end of file | ... | ... |
src/main/resources/static/pages/history_sch/edit/js/data_basic.js
| 1 | -/* 基础数据管理模块 */ | |
| 2 | - | |
| 3 | -var gb_data_basic = (function () { | |
| 4 | - | |
| 5 | - var allPersonnel; | |
| 6 | - var stationRoutes, lineInformations, codeToLine={}; | |
| 7 | - var ep = EventProxy.create("all_personnel" | |
| 8 | - , function (all_personnel) { | |
| 9 | - allPersonnel = all_personnel; | |
| 10 | - //gb_main_ep.emitLater('data-basic'); | |
| 11 | - }); | |
| 12 | - | |
| 13 | -/* //线路标准信息 | |
| 14 | - gb_common.$get('/lineInformation/line/multi', {lineCodes: line_idx}, function (rs) { | |
| 15 | - var informations = {}; | |
| 16 | - $.each(rs, function () { | |
| 17 | - informations[this.line.lineCode] = this; | |
| 18 | - delete this['line']; | |
| 19 | - }); | |
| 20 | - ep.emit('lineInformations', informations); | |
| 21 | - });*/ | |
| 22 | - | |
| 23 | - //人员信息 | |
| 24 | - loadAllPersonnel(function (data) { | |
| 25 | - ep.emit('all_personnel', data); | |
| 26 | - }); | |
| 27 | - function loadAllPersonnel(cb) { | |
| 28 | - $.get('/personnel/all_py', function (rs) { | |
| 29 | - //转换成自动补全组件需要的数据 | |
| 30 | - var data = [], code; | |
| 31 | - for(var i =0, p; p = rs[i++];){ | |
| 32 | - code = p['workId'].indexOf('-')!=-1?p['workId'].split('-')[1]:p['workId']; | |
| 33 | - data.push({ | |
| 34 | - value: code + '/' + p.name, | |
| 35 | - fullChars: p.fullChars.toUpperCase(), | |
| 36 | - camelChars: p.camelChars.toUpperCase() | |
| 37 | - }); | |
| 38 | - } | |
| 39 | - cb && cb(data); | |
| 40 | - }); | |
| 41 | - } | |
| 42 | - | |
| 43 | - var carparks = {}; | |
| 44 | - //停车场数据 | |
| 45 | - gb_common.$get('/realMap/carParkSpatialData', {}, function (rs) { | |
| 46 | - rs.list.sort(function (a, b) { | |
| 47 | - return a.parkName.localeCompare(b.parkName); | |
| 48 | - }); | |
| 49 | - $.each(rs.list, function () { | |
| 50 | - carparks[this.parkCode] = this; | |
| 51 | - }); | |
| 52 | - }); | |
| 53 | - | |
| 54 | - //车辆数据 | |
| 55 | - var carsArray; | |
| 56 | - $.get('/basic/cars?t=' + Math.random(), function (rs) { | |
| 57 | - carsArray = rs; | |
| 58 | - }); | |
| 59 | - | |
| 60 | - var getCarparkByCode = function (code) { | |
| 61 | - return carparks[code]; | |
| 62 | - }; | |
| 63 | - | |
| 64 | - //line code to name | |
| 65 | - $.get('/basic/lineCode2Name', function (rs) { | |
| 66 | - ep.emit('lineCode2Name', rs); | |
| 67 | - }); | |
| 68 | - | |
| 69 | - var getLineInformation = function (lineCode) { | |
| 70 | - return lineInformations[lineCode]; | |
| 71 | - }; | |
| 72 | - | |
| 73 | - var stationRouteSort = function (a, b) { | |
| 74 | - return a.stationRouteCode - b.stationRouteCode; | |
| 75 | - }; | |
| 76 | - | |
| 77 | - function findLineByCodes(codeArr) { | |
| 78 | - var rs = []; | |
| 79 | - $.each(codeArr, function () { | |
| 80 | - rs.push(codeToLine[this]); | |
| 81 | - }); | |
| 82 | - return rs; | |
| 83 | - } | |
| 84 | - | |
| 85 | - return { | |
| 86 | - getLineInformation: getLineInformation, | |
| 87 | - allInformations: function () { | |
| 88 | - return {}; | |
| 89 | - }, | |
| 90 | - allPersonnel: function () { | |
| 91 | - return allPersonnel; | |
| 92 | - }, | |
| 93 | - getSvgAttr: function (lineCode) { | |
| 94 | - return svgAttrs[lineCode]; | |
| 95 | - }, | |
| 96 | - //刷新员工信息 | |
| 97 | - refreshAllPersonnel: function (cb) { | |
| 98 | - loadAllPersonnel(function (data) { | |
| 99 | - allPersonnel = data; | |
| 100 | - cb && cb(); | |
| 101 | - }); | |
| 102 | - }, | |
| 103 | - carsArray: function () { | |
| 104 | - return carsArray; | |
| 105 | - }, | |
| 106 | - simpleParksArray: function () { | |
| 107 | - var map = {}; | |
| 108 | - for(var code in carparks) | |
| 109 | - map[code] = carparks[code].parkName; | |
| 110 | - return map; | |
| 111 | - }, | |
| 112 | - getLineInformation: getLineInformation, | |
| 113 | - allInformations: function () { | |
| 114 | - return lineInformations; | |
| 115 | - }, | |
| 116 | - stationRoutes: function (lineCode) { | |
| 117 | - return stationRoutes[lineCode] | |
| 118 | - }, | |
| 119 | - remarksMapps: function () { | |
| 120 | - return ""; | |
| 121 | - }, | |
| 122 | - findLineByCodes: findLineByCodes, | |
| 123 | - //初始化依赖数据 | |
| 124 | - initData: function (lineCode) { | |
| 125 | - var ep = EventProxy.create("stationRoutes", "lineInformations", "codeToLineMap", function (routes, informations, _codeToLine) { | |
| 126 | - stationRoutes = routes; | |
| 127 | - lineInformations = informations; | |
| 128 | - codeToLine[_codeToLine.lineCode] = _codeToLine; | |
| 129 | - }); | |
| 130 | - | |
| 131 | - //站点路由 | |
| 132 | - gb_common.$get('/stationroute/multiLine', {lineIds: lineCode}, function (rs) { | |
| 133 | - var list = rs.list; | |
| 134 | - var routeData = gb_common.groupBy(list, 'lineCode'); | |
| 135 | - //排序 | |
| 136 | - for (var lineCode in routeData) { | |
| 137 | - routeData[lineCode].sort(stationRouteSort); | |
| 138 | - } | |
| 139 | - ep.emitLater('stationRoutes', routeData); | |
| 140 | - }); | |
| 141 | - | |
| 142 | - //线路标准信息 | |
| 143 | - gb_common.$get('/lineInformation/line/multi', {lineCodes: lineCode}, function (rs) { | |
| 144 | - var _informations = {}; | |
| 145 | - $.each(rs, function () { | |
| 146 | - _informations[this.line.lineCode] = this; | |
| 147 | - delete this['line']; | |
| 148 | - }); | |
| 149 | - ep.emitLater('lineInformations', _informations); | |
| 150 | - }); | |
| 151 | - | |
| 152 | - //线路基础信息 | |
| 153 | - gb_common.$get('/line/' + lineCode, {}, function (rs) { | |
| 154 | - ep.emitLater('codeToLineMap', rs); | |
| 155 | - }); | |
| 156 | - } | |
| 157 | - }; | |
| 158 | -})(); | |
| 1 | +/* 基础数据管理模块 */ | |
| 2 | + | |
| 3 | +var gb_data_basic = (function () { | |
| 4 | + | |
| 5 | + var allPersonnel; | |
| 6 | + var stationRoutes, lineInformations, codeToLine={}; | |
| 7 | + var ep = EventProxy.create("all_personnel" | |
| 8 | + , function (all_personnel) { | |
| 9 | + allPersonnel = all_personnel; | |
| 10 | + //gb_main_ep.emitLater('data-basic'); | |
| 11 | + }); | |
| 12 | + | |
| 13 | +/* //线路标准信息 | |
| 14 | + gb_common.$get('/lineInformation/line/multi', {lineCodes: line_idx}, function (rs) { | |
| 15 | + var informations = {}; | |
| 16 | + $.each(rs, function () { | |
| 17 | + informations[this.line.lineCode] = this; | |
| 18 | + delete this['line']; | |
| 19 | + }); | |
| 20 | + ep.emit('lineInformations', informations); | |
| 21 | + });*/ | |
| 22 | + | |
| 23 | + //人员信息 | |
| 24 | + loadAllPersonnel(function (data) { | |
| 25 | + ep.emit('all_personnel', data); | |
| 26 | + }); | |
| 27 | + function loadAllPersonnel(cb) { | |
| 28 | + $.get('/personnel/all_py', function (rs) { | |
| 29 | + //转换成自动补全组件需要的数据 | |
| 30 | + var data = [], code; | |
| 31 | + for(var i =0, p; p = rs[i++];){ | |
| 32 | + code = p['workId'].indexOf('-')!=-1?p['workId'].split('-')[1]:p['workId']; | |
| 33 | + data.push({ | |
| 34 | + value: code + '/' + p.name, | |
| 35 | + fullChars: p.fullChars.toUpperCase(), | |
| 36 | + camelChars: p.camelChars.toUpperCase() | |
| 37 | + }); | |
| 38 | + } | |
| 39 | + cb && cb(data); | |
| 40 | + }); | |
| 41 | + } | |
| 42 | + | |
| 43 | + var carparks = {}; | |
| 44 | + //停车场数据 | |
| 45 | + gb_common.$get('/realMap/carParkSpatialData', {}, function (rs) { | |
| 46 | + rs.list.sort(function (a, b) { | |
| 47 | + return a.parkName.localeCompare(b.parkName); | |
| 48 | + }); | |
| 49 | + $.each(rs.list, function () { | |
| 50 | + carparks[this.parkCode] = this; | |
| 51 | + }); | |
| 52 | + }); | |
| 53 | + | |
| 54 | + //车辆数据 | |
| 55 | + var carsArray; | |
| 56 | + $.get('/basic/cars?t=' + Math.random(), function (rs) { | |
| 57 | + carsArray = rs; | |
| 58 | + }); | |
| 59 | + | |
| 60 | + var getCarparkByCode = function (code) { | |
| 61 | + return carparks[code]; | |
| 62 | + }; | |
| 63 | + | |
| 64 | + //line code to name | |
| 65 | + $.get('/basic/lineCode2Name', function (rs) { | |
| 66 | + ep.emit('lineCode2Name', rs); | |
| 67 | + }); | |
| 68 | + | |
| 69 | + var getLineInformation = function (lineCode) { | |
| 70 | + return lineInformations[lineCode]; | |
| 71 | + }; | |
| 72 | + | |
| 73 | + var stationRouteSort = function (a, b) { | |
| 74 | + return a.stationRouteCode - b.stationRouteCode; | |
| 75 | + }; | |
| 76 | + | |
| 77 | + function findLineByCodes(codeArr) { | |
| 78 | + var rs = []; | |
| 79 | + $.each(codeArr, function () { | |
| 80 | + rs.push(codeToLine[this]); | |
| 81 | + }); | |
| 82 | + return rs; | |
| 83 | + } | |
| 84 | + | |
| 85 | + return { | |
| 86 | + getLineInformation: getLineInformation, | |
| 87 | + allInformations: function () { | |
| 88 | + return {}; | |
| 89 | + }, | |
| 90 | + allPersonnel: function () { | |
| 91 | + return allPersonnel; | |
| 92 | + }, | |
| 93 | + getSvgAttr: function (lineCode) { | |
| 94 | + return svgAttrs[lineCode]; | |
| 95 | + }, | |
| 96 | + //刷新员工信息 | |
| 97 | + refreshAllPersonnel: function (cb) { | |
| 98 | + loadAllPersonnel(function (data) { | |
| 99 | + allPersonnel = data; | |
| 100 | + cb && cb(); | |
| 101 | + }); | |
| 102 | + }, | |
| 103 | + carsArray: function () { | |
| 104 | + return carsArray; | |
| 105 | + }, | |
| 106 | + simpleParksArray: function () { | |
| 107 | + var map = {}; | |
| 108 | + for(var code in carparks) | |
| 109 | + map[code] = carparks[code].parkName; | |
| 110 | + return map; | |
| 111 | + }, | |
| 112 | + getLineInformation: getLineInformation, | |
| 113 | + allInformations: function () { | |
| 114 | + return lineInformations; | |
| 115 | + }, | |
| 116 | + stationRoutes: function (lineCode) { | |
| 117 | + return stationRoutes[lineCode] | |
| 118 | + }, | |
| 119 | + remarksMapps: function () { | |
| 120 | + return ""; | |
| 121 | + }, | |
| 122 | + findLineByCodes: findLineByCodes, | |
| 123 | + //初始化依赖数据 | |
| 124 | + initData: function (lineCode, lineId) { | |
| 125 | + var ep = EventProxy.create("stationRoutes", "lineInformations", "codeToLineMap", function (routes, informations, _codeToLine) { | |
| 126 | + stationRoutes = routes; | |
| 127 | + lineInformations = informations; | |
| 128 | + codeToLine[_codeToLine.lineCode] = _codeToLine; | |
| 129 | + }); | |
| 130 | + | |
| 131 | + //站点路由 | |
| 132 | + gb_common.$get('/stationroute/multiLine', {lineIds: lineCode}, function (rs) { | |
| 133 | + var list = rs.list; | |
| 134 | + var routeData = gb_common.groupBy(list, 'lineCode'); | |
| 135 | + //排序 | |
| 136 | + for (var lineCode in routeData) { | |
| 137 | + routeData[lineCode].sort(stationRouteSort); | |
| 138 | + } | |
| 139 | + ep.emitLater('stationRoutes', routeData); | |
| 140 | + }); | |
| 141 | + | |
| 142 | + //线路标准信息 | |
| 143 | + gb_common.$get('/lineInformation/line/multi', {lineCodes: lineCode}, function (rs) { | |
| 144 | + var _informations = {}; | |
| 145 | + $.each(rs, function () { | |
| 146 | + _informations[this.line.lineCode] = this; | |
| 147 | + delete this['line']; | |
| 148 | + }); | |
| 149 | + ep.emitLater('lineInformations', _informations); | |
| 150 | + }); | |
| 151 | + | |
| 152 | + //线路基础信息 | |
| 153 | + gb_common.$get('/line/' + lineId, {}, function (rs) { | |
| 154 | + ep.emitLater('codeToLineMap', rs); | |
| 155 | + }); | |
| 156 | + } | |
| 157 | + }; | |
| 158 | +})(); | ... | ... |
src/main/resources/static/pages/home.html
| ... | ... | @@ -62,8 +62,11 @@ |
| 62 | 62 | <h2 style="text-indent: 35px;margin: 10px 0 5px;">2023-09-16 更新说明 Changelog</h2> |
| 63 | 63 | <br><br> |
| 64 | 64 | <ul> |
| 65 | - <li class="sub_title"><h6>线调、油电管理</h6></li> | |
| 66 | - <li><span class="label s_c_change">修改</span>1.历史路单维护、进出场存油(恒定)、进出场存电(恒定)的编辑限制统一为T+2(以今日为锚点,可以编辑今日、昨日、前日的数据)</li> | |
| 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.线调中查看车辆信息的tip弹窗加入驾驶员联系方式(手机号存在的情况)</li> | |
| 67 | 70 | </ul> |
| 68 | 71 | |
| 69 | 72 | </div> | ... | ... |
src/main/resources/static/pages/scheduleApp/module/basicInfo/busInfoManage/edit.html
| ... | ... | @@ -458,7 +458,11 @@ |
| 458 | 458 | <div class="form-group"> |
| 459 | 459 | <label class="col-md-2 control-label">是否氢能源车:</label> |
| 460 | 460 | <div class="col-md-3"> |
| 461 | - <sa-Radiogroup model="ctrl.busInfoForSave.hydrogen" dicgroup="truefalseType" name="hydrogen"></sa-Radiogroup> | |
| 461 | + <sa-Radiogroup model="ctrl.busInfoForSave.hydrogen" dicgroup="truefalseType" name="hydrogen" required></sa-Radiogroup> | |
| 462 | + </div> | |
| 463 | + <!-- 隐藏快,显示验证信息 --> | |
| 464 | + <div class="alert alert-danger well-sm" ng-show="myForm.hydrogen.$error.required"> | |
| 465 | + 是否氢能源车必须选择 | |
| 462 | 466 | </div> |
| 463 | 467 | </div> |
| 464 | 468 | |
| ... | ... | @@ -488,4 +492,4 @@ |
| 488 | 492 | |
| 489 | 493 | </div> |
| 490 | 494 | |
| 491 | -</div> | |
| 492 | 495 | \ No newline at end of file |
| 496 | +</div> | ... | ... |
src/main/resources/static/pages/scheduleApp/module/basicInfo/busInfoManage/form.html
| ... | ... | @@ -450,7 +450,11 @@ |
| 450 | 450 | <div class="form-group"> |
| 451 | 451 | <label class="col-md-2 control-label">是否氢能源车:</label> |
| 452 | 452 | <div class="col-md-3"> |
| 453 | - <sa-Radiogroup model="ctrl.busInfoForSave.hydrogen" dicgroup="truefalseType" name="hydrogen"></sa-Radiogroup> | |
| 453 | + <sa-Radiogroup model="ctrl.busInfoForSave.hydrogen" dicgroup="truefalseType" name="hydrogen" required></sa-Radiogroup> | |
| 454 | + </div> | |
| 455 | + <!-- 隐藏快,显示验证信息 --> | |
| 456 | + <div class="alert alert-danger well-sm" ng-show="myForm.hydrogen.$error.required"> | |
| 457 | + 是否氢能源车必须选择 | |
| 454 | 458 | </div> |
| 455 | 459 | </div> |
| 456 | 460 | |
| ... | ... | @@ -481,4 +485,4 @@ |
| 481 | 485 | </div> |
| 482 | 486 | |
| 483 | 487 | |
| 484 | -</div> | |
| 485 | 488 | \ No newline at end of file |
| 489 | +</div> | ... | ... |
src/main/resources/static/pages/scheduleApp/module/common/dts2/employeeGroup/saEmployeegroup.js
| ... | ... | @@ -646,7 +646,7 @@ angular.module('ScheduleApp').directive('saEmployeegroup', [ |
| 646 | 646 | console.log("xlidvalue=" + value); |
| 647 | 647 | |
| 648 | 648 | employeeConfigService_g.rest.list( |
| 649 | - {"xl.id_eq": value, "isCancel_eq" : false, size: 200}, | |
| 649 | + {"xl.id_eq": value, "isCancel_eq" : false, "ryDestroyStatus_eq" : 0, size: 200}, | |
| 650 | 650 | function(result) { |
| 651 | 651 | // 获取值了 |
| 652 | 652 | console.log("人员配置获取了"); | ... | ... |
src/main/resources/static/pages/scheduleApp/module/common/main.js
| ... | ... | @@ -116,26 +116,22 @@ ScheduleApp.factory('DataStore', [ |
| 116 | 116 | var deferred = $q.defer(); |
| 117 | 117 | |
| 118 | 118 | $http({ |
| 119 | - method: 'POST', | |
| 120 | - url: '/basic/refresh_person_data' | |
| 121 | - }).then(function() { | |
| 122 | - $http({ | |
| 123 | - method: 'GET', | |
| 124 | - url: '/personnel/all_py' | |
| 125 | - }).then(function(result) { | |
| 126 | - // 简拼数据 | |
| 127 | - var dd = result.data; | |
| 128 | - angular.forEach(result.data, function(obj) { | |
| 129 | - // 全拼 | |
| 130 | - obj["$fullChars"] = obj.fullChars; | |
| 131 | - // 简拼 | |
| 132 | - obj["$camelChars"] = obj.camelChars; | |
| 133 | - // 原值 | |
| 134 | - obj["$calcu_str"] = obj.name + "-" + obj.workId; | |
| 135 | - }); | |
| 136 | - deferred.resolve(dd); | |
| 119 | + method: 'GET', | |
| 120 | + url: '/ee/all_py' | |
| 121 | + }).then(function(result) { | |
| 122 | + // 简拼数据 | |
| 123 | + var dd = result.data; | |
| 124 | + angular.forEach(result.data, function(obj) { | |
| 125 | + // 全拼 | |
| 126 | + obj["$fullChars"] = obj.fullChars; | |
| 127 | + // 简拼 | |
| 128 | + obj["$camelChars"] = obj.camelChars; | |
| 129 | + // 原值 | |
| 130 | + obj["$calcu_str"] = obj.name + "-" + obj.workId; | |
| 137 | 131 | }); |
| 132 | + deferred.resolve(dd); | |
| 138 | 133 | }); |
| 134 | + | |
| 139 | 135 | return deferred.promise; |
| 140 | 136 | }; |
| 141 | 137 | ... | ... |
src/main/resources/static/pages/scheduleApp/module/common/prj-common-directive.js
| ... | ... | @@ -3669,7 +3669,7 @@ angular.module('ScheduleApp').directive('saEmployeegroup', [ |
| 3669 | 3669 | console.log("xlidvalue=" + value); |
| 3670 | 3670 | |
| 3671 | 3671 | employeeConfigService_g.rest.list( |
| 3672 | - {"xl.id_eq": value, "isCancel_eq" : false, size: 200}, | |
| 3672 | + {"xl.id_eq": value, "isCancel_eq" : false, "ryDestroyStatus_eq" : 0, size: 200}, | |
| 3673 | 3673 | function(result) { |
| 3674 | 3674 | // 获取值了 |
| 3675 | 3675 | console.log("人员配置获取了"); | ... | ... |
src/main/resources/static/real_control_v2/fragments/home/tooltip.html
| ... | ... | @@ -37,6 +37,11 @@ |
| 37 | 37 | <div> |
| 38 | 38 | <span class="field">驾驶员:</span>{{sch.jGh}}/{{sch.jName}} |
| 39 | 39 | </div> |
| 40 | + {{if sch.mobile!=null && sch.mobile!=""}} | |
| 41 | + <div> | |
| 42 | + <span class="field">电话:</span>{{sch.mobile}} | |
| 43 | + </div> | |
| 44 | + {{/if}} | |
| 40 | 45 | {{if sch.sGh!=null && sch.sGh!=""}} |
| 41 | 46 | <div> |
| 42 | 47 | <span class="field">售票员:</span>{{sch.sGh}}/{{sch.sName}} | ... | ... |
src/main/resources/static/real_control_v2/fragments/north/nav/sch_edit_info/list.html
| ... | ... | @@ -275,7 +275,7 @@ |
| 275 | 275 | jsyArray=[]; |
| 276 | 276 | lpArray = []; |
| 277 | 277 | $.each(rs.list, function () { |
| 278 | - this.jsonArray = JSON.parse(this.jsonArray); | |
| 278 | + this.jsonArray = JSON.parse(this.jsonArray ? this.jsonArray : null); | |
| 279 | 279 | etInfos[this.id] = this; |
| 280 | 280 | debugger |
| 281 | 281 | this['ts_str'] = moment(this.ts).format('YYYY-MM-DD HH:mm'); | ... | ... |
src/main/resources/static/real_control_v2/js/data/data_basic.js
| ... | ... | @@ -2,9 +2,9 @@ |
| 2 | 2 | |
| 3 | 3 | var gb_data_basic = (function () { |
| 4 | 4 | |
| 5 | - var stationRoutes, lineCode2NameAll, lineInformations, nbbm2deviceMap, device2nbbmMap, allPersonnel, svgAttrs; | |
| 6 | - var ep = EventProxy.create("stationRoutes", "lineCode2Name", "lineInformations", "nbbm2deviceId", "all_personnel", "svg_attrs" | |
| 7 | - , function (routes, code2Name, informations, nbbm2device, all_personnel, svgAttrMap) { | |
| 5 | + var stationRoutes, lineCode2NameAll, lineInformations, nbbm2deviceMap, device2nbbmMap, allPersonnel, svgAttrs, gh2mobileMap; | |
| 6 | + var ep = EventProxy.create("stationRoutes", "lineCode2Name", "lineInformations", "nbbm2deviceId", "all_personnel", "svg_attrs", "all_mobile" | |
| 7 | + , function (routes, code2Name, informations, nbbm2device, all_personnel, svgAttrMap, all_mobile) { | |
| 8 | 8 | stationRoutes = routes; |
| 9 | 9 | lineCode2NameAll = code2Name; |
| 10 | 10 | lineInformations = informations; |
| ... | ... | @@ -12,6 +12,7 @@ var gb_data_basic = (function () { |
| 12 | 12 | device2nbbmMap = gb_common.inverse(nbbm2deviceMap); |
| 13 | 13 | allPersonnel = all_personnel; |
| 14 | 14 | svgAttrs = svgAttrMap; |
| 15 | + gh2mobileMap = all_mobile; | |
| 15 | 16 | gb_main_ep.emitLater('data-basic'); |
| 16 | 17 | }); |
| 17 | 18 | |
| ... | ... | @@ -71,6 +72,12 @@ var gb_data_basic = (function () { |
| 71 | 72 | }); |
| 72 | 73 | } |
| 73 | 74 | |
| 75 | + (function loadAllPersonnelMobile() { | |
| 76 | + $.get('/basic/allPersonnelMobile', function (rs) { | |
| 77 | + ep.emit('all_mobile', rs); | |
| 78 | + }); | |
| 79 | + })(); | |
| 80 | + | |
| 74 | 81 | var carparks = {}; |
| 75 | 82 | //停车场数据 |
| 76 | 83 | gb_common.$get('/realMap/carParkSpatialData', {}, function (rs) { |
| ... | ... | @@ -259,6 +266,9 @@ var gb_data_basic = (function () { |
| 259 | 266 | }, |
| 260 | 267 | reload_stat_park_data: function () { |
| 261 | 268 | load_stat_park_data(); |
| 269 | + }, | |
| 270 | + gh2mobileMap: function () { | |
| 271 | + return gh2mobileMap; | |
| 262 | 272 | } |
| 263 | 273 | }; |
| 264 | 274 | })(); | ... | ... |
src/main/resources/static/real_control_v2/js/data/data_gps.js
| 1 | -/* gps 数据管理模块 */ | |
| 2 | - | |
| 3 | -var gb_data_gps = (function () { | |
| 4 | - | |
| 5 | - //fixed time refresh delay | |
| 6 | - var delay = 1000 * 7; | |
| 7 | - //deviceId ——> gps | |
| 8 | - var realData = {}; | |
| 9 | - //refresh after callback | |
| 10 | - var refreshEventCallbacks = []; | |
| 11 | - //register callback function | |
| 12 | - var registerCallback = function (cb) { | |
| 13 | - if (cb) | |
| 14 | - refreshEventCallbacks.push(cb); | |
| 15 | - }; | |
| 16 | - | |
| 17 | - var refresh = function (cb) { | |
| 18 | - $.ajax({ | |
| 19 | - url: '/gps/real/line', | |
| 20 | - data: {lineCodes: gb_data_basic.line_idx}, | |
| 21 | - dataType: 'json', | |
| 22 | - success: function (rs) { | |
| 23 | - //用定时的gps来检测session断开 | |
| 24 | - if(rs.status && rs.status==407){ | |
| 25 | - location.href = '/login.html'; | |
| 26 | - return; | |
| 27 | - } | |
| 28 | - refreshData(rs); | |
| 29 | - cb(); | |
| 30 | - }, | |
| 31 | - error: function (xr, t) { | |
| 32 | - notify_err('刷新GPS失败,稍后重试' + t); | |
| 33 | - cb(); | |
| 34 | - } | |
| 35 | - }); | |
| 36 | - }; | |
| 37 | - | |
| 38 | - var refreshData = function (rs) { | |
| 39 | - var old, addArr = [], | |
| 40 | - upArr = [], | |
| 41 | - upDownChange = []; | |
| 42 | - | |
| 43 | - var schArray; | |
| 44 | - $.each(rs.gpsList, function () { | |
| 45 | - old = realData[this.deviceId]; | |
| 46 | - if (old) { | |
| 47 | - if (this.timestamp > old.timestamp) { | |
| 48 | - if (old.upDown != this.upDown) | |
| 49 | - upDownChange.push(this); | |
| 50 | - else | |
| 51 | - upArr.push(this); | |
| 52 | - } | |
| 53 | - | |
| 54 | - } else | |
| 55 | - addArr.push(this); | |
| 56 | - | |
| 57 | - //班次信息 | |
| 58 | - if (this.schId) { | |
| 59 | - schArray = gb_schedule_table.findScheduleByLine(this.lineId); | |
| 60 | - if (schArray) | |
| 61 | - this.sch = schArray[this.schId]; | |
| 62 | - } | |
| 63 | - | |
| 64 | - //时间格式化 | |
| 65 | - this.dateStr = moment(this.timestamp).format('YYYY-MM-DD HH:mm:ss'); | |
| 66 | - realData[this.deviceId] = this; | |
| 67 | - }); | |
| 68 | - | |
| 69 | - //console.log('add array size: ' + addArr.length, 'up array size: ' + upArr.length); | |
| 70 | - //CCCallFuncN | |
| 71 | - $.each(refreshEventCallbacks, function (i, cb) { | |
| 72 | - cb(addArr, upArr, upDownChange, rs.overspeedList); | |
| 73 | - }); | |
| 74 | - | |
| 75 | - //班次站点编码检查信息 | |
| 76 | - if(rs['scis'] && rs['scis'].length > 0) | |
| 77 | - gb_schedule_table.putSCodeErrorInfo(rs['scis']); | |
| 78 | - | |
| 79 | - //超速数据回调 | |
| 80 | - //console.log('超速,,,', rs.overspeedList); | |
| 81 | - | |
| 82 | - }; | |
| 83 | - | |
| 84 | - var startFixedTime; | |
| 85 | - var fixedTimeRefresh = function () { | |
| 86 | - if (startFixedTime) | |
| 87 | - return; | |
| 88 | - startFixedTime = true; | |
| 89 | - | |
| 90 | - (function () { | |
| 91 | - var f = arguments.callee; | |
| 92 | - refresh(function () { | |
| 93 | - setTimeout(f, delay); | |
| 94 | - }); | |
| 95 | - })(); | |
| 96 | - }; | |
| 97 | - | |
| 98 | - var gpsByLineCode = function (lineCode) { | |
| 99 | - var rs = []; | |
| 100 | - for (var device in realData) { | |
| 101 | - if (realData[device].lineId == lineCode) | |
| 102 | - rs.push(realData[device]); | |
| 103 | - } | |
| 104 | - return rs; | |
| 105 | - }; | |
| 106 | - | |
| 107 | - var findOne = function (deviceId) { | |
| 108 | - return realData[deviceId]; | |
| 109 | - }; | |
| 110 | - | |
| 111 | - var findGpsByNbbm = function (nbbm) { | |
| 112 | - return realData[gb_data_basic.nbbm2deviceMap()[nbbm]]; | |
| 113 | - }; | |
| 114 | - | |
| 115 | - /** | |
| 116 | - * 设备掉线事件 | |
| 117 | - */ | |
| 118 | - var deviceOffline = function (gps) { | |
| 119 | - $.each(offlineCallbacks, function (i, cb) { | |
| 120 | - cb(gps); | |
| 121 | - }); | |
| 122 | - }; | |
| 123 | - | |
| 124 | - //注册掉线事件回调函数 | |
| 125 | - var offlineCallbacks = []; | |
| 126 | - var registerOfflineCb = function (cb) { | |
| 127 | - if (cb) | |
| 128 | - offlineCallbacks.push(cb); | |
| 129 | - }; | |
| 130 | - | |
| 131 | - return { | |
| 132 | - fixedTimeRefresh: fixedTimeRefresh, | |
| 133 | - registerCallback: registerCallback, | |
| 134 | - allGps: realData, | |
| 135 | - gpsByLineCode: gpsByLineCode, | |
| 136 | - findOne: findOne, | |
| 137 | - findGpsByNbbm: findGpsByNbbm, | |
| 138 | - deviceOffline: deviceOffline, | |
| 139 | - registerOfflineCb: registerOfflineCb | |
| 140 | - }; | |
| 141 | -})(); | |
| 1 | +/* gps 数据管理模块 */ | |
| 2 | + | |
| 3 | +var gb_data_gps = (function () { | |
| 4 | + | |
| 5 | + //fixed time refresh delay | |
| 6 | + var delay = 1000 * 7; | |
| 7 | + //deviceId ——> gps | |
| 8 | + var realData = {}; | |
| 9 | + //refresh after callback | |
| 10 | + var refreshEventCallbacks = []; | |
| 11 | + //register callback function | |
| 12 | + var registerCallback = function (cb) { | |
| 13 | + if (cb) | |
| 14 | + refreshEventCallbacks.push(cb); | |
| 15 | + }; | |
| 16 | + | |
| 17 | + var refresh = function (cb) { | |
| 18 | + $.ajax({ | |
| 19 | + url: '/gps/real/line', | |
| 20 | + data: {lineCodes: gb_data_basic.line_idx}, | |
| 21 | + dataType: 'json', | |
| 22 | + success: function (rs) { | |
| 23 | + //用定时的gps来检测session断开 | |
| 24 | + if(rs.status && rs.status==407){ | |
| 25 | + location.href = '/login.html'; | |
| 26 | + return; | |
| 27 | + } | |
| 28 | + refreshData(rs); | |
| 29 | + cb(); | |
| 30 | + }, | |
| 31 | + error: function (xr, t) { | |
| 32 | + notify_err('刷新GPS失败,稍后重试' + t); | |
| 33 | + cb(); | |
| 34 | + } | |
| 35 | + }); | |
| 36 | + }; | |
| 37 | + | |
| 38 | + var refreshData = function (rs) { | |
| 39 | + var old, addArr = [], | |
| 40 | + upArr = [], | |
| 41 | + upDownChange = []; | |
| 42 | + | |
| 43 | + var schArray; | |
| 44 | + $.each(rs.gpsList, function () { | |
| 45 | + old = realData[this.deviceId]; | |
| 46 | + if (old) { | |
| 47 | + if (this.timestamp > old.timestamp) { | |
| 48 | + if (old.upDown != this.upDown) | |
| 49 | + upDownChange.push(this); | |
| 50 | + else | |
| 51 | + upArr.push(this); | |
| 52 | + } | |
| 53 | + | |
| 54 | + } else | |
| 55 | + addArr.push(this); | |
| 56 | + | |
| 57 | + //班次信息 | |
| 58 | + if (this.schId) { | |
| 59 | + schArray = gb_schedule_table.findScheduleByLine(this.lineId); | |
| 60 | + if (schArray) { | |
| 61 | + var sch = schArray[this.schId]; | |
| 62 | + if (sch) { | |
| 63 | + this.sch = sch; | |
| 64 | + this.sch.mobile = gb_data_basic.gh2mobileMap()[sch.gsBm + '-' + sch.jGh]; | |
| 65 | + } | |
| 66 | + } | |
| 67 | + } | |
| 68 | + | |
| 69 | + //时间格式化 | |
| 70 | + this.dateStr = moment(this.timestamp).format('YYYY-MM-DD HH:mm:ss'); | |
| 71 | + realData[this.deviceId] = this; | |
| 72 | + }); | |
| 73 | + | |
| 74 | + //console.log('add array size: ' + addArr.length, 'up array size: ' + upArr.length); | |
| 75 | + //CCCallFuncN | |
| 76 | + $.each(refreshEventCallbacks, function (i, cb) { | |
| 77 | + cb(addArr, upArr, upDownChange, rs.overspeedList); | |
| 78 | + }); | |
| 79 | + | |
| 80 | + //班次站点编码检查信息 | |
| 81 | + if(rs['scis'] && rs['scis'].length > 0) | |
| 82 | + gb_schedule_table.putSCodeErrorInfo(rs['scis']); | |
| 83 | + | |
| 84 | + //超速数据回调 | |
| 85 | + //console.log('超速,,,', rs.overspeedList); | |
| 86 | + | |
| 87 | + }; | |
| 88 | + | |
| 89 | + var startFixedTime; | |
| 90 | + var fixedTimeRefresh = function () { | |
| 91 | + if (startFixedTime) | |
| 92 | + return; | |
| 93 | + startFixedTime = true; | |
| 94 | + | |
| 95 | + (function () { | |
| 96 | + var f = arguments.callee; | |
| 97 | + refresh(function () { | |
| 98 | + setTimeout(f, delay); | |
| 99 | + }); | |
| 100 | + })(); | |
| 101 | + }; | |
| 102 | + | |
| 103 | + var gpsByLineCode = function (lineCode) { | |
| 104 | + var rs = []; | |
| 105 | + for (var device in realData) { | |
| 106 | + if (realData[device].lineId == lineCode) | |
| 107 | + rs.push(realData[device]); | |
| 108 | + } | |
| 109 | + return rs; | |
| 110 | + }; | |
| 111 | + | |
| 112 | + var findOne = function (deviceId) { | |
| 113 | + return realData[deviceId]; | |
| 114 | + }; | |
| 115 | + | |
| 116 | + var findGpsByNbbm = function (nbbm) { | |
| 117 | + return realData[gb_data_basic.nbbm2deviceMap()[nbbm]]; | |
| 118 | + }; | |
| 119 | + | |
| 120 | + /** | |
| 121 | + * 设备掉线事件 | |
| 122 | + */ | |
| 123 | + var deviceOffline = function (gps) { | |
| 124 | + $.each(offlineCallbacks, function (i, cb) { | |
| 125 | + cb(gps); | |
| 126 | + }); | |
| 127 | + }; | |
| 128 | + | |
| 129 | + //注册掉线事件回调函数 | |
| 130 | + var offlineCallbacks = []; | |
| 131 | + var registerOfflineCb = function (cb) { | |
| 132 | + if (cb) | |
| 133 | + offlineCallbacks.push(cb); | |
| 134 | + }; | |
| 135 | + | |
| 136 | + return { | |
| 137 | + fixedTimeRefresh: fixedTimeRefresh, | |
| 138 | + registerCallback: registerCallback, | |
| 139 | + allGps: realData, | |
| 140 | + gpsByLineCode: gpsByLineCode, | |
| 141 | + findOne: findOne, | |
| 142 | + findGpsByNbbm: findGpsByNbbm, | |
| 143 | + deviceOffline: deviceOffline, | |
| 144 | + registerOfflineCb: registerOfflineCb | |
| 145 | + }; | |
| 146 | +})(); | ... | ... |
src/main/resources/static/real_control_v2/mapmonitor/fragments/map_infowindow.html
| ... | ... | @@ -28,6 +28,21 @@ |
| 28 | 28 | {{/if}} |
| 29 | 29 | </p> |
| 30 | 30 | <p>设备号:{{deviceId}}</p> |
| 31 | + {{if sch!=null}} | |
| 32 | + <div> | |
| 33 | + <span class="field">驾驶员:</span>{{sch.jGh}}/{{sch.jName}} | |
| 34 | + </div> | |
| 35 | + {{if sch.mobile!=null && sch.mobile!=""}} | |
| 36 | + <div> | |
| 37 | + <span class="field">电话:</span>{{sch.mobile}} | |
| 38 | + </div> | |
| 39 | + {{/if}} | |
| 40 | + {{if sch.sGh!=null && sch.sGh!=""}} | |
| 41 | + <div> | |
| 42 | + <span class="field">售票员:</span>{{sch.sGh}}/{{sch.sName}} | |
| 43 | + </div> | |
| 44 | + {{/if}} | |
| 45 | + {{/if}} | |
| 31 | 46 | <p>速度:{{speed>99?'..':speed}}</p> |
| 32 | 47 | <p>角度:{{direction}}</p> |
| 33 | 48 | <p>经度:{{lon}}</p> | ... | ... |
src/main/resources/static/real_control_v2/mapmonitor/js/map/platform/baidu.js
| ... | ... | @@ -282,7 +282,7 @@ var gb_map_baidu = (function(){ |
| 282 | 282 | //绘制多边形 |
| 283 | 283 | drawPolygon: function(opt){ |
| 284 | 284 | var station = opt.station |
| 285 | - ,code = station.stationCode; | |
| 285 | + ,code = station.stationRouteId; | |
| 286 | 286 | if(electronicFences[code]){ |
| 287 | 287 | electronicFences[code].show(); |
| 288 | 288 | return; | ... | ... |
src/main/resources/static/real_control_v2/mapmonitor/js/map/platform/gaode.js
| ... | ... | @@ -168,7 +168,7 @@ var gb_map_gaode = (function() { |
| 168 | 168 | //绘制多边形 |
| 169 | 169 | drawPolygon: function(opt){ |
| 170 | 170 | var station = opt.station |
| 171 | - ,code = station.stationCode; | |
| 171 | + ,code = station.stationRouteId; | |
| 172 | 172 | if(electronicFences[code]){ |
| 173 | 173 | electronicFences[code].show(); |
| 174 | 174 | return; | ... | ... |
src/main/resources/static/real_control_v2/mapmonitor/js/map_overlay_manager.js
| 1 | -var gb_map_overlay_mge = (function () { | |
| 2 | - | |
| 3 | - var storage = window.localStorage; | |
| 4 | - | |
| 5 | - var temps; | |
| 6 | - $.get('/real_control_v2/mapmonitor/fragments/map_infowindow.html', function (dom) { | |
| 7 | - temps = gb_common.compileTempByDom(dom, {compress: true}); | |
| 8 | - }); | |
| 9 | - | |
| 10 | - var $abnormNoticePanel = $('.c_b_abnorm_notice'); | |
| 11 | - var gpsRefresh = function (addArr, upArr, upDownChange, overspeedList) { | |
| 12 | - if(!$('.main-container .map-panel').is(':visible')) | |
| 13 | - return; | |
| 14 | - //如果地图正在重绘,暂时不刷新GPS | |
| 15 | - if(reDrawing) | |
| 16 | - return; | |
| 17 | - //var all = addArr.concat(upArr).concat(upDownChange); | |
| 18 | - gpsRefreshAll(addArr, upArr, upDownChange); | |
| 19 | - | |
| 20 | - //渲染超速信息 | |
| 21 | - overspeedList.sort(overspeed_sort); | |
| 22 | - var htmlStr = template('map_abnorm_overspeed_list-temp', {list: overspeedList}); | |
| 23 | - $abnormNoticePanel.html(htmlStr).scrollTop($abnormNoticePanel[0].scrollHeight); | |
| 24 | - }; | |
| 25 | - | |
| 26 | - var overspeed_sort = function (a, b) { | |
| 27 | - if(a.ets && !b.ets) | |
| 28 | - return -1; | |
| 29 | - if(!a.ets && b.ets) | |
| 30 | - return 1; | |
| 31 | - return a.st - b.st; | |
| 32 | - }; | |
| 33 | - | |
| 34 | - /** | |
| 35 | - * 超速点击 | |
| 36 | - */ | |
| 37 | - $abnormNoticePanel.on('click', '.c_b_item', function () { | |
| 38 | - var nbbm = $(this).data('nbbm'); | |
| 39 | - gb_map_gps_tree.selectitem(null, {value: nbbm}); | |
| 40 | - }); | |
| 41 | - | |
| 42 | - var gpsRefreshAll = function (addArr, upArr, upDownChange) { | |
| 43 | - //更新设备树菜单 | |
| 44 | - if(gb_map_gps_tree.readyStatus()){ | |
| 45 | - gb_map_gps_tree.create_node(addArr); | |
| 46 | - gb_map_gps_tree.update_node(upArr); | |
| 47 | - gb_map_gps_tree.changeUpDown(upDownChange); | |
| 48 | - } | |
| 49 | - | |
| 50 | - //更新地图 | |
| 51 | - var all = addArr.concat(upArr).concat(upDownChange); | |
| 52 | - gb_map_imap.call('drawRealGpsMarker', {gpsList: all}); | |
| 53 | - }; | |
| 54 | - | |
| 55 | - var reload_gps = function () { | |
| 56 | - var array = gb_common.get_vals(gb_data_gps.allGps); | |
| 57 | - gb_map_gps_tree.refresh(); | |
| 58 | - gb_map_imap.call('drawRealGpsMarker', {gpsList: array}); | |
| 59 | - }; | |
| 60 | - | |
| 61 | - var deviceFilter = function (node) { | |
| 62 | - return node.a_attr && node.a_attr.type=='device'; | |
| 63 | - }; | |
| 64 | - | |
| 65 | - //绘制线路走向 | |
| 66 | - var drawAllSection=function () { | |
| 67 | - //绘制线路走向 | |
| 68 | - var lines=JSON.parse(storage.getItem('lineControlItems')); | |
| 69 | - $.each(lines, function () { | |
| 70 | - //从storage里获取路由数据 | |
| 71 | - var lineCode=this.lineCode; | |
| 72 | - var route = JSON.parse(storage.getItem(lineCode + '_route')); | |
| 73 | - //上行 | |
| 74 | - gb_map_imap.call('drawLine', { | |
| 75 | - route: route, | |
| 76 | - style: {strokeWeight:6, strokeColor: gb_map_config.getConfig().section.color.up}, | |
| 77 | - id: lineCode+'_0', | |
| 78 | - upDown: 0, | |
| 79 | - hide: true | |
| 80 | - }); | |
| 81 | - //下行 | |
| 82 | - gb_map_imap.call('drawLine', { | |
| 83 | - route: route, | |
| 84 | - style: {strokeWeight:6, strokeColor: gb_map_config.getConfig().section.color.down}, | |
| 85 | - id: lineCode+'_1', | |
| 86 | - upDown: 1, | |
| 87 | - hide: true | |
| 88 | - }); | |
| 89 | - | |
| 90 | - }); | |
| 91 | - }; | |
| 92 | - | |
| 93 | - //根据选中项显示路段 | |
| 94 | - var showSection = function (chs) { | |
| 95 | - var idx = {}; | |
| 96 | - $.each(chs, function () { | |
| 97 | - idx[this.data.lineId+'_'+this.data.upDown]=1; | |
| 98 | - }); | |
| 99 | - | |
| 100 | - gb_map_imap.call('refreshPolyline', {idx: gb_common.get_keys(idx)}); | |
| 101 | - }; | |
| 102 | - | |
| 103 | - | |
| 104 | - //是否正在重绘 | |
| 105 | - var reDrawing; | |
| 106 | - var reDraw = function () { | |
| 107 | - reDrawing = true; | |
| 108 | - | |
| 109 | - gb_map_imap.call('clearAll'); | |
| 110 | - | |
| 111 | - try{ | |
| 112 | - drawAllSection(); | |
| 113 | - }catch (e){ | |
| 114 | - console.log(e); | |
| 115 | - } | |
| 116 | - //重绘GPS | |
| 117 | - gb_map_imap.call('drawRealGpsMarker', {gpsList: gb_common.get_vals(gb_data_gps.allGps)}); | |
| 118 | - | |
| 119 | - showOverlayByChecks(); | |
| 120 | - //显示路段 | |
| 121 | - showSection(getCheckedDevice()); | |
| 122 | - | |
| 123 | - reDrawing = false; | |
| 124 | - }; | |
| 125 | - | |
| 126 | - //重绘GPS | |
| 127 | - var reDrawGps = function () { | |
| 128 | - reDrawing = true; | |
| 129 | - gb_map_imap.call('clearAllGps'); | |
| 130 | - //重绘GPS | |
| 131 | - gb_map_imap.call('drawRealGpsMarker', {gpsList: gb_common.get_vals(gb_data_gps.allGps)}); | |
| 132 | - | |
| 133 | - showOverlayByChecks(); | |
| 134 | - reDrawing = false; | |
| 135 | - }; | |
| 136 | - | |
| 137 | - var init = function () { | |
| 138 | - reDraw(); | |
| 139 | - //注册GPS刷新事件 | |
| 140 | - gb_data_gps.registerCallback(gpsRefresh); | |
| 141 | - | |
| 142 | - centerToRational(); | |
| 143 | - }; | |
| 144 | - | |
| 145 | - | |
| 146 | - var showOverlayByChecks = function () { | |
| 147 | - var chs = getCheckedDevice(),chsMap={}; | |
| 148 | - $.each(chs, function () { | |
| 149 | - chsMap[this.a_attr.device]=true; | |
| 150 | - }); | |
| 151 | - | |
| 152 | - gb_map_imap.call('showGpsMarker', {chs: chsMap}); | |
| 153 | - | |
| 154 | - //路段 | |
| 155 | - showSection(chs); | |
| 156 | - | |
| 157 | - }; | |
| 158 | - | |
| 159 | - var _focus = function (deviceId) { | |
| 160 | - gb_map_imap.call('goToMarker', {deviceId: deviceId}); | |
| 161 | - //打开信息窗口 | |
| 162 | - gb_map_imap.call('openWindow',{deviceId: deviceId}); | |
| 163 | - }; | |
| 164 | - | |
| 165 | - //站点获得焦点 | |
| 166 | - var _focus_station = function (station) { | |
| 167 | - gb_map_imap.call('goToStation', station.stationCode); | |
| 168 | - }; | |
| 169 | - | |
| 170 | - //停车场获得焦点 | |
| 171 | - var _focus_carpark = function (carpark) { | |
| 172 | - //console.log('_focus_carpark', carpark); | |
| 173 | - gb_map_imap.call('goToCarpark', carpark.parkCode); | |
| 174 | - }; | |
| 175 | - | |
| 176 | - function getCheckedDevice() { | |
| 177 | - return gb_map_gps_tree.getChecked().filter(deviceFilter); | |
| 178 | - } | |
| 179 | - | |
| 180 | - //绘制站点 | |
| 181 | - var drawStation = function () { | |
| 182 | - var list = gb_map_spatial_data.getCheckedStation(); | |
| 183 | - //绘制站点 | |
| 184 | - gb_map_imap.call('drawStationMarker', {list: list}); | |
| 185 | - //绘制电子围栏 | |
| 186 | - drawElectronicFence(list); | |
| 187 | - }; | |
| 188 | - | |
| 189 | - //绘制电子围栏 | |
| 190 | - var drawElectronicFence = function (list) { | |
| 191 | - var config = gb_map_config.getConfig().spatialData; | |
| 192 | - if(!config.electronicFence) | |
| 193 | - return; | |
| 194 | - | |
| 195 | - if(!list){ | |
| 196 | - list = gb_map_spatial_data.getCheckedStation(); | |
| 197 | - } | |
| 198 | - | |
| 199 | - | |
| 200 | - gb_map_imap.call('hideAllCircles'); | |
| 201 | - $.each(list, function () { | |
| 202 | - fun=this.shapesType=='r'?drawCircle:drawPolygon; | |
| 203 | - fun(this); | |
| 204 | - }); | |
| 205 | - }; | |
| 206 | - | |
| 207 | - //绘制停车场 | |
| 208 | - var drawCarpark = function () { | |
| 209 | - var list = gb_map_spatial_data.gteCheckedCarpark(); | |
| 210 | - gb_map_imap.call('drawCarpark', {list: list}); | |
| 211 | - }; | |
| 212 | - | |
| 213 | - var drawCircle=function (data) { | |
| 214 | - var config = gb_map_config.getConfig().section.color; | |
| 215 | - var color = data.directions==0?config.up:config.down; | |
| 216 | - | |
| 217 | - var opt = { | |
| 218 | - lon: data.lon, | |
| 219 | - lat: data.lat, | |
| 220 | - text: data.stationName, | |
| 221 | - color: color, | |
| 222 | - weight: 2, | |
| 223 | - radius: parseFloat(data.radius), | |
| 224 | - id: data.stationCode | |
| 225 | - }; | |
| 226 | - | |
| 227 | - gb_map_imap.call('drawCircle', opt); | |
| 228 | - }; | |
| 229 | - | |
| 230 | - var drawPolygon=function (data) { | |
| 231 | - var config = gb_map_config.getConfig().section.color; | |
| 232 | - var color = data.directions==0?config.up:config.down; | |
| 233 | - | |
| 234 | - var opt = { | |
| 235 | - //id:data.stationCode, | |
| 236 | - color: color, | |
| 237 | - weight: 2, | |
| 238 | - station: data | |
| 239 | - }; | |
| 240 | - | |
| 241 | - gb_map_imap.call('drawPolygon', opt); | |
| 242 | - }; | |
| 243 | - | |
| 244 | - //地图居中至合理的位置 | |
| 245 | - var centerToRational=function () { | |
| 246 | - var chs=getCheckedDevice(); | |
| 247 | - if(chs && chs.length > 0){ | |
| 248 | - var id=chs[0].data.lineId+'_'+chs[0].data.upDown; | |
| 249 | - gb_map_imap.call('centerToLine', {id: id}); | |
| 250 | - } | |
| 251 | - }; | |
| 252 | - | |
| 253 | - return { | |
| 254 | - init: init, | |
| 255 | - refresh: showOverlayByChecks, | |
| 256 | - _focus: _focus, | |
| 257 | - _focus_station: _focus_station, | |
| 258 | - _focus_carpark: _focus_carpark, | |
| 259 | - map_gps_win_temp: function (data) { | |
| 260 | - var url='http://58.247.254.118:9999/pf/getPassengerFlow?deviceId='+data.deviceId; | |
| 261 | - console.log(url); | |
| 262 | - $.ajax({async:false,url:url, success:function(res) { | |
| 263 | - console.log(res); | |
| 264 | - data.num=res.num; | |
| 265 | - data.photo=res.photo; | |
| 266 | - }}) | |
| 267 | - console.log("数据回显"); | |
| 268 | - return temps['map-win-gps-detail-temp'](data); | |
| 269 | - }, | |
| 270 | - map_station_win_temp: function (data) { | |
| 271 | - return temps['map-win-station-detail-temp'](data); | |
| 272 | - }, | |
| 273 | - map_carpark_win_temp: function (data) { | |
| 274 | - return temps['map-win-carpark-detail-temp'](data); | |
| 275 | - }, | |
| 276 | - reDraw: reDraw, | |
| 277 | - reDrawGps: reDrawGps, | |
| 278 | - getCheckedDevice: getCheckedDevice, | |
| 279 | - drawStation: drawStation, | |
| 280 | - drawElectronicFence: drawElectronicFence, | |
| 281 | - drawCarpark: drawCarpark, | |
| 282 | - centerToRational:centerToRational, | |
| 283 | - reload_gps: reload_gps | |
| 284 | - }; | |
| 1 | +var gb_map_overlay_mge = (function () { | |
| 2 | + | |
| 3 | + var storage = window.localStorage; | |
| 4 | + | |
| 5 | + var temps; | |
| 6 | + $.get('/real_control_v2/mapmonitor/fragments/map_infowindow.html', function (dom) { | |
| 7 | + temps = gb_common.compileTempByDom(dom, {compress: true}); | |
| 8 | + }); | |
| 9 | + | |
| 10 | + var $abnormNoticePanel = $('.c_b_abnorm_notice'); | |
| 11 | + var gpsRefresh = function (addArr, upArr, upDownChange, overspeedList) { | |
| 12 | + if(!$('.main-container .map-panel').is(':visible')) | |
| 13 | + return; | |
| 14 | + //如果地图正在重绘,暂时不刷新GPS | |
| 15 | + if(reDrawing) | |
| 16 | + return; | |
| 17 | + //var all = addArr.concat(upArr).concat(upDownChange); | |
| 18 | + gpsRefreshAll(addArr, upArr, upDownChange); | |
| 19 | + | |
| 20 | + //渲染超速信息 | |
| 21 | + overspeedList.sort(overspeed_sort); | |
| 22 | + var htmlStr = template('map_abnorm_overspeed_list-temp', {list: overspeedList}); | |
| 23 | + $abnormNoticePanel.html(htmlStr).scrollTop($abnormNoticePanel[0].scrollHeight); | |
| 24 | + }; | |
| 25 | + | |
| 26 | + var overspeed_sort = function (a, b) { | |
| 27 | + if(a.ets && !b.ets) | |
| 28 | + return -1; | |
| 29 | + if(!a.ets && b.ets) | |
| 30 | + return 1; | |
| 31 | + return a.st - b.st; | |
| 32 | + }; | |
| 33 | + | |
| 34 | + /** | |
| 35 | + * 超速点击 | |
| 36 | + */ | |
| 37 | + $abnormNoticePanel.on('click', '.c_b_item', function () { | |
| 38 | + var nbbm = $(this).data('nbbm'); | |
| 39 | + gb_map_gps_tree.selectitem(null, {value: nbbm}); | |
| 40 | + }); | |
| 41 | + | |
| 42 | + var gpsRefreshAll = function (addArr, upArr, upDownChange) { | |
| 43 | + //更新设备树菜单 | |
| 44 | + if(gb_map_gps_tree.readyStatus()){ | |
| 45 | + gb_map_gps_tree.create_node(addArr); | |
| 46 | + gb_map_gps_tree.update_node(upArr); | |
| 47 | + gb_map_gps_tree.changeUpDown(upDownChange); | |
| 48 | + } | |
| 49 | + | |
| 50 | + //更新地图 | |
| 51 | + var all = addArr.concat(upArr).concat(upDownChange); | |
| 52 | + gb_map_imap.call('drawRealGpsMarker', {gpsList: all}); | |
| 53 | + }; | |
| 54 | + | |
| 55 | + var reload_gps = function () { | |
| 56 | + var array = gb_common.get_vals(gb_data_gps.allGps); | |
| 57 | + gb_map_gps_tree.refresh(); | |
| 58 | + gb_map_imap.call('drawRealGpsMarker', {gpsList: array}); | |
| 59 | + }; | |
| 60 | + | |
| 61 | + var deviceFilter = function (node) { | |
| 62 | + return node.a_attr && node.a_attr.type=='device'; | |
| 63 | + }; | |
| 64 | + | |
| 65 | + //绘制线路走向 | |
| 66 | + var drawAllSection=function () { | |
| 67 | + //绘制线路走向 | |
| 68 | + var lines=JSON.parse(storage.getItem('lineControlItems')); | |
| 69 | + $.each(lines, function () { | |
| 70 | + //从storage里获取路由数据 | |
| 71 | + var lineCode=this.lineCode; | |
| 72 | + var route = JSON.parse(storage.getItem(lineCode + '_route')); | |
| 73 | + //上行 | |
| 74 | + gb_map_imap.call('drawLine', { | |
| 75 | + route: route, | |
| 76 | + style: {strokeWeight:6, strokeColor: gb_map_config.getConfig().section.color.up}, | |
| 77 | + id: lineCode+'_0', | |
| 78 | + upDown: 0, | |
| 79 | + hide: true | |
| 80 | + }); | |
| 81 | + //下行 | |
| 82 | + gb_map_imap.call('drawLine', { | |
| 83 | + route: route, | |
| 84 | + style: {strokeWeight:6, strokeColor: gb_map_config.getConfig().section.color.down}, | |
| 85 | + id: lineCode+'_1', | |
| 86 | + upDown: 1, | |
| 87 | + hide: true | |
| 88 | + }); | |
| 89 | + | |
| 90 | + }); | |
| 91 | + }; | |
| 92 | + | |
| 93 | + //根据选中项显示路段 | |
| 94 | + var showSection = function (chs) { | |
| 95 | + var idx = {}; | |
| 96 | + $.each(chs, function () { | |
| 97 | + idx[this.data.lineId+'_'+this.data.upDown]=1; | |
| 98 | + }); | |
| 99 | + | |
| 100 | + gb_map_imap.call('refreshPolyline', {idx: gb_common.get_keys(idx)}); | |
| 101 | + }; | |
| 102 | + | |
| 103 | + | |
| 104 | + //是否正在重绘 | |
| 105 | + var reDrawing; | |
| 106 | + var reDraw = function () { | |
| 107 | + reDrawing = true; | |
| 108 | + | |
| 109 | + gb_map_imap.call('clearAll'); | |
| 110 | + | |
| 111 | + try{ | |
| 112 | + drawAllSection(); | |
| 113 | + }catch (e){ | |
| 114 | + console.log(e); | |
| 115 | + } | |
| 116 | + //重绘GPS | |
| 117 | + gb_map_imap.call('drawRealGpsMarker', {gpsList: gb_common.get_vals(gb_data_gps.allGps)}); | |
| 118 | + | |
| 119 | + showOverlayByChecks(); | |
| 120 | + //显示路段 | |
| 121 | + showSection(getCheckedDevice()); | |
| 122 | + | |
| 123 | + reDrawing = false; | |
| 124 | + }; | |
| 125 | + | |
| 126 | + //重绘GPS | |
| 127 | + var reDrawGps = function () { | |
| 128 | + reDrawing = true; | |
| 129 | + gb_map_imap.call('clearAllGps'); | |
| 130 | + //重绘GPS | |
| 131 | + gb_map_imap.call('drawRealGpsMarker', {gpsList: gb_common.get_vals(gb_data_gps.allGps)}); | |
| 132 | + | |
| 133 | + showOverlayByChecks(); | |
| 134 | + reDrawing = false; | |
| 135 | + }; | |
| 136 | + | |
| 137 | + var init = function () { | |
| 138 | + reDraw(); | |
| 139 | + //注册GPS刷新事件 | |
| 140 | + gb_data_gps.registerCallback(gpsRefresh); | |
| 141 | + | |
| 142 | + centerToRational(); | |
| 143 | + }; | |
| 144 | + | |
| 145 | + | |
| 146 | + var showOverlayByChecks = function () { | |
| 147 | + var chs = getCheckedDevice(),chsMap={}; | |
| 148 | + $.each(chs, function () { | |
| 149 | + chsMap[this.a_attr.device]=true; | |
| 150 | + }); | |
| 151 | + | |
| 152 | + gb_map_imap.call('showGpsMarker', {chs: chsMap}); | |
| 153 | + | |
| 154 | + //路段 | |
| 155 | + showSection(chs); | |
| 156 | + | |
| 157 | + }; | |
| 158 | + | |
| 159 | + var _focus = function (deviceId) { | |
| 160 | + gb_map_imap.call('goToMarker', {deviceId: deviceId}); | |
| 161 | + //打开信息窗口 | |
| 162 | + gb_map_imap.call('openWindow',{deviceId: deviceId}); | |
| 163 | + }; | |
| 164 | + | |
| 165 | + //站点获得焦点 | |
| 166 | + var _focus_station = function (station) { | |
| 167 | + gb_map_imap.call('goToStation', station.stationCode); | |
| 168 | + }; | |
| 169 | + | |
| 170 | + //停车场获得焦点 | |
| 171 | + var _focus_carpark = function (carpark) { | |
| 172 | + //console.log('_focus_carpark', carpark); | |
| 173 | + gb_map_imap.call('goToCarpark', carpark.parkCode); | |
| 174 | + }; | |
| 175 | + | |
| 176 | + function getCheckedDevice() { | |
| 177 | + return gb_map_gps_tree.getChecked().filter(deviceFilter); | |
| 178 | + } | |
| 179 | + | |
| 180 | + //绘制站点 | |
| 181 | + var drawStation = function () { | |
| 182 | + var list = gb_map_spatial_data.getCheckedStation(); | |
| 183 | + //绘制站点 | |
| 184 | + gb_map_imap.call('drawStationMarker', {list: list}); | |
| 185 | + //绘制电子围栏 | |
| 186 | + drawElectronicFence(list); | |
| 187 | + }; | |
| 188 | + | |
| 189 | + //绘制电子围栏 | |
| 190 | + var drawElectronicFence = function (list) { | |
| 191 | + var config = gb_map_config.getConfig().spatialData; | |
| 192 | + if(!config.electronicFence) | |
| 193 | + return; | |
| 194 | + | |
| 195 | + if(!list){ | |
| 196 | + list = gb_map_spatial_data.getCheckedStation(); | |
| 197 | + } | |
| 198 | + | |
| 199 | + | |
| 200 | + gb_map_imap.call('hideAllCircles'); | |
| 201 | + $.each(list, function () { | |
| 202 | + fun=this.shapesType=='r'?drawCircle:drawPolygon; | |
| 203 | + fun(this); | |
| 204 | + }); | |
| 205 | + }; | |
| 206 | + | |
| 207 | + //绘制停车场 | |
| 208 | + var drawCarpark = function () { | |
| 209 | + var list = gb_map_spatial_data.gteCheckedCarpark(); | |
| 210 | + gb_map_imap.call('drawCarpark', {list: list}); | |
| 211 | + }; | |
| 212 | + | |
| 213 | + var drawCircle=function (data) { | |
| 214 | + var config = gb_map_config.getConfig().section.color; | |
| 215 | + var color = data.directions==0?config.up:config.down; | |
| 216 | + | |
| 217 | + var opt = { | |
| 218 | + lon: data.lon, | |
| 219 | + lat: data.lat, | |
| 220 | + text: data.stationName, | |
| 221 | + color: color, | |
| 222 | + weight: 2, | |
| 223 | + radius: parseFloat(data.radius), | |
| 224 | + id: data.stationRouteId | |
| 225 | + }; | |
| 226 | + | |
| 227 | + gb_map_imap.call('drawCircle', opt); | |
| 228 | + }; | |
| 229 | + | |
| 230 | + var drawPolygon=function (data) { | |
| 231 | + var config = gb_map_config.getConfig().section.color; | |
| 232 | + var color = data.directions==0?config.up:config.down; | |
| 233 | + | |
| 234 | + var opt = { | |
| 235 | + //id:data.stationCode, | |
| 236 | + color: color, | |
| 237 | + weight: 2, | |
| 238 | + station: data | |
| 239 | + }; | |
| 240 | + | |
| 241 | + gb_map_imap.call('drawPolygon', opt); | |
| 242 | + }; | |
| 243 | + | |
| 244 | + //地图居中至合理的位置 | |
| 245 | + var centerToRational=function () { | |
| 246 | + var chs=getCheckedDevice(); | |
| 247 | + if(chs && chs.length > 0){ | |
| 248 | + var id=chs[0].data.lineId+'_'+chs[0].data.upDown; | |
| 249 | + gb_map_imap.call('centerToLine', {id: id}); | |
| 250 | + } | |
| 251 | + }; | |
| 252 | + | |
| 253 | + return { | |
| 254 | + init: init, | |
| 255 | + refresh: showOverlayByChecks, | |
| 256 | + _focus: _focus, | |
| 257 | + _focus_station: _focus_station, | |
| 258 | + _focus_carpark: _focus_carpark, | |
| 259 | + map_gps_win_temp: function (data) { | |
| 260 | + var url='http://58.247.254.118:9999/pf/getPassengerFlow?deviceId='+data.deviceId; | |
| 261 | + console.log(url); | |
| 262 | + $.ajax({async:false,url:url, success:function(res) { | |
| 263 | + console.log(res); | |
| 264 | + data.num=res.num; | |
| 265 | + data.photo=res.photo; | |
| 266 | + }}) | |
| 267 | + console.log("数据回显"); | |
| 268 | + return temps['map-win-gps-detail-temp'](data); | |
| 269 | + }, | |
| 270 | + map_station_win_temp: function (data) { | |
| 271 | + return temps['map-win-station-detail-temp'](data); | |
| 272 | + }, | |
| 273 | + map_carpark_win_temp: function (data) { | |
| 274 | + return temps['map-win-carpark-detail-temp'](data); | |
| 275 | + }, | |
| 276 | + reDraw: reDraw, | |
| 277 | + reDrawGps: reDrawGps, | |
| 278 | + getCheckedDevice: getCheckedDevice, | |
| 279 | + drawStation: drawStation, | |
| 280 | + drawElectronicFence: drawElectronicFence, | |
| 281 | + drawCarpark: drawCarpark, | |
| 282 | + centerToRational:centerToRational, | |
| 283 | + reload_gps: reload_gps | |
| 284 | + }; | |
| 285 | 285 | })(); |
| 286 | 286 | \ No newline at end of file | ... | ... |