Commit 1294cdc58b6a5e1663d77f8967462808a6f897bf

Authored by 潘钊
2 parents 84748939 cb37d576

Merge branch 'pudong' of http://222.66.0.204:8090/panzhaov5/bsth_control into pudong

Showing 28 changed files with 3850 additions and 149 deletions
src/main/java/com/bsth/controller/calc/CalcWaybillController.java
@@ -39,6 +39,9 @@ public class CalcWaybillController extends BaseController<CalcWaybill, Integer> @@ -39,6 +39,9 @@ public class CalcWaybillController extends BaseController<CalcWaybill, Integer>
39 } 39 }
40 40
41 Map<String, Object> m = new HashMap<String, Object>(); 41 Map<String, Object> m = new HashMap<String, Object>();
  42 + m.put("date", date);
  43 + m.put("line", line);
  44 + m.put("key", key);
42 try { 45 try {
43 46
44 m = calcWaybillService.generateNew(date, line); 47 m = calcWaybillService.generateNew(date, line);
@@ -53,7 +56,6 @@ public class CalcWaybillController extends BaseController&lt;CalcWaybill, Integer&gt; @@ -53,7 +56,6 @@ public class CalcWaybillController extends BaseController&lt;CalcWaybill, Integer&gt;
53 m.put("status", ResponseCode.ERROR); 56 m.put("status", ResponseCode.ERROR);
54 return m; 57 return m;
55 } 58 }
56 -  
57 return m; 59 return m;
58 } 60 }
59 61
@@ -101,6 +103,8 @@ public class CalcWaybillController extends BaseController&lt;CalcWaybill, Integer&gt; @@ -101,6 +103,8 @@ public class CalcWaybillController extends BaseController&lt;CalcWaybill, Integer&gt;
101 } 103 }
102 104
103 Map<String, Object> m = new HashMap<String, Object>(); 105 Map<String, Object> m = new HashMap<String, Object>();
  106 + m.put("date", date);
  107 + m.put("line", line);
104 try { 108 try {
105 109
106 m.put("status", calcWaybillService.calcDaily(date, line)); 110 m.put("status", calcWaybillService.calcDaily(date, line));
@@ -147,4 +151,130 @@ public class CalcWaybillController extends BaseController&lt;CalcWaybill, Integer&gt; @@ -147,4 +151,130 @@ public class CalcWaybillController extends BaseController&lt;CalcWaybill, Integer&gt;
147 return calcWaybillService.calcStatisticsDaily(gsdm,fgsdm,line,date,date2,xlName,type); 151 return calcWaybillService.calcStatisticsDaily(gsdm,fgsdm,line,date,date2,xlName,type);
148 } 152 }
149 153
  154 + @RequestMapping(value="/generateLineMileage")
  155 + public Map<String, Object> generateLineMileage(@RequestParam Map<String, Object> map) throws Exception{
  156 + Map<String, Object> m = new HashMap<String, Object>();
  157 + String date = "", line = "";
  158 + try {
  159 +
  160 + if(map.containsKey("date") && map.get("date")!=null){
  161 + date=map.get("date").toString().trim();
  162 + }
  163 + if(map.containsKey("line") && map.get("line")!=null){
  164 + line=map.get("line").toString().trim();
  165 + }
  166 +
  167 +
  168 + return calcWaybillService.calcLineMileage(date, line);
  169 +
  170 + } catch (Exception e) {
  171 + // TODO: handle exception
  172 + e.printStackTrace();
  173 + m.put("status", ResponseCode.ERROR);
  174 + m.put("date", date);
  175 + m.put("line", line);
  176 + return m;
  177 + }
  178 + }
  179 +
  180 + @RequestMapping(value="/generateBusMileage")
  181 + public Map<String, Object> generateBusMileage(@RequestParam Map<String, Object> map) throws Exception{
  182 + Map<String, Object> m = new HashMap<String, Object>();
  183 + String date = "", line = "";
  184 + try {
  185 +
  186 + if(map.containsKey("date") && map.get("date")!=null){
  187 + date=map.get("date").toString().trim();
  188 + }
  189 + if(map.containsKey("line") && map.get("line")!=null){
  190 + line=map.get("line").toString().trim();
  191 + }
  192 +
  193 +
  194 + return calcWaybillService.calcBusMileage(date, line);
  195 +
  196 + } catch (Exception e) {
  197 + // TODO: handle exception
  198 + e.printStackTrace();
  199 + m.put("status", ResponseCode.ERROR);
  200 + m.put("date", date);
  201 + m.put("line", line);
  202 + return m;
  203 + }
  204 + }
  205 +
  206 + @RequestMapping(value="/getLineMileage")
  207 + public List<Map<String, Object>> getLineMileage(@RequestParam Map<String, Object> map){
  208 + String gsdm="";
  209 + if(map.get("gsdm")!=null){
  210 + gsdm=map.get("gsdm").toString().trim();
  211 + }
  212 + String fgsdm="";
  213 + if(map.get("fgsdm")!=null){
  214 + fgsdm=map.get("fgsdm").toString().trim();
  215 + }
  216 + String line="";
  217 + if(map.get("line")!=null){
  218 + line=map.get("line").toString().trim();
  219 + }
  220 + String date="";
  221 + if(map.get("date")!=null){
  222 + date=map.get("date").toString().trim();
  223 + }
  224 + String date2="";
  225 + if(map.get("date2")!=null){
  226 + date2=map.get("date2").toString().trim();
  227 + }
  228 + String xlName="";
  229 + if(map.get("xlName")!=null){
  230 + xlName=map.get("xlName").toString().trim();
  231 + }
  232 + String zt="";
  233 + if(map.get("zt")!=null){
  234 + zt=map.get("zt").toString();
  235 + }
  236 + String by="";
  237 + if(map.get("by")!=null){
  238 + by=map.get("by").toString();
  239 + }
  240 + String type="";
  241 + if(map.get("type")!=null){
  242 + type=map.get("type").toString().trim();
  243 + }
  244 + return calcWaybillService.getLineMileage(gsdm, fgsdm, line, date, date2, xlName, zt, by, type);
  245 + }
  246 +
  247 + @RequestMapping(value="/getBusMileage")
  248 + public List<Map<String, Object>> getBusMileage(@RequestParam Map<String, Object> map){
  249 + String line="";
  250 + if(map.get("line")!=null){
  251 + line=map.get("line").toString().trim();
  252 + }
  253 + String date="";
  254 + if(map.get("date")!=null){
  255 + date=map.get("date").toString().trim();
  256 + }
  257 + String date2="";
  258 + if(map.get("date2")!=null){
  259 + date2=map.get("date2").toString().trim();
  260 + }
  261 + String xlName="";
  262 + if(map.get("xlName")!=null){
  263 + xlName=map.get("xlName").toString().trim();
  264 + }
  265 + String zt="";
  266 + if(map.get("zt")!=null){
  267 + zt=map.get("zt").toString();
  268 + }
  269 + String by="";
  270 + if(map.get("by")!=null){
  271 + by=map.get("by").toString();
  272 + }
  273 + String type="";
  274 + if(map.get("type")!=null){
  275 + type=map.get("type").toString().trim();
  276 + }
  277 + return calcWaybillService.getBusMileage(line, date, date2, xlName, zt, by, type);
  278 + }
  279 +
150 } 280 }
src/main/java/com/bsth/controller/schedule/core/TTInfoDetailController.java
@@ -8,6 +8,7 @@ import com.bsth.service.schedule.datatools.TTInfoDetailForEdit; @@ -8,6 +8,7 @@ import com.bsth.service.schedule.datatools.TTInfoDetailForEdit;
8 import com.bsth.service.schedule.datatools.TTinfoDetailDynamicData; 8 import com.bsth.service.schedule.datatools.TTinfoDetailDynamicData;
9 import com.bsth.service.schedule.timetable.ExcelFormatType; 9 import com.bsth.service.schedule.timetable.ExcelFormatType;
10 import com.bsth.service.schedule.utils.DataToolsFile; 10 import com.bsth.service.schedule.utils.DataToolsFile;
  11 +import com.bsth.service.schedule.utils.DataToolsFileType;
