Commit 1a4bf80a8a2992b23588705d76c91ca4a4edeb2a

Authored by 娄高锋
1 parent dc8e9be5

人车班次公里统计 和 路单数据统计

src/main/java/com/bsth/controller/calc/CalcExportController.java 0 → 100644
  1 +package com.bsth.controller.calc;
  2 +
  3 +import java.text.SimpleDateFormat;
  4 +import java.util.ArrayList;
  5 +import java.util.HashMap;
  6 +import java.util.Iterator;
  7 +import java.util.List;
  8 +import java.util.Map;
  9 +
  10 +import org.springframework.beans.factory.annotation.Autowired;
  11 +import org.springframework.web.bind.annotation.RequestMapping;
  12 +import org.springframework.web.bind.annotation.RequestMethod;
  13 +import org.springframework.web.bind.annotation.RequestParam;
  14 +import org.springframework.web.bind.annotation.RestController;
  15 +
  16 +import com.bsth.common.ResponseCode;
  17 +import com.bsth.entity.calc.CalcWaybill;
  18 +import com.bsth.entity.mcy_forms.Waybillday;
  19 +import com.bsth.service.calc.CalcMixService;
  20 +import com.bsth.service.calc.CalcWaybillService;
  21 +import com.bsth.util.ReportUtils;
  22 +
  23 +@RestController
  24 +@RequestMapping("calc_export")
  25 +public class CalcExportController {
  26 +
  27 + @Autowired
  28 + CalcWaybillService service;
  29 +
  30 + @Autowired
  31 + CalcMixService clacMixService;
  32 +
  33 + @RequestMapping(value = "/waybilldayExport", method = RequestMethod.GET)
  34 + public Map<String, Object> calcjsyspyExport(@RequestParam Map<String, Object> map) {
  35 +
  36 + String line="";
  37 + if(map.get("line")!=null){
  38 + line=map.get("line").toString().trim();
  39 + }
  40 + String lineName="";
  41 + if(map.get("lineName")!=null){
  42 + lineName=map.get("lineName").toString().trim();
  43 + }
  44 + String startDate="";
  45 + if(map.get("startDate")!=null){
  46 + startDate=map.get("startDate").toString().trim();
  47 + }
  48 + String endDate="";
  49 + if(map.get("endDate")!=null){
  50 + endDate=map.get("endDate").toString().trim();
  51 + }
  52 + String cont="";
  53 + if(map.get("cont")!=null){
  54 + cont=map.get("cont").toString().trim();
  55 + }
  56 + String empnames="";
  57 + if(map.get("empnames")!=null){
  58 + empnames=map.get("empnames").toString().trim();
  59 + }
  60 + String gsdmManth="";
  61 + if(map.get("gsdmManth")!=null){
  62 + gsdmManth=map.get("gsdmManth").toString().trim();
  63 + }
  64 + String fgsdmManth="";
  65 + if(map.get("fgsdmManth")!=null){
  66 + fgsdmManth=map.get("fgsdmManth").toString().trim();
  67 + }
  68 +
  69 + Map<String, Object> resMap = new HashMap<String, Object>();
  70 + List<Map<String, Object>> resList = new ArrayList<Map<String, Object>>();
  71 + List<Map<String, Object>> list = clacMixService.calcjsyspy(line, startDate, endDate, empnames, cont, gsdmManth, fgsdmManth);
  72 +
  73 + Map<String, Object> temp = new HashMap<String, Object>();
  74 + temp.put("i", "序号");
  75 + temp.put("jName", empnames);
  76 + temp.put("jhyybc", "计划营运班次");
  77 + temp.put("jhfyybc", "计划空驶班次");
  78 + temp.put("sjyybc", "实际营运班次");
  79 + temp.put("sjfyybc", "实际空驶班次");
  80 + temp.put("lbbc", "烂班班次");
  81 + temp.put("ljbc", "临加班次");
  82 + temp.put("jhzlc", "计划总里程");
  83 + temp.put("jhyylc", "计划营运里程");
  84 + temp.put("jhfyylc", "计划空驶里程");
  85 + temp.put("sjzlc", "实际总里程");
  86 + temp.put("sjyylc", "实际营运里程");
  87 + temp.put("sjfyylc", "实际空驶里程");
  88 + temp.put("lblc", "烂班里程");
  89 + temp.put("ljyylc", "临加营运里程");
  90 + temp.put("ljfyylc", "临加空驶里程");
  91 + resList.add(temp);
  92 + for(int i = 0; i < list.size(); i++){
  93 + temp = list.get(i);
  94 + temp.put("i", i+1);
  95 + resList.add(temp);
  96 + }
  97 +
  98 + String date = startDate.replaceAll("-", "");
  99 + if(!startDate.equals(endDate)){
  100 + date = startDate.replaceAll("-", "") + "-" + endDate.replaceAll("-", "");
  101 + }
  102 +
  103 + SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"),
  104 + sdfSimple = new SimpleDateFormat("yyyyMMdd");
  105 + List<Iterator<?>> listI = new ArrayList<Iterator<?>>();
  106 + Map<String,Object> mm = new HashMap<String, Object>();
  107 + ReportUtils ee = new ReportUtils();
  108 +
  109 + try {
  110 + listI.add(resList.iterator());
  111 + String path = this.getClass().getResource("/").getPath()+"static/pages/forms/";
  112 + ee.excelReplace(listI, new Object[] { mm }, path+"mould/calcjsyspy.xls",
  113 + path+"export/"+date+"-"+lineName+"-人车班次公里统计.xls");
  114 + resMap.put("status", ResponseCode.SUCCESS);
  115 + } catch (Exception e) {
  116 + e.printStackTrace();
  117 + resMap.put("status", ResponseCode.ERROR);
  118 + }
  119 + return resMap;
  120 + }
  121 +
  122 + @RequestMapping(value = "/singledataExportTj", method = RequestMethod.GET)
  123 + public Map<String, Object> singledataExportTj(@RequestParam Map<String, Object> map) {
  124 +
  125 + String line="";
  126 + if(map.get("line")!=null){
  127 + line=map.get("line").toString().trim();
  128 + }
  129 + String lineName="";
  130 + if(map.get("lineName")!=null){
  131 + lineName=map.get("lineName").toString().trim();
  132 + }
  133 + String startDate="";
  134 + if(map.get("startDate")!=null){
  135 + startDate=map.get("startDate").toString().trim();
  136 + }
  137 + String endDate="";
  138 + if(map.get("endDate")!=null){
  139 + endDate=map.get("endDate").toString().trim();
  140 + }
  141 + String tjtype="";
  142 + if(map.get("tjtype")!=null){
  143 + tjtype=map.get("tjtype").toString().trim();
  144 + }
  145 + String cont="";
  146 + if(map.get("cont")!=null){
  147 + cont=map.get("cont").toString().trim();
  148 + }
  149 + String gsdmSing="";
  150 + if(map.get("gsdmSing")!=null){
  151 + gsdmSing=map.get("gsdmSing").toString().trim();
  152 + }
  153 + String fgsdmSing="";
  154 + if(map.get("fgsdmSing")!=null){
  155 + fgsdmSing=map.get("fgsdmSing").toString().trim();
  156 + }
  157 +
  158 + Map<String, Object> resMap = new HashMap<String, Object>();
  159 + List<Map<String, Object>> resList = new ArrayList<Map<String, Object>>();
  160 + List<Map<String, Object>> list = clacMixService.singledatatj(line, startDate, endDate, tjtype, cont, gsdmSing, fgsdmSing);
  161 +
  162 + Map<String, Object> temp = new HashMap<String, Object>();
  163 + temp.put("i", "序号");
  164 + temp.put("gS", "所属公司");
  165 + temp.put("xlName", "线路");
  166 + temp.put("jName", tjtype);
  167 + temp.put("jhzlc", "计划公里");
  168 + temp.put("sjzlc", "行驶里程(包括空放)");
  169 + temp.put("sjfyylc", "空驶里程");
  170 + temp.put("hyl", "耗油量");
  171 + temp.put("jzl", "加注量");
  172 + temp.put("sh", "非营业用油");
  173 +
  174 + resList.add(temp);
  175 + for(int i = 0; i < list.size(); i++){
  176 + temp = list.get(i);
  177 + temp.put("i", i+1);
  178 + if(temp.get("xlName") == null){
  179 + temp.put("xlName", "");
  180 + }
  181 + resList.add(temp);
  182 + }
  183 +
  184 + String date = startDate.replaceAll("-", "");
  185 + if(!startDate.equals(endDate)){
  186 + date = startDate.replaceAll("-", "") + "-" + endDate.replaceAll("-", "");
  187 + }
  188 +
  189 + SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"),
  190 + sdfSimple = new SimpleDateFormat("yyyyMMdd");
  191 + List<Iterator<?>> listI = new ArrayList<Iterator<?>>();
  192 + Map<String,Object> mm = new HashMap<String, Object>();
  193 + ReportUtils ee = new ReportUtils();
  194 +
  195 + try {
  196 + listI.add(resList.iterator());
  197 + String path = this.getClass().getResource("/").getPath()+"static/pages/forms/";
  198 + ee.excelReplace(listI, new Object[] { mm }, path+"mould/calcsingledata.xls",
  199 + path+"export/"+date+"-"+lineName+"-路单数据(统计).xls");
  200 + resMap.put("status", ResponseCode.SUCCESS);
  201 + } catch (Exception e) {
  202 + e.printStackTrace();
  203 + resMap.put("status", ResponseCode.ERROR);
  204 + }
  205 + return resMap;
  206 + }
  207 +
  208 +}
