Commit d6c2acf5c96fe24e9732cf2abe66ddf8aea97c0c

Authored by 娄高锋
1 parent 9ccbb2fb

青浦调度添加报表:路单线路明细月报年报表。

src/main/java/com/bsth/controller/calc/CalcWaybillController.java
@@ -10,6 +10,8 @@ import org.springframework.web.bind.annotation.RequestMapping; @@ -10,6 +10,8 @@ import org.springframework.web.bind.annotation.RequestMapping;
10 import org.springframework.web.bind.annotation.RequestParam; 10 import org.springframework.web.bind.annotation.RequestParam;
11 import org.springframework.web.bind.annotation.RestController; 11 import org.springframework.web.bind.annotation.RestController;
12 12
  13 +import java.text.SimpleDateFormat;
  14 +import java.util.Date;
13 import java.util.HashMap; 15 import java.util.HashMap;
14 import java.util.List; 16 import java.util.List;
15 import java.util.Map; 17 import java.util.Map;
@@ -26,10 +28,17 @@ public class CalcWaybillController extends BaseController<CalcWaybill, Integer> @@ -26,10 +28,17 @@ public class CalcWaybillController extends BaseController<CalcWaybill, Integer>
26 28
27 @RequestMapping(value="/generateNew") 29 @RequestMapping(value="/generateNew")
28 public Map<String, Object> generateNews(@RequestParam Map<String, Object> map) throws Exception{ 30 public Map<String, Object> generateNews(@RequestParam Map<String, Object> map) throws Exception{
29 - String date = "", line = "", key=""; 31 + Map<String, Object> resMap = new HashMap<String, Object>();
  32 + String date = "", date1 = "", date2 = "", line = "", key="";
30 if(map.get("date")!=null){ 33 if(map.get("date")!=null){
31 date=map.get("date").toString().trim(); 34 date=map.get("date").toString().trim();
32 } 35 }
  36 + if(map.get("date1")!=null){
  37 + date1=map.get("date1").toString().trim();
  38 + }
  39 + if(map.get("date2")!=null){
  40 + date2=map.get("date2").toString().trim();
  41 + }
33 if(map.get("line")!=null){ 42 if(map.get("line")!=null){
34 line=map.get("line").toString().trim(); 43 line=map.get("line").toString().trim();
35 } 44 }
@@ -37,25 +46,65 @@ public class CalcWaybillController extends BaseController&lt;CalcWaybill, Integer&gt; @@ -37,25 +46,65 @@ public class CalcWaybillController extends BaseController&lt;CalcWaybill, Integer&gt;
37 key=map.get("key").toString().trim(); 46 key=map.get("key").toString().trim();
38 } 47 }
39 48
40 - Map<String, Object> m = new HashMap<String, Object>();  
41 - m.put("date", date);  
42 - m.put("line", line);  
43 - m.put("key", key);  
44 - try {  
45 -  
46 - m = calcWaybillService.generateNew(date, line);  
47 -  
48 - if(key.length() == 0){  
49 - m.put("status", calcWaybillService.calcDaily(date, line)); 49 + if(date.length() > 0){
  50 + try {
  51 +
  52 + if(key.length() == 0){
  53 + resMap = calcWaybillService.generateNew(date, line);
  54 + resMap.put("status", calcWaybillService.calcDaily(date, line));
  55 + } else if("1".equals(key)){
  56 + resMap = calcWaybillService.generateNew(date, line);
  57 + } else if("2".equals(key)){
  58 + resMap.put("status", calcWaybillService.calcDaily(date, line));
  59 + }
  60 +
  61 + } catch (Exception e) {
  62 + // TODO: handle exception
  63 + e.printStackTrace();
  64 + resMap.put("status", ResponseCode.ERROR);
  65 + resMap.put("date", date);
  66 + resMap.put("line", line);
  67 + resMap.put("key", key);
  68 + return resMap;
50 } 69 }
51 -  
52 - } catch (Exception e) {  
53 - // TODO: handle exception  
54 - e.printStackTrace();  
55 - m.put("status", ResponseCode.ERROR);  
56 - return m; 70 + resMap.put("date", date);
  71 + resMap.put("line", line);
  72 + resMap.put("key", key);
  73 + } else if(date1.length() > 0 && date2.length() > 0){
  74 + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
  75 + Date parse1 = sdf.parse(date1);
  76 + Date parse2 = sdf.parse(date2);
  77 + for(Date d = new Date(parse1.getTime());
  78 + d.getTime() <= parse2.getTime();
  79 + d.setTime(d.getTime() + 1l*1000*60*60*24)){
  80 + try {
  81 +
  82 + if(key.length() == 0){
  83 + resMap = calcWaybillService.generateNew(sdf.format(d), line);
  84 + resMap.put("status", calcWaybillService.calcDaily(sdf.format(d), line));
  85 + } else if("1".equals(key)){
  86 + resMap = calcWaybillService.generateNew(sdf.format(d), line);
  87 + } else if("2".equals(key)){
  88 + resMap.put("status", calcWaybillService.calcDaily(sdf.format(d), line));
  89 + }
  90 +
  91 + } catch (Exception e) {
  92 + // TODO: handle exception
  93 + e.printStackTrace();
  94 + resMap.put("status", ResponseCode.ERROR);
  95 + resMap.put("date1", date1);
  96 + resMap.put("date2", date2);
  97 + resMap.put("line", line);
  98 + resMap.put("key", key);
  99 + return resMap;
  100 + }
  101 + }
  102 + resMap.put("date1", date1);
  103 + resMap.put("date2", date2);
  104 + resMap.put("line", line);
  105 + resMap.put("key", key);
57 } 106 }
58 - return m; 107 + return resMap;
59 } 108 }
60 109
61 @RequestMapping(value="/statisticsDailyTj") 110 @RequestMapping(value="/statisticsDailyTj")
@@ -317,4 +366,8 @@ public class CalcWaybillController extends BaseController&lt;CalcWaybill, Integer&gt; @@ -317,4 +366,8 @@ public class CalcWaybillController extends BaseController&lt;CalcWaybill, Integer&gt;
317 return calcWaybillService.getBusMileage(line, date, date2, xlName, zt, by, type); 366 return calcWaybillService.getBusMileage(line, date, date2, xlName, zt, by, type);
318 } 367 }
319 368
  369 + @RequestMapping(value="/calcDetailMonthly")
  370 + public List<List<String>> calcDetailMonthly(@RequestParam Map<String, Object> map){
  371 + return calcWaybillService.calcDetailMonthly(map);
  372 + }
