Commit 1db382135670efd82291315453415d06af7d0ff4

Authored by 潘钊
2 parents 9370db4a a54badcc

Merge branch 'minhang' into pudong

Showing 57 changed files with 2057 additions and 1036 deletions
@@ -106,11 +106,11 @@ @@ -106,11 +106,11 @@
106 <artifactId>janino</artifactId> 106 <artifactId>janino</artifactId>
107 </dependency> 107 </dependency>
108 108
109 - <dependency>  
110 - <groupId>org.apache.poi</groupId>  
111 - <artifactId>poi</artifactId>  
112 - <version>3.13</version>  
113 - </dependency> 109 + <dependency>
  110 + <groupId>org.apache.poi</groupId>
  111 + <artifactId>poi-ooxml</artifactId>
  112 + <version>3.13</version>
  113 + </dependency>
114 114
115 <dependency> 115 <dependency>
116 <groupId>com.google.guava</groupId> 116 <groupId>com.google.guava</groupId>
src/main/java/com/bsth/controller/realcontrol/summary/HoursController.java
1 -package com.bsth.controller.realcontrol.summary;  
2 -  
3 -import com.bsth.controller.BaseController;  
4 -import com.bsth.data.summary.entity.Hours_jsy;  
5 -import org.springframework.web.bind.annotation.RequestMapping;  
6 -import org.springframework.web.bind.annotation.RestController;  
7 -  
8 -/**  
9 - * 汇总数据 -工时  
10 - * Created by panzhao on 2017/7/27.  
11 - */  
12 -@RestController  
13 -@RequestMapping("/summary/hours")  
14 -public class HoursController extends BaseController<Hours_jsy, Long>{  
15 -} 1 +package com.bsth.controller.realcontrol.summary;
  2 +
  3 +import com.bsth.controller.BaseController;
  4 +import com.bsth.data.summary.entity.Hours_jsy;
  5 +import org.springframework.web.bind.annotation.RequestMapping;
  6 +import org.springframework.web.bind.annotation.RestController;
  7 +
  8 +/**
  9 + * 汇总数据 -工时
  10 + * Created by panzhao on 2017/7/27.
  11 + */
  12 +@RestController
  13 +@RequestMapping("/summary/hours")
  14 +public class HoursController extends BaseController<Hours_jsy, Long>{
  15 +}
src/main/java/com/bsth/controller/report/ReportController.java
@@ -297,6 +297,8 @@ public class ReportController { @@ -297,6 +297,8 @@ public class ReportController {
297 m_.put("qSj", jsonObject.getString("qSj")); 297 m_.put("qSj", jsonObject.getString("qSj"));
298 m_.put("hJh", jsonObject.getString("hJh")); 298 m_.put("hJh", jsonObject.getString("hJh"));
299 m_.put("hSj", jsonObject.getString("hSj")); 299 m_.put("hSj", jsonObject.getString("hSj"));
  300 + m_.put("djgsj", jsonObject.getString("djgsj"));
  301 + m_.put("bcjgsj", jsonObject.getString("bcjgsj"));
300 lMap.add(m_); 302 lMap.add(m_);
301 } 303 }
302 List<Iterator<?>> listI = new ArrayList<Iterator<?>>(); 304 List<Iterator<?>> listI = new ArrayList<Iterator<?>>();
src/main/java/com/bsth/controller/schedule/BController.java
@@ -6,11 +6,11 @@ import com.bsth.entity.schedule.BEntity; @@ -6,11 +6,11 @@ import com.bsth.entity.schedule.BEntity;
6 import com.bsth.entity.sys.SysUser; 6 import com.bsth.entity.sys.SysUser;
7 import com.bsth.service.schedule.BService; 7 import com.bsth.service.schedule.BService;
8 import com.bsth.service.schedule.exception.ScheduleException; 8 import com.bsth.service.schedule.exception.ScheduleException;
  9 +import com.bsth.service.schedule.utils.DataToolsFile;
9 import com.bsth.service.sys.SysUserService; 10 import com.bsth.service.sys.SysUserService;
10 import com.google.common.base.Splitter; 11 import com.google.common.base.Splitter;
11 -import jxl.Sheet;  
12 -import jxl.Workbook;  
13 import org.apache.commons.lang3.StringUtils; 12 import org.apache.commons.lang3.StringUtils;
  13 +import org.apache.poi.ss.usermodel.Workbook;