... ...
src/main/java/com/bsth/controller/calc/CalcMixController.java 0 → 100644
  1 +package com.bsth.controller.calc;
  2 +
  3 +import java.util.List;
  4 +import java.util.Map;
  5 +
  6 +import org.springframework.beans.factory.annotation.Autowired;
  7 +import org.springframework.web.bind.annotation.RequestMapping;
  8 +import org.springframework.web.bind.annotation.RequestMethod;
  9 +import org.springframework.web.bind.annotation.RequestParam;
  10 +import org.springframework.web.bind.annotation.RestController;
  11 +
  12 +import com.bsth.service.calc.CalcMixService;
  13 +
  14 +@RestController
  15 +@RequestMapping("calc_mix")
  16 +public class CalcMixController {
  17 +
  18 + @Autowired
  19 + CalcMixService service;
  20 +
  21 + @RequestMapping(value="/calcjsyspy")
  22 + public List<Map<String, Object>> calcjsyspy(@RequestParam Map<String, Object> map){
  23 + String line="";
  24 + if(map.get("line")!=null){
  25 + line=map.get("line").toString().trim();
  26 + }
  27 + String startDate="";
  28 + if(map.get("startDate")!=null){
  29 + startDate=map.get("startDate").toString().trim();
  30 + }
  31 + String endDate="";
  32 + if(map.get("endDate")!=null){
  33 + endDate=map.get("endDate").toString().trim();
  34 + }
  35 + String empnames="";
  36 + if(map.get("empnames")!=null){
  37 + empnames=map.get("empnames").toString().trim();
  38 + }
  39 + String cont="";
  40 + if(map.get("cont")!=null){
  41 + cont=map.get("cont").toString().trim();
  42 + }
  43 + String gsdmManth="";
  44 + if(map.get("gsdmManth")!=null){
  45 + gsdmManth=map.get("gsdmManth").toString().trim();
  46 + }
  47 + String fgsdmManth="";
  48 + if(map.get("fgsdmManth")!=null){
  49 + fgsdmManth=map.get("fgsdmManth").toString().trim();
  50 + }
  51 + return service.calcjsyspy(line, startDate, endDate, empnames, cont, gsdmManth, fgsdmManth);
  52 + }
  53 +
  54 + @RequestMapping(value = "/singledatatj", method = RequestMethod.GET)
  55 + public List<Map<String, Object>> singledatatj(@RequestParam Map<String, Object> map) {
  56 + String line="";
  57 + if(map.get("line")!=null){
  58 + line=map.get("line").toString().trim();
  59 + }
  60 + String startDate="";
  61 + if(map.get("startDate")!=null){
  62 + startDate=map.get("startDate").toString().trim();
  63 + }
  64 + String endDate="";
  65 + if(map.get("endDate")!=null){
  66 + endDate=map.get("endDate").toString().trim();
  67 + }
  68 + String tjtype="";
  69 + if(map.get("tjtype")!=null){
  70 + tjtype=map.get("tjtype").toString().trim();
  71 + }
  72 + String cont="";
  73 + if(map.get("cont")!=null){
  74 + cont=map.get("cont").toString().trim();
  75 + }
  76 + String gsdmSing="";
  77 + if(map.get("gsdmSing")!=null){
  78 + gsdmSing=map.get("gsdmSing").toString().trim();
  79 + }
  80 + String fgsdmSing="";
  81 + if(map.get("fgsdmSing")!=null){
  82 + fgsdmSing=map.get("fgsdmSing").toString().trim();
  83 + }
  84 + return service.singledatatj(line, startDate, endDate, tjtype, cont, gsdmSing, fgsdmSing);
  85 + }
  86 +
  87 +}
... ...
src/main/java/com/bsth/repository/calc/CalcWaybillRepository.java
... ... @@ -58,4 +58,15 @@ public interface CalcWaybillRepository extends BaseRepository&lt;CalcWaybill, Integ
58 58 @Query("select DISTINCT s from ScheduleRealInfo s where s.scheduleDateStr=?1")
59 59 List<ScheduleRealInfo> findAllScheduleByDate(String schDate);
60 60  
  61 +
  62 + //按照时间段统计,公司下线路 (驾驶员)
  63 + @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 CONCAT(jGh,'/',jName) like %?6% order by c.xl")
  64 + List<CalcWaybill> scheduleByJsy(String line,String date,String date2,String gsdm,String fgsdm,String jsy);
  65 + //按照时间段统计,公司下线路 (售票员)
  66 + @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 CONCAT(sGh,'/',sName) like %?6% order by c.xl")
  67 + List<CalcWaybill> scheduleBySpy(String line,String date,String date2,String gsdm,String fgsdm,String spy);
  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")
  70 + List<CalcWaybill> scheduleByZbh(String line,String date,String date2,String gsdm,String fgsdm,String zbh);
  71 +
61 72 }
... ...
src/main/java/com/bsth/service/calc/CalcMixService.java 0 → 100644
  1 +package com.bsth.service.calc;
  2 +
  3 +import java.util.List;
  4 +import java.util.Map;
  5 +
  6 +/**
  7 + * Created by 19/02/28.
  8 + */
  9 +public interface CalcMixService {
  10 +
  11 + List<Map<String, Object>> calcjsyspy(String line, String startDate, String endDate, String cont, String empnames, String gsdmManth, String fgsdmManth);
  12 +
  13 + List<Map<String, Object>> singledatatj(String line, String startDate, String endDate, String tjtype, String cont, String gsdmSing, String fgsdmSing);
  14 +
  15 +}