11 import org.springframework.beans.factory.annotation.Autowired; 12 import org.springframework.beans.factory.annotation.Autowired;
12 import org.springframework.web.bind.annotation.*; 13 import org.springframework.web.bind.annotation.*;
13 14
@@ -128,11 +129,19 @@ public class TTInfoDetailController extends BController&lt;TTInfoDetail, Long&gt; { @@ -128,11 +129,19 @@ public class TTInfoDetailController extends BController&lt;TTInfoDetail, Long&gt; {
128 } 129 }
129 130
130 131
131 - @RequestMapping(value = "/exportDTDFile", method = RequestMethod.POST) 132 + @RequestMapping(value = "/exportDTDFile/{type}", method = RequestMethod.POST)
132 public void exportFile( 133 public void exportFile(
133 - @RequestBody TTinfoDetailDynamicData.DTInfos dtInfos, 134 + @RequestBody TTinfoDetailDynamicData.DTInfos dtInfos, @PathVariable("type") String type,
134 HttpServletResponse response) throws Exception { 135 HttpServletResponse response) throws Exception {
135 - DataToolsFile dataToolsFile = ttInfoDetailService.exportDynamicTTinfo(dtInfos); 136 + DataToolsFile dataToolsFile = null;
  137 + if ("xls".equals(type)) {
  138 + dataToolsFile = ttInfoDetailService.exportDynamicTTinfo(dtInfos, DataToolsFileType.XLS);
  139 + } else if ("xlsx".equals(type)) {
  140 + dataToolsFile = ttInfoDetailService.exportDynamicTTinfo(dtInfos, DataToolsFileType.XLSX);
  141 + } else {
  142 + throw new Exception("未知的导出格式==>" + type);
  143 + }
  144 +
136 // 流输出导出文件 145 // 流输出导出文件
137 response.setHeader("content-type", "application/octet-stream"); 146 response.setHeader("content-type", "application/octet-stream");
138 response.setHeader("Content-Disposition", "attachment; filename=" + dataToolsFile.getFile().getName()); 147 response.setHeader("Content-Disposition", "attachment; filename=" + dataToolsFile.getFile().getName());
src/main/java/com/bsth/data/schedule/thread/SubmitToTrafficManage.java
@@ -25,36 +25,48 @@ public class SubmitToTrafficManage extends Thread{ @@ -25,36 +25,48 @@ public class SubmitToTrafficManage extends Thread{
25 @Override 25 @Override
26 public void run() { 26 public void run() {
27 logger.info("开始提交数据到运管处..."); 27 logger.info("开始提交数据到运管处...");
28 -  
29 - try {  
30 - //路单  
31 - trafficManageService.setLD();  
32 - } catch (Exception e) {  
33 - logger.error("提交路单到运管处失败", e); 28 + boolean isContinue = true;
  29 + // 上传路单,如果接口异常,会自动重传
  30 + while (isContinue){
  31 + try {
  32 + //路单
  33 + trafficManageService.setLD();
  34 + isContinue = false;
  35 + } catch (Exception e) {
  36 + logger.error("提交路单到运管处失败", e);
  37 + try {
  38 + // 如果出现异常,程序暂停60分钟后再重新执行
  39 + Thread.sleep(60 * 60 * 1000);
  40 + } catch (Exception ex) { }
  41 + }
34 } 42 }
35 - try {  
36 - //车辆里程、油耗  
37 - trafficManageService.setLCYH();  
38 - } catch (Exception e) {  
39 - logger.error("提交车辆里程、油耗到运管处失败", e);  
40 - }  
41 - try {  
42 - //线路调度日报  
43 - trafficManageService.setDDRB();  
44 - } catch (Exception e) {  
45 - logger.error("提交线路调度日报到运管处失败", e);  
46 - }  
47 - try {  
48 - //线路计划班次表  
49 - trafficManageService.setJHBC();  
50 - } catch (Exception e) {  
51 - logger.error("提交线路计划班次表到运管处失败", e);  
52 - }  
53 - try {  
54 - // 运管处基础数据更新  
55 - ygcBasicDataService.updateYgcBasicData();  
56 - } catch (Exception e) {  
57 - logger.error("运管处基础数据更新失败", e); 43 +
  44 + // 路单上传成功后,再上传其他数据
  45 + if(!isContinue){
  46 + try {
  47 + //车辆里程、油耗
  48 + trafficManageService.setLCYH();
  49 + } catch (Exception e) {
  50 + logger.error("提交车辆里程、油耗到运管处失败", e);
  51 + }
  52 + try {
  53 + //线路调度日报
  54 + trafficManageService.setDDRB();
  55 + } catch (Exception e) {
  56 + logger.error("提交线路调度日报到运管处失败", e);
  57 + }
  58 + try {
  59 + //线路计划班次表
  60 + trafficManageService.setJHBC();
  61 + } catch (Exception e) {
  62 + logger.error("提交线路计划班次表到运管处失败", e);
  63 + }
  64 + try {
  65 + // 运管处基础数据更新
  66 + ygcBasicDataService.updateYgcBasicData();
  67 + } catch (Exception e) {
  68 + logger.error("运管处基础数据更新失败", e);
  69 + }
58 } 70 }
59 logger.info("提交数据到运管处结束!"); 71 logger.info("提交数据到运管处结束!");
60 } 72 }
src/main/java/com/bsth/entity/calc/CalcBusMileage.java 0 → 100644
  1 +package com.bsth.entity.calc;
  2 +
  3 +import java.util.Date;
  4 +
  5 +import javax.persistence.Entity;
  6 +import javax.persistence.GeneratedValue;
  7 +import javax.persistence.Id;
  8 +import javax.persistence.Table;
  9 +
  10 +@Entity
  11 +@Table(name = "calc_bus_mileage")
  12 +public class CalcBusMileage {
  13 + /* 主键*/
  14 + @Id
  15 + @GeneratedValue
  16 + private Long id;
  17 + /* 日期*/
  18 + private Date date;
  19 + /* 日期字符串*/
  20 + private String dateStr;
  21 + /* 线路编码*/
  22 + private String xl;
  23 + /* 线路名称*/
  24 + private String xlName;
  25 + /* 公司代码*/
  26 + private String gsdm;
  27 + /* 公司名称*/
  28 + private String gsName;
  29 + /* 分公司代码*/
  30 + private String fgsdm;
  31 + /* 分公司名称*/
  32 + private String fgsName;
  33 + /* 车号*/
  34 + private String nbbm;
  35 + /* 司机职号*/
  36 + private String jGh;
  37 + /* 司机姓名*/
  38 + private String jName;
  39 + /* 售票员职号*/
  40 + private String sGh;
  41 + /* 售票员姓名*/
  42 + private String sName;
  43 + /* 行驶里程(包括空放)*/
  44 + private Double zlc;
  45 + /* 计划内营运里程*/
  46 + private Double jhnlc;
  47 + /* 临时性多样化调度营运里程*/
  48 + private Double jhwlc;
  49 + /* 计划内进出场空驶*/
  50 + private Double jhnjcclc;
  51 + /* 计划外进出场空驶*/
  52 + private Double jhwjcclc;
  53 + /* 计划外进出场空驶_*/
  54 + private Double jhwjcclcz;
  55 + /* 空放空驶*/
  56 + private Double kfks;
  57 + /* 故障进出场空驶*/
  58 + private Double zrwjcclc;
  59 + /* 肇事进出场空驶*/
  60 + private Double zrwjcclc1;
  61 + /* 纠纷进出场空驶*/
  62 + private Double zrwjcclc2;
  63 + /* 其他进出场空驶*/
  64 + private Double zrwjcclcqt;
  65 + /* 临加营运公里*/
  66 + private Double ljyy;
  67 + /* 临加进出场空驶*/
  68 + private Double ljjcc;
  69 + /* 临加空放空驶*/
  70 + private Double ljkfks;
  71 + /* 电耗量*/
  72 + private Double dhl;
  73 + /* 加电量*/
  74 + private Double cdl;
  75 + /* 耗油量*/
  76 + private Double yhl;
  77 + /* 加注量*/
  78 + private Double jzl;
  79 + /* 非营业用油*/
  80 + private Double hyl;
  81 + /* 计划总公里*/
  82 + private Double jhzlc;
  83 + /* 备注*/
  84 + private String remark;
  85 + /* 创建时间*/
  86 + private Date createDate;
  87 +
  88 + public Long getId() {
  89 + return id;
  90 + }
  91 + public void setId(Long id) {
  92 + this.id = id;
  93 + }
  94 + public Date getDate() {
  95 + return date;
  96 + }
  97 + public void setDate(Date date) {
  98 + this.date = date;
  99 + }
  100 + public String getDateStr() {
  101 + return dateStr;
  102 + }
  103 + public void setDateStr(String dateStr) {
  104 + this.dateStr = dateStr;
  105 + }
  106 + public String getXl() {
  107 + return xl;
  108 + }
  109 + public void setXl(String xl) {
  110 + this.xl = xl;
  111 + }
  112 + public String getXlName() {
  113 + return xlName;
  114 + }
  115 + public void setXlName(String xlName) {
  116 + this.xlName = xlName;
  117 + }
  118 + public String getGsdm() {
  119 + return gsdm;
  120 + }
  121 + public void setGsdm(String gsdm) {
  122 + this.gsdm = gsdm;
  123 + }
  124 + public String getGsName() {
  125 + return gsName;
  126 + }
  127 + public void setGsName(String gsName) {
  128 + this.gsName = gsName;
  129 + }
  130 + public String getFgsdm() {
  131 + return fgsdm;
  132 + }
  133 + public void setFgsdm(String fgsdm) {
  134 + this.fgsdm = fgsdm;
  135 + }
  136 + public String getFgsName() {
  137 + return fgsName;
  138 + }
  139 + public void setFgsName(String fgsName) {
  140 + this.fgsName = fgsName;
  141 + }
  142 + public String getNbbm() {
  143 + return nbbm;
  144 + }
  145 + public void setNbbm(String nbbm) {
  146 + this.nbbm = nbbm;
  147 + }
  148 + public String getjGh() {
  149 + return jGh;
  150 + }
  151 + public void setjGh(String jGh) {
  152 + this.jGh = jGh;
  153 + }
  154 + public String getjName() {
  155 + return jName;
  156 + }
  157 + public void setjName(String jName) {
  158 + this.jName = jName;
  159 + }
  160 + public String getsGh() {
  161 + return sGh;
  162 + }
  163 + public void setsGh(String sGh) {
  164 + this.sGh = sGh;
  165 + }
  166 + public String getsName() {
  167 + return sName;
  168 + }
  169 + public void setsName(String sName) {
  170 + this.sName = sName;
  171 + }
  172 + public Double getZlc() {
  173 + return zlc;
  174 + }
  175 + public void setZlc(Double zlc) {
  176 + this.zlc = zlc;
  177 + }
  178 + public Double getJhnlc() {
  179 + return jhnlc;
  180 + }
  181 + public void setJhnlc(Double jhnlc) {
  182 + this.jhnlc = jhnlc;
  183 + }
  184 + public Double getJhwlc() {
  185 + return jhwlc;
  186 + }
  187 + public void setJhwlc(Double jhwlc) {
  188 + this.jhwlc = jhwlc;
  189 + }
  190 + public Double getJhnjcclc() {
  191 + return jhnjcclc;
  192 + }
  193 + public void setJhnjcclc(Double jhnjcclc) {
  194 + this.jhnjcclc = jhnjcclc;
  195 + }
  196 + public Double getJhwjcclc() {
  197 + return jhwjcclc;
  198 + }
  199 + public void setJhwjcclc(Double jhwjcclc) {
  200 + this.jhwjcclc = jhwjcclc;
  201 + }
  202 + public Double getJhwjcclcz() {
  203 + return jhwjcclcz;
  204 + }
  205 + public void setJhwjcclcz(Double jhwjcclcz) {
  206 + this.jhwjcclcz = jhwjcclcz;
  207 + }
  208 + public Double getKfks() {
  209 + return kfks;
  210 + }
  211 + public void setKfks(Double kfks) {
  212 + this.kfks = kfks;
  213 + }
  214 + public Double getZrwjcclc() {
  215 + return zrwjcclc;
  216 + }
  217 + public void setZrwjcclc(Double zrwjcclc) {
  218 + this.zrwjcclc = zrwjcclc;
  219 + }
  220 + public Double getZrwjcclc1() {
  221 + return zrwjcclc1;
  222 + }
  223 + public void setZrwjcclc1(Double zrwjcclc1) {
  224 + this.zrwjcclc1 = zrwjcclc1;
  225 + }
  226 + public Double getZrwjcclc2() {
  227 + return zrwjcclc2;
  228 + }
  229 + public void setZrwjcclc2(Double zrwjcclc2) {
  230 + this.zrwjcclc2 = zrwjcclc2;
  231 + }
  232 + public Double getZrwjcclcqt() {
  233 + return zrwjcclcqt;
  234 + }
  235 + public void setZrwjcclcqt(Double zrwjcclcqt) {
  236 + this.zrwjcclcqt = zrwjcclcqt;
  237 + }
  238 + public Double getLjyy() {
  239 + return ljyy;
  240 + }
  241 + public void setLjyy(Double ljyy) {
  242 + this.ljyy = ljyy;
  243 + }
  244 + public Double getLjjcc() {
  245 + return ljjcc;
  246 + }
  247 + public void setLjjcc(Double ljjcc) {
  248 + this.ljjcc = ljjcc;
  249 + }
  250 + public Double getLjkfks() {
  251 + return ljkfks;
  252 + }
  253 + public void setLjkfks(Double ljkfks) {
  254 + this.ljkfks = ljkfks;
  255 + }
  256 + public Double getDhl() {
  257 + return dhl;
  258 + }
  259 + public void setDhl(Double dhl) {
  260 + this.dhl = dhl;
  261 + }
  262 + public Double getCdl() {
  263 + return cdl;
  264 + }
  265 + public void setCdl(Double cdl) {
  266 + this.cdl = cdl;
  267 + }
  268 + public Double getYhl() {
  269 + return yhl;
  270 + }
  271 + public void setYhl(Double yhl) {
  272 + this.yhl = yhl;
  273 + }
  274 + public Double getJzl() {
  275 + return jzl;
  276 + }
  277 + public void setJzl(Double jzl) {
  278 + this.jzl = jzl;
  279 + }
  280 + public Double getHyl() {
  281 + return hyl;
  282 + }
  283 + public void setHyl(Double hyl) {
  284 + this.hyl = hyl;
  285 + }
  286 + public Double getJhzlc() {
  287 + return jhzlc;
  288 + }
  289 + public void setJhzlc(Double jhzlc) {
  290 + this.jhzlc = jhzlc;
  291 + }
  292 + public String getRemark() {
  293 + return remark;
  294 + }
  295 + public void setRemark(String remark) {
  296 + this.remark = remark;
  297 + }
  298 + public Date getCreateDate() {
  299 + return createDate;
  300 + }
  301 + public void setCreateDate(Date createDate) {
  302 + this.createDate = createDate;
  303 + }
  304 +
  305 +}
src/main/java/com/bsth/entity/calc/CalcLineMileage.java 0 → 100644
  1 +package com.bsth.entity.calc;
  2 +
  3 +import java.util.Date;
  4 +
  5 +import javax.persistence.Entity;
  6 +import javax.persistence.GeneratedValue;
  7 +import javax.persistence.Id;
  8 +import javax.persistence.Table;
  9 +
  10 +@Entity
  11 +@Table(name = "calc_line_mileage")
  12 +public class CalcLineMileage {
  13 + /* 主键*/
  14 + @Id
  15 + @GeneratedValue
  16 + private Long id;
  17 + /* 日期*/
  18 + private Date date;
  19 + /* 日期字符串*/
  20 + private String dateStr;
  21 + /* 线路编码*/
  22 + private String xl;
  23 + /* 线路名称*/
  24 + private String xlName;
  25 + /* 公司代码*/
  26 + private String gsdm;
  27 + /* 公司名称*/
  28 + private String gsName;
  29 + /* 分公司代码*/
  30 + private String fgsdm;
  31 + /* 分公司名称*/
  32 + private String fgsName;
  33 + /* 计划总里程*/
  34 + private Double jhzlc;
  35 + /* 计划营运程*/
  36 + private Double jhlc;
  37 + /* 计划空驶程*/
  38 + private Double jcclc;
  39 + /* 实际总里程*/
  40 + private Double sjzgl;
  41 + /* 计划内里程*/
  42 + private Double jhnlc;
  43 + /* 计划外里程*/
  44 + private Double jhwlc;
  45 + /* 计划内进出场空驶*/
  46 + private Double jhnjcclc;
  47 + /* 计划外进出场空驶*/
  48 + private Double jhwjcclc;
  49 + /* 计划外进出场空驶_*/
  50 + private Double jhwjcclcz;
  51 + /* 故障进出场空驶*/
  52 + private Double zrwjcclc;
  53 + /* 肇事进出场空驶*/
  54 + private Double zrwjcclc1;
  55 + /* 纠纷进出场空驶*/
  56 + private Double zrwjcclc2;
  57 + /* 其他进出场空驶*/
  58 + private Double zrwjcclcqt;
  59 + /* 空放 空驶*/
  60 + private Double kfks;
  61 + /* 少驶营运里程*/
  62 + private Double lbss;
  63 + /* 少驶 路阻*/
  64 + private Double ssglLz;
  65 + /* 少驶 吊慢*/
  66 + private Double ssglDm;
  67 + /* 少驶 故障*/
  68 + private Double ssglGz;
  69 + /* 少驶 纠纷*/
  70 + private Double ssglJf;
  71 + /* 少驶 肇事*/
  72 + private Double ssglZs;
  73 + /* 少驶 缺人*/
  74 + private Double ssglQr;
  75 + /* 少驶 缺车*/
  76 + private Double ssglQc;
  77 + /* 少驶 客稀*/
  78 + private Double ssglKx;
  79 + /* 少驶 气候*/
  80 + private Double ssglQh;
  81 + /* 少驶 援外*/
  82 + private Double ssglYw;
  83 + /* 少驶 其他*/
  84 + private Double ssglOther;
  85 + /* 临加营运公里*/
  86 + private Double ljyy;
  87 + /* 临加进出场空驶*/
  88 + private Double ljjcc;
  89 + /* 临加空放空驶*/
  90 + private Double ljkfks;
  91 + /* 备注*/
  92 + private String remark;
  93 + /* 创建时间*/
  94 + private Date createDate;
  95 +
  96 + public Long getId() {
  97 + return id;
  98 + }
  99 + public void setId(Long id) {
  100 + this.id = id;
  101 + }
  102 + public Date getDate() {
  103 + return date;
  104 + }
  105 + public void setDate(Date date) {
  106 + this.date = date;
  107 + }
  108 + public String getDateStr() {
  109 + return dateStr;
  110 + }
  111 + public void setDateStr(String dateStr) {
  112 + this.dateStr = dateStr;
  113 + }
  114 + public String getXl() {
  115 + return xl;
  116 + }
  117 + public void setXl(String xl) {
  118 + this.xl = xl;
  119 + }
  120 + public String getXlName() {
  121 + return xlName;
  122 + }
  123 + public void setXlName(String xlName) {
  124 + this.xlName = xlName;
  125 + }
  126 + public String getGsdm() {
  127 + return gsdm;
  128 + }
  129 + public void setGsdm(String gsdm) {
  130 + this.gsdm = gsdm;
  131 + }
  132 + public String getGsName() {
  133 + return gsName;
  134 + }
  135 + public void setGsName(String gsName) {
  136 + this.gsName = gsName;
  137 + }
  138 + public String getFgsdm() {
  139 + return fgsdm;
  140 + }
  141 + public void setFgsdm(String fgsdm) {
  142 + this.fgsdm = fgsdm;
  143 + }
  144 + public String getFgsName() {
  145 + return fgsName;
  146 + }
  147 + public void setFgsName(String fgsName) {
  148 + this.fgsName = fgsName;
  149 + }
  150 + public Double getJhzlc() {
  151 + return jhzlc;
  152 + }
  153 + public void setJhzlc(Double jhzlc) {
  154 + this.jhzlc = jhzlc;
  155 + }
  156 + public Double getJhlc() {
  157 + return jhlc;
  158 + }
  159 + public void setJhlc(Double jhlc) {
  160 + this.jhlc = jhlc;
  161 + }
  162 + public Double getJcclc() {
  163 + return jcclc;
  164 + }
  165 + public void setJcclc(Double jcclc) {
  166 + this.jcclc = jcclc;
  167 + }
  168 + public Double getSjzgl() {
  169 + return sjzgl;
  170 + }
  171 + public void setSjzgl(Double sjzgl) {
  172 + this.sjzgl = sjzgl;
  173 + }
  174 + public Double getJhnlc() {
  175 + return jhnlc;
  176 + }
  177 + public void setJhnlc(Double jhnlc) {
  178 + this.jhnlc = jhnlc;
  179 + }
  180 + public Double getJhwlc() {
  181 + return jhwlc;
  182 + }
  183 + public void setJhwlc(Double jhwlc) {
  184 + this.jhwlc = jhwlc;
  185 + }
  186 + public Double getJhnjcclc() {
  187 + return jhnjcclc;
  188 + }
  189 + public void setJhnjcclc(Double jhnjcclc) {
  190 + this.jhnjcclc = jhnjcclc;
  191 + }
  192 + public Double getJhwjcclc() {
  193 + return jhwjcclc;
  194 + }
  195 + public void setJhwjcclc(Double jhwjcclc) {
  196 + this.jhwjcclc = jhwjcclc;
  197 + }
  198 + public Double getJhwjcclcz() {
  199 + return jhwjcclcz;
  200 + }
  201 + public void setJhwjcclcz(Double jhwjcclcz) {
  202 + this.jhwjcclcz = jhwjcclcz;
  203 + }
  204 + public Double getZrwjcclc() {
  205 + return zrwjcclc;
  206 + }
  207 + public void setZrwjcclc(Double zrwjcclc) {
  208 + this.zrwjcclc = zrwjcclc;
  209 + }
  210 + public Double getZrwjcclc1() {
  211 + return zrwjcclc1;
  212 + }
  213 + public void setZrwjcclc1(Double zrwjcclc1) {
  214 + this.zrwjcclc1 = zrwjcclc1;
  215 + }
  216 + public Double getZrwjcclc2() {
  217 + return zrwjcclc2;
  218 + }
  219 + public void setZrwjcclc2(Double zrwjcclc2) {
  220 + this.zrwjcclc2 = zrwjcclc2;
  221 + }
  222 + public Double getZrwjcclcqt() {
  223 + return zrwjcclcqt;
  224 + }
  225 + public void setZrwjcclcqt(Double zrwjcclcqt) {
  226 + this.zrwjcclcqt = zrwjcclcqt;
  227 + }
  228 + public Double getKfks() {
  229 + return kfks;
  230 + }
  231 + public void setKfks(Double kfks) {
  232 + this.kfks = kfks;
  233 + }
  234 + public Double getLbss() {
  235 + return lbss;
  236 + }
  237 + public void setLbss(Double lbss) {
  238 + this.lbss = lbss;
  239 + }
  240 + public Double getSsglLz() {
  241 + return ssglLz;
  242 + }
  243 + public void setSsglLz(Double ssglLz) {
  244 + this.ssglLz = ssglLz;
  245 + }
  246 + public Double getSsglDm() {
  247 + return ssglDm;
  248 + }
  249 + public void setSsglDm(Double ssglDm) {
  250 + this.ssglDm = ssglDm;
  251 + }
  252 + public Double getSsglGz() {
  253 + return ssglGz;
  254 + }
  255 + public void setSsglGz(Double ssglGz) {
  256 + this.ssglGz = ssglGz;
  257 + }
  258 + public Double getSsglJf() {
  259 + return ssglJf;
  260 + }
  261 + public void setSsglJf(Double ssglJf) {
  262 + this.ssglJf = ssglJf;
  263 + }
  264 + public Double getSsglZs() {
  265 + return ssglZs;
  266 + }
  267 + public void setSsglZs(Double ssglZs) {
  268 + this.ssglZs = ssglZs;
  269 + }
  270 + public Double getSsglQr() {
  271 + return ssglQr;
  272 + }
  273 + public void setSsglQr(Double ssglQr) {
  274 + this.ssglQr = ssglQr;
  275 + }
  276 + public Double getSsglQc() {
  277 + return ssglQc;
  278 + }
  279 + public void setSsglQc(Double ssglQc) {
  280 + this.ssglQc = ssglQc;
  281 + }
  282 + public Double getSsglKx() {
  283 + return ssglKx;
  284 + }
  285 + public void setSsglKx(Double ssglKx) {
  286 + this.ssglKx = ssglKx;
  287 + }
  288 + public Double getSsglQh() {
  289 + return ssglQh;
  290 + }
  291 + public void setSsglQh(Double ssglQh) {
  292 + this.ssglQh = ssglQh;
  293 + }
  294 + public Double getSsglYw() {
  295 + return ssglYw;
  296 + }
  297 + public void setSsglYw(Double ssglYw) {
  298 + this.ssglYw = ssglYw;
  299 + }
  300 + public Double getSsglOther() {
  301 + return ssglOther;
  302 + }
  303 + public void setSsglOther(Double ssglOther) {
  304 + this.ssglOther = ssglOther;
  305 + }
  306 + public Double getLjyy() {
  307 + return ljyy;
  308 + }
  309 + public void setLjyy(Double ljyy) {
  310 + this.ljyy = ljyy;
  311 + }
  312 + public Double getLjjcc() {
  313 + return ljjcc;
  314 + }
  315 + public void setLjjcc(Double ljjcc) {
  316 + this.ljjcc = ljjcc;
  317 + }
  318 + public Double getLjkfks() {
  319 + return ljkfks;
  320 + }
  321 + public void setLjkfks(Double ljkfks) {
  322 + this.ljkfks = ljkfks;
  323 + }
  324 + public String getRemark() {
  325 + return remark;
  326 + }
  327 + public void setRemark(String remark) {
  328 + this.remark = remark;
  329 + }
  330 + public Date getCreateDate() {
  331 + return createDate;
  332 + }
  333 + public void setCreateDate(Date createDate) {
  334 + this.createDate = createDate;
  335 + }
  336 +
  337 +}
src/main/java/com/bsth/repository/calc/CalcBusMileageRepository.java 0 → 100644
  1 +package com.bsth.repository.calc;
  2 +
  3 +import java.util.List;
  4 +
  5 +import javax.transaction.Transactional;
  6 +
  7 +import com.bsth.entity.calc.CalcBusMileage;
  8 +import com.bsth.repository.BaseRepository;
  9 +
  10 +import org.springframework.data.jpa.repository.Modifying;
  11 +import org.springframework.data.jpa.repository.Query;
  12 +import org.springframework.stereotype.Repository;
  13 +
  14 +/**
  15 + *
  16 + */
  17 +@Repository
  18 +public interface CalcBusMileageRepository extends BaseRepository<CalcBusMileage, Integer>{
  19 +
  20 + //按照时间段统计,公司下线路
  21 + @Query(value="select DISTINCT c from CalcBusMileage c where c.xl like %?1% and c.dateStr between ?2 and ?3 and c.gsdm like %?4% and c.fgsdm like %?5% order by c.id")
  22 + List<CalcBusMileage> selectByDateAndLineTj(String line,String date,String date2,String gsdm,String fgsdm);
  23 +
  24 + //按照时间段统计,单条线路
  25 + @Query(value="select DISTINCT c from CalcBusMileage c where c.xl = ?1 and c.dateStr between ?2 and ?3 order by c.id")
  26 + List<CalcBusMileage> selectByDateAndLineTj2(String line,String date,String date2);
  27 +
  28 + //按照日期和线路删除数据
  29 + @Modifying
  30 + @Transactional
  31 + @Query(value = "delete CalcBusMileage c where c.dateStr=?1 and c.xl=?2")
  32 + void deleteByDateAndLine(String date, String line);
  33 +
  34 + //按照日期删除数据
  35 + @Modifying
  36 + @Transactional
  37 + @Query(value = "delete CalcBusMileage c where c.dateStr=?1")
  38 + void deleteByDate(String date);
  39 +
  40 +}
src/main/java/com/bsth/repository/calc/CalcLineMileageRepository.java 0 → 100644
  1 +package com.bsth.repository.calc;
  2 +
  3 +import java.util.List;
  4 +
  5 +import javax.transaction.Transactional;
  6 +
  7 +import com.bsth.entity.calc.CalcLineMileage;
  8 +import com.bsth.repository.BaseRepository;
  9 +
  10 +import org.springframework.data.jpa.repository.Modifying;
  11 +import org.springframework.data.jpa.repository.Query;
  12 +import org.springframework.stereotype.Repository;
  13 +
  14 +/**
  15 + *
  16 + */
  17 +@Repository
  18 +public interface CalcLineMileageRepository extends BaseRepository<CalcLineMileage, Integer>{
  19 +
  20 + //按照时间段统计,公司下线路
  21 + @Query(value="select DISTINCT c from CalcLineMileage c where c.xl like %?1% and c.dateStr between ?2 and ?3 and c.gsdm like %?4% and c.fgsdm like %?5% order by c.id")
  22 + List<CalcLineMileage> selectByDateAndLineTj(String line,String date,String date2,String gsdm,String fgsdm);
  23 +
  24 + //按照时间段统计,单条线路
  25 + @Query(value="select DISTINCT c from CalcLineMileage c where c.xl = ?1 and c.dateStr between ?2 and ?3 order by c.id")
  26 + List<CalcLineMileage> selectByDateAndLineTj2(String line,String date,String date2);
  27 +
  28 + //按照日期和线路删除数据
  29 + @Modifying
  30 + @Transactional
  31 + @Query(value = "delete CalcLineMileage c where c.dateStr=?1 and c.xl=?2")
  32 + void deleteByDateAndLine(String date, String line);
  33 +
  34 + //按照日期删除数据
  35 + @Modifying
  36 + @Transactional
  37 + @Query(value = "delete CalcLineMileage c where c.dateStr=?1")
  38 + void deleteByDate(String date);
  39 +
  40 +}
src/main/java/com/bsth/service/calc/CalcWaybillService.java
@@ -3,6 +3,8 @@ package com.bsth.service.calc; @@ -3,6 +3,8 @@ package com.bsth.service.calc;
3 import java.util.List; 3 import java.util.List;
4 import java.util.Map; 4 import java.util.Map;
5 5
  6 +import com.bsth.entity.calc.CalcBusMileage;
  7 +import com.bsth.entity.calc.CalcLineMileage;
6 import com.bsth.entity.calc.CalcStatistics; 8 import com.bsth.entity.calc.CalcStatistics;
7 import com.bsth.entity.calc.CalcWaybill; 9 import com.bsth.entity.calc.CalcWaybill;
8 import com.bsth.service.BaseService; 10 import com.bsth.service.BaseService;
@@ -13,7 +15,7 @@ import com.bsth.service.BaseService; @@ -13,7 +15,7 @@ import com.bsth.service.BaseService;
13 public interface CalcWaybillService extends BaseService<CalcWaybill, Integer> { 15 public interface CalcWaybillService extends BaseService<CalcWaybill, Integer> {
14 16
15 /** 17 /**
16 - * @param date 格式如:2018-03-30(留空""默认当前日期两天前 18 + * @param date 格式如:2018-03-30(留空""默认当前日期前第四天
17 * @param line (留空""默认全部线路) 19 * @param line (留空""默认全部线路)
18 */ 20 */
19 Map<String, Object> autoGenerate(String date, String line) throws Exception; 21 Map<String, Object> autoGenerate(String date, String line) throws Exception;
@@ -23,10 +25,19 @@ public interface CalcWaybillService extends BaseService&lt;CalcWaybill, Integer&gt; { @@ -23,10 +25,19 @@ public interface CalcWaybillService extends BaseService&lt;CalcWaybill, Integer&gt; {
23 List<Map<String, Object>> statisticsDailyTj(String gsdm,String fgsdm, String line, String date, String date2, String xlName, String type); 25 List<Map<String, Object>> statisticsDailyTj(String gsdm,String fgsdm, String line, String date, String date2, String xlName, String type);
24 26
25 /** 27 /**
26 - * @param rq 格式如:2018-03-22(留空""默认当前日期前天) 28 + * @param rq 格式如:2018-03-22(留空""默认当前日期前天)
27 * @param line (留空""默认全部线路) 29 * @param line (留空""默认全部线路)
28 */ 30 */
29 String calcDaily(String rq, String line) throws Exception; 31 String calcDaily(String rq, String line) throws Exception;
30 32
31 List<CalcStatistics> calcStatisticsDaily(String gsdm,String fgsdm, String line, String date, String date2, String xlName, String type); 33 List<CalcStatistics> calcStatisticsDaily(String gsdm,String fgsdm, String line, String date, String date2, String xlName, String type);
  34 +
  35 + Map<String, Object> calcLineMileage(String date, String line);
  36 +
  37 + Map<String, Object> calcBusMileage(String date, String line);
  38 +
  39 + List<Map<String, Object>> getLineMileage(String gsdm, String fgsdm, String line, String date, String date2, String xlName, String zt, String by, String type);
  40 +
  41 + List<Map<String, Object>> getBusMileage(String line, String date, String date2, String xlName, String zt, String by, String type);
  42 +
32 } 43 }
src/main/java/com/bsth/service/calc/impl/CalcWaybillServiceImpl.java
@@ -18,13 +18,19 @@ import java.util.Set; @@ -18,13 +18,19 @@ import java.util.Set;
18 import javax.transaction.Transactional; 18 import javax.transaction.Transactional;
19 19
20 import com.bsth.common.ResponseCode; 20 import com.bsth.common.ResponseCode;
  21 +import com.bsth.entity.Line;
  22 +import com.bsth.entity.calc.CalcBusMileage;
21 import com.bsth.entity.calc.CalcInterval; 23 import com.bsth.entity.calc.CalcInterval;
  24 +import com.bsth.entity.calc.CalcLineMileage;
22 import com.bsth.entity.calc.CalcStatistics; 25 import com.bsth.entity.calc.CalcStatistics;
23 import com.bsth.entity.calc.CalcWaybill; 26 import com.bsth.entity.calc.CalcWaybill;
24 import com.bsth.entity.realcontrol.ChildTaskPlan; 27 import com.bsth.entity.realcontrol.ChildTaskPlan;
25 import com.bsth.entity.realcontrol.ScheduleRealInfo; 28 import com.bsth.entity.realcontrol.ScheduleRealInfo;
26 import com.bsth.entity.sys.Interval; 29 import com.bsth.entity.sys.Interval;
  30 +import com.bsth.repository.LineRepository;
  31 +import com.bsth.repository.calc.CalcBusMileageRepository;
27 import com.bsth.repository.calc.CalcIntervalRepository; 32 import com.bsth.repository.calc.CalcIntervalRepository;
  33 +import com.bsth.repository.calc.CalcLineMileageRepository;
28 import com.bsth.repository.calc.CalcStatisticsRepository; 34 import com.bsth.repository.calc.CalcStatisticsRepository;
29 import com.bsth.repository.calc.CalcWaybillRepository; 35 import com.bsth.repository.calc.CalcWaybillRepository;
30 import com.bsth.repository.realcontrol.ScheduleRealInfoRepository; 36 import com.bsth.repository.realcontrol.ScheduleRealInfoRepository;
@@ -32,6 +38,7 @@ import com.bsth.service.calc.CalcToolService; @@ -32,6 +38,7 @@ import com.bsth.service.calc.CalcToolService;
32 import com.bsth.service.calc.CalcWaybillService; 38 import com.bsth.service.calc.CalcWaybillService;
33 import com.bsth.service.impl.BaseServiceImpl; 39 import com.bsth.service.impl.BaseServiceImpl;
34 import com.bsth.service.report.CulateMileageService; 40 import com.bsth.service.report.CulateMileageService;
  41 +import com.bsth.service.report.ReportService;
35 import com.bsth.util.Arith; 42 import com.bsth.util.Arith;
36 import com.bsth.util.BatchSaveUtils; 43 import com.bsth.util.BatchSaveUtils;
37 import com.bsth.util.ReportUtils; 44 import com.bsth.util.ReportUtils;
@@ -62,6 +69,12 @@ public class CalcWaybillServiceImpl extends BaseServiceImpl&lt;CalcWaybill, Integer @@ -62,6 +69,12 @@ public class CalcWaybillServiceImpl extends BaseServiceImpl&lt;CalcWaybill, Integer
62 private CalcStatisticsRepository calcStatisticsRepository; 69 private CalcStatisticsRepository calcStatisticsRepository;
63 70
64 @Autowired 71 @Autowired
  72 + private CalcLineMileageRepository calcLineMileageRepository;
  73 +
  74 + @Autowired
  75 + private CalcBusMileageRepository calcBusMileageRepository;
  76 +
  77 + @Autowired
65 private CalcToolService calcToolService; 78 private CalcToolService calcToolService;
66 79
67 @Autowired 80 @Autowired
@@ -69,7 +82,13 @@ public class CalcWaybillServiceImpl extends BaseServiceImpl&lt;CalcWaybill, Integer @@ -69,7 +82,13 @@ public class CalcWaybillServiceImpl extends BaseServiceImpl&lt;CalcWaybill, Integer
69 82
70 @Autowired 83 @Autowired
71 private ScheduleRealInfoRepository scheduleRealInfoRepository; 84 private ScheduleRealInfoRepository scheduleRealInfoRepository;
  85 +
  86 + @Autowired
  87 + private LineRepository lineRepository;
72 88
  89 + @Autowired
  90 + private ReportService reportService;
  91 +
73 @Autowired 92 @Autowired
74 JdbcTemplate jdbcTemplate; 93 JdbcTemplate jdbcTemplate;
75 94
@@ -83,20 +102,56 @@ public class CalcWaybillServiceImpl extends BaseServiceImpl&lt;CalcWaybill, Integer @@ -83,20 +102,56 @@ public class CalcWaybillServiceImpl extends BaseServiceImpl&lt;CalcWaybill, Integer
83 Date d = new Date(); 102 Date d = new Date();
84 d.setTime(d.getTime() - (4 * 1000 * 60 * 60 * 24)); 103 d.setTime(d.getTime() - (4 * 1000 * 60 * 60 * 24));
85 date = sdf.format(d); 104 date = sdf.format(d);
  105 + } else {
  106 + date = date.trim();
86 } 107 }
87 if(line == null || line.trim().length() == 0){ 108 if(line == null || line.trim().length() == 0){
88 line = ""; 109 line = "";
  110 + } else {
  111 + line = line.trim();
  112 + }
  113 +
  114 + Map<String, Object> m = new HashMap<String, Object>();
  115 + try {
  116 + Map<String, Object> generateNew = generateNew(date, line);
  117 + m.put("generateNew", generateNew);
  118 + } catch (Exception e) {
  119 + // TODO: handle exception
  120 + logger.info("重新统计保存失败!");
  121 + }
  122 + try {
  123 + Map<String, Object> calcLineMileage = calcLineMileage(date, line);
  124 + m.put("lineMileage", calcLineMileage);
  125 + } catch (Exception e) {
  126 + // TODO: handle exception
  127 + logger.info("线路公里审计保存失败!");
  128 + }
  129 + try {
  130 + Map<String, Object> calcBusMileage = calcBusMileage(date, line);
  131 + m.put("busMileage", calcBusMileage);
  132 + } catch (Exception e) {
  133 + // TODO: handle exception
  134 + logger.info("路单数据审计保存失败!");
89 } 135 }
90 - return generateNew(date, line); 136 +
  137 + return m;
91 } 138 }
92 139
93 @Transactional 140 @Transactional
94 @Override 141 @Override
95 public Map<String, Object> generateNew(String date, String line) throws Exception { 142 public Map<String, Object> generateNew(String date, String line) throws Exception {
96 Map<String, Object> newMap = new HashMap<String, Object>(); 143 Map<String, Object> newMap = new HashMap<String, Object>();
97 -  
98 try { 144 try {
99 - 145 + if(date == null){
  146 + date = "";
  147 + } else {
  148 + date = date.trim();
  149 + }
  150 + if(line == null){
  151 + line = "";
  152 + } else {
  153 + line = line.trim();
  154 + }
100 if(date.length() != 0 && line.length() != 0){ 155 if(date.length() != 0 && line.length() != 0){
101 calcRepository.deleteByDateAndLine(date, line); 156 calcRepository.deleteByDateAndLine(date, line);
102 calcIntervalRepository.deleteByDateAndLine(date, line); 157 calcIntervalRepository.deleteByDateAndLine(date, line);
@@ -414,6 +469,25 @@ public class CalcWaybillServiceImpl extends BaseServiceImpl&lt;CalcWaybill, Integer @@ -414,6 +469,25 @@ public class CalcWaybillServiceImpl extends BaseServiceImpl&lt;CalcWaybill, Integer
414 resList.add(m); 469 resList.add(m);
415 } 470 }
416 471
  472 + if (type != null && type.length() != 0 && type.equals("export")) {
  473 + SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"),
  474 + sdfSimple = new SimpleDateFormat("yyyyMMdd");
  475 + List<Iterator<?>> listI = new ArrayList<Iterator<?>>();
  476 + Map<String, Object> m = new HashMap<String, Object>();
  477 + m.put("date", date+"至"+date2);
  478 + ReportUtils ee = new ReportUtils();
  479 + try {
  480 + listI.add(resList.iterator());
  481 + String path = this.getClass().getResource("/").getPath() + "static/pages/forms/";
  482 + ee.excelReplace(listI, new Object[]{m}, path + "mould/statisticsDaily_.xls",
  483 + path + "export/统计日报" + sdfSimple.format(sdfMonth.parse(date)) + ".xls");
  484 + } catch (Exception e) {
  485 + // TODO: handle exception
  486 + //e.printStackTrace();
  487 + logger.info("" , e);
  488 + }
  489 + }
  490 +
417 return resList; 491 return resList;
418 } 492 }
419 493
@@ -448,11 +522,11 @@ public class CalcWaybillServiceImpl extends BaseServiceImpl&lt;CalcWaybill, Integer @@ -448,11 +522,11 @@ public class CalcWaybillServiceImpl extends BaseServiceImpl&lt;CalcWaybill, Integer
448 List<ScheduleRealInfo> list_s = new ArrayList<ScheduleRealInfo>(); 522 List<ScheduleRealInfo> list_s = new ArrayList<ScheduleRealInfo>();
449 List<ScheduleRealInfo> lists = new ArrayList<ScheduleRealInfo>(); 523 List<ScheduleRealInfo> lists = new ArrayList<ScheduleRealInfo>();
450 524
451 - String xlSql="select gs_bm, fgs_bm from bsth_c_s_sp_info_real where schedule_date_str = '"+rq+"'"; 525 + String gsSql="select gs_bm, fgs_bm from bsth_c_s_sp_info_real where schedule_date_str = '"+rq+"'";
452 if(line.trim().length() > 0) 526 if(line.trim().length() > 0)
453 - xlSql += " and xl_bm = '"+line+"'";  
454 - xlSql += " group by gs_bm, fgs_bm";  
455 - List<Map<String, String>> gsList=jdbcTemplate.query(xlSql, new RowMapper<Map<String, String>>() { 527 + gsSql += " and xl_bm = '"+line+"'";
  528 + gsSql += " group by gs_bm, fgs_bm";
  529 + List<Map<String, String>> gsList=jdbcTemplate.query(gsSql, new RowMapper<Map<String, String>>() {
456 @Override 530 @Override
457 public Map<String, String> mapRow(ResultSet arg0, int arg1) throws SQLException { 531 public Map<String, String> mapRow(ResultSet arg0, int arg1) throws SQLException {
458 Map<String, String> m = new HashMap<String, String>(); 532 Map<String, String> m = new HashMap<String, String>();
@@ -695,6 +769,25 @@ public class CalcWaybillServiceImpl extends BaseServiceImpl&lt;CalcWaybill, Integer @@ -695,6 +769,25 @@ public class CalcWaybillServiceImpl extends BaseServiceImpl&lt;CalcWaybill, Integer
695 resList.add(temp); 769 resList.add(temp);
696 } 770 }
697 771
  772 + if (type != null && type.length() != 0 && type.equals("export")) {
  773 + SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"),
  774 + sdfSimple = new SimpleDateFormat("yyyyMMdd");
  775 + List<Iterator<?>> listI = new ArrayList<Iterator<?>>();
  776 + Map<String, Object> m = new HashMap<String, Object>();
  777 + m.put("date", date+"至"+date2);
  778 + ReportUtils ee = new ReportUtils();
  779 + try {
  780 + listI.add(resList.iterator());
  781 + String path = this.getClass().getResource("/").getPath() + "static/pages/forms/";
  782 + ee.excelReplace(listI, new Object[]{m}, path + "mould/statisticsDaily_.xls",
  783 + path + "export/统计日报" + sdfSimple.format(sdfMonth.parse(date)) + ".xls");
  784 + } catch (Exception e) {
  785 + // TODO: handle exception
  786 + //e.printStackTrace();
  787 + logger.info("" , e);
  788 + }
  789 + }
  790 +
698 return resList; 791 return resList;
699 } 792 }
700 793
@@ -740,5 +833,554 @@ public class CalcWaybillServiceImpl extends BaseServiceImpl&lt;CalcWaybill, Integer @@ -740,5 +833,554 @@ public class CalcWaybillServiceImpl extends BaseServiceImpl&lt;CalcWaybill, Integer
740 s.setDjgsj(s.getDjgsj()>s_.getDjgsj()?s.getDjgsj():s_.getDjgsj()); 833 s.setDjgsj(s.getDjgsj()>s_.getDjgsj()?s.getDjgsj():s_.getDjgsj());
741 return s; 834 return s;
742 } 835 }
  836 +
  837 + @Transactional
  838 + @Override
  839 + public Map<String, Object> calcLineMileage(String date, String line) {
  840 + Map<String, Object> resMap = new HashMap<String, Object>();
  841 +
  842 + if(date.length() == 0){
  843 + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
  844 + Date d = new Date();
  845 + d.setTime(d.getTime() - 4 * 1000 * 60 * 60 * 24);
  846 + date = sdf.format(d);
  847 + }
  848 +
  849 + resMap.put("date", date);
  850 + resMap.put("line", line);
  851 + if(date == null || date.trim().length() == 0){
  852 + resMap.put("status", ResponseCode.ERROR);
  853 + resMap.put("remark", "日期不正确或为空");
  854 + return resMap;
  855 + } else {
  856 + date = date.trim();
  857 + }
  858 + if(line == null){
  859 + line = "";
  860 + } else {
  861 + line = line.trim();
  862 + }
  863 +
  864 + Map<String, Object> map = new HashMap<String, Object>();
  865 + List<CalcLineMileage> list = new ArrayList<CalcLineMileage>();
  866 + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
  867 + Date dateTime = new Date();
  868 +
  869 + try {
  870 +
  871 + String gsSql="select gs_bm, fgs_bm from bsth_c_s_sp_info_real where schedule_date_str = '"+date+"'";
  872 + if(line.trim().length() > 0)
  873 + gsSql += " and xl_bm = '"+line+"'";
  874 + gsSql += " group by gs_bm, fgs_bm";
  875 + List<Map<String, String>> gsList=jdbcTemplate.query(gsSql, new RowMapper<Map<String, String>>() {
  876 + @Override
  877 + public Map<String, String> mapRow(ResultSet arg0, int arg1) throws SQLException {
  878 + Map<String, String> m = new HashMap<String, String>();
  879 + m.put("gsdm", arg0.getString("gs_bm"));
  880 + m.put("fgsdm", arg0.getString("fgs_bm"));
  881 + return m;
  882 + }});
  883 +
  884 + map.put("date", date);
  885 + map.put("date2", date);
  886 + for(Map<String, String> tempMap : gsList){
  887 + map.put("gsdm", tempMap.get("gsdm").toString());
  888 + map.put("fgsdm", tempMap.get("fgsdm").toString());
  889 + List<Map<String, Object>> countByList = reportService.countByList(map);
  890 + for(Map<String, Object> m : countByList){
  891 + if(!m.containsKey("xlName") || m.get("xlName")==null
  892 + || m.get("xlName").toString().equals("合计"))
  893 + continue;
  894 + CalcLineMileage c = new CalcLineMileage();
  895 + c.setDate(sdf.parse(date));
  896 + c.setDateStr(date);
  897 + c.setGsdm(map.get("gsdm").toString());
  898 + c.setGsName(m.get("gs").toString());
  899 + c.setFgsdm(map.get("fgsdm").toString());
  900 + c.setFgsName(m.get("fgs").toString());
  901 + c.setXl(m.get("line").toString());
  902 + c.setXlName(m.get("xlName").toString());
  903 + c.setJhzlc(Double.valueOf(m.get("jhzlc").toString()));
  904 + c.setJhlc(Double.valueOf(m.get("jhlc").toString()));
  905 + c.setJcclc(Double.valueOf(m.get("jcclc").toString()));
  906 + c.setSjzgl(Double.valueOf(m.get("sjzgl").toString()));
  907 + c.setJhnlc(Double.valueOf(m.get("jhnlc").toString()));
  908 + c.setJhwlc(Double.valueOf(m.get("jhwlc").toString()));
  909 + c.setJhnjcclc(Double.valueOf(m.get("jhnjcclc").toString()));
  910 + c.setJhwjcclc(Double.valueOf(m.get("jhwjcclc").toString()));
  911 + c.setJhwjcclcz(Double.valueOf(m.get("jhwjcclc_z").toString()));
  912 + c.setZrwjcclc(Double.valueOf(m.get("zrwjcclc").toString()));
  913 + c.setZrwjcclc1(Double.valueOf(m.get("zrwjcclc1").toString()));
  914 + c.setZrwjcclc2(Double.valueOf(m.get("zrwjcclc2").toString()));
  915 + c.setZrwjcclcqt(Double.valueOf(m.get("zrwjcclcqt").toString()));
  916 + c.setKfks(Double.valueOf(m.get("kfks").toString()));
  917 + c.setLbss(Double.valueOf(m.get("lbss").toString()));
  918 + c.setSsglLz(Double.valueOf(m.get("ssgl_lz").toString()));
  919 + c.setSsglDm(Double.valueOf(m.get("ssgl_dm").toString()));
  920 + c.setSsglGz(Double.valueOf(m.get("ssgl_gz").toString()));
  921 + c.setSsglJf(Double.valueOf(m.get("ssgl_jf").toString()));
  922 + c.setSsglZs(Double.valueOf(m.get("ssgl_zs").toString()));
  923 + c.setSsglQr(Double.valueOf(m.get("ssgl_qr").toString()));
  924 + c.setSsglQc(Double.valueOf(m.get("ssgl_qc").toString()));
  925 + c.setSsglKx(Double.valueOf(m.get("ssgl_kx").toString()));
  926 + c.setSsglQh(Double.valueOf(m.get("ssgl_qh").toString()));
  927 + c.setSsglYw(Double.valueOf(m.get("ssgl_yw").toString()));
  928 + c.setSsglOther(Double.valueOf(m.get("ssgl_other").toString()));
  929 + c.setLjyy(Double.valueOf(m.get("ljyy").toString()));
  930 + c.setLjjcc(Double.valueOf(m.get("ljjcc").toString()));
  931 + c.setLjkfks(Double.valueOf(m.get("ljkfks").toString()));
  932 + c.setCreateDate(dateTime);
  933 + list.add(c);
  934 + }
  935 + }
  936 +
  937 + if(line.length() > 0){
  938 + calcLineMileageRepository.deleteByDateAndLine(date, line);
  939 + } else {
  940 + calcLineMileageRepository.deleteByDate(date);
  941 + }
  942 + calcLineMileageRepository.save(list);
  943 +
  944 + resMap.put("status", ResponseCode.SUCCESS);
  945 + } catch (Exception e) {
  946 + // TODO: handle exception
  947 + resMap.put("status", ResponseCode.ERROR);
  948 + logger.error("save erro.", e);
  949 + e.printStackTrace();
  950 + }
  951 + return resMap;
  952 + }
  953 +
  954 + @Transactional
  955 + @Override
  956 + public Map<String, Object> calcBusMileage(String date, String line) {
  957 + Map<String, Object> resMap = new HashMap<String, Object>();
  958 +
  959 + if(date.length() == 0){
  960 + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
  961 + Date d = new Date();
  962 + d.setTime(d.getTime() - 4 * 1000 * 60 * 60 * 24);
  963 + date = sdf.format(d);
  964 + }
  965 +
  966 + resMap.put("date", date);
  967 + resMap.put("line", line);
  968 + if(date == null || date.trim().length() == 0){
  969 + resMap.put("status", ResponseCode.ERROR);
  970 + resMap.put("remark", "日期不正确或为空");
  971 + return resMap;
  972 + } else {
  973 + date = date.trim();
  974 + }
  975 + if(line == null){
  976 + line = "";
  977 + } else {
  978 + line = line.trim();
  979 + }
  980 +
  981 + Map<String, Object> map = new HashMap<String, Object>();
  982 + Map<String, Object> xlmap = new HashMap<String, Object>();
  983 + List<CalcBusMileage> list = new ArrayList<CalcBusMileage>();
  984 + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
  985 + Date dateTime = new Date();
  986 +
  987 + try {
  988 +
  989 + String gsSql="select gs_bm, max(gs_name) gs_name, fgs_bm from bsth_c_s_sp_info_real"
  990 + + " where schedule_date_str = '"+date+"'";
  991 + if(line.trim().length() > 0)
  992 + gsSql += " and xl_bm = '"+line+"'";
  993 + gsSql += " group by gs_bm, fgs_bm";
  994 + List<Map<String, String>> gsList=jdbcTemplate.query(gsSql, new RowMapper<Map<String, String>>() {
  995 + @Override
  996 + public Map<String, String> mapRow(ResultSet arg0, int arg1) throws SQLException {
  997 + Map<String, String> m = new HashMap<String, String>();
  998 + m.put("gsdm", arg0.getString("gs_bm"));
  999 + m.put("gsName", arg0.getString("gs_name"));
  1000 + m.put("fgsdm", arg0.getString("fgs_bm"));
  1001 + return m;
  1002 + }});
  1003 +
  1004 + List<Line> xlList = lineRepository.findAllService();
  1005 + for(Line l : xlList){
  1006 + xlmap.put(l.getName(), l.getLineCode());
  1007 + }
  1008 +
  1009 + map.put("date", date);
  1010 + map.put("date2", date);
  1011 + map.put("zs", "js");
  1012 + for(Map<String, String> tempMap : gsList){
  1013 + map.put("gsdm", tempMap.get("gsdm").toString());
  1014 + map.put("fgsdm", tempMap.get("fgsdm").toString());
  1015 + List<Map<String, Object>> countByList = reportService.countByBusList(map);
  1016 + for(Map<String, Object> m : countByList){
  1017 + if(!m.containsKey("xlName") || m.get("xlName")==null
  1018 + || m.get("xlName").toString().equals("合计"))
  1019 + continue;
  1020 + CalcBusMileage c = new CalcBusMileage();
  1021 + c.setDate(sdf.parse(date));
  1022 + c.setDateStr(date);
  1023 + c.setGsdm(map.get("gsdm").toString());
  1024 + c.setGsName(tempMap.get("gsName").toString());
  1025 + c.setFgsdm(map.get("fgsdm").toString());
  1026 + c.setFgsName(m.get("fgs").toString());
  1027 + c.setXl(xlmap.get(m.get("xlName").toString()).toString());
  1028 + c.setXlName(m.get("xlName").toString());
  1029 + c.setNbbm(m.get("nbbm").toString());
  1030 + c.setjGh(m.get("jGh").toString());
  1031 + c.setjName(m.get("jName").toString());
  1032 + c.setsGh(m.get("sGh").toString());
  1033 + c.setsName(m.get("sName").toString());
  1034 + c.setZlc(Double.valueOf(m.get("zlc").toString()));
  1035 + c.setJhnlc(Double.valueOf(m.get("jhnlc").toString()));
  1036 + c.setJhwlc(Double.valueOf(m.get("jhwlc").toString()));
  1037 + c.setJhnjcclc(Double.valueOf(m.get("jhnjcclc").toString()));
  1038 + c.setJhwjcclc(Double.valueOf(m.get("jhwjcclc").toString()));
  1039 + c.setJhwjcclcz(Double.valueOf(m.get("jhwjcclc_z").toString()));
  1040 + c.setKfks(Double.valueOf(m.get("kfks").toString()));
  1041 + c.setZrwjcclc(Double.valueOf(m.get("zrwjcclc").toString()));
  1042 + c.setZrwjcclc1(Double.valueOf(m.get("zrwjcclc1").toString()));
  1043 + c.setZrwjcclc2(Double.valueOf(m.get("zrwjcclc2").toString()));
  1044 + c.setZrwjcclcqt(Double.valueOf(m.get("zrwjcclcqt").toString()));
  1045 + c.setLjyy(Double.valueOf(m.get("ljyy").toString()));
  1046 + c.setLjjcc(Double.valueOf(m.get("ljjcc").toString()));
  1047 + if(m.containsKey("ljkfks") && m.get("ljkfks") != null){
  1048 + c.setLjkfks(Double.valueOf(m.get("ljkfks").toString()));
  1049 + } else {
  1050 + c.setLjkfks(0d);
  1051 + }
  1052 + c.setDhl(Double.valueOf(m.get("dhl").toString()));
  1053 + c.setCdl(Double.valueOf(m.get("cdl").toString()));
  1054 + c.setYhl(Double.valueOf(m.get("yhl").toString()));
  1055 + c.setJzl(Double.valueOf(m.get("jzl").toString()));
  1056 + c.setHyl(Double.valueOf(m.get("hyl").toString()));
  1057 + c.setJhzlc(Double.valueOf(m.get("jhzlc").toString()));
  1058 + c.setCreateDate(dateTime);
  1059 + list.add(c);
  1060 + }
  1061 + }
  1062 +
  1063 + if(line.length() > 0){
  1064 + calcBusMileageRepository.deleteByDateAndLine(date, line);
  1065 + } else {
  1066 + calcBusMileageRepository.deleteByDate(date);
  1067 + }
  1068 + calcBusMileageRepository.save(list);
  1069 +
  1070 + resMap.put("status", ResponseCode.SUCCESS);
  1071 + } catch (Exception e) {
  1072 + // TODO: handle exception
  1073 + resMap.put("status", ResponseCode.ERROR);
  1074 + logger.error("save erro.", e);
  1075 + e.printStackTrace();
  1076 + }
  1077 + return resMap;
  1078 + }
  1079 +
  1080 + @Override
  1081 + public List<Map<String, Object>> getLineMileage(String gsdm, String fgsdm, String line,
  1082 + String date, String date2, String xlName, String zt, String by, String type) {
  1083 + List<Map<String, Object>> lMap = new ArrayList<Map<String, Object>>();
  1084 + List<CalcLineMileage> resList = new ArrayList<CalcLineMileage>();
  1085 + List<CalcLineMileage> list = new ArrayList<CalcLineMileage>();
  1086 + List<CalcLineMileage> calcs = new ArrayList<CalcLineMileage>();
  1087 + List<String> keyList = new ArrayList<String>();
  1088 + Map<String, List<CalcLineMileage>> keyMap = new HashMap<String, List<CalcLineMileage>>();
  1089 +
  1090 + if(line == null || line.trim().length() == 0){
  1091 + list = calcLineMileageRepository.selectByDateAndLineTj(line, date, date2, gsdm, fgsdm);
  1092 + } else {
  1093 + list = calcLineMileageRepository.selectByDateAndLineTj2(line, date, date2);
  1094 + }
  1095 +
  1096 + for(CalcLineMileage c : list){
  1097 + String key = c.getXlName();
  1098 + if(!keyMap.containsKey(key)){
  1099 + keyMap.put(key, new ArrayList<CalcLineMileage>());
  1100 + keyList.add(key);
  1101 + }
  1102 + keyMap.get(key).add(c);
  1103 + }
  1104 +
  1105 + for(String key : keyList){
  1106 + CalcLineMileage c1 = keyMap.get(key).get(0);
  1107 + for(int i = 1; i < keyMap.get(key).size(); i++){
  1108 + CalcLineMileage c2 = keyMap.get(key).get(i);
  1109 + c1 = addLineMileage(c1, c2);
  1110 + }
  1111 + calcs.add(c1);
  1112 + }
  1113 +
  1114 + CalcLineMileage temp = new CalcLineMileage();
  1115 + temp.setXlName("合计");
  1116 + for(CalcLineMileage c : calcs){
  1117 + temp = addLineMileage(temp, c);
  1118 + resList.add(c);
  1119 + }
  1120 + if(resList.size() > 0)
  1121 + resList.add(temp);
  1122 +
  1123 + for(CalcLineMileage c : resList){
  1124 + Map<String, Object> m = new HashMap<String, Object>();
  1125 + if(c.getXlName().equals("合计")){
  1126 + m.put("gsdm", "");
  1127 + m.put("gs", "");
  1128 + m.put("fgsdm", "");
  1129 + m.put("fgs", "");
  1130 + } else {
  1131 + m.put("gsdm", c.getGsdm());
  1132 + m.put("gs", c.getGsName());
  1133 + m.put("fgsdm", c.getFgsdm());
  1134 + m.put("fgs", c.getFgsName());
  1135 + }
  1136 + m.put("xlName", c.getXlName());
  1137 + m.put("jhzlc", c.getJhzlc());
  1138 + m.put("jhlc", c.getJhlc());
  1139 + m.put("jcclc", c.getJcclc());
  1140 + m.put("sjzgl", c.getSjzgl());
  1141 + m.put("jhnlc", c.getJhnlc());
  1142 + m.put("jhwlc", c.getJhwlc());
  1143 + m.put("jhnjcclc", c.getJhnjcclc());
  1144 + m.put("jhwjcclc", c.getJhwjcclc());
  1145 + m.put("jhwjcclc_z", c.getJhwjcclcz());
  1146 + m.put("zrwjcclc", c.getZrwjcclc());
  1147 + m.put("zrwjcclc1", c.getZrwjcclc1());
  1148 + m.put("zrwjcclc2", c.getZrwjcclc2());
  1149 + m.put("zrwjcclcqt", c.getZrwjcclcqt());
  1150 + m.put("kfks", c.getKfks());
  1151 + m.put("lbss", c.getLbss());
  1152 + m.put("ssgl_lz", c.getSsglLz());
  1153 + m.put("ssgl_dm", c.getSsglDm());
  1154 + m.put("ssgl_gz", c.getSsglGz());
  1155 + m.put("ssgl_jf", c.getSsglJf());
  1156 + m.put("ssgl_zs", c.getSsglZs());
  1157 + m.put("ssgl_qr", c.getSsglQr());
  1158 + m.put("ssgl_qc", c.getSsglQc());
  1159 + m.put("ssgl_kx", c.getSsglKx());
  1160 + m.put("ssgl_qh", c.getSsglQh());
  1161 + m.put("ssgl_yw", c.getSsglYw());
  1162 + m.put("ssgl_other", c.getSsglOther());
  1163 + m.put("ljyy", c.getLjyy());
  1164 + m.put("ljjcc", c.getLjjcc());
  1165 + m.put("ljkfks", c.getLjkfks());
  1166 + lMap.add(m);
  1167 + }
  1168 +
  1169 + if(type.equals("export")){
  1170 + List<Iterator<?>> listI = new ArrayList<Iterator<?>>();
  1171 + Map<String, Object> m = new HashMap<String, Object>();
  1172 + m.put("date", date);
  1173 + m.put("date1", date2);
  1174 +// String by=map.get("by").toString();
  1175 + String xls="";
  1176 + if(by.equals("sj")){
  1177 + xls="countByLine.xls";
  1178 + }else{
  1179 + xls="countByLines.xls";
  1180 + }
  1181 + ReportUtils ee = new ReportUtils();
  1182 + try {
  1183 + listI.add(lMap.iterator());
  1184 + String path = this.getClass().getResource("/").getPath() + "static/pages/forms/";
  1185 + ee.excelReplace(listI, new Object[]{m}, path + "mould/"+xls,
  1186 + path + "export/线路公里统计表.xls");
  1187 + } catch (Exception e) {
  1188 + // TODO: handle exception
  1189 + e.printStackTrace();
  1190 + }
  1191 + }
  1192 +
  1193 + return lMap;
  1194 + }
  1195 +
  1196 + @Override
  1197 + public List<Map<String, Object>> getBusMileage(String line, String date,
  1198 + String date2, String xlName, String zt, String by, String type) {
  1199 + List<CalcBusMileage> resList = new ArrayList<CalcBusMileage>();
  1200 + List<Map<String, Object>> lMap = new ArrayList<Map<String, Object>>();
  1201 + List<CalcBusMileage> list = calcBusMileageRepository.selectByDateAndLineTj2(line, date, date2);
  1202 +
  1203 + if(zt.equals("zbh")){
  1204 + List<String> keyList = new ArrayList<String>();
  1205 + Map<String, List<CalcBusMileage>> keyMap = new HashMap<>();
  1206 + for(CalcBusMileage c : list){
  1207 + String nbbm = c.getNbbm();
  1208 + if(!keyMap.containsKey(nbbm)){
  1209 + keyMap.put(nbbm, new ArrayList<CalcBusMileage>());
  1210 + keyList.add(nbbm);
  1211 + }
  1212 + keyMap.get(nbbm).add(c);
  1213 + }
  1214 + for(String key : keyList){
  1215 + CalcBusMileage c1 = keyMap.get(key).get(0);
  1216 + for(int i = 1; i < keyMap.get(key).size(); i++){
  1217 + CalcBusMileage c2 = keyMap.get(key).get(i);
  1218 + c1.setZlc(Arith.add(c1.getZlc(), c2.getZlc()));
  1219 + c1.setJhnlc(Arith.add(c1.getJhnlc(), c2.getJhnlc()));
  1220 + c1.setJhwlc(Arith.add(c1.getJhwlc(), c2.getJhwlc()));
  1221 + c1.setJhnjcclc(Arith.add(c1.getJhnjcclc(), c2.getJhnjcclc()));
  1222 + c1.setJhwjcclc(Arith.add(c1.getJhwjcclc(), c2.getJhwjcclc()));
  1223 + c1.setKfks(Arith.add(c1.getKfks(), c2.getKfks()));
  1224 + c1.setZrwjcclc(Arith.add(c1.getZrwjcclc(), c2.getZrwjcclc()));
  1225 + c1.setZrwjcclc1(Arith.add(c1.getZrwjcclc1(), c2.getZrwjcclc1()));
  1226 + c1.setZrwjcclc2(Arith.add(c1.getZrwjcclc2(), c2.getZrwjcclc2()));
  1227 + c1.setZrwjcclcqt(Arith.add(c1.getZrwjcclcqt(), c2.getZrwjcclcqt()));
  1228 + c1.setLjyy(Arith.add(c1.getLjyy(), c2.getLjyy()));
  1229 + c1.setLjjcc(Arith.add(c1.getLjjcc(), c2.getLjjcc()));
  1230 + c1.setLjkfks(Arith.add(c1.getLjkfks(), c2.getLjkfks()));
  1231 + c1.setDhl(Arith.add(c1.getDhl(), c2.getDhl()));
  1232 + c1.setCdl(Arith.add(c1.getCdl(), c2.getCdl()));
  1233 + c1.setYhl(Arith.add(c1.getYhl(), c2.getYhl()));
  1234 + c1.setJzl(Arith.add(c1.getJzl(), c2.getJzl()));
  1235 + c1.setHyl(Arith.add(c1.getHyl(), c2.getHyl()));
  1236 + c1.setJhzlc(Arith.add(c1.getJhzlc(), c2.getJhzlc()));
  1237 + }
  1238 + resList.add(c1);
  1239 + }
  1240 + } else {
  1241 + List<String> keyList = new ArrayList<String>();
  1242 + Map<String, List<CalcBusMileage>> keyMap = new HashMap<>();
  1243 + for(CalcBusMileage c : list){
  1244 + String key = c.getNbbm() + c.getjGh() + c.getjName() + c.getsGh() + c.getsName();
  1245 + if(!keyMap.containsKey(key)){
  1246 + keyMap.put(key, new ArrayList<CalcBusMileage>());
  1247 + keyList.add(key);
  1248 + }
  1249 + keyMap.get(key).add(c);
  1250 + }
  1251 + for(String key : keyList){
  1252 + CalcBusMileage c1 = keyMap.get(key).get(0);
  1253 + for(int i = 1; i < keyMap.get(key).size(); i++){
  1254 + CalcBusMileage c2 = keyMap.get(key).get(i);
  1255 + c1.setZlc(Arith.add(c1.getZlc(), c2.getZlc()));
  1256 + c1.setJhnlc(Arith.add(c1.getJhnlc(), c2.getJhnlc()));
  1257 + c1.setJhwlc(Arith.add(c1.getJhwlc(), c2.getJhwlc()));
  1258 + c1.setJhnjcclc(Arith.add(c1.getJhnjcclc(), c2.getJhnjcclc()));
  1259 + c1.setJhwjcclc(Arith.add(c1.getJhwjcclc(), c2.getJhwjcclc()));
  1260 + c1.setKfks(Arith.add(c1.getKfks(), c2.getKfks()));
  1261 + c1.setZrwjcclc(Arith.add(c1.getZrwjcclc(), c2.getZrwjcclc()));
  1262 + c1.setZrwjcclc1(Arith.add(c1.getZrwjcclc1(), c2.getZrwjcclc1()));
  1263 + c1.setZrwjcclc2(Arith.add(c1.getZrwjcclc2(), c2.getZrwjcclc2()));
  1264 + c1.setZrwjcclcqt(Arith.add(c1.getZrwjcclcqt(), c2.getZrwjcclcqt()));
  1265 + c1.setLjyy(Arith.add(c1.getLjyy(), c2.getLjyy()));
  1266 + c1.setLjjcc(Arith.add(c1.getLjjcc(), c2.getLjjcc()));
  1267 + c1.setLjkfks(Arith.add(c1.getLjkfks(), c2.getLjkfks()));
  1268 + c1.setDhl(Arith.add(c1.getDhl(), c2.getDhl()));
  1269 + c1.setCdl(Arith.add(c1.getCdl(), c2.getCdl()));
  1270 + c1.setYhl(Arith.add(c1.getYhl(), c2.getYhl()));
  1271 + c1.setJzl(Arith.add(c1.getJzl(), c2.getJzl()));
  1272 + c1.setHyl(Arith.add(c1.getHyl(), c2.getHyl()));
  1273 + c1.setJhzlc(Arith.add(c1.getJhzlc(), c2.getJhzlc()));
  1274 + }
  1275 + resList.add(c1);
  1276 + }
  1277 + }
  1278 +
  1279 + for(CalcBusMileage c : resList){
  1280 + Map<String, Object> m = new HashMap<String, Object>();
  1281 + if(date.equals(date2)){
  1282 + m.put("rq", date);
  1283 + } else {
  1284 + m.put("rq", date + "至" + date2);
  1285 + }
  1286 + m.put("fgs", c.getFgsName());
  1287 + m.put("xlName", c.getXlName());
  1288 + m.put("nbbm", c.getNbbm());
  1289 + m.put("jGh", c.getjGh());
  1290 + m.put("jName", c.getjName());
  1291 + m.put("sGh", c.getsGh());
  1292 + m.put("sName", c.getsName());
  1293 + m.put("zlc", c.getZlc());
  1294 + m.put("jhnlc", c.getJhnlc());
  1295 + m.put("jhwlc", c.getJhwlc());
  1296 + m.put("jhnjcclc", c.getJhnjcclc());
  1297 + m.put("jhwjcclc", c.getJhwjcclc());
  1298 + m.put("jhwjcclc_z", c.getJhwjcclcz());
  1299 + m.put("kfks", c.getKfks());
  1300 + m.put("zrwjcclc", c.getZrwjcclc());
  1301 + m.put("zrwjcclc1", c.getZrwjcclc1());
  1302 + m.put("zrwjcclc2", c.getZrwjcclc2());
  1303 + m.put("zrwjcclcqt", c.getZrwjcclcqt());
  1304 + m.put("ljyy", c.getLjyy());
  1305 + m.put("ljjcc", c.getLjjcc());
  1306 + m.put("ljkfks", c.getLjkfks());
  1307 + m.put("dhl", c.getDhl());
  1308 + m.put("cdl", c.getCdl());
  1309 + m.put("yhl", c.getYhl());
  1310 + m.put("jzl", c.getJzl());
  1311 + m.put("hyl", c.getYhl());
  1312 + m.put("jhzlc", c.getJhzlc());
  1313 + lMap.add(m);
  1314 + }
  1315 +
  1316 + if(type.equals("export")){
  1317 + List<Iterator<?>> listI = new ArrayList<Iterator<?>>();
  1318 + Map<String, Object> m = new HashMap<String, Object>();
  1319 + m.put("date", date);
  1320 + m.put("date1", date2);
  1321 + String xls="";
  1322 +// String by=map.get("by").toString();
  1323 +
  1324 + if(zt.equals("zbh")){
  1325 + if(by.equals("sj")){
  1326 + xls="countByBus1.xls";
  1327 + }else{
  1328 + xls="countByBus1s.xls";
  1329 + }
  1330 + }else{
  1331 +
  1332 + if(by.equals("sj")){
  1333 + xls="countByBus2.xls";
  1334 + }else{
  1335 + xls="countByBus2s.xls";
  1336 + }
  1337 + }
  1338 + ReportUtils ee = new ReportUtils();
  1339 + try {
  1340 + listI.add(lMap.iterator());
  1341 + String path = this.getClass().getResource("/").getPath() + "static/pages/forms/";
  1342 + ee.excelReplace(listI, new Object[]{m}, path + "mould/"+xls,
  1343 + path + "export/路单数据统计表.xls");
  1344 + } catch (Exception e) {
  1345 + // TODO: handle exception
  1346 + e.printStackTrace();
  1347 + }
  1348 + }
  1349 +
  1350 + return lMap;
  1351 + }
743 1352
  1353 + public CalcLineMileage addLineMileage(CalcLineMileage temp, CalcLineMileage c){
  1354 + temp.setJhzlc(Arith.add(temp.getJhzlc()!=null?temp.getJhzlc():0, c.getJhzlc()));
  1355 + temp.setJhlc(Arith.add(temp.getJhlc()!=null?temp.getJhlc():0, c.getJhlc()));
  1356 + temp.setJcclc(Arith.add(temp.getJcclc()!=null?temp.getJcclc():0, c.getJcclc()));
  1357 + temp.setSjzgl(Arith.add(temp.getSjzgl()!=null?temp.getSjzgl():0, c.getSjzgl()));
  1358 + temp.setJhnlc(Arith.add(temp.getJhnlc()!=null?temp.getJhnlc():0, c.getJhnlc()));
  1359 + temp.setJhwlc(Arith.add(temp.getJhwlc()!=null?temp.getJhwlc():0, c.getJhwlc()));
  1360 + temp.setJhnjcclc(Arith.add(temp.getJhnjcclc()!=null?temp.getJhnjcclc():0, c.getJhnjcclc()));
  1361 + temp.setJhwjcclc(Arith.add(temp.getJhwjcclc()!=null?temp.getJhwjcclc():0, c.getJhwjcclc()));
  1362 + temp.setJhwjcclcz(Arith.add(temp.getJhwjcclcz()!=null?temp.getJhwjcclcz():0, c.getJhwjcclcz()));
  1363 + temp.setZrwjcclc(Arith.add(temp.getZrwjcclc()!=null?temp.getZrwjcclc():0, c.getZrwjcclc()));
  1364 + temp.setZrwjcclc1(Arith.add(temp.getZrwjcclc1()!=null?temp.getZrwjcclc1():0, c.getZrwjcclc1()));
  1365 + temp.setZrwjcclc2(Arith.add(temp.getZrwjcclc2()!=null?temp.getZrwjcclc2():0, c.getZrwjcclc2()));
  1366 + temp.setZrwjcclcqt(Arith.add(temp.getZrwjcclcqt()!=null?temp.getZrwjcclcqt():0, c.getZrwjcclcqt()));
  1367 + temp.setKfks(Arith.add(temp.getKfks()!=null?temp.getKfks():0, c.getKfks()));
  1368 + temp.setLbss(Arith.add(temp.getLbss()!=null?temp.getLbss():0, c.getLbss()));
  1369 + temp.setSsglLz(Arith.add(temp.getSsglLz()!=null?temp.getSsglLz():0, c.getSsglLz()));
  1370 + temp.setSsglDm(Arith.add(temp.getSsglDm()!=null?temp.getSsglDm():0, c.getSsglDm()));
  1371 + temp.setSsglGz(Arith.add(temp.getSsglGz()!=null?temp.getSsglGz():0, c.getSsglGz()));
  1372 + temp.setSsglJf(Arith.add(temp.getSsglJf()!=null?temp.getSsglJf():0, c.getSsglJf()));
  1373 + temp.setSsglZs(Arith.add(temp.getSsglZs()!=null?temp.getSsglZs():0, c.getSsglZs()));
  1374 + temp.setSsglQr(Arith.add(temp.getSsglQr()!=null?temp.getSsglQr():0, c.getSsglQr()));
  1375 + temp.setSsglQc(Arith.add(temp.getSsglQc()!=null?temp.getSsglQc():0, c.getSsglQc()));
  1376 + temp.setSsglKx(Arith.add(temp.getSsglKx()!=null?temp.getSsglKx():0, c.getSsglKx()));
  1377 + temp.setSsglQh(Arith.add(temp.getSsglQh()!=null?temp.getSsglQh():0, c.getSsglQh()));
  1378 + temp.setSsglYw(Arith.add(temp.getSsglYw()!=null?temp.getSsglYw():0, c.getSsglYw()));
  1379 + temp.setSsglOther(Arith.add(temp.getSsglOther()!=null?temp.getSsglOther():0, c.getSsglOther()));
  1380 + temp.setLjyy(Arith.add(temp.getLjyy()!=null?temp.getLjyy():0, c.getLjyy()));
  1381 + temp.setLjjcc(Arith.add(temp.getLjjcc()!=null?temp.getLjjcc():0, c.getLjjcc()));
  1382 + temp.setLjkfks(Arith.add(temp.getLjkfks()!=null?temp.getLjkfks():0, c.getLjkfks()));
  1383 + return temp;
  1384 + }
  1385 +
744 } 1386 }
src/main/java/com/bsth/service/schedule/TTInfoDetailService.java
@@ -6,6 +6,7 @@ import com.bsth.service.schedule.datatools.TTinfoDetailDynamicData; @@ -6,6 +6,7 @@ import com.bsth.service.schedule.datatools.TTinfoDetailDynamicData;
6 import com.bsth.service.schedule.exception.ScheduleException; 6 import com.bsth.service.schedule.exception.ScheduleException;
7 import com.bsth.service.schedule.timetable.ExcelFormatType; 7 import com.bsth.service.schedule.timetable.ExcelFormatType;
8 import com.bsth.service.schedule.utils.DataToolsFile; 8 import com.bsth.service.schedule.utils.DataToolsFile;
  9 +import com.bsth.service.schedule.utils.DataToolsFileType;
9 10
10 import java.util.List; 11 import java.util.List;
11 import java.util.Map; 12 import java.util.Map;
@@ -30,7 +31,7 @@ public interface TTInfoDetailService extends BService&lt;TTInfoDetail, Long&gt; { @@ -30,7 +31,7 @@ public interface TTInfoDetailService extends BService&lt;TTInfoDetail, Long&gt; {
30 * @return 31 * @return
31 * @throws ScheduleException 32 * @throws ScheduleException
32 */ 33 */
33 - DataToolsFile exportDynamicTTinfo(TTinfoDetailDynamicData.DTInfos dtInfos) throws ScheduleException; 34 + DataToolsFile exportDynamicTTinfo(TTinfoDetailDynamicData.DTInfos dtInfos, DataToolsFileType type) throws ScheduleException;
34 35
35 /** 36 /**
36 * 获取时刻表最大发车顺序号 37 * 获取时刻表最大发车顺序号
src/main/java/com/bsth/service/schedule/datatools/Excel2003PoiOperator.java 0 → 100644
  1 +package com.bsth.service.schedule.datatools;
  2 +
  3 +import org.apache.poi.hssf.usermodel.*;
  4 +import org.apache.poi.ss.usermodel.*;
  5 +import org.apache.poi.ss.util.WorkbookUtil;
  6 +import org.apache.poi.xssf.usermodel.XSSFColor;
  7 +
  8 +import java.awt.Color;
  9 +import java.io.File;
  10 +import java.io.FileOutputStream;
  11 +import java.util.Date;
  12 +
  13 +/**
  14 + * Excel2003表格Poi操作类。
  15 + * TODO:2003里面还有很多和2007不通的样式设定方式,以后再改
  16 + */
  17 +public class Excel2003PoiOperator implements ExcelPoiOperator {
  18 + @Override
  19 + public Cell createCell(
  20 + Workbook workbook, Row row, short columnIndex,
  21 + Object value, int valueType,
  22 + HorizontalAlignment horizontalAlignment, VerticalAlignment verticalAlignment,
  23 + BorderStyle borderStyle, Color borderColor,
  24 + short fontSize, Color fontColor, String fontName,
  25 + Color backgroudColor, FillPatternType fillPatternType) {
  26 + HSSFWorkbook hssfWorkbook = (HSSFWorkbook) workbook;
  27 + HSSFRow hssfRow = (HSSFRow) row;
  28 +
  29 + CreationHelper creationHelper = hssfWorkbook.getCreationHelper();
  30 +
  31 + // 1、创建单元格对象
  32 + HSSFCell hssfCell = hssfRow.createCell((int) columnIndex);
  33 +
  34 + // 2、设定样式
  35 + HSSFCellStyle hssfCellStyle = hssfWorkbook.createCellStyle();
  36 +
  37 + // 设定值及数据格式
  38 + DataFormat dataFormat = hssfWorkbook.createDataFormat();
  39 + if (valueType == HSSFCell.CELL_TYPE_STRING) {
  40 + hssfCellStyle.setDataFormat(dataFormat.getFormat("@"));
  41 + hssfCell.setCellValue(creationHelper.createRichTextString(String.valueOf(value)));
  42 + } else if (valueType == HSSFCell.CELL_TYPE_NUMERIC) {
  43 + if (value instanceof Date) { // 日期
  44 + hssfCellStyle.setDataFormat(dataFormat.getFormat("yyyy-mm-dd"));
  45 + hssfCell.setCellValue((Date) value);
  46 + } else if (value instanceof Double) {
  47 + hssfCellStyle.setDataFormat(dataFormat.getFormat("0.00"));
  48 + hssfCell.setCellValue((Double) value);
  49 + } else if (value instanceof Integer) {
  50 + hssfCellStyle.setDataFormat(dataFormat.getFormat("0"));
  51 + hssfCell.setCellValue(Double.valueOf(value.toString()));
  52 + } else {
  53 + throw new RuntimeException("Excel2003 只支持 String Date Double Integer 单元格类型");
  54 + }
  55 + } else if (valueType == HSSFCell.CELL_TYPE_BLANK) {
  56 + hssfCell.setCellType(HSSFCell.CELL_TYPE_BLANK);
  57 + } else {
  58 + throw new RuntimeException("暂时不支持字符串、日期、数字以外的类型");
  59 + }
  60 +
  61 + // 对齐方式
  62 + hssfCellStyle.setAlignment((short) horizontalAlignment.ordinal());
  63 + hssfCellStyle.setVerticalAlignment((short) verticalAlignment.ordinal());
  64 +
  65 + // 边框样式
  66 + hssfCellStyle.setBorderTop((short) borderStyle.ordinal());
  67 + hssfCellStyle.setTopBorderColor(new XSSFColor(borderColor).getIndexed());
  68 + hssfCellStyle.setBorderBottom((short) borderStyle.ordinal());
  69 + hssfCellStyle.setBottomBorderColor(new XSSFColor(borderColor).getIndexed());
  70 + hssfCellStyle.setBorderLeft((short) borderStyle.ordinal());
  71 + hssfCellStyle.setLeftBorderColor(new XSSFColor(borderColor).getIndexed());
  72 + hssfCellStyle.setBorderRight((short) borderStyle.ordinal());
  73 + hssfCellStyle.setRightBorderColor(new XSSFColor(borderColor).getIndexed());
  74 +
  75 + // 字体颜色
  76 +// HSSFFont font = hssfWorkbook.createFont();
  77 +// font.setColor(new XSSFColor(fontColor).getIndexed());
  78 +// font.setFontHeightInPoints(fontSize);
  79 +// font.setFontName(fontName);
  80 +// hssfCellStyle.setFont(font);
  81 +
  82 +
  83 + // 单元背景色
  84 + hssfCellStyle.setFillForegroundColor(new XSSFColor(backgroudColor).getIndexed());
  85 +// hssfCellStyle.setFillPattern((short) fillPatternType.ordinal());
  86 +
  87 + // TODO
  88 +
  89 + hssfCell.setCellStyle(hssfCellStyle);
  90 + return hssfCell;
  91 + }
  92 +
  93 + @Override
  94 + public Cell createStringCell(
  95 + Workbook workbook, Row row, short columnIndex,
  96 + String value) {
  97 + HSSFWorkbook hssfWorkbook = (HSSFWorkbook) workbook;
  98 + HSSFRow hssfRow = (HSSFRow) row;
  99 +
  100 + HSSFCell hssfCell = (HSSFCell) createCell(
  101 + hssfWorkbook, hssfRow, columnIndex,
  102 + value, HSSFCell.CELL_TYPE_STRING,
  103 + HorizontalAlignment.CENTER, VerticalAlignment.CENTER,
  104 + BorderStyle.MEDIUM, new java.awt.Color(0xdedede),
  105 + (short) 13, new java.awt.Color(0x2765A7), "宋体",
  106 + new Color(0xffffff), FillPatternType.SOLID_FOREGROUND
  107 + );
  108 + DataFormat dataFormat = hssfWorkbook.createDataFormat();
  109 + hssfCell.getCellStyle().setDataFormat(dataFormat.getFormat("@"));
  110 + return hssfCell;
  111 + }
  112 +
  113 + @Override
  114 + public Cell createStringCell(
  115 + Workbook workbook, Row row, short columnIndex,
  116 + String value,
  117 + Color backgroudColor) {
  118 + HSSFWorkbook hssfWorkbook = (HSSFWorkbook) workbook;
  119 + HSSFRow hssfRow = (HSSFRow) row;
  120 +
  121 + HSSFCell hssfCell = (HSSFCell) createCell(
  122 + hssfWorkbook, hssfRow, columnIndex,
  123 + value, HSSFCell.CELL_TYPE_STRING,
  124 + HorizontalAlignment.CENTER, VerticalAlignment.CENTER,
  125 + BorderStyle.MEDIUM, new java.awt.Color(0xdedede),
  126 + (short) 13, new java.awt.Color(0x2765A7), "宋体",
  127 + backgroudColor, FillPatternType.SOLID_FOREGROUND
  128 + );
  129 + DataFormat dataFormat = hssfWorkbook.createDataFormat();
  130 + hssfCell.getCellStyle().setDataFormat(dataFormat.getFormat("@"));
  131 + return hssfCell;
  132 + }
  133 +
  134 + @Override
  135 + public Cell createIntegerCell(
  136 + Workbook workbook, Row row, short columnIndex,
  137 + Integer value) {
  138 + HSSFWorkbook hssfWorkbook = (HSSFWorkbook) workbook;
  139 + HSSFRow hssfRow = (HSSFRow) row;
  140 +
  141 + HSSFCell hssfCell = (HSSFCell) createCell(
  142 + hssfWorkbook, hssfRow, columnIndex,
  143 + value, HSSFCell.CELL_TYPE_NUMERIC,
  144 + HorizontalAlignment.CENTER, VerticalAlignment.CENTER,
  145 + BorderStyle.MEDIUM, new Color(0xdedede),
  146 + (short) 13, new Color(0x2765A7), "宋体",
  147 + new Color(0xffffff), FillPatternType.SOLID_FOREGROUND
  148 + );
  149 +
  150 + DataFormat dataFormat = hssfWorkbook.createDataFormat();
  151 + hssfCell.getCellStyle().setDataFormat(dataFormat.getFormat("0"));
  152 + return hssfCell;
  153 + }
  154 +
  155 + @Override
  156 + public Cell createIntegerCell(
  157 + Workbook workbook, Row row, short columnIndex,
  158 + Integer value,
  159 + Color backgroudColor) {
  160 + HSSFWorkbook hssfWorkbook = (HSSFWorkbook) workbook;
  161 + HSSFRow hssfRow = (HSSFRow) row;
  162 +
  163 + HSSFCell hssfCell = (HSSFCell) createCell(
  164 + hssfWorkbook, hssfRow, columnIndex,
  165 + value, HSSFCell.CELL_TYPE_NUMERIC,
  166 + HorizontalAlignment.CENTER, VerticalAlignment.CENTER,
  167 + BorderStyle.MEDIUM, new Color(0xdedede),
  168 + (short) 13, new Color(0x2765A7), "宋体",
  169 + backgroudColor, FillPatternType.SOLID_FOREGROUND
  170 + );
  171 +
  172 + DataFormat dataFormat = hssfWorkbook.createDataFormat();
  173 + hssfCell.getCellStyle().setDataFormat(dataFormat.getFormat("0"));
  174 + return hssfCell;
  175 + }
  176 +
  177 + @Override
  178 + public Cell createDoubleCell(
  179 + Workbook workbook, Row row, short columnIndex,
  180 + Double value) {
  181 + HSSFWorkbook hssfWorkbook = (HSSFWorkbook) workbook;
  182 + HSSFRow hssfRow = (HSSFRow) row;
  183 +
  184 + HSSFCell hssfCell = (HSSFCell) createCell(
  185 + hssfWorkbook, hssfRow, columnIndex,
  186 + value, HSSFCell.CELL_TYPE_NUMERIC,
  187 + HorizontalAlignment.CENTER, VerticalAlignment.CENTER,
  188 + BorderStyle.MEDIUM, new Color(0xdedede),
  189 + (short) 13, new Color(0x2765A7), "宋体",
  190 + new Color(0xffffff), FillPatternType.SOLID_FOREGROUND
  191 + );
  192 +
  193 + DataFormat dataFormat = hssfWorkbook.createDataFormat();
  194 + hssfCell.getCellStyle().setDataFormat(dataFormat.getFormat("0.00"));
  195 + return hssfCell;
  196 + }
  197 +
  198 + @Override
  199 + public Cell createDoubleCell(
  200 + Workbook workbook, Row row, short columnIndex,
  201 + Double value,
  202 + Color backgroudColor) {
  203 + HSSFWorkbook hssfWorkbook = (HSSFWorkbook) workbook;
  204 + HSSFRow hssfRow = (HSSFRow) row;
  205 +
  206 + HSSFCell hssfCell = (HSSFCell) createCell(
  207 + hssfWorkbook, hssfRow, columnIndex,
  208 + value, HSSFCell.CELL_TYPE_NUMERIC,
  209 + HorizontalAlignment.CENTER, VerticalAlignment.CENTER,
  210 + BorderStyle.MEDIUM, new Color(0xdedede),
  211 + (short) 13, new Color(0x2765A7), "宋体",
  212 + backgroudColor, FillPatternType.SOLID_FOREGROUND
  213 + );
  214 +
  215 + DataFormat dataFormat = hssfWorkbook.createDataFormat();
  216 + hssfCell.getCellStyle().setDataFormat(dataFormat.getFormat("0.00"));
  217 + return hssfCell;
  218 + }
  219 +
  220 + @Override
  221 + public Cell createBlankCell(Workbook workbook, Row row, short columnIndex) {
  222 + return createCell(
  223 + workbook, row, columnIndex,
  224 + null, HSSFCell.CELL_TYPE_BLANK,
  225 + HorizontalAlignment.CENTER, VerticalAlignment.CENTER,
  226 + BorderStyle.MEDIUM, new Color(0xdedede),
  227 + (short) 13, new Color(0x2765A7), "宋体",
  228 + new Color(0xffffff), FillPatternType.SOLID_FOREGROUND
  229 + );
  230 + }
  231 +
  232 + @Override
  233 + public Cell setCellDataFormat(Workbook workbook, Cell cell, String fmt) {
  234 + HSSFWorkbook hssfWorkbook = (HSSFWorkbook) workbook;
  235 + DataFormat dataFormat = hssfWorkbook.createDataFormat();
  236 + cell.getCellStyle().setDataFormat(dataFormat.getFormat("fmt"));
  237 + return cell;
  238 + }
  239 +
  240 + @Override
  241 + public Cell setCellBackground(Cell cell, Color color) {
  242 + HSSFCell hssfCell = (HSSFCell) cell;
  243 + hssfCell.getCellStyle().setFillForegroundColor(new XSSFColor(color).getIndexed());
  244 + return cell;
  245 + }
  246 +
  247 + @Override
  248 + public Workbook createWorkBook() {
  249 + return new HSSFWorkbook();
  250 + }
  251 +
  252 + @Override
  253 + public Sheet createWorkBookSheet(Workbook workbook, String sheetName) {
  254 + HSSFWorkbook hssfWorkbook = (HSSFWorkbook) workbook;
  255 + return hssfWorkbook.createSheet(WorkbookUtil.createSafeSheetName(sheetName));
  256 + }
  257 +
  258 + @Override
  259 + public Row createSheetRow(Sheet sheet, int rowIndex) {
  260 + HSSFSheet hssfSheet = (HSSFSheet) sheet;
  261 + return hssfSheet.createRow(rowIndex);
  262 + }
  263 +
  264 + @Override
  265 + public void writeExcel(File excelFile, Workbook workbook) {
  266 + try {
  267 + HSSFWorkbook hssfWorkbook = (HSSFWorkbook) workbook;
  268 + FileOutputStream fileOutputStream = new FileOutputStream(excelFile);
  269 + hssfWorkbook.write(fileOutputStream);
  270 + } catch (Exception exp) {
  271 + throw new RuntimeException(exp);
  272 + }
  273 + }
  274 +}
src/main/java/com/bsth/service/schedule/datatools/Excel2007PoiOperator.java 0 → 100644
  1 +package com.bsth.service.schedule.datatools;
  2 +
  3 +import org.apache.poi.ss.usermodel.*;
  4 +import org.apache.poi.ss.util.WorkbookUtil;
  5 +import org.apache.poi.xssf.usermodel.*;
  6 +
  7 +import java.awt.Color;
  8 +import java.io.File;
  9 +import java.io.FileOutputStream;
  10 +import java.util.Date;
  11 +
  12 +/**
  13 + * Excel2007表格Poi操作类。
  14 + * TODO:以后测style需要重用
  15 + */
  16 +public class Excel2007PoiOperator implements ExcelPoiOperator {
  17 + @Override
  18 + public Cell createCell(
  19 + Workbook workbook, Row row, short columnIndex,
  20 + Object value, int valueType,
  21 + HorizontalAlignment horizontalAlignment, VerticalAlignment verticalAlignment,
  22 + BorderStyle borderStyle, java.awt.Color borderColor,
  23 + short fontSize, java.awt.Color fontColor, String fontName,
  24 + java.awt.Color backgroudColor, FillPatternType fillPatternType) {
  25 +
  26 + XSSFWorkbook xssfWorkbook = (XSSFWorkbook) workbook;
  27 + XSSFRow xssfRow = (XSSFRow) row;
  28 +
  29 + CreationHelper creationHelper = xssfWorkbook.getCreationHelper();
  30 +
  31 + // 1、创建单元格对象
  32 + XSSFCell xssfCell = xssfRow.createCell(columnIndex);
  33 +
  34 + // 2、设定样式
  35 + XSSFCellStyle xssfCellStyle = xssfWorkbook.createCellStyle();
  36 +
  37 + // 设定值及数据格式
  38 + DataFormat dataFormat = xssfWorkbook.createDataFormat();
  39 + if (valueType == XSSFCell.CELL_TYPE_STRING) {
  40 + xssfCellStyle.setDataFormat(dataFormat.getFormat("@"));
  41 + xssfCell.setCellValue(creationHelper.createRichTextString(String.valueOf(value)));
  42 + } else if (valueType == XSSFCell.CELL_TYPE_NUMERIC) {
  43 + if (value instanceof Date) { // 日期
  44 + xssfCellStyle.setDataFormat(dataFormat.getFormat("yyyy-mm-dd"));
  45 + xssfCell.setCellValue((Date) value);
  46 + } else if (value instanceof Double) {
  47 + xssfCellStyle.setDataFormat(dataFormat.getFormat("0.00"));
  48 + xssfCell.setCellValue((Double) value);
  49 + } else if (value instanceof Integer) {
  50 + xssfCellStyle.setDataFormat(dataFormat.getFormat("0"));
  51 + xssfCell.setCellValue(Double.valueOf(value.toString()));
  52 + } else {
  53 + throw new RuntimeException("Excel2007 只支持 String Date Double Integer 单元格类型");
  54 + }
  55 + } else if (valueType == XSSFCell.CELL_TYPE_BLANK) {
  56 + xssfCell.setCellType(Cell.CELL_TYPE_BLANK);
  57 + } else {
  58 + throw new RuntimeException("暂时不支持字符串、日期、数字以外的类型");
  59 + }
  60 +
  61 + // 对齐方式
  62 + xssfCellStyle.setAlignment(horizontalAlignment);
  63 + xssfCellStyle.setVerticalAlignment(verticalAlignment);
  64 +
  65 + // 边框样式
  66 + xssfCellStyle.setBorderTop(borderStyle);
  67 + xssfCellStyle.setTopBorderColor(new XSSFColor(borderColor));
  68 + xssfCellStyle.setBorderBottom(borderStyle);
  69 + xssfCellStyle.setBottomBorderColor(new XSSFColor(borderColor));
  70 + xssfCellStyle.setBorderLeft(borderStyle);
  71 + xssfCellStyle.setLeftBorderColor(new XSSFColor(borderColor));
  72 + xssfCellStyle.setBorderRight(borderStyle);
  73 + xssfCellStyle.setRightBorderColor(new XSSFColor(borderColor));
  74 +
  75 + // 字体颜色
  76 + XSSFFont font = xssfWorkbook.createFont();
  77 + font.setColor(new XSSFColor(fontColor));
  78 + font.setFontHeightInPoints(fontSize);
  79 + font.setFontName(fontName);
  80 + xssfCellStyle.setFont(font);
  81 +
  82 +
  83 + // 单元背景色
  84 + xssfCellStyle.setFillForegroundColor(new XSSFColor(backgroudColor));
  85 + xssfCellStyle.setFillPattern(fillPatternType);
  86 +
  87 + // TODO
  88 +
  89 + xssfCell.setCellStyle(xssfCellStyle);
  90 + return xssfCell;
  91 + }
  92 +
  93 + @Override
  94 + public Cell createStringCell(
  95 + Workbook workbook, Row row, short columnIndex,
  96 + String value) {
  97 + XSSFWorkbook xssfWorkbook = (XSSFWorkbook) workbook;
  98 + XSSFRow xssfRow = (XSSFRow) row;
  99 +
  100 + XSSFCell xssfCell = (XSSFCell) createCell(
  101 + xssfWorkbook, xssfRow, columnIndex,
  102 + value, XSSFCell.CELL_TYPE_STRING,
  103 + HorizontalAlignment.CENTER, VerticalAlignment.CENTER,
  104 + BorderStyle.MEDIUM, new java.awt.Color(0xdedede),
  105 + (short) 13, new java.awt.Color(0x2765A7), "宋体",
  106 + new Color(0xffffff), FillPatternType.SOLID_FOREGROUND
  107 + );
  108 + DataFormat dataFormat = xssfWorkbook.createDataFormat();
  109 + xssfCell.getCellStyle().setDataFormat(dataFormat.getFormat("@"));
  110 + return xssfCell;
  111 + }
  112 +
  113 + @Override
  114 + public Cell createStringCell(
  115 + Workbook workbook, Row row, short columnIndex,
  116 + String value,
  117 + Color backgroudColor) {
  118 + XSSFWorkbook xssfWorkbook = (XSSFWorkbook) workbook;
  119 + XSSFRow xssfRow = (XSSFRow) row;
  120 +
  121 + XSSFCell xssfCell = (XSSFCell) createCell(
  122 + xssfWorkbook, xssfRow, columnIndex,
  123 + value, XSSFCell.CELL_TYPE_STRING,
  124 + HorizontalAlignment.CENTER, VerticalAlignment.CENTER,
  125 + BorderStyle.MEDIUM, new java.awt.Color(0xdedede),
  126 + (short) 13, new java.awt.Color(0x2765A7), "宋体",
  127 + backgroudColor, FillPatternType.SOLID_FOREGROUND
  128 + );
  129 + DataFormat dataFormat = xssfWorkbook.createDataFormat();
  130 + xssfCell.getCellStyle().setDataFormat(dataFormat.getFormat("@"));
  131 + return xssfCell;
  132 + }
  133 +
  134 + @Override
  135 + public Cell createIntegerCell(
  136 + Workbook workbook, Row row, short columnIndex,
  137 + Integer value) {
  138 + XSSFWorkbook xssfWorkbook = (XSSFWorkbook) workbook;
  139 + XSSFRow xssfRow = (XSSFRow) row;
  140 +
  141 + XSSFCell xssfCell = (XSSFCell) createCell(
  142 + xssfWorkbook, xssfRow, columnIndex,
  143 + value, XSSFCell.CELL_TYPE_NUMERIC,
  144 + HorizontalAlignment.CENTER, VerticalAlignment.CENTER,
  145 + BorderStyle.MEDIUM, new Color(0xdedede),
  146 + (short) 13, new Color(0x2765A7), "宋体",
  147 + new Color(0xffffff), FillPatternType.SOLID_FOREGROUND
  148 + );
  149 +
  150 + DataFormat dataFormat = xssfWorkbook.createDataFormat();
  151 + xssfCell.getCellStyle().setDataFormat(dataFormat.getFormat("0"));
  152 + return xssfCell;
  153 + }
  154 +
  155 + @Override
  156 + public Cell createIntegerCell(
  157 + Workbook workbook, Row row, short columnIndex,
  158 + Integer value,
  159 + Color backgroudColor) {
  160 + XSSFWorkbook xssfWorkbook = (XSSFWorkbook) workbook;
  161 + XSSFRow xssfRow = (XSSFRow) row;
  162 +
  163 + XSSFCell xssfCell = (XSSFCell) createCell(
  164 + xssfWorkbook, xssfRow, columnIndex,
  165 + value, XSSFCell.CELL_TYPE_NUMERIC,
  166 + HorizontalAlignment.CENTER, VerticalAlignment.CENTER,
  167 + BorderStyle.MEDIUM, new Color(0xdedede),
  168 + (short) 13, new Color(0x2765A7), "宋体",
  169 + backgroudColor, FillPatternType.SOLID_FOREGROUND
  170 + );
  171 +
  172 + DataFormat dataFormat = xssfWorkbook.createDataFormat();
  173 + xssfCell.getCellStyle().setDataFormat(dataFormat.getFormat("0"));
  174 + return xssfCell;
  175 + }
  176 +
  177 + @Override
  178 + public Cell createDoubleCell(
  179 + Workbook workbook, Row row, short columnIndex,
  180 + Double value) {
  181 + XSSFWorkbook xssfWorkbook = (XSSFWorkbook) workbook;
  182 + XSSFRow xssfRow = (XSSFRow) row;
  183 +
  184 + XSSFCell xssfCell = (XSSFCell) createCell(
  185 + xssfWorkbook, xssfRow, columnIndex,
  186 + value, XSSFCell.CELL_TYPE_NUMERIC,
  187 + HorizontalAlignment.CENTER, VerticalAlignment.CENTER,
  188 + BorderStyle.MEDIUM, new Color(0xdedede),
  189 + (short) 13, new Color(0x2765A7), "宋体",
  190 + new Color(0xffffff), FillPatternType.SOLID_FOREGROUND
  191 + );
  192 +
  193 + DataFormat dataFormat = xssfWorkbook.createDataFormat();
  194 + xssfCell.getCellStyle().setDataFormat(dataFormat.getFormat("0.00"));
  195 + return xssfCell;
  196 + }
  197 +
  198 + @Override
  199 + public Cell createDoubleCell(
  200 + Workbook workbook, Row row, short columnIndex,
  201 + Double value,
  202 + Color backgroudColor) {
  203 + XSSFWorkbook xssfWorkbook = (XSSFWorkbook) workbook;
  204 + XSSFRow xssfRow = (XSSFRow) row;
  205 +
  206 + XSSFCell xssfCell = (XSSFCell) createCell(
  207 + xssfWorkbook, xssfRow, columnIndex,
  208 + value, XSSFCell.CELL_TYPE_NUMERIC,
  209 + HorizontalAlignment.CENTER, VerticalAlignment.CENTER,
  210 + BorderStyle.MEDIUM, new Color(0xdedede),
  211 + (short) 13, new Color(0x2765A7), "宋体",
  212 + backgroudColor, FillPatternType.SOLID_FOREGROUND
  213 + );
  214 +
  215 + DataFormat dataFormat = xssfWorkbook.createDataFormat();
  216 + xssfCell.getCellStyle().setDataFormat(dataFormat.getFormat("0.00"));
  217 + return xssfCell;
  218 + }
  219 +
  220 + @Override
  221 + public Cell createBlankCell(
  222 + Workbook workbook, Row row, short columnIndex) {
  223 + return createCell(
  224 + workbook, row, columnIndex,
  225 + null, XSSFCell.CELL_TYPE_BLANK,
  226 + HorizontalAlignment.CENTER, VerticalAlignment.CENTER,
  227 + BorderStyle.MEDIUM, new Color(0xdedede),
  228 + (short) 13, new Color(0x2765A7), "宋体",
  229 + new Color(0xffffff), FillPatternType.SOLID_FOREGROUND
  230 + );
  231 + }
  232 +
  233 + @Override
  234 + public Cell setCellDataFormat(Workbook workbook, Cell cell, String fmt) {
  235 + XSSFWorkbook xssfWorkbook = (XSSFWorkbook) workbook;
  236 + DataFormat dataFormat = xssfWorkbook.createDataFormat();
  237 + cell.getCellStyle().setDataFormat(dataFormat.getFormat(fmt));
  238 + return cell;
  239 + }
  240 +
  241 + @Override
  242 + public Cell setCellBackground(Cell cell, Color color) {
  243 + XSSFCell xssfCell = (XSSFCell) cell;
  244 + xssfCell.getCellStyle().setFillForegroundColor(new XSSFColor(color));
  245 + return cell;
  246 + }
  247 +
  248 + @Override
  249 + public Workbook createWorkBook() {
  250 + return new XSSFWorkbook();
  251 + }
  252 +
  253 + @Override
  254 + public Sheet createWorkBookSheet(Workbook workbook, String sheetName) {
  255 + return workbook.createSheet(WorkbookUtil.createSafeSheetName(sheetName));
  256 + }
  257 +
  258 + @Override
  259 + public Row createSheetRow(Sheet sheet, int rowIndex) {
  260 + XSSFSheet xssfSheet = (XSSFSheet) sheet;
  261 + return xssfSheet.createRow(rowIndex);
  262 + }
  263 +
  264 + @Override
  265 + public void writeExcel(File excelFile, Workbook workbook) {
  266 + try {
  267 + XSSFWorkbook xssfWorkbook = (XSSFWorkbook) workbook;
  268 + FileOutputStream fileOutputStream = new FileOutputStream(excelFile);
  269 + xssfWorkbook.write(fileOutputStream);
  270 + } catch (Exception exp) {
  271 + throw new RuntimeException(exp);
  272 + }
  273 +
  274 + }
  275 +}
src/main/java/com/bsth/service/schedule/datatools/ExcelPoiOperator.java 0 → 100644
  1 +package com.bsth.service.schedule.datatools;
  2 +
  3 +import org.apache.poi.ss.usermodel.*;
  4 +
  5 +import java.awt.Color;
  6 +import java.io.File;
  7 +
  8 +/**
  9 + * Excel表格Poi操作接口。
  10 + */
  11 +public interface ExcelPoiOperator {
  12 +
  13 +
  14 + //---------------- 创建单元格 ---------------//
  15 +
  16 + Cell createCell(
  17 + Workbook workbook, Row row, short columnIndex,
  18 + Object value, int valueType,
  19 + HorizontalAlignment horizontalAlignment, VerticalAlignment verticalAlignment,
  20 + BorderStyle borderStyle, java.awt.Color borderColor,
  21 + short fontSize, java.awt.Color fontColor, String fontName,
  22 + java.awt.Color backgroudColor, FillPatternType fillPatternType
  23 + );
  24 +
  25 + Cell createStringCell(
  26 + Workbook workbook, Row row, short columnIndex,
  27 + String value
  28 + );
  29 +
  30 + Cell createStringCell(
  31 + Workbook workbook, Row row, short columnIndex,
  32 + String value,
  33 + java.awt.Color backgroudColor
  34 + );
  35 +
  36 + Cell createIntegerCell(
  37 + Workbook workbook, Row row, short columnIndex,
  38 + Integer value
  39 + );
  40 +
  41 + Cell createIntegerCell(
  42 + Workbook workbook, Row row, short columnIndex,
  43 + Integer value,
  44 + java.awt.Color backgroudColor
  45 + );
  46 +
  47 + Cell createDoubleCell(
  48 + Workbook workbook, Row row, short columnIndex,
  49 + Double value
  50 + );
  51 +
  52 + Cell createDoubleCell(
  53 + Workbook workbook, Row row, short columnIndex,
  54 + Double value,
  55 + java.awt.Color backgroudColor
  56 + );
  57 +
  58 + Cell createBlankCell(
  59 + Workbook workbook, Row row, short columnIndex
  60 + );
  61 +
  62 + //---------------- 创建单元格数据格式 ---------------//
  63 +
  64 + Cell setCellDataFormat(Workbook workbook, Cell cell, String fmt);
  65 +
  66 + Cell setCellBackground(Cell cell, Color color);
  67 +
  68 + //---------------- 创建workbook,sheet,row ---------------//
  69 + Workbook createWorkBook();
  70 + Sheet createWorkBookSheet(Workbook workbook, String sheetName);
  71 + Row createSheetRow(Sheet sheet, int rowIndex);
  72 +
  73 + //---------------- 生成文件 ---------------//
  74 + void writeExcel(File excelFile, Workbook workbook);
  75 +}
src/main/java/com/bsth/service/schedule/datatools/TTInfoDetailDataToolsImpl.java
@@ -14,10 +14,6 @@ import org.apache.commons.lang3.StringUtils; @@ -14,10 +14,6 @@ import org.apache.commons.lang3.StringUtils;
14 import org.apache.poi.ss.usermodel.Cell; 14 import org.apache.poi.ss.usermodel.Cell;
15 import org.apache.poi.ss.usermodel.Row; 15 import org.apache.poi.ss.usermodel.Row;
16 import org.apache.poi.ss.util.CellRangeAddress; 16 import org.apache.poi.ss.util.CellRangeAddress;
17 -import org.apache.poi.ss.util.WorkbookUtil;  
18 -import org.apache.poi.xssf.usermodel.XSSFCell;  
19 -import org.apache.poi.xssf.usermodel.XSSFRow;  
20 -import org.apache.poi.xssf.usermodel.XSSFSheet;  
21 import org.apache.poi.xssf.usermodel.XSSFWorkbook; 17 import org.apache.poi.xssf.usermodel.XSSFWorkbook;
22 import org.joda.time.DateTime; 18 import org.joda.time.DateTime;
23 import org.joda.time.LocalTime; 19 import org.joda.time.LocalTime;
@@ -31,7 +27,6 @@ import org.springframework.stereotype.Service; @@ -31,7 +27,6 @@ import org.springframework.stereotype.Service;
31 27
32 import java.awt.*; 28 import java.awt.*;
33 import java.io.File; 29 import java.io.File;
34 -import java.io.FileOutputStream;  
35 import java.io.PrintWriter; 30 import java.io.PrintWriter;
36 import java.io.StringWriter; 31 import java.io.StringWriter;
37 import java.util.*; 32 import java.util.*;
@@ -438,14 +433,14 @@ public class TTInfoDetailDataToolsImpl implements DataToolsService, TTInfoDetail @@ -438,14 +433,14 @@ public class TTInfoDetailDataToolsImpl implements DataToolsService, TTInfoDetail
438 } 433 }
439 } 434 }
440 435
441 - private void createDynamicTTinfoStatSheet(XSSFWorkbook wb, DTInfos dtInfos) {  
442 - XSSFSheet sheet = wb.createSheet(WorkbookUtil.createSafeSheetName("时刻表信息_统计")); 436 + private void createDynamicTTinfoStatSheet(org.apache.poi.ss.usermodel.Workbook wb, DTInfos dtInfos, ExcelPoiOperator excelPoiOperator) {
  437 + org.apache.poi.ss.usermodel.Sheet sheet = excelPoiOperator.createWorkBookSheet(wb, "时刻表信息_统计");
443 438
444 //-------------------------------- 1、路牌班次数据 -------------------------------// 439 //-------------------------------- 1、路牌班次数据 -------------------------------//
445 List<LpObj> lpObjList = dtInfos.getLpObjList(); 440 List<LpObj> lpObjList = dtInfos.getLpObjList();
446 441
447 // 构建第一行数据 442 // 构建第一行数据
448 - XSSFRow lpHeadRow = sheet.createRow((short) 0); 443 + Row lpHeadRow = excelPoiOperator.createSheetRow(sheet, 0);
449 if (lpObjList.size() == 0) { 444 if (lpObjList.size() == 0) {
450 throw new RuntimeException("没有班次数据!"); 445 throw new RuntimeException("没有班次数据!");
451 } 446 }
@@ -455,40 +450,36 @@ public class TTInfoDetailDataToolsImpl implements DataToolsService, TTInfoDetail @@ -455,40 +450,36 @@ public class TTInfoDetailDataToolsImpl implements DataToolsService, TTInfoDetail
455 } 450 }
456 451
457 // 构造表头 452 // 构造表头
458 - PoiUtils.createStringXSSFCell(wb, lpHeadRow, (short)0, "路牌", new Color(0x96b9d7)); 453 + excelPoiOperator.createStringCell(wb, lpHeadRow, (short) 0, "路牌", new Color(0x96b9d7));
  454 +
