Commit 895569f163c67e3b46e203575b6a9d9a0afc2a4d
Merge branch 'minhang' of http://222.66.0.204:8090/panzhaov5/bsth_control into minhang
Showing
11 changed files
with
423 additions
and
137 deletions
Too many changes to show.
To preserve performance only 11 of 72 files are displayed.
pom.xml
| @@ -18,21 +18,19 @@ | @@ -18,21 +18,19 @@ | ||
| 18 | <groupId>org.springframework.boot</groupId> | 18 | <groupId>org.springframework.boot</groupId> |
| 19 | <artifactId>spring-boot-starter-web</artifactId> | 19 | <artifactId>spring-boot-starter-web</artifactId> |
| 20 | </dependency> | 20 | </dependency> |
| 21 | - | 21 | + |
| 22 | <dependency> | 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 | <dependency> | 28 | <dependency> |
| 29 | <groupId>org.springframework.boot</groupId> | 29 | <groupId>org.springframework.boot</groupId> |
| 30 | <artifactId>spring-boot-starter-security</artifactId> | 30 | <artifactId>spring-boot-starter-security</artifactId> |
| 31 | </dependency> | 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 | <dependency> | 34 | <dependency> |
| 37 | <groupId>org.springframework.boot</groupId> | 35 | <groupId>org.springframework.boot</groupId> |
| 38 | <artifactId>spring-boot-starter-data-jpa</artifactId> | 36 | <artifactId>spring-boot-starter-data-jpa</artifactId> |
| @@ -68,27 +66,32 @@ | @@ -68,27 +66,32 @@ | ||
| 68 | <artifactId>fastjson</artifactId> | 66 | <artifactId>fastjson</artifactId> |
| 69 | <version>1.2.4</version> | 67 | <version>1.2.4</version> |
| 70 | </dependency> | 68 | </dependency> |
| 71 | - | 69 | + |
| 72 | <dependency> | 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 | <dependency> | 75 | <dependency> |
| 78 | <groupId>commons-dbcp</groupId> | 76 | <groupId>commons-dbcp</groupId> |
| 79 | <artifactId>commons-dbcp</artifactId> | 77 | <artifactId>commons-dbcp</artifactId> |
| 80 | </dependency> | 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 | <dependency> | 84 | <dependency> |
| 87 | <groupId>org.apache.commons</groupId> | 85 | <groupId>org.apache.commons</groupId> |
| 88 | <artifactId>commons-lang3</artifactId> | 86 | <artifactId>commons-lang3</artifactId> |
| 89 | <version>3.4</version> | 87 | <version>3.4</version> |
| 90 | </dependency> | 88 | </dependency> |
| 91 | <dependency> | 89 | <dependency> |
| 90 | + <groupId>commons-fileupload</groupId> | ||
| 91 | + <artifactId>commons-fileupload</artifactId> | ||
| 92 | + <version>1.2.2</version> | ||
| 93 | + </dependency> | ||
| 94 | + <dependency> | ||
| 92 | <groupId>commons-io</groupId> | 95 | <groupId>commons-io</groupId> |
| 93 | <artifactId>commons-io</artifactId> | 96 | <artifactId>commons-io</artifactId> |
| 94 | <version>2.4</version> | 97 | <version>2.4</version> |
| @@ -111,38 +114,38 @@ | @@ -111,38 +114,38 @@ | ||
| 111 | </dependency> | 114 | </dependency> |
| 112 | <!-- ftp文件上传包 --> | 115 | <!-- ftp文件上传包 --> |
| 113 | <dependency> | 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 | </dependency> | 130 | </dependency> |
| 118 | <dependency> | 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 | </dependency> | 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 | <groupId>c3p0</groupId> | 144 | <groupId>c3p0</groupId> |
| 142 | <artifactId>c3p0</artifactId> | 145 | <artifactId>c3p0</artifactId> |
| 143 | <version>0.9.1.2</version> | 146 | <version>0.9.1.2</version> |
| 144 | </dependency> | 147 | </dependency> |
| 145 | - | 148 | + |
| 146 | <!-- 图表 --> | 149 | <!-- 图表 --> |
| 147 | <dependency> | 150 | <dependency> |
| 148 | <groupId>com.google.code.gson</groupId> | 151 | <groupId>com.google.code.gson</groupId> |
| @@ -155,82 +158,79 @@ | @@ -155,82 +158,79 @@ | ||
| 155 | <version>2.1.8</version> | 158 | <version>2.1.8</version> |
| 156 | </dependency> | 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 | <dependency> | 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 | </dependency> | 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 | <dependency> | 234 | <dependency> |
| 235 | <groupId>com.vividsolutions</groupId> | 235 | <groupId>com.vividsolutions</groupId> |
| 236 | <artifactId>jts</artifactId> | 236 | <artifactId>jts</artifactId> |
| @@ -239,18 +239,18 @@ | @@ -239,18 +239,18 @@ | ||
| 239 | 239 | ||
| 240 | </dependencies> | 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.3.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 | <build> | 255 | <build> |
| 256 | <plugins> | 256 | <plugins> |
| @@ -304,8 +304,8 @@ | @@ -304,8 +304,8 @@ | ||
| 304 | <url>http://repo.spring.io/milestone</url> | 304 | <url>http://repo.spring.io/milestone</url> |
| 305 | </pluginRepository> | 305 | </pluginRepository> |
| 306 | </pluginRepositories> | 306 | </pluginRepositories> |
| 307 | - | 307 | + |
| 308 | <properties> | 308 | <properties> |
| 309 | - <start-class>com.bsth.Application</start-class> | 309 | + <start-class>com.bsth.Application</start-class> |
| 310 | </properties> | 310 | </properties> |
| 311 | </project> | 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/entity/oil/Jdl.java
| @@ -21,10 +21,12 @@ public class Jdl { | @@ -21,10 +21,12 @@ public class Jdl { | ||
| 21 | private String gsName; | 21 | private String gsName; |
| 22 | private String fgsBm; | 22 | private String fgsBm; |
| 23 | private String fgsName; | 23 | private String fgsName; |
| 24 | - private String clZbh; | 24 | + private String nbbm; |
| 25 | private Double jdl = 0.0; | 25 | private Double jdl = 0.0; |
| 26 | private String jdz; | 26 | private String jdz; |
| 27 | private String remarks; | 27 | private String remarks; |
| 28 | + @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss") | ||
| 29 | + private Date createrDate; | ||
| 28 | 30 | ||
| 29 | 31 | ||
| 30 | public Integer getId() { | 32 | public Integer getId() { |
| @@ -63,11 +65,11 @@ public class Jdl { | @@ -63,11 +65,11 @@ public class Jdl { | ||
| 63 | public void setFgsName(String fgsName) { | 65 | public void setFgsName(String fgsName) { |
| 64 | this.fgsName = fgsName; | 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 | public Double getJdl() { | 74 | public Double getJdl() { |
| 73 | return jdl; | 75 | return jdl; |
| @@ -87,5 +89,11 @@ public class Jdl { | @@ -87,5 +89,11 @@ public class Jdl { | ||
| 87 | public void setRemarks(String remarks) { | 89 | public void setRemarks(String remarks) { |
| 88 | this.remarks = remarks; | 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/service/impl/StationServiceImpl.java
| @@ -758,7 +758,7 @@ public class StationServiceImpl extends BaseServiceImpl<Station, Integer> implem | @@ -758,7 +758,7 @@ public class StationServiceImpl extends BaseServiceImpl<Station, Integer> implem | ||
| 758 | String bsectionVector = "LINESTRING(" + sectionsBpoints + ")"; | 758 | String bsectionVector = "LINESTRING(" + sectionsBpoints + ")"; |
| 759 | 759 | ||
| 760 | // 城建坐标点集合 | 760 | // 城建坐标点集合 |
| 761 | - String csectionVector = ""; | 761 | + String csectionVector = null; |
| 762 | 762 | ||
| 763 | // 路段类型 | 763 | // 路段类型 |
| 764 | String sectionType = ""; | 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/schedule/impl/TTInfoDetailServiceImpl.java
| @@ -169,8 +169,10 @@ public class TTInfoDetailServiceImpl extends BServiceImpl<TTInfoDetail, Long> im | @@ -169,8 +169,10 @@ public class TTInfoDetailServiceImpl extends BServiceImpl<TTInfoDetail, Long> im | ||
| 169 | Map<String, Object> ktrParms = new HashMap<>(); | 169 | Map<String, Object> ktrParms = new HashMap<>(); |
| 170 | File ktrFile = new File(this.getClass().getResource( | 170 | File ktrFile = new File(this.getClass().getResource( |
| 171 | dataToolsProperties.getTtinfodetailMetadatainputktr()).toURI()); | 171 | dataToolsProperties.getTtinfodetailMetadatainputktr()).toURI()); |
| 172 | +// File ktrFile2 = new File(this.getClass().getResource( | ||
| 173 | +// dataToolsProperties.getTtinfodetailDatainputktr()).toURI()); | ||
| 172 | File ktrFile2 = new File(this.getClass().getResource( | 174 | File ktrFile2 = new File(this.getClass().getResource( |
| 173 | - dataToolsProperties.getTtinfodetailDatainputktr()).toURI()); | 175 | + dataToolsProperties.getTtinfodetailDatainputktr2()).toURI()); |
| 174 | 176 | ||
| 175 | // 通用参数,转换文件路径,excel输入文件路径,错误输出文件路径 | 177 | // 通用参数,转换文件路径,excel输入文件路径,错误输出文件路径 |
| 176 | ktrParms.put("transpath", ktrFile.getAbsolutePath()); | 178 | ktrParms.put("transpath", ktrFile.getAbsolutePath()); |
src/main/java/com/bsth/service/schedule/utils/DataToolsProperties.java
| @@ -72,6 +72,9 @@ public class DataToolsProperties { | @@ -72,6 +72,9 @@ public class DataToolsProperties { | ||
| 72 | /** 时刻表明细信息导入 */ | 72 | /** 时刻表明细信息导入 */ |
| 73 | @NotNull | 73 | @NotNull |
| 74 | private String ttinfodetailDatainputktr; | 74 | private String ttinfodetailDatainputktr; |
| 75 | + /** 时刻表明细信息导入 */ | ||
| 76 | + @NotNull | ||
| 77 | + private String ttinfodetailDatainputktr2; | ||
| 75 | /** 排班规则信息导入 */ | 78 | /** 排班规则信息导入 */ |
| 76 | @NotNull | 79 | @NotNull |
| 77 | private String scheduleruleDatainputktr; | 80 | private String scheduleruleDatainputktr; |
| @@ -320,4 +323,12 @@ public class DataToolsProperties { | @@ -320,4 +323,12 @@ public class DataToolsProperties { | ||
| 320 | public void setGuideboardsDataoutputktr(String guideboardsDataoutputktr) { | 323 | public void setGuideboardsDataoutputktr(String guideboardsDataoutputktr) { |
| 321 | this.guideboardsDataoutputktr = guideboardsDataoutputktr; | 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/datatools/config-dev.properties
| @@ -30,11 +30,13 @@ datatools.guideboards_datainputktr=/datatools/ktrs/guideboardDataInput.ktr | @@ -30,11 +30,13 @@ datatools.guideboards_datainputktr=/datatools/ktrs/guideboardDataInput.ktr | ||
| 30 | # 时刻表基础信息导入 | 30 | # 时刻表基础信息导入 |
| 31 | datatools.ttinfo_datainputktr=/datatools/ktrs/ttinfoDataInput.ktr | 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 | datatools.ttinfodetail_foreditktr=/datatools/ktrs/ttinfodetailoutputforedit.ktr | 35 | datatools.ttinfodetail_foreditktr=/datatools/ktrs/ttinfodetailoutputforedit.ktr |
| 36 | # 时刻表明细信息导入 | 36 | # 时刻表明细信息导入 |
| 37 | datatools.ttinfodetail_datainputktr=/datatools/ktrs/ttinfodetailDataInput.ktr | 37 | datatools.ttinfodetail_datainputktr=/datatools/ktrs/ttinfodetailDataInput.ktr |
| 38 | +# 时刻表明细信息导入2 | ||
| 39 | +datatools.ttinfodetail_datainputktr2=/datatools/ktrs/ttinfodetailDataInput2.ktr | ||
| 38 | 40 | ||
| 39 | # 车辆配置信息导入 | 41 | # 车辆配置信息导入 |
| 40 | datatools.carsconfig_datainputktr=/datatools/ktrs/carsConfigDataInput.ktr | 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,11 +31,13 @@ datatools.guideboards_datainputktr=/datatools/ktrs/guideboardDataInput.ktr | ||
| 31 | # 时刻表基础信息导入 | 31 | # 时刻表基础信息导入 |
| 32 | datatools.ttinfo_datainputktr=/datatools/ktrs/ttinfoDataInput.ktr | 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 | datatools.ttinfodetail_foreditktr=/datatools/ktrs/ttinfodetailoutputforedit.ktr | 36 | datatools.ttinfodetail_foreditktr=/datatools/ktrs/ttinfodetailoutputforedit.ktr |
| 37 | # 时刻表明细信息导入 | 37 | # 时刻表明细信息导入 |
| 38 | datatools.ttinfodetail_datainputktr=/datatools/ktrs/ttinfodetailDataInput.ktr | 38 | datatools.ttinfodetail_datainputktr=/datatools/ktrs/ttinfodetailDataInput.ktr |
| 39 | +# 时刻表明细信息导入2 | ||
| 40 | +datatools.ttinfodetail_datainputktr2=/datatools/ktrs/ttinfodetailDataInput2.ktr | ||
| 39 | 41 | ||
| 40 | # 车辆配置信息导入 | 42 | # 车辆配置信息导入 |
| 41 | datatools.carsconfig_datainputktr=/datatools/ktrs/carsConfigDataInput.ktr | 43 | datatools.carsconfig_datainputktr=/datatools/ktrs/carsConfigDataInput.ktr |