Commit 2a6aa1cdd4618c2bf1015d06e2585a3f10a249e0
Merge branch 'minhang' of 192.168.168.201:panzhaov5/bsth_control into minhang
Showing
52 changed files
with
2320 additions
and
664 deletions
Too many changes to show.
To preserve performance only 52 of 162 files are displayed.
pom.xml
| ... | ... | @@ -220,11 +220,11 @@ |
| 220 | 220 | <version>1.1</version> |
| 221 | 221 | </dependency> |
| 222 | 222 | |
| 223 | - <dependency> | |
| 223 | +<!-- <dependency> | |
| 224 | 224 | <groupId>org.springframework.boot</groupId> |
| 225 | 225 | <artifactId>spring-boot-devtools</artifactId> |
| 226 | 226 | <optional>true</optional> |
| 227 | - </dependency> | |
| 227 | + </dependency>--> | |
| 228 | 228 | </dependencies> |
| 229 | 229 | |
| 230 | 230 | <dependencyManagement> | ... | ... |
src/main/java/com/bsth/common/Constants.java
| ... | ... | @@ -24,11 +24,13 @@ public class Constants { |
| 24 | 24 | /** |
| 25 | 25 | * 线调部分子页面不做拦截,便于浏览器缓存 |
| 26 | 26 | */ |
| 27 | - public static final String XD_CHILD_PAGES = "/real_control_v2/**"; | |
| 28 | - public static final String XD_TEMPS = "/pages/control/line/temps/**"; | |
| 27 | + public static final String XD_CHILD_PAGES = "/real_control_v2/**"; | |
| 28 | + public static final String XD_REAL_GPS = "/gps/real/line"; | |
| 29 | + //public static final String XD_TEMPS = "/pages/control/line/temps/**"; | |
| 29 | 30 | |
| 30 | 31 | //车载网关上行接口 |
| 31 | 32 | public static final String UPSTREAM_URL = "/control/upstream"; |
| 32 | 33 | |
| 33 | 34 | public static final String SESSION_USERNAME = "sessionUserName"; |
| 35 | + public static final String COMPANY_AUTHORITYS = "cmyAuths"; | |
| 34 | 36 | } | ... | ... |
src/main/java/com/bsth/controller/BaseController.java
| ... | ... | @@ -9,6 +9,7 @@ import org.springframework.data.domain.Page; |
| 9 | 9 | import org.springframework.data.domain.PageRequest; |
| 10 | 10 | import org.springframework.data.domain.Sort; |
| 11 | 11 | import org.springframework.data.domain.Sort.Direction; |
| 12 | +import org.springframework.util.CollectionUtils; | |
| 12 | 13 | import org.springframework.web.bind.annotation.PathVariable; |
| 13 | 14 | import org.springframework.web.bind.annotation.RequestMapping; |
| 14 | 15 | import org.springframework.web.bind.annotation.RequestMethod; |
| ... | ... | @@ -167,11 +168,24 @@ public class BaseController<T, ID extends Serializable> { |
| 167 | 168 | */ |
| 168 | 169 | @RequestMapping(value = "/dataExport", method = RequestMethod.GET) |
| 169 | 170 | public void dataExport(HttpServletResponse response) throws Exception { |
| 171 | + dataExport(response, null); | |
| 172 | + } | |
| 173 | + | |
| 174 | + @RequestMapping(value = "/dataExportExt", method = RequestMethod.GET) | |
| 175 | + public void dataExport(HttpServletResponse response, @RequestParam Map<String, Object> param) throws Exception { | |
| 170 | 176 | // 1、使用ktr转换获取输出文件 |
| 171 | 177 | File ktrfile = new File(this.getClass().getResource(getDataExportKtrClasspath()).toURI()); |
| 172 | - File outputfile = dataImportExportService.fileDataOutput( | |
| 173 | - getDataExportFilename(), | |
| 174 | - ktrfile); | |
| 178 | + File outputfile = null; | |
| 179 | + if (!CollectionUtils.isEmpty(param)) { | |
| 180 | + outputfile = dataImportExportService.fileDataOutput( | |
| 181 | + getDataExportFilename(), | |
| 182 | + ktrfile, | |
| 183 | + param); | |
| 184 | + } else { | |
| 185 | + outputfile = dataImportExportService.fileDataOutput( | |
| 186 | + getDataExportFilename(), | |
| 187 | + ktrfile); | |
| 188 | + } | |
| 175 | 189 | |
| 176 | 190 | System.out.println(outputfile.getName()); |
| 177 | 191 | String filePath = outputfile.getAbsolutePath(); | ... | ... |
src/main/java/com/bsth/controller/forms/ExportController.java
0 → 100644
| 1 | +package com.bsth.controller.forms; | |
| 2 | + | |
| 3 | +import java.text.SimpleDateFormat; | |
| 4 | +import java.util.ArrayList; | |
| 5 | +import java.util.HashMap; | |
| 6 | +import java.util.Iterator; | |
| 7 | +import java.util.List; | |
| 8 | +import java.util.Map; | |
| 9 | + | |
| 10 | +import org.springframework.beans.factory.annotation.Autowired; | |
| 11 | +import org.springframework.web.bind.annotation.RequestMapping; | |
| 12 | +import org.springframework.web.bind.annotation.RequestMethod; | |
| 13 | +import org.springframework.web.bind.annotation.RequestParam; | |
| 14 | +import org.springframework.web.bind.annotation.RestController; | |
| 15 | + | |
| 16 | +import com.bsth.entity.mcy_forms.Changetochange; | |
| 17 | +import com.bsth.entity.mcy_forms.Linepasswengerflow; | |
| 18 | +import com.bsth.entity.mcy_forms.Operationservice; | |
| 19 | +import com.bsth.entity.mcy_forms.Shifday; | |
| 20 | +import com.bsth.entity.mcy_forms.Shiftuehiclemanth; | |
| 21 | +import com.bsth.entity.mcy_forms.Singledata; | |
| 22 | +import com.bsth.entity.mcy_forms.Vehicleloading; | |
| 23 | +import com.bsth.entity.mcy_forms.Waybillday; | |
| 24 | +import com.bsth.service.forms.ExportService; | |
| 25 | +import com.bsth.service.forms.FormsService; | |
| 26 | +import com.bsth.util.ReportUtils; | |
| 27 | + | |
| 28 | +@RestController | |
| 29 | +@RequestMapping("mcy_export") | |
| 30 | +public class ExportController { | |
| 31 | + | |
| 32 | + @Autowired | |
| 33 | + FormsService formsService; | |
| 34 | + | |
| 35 | + @Autowired | |
| 36 | + ExportService exportService; | |
| 37 | + | |
| 38 | + //行车路单日报表 | |
| 39 | + @RequestMapping(value = "/waybilldayExport",method = RequestMethod.POST) | |
| 40 | + public List<Waybillday> waybilldayExport(@RequestParam Map<String, Object> map){ | |
| 41 | + List<Waybillday> waybillday = formsService.waybillday(map); | |
| 42 | + exportService.waybillday(map.get("date").toString(), waybillday); | |
| 43 | + return waybillday; | |
| 44 | + } | |
| 45 | + | |
| 46 | + | |
| 47 | + //线路客流量报表 | |
| 48 | + @RequestMapping(value = "/linepasswengerflowExport",method = RequestMethod.POST) | |
| 49 | + public List<Map<String, Object>> linepasswengerflowExport(@RequestParam Map<String, Object> map){ | |
| 50 | + SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"), | |
| 51 | + sdfSimple = new SimpleDateFormat("yyyyMMdd"); | |
| 52 | + List<Iterator<?>> listI = new ArrayList<Iterator<?>>(); | |
| 53 | + ReportUtils ee = new ReportUtils(); | |
| 54 | + List<Linepasswengerflow> linepasswengerflow = formsService.linepasswengerflow(map); | |
| 55 | + List<Map<String, Object>> resList = new ArrayList<Map<String, Object>>(); | |
| 56 | + int i=1; | |
| 57 | + for(Linepasswengerflow l : linepasswengerflow){ | |
| 58 | + Map<String, Object> m = new HashMap<String, Object>(); | |
| 59 | + m.put("i", i); | |
| 60 | + m.put("stationName", l.getStationName()); | |
| 61 | + m.put("1", " "); | |
| 62 | + m.put("2", " "); | |
| 63 | + resList.add(m); | |
| 64 | + i++; | |
| 65 | + } | |
| 66 | + | |
| 67 | + try { | |
| 68 | + listI.add(resList.iterator()); | |
| 69 | + String path = this.getClass().getResource("/").getPath()+"static\\pages\\forms\\"; | |
| 70 | + ee.excelReplace(listI, new Object[] { map }, path+"mould\\linepassengerflow.xls", | |
| 71 | + path+"export\\线路客流量报表" + sdfSimple.format(sdfMonth.parse(map.get("date").toString())) + ".xls"); | |
| 72 | + } catch (Exception e) { | |
| 73 | + e.printStackTrace(); | |
| 74 | + } | |
| 75 | + return resList; | |
| 76 | + } | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + //班次车辆人员日统计 | |
| 81 | + @RequestMapping(value = "/shifdayExport",method = RequestMethod.POST) | |
| 82 | + public List<Map<String, Object>> shifdayExport(@RequestParam Map<String, Object> map){ | |
| 83 | + SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"), | |
| 84 | + sdfSimple = new SimpleDateFormat("yyyyMMdd"); | |
| 85 | + List<Iterator<?>> listI = new ArrayList<Iterator<?>>(); | |
| 86 | + ReportUtils ee = new ReportUtils(); | |
| 87 | + List<Shifday> shifday = formsService.shifday(map); | |
| 88 | + List<Map<String, Object>> resList = new ArrayList<Map<String, Object>>(); | |
| 89 | + for(Shifday l : shifday){ | |
| 90 | + Map<String, Object> m = new HashMap<String, Object>(); | |
| 91 | + m.put("jName",l.getjName()); | |
| 92 | + m.put("sName", l.getsName()); | |
| 93 | + m.put("lpName", l.getLpName()); | |
| 94 | + m.put("carPlate", l.getCarPlate()); | |
| 95 | + m.put("jhlc", l.getJhlc()); | |
| 96 | + //m.put("sjjhlc", l.getSjjhlc()); | |
| 97 | + m.put("yygl", l.getYygl()); | |
| 98 | + m.put("emptMileage", l.getEmptMileage()); | |
| 99 | + m.put("remMileage", l.getRemMileage()); | |
| 100 | + m.put("addMileage", l.getAddMileage()); | |
| 101 | + m.put("totalm", l.getTotalm()); | |
| 102 | + m.put("jhbc", l.getJhbc()); | |
| 103 | + //m.put("sjjhbc", l.getSjjhbc()); | |
| 104 | + m.put("cjbc", l.getCjbc()); | |
| 105 | + m.put("ljbc", l.getLjbc()); | |
| 106 | + m.put("sjbc", l.getSjbc()); | |
| 107 | + resList.add(m); | |
| 108 | + } | |
| 109 | + | |
| 110 | + try { | |
| 111 | + listI.add(resList.iterator()); | |
| 112 | + String path = this.getClass().getResource("/").getPath()+"static\\pages\\forms\\"; | |
| 113 | + ee.excelReplace(listI, new Object[] { map }, path+"mould\\shifday.xls", | |
| 114 | + path+"export\\班次车辆人员日报表" + sdfSimple.format(sdfMonth.parse(map.get("date").toString())) + ".xls"); | |
| 115 | + } catch (Exception e) { | |
| 116 | + e.printStackTrace(); | |
| 117 | + } | |
| 118 | + return resList; | |
| 119 | + } | |
| 120 | + | |
| 121 | + //班次车辆人员月统计 | |
| 122 | + @RequestMapping(value = "/shiftuehiclemanthExport",method = RequestMethod.POST) | |
| 123 | + public List<Map<String, Object>> shiftuehiclemanthExport(@RequestParam Map<String, Object> map){ | |
| 124 | + SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"), | |
| 125 | + sdfSimple = new SimpleDateFormat("yyyyMMdd"); | |
| 126 | + List<Iterator<?>> listI = new ArrayList<Iterator<?>>(); | |
| 127 | + ReportUtils ee = new ReportUtils(); | |
| 128 | + List<Shiftuehiclemanth> shiftuehiclemanth = formsService.shiftuehiclemanth(map); | |
| 129 | + List<Map<String, Object>> resList = new ArrayList<Map<String, Object>>(); | |
| 130 | + int i=1; | |
| 131 | + for(Shiftuehiclemanth l : shiftuehiclemanth){ | |
| 132 | + Map<String, Object> m = new HashMap<String, Object>(); | |
| 133 | + m.put("i", i); | |
| 134 | + m.put("jName",l.getjName() ); | |
| 135 | + m.put("jhlc", l.getJhlc()); | |
| 136 | + m.put("emptMileage",l.getEmptMileage() ); | |
| 137 | + m.put("remMileage", l.getRemMileage()); | |
| 138 | + m.put("addMileage", l.getAddMileage()); | |
| 139 | + m.put("totalm", l.getTotalm()); | |
| 140 | + m.put("cjbc", l.getCjbc()); | |
| 141 | + m.put("ljbc", l.getLjbc()); | |
| 142 | + m.put("sjbc", l.getSjbc()); | |
| 143 | + resList.add(m); | |
| 144 | + i++; | |
| 145 | + } | |
| 146 | + | |
| 147 | + try { | |
| 148 | + listI.add(resList.iterator()); | |
| 149 | + | |
| 150 | + String path = this.getClass().getResource("/").getPath()+"static\\pages\\forms\\"; | |
| 151 | + ee.excelReplace(listI, new Object[] { map }, path+"mould\\shiftuehiclemanth.xls", | |
| 152 | + path+"export\\班次车辆人员月报表" + sdfSimple.format(sdfMonth.parse(map.get("startDate").toString())) + ".xls"); | |
| 153 | + | |
| 154 | + } catch (Exception e) { | |
| 155 | + e.printStackTrace(); | |
| 156 | + } | |
| 157 | + | |
| 158 | + return resList; | |
| 159 | + } | |
| 160 | + | |
| 161 | + | |
| 162 | + //路单数据报表 | |
| 163 | + @RequestMapping(value = "/singledataExport",method = RequestMethod.POST) | |
| 164 | + public List<Map<String, Object>> singledataExport(@RequestParam Map<String, Object> map){ | |
| 165 | + SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"), | |
| 166 | + sdfSimple = new SimpleDateFormat("yyyyMMdd"); | |
| 167 | + List<Iterator<?>> listI = new ArrayList<Iterator<?>>(); | |
| 168 | + ReportUtils ee = new ReportUtils(); | |
| 169 | + List<Singledata> singledata = formsService.singledata(map); | |
| 170 | + List<Map<String, Object>> resList = new ArrayList<Map<String, Object>>(); | |
| 171 | + int i=1; | |
| 172 | + for(Singledata l : singledata){ | |
| 173 | + Map<String, Object> m = new HashMap<String, Object>(); | |
| 174 | + m.put("i", i); | |
| 175 | + m.put("rQ",l.getrQ()); | |
| 176 | + m.put("gS", l.getgS()); | |
| 177 | + m.put("xL",l.getxL() ); | |
| 178 | + m.put("clzbh", l.getClzbh()); | |
| 179 | + m.put("jsy", l.getJsy()); | |
| 180 | + m.put("jName", l.getjName()); | |
| 181 | + m.put("sgh", l.getSgh()); | |
| 182 | + m.put("sName", l.getsName()); | |
| 183 | + m.put("jhlc", l.getJhlc()); | |
| 184 | + m.put("emptMileage", l.getEmptMileage()); | |
| 185 | + m.put("hyl", l.getHyl()); | |
| 186 | + m.put("jzl", l.getJzl()); | |
| 187 | + m.put("unyyyl",l.getUnyyyl()); | |
| 188 | + m.put("jhjl", l.getJhjl()); | |
| 189 | + resList.add(m); | |
| 190 | + i++; | |
| 191 | + } | |
| 192 | + | |
| 193 | + try { | |
| 194 | + listI.add(resList.iterator()); | |
| 195 | + String path = this.getClass().getResource("/").getPath()+"static\\pages\\forms\\"; | |
| 196 | + ee.excelReplace(listI, new Object[] { map }, path+"mould\\singledata.xls", | |
| 197 | + path+"export\\路单报表" + sdfSimple.format(sdfMonth.parse(map.get("startDate").toString())) + ".xls"); | |
| 198 | + } catch (Exception e) { | |
| 199 | + e.printStackTrace(); | |
| 200 | + } | |
| 201 | + | |
| 202 | + return resList; | |
| 203 | + } | |
| 204 | + | |
| 205 | + //车辆加注 | |
| 206 | + @RequestMapping(value = "/vehicleloadingExport",method = RequestMethod.POST) | |
| 207 | + public List<Map<String, Object>> vehicleloadingExport(@RequestParam Map<String, Object> map){ | |
| 208 | + SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"), | |
| 209 | + sdfSimple = new SimpleDateFormat("yyyyMMdd"); | |
| 210 | + List<Iterator<?>> listI = new ArrayList<Iterator<?>>(); | |
| 211 | + ReportUtils ee = new ReportUtils(); | |
| 212 | + List<Vehicleloading> vehicleloading = formsService.vehicleloading(map.get("line").toString(), map.get("date").toString()); | |
| 213 | + List<Map<String, Object>> resList = new ArrayList<Map<String, Object>>(); | |
| 214 | + int i=1; | |
| 215 | + for(Vehicleloading l : vehicleloading){ | |
| 216 | + Map<String, Object> m = new HashMap<String, Object>(); | |
| 217 | + m.put("i", i); | |
| 218 | + m.put("rQ", l.getrQ()); | |
| 219 | + m.put("gS", l.getgS()); | |
| 220 | + m.put("xL", l.getxL()); | |
| 221 | + m.put("clzbh", l.getClzbh()); | |
| 222 | + m.put("hyl", l.getHyl()); | |
| 223 | + m.put("jzl", l.getJzl()); | |
| 224 | + m.put("ls", l.getLs()); | |
| 225 | + m.put("jhlc", l.getJhlc()); | |
| 226 | + m.put("unyyyl", l.getUnyyyl()); | |
| 227 | + m.put("jhbc", l.getJhbc()); | |
| 228 | + m.put("sjbc", l.getSjbc()); | |
| 229 | + resList.add(m); | |
| 230 | + i++; | |
| 231 | + } | |
| 232 | + | |
| 233 | + try { | |
| 234 | + listI.add(resList.iterator()); | |
| 235 | + String path = this.getClass().getResource("/").getPath()+"static\\pages\\forms\\"; | |
| 236 | + ee.excelReplace(listI, new Object[] { map }, path+"mould\\vehicleloading.xls", | |
| 237 | + path+"export\\车辆加注" + sdfSimple.format(sdfMonth.parse(map.get("date").toString())) + ".xls"); | |
| 238 | + } catch (Exception e) { | |
| 239 | + e.printStackTrace(); | |
| 240 | + } | |
| 241 | + return resList; | |
| 242 | + } | |
| 243 | + | |
| 244 | + //运营服务阶段报表 | |
| 245 | + @RequestMapping(value = "/operationserviceExport",method = RequestMethod.POST) | |
| 246 | + public List<Map<String, Object>> operationserviceExport(@RequestParam Map<String, Object> map){ | |
| 247 | + SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"), | |
| 248 | + sdfSimple = new SimpleDateFormat("yyyyMMdd"); | |
| 249 | + List<Iterator<?>> listI = new ArrayList<Iterator<?>>(); | |
| 250 | + ReportUtils ee = new ReportUtils(); | |
| 251 | + List<Operationservice> operationservice = formsService.operationservice(map); | |
| 252 | + List<Map<String, Object>> resList = new ArrayList<Map<String, Object>>(); | |
| 253 | + int i=1; | |
| 254 | + for(Operationservice l : operationservice){ | |
| 255 | + Map<String, Object> m = new HashMap<String, Object>(); | |
| 256 | + m.put("i", i); | |
| 257 | + m.put("xlName", l.getXlName()); | |
| 258 | + m.put("jzl", l.getJzl()); | |
| 259 | + m.put("xhl", l.getXhl()); | |
| 260 | + m.put("xsgl", l.getXsgl()); | |
| 261 | + m.put("emptMileage", l.getEmptMileage()); | |
| 262 | + m.put("sjbc", l.getSjbc()); | |
| 263 | + resList.add(m); | |
| 264 | + i++; | |
| 265 | + } | |
| 266 | + | |
| 267 | + try { | |
| 268 | + listI.add(resList.iterator()); | |
| 269 | + String path = this.getClass().getResource("/").getPath()+"static\\pages\\forms\\"; | |
| 270 | + ee.excelReplace(listI, new Object[] { map }, path+"mould\\operationservice.xls", | |
| 271 | + path+"export\\运营服务阶段报表" + sdfSimple.format(sdfMonth.parse(map.get("startDate").toString())) + ".xls"); | |
| 272 | + } catch (Exception e) { | |
| 273 | + e.printStackTrace(); | |
| 274 | + } | |
| 275 | + return resList; | |
| 276 | + } | |
| 277 | + | |
| 278 | + | |
| 279 | + //换人换车情况日统计 | |
| 280 | + @RequestMapping(value = "/changetochangeExport",method = RequestMethod.POST) | |
| 281 | + public List<Map<String, Object>> changetochangeExport(@RequestParam Map<String, Object> map){ | |
| 282 | + SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"), | |
| 283 | + sdfSimple = new SimpleDateFormat("yyyyMMdd"); | |
| 284 | + List<Iterator<?>> listI = new ArrayList<Iterator<?>>(); | |
| 285 | + ReportUtils ee = new ReportUtils(); | |
| 286 | + List<Changetochange> changetochange = formsService.changetochange(map); | |
| 287 | + List<Map<String, Object>> resList = new ArrayList<Map<String, Object>>(); | |
| 288 | + for(Changetochange l : changetochange){ | |
| 289 | + Map<String, Object> m = new HashMap<String, Object>(); | |
| 290 | + m.put("rq",l.getRq()); | |
| 291 | + m.put("gs",l.getGs()); | |
| 292 | + m.put("fgs",l.getFgs()); | |
| 293 | + m.put("xl",l.getXl()); | |
| 294 | + m.put("lp",l.getLp()); | |
| 295 | + m.put("fssj",l.getFssj()); | |
| 296 | + m.put("xgsj",l.getXgsj()); | |
| 297 | + m.put("pcch",l.getPcch()); | |
| 298 | + m.put("pcry",l.getPcry()); | |
| 299 | + m.put("jhch",l.getJhch()); | |
| 300 | + m.put("jhgh",l.getJhgh()); | |
| 301 | + m.put("sjch",l.getSjch()); | |
| 302 | + m.put("sjgh",l.getSjgh()); | |
| 303 | + m.put("yy",l.getYy()); | |
| 304 | + m.put("xgr",l.getXgr()); | |
| 305 | + resList.add(m); | |
| 306 | + } | |
| 307 | + | |
| 308 | + try { | |
| 309 | + listI.add(resList.iterator()); | |
| 310 | + String path = this.getClass().getResource("/").getPath()+"static\\pages\\forms\\"; | |
| 311 | + ee.excelReplace(listI, new Object[] { map }, path+"mould\\changetochange.xls", | |
| 312 | + path+"export\\换人换车情况日统计" + sdfSimple.format(sdfMonth.parse(map.get("startDate").toString())) + ".xls"); | |
| 313 | + } catch (Exception e) { | |
| 314 | + e.printStackTrace(); | |
| 315 | + } | |
| 316 | + return resList; | |
| 317 | + } | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
| 323 | +} | ... | ... |
src/main/java/com/bsth/controller/oil/YlbController.java
| ... | ... | @@ -4,6 +4,7 @@ import java.text.ParseException; |
| 4 | 4 | import java.text.SimpleDateFormat; |
| 5 | 5 | import java.util.ArrayList; |
| 6 | 6 | import java.util.Date; |
| 7 | +import java.util.HashMap; | |
| 7 | 8 | import java.util.Iterator; |
| 8 | 9 | import java.util.List; |
| 9 | 10 | import java.util.Map; |
| ... | ... | @@ -23,6 +24,7 @@ import com.bsth.entity.oil.Ylb; |
| 23 | 24 | import com.bsth.entity.sys.SysUser; |
| 24 | 25 | import com.bsth.security.util.SecurityUtils; |
| 25 | 26 | import com.bsth.service.oil.YlbService; |
| 27 | +import com.bsth.util.ReportUtils; | |
| 26 | 28 | import com.google.common.base.Splitter; |
| 27 | 29 | |
| 28 | 30 | @RestController |
| ... | ... | @@ -47,8 +49,7 @@ public class YlbController extends BaseController<Ylb, Integer>{ |
| 47 | 49 | */ |
| 48 | 50 | @RequestMapping(value = "/obtain",method = RequestMethod.GET) |
| 49 | 51 | public Map<String, Object> obtain(@RequestParam Map<String, Object> map){ |
| 50 | - String rq=map.get("rq").toString(); | |
| 51 | - Map<String, Object> list=yblService.obtain(rq); | |
| 52 | + Map<String, Object> list=yblService.obtain(map); | |
| 52 | 53 | System.out.println(); |
| 53 | 54 | return list; |
| 54 | 55 | } |
| ... | ... | @@ -131,4 +132,58 @@ public class YlbController extends BaseController<Ylb, Integer>{ |
| 131 | 132 | return yblService.oilListMonth(line, date); |
| 132 | 133 | } |
| 133 | 134 | |
| 135 | + | |
| 136 | + @RequestMapping(value = "/listExport",method = RequestMethod.POST) | |
| 137 | + public List<Map<String, Object>> listExport(@RequestParam Map<String, Object> map){ | |
| 138 | + SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"), | |
| 139 | + sdfSimple = new SimpleDateFormat("yyyyMMdd"); | |
| 140 | + List<Iterator<?>> listI = new ArrayList<Iterator<?>>(); | |
| 141 | + ReportUtils ee = new ReportUtils(); | |
| 142 | + String rq=map.get("rq").toString(); | |
| 143 | + if(!(rq=="")){ | |
| 144 | + SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd"); | |
| 145 | + try { | |
| 146 | + map.put("rq_eq", sdfMonth.parse(rq)); | |
| 147 | + } catch (ParseException e) { | |
| 148 | + // TODO Auto-generated catch block | |
| 149 | + e.printStackTrace(); | |
| 150 | + } | |
| 151 | + } | |
| 152 | + List<Ylb> ylb= (List<Ylb>)yblService.list(map); | |
| 153 | +// (new CustomerSpecs<Ylb>(map)).iterator(); | |
| 154 | + List<Map<String, Object>> resList = new ArrayList<Map<String, Object>>(); | |
| 155 | + for (Ylb y : ylb) { | |
| 156 | + Map<String, Object> m = new HashMap<String, Object>(); | |
| 157 | + m.put("rq", y.getRq()); | |
| 158 | + m.put("gsname",y.getGsname() ); | |
| 159 | + m.put("xlname", y.getXlname()); | |
| 160 | + m.put("nbbm", y.getNbbm()); | |
| 161 | + m.put("jsy", y.getJsy()); | |
| 162 | + m.put("jzl", y.getJzl()); | |
| 163 | + m.put("czlc", y.getCzlc()); | |
| 164 | + m.put("jzlc", y.getJzlc()); | |
| 165 | + m.put("czyl", y.getCzyl()); | |
| 166 | + m.put("jzyl", y.getJzyl()); | |
| 167 | + m.put("yh", y.getYh()); | |
| 168 | + m.put("rylx", y.getRylx()); | |
| 169 | + m.put("ns", y.getNs()); | |
| 170 | + m.put("shyy", y.getShyy()); | |
| 171 | + m.put("sh", y.getSh()); | |
| 172 | + m.put("zlc", y.getZlc()); | |
| 173 | + m.put("yhlx", y.getYhlx()); | |
| 174 | + m.put("bglyh", y.getBglyh()); | |
| 175 | + resList.add(m); | |
| 176 | + } | |
| 177 | + try { | |
| 178 | + listI.add(resList.iterator()); | |
| 179 | + String path = this.getClass().getResource("/").getPath()+"static\\pages\\forms\\"; | |
| 180 | + ee.excelReplace(listI, new Object[] { map }, path+"mould\\list.xls", | |
| 181 | + path+"export\\进出场存油量" + sdfSimple.format(sdfMonth.parse(map.get("rq").toString())) + ".xls"); | |
| 182 | + } catch (Exception e) { | |
| 183 | + e.printStackTrace(); | |
| 184 | + } | |
| 185 | + | |
| 186 | + return resList; | |
| 187 | + | |
| 188 | + } | |
| 134 | 189 | } | ... | ... |
src/main/java/com/bsth/controller/schedule/TTInfoDetailController.java
| ... | ... | @@ -14,6 +14,7 @@ import com.bsth.service.StationRouteService; |
| 14 | 14 | import com.bsth.service.schedule.GuideboardInfoService; |
| 15 | 15 | import com.bsth.service.schedule.TTInfoDetailService; |
| 16 | 16 | import com.bsth.service.schedule.utils.DataImportExportService; |
| 17 | +import com.bsth.service.schedule.utils.DataToolsProperties; | |
| 17 | 18 | import jxl.Cell; |
| 18 | 19 | import jxl.Sheet; |
| 19 | 20 | import jxl.Workbook; |
| ... | ... | @@ -26,6 +27,7 @@ import org.springframework.util.CollectionUtils; |
| 26 | 27 | import org.springframework.web.bind.annotation.*; |
| 27 | 28 | import org.springframework.web.multipart.MultipartFile; |
| 28 | 29 | |
| 30 | +import javax.servlet.http.HttpServletResponse; | |
| 29 | 31 | import java.io.File; |
| 30 | 32 | import java.util.*; |
| 31 | 33 | import java.util.regex.Matcher; |
| ... | ... | @@ -51,6 +53,8 @@ public class TTInfoDetailController extends BaseController<TTInfoDetail, Long> { |
| 51 | 53 | private StationRouteService stationRouteService; |
| 52 | 54 | @Autowired |
| 53 | 55 | private GuideboardInfoService guideboardInfoService; |
| 56 | + @Autowired | |
| 57 | + private DataToolsProperties dataToolsProperties; | |
| 54 | 58 | |
| 55 | 59 | |
| 56 | 60 | public static class ExcelFileOutput { |
| ... | ... | @@ -126,11 +130,15 @@ public class TTInfoDetailController extends BaseController<TTInfoDetail, Long> { |
| 126 | 130 | Cell[] cells = sheet.getRow(0); // 获取第一行数据列 |
| 127 | 131 | for (int i = 0; i < cells.length; i++) { |
| 128 | 132 | String cell_con = cells[i].getContents(); |
| 133 | + | |
| 129 | 134 | if (StringUtils.isEmpty(cell_con)) { |
| 130 | 135 | rtn.put("status", ResponseCode.ERROR); |
| 131 | 136 | rtn.put("msg", String.format("第1行,第%d列数据不能为空", i + 1)); |
| 132 | 137 | return rtn; |
| 133 | 138 | } else { |
| 139 | + // 正则表达式去除数字 | |
| 140 | + cell_con = cell_con.replaceAll("[\\d+]", ""); | |
| 141 | + | |
| 134 | 142 | if (i == 0) { // 第一列必须是路牌2个字 |
| 135 | 143 | if (!"路牌".equals(cell_con.trim())) { |
| 136 | 144 | rtn.put("status", ResponseCode.ERROR); |
| ... | ... | @@ -457,4 +465,25 @@ public class TTInfoDetailController extends BaseController<TTInfoDetail, Long> { |
| 457 | 465 | public List<TTInfoDetail> findBcdetails(Integer xlId, Long ttinfoId, Long lpId) { |
| 458 | 466 | return ttInfoDetailRepository.findBcdetails(xlId, ttinfoId, lpId); |
| 459 | 467 | } |
| 468 | + | |
| 469 | + @Override | |
| 470 | + public void dataExport(HttpServletResponse response, @RequestParam Map<String, Object> param) throws Exception { | |
| 471 | + // 获取injectktr | |
| 472 | + File ktrFile2 = new File(this.getClass().getResource( | |
| 473 | + dataToolsProperties.getTtinfodetailOutput()).toURI()); | |
| 474 | + param.put("injectktrfile", ktrFile2.getAbsolutePath()); | |
| 475 | + param.put("ttinfoid", param.get("ttinfoid")); | |
| 476 | + | |
| 477 | + super.dataExport(response, param); | |
| 478 | + } | |
| 479 | + | |
| 480 | + @Override | |
| 481 | + protected String getDataExportKtrClasspath() { | |
| 482 | + return dataToolsProperties.getTtinfodetailMetaoutput(); | |
| 483 | + } | |
| 484 | + | |
| 485 | + @Override | |
| 486 | + protected String getDataExportFilename() { | |
| 487 | + return "时刻表"; | |
| 488 | + } | |
| 460 | 489 | } | ... | ... |
src/main/java/com/bsth/controller/sys/CompanyAuthorityController.java
0 → 100644
| 1 | +package com.bsth.controller.sys; | |
| 2 | + | |
| 3 | +import com.alibaba.fastjson.JSONArray; | |
| 4 | +import com.bsth.controller.BaseController; | |
| 5 | +import com.bsth.entity.sys.CompanyAuthority; | |
| 6 | +import com.bsth.service.sys.CompanyAuthorityService; | |
| 7 | +import org.apache.commons.lang3.StringEscapeUtils; | |
| 8 | +import org.springframework.beans.factory.annotation.Autowired; | |
| 9 | +import org.springframework.web.bind.annotation.RequestMapping; | |
| 10 | +import org.springframework.web.bind.annotation.RequestParam; | |
| 11 | +import org.springframework.web.bind.annotation.RestController; | |
| 12 | + | |
| 13 | +import java.util.List; | |
| 14 | +import java.util.Map; | |
| 15 | + | |
| 16 | +/** | |
| 17 | + * Created by panzhao on 2016/11/22. | |
| 18 | + */ | |
| 19 | +@RestController | |
| 20 | +@RequestMapping("companyAuthority") | |
| 21 | +public class CompanyAuthorityController extends BaseController<CompanyAuthority, Integer>{ | |
| 22 | + | |
| 23 | + @Autowired | |
| 24 | + CompanyAuthorityService companyAuthorityService; | |
| 25 | + | |
| 26 | + @RequestMapping(value = "save") | |
| 27 | + public Map<String, Object> save(@RequestParam Integer roleId, @RequestParam String authJsonStr){ | |
| 28 | + authJsonStr = StringEscapeUtils.unescapeHtml4(authJsonStr); | |
| 29 | + System.out.println(authJsonStr); | |
| 30 | + List<CompanyAuthority> list = JSONArray.parseArray(authJsonStr, CompanyAuthority.class); | |
| 31 | + return companyAuthorityService.save(roleId, list); | |
| 32 | + } | |
| 33 | +} | ... | ... |
src/main/java/com/bsth/controller/sys/UserController.java
| 1 | 1 | package com.bsth.controller.sys; |
| 2 | 2 | |
| 3 | -import java.util.HashMap; | |
| 4 | -import java.util.Map; | |
| 5 | - | |
| 6 | -import javax.servlet.http.HttpServletRequest; | |
| 7 | -import javax.servlet.http.HttpSession; | |
| 8 | - | |
| 3 | +import com.bsth.common.Constants; | |
| 4 | +import com.bsth.common.ResponseCode; | |
| 5 | +import com.bsth.controller.BaseController; | |
| 6 | +import com.bsth.controller.sys.dto.CompanyData; | |
| 7 | +import com.bsth.controller.sys.util.RSAUtils; | |
| 8 | +import com.bsth.entity.sys.CompanyAuthority; | |
| 9 | +import com.bsth.entity.sys.SysUser; | |
| 10 | +import com.bsth.security.util.SecurityUtils; | |
| 11 | +import com.bsth.service.sys.CompanyAuthorityService; | |
| 12 | +import com.bsth.service.sys.SysUserService; | |
| 13 | +import com.google.common.collect.ArrayListMultimap; | |
| 9 | 14 | import org.apache.commons.lang3.StringUtils; |
| 10 | 15 | import org.slf4j.Logger; |
| 11 | 16 | import org.slf4j.LoggerFactory; |
| ... | ... | @@ -18,13 +23,9 @@ import org.springframework.web.bind.annotation.RequestMethod; |
| 18 | 23 | import org.springframework.web.bind.annotation.RequestParam; |
| 19 | 24 | import org.springframework.web.bind.annotation.RestController; |
| 20 | 25 | |
| 21 | -import com.bsth.common.Constants; | |
| 22 | -import com.bsth.common.ResponseCode; | |
| 23 | -import com.bsth.controller.BaseController; | |
| 24 | -import com.bsth.controller.sys.util.RSAUtils; | |
| 25 | -import com.bsth.entity.sys.SysUser; | |
| 26 | -import com.bsth.security.util.SecurityUtils; | |
| 27 | -import com.bsth.service.sys.SysUserService; | |
| 26 | +import javax.servlet.http.HttpServletRequest; | |
| 27 | +import javax.servlet.http.HttpSession; | |
| 28 | +import java.util.*; | |
| 28 | 29 | |
| 29 | 30 | @RestController |
| 30 | 31 | @RequestMapping("user") |
| ... | ... | @@ -34,6 +35,9 @@ public class UserController extends BaseController<SysUser, Integer> { |
| 34 | 35 | |
| 35 | 36 | @Autowired |
| 36 | 37 | SysUserService sysUserService; |
| 38 | + | |
| 39 | + @Autowired | |
| 40 | + CompanyAuthorityService companyAuthorityService; | |
| 37 | 41 | |
| 38 | 42 | @RequestMapping(value = "/login/jCryptionKey") |
| 39 | 43 | public Map<String, Object> jCryptionKey(HttpServletRequest request){ |
| ... | ... | @@ -97,7 +101,11 @@ public class UserController extends BaseController<SysUser, Integer> { |
| 97 | 101 | SecurityUtils.login(user, request); |
| 98 | 102 | //session里写入用户名,webSocket连接时标识身份用 |
| 99 | 103 | session.setAttribute(Constants.SESSION_USERNAME, user.getUserName()); |
| 100 | - | |
| 104 | + | |
| 105 | + //获取公司权限数据 | |
| 106 | + List<CompanyAuthority> cmyAuths=companyAuthorityService.findByUser(user); | |
| 107 | + session.setAttribute(Constants.COMPANY_AUTHORITYS, cmyAuths); | |
| 108 | + | |
| 101 | 109 | captchaMap.remove(userName); |
| 102 | 110 | rs.put("status", ResponseCode.SUCCESS); |
| 103 | 111 | } catch (Exception e) { |
| ... | ... | @@ -106,6 +114,43 @@ public class UserController extends BaseController<SysUser, Integer> { |
| 106 | 114 | } |
| 107 | 115 | return rs; |
| 108 | 116 | } |
| 117 | + | |
| 118 | + /** | |
| 119 | + * 返回当前用户的公司权限数据,用于构建页面级联下拉框 | |
| 120 | + * @return | |
| 121 | + */ | |
| 122 | + @RequestMapping("companyData") | |
| 123 | + public List<CompanyData> companyData(HttpServletRequest request){ | |
| 124 | + List<CompanyData> rs = new ArrayList<>(); | |
| 125 | + CompanyData companyData; | |
| 126 | + | |
| 127 | + ArrayListMultimap<String, CompanyAuthority> map = ArrayListMultimap.create(); | |
| 128 | + List<CompanyAuthority> cmyAuths = (List<CompanyAuthority>) request.getSession().getAttribute(Constants.COMPANY_AUTHORITYS); | |
| 129 | + | |
| 130 | + for(CompanyAuthority cAuth : cmyAuths){ | |
| 131 | + map.put(cAuth.getCompanyCode()+"_"+cAuth.getCompanyName(), cAuth); | |
| 132 | + } | |
| 133 | + | |
| 134 | + Set<String> keys = map.keySet(); | |
| 135 | + String[] temps; | |
| 136 | + for(String k : keys){ | |
| 137 | + temps = k.split("_"); | |
| 138 | + | |
| 139 | + companyData = new CompanyData(); | |
| 140 | + companyData.setCompanyCode(temps[0]); | |
| 141 | + companyData.setCompanyName(temps[1]); | |
| 142 | + companyData.setChildren(new ArrayList<CompanyData.ChildrenCompany>()); | |
| 143 | + | |
| 144 | + cmyAuths = map.get(k); | |
| 145 | + for(CompanyAuthority c : cmyAuths){ | |
| 146 | + companyData.getChildren().add(new CompanyData.ChildrenCompany(c.getSubCompanyCode(), c.getSubCompanyName())); | |
| 147 | + } | |
| 148 | + | |
| 149 | + rs.add(companyData); | |
| 150 | + } | |
| 151 | + | |
| 152 | + return rs; | |
| 153 | + } | |
| 109 | 154 | |
| 110 | 155 | @RequestMapping(value = "/login/captchaStatus") |
| 111 | 156 | public int captchaStatus(String userName){ |
| ... | ... | @@ -162,7 +207,7 @@ public class UserController extends BaseController<SysUser, Integer> { |
| 162 | 207 | * @Description: TODO(修改密码) |
| 163 | 208 | * @param oldPWD |
| 164 | 209 | * 原始密码 |
| 165 | - * @param newwPWD | |
| 210 | + * @param newPWD | |
| 166 | 211 | * 新密码 |
| 167 | 212 | * @param cnewPWD |
| 168 | 213 | * 确认新密码 | ... | ... |
src/main/java/com/bsth/controller/sys/dto/CompanyData.java
0 → 100644
| 1 | +package com.bsth.controller.sys.dto; | |
| 2 | + | |
| 3 | +import java.util.List; | |
| 4 | + | |
| 5 | +/** | |
| 6 | + * Created by panzhao on 2016/11/22. | |
| 7 | + */ | |
| 8 | +public class CompanyData { | |
| 9 | + | |
| 10 | + private String companyCode; | |
| 11 | + | |
| 12 | + private String companyName; | |
| 13 | + | |
| 14 | + private List<ChildrenCompany> children; | |
| 15 | + | |
| 16 | + public String getCompanyCode() { | |
| 17 | + return companyCode; | |
| 18 | + } | |
| 19 | + | |
| 20 | + public void setCompanyCode(String companyCode) { | |
| 21 | + this.companyCode = companyCode; | |
| 22 | + } | |
| 23 | + | |
| 24 | + public String getCompanyName() { | |
| 25 | + return companyName; | |
| 26 | + } | |
| 27 | + | |
| 28 | + public void setCompanyName(String companyName) { | |
| 29 | + this.companyName = companyName; | |
| 30 | + } | |
| 31 | + | |
| 32 | + public List<ChildrenCompany> getChildren() { | |
| 33 | + return children; | |
| 34 | + } | |
| 35 | + | |
| 36 | + public void setChildren(List<ChildrenCompany> children) { | |
| 37 | + this.children = children; | |
| 38 | + } | |
| 39 | + | |
| 40 | + public static class ChildrenCompany { | |
| 41 | + private String code; | |
| 42 | + | |
| 43 | + private String name; | |
| 44 | + | |
| 45 | + public ChildrenCompany(String code, String name){ | |
| 46 | + this.code = code; | |
| 47 | + this.name = name; | |
| 48 | + } | |
| 49 | + | |
| 50 | + public String getName() { | |
| 51 | + return name; | |
| 52 | + } | |
| 53 | + | |
| 54 | + public void setName(String name) { | |
| 55 | + this.name = name; | |
| 56 | + } | |
| 57 | + | |
| 58 | + public String getCode() { | |
| 59 | + return code; | |
| 60 | + } | |
| 61 | + | |
| 62 | + public void setCode(String code) { | |
| 63 | + this.code = code; | |
| 64 | + } | |
| 65 | + } | |
| 66 | +} | ... | ... |
src/main/java/com/bsth/data/BasicData.java
| 1 | 1 | package com.bsth.data; |
| 2 | 2 | |
| 3 | -import java.util.ArrayList; | |
| 4 | -import java.util.HashMap; | |
| 5 | -import java.util.Iterator; | |
| 6 | -import java.util.List; | |
| 7 | -import java.util.Map; | |
| 8 | -import java.util.concurrent.TimeUnit; | |
| 9 | - | |
| 3 | +import com.bsth.Application; | |
| 4 | +import com.bsth.entity.*; | |
| 5 | +import com.bsth.entity.schedule.CarConfigInfo; | |
| 6 | +import com.bsth.repository.*; | |
| 7 | +import com.bsth.repository.schedule.CarConfigInfoRepository; | |
| 8 | +import com.google.common.collect.BiMap; | |
| 9 | +import com.google.common.collect.HashBiMap; | |
| 10 | +import org.apache.commons.lang3.StringUtils; | |
| 10 | 11 | import org.slf4j.Logger; |
| 11 | 12 | import org.slf4j.LoggerFactory; |
| 12 | 13 | import org.springframework.beans.factory.annotation.Autowired; |
| 13 | 14 | import org.springframework.boot.CommandLineRunner; |
| 14 | 15 | import org.springframework.stereotype.Component; |
| 15 | 16 | |
| 16 | -import com.bsth.Application; | |
| 17 | -import com.bsth.entity.CarPark; | |
| 18 | -import com.bsth.entity.Cars; | |
| 19 | -import com.bsth.entity.Line; | |
| 20 | -import com.bsth.entity.Personnel; | |
| 21 | -import com.bsth.entity.Station; | |
| 22 | -import com.bsth.entity.StationRoute; | |
| 23 | -import com.bsth.entity.schedule.CarConfigInfo; | |
| 24 | -import com.bsth.repository.CarParkRepository; | |
| 25 | -import com.bsth.repository.CarsRepository; | |
| 26 | -import com.bsth.repository.LineRepository; | |
| 27 | -import com.bsth.repository.PersonnelRepository; | |
| 28 | -import com.bsth.repository.StationRepository; | |
| 29 | -import com.bsth.repository.StationRouteRepository; | |
| 30 | -import com.bsth.repository.schedule.CarConfigInfoRepository; | |
| 31 | -import com.google.common.collect.BiMap; | |
| 32 | -import com.google.common.collect.HashBiMap; | |
| 33 | -import com.google.common.collect.TreeMultimap; | |
| 17 | +import java.util.*; | |
| 18 | +import java.util.concurrent.TimeUnit; | |
| 34 | 19 | |
| 35 | 20 | /** |
| 36 | - * | |
| 21 | + * @author PanZhao | |
| 37 | 22 | * @ClassName: BasicData |
| 38 | 23 | * @Description: TODO(基础的映射数据) |
| 39 | - * @author PanZhao | |
| 40 | 24 | * @date 2016年8月10日 下午3:27:45 |
| 41 | - * | |
| 42 | 25 | */ |
| 43 | 26 | @Component |
| 44 | -public class BasicData implements CommandLineRunner{ | |
| 45 | - | |
| 46 | - //设备号和车辆自编号 (K: 设备编码 ,V:车辆自编号) | |
| 47 | - public static BiMap<String, String> deviceId2NbbmMap; | |
| 48 | - | |
| 49 | - //车辆自编号和公司代码对照 (K: 车辆自编号 ,V:公司代码) | |
| 50 | - public static Map<String, String> nbbm2CompanyCodeMap; | |
| 51 | - | |
| 52 | - //站点编码和名称对照,包括停车场 (K: 站点编码 ,V:站点名称) | |
| 53 | - public static Map<String, String> stationCode2NameMap; | |
| 54 | - | |
| 55 | - //车辆和线路对照 | |
| 56 | - public static Map<String, Line> nbbm2LineMap; | |
| 57 | - | |
| 58 | - //线路和用户对照 用于webSocket定向推送消息(用户进入线调时写入数据) | |
| 59 | - public static TreeMultimap<String, String> lineCode2SocketUserMap = TreeMultimap.create(); | |
| 60 | - | |
| 61 | - //线路ID和code 对照 | |
| 62 | - public static BiMap<Integer, String> lineId2CodeMap; | |
| 63 | - | |
| 64 | - //线路编码和名称对照 | |
| 65 | - public static Map<String, String> lineCode2NameMap; | |
| 66 | - | |
| 67 | - //线路编码_站点编码 == 0|1 上下行 | |
| 68 | - public static Map<String, Integer> lineStationUpDownMap; | |
| 69 | - | |
| 70 | - //停车场 | |
| 71 | - public static List<String> parkCodeList; | |
| 72 | - | |
| 73 | - //线路ID和shangHaiLinecode 对照 | |
| 74 | - public static Map<Integer, String> lineId2ShangHaiCodeMap; | |
| 75 | - | |
| 76 | - //线路Code和shangHaiLinecode 对照 | |
| 77 | - public static Map<String, String> lineCode2ShangHaiCodeMap; | |
| 78 | - | |
| 79 | - //驾驶员工号 和 personnel 对象映射 | |
| 80 | - public static Map<String, Personnel> jsyMap; | |
| 81 | - //售票员工号 和 personnel 对象映射 | |
| 82 | - public static Map<String, Personnel> spyMap; | |
| 83 | - //全量员工 工号和姓名对照 | |
| 84 | - public static Map<String, String> allPerson; | |
| 85 | - | |
| 86 | - | |
| 87 | - static Logger logger = LoggerFactory.getLogger(BasicData.class); | |
| 88 | - | |
| 89 | - @Autowired | |
| 90 | - BasicDataLoader dataLoader; | |
| 91 | - | |
| 92 | - @Override | |
| 93 | - public void run(String... arg0) throws Exception { | |
| 94 | - Application.mainServices.scheduleWithFixedDelay(dataLoader, 0, 1, TimeUnit.HOURS); | |
| 95 | - } | |
| 96 | - | |
| 97 | - | |
| 98 | - @Component | |
| 99 | - public static class BasicDataLoader extends Thread{ | |
| 100 | - | |
| 101 | - @Autowired | |
| 102 | - CarsRepository carsRepository; | |
| 103 | - | |
| 104 | - @Autowired | |
| 105 | - StationRepository stationRepository; | |
| 106 | - | |
| 107 | - @Autowired | |
| 108 | - CarParkRepository carParkRepository; | |
| 109 | - | |
| 110 | - @Autowired | |
| 111 | - CarConfigInfoRepository carConfigInfoRepository; | |
| 112 | - | |
| 113 | - @Autowired | |
| 114 | - LineRepository lineRepository; | |
| 115 | - | |
| 116 | - @Autowired | |
| 117 | - StationRouteRepository stationRouteRepository; | |
| 118 | - | |
| 119 | - @Autowired | |
| 120 | - PersonnelRepository personnelRepository; | |
| 121 | - | |
| 122 | - | |
| 123 | - @Override | |
| 124 | - public void run() { | |
| 125 | - loadAllData(); | |
| 126 | - } | |
| 127 | - | |
| 128 | - /** | |
| 129 | - * @Title: loadAllData | |
| 130 | - * @Description: TODO(加载所有数据) | |
| 131 | - */ | |
| 132 | - public int loadAllData(){ | |
| 133 | - try{ | |
| 134 | - //设备信息 | |
| 135 | - loadDeviceInfo(); | |
| 136 | - //站点信息 | |
| 137 | - loadStationInfo(); | |
| 138 | - //线路信息 | |
| 139 | - loadLineInfo(); | |
| 140 | - //车辆和线路映射信息 | |
| 141 | - loadNbbm2LineInfo(); | |
| 142 | - //站点路由信息 | |
| 143 | - loadStationRouteInfo(); | |
| 144 | - //人员信息 | |
| 145 | - loadPersonnelInfo(); | |
| 146 | - logger.info("加载基础数据成功!," ); | |
| 147 | - }catch(Exception e){ | |
| 148 | - logger.error("加载基础数据时出现异常," , e); | |
| 149 | - } | |
| 150 | - return 0; | |
| 151 | - } | |
| 152 | - | |
| 153 | - | |
| 154 | - private void loadStationRouteInfo() { | |
| 155 | - Iterator<StationRoute> iterator = stationRouteRepository.findAllEffective().iterator(); | |
| 156 | - Map<String, Integer> map = new HashMap<>(); | |
| 157 | - StationRoute route; | |
| 158 | - | |
| 159 | - while(iterator.hasNext()){ | |
| 160 | - route = iterator.next(); | |
| 161 | - map.put(route.getLineCode() + "_" + route.getStationCode(), route.getDirections()); | |
| 162 | - } | |
| 163 | - lineStationUpDownMap = map; | |
| 164 | - } | |
| 165 | - | |
| 166 | - /** | |
| 167 | - * @Title: loadDeviceInfo | |
| 168 | - * @Description: TODO(加载设备相关信息) | |
| 169 | - */ | |
| 170 | - public void loadDeviceInfo(){ | |
| 171 | - BiMap<String, String> deviceId2Nbbm = HashBiMap.create(); | |
| 172 | - //车辆和公司代码对照 | |
| 173 | - Map<String, String> nbbm2CompanyCode = new HashMap<>(); | |
| 174 | - Iterator<Cars> carIterator = carsRepository.findAll().iterator(); | |
| 175 | - Cars car; | |
| 176 | - while(carIterator.hasNext()){ | |
| 177 | - car = carIterator.next(); | |
| 178 | - deviceId2Nbbm.put(car.getEquipmentCode(), car.getInsideCode()); | |
| 179 | - nbbm2CompanyCode.put(car.getInsideCode(), car.getBusinessCode()); | |
| 180 | - } | |
| 181 | - | |
| 182 | - deviceId2NbbmMap = deviceId2Nbbm; | |
| 183 | - nbbm2CompanyCodeMap = nbbm2CompanyCode; | |
| 184 | - } | |
| 185 | - | |
| 186 | - /** | |
| 187 | - * @Title: loadStationInfo | |
| 188 | - * @Description: TODO(加载站点信息) | |
| 189 | - */ | |
| 190 | - public void loadStationInfo(){ | |
| 191 | - Map<String, String> stationCode2Name = new HashMap<>(); | |
| 192 | - Iterator<Station> iterator = stationRepository.findAll().iterator(); | |
| 193 | - //站点 | |
| 194 | - Station station; | |
| 195 | - while(iterator.hasNext()){ | |
| 196 | - station = iterator.next(); | |
| 197 | - stationCode2Name.put(station.getStationCod(), station.getStationName()); | |
| 198 | - } | |
| 199 | - //停车场 | |
| 200 | - Iterator<CarPark> iterator2 = carParkRepository.findAll().iterator(); | |
| 201 | - | |
| 202 | - List<String> parkCodes = new ArrayList<>(); | |
| 203 | - | |
| 204 | - CarPark carPark; | |
| 205 | - while(iterator2.hasNext()){ | |
| 206 | - carPark = iterator2.next(); | |
| 207 | - stationCode2Name.put(carPark.getParkCode(), carPark.getParkName()); | |
| 208 | - | |
| 209 | - parkCodes.add(carPark.getParkCode()); | |
| 210 | - } | |
| 211 | - parkCodeList = parkCodes; | |
| 212 | - stationCode2NameMap = stationCode2Name; | |
| 213 | - } | |
| 214 | - | |
| 215 | - /** | |
| 216 | - * @Title: loadNbbm2LineInfo | |
| 217 | - * @Description: TODO(车辆和线路对照) | |
| 218 | - */ | |
| 219 | - public void loadNbbm2LineInfo(){ | |
| 220 | - Iterator<CarConfigInfo> allIterator = carConfigInfoRepository.findAll().iterator(); | |
| 221 | - Map<String, Line> ccMap = new HashMap<>(); | |
| 222 | - | |
| 223 | - CarConfigInfo cci; | |
| 224 | - while(allIterator.hasNext()){ | |
| 225 | - cci = allIterator.next(); | |
| 226 | - ccMap.put(cci.getCl().getInsideCode(), cci.getXl()); | |
| 227 | - } | |
| 228 | - nbbm2LineMap = ccMap; | |
| 229 | - } | |
| 230 | - | |
| 231 | - /** | |
| 232 | - * @Title: loadLineInfo | |
| 233 | - * @Description: TODO(加载线路相关信息) | |
| 234 | - */ | |
| 235 | - public void loadLineInfo(){ | |
| 236 | - Iterator<Line> iterator = lineRepository.findAll().iterator(); | |
| 237 | - | |
| 238 | - Line line; | |
| 239 | - BiMap<Integer, String> biMap = HashBiMap.create(); | |
| 240 | - Map<String, String> code2name = new HashMap<>(); | |
| 241 | - Map<Integer, String> id2SHcode = new HashMap<Integer, String>(); | |
| 242 | - Map<String, String> code2SHcode = new HashMap<String, String>(); | |
| 243 | - | |
| 244 | - while(iterator.hasNext()){ | |
| 245 | - line = iterator.next(); | |
| 246 | - biMap.put(line.getId(), line.getLineCode()); | |
| 247 | - code2name.put(line.getLineCode(), line.getName()); | |
| 248 | - id2SHcode.put(line.getId(),line.getShanghaiLinecode()); | |
| 249 | - code2SHcode.put(line.getLineCode(), line.getShanghaiLinecode()); | |
| 250 | - } | |
| 251 | - | |
| 252 | - lineId2CodeMap = biMap; | |
| 253 | - lineCode2NameMap = code2name; | |
| 254 | - lineId2ShangHaiCodeMap = id2SHcode; | |
| 255 | - lineCode2ShangHaiCodeMap = code2SHcode; | |
| 256 | - } | |
| 257 | - | |
| 258 | - /** | |
| 259 | - * | |
| 260 | - * @Title: loadPersonnelInfo | |
| 261 | - * @Description: TODO(加载人员信息) | |
| 262 | - */ | |
| 263 | - public void loadPersonnelInfo() { | |
| 264 | - Iterator<Personnel> iterator = personnelRepository.findAll().iterator(); | |
| 265 | - | |
| 266 | - Map<String, Personnel> jsyTempMap=new HashMap<>() | |
| 267 | - , spyTempMap=new HashMap<>(); | |
| 268 | - Map<String, String> allPersonMap=new HashMap<>(); | |
| 269 | - | |
| 270 | - Personnel p; | |
| 271 | - | |
| 272 | - while(iterator.hasNext()){ | |
| 273 | - p = iterator.next(); | |
| 274 | - | |
| 275 | - if(p.getPosts() != null){ | |
| 276 | - if(p.getPosts().equals("1")) | |
| 277 | - jsyTempMap.put(p.getJobCode(), p); | |
| 278 | - else if(p.getPosts().equals("2")) | |
| 279 | - spyTempMap.put(p.getJobCode(), p); | |
| 280 | - } | |
| 281 | - | |
| 282 | - allPersonMap.put(p.getJobCode(), p.getPersonnelName()); | |
| 283 | - } | |
| 284 | - | |
| 285 | - jsyMap=jsyTempMap; | |
| 286 | - spyMap=spyTempMap; | |
| 287 | - allPerson=allPersonMap; | |
| 288 | - } | |
| 289 | - } | |
| 27 | +public class BasicData implements CommandLineRunner { | |
| 28 | + | |
| 29 | + //设备号和车辆自编号 (K: 设备编码 ,V:车辆自编号) | |
| 30 | + public static BiMap<String, String> deviceId2NbbmMap; | |
| 31 | + | |
| 32 | + //车辆自编号和公司代码对照 (K: 车辆自编号 ,V:公司代码) | |
| 33 | + public static Map<String, String> nbbm2CompanyCodeMap; | |
| 34 | + | |
| 35 | + //站点编码和名称对照,包括停车场 (K: 站点编码 ,V:站点名称) | |
| 36 | + public static Map<String, String> stationCode2NameMap; | |
| 37 | + | |
| 38 | + //线路起终点对照(线路编码_上下行_起终点) 1024_0_B (1024上行起点) | |
| 39 | + public static Map<String, String> lineSEPointMap; | |
| 40 | + | |
| 41 | + //车辆和线路对照 | |
| 42 | + public static Map<String, Line> nbbm2LineMap; | |
| 43 | + | |
| 44 | + //线路和用户对照 用于webSocket定向推送消息(用户进入线调时写入数据) | |
| 45 | + //public static TreeMultimap<String, String> lineCode2SocketUserMap = TreeMultimap.create(); | |
| 46 | + | |
| 47 | + //线路ID和code 对照 | |
| 48 | + public static BiMap<Integer, String> lineId2CodeMap; | |
| 49 | + | |
| 50 | + //线路编码和名称对照 | |
| 51 | + public static Map<String, String> lineCode2NameMap; | |
| 52 | + | |
| 53 | + //线路编码_站点编码 == 0|1 上下行 | |
| 54 | + public static Map<String, Integer> lineStationUpDownMap; | |
| 55 | + | |
| 56 | + //停车场 | |
| 57 | + public static List<String> parkCodeList; | |
| 58 | + | |
| 59 | + //线路ID和shangHaiLinecode 对照 | |
| 60 | + public static Map<Integer, String> lineId2ShangHaiCodeMap; | |
| 61 | + | |
| 62 | + //线路Code和shangHaiLinecode 对照 | |
| 63 | + public static Map<String, String> lineCode2ShangHaiCodeMap; | |
| 64 | + | |
| 65 | + //驾驶员工号 和 personnel 对象映射 | |
| 66 | + public static Map<String, Personnel> jsyMap; | |
| 67 | + //售票员工号 和 personnel 对象映射 | |
| 68 | + public static Map<String, Personnel> spyMap; | |
| 69 | + //全量员工 工号和姓名对照 | |
| 70 | + public static Map<String, String> allPerson; | |
| 71 | + | |
| 72 | + //站点名和运管处编号 对照 | |
| 73 | + public static Map<String, Map<String, Map>> stationName2YgcNumber; | |
| 74 | + | |
| 75 | + | |
| 76 | + static Logger logger = LoggerFactory.getLogger(BasicData.class); | |
| 77 | + | |
| 78 | + @Autowired | |
| 79 | + BasicDataLoader dataLoader; | |
| 80 | + | |
| 81 | + @Override | |
| 82 | + public void run(String... arg0) throws Exception { | |
| 83 | + Application.mainServices.scheduleWithFixedDelay(dataLoader, 0, 1, TimeUnit.HOURS); | |
| 84 | + } | |
| 85 | + | |
| 86 | + | |
| 87 | + @Component | |
| 88 | + public static class BasicDataLoader extends Thread { | |
| 89 | + | |
| 90 | + @Autowired | |
| 91 | + CarsRepository carsRepository; | |
| 92 | + | |
| 93 | + @Autowired | |
| 94 | + StationRepository stationRepository; | |
| 95 | + | |
| 96 | + @Autowired | |
| 97 | + CarParkRepository carParkRepository; | |
| 98 | + | |
| 99 | + @Autowired | |
| 100 | + CarConfigInfoRepository carConfigInfoRepository; | |
| 101 | + | |
| 102 | + @Autowired | |
| 103 | + LineRepository lineRepository; | |
| 104 | + | |
| 105 | + @Autowired | |
| 106 | + StationRouteRepository stationRouteRepository; | |
| 107 | + | |
| 108 | + @Autowired | |
| 109 | + PersonnelRepository personnelRepository; | |
| 110 | + | |
| 111 | + | |
| 112 | + @Override | |
| 113 | + public void run() { | |
| 114 | + loadAllData(); | |
| 115 | + } | |
| 116 | + | |
| 117 | + /** | |
| 118 | + * @Title: loadAllData | |
| 119 | + * @Description: TODO(加载所有数据) | |
| 120 | + */ | |
| 121 | + public int loadAllData() { | |
| 122 | + try { | |
| 123 | + //设备信息 | |
| 124 | + loadDeviceInfo(); | |
| 125 | + //站点信息 | |
| 126 | + loadStationInfo(); | |
| 127 | + //线路信息 | |
| 128 | + loadLineInfo(); | |
| 129 | + //车辆和线路映射信息 | |
| 130 | + loadNbbm2LineInfo(); | |
| 131 | + //站点路由信息 | |
| 132 | + loadStationRouteInfo(); | |
| 133 | + //人员信息 | |
| 134 | + loadPersonnelInfo(); | |
| 135 | + logger.info("加载基础数据成功!,"); | |
| 136 | + } catch (Exception e) { | |
| 137 | + logger.error("加载基础数据时出现异常,", e); | |
| 138 | + } | |
| 139 | + return 0; | |
| 140 | + } | |
| 141 | + | |
| 142 | + | |
| 143 | + private void loadStationRouteInfo() { | |
| 144 | + Iterator<StationRoute> iterator = stationRouteRepository.findAllEffective().iterator(); | |
| 145 | + | |
| 146 | + Map<String, String> sePointMap = new HashMap<>(); | |
| 147 | + //lineSEPointMap | |
| 148 | + Map<String, Integer> map = new HashMap<>(); | |
| 149 | + | |
| 150 | + StationRoute route; | |
| 151 | + while (iterator.hasNext()) { | |
| 152 | + route = iterator.next(); | |
| 153 | + map.put(route.getLineCode() + "_" + route.getStationCode(), route.getDirections()); | |
| 154 | + | |
| 155 | + if (route.getStationMark() != null && | |
| 156 | + (route.getStationMark().equals("B") || route.getStationMark().equals("E"))) { | |
| 157 | + sePointMap.put(route.getLineCode() + "_" | |
| 158 | + + route.getDirections() | |
| 159 | + + "_" + route.getStationMark(), route.getStationCode()); | |
| 160 | + } | |
| 161 | + } | |
| 162 | + lineStationUpDownMap = map; | |
| 163 | + lineSEPointMap = sePointMap; | |
| 164 | + } | |
| 165 | + | |
| 166 | + /** | |
| 167 | + * @Title: loadDeviceInfo | |
| 168 | + * @Description: TODO(加载设备相关信息) | |
| 169 | + */ | |
| 170 | + public void loadDeviceInfo() { | |
| 171 | + BiMap<String, String> deviceId2Nbbm = HashBiMap.create(); | |
| 172 | + //车辆和公司代码对照 | |
| 173 | + Map<String, String> nbbm2CompanyCode = new HashMap<>(); | |
| 174 | + Iterator<Cars> carIterator = carsRepository.findAll().iterator(); | |
| 175 | + Cars car; | |
| 176 | + while (carIterator.hasNext()) { | |
| 177 | + car = carIterator.next(); | |
| 178 | + deviceId2Nbbm.put(car.getEquipmentCode(), car.getInsideCode()); | |
| 179 | + nbbm2CompanyCode.put(car.getInsideCode(), car.getBusinessCode()); | |
| 180 | + } | |
| 181 | + | |
| 182 | + deviceId2NbbmMap = deviceId2Nbbm; | |
| 183 | + nbbm2CompanyCodeMap = nbbm2CompanyCode; | |
| 184 | + } | |
| 185 | + | |
| 186 | + /** | |
| 187 | + * @Title: loadStationInfo | |
| 188 | + * @Description: TODO(加载站点信息) | |
| 189 | + */ | |
| 190 | + public void loadStationInfo() { | |
| 191 | + Map<String, String> stationCode2Name = new HashMap<>(); | |
| 192 | + Iterator<Station> iterator = stationRepository.findAll().iterator(); | |
| 193 | + //站点 | |
| 194 | + Station station; | |
| 195 | + while (iterator.hasNext()) { | |
| 196 | + station = iterator.next(); | |
| 197 | + stationCode2Name.put(station.getStationCod(), station.getStationName()); | |
| 198 | + } | |
| 199 | + //停车场 | |
| 200 | + Iterator<CarPark> iterator2 = carParkRepository.findAll().iterator(); | |
| 201 | + | |
| 202 | + List<String> parkCodes = new ArrayList<>(); | |
| 203 | + | |
| 204 | + CarPark carPark; | |
| 205 | + while (iterator2.hasNext()) { | |
| 206 | + carPark = iterator2.next(); | |
| 207 | + stationCode2Name.put(carPark.getParkCode(), carPark.getParkName()); | |
| 208 | + | |
| 209 | + parkCodes.add(carPark.getParkCode()); | |
| 210 | + } | |
| 211 | + parkCodeList = parkCodes; | |
| 212 | + stationCode2NameMap = stationCode2Name; | |
| 213 | + } | |
| 214 | + | |
| 215 | + /** | |
| 216 | + * @Title: loadNbbm2LineInfo | |
| 217 | + * @Description: TODO(车辆和线路对照) | |
| 218 | + */ | |
| 219 | + public void loadNbbm2LineInfo() { | |
| 220 | + Iterator<CarConfigInfo> allIterator = carConfigInfoRepository.findAll().iterator(); | |
| 221 | + Map<String, Line> ccMap = new HashMap<>(); | |
| 222 | + | |
| 223 | + CarConfigInfo cci; | |
| 224 | + while (allIterator.hasNext()) { | |
| 225 | + cci = allIterator.next(); | |
| 226 | + ccMap.put(cci.getCl().getInsideCode(), cci.getXl()); | |
| 227 | + } | |
| 228 | + nbbm2LineMap = ccMap; | |
| 229 | + } | |
| 230 | + | |
| 231 | + /** | |
| 232 | + * @Title: loadLineInfo | |
| 233 | + * @Description: TODO(加载线路相关信息) | |
| 234 | + */ | |
| 235 | + public void loadLineInfo(){ | |
| 236 | + List<StationRoute> stationsList = null;// 站点路由集 | |
| 237 | + StationRoute stationRoute = null; | |
| 238 | + int size = 0; | |
| 239 | + Map<String, Integer> station2Number ; | |
| 240 | + Map<String, Map> dirs2Statioin ; | |
| 241 | + int[] dirs = {0,1};// 运行方向 上下行 | |
| 242 | + int num = 1; | |
| 243 | + Iterator<Line> iterator = lineRepository.findAll().iterator(); | |
| 244 | + | |
| 245 | + Line line; | |
| 246 | + BiMap<Integer, String> biMap = HashBiMap.create(); | |
| 247 | + Map<String, String> code2name = new HashMap<>(); | |
| 248 | + Map<Integer, String> id2SHcode = new HashMap<Integer, String>(); | |
| 249 | + Map<String, String> code2SHcode = new HashMap<String, String>(); | |
| 250 | + Map<String, Map<String, Map>> tempStationName2YgcNumber = new HashMap<String, Map<String, Map>>(); | |
| 251 | + | |
| 252 | + while(iterator.hasNext()){ | |
| 253 | + line = iterator.next(); | |
| 254 | + biMap.put(line.getId(), line.getLineCode()); | |
| 255 | + code2name.put(line.getLineCode(), line.getName()); | |
| 256 | + id2SHcode.put(line.getId(),line.getShanghaiLinecode()); | |
| 257 | + code2SHcode.put(line.getLineCode(), line.getShanghaiLinecode()); | |
| 258 | + | |
| 259 | + /** | |
| 260 | + * 加载运管处的站点及序号 | |
| 261 | + * 上行从1开始,下行顺序续编 | |
| 262 | + | |
| 263 | + num = 1; | |
| 264 | + dirs2Statioin = new HashMap<String, Map>(); | |
| 265 | + for (int i = 0; i < dirs.length; i++) { | |
| 266 | + // 分别取得上下行的站点 | |
| 267 | + stationsList = stationRouteRepository.findByLine(line.getLineCode(), dirs[i]); | |
| 268 | + size = stationsList == null ? 0 :stationsList.size(); | |
| 269 | + if(size > 0 ){ | |
| 270 | + station2Number = new HashMap<String, Integer>(); | |
| 271 | + for (int j = 0; j < size; j++) { | |
| 272 | + stationRoute = stationsList.get(j); | |
| 273 | + // map保存为(站点名称 -->序号) | |
| 274 | + station2Number.put(stationRoute.getStationName(), num++); | |
| 275 | + } | |
| 276 | + // 保存两个数据,(0 --> station2Number)(1 --> station2Number) 0上行 1 下行 | |
| 277 | + dirs2Statioin.put(dirs[i]+"", station2Number); | |
| 278 | + } | |
| 279 | + } | |
| 280 | + // 保存(站点编码 --> dirs2Statioin) | |
| 281 | + tempStationName2YgcNumber.put(line.getLineCode(), dirs2Statioin); | |
| 282 | + */ | |
| 283 | + } | |
| 284 | + | |
| 285 | + lineId2CodeMap = biMap; | |
| 286 | + lineCode2NameMap = code2name; | |
| 287 | + lineId2ShangHaiCodeMap = id2SHcode; | |
| 288 | + lineCode2ShangHaiCodeMap = code2SHcode; | |
| 289 | + stationName2YgcNumber = tempStationName2YgcNumber; | |
| 290 | + } | |
| 291 | + | |
| 292 | + /** | |
| 293 | + * @Title: loadPersonnelInfo | |
| 294 | + * @Description: TODO(加载人员信息) | |
| 295 | + */ | |
| 296 | + public void loadPersonnelInfo() { | |
| 297 | + Iterator<Personnel> iterator = personnelRepository.findAll().iterator(); | |
| 298 | + | |
| 299 | + Map<String, Personnel> jsyTempMap = new HashMap<>(), spyTempMap = new HashMap<>(); | |
| 300 | + Map<String, String> allPersonMap = new HashMap<>(); | |
| 301 | + | |
| 302 | + Personnel p; | |
| 303 | + String jobCode; | |
| 304 | + while (iterator.hasNext()) { | |
| 305 | + p = iterator.next(); | |
| 306 | + | |
| 307 | + jobCode = p.getJobCode(); | |
| 308 | + if (StringUtils.isEmpty(jobCode)) | |
| 309 | + continue; | |
| 310 | + | |
| 311 | + /*if (jobCode.indexOf("-") != -1) { | |
| 312 | + jobCode = jobCode.split("-")[1]; | |
| 313 | + }*/ | |
| 314 | + if (p.getPosts() != null) { | |
| 315 | + if (p.getPosts().equals("1")) | |
| 316 | + jsyTempMap.put(jobCode, p); | |
| 317 | + else if (p.getPosts().equals("2")) | |
| 318 | + spyTempMap.put(jobCode, p); | |
| 319 | + } | |
| 320 | + | |
| 321 | + allPersonMap.put(jobCode, p.getPersonnelName()); | |
| 322 | + } | |
| 323 | + | |
| 324 | + jsyMap = jsyTempMap; | |
| 325 | + spyMap = spyTempMap; | |
| 326 | + allPerson = allPersonMap; | |
| 327 | + } | |
| 328 | + } | |
| 290 | 329 | } | ... | ... |
src/main/java/com/bsth/data/arrival/ArrivalData_GPS.java
| 1 | 1 | package com.bsth.data.arrival; |
| 2 | 2 | |
| 3 | -import java.util.ArrayList; | |
| 4 | -import java.util.Collection; | |
| 5 | -import java.util.HashMap; | |
| 6 | -import java.util.List; | |
| 7 | -import java.util.Map; | |
| 8 | -import java.util.Set; | |
| 9 | -import java.util.TreeSet; | |
| 10 | -import java.util.concurrent.TimeUnit; | |
| 11 | - | |
| 3 | +import com.bsth.data.match.Arrival2Schedule; | |
| 4 | +import com.bsth.data.schedule.DayOfSchedule; | |
| 5 | +import com.google.common.collect.ArrayListMultimap; | |
| 6 | +import com.google.common.collect.ListMultimap; | |
| 12 | 7 | import org.slf4j.Logger; |
| 13 | 8 | import org.slf4j.LoggerFactory; |
| 14 | 9 | import org.springframework.beans.factory.annotation.Autowired; |
| 15 | 10 | import org.springframework.boot.CommandLineRunner; |
| 16 | 11 | import org.springframework.stereotype.Component; |
| 17 | 12 | |
| 18 | -import com.bsth.Application; | |
| 19 | -import com.bsth.data.match.Arrival2Schedule; | |
| 20 | -import com.bsth.data.schedule.DayOfSchedule; | |
| 21 | -import com.google.common.collect.ArrayListMultimap; | |
| 22 | -import com.google.common.collect.ListMultimap; | |
| 13 | +import java.util.*; | |
| 23 | 14 | |
| 24 | 15 | /** |
| 25 | 16 | * |
| ... | ... | @@ -32,7 +23,7 @@ import com.google.common.collect.ListMultimap; |
| 32 | 23 | @Component |
| 33 | 24 | public class ArrivalData_GPS implements CommandLineRunner{ |
| 34 | 25 | |
| 35 | - // 起终点站进出数据 K:车辆编码 | |
| 26 | + // 起终点站进出数据 K:车辆编码 | |
| 36 | 27 | private static ListMultimap<String, ArrivalEntity> startAndEndMaps; |
| 37 | 28 | |
| 38 | 29 | private static Map<String, Integer> carIndexMap; |
| ... | ... | @@ -50,8 +41,8 @@ public class ArrivalData_GPS implements CommandLineRunner{ |
| 50 | 41 | |
| 51 | 42 | @Override |
| 52 | 43 | public void run(String... arg0) throws Exception { |
| 53 | - logger.info("ArrivalData_GPS,100,10 @11-10"); | |
| 54 | - //Application.mainServices.scheduleWithFixedDelay(dataLoaderThread, 100, 10, TimeUnit.SECONDS); | |
| 44 | + logger.info("ArrivalData_GPS,30,10"); | |
| 45 | + //Application.mainServices.scheduleWithFixedDelay(dataLoaderThread, 40, 10, TimeUnit.SECONDS); | |
| 55 | 46 | } |
| 56 | 47 | |
| 57 | 48 | @Component |
| ... | ... | @@ -69,6 +60,7 @@ public class ArrivalData_GPS implements CommandLineRunner{ |
| 69 | 60 | @Override |
| 70 | 61 | public void run() { |
| 71 | 62 | try{ |
| 63 | + logger.info("开始加载到离站数据, " + System.currentTimeMillis()); | |
| 72 | 64 | List<ArrivalEntity> arrSets = dataLoader.load(); |
| 73 | 65 | if(null == arrSets || arrSets.size() == 0) |
| 74 | 66 | return; | ... | ... |
src/main/java/com/bsth/data/gpsdata/GpsEntity.java
| ... | ... | @@ -71,6 +71,9 @@ public class GpsEntity { |
| 71 | 71 | |
| 72 | 72 | private int version; |
| 73 | 73 | |
| 74 | + /** 是否起终点站 */ | |
| 75 | + private boolean sEPoint; | |
| 76 | + | |
| 74 | 77 | public Integer getCompanyCode() { |
| 75 | 78 | return companyCode; |
| 76 | 79 | } |
| ... | ... | @@ -238,4 +241,12 @@ public class GpsEntity { |
| 238 | 241 | public void setVersion(int version) { |
| 239 | 242 | this.version = version; |
| 240 | 243 | } |
| 244 | + | |
| 245 | + public boolean issEPoint() { | |
| 246 | + return sEPoint; | |
| 247 | + } | |
| 248 | + | |
| 249 | + public void setsEPoint(boolean sEPoint) { | |
| 250 | + this.sEPoint = sEPoint; | |
| 251 | + } | |
| 241 | 252 | } | ... | ... |
src/main/java/com/bsth/data/gpsdata/GpsRealData.java
| ... | ... | @@ -28,7 +28,7 @@ import com.bsth.util.ConfigUtil; |
| 28 | 28 | import com.google.common.collect.TreeMultimap; |
| 29 | 29 | |
| 30 | 30 | /** |
| 31 | - * | |
| 31 | + * | |
| 32 | 32 | * @ClassName: GpsRealData |
| 33 | 33 | * @Description: TODO(实时GPS数据集合) |
| 34 | 34 | * @author PanZhao |
| ... | ... | @@ -37,25 +37,25 @@ import com.google.common.collect.TreeMultimap; |
| 37 | 37 | */ |
| 38 | 38 | @Component |
| 39 | 39 | public class GpsRealData implements CommandLineRunner{ |
| 40 | - | |
| 40 | + | |
| 41 | 41 | static Logger logger = LoggerFactory.getLogger(GpsRealData.class); |
| 42 | - | |
| 42 | + | |
| 43 | 43 | private static Map<String, GpsEntity> gpsMap; |
| 44 | - | |
| 44 | + | |
| 45 | 45 | //按线路分组设备号 |
| 46 | 46 | private static TreeMultimap<String, String> lineCode2Devices; |
| 47 | 47 | |
| 48 | 48 | // 网关数据接口地址 |
| 49 | 49 | private static String url; |
| 50 | - | |
| 50 | + | |
| 51 | 51 | @Autowired |
| 52 | 52 | GpsDataLoader gpsDataLoader; |
| 53 | - | |
| 53 | + | |
| 54 | 54 | @Autowired |
| 55 | 55 | DayOfSchedule dayOfSchedule; |
| 56 | - | |
| 56 | + | |
| 57 | 57 | @Autowired |
| 58 | - ForecastRealServer forecastRealServer; | |
| 58 | + ForecastRealServer forecastRealServer; | |
| 59 | 59 | /** |
| 60 | 60 | * 构造函数 |
| 61 | 61 | */ |
| ... | ... | @@ -64,49 +64,52 @@ public class GpsRealData implements CommandLineRunner{ |
| 64 | 64 | lineCode2Devices = TreeMultimap.create(); |
| 65 | 65 | url = ConfigUtil.get("http.gps.real.url"); |
| 66 | 66 | } |
| 67 | - | |
| 67 | + | |
| 68 | 68 | @Override |
| 69 | 69 | public void run(String... arg0) throws Exception { |
| 70 | 70 | logger.info("gpsDataLoader,20,6"); |
| 71 | - //Application.mainServices.scheduleWithFixedDelay(gpsDataLoader, 20, 6, TimeUnit.SECONDS); | |
| 71 | + Application.mainServices.scheduleWithFixedDelay(gpsDataLoader, 20, 5, TimeUnit.SECONDS); | |
| 72 | 72 | } |
| 73 | 73 | |
| 74 | 74 | public GpsEntity add(GpsEntity gps) { |
| 75 | 75 | String device = gps.getDeviceId(); |
| 76 | 76 | GpsEntity old = gpsMap.get(device); |
| 77 | - | |
| 78 | - //定时定距数据附带站点编码改变 | |
| 79 | - if(null == old || !old.getStopNo().equals(gps.getStopNo())){ | |
| 80 | - gps.setArrTime(gps.getTimestamp()); | |
| 81 | - //预测到达终点时间 | |
| 82 | - forecastRealServer.forecast(gps.getNbbm(), gps); | |
| 83 | - } | |
| 84 | - else{ | |
| 85 | - gps.setArrTime(old.getArrTime()); | |
| 86 | - //不预测, 重新计算终点时间 | |
| 87 | - gps.setExpectStopTime(forecastRealServer.expectStopTime(gps.getNbbm())); | |
| 77 | + | |
| 78 | + if(!StringUtils.isEmpty(gps.getStopNo())){ | |
| 79 | + //定时定距数据附带站点编码改变 | |
| 80 | + if(null == old || !gps.getStopNo().equals(old.getStopNo())){ | |
| 81 | + gps.setArrTime(gps.getTimestamp()); | |
| 82 | + //预测到达终点时间 | |
| 83 | + forecastRealServer.forecast(gps.getNbbm(), gps); | |
| 84 | + } | |
| 85 | + else{ | |
| 86 | + gps.setArrTime(old.getArrTime()); | |
| 87 | + //不预测, 重新计算终点时间 | |
| 88 | + gps.setExpectStopTime(forecastRealServer.expectStopTime(gps.getNbbm())); | |
| 89 | + } | |
| 88 | 90 | } |
| 89 | - | |
| 91 | + | |
| 90 | 92 | gpsMap.put(device, gps); |
| 91 | - lineCode2Devices.put(gps.getLineId(), device); | |
| 93 | + if(StringUtils.isNotBlank(gps.getLineId())) | |
| 94 | + lineCode2Devices.put(gps.getLineId(), device); | |
| 92 | 95 | return gps; |
| 93 | 96 | } |
| 94 | 97 | |
| 95 | 98 | /** |
| 96 | - * | |
| 99 | + * | |
| 97 | 100 | * @Title: get @Description: TODO(设备号获取GPS) |
| 98 | 101 | */ |
| 99 | 102 | public GpsEntity get(String deviceId) { |
| 100 | 103 | return gpsMap.get(deviceId); |
| 101 | 104 | } |
| 102 | - | |
| 105 | + | |
| 103 | 106 | /** |
| 104 | - * | |
| 107 | + * | |
| 105 | 108 | * @Title: get @Description: TODO(线路编码获取GPS集合) @throws |
| 106 | 109 | */ |
| 107 | 110 | public List<GpsEntity> getByLine(String lineCode) { |
| 108 | 111 | NavigableSet<String> set = lineCode2Devices.get(lineCode); |
| 109 | - | |
| 112 | + | |
| 110 | 113 | List<GpsEntity> rs = new ArrayList<>(); |
| 111 | 114 | GpsEntity gps; |
| 112 | 115 | ScheduleRealInfo sch; |
| ... | ... | @@ -115,19 +118,19 @@ public class GpsRealData implements CommandLineRunner{ |
| 115 | 118 | //过滤异常GPS数据 |
| 116 | 119 | if(gps.isAbnormal()) |
| 117 | 120 | continue; |
| 118 | - | |
| 121 | + | |
| 119 | 122 | sch = dayOfSchedule.execPlamMap().get(gps.getNbbm()); |
| 120 | 123 | if(null != sch) |
| 121 | 124 | gps.setSchId(sch.getId()); |
| 122 | 125 | rs.add(gps); |
| 123 | 126 | } |
| 124 | - | |
| 127 | + | |
| 125 | 128 | return rs; |
| 126 | 129 | } |
| 127 | - | |
| 130 | + | |
| 128 | 131 | public List<GpsEntity> get(List<String> pArray){ |
| 129 | 132 | List<GpsEntity> list = new ArrayList<>(); |
| 130 | - | |
| 133 | + | |
| 131 | 134 | for(String code : pArray) |
| 132 | 135 | list.addAll(getByLine(code)); |
| 133 | 136 | return list; |
| ... | ... | @@ -136,11 +139,11 @@ public class GpsRealData implements CommandLineRunner{ |
| 136 | 139 | public Set<String> allDevices(){ |
| 137 | 140 | return gpsMap.keySet(); |
| 138 | 141 | } |
| 139 | - | |
| 142 | + | |
| 140 | 143 | public GpsEntity findByDeviceId(String deviceId) { |
| 141 | 144 | return gpsMap.get(deviceId); |
| 142 | 145 | } |
| 143 | - | |
| 146 | + | |
| 144 | 147 | public Collection<GpsEntity> all(){ |
| 145 | 148 | return gpsMap.values(); |
| 146 | 149 | } |
| ... | ... | @@ -150,9 +153,9 @@ public class GpsRealData implements CommandLineRunner{ |
| 150 | 153 | } |
| 151 | 154 | @Component |
| 152 | 155 | public static class GpsDataLoader extends Thread{ |
| 153 | - | |
| 156 | + | |
| 154 | 157 | Logger logger = LoggerFactory.getLogger(GpsDataLoader.class); |
| 155 | - | |
| 158 | + | |
| 156 | 159 | @Autowired |
| 157 | 160 | GpsRealData gpsRealData; |
| 158 | 161 | |
| ... | ... | @@ -164,7 +167,7 @@ public class GpsRealData implements CommandLineRunner{ |
| 164 | 167 | logger.error("", e); |
| 165 | 168 | } |
| 166 | 169 | } |
| 167 | - | |
| 170 | + | |
| 168 | 171 | public void load() throws Exception { |
| 169 | 172 | List<GpsEntity> list = new ArrayList<>(); |
| 170 | 173 | CloseableHttpClient httpClient = null; |
| ... | ... | @@ -172,7 +175,7 @@ public class GpsRealData implements CommandLineRunner{ |
| 172 | 175 | try { |
| 173 | 176 | httpClient = HttpClients.createDefault(); |
| 174 | 177 | HttpGet get = new HttpGet(url); |
| 175 | - | |
| 178 | + | |
| 176 | 179 | response = httpClient.execute(get); |
| 177 | 180 | |
| 178 | 181 | HttpEntity entity = response.getEntity(); |
| ... | ... | @@ -181,32 +184,45 @@ public class GpsRealData implements CommandLineRunner{ |
| 181 | 184 | BufferedReader br = new BufferedReader(new InputStreamReader(entity.getContent())); |
| 182 | 185 | StringBuffer stringBuffer = new StringBuffer(); |
| 183 | 186 | String str = ""; |
| 184 | - while ((str = br.readLine()) != null) | |
| 187 | + while ((str = br.readLine()) != null) | |
| 185 | 188 | stringBuffer.append(str); |
| 186 | 189 | |
| 187 | 190 | JSONObject jsonObj = JSON.parseObject(stringBuffer.toString()); |
| 188 | 191 | |
| 189 | - if (jsonObj != null) | |
| 192 | + if (jsonObj != null) | |
| 190 | 193 | list = JSON.parseArray(jsonObj.getString("data"), GpsEntity.class); |
| 191 | - | |
| 194 | + | |
| 192 | 195 | String nbbm; |
| 193 | - //附加车辆内部编码 | |
| 194 | - Integer updown; | |
| 195 | 196 | for(GpsEntity gps : list){ |
| 197 | + //没有设备号 | |
| 198 | + if(StringUtils.isBlank(gps.getDeviceId())) | |
| 199 | + continue; | |
| 200 | + | |
| 196 | 201 | nbbm = BasicData.deviceId2NbbmMap.get(gps.getDeviceId()); |
| 197 | 202 | if(StringUtils.isBlank(nbbm)) |
| 198 | 203 | gps.setAbnormal(true);//标记为异常数据 |
| 199 | 204 | else |
| 200 | 205 | gps.setNbbm(nbbm); |
| 201 | - | |
| 206 | + | |
| 202 | 207 | gps.setStationName(BasicData.stationCode2NameMap.get(gps.getStopNo())); |
| 208 | + gpsRealData.add(gps); | |
| 209 | + | |
| 210 | + //纠正走向 | |
| 211 | + correctUpdown(gps); | |
| 212 | + /*if(issEPoint(gps)) | |
| 213 | + continue; | |
| 214 | + | |
| 215 | + //如果走向未知,尝试根据站点纠正走向 | |
| 203 | 216 | if(gps.getUpDown() == -1){ |
| 204 | - //如果走向未知,尝试根据站点纠正走向 | |
| 205 | - updown=BasicData.lineStationUpDownMap.get(gps.getLineId()+"_"+gps.getStopNo()); | |
| 217 | + updown=stationUpDownMap.get(gps.getLineId()+"_"+gps.getStopNo()); | |
| 206 | 218 | if(updown != null) |
| 207 | 219 | gps.setUpDown(updown); |
| 208 | 220 | } |
| 209 | - gpsRealData.add(gps); | |
| 221 | + //如果站点编码和走向相反(即上行站点ID,走向为下行),尝试根据站点纠正走向 | |
| 222 | + updown=stationUpDownMap.get(gps.getLineId()+"_"+gps.getStopNo()); | |
| 223 | + if(updown != null && !gps.getUpDown().equals(updown)){ | |
| 224 | + gps.setUpDown(updown); | |
| 225 | + }*/ | |
| 210 | 226 | } |
| 211 | 227 | } else |
| 212 | 228 | logger.error("result is null"); |
| ... | ... | @@ -220,5 +236,55 @@ public class GpsRealData implements CommandLineRunner{ |
| 220 | 236 | response.close(); |
| 221 | 237 | } |
| 222 | 238 | } |
| 239 | + | |
| 240 | + /** | |
| 241 | + * 是否是起终点 | |
| 242 | + * @param gps | |
| 243 | + * @return | |
| 244 | + */ | |
| 245 | + public boolean isSEPoint(GpsEntity gps){ | |
| 246 | + String key = gps.getLineId()+"_"+gps.getUpDown()+"_" | |
| 247 | + ,stationCode; | |
| 248 | + | |
| 249 | + if(BasicData.lineSEPointMap.containsKey(key+"B")){ | |
| 250 | + stationCode = BasicData.lineSEPointMap.get(key+"B"); | |
| 251 | + if(gps.getStopNo().equals(stationCode)){ | |
| 252 | + gps.setsEPoint(true); | |
| 253 | + return true; | |
| 254 | + } | |
| 255 | + } | |
| 256 | + | |
| 257 | + if(BasicData.lineSEPointMap.containsKey(key+"E")){ | |
| 258 | + stationCode = BasicData.lineSEPointMap.get(key+"E"); | |
| 259 | + if(gps.getStopNo().equals(stationCode)){ | |
| 260 | + gps.setsEPoint(true); | |
| 261 | + return true; | |
| 262 | + } | |
| 263 | + } | |
| 264 | + return false; | |
| 265 | + } | |
| 266 | + | |
| 267 | + /** | |
| 268 | + * 纠正上下行 | |
| 269 | + * @param gps | |
| 270 | + */ | |
| 271 | + public void correctUpdown(GpsEntity gps){ | |
| 272 | + Integer updown=BasicData.lineStationUpDownMap.get(gps.getLineId()+"_"+gps.getStopNo()); | |
| 273 | + if(updown != null && !updown.equals(gps.getUpDown())) | |
| 274 | + gps.setUpDown(updown); | |
| 275 | + /*//如果走向未知,尝试根据站点纠正走向 | |
| 276 | + if(gps.getUpDown() == -1){ | |
| 277 | + | |
| 278 | + }*/ | |
| 279 | + | |
| 280 | + if(isSEPoint(gps)) | |
| 281 | + return; | |
| 282 | + | |
| 283 | + /*//如果站点编码和走向相反(即上行站点ID,走向为下行),尝试根据站点纠正走向 | |
| 284 | + updown=BasicData.lineStationUpDownMap.get(gps.getLineId()+"_"+gps.getStopNo()); | |
| 285 | + if(updown != null && !gps.getUpDown().equals(updown)){ | |
| 286 | + gps.setUpDown(updown); | |
| 287 | + }*/ | |
| 288 | + } | |
| 223 | 289 | } |
| 224 | 290 | } | ... | ... |
src/main/java/com/bsth/data/schedule/DayOfSchedule.java
| ... | ... | @@ -130,11 +130,11 @@ public class DayOfSchedule implements CommandLineRunner { |
| 130 | 130 | //翻班线程 |
| 131 | 131 | Application.mainServices.scheduleWithFixedDelay(scheduleRefreshThread, 15, 240, TimeUnit.SECONDS); |
| 132 | 132 | //入库 |
| 133 | - //Application.mainServices.scheduleWithFixedDelay(schedulePstThread, 60, 60, TimeUnit.SECONDS); | |
| 133 | + Application.mainServices.scheduleWithFixedDelay(schedulePstThread, 60, 60, TimeUnit.SECONDS); | |
| 134 | 134 | //首班出场指令补发器 |
| 135 | - //Application.mainServices.scheduleWithFixedDelay(firstScheduleCheckThread, 30, 240, TimeUnit.SECONDS); | |
| 135 | + Application.mainServices.scheduleWithFixedDelay(firstScheduleCheckThread, 30, 240, TimeUnit.SECONDS); | |
| 136 | 136 | //班次误点扫描 |
| 137 | - //Application.mainServices.scheduleWithFixedDelay(scheduleLateThread, 60, 60, TimeUnit.SECONDS); | |
| 137 | + Application.mainServices.scheduleWithFixedDelay(scheduleLateThread, 60, 60, TimeUnit.SECONDS); | |
| 138 | 138 | |
| 139 | 139 | //每天凌晨2点20提交数据到运管处 |
| 140 | 140 | long diff = (DateUtils.getTimestamp() + 1000*60*140) - System.currentTimeMillis(); | ... | ... |
src/main/java/com/bsth/data/schedule/thread/SchedulePstThread.java
| 1 | 1 | package com.bsth.data.schedule.thread; |
| 2 | 2 | |
| 3 | -import java.util.LinkedList; | |
| 4 | - | |
| 5 | -import org.springframework.beans.factory.annotation.Autowired; | |
| 6 | -import org.springframework.stereotype.Component; | |
| 7 | - | |
| 8 | 3 | import com.bsth.data.schedule.DayOfSchedule; |
| 9 | 4 | import com.bsth.entity.realcontrol.ScheduleRealInfo; |
| 10 | 5 | import com.bsth.repository.realcontrol.ScheduleRealInfoRepository; |
| 6 | +import org.slf4j.Logger; | |
| 7 | +import org.slf4j.LoggerFactory; | |
| 8 | +import org.springframework.beans.factory.annotation.Autowired; | |
| 9 | +import org.springframework.orm.jpa.JpaObjectRetrievalFailureException; | |
| 10 | +import org.springframework.stereotype.Component; | |
| 11 | + | |
| 12 | +import javax.persistence.EntityNotFoundException; | |
| 13 | +import java.util.LinkedList; | |
| 11 | 14 | |
| 12 | 15 | /** |
| 13 | - * | |
| 14 | - * @ClassName: SchedulePstThread | |
| 15 | - * @Description: TODO(班次异步持久化) | |
| 16 | - * @author PanZhao | |
| 17 | - * @date 2016年8月24日 上午1:47:05 | |
| 18 | - * | |
| 16 | + * @author PanZhao | |
| 17 | + * @ClassName: SchedulePstThread | |
| 18 | + * @Description: TODO(班次异步持久化) | |
| 19 | + * @date 2016年8月24日 上午1:47:05 | |
| 19 | 20 | */ |
| 20 | 21 | @Component |
| 21 | -public class SchedulePstThread extends Thread{ | |
| 22 | - | |
| 23 | - @Autowired | |
| 24 | - ScheduleRealInfoRepository scheduleRepository; | |
| 25 | - | |
| 26 | - @Override | |
| 27 | - public void run() { | |
| 28 | - LinkedList<ScheduleRealInfo> list = DayOfSchedule.pstBuffer; | |
| 29 | - | |
| 30 | - ScheduleRealInfo schedule; | |
| 31 | - for (int i = 0; i < 1000; i++) { | |
| 32 | - schedule = list.poll(); | |
| 33 | - if (null == schedule) | |
| 34 | - break; | |
| 35 | - | |
| 36 | - scheduleRepository.save(schedule); | |
| 37 | - } | |
| 38 | - } | |
| 22 | +public class SchedulePstThread extends Thread { | |
| 23 | + | |
| 24 | + @Autowired | |
| 25 | + ScheduleRealInfoRepository scheduleRepository; | |
| 26 | + | |
| 27 | + Logger logger = LoggerFactory.getLogger(this.getClass()); | |
| 28 | + | |
| 29 | + @Override | |
| 30 | + public void run() { | |
| 31 | + | |
| 32 | + LinkedList<ScheduleRealInfo> list = DayOfSchedule.pstBuffer; | |
| 33 | + | |
| 34 | + ScheduleRealInfo schedule; | |
| 35 | + for (int i = 0; i < 1000; i++) { | |
| 36 | + schedule = list.poll(); | |
| 37 | + if (null == schedule) | |
| 38 | + break; | |
| 39 | + | |
| 40 | + try { | |
| 41 | + scheduleRepository.save(schedule); | |
| 42 | + } | |
| 43 | + catch (JpaObjectRetrievalFailureException e1){ | |
| 44 | + logger.error("JpaObjectRetrievalFailureException error.... 可忽略"); | |
| 45 | + } | |
| 46 | + catch(EntityNotFoundException e2){ | |
| 47 | + logger.error("EntityNotFoundException error.... 可忽略"); | |
| 48 | + } | |
| 49 | + catch (Exception e) { | |
| 50 | + logger.error("", e); | |
| 51 | + } | |
| 52 | + } | |
| 53 | + } | |
| 39 | 54 | } | ... | ... |
src/main/java/com/bsth/entity/Station.java
| ... | ... | @@ -97,7 +97,16 @@ public class Station { |
| 97 | 97 | |
| 98 | 98 | // 版本号 |
| 99 | 99 | private Integer versions; |
| 100 | - | |
| 100 | + | |
| 101 | + /** 是否有电子站牌 这里是老调度系统的原始字段,暂时保留该字段。 */ | |
| 102 | + private Integer isHaveLed; | |
| 103 | + | |
| 104 | + /** 是否有候车亭 这里是老调度系统的原始字段,暂时保留该字段。*/ | |
| 105 | + private Integer isHaveShelter; | |
| 106 | + | |
| 107 | + /** 是否港湾式公交站 这里是老调度系统的原始字段,暂时保留该字段。*/ | |
| 108 | + private Integer isHarbourStation; | |
| 109 | + | |
| 101 | 110 | // 描述 |
| 102 | 111 | private String descriptions; |
| 103 | 112 | |
| ... | ... | @@ -115,6 +124,30 @@ public class Station { |
| 115 | 124 | @Column(name = "update_date", columnDefinition = "timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP") |
| 116 | 125 | private Date updateDate; |
| 117 | 126 | |
| 127 | + public Integer getIsHaveLed() { | |
| 128 | + return isHaveLed; | |
| 129 | + } | |
| 130 | + | |
| 131 | + public void setIsHaveLed(Integer isHaveLed) { | |
| 132 | + this.isHaveLed = isHaveLed; | |
| 133 | + } | |
| 134 | + | |
| 135 | + public Integer getIsHaveShelter() { | |
| 136 | + return isHaveShelter; | |
| 137 | + } | |
| 138 | + | |
| 139 | + public void setIsHaveShelter(Integer isHaveShelter) { | |
| 140 | + this.isHaveShelter = isHaveShelter; | |
| 141 | + } | |
| 142 | + | |
| 143 | + public Integer getIsHarbourStation() { | |
| 144 | + return isHarbourStation; | |
| 145 | + } | |
| 146 | + | |
| 147 | + public void setIsHarbourStation(Integer isHarbourStation) { | |
| 148 | + this.isHarbourStation = isHarbourStation; | |
| 149 | + } | |
| 150 | + | |
| 118 | 151 | public String getAddr() { |
| 119 | 152 | return addr; |
| 120 | 153 | } | ... | ... |
src/main/java/com/bsth/entity/mcy_forms/Changetochange.java
| 1 | 1 | package com.bsth.entity.mcy_forms; |
| 2 | 2 | |
| 3 | +import java.util.Date; | |
| 4 | + | |
| 5 | +import javax.persistence.Entity; | |
| 6 | +import javax.persistence.GeneratedValue; | |
| 7 | +import javax.persistence.Id; | |
| 8 | +import javax.persistence.Table; | |
| 9 | + | |
| 10 | +@Entity | |
| 11 | +@Table(name = "bsth_c_chtoch") | |
| 3 | 12 | public class Changetochange { |
| 13 | + @Id | |
| 14 | + @GeneratedValue | |
| 15 | + private Integer id; | |
| 16 | + | |
| 17 | + private String rq;//日期 | |
| 18 | + | |
| 19 | + private String gs;//公司 | |
| 20 | + | |
| 21 | + private String fgs;//分公司 | |
| 22 | + | |
| 23 | + private String xl;//线路 | |
| 24 | + | |
| 25 | + private String lp;//路牌 | |
| 26 | + | |
| 27 | + private String fssj;//发生时间 | |
| 28 | + | |
| 29 | + private String xgsj;//修改时间 | |
| 30 | + | |
| 31 | + private String pcch;//配车车号 | |
| 32 | + | |
| 33 | + private String pcry;//配车人员 | |
| 34 | + | |
| 35 | + private String jhch;//计划车号 | |
| 36 | + | |
| 37 | + private String jhgh;//计划工号 | |
| 38 | + | |
| 39 | + private String sjch;//实际车号 | |
| 40 | + | |
| 41 | + private String sjgh;//实际工号 | |
| 42 | + | |
| 43 | + private String yy;//原因 | |
| 44 | + | |
| 45 | + private String xgr;//修改人 | |
| 46 | + | |
| 47 | + | |
| 48 | + public Integer getId() { | |
| 49 | + return id; | |
| 50 | + } | |
| 51 | + | |
| 52 | + public void setId(Integer id) { | |
| 53 | + this.id = id; | |
| 54 | + } | |
| 55 | + | |
| 56 | + public String getRq() { | |
| 57 | + return rq; | |
| 58 | + } | |
| 59 | + | |
| 60 | + public void setRq(String rq) { | |
| 61 | + this.rq = rq; | |
| 62 | + } | |
| 63 | + | |
| 64 | + public String getGs() { | |
| 65 | + return gs; | |
| 66 | + } | |
| 67 | + | |
| 68 | + public void setGs(String gs) { | |
| 69 | + this.gs = gs; | |
| 70 | + } | |
| 71 | + | |
| 72 | + public String getFgs() { | |
| 73 | + return fgs; | |
| 74 | + } | |
| 75 | + | |
| 76 | + public void setFgs(String fgs) { | |
| 77 | + this.fgs = fgs; | |
| 78 | + } | |
| 79 | + | |
| 80 | + public String getXl() { | |
| 81 | + return xl; | |
| 82 | + } | |
| 83 | + | |
| 84 | + public void setXl(String xl) { | |
| 85 | + this.xl = xl; | |
| 86 | + } | |
| 87 | + | |
| 88 | + public String getLp() { | |
| 89 | + return lp; | |
| 90 | + } | |
| 91 | + | |
| 92 | + public void setLp(String lp) { | |
| 93 | + this.lp = lp; | |
| 94 | + } | |
| 95 | + | |
| 96 | + public String getFssj() { | |
| 97 | + return fssj; | |
| 98 | + } | |
| 99 | + | |
| 100 | + public void setFssj(String fssj) { | |
| 101 | + this.fssj = fssj; | |
| 102 | + } | |
| 103 | + | |
| 104 | + public String getXgsj() { | |
| 105 | + return xgsj; | |
| 106 | + } | |
| 107 | + | |
| 108 | + public void setXgsj(String xgsj) { | |
| 109 | + this.xgsj = xgsj; | |
| 110 | + } | |
| 111 | + | |
| 112 | + public String getPcch() { | |
| 113 | + return pcch; | |
| 114 | + } | |
| 115 | + | |
| 116 | + public void setPcch(String pcch) { | |
| 117 | + this.pcch = pcch; | |
| 118 | + } | |
| 119 | + | |
| 120 | + public String getPcry() { | |
| 121 | + return pcry; | |
| 122 | + } | |
| 123 | + | |
| 124 | + public void setPcry(String pcry) { | |
| 125 | + this.pcry = pcry; | |
| 126 | + } | |
| 127 | + | |
| 128 | + | |
| 129 | + public String getJhch() { | |
| 130 | + return jhch; | |
| 131 | + } | |
| 132 | + | |
| 133 | + public void setJhch(String jhch) { | |
| 134 | + this.jhch = jhch; | |
| 135 | + } | |
| 136 | + | |
| 137 | + public String getJhgh() { | |
| 138 | + return jhgh; | |
| 139 | + } | |
| 140 | + | |
| 141 | + public void setJhgh(String jhgh) { | |
| 142 | + this.jhgh = jhgh; | |
| 143 | + } | |
| 144 | + | |
| 145 | + public String getSjch() { | |
| 146 | + return sjch; | |
| 147 | + } | |
| 148 | + | |
| 149 | + public void setSjch(String sjch) { | |
| 150 | + this.sjch = sjch; | |
| 151 | + } | |
| 152 | + | |
| 153 | + public String getSjgh() { | |
| 154 | + return sjgh; | |
| 155 | + } | |
| 156 | + | |
| 157 | + public void setSjgh(String sjgh) { | |
| 158 | + this.sjgh = sjgh; | |
| 159 | + } | |
| 160 | + | |
| 161 | + public String getYy() { | |
| 162 | + return yy; | |
| 163 | + } | |
| 164 | + | |
| 165 | + public void setYy(String yy) { | |
| 166 | + this.yy = yy; | |
| 167 | + } | |
| 168 | + | |
| 169 | + public String getXgr() { | |
| 170 | + return xgr; | |
| 171 | + } | |
| 172 | + | |
| 173 | + public void setXgr(String xgr) { | |
| 174 | + this.xgr = xgr; | |
| 175 | + } | |
| 176 | + | |
| 4 | 177 | |
| 5 | 178 | |
| 6 | 179 | } | ... | ... |
src/main/java/com/bsth/entity/schedule/SchedulePlanInfo.java
| ... | ... | @@ -3,6 +3,7 @@ package com.bsth.entity.schedule; |
| 3 | 3 | import com.bsth.entity.Line; |
| 4 | 4 | import com.bsth.entity.sys.SysUser; |
| 5 | 5 | import com.bsth.service.schedule.rules.shiftloop.ScheduleResult_output; |
| 6 | +import org.apache.commons.lang3.StringUtils; | |
| 6 | 7 | |
| 7 | 8 | import javax.persistence.*; |
| 8 | 9 | import java.util.Date; |
| ... | ... | @@ -199,12 +200,29 @@ public class SchedulePlanInfo { |
| 199 | 200 | } |
| 200 | 201 | |
| 201 | 202 | this.j = employeeConfigInfo.getJsy().getId(); |
| 202 | - this.jGh = employeeConfigInfo.getJsy().getJobCode(); | |
| 203 | +// this.jGh = employeeConfigInfo.getJsy().getJobCode(); | |
| 204 | + if (StringUtils.isNotEmpty(employeeConfigInfo.getJsy().getJobCode())) { | |
| 205 | + String[] jsy_temp = employeeConfigInfo.getJsy().getJobCode().split("-"); | |
| 206 | + if (jsy_temp.length > 1) { | |
| 207 | + this.jGh = jsy_temp[1]; | |
| 208 | + } else { | |
| 209 | + this.jGh = jsy_temp[0]; | |
| 210 | + } | |
| 211 | + } | |
| 203 | 212 | this.jName = employeeConfigInfo.getJsy().getPersonnelName(); |
| 204 | 213 | // 关联的售票员 |
| 205 | 214 | if (employeeConfigInfo.getSpy() != null) { |
| 206 | 215 | this.s = employeeConfigInfo.getSpy().getId(); |
| 207 | - this.sGh = employeeConfigInfo.getSpy().getJobCode(); | |
| 216 | +// this.sGh = employeeConfigInfo.getSpy().getJobCode(); | |
| 217 | + if (StringUtils.isNotEmpty(employeeConfigInfo.getSpy().getJobCode())) { | |
| 218 | + String[] spy_temp = employeeConfigInfo.getSpy().getJobCode().split("-"); | |
| 219 | + if (spy_temp.length > 1) { | |
| 220 | + this.sGh = spy_temp[1]; | |
| 221 | + } else { | |
| 222 | + this.sGh = spy_temp[0]; | |
| 223 | + } | |
| 224 | + } | |
| 225 | + | |
| 208 | 226 | this.sName = employeeConfigInfo.getSpy().getPersonnelName(); |
| 209 | 227 | } |
| 210 | 228 | ... | ... |
src/main/java/com/bsth/entity/sys/CompanyAuthority.java
0 → 100644
| 1 | +package com.bsth.entity.sys; | |
| 2 | + | |
| 3 | +import javax.persistence.*; | |
| 4 | + | |
| 5 | +/** | |
| 6 | + * Created by panzhao on 2016/11/22. | |
| 7 | + */ | |
| 8 | +@Entity | |
| 9 | +@Table(name = "bsth_c_sys_company_auth") | |
| 10 | +public class CompanyAuthority { | |
| 11 | + | |
| 12 | + @Id | |
| 13 | + @GeneratedValue(strategy = GenerationType.IDENTITY) | |
| 14 | + private Integer id; | |
| 15 | + | |
| 16 | + /** 公司代码 */ | |
| 17 | + private String companyCode; | |
| 18 | + | |
| 19 | + /** 公司名称 */ | |
| 20 | + private String companyName; | |
| 21 | + | |
| 22 | + /** 分公司代码 */ | |
| 23 | + private String subCompanyCode; | |
| 24 | + | |
| 25 | + /** 分公司代码 */ | |
| 26 | + private String subCompanyName; | |
| 27 | + | |
| 28 | + private Integer roleId; | |
| 29 | + | |
| 30 | + public String getSubCompanyName() { | |
| 31 | + return subCompanyName; | |
| 32 | + } | |
| 33 | + | |
| 34 | + public void setSubCompanyName(String subCompanyName) { | |
| 35 | + this.subCompanyName = subCompanyName; | |
| 36 | + } | |
| 37 | + | |
| 38 | + public String getSubCompanyCode() { | |
| 39 | + return subCompanyCode; | |
| 40 | + } | |
| 41 | + | |
| 42 | + public void setSubCompanyCode(String subCompanyCode) { | |
| 43 | + this.subCompanyCode = subCompanyCode; | |
| 44 | + } | |
| 45 | + | |
| 46 | + public String getCompanyName() { | |
| 47 | + return companyName; | |
| 48 | + } | |
| 49 | + | |
| 50 | + public void setCompanyName(String companyName) { | |
| 51 | + this.companyName = companyName; | |
| 52 | + } | |
| 53 | + | |
| 54 | + public String getCompanyCode() { | |
| 55 | + return companyCode; | |
| 56 | + } | |
| 57 | + | |
| 58 | + public void setCompanyCode(String companyCode) { | |
| 59 | + this.companyCode = companyCode; | |
| 60 | + } | |
| 61 | + | |
| 62 | + public Integer getId() { | |
| 63 | + return id; | |
| 64 | + } | |
| 65 | + | |
| 66 | + public void setId(Integer id) { | |
| 67 | + this.id = id; | |
| 68 | + } | |
| 69 | + | |
| 70 | + public Integer getRoleId() { | |
| 71 | + return roleId; | |
| 72 | + } | |
| 73 | + | |
| 74 | + public void setRoleId(Integer roleId) { | |
| 75 | + this.roleId = roleId; | |
| 76 | + } | |
| 77 | +} | ... | ... |
src/main/java/com/bsth/filter/BaseFilter.java
| ... | ... | @@ -24,7 +24,7 @@ public abstract class BaseFilter implements Filter { |
| 24 | 24 | * 白名单 |
| 25 | 25 | */ |
| 26 | 26 | private String[] whiteListURLs = { Constants.LOGIN_PAGE,Constants.CAPTCHA, |
| 27 | - Constants.ASSETS_URL, Constants.FAVICON_URL, Constants.METRONIC_URL, Constants.LOGIN, Constants.LOGIN_FAILURE, Constants.UPSTREAM_URL, Constants.XD_CHILD_PAGES, Constants.XD_TEMPS }; | |
| 27 | + Constants.ASSETS_URL, Constants.FAVICON_URL, Constants.METRONIC_URL, Constants.LOGIN, Constants.LOGIN_FAILURE, Constants.UPSTREAM_URL, Constants.XD_CHILD_PAGES, Constants.XD_REAL_GPS }; | |
| 28 | 28 | |
| 29 | 29 | @Override |
| 30 | 30 | public void destroy() { | ... | ... |
src/main/java/com/bsth/oplog/http/HttpOpLogInterceptor.java
| ... | ... | @@ -3,8 +3,8 @@ package com.bsth.oplog.http; |
| 3 | 3 | import javax.servlet.http.HttpServletRequest; |
| 4 | 4 | import javax.servlet.http.HttpServletResponse; |
| 5 | 5 | |
| 6 | +import com.bsth.common.Constants; | |
| 6 | 7 | import org.springframework.beans.factory.annotation.Autowired; |
| 7 | -import org.springframework.stereotype.Component; | |
| 8 | 8 | import org.springframework.util.AntPathMatcher; |
| 9 | 9 | import org.springframework.util.PathMatcher; |
| 10 | 10 | import org.springframework.web.method.HandlerMethod; |
| ... | ... | @@ -25,7 +25,7 @@ public class HttpOpLogInterceptor implements HandlerInterceptor { |
| 25 | 25 | private final PathMatcher pathMatcher = new AntPathMatcher(); |
| 26 | 26 | |
| 27 | 27 | // GET 白名单 |
| 28 | - private String[] httpGetWhiteList = { "/user/login/**", "/user/currentUser","/dictionary/**", "/module/findByCurrentUser", "/gps/**", "/error/**" }; | |
| 28 | + private String[] httpGetWhiteList = { "/user/login/**", "/user/currentUser","/dictionary/**", "/module/findByCurrentUser", "/gps/**", "/error/**", Constants.XD_CHILD_PAGES}; | |
| 29 | 29 | |
| 30 | 30 | // POST 白名单 |
| 31 | 31 | private String[] httpPostWhiteList = { | ... | ... |
src/main/java/com/bsth/repository/CarParkRepository.java
| ... | ... | @@ -33,9 +33,9 @@ public interface CarParkRepository extends BaseRepository<CarPark, Integer>{ |
| 33 | 33 | |
| 34 | 34 | "?6 , str_to_date(?7,'%Y-%m-%d %H:%i:%s') , ?8 , ?9 , ?10," + |
| 35 | 35 | |
| 36 | - "str_to_date(?11,'%Y-%m-%d %H:%i:%s'), ?12 ,?13,GeomFromText(?14), ?15, " + | |
| 36 | + "str_to_date(?11,'%Y-%m-%d %H:%i:%s'), ?12 ,?13,ST_GeomFromText(?14), ?15, " + | |
| 37 | 37 | |
| 38 | - "?16, GeomFromText(?17), ?18,?19)", nativeQuery=true) | |
| 38 | + "?16, ST_GeomFromText(?17), ?18,?19)", nativeQuery=true) | |
| 39 | 39 | public void carParkSave(Double area,String company,String parkCode,String parkName, |
| 40 | 40 | |
| 41 | 41 | String brancheCompany,Integer createBy,String createDate,String descriptions,Integer destroy, |
| ... | ... | @@ -91,8 +91,8 @@ public interface CarParkRepository extends BaseRepository<CarPark, Integer>{ |
| 91 | 91 | "versions = ?12 , " + |
| 92 | 92 | "b_center_point = ?13 , " + |
| 93 | 93 | "g_center_point = ?14 , " + |
| 94 | - "b_park_point = GeomFromText(?15) , " + | |
| 95 | - "g_park_point = GeomFromText(?16) , " + | |
| 94 | + "b_park_point = ST_GeomFromText(?15) , " + | |
| 95 | + "g_park_point = ST_GeomFromText(?16) , " + | |
| 96 | 96 | "db_type = ?17 , " + |
| 97 | 97 | "radius = ?18 , " + |
| 98 | 98 | "shapes_type = ?19 " + | ... | ... |
src/main/java/com/bsth/repository/SectionRepository.java
| ... | ... | @@ -83,33 +83,32 @@ public interface SectionRepository extends BaseRepository<Section, Integer> { |
| 83 | 83 | @Transactional |
| 84 | 84 | @Modifying |
| 85 | 85 | @Query(value="UPDATE bsth_c_section SET " + |
| 86 | - "gsection_vector = ST_GeomFromText(?2) , " + | |
| 87 | - "bsection_vector = ST_GeomFromText(?3)," + | |
| 88 | - "section_code = ?4," + | |
| 89 | - "section_name = ?5," + | |
| 90 | - "croses_road = ?6," + | |
| 91 | - "end_node = ?7," + | |
| 92 | - "start_node = ?8," + | |
| 93 | - "middle_node = ?9," + | |
| 94 | - "section_type = ?10," + | |
| 95 | - "csection_vector = ?11," + | |
| 96 | - "road_coding = ?12," + | |
| 97 | - "section_distance = ?13," + | |
| 98 | - "section_time = ?14," + | |
| 99 | - "db_type = ?15," + | |
| 100 | - "speed_limit = ?16," + | |
| 101 | - "descriptions = ?17," + | |
| 102 | - "versions = ?18," + | |
| 103 | - "create_by = ?19," + | |
| 104 | - "create_date = str_to_date(?20,'%Y-%m-%d %H:%i:%s')," + | |
| 105 | - "update_by = ?21," + | |
| 106 | - "update_date = str_to_date(?22,'%Y-%m-%d %H:%i:%s')" + | |
| 86 | + " gsection_vector = ST_GeomFromText(?2) , " + | |
| 87 | + " bsection_vector = ST_GeomFromText(?3)," + | |
| 88 | + " section_code = ?4," + | |
| 89 | + " section_name = ?5," + | |
| 90 | + " croses_road = ?6," + | |
| 91 | + " end_node = ?7," + | |
| 92 | + " start_node = ?8," + | |
| 93 | + " middle_node = ?9," + | |
| 94 | + " section_type = ?10," + | |
| 95 | + " road_coding = ?11," + | |
| 96 | + " section_distance = ?12," + | |
| 97 | + " section_time = ?13," + | |
| 98 | + " db_type = ?14," + | |
| 99 | + " speed_limit = ?15," + | |
| 100 | + " descriptions = ?16," + | |
| 101 | + " versions = ?17," + | |
| 102 | + " create_by = ?18," + | |
| 103 | + " create_date = str_to_date(?19,'%Y-%m-%d %H:%i:%s')," + | |
| 104 | + " update_by = ?20," + | |
| 105 | + " update_date = str_to_date(?21,'%Y-%m-%d %H:%i:%s')" + | |
| 107 | 106 | " WHERE id = ?1", nativeQuery=true) |
| 108 | 107 | public void sectionUpdate(Integer sectionId,String gsectionVector,String bsectionVector,String sectionCode,String sectionName, |
| 109 | 108 | |
| 110 | 109 | String crosesRoad,String endNode,String startNode,String middleNode,String sectionType, |
| 111 | 110 | |
| 112 | - String csectionVector,String roadCoding,Double sectionDistance,Double sectionTime,String dbType, | |
| 111 | + String roadCoding,Double sectionDistance,Double sectionTime,String dbType, | |
| 113 | 112 | |
| 114 | 113 | Double speedLimit,String descriptions,Integer version,Integer createBy,String createDate, |
| 115 | 114 | ... | ... |
src/main/java/com/bsth/repository/SectionRouteRepository.java
| ... | ... | @@ -69,7 +69,7 @@ public interface SectionRouteRepository extends BaseRepository<SectionRoute, Int |
| 69 | 69 | "r.versions AS versions," + |
| 70 | 70 | "r.descriptions AS descriptions" + |
| 71 | 71 | " FROM bsth_c_sectionroute r where r.line = ?1 and r.directions = ?2 and r.destroy=0 ) a " + |
| 72 | - " LEFT JOIN bsth_c_section b ON a.sectionrouteSection = b.id", nativeQuery=true) | |
| 72 | + " LEFT JOIN bsth_c_section b ON a.sectionrouteSection = b.id order by a.sectionrouteCode asc", nativeQuery=true) | |
| 73 | 73 | List<Object[]> getSectionRoute(int lineId, int directions); |
| 74 | 74 | |
| 75 | 75 | ... | ... |
src/main/java/com/bsth/repository/StationRouteRepository.java
| ... | ... | @@ -110,9 +110,12 @@ public interface StationRouteRepository extends BaseRepository<StationRoute, Int |
| 110 | 110 | * |
| 111 | 111 | * @return List<Object[]> |
| 112 | 112 | */ |
| 113 | - @Query(value = "SELECT s.b_jwpoints,s.station_name FROM (" + | |
| 113 | + /*@Query(value = "SELECT s.b_jwpoints,s.station_name FROM (" + | |
| 114 | 114 | "SELECT b.station FROM bsth_c_stationroute b where b.line =?1 and b.directions = ?2 and b.destroy=0) r " + |
| 115 | - "LEFT JOIN bsth_c_station s on r.station = s.id", nativeQuery=true) | |
| 115 | + "LEFT JOIN bsth_c_station s on r.station = s.id", nativeQuery=true)*/ | |
| 116 | + @Query(value = "SELECT s.b_jwpoints,s.station_name,r.station_route_code FROM (" + | |
| 117 | + "SELECT b.station,b.station_route_code FROM bsth_c_stationroute b where b.line =?1 and b.directions = ?2 and b.destroy=0) r " + | |
| 118 | + "LEFT JOIN bsth_c_station s on r.station = s.id order by r.station_route_code asc", nativeQuery=true) | |
| 116 | 119 | List<Object[]> getSelectStationRouteCenterPoints(Integer lineId,Integer direction); |
| 117 | 120 | |
| 118 | 121 | /** | ... | ... |
src/main/java/com/bsth/repository/oil/YlbRepository.java
| ... | ... | @@ -23,7 +23,7 @@ public interface YlbRepository extends BaseRepository<Ylb, Integer>{ |
| 23 | 23 | @Modifying |
| 24 | 24 | @Query(value="SELECT a.* FROM bsth_c_ylb a where to_days(?1)-to_days(a.rq)=1" |
| 25 | 25 | + " and jcsx=(select max(b.jcsx) from bsth_c_ylb b where a.nbbm=b.nbbm and " |
| 26 | - + " to_days(?1)-to_days(b.rq)=1 ) group by nbbm",nativeQuery=true) | |
| 26 | + + " to_days(?1)-to_days(b.rq)=1 )",nativeQuery=true) | |
| 27 | 27 | List<Ylb> obtainYlbefore(String rq); |
| 28 | 28 | |
| 29 | 29 | /** | ... | ... |
src/main/java/com/bsth/repository/realcontrol/ScheduleRealInfoRepository.java
| ... | ... | @@ -100,10 +100,10 @@ public interface ScheduleRealInfoRepository extends BaseRepository<ScheduleRealI |
| 100 | 100 | void deleteByLineCodeAndDate(String xlBm, String schDate); |
| 101 | 101 | |
| 102 | 102 | //去掉了 xlBm is not null |
| 103 | - @Query(value="select s from ScheduleRealInfo s where s.xlBm = ?1 and DATE_FORMAT(s.scheduleDate,'%Y-%m-%d') = ?2") | |
| 103 | + @Query(value="select s from ScheduleRealInfo s where s.xlBm like %?1% and DATE_FORMAT(s.scheduleDate,'%Y-%m-%d') = ?2") | |
| 104 | 104 | List<ScheduleRealInfo> scheduleByDateAndLine(String line,String date); |
| 105 | 105 | |
| 106 | - @Query(value="select new map(s.scheduleDate as scheduleDate,s.xlBm as xlBm,s.clZbh as clZbh,s.jGh as jGh) from ScheduleRealInfo s where (s.xlBm = ?1 or s.xlBm is not null) and DATE_FORMAT(s.scheduleDate,'%Y-%m-%d') = ?2 GROUP BY xlBm,clZbh,jGh ORDER BY xlBm,clZbh,realExecDate,fcsjActual") | |
| 106 | + @Query(value="select new map(s.scheduleDate as scheduleDate,s.xlBm as xlBm,s.clZbh as clZbh,s.jGh as jGh) from ScheduleRealInfo s where s.xlBm like %?1% and DATE_FORMAT(s.scheduleDate,'%Y-%m-%d') = ?2 GROUP BY xlBm,clZbh,jGh,scheduleDate,jGh ORDER BY xlBm,clZbh") | |
| 107 | 107 | List<Map<String,Object>> yesterdayDataList(String line,String date); |
| 108 | 108 | |
| 109 | 109 | @Query(value="select s from ScheduleRealInfo s where DATE_FORMAT(s.scheduleDate,'%Y-%m-%d') = ?1 ORDER BY xlBm,lpName,clZbh,xlDir") | ... | ... |
src/main/java/com/bsth/repository/sys/CompanyAuthorityRepository.java
0 → 100644
| 1 | +package com.bsth.repository.sys; | |
| 2 | + | |
| 3 | +import com.bsth.entity.sys.CompanyAuthority; | |
| 4 | +import com.bsth.repository.BaseRepository; | |
| 5 | +import org.springframework.data.jpa.repository.Modifying; | |
| 6 | +import org.springframework.data.jpa.repository.Query; | |
| 7 | +import org.springframework.stereotype.Repository; | |
| 8 | + | |
| 9 | +import java.util.List; | |
| 10 | + | |
| 11 | +/** | |
| 12 | + * Created by panzhao on 2016/11/22. | |
| 13 | + */ | |
| 14 | +@Repository | |
| 15 | +public interface CompanyAuthorityRepository extends BaseRepository<CompanyAuthority, Integer>{ | |
| 16 | + | |
| 17 | + @Modifying | |
| 18 | + @Query(value="DELETE FROM CompanyAuthority WHERE roleId = ?1") | |
| 19 | + void deleteByRoleId(Integer roleId); | |
| 20 | + | |
| 21 | + @Query(value = "select ca from CompanyAuthority ca where ca.roleId in ?1") | |
| 22 | + List<CompanyAuthority> findByRoles(List<Integer> idx); | |
| 23 | +} | ... | ... |
src/main/java/com/bsth/repository/sys/ModuleRepository.java
| 1 | 1 | package com.bsth.repository.sys; |
| 2 | 2 | |
| 3 | -import java.util.List; | |
| 4 | -import java.util.Set; | |
| 5 | - | |
| 3 | +import com.bsth.entity.sys.Module; | |
| 4 | +import com.bsth.repository.BaseRepository; | |
| 6 | 5 | import org.springframework.data.jpa.domain.Specification; |
| 7 | -import org.springframework.data.jpa.repository.EntityGraph; | |
| 8 | 6 | import org.springframework.data.jpa.repository.Query; |
| 9 | 7 | import org.springframework.stereotype.Repository; |
| 10 | 8 | |
| 11 | -import com.bsth.entity.sys.Module; | |
| 12 | -import com.bsth.repository.BaseRepository; | |
| 9 | +import java.util.List; | |
| 10 | +import java.util.Set; | |
| 13 | 11 | |
| 14 | 12 | @Repository |
| 15 | -public interface ModuleRepository extends BaseRepository<Module, Integer>{ | |
| 16 | - | |
| 17 | - @Query("select m from Module m where m.groupType in ?1") | |
| 18 | - List<Module> findByGroupType(String[] groupType); | |
| 19 | - | |
| 20 | - List<Module> findByPId(Integer pId); | |
| 21 | - | |
| 22 | - @Query("select m from Module m where m.id in ?1") | |
| 23 | - Set<Module> findByIds(List<Integer> ids); | |
| 24 | - | |
| 25 | - @Override | |
| 26 | - List<Module> findAll(Specification<Module> spec); | |
| 13 | +public interface ModuleRepository extends BaseRepository<Module, Integer> { | |
| 14 | + | |
| 15 | + @Query("select m from Module m where m.groupType in ?1") | |
| 16 | + List<Module> findByGroupType(String[] groupType); | |
| 17 | + | |
| 18 | + List<Module> findByPId(Integer pId); | |
| 19 | + | |
| 20 | + @Query("select m from Module m where m.id in ?1") | |
| 21 | + Set<Module> findByIds(List<Integer> ids); | |
| 22 | + | |
| 23 | + @Override | |
| 24 | + List<Module> findAll(Specification<Module> spec); | |
| 25 | + | |
| 27 | 26 | } | ... | ... |
src/main/java/com/bsth/security/WebSecurityConfig.java
| ... | ... | @@ -36,7 +36,7 @@ public class WebSecurityConfig extends WebSecurityConfigurerAdapter { |
| 36 | 36 | public void configure(WebSecurity web) throws Exception { |
| 37 | 37 | // 白名单 |
| 38 | 38 | web.ignoring().antMatchers(Constants.LOGIN_PAGE, Constants.LOGIN, Constants.ASSETS_URL, Constants.FAVICON_URL, Constants.CAPTCHA, |
| 39 | - Constants.METRONIC_URL, Constants.LOGIN_FAILURE, Constants.UPSTREAM_URL, Constants.XD_CHILD_PAGES, Constants.XD_TEMPS); | |
| 39 | + Constants.METRONIC_URL, Constants.LOGIN_FAILURE, Constants.UPSTREAM_URL, Constants.XD_CHILD_PAGES); | |
| 40 | 40 | } |
| 41 | 41 | |
| 42 | 42 | @Override | ... | ... |
src/main/java/com/bsth/service/TrafficManageService.java
| 1 | 1 | package com.bsth.service; |
| 2 | 2 | |
| 3 | -import com.bsth.entity.Line; | |
| 4 | - | |
| 5 | 3 | /** |
| 6 | - * | |
| 4 | + * | |
| 7 | 5 | * @Interface: LineService(线路service业务层实现接口) |
| 8 | - * | |
| 6 | + * | |
| 9 | 7 | * @extends : BaseService |
| 10 | - * | |
| 8 | + * | |
| 11 | 9 | * @Description: TODO(线路service业务层实现接口) |
| 12 | - * | |
| 10 | + * | |
| 13 | 11 | * @Author bsth@lq |
| 14 | - * | |
| 12 | + * | |
| 15 | 13 | * @Date 2016年4月28日 上午9:21:17 |
| 16 | 14 | * |
| 17 | 15 | * @Version 公交调度系统BS版 0.1 |
| 18 | - * | |
| 16 | + * | |
| 19 | 17 | */ |
| 20 | 18 | public interface TrafficManageService { |
| 21 | - | |
| 19 | + | |
| 22 | 20 | /** |
| 23 | 21 | * 上传线路信息 |
| 24 | - * | |
| 22 | + * | |
| 25 | 23 | * @return 调用接口返回信息 |
| 26 | 24 | */ |
| 27 | 25 | String setXL(); |
| 28 | - | |
| 26 | + | |
| 29 | 27 | /** |
| 30 | 28 | * 上传车辆信息 |
| 31 | - * | |
| 29 | + * | |
| 32 | 30 | * @return 调用接口返回信息 |
| 33 | 31 | */ |
| 34 | 32 | String setCL(); |
| 35 | - | |
| 33 | + | |
| 36 | 34 | /** |
| 37 | 35 | * 上传司机信息 |
| 38 | 36 | * @return 调用接口返回信息 |
| 39 | 37 | */ |
| 40 | 38 | String setSJ(); |
| 41 | - | |
| 39 | + | |
| 42 | 40 | /** |
| 43 | 41 | * 上传超速数据 |
| 44 | - * | |
| 42 | + * | |
| 45 | 43 | * @return 调用接口返回信息 |
| 46 | 44 | */ |
| 47 | 45 | String setCS(); |
| 48 | - | |
| 46 | + | |
| 49 | 47 | /** |
| 50 | 48 | * 上传线路班次时刻表数据 |
| 51 | - * | |
| 49 | + * | |
| 52 | 50 | * @return 调用接口返回信息 |
| 53 | 51 | */ |
| 54 | 52 | String setSKB(String ids); |
| 55 | - | |
| 53 | + | |
| 56 | 54 | /** |
| 57 | 55 | * 线路人员车辆配置信息 |
| 58 | 56 | * @return 调用接口返回信息 |
| 59 | 57 | */ |
| 60 | 58 | String setXLPC(); |
| 61 | - | |
| 59 | + | |
| 62 | 60 | /** |
| 63 | 61 | * 线路计划班次表 |
| 64 | 62 | * @return 调用接口返回信息 |
| 65 | 63 | */ |
| 66 | 64 | String setJHBC(); |
| 67 | - | |
| 65 | + | |
| 68 | 66 | String setLD(); |
| 69 | - | |
| 67 | + | |
| 70 | 68 | String setLCYH(); |
| 71 | - | |
| 72 | - String setDDRB(); | |
| 69 | + | |
| 70 | + String setDDRB(); | |
| 71 | + | |
| 72 | + /** | |
| 73 | + * 下载全量的公交基础数据 | |
| 74 | + * @return | |
| 75 | + */ | |
| 76 | + String getDownLoadAllDataFile(); | |
| 77 | + | |
| 78 | + /** | |
| 79 | + * 下载增量的公交基础数据 | |
| 80 | + * @return | |
| 81 | + */ | |
| 82 | + String getDownLoadIncreaseDataFile(); | |
| 83 | + | |
| 84 | + /** | |
| 85 | + * 指定线路查询方式公交基础数据下载 | |
| 86 | + * @return | |
| 87 | + */ | |
| 88 | + String getDownLoadWarrantsBusLineStation(); | |
| 73 | 89 | } | ... | ... |
src/main/java/com/bsth/service/forms/ExportService.java
0 → 100644
| 1 | +package com.bsth.service.forms; | |
| 2 | + | |
| 3 | +import java.util.List; | |
| 4 | + | |
| 5 | +import com.bsth.entity.mcy_forms.Linepasswengerflow; | |
| 6 | +import com.bsth.entity.mcy_forms.Operationservice; | |
| 7 | +import com.bsth.entity.mcy_forms.Shifday; | |
| 8 | +import com.bsth.entity.mcy_forms.Shiftuehiclemanth; | |
| 9 | +import com.bsth.entity.mcy_forms.Singledata; | |
| 10 | +import com.bsth.entity.mcy_forms.Vehicleloading; | |
| 11 | +import com.bsth.entity.mcy_forms.Waybillday; | |
| 12 | + | |
| 13 | +public interface ExportService { | |
| 14 | + | |
| 15 | + public void waybillday(String date, List<Waybillday> resList); | |
| 16 | + | |
| 17 | + public void linepasswengerflow(String date,List<Linepasswengerflow> resList); | |
| 18 | + | |
| 19 | + public void shifday(String date, List<Shifday> resList); | |
| 20 | + | |
| 21 | + public void shiftuehiclemanth(String startDate, String endDate, String lpName, | |
| 22 | + List<Shiftuehiclemanth> resList); | |
| 23 | + | |
| 24 | + public void singledata(String startDate, String endDate, String lpName, List<Singledata> resList); | |
| 25 | + | |
| 26 | + public void vehicleloading(String date, List<Vehicleloading> resList); | |
| 27 | + | |
| 28 | + public void operationservice(String startDate, String endDate, String lpName, | |
| 29 | + List<Operationservice> resList); | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | +} | ... | ... |
src/main/java/com/bsth/service/forms/impl/ExportServiceImpl.java
0 → 100644
| 1 | +package com.bsth.service.forms.impl; | |
| 2 | + | |
| 3 | +import java.text.SimpleDateFormat; | |
| 4 | +import java.util.ArrayList; | |
| 5 | +import java.util.HashMap; | |
| 6 | +import java.util.Iterator; | |
| 7 | +import java.util.List; | |
| 8 | +import java.util.Map; | |
| 9 | +import org.springframework.stereotype.Service; | |
| 10 | + | |
| 11 | +import com.bsth.entity.mcy_forms.Linepasswengerflow; | |
| 12 | +import com.bsth.entity.mcy_forms.Operationservice; | |
| 13 | +import com.bsth.entity.mcy_forms.Shifday; | |
| 14 | +import com.bsth.entity.mcy_forms.Shiftuehiclemanth; | |
| 15 | +import com.bsth.entity.mcy_forms.Singledata; | |
| 16 | +import com.bsth.entity.mcy_forms.Vehicleloading; | |
| 17 | +import com.bsth.entity.mcy_forms.Waybillday; | |
| 18 | +import com.bsth.service.forms.ExportService; | |
| 19 | +import com.bsth.util.ReportUtils; | |
| 20 | + | |
| 21 | +@Service | |
| 22 | +public class ExportServiceImpl implements ExportService{ | |
| 23 | + | |
| 24 | + | |
| 25 | + //行车路单日报表 | |
| 26 | + @Override | |
| 27 | + public void waybillday(String date, List<Waybillday> list) { | |
| 28 | + | |
| 29 | + SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"), | |
| 30 | + sdfSimple = new SimpleDateFormat("yyyyMMdd"); | |
| 31 | + List<Map<String, Object>> resList = new ArrayList<Map<String, Object>>(); | |
| 32 | + List<Iterator<?>> listI = new ArrayList<Iterator<?>>(); | |
| 33 | + Map<String,Object> map = new HashMap<String, Object>(); | |
| 34 | + ReportUtils ee = new ReportUtils(); | |
| 35 | + | |
| 36 | + for(Waybillday w : list){ | |
| 37 | + Map<String, Object> m = new HashMap<String, Object>(); | |
| 38 | + m.put("carPlate", w.getCarPlate()); | |
| 39 | + m.put("jzl1", w.getJzl1()); | |
| 40 | + m.put("jzl", w.getJzl()); | |
| 41 | + m.put("yh", w.getYh()); | |
| 42 | + m.put("jName", w.getjName()); | |
| 43 | + m.put("zlc", w.getZlc()); | |
| 44 | + resList.add(m); | |
| 45 | + } | |
| 46 | + | |
| 47 | + try { | |
| 48 | + listI.add(resList.iterator()); | |
| 49 | + String path = this.getClass().getResource("/").getPath()+"static\\pages\\forms\\"; | |
| 50 | + ee.excelReplace(listI, new Object[] { map }, path+"mould\\waybillday.xls", | |
| 51 | + path+"export\\行车路单日报表" + sdfSimple.format(sdfMonth.parse(date)) + ".xls"); | |
| 52 | + } catch (Exception e) { | |
| 53 | + e.printStackTrace(); | |
| 54 | + } | |
| 55 | + } | |
| 56 | + | |
| 57 | + //线路客流量报表 | |
| 58 | + @Override | |
| 59 | + public void linepasswengerflow(String date, List<Linepasswengerflow> list) { | |
| 60 | + | |
| 61 | + SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"), | |
| 62 | + sdfSimple = new SimpleDateFormat("yyyyMMdd"); | |
| 63 | + List<Map<String, Object>> resList = new ArrayList<Map<String, Object>>(); | |
| 64 | + List<Iterator<?>> listI = new ArrayList<Iterator<?>>(); | |
| 65 | + Map<String,Object> map = new HashMap<String, Object>(); | |
| 66 | + ReportUtils ee = new ReportUtils(); | |
| 67 | + for(Linepasswengerflow l : list){ | |
| 68 | + Map<String, Object> m = new HashMap<String, Object>(); | |
| 69 | + m.put("stationName", l.getStationName()); | |
| 70 | + resList.add(m); | |
| 71 | + } | |
| 72 | + | |
| 73 | + try { | |
| 74 | + listI.add(resList.iterator()); | |
| 75 | + String path = this.getClass().getResource("/").getPath()+"static\\pages\\forms\\"; | |
| 76 | + ee.excelReplace(listI, new Object[] { map }, path+"mould\\linepasswengerflow.xls", | |
| 77 | + path+"export\\线路客流量报表" + sdfSimple.format(sdfMonth.parse(date)) + ".xls"); | |
| 78 | + } catch (Exception e) { | |
| 79 | + e.printStackTrace(); | |
| 80 | + } | |
| 81 | + | |
| 82 | + } | |
| 83 | + | |
| 84 | + | |
| 85 | + //班次车辆人员日统计 | |
| 86 | + @Override | |
| 87 | + public void shifday(String date,List<Shifday> list) { | |
| 88 | + SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"), | |
| 89 | + sdfSimple = new SimpleDateFormat("yyyyMMdd"); | |
| 90 | + List<Map<String, Object>> resList = new ArrayList<Map<String, Object>>(); | |
| 91 | + List<Iterator<?>> listI = new ArrayList<Iterator<?>>(); | |
| 92 | + Map<String,Object> map = new HashMap<String, Object>(); | |
| 93 | + ReportUtils ee = new ReportUtils(); | |
| 94 | + | |
| 95 | + for(Shifday l : list){ | |
| 96 | + Map<String, Object> m = new HashMap<String, Object>(); | |
| 97 | + m.put("jName",l.getjName()); | |
| 98 | + m.put("sName", l.getsName()); | |
| 99 | + m.put("lpName", l.getLpName()); | |
| 100 | + m.put("carPlate", l.getCarPlate()); | |
| 101 | + m.put("jhlc", l.getJhlc()); | |
| 102 | + m.put("sjjhlc", l.getSjjhlc()); | |
| 103 | + m.put("yygl", l.getYygl()); | |
| 104 | + m.put("emptMileage", l.getEmptMileage()); | |
| 105 | + m.put("remMileage", l.getRemMileage()); | |
| 106 | + m.put("addMileage", l.getAddMileage()); | |
| 107 | + m.put("totalm", l.getTotalm()); | |
| 108 | + m.put("jhbc", l.getJhbc()); | |
| 109 | + m.put("sjjhbc", l.getSjjhbc()); | |
| 110 | + m.put("cjbc", l.getCjbc()); | |
| 111 | + m.put("ljbc", l.getLjbc()); | |
| 112 | + m.put("sjbc", l.getSjbc()); | |
| 113 | + resList.add(m); | |
| 114 | + } | |
| 115 | + | |
| 116 | + try { | |
| 117 | + listI.add(resList.iterator()); | |
| 118 | + String path = this.getClass().getResource("/").getPath()+"static\\pages\\forms\\"; | |
| 119 | + ee.excelReplace(listI, new Object[] { map }, path+"mould\\shifday.xls", | |
| 120 | + path+"export\\班次车辆人员日报表" + sdfSimple.format(sdfMonth.parse(date)) + ".xls"); | |
| 121 | + } catch (Exception e) { | |
| 122 | + e.printStackTrace(); | |
| 123 | + } | |
| 124 | + | |
| 125 | + } | |
| 126 | + | |
| 127 | + //班次车辆人员月统计 | |
| 128 | + @Override | |
| 129 | + public void shiftuehiclemanth(String startDate,String endDate,String lpName, List<Shiftuehiclemanth> list) { | |
| 130 | + | |
| 131 | + SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"), | |
| 132 | + sdfSimple = new SimpleDateFormat("yyyyMMdd"); | |
| 133 | + List<Map<String, Object>> resList = new ArrayList<Map<String, Object>>(); | |
| 134 | + List<Iterator<?>> listI = new ArrayList<Iterator<?>>(); | |
| 135 | + Map<String,Object> map = new HashMap<String, Object>(); | |
| 136 | + ReportUtils ee = new ReportUtils(); | |
| 137 | + | |
| 138 | + for(Shiftuehiclemanth l : list){ | |
| 139 | + Map<String, Object> m = new HashMap<String, Object>(); | |
| 140 | + m.put("jName",l.getjName() ); | |
| 141 | + m.put("jhlc", l.getJhlc()); | |
| 142 | + m.put("emptMileage",l.getEmptMileage() ); | |
| 143 | + m.put("remMileage", l.getRemMileage()); | |
| 144 | + m.put("addMileage", l.getAddMileage()); | |
| 145 | + m.put("totalm", l.getTotalm()); | |
| 146 | + m.put("cjbc", l.getCjbc()); | |
| 147 | + m.put("ljbc", l.getLjbc()); | |
| 148 | + m.put("sjbc", l.getSjbc()); | |
| 149 | + resList.add(m); | |
| 150 | + } | |
| 151 | + | |
| 152 | + try { | |
| 153 | + listI.add(resList.iterator()); | |
| 154 | + String path = this.getClass().getResource("/").getPath()+"static\\pages\\forms\\"; | |
| 155 | + ee.excelReplace(listI, new Object[] { map }, path+"mould\\shiftuehiclemanth.xls", | |
| 156 | + path+"export\\班次车辆人员月报表" + sdfSimple.format(sdfMonth.parse(startDate)) + ".xls"); | |
| 157 | + } catch (Exception e) { | |
| 158 | + e.printStackTrace(); | |
| 159 | + } | |
| 160 | + | |
| 161 | + } | |
| 162 | + | |
| 163 | + //路单报表 | |
| 164 | + @Override | |
| 165 | + public void singledata(String startDate,String endDate,String lpName, List<Singledata> list) { | |
| 166 | + SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"), | |
| 167 | + sdfSimple = new SimpleDateFormat("yyyyMMdd"); | |
| 168 | + List<Map<String, Object>> resList = new ArrayList<Map<String, Object>>(); | |
| 169 | + List<Iterator<?>> listI = new ArrayList<Iterator<?>>(); | |
| 170 | + Map<String,Object> map = new HashMap<String, Object>(); | |
| 171 | + ReportUtils ee = new ReportUtils(); | |
| 172 | + | |
| 173 | + for(Singledata l : list){ | |
| 174 | + Map<String, Object> m = new HashMap<String, Object>(); | |
| 175 | + m.put("rQ",l.getrQ()); | |
| 176 | + m.put("gS", l.getgS()); | |
| 177 | + m.put("xL",l.getxL() ); | |
| 178 | + m.put("clzbh", l.getClzbh()); | |
| 179 | + m.put("jsy", l.getJsy()); | |
| 180 | + m.put("jName", l.getjName()); | |
| 181 | + m.put("sgh", l.getSgh()); | |
| 182 | + m.put("sName", l.getsName()); | |
| 183 | + m.put("jhlc", l.getJhlc()); | |
| 184 | + m.put("emptMileage", l.getEmptMileage()); | |
| 185 | + m.put("hyl", l.getHyl()); | |
| 186 | + m.put("jzl", l.getJzl()); | |
| 187 | + m.put("unyyyl",l.getUnyyyl()); | |
| 188 | + m.put("jhjl", l.getJhjl()); | |
| 189 | + resList.add(m); | |
| 190 | + } | |
| 191 | + | |
| 192 | + try { | |
| 193 | + listI.add(resList.iterator()); | |
| 194 | + String path = this.getClass().getResource("/").getPath()+"static\\pages\\forms\\"; | |
| 195 | + ee.excelReplace(listI, new Object[] { map }, path+"mould\\singledata.xls", | |
| 196 | + path+"export\\路单日报表" + sdfSimple.format(sdfMonth.parse(startDate)) + ".xls"); | |
| 197 | + } catch (Exception e) { | |
| 198 | + e.printStackTrace(); | |
| 199 | + } | |
| 200 | + | |
| 201 | + | |
| 202 | + } | |
| 203 | + | |
| 204 | + | |
| 205 | + //车辆加注 | |
| 206 | + @Override | |
| 207 | + public void vehicleloading(String date, List<Vehicleloading> list) { | |
| 208 | + SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"), | |
| 209 | + sdfSimple = new SimpleDateFormat("yyyyMMdd"); | |
| 210 | + List<Map<String, Object>> resList = new ArrayList<Map<String, Object>>(); | |
| 211 | + List<Iterator<?>> listI = new ArrayList<Iterator<?>>(); | |
| 212 | + Map<String,Object> map = new HashMap<String, Object>(); | |
| 213 | + ReportUtils ee = new ReportUtils(); | |
| 214 | + | |
| 215 | + for(Vehicleloading l : list){ | |
| 216 | + Map<String, Object> m = new HashMap<String, Object>(); | |
| 217 | + m.put("rQ", l.getrQ()); | |
| 218 | + m.put("gS", l.getgS()); | |
| 219 | + m.put("xL", l.getxL()); | |
| 220 | + m.put("clzbh", l.getClzbh()); | |
| 221 | + m.put("hyl", l.getHyl()); | |
| 222 | + m.put("jzl", l.getJzl()); | |
| 223 | + m.put("ls", l.getLs()); | |
| 224 | + m.put("jhlc", l.getJhlc()); | |
| 225 | + m.put("unyyyl", l.getUnyyyl()); | |
| 226 | + m.put("jhbc", l.getJhbc()); | |
| 227 | + m.put("sjbc", l.getSjbc()); | |
| 228 | + resList.add(m); | |
| 229 | + } | |
| 230 | + | |
| 231 | + try { | |
| 232 | + listI.add(resList.iterator()); | |
| 233 | + String path = this.getClass().getResource("/").getPath()+"static\\pages\\forms\\"; | |
| 234 | + ee.excelReplace(listI, new Object[] { map }, path+"mould\\vehicleloading.xls", | |
| 235 | + path+"export\\车辆加注" + sdfSimple.format(sdfMonth.parse(date)) + ".xls"); | |
| 236 | + } catch (Exception e) { | |
| 237 | + e.printStackTrace(); | |
| 238 | + } | |
| 239 | + } | |
| 240 | + | |
| 241 | + //运营服务阶段报表 | |
| 242 | + @Override | |
| 243 | + public void operationservice(String startDate,String endDate,String lpName,List<Operationservice> list) { | |
| 244 | + SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"), | |
| 245 | + sdfSimple = new SimpleDateFormat("yyyyMMdd"); | |
| 246 | + | |
| 247 | + List<Iterator<?>> listI = new ArrayList<Iterator<?>>(); | |
| 248 | + Map<String,Object> map = new HashMap<String, Object>(); | |
| 249 | + ReportUtils ee = new ReportUtils(); | |
| 250 | + List<Map<String, Object>> resList = new ArrayList<Map<String, Object>>(); | |
| 251 | + for(Operationservice l : list){ | |
| 252 | + Map<String, Object> m = new HashMap<String, Object>(); | |
| 253 | + m.put("xlName", l.getXlName()); | |
| 254 | + m.put("jzl", l.getJzl()); | |
| 255 | + m.put("xhl", l.getXhl()); | |
| 256 | + m.put("xsgl", l.getXsgl()); | |
| 257 | + m.put("emptMileage", l.getEmptMileage()); | |
| 258 | + m.put("sjbc", l.getSjbc()); | |
| 259 | + resList.add(m); | |
| 260 | + } | |
| 261 | + | |
| 262 | + try { | |
| 263 | + listI.add(resList.iterator()); | |
| 264 | + String path = this.getClass().getResource("/").getPath()+"static\\pages\\forms\\"; | |
| 265 | + ee.excelReplace(listI, new Object[] { map }, path+"mould\\operationservice.xls", | |
| 266 | + path+"export\\运营服务阶段报表" + sdfSimple.format(sdfMonth.parse(startDate)) + ".xls"); | |
| 267 | + } catch (Exception e) { | |
| 268 | + e.printStackTrace(); | |
| 269 | + } | |
| 270 | + } | |
| 271 | + | |
| 272 | + | |
| 273 | +} | ... | ... |
src/main/java/com/bsth/service/forms/impl/FormsServiceImpl.java
| ... | ... | @@ -3,8 +3,10 @@ package com.bsth.service.forms.impl; |
| 3 | 3 | import java.sql.ResultSet; |
| 4 | 4 | import java.sql.SQLException; |
| 5 | 5 | import java.text.DecimalFormat; |
| 6 | +import java.text.ParseException; | |
| 6 | 7 | import java.text.SimpleDateFormat; |
| 7 | 8 | import java.util.ArrayList; |
| 9 | +import java.util.Date; | |
| 8 | 10 | import java.util.HashMap; |
| 9 | 11 | import java.util.Iterator; |
| 10 | 12 | import java.util.List; |
| ... | ... | @@ -226,11 +228,66 @@ public class FormsServiceImpl implements FormsService{ |
| 226 | 228 | } |
| 227 | 229 | |
| 228 | 230 | //换人换车情况日统计 |
| 229 | - @Override | |
| 230 | - public List<Changetochange> changetochange(Map<String, Object> map) { | |
| 231 | - | |
| 232 | - return null; | |
| 233 | - } | |
| 231 | + String rq; | |
| 232 | + @Override | |
| 233 | + public List<Changetochange> changetochange(Map<String, Object> map) { | |
| 234 | + | |
| 235 | + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd") ; | |
| 236 | + SimpleDateFormat sdf1 = new SimpleDateFormat("yyyy年MM月dd日") ; | |
| 237 | + Date d = null ; | |
| 238 | + Date d1 = null ; | |
| 239 | + try { | |
| 240 | + d = sdf.parse(map.get("startDate").toString()); | |
| 241 | + d1 = sdf.parse(map.get("endDate").toString()); | |
| 242 | + } catch (ParseException e) { | |
| 243 | + | |
| 244 | + e.printStackTrace(); | |
| 245 | + } | |
| 246 | + String rq2=sdf1.format(d); | |
| 247 | + String rq3=sdf1.format(d1); | |
| 248 | + | |
| 249 | + rq=rq2+"-"+ rq3; | |
| 250 | + | |
| 251 | + String sql=" select c.*,l.line_code from bsth_c_chtoch c LEFT JOIN bsth_c_line l on c.xl=l.name WHERE 1=1 "; | |
| 252 | + if(!map.get("startDate").toString().equals(" ")&&!map.get("endDate").toString().equals(" ")){ | |
| 253 | + sql+= "and DATE_FORMAT( c.rq,'%Y-%m-%d') BETWEEN '"+map.get("startDate").toString()+"' and '"+map.get("endDate").toString()+"'"; | |
| 254 | + } | |
| 255 | + if(!map.get("line").equals("")){ | |
| 256 | + sql+="and line_code='"+map.get("line")+"'"; | |
| 257 | + } | |
| 258 | + if(map.get("sel").equals("2")){ | |
| 259 | + sql+=" and c.pcch!=c.pcry"; | |
| 260 | + }else if(map.get("sel").equals("1")){ | |
| 261 | + sql+=" and c.jhgh!=c.sjgh"; | |
| 262 | + } | |
| 263 | + | |
| 264 | + | |
| 265 | + List<Changetochange> list = jdbcTemplate.query(sql, new RowMapper<Changetochange>() { | |
| 266 | + | |
| 267 | + @Override | |
| 268 | + public Changetochange mapRow(ResultSet arg0, int arg1) throws SQLException { | |
| 269 | + Changetochange chan= new Changetochange(); | |
| 270 | + | |
| 271 | + chan.setRq(rq); | |
| 272 | + chan.setGs(arg0.getString("gs").toString()); | |
| 273 | + chan.setFgs(arg0.getString("fgs").toString()); | |
| 274 | + chan.setXl(arg0.getString("xl").toString()); | |
| 275 | + chan.setLp(arg0.getString("lp").toString()); | |
| 276 | + chan.setFssj(arg0.getString("fssj").toString()); | |
| 277 | + chan.setXgsj(arg0.getString("xgsj").toString()); | |
| 278 | + chan.setPcch(arg0.getString("pcch").toString()); | |
| 279 | + chan.setPcry(arg0.getString("pcry").toString()); | |
| 280 | + chan.setJhch(arg0.getString("jhch").toString()); | |
| 281 | + chan.setJhgh(arg0.getString("jhgh").toString()); | |
| 282 | + chan.setSjch(arg0.getString("sjch").toString()); | |
| 283 | + chan.setSjgh(arg0.getString("sjgh").toString()); | |
| 284 | + chan.setYy(arg0.getString("yy").toString()); | |
| 285 | + chan.setXgr(arg0.getString("xgr").toString()); | |
| 286 | + return chan; | |
| 287 | + } | |
| 288 | + }); | |
| 289 | + return list; | |
| 290 | + } | |
| 234 | 291 | |
| 235 | 292 | |
| 236 | 293 | //路单数据 |
| ... | ... | @@ -339,4 +396,5 @@ public class FormsServiceImpl implements FormsService{ |
| 339 | 396 | } |
| 340 | 397 | |
| 341 | 398 | |
| 399 | + | |
| 342 | 400 | } | ... | ... |
src/main/java/com/bsth/service/impl/CarParkServiceImpl.java
| ... | ... | @@ -75,9 +75,19 @@ public class CarParkServiceImpl extends BaseServiceImpl<CarPark, Integer> implem |
| 75 | 75 | |
| 76 | 76 | } |
| 77 | 77 | |
| 78 | - bParkPoint = "POLYGON((" + bParkPoint +"))"; | |
| 78 | + if(bParkPoint.equals("")) | |
| 79 | + bParkPoint = null; | |
| 80 | + else | |
| 81 | + bParkPoint = "POLYGON((" + bParkPoint +"))"; | |
| 82 | + | |
| 83 | + if(gParkPoint.equals("")) | |
| 84 | + gParkPoint = null; | |
| 85 | + else | |
| 86 | + gParkPoint = "POLYGON((" + gParkPoint +"))"; | |
| 79 | 87 | |
| 80 | - gParkPoint = "POLYGON((" + gParkPoint +"))"; | |
| 88 | + /*bParkPoint = "POLYGON((" + bParkPoint +"))"; | |
| 89 | + | |
| 90 | + gParkPoint = "POLYGON((" + gParkPoint +"))";*/ | |
| 81 | 91 | |
| 82 | 92 | // 地理位置中心点(百度坐标) |
| 83 | 93 | String bCenterPoint = map.get("bCenterPoint").equals("") ? "" : map.get("bCenterPoint").toString(); |
| ... | ... | @@ -93,7 +103,7 @@ public class CarParkServiceImpl extends BaseServiceImpl<CarPark, Integer> implem |
| 93 | 103 | |
| 94 | 104 | } |
| 95 | 105 | |
| 96 | - String gCenterPoint = ""; | |
| 106 | + String gCenterPoint = null; | |
| 97 | 107 | |
| 98 | 108 | if(bJwpointsArray.length>0) { |
| 99 | 109 | |
| ... | ... | @@ -147,6 +157,9 @@ public class CarParkServiceImpl extends BaseServiceImpl<CarPark, Integer> implem |
| 147 | 157 | // 修改人 |
| 148 | 158 | Integer updateBy = map.get("updateBy").equals("") ? null : Integer.parseInt(map.get("updateBy").toString()); |
| 149 | 159 | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 150 | 163 | carParkRepository.carParkSave(area, company, parkCode, parkName, |
| 151 | 164 | |
| 152 | 165 | brancheCompany, createBy, createDate, descriptions, destroy, |
| ... | ... | @@ -296,7 +309,7 @@ public class CarParkServiceImpl extends BaseServiceImpl<CarPark, Integer> implem |
| 296 | 309 | |
| 297 | 310 | } |
| 298 | 311 | |
| 299 | - String gCenterPoint = ""; | |
| 312 | + String gCenterPoint =null; | |
| 300 | 313 | |
| 301 | 314 | if(bJwpointsArray.length>0) { |
| 302 | 315 | |
| ... | ... | @@ -337,10 +350,18 @@ public class CarParkServiceImpl extends BaseServiceImpl<CarPark, Integer> implem |
| 337 | 350 | } |
| 338 | 351 | |
| 339 | 352 | } |
| 353 | + if(bParkPoint.equals("")) | |
| 354 | + bParkPoint = null; | |
| 355 | + else | |
| 356 | + bParkPoint = "POLYGON((" + bParkPoint +"))"; | |
| 357 | + | |
| 358 | + if(gParkPoint.equals("")) | |
| 359 | + gParkPoint = null; | |
| 360 | + else | |
| 361 | + gParkPoint = "POLYGON((" + gParkPoint +"))"; | |
| 362 | + /*bParkPoint = "POLYGON((" + bParkPoint +"))"; | |
| 340 | 363 | |
| 341 | - bParkPoint = "POLYGON((" + bParkPoint +"))"; | |
| 342 | - | |
| 343 | - gParkPoint = "POLYGON((" + gParkPoint +"))"; | |
| 364 | + gParkPoint = "POLYGON((" + gParkPoint +"))";*/ | |
| 344 | 365 | |
| 345 | 366 | // 编码 |
| 346 | 367 | String parkCode = map.get("parkCode").equals("") ? "" : map.get("parkCode").toString(); | ... | ... |
src/main/java/com/bsth/service/impl/SectionServiceImpl.java
| ... | ... | @@ -213,10 +213,11 @@ public class SectionServiceImpl extends BaseServiceImpl<Section, Integer> implem |
| 213 | 213 | |
| 214 | 214 | String sectionType=""; |
| 215 | 215 | |
| 216 | - String csectionVector=""; | |
| 216 | + // String csectionVector=""; | |
| 217 | 217 | |
| 218 | 218 | // 更新 |
| 219 | - repository.sectionUpdate(sectionId, gsectionVector, bsectionVectorS, sectionCode, sectionName, crosesRoad, endNode, startNode, middleNode, sectionType, csectionVector, roadCoding, sectionDistance, sectionTime, dbType, speedLimit, descriptions, version, createBy, createDate, updateBy, updateDate); | |
| 219 | + /*repository.sectionUpdate(sectionId, gsectionVector, bsectionVectorS, sectionCode, sectionName, crosesRoad, endNode, startNode, middleNode, sectionType, csectionVector, roadCoding, sectionDistance, sectionTime, dbType, speedLimit, descriptions, version, createBy, createDate, updateBy, updateDate);*/ | |
| 220 | + repository.sectionUpdate(sectionId, gsectionVector, bsectionVectorS, sectionCode, sectionName, crosesRoad, endNode, startNode, middleNode, sectionType, roadCoding, sectionDistance, sectionTime, dbType, speedLimit, descriptions, version, createBy, createDate, updateBy, updateDate); | |
| 220 | 221 | |
| 221 | 222 | SectionRoute route = new SectionRoute(); |
| 222 | 223 | |
| ... | ... | @@ -393,7 +394,7 @@ public class SectionServiceImpl extends BaseServiceImpl<Section, Integer> implem |
| 393 | 394 | |
| 394 | 395 | String sectionType=""; |
| 395 | 396 | |
| 396 | - String csectionVector=""; | |
| 397 | + String csectionVector=null; | |
| 397 | 398 | |
| 398 | 399 | Integer id = Integer.valueOf(sectionCode); |
| 399 | 400 | ... | ... |
src/main/java/com/bsth/service/impl/StationServiceImpl.java
| ... | ... | @@ -977,9 +977,9 @@ public class StationServiceImpl extends BaseServiceImpl<Station, Integer> implem |
| 977 | 977 | |
| 978 | 978 | } |
| 979 | 979 | |
| 980 | - bPloygonGrid = "POLYGON((" + bPloygonGrid +"))"; | |
| 980 | + /* bPloygonGrid = "POLYGON((" + bPloygonGrid +"))"; | |
| 981 | 981 | |
| 982 | - gPloygonGrid = "POLYGON((" + gPloygonGrid +"))"; | |
| 982 | + gPloygonGrid = "POLYGON((" + gPloygonGrid +"))";*/ | |
| 983 | 983 | |
| 984 | 984 | // 是否撤销 |
| 985 | 985 | Integer destroy = map.get("destroy").equals("") ? null : Integer.parseInt(map.get("destroy").toString()); | ... | ... |
src/main/java/com/bsth/service/impl/TrafficManageServiceImpl.java
| ... | ... | @@ -22,6 +22,7 @@ import org.slf4j.LoggerFactory; |
| 22 | 22 | import org.springframework.beans.factory.annotation.Autowired; |
| 23 | 23 | import org.springframework.data.domain.Sort; |
| 24 | 24 | import org.springframework.data.domain.Sort.Direction; |
| 25 | +import org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate; | |
| 25 | 26 | import org.springframework.stereotype.Service; |
| 26 | 27 | |
| 27 | 28 | import com.bsth.data.BasicData; |
| ... | ... | @@ -119,6 +120,10 @@ public class TrafficManageServiceImpl implements TrafficManageService{ |
| 119 | 120 | @Autowired |
| 120 | 121 | private ScheduleRealInfoRepository scheduleRealInfoRepository; |
| 121 | 122 | |
| 123 | + @Autowired | |
| 124 | + NamedParameterJdbcTemplate jdbcTemplate; | |
| 125 | + | |
| 126 | + | |
| 122 | 127 | // 运管处接口 |
| 123 | 128 | private InternalPortType portType = new Internal().getInternalHttpSoap11Endpoint(); |
| 124 | 129 | private WebServiceSoap ssop ; |
| ... | ... | @@ -163,9 +168,6 @@ public class TrafficManageServiceImpl implements TrafficManageService{ |
| 163 | 168 | sBuffer.append("<XLs>"); |
| 164 | 169 | while(lineIterator.hasNext()){ |
| 165 | 170 | line = lineIterator.next(); |
| 166 | - if(line.getLinePlayType() == null){ | |
| 167 | - continue; | |
| 168 | - } | |
| 169 | 171 | if(BasicData.lineId2ShangHaiCodeMap.get(line.getId()) == null){ |
| 170 | 172 | continue; |
| 171 | 173 | } |
| ... | ... | @@ -189,7 +191,8 @@ public class TrafficManageServiceImpl implements TrafficManageService{ |
| 189 | 191 | sBuffer.append("<QZLC>").append(upMileage).append("</QZLC>"); |
| 190 | 192 | sBuffer.append("<ZQLC>").append(downMileage).append("</ZQLC>"); |
| 191 | 193 | } |
| 192 | - sBuffer.append("<XLGH>").append(line.getLinePlayType()).append("</XLGH>"); | |
| 194 | + sBuffer.append("<XLGH>").append(line.getLinePlayType() == null ?"0":line.getLinePlayType()) | |
| 195 | + .append("</XLGH>"); | |
| 193 | 196 | // 循环添加站点信息 |
| 194 | 197 | sBuffer.append("<StationList>"); |
| 195 | 198 | // 先查上行 |
| ... | ... | @@ -334,21 +337,28 @@ public class TrafficManageServiceImpl implements TrafficManageService{ |
| 334 | 337 | |
| 335 | 338 | int seqNumber = 0; |
| 336 | 339 | for(ScheduleRealInfo scheduleRealInfo:list){ |
| 337 | - if(schRealInfo.getXlBm().equals(scheduleRealInfo.getXlBm()) && schRealInfo.getLpName().equals(scheduleRealInfo.getLpName()) | |
| 340 | + if(schRealInfo.getXlBm().equals(scheduleRealInfo.getXlBm()) && schRealInfo.getLpName() | |
| 341 | + .equals(scheduleRealInfo.getLpName()) | |
| 338 | 342 | && schRealInfo.getClZbh().equals(scheduleRealInfo.getClZbh())){ |
| 343 | + if(scheduleRealInfo.getFcsjActual() == null ||scheduleRealInfo.getBcType().equals("in") | |
| 344 | + || scheduleRealInfo.getBcType().equals("out")){ | |
| 345 | + continue; | |
| 346 | + } | |
| 339 | 347 | scheduleRealInfo.getQdzCode(); |
| 340 | 348 | sf.append("<LD>"); |
| 341 | 349 | sf.append("<SJGH>"+scheduleRealInfo.getjGh()+"</SJGH>"); |
| 342 | 350 | sf.append("<SXX>"+scheduleRealInfo.getXlDir()+"</SXX>"); |
| 343 | 351 | sf.append("<FCZDMC>"+scheduleRealInfo.getQdzName()+"</FCZDMC>"); |
| 344 | - sf.append("<FCZDXH>" + ++seqNumber + "</FCZDXH>"); | |
| 352 | + sf.append("<FCZDXH>" + getYgcStationNumByLineCodeAndDirectionAndStationName( | |
| 353 | + scheduleRealInfo.getXlBm(), scheduleRealInfo.getXlDir(), scheduleRealInfo.getQdzName()) + "</FCZDXH>"); | |
| 345 | 354 | sf.append("<FCZDBM>"+scheduleRealInfo.getQdzCode()+"</FCZDBM>"); |
| 346 | 355 | sf.append("<JHFCSJ>"+scheduleRealInfo.getFcsj()+"</JHFCSJ>"); |
| 347 | 356 | sf.append("<DFSJ>"+scheduleRealInfo.getDfsj()+"</DFSJ>"); |
| 348 | 357 | sf.append("<SJFCSJ>"+scheduleRealInfo.getFcsjActual()+"</SJFCSJ>"); |
| 349 | 358 | sf.append("<FCZDLX>"+""+"</FCZDLX>"); |
| 350 | 359 | sf.append("<DDZDMC>"+scheduleRealInfo.getZdzName()+"</DDZDMC>"); |
| 351 | - sf.append("<DDZDXH>"+ seqNumber +"</DDZDXH>"); | |
| 360 | + sf.append("<DDZDXH>"+ getYgcStationNumByLineCodeAndDirectionAndStationName( | |
| 361 | + scheduleRealInfo.getXlBm(), scheduleRealInfo.getXlDir(), scheduleRealInfo.getZdzName()) +"</DDZDXH>"); | |
| 352 | 362 | sf.append("<DDZDBM>"+scheduleRealInfo.getZdzCode()+"</DDZDBM>"); |
| 353 | 363 | sf.append("<JHDDSJ>"+scheduleRealInfo.getZdsj()+"</JHDDSJ>"); |
| 354 | 364 | sf.append("<SJDDSJ>"+scheduleRealInfo.getZdsjActual()+"</SJDDSJ>"); |
| ... | ... | @@ -404,7 +414,8 @@ public class TrafficManageServiceImpl implements TrafficManageService{ |
| 404 | 414 | sf.append("<XLBM>"+BasicData.lineCode2ShangHaiCodeMap.get(schRealInfo.getXlBm())+"</XLBM>"); |
| 405 | 415 | sf.append("<CPH>"+car.getCarPlate()+"</CPH>"); |
| 406 | 416 | for(ScheduleRealInfo scheduleRealInfo:list){ |
| 407 | - if(schRealInfo.getXlBm().equals(scheduleRealInfo.getXlBm()) && schRealInfo.getClZbh().equals(scheduleRealInfo.getClZbh())){ | |
| 417 | + if(schRealInfo.getXlBm().equals(scheduleRealInfo.getXlBm()) && schRealInfo.getClZbh() | |
| 418 | + .equals(scheduleRealInfo.getClZbh())){ | |
| 408 | 419 | Set<ChildTaskPlan> childTaskPlans = scheduleRealInfo.getcTasks(); |
| 409 | 420 | //如果没有子任务,里程就是已执行(Status=2);有子任务的,忽略主任务,子任务的烂班 |
| 410 | 421 | if(childTaskPlans.isEmpty()){ |
| ... | ... | @@ -412,7 +423,7 @@ public class TrafficManageServiceImpl implements TrafficManageService{ |
| 412 | 423 | totalKilometers += scheduleRealInfo.getJhlc()==null?0.0:scheduleRealInfo.getJhlc(); |
| 413 | 424 | if(scheduleRealInfo.getBcType().equals("in") || scheduleRealInfo.getBcType().equals("out") |
| 414 | 425 | || scheduleRealInfo.getBcType().equals("venting")){ |
| 415 | - emptyKilometers += scheduleRealInfo.getJhlc()==null?0.0:scheduleRealInfo.getJhlc();; | |
| 426 | + emptyKilometers += scheduleRealInfo.getJhlc()==null?0.0:scheduleRealInfo.getJhlc(); | |
| 416 | 427 | } |
| 417 | 428 | } |
| 418 | 429 | }else{ |
| ... | ... | @@ -588,14 +599,19 @@ public class TrafficManageServiceImpl implements TrafficManageService{ |
| 588 | 599 | if(xlbm.equals(schedulePlanInfo.getXlBm()) |
| 589 | 600 | && zbh.equals(schedulePlanInfo.getClZbh()) |
| 590 | 601 | && lp == schedulePlanInfo.getLp()){ |
| 602 | + if(schedulePlanInfo.getBcType().equals("in") || schedulePlanInfo.getBcType().equals("out")){ | |
| 603 | + continue; | |
| 604 | + } | |
| 591 | 605 | sBuffer.append("<BC>"); |
| 592 | 606 | sBuffer.append("<SJGH>").append(schedulePlanInfo.getjGh()).append("</SJGH>"); |
| 593 | 607 | sBuffer.append("<SXX>").append(schedulePlanInfo.getXlDir()).append("</SXX>"); |
| 594 | 608 | sBuffer.append("<FCZDMC>").append(schedulePlanInfo.getQdzName()).append("</FCZDMC>"); |
| 595 | - sBuffer.append("<ZDXH>").append(++startSerialNum).append("</ZDXH>"); | |
| 609 | + sBuffer.append("<ZDXH>").append(getYgcStationNumByLineCodeAndDirectionAndStationName( | |
| 610 | + schedulePlanInfo.getXlBm(), schedulePlanInfo.getXlDir(), schedulePlanInfo.getQdzName())).append("</ZDXH>"); | |
| 596 | 611 | sBuffer.append("<JHFCSJ>").append(schedulePlanInfo.getFcsj()).append("</JHFCSJ>"); |
| 597 | 612 | sBuffer.append("<DDZDMC>").append(schedulePlanInfo.getZdzName()).append("</DDZDMC>"); |
| 598 | - sBuffer.append("<ZDXH>").append(++endSerialNum).append("</ZDXH>"); | |
| 613 | + sBuffer.append("<ZDXH>").append(getYgcStationNumByLineCodeAndDirectionAndStationName( | |
| 614 | + schedulePlanInfo.getXlBm(), schedulePlanInfo.getXlDir(), schedulePlanInfo.getZdzName())).append("</ZDXH>"); | |
| 599 | 615 | sBuffer.append("<JHDDSJ>").append(calcDdsj(schedulePlanInfo.getFcsj(),schedulePlanInfo.getBcsj())) |
| 600 | 616 | .append("</JHDDSJ>"); |
| 601 | 617 | sBuffer.append("</BC>"); |
| ... | ... | @@ -643,6 +659,7 @@ public class TrafficManageServiceImpl implements TrafficManageService{ |
| 643 | 659 | Iterator<TTInfoDetail> ttInfoDetailIterator; |
| 644 | 660 | HashMap<String,Object> param = new HashMap<String, Object>(); |
| 645 | 661 | String ttinfoJhlc = null;//计划总里程 |
| 662 | + String lineCode ; | |
| 646 | 663 | sBuffer.append("<SKBs>"); |
| 647 | 664 | for (int i = 0; i < idArray.length; i++) { |
| 648 | 665 | ttInfo = ttInfoRepository.findOne(Long.valueOf(idArray[i])); |
| ... | ... | @@ -652,7 +669,8 @@ public class TrafficManageServiceImpl implements TrafficManageService{ |
| 652 | 669 | ttInfoDetailIterator = ttInfoDetailRepository.findAll(new CustomerSpecs<TTInfoDetail>(param), |
| 653 | 670 | new Sort(Direction.ASC, "xlDir")).iterator(); |
| 654 | 671 | sBuffer.append("<SKB>"); |
| 655 | - sBuffer.append("<XLBM>").append(BasicData.lineId2ShangHaiCodeMap.get(ttInfo.getXl())).append("</XLBM>"); | |
| 672 | + sBuffer.append("<XLBM>").append(BasicData.lineId2ShangHaiCodeMap.get(ttInfo.getXl().getId())) | |
| 673 | + .append("</XLBM>"); | |
| 656 | 674 | ttinfoJhlc = new String(); |
| 657 | 675 | sBuffer.append("<JHZLC>").append(ttinfoJhlc).append("</JHZLC>"); |
| 658 | 676 | sBuffer.append("<JHYYLC>").append(ttinfoJhlc).append("</JHYYLC>"); |
| ... | ... | @@ -662,23 +680,35 @@ public class TrafficManageServiceImpl implements TrafficManageService{ |
| 662 | 680 | sBuffer.append("<TBYY>").append("").append("</TBYY>"); |
| 663 | 681 | sBuffer.append("<UPDT>").append(sdfnyrsfm.format(new Date())).append("</UPDT>"); |
| 664 | 682 | int num = 1; |
| 683 | + // 加上<BCList> | |
| 684 | + if(ttInfoDetailIterator.hasNext()){ | |
| 685 | + sBuffer.append("<BCList>"); | |
| 686 | + } | |
| 665 | 687 | while (ttInfoDetailIterator.hasNext()) { |
| 666 | 688 | ttInfoDetail = ttInfoDetailIterator.next(); |
| 689 | + if(ttInfoDetail.getBcType().equals("in") || ttInfoDetail.getBcType().equals("out")){ | |
| 690 | + continue; | |
| 691 | + } | |
| 667 | 692 | ttinfoJhlc = ttInfoDetail.getJhlc()+"";// 设置计划总里程 |
| 668 | - sBuffer.append("<BCList>"); | |
| 693 | + lineCode = ttInfoDetail.getXl().getLineCode(); | |
| 669 | 694 | sBuffer.append("<BC>"); |
| 670 | 695 | sBuffer.append("<LPBH>").append(ttInfoDetail.getLp().getLpNo()).append("</LPBH>"); |
| 671 | 696 | sBuffer.append("<SXX>").append(ttInfoDetail.getXlDir()).append("</SXX>"); |
| 672 | - sBuffer.append("<FCZDMC>").append(ttInfoDetail.getQdz()).append("</FCZDMC>"); | |
| 673 | - sBuffer.append("<ZDXH>").append(num).append("</ZDXH>"); | |
| 697 | + sBuffer.append("<FCZDMC>").append(ttInfoDetail.getQdz().getStationName()).append("</FCZDMC>"); | |
| 698 | + sBuffer.append("<ZDXH>").append(getYgcStationNumByLineCodeAndDirectionAndStationName( | |
| 699 | + lineCode, ttInfoDetail.getXlDir(), ttInfoDetail.getQdz().getStationName())).append("</ZDXH>"); | |
| 674 | 700 | sBuffer.append("<JHFCSJ>").append(ttInfoDetail.getFcsj()).append("</JHFCSJ>"); |
| 675 | - sBuffer.append("<DDZDMC>").append(ttInfoDetail.getZdz()).append("</DDZDMC>"); | |
| 676 | - sBuffer.append("<ZDXH>").append(num).append("</ZDXH>"); | |
| 701 | + sBuffer.append("<DDZDMC>").append(ttInfoDetail.getZdz().getStationName()).append("</DDZDMC>"); | |
| 702 | + sBuffer.append("<ZDXH>").append(getYgcStationNumByLineCodeAndDirectionAndStationName( | |
| 703 | + lineCode, ttInfoDetail.getXlDir(), ttInfoDetail.getZdz().getStationName())).append("</ZDXH>"); | |
| 677 | 704 | sBuffer.append("<JHDDSJ>").append(calcDdsj(ttInfoDetail.getFcsj(),ttInfoDetail.getBcsj())).append("</JHDDSJ>"); |
| 678 | 705 | sBuffer.append("</BC>"); |
| 679 | - sBuffer.append("</BCList>"); | |
| 706 | + | |
| 680 | 707 | num++; |
| 681 | 708 | } |
| 709 | + if(sBuffer.indexOf("<BCList>") != -1){ | |
| 710 | + sBuffer.append("</BCList>"); | |
| 711 | + } | |
| 682 | 712 | sBuffer.append("</SKB>"); |
| 683 | 713 | } |
| 684 | 714 | sBuffer.append("</SKBs>"); |
| ... | ... | @@ -1008,7 +1038,7 @@ public class TrafficManageServiceImpl implements TrafficManageService{ |
| 1008 | 1038 | zdlx = "2"; |
| 1009 | 1039 | } |
| 1010 | 1040 | sBuffer.append("<Station>"); |
| 1011 | - sBuffer.append("<ZDXH>").append(startId).append("</ZDXH>"); | |
| 1041 | + sBuffer.append("<ZDXH>").append(getYgcStationNumByLineCodeAndDirectionAndStationName(srRoute.getLineCode(),srRoute.getDirections()+"",srRoute.getStationName())).append("</ZDXH>"); | |
| 1012 | 1042 | sBuffer.append("<SXX>").append(srRoute.getDirections()).append("</SXX>"); |
| 1013 | 1043 | sBuffer.append("<ZDMC>").append(srRoute.getStationName()).append("</ZDMC>"); |
| 1014 | 1044 | sBuffer.append("<ZDBM>").append(srRoute.getStationCode()).append("</ZDBM>"); |
| ... | ... | @@ -1023,4 +1053,18 @@ public class TrafficManageServiceImpl implements TrafficManageService{ |
| 1023 | 1053 | return startId; |
| 1024 | 1054 | } |
| 1025 | 1055 | |
| 1056 | + /** | |
| 1057 | + * | |
| 1058 | + * @param lineCode 线路编码 | |
| 1059 | + * @param direction 线路方向 | |
| 1060 | + * @param stationName 让点名称 | |
| 1061 | + * @return 运管处站点序号 | |
| 1062 | + */ | |
| 1063 | + private Integer getYgcStationNumByLineCodeAndDirectionAndStationName(String lineCode,String direction,String stationName){ | |
| 1064 | + Integer number = 0; | |
| 1065 | + Map<String, Map> dirs2Statioin = BasicData.stationName2YgcNumber.get(lineCode); | |
| 1066 | + Map<String, Integer> station2Number = dirs2Statioin.get(direction); | |
| 1067 | + number = station2Number.get(stationName); | |
| 1068 | + return number; | |
| 1069 | + } | |
| 1026 | 1070 | } | ... | ... |
src/main/java/com/bsth/service/oil/YlbService.java
| ... | ... | @@ -7,7 +7,7 @@ import com.bsth.entity.oil.Ylb; |
| 7 | 7 | import com.bsth.service.BaseService; |
| 8 | 8 | |
| 9 | 9 | public interface YlbService extends BaseService<Ylb, Integer>{ |
| 10 | - Map<String, Object> obtain(String rq); | |
| 10 | + Map<String, Object> obtain(Map<String, Object> map); | |
| 11 | 11 | String obtainDsq(); |
| 12 | 12 | Map<String, Object> sort(Map<String, Object> map); |
| 13 | 13 | ... | ... |
src/main/java/com/bsth/service/oil/impl/YlbServiceImpl.java
| ... | ... | @@ -85,7 +85,7 @@ public class YlbServiceImpl extends BaseServiceImpl<Ylb,Integer> implements YlbS |
| 85 | 85 | //前一天所有车辆最后进场班次信息 |
| 86 | 86 | List<Ylb> ylListBe=repository.obtainYlbefore(rq); |
| 87 | 87 | //从排班表中计算出行驶的总里程 |
| 88 | - List<Map<String,Object>> listpb=scheduleRealInfoService.yesterdayDataList("1024",rq); | |
| 88 | + List<Map<String,Object>> listpb=scheduleRealInfoService.yesterdayDataList("",rq); | |
| 89 | 89 | |
| 90 | 90 | for(int x=0;x<listpb.size();x++){ |
| 91 | 91 | |
| ... | ... | @@ -151,7 +151,13 @@ public class YlbServiceImpl extends BaseServiceImpl<Ylb,Integer> implements YlbS |
| 151 | 151 | */ |
| 152 | 152 | @Transactional |
| 153 | 153 | @Override |
| 154 | - public Map<String, Object> obtain(String rq) { | |
| 154 | + public Map<String, Object> obtain(Map<String, Object> map2) { | |
| 155 | + String rq=map2.get("rq").toString(); | |
| 156 | + String line=""; | |
| 157 | + if(map2.get("xlbm_eq")!=null){ | |
| 158 | + line=map2.get("xlbm_eq").toString(); | |
| 159 | + } | |
| 160 | + | |
| 155 | 161 | SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd"); |
| 156 | 162 | //保留两位小数 |
| 157 | 163 | DecimalFormat df = new DecimalFormat("#.00"); |
| ... | ... | @@ -164,7 +170,7 @@ public class YlbServiceImpl extends BaseServiceImpl<Ylb,Integer> implements YlbS |
| 164 | 170 | //前一天所有车辆最后进场班次信息 |
| 165 | 171 | List<Ylb> ylListBe=repository.obtainYlbefore(rq); |
| 166 | 172 | //从排班表中计算出行驶的总里程 |
| 167 | - List<Map<String,Object>> listpb=scheduleRealInfoService.yesterdayDataList("1024",rq); | |
| 173 | + List<Map<String,Object>> listpb=scheduleRealInfoService.yesterdayDataList(line,rq); | |
| 168 | 174 | |
| 169 | 175 | for(int x=0;x<listpb.size();x++){ |
| 170 | 176 | ... | ... |
src/main/java/com/bsth/service/realcontrol/dto/ScheduleExecRate.java
| 1 | -package com.bsth.service.realcontrol.dto; | |
| 2 | - | |
| 3 | -/** | |
| 4 | - * 班次执行率DTO | |
| 5 | - * Created by panzhao on 2016/11/14. | |
| 6 | - */ | |
| 7 | -public class ScheduleExecRate { | |
| 8 | - | |
| 9 | - private long id; | |
| 10 | - private String dfsj; | |
| 11 | - private String fcsjActual; | |
| 12 | - private String zdsj; | |
| 13 | - private String zdsjActual; | |
| 14 | - private int status; | |
| 15 | - private String lineCode; | |
| 16 | - | |
| 17 | - public long getId() { | |
| 18 | - return id; | |
| 19 | - } | |
| 20 | - | |
| 21 | - public void setId(long id) { | |
| 22 | - this.id = id; | |
| 23 | - } | |
| 24 | - | |
| 25 | - public String getDfsj() { | |
| 26 | - return dfsj; | |
| 27 | - } | |
| 28 | - | |
| 29 | - public void setDfsj(String dfsj) { | |
| 30 | - this.dfsj = dfsj; | |
| 31 | - } | |
| 32 | - | |
| 33 | - public String getFcsjActual() { | |
| 34 | - return fcsjActual; | |
| 35 | - } | |
| 36 | - | |
| 37 | - public void setFcsjActual(String fcsjActual) { | |
| 38 | - this.fcsjActual = fcsjActual; | |
| 39 | - } | |
| 40 | - | |
| 41 | - public String getZdsj() { | |
| 42 | - return zdsj; | |
| 43 | - } | |
| 44 | - | |
| 45 | - public void setZdsj(String zdsj) { | |
| 46 | - this.zdsj = zdsj; | |
| 47 | - } | |
| 48 | - | |
| 49 | - public String getZdsjActual() { | |
| 50 | - return zdsjActual; | |
| 51 | - } | |
| 52 | - | |
| 53 | - public void setZdsjActual(String zdsjActual) { | |
| 54 | - this.zdsjActual = zdsjActual; | |
| 55 | - } | |
| 56 | - | |
| 57 | - public int getStatus() { | |
| 58 | - return status; | |
| 59 | - } | |
| 60 | - | |
| 61 | - public void setStatus(int status) { | |
| 62 | - this.status = status; | |
| 63 | - } | |
| 64 | - | |
| 65 | - public String getLineCode() { | |
| 66 | - return lineCode; | |
| 67 | - } | |
| 68 | - | |
| 69 | - public void setLineCode(String lineCode) { | |
| 70 | - this.lineCode = lineCode; | |
| 71 | - } | |
| 72 | -} | |
| 1 | +package com.bsth.service.realcontrol.dto; | |
| 2 | + | |
| 3 | +/** | |
| 4 | + * 班次执行率DTO | |
| 5 | + * Created by panzhao on 2016/11/14. | |
| 6 | + */ | |
| 7 | +public class ScheduleExecRate { | |
| 8 | + | |
| 9 | + private long id; | |
| 10 | + private String dfsj; | |
| 11 | + private String fcsjActual; | |
| 12 | + private String zdsj; | |
| 13 | + private String zdsjActual; | |
| 14 | + private int status; | |
| 15 | + private String lineCode; | |
| 16 | + | |
| 17 | + public long getId() { | |
| 18 | + return id; | |
| 19 | + } | |
| 20 | + | |
| 21 | + public void setId(long id) { | |
| 22 | + this.id = id; | |
| 23 | + } | |
| 24 | + | |
| 25 | + public String getDfsj() { | |
| 26 | + return dfsj; | |
| 27 | + } | |
| 28 | + | |
| 29 | + public void setDfsj(String dfsj) { | |
| 30 | + this.dfsj = dfsj; | |
| 31 | + } | |
| 32 | + | |
| 33 | + public String getFcsjActual() { | |
| 34 | + return fcsjActual; | |
| 35 | + } | |
| 36 | + | |
| 37 | + public void setFcsjActual(String fcsjActual) { | |
| 38 | + this.fcsjActual = fcsjActual; | |
| 39 | + } | |
| 40 | + | |
| 41 | + public String getZdsj() { | |
| 42 | + return zdsj; | |
| 43 | + } | |
| 44 | + | |
| 45 | + public void setZdsj(String zdsj) { | |
| 46 | + this.zdsj = zdsj; | |
| 47 | + } | |
| 48 | + | |
| 49 | + public String getZdsjActual() { | |
| 50 | + return zdsjActual; | |
| 51 | + } | |
| 52 | + | |
| 53 | + public void setZdsjActual(String zdsjActual) { | |
| 54 | + this.zdsjActual = zdsjActual; | |
| 55 | + } | |
| 56 | + | |
| 57 | + public int getStatus() { | |
| 58 | + return status; | |
| 59 | + } | |
| 60 | + | |
| 61 | + public void setStatus(int status) { | |
| 62 | + this.status = status; | |
| 63 | + } | |
| 64 | + | |
| 65 | + public String getLineCode() { | |
| 66 | + return lineCode; | |
| 67 | + } | |
| 68 | + | |
| 69 | + public void setLineCode(String lineCode) { | |
| 70 | + this.lineCode = lineCode; | |
| 71 | + } | |
| 72 | +} | ... | ... |
src/main/java/com/bsth/service/realcontrol/impl/ScheduleRealInfoServiceImpl.java
| 1 | 1 | package com.bsth.service.realcontrol.impl; |
| 2 | 2 | |
| 3 | -import java.text.DecimalFormat; | |
| 4 | -import java.text.ParseException; | |
| 5 | -import java.text.SimpleDateFormat; | |
| 6 | -import java.util.ArrayList; | |
| 7 | -import java.util.Collection; | |
| 8 | -import java.util.Collections; | |
| 9 | -import java.util.Date; | |
| 10 | -import java.util.HashMap; | |
| 11 | -import java.util.HashSet; | |
| 12 | -import java.util.Iterator; | |
| 13 | -import java.util.List; | |
| 14 | -import java.util.Map; | |
| 15 | -import java.util.Set; | |
| 16 | - | |
| 17 | -import com.bsth.entity.realcontrol.LineConfig; | |
| 18 | -import org.apache.commons.lang3.StringUtils; | |
| 19 | -import org.joda.time.format.DateTimeFormat; | |
| 20 | -import org.joda.time.format.DateTimeFormatter; | |
| 21 | -import org.slf4j.Logger; | |
| 22 | -import org.slf4j.LoggerFactory; | |
| 23 | -import org.springframework.beans.factory.annotation.Autowired; | |
| 24 | -import org.springframework.stereotype.Service; | |
| 25 | - | |
| 26 | 3 | import com.alibaba.fastjson.JSONArray; |
| 27 | 4 | import com.alibaba.fastjson.JSONObject; |
| 28 | 5 | import com.bsth.common.ResponseCode; |
| ... | ... | @@ -39,6 +16,7 @@ import com.bsth.entity.Cars; |
| 39 | 16 | import com.bsth.entity.Line; |
| 40 | 17 | import com.bsth.entity.Personnel; |
| 41 | 18 | import com.bsth.entity.realcontrol.ChildTaskPlan; |
| 19 | +import com.bsth.entity.realcontrol.LineConfig; | |
| 42 | 20 | import com.bsth.entity.realcontrol.ScheduleRealInfo; |
| 43 | 21 | import com.bsth.entity.schedule.CarConfigInfo; |
| 44 | 22 | import com.bsth.entity.schedule.EmployeeConfigInfo; |
| ... | ... | @@ -54,17 +32,25 @@ import com.bsth.security.util.SecurityUtils; |
| 54 | 32 | import com.bsth.service.SectionRouteService; |
| 55 | 33 | import com.bsth.service.impl.BaseServiceImpl; |
| 56 | 34 | import com.bsth.service.realcontrol.ScheduleRealInfoService; |
| 57 | -import com.bsth.util.DateUtils; | |
| 58 | -import com.bsth.util.ReportRelatedUtils; | |
| 59 | -import com.bsth.util.ReportUtils; | |
| 60 | -import com.bsth.util.TimeUtils; | |
| 61 | -import com.bsth.util.TransGPS; | |
| 35 | +import com.bsth.util.*; | |
| 62 | 36 | import com.bsth.util.TransGPS.Location; |
| 63 | 37 | import com.bsth.websocket.handler.SendUtils; |
| 64 | 38 | import com.google.common.base.Splitter; |
| 65 | 39 | import com.google.common.collect.ArrayListMultimap; |
| 66 | 40 | import com.google.common.collect.Lists; |
| 67 | 41 | import com.google.common.collect.Multimap; |
| 42 | +import org.apache.commons.lang3.StringUtils; | |
| 43 | +import org.joda.time.format.DateTimeFormat; | |
| 44 | +import org.joda.time.format.DateTimeFormatter; | |
| 45 | +import org.slf4j.Logger; | |
| 46 | +import org.slf4j.LoggerFactory; | |
| 47 | +import org.springframework.beans.factory.annotation.Autowired; | |
| 48 | +import org.springframework.stereotype.Service; | |
| 49 | + | |
| 50 | +import java.text.DecimalFormat; | |
| 51 | +import java.text.ParseException; | |
| 52 | +import java.text.SimpleDateFormat; | |
| 53 | +import java.util.*; | |
| 68 | 54 | |
| 69 | 55 | @Service |
| 70 | 56 | public class ScheduleRealInfoServiceImpl extends BaseServiceImpl<ScheduleRealInfo, Long> |
| ... | ... | @@ -289,6 +275,10 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl<ScheduleRealInf |
| 289 | 275 | rs.put("msg", "驾驶员工号不能为空!"); |
| 290 | 276 | return rs; |
| 291 | 277 | } |
| 278 | + //截取工号 | |
| 279 | + if(t.getsGh().indexOf("-") != -1){ | |
| 280 | + t.setsGh(t.getsGh().split("-")[1]); | |
| 281 | + } | |
| 292 | 282 | |
| 293 | 283 | t.setScheduleDateStr(schDate); |
| 294 | 284 | t.setScheduleDate(sdfyyyyMMdd.parse(schDate)); |
| ... | ... | @@ -454,12 +444,16 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl<ScheduleRealInf |
| 454 | 444 | |
| 455 | 445 | @Override |
| 456 | 446 | public void adjustDriver(ScheduleRealInfo schedule, String driver, String driverName) { |
| 447 | + if(driver.indexOf("-") != -1) | |
| 448 | + driver = driver.split("-")[1]; | |
| 457 | 449 | schedule.setjGh(driver); |
| 458 | 450 | schedule.setjName(driverName); |
| 459 | 451 | } |
| 460 | 452 | |
| 461 | 453 | @Override |
| 462 | 454 | public void adjustConductor(ScheduleRealInfo schedule, String conductor, String conductorName) { |
| 455 | + if(conductor.indexOf("-") != -1) | |
| 456 | + conductor = conductor.split("-")[1]; | |
| 463 | 457 | schedule.setsGh(conductor); |
| 464 | 458 | schedule.setsName(conductorName); |
| 465 | 459 | } |
| ... | ... | @@ -1135,8 +1129,10 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl<ScheduleRealInf |
| 1135 | 1129 | addMileage += tempJhlc; |
| 1136 | 1130 | ljbc++; |
| 1137 | 1131 | }else{ |
| 1132 | + if(scheduleRealInfo.getBcType().equals("normal")){ | |
| 1133 | + jhbc++; | |
| 1134 | + } | |
| 1138 | 1135 | jhlc += tempJhlc; |
| 1139 | - jhbc++; | |
| 1140 | 1136 | if(scheduleRealInfo.getStatus() == -1){ |
| 1141 | 1137 | remMileage += tempJhlc; |
| 1142 | 1138 | cjbc++; |
| ... | ... | @@ -1522,7 +1518,7 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl<ScheduleRealInf |
| 1522 | 1518 | if(scheduleRealInfo.getXlBm().equals(yesterdayDataList.get(i).get("xlBm")) && scheduleRealInfo.getClZbh().equals(yesterdayDataList.get(i).get("clZbh")) |
| 1523 | 1519 | && scheduleRealInfo.getjGh().equals(yesterdayDataList.get(i).get("jGh"))){ |
| 1524 | 1520 | //根据线路代码获取公司 |
| 1525 | - Line li = lineRepository.findByLineCode(line); | |
| 1521 | + Line li = lineRepository.findByLineCode(scheduleRealInfo.getXlBm()); | |
| 1526 | 1522 | yesterdayDataList.get(i).put("company", li.getCompany()); |
| 1527 | 1523 | //计算总公里 |
| 1528 | 1524 | Set<ChildTaskPlan> childTaskPlans = scheduleRealInfo.getcTasks(); | ... | ... |
src/main/java/com/bsth/service/schedule/utils/DataImportExportService.java
| ... | ... | @@ -3,6 +3,7 @@ package com.bsth.service.schedule.utils; |
| 3 | 3 | import org.springframework.web.multipart.MultipartFile; |
| 4 | 4 | |
| 5 | 5 | import java.io.File; |
| 6 | +import java.util.Map; | |
| 6 | 7 | |
| 7 | 8 | /** |
| 8 | 9 | * 数据导入导出服务。 |
| ... | ... | @@ -32,4 +33,7 @@ public interface DataImportExportService { |
| 32 | 33 | * @throws Exception |
| 33 | 34 | */ |
| 34 | 35 | File fileDataOutput(String fileName, File ktrFile) throws Exception; |
| 36 | + | |
| 37 | + | |
| 38 | + File fileDataOutput(String fileName, File ktrFile, Map<String, Object> param) throws Exception; | |
| 35 | 39 | } | ... | ... |
src/main/java/com/bsth/service/schedule/utils/DataImportExportServiceImpl.java
| ... | ... | @@ -10,6 +10,7 @@ import org.springframework.beans.factory.InitializingBean; |
| 10 | 10 | import org.springframework.beans.factory.annotation.Autowired; |
| 11 | 11 | import org.springframework.boot.context.properties.EnableConfigurationProperties; |
| 12 | 12 | import org.springframework.stereotype.Service; |
| 13 | +import org.springframework.util.CollectionUtils; | |
| 13 | 14 | import org.springframework.web.multipart.MultipartFile; |
| 14 | 15 | |
| 15 | 16 | import java.io.File; |
| ... | ... | @@ -111,6 +112,11 @@ public class DataImportExportServiceImpl implements DataImportExportService, Ini |
| 111 | 112 | |
| 112 | 113 | @Override |
| 113 | 114 | public File fileDataOutput(String fileName, File ktrFile) throws Exception { |
| 115 | + return fileDataOutput(fileName, ktrFile, null); | |
| 116 | + } | |
| 117 | + | |
| 118 | + @Override | |
| 119 | + public File fileDataOutput(String fileName, File ktrFile, Map<String, Object> param) throws Exception { | |
| 114 | 120 | // 初始化转换,元数据,转换对象 |
| 115 | 121 | TransMeta transMeta = new TransMeta(ktrFile.getAbsolutePath()); |
| 116 | 122 | Trans trans = new Trans(transMeta); |
| ... | ... | @@ -120,6 +126,14 @@ public class DataImportExportServiceImpl implements DataImportExportService, Ini |
| 120 | 126 | fileName + |
| 121 | 127 | new DateTime().toString("yyyyMMddHHmmss") + ".xls"; |
| 122 | 128 | trans.setParameterValue("filepath", filepath); |
| 129 | + | |
| 130 | + // 添加其他参数 | |
| 131 | + if (!CollectionUtils.isEmpty(param)) { | |
| 132 | + for (String key : param.keySet()) { | |
| 133 | + trans.setParameterValue(key, String.valueOf(param.get(key))); | |
| 134 | + } | |
| 135 | + } | |
| 136 | + | |
| 123 | 137 | // 执行转换 |
| 124 | 138 | trans.execute(null); |
| 125 | 139 | // 等待转换结束 | ... | ... |
src/main/java/com/bsth/service/schedule/utils/DataToolsProperties.java
| ... | ... | @@ -83,6 +83,10 @@ public class DataToolsProperties { |
| 83 | 83 | /** 人员信息导出ktr转换 */ |
| 84 | 84 | @NotNull |
| 85 | 85 | private String employeesDataoutputktr; |
| 86 | + /** 时刻表导出元数据ktr转换 */ | |
| 87 | + private String ttinfodetailMetaoutput; | |
| 88 | + /** 时刻表导出数据ktr转换 */ | |
| 89 | + private String ttinfodetailOutput; | |
| 86 | 90 | |
| 87 | 91 | // TODO: |
| 88 | 92 | |
| ... | ... | @@ -253,4 +257,20 @@ public class DataToolsProperties { |
| 253 | 257 | public void setKvarsDbdname(String kvarsDbdname) { |
| 254 | 258 | this.kvarsDbdname = kvarsDbdname; |
| 255 | 259 | } |
| 260 | + | |
| 261 | + public String getTtinfodetailMetaoutput() { | |
| 262 | + return ttinfodetailMetaoutput; | |
| 263 | + } | |
| 264 | + | |
| 265 | + public void setTtinfodetailMetaoutput(String ttinfodetailMetaoutput) { | |
| 266 | + this.ttinfodetailMetaoutput = ttinfodetailMetaoutput; | |
| 267 | + } | |
| 268 | + | |
| 269 | + public String getTtinfodetailOutput() { | |
| 270 | + return ttinfodetailOutput; | |
| 271 | + } | |
| 272 | + | |
| 273 | + public void setTtinfodetailOutput(String ttinfodetailOutput) { | |
| 274 | + this.ttinfodetailOutput = ttinfodetailOutput; | |
| 275 | + } | |
| 256 | 276 | } | ... | ... |
src/main/java/com/bsth/service/sys/CompanyAuthorityService.java
0 → 100644
| 1 | +package com.bsth.service.sys; | |
| 2 | + | |
| 3 | +import com.bsth.entity.sys.CompanyAuthority; | |
| 4 | +import com.bsth.entity.sys.SysUser; | |
| 5 | +import com.bsth.service.BaseService; | |
| 6 | + | |
| 7 | +import java.util.List; | |
| 8 | +import java.util.Map; | |
| 9 | + | |
| 10 | +/** | |
| 11 | + * Created by panzhao on 2016/11/22. | |
| 12 | + */ | |
| 13 | +public interface CompanyAuthorityService extends BaseService<CompanyAuthority, Integer> { | |
| 14 | + Map<String,Object> save(Integer roleId, List<CompanyAuthority> list); | |
| 15 | + | |
| 16 | + List<CompanyAuthority> findByUser(SysUser user); | |
| 17 | +} | ... | ... |
src/main/java/com/bsth/service/sys/impl/CompanyAuthorityServiceImpl.java
0 → 100644
| 1 | +package com.bsth.service.sys.impl; | |
| 2 | + | |
| 3 | +import com.bsth.common.ResponseCode; | |
| 4 | +import com.bsth.entity.sys.CompanyAuthority; | |
| 5 | +import com.bsth.entity.sys.Role; | |
| 6 | +import com.bsth.entity.sys.SysUser; | |
| 7 | +import com.bsth.repository.sys.CompanyAuthorityRepository; | |
| 8 | +import com.bsth.service.impl.BaseServiceImpl; | |
| 9 | +import com.bsth.service.sys.CompanyAuthorityService; | |
| 10 | +import org.slf4j.Logger; | |
| 11 | +import org.slf4j.LoggerFactory; | |
| 12 | +import org.springframework.beans.factory.annotation.Autowired; | |
| 13 | +import org.springframework.stereotype.Service; | |
| 14 | +import org.springframework.transaction.annotation.Transactional; | |
| 15 | + | |
| 16 | +import java.util.*; | |
| 17 | + | |
| 18 | +/** | |
| 19 | + * Created by panzhao on 2016/11/22. | |
| 20 | + */ | |
| 21 | +@Service | |
| 22 | +public class CompanyAuthorityServiceImpl extends BaseServiceImpl<CompanyAuthority, Integer> implements CompanyAuthorityService { | |
| 23 | + | |
| 24 | + @Autowired | |
| 25 | + CompanyAuthorityRepository companyAuthorityRepository; | |
| 26 | + | |
| 27 | + Logger logger = LoggerFactory.getLogger(this.getClass()); | |
| 28 | + | |
| 29 | + @Transactional | |
| 30 | + @Override | |
| 31 | + public Map<String, Object> save(Integer roleId, List<CompanyAuthority> list) { | |
| 32 | + Map<String, Object> rs = new HashMap(); | |
| 33 | + | |
| 34 | + try { | |
| 35 | + for(CompanyAuthority cauth : list){ | |
| 36 | + cauth.setRoleId(roleId); | |
| 37 | + } | |
| 38 | + | |
| 39 | + //删除原数据 | |
| 40 | + companyAuthorityRepository.deleteByRoleId(roleId); | |
| 41 | + | |
| 42 | + //重新写入数据 | |
| 43 | + companyAuthorityRepository.save(list); | |
| 44 | + | |
| 45 | + rs.put("status", ResponseCode.SUCCESS); | |
| 46 | + } catch (Exception e) { | |
| 47 | + logger.error("", e); | |
| 48 | + rs.put("status", ResponseCode.ERROR); | |
| 49 | + } | |
| 50 | + | |
| 51 | + return rs; | |
| 52 | + } | |
| 53 | + | |
| 54 | + @Override | |
| 55 | + public List<CompanyAuthority> findByUser(SysUser user) { | |
| 56 | + Set<Role> roles = user.getRoles(); | |
| 57 | + if(roles == null || roles.size() == 0) | |
| 58 | + return null; | |
| 59 | + | |
| 60 | + List<Integer> idx = new ArrayList<>(); | |
| 61 | + for(Role r : roles) | |
| 62 | + idx.add(r.getId()); | |
| 63 | + | |
| 64 | + List<CompanyAuthority> cAuths = companyAuthorityRepository.findByRoles(idx); | |
| 65 | + return cAuths; | |
| 66 | + } | |
| 67 | +} | ... | ... |
src/main/java/com/bsth/service/sys/impl/ModuleServiceImpl.java
| 1 | 1 | package com.bsth.service.sys.impl; |
| 2 | 2 | |
| 3 | -import java.util.ArrayList; | |
| 4 | -import java.util.HashMap; | |
| 5 | -import java.util.HashSet; | |
| 6 | -import java.util.List; | |
| 7 | -import java.util.Map; | |
| 8 | -import java.util.Set; | |
| 9 | - | |
| 10 | -import org.springframework.beans.factory.annotation.Autowired; | |
| 11 | -import org.springframework.data.domain.Sort; | |
| 12 | -import org.springframework.data.domain.Sort.Direction; | |
| 13 | -import org.springframework.stereotype.Service; | |
| 14 | - | |
| 15 | 3 | import com.bsth.common.ResponseCode; |
| 16 | 4 | import com.bsth.entity.sys.Module; |
| 17 | 5 | import com.bsth.entity.sys.Role; |
| ... | ... | @@ -20,12 +8,23 @@ import com.bsth.repository.sys.ModuleRepository; |
| 20 | 8 | import com.bsth.security.util.SecurityUtils; |
| 21 | 9 | import com.bsth.service.impl.BaseServiceImpl; |
| 22 | 10 | import com.bsth.service.sys.ModuleService; |
| 11 | +import org.springframework.beans.factory.annotation.Autowired; | |
| 12 | +import org.springframework.jdbc.core.JdbcTemplate; | |
| 13 | +import org.springframework.jdbc.core.RowMapper; | |
| 14 | +import org.springframework.stereotype.Service; | |
| 15 | + | |
| 16 | +import java.sql.ResultSet; | |
| 17 | +import java.sql.SQLException; | |
| 18 | +import java.util.*; | |
| 23 | 19 | |
| 24 | 20 | @Service |
| 25 | 21 | public class ModuleServiceImpl extends BaseServiceImpl<Module, Integer> implements ModuleService{ |
| 26 | 22 | |
| 27 | 23 | @Autowired |
| 28 | 24 | ModuleRepository moduleRepository; |
| 25 | + | |
| 26 | + @Autowired | |
| 27 | + JdbcTemplate jdbcTemplate; | |
| 29 | 28 | |
| 30 | 29 | @Override |
| 31 | 30 | public List<Module> findByGroupType(String group) { |
| ... | ... | @@ -62,26 +61,38 @@ public class ModuleServiceImpl extends BaseServiceImpl<Module, Integer> implemen |
| 62 | 61 | SysUser user = SecurityUtils.getCurrentUser(); |
| 63 | 62 | Set<Role> roles = user.getRoles(); |
| 64 | 63 | |
| 65 | - List<Module> all = (List<Module>) moduleRepository.findAll(new Sort(Direction.ASC, "id")) | |
| 66 | - ,results = new ArrayList<>(); | |
| 67 | - | |
| 64 | + String inCond = ""; | |
| 65 | + for(Role r : roles) | |
| 66 | + inCond += ("," + r.getId()); | |
| 67 | + | |
| 68 | + inCond = "(" + inCond.substring(1) + ")"; | |
| 69 | + | |
| 70 | + String sql = "select ID,CREATE_DATE,`ENABLE`,GROUP_TYPE,ICON,MAPP_SYMBOL,NAME,P_ID,PATH,UPDATE_DATE,CONTAINER from bsth_c_sys_module m where id in (select modules from bsth_c_sys_role_modules where roles in "+inCond+") or group_type != 3"; | |
| 71 | + List<Module> all = jdbcTemplate.query(sql, new ModuleRowMapper()) | |
| 72 | + ,rs = new ArrayList<>(); | |
| 73 | + | |
| 68 | 74 | Map<Integer, Module> map = new HashMap<>(); |
| 69 | 75 | for(Module m : all){ |
| 70 | 76 | map.put(m.getId(), m); |
| 71 | - for(Role r : roles){ | |
| 72 | - if(m.getRoles().contains(r)) | |
| 73 | - results.add(m); | |
| 74 | - } | |
| 77 | + if(m.getGroupType().equals("3")) | |
| 78 | + rs.add(m); | |
| 75 | 79 | } |
| 76 | 80 | |
| 77 | 81 | //上层目录和组节点 |
| 78 | 82 | Set<Module> pSet = new HashSet<>(); |
| 79 | - for(Module m : results){ | |
| 83 | + for(Module m : rs){ | |
| 80 | 84 | searchParentNode(m, map, pSet); |
| 81 | 85 | } |
| 82 | - results.addAll(pSet); | |
| 83 | - | |
| 84 | - return results; | |
| 86 | + rs.addAll(pSet); | |
| 87 | + | |
| 88 | + //排序 | |
| 89 | + Collections.sort(rs, new Comparator<Module>() { | |
| 90 | + @Override | |
| 91 | + public int compare(Module o1, Module o2) { | |
| 92 | + return o1.getId() - o2.getId(); | |
| 93 | + } | |
| 94 | + }); | |
| 95 | + return rs; | |
| 85 | 96 | } |
| 86 | 97 | |
| 87 | 98 | /** |
| ... | ... | @@ -105,4 +116,24 @@ public class ModuleServiceImpl extends BaseServiceImpl<Module, Integer> implemen |
| 105 | 116 | searchParentNode(pModule, idMap, pSet); |
| 106 | 117 | } |
| 107 | 118 | } |
| 119 | + | |
| 120 | + public class ModuleRowMapper implements RowMapper<Module>{ | |
| 121 | + | |
| 122 | + @Override | |
| 123 | + public Module mapRow(ResultSet rs, int rowNum) throws SQLException { | |
| 124 | + Module module = new Module(); | |
| 125 | + module.setId(rs.getInt("ID")); | |
| 126 | + module.setCreateDate(rs.getDate("CREATE_DATE")); | |
| 127 | + module.setEnable(rs.getBoolean("ENABLE")); | |
| 128 | + module.setGroupType(rs.getString("GROUP_TYPE")); | |
| 129 | + module.setIcon(rs.getString("ICON")); | |
| 130 | + module.setMappSymbol(rs.getString("MAPP_SYMBOL")); | |
| 131 | + module.setName(rs.getString("NAME")); | |
| 132 | + module.setpId(rs.getInt("P_ID")); | |
| 133 | + module.setPath(rs.getString("PATH")); | |
| 134 | + module.setUpdateDate(rs.getDate("UPDATE_DATE")); | |
| 135 | + module.setContainer(rs.getString("CONTAINER")); | |
| 136 | + return module; | |
| 137 | + } | |
| 138 | + } | |
| 108 | 139 | } | ... | ... |
src/main/java/com/bsth/util/Geo/SHCJ2BDJW.java
| ... | ... | @@ -25,9 +25,11 @@ public class SHCJ2BDJW { |
| 25 | 25 | |
| 26 | 26 | ResultSet rs = null; |
| 27 | 27 | |
| 28 | - String sqlSelect = "SELECT b.SHAPESTRING as SHAPE , b.id as ID FROM jjwgps_t_gjldb b where SHAPESTRING is not null order by b.ldbh asc "; | |
| 28 | + /*String sqlSelect = "SELECT b.SHAPESTRING as SHAPE , b.id as ID FROM jjwgps_t_gjldb b where SHAPESTRING is not null order by b.ldbh asc ";*/ | |
| 29 | + /*String sqlSelect = "select s.id,s.descriptions from bsth_c_station s order by s.id asc ";*/ | |
| 30 | + String sqlSelect = "SELECT s.id,s.descriptions FROM bsth_c_section s order by s.id asc "; | |
| 29 | 31 | |
| 30 | - String sqlUpdate = "UPDATE jjwgps_t_gjldb SET bdjw = GeomFromText(?),SHAPE = GeomFromText(?) where id = ?"; | |
| 32 | + String sqlUpdate = "UPDATE bsth_c_section SET csection_vector = ST_GeomFromText(?) , bsection_vector=ST_GeomFromText(?) , gsection_vector=ST_GeomFromText(?) where id = ?"; | |
| 31 | 33 | |
| 32 | 34 | List<Map<String, Object>> list = new ArrayList<>(); |
| 33 | 35 | |
| ... | ... | @@ -42,9 +44,9 @@ public class SHCJ2BDJW { |
| 42 | 44 | |
| 43 | 45 | Map<String, Object> map = new HashMap<String, Object>(); |
| 44 | 46 | |
| 45 | - map.put("shape", rs.getString("SHAPE")); | |
| 47 | + map.put("descriptions", rs.getString("descriptions")); | |
| 46 | 48 | |
| 47 | - map.put("id", rs.getInt("ID")); | |
| 49 | + map.put("id", rs.getInt("id")); | |
| 48 | 50 | |
| 49 | 51 | list.add(map); |
| 50 | 52 | } |
| ... | ... | @@ -52,15 +54,29 @@ public class SHCJ2BDJW { |
| 52 | 54 | for(int i =0;i<list.size();i++) { |
| 53 | 55 | |
| 54 | 56 | Map<String, Object> temp = list.get(i); |
| 55 | - | |
| 56 | - String lineString = temp.get("shape").toString(); | |
| 57 | - /*String lineString = "LINESTRING (13532.5305161702 -3677.63275264995, 13433.22401617 -3881.74765264988)";*/ | |
| 58 | - | |
| 57 | + // POINT (8229.30921617 -933.16425265) | |
| 58 | + String lineString = temp.get("descriptions").toString(); | |
| 59 | + int id = Integer.parseInt(temp.get("id").toString()); | |
| 59 | 60 | |
| 60 | 61 | String arrayP[] = lineString.substring(lineString.indexOf("(")+1, lineString.length()-1).split(", "); |
| 61 | - | |
| 62 | - int id = Integer.parseInt(temp.get("id").toString()); | |
| 63 | - String geometry = ""; | |
| 62 | + /*String arrayP[] = lineString.substring(lineString.indexOf("(")+1, lineString.length()-1).split(" "); | |
| 63 | + String b_jwpoints = ""; | |
| 64 | + Float g_lonx=0.0f,g_laty=0.0f,x=0.0f,y=0.0f;*/ | |
| 65 | + | |
| 66 | + /*Double lng = Double.parseDouble(arrayP[0]); | |
| 67 | + Double lat = Double.parseDouble(arrayP[1]); | |
| 68 | + x = Float.parseFloat(arrayP[0]); | |
| 69 | + y = Float.parseFloat(arrayP[1]); | |
| 70 | + // WGS84 | |
| 71 | + Map map_2 = JWDUtil.ConvertSHToJW(lng,lat); | |
| 72 | + g_lonx = Float.parseFloat(map_2.get("x").toString()); | |
| 73 | + g_laty = Float.parseFloat(map_2.get("y").toString()); | |
| 74 | + Location location = TransGPS.LocationMake(Float.parseFloat(map_2.get("x").toString()), Float.parseFloat(map_2.get("y").toString())); | |
| 75 | + location = TransGPS.bd_encrypt(TransGPS.transformFromWGSToGCJ(location)); | |
| 76 | + b_jwpoints = (location.getLng()+0.000727) + " " + (location.getLat() - 0.0000624);*/ | |
| 77 | + //b_jwpoints = (location.getLng()) + " " + (location.getLat()); | |
| 78 | + | |
| 79 | + String csection_vector="",bsection_vector="",gsection_vector=""; | |
| 64 | 80 | |
| 65 | 81 | for(int k =0;k<arrayP.length;k++) { |
| 66 | 82 | |
| ... | ... | @@ -76,28 +92,42 @@ public class SHCJ2BDJW { |
| 76 | 92 | |
| 77 | 93 | location = TransGPS.bd_encrypt(TransGPS.transformFromWGSToGCJ(location)); |
| 78 | 94 | |
| 79 | - if(k==arrayP.length-1) | |
| 80 | - geometry = geometry + (location.getLng()+0.000727) + " " + (location.getLat() - 0.0000624); | |
| 81 | - else | |
| 82 | - geometry = geometry + (location.getLng()+0.000727) + " " + (location.getLat() - 0.0000624) + ","; | |
| 95 | + if(k==arrayP.length-1) { | |
| 96 | + bsection_vector = bsection_vector + (location.getLng()+0.000727) + " " + (location.getLat() - 0.0000624); | |
| 97 | + csection_vector = csection_vector + arrayXY[0] + " " + arrayXY[1]; | |
| 98 | + gsection_vector = gsection_vector + map_2.get("x").toString() + " " + map_2.get("y").toString(); | |
| 99 | + }else { | |
| 100 | + bsection_vector = bsection_vector + (location.getLng()+0.000727) + " " + (location.getLat() - 0.0000624) + ","; | |
| 101 | + csection_vector = csection_vector + arrayXY[0] + " " + arrayXY[1] +","; | |
| 102 | + gsection_vector = gsection_vector + map_2.get("x").toString() + " " + map_2.get("y").toString()+","; | |
| 103 | + } | |
| 83 | 104 | |
| 84 | 105 | |
| 85 | 106 | } |
| 86 | 107 | |
| 87 | 108 | ps = null; |
| 88 | - | |
| 89 | - geometry = "LINESTRING(" + geometry +")"; | |
| 109 | + bsection_vector = "LINESTRING(" + bsection_vector +")"; | |
| 110 | + csection_vector = "LINESTRING(" + csection_vector +")"; | |
| 111 | + gsection_vector = "LINESTRING(" + gsection_vector +")"; | |
| 90 | 112 | |
| 91 | 113 | ps = conn.prepareStatement(sqlUpdate); |
| 92 | 114 | |
| 93 | - ps.setString(1, geometry); | |
| 94 | - | |
| 95 | - ps.setString(2, lineString); | |
| 96 | - | |
| 97 | - ps.setInt(3, id); | |
| 98 | - | |
| 115 | + // String sqlUpdate = "UPDATE bsth_c_section SET csection_vector = ? , bsection_vector=? , gsection_vector=? where id = ?"; | |
| 116 | + ps.setString(1, csection_vector); | |
| 117 | + ps.setString(2, bsection_vector); | |
| 118 | + ps.setString(3, gsection_vector); | |
| 119 | + ps.setInt(4, id); | |
| 120 | + | |
| 121 | + //int stauts = ps.executeUpdate(); | |
| 122 | + // String sqlUpdate = "UPDATE bsth_c_station SET b_jwpoints = ?1 , g_lonx=?2 , g_laty=?3 , x = ?4 , y = ?5 where id = ?6"; | |
| 123 | + /*ps.setString(1, b_jwpoints); | |
| 124 | + ps.setFloat(2, g_lonx); | |
| 125 | + ps.setFloat(3, g_laty); | |
| 126 | + ps.setFloat(4, x); | |
| 127 | + ps.setFloat(5, y); | |
| 128 | + ps.setFloat(6, id);*/ | |
| 99 | 129 | int stauts = ps.executeUpdate(); |
| 100 | - | |
| 130 | + System.out.println(stauts); | |
| 101 | 131 | } |
| 102 | 132 | |
| 103 | 133 | } catch (SQLException e) { | ... | ... |
src/main/resources/application-dev.properties
| ... | ... | @@ -8,7 +8,7 @@ spring.jpa.hibernate.naming_strategy= org.hibernate.cfg.ImprovedNamingStrategy |
| 8 | 8 | spring.jpa.database= MYSQL |
| 9 | 9 | spring.jpa.show-sql= false |
| 10 | 10 | spring.datasource.driver-class-name= com.mysql.jdbc.Driver |
| 11 | -spring.datasource.url= jdbc:mysql://192.168.168.201/mh_control?useUnicode=true&characterEncoding=utf-8&useSSL=false | |
| 11 | +spring.datasource.url= jdbc:mysql://192.168.168.201:3306/mh_control?useUnicode=true&characterEncoding=utf-8&useSSL=false | |
| 12 | 12 | spring.datasource.username= root |
| 13 | 13 | spring.datasource.password= 123456 |
| 14 | 14 | #DATASOURCE | ... | ... |
src/main/resources/datatools/config-dev.properties
| ... | ... | @@ -48,13 +48,19 @@ datatools.employeesconfig_datainputktr=/datatools/ktrs/employeesConfigDataInput. |
| 48 | 48 | |
| 49 | 49 | # 4、数据导出配置信息 |
| 50 | 50 | # 导出数据文件目录配置(根据不同的环境需要修正) |
| 51 | -datatools.fileoutput_dir=/Users/xu/resource/project/bsth_control_u_d_files | |
| 51 | +datatools.fileoutput_dir=/Users/xu/resource/project_code/runtime_temp/bsth_control_u_d_files | |
| 52 | 52 | |
| 53 | 53 | ##---------------------------- 导出数据ktr -----------------------------## |
| 54 | 54 | # 车辆信息导出ktr转换 |
| 55 | 55 | datatools.cars_dataoutputktr=/datatools/ktrs/carsDataOutput.ktr |
| 56 | 56 | # 人员信息导出ktr转换 |
| 57 | 57 | datatools.employees_dataoutputktr=/datatools/ktrs/employeesDataOutput.ktr |
| 58 | +# 时刻表导出元数据ktr转换 | |
| 59 | +datatools.ttinfodetail_metaoutput=/datatools/ktrs/ttinfodetailDataOutputMetaData.ktr | |
| 60 | +# 时刻表导出数据ktr转换 | |
| 61 | +datatools.ttinfodetail_output=/datatools/ktrs/ttinfodetailDataOutput.ktr | |
| 62 | + | |
| 63 | + | |
| 58 | 64 | |
| 59 | 65 | # TODO: |
| 60 | 66 | ... | ... |
src/main/resources/datatools/config-prod.properties
| ... | ... | @@ -56,5 +56,9 @@ datatools.fileoutput_dir=/opt/bsth_control_u_d_files |
| 56 | 56 | datatools.cars_dataoutputktr=/datatools/ktrs/carsDataOutput.ktr |
| 57 | 57 | # 人员信息导出ktr转换 |
| 58 | 58 | datatools.employees_dataoutputktr=/datatools/ktrs/employeesDataOutput.ktr |
| 59 | +# 时刻表导出元数据ktr转换 | |
| 60 | +datatools.ttinfodetail_metaoutput=/datatools/ktrs/ttinfodetailDataOutputMetaData.ktr | |
| 61 | +# 时刻表导出数据ktr转换 | |
| 62 | +datatools.ttinfodetail_output=/datatools/ktrs/ttinfodetailDataOutput.ktr | |
| 59 | 63 | |
| 60 | 64 | # TODO: |
| 61 | 65 | \ No newline at end of file | ... | ... |