459 StationRoute station1 = stationRouteService.findById(lpObjList.get(0).getStationRouteId1()); 455 StationRoute station1 = stationRouteService.findById(lpObjList.get(0).getStationRouteId1());
460 StationRoute station2 = stationRouteService.findById(lpObjList.get(1).getStationRouteId2()); 456 StationRoute station2 = stationRouteService.findById(lpObjList.get(1).getStationRouteId2());
461 for (int i = 0; i < groupCount; i++) { 457 for (int i = 0; i < groupCount; i++) {
462 - PoiUtils.createStringXSSFCell(wb, lpHeadRow, (short) (i * 2 + 1),  
463 - station1.getStationName(), new Color(0x96b9d7));  
464 - PoiUtils.createStringXSSFCell(wb, lpHeadRow, (short) (i * 2 + 2),  
465 - station2.getStationName(), new Color(0x96b9d7)); 458 + excelPoiOperator.createStringCell(wb, lpHeadRow, (short) (i * 2 + 1), station1.getStationName(), new Color(0x96b9d7));
  459 + excelPoiOperator.createStringCell(wb, lpHeadRow, (short) (i * 2 + 2), station2.getStationName(), new Color(0x96b9d7));
466 } 460 }
467 - PoiUtils.createStringXSSFCell(wb, lpHeadRow, (short) (groupCount * 2 + 1),  
468 - "路牌工时", new Color(0x96b9d7));  
469 - PoiUtils.createStringXSSFCell(wb, lpHeadRow, (short) (groupCount * 2 + 2),  
470 - "营运班次数", new Color(0x96b9d7)); 461 + excelPoiOperator.createStringCell(wb, lpHeadRow, (short) (groupCount * 2 + 1), "路牌工时", new Color(0x96b9d7));
  462 + excelPoiOperator.createStringCell(wb, lpHeadRow, (short) (groupCount * 2 + 2), "营运班次数", new Color(0x96b9d7));