14 import org.springframework.beans.factory.annotation.Autowired; 14 import org.springframework.beans.factory.annotation.Autowired;
15 import org.springframework.data.domain.PageRequest; 15 import org.springframework.data.domain.PageRequest;
16 import org.springframework.data.domain.Sort; 16 import org.springframework.data.domain.Sort;
@@ -154,20 +154,24 @@ public class BController&lt;T, ID extends Serializable&gt; { @@ -154,20 +154,24 @@ public class BController&lt;T, ID extends Serializable&gt; {
154 public Map<String, Object> uploadFile(MultipartFile file) { 154 public Map<String, Object> uploadFile(MultipartFile file) {
155 Map<String, Object> rtn = new HashMap<>(); 155 Map<String, Object> rtn = new HashMap<>();
156 try { 156 try {
157 - File file1 = bService.uploadFile(file.getOriginalFilename(), file.getBytes()); 157 + DataToolsFile dataToolsFile = bService.uploadFile(file.getOriginalFilename(), file.getBytes());
158 // excel文件名 158 // excel文件名
159 - String fileName = file1.getAbsolutePath(); 159 + String fileName = dataToolsFile.getFile().getAbsolutePath();
  160 + Workbook wb = dataToolsFile.getFileType().getWorkBook(dataToolsFile.getFile());
  161 +
160 // excel文件sheet 162 // excel文件sheet
161 List<String> sheetnames = new ArrayList<>(); 163 List<String> sheetnames = new ArrayList<>();
162 - Workbook book = Workbook.getWorkbook(file1);  
163 - for (Sheet sheet : book.getSheets()) {  
164 - sheetnames.add(sheet.getName()); 164 + for (int i = 0; i < wb.getNumberOfSheets(); i ++) {
  165 + sheetnames.add(wb.getSheetAt(i).getSheetName());
165 } 166 }
166 167
  168 + wb.close();
  169 +
167 rtn.put("status", ResponseCode.SUCCESS); 170 rtn.put("status", ResponseCode.SUCCESS);
168 rtn.put("filename", fileName); 171 rtn.put("filename", fileName);
169 rtn.put("sheetnames", StringUtils.join(sheetnames, ",")); 172 rtn.put("sheetnames", StringUtils.join(sheetnames, ","));
170 } catch (Exception exp) { 173 } catch (Exception exp) {
  174 + exp.printStackTrace();
171 rtn.put("status", ResponseCode.ERROR); 175 rtn.put("status", ResponseCode.ERROR);
172 rtn.put("msg", exp.getMessage()); 176 rtn.put("msg", exp.getMessage());
173 } 177 }
@@ -202,9 +206,9 @@ public class BController&lt;T, ID extends Serializable&gt; { @@ -202,9 +206,9 @@ public class BController&lt;T, ID extends Serializable&gt; {
202 Map<String, Object> rtn = new HashMap<>(); 206 Map<String, Object> rtn = new HashMap<>();
203 207
204 try { 208 try {
205 - File file1 = bService.uploadFile(file.getOriginalFilename(), file.getBytes()); 209 + DataToolsFile dataToolsFile = bService.uploadFile(file.getOriginalFilename(), file.getBytes());
206 Map<String, Object> params = new HashMap<>(); 210 Map<String, Object> params = new HashMap<>();
207 - bService.importData(file1, params); 211 + bService.importData(dataToolsFile.getFile(), params);
208 212
209 rtn.put("status", ResponseCode.SUCCESS); 213 rtn.put("status", ResponseCode.SUCCESS);
210 rtn.put("msg", "上传&导入文件成功"); 214 rtn.put("msg", "上传&导入文件成功");
@@ -220,16 +224,16 @@ public class BController&lt;T, ID extends Serializable&gt; { @@ -220,16 +224,16 @@ public class BController&lt;T, ID extends Serializable&gt; {
220 @RequestMapping(value = "/exportFile", method = RequestMethod.GET) 224 @RequestMapping(value = "/exportFile", method = RequestMethod.GET)
221 public void exportFile(HttpServletResponse response, 225 public void exportFile(HttpServletResponse response,
222 @RequestParam Map<String, Object> params) throws Exception { 226 @RequestParam Map<String, Object> params) throws Exception {
223 - File file = bService.exportData(params); 227 + DataToolsFile dataToolsFile = bService.exportData(params);
224 // 流输出导出文件 228 // 流输出导出文件
225 response.setHeader("content-type", "application/octet-stream"); 229 response.setHeader("content-type", "application/octet-stream");
226 - response.setHeader("Content-Disposition", "attachment; filename=" + file.getName()); 230 + response.setHeader("Content-Disposition", "attachment; filename=" + dataToolsFile.getFile().getName());
227 response.setContentType("application/octet-stream"); 231 response.setContentType("application/octet-stream");
228 232
229 OutputStream os = response.getOutputStream(); 233 OutputStream os = response.getOutputStream();
230 BufferedOutputStream bos = new BufferedOutputStream(os); 234 BufferedOutputStream bos = new BufferedOutputStream(os);
231 235
232 - InputStream is = new FileInputStream(file); 236 + InputStream is = new FileInputStream(dataToolsFile.getFile());
233 BufferedInputStream bis = new BufferedInputStream(is); 237 BufferedInputStream bis = new BufferedInputStream(is);
234 238
235 int length = 0; 239 int length = 0;
src/main/java/com/bsth/controller/schedule/PeopleCarPlanController.java
@@ -59,4 +59,15 @@ public class PeopleCarPlanController { @@ -59,4 +59,15 @@ public class PeopleCarPlanController {
59 return peopleCarPlanService.commandState(map); 59 return peopleCarPlanService.commandState(map);
60 } 60 }
61 61
  62 + @RequestMapping(value="/commandByLineList", method = RequestMethod.GET)
  63 + public List<Map<String,Object>> commandByLineList(@RequestParam Map<String, Object> map){
  64 + return peopleCarPlanService.commandByLineList(map);
  65 + }
  66 +
  67 + @RequestMapping(value="/commandByJghList", method = RequestMethod.GET)
  68 + public List<Map<String,Object>> commandByJghList(@RequestParam Map<String, Object> map){
  69 + return peopleCarPlanService.commandByJghList(map);
  70 + }
  71 +
  72 +
62 } 73 }
src/main/java/com/bsth/data/summary/entity/Hours_jsy.java
1 -package com.bsth.data.summary.entity;  
2 -  
3 -import javax.persistence.Entity;  
4 -import javax.persistence.Id;  
5 -import javax.persistence.Table;  
6 -import javax.persistence.Transient;  
7 -import java.util.Date;  
8 -  
9 -/**  
10 - * Created by panzhao on 2017/7/26.  
11 - * table:  
12 - * 驾驶员工时  
13 - */  
14 -@Entity  
15 -@Table(name = "z_calc_hoursjsy")  
16 -public class Hours_jsy {  
17 -  
18 - @Id  
19 - private Long id;  
20 -  
21 - /** 公司编码 */  
22 - private String companyId;  
23 -  
24 - /** 分公司编码 */  
25 - private String subCompanyId;  
26 -  
27 - /** 公司名称 */  
28 - @Transient  
29 - private String companyName;  
30 - /** 分公司名称 */  
31 - @Transient  
32 - private String subCompanyName;  
33 -  
34 - /** 线路编码 */  
35 - private String lineCode;  
36 -  
37 - /** 线路名称 */  
38 - private String lineName;  
39 -  
40 - /** 驾驶员工号 */  
41 - private String jsy;  
42 -  
43 - /** 驾驶员姓名 */  
44 - private String jsyName;  
45 -  
46 - /** 车辆自编号 */  
47 - private String nbbm;  
48 -  
49 - /** 路牌 */  
50 - private String lpName;  
51 -  
52 - /** 日期 (班次日期) */  
53 - private String rq;  
54 -  
55 - /** 计划工时(分钟) */  
56 - private Integer hoursJh;  
57 - @Transient  
58 - private String hoursJhStr;  
59 -  
60 - /** 实际工时(分钟) */  
61 - private Integer hoursSj;  
62 - @Transient  
63 - private String hoursSjStr;  
64 -  
65 - /** 来源 0: 从路单结算、 1:人工录入 */  
66 - private int source;  
67 -  
68 - /** 备注 */  
69 - private String remarks;  
70 -  
71 - private Date createDate;  
72 -  
73 - public String getCompanyId() {  
74 - return companyId;  
75 - }  
76 -  
77 - public void setCompanyId(String companyId) {  
78 - this.companyId = companyId;  
79 - }  
80 -  
81 - public String getSubCompanyId() {  
82 - return subCompanyId;  
83 - }  
84 -  
85 - public void setSubCompanyId(String subCompanyId) {  
86 - this.subCompanyId = subCompanyId;  
87 - }  
88 -  
89 - public String getLineCode() {  
90 - return lineCode;  
91 - }  
92 -  
93 - public void setLineCode(String lineCode) {  
94 - this.lineCode = lineCode;  
95 - }  
96 -  
97 - public String getLineName() {  
98 - return lineName;  
99 - }  
100 -  
101 - public void setLineName(String lineName) {  
102 - this.lineName = lineName;  
103 - }  
104 -  
105 - public String getJsy() {  
106 - return jsy;  
107 - }  
108 -  
109 - public void setJsy(String jsy) {  
110 - this.jsy = jsy;  
111 - }  
112 -  
113 - public String getJsyName() {  
114 - return jsyName;  
115 - }  
116 -  
117 - public void setJsyName(String jsyName) {  
118 - this.jsyName = jsyName;  
119 - }  
120 -  
121 - public String getNbbm() {  
122 - return nbbm;  
123 - }  
124 -  
125 - public void setNbbm(String nbbm) {  
126 - this.nbbm = nbbm;  
127 - }  
128 -  
129 - public String getLpName() {  
130 - return lpName;  
131 - }  
132 -  
133 - public void setLpName(String lpName) {  
134 - this.lpName = lpName;  
135 - }  
136 -  
137 - public String getRq() {  
138 - return rq;  
139 - }  
140 -  
141 - public void setRq(String rq) {  
142 - this.rq = rq;  
143 - }  
144 -  
145 -  
146 - public int getSource() {  
147 - return source;  
148 - }  
149 -  
150 - public void setSource(int source) {  
151 - this.source = source;  
152 - }  
153 -  
154 - public String getRemarks() {  
155 - return remarks;  
156 - }  
157 -  
158 - public void setRemarks(String remarks) {  
159 - this.remarks = remarks;  
160 - }  
161 -  
162 - public Date getCreateDate() {  
163 - return createDate;  
164 - }  
165 -  
166 - public void setCreateDate(Date createDate) {  
167 - this.createDate = createDate;  
168 - }  
169 -  
170 - public Integer getHoursJh() {  
171 - return hoursJh;  
172 - }  
173 -  
174 - public void setHoursJh(Integer hoursJh) {  
175 - this.hoursJh = hoursJh;  
176 - }  
177 -  
178 - public Integer getHoursSj() {  
179 - return hoursSj;  
180 - }  
181 -  
182 - public void setHoursSj(Integer hoursSj) {  
183 - this.hoursSj = hoursSj;  
184 - }  
185 -  
186 - public String keys() {  
187 - return this.getLineCode() + "_" + this.getLpName() + "_" + this.getJsy() + "_" + this.getNbbm();  
188 - }  
189 -  
190 - public long getId() {  
191 - return id;  
192 - }  
193 -  
194 - public void setId(long id) {  
195 - this.id = id;  
196 - }  
197 -  
198 - public String getCompanyName() {  
199 - return companyName;  
200 - }  
201 -  
202 - public void setCompanyName(String companyName) {  
203 - this.companyName = companyName;  
204 - }  
205 -  
206 - public String getSubCompanyName() {  
207 - return subCompanyName;  
208 - }  
209 -  
210 - public void setSubCompanyName(String subCompanyName) {  
211 - this.subCompanyName = subCompanyName;  
212 - }  
213 -  
214 - public String getHoursJhStr() {  
215 - return hoursJhStr;  
216 - }  
217 -  
218 - public void setHoursJhStr(String hoursJhStr) {  
219 - this.hoursJhStr = hoursJhStr;  
220 - }  
221 -  
222 - public String getHoursSjStr() {  
223 - return hoursSjStr;  
224 - }  
225 -  
226 - public void setHoursSjStr(String hoursSjStr) {  
227 - this.hoursSjStr = hoursSjStr;  
228 - }  
229 -} 1 +package com.bsth.data.summary.entity;
  2 +
  3 +import javax.persistence.Entity;
  4 +import javax.persistence.Id;
  5 +import javax.persistence.Table;
  6 +import javax.persistence.Transient;
  7 +import java.util.Date;
  8 +
  9 +/**
  10 + * Created by panzhao on 2017/7/26.
  11 + * table:
  12 + * 驾驶员工时
  13 + */
  14 +@Entity
  15 +@Table(name = "z_calc_hoursjsy")
  16 +public class Hours_jsy {
  17 +
  18 + @Id
  19 + private Long id;
  20 +
  21 + /** 公司编码 */
  22 + private String companyId;
  23 +
  24 + /** 分公司编码 */
  25 + private String subCompanyId;
  26 +
  27 + /** 公司名称 */
  28 + @Transient
  29 + private String companyName;
  30 + /** 分公司名称 */
  31 + @Transient
  32 + private String subCompanyName;
  33 +
  34 + /** 线路编码 */
  35 + private String lineCode;
  36 +
  37 + /** 线路名称 */
  38 + private String lineName;
  39 +
  40 + /** 驾驶员工号 */
  41 + private String jsy;
  42 +
  43 + /** 驾驶员姓名 */
  44 + private String jsyName;
  45 +
  46 + /** 车辆自编号 */
  47 + private String nbbm;
  48 +
  49 + /** 路牌 */
  50 + private String lpName;
  51 +
  52 + /** 日期 (班次日期) */
  53 + private String rq;
  54 +
  55 + /** 计划工时(分钟) */
  56 + private Integer hoursJh;
  57 + @Transient
  58 + private String hoursJhStr;
  59 +
  60 + /** 实际工时(分钟) */
  61 + private Integer hoursSj;
  62 + @Transient
  63 + private String hoursSjStr;
  64 +
  65 + /** 来源 0: 从路单结算、 1:人工录入 */
  66 + private int source;
  67 +
  68 + /** 备注 */
  69 + private String remarks;
  70 +
  71 + private Date createDate;
  72 +
  73 + public String getCompanyId() {
  74 + return companyId;
  75 + }
  76 +
  77 + public void setCompanyId(String companyId) {
  78 + this.companyId = companyId;
  79 + }
  80 +
  81 + public String getSubCompanyId() {
  82 + return subCompanyId;
  83 + }
  84 +
  85 + public void setSubCompanyId(String subCompanyId) {
  86 + this.subCompanyId = subCompanyId;
  87 + }
  88 +
  89 + public String getLineCode() {
  90 + return lineCode;
  91 + }
  92 +
  93 + public void setLineCode(String lineCode) {
  94 + this.lineCode = lineCode;
  95 + }
  96 +
  97 + public String getLineName() {
  98 + return lineName;
  99 + }
  100 +
  101 + public void setLineName(String lineName) {
  102 + this.lineName = lineName;
  103 + }
  104 +
  105 + public String getJsy() {
  106 + return jsy;
  107 + }
  108 +
  109 + public void setJsy(String jsy) {
  110 + this.jsy = jsy;
  111 + }
  112 +
  113 + public String getJsyName() {
  114 + return jsyName;
  115 + }
  116 +
  117 + public void setJsyName(String jsyName) {
  118 + this.jsyName = jsyName;
  119 + }
  120 +
  121 + public String getNbbm() {
  122 + return nbbm;
  123 + }
  124 +
  125 + public void setNbbm(String nbbm) {
  126 + this.nbbm = nbbm;
  127 + }
  128 +
  129 + public String getLpName() {
  130 + return lpName;
  131 + }
  132 +
  133 + public void setLpName(String lpName) {
  134 + this.lpName = lpName;
  135 + }
  136 +
  137 + public String getRq() {
  138 + return rq;
  139 + }
  140 +
  141 + public void setRq(String rq) {
  142 + this.rq = rq;
  143 + }
  144 +
  145 +
  146 + public int getSource() {
  147 + return source;
  148 + }
  149 +
  150 + public void setSource(int source) {
  151 + this.source = source;
  152 + }
  153 +
  154 + public String getRemarks() {
  155 + return remarks;
  156 + }
  157 +
  158 + public void setRemarks(String remarks) {
  159 + this.remarks = remarks;
  160 + }
  161 +
  162 + public Date getCreateDate() {
  163 + return createDate;
  164 + }
  165 +
  166 + public void setCreateDate(Date createDate) {
  167 + this.createDate = createDate;
  168 + }
  169 +
  170 + public Integer getHoursJh() {
  171 + return hoursJh;
  172 + }
  173 +
  174 + public void setHoursJh(Integer hoursJh) {
  175 + this.hoursJh = hoursJh;
  176 + }
  177 +
  178 + public Integer getHoursSj() {
  179 + return hoursSj;
  180 + }
  181 +
  182 + public void setHoursSj(Integer hoursSj) {
  183 + this.hoursSj = hoursSj;
  184 + }
  185 +
  186 + public String keys() {
  187 + return this.getLineCode() + "_" + this.getLpName() + "_" + this.getJsy() + "_" + this.getNbbm();
  188 + }
  189 +
  190 + public long getId() {
  191 + return id;
  192 + }
  193 +
  194 + public void setId(long id) {
  195 + this.id = id;
  196 + }
  197 +
  198 + public String getCompanyName() {
  199 + return companyName;
  200 + }
  201 +
  202 + public void setCompanyName(String companyName) {
  203 + this.companyName = companyName;
  204 + }
  205 +
  206 + public String getSubCompanyName() {
  207 + return subCompanyName;
  208 + }
  209 +
  210 + public void setSubCompanyName(String subCompanyName) {
  211 + this.subCompanyName = subCompanyName;
  212 + }
  213 +
  214 + public String getHoursJhStr() {
  215 + return hoursJhStr;
  216 + }
  217 +
  218 + public void setHoursJhStr(String hoursJhStr) {
  219 + this.hoursJhStr = hoursJhStr;
  220 + }
  221 +
  222 + public String getHoursSjStr() {
  223 + return hoursSjStr;
  224 + }
  225 +
  226 + public void setHoursSjStr(String hoursSjStr) {
  227 + this.hoursSjStr = hoursSjStr;
  228 + }
  229 +}
src/main/java/com/bsth/data/summary/repository/HoursRepository.java
1 -package com.bsth.data.summary.repository;  
2 -  
3 -import com.bsth.data.summary.entity.Hours_jsy;  
4 -import com.bsth.repository.BaseRepository;  
5 -import org.springframework.stereotype.Repository;  
6 -  
7 -/**  
8 - * Created by panzhao on 2017/7/27.  
9 - */  
10 -@Repository  
11 -public interface HoursRepository extends BaseRepository<Hours_jsy, Long> {  
12 -} 1 +package com.bsth.data.summary.repository;
  2 +
  3 +import com.bsth.data.summary.entity.Hours_jsy;
  4 +import com.bsth.repository.BaseRepository;
  5 +import org.springframework.stereotype.Repository;
  6 +
  7 +/**
  8 + * Created by panzhao on 2017/7/27.
  9 + */
  10 +@Repository
  11 +public interface HoursRepository extends BaseRepository<Hours_jsy, Long> {
  12 +}
src/main/java/com/bsth/data/summary/service/HoursService.java
1 -package com.bsth.data.summary.service;  
2 -  
3 -import com.bsth.data.summary.entity.Hours_jsy;  
4 -import com.bsth.service.BaseService;  
5 -  
6 -/**  
7 - * Created by panzhao on 2017/7/27.  
8 - */  
9 -public interface HoursService extends BaseService<Hours_jsy, Long>{  
10 -} 1 +package com.bsth.data.summary.service;
  2 +
  3 +import com.bsth.data.summary.entity.Hours_jsy;
  4 +import com.bsth.service.BaseService;
  5 +
  6 +/**
  7 + * Created by panzhao on 2017/7/27.
  8 + */
  9 +public interface HoursService extends BaseService<Hours_jsy, Long>{
  10 +}
src/main/java/com/bsth/data/summary/service/impl/HoursServiceImpl.java
1 -package com.bsth.data.summary.service.impl;  
2 -  
3 -import com.bsth.data.BasicData;  
4 -import com.bsth.data.summary.entity.Hours_jsy;  
5 -import com.bsth.data.summary.service.HoursService;  
6 -import com.bsth.service.impl.BaseServiceImpl;  
7 -import org.springframework.data.domain.Page;  
8 -import org.springframework.data.domain.PageRequest;  
9 -import org.springframework.data.domain.Pageable;  
10 -import org.springframework.data.domain.Sort;  
11 -import org.springframework.stereotype.Service;  
12 -  
13 -import java.util.ArrayList;  
14 -import java.util.List;  
15 -import java.util.Map;  
16 -  
17 -/**  
18 - * Created by panzhao on 2017/7/27.  
19 - */  
20 -@Service  
21 -public class HoursServiceImpl extends BaseServiceImpl<Hours_jsy, Long> implements HoursService {  
22 -  
23 - @Override  
24 - public Page<Hours_jsy> list(Map<String, Object> map, Pageable pageable) {  
25 - //排序  
26 - List<Sort.Order> orderList = new ArrayList<>();  
27 - orderList.add(new Sort.Order(Sort.Direction.ASC,"rq"));  
28 - orderList.add(new Sort.Order(Sort.Direction.ASC,"lineName"));  
29 - orderList.add(new Sort.Order(Sort.Direction.ASC,"jsy"));  
30 - orderList.add(new Sort.Order(Sort.Direction.ASC,"nbbm"));  
31 -  
32 - Page<Hours_jsy> page = super.list(map, new PageRequest(pageable.getPageNumber(), pageable.getPageSize(), new Sort(orderList)));  
33 -  
34 - //公司编码转名称  
35 - List<Hours_jsy> list = page.getContent();  
36 - for(Hours_jsy h : list){  
37 - h.setCompanyName(BasicData.businessCodeNameMap.get(h.getCompanyId()));  
38 - h.setSubCompanyName(BasicData.businessFgsCodeNameMap.get(h.getSubCompanyId()+"_"+h.getCompanyId()));  
39 -  
40 - //时间字符串  
41 - h.setHoursJhStr(hoursToString(h.getHoursJh()));  
42 - h.setHoursSjStr(hoursToString(h.getHoursSj()));  
43 - }  
44 - return page;  
45 - }  
46 -  
47 - private String hoursToString(Integer minute){  
48 - if(minute==0)  
49 - return "0";  
50 - int h = minute / 60;  
51 - String str = (h<10?"0"+h:h) + "";  
52 -  
53 - int m = minute % 60;  
54 - if(m != 0)  
55 - str += ("." + (m<10?"0"+m:m));  
56 - return str;  
57 - }  
58 -} 1 +package com.bsth.data.summary.service.impl;
  2 +
  3 +import com.bsth.data.BasicData;
  4 +import com.bsth.data.summary.entity.Hours_jsy;
  5 +import com.bsth.data.summary.service.HoursService;
  6 +import com.bsth.service.impl.BaseServiceImpl;
  7 +import org.springframework.data.domain.Page;
  8 +import org.springframework.data.domain.PageRequest;
  9 +import org.springframework.data.domain.Pageable;
  10 +import org.springframework.data.domain.Sort;
  11 +import org.springframework.stereotype.Service;
  12 +
  13 +import java.util.ArrayList;
  14 +import java.util.List;
  15 +import java.util.Map;
  16 +
  17 +/**
  18 + * Created by panzhao on 2017/7/27.
  19 + */
  20 +@Service
  21 +public class HoursServiceImpl extends BaseServiceImpl<Hours_jsy, Long> implements HoursService {
  22 +
  23 + @Override
  24 + public Page<Hours_jsy> list(Map<String, Object> map, Pageable pageable) {
  25 + //排序
  26 + List<Sort.Order> orderList = new ArrayList<>();
  27 + orderList.add(new Sort.Order(Sort.Direction.ASC,"rq"));
  28 + orderList.add(new Sort.Order(Sort.Direction.ASC,"lineName"));
  29 + orderList.add(new Sort.Order(Sort.Direction.ASC,"jsy"));
  30 + orderList.add(new Sort.Order(Sort.Direction.ASC,"nbbm"));
  31 +
  32 + Page<Hours_jsy> page = super.list(map, new PageRequest(pageable.getPageNumber(), pageable.getPageSize(), new Sort(orderList)));
  33 +
  34 + //公司编码转名称
  35 + List<Hours_jsy> list = page.getContent();
  36 + for(Hours_jsy h : list){
  37 + h.setCompanyName(BasicData.businessCodeNameMap.get(h.getCompanyId()));
  38 + h.setSubCompanyName(BasicData.businessFgsCodeNameMap.get(h.getSubCompanyId()+"_"+h.getCompanyId()));
  39 +
  40 + //时间字符串
  41 + h.setHoursJhStr(hoursToString(h.getHoursJh()));
  42 + h.setHoursSjStr(hoursToString(h.getHoursSj()));
  43 + }
  44 + return page;
  45 + }
  46 +
  47 + private String hoursToString(Integer minute){
  48 + if(minute==0)
  49 + return "0";
  50 + int h = minute / 60;
  51 + String str = (h<10?"0"+h:h) + "";
  52 +
  53 + int m = minute % 60;
  54 + if(m != 0)
  55 + str += ("." + (m<10?"0"+m:m));
  56 + return str;
  57 + }
  58 +}
src/main/java/com/bsth/entity/oil/Jdl.java
@@ -22,6 +22,7 @@ public class Jdl { @@ -22,6 +22,7 @@ public class Jdl {
22 private String fgsBm; 22 private String fgsBm;
23 private String fgsName; 23 private String fgsName;
24 private String nbbm; 24 private String nbbm;
  25 + private String jsy;
25 private Double jdl = 0.0; 26 private Double jdl = 0.0;
26 private String jdz; 27 private String jdz;
27 private String remarks; 28 private String remarks;
@@ -95,5 +96,13 @@ public class Jdl { @@ -95,5 +96,13 @@ public class Jdl {
95 public void setCreaterDate(Date createrDate) { 96 public void setCreaterDate(Date createrDate) {
96 this.createrDate = createrDate; 97 this.createrDate = createrDate;
97 } 98 }
  99 + public String getJsy() {
  100 + return jsy;
  101 + }
  102 + public void setJsy(String jsy) {
  103 + this.jsy = jsy;
  104 + }
  105 +
  106 +
98 107
99 } 108 }
src/main/java/com/bsth/repository/oil/DlbRepository.java
@@ -93,5 +93,6 @@ public interface DlbRepository extends BaseRepository&lt;Dlb, Integer&gt;{ @@ -93,5 +93,6 @@ public interface DlbRepository extends BaseRepository&lt;Dlb, Integer&gt;{
93 " WHERE id = ?1", nativeQuery=true) 93 " WHERE id = ?1", nativeQuery=true)
94 public void dlbUpdate(Integer id,double czcd,double jzcd,double hd, double sh,String shyy,int yhlx); 94 public void dlbUpdate(Integer id,double czcd,double jzcd,double hd, double sh,String shyy,int yhlx);
95 95
96 - 96 + @Query(value="SELECT * FROM bsth_c_dlb where to_days(?1)=to_days(rq) and nbbm =?2 and jsy=?3 and xlbm=?4",nativeQuery=true)
  97 + List<Dlb> queryListDlb(String rq,String nbbm,String jgh,String xlbm);
97 } 98 }
src/main/java/com/bsth/repository/oil/JdlRepository.java
@@ -17,22 +17,25 @@ public interface JdlRepository extends BaseRepository&lt;Jdl, Integer&gt;{ @@ -17,22 +17,25 @@ public interface JdlRepository extends BaseRepository&lt;Jdl, Integer&gt;{
17 @Transactional 17 @Transactional
18 @Modifying 18 @Modifying
19 @Query(value="INSERT INTO bsth_c_jdl("+ 19 @Query(value="INSERT INTO bsth_c_jdl("+
20 - "gs_bm, gs_name, fgs_bm, fgs_name, rq, nbbm, jdl, jdz, remarks, creater_date)" + 20 + "gs_bm, gs_name, fgs_bm, fgs_name, rq, nbbm, jdl, jdz, remarks, creater_date,jsy)" +
21 " VALUES(" + 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, String jdl, String jdz, String remarks, String createrDate); 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'),?11)", nativeQuery=true)
  23 + void insertData(String gsbm, String gsName, String fgsbm, String fgsName, String rq, String nbbm, String jdl, String jdz, String remarks, String createrDate,String jsy);
24 24
25 - @Query(value="SELECT * FROM bsth_c_jdl where gs_bm = ?1 and fgs_bm = ?2 and rq = ?3 and nbbm like %?4%",nativeQuery=true)  
26 - List<Jdl> query(String gsbm, String fgsbm, String rq, String nbbm); 25 + @Query(value="SELECT * FROM bsth_c_jdl where gs_bm = ?1 and fgs_bm = ?2 and rq = ?3 and nbbm like %?4% and jsy like %?5%" ,nativeQuery=true)
  26 + List<Jdl> query(String gsbm, String fgsbm, String rq, String nbbm,String jsy);
27 27
28 28
29 @Query(value="SELECT * FROM bsth_c_jdl where rq = ?",nativeQuery=true) 29 @Query(value="SELECT * FROM bsth_c_jdl where rq = ?",nativeQuery=true)
30 List<Jdl> JdlList( String rq); 30 List<Jdl> JdlList( String rq);
31 31
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); 32 + @Query(value="SELECT jdl FROM bsth_c_jdl where gs_bm = ?1 and fgs_bm = ?2 and rq = ?3 and nbbm = ?4 and jsy = ?5 ",nativeQuery=true)
  33 + List<Double> queryBySame(String gsbm, String fgsbm, String rq, String nbbm, String jsy);
34 34
35 - @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)  
36 - void UpdateJdl(String jdl, String gsbm, String fgsbm, String rq, String nbbm, String jdz); 35 +
  36 + @Transactional
  37 + @Modifying
  38 + @Query(value="UPDATE bsth_c_jdl set jdl = ?1 where gs_bm = ?2 and fgs_bm = ?3 and rq = ?4 and nbbm = ?5 and jsy = ?6",nativeQuery=true)
  39 + void UpdateJdl(String jdl, String gsbm, String fgsbm, String rq, String nbbm, String jsy);
37 40
38 } 41 }
src/main/java/com/bsth/repository/oil/YlbRepository.java
@@ -62,8 +62,8 @@ public interface YlbRepository extends BaseRepository&lt;Ylb, Integer&gt;{ @@ -62,8 +62,8 @@ public interface YlbRepository extends BaseRepository&lt;Ylb, Integer&gt;{
62 List<Ylb> obtainYl_eq(String rq,String gsdm,String fgsdm,String xlbm,String nbbm,String px); 62 List<Ylb> obtainYl_eq(String rq,String gsdm,String fgsdm,String xlbm,String nbbm,String px);
63 63
64 64
65 - @Query(value="SELECT * FROM bsth_c_ylb where to_days(?1)=to_days(rq) and nbbm =?2 and jsy=?3 ",nativeQuery=true)  
66 - List<Ylb> queryListYlb(String rq,String nbbm,String jgh); 65 + @Query(value="SELECT * FROM bsth_c_ylb where to_days(?1)=to_days(rq) and nbbm =?2 and jsy=?3 and xlbm=?4",nativeQuery=true)
  66 + List<Ylb> queryListYlb(String rq,String nbbm,String jgh,String xlbm);
67 67
68 @Query(value="SELECT * FROM bsth_c_ylb where to_days(?1)=to_days(rq) and nbbm =?2 and jsy=?3 and xlbm=?4 order by ?5 asc",nativeQuery=true) 68 @Query(value="SELECT * FROM bsth_c_ylb where to_days(?1)=to_days(rq) and nbbm =?2 and jsy=?3 and xlbm=?4 order by ?5 asc",nativeQuery=true)
69 List<Ylb> checkYlb(String rq,String nbbm,String jgh,String xlbm,String px); 69 List<Ylb> checkYlb(String rq,String nbbm,String jgh,String xlbm,String px);
@@ -97,8 +97,6 @@ public interface YlbRepository extends BaseRepository&lt;Ylb, Integer&gt;{ @@ -97,8 +97,6 @@ public interface YlbRepository extends BaseRepository&lt;Ylb, Integer&gt;{
97 * @param xlbm 97 * @param xlbm
98 * @return 98 * @return
99 */ 99 */
100 - @Transactional  
101 - @Modifying  
102 @Query(value="select nbbm,sum(jzl*100) as jzl ,sum(zlc*100) as zlc from bsth_c_ylb where to_days(?1)=to_days(rq) and " 100 @Query(value="select nbbm,sum(jzl*100) as jzl ,sum(zlc*100) as zlc from bsth_c_ylb where to_days(?1)=to_days(rq) and "
103 + " ssgsdm like %?2% " 101 + " ssgsdm like %?2% "
104 + " and fgsdm like %?3%" 102 + " and fgsdm like %?3%"
src/main/java/com/bsth/service/oil/impl/DlbServiceImpl.java
@@ -158,7 +158,8 @@ public class DlbServiceImpl extends BaseServiceImpl&lt;Dlb,Integer&gt; implements DlbS @@ -158,7 +158,8 @@ public class DlbServiceImpl extends BaseServiceImpl&lt;Dlb,Integer&gt; implements DlbS
158 //手动导入没有驾驶员工号 158 //手动导入没有驾驶员工号
159 for (int i = 0; i < jdlList.size(); i++) { 159 for (int i = 0; i < jdlList.size(); i++) {
160 Jdl jdl=jdlList.get(i); 160 Jdl jdl=jdlList.get(i);
161 - if(map.get("clZbh").toString().equals(jdl.getNbbm()) ){ 161 + if(map.get("clZbh").toString().equals(jdl.getNbbm())
  162 + &&map.get("jGh").toString().equals(jdl.getJsy())){
162 jzl+=jdl.getJdl(); 163 jzl+=jdl.getJdl();
163 } 164 }
164 } 165 }
@@ -295,10 +296,11 @@ public class DlbServiceImpl extends BaseServiceImpl&lt;Dlb,Integer&gt; implements DlbS @@ -295,10 +296,11 @@ public class DlbServiceImpl extends BaseServiceImpl&lt;Dlb,Integer&gt; implements DlbS
295 t.setCzcd(0.0); 296 t.setCzcd(0.0);
296 } 297 }
297 298
298 - //手动导入没有驾驶员工号 299 + //
299 for (int i = 0; i < jdlList.size(); i++) { 300 for (int i = 0; i < jdlList.size(); i++) {
300 Jdl jdl=jdlList.get(i); 301 Jdl jdl=jdlList.get(i);
301 - if(map.get("clZbh").toString().equals(jdl.getNbbm()) ){ 302 + if(map.get("clZbh").toString().equals(jdl.getNbbm())
  303 + &&map.get("jGh").toString().equals(jdl.getJsy())){
302 jzl+=jdl.getJdl(); 304 jzl+=jdl.getJdl();
303 } 305 }
304 } 306 }
@@ -314,10 +316,10 @@ public class DlbServiceImpl extends BaseServiceImpl&lt;Dlb,Integer&gt; implements DlbS @@ -314,10 +316,10 @@ public class DlbServiceImpl extends BaseServiceImpl&lt;Dlb,Integer&gt; implements DlbS
314 } 316 }
315 317
316 t.setCdl(jzl); 318 t.setCdl(jzl);
317 - if(type.equals("add")){ 319 +// if(type.equals("add")){
318 t.setHd(jzl); 320 t.setHd(jzl);
319 t.setJzcd(t.getCzcd()); 321 t.setJzcd(t.getCzcd());
320 - } 322 +// }
321 323
322 t.setNbbm(map.get("clZbh").toString()); 324 t.setNbbm(map.get("clZbh").toString());
323 t.setJsy(map.get("jGh")==null?"":map.get("jGh").toString()); 325 t.setJsy(map.get("jGh")==null?"":map.get("jGh").toString());
src/main/java/com/bsth/service/oil/impl/JdlServiceImpl.java
@@ -59,11 +59,11 @@ public class JdlServiceImpl extends BaseServiceImpl&lt;Jdl, Integer&gt; implements Jdl @@ -59,11 +59,11 @@ public class JdlServiceImpl extends BaseServiceImpl&lt;Jdl, Integer&gt; implements Jdl
59 text += ","; 59 text += ",";
60 continue; 60 continue;
61 } 61 }
62 - text += cell.getStringCellValue() + ","; 62 + text += String.valueOf(cell) + ",";
63 } 63 }
64 String[] split = (text+";").split(","); 64 String[] split = (text+";").split(",");
65 String str = ""; 65 String str = "";
66 - for(int j = 0; j < split.length && j < 5; j++){ 66 + for(int j = 0; j < split.length && j < 6; j++){
67 str += split[j]; 67 str += split[j];
68 } 68 }
69 if(str.trim().length() == 0) 69 if(str.trim().length() == 0)
@@ -73,23 +73,24 @@ public class JdlServiceImpl extends BaseServiceImpl&lt;Jdl, Integer&gt; implements Jdl @@ -73,23 +73,24 @@ public class JdlServiceImpl extends BaseServiceImpl&lt;Jdl, Integer&gt; implements Jdl
73 for(int i = 0; i < textList.size(); i++){ 73 for(int i = 0; i < textList.size(); i++){
74 String text = textList.get(i); 74 String text = textList.get(i);
75 String[] split = text.split(","); 75 String[] split = text.split(",");
76 - String rq = split[0];  
77 - String nbbm = split[1];  
78 - double jdl = Double.valueOf(split[2].trim().length()!=0?split[2]:"0");  
79 - String jdz = split[3];  
80 - String remarks = split[4]; 76 + String rq = split[0].trim();
  77 + String nbbm = split[1].trim();
  78 + String jsy= split[2].trim();
  79 + double jdl = Double.valueOf(split[3].trim().length()!=0?split[3]:"0");
  80 + String jdz = split[4].trim();
  81 + String remarks = split[5].trim();
81 if(rq.trim().length() == 0){ 82 if(rq.trim().length() == 0){
82 rq = sdf.format(new Date()); 83 rq = sdf.format(new Date());
83 } 84 }
84 85
85 - List<Double> jdl_ = repository.queryBySame(gsbm, fgsbm, rq, nbbm, jdz); 86 + List<Double> jdl_ = repository.queryBySame(gsbm, fgsbm, rq, nbbm, jsy);
86 87
87 if(jdl_.size() == 0){ 88 if(jdl_.size() == 0){
88 repository.insertData(gsbm, gsName, fgsbm, fgsName, rq, nbbm, 89 repository.insertData(gsbm, gsName, fgsbm, fgsName, rq, nbbm,
89 - df.format(jdl), jdz, remarks, sd.format(new Date())); 90 + df.format(jdl), jdz, remarks, sd.format(new Date()),jsy);
90 }else{ 91 }else{
91 - jdl += jdl_.get(0);  
92 - repository.UpdateJdl(df.format(jdl), gsbm, fgsbm, rq, nbbm, jdz); 92 +// jdl += jdl_.get(0);
  93 + repository.UpdateJdl(df.format(jdl), gsbm, fgsbm, rq, nbbm, jsy);
93 } 94 }
94 } 95 }
95 wb.close(); 96 wb.close();
@@ -111,8 +112,9 @@ public class JdlServiceImpl extends BaseServiceImpl&lt;Jdl, Integer&gt; implements Jdl @@ -111,8 +112,9 @@ public class JdlServiceImpl extends BaseServiceImpl&lt;Jdl, Integer&gt; implements Jdl
111 String fgsbm = map.get("fgsbm").toString(); 112 String fgsbm = map.get("fgsbm").toString();
112 String rq = map.get("rq").toString(); 113 String rq = map.get("rq").toString();
113 String nbbm = map.get("nbbm").toString(); 114 String nbbm = map.get("nbbm").toString();
  115 + String jsy =map.get("jsy").toString();
114 Integer page = Integer.valueOf(map.containsKey("page")?map.get("page").toString():"0"); 116 Integer page = Integer.valueOf(map.containsKey("page")?map.get("page").toString():"0");
115 - List<Jdl> query = repository.query(gsbm, fgsbm, rq, nbbm); 117 + List<Jdl> query = repository.query(gsbm, fgsbm, rq, nbbm,jsy);
116 118
117 if(!map.containsKey("type")){ 119 if(!map.containsKey("type")){
118 120
src/main/java/com/bsth/service/realcontrol/impl/ScheduleRealInfoServiceImpl.java
@@ -24,6 +24,7 @@ import com.bsth.data.utils.CustomStringUtils; @@ -24,6 +24,7 @@ import com.bsth.data.utils.CustomStringUtils;
24 import com.bsth.entity.Cars; 24 import com.bsth.entity.Cars;
25 import com.bsth.entity.Line; 25 import com.bsth.entity.Line;
26 import com.bsth.entity.Personnel; 26 import com.bsth.entity.Personnel;
  27 +import com.bsth.entity.oil.Dlb;
27 import com.bsth.entity.oil.Ylb; 28 import com.bsth.entity.oil.Ylb;
28 import com.bsth.entity.oil.Ylxxb; 29 import com.bsth.entity.oil.Ylxxb;
29 import com.bsth.entity.realcontrol.ChildTaskPlan; 30 import com.bsth.entity.realcontrol.ChildTaskPlan;
@@ -37,6 +38,7 @@ import com.bsth.entity.schedule.SchedulePlanInfo; @@ -37,6 +38,7 @@ import com.bsth.entity.schedule.SchedulePlanInfo;
37 import com.bsth.entity.sys.DutyEmployee; 38 import com.bsth.entity.sys.DutyEmployee;
38 import com.bsth.entity.sys.SysUser; 39 import com.bsth.entity.sys.SysUser;
39 import com.bsth.repository.LineRepository; 40 import com.bsth.repository.LineRepository;
  41 +import com.bsth.repository.oil.DlbRepository;
40 import com.bsth.repository.oil.YlbRepository; 42 import com.bsth.repository.oil.YlbRepository;
41 import com.bsth.repository.oil.YlxxbRepository; 43 import com.bsth.repository.oil.YlxxbRepository;
42 import com.bsth.repository.realcontrol.ChildTaskPlanRepository; 44 import com.bsth.repository.realcontrol.ChildTaskPlanRepository;
@@ -133,6 +135,9 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf @@ -133,6 +135,9 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
133 135
134 @Autowired 136 @Autowired
135 YlbRepository ylbRepository; 137 YlbRepository ylbRepository;
  138 +
  139 + @Autowired
  140 + DlbRepository dlbRepository;
136 141
137 @Autowired 142 @Autowired
138 ReportService reposrService; 143 ReportService reposrService;
@@ -903,13 +908,18 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf @@ -903,13 +908,18 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
903 e.printStackTrace(); 908 e.printStackTrace();
904 } 909 }
905 } 910 }
906 - 911 + String xls="";
  912 + if(map.get("type").toString().equals("0")){
  913 + xls="waybill_minhang.xls";
  914 + }else{
  915 + xls="waybill_minhang_dl.xls";
  916 + }
907 917
908 918
909 String path = this.getClass().getResource("/").getPath() + "static/pages/forms/"; 919 String path = this.getClass().getResource("/").getPath() + "static/pages/forms/";
910 920
911 list.add(listMap.iterator()); 921 list.add(listMap.iterator());
912 - ee.excelReplace(list, new Object[]{scheduleRealInfos.get(0),map}, path + "mould/waybill_minhang.xls", 922 + ee.excelReplace(list, new Object[]{scheduleRealInfos.get(0),map}, path + "mould/"+xls,
913 path + "export/" + date + "-" + jName + "-" + clZbh + "-" + lpName + "-行车路单.xls"); 923 path + "export/" + date + "-" + jName + "-" + clZbh + "-" + lpName + "-行车路单.xls");
914 return scheduleRealInfos; 924 return scheduleRealInfos;
915 } 925 }
@@ -3573,27 +3583,42 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf @@ -3573,27 +3583,42 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
3573 ScheduleRealInfo s = scheduleRealInfoRepository.scheduleById(id); 3583 ScheduleRealInfo s = scheduleRealInfoRepository.scheduleById(id);
3574 String xlbm = s.getXlBm(); 3584 String xlbm = s.getXlBm();
3575 String fcrq = s.getScheduleDateStr(); 3585 String fcrq = s.getScheduleDateStr();
3576 - List<Ylxxb> listYlxxb = ylxxbRepository.queryListYlxxb(s.getClZbh(), fcrq);  
3577 - Double jzl = 0.0;  
3578 - for (int t = 0; t < listYlxxb.size(); t++) {  
3579 - Ylxxb y = listYlxxb.get(t);  
3580 - jzl = Arith.add(jzl, y.getJzl());  
3581 - }  
3582 3586
3583 - List<Ylb> listYlb = ylbRepository.queryListYlb(fcrq, s.getClZbh(), s.getjGh()); 3587 + int type=0;
3584 Double ccyl = 0.0; 3588 Double ccyl = 0.0;
3585 Double jcyl = 0.0; 3589 Double jcyl = 0.0;
3586 Double yh = 0.0; 3590 Double yh = 0.0;
3587 - for (int i = 0; i < listYlb.size(); i++) {  
3588 - Ylb y = listYlb.get(i);  
3589 - ccyl=Arith.add(ccyl, y.getCzyl());  
3590 - jcyl=Arith.add(jcyl, y.getJzyl());  
3591 - yh =Arith.add(yh ,y.getYh()); 3591 + Double jzl = 0.0;
  3592 + List<Ylb> listYlb = ylbRepository.queryListYlb(fcrq, s.getClZbh(), s.getjGh(),xlbm);
  3593 + List<Dlb> listDlb = dlbRepository.queryListDlb(fcrq, s.getClZbh(), s.getjGh(),xlbm);
  3594 + if(listYlb.size()>0){
  3595 + type=0;
  3596 + for (int i = 0; i < listYlb.size(); i++) {
  3597 + Ylb y = listYlb.get(i);
  3598 + ccyl=Arith.add(ccyl, y.getCzyl());
  3599 + jcyl=Arith.add(jcyl, y.getJzyl());
  3600 + yh =Arith.add(yh ,y.getYh());
  3601 + jzl =Arith.add(jzl, y.getJzl());
  3602 + }
  3603 + }else{
  3604 + type=1;
  3605 + for (int i = 0; i < listDlb.size(); i++) {
  3606 + Dlb d=listDlb.get(i);
  3607 + ccyl=Arith.add(ccyl, d.getCzcd());
  3608 + jcyl=Arith.add(jcyl, d.getJzcd());
  3609 + yh =Arith.add(yh ,d.getHd());
  3610 + jzl =Arith.add(jzl, d.getCdl());
  3611 + }
3592 } 3612 }
  3613 +
  3614 +
  3615 +
3593 map.put("jzl", jzl); 3616 map.put("jzl", jzl);
3594 map.put("yh", yh); 3617 map.put("yh", yh);
3595 map.put("ccyl", ccyl); 3618 map.put("ccyl", ccyl);
3596 map.put("jcyl", jcyl); 3619 map.put("jcyl", jcyl);
  3620 + map.put("type", type);
  3621 +
3597 map.put("xlName", s.getXlName()); 3622 map.put("xlName", s.getXlName());
3598 map.put("clZbh", s.getClZbh()); 3623 map.put("clZbh", s.getClZbh());
3599 map.put("plate", BasicData.nbbmCompanyPlateMap.get(s.getClZbh())); 3624 map.put("plate", BasicData.nbbmCompanyPlateMap.get(s.getClZbh()));
@@ -3861,7 +3886,7 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf @@ -3861,7 +3886,7 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
3861 } 3886 }
3862 3887
3863 dataList2.add(tempMap); 3888 dataList2.add(tempMap);
3864 - 3889 +/*
3865 size = 0; 3890 size = 0;
3866 tempMap = new HashMap<String, Object>(); 3891 tempMap = new HashMap<String, Object>();
3867 for (ScheduleRealInfo schedule : list3) { 3892 for (ScheduleRealInfo schedule : list3) {
@@ -3907,8 +3932,97 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf @@ -3907,8 +3932,97 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
3907 tempMap.put("remarks" + size, ""); 3932 tempMap.put("remarks" + size, "");
3908 } 3933 }
3909 } 3934 }
  3935 +*/
  3936 +
  3937 + size = 0;
  3938 + tempMap = new HashMap<String, Object>();
  3939 + for (ScheduleRealInfo schedule : list3) {
  3940 + int x=size%3;
  3941 + if(x==0 && size>0){
  3942 + dataList3.add(tempMap);
  3943 + tempMap = new HashMap<String, Object>();
  3944 + }
  3945 + tempMap.put("lpName" + x, schedule.getLpName());
  3946 + tempMap.put("qdzName" + x, schedule.getQdzName());
  3947 + tempMap.put("zdsj" + x, schedule.getZdsj());
  3948 + String zdsjActual=schedule.getZdsjActual() != null ? schedule.getZdsjActual() : "";
  3949 + tempMap.put("zdsjActual" + x, zdsjActual);
  3950 +
  3951 + String zdsjk="";
  3952 + String zdsjm="";
  3953 + if(!zdsjActual.equals("")){
  3954 + String[] zdsj_s=schedule.getZdsj().split(":");
  3955 + String[] zdsjActual_s=zdsjActual.split(":");
  3956 + Long zdsj_=Long.parseLong(zdsj_s[0])*60+Long.parseLong(zdsj_s[1]);
  3957 + Long zdsjActual_=Long.parseLong(zdsjActual_s[0])*60+Long.parseLong(zdsjActual_s[1]);
  3958 + if((zdsj_-zdsjActual_)>0){
  3959 + zdsjm =String.valueOf(zdsj_-zdsjActual_);
  3960 + }else{
  3961 + zdsjk =String.valueOf(zdsj_-zdsjActual_);
  3962 + }
  3963 + }
  3964 + tempMap.put("zdsjk" + x, zdsjk);
  3965 + tempMap.put("zdsjm" + x, zdsjm);
  3966 + tempMap.put("fcsj" + x, schedule.getFcsj());
  3967 + String fcsjActural=schedule.getFcsjActual() != null ? schedule.getFcsjActual() : "";
  3968 + String bcType=schedule.getBcType()!=null?schedule.getBcType():"";
  3969 + String fcsjActuralstr="";
  3970 + if(bcType.equals("in")){
  3971 + fcsjActuralstr=fcsjActural+"(进)";
  3972 + }
  3973 + if(bcType.equals("out")){
  3974 + fcsjActuralstr=fcsjActural+"(出)";
  3975 + }
  3976 + tempMap.put("fcsjActual" + x, fcsjActuralstr);
  3977 + String fcsjk="";
  3978 + String fcsjm="";
  3979 + if(!fcsjActural.equals("")){
  3980 + String[] zdsj_s=schedule.getFcsj().split(":");
  3981 + String[] fcsjActural_s=fcsjActural.split(":");
  3982 + Long zdsj_=Long.parseLong(zdsj_s[0])*60+Long.parseLong(zdsj_s[1]);
  3983 + Long fcsjActural_=Long.parseLong(fcsjActural_s[0])*60+Long.parseLong(fcsjActural_s[1]);
  3984 + if((zdsj_-fcsjActural_)>0){
  3985 + fcsjm =String.valueOf(zdsj_-fcsjActural_);
  3986 + }else{
  3987 + fcsjk =String.valueOf(zdsj_-fcsjActural_);
  3988 + }
  3989 + }
  3990 + tempMap.put("fcsjk" + x, fcsjk);
  3991 + tempMap.put("fcsjm" + x, fcsjm);
  3992 + tempMap.put("remarks" + x, schedule.getRemarks() != null ? schedule.getRemarks() : "");
3910 3993
3911 - dataList3.add(tempMap); 3994 + size++;
  3995 + }
  3996 + if(tempMap.get("lpName0")!=null){
  3997 + if(tempMap.get("lpName1")==null){
  3998 + tempMap.put("lpName1" , "");
  3999 + tempMap.put("qdzName1" , "");
  4000 + tempMap.put("zdsj1" , "");
  4001 + tempMap.put("zdsjActual1", "");
  4002 + tempMap.put("zdsjk1", "");
  4003 + tempMap.put("zdsjm1", "");
  4004 + tempMap.put("fcsj1", "");
  4005 + tempMap.put("fcsjActual1", "");
  4006 + tempMap.put("fcsjk1", "");
  4007 + tempMap.put("fcsjm1", "");
  4008 + tempMap.put("remarks1", "");
  4009 + }
  4010 + if(tempMap.get("lpName2")==null){
  4011 + tempMap.put("lpName2", "");
  4012 + tempMap.put("qdzName2", "");
  4013 + tempMap.put("zdsj2", "");
  4014 + tempMap.put("zdsjActual2", "");
  4015 + tempMap.put("zdsjk2", "");
  4016 + tempMap.put("zdsjm2", "");
  4017 + tempMap.put("fcsj2", "");
  4018 + tempMap.put("fcsjActual2", "");
  4019 + tempMap.put("fcsjk2", "");
  4020 + tempMap.put("fcsjm2", "");
  4021 + tempMap.put("remarks2", "");
  4022 + }
  4023 + dataList3.add(tempMap);
  4024 + }
  4025 +
3912 4026
3913 if (type.equals("export")) { 4027 if (type.equals("export")) {
3914 SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"), 4028 SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"),
@@ -4008,7 +4122,13 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf @@ -4008,7 +4122,13 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
4008 String path = this.getClass().getResource("/").getPath() + "static/pages/forms/"; 4122 String path = this.getClass().getResource("/").getPath() + "static/pages/forms/";
4009 4123
4010 list.add(listMap.iterator()); 4124 list.add(listMap.iterator());
4011 - ee.excelReplace(list, new Object[]{map}, path + "mould/waybill_minhang.xls", 4125 + String xls="";
  4126 + if(map.get("type").toString().equals("0")){
  4127 + xls="waybill_minhang.xls";
  4128 + }else{
  4129 + xls="waybill_minhang_dl.xls";
  4130 + }
  4131 + ee.excelReplace(list, new Object[]{map}, path + "mould/"+xls,
4012 path + "export/" + date + "-" + jName + "-" + clZbh + "-" + lpName + "-行车路单.xls"); 4132 path + "export/" + date + "-" + jName + "-" + clZbh + "-" + lpName + "-行车路单.xls");
4013 // return scheduleRealInfos; 4133 // return scheduleRealInfos;
4014 } 4134 }
src/main/java/com/bsth/service/report/impl/ReportServiceImpl.java
@@ -2402,6 +2402,8 @@ public class ReportServiceImpl implements ReportService{ @@ -2402,6 +2402,8 @@ public class ReportServiceImpl implements ReportService{
2402 m.put("qSj", time); 2402 m.put("qSj", time);
2403 m.put("hJh", listInfo.get(i+1).getFcsj()); 2403 m.put("hJh", listInfo.get(i+1).getFcsj());
2404 m.put("hSj", listInfo.get(i+1).getFcsjActual()); 2404 m.put("hSj", listInfo.get(i+1).getFcsjActual());
  2405 + m.put("djgsj", peak);
  2406 + m.put("bcjgsj", (fscjNext-fcsjTime)/60000);
2405 mapList.add(m); 2407 mapList.add(m);
2406 } 2408 }
2407 }else{ 2409 }else{
@@ -2416,6 +2418,8 @@ public class ReportServiceImpl implements ReportService{ @@ -2416,6 +2418,8 @@ public class ReportServiceImpl implements ReportService{
2416 m.put("qSj", time); 2418 m.put("qSj", time);
2417 m.put("hJh", listInfo.get(i+1).getFcsj()); 2419 m.put("hJh", listInfo.get(i+1).getFcsj());
2418 m.put("hSj", listInfo.get(i+1).getFcsjActual()); 2420 m.put("hSj", listInfo.get(i+1).getFcsjActual());
  2421 + m.put("djgsj", trough);
  2422 + m.put("bcjgsj", (fscjNext-fcsjTime)/60000);
2419 mapList.add(m); 2423 mapList.add(m);
2420 } 2424 }
2421 } 2425 }
@@ -2443,6 +2447,8 @@ public class ReportServiceImpl implements ReportService{ @@ -2443,6 +2447,8 @@ public class ReportServiceImpl implements ReportService{
2443 m.put("qSj", time); 2447 m.put("qSj", time);
2444 m.put("hJh", listInfo.get(i+1).getFcsj()); 2448 m.put("hJh", listInfo.get(i+1).getFcsj());
2445 m.put("hSj", listInfo.get(i+1).getFcsjActual()); 2449 m.put("hSj", listInfo.get(i+1).getFcsjActual());
  2450 + m.put("djgsj", peak);
  2451 + m.put("bcjgsj", (fscjNext-fcsjTime)/60000);
2446 mapList.add(m); 2452 mapList.add(m);
2447 } 2453 }
2448 }else{ 2454 }else{
@@ -2457,6 +2463,8 @@ public class ReportServiceImpl implements ReportService{ @@ -2457,6 +2463,8 @@ public class ReportServiceImpl implements ReportService{
2457 m.put("qSj", time); 2463 m.put("qSj", time);
2458 m.put("hJh", listInfo.get(i+1).getFcsj()); 2464 m.put("hJh", listInfo.get(i+1).getFcsj());
2459 m.put("hSj", listInfo.get(i+1).getFcsjActual()); 2465 m.put("hSj", listInfo.get(i+1).getFcsjActual());
  2466 + m.put("djgsj", trough);
  2467 + m.put("bcjgsj", (fscjNext-fcsjTime)/60000);
2460 mapList.add(m); 2468 mapList.add(m);
2461 } 2469 }
2462 } 2470 }
src/main/java/com/bsth/service/schedule/PeopleCarPlanService.java
@@ -20,4 +20,6 @@ public interface PeopleCarPlanService { @@ -20,4 +20,6 @@ public interface PeopleCarPlanService {
20 List<Map<String, Object>> firstAndLastBus_sum(Map<String, Object> map); 20 List<Map<String, Object>> firstAndLastBus_sum(Map<String, Object> map);
21 21
22 List<Map<String, Object>> commandState(Map<String, Object> map); 22 List<Map<String, Object>> commandState(Map<String, Object> map);
  23 + List<Map<String, Object>> commandByLineList(Map<String, Object> map);
  24 + List<Map<String, Object>> commandByJghList(Map<String, Object> map);
23 } 25 }
src/main/java/com/bsth/service/schedule/datatools/CarConfigInfoDataToolsImpl.java
1 package com.bsth.service.schedule.datatools; 1 package com.bsth.service.schedule.datatools;
2 2
3 import com.bsth.service.schedule.exception.ScheduleException; 3 import com.bsth.service.schedule.exception.ScheduleException;
4 -import com.bsth.service.schedule.utils.DataToolsProperties;  
5 -import com.bsth.service.schedule.utils.DataToolsService;  
6 -import jxl.Cell;  
7 -import jxl.Sheet;  
8 -import jxl.Workbook; 4 +import com.bsth.service.schedule.utils.*;
9 import jxl.write.Label; 5 import jxl.write.Label;
10 import jxl.write.WritableSheet; 6 import jxl.write.WritableSheet;
11 import jxl.write.WritableWorkbook; 7 import jxl.write.WritableWorkbook;
  8 +import org.apache.poi.ss.usermodel.Sheet;
  9 +import org.apache.poi.ss.usermodel.Workbook;