320 } 373 }
src/main/java/com/bsth/data/schedule/thread/CalcOilThread.java
@@ -36,22 +36,39 @@ public class CalcOilThread extends Thread{ @@ -36,22 +36,39 @@ public class CalcOilThread extends Thread{
36 @Override 36 @Override
37 public void run() { 37 public void run() {
38 try{ 38 try{
39 - logger.info("开始计算路单里程加注量....");  
40 - ylbService.obtainDsq();  
41 - dlbService.obtainDsq();  
42 - logger.info("计算路单里程加注量结束!");  
43 - logger.info("开始计算班次准点率...."); 39 + logger.info("开始计算路单里程加油量....");
  40 + ylbService.obtainDsq();
  41 + logger.info("计算路单里程加油量结束!");
  42 + } catch(Exception e){
  43 + logger.error("计算路单里程加油量失败",e);
  44 + }
  45 + try{
  46 + logger.info("开始计算路单里程充电量....");
  47 + dlbService.obtainDsq();
  48 + logger.info("计算路单里程充电量结束!");
  49 + } catch(Exception e){
  50 + logger.error("计算路单里程充电量失败",e);
  51 + }
  52 + try{
  53 + logger.info("开始计算班次准点率....");
44 sheetService.saveSheetList(""); 54 sheetService.saveSheetList("");
45 logger.info("计算班次准点率结束!"); 55 logger.info("计算班次准点率结束!");
46 -  
47 - logger.info("开始保存重新统计数据...."); 56 + } catch(Exception e){
  57 + logger.error("计算班次准点率失败",e);
  58 + }
  59 + try{
  60 + logger.info("开始保存重新统计数据....");
48 calcWaybillService.autoGenerate("", ""); 61 calcWaybillService.autoGenerate("", "");
49 logger.info("重新统计保存结束!"); 62 logger.info("重新统计保存结束!");
50 - logger.info("开始保存统计日报...."); 63 + } catch(Exception e){
  64 + logger.error("重新统计保存失败",e);
  65 + }
  66 + try{
  67 + logger.info("开始保存统计日报....");
51 calcWaybillService.calcDaily("", ""); 68 calcWaybillService.calcDaily("", "");
52 logger.info("统计日报保存结束!"); 69 logger.info("统计日报保存结束!");
53 } catch(Exception e){ 70 } catch(Exception e){
54 - logger.error("计算路单里程加注量失败",e); 71 + logger.error("统计日报保存失败",e);
55 } 72 }
56 73
57 //清除指令数据 74 //清除指令数据
src/main/java/com/bsth/entity/calc/CalcWaybillDetail.java 0 → 100644
  1 +package com.bsth.entity.calc;
  2 +
  3 +import java.util.Date;
  4 +// calcDetailMonthly.html 返回类
  5 +public class CalcWaybillDetail {
  6 + private Long id;
  7 + /* 公司代码*/
  8 + private String gsdm;
  9 + /* 公司名称*/
  10 + private String gsname;
  11 + /* 分公司代码*/
  12 + private String fgsdm;
  13 + /* 分公司名称*/
  14 + private String fgsname;
  15 + /* 日期*/
  16 + private Date rq;
  17 + /* 日期字符串*/
  18 + private String rqStr;
  19 + /* 线路编码*/
  20 + private String xl;
  21 + /* 线路名称*/
  22 + private String xlName;
  23 + /* 车辆自编号*/
  24 + private String cl;
  25 + /* 路牌名字*/
  26 + private String lp;
  27 + /* 驾驶员工号*/
  28 + private String jGh;
  29 + /* 驾驶员名字*/
  30 + private String jName;
  31 + /* 售票员工号*/
  32 + private String sGh;
  33 + /* 售票员名字*/
  34 + private String sName;
  35 + /* 计划营运班次*/
  36 + private int jhyybc=0;
  37 + /* 计划早高峰营运班次*/
  38 + private int jhyybczgf=0;
  39 + /* 计划晚高峰营运班次*/
  40 + private int jhyybcwgf=0;
  41 + /* 计划非营运班次*/
  42 + private int jhfyybc=0;
  43 + /* 计划营运里程*/
  44 + private Double jhyylc=0.0;
  45 + /* 计划非营运里程*/
  46 + private Double jhfyylc=0.0;
  47 + /* 实际营运班次*/
  48 + private int sjyybc=0;
  49 + /* 实际早高峰营运班次*/
  50 + private int sjyybczgf=0;
  51 + /* 实际晚高峰营运班次*/
  52 + private int sjyybcwgf=0;
  53 + /* 实际非营运班次*/
  54 + private int sjfyybc=0;
  55 + /* 实际营运里程*/
  56 + private Double sjyylc=0.0;
  57 + /* 实际非营运里程*/
  58 + private Double sjfyylc=0.0;
  59 + /* 临加班次*/
  60 + private int ljbc=0;
  61 + /* 临加早高峰班次*/
  62 + private int ljbczgf=0;
  63 + /* 临加晚高峰班次*/
  64 + private int ljbcwgf=0;
  65 + /* 临加营运里程*/
  66 + private Double ljyylc=0.0;
  67 + /* 临加非营运里程*/
  68 + private Double ljfyylc=0.0;
  69 + /* 烂班班次*/
  70 + private int lbbc=0;
  71 + /* 烂班里程*/
  72 + private Double lblc=0.0;
  73 +
  74 +
  75 + // 总里程
  76 + private Double zlc=0.0;
  77 + private Double czlc=0.0;
  78 + private Double jzlc=0.0;
  79 + // 出场油量
  80 + private Double czyl=0.0;
  81 + // 进场油量
  82 + private Double jzyl=0.0;
  83 + // 加注量
  84 + private Double jzl=0.0;
  85 + // 加注量 0号柴油
  86 + private Double jzl0=0.0;
  87 + // 加注量 -10#号柴油
  88 + private Double jzl10=0.0;
  89 + // 油耗
  90 + private Double yh=0.0;
  91 + // 百公里油耗
  92 + private Double bglyh=0.0;
  93 + // 损耗
  94 + private Double sh=0.0;
  95 + // 燃油类型
  96 + private String rylx;
  97 +
  98 + //出站存电
  99 + private Double czcd=0.0;
  100 + //进站存电
  101 + private Double jzcd=0.0;
  102 + //充电量
  103 + private Double cdl=0.0;
  104 + //耗电
  105 + private Double hd=0.0;
  106 + //百公里耗电
  107 + private Double bglhd=0.0;
  108 +
  109 + // 天数记录
  110 + private int ts;
  111 +
  112 + /* 创建时间*/
  113 + private Date createTime;
  114 + /* 修改时间*/
  115 + private Date updateTime;
  116 + public Long getId() {
  117 + return id;
  118 + }
  119 + public void setId(Long id) {
  120 + this.id = id;
  121 + }
  122 + public String getGsdm() {
  123 + return gsdm;
  124 + }
  125 + public void setGsdm(String gsdm) {
  126 + this.gsdm = gsdm;
  127 + }
  128 + public String getGsname() {
  129 + return gsname;
  130 + }
  131 + public void setGsname(String gsname) {
  132 + this.gsname = gsname;
  133 + }
  134 + public String getFgsdm() {
  135 + return fgsdm;
  136 + }
  137 + public void setFgsdm(String fgsdm) {
  138 + this.fgsdm = fgsdm;
  139 + }
  140 + public String getFgsname() {
  141 + return fgsname;
  142 + }
  143 + public void setFgsname(String fgsname) {
  144 + this.fgsname = fgsname;
  145 + }
  146 + public Date getRq() {
  147 + return rq;
  148 + }
  149 + public void setRq(Date rq) {
  150 + this.rq = rq;
  151 + }
  152 + public String getRqStr() {
  153 + return rqStr;
  154 + }
  155 + public void setRqStr(String rqStr) {
  156 + this.rqStr = rqStr;
  157 + }
  158 + public String getXl() {
  159 + return xl;
  160 + }
  161 + public void setXl(String xl) {
  162 + this.xl = xl;
  163 + }
  164 + public String getXlName() {
  165 + return xlName;
  166 + }
  167 + public void setXlName(String xlName) {
  168 + this.xlName = xlName;
  169 + }
  170 + public String getCl() {
  171 + return cl;
  172 + }
  173 + public void setCl(String cl) {
  174 + this.cl = cl;
  175 + }
  176 + public String getLp() {
  177 + return lp;
  178 + }
  179 + public void setLp(String lp) {
  180 + this.lp = lp;
  181 + }
  182 + public String getjGh() {
  183 + return jGh;
  184 + }
  185 + public void setjGh(String jGh) {
  186 + this.jGh = jGh;
  187 + }
  188 + public String getjName() {
  189 + return jName;
  190 + }
  191 + public void setjName(String jName) {
  192 + this.jName = jName;
  193 + }
  194 + public String getsGh() {
  195 + return sGh;
  196 + }
  197 + public void setsGh(String sGh) {
  198 + this.sGh = sGh;
  199 + }
  200 + public String getsName() {
  201 + return sName;
  202 + }
  203 + public void setsName(String sName) {
  204 + this.sName = sName;
  205 + }
  206 + public int getJhyybc() {
  207 + return jhyybc;
  208 + }
  209 + public void setJhyybc(int jhyybc) {
  210 + this.jhyybc = jhyybc;
  211 + }
  212 + public int getJhyybczgf() {
  213 + return jhyybczgf;
  214 + }
  215 + public void setJhyybczgf(int jhyybczgf) {
  216 + this.jhyybczgf = jhyybczgf;
  217 + }
  218 + public int getJhyybcwgf() {
  219 + return jhyybcwgf;
  220 + }
  221 + public void setJhyybcwgf(int jhyybcwgf) {
  222 + this.jhyybcwgf = jhyybcwgf;
  223 + }
  224 + public int getJhfyybc() {
  225 + return jhfyybc;
  226 + }
  227 + public void setJhfyybc(int jhfyybc) {
  228 + this.jhfyybc = jhfyybc;
  229 + }
  230 + public Double getJhyylc() {
  231 + return jhyylc;
  232 + }
  233 + public void setJhyylc(Double jhyylc) {
  234 + this.jhyylc = jhyylc;
  235 + }
  236 + public Double getJhfyylc() {
  237 + return jhfyylc;
  238 + }
  239 + public void setJhfyylc(Double jhfyylc) {
  240 + this.jhfyylc = jhfyylc;
  241 + }
  242 + public int getSjyybc() {
  243 + return sjyybc;
  244 + }
  245 + public void setSjyybc(int sjyybc) {
  246 + this.sjyybc = sjyybc;
  247 + }
  248 + public int getSjyybczgf() {
  249 + return sjyybczgf;
  250 + }
  251 + public void setSjyybczgf(int sjyybczgf) {
  252 + this.sjyybczgf = sjyybczgf;
  253 + }
  254 + public int getSjyybcwgf() {
  255 + return sjyybcwgf;
  256 + }
  257 + public void setSjyybcwgf(int sjyybcwgf) {
  258 + this.sjyybcwgf = sjyybcwgf;
  259 + }
  260 + public int getSjfyybc() {
  261 + return sjfyybc;
  262 + }
  263 + public void setSjfyybc(int sjfyybc) {
  264 + this.sjfyybc = sjfyybc;
  265 + }
  266 + public Double getSjyylc() {
  267 + return sjyylc;
  268 + }
  269 + public void setSjyylc(Double sjyylc) {
  270 + this.sjyylc = sjyylc;
  271 + }
  272 + public Double getSjfyylc() {
  273 + return sjfyylc;
  274 + }
  275 + public void setSjfyylc(Double sjfyylc) {
  276 + this.sjfyylc = sjfyylc;
  277 + }
  278 + public int getLjbc() {
  279 + return ljbc;
  280 + }
  281 + public void setLjbc(int ljbc) {
  282 + this.ljbc = ljbc;
  283 + }
  284 + public int getLjbczgf() {
  285 + return ljbczgf;
  286 + }
  287 + public void setLjbczgf(int ljbczgf) {
  288 + this.ljbczgf = ljbczgf;
  289 + }
  290 + public int getLjbcwgf() {
  291 + return ljbcwgf;
  292 + }
  293 + public void setLjbcwgf(int ljbcwgf) {
  294 + this.ljbcwgf = ljbcwgf;
  295 + }
  296 + public Double getLjyylc() {
  297 + return ljyylc;
  298 + }
  299 + public void setLjyylc(Double ljyylc) {
  300 + this.ljyylc = ljyylc;
  301 + }
  302 + public Double getLjfyylc() {
  303 + return ljfyylc;
  304 + }
  305 + public void setLjfyylc(Double ljfyylc) {
  306 + this.ljfyylc = ljfyylc;
  307 + }
  308 + public int getLbbc() {
  309 + return lbbc;
  310 + }
  311 + public void setLbbc(int lbbc) {
  312 + this.lbbc = lbbc;
  313 + }
  314 + public Double getLblc() {
  315 + return lblc;
  316 + }
  317 + public void setLblc(Double lblc) {
  318 + this.lblc = lblc;
  319 + }
  320 +
  321 + public Double getZlc() {
  322 + return zlc;
  323 + }
  324 +
  325 + public void setZlc(Double zlc) {
  326 + this.zlc = zlc;
  327 + }
  328 +
  329 + public Double getCzlc() {
  330 + return czlc;
  331 + }
  332 +
  333 + public void setCzlc(Double czlc) {
  334 + this.czlc = czlc;
  335 + }
  336 +
  337 + public Double getJzlc() {
  338 + return jzlc;
  339 + }
  340 +
  341 + public void setJzlc(Double jzlc) {
  342 + this.jzlc = jzlc;
  343 + }
  344 +
  345 + public Double getCzyl() {
  346 + return czyl;
  347 + }
  348 +
  349 + public void setCzyl(Double czyl) {
  350 + this.czyl = czyl;
  351 + }
  352 +
  353 + public Double getJzyl() {
  354 + return jzyl;
  355 + }
  356 +
  357 + public void setJzyl(Double jzyl) {
  358 + this.jzyl = jzyl;
  359 + }
  360 +
  361 + public Double getJzl() {
  362 + return jzl;
  363 + }
  364 +
  365 + public Double getJzl0() {
  366 + return jzl0;
  367 + }
  368 +
  369 + public void setJzl0(Double jzl0) {
  370 + this.jzl0 = jzl0;
  371 + }
  372 +
  373 + public Double getJzl10() {
  374 + return jzl10;
  375 + }
  376 +
  377 + public void setJzl10(Double jzl10) {
  378 + this.jzl10 = jzl10;
  379 + }
  380 +
  381 + public void setJzl(Double jzl) {
  382 + this.jzl = jzl;
  383 + }
  384 +
  385 + public Double getYh() {
  386 + return yh;
  387 + }
  388 +
  389 + public void setYh(Double yh) {
  390 + this.yh = yh;
  391 + }
  392 +
  393 + public Double getBglyh() {
  394 + return bglyh;
  395 + }
  396 +
  397 + public void setBglyh(Double bglyh) {
  398 + this.bglyh = bglyh;
  399 + }
  400 +
  401 + public Double getSh() {
  402 + return sh;
  403 + }
  404 +
  405 + public void setSh(Double sh) {
  406 + this.sh = sh;
  407 + }
  408 +
  409 + public String getRylx() {
  410 + return rylx;
  411 + }
  412 +
  413 + public void setRylx(String rylx) {
  414 + this.rylx = rylx;
  415 + }
  416 +
  417 + public Double getCzcd() {
  418 + return czcd;
  419 + }
  420 +
  421 + public void setCzcd(Double czcd) {
  422 + this.czcd = czcd;
  423 + }
  424 +
  425 + public Double getJzcd() {
  426 + return jzcd;
  427 + }
  428 +
  429 + public void setJzcd(Double jzcd) {
  430 + this.jzcd = jzcd;
  431 + }
  432 +
  433 + public Double getCdl() {
  434 + return cdl;
  435 + }
  436 +
  437 + public void setCdl(Double cdl) {
  438 + this.cdl = cdl;
  439 + }
  440 +
  441 + public Double getHd() {
  442 + return hd;
  443 + }
  444 +
  445 + public void setHd(Double hd) {
  446 + this.hd = hd;
  447 + }
  448 +
  449 + public Double getBglhd() {
  450 + return bglhd;
  451 + }
  452 +
  453 + public void setBglhd(Double bglhd) {
  454 + this.bglhd = bglhd;
  455 + }
  456 +
  457 + public int getTs() {
  458 + return ts;
  459 + }
  460 +
  461 + public void setTs(int ts) {
  462 + this.ts = ts;
  463 + }
  464 +
  465 + public Date getCreateTime() {
  466 + return createTime;
  467 + }
  468 + public void setCreateTime(Date createTime) {
  469 + this.createTime = createTime;
  470 + }
  471 + public Date getUpdateTime() {
  472 + return updateTime;
  473 + }
  474 + public void setUpdateTime(Date updateTime) {
  475 + this.updateTime = updateTime;
  476 + }
  477 +
  478 +
  479 +
  480 +}
0 \ No newline at end of file 481 \ No newline at end of file
src/main/java/com/bsth/repository/calc/CalcWaybillRepository.java
@@ -68,5 +68,26 @@ public interface CalcWaybillRepository extends BaseRepository&lt;CalcWaybill, Integ @@ -68,5 +68,26 @@ public interface CalcWaybillRepository extends BaseRepository&lt;CalcWaybill, Integ
68 //按照时间段统计,公司下线路 (车辆自编号) 68 //按照时间段统计,公司下线路 (车辆自编号)
69 @Query(value="select DISTINCT c from CalcWaybill c where c.xl like %?1% and c.rqStr between ?2 and ?3 and c.gsdm like %?4% and c.fgsdm like %?5% and cl like %?6% order by c.xl") 69 @Query(value="select DISTINCT c from CalcWaybill c where c.xl like %?1% and c.rqStr between ?2 and ?3 and c.gsdm like %?4% and c.fgsdm like %?5% and cl like %?6% order by c.xl")
70 List<CalcWaybill> scheduleByZbh(String line,String date,String date2,String gsdm,String fgsdm,String zbh); 70 List<CalcWaybill> scheduleByZbh(String line,String date,String date2,String gsdm,String fgsdm,String zbh);
  71 + @Query(value="select DISTINCT c from CalcWaybill c where c.xl like %?1% and c.rqStr between ?2 and ?3 and c.gsdm like %?4% and c.fgsdm like %?5% and c.cl like %?6%"
  72 + + " and c.cl in (select s.insideCode from Cars s where s.sfdc = ?7) order by c.xl")
  73 + List<CalcWaybill> scheduleByZbh(String line,String date,String date2,String gsdm,String fgsdm,String zbh,Boolean sfdc);
  74 +
  75 +
  76 + //按照时间段统计,公司下线路 (驾驶员)
  77 + @Query(value="select DISTINCT c from CalcWaybill c where c.xl in(?1) and c.rqStr between ?2 and ?3 and c.gsdm in(?4) and c.fgsdm in(?5) " +
  78 + "and c.xl in (select l.lineCode from Line l where l.destroy in (?6)) order by c.jGh,c.fgsdm,c.xl,c.rqStr")
  79 + List<CalcWaybill> scheduleByJsy2(List<String> line,String date,String date2,List<String> gsdm,List<String> fgsdm, List<Integer> destroy);
  80 + //按照时间段统计,公司下线路 (售票员) coalesce(c.sGh,'')
  81 + @Query(value="select DISTINCT c from CalcWaybill c where c.xl in(?1) and c.rqStr between ?2 and ?3 and c.gsdm in(?4) and c.fgsdm in(?5) and c.sGh <> null and c.sGh <> '' " +
  82 + "and c.xl in (select l.lineCode from Line l where l.destroy in (?6)) order by c.sGh,c.fgsdm,c.xl,c.rqStr")
  83 + List<CalcWaybill> scheduleBySpy2(List<String> line,String date,String date2,List<String> gsdm,List<String> fgsdm, List<Integer> destroy);
  84 + //按照时间段统计,公司下线路 (车辆自编号)
  85 + @Query(value="select DISTINCT c from CalcWaybill c where c.xl in(?1) and c.rqStr between ?2 and ?3 and c.gsdm in(?4) and c.fgsdm in(?5) " +
  86 + "and c.xl in (select l.lineCode from Line l where l.destroy in (?6)) order by c.cl,c.fgsdm,c.xl,c.rqStr")
  87 + List<CalcWaybill> scheduleByZbh2(List<String> line,String date,String date2,List<String> gsdm,List<String> fgsdm, List<Integer> destroy);
  88 + //按照时间段统计,公司下线路 排序不同
  89 + @Query(value="select DISTINCT c from CalcWaybill c where c.xl in(?1) and c.rqStr between ?2 and ?3 and c.gsdm in(?4) and c.fgsdm in(?5) " +
  90 + "and c.xl in (select l.lineCode from Line l where l.destroy in (?6)) order by c.fgsdm,c.xl,c.rqStr")
  91 + List<CalcWaybill> scheduleByDateAndLineTjPx(List<String> line,String date,String date2,List<String> gsdm,List<String> fgsdm, List<Integer> destroy);
71 92
72 } 93 }
src/main/java/com/bsth/service/calc/CalcWaybillService.java
@@ -42,4 +42,5 @@ public interface CalcWaybillService extends BaseService&lt;CalcWaybill, Integer&gt; { @@ -42,4 +42,5 @@ public interface CalcWaybillService extends BaseService&lt;CalcWaybill, Integer&gt; {
42 42
43 List<Map<String, Object>> getBusMileage(String line, String date, String date2, String xlName, String zt, String by, String type); 43 List<Map<String, Object>> getBusMileage(String line, String date, String date2, String xlName, String zt, String by, String type);
44 44
  45 + List<List<String>> calcDetailMonthly(Map<String, Object> map);
45 } 46 }
src/main/java/com/bsth/service/calc/impl/CalcWaybillServiceImpl.java
@@ -2,6 +2,7 @@ package com.bsth.service.calc.impl; @@ -2,6 +2,7 @@ package com.bsth.service.calc.impl;
2 2
3 import java.sql.ResultSet; 3 import java.sql.ResultSet;
4 import java.sql.SQLException; 4 import java.sql.SQLException;
  5 +import java.text.DecimalFormat;
5 import java.text.ParseException; 6 import java.text.ParseException;
6 import java.text.SimpleDateFormat; 7 import java.text.SimpleDateFormat;
7 import java.util.ArrayList; 8 import java.util.ArrayList;
@@ -16,20 +17,28 @@ import java.util.List; @@ -16,20 +17,28 @@ import java.util.List;
16 import java.util.Map; 17 import java.util.Map;
17 import java.util.Map.Entry; 18 import java.util.Map.Entry;
18 import java.util.Set; 19 import java.util.Set;
  20 +import java.util.TreeMap;
19 21
20 import javax.transaction.Transactional; 22 import javax.transaction.Transactional;
21 23
  24 +import com.alibaba.fastjson.JSON;
  25 +import com.alibaba.fastjson.JSONArray;
22 import com.bsth.common.ResponseCode; 26 import com.bsth.common.ResponseCode;
23 import com.bsth.data.BasicData; 27 import com.bsth.data.BasicData;
  28 +import com.bsth.entity.Cars;
24 import com.bsth.entity.Line; 29 import com.bsth.entity.Line;
25 import com.bsth.entity.calc.CalcBusMileage; 30 import com.bsth.entity.calc.CalcBusMileage;
26 import com.bsth.entity.calc.CalcInterval; 31 import com.bsth.entity.calc.CalcInterval;
27 import com.bsth.entity.calc.CalcLineMileage; 32 import com.bsth.entity.calc.CalcLineMileage;
28 import com.bsth.entity.calc.CalcStatistics; 33 import com.bsth.entity.calc.CalcStatistics;
29 import com.bsth.entity.calc.CalcWaybill; 34 import com.bsth.entity.calc.CalcWaybill;
  35 +import com.bsth.entity.calc.CalcWaybillDetail;
  36 +import com.bsth.entity.oil.Dlb;
  37 +import com.bsth.entity.oil.Ylb;
30 import com.bsth.entity.realcontrol.ChildTaskPlan; 38 import com.bsth.entity.realcontrol.ChildTaskPlan;
31 import com.bsth.entity.realcontrol.ScheduleRealInfo; 39 import com.bsth.entity.realcontrol.ScheduleRealInfo;
32 import com.bsth.entity.sys.Interval; 40 import com.bsth.entity.sys.Interval;
  41 +import com.bsth.repository.CarsRepository;
33 import com.bsth.repository.LineRepository; 42 import com.bsth.repository.LineRepository;
34 import com.bsth.repository.calc.CalcBusMileageRepository; 43 import com.bsth.repository.calc.CalcBusMileageRepository;
35 import com.bsth.repository.calc.CalcIntervalRepository; 44 import com.bsth.repository.calc.CalcIntervalRepository;
@@ -51,8 +60,10 @@ import com.github.stuxuhai.jpinyin.PinyinException; @@ -51,8 +60,10 @@ import com.github.stuxuhai.jpinyin.PinyinException;
51 import com.github.stuxuhai.jpinyin.PinyinFormat; 60 import com.github.stuxuhai.jpinyin.PinyinFormat;
52 import com.github.stuxuhai.jpinyin.PinyinHelper; 61 import com.github.stuxuhai.jpinyin.PinyinHelper;
53 62
  63 +import org.apache.commons.lang3.StringUtils;
54 import org.slf4j.Logger; 64 import org.slf4j.Logger;
55 import org.slf4j.LoggerFactory; 65 import org.slf4j.LoggerFactory;
  66 +import org.springframework.beans.BeanUtils;
56 import org.springframework.beans.factory.annotation.Autowired; 67 import org.springframework.beans.factory.annotation.Autowired;
57 import org.springframework.jdbc.core.JdbcTemplate; 68 import org.springframework.jdbc.core.JdbcTemplate;
58 import org.springframework.jdbc.core.RowMapper; 69 import org.springframework.jdbc.core.RowMapper;
@@ -97,6 +108,8 @@ public class CalcWaybillServiceImpl extends BaseServiceImpl&lt;CalcWaybill, Integer @@ -97,6 +108,8 @@ public class CalcWaybillServiceImpl extends BaseServiceImpl&lt;CalcWaybill, Integer
97 private LineService lineService; 108 private LineService lineService;
98 @Autowired 109 @Autowired
99 private ReportService reportService; 110 private ReportService reportService;
  111 + @Autowired
  112 + private CarsRepository carsRepository;
100 113
101 @Autowired 114 @Autowired
102 JdbcTemplate jdbcTemplate; 115 JdbcTemplate jdbcTemplate;
@@ -1830,6 +1843,638 @@ public class CalcWaybillServiceImpl extends BaseServiceImpl&lt;CalcWaybill, Integer @@ -1830,6 +1843,638 @@ public class CalcWaybillServiceImpl extends BaseServiceImpl&lt;CalcWaybill, Integer
1830 return temp; 1843 return temp;
1831 } 1844 }
1832 1845
  1846 + @Override
  1847 + public List<List<String>> calcDetailMonthly(Map<String, Object> map) {
  1848 + List<Integer> destroy= new ArrayList<>();
  1849 + String destroyStr = "";
  1850 + if(map.get("destroy")!=null){
  1851 + destroyStr = map.get("destroy").toString().trim();
  1852 + String[] destroys = destroyStr.split(",");
  1853 + for (int i = 0; i < destroys.length; i++){
  1854 + destroy.add(Integer.parseInt(destroys[i]));
  1855 + }
  1856 + }
  1857 + List<String> gsdm= new ArrayList<>();
  1858 + String gsdmStr = "";
  1859 + if(map.get("gsdm")!=null){
  1860 + gsdmStr = map.get("gsdm").toString().trim();
  1861 + String[] gsdms = gsdmStr.split(",");
  1862 + for (int i = 0; i < gsdms.length; i++){
  1863 + gsdm.add(gsdms[i]);
  1864 + }
  1865 + }
  1866 + List<String> fgsdm= new ArrayList<>();
  1867 + String fgsdmStr = "";
  1868 + if(map.get("fgsdm")!=null){
  1869 + fgsdmStr = map.get("fgsdm").toString().trim();
  1870 + String[] fgsdms = fgsdmStr.split(",");
  1871 + for (int i = 0; i < fgsdms.length; i++){
  1872 + fgsdm.add(fgsdms[i]);
  1873 + }
  1874 + }
  1875 +// String line= null;
  1876 + List<String> line= new ArrayList<>();
  1877 + String lineStr = "";
  1878 + if(map.get("lineCode")!=null){
  1879 + lineStr = map.get("lineCode").toString().trim();
  1880 + String[] lines = lineStr.split(",");
  1881 + for (int i = 0; i < lines.length; i++){
  1882 + line.add(lines[i]);
  1883 + }
  1884 + }
  1885 + String startDate="";
  1886 + if(map.get("startDate")!=null){
  1887 + startDate=map.get("startDate").toString().trim();
  1888 + }
  1889 + String endDate="";
  1890 + if(map.get("endDate")!=null){
  1891 + endDate=map.get("endDate").toString().trim();
  1892 + }
  1893 + String type="";
  1894 + if(map.get("type")!=null){
  1895 + type=map.get("type").toString().trim();
  1896 + }
  1897 + String statisticalObj="";
  1898 + if(map.get("statisticalObj")!=null){
  1899 + statisticalObj=map.get("statisticalObj").toString().trim();
  1900 + }
  1901 + String itemDetails="";
  1902 + if(map.get("itemDetails")!=null){
  1903 + itemDetails=map.get("itemDetails").toString().trim();
  1904 + }
  1905 +// Boolean item=false;
  1906 + /*String item="";
  1907 + if(map.get("item")!=null){
  1908 + if("dh".equals(map.get("item").toString().trim()))
  1909 + item=" where c.sfdc = 1";
  1910 +// item=false;
  1911 + else if ("dh".equals(map.get("item").toString().trim()))
  1912 + item=" where c.sfdc = 0";
  1913 +// item=true;
  1914 + else
  1915 + item="";
  1916 + }*/
  1917 + String timeType=map.get("timeType").toString().trim();
  1918 +
  1919 + List<List<String>> resList = new ArrayList<>();
  1920 + List<CalcWaybill> list = new ArrayList<CalcWaybill>();
  1921 +// List<Map<String, Object>> resList = new ArrayList<Map<String, Object>>();
  1922 + // 右边可变天数
  1923 + TreeMap<String, List<CalcWaybillDetail>> keyMapList = new TreeMap<String, List<CalcWaybillDetail>>();
  1924 + // 左边固定列
  1925 + TreeMap<String, CalcWaybillDetail> keyMap = new TreeMap<String, CalcWaybillDetail>();
  1926 +
  1927 + List<Map<String, CalcWaybillDetail>> dayList = new ArrayList<>();
  1928 + int day = 0, day2 = 0;
  1929 + if("m".equals(timeType)){
  1930 + day = Integer.parseInt(startDate.substring(8,10));
  1931 + day2 = Integer.parseInt(endDate.substring(8,10));
  1932 + for(int i=day; i<=day2; i++){
  1933 + Map<String, CalcWaybillDetail> daym = new HashMap<>();
  1934 + daym.put(startDate.substring(0,7)+"-"+(i<10?"0"+i:i),this.initCalcWaybillDetail());
  1935 + dayList.add(daym);
  1936 + }
  1937 + } else if("y".equals(timeType)){
  1938 + day = Integer.parseInt(startDate.substring(5,7));
  1939 + day2 = Integer.parseInt(endDate.substring(5,7));
  1940 + for(int i=day; i<=day2; i++){
  1941 + Map<String, CalcWaybillDetail> daym = new HashMap<>();
  1942 + daym.put(startDate.substring(0,5)+(i<10?"0"+i:i),this.initCalcWaybillDetail());
  1943 + dayList.add(daym);
  1944 + }
  1945 + startDate += "-01";
  1946 + endDate += "-31";
  1947 + }
  1948 +
  1949 + int flag = 0;
  1950 + if("jsy".equals(statisticalObj)){
  1951 + flag = 1;
  1952 + list = calcRepository.scheduleByJsy2(line, startDate, endDate, gsdm, fgsdm, destroy);
  1953 + } else if("cwy".equals(statisticalObj)){
  1954 + flag = 2;
  1955 + list = calcRepository.scheduleBySpy2(line, startDate, endDate, gsdm, fgsdm, destroy);
  1956 + } else if("cl".equals(statisticalObj)){
  1957 + flag = 3;
  1958 + list = calcRepository.scheduleByZbh2(line, startDate, endDate, gsdm, fgsdm, destroy);
  1959 + } else if("xl".equals(statisticalObj)){
  1960 + flag = 4;
  1961 + list = calcRepository.scheduleByDateAndLineTjPx(line,startDate,endDate,gsdm,fgsdm, destroy);
  1962 + /*if(line.equals("")){
  1963 + //查询所有线路
  1964 + }else{
  1965 + //查询单条线路
  1966 + list = calcRepository.scheduleByDateAndLineTjPx2(line,startDate,endDate);
  1967 + }*/
  1968 + }
  1969 +
  1970 +
  1971 + // List类转换
  1972 + final List<CalcWaybillDetail> listNew = JSONArray.parseArray(JSON.toJSONString(list), CalcWaybillDetail.class);
  1973 +
  1974 + if(listNew.size() <= 0){
  1975 + return resList;
  1976 + }
  1977 + Map<String,Ylb> ylbMap = new HashMap<>();
  1978 + Map<String,Ylb> ylbCLMap = new HashMap<>();
  1979 + Map<String,Dlb> dlbMap = new HashMap<>();
  1980 + Map<String,Dlb> dlbCLMap = new HashMap<>();
  1981 +
  1982 + final SimpleDateFormat ft = new SimpleDateFormat("yyyy-MM-dd");
  1983 +
  1984 + // 只有在选择 车辆,驾驶员查询时才有
  1985 + // 把油量和电量数据查出来,封装成Map,计算时直接取
  1986 + if(flag != 2 ){
  1987 + String linesql="";
  1988 + if(!lineStr.equals("")){
  1989 + linesql +=" and xlbm in("+lineStr+") ";
  1990 + }
  1991 + if(!gsdmStr.equals("")){
  1992 + linesql +=" and ssgsdm in("+gsdmStr+") ";
  1993 + }
  1994 + if(!fgsdmStr.equals("")){
  1995 + linesql +=" and fgsdm in("+fgsdmStr+") ";
  1996 + }
  1997 + String ylsql="SELECT * FROM bsth_c_ylb"
  1998 +// String ylsql="SELECT id,xlbm,nbbm,jsy,jzl,czyl,jzyl,yh,sh,fgsdm FROM bsth_c_ylb"
  1999 + + " WHERE rq >= '"+startDate+"' and rq <= '"+endDate+"' "
  2000 + + linesql;
  2001 + String dlSal= " SELECT * FROM bsth_c_dlb"
  2002 +// String dlSal= " SELECT id,xlbm,nbbm,jsy,cdl,czcd,jzcd,hd,sh,fgsdm FROM bsth_c_dlb"
  2003 + + " WHERE rq >= '"+startDate+"' and rq <= '"+endDate+"' "
  2004 + + linesql;
  2005 + List<Ylb> ylbList = jdbcTemplate.query(ylsql, new RowMapper<Ylb>() {
  2006 + @Override
  2007 + public Ylb mapRow(ResultSet arg0, int arg1) throws SQLException{
  2008 + Ylb ylb = new Ylb();
  2009 + Date rq = null;
  2010 + try{
  2011 + rq = ft.parse(arg0.getString("rq"));
  2012 + } catch (ParseException e){
  2013 + logger.error(e.toString(),e);
  2014 + }
  2015 +// Date rq = ft.parse(arg0.getString("rq"));
  2016 + ylb.setXlbm(arg0.getString("xlbm"));
  2017 + ylb.setJsy(arg0.getString("jsy"));
  2018 + ylb.setJname(arg0.getString("jname"));
  2019 + ylb.setNbbm(arg0.getString("nbbm"));
  2020 + ylb.setZlc(Double.parseDouble(arg0.getString("zlc")));
  2021 + ylb.setJzl(Double.parseDouble(arg0.getString("jzl")));
  2022 + ylb.setJzyl(Double.parseDouble(arg0.getString("jzyl")));
  2023 + ylb.setCzyl(Double.parseDouble(arg0.getString("czyl")));
  2024 + ylb.setYh(Double.parseDouble(arg0.getString("yh")));
  2025 + ylb.setSh(Double.parseDouble(arg0.getString("sh")));
  2026 + ylb.setRylx(arg0.getString("rylx"));
  2027 + ylb.setFgsdm(arg0.getString("fgsdm"));
  2028 + ylb.setRq(rq);
  2029 + return ylb;
  2030 + }
  2031 + });
  2032 + List<Dlb> dlbList = jdbcTemplate.query(dlSal, new RowMapper<Dlb>() {
  2033 + @Override
  2034 + public Dlb mapRow(ResultSet arg0, int arg1) throws SQLException {
  2035 + Dlb dlb = new Dlb();Date rq = null;
  2036 + try{
  2037 + rq = ft.parse(arg0.getString("rq"));
  2038 + } catch (ParseException e){
  2039 + logger.error(e.toString(),e);
  2040 + }
  2041 + dlb.setXlbm(arg0.getString("xlbm"));
  2042 + dlb.setJsy(arg0.getString("jsy"));
  2043 + dlb.setJname(arg0.getString("jname"));
  2044 + dlb.setNbbm(arg0.getString("nbbm"));
  2045 + dlb.setZlc(Double.parseDouble(arg0.getString("zlc")));
  2046 + dlb.setCdl(Double.parseDouble(arg0.getString("cdl")));
  2047 + dlb.setJzcd(Double.parseDouble(arg0.getString("jzcd")));
  2048 + dlb.setCzcd(Double.parseDouble(arg0.getString("czcd")));
  2049 + dlb.setHd(Double.parseDouble(arg0.getString("hd")));
  2050 + dlb.setSh(Double.parseDouble(arg0.getString("sh")));
  2051 + dlb.setFgsdm(arg0.getString("fgsdm"));
  2052 + dlb.setRq(rq);
  2053 + return dlb;
  2054 + }
  2055 + });
  2056 +
  2057 + for (Ylb y:ylbList) {
  2058 + if(ylbMap.containsKey(y.getRq().getTime()+"_"+y.getXlbm()+"_"+y.getJsy()+"_"+y.getNbbm())){
  2059 + Ylb yo = ylbMap.get(y.getRq().getTime()+"_"+y.getXlbm()+"_"+y.getJsy()+"_"+y.getNbbm());
  2060 + yo.setZlc(Arith.add(yo.getZlc(),y.getZlc()));
  2061 + yo.setCzyl(Arith.add(yo.getCzyl(),y.getCzyl()));
  2062 + yo.setJzyl(Arith.add(yo.getJzyl(),y.getJzyl()));
  2063 + yo.setJzl(Arith.add(yo.getJzl(),y.getJzl()));
  2064 + yo.setYh(Arith.add(yo.getYh(),y.getYh()));
  2065 + } else
  2066 + ylbMap.put(y.getRq().getTime()+"_"+y.getXlbm()+"_"+y.getJsy()+"_"+y.getNbbm(),y);
  2067 +
  2068 +// ylbMap.put(y.getRq().getTime()+"_"+y.getXlbm()+"_"+y.getJsy()+"_"+y.getJname()+"_"+y.getNbbm(),y);
  2069 +// ylbCLMap.put(y.getRq().getTime()+"_"+y.getXlbm()+"_"+y.getNbbm(),y);
  2070 + }
  2071 + for (Dlb d:dlbList) {
  2072 + if(dlbMap.containsKey(d.getRq().getTime()+"_"+d.getXlbm()+"_"+d.getJsy()+"_"+d.getNbbm())){
  2073 + Dlb dold = dlbMap.get(d.getRq().getTime()+"_"+d.getXlbm()+"_"+d.getJsy()+"_"+d.getNbbm());
  2074 + dold.setZlc(Arith.add(dold.getZlc(),d.getZlc()));
  2075 + dold.setHd(Arith.add(dold.getHd(),d.getHd()));
  2076 + dold.setCzcd(Arith.add(dold.getCzcd(),d.getCzcd()));
  2077 + dold.setJzcd(Arith.add(dold.getJzcd(),d.getJzcd()));
  2078 + dold.setCdl(Arith.add(dold.getCdl(),d.getCdl()));
  2079 + } else
  2080 + dlbMap.put(d.getRq().getTime()+"_"+d.getXlbm()+"_"+d.getJsy()+"_"+d.getNbbm(),d);
  2081 +// dlbMap.put(d.getRq().getTime()+"_"+d.getXlbm()+"_"+d.getJsy()+"_"+d.getJname()+"_"+d.getNbbm(),d);
  2082 +// dlbCLMap.put(d.getRq().getTime()+"_"+d.getXlbm()+"_"+d.getNbbm(),d);
  2083 + }
  2084 + }
  2085 +
  2086 + CalcWaybillDetail zjCalc = this.initCalcWaybillDetail();
  2087 + zjCalc.setjName("合计");
  2088 + // 横向数据的第几天下标
  2089 + int dayIndex = 0;
  2090 + int dayIndexPrev = -1;
  2091 + // 报表纵向列数据生成
  2092 + for (int i = 0; listNew.size() > i; i++) {
  2093 + CalcWaybillDetail cw = listNew.get(i);
  2094 +
  2095 + CalcWaybillDetail cwNext = new CalcWaybillDetail();
  2096 + if(i<listNew.size()-1){
  2097 + cwNext = listNew.get(i+1);
  2098 + }
  2099 + String xl = cw.getXl();
  2100 + String jsy = cw.getjGh();
  2101 + String cwy = cw.getsGh();
  2102 + String cl = cw.getCl();
  2103 +
  2104 + Ylb y = new Ylb();
  2105 + Dlb d = new Dlb();
  2106 + // 统计类型不同统计的左边列不同
  2107 + // 赋值油、电量
  2108 + if(flag != 2){
  2109 + // 取了之后删除,防止重复取,应为添加的时候已经合并了
  2110 + y = ylbMap.get(cw.getRq().getTime()+"_"+cw.getXl()+"_"+cw.getjGh()+"_"+cw.getCl());
  2111 + ylbMap.remove(cw.getRq().getTime()+"_"+cw.getXl()+"_"+cw.getjGh()+"_"+cw.getCl());
  2112 + d = dlbMap.get(cw.getRq().getTime()+"_"+cw.getXl()+"_"+cw.getjGh()+"_"+cw.getCl());
  2113 + dlbMap.remove(cw.getRq().getTime()+"_"+cw.getXl()+"_"+cw.getjGh()+"_"+cw.getCl());
  2114 + if(y != null){
  2115 + cw.setZlc(y.getZlc());
  2116 + cw.setYh(y.getYh());
  2117 + cw.setJzl(y.getJzl());
  2118 + if("0".equals(y.getRylx())){
  2119 + cw.setJzl0(y.getJzl());
  2120 + }else if("1".equals(y.getRylx())){
  2121 + cw.setJzl10(y.getJzl());
  2122 + }
  2123 + cw.setJzyl(y.getJzyl());
  2124 + cw.setCzyl(y.getCzyl());
  2125 + cw.setRylx(y.getRylx());
  2126 + cw.setBglyh((y.getZlc()==0? 0:100*y.getYh()/y.getZlc()));
  2127 + }
  2128 + if(d != null) {
  2129 + cw.setZlc(d.getZlc());
  2130 + cw.setHd(d.getHd());
  2131 + cw.setJzcd(d.getJzcd());
  2132 + cw.setCzcd(d.getCzcd());
  2133 + cw.setCdl(d.getCdl());
  2134 + cw.setBglyh((d.getZlc()==0? 0:100*d.getHd()/d.getZlc()));
  2135 + }
  2136 + }
  2137 +
  2138 + String key = "",keyNext = "";
  2139 + if(flag == 1){
  2140 + if(cw.getjGh() != null && cw.getjName() != null)
  2141 + key += cw.getjGh() + "/" + cw.getjName();
  2142 + if(cwNext.getjGh() != null && cwNext.getjName() != null)
  2143 + keyNext += cwNext.getjGh() + "/" + cwNext.getjName();
  2144 + } else if(flag == 2){
  2145 + if(cw.getsGh() != null && cw.getsName() != null)
  2146 + key += cw.getsGh() + "/" + cw.getsName();
  2147 + if(cwNext.getsGh() != null && cwNext.getsName() != null)
  2148 + keyNext += cwNext.getsGh() + "/" + cwNext.getsName();
  2149 + } else if(flag == 3){
  2150 + if(cw.getCl() != null)
  2151 + key += cw.getCl();
  2152 + if(cwNext.getCl() != null)
  2153 + keyNext += cwNext.getCl();
  2154 + }
  2155 + key = cw.getGsdm()+"/"+cw.getFgsdm()+"/"+cw.getXl() + "/" + key;
  2156 + keyNext = cwNext.getGsdm()+"/"+cwNext.getFgsdm()+"/"+cwNext.getXl() + "/" + keyNext;
  2157 + CalcWaybillDetail calc = new CalcWaybillDetail();
  2158 + List<CalcWaybillDetail> calcList = new ArrayList<>();
  2159 + // 是否一行数据的第一个、生成key,calc为刚添加,不去和cw相加
  2160 + boolean ifFirst = false;
  2161 + if(keyMapList.containsKey(key)){
  2162 + calc = keyMap.get(key);
  2163 + calcList = keyMapList.get(key);
  2164 + } else {
  2165 + // 深度拷贝对象
  2166 + BeanUtils.copyProperties(cw,calc);
  2167 + keyMap.put(key, calc);
  2168 + dayIndex = 0;
  2169 + ifFirst = true;
  2170 + }
  2171 +
  2172 + CalcWaybillDetail dayc = null;
  2173 + if("m".equals(timeType)){
  2174 + while (!dayList.get(dayIndex).containsKey(cw.getRqStr())){
  2175 + calcList.add(new CalcWaybillDetail());
  2176 + dayIndex++;
  2177 + }
  2178 + dayc = dayList.get(dayIndex).get(cw.getRqStr());
  2179 + } else if("y".equals(timeType)){
  2180 + while (!dayList.get(dayIndex).containsKey(cw.getRqStr().substring(0,7))){
  2181 + calcList.add(new CalcWaybillDetail());
  2182 + dayIndex++;
  2183 + }
  2184 + dayc = dayList.get(dayIndex).get(cw.getRqStr().substring(0,7));
  2185 + }
  2186 +
  2187 +
  2188 + // 天数相加
  2189 + this.summation(dayc, cw);
  2190 + // 左边固定列数据相加
  2191 + if(!ifFirst)
  2192 + this.summation(calc, cw);
  2193 + // 左边合计相加
  2194 + this.summation(zjCalc, cw);
  2195 +
  2196 +
  2197 + if(dayIndexPrev == dayIndex && calcList.size() > dayIndex){
  2198 + CalcWaybillDetail cwPrev = calcList.get(dayIndex);
  2199 + this.summation(cwPrev, cw);
  2200 + } else {
  2201 + CalcWaybillDetail cwd = new CalcWaybillDetail();
  2202 + // 深度拷贝对象
  2203 + BeanUtils.copyProperties(cw,cwd);
  2204 + calcList.add(cwd);
  2205 + calc.setTs(calc.getTs()+1);
  2206 + zjCalc.setTs(zjCalc.getTs()+1);
  2207 + }
  2208 +
  2209 + // 把下标
  2210 + dayIndexPrev = dayIndex;
  2211 + // timeType 为m 月报表时,日期不一样就换列,为y 年报表是,月份不一样换列
  2212 + if("m".equals(timeType) && cwNext != null && key.equals(keyNext) && !cw.getRqStr().equals(cwNext.getRqStr())){
  2213 + dayIndex++;
  2214 + } else if("y".equals(timeType) && cwNext != null && key.equals(keyNext) && !cw.getRqStr().substring(0,7).equals(cwNext.getRqStr().substring(0,7))){
  2215 + dayIndex++;
  2216 + } else if(!key.equals(keyNext)){
  2217 + // 满数据的不用补空格
  2218 + while (dayList.size() > dayIndex+1){
  2219 + calcList.add(new CalcWaybillDetail());
  2220 + dayIndex++;
  2221 + }
  2222 + // 换列了从头开始,上一个下标赋值为初始
  2223 + dayIndexPrev = -1;
  2224 + }
  2225 + // 右边可变列添加数据
  2226 + keyMapList.put(key,calcList);
  2227 + }
  2228 +
  2229 + // 表头和数据
  2230 + Iterator iter = keyMap.entrySet().iterator();
  2231 +
  2232 + List<String> list1 = new ArrayList<>();
  2233 + list1.add("序号");
  2234 + list1.add("所属公司");
  2235 + list1.add("线路");
  2236 + if(flag==1 ||flag==2 ){
  2237 + list1.add("工号");
  2238 + list1.add("姓名");
  2239 + } else if(flag==3){
  2240 + list1.add("自编号");
  2241 + list1.add("车牌号");
  2242 + list1.add("燃油类型");
  2243 + }
  2244 + list1.add("计划公里");
  2245 + list1.add("总公里");
  2246 + list1.add("空驶公里");
  2247 + list1.add("临加公里");
  2248 + list1.add("烂班公里");
  2249 + list1.add("m".equals(timeType)?"天数":"月数");
  2250 + for(int i=day; i<=day2; i++){
  2251 + list1.add((i<10?"0"+i:i)+("m".equals(timeType)?"日":"月"));
  2252 + }
  2253 + if("bgldh".equals(itemDetails) || "bglyh".equals(itemDetails)){
  2254 + list1.add("平均");
  2255 + } else
  2256 + list1.add("合计");
  2257 + resList.add(list1);
  2258 +
  2259 + Map<String, String> carsMap = new HashMap<>();
  2260 + List<Cars> carsList = carsRepository.findCars();
  2261 + for (Cars c:carsList) {
  2262 + String sfdc = c.getSfdc()+"";
  2263 + carsMap.put(c.getInsideCode(), sfdc.equals("true")?"纯电动":"柴油");
  2264 + }
  2265 +
  2266 + int i=1;
  2267 + DecimalFormat df = new DecimalFormat("0.00");//格式化小数
  2268 + double allNum = 0.0;
  2269 + while (iter.hasNext()) {
  2270 + Map.Entry entry = (Map.Entry) iter.next();
  2271 + // 获取key
  2272 + String key = (String) entry.getKey();
  2273 + // 获取value
  2274 + CalcWaybillDetail c = (CalcWaybillDetail) entry.getValue();
  2275 +
  2276 + List<CalcWaybillDetail> cList = keyMapList.get(key);
  2277 +
  2278 + List<String> listStr = new ArrayList<>();
  2279 + listStr.add(i+"");
  2280 + i++;
  2281 + listStr.add(c.getFgsname());
  2282 + listStr.add(c.getXlName());
  2283 + if("jsy".equals(statisticalObj)){
  2284 + listStr.add(c.getjGh());
  2285 + listStr.add(c.getjName());
  2286 + } else if("cwy".equals(statisticalObj)){
  2287 + listStr.add(c.getsGh());
  2288 + listStr.add(c.getsName());
  2289 + } else if("cl".equals(statisticalObj)){
  2290 + listStr.add(c.getCl());
  2291 + listStr.add(BasicData.nbbmCompanyPlateMap.get(c.getCl())+"");
  2292 + listStr.add(carsMap.get(c.getCl()));
  2293 + } else if("xl".equals(statisticalObj)){
  2294 +
  2295 + }
  2296 + listStr.add(df.format(c.getJhyylc()+c.getJhfyylc()));
  2297 + listStr.add(df.format(c.getSjyylc()+c.getSjfyylc()+c.getLjyylc()+c.getLjfyylc()));
  2298 +// listStr.add(df.format(c.getSjyylc()+c.getLjyylc()));
  2299 + listStr.add(df.format(c.getSjfyylc()+c.getLjfyylc()));
  2300 + listStr.add(df.format(c.getLjyylc()+c.getLjfyylc()));
  2301 + listStr.add(df.format(c.getLblc()));
  2302 + listStr.add(c.getTs()+"");
  2303 + c.setBglhd(c.getBglhd()/c.getTs());
  2304 + c.setBglyh(c.getBglyh()/c.getTs());
  2305 + // 把列合计的数添加到最后一个
  2306 + cList.add(c);
  2307 + // DecimalFormat df = new DecimalFormat("0.00");//格式化小数
  2308 + for (CalcWaybillDetail c1:cList) {
  2309 + if(StringUtils.isEmpty(c1.getXl())) {
  2310 + listStr.add("");
  2311 + } else{
  2312 + if("jzlAll".equals(itemDetails)){
  2313 + listStr.add(df.format(c1.getJzl()));
  2314 + }else if("jzl0".equals(itemDetails)){
  2315 + listStr.add(df.format(c1.getJzl0()));
  2316 + } else if("jzl-10".equals(itemDetails)){
  2317 + listStr.add(df.format(c1.getJzl10()));
  2318 + } else if("yhl".equals(itemDetails)){
  2319 + listStr.add(df.format(c1.getYh()));
  2320 + } else if("jccy".equals(itemDetails)){
  2321 + listStr.add(df.format(c1.getJzyl()));
  2322 + } else if("cccy".equals(itemDetails)){
  2323 + listStr.add(df.format(c1.getCzyl()));
  2324 + } else if("bglyh".equals(itemDetails)){
  2325 + listStr.add(df.format(c1.getZlc()==0? 0:100*c1.getYh()/c1.getZlc()));
  2326 + } else if("dh".equals(itemDetails)){
  2327 + listStr.add(df.format(c1.getHd()));
  2328 + } else if("cdl".equals(itemDetails)){
  2329 + listStr.add(df.format(c1.getCdl()));
  2330 + } else if("cccd".equals(itemDetails)){
  2331 + listStr.add(df.format(c1.getCzcd()));
  2332 + } else if("jccd".equals(itemDetails)){
  2333 + listStr.add(df.format(c1.getJzcd()));
  2334 + } else if("bgldh".equals(itemDetails)){
  2335 + listStr.add(df.format(c1.getZlc()==0? 0:100*c1.getHd()/c1.getZlc()));
  2336 +// listStr.add(df.format(c1.getBglhd()));
  2337 + } else if("zgl".equals(itemDetails)){
  2338 + listStr.add(df.format((c1.getSjyylc()+c1.getSjfyylc()+c1.getLjfyylc()+c1.getLjyylc())));
  2339 + } else if("jhgl".equals(itemDetails)){
  2340 + listStr.add(df.format(c1.getJhyylc()+c1.getJhfyylc()));
  2341 + } else if("sjbc".equals(itemDetails)){
  2342 + listStr.add(c1.getSjyybc()+c1.getSjfyybc()+c1.getLjbc()+"");
  2343 + } else if("jhbc".equals(itemDetails)){
  2344 + listStr.add(c1.getJhyybc()+c1.getJhfyybc()+"");
  2345 + }
  2346 + }
  2347 + }
  2348 + allNum = allNum + Double.parseDouble(listStr.get(listStr.size()-1));
  2349 + resList.add(listStr);
  2350 + }
  2351 +
  2352 + // 合计列
  2353 + List<String> listEnd = new ArrayList<>();
  2354 + listEnd.add("合计");
  2355 + listEnd.add(df.format(zjCalc.getJhyylc()+zjCalc.getJhfyylc()));
  2356 + listEnd.add(df.format(zjCalc.getSjfyylc()+zjCalc.getSjyylc()+zjCalc.getLjyylc()+zjCalc.getLjfyylc()));//总公里
  2357 +// listEnd.add(df.format(zjCalc.getSjyylc()+zjCalc.getLjyylc()));//营运
  2358 + listEnd.add(df.format(zjCalc.getSjfyylc()+zjCalc.getLjfyylc()));
  2359 + listEnd.add(df.format(zjCalc.getLjfyylc()+zjCalc.getLjyylc()));
  2360 + listEnd.add(df.format(zjCalc.getLblc()));
  2361 + listEnd.add(zjCalc.getTs()+"");
  2362 + double all = 0.0;
  2363 + for (Map<String, CalcWaybillDetail> cmap:dayList) {
  2364 + for (Map.Entry<String, CalcWaybillDetail> cw : cmap.entrySet()) {
  2365 +// System.out.println("key = " + cw.getKey() + ", value = " + cw.getValue());
  2366 + CalcWaybillDetail c1 = cw.getValue();
  2367 + if("jzlAll".equals(itemDetails)){
  2368 + listEnd.add(df.format(c1.getJzl()));
  2369 + } else if("jzl0".equals(itemDetails)){
  2370 + listEnd.add(df.format(c1.getJzl0()));
  2371 + } else if("jzl-10".equals(itemDetails)){
  2372 + listEnd.add(df.format(c1.getJzl10()));
  2373 + } else if("yhl".equals(itemDetails)){
  2374 + listEnd.add(df.format(c1.getYh()));
  2375 + } else if("jccy".equals(itemDetails)){
  2376 + listEnd.add(df.format(c1.getJzyl()));
  2377 + } else if("cccy".equals(itemDetails)){
  2378 + listEnd.add(df.format(c1.getCzyl()));
  2379 + } else if("bglyh".equals(itemDetails)){
  2380 + listEnd.add(df.format(c1.getZlc()==0? 0:100*c1.getYh()/c1.getZlc()));
  2381 + } else if("dh".equals(itemDetails)){
  2382 + listEnd.add(df.format(c1.getHd()));
  2383 + } else if("cdl".equals(itemDetails)){
  2384 + listEnd.add(df.format(c1.getCdl()));
  2385 + } else if("cccd".equals(itemDetails)){
  2386 + listEnd.add(df.format(c1.getCzcd()));
  2387 + } else if("jccd".equals(itemDetails)){
  2388 + listEnd.add(df.format(c1.getJzcd()));
  2389 + } else if("bgldh".equals(itemDetails)){
  2390 +// listEnd.add(df.format(c1.getBglhd()));
  2391 + listEnd.add(df.format(c1.getZlc()==0? 0:100*c1.getHd()/c1.getZlc()));
  2392 + } else if("zgl".equals(itemDetails)){
  2393 + listEnd.add((df.format(c1.getSjyylc()+c1.getSjfyylc()+c1.getLjfyylc()+c1.getLjyylc())));
  2394 + } else if("jhgl".equals(itemDetails)){
  2395 + listEnd.add((df.format(c1.getJhyylc()+c1.getJhfyylc())));
  2396 + } else if("sjbc".equals(itemDetails)){
  2397 + listEnd.add(c1.getSjyybc()+c1.getSjfyybc()+c1.getLjbc()+"");
  2398 + } else if("jhbc".equals(itemDetails)){
  2399 + listEnd.add((c1.getJhyybc()+c1.getJhfyybc())+"");
  2400 + }
  2401 + }
  2402 + all = all + Double.parseDouble(listEnd.get(listEnd.size()-1));
  2403 + }
  2404 +
  2405 + // 百公里电油耗时为平均数
  2406 + if("bgldh".equals(itemDetails) || "bglyh".equals(itemDetails)){
  2407 + allNum = allNum/keyMap.size();
  2408 + all = all/dayList.size();
  2409 + }
  2410 +// listEnd.add(df.format(allNum)+"/"+df.format(all));
  2411 + listEnd.add(df.format(all));
  2412 + resList.add(listEnd);
  2413 +
  2414 + return resList;
  2415 + }
  2416 +
  2417 + public CalcWaybillDetail initCalcWaybillDetail(){
  2418 + CalcWaybillDetail calc = new CalcWaybillDetail();
  2419 + calc.setJhyybc(0);
  2420 + calc.setJhyylc(0d);
  2421 + calc.setJhfyybc(0);
  2422 + calc.setJhfyylc(0d);
  2423 + calc.setSjyybc(0);
  2424 + calc.setSjyylc(0d);
  2425 + calc.setSjfyybc(0);
  2426 + calc.setSjfyylc(0d);
  2427 + calc.setLbbc(0);
  2428 + calc.setLblc(0d);
  2429 + calc.setLjbc(0);
  2430 + calc.setLjyylc(0d);
  2431 + calc.setZlc(0d);
  2432 + calc.setCzyl(0d);
  2433 + calc.setJzyl(0d);
  2434 + calc.setJzl(0d);
  2435 + calc.setJzl0(0d);
  2436 + calc.setJzl10(0d);
  2437 + calc.setYh(0d);
  2438 + calc.setCzcd(0d);
  2439 + calc.setJzcd(0d);
  2440 + calc.setCdl(0d);
  2441 + calc.setHd(0d);
  2442 + calc.setTs(0);
  2443 + return calc;
  2444 + }
  2445 +
  2446 + public CalcWaybillDetail summation(CalcWaybillDetail c1, CalcWaybillDetail c2){
  2447 + c1.setJhyybc(c1.getJhyybc() + c2.getJhyybc());
  2448 + c1.setJhyylc(Arith.add(c1.getJhyylc(), c2.getJhyylc()));
  2449 + c1.setJhfyybc(c1.getJhfyybc() + c2.getJhfyybc());
  2450 + c1.setJhfyylc(Arith.add(c1.getJhfyylc(), c2.getJhfyylc()));
  2451 + c1.setSjyybc(c1.getSjyybc() + c2.getSjyybc());
  2452 + c1.setSjyylc(Arith.add(c1.getSjyylc(), c2.getSjyylc()));
  2453 +// c1.setSjyylc(Arith.add(c1.getSjyylc(), c2.getLjyylc()));// 把临加的也算上了,后面不用加了
  2454 + c1.setSjfyybc(c1.getSjfyybc() + c2.getSjfyybc());
  2455 + c1.setSjfyylc(Arith.add(c1.getSjfyylc(), c2.getSjfyylc()));
  2456 +// c1.setSjfyylc(Arith.add(c1.getSjfyylc(), c2.getLjfyylc()));// 把临加的也算上了,后面不用加了
  2457 + c1.setLbbc(c1.getLbbc() + c2.getLbbc());
  2458 + c1.setLblc(Arith.add(c1.getLblc(), c2.getLblc()));
  2459 + c1.setLjbc(c1.getLjbc() + c2.getLjbc());
  2460 + c1.setLjyylc(Arith.add(c1.getLjyylc(), c2.getLjyylc()));
  2461 + c1.setLjfyylc(Arith.add(c1.getLjfyylc(), c2.getLjfyylc()));
  2462 + c1.setZlc(Arith.add(c1.getZlc(),c2.getZlc()));
  2463 + c1.setCzyl(Arith.add(c1.getCzyl(),c2.getCzyl()));
  2464 + c1.setJzyl(Arith.add(c1.getJzyl(),c2.getJzyl()));
  2465 + c1.setJzl(Arith.add(c1.getJzl(),c2.getJzl()));
  2466 + c1.setJzl0(Arith.add(c1.getJzl0(),c2.getJzl0()));
  2467 + c1.setJzl10(Arith.add(c1.getJzl10(),c2.getJzl10()));
  2468 + c1.setYh(Arith.add(c1.getYh(),c2.getYh()));
  2469 + c1.setHd(Arith.add(c1.getHd(),c2.getHd()));
  2470 + c1.setCzcd(Arith.add(c1.getCzcd(),c2.getCzcd()));
  2471 + c1.setJzcd(Arith.add(c1.getJzcd(),c2.getJzcd()));
  2472 + c1.setCdl(Arith.add(c1.getCdl(),c2.getCdl()));
  2473 + c1.setTs(c1.getTs()+c2.getTs());
  2474 +// c1.setDtbc(c1.getDtbc() + c2.getDtbc());
  2475 + return c1;
  2476 + }
  2477 +
