Commit 04cc4d9d773cfcc3236f95dfe9119fa7e5cbdb6a
Merge branch 'minhang' of 192.168.168.201:panzhaov5/bsth_control into minhang
Showing
20 changed files
with
797 additions
and
386 deletions
Too many changes to show.
To preserve performance only 20 of 54 files are displayed.
src/main/java/com/bsth/controller/BaseController2.java
| ... | ... | @@ -5,10 +5,13 @@ import com.bsth.common.ResponseCode; |
| 5 | 5 | import com.bsth.service.BaseService; |
| 6 | 6 | import com.bsth.service.schedule.utils.DataImportExportService; |
| 7 | 7 | import com.google.common.base.Splitter; |
| 8 | +import jxl.Sheet; | |
| 9 | +import jxl.Workbook; | |
| 8 | 10 | import org.springframework.beans.factory.annotation.Autowired; |
| 9 | 11 | import org.springframework.data.domain.Page; |
| 10 | 12 | import org.springframework.data.domain.PageRequest; |
| 11 | 13 | import org.springframework.data.domain.Sort; |
| 14 | +import org.springframework.util.CollectionUtils; | |
| 12 | 15 | import org.springframework.web.bind.annotation.*; |
| 13 | 16 | import org.springframework.web.multipart.MultipartFile; |
| 14 | 17 | |
| ... | ... | @@ -164,11 +167,24 @@ public class BaseController2<T, ID extends Serializable> { |
| 164 | 167 | */ |
| 165 | 168 | @RequestMapping(value = "/dataExport", method = RequestMethod.GET) |
| 166 | 169 | public void dataExport(HttpServletResponse response) throws Exception { |
| 170 | + dataExport(response, null); | |
| 171 | + } | |
| 172 | + | |
| 173 | + @RequestMapping(value = "/dataExportExt", method = RequestMethod.GET) | |
| 174 | + public void dataExport(HttpServletResponse response, @RequestParam Map<String, Object> param) throws Exception { | |
| 167 | 175 | // 1、使用ktr转换获取输出文件 |
| 168 | 176 | File ktrfile = new File(this.getClass().getResource(getDataExportKtrClasspath()).toURI()); |
| 169 | - File outputfile = dataImportExportService.fileDataOutput( | |
| 170 | - getDataExportFilename(), | |
| 171 | - ktrfile); | |
| 177 | + File outputfile = null; | |
| 178 | + if (!CollectionUtils.isEmpty(param)) { | |
| 179 | + outputfile = dataImportExportService.fileDataOutput( | |
| 180 | + getDataExportFilename(), | |
| 181 | + ktrfile, | |
| 182 | + param); | |
| 183 | + } else { | |
| 184 | + outputfile = dataImportExportService.fileDataOutput( | |
| 185 | + getDataExportFilename(), | |
| 186 | + ktrfile); | |
| 187 | + } | |
| 172 | 188 | |
| 173 | 189 | System.out.println(outputfile.getName()); |
| 174 | 190 | String filePath = outputfile.getAbsolutePath(); |
| ... | ... | @@ -225,4 +241,52 @@ public class BaseController2<T, ID extends Serializable> { |
| 225 | 241 | throw new RuntimeException("必须override,并指定ktr classpath"); |
| 226 | 242 | } |
| 227 | 243 | |
| 244 | + | |
| 245 | + public static class ExcelFileOutput { | |
| 246 | + private String fileName; | |
| 247 | + private List<Map<String, Object>> sheetnames = new ArrayList<>(); | |
| 248 | + | |
| 249 | + public String getFileName() { | |
| 250 | + return fileName; | |
| 251 | + } | |
| 252 | + | |
| 253 | + public void setFileName(String fileName) { | |
| 254 | + this.fileName = fileName; | |
| 255 | + } | |
| 256 | + | |
| 257 | + public List<Map<String, Object>> getSheetnames() { | |
| 258 | + return sheetnames; | |
| 259 | + } | |
| 260 | + | |
| 261 | + public void setSheetnames(List<Map<String, Object>> sheetnames) { | |
| 262 | + this.sheetnames = sheetnames; | |
| 263 | + } | |
| 264 | + } | |
| 265 | + | |
| 266 | + /** | |
| 267 | + * 上传Excel文件,返回文件全路径名,工作区名称列表。 | |
| 268 | + * @param file | |
| 269 | + * @return | |
| 270 | + * @throws Exception | |
| 271 | + */ | |
| 272 | + @RequestMapping(value = "/uploadFile", method = RequestMethod.POST) | |
| 273 | + public ExcelFileOutput fileUpload(MultipartFile file) throws Exception { | |
| 274 | + // 返回对象 | |
| 275 | + ExcelFileOutput rs = new ExcelFileOutput(); | |
| 276 | + | |
| 277 | + // 上传文件 | |
| 278 | + File file1 = dataImportExportService.uploadFile(file); | |
| 279 | + // 获取文件的sheet | |
| 280 | + Workbook book = Workbook.getWorkbook(file1); | |
| 281 | + for (Sheet sheet : book.getSheets()) { | |
| 282 | + String sheetname = sheet.getName(); | |
| 283 | + Map<String, Object> s = new HashMap<>(); | |
| 284 | + s.put("name", sheetname); | |
| 285 | + rs.getSheetnames().add(s); | |
| 286 | + } | |
| 287 | + | |
| 288 | + rs.setFileName(file1.getAbsolutePath()); | |
| 289 | + return rs; | |
| 290 | + } | |
| 291 | + | |
| 228 | 292 | } | ... | ... |
src/main/java/com/bsth/controller/CarsController.java
| 1 | 1 | package com.bsth.controller; |
| 2 | 2 | |
| 3 | +import com.bsth.common.ResponseCode; | |
| 3 | 4 | import com.bsth.entity.Cars; |
| 5 | +import com.bsth.service.schedule.utils.DataImportExportService; | |
| 4 | 6 | import com.bsth.service.schedule.utils.DataToolsProperties; |
| 5 | 7 | import org.springframework.beans.factory.annotation.Autowired; |
| 6 | 8 | import org.springframework.boot.context.properties.EnableConfigurationProperties; |
| 7 | -import org.springframework.web.bind.annotation.*; | |
| 9 | +import org.springframework.web.bind.annotation.RequestMapping; | |
| 10 | +import org.springframework.web.bind.annotation.RequestMethod; | |
| 11 | +import org.springframework.web.bind.annotation.RequestParam; | |
| 12 | +import org.springframework.web.bind.annotation.RestController; | |
| 8 | 13 | |
| 14 | +import java.io.File; | |
| 15 | +import java.util.HashMap; | |
| 9 | 16 | import java.util.Map; |
| 10 | 17 | |
| 11 | 18 | /** |
| ... | ... | @@ -14,24 +21,12 @@ import java.util.Map; |
| 14 | 21 | @RestController |
| 15 | 22 | @RequestMapping("cars") |
| 16 | 23 | @EnableConfigurationProperties(DataToolsProperties.class) |
| 17 | -public class CarsController extends BaseController<Cars, Integer> { | |
| 24 | +public class CarsController extends BaseController2<Cars, Integer> { | |
| 18 | 25 | |
| 19 | 26 | @Autowired |
| 20 | 27 | private DataToolsProperties dataToolsProperties; |
| 21 | - | |
| 22 | - /** | |
| 23 | - * 覆写方法,因为form提交的方式参数不全,改用 json形式提交 @RequestBody | |
| 24 | - * @Title: save | |
| 25 | - * @Description: TODO(持久化对象) | |
| 26 | - * @param @param t | |
| 27 | - * @param @return 设定文件 | |
| 28 | - * @return Map<String,Object> {status: 1(成功),-1(失败)} | |
| 29 | - * @throws | |
| 30 | - */ | |
| 31 | - @RequestMapping(method = RequestMethod.POST) | |
| 32 | - public Map<String, Object> save(@RequestBody Cars t){ | |
| 33 | - return baseService.save(t); | |
| 34 | - } | |
| 28 | + @Autowired | |
| 29 | + private DataImportExportService dataImportExportService; | |
| 35 | 30 | |
| 36 | 31 | /** |
| 37 | 32 | * 验证。 |
| ... | ... | @@ -44,6 +39,48 @@ public class CarsController extends BaseController<Cars, Integer> { |
| 44 | 39 | return baseService.validateEquale(map); |
| 45 | 40 | } |
| 46 | 41 | |
| 42 | + // uploadFile post | |
| 43 | + | |
| 44 | + // 验证excel sheet | |
| 45 | + @RequestMapping(value = "/validate/sheet", method = RequestMethod.GET) | |
| 46 | + public Map<String, Object> validateSheet() throws Exception { | |
| 47 | + Map<String, Object> rtn = new HashMap<>(); | |
| 48 | + | |
| 49 | + // TODO: | |
| 50 | + | |
| 51 | + rtn.put("status", ResponseCode.SUCCESS); | |
| 52 | + return rtn; | |
| 53 | + } | |
| 54 | + | |
| 55 | + @RequestMapping(value = "/importfile", method = RequestMethod.POST) | |
| 56 | + public Map<String, Object> importData( | |
| 57 | + @RequestParam Map<String, Object> form) | |
| 58 | + throws Exception { | |
| 59 | + Map<String, Object> rtn = new HashMap<>(); | |
| 60 | + | |
| 61 | + // TODO: | |
| 62 | + String filename = (String) form.get("filename"); | |
| 63 | + | |
| 64 | + | |
| 65 | + try { | |
| 66 | + // 获取ktr转换文件绝对路径 | |
| 67 | + File ktrfile = new File(this.getClass().getResource(getDataImportKtrClasspath()).toURI()); | |
| 68 | + System.out.println(ktrfile.getAbsolutePath()); | |
| 69 | + // 导入数据 | |
| 70 | + dataImportExportService.fileDataImport(new File(filename), ktrfile); | |
| 71 | + | |
| 72 | + rtn.put("status", ResponseCode.SUCCESS); | |
| 73 | + rtn.put("msg", "导入成功"); | |
| 74 | + } catch (Exception exp) { | |
| 75 | + exp.printStackTrace(); | |
| 76 | + rtn.put("status", ResponseCode.ERROR); | |
| 77 | + rtn.put("msg", exp.getLocalizedMessage()); | |
| 78 | + } | |
| 79 | + | |
| 80 | + return rtn; | |
| 81 | + } | |
| 82 | + | |
| 83 | + | |
| 47 | 84 | @Override |
| 48 | 85 | protected String getDataImportKtrClasspath() { |
| 49 | 86 | return dataToolsProperties.getCarsDatainputktr(); | ... | ... |
src/main/java/com/bsth/controller/realcontrol/RealMapController.java
0 → 100644
| 1 | +package com.bsth.controller.realcontrol; | |
| 2 | + | |
| 3 | +import com.bsth.service.realcontrol.RealMapService; | |
| 4 | +import org.springframework.beans.factory.annotation.Autowired; | |
| 5 | +import org.springframework.web.bind.annotation.RequestMapping; | |
| 6 | +import org.springframework.web.bind.annotation.RequestParam; | |
| 7 | +import org.springframework.web.bind.annotation.RestController; | |
| 8 | + | |
| 9 | +import java.util.Map; | |
| 10 | + | |
| 11 | +/** | |
| 12 | + * 线调 地图监控相关 | |
| 13 | + * Created by panzhao on 2016/11/23. | |
| 14 | + */ | |
| 15 | +@RestController | |
| 16 | +@RequestMapping("realMap") | |
| 17 | +public class RealMapController { | |
| 18 | + | |
| 19 | + @Autowired | |
| 20 | + RealMapService realMapService; | |
| 21 | + | |
| 22 | + /** | |
| 23 | + * 根据线路获取站点路由及空间数据 | |
| 24 | + */ | |
| 25 | + @RequestMapping(value = "/stationSpatialData") | |
| 26 | + public Map<String, Object> stationSpatialData(@RequestParam String idx){ | |
| 27 | + return realMapService.stationSpatialData(idx); | |
| 28 | + } | |
| 29 | +} | ... | ... |
src/main/java/com/bsth/controller/realcontrol/ScheduleRealInfoController.java
| 1 | 1 | package com.bsth.controller.realcontrol; |
| 2 | 2 | |
| 3 | -import java.io.UnsupportedEncodingException; | |
| 4 | -import java.net.URLDecoder; | |
| 5 | -import java.util.*; | |
| 6 | - | |
| 7 | -import org.apache.commons.lang3.StringEscapeUtils; | |
| 8 | -import org.drools.core.runtime.help.impl.XStreamJSon.JSonAbortWorkItemConverter; | |
| 9 | -import org.joda.time.format.DateTimeFormat; | |
| 10 | -import org.joda.time.format.DateTimeFormatter; | |
| 11 | -import org.springframework.beans.factory.annotation.Autowired; | |
| 12 | -import org.springframework.web.bind.annotation.PathVariable; | |
| 13 | -import org.springframework.web.bind.annotation.RequestMapping; | |
| 14 | -import org.springframework.web.bind.annotation.RequestMethod; | |
| 15 | -import org.springframework.web.bind.annotation.RequestParam; | |
| 16 | -import org.springframework.web.bind.annotation.RestController; | |
| 17 | - | |
| 18 | -import com.alibaba.fastjson.JSON; | |
| 19 | 3 | import com.alibaba.fastjson.JSONArray; |
| 20 | 4 | import com.bsth.controller.BaseController; |
| 21 | 5 | import com.bsth.controller.realcontrol.dto.ChangePersonCar; |
| ... | ... | @@ -23,9 +7,14 @@ import com.bsth.controller.realcontrol.dto.DfsjChange; |
| 23 | 7 | import com.bsth.data.BasicData; |
| 24 | 8 | import com.bsth.data.schedule.DayOfSchedule; |
| 25 | 9 | import com.bsth.entity.realcontrol.ScheduleRealInfo; |
| 26 | -import com.bsth.security.util.SecurityUtils; | |
| 27 | 10 | import com.bsth.service.realcontrol.ScheduleRealInfoService; |
| 28 | -import com.google.common.base.Splitter; | |
| 11 | +import org.apache.commons.lang3.StringEscapeUtils; | |
| 12 | +import org.joda.time.format.DateTimeFormat; | |
| 13 | +import org.joda.time.format.DateTimeFormatter; | |
| 14 | +import org.springframework.beans.factory.annotation.Autowired; | |
| 15 | +import org.springframework.web.bind.annotation.*; | |
| 16 | + | |
| 17 | +import java.util.*; | |
| 29 | 18 | |
| 30 | 19 | @RestController |
| 31 | 20 | @RequestMapping("/realSchedule") | ... | ... |
src/main/java/com/bsth/controller/realcontrol/dto/StationSpatialData.java
0 → 100644
| 1 | +package com.bsth.controller.realcontrol.dto; | |
| 2 | + | |
| 3 | +/** | |
| 4 | + * Created by panzhao on 2016/11/23. | |
| 5 | + */ | |
| 6 | +public class StationSpatialData { | |
| 7 | + | |
| 8 | + private String lineCode; | |
| 9 | + | |
| 10 | + private String stationName; | |
| 11 | + | |
| 12 | + private String stationCode; | |
| 13 | + | |
| 14 | + private String stationMark; | |
| 15 | + | |
| 16 | + private int directions; | |
| 17 | + | |
| 18 | + private Float distances; | |
| 19 | + | |
| 20 | + private Float toTime; | |
| 21 | + | |
| 22 | + private Integer versions; | |
| 23 | + | |
| 24 | + private Float gLonx; | |
| 25 | + | |
| 26 | + private Float gLaty; | |
| 27 | + | |
| 28 | + private Float radius; | |
| 29 | + | |
| 30 | + private String shapesType; | |
| 31 | + | |
| 32 | + private String gPolygonGrid; | |
| 33 | + | |
| 34 | + private Integer stationRouteCode; | |
| 35 | + | |
| 36 | + public String getLineCode() { | |
| 37 | + return lineCode; | |
| 38 | + } | |
| 39 | + | |
| 40 | + public void setLineCode(String lineCode) { | |
| 41 | + this.lineCode = lineCode; | |
| 42 | + } | |
| 43 | + | |
| 44 | + public String getStationName() { | |
| 45 | + return stationName; | |
| 46 | + } | |
| 47 | + | |
| 48 | + public void setStationName(String stationName) { | |
| 49 | + this.stationName = stationName; | |
| 50 | + } | |
| 51 | + | |
| 52 | + public String getStationCode() { | |
| 53 | + return stationCode; | |
| 54 | + } | |
| 55 | + | |
| 56 | + public void setStationCode(String stationCode) { | |
| 57 | + this.stationCode = stationCode; | |
| 58 | + } | |
| 59 | + | |
| 60 | + public String getStationMark() { | |
| 61 | + return stationMark; | |
| 62 | + } | |
| 63 | + | |
| 64 | + public void setStationMark(String stationMark) { | |
| 65 | + this.stationMark = stationMark; | |
| 66 | + } | |
| 67 | + | |
| 68 | + public int getDirections() { | |
| 69 | + return directions; | |
| 70 | + } | |
| 71 | + | |
| 72 | + public void setDirections(int directions) { | |
| 73 | + this.directions = directions; | |
| 74 | + } | |
| 75 | + | |
| 76 | + public Float getDistances() { | |
| 77 | + return distances; | |
| 78 | + } | |
| 79 | + | |
| 80 | + public void setDistances(Float distances) { | |
| 81 | + this.distances = distances; | |
| 82 | + } | |
| 83 | + | |
| 84 | + public Float getToTime() { | |
| 85 | + return toTime; | |
| 86 | + } | |
| 87 | + | |
| 88 | + public void setToTime(Float toTime) { | |
| 89 | + this.toTime = toTime; | |
| 90 | + } | |
| 91 | + | |
| 92 | + public Integer getVersions() { | |
| 93 | + return versions; | |
| 94 | + } | |
| 95 | + | |
| 96 | + public void setVersions(Integer versions) { | |
| 97 | + this.versions = versions; | |
| 98 | + } | |
| 99 | + | |
| 100 | + public Float getgLonx() { | |
| 101 | + return gLonx; | |
| 102 | + } | |
| 103 | + | |
| 104 | + public void setgLonx(Float gLonx) { | |
| 105 | + this.gLonx = gLonx; | |
| 106 | + } | |
| 107 | + | |
| 108 | + public Float getgLaty() { | |
| 109 | + return gLaty; | |
| 110 | + } | |
| 111 | + | |
| 112 | + public void setgLaty(Float gLaty) { | |
| 113 | + this.gLaty = gLaty; | |
| 114 | + } | |
| 115 | + | |
| 116 | + public Float getRadius() { | |
| 117 | + return radius; | |
| 118 | + } | |
| 119 | + | |
| 120 | + public void setRadius(Float radius) { | |
| 121 | + this.radius = radius; | |
| 122 | + } | |
| 123 | + | |
| 124 | + public String getShapesType() { | |
| 125 | + return shapesType; | |
| 126 | + } | |
| 127 | + | |
| 128 | + public void setShapesType(String shapesType) { | |
| 129 | + this.shapesType = shapesType; | |
| 130 | + } | |
| 131 | + | |
| 132 | + public String getgPolygonGrid() { | |
| 133 | + return gPolygonGrid; | |
| 134 | + } | |
| 135 | + | |
| 136 | + public void setgPolygonGrid(String gPolygonGrid) { | |
| 137 | + this.gPolygonGrid = gPolygonGrid; | |
| 138 | + } | |
| 139 | + | |
| 140 | + public Integer getStationRouteCode() { | |
| 141 | + return stationRouteCode; | |
| 142 | + } | |
| 143 | + | |
| 144 | + public void setStationRouteCode(Integer stationRouteCode) { | |
| 145 | + this.stationRouteCode = stationRouteCode; | |
| 146 | + } | |
| 147 | +} | ... | ... |
src/main/java/com/bsth/controller/schedule/TTInfoDetailController.java
| 1 | 1 | package com.bsth.controller.schedule; |
| 2 | 2 | |
| 3 | 3 | import com.bsth.common.ResponseCode; |
| 4 | -import com.bsth.controller.BaseController; | |
| 4 | +import com.bsth.controller.BaseController2; | |
| 5 | 5 | import com.bsth.entity.CarPark; |
| 6 | 6 | import com.bsth.entity.LineInformation; |
| 7 | 7 | import com.bsth.entity.StationRoute; |
| ... | ... | @@ -38,7 +38,7 @@ import java.util.regex.Pattern; |
| 38 | 38 | */ |
| 39 | 39 | @RestController |
| 40 | 40 | @RequestMapping("tidc") |
| 41 | -public class TTInfoDetailController extends BaseController<TTInfoDetail, Long> { | |
| 41 | +public class TTInfoDetailController extends BaseController2<TTInfoDetail, Long> { | |
| 42 | 42 | @Autowired |
| 43 | 43 | private TTInfoDetailService ttInfoDetailService; |
| 44 | 44 | @Autowired |
| ... | ... | @@ -56,53 +56,13 @@ public class TTInfoDetailController extends BaseController<TTInfoDetail, Long> { |
| 56 | 56 | @Autowired |
| 57 | 57 | private DataToolsProperties dataToolsProperties; |
| 58 | 58 | |
| 59 | - | |
| 60 | - public static class ExcelFileOutput { | |
| 61 | - private String fileName; | |
| 62 | - private List<Map<String, Object>> sheetnames = new ArrayList<>(); | |
| 63 | - | |
| 64 | - public String getFileName() { | |
| 65 | - return fileName; | |
| 66 | - } | |
| 67 | - | |
| 68 | - public void setFileName(String fileName) { | |
| 69 | - this.fileName = fileName; | |
| 70 | - } | |
| 71 | - | |
| 72 | - public List<Map<String, Object>> getSheetnames() { | |
| 73 | - return sheetnames; | |
| 74 | - } | |
| 75 | - | |
| 76 | - public void setSheetnames(List<Map<String, Object>> sheetnames) { | |
| 77 | - this.sheetnames = sheetnames; | |
| 78 | - } | |
| 79 | - } | |
| 80 | - | |
| 81 | 59 | /** |
| 82 | 60 | * 1、上传Excel文件,返回文件全路径名,工作区名称列表。 |
| 83 | 61 | * @param file |
| 84 | 62 | * @return |
| 85 | 63 | * @throws Exception |
| 86 | 64 | */ |
| 87 | - @RequestMapping(value = "/uploadFile", method = RequestMethod.POST) | |
| 88 | - public ExcelFileOutput fileUpload(MultipartFile file) throws Exception { | |
| 89 | - // 返回对象 | |
| 90 | - ExcelFileOutput rs = new ExcelFileOutput(); | |
| 91 | - | |
| 92 | - // 上传文件 | |
| 93 | - File file1 = dataImportExportService.uploadFile(file); | |
| 94 | - // 获取文件的sheet | |
| 95 | - Workbook book = Workbook.getWorkbook(file1); | |
| 96 | - for (Sheet sheet : book.getSheets()) { | |
| 97 | - String sheetname = sheet.getName(); | |
| 98 | - Map<String, Object> s = new HashMap<>(); | |
| 99 | - s.put("name", sheetname); | |
| 100 | - rs.getSheetnames().add(s); | |
| 101 | - } | |
| 102 | 65 | |
| 103 | - rs.setFileName(file1.getAbsolutePath()); | |
| 104 | - return rs; | |
| 105 | - } | |
| 106 | 66 | |
| 107 | 67 | /** |
| 108 | 68 | * 2、验证sheet(以后放到规则引擎里去做)。 |
| ... | ... | @@ -441,21 +401,6 @@ public class TTInfoDetailController extends BaseController<TTInfoDetail, Long> { |
| 441 | 401 | return ttInfoDetailService.getEditInfo(xlid, ttid); |
| 442 | 402 | } |
| 443 | 403 | |
| 444 | - /** | |
| 445 | - * 覆写方法,因为form提交的方式参数不全,改用 json形式提交 @RequestBody | |
| 446 | - * @Title: save | |
| 447 | - * @Description: TODO(持久化对象) | |
| 448 | - * @param @param t | |
| 449 | - * @param @return 设定文件 | |
| 450 | - * @return Map<String,Object> {status: 1(成功),-1(失败)} | |
| 451 | - * @throws | |
| 452 | - */ | |
| 453 | - @RequestMapping(method = RequestMethod.POST) | |
| 454 | - public Map<String, Object> save(@RequestBody TTInfoDetail t){ | |
| 455 | - | |
| 456 | - return baseService.save(t); | |
| 457 | - } | |
| 458 | - | |
| 459 | 404 | @Override |
| 460 | 405 | public TTInfoDetail findById(@PathVariable("id") Long aLong) { |
| 461 | 406 | return ttInfoDetailRepository.findOneExtend(aLong); | ... | ... |
src/main/java/com/bsth/controller/sys/CompanyAuthorityController.java
| 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 | -} | |
| 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/dto/CompanyData.java
| 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 | -} | |
| 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/entity/realcontrol/ScheduleRealInfo.java
| ... | ... | @@ -2,13 +2,11 @@ package com.bsth.entity.realcontrol; |
| 2 | 2 | |
| 3 | 3 | import com.bsth.entity.sys.SysUser; |
| 4 | 4 | import com.fasterxml.jackson.annotation.JsonIgnore; |
| 5 | - | |
| 6 | -import javax.persistence.*; | |
| 7 | - | |
| 8 | 5 | import org.apache.commons.lang3.StringUtils; |
| 9 | 6 | import org.joda.time.format.DateTimeFormat; |
| 10 | 7 | import org.joda.time.format.DateTimeFormatter; |
| 11 | 8 | |
| 9 | +import javax.persistence.*; | |
| 12 | 10 | import java.util.Date; |
| 13 | 11 | import java.util.HashSet; |
| 14 | 12 | import java.util.Set; |
| ... | ... | @@ -177,8 +175,116 @@ public class ScheduleRealInfo { |
| 177 | 175 | /** 子任务 */ |
| 178 | 176 | @OneToMany(fetch = FetchType.LAZY/*, cascade = CascadeType.ALL*/) |
| 179 | 177 | private Set<ChildTaskPlan> cTasks = new HashSet<>(); |
| 180 | - | |
| 181 | - /** ---------------- | |
| 178 | + | |
| 179 | + /** 关联的公司名称 */ | |
| 180 | + private String gsName; | |
| 181 | + /** 关联的公司编码 */ | |
| 182 | + private String gsBm; | |
| 183 | + /** 关联的分公司名称 */ | |
| 184 | + private String fgsName; | |
| 185 | + /** 关联的分公司编码 */ | |
| 186 | + private String fgsBm; | |
| 187 | + /** 出场顺序号 */ | |
| 188 | + private Integer ccno; | |
| 189 | + | |
| 190 | + //待发调试(是否自动调整) | |
| 191 | + private boolean dfAuto; | |
| 192 | + //是否有GPS信号 | |
| 193 | + private boolean online; | |
| 194 | + | |
| 195 | + public boolean isDfAuto() { | |
| 196 | + return dfAuto; | |
| 197 | + } | |
| 198 | + | |
| 199 | + public void setDfAuto(boolean dfAuto) { | |
| 200 | + this.dfAuto = dfAuto; | |
| 201 | + } | |
| 202 | + | |
| 203 | + public boolean isOnline() { | |
| 204 | + return online; | |
| 205 | + } | |
| 206 | + | |
| 207 | + public void setOnline(boolean online) { | |
| 208 | + this.online = online; | |
| 209 | + } | |
| 210 | + | |
| 211 | + public String getQdzArrDatejh() { | |
| 212 | + return qdzArrDatejh; | |
| 213 | + } | |
| 214 | + | |
| 215 | + public void setQdzArrDatejh(String qdzArrDatejh) { | |
| 216 | + this.qdzArrDatejh = qdzArrDatejh; | |
| 217 | + } | |
| 218 | + | |
| 219 | + public String getQdzArrDatesj() { | |
| 220 | + return qdzArrDatesj; | |
| 221 | + } | |
| 222 | + | |
| 223 | + public void setQdzArrDatesj(String qdzArrDatesj) { | |
| 224 | + this.qdzArrDatesj = qdzArrDatesj; | |
| 225 | + } | |
| 226 | + | |
| 227 | + public void setcTasks(Set<ChildTaskPlan> cTasks) { | |
| 228 | + this.cTasks = cTasks; | |
| 229 | + } | |
| 230 | + | |
| 231 | + public String getGsName() { | |
| 232 | + return gsName; | |
| 233 | + } | |
| 234 | + | |
| 235 | + public void setGsName(String gsName) { | |
| 236 | + this.gsName = gsName; | |
| 237 | + } | |
| 238 | + | |
| 239 | + public String getGsBm() { | |
| 240 | + return gsBm; | |
| 241 | + } | |
| 242 | + | |
| 243 | + public void setGsBm(String gsBm) { | |
| 244 | + this.gsBm = gsBm; | |
| 245 | + } | |
| 246 | + | |
| 247 | + public String getFgsName() { | |
| 248 | + return fgsName; | |
| 249 | + } | |
| 250 | + | |
| 251 | + public void setFgsName(String fgsName) { | |
| 252 | + this.fgsName = fgsName; | |
| 253 | + } | |
| 254 | + | |
| 255 | + public String getFgsBm() { | |
| 256 | + return fgsBm; | |
| 257 | + } | |
| 258 | + | |
| 259 | + public void setFgsBm(String fgsBm) { | |
| 260 | + this.fgsBm = fgsBm; | |
| 261 | + } | |
| 262 | + | |
| 263 | + public Integer getCcno() { | |
| 264 | + return ccno; | |
| 265 | + } | |
| 266 | + | |
| 267 | + public void setCcno(Integer ccno) { | |
| 268 | + this.ccno = ccno; | |
| 269 | + } | |
| 270 | + | |
| 271 | + public static DateTimeFormatter getFmtHHmm() { | |
| 272 | + return fmtHHmm; | |
| 273 | + } | |
| 274 | + | |
| 275 | + public static void setFmtHHmm(DateTimeFormatter fmtHHmm) { | |
| 276 | + ScheduleRealInfo.fmtHHmm = fmtHHmm; | |
| 277 | + } | |
| 278 | + | |
| 279 | + public static DateTimeFormatter getFmtyyyyMMddHHmm() { | |
| 280 | + return fmtyyyyMMddHHmm; | |
| 281 | + } | |
| 282 | + | |
| 283 | + public static void setFmtyyyyMMddHHmm(DateTimeFormatter fmtyyyyMMddHHmm) { | |
| 284 | + ScheduleRealInfo.fmtyyyyMMddHHmm = fmtyyyyMMddHHmm; | |
| 285 | + } | |
| 286 | + | |
| 287 | + /** ---------------- | |
| 182 | 288 | @OneToOne(fetch = FetchType.LAZY, cascade = CascadeType.ALL) |
| 183 | 289 | private RealTimeModel sjfcModel; |
| 184 | 290 | @OneToOne(fetch = FetchType.LAZY, cascade = CascadeType.ALL) | ... | ... |
src/main/java/com/bsth/entity/sys/CompanyAuthority.java
| 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 | -} | |
| 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/repository/realcontrol/ScheduleRealInfoRepository.java
| ... | ... | @@ -37,14 +37,14 @@ public interface ScheduleRealInfoRepository extends BaseRepository<ScheduleRealI |
| 37 | 37 | @Query(value="SELECT r.xl_name,r.lp_name,r.cl_zbh,d.sender,d.timestamp," |
| 38 | 38 | + " d.txt_content FROM bsth_c_s_sp_info_real r RIGHT JOIN bsth_v_directive_60 " |
| 39 | 39 | + "d ON r.id = d.sch WHERE d.is_dispatch = 1 AND r.xl_bm like %?1% AND " |
| 40 | - + "r.schedule_date like %?2% and r.cl_zbh like %?3% order by d.timestamp",nativeQuery=true) | |
| 40 | + + " DATE_FORMAT(r.schedule_date,'%Y-%m-%d') = ?2 and r.cl_zbh like %?3% order by d.timestamp",nativeQuery=true) | |
| 41 | 41 | List<Object[]> historyMessage(String line,String date,String code); |
| 42 | 42 | |
| 43 | 43 | @Query(value="SELECT r.xl_name,r.lp_name,r.cl_zbh,count(*) as cs " |
| 44 | 44 | + " FROM bsth_c_s_sp_info_real r RIGHT JOIN bsth_v_directive_60 d " |
| 45 | 45 | + " ON r.id = d.sch WHERE d.is_dispatch = 1 AND r.xl_bm like %?1% AND " |
| 46 | - + " r.schedule_date like %?2% and r.cl_zbh like %?3% group by " | |
| 47 | - + " lp_name,xl_name,cl_zbh order by d.timestamp",nativeQuery=true) | |
| 46 | + + " DATE_FORMAT(r.schedule_date,'%Y-%m-%d') = ?2 and r.cl_zbh like %?3% group by " | |
| 47 | + + " lp_name,xl_name,cl_zbh",nativeQuery=true) | |
| 48 | 48 | List<Object[]> historyMessageCount(String line,String date,String code); |
| 49 | 49 | |
| 50 | 50 | @Query(value = "select max(id) from ScheduleRealInfo") | ... | ... |
src/main/java/com/bsth/repository/sys/CompanyAuthorityRepository.java
| 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 | -} | |
| 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/service/realcontrol/RealMapService.java
0 → 100644
src/main/java/com/bsth/service/realcontrol/impl/RealMapServiceImpl.java
0 → 100644
| 1 | +package com.bsth.service.realcontrol.impl; | |
| 2 | + | |
| 3 | +import com.bsth.common.ResponseCode; | |
| 4 | +import com.bsth.controller.realcontrol.dto.StationSpatialData; | |
| 5 | +import com.bsth.service.realcontrol.RealMapService; | |
| 6 | +import com.google.common.base.Splitter; | |
| 7 | +import org.slf4j.Logger; | |
| 8 | +import org.slf4j.LoggerFactory; | |
| 9 | +import org.springframework.beans.factory.annotation.Autowired; | |
| 10 | +import org.springframework.jdbc.core.BeanPropertyRowMapper; | |
| 11 | +import org.springframework.jdbc.core.JdbcTemplate; | |
| 12 | +import org.springframework.stereotype.Service; | |
| 13 | + | |
| 14 | +import java.util.HashMap; | |
| 15 | +import java.util.List; | |
| 16 | +import java.util.Map; | |
| 17 | + | |
| 18 | +/** | |
| 19 | + * Created by panzhao on 2016/11/23. | |
| 20 | + */ | |
| 21 | +@Service | |
| 22 | +public class RealMapServiceImpl implements RealMapService { | |
| 23 | + | |
| 24 | + @Autowired | |
| 25 | + JdbcTemplate jdbcTemplate; | |
| 26 | + | |
| 27 | + Logger logger = LoggerFactory.getLogger(this.getClass()); | |
| 28 | + | |
| 29 | + @Override | |
| 30 | + public Map<String, Object> stationSpatialData(String idx) { | |
| 31 | + Map<String, Object> rs = new HashMap(); | |
| 32 | + | |
| 33 | + try { | |
| 34 | + List<String> idArray = Splitter.on(",").splitToList(idx); | |
| 35 | + //拼接in语句 | |
| 36 | + String inStr = ""; | |
| 37 | + for (String code : idArray) { | |
| 38 | + inStr += (",'" + code+"'"); | |
| 39 | + } | |
| 40 | + inStr = " (" + inStr.substring(1) + ")"; | |
| 41 | + | |
| 42 | + String sql = "select R.LINE_CODE,R.STATION_NAME,R.STATION_CODE,R.STATION_MARK,R.DIRECTIONS,R.DISTANCES,R.TO_TIME, R.VERSIONS,S.G_LONX,S.G_LATY,S.RADIUS,S.SHAPES_TYPE,ST_AsText(S.G_POLYGON_GRID) as G_POLYGON_GRID, R.STATION_ROUTE_CODE from bsth_c_stationroute r inner join bsth_c_station s on r.station=s.id where r.line_code in "+inStr+" and r.destroy=0"; | |
| 43 | + | |
| 44 | + List<StationSpatialData> list = jdbcTemplate.query(sql,new BeanPropertyRowMapper(StationSpatialData.class)); | |
| 45 | + rs.put("status", ResponseCode.SUCCESS); | |
| 46 | + rs.put("list", list); | |
| 47 | + } catch (Exception e) { | |
| 48 | + logger.error("", e); | |
| 49 | + rs.put("status", ResponseCode.ERROR); | |
| 50 | + rs.put("msg", "查询站点空间数据出现异常!"); | |
| 51 | + } | |
| 52 | + | |
| 53 | + return rs; | |
| 54 | + } | |
| 55 | +} | ... | ... |
src/main/java/com/bsth/service/realcontrol/impl/ScheduleRealInfoServiceImpl.java
| ... | ... | @@ -1281,6 +1281,9 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl<ScheduleRealInf |
| 1281 | 1281 | if(scheduleRealInfo.isSflj()){ |
| 1282 | 1282 | ljgl += tempJhlc; |
| 1283 | 1283 | } |
| 1284 | + }else{ | |
| 1285 | + ssgl += tempJhlc; | |
| 1286 | + ssgl_other += tempJhlc; | |
| 1284 | 1287 | } |
| 1285 | 1288 | }else{ |
| 1286 | 1289 | Iterator<ChildTaskPlan> it = childTaskPlans.iterator(); | ... | ... |
src/main/java/com/bsth/service/schedule/utils/DataImportExportService.java
src/main/java/com/bsth/service/schedule/utils/DataImportExportServiceImpl.java
| ... | ... | @@ -111,6 +111,31 @@ public class DataImportExportServiceImpl implements DataImportExportService, Ini |
| 111 | 111 | } |
| 112 | 112 | |
| 113 | 113 | @Override |
| 114 | + public void fileDataImport(File datafile, File ktrFile) throws Exception { | |
| 115 | +// // 1、上传数据文件 | |
| 116 | +// File uploadFile = datafile; | |
| 117 | + | |
| 118 | + // 2、使用kettle运行封装数据导入逻辑的ktr转换文件 | |
| 119 | + // 2.1、初始化kettle(组件初始化已经做了) | |
| 120 | + // 2.2、创建转换元数据,转换 | |
| 121 | + TransMeta transMeta = new TransMeta(ktrFile.getAbsolutePath()); | |
| 122 | + Trans trans = new Trans(transMeta); | |
| 123 | + // 2.3、设定命名参数,用于指定数据文件,注意每个ktr必须都有以下指定的命名参数 | |
| 124 | + trans.setParameterValue("filepath", datafile.getAbsolutePath()); // 指定导入数据文件的位置 | |
| 125 | + trans.setParameterValue("erroroutputdir", dataToolsProperties.getTransErrordir()); // ktr转换错误输出目录 | |
| 126 | + // TODO:可以考虑设定日志输出 | |
| 127 | + // 2.4、执行转换 | |
| 128 | + trans.execute(null); | |
| 129 | + // 2.5、等待转换结束 | |
| 130 | + trans.waitUntilFinished(); | |
| 131 | + | |
| 132 | + // 3、判定ktr错误数,注意这种错误代表部分数据错误,不会终止转换执行,一般设计ktr的时候,会有错误输出文件,TODO:以后考虑使用日志实时输出 | |
| 133 | + if (trans.getErrors() > 0) { | |
| 134 | + throw new Exception("转换数据部分错误,请查看相关错误输出文件!"); | |
| 135 | + } | |
| 136 | + } | |
| 137 | + | |
| 138 | + @Override | |
| 114 | 139 | public File fileDataOutput(String fileName, File ktrFile) throws Exception { |
| 115 | 140 | return fileDataOutput(fileName, ktrFile, null); |
| 116 | 141 | } | ... | ... |
src/main/java/com/bsth/service/sys/CompanyAuthorityService.java
| 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 | -} | |
| 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
| 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 | -} | |
| 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/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:3306/mh_control?useUnicode=true&characterEncoding=utf-8&useSSL=false | |
| 11 | +spring.datasource.url= jdbc:mysql://192.168.168.201/mh_control?useUnicode=true&characterEncoding=utf-8&useSSL=false | |
| 12 | 12 | spring.datasource.username= root |
| 13 | 13 | spring.datasource.password= 123456 |
| 14 | 14 | #DATASOURCE | ... | ... |