Commit c8395069a185768a51395d63546f0bd284c46b2f
Merge branch 'minhang' into qingpu
# Conflicts: # src/main/java/com/bsth/service/oil/impl/YlbServiceImpl.java # src/main/resources/application-dev.properties # src/main/resources/static/index.html # src/main/resources/static/login.html # src/main/resources/static/real_control_v2/css/line_schedule.css # src/main/resources/static/real_control_v2/main.html
Showing
64 changed files
with
2210 additions
and
1157 deletions
Too many changes to show.
To preserve performance only 64 of 508 files are displayed.
pom.xml
| 1 | 1 | <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
| 2 | - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | |
| 2 | + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | |
| 3 | 3 | |
| 4 | 4 | <modelVersion>4.0.0</modelVersion> |
| 5 | 5 | <groupId>com.bsth</groupId> |
| ... | ... | @@ -237,6 +237,33 @@ |
| 237 | 237 | <version>1.13</version> |
| 238 | 238 | </dependency> |
| 239 | 239 | |
| 240 | + <dependency> | |
| 241 | + <groupId>org.dbunit</groupId> | |
| 242 | + <artifactId>dbunit</artifactId> | |
| 243 | + <version>2.4.9</version> | |
| 244 | + <scope>test</scope> | |
| 245 | + | |
| 246 | + <exclusions> | |
| 247 | + <exclusion> | |
| 248 | + <groupId>org.slf4j</groupId> | |
| 249 | + <artifactId>slf4j-api</artifactId> | |
| 250 | + </exclusion> | |
| 251 | + </exclusions> | |
| 252 | + </dependency> | |
| 253 | + | |
| 254 | + <dependency> | |
| 255 | + <groupId>com.h2database</groupId> | |
| 256 | + <artifactId>h2</artifactId> | |
| 257 | + <version>1.2.132</version> | |
| 258 | + <scope>test</scope> | |
| 259 | + </dependency> | |
| 260 | + | |
| 261 | + | |
| 262 | + <dependency> | |
| 263 | + <groupId>ojdbc</groupId> | |
| 264 | + <artifactId>ojdbc</artifactId> | |
| 265 | + <version>14</version> | |
| 266 | + </dependency> | |
| 240 | 267 | </dependencies> |
| 241 | 268 | |
| 242 | 269 | <dependencyManagement> | ... | ... |
src/main/java/com/bsth/Application.java
| ... | ... | @@ -2,10 +2,6 @@ package com.bsth; |
| 2 | 2 | |
| 3 | 3 | import com.fasterxml.jackson.databind.ObjectMapper; |
| 4 | 4 | import com.fasterxml.jackson.databind.SerializationFeature; |
| 5 | - | |
| 6 | -import java.util.concurrent.Executors; | |
| 7 | -import java.util.concurrent.ScheduledExecutorService; | |
| 8 | - | |
| 9 | 5 | import org.springframework.boot.SpringApplication; |
| 10 | 6 | import org.springframework.boot.autoconfigure.SpringBootApplication; |
| 11 | 7 | import org.springframework.boot.builder.SpringApplicationBuilder; |
| ... | ... | @@ -13,10 +9,13 @@ import org.springframework.boot.context.web.SpringBootServletInitializer; |
| 13 | 9 | import org.springframework.context.annotation.Bean; |
| 14 | 10 | import org.springframework.context.annotation.Primary; |
| 15 | 11 | |
| 12 | +import java.util.concurrent.Executors; | |
| 13 | +import java.util.concurrent.ScheduledExecutorService; | |
| 14 | + | |
| 16 | 15 | @SpringBootApplication |
| 17 | 16 | public class Application extends SpringBootServletInitializer { |
| 18 | 17 | |
| 19 | - public static ScheduledExecutorService mainServices = Executors.newScheduledThreadPool(12); | |
| 18 | + public static ScheduledExecutorService mainServices = Executors.newScheduledThreadPool(13); | |
| 20 | 19 | |
| 21 | 20 | @Override |
| 22 | 21 | protected SpringApplicationBuilder configure(SpringApplicationBuilder application) { | ... | ... |
src/main/java/com/bsth/common/Constants.java
| ... | ... | @@ -36,4 +36,14 @@ public class Constants { |
| 36 | 36 | |
| 37 | 37 | public static final String SESSION_USERNAME = "sessionUserName"; |
| 38 | 38 | public static final String COMPANY_AUTHORITYS = "cmyAuths"; |
| 39 | + | |
| 40 | + /** | |
| 41 | + * 解除调度指令和班次的外键约束 | |
| 42 | + */ | |
| 43 | + public static final String REMOVE_DIRECTIVE_SCH_FK = "update bsth_v_directive_60 set sch=NULL where sch=?"; | |
| 44 | + | |
| 45 | + /** | |
| 46 | + * 批量解除调度指令和班次的外键约束 | |
| 47 | + */ | |
| 48 | + public static final String MULTI_REMOVE_DIRECTIVE_SCH_FK = "update bsth_v_directive_60 set sch=NULL where sch in "; | |
| 39 | 49 | } | ... | ... |
src/main/java/com/bsth/controller/BaseController.java
| 1 | 1 | package com.bsth.controller; |
| 2 | 2 | |
| 3 | -import com.bsth.common.ResponseCode; | |
| 4 | 3 | import com.bsth.service.BaseService; |
| 5 | -import com.bsth.service.schedule.utils.DataImportExportService; | |
| 6 | 4 | import com.google.common.base.Splitter; |
| 7 | 5 | import org.springframework.beans.factory.annotation.Autowired; |
| 8 | 6 | import org.springframework.data.domain.Page; |
| 9 | 7 | import org.springframework.data.domain.PageRequest; |
| 10 | 8 | import org.springframework.data.domain.Sort; |
| 11 | 9 | import org.springframework.data.domain.Sort.Direction; |
| 12 | -import org.springframework.util.CollectionUtils; | |
| 13 | 10 | import org.springframework.web.bind.annotation.PathVariable; |
| 14 | 11 | import org.springframework.web.bind.annotation.RequestMapping; |
| 15 | 12 | import org.springframework.web.bind.annotation.RequestMethod; |
| 16 | 13 | import org.springframework.web.bind.annotation.RequestParam; |
| 17 | -import org.springframework.web.multipart.MultipartFile; | |
| 18 | 14 | |
| 19 | -import javax.servlet.http.HttpServletResponse; | |
| 20 | -import java.io.*; | |
| 15 | +import java.io.Serializable; | |
| 21 | 16 | import java.util.ArrayList; |
| 22 | -import java.util.HashMap; | |
| 23 | 17 | import java.util.List; |
| 24 | 18 | import java.util.Map; |
| 25 | 19 | |
| ... | ... | @@ -35,8 +29,6 @@ public class BaseController<T, ID extends Serializable> { |
| 35 | 29 | |
| 36 | 30 | @Autowired |
| 37 | 31 | protected BaseService<T, ID> baseService; |
| 38 | - @Autowired | |
| 39 | - DataImportExportService dataImportExportService; | |
| 40 | 32 | |
| 41 | 33 | /** |
| 42 | 34 | * @param @param map 查询条件 |
| ... | ... | @@ -126,115 +118,4 @@ public class BaseController<T, ID extends Serializable> { |
| 126 | 118 | return baseService.delete(id); |
| 127 | 119 | } |
| 128 | 120 | |
| 129 | - /** | |
| 130 | - * 上传数据文件,并使用ktr转换文件导入数据。 | |
| 131 | - * | |
| 132 | - * @param file | |
| 133 | - * @return | |
| 134 | - * @throws Exception | |
| 135 | - */ | |
| 136 | - @RequestMapping(value = "/dataImport", method = RequestMethod.POST) | |
| 137 | - public Map<String, Object> uploadDataAndImport(MultipartFile file) throws Exception { | |
| 138 | - Map<String, Object> resultMap = new HashMap<>(); | |
| 139 | - | |
| 140 | - try { | |
| 141 | - // 获取ktr转换文件绝对路径 | |
| 142 | - File ktrfile = new File(this.getClass().getResource(getDataImportKtrClasspath()).toURI()); | |
| 143 | - System.out.println(ktrfile.getAbsolutePath()); | |
| 144 | - // 导入数据 | |
| 145 | - dataImportExportService.fileDataImport(file, ktrfile); | |
| 146 | - | |
| 147 | - resultMap.put("status", ResponseCode.SUCCESS); | |
| 148 | - resultMap.put("msg", "导入成功"); | |
| 149 | - } catch (Exception exp) { | |
| 150 | - exp.printStackTrace(); | |
| 151 | - resultMap.put("status", ResponseCode.ERROR); | |
| 152 | - resultMap.put("msg", exp.getLocalizedMessage()); | |
| 153 | - } | |
| 154 | - | |
| 155 | - return resultMap; | |
| 156 | - } | |
| 157 | - | |
| 158 | - /** | |
| 159 | - * 使用ktr导出数据。 | |
| 160 | - * | |
| 161 | - * @param response | |
| 162 | - * @throws Exception | |
| 163 | - */ | |
| 164 | - @RequestMapping(value = "/dataExport", method = RequestMethod.GET) | |
| 165 | - public void dataExport(HttpServletResponse response) throws Exception { | |
| 166 | - dataExport(response, null); | |
| 167 | - } | |
| 168 | - | |
| 169 | - @RequestMapping(value = "/dataExportExt", method = RequestMethod.GET) | |
| 170 | - public void dataExport(HttpServletResponse response, @RequestParam Map<String, Object> param) throws Exception { | |
| 171 | - // 1、使用ktr转换获取输出文件 | |
| 172 | - File ktrfile = new File(this.getClass().getResource(getDataExportKtrClasspath()).toURI()); | |
| 173 | - File outputfile = null; | |
| 174 | - if (!CollectionUtils.isEmpty(param)) { | |
| 175 | - outputfile = dataImportExportService.fileDataOutput( | |
| 176 | - getDataExportFilename(), | |
| 177 | - ktrfile, | |
| 178 | - param); | |
| 179 | - } else { | |
| 180 | - outputfile = dataImportExportService.fileDataOutput( | |
| 181 | - getDataExportFilename(), | |
| 182 | - ktrfile); | |
| 183 | - } | |
| 184 | - | |
| 185 | - System.out.println(outputfile.getName()); | |
| 186 | - String filePath = outputfile.getAbsolutePath(); | |
| 187 | - String fp[] = filePath.split(File.separator); | |
| 188 | - String fileName = fp[fp.length - 1]; | |
| 189 | - | |
| 190 | - // TODO:使用ktr获取导出数据 | |
| 191 | - | |
| 192 | - response.setHeader("conent-type", "application/octet-stream"); | |
| 193 | - response.setContentType("application/octet-stream"); | |
| 194 | - response.setHeader("Content-Disposition", "attachment; filename=" + "东东"); | |
| 195 | - | |
| 196 | - OutputStream os = response.getOutputStream(); | |
| 197 | - BufferedOutputStream bos = new BufferedOutputStream(os); | |
| 198 | - | |
| 199 | - InputStream is = null; | |
| 200 | - | |
| 201 | - is = new FileInputStream(filePath); | |
| 202 | - BufferedInputStream bis = new BufferedInputStream(is); | |
| 203 | - | |
| 204 | - int length = 0; | |
| 205 | - byte[] temp = new byte[1 * 1024 * 10]; | |
| 206 | - | |
| 207 | - while ((length = bis.read(temp)) != -1) { | |
| 208 | - bos.write(temp, 0, length); | |
| 209 | - } | |
| 210 | - bos.flush(); | |
| 211 | - bis.close(); | |
| 212 | - bos.close(); | |
| 213 | - is.close(); | |
| 214 | - } | |
| 215 | - | |
| 216 | - /** | |
| 217 | - * @return 数据导出的ktr转换文件类路径。 | |
| 218 | - */ | |
| 219 | - protected String getDataExportKtrClasspath() { | |
| 220 | - // 默认返回异常,子类如果要使用导出功能,必须覆写此方法,指定ktr文件类路径 | |
| 221 | - throw new RuntimeException("必须override,并指定ktr classpath"); | |
| 222 | - } | |
| 223 | - | |
| 224 | - /** | |
| 225 | - * @return 导出文件名。 | |
| 226 | - */ | |
| 227 | - protected String getDataExportFilename() { | |
| 228 | - // 默认返回异常,子类如果要使用导出功能,必须覆写此方法,指定导出的文件路径名 | |
| 229 | - throw new RuntimeException("必须override,并指定导出文件名"); | |
| 230 | - } | |
| 231 | - | |
| 232 | - /** | |
| 233 | - * @return 数据导入的ktr转换文件类路径。 | |
| 234 | - */ | |
| 235 | - protected String getDataImportKtrClasspath() { | |
| 236 | - // 默认返回异常,子类如果要使用导入功能,必须覆写此方法,指定ktr文件类路径 | |
| 237 | - throw new RuntimeException("必须override,并指定ktr classpath"); | |
| 238 | - } | |
| 239 | - | |
| 240 | 121 | } | ... | ... |
src/main/java/com/bsth/controller/BaseController2.java deleted
100644 → 0
| 1 | -package com.bsth.controller; | |
| 2 | - | |
| 3 | - | |
| 4 | -import com.bsth.common.ResponseCode; | |
| 5 | -import com.bsth.service.BaseService; | |
| 6 | -import com.bsth.service.schedule.utils.DataImportExportService; | |
| 7 | -import com.google.common.base.Splitter; | |
| 8 | -import jxl.Sheet; | |
| 9 | -import jxl.Workbook; | |
| 10 | -import org.springframework.beans.factory.annotation.Autowired; | |
| 11 | -import org.springframework.data.domain.Page; | |
| 12 | -import org.springframework.data.domain.PageRequest; | |
| 13 | -import org.springframework.data.domain.Sort; | |
| 14 | -import org.springframework.util.CollectionUtils; | |
| 15 | -import org.springframework.web.bind.annotation.*; | |
| 16 | -import org.springframework.web.multipart.MultipartFile; | |
| 17 | - | |
| 18 | -import javax.servlet.http.HttpServletResponse; | |
| 19 | -import java.io.*; | |
| 20 | -import java.util.ArrayList; | |
| 21 | -import java.util.HashMap; | |
| 22 | -import java.util.List; | |
| 23 | -import java.util.Map; | |
| 24 | - | |
| 25 | -/** | |
| 26 | - * Created by xu on 16/11/3. | |
| 27 | - */ | |
| 28 | -public class BaseController2<T, ID extends Serializable> { | |
| 29 | - | |
| 30 | - @Autowired | |
| 31 | - protected BaseService<T, ID> baseService; | |
| 32 | - @Autowired | |
| 33 | - DataImportExportService dataImportExportService; | |
| 34 | - | |
| 35 | - /** | |
| 36 | - * | |
| 37 | - * @Title: list | |
| 38 | - * @Description: TODO(多条件分页查询) | |
| 39 | - * @param @param map 查询条件 | |
| 40 | - * @param @param page 页码 | |
| 41 | - * @param @param size 每页显示数量 | |
| 42 | - * @throws | |
| 43 | - */ | |
| 44 | - @RequestMapping(method = RequestMethod.GET) | |
| 45 | - public Page<T> list(@RequestParam Map<String, Object> map, | |
| 46 | - @RequestParam(defaultValue = "0") int page, | |
| 47 | - @RequestParam(defaultValue = "10") int size, | |
| 48 | - @RequestParam(defaultValue = "id") String order, | |
| 49 | - @RequestParam(defaultValue = "DESC") String direction){ | |
| 50 | - | |
| 51 | - // 允许多个字段排序,order可以写单个字段,也可以写多个字段 | |
| 52 | - // 多个字段格式:{col1},{col2},{col3},....,{coln} | |
| 53 | - List<String> order_columns = Splitter.on(",").trimResults().splitToList(order); | |
| 54 | - // 多字段排序:DESC,ASC... | |
| 55 | - List<String> order_dirs = Splitter.on(",").trimResults().splitToList(direction); | |
| 56 | - | |
| 57 | - if (order_dirs.size() == 1) { // 所有字段采用一种排序 | |
| 58 | - if (null != order_dirs.get(0) && order_dirs.get(0).equals("ASC")) { | |
| 59 | - return baseService.list(map, new PageRequest(page, size, new Sort(Sort.Direction.ASC, order_columns))); | |
| 60 | - } else { | |
| 61 | - return baseService.list(map, new PageRequest(page, size, new Sort(Sort.Direction.DESC, order_columns))); | |
| 62 | - } | |
| 63 | - } else if (order_columns.size() == order_dirs.size()) { | |
| 64 | - List<Sort.Order> orderList = new ArrayList<>(); | |
| 65 | - for (int i = 0; i < order_columns.size(); i++) { | |
| 66 | - if (null != order_dirs.get(i) && order_dirs.get(i).equals("ASC")) { | |
| 67 | - orderList.add(new Sort.Order(Sort.Direction.ASC, order_columns.get(i))); | |
| 68 | - } else { | |
| 69 | - orderList.add(new Sort.Order(Sort.Direction.DESC, order_columns.get(i))); | |
| 70 | - } | |
| 71 | - } | |
| 72 | - return baseService.list(map, new PageRequest(page, size, new Sort(orderList))); | |
| 73 | - } else { | |
| 74 | - throw new RuntimeException("多字段排序参数格式问题,排序顺序和字段数不一致"); | |
| 75 | - } | |
| 76 | - } | |
| 77 | - | |
| 78 | - /** | |
| 79 | - * | |
| 80 | - * @Title: list | |
| 81 | - * @Description: TODO(多条件查询) | |
| 82 | - * @param @param map | |
| 83 | - * @throws | |
| 84 | - */ | |
| 85 | - @RequestMapping(value = "/all", method = RequestMethod.GET) | |
| 86 | - public Iterable<T> list(@RequestParam Map<String, Object> map){ | |
| 87 | - return baseService.list(map); | |
| 88 | - } | |
| 89 | - | |
| 90 | - /** | |
| 91 | - * 这里保存直接返回保存后的对象,不自己定义Map返回了,和前端angularjs配合。 | |
| 92 | - * form也可以提交,但是页面参数可能不全, | |
| 93 | - * json的化比较灵活,但是貌似有多余属性也会报错,或者碰到lazy属性值,也有问题 | |
| 94 | - * 不论form,还是json提交都能解决问题,就看哪个方便哪个来 | |
| 95 | - * | |
| 96 | - * @param t 参数需要使用@RequestBody转换json成对象 | |
| 97 | - * @return | |
| 98 | - */ | |
| 99 | - @RequestMapping(method = RequestMethod.POST) | |
| 100 | - public T save(@RequestBody T t) { | |
| 101 | - baseService.save(t); | |
| 102 | - return t; | |
| 103 | - } | |
| 104 | - | |
| 105 | - @RequestMapping(value="/{id}", method = RequestMethod.POST) | |
| 106 | - public T update(@RequestBody T t) { | |
| 107 | - baseService.save(t); | |
| 108 | - return t; | |
| 109 | - } | |
| 110 | - | |
| 111 | - /** | |
| 112 | - * | |
| 113 | - * @Title: findById | |
| 114 | - * @Description: TODO(根据主键获取单个对象) | |
| 115 | - * @param @param id | |
| 116 | - * @throws | |
| 117 | - */ | |
| 118 | - @RequestMapping(value="/{id}",method = RequestMethod.GET) | |
| 119 | - public T findById(@PathVariable("id") ID id){ | |
| 120 | - return baseService.findById(id); | |
| 121 | - } | |
| 122 | - | |
| 123 | - /** | |
| 124 | - * | |
| 125 | - * @Title: delete | |
| 126 | - * @Description: TODO(根据主键删除对象) | |
| 127 | - * @param @param id | |
| 128 | - * @throws | |
| 129 | - */ | |
| 130 | - @RequestMapping(value="/{id}",method = RequestMethod.DELETE) | |
| 131 | - public Map<String, Object> delete(@PathVariable("id") ID id){ | |
| 132 | - return baseService.delete(id); | |
| 133 | - } | |
| 134 | - | |
| 135 | - /** | |
| 136 | - * 上传数据文件,并使用ktr转换文件导入数据。 | |
| 137 | - * @param file | |
| 138 | - * @return | |
| 139 | - * @throws Exception | |
| 140 | - */ | |
| 141 | - @RequestMapping(value = "/dataImport", method = RequestMethod.POST) | |
| 142 | - public Map<String, Object> uploadDataAndImport(MultipartFile file) throws Exception { | |
| 143 | - Map<String, Object> resultMap = new HashMap<>(); | |
| 144 | - | |
| 145 | - try { | |
| 146 | - // 获取ktr转换文件绝对路径 | |
| 147 | - File ktrfile = new File(this.getClass().getResource(getDataImportKtrClasspath()).toURI()); | |
| 148 | - System.out.println(ktrfile.getAbsolutePath()); | |
| 149 | - // 导入数据 | |
| 150 | - dataImportExportService.fileDataImport(file, ktrfile); | |
| 151 | - | |
| 152 | - resultMap.put("status", ResponseCode.SUCCESS); | |
| 153 | - resultMap.put("msg", "导入成功"); | |
| 154 | - } catch (Exception exp) { | |
| 155 | - exp.printStackTrace(); | |
| 156 | - resultMap.put("status", ResponseCode.ERROR); | |
| 157 | - resultMap.put("msg", exp.getLocalizedMessage()); | |
| 158 | - } | |
| 159 | - | |
| 160 | - return resultMap; | |
| 161 | - } | |
| 162 | - | |
| 163 | - /** | |
| 164 | - * 使用ktr导出数据。 | |
| 165 | - * @param response | |
| 166 | - * @throws Exception | |
| 167 | - */ | |
| 168 | - @RequestMapping(value = "/dataExport", method = RequestMethod.GET) | |
| 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 { | |
| 175 | - // 1、使用ktr转换获取输出文件 | |
| 176 | - File ktrfile = new File(this.getClass().getResource(getDataExportKtrClasspath()).toURI()); | |
| 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 | - } | |
| 188 | - | |
| 189 | - System.out.println(outputfile.getName()); | |
| 190 | - System.out.println(outputfile.getAbsolutePath()); | |
| 191 | - | |
| 192 | - String filePath = outputfile.getAbsolutePath(); | |
| 193 | -// String fp[] = filePath.split(File.separator); | |
| 194 | -// String fileName = fp[fp.length - 1]; | |
| 195 | - | |
| 196 | - // TODO:使用ktr获取导出数据 | |
| 197 | - | |
| 198 | - response.setHeader("conent-type", "application/octet-stream"); | |
| 199 | - response.setContentType("application/octet-stream"); | |
| 200 | - response.setHeader("Content-Disposition", "attachment; filename=" + "东东"); | |
| 201 | - | |
| 202 | - OutputStream os = response.getOutputStream(); | |
| 203 | - BufferedOutputStream bos = new BufferedOutputStream(os); | |
| 204 | - | |
| 205 | - InputStream is = null; | |
| 206 | - | |
| 207 | - is = new FileInputStream(filePath); | |
| 208 | - BufferedInputStream bis = new BufferedInputStream(is); | |
| 209 | - | |
| 210 | - int length = 0; | |
| 211 | - byte[] temp = new byte[1 * 1024 * 10]; | |
| 212 | - | |
| 213 | - while ((length = bis.read(temp)) != -1) { | |
| 214 | - bos.write(temp, 0, length); | |
| 215 | - } | |
| 216 | - bos.flush(); | |
| 217 | - bis.close(); | |
| 218 | - bos.close(); | |
| 219 | - is.close(); | |
| 220 | - } | |
| 221 | - | |
| 222 | - /** | |
| 223 | - * @return 数据导出的ktr转换文件类路径。 | |
| 224 | - */ | |
| 225 | - protected String getDataExportKtrClasspath() { | |
| 226 | - // 默认返回异常,子类如果要使用导出功能,必须覆写此方法,指定ktr文件类路径 | |
| 227 | - throw new RuntimeException("必须override,并指定ktr classpath"); | |
| 228 | - } | |
| 229 | - | |
| 230 | - /** | |
| 231 | - * @return 导出文件名。 | |
| 232 | - */ | |
| 233 | - protected String getDataExportFilename() { | |
| 234 | - // 默认返回异常,子类如果要使用导出功能,必须覆写此方法,指定导出的文件路径名 | |
| 235 | - throw new RuntimeException("必须override,并指定导出文件名"); | |
| 236 | - } | |
| 237 | - | |
| 238 | - /** | |
| 239 | - * @return 数据导入的ktr转换文件类路径。 | |
| 240 | - */ | |
| 241 | - protected String getDataImportKtrClasspath() { | |
| 242 | - // 默认返回异常,子类如果要使用导入功能,必须覆写此方法,指定ktr文件类路径 | |
| 243 | - throw new RuntimeException("必须override,并指定ktr classpath"); | |
| 244 | - } | |
| 245 | - | |
| 246 | - | |
| 247 | - public static class ExcelFileOutput { | |
| 248 | - private String fileName; | |
| 249 | - private List<Map<String, Object>> sheetnames = new ArrayList<>(); | |
| 250 | - | |
| 251 | - public String getFileName() { | |
| 252 | - return fileName; | |
| 253 | - } | |
| 254 | - | |
| 255 | - public void setFileName(String fileName) { | |
| 256 | - this.fileName = fileName; | |
| 257 | - } | |
| 258 | - | |
| 259 | - public List<Map<String, Object>> getSheetnames() { | |
| 260 | - return sheetnames; | |
| 261 | - } | |
| 262 | - | |
| 263 | - public void setSheetnames(List<Map<String, Object>> sheetnames) { | |
| 264 | - this.sheetnames = sheetnames; | |
| 265 | - } | |
| 266 | - } | |
| 267 | - | |
| 268 | - /** | |
| 269 | - * 上传Excel文件,返回文件全路径名,工作区名称列表。 | |
| 270 | - * @param file | |
| 271 | - * @return | |
| 272 | - * @throws Exception | |
| 273 | - */ | |
| 274 | - @RequestMapping(value = "/uploadFile", method = RequestMethod.POST) | |
| 275 | - public ExcelFileOutput fileUpload(MultipartFile file) throws Exception { | |
| 276 | - // 返回对象 | |
| 277 | - ExcelFileOutput rs = new ExcelFileOutput(); | |
| 278 | - | |
| 279 | - // 上传文件 | |
| 280 | - File file1 = dataImportExportService.uploadFile(file); | |
| 281 | - // 获取文件的sheet | |
| 282 | - Workbook book = Workbook.getWorkbook(file1); | |
| 283 | - for (Sheet sheet : book.getSheets()) { | |
| 284 | - String sheetname = sheet.getName(); | |
| 285 | - Map<String, Object> s = new HashMap<>(); | |
| 286 | - s.put("name", sheetname); | |
| 287 | - rs.getSheetnames().add(s); | |
| 288 | - } | |
| 289 | - | |
| 290 | - rs.setFileName(file1.getAbsolutePath()); | |
| 291 | - return rs; | |
| 292 | - } | |
| 293 | - | |
| 294 | -} |
src/main/java/com/bsth/controller/BusinessController.java
| 1 | 1 | package com.bsth.controller; |
| 2 | 2 | |
| 3 | +import org.springframework.beans.factory.annotation.Autowired; | |
| 3 | 4 | import org.springframework.web.bind.annotation.RequestMapping; |
| 5 | +import org.springframework.web.bind.annotation.RequestMethod; | |
| 4 | 6 | import org.springframework.web.bind.annotation.RestController; |
| 5 | 7 | |
| 6 | 8 | import com.bsth.entity.Business; |
| 9 | +import com.bsth.service.BusinessService; | |
| 10 | +import com.bsth.util.GetUIDAndCode; | |
| 7 | 11 | |
| 8 | 12 | /** |
| 9 | 13 | * |
| ... | ... | @@ -23,5 +27,11 @@ import com.bsth.entity.Business; |
| 23 | 27 | @RestController |
| 24 | 28 | @RequestMapping("business") |
| 25 | 29 | public class BusinessController extends BaseController<Business, Integer> { |
| 26 | - | |
| 30 | + @Autowired | |
| 31 | + private BusinessService businessService; | |
| 32 | + | |
| 33 | + @RequestMapping(value = "getCompCode", method = RequestMethod.GET) | |
| 34 | + public long getLineCode() { | |
| 35 | + return businessService.getCompCode(); | |
| 36 | + } | |
| 27 | 37 | } | ... | ... |
src/main/java/com/bsth/controller/CarsController.java
| 1 | 1 | package com.bsth.controller; |
| 2 | 2 | |
| 3 | -import com.bsth.common.ResponseCode; | |
| 4 | 3 | import com.bsth.entity.Cars; |
| 5 | -import com.bsth.service.schedule.utils.DataImportExportService; | |
| 6 | -import com.bsth.service.schedule.utils.DataToolsProperties; | |
| 7 | -import org.springframework.beans.factory.annotation.Autowired; | |
| 8 | -import org.springframework.boot.context.properties.EnableConfigurationProperties; | |
| 9 | 4 | import org.springframework.web.bind.annotation.RequestMapping; |
| 10 | -import org.springframework.web.bind.annotation.RequestMethod; | |
| 11 | -import org.springframework.web.bind.annotation.RequestParam; | |
| 12 | 5 | import org.springframework.web.bind.annotation.RestController; |
| 13 | 6 | |
| 14 | -import java.io.File; | |
| 15 | -import java.util.HashMap; | |
| 16 | -import java.util.Map; | |
| 17 | - | |
| 18 | 7 | /** |
| 19 | 8 | * Created by xu on 16/5/31. |
| 20 | 9 | */ |
| 21 | 10 | @RestController |
| 22 | 11 | @RequestMapping("cars") |
| 23 | -@EnableConfigurationProperties(DataToolsProperties.class) | |
| 24 | -public class CarsController extends BaseController2<Cars, Integer> { | |
| 25 | - | |
| 26 | - @Autowired | |
| 27 | - private DataToolsProperties dataToolsProperties; | |
| 28 | - @Autowired | |
| 29 | - private DataImportExportService dataImportExportService; | |
| 30 | - | |
| 31 | - /** | |
| 32 | - * 验证。 | |
| 33 | - * @param map | |
| 34 | - * @return | |
| 35 | - */ | |
| 36 | - @RequestMapping(value = "/validate/equale", method = RequestMethod.GET) | |
| 37 | - public Map<String, Object> validateData(@RequestParam Map<String, Object> map) { | |
| 38 | - // 一般比较自编号是否重复 | |
| 39 | - return baseService.validateEquale(map); | |
| 40 | - } | |
| 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 | - | |
| 84 | - @Override | |
| 85 | - protected String getDataImportKtrClasspath() { | |
| 86 | - return dataToolsProperties.getCarsDatainputktr(); | |
| 87 | - } | |
| 88 | - | |
| 89 | - @Override | |
| 90 | - protected String getDataExportKtrClasspath() { | |
| 91 | - return dataToolsProperties.getCarsDataoutputktr(); | |
| 92 | - } | |
| 12 | +public class CarsController extends BaseController<Cars, Integer> { | |
| 93 | 13 | |
| 94 | - @Override | |
| 95 | - protected String getDataExportFilename() { | |
| 96 | - return "车辆基础数据"; | |
| 97 | - } | |
| 98 | 14 | } | ... | ... |
src/main/java/com/bsth/controller/DownloadController.java
| ... | ... | @@ -100,4 +100,29 @@ public class DownloadController |
| 100 | 100 | os.close(); |
| 101 | 101 | file.delete(); |
| 102 | 102 | } |
| 103 | + | |
| 104 | + | |
| 105 | + @RequestMapping("downloadModel") | |
| 106 | + public void downloadModel(HttpServletResponse response,String fileName) | |
| 107 | + throws IOException { | |
| 108 | +// String fileNames=URLDecoder.decode(fileName,"UTF-8"); | |
| 109 | + fileName =fileName + ".xls"; | |
| 110 | + String moudelPath = this.getClass().getResource("/").getPath()+ "static/pages/forms/export/"+fileName; | |
| 111 | + File file = new File(moudelPath);// path是根据日志路径和文件名拼接出来的 | |
| 112 | +// String filename = file.getName();// 获取日志文件名称 | |
| 113 | + InputStream fis = new BufferedInputStream(new FileInputStream(moudelPath)); | |
| 114 | + byte[] buffer = new byte[fis.available()]; | |
| 115 | + fis.read(buffer); | |
| 116 | + fis.close(); | |
| 117 | + response.reset(); | |
| 118 | + response.addHeader("Content-Disposition", "attachment;filename=" + new String(fileName.replaceAll(" ", "").getBytes("utf-8"),"iso8859-1")); | |
| 119 | + response.addHeader("Content-Length", "" + file.length()); | |
| 120 | + OutputStream os = new BufferedOutputStream(response.getOutputStream()); | |
| 121 | + response.setContentType("application/octet-stream"); | |
| 122 | + os.write(buffer);// 输出文件 | |
| 123 | + os.flush(); | |
| 124 | + os.close(); | |
| 125 | + } | |
| 126 | + | |
| 127 | + | |
| 103 | 128 | } | ... | ... |
src/main/java/com/bsth/controller/PersonnelController.java
| ... | ... | @@ -2,10 +2,11 @@ package com.bsth.controller; |
| 2 | 2 | |
| 3 | 3 | import com.bsth.entity.Personnel; |
| 4 | 4 | import com.bsth.service.PersonnelService; |
| 5 | -import com.bsth.service.schedule.utils.DataToolsProperties; | |
| 6 | 5 | import org.springframework.beans.factory.annotation.Autowired; |
| 7 | -import org.springframework.boot.context.properties.EnableConfigurationProperties; | |
| 8 | -import org.springframework.web.bind.annotation.*; | |
| 6 | +import org.springframework.web.bind.annotation.RequestMapping; | |
| 7 | +import org.springframework.web.bind.annotation.RequestMethod; | |
| 8 | +import org.springframework.web.bind.annotation.RequestParam; | |
| 9 | +import org.springframework.web.bind.annotation.RestController; | |
| 9 | 10 | |
| 10 | 11 | import java.util.List; |
| 11 | 12 | import java.util.Map; |
| ... | ... | @@ -15,54 +16,11 @@ import java.util.Map; |
| 15 | 16 | */ |
| 16 | 17 | @RestController |
| 17 | 18 | @RequestMapping("personnel") |
| 18 | -@EnableConfigurationProperties(DataToolsProperties.class) | |
| 19 | 19 | public class PersonnelController extends BaseController<Personnel, Integer> { |
| 20 | 20 | |
| 21 | 21 | @Autowired |
| 22 | - private DataToolsProperties dataToolsProperties; | |
| 23 | - | |
| 24 | - @Autowired | |
| 25 | 22 | private PersonnelService service; |
| 26 | - /** | |
| 27 | - * 覆写方法,因为form提交的方式参数不全,改用 json形式提交 @RequestBody | |
| 28 | - * @Title: save | |
| 29 | - * @Description: TODO(持久化对象) | |
| 30 | - * @param @param t | |
| 31 | - * @param @return 设定文件 | |
| 32 | - * @return Map<String,Object> {status: 1(成功),-1(失败)} | |
| 33 | - * @throws | |
| 34 | - */ | |
| 35 | - @RequestMapping(method = RequestMethod.POST) | |
| 36 | - public Map<String, Object> save(@RequestBody Personnel t){ | |
| 37 | - return baseService.save(t); | |
| 38 | - } | |
| 39 | - | |
| 40 | - /** | |
| 41 | - * 验证。 | |
| 42 | - * @param map | |
| 43 | - * @return | |
| 44 | - */ | |
| 45 | - @RequestMapping(value = "/validate/equale", method = RequestMethod.GET) | |
| 46 | - public Map<String, Object> validateData(@RequestParam Map<String, Object> map) { | |
| 47 | - // 一般比较相同公司下工号是否相同 | |
| 48 | - return baseService.validateEquale(map); | |
| 49 | - } | |
| 50 | - | |
| 51 | - @Override | |
| 52 | - protected String getDataImportKtrClasspath() { | |
| 53 | - return dataToolsProperties.getEmployeesDatainputktr(); | |
| 54 | - } | |
| 55 | - | |
| 56 | - @Override | |
| 57 | - protected String getDataExportKtrClasspath() { | |
| 58 | - return dataToolsProperties.getEmployeesDataoutputktr(); | |
| 59 | - } | |
| 60 | 23 | |
| 61 | - @Override | |
| 62 | - protected String getDataExportFilename() { | |
| 63 | - return "人员基础信息"; | |
| 64 | - } | |
| 65 | - | |
| 66 | 24 | @RequestMapping(value = "/sreachPersonnel", method = RequestMethod.GET) |
| 67 | 25 | public List<Map<String, String>> sreachPersonnel(@RequestParam String jobCode) { |
| 68 | 26 | return service.sreachPersonnel(jobCode); | ... | ... |
src/main/java/com/bsth/controller/SectionController.java
| ... | ... | @@ -48,13 +48,9 @@ public class SectionController extends BaseController<Section, Integer> { |
| 48 | 48 | */ |
| 49 | 49 | @RequestMapping(value="sectionSave" , method = RequestMethod.POST) |
| 50 | 50 | public Map<String, Object> sectionSave(@RequestParam Map<String, Object> map) { |
| 51 | - | |
| 52 | 51 | map.put("createBy", ""); |
| 53 | - | |
| 54 | 52 | map.put("updateBy", ""); |
| 55 | - | |
| 56 | 53 | return service.sectionSave(map); |
| 57 | - | |
| 58 | 54 | } |
| 59 | 55 | |
| 60 | 56 | /** | ... | ... |
src/main/java/com/bsth/controller/SectionRouteController.java
| ... | ... | @@ -35,6 +35,17 @@ public class SectionRouteController extends BaseController<SectionRoute, Integer |
| 35 | 35 | @Autowired |
| 36 | 36 | SectionRouteService routeService; |
| 37 | 37 | |
| 38 | + /** | |
| 39 | + * @param @param map | |
| 40 | + * @throws | |
| 41 | + * @Title: list | |
| 42 | + * @Description: TODO(多条件查询) | |
| 43 | + */ | |
| 44 | + @RequestMapping(value = "/all", method = RequestMethod.GET) | |
| 45 | + public Iterable<SectionRoute> list(@RequestParam Map<String, Object> map) { | |
| 46 | + return routeService.list(map); | |
| 47 | + } | |
| 48 | + | |
| 38 | 49 | /** |
| 39 | 50 | * @Description :TODO(查询路段信息) |
| 40 | 51 | * |
| ... | ... | @@ -57,7 +68,6 @@ public class SectionRouteController extends BaseController<SectionRoute, Integer |
| 57 | 68 | */ |
| 58 | 69 | @RequestMapping(value = "/findSectionRouteInfoFormId",method = RequestMethod.GET) |
| 59 | 70 | public List<Map<String, Object>> findSectionRouteInfoFormId(@RequestParam Map<String, Object> map) { |
| 60 | - | |
| 61 | 71 | return routeService.findSectionRouteInfoFormId(map); |
| 62 | 72 | } |
| 63 | 73 | |
| ... | ... | @@ -72,4 +82,14 @@ public class SectionRouteController extends BaseController<SectionRoute, Integer |
| 72 | 82 | public List<Map<String, Object>> findUpStationRouteCode(@RequestParam Map<String, Object> map) { |
| 73 | 83 | return routeService.findUpSectionRouteCode(map); |
| 74 | 84 | } |
| 85 | + | |
| 86 | + /** | |
| 87 | + * @Description :TODO(引用路段) | |
| 88 | + * | |
| 89 | + * @return List<Map<String, Object>> | |
| 90 | + */ | |
| 91 | + @RequestMapping(value = "/quoteSection" , method = RequestMethod.POST) | |
| 92 | + public Map<String, Object> quoteSection(@RequestParam Map<String, Object> map) { | |
| 93 | + return routeService.quoteSection(map); | |
| 94 | + } | |
| 75 | 95 | } | ... | ... |
src/main/java/com/bsth/controller/StationController.java
| ... | ... | @@ -60,16 +60,12 @@ public class StationController extends BaseController<Station, Integer> { |
| 60 | 60 | */ |
| 61 | 61 | @RequestMapping(value="collectionSave" , method = RequestMethod.POST) |
| 62 | 62 | public Map<String, Object> collectionSave(@RequestParam Map<String, Object> map) { |
| 63 | - | |
| 64 | 63 | return service.systemSaveStations(map); |
| 65 | - | |
| 66 | 64 | } |
| 67 | 65 | |
| 68 | 66 | @RequestMapping(value="manualSave" , method = RequestMethod.POST) |
| 69 | 67 | public Map<String, Object> manualSave(@RequestParam Map<String, Object> map) { |
| 70 | - | |
| 71 | 68 | return service.manualSave(map); |
| 72 | - | |
| 73 | 69 | } |
| 74 | 70 | |
| 75 | 71 | /** |
| ... | ... | @@ -89,13 +85,9 @@ public class StationController extends BaseController<Station, Integer> { |
| 89 | 85 | */ |
| 90 | 86 | @RequestMapping(value="stationSave" , method = RequestMethod.POST) |
| 91 | 87 | public Map<String, Object> stationSave(@RequestParam Map<String, Object> map) { |
| 92 | - | |
| 93 | 88 | map.put("createBy", ""); |
| 94 | - | |
| 95 | 89 | map.put("updateBy", ""); |
| 96 | - | |
| 97 | 90 | return service.stationSaveMap(map); |
| 98 | - | |
| 99 | 91 | } |
| 100 | 92 | |
| 101 | 93 | /** | ... | ... |
src/main/java/com/bsth/controller/StationRouteController.java
| ... | ... | @@ -36,6 +36,17 @@ public class StationRouteController extends BaseController<StationRoute, Integer |
| 36 | 36 | @Autowired |
| 37 | 37 | StationRouteRepository stationRouteRepository; |
| 38 | 38 | |
| 39 | + /** | |
| 40 | + * @param @param map | |
| 41 | + * @throws | |
| 42 | + * @Title: list | |
| 43 | + * @Description: TODO(多条件查询) | |
| 44 | + */ | |
| 45 | + @RequestMapping(value = "/all", method = RequestMethod.GET) | |
| 46 | + public Iterable<StationRoute> list(@RequestParam Map<String, Object> map) { | |
| 47 | + return service.list(map); | |
| 48 | + } | |
| 49 | + | |
| 39 | 50 | /** |
| 40 | 51 | * @Description :TODO(查询树站点与路段数据) |
| 41 | 52 | * |
| ... | ... | @@ -111,7 +122,6 @@ public class StationRouteController extends BaseController<StationRoute, Integer |
| 111 | 122 | */ |
| 112 | 123 | @RequestMapping(value = "/findStationRouteInfo",method = RequestMethod.GET) |
| 113 | 124 | public List<Map<String, Object>> findStationRouteInfo(@RequestParam Map<String, Object> map) { |
| 114 | - | |
| 115 | 125 | return service.findStationRouteInfo(map); |
| 116 | 126 | } |
| 117 | 127 | |
| ... | ... | @@ -127,8 +137,26 @@ public class StationRouteController extends BaseController<StationRoute, Integer |
| 127 | 137 | */ |
| 128 | 138 | @RequestMapping(value = "/multiLine", method = RequestMethod.GET) |
| 129 | 139 | public Map<String, Object> findByMultiLine(@RequestParam String lineIds){ |
| 130 | - | |
| 131 | 140 | return service.findByMultiLine(lineIds); |
| 132 | 141 | } |
| 133 | 142 | |
| 143 | + /** | |
| 144 | + * | |
| 145 | + * @Title: updSwitchDir | |
| 146 | + * @Description: TODO(上下行切换) | |
| 147 | + */ | |
| 148 | + @RequestMapping(value = "/updSwitchDir", method = RequestMethod.POST) | |
| 149 | + public Map<String, Object> updSwitchDir(@RequestParam String lineIds){ | |
| 150 | + return service.updSwitchDir(lineIds); | |
| 151 | + } | |
| 152 | + | |
| 153 | + /** | |
| 154 | + * | |
| 155 | + * @Title: upddis | |
| 156 | + * @Description: TODO(更新站距) | |
| 157 | + */ | |
| 158 | + @RequestMapping(value = "/upddis",method = RequestMethod.POST) | |
| 159 | + public Map<String, Object> upddis(@RequestParam Map<String, Object> map) { | |
| 160 | + return service.upddis(map); | |
| 161 | + } | |
| 134 | 162 | } | ... | ... |
src/main/java/com/bsth/controller/forms/ExportController.java
| ... | ... | @@ -28,6 +28,7 @@ import com.bsth.entity.mcy_forms.Vehicleloading; |
| 28 | 28 | import com.bsth.entity.mcy_forms.Waybillday; |
| 29 | 29 | import com.bsth.service.forms.ExportService; |
| 30 | 30 | import com.bsth.service.forms.FormsService; |
| 31 | +import com.bsth.util.Arith; | |
| 31 | 32 | import com.bsth.util.ReportUtils; |
| 32 | 33 | |
| 33 | 34 | @RestController |
| ... | ... | @@ -82,7 +83,7 @@ public class ExportController { |
| 82 | 83 | } |
| 83 | 84 | |
| 84 | 85 | // 班次车辆人员日统计 |
| 85 | - @RequestMapping(value = "/shifdayExport", method = RequestMethod.POST) | |
| 86 | + @RequestMapping(value = "/shifdayExport", method = RequestMethod.GET) | |
| 86 | 87 | public List<Map<String, Object>> shifdayExport(@RequestParam Map<String, Object> map) { |
| 87 | 88 | SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"), sdfSimple = new SimpleDateFormat("yyyyMMdd"); |
| 88 | 89 | List<Iterator<?>> listI = new ArrayList<Iterator<?>>(); |
| ... | ... | @@ -122,7 +123,7 @@ public class ExportController { |
| 122 | 123 | } |
| 123 | 124 | |
| 124 | 125 | // 班次车辆人员月统计 |
| 125 | - @RequestMapping(value = "/shiftuehiclemanthExport", method = RequestMethod.POST) | |
| 126 | + @RequestMapping(value = "/shiftuehiclemanthExport", method = RequestMethod.GET) | |
| 126 | 127 | public List<Map<String, Object>> shiftuehiclemanthExport(@RequestParam Map<String, Object> map) { |
| 127 | 128 | SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"), sdfSimple = new SimpleDateFormat("yyyyMMdd"); |
| 128 | 129 | List<Iterator<?>> listI = new ArrayList<Iterator<?>>(); |
| ... | ... | @@ -147,12 +148,18 @@ public class ExportController { |
| 147 | 148 | } |
| 148 | 149 | |
| 149 | 150 | try { |
| 151 | + String mouldurl = null; | |
| 152 | + if(map.get("empnames").equals("驾驶员")){ | |
| 153 | + mouldurl="mould/shiftuehiclemanth.xls"; | |
| 154 | + }else if(map.get("empnames").equals("售票员")){ | |
| 155 | + mouldurl="mould/shiftuehiclemanthspy.xls"; | |
| 156 | + }else if(map.get("empnames").equals("车辆自编号")){ | |
| 157 | + mouldurl="mould/shiftuehiclemanthclzbh.xls"; | |
| 158 | + } | |
| 150 | 159 | listI.add(resList.iterator()); |
| 151 | - | |
| 152 | 160 | String path = this.getClass().getResource("/").getPath() + "static/pages/forms/"; |
| 153 | - ee.excelReplace(listI, new Object[] { map }, path + "mould/shiftuehiclemanth.xls", path | |
| 154 | - + "export/班次车辆人员月报表" + sdfSimple.format(sdfMonth.parse(map.get("startDate").toString())) + ".xls"); | |
| 155 | - | |
| 161 | + ee.excelReplace(listI, new Object[] { map }, path +mouldurl, | |
| 162 | + path + "export/班次车辆人员月报表" + sdfSimple.format(sdfMonth.parse(map.get("startDate").toString())) + ".xls"); | |
| 156 | 163 | } catch (Exception e) { |
| 157 | 164 | e.printStackTrace(); |
| 158 | 165 | } |
| ... | ... | @@ -161,7 +168,7 @@ public class ExportController { |
| 161 | 168 | } |
| 162 | 169 | |
| 163 | 170 | // 路单数据报表 |
| 164 | - @RequestMapping(value = "/singledataExport", method = RequestMethod.POST) | |
| 171 | + @RequestMapping(value = "/singledataExport", method = RequestMethod.GET) | |
| 165 | 172 | public List<Map<String, Object>> singledataExport(@RequestParam Map<String, Object> map) { |
| 166 | 173 | SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"), sdfSimple = new SimpleDateFormat("yyyyMMdd"); |
| 167 | 174 | List<Iterator<?>> listI = new ArrayList<Iterator<?>>(); |
| ... | ... | @@ -207,12 +214,12 @@ public class ExportController { |
| 207 | 214 | } |
| 208 | 215 | |
| 209 | 216 | // 车辆加注 |
| 210 | - @RequestMapping(value = "/vehicleloadingExport", method = RequestMethod.POST) | |
| 217 | + @RequestMapping(value = "/vehicleloadingExport", method = RequestMethod.GET) | |
| 211 | 218 | public List<Map<String, Object>> vehicleloadingExport(@RequestParam Map<String, Object> map) { |
| 212 | 219 | SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"), sdfSimple = new SimpleDateFormat("yyyyMMdd"); |
| 213 | 220 | List<Iterator<?>> listI = new ArrayList<Iterator<?>>(); |
| 214 | 221 | ReportUtils ee = new ReportUtils(); |
| 215 | - List<Vehicleloading> vehicleloading = formsService.vehicleloading(map.get("gsdmVehic").toString(),map.get("fgsdmVehic").toString(),map.get("line").toString(), | |
| 222 | + List<Vehicleloading> vehicleloading = formsService.vehicleloading(map.get("line").toString(), | |
| 216 | 223 | map.get("data").toString()); |
| 217 | 224 | List<Map<String, Object>> resList = new ArrayList<Map<String, Object>>(); |
| 218 | 225 | int i = 1; |
| ... | ... | @@ -246,7 +253,7 @@ public class ExportController { |
| 246 | 253 | } |
| 247 | 254 | |
| 248 | 255 | // 运营服务阶段报表 |
| 249 | - @RequestMapping(value = "/operationserviceExport", method = RequestMethod.POST) | |
| 256 | + @RequestMapping(value = "/operationserviceExport", method = RequestMethod.GET) | |
| 250 | 257 | public List<Map<String, Object>> operationserviceExport(@RequestParam Map<String, Object> map) { |
| 251 | 258 | SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"), sdfSimple = new SimpleDateFormat("yyyyMMdd"); |
| 252 | 259 | List<Iterator<?>> listI = new ArrayList<Iterator<?>>(); |
| ... | ... | @@ -552,17 +559,13 @@ public class ExportController { |
| 552 | 559 | List<Daily> allline = formsService.daily(map); |
| 553 | 560 | |
| 554 | 561 | List<Map<String, Object>> resList = new ArrayList<Map<String, Object>>(); |
| 555 | - Float zgl=0f; | |
| 556 | - Float ks=0f; | |
| 557 | - Float yh=0f; | |
| 558 | - Float bc=0f; | |
| 562 | + double zgl=0.0; | |
| 563 | + double ks=0.0; | |
| 564 | + double yh=0.0; | |
| 565 | + int bc=0; | |
| 559 | 566 | Map<String, Object> m ; |
| 560 | 567 | for (Daily d : allline) { |
| 561 | 568 | m = new HashMap<String, Object>(); |
| 562 | - zgl +=d.getZlc()==""?0f:Float.valueOf(d.getZlc()); | |
| 563 | - ks +=d.getJzl1()==""?0f:Float.valueOf(d.getJzl1()); | |
| 564 | - yh +=d.getYh()==""?0f:Float.valueOf(d.getYh()); | |
| 565 | - bc +=d.getBc()==""?0f:Float.valueOf(d.getBc()); | |
| 566 | 569 | m.put("zbh", d.getZbh()); |
| 567 | 570 | m.put("jgh",d.getJgh()); |
| 568 | 571 | m.put("jName", d.getjName()); |
| ... | ... | @@ -570,9 +573,13 @@ public class ExportController { |
| 570 | 573 | m.put("jzl1", d.getJzl1()); |
| 571 | 574 | m.put("yh", d.getYh()); |
| 572 | 575 | m.put("bc", d.getBc()); |
| 576 | + zgl =Arith.add(zgl, d.getZlc()); | |
| 577 | + ks =Arith.add(ks, d.getJzl1()); | |
| 578 | + yh =Arith.add(yh, d.getYh()); | |
| 579 | + bc +=Integer.parseInt(d.getBc()); | |
| 573 | 580 | |
| 574 | 581 | resList.add(m); |
| 575 | - } | |
| 582 | + } | |
| 576 | 583 | |
| 577 | 584 | m=new HashMap<String,Object>(); |
| 578 | 585 | m.put("total_zgl", zgl); | ... | ... |
src/main/java/com/bsth/controller/forms/MCY_FormsController.java
| ... | ... | @@ -52,14 +52,14 @@ public class MCY_FormsController { |
| 52 | 52 | } |
| 53 | 53 | |
| 54 | 54 | // 班次车辆人员月报表 |
| 55 | - @RequestMapping(value = "/shiftuehiclemanth", method = RequestMethod.POST) | |
| 55 | + @RequestMapping(value = "/shiftuehiclemanth", method = RequestMethod.GET) | |
| 56 | 56 | public List<Shiftuehiclemanth> shiftuehiclemanth(@RequestParam Map<String, Object> map) { |
| 57 | 57 | |
| 58 | 58 | return formsService.shiftuehiclemanth(map); |
| 59 | 59 | } |
| 60 | 60 | |
| 61 | 61 | // 班次车辆人员日统计 |
| 62 | - @RequestMapping(value = "/shifday", method = RequestMethod.POST) | |
| 62 | + @RequestMapping(value = "/shifday", method = RequestMethod.GET) | |
| 63 | 63 | public List<Shifday> shifday(@RequestParam Map<String, Object> map) { |
| 64 | 64 | |
| 65 | 65 | return formsService.shifday(map); |
| ... | ... | @@ -73,21 +73,20 @@ public class MCY_FormsController { |
| 73 | 73 | } |
| 74 | 74 | |
| 75 | 75 | // 路单数据 |
| 76 | - @RequestMapping(value = "/singledata", method = RequestMethod.POST) | |
| 76 | + @RequestMapping(value = "/singledata", method = RequestMethod.GET) | |
| 77 | 77 | public List<Singledata> singledata(@RequestParam Map<String, Object> map) { |
| 78 | 78 | |
| 79 | 79 | return formsService.singledata(map); |
| 80 | 80 | } |
| 81 | 81 | |
| 82 | 82 | // 车辆加注 |
| 83 | - @RequestMapping(value = "/vehicleloading", method = RequestMethod.POST) | |
| 84 | - public List<Vehicleloading> vehicleloading(@RequestParam String gsdmVehic, @RequestParam String fgsdmVehic, | |
| 85 | - @RequestParam String line, @RequestParam String data) { | |
| 86 | - return formsService.vehicleloading(gsdmVehic, fgsdmVehic, line, data); | |
| 83 | + @RequestMapping(value = "/vehicleloading", method = RequestMethod.GET) | |
| 84 | + public List<Vehicleloading> vehicleloading(@RequestParam String line, @RequestParam String data) { | |
| 85 | + return formsService.vehicleloading(line, data); | |
| 87 | 86 | } |
| 88 | 87 | |
| 89 | 88 | // 运营服务阶段报表 |
| 90 | - @RequestMapping(value = "/operationservice", method = RequestMethod.POST) | |
| 89 | + @RequestMapping(value = "/operationservice", method = RequestMethod.GET) | |
| 91 | 90 | public List<Operationservice> operationservice(@RequestParam Map<String, Object> map) { |
| 92 | 91 | |
| 93 | 92 | return formsService.operationservice(map); | ... | ... |
src/main/java/com/bsth/controller/gps/GpsController.java
| ... | ... | @@ -96,4 +96,34 @@ public class GpsController { |
| 96 | 96 | public Map<String, Object> gpsCompletion(@RequestParam long schId) { |
| 97 | 97 | return gpsService.gpsCompletion(schId); |
| 98 | 98 | } |
| 99 | + | |
| 100 | + /** | |
| 101 | + * 历史GPS查询 ,第二版轨迹回放用 | |
| 102 | + * @param nbbm | |
| 103 | + * @param st | |
| 104 | + * @param et | |
| 105 | + * @return | |
| 106 | + */ | |
| 107 | + @RequestMapping(value = "/history_v2/{nbbm}") | |
| 108 | + public Map<String, Object> history_v2(@PathVariable("nbbm") String nbbm, @RequestParam long st, @RequestParam long et){ | |
| 109 | + return gpsService.history_v2(nbbm, st, et); | |
| 110 | + } | |
| 111 | + | |
| 112 | + /** | |
| 113 | + * 安全驾驶数据 分页查询 | |
| 114 | + * @param map | |
| 115 | + * @param page | |
| 116 | + * @param size | |
| 117 | + * @param order | |
| 118 | + * @param direction | |
| 119 | + * @return | |
| 120 | + */ | |
| 121 | + @RequestMapping(value = "/safeDriv") | |
| 122 | + public Map<String, Object> safeDrivList(@RequestParam Map<String, Object> map, | |
| 123 | + @RequestParam(defaultValue = "0") int page, | |
| 124 | + @RequestParam(defaultValue = "15") int size, | |
| 125 | + @RequestParam(defaultValue = "timestamp") String order, | |
| 126 | + @RequestParam(defaultValue = "DESC") String direction){ | |
| 127 | + return gpsService.safeDrivList(map , page, size, order, direction); | |
| 128 | + } | |
| 99 | 129 | } | ... | ... |
src/main/java/com/bsth/controller/oil/DlbController.java
| 1 | 1 | package com.bsth.controller.oil; |
| 2 | 2 | |
| 3 | +import java.text.SimpleDateFormat; | |
| 4 | +import java.util.ArrayList; | |
| 3 | 5 | import java.util.HashMap; |
| 6 | +import java.util.Iterator; | |
| 4 | 7 | import java.util.List; |
| 5 | 8 | import java.util.Map; |
| 6 | 9 | |
| ... | ... | @@ -17,6 +20,7 @@ import com.bsth.controller.BaseController; |
| 17 | 20 | import com.bsth.entity.oil.Dlb; |
| 18 | 21 | import com.bsth.entity.oil.Ylb; |
| 19 | 22 | import com.bsth.service.oil.DlbService; |
| 23 | +import com.bsth.util.ReportUtils; | |
| 20 | 24 | import com.google.common.base.Splitter; |
| 21 | 25 | |
| 22 | 26 | @RestController |
| ... | ... | @@ -124,4 +128,57 @@ public class DlbController extends BaseController<Dlb, Integer>{ |
| 124 | 128 | } |
| 125 | 129 | return list; |
| 126 | 130 | } |
| 131 | + | |
| 132 | + | |
| 133 | + @RequestMapping(value = "/listExport",method = RequestMethod.POST) | |
| 134 | + public List<Map<String, Object>> listExport(@RequestParam Map<String, Object> map){ | |
| 135 | + SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"), | |
| 136 | + sdfSimple = new SimpleDateFormat("yyyyMMdd"); | |
| 137 | + List<Iterator<?>> listI = new ArrayList<Iterator<?>>(); | |
| 138 | + ReportUtils ee = new ReportUtils(); | |
| 139 | + List<Dlb> dlb= service.listDlb(map); | |
| 140 | +// (new CustomerSpecs<Ylb>(map)).iterator(); | |
| 141 | + List<Map<String, Object>> resList = new ArrayList<Map<String, Object>>(); | |
| 142 | + for (Dlb y : dlb) { | |
| 143 | + Map<String, Object> m = new HashMap<String, Object>(); | |
| 144 | + m.put("rq", y.getRq()); | |
| 145 | + m.put("gsname",y.getGsname() ); | |
| 146 | + m.put("xlname", y.getXlname()); | |
| 147 | + m.put("nbbm", y.getNbbm()); | |
| 148 | + m.put("jsy", y.getJsy()); | |
| 149 | + m.put("cdl", y.getCdl()); | |
| 150 | + m.put("czcd", y.getCzcd()+"%"); | |
| 151 | + m.put("jzcd", y.getJzcd()+"%"); | |
| 152 | + m.put("hd", y.getHd()); | |
| 153 | + String shyy ="无"; | |
| 154 | + if(y.getShyy()!=null){ | |
| 155 | + if(shyy.equals("1")){shyy="票务用油";} | |
| 156 | + else if(shyy.equals("2")){shyy="保养用油";} | |
| 157 | + else if(shyy.equals("3")){shyy="报废车用油";} | |
| 158 | + else if(shyy.equals("4")){shyy="其它用油";} | |
| 159 | + else if(shyy.equals("5")){shyy="人保部";} | |
| 160 | + else if(shyy.equals("6")){shyy="车队";} | |
| 161 | + else if(shyy.equals("7")){shyy="车间(高保)";} | |
| 162 | + else if(shyy.equals("8")){shyy="车间(小修)";} | |
| 163 | + else{shyy ="无";} | |
| 164 | + } | |
| 165 | + m.put("shyy", shyy); | |
| 166 | + m.put("sh", y.getSh()); | |
| 167 | + m.put("zlc", y.getZlc()); | |
| 168 | + m.put("bglyh", y.getBglyh()); | |
| 169 | + resList.add(m); | |
| 170 | + } | |
| 171 | + try { | |
| 172 | + listI.add(resList.iterator()); | |
| 173 | + String path = this.getClass().getResource("/").getPath()+"static/pages/forms/"; | |
| 174 | + ee.excelReplace(listI, new Object[] { map }, path+"mould/listDl.xls", | |
| 175 | + path+"export/"+map.get("rq").toString()+ "进出场存电量.xls"); | |
| 176 | + } catch (Exception e) { | |
| 177 | + e.printStackTrace(); | |
| 178 | + } | |
| 179 | + | |
| 180 | + return resList; | |
| 181 | + | |
| 182 | + } | |
| 183 | + | |
| 127 | 184 | } | ... | ... |
src/main/java/com/bsth/controller/oil/YlbController.java
| ... | ... | @@ -238,9 +238,11 @@ public class YlbController extends BaseController<Ylb, Integer>{ |
| 238 | 238 | Map<String, Object> m = new HashMap<String, Object>(); |
| 239 | 239 | m.put("rq", y.getRq()); |
| 240 | 240 | m.put("gsname",y.getGsname() ); |
| 241 | + m.put("fgsname", y.getFgsname()); | |
| 241 | 242 | m.put("xlname", y.getXlname()); |
| 242 | 243 | m.put("nbbm", y.getNbbm()); |
| 243 | 244 | m.put("jsy", y.getJsy()); |
| 245 | + m.put("name", y.getName()); | |
| 244 | 246 | m.put("jzl", y.getJzl()); |
| 245 | 247 | m.put("czlc", y.getCzlc()); |
| 246 | 248 | m.put("jzlc", y.getJzlc()); | ... | ... |
src/main/java/com/bsth/controller/realcontrol/BasicDataController.java
| ... | ... | @@ -4,6 +4,8 @@ import com.alibaba.fastjson.JSON; |
| 4 | 4 | import com.alibaba.fastjson.serializer.PropertyFilter; |
| 5 | 5 | import com.bsth.common.ResponseCode; |
| 6 | 6 | import com.bsth.data.BasicData; |
| 7 | +import com.bsth.entity.Line; | |
| 8 | +import com.google.common.collect.ArrayListMultimap; | |
| 7 | 9 | import org.slf4j.Logger; |
| 8 | 10 | import org.slf4j.LoggerFactory; |
| 9 | 11 | import org.springframework.beans.factory.annotation.Autowired; |
| ... | ... | @@ -11,9 +13,7 @@ import org.springframework.web.bind.annotation.RequestMapping; |
| 11 | 13 | import org.springframework.web.bind.annotation.RequestMethod; |
| 12 | 14 | import org.springframework.web.bind.annotation.RestController; |
| 13 | 15 | |
| 14 | -import java.util.HashMap; | |
| 15 | -import java.util.List; | |
| 16 | -import java.util.Map; | |
| 16 | +import java.util.*; | |
| 17 | 17 | |
| 18 | 18 | @RestController |
| 19 | 19 | @RequestMapping("/basic") |
| ... | ... | @@ -126,4 +126,23 @@ public class BasicDataController { |
| 126 | 126 | public Map<String, String> nbbm2PlateNo(){ |
| 127 | 127 | return basicData.getNbbm2PlateNo(); |
| 128 | 128 | } |
| 129 | + | |
| 130 | + | |
| 131 | + /** | |
| 132 | + * 获取线路配车信息 | |
| 133 | + * @return | |
| 134 | + */ | |
| 135 | + @RequestMapping("/ccInfo") | |
| 136 | + public Map<String, Collection<String>> ccInfo(){ | |
| 137 | + | |
| 138 | + ArrayListMultimap<String, String> listMultimap = ArrayListMultimap.create(); | |
| 139 | + Set<String> ks = BasicData.nbbm2LineMap.keySet(); | |
| 140 | + | |
| 141 | + Line line; | |
| 142 | + for(String nbbm : ks){ | |
| 143 | + line = BasicData.nbbm2LineMap.get(nbbm); | |
| 144 | + listMultimap.put(line.getLineCode(), nbbm); | |
| 145 | + } | |
| 146 | + return listMultimap.asMap(); | |
| 147 | + } | |
| 129 | 148 | } | ... | ... |
src/main/java/com/bsth/controller/realcontrol/DataManagerController.java
0 → 100644
| 1 | +package com.bsth.controller.realcontrol; | |
| 2 | + | |
| 3 | +import com.bsth.service.realcontrol.DataManagerService; | |
| 4 | +import org.apache.commons.lang3.StringEscapeUtils; | |
| 5 | +import org.springframework.beans.factory.annotation.Autowired; | |
| 6 | +import org.springframework.web.bind.annotation.RequestMapping; | |
| 7 | +import org.springframework.web.bind.annotation.RequestParam; | |
| 8 | +import org.springframework.web.bind.annotation.RestController; | |
| 9 | + | |
| 10 | +import java.util.Map; | |
| 11 | + | |
| 12 | +/** | |
| 13 | + * 数据管理,包括从老系统的数据迁移。新系统的数据校验等 | |
| 14 | + * Created by panzhao on 2017/4/17. | |
| 15 | + */ | |
| 16 | +@RestController | |
| 17 | +@RequestMapping("dataManager") | |
| 18 | +public class DataManagerController { | |
| 19 | + | |
| 20 | + @Autowired | |
| 21 | + DataManagerService dataManagerService; | |
| 22 | + | |
| 23 | + @RequestMapping("cars/old_now") | |
| 24 | + public Map<String, Object> carInfos(@RequestParam Integer lineId){ | |
| 25 | + return dataManagerService.carInfos(lineId); | |
| 26 | + } | |
| 27 | + | |
| 28 | + @RequestMapping("car/updateDevices") | |
| 29 | + public Map<String, Object> updateDevices(@RequestParam String jsonStr){ | |
| 30 | + jsonStr = StringEscapeUtils.unescapeHtml4(jsonStr); | |
| 31 | + return dataManagerService.updateDevices(jsonStr); | |
| 32 | + } | |
| 33 | +} | ... | ... |
src/main/java/com/bsth/controller/realcontrol/LineConfigController.java
| ... | ... | @@ -14,39 +14,91 @@ public class LineConfigController extends BaseController<LineConfig, Integer>{ |
| 14 | 14 | |
| 15 | 15 | @Autowired |
| 16 | 16 | LineConfigService lineConfigService; |
| 17 | - | |
| 17 | + | |
| 18 | + /** | |
| 19 | + * 检查是否有线路配置信息 | |
| 20 | + * @param codeArray | |
| 21 | + * @return | |
| 22 | + */ | |
| 18 | 23 | @RequestMapping("/check") |
| 19 | 24 | public Map<String, Object> check(@RequestParam String[] codeArray){ |
| 20 | 25 | return lineConfigService.check(codeArray); |
| 21 | 26 | } |
| 22 | - | |
| 27 | + | |
| 28 | + /** | |
| 29 | + * 初始化线路配置 | |
| 30 | + * @param lineCode | |
| 31 | + * @return | |
| 32 | + * @throws Exception | |
| 33 | + */ | |
| 23 | 34 | @RequestMapping("/init/{lineCode}") |
| 24 | 35 | public Integer init(@PathVariable("lineCode") String lineCode) throws Exception{ |
| 25 | 36 | return lineConfigService.init(lineCode); |
| 26 | 37 | } |
| 27 | - | |
| 38 | + | |
| 39 | + /** | |
| 40 | + * 修改班次刷新时间 | |
| 41 | + * @param time | |
| 42 | + * @param lineCode | |
| 43 | + * @return | |
| 44 | + */ | |
| 28 | 45 | @RequestMapping(value = "/editTime", method = RequestMethod.POST) |
| 29 | 46 | public Map<String, Object> editStartOptTime(@RequestParam String time,@RequestParam String lineCode){ |
| 30 | 47 | return lineConfigService.editStartOptTime(time, lineCode); |
| 31 | 48 | } |
| 32 | - | |
| 49 | + | |
| 50 | + /** | |
| 51 | + * 修改出场时间类型 | |
| 52 | + * @param lineCode | |
| 53 | + * @param type | |
| 54 | + * @return | |
| 55 | + */ | |
| 33 | 56 | @RequestMapping(value = "/editOutTimeType", method = RequestMethod.POST) |
| 34 | - public Map<String, Object> editOutTimeType(@RequestParam String lineCode, @RequestParam int type){ | |
| 35 | - return lineConfigService.editOutTimeType(lineCode, type); | |
| 57 | + public Map<String, Object> editOutTimeType(@RequestParam String lineCode, @RequestParam int type,@RequestParam String parkCode,@RequestParam String stationCode){ | |
| 58 | + return lineConfigService.editOutTimeType(lineCode, type, parkCode, stationCode); | |
| 36 | 59 | } |
| 37 | 60 | |
| 61 | + /** | |
| 62 | + * 启用原线路回场 | |
| 63 | + * @param lineCode | |
| 64 | + * @param enable | |
| 65 | + * @return | |
| 66 | + */ | |
| 38 | 67 | @RequestMapping(value = "/enableInParkForSource", method = RequestMethod.POST) |
| 39 | 68 | public Map<String, Object> enableInParkForSource(@RequestParam String lineCode, @RequestParam int enable){ |
| 40 | 69 | return lineConfigService.enableInParkForSource(lineCode, enable); |
| 41 | 70 | } |
| 42 | 71 | |
| 72 | + /** | |
| 73 | + * 根据线路编码获取配置信息 | |
| 74 | + * @param lineCode | |
| 75 | + * @return | |
| 76 | + */ | |
| 43 | 77 | @RequestMapping(value = "/getByLineCode") |
| 44 | 78 | public LineConfig getByLineCode(@RequestParam String lineCode){ |
| 45 | 79 | return lineConfigService.getByLineCode(lineCode); |
| 46 | 80 | } |
| 47 | 81 | |
| 82 | + /** | |
| 83 | + * 到站缓冲区设置 | |
| 84 | + * @param lineCode | |
| 85 | + * @param field | |
| 86 | + * @param value | |
| 87 | + * @return | |
| 88 | + */ | |
| 48 | 89 | @RequestMapping(value = "/bufferTimeDiff", method = RequestMethod.POST) |
| 49 | 90 | public Map<String, Object> bufferTimeDiff(@RequestParam String lineCode, @RequestParam String field,@RequestParam String value){ |
| 50 | 91 | return lineConfigService.bufferTimeDiff(lineCode, field, value); |
| 51 | 92 | } |
| 93 | + | |
| 94 | + /** | |
| 95 | + * 应急停靠设置 | |
| 96 | + * @param map | |
| 97 | + * @return | |
| 98 | + */ | |
| 99 | + @RequestMapping(value = "/yjtkSet", method = RequestMethod.POST) | |
| 100 | + public Map<String, Object> yjtkSet(@RequestParam Map<String, String> map){ | |
| 101 | + //System.out.println(map); | |
| 102 | + return lineConfigService.yjtkSet(map); | |
| 103 | + } | |
| 52 | 104 | } | ... | ... |
src/main/java/com/bsth/controller/realcontrol/ScheduleRealInfoController.java
| 1 | 1 | package com.bsth.controller.realcontrol; |
| 2 | 2 | |
| 3 | 3 | import com.alibaba.fastjson.JSONArray; |
| 4 | +import com.bsth.common.ResponseCode; | |
| 4 | 5 | import com.bsth.controller.BaseController; |
| 5 | 6 | import com.bsth.controller.realcontrol.dto.ChangePersonCar; |
| 6 | 7 | import com.bsth.controller.realcontrol.dto.DfsjChange; |
| ... | ... | @@ -185,16 +186,6 @@ public class ScheduleRealInfoController extends BaseController<ScheduleRealInfo, |
| 185 | 186 | |
| 186 | 187 | /** |
| 187 | 188 | * |
| 188 | - * @Title: trustStatus @Description: TODO(线路托管状态) @param @param lineCodes | |
| 189 | - * 线路编码 @throws | |
| 190 | - */ | |
| 191 | - @RequestMapping(value = "/trustStatus") | |
| 192 | - public Map<Integer, Integer> trustStatus(@RequestParam String lineCodes) { | |
| 193 | - return scheduleRealInfoService.trustStatus(lineCodes); | |
| 194 | - } | |
| 195 | - | |
| 196 | - /** | |
| 197 | - * | |
| 198 | 189 | * @Title: outgoAdjustAll |
| 199 | 190 | * @Description: TODO(批量待发调整) |
| 200 | 191 | * @param @param list |
| ... | ... | @@ -206,17 +197,6 @@ public class ScheduleRealInfoController extends BaseController<ScheduleRealInfo, |
| 206 | 197 | params = StringEscapeUtils.unescapeHtml4(params); |
| 207 | 198 | return scheduleRealInfoService.outgoAdjustAll(params); |
| 208 | 199 | } |
| 209 | - | |
| 210 | - /** | |
| 211 | - * | |
| 212 | - * @Title: changeTrustStatus @Description: TODO(切换线路托管状态) @param @param | |
| 213 | - * lineCode 线路编码 @param @param status 托管状态 @throws | |
| 214 | - */ | |
| 215 | - @RequestMapping(value = "/trustStatus/change", method = RequestMethod.POST) | |
| 216 | - public int changeTrustStatus(@RequestParam Integer lineCode, @RequestParam Integer status) { | |
| 217 | - //ScheduleBuffer.trustMap.put(lineCode, status); | |
| 218 | - return 200; | |
| 219 | - } | |
| 220 | 200 | |
| 221 | 201 | /** |
| 222 | 202 | * |
| ... | ... | @@ -242,12 +222,6 @@ public class ScheduleRealInfoController extends BaseController<ScheduleRealInfo, |
| 242 | 222 | return scheduleRealInfoService.findRouteByLine(lineCode); |
| 243 | 223 | } |
| 244 | 224 | |
| 245 | - @RequestMapping(value = "/test/getSch") | |
| 246 | - public int getSch(){ | |
| 247 | - //getSchedulePlanThread.start(); | |
| 248 | - return 1; | |
| 249 | - } | |
| 250 | - | |
| 251 | 225 | /** |
| 252 | 226 | * |
| 253 | 227 | * @Title: removeChildTask |
| ... | ... | @@ -268,7 +242,6 @@ public class ScheduleRealInfoController extends BaseController<ScheduleRealInfo, |
| 268 | 242 | */ |
| 269 | 243 | @RequestMapping(value = "/lineCode/{lineCode}") |
| 270 | 244 | public List<ScheduleRealInfo> findByLineCode(@PathVariable("lineCode") String lineCode){ |
| 271 | - //return ScheduleBuffer.realSchedulListMap.get(lineCode); | |
| 272 | 245 | return dayOfSchedule.findByLineCode(lineCode); |
| 273 | 246 | } |
| 274 | 247 | |
| ... | ... | @@ -368,9 +341,36 @@ public class ScheduleRealInfoController extends BaseController<ScheduleRealInfo, |
| 368 | 341 | } |
| 369 | 342 | |
| 370 | 343 | @RequestMapping(value="/statisticsDailyTj") |
| 371 | - public List<Map<String,Object>> statisticsDailyTj(@RequestParam String line, @RequestParam String date, | |
| 372 | - @RequestParam String date2,@RequestParam String xlName, @RequestParam String type){ | |
| 373 | - return scheduleRealInfoService.statisticsDailyTj(line, date,date2, xlName, type); | |
| 344 | + public List<Map<String,Object>> statisticsDailyTj(@RequestParam Map<String, Object> map){ | |
| 345 | + String gsdm=""; | |
| 346 | + if(map.get("gsdm")!=null){ | |
| 347 | + gsdm=map.get("gsdm").toString(); | |
| 348 | + } | |
| 349 | + String fgsdm=""; | |
| 350 | + if(map.get("fgsdm")!=null){ | |
| 351 | + fgsdm=map.get("fgsdm").toString(); | |
| 352 | + } | |
| 353 | + String line=""; | |
| 354 | + if(map.get("line")!=null){ | |
| 355 | + line=map.get("line").toString(); | |
| 356 | + } | |
| 357 | + String date=""; | |
| 358 | + if(map.get("date")!=null){ | |
| 359 | + date=map.get("date").toString(); | |
| 360 | + } | |
| 361 | + String date2=""; | |
| 362 | + if(map.get("date2")!=null){ | |
| 363 | + date2=map.get("date2").toString(); | |
| 364 | + } | |
| 365 | + String xlName=""; | |
| 366 | + if(map.get("xlName")!=null){ | |
| 367 | + xlName=map.get("xlName").toString(); | |
| 368 | + } | |
| 369 | + String type=""; | |
| 370 | + if(map.get("type")!=null){ | |
| 371 | + type=map.get("type").toString(); | |
| 372 | + } | |
| 373 | + return scheduleRealInfoService.statisticsDailyTj(gsdm,fgsdm,line, date,date2, xlName, type); | |
| 374 | 374 | } |
| 375 | 375 | |
| 376 | 376 | @RequestMapping(value="/MapById",method = RequestMethod.GET) |
| ... | ... | @@ -419,10 +419,10 @@ public class ScheduleRealInfoController extends BaseController<ScheduleRealInfo, |
| 419 | 419 | return scheduleRealInfoService.changeBcType(id, bcType, remarks); |
| 420 | 420 | } |
| 421 | 421 | |
| 422 | - @RequestMapping(value="/history", method=RequestMethod.POST) | |
| 422 | +/* @RequestMapping(value="/history", method=RequestMethod.POST) | |
| 423 | 423 | public Map<String,Object> historySave(ScheduleRealInfo sch){ |
| 424 | 424 | return scheduleRealInfoService.historySave(sch); |
| 425 | - } | |
| 425 | + }*/ | |
| 426 | 426 | |
| 427 | 427 | |
| 428 | 428 | private static DateTimeFormatter fmtyyyyMMdd = DateTimeFormat.forPattern("yyyy-MM-dd"); |
| ... | ... | @@ -486,4 +486,54 @@ public class ScheduleRealInfoController extends BaseController<ScheduleRealInfo, |
| 486 | 486 | public Map<String, Object> lpChangeMulti(@RequestParam String leftIdx, @RequestParam String rightIdx,@RequestParam int type){ |
| 487 | 487 | return scheduleRealInfoService.lpChangeMulti(leftIdx, rightIdx, type); |
| 488 | 488 | } |
| 489 | + | |
| 490 | + /** | |
| 491 | + * 删除当日实际排班 | |
| 492 | + * @return | |
| 493 | + */ | |
| 494 | + @RequestMapping(value = "deleteRealSchedule", method = RequestMethod.POST) | |
| 495 | + public Map<String, Object> deleteRealSchedule(@RequestParam String lineCode){ | |
| 496 | + return dayOfSchedule.deleteRealSchedule(lineCode); | |
| 497 | + } | |
| 498 | + | |
| 499 | + /** | |
| 500 | + * 从计划表重新加载当日排班 | |
| 501 | + * @param lineCode | |
| 502 | + * @return | |
| 503 | + */ | |
| 504 | + @RequestMapping(value = "reLoadRealSchedule", method = RequestMethod.POST) | |
| 505 | + public Map<String, Object> reLoadRealSchedule(@RequestParam String lineCode){ | |
| 506 | + Map<String, Object> rs = new HashMap<>(); | |
| 507 | + List<ScheduleRealInfo> list = dayOfSchedule.findByLineCode(lineCode); | |
| 508 | + if(list != null && list.size() > 0){ | |
| 509 | + rs.put("status", ResponseCode.ERROR); | |
| 510 | + rs.put("msg", "失败," + list.get(0).getXlName() + "当日存在实际排班,无法重新加载。"); | |
| 511 | + return rs; | |
| 512 | + } | |
| 513 | + | |
| 514 | + int code = dayOfSchedule.reloadSch(lineCode); | |
| 515 | + rs.put("status", code==0? ResponseCode.SUCCESS: ResponseCode.ERROR); | |
| 516 | + return rs; | |
| 517 | + } | |
| 518 | + | |
| 519 | + /** | |
| 520 | + * 误点调整 | |
| 521 | + * @param idx | |
| 522 | + * @param minute | |
| 523 | + * @return | |
| 524 | + */ | |
| 525 | + @RequestMapping(value = "lateAdjust", method = RequestMethod.POST) | |
| 526 | + public Map<String, Object> lateAdjust(@RequestParam String idx,@RequestParam float minute ){ | |
| 527 | + return scheduleRealInfoService.lateAdjust(idx, minute); | |
| 528 | + } | |
| 529 | + | |
| 530 | + /** | |
| 531 | + * 获取所有应发未到的班次 | |
| 532 | + * @param idx | |
| 533 | + * @return | |
| 534 | + */ | |
| 535 | + @RequestMapping(value = "allLate2") | |
| 536 | + public List<ScheduleRealInfo> allLate2(@RequestParam String idx){ | |
| 537 | + return scheduleRealInfoService.allLate2(idx); | |
| 538 | + } | |
| 489 | 539 | } | ... | ... |
src/main/java/com/bsth/controller/realcontrol/anomalyCheckController.java
0 → 100644
| 1 | +package com.bsth.controller.realcontrol; | |
| 2 | + | |
| 3 | +import com.bsth.data.schedule.DayOfSchedule; | |
| 4 | +import com.bsth.entity.realcontrol.ScheduleRealInfo; | |
| 5 | +import org.slf4j.Logger; | |
| 6 | +import org.slf4j.LoggerFactory; | |
| 7 | +import org.springframework.beans.factory.annotation.Autowired; | |
| 8 | +import org.springframework.web.bind.annotation.RequestMapping; | |
| 9 | +import org.springframework.web.bind.annotation.RequestMethod; | |
| 10 | +import org.springframework.web.bind.annotation.RequestParam; | |
| 11 | +import org.springframework.web.bind.annotation.RestController; | |
| 12 | + | |
| 13 | +import java.util.HashSet; | |
| 14 | +import java.util.List; | |
| 15 | +import java.util.Set; | |
| 16 | + | |
| 17 | +/** | |
| 18 | + * 相关数据异常检测 | |
| 19 | + * Created by panzhao on 2017/4/14. | |
| 20 | + */ | |
| 21 | +@RestController | |
| 22 | +@RequestMapping("anomalyCheck") | |
| 23 | +public class anomalyCheckController { | |
| 24 | + | |
| 25 | + | |
| 26 | + Logger logger = LoggerFactory.getLogger(this.getClass()); | |
| 27 | + | |
| 28 | + @Autowired | |
| 29 | + DayOfSchedule dayOfSchedule; | |
| 30 | + /** | |
| 31 | + * 出现重复班次的车辆 | |
| 32 | + * @param nbbm | |
| 33 | + */ | |
| 34 | + @RequestMapping(value = "/schRepeat", method = RequestMethod.POST) | |
| 35 | + public void schRepeat(@RequestParam String nbbm){ | |
| 36 | + logger.info("前端通知,车辆 " + nbbm + "出现重复班次,开始检测..."); | |
| 37 | + List<ScheduleRealInfo> list = dayOfSchedule.findByNbbm(nbbm); | |
| 38 | + | |
| 39 | + Set<ScheduleRealInfo> set = new HashSet<>(); | |
| 40 | + for(ScheduleRealInfo sch : list){ | |
| 41 | + if(!set.add(sch)){ | |
| 42 | + logger.info("出现一次重复班次,班次ID:" + sch.getId()); | |
| 43 | + } | |
| 44 | + } | |
| 45 | + | |
| 46 | + if(set.size() > 0){ | |
| 47 | + dayOfSchedule.replaceByNbbm(nbbm, set); | |
| 48 | + } | |
| 49 | + } | |
| 50 | +} | ... | ... |
src/main/java/com/bsth/controller/report/ReportController.java
| 1 | 1 | package com.bsth.controller.report; |
| 2 | 2 | |
| 3 | +import java.util.ArrayList; | |
| 3 | 4 | import java.util.HashMap; |
| 5 | +import java.util.Iterator; | |
| 4 | 6 | import java.util.List; |
| 5 | 7 | import java.util.Map; |
| 6 | 8 | |
| ... | ... | @@ -13,6 +15,7 @@ import org.springframework.web.bind.annotation.RestController; |
| 13 | 15 | import com.bsth.entity.excep.ArrivalInfo; |
| 14 | 16 | import com.bsth.entity.realcontrol.ScheduleRealInfo; |
| 15 | 17 | import com.bsth.service.report.ReportService; |
| 18 | +import com.bsth.util.ReportUtils; | |
| 16 | 19 | |
| 17 | 20 | @RestController |
| 18 | 21 | @RequestMapping("report") |
| ... | ... | @@ -21,22 +24,152 @@ public class ReportController { |
| 21 | 24 | @Autowired |
| 22 | 25 | ReportService service; |
| 23 | 26 | |
| 24 | - @RequestMapping(value="/queryListBczx" ,method = RequestMethod.POST) | |
| 27 | + @RequestMapping(value="/queryListBczx" ,method = RequestMethod.GET) | |
| 25 | 28 | public List<ScheduleRealInfo> queryListBczx(@RequestParam String clzbh,@RequestParam String line,@RequestParam String date){ |
| 26 | 29 | return service.queryListBczx(line,date,clzbh); |
| 27 | 30 | } |
| 28 | 31 | |
| 29 | - @RequestMapping(value="/queryListZdxx" ,method = RequestMethod.POST) | |
| 32 | + @RequestMapping(value="/queryListZdxx" ,method = RequestMethod.GET) | |
| 30 | 33 | public List<ArrivalInfo> queryListZdxx(@RequestParam String clzbh,@RequestParam String line, |
| 31 | 34 | @RequestParam String date,@RequestParam String fcsj,@RequestParam String ddsj){ |
| 32 | 35 | return service.queryListZdxx(line,date,clzbh,fcsj,ddsj); |
| 33 | 36 | } |
| 34 | - @RequestMapping(value="/queryListClzd" ,method = RequestMethod.POST) | |
| 37 | + | |
| 38 | + @RequestMapping(value="/exportQueryListZdxx" ,method = RequestMethod.GET) | |
| 39 | + public List<Map<String, Object>> exportQueryListZdxx(@RequestParam String clzbh,@RequestParam String line, | |
| 40 | + @RequestParam String date,@RequestParam String fcsj,@RequestParam String ddsj){ | |
| 41 | + List<Iterator<?>> listI = new ArrayList<Iterator<?>>(); | |
| 42 | + ReportUtils ee = new ReportUtils(); | |
| 43 | + List<ArrivalInfo> list=service.queryListZdxx(line,date,clzbh,fcsj,ddsj); | |
| 44 | + List<Map<String, Object>> resList = new ArrayList<Map<String, Object>>(); | |
| 45 | + int i=1; | |
| 46 | + for (ArrivalInfo a:list ) { | |
| 47 | + Map<String, Object> m = new HashMap<String, Object>(); | |
| 48 | + m.put("i", i); | |
| 49 | + m.put("nbbm", a.getNbbm()); | |
| 50 | + m.put("stopName", a.getStopName()); | |
| 51 | + m.put("jzsj", a.getJzsj()); | |
| 52 | + m.put("czsj", a.getCzsj()); | |
| 53 | + m.put("kgm", ""); | |
| 54 | + m.put("upDown", a.getUpDown()==0?"上行":"下行"); | |
| 55 | + m.put("kmsd", ""); | |
| 56 | + m.put("bufa", ""); | |
| 57 | + m.put("skcs", ""); | |
| 58 | + m.put("skje", ""); | |
| 59 | + m.put("mfskcs", ""); | |
| 60 | + m.put("mfskje", ""); | |
| 61 | + resList.add(m); | |
| 62 | + i++; | |
| 63 | + } | |
| 64 | + | |
| 65 | + try { | |
| 66 | + Map<String, Object> map=new HashMap<String, Object>(); | |
| 67 | + listI.add(resList.iterator()); | |
| 68 | + String path = this.getClass().getResource("/").getPath() + "static/pages/forms/"; | |
| 69 | + ee.excelReplace(listI, new Object[] { map }, path + "mould/inoutstation.xls", | |
| 70 | + path + "export/班次到离站.xls"); | |
| 71 | + } catch (Exception e) { | |
| 72 | + e.printStackTrace(); | |
| 73 | + } | |
| 74 | + return resList; | |
| 75 | + } | |
| 76 | + | |
| 77 | + | |
| 78 | + @RequestMapping(value="/queryListClzd" ,method = RequestMethod.GET) | |
| 35 | 79 | public List<ArrivalInfo> queryListClzd(@RequestParam String zd,@RequestParam String line, |
| 36 | 80 | @RequestParam String zdlx,@RequestParam String fcsj,@RequestParam String ddsj){ |
| 37 | 81 | return service.queryListClzd(line,zd,zdlx,fcsj,ddsj); |
| 38 | 82 | } |
| 39 | 83 | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + @RequestMapping(value="/exportQueryListClzd" ,method = RequestMethod.GET) | |
| 88 | + public List<Map<String, Object>> exportQueryListClzd(@RequestParam String zd,@RequestParam String line, | |
| 89 | + @RequestParam String zdlx,@RequestParam String fcsj,@RequestParam String ddsj){ | |
| 90 | + List<Iterator<?>> listI = new ArrayList<Iterator<?>>(); | |
| 91 | + ReportUtils ee = new ReportUtils(); | |
| 92 | + List<ArrivalInfo> list=service.queryListClzd(line,zd,zdlx,fcsj,ddsj); | |
| 93 | + List<Map<String, Object>> resList = new ArrayList<Map<String, Object>>(); | |
| 94 | + int i=1; | |
| 95 | + for (ArrivalInfo a:list ) { | |
| 96 | + Map<String, Object> m = new HashMap<String, Object>(); | |
| 97 | + m.put("i", i); | |
| 98 | + m.put("nbbm", a.getNbbm()); | |
| 99 | + m.put("stopName", a.getStopName()); | |
| 100 | + m.put("jzsj", a.getJzsj()); | |
| 101 | + m.put("czsj", a.getCzsj()); | |
| 102 | + m.put("kgm", ""); | |
| 103 | + m.put("upDown", a.getUpDown()==0?"上行":"下行"); | |
| 104 | + m.put("kmsd", ""); | |
| 105 | + m.put("bufa", ""); | |
| 106 | + m.put("skcs", ""); | |
| 107 | + m.put("skje", ""); | |
| 108 | + m.put("mfskcs", ""); | |
| 109 | + m.put("mfskje", ""); | |
| 110 | + resList.add(m); | |
| 111 | + i++; | |
| 112 | + } | |
| 113 | + | |
| 114 | + try { | |
| 115 | + Map<String, Object> map=new HashMap<String, Object>(); | |
| 116 | + listI.add(resList.iterator()); | |
| 117 | + String path = this.getClass().getResource("/").getPath() + "static/pages/forms/"; | |
| 118 | + ee.excelReplace(listI, new Object[] { map }, path + "mould/inoutstation.xls", | |
| 119 | + path + "export/班次到离站.xls"); | |
| 120 | + } catch (Exception e) { | |
| 121 | + e.printStackTrace(); | |
| 122 | + } | |
| 123 | + return resList; | |
| 124 | + } | |
| 125 | + | |
| 126 | + | |
| 127 | + @RequestMapping(value="/jobSummaryExport" ,method = RequestMethod.GET) | |
| 128 | + public List<Map<String, Object>> jobSummaryExport(@RequestParam Map<String, Object> map){ | |
| 129 | + List<Iterator<?>> listI = new ArrayList<Iterator<?>>(); | |
| 130 | + String lineName=map.get("lineName").toString(); | |
| 131 | + String date=map.get("date").toString(); | |
| 132 | + ReportUtils ee = new ReportUtils(); | |
| 133 | + List<Map<String,Object>> fwqlList= service.jobFwqk(map); | |
| 134 | + List<Map<String, Object>> lgqlList=service.jobLjqk(map); | |
| 135 | + map=service.jobHzxx(map); | |
| 136 | + map.put("lineName", lineName); | |
| 137 | + map.put("date",date); | |
| 138 | + if(fwqlList.size()<=0){ | |
| 139 | + Map<String, Object> newMap=new HashMap<String,Object>(); | |
| 140 | + newMap.put("nr", " "); | |
| 141 | + newMap.put("lp", " "); | |
| 142 | + newMap.put("nbbm", " "); | |
| 143 | + newMap.put("jgh", " "); | |
| 144 | + newMap.put("dz", " "); | |
| 145 | + newMap.put("sj", " "); | |
| 146 | + newMap.put("lbbc", " "); | |
| 147 | + newMap.put("lblc", " "); | |
| 148 | + newMap.put("jyqp", " "); | |
| 149 | + fwqlList.add(newMap); | |
| 150 | + } | |
| 151 | + if(lgqlList.size()<=0){ | |
| 152 | + Map<String, Object> newMap=new HashMap<String,Object>(); | |
| 153 | + newMap.put("lp", " "); | |
| 154 | + newMap.put("nbbm", " "); | |
| 155 | + newMap.put("jgh", " "); | |
| 156 | + newMap.put("dz", " "); | |
| 157 | + newMap.put("sj", " "); | |
| 158 | + newMap.put("ljlc"," "); | |
| 159 | + newMap.put("jyqp", " "); | |
| 160 | + lgqlList.add(newMap); | |
| 161 | + } | |
| 162 | + try { | |
| 163 | + listI.add(fwqlList.iterator()); | |
| 164 | + listI.add(lgqlList.iterator()); | |
| 165 | + String path = this.getClass().getResource("/").getPath() + "static/pages/forms/"; | |
| 166 | + ee.excelReplace(listI, new Object[] { map }, path + "mould/jobSummary.xls", | |
| 167 | + path + "export/调度员工作汇总日报.xls"); | |
| 168 | + } catch (Exception e) { | |
| 169 | + e.printStackTrace(); | |
| 170 | + } | |
| 171 | + return new ArrayList<Map<String, Object>>(); | |
| 172 | + } | |
| 40 | 173 | @RequestMapping(value = "/sreachZd", method = RequestMethod.GET) |
| 41 | 174 | public List<Map<String, String>> sreachPersonnel(@RequestParam String line,@RequestParam int zdlx,@RequestParam String zd) { |
| 42 | 175 | return service.sreachZd(line,zdlx, zd); | ... | ... |
src/main/java/com/bsth/controller/schedule/core/TTInfoDetailController.java
| ... | ... | @@ -5,11 +5,7 @@ import com.bsth.controller.schedule.BController; |
| 5 | 5 | import com.bsth.entity.schedule.TTInfoDetail; |
| 6 | 6 | import com.bsth.service.schedule.TTInfoDetailService; |
| 7 | 7 | import org.springframework.beans.factory.annotation.Autowired; |
| 8 | -import org.springframework.web.bind.annotation.PathVariable; | |
| 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 | +import org.springframework.web.bind.annotation.*; | |
| 13 | 9 | |
| 14 | 10 | import java.util.HashMap; |
| 15 | 11 | import java.util.List; |
| ... | ... | @@ -88,6 +84,20 @@ public class TTInfoDetailController extends BController<TTInfoDetail, Long> { |
| 88 | 84 | } |
| 89 | 85 | return rtn; |
| 90 | 86 | } |
| 87 | + | |
| 88 | + @RequestMapping(value = "/zd_tcc", method = RequestMethod.GET) | |
| 89 | + public Map<String, Object> getZdAndTccInfo(Integer lineid, Integer xldir) { | |
| 90 | + Map<String, Object> rtn = new HashMap<>(); | |
| 91 | + try { | |
| 92 | + List<Map<String, Object>> list = ttInfoDetailService.findZdAndTcc(lineid, xldir); | |
| 93 | + rtn.put("status", ResponseCode.SUCCESS); | |
| 94 | + rtn.put("data", list); | |
| 95 | + } catch (Exception exp) { | |
| 96 | + rtn.put("status", ResponseCode.ERROR); | |
| 97 | + rtn.put("msg", exp.getMessage()); | |
| 98 | + } | |
| 99 | + return rtn; | |
| 100 | + } | |
| 91 | 101 | |
| 92 | 102 | /** |
| 93 | 103 | * 时刻表明细批量插入 | ... | ... |
src/main/java/com/bsth/controller/sys/UserController.java
| ... | ... | @@ -237,4 +237,9 @@ public class UserController extends BaseController<SysUser, Integer> { |
| 237 | 237 | } |
| 238 | 238 | return msg; |
| 239 | 239 | } |
| 240 | + | |
| 241 | + @RequestMapping(value = "/register" ,method = RequestMethod.POST) | |
| 242 | + public Map<String, Object> register(SysUser u){ | |
| 243 | + return sysUserService.register(u); | |
| 244 | + } | |
| 240 | 245 | } | ... | ... |
src/main/java/com/bsth/data/BasicData.java
| ... | ... | @@ -31,7 +31,7 @@ public class BasicData implements CommandLineRunner { |
| 31 | 31 | //公司代码和公司名对照(K: 公司编码,V:公司名) |
| 32 | 32 | public static Map<String, String> businessCodeNameMap; |
| 33 | 33 | |
| 34 | - //分公司公司代码和分公司公司名对照(K: 公司编码+分公司编码,V:分公司公司名) | |
| 34 | + //分公司公司代码和分公司公司名对照(K: 公司编码_分公司编码,V:分公司公司名) | |
| 35 | 35 | public static Map<String, String> businessFgsCodeNameMap; |
| 36 | 36 | |
| 37 | 37 | //设备号和车辆自编号 (K: 设备编码 ,V:车辆自编号) |
| ... | ... | @@ -332,6 +332,7 @@ public class BasicData implements CommandLineRunner { |
| 332 | 332 | } |
| 333 | 333 | |
| 334 | 334 | perTempMap.put(jobCode, p); |
| 335 | + | |
| 335 | 336 | allPersonMap.put(jobCode, p.getPersonnelName()); |
| 336 | 337 | } |
| 337 | 338 | ... | ... |
src/main/java/com/bsth/data/LineConfigData.java
| 1 | 1 | package com.bsth.data; |
| 2 | 2 | |
| 3 | +import com.bsth.Application; | |
| 3 | 4 | import com.bsth.entity.Line; |
| 4 | 5 | import com.bsth.entity.realcontrol.D80ReplyTemp; |
| 5 | 6 | import com.bsth.entity.realcontrol.LineConfig; |
| 6 | -import com.bsth.oplog.normal.OpLogger; | |
| 7 | +import com.bsth.entity.realcontrol.ScheduleRealInfo; | |
| 7 | 8 | import com.bsth.service.LineService; |
| 8 | 9 | import com.bsth.service.realcontrol.LineConfigService; |
| 9 | 10 | import org.slf4j.Logger; |
| ... | ... | @@ -14,101 +15,151 @@ import org.springframework.core.annotation.Order; |
| 14 | 15 | import org.springframework.stereotype.Component; |
| 15 | 16 | |
| 16 | 17 | import java.util.*; |
| 18 | +import java.util.concurrent.TimeUnit; | |
| 17 | 19 | |
| 18 | 20 | /** |
| 19 | - * | |
| 21 | + * @author PanZhao | |
| 20 | 22 | * @ClassName: LineConfigData |
| 21 | 23 | * @Description: TODO(线路配置数据管理) |
| 22 | - * @author PanZhao | |
| 23 | 24 | * @date 2016年8月15日 下午2:50:19 |
| 24 | - * | |
| 25 | 25 | */ |
| 26 | 26 | @Component |
| 27 | 27 | @Order(value = 2) |
| 28 | 28 | public class LineConfigData implements CommandLineRunner { |
| 29 | - | |
| 30 | - Logger logger = LoggerFactory.getLogger(this.getClass()); | |
| 31 | - | |
| 32 | - // 线路编码和配置 | |
| 33 | - private Map<String, LineConfig> lineConfMap; | |
| 34 | - | |
| 35 | - @Autowired | |
| 36 | - LineConfigService lineConfigService; | |
| 37 | - | |
| 38 | - @Autowired | |
| 39 | - LineService lineService; | |
| 40 | - | |
| 41 | - @Autowired | |
| 42 | - OpLogger opLog; | |
| 43 | - | |
| 44 | - @Override | |
| 45 | - public void run(String... arg0) throws Exception { | |
| 46 | - lineConfMap = new HashMap<>(); | |
| 47 | - | |
| 48 | - Iterator<LineConfig> itr = lineConfigService.findAll().iterator(); | |
| 49 | - while (itr.hasNext()) | |
| 50 | - setBuffer(itr.next()); | |
| 51 | - | |
| 52 | - opLog.info("Line_config_data"); | |
| 53 | - } | |
| 54 | - | |
| 55 | - public LineConfig get(String lineCode){ | |
| 56 | - return lineConfMap.get(lineCode); | |
| 57 | - } | |
| 58 | - | |
| 59 | - public Collection<LineConfig> getAll(){ | |
| 60 | - return lineConfMap.values(); | |
| 61 | - } | |
| 62 | - | |
| 63 | - public void set(LineConfig conf){ | |
| 64 | - lineConfigService.save(conf); | |
| 65 | - setBuffer(conf); | |
| 66 | - } | |
| 67 | - | |
| 68 | - public void setBuffer(LineConfig conf){ | |
| 69 | - lineConfMap.put(conf.getLine().getLineCode(), conf); | |
| 70 | - } | |
| 71 | - | |
| 72 | - /** | |
| 73 | - * | |
| 74 | - * @Title: init | |
| 75 | - * @Description: TODO(初始化配置信息) | |
| 76 | - */ | |
| 77 | - public void init(String lineCode) throws Exception{ | |
| 78 | - LineConfig conf = new LineConfig(); | |
| 79 | - //线路 | |
| 80 | - Line line = lineService.findByLineCode(lineCode); | |
| 81 | - if(null == line) | |
| 82 | - throw new NullPointerException("异常的lineCode"); | |
| 83 | - | |
| 84 | - conf.setLine(line); | |
| 85 | - //开始运营时间 | |
| 86 | - conf.setStartOpt("02:00"); | |
| 87 | - //托管状态 | |
| 88 | - conf.setTrust(true); | |
| 89 | - //出场时间类型 | |
| 90 | - conf.setOutConfig(0); | |
| 91 | - //进场时间类型 | |
| 92 | - //conf.setInConfig(1); | |
| 93 | - //短语模板 | |
| 94 | - conf.setPhraseTemps(""); | |
| 95 | - //调度指令模板 | |
| 96 | - conf.setSchDirectiveTemp(""); | |
| 97 | - | |
| 98 | - //80指令回复 | |
| 99 | - D80ReplyTemp t50 = new D80ReplyTemp(conf, (short)0x50, "同意,回电详谈", "不同意,请回电") | |
| 100 | - ,t60 = new D80ReplyTemp(conf, (short)0x60, "同意,回电详谈", "不同意,请回电") | |
| 101 | - ,tA2 = new D80ReplyTemp(conf, (short)0xA2, "同意,回电详谈", "不同意,请回电") | |
| 102 | - ,t70 = new D80ReplyTemp(conf, (short)0x70, "同意,回电详谈", "不同意,请回电") | |
| 103 | - ,t11 = new D80ReplyTemp(conf, (short)0x11, "同意,回电详谈", "不同意,请回电"); | |
| 104 | - | |
| 105 | - Set<D80ReplyTemp> temps = conf.getD80Temps(); | |
| 106 | - temps.add(t50); | |
| 107 | - temps.add(t60); | |
| 108 | - temps.add(tA2); | |
| 109 | - temps.add(t70); | |
| 110 | - temps.add(t11); | |
| 111 | - | |
| 112 | - set(conf); | |
| 113 | - } | |
| 29 | + | |
| 30 | + static Logger logger = LoggerFactory.getLogger(LineConfigData.class); | |
| 31 | + | |
| 32 | + // 线路编码和配置 | |
| 33 | + private Map<String, LineConfig> lineConfMap; | |
| 34 | + | |
| 35 | + @Autowired | |
| 36 | + LineConfigService lineConfigService; | |
| 37 | + | |
| 38 | + @Autowired | |
| 39 | + LineService lineService; | |
| 40 | + | |
| 41 | + //入库缓冲 | |
| 42 | + static LinkedList<LineConfig> saveBuffers = new LinkedList<>(); | |
| 43 | + | |
| 44 | + @Autowired | |
| 45 | + LineConfigPersistThread configPersistThread; | |
| 46 | + | |
| 47 | + @Override | |
| 48 | + public void run(String... arg0) throws Exception { | |
| 49 | + lineConfMap = new HashMap<>(); | |
| 50 | + | |
| 51 | + Iterator<LineConfig> itr = lineConfigService.findAll().iterator(); | |
| 52 | + while (itr.hasNext()) | |
| 53 | + setBuffer(itr.next()); | |
| 54 | + | |
| 55 | + //异步入库 | |
| 56 | + Application.mainServices.scheduleWithFixedDelay(configPersistThread, 60, 60, TimeUnit.SECONDS); | |
| 57 | + } | |
| 58 | + | |
| 59 | + /** | |
| 60 | + * 起点发出,应用缓冲区设置参数 | |
| 61 | + * @param sch | |
| 62 | + * @param timestamp | |
| 63 | + * @return | |
| 64 | + */ | |
| 65 | + public long applyOut(ScheduleRealInfo sch, Long timestamp) { | |
| 66 | + LineConfig config = lineConfMap.get(sch.getXlBm()); | |
| 67 | + int diff = sch.getXlDir()=="0"?config.getUpOutDiff():config.getDownOutDiff(); | |
| 68 | + return timestamp - (diff * 1000); | |
| 69 | + } | |
| 70 | + | |
| 71 | + /** | |
| 72 | + * 终点到达,应用缓冲区设置参数 | |
| 73 | + * @param sch | |
| 74 | + * @param timestamp | |
| 75 | + * @return | |
| 76 | + */ | |
| 77 | + public long applyIn(ScheduleRealInfo sch, Long timestamp){ | |
| 78 | + LineConfig config = lineConfMap.get(sch.getXlBm()); | |
| 79 | + int diff = sch.getXlDir()=="0"?config.getUpInDiff():config.getDownInDiff(); | |
| 80 | + return timestamp - (diff * 1000); | |
| 81 | + } | |
| 82 | + | |
| 83 | + @Component | |
| 84 | + private static class LineConfigPersistThread extends Thread { | |
| 85 | + | |
| 86 | + @Autowired | |
| 87 | + LineConfigService lineConfigService; | |
| 88 | + | |
| 89 | + @Override | |
| 90 | + public void run() { | |
| 91 | + LineConfig config; | |
| 92 | + for (int i = 0; i < 800; i++) { | |
| 93 | + config = saveBuffers.poll(); | |
| 94 | + if (config == null) | |
| 95 | + break; | |
| 96 | + | |
| 97 | + try { | |
| 98 | + lineConfigService.save(config); | |
| 99 | + }catch (Exception e){ | |
| 100 | + logger.error("", e); | |
| 101 | + } | |
| 102 | + } | |
| 103 | + } | |
| 104 | + } | |
| 105 | + | |
| 106 | + public LineConfig get(String lineCode) { | |
| 107 | + return lineConfMap.get(lineCode); | |
| 108 | + } | |
| 109 | + | |
| 110 | + public Collection<LineConfig> getAll() { | |
| 111 | + return lineConfMap.values(); | |
| 112 | + } | |
| 113 | + | |
| 114 | + public void set(LineConfig conf) { | |
| 115 | + //lineConfigService.save(conf); | |
| 116 | + saveBuffers.add(conf); | |
| 117 | + setBuffer(conf); | |
| 118 | + } | |
| 119 | + | |
| 120 | + public void setBuffer(LineConfig conf) { | |
| 121 | + lineConfMap.put(conf.getLine().getLineCode(), conf); | |
| 122 | + } | |
| 123 | + | |
| 124 | + /** | |
| 125 | + * @Title: init | |
| 126 | + * @Description: TODO(初始化配置信息) | |
| 127 | + */ | |
| 128 | + public void init(String lineCode) throws Exception { | |
| 129 | + LineConfig conf = new LineConfig(); | |
| 130 | + //线路 | |
| 131 | + Line line = lineService.findByLineCode(lineCode); | |
| 132 | + if (null == line) | |
| 133 | + throw new NullPointerException("异常的lineCode"); | |
| 134 | + | |
| 135 | + conf.setLine(line); | |
| 136 | + //开始运营时间 | |
| 137 | + conf.setStartOpt("02:00"); | |
| 138 | + //托管状态 | |
| 139 | + conf.setTrust(true); | |
| 140 | + //出场时间类型 | |
| 141 | + conf.setOutConfig(0); | |
| 142 | + //进场时间类型 | |
| 143 | + //conf.setInConfig(1); | |
| 144 | + //短语模板 | |
| 145 | + conf.setPhraseTemps(""); | |
| 146 | + //调度指令模板 | |
| 147 | + conf.setSchDirectiveTemp(""); | |
| 148 | + | |
| 149 | + //80指令回复 闵行用 | |
| 150 | + D80ReplyTemp t50 = new D80ReplyTemp(conf, (short) 0x50, "同意,回电详谈", "不同意,请回电"), t60 = new D80ReplyTemp(conf, (short) 0x60, "同意,回电详谈", "不同意,请回电"), tA2 = new D80ReplyTemp(conf, (short) 0xA2, "同意,回电详谈", "不同意,请回电"), t70 = new D80ReplyTemp(conf, (short) 0x70, "同意,回电详谈", "不同意,请回电"), t11 = new D80ReplyTemp(conf, (short) 0x11, "同意,回电详谈", "不同意,请回电"); | |
| 151 | + | |
| 152 | + //应急停靠默认值 | |
| 153 | + conf.setYjtkStart("00:00"); | |
| 154 | + conf.setYjtkEnd("23:59"); | |
| 155 | + | |
| 156 | + Set<D80ReplyTemp> temps = conf.getD80Temps(); | |
| 157 | + temps.add(t50); | |
| 158 | + temps.add(t60); | |
| 159 | + temps.add(tA2); | |
| 160 | + temps.add(t70); | |
| 161 | + temps.add(t11); | |
| 162 | + | |
| 163 | + set(conf); | |
| 164 | + } | |
| 114 | 165 | } | ... | ... |
src/main/java/com/bsth/data/gpsdata/arrival/SignalHandle.java
| ... | ... | @@ -85,7 +85,7 @@ public abstract class SignalHandle { |
| 85 | 85 | gps.setStopNo(station.getCode()); |
| 86 | 86 | } |
| 87 | 87 | |
| 88 | - logger.info(fmtHHmm.print(gps.getTimestamp()) + " 车辆 :" + gps.getNbbm() + " 切换到走向 : " + updown); | |
| 88 | + logger.info(gps.getTimestamp() + " -" + fmtHHmm.print(gps.getTimestamp()) + " 车辆 :" + gps.getNbbm() + " 切换到走向 : " + updown); | |
| 89 | 89 | } |
| 90 | 90 | |
| 91 | 91 | /** | ... | ... |
src/main/java/com/bsth/data/gpsdata/arrival/handlers/CorrectSignalHandle.java
| ... | ... | @@ -48,12 +48,6 @@ public class CorrectSignalHandle extends SignalHandle { |
| 48 | 48 | gps.setState(0); |
| 49 | 49 | } |
| 50 | 50 | |
| 51 | - /*if(gps.getState() != 0){ | |
| 52 | - logger.info(gps.getNbbm() + " 纠正状态到营运"); | |
| 53 | - //切换到营运状态 | |
| 54 | - directiveService.send60Operation(sch.getClZbh(), 0, Integer.parseInt(sch.getXlDir()), null, "纠正@系统"); | |
| 55 | - }*/ | |
| 56 | - | |
| 57 | 51 | return true; |
| 58 | 52 | } |
| 59 | 53 | } | ... | ... |
src/main/java/com/bsth/data/gpsdata/arrival/handlers/InOutStationSignalHandle.java
| ... | ... | @@ -8,6 +8,7 @@ import com.bsth.data.gpsdata.arrival.utils.ScheduleSignalState; |
| 8 | 8 | import com.bsth.data.gpsdata.arrival.utils.SignalSchPlanMatcher; |
| 9 | 9 | import com.bsth.data.schedule.DayOfSchedule; |
| 10 | 10 | import com.bsth.data.schedule.ScheduleComparator; |
| 11 | +import com.bsth.data.schedule.late_adjust.LateAdjustHandle; | |
| 11 | 12 | import com.bsth.entity.realcontrol.LineConfig; |
| 12 | 13 | import com.bsth.entity.realcontrol.ScheduleRealInfo; |
| 13 | 14 | import com.bsth.service.directive.DirectiveService; |
| ... | ... | @@ -135,13 +136,19 @@ public class InOutStationSignalHandle extends SignalHandle{ |
| 135 | 136 | if(StringUtils.isNotEmpty(sch.getFcsjActual())) |
| 136 | 137 | return; |
| 137 | 138 | |
| 139 | + //应用到离站缓冲区设置参数 | |
| 140 | + long rsT = lineConfigData.applyOut(sch, gps.getTimestamp()); | |
| 141 | + | |
| 138 | 142 | //实发时间 |
| 139 | - sch.setFcsjActualAll(gps.getTimestamp()); | |
| 143 | + sch.setFcsjActualAll(rsT); | |
| 140 | 144 | //通知客户端 |
| 141 | 145 | sendUtils.sendFcsj(sch); |
| 142 | 146 | //持久化 |
| 143 | 147 | dayOfSchedule.save(sch); |
| 144 | 148 | |
| 149 | + //清理应发未发标记 | |
| 150 | + LateAdjustHandle.remove(sch); | |
| 151 | + | |
| 145 | 152 | if(sch.getBcType().equals("out")){ |
| 146 | 153 | //出场时,切换成营运状态 |
| 147 | 154 | directiveService.send60Operation(sch.getClZbh(), 0, Integer.parseInt(sch.getXlDir()), null, "出场@系统"); |
| ... | ... | @@ -152,12 +159,32 @@ public class InOutStationSignalHandle extends SignalHandle{ |
| 152 | 159 | } |
| 153 | 160 | else if(sch.getBcType().equals("out")){ |
| 154 | 161 | ScheduleRealInfo next = dayOfSchedule.nextSame(sch); |
| 162 | + //如果下一个班次是区间,并且是环线 | |
| 163 | + if(next != null && next.getBcType().equals("region")){ | |
| 164 | + next = dayOfSchedule.nextSame(next); | |
| 165 | + if(next == null || !next.getQdzName().equals(next.getZdzName())){ | |
| 166 | + return; | |
| 167 | + } | |
| 168 | + } | |
| 155 | 169 | if(next != null && prev.getStopNo().equals(next.getQdzCode())){ |
| 156 | 170 | //发下一个班次 |
| 157 | 171 | dayOfSchedule.addExecPlan(next); |
| 158 | 172 | outStation(gps, prev); |
| 159 | 173 | } |
| 160 | 174 | } |
| 175 | + //当前班次是区间 | |
| 176 | + else if(sch.getBcType().equals("region")){ | |
| 177 | + ScheduleRealInfo next = dayOfSchedule.nextSame(sch); | |
| 178 | + if(next==null || !next.getQdzName().equals(next.getZdzName())){ | |
| 179 | + return; | |
| 180 | + } | |
| 181 | + //是环线 | |
| 182 | + if(prev.getStopNo().equals(next.getQdzCode())){ | |
| 183 | + //发下一个班次 | |
| 184 | + dayOfSchedule.addExecPlan(next); | |
| 185 | + outStation(gps, prev); | |
| 186 | + } | |
| 187 | + } | |
| 161 | 188 | } |
| 162 | 189 | |
| 163 | 190 | |
| ... | ... | @@ -215,24 +242,39 @@ public class InOutStationSignalHandle extends SignalHandle{ |
| 215 | 242 | if(StringUtils.isNotEmpty(sch.getZdsjActual())) |
| 216 | 243 | return; |
| 217 | 244 | |
| 218 | - sch.setZdsjActualAll(gps.getTimestamp()); | |
| 245 | + //应用到离站缓冲区设置参数 | |
| 246 | + long rsT = lineConfigData.applyIn(sch, gps.getTimestamp()); | |
| 247 | + | |
| 248 | + sch.setZdsjActualAll(rsT); | |
| 249 | + | |
| 250 | + //通知误点停靠程序,有车辆到站 | |
| 251 | + LateAdjustHandle.carArrive(gps); | |
| 252 | + | |
| 219 | 253 | //已完成班次数 |
| 220 | 254 | int doneSum = dayOfSchedule.doneSum(sch.getClZbh()); |
| 221 | 255 | ScheduleRealInfo next = dayOfSchedule.next(sch); |
| 222 | - //通知客户端 | |
| 223 | - sendUtils.sendZdsj(sch, next, doneSum); | |
| 224 | 256 | //持久化 |
| 225 | 257 | dayOfSchedule.save(sch); |
| 226 | 258 | |
| 227 | - //准备执行下一个班次 | |
| 228 | - if (next != null) { | |
| 229 | - next.setQdzArrDatesj(sch.getZdsjActual()); | |
| 259 | + if(next != null){ | |
| 230 | 260 | dayOfSchedule.addExecPlan(next); |
| 231 | 261 | //进站既进场 |
| 232 | 262 | inStationAndInPark(sch, next); |
| 263 | + } | |
| 264 | + | |
| 265 | + //该路牌的下一个班次,起点实际到达时间 | |
| 266 | + ScheduleRealInfo lpNext = dayOfSchedule.nextByLp(sch); | |
| 267 | + if(lpNext != null){ | |
| 268 | + lpNext.setQdzArrDatesj(sch.getZdsjActual()); | |
| 269 | + } | |
| 270 | + | |
| 271 | + //通知客户端 | |
| 272 | + sendUtils.sendZdsj(sch, lpNext, doneSum); | |
| 273 | + | |
| 274 | + //准备执行下一个班次 | |
| 275 | + if (next != null) { | |
| 233 | 276 | //将gps转换为下一个班次走向的站内信号 |
| 234 | 277 | transformUpdown(gps, next); |
| 235 | - | |
| 236 | 278 | //下发调度指令 |
| 237 | 279 | directiveService.send60Dispatch(next, doneSum, "到站@系统"); |
| 238 | 280 | |
| ... | ... | @@ -254,7 +296,7 @@ public class InOutStationSignalHandle extends SignalHandle{ |
| 254 | 296 | //如果当前班次是出场,并且进的是下一个班次的终点 |
| 255 | 297 | if(sch.getBcType().equals("out")){ |
| 256 | 298 | ScheduleRealInfo next = dayOfSchedule.next(sch); |
| 257 | - if(next.getZdzCode().equals(gps.getStopNo())){ | |
| 299 | + if(next != null && next.getZdzCode().equals(gps.getStopNo())){ | |
| 258 | 300 | List<ScheduleRealInfo> halfList = dayOfSchedule.findByNbbm(sch.getClZbh()); |
| 259 | 301 | //和当前进站信号最匹配的一个班次 |
| 260 | 302 | ScheduleRealInfo nearSch = nearScheduleByGpsIn(gps, halfList); | ... | ... |
src/main/java/com/bsth/data/gpsdata/arrival/handlers/OfflineSignalHandle.java
| ... | ... | @@ -30,7 +30,8 @@ public class OfflineSignalHandle extends SignalHandle{ |
| 30 | 30 | |
| 31 | 31 | if(isNotEmpty(prevs)){ |
| 32 | 32 | GpsEntity prev = prevs.getTail(); |
| 33 | - int space = (int) (gps.getTimestamp() - prev.getTimestamp()); | |
| 33 | + //间隔太大就丢弃,不管之前还是之后 | |
| 34 | + int space = Math.abs((int) (gps.getTimestamp() - prev.getTimestamp())); | |
| 34 | 35 | if(space > OFFLINE_TIME) |
| 35 | 36 | gps.setSignalState("reconnection"); |
| 36 | 37 | ... | ... |
src/main/java/com/bsth/data/gpsdata/recovery/GpsDataRecovery.java
| ... | ... | @@ -60,7 +60,7 @@ public class GpsDataRecovery implements ApplicationContextAware { |
| 60 | 60 | for (String nbbm : keys) { |
| 61 | 61 | Collections.sort(listMap.get(nbbm), comp); |
| 62 | 62 | threadPool.execute(new RecoveryThread(listMap.get(nbbm), count)); |
| 63 | - /*if(nbbm.equals("SXC-YD012")) | |
| 63 | + /*if(nbbm.equals("W7C-001")) | |
| 64 | 64 | new RecoveryThread(listMap.get(nbbm), count).run();*/ |
| 65 | 65 | } |
| 66 | 66 | ... | ... |
src/main/java/com/bsth/data/safe_driv/SafeDriv.java
0 → 100644
| 1 | +package com.bsth.data.safe_driv; | |
| 2 | + | |
| 3 | +/** | |
| 4 | + * 安全驾驶 | |
| 5 | + * Created by panzhao on 2017/4/6. | |
| 6 | + */ | |
| 7 | +public class SafeDriv { | |
| 8 | + | |
| 9 | + /** | |
| 10 | + * 时间 | |
| 11 | + * 2017-04-06 08:00:00.0 | |
| 12 | + */ | |
| 13 | + private String Startime; | |
| 14 | + | |
| 15 | + /** | |
| 16 | + * 时间戳 | |
| 17 | + */ | |
| 18 | + private Long ts; | |
| 19 | + | |
| 20 | + /** | |
| 21 | + * 设备编号 | |
| 22 | + */ | |
| 23 | + private String sbbh; | |
| 24 | + | |
| 25 | + /** | |
| 26 | + * 线路名称 | |
| 27 | + */ | |
| 28 | + private String xlmc; | |
| 29 | + | |
| 30 | + private String xlbm; | |
| 31 | + | |
| 32 | + /** | |
| 33 | + * 车辆自编号 | |
| 34 | + */ | |
| 35 | + private String clzbh; | |
| 36 | + | |
| 37 | + /** | |
| 38 | + * 车牌号 | |
| 39 | + */ | |
| 40 | + private String cph; | |
| 41 | + | |
| 42 | + /** | |
| 43 | + * 检查属性 | |
| 44 | + * 双脱手 0 单脱手 1 其他为0都是异常 | |
| 45 | + */ | |
| 46 | + private String jctype; | |
| 47 | + | |
| 48 | + /** | |
| 49 | + * 异常种类 | |
| 50 | + * 手部检测: 1 | |
| 51 | + * 脸部检测: 5 | |
| 52 | + * 摄像头检测: 2 | |
| 53 | + * 安全带检测: 3 | |
| 54 | + * 袖章检测: 4 | |
| 55 | + */ | |
| 56 | + private String yczltype; | |
| 57 | + | |
| 58 | + @Override | |
| 59 | + public int hashCode() { | |
| 60 | + return ("safe_" + (this.getClzbh() + this.getStartime())).hashCode(); | |
| 61 | + } | |
| 62 | + | |
| 63 | + @Override | |
| 64 | + public boolean equals(Object obj) { | |
| 65 | + SafeDriv s2 = (SafeDriv)obj; | |
| 66 | + return (this.getClzbh() + this.getStartime()).equals(s2.getClzbh() + s2.getStartime()); | |
| 67 | + } | |
| 68 | + | |
| 69 | + public String getStartime() { | |
| 70 | + return Startime; | |
| 71 | + } | |
| 72 | + | |
| 73 | + public void setStartime(String startime) { | |
| 74 | + Startime = startime; | |
| 75 | + } | |
| 76 | + | |
| 77 | + public String getSbbh() { | |
| 78 | + return sbbh; | |
| 79 | + } | |
| 80 | + | |
| 81 | + public void setSbbh(String sbbh) { | |
| 82 | + this.sbbh = sbbh; | |
| 83 | + } | |
| 84 | + | |
| 85 | + public String getXlmc() { | |
| 86 | + return xlmc; | |
| 87 | + } | |
| 88 | + | |
| 89 | + public void setXlmc(String xlmc) { | |
| 90 | + this.xlmc = xlmc; | |
| 91 | + } | |
| 92 | + | |
| 93 | + public String getClzbh() { | |
| 94 | + return clzbh; | |
| 95 | + } | |
| 96 | + | |
| 97 | + public void setClzbh(String clzbh) { | |
| 98 | + this.clzbh = clzbh; | |
| 99 | + } | |
| 100 | + | |
| 101 | + public String getCph() { | |
| 102 | + return cph; | |
| 103 | + } | |
| 104 | + | |
| 105 | + public void setCph(String cph) { | |
| 106 | + this.cph = cph; | |
| 107 | + } | |
| 108 | + | |
| 109 | + public String getJctype() { | |
| 110 | + return jctype; | |
| 111 | + } | |
| 112 | + | |
| 113 | + public void setJctype(String jctype) { | |
| 114 | + this.jctype = jctype; | |
| 115 | + } | |
| 116 | + | |
| 117 | + public String getYczltype() { | |
| 118 | + return yczltype; | |
| 119 | + } | |
| 120 | + | |
| 121 | + public void setYczltype(String yczltype) { | |
| 122 | + this.yczltype = yczltype; | |
| 123 | + } | |
| 124 | + | |
| 125 | + public Long getTs() { | |
| 126 | + return ts; | |
| 127 | + } | |
| 128 | + | |
| 129 | + public void setTs(Long ts) { | |
| 130 | + this.ts = ts; | |
| 131 | + } | |
| 132 | + | |
| 133 | + public String getXlbm() { | |
| 134 | + return xlbm; | |
| 135 | + } | |
| 136 | + | |
| 137 | + public void setXlbm(String xlbm) { | |
| 138 | + this.xlbm = xlbm; | |
| 139 | + } | |
| 140 | +} | ... | ... |
src/main/java/com/bsth/data/safe_driv/SafeDrivCenter.java
0 → 100644
| 1 | +package com.bsth.data.safe_driv; | |
| 2 | + | |
| 3 | +import com.bsth.websocket.handler.SendUtils; | |
| 4 | +import org.joda.time.format.DateTimeFormat; | |
| 5 | +import org.joda.time.format.DateTimeFormatter; | |
| 6 | +import org.springframework.beans.BeansException; | |
| 7 | +import org.springframework.beans.factory.annotation.Autowired; | |
| 8 | +import org.springframework.boot.CommandLineRunner; | |
| 9 | +import org.springframework.context.ApplicationContext; | |
| 10 | +import org.springframework.context.ApplicationContextAware; | |
| 11 | +import org.springframework.stereotype.Component; | |
| 12 | + | |
| 13 | +import java.util.HashMap; | |
| 14 | +import java.util.HashSet; | |
| 15 | +import java.util.Map; | |
| 16 | +import java.util.Set; | |
| 17 | + | |
| 18 | +/** | |
| 19 | + * 安全驾驶 | |
| 20 | + * Created by panzhao on 2017/4/6. | |
| 21 | + */ | |
| 22 | +@Component | |
| 23 | +public class SafeDrivCenter implements CommandLineRunner,ApplicationContextAware { | |
| 24 | + | |
| 25 | + private static Set<SafeDriv> data; | |
| 26 | + | |
| 27 | + @Autowired | |
| 28 | + SafeDrivDataLoadThread safeDrivDataLoadThread; | |
| 29 | + | |
| 30 | + static SendUtils sendUtils; | |
| 31 | + | |
| 32 | + /** | |
| 33 | + * 车辆自编号 和 最新一条数据对照 | |
| 34 | + */ | |
| 35 | + private static Map<String, SafeDriv> safeMap; | |
| 36 | + | |
| 37 | + static { | |
| 38 | + data = new HashSet<>(); | |
| 39 | + safeMap = new HashMap<>(); | |
| 40 | + } | |
| 41 | + | |
| 42 | + private static DateTimeFormatter fmt = DateTimeFormat.forPattern("yyyy-MM-dd HH:mm:ss.SSS"); | |
| 43 | + public static void put(SafeDriv sd){ | |
| 44 | + sd.setTs(fmt.parseMillis(sd.getStartime())); | |
| 45 | + | |
| 46 | + if(sd.getYczltype().indexOf("A") == -1) | |
| 47 | + sd.setYczltype("A" + sd.getYczltype()); | |
| 48 | + | |
| 49 | + //SafeDriv old = safeMap.get(sd.getClzbh()); | |
| 50 | + if(!data.contains(sd)){ | |
| 51 | + //通知客户端 | |
| 52 | + sendUtils.sendSafeDriv(sd); | |
| 53 | + data.add(sd); | |
| 54 | + safeMap.put(sd.getClzbh(), sd); | |
| 55 | + } | |
| 56 | + } | |
| 57 | + | |
| 58 | + public static Set<SafeDriv> findAll(){ | |
| 59 | + return data; | |
| 60 | + } | |
| 61 | + | |
| 62 | + public static void clear(){ | |
| 63 | + data = new HashSet<>(); | |
| 64 | + safeMap = new HashMap<>(); | |
| 65 | + } | |
| 66 | + | |
| 67 | + @Override | |
| 68 | + public void run(String... strings) throws Exception { | |
| 69 | + //定时加载安全驾驶数据 | |
| 70 | + //Application.mainServices.scheduleWithFixedDelay(safeDrivDataLoadThread, 60, 4, TimeUnit.SECONDS); | |
| 71 | + } | |
| 72 | + | |
| 73 | + @Override | |
| 74 | + public void setApplicationContext(ApplicationContext applicationContext) throws BeansException { | |
| 75 | + sendUtils = applicationContext.getBean(SendUtils.class); | |
| 76 | + } | |
| 77 | +} | ... | ... |
src/main/java/com/bsth/data/safe_driv/SafeDrivDataLoadThread.java
0 → 100644
| 1 | +package com.bsth.data.safe_driv; | |
| 2 | + | |
| 3 | +import com.alibaba.fastjson.JSON; | |
| 4 | +import org.apache.http.HttpEntity; | |
| 5 | +import org.apache.http.client.methods.CloseableHttpResponse; | |
| 6 | +import org.apache.http.client.methods.HttpGet; | |
| 7 | +import org.apache.http.impl.client.CloseableHttpClient; | |
| 8 | +import org.apache.http.impl.client.HttpClients; | |
| 9 | +import org.slf4j.Logger; | |
| 10 | +import org.slf4j.LoggerFactory; | |
| 11 | +import org.springframework.stereotype.Component; | |
| 12 | + | |
| 13 | +import java.io.BufferedReader; | |
| 14 | +import java.io.InputStreamReader; | |
| 15 | +import java.util.List; | |
| 16 | + | |
| 17 | +/** | |
| 18 | + * 安全驾驶数据加载线程 | |
| 19 | + * Created by panzhao on 2017/4/6. | |
| 20 | + */ | |
| 21 | +@Component | |
| 22 | +public class SafeDrivDataLoadThread extends Thread{ | |
| 23 | + | |
| 24 | + private final static String url = "http://180.166.5.82:9988//bsth-safedriving/Crlcxb/realtimeInterface.do"; | |
| 25 | + | |
| 26 | + Logger logger = LoggerFactory.getLogger(this.getClass()); | |
| 27 | + | |
| 28 | + @Override | |
| 29 | + public void run() { | |
| 30 | + List<SafeDriv> list = null; | |
| 31 | + CloseableHttpClient httpClient = null; | |
| 32 | + CloseableHttpResponse response = null; | |
| 33 | + try { | |
| 34 | + httpClient = HttpClients.createDefault(); | |
| 35 | + HttpGet get = new HttpGet(url); | |
| 36 | + | |
| 37 | + response = httpClient.execute(get); | |
| 38 | + | |
| 39 | + HttpEntity entity = response.getEntity(); | |
| 40 | + if (null != entity) { | |
| 41 | + BufferedReader br = new BufferedReader(new InputStreamReader(entity.getContent())); | |
| 42 | + StringBuffer stringBuffer = new StringBuffer(); | |
| 43 | + String str = ""; | |
| 44 | + while ((str = br.readLine()) != null) | |
| 45 | + stringBuffer.append(str); | |
| 46 | + | |
| 47 | + | |
| 48 | + list = JSON.parseArray(stringBuffer.toString(), SafeDriv.class); | |
| 49 | + /** | |
| 50 | + * 模拟数据 | |
| 51 | + | |
| 52 | + SafeDriv sd1 = new SafeDriv(); | |
| 53 | + sd1.setYczltype("1"); | |
| 54 | + sd1.setClzbh("W2B-001"); | |
| 55 | + sd1.setStartime("2017-04-07 08:00:00.0"); | |
| 56 | + | |
| 57 | + SafeDriv sd2 = new SafeDriv(); | |
| 58 | + sd2.setYczltype("2"); | |
| 59 | + sd2.setClzbh("W2B-002"); | |
| 60 | + sd2.setStartime("2017-04-07 08:02:00.0"); | |
| 61 | + | |
| 62 | + SafeDriv sd3 = new SafeDriv(); | |
| 63 | + sd3.setYczltype("3"); | |
| 64 | + sd3.setClzbh("W2B-003"); | |
| 65 | + sd3.setStartime("2017-04-07 08:03:00.0"); | |
| 66 | + | |
| 67 | + SafeDriv sd4 = new SafeDriv(); | |
| 68 | + sd4.setYczltype("4"); | |
| 69 | + sd4.setClzbh("W2B-004"); | |
| 70 | + sd4.setStartime("2017-04-07 08:04:00.0"); | |
| 71 | + | |
| 72 | + SafeDriv sd5 = new SafeDriv(); | |
| 73 | + sd5.setYczltype("5"); | |
| 74 | + sd5.setClzbh("W2B-005"); | |
| 75 | + sd5.setStartime("2017-04-07 08:05:00.0"); | |
| 76 | + | |
| 77 | + list.add(sd1); | |
| 78 | + list.add(sd2); | |
| 79 | + list.add(sd3); | |
| 80 | + list.add(sd4); | |
| 81 | + list.add(sd5); | |
| 82 | + */ | |
| 83 | + for(SafeDriv sd : list){ | |
| 84 | + SafeDrivCenter.put(sd); | |
| 85 | + } | |
| 86 | + } | |
| 87 | + | |
| 88 | + httpClient.close(); | |
| 89 | + response.close(); | |
| 90 | + } catch (Exception e) { | |
| 91 | + logger.error(e.getMessage()); | |
| 92 | + } | |
| 93 | + } | |
| 94 | +} | ... | ... |
src/main/java/com/bsth/data/schedule/DayOfSchedule.java
| ... | ... | @@ -3,12 +3,18 @@ package com.bsth.data.schedule; |
| 3 | 3 | import com.alibaba.fastjson.JSON; |
| 4 | 4 | import com.alibaba.fastjson.JSONArray; |
| 5 | 5 | import com.bsth.Application; |
| 6 | +import com.bsth.common.Constants; | |
| 7 | +import com.bsth.common.ResponseCode; | |
| 6 | 8 | import com.bsth.data.BasicData; |
| 7 | 9 | import com.bsth.data.LineConfigData; |
| 8 | 10 | import com.bsth.data.directive.DirectivesPstThread; |
| 9 | 11 | import com.bsth.data.gpsdata.GpsRealData; |
| 10 | 12 | import com.bsth.data.gpsdata.recovery.GpsDataRecovery; |
| 11 | -import com.bsth.data.schedule.thread.*; | |
| 13 | +import com.bsth.data.schedule.late_adjust.ScheduleLateThread; | |
| 14 | +import com.bsth.data.schedule.thread.CalcOilThread; | |
| 15 | +import com.bsth.data.schedule.thread.SchedulePstThread; | |
| 16 | +import com.bsth.data.schedule.thread.ScheduleRefreshThread; | |
| 17 | +import com.bsth.data.schedule.thread.SubmitToTrafficManage; | |
| 12 | 18 | import com.bsth.entity.realcontrol.LineConfig; |
| 13 | 19 | import com.bsth.entity.realcontrol.ScheduleRealInfo; |
| 14 | 20 | import com.bsth.entity.schedule.SchedulePlanInfo; |
| ... | ... | @@ -17,8 +23,9 @@ import com.bsth.service.schedule.SchedulePlanInfoService; |
| 17 | 23 | import com.bsth.util.BatchSaveUtils; |
| 18 | 24 | import com.bsth.util.DateUtils; |
| 19 | 25 | import com.bsth.websocket.handler.SendUtils; |
| 26 | +import com.google.common.base.Predicate; | |
| 20 | 27 | import com.google.common.collect.ArrayListMultimap; |
| 21 | -import com.google.common.collect.TreeMultimap; | |
| 28 | +import com.google.common.collect.Collections2; | |
| 22 | 29 | import org.apache.commons.lang3.StringUtils; |
| 23 | 30 | import org.joda.time.format.DateTimeFormat; |
| 24 | 31 | import org.joda.time.format.DateTimeFormatter; |
| ... | ... | @@ -27,6 +34,8 @@ import org.slf4j.LoggerFactory; |
| 27 | 34 | import org.springframework.beans.factory.annotation.Autowired; |
| 28 | 35 | import org.springframework.boot.CommandLineRunner; |
| 29 | 36 | import org.springframework.core.annotation.Order; |
| 37 | +import org.springframework.dao.DataIntegrityViolationException; | |
| 38 | +import org.springframework.jdbc.core.JdbcTemplate; | |
| 30 | 39 | import org.springframework.stereotype.Component; |
| 31 | 40 | |
| 32 | 41 | import java.text.ParseException; |
| ... | ... | @@ -52,16 +61,16 @@ public class DayOfSchedule implements CommandLineRunner { |
| 52 | 61 | // 按车辆分组的班次数据 |
| 53 | 62 | private static ArrayListMultimap<String, ScheduleRealInfo> nbbmScheduleMap; |
| 54 | 63 | |
| 64 | + //按路牌分组的班次数据 线路编码_路牌名称 ——> 班次list | |
| 65 | + private static ArrayListMultimap<String, ScheduleRealInfo> lpScheduleMap; | |
| 66 | + | |
| 55 | 67 | // 班次主键映射 |
| 56 | 68 | private static Map<Long, ScheduleRealInfo> id2SchedulMap; |
| 57 | 69 | |
| 58 | - // 车辆和排班起终点站对照(包括进出的停车场,区间起终点) | |
| 59 | - private static TreeMultimap<String, String> nbbm2SEStationMap; | |
| 60 | - | |
| 61 | 70 | //车辆 ——> 当前执行班次 |
| 62 | 71 | private static Map<String, ScheduleRealInfo> carExecutePlanMap; |
| 63 | 72 | |
| 64 | - // 持久化缓冲区 | |
| 73 | + // 持久化 | |
| 65 | 74 | public static LinkedList<ScheduleRealInfo> pstBuffer; |
| 66 | 75 | |
| 67 | 76 | // 排序器 |
| ... | ... | @@ -95,11 +104,12 @@ public class DayOfSchedule implements CommandLineRunner { |
| 95 | 104 | |
| 96 | 105 | static { |
| 97 | 106 | nbbmScheduleMap = ArrayListMultimap.create(); |
| 107 | + lpScheduleMap = ArrayListMultimap.create(); | |
| 108 | + | |
| 98 | 109 | id2SchedulMap = new HashMap<>(); |
| 99 | 110 | pstBuffer = new LinkedList<>(); |
| 100 | 111 | schFCSJComparator = new ScheduleComparator.FCSJ(); |
| 101 | 112 | currSchDateMap = new HashMap<>(); |
| 102 | - nbbm2SEStationMap = TreeMultimap.create(); | |
| 103 | 113 | carExecutePlanMap = new HashMap<>(); |
| 104 | 114 | |
| 105 | 115 | schedulePlanMap = new HashMap<>(); |
| ... | ... | @@ -138,11 +148,11 @@ public class DayOfSchedule implements CommandLineRunner { |
| 138 | 148 | //dataRecovery(); |
| 139 | 149 | |
| 140 | 150 | //翻班线程 |
| 141 | - Application.mainServices.scheduleWithFixedDelay(scheduleRefreshThread, 15, 240, TimeUnit.SECONDS); | |
| 151 | +// Application.mainServices.scheduleWithFixedDelay(scheduleRefreshThread, 15, 240, TimeUnit.SECONDS); | |
| 142 | 152 | //入库 |
| 143 | 153 | // Application.mainServices.scheduleWithFixedDelay(schedulePstThread, 60, 30, TimeUnit.SECONDS); |
| 144 | 154 | //班次误点扫描 |
| 145 | -// Application.mainServices.scheduleWithFixedDelay(scheduleLateThread, 60, 60, TimeUnit.SECONDS); | |
| 155 | +// Application.mainServices.scheduleWithFixedDelay(scheduleLateThread, 60, 30, TimeUnit.SECONDS); | |
| 146 | 156 | |
| 147 | 157 | //每天凌晨2点20提交数据到运管处 |
| 148 | 158 | long diff = (DateUtils.getTimestamp() + 1000 * 60 * 140) - System.currentTimeMillis(); |
| ... | ... | @@ -150,10 +160,10 @@ public class DayOfSchedule implements CommandLineRunner { |
| 150 | 160 | diff += (1000 * 60 * 60 * 24); |
| 151 | 161 | |
| 152 | 162 | logger.info(diff / 1000 / 60 + "分钟之后提交到运管处"); |
| 153 | - //Application.mainServices.scheduleWithFixedDelay(submitToTrafficManage, diff / 1000, 60 * 60 * 24, TimeUnit.SECONDS); | |
| 163 | + //Application.mainServices.scheduleAtFixedRate(submitToTrafficManage, diff / 1000, 60 * 60 * 24, TimeUnit.SECONDS); | |
| 154 | 164 | |
| 155 | 165 | //计算油、公里加注 |
| 156 | - Application.mainServices.scheduleWithFixedDelay(calcOilThread, diff / 1000, 60 * 60 * 24, TimeUnit.SECONDS); | |
| 166 | + Application.mainServices.scheduleAtFixedRate(calcOilThread, diff / 1000, 60 * 60 * 24, TimeUnit.SECONDS); | |
| 157 | 167 | |
| 158 | 168 | //指令持久化线程 |
| 159 | 169 | Application.mainServices.scheduleWithFixedDelay(directivesPstThread, 180, 180, TimeUnit.SECONDS); |
| ... | ... | @@ -226,10 +236,14 @@ public class DayOfSchedule implements CommandLineRunner { |
| 226 | 236 | //添加到缓存 |
| 227 | 237 | putAll(list); |
| 228 | 238 | |
| 239 | + | |
| 240 | + Set<String> lps = searchAllLP(list); | |
| 241 | + for(String lp : lps){ | |
| 242 | + //计算“起点站应到”时间 | |
| 243 | + schAttrCalculator.calcQdzTimePlan(lpScheduleMap.get(lineCode + "_" + lp)); | |
| 244 | + } | |
| 229 | 245 | Set<String> cars = searchAllCars(list); |
| 230 | 246 | for (String nbbm : cars) { |
| 231 | - //计算“起点站应到”时间 | |
| 232 | - schAttrCalculator.calcQdzTimePlan(nbbmScheduleMap.get(nbbm)); | |
| 233 | 247 | //车辆 ——> 要执行的班次对照 |
| 234 | 248 | reCalcExecPlan(nbbm); |
| 235 | 249 | } |
| ... | ... | @@ -244,10 +258,14 @@ public class DayOfSchedule implements CommandLineRunner { |
| 244 | 258 | return 0; |
| 245 | 259 | } |
| 246 | 260 | |
| 261 | + public int reloadSch(String lineCode){ | |
| 262 | + return reloadSch(lineCode, calcSchDate(lineCode), true); | |
| 263 | + } | |
| 264 | + | |
| 247 | 265 | /** |
| 248 | 266 | * @Title: searchAllCars |
| 249 | 267 | * @Description: TODO(搜索班次集合中的车辆) |
| 250 | - */ | |
| 268 | + */ | |
| 251 | 269 | private Set<String> searchAllCars(List<ScheduleRealInfo> list) { |
| 252 | 270 | Set<String> cars = new HashSet<>(); |
| 253 | 271 | for (ScheduleRealInfo sch : list) |
| ... | ... | @@ -256,6 +274,18 @@ public class DayOfSchedule implements CommandLineRunner { |
| 256 | 274 | return cars; |
| 257 | 275 | } |
| 258 | 276 | |
| 277 | + /** | |
| 278 | + * @Title: searchAllCars | |
| 279 | + * @Description: TODO(搜索班次集合中的路牌) | |
| 280 | + */ | |
| 281 | + private Set<String> searchAllLP(List<ScheduleRealInfo> list) { | |
| 282 | + Set<String> lps = new HashSet<>(); | |
| 283 | + for (ScheduleRealInfo sch : list) | |
| 284 | + lps.add(sch.getLpName()); | |
| 285 | + | |
| 286 | + return lps; | |
| 287 | + } | |
| 288 | + | |
| 259 | 289 | private void putAll(List<ScheduleRealInfo> list) { |
| 260 | 290 | for (ScheduleRealInfo sch : list) |
| 261 | 291 | put(sch); |
| ... | ... | @@ -301,6 +331,17 @@ public class DayOfSchedule implements CommandLineRunner { |
| 301 | 331 | } |
| 302 | 332 | } |
| 303 | 333 | |
| 334 | + //清理路牌对照 | |
| 335 | + List<String> lprms = new ArrayList<>(); | |
| 336 | + Set<String> lps = lpScheduleMap.keySet(); | |
| 337 | + for(String lp : lps){ | |
| 338 | + if(lp.indexOf(lineCode + "_") != -1) | |
| 339 | + lprms.add(lp); | |
| 340 | + } | |
| 341 | + | |
| 342 | + for(String lp : lprms) | |
| 343 | + lpScheduleMap.removeAll(lp); | |
| 344 | + | |
| 304 | 345 | logger.info(lineCode + "排班清理 " + count); |
| 305 | 346 | } |
| 306 | 347 | |
| ... | ... | @@ -379,10 +420,15 @@ public class DayOfSchedule implements CommandLineRunner { |
| 379 | 420 | sch.setLate(false); |
| 380 | 421 | } |
| 381 | 422 | |
| 423 | + //售票员为空设置为""字符串 | |
| 424 | + if(StringUtils.isEmpty(sch.getsGh())){ | |
| 425 | + sch.setsGh(""); | |
| 426 | + sch.setsName(""); | |
| 427 | + } | |
| 382 | 428 | sch.setJhlcOrig(sch.getJhlc()); |
| 383 | - //计划里程为0,设置NULL | |
| 384 | - //if (sch.getJhlc() != null && sch.getJhlc() == 0) | |
| 385 | - // sch.setJhlc(null); | |
| 429 | + //保留备注 | |
| 430 | + if(StringUtils.isNotEmpty(sch.getRemark())) | |
| 431 | + sch.setRemarks(sch.getRemark()); | |
| 386 | 432 | } |
| 387 | 433 | } catch (Exception e) { |
| 388 | 434 | logger.error("", e); |
| ... | ... | @@ -480,18 +526,31 @@ public class DayOfSchedule implements CommandLineRunner { |
| 480 | 526 | return id2SchedulMap.get(id); |
| 481 | 527 | } |
| 482 | 528 | |
| 483 | - public Set<String> getSEStationList(String nbbm) { | |
| 484 | - return nbbm2SEStationMap.get(nbbm); | |
| 485 | - } | |
| 486 | 529 | |
| 487 | 530 | /** |
| 488 | 531 | * @Title: next |
| 489 | 532 | * @Description: TODO(下一个班次) |
| 490 | 533 | */ |
| 491 | 534 | public ScheduleRealInfo next(ScheduleRealInfo sch) { |
| 535 | + List<ScheduleRealInfo> list = nbbmScheduleMap.get(sch.getClZbh()); | |
| 536 | + return next(list, sch); | |
| 537 | + } | |
| 492 | 538 | |
| 539 | + /** | |
| 540 | + * 下一个相同走向的班次 | |
| 541 | + * @param sch | |
| 542 | + * @return | |
| 543 | + */ | |
| 544 | + public ScheduleRealInfo nextSame(final ScheduleRealInfo sch){ | |
| 493 | 545 | List<ScheduleRealInfo> list = nbbmScheduleMap.get(sch.getClZbh()); |
| 494 | - int outConfig = -1; | |
| 546 | + Collection<ScheduleRealInfo> subList = Collections2.filter(list, new Predicate<ScheduleRealInfo>(){ | |
| 547 | + | |
| 548 | + @Override | |
| 549 | + public boolean apply(ScheduleRealInfo item) { | |
| 550 | + return item.getXlDir().equals(sch.getXlDir()); | |
| 551 | + } | |
| 552 | + }); | |
| 553 | + /*int outConfig = -1; | |
| 495 | 554 | LineConfig config = lineConfigData.get(sch.getXlBm()); |
| 496 | 555 | if (config != null) |
| 497 | 556 | outConfig = config.getOutConfig(); |
| ... | ... | @@ -515,21 +574,22 @@ public class DayOfSchedule implements CommandLineRunner { |
| 515 | 574 | && (!limitPark || park.equals(temp.getQdzCode()))) |
| 516 | 575 | continue; |
| 517 | 576 | |
| 518 | - if (flag) { | |
| 577 | + if (flag && temp.getXlDir().equals(sch.getXlDir())) { | |
| 519 | 578 | next = temp; |
| 520 | 579 | break; |
| 521 | 580 | } |
| 522 | - } | |
| 523 | - return next; | |
| 581 | + }*/ | |
| 582 | + return next(subList, sch); | |
| 524 | 583 | } |
| 525 | 584 | |
| 585 | + | |
| 526 | 586 | /** |
| 527 | - * 下一个相同走向的班次 | |
| 528 | - * @param sch | |
| 587 | + * 下一个班次 | |
| 588 | + * @param list 班次集合 | |
| 589 | + * @param sch 当前班次 | |
| 529 | 590 | * @return |
| 530 | 591 | */ |
| 531 | - public ScheduleRealInfo nextSame(ScheduleRealInfo sch){ | |
| 532 | - List<ScheduleRealInfo> list = nbbmScheduleMap.get(sch.getClZbh()); | |
| 592 | + private ScheduleRealInfo next(Collection<ScheduleRealInfo> list , ScheduleRealInfo sch){ | |
| 533 | 593 | int outConfig = -1; |
| 534 | 594 | LineConfig config = lineConfigData.get(sch.getXlBm()); |
| 535 | 595 | if (config != null) |
| ... | ... | @@ -554,7 +614,7 @@ public class DayOfSchedule implements CommandLineRunner { |
| 554 | 614 | && (!limitPark || park.equals(temp.getQdzCode()))) |
| 555 | 615 | continue; |
| 556 | 616 | |
| 557 | - if (flag && temp.getXlDir().equals(sch.getXlDir())) { | |
| 617 | + if (flag) { | |
| 558 | 618 | next = temp; |
| 559 | 619 | break; |
| 560 | 620 | } |
| ... | ... | @@ -610,16 +670,21 @@ public class DayOfSchedule implements CommandLineRunner { |
| 610 | 670 | |
| 611 | 671 | String nbbm = sch.getClZbh(); |
| 612 | 672 | nbbmScheduleMap.put(nbbm, sch); |
| 613 | - nbbm2SEStationMap.put(nbbm, sch.getQdzCode()); | |
| 614 | - nbbm2SEStationMap.put(nbbm, sch.getZdzCode()); | |
| 615 | 673 | |
| 616 | 674 | //主键索引 |
| 617 | 675 | id2SchedulMap.put(sch.getId(), sch); |
| 676 | + //路牌对照表 | |
| 677 | + addLPMapp(sch); | |
| 678 | + | |
| 618 | 679 | //跨24点的,再save一次 |
| 619 | 680 | if (!sch.getRealExecDate().equals(sch.getScheduleDateStr())) |
| 620 | 681 | save(sch); |
| 621 | 682 | } |
| 622 | 683 | |
| 684 | + public void addLPMapp(ScheduleRealInfo sch){ | |
| 685 | + lpScheduleMap.put(sch.getXlBm() + "_" + sch.getLpName(), sch); | |
| 686 | + } | |
| 687 | + | |
| 623 | 688 | public void delete(ScheduleRealInfo sch) { |
| 624 | 689 | //ScheduleRealInfo sch = id2SchedulMap.get(id); |
| 625 | 690 | if (!sch.isSflj()) |
| ... | ... | @@ -627,38 +692,25 @@ public class DayOfSchedule implements CommandLineRunner { |
| 627 | 692 | |
| 628 | 693 | nbbmScheduleMap.remove(sch.getClZbh(), sch); |
| 629 | 694 | id2SchedulMap.remove(sch.getId()); |
| 695 | + lpScheduleMap.remove(sch.getXlBm() + "_" + sch.getLpName(), sch); | |
| 630 | 696 | //return sch; |
| 631 | 697 | } |
| 632 | 698 | |
| 633 | -// public void calcQdzTimePlan(String nbbm){ | |
| 634 | -// schAttrCalculator.calcQdzTimePlan(nbbmScheduleMap.get(nbbm)); | |
| 635 | -// } | |
| 636 | 699 | |
| 637 | - public List<ScheduleRealInfo> updateQdzTimePlan(String nbbm) { | |
| 700 | +/* public List<ScheduleRealInfo> updateQdzTimePlan(String nbbm) { | |
| 638 | 701 | Collections.sort(nbbmScheduleMap.get(nbbm), schFCSJComparator); |
| 639 | 702 | return schAttrCalculator.updateQdzTimePlan(nbbmScheduleMap.get(nbbm)); |
| 640 | - } | |
| 641 | - | |
| 642 | - /** | |
| 643 | - * | |
| 644 | - * @Title: nextAll | |
| 645 | - * @Description: TODO(之后的所有班次) | |
| 646 | - */ | |
| 647 | -/* public List<ScheduleRealInfo> nextAll(ScheduleRealInfo sch) { | |
| 648 | - List<ScheduleRealInfo> list = nbbmScheduleMap.get(sch.getClZbh()); | |
| 649 | - // 排序 | |
| 650 | - Collections.sort(list, schFCSJComparator); | |
| 703 | + }*/ | |
| 651 | 704 | |
| 652 | - List<ScheduleRealInfo> rs = new ArrayList<>(); | |
| 653 | - ScheduleRealInfo temp; | |
| 654 | - for (int i = 0; i < list.size() - 1; i++) { | |
| 655 | - temp = list.get(i); | |
| 656 | - if(temp.getFcsjT() > sch.getFcsjT()) | |
| 657 | - rs.add(temp); | |
| 705 | + public List<ScheduleRealInfo> updateQdzTimePlan(String lpName) { | |
| 706 | + List<ScheduleRealInfo> list = lpScheduleMap.get(lpName); | |
| 707 | + Collections.sort(list, schFCSJComparator); | |
| 708 | + return schAttrCalculator.updateQdzTimePlan(list); | |
| 709 | + } | |
| 658 | 710 | |
| 659 | - } | |
| 660 | - return rs; | |
| 661 | - }*/ | |
| 711 | + public List<ScheduleRealInfo> updateQdzTimePlan(ScheduleRealInfo sch) { | |
| 712 | + return updateQdzTimePlan(sch.getXlBm() + "_" + sch.getLpName()); | |
| 713 | + } | |
| 662 | 714 | |
| 663 | 715 | /** |
| 664 | 716 | * @Title: doneSum |
| ... | ... | @@ -818,9 +870,9 @@ public class DayOfSchedule implements CommandLineRunner { |
| 818 | 870 | */ |
| 819 | 871 | public List<ScheduleRealInfo> changeCar(ScheduleRealInfo sch, String newClZbh) { |
| 820 | 872 | List<ScheduleRealInfo> ups = new ArrayList<>(); |
| 821 | - String oldClzbh = sch.getClZbh(); | |
| 873 | + /*String oldClzbh = sch.getClZbh(); | |
| 822 | 874 | if (oldClzbh.equals(newClZbh)) |
| 823 | - return ups; | |
| 875 | + return ups;*/ | |
| 824 | 876 | |
| 825 | 877 | |
| 826 | 878 | //变更相关映射信息 |
| ... | ... | @@ -828,12 +880,10 @@ public class DayOfSchedule implements CommandLineRunner { |
| 828 | 880 | |
| 829 | 881 | sch.setClZbh(newClZbh); |
| 830 | 882 | nbbmScheduleMap.put(newClZbh, sch); |
| 831 | - nbbm2SEStationMap.put(newClZbh, sch.getQdzCode()); | |
| 832 | - nbbm2SEStationMap.put(newClZbh, sch.getZdzCode()); | |
| 833 | 883 | |
| 834 | 884 | //重新计算班次应到时间 |
| 835 | - ups.addAll(updateQdzTimePlan(oldClzbh)); | |
| 836 | - ups.addAll(updateQdzTimePlan(newClZbh)); | |
| 885 | + //ups.addAll(updateQdzTimePlan(oldClzbh)); | |
| 886 | + //ups.addAll(updateQdzTimePlan(newClZbh)); | |
| 837 | 887 | |
| 838 | 888 | //重新计算车辆当前执行班次 |
| 839 | 889 | reCalcExecPlan(newClZbh); |
| ... | ... | @@ -850,7 +900,9 @@ public class DayOfSchedule implements CommandLineRunner { |
| 850 | 900 | } |
| 851 | 901 | |
| 852 | 902 | public void reCalcExecPlan(String nbbm){ |
| 853 | - carExecutePlanMap.put(nbbm, schAttrCalculator.calcCurrentExecSch(nbbmScheduleMap.get(nbbm))); | |
| 903 | + List<ScheduleRealInfo> list = nbbmScheduleMap.get(nbbm); | |
| 904 | + Collections.sort(list, schFCSJComparator); | |
| 905 | + carExecutePlanMap.put(nbbm, schAttrCalculator.calcCurrentExecSch(list)); | |
| 854 | 906 | } |
| 855 | 907 | |
| 856 | 908 | /** |
| ... | ... | @@ -875,44 +927,90 @@ public class DayOfSchedule implements CommandLineRunner { |
| 875 | 927 | return false; |
| 876 | 928 | } |
| 877 | 929 | |
| 930 | + | |
| 931 | + @Autowired | |
| 932 | + JdbcTemplate jdbcTemplate; | |
| 878 | 933 | /** |
| 879 | - * 获取班次的计划停站时间 | |
| 880 | - * @param sch | |
| 934 | + * 删除实际排班 | |
| 935 | + * @param lineCode | |
| 881 | 936 | * @return |
| 937 | + */ | |
| 938 | + public Map<String, Object> deleteRealSchedule(String lineCode) { | |
| 939 | + Map<String, Object> rs = new HashMap<>(); | |
| 882 | 940 | |
| 883 | - public int stopTimePlan(Object task) { | |
| 941 | + try { | |
| 942 | + String rq = currSchDateMap.get(lineCode); | |
| 943 | + if(StringUtils.isNotEmpty(rq)){ | |
| 944 | + List<ScheduleRealInfo> all = findByLineCode(lineCode); | |
| 945 | + //解除gps 和班次之间的关联 | |
| 946 | + List<ScheduleRealInfo> unions = calcUnion(all, carExecutePlanMap.values()); | |
| 947 | + for(ScheduleRealInfo sch : unions){ | |
| 948 | + removeExecPlan(sch.getClZbh()); | |
| 949 | + } | |
| 950 | + //解除调度指令和班次的外键约束 | |
| 951 | + StringBuilder inStr = new StringBuilder("("); | |
| 952 | + for(ScheduleRealInfo sch : all){ | |
| 953 | + inStr.append(sch.getId() + ","); | |
| 954 | + } | |
| 955 | + inStr.deleteCharAt(inStr.length() - 1).append(")"); | |
| 956 | + jdbcTemplate.update(Constants.MULTI_REMOVE_DIRECTIVE_SCH_FK + " " + inStr.toString()); | |
| 884 | 957 | |
| 885 | - ScheduleRealInfo sch = prev((ScheduleRealInfo) task); | |
| 958 | + //删除班次数据 | |
| 959 | + removeRealSch(lineCode, rq); | |
| 960 | + //删除相关班次修正记录 | |
| 886 | 961 | |
| 887 | - sch.getzdsj | |
| 888 | - return -1; | |
| 889 | - }*/ | |
| 962 | + } | |
| 963 | + rs.put("status", ResponseCode.SUCCESS); | |
| 964 | + }catch (Exception e){ | |
| 965 | + logger.error("", e); | |
| 966 | + rs.put("status", ResponseCode.ERROR); | |
| 967 | + if(e instanceof DataIntegrityViolationException) | |
| 968 | + rs.put("msg", "失败,违反数据约束!!"); | |
| 969 | + else | |
| 970 | + rs.put("msg", e.getMessage()); | |
| 971 | + } | |
| 972 | + | |
| 973 | + return rs; | |
| 974 | + } | |
| 890 | 975 | |
| 891 | 976 | /** |
| 977 | + * 计算并集 | |
| 892 | 978 | * |
| 893 | - * @Title: linkToSchPlan | |
| 894 | - * @Description: TODO(车辆关联到班次) | |
| 979 | + * @param all | |
| 980 | + * @param sub | |
| 981 | + * @return | |
| 895 | 982 | */ |
| 896 | -/* public void linkToSchPlan(String nbbm) { | |
| 897 | - //当前GPS状态 | |
| 898 | - GpsEntity gps = gpsRealData.get(BasicData.deviceId2NbbmMap.inverse().get(nbbm)); | |
| 899 | - if(null == gps) | |
| 900 | - return; | |
| 901 | - | |
| 902 | - //班次集合 | |
| 903 | - List<ScheduleRealInfo> schArr = nbbmScheduleMap.get(nbbm); | |
| 904 | - | |
| 905 | - for(ScheduleRealInfo sch : schArr){ | |
| 906 | - if(sch.getStatus() == 2) | |
| 907 | - continue; | |
| 908 | - if(sch.isDestroy()) | |
| 909 | - continue; | |
| 910 | - if(!sch.getXlBm().equals(gps.getLineId()) | |
| 911 | - || Integer.parseInt(sch.getXlDir()) != gps.getUpDown().intValue()) | |
| 912 | - continue; | |
| 913 | - | |
| 914 | - addExecPlan(sch); | |
| 915 | - break; | |
| 916 | - } | |
| 917 | - }*/ | |
| 983 | + public List<ScheduleRealInfo> calcUnion(Collection<ScheduleRealInfo> c1, Collection<ScheduleRealInfo> c2) { | |
| 984 | + List<ScheduleRealInfo> rs = new ArrayList<>(); | |
| 985 | + | |
| 986 | + for (ScheduleRealInfo sch : c1) { | |
| 987 | + if(c2.contains(sch)){ | |
| 988 | + rs.add(sch); | |
| 989 | + } | |
| 990 | + } | |
| 991 | + return rs; | |
| 992 | + } | |
| 993 | + | |
| 994 | + /** | |
| 995 | + * 覆盖一辆车的所有班次 | |
| 996 | + * @param nbbm | |
| 997 | + * @param sets | |
| 998 | + */ | |
| 999 | + public void replaceByNbbm(String nbbm, Set<ScheduleRealInfo> sets){ | |
| 1000 | + nbbmScheduleMap.removeAll(nbbm); | |
| 1001 | + nbbmScheduleMap.putAll(nbbm, sets); | |
| 1002 | + //重新计算班次应到时间 | |
| 1003 | + updateQdzTimePlan(nbbm); | |
| 1004 | + } | |
| 1005 | + | |
| 1006 | + /** | |
| 1007 | + * 获取该班次所在路牌的下一个班次 | |
| 1008 | + * @param sch | |
| 1009 | + * @return | |
| 1010 | + */ | |
| 1011 | + public ScheduleRealInfo nextByLp(ScheduleRealInfo sch) { | |
| 1012 | + List<ScheduleRealInfo> list = lpScheduleMap.get(sch.getXlBm() + "_" + sch.getLpName()); | |
| 1013 | + Collections.sort(list, schFCSJComparator); | |
| 1014 | + return next(list, sch); | |
| 1015 | + } | |
| 918 | 1016 | } |
| 919 | 1017 | \ No newline at end of file | ... | ... |
src/main/java/com/bsth/data/schedule/SchAttrCalculator.java
| ... | ... | @@ -104,7 +104,7 @@ public class SchAttrCalculator { |
| 104 | 104 | /** |
| 105 | 105 | * |
| 106 | 106 | * @Title: calcQdzTimePlan |
| 107 | - * @Description: TODO(计算班次的起点应到时间,list 必须是同一辆车的班次) | |
| 107 | + * @Description: TODO(计算班次的起点应到时间) | |
| 108 | 108 | */ |
| 109 | 109 | public void calcQdzTimePlan(List<ScheduleRealInfo> list){ |
| 110 | 110 | Collections.sort(list, new ScheduleComparator.FCSJ()); |
| ... | ... | @@ -116,12 +116,13 @@ public class SchAttrCalculator { |
| 116 | 116 | ScheduleRealInfo prve = list.get(0), curr; |
| 117 | 117 | for(int i = 1; i < len; i ++){ |
| 118 | 118 | curr = list.get(i); |
| 119 | - if(prve.getZdzName().equals(curr.getQdzName())){ | |
| 119 | + | |
| 120 | + if(prve.getZdzName().equals(curr.getQdzName()) | |
| 121 | + || prve.getZdzCode().equals(curr.getQdzCode())){ | |
| 120 | 122 | curr.setQdzArrDateJH(prve.getZdsj()); |
| 121 | - if(StringUtils.isNotEmpty(prve.getZdsjActual()) && StringUtils.isEmpty(curr.getQdzArrDatesj())) | |
| 123 | + if(StringUtils.isNotEmpty(prve.getZdsjActual())) | |
| 122 | 124 | curr.setQdzArrDatesj(prve.getZdsjActual()); |
| 123 | 125 | } |
| 124 | - | |
| 125 | 126 | prve = curr; |
| 126 | 127 | } |
| 127 | 128 | } |
| ... | ... | @@ -129,7 +130,7 @@ public class SchAttrCalculator { |
| 129 | 130 | /** |
| 130 | 131 | * |
| 131 | 132 | * @Title: updateQdzTimePlan |
| 132 | - * @Description: TODO(更新班次的起点应到时间,list 必须是同一辆车的班次) 并返回被更新的班次 | |
| 133 | + * @Description: TODO(更新班次的起点应到时间) 并返回被更新的班次 | |
| 133 | 134 | */ |
| 134 | 135 | public List<ScheduleRealInfo> updateQdzTimePlan(List<ScheduleRealInfo> list){ |
| 135 | 136 | Collections.sort(list, new ScheduleComparator.FCSJ()); |
| ... | ... | @@ -143,7 +144,8 @@ public class SchAttrCalculator { |
| 143 | 144 | for(int i = 1; i < len; i ++){ |
| 144 | 145 | curr = list.get(i); |
| 145 | 146 | |
| 146 | - if(prve.getZdzName().equals(curr.getQdzName())){ | |
| 147 | + if(prve.getZdzName().equals(curr.getQdzName()) | |
| 148 | + || prve.getZdzCode().equals(curr.getQdzCode())){ | |
| 147 | 149 | |
| 148 | 150 | if(curr.getQdzArrDateJH() != null && prve.getZdsj().equals(curr.getQdzArrDateJH())){ |
| 149 | 151 | prve = curr; | ... | ... |
src/main/java/com/bsth/data/schedule/late_adjust/LateAdjustHandle.java
0 → 100644
| 1 | + | |
| 2 | +package com.bsth.data.schedule.late_adjust; | |
| 3 | + | |
| 4 | +import com.bsth.data.BasicData; | |
| 5 | +import com.bsth.data.LineConfigData; | |
| 6 | +import com.bsth.data.gpsdata.GpsEntity; | |
| 7 | +import com.bsth.entity.realcontrol.LineConfig; | |
| 8 | +import com.bsth.entity.realcontrol.ScheduleRealInfo; | |
| 9 | +import com.bsth.util.Arith; | |
| 10 | +import com.bsth.websocket.handler.SendUtils; | |
| 11 | +import org.slf4j.Logger; | |
| 12 | +import org.slf4j.LoggerFactory; | |
| 13 | +import org.springframework.beans.BeansException; | |
| 14 | +import org.springframework.context.ApplicationContext; | |
| 15 | +import org.springframework.context.ApplicationContextAware; | |
| 16 | +import org.springframework.stereotype.Component; | |
| 17 | + | |
| 18 | +import java.util.Collection; | |
| 19 | +import java.util.HashMap; | |
| 20 | +import java.util.Map; | |
| 21 | + | |
| 22 | +/** | |
| 23 | + * 误点自动调整待发 处理程序 | |
| 24 | + * | |
| 25 | + * 注意 :这里的误点是指应发未到 | |
| 26 | + * Created by panzhao on 2017/4/16. | |
| 27 | + */ | |
| 28 | +@Component | |
| 29 | +public class LateAdjustHandle implements ApplicationContextAware{ | |
| 30 | + | |
| 31 | + static LineConfigData lineConfigData; | |
| 32 | + static SendUtils sendUtils; | |
| 33 | + | |
| 34 | + static Logger logger = LoggerFactory.getLogger(LateAdjustHandle.class); | |
| 35 | + | |
| 36 | + /** | |
| 37 | + * 应发未到车辆 和 班次 | |
| 38 | + */ | |
| 39 | + private static Map<String, ScheduleRealInfo> lateSchMap; | |
| 40 | + | |
| 41 | + | |
| 42 | + static { | |
| 43 | + lateSchMap = new HashMap<>(); | |
| 44 | + } | |
| 45 | + | |
| 46 | + /** | |
| 47 | + * 新增一个误点班次 | |
| 48 | + * @param sch | |
| 49 | + */ | |
| 50 | + public static void putLate(ScheduleRealInfo sch){ | |
| 51 | + try { | |
| 52 | + //进出场班次不需要 | |
| 53 | + if(sch.getBcType().equals("in") || sch.getBcType().equals("out")) | |
| 54 | + return; | |
| 55 | + //线路配置 | |
| 56 | + LineConfig config = lineConfigData.get(sch.getXlBm()); | |
| 57 | + if(sch.getLateMinute() == 0){ | |
| 58 | + if(config.isEnableYjtk()){ | |
| 59 | + sch.setLateMinute(sch.getXlDir().equals("0")?config.getUpStopMinute():config.getDownStopMinute()); | |
| 60 | + } | |
| 61 | + else | |
| 62 | + return; | |
| 63 | + } | |
| 64 | + | |
| 65 | + if(sch.getDfsj().compareTo(config.getYjtkStart()) > 0 | |
| 66 | + && sch.getDfsj().compareTo(config.getYjtkEnd()) <= 0){ | |
| 67 | + | |
| 68 | + ScheduleRealInfo cancel = null; | |
| 69 | + //之前存在误点班次没有发出 | |
| 70 | + ScheduleRealInfo old = lateSchMap.get(sch.getClZbh()); | |
| 71 | + if(old != null && old.getDfsjT() < sch.getDfsjT()){ | |
| 72 | + remove(old); | |
| 73 | + cancel = old; | |
| 74 | + logger.info("【应发未到】old 班次 " + old.getId() + " -被覆盖!"); | |
| 75 | + } | |
| 76 | + | |
| 77 | + lateSchMap.put(sch.getClZbh(), sch); | |
| 78 | + //通知客户端 | |
| 79 | + sch.setLate2(true); | |
| 80 | + sendUtils.sendAutoWdtz(sch, cancel); | |
| 81 | + | |
| 82 | + logger.info("【应发未到】班次 " + sch.getClZbh() + " -" + sch.getDfsj() + " -id: " + sch.getId() + " -加入误点调整!"); | |
| 83 | + } | |
| 84 | + }catch (Exception e){ | |
| 85 | + logger.error("", e); | |
| 86 | + } | |
| 87 | + } | |
| 88 | + | |
| 89 | + | |
| 90 | + /** | |
| 91 | + * 获取所有应发未到的班次 | |
| 92 | + * @return | |
| 93 | + */ | |
| 94 | + public static Collection<ScheduleRealInfo> allLateSch(){ | |
| 95 | + return lateSchMap.values(); | |
| 96 | + } | |
| 97 | + | |
| 98 | + public static void remove(ScheduleRealInfo sch){ | |
| 99 | + try { | |
| 100 | + if(lateSchMap.get(sch.getClZbh()) == sch){ | |
| 101 | + lateSchMap.remove(sch.getClZbh()); | |
| 102 | + sch.setLate2(false); | |
| 103 | + sch.setLateMinute(0); | |
| 104 | + } | |
| 105 | + }catch (Exception e){ | |
| 106 | + logger.error("", e); | |
| 107 | + } | |
| 108 | + } | |
| 109 | + | |
| 110 | + /** | |
| 111 | + * 车辆到站 | |
| 112 | + * @param gps | |
| 113 | + */ | |
| 114 | + public static void carArrive(GpsEntity gps){ | |
| 115 | + try{ | |
| 116 | + if(gps.getInstation() != 1) | |
| 117 | + return; | |
| 118 | + | |
| 119 | + ScheduleRealInfo sch = lateSchMap.get(gps.getNbbm()); | |
| 120 | + if(sch == null) | |
| 121 | + return; | |
| 122 | + | |
| 123 | + //进的是班次起点(名称一样即可) | |
| 124 | + gps.setStationName(BasicData.stationCode2NameMap.get(gps.getLineId() + "_" + gps.getUpDown() + "_" + gps.getStopNo())); | |
| 125 | + if(gps.getStationName().equals(sch.getQdzName()) | |
| 126 | + && sch.getLateMinute() > 0){ | |
| 127 | + //自动调整待发 到达时间 + 停靠时间 | |
| 128 | + long dt = Arith.addLong(gps.getTimestamp(), (sch.getLateMinute() * 60 * 1000)); | |
| 129 | + sch.setDfsjAll(dt); | |
| 130 | + sch.setDfAuto(true); | |
| 131 | + //取消应发未到标记 | |
| 132 | + sch.setLate2(false); | |
| 133 | + | |
| 134 | + lateSchMap.remove(sch.getClZbh()); | |
| 135 | + logger.info("【应发未到】车辆到站 " + sch.getClZbh() + " -" + sch.getDfsj() + " -到站时间:" + gps.getTimestamp() + " -停靠时间:" + sch.getLateMinute() + " -自动设置的待发时间:" + dt); | |
| 136 | + } | |
| 137 | + }catch (Exception e){ | |
| 138 | + e.printStackTrace(); | |
| 139 | + logger.error("", e); | |
| 140 | + } | |
| 141 | + } | |
| 142 | + | |
| 143 | + @Override | |
| 144 | + public void setApplicationContext(ApplicationContext applicationContext) throws BeansException { | |
| 145 | + lineConfigData = applicationContext.getBean(LineConfigData.class); | |
| 146 | + sendUtils = applicationContext.getBean(SendUtils.class); | |
| 147 | + } | |
| 148 | +} | |
| 0 | 149 | \ No newline at end of file | ... | ... |
src/main/java/com/bsth/data/schedule/thread/ScheduleLateThread.java renamed to src/main/java/com/bsth/data/schedule/late_adjust/ScheduleLateThread.java
| 1 | -package com.bsth.data.schedule.thread; | |
| 1 | +package com.bsth.data.schedule.late_adjust; | |
| 2 | 2 | |
| 3 | 3 | |
| 4 | -import java.util.ArrayList; | |
| 5 | -import java.util.Collections; | |
| 6 | -import java.util.Comparator; | |
| 7 | -import java.util.List; | |
| 8 | - | |
| 9 | -import org.springframework.beans.factory.annotation.Autowired; | |
| 10 | -import org.springframework.stereotype.Component; | |
| 11 | - | |
| 12 | 4 | import com.bsth.data.schedule.DayOfSchedule; |
| 13 | 5 | import com.bsth.data.schedule.ScheduleComparator; |
| 14 | 6 | import com.bsth.entity.realcontrol.ScheduleRealInfo; |
| 15 | 7 | import com.bsth.websocket.handler.SendUtils; |
| 8 | +import org.apache.commons.lang3.StringUtils; | |
| 9 | +import org.springframework.beans.factory.annotation.Autowired; | |
| 10 | +import org.springframework.stereotype.Component; | |
| 11 | + | |
| 12 | +import java.util.ArrayList; | |
| 13 | +import java.util.Collections; | |
| 14 | +import java.util.Comparator; | |
| 15 | +import java.util.List; | |
| 16 | 16 | |
| 17 | 17 | /** |
| 18 | - * | |
| 19 | - * @ClassName: ScheduleLateThread | |
| 20 | - * @Description: TODO(班次误点扫描线程) | |
| 21 | - * @author PanZhao | |
| 22 | - * @date 2016年8月31日 下午3:09:02 | |
| 18 | + * | |
| 19 | + * @ClassName: ScheduleLateThread | |
| 20 | + * @Description: TODO(班次误点扫描线程) | |
| 21 | + * @author PanZhao | |
| 22 | + * @date 2016年8月31日 下午3:09:02 | |
| 23 | 23 | * |
| 24 | 24 | */ |
| 25 | 25 | @Component |
| ... | ... | @@ -27,29 +27,42 @@ public class ScheduleLateThread extends Thread{ |
| 27 | 27 | |
| 28 | 28 | @Autowired |
| 29 | 29 | DayOfSchedule dayOfSchedule; |
| 30 | - | |
| 30 | + | |
| 31 | 31 | @Autowired |
| 32 | 32 | SendUtils sendUtils; |
| 33 | - | |
| 33 | + | |
| 34 | 34 | private static Comparator<ScheduleRealInfo> cpm = new ScheduleComparator.FCSJ(); |
| 35 | - | |
| 35 | + | |
| 36 | 36 | @Override |
| 37 | 37 | public void run() { |
| 38 | 38 | List<ScheduleRealInfo> all = new ArrayList<>(dayOfSchedule.findAll()); |
| 39 | 39 | Collections.sort(all, cpm); |
| 40 | - | |
| 40 | + | |
| 41 | 41 | long t = System.currentTimeMillis(); |
| 42 | 42 | int size = all.size(); |
| 43 | - | |
| 43 | + | |
| 44 | 44 | ScheduleRealInfo sch; |
| 45 | 45 | for(int i = 0; i < size; i ++){ |
| 46 | 46 | sch = all.get(i); |
| 47 | 47 | if(sch.getDfsjT() > t) |
| 48 | 48 | break; |
| 49 | - | |
| 50 | - if(sch.isLate() == false | |
| 51 | - && sch.getStatus() == 0 | |
| 52 | - && sch.getFcsjActual() == null){ | |
| 49 | + | |
| 50 | + if(sch.isLate()) | |
| 51 | + continue; | |
| 52 | + | |
| 53 | + if(sch.getStatus() == 0 | |
| 54 | + && StringUtils.isEmpty(sch.getFcsjActual())){ | |
| 55 | + | |
| 56 | + //检查应发未到 当前班次无起点到达时间 | |
| 57 | + if(StringUtils.isEmpty(sch.getQdzArrDateSJ())){ | |
| 58 | + ScheduleRealInfo prev = dayOfSchedule.prev(sch); | |
| 59 | + //上一个班次也没有实际终点到达时间 | |
| 60 | + if(prev != null && StringUtils.isEmpty(prev.getZdsjActual())){ | |
| 61 | + //进入误点调整程序 | |
| 62 | + LateAdjustHandle.putLate(sch); | |
| 63 | + } | |
| 64 | + } | |
| 65 | + | |
| 53 | 66 | //应发未发 |
| 54 | 67 | sch.setLate(true); |
| 55 | 68 | //通知客户端 |
| ... | ... | @@ -57,4 +70,4 @@ public class ScheduleLateThread extends Thread{ |
| 57 | 70 | } |
| 58 | 71 | } |
| 59 | 72 | } |
| 60 | -} | |
| 73 | +} | |
| 61 | 74 | \ No newline at end of file | ... | ... |
src/main/java/com/bsth/data/schedule/thread/CalcOilThread.java
| 1 | 1 | package com.bsth.data.schedule.thread; |
| 2 | 2 | |
| 3 | +import com.bsth.service.oil.DlbService; | |
| 4 | +import com.bsth.data.safe_driv.SafeDrivCenter; | |
| 3 | 5 | import com.bsth.service.oil.YlbService; |
| 4 | 6 | import org.slf4j.Logger; |
| 5 | 7 | import org.slf4j.LoggerFactory; |
| ... | ... | @@ -15,7 +17,8 @@ public class CalcOilThread extends Thread{ |
| 15 | 17 | |
| 16 | 18 | @Autowired |
| 17 | 19 | YlbService ylbService; |
| 18 | - | |
| 20 | + @Autowired | |
| 21 | + DlbService dlbService; | |
| 19 | 22 | Logger logger = LoggerFactory.getLogger(this.getClass()); |
| 20 | 23 | |
| 21 | 24 | @Override |
| ... | ... | @@ -23,7 +26,11 @@ public class CalcOilThread extends Thread{ |
| 23 | 26 | try{ |
| 24 | 27 | logger.info("开始计算路单里程加注量...."); |
| 25 | 28 | ylbService.obtainDsq(); |
| 29 | + dlbService.obtainDsq(); | |
| 26 | 30 | logger.info("计算路单里程加注量结束!"); |
| 31 | + | |
| 32 | + //清除安全驾驶数据 先临时蹭这个线程 | |
| 33 | + SafeDrivCenter.clear(); | |
| 27 | 34 | } catch(Exception e){ |
| 28 | 35 | logger.error("计算路单里程加注量失败",e); |
| 29 | 36 | } | ... | ... |
src/main/java/com/bsth/data/schedule/thread/ScheduleRefreshThread.java
| ... | ... | @@ -2,7 +2,6 @@ package com.bsth.data.schedule.thread; |
| 2 | 2 | |
| 3 | 3 | import com.bsth.data.BasicData; |
| 4 | 4 | import com.bsth.data.LineConfigData; |
| 5 | -import com.bsth.data.arrival.ArrivalData_GPS; | |
| 6 | 5 | import com.bsth.data.directive.DayOfDirectives; |
| 7 | 6 | import com.bsth.data.pilot80.PilotReport; |
| 8 | 7 | import com.bsth.data.schedule.DayOfSchedule; |
| ... | ... | @@ -29,8 +28,8 @@ public class ScheduleRefreshThread extends Thread{ |
| 29 | 28 | @Autowired |
| 30 | 29 | DayOfSchedule dayOfSchedule; |
| 31 | 30 | |
| 32 | - @Autowired | |
| 33 | - ArrivalData_GPS arrivalData; | |
| 31 | + /*@Autowired | |
| 32 | + ArrivalData_GPS arrivalData;*/ | |
| 34 | 33 | |
| 35 | 34 | @Autowired |
| 36 | 35 | LineConfigData lineConfs; |
| ... | ... | @@ -58,8 +57,6 @@ public class ScheduleRefreshThread extends Thread{ |
| 58 | 57 | if(oldSchDate == null || !oldSchDate.equals(currSchDate)){ |
| 59 | 58 | |
| 60 | 59 | logger.info(lineCode + "开始翻班, " + currSchDate); |
| 61 | - //清除进出站数据 | |
| 62 | - arrivalData.clearRAMData(lineCode); | |
| 63 | 60 | //清除指令数据 |
| 64 | 61 | Set<String> cars = dayOfSchedule.findCarByLineCode(lineCode); |
| 65 | 62 | for(String car : cars) | ... | ... |
src/main/java/com/bsth/entity/Business.java
| 1 | 1 | package com.bsth.entity; |
| 2 | 2 | |
| 3 | +import java.util.Date; | |
| 4 | + | |
| 5 | +import javax.persistence.Column; | |
| 3 | 6 | import javax.persistence.Entity; |
| 4 | 7 | import javax.persistence.GeneratedValue; |
| 5 | 8 | import javax.persistence.GenerationType; |
| ... | ... | @@ -40,6 +43,29 @@ public class Business { |
| 40 | 43 | |
| 41 | 44 | // 描述 |
| 42 | 45 | private String descriptions; |
| 46 | + | |
| 47 | + // 创建日期 | |
| 48 | + @Column(updatable = false, name = "create_date", columnDefinition = "TIMESTAMP DEFAULT CURRENT_TIMESTAMP") | |
| 49 | + private Date createDate; | |
| 50 | + | |
| 51 | + // 修改日期 | |
| 52 | + @Column(name = "update_date", columnDefinition = "timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP") | |
| 53 | + private Date updateDate; | |
| 54 | + public Date getCreateDate() { | |
| 55 | + return createDate; | |
| 56 | + } | |
| 57 | + | |
| 58 | + public void setCreateDate(Date createDate) { | |
| 59 | + this.createDate = createDate; | |
| 60 | + } | |
| 61 | + | |
| 62 | + public Date getUpdateDate() { | |
| 63 | + return updateDate; | |
| 64 | + } | |
| 65 | + | |
| 66 | + public void setUpdateDate(Date updateDate) { | |
| 67 | + this.updateDate = updateDate; | |
| 68 | + } | |
| 43 | 69 | |
| 44 | 70 | public Integer getId() { |
| 45 | 71 | return id; | ... | ... |
src/main/java/com/bsth/entity/LineInformation.java
| ... | ... | @@ -64,6 +64,12 @@ public class LineInformation { |
| 64 | 64 | // 晚高峰结束时间 00:00 |
| 65 | 65 | private String lateEndTime; |
| 66 | 66 | |
| 67 | + // 小夜高峰开始时间 00:00 | |
| 68 | + private String xygfkssj; | |
| 69 | + | |
| 70 | + // 小夜高峰结束时间 00:00 | |
| 71 | + private String xygfjssj; | |
| 72 | + | |
| 67 | 73 | // 早高峰上行行驶时间 |
| 68 | 74 | private Double earlyUpTime; |
| 69 | 75 | |
| ... | ... | @@ -91,15 +97,6 @@ public class LineInformation { |
| 91 | 97 | // 停车场 |
| 92 | 98 | private String carPark; |
| 93 | 99 | |
| 94 | - // 进场时间 | |
| 95 | - private Double paradeTime; | |
| 96 | - | |
| 97 | - // 出场时间 | |
| 98 | - private Double outTime; | |
| 99 | - | |
| 100 | - // 进场里程 | |
| 101 | - private Double paradeMileage; | |
| 102 | - | |
| 103 | 100 | // 上行进场时间 |
| 104 | 101 | private Double upInTimer; |
| 105 | 102 | |
| ... | ... | @@ -123,7 +120,82 @@ public class LineInformation { |
| 123 | 120 | |
| 124 | 121 | // 下行出场里程 |
| 125 | 122 | private Double downOutMileage; |
| 123 | + | |
| 124 | + // 早高峰大间隔(分钟)老调度系统字段,暂时保留 | |
| 125 | + private Double earlyIntervalLg; | |
| 126 | + | |
| 127 | + // 晚高峰大间隔(分钟)老调度系统字段,暂时保留 | |
| 128 | + private Double lateIntervalLg; | |
| 129 | + | |
| 130 | + // 平时大间隔(分钟)老调度系统字段,暂时保留 | |
| 131 | + private Double intervalLg; | |
| 132 | + | |
| 133 | + // 限速(平时)老调度系统字段,暂时保留 | |
| 134 | + private Double speedLimit; | |
| 135 | + | |
| 136 | + // 限速(雨天)老调度系统字段,暂时保留 | |
| 137 | + private Double rainLimit; | |
| 138 | + | |
| 139 | + // 限速(大雾)老调度系统字段,暂时保留 | |
| 140 | + private Double fogLimit; | |
| 126 | 141 | |
| 142 | + // 限速(冰雪)老调度系统字段,暂时保留 | |
| 143 | + private Double snowLimit; | |
| 144 | + | |
| 145 | + // 限速(节庆)老调度系统字段,暂时保留 | |
| 146 | + private Double festivalSpeedLimit; | |
| 147 | + | |
| 148 | + // 滞站 | |
| 149 | + private Integer lagStation; | |
| 150 | + | |
| 151 | + // 越站 | |
| 152 | + private Integer skip; | |
| 153 | + | |
| 154 | + // 超速 | |
| 155 | + private Integer speeding; | |
| 156 | + | |
| 157 | + // 串线 | |
| 158 | + private Integer crossedLine; | |
| 159 | + | |
| 160 | + // 越界 | |
| 161 | + private Integer overflights; | |
| 162 | + | |
| 163 | + // 描述 | |
| 164 | + private String descriptions; | |
| 165 | + | |
| 166 | + // 创建人 | |
| 167 | + private Integer createBy; | |
| 168 | + | |
| 169 | + // 修改人 | |
| 170 | + private Integer updateBy; | |
| 171 | + | |
| 172 | + // 创建日期 | |
| 173 | + @Column(updatable = false, name = "create_date", columnDefinition = "TIMESTAMP DEFAULT CURRENT_TIMESTAMP") | |
| 174 | + private Date createDate; | |
| 175 | + | |
| 176 | + // 修改日期 | |
| 177 | + @Column(name = "update_date", columnDefinition = "timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP") | |
| 178 | + private Date updateDate; | |
| 179 | + | |
| 180 | + @ManyToOne | |
| 181 | + private Line line; | |
| 182 | + | |
| 183 | + public String getXygfkssj() { | |
| 184 | + return xygfkssj; | |
| 185 | + } | |
| 186 | + | |
| 187 | + public void setXygfkssj(String xygfkssj) { | |
| 188 | + this.xygfkssj = xygfkssj; | |
| 189 | + } | |
| 190 | + | |
| 191 | + public String getXygfjssj() { | |
| 192 | + return xygfjssj; | |
| 193 | + } | |
| 194 | + | |
| 195 | + public void setXygfjssj(String xygfjssj) { | |
| 196 | + this.xygfjssj = xygfjssj; | |
| 197 | + } | |
| 198 | + | |
| 127 | 199 | public Double getUpInTimer() { |
| 128 | 200 | return upInTimer; |
| 129 | 201 | } |
| ... | ... | @@ -188,68 +260,6 @@ public class LineInformation { |
| 188 | 260 | this.downOutMileage = downOutMileage; |
| 189 | 261 | } |
| 190 | 262 | |
| 191 | - // 出场里程 | |
| 192 | - private Double outMileage; | |
| 193 | - | |
| 194 | - // 早高峰大间隔(分钟) | |
| 195 | - private Double earlyIntervalLg; | |
| 196 | - | |
| 197 | - // 晚高峰大间隔(分钟) | |
| 198 | - private Double lateIntervalLg; | |
| 199 | - | |
| 200 | - // 平时大间隔(分钟) | |
| 201 | - private Double intervalLg; | |
| 202 | - | |
| 203 | - // 限速(平时) | |
| 204 | - private Double speedLimit; | |
| 205 | - | |
| 206 | - // 限速(雨天) | |
| 207 | - private Double rainLimit; | |
| 208 | - | |
| 209 | - // 限速(大雾) | |
| 210 | - private Double fogLimit; | |
| 211 | - | |
| 212 | - // 限速(冰雪) | |
| 213 | - private Double snowLimit; | |
| 214 | - | |
| 215 | - // 限速(节庆) | |
| 216 | - private Double festivalSpeedLimit; | |
| 217 | - | |
| 218 | - // 滞站 | |
| 219 | - private Integer lagStation; | |
| 220 | - | |
| 221 | - // 越站 | |
| 222 | - private Integer skip; | |
| 223 | - | |
| 224 | - // 超速 | |
| 225 | - private Integer speeding; | |
| 226 | - | |
| 227 | - // 串线 | |
| 228 | - private Integer crossedLine; | |
| 229 | - | |
| 230 | - // 越界 | |
| 231 | - private Integer overflights; | |
| 232 | - | |
| 233 | - // 描述 | |
| 234 | - private String descriptions; | |
| 235 | - | |
| 236 | - // 创建人 | |
| 237 | - private Integer createBy; | |
| 238 | - | |
| 239 | - // 修改人 | |
| 240 | - private Integer updateBy; | |
| 241 | - | |
| 242 | - // 创建日期 | |
| 243 | - @Column(updatable = false, name = "create_date", columnDefinition = "TIMESTAMP DEFAULT CURRENT_TIMESTAMP") | |
| 244 | - private Date createDate; | |
| 245 | - | |
| 246 | - // 修改日期 | |
| 247 | - @Column(name = "update_date", columnDefinition = "timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP") | |
| 248 | - private Date updateDate; | |
| 249 | - | |
| 250 | - @ManyToOne | |
| 251 | - private Line line; | |
| 252 | - | |
| 253 | 263 | public Integer getId() { |
| 254 | 264 | return id; |
| 255 | 265 | } |
| ... | ... | @@ -416,39 +426,6 @@ public class LineInformation { |
| 416 | 426 | public void setCarPark(String carPark) { |
| 417 | 427 | this.carPark = carPark; |
| 418 | 428 | } |
| 419 | - | |
| 420 | - public Double getParadeTime() { | |
| 421 | - return paradeTime; | |
| 422 | - } | |
| 423 | - | |
| 424 | - public void setParadeTime(Double paradeTime) { | |
| 425 | - this.paradeTime = paradeTime; | |
| 426 | - } | |
| 427 | - | |
| 428 | - public Double getOutTime() { | |
| 429 | - return outTime; | |
| 430 | - } | |
| 431 | - | |
| 432 | - public void setOutTime(Double outTime) { | |
| 433 | - this.outTime = outTime; | |
| 434 | - } | |
| 435 | - | |
| 436 | - public Double getParadeMileage() { | |
| 437 | - return paradeMileage; | |
| 438 | - } | |
| 439 | - | |
| 440 | - public void setParadeMileage(Double paradeMileage) { | |
| 441 | - this.paradeMileage = paradeMileage; | |
| 442 | - } | |
| 443 | - | |
| 444 | - public Double getOutMileage() { | |
| 445 | - return outMileage; | |
| 446 | - } | |
| 447 | - | |
| 448 | - public void setOutMileage(Double outMileage) { | |
| 449 | - this.outMileage = outMileage; | |
| 450 | - } | |
| 451 | - | |
| 452 | 429 | public Double getEarlyIntervalLg() { |
| 453 | 430 | return earlyIntervalLg; |
| 454 | 431 | } | ... | ... |
src/main/java/com/bsth/entity/SectionRoute.java
src/main/java/com/bsth/entity/excep/Offline.java
| ... | ... | @@ -6,6 +6,7 @@ import javax.persistence.Entity; |
| 6 | 6 | import javax.persistence.GeneratedValue; |
| 7 | 7 | import javax.persistence.Id; |
| 8 | 8 | import javax.persistence.Table; |
| 9 | +import javax.persistence.Transient; | |
| 9 | 10 | |
| 10 | 11 | /** |
| 11 | 12 | * 掉线 |
| ... | ... | @@ -65,7 +66,46 @@ public class Offline { |
| 65 | 66 | */ |
| 66 | 67 | private Date createDate; |
| 67 | 68 | |
| 68 | - | |
| 69 | + @Transient | |
| 70 | + private String nbbm; | |
| 71 | + @Transient | |
| 72 | + private String jsy; | |
| 73 | + @Transient | |
| 74 | + private String lpname; | |
| 75 | + @Transient | |
| 76 | + private Long ts; | |
| 77 | + | |
| 78 | + @Transient | |
| 79 | + private String tsdate; | |
| 80 | + @Transient | |
| 81 | + private String deviceid; | |
| 82 | + | |
| 83 | + public String getDeviceid() { | |
| 84 | + return deviceid; | |
| 85 | + } | |
| 86 | + | |
| 87 | + public void setDeviceid(String deviceid) { | |
| 88 | + this.deviceid = deviceid; | |
| 89 | + } | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + public String getTsdate() { | |
| 94 | + return tsdate; | |
| 95 | + } | |
| 96 | + | |
| 97 | + public void setTsdate(String tsdate) { | |
| 98 | + this.tsdate = tsdate; | |
| 99 | + } | |
| 100 | + | |
| 101 | + public Long getTs() { | |
| 102 | + return ts; | |
| 103 | + } | |
| 104 | + | |
| 105 | + public void setTs(Long ts) { | |
| 106 | + this.ts = ts; | |
| 107 | + } | |
| 108 | + | |
| 69 | 109 | public Integer getId() { |
| 70 | 110 | return id; |
| 71 | 111 | } |
| ... | ... | @@ -146,5 +186,29 @@ public class Offline { |
| 146 | 186 | this.timestampDate = timestampDate; |
| 147 | 187 | } |
| 148 | 188 | |
| 189 | + public String getNbbm() { | |
| 190 | + return nbbm; | |
| 191 | + } | |
| 192 | + | |
| 193 | + public void setNbbm(String nbbm) { | |
| 194 | + this.nbbm = nbbm; | |
| 195 | + } | |
| 149 | 196 | |
| 197 | + public String getJsy() { | |
| 198 | + return jsy; | |
| 199 | + } | |
| 200 | + | |
| 201 | + public void setJsy(String jsy) { | |
| 202 | + this.jsy = jsy; | |
| 203 | + } | |
| 204 | + | |
| 205 | + public String getLpname() { | |
| 206 | + return lpname; | |
| 207 | + } | |
| 208 | + | |
| 209 | + public void setLpname(String lpname) { | |
| 210 | + this.lpname = lpname; | |
| 211 | + } | |
| 212 | + | |
| 213 | + | |
| 150 | 214 | } | ... | ... |
src/main/java/com/bsth/entity/excep/Outbound.java
| ... | ... | @@ -6,6 +6,7 @@ import javax.persistence.Entity; |
| 6 | 6 | import javax.persistence.GeneratedValue; |
| 7 | 7 | import javax.persistence.Id; |
| 8 | 8 | import javax.persistence.Table; |
| 9 | +import javax.persistence.Transient; | |
| 9 | 10 | |
| 10 | 11 | /** |
| 11 | 12 | * 越界 |
| ... | ... | @@ -72,7 +73,12 @@ public class Outbound { |
| 72 | 73 | * 时间 |
| 73 | 74 | */ |
| 74 | 75 | private Date createDate; |
| 75 | - | |
| 76 | + @Transient | |
| 77 | + private String nbbm; | |
| 78 | + @Transient | |
| 79 | + private String jsy; | |
| 80 | + @Transient | |
| 81 | + private String lpname; | |
| 76 | 82 | |
| 77 | 83 | public Integer getId() { |
| 78 | 84 | return id; |
| ... | ... | @@ -162,5 +168,29 @@ public class Outbound { |
| 162 | 168 | this.timestampDate = timestampDate; |
| 163 | 169 | } |
| 164 | 170 | |
| 171 | + public String getNbbm() { | |
| 172 | + return nbbm; | |
| 173 | + } | |
| 174 | + | |
| 175 | + public void setNbbm(String nbbm) { | |
| 176 | + this.nbbm = nbbm; | |
| 177 | + } | |
| 178 | + | |
| 179 | + public String getJsy() { | |
| 180 | + return jsy; | |
| 181 | + } | |
| 182 | + | |
| 183 | + public void setJsy(String jsy) { | |
| 184 | + this.jsy = jsy; | |
| 185 | + } | |
| 186 | + | |
| 187 | + public String getLpname() { | |
| 188 | + return lpname; | |
| 189 | + } | |
| 190 | + | |
| 191 | + public void setLpname(String lpname) { | |
| 192 | + this.lpname = lpname; | |
| 193 | + } | |
| 194 | + | |
| 165 | 195 | |
| 166 | 196 | } | ... | ... |
src/main/java/com/bsth/entity/excep/Speeding.java
| ... | ... | @@ -6,6 +6,7 @@ import javax.persistence.Entity; |
| 6 | 6 | import javax.persistence.GeneratedValue; |
| 7 | 7 | import javax.persistence.Id; |
| 8 | 8 | import javax.persistence.Table; |
| 9 | +import javax.persistence.Transient; | |
| 9 | 10 | |
| 10 | 11 | /** |
| 11 | 12 | * 超速 |
| ... | ... | @@ -66,6 +67,13 @@ public class Speeding { |
| 66 | 67 | private String timestampDate; |
| 67 | 68 | |
| 68 | 69 | |
| 70 | + @Transient | |
| 71 | + private String nbbm; | |
| 72 | + @Transient | |
| 73 | + private String jsy; | |
| 74 | + @Transient | |
| 75 | + private String lpname; | |
| 76 | + | |
| 69 | 77 | /** |
| 70 | 78 | * 创建时间 |
| 71 | 79 | */ |
| ... | ... | @@ -161,6 +169,30 @@ public class Speeding { |
| 161 | 169 | this.timestampDate = timestampDate; |
| 162 | 170 | } |
| 163 | 171 | |
| 172 | + public String getNbbm() { | |
| 173 | + return nbbm; | |
| 174 | + } | |
| 175 | + | |
| 176 | + public void setNbbm(String nbbm) { | |
| 177 | + this.nbbm = nbbm; | |
| 178 | + } | |
| 179 | + | |
| 180 | + public String getJsy() { | |
| 181 | + return jsy; | |
| 182 | + } | |
| 183 | + | |
| 184 | + public void setJsy(String jsy) { | |
| 185 | + this.jsy = jsy; | |
| 186 | + } | |
| 187 | + | |
| 188 | + public String getLpname() { | |
| 189 | + return lpname; | |
| 190 | + } | |
| 191 | + | |
| 192 | + public void setLpname(String lpname) { | |
| 193 | + this.lpname = lpname; | |
| 194 | + } | |
| 195 | + | |
| 164 | 196 | |
| 165 | 197 | |
| 166 | 198 | } | ... | ... |
src/main/java/com/bsth/entity/mcy_forms/Operationservice.java
| ... | ... | @@ -3,7 +3,7 @@ package com.bsth.entity.mcy_forms; |
| 3 | 3 | public class Operationservice { |
| 4 | 4 | |
| 5 | 5 | private String xlName;//线路 |
| 6 | - | |
| 6 | + private String xlBm;//线路编码 | |
| 7 | 7 | private String jzl;//加注量 |
| 8 | 8 | |
| 9 | 9 | private String xhl;//消耗量 |
| ... | ... | @@ -81,6 +81,14 @@ public class Operationservice { |
| 81 | 81 | public void setSjbc(String sjbc) { |
| 82 | 82 | this.sjbc = sjbc; |
| 83 | 83 | } |
| 84 | + | |
| 85 | + public String getXlBm() { | |
| 86 | + return xlBm; | |
| 87 | + } | |
| 88 | + | |
| 89 | + public void setXlBm(String xlBm) { | |
| 90 | + this.xlBm = xlBm; | |
| 91 | + } | |
| 84 | 92 | |
| 85 | 93 | |
| 86 | 94 | } | ... | ... |
src/main/java/com/bsth/entity/mcy_forms/Shiftuehiclemanth.java
| ... | ... | @@ -22,6 +22,17 @@ public class Shiftuehiclemanth { |
| 22 | 22 | |
| 23 | 23 | private String jgh; |
| 24 | 24 | private String zbh; |
| 25 | + public String getSgh() { | |
| 26 | + return sgh; | |
| 27 | + } | |
| 28 | + | |
| 29 | + public void setSgh(String sgh) { | |
| 30 | + this.sgh = sgh; | |
| 31 | + } | |
| 32 | + | |
| 33 | + private String sgh; | |
| 34 | + | |
| 35 | + | |
| 25 | 36 | public String getJgh() { |
| 26 | 37 | return jgh; |
| 27 | 38 | } | ... | ... |
src/main/java/com/bsth/entity/mcy_forms/Waybillday.java
| ... | ... | @@ -20,6 +20,8 @@ public class Waybillday { |
| 20 | 20 | |
| 21 | 21 | private String zlc;//里程 |
| 22 | 22 | |
| 23 | + private String sh;//损耗 | |
| 24 | + | |
| 23 | 25 | public String getJgh() { |
| 24 | 26 | return jgh; |
| 25 | 27 | } |
| ... | ... | @@ -110,6 +112,15 @@ public class Waybillday { |
| 110 | 112 | public void setYl(String yl) { |
| 111 | 113 | this.yl = yl; |
| 112 | 114 | } |
| 115 | + | |
| 116 | + public String getSh() { | |
| 117 | + return sh; | |
| 118 | + } | |
| 119 | + | |
| 120 | + public void setSh(String sh) { | |
| 121 | + this.sh = sh; | |
| 122 | + } | |
| 123 | + | |
| 113 | 124 | |
| 114 | 125 | |
| 115 | 126 | } | ... | ... |
src/main/java/com/bsth/entity/oil/Ylb.java
| ... | ... | @@ -63,6 +63,11 @@ public class Ylb { |
| 63 | 63 | @Transient |
| 64 | 64 | private String gsname; |
| 65 | 65 | |
| 66 | + @Transient | |
| 67 | + private String fgsname; | |
| 68 | + | |
| 69 | + @Transient | |
| 70 | + private String name; | |
| 66 | 71 | |
| 67 | 72 | public Integer getId() { |
| 68 | 73 | return id; |
| ... | ... | @@ -299,6 +304,22 @@ public class Ylb { |
| 299 | 304 | } |
| 300 | 305 | |
| 301 | 306 | |
| 307 | + public String getFgsname() { | |
| 308 | + return BasicData.businessFgsCodeNameMap.get(this.fgsdm+"_"+this.ssgsdm); | |
| 309 | + } | |
| 310 | + | |
| 311 | + public void setFgsname(String fgsname) { | |
| 312 | + this.fgsname = fgsname; | |
| 313 | + } | |
| 314 | + | |
| 315 | + public String getName() { | |
| 316 | + return BasicData.allPerson.get(this.jsy); | |
| 317 | + } | |
| 318 | + | |
| 319 | + public void setName(String name) { | |
| 320 | + this.name = name; | |
| 321 | + } | |
| 322 | + | |
| 302 | 323 | |
| 303 | 324 | |
| 304 | 325 | ... | ... |
src/main/java/com/bsth/entity/realcontrol/ChildTaskPlan.java
| ... | ... | @@ -223,7 +223,7 @@ public class ChildTaskPlan { |
| 223 | 223 | |
| 224 | 224 | @Override |
| 225 | 225 | public int hashCode() { |
| 226 | - return ("" + this.getId() + this.getSchedule().getId()).hashCode(); | |
| 226 | + return ("cTask" + this.getId() + this.getSchedule().getId()).hashCode(); | |
| 227 | 227 | } |
| 228 | 228 | |
| 229 | 229 | @Override | ... | ... |
src/main/java/com/bsth/entity/realcontrol/LineConfig.java
| ... | ... | @@ -50,6 +50,9 @@ public class LineConfig { |
| 50 | 50 | /** 出站既出场 对应的停车场 */ |
| 51 | 51 | private String twinsPark; |
| 52 | 52 | |
| 53 | + /** 出站既出场 对应的起点站 */ | |
| 54 | + private String twinsStation; | |
| 55 | + | |
| 53 | 56 | /** 短语模板 , 号分隔多个 */ |
| 54 | 57 | private String phraseTemps; |
| 55 | 58 | |
| ... | ... | @@ -79,7 +82,9 @@ public class LineConfig { |
| 79 | 82 | * 应急停靠 |
| 80 | 83 | */ |
| 81 | 84 | private boolean enableYjtk; |
| 85 | + /** HH:mm */ | |
| 82 | 86 | private String yjtkStart; |
| 87 | + /** HH:mm */ | |
| 83 | 88 | private String yjtkEnd; |
| 84 | 89 | private int upStopMinute; |
| 85 | 90 | private int downStopMinute; |
| ... | ... | @@ -268,4 +273,12 @@ public class LineConfig { |
| 268 | 273 | public void setEnableYjtk(boolean enableYjtk) { |
| 269 | 274 | this.enableYjtk = enableYjtk; |
| 270 | 275 | } |
| 276 | + | |
| 277 | + public String getTwinsStation() { | |
| 278 | + return twinsStation; | |
| 279 | + } | |
| 280 | + | |
| 281 | + public void setTwinsStation(String twinsStation) { | |
| 282 | + this.twinsStation = twinsStation; | |
| 283 | + } | |
| 271 | 284 | } | ... | ... |
src/main/java/com/bsth/entity/realcontrol/OilStationSociety.java
| ... | ... | @@ -21,6 +21,11 @@ public class OilStationSociety { |
| 21 | 21 | private String stationName; |
| 22 | 22 | |
| 23 | 23 | /** |
| 24 | + * 加油站编码(为空则默认社会加油站) | |
| 25 | + */ | |
| 26 | + private String stationCode; | |
| 27 | + | |
| 28 | + /** | |
| 24 | 29 | * 上行进场距离 |
| 25 | 30 | */ |
| 26 | 31 | private Double upInMile; |
| ... | ... | @@ -137,4 +142,12 @@ public class OilStationSociety { |
| 137 | 142 | public void setDownOutTime(int downOutTime) { |
| 138 | 143 | this.downOutTime = downOutTime; |
| 139 | 144 | } |
| 145 | + | |
| 146 | + public String getStationCode() { | |
| 147 | + return stationCode; | |
| 148 | + } | |
| 149 | + | |
| 150 | + public void setStationCode(String stationCode) { | |
| 151 | + this.stationCode = stationCode; | |
| 152 | + } | |
| 140 | 153 | } | ... | ... |
src/main/java/com/bsth/entity/realcontrol/ScheduleRealInfo.java
| ... | ... | @@ -139,12 +139,22 @@ public class ScheduleRealInfo { |
| 139 | 139 | /** 是否是临加班次 */ |
| 140 | 140 | private boolean sflj; |
| 141 | 141 | |
| 142 | - /** 是否误点*/ | |
| 142 | + /** 是否误点 (应发未发)*/ | |
| 143 | 143 | @Transient |
| 144 | 144 | private boolean late; |
| 145 | 145 | |
| 146 | + /** 是否误点 (应发未到) */ | |
| 147 | + @Transient | |
| 148 | + private boolean late2; | |
| 149 | + /** 误点停靠时间 */ | |
| 150 | + @Transient | |
| 151 | + private float lateMinute; | |
| 152 | + | |
| 146 | 153 | /** 备注*/ |
| 147 | 154 | private String remarks; |
| 155 | + | |
| 156 | + /** 原计划排班备注 */ | |
| 157 | + private String remark; | |
| 148 | 158 | |
| 149 | 159 | /**待发时间(格式 HH:mm) */ |
| 150 | 160 | private String dfsj; |
| ... | ... | @@ -168,7 +178,7 @@ public class ScheduleRealInfo { |
| 168 | 178 | private String qdzArrDatesj; |
| 169 | 179 | |
| 170 | 180 | /** 子任务 */ |
| 171 | - @OneToMany(fetch = FetchType.LAZY, cascade = CascadeType.ALL) | |
| 181 | + @OneToMany(fetch = FetchType.LAZY, mappedBy = "schedule") | |
| 172 | 182 | private Set<ChildTaskPlan> cTasks = new HashSet<>(); |
| 173 | 183 | |
| 174 | 184 | /** 关联的公司名称 */ |
| ... | ... | @@ -769,7 +779,10 @@ public class ScheduleRealInfo { |
| 769 | 779 | |
| 770 | 780 | public void destroy(){ |
| 771 | 781 | this.jhlc = 0.0; |
| 782 | + if(this.isSflj()) | |
| 783 | + this.jhlcOrig = 0.0; | |
| 772 | 784 | this.status = -1; |
| 785 | + this.clearFcsjActual(); | |
| 773 | 786 | } |
| 774 | 787 | |
| 775 | 788 | public boolean isDestroy(){ |
| ... | ... | @@ -875,4 +888,28 @@ public class ScheduleRealInfo { |
| 875 | 888 | else |
| 876 | 889 | this.setLate(false); |
| 877 | 890 | } |
| 891 | + | |
| 892 | + public String getRemark() { | |
| 893 | + return remark; | |
| 894 | + } | |
| 895 | + | |
| 896 | + public void setRemark(String remark) { | |
| 897 | + this.remark = remark; | |
| 898 | + } | |
| 899 | + | |
| 900 | + public float getLateMinute() { | |
| 901 | + return lateMinute; | |
| 902 | + } | |
| 903 | + | |
| 904 | + public void setLateMinute(float lateMinute) { | |
| 905 | + this.lateMinute = lateMinute; | |
| 906 | + } | |
| 907 | + | |
| 908 | + public boolean isLate2() { | |
| 909 | + return late2; | |
| 910 | + } | |
| 911 | + | |
| 912 | + public void setLate2(boolean late2) { | |
| 913 | + this.late2 = late2; | |
| 914 | + } | |
| 878 | 915 | } | ... | ... |
src/main/java/com/bsth/entity/schedule/SchedulePlan.java
| ... | ... | @@ -2,8 +2,11 @@ package com.bsth.entity.schedule; |
| 2 | 2 | |
| 3 | 3 | import com.bsth.entity.Line; |
| 4 | 4 | import com.fasterxml.jackson.annotation.JsonIgnore; |
| 5 | +import org.apache.commons.lang3.BooleanUtils; | |
| 5 | 6 | |
| 6 | 7 | import javax.persistence.*; |
| 8 | +import java.sql.PreparedStatement; | |
| 9 | +import java.sql.SQLException; | |
| 7 | 10 | import java.util.ArrayList; |
| 8 | 11 | import java.util.Date; |
| 9 | 12 | import java.util.List; |
| ... | ... | @@ -53,6 +56,30 @@ public class SchedulePlan extends BEntity { |
| 53 | 56 | @OneToMany(mappedBy = "schedulePlan", cascade = CascadeType.ALL, fetch = FetchType.LAZY) |
| 54 | 57 | private List<SchedulePlanInfo> schedulePlanInfoList = new ArrayList<>(); |
| 55 | 58 | |
| 59 | + | |
| 60 | + public static String generateInsertSql() { | |
| 61 | + String sql = "insert into bsth_c_s_sp " + | |
| 62 | + " (xl, schedule_from_time, schedule_to_time, " + | |
| 63 | + "tt_info_names, tt_info_ids, is_history_plan_first, plan_result, " + | |
| 64 | + "create_by, update_by, create_date, update_date) " + | |
| 65 | + "values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)"; | |
| 66 | + return sql; | |
| 67 | + } | |
| 68 | + | |
| 69 | + public void preparedStatementSet(PreparedStatement ps) throws SQLException { | |
| 70 | + ps.setInt(1, this.xl.getId()); | |
| 71 | + ps.setDate(2, new java.sql.Date(this.scheduleFromTime.getTime())); | |
| 72 | + ps.setDate(3, new java.sql.Date(this.scheduleToTime.getTime())); | |
| 73 | + ps.setString(4, this.ttInfoNames); | |
| 74 | + ps.setString(5, this.ttInfoIds); | |
| 75 | + ps.setInt(6, BooleanUtils.isTrue(this.isHistoryPlanFirst) ? 1 : 0); | |
| 76 | + ps.setString(7, this.planResult); | |
| 77 | + ps.setInt(8, this.getCreateBy().getId()); | |
| 78 | + ps.setInt(9, this.getUpdateBy().getId()); | |
| 79 | + ps.setTimestamp(10, new java.sql.Timestamp(this.getCreateDate().getTime())); | |
| 80 | + ps.setTimestamp(11, new java.sql.Timestamp(this.getUpdateDate().getTime())); | |
| 81 | + } | |
| 82 | + | |
| 56 | 83 | public Long getId() { |
| 57 | 84 | return id; |
| 58 | 85 | } | ... | ... |
src/main/java/com/bsth/entity/schedule/SchedulePlanInfo.java
| ... | ... | @@ -6,6 +6,9 @@ import com.bsth.service.schedule.rules.shiftloop.ScheduleResult_output; |
| 6 | 6 | import org.apache.commons.lang3.StringUtils; |
| 7 | 7 | |
| 8 | 8 | import javax.persistence.*; |
| 9 | +import java.sql.PreparedStatement; | |
| 10 | +import java.sql.SQLException; | |
| 11 | +import java.sql.Types; | |
| 9 | 12 | import java.util.Date; |
| 10 | 13 | import java.util.List; |
| 11 | 14 | |
| ... | ... | @@ -88,16 +91,18 @@ public class SchedulePlanInfo { |
| 88 | 91 | @Column(nullable = false) |
| 89 | 92 | private String xlDir; |
| 90 | 93 | /** 起点站id,根据班次类型,会关联 bsth_c_station,或 bsth_c_car_park,不做mapping */ |
| 91 | - @Column(nullable = false) | |
| 92 | - private Integer qdz; | |
| 94 | + // 这个字段以后不用了 | |
| 95 | +// @Column(nullable = false) | |
| 96 | +// private Integer qdz; | |
| 93 | 97 | /** 起点站code */ |
| 94 | 98 | private String qdzCode; |
| 95 | 99 | /** 起点站名字 */ |
| 96 | 100 | @Column(nullable = false) |
| 97 | 101 | private String qdzName; |
| 98 | 102 | /** 终点站id,根据班次类型,会关联 bsth_c_station,或 bsth_c_car_park,不做mapping */ |
| 99 | - @Column(nullable = false) | |
| 100 | - private Integer zdz; | |
| 103 | + // 这个字段以后不用了 | |
| 104 | +// @Column(nullable = false) | |
| 105 | +// private Integer zdz; | |
| 101 | 106 | /** 终点站code */ |
| 102 | 107 | private String zdzCode; |
| 103 | 108 | /** 终点站名字 */ |
| ... | ... | @@ -128,6 +133,9 @@ public class SchedulePlanInfo { |
| 128 | 133 | /** 关联的时刻表名字 */ |
| 129 | 134 | private String ttInfoName; |
| 130 | 135 | |
| 136 | + /** 时刻表的明细备注 */ | |
| 137 | + private String remark; | |
| 138 | + | |
| 131 | 139 | |
| 132 | 140 | /** 创建人 */ |
| 133 | 141 | @ManyToOne(cascade = CascadeType.PERSIST, fetch = FetchType.LAZY) |
| ... | ... | @@ -143,12 +151,15 @@ public class SchedulePlanInfo { |
| 143 | 151 | private Date updateDate; |
| 144 | 152 | |
| 145 | 153 | |
| 154 | +// @ManyToOne(cascade = CascadeType.PERSIST, fetch = FetchType.LAZY) | |
| 155 | +// @JoinTable( | |
| 156 | +// name = "bsth_c_s_sp_r_info", | |
| 157 | +// joinColumns = @JoinColumn(name = "sp_info_id"), | |
| 158 | +// inverseJoinColumns = @JoinColumn(name = "sp_id") | |
| 159 | +// ) | |
| 160 | +// private SchedulePlan schedulePlan; | |
| 161 | + | |
| 146 | 162 | @ManyToOne(cascade = CascadeType.PERSIST, fetch = FetchType.LAZY) |
| 147 | - @JoinTable( | |
| 148 | - name = "bsth_c_s_sp_r_info", | |
| 149 | - joinColumns = @JoinColumn(name = "sp_info_id"), | |
| 150 | - inverseJoinColumns = @JoinColumn(name = "sp_id") | |
| 151 | - ) | |
| 152 | 163 | private SchedulePlan schedulePlan; |
| 153 | 164 | |
| 154 | 165 | public SchedulePlanInfo() {} |
| ... | ... | @@ -235,28 +246,10 @@ public class SchedulePlanInfo { |
| 235 | 246 | // 时刻明细数据 |
| 236 | 247 | this.xlDir = ttInfoDetail.getXlDir(); // 线路上下行 |
| 237 | 248 | this.bcType = ttInfoDetail.getBcType(); // 班次类型 |
| 238 | - if ("out".equals(this.bcType)) { // 出场班次 | |
| 239 | - this.qdz = ttInfoDetail.getTcc().getId(); // 起点站-停车场id | |
| 240 | - this.qdzCode = ttInfoDetail.getTcc().getParkCode(); // 起点站-停车场code | |
| 241 | - this.qdzName = ttInfoDetail.getTcc().getParkName(); // 起点站-停车场name | |
| 242 | - this.zdz = ttInfoDetail.getZdz().getId(); // 终点站id | |
| 243 | - this.zdzCode = ttInfoDetail.getZdz().getStationCod(); // 终点站code | |
| 244 | - this.zdzName = ttInfoDetail.getZdz().getStationName(); // 终点站name | |
| 245 | - } else if ("in".equals(this.bcType)) { // 进场班次 | |
| 246 | - this.qdz = ttInfoDetail.getQdz().getId(); // 起点站id | |
| 247 | - this.qdzCode = ttInfoDetail.getQdz().getStationCod(); // 起点站code | |
| 248 | - this.qdzName = ttInfoDetail.getQdz().getStationName(); // 起点站name | |
| 249 | - this.zdz = ttInfoDetail.getTcc().getId(); // 终点站-停车场id | |
| 250 | - this.zdzCode = ttInfoDetail.getTcc().getParkCode(); // 终点站-停车场code | |
| 251 | - this.zdzName = ttInfoDetail.getTcc().getParkName(); // 终点站-停车场name | |
| 252 | - } else { // 其他班次 | |
| 253 | - this.qdz = ttInfoDetail.getQdz().getId(); // 起点站id | |
| 254 | - this.qdzCode = ttInfoDetail.getQdz().getStationCod(); // 起点站code | |
| 255 | - this.qdzName = ttInfoDetail.getQdz().getStationName(); // 起点站name | |
| 256 | - this.zdz = ttInfoDetail.getZdz().getId(); // 终点站id | |
| 257 | - this.zdzCode = ttInfoDetail.getZdz().getStationCod(); // 终点站code | |
| 258 | - this.zdzName = ttInfoDetail.getZdz().getStationName(); // 终点站name | |
| 259 | - } | |
| 249 | + this.qdzCode = ttInfoDetail.getQdzCode(); // 起点站code | |
| 250 | + this.qdzName = ttInfoDetail.getQdzName(); // 起点站name | |
| 251 | + this.zdzCode = ttInfoDetail.getZdzCode(); // 终点站code | |
| 252 | + this.zdzName = ttInfoDetail.getZdzName(); // 终点站name | |
| 260 | 253 | |
| 261 | 254 | this.fcsj = ttInfoDetail.getFcsj(); // 发车时间 |
| 262 | 255 | this.fcno = ttInfoDetail.getFcno(); // 发车顺序号 |
| ... | ... | @@ -269,12 +262,15 @@ public class SchedulePlanInfo { |
| 269 | 262 | // 使用的时刻表名字 |
| 270 | 263 | this.ttInfoName = ttInfoDetail.getTtinfo().getName(); |
| 271 | 264 | |
| 265 | + // 备注信息 | |
| 266 | + this.remark = ttInfoDetail.getRemark(); | |
| 267 | + | |
| 272 | 268 | // 使用车辆配置的停车场信息 |
| 273 | 269 | String pzType = carConfigInfo.getPzType(); // 配置类型 |
| 274 | 270 | if (pzType != null && !pzType.equals("BSY")) { |
| 275 | 271 | if ("ZW".equals(pzType)) { // 只看早晚进出场 |
| 276 | 272 | if (isFirstBc) { // 第一个班次是出场 |
| 277 | - this.qdz = carConfigInfo.getTcc().getId(); // 起点站-停车场id | |
| 273 | +// this.qdz = carConfigInfo.getTcc().getId(); // 起点站-停车场id | |
| 278 | 274 | this.qdzCode = carConfigInfo.getTcc().getParkCode(); // 起点站-停车场code |
| 279 | 275 | this.qdzName = carConfigInfo.getTcc().getParkName(); // 起点站-停车场name |
| 280 | 276 | |
| ... | ... | @@ -282,7 +278,7 @@ public class SchedulePlanInfo { |
| 282 | 278 | this.bcsj = "0".equals(this.xlDir) ? carConfigInfo.getUpOutSj().intValue() : carConfigInfo.getDownOutSj().intValue(); |
| 283 | 279 | |
| 284 | 280 | } else if (isLastBc) { // 最后一个班次是进场 |
| 285 | - this.zdz = carConfigInfo.getTcc().getId(); // 终点站-停车场id | |
| 281 | +// this.zdz = carConfigInfo.getTcc().getId(); // 终点站-停车场id | |
| 286 | 282 | this.zdzCode = carConfigInfo.getTcc().getParkCode(); // 终点站-停车场code |
| 287 | 283 | this.zdzName = carConfigInfo.getTcc().getParkName(); // 终点站-停车场name |
| 288 | 284 | |
| ... | ... | @@ -292,7 +288,7 @@ public class SchedulePlanInfo { |
| 292 | 288 | |
| 293 | 289 | } else if ("FS".equals(pzType)) { // 所有进出场 |
| 294 | 290 | if ("out".equals(this.bcType)) { // 出场班次 |
| 295 | - this.qdz = carConfigInfo.getTcc().getId(); // 起点站-停车场id | |
| 291 | +// this.qdz = carConfigInfo.getTcc().getId(); // 起点站-停车场id | |
| 296 | 292 | this.qdzCode = carConfigInfo.getTcc().getParkCode(); // 起点站-停车场code |
| 297 | 293 | this.qdzName = carConfigInfo.getTcc().getParkName(); // 起点站-停车场name |
| 298 | 294 | |
| ... | ... | @@ -300,7 +296,7 @@ public class SchedulePlanInfo { |
| 300 | 296 | this.bcsj = "0".equals(this.xlDir) ? carConfigInfo.getUpOutSj().intValue() : carConfigInfo.getDownOutSj().intValue(); |
| 301 | 297 | |
| 302 | 298 | } else if ("in".equals(this.bcType)) { |
| 303 | - this.zdz = carConfigInfo.getTcc().getId(); // 终点站-停车场id | |
| 299 | +// this.zdz = carConfigInfo.getTcc().getId(); // 终点站-停车场id | |
| 304 | 300 | this.zdzCode = carConfigInfo.getTcc().getParkCode(); // 终点站-停车场code |
| 305 | 301 | this.zdzName = carConfigInfo.getTcc().getParkName(); // 终点站-停车场name |
| 306 | 302 | |
| ... | ... | @@ -312,13 +308,61 @@ public class SchedulePlanInfo { |
| 312 | 308 | |
| 313 | 309 | } |
| 314 | 310 | |
| 315 | - | |
| 316 | - public Integer getS() { | |
| 317 | - return s; | |
| 318 | - } | |
| 319 | - | |
| 320 | - public void setS(Integer s) { | |
| 321 | - this.s = s; | |
| 311 | + public static String generateInsertSql() { | |
| 312 | + String sql = "insert into bsth_c_s_sp_info " + | |
| 313 | + " (schedule_date, gs_name, gs_bm, fgs_name, fgs_bm, ccno, " + | |
| 314 | + "xl, xl_name, xl_bm, lp, lp_name, cl, cl_zbh, bd_time, cc_time, " + | |
| 315 | + "j, j_gh, j_name, s, s_gh, s_name, " + | |
| 316 | + "xl_dir, qdz_code, qdz_name, zdz_code, zdz_name, " + | |
| 317 | + "fcsj, fcno, bcs, jhlc, bcsj, bc_type, " + | |
| 318 | + "tt_info, tt_info_name, remark, schedule_plan, " + | |
| 319 | + "create_by, update_by, create_date, update_date) " + | |
| 320 | + "values (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?," + | |
| 321 | + "?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)"; | |
| 322 | + return sql; | |
| 323 | + } | |
| 324 | + | |
| 325 | + public void preparedStatementSet(PreparedStatement ps) throws SQLException { | |
| 326 | + if (this.scheduleDate != null) ps.setDate(1, new java.sql.Date(this.scheduleDate.getTime())); else ps.setNull(1, Types.DATE); | |
| 327 | + if (this.gsName != null) ps.setString(2, this.gsName); else ps.setNull(2, Types.VARCHAR); | |
| 328 | + if (this.gsBm != null) ps.setString(3, this.gsBm); else ps.setNull(3, Types.VARCHAR); | |
| 329 | + if (this.fgsName != null) ps.setString(4, this.fgsName); else ps.setNull(4, Types.VARCHAR); | |
| 330 | + if (this.fgsBm != null) ps.setString(5, this.fgsBm); else ps.setNull(5, Types.VARCHAR); | |
| 331 | + if (this.ccno != null) ps.setInt(6, this.ccno); else ps.setNull(6, Types.INTEGER); | |
| 332 | + if (this.xl != null) ps.setInt(7, this.xl); else ps.setNull(7, Types.INTEGER); | |
| 333 | + if (this.xlName != null) ps.setString(8, this.xlName); else ps.setNull(8, Types.VARCHAR); | |
| 334 | + if (this.xlBm != null) ps.setString(9, this.xlBm); else ps.setNull(9, Types.VARCHAR); | |
| 335 | + if (this.lp != null) ps.setLong(10, this.lp); else ps.setNull(10, Types.BIGINT); | |
| 336 | + if (this.lpName != null) ps.setString(11, this.lpName); else ps.setNull(11, Types.VARCHAR); | |
| 337 | + if (this.cl != null) ps.setInt(12, this.cl); else ps.setNull(12, Types.INTEGER); | |
| 338 | + if (this.clZbh != null) ps.setString(13, this.clZbh); else ps.setNull(13, Types.VARCHAR); | |
| 339 | + if (this.bdTime != null) ps.setString(14, this.bdTime); else ps.setNull(14, Types.VARCHAR); | |
| 340 | + if (this.ccTime != null) ps.setString(15, this.ccTime); else ps.setNull(15, Types.VARCHAR); | |
| 341 | + if (this.j != null) ps.setInt(16, this.j); else ps.setNull(16, Types.INTEGER); | |
| 342 | + if (this.jGh != null) ps.setString(17, this.jGh); else ps.setNull(17, Types.VARCHAR); | |
| 343 | + if (this.jName != null) ps.setString(18, this.jName); else ps.setNull(18, Types.VARCHAR); | |
| 344 | + if (this.s != null) ps.setInt(19, this.s); else ps.setNull(19, Types.INTEGER); | |
| 345 | + if (this.sGh != null) ps.setString(20, this.sGh); else ps.setNull(20, Types.VARCHAR); | |
| 346 | + if (this.sName != null) ps.setString(21, this.sName); else ps.setNull(21, Types.VARCHAR); | |
| 347 | + if (this.xlDir != null) ps.setString(22, this.xlDir); else ps.setNull(22, Types.VARCHAR); | |
| 348 | + if (this.qdzCode != null) ps.setString(23, this.qdzCode); else ps.setNull(23, Types.VARCHAR); | |
| 349 | + if (this.qdzName != null) ps.setString(24, this.qdzName); else ps.setNull(24, Types.VARCHAR); | |
| 350 | + if (this.zdzCode != null) ps.setString(25, this.zdzCode); else ps.setNull(25, Types.VARCHAR); | |
| 351 | + if (this.zdzName != null) ps.setString(26, this.zdzName); else ps.setNull(26, Types.VARCHAR); | |
| 352 | + if (this.fcsj != null) ps.setString(27, this.fcsj); else ps.setNull(27, Types.VARCHAR); | |
| 353 | + if (this.fcno != null) ps.setInt(28, this.fcno); else ps.setNull(28, Types.INTEGER); | |
| 354 | + if (this.bcs != null) ps.setInt(29, this.bcs); else ps.setNull(29, Types.INTEGER); | |
| 355 | + if (this.jhlc != null) ps.setDouble(30, this.jhlc); else ps.setNull(30, Types.DOUBLE); | |
| 356 | + if (this.bcsj != null) ps.setInt(31, this.bcsj); else ps.setNull(31, Types.INTEGER); | |
| 357 | + if (this.bcType != null) ps.setString(32, this.bcType); else ps.setNull(32, Types.VARCHAR); | |
| 358 | + if (this.ttInfo != null) ps.setLong(33, this.ttInfo); else ps.setNull(33, Types.BIGINT); | |
| 359 | + if (this.ttInfoName != null) ps.setString(34, this.ttInfoName); else ps.setNull(34, Types.VARCHAR); | |
| 360 | + if (this.remark != null) ps.setString(35, this.remark); else ps.setNull(35, Types.VARCHAR); | |
| 361 | + if (this.schedulePlan != null) ps.setLong(36, this.schedulePlan.getId()); else ps.setNull(36, Types.BIGINT); | |
| 362 | + if (this.createBy != null) ps.setInt(37, this.createBy.getId()); else ps.setNull(37, Types.INTEGER); | |
| 363 | + if (this.updateBy != null) ps.setInt(38, this.updateBy.getId()); else ps.setNull(38, Types.INTEGER); | |
| 364 | + if (this.createDate != null) ps.setTimestamp(39, new java.sql.Timestamp(this.createDate.getTime())); else ps.setNull(39, Types.TIMESTAMP); | |
| 365 | + if (this.updateDate != null) ps.setTimestamp(40, new java.sql.Timestamp(this.updateDate.getTime())); else ps.setNull(40, Types.TIMESTAMP); | |
| 322 | 366 | } |
| 323 | 367 | |
| 324 | 368 | public Long getId() { |
| ... | ... | @@ -337,6 +381,46 @@ public class SchedulePlanInfo { |
| 337 | 381 | this.scheduleDate = scheduleDate; |
| 338 | 382 | } |
| 339 | 383 | |
| 384 | + public String getGsName() { | |
| 385 | + return gsName; | |
| 386 | + } | |
| 387 | + | |
| 388 | + public void setGsName(String gsName) { | |
| 389 | + this.gsName = gsName; | |
| 390 | + } | |
| 391 | + | |
| 392 | + public String getGsBm() { | |
| 393 | + return gsBm; | |
| 394 | + } | |
| 395 | + | |
| 396 | + public void setGsBm(String gsBm) { | |
| 397 | + this.gsBm = gsBm; | |
| 398 | + } | |
| 399 | + | |
| 400 | + public String getFgsName() { | |
| 401 | + return fgsName; | |
| 402 | + } | |
| 403 | + | |
| 404 | + public void setFgsName(String fgsName) { | |
| 405 | + this.fgsName = fgsName; | |
| 406 | + } | |
| 407 | + | |
| 408 | + public String getFgsBm() { | |
| 409 | + return fgsBm; | |
| 410 | + } | |
| 411 | + | |
| 412 | + public void setFgsBm(String fgsBm) { | |
| 413 | + this.fgsBm = fgsBm; | |
| 414 | + } | |
| 415 | + | |
| 416 | + public Integer getCcno() { | |
| 417 | + return ccno; | |
| 418 | + } | |
| 419 | + | |
| 420 | + public void setCcno(Integer ccno) { | |
| 421 | + this.ccno = ccno; | |
| 422 | + } | |
| 423 | + | |
| 340 | 424 | public Integer getXl() { |
| 341 | 425 | return xl; |
| 342 | 426 | } |
| ... | ... | @@ -433,6 +517,14 @@ public class SchedulePlanInfo { |
| 433 | 517 | this.jName = jName; |
| 434 | 518 | } |
| 435 | 519 | |
| 520 | + public Integer getS() { | |
| 521 | + return s; | |
| 522 | + } | |
| 523 | + | |
| 524 | + public void setS(Integer s) { | |
| 525 | + this.s = s; | |
| 526 | + } | |
| 527 | + | |
| 436 | 528 | public String getsGh() { |
| 437 | 529 | return sGh; |
| 438 | 530 | } |
| ... | ... | @@ -457,12 +549,12 @@ public class SchedulePlanInfo { |
| 457 | 549 | this.xlDir = xlDir; |
| 458 | 550 | } |
| 459 | 551 | |
| 460 | - public Integer getQdz() { | |
| 461 | - return qdz; | |
| 552 | + public String getQdzCode() { | |
| 553 | + return qdzCode; | |
| 462 | 554 | } |
| 463 | 555 | |
| 464 | - public void setQdz(Integer qdz) { | |
| 465 | - this.qdz = qdz; | |
| 556 | + public void setQdzCode(String qdzCode) { | |
| 557 | + this.qdzCode = qdzCode; | |
| 466 | 558 | } |
| 467 | 559 | |
| 468 | 560 | public String getQdzName() { |
| ... | ... | @@ -473,12 +565,12 @@ public class SchedulePlanInfo { |
| 473 | 565 | this.qdzName = qdzName; |
| 474 | 566 | } |
| 475 | 567 | |
| 476 | - public Integer getZdz() { | |
| 477 | - return zdz; | |
| 568 | + public String getZdzCode() { | |
| 569 | + return zdzCode; | |
| 478 | 570 | } |
| 479 | 571 | |
| 480 | - public void setZdz(Integer zdz) { | |
| 481 | - this.zdz = zdz; | |
| 572 | + public void setZdzCode(String zdzCode) { | |
| 573 | + this.zdzCode = zdzCode; | |
| 482 | 574 | } |
| 483 | 575 | |
| 484 | 576 | public String getZdzName() { |
| ... | ... | @@ -537,6 +629,30 @@ public class SchedulePlanInfo { |
| 537 | 629 | this.bcType = bcType; |
| 538 | 630 | } |
| 539 | 631 | |
| 632 | + public Long getTtInfo() { | |
| 633 | + return ttInfo; | |
| 634 | + } | |
| 635 | + | |
| 636 | + public void setTtInfo(Long ttInfo) { | |
| 637 | + this.ttInfo = ttInfo; | |
| 638 | + } | |
| 639 | + | |
| 640 | + public String getTtInfoName() { | |
| 641 | + return ttInfoName; | |
| 642 | + } | |
| 643 | + | |
| 644 | + public void setTtInfoName(String ttInfoName) { | |
| 645 | + this.ttInfoName = ttInfoName; | |
| 646 | + } | |
| 647 | + | |
| 648 | + public String getRemark() { | |
| 649 | + return remark; | |
| 650 | + } | |
| 651 | + | |
| 652 | + public void setRemark(String remark) { | |
| 653 | + this.remark = remark; | |
| 654 | + } | |
| 655 | + | |
| 540 | 656 | public SysUser getCreateBy() { |
| 541 | 657 | return createBy; |
| 542 | 658 | } |
| ... | ... | @@ -569,62 +685,6 @@ public class SchedulePlanInfo { |
| 569 | 685 | this.updateDate = updateDate; |
| 570 | 686 | } |
| 571 | 687 | |
| 572 | - public String getQdzCode() { | |
| 573 | - return qdzCode; | |
| 574 | - } | |
| 575 | - | |
| 576 | - public void setQdzCode(String qdzCode) { | |
| 577 | - this.qdzCode = qdzCode; | |
| 578 | - } | |
| 579 | - | |
| 580 | - public String getZdzCode() { | |
| 581 | - return zdzCode; | |
| 582 | - } | |
| 583 | - | |
| 584 | - public void setZdzCode(String zdzCode) { | |
| 585 | - this.zdzCode = zdzCode; | |
| 586 | - } | |
| 587 | - | |
| 588 | - public String getGsName() { | |
| 589 | - return gsName; | |
| 590 | - } | |
| 591 | - | |
| 592 | - public void setGsName(String gsName) { | |
| 593 | - this.gsName = gsName; | |
| 594 | - } | |
| 595 | - | |
| 596 | - public String getGsBm() { | |
| 597 | - return gsBm; | |
| 598 | - } | |
| 599 | - | |
| 600 | - public void setGsBm(String gsBm) { | |
| 601 | - this.gsBm = gsBm; | |
| 602 | - } | |
| 603 | - | |
| 604 | - public String getFgsName() { | |
| 605 | - return fgsName; | |
| 606 | - } | |
| 607 | - | |
| 608 | - public void setFgsName(String fgsName) { | |
| 609 | - this.fgsName = fgsName; | |
| 610 | - } | |
| 611 | - | |
| 612 | - public String getFgsBm() { | |
| 613 | - return fgsBm; | |
| 614 | - } | |
| 615 | - | |
| 616 | - public void setFgsBm(String fgsBm) { | |
| 617 | - this.fgsBm = fgsBm; | |
| 618 | - } | |
| 619 | - | |
| 620 | - public Integer getCcno() { | |
| 621 | - return ccno; | |
| 622 | - } | |
| 623 | - | |
| 624 | - public void setCcno(Integer ccno) { | |
| 625 | - this.ccno = ccno; | |
| 626 | - } | |
| 627 | - | |
| 628 | 688 | public SchedulePlan getSchedulePlan() { |
| 629 | 689 | return schedulePlan; |
| 630 | 690 | } |
| ... | ... | @@ -632,20 +692,4 @@ public class SchedulePlanInfo { |
| 632 | 692 | public void setSchedulePlan(SchedulePlan schedulePlan) { |
| 633 | 693 | this.schedulePlan = schedulePlan; |
| 634 | 694 | } |
| 635 | - | |
| 636 | - public Long getTtInfo() { | |
| 637 | - return ttInfo; | |
| 638 | - } | |
| 639 | - | |
| 640 | - public void setTtInfo(Long ttInfo) { | |
| 641 | - this.ttInfo = ttInfo; | |
| 642 | - } | |
| 643 | - | |
| 644 | - public String getTtInfoName() { | |
| 645 | - return ttInfoName; | |
| 646 | - } | |
| 647 | - | |
| 648 | - public void setTtInfoName(String ttInfoName) { | |
| 649 | - this.ttInfoName = ttInfoName; | |
| 650 | - } | |
| 651 | 695 | } | ... | ... |
src/main/java/com/bsth/entity/schedule/TTInfoDetail.java
| ... | ... | @@ -47,16 +47,28 @@ public class TTInfoDetail extends BEntity { |
| 47 | 47 | /** 线路方向(TODO:上下行,上行,下行,这个以后用枚举还是字典再议,现在先用文字) */ |
| 48 | 48 | @Column(nullable = false) |
| 49 | 49 | private String xlDir; |
| 50 | - /** 起点站关联 */ | |
| 50 | + | |
| 51 | + /** 起点站关联(以后不用了,暂时留着) */ | |
| 51 | 52 | @ManyToOne(cascade = CascadeType.DETACH, fetch = FetchType.LAZY) |
| 52 | 53 | private Station qdz; |
| 53 | - /** 终点站关联 */ | |
| 54 | + /** 终点站关联(以后不用了,暂时留着) */ | |
| 54 | 55 | @ManyToOne(cascade = CascadeType.DETACH, fetch = FetchType.LAZY) |
| 55 | 56 | private Station zdz; |
| 56 | - /** 停车场关联(出场,进场班次会关联停车场) */ | |
| 57 | + /** 停车场关联(出场,进场班次会关联停车场)(以后不用了,暂时留着) */ | |
| 57 | 58 | @ManyToOne(cascade = CascadeType.DETACH, fetch = FetchType.LAZY) |
| 58 | 59 | private CarPark tcc; |
| 59 | 60 | |
| 61 | + // 站点包括普通站点和停车场(站点编码不同,使用站点编码区分) | |
| 62 | + // 以后不需要再区分是站点还是停车场了 | |
| 63 | + /** 起站点代码(bsth_c_station,bsth_c_car_park 里的编码) */ | |
| 64 | + private String qdzCode; | |
| 65 | + /** 起站点名字(bsth_c_stationroute,bsth_c_car_park里的名字) */ | |
| 66 | + private String qdzName; | |
| 67 | + /** 终点站代码(bsth_c_station,bsth_c_car_park 里的编码) */ | |
| 68 | + private String zdzCode; | |
| 69 | + /** 终点站名字(bsth_c_stationroute,bsth_c_car_park里的名字) */ | |
| 70 | + private String zdzName; | |
| 71 | + | |
| 60 | 72 | /** 发车时间(格式 HH:mm) */ |
| 61 | 73 | @Column(nullable = false, length = 5) |
| 62 | 74 | private String fcsj; |
| ... | ... | @@ -236,4 +248,36 @@ public class TTInfoDetail extends BEntity { |
| 236 | 248 | public void setIsFB(Boolean isFB) { |
| 237 | 249 | this.isFB = isFB; |
| 238 | 250 | } |
| 251 | + | |
| 252 | + public String getQdzCode() { | |
| 253 | + return qdzCode; | |
| 254 | + } | |
| 255 | + | |
| 256 | + public void setQdzCode(String qdzCode) { | |
| 257 | + this.qdzCode = qdzCode; | |
| 258 | + } | |
| 259 | + | |
| 260 | + public String getQdzName() { | |
| 261 | + return qdzName; | |
| 262 | + } | |
| 263 | + | |
| 264 | + public void setQdzName(String qdzName) { | |
| 265 | + this.qdzName = qdzName; | |
| 266 | + } | |
| 267 | + | |
| 268 | + public String getZdzCode() { | |
| 269 | + return zdzCode; | |
| 270 | + } | |
| 271 | + | |
| 272 | + public void setZdzCode(String zdzCode) { | |
| 273 | + this.zdzCode = zdzCode; | |
| 274 | + } | |
| 275 | + | |
| 276 | + public String getZdzName() { | |
| 277 | + return zdzName; | |
| 278 | + } | |
| 279 | + | |
| 280 | + public void setZdzName(String zdzName) { | |
| 281 | + this.zdzName = zdzName; | |
| 282 | + } | |
| 239 | 283 | } | ... | ... |
src/main/java/com/bsth/entity/schedule/rule/RerunRule.java
| ... | ... | @@ -53,6 +53,8 @@ public class RerunRule extends BEntity { |
| 53 | 53 | private GuideboardInfo rerunLp; |
| 54 | 54 | /** 套跑班次(时刻表明细ids,使用逗号连接) */ |
| 55 | 55 | private String rerunTtinfodetailIds; |
| 56 | + /** 套跑班次(对应具体班次的发车时间,使用逗号连接) */ | |
| 57 | + private String rerunTtinfodetailFcsjs; | |
| 56 | 58 | |
| 57 | 59 | |
| 58 | 60 | /** 套跑类型(dylp;对应路牌,dybc:对应班车) */ |
| ... | ... | @@ -167,4 +169,11 @@ public class RerunRule extends BEntity { |
| 167 | 169 | this.isCancel = isCancel; |
| 168 | 170 | } |
| 169 | 171 | |
| 172 | + public String getRerunTtinfodetailFcsjs() { | |
| 173 | + return rerunTtinfodetailFcsjs; | |
| 174 | + } | |
| 175 | + | |
| 176 | + public void setRerunTtinfodetailFcsjs(String rerunTtinfodetailFcsjs) { | |
| 177 | + this.rerunTtinfodetailFcsjs = rerunTtinfodetailFcsjs; | |
| 178 | + } | |
| 170 | 179 | } | ... | ... |
src/main/java/com/bsth/entity/schedule/rule/ScheduleRule1Flat.java
| ... | ... | @@ -57,6 +57,7 @@ public class ScheduleRule1Flat extends BEntity { |
| 57 | 57 | private String lpNames; |
| 58 | 58 | /** 对应的路牌ids(用逗号隔开) */ |
| 59 | 59 | @NotNull |
| 60 | + @Column(length = 1000) | |
| 60 | 61 | private String lpIds; |
| 61 | 62 | /** 起始路牌(从0开始) */ |
| 62 | 63 | @NotNull |
| ... | ... | @@ -66,6 +67,7 @@ public class ScheduleRule1Flat extends BEntity { |
| 66 | 67 | private String ryDbbms; |
| 67 | 68 | /** 对应的人员配置ids(用逗号隔开,如果分班,就先-隔开再逗号隔开) */ |
| 68 | 69 | @NotNull |
| 70 | + @Column(length = 1000) | |
| 69 | 71 | private String ryConfigIds; |
| 70 | 72 | /** 起始人员(从0开始) */ |
| 71 | 73 | @NotNull | ... | ... |
src/main/java/com/bsth/entity/schedule/temp/SchedulePlanRuleResult.java
| ... | ... | @@ -2,10 +2,7 @@ package com.bsth.entity.schedule.temp; |
| 2 | 2 | |
| 3 | 3 | import com.bsth.entity.schedule.SchedulePlan; |
| 4 | 4 | |
| 5 | -import javax.persistence.Entity; | |
| 6 | -import javax.persistence.GeneratedValue; | |
| 7 | -import javax.persistence.Id; | |
| 8 | -import javax.persistence.Table; | |
| 5 | +import javax.persistence.*; | |
| 9 | 6 | import java.util.Date; |
| 10 | 7 | |
| 11 | 8 | /** |
| ... | ... | @@ -13,6 +10,7 @@ import java.util.Date; |
| 13 | 10 | */ |
| 14 | 11 | @Entity |
| 15 | 12 | @Table(name = "bsth_c_s_sp_rule_rst") |
| 13 | +// TODO:此表以后考虑表分区 | |
| 16 | 14 | public class SchedulePlanRuleResult { |
| 17 | 15 | /** 主键Id */ |
| 18 | 16 | @Id |
| ... | ... | @@ -20,7 +18,8 @@ public class SchedulePlanRuleResult { |
| 20 | 18 | private Long id; |
| 21 | 19 | |
| 22 | 20 | /** 线路id */ |
| 23 | - private String xlId; | |
| 21 | + // 这里要建一个索引 tt1 normal btree | |
| 22 | + private Integer xlId; | |
| 24 | 23 | /** 线路名字 */ |
| 25 | 24 | private String xlName; |
| 26 | 25 | |
| ... | ... | @@ -32,12 +31,14 @@ public class SchedulePlanRuleResult { |
| 32 | 31 | private String ccZbh; |
| 33 | 32 | |
| 34 | 33 | /** 路牌id列表字符串 */ |
| 34 | + @Column(length = 1000) | |
| 35 | 35 | private String gids; |
| 36 | 36 | /** 路牌名字列表字符串 */ |
| 37 | 37 | private String gnames; |
| 38 | 38 | /** 翻到哪个路牌索引 */ |
| 39 | 39 | private String gidindex; |
| 40 | 40 | /** 人员配置id列表字符串 */ |
| 41 | + @Column(length = 1000) | |
| 41 | 42 | private String ecids; |
| 42 | 43 | /** 人员配置搭班编码列表字符串 */ |
| 43 | 44 | private String ecdbbms; |
| ... | ... | @@ -50,6 +51,7 @@ public class SchedulePlanRuleResult { |
| 50 | 51 | private String ttinfoName; |
| 51 | 52 | |
| 52 | 53 | /** 排班日期 */ |
| 54 | + // 这里要建一个索引 tt2 normal btree | |
| 53 | 55 | private Date scheduleDate; |
| 54 | 56 | |
| 55 | 57 | /** 操作人员id */ |
| ... | ... | @@ -57,6 +59,7 @@ public class SchedulePlanRuleResult { |
| 57 | 59 | /** 操作人员姓名 */ |
| 58 | 60 | private String sysuserName; |
| 59 | 61 | /** 操作时间 */ |
| 62 | + // 这里要建一个索引 tt3 normal btree | |
| 60 | 63 | private Date createDate; |
| 61 | 64 | |
| 62 | 65 | public SchedulePlanRuleResult() { |
| ... | ... | @@ -77,6 +80,22 @@ public class SchedulePlanRuleResult { |
| 77 | 80 | this.id = id; |
| 78 | 81 | } |
| 79 | 82 | |
| 83 | + public Integer getXlId() { | |
| 84 | + return xlId; | |
| 85 | + } | |
| 86 | + | |
| 87 | + public void setXlId(Integer xlId) { | |
| 88 | + this.xlId = xlId; | |
| 89 | + } | |
| 90 | + | |
| 91 | + public String getXlName() { | |
| 92 | + return xlName; | |
| 93 | + } | |
| 94 | + | |
| 95 | + public void setXlName(String xlName) { | |
| 96 | + this.xlName = xlName; | |
| 97 | + } | |
| 98 | + | |
| 80 | 99 | public String getRuleId() { |
| 81 | 100 | return ruleId; |
| 82 | 101 | } |
| ... | ... | @@ -149,6 +168,22 @@ public class SchedulePlanRuleResult { |
| 149 | 168 | this.ecindex = ecindex; |
| 150 | 169 | } |
| 151 | 170 | |
| 171 | + public String getTtinfoId() { | |
| 172 | + return ttinfoId; | |
| 173 | + } | |
| 174 | + | |
| 175 | + public void setTtinfoId(String ttinfoId) { | |
| 176 | + this.ttinfoId = ttinfoId; | |
| 177 | + } | |
| 178 | + | |
| 179 | + public String getTtinfoName() { | |
| 180 | + return ttinfoName; | |
| 181 | + } | |
| 182 | + | |
| 183 | + public void setTtinfoName(String ttinfoName) { | |
| 184 | + this.ttinfoName = ttinfoName; | |
| 185 | + } | |
| 186 | + | |
| 152 | 187 | public Date getScheduleDate() { |
| 153 | 188 | return scheduleDate; |
| 154 | 189 | } |
| ... | ... | @@ -180,36 +215,4 @@ public class SchedulePlanRuleResult { |
| 180 | 215 | public void setCreateDate(Date createDate) { |
| 181 | 216 | this.createDate = createDate; |
| 182 | 217 | } |
| 183 | - | |
| 184 | - public String getXlId() { | |
| 185 | - return xlId; | |
| 186 | - } | |
| 187 | - | |
| 188 | - public void setXlId(String xlId) { | |
| 189 | - this.xlId = xlId; | |
| 190 | - } | |
| 191 | - | |
| 192 | - public String getXlName() { | |
| 193 | - return xlName; | |
| 194 | - } | |
| 195 | - | |
| 196 | - public void setXlName(String xlName) { | |
| 197 | - this.xlName = xlName; | |
| 198 | - } | |
| 199 | - | |
| 200 | - public String getTtinfoId() { | |
| 201 | - return ttinfoId; | |
| 202 | - } | |
| 203 | - | |
| 204 | - public void setTtinfoId(String ttinfoId) { | |
| 205 | - this.ttinfoId = ttinfoId; | |
| 206 | - } | |
| 207 | - | |
| 208 | - public String getTtinfoName() { | |
| 209 | - return ttinfoName; | |
| 210 | - } | |
| 211 | - | |
| 212 | - public void setTtinfoName(String ttinfoName) { | |
| 213 | - this.ttinfoName = ttinfoName; | |
| 214 | - } | |
| 215 | 218 | } | ... | ... |
src/main/java/com/bsth/repository/BusinessRepository.java
| 1 | 1 | package com.bsth.repository; |
| 2 | 2 | |
| 3 | +import org.springframework.data.jpa.repository.Query; | |
| 3 | 4 | import org.springframework.stereotype.Repository; |
| 4 | 5 | |
| 5 | 6 | import com.bsth.entity.Business; |
| ... | ... | @@ -28,5 +29,7 @@ public interface BusinessRepository extends BaseRepository<Business, Integer> { |
| 28 | 29 | List<Business> findByBusinessCode(String code); |
| 29 | 30 | |
| 30 | 31 | List<Business> findByUpCodeAndBusinessCode(String c1, String c2); |
| 31 | - | |
| 32 | + | |
| 33 | + @Query(value = "SELECT IFNULL(num,0) as maxId from (SELECT MAX(id) as num FROM bsth_c_business) k" , nativeQuery=true) | |
| 34 | + long getMaxId(); | |
| 32 | 35 | } | ... | ... |
src/main/java/com/bsth/repository/SectionRepository.java
| ... | ... | @@ -72,7 +72,6 @@ public interface SectionRepository extends BaseRepository<Section, Integer> { |
| 72 | 72 | |
| 73 | 73 | String descriptions, int versions,int id); |
| 74 | 74 | |
| 75 | - | |
| 76 | 75 | /** |
| 77 | 76 | * @Description :TODO(编辑线路走向) |
| 78 | 77 | * |
| ... | ... | @@ -113,5 +112,4 @@ public interface SectionRepository extends BaseRepository<Section, Integer> { |
| 113 | 112 | Double speedLimit,String descriptions,Integer version,Integer createBy,String createDate, |
| 114 | 113 | |
| 115 | 114 | Integer updateBy,String updateDate); |
| 116 | - | |
| 117 | 115 | } | ... | ... |