471 463
472 // 构建每个路牌的班次数据 464 // 构建每个路牌的班次数据
473 for (int i = 0; i < lpObjList.size(); i++) { 465 for (int i = 0; i < lpObjList.size(); i++) {
474 LpObj lpObj = lpObjList.get(i); 466 LpObj lpObj = lpObjList.get(i);
475 - XSSFRow lpRow = sheet.createRow((short) (i + 1));  
476 - PoiUtils.createStringXSSFCell(wb, lpRow, (short) 0, lpObj.getLpname()); 467 + Row lpRow = excelPoiOperator.createSheetRow(sheet, i + 1);
  468 + excelPoiOperator.createStringCell(wb, lpRow, (short) 0, lpObj.getLpname());
477 for (int j = 0; j < groupCount; j++) { 469 for (int j = 0; j < groupCount; j++) {
478 - PoiUtils.createBlankXSSFCell(wb, lpRow, (short) (j * 2 + 1));  
479 - PoiUtils.createBlankXSSFCell(wb, lpRow, (short) (j * 2 + 2)); 470 + excelPoiOperator.createBlankCell(wb, lpRow, (short) (j * 2 + 1));
  471 + excelPoiOperator.createBlankCell(wb, lpRow, (short) (j * 2 + 2));
480 } 472 }
481 for (BcObj bcObj : lpObj.getBcObjList()) { 473 for (BcObj bcObj : lpObj.getBcObjList()) {
482 if (bcObj.getBcType() == BcType.NORMAL) { 474 if (bcObj.getBcType() == BcType.NORMAL) {
483 - Cell cell = lpRow.getCell((short) (bcObj.getGroupNo() * 2 + bcObj.getGroupBcNo() + 1));  
484 - cell.setCellValue(bcObj.getFcsjDesc()); 475 + lpRow.getCell((short) (bcObj.getGroupNo() * 2 + bcObj.getGroupBcNo() + 1)).setCellValue(bcObj.getFcsjDesc());
485 } 476 }
486 } 477 }
487 // 路牌工时/班次数 478 // 路牌工时/班次数
488 - PoiUtils.createDoubleXSSFCell(wb, lpRow, (short) (groupCount * 2 + 1), 479 + excelPoiOperator.createDoubleCell(wb, lpRow, (short) (groupCount * 2 + 1),
489 lpObj.getZgs() / 60); 480 lpObj.getZgs() / 60);
490 // 营运班次数 481 // 营运班次数
491 - PoiUtils.createIntegerXSSFCell(wb, lpRow, (short) (groupCount * 2 + 2), 482 + excelPoiOperator.createIntegerCell(wb, lpRow, (short) (groupCount * 2 + 2),
492 lpObj.getZbc()); 483 lpObj.getZbc());
493 } 484 }
494 485
@@ -514,9 +505,9 @@ public class TTInfoDetailDataToolsImpl implements DataToolsService, TTInfoDetail @@ -514,9 +505,9 @@ public class TTInfoDetailDataToolsImpl implements DataToolsService, TTInfoDetail
514 505
515 int startrow = lpObjList.size() + 3; 506 int startrow = lpObjList.size() + 3;
516 for (int i = startrow; i <= startrow + 22; i++) { 507 for (int i = startrow; i <= startrow + 22; i++) {
517 - XSSFRow xssfRow = sheet.createRow(i); 508 + Row row = excelPoiOperator.createSheetRow(sheet, i);
518 for (int j = 0; j < 10; j++) { 509 for (int j = 0; j < 10; j++) {
519 - PoiUtils.createStringXSSFCell(wb, xssfRow, (short) j, ""); 510 + excelPoiOperator.createStringCell(wb, row, (short) j, "");
520 511
521 } 512 }
522 } 513 }
@@ -537,27 +528,27 @@ public class TTInfoDetailDataToolsImpl implements DataToolsService, TTInfoDetail @@ -537,27 +528,27 @@ public class TTInfoDetailDataToolsImpl implements DataToolsService, TTInfoDetail
537 StatInfo statInfo = statInfos.get(i); 528 StatInfo statInfo = statInfos.get(i);
538 529
539 // 1、统计序号 530 // 1、统计序号
540 - PoiUtils.setIntegerStyleXSSFCellStyle(wb, sheet.getRow(startrow + 2 + i).getCell(0)); 531 + excelPoiOperator.setCellDataFormat(wb, sheet.getRow(startrow + 2 + i).getCell(0), "0");
541 sheet.getRow(startrow + 2 + i).getCell(0).setCellValue(i); 532 sheet.getRow(startrow + 2 + i).getCell(0).setCellValue(i);
542 533
543 // 2、统计项目 534 // 2、统计项目
544 sheet.getRow(startrow + 2 + i).getCell(1).setCellValue(statInfo.getStatItem()); 535 sheet.getRow(startrow + 2 + i).getCell(1).setCellValue(statInfo.getStatItem());
545 536
546 // 3、统计数值 537 // 3、统计数值
547 - PoiUtils.setDoubleStyleXSSFCellStyle(wb, sheet.getRow(startrow + 2 + i).getCell(9)); 538 + excelPoiOperator.setCellDataFormat(wb, sheet.getRow(startrow + 2 + i).getCell(9), "0.00");
548 sheet.getRow(startrow + 2 + i).getCell(9).setCellValue(statInfo.getStatValue()); 539 sheet.getRow(startrow + 2 + i).getCell(9).setCellValue(statInfo.getStatValue());
549 } 540 }
550 541
551 } 542 }
552 543
553 - private void createDynamicTTinfoSheet(XSSFWorkbook wb, DTInfos dtInfos) {  
554 - XSSFSheet sheet = wb.createSheet(WorkbookUtil.createSafeSheetName("时刻表信息")); 544 + private void createDynamicTTinfoSheet(org.apache.poi.ss.usermodel.Workbook wb, DTInfos dtInfos, ExcelPoiOperator excelPoiOperator) {
  545 + org.apache.poi.ss.usermodel.Sheet sheet = excelPoiOperator.createWorkBookSheet(wb, "时刻表信息");
555 546
556 //-------------------------------- 1、路牌班次数据 -------------------------------// 547 //-------------------------------- 1、路牌班次数据 -------------------------------//
557 List<LpObj> lpObjList = dtInfos.getLpObjList(); 548 List<LpObj> lpObjList = dtInfos.getLpObjList();
558 549
559 // 构建第一行数据 550 // 构建第一行数据
560 - XSSFRow lpHeadRow = sheet.createRow((short) 0); 551 + Row lpHeadRow = excelPoiOperator.createSheetRow(sheet, 0);
561 if (lpObjList.size() == 0) { 552 if (lpObjList.size() == 0) {
562 throw new RuntimeException("没有班次数据!"); 553 throw new RuntimeException("没有班次数据!");
563 } 554 }
@@ -567,72 +558,61 @@ public class TTInfoDetailDataToolsImpl implements DataToolsService, TTInfoDetail @@ -567,72 +558,61 @@ public class TTInfoDetailDataToolsImpl implements DataToolsService, TTInfoDetail
567 } 558 }
568 559
569 // 构造表头,添加一个进场,添加一个出场 560 // 构造表头,添加一个进场,添加一个出场
570 - PoiUtils.createStringXSSFCell(wb, lpHeadRow, (short)0, "路牌", new Color(0x96b9d7)); 561 +
  562 + excelPoiOperator.createStringCell(wb, lpHeadRow, (short) 0, "路牌", new Color(0x96b9d7));
  563 + excelPoiOperator.createStringCell(wb, lpHeadRow, (short) 1, "报到", new Color(0x96b9d7));
  564 + excelPoiOperator.createStringCell(wb, lpHeadRow, (short) 2, "出场", new Color(0x96b9d7));
  565 +
  566 +