... ...
src/main/java/com/bsth/service/calc/impl/CalcMixServiceImpl.java 0 → 100644
  1 +package com.bsth.service.calc.impl;
  2 +
  3 +import java.sql.ResultSet;
  4 +import java.sql.SQLException;
  5 +import java.util.ArrayList;
  6 +import java.util.HashMap;
  7 +import java.util.List;
  8 +import java.util.Map;
  9 +
  10 +import com.bsth.data.BasicData;
  11 +import com.bsth.entity.calc.CalcWaybill;
  12 +import com.bsth.entity.mcy_forms.Singledata;
  13 +import com.bsth.repository.calc.CalcWaybillRepository;
  14 +import com.bsth.service.calc.CalcMixService;
  15 +import com.bsth.util.Arith;
  16 +
  17 +import org.slf4j.Logger;
  18 +import org.slf4j.LoggerFactory;
  19 +import org.springframework.beans.factory.annotation.Autowired;
  20 +import org.springframework.jdbc.core.JdbcTemplate;
  21 +import org.springframework.jdbc.core.RowMapper;
  22 +import org.springframework.stereotype.Service;
  23 +
  24 +/**
  25 + * Created by 19/02/28.
  26 + */
  27 +@Service
  28 +public class CalcMixServiceImpl implements CalcMixService {
  29 +
  30 + @Autowired
  31 + private CalcWaybillRepository calcRepository;
  32 +
  33 + @Autowired
  34 + JdbcTemplate jdbcTemplate;
  35 +
  36 +
  37 + Logger logger = LoggerFactory.getLogger(this.getClass());
  38 +
  39 +
  40 + @Override
  41 + public List<Map<String, Object>> calcjsyspy(String line, String date, String date2,
  42 + String empnames, String cont, String gsdm, String fgsdm) {
  43 +
  44 + List<Map<String, Object>> resList = new ArrayList<Map<String, Object>>();
  45 + List<CalcWaybill> list = null;
  46 +
  47 + int flag = 0;
  48 + if("驾驶员".equals(empnames)){
  49 + flag = 1;
  50 + list = calcRepository.scheduleByJsy(line, date, date2, gsdm, fgsdm, cont);
  51 + } else if("售票员".equals(empnames)){
  52 + flag = 2;
  53 + list = calcRepository.scheduleBySpy(line, date, date2, gsdm, fgsdm, cont);
  54 + } else if("车辆自编号".equals(empnames)){
  55 + flag = 3;
  56 + list = calcRepository.scheduleByZbh(line, date, date2, gsdm, fgsdm, cont);
  57 + }
  58 +
  59 + List<CalcWaybill> calcList = new ArrayList<CalcWaybill>();
  60 + Map<String, CalcWaybill> calcMap = new HashMap<String, CalcWaybill>();
  61 +
  62 + CalcWaybill zjCalc = this.initCalcWaybill();
  63 + zjCalc.setjName("合计");
  64 + for(CalcWaybill c : list){
  65 + String key = "";
  66 + if(flag == 1){
  67 + if(c.getjGh() != null && c.getjName() != null)
  68 + key = c.getjGh() + "/" + c.getjName();
  69 + } else if(flag == 2){
  70 + if(c.getsGh() != null && c.getsName() != null)
  71 + key = c.getsGh() + "/" + c.getsName();
  72 + } else if(flag == 3){
  73 + if(c.getCl() != null)
  74 + key = c.getCl();
  75 + }
  76 +
  77 + if(key.trim().length() == 0 || "/".equals(key))
  78 + continue;
  79 +
  80 + CalcWaybill calc = null;
  81 + if(calcMap.containsKey(key)){
  82 + calc = calcMap.get(key);
  83 + } else {
  84 + calc = this.initCalcWaybill();
  85 + calc.setjName(key);
  86 + calcList.add(calc);
  87 + calcMap.put(key, calc);
  88 + }
  89 +
  90 + this.summation(calc, c);
  91 +
  92 + this.summation(zjCalc, c);
  93 +
  94 + }
  95 + calcList.add(zjCalc);
  96 + calcMap.put("合计", zjCalc);
  97 +
  98 + for(CalcWaybill c : calcList){
  99 + Map<String, Object> m = new HashMap<String, Object>();
  100 + m.put("jName", c.getjName());
  101 + m.put("jhyybc", c.getJhyybc());
  102 + m.put("jhfyybc", c.getJhfyybc());
  103 + m.put("sjyybc", c.getSjyybc());
  104 + m.put("sjfyybc", c.getSjfyybc());
  105 + m.put("lbbc", c.getLbbc());
  106 + m.put("ljbc", c.getLjbc());
  107 + m.put("jhzlc", Arith.add(c.getJhyylc(), c.getJhfyylc()));
  108 + m.put("jhyylc", c.getJhyylc());
  109 + m.put("jhfyylc", c.getJhfyylc());
  110 + m.put("sjzlc", Arith.add(c.getSjyylc(), c.getSjfyylc()));
  111 + m.put("sjyylc", c.getSjyylc());
  112 + m.put("sjfyylc", c.getSjfyylc());
  113 + m.put("lblc", c.getLblc());
  114 + m.put("ljyylc", c.getLjyylc());
  115 + m.put("ljfyylc", c.getLjfyylc());
  116 + resList.add(m);
  117 + }
  118 +
  119 + return resList;
  120 + }
  121 +
  122 + public CalcWaybill initCalcWaybill(){
  123 + CalcWaybill calc = new CalcWaybill();
  124 + calc.setJhyybc(0);
  125 + calc.setJhyylc(0d);
  126 + calc.setJhfyybc(0);
  127 + calc.setJhfyylc(0d);
  128 + calc.setSjyybc(0);
  129 + calc.setSjyylc(0d);
  130 + calc.setSjfyybc(0);
  131 + calc.setSjfyylc(0d);
  132 + calc.setLbbc(0);
  133 + calc.setLblc(0d);
  134 + calc.setLjbc(0);
  135 + calc.setLjyylc(0d);
  136 + calc.setLjfyylc(0d);
  137 + return calc;
  138 + }
  139 +
  140 + public CalcWaybill summation(CalcWaybill c1, CalcWaybill c2){
  141 + c1.setJhyybc(c1.getJhyybc() + c2.getJhyybc());
  142 + c1.setJhyylc(Arith.add(c1.getJhyylc(), c2.getJhyylc()));
  143 + c1.setJhfyybc(c1.getJhfyybc() + c2.getJhfyybc());
  144 + c1.setJhfyylc(Arith.add(c1.getJhfyylc(), c2.getJhfyylc()));
  145 + c1.setSjyybc(c1.getSjyybc() + c2.getSjyybc());
  146 + c1.setSjyylc(Arith.add(c1.getSjyylc(), c2.getSjyylc()));
  147 + c1.setSjyylc(Arith.add(c1.getSjyylc(), c2.getLjyylc()));
  148 + c1.setSjfyybc(c1.getSjfyybc() + c2.getSjfyybc());
  149 + c1.setSjfyylc(Arith.add(c1.getSjfyylc(), c2.getSjfyylc()));
  150 + c1.setSjfyylc(Arith.add(c1.getSjfyylc(), c2.getLjfyylc()));
  151 + c1.setLbbc(c1.getLbbc() + c2.getLbbc());
  152 + c1.setLblc(Arith.add(c1.getLblc(), c2.getLblc()));
  153 + c1.setLjbc(c1.getLjbc() + c2.getLjbc());
  154 + c1.setLjyylc(Arith.add(c1.getLjyylc(), c2.getLjyylc()));
  155 + c1.setLjfyylc(Arith.add(c1.getLjfyylc(), c2.getLjfyylc()));
  156 + return c1;
  157 + }
  158 +
  159 + @Override
  160 + public List<Map<String, Object>> singledatatj(String line,
  161 + String date, String date2,
  162 + String tjtype, String cont,
  163 + String gsdm, String fgsdm) {
  164 +
  165 + List<Map<String, Object>> resList = new ArrayList<Map<String, Object>>();
  166 + List<CalcWaybill> list = null;
  167 +
  168 + int flag = 0;
  169 + if("驾驶员".equals(tjtype)){
  170 + flag = 1;
  171 + list = calcRepository.scheduleByJsy(line, date, date2, gsdm, fgsdm, cont);
  172 + } else if("售票员".equals(tjtype)){
  173 + flag = 2;
  174 + list = calcRepository.scheduleBySpy(line, date, date2, gsdm, fgsdm, cont);
  175 + } else if("车辆自编号".equals(tjtype)){
  176 + flag = 3;
  177 + list = calcRepository.scheduleByZbh(line, date, date2, gsdm, fgsdm, cont);
  178 + }
  179 +
  180 + List<CalcWaybill> calcList = new ArrayList<CalcWaybill>();
  181 + Map<String, CalcWaybill> calcMap = new HashMap<String, CalcWaybill>();
  182 +
  183 + CalcWaybill zjCalc = this.initCalcWaybill();
  184 + zjCalc.setjName("合计");
  185 + for(CalcWaybill c : list){
  186 + String key = "";
  187 + if(flag == 1){
  188 + if(c.getjGh() != null && c.getjName() != null)
  189 + key += c.getjGh() + "/" + c.getjName();
  190 + } else if(flag == 2){
  191 + if(c.getsGh() != null && c.getsName() != null)
  192 + key += c.getsGh() + "/" + c.getsName();
  193 + } else if(flag == 3){
  194 + if(c.getCl() != null)
  195 + key += c.getCl();
  196 + }
  197 +
  198 + if(key.trim().length() == 0 || "/".equals(key))
  199 + continue;
  200 +
  201 + String jName = key;
  202 + key = c.getXl() + "/" + key;
  203 +
  204 + CalcWaybill calc = null;
  205 + if(calcMap.containsKey(key)){
  206 + calc = calcMap.get(key);
  207 + } else {
  208 + calc = this.initCalcWaybill();
  209 + calc.setXlName(c.getXlName());
  210 + calc.setXl(c.getXl());
  211 + calc.setjName(jName);
  212 + calcList.add(calc);
  213 + calcMap.put(key, calc);
  214 + }
  215 +
  216 + this.summation(calc, c);
  217 +
  218 + this.summation(zjCalc, c);
  219 +
  220 + }
  221 + calcList.add(zjCalc);
  222 + calcMap.put("合计", zjCalc);
  223 +
  224 + Map<String, Map<String, Object>> keyMap = new HashMap<String, Map<String, Object>>();
  225 + for(CalcWaybill c : calcList){
  226 + Map<String, Object> m = new HashMap<String, Object>();
  227 + m.put("gS", BasicData.businessFgsCodeNameMap.get(fgsdm+"_"+gsdm));
  228 + m.put("xl", c.getXl());
  229 + m.put("xlName", c.getXlName());
  230 + m.put("jName", c.getjName());
  231 + m.put("jhyybc", c.getJhyybc());
  232 + m.put("jhfyybc", c.getJhfyybc());
  233 + m.put("sjyybc", c.getSjyybc());
  234 + m.put("sjfyybc", c.getSjfyybc());
  235 + m.put("lbbc", c.getLbbc());
  236 + m.put("ljbc", c.getLjbc());
  237 + m.put("jhzlc", Arith.add(c.getJhyylc(), c.getJhfyylc()));
  238 + m.put("jhyylc", c.getJhyylc());
  239 + m.put("jhfyylc", c.getJhfyylc());
  240 + m.put("sjzlc", Arith.add(c.getSjyylc(), c.getSjfyylc()));
  241 + m.put("sjyylc", c.getSjyylc());
  242 + m.put("sjfyylc", c.getSjfyylc());
  243 + m.put("lblc", c.getLblc());
  244 + m.put("ljyylc", c.getLjyylc());
  245 + m.put("ljfyylc", c.getLjfyylc());
  246 + if(flag != 2){
  247 + m.put("hyl", 0);
  248 + m.put("jzl", 0);
  249 + m.put("sh", 0);
  250 + }
  251 + resList.add(m);
  252 + keyMap.put(c.getXl() + "/" + c.getjName(), m);
  253 + }
  254 +
  255 + String linesql="";
  256 + if(!line.equals("")){
  257 + linesql +=" and xlbm ='"+line+"' ";
  258 + }
  259 + if(!gsdm.equals("")){
  260 + linesql +=" and ssgsdm ='"+gsdm+"' ";
  261 + }
  262 + if(!fgsdm.equals("")){
  263 + linesql +=" and fgsdm ='"+fgsdm+"' ";
  264 + }
  265 + String nysql="SELECT id,xlbm,nbbm,jsy,jzl as jzl,yh as yh,sh as sh,fgsdm FROM bsth_c_ylb"
  266 + + " WHERE rq >= '"+date+"' and rq <= '"+date2+"'"
  267 + + linesql
  268 + + " union"
  269 + + " SELECT id,xlbm,nbbm,jsy,cdl as jzl,hd as yh,sh as sh,fgsdm FROM bsth_c_dlb"
  270 + + " WHERE rq >= '"+date2+"' and rq <= '"+date2+"'"
  271 + + linesql;
  272 + List<Singledata> listNy = jdbcTemplate.query(nysql, new RowMapper<Singledata>() {
  273 + @Override
  274 + public Singledata mapRow(ResultSet arg0, int arg1) throws SQLException {
  275 + Singledata sin = new Singledata();
  276 + sin.setxL(arg0.getString("xlbm"));
  277 + sin.setJsy(arg0.getString("jsy"));
  278 + sin.setClzbh(arg0.getString("nbbm"));
  279 + sin.setJzl(arg0.getString("jzl"));
  280 + sin.setHyl(arg0.getString("yh"));
  281 + sin.setUnyyyl(arg0.getString("sh"));
  282 + sin.setgS(arg0.getString("fgsdm"));
  283 + return sin;
  284 + }
  285 + });
  286 +
  287 + if(flag != 2){
  288 + Map<String, Object> last = resList.get(resList.size()-1);
  289 + last.put("hyl", 0);
  290 + last.put("jzl", 0);
  291 + last.put("sh", 0);
  292 +
  293 + //统计油,电表中手动添加的或者有加注没里程的数据
  294 + for (int i = 0; i < listNy.size(); i++) {
  295 + Singledata sin_=listNy.get(i);
  296 + String xl=sin_.getxL();
  297 + String str = "";
  298 + if(flag == 1){
  299 + str = sin_.getJsy() + "/" + BasicData.allPerson.get(gsdm+"-"+sin_.getJsy());
  300 + } else {
  301 + str = sin_.getClzbh();
  302 + }
  303 +// boolean fages=true;
  304 + if(keyMap.containsKey(xl + "/" + str)){
  305 + Map<String, Object> m = keyMap.get(xl + "/" + str);
  306 + m.put("hyl", Arith.add(m.get("hyl"), sin_.getHyl()!=null?sin_.getHyl():0));
  307 + m.put("jzl", Arith.add(m.get("jzl"), sin_.getJzl()!=null?sin_.getJzl():0));
  308 + m.put("sh", Arith.add(m.get("sh"), sin_.getUnyyyl()!=null?sin_.getUnyyyl():0));
  309 + last.put("hyl", Arith.add(last.get("hyl"), m.get("hyl")));
  310 + last.put("jzl", Arith.add(last.get("jzl"), m.get("jzl")));
  311 + last.put("sh", Arith.add(last.get("sh"), m.get("sh")));
  312 + } else {
  313 + Map<String, Object> m = new HashMap<String, Object>();
  314 + m.put("gS", BasicData.businessFgsCodeNameMap.get(fgsdm+"_"+gsdm));
  315 + m.put("xl", xl);
  316 + m.put("xlName", BasicData.lineCodeAllNameMap.get(xl));
  317 + m.put("jName", str);
  318 + m.put("jhzlc", 0);
  319 + m.put("sjzlc", 0);
  320 + m.put("sjfyylc", 0);
  321 + m.put("hyl", sin_.getHyl()!=null?sin_.getHyl():0);
  322 + m.put("jzl", sin_.getJzl()!=null?sin_.getJzl():0);
  323 + m.put("sh", sin_.getUnyyyl()!=null?sin_.getUnyyyl():0);
  324 + last.put("hyl", Arith.add(last.get("hyl"), m.get("hyl")));
  325 + last.put("jzl", Arith.add(last.get("jzl"), m.get("jzl")));
  326 + last.put("sh", Arith.add(last.get("sh"), m.get("sh")));
  327 +
  328 + keyMap.put(xl + "/" + str, m);
  329 + }
  330 + }
  331 + resList.remove(last);
  332 + resList.add(last);
  333 + }
  334 +
  335 + return resList;
  336 + }
  337 +
  338 +}