1833 } 2478 }
1834 2479
1835 class AccountXlbmByping implements Comparator<Map<String, Object>> { 2480 class AccountXlbmByping implements Comparator<Map<String, Object>> {
src/main/resources/static/pages/forms/calc/calcDetailMonthly.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 + text-align: center; }
  12 + .table-bordered > thead > tr > th,
  13 + .table-bordered > thead > tr > td {
  14 + border-bottom-width: 2px; }
  15 +
  16 + .table > tbody + tbody {
  17 + border-top: 1px solid; }
  18 +
  19 +
  20 + #analy_body tr> td >span{
  21 + word-break: keep-all;white-space:nowrap;
  22 + }
  23 +
  24 + #analy_body td{
  25 + min-width: 100px;
  26 + max-width: 100px;
  27 + width: 100px;
  28 + }
  29 +
  30 + #analy_body{
  31 + margin-top: 20px;
  32 + height: 620px;
  33 + width: 100%
  34 + }
  35 +
  36 +
  37 + .table_head::-webkit-scrollbar {
  38 + display:none
  39 + }
  40 +
  41 + .table_head{
  42 + min-width: 906px;
  43 + width: 100%;
  44 + overflow: hidden;
  45 + }
  46 +
  47 + .table_body{
  48 + width:101%;
  49 + height:580px;
  50 + overflow: auto;
  51 + margin-top: -20px;
  52 + }
  53 +</style>
  54 +<div class="page-head">
  55 + <div class="page-title">
  56 + <h1>路单线路明细月报表</h1>
  57 + </div>
  58 +</div>
  59 +
  60 +<!--<div class="row">-->
  61 +<div class=" row col-md-12 portlet light bordered" style="height:calc(100% - 38px)">
  62 + <div class="">
  63 + <form class="form-inline" >
  64 + <div style="display: inline-block; margin-left: 13px;" id="gsdmDiv_daily">
  65 + <span class="item-label" style="width: 80px;">&#12288;&#12288;公司: </span>
  66 + <select class="form-control" name="company" id="gsdm" style="width: 150px;"></select>
  67 + </div>
  68 + <div style="display: inline-block; margin-left: 13px;" id="fgsdmDiv_daily">
  69 + <span class="item-label" style="width: 80px;">&#12288;分公司: </span>
  70 + <select class="form-control" name="fgsdm" id="fgsdm" style="width: 150px;"></select>
  71 + </div>
  72 + <!--<div style="display: inline-block;margin-left: 33px;">
  73 + <span class="item-label" style="width: 80px;">&#12288;&#12288;线路: </span>
  74 + <select class="form-control" name="line" id="line" style="width: 180px;"></select>
  75 + </div>-->
  76 + <div style="display: inline-block;margin-left: 13px;" class="date-picker">
  77 + <span class="item-label" style="width: 80px;">&#12288;&#12288;时间: </span>
  78 + <input class="form-control" type="text" id="startDate" style="width: 150px;" /> -
  79 + <input class="form-control" type="text" id="endDate" style="width: 150px;" />
  80 + <!--<input class="form-control" type="text" id="startDate" style="width: 180px;" value="2020-10-01"/> - -->
  81 + <!--<input class="form-control" type="text" id="endDate" style="width: 180px;" value="2020-10-10"/>-->
  82 + </div>
  83 +
  84 + <div style="margin-top: 2px"></div>
  85 +
  86 + <div style="display: inline-block; margin-left: 13px;">
  87 + <span class="item-label" style="width: 80px;">线路性质: </span>
  88 + <select class="form-control" name="destroy" id="destroy" style="width: 150px;">
  89 + <option value="0,1">全部线路</option>
  90 + <option value="0">营运线路</option>
  91 + <option value="1">非营运线路</option>
  92 + </select>
  93 + </div>
  94 + <div style="display: inline-block;margin-left: 13px;">
  95 + <span class="item-label" style="width: 80px;">统计对象: </span>
  96 + <select class="form-control" name="statisticalObj" id="statisticalObj" style="width: 150px;">
  97 + <option value="cl">车辆</option>
  98 + <option value="jsy">驾驶员</option>
  99 + <option value="cwy">乘务员</option>
  100 + <option value="xl">线路</option>
  101 + </select>
  102 + </div>
  103 +
  104 + <div style="display: inline-block; margin-left: 13px;" >
  105 + <span class="item-label" style="width: 80px;">统计项目: </span>
  106 + <select class="form-control" name="statisticalItem" id="statisticalItem" style="width: 150px;">
  107 + <option value="yh">油耗</option>
  108 + <option value="dh">电耗</option>
  109 + <option value="gl">公里</option>
  110 + <option value="bc">班次</option>
  111 + </select>
  112 + </div>
  113 + <div style="display: inline-block; margin-left: 13px;" >
  114 + <span class="item-label" style="width: 80px;">项目明细: </span>
  115 + <select class="form-control" name="itemDetails" id="itemDetails" style="width: 150px;"></select>
  116 + </div>
  117 + <div class="form-group" style="display: inline-block;margin-left: 22px;">
  118 + <input class="btn btn-default" type="button" id="query" value="筛选"/>
  119 + <input class="btn btn-default" type="button" id="export" value="导出"/>
  120 + </div>
  121 + </form>
  122 + </div>
  123 +
  124 + <div id="analy_body">
  125 + <div class="table_head" id="table_head">
  126 + <table class="table table-bordered table-hover table-checkable " id="forms_head">
  127 + <thead>
  128 + </thead>
  129 + </table>
  130 + </div>
  131 + <div class="table_body" id="table_body">
  132 + <table class="table table-bordered table-hover table-checkable" id="forms_body" style="background-color: white;">
  133 + <tbody>
  134 + </tbody>
  135 + </table>
  136 + </div>
  137 + </div>
  138 +</div>
  139 +<script >
  140 + $(function(){
  141 + $('#export').attr('disabled', "true");
  142 + // 关闭左侧栏
  143 + if (!$('body').hasClass('page-sidebar-closed'))
  144 + $('.menu-toggler.sidebar-toggler').click();
  145 +
  146 + var table_body1 = document.getElementById("table_body");
  147 + table_body1.onscroll = function(){
  148 + var table_body1_left = this.scrollLeft;
  149 + document.getElementById("table_head").scrollLeft = table_body1_left;
  150 + };
  151 +
  152 + var d = new Date();
  153 + d.setTime(d.getTime() - 4*1000*60*60*24);//只能查4天以前的数据
  154 + var year = d.getFullYear();
  155 + var month = d.getMonth() + 1;
  156 + var day = d.getDate();
  157 + if(month < 10)
  158 + month = "0" + month;
  159 + if(day < 10)
  160 + day = "0" + day;
  161 + //时间
  162 + var dateTime=year + "-" + month + "-" + day;
  163 + $("#startDate").val(dateTime);
  164 + $("#endDate").val(dateTime);
  165 +
  166 + $("#endDate").datetimepicker({
  167 + format : 'YYYY-MM-DD',
  168 + locale : 'zh-cn',
  169 + maxDate : dateTime
  170 + });
  171 + $("#startDate").datetimepicker({
  172 + format : 'YYYY-MM-DD',
  173 + locale : 'zh-cn',
  174 + maxDate : dateTime
  175 + });
  176 +
  177 + var lineAll="";
  178 + var datas = {}; //查询条件
  179 +
  180 +// /**用户分配的线路*/
  181 +// $.get('/realControAuthority/findByCurrentUser', function (userAuthor) {
  182 +// lineAll = userAuthor.lineCodeStr.substring(0,userAuthor.lineCodeStr.length-1);
  183 +// });
  184 +
  185 + /**全部的线路*/
  186 + $.get('/line/all', function (lines) {
  187 + $.each(lines,function (i, e) {
  188 + if(i > 0){
  189 + lineAll += ",";
  190 + }
  191 + lineAll += e.lineCode;
  192 + });
  193 + });
  194 +
  195 + var tempData = {};
  196 +
  197 + $.get('/user/companyData', function(result){
  198 + var obj = result;
  199 + var options = '';
  200 + for(var i = 0; i < obj.length; i++){
  201 + options += '<option value="'+obj[i].companyCode+'">'+obj[i].companyName+'</option>';
  202 + }
  203 +
  204 + if(obj.length ==0){
  205 + $("#gsdmDiv_daily").css('display','none');
  206 + }else if(obj.length ==1){
  207 + $("#gsdmDiv_daily").css('display','none');
  208 + if(obj[0].children.length == 1 || obj[0].children.length == 0){
  209 + fage=false;
  210 + $('#gsdmDiv_daily').css('display','none');
  211 + }
  212 + }
  213 + $('#gsdm').html(options);
  214 + updateCompany();
  215 + });
  216 + $("#gsdm").on("change",updateCompany);
  217 +
  218 + function updateCompany(){
  219 + var company = $('#gsdm').val();
  220 + $.get('/user/companyData', function(obj) {
  221 + var option = '';
  222 + var allC = "";
  223 + for (var i = 0; i < obj.length; i++) {
  224 + if (obj[i].companyCode == company) {
  225 + var children = obj[i].children;
  226 + for (var j = 0; j < children.length; j++) {
  227 + allC += children[j].code+",";
  228 + option += '<option value="' + children[j].code + '">' + children[j].name + '</option>';
  229 + }
  230 + }
  231 + }
  232 +
  233 + var options = '<option value="'+allC.substring(0,allC.length-1)+'">所有分公司</option>'+option;
  234 + $('#fgsdm').html(options);
  235 + });
  236 + }
  237 +
  238 + // 项目明细选项列
  239 + // 触发默认选项
  240 + updateItem();
  241 + $("#statisticalItem").on("change",updateItem);
  242 + function updateItem() {
  243 + var item = $('#statisticalItem').val();
  244 + var options = '';
  245 + if(item == "yh"){
  246 + options += '<option value="jzlAll">加注量[全部]</option>' +
  247 + '<option value="jzl0">加注量[0#]</option>'+
  248 + '<option value="jzl-10">加注量[-10#]</option>'+
  249 + '<option value="yhl">油耗量</option>'+
  250 + '<option value="cccy">出场存油</option>'+
  251 + '<option value="jccy">进场存油</option>'+
  252 + '<option value="bglyh">百公里油耗</option>';
  253 + } else if(item == "gl"){
  254 + options += '<option value="zgl">总公里</option>' +
  255 + '<option value="jhgl">计划公里</option>';
  256 + /*'<option value="jclm">进场路码</option>'+
  257 + '<option value="cclm">出场路码</option>'*/
  258 + } else if(item == "bc"){
  259 + options += '<option value="sjbc">实际班次</option>' +
  260 + '<option value="jhbc">计划班次</option>';
  261 + } else if(item == "dh"){
  262 + options += '<option value="dh">耗电量</option>';
  263 + options += '<option value="cdl">充电量</option>';
  264 + options += '<option value="cccd">出场存电</option>';
  265 + options += '<option value="jccd">进场存电</option>';
  266 + options += '<option value="bgldh">百公里电耗</option>';
  267 + }
  268 + $('#itemDetails').html(options);
  269 + }
  270 +
  271 + //线路名称
  272 + var lineName = '';
  273 + $("#query").on("click",function(){
  274 + var gsdm = $("#gsdm").val();
  275 + var fgsdm = $("#fgsdm").val();
  276 + var startDate = $("#startDate").val();
  277 + var endDate = $("#endDate").val();
  278 + var statisticalObj = $("#statisticalObj").val();
  279 + //开始和结束时间
  280 + var startTime = Date.parse(new Date(startDate));
  281 + var endTime = Date.parse(new Date(endDate));
  282 +
  283 + datas = {}; // 清空之前数据
  284 + datas.gsdm = gsdm;
  285 + datas.fgsdm = fgsdm;
  286 + datas.lineCode = lineAll;
  287 + datas.timeType = "m";
  288 + datas.startDate = startDate;
  289 + datas.endDate = endDate;
  290 + datas.destroy = $("#destroy").val();
  291 + datas.statisticalObj = $("#statisticalObj").val();
  292 + datas.itemDetails = $("#itemDetails").val();
  293 + var itemDetails = datas.itemDetails,
  294 + type = "加注量[全部]";
  295 + if(itemDetails=="jzl0"){
  296 + type = "加注量[0#]"
  297 + } else if(itemDetails=="jzl-10"){
  298 + type = "加注量[-10#]"
  299 + } else if(itemDetails=="yhl"){
  300 + type = "油耗量"
  301 + } else if(itemDetails=="cccy"){
  302 + type = "出场存油"
  303 + } else if(itemDetails=="jccy"){
  304 + type = "进场存油"
  305 + } else if(itemDetails=="bglyh"){
  306 + type = "百公里油耗"
  307 + } else if(itemDetails=="zgl"){
  308 + type = "总公里"
  309 + } else if(itemDetails=="jhgl"){
  310 + type = "计划公里"
  311 + } else if(itemDetails=="jclm"){
  312 + type = "进场路码"
  313 + } else if(itemDetails=="cclm"){
  314 + type = "出场路码"
  315 + } else if(itemDetails=="sjbc"){
  316 + type = "实际班次"
  317 + } else if(itemDetails=="jhbc"){
  318 + type = "计划班次"
  319 + } else if(itemDetails=="dh"){
  320 + type = "耗电量"
  321 + } else if(itemDetails=="cdl"){
  322 + type = "充电量"
  323 + } else if(itemDetails=="cccd"){
  324 + type = "出场存电"
  325 + } else if(itemDetails=="jccd"){
  326 + type = "进场存电"
  327 + } else if(itemDetails=="bgldh"){
  328 + type = "百公里电耗"
  329 + }
  330 + datas.name = datas.startDate+"-"+datas.endDate+"-路单线路明细月报表("+type+")";
  331 + if(startDate==null || startDate =="" ||endDate==null || endDate ==""){
  332 + layer.msg('请选择时间段!');
  333 + }else if(endTime<startTime){
  334 + layer.msg('结束日期不能小于开始日期!');
  335 + }else {
  336 + if (endDate.substring(0, 7) != startDate.substring(0, 7)) {
  337 + layer.msg("请查询同月份数据!");
  338 + return;
  339 + } else {
  340 + var lodingI = layer.load(2);
  341 + $get('/calcWaybill/calcDetailMonthly', datas, function (rs) {
  342 + if (rs.length <=0) {
  343 + layer.close(lodingI);
  344 + layer.open({
  345 + title: '提示'
  346 + , content: '没有您要查询的数据,请重新选择参数!'
  347 + });
  348 + $("#export").attr('disabled',"true");
  349 + return;
  350 + }else
  351 + $("#export").removeAttr("disabled");
  352 + var htmlHead = "<tr><td colspan='"+rs[0].length+"'>"+datas.name+"</td></tr>", htmlBody = "";
  353 + var rsLength = rs.length;
  354 + rs.forEach(function (o, i) {
  355 + var html = "<tr>"
  356 + o.forEach(function (td, j) {
  357 + var colspan;
  358 + if (i == rsLength - 1 && j == 0) {
  359 + colspan = (statisticalObj == "xl" ? "colspan='3'" : "colspan='5'");
  360 + if(statisticalObj == "cl")
  361 + colspan = "colspan='6'";
  362 + }
  363 + html += "<td " + colspan + ">" + td + "</td>"
  364 + });
  365 + html += "</tr>"
  366 + if (i == 0) {
  367 + htmlHead += html;
  368 + } else
  369 + htmlBody += html;
  370 + });
  371 + $('#forms_head thead').html(htmlHead);
  372 + $('#forms_body tbody').html(htmlBody);
  373 + layer.close(lodingI);
  374 + });
  375 + }
  376 + }
  377 + });
  378 +
  379 + $("#export").on("click",function(){
  380 + $post("/report/calcDetailMonthlyE",datas,function(result){
  381 + window.open("/downloadFile/download?fileName="+datas.name);
  382 + });
  383 + });
  384 + });
  385 +</script>
  386 +<!--<script type="application/javascript" src="/pages/forms/calc/calcDetailMonthly.js"></script>-->