571 StationRoute station1 = stationRouteService.findById(lpObjList.get(0).getStationRouteId1()); 567 StationRoute station1 = stationRouteService.findById(lpObjList.get(0).getStationRouteId1());
572 StationRoute station2 = stationRouteService.findById(lpObjList.get(1).getStationRouteId2()); 568 StationRoute station2 = stationRouteService.findById(lpObjList.get(1).getStationRouteId2());
573 - PoiUtils.createStringXSSFCell(wb, lpHeadRow, (short) (1),  
574 - "报到", new Color(0x96b9d7));  
575 - PoiUtils.createStringXSSFCell(wb, lpHeadRow, (short) (2),  
576 - "出场", new Color(0x96b9d7));  
577 for (int i = 1; i <= groupCount; i++) { 569 for (int i = 1; i <= groupCount; i++) {
578 - PoiUtils.createStringXSSFCell(wb, lpHeadRow, (short) (i * 2 + 1),  
579 - station1.getStationName(), new Color(0x96b9d7));  
580 - PoiUtils.createStringXSSFCell(wb, lpHeadRow, (short) (i * 2 + 2),  
581 - station2.getStationName(), new Color(0x96b9d7)); 570 + excelPoiOperator.createStringCell(wb, lpHeadRow, (short) (i * 2 + 1), station1.getStationName(), new Color(0x96b9d7));
  571 + excelPoiOperator.createStringCell(wb, lpHeadRow, (short) (i * 2 + 2), station2.getStationName(), new Color(0x96b9d7));
582 } 572 }
583 573
584 // 最后一个进场需要变成三个班次 574 // 最后一个进场需要变成三个班次
585 // 1个分班进场班次插入到前面的班次 575 // 1个分班进场班次插入到前面的班次
586 // 后面添加两个班次,1个到场班次,1个离场班次 576 // 后面添加两个班次,1个到场班次,1个离场班次
587 - PoiUtils.createStringXSSFCell(wb, lpHeadRow, (short) (groupCount * 2 + 3),  
588 - "到场", new Color(0x96b9d7));  
589 - PoiUtils.createStringXSSFCell(wb, lpHeadRow, (short) (groupCount * 2 + 4),  
590 - "离场", new Color(0x96b9d7)); 577 + excelPoiOperator.createStringCell(wb, lpHeadRow, (short) (groupCount * 2 + 3), "到场", new Color(0x96b9d7));
  578 + excelPoiOperator.createStringCell(wb, lpHeadRow, (short) (groupCount * 2 + 4), "离场", new Color(0x96b9d7));
591 579
592 // 路牌统计字段 580 // 路牌统计字段
593 - PoiUtils.createStringXSSFCell(wb, lpHeadRow, (short) (groupCount * 2 + 5),  
594 - "总公里", new Color(0x96b9d7));  
595 - PoiUtils.createStringXSSFCell(wb, lpHeadRow, (short) (groupCount * 2 + 6),  
596 - "营业公里", new Color(0x96b9d7));  
597 - PoiUtils.createStringXSSFCell(wb, lpHeadRow, (short) (groupCount * 2 + 7),  
598 - "空驶公里", new Color(0x96b9d7));  
599 - PoiUtils.createStringXSSFCell(wb, lpHeadRow, (short) (groupCount * 2 + 8),  
600 - "总工时", new Color(0x96b9d7));  
601 - PoiUtils.createStringXSSFCell(wb, lpHeadRow, (short) (groupCount * 2 + 9),  
602 - "营业工时", new Color(0x96b9d7));  
603 - PoiUtils.createStringXSSFCell(wb, lpHeadRow, (short) (groupCount * 2 + 10),  
604 - "营运班次", new Color(0x96b9d7)); 581 + excelPoiOperator.createStringCell(wb, lpHeadRow, (short) (groupCount * 2 + 5), "总公里", new Color(0x96b9d7));
  582 + excelPoiOperator.createStringCell(wb, lpHeadRow, (short) (groupCount * 2 + 6), "营业公里", new Color(0x96b9d7));
  583 + excelPoiOperator.createStringCell(wb, lpHeadRow, (short) (groupCount * 2 + 7), "空驶公里", new Color(0x96b9d7));
  584 + excelPoiOperator.createStringCell(wb, lpHeadRow, (short) (groupCount * 2 + 8), "总工时", new Color(0x96b9d7));
  585 + excelPoiOperator.createStringCell(wb, lpHeadRow, (short) (groupCount * 2 + 9), "营业工时", new Color(0x96b9d7));
  586 + excelPoiOperator.createStringCell(wb, lpHeadRow, (short) (groupCount * 2 + 10), "营运班次", new Color(0x96b9d7));
605 587
606 // 构建每个路牌的班次数据 588 // 构建每个路牌的班次数据
  589 + Cell cell = null;
