Commit 87287347e350b3ef6b66824a13e59d5e4e0adb13
Merge branch 'minhang' into pudong
# Conflicts: # src/main/resources/static/index.html # src/main/resources/static/login.html
Showing
23 changed files
with
767 additions
and
160 deletions
Too many changes to show.
To preserve performance only 23 of 95 files are displayed.
pom.xml
| ... | ... | @@ -18,21 +18,19 @@ |
| 18 | 18 | <groupId>org.springframework.boot</groupId> |
| 19 | 19 | <artifactId>spring-boot-starter-web</artifactId> |
| 20 | 20 | </dependency> |
| 21 | - | |
| 21 | + | |
| 22 | 22 | <dependency> |
| 23 | - <groupId>org.springframework.boot</groupId> | |
| 24 | - <artifactId>spring-boot-starter-tomcat</artifactId> | |
| 25 | - <scope>provided</scope> | |
| 26 | - </dependency> | |
| 27 | - | |
| 23 | + <groupId>org.springframework.boot</groupId> | |
| 24 | + <artifactId>spring-boot-starter-tomcat</artifactId> | |
| 25 | + <scope>provided</scope> | |
| 26 | + </dependency> | |
| 27 | + | |
| 28 | 28 | <dependency> |
| 29 | 29 | <groupId>org.springframework.boot</groupId> |
| 30 | 30 | <artifactId>spring-boot-starter-security</artifactId> |
| 31 | 31 | </dependency> |
| 32 | -<!-- <dependency> | |
| 33 | - <groupId>org.springframework.security</groupId> | |
| 34 | - <artifactId>spring-security-config</artifactId> | |
| 35 | - </dependency> --> | |
| 32 | + <!-- <dependency> <groupId>org.springframework.security</groupId> <artifactId>spring-security-config</artifactId> | |
| 33 | + </dependency> --> | |
| 36 | 34 | <dependency> |
| 37 | 35 | <groupId>org.springframework.boot</groupId> |
| 38 | 36 | <artifactId>spring-boot-starter-data-jpa</artifactId> |
| ... | ... | @@ -68,27 +66,32 @@ |
| 68 | 66 | <artifactId>fastjson</artifactId> |
| 69 | 67 | <version>1.2.4</version> |
| 70 | 68 | </dependency> |
| 71 | - | |
| 69 | + | |
| 72 | 70 | <dependency> |
| 73 | - <groupId>org.apache.httpcomponents</groupId> | |
| 74 | - <artifactId>httpclient</artifactId> | |
| 75 | - </dependency> | |
| 71 | + <groupId>org.apache.httpcomponents</groupId> | |
| 72 | + <artifactId>httpclient</artifactId> | |
| 73 | + </dependency> | |
| 76 | 74 | |
| 77 | 75 | <dependency> |
| 78 | 76 | <groupId>commons-dbcp</groupId> |
| 79 | 77 | <artifactId>commons-dbcp</artifactId> |
| 80 | 78 | </dependency> |
| 81 | - <dependency> | |
| 82 | - <groupId>commons-lang</groupId> | |
| 83 | - <artifactId>commons-lang</artifactId> | |
| 84 | - <version>2.6</version> | |
| 85 | - </dependency> | |
| 79 | + <dependency> | |
| 80 | + <groupId>commons-lang</groupId> | |
| 81 | + <artifactId>commons-lang</artifactId> | |
| 82 | + <version>2.6</version> | |
| 83 | + </dependency> | |
| 86 | 84 | <dependency> |
| 87 | 85 | <groupId>org.apache.commons</groupId> |
| 88 | 86 | <artifactId>commons-lang3</artifactId> |
| 89 | 87 | <version>3.4</version> |
| 90 | 88 | </dependency> |
| 91 | 89 | <dependency> |
| 90 | + <groupId>commons-fileupload</groupId> | |
| 91 | + <artifactId>commons-fileupload</artifactId> | |
| 92 | + <version>1.2.2</version> | |
| 93 | + </dependency> | |
| 94 | + <dependency> | |
| 92 | 95 | <groupId>commons-io</groupId> |
| 93 | 96 | <artifactId>commons-io</artifactId> |
| 94 | 97 | <version>2.4</version> |
| ... | ... | @@ -111,38 +114,38 @@ |
| 111 | 114 | </dependency> |
| 112 | 115 | <!-- ftp文件上传包 --> |
| 113 | 116 | <dependency> |
| 114 | - <groupId>commons-net</groupId> | |
| 115 | - <artifactId>commons-net</artifactId> | |
| 116 | - <version>3.5</version> | |
| 117 | + <groupId>commons-net</groupId> | |
| 118 | + <artifactId>commons-net</artifactId> | |
| 119 | + <version>3.5</version> | |
| 120 | + </dependency> | |
| 121 | + <dependency> | |
| 122 | + <groupId>org.apache.commons</groupId> | |
| 123 | + <artifactId>commons-compress</artifactId> | |
| 124 | + <version>1.3</version> | |
| 125 | + </dependency> | |
| 126 | + <!-- drools 6依赖 --> | |
| 127 | + <dependency> | |
| 128 | + <groupId>org.kie</groupId> | |
| 129 | + <artifactId>kie-api</artifactId> | |
| 117 | 130 | </dependency> |
| 118 | 131 | <dependency> |
| 119 | - <groupId>org.apache.commons</groupId> | |
| 120 | - <artifactId>commons-compress</artifactId> | |
| 121 | - <version>1.3</version> | |
| 132 | + <groupId>org.drools</groupId> | |
| 133 | + <artifactId>drools-compiler</artifactId> | |
| 134 | + </dependency> | |
| 135 | + | |
| 136 | + <!-- springboot测试 --> | |
| 137 | + <dependency> | |
| 138 | + <groupId>org.springframework.boot</groupId> | |
| 139 | + <artifactId>spring-boot-starter-test</artifactId> | |
| 140 | + <scope>test</scope> | |
| 122 | 141 | </dependency> |
| 123 | - <!-- drools 6依赖 --> | |
| 124 | - <dependency> | |
| 125 | - <groupId>org.kie</groupId> | |
| 126 | - <artifactId>kie-api</artifactId> | |
| 127 | - </dependency> | |
| 128 | - <dependency> | |
| 129 | - <groupId>org.drools</groupId> | |
| 130 | - <artifactId>drools-compiler</artifactId> | |
| 131 | - </dependency> | |
| 132 | 142 | |
| 133 | - <!-- springboot测试 --> | |
| 134 | - <dependency> | |
| 135 | - <groupId>org.springframework.boot</groupId> | |
| 136 | - <artifactId>spring-boot-starter-test</artifactId> | |
| 137 | - <scope>test</scope> | |
| 138 | - </dependency> | |
| 139 | - | |
| 140 | - <dependency> | |
| 143 | + <dependency> | |
| 141 | 144 | <groupId>c3p0</groupId> |
| 142 | 145 | <artifactId>c3p0</artifactId> |
| 143 | 146 | <version>0.9.1.2</version> |
| 144 | 147 | </dependency> |
| 145 | - | |
| 148 | + | |
| 146 | 149 | <!-- 图表 --> |
| 147 | 150 | <dependency> |
| 148 | 151 | <groupId>com.google.code.gson</groupId> |
| ... | ... | @@ -155,82 +158,79 @@ |
| 155 | 158 | <version>2.1.8</version> |
| 156 | 159 | </dependency> |
| 157 | 160 | |
| 158 | - <dependency> | |
| 159 | - <groupId>org.apache.tika</groupId> | |
| 160 | - <artifactId>tika-core</artifactId> | |
| 161 | - <version>1.7</version> | |
| 162 | - </dependency> | |
| 161 | + <dependency> | |
| 162 | + <groupId>org.apache.tika</groupId> | |
| 163 | + <artifactId>tika-core</artifactId> | |
| 164 | + <version>1.7</version> | |
| 165 | + </dependency> | |
| 166 | + | |
| 167 | + <!-- pentaho kettle 依赖 --> | |
| 168 | + <dependency> | |
| 169 | + <groupId>com.pentaho.kettle</groupId> | |
| 170 | + <artifactId>kettle-core</artifactId> | |
| 171 | + <version>6.0.1.0-386</version> | |
| 172 | + </dependency> | |
| 173 | + <dependency> | |
| 174 | + <groupId>com.pentaho.kettle</groupId> | |
| 175 | + <artifactId>kettle-engine</artifactId> | |
| 176 | + <version>6.0.1.0-386</version> | |
| 177 | + </dependency> | |
| 178 | + <dependency> | |
| 179 | + <groupId>com.pentaho.kettle</groupId> | |
| 180 | + <artifactId>metastore</artifactId> | |
| 181 | + <version>6.0.1.0-386</version> | |
| 182 | + </dependency> | |
| 183 | + <dependency> | |
| 184 | + <groupId>com.pentaho.kettle</groupId> | |
| 185 | + <artifactId>vfs2</artifactId> | |
| 186 | + <version>2.1-20150824</version> | |
| 187 | + </dependency> | |
| 188 | + <dependency> | |
| 189 | + <groupId>net.sourceforge.jexcelapi</groupId> | |
| 190 | + <artifactId>jxl</artifactId> | |
| 191 | + <version>2.6.12</version> | |
| 192 | + </dependency> | |
| 193 | + <dependency> | |
| 194 | + <groupId>rhino</groupId> | |
| 195 | + <artifactId>js</artifactId> | |
| 196 | + <version>1.7R2</version> | |
| 197 | + </dependency> | |
| 198 | + <dependency> | |
| 199 | + <groupId>javax.mail</groupId> | |
| 200 | + <artifactId>mail</artifactId> | |
| 201 | + <version>1.4.7</version> | |
| 202 | + </dependency> | |
| 163 | 203 | |
| 164 | - <!-- pentaho kettle 依赖 --> | |
| 165 | - <dependency> | |
| 166 | - <groupId>com.pentaho.kettle</groupId> | |
| 167 | - <artifactId>kettle-core</artifactId> | |
| 168 | - <version>6.0.1.0-386</version> | |
| 169 | - </dependency> | |
| 170 | - <dependency> | |
| 171 | - <groupId>com.pentaho.kettle</groupId> | |
| 172 | - <artifactId>kettle-engine</artifactId> | |
| 173 | - <version>6.0.1.0-386</version> | |
| 174 | - </dependency> | |
| 175 | - <dependency> | |
| 176 | - <groupId>com.pentaho.kettle</groupId> | |
| 177 | - <artifactId>metastore</artifactId> | |
| 178 | - <version>6.0.1.0-386</version> | |
| 179 | - </dependency> | |
| 180 | - <dependency> | |
| 181 | - <groupId>com.pentaho.kettle</groupId> | |
| 182 | - <artifactId>vfs2</artifactId> | |
| 183 | - <version>2.1-20150824</version> | |
| 184 | - </dependency> | |
| 185 | - <dependency> | |
| 186 | - <groupId>net.sourceforge.jexcelapi</groupId> | |
| 187 | - <artifactId>jxl</artifactId> | |
| 188 | - <version>2.6.12</version> | |
| 189 | - </dependency> | |
| 190 | - <dependency> | |
| 191 | - <groupId>rhino</groupId> | |
| 192 | - <artifactId>js</artifactId> | |
| 193 | - <version>1.7R2</version> | |
| 194 | - </dependency> | |
| 195 | - <dependency> | |
| 196 | - <groupId>javax.mail</groupId> | |
| 197 | - <artifactId>mail</artifactId> | |
| 198 | - <version>1.4.7</version> | |
| 199 | - </dependency> | |
| 204 | + <dependency> | |
| 205 | + <groupId>com.github.axet</groupId> | |
| 206 | + <artifactId>kaptcha</artifactId> | |
| 207 | + <version>0.0.9</version> | |
| 208 | + </dependency> | |
| 200 | 209 | |
| 201 | 210 | <dependency> |
| 202 | - <groupId>com.github.axet</groupId> | |
| 203 | - <artifactId>kaptcha</artifactId> | |
| 204 | - <version>0.0.9</version> | |
| 205 | - </dependency> | |
| 206 | - | |
| 207 | - <dependency> | |
| 208 | - <groupId>commons-codec</groupId> | |
| 209 | - <artifactId>commons-codec</artifactId> | |
| 210 | - <version>1.4</version> | |
| 211 | - <scope>compile</scope> | |
| 212 | - </dependency> | |
| 213 | - <dependency> | |
| 214 | - <groupId>org.bouncycastle</groupId> | |
| 215 | - <artifactId>bcprov-jdk15on</artifactId> | |
| 216 | - <version>1.52</version> | |
| 217 | - </dependency> | |
| 218 | - <dependency> | |
| 219 | - <groupId>axis</groupId> | |
| 220 | - <artifactId>axis</artifactId> | |
| 221 | - <version>1.4</version> | |
| 222 | - </dependency> | |
| 223 | - <dependency> | |
| 224 | - <groupId>javax.xml</groupId> | |
| 225 | - <artifactId>jaxrpc-api</artifactId> | |
| 226 | - <version>1.1</version> | |
| 211 | + <groupId>commons-codec</groupId> | |
| 212 | + <artifactId>commons-codec</artifactId> | |
| 213 | + <version>1.4</version> | |
| 214 | + <scope>compile</scope> | |
| 215 | + </dependency> | |
| 216 | + <dependency> | |
| 217 | + <groupId>org.bouncycastle</groupId> | |
| 218 | + <artifactId>bcprov-jdk15on</artifactId> | |
| 219 | + <version>1.52</version> | |
| 220 | + </dependency> | |
| 221 | + <dependency> | |
| 222 | + <groupId>axis</groupId> | |
| 223 | + <artifactId>axis</artifactId> | |
| 224 | + <version>1.4</version> | |
| 225 | + </dependency> | |
| 226 | + <dependency> | |
| 227 | + <groupId>javax.xml</groupId> | |
| 228 | + <artifactId>jaxrpc-api</artifactId> | |
| 229 | + <version>1.1</version> | |
| 227 | 230 | </dependency> |
| 228 | 231 | |
| 229 | -<!-- <dependency> | |
| 230 | - <groupId>org.springframework.boot</groupId> | |
| 231 | - <artifactId>spring-boot-devtools</artifactId> | |
| 232 | - <optional>true</optional> | |
| 233 | - </dependency>--> | |
| 232 | + <!-- <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-devtools</artifactId> | |
| 233 | + <optional>true</optional> </dependency> --> | |
| 234 | 234 | <dependency> |
| 235 | 235 | <groupId>com.vividsolutions</groupId> |
| 236 | 236 | <artifactId>jts</artifactId> |
| ... | ... | @@ -239,18 +239,18 @@ |
| 239 | 239 | |
| 240 | 240 | </dependencies> |
| 241 | 241 | |
| 242 | - <dependencyManagement> | |
| 243 | - <dependencies> | |
| 244 | - <!-- drools 6依赖 --> | |
| 245 | - <dependency> | |
| 246 | - <groupId>org.drools</groupId> | |
| 247 | - <artifactId>drools-bom</artifactId> | |
| 248 | - <type>pom</type> | |
| 249 | - <version>6.2.0.Final</version> | |
| 250 | - <scope>import</scope> | |
| 251 | - </dependency> | |
| 252 | - </dependencies> | |
| 253 | - </dependencyManagement> | |
| 242 | + <dependencyManagement> | |
| 243 | + <dependencies> | |
| 244 | + <!-- drools 6依赖 --> | |
| 245 | + <dependency> | |
| 246 | + <groupId>org.drools</groupId> | |
| 247 | + <artifactId>drools-bom</artifactId> | |
| 248 | + <type>pom</type> | |
| 249 | + <version>6.3.0.Final</version> | |
| 250 | + <scope>import</scope> | |
| 251 | + </dependency> | |
| 252 | + </dependencies> | |
| 253 | + </dependencyManagement> | |
| 254 | 254 | |
| 255 | 255 | <build> |
| 256 | 256 | <plugins> |
| ... | ... | @@ -304,8 +304,8 @@ |
| 304 | 304 | <url>http://repo.spring.io/milestone</url> |
| 305 | 305 | </pluginRepository> |
| 306 | 306 | </pluginRepositories> |
| 307 | - | |
| 307 | + | |
| 308 | 308 | <properties> |
| 309 | - <start-class>com.bsth.Application</start-class> | |
| 309 | + <start-class>com.bsth.Application</start-class> | |
| 310 | 310 | </properties> |
| 311 | 311 | </project> | ... | ... |
src/main/java/com/bsth/controller/oil/JdlController.java
0 → 100644
| 1 | +package com.bsth.controller.oil; | |
| 2 | + | |
| 3 | +import java.io.File; | |
| 4 | +import java.util.HashMap; | |
| 5 | +import java.util.Map; | |
| 6 | + | |
| 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 | +import org.springframework.web.multipart.MultipartFile; | |
| 13 | +import org.springframework.web.servlet.ModelAndView; | |
| 14 | + | |
| 15 | +import com.alibaba.fastjson.JSON; | |
| 16 | +import com.alibaba.fastjson.JSONArray; | |
| 17 | +import com.alibaba.fastjson.JSONObject; | |
| 18 | +import com.bsth.controller.BaseController; | |
| 19 | +import com.bsth.entity.oil.Jdl; | |
| 20 | +import com.bsth.service.oil.JdlService; | |
| 21 | +import com.google.common.io.Files; | |
| 22 | + | |
| 23 | +@RestController | |
| 24 | +@RequestMapping("jdl") | |
| 25 | +public class JdlController extends BaseController<Jdl, Integer> { | |
| 26 | + | |
| 27 | + @Autowired | |
| 28 | + JdlService jdlService; | |
| 29 | + | |
| 30 | + public String getDataImportClasspath(){ | |
| 31 | + return this.getClass().getResource("/").getPath() + "/static/pages/electricity/jdl"; | |
| 32 | + } | |
| 33 | + | |
| 34 | + @RequestMapping(value = "/uploadFile",method = RequestMethod.POST) | |
| 35 | + public String uploadFile(MultipartFile file, String gsbm_, String gsName, | |
| 36 | + String fgsbm_, String fgsName) throws Exception{ | |
| 37 | + Map<String, Object> map = new HashMap<String, Object>(); | |
| 38 | +// File ktrfile = new File(this.getClass().getResource(getDataImportKtrClasspath()).toURI()); | |
| 39 | +// System.out.println(ktrfile.getAbsolutePath()); | |
| 40 | + System.out.println(file.getSize()); | |
| 41 | + File newFile = new File( | |
| 42 | + getDataImportClasspath() + File.separator + | |
| 43 | + file.getOriginalFilename()); | |
| 44 | + Files.write(file.getBytes(), newFile); | |
| 45 | + String result = jdlService.importExcel(newFile, gsbm_, gsName, fgsbm_, fgsName); | |
| 46 | + return "{\"result\":" + "\""+result+"\"}"; | |
| 47 | + } | |
| 48 | + | |
| 49 | + @RequestMapping(value = "/query",method = RequestMethod.GET) | |
| 50 | + public Map<String, Object> query(@RequestParam Map<String, Object> map) throws Exception{ | |
| 51 | + return jdlService.query(map); | |
| 52 | + } | |
| 53 | + | |
| 54 | +} | ... | ... |
src/main/java/com/bsth/controller/realcontrol/ScheduleRealInfoController.java
| ... | ... | @@ -449,4 +449,9 @@ public class ScheduleRealInfoController extends BaseController<ScheduleRealInfo, |
| 449 | 449 | public List<SchedulePlanInfo> currentSchedulePlan(@RequestParam String lineCode){ |
| 450 | 450 | return scheduleRealInfoService.currentSchedulePlan(lineCode); |
| 451 | 451 | } |
| 452 | + | |
| 453 | + @RequestMapping(value = "lpChangeMulti", method = RequestMethod.POST) | |
| 454 | + public Map<String, Object> lpChangeMulti(@RequestParam String leftIdx, @RequestParam String rightIdx){ | |
| 455 | + return scheduleRealInfoService.lpChangeMulti(leftIdx, rightIdx); | |
| 456 | + } | |
| 452 | 457 | } | ... | ... |
src/main/java/com/bsth/controller/realcontrol/dto/LpData.java
0 → 100644
| 1 | +package com.bsth.controller.realcontrol.dto; | |
| 2 | + | |
| 3 | +import com.bsth.entity.realcontrol.ScheduleRealInfo; | |
| 4 | + | |
| 5 | +/** | |
| 6 | + * 路牌相关的数据(换路牌时要换的字段) | |
| 7 | + * Created by panzhao on 2017/3/2. | |
| 8 | + */ | |
| 9 | +public class LpData { | |
| 10 | + | |
| 11 | + public LpData(ScheduleRealInfo sch) { | |
| 12 | + this.jGh = sch.getjGh(); | |
| 13 | + this.jName = sch.getjName(); | |
| 14 | + this.sGh = sch.getsGh(); | |
| 15 | + this.sName = sch.getsName(); | |
| 16 | + this.nbbm = sch.getClZbh(); | |
| 17 | + | |
| 18 | + this.fcsj = sch.getFcsjActualTime(); | |
| 19 | + this.zdsj = sch.getZdsjActualTime(); | |
| 20 | + } | |
| 21 | + | |
| 22 | + public void appendTo(ScheduleRealInfo sch) { | |
| 23 | + sch.setjGh(this.jGh); | |
| 24 | + sch.setjName(this.jName); | |
| 25 | + sch.setsGh(this.sGh); | |
| 26 | + sch.setsName(this.sName); | |
| 27 | + sch.setClZbh(this.nbbm); | |
| 28 | + | |
| 29 | + if (this.fcsj != null) | |
| 30 | + sch.setFcsjActualAll(this.fcsj); | |
| 31 | + if (this.zdsj != null) | |
| 32 | + sch.setZdsjActualAll(this.zdsj); | |
| 33 | + } | |
| 34 | + | |
| 35 | + /** | |
| 36 | + * 驾驶员 | |
| 37 | + */ | |
| 38 | + private String jGh; | |
| 39 | + private String jName; | |
| 40 | + | |
| 41 | + /** | |
| 42 | + * 售票员 | |
| 43 | + */ | |
| 44 | + private String sGh; | |
| 45 | + private String sName; | |
| 46 | + | |
| 47 | + /** | |
| 48 | + * 车辆自编号 | |
| 49 | + */ | |
| 50 | + private String nbbm; | |
| 51 | + | |
| 52 | + /** | |
| 53 | + * 实际发车时间 | |
| 54 | + */ | |
| 55 | + private Long fcsj; | |
| 56 | + | |
| 57 | + /** | |
| 58 | + * 实际终点时间 | |
| 59 | + */ | |
| 60 | + private Long zdsj; | |
| 61 | + | |
| 62 | + public String getjGh() { | |
| 63 | + return jGh; | |
| 64 | + } | |
| 65 | + | |
| 66 | + public void setjGh(String jGh) { | |
| 67 | + this.jGh = jGh; | |
| 68 | + } | |
| 69 | + | |
| 70 | + public String getjName() { | |
| 71 | + return jName; | |
| 72 | + } | |
| 73 | + | |
| 74 | + public void setjName(String jName) { | |
| 75 | + this.jName = jName; | |
| 76 | + } | |
| 77 | + | |
| 78 | + public String getsGh() { | |
| 79 | + return sGh; | |
| 80 | + } | |
| 81 | + | |
| 82 | + public void setsGh(String sGh) { | |
| 83 | + this.sGh = sGh; | |
| 84 | + } | |
| 85 | + | |
| 86 | + public String getsName() { | |
| 87 | + return sName; | |
| 88 | + } | |
| 89 | + | |
| 90 | + public void setsName(String sName) { | |
| 91 | + this.sName = sName; | |
| 92 | + } | |
| 93 | + | |
| 94 | + public String getNbbm() { | |
| 95 | + return nbbm; | |
| 96 | + } | |
| 97 | + | |
| 98 | + public void setNbbm(String nbbm) { | |
| 99 | + this.nbbm = nbbm; | |
| 100 | + } | |
| 101 | + | |
| 102 | + public Long getFcsj() { | |
| 103 | + return fcsj; | |
| 104 | + } | |
| 105 | + | |
| 106 | + public void setFcsj(Long fcsj) { | |
| 107 | + this.fcsj = fcsj; | |
| 108 | + } | |
| 109 | + | |
| 110 | + public Long getZdsj() { | |
| 111 | + return zdsj; | |
| 112 | + } | |
| 113 | + | |
| 114 | + public void setZdsj(Long zdsj) { | |
| 115 | + this.zdsj = zdsj; | |
| 116 | + } | |
| 117 | +} | ... | ... |
src/main/java/com/bsth/controller/schedule/core/SchedulePlanController.java
| ... | ... | @@ -81,7 +81,6 @@ public class SchedulePlanController extends BController<SchedulePlan, Long> { |
| 81 | 81 | @PathVariable(value = "from") Date from, |
| 82 | 82 | @PathVariable(value = "to") Date to |
| 83 | 83 | ) throws Exception { |
| 84 | - // TODO:测试数据 | |
| 85 | 84 | Map<String, Object> rtn = new HashMap<>(); |
| 86 | 85 | rtn.put("status", ResponseCode.SUCCESS); |
| 87 | 86 | rtn.put("data", schedulePlanService.validateTTInfo(xlid, from, to)); | ... | ... |
src/main/java/com/bsth/data/gpsdata/arrival/handlers/InOutStationSignalHandle.java
| ... | ... | @@ -46,6 +46,9 @@ public class InOutStationSignalHandle extends SignalHandle{ |
| 46 | 46 | |
| 47 | 47 | private final static int MAX_BEFORE_TIME = 1000 * 60 * 72; |
| 48 | 48 | |
| 49 | + //最大的班次时间差,防止异常的GPS时间打乱数据 | |
| 50 | + private final static int MAX_NORMAL_DIFF = 1000 * 60 * 60 * 12; | |
| 51 | + | |
| 49 | 52 | @Override |
| 50 | 53 | public boolean handle(GpsEntity gps, CircleQueue<GpsEntity> prevs) { |
| 51 | 54 | //忽略掉线信号 |
| ... | ... | @@ -106,8 +109,14 @@ public class InOutStationSignalHandle extends SignalHandle{ |
| 106 | 109 | ScheduleRealInfo sch = dayOfSchedule.executeCurr(gps.getNbbm()); |
| 107 | 110 | String qdzCode = sch.getQdzCode(); |
| 108 | 111 | |
| 112 | + int diff = (int) (sch.getDfsjT() - gps.getTimestamp()); | |
| 113 | + | |
| 109 | 114 | //首班出场最多提前1.2小时 |
| 110 | - if(dayOfSchedule.isFirstOut(sch) && sch.getDfsjT() - gps.getTimestamp() > MAX_BEFORE_TIME) | |
| 115 | + if(dayOfSchedule.isFirstOut(sch) && diff > MAX_BEFORE_TIME) | |
| 116 | + return; | |
| 117 | + | |
| 118 | + //正常班次最大时间差 | |
| 119 | + if(Math.abs(diff) > MAX_NORMAL_DIFF) | |
| 111 | 120 | return; |
| 112 | 121 | |
| 113 | 122 | //起点发车 |
| ... | ... | @@ -169,8 +178,13 @@ public class InOutStationSignalHandle extends SignalHandle{ |
| 169 | 178 | |
| 170 | 179 | if(gps.getStopNo().equals(sch.getZdzCode())){ |
| 171 | 180 | |
| 181 | + int diff = (int) (sch.getZdsjT() - gps.getTimestamp()); | |
| 172 | 182 | //进场最多提前1.2小时 |
| 173 | - if(sch.getBcType().equals("in") && sch.getZdsjT() - gps.getTimestamp() > MAX_BEFORE_TIME) | |
| 183 | + if(sch.getBcType().equals("in") && diff > MAX_BEFORE_TIME) | |
| 184 | + return; | |
| 185 | + | |
| 186 | + //正常班次最大时间差 | |
| 187 | + if(Math.abs(diff) > MAX_NORMAL_DIFF) | |
| 174 | 188 | return; |
| 175 | 189 | |
| 176 | 190 | //实达时间不覆盖 | ... | ... |
src/main/java/com/bsth/entity/oil/Jdl.java
| ... | ... | @@ -21,10 +21,12 @@ public class Jdl { |
| 21 | 21 | private String gsName; |
| 22 | 22 | private String fgsBm; |
| 23 | 23 | private String fgsName; |
| 24 | - private String clZbh; | |
| 24 | + private String nbbm; | |
| 25 | 25 | private Double jdl = 0.0; |
| 26 | 26 | private String jdz; |
| 27 | 27 | private String remarks; |
| 28 | + @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss") | |
| 29 | + private Date createrDate; | |
| 28 | 30 | |
| 29 | 31 | |
| 30 | 32 | public Integer getId() { |
| ... | ... | @@ -63,11 +65,11 @@ public class Jdl { |
| 63 | 65 | public void setFgsName(String fgsName) { |
| 64 | 66 | this.fgsName = fgsName; |
| 65 | 67 | } |
| 66 | - public String getClZbh() { | |
| 67 | - return clZbh; | |
| 68 | + public String getNbbm() { | |
| 69 | + return nbbm; | |
| 68 | 70 | } |
| 69 | - public void setClZbh(String clZbh) { | |
| 70 | - this.clZbh = clZbh; | |
| 71 | + public void setNbbm(String nbbm) { | |
| 72 | + this.nbbm = nbbm; | |
| 71 | 73 | } |
| 72 | 74 | public Double getJdl() { |
| 73 | 75 | return jdl; |
| ... | ... | @@ -87,5 +89,11 @@ public class Jdl { |
| 87 | 89 | public void setRemarks(String remarks) { |
| 88 | 90 | this.remarks = remarks; |
| 89 | 91 | } |
| 92 | + public Date getCreaterDate() { | |
| 93 | + return createrDate; | |
| 94 | + } | |
| 95 | + public void setCreaterDate(Date createrDate) { | |
| 96 | + this.createrDate = createrDate; | |
| 97 | + } | |
| 90 | 98 | |
| 91 | 99 | } | ... | ... |
src/main/java/com/bsth/repository/oil/JdlRepository.java
0 → 100644
| 1 | +package com.bsth.repository.oil; | |
| 2 | + | |
| 3 | + | |
| 4 | +import java.util.List; | |
| 5 | + | |
| 6 | +import org.springframework.data.jpa.repository.Modifying; | |
| 7 | +import org.springframework.data.jpa.repository.Query; | |
| 8 | +import org.springframework.stereotype.Repository; | |
| 9 | +import org.springframework.transaction.annotation.Transactional; | |
| 10 | + | |
| 11 | +import com.bsth.entity.oil.Jdl; | |
| 12 | +import com.bsth.repository.BaseRepository; | |
| 13 | + | |
| 14 | +@Repository | |
| 15 | +public interface JdlRepository extends BaseRepository<Jdl, Integer>{ | |
| 16 | + | |
| 17 | + @Transactional | |
| 18 | + @Modifying | |
| 19 | + @Query(value="INSERT INTO bsth_c_jdl("+ | |
| 20 | + "gs_bm, gs_name, fgs_bm, fgs_name, rq, nbbm, jdl, jdz, remarks, creater_date)" + | |
| 21 | + " VALUES(" + | |
| 22 | + "?1,?2,?3,?4,str_to_date(?5,'%Y-%m-%d'),?6,?7,?8,?9,str_to_date(?10,'%Y-%m-%d %H:%i:%s'))", nativeQuery=true) | |
| 23 | + void insertData(String gsbm, String gsName, String fgsbm, String fgsName, String rq, String nbbm, Double jdl, String jdz, String remarks, String createrDate); | |
| 24 | + | |
| 25 | + @Transactional | |
| 26 | + @Modifying | |
| 27 | + @Query(value="SELECT * FROM bsth_c_jdl where gs_bm = ?1 and fgs_bm = ?2 and rq = ?3 and nbbm like %?4%",nativeQuery=true) | |
| 28 | + List<Jdl> query(String gsbm, String fgsbm, String rq, String nbbm); | |
| 29 | + | |
| 30 | + @Transactional | |
| 31 | + @Modifying | |
| 32 | + @Query(value="SELECT jdl FROM bsth_c_jdl where gs_bm = ?1 and fgs_bm = ?2 and rq = ?3 and nbbm = ?4 and jdz = ?5",nativeQuery=true) | |
| 33 | + List<Double> queryBySame(String gsbm, String fgsbm, String rq, String nbbm, String jdz); | |
| 34 | + | |
| 35 | + @Transactional | |
| 36 | + @Modifying | |
| 37 | + @Query(value="UPDATE bsth_c_jdl set jdl = ?1 where gs_bm = ?2 and fgs_bm = ?3 and rq = ?4 and nbbm = ?5 and jdz = ?6",nativeQuery=true) | |
| 38 | + void UpdateJdl(Double jdl, String gsbm, String fgsbm, String rq, String nbbm, String jdz); | |
| 39 | + | |
| 40 | +} | ... | ... |
src/main/java/com/bsth/repository/realcontrol/ScheduleRealInfoRepository.java
| ... | ... | @@ -28,7 +28,7 @@ public interface ScheduleRealInfoRepository extends BaseRepository<ScheduleRealI |
| 28 | 28 | @Query(value="select s from ScheduleRealInfo s where s.xlBm = ?1 and DATE_FORMAT(s.scheduleDate,'%Y-%m-%d') = ?2 GROUP BY s.id,s.jGh,s.clZbh,s.lpName order by (lpName+1)") |
| 29 | 29 | List<ScheduleRealInfo> queryUserInfo(String line,String date); |
| 30 | 30 | |
| 31 | - @Query(value="select min(s.id), s.jGh,s.clZbh,s.lpName,s.jName from ScheduleRealInfo s where s.xlBm = ?1 and DATE_FORMAT(s.scheduleDate,'%Y-%m-%d') = ?2 GROUP BY s.jGh,s.clZbh,s.lpName ,s.jName order by (lpName+1)") | |
| 31 | + @Query(value="select min(s.id), s.jGh,s.clZbh,s.lpName,s.jName,s.sGh,s.sName from ScheduleRealInfo s where s.xlBm = ?1 and DATE_FORMAT(s.scheduleDate,'%Y-%m-%d') = ?2 GROUP BY s.jGh,s.clZbh,s.lpName ,s.jName,s.sGh,s.sName order by (lpName+1)") | |
| 32 | 32 | List<ScheduleRealInfo> queryUserInfo2(String line,String date); |
| 33 | 33 | |
| 34 | 34 | @Query(value="select min(s.id), s.clZbh from ScheduleRealInfo s where s.xlBm = ?1 and DATE_FORMAT(s.scheduleDate,'%Y-%m-%d') = ?2 GROUP BY s.clZbh ") | ... | ... |
src/main/java/com/bsth/service/impl/StationServiceImpl.java
| ... | ... | @@ -758,7 +758,7 @@ public class StationServiceImpl extends BaseServiceImpl<Station, Integer> implem |
| 758 | 758 | String bsectionVector = "LINESTRING(" + sectionsBpoints + ")"; |
| 759 | 759 | |
| 760 | 760 | // 城建坐标点集合 |
| 761 | - String csectionVector = ""; | |
| 761 | + String csectionVector = null; | |
| 762 | 762 | |
| 763 | 763 | // 路段类型 |
| 764 | 764 | String sectionType = ""; | ... | ... |
src/main/java/com/bsth/service/oil/JdlService.java
0 → 100644
| 1 | +package com.bsth.service.oil; | |
| 2 | + | |
| 3 | +import java.io.File; | |
| 4 | +import java.util.Map; | |
| 5 | + | |
| 6 | +import com.bsth.entity.oil.Jdl; | |
| 7 | +import com.bsth.service.BaseService; | |
| 8 | + | |
| 9 | +public interface JdlService extends BaseService<Jdl, Integer> { | |
| 10 | + | |
| 11 | + public String importExcel(File file, String gsbm_, String gsName, String fgsbm, String fgsName); | |
| 12 | + | |
| 13 | + public Map<String, Object> query(Map<String, Object> map); | |
| 14 | + | |
| 15 | +} | ... | ... |
src/main/java/com/bsth/service/oil/impl/JdlServiceImpl.java
0 → 100644
| 1 | +package com.bsth.service.oil.impl; | |
| 2 | + | |
| 3 | +import java.io.File; | |
| 4 | +import java.io.FileInputStream; | |
| 5 | +import java.text.SimpleDateFormat; | |
| 6 | +import java.util.ArrayList; | |
| 7 | +import java.util.Date; | |
| 8 | +import java.util.HashMap; | |
| 9 | +import java.util.Iterator; | |
| 10 | +import java.util.List; | |
| 11 | +import java.util.Map; | |
| 12 | + | |
| 13 | +import org.apache.poi.hssf.usermodel.HSSFCell; | |
| 14 | +import org.apache.poi.hssf.usermodel.HSSFRow; | |
| 15 | +import org.apache.poi.hssf.usermodel.HSSFSheet; | |
| 16 | +import org.apache.poi.hssf.usermodel.HSSFWorkbook; | |
| 17 | +import org.apache.poi.poifs.filesystem.POIFSFileSystem; | |
| 18 | +import org.springframework.beans.factory.annotation.Autowired; | |
| 19 | +import org.springframework.stereotype.Service; | |
| 20 | + | |
| 21 | +import com.bsth.entity.oil.Jdl; | |
| 22 | +import com.bsth.repository.oil.JdlRepository; | |
| 23 | +import com.bsth.service.impl.BaseServiceImpl; | |
| 24 | +import com.bsth.service.oil.JdlService; | |
| 25 | +import com.bsth.util.ReportUtils; | |
| 26 | + | |
| 27 | +@Service | |
| 28 | +public class JdlServiceImpl extends BaseServiceImpl<Jdl, Integer> implements JdlService { | |
| 29 | + | |
| 30 | + @Autowired | |
| 31 | + JdlRepository repository; | |
| 32 | + | |
| 33 | + @Override | |
| 34 | + public String importExcel(File file, String gsbm, String gsName, String fgsbm, String fgsName) { | |
| 35 | + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); | |
| 36 | + SimpleDateFormat sd = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); | |
| 37 | + List<String> textList = new ArrayList<String>(); | |
| 38 | + try { | |
| 39 | + POIFSFileSystem fs = new POIFSFileSystem(new FileInputStream(file)); | |
| 40 | + HSSFWorkbook wb = new HSSFWorkbook(fs); | |
| 41 | + HSSFSheet sheet = wb.getSheetAt(0); | |
| 42 | + // 取得总行数 | |
| 43 | + int rowNum = sheet.getLastRowNum() + 1; | |
| 44 | + // 取得总列数 | |
| 45 | + int cellNum = sheet.getRow(0).getLastCellNum(); | |
| 46 | + HSSFRow row = null; | |
| 47 | + HSSFCell cell = null; | |
| 48 | + for(int i = 2; i < rowNum; i++){ | |
| 49 | + row = sheet.getRow(i); | |
| 50 | + if (row == null){ | |
| 51 | + continue; | |
| 52 | + } | |
| 53 | + String text = ""; | |
| 54 | + for(int j = 0; j < cellNum; j++){ | |
| 55 | + cell = row.getCell(j); | |
| 56 | + if(cell == null){ | |
| 57 | + text += ","; | |
| 58 | + continue; | |
| 59 | + } | |
| 60 | + text += cell.getStringCellValue() + ","; | |
| 61 | + } | |
| 62 | + String[] split = (text+";").split(","); | |
| 63 | + String str = ""; | |
| 64 | + for(int j = 0; j < split.length && j < 5; j++){ | |
| 65 | + str += split[j]; | |
| 66 | + } | |
| 67 | + if(str.trim().length() == 0) | |
| 68 | + continue; | |
| 69 | + textList.add(text + ";"); | |
| 70 | + } | |
| 71 | + for(int i = 0; i < textList.size(); i++){ | |
| 72 | + String text = textList.get(i); | |
| 73 | + String[] split = text.split(","); | |
| 74 | + String rq = split[0]; | |
| 75 | + String nbbm = split[1]; | |
| 76 | + double jdl = Double.valueOf(split[2].trim().length()!=0?split[2]:"0"); | |
| 77 | + String jdz = split[3]; | |
| 78 | + String remarks = split[4]; | |
| 79 | + if(rq.trim().length() == 0){ | |
| 80 | + rq = sdf.format(new Date()); | |
| 81 | + } | |
| 82 | + | |
| 83 | + List<Double> jdl_ = repository.queryBySame(gsbm, fgsbm, rq, nbbm, jdz); | |
| 84 | + | |
| 85 | + if(jdl_.size() == 0){ | |
| 86 | + repository.insertData(gsbm, gsName, fgsbm, fgsName, rq, nbbm, | |
| 87 | + jdl, jdz, remarks, sd.format(new Date())); | |
| 88 | + }else{ | |
| 89 | + jdl += jdl_.get(0); | |
| 90 | + repository.UpdateJdl(jdl, gsbm, fgsbm, rq, nbbm, jdz); | |
| 91 | + } | |
| 92 | + } | |
| 93 | + wb.close(); | |
| 94 | + fs.close(); | |
| 95 | + } catch (Exception e) { | |
| 96 | + // TODO Auto-generated catch block | |
| 97 | + e.printStackTrace(); | |
| 98 | + return "文件导入失败"; | |
| 99 | + } finally { | |
| 100 | + file.delete(); | |
| 101 | + } | |
| 102 | + return "文件导入成功"; | |
| 103 | + } | |
| 104 | + | |
| 105 | + @Override | |
| 106 | + public Map<String, Object> query(Map<String, Object> map) { | |
| 107 | + Map<String, Object> modelMap = new HashMap<String, Object>(); | |
| 108 | + String gsbm = map.get("gsbm").toString(); | |
| 109 | + String fgsbm = map.get("fgsbm").toString(); | |
| 110 | + String rq = map.get("rq").toString(); | |
| 111 | + String nbbm = map.get("nbbm").toString(); | |
| 112 | + Integer page = Integer.valueOf(map.containsKey("page")?map.get("page").toString():"0"); | |
| 113 | + List<Jdl> query = repository.query(gsbm, fgsbm, rq, nbbm); | |
| 114 | + | |
| 115 | + if(!map.containsKey("type")){ | |
| 116 | + | |
| 117 | + int end = (page+1)*10>query.size()?query.size():(page+1)*10; | |
| 118 | + modelMap.put("dataList", query.subList(page*10, end)); | |
| 119 | + modelMap.put("totalPages", query.size()%10>0?query.size()/10+1:query.size()/10); | |
| 120 | + | |
| 121 | + } else if(map.get("type").toString().equals("export")){ | |
| 122 | + SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"), | |
| 123 | + sdfSimple = new SimpleDateFormat("yyyyMMdd"); | |
| 124 | + | |
| 125 | + List<Map<String, Object>> list = new ArrayList<Map<String, Object>>(); | |
| 126 | + for(Jdl jdl : query){ | |
| 127 | + Map<String, Object> m = new HashMap<String, Object>(); | |
| 128 | + m.put("rq", sdfMonth.format(jdl.getRq())); | |
| 129 | + m.put("nbbm", jdl.getNbbm()); | |
| 130 | + m.put("jdl", jdl.getJdl()); | |
| 131 | + m.put("jdz", jdl.getJdz()); | |
| 132 | + m.put("remarks", jdl.getRemarks()); | |
| 133 | + list.add(m); | |
| 134 | + } | |
| 135 | + | |
| 136 | + List<Iterator<?>> listI = new ArrayList<Iterator<?>>(); | |
| 137 | + Map<String, Object> m = new HashMap<String, Object>(); | |
| 138 | + ReportUtils ee = new ReportUtils(); | |
| 139 | + try { | |
| 140 | + listI.add(list.iterator()); | |
| 141 | + String path = this.getClass().getResource("/").getPath()+"static/pages/forms/"; | |
| 142 | + ee.excelReplace(listI, new Object[] { m }, path+"mould/export_Jdl.xls", | |
| 143 | + path+"export/车辆充电量" + sdfSimple.format(sdfMonth.parse(rq)) + ".xls"); | |
| 144 | + } catch (Exception e) { | |
| 145 | + // TODO: handle exception | |
| 146 | + e.printStackTrace(); | |
| 147 | + } | |
| 148 | + } | |
| 149 | + return modelMap; | |
| 150 | + } | |
| 151 | + | |
| 152 | +} | ... | ... |
src/main/java/com/bsth/service/realcontrol/ScheduleRealInfoService.java
| ... | ... | @@ -151,4 +151,8 @@ public interface ScheduleRealInfoService extends BaseService<ScheduleRealInfo, L |
| 151 | 151 | Map<String, Object> exportWaybillMore(Map<String, Object> map); |
| 152 | 152 | |
| 153 | 153 | List<SchedulePlanInfo> currentSchedulePlan(String lineCode); |
| 154 | + | |
| 155 | + Map<String,Object> lpChangeMulti(String leftIdx, String rightIdx); | |
| 156 | + | |
| 157 | + void lpChange(ScheduleRealInfo leftSch, ScheduleRealInfo rightSch); | |
| 154 | 158 | } | ... | ... |
src/main/java/com/bsth/service/realcontrol/impl/ScheduleRealInfoServiceImpl.java
| ... | ... | @@ -6,6 +6,7 @@ import com.alibaba.fastjson.JSONObject; |
| 6 | 6 | import com.bsth.common.ResponseCode; |
| 7 | 7 | import com.bsth.controller.realcontrol.dto.ChangePersonCar; |
| 8 | 8 | import com.bsth.controller.realcontrol.dto.DfsjChange; |
| 9 | +import com.bsth.controller.realcontrol.dto.LpData; | |
| 9 | 10 | import com.bsth.data.BasicData; |
| 10 | 11 | import com.bsth.data.LineConfigData; |
| 11 | 12 | import com.bsth.data.arrival.ArrivalData_GPS; |
| ... | ... | @@ -3247,4 +3248,50 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl<ScheduleRealInf |
| 3247 | 3248 | } |
| 3248 | 3249 | return rs; |
| 3249 | 3250 | } |
| 3251 | + | |
| 3252 | + | |
| 3253 | + @Override | |
| 3254 | + public Map<String, Object> lpChangeMulti(String leftIdx, String rightIdx) { | |
| 3255 | + Map<String, Object> rs = new HashMap<>(); | |
| 3256 | + List<ScheduleRealInfo> ts = new ArrayList<>(); | |
| 3257 | + try { | |
| 3258 | + List<String> leftList = Splitter.on(",").splitToList(leftIdx); | |
| 3259 | + List<String> rightList = Splitter.on(",").splitToList(rightIdx); | |
| 3260 | + if(leftList.size() != rightList.size()){ | |
| 3261 | + rs.put("status", ResponseCode.ERROR); | |
| 3262 | + rs.put("msg", "不对称的对调!"); | |
| 3263 | + return rs; | |
| 3264 | + } | |
| 3265 | + | |
| 3266 | + ScheduleRealInfo leftSch, rightSch; | |
| 3267 | + for(int i = 0; i < leftList.size(); i ++){ | |
| 3268 | + leftSch = dayOfSchedule.get(Long.parseLong(leftList.get(i))); | |
| 3269 | + rightSch = dayOfSchedule.get(Long.parseLong(rightList.get(i))); | |
| 3270 | + | |
| 3271 | + //调换路牌 | |
| 3272 | + lpChange(leftSch, rightSch); | |
| 3273 | + | |
| 3274 | + ts.add(leftSch); | |
| 3275 | + ts.add(rightSch); | |
| 3276 | + } | |
| 3277 | + | |
| 3278 | + rs.put("status", ResponseCode.SUCCESS); | |
| 3279 | + rs.put("ts", ts); | |
| 3280 | + }catch(Exception e){ | |
| 3281 | + logger.error("", e); | |
| 3282 | + rs.put("status", ResponseCode.ERROR); | |
| 3283 | + rs.put("msg", e.getMessage()); | |
| 3284 | + } | |
| 3285 | + | |
| 3286 | + return rs; | |
| 3287 | + } | |
| 3288 | + | |
| 3289 | + @Override | |
| 3290 | + public void lpChange(ScheduleRealInfo leftSch, ScheduleRealInfo rightSch) { | |
| 3291 | + LpData leftData = new LpData(leftSch); | |
| 3292 | + LpData rightData = new LpData(rightSch); | |
| 3293 | + | |
| 3294 | + leftData.appendTo(rightSch); | |
| 3295 | + rightData.appendTo(leftSch); | |
| 3296 | + } | |
| 3250 | 3297 | } |
| 3251 | 3298 | \ No newline at end of file | ... | ... |
src/main/java/com/bsth/service/schedule/impl/SchedulePlanServiceImpl.java
| ... | ... | @@ -8,6 +8,7 @@ import com.bsth.repository.schedule.SchedulePlanInfoRepository; |
| 8 | 8 | import com.bsth.repository.schedule.SchedulePlanRepository; |
| 9 | 9 | import com.bsth.service.LineService; |
| 10 | 10 | import com.bsth.service.schedule.SchedulePlanService; |
| 11 | +import com.bsth.service.schedule.TTInfoDetailService; | |
| 11 | 12 | import com.bsth.service.schedule.TTInfoService; |
| 12 | 13 | import com.bsth.service.schedule.rules.shiftloop.ScheduleCalcuParam_input; |
| 13 | 14 | import com.bsth.service.schedule.rules.shiftloop.ScheduleResult_output; |
| ... | ... | @@ -48,6 +49,8 @@ public class SchedulePlanServiceImpl extends BServiceImpl<SchedulePlan, Long> im |
| 48 | 49 | private LineService lineService; |
| 49 | 50 | @Autowired |
| 50 | 51 | private TTInfoService ttInfoService; |
| 52 | + @Autowired | |
| 53 | + private TTInfoDetailService ttInfoDetailService; | |
| 51 | 54 | |
| 52 | 55 | /** 日志记录器 */ |
| 53 | 56 | private Logger logger = LoggerFactory.getLogger(SchedulePlanServiceImpl.class); |
| ... | ... | @@ -186,9 +189,13 @@ public class SchedulePlanServiceImpl extends BServiceImpl<SchedulePlan, Long> im |
| 186 | 189 | // 构造drools session->载入数据->启动规则->计算->销毁session |
| 187 | 190 | // 创建session,内部配置的是stateful |
| 188 | 191 | KieSession session = kieBase.newKieSession(); |
| 189 | - // TODO:设置gloable对象,在drl中通过别名使用 | |
| 192 | + // 设置gloable对象,在drl中通过别名使用 | |
| 190 | 193 | session.setGlobal("log", logger); |
| 191 | 194 | session.setGlobal("lineService", lineService); |
| 195 | + session.setGlobal("ttInfoDetailService", ttInfoDetailService); | |
| 196 | + | |
| 197 | + Result rs = new Result(); // 输出gloable对象 | |
| 198 | + session.setGlobal("rs", rs); | |
| 192 | 199 | |
| 193 | 200 | // 载入数据 |
| 194 | 201 | CalcuParam calcuParam = new CalcuParam( |
| ... | ... | @@ -206,6 +213,6 @@ public class SchedulePlanServiceImpl extends BServiceImpl<SchedulePlan, Long> im |
| 206 | 213 | session.dispose(); |
| 207 | 214 | |
| 208 | 215 | |
| 209 | - return null; | |
| 216 | + return rs; | |
| 210 | 217 | } |
| 211 | 218 | } | ... | ... |
src/main/java/com/bsth/service/schedule/impl/TTInfoDetailServiceImpl.java
| ... | ... | @@ -169,8 +169,10 @@ public class TTInfoDetailServiceImpl extends BServiceImpl<TTInfoDetail, Long> im |
| 169 | 169 | Map<String, Object> ktrParms = new HashMap<>(); |
| 170 | 170 | File ktrFile = new File(this.getClass().getResource( |
| 171 | 171 | dataToolsProperties.getTtinfodetailMetadatainputktr()).toURI()); |
| 172 | +// File ktrFile2 = new File(this.getClass().getResource( | |
| 173 | +// dataToolsProperties.getTtinfodetailDatainputktr()).toURI()); | |
| 172 | 174 | File ktrFile2 = new File(this.getClass().getResource( |
| 173 | - dataToolsProperties.getTtinfodetailDatainputktr()).toURI()); | |
| 175 | + dataToolsProperties.getTtinfodetailDatainputktr2()).toURI()); | |
| 174 | 176 | |
| 175 | 177 | // 通用参数,转换文件路径,excel输入文件路径,错误输出文件路径 |
| 176 | 178 | ktrParms.put("transpath", ktrFile.getAbsolutePath()); | ... | ... |
src/main/java/com/bsth/service/schedule/rules/MyDroolsConfiguration.java
| ... | ... | @@ -52,6 +52,9 @@ public class MyDroolsConfiguration { |
| 52 | 52 | // 3.2、写入drl(写法超多,有点混乱) |
| 53 | 53 | // 这里使用文件的形式写入,TODO:以后考虑从数据库中读drl写入 |
| 54 | 54 | // 注意kfs写的时候如果指定path,强制为src/main/resources/加上文件名,还有就是文件名不要重复否则会覆盖的 |
| 55 | + kfs.write("src/main/resources/functions.drl", kieServices.getResources() | |
| 56 | + .newInputStreamResource(this.getClass().getResourceAsStream( | |
| 57 | + "/rules/functions.drl"), "UTF-8")); | |
| 55 | 58 | kfs.write("src/main/resources/HelloWorld.drl", kieServices.getResources() |
| 56 | 59 | .newInputStreamResource(this.getClass().getResourceAsStream( |
| 57 | 60 | "/rules/HelloWorld.drl"), "UTF-8")); | ... | ... |
src/main/java/com/bsth/service/schedule/rules/ttinfo2/ErrorBcCountFunction.java
0 → 100644
| 1 | +package com.bsth.service.schedule.rules.ttinfo2; | |
| 2 | + | |
| 3 | +import com.bsth.entity.schedule.TTInfoDetail; | |
| 4 | +import org.kie.api.runtime.rule.AccumulateFunction; | |
| 5 | + | |
| 6 | +import java.io.*; | |
| 7 | + | |
| 8 | +/** | |
| 9 | + * Created by xu on 17/2/28. | |
| 10 | + */ | |
| 11 | +public class ErrorBcCountFunction implements AccumulateFunction { | |
| 12 | + @Override | |
| 13 | + public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException { | |
| 14 | + } | |
| 15 | + | |
| 16 | + @Override | |
| 17 | + public void writeExternal(ObjectOutput out) throws IOException { | |
| 18 | + } | |
| 19 | + | |
| 20 | + protected static class ErrorCountData implements Externalizable { | |
| 21 | + public long errorcount = 0; | |
| 22 | + public TTInfoDetail ttInfoDetail; | |
| 23 | + | |
| 24 | + public ErrorCountData() { | |
| 25 | + } | |
| 26 | + | |
| 27 | + @Override | |
| 28 | + public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException { | |
| 29 | + errorcount = in.readLong(); | |
| 30 | + ttInfoDetail = (TTInfoDetail) in.readObject(); | |
| 31 | + } | |
| 32 | + | |
| 33 | + @Override | |
| 34 | + public void writeExternal(ObjectOutput out) throws IOException { | |
| 35 | + out.writeLong(errorcount); | |
| 36 | + out.writeObject(ttInfoDetail); | |
| 37 | + } | |
| 38 | + } | |
| 39 | + | |
| 40 | + @Override | |
| 41 | + public Serializable createContext() { | |
| 42 | + return new ErrorCountData(); | |
| 43 | + } | |
| 44 | + | |
| 45 | + @Override | |
| 46 | + public void init(Serializable context) throws Exception { | |
| 47 | + ErrorCountData errorCountData = (ErrorCountData) context; | |
| 48 | + errorCountData.errorcount = 0; | |
| 49 | + } | |
| 50 | + | |
| 51 | + @Override | |
| 52 | + public void accumulate(Serializable context, Object value) { | |
| 53 | + ErrorCountData errorCountData = (ErrorCountData) context; | |
| 54 | + TTInfoDetail ttInfoDetail = (TTInfoDetail) value; | |
| 55 | + | |
| 56 | + if (ttInfoDetail.getTtinfo() == null) { | |
| 57 | + errorCountData.errorcount ++; | |
| 58 | + return; | |
| 59 | + } | |
| 60 | + | |
| 61 | + if ("in".equals(ttInfoDetail.getBcType())) { | |
| 62 | + if (ttInfoDetail.getQdz() == null || ttInfoDetail.getTcc() == null) { | |
| 63 | + errorCountData.errorcount ++; | |
| 64 | + } | |
| 65 | + } else if ("out".equals(ttInfoDetail.getBcType())) { | |
| 66 | + if (ttInfoDetail.getTcc() == null || ttInfoDetail.getZdz() == null) { | |
| 67 | + errorCountData.errorcount ++; | |
| 68 | + } | |
| 69 | + } else { | |
| 70 | + if (ttInfoDetail.getQdz() == null || ttInfoDetail.getZdz() == null) { | |
| 71 | + errorCountData.errorcount ++; | |
| 72 | + } | |
| 73 | + } | |
| 74 | + } | |
| 75 | + | |
| 76 | + @Override | |
| 77 | + public void reverse(Serializable context, Object value) throws Exception { | |
| 78 | + ErrorCountData errorCountData = (ErrorCountData) context; | |
| 79 | + TTInfoDetail ttInfoDetail = (TTInfoDetail) value; | |
| 80 | + | |
| 81 | + if (ttInfoDetail.getTtinfo() == null) { | |
| 82 | + errorCountData.errorcount --; | |
| 83 | + return; | |
| 84 | + } | |
| 85 | + | |
| 86 | + if ("in".equals(ttInfoDetail.getBcType())) { | |
| 87 | + if (ttInfoDetail.getQdz() == null || ttInfoDetail.getTcc() == null) { | |
| 88 | + errorCountData.errorcount --; | |
| 89 | + } | |
| 90 | + } else if ("out".equals(ttInfoDetail.getBcType())) { | |
| 91 | + if (ttInfoDetail.getTcc() == null || ttInfoDetail.getZdz() == null) { | |
| 92 | + errorCountData.errorcount --; | |
| 93 | + } | |
| 94 | + } else { | |
| 95 | + if (ttInfoDetail.getQdz() == null || ttInfoDetail.getZdz() == null) { | |
| 96 | + errorCountData.errorcount --; | |
| 97 | + } | |
| 98 | + } | |
| 99 | + | |
| 100 | + } | |
| 101 | + | |
| 102 | + @Override | |
| 103 | + public Object getResult(Serializable context) throws Exception { | |
| 104 | + ErrorCountData errorCountData = (ErrorCountData) context; | |
| 105 | + return errorCountData.errorcount; | |
| 106 | + } | |
| 107 | + | |
| 108 | + @Override | |
| 109 | + public boolean supportsReverse() { | |
| 110 | + return true; | |
| 111 | + } | |
| 112 | + | |
| 113 | + @Override | |
| 114 | + public Class<?> getResultType() { | |
| 115 | + return Number.class; | |
| 116 | + } | |
| 117 | +} | ... | ... |
src/main/java/com/bsth/service/schedule/rules/ttinfo2/Result.java
| ... | ... | @@ -9,6 +9,14 @@ import java.util.List; |
| 9 | 9 | public class Result { |
| 10 | 10 | private List<StatInfo> infos = new ArrayList<>(); |
| 11 | 11 | |
| 12 | + public List<StatInfo> getInfos() { | |
| 13 | + return infos; | |
| 14 | + } | |
| 15 | + | |
| 16 | + public void setInfos(List<StatInfo> infos) { | |
| 17 | + this.infos = infos; | |
| 18 | + } | |
| 19 | + | |
| 12 | 20 | public static class StatInfo { |
| 13 | 21 | /** 时刻表id */ |
| 14 | 22 | private Long ttid; |
| ... | ... | @@ -16,16 +24,16 @@ public class Result { |
| 16 | 24 | private String ttname; |
| 17 | 25 | |
| 18 | 26 | /** 所有班次数 */ |
| 19 | - private Integer allbc; | |
| 27 | + private Long allbc; | |
| 20 | 28 | /** 进场班次数 */ |
| 21 | - private Integer inbc; | |
| 29 | + private Long inbc; | |
| 22 | 30 | /** 出场班次数 */ |
| 23 | - private Integer outbc; | |
| 31 | + private Long outbc; | |
| 24 | 32 | /** 营运班次数 */ |
| 25 | - private Integer yybc; | |
| 33 | + private Long yybc; | |
| 26 | 34 | |
| 27 | 35 | /** 错误班次数 */ |
| 28 | - private Integer errorbc; | |
| 36 | + private Long errorbc; | |
| 29 | 37 | |
| 30 | 38 | public Long getTtid() { |
| 31 | 39 | return ttid; |
| ... | ... | @@ -43,43 +51,43 @@ public class Result { |
| 43 | 51 | this.ttname = ttname; |
| 44 | 52 | } |
| 45 | 53 | |
| 46 | - public Integer getAllbc() { | |
| 54 | + public Long getAllbc() { | |
| 47 | 55 | return allbc; |
| 48 | 56 | } |
| 49 | 57 | |
| 50 | - public void setAllbc(Integer allbc) { | |
| 58 | + public void setAllbc(Long allbc) { | |
| 51 | 59 | this.allbc = allbc; |
| 52 | 60 | } |
| 53 | 61 | |
| 54 | - public Integer getInbc() { | |
| 62 | + public Long getInbc() { | |
| 55 | 63 | return inbc; |
| 56 | 64 | } |
| 57 | 65 | |
| 58 | - public void setInbc(Integer inbc) { | |
| 66 | + public void setInbc(Long inbc) { | |
| 59 | 67 | this.inbc = inbc; |
| 60 | 68 | } |
| 61 | 69 | |
| 62 | - public Integer getOutbc() { | |
| 70 | + public Long getOutbc() { | |
| 63 | 71 | return outbc; |
| 64 | 72 | } |
| 65 | 73 | |
| 66 | - public void setOutbc(Integer outbc) { | |
| 74 | + public void setOutbc(Long outbc) { | |
| 67 | 75 | this.outbc = outbc; |
| 68 | 76 | } |
| 69 | 77 | |
| 70 | - public Integer getYybc() { | |
| 78 | + public Long getYybc() { | |
| 71 | 79 | return yybc; |
| 72 | 80 | } |
| 73 | 81 | |
| 74 | - public void setYybc(Integer yybc) { | |
| 82 | + public void setYybc(Long yybc) { | |
| 75 | 83 | this.yybc = yybc; |
| 76 | 84 | } |
| 77 | 85 | |
| 78 | - public Integer getErrorbc() { | |
| 86 | + public Long getErrorbc() { | |
| 79 | 87 | return errorbc; |
| 80 | 88 | } |
| 81 | 89 | |
| 82 | - public void setErrorbc(Integer errorbc) { | |
| 90 | + public void setErrorbc(Long errorbc) { | |
| 83 | 91 | this.errorbc = errorbc; |
| 84 | 92 | } |
| 85 | 93 | } | ... | ... |
src/main/java/com/bsth/service/schedule/utils/DataToolsProperties.java
| ... | ... | @@ -72,6 +72,9 @@ public class DataToolsProperties { |
| 72 | 72 | /** 时刻表明细信息导入 */ |
| 73 | 73 | @NotNull |
| 74 | 74 | private String ttinfodetailDatainputktr; |
| 75 | + /** 时刻表明细信息导入 */ | |
| 76 | + @NotNull | |
| 77 | + private String ttinfodetailDatainputktr2; | |
| 75 | 78 | /** 排班规则信息导入 */ |
| 76 | 79 | @NotNull |
| 77 | 80 | private String scheduleruleDatainputktr; |
| ... | ... | @@ -320,4 +323,12 @@ public class DataToolsProperties { |
| 320 | 323 | public void setGuideboardsDataoutputktr(String guideboardsDataoutputktr) { |
| 321 | 324 | this.guideboardsDataoutputktr = guideboardsDataoutputktr; |
| 322 | 325 | } |
| 326 | + | |
| 327 | + public String getTtinfodetailDatainputktr2() { | |
| 328 | + return ttinfodetailDatainputktr2; | |
| 329 | + } | |
| 330 | + | |
| 331 | + public void setTtinfodetailDatainputktr2(String ttinfodetailDatainputktr2) { | |
| 332 | + this.ttinfodetailDatainputktr2 = ttinfodetailDatainputktr2; | |
| 333 | + } | |
| 323 | 334 | } | ... | ... |
src/main/resources/application-dev.properties
| ... | ... | @@ -8,9 +8,9 @@ spring.jpa.hibernate.naming_strategy= org.hibernate.cfg.ImprovedNamingStrategy |
| 8 | 8 | spring.jpa.database= MYSQL |
| 9 | 9 | spring.jpa.show-sql= false |
| 10 | 10 | spring.datasource.driver-class-name= com.mysql.jdbc.Driver |
| 11 | -spring.datasource.url= jdbc:mysql://192.168.168.201/:3306/mh_control?useUnicode=true&characterEncoding=utf-8&useSSL=false | |
| 11 | +spring.datasource.url= jdbc:mysql://localhost:3306/qp_control?useUnicode=true&characterEncoding=utf-8&useSSL=false | |
| 12 | 12 | spring.datasource.username= root |
| 13 | -spring.datasource.password= 123456 | |
| 13 | +spring.datasource.password= root | |
| 14 | 14 | #DATASOURCE |
| 15 | 15 | spring.datasource.max-active=100 |
| 16 | 16 | spring.datasource.max-idle=8 | ... | ... |
src/main/resources/datatools/config-dev.properties
| ... | ... | @@ -30,11 +30,13 @@ datatools.guideboards_datainputktr=/datatools/ktrs/guideboardDataInput.ktr |
| 30 | 30 | # 时刻表基础信息导入 |
| 31 | 31 | datatools.ttinfo_datainputktr=/datatools/ktrs/ttinfoDataInput.ktr |
| 32 | 32 | # 时刻表明细信息导入(元数据) |
| 33 | -datatools.ttinfodetail_metadatainputktr=/datatools/ktrs/ttinfodetailMetaData.ktr | |
| 33 | +datatools.ttinfodetail_metadatainputktr=/datatools/ktrs/ttinfodetailDataInputMetaData.ktr | |
| 34 | 34 | # 时刻表明细编辑用数据 |
| 35 | 35 | datatools.ttinfodetail_foreditktr=/datatools/ktrs/ttinfodetailoutputforedit.ktr |
| 36 | 36 | # 时刻表明细信息导入 |
| 37 | 37 | datatools.ttinfodetail_datainputktr=/datatools/ktrs/ttinfodetailDataInput.ktr |
| 38 | +# 时刻表明细信息导入2 | |
| 39 | +datatools.ttinfodetail_datainputktr2=/datatools/ktrs/ttinfodetailDataInput2.ktr | |
| 38 | 40 | |
| 39 | 41 | # 车辆配置信息导入 |
| 40 | 42 | datatools.carsconfig_datainputktr=/datatools/ktrs/carsConfigDataInput.ktr | ... | ... |
src/main/resources/datatools/config-prod.properties
| ... | ... | @@ -31,11 +31,13 @@ datatools.guideboards_datainputktr=/datatools/ktrs/guideboardDataInput.ktr |
| 31 | 31 | # 时刻表基础信息导入 |
| 32 | 32 | datatools.ttinfo_datainputktr=/datatools/ktrs/ttinfoDataInput.ktr |
| 33 | 33 | # 时刻表明细信息导入(元数据) |
| 34 | -datatools.ttinfodetail_metadatainputktr=/datatools/ktrs/ttinfodetailMetaData.ktr | |
| 34 | +datatools.ttinfodetail_metadatainputktr=/datatools/ktrs/ttinfodetailDataInputMetaData.ktr | |
| 35 | 35 | # 时刻表明细编辑用数据 |
| 36 | 36 | datatools.ttinfodetail_foreditktr=/datatools/ktrs/ttinfodetailoutputforedit.ktr |
| 37 | 37 | # 时刻表明细信息导入 |
| 38 | 38 | datatools.ttinfodetail_datainputktr=/datatools/ktrs/ttinfodetailDataInput.ktr |
| 39 | +# 时刻表明细信息导入2 | |
| 40 | +datatools.ttinfodetail_datainputktr2=/datatools/ktrs/ttinfodetailDataInput2.ktr | |
| 39 | 41 | |
| 40 | 42 | # 车辆配置信息导入 |
| 41 | 43 | datatools.carsconfig_datainputktr=/datatools/ktrs/carsConfigDataInput.ktr | ... | ... |