0 \ No newline at end of file 387 \ No newline at end of file
src/main/resources/static/pages/forms/calc/calcDetailYear.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 + text-align: center; }
  12 + .table-bordered > thead > tr > th,
  13 + .table-bordered > thead > tr > td {
  14 + border-bottom-width: 2px; }
  15 +
  16 + .table > tbody + tbody {
  17 + border-top: 1px solid; }
  18 +
  19 +
  20 + #analy_body tr> td >span{
  21 + word-break: keep-all;white-space:nowrap;
  22 + }
  23 +
  24 + #analy_body td{
  25 + min-width: 100px;
  26 + max-width: 100px;
  27 + width: 100px;
  28 + }
  29 +
  30 + #analy_body{
  31 + margin-top: 20px;
  32 + height: 620px;
  33 + width: 100%
  34 + }
  35 +
  36 +
  37 + .table_head::-webkit-scrollbar {
  38 + display:none
  39 + }
  40 +
  41 + .table_head{
  42 + min-width: 906px;
  43 + width: 100%;
  44 + overflow: hidden;
  45 + }
  46 +
  47 + .table_body{
  48 + width:101%;
  49 + height:580px;
  50 + overflow: auto;
  51 + margin-top: -20px;
  52 + }
  53 +</style>
  54 +<div class="page-head">
  55 + <div class="page-title">
  56 + <h1>路单线路明细年报表</h1>
  57 + </div>
  58 +</div>
  59 +
  60 +<!--<div class="row">-->
  61 +<div class=" row col-md-12 portlet light bordered" style="height:calc(100% - 38px)">
  62 + <div class="">
  63 + <form class="form-inline" >
  64 + <div style="display: inline-block; margin-left: 13px;" id="gsdmDiv_daily">
  65 + <span class="item-label" style="width: 80px;">&#12288;&#12288;公司: </span>
  66 + <select class="form-control" name="company" id="gsdm" style="width: 150px;"></select>
  67 + </div>
  68 + <div style="display: inline-block; margin-left: 13px;" id="fgsdmDiv_daily">
  69 + <span class="item-label" style="width: 80px;">&#12288;分公司: </span>
  70 + <select class="form-control" name="fgsdm" id="fgsdm" style="width: 150px;"></select>
  71 + </div>
  72 + <!--<div style="display: inline-block;margin-left: 33px;">
  73 + <span class="item-label" style="width: 80px;">&#12288;&#12288;线路: </span>
  74 + <select class="form-control" name="line" id="line" style="width: 180px;"></select>
  75 + </div>-->
  76 + <div style="display: inline-block;margin-left: 13px;" class="date-picker">
  77 + <span class="item-label" style="width: 80px;">&#12288;&#12288;时间: </span>
  78 + <input class="form-control" type="text" id="startDate" style="width: 150px;" /> -
  79 + <input class="form-control" type="text" id="endDate" style="width: 150px;" />
  80 + <!--<input class="form-control" type="text" id="startDate" style="width: 180px;" value="2020-10-01"/> - -->
  81 + <!--<input class="form-control" type="text" id="endDate" style="width: 180px;" value="2020-10-10"/>-->
  82 + </div>
  83 +
  84 + <div style="margin-top: 2px"></div>
  85 +
  86 + <div style="display: inline-block; margin-left: 13px;">
  87 + <span class="item-label" style="width: 80px;">线路性质: </span>
  88 + <select class="form-control" name="destroy" id="destroy" style="width: 150px;">
  89 + <option value="0,1">全部线路</option>
  90 + <option value="0">营运线路</option>
  91 + <option value="1">非营运线路</option>
  92 + </select>
  93 + </div>
  94 + <div style="display: inline-block;margin-left: 13px;">
  95 + <span class="item-label" style="width: 80px;">统计对象: </span>
  96 + <select class="form-control" name="statisticalObj" id="statisticalObj" style="width: 150px;">
  97 + <option value="cl">车辆</option>
  98 + <option value="jsy">驾驶员</option>
  99 + <option value="cwy">乘务员</option>
  100 + <option value="xl">线路</option>
  101 + </select>
  102 + </div>
  103 +
  104 + <div style="display: inline-block; margin-left: 13px;" >
  105 + <span class="item-label" style="width: 80px;">统计项目: </span>
  106 + <select class="form-control" name="statisticalItem" id="statisticalItem" style="width: 150px;">
  107 + <option value="yh">油耗</option>
  108 + <option value="dh">电耗</option>
  109 + <option value="gl">公里</option>
  110 + <option value="bc">班次</option>
  111 + </select>
  112 + </div>
  113 + <div style="display: inline-block; margin-left: 13px;" >
  114 + <span class="item-label" style="width: 80px;">项目明细: </span>
  115 + <select class="form-control" name="itemDetails" id="itemDetails" style="width: 150px;"></select>
  116 + </div>
  117 + <div class="form-group" style="display: inline-block;margin-left: 22px;">
  118 + <input class="btn btn-default" type="button" id="query" value="筛选"/>
  119 + <input class="btn btn-default" type="button" id="export" value="导出"/>
  120 + </div>
  121 + </form>
  122 + </div>
  123 +
  124 + <div id="analy_body">
  125 + <div class="table_head" id="table_head">
  126 + <table class="table table-bordered table-hover table-checkable " id="forms_head">
  127 + <thead>
  128 + </thead>
  129 + </table>
  130 + </div>
  131 + <div class="table_body" id="table_body">
  132 + <table class="table table-bordered table-hover table-checkable" id="forms_body" style="background-color: white;">
  133 + <tbody>
  134 + </tbody>
  135 + </table>
  136 + </div>
  137 + </div>
  138 +</div>
  139 +<script >
  140 + $(function(){
  141 + $('#export').attr('disabled', "true");
  142 + // 关闭左侧栏
  143 + if (!$('body').hasClass('page-sidebar-closed'))
  144 + $('.menu-toggler.sidebar-toggler').click();
  145 +
  146 + var table_body1 = document.getElementById("table_body");
  147 + table_body1.onscroll = function(){
  148 + var table_body1_left = this.scrollLeft;
  149 + document.getElementById("table_head").scrollLeft = table_body1_left;
  150 + };
  151 +
  152 + var d = new Date();
  153 + var year = d.getFullYear();
  154 + var month = d.getMonth() + 1;
  155 + if(month < 10)
  156 + month = "0" + month;
  157 + //时间
  158 + var dateTime=year + "-" + month;
  159 + $("#startDate").val(dateTime);
  160 + $("#endDate").val(dateTime);
  161 +
  162 + $("#endDate").datetimepicker({
  163 + format : 'YYYY-MM',
  164 + locale : 'zh-cn',
  165 + maxDate : dateTime
  166 + });
  167 + $("#startDate").datetimepicker({
  168 + format : 'YYYY-MM',
  169 + locale : 'zh-cn',
  170 + maxDate : dateTime
  171 + });
  172 +
  173 +
  174 + var lineAll="",lineNoD="",lineD="";
  175 + var datas = {}; //查询条件
  176 +
  177 +
  178 +// /**用户分配的线路*/
  179 +// $.get('/realControAuthority/findByCurrentUser', function (userAuthor) {
  180 +// lineAll = userAuthor.lineCodeStr.substring(0,userAuthor.lineCodeStr.length-1);
  181 +// });
  182 +
  183 + /**全部的线路*/
  184 + $.get('/line/all', function (lines) {
  185 + $.each(lines,function (i, e) {
  186 + if(i > 0){
  187 + lineAll += ",";
  188 + }
  189 + lineAll += e.lineCode;
  190 + });
  191 + });
  192 +
  193 + var tempData = {};
  194 +
  195 + $.get('/user/companyData', function(result){
  196 + var obj = result;
  197 + var options = '';
  198 + for(var i = 0; i < obj.length; i++){
  199 + options += '<option value="'+obj[i].companyCode+'">'+obj[i].companyName+'</option>';
  200 + }
  201 +
  202 + if(obj.length ==0){
  203 + $("#gsdmDiv_daily").css('display','none');
  204 + }else if(obj.length ==1){
  205 + $("#gsdmDiv_daily").css('display','none');
  206 + if(obj[0].children.length == 1 || obj[0].children.length == 0){
  207 + fage=false;
  208 + $('#gsdmDiv_daily').css('display','none');
  209 + }
  210 + }
  211 + $('#gsdm').html(options);
  212 + updateCompany();
  213 + });
  214 + $("#gsdm").on("change",updateCompany);
  215 +
  216 + function updateCompany(){
  217 + var company = $('#gsdm').val();
  218 + $.get('/user/companyData', function(obj) {
  219 + var option = '';
  220 + var allC = "";
  221 + for (var i = 0; i < obj.length; i++) {
  222 + if (obj[i].companyCode == company) {
  223 + var children = obj[i].children;
  224 + for (var j = 0; j < children.length; j++) {
  225 + allC += children[j].code+",";
  226 + option += '<option value="' + children[j].code + '">' + children[j].name + '</option>';
  227 + }
  228 + }
  229 + }
  230 +
  231 + var options = '<option value="'+allC.substring(0,allC.length-1)+'">所有分公司</option>'+option;
  232 + $('#fgsdm').html(options);
  233 + });
  234 + }
  235 +
  236 + // 项目明细选项列
  237 + // 触发默认选项
  238 + updateItem();
  239 + $("#statisticalItem").on("change",updateItem);
  240 + var item ="";
  241 + function updateItem() {
  242 + item = $('#statisticalItem').val();
  243 + var options = '';
  244 + if(item == "yh"){
  245 + options += '<option value="jzlAll">加注量[全部]</option>' +
  246 + '<option value="jzl0">加注量[0#]</option>'+
  247 + '<option value="jzl-10">加注量[-10#]</option>'+
  248 + '<option value="yhl">油耗量</option>'+
  249 + '<option value="cccy">出场存油</option>'+
  250 + '<option value="jccy">进场存油</option>'+
  251 + '<option value="bglyh">百公里油耗</option>';
  252 + } else if(item == "gl"){
  253 + options += '<option value="zgl">总公里</option>' +
  254 + '<option value="jhgl">计划公里</option>';
  255 + /*'<option value="jclm">进场路码</option>'+
  256 + '<option value="cclm">出场路码</option>'*/
  257 + } else if(item == "bc"){
  258 + options += '<option value="sjbc">实际班次</option>' +
  259 + '<option value="jhbc">计划班次</option>';
  260 + } else if(item == "dh"){
  261 + options += '<option value="dh">耗电量</option>';
  262 + options += '<option value="cdl">充电量</option>';
  263 + options += '<option value="cccd">出场存电</option>';
  264 + options += '<option value="jccd">进场存电</option>';
  265 + options += '<option value="bgldh">百公里电耗</option>';
  266 + }
  267 + $('#itemDetails').html(options);
  268 + }
  269 +
  270 + //线路名称
  271 + var lineName = '';
  272 + $("#query").on("click",function(){
  273 + var gsdm = $("#gsdm").val();
  274 + var fgsdm = $("#fgsdm").val();
  275 + var startDate = $("#startDate").val();
  276 + var endDate = $("#endDate").val();
  277 + var statisticalObj = $("#statisticalObj").val();
  278 + //开始和结束时间
  279 + var startTime = Date.parse(new Date(startDate));
  280 + var endTime = Date.parse(new Date(endDate));
  281 +
  282 + datas = {}; // 清空之前数据
  283 + datas.timeType = "y";
  284 + datas.gsdm = gsdm;
  285 + datas.fgsdm = fgsdm;
  286 + datas.lineCode = lineAll;
  287 + datas.startDate = startDate;
  288 + datas.endDate = endDate;
  289 + datas.destroy = $("#destroy").val();
  290 + datas.statisticalObj = $("#statisticalObj").val();
  291 + datas.itemDetails = $("#itemDetails").val();
  292 + datas.item = item;
  293 +
  294 + var itemDetails = datas.itemDetails,
  295 + type = "加注量[全部]";
  296 + if(itemDetails=="jzl0"){
  297 + type = "加注量[0#]"
  298 + } else if(itemDetails=="jzl-10"){
  299 + type = "加注量[-10#]"
  300 + } else if(itemDetails=="yhl"){
  301 + type = "油耗量"
  302 + } else if(itemDetails=="cccy"){
  303 + type = "出场存油"
  304 + } else if(itemDetails=="jccy"){
  305 + type = "进场存油"
  306 + } else if(itemDetails=="bglyh"){
  307 + type = "百公里油耗"
  308 + } else if(itemDetails=="zgl"){
  309 + type = "总公里"
  310 + } else if(itemDetails=="jhgl"){
  311 + type = "计划公里"
  312 + } else if(itemDetails=="jclm"){
  313 + type = "进场路码"
  314 + } else if(itemDetails=="cclm"){
  315 + type = "出场路码"
  316 + } else if(itemDetails=="sjbc"){
  317 + type = "实际班次"
  318 + } else if(itemDetails=="jhbc"){
  319 + type = "计划班次"
  320 + } else if(itemDetails=="dh"){
  321 + type = "耗电量"
  322 + } else if(itemDetails=="cdl"){
  323 + type = "充电量"
  324 + } else if(itemDetails=="cccd"){
  325 + type = "出场存电"
  326 + } else if(itemDetails=="jccd"){
  327 + type = "进场存电"
  328 + } else if(itemDetails=="bgldh"){
  329 + type = "百公里电耗"
  330 + }
  331 + datas.name = datas.startDate+"-"+datas.endDate+"-路单线路明细年报表("+type+")";
  332 + if(startDate==null || startDate =="" ||endDate==null || endDate ==""){
  333 + layer.msg('请选择时间段!');
  334 + }else if(endTime<startTime){
  335 + layer.msg('结束日期不能小于开始日期!');
  336 + }else {
  337 + if (endDate.substring(0, 4) != startDate.substring(0, 4)) {
  338 + layer.msg("请查询同年份数据!");
  339 + return;
  340 + } else {
  341 + var lodingI = layer.load(2);
  342 + $get('/calcWaybill/calcDetailMonthly', datas, function (rs) {
  343 + if (rs.length <=0) {
  344 + layer.close(lodingI);
  345 + layer.open({
  346 + title: '提示'
  347 + , content: '没有您要查询的数据,请重新选择参数!'
  348 + });
  349 + $("#export").attr('disabled',"true");
  350 + return;
  351 + }else
  352 + $("#export").removeAttr("disabled");
  353 + var htmlHead = "<tr><td colspan='"+rs[0].length+"'>"+datas.name+"</td></tr>", htmlBody = "";
  354 + var rsLength = rs.length;
  355 + rs.forEach(function (o, i) {
  356 + var html = "<tr>"
  357 + o.forEach(function (td, j) {
  358 + var colspan;
  359 + if (i == rsLength - 1 && j == 0) {
  360 + colspan = (statisticalObj == "xl" ? "colspan='3'" : "colspan='5'");
  361 + if(statisticalObj == "cl")
  362 + colspan = "colspan='6'";
  363 + }
  364 + html += "<td " + colspan + ">" + td + "</td>"
  365 + });
  366 + html += "</tr>"
  367 + if (i == 0) {
  368 + htmlHead += html;
  369 + } else
  370 + htmlBody += html;
  371 + });
  372 + $('#forms_head thead').html(htmlHead);
  373 + $('#forms_body tbody').html(htmlBody);
  374 + layer.close(lodingI);
  375 + });
  376 + }
  377 + }
  378 + });
  379 +
  380 + $("#export").on("click",function(){
  381 + $post("/report/calcDetailMonthlyE",datas,function(result){
  382 + window.open("/downloadFile/download?fileName="+datas.name);
  383 + });
  384 + });
  385 + });
  386 +</script>
  387 +<!--<script type="application/javascript" src="/pages/forms/calc/calcDetailMonthly.js"></script>-->
0 \ No newline at end of file 388 \ No newline at end of file