607 for (int i = 0; i < lpObjList.size(); i++) { 590 for (int i = 0; i < lpObjList.size(); i++) {
608 LpObj lpObj = lpObjList.get(i); 591 LpObj lpObj = lpObjList.get(i);
609 - XSSFRow lpRow = sheet.createRow((short) (i + 1));  
610 - PoiUtils.createStringXSSFCell(wb, lpRow, (short) 0, lpObj.getLpname()); 592 + Row lpRow = excelPoiOperator.createSheetRow(sheet, i + 1);
  593 + excelPoiOperator.createStringCell(wb, lpRow, (short) 0, lpObj.getLpname());
611 594
612 // 创建空白单元格,并设置字符串格式 595 // 创建空白单元格,并设置字符串格式
613 - XSSFCell xssfCell = null; 596 + cell = excelPoiOperator.createBlankCell(wb, lpRow, (short) 1);
  597 + excelPoiOperator.setCellDataFormat(wb, cell, "@");
614 598
615 - xssfCell = PoiUtils.createBlankXSSFCell(wb, lpRow, (short) (1));  
616 - PoiUtils.setStringStyleXSSFCellStyle(wb, xssfCell);  
617 -  
618 - xssfCell = PoiUtils.createBlankXSSFCell(wb, lpRow, (short) (2));  
619 - PoiUtils.setStringStyleXSSFCellStyle(wb, xssfCell); 599 + cell = excelPoiOperator.createBlankCell(wb, lpRow, (short) 2);
  600 + excelPoiOperator.setCellDataFormat(wb, cell, "@");
620 601
621 for (int j = 1; j <= groupCount; j++) { 602 for (int j = 1; j <= groupCount; j++) {
622 - xssfCell = PoiUtils.createBlankXSSFCell(wb, lpRow, (short) (j * 2 + 1));  
623 - PoiUtils.setStringStyleXSSFCellStyle(wb, xssfCell);  
624 - xssfCell = PoiUtils.createBlankXSSFCell(wb, lpRow, (short) (j * 2 + 2));  
625 - PoiUtils.setStringStyleXSSFCellStyle(wb, xssfCell); 603 + cell = excelPoiOperator.createBlankCell(wb, lpRow, (short) (j * 2 + 1));
  604 + excelPoiOperator.setCellDataFormat(wb, cell, "@");
  605 + cell = excelPoiOperator.createBlankCell(wb, lpRow, (short) (j * 2 + 2));
  606 + excelPoiOperator.setCellDataFormat(wb, cell, "@");
626 } 607 }
627 608
628 - xssfCell = PoiUtils.createBlankXSSFCell(wb, lpRow, (short) (groupCount * 2 + 3));  
629 - PoiUtils.setStringStyleXSSFCellStyle(wb, xssfCell);  
630 - xssfCell = PoiUtils.createBlankXSSFCell(wb, lpRow, (short) (groupCount * 2 + 4));  
631 - PoiUtils.setStringStyleXSSFCellStyle(wb, xssfCell); 609 + cell = excelPoiOperator.createBlankCell(wb, lpRow, (short) (groupCount * 2 + 3));
  610 + excelPoiOperator.setCellDataFormat(wb, cell, "@");
  611 + cell = excelPoiOperator.createBlankCell(wb, lpRow, (short) (groupCount * 2 + 4));
  612 + excelPoiOperator.setCellDataFormat(wb, cell, "@");
632 613
633 for (int j = 0; j < lpObj.getBcObjList().size(); j++) { 614 for (int j = 0; j < lpObj.getBcObjList().size(); j++) {
634 BcObj bcObj = lpObj.getBcObjList().get(j); // 当前班次 615 BcObj bcObj = lpObj.getBcObjList().get(j); // 当前班次
635 - Cell cell = null; // 待处理的单元格  
636 616
637 switch (bcObj.getBcType()) { 617 switch (bcObj.getBcType()) {
638 case BD: // 报到班次 618 case BD: // 报到班次
@@ -680,14 +660,16 @@ public class TTInfoDetailDataToolsImpl implements DataToolsService, TTInfoDetail @@ -680,14 +660,16 @@ public class TTInfoDetailDataToolsImpl implements DataToolsService, TTInfoDetail
680 } 660 }
681 661
682 // 路牌统计字段 662 // 路牌统计字段
683 - PoiUtils.createDoubleXSSFCell(wb, lpRow, (short) (groupCount * 2 + 5), lpObj.getZlc());  
684 - PoiUtils.createDoubleXSSFCell(wb, lpRow, (short) (groupCount * 2 + 6), lpObj.getYylc());  
685 - PoiUtils.createDoubleXSSFCell(wb, lpRow, (short) (groupCount * 2 + 7), lpObj.getKslc());  
686 - PoiUtils.createStringXSSFCell(wb, lpRow, (short) (groupCount * 2 + 8), 663 + excelPoiOperator.createDoubleCell(wb, lpRow, (short) (groupCount * 2 + 5), lpObj.getZlc());
  664 + excelPoiOperator.createDoubleCell(wb, lpRow, (short) (groupCount * 2 + 6), lpObj.getYylc());
  665 + excelPoiOperator.createDoubleCell(wb, lpRow, (short) (groupCount * 2 + 7), lpObj.getKslc());
  666 + cell = excelPoiOperator.createStringCell(wb, lpRow, (short) (groupCount * 2 + 8),
687 String.format("%d%s%d", (int) (lpObj.getZgs() / 60), ":", (int) (lpObj.getZgs() % 60))); 667 String.format("%d%s%d", (int) (lpObj.getZgs() / 60), ":", (int) (lpObj.getZgs() % 60)));
688 - PoiUtils.createStringXSSFCell(wb, lpRow, (short) (groupCount * 2 + 9), 668 + excelPoiOperator.setCellDataFormat(wb, cell, "[h]:mm");
  669 + cell = excelPoiOperator.createStringCell(wb, lpRow, (short) (groupCount * 2 + 9),
689 String.format("%d%s%d", (int) (lpObj.getYygs() / 60), ":", (int) (lpObj.getYygs() % 60))); 670 String.format("%d%s%d", (int) (lpObj.getYygs() / 60), ":", (int) (lpObj.getYygs() % 60)));
690 - PoiUtils.createIntegerXSSFCell(wb, lpRow, (short) (groupCount * 2 + 10), lpObj.getYybc()); 671 + excelPoiOperator.setCellDataFormat(wb, cell, "[h]:mm");
  672 + excelPoiOperator.createIntegerCell(wb, lpRow, (short) (groupCount * 2 + 10), lpObj.getYybc());
691 673
692 } 674 }
693 675
@@ -710,24 +692,33 @@ public class TTInfoDetailDataToolsImpl implements DataToolsService, TTInfoDetail @@ -710,24 +692,33 @@ public class TTInfoDetailDataToolsImpl implements DataToolsService, TTInfoDetail
710 } 692 }
711 693
712 @Override 694 @Override
713 - public DataToolsFile exportDynamicTTinfo(DTInfos dtInfos) throws ScheduleException { 695 + public DataToolsFile exportDynamicTTinfo(DTInfos dtInfos, DataToolsFileType type) throws ScheduleException {
714 try { 696 try {
  697 + ExcelPoiOperator excelPoiOperator;
  698 + if (type == DataToolsFileType.XLS) {
  699 + excelPoiOperator = new Excel2003PoiOperator();
  700 + } else if (type == DataToolsFileType.XLSX) {
  701 + excelPoiOperator = new Excel2007PoiOperator();
  702 + } else {
  703 + throw new RuntimeException("未知的导出格式==>" + type);
  704 + }
  705 +
715 // 使用POI,创建xlsx文件 706 // 使用POI,创建xlsx文件
716 - XSSFWorkbook wb = new XSSFWorkbook();  
717 - this.createDynamicTTinfoSheet(wb, dtInfos);  
718 - this.createDynamicTTinfoStatSheet(wb, dtInfos); 707 + org.apache.poi.ss.usermodel.Workbook wb = excelPoiOperator.createWorkBook();
  708 + this.createDynamicTTinfoSheet(wb, dtInfos, excelPoiOperator);
  709 + this.createDynamicTTinfoStatSheet(wb, dtInfos, excelPoiOperator);
719 710
720 // wb内存写入文件 711 // wb内存写入文件
721 String filepath = dataToolsProperties.getFileoutputDir() + 712 String filepath = dataToolsProperties.getFileoutputDir() +
722 File.separator + 713 File.separator +
723 "动态时刻表-" + 714 "动态时刻表-" +
724 new DateTime().toString("yyyyMMddHHmmss") + ".xlsx"; 715 new DateTime().toString("yyyyMMddHHmmss") + ".xlsx";
725 - FileOutputStream fileOut = new FileOutputStream(filepath);  
726 - wb.write(fileOut); 716 + File file = new File(filepath);
  717 + excelPoiOperator.writeExcel(file, wb);
727 718
728 DataToolsFile dataToolsFile = new DataToolsFile(); 719 DataToolsFile dataToolsFile = new DataToolsFile();
729 dataToolsFile.setFileType(DataToolsFileType.XLSX); 720 dataToolsFile.setFileType(DataToolsFileType.XLSX);
730 - dataToolsFile.setFile(new File(filepath)); 721 + dataToolsFile.setFile(file);
731 722
732 return dataToolsFile; 723 return dataToolsFile;
733 724
src/main/java/com/bsth/service/schedule/datatools/TTinfoDetailDynamicData.java
@@ -2,6 +2,7 @@ package com.bsth.service.schedule.datatools; @@ -2,6 +2,7 @@ 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.DataToolsFile; 4 import com.bsth.service.schedule.utils.DataToolsFile;
  5 +import com.bsth.service.schedule.utils.DataToolsFileType;
5 import com.fasterxml.jackson.annotation.JsonCreator; 6 import com.fasterxml.jackson.annotation.JsonCreator;
6 import com.fasterxml.jackson.annotation.JsonValue; 7 import com.fasterxml.jackson.annotation.JsonValue;
7 8
@@ -374,5 +375,5 @@ public interface TTinfoDetailDynamicData { @@ -374,5 +375,5 @@ public interface TTinfoDetailDynamicData {
374 * @return 375 * @return
375 * @throws ScheduleException 376 * @throws ScheduleException
376 */ 377 */
377 - public DataToolsFile exportDynamicTTinfo(DTInfos dtInfos) throws ScheduleException;  
378 -}  
379 \ No newline at end of file 378 \ No newline at end of file
  379 + public DataToolsFile exportDynamicTTinfo(DTInfos dtInfos, DataToolsFileType type) throws ScheduleException;
  380 +}
src/main/java/com/bsth/service/schedule/impl/PeopleCarPlanServiceImpl.java
@@ -323,6 +323,7 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService { @@ -323,6 +323,7 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService {
323 String line = map.get("line").toString(); 323 String line = map.get("line").toString();
324 String date = map.get("date").toString(); 324 String date = map.get("date").toString();
325 String type = map.get("type").toString(); 325 String type = map.get("type").toString();
  326 + String lineName = "";
326 327
327 if(date.length() == 0){ 328 if(date.length() == 0){
328 date = new SimpleDateFormat("yyyy-MM-dd").format(new Date()); 329 date = new SimpleDateFormat("yyyy-MM-dd").format(new Date());
@@ -332,6 +333,13 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService { @@ -332,6 +333,13 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService {
332 333
333 Map<String, List<ScheduleRealInfo>> keyMap = new HashMap<String, List<ScheduleRealInfo>>(); 334 Map<String, List<ScheduleRealInfo>> keyMap = new HashMap<String, List<ScheduleRealInfo>>();
334 for(ScheduleRealInfo schedule : list){ 335 for(ScheduleRealInfo schedule : list){
  336 + if(lineName.length() == 0){
  337 + if(line.length() > 0 && schedule.getXlName()!=null){
  338 + lineName = schedule.getXlName();
  339 + } else if(schedule.getFgsName()!=null){
  340 + lineName = schedule.getFgsName();
  341 + }
  342 + }
335 String key = schedule.getXlName(); 343 String key = schedule.getXlName();
336 if(key == null || key.trim().equals("") || lineSet.contains(key)) 344 if(key == null || key.trim().equals("") || lineSet.contains(key))
337 continue; 345 continue;
@@ -341,7 +349,7 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService { @@ -341,7 +349,7 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService {
341 keyMap.get(key).add(schedule); 349 keyMap.get(key).add(schedule);
342 } 350 }
343 351
344 - SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-ddHH:mm"); 352 +// SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-ddHH:mm");
345 Long zgfBegin = 0l; 353 Long zgfBegin = 0l;
346 Long zgfEnd = 0l; 354 Long zgfEnd = 0l;
347 Long wgfBegin = 0l; 355 Long wgfBegin = 0l;
src/main/java/com/bsth/service/schedule/impl/TTInfoDetailServiceImpl.java
@@ -145,8 +145,8 @@ public class TTInfoDetailServiceImpl extends BServiceImpl&lt;TTInfoDetail, Long&gt; im @@ -145,8 +145,8 @@ public class TTInfoDetailServiceImpl extends BServiceImpl&lt;TTInfoDetail, Long&gt; im
145 } 145 }
146 146
147 @Override 147 @Override
148 - public DataToolsFile exportDynamicTTinfo(TTinfoDetailDynamicData.DTInfos dtInfos) throws ScheduleException {  
149 - return tTinfoDetailDynamicData.exportDynamicTTinfo(dtInfos); 148 + public DataToolsFile exportDynamicTTinfo(TTinfoDetailDynamicData.DTInfos dtInfos, DataToolsFileType type) throws ScheduleException {
  149 + return tTinfoDetailDynamicData.exportDynamicTTinfo(dtInfos, type);
150 } 150 }
151 151
152 @Override 152 @Override
src/main/resources/static/pages/base/timesmodel/gantt.html
@@ -50,9 +50,31 @@ @@ -50,9 +50,31 @@
50 <!--<div class="btn-group btn-group-devided checkbtn" data-toggle="buttons">--> 50 <!--<div class="btn-group btn-group-devided checkbtn" data-toggle="buttons">-->
51 <!--<a class="btn btn-circle blue checkAdd" href="javascript:;" data-pjax><i class="fa fa-check"></i> 保存数据</a>--> 51 <!--<a class="btn btn-circle blue checkAdd" href="javascript:;" data-pjax><i class="fa fa-check"></i> 保存数据</a>-->
52 <!--</div>--> 52 <!--</div>-->
53 - <div class="btn-group btn-group-devided exportbtn" data-toggle="buttons">  
54 - <!--<a class="btn btn-circle blue exportAdd" href="javascript:;" data-pjax><i class="fa fa-file-excel-o"></i> 导出数据</a>--> 53 +
  54 + <div class="btn-group exportbtn">
  55 + <a href="javascript:" class="btn red btn-outline btn-circle exportAdd" data-toggle="dropdown">
  56 + <i class="fa fa-file-excel-o"></i>
  57 + <span class="exportAddSpan">导出数据</span>
  58 + <i class="fa fa-angle-down"></i>
  59 + </a>
  60 + <ul class="dropdown-menu pull-right">
  61 + <li>
  62 + <a href="javascript:" class="tool-action exportAddXls">
  63 + <i class="fa fa-file-excel-o"></i>
  64 + Excel97 xls
  65 + </a>
  66 + </li>
  67 + <li>
  68 + <a href="javascript:" class="tool-action exportAddXlsx">
  69 + <i class="fa fa-file-excel-o"></i>
  70 + Excel2007 xlsx
  71 + </a>
  72 + </li>
  73 + </ul>
55 </div> 74 </div>
  75 +
  76 +
  77 +
56 <div class="btn-group checkbtn"> 78 <div class="btn-group checkbtn">
57 <a href="javascript:" class="btn red btn-outline btn-circle" data-toggle="dropdown" aria-expanded="false"> 79 <a href="javascript:" class="btn red btn-outline btn-circle" data-toggle="dropdown" aria-expanded="false">
58 <i class="fa fa-cog"></i> 80 <i class="fa fa-cog"></i>
src/main/resources/static/pages/base/timesmodel/js/gantt.js
@@ -83,7 +83,6 @@ @@ -83,7 +83,6 @@
83 // TODO:绘制gantt图表 83 // TODO:绘制gantt图表
84 // TODO:var seDate = getksjssj(null,seMap.s); 关联参数必须设置 84 // TODO:var seDate = getksjssj(null,seMap.s); 关联参数必须设置
85 // TODO:CSMap.maxCar 之后要设定一下的 85 // TODO:CSMap.maxCar 之后要设定一下的
86 - $(".exportbtn").html("<a class=\"btn btn-circle blue exportAdd\" href=\"javascript:;\" data-pjax><i class=\"fa fa-file-excel-o\"></i> 导出数据</a>");  
87 data = Main_v2.BXPplaceClassesTime03(_paramObj, CSMap.maxCar); 86 data = Main_v2.BXPplaceClassesTime03(_paramObj, CSMap.maxCar);
88 Main_v2.exportDataConfig(data.aInternalLpObj); 87 Main_v2.exportDataConfig(data.aInternalLpObj);
89 } 88 }
src/main/resources/static/pages/base/timesmodel/js/v2/core/InternalScheduleObj.js
@@ -1548,6 +1548,8 @@ var InternalScheduleObj = function(paramObj, lpArray, factory) { @@ -1548,6 +1548,8 @@ var InternalScheduleObj = function(paramObj, lpArray, factory) {
1548 oLp.fnGetBcChainInfo(0)["e_q"], 1548 oLp.fnGetBcChainInfo(0)["e_q"],
1549 oLp.fnGetBcChainInfo(0)["e_b"] 1549 oLp.fnGetBcChainInfo(0)["e_b"]
1550 ); 1550 );
  1551 + oEndBc.fnSetIsLastBc(false); // 有可能最后一个班次是吃饭班次,重置
  1552 + oEndBc.fnSetEatTime(0); // 有可能最后一个班次是吃饭班次,重置
1551 aOtherBc.push(_factory.createBcObj( 1553 aOtherBc.push(_factory.createBcObj(
1552 oLp, "in", true, 1, 1554 oLp, "in", true, 1,
1553 oEndBc.getArrTimeObj(), 1555 oEndBc.getArrTimeObj(),
src/main/resources/static/pages/base/timesmodel/js/v2/main_v2.js
@@ -821,7 +821,7 @@ var Main_v2 = function() { @@ -821,7 +821,7 @@ var Main_v2 = function() {
821 * @param aInternalLpObj 内部路牌对象列表 821 * @param aInternalLpObj 内部路牌对象列表
822 */ 822 */
823 exportDataConfig: function(aInternalLpObj) { 823 exportDataConfig: function(aInternalLpObj) {
824 - $('.exportAdd').on('click',function() { 824 + $('.exportAddXls').on('click', function() {
825 var aInfos = { 825 var aInfos = {
826 "lpObjList": _funCalcuExportData_lpObjList(aInternalLpObj), // 路牌班次信息列表 826 "lpObjList": _funCalcuExportData_lpObjList(aInternalLpObj), // 路牌班次信息列表
827 "statInfoList": _funCalcuExportData_statInfoList(aInternalLpObj) // 统计项目列表 827 "statInfoList": _funCalcuExportData_statInfoList(aInternalLpObj) // 统计项目列表
@@ -830,12 +830,12 @@ var Main_v2 = function() { @@ -830,12 +830,12 @@ var Main_v2 = function() {
830 console.log(aInfos); 830 console.log(aInfos);
831 831
832 $(".exportAdd").addClass("disabled"); 832 $(".exportAdd").addClass("disabled");
833 - $(".exportAdd").html("<i class=\"fa fa-spinner\" aria-hidden=\"true\"></i>" + " 正在导出..."); 833 + $(".exportAddSpan").html("正在导出...");
834 834
835 // 提交 835 // 提交
836 $.ajax({ 836 $.ajax({
837 type: 'POST', 837 type: 'POST',
838 - url: "/tidc/exportDTDFile", 838 + url: "/tidc/exportDTDFile/xls",
839 dataType: 'binary', 839 dataType: 'binary',
840 contentType: "application/json", 840 contentType: "application/json",
841 data: JSON.stringify(aInfos), 841 data: JSON.stringify(aInfos),
@@ -843,16 +843,48 @@ var Main_v2 = function() { @@ -843,16 +843,48 @@ var Main_v2 = function() {
843 Main_v2.downloadFile(data, "application/octet-stream", "时刻表信息.xls"); 843 Main_v2.downloadFile(data, "application/octet-stream", "时刻表信息.xls");
844 844
845 $(".exportAdd").removeClass("disabled"); 845 $(".exportAdd").removeClass("disabled");
846 - $(".exportAdd").html("<i class=\"fa fa-file-excel-o\"></i>" + " 导出数据"); 846 + $(".exportAddSpan").html(" 导出数据");
847 }, 847 },
848 error: function(xhr, type){ 848 error: function(xhr, type){
849 alert('错误:TODO'); 849 alert('错误:TODO');
850 850
851 $(".exportAdd").removeClass("disabled"); 851 $(".exportAdd").removeClass("disabled");
852 - $(".exportAdd").html("<i class=\"fa fa-file-excel-o\"></i>" + " 导出数据"); 852 + $(".exportAddSpan").html(" 导出数据");
853 } 853 }
854 }); 854 });
  855 + });
  856 +
  857 + $('.exportAddXlsx').on('click', function() {
  858 + var aInfos = {
  859 + "lpObjList": _funCalcuExportData_lpObjList(aInternalLpObj), // 路牌班次信息列表
  860 + "statInfoList": _funCalcuExportData_statInfoList(aInternalLpObj) // 统计项目列表
  861 + };
  862 +
  863 + console.log(aInfos);
  864 +
  865 + $(".exportAdd").addClass("disabled");
  866 + $(".exportAddSpan").html("正在导出...");
  867 +
  868 + // 提交
  869 + $.ajax({
  870 + type: 'POST',
  871 + url: "/tidc/exportDTDFile/xlsx",
  872 + dataType: 'binary',
  873 + contentType: "application/json",
  874 + data: JSON.stringify(aInfos),
  875 + success: function(data){
  876 + Main_v2.downloadFile(data, "application/octet-stream", "时刻表信息.xlsx");
855 877
  878 + $(".exportAdd").removeClass("disabled");
  879 + $(".exportAddSpan").html(" 导出数据");
  880 + },
  881 + error: function(xhr, type){
  882 + alert('错误:TODO');
  883 +
  884 + $(".exportAdd").removeClass("disabled");
  885 + $(".exportAddSpan").html(" 导出数据");
  886 + }
  887 + });
856 }); 888 });
857 }, 889 },
858 890
src/main/resources/static/pages/base/timesmodel/paramadd.html
1 <!-- 统计数据 --> 1 <!-- 统计数据 -->
  2 +<style>
  3 + .form-control:focus {
  4 + border-color: #53ced9;
  5 + }
  6 + .tagsDiv {
  7 + border: 1px solid #c2cad8;
  8 + margin-left: 15px;
  9 + padding: 4px 15px 4px 15px;
  10 + width: 50%;
  11 + }
  12 +</style>
2 <div class="modal fade" id="paramadd_mobal" tabindex="-1" role="basic" aria-hidden="true"> 13 <div class="modal fade" id="paramadd_mobal" tabindex="-1" role="basic" aria-hidden="true">
3 - <div class="modal-dialog" style="margin-left: 200px;">  
4 - <div class="modal-content" style="width: 900px;"> 14 + <div class="modal-dialog" style="margin-left: 100px;">
  15 + <div class="modal-content" style="width: 1000px;">
5 <div class="modal-header"> 16 <div class="modal-header">
6 <button type="button" class="close" data-dismiss="modal" aria-hidden="true"></button> 17 <button type="button" class="close" data-dismiss="modal" aria-hidden="true"></button>
7 <h4 class="modal-title">参数数据 </h4> 18 <h4 class="modal-title">参数数据 </h4>
@@ -318,6 +329,54 @@ @@ -318,6 +329,54 @@
318 </div> 329 </div>
319 </div> 330 </div>
320 331
  332 + <div class="form-group">
  333 + <div class="col-md-6">
  334 + <label class="control-label col-md-5"><span class="required"> * </span>停站类型 :</label>
  335 + <div class="col-md-5 tagsDiv">
  336 + <div class="row" style="margin-left: 15px;">
  337 + <input type="text" value="{{map.stt}}" name="stt" id="stoptype_tagsinput" style="display: none;">
  338 + </div>
  339 +
  340 + <div class="row" style="margin-top: 10px;">
  341 + <label class="control-label col-md-4">停站类型:</label>
  342 + <div class="col-md-8">
  343 + <select name="stopType" class="form-control" id="stopType_id">
  344 + <option value="">-- 请选择停站类型 --</option>
  345 + <option value="0">主站停站</option>
  346 + <option value="1">双向停站</option>
  347 + </select>
  348 + </div>
  349 + </div>
  350 +
  351 + <div class="row" style="margin-top: 10px;">
  352 + <label class="control-label col-md-4">主站:</label>
  353 + <div class="col-md-8">
  354 + <select name="masterStop" class="form-control" id="masterStop_id">
  355 + <option value="">请选择...</option>
  356 + <option value="0">{{map.startStationName}}</option>
  357 + <option value="1">{{map.endStationName}}</option>
  358 + </select>
  359 + </div>
  360 + </div>
  361 +
  362 + <div class="row" style="margin-top: 10px;margin-left: 116px;">
  363 + <a href="javascript:" class="btn red" id="stoptype_tagsinput_add">添加</a>
  364 + </div>
  365 + </div>
  366 +
  367 + </div>
  368 +
  369 + <div class="col-md-6">
  370 + <label class="control-label col-md-5">
  371 + <span class="required"> * </span> 建议高峰配车数 :</label>
  372 + <div class="col-md-5">
  373 + <input type="text" class="form-control" placeholder="车辆数" name="gfjypcs"
  374 + id="gfjypcsInput" min="1" value="{{map.gfjypcs}}">
  375 + </div>
  376 + </div>
  377 +
  378 + </div>
  379 +
321 <!-- 隐藏字段-时间 --> 380 <!-- 隐藏字段-时间 -->
322 <input type="hidden" name="skbName" value="{{map.skbName}}" id="skbName_id"/> 381 <input type="hidden" name="skbName" value="{{map.skbName}}" id="skbName_id"/>
323 <input type="hidden" name="skbmc" value="{{map.skbmc}}" id="skbmc_id"/> 382 <input type="hidden" name="skbmc" value="{{map.skbmc}}" id="skbmc_id"/>
@@ -423,6 +482,8 @@ @@ -423,6 +482,8 @@
423 // 1、 获取表单内容,并序列化 482 // 1、 获取表单内容,并序列化
424 var fp = form.serializeJSON(); 483 var fp = form.serializeJSON();
425 484
  485 + console.log(fp);
  486 +
426 // 2、重新刷新表单数据 487 // 2、重新刷新表单数据
427 var ganttMap = JSON.parse(window.localStorage.Gantt_AgursData); 488 var ganttMap = JSON.parse(window.localStorage.Gantt_AgursData);
428 var key; 489 var key;
@@ -431,6 +492,8 @@ @@ -431,6 +492,8 @@
431 if (ganttMap[key] != fp[key]) { 492 if (ganttMap[key] != fp[key]) {
432 ganttMap[key] = fp[key]; 493 ganttMap[key] = fp[key];
433 } 494 }
  495 + } else {
  496 + ganttMap[key] = fp[key];
434 } 497 }
435 } 498 }
436 window.localStorage.setItem("Gantt_AgursData",JSON.stringify(ganttMap)); 499 window.localStorage.setItem("Gantt_AgursData",JSON.stringify(ganttMap));
@@ -440,7 +503,7 @@ @@ -440,7 +503,7 @@
440 var paramObj = pp[0]; 503 var paramObj = pp[0];
441 var dataMap = pp[1]; 504 var dataMap = pp[1];
442 var csMap = getCSMap(paramObj); 505 var csMap = getCSMap(paramObj);
443 - console.log(graph); 506 + // console.log(graph);
444 var data = Main_v2.BXPplaceClassesTime03(paramObj, csMap.maxCar); 507 var data = Main_v2.BXPplaceClassesTime03(paramObj, csMap.maxCar);
445 Main_v2.exportDataConfig(data.aInternalLpObj); 508 Main_v2.exportDataConfig(data.aInternalLpObj);
446 509
@@ -491,6 +554,8 @@ @@ -491,6 +554,8 @@
491 opt.push("<option value='1'>" + d.stationName + "</option>"); 554 opt.push("<option value='1'>" + d.stationName + "</option>");
492 } 555 }
493 }); 556 });
  557 + initTagsinput(opt.join(","));
  558 +
494 opt.push("<option value='allYes'>起终点站都可以</option>"); 559 opt.push("<option value='allYes'>起终点站都可以</option>");
495 $('#cfdd_id').html(opt.join("")); 560 $('#cfdd_id').html(opt.join(""));
496 $('#cfdd_id').val(param.cfdd); 561 $('#cfdd_id').val(param.cfdd);
@@ -524,10 +589,62 @@ @@ -524,10 +589,62 @@
524 $('#lateStartTime_id').datetimepicker({format : 'HH:mm',locale: 'zh-cn'}); 589 $('#lateStartTime_id').datetimepicker({format : 'HH:mm',locale: 'zh-cn'});
525 $('#lateEndTime_id').datetimepicker({format : 'HH:mm',locale: 'zh-cn'}); 590 $('#lateEndTime_id').datetimepicker({format : 'HH:mm',locale: 'zh-cn'});
526 591
  592 + });
  593 + });
  594 +
  595 + function initTagsinput(htmlStr) {
  596 + $('#masterStop_id').html(htmlStr);
  597 +
  598 + var elt = $('#stoptype_tagsinput');
  599 + var value = elt.val();
  600 + var stoptype = value.split("/")[0];
  601 + var masterstop = value.split("/")[1];
  602 +
  603 + $('#stopType_id').val(stoptype);
  604 + $('#masterStop_id').val(masterstop);
527 605
  606 + elt.tagsinput({
  607 + tagClass: function(item) {
  608 + return 'label label-danger label-important';
  609 + },
  610 + itemValue: 'value',
  611 + itemText: 'text'
  612 + });
528 613
  614 + $('#stoptype_tagsinput').on('beforeItemAdd', function(event) {
  615 + // TODO:这里可以做一些逻辑判定
529 }); 616 });
530 - }); 617 +
  618 + $('#stoptype_tagsinput_add').on('click', function(){
  619 + var stoptype = $("#stopType_id").val();
  620 + var masterstop = $("#masterStop_id").val();
  621 + var masterstop_text = $("#masterStop_id option:selected").text();
  622 +
  623 + if (stoptype && stoptype != "") {
  624 + if (stoptype == "0" && masterstop && masterstop != "") {
  625 + elt.tagsinput('add', {
  626 + "value": stoptype + '/' + masterstop,
  627 + "text": "主站停站" + "/" + masterstop_text
  628 + });
  629 + } else {
  630 + elt.tagsinput('add', {
  631 + "value": 1,
  632 + "text": "双向停站"
  633 + });
  634 + }
  635 + }
  636 + });
  637 +
  638 + if (stoptype && stoptype != "") {
  639 + elt.tagsinput('add', {
  640 + "value": stoptype + '/' + masterstop,
  641 + "text":
  642 + $("#stopType_id option:selected").text() + "/" +
  643 + $("#masterStop_id option:selected").text()
  644 + });
  645 + }
  646 +
  647 + }