12 import org.slf4j.Logger; 10 import org.slf4j.Logger;
13 import org.slf4j.LoggerFactory; 11 import org.slf4j.LoggerFactory;
14 import org.springframework.beans.factory.annotation.Autowired; 12 import org.springframework.beans.factory.annotation.Autowired;
@@ -39,26 +37,45 @@ public class CarConfigInfoDataToolsImpl implements DataToolsService { @@ -39,26 +37,45 @@ public class CarConfigInfoDataToolsImpl implements DataToolsService {
39 private DataToolsProperties dataToolsProperties; 37 private DataToolsProperties dataToolsProperties;
40 38
41 @Override 39 @Override
42 - public File uploadFile(String filename, byte[] filedata) throws ScheduleException { 40 + public DataToolsFile uploadFile(String filename, byte[] filedata) throws ScheduleException {
43 try { 41 try {
44 - // 对上传的excel文件做处理,将第一个sheet名字设定为工作表1  
45 - File file = dataToolsService.uploadFile(filename, filedata);  
46 - Workbook workbook = Workbook.getWorkbook(file);  
47 - Sheet sheet = workbook.getSheet(0); 42 + // 对上传的excel文件做处理
  43 + // 将第一个sheet保存成一个xls文件
  44 + DataToolsFile dataToolsFile = dataToolsService.uploadFile(filename, filedata);
  45 + File file = dataToolsFile.getFile();
  46 +
  47 + // poi api
  48 + Workbook poi_workbook = dataToolsFile.getFileType().getWorkBook(file);
  49 + Sheet poi_sheet = poi_workbook.getSheetAt(0); // 第一个sheet
  50 + int rowNum = poi_sheet.getLastRowNum(); // 获取总共多少行
  51 + if (rowNum < 0) {
  52 + throw new RuntimeException("表格内容为空!");
  53 + }
  54 + int colNum = poi_sheet.getRow(0).getLastCellNum(); // 获取总共多少列,以第一行为主
48 55
  56 + // jxl api
49 File fileCal = new File(file.getAbsolutePath() + "_sheetChange.xls"); 57 File fileCal = new File(file.getAbsolutePath() + "_sheetChange.xls");
50 - WritableWorkbook writableWorkbook = Workbook.createWorkbook(fileCal); 58 + WritableWorkbook writableWorkbook = jxl.Workbook.createWorkbook(fileCal);
51 WritableSheet writableSheet = writableWorkbook.createSheet("工作表1", 0); 59 WritableSheet writableSheet = writableWorkbook.createSheet("工作表1", 0);
52 - for (int i = 0; i < sheet.getRows(); i++) {  
53 - Cell[] cells = sheet.getRow(i);  
54 - for (int j = 0; j < cells.length; j++) {  
55 - writableSheet.addCell(new Label(j, i, cells[j].getContents())); 60 +
  61 + for (int i = 0; i <= rowNum; i++) {
  62 + for (int j = 0; j <= colNum; j++) {
  63 + // poi读
  64 + String cellContent = PoiUtils.getStringValueFromCell(poi_sheet.getRow(i).getCell(j));
  65 + // jxl写
  66 + writableSheet.addCell(new Label(j, i, cellContent));
56 } 67 }
  68 +
57 } 69 }
58 writableWorkbook.write(); 70 writableWorkbook.write();
59 writableWorkbook.close(); 71 writableWorkbook.close();
  72 + poi_workbook.close();
  73 +
  74 + DataToolsFile dataToolsFile1 = new DataToolsFile();
  75 + dataToolsFile1.setFile(fileCal);
  76 + dataToolsFile1.setFileType(DataToolsFileType.XLS);
60 77
61 - return fileCal; 78 + return dataToolsFile1;
62 79
63 } catch (Exception exp) { 80 } catch (Exception exp) {
64 throw new ScheduleException(exp); 81 throw new ScheduleException(exp);
@@ -96,7 +113,7 @@ public class CarConfigInfoDataToolsImpl implements DataToolsService { @@ -96,7 +113,7 @@ public class CarConfigInfoDataToolsImpl implements DataToolsService {
96 } 113 }
97 114
98 @Override 115 @Override
99 - public File exportData(Map<String, Object> params) throws ScheduleException { 116 + public DataToolsFile exportData(Map<String, Object> params) throws ScheduleException {
100 try { 117 try {
101 LOGGER.info("//---------------- 导出车辆配置信息 start... ----------------//"); 118 LOGGER.info("//---------------- 导出车辆配置信息 start... ----------------//");
102 // 创建ktr转换所需参数 119 // 创建ktr转换所需参数
@@ -110,7 +127,7 @@ public class CarConfigInfoDataToolsImpl implements DataToolsService { @@ -110,7 +127,7 @@ public class CarConfigInfoDataToolsImpl implements DataToolsService {
110 127
111 ktrParms.putAll(params); 128 ktrParms.putAll(params);
112 129
113 - File file = dataToolsService.exportData(ktrParms); 130 + DataToolsFile file = dataToolsService.exportData(ktrParms);
114 131
115 LOGGER.info("//---------------- 导出车辆配置信息 success... ----------------//"); 132 LOGGER.info("//---------------- 导出车辆配置信息 success... ----------------//");
116 133
src/main/java/com/bsth/service/schedule/datatools/CarsDataToolsImpl.java
1 package com.bsth.service.schedule.datatools; 1 package com.bsth.service.schedule.datatools;
2 2
3 import com.bsth.service.schedule.exception.ScheduleException; 3 import com.bsth.service.schedule.exception.ScheduleException;
4 -import com.bsth.service.schedule.utils.DataToolsProperties;  
5 -import com.bsth.service.schedule.utils.DataToolsService;  
6 -import jxl.Cell;  
7 -import jxl.Sheet;  
8 -import jxl.Workbook; 4 +import com.bsth.service.schedule.utils.*;
9 import jxl.write.Label; 5 import jxl.write.Label;
10 import jxl.write.WritableSheet; 6 import jxl.write.WritableSheet;
11 import jxl.write.WritableWorkbook; 7 import jxl.write.WritableWorkbook;
@@ -39,26 +35,45 @@ public class CarsDataToolsImpl implements DataToolsService { @@ -39,26 +35,45 @@ public class CarsDataToolsImpl implements DataToolsService {
39 private DataToolsProperties dataToolsProperties; 35 private DataToolsProperties dataToolsProperties;
40 36
41 @Override 37 @Override
42 - public File uploadFile(String filename, byte[] filedata) throws ScheduleException { 38 + public DataToolsFile uploadFile(String filename, byte[] filedata) throws ScheduleException {
43 try { 39 try {
44 - // 对上传的excel文件做处理,将第一个sheet名字设定为工作表1  
45 - File file = dataToolsService.uploadFile(filename, filedata);  
46 - Workbook workbook = Workbook.getWorkbook(file);  
47 - Sheet sheet = workbook.getSheet(0); 40 + // 对上传的excel文件做处理
  41 + // 将第一个sheet保存成一个xls文件
  42 + DataToolsFile dataToolsFile = dataToolsService.uploadFile(filename, filedata);
  43 + File file = dataToolsFile.getFile();
  44 +
  45 + // poi api
  46 + org.apache.poi.ss.usermodel.Workbook poi_workbook = dataToolsFile.getFileType().getWorkBook(file);
  47 + org.apache.poi.ss.usermodel.Sheet poi_sheet = poi_workbook.getSheetAt(0); // 第一个sheet
  48 + int rowNum = poi_sheet.getLastRowNum(); // 获取总共多少行
  49 + if (rowNum < 0) {
  50 + throw new RuntimeException("表格内容为空!");
  51 + }
  52 + int colNum = poi_sheet.getRow(0).getLastCellNum(); // 获取总共多少列,以第一行为主
48 53
  54 + // jxl api
49 File fileCal = new File(file.getAbsolutePath() + "_sheetChange.xls"); 55 File fileCal = new File(file.getAbsolutePath() + "_sheetChange.xls");
50 - WritableWorkbook writableWorkbook = Workbook.createWorkbook(fileCal); 56 + WritableWorkbook writableWorkbook = jxl.Workbook.createWorkbook(fileCal);
51 WritableSheet writableSheet = writableWorkbook.createSheet("工作表1", 0); 57 WritableSheet writableSheet = writableWorkbook.createSheet("工作表1", 0);
52 - for (int i = 0; i < sheet.getRows(); i++) {  
53 - Cell[] cells = sheet.getRow(i);  
54 - for (int j = 0; j < cells.length; j++) {  
55 - writableSheet.addCell(new Label(j, i, cells[j].getContents())); 58 +
  59 + for (int i = 0; i <= rowNum; i++) {
  60 + for (int j = 0; j <= colNum; j++) {
  61 + // poi读
  62 + String cellContent = PoiUtils.getStringValueFromCell(poi_sheet.getRow(i).getCell(j));
  63 + // jxl写
  64 + writableSheet.addCell(new Label(j, i, cellContent));
56 } 65 }
  66 +
57 } 67 }
58 writableWorkbook.write(); 68 writableWorkbook.write();
59 writableWorkbook.close(); 69 writableWorkbook.close();
  70 + poi_workbook.close();
  71 +
  72 + DataToolsFile dataToolsFile1 = new DataToolsFile();
  73 + dataToolsFile1.setFile(fileCal);
  74 + dataToolsFile1.setFileType(DataToolsFileType.XLS);
60 75
61 - return fileCal; 76 + return dataToolsFile1;
62 77
63 } catch (Exception exp) { 78 } catch (Exception exp) {
64 throw new ScheduleException(exp); 79 throw new ScheduleException(exp);
@@ -94,7 +109,7 @@ public class CarsDataToolsImpl implements DataToolsService { @@ -94,7 +109,7 @@ public class CarsDataToolsImpl implements DataToolsService {
94 } 109 }
95 110
96 @Override 111 @Override
97 - public File exportData(Map<String, Object> params) throws ScheduleException { 112 + public DataToolsFile exportData(Map<String, Object> params) throws ScheduleException {
98 try { 113 try {
99 LOGGER.info("//---------------- 导出车辆基础信息 start... ----------------//"); 114 LOGGER.info("//---------------- 导出车辆基础信息 start... ----------------//");
100 // 创建ktr转换所需参数 115 // 创建ktr转换所需参数
@@ -106,7 +121,7 @@ public class CarsDataToolsImpl implements DataToolsService { @@ -106,7 +121,7 @@ public class CarsDataToolsImpl implements DataToolsService {
106 ktrParms.put("transpath", ktrFile.getAbsolutePath()); 121 ktrParms.put("transpath", ktrFile.getAbsolutePath());
107 ktrParms.put("filename", "车辆基础信息_download-"); 122 ktrParms.put("filename", "车辆基础信息_download-");
108 123
109 - File file = dataToolsService.exportData(ktrParms); 124 + DataToolsFile file = dataToolsService.exportData(ktrParms);
110 125
111 LOGGER.info("//---------------- 导出车辆基础信息 success... ----------------//"); 126 LOGGER.info("//---------------- 导出车辆基础信息 success... ----------------//");
112 127
src/main/java/com/bsth/service/schedule/datatools/EmployeeConfigInfoDataToolsImpl.java
1 package com.bsth.service.schedule.datatools; 1 package com.bsth.service.schedule.datatools;
2 2
3 import com.bsth.service.schedule.exception.ScheduleException; 3 import com.bsth.service.schedule.exception.ScheduleException;
4 -import com.bsth.service.schedule.utils.DataToolsProperties;  
5 -import com.bsth.service.schedule.utils.DataToolsService;  
6 -import jxl.Cell;  
7 -import jxl.Sheet;  
8 -import jxl.Workbook; 4 +import com.bsth.service.schedule.utils.*;
9 import jxl.write.Label; 5 import jxl.write.Label;
10 import jxl.write.WritableSheet; 6 import jxl.write.WritableSheet;
11 import jxl.write.WritableWorkbook; 7 import jxl.write.WritableWorkbook;
@@ -39,26 +35,45 @@ public class EmployeeConfigInfoDataToolsImpl implements DataToolsService { @@ -39,26 +35,45 @@ public class EmployeeConfigInfoDataToolsImpl implements DataToolsService {
39 private DataToolsProperties dataToolsProperties; 35 private DataToolsProperties dataToolsProperties;
40 36
41 @Override 37 @Override
42 - public File uploadFile(String filename, byte[] filedata) throws ScheduleException { 38 + public DataToolsFile uploadFile(String filename, byte[] filedata) throws ScheduleException {
43 try { 39 try {
44 - // 对上传的excel文件做处理,将第一个sheet名字设定为工作表1  
45 - File file = dataToolsService.uploadFile(filename, filedata);  
46 - Workbook workbook = Workbook.getWorkbook(file);  
47 - Sheet sheet = workbook.getSheet(0); 40 + // 对上传的excel文件做处理
  41 + // 将第一个sheet保存成一个xls文件
  42 + DataToolsFile dataToolsFile = dataToolsService.uploadFile(filename, filedata);
  43 + File file = dataToolsFile.getFile();
  44 +
  45 + // poi api
  46 + org.apache.poi.ss.usermodel.Workbook poi_workbook = dataToolsFile.getFileType().getWorkBook(file);
  47 + org.apache.poi.ss.usermodel.Sheet poi_sheet = poi_workbook.getSheetAt(0); // 第一个sheet
  48 + int rowNum = poi_sheet.getLastRowNum(); // 获取总共多少行
  49 + if (rowNum < 0) {
  50 + throw new RuntimeException("表格内容为空!");
  51 + }
  52 + int colNum = poi_sheet.getRow(0).getLastCellNum(); // 获取总共多少列,以第一行为主
48 53
  54 + // jxl api
49 File fileCal = new File(file.getAbsolutePath() + "_sheetChange.xls"); 55 File fileCal = new File(file.getAbsolutePath() + "_sheetChange.xls");
50 - WritableWorkbook writableWorkbook = Workbook.createWorkbook(fileCal); 56 + WritableWorkbook writableWorkbook = jxl.Workbook.createWorkbook(fileCal);
51 WritableSheet writableSheet = writableWorkbook.createSheet("工作表1", 0); 57 WritableSheet writableSheet = writableWorkbook.createSheet("工作表1", 0);
52 - for (int i = 0; i < sheet.getRows(); i++) {  
53 - Cell[] cells = sheet.getRow(i);  
54 - for (int j = 0; j < cells.length; j++) {  
55 - writableSheet.addCell(new Label(j, i, cells[j].getContents())); 58 +
  59 + for (int i = 0; i <= rowNum; i++) {
  60 + for (int j = 0; j <= colNum; j++) {
  61 + // poi读
  62 + String cellContent = PoiUtils.getStringValueFromCell(poi_sheet.getRow(i).getCell(j));
  63 + // jxl写
  64 + writableSheet.addCell(new Label(j, i, cellContent));
56 } 65 }
  66 +
57 } 67 }
58 writableWorkbook.write(); 68 writableWorkbook.write();
59 writableWorkbook.close(); 69 writableWorkbook.close();
  70 + poi_workbook.close();
  71 +
  72 + DataToolsFile dataToolsFile1 = new DataToolsFile();
  73 + dataToolsFile1.setFile(fileCal);
  74 + dataToolsFile1.setFileType(DataToolsFileType.XLS);
60 75
61 - return fileCal; 76 + return dataToolsFile1;
62 77
63 } catch (Exception exp) { 78 } catch (Exception exp) {
64 throw new ScheduleException(exp); 79 throw new ScheduleException(exp);
@@ -96,7 +111,7 @@ public class EmployeeConfigInfoDataToolsImpl implements DataToolsService { @@ -96,7 +111,7 @@ public class EmployeeConfigInfoDataToolsImpl implements DataToolsService {
96 } 111 }
97 112
98 @Override 113 @Override
99 - public File exportData(Map<String, Object> params) throws ScheduleException { 114 + public DataToolsFile exportData(Map<String, Object> params) throws ScheduleException {
100 try { 115 try {
101 LOGGER.info("//---------------- 导出人员配置信息 start... ----------------//"); 116 LOGGER.info("//---------------- 导出人员配置信息 start... ----------------//");
102 // 创建ktr转换所需参数 117 // 创建ktr转换所需参数
@@ -110,7 +125,7 @@ public class EmployeeConfigInfoDataToolsImpl implements DataToolsService { @@ -110,7 +125,7 @@ public class EmployeeConfigInfoDataToolsImpl implements DataToolsService {
110 125
111 ktrParms.putAll(params); 126 ktrParms.putAll(params);
112 127
113 - File file = dataToolsService.exportData(ktrParms); 128 + DataToolsFile file = dataToolsService.exportData(ktrParms);
114 129
115 LOGGER.info("//---------------- 导出人员配置信息 success... ----------------//"); 130 LOGGER.info("//---------------- 导出人员配置信息 success... ----------------//");
116 131
src/main/java/com/bsth/service/schedule/datatools/EmployeeDataToolsImpl.java
1 package com.bsth.service.schedule.datatools; 1 package com.bsth.service.schedule.datatools;
2 2
3 import com.bsth.service.schedule.exception.ScheduleException; 3 import com.bsth.service.schedule.exception.ScheduleException;
4 -import com.bsth.service.schedule.utils.DataToolsProperties;  
5 -import com.bsth.service.schedule.utils.DataToolsService;  
6 -import jxl.Cell;  
7 -import jxl.Sheet;  
8 -import jxl.Workbook; 4 +import com.bsth.service.schedule.utils.*;
9 import jxl.write.Label; 5 import jxl.write.Label;
10 import jxl.write.WritableSheet; 6 import jxl.write.WritableSheet;
11 import jxl.write.WritableWorkbook; 7 import jxl.write.WritableWorkbook;
@@ -39,26 +35,45 @@ public class EmployeeDataToolsImpl implements DataToolsService { @@ -39,26 +35,45 @@ public class EmployeeDataToolsImpl implements DataToolsService {
39 private DataToolsProperties dataToolsProperties; 35 private DataToolsProperties dataToolsProperties;
40 36
41 @Override 37 @Override
42 - public File uploadFile(String filename, byte[] filedata) throws ScheduleException { 38 + public DataToolsFile uploadFile(String filename, byte[] filedata) throws ScheduleException {
43 try { 39 try {
44 - // 对上传的excel文件做处理,将第一个sheet名字设定为工作表1  
45 - File file = dataToolsService.uploadFile(filename, filedata);  
46 - Workbook workbook = Workbook.getWorkbook(file);  
47 - Sheet sheet = workbook.getSheet(0); 40 + // 对上传的excel文件做处理
  41 + // 将第一个sheet保存成一个xls文件
  42 + DataToolsFile dataToolsFile = dataToolsService.uploadFile(filename, filedata);
  43 + File file = dataToolsFile.getFile();
  44 +
  45 + // poi api
  46 + org.apache.poi.ss.usermodel.Workbook poi_workbook = dataToolsFile.getFileType().getWorkBook(file);
  47 + org.apache.poi.ss.usermodel.Sheet poi_sheet = poi_workbook.getSheetAt(0); // 第一个sheet
  48 + int rowNum = poi_sheet.getLastRowNum(); // 获取总共多少行
  49 + if (rowNum < 0) {
  50 + throw new RuntimeException("表格内容为空!");
  51 + }
  52 + int colNum = poi_sheet.getRow(0).getLastCellNum(); // 获取总共多少列,以第一行为主
48 53
  54 + // jxl api
49 File fileCal = new File(file.getAbsolutePath() + "_sheetChange.xls"); 55 File fileCal = new File(file.getAbsolutePath() + "_sheetChange.xls");
50 - WritableWorkbook writableWorkbook = Workbook.createWorkbook(fileCal); 56 + WritableWorkbook writableWorkbook = jxl.Workbook.createWorkbook(fileCal);
51 WritableSheet writableSheet = writableWorkbook.createSheet("工作表1", 0); 57 WritableSheet writableSheet = writableWorkbook.createSheet("工作表1", 0);
52 - for (int i = 0; i < sheet.getRows(); i++) {  
53 - Cell[] cells = sheet.getRow(i);  
54 - for (int j = 0; j < cells.length; j++) {  
55 - writableSheet.addCell(new Label(j, i, cells[j].getContents())); 58 +
  59 + for (int i = 0; i <= rowNum; i++) {
  60 + for (int j = 0; j <= colNum; j++) {
  61 + // poi读
  62 + String cellContent = PoiUtils.getStringValueFromCell(poi_sheet.getRow(i).getCell(j));
  63 + // jxl写
  64 + writableSheet.addCell(new Label(j, i, cellContent));
56 } 65 }
  66 +
57 } 67 }
58 writableWorkbook.write(); 68 writableWorkbook.write();
59 writableWorkbook.close(); 69 writableWorkbook.close();
  70 + poi_workbook.close();
  71 +
  72 + DataToolsFile dataToolsFile1 = new DataToolsFile();
  73 + dataToolsFile1.setFile(fileCal);
  74 + dataToolsFile1.setFileType(DataToolsFileType.XLS);
60 75
61 - return fileCal; 76 + return dataToolsFile1;
62 77
63 } catch (Exception exp) { 78 } catch (Exception exp) {
64 throw new ScheduleException(exp); 79 throw new ScheduleException(exp);
@@ -94,7 +109,7 @@ public class EmployeeDataToolsImpl implements DataToolsService { @@ -94,7 +109,7 @@ public class EmployeeDataToolsImpl implements DataToolsService {
94 } 109 }
95 110
96 @Override 111 @Override
97 - public File exportData(Map<String, Object> params) throws ScheduleException { 112 + public DataToolsFile exportData(Map<String, Object> params) throws ScheduleException {
98 try { 113 try {
99 LOGGER.info("//---------------- 导出人员基础信息 start... ----------------//"); 114 LOGGER.info("//---------------- 导出人员基础信息 start... ----------------//");
100 // 创建ktr转换所需参数 115 // 创建ktr转换所需参数
@@ -106,7 +121,7 @@ public class EmployeeDataToolsImpl implements DataToolsService { @@ -106,7 +121,7 @@ public class EmployeeDataToolsImpl implements DataToolsService {
106 ktrParms.put("transpath", ktrFile.getAbsolutePath()); 121 ktrParms.put("transpath", ktrFile.getAbsolutePath());
107 ktrParms.put("filename", "人员基础信息_download-"); 122 ktrParms.put("filename", "人员基础信息_download-");
108 123
109 - File file = dataToolsService.exportData(ktrParms); 124 + DataToolsFile file = dataToolsService.exportData(ktrParms);
110 125
111 LOGGER.info("//---------------- 导出人员基础信息 success... ----------------//"); 126 LOGGER.info("//---------------- 导出人员基础信息 success... ----------------//");
112 127
src/main/java/com/bsth/service/schedule/datatools/GuideboardInfoDataToolsImpl.java
1 package com.bsth.service.schedule.datatools; 1 package com.bsth.service.schedule.datatools;
2 2
3 import com.bsth.service.schedule.exception.ScheduleException; 3 import com.bsth.service.schedule.exception.ScheduleException;
4 -import com.bsth.service.schedule.utils.DataToolsProperties;  
5 -import com.bsth.service.schedule.utils.DataToolsService;  
6 -import jxl.Cell;  
7 -import jxl.Sheet;  
8 -import jxl.Workbook; 4 +import com.bsth.service.schedule.utils.*;
9 import jxl.write.Label; 5 import jxl.write.Label;
10 import jxl.write.WritableSheet; 6 import jxl.write.WritableSheet;
11 import jxl.write.WritableWorkbook; 7 import jxl.write.WritableWorkbook;
@@ -39,26 +35,45 @@ public class GuideboardInfoDataToolsImpl implements DataToolsService { @@ -39,26 +35,45 @@ public class GuideboardInfoDataToolsImpl implements DataToolsService {
39 private DataToolsProperties dataToolsProperties; 35 private DataToolsProperties dataToolsProperties;
40 36
41 @Override 37 @Override
42 - public File uploadFile(String filename, byte[] filedata) throws ScheduleException { 38 + public DataToolsFile uploadFile(String filename, byte[] filedata) throws ScheduleException {
43 try { 39 try {
44 - // 对上传的excel文件做处理,将第一个sheet名字设定为工作表1  
45 - File file = dataToolsService.uploadFile(filename, filedata);  
46 - Workbook workbook = Workbook.getWorkbook(file);  
47 - Sheet sheet = workbook.getSheet(0); 40 + // 对上传的excel文件做处理
  41 + // 将第一个sheet保存成一个xls文件
  42 + DataToolsFile dataToolsFile = dataToolsService.uploadFile(filename, filedata);
  43 + File file = dataToolsFile.getFile();
  44 +
  45 + // poi api
  46 + org.apache.poi.ss.usermodel.Workbook poi_workbook = dataToolsFile.getFileType().getWorkBook(file);
  47 + org.apache.poi.ss.usermodel.Sheet poi_sheet = poi_workbook.getSheetAt(0); // 第一个sheet
  48 + int rowNum = poi_sheet.getLastRowNum(); // 获取总共多少行
  49 + if (rowNum < 0) {
  50 + throw new RuntimeException("表格内容为空!");
  51 + }
  52 + int colNum = poi_sheet.getRow(0).getLastCellNum(); // 获取总共多少列,以第一行为主
48 53
  54 + // jxl api
49 File fileCal = new File(file.getAbsolutePath() + "_sheetChange.xls"); 55 File fileCal = new File(file.getAbsolutePath() + "_sheetChange.xls");
50 - WritableWorkbook writableWorkbook = Workbook.createWorkbook(fileCal); 56 + WritableWorkbook writableWorkbook = jxl.Workbook.createWorkbook(fileCal);
51 WritableSheet writableSheet = writableWorkbook.createSheet("工作表1", 0); 57 WritableSheet writableSheet = writableWorkbook.createSheet("工作表1", 0);
52 - for (int i = 0; i < sheet.getRows(); i++) {  
53 - Cell[] cells = sheet.getRow(i);  
54 - for (int j = 0; j < cells.length; j++) {  
55 - writableSheet.addCell(new Label(j, i, cells[j].getContents())); 58 +
  59 + for (int i = 0; i <= rowNum; i++) {
  60 + for (int j = 0; j <= colNum; j++) {
  61 + // poi读
  62 + String cellContent = PoiUtils.getStringValueFromCell(poi_sheet.getRow(i).getCell(j));
  63 + // jxl写
  64 + writableSheet.addCell(new Label(j, i, cellContent));
56 } 65 }
  66 +
57 } 67 }
58 writableWorkbook.write(); 68 writableWorkbook.write();
59 writableWorkbook.close(); 69 writableWorkbook.close();
  70 + poi_workbook.close();
  71 +
  72 + DataToolsFile dataToolsFile1 = new DataToolsFile();
  73 + dataToolsFile1.setFile(fileCal);
  74 + dataToolsFile1.setFileType(DataToolsFileType.XLS);
60 75
61 - return fileCal; 76 + return dataToolsFile1;
62 77
63 } catch (Exception exp) { 78 } catch (Exception exp) {
64 throw new ScheduleException(exp); 79 throw new ScheduleException(exp);
@@ -96,7 +111,7 @@ public class GuideboardInfoDataToolsImpl implements DataToolsService { @@ -96,7 +111,7 @@ public class GuideboardInfoDataToolsImpl implements DataToolsService {
96 } 111 }
97 112
98 @Override 113 @Override
99 - public File exportData(Map<String, Object> params) throws ScheduleException { 114 + public DataToolsFile exportData(Map<String, Object> params) throws ScheduleException {
100 try { 115 try {
101 LOGGER.info("//---------------- 导出路牌信息 start... ----------------//"); 116 LOGGER.info("//---------------- 导出路牌信息 start... ----------------//");
102 // 创建ktr转换所需参数 117 // 创建ktr转换所需参数
@@ -110,7 +125,7 @@ public class GuideboardInfoDataToolsImpl implements DataToolsService { @@ -110,7 +125,7 @@ public class GuideboardInfoDataToolsImpl implements DataToolsService {
110 125
111 ktrParms.putAll(params); 126 ktrParms.putAll(params);
112 127
113 - File file = dataToolsService.exportData(ktrParms); 128 + DataToolsFile file = dataToolsService.exportData(ktrParms);
114 129
115 LOGGER.info("//---------------- 导出路牌信息 success... ----------------//"); 130 LOGGER.info("//---------------- 导出路牌信息 success... ----------------//");
116 131
src/main/java/com/bsth/service/schedule/datatools/ScheduleRule1FlatDataToolsImpl.java
1 package com.bsth.service.schedule.datatools; 1 package com.bsth.service.schedule.datatools;
2 2
3 import com.bsth.service.schedule.exception.ScheduleException; 3 import com.bsth.service.schedule.exception.ScheduleException;
4 -import com.bsth.service.schedule.utils.DataToolsProperties;  
5 -import com.bsth.service.schedule.utils.DataToolsService;  
6 -import jxl.Cell;  
7 -import jxl.Sheet;  
8 -import jxl.Workbook; 4 +import com.bsth.service.schedule.utils.*;
9 import jxl.write.Label; 5 import jxl.write.Label;
10 import jxl.write.WritableSheet; 6 import jxl.write.WritableSheet;
11 import jxl.write.WritableWorkbook; 7 import jxl.write.WritableWorkbook;
@@ -39,26 +35,45 @@ public class ScheduleRule1FlatDataToolsImpl implements DataToolsService { @@ -39,26 +35,45 @@ public class ScheduleRule1FlatDataToolsImpl implements DataToolsService {
39 private DataToolsProperties dataToolsProperties; 35 private DataToolsProperties dataToolsProperties;
40 36
41 @Override 37 @Override
42 - public File uploadFile(String filename, byte[] filedata) throws ScheduleException { 38 + public DataToolsFile uploadFile(String filename, byte[] filedata) throws ScheduleException {
43 try { 39 try {
44 - // 对上传的excel文件做处理,将第一个sheet名字设定为工作表1  
45 - File file = dataToolsService.uploadFile(filename, filedata);  
46 - Workbook workbook = Workbook.getWorkbook(file);  
47 - Sheet sheet = workbook.getSheet(0); 40 + // 对上传的excel文件做处理
  41 + // 将第一个sheet保存成一个xls文件
  42 + DataToolsFile dataToolsFile = dataToolsService.uploadFile(filename, filedata);
  43 + File file = dataToolsFile.getFile();
  44 +
  45 + // poi api
  46 + org.apache.poi.ss.usermodel.Workbook poi_workbook = dataToolsFile.getFileType().getWorkBook(file);
  47 + org.apache.poi.ss.usermodel.Sheet poi_sheet = poi_workbook.getSheetAt(0); // 第一个sheet
  48 + int rowNum = poi_sheet.getLastRowNum(); // 获取总共多少行
  49 + if (rowNum < 0) {
  50 + throw new RuntimeException("表格内容为空!");
  51 + }
  52 + int colNum = poi_sheet.getRow(0).getLastCellNum(); // 获取总共多少列,以第一行为主
48 53
  54 + // jxl api
49 File fileCal = new File(file.getAbsolutePath() + "_sheetChange.xls"); 55 File fileCal = new File(file.getAbsolutePath() + "_sheetChange.xls");
50 - WritableWorkbook writableWorkbook = Workbook.createWorkbook(fileCal); 56 + WritableWorkbook writableWorkbook = jxl.Workbook.createWorkbook(fileCal);
51 WritableSheet writableSheet = writableWorkbook.createSheet("工作表1", 0); 57 WritableSheet writableSheet = writableWorkbook.createSheet("工作表1", 0);
52 - for (int i = 0; i < sheet.getRows(); i++) {  
53 - Cell[] cells = sheet.getRow(i);  
54 - for (int j = 0; j < cells.length; j++) {  
55 - writableSheet.addCell(new Label(j, i, cells[j].getContents())); 58 +
  59 + for (int i = 0; i <= rowNum; i++) {
  60 + for (int j = 0; j <= colNum; j++) {
  61 + // poi读
  62 + String cellContent = PoiUtils.getStringValueFromCell(poi_sheet.getRow(i).getCell(j));
  63 + // jxl写
  64 + writableSheet.addCell(new Label(j, i, cellContent));
56 } 65 }
  66 +
57 } 67 }
58 writableWorkbook.write(); 68 writableWorkbook.write();
59 writableWorkbook.close(); 69 writableWorkbook.close();
  70 + poi_workbook.close();
  71 +
  72 + DataToolsFile dataToolsFile1 = new DataToolsFile();
  73 + dataToolsFile1.setFile(fileCal);
  74 + dataToolsFile1.setFileType(DataToolsFileType.XLS);
60 75
61 - return fileCal; 76 + return dataToolsFile1;
62 77
63 } catch (Exception exp) { 78 } catch (Exception exp) {
64 throw new ScheduleException(exp); 79 throw new ScheduleException(exp);
@@ -96,7 +111,7 @@ public class ScheduleRule1FlatDataToolsImpl implements DataToolsService { @@ -96,7 +111,7 @@ public class ScheduleRule1FlatDataToolsImpl implements DataToolsService {
96 } 111 }
97 112
98 @Override 113 @Override
99 - public File exportData(Map<String, Object> params) throws ScheduleException { 114 + public DataToolsFile exportData(Map<String, Object> params) throws ScheduleException {
100 try { 115 try {
101 LOGGER.info("//---------------- 导出排版规则信息 start... ----------------//"); 116 LOGGER.info("//---------------- 导出排版规则信息 start... ----------------//");
102 // 创建ktr转换所需参数 117 // 创建ktr转换所需参数
@@ -110,7 +125,7 @@ public class ScheduleRule1FlatDataToolsImpl implements DataToolsService { @@ -110,7 +125,7 @@ public class ScheduleRule1FlatDataToolsImpl implements DataToolsService {
110 125
111 ktrParms.putAll(params); 126 ktrParms.putAll(params);
112 127
113 - File file = dataToolsService.exportData(ktrParms); 128 + DataToolsFile file = dataToolsService.exportData(ktrParms);
114 129
115 LOGGER.info("//---------------- 导出排版规则信息 success... ----------------//"); 130 LOGGER.info("//---------------- 导出排版规则信息 success... ----------------//");
116 131
src/main/java/com/bsth/service/schedule/datatools/TTInfoDetailDataToolsImpl.java
1 package com.bsth.service.schedule.datatools; 1 package com.bsth.service.schedule.datatools;
2 2
3 import com.bsth.service.schedule.exception.ScheduleException; 3 import com.bsth.service.schedule.exception.ScheduleException;
4 -import com.bsth.service.schedule.utils.DataToolsProperties;  
5 -import com.bsth.service.schedule.utils.DataToolsService;  
6 -import jxl.Cell; 4 +import com.bsth.service.schedule.utils.*;
7 import jxl.Sheet; 5 import jxl.Sheet;
8 import jxl.Workbook; 6 import jxl.Workbook;
9 import jxl.write.Label; 7 import jxl.write.Label;
10 import jxl.write.WritableSheet; 8 import jxl.write.WritableSheet;
11 import jxl.write.WritableWorkbook; 9 import jxl.write.WritableWorkbook;
12 import org.apache.commons.lang3.StringUtils; 10 import org.apache.commons.lang3.StringUtils;
  11 +import org.apache.poi.ss.usermodel.Row;
13 import org.joda.time.DateTime; 12 import org.joda.time.DateTime;
14 import org.slf4j.Logger; 13 import org.slf4j.Logger;
15 import org.slf4j.LoggerFactory; 14 import org.slf4j.LoggerFactory;
@@ -40,10 +39,10 @@ public class TTInfoDetailDataToolsImpl implements DataToolsService, TTInfoDetail @@ -40,10 +39,10 @@ public class TTInfoDetailDataToolsImpl implements DataToolsService, TTInfoDetail
40 private DataToolsProperties dataToolsProperties; 39 private DataToolsProperties dataToolsProperties;
41 40
42 @Override 41 @Override
43 - public File uploadFile(String filename, byte[] filedata) throws ScheduleException { 42 + public DataToolsFile uploadFile(String filename, byte[] filedata) throws ScheduleException {
44 try { 43 try {
45 // 对上传的excel文件做处理,将第一个sheet名字设定为工作表1 44 // 对上传的excel文件做处理,将第一个sheet名字设定为工作表1
46 - File file = dataToolsService.uploadFile(filename, filedata); 45 + DataToolsFile file = dataToolsService.uploadFile(filename, filedata);
47 // Workbook workbook = Workbook.getWorkbook(file); 46 // Workbook workbook = Workbook.getWorkbook(file);
48 // Sheet sheet = workbook.getSheet(0); 47 // Sheet sheet = workbook.getSheet(0);
49 // 48 //
@@ -73,7 +72,7 @@ public class TTInfoDetailDataToolsImpl implements DataToolsService, TTInfoDetail @@ -73,7 +72,7 @@ public class TTInfoDetailDataToolsImpl implements DataToolsService, TTInfoDetail
73 try { 72 try {
74 LOGGER.info("//---------------- 导入时刻表明细 start... ----------------//"); 73 LOGGER.info("//---------------- 导入时刻表明细 start... ----------------//");
75 74
76 - String filename = file.getAbsolutePath(); // xls文件名 75 + String filename = file.getAbsolutePath(); // xls xlsx 文件名
77 String sheetname = String.valueOf(params.get("sheetname")); // sheet名字 76 String sheetname = String.valueOf(params.get("sheetname")); // sheet名字
78 Long ttid = Long.valueOf(String.valueOf(params.get("ttid"))); // 时刻表id 77 Long ttid = Long.valueOf(String.valueOf(params.get("ttid"))); // 时刻表id
79 Long xlid = Long.valueOf(String.valueOf(params.get("xlid"))); // 线路id 78 Long xlid = Long.valueOf(String.valueOf(params.get("xlid"))); // 线路id
@@ -89,27 +88,45 @@ public class TTInfoDetailDataToolsImpl implements DataToolsService, TTInfoDetail @@ -89,27 +88,45 @@ public class TTInfoDetailDataToolsImpl implements DataToolsService, TTInfoDetail
89 // 1、修改已经上传的excel文件,在每个起点站后标示数字,表示第几个班次 88 // 1、修改已经上传的excel文件,在每个起点站后标示数字,表示第几个班次
90 // 2、由于格式问题,需要把内容都转换成字符串 89 // 2、由于格式问题,需要把内容都转换成字符串
91 List<String> colList = new ArrayList<>(); 90 List<String> colList = new ArrayList<>();
92 - Workbook workbook = Workbook.getWorkbook(new File(filename));  
93 - Sheet sheet = workbook.getSheet(sheetname);  
94 - Cell[] cells = sheet.getRow(0);  
95 - for (int i = 0; i < cells.length; i++) { 91 +
  92 + // poi api,并读取第一行数据,组合成站点列表,逗号分隔
  93 + org.apache.poi.ss.usermodel.Workbook poi_workbook;
  94 + org.apache.poi.ss.usermodel.Sheet poi_sheet;
  95 + if (DataToolsFileType.XLS.isThisType(file)) {
  96 + poi_workbook = DataToolsFileType.XLS.getWorkBook(file);
  97 + } else if (DataToolsFileType.XLSX.isThisType(file)) {
  98 + poi_workbook = DataToolsFileType.XLSX.getWorkBook(file);
  99 + } else {
  100 + throw new Exception("不是xls xlsx文件!");
  101 + }
  102 + poi_sheet = poi_workbook.getSheet(sheetname);
  103 + int rownums = poi_sheet.getLastRowNum() + 1;
  104 + int colnums = poi_sheet.getRow(0).getLastCellNum();
  105 + Row firstrow = poi_sheet.getRow(0);
  106 + for (int i = 0; i < colnums; i++) {
  107 + org.apache.poi.ss.usermodel.Cell cell = firstrow.getCell(i);
96 if (i == 0) { 108 if (i == 0) {
97 - colList.add(cells[i].getContents().trim()); 109 + colList.add(PoiUtils.getStringValueFromCell(cell).trim());
98 } else { 110 } else {
99 - colList.add(cells[i].getContents() + i); 111 + colList.add(PoiUtils.getStringValueFromCell(cell) + i);
100 } 112 }
101 } 113 }
102 114
  115 + // jxl api
103 File fileCal = new File(filename + "_stringType.xls"); 116 File fileCal = new File(filename + "_stringType.xls");
104 - WritableWorkbook writableWorkbook = Workbook.createWorkbook(fileCal, workbook);  
105 - WritableSheet sheet1 = writableWorkbook.getSheet(sheetname);  
106 - for (int i = 0; i < sheet1.getColumns(); i++) { // 第一行数据 117 + WritableWorkbook writableWorkbook = Workbook.createWorkbook(fileCal);
  118 + WritableSheet sheet1 = writableWorkbook.createSheet(sheetname, 0);
  119 + for (int i = 0; i < colnums; i++) { // 第一行数据
107 sheet1.addCell(new Label(i, 0, colList.get(i))); 120 sheet1.addCell(new Label(i, 0, colList.get(i)));
108 } 121 }
109 - for (int i = 1; i < sheet1.getRows(); i++) { // 第二行开始  
110 - Cell[] cells1 = sheet.getRow(i);  
111 - for (int j = 0; j < cells1.length; j++) {  
112 - sheet1.addCell(new Label(j, i, cells1[j].getContents())); 122 + for (int i = 1; i < rownums; i++) { // 第二行开始
  123 + for (int j = 0; j < colnums; j++) {
  124 + // poi读
  125 + String cellContent = PoiUtils.getStringValueFromCell(
  126 + poi_sheet.getRow(i).getCell(j)
  127 + );
  128 + // jxl写
  129 + sheet1.addCell(new Label(j, i, cellContent));
113 } 130 }
114 } 131 }
115 writableWorkbook.write(); 132 writableWorkbook.write();
@@ -169,7 +186,7 @@ public class TTInfoDetailDataToolsImpl implements DataToolsService, TTInfoDetail @@ -169,7 +186,7 @@ public class TTInfoDetailDataToolsImpl implements DataToolsService, TTInfoDetail
169 } 186 }
170 187
171 @Override 188 @Override
172 - public File exportData(Map<String, Object> params) throws ScheduleException { 189 + public DataToolsFile exportData(Map<String, Object> params) throws ScheduleException {
173 try { 190 try {
174 LOGGER.info("//---------------- 导出时刻表明细 start... ----------------//"); 191 LOGGER.info("//---------------- 导出时刻表明细 start... ----------------//");
175 192
@@ -188,7 +205,7 @@ public class TTInfoDetailDataToolsImpl implements DataToolsService, TTInfoDetail @@ -188,7 +205,7 @@ public class TTInfoDetailDataToolsImpl implements DataToolsService, TTInfoDetail
188 ktrParms.put("injectktrfile", ktrFile2.getAbsolutePath()); // 注入元数据的ktr文件 205 ktrParms.put("injectktrfile", ktrFile2.getAbsolutePath()); // 注入元数据的ktr文件
189 ktrParms.put("ttinfoid", String.valueOf(params.get("ttinfoid"))); 206 ktrParms.put("ttinfoid", String.valueOf(params.get("ttinfoid")));
190 207
191 - File file = dataToolsService.exportData(ktrParms); 208 + DataToolsFile file = dataToolsService.exportData(ktrParms);
192 209
193 LOGGER.info("//---------------- 导出时刻表明细 success... ----------------//"); 210 LOGGER.info("//---------------- 导出时刻表明细 success... ----------------//");
194 211
src/main/java/com/bsth/service/schedule/impl/BServiceImpl.java
@@ -4,6 +4,7 @@ import com.bsth.entity.search.CustomerSpecs; @@ -4,6 +4,7 @@ import com.bsth.entity.search.CustomerSpecs;
4 import com.bsth.repository.BaseRepository; 4 import com.bsth.repository.BaseRepository;
5 import com.bsth.service.schedule.BService; 5 import com.bsth.service.schedule.BService;
6 import com.bsth.service.schedule.exception.ScheduleException; 6 import com.bsth.service.schedule.exception.ScheduleException;
  7 +import com.bsth.service.schedule.utils.DataToolsFile;
7 import org.slf4j.Logger; 8 import org.slf4j.Logger;
8 import org.slf4j.LoggerFactory; 9 import org.slf4j.LoggerFactory;
9 import org.springframework.beans.factory.annotation.Autowired; 10 import org.springframework.beans.factory.annotation.Autowired;
@@ -111,7 +112,7 @@ public class BServiceImpl&lt;T, ID extends Serializable&gt; implements BService&lt;T, ID&gt; @@ -111,7 +112,7 @@ public class BServiceImpl&lt;T, ID extends Serializable&gt; implements BService&lt;T, ID&gt;
111 } 112 }
112 113
113 @Override 114 @Override
114 - public File uploadFile(String filename, byte[] filedata) throws ScheduleException { 115 + public DataToolsFile uploadFile(String filename, byte[] filedata) throws ScheduleException {
115 throw new ScheduleException("子类自己复写此方法!"); 116 throw new ScheduleException("子类自己复写此方法!");
116 } 117 }
117 118
@@ -121,7 +122,7 @@ public class BServiceImpl&lt;T, ID extends Serializable&gt; implements BService&lt;T, ID&gt; @@ -121,7 +122,7 @@ public class BServiceImpl&lt;T, ID extends Serializable&gt; implements BService&lt;T, ID&gt;
121 } 122 }
122 123
123 @Override 124 @Override
124 - public File exportData(Map<String, Object> params) throws ScheduleException { 125 + public DataToolsFile exportData(Map<String, Object> params) throws ScheduleException {
125 throw new ScheduleException("子类自己复写此方法!"); 126 throw new ScheduleException("子类自己复写此方法!");
126 } 127 }
127 } 128 }
src/main/java/com/bsth/service/schedule/impl/CarConfigInfoServiceImpl.java
@@ -5,6 +5,7 @@ import com.bsth.entity.schedule.rule.ScheduleRule1Flat; @@ -5,6 +5,7 @@ import com.bsth.entity.schedule.rule.ScheduleRule1Flat;
5 import com.bsth.service.schedule.CarConfigInfoService; 5 import com.bsth.service.schedule.CarConfigInfoService;
6 import com.bsth.service.schedule.ScheduleRule1FlatService; 6 import com.bsth.service.schedule.ScheduleRule1FlatService;
7 import com.bsth.service.schedule.exception.ScheduleException; 7 import com.bsth.service.schedule.exception.ScheduleException;
  8 +import com.bsth.service.schedule.utils.DataToolsFile;
8 import com.bsth.service.schedule.utils.DataToolsService; 9 import com.bsth.service.schedule.utils.DataToolsService;
9 import org.springframework.beans.factory.annotation.Autowired; 10 import org.springframework.beans.factory.annotation.Autowired;
10 import org.springframework.beans.factory.annotation.Qualifier; 11 import org.springframework.beans.factory.annotation.Qualifier;
@@ -30,7 +31,7 @@ public class CarConfigInfoServiceImpl extends BServiceImpl&lt;CarConfigInfo, Long&gt; @@ -30,7 +31,7 @@ public class CarConfigInfoServiceImpl extends BServiceImpl&lt;CarConfigInfo, Long&gt;
30 private DataToolsService dataToolsService; 31 private DataToolsService dataToolsService;
31 32
32 @Override 33 @Override
33 - public File uploadFile(String filename, byte[] filedata) throws ScheduleException { 34 + public DataToolsFile uploadFile(String filename, byte[] filedata) throws ScheduleException {
34 return dataToolsService.uploadFile(filename, filedata); 35 return dataToolsService.uploadFile(filename, filedata);
35 } 36 }
36 37
@@ -40,7 +41,7 @@ public class CarConfigInfoServiceImpl extends BServiceImpl&lt;CarConfigInfo, Long&gt; @@ -40,7 +41,7 @@ public class CarConfigInfoServiceImpl extends BServiceImpl&lt;CarConfigInfo, Long&gt;
40 } 41 }
41 42
42 @Override 43 @Override
43 - public File exportData(Map<String, Object> params) throws ScheduleException { 44 + public DataToolsFile exportData(Map<String, Object> params) throws ScheduleException {
44 return dataToolsService.exportData(params); 45 return dataToolsService.exportData(params);
45 } 46 }
46 47
src/main/java/com/bsth/service/schedule/impl/CarsServiceImpl.java
@@ -3,6 +3,7 @@ package com.bsth.service.schedule.impl; @@ -3,6 +3,7 @@ package com.bsth.service.schedule.impl;
3 import com.bsth.entity.Cars; 3 import com.bsth.entity.Cars;
4 import com.bsth.service.schedule.CarsService; 4 import com.bsth.service.schedule.CarsService;
5 import com.bsth.service.schedule.exception.ScheduleException; 5 import com.bsth.service.schedule.exception.ScheduleException;
  6 +import com.bsth.service.schedule.utils.DataToolsFile;
6 import com.bsth.service.schedule.utils.DataToolsService; 7 import com.bsth.service.schedule.utils.DataToolsService;
7 import org.springframework.beans.factory.annotation.Autowired; 8 import org.springframework.beans.factory.annotation.Autowired;
8 import org.springframework.beans.factory.annotation.Qualifier; 9 import org.springframework.beans.factory.annotation.Qualifier;
@@ -29,12 +30,12 @@ public class CarsServiceImpl extends BServiceImpl&lt;Cars, Integer&gt; implements Cars @@ -29,12 +30,12 @@ public class CarsServiceImpl extends BServiceImpl&lt;Cars, Integer&gt; implements Cars
29 } 30 }
30 31
31 @Override 32 @Override
32 - public File exportData(Map<String, Object> params) throws ScheduleException { 33 + public DataToolsFile exportData(Map<String, Object> params) throws ScheduleException {
33 return dataToolsService.exportData(params); 34 return dataToolsService.exportData(params);
34 } 35 }
35 36
36 @Override 37 @Override
37 - public File uploadFile(String filename, byte[] filedata) throws ScheduleException { 38 + public DataToolsFile uploadFile(String filename, byte[] filedata) throws ScheduleException {
38 return dataToolsService.uploadFile(filename, filedata); 39 return dataToolsService.uploadFile(filename, filedata);
39 } 40 }
40 41
src/main/java/com/bsth/service/schedule/impl/EmployeeConfigInfoServiceImpl.java
@@ -5,6 +5,7 @@ import com.bsth.entity.schedule.rule.ScheduleRule1Flat; @@ -5,6 +5,7 @@ import com.bsth.entity.schedule.rule.ScheduleRule1Flat;
5 import com.bsth.service.schedule.EmployeeConfigInfoService; 5 import com.bsth.service.schedule.EmployeeConfigInfoService;
6 import com.bsth.service.schedule.ScheduleRule1FlatService; 6 import com.bsth.service.schedule.ScheduleRule1FlatService;
7 import com.bsth.service.schedule.exception.ScheduleException; 7 import com.bsth.service.schedule.exception.ScheduleException;
  8 +import com.bsth.service.schedule.utils.DataToolsFile;
8 import com.bsth.service.schedule.utils.DataToolsService; 9 import com.bsth.service.schedule.utils.DataToolsService;
9 import org.springframework.beans.factory.annotation.Autowired; 10 import org.springframework.beans.factory.annotation.Autowired;
10 import org.springframework.beans.factory.annotation.Qualifier; 11 import org.springframework.beans.factory.annotation.Qualifier;
@@ -36,7 +37,7 @@ public class EmployeeConfigInfoServiceImpl extends BServiceImpl&lt;EmployeeConfigIn @@ -36,7 +37,7 @@ public class EmployeeConfigInfoServiceImpl extends BServiceImpl&lt;EmployeeConfigIn
36 private JdbcTemplate jdbcTemplate; 37 private JdbcTemplate jdbcTemplate;
37 38
38 @Override 39 @Override
39 - public File uploadFile(String filename, byte[] filedata) throws ScheduleException { 40 + public DataToolsFile uploadFile(String filename, byte[] filedata) throws ScheduleException {
40 return dataToolsService.uploadFile(filename, filedata); 41 return dataToolsService.uploadFile(filename, filedata);
41 } 42 }
42 43
@@ -46,7 +47,7 @@ public class EmployeeConfigInfoServiceImpl extends BServiceImpl&lt;EmployeeConfigIn @@ -46,7 +47,7 @@ public class EmployeeConfigInfoServiceImpl extends BServiceImpl&lt;EmployeeConfigIn
46 } 47 }
47 48
48 @Override 49 @Override
49 - public File exportData(Map<String, Object> params) throws ScheduleException { 50 + public DataToolsFile exportData(Map<String, Object> params) throws ScheduleException {
50 return dataToolsService.exportData(params); 51 return dataToolsService.exportData(params);
51 } 52 }
52 53
src/main/java/com/bsth/service/schedule/impl/EmployeeServiceImpl.java
@@ -3,6 +3,7 @@ package com.bsth.service.schedule.impl; @@ -3,6 +3,7 @@ package com.bsth.service.schedule.impl;
3 import com.bsth.entity.Personnel; 3 import com.bsth.entity.Personnel;
4 import com.bsth.service.schedule.EmployeeService; 4 import com.bsth.service.schedule.EmployeeService;
5 import com.bsth.service.schedule.exception.ScheduleException; 5 import com.bsth.service.schedule.exception.ScheduleException;
  6 +import com.bsth.service.schedule.utils.DataToolsFile;
6 import com.bsth.service.schedule.utils.DataToolsService; 7 import com.bsth.service.schedule.utils.DataToolsService;
7 import org.springframework.beans.factory.annotation.Autowired; 8 import org.springframework.beans.factory.annotation.Autowired;
8 import org.springframework.beans.factory.annotation.Qualifier; 9 import org.springframework.beans.factory.annotation.Qualifier;
@@ -24,7 +25,7 @@ public class EmployeeServiceImpl extends BServiceImpl&lt;Personnel, Integer&gt; implem @@ -24,7 +25,7 @@ public class EmployeeServiceImpl extends BServiceImpl&lt;Personnel, Integer&gt; implem
24 private DataToolsService dataToolsService; 25 private DataToolsService dataToolsService;
25 26
26 @Override 27 @Override
27 - public File uploadFile(String filename, byte[] filedata) throws ScheduleException { 28 + public DataToolsFile uploadFile(String filename, byte[] filedata) throws ScheduleException {
28 return dataToolsService.uploadFile(filename, filedata); 29 return dataToolsService.uploadFile(filename, filedata);
29 } 30 }
30 31
@@ -34,7 +35,7 @@ public class EmployeeServiceImpl extends BServiceImpl&lt;Personnel, Integer&gt; implem @@ -34,7 +35,7 @@ public class EmployeeServiceImpl extends BServiceImpl&lt;Personnel, Integer&gt; implem
34 } 35 }
35 36
36 @Override 37 @Override
37 - public File exportData(Map<String, Object> params) throws ScheduleException { 38 + public DataToolsFile exportData(Map<String, Object> params) throws ScheduleException {
38 return dataToolsService.exportData(params); 39 return dataToolsService.exportData(params);
39 } 40 }
40 41
src/main/java/com/bsth/service/schedule/impl/GuideboardInfoServiceImpl.java
@@ -5,6 +5,7 @@ import com.bsth.entity.schedule.TTInfoDetail; @@ -5,6 +5,7 @@ import com.bsth.entity.schedule.TTInfoDetail;
5 import com.bsth.service.schedule.GuideboardInfoService; 5 import com.bsth.service.schedule.GuideboardInfoService;
6 import com.bsth.service.schedule.TTInfoDetailService; 6 import com.bsth.service.schedule.TTInfoDetailService;
7 import com.bsth.service.schedule.exception.ScheduleException; 7 import com.bsth.service.schedule.exception.ScheduleException;
  8 +import com.bsth.service.schedule.utils.DataToolsFile;
8 import com.bsth.service.schedule.utils.DataToolsService; 9 import com.bsth.service.schedule.utils.DataToolsService;
9 import org.springframework.beans.factory.annotation.Autowired; 10 import org.springframework.beans.factory.annotation.Autowired;
10 import org.springframework.beans.factory.annotation.Qualifier; 11 import org.springframework.beans.factory.annotation.Qualifier;
@@ -128,7 +129,7 @@ public class GuideboardInfoServiceImpl extends BServiceImpl&lt;GuideboardInfo, Long @@ -128,7 +129,7 @@ public class GuideboardInfoServiceImpl extends BServiceImpl&lt;GuideboardInfo, Long
128 } 129 }
129 130
130 @Override 131 @Override
131 - public File uploadFile(String filename, byte[] filedata) throws ScheduleException { 132 + public DataToolsFile uploadFile(String filename, byte[] filedata) throws ScheduleException {
132 return dataToolsService.uploadFile(filename, filedata); 133 return dataToolsService.uploadFile(filename, filedata);
133 } 134 }
134 135
@@ -138,7 +139,7 @@ public class GuideboardInfoServiceImpl extends BServiceImpl&lt;GuideboardInfo, Long @@ -138,7 +139,7 @@ public class GuideboardInfoServiceImpl extends BServiceImpl&lt;GuideboardInfo, Long
138 } 139 }
139 140
140 @Override 141 @Override
141 - public File exportData(Map<String, Object> params) throws ScheduleException { 142 + public DataToolsFile exportData(Map<String, Object> params) throws ScheduleException {
142 return dataToolsService.exportData(params); 143 return dataToolsService.exportData(params);
143 } 144 }
144 145
src/main/java/com/bsth/service/schedule/impl/PeopleCarPlanServiceImpl.java
@@ -22,6 +22,7 @@ import org.springframework.jdbc.core.JdbcTemplate; @@ -22,6 +22,7 @@ import org.springframework.jdbc.core.JdbcTemplate;
22 import org.springframework.jdbc.core.RowMapper; 22 import org.springframework.jdbc.core.RowMapper;
23 import org.springframework.stereotype.Service; 23 import org.springframework.stereotype.Service;
24 24
  25 +import com.bsth.data.BasicData;
25 import com.bsth.entity.realcontrol.ScheduleRealInfo; 26 import com.bsth.entity.realcontrol.ScheduleRealInfo;
26 import com.bsth.entity.schedule.SchedulePlanInfo; 27 import com.bsth.entity.schedule.SchedulePlanInfo;
27 import com.bsth.repository.realcontrol.ScheduleRealInfoRepository; 28 import com.bsth.repository.realcontrol.ScheduleRealInfoRepository;
@@ -1687,7 +1688,7 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService { @@ -1687,7 +1688,7 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService {
1687 return resList; 1688 return resList;
1688 } 1689 }
1689 1690
1690 - @Override 1691 + /*@Override
1691 public List<Map<String, Object>> commandState(Map<String, Object> map) { 1692 public List<Map<String, Object>> commandState(Map<String, Object> map) {
1692 List<Map<String, Object>> resList = new ArrayList<Map<String, Object>>(); 1693 List<Map<String, Object>> resList = new ArrayList<Map<String, Object>>();
1693 List<Map<String, Object>> list = new ArrayList<Map<String, Object>>(); 1694 List<Map<String, Object>> list = new ArrayList<Map<String, Object>>();
@@ -1869,15 +1870,15 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService { @@ -1869,15 +1870,15 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService {
1869 1870
1870 return resList; 1871 return resList;
1871 } 1872 }
1872 -  
1873 - /*@Override 1873 +*/
  1874 + @Override
1874 public List<Map<String, Object>> commandState(Map<String, Object> map) { 1875 public List<Map<String, Object>> commandState(Map<String, Object> map) {
1875 // TODO Auto-generated method stub 1876 // TODO Auto-generated method stub
1876 String company = map.get("company").toString(); 1877 String company = map.get("company").toString();
1877 String subCompany = map.get("subCompany").toString(); 1878 String subCompany = map.get("subCompany").toString();
1878 - String line = map.get("line").toString(); 1879 + String line = map.get("line").toString().trim();
1879 String date = map.get("date").toString(); 1880 String date = map.get("date").toString();
1880 - String code = map.get("code").toString(); 1881 +// String code = map.get("code").toString();
1881 String type = map.get("type").toString(); 1882 String type = map.get("type").toString();
1882 1883
1883 String sql_="select * from bsth_c_s_sp_info_real " 1884 String sql_="select * from bsth_c_s_sp_info_real "
@@ -1889,7 +1890,7 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService { @@ -1889,7 +1890,7 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService {
1889 } 1890 }
1890 1891
1891 1892
1892 - String sql="SELECT r.id,r.schedule_date_str,r.xl_name,r.cl_zbh,r.j_gh,r.j_name," 1893 + String sql="SELECT r.id,r.schedule_date_str,r.xl_name,r.xl_bm,r.cl_zbh,r.j_gh,r.j_name,"
1893 + " r.fcsj,d. TIMESTAMP,d.reply46,d.reply47,d.reply46time,d.reply47time," 1894 + " r.fcsj,d. TIMESTAMP,d.reply46,d.reply47,d.reply46time,d.reply47time,"
1894 + " r.gs_name,r.fgs_name,CONCAT(r.xl_bm,'_',r.id) as line_sch FROM ("+sql_+") " 1895 + " r.gs_name,r.fgs_name,CONCAT(r.xl_bm,'_',r.id) as line_sch FROM ("+sql_+") "
1895 + " AS r LEFT JOIN bsth_v_directive_60 AS d ON r.id = d.sch AND d.is_dispatch = 1" 1896 + " AS r LEFT JOIN bsth_v_directive_60 AS d ON r.id = d.sch AND d.is_dispatch = 1"
@@ -1903,6 +1904,7 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService { @@ -1903,6 +1904,7 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService {
1903 map.put("id", rs.getString("id")); 1904 map.put("id", rs.getString("id"));
1904 map.put("date", rs.getString("schedule_date_str")); 1905 map.put("date", rs.getString("schedule_date_str"));
1905 map.put("line", rs.getString("xl_name")); 1906 map.put("line", rs.getString("xl_name"));
  1907 + map.put("xlbm", rs.getString("xl_bm"));
1906 map.put("clZbh", rs.getString("cl_zbh")); 1908 map.put("clZbh", rs.getString("cl_zbh"));
1907 map.put("jGh", rs.getString("j_gh")); 1909 map.put("jGh", rs.getString("j_gh"));
1908 map.put("jName", rs.getString("j_name")); 1910 map.put("jName", rs.getString("j_name"));
@@ -1910,15 +1912,356 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService { @@ -1910,15 +1912,356 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService {
1910 map.put("timestamp", rs.getString("timestamp")); 1912 map.put("timestamp", rs.getString("timestamp"));
1911 map.put("reply46", rs.getString("reply46")); 1913 map.put("reply46", rs.getString("reply46"));
1912 map.put("reply47", rs.getString("reply47")); 1914 map.put("reply47", rs.getString("reply47"));
1913 - map.put("reply46time", rs.getString("reply46time"));  
1914 - map.put("reply47time", rs.getString("reply47time")); 1915 + map.put("reply46time", rs.getObject("reply46time"));
  1916 + map.put("reply47time", rs.getObject("reply47time"));
1915 map.put("company", rs.getObject("gs_name")); 1917 map.put("company", rs.getObject("gs_name"));
1916 map.put("subCompany", rs.getObject("fgs_name")); 1918 map.put("subCompany", rs.getObject("fgs_name"));
1917 map.put("lineSch", rs.getString("line_sch")); 1919 map.put("lineSch", rs.getString("line_sch"));
1918 return map; 1920 return map;
1919 } 1921 }
1920 }); 1922 });
1921 - return null;  
1922 - }*/ 1923 + List<Map<String, Object>> list_=new ArrayList<Map<String,Object>>();
  1924 + int jhs = 0,sjs=0,wqr=0;
  1925 + Map<String, Object> m_;
  1926 + for (int i = 0; i < list.size(); i++) {
  1927 +
  1928 + Map<String, Object> m=list.get(i);
  1929 + if(i==0){
  1930 + jhs ++ ;
  1931 + if(m.get("reply46time")==null)
  1932 + wqr++;
  1933 +
  1934 + if(!(m.get("reply46time")==null))
  1935 + sjs++;
  1936 + }else{
  1937 + if(m.get("line").toString().equals(list.get(i-1).get("line").toString())){
  1938 + if(!(m.get("lineSch").toString().equals(list.get(i-1).get("lineSch").toString()))){
  1939 + jhs ++ ;
  1940 + if(m.get("reply47time")==null)
  1941 + wqr++;
  1942 +
  1943 + if(!(m.get("reply46time")==null))
  1944 + sjs++;
  1945 + }
  1946 + if(i==list.size()-1){
  1947 + m_=new HashMap<String, Object>();
  1948 + m_.put("company", list.get(i).get("company"));
  1949 + m_.put("subCompany", list.get(i).get("subCompany"));
  1950 + m_.put("date", date);
  1951 + m_.put("line", list.get(i).get("line"));
  1952 + m_.put("xlbm", list.get(i).get("xlbm"));
  1953 + // m_.put("clZbh", list.get(i).get("clZbh"));
  1954 + // m_.put("jsy", list.get(i).get("jGh")+"/"+ list.get(i-1).get("jName"));
  1955 + m_.put("jhf", jhs);
  1956 + m_.put("sjf", sjs);
  1957 + m_.put("wqr", wqr);
  1958 + list_.add(m_);
  1959 + }
  1960 + }else{
  1961 + m_=new HashMap<String, Object>();
  1962 + m_.put("company", list.get(i-1).get("company"));
  1963 + m_.put("subCompany", list.get(i-1).get("subCompany"));
  1964 + m_.put("date", date);
  1965 + m_.put("line", list.get(i-1).get("line"));
  1966 + m_.put("xlbm", list.get(i-1).get("xlbm"));
  1967 +// m_.put("clZbh", list.get(i-1).get("clZbh"));
  1968 +// m_.put("jsy", list.get(i-1).get("jGh")+"/"+ list.get(i).get("jName"));
  1969 + m_.put("jhf", jhs);
  1970 + m_.put("sjf", sjs);
  1971 + m_.put("wqr", wqr);
  1972 + list_.add(m_);
  1973 +
  1974 + jhs =0;sjs=0;wqr=0;
  1975 +
  1976 + jhs ++ ;
  1977 + if(m.get("reply46time")==null)
  1978 + wqr++;
  1979 +
  1980 + if(!(m.get("reply46time")==null))
  1981 + sjs++;
  1982 +
  1983 + if(i==list.size()-1){
  1984 + m_=new HashMap<String, Object>();
  1985 + m_.put("company", list.get(i).get("company"));
  1986 + m_.put("subCompany", list.get(i).get("subCompany"));
  1987 + m_.put("date", date);
  1988 + m_.put("line", list.get(i).get("line"));
  1989 + m_.put("xlbm", list.get(i).get("xlbm"));
  1990 +// m_.put("clZbh", list.get(i).get("clZbh"));
  1991 +// m_.put("jsy", list.get(i).get("jGh")+"/"+ list.get(i).get("jName"));
  1992 + m_.put("jhf", jhs);
  1993 + m_.put("sjf", sjs);
  1994 + m_.put("wqr", wqr);
  1995 + list_.add(m_);
  1996 + }
  1997 + }
  1998 + }
  1999 + }
  2000 +
  2001 + if(type.equals("export")){
  2002 + SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"),
  2003 + sdfSimple = new SimpleDateFormat("yyyyMMdd");
  2004 + List<Iterator<?>> listI = new ArrayList<Iterator<?>>();
  2005 + Map<String,Object> m = new HashMap<String, Object>();
  2006 + ReportUtils ee = new ReportUtils();
  2007 + try {
  2008 + listI.add(list_.iterator());
  2009 + String path = this.getClass().getResource("/").getPath()+"static/pages/forms/";
  2010 + ee.excelReplace(listI, new Object[] { m }, path+"mould/commandState.xls",
  2011 + path+"export/指令状态分析" + sdfSimple.format(sdfMonth.parse(date)) + ".xls");
  2012 + } catch (Exception e) {
  2013 + // TODO: handle exception
  2014 + e.printStackTrace();
  2015 + }
  2016 + }
  2017 + return list_;
  2018 + }
  2019 +
  2020 + @Override
  2021 + public List<Map<String, Object>> commandByLineList(Map<String, Object> map) {
  2022 + // TODO Auto-generated method stub
  2023 +
  2024 + String line = map.get("line").toString().trim();
  2025 + String date = map.get("date").toString();
  2026 +// String code = map.get("code").toString();
  2027 + String type = map.get("type").toString();
  2028 +
  2029 + String sql_="select * from bsth_c_s_sp_info_real "
  2030 + + " WHERE schedule_date_str = '"+date+"' and xl_bm = '"+line+"'";
  2031 +
  2032 +
  2033 + String sql="SELECT r.id,r.schedule_date_str,r.xl_name,r.xl_bm,r.cl_zbh,r.j_gh,r.j_name,"
  2034 + + " r.fcsj,d. TIMESTAMP,d.reply46,d.reply47,d.reply46time,d.reply47time,"
  2035 + + " r.gs_name,r.fgs_name,CONCAT(r.j_gh,'_',r.id) as gh_sch FROM ("+sql_+") "
  2036 + + " AS r LEFT JOIN bsth_v_directive_60 AS d ON r.id = d.sch AND d.is_dispatch = 1"
  2037 + + " order by r.j_gh,r.cl_zbh,r.id,d.timestamp desc ";
  2038 +
  2039 +
  2040 + List<Map<String, Object>> list = jdbcTemplate.query(sql,
  2041 + new RowMapper<Map<String, Object>>(){
  2042 + @Override
  2043 + public Map<String, Object> mapRow(ResultSet rs, int rowNum) throws SQLException {
  2044 + Map<String, Object> map = new HashMap<String, Object>();
  2045 + map.put("id", rs.getString("id"));
  2046 + map.put("date", rs.getString("schedule_date_str"));
  2047 + map.put("line", rs.getString("xl_name"));
  2048 + map.put("xlbm", rs.getString("xl_bm"));
  2049 + map.put("clZbh", rs.getString("cl_zbh"));
  2050 + map.put("jGh", rs.getString("j_gh"));
  2051 + map.put("jName", rs.getString("j_name"));
  2052 + map.put("fcsj", rs.getString("fcsj"));
  2053 + map.put("timestamp", rs.getString("timestamp"));
  2054 + map.put("reply46", rs.getString("reply46"));
  2055 + map.put("reply47", rs.getString("reply47"));
  2056 + map.put("reply46time", rs.getObject("reply46time"));
  2057 + map.put("reply47time", rs.getObject("reply47time"));
  2058 + map.put("company", rs.getObject("gs_name"));
  2059 + map.put("subCompany", rs.getObject("fgs_name"));
  2060 + map.put("ghSch", rs.getString("gh_sch"));
  2061 + return map;
  2062 + }
  2063 + });
  2064 +
  2065 + List<Map<String, Object>> list_=new ArrayList<Map<String,Object>>();
  2066 + int jhs = 0,sjs=0,wqr=0;
  2067 + Map<String, Object> m_;
  2068 + for (int i = 0; i < list.size(); i++) {
  2069 +
  2070 + Map<String, Object> m=list.get(i);
  2071 + if(i==0){
  2072 + jhs ++ ;
  2073 + if(m.get("reply46time")==null)
  2074 + wqr++;
  2075 +
  2076 + if(!(m.get("reply46time")==null))
  2077 + sjs++;
  2078 + }else{
  2079 + if(m.get("jGh").toString().equals(list.get(i-1).get("jGh").toString())
  2080 + && m.get("clZbh").toString().equals(list.get(i-1).get("clZbh").toString())){
  2081 + if(!(m.get("ghSch").toString().equals(list.get(i-1).get("ghSch").toString()))){
  2082 + jhs ++ ;
  2083 + if(m.get("reply47time")==null)
  2084 + wqr++;
  2085 +
  2086 + if(!(m.get("reply46time")==null))
  2087 + sjs++;
  2088 + }
  2089 + if(i==list.size()-1){
  2090 + m_=new HashMap<String, Object>();
  2091 + m_.put("company", list.get(i).get("company"));
  2092 + m_.put("subCompany", list.get(i).get("subCompany"));
  2093 + m_.put("date", date);
  2094 + m_.put("line", list.get(i).get("line"));
  2095 + m_.put("xlbm", list.get(i).get("xlbm"));
  2096 + m_.put("clZbh", list.get(i).get("clZbh"));
  2097 + m_.put("jGh", list.get(i).get("jGh"));
  2098 + m_.put("jsy", list.get(i).get("jGh")+"/"+ list.get(i).get("jName"));
  2099 + m_.put("jhf", jhs);
  2100 + m_.put("sjf", sjs);
  2101 + m_.put("wqr", wqr);
  2102 + list_.add(m_);
  2103 + }
  2104 + }else{
  2105 + m_=new HashMap<String, Object>();
  2106 + m_.put("company", list.get(i-1).get("company"));
  2107 + m_.put("subCompany", list.get(i-1).get("subCompany"));
  2108 + m_.put("date", date);
  2109 + m_.put("line", list.get(i-1).get("line"));
  2110 + m_.put("xlbm", list.get(i-1).get("xlbm"));
  2111 + m_.put("clZbh", list.get(i-1).get("clZbh"));
  2112 + m_.put("jGh", list.get(i).get("jGh"));
  2113 + m_.put("jsy", list.get(i-1).get("jGh")+"/"+ list.get(i-1).get("jName"));
  2114 + m_.put("jhf", jhs);
  2115 + m_.put("sjf", sjs);
  2116 + m_.put("wqr", wqr);
  2117 + list_.add(m_);
  2118 +
  2119 + jhs =0;sjs=0;wqr=0;
  2120 +
  2121 + jhs ++ ;
  2122 + if(m.get("reply46time")==null)
  2123 + wqr++;
  2124 +
  2125 + if(!(m.get("reply46time")==null))
  2126 + sjs++;
  2127 +
  2128 + if(i==list.size()-1){
  2129 + m_=new HashMap<String, Object>();
  2130 + m_.put("company", list.get(i).get("company"));
  2131 + m_.put("subCompany", list.get(i).get("subCompany"));
  2132 + m_.put("date", date);
  2133 + m_.put("line", list.get(i).get("line"));
  2134 + m_.put("xlbm", list.get(i).get("xlbm"));
  2135 + m_.put("clZbh", list.get(i).get("clZbh"));
  2136 + m_.put("jGh", list.get(i).get("jGh"));
  2137 + m_.put("jsy", list.get(i).get("jGh")+"/"+ list.get(i).get("jName"));
  2138 + m_.put("jhf", jhs);
  2139 + m_.put("sjf", sjs);
  2140 + m_.put("wqr", wqr);
  2141 + list_.add(m_);
  2142 + }
  2143 + }
  2144 + }
  2145 + }
  2146 +
  2147 +
  2148 + if(type.equals("export")){
  2149 + SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"),
  2150 + sdfSimple = new SimpleDateFormat("yyyyMMdd");
  2151 + List<Iterator<?>> listI = new ArrayList<Iterator<?>>();
  2152 + Map<String,Object> m = new HashMap<String, Object>();
  2153 + m.put("xlmc", BasicData.lineId2CodeMap.get(line));
  2154 + ReportUtils ee = new ReportUtils();
  2155 + try {
  2156 + listI.add(list_.iterator());
  2157 + String path = this.getClass().getResource("/").getPath()+"static/pages/forms/";
  2158 + ee.excelReplace(listI, new Object[] { m }, path+"mould/commandState1.xls",
  2159 + path+"export/线路指令状态分析" + sdfSimple.format(sdfMonth.parse(date)) + ".xls");
  2160 + } catch (Exception e) {
  2161 + // TODO: handle exception
  2162 + e.printStackTrace();
  2163 + }
  2164 + }
  2165 + return list_;
  2166 +
  2167 + }
  2168 +
  2169 + @Override
  2170 + public List<Map<String, Object>> commandByJghList(Map<String, Object> map) {
  2171 + // TODO Auto-generated method stub
  2172 +
  2173 + String line = map.get("line").toString().trim();
  2174 + String date = map.get("date").toString();
  2175 + String jgh = map.get("jgh").toString();
  2176 +// String code = map.get("code").toString();
  2177 + String type = map.get("type").toString();
  2178 +
  2179 + String sql_="select * from bsth_c_s_sp_info_real "
  2180 + + " WHERE schedule_date_str = '"+date+"' and j_gh = '"+jgh+"'";
  2181 +
  2182 + if(!line.equals("")){
  2183 + sql_ +=" and xl_bm = '"+line+"'";
  2184 + }
  2185 +
  2186 +
  2187 + String sql="SELECT r.id,r.schedule_date_str,r.fcsj,r.xl_name,r.xl_bm,r.cl_zbh,r.j_gh,r.j_name,"
  2188 + + " r.fcsj,d. TIMESTAMP,d.reply46,d.reply47,d.reply46time,d.reply47time,"
  2189 + + " r.gs_name,r.fgs_name FROM ("+sql_+") "
  2190 + + " AS r LEFT JOIN bsth_v_directive_60 AS d ON r.id = d.sch AND d.is_dispatch = 1"
  2191 + + " order by r.fcsj,r.cl_zbh desc ";
  2192 +
  2193 +
  2194 + List<Map<String, Object>> list = jdbcTemplate.query(sql,
  2195 + new RowMapper<Map<String, Object>>(){
  2196 + @Override
  2197 + public Map<String, Object> mapRow(ResultSet rs, int rowNum) throws SQLException {
  2198 + Map<String, Object> map = new HashMap<String, Object>();
  2199 + map.put("id", rs.getString("id"));
  2200 + map.put("date", rs.getString("schedule_date_str"));
  2201 + map.put("fcsj", rs.getString("fcsj"));
  2202 + map.put("line", rs.getString("xl_name"));
  2203 + map.put("xlbm", rs.getString("xl_bm"));
  2204 + map.put("clZbh", rs.getString("cl_zbh"));
  2205 + map.put("jGh", rs.getString("j_gh"));
  2206 + map.put("jName", rs.getString("j_name"));
  2207 + map.put("fcsj", rs.getString("fcsj"));
  2208 + map.put("timestamp", rs.getString("timestamp"));
  2209 + map.put("reply46", rs.getString("reply46"));
  2210 + map.put("reply47", rs.getString("reply47"));
  2211 + map.put("reply46time", rs.getObject("reply46time"));
  2212 + map.put("reply47time", rs.getObject("reply47time"));
  2213 + map.put("company", rs.getObject("gs_name"));
  2214 + map.put("subCompany", rs.getObject("fgs_name"));
  2215 + return map;
  2216 + }
  2217 + });
  2218 + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
  2219 + List<Map<String, Object>> list_=new ArrayList<Map<String,Object>>();
  2220 + Map<String, Object> m_;
  2221 + for (int i = 0; i < list.size(); i++) {
  2222 + Map<String, Object> m=list.get(i);
  2223 + m_=new HashMap<String, Object>();
  2224 + m_.put("company", m.get("company"));
  2225 + m_.put("subCompany",m.get("subCompany"));
  2226 + m_.put("date", date);
  2227 + m_.put("line",m.get("line"));
  2228 + m_.put("clZbh", m.get("clZbh"));
  2229 + m_.put("jsy", m.get("jGh")+"/"+ m.get("jName"));
  2230 + m_.put("jfsj", m.get("fcsj"));
  2231 + if(m.get("timestamp") != null){
  2232 + m_.put("time", sdf.format(new Date(Long.valueOf(m.get("timestamp").toString()))));
  2233 + } else
  2234 + m_.put("time", "/");
  2235 +
  2236 + if(m.get("reply46time") != null)
  2237 + m_.put("time46", sdf.format(new Date(Long.valueOf(m.get("reply46time").toString()))));
  2238 + else
  2239 + m_.put("time46", "/");
  2240 +
  2241 + if(m.get("reply47time") != null)
  2242 + m_.put("time47", sdf.format(new Date(Long.valueOf(m.get("reply47time").toString()))));
  2243 + else
  2244 + m_.put("time47", "/");
  2245 + list_.add(m_);
  2246 + }
  2247 +
  2248 + if(type.equals("export")){
  2249 + SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"),
  2250 + sdfSimple = new SimpleDateFormat("yyyyMMdd");
  2251 + List<Iterator<?>> listI = new ArrayList<Iterator<?>>();
  2252 + Map<String,Object> m = new HashMap<String, Object>();
  2253 + ReportUtils ee = new ReportUtils();
  2254 + try {
  2255 + listI.add(list_.iterator());
  2256 + String path = this.getClass().getResource("/").getPath()+"static/pages/forms/";
  2257 + ee.excelReplace(listI, new Object[] { m }, path+"mould/commandState2.xls",
  2258 + path+"export/指令状态明细" + sdfSimple.format(sdfMonth.parse(date)) + ".xls");
  2259 + } catch (Exception e) {
  2260 + // TODO: handle exception
  2261 + e.printStackTrace();
  2262 + }
  2263 + }
  2264 + return list_;
  2265 + }
1923 2266
1924 } 2267 }
src/main/java/com/bsth/service/schedule/impl/ScheduleRule1FlatServiceImpl.java
@@ -3,6 +3,7 @@ package com.bsth.service.schedule.impl; @@ -3,6 +3,7 @@ package com.bsth.service.schedule.impl;
3 import com.bsth.entity.schedule.rule.ScheduleRule1Flat; 3 import com.bsth.entity.schedule.rule.ScheduleRule1Flat;
4 import com.bsth.service.schedule.ScheduleRule1FlatService; 4 import com.bsth.service.schedule.ScheduleRule1FlatService;
5 import com.bsth.service.schedule.exception.ScheduleException; 5 import com.bsth.service.schedule.exception.ScheduleException;
  6 +import com.bsth.service.schedule.utils.DataToolsFile;
6 import com.bsth.service.schedule.utils.DataToolsService; 7 import com.bsth.service.schedule.utils.DataToolsService;
7 import org.springframework.beans.factory.annotation.Autowired; 8 import org.springframework.beans.factory.annotation.Autowired;
8 import org.springframework.beans.factory.annotation.Qualifier; 9 import org.springframework.beans.factory.annotation.Qualifier;
@@ -21,7 +22,7 @@ public class ScheduleRule1FlatServiceImpl extends BServiceImpl&lt;ScheduleRule1Flat @@ -21,7 +22,7 @@ public class ScheduleRule1FlatServiceImpl extends BServiceImpl&lt;ScheduleRule1Flat
21 private DataToolsService dataToolsService; 22 private DataToolsService dataToolsService;
22 23
23 @Override 24 @Override
24 - public File uploadFile(String filename, byte[] filedata) throws ScheduleException { 25 + public DataToolsFile uploadFile(String filename, byte[] filedata) throws ScheduleException {
25 return dataToolsService.uploadFile(filename, filedata); 26 return dataToolsService.uploadFile(filename, filedata);
26 } 27 }
27 28
@@ -31,7 +32,7 @@ public class ScheduleRule1FlatServiceImpl extends BServiceImpl&lt;ScheduleRule1Flat @@ -31,7 +32,7 @@ public class ScheduleRule1FlatServiceImpl extends BServiceImpl&lt;ScheduleRule1Flat
31 } 32 }
32 33
33 @Override 34 @Override
34 - public File exportData(Map<String, Object> params) throws ScheduleException { 35 + public DataToolsFile exportData(Map<String, Object> params) throws ScheduleException {
35 return dataToolsService.exportData(params); 36 return dataToolsService.exportData(params);
36 } 37 }
37 } 38 }
src/main/java/com/bsth/service/schedule/impl/TTInfoDetailServiceImpl.java
@@ -23,30 +23,29 @@ import com.bsth.service.schedule.GuideboardInfoService; @@ -23,30 +23,29 @@ import com.bsth.service.schedule.GuideboardInfoService;
23 import com.bsth.service.schedule.TTInfoDetailService; 23 import com.bsth.service.schedule.TTInfoDetailService;
24 import com.bsth.service.schedule.datatools.TTInfoDetailForEdit; 24 import com.bsth.service.schedule.datatools.TTInfoDetailForEdit;
25 import com.bsth.service.schedule.exception.ScheduleException; 25 import com.bsth.service.schedule.exception.ScheduleException;
26 -import com.bsth.service.schedule.utils.DataToolsProperties; 26 +import com.bsth.service.schedule.utils.DataToolsFile;
  27 +import com.bsth.service.schedule.utils.DataToolsFileType;
27 import com.bsth.service.schedule.utils.DataToolsService; 28 import com.bsth.service.schedule.utils.DataToolsService;
28 -import jxl.Cell;  
29 -import jxl.Sheet;  
30 -import jxl.Workbook;  
31 -import jxl.write.Label;  
32 -import jxl.write.WritableSheet;  
33 -import jxl.write.WritableWorkbook; 29 +import com.bsth.service.schedule.utils.PoiUtils;
34 import org.apache.commons.lang3.StringUtils; 30 import org.apache.commons.lang3.StringUtils;
35 -import org.joda.time.DateTime; 31 +import org.apache.poi.ss.usermodel.Cell;
  32 +import org.apache.poi.ss.usermodel.Row;
  33 +import org.apache.poi.ss.usermodel.Sheet;
  34 +import org.apache.poi.ss.usermodel.Workbook;
36 import org.slf4j.Logger; 35 import org.slf4j.Logger;
37 import org.slf4j.LoggerFactory; 36 import org.slf4j.LoggerFactory;
38 import org.springframework.beans.factory.annotation.Autowired; 37 import org.springframework.beans.factory.annotation.Autowired;
39 import org.springframework.beans.factory.annotation.Qualifier; 38 import org.springframework.beans.factory.annotation.Qualifier;
40 -import org.springframework.boot.context.properties.EnableConfigurationProperties;  
41 import org.springframework.jdbc.core.JdbcTemplate; 39 import org.springframework.jdbc.core.JdbcTemplate;
42 import org.springframework.stereotype.Service; 40 import org.springframework.stereotype.Service;
43 import org.springframework.transaction.annotation.Transactional; 41 import org.springframework.transaction.annotation.Transactional;
44 import org.springframework.util.CollectionUtils; 42 import org.springframework.util.CollectionUtils;
45 43
46 import java.io.File; 44 import java.io.File;
47 -import java.io.PrintWriter;  
48 -import java.io.StringWriter;  
49 -import java.util.*; 45 +import java.util.ArrayList;
  46 +import java.util.HashMap;
  47 +import java.util.List;
  48 +import java.util.Map;
50 import java.util.regex.Matcher; 49 import java.util.regex.Matcher;
51 import java.util.regex.Pattern; 50 import java.util.regex.Pattern;
52 51
@@ -122,7 +121,7 @@ public class TTInfoDetailServiceImpl extends BServiceImpl&lt;TTInfoDetail, Long&gt; im @@ -122,7 +121,7 @@ public class TTInfoDetailServiceImpl extends BServiceImpl&lt;TTInfoDetail, Long&gt; im
122 } 121 }
123 122
124 @Override 123 @Override
125 - public File uploadFile(String filename, byte[] filedata) throws ScheduleException { 124 + public DataToolsFile uploadFile(String filename, byte[] filedata) throws ScheduleException {
126 return dataToolsService.uploadFile(filename, filedata); 125 return dataToolsService.uploadFile(filename, filedata);
127 } 126 }
128 127
@@ -134,7 +133,7 @@ public class TTInfoDetailServiceImpl extends BServiceImpl&lt;TTInfoDetail, Long&gt; im @@ -134,7 +133,7 @@ public class TTInfoDetailServiceImpl extends BServiceImpl&lt;TTInfoDetail, Long&gt; im
134 } 133 }
135 134
136 @Override 135 @Override
137 - public File exportData(Map<String, Object> params) throws ScheduleException { 136 + public DataToolsFile exportData(Map<String, Object> params) throws ScheduleException {
138 return dataToolsService.exportData(params); 137 return dataToolsService.exportData(params);
139 } 138 }
140 139
@@ -152,17 +151,30 @@ public class TTInfoDetailServiceImpl extends BServiceImpl&lt;TTInfoDetail, Long&gt; im @@ -152,17 +151,30 @@ public class TTInfoDetailServiceImpl extends BServiceImpl&lt;TTInfoDetail, Long&gt; im
152 @Override 151 @Override
153 public void validateExcelSheet(String filename, String sheetname, Integer lineid, String linename) throws ScheduleException { 152 public void validateExcelSheet(String filename, String sheetname, Integer lineid, String linename) throws ScheduleException {
154 try { 153 try {
155 - Workbook book = Workbook.getWorkbook(new File(filename));  
156 - Sheet sheet = book.getSheet(sheetname);  
157 - if (sheet.getRows() == 0 || sheet.getColumns() == 0) { // 工作区是否为空 154 + File file = new File(filename);
  155 + Workbook workbook;
  156 +
  157 + if (DataToolsFileType.XLS.isThisType(file)) {
  158 + workbook = DataToolsFileType.XLS.getWorkBook(file);
  159 + } else if (DataToolsFileType.XLSX.isThisType(file)) {
  160 + workbook = DataToolsFileType.XLSX.getWorkBook(file);
  161 + } else {
  162 + throw new Exception("不是xls xlsx文件!");
  163 + }
  164 +
  165 + Sheet sheet = workbook.getSheet(sheetname);
  166 + int rowNums = sheet.getLastRowNum() + 1; // 基于0 base的,长度加1
  167 + int colNums = sheet.getRow(0).getLastCellNum(); // 不需要加1,就是长度
  168 +
  169 + if (rowNums == 0 || colNums == 0) { // 工作区是否为空
158 throw new Exception(String.format("%s 工作区没有数据!", sheetname)); 170 throw new Exception(String.format("%s 工作区没有数据!", sheetname));
159 } else { 171 } else {
160 - if (sheet.getRows() <= 1 || sheet.getColumns() <= 1) { 172 + if (rowNums <= 1 || rowNums <= 1) {
161 throw new Exception(String.format("工作区至少包含2行2列的数据")); 173 throw new Exception(String.format("工作区至少包含2行2列的数据"));
162 } else { 174 } else {
163 - Cell[] cells = sheet.getRow(0); // 获取第一行数据列  
164 - for (int i = 0; i < cells.length; i++) {  
165 - String cell_con = StringUtils.trimToEmpty(cells[i].getContents()); // trimToEmpty 175 + Row firstRow = sheet.getRow(0); // 获取第一行数据列
  176 + for (int i = 0; i < colNums; i++) {
  177 + String cell_con = StringUtils.trimToEmpty(PoiUtils.getStringValueFromCell(firstRow.getCell(i))); // trimToEmpty
166 178
167 if (StringUtils.isEmpty(cell_con)) { 179 if (StringUtils.isEmpty(cell_con)) {
168 throw new Exception(String.format("第1行,第%d列数据不能为空", i + 1)); 180 throw new Exception(String.format("第1行,第%d列数据不能为空", i + 1));
@@ -203,9 +215,9 @@ public class TTInfoDetailServiceImpl extends BServiceImpl&lt;TTInfoDetail, Long&gt; im @@ -203,9 +215,9 @@ public class TTInfoDetailServiceImpl extends BServiceImpl&lt;TTInfoDetail, Long&gt; im
203 215
204 // 验证路牌内容 216 // 验证路牌内容
205 Map<String, Integer> gbindexmap = new HashMap<>(); // 记录每个路牌在第几行 217 Map<String, Integer> gbindexmap = new HashMap<>(); // 记录每个路牌在第几行
206 - for (int i = 1; i < sheet.getRows(); i++) { // 从第2行开始验证数据  
207 - Cell bcell = sheet.getRow(i)[0]; // 获取第1列  
208 - String bcell_con = StringUtils.trimToEmpty(bcell.getContents()); // trimToEmpty 218 + for (int i = 1; i < rowNums; i++) { // 从第2行开始验证数据
  219 + Cell cell = sheet.getRow(i).getCell(0); // 获取第1列
  220 + String bcell_con = StringUtils.trimToEmpty(PoiUtils.getStringValueFromCell(cell)); // trimToEmpty
209 if (StringUtils.isEmpty(bcell_con)) { 221 if (StringUtils.isEmpty(bcell_con)) {
210 throw new Exception(String.format("第%d行,第1列路牌无数据", i + 1)); 222 throw new Exception(String.format("第%d行,第1列路牌无数据", i + 1));
211 } else if (gbindexmap.get(bcell_con.trim()) != null) { 223 } else if (gbindexmap.get(bcell_con.trim()) != null) {
@@ -236,10 +248,10 @@ public class TTInfoDetailServiceImpl extends BServiceImpl&lt;TTInfoDetail, Long&gt; im @@ -236,10 +248,10 @@ public class TTInfoDetailServiceImpl extends BServiceImpl&lt;TTInfoDetail, Long&gt; im
236 Pattern p2 = Pattern.compile(rex2); 248 Pattern p2 = Pattern.compile(rex2);
237 Pattern p3 = Pattern.compile(rex3); 249 Pattern p3 = Pattern.compile(rex3);
238 250
239 - for (int i = 1; i < sheet.getRows(); i++) { // 从第2行开始验证数据  
240 - Cell[] bcells = sheet.getRow(i);  
241 - for (int j = 1; j < bcells.length; j++) { // 从第2列开始  
242 - String bcell_con = StringUtils.trimToEmpty(bcells[j].getContents()); // trimToEmpty 251 + for (int i = 1; i < rowNums; i++) { // 从第2行开始验证数据
  252 + Row row = sheet.getRow(i);
  253 + for (int j = 1; j < colNums; j++) { // 从第2列开始
  254 + String bcell_con = StringUtils.trimToEmpty(PoiUtils.getStringValueFromCell(row.getCell(j))); // trimToEmpty
243 if (StringUtils.isNotEmpty(bcell_con)) { 255 if (StringUtils.isNotEmpty(bcell_con)) {
244 Matcher m1 = p1.matcher(bcell_con.trim()); 256 Matcher m1 = p1.matcher(bcell_con.trim());
245 Matcher m2 = p2.matcher(bcell_con.trim()); 257 Matcher m2 = p2.matcher(bcell_con.trim());
@@ -253,6 +265,7 @@ public class TTInfoDetailServiceImpl extends BServiceImpl&lt;TTInfoDetail, Long&gt; im @@ -253,6 +265,7 @@ public class TTInfoDetailServiceImpl extends BServiceImpl&lt;TTInfoDetail, Long&gt; im
253 } 265 }
254 266
255 } 267 }
  268 +
256 } catch (Exception exp) { 269 } catch (Exception exp) {
257 exp.printStackTrace(); 270 exp.printStackTrace();
258 throw new ScheduleException(exp.getMessage()); 271 throw new ScheduleException(exp.getMessage());
@@ -315,13 +328,13 @@ public class TTInfoDetailServiceImpl extends BServiceImpl&lt;TTInfoDetail, Long&gt; im @@ -315,13 +328,13 @@ public class TTInfoDetailServiceImpl extends BServiceImpl&lt;TTInfoDetail, Long&gt; im
315 } 328 }
316 329
317 /** 330 /**
318 - * @description : (TODO) 时刻表明细模型数据保存. 331 + * @description (TODO) 时刻表明细模型数据保存.
319 * 332 *
320 - * @param : [map] 333 + * @param map
321 * 334 *
322 * @return : 返回保存操作后的状态. 335 * @return : 返回保存操作后的状态.
323 * 336 *
324 - * @exception : 处理所有抛出来的异常. 337 + * @exception 处理所有抛出来的异常.
325 * */ 338 * */
326 @Transactional 339 @Transactional
327 public Map<String, Object> skbDetailMxSave(Map<String, Object> map) { 340 public Map<String, Object> skbDetailMxSave(Map<String, Object> map) {
@@ -347,11 +360,11 @@ public class TTInfoDetailServiceImpl extends BServiceImpl&lt;TTInfoDetail, Long&gt; im @@ -347,11 +360,11 @@ public class TTInfoDetailServiceImpl extends BServiceImpl&lt;TTInfoDetail, Long&gt; im
347 /** 360 /**
348 * @description : (TODO) json班次数据转list班次. 361 * @description : (TODO) json班次数据转list班次.
349 * 362 *
350 - * @param : [jsonStr--班次json字符串] 363 + * @param jsonStr 班次json字符串]
351 * 364 *
352 - * @return :返回一个list分装的班次数据. 365 + * @return 返回一个list分装的班次数据.
353 * 366 *
354 - * @status : OK. 367 + * @status OK.
355 * */ 368 * */
356 public List<TTInfoDetail> jsonArrayToListEntity(String jsonStr) throws Exception { 369 public List<TTInfoDetail> jsonArrayToListEntity(String jsonStr) throws Exception {
357 // 1、创建list分装的时刻表明细实体对象数据. 370 // 1、创建list分装的时刻表明细实体对象数据.
@@ -369,9 +382,9 @@ public class TTInfoDetailServiceImpl extends BServiceImpl&lt;TTInfoDetail, Long&gt; im @@ -369,9 +382,9 @@ public class TTInfoDetailServiceImpl extends BServiceImpl&lt;TTInfoDetail, Long&gt; im
369 /** 382 /**
370 * @description : (TODO) 班次map对象转实体对象. 383 * @description : (TODO) 班次map对象转实体对象.
371 * 384 *
372 - * @param : [obj-班次map对象]. 385 + * @param obj 班次map对象.
373 * 386 *
374 - * @return : 返回一个班次实体对象. 387 + * @return 返回一个班次实体对象.
375 * 388 *
376 * @exception 异常暂先抛出去. 389 * @exception 异常暂先抛出去.
377 * */ 390 * */
@@ -427,7 +440,7 @@ public class TTInfoDetailServiceImpl extends BServiceImpl&lt;TTInfoDetail, Long&gt; im @@ -427,7 +440,7 @@ public class TTInfoDetailServiceImpl extends BServiceImpl&lt;TTInfoDetail, Long&gt; im
427 /** 440 /**
428 * @description : (TODO) int转boolean类型. 441 * @description : (TODO) int转boolean类型.
429 * 442 *
430 - * @param : [value--int类型的数值] 443 + * @param value--int类型的数值]
431 * 444 *
432 * @return : 返回一个布尔类型值. 445 * @return : 返回一个布尔类型值.
433 * */ 446 * */
@@ -441,9 +454,9 @@ public class TTInfoDetailServiceImpl extends BServiceImpl&lt;TTInfoDetail, Long&gt; im @@ -441,9 +454,9 @@ public class TTInfoDetailServiceImpl extends BServiceImpl&lt;TTInfoDetail, Long&gt; im
441 } 454 }
442 455
443 /** 456 /**
444 - * @description : (TODO) 获取路牌. 457 + * @description (TODO) 获取路牌.
445 * 458 *
446 - * @param [xl--线路,name--路牌名称,code--路牌编码,lpType--路牌类型] 459 + * @param xl --线路,name--路牌名称,code--路牌编码,lpType--路牌类型]
447 * 460 *
448 * @return 返回路牌. 461 * @return 返回路牌.
449 * */ 462 * */
@@ -479,11 +492,11 @@ public class TTInfoDetailServiceImpl extends BServiceImpl&lt;TTInfoDetail, Long&gt; im @@ -479,11 +492,11 @@ public class TTInfoDetailServiceImpl extends BServiceImpl&lt;TTInfoDetail, Long&gt; im
479 /** 492 /**
480 * @description : (TODO) 线路方向转代码. 493 * @description : (TODO) 线路方向转代码.
481 * 494 *
482 - * @param : [str--方向字符串] 495 + * @param str--方向字符串]
483 * 496 *
484 * @return 返回方向代码. 497 * @return 返回方向代码.
485 * 498 *
486 - * @exception : 异常暂先抛出. 499 + * @exception 异常暂先抛出.
487 * */ 500 * */
488 public String dirToCod(String str) throws Exception { 501 public String dirToCod(String str) throws Exception {
489 String c = ""; 502 String c = "";
src/main/java/com/bsth/service/schedule/utils/DataToolsFile.java 0 → 100644
  1 +package com.bsth.service.schedule.utils;
  2 +
  3 +import java.io.File;
  4 +
  5 +/**
  6 + * 数据工具文件(操作后的)。
  7 + */
  8 +public class DataToolsFile {
  9 + /** 文件类型 */
  10 + private DataToolsFileType fileType;
  11 + /** 具体文件 */
  12 + private File file;
  13 +
  14 + public DataToolsFileType getFileType() {
  15 + return fileType;
  16 + }
  17 +
  18 + public void setFileType(DataToolsFileType fileType) {
  19 + this.fileType = fileType;
  20 + }
  21 +
  22 + public File getFile() {
  23 + return file;
  24 + }
  25 +
  26 + public void setFile(File file) {
  27 + this.file = file;
  28 + }
  29 +}
src/main/java/com/bsth/service/schedule/utils/DataToolsFileType.java 0 → 100644
  1 +package com.bsth.service.schedule.utils;
  2 +
  3 +import org.apache.poi.hssf.usermodel.HSSFWorkbook;
  4 +import org.apache.poi.ss.usermodel.Workbook;
  5 +import org.apache.poi.xssf.usermodel.XSSFWorkbook;
  6 +import org.apache.tika.Tika;
  7 +
  8 +import java.io.File;
  9 +import java.io.FileInputStream;
  10 +
  11 +/**
  12 + * 数据工具文件类型。
  13 + */
  14 +public enum DataToolsFileType {
  15 + XLS { // excel xls 文件
  16 + @Override
  17 + public boolean isThisType(byte[] fileData) {
  18 + Tika tika = new Tika();
  19 + String type = tika.detect(fileData);
  20 +
  21 + // application/x-tika-msoffice
  22 + if ("application/vnd.ms-excel".equals(type) ||
  23 + "application/x-tika-msoffice".equals(type)) {
  24 + // .xls 2007的格式
  25 + return true;
  26 + } else {
  27 + return false;
  28 + }
  29 + }
  30 +
  31 + @Override
  32 + public boolean isThisType(File file) {
  33 + try {
  34 + Tika tika = new Tika();
  35 + String type = tika.detect(file);
  36 +
  37 + // application/x-tika-msoffice
  38 + if ("application/vnd.ms-excel".equals(type) ||
  39 + "application/x-tika-msoffice".equals(type)) {
  40 + // .xls 2007的格式
  41 + return true;
  42 + } else {
  43 + return false;
  44 + }
  45 +
  46 + } catch (Exception exp) {
  47 + throw new RuntimeException(exp);
  48 + }
  49 +
  50 + }
  51 +
  52 + @Override
  53 + public String getNewFileName(String... fileNames) {
  54 + StringBuilder stringBuilder = new StringBuilder();
  55 + for (String fn: fileNames) {
  56 + stringBuilder.append(fn);
  57 + }
  58 + stringBuilder.append(".xls");
  59 + return stringBuilder.toString();
  60 + }
  61 +
  62 + @Override
  63 + public Workbook getWorkBook(File file) {
  64 + try {
  65 + return new HSSFWorkbook(new FileInputStream(file));
  66 + } catch (Exception exp) {
  67 + throw new RuntimeException(exp);
  68 + }
  69 + }
  70 + },
  71 + XLSX { // excel xlsx 文件
  72 + @Override
  73 + public boolean isThisType(byte[] fileData) {
  74 + Tika tika = new Tika();
  75 + String type = tika.detect(fileData);
  76 +
  77 + // application/x-tika-ooxml
  78 + if ("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet".equals(type) ||
  79 + "application/x-tika-ooxml".equals(type)) {
  80 + // .xlsx 2007之后的格式
  81 + return true;
  82 + } else {
  83 + return false;
  84 + }
  85 +
  86 + }
  87 +
  88 + @Override
  89 + public boolean isThisType(File file) {
  90 + try {
  91 + Tika tika = new Tika();
  92 + String type = tika.detect(file);
  93 +
  94 + // application/x-tika-ooxml
  95 + if ("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet".equals(type) ||
  96 + "application/x-tika-ooxml".equals(type)) {
  97 + // .xlsx 2007之后的格式
  98 + return true;
  99 + } else {
  100 + return false;
  101 + }
  102 +
  103 + } catch (Exception exp) {
  104 + throw new RuntimeException(exp);
  105 + }
  106 + }
  107 +
  108 + @Override
  109 + public String getNewFileName(String... fileNames) {
  110 + StringBuilder stringBuilder = new StringBuilder();
  111 + for (String fn: fileNames) {
  112 + stringBuilder.append(fn);
  113 + }
  114 + stringBuilder.append(".xlsx");
  115 + return stringBuilder.toString();
  116 + }
  117 +
  118 + @Override
  119 + public Workbook getWorkBook(File file) {
  120 + try {
  121 + return new XSSFWorkbook(file);
  122 + } catch (Exception exp) {
  123 + throw new RuntimeException(exp);
  124 + }
  125 +
  126 + }
  127 + };
  128 +
  129 + /**
  130 + * 判定是否是此文件类型。
  131 + * @param fileData
  132 + * @return
  133 + */
  134 + public abstract boolean isThisType(byte[] fileData);
  135 +
  136 + /**
  137 + * 判定文件类型。
  138 + * @param file
  139 + * @return
  140 + */
  141 + public abstract boolean isThisType(File file);
  142 +
  143 + /**
  144 + * 生成对应的文件名
  145 + * @param fileNames 文件名组成部份
  146 + * @return
  147 + */
  148 + public abstract String getNewFileName(String ... fileNames);
  149 +
  150 + /**
  151 + * 获取Excel工作本对象。
  152 + * @param file 文件
  153 + * @return
  154 + */
  155 + public abstract Workbook getWorkBook(File file);
  156 +}
src/main/java/com/bsth/service/schedule/utils/DataToolsService.java
@@ -11,9 +11,9 @@ import java.util.Map; @@ -11,9 +11,9 @@ import java.util.Map;
11 public interface DataToolsService { 11 public interface DataToolsService {
12 //----------------- 数据服务操作 --------------// 12 //----------------- 数据服务操作 --------------//
13 // 上传文件 13 // 上传文件
14 - File uploadFile(String filename, byte[] filedata) throws ScheduleException; 14 + DataToolsFile uploadFile(String filename, byte[] filedata) throws ScheduleException;
15 // 导入数据 15 // 导入数据
16 void importData(File file, Map<String, Object> params) throws ScheduleException; 16 void importData(File file, Map<String, Object> params) throws ScheduleException;
17 // 导出数据 17 // 导出数据
18 - File exportData(Map<String, Object> params) throws ScheduleException; 18 + DataToolsFile exportData(Map<String, Object> params) throws ScheduleException;
19 } 19 }
src/main/java/com/bsth/service/schedule/utils/DataToolsServiceImpl.java
@@ -2,7 +2,6 @@ package com.bsth.service.schedule.utils; @@ -2,7 +2,6 @@ package com.bsth.service.schedule.utils;
2 2
3 import com.bsth.service.schedule.exception.ScheduleException; 3 import com.bsth.service.schedule.exception.ScheduleException;
4 import com.google.common.io.Files; 4 import com.google.common.io.Files;
5 -import org.apache.tika.Tika;  
6 import org.joda.time.DateTime; 5 import org.joda.time.DateTime;
7 import org.pentaho.di.core.KettleEnvironment; 6 import org.pentaho.di.core.KettleEnvironment;
8 import org.pentaho.di.core.logging.KettleLogStore; 7 import org.pentaho.di.core.logging.KettleLogStore;
@@ -91,33 +90,46 @@ public class DataToolsServiceImpl implements DataToolsService { @@ -91,33 +90,46 @@ public class DataToolsServiceImpl implements DataToolsService {
91 } 90 }
92 91
93 @Override 92 @Override
94 - public File uploadFile(String filename, byte[] filedata) throws ScheduleException { 93 + public DataToolsFile uploadFile(String filename, byte[] filedata) throws ScheduleException {
95 // 上传文件 94 // 上传文件
96 try { 95 try {
97 initKettle(); 96 initKettle();
98 97
99 LOGGER.info("start uploadFile...originalFilename={}", filename); 98 LOGGER.info("start uploadFile...originalFilename={}", filename);
100 - File newFile = new File(dataToolsProperties.getFileuploadDir() + File.separator +  
101 - filename + "-upload-" + new DateTime().toString("yyyyMMddHHmmss") + ".xls");  
102 - // TODO:判定是否excel数据  
103 - Tika tika = new Tika();  
104 - String type = tika.detect(filedata);  
105 - // application/x-tika-msoffice  
106 - LOGGER.info("文件格式={}", type);  
107 - if ("application/vnd.ms-excel".equals(type) || "application/x-tika-msoffice".equals(type)) {  
108 - // .xls 2007的格式  
109 - Files.write(filedata, newFile);  
110 - } else if ("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet".equals(type)) {  
111 - // .xlsx 2007之后的格式  
112 - throw new Exception("暂时不支持.xlsx格式文件!"); 99 +
  100 + DataToolsFile dataToolsFile = new DataToolsFile();
  101 +
  102 + // 判定文件类型(目前只支持xls,xlsx文件)
  103 + if (DataToolsFileType.XLS.isThisType(filedata)) {
  104 + // xls文件
  105 + dataToolsFile.setFileType(DataToolsFileType.XLS);
  106 + dataToolsFile.setFile(new File(DataToolsFileType.XLS.getNewFileName(
  107 + dataToolsProperties.getFileuploadDir(),
  108 + File.separator,
  109 + filename,
  110 + "-upload-",
  111 + new DateTime().toString("yyyyMMddHHmmss")
  112 + )));
  113 + Files.write(filedata, dataToolsFile.getFile());
  114 + } else if (DataToolsFileType.XLSX.isThisType(filedata)) {
  115 + // xlsx文件
  116 + dataToolsFile.setFileType(DataToolsFileType.XLSX);
  117 + dataToolsFile.setFile(new File(DataToolsFileType.XLSX.getNewFileName(
  118 + dataToolsProperties.getFileuploadDir(),
  119 + File.separator,
  120 + filename,
  121 + "-upload-",
  122 + new DateTime().toString("yyyyMMddHHmmss")
  123 + )));
  124 + Files.write(filedata, dataToolsFile.getFile());
113 } else { 125 } else {
114 // 非excel文件 126 // 非excel文件
115 - throw new Exception("非.xls格式文件!"); 127 + throw new Exception("非.xls .xlsx 格式文件!");
116 } 128 }
117 129
118 - LOGGER.info("uploadFile success...newFilename={}", newFile.getAbsolutePath()); 130 + LOGGER.info("uploadFile success...newFilename={}", dataToolsFile.getFile().getAbsolutePath());
119 131
120 - return newFile; 132 + return dataToolsFile;
121 } catch (Exception exp) { 133 } catch (Exception exp) {
122 LOGGER.info("uploadFile failed...stackTrace..."); 134 LOGGER.info("uploadFile failed...stackTrace...");
123 135
@@ -194,7 +206,7 @@ public class DataToolsServiceImpl implements DataToolsService { @@ -194,7 +206,7 @@ public class DataToolsServiceImpl implements DataToolsService {
194 } 206 }
195 207
196 @Override 208 @Override
197 - public File exportData(Map<String, Object> params) throws ScheduleException { 209 + public DataToolsFile exportData(Map<String, Object> params) throws ScheduleException {
198 // 导出数据 210 // 导出数据
199 String transLogId = ""; 211 String transLogId = "";
200 String transMetaLogId = ""; 212 String transMetaLogId = "";
@@ -251,7 +263,12 @@ public class DataToolsServiceImpl implements DataToolsService { @@ -251,7 +263,12 @@ public class DataToolsServiceImpl implements DataToolsService {
251 LOGGER.info(stringBuffer.toString()); 263 LOGGER.info(stringBuffer.toString());
252 LOGGER.info("exportData success..."); 264 LOGGER.info("exportData success...");
253 265
254 - return new File(filepath + ".xls"); 266 + // 导出目前是xls格式
  267 + DataToolsFile dataToolsFile = new DataToolsFile();
  268 + dataToolsFile.setFileType(DataToolsFileType.XLS);
  269 + dataToolsFile.setFile(new File(filepath + ".xls"));
  270 +
  271 + return dataToolsFile;
255 } catch (Exception exp) { 272 } catch (Exception exp) {
256 LOGGER.info("exportData failed...statckTrace..."); 273 LOGGER.info("exportData failed...statckTrace...");
257 274
src/main/java/com/bsth/service/schedule/utils/PoiUtils.java 0 → 100644
  1 +package com.bsth.service.schedule.utils;
  2 +
  3 +import org.apache.poi.hssf.usermodel.HSSFDateUtil;
  4 +import org.apache.poi.ss.usermodel.Cell;
  5 +import org.apache.poi.xssf.usermodel.XSSFCell;
  6 +
  7 +import java.text.DecimalFormat;
  8 +import java.text.SimpleDateFormat;
  9 +import java.util.Date;
  10 +
  11 +/**
  12 + * POI操作的until方法。
  13 + */
  14 +public class PoiUtils {
  15 + /**
  16 + * 使用poi读取cell中的值
  17 + * @param cell
  18 + * @return
  19 + */
  20 + public static String getStringValueFromCell(Cell cell) {
  21 + SimpleDateFormat sFormat = new SimpleDateFormat("MM/dd/yyyy");
  22 + DecimalFormat decimalFormat = new DecimalFormat("#.#");
  23 + String cellValue = "";
  24 + if(cell == null) {
  25 + return cellValue;
  26 + }
  27 + else if(cell.getCellType() == Cell.CELL_TYPE_STRING) {
  28 + cellValue = cell.getStringCellValue();
  29 + }
  30 +
  31 + else if(cell.getCellType() == XSSFCell.CELL_TYPE_NUMERIC) {
  32 + if(HSSFDateUtil.isCellDateFormatted(cell)) {
  33 + double d = cell.getNumericCellValue();
  34 + Date date = HSSFDateUtil.getJavaDate(d);
  35 + cellValue = sFormat.format(date);
  36 + }
  37 + else {
  38 + cellValue = decimalFormat.format((cell.getNumericCellValue()));
  39 + }
  40 + }
  41 + else if(cell.getCellType() == Cell.CELL_TYPE_BLANK) {
  42 + cellValue = "";
  43 + }
  44 + else if(cell.getCellType() == Cell.CELL_TYPE_BOOLEAN) {
  45 + cellValue = String.valueOf(cell.getBooleanCellValue());
  46 + }
  47 + else if(cell.getCellType() == Cell.CELL_TYPE_ERROR) {
  48 + cellValue = "";
  49 + }
  50 + else if(cell.getCellType() == Cell.CELL_TYPE_FORMULA) {
  51 + cellValue = cell.getCellFormula().toString();
  52 + }
  53 + return cellValue;
  54 + }
  55 +}
src/main/resources/datatools/ktrs/ttinfodetailDataInput.ktr
@@ -828,7 +828,7 @@ @@ -828,7 +828,7 @@
828 <optimizationLevel>9</optimizationLevel> 828 <optimizationLevel>9</optimizationLevel>
829 <jsScripts> <jsScript> <jsScript_type>0</jsScript_type> 829 <jsScripts> <jsScript> <jsScript_type>0</jsScript_type>
830 <jsScript_name>Script 1</jsScript_name> 830 <jsScript_name>Script 1</jsScript_name>
831 - <jsScript_script>&#x2f;&#x2f;Script here&#xa;&#xa;&#x2f;&#x2f; &#x4f7f;&#x7528;&#x6b63;&#x5219;&#x8868;&#x8fbe;&#x5f0f;&#x53bb;&#x9664;&#x7ad9;&#x70b9;&#x540d;&#x79f0;&#x53f3;&#x4fa7;&#x591a;&#x4f59;&#x7684;&#x6570;&#x5b57;&#xa;qdzname &#x3d; qdzname.replace&#x28;&#x2f;&#x28;&#x5c;d&#x2b;&#x24;&#x29;&#x2f;g,&#x27;&#x27;&#x29;&#x3b;&#xa;&#xa;&#x2f;&#x2f; sendtime&#x5904;&#x7406;&#xff0c;hhmm&#xff0c;hh&#x3a;mm&#xff0c;hh,mm&#xa;var sendtime_calcu&#x3b;&#xa;if &#x28;sendtime.length &#x3d;&#x3d; 5&#x29; &#x7b; &#x2f;&#x2f; &#x6700;&#x957f;&#x683c;&#x5f0f;&#xff0c;&#x5305;&#x62ec;&#x5206;&#x9694;&#x7b26;&#xff0c;&#x7edf;&#x4e00;&#x628a;&#x5206;&#x9694;&#x7b26;&#x66ff;&#x6362;&#x6210;&#x5192;&#x53f7;&#xa; sendtime_calcu &#x3d; sendtime.substr&#x28;0, 2&#x29; &#x2b; &#x22;&#x3a;&#x22; &#x2b; sendtime.substr&#x28;3, 2&#x29;&#x3b;&#xa;&#x7d; else if &#x28;sendtime.length &#x3d;&#x3d; 4&#x29; &#x7b;&#xa; if &#x28;sendtime.indexOf&#x28;&#x22;&#x3a;&#x22;&#x29; &#x3e; 0&#x29; &#x7b; &#x2f;&#x2f; &#x5192;&#x53f7;&#x5206;&#x9694;&#xff0c;&#x65e0;&#x9700;&#x4fee;&#x6539;&#xa; sendtime_calcu &#x3d; sendtime&#x3b;&#xa; &#x7d; else if &#x28;sendtime.indexOf&#x28;&#x22;,&#x22;&#x29; &#x3e; 0&#x29; &#x7b; &#x2f;&#x2f; &#x9017;&#x53f7;&#x5206;&#x9694;&#xff0c;&#x6539;&#x6210;&#x5192;&#x53f7;&#x5206;&#x9694;&#xa; sendtime_calcu &#x3d; sendtime.substr&#x28;0, 1&#x29; &#x2b; &#x22;&#x3a;&#x22; &#x2b; sendtime.substr&#x28;2, 2&#x29;&#x3b;&#xa; &#x7d; else &#x7b; &#x2f;&#x2f; &#x65e0;&#x5206;&#x9694;&#x7b26;&#xff0c;&#x6539;&#x6210;&#x5192;&#x53f7;&#x5206;&#x9694;&#xa; sendtime_calcu &#x3d; sendtime.substr&#x28;0, 2&#x29; &#x2b; &#x22;&#x3a;&#x22; &#x2b; sendtime.substr&#x28;2, 2&#x29;&#x3b;&#xa; &#x7d;&#xa;&#x7d; else if &#x28;sendtime.length &#x3d;&#x3d; 3&#x29; &#x7b; &#x2f;&#x2f; &#x65e0;&#x5206;&#x9694;&#x7b26;&#xff0c;&#x6539;&#x6210;&#x5192;&#x53f7;&#x5206;&#x9694;&#xa; sendtime_calcu &#x3d; sendtime.substr&#x28;0, 1&#x29; &#x2b; &#x22;&#x3a;&#x22; &#x2b; sendtime.substr&#x28;1, 2&#x29;&#x3b;&#xa;&#x7d;&#xa;&#xa;&#x2f;&#x2f; &#x8bbe;&#x7f6e;&#x5206;&#x73ed;&#xa;var isfb &#x3d; 0&#x3b;&#xa;&#xa;&#x2f;&#x2f; &#x8bbe;&#x7f6e;&#x505c;&#x9a76;&#xa;var ists &#x3d; 0&#x3b;&#xa;&#xa;&#x2f;&#x2f; &#x8bbe;&#x7f6e;isCanceled&#xa;var iscanceled &#x3d; 0&#x3b;</jsScript_script> 831 + <jsScript_script>&#x2f;&#x2f;Script here&#xa;&#xa;&#x2f;&#x2f; &#x4f7f;&#x7528;&#x6b63;&#x5219;&#x8868;&#x8fbe;&#x5f0f;&#x53bb;&#x9664;&#x7ad9;&#x70b9;&#x540d;&#x79f0;&#x53f3;&#x4fa7;&#x591a;&#x4f59;&#x7684;&#x6570;&#x5b57;&#xa;qdzname &#x3d; qdzname.replace&#x28;&#x2f;&#x28;&#x5c;d&#x2b;&#x24;&#x29;&#x2f;g,&#x27;&#x27;&#x29;&#x3b;&#xa;&#xa;&#x2f;&#x2f; sendtime&#x5904;&#x7406;&#xff0c;hhmm&#xff0c;hh&#x3a;mm&#xff0c;hh,mm&#xa;var sendtime_calcu&#x3b;&#xa;if &#x28;sendtime.length &#x3d;&#x3d; 5&#x29; &#x7b; &#x2f;&#x2f; &#x6700;&#x957f;&#x683c;&#x5f0f;&#xff0c;&#x5305;&#x62ec;&#x5206;&#x9694;&#x7b26;&#xff0c;&#x7edf;&#x4e00;&#x628a;&#x5206;&#x9694;&#x7b26;&#x66ff;&#x6362;&#x6210;&#x5192;&#x53f7;&#xa; sendtime_calcu &#x3d; sendtime.substr&#x28;0, 2&#x29; &#x2b; &#x22;&#x3a;&#x22; &#x2b; sendtime.substr&#x28;3, 2&#x29;&#x3b;&#xa;&#x7d; else if &#x28;sendtime.length &#x3d;&#x3d; 4&#x29; &#x7b;&#xa; if &#x28;sendtime.indexOf&#x28;&#x22;&#x3a;&#x22;&#x29; &#x3e; 0&#x29; &#x7b; &#x2f;&#x2f; &#x5192;&#x53f7;&#x5206;&#x9694;&#xff0c;&#x65e0;&#x9700;&#x4fee;&#x6539;&#xa; sendtime_calcu &#x3d; sendtime&#x3b;&#xa; &#x7d; else if &#x28;sendtime.indexOf&#x28;&#x22;,&#x22;&#x29; &#x3e; 0&#x29; &#x7b; &#x2f;&#x2f; &#x9017;&#x53f7;&#x5206;&#x9694;&#xff0c;&#x6539;&#x6210;&#x5192;&#x53f7;&#x5206;&#x9694;&#xa; sendtime_calcu &#x3d; sendtime.substr&#x28;0, 1&#x29; &#x2b; &#x22;&#x3a;&#x22; &#x2b; sendtime.substr&#x28;2, 2&#x29;&#x3b;&#xa; &#x7d; else &#x7b; &#x2f;&#x2f; &#x65e0;&#x5206;&#x9694;&#x7b26;&#xff0c;&#x6539;&#x6210;&#x5192;&#x53f7;&#x5206;&#x9694;&#xa; sendtime_calcu &#x3d; sendtime.substr&#x28;0, 2&#x29; &#x2b; &#x22;&#x3a;&#x22; &#x2b; sendtime.substr&#x28;2, 2&#x29;&#x3b;&#xa; &#x7d;&#xa;&#x7d; else if &#x28;sendtime.length &#x3d;&#x3d; 3&#x29; &#x7b; &#x2f;&#x2f; &#x65e0;&#x5206;&#x9694;&#x7b26;&#xff0c;&#x6539;&#x6210;&#x5192;&#x53f7;&#x5206;&#x9694;&#xa; sendtime_calcu &#x3d; sendtime.substr&#x28;0, 1&#x29; &#x2b; &#x22;&#x3a;&#x22; &#x2b; sendtime.substr&#x28;1, 2&#x29;&#x3b;&#xa;&#x7d;&#xa;&#xa;&#x2f;&#x2f; &#x5168;&#x90e8;&#x4fee;&#x6b63;&#x5b8c;&#x6bd5;&#x540e;&#xff0c;&#x5982;&#x679c;&#x957f;&#x5ea6;&#x4e0d;&#x662f;5&#xff0c;&#x524d;&#x9762;&#x8865;0&#xa;if &#x28;sendtime_calcu.length &#x21;&#x3d; 5&#x29; &#x7b;&#xa; sendtime_calcu &#x3d; &#x22;0&#x22; &#x2b; sendtime_calcu&#x3b;&#xa;&#x7d;&#xa;&#xa;&#x2f;&#x2f; &#x8bbe;&#x7f6e;&#x5206;&#x73ed;&#xa;var isfb &#x3d; 0&#x3b;&#xa;&#xa;&#x2f;&#x2f; &#x8bbe;&#x7f6e;&#x505c;&#x9a76;&#xa;var ists &#x3d; 0&#x3b;&#xa;&#xa;&#x2f;&#x2f; &#x8bbe;&#x7f6e;isCanceled&#xa;var iscanceled &#x3d; 0&#x3b;</jsScript_script>
832 </jsScript> </jsScripts> <fields> <field> <name>qdzname</name> 832 </jsScript> </jsScripts> <fields> <field> <name>qdzname</name>
833 <rename>qdzname</rename> 833 <rename>qdzname</rename>
834 <type>String</type> 834 <type>String</type>
src/main/resources/datatools/ktrs/ttinfodetailDataInput2.ktr
@@ -828,7 +828,7 @@ @@ -828,7 +828,7 @@
828 <optimizationLevel>9</optimizationLevel> 828 <optimizationLevel>9</optimizationLevel>
829 <jsScripts> <jsScript> <jsScript_type>0</jsScript_type> 829 <jsScripts> <jsScript> <jsScript_type>0</jsScript_type>
830 <jsScript_name>Script 1</jsScript_name> 830 <jsScript_name>Script 1</jsScript_name>
831 - <jsScript_script>&#x2f;&#x2f;Script here&#xa;&#xa;&#x2f;&#x2f; &#x4f7f;&#x7528;&#x6b63;&#x5219;&#x8868;&#x8fbe;&#x5f0f;&#x53bb;&#x9664;&#x7ad9;&#x70b9;&#x540d;&#x79f0;&#x53f3;&#x4fa7;&#x591a;&#x4f59;&#x7684;&#x6570;&#x5b57;&#xa;qdzname &#x3d; qdzname.replace&#x28;&#x2f;&#x28;&#x5c;d&#x2b;&#x24;&#x29;&#x2f;g,&#x27;&#x27;&#x29;&#x3b;&#xa;&#xa;&#x2f;&#x2f; sendtime&#x5904;&#x7406;&#xff0c;hhmm&#xff0c;hh&#x3a;mm&#xff0c;hh,mm&#xa;var sendtime_calcu&#x3b;&#xa;if &#x28;sendtime.length &#x3d;&#x3d; 5&#x29; &#x7b; &#x2f;&#x2f; &#x6700;&#x957f;&#x683c;&#x5f0f;&#xff0c;&#x5305;&#x62ec;&#x5206;&#x9694;&#x7b26;&#xff0c;&#x7edf;&#x4e00;&#x628a;&#x5206;&#x9694;&#x7b26;&#x66ff;&#x6362;&#x6210;&#x5192;&#x53f7;&#xa; sendtime_calcu &#x3d; sendtime.substr&#x28;0, 2&#x29; &#x2b; &#x22;&#x3a;&#x22; &#x2b; sendtime.substr&#x28;3, 2&#x29;&#x3b;&#xa;&#x7d; else if &#x28;sendtime.length &#x3d;&#x3d; 4&#x29; &#x7b;&#xa; if &#x28;sendtime.indexOf&#x28;&#x22;&#x3a;&#x22;&#x29; &#x3e; 0&#x29; &#x7b; &#x2f;&#x2f; &#x5192;&#x53f7;&#x5206;&#x9694;&#xff0c;&#x65e0;&#x9700;&#x4fee;&#x6539;&#xa; sendtime_calcu &#x3d; sendtime&#x3b;&#xa; &#x7d; else if &#x28;sendtime.indexOf&#x28;&#x22;,&#x22;&#x29; &#x3e; 0&#x29; &#x7b; &#x2f;&#x2f; &#x9017;&#x53f7;&#x5206;&#x9694;&#xff0c;&#x6539;&#x6210;&#x5192;&#x53f7;&#x5206;&#x9694;&#xa; sendtime_calcu &#x3d; sendtime.substr&#x28;0, 1&#x29; &#x2b; &#x22;&#x3a;&#x22; &#x2b; sendtime.substr&#x28;2, 2&#x29;&#x3b;&#xa; &#x7d; else &#x7b; &#x2f;&#x2f; &#x65e0;&#x5206;&#x9694;&#x7b26;&#xff0c;&#x6539;&#x6210;&#x5192;&#x53f7;&#x5206;&#x9694;&#xa; sendtime_calcu &#x3d; sendtime.substr&#x28;0, 2&#x29; &#x2b; &#x22;&#x3a;&#x22; &#x2b; sendtime.substr&#x28;2, 2&#x29;&#x3b;&#xa; &#x7d;&#xa;&#x7d; else if &#x28;sendtime.length &#x3d;&#x3d; 3&#x29; &#x7b; &#x2f;&#x2f; &#x65e0;&#x5206;&#x9694;&#x7b26;&#xff0c;&#x6539;&#x6210;&#x5192;&#x53f7;&#x5206;&#x9694;&#xa; sendtime_calcu &#x3d; sendtime.substr&#x28;0, 1&#x29; &#x2b; &#x22;&#x3a;&#x22; &#x2b; sendtime.substr&#x28;1, 2&#x29;&#x3b;&#xa;&#x7d;&#xa;&#xa;&#x2f;&#x2f; &#x8bbe;&#x7f6e;&#x5206;&#x73ed;&#xa;var isfb &#x3d; 0&#x3b;&#xa;&#xa;&#x2f;&#x2f; &#x8bbe;&#x7f6e;&#x505c;&#x9a76;&#xa;var ists &#x3d; 0&#x3b;&#xa;&#xa;&#x2f;&#x2f; &#x8bbe;&#x7f6e;isCanceled&#xa;var iscanceled &#x3d; 0&#x3b;</jsScript_script> 831 + <jsScript_script>&#x2f;&#x2f;Script here&#xa;&#xa;&#x2f;&#x2f; &#x4f7f;&#x7528;&#x6b63;&#x5219;&#x8868;&#x8fbe;&#x5f0f;&#x53bb;&#x9664;&#x7ad9;&#x70b9;&#x540d;&#x79f0;&#x53f3;&#x4fa7;&#x591a;&#x4f59;&#x7684;&#x6570;&#x5b57;&#xa;qdzname &#x3d; qdzname.replace&#x28;&#x2f;&#x28;&#x5c;d&#x2b;&#x24;&#x29;&#x2f;g,&#x27;&#x27;&#x29;&#x3b;&#xa;&#xa;&#x2f;&#x2f; sendtime&#x5904;&#x7406;&#xff0c;hhmm&#xff0c;hh&#x3a;mm&#xff0c;hh,mm&#xa;var sendtime_calcu&#x3b;&#xa;if &#x28;sendtime.length &#x3d;&#x3d; 5&#x29; &#x7b; &#x2f;&#x2f; &#x6700;&#x957f;&#x683c;&#x5f0f;&#xff0c;&#x5305;&#x62ec;&#x5206;&#x9694;&#x7b26;&#xff0c;&#x7edf;&#x4e00;&#x628a;&#x5206;&#x9694;&#x7b26;&#x66ff;&#x6362;&#x6210;&#x5192;&#x53f7;&#xa; sendtime_calcu &#x3d; sendtime.substr&#x28;0, 2&#x29; &#x2b; &#x22;&#x3a;&#x22; &#x2b; sendtime.substr&#x28;3, 2&#x29;&#x3b;&#xa;&#x7d; else if &#x28;sendtime.length &#x3d;&#x3d; 4&#x29; &#x7b;&#xa; if &#x28;sendtime.indexOf&#x28;&#x22;&#x3a;&#x22;&#x29; &#x3e; 0&#x29; &#x7b; &#x2f;&#x2f; &#x5192;&#x53f7;&#x5206;&#x9694;&#xff0c;&#x65e0;&#x9700;&#x4fee;&#x6539;&#xa; sendtime_calcu &#x3d; sendtime&#x3b;&#xa; &#x7d; else if &#x28;sendtime.indexOf&#x28;&#x22;,&#x22;&#x29; &#x3e; 0&#x29; &#x7b; &#x2f;&#x2f; &#x9017;&#x53f7;&#x5206;&#x9694;&#xff0c;&#x6539;&#x6210;&#x5192;&#x53f7;&#x5206;&#x9694;&#xa; sendtime_calcu &#x3d; sendtime.substr&#x28;0, 1&#x29; &#x2b; &#x22;&#x3a;&#x22; &#x2b; sendtime.substr&#x28;2, 2&#x29;&#x3b;&#xa; &#x7d; else &#x7b; &#x2f;&#x2f; &#x65e0;&#x5206;&#x9694;&#x7b26;&#xff0c;&#x6539;&#x6210;&#x5192;&#x53f7;&#x5206;&#x9694;&#xa; sendtime_calcu &#x3d; sendtime.substr&#x28;0, 2&#x29; &#x2b; &#x22;&#x3a;&#x22; &#x2b; sendtime.substr&#x28;2, 2&#x29;&#x3b;&#xa; &#x7d;&#xa;&#x7d; else if &#x28;sendtime.length &#x3d;&#x3d; 3&#x29; &#x7b; &#x2f;&#x2f; &#x65e0;&#x5206;&#x9694;&#x7b26;&#xff0c;&#x6539;&#x6210;&#x5192;&#x53f7;&#x5206;&#x9694;&#xa; sendtime_calcu &#x3d; sendtime.substr&#x28;0, 1&#x29; &#x2b; &#x22;&#x3a;&#x22; &#x2b; sendtime.substr&#x28;1, 2&#x29;&#x3b;&#xa;&#x7d;&#xa;&#xa;&#x2f;&#x2f; &#x5168;&#x90e8;&#x4fee;&#x6b63;&#x5b8c;&#x6bd5;&#x540e;&#xff0c;&#x5982;&#x679c;&#x957f;&#x5ea6;&#x4e0d;&#x662f;5&#xff0c;&#x524d;&#x9762;&#x8865;0&#xa;if &#x28;sendtime_calcu.length &#x21;&#x3d; 5&#x29; &#x7b;&#xa; sendtime_calcu &#x3d; &#x22;0&#x22; &#x2b; sendtime_calcu&#x3b;&#xa;&#x7d;&#xa;&#xa;&#x2f;&#x2f; &#x8bbe;&#x7f6e;&#x5206;&#x73ed;&#xa;var isfb &#x3d; 0&#x3b;&#xa;&#xa;&#x2f;&#x2f; &#x8bbe;&#x7f6e;&#x505c;&#x9a76;&#xa;var ists &#x3d; 0&#x3b;&#xa;&#xa;&#x2f;&#x2f; &#x8bbe;&#x7f6e;isCanceled&#xa;var iscanceled &#x3d; 0&#x3b;</jsScript_script>
832 </jsScript> </jsScripts> <fields> <field> <name>qdzname</name> 832 </jsScript> </jsScripts> <fields> <field> <name>qdzname</name>
833 <rename>qdzname</rename> 833 <rename>qdzname</rename>
834 <type>String</type> 834 <type>String</type>
src/main/resources/static/pages/electricity/jdl/list.html
@@ -54,7 +54,9 @@ @@ -54,7 +54,9 @@
54 <td>内部编码:</td> 54 <td>内部编码:</td>
55 <td> 55 <td>
56 <select class="form-control" name="nbbm" id="nbbm" style="width: 120px;"></select> 56 <select class="form-control" name="nbbm" id="nbbm" style="width: 120px;"></select>
57 - </td> 57 + </td>
  58 + <td>驾驶员:</td>
  59 + <td><input type="text" style="width: 80px" name="jsy" id="jsy"/></td>
58 <td width="20%"> 60 <td width="20%">
59 <button class="btn btn-sm green btn-outline filter-submit margin-bottom" style="margin-right:0px"> 61 <button class="btn btn-sm green btn-outline filter-submit margin-bottom" style="margin-right:0px">
60 <i class="fa fa-search"></i> 搜索 62 <i class="fa fa-search"></i> 搜索
@@ -70,7 +72,8 @@ @@ -70,7 +72,8 @@
70 <tr role="row" class="heading"> 72 <tr role="row" class="heading">
71 <th>#</th> 73 <th>#</th>
72 <th>日期</th> 74 <th>日期</th>
73 - <th colspan="2">内部编码</th> 75 + <th colspan="2">内部编码</th>
  76 + <th colspan="2">驾驶员</th>
74 <th colspan="2">充电量</th> 77 <th colspan="2">充电量</th>
75 <th colspan="2">充电站</th> 78 <th colspan="2">充电站</th>
76 <th colspan="2">备注</th> 79 <th colspan="2">备注</th>
@@ -378,7 +381,8 @@ @@ -378,7 +381,8 @@
378 {{i + 1}} 381 {{i + 1}}
379 </td> 382 </td>
380 <td>{{obj.rq}}</td> 383 <td>{{obj.rq}}</td>
381 - <td colspan="2">{{obj.nbbm}}</td> 384 + <td colspan="2">{{obj.nbbm}}</td>
  385 + <td colspan="2">{{obj.jsy}}</td>
382 <td colspan="2">{{obj.jdl}}</td> 386 <td colspan="2">{{obj.jdl}}</td>
383 <td colspan="2">{{obj.jdz}}</td> 387 <td colspan="2">{{obj.jdz}}</td>
384 <td>{{obj.remarks}}</td> 388 <td>{{obj.remarks}}</td>
src/main/resources/static/pages/electricity/list/list.html
@@ -419,7 +419,6 @@ onkeyup=&quot;this.value=this.value.replace(/[^(\d||/.)]/g,&#39;&#39;).replace(&#39;.&#39;,&#39;$#$&#39;).rep @@ -419,7 +419,6 @@ onkeyup=&quot;this.value=this.value.replace(/[^(\d||/.)]/g,&#39;&#39;).replace(&#39;.&#39;,&#39;$#$&#39;).rep
419 }) 419 })
420 //获取加存信息 420 //获取加存信息
421 $("#obtain").on('click', function () { 421 $("#obtain").on('click', function () {
422 - console.log("获取加存");  
423 if ($("#rq").val() != "") { 422 if ($("#rq").val() != "") {
424 var params =getParamsList(); 423 var params =getParamsList();
425 424
src/main/resources/static/pages/forms/export/import_Jdl.xls
No preview for this file type
src/main/resources/static/pages/forms/mould/commandState.xls
No preview for this file type
src/main/resources/static/pages/forms/mould/commandState1.xls
No preview for this file type
src/main/resources/static/pages/forms/mould/commandState2.xls 0 → 100644
No preview for this file type
src/main/resources/static/pages/forms/mould/countIntervalXx.xls
No preview for this file type
src/main/resources/static/pages/forms/mould/export_Jdl.xls
No preview for this file type
src/main/resources/static/pages/forms/mould/waybill_minhang_dl.xls 0 → 100644
No preview for this file type
src/main/resources/static/pages/forms/statement/commandState.html
@@ -35,16 +35,17 @@ @@ -35,16 +35,17 @@
35 <span class="item-label" style="width: 80px;">分公司: </span> 35 <span class="item-label" style="width: 80px;">分公司: </span>
36 <select class="form-control" name="subCompany" id="subCompany" style="width: 180px;"></select> 36 <select class="form-control" name="subCompany" id="subCompany" style="width: 180px;"></select>
37 </div> 37 </div>
  38 + <div style="margin-top: 10px" ></div>
38 <div style="display: inline-block; margin-left: 15px;"> 39 <div style="display: inline-block; margin-left: 15px;">
39 <span class="item-label" style="width: 80px;">线路: </span> 40 <span class="item-label" style="width: 80px;">线路: </span>
40 <select class="form-control" name="line" id="line" style="width: 180px;"></select> 41 <select class="form-control" name="line" id="line" style="width: 180px;"></select>
41 </div> 42 </div>
42 - <div style="margin-top: 10px" /> 43 +
43 <div style="display: inline-block;margin-left: 15px;"> 44 <div style="display: inline-block;margin-left: 15px;">
44 - <span class="item-label" style="width: 80px;">时间: </span> 45 + <span class="item-label" style="width: 80px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;时间: </span>
45 <input class="form-control" type="text" id="date" style="width: 180px;"/> 46 <input class="form-control" type="text" id="date" style="width: 180px;"/>
46 </div> 47 </div>
47 - <div style="display: inline-block;margin-left: 8px"> 48 + <div style="display:none;margin-left: 8px">
48 <span class="item-label" style="width: 140px;">内部编码: </span> 49 <span class="item-label" style="width: 140px;">内部编码: </span>
49 <select class="form-control" name="code" id="code" style="width: 180px;"></select> 50 <select class="form-control" name="code" id="code" style="width: 180px;"></select>
50 </div> 51 </div>
@@ -63,8 +64,6 @@ @@ -63,8 +64,6 @@
63 <th>公司</th> 64 <th>公司</th>
64 <th>分公司</th> 65 <th>分公司</th>
65 <th>线路</th> 66 <th>线路</th>
66 - <th>车辆</th>  
67 - <th>人员</th>  
68 <th>应发</th> 67 <th>应发</th>
69 <th>实发</th> 68 <th>实发</th>
70 <th>未确认</th> 69 <th>未确认</th>
@@ -76,7 +75,7 @@ @@ -76,7 +75,7 @@
76 </table> 75 </table>
77 <div id="box">&nbsp;</div> 76 <div id="box">&nbsp;</div>
78 <div id="works_hidden" class="hidden"> 77 <div id="works_hidden" class="hidden">
79 - <span class="item-label" style="width: 80px;margin-left: 20px;">明细: </span> 78 + <!-- <span class="item-label" style="width: 80px;margin-left: 20px;">明细: </span>
80 <span class="item-label" style="width: 80px;margin-left: 60px;">日期 </span> 79 <span class="item-label" style="width: 80px;margin-left: 60px;">日期 </span>
81 <span class="item-label" style="width: 80px;" id="date1"></span> 80 <span class="item-label" style="width: 80px;" id="date1"></span>
82 <span class="item-label" style="width: 80px;margin-left: 60px;">公司 </span> 81 <span class="item-label" style="width: 80px;margin-left: 60px;">公司 </span>
@@ -89,19 +88,21 @@ @@ -89,19 +88,21 @@
89 <span class="item-label" style="width: 80px;" id="clZbh1"></span> 88 <span class="item-label" style="width: 80px;" id="clZbh1"></span>
90 <span class="item-label" style="width: 80px;margin-left: 60px;">人员 </span> 89 <span class="item-label" style="width: 80px;margin-left: 60px;">人员 </span>
91 <span class="item-label" style="width: 80px;" id="jsy1"></span> 90 <span class="item-label" style="width: 80px;" id="jsy1"></span>
92 - <span class="item-label" style="width: 80px;margin-left: 60px;"></span> 91 + <span class="item-label" style="width: 80px;margin-left: 60px;"></span> -->
93 <input class="btn btn-default" type="button" id="export1" value="导出当前明细"/> 92 <input class="btn btn-default" type="button" id="export1" value="导出当前明细"/>
94 </div> 93 </div>
95 <table class="table table-bordered table-hover table-checkable" id="works"> 94 <table class="table table-bordered table-hover table-checkable" id="works">
96 <thead> 95 <thead>
97 <tr class="hidden"> 96 <tr class="hidden">
  97 + <th>公司</th>
  98 + <th>分公司</th>
98 <th>日期</th> 99 <th>日期</th>
99 <th>线路</th> 100 <th>线路</th>
100 <th>车辆</th> 101 <th>车辆</th>
101 - <th>计划发车时间</th>  
102 - <th>发送时间</th>  
103 - <th>收到时间</th>  
104 - <th>确认时间</th> 102 + <th>人员</th>
  103 + <th>应发</th>
  104 + <th>实发</th>
  105 + <th>未确认</th>
105 </tr> 106 </tr>
106 </thead> 107 </thead>
107 <tbody> 108 <tbody>
@@ -183,6 +184,7 @@ @@ -183,6 +184,7 @@
183 var tempData = {}; 184 var tempData = {};
184 $.get('/report/lineList',function(xlList){ 185 $.get('/report/lineList',function(xlList){
185 var data = []; 186 var data = [];
  187 + data.push({id: " ", text: "全部线路"});
186 $.get('/user/companyData', function(result){ 188 $.get('/user/companyData', function(result){
187 for(var i = 0; i < result.length; i++){ 189 for(var i = 0; i < result.length; i++){
188 var companyCode = result[i].companyCode; 190 var companyCode = result[i].companyCode;
@@ -265,6 +267,7 @@ @@ -265,6 +267,7 @@
265 var company = $("#company").val(); 267 var company = $("#company").val();
266 var subCompany = $("#subCompany").val(); 268 var subCompany = $("#subCompany").val();
267 function jsDoQuery(pagination){ 269 function jsDoQuery(pagination){
  270 + $("#export").removeAttr("disabled");
268 if($("#date").val() == null || $("#date").val().trim().length == 0){ 271 if($("#date").val() == null || $("#date").val().trim().length == 0){
269 layer.msg("请选择时间!"); 272 layer.msg("请选择时间!");
270 return; 273 return;
@@ -287,29 +290,61 @@ @@ -287,29 +290,61 @@
287 $get('/pcpc/commandState', params, function(result){ 290 $get('/pcpc/commandState', params, function(result){
288 // 把数据填充到模版中 291 // 把数据填充到模版中
289 var tbodyHtml = template('list_commandState',{list:result}); 292 var tbodyHtml = template('list_commandState',{list:result});
290 - list = result;  
291 // 把渲染好的模版html文本追加到表格中 293 // 把渲染好的模版html文本追加到表格中
292 $('#forms tbody').html(tbodyHtml); 294 $('#forms tbody').html(tbodyHtml);
293 295
294 - if(result.length == 0){  
295 - $('#export').attr('disabled', "true");  
296 - } else {  
297 - $("#export").removeAttr("disabled");  
298 - }  
299 -  
300 - $("#works_hidden").removeClass("hidden");  
301 - $("#works .hidden").removeClass("hidden");  
302 - $("#works_hidden").addClass("hidden");  
303 - $("#works").addClass("hidden"); 296 + $('.btn-command').on('click', openCommandByLine);
304 297
305 }); 298 });
306 } 299 }
  300 +
  301 + var xlbm="";
  302 + function openCommandByLine(){
  303 + var id = $(this).data('id');
  304 + date = $("#date").val();
  305 + xlbm=id;
  306 + var params = {};
  307 + params['line'] = id;
  308 + params['date'] = date;
  309 + params['type'] = "query";
  310 + $("#works .hidden").removeClass("hidden");
  311 + $("#works_hidden").removeClass("hidden");
  312 + $get('/pcpc/commandByLineList',params,function(result){
  313 + var commandByLine = template('list_workList',{list:result});
  314 + $('#works tbody').html(commandByLine);
  315 +
  316 + $('.btn-command-line').on('click', openCommand);
  317 + $("html,body").animate({scrollTop:$("#works").offset().top},1000);
  318 + });
  319 + }
  320 +
  321 + function openCommand(){
  322 + var id = $(this).data('id');
  323 + date = $("#date").val();
  324 + var params = {};
  325 + params['jgh'] = id;
  326 + params['date'] = date;
  327 + params['line'] =xlbm;
  328 + $.get('/pages/forms/statement/commandStateByLine.html', function (content) {
  329 + layer.open({
  330 + type: 1,
  331 + area: ['800px', '600px'],
  332 + content: content,
  333 + title: '指令状态分析',
  334 + shift: 5,
  335 + scrollbar: false,
  336 + success: function () {
  337 + $('#commandByLineList').trigger('init', params);
  338 + }
  339 + });
  340 + });
  341 + }
  342 +
307 343
308 $("#export").on("click",function(){ 344 $("#export").on("click",function(){
309 var params = {}; 345 var params = {};
310 params['line'] = line; 346 params['line'] = line;
311 params['date'] = date; 347 params['date'] = date;
312 - params['code'] = code;  
313 params['type'] = "export"; 348 params['type'] = "export";
314 params['company'] = company; 349 params['company'] = company;
315 params['subCompany'] = subCompany; 350 params['subCompany'] = subCompany;
@@ -318,45 +353,16 @@ @@ -318,45 +353,16 @@
318 }); 353 });
319 }); 354 });
320 355
321 - var jsy = "";  
322 - $("#forms tbody").on("click","a",function(){  
323 - jsy = $(this).html();  
324 - $.each(list, function(i, g){  
325 - if(jsy == g.jsy){  
326 - $("#date1").html(g.date);  
327 - $("#line1").html(g.line);  
328 - $("#clZbh1").html(g.clZbh);  
329 - $("#jsy1").html(g.jsy);  
330 - $("#company2").html(g.company);  
331 - $("subCompany2").html(g.subCompany);  
332 - $("#works_hidden").removeClass("hidden");  
333 - $("#works").removeClass("hidden");  
334 - // 把数据填充到模版中  
335 - var tbodyHtml = template('list_workList',{list:g.workList});  
336 - // 把渲染好的模版html文本追加到表格中  
337 - $('#works tbody').html(tbodyHtml);  
338 - }  
339 - });  
340 -  
341 - $("html,body").animate({scrollTop:$("#box").offset().top},1000);  
342 -  
343 - });  
344 -  
345 $("#export1").on("click",function(){ 356 $("#export1").on("click",function(){
346 var params = {}; 357 var params = {};
347 - params['jsy'] = jsy;  
348 - params['line'] = line; 358 + params['line'] = xlbm;
349 params['date'] = date; 359 params['date'] = date;
350 - params['code'] = code;  
351 - params['type'] = "export1";  
352 - params['company'] = company;  
353 - params['subCompany'] = subCompany;  
354 - $get('/pcpc/commandState', params, function(result){  
355 - window.open("/downloadFile/download?fileName=指令状态明细"+moment(date).format("YYYYMMDD")); 360 + params['type'] = "export";
  361 + $get('/pcpc/commandByLineList', params, function(result){
  362 + window.open("/downloadFile/download?fileName=线路指令状态分析"+moment(date).format("YYYYMMDD"));
356 }); 363 });
357 }); 364 });
358 365
359 -  
360 }); 366 });
361 367
362 368
@@ -367,9 +373,10 @@ @@ -367,9 +373,10 @@
367 <td>{{obj.date}}</td> 373 <td>{{obj.date}}</td>
368 <td>{{obj.company}}</td> 374 <td>{{obj.company}}</td>
369 <td>{{obj.subCompany}}</td> 375 <td>{{obj.subCompany}}</td>
370 - <td>{{obj.line}}</td>  
371 - <td>{{obj.clZbh}}</td>  
372 - <td><a id="jsy">{{obj.jsy}}</a></td> 376 + <td>
  377 + <button type="button" class="btn btn-sm blue btn-command"
  378 + data-id="{{obj.xlbm}}">{{obj.line}}</button>
  379 +
373 <td>{{obj.jhf}}</td> 380 <td>{{obj.jhf}}</td>
374 <td>{{obj.sjf}}</td> 381 <td>{{obj.sjf}}</td>
375 <td>{{obj.wqr}}</td> 382 <td>{{obj.wqr}}</td>
@@ -377,7 +384,7 @@ @@ -377,7 +384,7 @@
377 {{/each}} 384 {{/each}}
378 {{if list.length == 0}} 385 {{if list.length == 0}}
379 <tr> 386 <tr>
380 - <td colspan="9"><h6 class="muted">没有找到相关数据</h6></td> 387 + <td colspan="7"><h6 class="muted">没有找到相关数据</h6></td>
381 </tr> 388 </tr>
382 {{/if}} 389 {{/if}}
383 </script> 390 </script>
@@ -385,18 +392,23 @@ @@ -385,18 +392,23 @@
385 <script type="text/html" id="list_workList"> 392 <script type="text/html" id="list_workList">
386 {{each list as obj i}} 393 {{each list as obj i}}
387 <tr> 394 <tr>
388 - <td>{{obj.date}}</td>  
389 - <td>{{obj.line}}</td>  
390 - <td>{{obj.clZbh}}</td>  
391 - <td>{{obj.fcsj}}</td>  
392 - <td>{{obj.time}}</td>  
393 - <td>{{obj.time46}}</td>  
394 - <td>{{obj.time47}}</td> 395 + <td>{{obj.company}}</td>
  396 + <td>{{obj.subCompany}}</td>
  397 + <td>{{obj.date}}</td>
  398 + <td>{{obj.line}}</td>
  399 + <td>{{obj.clZbh}}</td>
  400 + <td>
  401 + <button type="button" class="btn btn-sm blue btn-command-line"
  402 + data-id="{{obj.jGh}}">{{obj.jsy}}</button>
  403 + </td>
  404 + <td>{{obj.jhf}}</td>
  405 + <td>{{obj.sjf}}</td>
  406 + <td>{{obj.wqr}}</td>
395 </tr> 407 </tr>
396 {{/each}} 408 {{/each}}
397 {{if list.length == 0}} 409 {{if list.length == 0}}
398 <tr> 410 <tr>
399 - <td colspan="7"><h6 class="muted">没有找到相关数据</h6></td> 411 + <td colspan="9"><h6 class="muted">没有找到相关数据</h6></td>
400 </tr> 412 </tr>
401 {{/if}} 413 {{/if}}
402 </script> 414 </script>
403 \ No newline at end of file 415 \ No newline at end of file
src/main/resources/static/pages/forms/statement/commandStateByLine.html 0 → 100644
  1 +<style type="text/css">
  2 + .table-bordered {
  3 + border: 1px solid; }
  4 + .table-bordered > thead > tr > th,
  5 + .table-bordered > thead > tr > td,
  6 + .table-bordered > tbody > tr > th,
  7 + .table-bordered > tbody > tr > td,
  8 + .table-bordered > tfoot > tr > th,
  9 + .table-bordered > tfoot > tr > td {
  10 + border: 1px solid; }
  11 + .table-bordered > thead > tr > th,
  12 + .table-bordered > thead > tr > td {
  13 + border-bottom-width: 2px; }
  14 +
  15 + .table > tbody + tbody {
  16 + border-top: 1px solid; }
  17 +</style>
  18 +
  19 +<div class="page-head">
  20 + <div class="page-title" style="margin-left: 20px">
  21 + <button id="exportList">数据导出</button>
  22 + </div>
  23 +</div>
  24 +
  25 +<div class="row" id="commandByLineList">
  26 + <div class="col-md-12">
  27 + <div class="portlet light porttlet-fit bordered">
  28 + <div class="portlet-body">
  29 + <div class="table-container" style="margin-top: 10px;overflow:auto;min-width: 600px">
  30 + <table class="table table-bordered table-hover table-checkable" id="forms_1">
  31 + <thead>
  32 + <tr>
  33 + <td>公司</td>
  34 + <td>分公司</td>
  35 + <td>日期</td>
  36 + <td>线路</td>
  37 + <td>车辆</td>
  38 + <td>人员</td>
  39 + <td>计划发车时间</td>
  40 + <td>发送时间</td>
  41 + <td>收到时间</td>
  42 + <td>确认时间</td>
  43 + </tr>
  44 + </thead>
  45 +
  46 + <tbody>
  47 +
  48 + </tbody>
  49 + </table>
  50 + </div>
  51 + </div>
  52 + </div>
  53 + </div>
  54 +</div>
  55 +
  56 +<script>
  57 + $(function(){
  58 + // 关闭左侧栏
  59 + if (!$('body').hasClass('page-sidebar-closed'))
  60 + $('.menu-toggler.sidebar-toggler').click();
  61 + var params_;
  62 + $("#commandByLineList").on('init', function (e, params) {
  63 + params['type']='export';
  64 + params_=params;
  65 + console.log(params.date);
  66 + $get('/pcpc/commandByJghList',params,function(result){
  67 + var commandByLine = template('commandByLine',{list:result});
  68 + $('#forms_1 tbody').html(commandByLine);
  69 + });
  70 + })
  71 + $("#exportList").on('click',function(){
  72 + $get('/pcpc/commandByLineList', params_, function(result){
  73 + window.open("/downloadFile/download?fileName=指令状态明细"+moment(params_.date).format("YYYYMMDD"));
  74 + });
  75 + });
  76 +
  77 +
  78 + });
  79 +</script>
  80 +<script type="text/html" id="commandByLine">
  81 + {{each list as obj i}}
  82 + <tr>
  83 + <td>{{obj.company}}</td>
  84 + <td>{{obj.subCompany}}</td>
  85 + <td>{{obj.date}}</td>
  86 + <td>{{obj.line}}</td>
  87 + <td>{{obj.clZbh}}</td>
  88 + <td>{{obj.jsy}}</td>
  89 + <td>{{obj.jfsj}}</td>
  90 + <td>{{obj.time}}</td>
  91 + <td>{{obj.time46}}</td>
  92 + <td>{{obj.time47}}</td>
  93 + </tr>
  94 + {{/each}}
  95 + {{if list.length == 0}}
  96 + <tr>
  97 + <td colspan="10"><h6 class="muted">没有找到相关数据</h6></td>
  98 + </tr>
  99 + {{/if}}
  100 +</script>
0 \ No newline at end of file 101 \ No newline at end of file
src/main/resources/static/pages/forms/statement/waybill.html
@@ -417,11 +417,20 @@ @@ -417,11 +417,20 @@
417 <td colspan="14">路别:{{xlName}} 路牌:{{lpName}} 车号:{{clZbh}}({{plate}}) 出场时间:{{fcsjActual}} 到达站名:{{zdzName}} 当班调派:{{dbdp}} 日期:{{scheduleDate}}</td> 417 <td colspan="14">路别:{{xlName}} 路牌:{{lpName}} 车号:{{clZbh}}({{plate}}) 出场时间:{{fcsjActual}} 到达站名:{{zdzName}} 当班调派:{{dbdp}} 日期:{{scheduleDate}}</td>
418 </tr> 418 </tr>
419 <tr> 419 <tr>
  420 + {{if type==0}}
420 <td colspan="2">出场存油 {{ccyl}}升</td> 421 <td colspan="2">出场存油 {{ccyl}}升</td>
421 <td colspan="2">加注量 {{jzl}}升</td> 422 <td colspan="2">加注量 {{jzl}}升</td>
422 <td colspan="2">进场存油 {{jcyl}}升</td> 423 <td colspan="2">进场存油 {{jcyl}}升</td>
423 <td colspan="4">加注机油 &nbsp;升</td> 424 <td colspan="4">加注机油 &nbsp;升</td>
424 <td colspan="4">本日耗油 {{yh}}升</td> 425 <td colspan="4">本日耗油 {{yh}}升</td>
  426 + {{/if}}
  427 + {{if type==1}}
  428 + <td colspan="2">出场存电 {{ccyl}}%</td>
  429 + <td colspan="2">充电量 {{jzl}}度</td>
  430 + <td colspan="2">进场存电 {{jcyl}}%</td>
  431 + <td colspan="4">加注机油 &nbsp;升</td>
  432 + <td colspan="4">本日耗电 {{yh}}度</td>
  433 + {{/if}}
425 </tr> 434 </tr>
426 <tr> 435 <tr>
427 <td rowspan="2">调度章</td> 436 <td rowspan="2">调度章</td>
src/main/resources/static/pages/report/countInterval/countInterval.html
@@ -52,7 +52,7 @@ @@ -52,7 +52,7 @@
52 <div class="portlet-body"> 52 <div class="portlet-body">
53 <div class="row" class="col-md-12"> 53 <div class="row" class="col-md-12">
54 <div class="col-md-5"> 54 <div class="col-md-5">
55 - <div id="left_table" style="margin-top: 10px;overflow:auto;height: 860px"> 55 + <div id="left_table" style="margin-top: 10px;overflow:auto;">
56 <input class="btn btn-default hidden" type="button" id="export" value="导出"/> 56 <input class="btn btn-default hidden" type="button" id="export" value="导出"/>
57 <table class="table table-bordered table-hover table-checkable pre-scrollable" id="info_inter"> 57 <table class="table table-bordered table-hover table-checkable pre-scrollable" id="info_inter">
58 <thead> 58 <thead>
@@ -61,7 +61,7 @@ @@ -61,7 +61,7 @@
61 <th>线路</th> 61 <th>线路</th>
62 <th>等级</th> 62 <th>等级</th>
63 <th>班次数</th> 63 <th>班次数</th>
64 - <th>发生次数</th> 64 + <th>次数</th>
65 <th>发生率</th> 65 <th>发生率</th>
66 </tr> 66 </tr>
67 </thead> 67 </thead>
@@ -77,16 +77,21 @@ @@ -77,16 +77,21 @@
77 <table class="table table-bordered table-hover table-checkable" id="forms"> 77 <table class="table table-bordered table-hover table-checkable" id="forms">
78 <thead class="hidden"> 78 <thead class="hidden">
79 <tr > 79 <tr >
80 - <th rowspan="2">分公司</th>  
81 - <th rowspan="2">线路</th>  
82 - <th rowspan="2">大间隔等级</th>  
83 - <th colspan="4">发生大间隔班次</th> 80 + <th rowspan="3">分公司</th>
  81 + <th rowspan="3">线路</th>
  82 + <th rowspan="3">等级</th>
  83 + <th colspan="6">发生大间隔班次</th>
84 </tr> 84 </tr>
85 <tr> 85 <tr>
86 - <th>计发</th>  
87 - <th>实发</th>  
88 - <th>计发</th>  
89 - <th>实发</th> 86 + <th rowspan="2">计发</th>
  87 + <th rowspan="2">实发</th>
  88 + <th rowspan="2">计发</th>
  89 + <th rowspan="2">实发</th>
  90 + <th colspan="2">间隔时间(分)</th>
  91 + </tr>
  92 + <tr>
  93 + <th>班次</th>
  94 + <th>大间隔</th>
90 </tr> 95 </tr>
91 </thead> 96 </thead>
92 <tbody> 97 <tbody>
@@ -208,7 +213,7 @@ @@ -208,7 +213,7 @@
208 layer.msg("请选择时间!"); 213 layer.msg("请选择时间!");
209 return; 214 return;
210 } 215 }
211 -// $("#left_table").height($(window).height()-100); 216 + $("#left_table").height($(window).height()-200);
212 line = $("#line").val(); 217 line = $("#line").val();
213 date = $("#date").val(); 218 date = $("#date").val();
214 gsbm =$("#gsdm").val(); 219 gsbm =$("#gsdm").val();
@@ -296,13 +301,15 @@ @@ -296,13 +301,15 @@
296 <script type="text/html" id="list_inter_info_xx"> 301 <script type="text/html" id="list_inter_info_xx">
297 {{each list as obj i}} 302 {{each list as obj i}}
298 <tr> 303 <tr>
299 - <td width="20%">{{obj.fgsname}}</td>  
300 - <td width="20%">{{obj.xlName}}</td>  
301 - <td width="10%">{{obj.djgde}}</td>  
302 - <td width="10%">{{obj.qJh}}</td>  
303 - <td width="10%">{{obj.qSj}}</td>  
304 - <td width="10%">{{obj.hJh}}</td>  
305 - <td width="10%">{{obj.hSj}}</td> 304 + <td width="14%">{{obj.fgsname}}</td>
  305 + <td width="16%">{{obj.xlName}}</td>
  306 + <td width="8%">{{obj.djgde}}</td>
  307 + <td width="8%">{{obj.qJh}}</td>
  308 + <td width="8%">{{obj.qSj}}</td>
  309 + <td width="8%">{{obj.hJh}}</td>
  310 + <td width="8%">{{obj.hSj}}</td>
  311 + <td width="10%">{{obj.bcjgsj}}</td>
  312 + <td width="10%">{{obj.djgsj}}</td>
306 </tr> 313 </tr>
307 {{/each}} 314 {{/each}}
308 {{if list.length == 0}} 315 {{if list.length == 0}}
src/main/resources/static/pages/report/sheet/sheetList.html
@@ -242,7 +242,6 @@ @@ -242,7 +242,6 @@
242 } 242 }
243 function openSheetList(){ 243 function openSheetList(){
244 var id = $(this).data('id'); 244 var id = $(this).data('id');
245 - console.log(id);  
246 $.get('/pages/report/sheet/list.html', function (content) { 245 $.get('/pages/report/sheet/list.html', function (content) {
247 layer.open({ 246 layer.open({
248 type: 1, 247 type: 1,
src/main/resources/static/pages/summary/work_hours/list.html
1 -<!DOCTYPE html>  
2 -<html lang="zh-cn">  
3 -  
4 -<head>  
5 - <meta charset="UTF-8">  
6 - <link rel="stylesheet" href="/assets/plugins/uk3.0/uikit.min.css"/>  
7 - <link rel="stylesheet" href="/real_control_v2/assets/plugins/perfect-scrollbar/perfect-scrollbar.css" />  
8 - <!-- flatpickr -->  
9 - <link rel="stylesheet" href="/real_control_v2/assets/plugins/flatpickr/flatpickr.min.css">  
10 - <style>  
11 - html,body{  
12 - height: 100%;  
13 - }  
14 - .ct_page{  
15 - padding: 25px 15px;  
16 - height: 100%;  
17 - height: calc(100% - 50px);  
18 - }  
19 -  
20 - .ct_cont{  
21 - height: calc(100% - 41px);  
22 - }  
23 -  
24 - .ct_cont>div>div.uk-card{  
25 - height: 99%;  
26 - }  
27 -  
28 - .loading{  
29 - height: 100%;  
30 - text-align: center;  
31 - }  
32 - .loading .uk-spinner{  
33 - margin-top: 200px;  
34 - }  
35 - .loading circle{  
36 - stroke: red;  
37 - }  
38 -  
39 - .ps-container > .ps-scrollbar-x-rail, .ps-container > .ps-scrollbar-y-rail{  
40 - opacity: 0.6 !important;  
41 - padding: 0 !important;  
42 - }  
43 -  
44 - .ct_table_wrap.day th:nth-of-type(1),.ct_table_wrap.day td:nth-of-type(1){  
45 - width: 10%;  
46 - }  
47 - .ct_table_wrap.day th:nth-of-type(2),.ct_table_wrap.day td:nth-of-type(2){  
48 - width: 10%;  
49 - }  
50 - .ct_table_wrap.day th:nth-of-type(3),.ct_table_wrap.day td:nth-of-type(3){  
51 - width: 10%;  
52 - }  
53 - .ct_table_wrap.day th:nth-of-type(4),.ct_table_wrap.day td:nth-of-type(4){  
54 - width: 10%;  
55 - }  
56 - .ct_table_wrap.day th:nth-of-type(5),.ct_table_wrap.day td:nth-of-type(5){  
57 - width: 5%;  
58 - }  
59 - .ct_table_wrap.day th:nth-of-type(6),.ct_table_wrap.day td:nth-of-type(6){  
60 - width: 15%;  
61 - }  
62 - .ct_table_wrap.day th:nth-of-type(7),.ct_table_wrap.day td:nth-of-type(7){  
63 - width: 10%;  
64 - }  
65 - .ct_table_wrap.day th:nth-of-type(8),.ct_table_wrap.day td:nth-of-type(8){  
66 - width: 10%;  
67 - }  
68 - .ct_table_wrap.day th:nth-of-type(9),.ct_table_wrap.day td:nth-of-type(9){  
69 - width: 10%;  
70 - }  
71 - .ct_table_wrap.day th:nth-of-type(10),.ct_table_wrap.day td:nth-of-type(10){  
72 - width: 10%;  
73 - }  
74 -  
75 - .ct_search_form_wrap{  
76 - border-bottom: 1px solid #e5e5e5;  
77 - padding: 10px 0 25px 10px;  
78 - }  
79 - .ct_search_form_wrap .ct_field{  
80 - display: inline-block;  
81 - margin: 0 5px;  
82 - }  
83 -  
84 - .ct_search_form_wrap .ct_field label{  
85 - font-size: 14px;  
86 - }  
87 -  
88 - .ct_search_form_wrap .ct_field input{  
89 - width: 110px;  
90 - }  
91 -  
92 - .ct_search_form_wrap .ct_field select{  
93 - width: auto;  
94 - min-width: 100px;  
95 - }  
96 -  
97 - .ct_search_form_wrap .uk-button{  
98 - padding: 0 14px;  
99 - }  
100 -  
101 - .ct_search_form_wrap .uk-button i{  
102 - vertical-align: middle;  
103 - margin-top: -2px;  
104 - margin-right: 7px;  
105 - }  
106 -  
107 - .ct_table_wrap{  
108 - font-size: 14px;  
109 - height: calc(100% - 77px);  
110 - }  
111 -  
112 - .t_body_wrap{  
113 - height: calc(100% - 41px);  
114 - overflow: auto;  
115 - position: relative;  
116 - }  
117 - </style>  
118 -</head>  
119 -  
120 -<body>  
121 -<div class="loading">  
122 - <div uk-spinner></div>  
123 -</div>  
124 -<div class="ct_page" style="display: none;">  
125 - <h2 class="uk-heading-line uk-heading-bullet"><span>工时统计</span></h2>  
126 - <div class="ct_cont" >  
127 - <div class="ct_search_form_wrap">  
128 - <form>  
129 - <div class="ct_field">  
130 - <label>公司:  
131 - <select class="uk-select" name="companyId_eq">  
132 - </select>  
133 - </label>  
134 - </div>  
135 - <div class="ct_field">  
136 - <label>分公司:  
137 - <select class="uk-select" name="subCompanyId_eq">  
138 - </select>  
139 - </label>  
140 - </div>  
141 - <div class="ct_field">  
142 - <label>线路:  
143 - <select class="uk-select" name="lineCode_eq">  
144 - <option value="81101">航头4路</option>  
145 - </select>  
146 - </label>  
147 - </div>  
148 - <div class="ct_field">  
149 - <label>日期:  
150 - <input class="uk-input" name="rq_eq" >  
151 - </label>  
152 - </div>  
153 - <div class="ct_field">  
154 - <label>驾驶员:  
155 - <input class="uk-input" name="jsy_eq" placeholder="工号">  
156 - </label>  
157 - </div>  
158 - <div class="ct_field">  
159 - <label>车辆:  
160 - <input class="uk-input" name="nbbm_eq" >  
161 - </label>  
162 - </div>  
163 - <div class="ct_field">  
164 - <button class="uk-button uk-button-primary search"><i uk-icon="icon: search"></i>搜索</button>  
165 - <span id="add_hours_icon" uk-icon="icon: plus" style="vertical-align: bottom;margin-left: 5px;" title="录入工休和非营运工时" uk-tooltip></span>  
166 - </div>  
167 - </form>  
168 - </div>  
169 - <div class="ct_table_wrap day">  
170 - <table class="uk-table uk-table-small" style="margin-bottom: 0;">  
171 - <thead>  
172 - <tr>  
173 - <th>日期</th>  
174 - <th>公司</th>  
175 - <th>分公司</th>  
176 - <th>线路</th>  
177 - <th>路牌</th>  
178 - <th>驾驶员</th>  
179 - <th>车辆</th>  
180 - <th>计划工时 &nbsp;<i uk-icon="icon: question; ratio:.7" title="格式:小时.分钟" uk-tooltip></i ></th>  
181 - <th>实际工时</th>  
182 - <th>备注</th>  
183 - </tr>  
184 - </thead>  
185 - </table>  
186 - <div class="t_body_wrap">  
187 - <table class="uk-table uk-table-divider uk-table-hover uk-table-small ct_jsy_day_table">  
188 - <tbody>  
189 - </tbody>  
190 - </table>  
191 - </div>  
192 - </div>  
193 - </div>  
194 -</div>  
195 -  
196 -<!--<div id="hours_add_modal" uk-modal>  
197 - <div class="uk-modal-dialog uk-modal-body">  
198 - <button class="uk-modal-close-default" type="button" uk-close></button>  
199 - <h2 class="uk-modal-title">Default</h2>  
200 - <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>  
201 - </div>  
202 -</div>-->  
203 -  
204 -<script id="hours_jsy_day_list_temp" type="text/html">  
205 - {{each list as obj i}}  
206 - <tr>  
207 - <td>{{obj.rq}}</td>  
208 - <td>{{obj.companyName}}</td>  
209 - <td>{{obj.subCompanyName}}</td>  
210 - <td>{{obj.lineName}}</td>  
211 - <td>{{obj.lpName}}</td>  
212 - <td>{{obj.jsy}}/{{obj.jsyName}}</td>  
213 - <td>{{obj.nbbm}}</td>  
214 - <td>{{obj.hoursJhStr}}</td>  
215 - <td>{{obj.hoursSjStr}}</td>  
216 - <td>{{obj.remarks}}</td>  
217 - </tr>  
218 - {{/each}}  
219 -</script>  
220 -  
221 -<script src="/metronic_v4.5.4/plugins/jquery.min.js"></script>  
222 -<script src="/assets/plugins/uk3.0/uikit.min.js"></script>  
223 -<script src="/assets/plugins/uk3.0/uikit-icons.min.js"></script>  
224 -<script src="/real_control_v2/assets/plugins/perfect-scrollbar/perfect-scrollbar.jquery.js" ></script>  
225 -<!-- EventProxy -->  
226 -<script src="/assets/js/eventproxy.js"></script>  
227 -<!-- art-template 模版引擎 -->  
228 -<script src="/assets/plugins/template.js"></script>  
229 -<script src="/real_control_v2/assets/plugins/moment/moment.min.js"></script>  
230 -<!-- jquery.serializejson JSON序列化插件 -->  
231 -<script src="/assets/plugins/jquery.serializejson.js" merge="plugins"></script>  
232 -<!-- flatpickr -->  
233 -<script src="/real_control_v2/assets/plugins/flatpickr/flatpickr.min.js" ></script>  
234 -<script src="/real_control_v2/assets/plugins/flatpickr/l10n/zh.js" ></script>  
235 -<script>  
236 -  
237 - var f = $('form', '');  
238 - var page=0, pageSize=120;  
239 -  
240 - var ep = EventProxy.create('query_comps', 'query_lines', function () {  
241 - $('[name=companyId_eq]', f).trigger('change');//公司change  
242 - query();  
243 -  
244 - $('.loading').remove();  
245 - $('.ct_page').show();  
246 - });  
247 -  
248 - //点击搜索  
249 - $('button.search', f).on('click', query);  
250 -  
251 - function query() {  
252 - var data = f.serializeJSON();  
253 - data.page = page;  
254 - data.size = pageSize;  
255 -  
256 - $.get('/summary/hours', data, function (rs) {  
257 - //console.log('data', rs);  
258 - var htmlStr = template('hours_jsy_day_list_temp', {list: rs.content});  
259 - $('.ct_jsy_day_table tbody').html(htmlStr);  
260 -  
261 - $('.t_body_wrap').perfectScrollbar('update');  
262 - });  
263 - }  
264 -  
265 - //日期选择器  
266 - $('[name=rq_eq]', f).val('2017-07-25');  
267 - flatpickr('.ct_search_form_wrap [name=rq_eq]', {"locale": "zh", maxDate: '2017-07-25', minDate: '2017-07-01'});  
268 -  
269 - var comps;  
270 - //构建公司级联下拉框  
271 - $.get('/user/companyData', function (rs) {  
272 - comps = rs;  
273 - var opts = '';  
274 - for(var i=0,obj;obj=comps[i++];){  
275 - opts += '<option value="'+obj.companyCode+'">'+obj.companyName+'</option>';  
276 - }  
277 - $('[name=companyId_eq]', f).html(opts);  
278 - ep.emit('query_comps');  
279 - });  
280 -  
281 - var lineMapps;  
282 - //加载线路信息  
283 - $.get('/line/all', {'destroy_eq': 0}, function (rs) {  
284 - rs.sort(function (a, b) {  
285 - return a.name.localeCompare(b.name);  
286 - });  
287 - lineMapps={};  
288 - var k;  
289 - $.each(rs, function () {  
290 - k = this.company+'_'+this.brancheCompany;  
291 - if(!lineMapps[k])  
292 - lineMapps[k]=[];  
293 - lineMapps[k].push(this);  
294 - });  
295 -  
296 - ep.emit('query_lines');  
297 - });  
298 -  
299 - $('[name=companyId_eq]', f).on('change', function () {  
300 - var code = $(this).val(), subs=[];  
301 - $.each(comps, function () {  
302 - if(this.companyCode==code)  
303 - subs=this.children;  
304 - });  
305 -  
306 - var opts='';  
307 - $.each(subs, function () {  
308 - opts += '<option value="'+this.code+'">'+this.name+'</option>';  
309 - });  
310 - $('[name=subCompanyId_eq]', f).html(opts).trigger('change');  
311 - });  
312 -  
313 - $('[name=subCompanyId_eq]', f).on('change', function () {  
314 - var k = $('[name=companyId_eq]', f).val() + '_' + $(this).val();  
315 - var array = lineMapps[k];  
316 - var opts = '';  
317 - if(array){  
318 - $.each(array, function () {  
319 - opts += '<option value="'+this.lineCode+'">'+this.name+'</option>';  
320 - });  
321 - }  
322 - $('[name=lineCode_eq]', f).html(opts);  
323 - });  
324 -  
325 - //  
326 - //滚动条  
327 - $('.t_body_wrap').perfectScrollbar({suppressScrollX: true});  
328 -  
329 - $(document).on('submit', 'form', function () {  
330 - return false;  
331 - });  
332 -  
333 - $('#add_hours_icon').on('click', function () {  
334 - UIkit.notification('暂不开放!', 'danger');  
335 - });  
336 -</script>  
337 -</body> 1 +<!DOCTYPE html>
  2 +<html lang="zh-cn">
  3 +
  4 +<head>
  5 + <meta charset="UTF-8">
  6 + <link rel="stylesheet" href="/assets/plugins/uk3.0/uikit.min.css"/>
  7 + <link rel="stylesheet" href="/real_control_v2/assets/plugins/perfect-scrollbar/perfect-scrollbar.css" />
  8 + <!-- flatpickr -->
  9 + <link rel="stylesheet" href="/real_control_v2/assets/plugins/flatpickr/flatpickr.min.css">
  10 + <style>
  11 + html,body{
  12 + height: 100%;
  13 + }
  14 + .ct_page{
  15 + padding: 25px 15px;
  16 + height: 100%;
  17 + height: calc(100% - 50px);
  18 + }
  19 +
  20 + .ct_cont{
  21 + height: calc(100% - 41px);
  22 + }
  23 +
  24 + .ct_cont>div>div.uk-card{
  25 + height: 99%;
  26 + }
  27 +
  28 + .loading{
  29 + height: 100%;
  30 + text-align: center;
  31 + }
  32 + .loading .uk-spinner{
  33 + margin-top: 200px;
  34 + }
  35 + .loading circle{
  36 + stroke: red;
  37 + }
  38 +
  39 + .ps-container > .ps-scrollbar-x-rail, .ps-container > .ps-scrollbar-y-rail{
  40 + opacity: 0.6 !important;
  41 + padding: 0 !important;
  42 + }
  43 +
  44 + .ct_table_wrap.day th:nth-of-type(1),.ct_table_wrap.day td:nth-of-type(1){
  45 + width: 10%;
  46 + }
  47 + .ct_table_wrap.day th:nth-of-type(2),.ct_table_wrap.day td:nth-of-type(2){
  48 + width: 10%;
  49 + }
  50 + .ct_table_wrap.day th:nth-of-type(3),.ct_table_wrap.day td:nth-of-type(3){
  51 + width: 10%;
  52 + }
  53 + .ct_table_wrap.day th:nth-of-type(4),.ct_table_wrap.day td:nth-of-type(4){
  54 + width: 10%;
  55 + }
  56 + .ct_table_wrap.day th:nth-of-type(5),.ct_table_wrap.day td:nth-of-type(5){
  57 + width: 5%;
  58 + }
  59 + .ct_table_wrap.day th:nth-of-type(6),.ct_table_wrap.day td:nth-of-type(6){
  60 + width: 15%;
  61 + }
  62 + .ct_table_wrap.day th:nth-of-type(7),.ct_table_wrap.day td:nth-of-type(7){
  63 + width: 10%;
  64 + }
  65 + .ct_table_wrap.day th:nth-of-type(8),.ct_table_wrap.day td:nth-of-type(8){
  66 + width: 10%;
  67 + }
  68 + .ct_table_wrap.day th:nth-of-type(9),.ct_table_wrap.day td:nth-of-type(9){
  69 + width: 10%;
  70 + }
  71 + .ct_table_wrap.day th:nth-of-type(10),.ct_table_wrap.day td:nth-of-type(10){
  72 + width: 10%;
  73 + }
  74 +
  75 + .ct_search_form_wrap{
  76 + border-bottom: 1px solid #e5e5e5;
  77 + padding: 10px 0 25px 10px;
  78 + }
  79 + .ct_search_form_wrap .ct_field{
  80 + display: inline-block;
  81 + margin: 0 5px;
  82 + }
  83 +
  84 + .ct_search_form_wrap .ct_field label{
  85 + font-size: 14px;
  86 + }
  87 +
  88 + .ct_search_form_wrap .ct_field input{
  89 + width: 110px;
  90 + }
  91 +
  92 + .ct_search_form_wrap .ct_field select{
  93 + width: auto;
  94 + min-width: 100px;
  95 + }
  96 +
  97 + .ct_search_form_wrap .uk-button{
  98 + padding: 0 14px;
  99 + }
  100 +
  101 + .ct_search_form_wrap .uk-button i{
  102 + vertical-align: middle;
  103 + margin-top: -2px;
  104 + margin-right: 7px;
  105 + }
  106 +
  107 + .ct_table_wrap{
  108 + font-size: 14px;
  109 + height: calc(100% - 77px);
  110 + }
  111 +
  112 + .t_body_wrap{
  113 + height: calc(100% - 41px);
  114 + overflow: auto;
  115 + position: relative;
  116 + }
  117 + </style>
  118 +</head>
  119 +
  120 +<body>
  121 +<div class="loading">
  122 + <div uk-spinner></div>
  123 +</div>
  124 +<div class="ct_page" style="display: none;">
  125 + <h2 class="uk-heading-line uk-heading-bullet"><span>工时统计</span></h2>
  126 + <div class="ct_cont" >
  127 + <div class="ct_search_form_wrap">
  128 + <form>
  129 + <div class="ct_field">
  130 + <label>公司:
  131 + <select class="uk-select" name="companyId_eq">
  132 + </select>
  133 + </label>
  134 + </div>
  135 + <div class="ct_field">
  136 + <label>分公司:
  137 + <select class="uk-select" name="subCompanyId_eq">
  138 + </select>
  139 + </label>
  140 + </div>
  141 + <div class="ct_field">
  142 + <label>线路:
  143 + <select class="uk-select" name="lineCode_eq">
  144 + <option value="81101">航头4路</option>
  145 + </select>
  146 + </label>
  147 + </div>
  148 + <div class="ct_field">
  149 + <label>日期:
  150 + <input class="uk-input" name="rq_eq" >
  151 + </label>
  152 + </div>
  153 + <div class="ct_field">
  154 + <label>驾驶员:
  155 + <input class="uk-input" name="jsy_eq" placeholder="工号">
  156 + </label>
  157 + </div>
  158 + <div class="ct_field">
  159 + <label>车辆:
  160 + <input class="uk-input" name="nbbm_eq" >
  161 + </label>
  162 + </div>
  163 + <div class="ct_field">
  164 + <button class="uk-button uk-button-primary search"><i uk-icon="icon: search"></i>搜索</button>
  165 + <span id="add_hours_icon" uk-icon="icon: plus" style="vertical-align: bottom;margin-left: 5px;" title="录入工休和非营运工时" uk-tooltip></span>
  166 + </div>
  167 + </form>
  168 + </div>
  169 + <div class="ct_table_wrap day">
  170 + <table class="uk-table uk-table-small" style="margin-bottom: 0;">
  171 + <thead>
  172 + <tr>
  173 + <th>日期</th>
  174 + <th>公司</th>
  175 + <th>分公司</th>
  176 + <th>线路</th>
  177 + <th>路牌</th>
  178 + <th>驾驶员</th>
  179 + <th>车辆</th>
  180 + <th>计划工时 &nbsp;<i uk-icon="icon: question; ratio:.7" title="格式:小时.分钟" uk-tooltip></i ></th>
  181 + <th>实际工时</th>
  182 + <th>备注</th>
  183 + </tr>
  184 + </thead>
  185 + </table>
  186 + <div class="t_body_wrap">
  187 + <table class="uk-table uk-table-divider uk-table-hover uk-table-small ct_jsy_day_table">
  188 + <tbody>
  189 + </tbody>
  190 + </table>
  191 + </div>
  192 + </div>
  193 + </div>
  194 +</div>
  195 +
  196 +<!--<div id="hours_add_modal" uk-modal>
  197 + <div class="uk-modal-dialog uk-modal-body">
  198 + <button class="uk-modal-close-default" type="button" uk-close></button>
  199 + <h2 class="uk-modal-title">Default</h2>
  200 + <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
  201 + </div>
  202 +</div>-->
  203 +
  204 +<script id="hours_jsy_day_list_temp" type="text/html">
  205 + {{each list as obj i}}
  206 + <tr>
  207 + <td>{{obj.rq}}</td>
  208 + <td>{{obj.companyName}}</td>
  209 + <td>{{obj.subCompanyName}}</td>
  210 + <td>{{obj.lineName}}</td>
  211 + <td>{{obj.lpName}}</td>
  212 + <td>{{obj.jsy}}/{{obj.jsyName}}</td>
  213 + <td>{{obj.nbbm}}</td>
  214 + <td>{{obj.hoursJhStr}}</td>
  215 + <td>{{obj.hoursSjStr}}</td>
  216 + <td>{{obj.remarks}}</td>
  217 + </tr>
  218 + {{/each}}
  219 +</script>
  220 +
  221 +<script src="/metronic_v4.5.4/plugins/jquery.min.js"></script>
  222 +<script src="/assets/plugins/uk3.0/uikit.min.js"></script>
  223 +<script src="/assets/plugins/uk3.0/uikit-icons.min.js"></script>
  224 +<script src="/real_control_v2/assets/plugins/perfect-scrollbar/perfect-scrollbar.jquery.js" ></script>
  225 +<!-- EventProxy -->
  226 +<script src="/assets/js/eventproxy.js"></script>
  227 +<!-- art-template 模版引擎 -->
  228 +<script src="/assets/plugins/template.js"></script>
  229 +<script src="/real_control_v2/assets/plugins/moment/moment.min.js"></script>
  230 +<!-- jquery.serializejson JSON序列化插件 -->
  231 +<script src="/assets/plugins/jquery.serializejson.js" merge="plugins"></script>
  232 +<!-- flatpickr -->
  233 +<script src="/real_control_v2/assets/plugins/flatpickr/flatpickr.min.js" ></script>
  234 +<script src="/real_control_v2/assets/plugins/flatpickr/l10n/zh.js" ></script>
  235 +<script>
  236 +
  237 + var f = $('form', '');
  238 + var page=0, pageSize=120;
  239 +
  240 + var ep = EventProxy.create('query_comps', 'query_lines', function () {
  241 + $('[name=companyId_eq]', f).trigger('change');//公司change
  242 + query();
  243 +
  244 + $('.loading').remove();
  245 + $('.ct_page').show();
  246 + });
  247 +
  248 + //点击搜索
  249 + $('button.search', f).on('click', query);
  250 +
  251 + function query() {
  252 + var data = f.serializeJSON();
  253 + data.page = page;
  254 + data.size = pageSize;
  255 +
  256 + $.get('/summary/hours', data, function (rs) {
  257 + //console.log('data', rs);
  258 + var htmlStr = template('hours_jsy_day_list_temp', {list: rs.content});
  259 + $('.ct_jsy_day_table tbody').html(htmlStr);
  260 +
  261 + $('.t_body_wrap').perfectScrollbar('update');
  262 + });
  263 + }
  264 +
  265 + //日期选择器
  266 + $('[name=rq_eq]', f).val('2017-07-25');
  267 + flatpickr('.ct_search_form_wrap [name=rq_eq]', {"locale": "zh", maxDate: '2017-07-25', minDate: '2017-07-01'});
  268 +
  269 + var comps;
  270 + //构建公司级联下拉框
  271 + $.get('/user/companyData', function (rs) {
  272 + comps = rs;
  273 + var opts = '';
  274 + for(var i=0,obj;obj=comps[i++];){
  275 + opts += '<option value="'+obj.companyCode+'">'+obj.companyName+'</option>';
  276 + }
  277 + $('[name=companyId_eq]', f).html(opts);
  278 + ep.emit('query_comps');
  279 + });
  280 +
  281 + var lineMapps;
  282 + //加载线路信息
  283 + $.get('/line/all', {'destroy_eq': 0}, function (rs) {
  284 + rs.sort(function (a, b) {
  285 + return a.name.localeCompare(b.name);
  286 + });
  287 + lineMapps={};
  288 + var k;
  289 + $.each(rs, function () {
  290 + k = this.company+'_'+this.brancheCompany;
  291 + if(!lineMapps[k])
  292 + lineMapps[k]=[];
  293 + lineMapps[k].push(this);
  294 + });
  295 +
  296 + ep.emit('query_lines');
  297 + });
  298 +
  299 + $('[name=companyId_eq]', f).on('change', function () {
  300 + var code = $(this).val(), subs=[];
  301 + $.each(comps, function () {
  302 + if(this.companyCode==code)
  303 + subs=this.children;
  304 + });
  305 +
  306 + var opts='';
  307 + $.each(subs, function () {
  308 + opts += '<option value="'+this.code+'">'+this.name+'</option>';
  309 + });
  310 + $('[name=subCompanyId_eq]', f).html(opts).trigger('change');
  311 + });
  312 +
  313 + $('[name=subCompanyId_eq]', f).on('change', function () {
  314 + var k = $('[name=companyId_eq]', f).val() + '_' + $(this).val();
  315 + var array = lineMapps[k];
  316 + var opts = '';
  317 + if(array){
  318 + $.each(array, function () {
  319 + opts += '<option value="'+this.lineCode+'">'+this.name+'</option>';
  320 + });
  321 + }
  322 + $('[name=lineCode_eq]', f).html(opts);
  323 + });
  324 +
  325 + //
  326 + //滚动条
  327 + $('.t_body_wrap').perfectScrollbar({suppressScrollX: true});
  328 +
  329 + $(document).on('submit', 'form', function () {
  330 + return false;
  331 + });
  332 +
  333 + $('#add_hours_icon').on('click', function () {
  334 + UIkit.notification('暂不开放!', 'danger');
  335 + });
  336 +</script>
  337 +</body>
338 </html> 338 </html>
339 \ No newline at end of file 339 \ No newline at end of file
src/main/resources/static/pages/summary/work_hours/main.html
1 -<!-- 工时统计 --> 1 +<!-- 工时统计 -->
2 <iframe src="/pages/summary/work_hours/list.html?origin=real_control_iframe" frameborder="0" style="height: 100%;width: 100%;"></iframe> 2 <iframe src="/pages/summary/work_hours/list.html?origin=real_control_iframe" frameborder="0" style="height: 100%;width: 100%;"></iframe>
3 \ No newline at end of file 3 \ No newline at end of file