... ...
src/main/java/com/bsth/service/impl/BusIntervalServiceImpl.java
... ... @@ -505,7 +505,7 @@ public class BusIntervalServiceImpl implements BusIntervalService {
505 505 }
506 506  
507 507 String key = schedule.getXlBm() + "/" + schedule.getXlName() + "/" + schedule.getQdzName()
508   - + "/" + schedule.getFgsName() + "/" + schedule.getFgsBm();
  508 + + "/" + schedule.getFgsBm();
509 509 if(!keyMap.containsKey(key))
510 510 keyMap.put(key, new ArrayList<ScheduleRealInfo>());
511 511 keyMap.get(key).add(schedule);
... ... @@ -618,8 +618,8 @@ public class BusIntervalServiceImpl implements BusIntervalService {
618 618 tempMap.put("line", split[1]);
619 619 tempMap.put("qdz", split[2]);
620 620 tempMap.put("company", companyName);
621   - tempMap.put("subCompany", split[3]);
622   - tempMap.put("fgsbm", split[4]);
  621 + tempMap.put("subCompany", subCompanyName);
  622 + tempMap.put("fgsbm", split[3]);
623 623 long jhInterval = 0l;
624 624 long sjInterval = 0l;
625 625 for(Long i : fcsjs)
... ... @@ -677,7 +677,7 @@ public class BusIntervalServiceImpl implements BusIntervalService {
677 677 }else if(statu.equals("0")){
678 678 List<Long> longList = new ArrayList<Long>();
679 679 for(String key : keyList){
680   - long xlBm = Long.valueOf(key.split("/")[4]) * 1000000l + Long.valueOf(key.split("/")[0]);
  680 + long xlBm = Long.valueOf(key.split("/")[3]) * 1000000l + Long.valueOf(key.split("/")[0]);
681 681 if(!longList.contains(xlBm))
682 682 longList.add(xlBm);
683 683 Collections.sort(longList);
... ... @@ -685,7 +685,7 @@ public class BusIntervalServiceImpl implements BusIntervalService {
685 685 for(long xlBm : longList){
686 686 for(String key : keyList){
687 687 String[] split = key.split("/");
688   - long kl = Long.valueOf(split[4]) * 1000000l + Long.valueOf(split[0]);
  688 + long kl = Long.valueOf(split[3]) * 1000000l + Long.valueOf(split[0]);
689 689 if(kl == xlBm){
690 690 Map<String, Object> tempMap = new HashMap<String, Object>();
691 691 List<Long> fcsjs = new ArrayList<Long>();
... ... @@ -712,8 +712,8 @@ public class BusIntervalServiceImpl implements BusIntervalService {
712 712 tempMap.put("line", split[1]);
713 713 tempMap.put("qdz", split[2]);
714 714 tempMap.put("company", companyName);
715   - tempMap.put("subCompany", split[3]);
716   - tempMap.put("fgsbm", split[4]);
  715 + tempMap.put("subCompany", subCompanyName);
  716 + tempMap.put("fgsbm", split[3]);
717 717 tempMap.put("jhInterval", fcsjs.size()>0?df.format((double)fcsj/fcsjs.size()):"/");
718 718 tempMap.put("sjInterval", fcsjAs.size()>0?df.format((double)fcsjA/fcsjAs.size()):"/");
719 719 tempMap.put("MaxInterval", fcsjAs.size()>0?fcsjAs.get(fcsjAs.size() - 1):"/");
... ...
src/main/java/com/bsth/service/schedule/impl/PeopleCarPlanServiceImpl.java
... ... @@ -385,9 +385,9 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService {
385 385 // zgfEnd = sdf.parse(date + "08:30").getTime();
386 386 // wgfBegin = sdf.parse(date + "16:00").getTime();
387 387 // wgfEnd = sdf.parse(date + "18:00").getTime();
388   - zgfBegin = 6l * 60l + 30l;
  388 + zgfBegin = 6l * 60l + 31l;
389 389 zgfEnd = 8l * 60l + 30l;
390   - wgfBegin = 16l * 60l + 0l;
  390 + wgfBegin = 16l * 60l + 1l;
391 391 wgfEnd = 18l * 60l + 0l;
392 392 } catch (Exception e) {
393 393 // TODO Auto-generated catch block
... ... @@ -414,15 +414,23 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService {
414 414 subCompanyName = schedule.getFgsName();
415 415  
416 416 //早晚高峰时段执行率
417   - if(schedule.getFcsjT() >= zgfBegin && schedule.getFcsjT() <= zgfEnd){
418   - jhzgf++;
419   - if(schedule.getFcsjActual() != null)
  417 + if(!schedule.getBcType().equals("in") && !schedule.getBcType().equals("out") && !schedule.getBcType().equals("ldks")){
  418 + if(schedule.getFcsjT() >= zgfBegin && schedule.getFcsjT() <= zgfEnd){
  419 + jhzgf++;
  420 + }
  421 + if(schedule.getFcsjActual() != null && !schedule.isDestroy()
  422 + && schedule.getFcsjActualTime() >= zgfBegin
  423 + && schedule.getFcsjActualTime() <= zgfEnd){
420 424 sjzgf++;
421   - }
422   - if(schedule.getFcsjT() >= wgfBegin && schedule.getFcsjT() <= wgfEnd){
423   - jhwgf++;
424   - if(schedule.getFcsjActual() != null)
  425 + }
  426 + if(schedule.getFcsjT() >= wgfBegin && schedule.getFcsjT() <= wgfEnd){
  427 + jhwgf++;
  428 + }
  429 + if(schedule.getFcsjActual() != null && !schedule.isDestroy()
  430 + && schedule.getFcsjActualTime() >= wgfBegin
  431 + && schedule.getFcsjActualTime() <= wgfEnd){
425 432 sjwgf++;
  433 + }
426 434 }
427 435  
428 436 //班次数和出场数
... ...
src/main/resources/static/pages/forms/calc/calcjsyspy.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 + text-align: center; }
  16 +
  17 + .table > tbody + tbody {
  18 + border-top: 1px solid; }
  19 +</style>
  20 +
  21 +<div class="page-head">
  22 + <div class="page-title">
  23 + <h1>人车班次公里统计</h1>
  24 + </div>
  25 +</div>
  26 +
  27 +<div class="row">
  28 + <div class="col-md-12">
  29 + <div class="portlet light porttlet-fit bordered">
  30 + <div class="portlet-title">
  31 + <form class="form-inline" action="">
  32 + <div style="display: inline-block; margin-left: 33px;" id="gsdmDiv_manth">
  33 + <span class="item-label" style="width: 80px;">公司: </span>
  34 + <select class="form-control" name="company" id="gsdmManth" style="width: 140px;"></select>
  35 + </div>
  36 + <div style="display: inline-block; margin-left: 24px;" id="fgsdmDiv_manth">
  37 + <span class="item-label" style="width: 80px;">分公司: </span>
  38 + <select class="form-control" name="subCompany" id="fgsdmManth" style="width: 140px;"></select>
  39 + </div>
  40 + <div style="display: inline-block;margin-left: 10px">
  41 + <span class="item-label" style="width: 150px;">线路: </span>
  42 + <select class="form-control" name="line" id="line" style="width: 136px;"></select>
  43 + </div>
  44 + <div style="margin-top: 10px">
  45 +
  46 + </div>
  47 + <div style="display: inline-block;margin-left: 5px;">
  48 + <span class="item-label" style="width: 80px;">开始时间: </span>
  49 + <input class="form-control" type="text" id="startDate" style="width: 140px;"/>
  50 + </div>
  51 + <div style="display: inline-block;margin-left: 10px;">
  52 + <span class="item-label" style="width: 80px;">结束时间: </span>
  53 + <input class="form-control" type="text" id="endDate" style="width: 140px;"/>
  54 + </div>
  55 + <div style="display: inline-block;margin-left: 10px">
  56 + <span class="item-label" style="width: 80px;">统计: </span>
  57 + <select class="form-control" style="width: 136px;" id='empnames'>
  58 + <option value="驾驶员">驾驶员</option>
  59 + <option value="售票员">售票员</option>
  60 + <option value="车辆自编号">车辆自编号</option>
  61 + </select>
  62 + </div>
  63 + <div style="display: inline-block;margin-left: 0px">
  64 + <span class="item-label" style="width: 150px;">:</span>
  65 + <input class="form-control" name="cont" id="cont" style="width: 136px;"></input>
  66 + </div>
  67 + <div class="form-group">
  68 + <input class="btn btn-default" type="button" id="query" value="筛选"/>
  69 + <input class="btn btn-default" type="button" id="export" value="导出"/>
  70 + </div>
  71 + </form>
  72 + </div>
  73 + <div class="portlet-body">
  74 + <div class="table-container" style="margin-top: 10px;overflow:auto;min-width: 906px">
  75 + <table class="table table-bordered table-hover table-checkable" id="forms">
  76 + <thead>
  77 + <tr>
  78 + <th>序号</th>
  79 + <th id='empname'>驾驶员</th>
  80 + <th>计划营运班次</th>
  81 + <th>实际营运班次</th>
  82 + <th>烂班班次</th>
  83 + <th>临加班次</th>
  84 + <th>计划总里程</th>
  85 + <th>计划营运里程</th>
  86 + <th>计划空驶里程</th>
  87 + <th>实际总里程</th>
  88 + <th>实际营运里程</th>
  89 + <th>实际空驶里程</th>
  90 + <th>烂班里程</th>
  91 + <th>临加营运里程</th>
  92 + <th>临加空驶里程</th>
  93 + </tr>
  94 + </thead>
  95 + <tbody>
  96 +
  97 + </tbody>
  98 + </table>
  99 + </div>
  100 + </div>
  101 + </div>
  102 + </div>
  103 +</div>
  104 +
  105 +<script>
  106 + $(function(){
  107 + // 关闭左侧栏
  108 + if (!$('body').hasClass('page-sidebar-closed'))
  109 + $('.menu-toggler.sidebar-toggler').click();
  110 +
  111 + var d = new Date();
  112 + d.setTime(d.getTime() - 1*1000*60*60*24);
  113 + var year = d.getFullYear();
  114 + var month = d.getMonth() + 1;
  115 + var day = d.getDate();
  116 + if(month < 10)
  117 + month = "0" + month;
  118 + if(day < 10)
  119 + day = "0" + day;
  120 + var dateTime = year + "-" + month + "-" + day;
  121 + $("#startDate,#endDate").datetimepicker({
  122 + format : 'YYYY-MM-DD',
  123 + locale : 'zh-cn',
  124 + maxDate : dateTime
  125 + });
  126 + $("#startDate,#endDate").val(year + "-" + month + "-" + day);
  127 +
  128 + var fage=false;
  129 + var obj = [];
  130 + var xlList;
  131 + $.get('/report/lineList',function(result){
  132 + xlList=result;
  133 + $.get('/user/companyData', function(result){
  134 + obj = result;
  135 + var options = '';
  136 + for(var i = 0; i < obj.length; i++){
  137 + options += '<option value="'+obj[i].companyCode+'">'+obj[i].companyName+'</option>';
  138 + }
  139 +
  140 + if(obj.length ==0){
  141 + $("#gsdmDiv_manth").css('display','none');
  142 + $('#fgsdmDiv_manth').css('display','none');
  143 + }else if(obj.length ==1){
  144 + $("#gsdmDiv_manth").css('display','none');
  145 + if(obj[0].children.length == 1 || obj[0].children.length ==0)
  146 + $('#fgsdmDiv_manth').css('display','none');
  147 + }
  148 + $('#gsdmManth').html(options);
  149 + updateCompany();
  150 + });
  151 + })
  152 + $("#gsdmManth").on("change",updateCompany);
  153 + function updateCompany(){
  154 + var company = $('#gsdmManth').val();
  155 + var options = '<option value="">全部分公司</option>';
  156 + for(var i = 0; i < obj.length; i++){
  157 + if(obj[i].companyCode == company){
  158 + var children = obj[i].children;
  159 + for(var j = 0; j < children.length; j++){
  160 + options += '<option value="'+children[j].code+'">'+children[j].name+'</option>';
  161 + }
  162 + }
  163 + }
  164 + $('#fgsdmManth').html(options);
  165 + }
  166 +
  167 +
  168 + var tempData = {};
  169 + $.get('/report/lineList',function(xlList){
  170 + var data = [];
  171 + data.push({id: " ", text: "全部线路"});
  172 + $.get('/user/companyData', function(result){
  173 + for(var i = 0; i < result.length; i++){
  174 + var companyCode = result[i].companyCode;
  175 + var children = result[i].children;
  176 + for(var j = 0; j < children.length; j++){
  177 + var code = children[j].code;
  178 + for(var k=0;k < xlList.length;k++ ){
  179 + if(xlList[k]["fgsbm"]==code && xlList[k]["gsbm"]==companyCode){
  180 + data.push({id: xlList[k]["xlbm"], text: xlList[k]["xlname"]});
  181 + tempData[xlList[k]["xlbm"]] = companyCode+":"+code;
  182 + }
  183 + }
  184 + }
  185 + }
  186 + initPinYinSelect2('#line',data,'');
  187 +
  188 + });
  189 + });
  190 +
  191 + $("#line").on("change", function(){
  192 + if($("#line").val() == " "){
  193 + $("#gsdmManth").attr("disabled", false);
  194 + $("#fgsdmManth").attr("disabled", false);
  195 + } else {
  196 + var temp = tempData[$("#line").val()].split(":");
  197 + $("#gsdmManth").val(temp[0]);
  198 + updateCompany();
  199 + $("#fgsdmManth").val(temp[1]);
  200 + $("#gsdmManth").attr("disabled", true);
  201 +// $("#fgsdmManth").attr("disabled", true);
  202 + }
  203 + });
  204 +
  205 + var cont = "驾驶员", cont1 = "", cont2 = "", cont3 = "";
  206 + $("#empnames").on("change",function(){
  207 + if(cont == "驾驶员"){
  208 + cont1 = $("#cont").val();
  209 + } else if(cont == "售票员"){
  210 + cont2 = $("#cont").val();
  211 + } else if(cont == "车辆自编号"){
  212 + cont3 = $("#cont").val();
  213 + }
  214 + cont = $("#empnames").val();
  215 + if($("#empnames").val() == "驾驶员"){
  216 + $("#cont").val(cont1);
  217 + } else if($("#empnames").val() == "售票员"){
  218 + $("#cont").val(cont2);
  219 + } else if($("#empnames").val() == "车辆自编号"){
  220 + $("#cont").val(cont3);
  221 + }
  222 + });
  223 +
  224 + $("#query").on("click",function(){
  225 + if($("#startDate").val() == null || $("#startDate").val().trim().length == 0){
  226 + layer.msg("请选择时间范围!");
  227 + return;
  228 + }
  229 + if($("#endDate").val() == null || $("#endDate").val().trim().length == 0){
  230 + layer.msg("请选择时间范围!");
  231 + return;
  232 + }
  233 + $("#empname").html($("#empnames").val())
  234 + var params={};
  235 + params.empnames=$("#empnames").val();
  236 + params.cont = $("#cont").val();
  237 + params.line = $("#line").val();
  238 + params.startDate = $("#startDate").val();
  239 + params.endDate = $("#endDate").val();
  240 + params.lpName = $("#lpName").val();
  241 + params.gsdmManth= $("#gsdmManth").val();
  242 + params.fgsdmManth= $("#fgsdmManth").val();
  243 + var i = layer.load(2);
  244 + $get("/calc_mix/calcjsyspy",params,function(result){
  245 +
  246 + var list_calcjsyspy = template('list_calcjsyspy',{list:result});
  247 + // 把渲染好的模版html文本追加到表格中
  248 + $('#forms tbody').html(list_calcjsyspy);
  249 + layer.close(i);
  250 +
  251 + });
  252 + });
  253 +
  254 + $("#export").on("click",function(){
  255 + var lineName = $('#line option:selected').text();
  256 + var startDate = $("#startDate").val();
  257 + var endDate = $("#endDate").val();
  258 + var params={};
  259 + params.empnames=$("#empnames").val();
  260 + params.cont = $("#cont").val();
  261 + params.line = $("#line").val();
  262 + params.startDate = $("#startDate").val();
  263 + params.endDate = $("#endDate").val();
  264 + params.lpName = $("#lpName").val();
  265 + params.gsdmManth= $("#gsdmManth").val();
  266 + params.fgsdmManth= $("#fgsdmManth").val();
  267 + params.lineName = lineName;
  268 + params.type='export';
  269 + var i = layer.load(2);
  270 + $get('/calc_export/waybilldayExport',params,function(result){
  271 + var dateTime = "";
  272 + if(startDate == endDate){
  273 + dateTime = moment(startDate).format("YYYYMMDD");
  274 + } else {
  275 + dateTime = moment(startDate).format("YYYYMMDD")
  276 + +"-"+moment(endDate).format("YYYYMMDD");
  277 + }
  278 + window.open("/downloadFile/download?fileName="
  279 + +dateTime+"-"+lineName+"-人车班次公里统计");
  280 + layer.close(i);
  281 + });
  282 + });
  283 +
  284 + });
  285 +
  286 +
  287 +</script>
  288 +<script type="text/html" id="list_calcjsyspy">
  289 + {{each list as obj i}}
  290 + <tr>
  291 + <td>{{i+1}}</td>
  292 + <td>{{obj.jName}}</td>
  293 + <td>{{obj.jhyybc}}</td>
  294 + <td>{{obj.sjyybc}}</td>
  295 + <td>{{obj.lbbc}}</td>
  296 + <td>{{obj.ljbc}}</td>
  297 + <td>{{obj.jhzlc}}</td>
  298 + <td>{{obj.jhyylc}}</td>
  299 + <td>{{obj.jhfyylc}}</td>
  300 + <td>{{obj.sjzlc}}</td>
  301 + <td>{{obj.sjyylc}}</td>
  302 + <td>{{obj.sjfyylc}}</td>
  303 + <td>{{obj.lblc}}</td>
  304 + <td>{{obj.ljyylc}}</td>
  305 + <td>{{obj.ljfyylc}}</td>
  306 + </tr>
  307 + {{/each}}
  308 + {{if list.length == 0}}
  309 + <tr>
  310 + <td colspan="10"><h6 class="muted">没有找到相关数据</h6></td>
  311 + </tr>
  312 + {{/if}}
  313 +</script>
0 314 \ No newline at end of file
... ...
src/main/resources/static/pages/forms/calc/calcsingledata.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 + text-align: center; }
  15 +
  16 + .table > tbody + tbody {
  17 + border-top: 1px solid; }
  18 +</style>
  19 +
  20 +<div class="page-head">
  21 + <div class="page-title">
  22 + <h1>路单数据(统计)</h1>
  23 + </div>
  24 +</div>
  25 +
  26 +<div class="row">
  27 + <div class="col-md-12">
  28 + <div class="portlet light porttlet-fit bordered">
  29 + <div class="portlet-title">
  30 + <form class="form-inline" action="">
  31 + <div style="display: inline-block; margin-left: 31px;" id="gsdmDiv_sing">
  32 + <span class="item-label" style="width: 80px;">公司: </span>
  33 + <select class="form-control" name="company" id="gsdmSing" style="width: 140px;"></select>
  34 + </div>
  35 + <div style="display: inline-block; margin-left: 22px;" id="fgsdmDiv_sing">
  36 + <span class="item-label" style="width: 80px;">分公司: </span>
  37 + <select class="form-control" name="subCompany" id="fgsdmSing" style="width: 140px;"></select>
  38 + </div>
  39 + <div style="display: inline-block; margin-left: 31px;">
  40 + <span class="item-label" style="width: 80px;">线路: </span>
  41 + <select class="form-control" name="line" id="line" style="width: 140px;"></select>
  42 + </div>
  43 + <div style="margin-top: 10px"></div>
  44 + <div style="display: inline-block;margin-left: 3px;">
  45 + <span class="item-label" style="width: 140px;">开始时间: </span>
  46 + <input class="form-control" type="text" id="startDate" style="width: 140px;"/>
  47 + </div>
  48 + <div style="display: inline-block;margin-left: 8px;">
  49 + <span class="item-label" style="width: 140px;">结束时间: </span>
  50 + <input class="form-control" type="text" id="endDate" style="width: 140px;"/>
  51 + </div>
  52 + <div style="display: inline-block;margin-left: 31px">
  53 + <span class="item-label" style="width: 150px;">统计: </span>
  54 + <select class="form-control" name="tjtype" id="tjtype" style="width: 140px;">
  55 + <option value="驾驶员">驾驶员</option>
  56 + <option value="售票员">售票员</option>
  57 + <option value="车辆自编号">车辆自编号</option>
  58 + </select>
  59 + <div style="display: inline-block;margin-left: 0px">
  60 + <span class="item-label" style="width: 150px;">:</span>
  61 + <input class="form-control" name="cont" id="cont" style="width: 136px;"></input>
  62 + </div>
  63 + </div>
  64 + <div class="form-group">
  65 + <input class="btn btn-default" type="button" id="query" value="筛选"/>
  66 + <input class="btn btn-default" type="button" id="export" value="导出"/>
  67 + </div>
  68 + </form>
  69 + </div>
  70 + <div class="portlet-body">
  71 + <div class="table-container" style="margin-top: 10px;overflow:auto;min-width: 906px">
  72 + <table class="table table-bordered table-hover table-checkable" id="forms">
  73 + <thead>
  74 + <tr>
  75 + <th>序号</th>
  76 + <th>所属公司</th>
  77 + <th>线路</th>
  78 + <th id='empname'>驾驶员</th>
  79 + <th>行驶里程(包括空放)</th>
  80 + <th>空驶里程</th>
  81 + <th>耗油量</th>
  82 + <th>加注量</th>
  83 + <th>非营业用油</th>
  84 + <th>计划公里</th>
  85 + </tr>
  86 + </thead>
  87 + <tbody>
  88 +
  89 + </tbody>
  90 + </table>
  91 + </div>
  92 + </div>
  93 + </div>
  94 + </div>
  95 +</div>
  96 +
  97 +<script>
  98 + $(function(){
  99 + // 关闭左侧栏
  100 + if (!$('body').hasClass('page-sidebar-closed'))
  101 + $('.menu-toggler.sidebar-toggler').click();
  102 +
  103 + $("#startDate,#endDate").datetimepicker({
  104 + format : 'YYYY-MM-DD',
  105 + locale : 'zh-cn'
  106 + });
  107 +
  108 + var d = new Date();
  109 + var year = d.getFullYear();
  110 + var month = d.getMonth() + 1;
  111 + var day = d.getDate();
  112 + if(month < 10)
  113 + month = "0" + month;
  114 + if(day < 10)
  115 + day = "0" + day;
  116 + $("#startDate,#endDate").val(year + "-" + month + "-" + day);
  117 +
  118 + var fage=false;
  119 + var xlList;
  120 + var obj = [];
  121 +
  122 + $.get('/report/lineList',function(result){
  123 + xlList=result;
  124 + $.get('/user/companyData', function(result){
  125 + obj = result;
  126 + var options = '';
  127 + for(var i = 0; i < obj.length; i++){
  128 + options += '<option value="'+obj[i].companyCode+'">'+obj[i].companyName+'</option>';
  129 + }
  130 +
  131 + if(obj.length ==0){
  132 + $("#gsdmDiv_sing").css('display','none');
  133 + }else if(obj.length ==1){
  134 + $("#gsdmDiv_sing").css('display','none');
  135 + if(obj[0].children.length == 1 || obj[0].children.length ==0)
  136 + $('#fgsdmDiv_sing').css('display','none');
  137 + }
  138 + $('#gsdmSing').html(options);
  139 + updateCompany();
  140 + });
  141 + })
  142 + $("#gsdmSing").on("change",updateCompany);
  143 + function updateCompany(){
  144 + var company = $('#gsdmSing').val();
  145 +// var options = '<option value="">全部分公司</option>';
  146 + var options ='';
  147 + for(var i = 0; i < obj.length; i++){
  148 + if(obj[i].companyCode == company){
  149 + var children = obj[i].children;
  150 + for(var j = 0; j < children.length; j++){
  151 + options += '<option value="'+children[j].code+'">'+children[j].name+'</option>';
  152 + }
  153 + }
  154 + }
  155 + $('#fgsdmSing').html(options);
  156 + }
  157 +
  158 + var tempData = {};
  159 + $.get('/report/lineList',function(xlList){
  160 + var data = [];
  161 + data.push({id: " ", text: "全部线路"});
  162 + $.get('/user/companyData', function(result){
  163 + for(var i = 0; i < result.length; i++){
  164 + var companyCode = result[i].companyCode;
  165 + var children = result[i].children;
  166 + for(var j = 0; j < children.length; j++){
  167 + var code = children[j].code;
  168 + for(var k=0;k < xlList.length;k++ ){
  169 + if(xlList[k]["fgsbm"]==code && xlList[k]["gsbm"]==companyCode){
  170 + data.push({id: xlList[k]["xlbm"], text: xlList[k]["xlname"]});
  171 + tempData[xlList[k]["xlbm"]] = companyCode+":"+code;
  172 + }
  173 + }
  174 + }
  175 + }
  176 + initPinYinSelect2('#line',data,'');
  177 +
  178 + });
  179 + });
  180 +
  181 + $("#line").on("change", function(){
  182 + if($("#line").val() == " "){
  183 + $("#gsdmSing").attr("disabled", false);
  184 + $("#fgsdmSing").attr("disabled", false);
  185 + } else {
  186 + var temp = tempData[$("#line").val()].split(":");
  187 + $("#gsdmSing").val(temp[0]);
  188 + updateCompany();
  189 +// $("#fgsdmSing").val(temp[1]);
  190 + $("#fgsdmSing").val("");
  191 + $("#gsdmSing").attr("disabled", true);
  192 +// $("#fgsdmSing").attr("disabled", true);
  193 + }
  194 + });
  195 +
  196 + var cont = "驾驶员", cont1 = "", cont2 = "", cont3 = "";
  197 + $("#tjtype").on("change",function(){
  198 + if(cont == "驾驶员"){
  199 + cont1 = $("#cont").val();
  200 + } else if(cont == "售票员"){
  201 + cont2 = $("#cont").val();
  202 + } else if(cont == "车辆自编号"){
  203 + cont3 = $("#cont").val();
  204 + }
  205 + cont = $("#tjtype").val();
  206 + if($("#tjtype").val() == "驾驶员"){
  207 + $("#cont").val(cont1);
  208 + } else if($("#tjtype").val() == "售票员"){
  209 + $("#cont").val(cont2);
  210 + } else if($("#tjtype").val() == "车辆自编号"){
  211 + $("#cont").val(cont3);
  212 + }
  213 + });
  214 +
  215 + $("#query").on("click",function(){
  216 + if($("#startDate").val() == null || $("#startDate").val().trim().length == 0){
  217 + layer.msg("请选择时间!");
  218 + return;
  219 + }
  220 + if($("#endDate").val() == null || $("#endDate").val().trim().length == 0){
  221 + layer.msg("请选择时间!");
  222 + return;
  223 + }
  224 + $("#empname").html($("#tjtype").val());
  225 + var line = $("#line").val();
  226 + var startDate = $("#startDate").val();
  227 + var endDate = $("#endDate").val();
  228 + var gsdmSing = $("#gsdmSing").val();
  229 + var fgsdmSing = $("#fgsdmSing").val();
  230 + var tjtype=$("#tjtype").val();
  231 + var cont=$("#cont").val();
  232 + var params = {};
  233 + var i = layer.load(2);
  234 + $get("/calc_mix/singledatatj",{gsdmSing:gsdmSing,fgsdmSing:fgsdmSing,line:line,startDate:startDate,endDate:endDate,tjtype:tjtype,cont:cont},function(result){
  235 + layer.close(i);
  236 + var singledata = template('singledata',{list:result});
  237 + // 把渲染好的模版html文本追加到表格中
  238 + $('#forms tbody').html(singledata);
  239 + });
  240 + });
  241 +
  242 + $("#export").on("click",function(){
  243 + var line = $("#line").val();
  244 + var startDate = $("#startDate").val();
  245 + var endDate = $("#endDate").val();
  246 + var gsdmSing = $("#gsdmSing").val();
  247 + var fgsdmSing = $("#fgsdmSing").val();
  248 + var tjtype=$("#tjtype").val();
  249 + var cont=$("#cont").val();
  250 + var lineName = $('#line option:selected').text();
  251 + if(lineName == "全部线路")
  252 + lineName = $('#fgsdmSing option:selected').text();
  253 + var i = layer.load(2);
  254 + $get('/calc_export/singledataExportTj',{gsdmSing:gsdmSing,fgsdmSing:fgsdmSing,line:line,startDate:startDate,endDate:endDate,tjtype:tjtype,cont:cont,type:'export',lineName:lineName},function(result){
  255 + var dateTime = "";
  256 + if(startDate == endDate){
  257 + dateTime = moment(startDate).format("YYYYMMDD");
  258 + } else {
  259 + dateTime = moment(startDate).format("YYYYMMDD")
  260 + +"-"+moment(endDate).format("YYYYMMDD");
  261 + }
  262 + window.open("/downloadFile/download?fileName="
  263 + +dateTime+"-"+lineName+"-路单数据(统计)");
  264 + layer.close(i);
  265 + });
  266 + });
  267 + });
  268 +
  269 +</script>
  270 +<script type="text/html" id="singledata">
  271 + {{each list as obj i}}
  272 + <tr>
  273 + <td>{{i+1}}</td>
  274 + <td>{{obj.gS}}</td>
  275 + <td>{{obj.xlName}}</td>
  276 + <td>{{obj.jName}}</td>
  277 + <td>{{obj.sjzlc}}</td>
  278 + <td>{{obj.sjfyylc}}</td>
  279 + <td>{{obj.hyl}}</td>
  280 + <td>{{obj.jzl}}</td>
  281 + <td>{{obj.sh}}</td>
  282 + <td>{{obj.jhzlc}}</td>
  283 + </tr>
  284 + {{/each}}
  285 + {{if list.length == 0}}
  286 + <tr>
  287 + <td colspan="16"><h6 class="muted">没有找到相关数据</h6></td>
  288 + </tr>
  289 + {{/if}}
  290 +</script>
... ...
src/main/resources/static/pages/forms/mould/calcjsyspy.xls 0 → 100644
No preview for this file type
src/main/resources/static/pages/forms/mould/calcsingledata.xls 0 → 100644
No preview for this file type