531 648
532 function getMinDate(d1,d2) { 649 function getMinDate(d1,d2) {
533 // 1、定义返回字符串. 650 // 1、定义返回字符串.
src/main/resources/static/pages/calc/company/countBusMileage.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 +
  18 + #forms > thead > tr> td >span{
  19 + width: 5px;
  20 + word-wrap: break-word;
  21 + letter-spacing: 20px;
  22 + }
  23 +
  24 + #forms > thead > tr> td >label{
  25 + word-break: keep-all;white-space:nowrap;
  26 + }
  27 +</style>
  28 +
  29 +<div class="page-head">
  30 + <div class="page-title">
  31 + <h1>路单数据统计表</h1>
  32 + </div>
  33 +</div>
  34 +
  35 +<div class="row">
  36 + <div class="col-md-12">
  37 + <div class="portlet light porttlet-fit bordered">
  38 + <div class="portlet-title">
  39 + <form class="form-inline" action="">
  40 + <div style="display: inline-block;margin-left: 28px; " id="gsdmDiv">
  41 + <span class="item-label" style="width: 80px;">公司: </span>
  42 + <select class="form-control" name="company" id="gsdm" style="width: 180px;"></select>
  43 + </div>
  44 + <div style="display: inline-block; margin-left: 29px;" id="fgsdmDiv">
  45 + <span class="item-label" style="width: 80px;">分公司: </span>
  46 + <select class="form-control" name="subCompany" id="fgsdm" style="width: 180px;"></select>
  47 + </div>
  48 + <div style="display: inline-block;margin-left: 43px;">
  49 + <span class="item-label" style="width: 80px;">线路: </span>
  50 + <select class="form-control" name="line" id="line" style="width: 180px;"></select>
  51 + </div>
  52 + <div style="margin-top: 2px"></div>
  53 +
  54 + <div style="display: inline-block;">
  55 + <span class="item-label" style="width: 80px;">开始时间: </span>
  56 + <input class="form-control" type="text" id="date" style="width: 180px;"/>
  57 + </div>
  58 + <div style="display: inline-block;margin-left: 15px;">
  59 + <span class="item-label" style="width: 80px;">结束时间: </span>
  60 + <input class="form-control" type="text" id="date2" style="width: 180px;"/>
  61 + </div>
  62 + <div style="display: inline-block;margin-left: 15px;">
  63 + <span class="item-label" style="width: 80px;">显示分类: </span>
  64 + <select class="form-control" style="width: 120px;" id="zt">
  65 + <option value="zbh">车辆</option>
  66 + <option value="js">驾/售</option>
  67 + </select>
  68 + </div>
  69 + <div class="form-group" style="margin-left: 55px;">
  70 + <input class="btn btn-default" type="button" id="query" value="查询"/>
  71 + <input class="btn btn-default" type="button" id="export" value="导出"/>
  72 + </div>
  73 + </form>
  74 + </div>
  75 + <div class="portlet-body">
  76 + <div class="table-container" id="countLine" style="margin-top: 10px;overflow:auto;min-width: 906px">
  77 + <table class="table table-bordered table-hover table-checkable" id="forms">
  78 +
  79 +
  80 + </table>
  81 + </div>
  82 + </div>
  83 + </div>
  84 + </div>
  85 +</div>
  86 +
  87 +<script>
  88 + $(function(){
  89 + $('#export').attr('disabled', "true");
  90 +
  91 + // 关闭左侧栏
  92 + if (!$('body').hasClass('page-sidebar-closed'))
  93 + $('.menu-toggler.sidebar-toggler').click();
  94 +
  95 + $("#date").datetimepicker({
  96 + format : 'YYYY-MM-DD',
  97 + locale : 'zh-cn'
  98 + });
  99 +
  100 + $("#date2").datetimepicker({
  101 + format : 'YYYY-MM-DD',
  102 + locale : 'zh-cn'
  103 + });
  104 + var d = new Date();
  105 + var year = d.getFullYear();
  106 + var month = d.getMonth() + 1;
  107 + var day = d.getDate();
  108 + if(month < 10)
  109 + month = "0" + month;
  110 + if(day < 10)
  111 + day = "0" + day;
  112 + $("#date").val(year + "-" + month + "-" + day);
  113 +
  114 + $("#date2").val(year + "-" + month + "-" + day);
  115 +
  116 + var fage=false;
  117 + var obj = [];
  118 + var xlList;
  119 + $.get('/report/lineList',function(result){
  120 + xlList=result;
  121 + $.get('/user/companyData', function(result){
  122 + obj = result;
  123 + var options = '';
  124 + for(var i = 0; i < obj.length; i++){
  125 + options += '<option value="'+obj[i].companyCode+'">'+obj[i].companyName+'</option>';
  126 + }
  127 +
  128 + if(obj.length ==0){
  129 + $("#gsdmDiv").css('display','none');
  130 + }else if(obj.length ==1){
  131 + $("#gsdmDiv").css('display','none');
  132 + if(obj[0].children.length == 1 || obj[0].children.length ==0)
  133 + $('#fgsdmDiv').css('display','none');
  134 + }
  135 + $('#gsdm').html(options);
  136 + updateCompany();
  137 + });
  138 + })
  139 + $("#gsdm").on("change",updateCompany);
  140 + function updateCompany(){
  141 + var company = $('#gsdm').val();
  142 + var options = '';
  143 + for(var i = 0; i < obj.length; i++){
  144 + if(obj[i].companyCode == company){
  145 + var children = obj[i].children;
  146 + for(var j = 0; j < children.length; j++){
  147 + options += '<option value="'+children[j].code+'">'+children[j].name+'</option>';
  148 + }
  149 + }
  150 + }
  151 + $('#fgsdm').html(options);
  152 + }
  153 +
  154 +
  155 + var tempData = {};
  156 + $.get('/report/lineList',function(xlList){
  157 + var data = [];
  158 +// data.push({id: " ", text: "全部线路"});
  159 + $.get('/user/companyData', function(result){
  160 + for(var i = 0; i < result.length; i++){
  161 + var companyCode = result[i].companyCode;
  162 + var children = result[i].children;
  163 + for(var j = 0; j < children.length; j++){
  164 + var code = children[j].code;
  165 + for(var k=0;k < xlList.length;k++ ){
  166 + if(xlList[k]["fgsbm"]==code && xlList[k]["gsbm"]==companyCode){
  167 + data.push({id: xlList[k]["xlbm"], text: xlList[k]["xlname"]});
  168 + tempData[xlList[k]["xlbm"]] = companyCode+":"+code;
  169 + }
  170 + }
  171 + }
  172 + }
  173 + initPinYinSelect2('#line',data,'');
  174 +
  175 + });
  176 + });
  177 +
  178 + $("#line").on("change", function(){
  179 + if($("#line").val() == " "){
  180 + $("#gsdm").attr("disabled", false);
  181 + $("#fgsdm").attr("disabled", false);
  182 + } else {
  183 + var temp = tempData[$("#line").val()].split(":");
  184 + $("#gsdm").val(temp[0]);
  185 + updateCompany();
  186 + $("#fgsdm").val(temp[1]);
  187 + $("#gsdm").attr("disabled", true);
  188 + $("#fgsdm").attr("disabled", true);
  189 + }
  190 + });
  191 +
  192 + var line ="";
  193 + var xlName ="";
  194 + var date = "";
  195 + var date2 ="";
  196 + var gsdm="";
  197 + var fgsdm="";
  198 + var zt="";
  199 + $("#countLine").height($(window).height()-280);
  200 + $("#query").on("click",function(){
  201 + $("#countLine").height($(window).height()-280);
  202 + if($("#date").val() == null || $("#date").val().trim().length == 0){
  203 + layer.msg("请选择时间范围!");
  204 + return;
  205 + }
  206 + if($("#date2").val() == null || $("#date2").val().trim().length == 0){
  207 + layer.msg("请选择时间范围!");
  208 + return;
  209 + }
  210 + line = $("#line").val();
  211 + xlName = $("#select2-line-container").html();
  212 + date = $("#date").val();
  213 + date2 =$("#date2").val();
  214 + gsdm =$("#gsdm").val();
  215 + fgsdm=$("#fgsdm").val();
  216 + zt=$("#zt").val();
  217 + if(line=="请选择"){
  218 + line="";
  219 + }
  220 + if(date==null || date =="" ||date2==null || date2 ==""){
  221 + layer.msg('请选择时间段.');
  222 + }else{
  223 + var params = {};
  224 + params['gsdm'] = gsdm;
  225 + params['fgsdm'] =fgsdm ;
  226 + params['line'] = line;
  227 + params['date'] = date;
  228 + params['date2'] = date2;
  229 + params['xlName'] = xlName;
  230 + params['zt']=zt;
  231 + params['type'] = "query";
  232 + var tbodyHtml = template('countBusDailyGs',{list:""});
  233 + var i = layer.load(2);
  234 + $get('/calcWaybill/getBusMileage',params,function(result){
  235 + layer.close(i);
  236 + // 把数据填充到模版中
  237 + var tbodyHtml = template('countBusDailyGs',{list:result,zt:zt});
  238 + // 把渲染好的模版html文本追加到表格中
  239 + $('#forms').html(tbodyHtml);
  240 +
  241 + if(result.length == 0)
  242 + $("#export").attr('disabled',"true");
  243 + else
  244 + $("#export").removeAttr("disabled");
  245 + });
  246 + }
  247 +
  248 + });
  249 +
  250 + $("#export").on("click",function(){
  251 + var params = {};
  252 + params['gsdm'] = gsdm;
  253 + params['fgsdm'] =fgsdm ;
  254 + params['line'] = line;
  255 + params['date'] = date;
  256 + params['date2'] = date2;
  257 + params['xlName'] = xlName;
  258 + params['zt']=zt;
  259 + params['type'] = "export";
  260 + params['by']='gs';
  261 + $get('/calcWaybill/getBusMileage',params,function(result){
  262 + window.open("/downloadFile/download?fileName=路单数据统计表");
  263 + });
  264 + });
  265 +
  266 + });
  267 +</script>
  268 +<script type="text/html" id="countBusDailyGs">
  269 + <thead>
  270 + <tr>
  271 + <th colspan="31">路单数据统计表</th>
  272 + </tr>
  273 + <tr>
  274 + <td>序号</td>
  275 + <td>日期</td>
  276 + <td>所属公司</td>
  277 + <td>线路</td>
  278 + <td>车号</td>
  279 + {{if zt=='js'}}
  280 + <td>司机职号</td>
  281 + <td>司机姓名</td>
  282 + <td>售票员职号</td>
  283 + <td>售票员姓名</td>
  284 + {{/if}}
  285 + <td>行驶里程(包括空放)</td>
  286 + <td>计划内营运里程</td>
  287 + <td><label>临时性</label><label>多样化</label><label>调度营</label><label>运里程</label></td>
  288 + <td><label>计划内</label><label>进出场</label><label>空驶</label></td>
  289 + <td><label>计划外</label><label>进出场</label><label>空驶</label></td>
  290 + <td>空放空驶</td>
  291 + <td><label>故障</label><label>进出场</label><label>空驶</label></td>
  292 + <td><label>肇事</label><label>进出场</label><label>空驶</label></td>
  293 + <td><label>纠纷</label><label>进出场</label><label>空驶</label></td>
  294 + <td><label>其他</label><label>进出场</label><label>空驶</label></td>
  295 + <td>临加营运公里</td>
  296 + <td>临加进出场空驶</td>
  297 + <td>临加空放空驶</td>
  298 + <td>电耗量</td>
  299 + <td>加电量</td>
  300 + <td>耗油量</td>
  301 + <td>加注量</td>
  302 + <td>非营业用油</td>
  303 + <td>计划总公里</td>
  304 + </tr>
  305 + </thead>
  306 + <tbody >
  307 + {{each list as obj i}}
  308 + <tr>
  309 + <td>{{i+1}}</td>
  310 + <td>{{obj.rq}}</td>
  311 + <td>{{obj.fgs}}</td>
  312 + <td>{{obj.xlName}}</td>
  313 + <td>{{obj.nbbm}}</td>
  314 + {{if zt=='js'}}
  315 + <td>{{obj.jGh}}</td>
  316 + <td>{{obj.jName}}</td>
  317 + <td>{{obj.sGh}}</td>
  318 + <td>{{obj.sName}}</td>
  319 + {{/if}}
  320 + <td>{{obj.zlc}}</td>
  321 + <td>{{obj.jhnlc}}</td>
  322 + <td>{{obj.jhwlc}}</td>
  323 + <td>{{obj.jhnjcclc}}</td>
  324 + <td>{{obj.jhwjcclc}}</td>
  325 + <td>{{obj.kfks}}</td>
  326 + <td>{{obj.zrwjcclc}}</td>
  327 + <td>{{obj.zrwjcclc1}}</td>
  328 + <td>{{obj.zrwjcclc2}}</td>
  329 + <td>{{obj.zrwjcclcqt}}</td>
  330 + <td>{{obj.ljyy}}</td>
  331 + <td>{{obj.ljjcc}}</td>
  332 + <td>{{obj.ljkfks}}</td>
  333 + <td>{{obj.dhl}}</td>
  334 + <td>{{obj.cdl}}</td>
  335 + <td>{{obj.yhl}}</td>
  336 + <td>{{obj.jzl}}</td>
  337 + <td>{{obj.hyl}}</td>
  338 + <td>{{obj.jhzlc}}</td>
  339 + </tr>
  340 + {{/each}}
  341 + {{if list.length == 0}}
  342 + <tr>
  343 + <td colspan="28"><h6 class="muted">没有找到相关数据</h6></td>
  344 + </tr>
  345 + {{/if}}
  346 +</tbody>
  347 +</script>
0 \ No newline at end of file 348 \ No newline at end of file
src/main/resources/static/pages/calc/company/countLineMileage.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 +
  18 + #forms > thead > tr> td >span{
  19 + width: 5px;
  20 + word-wrap: break-word;
  21 + letter-spacing: 20px;
  22 + }
  23 +
  24 + #forms > thead > tr> td >label{
  25 + word-break: keep-all;white-space:nowrap;
  26 + }
  27 +</style>
  28 +
  29 +<div class="page-head">
  30 + <div class="page-title">
  31 + <h1>线路公里统计表</h1>
  32 + </div>
  33 +</div>
  34 +
  35 +<div class="row">
  36 + <div class="col-md-12">
  37 + <div class="portlet light porttlet-fit bordered">
  38 + <div class="portlet-title">
  39 + <form class="form-inline" action="">
  40 + <div style="display: inline-block; " id="gsdmDiv">
  41 + <span class="item-label" style="width: 80px;">公司: </span>
  42 + <select class="form-control" name="company" id="gsdm" style="width: 180px;"></select>
  43 + </div>
  44 + <div style="display: inline-block; margin-left: 29px;" id="fgsdmDiv">
  45 + <span class="item-label" style="width: 80px;">分公司: </span>
  46 + <select class="form-control" name="subCompany" id="fgsdm" style="width: 180px;"></select>
  47 + </div>
  48 + <div style="margin-top: 2px"></div>
  49 + <div style="display: inline-block;">
  50 + <span class="item-label" style="width: 80px;">线路: </span>
  51 + <select class="form-control" name="line" id="line" style="width: 180px;"></select>
  52 + </div>
  53 + <div style="display: inline-block;margin-left: 15px;">
  54 + <span class="item-label" style="width: 80px;">开始时间: </span>
  55 + <input class="form-control" type="text" id="date" style="width: 180px;"/>
  56 + </div>
  57 + <div style="display: inline-block;margin-left: 15px;">
  58 + <span class="item-label" style="width: 80px;">结束时间: </span>
  59 + <input class="form-control" type="text" id="date2" style="width: 180px;"/>
  60 + </div>
  61 + <div class="form-group">
  62 + <input class="btn btn-default" type="button" id="query" value="查询"/>
  63 + <input class="btn btn-default" type="button" id="export" value="导出"/>
  64 + </div>
  65 + </form>
  66 + </div>
  67 + <div class="portlet-body">
  68 + <div class="table-container" id="countLine" style="margin-top: 10px;overflow:auto;min-width: 906px">
  69 + <table class="table table-bordered table-hover table-checkable" id="forms">
  70 + <thead>
  71 + <tr>
  72 + <th colspan="31"><label id="datetodate"></label>线路公里统计表</th>
  73 + </tr>
  74 + <tr>
  75 + <td rowspan="2"><span>公司</span></td>
  76 + <td rowspan="2"><span>分公司</span></td>
  77 + <td rowspan="2"><span>路线别</span></td>
  78 + <td rowspan="2"><label>计划</label><label>总公里</label></td>
  79 + <td rowspan="2"><label>计划营</label><label>运公里</label></td>
  80 + <td rowspan="2"><label>计划空</label><label>驶公里</label></td>
  81 + <td rowspan="2"><label>实际</label><label>总公里</label></td>
  82 + <td colspan="2"><label>实际营</label><label>运公里</label></td>
  83 + <td colspan="7"><label>实际空</label><label>驶公里</label></td>
  84 + <td rowspan="2"><label>少驶营</label><label>运里程</label></td>
  85 + <td colspan="11">少驶原因(公里)</td>
  86 + <td colspan="3">临加公里</td>
  87 + </tr>
  88 + <tr>
  89 + <td><label>计划内</label><label>营运</label><label>里程</label></td>
  90 + <td><label>临时性</label><label>多样化</label><label>调度营</label><label>运里程</label></td>
  91 + <td><label>计划内</label><label>进出场</label><label>空驶</label></td>
  92 + <td><label>计划外</label><label>进出场</label><label>空驶</label></td>
  93 + <td><label>故障</label><label>进出场</label><label>空驶</label></td>
  94 + <td><label>肇事</label><label>进出场</label><label>空驶</label></td>
  95 + <td><label>纠纷</label><label>进出场</label><label>空驶</label></td>
  96 + <td><label>其他</label><label>进出场</label><label>空驶</label></td>
  97 + <td><label>空放 </label><label>空驶</label></td>
  98 + <td><span>路阻</span></td>
  99 + <td><span>吊慢</span></td>
  100 + <td><span>故障</span></td>
  101 + <td><span>纠纷</span></td>
  102 + <td><span>肇事</span></td>
  103 + <td><span>缺人</span></td>
  104 + <td><span>缺车</span></td>
  105 + <td><span>客稀</span></td>
  106 + <td><span>气候</span></td>
  107 + <td><span>援外</span></td>
  108 + <td><span>其他</span></td>
  109 + <td><label>临加营</label><label>运公里</label></td>
  110 + <td><label>临加进出</label><label>场空驶</label></td>
  111 + <td><label>临加</label><label>空放</label><label>空驶</label></td>
  112 + </tr>
  113 +
  114 + </thead>
  115 + <tbody class="countLineNb">
  116 +
  117 + </tbody>
  118 + </table>
  119 + </div>
  120 + </div>
  121 + </div>
  122 + </div>
  123 +</div>
  124 +
  125 +<script>
  126 + $(function(){
  127 + $('#export').attr('disabled', "true");
  128 +
  129 + // 关闭左侧栏
  130 + if (!$('body').hasClass('page-sidebar-closed'))
  131 + $('.menu-toggler.sidebar-toggler').click();
  132 +
  133 + $("#date").datetimepicker({
  134 + format : 'YYYY-MM-DD',
  135 + locale : 'zh-cn'
  136 + });
  137 +
  138 + $("#date2").datetimepicker({
  139 + format : 'YYYY-MM-DD',
  140 + locale : 'zh-cn'
  141 + });
  142 + var d = new Date();
  143 + var year = d.getFullYear();
  144 + var month = d.getMonth() + 1;
  145 + var day = d.getDate();
  146 + if(month < 10)
  147 + month = "0" + month;
  148 + if(day < 10)
  149 + day = "0" + day;
  150 + $("#date").val(year + "-" + month + "-" + day);
  151 +
  152 + $("#date2").val(year + "-" + month + "-" + day);
  153 +
  154 + var fage=false;
  155 + var obj = [];
  156 + var xlList;
  157 + $.get('/report/lineList',function(result){
  158 + xlList=result;
  159 + $.get('/user/companyData', function(result){
  160 + obj = result;
  161 + var options = '';
  162 + for(var i = 0; i < obj.length; i++){
  163 + options += '<option value="'+obj[i].companyCode+'">'+obj[i].companyName+'</option>';
  164 + }
  165 +
  166 + if(obj.length ==0){
  167 + $("#gsdmDiv").css('display','none');
  168 + }else if(obj.length ==1){
  169 + $("#gsdmDiv").css('display','none');
  170 + if(obj[0].children.length == 1 || obj[0].children.length ==0)
  171 + $('#fgsdmDiv').css('display','none');
  172 + }
  173 + $('#gsdm').html(options);
  174 + updateCompany();
  175 + });
  176 + })
  177 + $("#gsdm").on("change",updateCompany);
  178 + function updateCompany(){
  179 + var company = $('#gsdm').val();
  180 + var options = '';
  181 + for(var i = 0; i < obj.length; i++){
  182 + if(obj[i].companyCode == company){
  183 + var children = obj[i].children;
  184 + for(var j = 0; j < children.length; j++){
  185 + options += '<option value="'+children[j].code+'">'+children[j].name+'</option>';
  186 + }
  187 + }
  188 + }
  189 + $('#fgsdm').html(options);
  190 + }
  191 +
  192 +
  193 + var tempData = {};
  194 + $.get('/report/lineList',function(xlList){
  195 + var data = [];
  196 + data.push({id: " ", text: "全部线路"});
  197 + $.get('/user/companyData', function(result){
  198 + for(var i = 0; i < result.length; i++){
  199 + var companyCode = result[i].companyCode;
  200 + var children = result[i].children;
  201 + for(var j = 0; j < children.length; j++){
  202 + var code = children[j].code;
  203 + for(var k=0;k < xlList.length;k++ ){
  204 + if(xlList[k]["fgsbm"]==code && xlList[k]["gsbm"]==companyCode){
  205 + data.push({id: xlList[k]["xlbm"], text: xlList[k]["xlname"]});
  206 + tempData[xlList[k]["xlbm"]] = companyCode+":"+code;
  207 + }
  208 + }
  209 + }
  210 + }
  211 + initPinYinSelect2('#line',data,'');
  212 +
  213 + });
  214 + });
  215 +
  216 + $("#line").on("change", function(){
  217 + if($("#line").val() == " "){
  218 + $("#gsdm").attr("disabled", false);
  219 + $("#fgsdm").attr("disabled", false);
  220 + } else {
  221 + var temp = tempData[$("#line").val()].split(":");
  222 + $("#gsdm").val(temp[0]);
  223 + updateCompany();
  224 + $("#fgsdm").val(temp[1]);
  225 + $("#gsdm").attr("disabled", true);
  226 + $("#fgsdm").attr("disabled", true);
  227 + }
  228 + });
  229 +
  230 + var line ="";
  231 + var xlName ="";
  232 + var date = "";
  233 + var date2 ="";
  234 + var gsdm="";
  235 + var fgsdm="";
  236 + $("#query").on("click",function(){
  237 + $("#countLine").height($(window).height()-280);
  238 + if($("#date").val() == null || $("#date").val().trim().length == 0){
  239 + layer.msg("请选择时间范围!");
  240 + return;
  241 + }
  242 + if($("#date2").val() == null || $("#date2").val().trim().length == 0){
  243 + layer.msg("请选择时间范围!");
  244 + return;
  245 + }
  246 + line = $("#line").val();
  247 + xlName = $("#select2-line-container").html();
  248 + date = $("#date").val();
  249 + date2 =$("#date2").val();
  250 + gsdm =$("#gsdm").val();
  251 + fgsdm=$("#fgsdm").val();
  252 + if(line=="请选择"){
  253 + line="";
  254 + }
  255 + if(date==null || date =="" ||date2==null || date2 ==""){
  256 + layer.msg('请选择时间段.');
  257 + }else{
  258 + var params = {};
  259 + params['gsdm'] = gsdm;
  260 + params['fgsdm'] =fgsdm ;
  261 + params['line'] = line;
  262 + params['date'] = date;
  263 + params['date2'] = date2;
  264 + params['xlName'] = xlName;
  265 + params['type'] = "query";
  266 + var i = layer.load(2);
  267 + $get('/calcWaybill/getLineMileage',params,function(result){
  268 + layer.close(i);
  269 + $("#datetodate").html(date+"至"+date2);
  270 + // 把数据填充到模版中
  271 + var tbodyHtml = template('countLineListGs',{list:result});
  272 + // 把渲染好的模版html文本追加到表格中
  273 + $('#forms .countLineNb').html(tbodyHtml);
  274 +
  275 + if(result.length == 0)
  276 + $("#export").attr('disabled',"true");
  277 + else
  278 + $("#export").removeAttr("disabled");
  279 + });
  280 + }
  281 +
  282 + });
  283 + $("#countLine").height($(window).height()-280);
  284 + $("#export").on("click",function(){
  285 + var params = {};
  286 + params['gsdm'] = gsdm;
  287 + params['fgsdm'] =fgsdm ;
  288 + params['line'] = line;
  289 + params['date'] = date;
  290 + params['date2'] = date2;
  291 + params['xlName'] = xlName;
  292 + params['type'] = "export";
  293 + params['by']='gs';
  294 + $get('/calcWaybill/getLineMileage',params,function(result){
  295 + window.open("/downloadFile/download?fileName=线路公里统计表");
  296 + });
  297 + });
  298 + });
  299 +</script>
  300 +<script type="text/html" id="countLineListGs">
  301 + {{each list as obj i}}
  302 + <tr>
  303 + <td>{{obj.gs}}</td>
  304 + <td>{{obj.fgs}}</td>
  305 + <td>{{obj.xlName}}</td>
  306 + <td>{{obj.jhzlc}}</td>
  307 + <td>{{obj.jhlc}}</td>
  308 + <td>{{obj.jcclc}}</td>
  309 + <td>{{obj.sjzgl}}</td>
  310 + <td>{{obj.jhnlc}}</td>
  311 + <td>{{obj.jhwlc}}</td>
  312 + <td>{{obj.jhnjcclc}}</td>
  313 + <td>{{obj.jhwjcclc}}</td>
  314 + <td>{{obj.zrwjcclc}}</td>
  315 + <td>{{obj.zrwjcclc1}}</td>
  316 + <td>{{obj.zrwjcclc2}}</td>
  317 + <td>{{obj.zrwjcclcqt}}</td>
  318 + <td>{{obj.kfks}}</td>
  319 + <td>{{obj.lbss}}</td>
  320 + <td>{{obj.ssgl_lz}}</td>
  321 + <td>{{obj.ssgl_dm}}</td>
  322 + <td>{{obj.ssgl_gz}}</td>
  323 + <td>{{obj.ssgl_jf}}</td>
  324 + <td>{{obj.ssgl_zs}}</td>
  325 + <td>{{obj.ssgl_qr}}</td>
  326 + <td>{{obj.ssgl_qc}}</td>
  327 + <td>{{obj.ssgl_kx}}</td>
  328 + <td>{{obj.ssgl_qh}}</td>
  329 + <td>{{obj.ssgl_yw}}</td>
  330 + <td>{{obj.ssgl_other}}</td>
  331 + <td>{{obj.ljyy}}</td>
  332 + <td>{{obj.ljjcc}}</td>
  333 + <td>{{obj.ljkfks}}</td>
  334 + </tr>
  335 + {{/each}}
  336 + {{if list.length == 0}}
  337 + <tr>
  338 + <td colspan="30"><h6 class="muted">没有找到相关数据</h6></td>
  339 + </tr>
  340 + {{/if}}
  341 +</script>
0 \ No newline at end of file 342 \ No newline at end of file
src/main/resources/static/pages/calc/countBusMileage.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 +
  18 + #forms > thead > tr> td >span{
  19 + width: 5px;
  20 + word-wrap: break-word;
  21 + letter-spacing: 20px;
  22 + }
  23 +
  24 + #forms > thead > tr> td >label{
  25 + word-break: keep-all;white-space:nowrap;
  26 + }
  27 +</style>
  28 +
  29 +<div class="page-head">
  30 + <div class="page-title">
  31 + <h1>路单数据统计表(审计)</h1>
  32 + </div>
  33 +</div>
  34 +
  35 +<div class="row">
  36 + <div class="col-md-12">
  37 + <div class="portlet light porttlet-fit bordered">
  38 + <div class="portlet-title">
  39 + <form class="form-inline" action="">
  40 + <div style="display: inline-block;margin-left: 28px; " id="gsdmDiv">
  41 + <span class="item-label" style="width: 80px;">公司: </span>
  42 + <select class="form-control" name="company" id="gsdm" style="width: 180px;"></select>
  43 + </div>
  44 + <div style="display: inline-block; margin-left: 29px;" id="fgsdmDiv">
  45 + <span class="item-label" style="width: 80px;">分公司: </span>
  46 + <select class="form-control" name="subCompany" id="fgsdm" style="width: 180px;"></select>
  47 + </div>
  48 + <div style="display: inline-block;margin-left: 43px;">
  49 + <span class="item-label" style="width: 80px;">线路: </span>
  50 + <select class="form-control" name="line" id="line" style="width: 180px;"></select>
  51 + </div>
  52 + <div style="margin-top: 2px"></div>
  53 +
  54 + <div style="display: inline-block;">
  55 + <span class="item-label" style="width: 80px;">开始时间: </span>
  56 + <input class="form-control" type="text" id="date" style="width: 180px;"/>
  57 + </div>
  58 + <div style="display: inline-block;margin-left: 15px;">
  59 + <span class="item-label" style="width: 80px;">结束时间: </span>
  60 + <input class="form-control" type="text" id="date2" style="width: 180px;"/>
  61 + </div>
  62 + <div style="display: inline-block;margin-left: 15px;">
  63 + <span class="item-label" style="width: 80px;">显示分类: </span>
  64 + <select class="form-control" style="width: 120px;" id="zt">
  65 + <option value="zbh">车辆</option>
  66 + <option value="js">驾/售</option>
  67 + </select>
  68 + </div>
  69 + <div class="form-group" style="margin-left: 55px;">
  70 + <input class="btn btn-default" type="button" id="query" value="查询"/>
  71 + <input class="btn btn-default" type="button" id="export" value="导出"/>
  72 + </div>
  73 + </form>
  74 + </div>
  75 + <div class="portlet-body">
  76 + <div class="table-container" id="countLine" style="margin-top: 10px;overflow:auto;min-width: 906px">
  77 + <table class="table table-bordered table-hover table-checkable" id="forms">
  78 +
  79 +
  80 + </table>
  81 + </div>
  82 + </div>
  83 + </div>
  84 + </div>
  85 +</div>
  86 +
  87 +<script>
  88 + $(function(){
  89 + $('#export').attr('disabled', "true");
  90 +
  91 + // 关闭左侧栏
  92 + if (!$('body').hasClass('page-sidebar-closed'))
  93 + $('.menu-toggler.sidebar-toggler').click();
  94 +
  95 + var d = new Date();
  96 + d.setTime(d.getTime() - 1*1000*60*60*24);
  97 + var year = d.getFullYear();
  98 + var month = d.getMonth() + 1;
  99 + var day = d.getDate();
  100 + if(month < 10)
  101 + month = "0" + month;
  102 + if(day < 10)
  103 + day = "0" + day;
  104 + var dateTime = year + "-" + month + "-" + day;
  105 + $("#date").datetimepicker({
  106 + format : 'YYYY-MM-DD',
  107 + locale : 'zh-cn',
  108 + maxDate : dateTime
  109 + });
  110 + $("#date2").datetimepicker({
  111 + format : 'YYYY-MM-DD',
  112 + locale : 'zh-cn',
  113 + maxDate : dateTime
  114 + });
  115 + $("#date").val(dateTime);
  116 + $("#date2").val(dateTime);
  117 +
  118 + var fage=false;
  119 + var obj = [];
  120 + var xlList;
  121 + $.get('/report/lineList',function(result){
  122 + xlList=result;
  123 + $.get('/user/companyData', function(result){
  124 + obj = result;
  125 + var options = '';
  126 + for(var i = 0; i < obj.length; i++){
  127 + options += '<option value="'+obj[i].companyCode+'">'+obj[i].companyName+'</option>';
  128 + }
  129 +
  130 + if(obj.length ==0){
  131 + $("#gsdmDiv").css('display','none');
  132 + }else if(obj.length ==1){
  133 + $("#gsdmDiv").css('display','none');
  134 + if(obj[0].children.length == 1 || obj[0].children.length ==0)
  135 + $('#fgsdmDiv').css('display','none');
  136 + }
  137 + $('#gsdm').html(options);
  138 + updateCompany();
  139 + });
  140 + })
  141 + $("#gsdm").on("change",updateCompany);
  142 + function updateCompany(){
  143 + var company = $('#gsdm').val();
  144 + var options = '';
  145 + for(var i = 0; i < obj.length; i++){
  146 + if(obj[i].companyCode == company){
  147 + var children = obj[i].children;
  148 + for(var j = 0; j < children.length; j++){
  149 + options += '<option value="'+children[j].code+'">'+children[j].name+'</option>';
  150 + }
  151 + }
  152 + }
  153 + $('#fgsdm').html(options);
  154 + }
  155 +
  156 +
  157 + var tempData = {};
  158 + $.get('/report/lineList',function(xlList){
  159 + var data = [];
  160 +// data.push({id: " ", text: "全部线路"});
  161 + $.get('/user/companyData', function(result){
  162 + for(var i = 0; i < result.length; i++){
  163 + var companyCode = result[i].companyCode;
  164 + var children = result[i].children;
  165 + for(var j = 0; j < children.length; j++){
  166 + var code = children[j].code;
  167 + for(var k=0;k < xlList.length;k++ ){
  168 + if(xlList[k]["fgsbm"]==code && xlList[k]["gsbm"]==companyCode){
  169 + data.push({id: xlList[k]["xlbm"], text: xlList[k]["xlname"]});
  170 + tempData[xlList[k]["xlbm"]] = companyCode+":"+code;
  171 + }
  172 + }
  173 + }
  174 + }
  175 + initPinYinSelect2('#line',data,'');
  176 +
  177 + });
  178 + });
  179 +
  180 + $("#line").on("change", function(){
  181 + if($("#line").val() == " "){
  182 + $("#gsdm").attr("disabled", false);
  183 + $("#fgsdm").attr("disabled", false);
  184 + } else {
  185 + var temp = tempData[$("#line").val()].split(":");
  186 + $("#gsdm").val(temp[0]);
  187 + updateCompany();
  188 + $("#fgsdm").val(temp[1]);
  189 + $("#gsdm").attr("disabled", true);
  190 + $("#fgsdm").attr("disabled", true);
  191 + }
  192 + });
  193 +
  194 + var line ="";
  195 + var xlName ="";
  196 + var date = "";
  197 + var date2 ="";
  198 + var gsdm="";
  199 + var fgsdm="";
  200 + var zt="";
  201 + $("#countLine").height($(window).height()-280);
  202 + $("#query").on("click",function(){
  203 + $("#countLine").height($(window).height()-280);
  204 + if($("#date").val() == null || $("#date").val().trim().length == 0){
  205 + layer.msg("请选择时间范围!");
  206 + return;
  207 + }
  208 + if($("#date2").val() == null || $("#date2").val().trim().length == 0){
  209 + layer.msg("请选择时间范围!");
  210 + return;
  211 + }
  212 + line = $("#line").val();
  213 + xlName = $("#select2-line-container").html();
  214 + date = $("#date").val();
  215 + date2 =$("#date2").val();
  216 + gsdm =$("#gsdm").val();
  217 + fgsdm=$("#fgsdm").val();
  218 + zt=$("#zt").val();
  219 + if(line=="请选择"){
  220 + line="";
  221 + }
  222 + if(date==null || date =="" ||date2==null || date2 ==""){
  223 + layer.msg('请选择时间段.');
  224 + }else{
  225 + var params = {};
  226 + params['gsdm'] = gsdm;
  227 + params['fgsdm'] =fgsdm ;
  228 + params['line'] = line;
  229 + params['date'] = date;
  230 + params['date2'] = date2;
  231 + params['xlName'] = xlName;
  232 + params['zt']=zt;
  233 + params['type'] = "query";
  234 + var tbodyHtml = template('countBusDailySj',{list:""});
  235 + var i = layer.load(2);
  236 + $get('/calcWaybill/getBusMileage',params,function(result){
  237 + layer.close(i);
  238 + // 把数据填充到模版中
  239 + var tbodyHtml = template('countBusDailySj',{list:result,zt:zt});
  240 + // 把渲染好的模版html文本追加到表格中
  241 + $('#forms').html(tbodyHtml);
  242 +
  243 + if(result.length == 0)
  244 + $("#export").attr('disabled',"true");
  245 + else
  246 + $("#export").removeAttr("disabled");
  247 + });
  248 + }
  249 +
  250 + });
  251 +
  252 + $("#export").on("click",function(){
  253 + var params = {};
  254 + params['gsdm'] = gsdm;
  255 + params['fgsdm'] =fgsdm ;
  256 + params['line'] = line;
  257 + params['date'] = date;
  258 + params['date2'] = date2;
  259 + params['xlName'] = xlName;
  260 + params['zt']=zt;
  261 + params['type'] = "export";
  262 + params['by']='sj';
  263 + $get('/calcWaybill/getBusMileage',params,function(result){
  264 + window.open("/downloadFile/download?fileName=路单数据统计表");
  265 + });
  266 + });
  267 +
  268 + });
  269 +</script>
  270 +<script type="text/html" id="countBusDailySj">
  271 + <thead>
  272 + <tr>
  273 + <th colspan="31">路单数据统计表</th>
  274 + </tr>
  275 + <tr>
  276 + <td>序号</td>
  277 + <td>日期</td>
  278 + <td>所属公司</td>
  279 + <td>线路</td>
  280 + <td>车号</td>
  281 + {{if zt=='js'}}
  282 + <td>司机职号</td>
  283 + <td>司机姓名</td>
  284 + <td>售票员职号</td>
  285 + <td>售票员姓名</td>
  286 + {{/if}}
  287 + <td>行驶里程(包括空放)</td>
  288 + <td>计划内营运里程</td>
  289 + <td><label>临时性</label><label>多样化</label><label>调度营</label><label>运里程</label></td>
  290 + <td><label>计划内</label><label>进出场</label><label>空驶</label></td>
  291 + <td><label>计划外</label><label>进出场</label><label>空驶</label></td>
  292 + <td>空放空驶</td>
  293 + <td><label>故障</label><label>进出场</label><label>空驶</label></td>
  294 + <td><label>肇事</label><label>进出场</label><label>空驶</label></td>
  295 + <td><label>纠纷</label><label>进出场</label><label>空驶</label></td>
  296 + <td>临加营运公里</td>
  297 + <td>临加进出场空驶</td>
  298 + <td>临加空放空驶</td>
  299 + <td>电耗量</td>
  300 + <td>加电量</td>
  301 + <td>耗油量</td>
  302 + <td>加注量</td>
  303 + <td>非营业用油</td>
  304 + <td>计划总公里</td>
  305 + </tr>
  306 + </thead>
  307 + <tbody >
  308 + {{each list as obj i}}
  309 + <tr>
  310 + <td>{{i+1}}</td>
  311 + <td>{{obj.rq}}</td>
  312 + <td>{{obj.fgs}}</td>
  313 + <td>{{obj.xlName}}</td>
  314 + <td>{{obj.nbbm}}</td>
  315 + {{if zt=='js'}}
  316 + <td>{{obj.jGh}}</td>
  317 + <td>{{obj.jName}}</td>
  318 + <td>{{obj.sGh}}</td>
  319 + <td>{{obj.sName}}</td>
  320 + {{/if}}
  321 + <td>{{obj.zlc}}</td>
  322 + <td>{{obj.jhnlc}}</td>
  323 + <td>{{obj.jhwlc}}</td>
  324 + <td>{{obj.jhnjcclc}}</td>
  325 + <td>{{obj.jhwjcclc_z}}</td>
  326 + <td>{{obj.kfks}}</td>
  327 + <td>{{obj.zrwjcclc}}</td>
  328 + <td>{{obj.zrwjcclc1}}</td>
  329 + <td>{{obj.zrwjcclc2}}</td>
  330 + <td>{{obj.ljyy}}</td>
  331 + <td>{{obj.ljjcc}}</td>
  332 + <td>{{obj.ljkfks}}</td>
  333 + <td>{{obj.dhl}}</td>
  334 + <td>{{obj.cdl}}</td>
  335 + <td>{{obj.yhl}}</td>
  336 + <td>{{obj.jzl}}</td>
  337 + <td>{{obj.hyl}}</td>
  338 + <td>{{obj.jhzlc}}</td>
  339 + </tr>
  340 + {{/each}}
  341 + {{if list.length == 0}}
  342 + <tr>
  343 + <td colspan="26"><h6 class="muted">没有找到相关数据</h6></td>
  344 + </tr>
  345 + {{/if}}
  346 +</tbody>
  347 +</script>
0 \ No newline at end of file 348 \ No newline at end of file
src/main/resources/static/pages/calc/countLineMileage.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 +
  18 + #forms > thead > tr> td >span{
  19 + width: 5px;
  20 + word-wrap: break-word;
  21 + letter-spacing: 20px;
  22 + }
  23 +
  24 + #forms > thead > tr> td >label{
  25 + word-break: keep-all;white-space:nowrap;
  26 + }
  27 +</style>
  28 +
  29 +<div class="page-head">
  30 + <div class="page-title">
  31 + <h1>线路公里统计表(审计)</h1>
  32 + </div>
  33 +</div>
  34 +
  35 +<div class="row">
  36 + <div class="col-md-12">
  37 + <div class="portlet light porttlet-fit bordered">
  38 + <div class="portlet-title">
  39 + <form class="form-inline" action="">
  40 + <div style="display: inline-block; " id="gsdmDiv">
  41 + <span class="item-label" style="width: 80px;">公司: </span>
  42 + <select class="form-control" name="company" id="gsdm" style="width: 180px;"></select>
  43 + </div>
  44 + <div style="display: inline-block; margin-left: 29px;" id="fgsdmDiv">
  45 + <span class="item-label" style="width: 80px;">分公司: </span>
  46 + <select class="form-control" name="subCompany" id="fgsdm" style="width: 180px;"></select>
  47 + </div>
  48 + <div style="margin-top: 2px"></div>
  49 + <div style="display: inline-block;">
  50 + <span class="item-label" style="width: 80px;">线路: </span>
  51 + <select class="form-control" name="line" id="line" style="width: 180px;"></select>
  52 + </div>
  53 + <div style="display: inline-block;margin-left: 15px;">
  54 + <span class="item-label" style="width: 80px;">开始时间: </span>
  55 + <input class="form-control" type="text" id="date" style="width: 180px;"/>
  56 + </div>
  57 + <div style="display: inline-block;margin-left: 15px;">
  58 + <span class="item-label" style="width: 80px;">结束时间: </span>
  59 + <input class="form-control" type="text" id="date2" style="width: 180px;"/>
  60 + </div>
  61 + <div class="form-group">
  62 + <input class="btn btn-default" type="button" id="query" value="查询"/>
  63 + <input class="btn btn-default" type="button" id="export" value="导出"/>
  64 + </div>
  65 + </form>
  66 + </div>
  67 + <div class="portlet-body">
  68 + <div class="table-container" id="countLine" style="margin-top: 10px;overflow:auto;min-width: 906px">
  69 + <table class="table table-bordered table-hover table-checkable" id="forms">
  70 + <thead>
  71 + <tr>
  72 + <th colspan="30"><label id="datetodate"></label>线路公里统计表</th>
  73 + </tr>
  74 + <tr>
  75 + <td rowspan="2"><span>公司</span></td>
  76 + <td rowspan="2"><span>分公司</span></td>
  77 + <td rowspan="2"><span>路线别</span></td>
  78 + <td rowspan="2"><label>计划</label><label>总公里</label></td>
  79 + <td rowspan="2"><label>计划营</label><label>运公里</label></td>
  80 + <td rowspan="2"><label>计划空</label><label>驶公里</label></td>
  81 + <td rowspan="2"><label>实际</label><label>总公里</label></td>
  82 + <td colspan="2"><label>实际营</label><label>运公里</label></td>
  83 + <td colspan="6"><label>实际空</label><label>驶公里</label></td>
  84 + <td rowspan="2"><label>少驶营</label><label>运里程</label></td>
  85 + <td colspan="11">少驶原因(公里)</td>
  86 + <td colspan="3">临加公里</td>
  87 + </tr>
  88 + <tr>
  89 + <td><label>计划内</label><label>营运</label><label>里程</label></td>
  90 + <td><label>临时性</label><label>多样化</label><label>调度营</label><label>运里程</label></td>
  91 + <td><label>计划内</label><label>进出场</label><label>空驶</label></td>
  92 + <td><label>计划外</label><label>进出场</label><label>空驶</label></td>
  93 + <td><label>故障</label><label>进出场</label><label>空驶</label></td>
  94 + <td><label>肇事</label><label>进出场</label><label>空驶</label></td>
  95 + <td><label>纠纷</label><label>进出场</label><label>空驶</label></td>
  96 + <td><label>空放 </label><label>空驶</label></td>
  97 + <td><span>路阻</span></td>
  98 + <td><span>吊慢</span></td>
  99 + <td><span>故障</span></td>
  100 + <td><span>纠纷</span></td>
  101 + <td><span>肇事</span></td>
  102 + <td><span>缺人</span></td>
  103 + <td><span>缺车</span></td>
  104 + <td><span>客稀</span></td>
  105 + <td><span>气候</span></td>
  106 + <td><span>援外</span></td>
  107 + <td><span>其他</span></td>
  108 + <td><label>临加营</label><label>运公里</label></td>
  109 + <td><label>临加进出</label><label>场空驶</label></td>
  110 + <td><label>临加</label><label>空放</label><label>空驶</label></td>
  111 + </tr>
  112 +
  113 + </thead>
  114 + <tbody class="countLineSj">
  115 +
  116 + </tbody>
  117 + </table>
  118 + </div>
  119 + </div>
  120 + </div>
  121 + </div>
  122 +</div>
  123 +
  124 +<script>
  125 + $(function(){
  126 + $('#export').attr('disabled', "true");
  127 +
  128 + // 关闭左侧栏
  129 + if (!$('body').hasClass('page-sidebar-closed'))
  130 + $('.menu-toggler.sidebar-toggler').click();
  131 +
  132 + var d = new Date();
  133 + d.setTime(d.getTime() - 1*1000*60*60*24);
  134 + var year = d.getFullYear();
  135 + var month = d.getMonth() + 1;
  136 + var day = d.getDate();
  137 + if(month < 10)
  138 + month = "0" + month;
  139 + if(day < 10)
  140 + day = "0" + day;
  141 + var dateTime = year + "-" + month + "-" + day;
  142 + $("#date").datetimepicker({
  143 + format : 'YYYY-MM-DD',
  144 + locale : 'zh-cn',
  145 + maxDate : dateTime
  146 + });
  147 + $("#date2").datetimepicker({
  148 + format : 'YYYY-MM-DD',
  149 + locale : 'zh-cn',
  150 + maxDate : dateTime
  151 + });
  152 + $("#date").val(dateTime);
  153 + $("#date2").val(dateTime);
  154 +
  155 + var fage=false;
  156 + var obj = [];
  157 + var xlList;
  158 + $.get('/report/lineList',function(result){
  159 + xlList=result;
  160 + $.get('/user/companyData', function(result){
  161 + obj = result;
  162 + var options = '';
  163 + for(var i = 0; i < obj.length; i++){
  164 + options += '<option value="'+obj[i].companyCode+'">'+obj[i].companyName+'</option>';
  165 + }
  166 +
  167 + if(obj.length ==0){
  168 + $("#gsdmDiv").css('display','none');
  169 + }else if(obj.length ==1){
  170 + $("#gsdmDiv").css('display','none');
  171 + if(obj[0].children.length == 1 || obj[0].children.length ==0)
  172 + $('#fgsdmDiv').css('display','none');
  173 + }
  174 + $('#gsdm').html(options);
  175 + updateCompany();
  176 + });
  177 + })
  178 + $("#gsdm").on("change",updateCompany);
  179 + function updateCompany(){
  180 + var company = $('#gsdm').val();
  181 + var options = '';
  182 + for(var i = 0; i < obj.length; i++){
  183 + if(obj[i].companyCode == company){
  184 + var children = obj[i].children;
  185 + for(var j = 0; j < children.length; j++){
  186 + options += '<option value="'+children[j].code+'">'+children[j].name+'</option>';
  187 + }
  188 + }
  189 + }
  190 + $('#fgsdm').html(options);
  191 + }
  192 +
  193 +
  194 + var tempData = {};
  195 + $.get('/report/lineList',function(xlList){
  196 + var data = [];
  197 + data.push({id: " ", text: "全部线路"});
  198 + $.get('/user/companyData', function(result){
  199 + for(var i = 0; i < result.length; i++){
  200 + var companyCode = result[i].companyCode;
  201 + var children = result[i].children;
  202 + for(var j = 0; j < children.length; j++){
  203 + var code = children[j].code;
  204 + for(var k=0;k < xlList.length;k++ ){
  205 + if(xlList[k]["fgsbm"]==code && xlList[k]["gsbm"]==companyCode){
  206 + data.push({id: xlList[k]["xlbm"], text: xlList[k]["xlname"]});
  207 + tempData[xlList[k]["xlbm"]] = companyCode+":"+code;
  208 + }
  209 + }
  210 + }
  211 + }
  212 + initPinYinSelect2('#line',data,'');
  213 +
  214 + });
  215 + });
  216 +
  217 + $("#line").on("change", function(){
  218 + if($("#line").val() == " "){
  219 + $("#gsdm").attr("disabled", false);
  220 + $("#fgsdm").attr("disabled", false);
  221 + } else {
  222 + var temp = tempData[$("#line").val()].split(":");
  223 + $("#gsdm").val(temp[0]);
  224 + updateCompany();
  225 + $("#fgsdm").val(temp[1]);
  226 + $("#gsdm").attr("disabled", true);
  227 + $("#fgsdm").attr("disabled", true);
  228 + }
  229 + });
  230 +
  231 + var line ="";
  232 + var xlName ="";
  233 + var date = "";
  234 + var date2 ="";
  235 + var gsdm="";
  236 + var fgsdm="";
  237 + $("#query").on("click",function(){
  238 + $("#countLine").height($(window).height()-280);
  239 + if($("#date").val() == null || $("#date").val().trim().length == 0){
  240 + layer.msg("请选择时间范围!");
  241 + return;
  242 + }
  243 + if($("#date2").val() == null || $("#date2").val().trim().length == 0){
  244 + layer.msg("请选择时间范围!");
  245 + return;
  246 + }
  247 + line = $("#line").val();
  248 + xlName = $("#select2-line-container").html();
  249 + date = $("#date").val();
  250 + date2 =$("#date2").val();
  251 + gsdm =$("#gsdm").val();
  252 + fgsdm=$("#fgsdm").val();
  253 + if(line=="请选择"){
  254 + line="";
  255 + }
  256 + if(date==null || date =="" ||date2==null || date2 ==""){
  257 + layer.msg('请选择时间段.');
  258 + }else{
  259 + var params = {};
  260 + params['gsdm'] = gsdm;
  261 + params['fgsdm'] =fgsdm ;
  262 + params['line'] = line;
  263 + params['date'] = date;
  264 + params['date2'] = date2;
  265 + params['xlName'] = xlName;
  266 + params['type'] = "query";
  267 + var i = layer.load(2);
  268 + $get('/calcWaybill/getLineMileage',params,function(result){
  269 + $("#datetodate").html(date+"至"+date2);
  270 + layer.close(i);
  271 + // 把数据填充到模版中
  272 + var tbodyHtml = template('countLineListSj',{list:result});
  273 + // 把渲染好的模版html文本追加到表格中
  274 + $('#forms .countLineSj').html(tbodyHtml);
  275 +
  276 + if(result.length == 0)
  277 + $("#export").attr('disabled',"true");
  278 + else
  279 + $("#export").removeAttr("disabled");
  280 + });
  281 + }
  282 +
  283 + });
  284 + $("#countLine").height($(window).height()-280);
  285 + $("#export").on("click",function(){
  286 + var params = {};
  287 + params['gsdm'] = gsdm;
  288 + params['fgsdm'] =fgsdm ;
  289 + params['line'] = line;
  290 + params['date'] = date;
  291 + params['date2'] = date2;
  292 + params['xlName'] = xlName;
  293 + params['type'] = "export";
  294 + params['by']='sj';
  295 + $get('/calcWaybill/getLineMileage',params,function(result){
  296 + window.open("/downloadFile/download?fileName=线路公里统计表");
  297 + });
  298 + });
  299 + });
  300 +</script>
  301 +<script type="text/html" id="countLineListSj">
  302 + {{each list as obj i}}
  303 + <tr>
  304 + <td>{{obj.gs}}</td>
  305 + <td>{{obj.fgs}}</td>
  306 + <td>{{obj.xlName}}</td>
  307 + <td>{{obj.jhzlc}}</td>
  308 + <td>{{obj.jhlc}}</td>
  309 + <td>{{obj.jcclc}}</td>
  310 + <td>{{obj.sjzgl}}</td>
  311 + <td>{{obj.jhnlc}}</td>
  312 + <td>{{obj.jhwlc}}</td>
  313 + <td>{{obj.jhnjcclc}}</td>
  314 + <td>{{obj.jhwjcclc_z}}</td>
  315 + <td>{{obj.zrwjcclc}}</td>
  316 + <td>{{obj.zrwjcclc1}}</td>
  317 + <td>{{obj.zrwjcclc2}}</td>
  318 + <td>{{obj.kfks}}</td>
  319 + <td>{{obj.lbss}}</td>
  320 + <td>{{obj.ssgl_lz}}</td>
  321 + <td>{{obj.ssgl_dm}}</td>
  322 + <td>{{obj.ssgl_gz}}</td>
  323 + <td>{{obj.ssgl_jf}}</td>
  324 + <td>{{obj.ssgl_zs}}</td>
  325 + <td>{{obj.ssgl_qr}}</td>
  326 + <td>{{obj.ssgl_qc}}</td>
  327 + <td>{{obj.ssgl_kx}}</td>
  328 + <td>{{obj.ssgl_qh}}</td>
  329 + <td>{{obj.ssgl_yw}}</td>
  330 + <td>{{obj.ssgl_other}}</td>
  331 + <td>{{obj.ljyy}}</td>
  332 + <td>{{obj.ljjcc}}</td>
  333 + <td>{{obj.ljkfks}}</td>
  334 + </tr>
  335 + {{/each}}
  336 + {{if list.length == 0}}
  337 + <tr>
  338 + <td colspan="30"><h6 class="muted">没有找到相关数据</h6></td>
  339 + </tr>
  340 + {{/if}}
  341 +</script>
0 \ No newline at end of file 342 \ No newline at end of file
src/main/resources/static/pages/forms/statement/statisticsDailyCalc.html
@@ -314,7 +314,8 @@ @@ -314,7 +314,8 @@
314 params['date2'] = date2; 314 params['date2'] = date2;
315 params['xlName'] = xlName; 315 params['xlName'] = xlName;
316 params['type'] = "export"; 316 params['type'] = "export";
317 - $get('/realSchedule/statisticsDailyTj',params,function(result){ 317 +// $get('/realSchedule/statisticsDailyTj',params,function(result){
  318 + $get('/calcWaybill/statisticsDailyTj',params,function(result){
318 window.open("/downloadFile/download?fileName=统计日报"+moment(date).format("YYYYMMDD")); 319 window.open("/downloadFile/download?fileName=统计日报"+moment(date).format("YYYYMMDD"));
319 }); 320 });
320 }); 321 });
src/main/resources/static/pages/forms/statement/statisticsDailyCalc2.html
@@ -314,7 +314,8 @@ @@ -314,7 +314,8 @@
314 params['date2'] = date2; 314 params['date2'] = date2;
315 params['xlName'] = xlName; 315 params['xlName'] = xlName;
316 params['type'] = "export"; 316 params['type'] = "export";
317 - $get('/realSchedule/statisticsDailyTj',params,function(result){ 317 +// $get('/realSchedule/statisticsDailyTj',params,function(result){
  318 + $get('/calcWaybill/calcStatisticsDaily',params,function(result){
318 window.open("/downloadFile/download?fileName=统计日报"+moment(date).format("YYYYMMDD")); 319 window.open("/downloadFile/download?fileName=统计日报"+moment(date).format("YYYYMMDD"));
319 }); 320 });
320 }); 321 });