Commit abb80d72be6d60d8df72e983957e2ba00a42fa0b

Authored by yiming
1 parent 7f44aa98

路线月报台账、线路月报同比

Showing 56 changed files with 8529 additions and 126 deletions
src/main/java/com/bsth/controller/oil/JqlController.java 0 → 100644
  1 +package com.bsth.controller.oil;
  2 +
  3 +import java.io.File;
  4 +import java.util.HashMap;
  5 +import java.util.Map;
  6 +
  7 +import org.springframework.beans.factory.annotation.Autowired;
  8 +import org.springframework.web.bind.annotation.RequestMapping;
  9 +import org.springframework.web.bind.annotation.RequestMethod;
  10 +import org.springframework.web.bind.annotation.RequestParam;
  11 +import org.springframework.web.bind.annotation.RestController;
  12 +import org.springframework.web.multipart.MultipartFile;
  13 +
  14 +import com.bsth.controller.BaseController;
  15 +import com.bsth.entity.oil.Jql;
  16 +import com.bsth.service.oil.JqlService;
  17 +import com.google.common.io.Files;
  18 +
  19 +@RestController
  20 +@RequestMapping("jql")
  21 +public class JqlController extends BaseController<Jql, Integer> {
  22 +
  23 + @Autowired
  24 + JqlService jqlService;
  25 +
  26 + public String getDataImportClasspath(){
  27 + return this.getClass().getResource("/").getPath() + "/static/pages/hydrogen/jql";
  28 + }
  29 +
  30 + @RequestMapping(value = "/uploadFile",method = RequestMethod.POST)
  31 + public String uploadFile(MultipartFile file, String gsbm_, String gsName,
  32 + String fgsbm_, String fgsName) throws Exception{
  33 + Map<String, Object> map = new HashMap<String, Object>();
  34 + File newFile = new File(
  35 + getDataImportClasspath() + File.separator +
  36 + file.getOriginalFilename());
  37 + Files.write(file.getBytes(), newFile);
  38 + String result = jqlService.importExcel(newFile, gsbm_, gsName, fgsbm_, fgsName);
  39 + return "{\"result\":" + "\""+result+"\"}";
  40 + }
  41 +
  42 + @RequestMapping(value = "/query",method = RequestMethod.GET)
  43 + public Map<String, Object> query(@RequestParam Map<String, Object> map) throws Exception{
  44 + return jqlService.query(map);
  45 + }
  46 +
  47 +}
src/main/java/com/bsth/controller/oil/QlbController.java 0 → 100644
  1 +package com.bsth.controller.oil;
  2 +
  3 +import java.text.SimpleDateFormat;
  4 +import java.util.ArrayList;
  5 +import java.util.Date;
  6 +import java.util.HashMap;
  7 +import java.util.Iterator;
  8 +import java.util.List;
  9 +import java.util.Map;
  10 +
  11 +import org.springframework.beans.factory.annotation.Autowired;
  12 +import org.springframework.data.domain.Page;
  13 +import org.springframework.data.domain.PageRequest;
  14 +import org.springframework.data.domain.Sort;
  15 +import org.springframework.data.domain.Sort.Direction;
  16 +import org.springframework.web.bind.annotation.RequestMapping;
  17 +import org.springframework.web.bind.annotation.RequestMethod;
  18 +import org.springframework.web.bind.annotation.RequestParam;
  19 +import org.springframework.web.bind.annotation.RestController;
  20 +import com.bsth.controller.BaseController;
  21 +import com.bsth.entity.oil.Qlb;
  22 +import com.bsth.service.oil.QlbService;
  23 +import com.bsth.util.Arith;
  24 +import com.bsth.util.ReportUtils;
  25 +import com.google.common.base.Splitter;
  26 +
  27 +@RestController
  28 +@RequestMapping("qlb")
  29 +public class QlbController extends BaseController<Qlb, Integer>{
  30 + @Autowired
  31 + QlbService service;
  32 + /**
  33 + *
  34 + * @Title: list
  35 + * @Description: TODO(多条件分页查询)
  36 + * @param @param map 查询条件
  37 + * @param @param page 页码
  38 + * @param @param size 每页显示数量
  39 + * @throws
  40 + */
  41 + @RequestMapping(method = RequestMethod.GET)
  42 + public Page<Qlb> list(@RequestParam Map<String, Object> map,
  43 + @RequestParam(defaultValue = "0") int page,
  44 + @RequestParam(defaultValue = "10") int size,
  45 + @RequestParam(defaultValue = "id") String order,
  46 + @RequestParam(defaultValue = "DESC") String direction){
  47 +
  48 + Direction d;
  49 +// map.put("xlbm_like", map.get("xlbm_like").toString().trim());
  50 +// try {
  51 + String rq=map.get("rq").toString();
  52 + if(!(rq=="")){
  53 +//
  54 +// SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd");
  55 +// Calendar calendar = new GregorianCalendar();
  56 +// calendar.setTime(sdf.parse(rq));
  57 +// calendar.add(calendar.DATE,1);
  58 +// Date date=calendar.getTime();
  59 + map.put("rq_eq", rq);
  60 +// map.put("rq_lt", sdf.format(date));
  61 +// System.out.println(rq);
  62 +// System.out.println(sdf.format(date));
  63 + }
  64 +// } catch (ParseException e) {
  65 +// // TODO Auto-generated catch block
  66 +// e.printStackTrace();
  67 +// }
  68 + if(null != direction && direction.equals("ASC"))
  69 + d = Direction.ASC;
  70 + else
  71 + d = Direction.DESC;
  72 +
  73 + // 允许多个字段排序,order可以写单个字段,也可以写多个字段
  74 + // 多个字段格式:{col1},{col2},{col3},....,{coln}
  75 + // 每个字段的排序方向都是一致,这个以后再看要不要改
  76 + List<String> list = Splitter.on(",").trimResults().splitToList(order);
  77 + return baseService.list(map, new PageRequest(page, size, new Sort(d, list)));
  78 + }
  79 + @RequestMapping(value = "/qlbList",method = RequestMethod.GET)
  80 + public List<Qlb> qlbList(@RequestParam Map<String, Object> map){
  81 + List<Qlb> list=service.listQlb(map);
  82 + return list;
  83 + }
  84 +
  85 +
  86 +
  87 + @RequestMapping(value = "/obtain",method = RequestMethod.GET)
  88 + public Map<String, Object> obtain(@RequestParam Map<String, Object> map) throws Exception{
  89 + Map<String, Object> list=new HashMap<String, Object>();
  90 + try {
  91 + list = service.obtain(map);
  92 + } catch (Exception e) {
  93 + // TODO Auto-generated catch block
  94 + throw e;
  95 + }
  96 + return list;
  97 + }
  98 +
  99 + /**
  100 + * 保存氢量
  101 + * @param map
  102 + * @return
  103 + */
  104 + @RequestMapping(value = "/sort",method = RequestMethod.GET)
  105 + public Map<String, Object> sort(@RequestParam Map<String, Object> map){
  106 + Map<String, Object> list=service.sort(map);
  107 + return list;
  108 + }
  109 +
  110 + /**
  111 + * 核对氢量(有加氢没里程)
  112 + * @param map
  113 + * @return
  114 + */
  115 + @RequestMapping(value = "/checkQl",method = RequestMethod.GET)
  116 + public Map<String, Object> checkQl(@RequestParam Map<String, Object> map){
  117 + Map<String, Object> list=service.checkQl(map);
  118 + return list;
  119 + }
  120 +
  121 + @RequestMapping(value = "/sumQlb",method = RequestMethod.GET)
  122 + public Map<String, Object> sumQlb(@RequestParam Map<String, Object> map){
  123 + Map<String, Object> list=service.sumQlb(map);
  124 + return list;
  125 + }
  126 +
  127 + @RequestMapping(value = "/saveQlbList",method = RequestMethod.POST)
  128 + public Map<String, Object> saveQlbList(@RequestParam Map<String, Object> map){
  129 + Map<String, Object> list=new HashMap<String, Object>();
  130 + try {
  131 + list = service.saveQlbList(map);
  132 + } catch (Exception e) {
  133 + // TODO Auto-generated catch block
  134 + e.printStackTrace();
  135 + }
  136 + return list;
  137 + }
  138 +
  139 +
  140 + @RequestMapping(value = "/listExport",method = RequestMethod.POST)
  141 + public List<Map<String, Object>> listExport(@RequestParam Map<String, Object> map){
  142 + SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"),
  143 + sdfSimple = new SimpleDateFormat("yyyyMMdd");
  144 + List<Iterator<?>> listI = new ArrayList<Iterator<?>>();
  145 + ReportUtils ee = new ReportUtils();
  146 + List<Qlb> qlb = service.listQlb(map);
  147 +// (new CustomerSpecs<Ylb>(map)).iterator();
  148 + List<Map<String, Object>> resList = new ArrayList<Map<String, Object>>();
  149 + for (Qlb y : qlb) {
  150 + Map<String, Object> m = new HashMap<String, Object>();
  151 + m.put("rq", y.getRq());
  152 + m.put("gsname",y.getGsname() );
  153 + m.put("fgsname", y.getFgsname());
  154 + if(y.getLinename()==null){
  155 + m.put("xlname", y.getXlname()==null?"":y.getXlname());
  156 + }else{
  157 + m.put("xlname", y.getLinename());
  158 + }
  159 + m.put("nbbm", y.getNbbm());
  160 + m.put("jsy", y.getJsy());
  161 + m.put("name", y.getName());
  162 + m.put("jql", y.getJql()<=0?"0":y.getJql());
  163 + m.put("czcl", y.getCzcl()<=0?"0":y.getCzcl()+"%");
  164 + m.put("jzcl", y.getJzcl()<=0?"0":y.getJzcl()+"%");
  165 + m.put("czlc", y.getCzlc()<=0?"0":y.getCzlc());
  166 + m.put("jzlc", y.getJzlc()<=0?"0":y.getJzlc());
  167 + m.put("hn", y.getHn()<=0?"0":y.getHn());
  168 + String shyy ="无";
  169 + if(y.getShyy()!=null){
  170 + shyy=y.getShyy();
  171 + if(shyy.equals("1")){shyy="票务用";}
  172 + else if(shyy.equals("2")){shyy="保养用";}
  173 + else if(shyy.equals("3")){shyy="报废车用";}
  174 + else if(shyy.equals("4")){shyy="其它用";}
  175 + else if(shyy.equals("5")){shyy="人保部";}
  176 + else if(shyy.equals("6")){shyy="车队";}
  177 + else if(shyy.equals("7")){shyy="车间(高保)";}
  178 + else if(shyy.equals("8")){shyy="车间(小修)";}
  179 + else{shyy ="无";}
  180 + }
  181 + m.put("ns", y.getNs()<=0?"0":y.getNs());
  182 + m.put("shyy", shyy);
  183 + m.put("sh", y.getSh()<=0?"0":y.getSh());
  184 + m.put("zlc", y.getZlc()<=0?"0":y.getZlc());
  185 + m.put("rdlx", "");
  186 + m.put("bglnh", y.getBglhn());
  187 + m.put("znh", Arith.add(y.getSh(), y.getHn()));
  188 + resList.add(m);
  189 + }
  190 + try {
  191 + map.put("sheetName", map.get("rq"));
  192 + listI.add(resList.iterator());
  193 + String path = this.getClass().getResource("/").getPath()+"static/pages/forms/";
  194 + ee.excelReplace(listI, new Object[] { map }, path+"mould/listQl.xls",
  195 + path+"export/"+map.get("rq").toString()+ "进出场存氢量.xls");
  196 + } catch (Exception e) {
  197 + e.printStackTrace();
  198 + }
  199 +
  200 + return resList;
  201 +
  202 + }
  203 +
  204 +
  205 + @RequestMapping(value = "/checkJsy",method = RequestMethod.GET)
  206 + public String checkJsy(@RequestParam Map<String, Object> map){
  207 + String list=service.checkJsy(map);
  208 + return list;
  209 + }
  210 +
  211 + @RequestMapping(value = "/deleteIds", method = RequestMethod.POST)
  212 + public Map<String, Object> deleteIds(@RequestParam Map<String, Object> map) {
  213 + Map<String, Object> maps=new HashMap<String, Object>();
  214 + try {
  215 + maps= service.deleteIds(map);
  216 + } catch (Exception e) {
  217 + // TODO Auto-generated catch block
  218 + e.printStackTrace();
  219 + }
  220 + return maps;
  221 + }
  222 +
  223 + @RequestMapping(value = "/saveQlb",method = RequestMethod.POST)
  224 + public Map<String, Object> saveQlb(Qlb t){
  225 +// SysUser user = SecurityUtils.getCurrentUser();
  226 + t.setCreatetime(new Date());
  227 +// Ylb t=new Ylb();
  228 + return service.saveQlb(t);
  229 + }
  230 +
  231 + @RequestMapping(value = "/updateJsy",method = RequestMethod.GET)
  232 + public Map<String, Object> updateJsy(@RequestParam Map<String, Object> map){
  233 + return service.update(map);
  234 + }
  235 +}
src/main/java/com/bsth/controller/oil/YlxxbController.java
1 package com.bsth.controller.oil; 1 package com.bsth.controller.oil;
2 2
  3 +import java.io.File;
3 import java.util.HashMap; 4 import java.util.HashMap;
4 import java.util.List; 5 import java.util.List;
5 import java.util.Map; 6 import java.util.Map;
6 7
  8 +import com.google.common.io.Files;
7 import org.springframework.beans.factory.annotation.Autowired; 9 import org.springframework.beans.factory.annotation.Autowired;
8 import org.springframework.web.bind.annotation.RequestMapping; 10 import org.springframework.web.bind.annotation.RequestMapping;
9 import org.springframework.web.bind.annotation.RequestMethod; 11 import org.springframework.web.bind.annotation.RequestMethod;
@@ -14,6 +16,7 @@ import com.bsth.controller.BaseController; @@ -14,6 +16,7 @@ import com.bsth.controller.BaseController;
14 import com.bsth.entity.oil.Ylxxb; 16 import com.bsth.entity.oil.Ylxxb;
15 import com.bsth.service.oil.YlxxbService; 17 import com.bsth.service.oil.YlxxbService;
16 import com.bsth.util.PageObject; 18 import com.bsth.util.PageObject;
  19 +import org.springframework.web.multipart.MultipartFile;
17 20
18 @RestController 21 @RestController
19 @RequestMapping("ylxxb") 22 @RequestMapping("ylxxb")
@@ -76,5 +79,24 @@ public class YlxxbController extends BaseController&lt;Ylxxb, Integer&gt;{ @@ -76,5 +79,24 @@ public class YlxxbController extends BaseController&lt;Ylxxb, Integer&gt;{
76 } 79 }
77 return maps; 80 return maps;
78 } 81 }
79 - 82 +
  83 +
  84 + public String getDataImportClasspath(){
  85 + return this.getClass().getResource("/").getPath() + "/static/pages/oil";
  86 + }
  87 +
  88 + @RequestMapping(value = "/uploadFile",method = RequestMethod.POST)
  89 + public String uploadFile(MultipartFile file) throws Exception{
  90 + File newFile = new File(
  91 + getDataImportClasspath() + File.separator +
  92 + file.getOriginalFilename());
  93 + Files.write(file.getBytes(), newFile);
  94 + String result = service.importExcel(newFile);
  95 + return "{\"result\":" + "\""+result+"\"}";
  96 + }
  97 +
  98 + @RequestMapping(value = "/query",method = RequestMethod.GET)
  99 + public Map<String, Object> query(@RequestParam Map<String, Object> map) throws Exception{
  100 + return service.query(map);
  101 + }
80 } 102 }
src/main/java/com/bsth/controller/report/XlybtbController.java 0 → 100644
  1 +package com.bsth.controller.report;
  2 +
  3 +
  4 +import com.bsth.service.report.XlybtbService;
  5 +import org.springframework.beans.factory.annotation.Autowired;
  6 +import org.springframework.web.bind.annotation.RequestMapping;
  7 +import org.springframework.web.bind.annotation.RequestMethod;
  8 +import org.springframework.web.bind.annotation.RequestParam;
  9 +import org.springframework.web.bind.annotation.RestController;
  10 +import java.util.Map;
  11 +
  12 +@RestController
  13 +@RequestMapping("xlybtb")
  14 +public class XlybtbController {
  15 +
  16 + @Autowired
  17 + XlybtbService xlybtbService;
  18 + @RequestMapping(value = "/query",method = RequestMethod.GET)
  19 + public Map<String, Object> query(@RequestParam Map<String, Object> map) throws Exception{
  20 + Map<String, Object> m= xlybtbService.query(map);
  21 + return m;
  22 + }
  23 +
  24 +}
src/main/java/com/bsth/controller/report/XlybtzController.java 0 → 100644
  1 +package com.bsth.controller.report;
  2 +
  3 +
  4 +import com.bsth.service.report.XlybtzService;
  5 +import com.google.common.io.Files;
  6 +import org.springframework.beans.factory.annotation.Autowired;
  7 +import org.springframework.web.bind.annotation.*;
  8 +import org.springframework.web.multipart.MultipartFile;
  9 +import java.io.*;
  10 +import java.util.*;
  11 +
  12 +@RestController
  13 +@RequestMapping("xlybtz")
  14 +public class XlybtzController {
  15 +
  16 + @Autowired
  17 + XlybtzService xlybtzService;
  18 +
  19 + public String getDataImportClasspath(){
  20 + return this.getClass().getResource("/").getPath() + "/static/pages/electricity/jdl";
  21 + }
  22 + @RequestMapping(value = "/uploadFile",method = RequestMethod.POST)
  23 + public String uploadFile(MultipartFile file,@RequestParam int reportType,@RequestParam String date) throws Exception{
  24 + File newFile = new File(getDataImportClasspath() + File.separator + file.getOriginalFilename());
  25 + Files.write(file.getBytes(), newFile);
  26 + String type=null;
  27 + String result=null;
  28 + if(reportType==1){
  29 + type="票务";
  30 + result = xlybtzService.imporPWExcel(newFile,date);
  31 + }else if(reportType==2){
  32 + type="二维码";
  33 + result = xlybtzService.importQRCordExcel(newFile,date);
  34 + }
  35 + else if(reportType==3){
  36 + type="申城通";
  37 + result = xlybtzService.importCardExcel(newFile,date,type);
  38 + }
  39 + else if(reportType==4){
  40 + type="实体卡";
  41 + result = xlybtzService.importCardExcel(newFile,date,type);
  42 + }
  43 + else if(reportType==5){
  44 + type="保通卡";
  45 + result = xlybtzService.importCardExcel(newFile,date,type);
  46 + }
  47 + else{
  48 + result="请选择导入类型";
  49 + }
  50 +
  51 + return "{\"result\":" + "\""+result+"\"}";
  52 + }
  53 +
  54 + @RequestMapping(value = "/query",method = RequestMethod.GET)
  55 + public Map<String, Object> query(@RequestParam Map<String, Object> map) throws Exception{
  56 + Map<String, Object> m= xlybtzService.query(map);
  57 + return m;
  58 + }
  59 +
  60 +}
src/main/java/com/bsth/data/BasicData.java
@@ -3,9 +3,11 @@ package com.bsth.data; @@ -3,9 +3,11 @@ package com.bsth.data;
3 import com.bsth.data.gpsdata_v2.cache.GeoCacheData; 3 import com.bsth.data.gpsdata_v2.cache.GeoCacheData;
4 import com.bsth.data.pinyin.PersionPinYinBuffer; 4 import com.bsth.data.pinyin.PersionPinYinBuffer;
5 import com.bsth.entity.*; 5 import com.bsth.entity.*;
  6 +import com.bsth.entity.report.LineCompare;
6 import com.bsth.entity.schedule.CarConfigInfo; 7 import com.bsth.entity.schedule.CarConfigInfo;
7 import com.bsth.repository.*; 8 import com.bsth.repository.*;
8 import com.bsth.repository.schedule.CarConfigInfoRepository; 9 import com.bsth.repository.schedule.CarConfigInfoRepository;
  10 +import com.bsth.repository.ticket.LineCompareRepository;
9 import com.google.common.collect.BiMap; 11 import com.google.common.collect.BiMap;
10 import com.google.common.collect.HashBiMap; 12 import com.google.common.collect.HashBiMap;
11 import org.apache.commons.lang3.StringUtils; 13 import org.apache.commons.lang3.StringUtils;
@@ -45,6 +47,9 @@ public class BasicData { @@ -45,6 +47,9 @@ public class BasicData {
45 //车辆自编号和牌照号对照 (K: 车辆自编号 ,V:牌照号) 47 //车辆自编号和牌照号对照 (K: 车辆自编号 ,V:牌照号)
46 public static Map<String, String> nbbmCompanyPlateMap; 48 public static Map<String, String> nbbmCompanyPlateMap;
47 49
  50 + //牌照号和车辆自编号对照 (K: 牌照号 ,V:车辆自编号)
  51 + public static Map<String, String> plate2NbbmMap;
  52 +
48 //站点编码和名称对照,包括停车场 (K: lineCode_updown_stationCode ,V:站点名称) 53 //站点编码和名称对照,包括停车场 (K: lineCode_updown_stationCode ,V:站点名称)
49 public static Map<String, String> stationCode2NameMap; 54 public static Map<String, String> stationCode2NameMap;
50 55
@@ -58,6 +63,8 @@ public class BasicData { @@ -58,6 +63,8 @@ public class BasicData {
58 public static Map<String, String> lineCode2NameMap; 63 public static Map<String, String> lineCode2NameMap;
59 64
60 public static Map<String, String> lineCodeAllNameMap; 65 public static Map<String, String> lineCodeAllNameMap;
  66 + //名称和线路编码对照
  67 + public static Map<String, String> Name2LineCodeMap;
61 //停车场 68 //停车场
62 public static List<String> parkCodeList; 69 public static List<String> parkCodeList;
63 70
@@ -79,6 +86,12 @@ public class BasicData { @@ -79,6 +86,12 @@ public class BasicData {
79 //站点名和运管处编号 对照 86 //站点名和运管处编号 对照
80 public static Map<String, Integer> stationName2YgcNumber; 87 public static Map<String, Integer> stationName2YgcNumber;
81 88
  89 + //青浦线路编码转调度线路编码
  90 + public static Map<String, LineCompare> lineCodeOut2LineCodeMap;
  91 +
  92 + //青浦票务系统线路名转调度线路编码
  93 + public static Map<String, LineCompare> namePWOut2LineCodeMap;
  94 +
82 public static List<WhiteIp> whiteIpList; 95 public static List<WhiteIp> whiteIpList;
83 96
84 private static Map<String, SystemParam> key2param = new HashMap<>(); 97 private static Map<String, SystemParam> key2param = new HashMap<>();
@@ -141,6 +154,9 @@ public class BasicData { @@ -141,6 +154,9 @@ public class BasicData {
141 @Autowired 154 @Autowired
142 private SystemParamRepository systemParamRepository; 155 private SystemParamRepository systemParamRepository;
143 156
  157 + @Autowired
  158 + private LineCompareRepository lineCompareRepository;
  159 +
144 @Override 160 @Override
145 public void run() { 161 public void run() {
146 loadAllData(); 162 loadAllData();
@@ -170,6 +186,7 @@ public class BasicData { @@ -170,6 +186,7 @@ public class BasicData {
170 geoCacheData.loadData(); 186 geoCacheData.loadData();
171 station2ParkBuffer.saveAll(); 187 station2ParkBuffer.saveAll();
172 loadSystemParam(); 188 loadSystemParam();
  189 + loadLineCompare();
173 logger.info("加载基础数据成功!,"); 190 logger.info("加载基础数据成功!,");
174 } catch (Exception e) { 191 } catch (Exception e) {
175 logger.error("加载基础数据时出现异常,", e); 192 logger.error("加载基础数据时出现异常,", e);
@@ -208,7 +225,8 @@ public class BasicData { @@ -208,7 +225,8 @@ public class BasicData {
208 225
209 //车辆自编号和拍照号对照 226 //车辆自编号和拍照号对照
210 Map<String, String> nbbmCompanyPlate = new HashMap<>(); 227 Map<String, String> nbbmCompanyPlate = new HashMap<>();
211 - 228 + //车辆自编号和拍照号对照
  229 + Map<String, String> plate2nbbm = new HashMap<>();
212 Iterator<Cars> carIterator = carsRepository.findAll().iterator(); 230 Iterator<Cars> carIterator = carsRepository.findAll().iterator();
213 Cars car; 231 Cars car;
214 while (carIterator.hasNext()) { 232 while (carIterator.hasNext()) {
@@ -217,12 +235,14 @@ public class BasicData { @@ -217,12 +235,14 @@ public class BasicData {
217 nbbm2CompanyCode.put(car.getInsideCode(), car.getBusinessCode()); 235 nbbm2CompanyCode.put(car.getInsideCode(), car.getBusinessCode());
218 nbbm2FgsCompanyCode.put(car.getInsideCode(), car.getBrancheCompanyCode() + "_" + car.getBusinessCode() ); 236 nbbm2FgsCompanyCode.put(car.getInsideCode(), car.getBrancheCompanyCode() + "_" + car.getBusinessCode() );
219 nbbmCompanyPlate.put(car.getInsideCode(), car.getCarPlate()); 237 nbbmCompanyPlate.put(car.getInsideCode(), car.getCarPlate());
  238 + plate2nbbm.put(car.getCarPlate(),car.getInsideCode());
220 } 239 }
221 240
222 deviceId2NbbmMap = deviceId2Nbbm; 241 deviceId2NbbmMap = deviceId2Nbbm;
223 nbbm2CompanyCodeMap = nbbm2CompanyCode; 242 nbbm2CompanyCodeMap = nbbm2CompanyCode;
224 nbbm2FgsCompanyCodeMap = nbbm2FgsCompanyCode; 243 nbbm2FgsCompanyCodeMap = nbbm2FgsCompanyCode;
225 nbbmCompanyPlateMap =nbbmCompanyPlate; 244 nbbmCompanyPlateMap =nbbmCompanyPlate;
  245 + plate2NbbmMap=plate2nbbm;
226 } 246 }
227 247
228 /** 248 /**
@@ -285,7 +305,7 @@ public class BasicData { @@ -285,7 +305,7 @@ public class BasicData {
285 Map<Integer, String> id2SHcode = new HashMap<Integer, String>(); 305 Map<Integer, String> id2SHcode = new HashMap<Integer, String>();
286 Map<String, String> code2SHcode = new HashMap<String, String>(); 306 Map<String, String> code2SHcode = new HashMap<String, String>();
287 Map<String, Integer> tempStationName2YgcNumber = new HashMap<String, Integer>(); 307 Map<String, Integer> tempStationName2YgcNumber = new HashMap<String, Integer>();
288 - 308 + Map<String, String> name2code = new HashMap<>();
289 /** 309 /**
290 * 加载运管处的站点及序号 310 * 加载运管处的站点及序号
291 * 上行从1开始,下行顺序续编 311 * 上行从1开始,下行顺序续编
@@ -317,6 +337,7 @@ public class BasicData { @@ -317,6 +337,7 @@ public class BasicData {
317 code2name.put(line.getLineCode(), line.getName()); 337 code2name.put(line.getLineCode(), line.getName());
318 id2SHcode.put(line.getId(), line.getShanghaiLinecode()); 338 id2SHcode.put(line.getId(), line.getShanghaiLinecode());
319 code2SHcode.put(line.getLineCode(), line.getShanghaiLinecode()); 339 code2SHcode.put(line.getLineCode(), line.getShanghaiLinecode());
  340 + name2code.put(line.getName(), line.getLineCode());
320 } 341 }
321 342
322 // 特殊线路ID为0的数据 (小模块轨迹) 343 // 特殊线路ID为0的数据 (小模块轨迹)
@@ -328,6 +349,7 @@ public class BasicData { @@ -328,6 +349,7 @@ public class BasicData {
328 lineId2ShangHaiCodeMap = id2SHcode; 349 lineId2ShangHaiCodeMap = id2SHcode;
329 lineCode2ShangHaiCodeMap = code2SHcode; 350 lineCode2ShangHaiCodeMap = code2SHcode;
330 stationName2YgcNumber = tempStationName2YgcNumber; 351 stationName2YgcNumber = tempStationName2YgcNumber;
  352 + Name2LineCodeMap =name2code;
331 353
332 Map<String, String> code2nameAll = new HashMap<>(); 354 Map<String, String> code2nameAll = new HashMap<>();
333 Iterator<Line> iteratorAll = lineRepository.findAll().iterator(); 355 Iterator<Line> iteratorAll = lineRepository.findAll().iterator();
@@ -393,6 +415,22 @@ public class BasicData { @@ -393,6 +415,22 @@ public class BasicData {
393 BasicData.key2param = key2param; 415 BasicData.key2param = key2param;
394 } 416 }
395 } 417 }
  418 + public void loadLineCompare() {
  419 + Iterator<LineCompare> allIterator = lineCompareRepository.findAll().iterator();
  420 + Map<String, LineCompare> map = new HashMap<>();
  421 + Map<String, LineCompare> map2 = new HashMap<>();
  422 +
  423 + LineCompare lc;
  424 + while (allIterator.hasNext()) {
  425 + lc = allIterator.next();
  426 + if(lc.getLineCodeOut()!=null){
  427 + map.put(lc.getLineCodeOut(), lc);
  428 + }
  429 + map2.put(lc.getNamePw(),lc);
  430 + }
  431 + lineCodeOut2LineCodeMap = map;
  432 + namePWOut2LineCodeMap =map2;
  433 + }
396 } 434 }
397 435
398 @Component 436 @Component
src/main/java/com/bsth/entity/Cars.java
@@ -128,6 +128,8 @@ public class Cars extends BEntity implements Serializable { @@ -128,6 +128,8 @@ public class Cars extends BEntity implements Serializable {
128 private Boolean sfdc; 128 private Boolean sfdc;
129 /** 是否混合动力(TODO:在原系统里没有,这里暂时留着) */ 129 /** 是否混合动力(TODO:在原系统里没有,这里暂时留着) */
130 private Boolean sfmix; 130 private Boolean sfmix;
  131 + /** 是否氢能源车 */
  132 + private Boolean hydrogen;
131 /** 备注/描述 */ 133 /** 备注/描述 */
132 private String descriptions; 134 private String descriptions;
133 135
@@ -452,6 +454,9 @@ public class Cars extends BEntity implements Serializable { @@ -452,6 +454,9 @@ public class Cars extends BEntity implements Serializable {
452 } 454 }
453 455
454 public Boolean getSfdc() { 456 public Boolean getSfdc() {
  457 + if(sfdc==null){
  458 + sfdc=false;
  459 + }
455 return sfdc; 460 return sfdc;
456 } 461 }
457 462
@@ -516,10 +521,24 @@ public class Cars extends BEntity implements Serializable { @@ -516,10 +521,24 @@ public class Cars extends BEntity implements Serializable {
516 } 521 }
517 522
518 public Boolean getSfmix() { 523 public Boolean getSfmix() {
  524 + if(sfmix==null){
  525 + sfmix=false;
  526 + }
519 return sfmix; 527 return sfmix;
520 } 528 }
521 529
522 public void setSfmix(Boolean sfmix) { 530 public void setSfmix(Boolean sfmix) {
523 this.sfmix = sfmix; 531 this.sfmix = sfmix;
524 } 532 }
  533 +
  534 + public Boolean getHydrogen() {
  535 + if(hydrogen==null){
  536 + hydrogen=false;
  537 + }
  538 + return hydrogen;
  539 + }
  540 +
  541 + public void setHydrogen(Boolean hydrogen) {
  542 + this.hydrogen = hydrogen;
  543 + }
525 } 544 }
src/main/java/com/bsth/entity/oil/Jdl.java
1 package com.bsth.entity.oil; 1 package com.bsth.entity.oil;
2 2
  3 +import java.text.SimpleDateFormat;
3 import java.util.Date; 4 import java.util.Date;
4 5
5 import javax.persistence.Entity; 6 import javax.persistence.Entity;
@@ -28,7 +29,8 @@ public class Jdl { @@ -28,7 +29,8 @@ public class Jdl {
28 private String remarks; 29 private String remarks;
29 @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss") 30 @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
30 private Date createrDate; 31 private Date createrDate;
31 - 32 + private String rqStr;
  33 + private String plate;
32 34
33 public Integer getId() { 35 public Integer getId() {
34 return id; 36 return id;
@@ -102,7 +104,17 @@ public class Jdl { @@ -102,7 +104,17 @@ public class Jdl {
102 public void setJsy(String jsy) { 104 public void setJsy(String jsy) {
103 this.jsy = jsy; 105 this.jsy = jsy;
104 } 106 }
105 -  
106 -  
107 - 107 +
  108 + static SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
  109 + public String getRqStr() {
  110 + return sdf.format(rq);
  111 + }
  112 +
  113 + public String getPlate() {
  114 + return plate;
  115 + }
  116 +
  117 + public void setPlate(String plate) {
  118 + this.plate = plate;
  119 + }
108 } 120 }
src/main/java/com/bsth/entity/oil/Jql.java 0 → 100644
  1 +package com.bsth.entity.oil;
  2 +
  3 +import org.springframework.format.annotation.DateTimeFormat;
  4 +
  5 +import javax.persistence.*;
  6 +import java.text.SimpleDateFormat;
  7 +import java.util.Date;
  8 +
  9 +@Entity
  10 +@Table(name = "bsth_c_jql")
  11 +public class Jql {
  12 + @Id
  13 + @GeneratedValue(strategy = GenerationType.IDENTITY)
  14 + private Integer id;
  15 + @DateTimeFormat(pattern="yyyy-MM-dd")
  16 + private Date rq;
  17 + private String gsBm;
  18 + private String gsName;
  19 + private String fgsBm;
  20 + private String fgsName;
  21 + private String nbbm;
  22 + private String jsy;
  23 + private Double jql = 0.0;
  24 + private String jqz;
  25 + private String remarks;
  26 + @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
  27 + private Date createrDate;
  28 + private String rqStr;
  29 + private String plate;
  30 +
  31 + public Integer getId() {
  32 + return id;
  33 + }
  34 + public void setId(Integer id) {
  35 + this.id = id;
  36 + }
  37 + public Date getRq() {
  38 + return rq;
  39 + }
  40 + public void setRq(Date rq) {
  41 + this.rq = rq;
  42 + }
  43 + public String getGsBm() {
  44 + return gsBm;
  45 + }
  46 + public void setGsBm(String gsBm) {
  47 + this.gsBm = gsBm;
  48 + }
  49 + public String getGsName() {
  50 + return gsName;
  51 + }
  52 + public void setGsName(String gsName) {
  53 + this.gsName = gsName;
  54 + }
  55 + public String getFgsBm() {
  56 + return fgsBm;
  57 + }
  58 + public void setFgsBm(String fgsBm) {
  59 + this.fgsBm = fgsBm;
  60 + }
  61 + public String getFgsName() {
  62 + return fgsName;
  63 + }
  64 + public void setFgsName(String fgsName) {
  65 + this.fgsName = fgsName;
  66 + }
  67 + public String getNbbm() {
  68 + return nbbm;
  69 + }
  70 + public void setNbbm(String nbbm) {
  71 + this.nbbm = nbbm;
  72 + }
  73 + public Double getJql() {
  74 + return jql;
  75 + }
  76 + public void setJql(Double jql) {
  77 + this.jql = jql;
  78 + }
  79 + public String getJqz() {
  80 + return jqz;
  81 + }
  82 + public void setJqz(String jqz) {
  83 + this.jqz = jqz;
  84 + }
  85 + public String getRemarks() {
  86 + return remarks;
  87 + }
  88 + public void setRemarks(String remarks) {
  89 + this.remarks = remarks;
  90 + }
  91 + public Date getCreaterDate() {
  92 + return createrDate;
  93 + }
  94 + public void setCreaterDate(Date createrDate) {
  95 + this.createrDate = createrDate;
  96 + }
  97 + public String getJsy() {
  98 + return jsy;
  99 + }
  100 + public void setJsy(String jsy) {
  101 + this.jsy = jsy;
  102 + }
  103 +
  104 + static SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
  105 + public String getRqStr() {
  106 + return sdf.format(rq);
  107 + }
  108 +
  109 + public String getPlate() {
  110 + return plate;
  111 + }
  112 +
  113 + public void setPlate(String plate) {
  114 + this.plate = plate;
  115 + }
  116 +}
src/main/java/com/bsth/entity/oil/Qlb.java 0 → 100644
  1 +package com.bsth.entity.oil;
  2 +
  3 +import com.bsth.data.BasicData;
  4 +import org.springframework.format.annotation.DateTimeFormat;
  5 +
  6 +import javax.persistence.*;
  7 +import java.text.DecimalFormat;
  8 +import java.util.Date;
  9 +
  10 +@Entity
  11 +@Table(name = "bsth_c_qlb")
  12 +public class Qlb {
  13 + @Id
  14 + @GeneratedValue(strategy = GenerationType.IDENTITY)
  15 + private Integer id;
  16 + @DateTimeFormat(pattern="yyyy-MM-dd")
  17 + private Date rq;
  18 + private String xlbm;
  19 + private String linename;
  20 + private String ssgsdm;
  21 + private String fgsdm;
  22 + private String nbbm;
  23 + private String jsy;
  24 + private Double czlc=0.0;
  25 + private Double jzlc=0.0;
  26 + //出站存量
  27 + private Double czcl=0.0;
  28 + //进站存量
  29 + private Double jzcl=0.0;
  30 + //充电量
  31 + private Double jql;
  32 + //是否跨天营运
  33 + private int sfkt;
  34 + private String jhsj;
  35 + //耗能
  36 + private Double hn=0.0;
  37 + //损耗
  38 + private Double sh=0.0;
  39 + //损耗原因
  40 + private String shyy;
  41 + private Double zlc=0.0;
  42 + //能耗类型
  43 + private int nhlx;
  44 + //尿素
  45 + private Double ns=0.0;
  46 + private Double fyylc=0.0;
  47 + private Double jhzlc=0.0;
  48 + private Double jhfyylc=0.0;
  49 + private int jhzbc;
  50 + private int jhbc;
  51 + private int sjzbc;
  52 + private int sjbc;
  53 + private String edituser;
  54 + private Date edittime;
  55 + private Date createtime;
  56 + private Date updatetime;
  57 + //能源类型
  58 + private int nylx;
  59 + //进场顺序(根据最先出场和最后进场来关联车辆的存电量)
  60 + private int jcsx;
  61 +
  62 + private String jname;
  63 + @Transient
  64 + private String name;
  65 + @Transient
  66 + private String bglhn;
  67 +
  68 + @Transient
  69 + private String xlname;
  70 +
  71 + @Transient
  72 + private String gsname;
  73 +
  74 + @Transient
  75 + private String fgsname;
  76 +
  77 +
  78 +
  79 + private String lp;
  80 +
  81 + public Integer getId() {
  82 + return id;
  83 + }
  84 +
  85 + public void setId(Integer id) {
  86 + this.id = id;
  87 + }
  88 +
  89 + public Date getRq() {
  90 + return rq;
  91 + }
  92 +
  93 + public void setRq(Date rq) {
  94 + this.rq = rq;
  95 + }
  96 +
  97 + public String getXlbm() {
  98 + return xlbm;
  99 + }
  100 +
  101 + public void setXlbm(String xlbm) {
  102 + this.xlbm = xlbm;
  103 + }
  104 +
  105 + public String getLinename() {
  106 + return linename;
  107 + }
  108 +
  109 + public void setLinename(String linename) {
  110 + this.linename = linename;
  111 + }
  112 +
  113 + public String getSsgsdm() {
  114 + return ssgsdm;
  115 + }
  116 +
  117 + public void setSsgsdm(String ssgsdm) {
  118 + this.ssgsdm = ssgsdm;
  119 + }
  120 +
  121 + public String getFgsdm() {
  122 + return fgsdm;
  123 + }
  124 +
  125 + public void setFgsdm(String fgsdm) {
  126 + this.fgsdm = fgsdm;
  127 + }
  128 +
  129 + public String getNbbm() {
  130 + return nbbm;
  131 + }
  132 +
  133 + public void setNbbm(String nbbm) {
  134 + this.nbbm = nbbm;
  135 + }
  136 +
  137 + public String getJsy() {
  138 + return jsy;
  139 + }
  140 +
  141 + public void setJsy(String jsy) {
  142 + this.jsy = jsy;
  143 + }
  144 +
  145 + public Double getCzlc() {
  146 + return czlc;
  147 + }
  148 +
  149 + public void setCzlc(Double czlc) {
  150 + this.czlc = czlc;
  151 + }
  152 +
  153 + public Double getJzlc() {
  154 + return jzlc;
  155 + }
  156 +
  157 + public void setJzlc(Double jzlc) {
  158 + this.jzlc = jzlc;
  159 + }
  160 +
  161 + public Double getCzcl() {
  162 + return czcl;
  163 + }
  164 +
  165 + public void setCzcl(Double czcl) {
  166 + this.czcl = czcl;
  167 + }
  168 +
  169 + public Double getJzcl() {
  170 + return jzcl;
  171 + }
  172 +
  173 + public void setJzcl(Double jzcl) {
  174 + this.jzcl = jzcl;
  175 + }
  176 +
  177 + public Double getJql() {
  178 + return jql;
  179 + }
  180 +
  181 + public void setJql(Double jql) {
  182 + this.jql = jql;
  183 + }
  184 +
  185 + public int getSfkt() {
  186 + return sfkt;
  187 + }
  188 +
  189 + public void setSfkt(int sfkt) {
  190 + this.sfkt = sfkt;
  191 + }
  192 +
  193 + public String getJhsj() {
  194 + return jhsj;
  195 + }
  196 +
  197 + public void setJhsj(String jhsj) {
  198 + this.jhsj = jhsj;
  199 + }
  200 +
  201 + public Double getHn() {
  202 + return hn;
  203 + }
  204 +
  205 + public void setHn(Double hn) {
  206 + this.hn = hn;
  207 + }
  208 +
  209 + public Double getSh() {
  210 + return sh;
  211 + }
  212 +
  213 + public void setSh(Double sh) {
  214 + this.sh = sh;
  215 + }
  216 +
  217 + public String getShyy() {
  218 + return shyy;
  219 + }
  220 +
  221 + public void setShyy(String shyy) {
  222 + this.shyy = shyy;
  223 + }
  224 +
  225 + public Double getZlc() {
  226 + return zlc;
  227 + }
  228 +
  229 + public void setZlc(Double zlc) {
  230 + this.zlc = zlc;
  231 + }
  232 +
  233 + public int getNhlx() {
  234 + return nhlx;
  235 + }
  236 +
  237 + public void setNhlx(int nhlx) {
  238 + this.nhlx = nhlx;
  239 + }
  240 +
  241 + public Double getNs() {
  242 + return ns;
  243 + }
  244 +
  245 + public void setNs(Double ns) {
  246 + this.ns = ns;
  247 + }
  248 +
  249 + public Double getFyylc() {
  250 + return fyylc;
  251 + }
  252 +
  253 + public void setFyylc(Double fyylc) {
  254 + this.fyylc = fyylc;
  255 + }
  256 +
  257 + public Double getJhzlc() {
  258 + return jhzlc;
  259 + }
  260 +
  261 + public void setJhzlc(Double jhzlc) {
  262 + this.jhzlc = jhzlc;
  263 + }
  264 +
  265 + public Double getJhfyylc() {
  266 + return jhfyylc;
  267 + }
  268 +
  269 + public void setJhfyylc(Double jhfyylc) {
  270 + this.jhfyylc = jhfyylc;
  271 + }
  272 +
  273 + public int getJhzbc() {
  274 + return jhzbc;
  275 + }
  276 +
  277 + public void setJhzbc(int jhzbc) {
  278 + this.jhzbc = jhzbc;
  279 + }
  280 +
  281 + public int getJhbc() {
  282 + return jhbc;
  283 + }
  284 +
  285 + public void setJhbc(int jhbc) {
  286 + this.jhbc = jhbc;
  287 + }
  288 +
  289 + public int getSjzbc() {
  290 + return sjzbc;
  291 + }
  292 +
  293 + public void setSjzbc(int sjzbc) {
  294 + this.sjzbc = sjzbc;
  295 + }
  296 +
  297 + public int getSjbc() {
  298 + return sjbc;
  299 + }
  300 +
  301 + public void setSjbc(int sjbc) {
  302 + this.sjbc = sjbc;
  303 + }
  304 +
  305 + public String getEdituser() {
  306 + return edituser;
  307 + }
  308 +
  309 + public void setEdituser(String edituser) {
  310 + this.edituser = edituser;
  311 + }
  312 +
  313 + public Date getEdittime() {
  314 + return edittime;
  315 + }
  316 +
  317 + public void setEdittime(Date edittime) {
  318 + this.edittime = edittime;
  319 + }
  320 +
  321 + public Date getCreatetime() {
  322 + return createtime;
  323 + }
  324 +
  325 + public void setCreatetime(Date createtime) {
  326 + this.createtime = createtime;
  327 + }
  328 +
  329 + public int getNylx() {
  330 + return nylx;
  331 + }
  332 +
  333 + public void setNylx(int nylx) {
  334 + this.nylx = nylx;
  335 + }
  336 +
  337 + public int getJcsx() {
  338 + return jcsx;
  339 + }
  340 +
  341 + public void setJcsx(int jcsx) {
  342 + this.jcsx = jcsx;
  343 + }
  344 +
  345 + public String getBglhn() {
  346 + if(this.getZlc()==0){
  347 + return "0";
  348 + }else{
  349 + DecimalFormat df = new DecimalFormat("0.00");
  350 + return df.format(this.getHn()/this.getZlc()*100);
  351 + }
  352 + }
  353 +
  354 + public void setBglhn(String bglhn) {
  355 + this.bglhn = bglhn;
  356 + }
  357 +
  358 + public String getXlname() {
  359 + return BasicData.lineCodeAllNameMap.get(this.xlbm);
  360 + }
  361 +
  362 + public void setXlname(String xlname) {
  363 + this.xlname = xlname;
  364 + }
  365 +
  366 + public String getGsname() {
  367 + return BasicData.businessCodeNameMap.get(this.ssgsdm);
  368 + }
  369 +
  370 + public void setGsname(String gsname) {
  371 + this.gsname = gsname;
  372 + }
  373 +
  374 + public String getName() {
  375 + return BasicData.allPerson.get(this.ssgsdm+"-"+this.jsy);
  376 + }
  377 +
  378 + public void setName(String name) {
  379 + this.name = name;
  380 + }
  381 +
  382 + public String getFgsname() {
  383 + return BasicData.businessFgsCodeNameMap.get(this.fgsdm+"_"+this.ssgsdm);
  384 + }
  385 +
  386 + public void setFgsname(String fgsname) {
  387 + this.fgsname = fgsname;
  388 + }
  389 +
  390 + public Date getUpdatetime() {
  391 + return updatetime;
  392 + }
  393 +
  394 + public void setUpdatetime(Date updatetime) {
  395 + this.updatetime = updatetime;
  396 + }
  397 +
  398 + public String getLp() {
  399 + return lp;
  400 + }
  401 +
  402 + public void setLp(String lp) {
  403 + this.lp = lp;
  404 + }
  405 +
  406 + public String getJname() {
  407 + return jname;
  408 + }
  409 +
  410 + public void setJname(String jname) {
  411 + this.jname = jname;
  412 + }
  413 +
  414 +
  415 +
  416 +}
src/main/java/com/bsth/entity/oil/Ylxxb.java
1 package com.bsth.entity.oil; 1 package com.bsth.entity.oil;
2 2
  3 +import java.text.SimpleDateFormat;
3 import java.util.Date; 4 import java.util.Date;
4 5
5 import javax.persistence.Entity; 6 import javax.persistence.Entity;
@@ -48,8 +49,10 @@ public class Ylxxb { @@ -48,8 +49,10 @@ public class Ylxxb {
48 private String linename; 49 private String linename;
49 @Transient 50 @Transient
50 private Double zjzl; 51 private Double zjzl;
51 -  
52 - 52 +
  53 + private String yh;
  54 +
  55 +
53 public Integer getId() { 56 public Integer getId() {
54 return id; 57 return id;
55 } 58 }
@@ -200,7 +203,17 @@ public class Ylxxb { @@ -200,7 +203,17 @@ public class Ylxxb {
200 public void setLinename(String linename) { 203 public void setLinename(String linename) {
201 this.linename = linename; 204 this.linename = linename;
202 } 205 }
203 -  
204 -  
205 - 206 +
  207 + static SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
  208 + public String getRqStr() {
  209 + return sdf.format(yyrq);
  210 + }
  211 +
  212 + public String getYh() {
  213 + return yh;
  214 + }
  215 +
  216 + public void setYh(String yh) {
  217 + this.yh = yh;
  218 + }
206 } 219 }
src/main/java/com/bsth/entity/realcontrol/Xlybtb.java 0 → 100644
  1 +package com.bsth.entity.realcontrol;
  2 +
  3 +
  4 +import java.text.DecimalFormat;
  5 +import java.util.List;
  6 +
  7 +//线路月报同比
  8 +public class Xlybtb {
  9 +
  10 + private String xl;//路线
  11 + private double xlcd;//线路长度
  12 + private int rcjh;//人次计划
  13 + private int rcsj;//人次实际
  14 + private int rctq;//人次同期
  15 + private Double rctb;//人次同比
  16 + private Double rcjhwc;//人次计划完成
  17 +
  18 + private int ysjh;//营收计划
  19 + private double yssj;//营收实际
  20 + private double ystq;//营收同期
  21 + private Double ystb;//营收同比
  22 + private Double ysybgl;//营收 元/百公里
  23 + private Double ysjhwc;//营收计划完成
  24 +
  25 + private double lcjh;//里程计划
  26 + private double lcsj;//里程实际
  27 + private double lccy;//里程柴油
  28 + private double lccd;//里程纯电
  29 + private double lcqrl;//里程氢燃料
  30 + private double lctq;//里程去年同期
  31 + private Double lctb;//里程同比
  32 + private Double lcjhwc;//里程计划完成
  33 +
  34 + private int bcjh;//班次计划
  35 + private int bcsj;//班次实际
  36 + private int bctq;//班次同期
  37 + private Double bctb;//班次同比
  38 + private Double bcjhwc;//班次计划完成
  39 +
  40 + private double kssj;//空驶实际
  41 + private double kstq;//空驶同期
  42 + private Double kstb;//空驶同比
  43 +
  44 + public String getXl() {
  45 + return xl;
  46 + }
  47 +
  48 + public void setXl(String xl) {
  49 + this.xl = xl;
  50 + }
  51 +
  52 + public double getXlcd() {
  53 + return xlcd;
  54 + }
  55 +
  56 + public void setXlcd(double xlcd) {
  57 + this.xlcd = xlcd;
  58 + }
  59 +
  60 + public int getRcjh() {
  61 + return rcjh;
  62 + }
  63 +
  64 + public void setRcjh(int rcjh) {
  65 + this.rcjh = rcjh;
  66 + }
  67 +
  68 + public int getRcsj() {
  69 + return rcsj;
  70 + }
  71 +
  72 + public void setRcsj(int rcsj) {
  73 + this.rcsj = rcsj;
  74 + }
  75 +
  76 + public int getRctq() {
  77 + return rctq;
  78 + }
  79 +
  80 + public void setRctq(int rctq) {
  81 + this.rctq = rctq;
  82 + }
  83 +
  84 + public Double getRctb() {
  85 + return rctb;
  86 + }
  87 +
  88 + public void setRctb(Double rctb) {
  89 + this.rctb = rctb;
  90 + }
  91 +
  92 + public Double getRcjhwc() {
  93 + return rcjhwc;
  94 + }
  95 +
  96 + public void setRcjhwc(Double rcjhwc) {
  97 + this.rcjhwc = rcjhwc;
  98 + }
  99 +
  100 + public int getYsjh() {
  101 + return ysjh;
  102 + }
  103 +
  104 + public void setYsjh(int ysjh) {
  105 + this.ysjh = ysjh;
  106 + }
  107 +
  108 + public double getYssj() {
  109 + return yssj;
  110 + }
  111 +
  112 + public void setYssj(double yssj) {
  113 + this.yssj = yssj;
  114 + }
  115 +
  116 + public double getYstq() {
  117 + return ystq;
  118 + }
  119 +
  120 + public void setYstq(double ystq) {
  121 + this.ystq = ystq;
  122 + }
  123 +
  124 + public Double getYstb() {
  125 + return ystb;
  126 + }
  127 +
  128 + public void setYstb(Double ystb) {
  129 + this.ystb = ystb;
  130 + }
  131 +
  132 + public Double getYsybgl() {
  133 + return ysybgl;
  134 + }
  135 +
  136 + public void setYsybgl(Double ysybgl) {
  137 + this.ysybgl = ysybgl;
  138 + }
  139 +
  140 + public Double getYsjhwc() {
  141 + return ysjhwc;
  142 + }
  143 +
  144 + public void setYsjhwc(Double ysjhwc) {
  145 + this.ysjhwc = ysjhwc;
  146 + }
  147 +
  148 + public double getLcjh() {
  149 + return lcjh;
  150 + }
  151 +
  152 + public void setLcjh(double lcjh) {
  153 + this.lcjh = lcjh;
  154 + }
  155 +
  156 + public double getLcsj() {
  157 + return lcsj;
  158 + }
  159 +
  160 + public void setLcsj(double lcsj) {
  161 + this.lcsj = lcsj;
  162 + }
  163 +
  164 + public double getLccy() {
  165 + return lccy;
  166 + }
  167 +
  168 + public void setLccy(double lccy) {
  169 + this.lccy = lccy;
  170 + }
  171 +
  172 + public double getLccd() {
  173 + return lccd;
  174 + }
  175 +
  176 + public void setLccd(double lccd) {
  177 + this.lccd = lccd;
  178 + }
  179 +
  180 + public double getLcqrl() {
  181 + return lcqrl;
  182 + }
  183 +
  184 + public void setLcqrl(double lcqrl) {
  185 + this.lcqrl = lcqrl;
  186 + }
  187 +
  188 + public double getLctq() {
  189 + return lctq;
  190 + }
  191 +
  192 + public void setLctq(double lctq) {
  193 + this.lctq = lctq;
  194 + }
  195 +
  196 + public Double getLctb() {
  197 + return lctb;
  198 + }
  199 +
  200 + public void setLctb(Double lctb) {
  201 + this.lctb = lctb;
  202 + }
  203 +
  204 + public Double getLcjhwc() {
  205 + return lcjhwc;
  206 + }
  207 +
  208 + public void setLcjhwc(Double lcjhwc) {
  209 + this.lcjhwc = lcjhwc;
  210 + }
  211 +
  212 + public int getBcjh() {
  213 + return bcjh;
  214 + }
  215 +
  216 + public void setBcjh(int bcjh) {
  217 + this.bcjh = bcjh;
  218 + }
  219 +
  220 + public int getBcsj() {
  221 + return bcsj;
  222 + }
  223 +
  224 + public void setBcsj(int bcsj) {
  225 + this.bcsj = bcsj;
  226 + }
  227 +
  228 + public int getBctq() {
  229 + return bctq;
  230 + }
  231 +
  232 + public void setBctq(int bctq) {
  233 + this.bctq = bctq;
  234 + }
  235 +
  236 + public Double getBctb() {
  237 + return bctb;
  238 + }
  239 +
  240 + public void setBctb(Double bctb) {
  241 + this.bctb = bctb;
  242 + }
  243 +
  244 + public Double getBcjhwc() {
  245 + return bcjhwc;
  246 + }
  247 +
  248 + public void setBcjhwc(Double bcjhwc) {
  249 + this.bcjhwc = bcjhwc;
  250 + }
  251 +
  252 + public double getKssj() {
  253 + return kssj;
  254 + }
  255 +
  256 + public void setKssj(double kssj) {
  257 + this.kssj = kssj;
  258 + }
  259 +
  260 + public double getKstq() {
  261 + return kstq;
  262 + }
  263 +
  264 + public void setKstq(double kstq) {
  265 + this.kstq = kstq;
  266 + }
  267 +
  268 + public Double getKstb() {
  269 + return kstb;
  270 + }
  271 +
  272 + public void setKstb(Double kstb) {
  273 + this.kstb = kstb;
  274 + }
  275 +
  276 + private static DecimalFormat df = new DecimalFormat("#.00");
  277 + public static Xlybtb getTotal(List<Xlybtb> xlybtbs, String name){
  278 + Xlybtb xlybtb = new Xlybtb();
  279 + xlybtb.setXl(name);
  280 + for (Xlybtb x : xlybtbs) {
  281 + xlybtb.setXlcd(Double.parseDouble(df.format(xlybtb.getXlcd()+x.getXlcd())));
  282 + int rcsj=xlybtb.getRcsj()+x.getRcsj();
  283 + int rctq=xlybtb.getRctq()+x.getRctq();
  284 + xlybtb.setRcjh(0);//人次计划
  285 + xlybtb.setRcsj(rcsj);//人次实际
  286 + xlybtb.setRctq(rctq);//人次同期
  287 + xlybtb.setRctb(rctq==0?null:Double.parseDouble(df.format((0-((double)(rctq-rcsj)/rctq))*100)));//人次同比
  288 + xlybtb.setRcjhwc(null);//人次计划完成
  289 +
  290 + double yssj=xlybtb.getYssj()+x.getYssj();
  291 + double ystq=xlybtb.getYstq()+x.getYstq();
  292 + double lcsj=Double.parseDouble(df.format(xlybtb.getLcsj()+x.getLcsj()));
  293 + xlybtb.setLcsj(lcsj);
  294 + xlybtb.setYsjh(0);//营收计
  295 + xlybtb.setYssj(yssj);//营收实际
  296 + xlybtb.setYstq(ystq);//营收同期
  297 + xlybtb.setYstb(ystq==0?null:Double.parseDouble(df.format((0-((double)(ystq-yssj)/ystq))*100)));//营收同比
  298 + xlybtb.setYsybgl(lcsj==0?null:Double.parseDouble(df.format(yssj/lcsj*100)));//营收 元/百公里
  299 + xlybtb.setYsjhwc(null);//营收计划完成
  300 +
  301 + double lcjh=Double.parseDouble(df.format(xlybtb.getLcjh()+x.getLcjh()));
  302 + double lctq=Double.parseDouble(df.format(xlybtb.getLctq()+x.getLctq()));
  303 + xlybtb.setLcjh(Double.parseDouble(df.format(lcjh)));//里程计划
  304 + xlybtb.setLccy(Double.parseDouble(df.format(xlybtb.getLccy()+x.getLccy()))); //里程柴油
  305 + xlybtb.setLccd(Double.parseDouble(df.format(xlybtb.getLccd()+x.getLccd())));//里程纯电
  306 + xlybtb.setLcqrl(Double.parseDouble(df.format(xlybtb.getLcqrl()+x.getLcqrl())));//里程氢燃料
  307 + xlybtb.setLctq(lctq);//里程去年同期
  308 + xlybtb.setLctb(lctq==0?null:Double.parseDouble(df.format((0-((lctq-lcsj)/lctq))*100)));//里程同比
  309 + xlybtb.setLcjhwc(lcjh==0?null:Double.parseDouble(df.format(lcsj/lcjh*100)));//里程计划完成
  310 +
  311 + int bcsj=xlybtb.getBcsj()+x.getBcsj();
  312 + int bcjh=xlybtb.getBcjh()+x.getBcjh();
  313 + int bctq=xlybtb.getBctq()+x.getBctq();
  314 + xlybtb.setBcjh(bcjh);//班次计划
  315 + xlybtb.setBcsj(bcsj);//班次实际
  316 + xlybtb.setBctq(bctq);//班次同期
  317 + xlybtb.setBctb(bctq==0?null:Double.parseDouble(df.format((0-((double)(bctq-bcsj)/bctq))*100)));//班次同比
  318 + xlybtb.setBcjhwc(bcjh==0?null:Double.parseDouble(df.format((double)bcsj/bcjh*100)));//班次计划完成
  319 +
  320 + double kssj=xlybtb.getKssj()+x.getKssj();
  321 + double kstq=xlybtb.getKstq()+x.getKstq();
  322 + xlybtb.setKssj(Double.parseDouble(df.format(kssj)));//空驶实际
  323 + xlybtb.setKstq(Double.parseDouble(df.format(kstq)));//空驶同期
  324 + xlybtb.setKstb(kstq==0?null:Double.parseDouble(df.format((0-((kstq-kssj)/kstq))*100)));//空驶同比
  325 + }
  326 + return xlybtb;
  327 + }
  328 +}
src/main/java/com/bsth/entity/realcontrol/Xlybtz.java 0 → 100644
  1 +package com.bsth.entity.realcontrol;
  2 +
  3 +import java.text.DecimalFormat;
  4 +import java.util.List;
  5 +//线路月报台账
  6 +public class Xlybtz {
  7 +
  8 + private String xl;//路线
  9 + private double xlcd;//线路长度
  10 + private int cldx;//车辆数大型
  11 + private int clzx;//31中型
  12 + private int rcpw;//人次票务
  13 + private int rcpos;//人次POS
  14 + private int rchj;//人次合计
  15 + private int rcrjdc;//人次日均单车
  16 + private int yspw;//营收票务
  17 + private int yspos;//营收POS
  18 + private int ysyhhc;//营收优惠换乘
  19 + private int ysbtk;//营收保通卡
  20 + private int yshj;//营收合计
  21 + private int ysrjdc;//营收日均单车
  22 + private double bglys;// 百公里营收(元)
  23 + private double cygl;//柴油(公里)
  24 + private double ydgl;//油电(公里
  25 + private double cdgl;//纯电(公里)
  26 + private double qrlgl;//氢燃料(公里)
  27 + private double cys;// 柴油(升)
  28 + private double yds;// 油电(升)
  29 + private double dhd;// 电耗(度)氢能车也加少量电
  30 + private double cddh;// 纯电电耗(度)
  31 + private double qrlqk;// 氢燃料(千克)
  32 + private double cysbgl;// 柴油升/百公里
  33 + private double ydsbgl;// 油电升/百公里
  34 + private double cddbgl;// 纯电度/百公里
  35 + private int btkrc;// 保通卡(人次)
  36 + private int jhbc;// 计划班次
  37 + private int sjbc;// 实际班次
  38 + private double jhgl;// 计划公里
  39 + private double sjgl;// 实际公里
  40 + private double glwc;// 公里完成%
  41 + private double bcwc;// 班次完成%
  42 + private int cr;// 车日
  43 + private double ksgl;// 其中:空驶公里
  44 + private double pjpj;// 平均票价
  45 +
  46 + private static DecimalFormat df = new DecimalFormat("#.00");
  47 + public static Xlybtz getTotal(List<Xlybtz> xlybtzs,String name,int dayCount){
  48 + Xlybtz xlybtz = new Xlybtz();
  49 + xlybtz.setXl(name);
  50 + for (Xlybtz x : xlybtzs) {
  51 + xlybtz.setXlcd(Double.parseDouble(df.format(xlybtz.getXlcd()+x.getXlcd())));
  52 + xlybtz.setCldx(xlybtz.getCldx()+x.getCldx());
  53 + xlybtz.setClzx(xlybtz.getClzx()+x.getClzx());
  54 + xlybtz.setRcpw(xlybtz.getRcpw()+x.getRcpw());
  55 + xlybtz.setRcpos(xlybtz.getRcpos()+x.getRcpos());
  56 + xlybtz.setRchj(xlybtz.getRchj()+x.getRchj());
  57 + xlybtz.setRcrjdc(xlybtz.getRchj()/(xlybtz.getCldx()+xlybtz.getClzx())/dayCount);
  58 + xlybtz.setYspw(xlybtz.getYspw()+x.getYspw());
  59 + xlybtz.setYspos(xlybtz.getYspos()+x.getYspos());
  60 + xlybtz.setYsyhhc(xlybtz.getYsyhhc()+x.getYsyhhc());
  61 + xlybtz.setYsbtk(xlybtz.getYsbtk()+x.getYsbtk());
  62 + xlybtz.setYshj(xlybtz.getYshj()+x.getYshj());
  63 + xlybtz.setYsrjdc(xlybtz.getYshj()/(xlybtz.getCldx()+xlybtz.getClzx())/dayCount);
  64 + xlybtz.setCygl(Double.parseDouble(df.format(xlybtz.getCygl()+x.getCygl())));
  65 + xlybtz.setYdgl(Double.parseDouble(df.format(xlybtz.getYdgl()+x.getYdgl())));
  66 + xlybtz.setCdgl(Double.parseDouble(df.format(xlybtz.getCdgl()+x.getCdgl())));
  67 + xlybtz.setQrlgl(Double.parseDouble(df.format(xlybtz.getQrlgl()+x.getQrlgl())));
  68 + if(xlybtz.getCygl()+xlybtz.getYdgl()+xlybtz.getCdgl()+xlybtz.getQrlgl()!=0){
  69 + xlybtz.setBglys(Double.parseDouble(df.format(xlybtz.getYshj()/(xlybtz.getCygl()+xlybtz.getYdgl()+xlybtz.getCdgl()+xlybtz.getQrlgl())*100)));
  70 + }
  71 + xlybtz.setCys(Double.parseDouble(df.format(xlybtz.getCys()+x.getCys())));
  72 + xlybtz.setYds(Double.parseDouble(df.format(xlybtz.getYds()+x.getYds())));
  73 + xlybtz.setDhd(Double.parseDouble(df.format(xlybtz.getDhd()+x.getDhd())));
  74 + xlybtz.setCddh(Double.parseDouble(df.format(xlybtz.getCddh()+x.getCddh())));
  75 + xlybtz.setQrlqk(Double.parseDouble(df.format(xlybtz.getQrlqk()+x.getQrlqk())));
  76 + if(xlybtz.getCygl()!=0){
  77 + xlybtz.setCysbgl(Double.parseDouble(df.format((xlybtz.getCys()/xlybtz.getCygl()*100))));
  78 + }
  79 + if(xlybtz.getYdgl()!=0){
  80 + xlybtz.setYdsbgl(Double.parseDouble(df.format((xlybtz.getYds()/xlybtz.getYdgl()*100))));
  81 + }
  82 + if(xlybtz.getCdgl()!=0){
  83 + xlybtz.setCddbgl(Double.parseDouble(df.format((xlybtz.getCddh()/xlybtz.getCdgl()*100))));
  84 + }
  85 + xlybtz.setBtkrc(xlybtz.getBtkrc()+x.getBtkrc());
  86 + xlybtz.setJhbc(xlybtz.getJhbc()+x.getJhbc());
  87 + xlybtz.setSjbc(xlybtz.getSjbc()+x.getSjbc());
  88 + xlybtz.setJhgl(Double.parseDouble(df.format(xlybtz.getJhgl()+x.getJhgl())));
  89 + xlybtz.setSjgl(Double.parseDouble(df.format(xlybtz.getSjgl()+x.getSjgl())));
  90 + if(xlybtz.getJhgl()!=0){
  91 + xlybtz.setGlwc(Double.parseDouble(df.format(xlybtz.getSjgl()/xlybtz.getJhgl()*100)));
  92 + }
  93 + if(xlybtz.getJhbc()!=0){
  94 + xlybtz.setBcwc(Double.parseDouble(df.format((double)xlybtz.getSjbc()/xlybtz.getJhbc()*100)));
  95 + }
  96 + xlybtz.setCr(xlybtz.getCr()+x.getCr());
  97 + xlybtz.setKsgl(xlybtz.getKsgl()+x.getKsgl());
  98 + if(xlybtz.getRchj()!=0){
  99 + xlybtz.setPjpj(Double.parseDouble(df.format((double)xlybtz.getYshj()/xlybtz.getRchj())));
  100 + }
  101 + }
  102 + return xlybtz;
  103 + }
  104 +
  105 + public String getXl() {
  106 + return xl;
  107 + }
  108 +
  109 + public void setXl(String xl) {
  110 + this.xl = xl;
  111 + }
  112 +
  113 + public double getXlcd() {
  114 + return xlcd;
  115 + }
  116 +
  117 + public void setXlcd(double xlcd) {
  118 + this.xlcd = xlcd;
  119 + }
  120 +
  121 + public int getCldx() {
  122 + return cldx;
  123 + }
  124 +
  125 + public void setCldx(int cldx) {
  126 + this.cldx = cldx;
  127 + }
  128 +
  129 + public int getClzx() {
  130 + return clzx;
  131 + }
  132 +
  133 + public void setClzx(int clzx) {
  134 + this.clzx = clzx;
  135 + }
  136 +
  137 + public int getRcpw() {
  138 + return rcpw;
  139 + }
  140 +
  141 + public void setRcpw(int rcpw) {
  142 + this.rcpw = rcpw;
  143 + }
  144 +
  145 + public int getRcpos() {
  146 + return rcpos;
  147 + }
  148 +
  149 + public void setRcpos(int rcpos) {
  150 + this.rcpos = rcpos;
  151 + }
  152 +
  153 + public int getRchj() {
  154 + return rchj;
  155 + }
  156 +
  157 + public void setRchj(int rchj) {
  158 + this.rchj = rchj;
  159 + }
  160 +
  161 + public int getRcrjdc() {
  162 + return rcrjdc;
  163 + }
  164 +
  165 + public void setRcrjdc(int rcrjdc) {
  166 + this.rcrjdc = rcrjdc;
  167 + }
  168 +
  169 + public int getYspw() {
  170 + return yspw;
  171 + }
  172 +
  173 + public void setYspw(int yspw) {
  174 + this.yspw = yspw;
  175 + }
  176 +
  177 + public int getYspos() {
  178 + return yspos;
  179 + }
  180 +
  181 + public void setYspos(int yspos) {
  182 + this.yspos = yspos;
  183 + }
  184 +
  185 + public int getYsyhhc() {
  186 + return ysyhhc;
  187 + }
  188 +
  189 + public void setYsyhhc(int ysyhhc) {
  190 + this.ysyhhc = ysyhhc;
  191 + }
  192 +
  193 + public int getYsbtk() {
  194 + return ysbtk;
  195 + }
  196 +
  197 + public void setYsbtk(int ysbtk) {
  198 + this.ysbtk = ysbtk;
  199 + }
  200 +
  201 + public int getYshj() {
  202 + return yshj;
  203 + }
  204 +
  205 + public void setYshj(int yshj) {
  206 + this.yshj = yshj;
  207 + }
  208 +
  209 + public int getYsrjdc() {
  210 + return ysrjdc;
  211 + }
  212 +
  213 + public void setYsrjdc(int ysrjdc) {
  214 + this.ysrjdc = ysrjdc;
  215 + }
  216 +
  217 + public double getBglys() {
  218 + return bglys;
  219 + }
  220 +
  221 + public void setBglys(double bglys) {
  222 + this.bglys = bglys;
  223 + }
  224 +
  225 + public double getCygl() {
  226 + return cygl;
  227 + }
  228 +
  229 + public void setCygl(double cygl) {
  230 + this.cygl = cygl;
  231 + }
  232 +
  233 + public double getYdgl() {
  234 + return ydgl;
  235 + }
  236 +
  237 + public void setYdgl(double ydgl) {
  238 + this.ydgl = ydgl;
  239 + }
  240 +
  241 + public double getCdgl() {
  242 + return cdgl;
  243 + }
  244 +
  245 + public void setCdgl(double cdgl) {
  246 + this.cdgl = cdgl;
  247 + }
  248 +
  249 + public double getQrlgl() {
  250 + return qrlgl;
  251 + }
  252 +
  253 + public void setQrlgl(double qrlgl) {
  254 + this.qrlgl = qrlgl;
  255 + }
  256 +
  257 + public double getCys() {
  258 + return cys;
  259 + }
  260 +
  261 + public void setCys(double cys) {
  262 + this.cys = cys;
  263 + }
  264 +
  265 + public double getYds() {
  266 + return yds;
  267 + }
  268 +
  269 + public void setYds(double yds) {
  270 + this.yds = yds;
  271 + }
  272 +
  273 + public double getDhd() {
  274 + return dhd;
  275 + }
  276 +
  277 + public void setDhd(double dhd) {
  278 + this.dhd = dhd;
  279 + }
  280 +
  281 + public double getQrlqk() {
  282 + return qrlqk;
  283 + }
  284 +
  285 + public void setQrlqk(double qrlqk) {
  286 + this.qrlqk = qrlqk;
  287 + }
  288 +
  289 + public double getCysbgl() {
  290 + return cysbgl;
  291 + }
  292 +
  293 + public void setCysbgl(double cysbgl) {
  294 + this.cysbgl = cysbgl;
  295 + }
  296 +
  297 + public double getYdsbgl() {
  298 + return ydsbgl;
  299 + }
  300 +
  301 + public void setYdsbgl(double ydsbgl) {
  302 + this.ydsbgl = ydsbgl;
  303 + }
  304 +
  305 + public double getCddbgl() {
  306 + return cddbgl;
  307 + }
  308 +
  309 + public void setCddbgl(double cddbgl) {
  310 + this.cddbgl = cddbgl;
  311 + }
  312 +
  313 + public int getBtkrc() {
  314 + return btkrc;
  315 + }
  316 +
  317 + public void setBtkrc(int btkrc) {
  318 + this.btkrc = btkrc;
  319 + }
  320 +
  321 + public int getJhbc() {
  322 + return jhbc;
  323 + }
  324 +
  325 + public void setJhbc(int jhbc) {
  326 + this.jhbc = jhbc;
  327 + }
  328 +
  329 + public int getSjbc() {
  330 + return sjbc;
  331 + }
  332 +
  333 + public void setSjbc(int sjbc) {
  334 + this.sjbc = sjbc;
  335 + }
  336 +
  337 + public double getJhgl() {
  338 + return jhgl;
  339 + }
  340 +
  341 + public void setJhgl(double jhgl) {
  342 + this.jhgl = jhgl;
  343 + }
  344 +
  345 + public double getGlwc() {
  346 + return glwc;
  347 + }
  348 +
  349 + public void setGlwc(double glwc) {
  350 + this.glwc = glwc;
  351 + }
  352 +
  353 + public double getBcwc() {
  354 + return bcwc;
  355 + }
  356 +
  357 + public void setBcwc(double bcwc) {
  358 + this.bcwc = bcwc;
  359 + }
  360 +
  361 + public int getCr() {
  362 + return cr;
  363 + }
  364 +
  365 + public void setCr(int cr) {
  366 + this.cr = cr;
  367 + }
  368 +
  369 + public double getKsgl() {
  370 + return ksgl;
  371 + }
  372 +
  373 + public void setKsgl(double ksgl) {
  374 + this.ksgl = ksgl;
  375 + }
  376 +
  377 + public double getPjpj() {
  378 + return pjpj;
  379 + }
  380 +
  381 + public void setPjpj(double pjpj) {
  382 + this.pjpj = pjpj;
  383 + }
  384 +
  385 + public double getCddh() {
  386 + return cddh;
  387 + }
  388 +
  389 + public void setCddh(double cddh) {
  390 + this.cddh = cddh;
  391 + }
  392 +
  393 + public double getSjgl() {
  394 + return sjgl;
  395 + }
  396 +
  397 + public void setSjgl(double sjgl) {
  398 + this.sjgl = sjgl;
  399 + }
  400 +}
src/main/java/com/bsth/entity/report/CardExcel.java 0 → 100644
  1 +package com.bsth.entity.report;
  2 +
  3 +public class CardExcel {
  4 +
  5 +
  6 + private String gs;//公司
  7 + private String xl;//线路
  8 + private String jylx;//交易类型
  9 + private int zcbs;//正常笔数
  10 + private double zcje;//正常金额
  11 + private double yhje;//优惠金额
  12 + private int kybs;//可疑笔数
  13 + private double kyje;//可疑金额
  14 + private double yhje2;//优惠金额
  15 + private int tzbs;//调整笔数
  16 + private double tzje;//调整金额
  17 + private double yhje3;//优惠金额
  18 +
  19 + private int sjbs;//实际笔数
  20 + private double sjje;//实际金额
  21 +
  22 + public static String[] columns = new String[]{"gs","xl","jylx","zcbs","zcje","yhje","kybs","kyje","yhje2","tzbs","tzje","yhje3"};
  23 +
  24 + public String getGs() {
  25 + return gs;
  26 + }
  27 +
  28 + public void setGs(String gs) {
  29 + this.gs = gs;
  30 + }
  31 +
  32 + public String getXl() {
  33 + return xl;
  34 + }
  35 +
  36 + public void setXl(String xl) {
  37 + this.xl = xl;
  38 + }
  39 +
  40 + public String getJylx() {
  41 + return jylx;
  42 + }
  43 +
  44 + public void setJylx(String jylx) {
  45 + this.jylx = jylx;
  46 + }
  47 +
  48 + public int getZcbs() {
  49 + return zcbs;
  50 + }
  51 +
  52 + public void setZcbs(int zcbs) {
  53 + this.zcbs = zcbs;
  54 + }
  55 +
  56 + public double getZcje() {
  57 + return zcje;
  58 + }
  59 +
  60 + public void setZcje(double zcje) {
  61 + this.zcje = zcje;
  62 + }
  63 +
  64 + public double getYhje() {
  65 + return yhje;
  66 + }
  67 +
  68 + public void setYhje(double yhje) {
  69 + this.yhje = yhje;
  70 + }
  71 +
  72 + public int getKybs() {
  73 + return kybs;
  74 + }
  75 +
  76 + public void setKybs(int kybs) {
  77 + this.kybs = kybs;
  78 + }
  79 +
  80 + public double getKyje() {
  81 + return kyje;
  82 + }
  83 +
  84 + public void setKyje(double kyje) {
  85 + this.kyje = kyje;
  86 + }
  87 +
  88 + public double getYhje2() {
  89 + return yhje2;
  90 + }
  91 +
  92 + public void setYhje2(double yhje2) {
  93 + this.yhje2 = yhje2;
  94 + }
  95 +
  96 + public int getTzbs() {
  97 + return tzbs;
  98 + }
  99 +
  100 + public void setTzbs(int tzbs) {
  101 + this.tzbs = tzbs;
  102 + }
  103 +
  104 + public double getTzje() {
  105 + return tzje;
  106 + }
  107 +
  108 + public void setTzje(double tzje) {
  109 + this.tzje = tzje;
  110 + }
  111 +
  112 + public double getYhje3() {
  113 + return yhje3;
  114 + }
  115 +
  116 + public void setYhje3(double yhje3) {
  117 + this.yhje3 = yhje3;
  118 + }
  119 +
  120 +
  121 + public int getSjbs() {
  122 + return zcbs+tzbs;
  123 + }
  124 +
  125 + public double getSjje() {
  126 + return zcje+yhje+tzje+yhje3;
  127 + }
  128 +}
src/main/java/com/bsth/entity/report/LineCompare.java 0 → 100644
  1 +package com.bsth.entity.report;
  2 +
  3 +import javax.persistence.*;
  4 +
  5 +@Entity
  6 +@Table(name = "bsth_c_line_compare")
  7 +public class LineCompare {
  8 +
  9 + @Id
  10 + @GeneratedValue(strategy = GenerationType.IDENTITY)
  11 + private Integer id;
  12 + private String lineCodeOut;//青浦线路编码
  13 + private String name;//线路名
  14 + private String convoy;//车队
  15 + private String lineCode;//线路编码
  16 + private String namePw;//票务系统线路名
  17 +
  18 + public Integer getId() {
  19 + return id;
  20 + }
  21 +
  22 + public void setId(Integer id) {
  23 + this.id = id;
  24 + }
  25 +
  26 + public String getLineCodeOut() {
  27 + if(lineCodeOut==null){
  28 + return null;
  29 + }
  30 + else if(lineCodeOut.length()>4){
  31 + return lineCodeOut.substring(lineCodeOut.length()-4);
  32 + }else {
  33 + while (lineCodeOut.length()<4){
  34 + lineCodeOut="0"+lineCodeOut;
  35 + }
  36 + return lineCodeOut;
  37 + }
  38 + }
  39 +
  40 + public void setLineCodeOut(String lineCodeOut) {
  41 + this.lineCodeOut = lineCodeOut;
  42 + }
  43 +
  44 + public String getName() {
  45 + return name;
  46 + }
  47 +
  48 + public void setName(String name) {
  49 + this.name = name;
  50 + }
  51 +
  52 + public String getConvoy() {
  53 + return convoy;
  54 + }
  55 +
  56 + public void setConvoy(String convoy) {
  57 + this.convoy = convoy;
  58 + }
  59 +
  60 + public String getLineCode() {
  61 + return lineCode;
  62 + }
  63 +
  64 + public void setLineCode(String lineCode) {
  65 + this.lineCode = lineCode;
  66 + }
  67 +
  68 + public String getNamePw() {
  69 + return namePw;
  70 + }
  71 +
  72 + public void setNamePw(String namePw) {
  73 + this.namePw = namePw;
  74 + }
  75 +}
src/main/java/com/bsth/entity/report/PWExcel.java 0 → 100644
  1 +package com.bsth.entity.report;
  2 +
  3 +public class PWExcel {
  4 +
  5 +
  6 + private String xl;//线路名
  7 + private int pj1;
  8 + private int pj2;
  9 + private int pj3;
  10 + private int pj4;
  11 + private int pj5;
  12 + private int pj6;
  13 + private int pj7;
  14 + private int pj8;
  15 + private int pj9;
  16 + private int pj10;
  17 + private int pj11;
  18 + private int pj12;
  19 + private int pj13;
  20 + private int cls;//车辆数
  21 + private int dtrc;//当天人次
  22 + private int ljrc;//累计人次
  23 + private double dtje;//当天金额
  24 + private double ljje;//累计金额
  25 +
  26 + public static String[] columns = new String[]{"xl","pj1","pj2","pj3","pj4","pj5","pj6","pj7","pj8","pj9","pj10","pj11","pj12","pj13","cls","dtrc","ljrc","dtje","ljje"};
  27 +
  28 + public String getXl() {
  29 + return xl;
  30 + }
  31 +
  32 + public void setXl(String xl) {
  33 + this.xl = xl;
  34 + }
  35 +
  36 + public int getPj1() {
  37 + return pj1;
  38 + }
  39 +
  40 + public void setPj1(int pj1) {
  41 + this.pj1 = pj1;
  42 + }
  43 +
  44 + public int getPj2() {
  45 + return pj2;
  46 + }
  47 +
  48 + public void setPj2(int pj2) {
  49 + this.pj2 = pj2;
  50 + }
  51 +
  52 + public int getPj3() {
  53 + return pj3;
  54 + }
  55 +
  56 + public void setPj3(int pj3) {
  57 + this.pj3 = pj3;
  58 + }
  59 +
  60 + public int getPj4() {
  61 + return pj4;
  62 + }
  63 +
  64 + public void setPj4(int pj4) {
  65 + this.pj4 = pj4;
  66 + }
  67 +
  68 + public int getPj5() {
  69 + return pj5;
  70 + }
  71 +
  72 + public void setPj5(int pj5) {
  73 + this.pj5 = pj5;
  74 + }
  75 +
  76 + public int getPj6() {
  77 + return pj6;
  78 + }
  79 +
  80 + public void setPj6(int pj6) {
  81 + this.pj6 = pj6;
  82 + }
  83 +
  84 + public int getPj7() {
  85 + return pj7;
  86 + }
  87 +
  88 + public void setPj7(int pj7) {
  89 + this.pj7 = pj7;
  90 + }
  91 +
  92 + public int getPj8() {
  93 + return pj8;
  94 + }
  95 +
  96 + public void setPj8(int pj8) {
  97 + this.pj8 = pj8;
  98 + }
  99 +
  100 + public int getPj9() {
  101 + return pj9;
  102 + }
  103 +
  104 + public void setPj9(int pj9) {
  105 + this.pj9 = pj9;
  106 + }
  107 +
  108 + public int getPj10() {
  109 + return pj10;
  110 + }
  111 +
  112 + public void setPj10(int pj10) {
  113 + this.pj10 = pj10;
  114 + }
  115 +
  116 + public int getPj11() {
  117 + return pj11;
  118 + }
  119 +
  120 + public void setPj11(int pj11) {
  121 + this.pj11 = pj11;
  122 + }
  123 +
  124 + public int getPj12() {
  125 + return pj12;
  126 + }
  127 +
  128 + public void setPj12(int pj12) {
  129 + this.pj12 = pj12;
  130 + }
  131 +
  132 + public int getPj13() {
  133 + return pj13;
  134 + }
  135 +
  136 + public void setPj13(int pj13) {
  137 + this.pj13 = pj13;
  138 + }
  139 +
  140 + public int getCls() {
  141 + return cls;
  142 + }
  143 +
  144 + public void setCls(int cls) {
  145 + this.cls = cls;
  146 + }
  147 +
  148 + public int getDtrc() {
  149 + return dtrc;
  150 + }
  151 +
  152 + public void setDtrc(int dtrc) {
  153 + this.dtrc = dtrc;
  154 + }
  155 +
  156 + public int getLjrc() {
  157 + return ljrc;
  158 + }
  159 +
  160 + public void setLjrc(int ljrc) {
  161 + this.ljrc = ljrc;
  162 + }
  163 +
  164 + public double getDtje() {
  165 + return dtje;
  166 + }
  167 +
  168 + public void setDtje(double dtje) {
  169 + this.dtje = dtje;
  170 + }
  171 +
  172 + public double getLjje() {
  173 + return ljje;
  174 + }
  175 +
  176 + public void setLjje(double ljje) {
  177 + this.ljje = ljje;
  178 + }
  179 +}
src/main/java/com/bsth/entity/report/QRCodeExcel.java 0 → 100644
  1 +package com.bsth.entity.report;
  2 +
  3 +public class QRCodeExcel {
  4 +
  5 +
  6 + private String gs;//公司
  7 + private String xl;//线路
  8 + private String jylx;//交易类型
  9 + private int zcbs;//正常笔数
  10 + private double zcje;//正常金额
  11 + private double yhje;//优惠金额
  12 + private int kybs;//可疑笔数
  13 + private double kyje;//可疑金额
  14 + private double yhje2;//优惠金额
  15 + private int tzbs;//调整笔数
  16 + private double tzje;//调整金额
  17 + private double yhje3;//优惠金额
  18 + private int bkkbs;//补扣款笔数
  19 + private double bkkje;//补扣款金额
  20 +
  21 + private int sjbs;//实际笔数
  22 + private double sjje;//实际金额
  23 +
  24 + public static String[] columns = new String[]{"gs","xl","jylx","zcbs","zcje","yhje","kybs","kyje","yhje2","tzbs","tzje","yhje3","bkkbs","bkkje"};
  25 +
  26 + public String getGs() {
  27 + return gs;
  28 + }
  29 +
  30 + public void setGs(String gs) {
  31 + this.gs = gs;
  32 + }
  33 +
  34 + public String getXl() {
  35 + return xl;
  36 + }
  37 +
  38 + public void setXl(String xl) {
  39 + this.xl = xl;
  40 + }
  41 +
  42 + public String getJylx() {
  43 + return jylx;
  44 + }
  45 +
  46 + public void setJylx(String jylx) {
  47 + this.jylx = jylx;
  48 + }
  49 +
  50 + public int getZcbs() {
  51 + return zcbs;
  52 + }
  53 +
  54 + public void setZcbs(int zcbs) {
  55 + this.zcbs = zcbs;
  56 + }
  57 +
  58 + public double getZcje() {
  59 + return zcje;
  60 + }
  61 +
  62 + public void setZcje(double zcje) {
  63 + this.zcje = zcje;
  64 + }
  65 +
  66 + public double getYhje() {
  67 + return yhje;
  68 + }
  69 +
  70 + public void setYhje(double yhje) {
  71 + this.yhje = yhje;
  72 + }
  73 +
  74 + public int getKybs() {
  75 + return kybs;
  76 + }
  77 +
  78 + public void setKybs(int kybs) {
  79 + this.kybs = kybs;
  80 + }
  81 +
  82 + public double getKyje() {
  83 + return kyje;
  84 + }
  85 +
  86 + public void setKyje(double kyje) {
  87 + this.kyje = kyje;
  88 + }
  89 +
  90 + public double getYhje2() {
  91 + return yhje2;
  92 + }
  93 +
  94 + public void setYhje2(double yhje2) {
  95 + this.yhje2 = yhje2;
  96 + }
  97 +
  98 + public int getTzbs() {
  99 + return tzbs;
  100 + }
  101 +
  102 + public void setTzbs(int tzbs) {
  103 + this.tzbs = tzbs;
  104 + }
  105 +
  106 + public double getTzje() {
  107 + return tzje;
  108 + }
  109 +
  110 + public void setTzje(double tzje) {
  111 + this.tzje = tzje;
  112 + }
  113 +
  114 + public double getYhje3() {
  115 + return yhje3;
  116 + }
  117 +
  118 + public void setYhje3(double yhje3) {
  119 + this.yhje3 = yhje3;
  120 + }
  121 +
  122 + public int getBkkbs() {
  123 + return bkkbs;
  124 + }
  125 +
  126 + public void setBkkbs(int bkkbs) {
  127 + this.bkkbs = bkkbs;
  128 + }
  129 +
  130 + public double getBkkje() {
  131 + return bkkje;
  132 + }
  133 +
  134 + public void setBkkje(double bkkje) {
  135 + this.bkkje = bkkje;
  136 + }
  137 +
  138 + public int getSjbs() {
  139 + return zcbs+tzbs+bkkbs;
  140 + }
  141 +
  142 + public double getSjje() {
  143 + return zcje+yhje+tzje+yhje3+bkkje;
  144 + }
  145 +}
src/main/java/com/bsth/entity/report/Ticket.java 0 → 100644
  1 +package com.bsth.entity.report;
  2 +
  3 +
  4 +import com.fasterxml.jackson.annotation.JsonFormat;
  5 +import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
  6 +import javax.persistence.*;
  7 +import java.util.Date;
  8 +
  9 +@JsonIgnoreProperties(ignoreUnknown = true)
  10 +@Entity
  11 +@Table(name = "ticket_info")
  12 +public class Ticket implements Comparable<Ticket>{
  13 +
  14 + @Id
  15 + @GeneratedValue(strategy = GenerationType.IDENTITY)
  16 + private Integer id;
  17 +
  18 + /**
  19 + * 日期
  20 + */
  21 + @JsonFormat(pattern = "yyyy-MM-dd")
  22 + private String date;
  23 +
  24 + /**
  25 + * 车队
  26 + */
  27 + private String convoy;
  28 +
  29 + /**
  30 + * 线路名
  31 + */
  32 + private String lineName;
  33 +
  34 + /**
  35 + * 线路编码
  36 + */
  37 + private String lineCode;
  38 +
  39 + /**
  40 + * 线路编码
  41 + */
  42 + private Integer lineId;
  43 +
  44 + /**
  45 + * 人次
  46 + */
  47 + private int count;
  48 +
  49 + /**
  50 + * 金额
  51 + */
  52 + private double amount;
  53 +
  54 + /**
  55 + * 支付方式
  56 + */
  57 + private String payType;
  58 +
  59 + /**
  60 + * 创建日期
  61 + */
  62 + @Column(updatable = false, name = "create_date", columnDefinition = "TIMESTAMP DEFAULT CURRENT_TIMESTAMP")
  63 + private Date createDate;
  64 +
  65 + public Integer getId() {
  66 + return id;
  67 + }
  68 +
  69 + public void setId(Integer id) {
  70 + this.id = id;
  71 + }
  72 +
  73 + public String getDate() {
  74 + return date;
  75 + }
  76 +
  77 + public void setDate(String date) {
  78 + this.date = date;
  79 + }
  80 +
  81 + public String getConvoy() {
  82 + return convoy;
  83 + }
  84 +
  85 + public void setConvoy(String convoy) {
  86 + this.convoy = convoy;
  87 + }
  88 +
  89 + public String getLineName() {
  90 + return lineName;
  91 + }
  92 +
  93 + public void setLineName(String lineName) {
  94 + if(lineName.contains(".")){
  95 + lineName=lineName.split("\\.")[0];
  96 + }
  97 + this.lineName = lineName;
  98 + }
  99 +
  100 + public int getCount() {
  101 + return count;
  102 + }
  103 +
  104 + public void setCount(int count) {
  105 + this.count = count;
  106 + }
  107 +
  108 + public double getAmount() {
  109 + return amount;
  110 + }
  111 +
  112 + public void setAmount(double amount) {
  113 + this.amount = amount;
  114 + }
  115 +
  116 + public String getPayType() {
  117 + return payType;
  118 + }
  119 +
  120 + public void setPayType(String payType) {
  121 + this.payType = payType;
  122 + }
  123 +
  124 + public Date getCreateDate() {
  125 + return createDate;
  126 + }
  127 +
  128 + public void setCreateDate(Date createDate) {
  129 + this.createDate = createDate;
  130 + }
  131 +
  132 + public String getLineCode() {
  133 + return lineCode;
  134 + }
  135 +
  136 + public void setLineCode(String lineCode) {
  137 + this.lineCode = lineCode;
  138 + }
  139 +
  140 + public Integer getLineId() {
  141 + return lineId;
  142 + }
  143 +
  144 + public void setLineId(Integer lineId) {
  145 + this.lineId = lineId;
  146 + }
  147 +
  148 + @Override
  149 + public int compareTo(Ticket o) {
  150 + return this.getConvoy().compareTo(o.getConvoy());
  151 + }
  152 +}
src/main/java/com/bsth/repository/LineInformationRepository.java
@@ -31,4 +31,7 @@ public interface LineInformationRepository extends BaseRepository&lt;LineInformatio @@ -31,4 +31,7 @@ public interface LineInformationRepository extends BaseRepository&lt;LineInformatio
31 List<LineInformation> findByLine(List<String> lineCodes); 31 List<LineInformation> findByLine(List<String> lineCodes);
32 32
33 List<LineInformation> findByLine(Line line); 33 List<LineInformation> findByLine(Line line);
  34 +
  35 + @Query("select i from LineInformation i")
  36 + List<LineInformation> findAll();
34 } 37 }
src/main/java/com/bsth/repository/oil/JdlRepository.java
@@ -17,10 +17,10 @@ public interface JdlRepository extends BaseRepository&lt;Jdl, Integer&gt;{ @@ -17,10 +17,10 @@ public interface JdlRepository extends BaseRepository&lt;Jdl, Integer&gt;{
17 @Transactional 17 @Transactional
18 @Modifying 18 @Modifying
19 @Query(value="INSERT INTO bsth_c_jdl("+ 19 @Query(value="INSERT INTO bsth_c_jdl("+
20 - "gs_bm, gs_name, fgs_bm, fgs_name, rq, nbbm, jdl, jdz, remarks, creater_date)" + 20 + "gs_bm, gs_name, fgs_bm, fgs_name, rq, nbbm, jdl, jdz, remarks, creater_date, jsy, plate)" +
21 " VALUES(" + 21 " VALUES(" +
22 - "?1,?2,?3,?4,str_to_date(?5,'%Y-%m-%d'),?6,?7,?8,?9,str_to_date(?10,'%Y-%m-%d %H:%i:%s'))", nativeQuery=true)  
23 - void insertData(String gsbm, String gsName, String fgsbm, String fgsName, String rq, String nbbm, String jdl, String jdz, String remarks, String createrDate); 22 + "?1,?2,?3,?4,str_to_date(?5,'%Y-%m-%d'),?6,?7,?8,?9,str_to_date(?10,'%Y-%m-%d %H:%i:%s'),?11,?12)", nativeQuery=true)
  23 + void insertData(String gsbm, String gsName, String fgsbm, String fgsName, String rq, String nbbm, String jdl, String jdz, String remarks, String createrDate, String jsy, String plate);
24 24
25 @Query(value="SELECT * FROM bsth_c_jdl where gs_bm = ?1 and fgs_bm = ?2 and rq = ?3 and nbbm like %?4% " ,nativeQuery=true) 25 @Query(value="SELECT * FROM bsth_c_jdl where gs_bm = ?1 and fgs_bm = ?2 and rq = ?3 and nbbm like %?4% " ,nativeQuery=true)
26 List<Jdl> query(String gsbm, String fgsbm, String rq, String nbbm); 26 List<Jdl> query(String gsbm, String fgsbm, String rq, String nbbm);
@@ -35,7 +35,9 @@ public interface JdlRepository extends BaseRepository&lt;Jdl, Integer&gt;{ @@ -35,7 +35,9 @@ public interface JdlRepository extends BaseRepository&lt;Jdl, Integer&gt;{
35 35
36 @Transactional 36 @Transactional
37 @Modifying 37 @Modifying
38 - @Query(value="UPDATE bsth_c_jdl set jdl = ?1 where gs_bm = ?2 and fgs_bm = ?3 and rq = ?4 and nbbm = ?5",nativeQuery=true)  
39 - void UpdateJdl(String jdl, String gsbm, String fgsbm, String rq, String nbbm);  
40 - 38 + @Query(value="UPDATE bsth_c_jdl set jdl = ?1,jsy=?6,plate=?7 where gs_bm = ?2 and fgs_bm = ?3 and rq = ?4 and nbbm = ?5",nativeQuery=true)
  39 + void UpdateJdl(String jdl, String gsbm, String fgsbm, String rq, String nbbm, String jsy, String plate);
  40 +
  41 + @Query(value="SELECT * FROM bsth_c_jdl where rq >= ?1 and rq <= ?2",nativeQuery=true)
  42 + List<Jdl> JdlList( String rqS, String rqE);
41 } 43 }
src/main/java/com/bsth/repository/oil/JqlRepository.java 0 → 100644
  1 +package com.bsth.repository.oil;
  2 +
  3 +
  4 +import java.util.List;
  5 +
  6 +import org.springframework.data.jpa.repository.Modifying;
  7 +import org.springframework.data.jpa.repository.Query;
  8 +import org.springframework.stereotype.Repository;
  9 +import org.springframework.transaction.annotation.Transactional;
  10 +
  11 +import com.bsth.entity.oil.Jql;
  12 +import com.bsth.repository.BaseRepository;
  13 +
  14 +@Repository
  15 +public interface JqlRepository extends BaseRepository<Jql, Integer>{
  16 +
  17 + @Transactional
  18 + @Modifying
  19 + @Query(value="INSERT INTO bsth_c_jql("+
  20 + "gs_bm, gs_name, fgs_bm, fgs_name, rq, nbbm, jql, jqz, remarks, creater_date,jsy,plate)" +
  21 + " VALUES(" +
  22 + "?1,?2,?3,?4,str_to_date(?5,'%Y-%m-%d'),?6,?7,?8,?9,str_to_date(?10,'%Y-%m-%d %H:%i:%s'),?11,?12)", nativeQuery=true)
  23 + void insertData(String gsbm, String gsName, String fgsbm, String fgsName, String rq, String nbbm, String jql, String jqz, String remarks, String createrDate,String jsy,String plate);
  24 +
  25 + @Query(value="SELECT * FROM bsth_c_jql where gs_bm = ?1 and fgs_bm = ?2 and rq = ?3 and nbbm like %?4% " ,nativeQuery=true)
  26 + List<Jql> query(String gsbm, String fgsbm, String rq, String nbbm);
  27 +
  28 + @Query(value="SELECT * FROM bsth_c_jql where gs_bm = ?1 and rq = ?2 and nbbm like %?3% " ,nativeQuery=true)
  29 + List<Jql> query(String gsbm, String rq, String nbbm);
  30 +
  31 + @Query(value="SELECT * FROM bsth_c_jql where rq = ?",nativeQuery=true)
  32 + List<Jql> JqlList( String rq);
  33 +
  34 + @Query(value="SELECT * FROM bsth_c_jql where rq = ?1 and gs_bm like %?2% and fgs_bm like %?3%",nativeQuery=true)
  35 + List<Jql> JqlList_1( String rq, String gsbm, String fgsbm);
  36 +
  37 + @Query(value="SELECT jql FROM bsth_c_jql where gs_bm = ?1 and fgs_bm = ?2 and rq = ?3 and nbbm = ?4 ",nativeQuery=true)
  38 + List<Double> queryBySame(String gsbm, String fgsbm, String rq, String nbbm);
  39 +
  40 +
  41 + @Transactional
  42 + @Modifying
  43 + @Query(value="UPDATE bsth_c_jql set jql = ?1,jsy=?6,plate=?7 where gs_bm = ?2 and fgs_bm = ?3 and rq = ?4 and nbbm = ?5",nativeQuery=true)
  44 + void UpdateJql(String jql, String gsbm, String fgsbm, String rq, String nbbm,String jsy,String plate);
  45 +
  46 + @Query(value="SELECT * FROM bsth_c_jql where rq >= ?1 and rq <= ?2",nativeQuery=true)
  47 + List<Jql> JqlList( String rqS,String rqE);
  48 +
  49 +}
src/main/java/com/bsth/repository/oil/QlbRepository.java 0 → 100644
  1 +package com.bsth.repository.oil;
  2 +
  3 +import java.util.Date;
  4 +import java.util.List;
  5 +
  6 +import org.springframework.data.jpa.repository.Modifying;
  7 +import org.springframework.data.jpa.repository.Query;
  8 +import org.springframework.stereotype.Repository;
  9 +import org.springframework.transaction.annotation.Transactional;
  10 +
  11 +import com.bsth.entity.oil.Qlb;
  12 +import com.bsth.repository.BaseRepository;
  13 +
  14 +@Repository
  15 +public interface QlbRepository extends BaseRepository<Qlb, Integer>{
  16 + /**
  17 + * 前一天DLB信息
  18 + * @param rq
  19 + * @return
  20 + */
  21 + @Query(value="SELECT a.* FROM bsth_c_qlb a where to_days(?1)-to_days(a.rq)=1 "
  22 + + " and jcsx=(select max(b.jcsx) from bsth_c_qlb b where a.nbbm=b.nbbm and "
  23 + + " to_days(?1)-to_days(b.rq)=1) and ssgsdm like %?2% and fgsdm like %?3% and "
  24 + + " xlbm like %?4% and nbbm like %?5%",nativeQuery=true)
  25 + List<Qlb> obtainQlbefore(String rq,String gsdm,String fgsdm,String xlbm,String nbbm);
  26 + /**
  27 + * 当天DLB信息
  28 + * @param rq
  29 + * @return
  30 + */
  31 + @Query(value="SELECT * FROM bsth_c_qlb where rq=?1 and ssgsdm like %?2% "
  32 + + " and fgsdm like %?3%"
  33 + + " and xlbm like %?4% and nbbm like %?5% order by ?6 asc",nativeQuery=true)
  34 + List<Qlb> obtainQl(String rq,String gsbm,String fgsdm,String xlbm,String nbbm,String px);
  35 +
  36 + @Query(value="select s from Qlb s "
  37 + + " where to_days(s.rq)=to_days(?1) "
  38 + + " and s.ssgsdm like %?2% "
  39 + + " and s.fgsdm like %?3%"
  40 + + " and s.xlbm like %?4% "
  41 + + " and s.nbbm in ?5 order by nbbm,jcsx")
  42 + List<Qlb> listQlb(String rq, String gsbm,String fgsbm,String xlbm,List<String> listNbbm);
  43 +
  44 + @Query(value="select s from Qlb s "
  45 + + " where s.rq=?1 "
  46 + + " and s.ssgsdm like %?2% "
  47 + + " and s.fgsdm like %?3%"
  48 + + " and s.xlbm like %?4% "
  49 + + " and s.nbbm in ?5 order by nbbm,jcsx")
  50 + List<Qlb> listQlb_s(Date rq, String gsbm,String fgsbm,String xlbm,List<String> listNbbm);
  51 +
  52 +
  53 + /**
  54 + *
  55 + * @param nbbm
  56 + * @param rq
  57 + * @param xlbm
  58 + * @return
  59 + */
  60 + @Query(value="select nbbm,count(nbbm) from bsth_c_qlb where rq=?1 "
  61 + + " and ssgsdm like %?2% "
  62 + + " and fgsdm like %?3% "
  63 + + " and xlbm like %?4% and nbbm like %?5% "
  64 + + " group by nbbm,rq,ssgsdm,fgsdm",nativeQuery=true)
  65 + List<Object[]> checkNbmmNum(String rq, String gsbm,String fgsbm,String xlbm,String nbbm);
  66 +
  67 + @Query(value="select nbbm,sum(jql*100) as jql ,sum(zlc*100) as zlc from bsth_c_qlb where rq= ?1 "
  68 + + " and ssgsdm like %?2% "
  69 + + " and fgsdm like %?3% "
  70 + + " and xlbm like %?4% and nbbm like %?5% "
  71 + + " group by nbbm,rq,ssgsdm,fgsdm,xlbm",nativeQuery=true)
  72 + List<Object[]> checkNbmmQl(String rq, String gsbm,String fgsbm,String xlbm,String nbbm);
  73 +
  74 +
  75 + @Query(value="select jql,hn,sh from Qlb s "
  76 + + " where to_days(s.rq)=to_days(?1) "
  77 + + " and s.ssgsdm like %?2% "
  78 + + " and s.fgsdm like %?3% "
  79 + + " and s.xlbm like %?4% "
  80 + + " and s.nbbm in ?5 ")
  81 + List<Object[]> sumQlb(String rq, String gsbm,String fgsbm,String xlbm,List<String> listNbbm);
  82 +
  83 + @Query(value="select jql,hn,sh from Qlb s "
  84 + + " where s.rq=?1 "
  85 + + " and s.ssgsdm like %?2% "
  86 + + " and s.fgsdm like %?3% "
  87 + + " and s.xlbm like %?4% "
  88 + + " and s.nbbm in ?5 ")
  89 + List<Object[]> sumQlb_s(Date rq, String gsbm,String fgsbm,String xlbm,List<String> listNbbm);
  90 +
  91 +
  92 + @Query(value="select ifnull(jql,0),ifnull(hn,0),ifnull(sh,0) from bsth_c_qlb "
  93 + + " where rq=?1 "
  94 + + " and ssgsdm like %?2% "
  95 + + " and fgsdm like %?3% "
  96 + + " and xlbm like %?4% "
  97 + + " and nbbm like %?5%",nativeQuery=true)
  98 + List<Object[]> sumQlb2(String rq, String gsbm,String fgsbm,String xlbm,String nbbm);
  99 +
  100 + @Transactional
  101 + @Modifying
  102 + @Query(value="UPDATE bsth_c_qlb SET " +
  103 + " czcl= ?2," +
  104 + " jzcl = ?3, " +
  105 + " hn = ?4, " +
  106 + " sh = ?5, " +
  107 + " shyy = ?6, " +
  108 + " nhlx = ?7 " +
  109 + " WHERE id = ?1", nativeQuery=true)
  110 + public void qlbUpdate(Integer id,double czcl,double jzcl,double hn, double sh,String shyy,int nhlx);
  111 +
  112 + @Query(value="SELECT * FROM bsth_c_qlb where rq=?1 and nbbm=?2 and jsy=?3 and xlbm=?4",nativeQuery=true)
  113 + List<Qlb> queryListQlb(String rq,String nbbm,String jgh,String xlbm);
  114 +
  115 + @Query(value="SELECT * FROM bsth_c_qlb where rq=?1 and xlbm=?2",nativeQuery=true)
  116 + List<Qlb> queryQlbByRqXlbm(String rq, String xlbm);
  117 +
  118 + @Query(value="SELECT * FROM bsth_c_qlb where id=?1",nativeQuery=true)
  119 + Qlb findById(int id);
  120 +
  121 + //按照日期删除数据
  122 + @Modifying
  123 + @javax.transaction.Transactional
  124 + @Query(value="DELETE from bsth_c_qlb where id = ?1", nativeQuery=true)
  125 + void deleteById(int id);
  126 +
  127 +}
src/main/java/com/bsth/repository/oil/YlxxbRepository.java
@@ -29,7 +29,26 @@ public interface YlxxbRepository extends BaseRepository&lt;Ylxxb, Integer&gt;{ @@ -29,7 +29,26 @@ public interface YlxxbRepository extends BaseRepository&lt;Ylxxb, Integer&gt;{
29 @Query(value="select * from bsth_c_ylxxb s where s.nbbm = ?1 and " 29 @Query(value="select * from bsth_c_ylxxb s where s.nbbm = ?1 and "
30 + "s.yyrq=?2",nativeQuery=true) 30 + "s.yyrq=?2",nativeQuery=true)
31 List<Ylxxb> queryListYlxxb(String clZbh,String date); 31 List<Ylxxb> queryListYlxxb(String clZbh,String date);
32 -  
33 -  
34 - 32 +
  33 + @Query(value="SELECT * FROM bsth_c_ylxxb where yyrq >= ?1 and yyrq <= ?2",nativeQuery=true)
  34 + List<Ylxxb> ylxxbList(String rqS, String rqE);
  35 +
  36 + @Query(value="SELECT jzl FROM bsth_c_ylxxb where gsdm = ?1 and yyrq = ?2 and nbbm = ?3 and jylx = '1' ",nativeQuery=true)
  37 + List<Double> import_queryBySame( String gsbm, String rq, String nbbm);
  38 +
  39 + @Transactional
  40 + @Modifying
  41 + @Query(value="INSERT INTO bsth_c_ylxxb("+
  42 + "gsdm, yyrq, nbbm, jsy, jzl, stationid, bz, createtime, nylx, jylx, plate, yh) " +
  43 + "VALUES(" +
  44 + "?1,str_to_date(?2,'%Y-%m-%d'),?3,?4,?5,?6,?7,str_to_date(?8,'%Y-%m-%d %H:%i:%s'), '0', '1',?9,?10) ", nativeQuery=true)
  45 + void import_insertData(String gsbm, String rq, String nbbm, String jsy, String jzl, String jyz, String remarks, String createtime, String plate, String yh);
  46 +
  47 + @Transactional
  48 + @Modifying
  49 + @Query(value="UPDATE bsth_c_ylxxb set jzl = ?1, jsy = ?2, stationid = ?3, bz = ?4 , plate = ?8 , yh = ?9 "
  50 + + "where gsdm = ?5 and yyrq = ?6 and nbbm = ?7 and jylx = '1' ",nativeQuery=true)
  51 + void import_UpdateJzl(String jzl, String jsy, String jyz, String remarks, String gsbm, String rq, String nbbm, String plate, String yh);
  52 +
  53 +
35 } 54 }
src/main/java/com/bsth/repository/ticket/LineCompareRepository.java 0 → 100644
  1 +package com.bsth.repository.ticket;
  2 +
  3 +import com.bsth.entity.report.LineCompare;
  4 +import com.bsth.repository.BaseRepository;
  5 +import org.springframework.data.jpa.repository.Query;
  6 +import org.springframework.stereotype.Repository;
  7 +
  8 +import java.util.List;
  9 +
  10 +@Repository
  11 +public interface LineCompareRepository extends BaseRepository<LineCompare, Integer> {
  12 +
  13 + @Query(value="select l from LineCompare l")
  14 + List<LineCompare> findAll();
  15 +
  16 +}
src/main/java/com/bsth/repository/ticket/TicketRepository.java 0 → 100644
  1 +package com.bsth.repository.ticket;
  2 +
  3 +
  4 +import com.bsth.entity.report.Ticket;
  5 +import com.bsth.repository.BaseRepository;
  6 +import org.springframework.data.jpa.repository.Query;
  7 +import org.springframework.stereotype.Repository;
  8 +
  9 +import java.util.List;
  10 +
  11 +@Repository
  12 +public interface TicketRepository extends BaseRepository<Ticket, Integer>{
  13 +
  14 +
  15 +
  16 + @Query(value="SELECT ticket FROM Ticket ticket where ticket.lineName = ?1 and ticket.date = ?2" )
  17 + List<Ticket> query(String line, String date);
  18 +
  19 +}
src/main/java/com/bsth/service/oil/JqlService.java 0 → 100644
  1 +package com.bsth.service.oil;
  2 +
  3 +import com.bsth.entity.oil.Jql;
  4 +import com.bsth.service.BaseService;
  5 +
  6 +import java.io.File;
  7 +import java.util.Map;
  8 +
  9 +public interface JqlService extends BaseService<Jql, Integer> {
  10 +
  11 + public String importExcel(File file, String gsbm_, String gsName, String fgsbm, String fgsName);
  12 +
  13 + public Map<String, Object> query(Map<String, Object> map);
  14 +
  15 +}
src/main/java/com/bsth/service/oil/QlbService.java 0 → 100644
  1 +package com.bsth.service.oil;
  2 +
  3 +import com.bsth.entity.oil.Qlb;
  4 +import com.bsth.service.BaseService;
  5 +
  6 +import java.util.List;
  7 +import java.util.Map;
  8 +
  9 +public interface QlbService extends BaseService<Qlb, Integer>{
  10 + Map<String, Object> obtain(Map<String, Object> map) throws Exception;
  11 +
  12 + Map<String, Object> sort(Map<String, Object> map);
  13 +
  14 + Map<String, Object> checkQl(Map<String, Object> map);
  15 +
  16 + List<Qlb> listQlb(Map<String, Object> map);
  17 +
  18 + Map<String, Object> sumQlb(Map<String, Object> map);
  19 +
  20 + Map<String, Object> saveQlbList(Map<String, Object> map) throws Exception;
  21 +
  22 + String obtainDsq() throws Exception;
  23 +
  24 + String checkJsy(Map<String, Object> map);
  25 +
  26 + Map<String, Object> saveQlb(Qlb t);
  27 +
  28 + Map<String, Object> deleteIds(Map<String, Object> map) throws Exception;
  29 +
  30 + Map<String, List<Qlb>> updeteHistory(List<Map<String, Object>> list,String date,
  31 + String gsdm,String fgsdm,String line) ;
  32 +
  33 + Map<String, Object> update(Map<String, Object> map);
  34 +
  35 +
  36 +}
src/main/java/com/bsth/service/oil/YlxxbService.java
1 package com.bsth.service.oil; 1 package com.bsth.service.oil;
2 2
  3 +import java.io.File;
3 import java.util.List; 4 import java.util.List;
4 import java.util.Map; 5 import java.util.Map;
5 6
@@ -17,4 +18,8 @@ public interface YlxxbService extends BaseService&lt;Ylxxb, Integer&gt;{ @@ -17,4 +18,8 @@ public interface YlxxbService extends BaseService&lt;Ylxxb, Integer&gt;{
17 18
18 Map<String, Object> saveYlxxb(Map<String, Object> map); 19 Map<String, Object> saveYlxxb(Map<String, Object> map);
19 20
  21 + String importExcel(File file);
  22 +
  23 + Map<String, Object> query(Map<String, Object> map);
  24 +
20 } 25 }
src/main/java/com/bsth/service/oil/impl/JdlServiceImpl.java
@@ -2,8 +2,12 @@ package com.bsth.service.oil.impl; @@ -2,8 +2,12 @@ package com.bsth.service.oil.impl;
2 2
3 import java.io.File; 3 import java.io.File;
4 import java.io.FileInputStream; 4 import java.io.FileInputStream;
  5 +import java.sql.PreparedStatement;
  6 +import java.sql.SQLException;
5 import java.text.DecimalFormat; 7 import java.text.DecimalFormat;
6 import java.text.SimpleDateFormat; 8 import java.text.SimpleDateFormat;
  9 +import java.time.LocalDate;
  10 +import java.time.format.DateTimeFormatter;
7 import java.util.ArrayList; 11 import java.util.ArrayList;
8 import java.util.Date; 12 import java.util.Date;
9 import java.util.HashMap; 13 import java.util.HashMap;
@@ -11,12 +15,16 @@ import java.util.Iterator; @@ -11,12 +15,16 @@ import java.util.Iterator;
11 import java.util.List; 15 import java.util.List;
12 import java.util.Map; 16 import java.util.Map;
13 17
  18 +import com.bsth.entity.report.Ticket;
14 import org.apache.poi.hssf.usermodel.HSSFCell; 19 import org.apache.poi.hssf.usermodel.HSSFCell;
15 import org.apache.poi.hssf.usermodel.HSSFRow; 20 import org.apache.poi.hssf.usermodel.HSSFRow;
16 import org.apache.poi.hssf.usermodel.HSSFSheet; 21 import org.apache.poi.hssf.usermodel.HSSFSheet;
17 import org.apache.poi.hssf.usermodel.HSSFWorkbook; 22 import org.apache.poi.hssf.usermodel.HSSFWorkbook;
18 import org.apache.poi.poifs.filesystem.POIFSFileSystem; 23 import org.apache.poi.poifs.filesystem.POIFSFileSystem;
19 import org.springframework.beans.factory.annotation.Autowired; 24 import org.springframework.beans.factory.annotation.Autowired;
  25 +import org.springframework.jdbc.core.BatchPreparedStatementSetter;
  26 +import org.springframework.jdbc.core.BeanPropertyRowMapper;
  27 +import org.springframework.jdbc.core.JdbcTemplate;
20 import org.springframework.stereotype.Service; 28 import org.springframework.stereotype.Service;
21 29
22 import com.bsth.entity.oil.Jdl; 30 import com.bsth.entity.oil.Jdl;
@@ -24,6 +32,10 @@ import com.bsth.repository.oil.JdlRepository; @@ -24,6 +32,10 @@ import com.bsth.repository.oil.JdlRepository;
24 import com.bsth.service.impl.BaseServiceImpl; 32 import com.bsth.service.impl.BaseServiceImpl;
25 import com.bsth.service.oil.JdlService; 33 import com.bsth.service.oil.JdlService;
26 import com.bsth.util.ReportUtils; 34 import com.bsth.util.ReportUtils;
  35 +import org.springframework.transaction.TransactionException;
  36 +import org.springframework.transaction.TransactionStatus;
  37 +import org.springframework.transaction.support.TransactionCallbackWithoutResult;
  38 +import org.springframework.transaction.support.TransactionTemplate;
27 39
28 @Service 40 @Service
29 public class JdlServiceImpl extends BaseServiceImpl<Jdl, Integer> implements JdlService { 41 public class JdlServiceImpl extends BaseServiceImpl<Jdl, Integer> implements JdlService {
@@ -31,8 +43,18 @@ public class JdlServiceImpl extends BaseServiceImpl&lt;Jdl, Integer&gt; implements Jdl @@ -31,8 +43,18 @@ public class JdlServiceImpl extends BaseServiceImpl&lt;Jdl, Integer&gt; implements Jdl
31 @Autowired 43 @Autowired
32 JdlRepository repository; 44 JdlRepository repository;
33 45
  46 + @Autowired
  47 + JdbcTemplate jdbcTemplate;
  48 +
  49 + @Autowired
  50 + private TransactionTemplate transactionTemplate;
  51 +
34 @Override 52 @Override
35 public String importExcel(File file, String gsbm, String gsName, String fgsbm, String fgsName) { 53 public String importExcel(File file, String gsbm, String gsName, String fgsbm, String fgsName) {
  54 + gsbm="99";
  55 + gsName="青浦公交";
  56 + fgsbm="100";
  57 + fgsName="青浦公交";
36 SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); 58 SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
37 SimpleDateFormat sd = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); 59 SimpleDateFormat sd = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
38 DecimalFormat df = new DecimalFormat("######0.00"); 60 DecimalFormat df = new DecimalFormat("######0.00");
@@ -41,6 +63,19 @@ public class JdlServiceImpl extends BaseServiceImpl&lt;Jdl, Integer&gt; implements Jdl @@ -41,6 +63,19 @@ public class JdlServiceImpl extends BaseServiceImpl&lt;Jdl, Integer&gt; implements Jdl
41 POIFSFileSystem fs = new POIFSFileSystem(new FileInputStream(file)); 63 POIFSFileSystem fs = new POIFSFileSystem(new FileInputStream(file));
42 HSSFWorkbook wb = new HSSFWorkbook(fs); 64 HSSFWorkbook wb = new HSSFWorkbook(fs);
43 HSSFSheet sheet = wb.getSheetAt(0); 65 HSSFSheet sheet = wb.getSheetAt(0);
  66 + String n=sheet.getSheetName();
  67 + String y=n.split("年")[0];
  68 + if(n.split("年").length<2){
  69 + return "报表日期读取失败";
  70 + }
  71 + String m=n.split("年")[1].split("月")[0];
  72 + if(y.length()==2){
  73 + y="20"+y;
  74 + }
  75 + if(m.length()==1){
  76 + m="0"+m;
  77 + }
  78 + System.out.println(y+"-"+m);
44 // 取得总行数 79 // 取得总行数
45 int rowNum = sheet.getLastRowNum() + 1; 80 int rowNum = sheet.getLastRowNum() + 1;
46 // 取得总列数 81 // 取得总列数
@@ -59,7 +94,15 @@ public class JdlServiceImpl extends BaseServiceImpl&lt;Jdl, Integer&gt; implements Jdl @@ -59,7 +94,15 @@ public class JdlServiceImpl extends BaseServiceImpl&lt;Jdl, Integer&gt; implements Jdl
59 text += ","; 94 text += ",";
60 continue; 95 continue;
61 } 96 }
  97 + if(cell.getCellType()==2){//处理公式类数据
  98 + try {
  99 + text +=(cell.getNumericCellValue()+ ",");
  100 + } catch (IllegalStateException e) {
  101 + text +=(cell.getRichStringCellValue()+ ",");
  102 + }
  103 + }else {
62 text += String.valueOf(cell) + ","; 104 text += String.valueOf(cell) + ",";
  105 + }
63 } 106 }
64 String[] split = (text+";").split(","); 107 String[] split = (text+";").split(",");
65 String str = ""; 108 String str = "";
@@ -70,29 +113,68 @@ public class JdlServiceImpl extends BaseServiceImpl&lt;Jdl, Integer&gt; implements Jdl @@ -70,29 +113,68 @@ public class JdlServiceImpl extends BaseServiceImpl&lt;Jdl, Integer&gt; implements Jdl
70 continue; 113 continue;
71 textList.add(text + ";"); 114 textList.add(text + ";");
72 } 115 }
  116 + String rq = y+"-"+m+"-"+"01";//日期
  117 + List<Jdl> jdlList=new ArrayList<>();
73 for(int i = 0; i < textList.size(); i++){ 118 for(int i = 0; i < textList.size(); i++){
74 String text = textList.get(i); 119 String text = textList.get(i);
75 String[] split = text.split(","); 120 String[] split = text.split(",");
76 - String rq = split[0].trim();  
77 - String nbbm = split[1].trim();  
78 -// String jsy= split[2].trim();  
79 - double jdl = Double.valueOf(split[2].trim().length()!=0?split[2]:"0");  
80 - String jdz = split[3].trim();  
81 - String remarks = split[4].trim();  
82 - if(rq.trim().length() == 0){  
83 - rq = sdf.format(new Date()); 121 + String plate = split[2].trim();//车牌号
  122 + if ("合计".equals(plate)){
  123 + break;
84 } 124 }
85 -  
86 - List<Double> jdl_ = repository.queryBySame(gsbm, fgsbm, rq, nbbm);  
87 -  
88 - if(jdl_.size() == 0){  
89 - repository.insertData(gsbm, gsName, fgsbm, fgsName, rq, nbbm,  
90 - df.format(jdl), jdz, remarks, sd.format(new Date()));  
91 - }else{  
92 -// jdl += jdl_.get(0);  
93 - repository.UpdateJdl(df.format(jdl), gsbm, fgsbm, rq, nbbm); 125 + String nbbm = split[3].trim();//内部编号
  126 + if ("".equals(nbbm)){
  127 + continue;
94 } 128 }
  129 + double jdl = Double.valueOf(split[4].trim().length()!=0?split[4]:"0");//加注量
  130 +
  131 + String jsy= "";//驾驶员工号
  132 + String jdz = "";//能源站
  133 + String remarks = "";//备注
  134 + Jdl j=new Jdl();
  135 + j.setGsBm(gsbm);
  136 + j.setGsName(gsName);
  137 + j.setFgsBm(fgsbm);
  138 + j.setFgsName(fgsName);
  139 + j.setNbbm(nbbm);
  140 + j.setJdl(jdl);
  141 + j.setJdz(jdz);
  142 + j.setRemarks(remarks);
  143 + j.setCreaterDate(new Date());
  144 + j.setJsy(jsy);
  145 + j.setPlate(plate);
  146 + jdlList.add(j);
95 } 147 }
  148 + transactionTemplate.execute(new TransactionCallbackWithoutResult() {
  149 + @Override
  150 + public void doInTransactionWithoutResult(TransactionStatus status) {
  151 + //删除
  152 + jdbcTemplate.update("delete from bsth_c_jdl where rq =+rq");
  153 + //重新写入
  154 + jdbcTemplate.batchUpdate("insert into bsth_c_jdl(gs_bm,gs_name,fgs_bm,fgs_name,rq,nbbm,jdl,jdz,remarks,jsy,plate)" +
  155 + " VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)", new BatchPreparedStatementSetter() {
  156 + @Override
  157 + public void setValues(PreparedStatement ps, int i) throws SQLException {
  158 + Jdl jdl = jdlList.get(i);
  159 + ps.setString(1, jdl.getGsBm());
  160 + ps.setString(2, jdl.getGsName());
  161 + ps.setString(3, jdl.getFgsBm());
  162 + ps.setString(4, jdl.getFgsName());
  163 + ps.setString(5, rq);
  164 + ps.setString(6, jdl.getNbbm());
  165 + ps.setString(7, df.format(jdl.getJdl()));
  166 + ps.setString(8, jdl.getJdz());
  167 + ps.setString(9, jdl.getRemarks());
  168 + ps.setString(10, jdl.getJsy());
  169 + ps.setString(11, jdl.getPlate());
  170 + }
  171 + @Override
  172 + public int getBatchSize() {
  173 + return jdlList.size();
  174 + }
  175 + });
  176 + }
  177 + });
96 wb.close(); 178 wb.close();
97 fs.close(); 179 fs.close();
98 } catch (Exception e) { 180 } catch (Exception e) {
@@ -108,13 +190,15 @@ public class JdlServiceImpl extends BaseServiceImpl&lt;Jdl, Integer&gt; implements Jdl @@ -108,13 +190,15 @@ public class JdlServiceImpl extends BaseServiceImpl&lt;Jdl, Integer&gt; implements Jdl
108 @Override 190 @Override
109 public Map<String, Object> query(Map<String, Object> map) { 191 public Map<String, Object> query(Map<String, Object> map) {
110 Map<String, Object> modelMap = new HashMap<String, Object>(); 192 Map<String, Object> modelMap = new HashMap<String, Object>();
111 - String gsbm = map.get("gsbm").toString();  
112 - String fgsbm = map.get("fgsbm").toString();  
113 - String rq = map.get("rq").toString();  
114 - String nbbm = map.get("nbbm").toString();  
115 -// String jsy =map.get("jsy").toString();  
116 Integer page = Integer.valueOf(map.containsKey("page")?map.get("page").toString():"0"); 193 Integer page = Integer.valueOf(map.containsKey("page")?map.get("page").toString():"0");
117 - List<Jdl> query = repository.query(gsbm, fgsbm, rq, nbbm); 194 + StringBuffer sql=new StringBuffer("SELECT * FROM bsth_c_jdl where 1=1 ");
  195 + if(map.get("rq")!=null && !"".equals(map.get("rq").toString())){
  196 + sql.append("and rq>='"+map.get("rq")+"'");
  197 + }
  198 + if(map.get("nbbm")!=null && !"".equals(map.get("nbbm").toString())){
  199 + sql.append("and nbbm='"+map.get("nbbm")+"'");
  200 + }
  201 + List<Jdl> query = jdbcTemplate.query(sql.toString(), BeanPropertyRowMapper.newInstance(Jdl.class));
118 202
119 if(!map.containsKey("type")){ 203 if(!map.containsKey("type")){
120 204
@@ -133,11 +217,12 @@ public class JdlServiceImpl extends BaseServiceImpl&lt;Jdl, Integer&gt; implements Jdl @@ -133,11 +217,12 @@ public class JdlServiceImpl extends BaseServiceImpl&lt;Jdl, Integer&gt; implements Jdl
133 m.put("nbbm", jdl.getNbbm()); 217 m.put("nbbm", jdl.getNbbm());
134 m.put("jdl", jdl.getJdl()); 218 m.put("jdl", jdl.getJdl());
135 m.put("jdz", jdl.getJdz()); 219 m.put("jdz", jdl.getJdz());
  220 + m.put("plate", jdl.getPlate());
136 m.put("remarks", jdl.getRemarks()); 221 m.put("remarks", jdl.getRemarks());
137 list.add(m); 222 list.add(m);
138 } 223 }
139 224
140 - List<Iterator<?>> listI = new ArrayList<Iterator<?>>(); 225 + /* List<Iterator<?>> listI = new ArrayList<Iterator<?>>();
141 Map<String, Object> m = new HashMap<String, Object>(); 226 Map<String, Object> m = new HashMap<String, Object>();
142 ReportUtils ee = new ReportUtils(); 227 ReportUtils ee = new ReportUtils();
143 try { 228 try {
@@ -148,9 +233,9 @@ public class JdlServiceImpl extends BaseServiceImpl&lt;Jdl, Integer&gt; implements Jdl @@ -148,9 +233,9 @@ public class JdlServiceImpl extends BaseServiceImpl&lt;Jdl, Integer&gt; implements Jdl
148 } catch (Exception e) { 233 } catch (Exception e) {
149 // TODO: handle exception 234 // TODO: handle exception
150 e.printStackTrace(); 235 e.printStackTrace();
151 - } 236 + }*/
152 } 237 }
153 return modelMap; 238 return modelMap;
154 } 239 }
155 - 240 +
156 } 241 }
src/main/java/com/bsth/service/oil/impl/JqlServiceImpl.java 0 → 100644
  1 +package com.bsth.service.oil.impl;
  2 +
  3 +import com.bsth.entity.oil.Jql;
  4 +import com.bsth.entity.report.Ticket;
  5 +import com.bsth.repository.oil.JqlRepository;
  6 +import com.bsth.service.impl.BaseServiceImpl;
  7 +import com.bsth.service.oil.JqlService;
  8 +import com.bsth.util.ReportUtils;
  9 +import org.apache.poi.hssf.usermodel.HSSFCell;
  10 +import org.apache.poi.hssf.usermodel.HSSFRow;
  11 +import org.apache.poi.hssf.usermodel.HSSFSheet;
  12 +import org.apache.poi.hssf.usermodel.HSSFWorkbook;
  13 +import org.apache.poi.poifs.filesystem.POIFSFileSystem;
  14 +import org.springframework.beans.factory.annotation.Autowired;
  15 +import org.springframework.jdbc.core.BeanPropertyRowMapper;
  16 +import org.springframework.jdbc.core.JdbcTemplate;
  17 +import org.springframework.stereotype.Service;
  18 +
  19 +import java.io.File;
  20 +import java.io.FileInputStream;
  21 +import java.text.DecimalFormat;
  22 +import java.text.SimpleDateFormat;
  23 +import java.util.*;
  24 +
  25 +@Service
  26 +public class JqlServiceImpl extends BaseServiceImpl<Jql, Integer> implements JqlService {
  27 +
  28 + @Autowired
  29 + JqlRepository repository;
  30 +
  31 + @Autowired
  32 + JdbcTemplate jdbcTemplate;
  33 +
  34 + @Override
  35 + public String importExcel(File file, String gsbm, String gsName, String fgsbm, String fgsName) {
  36 + gsbm="99";
  37 + gsName="青浦公交";
  38 + fgsbm="100";
  39 + fgsName="青浦公交";
  40 + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
  41 + SimpleDateFormat sd = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
  42 + DecimalFormat df = new DecimalFormat("######0.00");
  43 + List<String> textList = new ArrayList<String>();
  44 + try {
  45 + POIFSFileSystem fs = new POIFSFileSystem(new FileInputStream(file));
  46 + HSSFWorkbook wb = new HSSFWorkbook(fs);
  47 + HSSFSheet sheet = wb.getSheetAt(0);
  48 + // 取得总行数
  49 + int rowNum = sheet.getLastRowNum() + 1;
  50 + // 取得总列数
  51 + int cellNum = sheet.getRow(0).getLastCellNum();
  52 + HSSFRow row = null;
  53 + HSSFCell cell = null;
  54 + for(int i = 2; i < rowNum; i++){
  55 + row = sheet.getRow(i);
  56 + if (row == null){
  57 + continue;
  58 + }
  59 + String text = "";
  60 + for(int j = 0; j < cellNum; j++){
  61 + cell = row.getCell(j);
  62 + if(cell == null){
  63 + text += ",";
  64 + continue;
  65 + }
  66 + text += String.valueOf(cell) + ",";
  67 + }
  68 + String[] split = (text+";").split(",");
  69 + String str = "";
  70 + for(int j = 0; j < split.length && j < 5; j++){
  71 + str += split[j];
  72 + }
  73 + if(str.trim().length() == 0)
  74 + continue;
  75 + textList.add(text + ";");
  76 + }
  77 + for(int i = 0; i < textList.size(); i++){
  78 + String text = textList.get(i);
  79 + String[] split = text.split(",");
  80 + String rq = split[0].trim();//日期
  81 + String nbbm = split[1].trim();//内部编号
  82 + /*String jsy= split[2].trim();//驾驶员工号*/
  83 + String jsy="";
  84 + double jql = Double.valueOf(split[2].trim().length()!=0?split[2]:"0");//加注量
  85 + String jqz = split[3].trim();//能源站
  86 + String plate = split[4].trim();//车牌号
  87 + String remarks = split[5].trim();//备注
  88 + if(rq.trim().length() == 0){
  89 + rq = sdf.format(new Date());
  90 + }
  91 +
  92 + List<Double> jql_ = repository.queryBySame(gsbm, fgsbm, rq, nbbm);
  93 +
  94 + if(jql_.size() == 0){
  95 + repository.insertData(gsbm, gsName, fgsbm, fgsName, rq, nbbm,
  96 + df.format(jql), jqz, remarks, sd.format(new Date()),jsy,plate);
  97 + }else{
  98 + repository.UpdateJql(df.format(jql), gsbm, fgsbm, rq, nbbm,jsy,plate);
  99 + }
  100 + }
  101 + wb.close();
  102 + fs.close();
  103 + } catch (Exception e) {
  104 + // TODO Auto-generated catch block
  105 + e.printStackTrace();
  106 + return "文件导入失败";
  107 + } finally {
  108 + file.delete();
  109 + }
  110 + return "文件导入成功";
  111 + }
  112 +
  113 + @Override
  114 + public Map<String, Object> query(Map<String, Object> map) {
  115 + Map<String, Object> modelMap = new HashMap<String, Object>();
  116 + Integer page = Integer.valueOf(map.containsKey("page")?map.get("page").toString():"0");
  117 + StringBuffer sql=new StringBuffer("SELECT * FROM bsth_c_jql where 1=1 ");
  118 + if(map.get("rq")!=null && !"".equals(map.get("rq").toString())){
  119 + sql.append("and rq>='"+map.get("rq")+"'");
  120 + }
  121 + if(map.get("nbbm")!=null && !"".equals(map.get("nbbm").toString())){
  122 + sql.append("and nbbm='"+map.get("nbbm")+"'");
  123 + }
  124 + List<Jql> query = jdbcTemplate.query(sql.toString(), BeanPropertyRowMapper.newInstance(Jql.class));
  125 +
  126 + if(!map.containsKey("type")){
  127 +
  128 + int end = (page+1)*10>query.size()?query.size():(page+1)*10;
  129 + modelMap.put("dataList", query.subList(page*10, end));
  130 + modelMap.put("totalPages", query.size()%10>0?query.size()/10+1:query.size()/10);
  131 +
  132 + } else if(map.get("type").toString().equals("export")){
  133 + SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"),
  134 + sdfSimple = new SimpleDateFormat("yyyyMMdd");
  135 +
  136 + List<Map<String, Object>> list = new ArrayList<Map<String, Object>>();
  137 + for(Jql jql : query){
  138 + Map<String, Object> m = new HashMap<String, Object>();
  139 + m.put("rq", sdfMonth.format(jql.getRq()));
  140 + m.put("nbbm", jql.getNbbm());
  141 + m.put("jql", jql.getJql());
  142 + m.put("jqz", jql.getJqz());
  143 + m.put("plate", jql.getPlate());
  144 + m.put("remarks", jql.getRemarks());
  145 + list.add(m);
  146 + }
  147 +
  148 + /*List<Iterator<?>> listI = new ArrayList<Iterator<?>>();
  149 + Map<String, Object> m = new HashMap<String, Object>();
  150 + ReportUtils ee = new ReportUtils();
  151 + try {
  152 + listI.add(list.iterator());
  153 + String path = this.getClass().getResource("/").getPath()+"static/pages/forms/";
  154 + ee.excelReplace(listI, new Object[] { m }, path+"mould/export_Jql.xls",
  155 + path+"export/车辆加氢量" + sdfSimple.format(sdfMonth.parse(rq)) + ".xls");
  156 + } catch (Exception e) {
  157 + // TODO: handle exception
  158 + e.printStackTrace();
  159 + }*/
  160 + }
  161 + return modelMap;
  162 + }
  163 +
  164 +}
src/main/java/com/bsth/service/oil/impl/QlbServiceImpl.java 0 → 100644
  1 +package com.bsth.service.oil.impl;
  2 +
  3 +import com.alibaba.fastjson.JSONArray;
  4 +import com.alibaba.fastjson.JSONObject;
  5 +import com.bsth.common.ResponseCode;
  6 +import com.bsth.data.BasicData;
  7 +import com.bsth.entity.Cars;
  8 +import com.bsth.entity.Line;
  9 +import com.bsth.entity.oil.Jql;
  10 +import com.bsth.entity.oil.Nylog;
  11 +import com.bsth.entity.oil.Qlb;
  12 +import com.bsth.entity.oil.Ylxxb;
  13 +import com.bsth.entity.sys.SysUser;
  14 +import com.bsth.repository.CarsRepository;
  15 +import com.bsth.repository.oil.*;
  16 +import com.bsth.security.util.SecurityUtils;
  17 +import com.bsth.service.impl.BaseServiceImpl;
  18 +import com.bsth.service.oil.QlbService;
  19 +import com.bsth.service.realcontrol.ScheduleRealInfoService;
  20 +import com.bsth.util.Arith;
  21 +import com.bsth.util.BatchSaveUtils;
  22 +import org.apache.commons.lang3.StringEscapeUtils;
  23 +import org.apache.commons.lang3.StringUtils;
  24 +import org.slf4j.Logger;
  25 +import org.slf4j.LoggerFactory;
  26 +import org.springframework.beans.factory.annotation.Autowired;
  27 +import org.springframework.jdbc.core.JdbcTemplate;
  28 +import org.springframework.jdbc.core.RowMapper;
  29 +import org.springframework.stereotype.Service;
  30 +
  31 +import javax.transaction.Transactional;
  32 +import java.sql.ResultSet;
  33 +import java.sql.SQLException;
  34 +import java.text.DecimalFormat;
  35 +import java.text.ParseException;
  36 +import java.text.SimpleDateFormat;
  37 +import java.util.*;
  38 +
  39 +@Service
  40 +public class QlbServiceImpl extends BaseServiceImpl<Qlb,Integer> implements QlbService{
  41 + @Autowired
  42 + QlbRepository repository;
  43 + @Autowired
  44 + NylogRepository nylogRepository;
  45 + @Autowired
  46 + YlxxbRepository ylxxbRepository;
  47 + @Autowired
  48 + JdlRepository jdlRepository;
  49 + @Autowired
  50 + JqlRepository jqlRepository;
  51 + @Autowired
  52 + CarsRepository carsRepository;
  53 + @Autowired
  54 + ScheduleRealInfoService scheduleRealInfoService;
  55 + @Autowired
  56 + JdbcTemplate jdbcTemplate;
  57 +
  58 + Logger logger = LoggerFactory.getLogger(this.getClass());
  59 +
  60 + @Transactional
  61 + @Override
  62 + public String obtainDsq() throws Exception{
  63 + String result = "failure";
  64 + List<Cars> carsList=carsRepository.findCars();
  65 + Map<String, Boolean> carsMap=new HashMap<String, Boolean>();
  66 + for (int i = 0; i < carsList.size(); i++) {
  67 + Cars c=carsList.get(i);
  68 + carsMap.put(c.getInsideCode(), c.getHydrogen());
  69 + }
  70 + SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd");
  71 + Date dNow = new Date(); //当前时间
  72 + Date dBefore = new Date();
  73 + Calendar calendar = Calendar.getInstance(); //得到日历
  74 + calendar.setTime(dNow);//把当前时间赋给日历
  75 + calendar.add(Calendar.DAY_OF_MONTH, -1); //设置为前一天
  76 + dBefore = calendar.getTime(); //得到前一天的时间
  77 + String rq=sdf.format(dBefore);
  78 +// String rq="2017-11-02";
  79 + String line="";
  80 + //保留两位小数
  81 + DecimalFormat df = new DecimalFormat("#.00");
  82 + // TODO Auto-generated method stub
  83 + Map<String, Object> newMap=new HashMap<String,Object>();
  84 + //当天QLB信息
  85 + List<Qlb> qlList=repository.obtainQl(rq, "", "", line, "", "nbbm");
  86 + //当天YLXXB信息
  87 + List<Ylxxb> ylxxList=ylxxbRepository.obtainYlxx(rq,1,"");
  88 + //当天加氢信息表
  89 + List<Jql> jqlList=jqlRepository.JqlList(rq);
  90 + //前一天所有车辆最后进场班次信息
  91 + List<Qlb> qlListBe=repository.obtainQlbefore(rq, "", "", "", "");
  92 + //从排班表中计算出行驶的总里程
  93 + List<Map<String,Object>> listpb=scheduleRealInfoService.yesterdayDataList(line,rq,"","","","");
  94 + for(int x=0;x<listpb.size();x++){
  95 + String type="add";
  96 + boolean sfHydrogen=false;
  97 + Map<String, Object> map=listpb.get(x);
  98 + if (carsMap.get(map.get("clZbh").toString())!=null) {
  99 + sfHydrogen = carsMap.get(map.get("clZbh").toString());
  100 + }else{
  101 + sfHydrogen = false;
  102 + }
  103 + if(sfHydrogen){
  104 + //判断驾驶员驾驶的该车辆是否已经存入了(查出的结果集中日期是相同的,根据驾驶员、内部编号、线路编码判断)
  105 + Qlb t=new Qlb();
  106 + for(int k=0;k<qlList.size();k++){
  107 + Qlb t1=qlList.get(k);
  108 + if(t1.getNbbm().equals(map.get("clZbh").toString())
  109 + &&t1.getJsy().equals(map.get("jGh").toString())
  110 + &&t1.getXlbm().equals(map.get("xlBm").toString())
  111 + &&t1.getLp().equals(map.get("lpName").toString()))
  112 + {
  113 + t=t1;
  114 + type="update";
  115 + }
  116 + }
  117 + try {
  118 + //当日的第一个班次,出场油量等于前一天的最后一个班次的进场油量
  119 + Double jzl=0.0;
  120 + if(map.get("seqNumber").toString().equals("1")){
  121 + boolean fage=true;
  122 + for (int i = 0; i < qlListBe.size(); i++) {
  123 + Qlb qlb=qlListBe.get(i);
  124 + if(map.get("clZbh").toString().equals(qlb.getNbbm())){
  125 + t.setCzcl(qlb.getJzcl());
  126 + fage=false;
  127 + break;
  128 + }
  129 + }
  130 + if(fage){
  131 + t.setCzcl(0.0);
  132 + }
  133 +
  134 + //手动导入没有驾驶员工号
  135 + for (int i = 0; i < jqlList.size(); i++) {
  136 + Jql jql=jqlList.get(i);
  137 + if(map.get("clZbh").toString().equals(jql.getNbbm())
  138 + &&map.get("jGh").toString().equals(jql.getJsy())){
  139 + jzl+=jql.getJql();
  140 + }
  141 + }
  142 + }
  143 +
  144 +
  145 +// //把当天的YLXXB的加注量设置为当天YLB的加注量(根据车号,驾驶员判断)
  146 +// for(int j=0;j<ylxxList.size();j++){
  147 +// Ylxxb ylxxb = ylxxList.get(j);
  148 +// if(map.get("clZbh").toString().equals(ylxxb.getNbbm()) &&map.get("jGh").toString().equals(ylxxb.getJsy())){
  149 +// jzl+=ylxxb.getJzl();
  150 +// }
  151 +// }
  152 +
  153 + t.setJql(jzl);
  154 + if(type.equals("add")){
  155 + t.setHn(jzl);
  156 + t.setJzcl(t.getCzcl());
  157 + }
  158 +
  159 + t.setNbbm(map.get("clZbh").toString());
  160 + t.setJsy(map.get("jGh")==null?"":map.get("jGh").toString());
  161 + t.setZlc(map.get("totalKilometers")==null?0.0:Double.parseDouble(df.format(Double.parseDouble(map.get("totalKilometers").toString()))));
  162 + t.setXlbm(map.get("xlBm")==null?"":map.get("xlBm").toString());
  163 + t.setLinename(map.get("lineName")==null?"":map.get("lineName").toString());
  164 + t.setJcsx(Integer.parseInt(map.get("seqNumber").toString()));
  165 + t.setSsgsdm(map.get("company")==null?"":map.get("company").toString());
  166 + t.setFgsdm(map.get("bCompany")==null?"":map.get("bCompany").toString());
  167 + t.setJhsj(map.get("fcsj")==null?"":map.get("fcsj").toString());
  168 + t.setLp(map.get("lpName").toString());
  169 + t.setRq(sdf.parse(rq));
  170 + t.setCreatetime(new Date());
  171 + t.setJname(map.get("jName").toString());
  172 + repository.save(t);
  173 + newMap.put("status", ResponseCode.SUCCESS);
  174 + } catch (ParseException e) {
  175 + // TODO Auto-generated catch block
  176 + newMap.put("status", ResponseCode.ERROR);
  177 + e.printStackTrace();
  178 + }
  179 + }
  180 + }
  181 + return result;
  182 + }
  183 +
  184 + /**
  185 + * 获取进存油信息
  186 + * @Transactional 回滚事物
  187 + */
  188 + @Transactional
  189 + @Override
  190 + public Map<String, Object> obtain(Map<String, Object> map2) throws Exception{
  191 + Map<String, Object> newMap = new HashMap<String, Object>();
  192 + try {
  193 + Date date=new Date();
  194 + List<Cars> carsList = carsRepository.findCars();
  195 + Map<String, Boolean> carsMap = new HashMap<String, Boolean>();
  196 + for (int i = 0; i < carsList.size(); i++) {
  197 + Cars c = carsList.get(i);
  198 + carsMap.put(c.getInsideCode(), c.getHydrogen());
  199 + }
  200 + String rq = map2.get("rq").toString();
  201 + String line = "";
  202 + if (map2.get("xlbm_like") != null) {
  203 + line = map2.get("xlbm_like").toString().trim();
  204 + }
  205 + String gsbm="";
  206 + if(map2.get("ssgsdm_like")!=null){
  207 + gsbm=map2.get("ssgsdm_like").toString();
  208 + }
  209 + String fgsbm="";
  210 + if(map2.get("fgsdm_like")!=null){
  211 + fgsbm=map2.get("fgsdm_like").toString();
  212 + }
  213 + String nbbm="";
  214 + if(map2.get("nbbm_eq")!=null){
  215 + nbbm=map2.get("nbbm_eq").toString();
  216 + }
  217 + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
  218 + // 保留两位小数
  219 + DecimalFormat df = new DecimalFormat("#.00");
  220 + // TODO Auto-generated method stub
  221 + // 当天QLB信息
  222 + List<Qlb> qlList = this.listOrderBy(rq,gsbm,fgsbm,"",nbbm,"nbbm");
  223 + // 当天YLXXB信息
  224 + List<Ylxxb> ylxxList = ylxxbRepository.obtainYlxx(rq, 0, gsbm);
  225 + // 从排班表中计算出行驶的总里程
  226 + List<Map<String, Object>> listpb =new ArrayList<Map<String, Object>>();
  227 + List<Map<String, Object>> listpbs=scheduleRealInfoService.yesterdayDataList("", rq, gsbm, fgsbm, "", nbbm);
  228 + Map<String, Double> lcMap=new HashMap<String,Double>();
  229 + for (int i = 0; i < listpbs.size(); i++) {
  230 + String cl=listpbs.get(i).get("clZbh").toString();
  231 + Double lc=listpbs.get(i).get("totalKilometers") == null ? 0.0
  232 + : Double.parseDouble(listpbs.get(i).get("totalKilometers").toString());
  233 + if(lcMap.get(cl)==null){
  234 + lcMap.put(cl, lc);
  235 + }else{
  236 + double lc_=lcMap.get(cl);
  237 + lcMap.remove(cl);
  238 + lcMap.put(cl, Arith.add(lc, lc_));
  239 + }
  240 + }
  241 +
  242 + List<Jql> jqlList=jqlRepository.JqlList(rq);
  243 + List<Jql> jqlList_1=jqlRepository.JqlList_1(rq, gsbm, "-1");
  244 + String sxtj=map2.get("sxtj").toString();
  245 + if(sxtj.equals("0")){
  246 + listpb=listpbs;
  247 + }else{
  248 + List<Object[]> objectLists=repository.checkNbmmNum(rq, gsbm, fgsbm, "", nbbm);
  249 + List<String> stringList=new ArrayList<String>();
  250 + for (int i = 0; i < objectLists.size(); i++) {
  251 + String clbm=objectLists.get(i)[0].toString();
  252 + int cs=Integer.parseInt(objectLists.get(i)[1].toString());
  253 + //一车一单
  254 + if(sxtj.equals("1")){
  255 + if(cs==1){
  256 + stringList.add(clbm);
  257 + }
  258 + }
  259 + //一车多单
  260 + if(sxtj.equals("2")){
  261 + if(cs>1){
  262 + stringList.add(clbm);
  263 + }
  264 + }
  265 + }
  266 +
  267 + for (int i = 0; i < stringList.size(); i++) {
  268 + String strNbbm=stringList.get(i);
  269 + for (int j = 0; j < listpbs.size(); j++) {
  270 + Map<String, Object> map = listpbs.get(j);
  271 + String mapNbbm=map.get("clZbh").toString();
  272 + if(strNbbm.equals(mapNbbm)){
  273 + listpb.add(map);
  274 + }
  275 + }
  276 + }
  277 + }
  278 + Map<String, Object> newMap_=new HashMap<String,Object>();
  279 + List<Qlb> addList = new ArrayList<Qlb>();
  280 + List<Qlb> updateList = new ArrayList<Qlb>();
  281 + Map<String, Object> cMap=new HashMap<String, Object>();
  282 + List<Map<String, Object>> listpb_=listpb;
  283 + Collections.sort(listpb,new NbbmJcsxMap2());
  284 +
  285 + Map<String, String> clFgs=new HashMap<String, String>(); // 电车当天在哪几个公司运营了
  286 + for(int x = 0; x < listpb_.size(); x++){
  287 + boolean sfHydrogen = false;
  288 + Map<String, Object> map_ = listpb_.get(x);
  289 + String clZbh = map_.get("clZbh").toString();
  290 + if (carsMap.get(clZbh) != null) {
  291 + sfHydrogen = carsMap.get(clZbh);
  292 + } else {
  293 + sfHydrogen = false;
  294 + }
  295 + if (sfHydrogen) {
  296 + if(clFgs.get(clZbh)==null){
  297 + clFgs.put(clZbh, "");
  298 + }
  299 + String gsFgs = map_.get("company").toString() + "_" + map_.get("bCompany").toString();
  300 + if(!(clFgs.get(clZbh).contains(gsFgs))){
  301 + clFgs.put(clZbh, clFgs.get(clZbh) + "/" + gsFgs);
  302 + }
  303 + }
  304 + }
  305 +
  306 + for (int x = 0; x < listpb_.size(); x++) {
  307 + String type = "add";
  308 + boolean sfHydrogen = false;
  309 + Map<String, Object> map_ = listpb_.get(x);
  310 + if (carsMap.get(map_.get("clZbh").toString()) != null) {
  311 + sfHydrogen = carsMap.get(map_.get("clZbh").toString());
  312 + } else {
  313 + sfHydrogen = false;
  314 + }
  315 + if (sfHydrogen) {
  316 + if(newMap_.get(map_.get("clZbh").toString())==null){
  317 + newMap_.put(map_.get("clZbh").toString(), map_.get("clZbh").toString());
  318 + //车辆总里程
  319 + double zlc =lcMap.get(map_.get("clZbh").toString());
  320 + //车辆总加氢量
  321 + double zjzl = 0.0, zjzl_1 = 0.0;
  322 +// for (int j = 0; j < ylxxList.size(); j++) {
  323 +// Ylxxb ylxxb = ylxxList.get(j);
  324 +// if (map_.get("clZbh").toString().equals(ylxxb.getNbbm())
  325 +// && map_.get("company").toString().equals(ylxxb.getGsdm())) {
  326 +// zjzl = Arith.add(zjzl, ylxxb.getJzl());
  327 +// }
  328 +// }
  329 + for (int i = 0; i < jqlList.size(); i++) {
  330 + Jql jql=jqlList.get(i);
  331 + if(map_.get("clZbh").toString().equals(jql.getNbbm())
  332 + &&clFgs.get(map_.get("clZbh").toString()).contains(jql.getGsBm()+"_"+jql.getFgsBm())){
  333 + zjzl = Arith.add(zjzl,jql.getJql());
  334 + }
  335 + }
  336 +
  337 + int num = 0; // 2022年12月20号要求不按车队导入,这之后导入的加注量将覆盖原加注量
  338 + for (int i = 0; i < jqlList_1.size(); i++) {
  339 + Jql jql=jqlList_1.get(i);
  340 + if(map_.get("clZbh").toString().equals(jql.getNbbm())
  341 + &&map_.get("company").toString().equals(jql.getGsBm())){
  342 + zjzl_1 = Arith.add(zjzl_1,jql.getJql());
  343 + num++;
  344 + }
  345 + }
  346 + if(num > 0){
  347 + zjzl = zjzl_1;
  348 + }
  349 +
  350 + Double nextJzyl = 0.0;
  351 + for (int i = 0; i < listpb.size(); i++) {
  352 + Map<String, Object> map = listpb.get(i);
  353 + if(map_.get("clZbh").toString().equals(map.get("clZbh").toString())){
  354 + // 判断驾驶员驾驶的该车辆是否已经存入了(查出的结果集中日期是相同的,根据驾驶员、内部编号、线路编码判断)
  355 + Qlb t = new Qlb();
  356 + for (int k = 0; k < qlList.size(); k++) {
  357 + Qlb t1 = qlList.get(k);
  358 + if (t1.getNbbm().equals(map.get("clZbh").toString())
  359 + && t1.getJsy().equals(map.get("jGh").toString())
  360 + && t1.getXlbm().equals(map.get("xlBm").toString())) {
  361 + if(t1.getLp()==null){
  362 + //同人同车同线路不同路牌的过滤 (考虑到历史数据)
  363 + if (cMap.get(map.get("clZbh").toString()+map.get("jGh").toString()+map.get("xlBm").toString())==null) {
  364 + t = t1;
  365 + type = "update";
  366 + cMap.put(map.get("clZbh").toString()+map.get("jGh").toString()+map.get("xlBm").toString(),
  367 + map.get("clZbh").toString());
  368 + }
  369 + }else{
  370 + if(t1.getLp().equals(map.get("lpName").toString())){
  371 + t = t1;
  372 + type = "update";
  373 + }
  374 +
  375 + }
  376 + }
  377 + }
  378 + Double lc= Double.parseDouble(map.get("totalKilometers").toString());
  379 + if(map.get("seqNumber").toString().equals("1")){
  380 + // 当日的第一个班次,出场油量等于前一天的最后一个班次的进场油量
  381 + Double dh=0.0;
  382 + if(zlc>0){
  383 + dh = Double.parseDouble(df.format(zjzl * (lc / zlc)));
  384 + }
  385 + nextJzyl =Arith.sub(zjzl,dh);
  386 + if(zlc>0){
  387 +// long l=Math.round(nextJzyl);
  388 + double ylxs=nextJzyl;
  389 + dh=Arith.add(dh, Arith.sub(nextJzyl,ylxs));
  390 + if(dh<0){
  391 + t.setHn(0.0);
  392 + t.setJql(0.0);
  393 + nextJzyl=Arith.add(ylxs, dh);
  394 + }else{
  395 + t.setHn(dh);
  396 + t.setJql(dh);
  397 + nextJzyl=ylxs;
  398 + }
  399 + }else{
  400 + t.setHn(0.0);
  401 + t.setJql(0.0);
  402 + }
  403 + }else{
  404 + Double dh=0.0;
  405 + if(zlc>0){
  406 + dh = Double.parseDouble(df.format(zjzl * (lc / zlc)));
  407 + }
  408 + nextJzyl =Arith.sub( nextJzyl,dh);
  409 + if(zlc>0){
  410 +// long l=0l;
  411 + double ylxs=0.0;
  412 + if(i==listpb.size()-1){
  413 +// ylxs=czyl;
  414 + }else{
  415 + if(listpb.get(i+1).get("clZbh").toString().equals(map.get("clZbh").toString())){
  416 +// l=Math.round(nextJzyl);
  417 + ylxs=nextJzyl;
  418 + }
  419 +
  420 + }
  421 + dh=Arith.add(dh, Arith.sub(nextJzyl,ylxs));
  422 + if(dh<0){
  423 + t.setHn(0.0);
  424 + t.setJql(0.0);
  425 + nextJzyl=Arith.add(ylxs, dh);
  426 + }else{
  427 + t.setHn(dh);
  428 + t.setJql(dh);
  429 + nextJzyl=ylxs;
  430 + }
  431 + }else{
  432 + t.setHn(0.0);
  433 + t.setJql(0.0);
  434 + }
  435 + }
  436 + t.setCzcl(100.0);
  437 + t.setJzcl(100.0);
  438 + t.setNbbm(map.get("clZbh").toString());
  439 + t.setJsy(map.get("jGh") == null ? "" : map.get("jGh").toString());
  440 + t.setZlc(map.get("totalKilometers") == null ? 0.0
  441 + : Double.parseDouble(map.get("totalKilometers").toString()));
  442 + t.setXlbm(map.get("xlBm") == null ? "" : map.get("xlBm").toString());
  443 + t.setLinename(map.get("lineName")==null?"":map.get("lineName").toString());
  444 + t.setJcsx(Integer.parseInt(map.get("seqNumber").toString()));
  445 + t.setSsgsdm(map.get("company") == null ? "" : map.get("company").toString());
  446 + t.setFgsdm(map.get("bCompany") == null ? "" : map.get("bCompany").toString());
  447 + t.setJhsj(map.get("fcsj")==null?"":map.get("fcsj").toString());
  448 + t.setRq(sdf.parse(rq));
  449 + t.setLp(map.get("lpName").toString());
  450 + t.setJname(map.get("jName").toString());
  451 + if (!(t.getSsgsdm().equals("") || t.getFgsdm().equals(""))) {
  452 + if (t.getHn() < 0) {
  453 + t.setHn(0.0);
  454 + }
  455 + if (t.getJql() < 0) {
  456 + t.setJql(0.0);
  457 + }
  458 + if (type.equals("add")) {
  459 + t.setCreatetime(date);
  460 + addList.add(t);
  461 + } else {
  462 + t.setUpdatetime(date);
  463 + updateList.add(t);
  464 + }
  465 + }
  466 + newMap.put("status", ResponseCode.SUCCESS);
  467 + }
  468 + }
  469 + }
  470 + }
  471 + }
  472 + if(addList.size()>0){
  473 + try {
  474 + new BatchSaveUtils<Qlb>().saveList2(addList, Qlb.class);
  475 + } catch (Exception e) {
  476 + // TODO: handle exception
  477 + if(e.getMessage().indexOf("PK_QLB_UK")>0){
  478 + newMap.put("fage", "存在相同数据,数据已经过滤");
  479 + logger.info("获取:存在相同数据,数据已经过滤");
  480 + }
  481 + }
  482 +
  483 + }
  484 +
  485 + if(updateList.size()>0){
  486 + for (int i = 0; i < updateList.size(); i++) {
  487 + repository.save(updateList.get(i));
  488 + }
  489 + }
  490 + SysUser user = SecurityUtils.getCurrentUser();
  491 + Nylog nylog=new Nylog();
  492 + nylog.setCreatedate(new Date());
  493 + nylog.setCzmc("获取");
  494 + nylog.setNylx("氢");
  495 + nylog.setUserid(user.getUserName());
  496 + nylog.setUsername(user.getName());
  497 + nylog.setCxtj(line+"-"+ date+"-"+gsbm+"-"+fgsbm);
  498 + nylogRepository.save(nylog);
  499 + newMap.put("status", ResponseCode.SUCCESS);
  500 + } catch (Exception e) {
  501 + // TODO Auto-generated catch block
  502 + newMap.put("status", ResponseCode.ERROR);
  503 + throw e;
  504 + }
  505 +
  506 + return newMap;
  507 + }
  508 +
  509 + /**
  510 + * 拆分
  511 + */
  512 + @Transactional
  513 + @Override
  514 + public Map<String, Object> sort(Map<String, Object> map) {
  515 + // TODO Auto-generated method stub
  516 + Map<String, Object> newMap = new HashMap<String, Object>();
  517 + try{
  518 + int id=Integer.parseInt(map.get("id").toString());
  519 + //最后存油量
  520 + Double jzcl=Double.parseDouble(map.get("jzdl").toString());
  521 + Double hn=Double.parseDouble(map.get("hdl").toString());
  522 + Qlb qlb=repository.findById(id);
  523 + qlb.setJzcl(jzcl);
  524 + qlb.setHn(hn);
  525 + repository.save(qlb);
  526 + newMap.put("status", ResponseCode.SUCCESS);
  527 + }catch(Exception e){
  528 + newMap.put("status", ResponseCode.ERROR);
  529 + logger.error("save erro.", e);
  530 + }
  531 + return newMap;
  532 + }
  533 +
  534 +
  535 + /**
  536 + * 核对,有加注没里程
  537 + * @param map
  538 + * @return
  539 + */
  540 + @Transactional
  541 + @Override
  542 + public Map<String, Object> checkQl(Map<String, Object> map) {
  543 + Map<String, Object> newMap=new HashMap<String,Object>();
  544 +
  545 + try{
  546 + //获取车辆存油信息
  547 +
  548 + String rq=map.get("rq").toString();
  549 + String xlbm="";
  550 + if(map.get("xlbm_like")!=null){
  551 + xlbm= map.get("xlbm_like").toString().trim();
  552 + }
  553 + String gsbm="";
  554 + if(map.get("ssgsdm_like")!=null){
  555 + gsbm=map.get("ssgsdm_like").toString();
  556 + }
  557 + String fgsbm="";
  558 + if(map.get("fgsdm_like")!=null){
  559 + fgsbm=map.get("fgsdm_like").toString();
  560 + }
  561 + String nbbm="";
  562 + if(map.get("nbbm_eq")!=null){
  563 + nbbm=map.get("nbbm_eq").toString();
  564 + }
  565 +
  566 + String sql="select * from bsth_c_jql j where"
  567 + + " j.gs_bm = ? and j.fgs_bm = ? and rq = ? "
  568 + + " and nbbm not in (select nbbm from bsth_c_qlb d "
  569 + + " where ssgsdm = ? and fgsdm = ? and rq = ?)";
  570 + Object[] objects = {gsbm, fgsbm, rq, gsbm, fgsbm, rq};
  571 + List<Jql> listJql=jdbcTemplate.query(sql,
  572 + objects,
  573 + new RowMapper<Jql>(){
  574 + @Override
  575 + public Jql mapRow(ResultSet rs, int rowNum) throws SQLException {
  576 + Jql s = new Jql();
  577 + s.setNbbm(rs.getString("nbbm"));
  578 + s.setGsBm(rs.getString("gs_bm"));
  579 + s.setFgsBm(rs.getString("fgs_bm"));
  580 + s.setJql(rs.getDouble("jql"));
  581 + s.setRq(rs.getDate("rq"));
  582 + return s;
  583 + }
  584 + });
  585 + for (int i = 0; i < listJql.size(); i++) {
  586 + Jql j=listJql.get(i);
  587 + Qlb t=new Qlb();
  588 + Line line = BasicData.nbbm2LineMap.get(j.getNbbm());
  589 + if(null !=line){
  590 + t.setJql(j.getJql());
  591 + t.setNbbm(j.getNbbm());
  592 + t.setRq(j.getRq());
  593 + t.setJsy("");
  594 + t.setJql(j.getJql());
  595 + t.setSsgsdm(j.getGsBm());
  596 + t.setFgsdm(j.getFgsBm());
  597 + t.setJzcl(100.0);
  598 + t.setCzcl(100.0);
  599 + t.setHn(0.0);
  600 + t.setJcsx(1);
  601 + t.setXlbm(line.getLineCode());
  602 + t.setLp("");
  603 + repository.save(t);
  604 + }
  605 + }
  606 +
  607 + SysUser user = SecurityUtils.getCurrentUser();
  608 + Nylog nylog=new Nylog();
  609 + nylog.setCreatedate(new Date());
  610 + nylog.setCzmc("核对");
  611 + nylog.setNylx("氢");
  612 + nylog.setUserid(user.getUserName());
  613 + nylog.setUsername(user.getName());
  614 + nylog.setCxtj(xlbm+"-"+ rq+"-"+gsbm+"-"+fgsbm);
  615 + nylogRepository.save(nylog);
  616 + newMap.put("status", ResponseCode.SUCCESS);
  617 + }catch(Exception e){
  618 + newMap.put("status", ResponseCode.ERROR);
  619 + logger.error("save erro.", e);
  620 + throw e;
  621 + }
  622 +
  623 + return newMap;
  624 + }
  625 +
  626 + @Override
  627 + public List<Qlb> listQlb(Map<String, Object> map) {
  628 + // TODO Auto-generated method stub
  629 + List<Qlb> listQlb = new ArrayList<Qlb>();
  630 + List<String> stringList = new ArrayList<String>();
  631 + String rq = map.get("rq").toString();
  632 + String gsbm = map.get("ssgsdm_like").toString();
  633 + String fgsbm = map.get("fgsdm_like").toString();
  634 + String xlbm = map.get("xlbm_like").toString().trim();
  635 + String nbbm = map.get("nbbm_eq").toString();
  636 + String sxtj = map.get("sxtj").toString();
  637 + String type = map.get("type").toString();
  638 + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
  639 + try {
  640 + if (nbbm.trim() != "") {
  641 + stringList.add(nbbm);
  642 + if (type.equals("1"))
  643 + listQlb = repository.listQlb(rq, gsbm, fgsbm, xlbm, stringList);
  644 + else
  645 + listQlb = repository.listQlb_s(sdf.parse(rq + " 00:00:00"), gsbm, fgsbm, xlbm, stringList);
  646 +
  647 + } else {
  648 + // 全部
  649 + if (sxtj.equals("0")) {
  650 + List<Object[]> objectLists = repository.checkNbmmNum(rq, gsbm, fgsbm, xlbm, nbbm);
  651 + for (int i = 0; i < objectLists.size(); i++) {
  652 + String clbm = objectLists.get(i)[0].toString();
  653 + stringList.add(clbm);
  654 + }
  655 + if (stringList.size() > 0) {
  656 + if (type.equals("1"))
  657 + listQlb = repository.listQlb(rq, gsbm, fgsbm, xlbm, stringList);
  658 + else
  659 + listQlb = repository.listQlb_s(sdf.parse(rq + " 00:00:00"), gsbm, fgsbm, xlbm, stringList);
  660 + }
  661 + } else {
  662 + List<Object[]> objectLists;
  663 + if (sxtj.equals("3")) {
  664 + // 有加油没里程
  665 + objectLists = repository.checkNbmmQl(rq, gsbm, fgsbm, xlbm, nbbm);
  666 + for (int i = 0; i < objectLists.size(); i++) {
  667 + String clbm = objectLists.get(i)[0].toString();
  668 + double jzl = Double.parseDouble(objectLists.get(i)[1].toString());
  669 + double zlc = Double.parseDouble(objectLists.get(i)[2].toString());
  670 + if (jzl > 0 && zlc <= 0) {
  671 + stringList.add(clbm);
  672 + }
  673 +
  674 + }
  675 +
  676 + } else if (sxtj.equals("4")) {
  677 + // 有里程没加油
  678 + objectLists = repository.checkNbmmQl(rq, gsbm, fgsbm, xlbm, nbbm);
  679 + for (int i = 0; i < objectLists.size(); i++) {
  680 + String clbm = objectLists.get(i)[0].toString();
  681 + double jzl = Double.parseDouble(objectLists.get(i)[1].toString());
  682 + double zlc = Double.parseDouble(objectLists.get(i)[2].toString());
  683 + if (zlc > 0 && jzl <= 0) {
  684 + stringList.add(clbm);
  685 + }
  686 +
  687 + }
  688 + } else {
  689 + objectLists = repository.checkNbmmNum(rq, gsbm, fgsbm, xlbm, nbbm);
  690 + for (int i = 0; i < objectLists.size(); i++) {
  691 + String clbm = objectLists.get(i)[0].toString();
  692 + int cs = Integer.parseInt(objectLists.get(i)[1].toString());
  693 + // 一车一单
  694 + if (sxtj.equals("1")) {
  695 + if (cs == 1) {
  696 + stringList.add(clbm);
  697 + }
  698 + }
  699 + // 一车多单
  700 + if (sxtj.equals("2")) {
  701 + if (cs > 1) {
  702 + stringList.add(clbm);
  703 + }
  704 + }
  705 + }
  706 + }
  707 +
  708 + if (stringList.size() > 0) {
  709 + if (type.equals("1"))
  710 + listQlb = repository.listQlb(rq, gsbm, fgsbm, xlbm, stringList);
  711 + else
  712 + listQlb = repository.listQlb_s(sdf.parse(rq + " 00:00:00"), gsbm, fgsbm, xlbm, stringList);
  713 + }
  714 + }
  715 + }
  716 + } catch (ParseException e) {
  717 + // TODO Auto-generated catch block
  718 + e.printStackTrace();
  719 + }
  720 + return listQlb;
  721 + }
  722 +
  723 + @Override
  724 + public Map<String, Object> sumQlb(Map<String, Object> map) {
  725 + // TODO Auto-generated method stub
  726 + List<String> stringList = new ArrayList<String>();
  727 + String rq = map.get("rq").toString();
  728 + String gsbm = map.get("ssgsdm_like").toString();
  729 + String fgsbm = map.get("fgsdm_like").toString();
  730 + String xlbm = map.get("xlbm_like").toString().trim();
  731 + String nbbm = map.get("nbbm_eq").toString();
  732 + String sxtj = map.get("sxtj").toString();
  733 + String type = map.get("type").toString();
  734 + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
  735 + List<Object[]> sumQlbList = new ArrayList<Object[]>();
  736 + try {
  737 + if (nbbm.trim() != "") {
  738 + stringList.add(nbbm);
  739 + } else {
  740 + if (!sxtj.equals("0")) {
  741 + List<Object[]> objectLists;
  742 + if (sxtj.equals("3")) {
  743 + // 有加油没里程
  744 + objectLists = repository.checkNbmmQl(rq, gsbm, fgsbm, xlbm, nbbm);
  745 + for (int i = 0; i < objectLists.size(); i++) {
  746 + String clbm = objectLists.get(i)[0].toString();
  747 + double jzl = Double.parseDouble(objectLists.get(i)[1].toString());
  748 + double zlc = Double.parseDouble(objectLists.get(i)[2].toString());
  749 + if (jzl > 0 && zlc <= 0) {
  750 + stringList.add(clbm);
  751 + }
  752 +
  753 + }
  754 +
  755 + } else if (sxtj.equals("4")) {
  756 + // 有里程没加油
  757 + objectLists = repository.checkNbmmQl(rq, gsbm, fgsbm, xlbm, nbbm);
  758 + for (int i = 0; i < objectLists.size(); i++) {
  759 + String clbm = objectLists.get(i)[0].toString();
  760 + double jzl = Double.parseDouble(objectLists.get(i)[1].toString());
  761 + double zlc = Double.parseDouble(objectLists.get(i)[2].toString());
  762 + if (zlc > 0 && jzl <= 0) {
  763 + stringList.add(clbm);
  764 + }
  765 +
  766 + }
  767 + } else {
  768 + objectLists = repository.checkNbmmNum(rq, gsbm, fgsbm, xlbm, nbbm);
  769 + for (int i = 0; i < objectLists.size(); i++) {
  770 + String clbm = objectLists.get(i)[0].toString();
  771 + int cs = Integer.parseInt(objectLists.get(i)[1].toString());
  772 + // 一车一单
  773 + if (sxtj.equals("1")) {
  774 + if (cs == 1) {
  775 + stringList.add(clbm);
  776 + }
  777 + }
  778 + // 一车多单
  779 + if (sxtj.equals("2")) {
  780 + if (cs > 1) {
  781 + stringList.add(clbm);
  782 + }
  783 + }
  784 + }
  785 + }
  786 + }
  787 + }
  788 + if (sxtj.equals("0")) {
  789 + sumQlbList = repository.sumQlb2(rq, gsbm, fgsbm, xlbm, nbbm);
  790 + } else {
  791 + if (stringList.size() > 0) {
  792 + if (type.equals("1"))
  793 + sumQlbList = repository.sumQlb(rq, gsbm, fgsbm, xlbm, stringList);
  794 + else
  795 + sumQlbList = repository.sumQlb_s(sdf.parse(rq + " 00:00:00"), gsbm, fgsbm, xlbm, stringList);
  796 +
  797 + }
  798 + }
  799 + } catch (ParseException e) {
  800 + // TODO Auto-generated catch block
  801 + e.printStackTrace();
  802 + }
  803 + Double jzl = 0.0, yh = 0.0, sh = 0.0;
  804 + for (int i = 0; i < sumQlbList.size(); i++) {
  805 + jzl = Arith.add(jzl, Double.valueOf(sumQlbList.get(i)[0].toString()));
  806 + yh = Arith.add(yh, Double.valueOf(sumQlbList.get(i)[1].toString()));
  807 + sh = Arith.add(sh, Double.valueOf(sumQlbList.get(i)[2].toString()));
  808 + }
  809 +
  810 + Map<String, Object> sumMap = new HashMap<String, Object>();
  811 + sumMap.put("jzl", jzl);
  812 + sumMap.put("yh", yh);
  813 + sumMap.put("sh", sh);
  814 + return sumMap;
  815 + }
  816 +
  817 +
  818 + @Transactional
  819 + @Override
  820 + public Map<String, Object> saveQlbList(Map<String, Object> map) throws Exception {
  821 + // TODO Auto-generated method stub
  822 + Map<String, Object> newMap=new HashMap<String,Object>();
  823 + try{
  824 + SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd");
  825 + String json =StringEscapeUtils.unescapeHtml4(map.get("qlbList").toString());
  826 + JSONArray jsonArray=JSONArray.parseArray(json);
  827 + JSONObject jsonObject;
  828 + for (int i = 0; i < jsonArray.size(); i++) {
  829 + jsonObject=jsonArray.getJSONObject(i);
  830 + double czcl = jsonObject.getDoubleValue("czcl");
  831 +// double jql =jsonObject.getDoubleValue("jql");
  832 + double jzcl =jsonObject.getDoubleValue("jzcl");
  833 + double sh =jsonObject.getDoubleValue("sh");
  834 + String shyy =jsonObject.getString("shyy");
  835 + double hn = jsonObject.getDoubleValue("hn");
  836 + int nhlx =jsonObject.getIntValue("nhlx");
  837 + Integer id =jsonObject.getInteger("id");
  838 + repository.qlbUpdate(id, czcl, jzcl, hn, sh, shyy, nhlx);
  839 +
  840 + }
  841 +
  842 + SysUser user = SecurityUtils.getCurrentUser();
  843 + Nylog nylog=new Nylog();
  844 + nylog.setCreatedate(new Date());
  845 + nylog.setCzmc("保存全部");
  846 + nylog.setNylx("氢");
  847 + nylog.setUserid(user.getUserName());
  848 + nylog.setUsername(user.getName());
  849 + nylog.setCxtj("");
  850 + nylogRepository.save(nylog);
  851 + newMap.put("status", ResponseCode.SUCCESS);
  852 + }catch(Exception e){
  853 + newMap.put("status", ResponseCode.ERROR);
  854 + logger.error("save erro.", e);
  855 + throw e;
  856 + }
  857 + return newMap;
  858 + }
  859 +
  860 + public List<Qlb> listOrderBy(String rq,String gsdm,
  861 + String fgsdm,String xlbm,String nbbm,
  862 + String px) {
  863 +
  864 + List<String> objList = new ArrayList<>();
  865 + String sql="SELECT * FROM bsth_c_qlb "
  866 + + " where rq=? ";
  867 + objList.add(rq);
  868 + if(gsdm.trim().length() > 0 && fgsdm.trim().length() > 0){
  869 + sql += " and ssgsdm like CONCAT('%',?,'%') "
  870 + + " and fgsdm like CONCAT('%',?,'%') ";
  871 + objList.add(gsdm);
  872 + objList.add(fgsdm);
  873 + } else if(gsdm.trim().length() > 0){
  874 + sql += " and ssgsdm like CONCAT('%',?,'%') ";
  875 + objList.add(gsdm);
  876 + }
  877 + if(xlbm.trim().length() > 0){
  878 + sql+= " and xlbm = ? ";
  879 + objList.add(xlbm);
  880 + }
  881 + sql += "and nbbm like CONCAT('%',?,'%') order by "+px+" asc ";
  882 + objList.add(nbbm);
  883 +
  884 + List<Qlb> list = jdbcTemplate.query(sql, objList.toArray(), new RowMapper<Qlb>() {
  885 + @Override
  886 + public Qlb mapRow(ResultSet arg0, int arg1) throws SQLException {
  887 + Qlb y = new Qlb();
  888 + y.setId(arg0.getInt("id"));
  889 + return y;
  890 + }
  891 + });
  892 + List<Qlb> lists=new ArrayList<Qlb>();
  893 + List<Qlb> qlbLists=repository.obtainQl(rq,gsdm,fgsdm,xlbm,nbbm,"jcsx");
  894 + for (int i = 0; i < list.size(); i++) {
  895 + Qlb t=list.get(i);
  896 + for (int j = 0; j < qlbLists.size(); j++) {
  897 + Qlb t2=qlbLists.get(j);
  898 + if(t.getId().intValue()==t2.getId().intValue()){
  899 + lists.add(t2);
  900 + break;
  901 + }
  902 + }
  903 + }
  904 +
  905 + return lists;
  906 + }
  907 +
  908 +
  909 + @Override
  910 + public String checkJsy(Map<String, Object> map) {
  911 + // TODO Auto-generated method stub
  912 + String rq=map.get("date").toString();
  913 + String nbbm=map.get("nbbm").toString();
  914 + String jsy =map.get("jsy").toString();
  915 + String xlbm=map.get("xlbm").toString();
  916 + List<Qlb> list= repository.queryListQlb(rq, nbbm, jsy, xlbm);
  917 + String type="1";
  918 + if(list.size()>0){
  919 + type="0";
  920 + }
  921 + return type;
  922 + }
  923 +
  924 + @Override
  925 + public Map<String, Object> saveQlb(Qlb t) {
  926 + // TODO Auto-generated method stub
  927 + Map<String, Object> map = new HashMap<>();
  928 + SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd");
  929 + String rq=sdf.format(t.getRq());
  930 + String gsdm=t.getSsgsdm();
  931 + String fgsdm=t.getFgsdm();
  932 + String xlbm=t.getXlbm();
  933 + String jhsj=t.getJhsj();
  934 + String nbbm=t.getNbbm();
  935 + t.setCreatetime(new Date());
  936 + String[] jhsjStr = jhsj.split(":");
  937 + long fcsjL= Long.parseLong(jhsjStr[0])*60+Long.parseLong(jhsjStr[1]);
  938 + List<Qlb> list=this.listOrderBy(rq, gsdm, fgsdm, xlbm, nbbm, "jhsj");
  939 + int jcsx=1;
  940 + if(list.size()>0){
  941 + for (int i = 0; i < list.size(); i++) {
  942 + Qlb y=list.get(i);
  943 + String[] fcsjStr = y.getJhsj().split(":");
  944 + long fcsj=Long.parseLong(fcsjStr[0])*60+Long.parseLong(fcsjStr[1]);
  945 + if(fcsjL>fcsj){
  946 + jcsx=jcsx+y.getJcsx();
  947 + }else{
  948 + y.setJcsx(y.getJcsx()+1);
  949 + repository.save(y);
  950 + }
  951 + }
  952 + }
  953 + t.setJcsx(jcsx);
  954 + repository.save(t);
  955 +
  956 + SysUser user = SecurityUtils.getCurrentUser();
  957 + Nylog nylog=new Nylog();
  958 + nylog.setCreatedate(new Date());
  959 + nylog.setCzmc("手动添加");
  960 + nylog.setNylx("氢");
  961 + nylog.setUserid(user.getUserName());
  962 + nylog.setUsername(user.getName());
  963 + nylog.setCxtj("");
  964 + nylogRepository.save(nylog);
  965 + map.put("status", ResponseCode.SUCCESS);
  966 + map.put("t", t);
  967 + return map;
  968 + }
  969 +
  970 + @Transactional
  971 + @Override
  972 + public Map<String, Object> deleteIds(Map<String, Object> map) throws Exception{
  973 + // TODO Auto-generated method stub
  974 + Map<String, Object> maps = new HashMap<>();
  975 + try{
  976 + String json =StringEscapeUtils.unescapeHtml4(map.get("ids").toString());
  977 + JSONArray jsonArray=JSONArray.parseArray(json);
  978 + JSONObject jsonObject;
  979 + for (int x = 0; x < jsonArray.size(); x++) {
  980 + jsonObject=jsonArray.getJSONObject(x);
  981 + Integer id =jsonObject.getInteger("id");
  982 + repository.deleteById(id);
  983 + }
  984 +
  985 + SysUser user = SecurityUtils.getCurrentUser();
  986 + Nylog nylog=new Nylog();
  987 + nylog.setCreatedate(new Date());
  988 + nylog.setCzmc("删除");
  989 + nylog.setNylx("氢");
  990 + nylog.setUserid(user.getUserName());
  991 + nylog.setUsername(user.getName());
  992 + nylog.setCxtj("");
  993 + nylogRepository.save(nylog);
  994 + maps.put("status", ResponseCode.SUCCESS);
  995 + } catch (Exception e) {
  996 + maps.put("status", ResponseCode.ERROR);
  997 + logger.error("save erro.", e);
  998 + throw e;
  999 + }
  1000 + return maps;
  1001 + }
  1002 +
  1003 + @Override
  1004 + public Map<String, List<Qlb>> updeteHistory(List<Map<String, Object>> listpbQc,String date,
  1005 + String gsdm,String fgsdm,String line) {
  1006 + // TODO Auto-generated method stub
  1007 + Map<String, List<Qlb>> mapList=new HashMap<String,List<Qlb>>();
  1008 + SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd");
  1009 + // 保留两位小数
  1010 + DecimalFormat df = new DecimalFormat("#.00");
  1011 + List<Qlb> qlbList=this.listOrderBy(date,gsdm,fgsdm,"","","nbbm");
  1012 + List<Qlb> qlbList_upd=new ArrayList<Qlb>();
  1013 + List<Qlb> qlbList_del=new ArrayList<Qlb>();
  1014 + try{
  1015 + for (int j = 0; j < qlbList.size(); j++) {
  1016 + Qlb t=qlbList.get(j);
  1017 + boolean fage=true;
  1018 + if(StringUtils.isEmpty(t.getLp())){
  1019 + fage=false;
  1020 + }else{
  1021 + for (int i = 0; i < listpbQc.size(); i++) {
  1022 + Map<String, Object> m = listpbQc.get(i);
  1023 + if(t.getNbbm().equals(m.get("clZbh").toString())
  1024 + &&t.getJsy().equals(m.get("jGh").toString())
  1025 + &&t.getXlbm().equals(m.get("xlBm").toString())
  1026 + &&t.getLp().equals(m.get("lpName").toString())){
  1027 + //该条记录不用删除
  1028 + fage =false;
  1029 + qlbList_upd.add(t);
  1030 + }
  1031 + }
  1032 + }
  1033 +
  1034 + if(fage){
  1035 + if(t.getXlbm().equals(line)){
  1036 + qlbList_del.add(t);
  1037 + }
  1038 + }
  1039 + }
  1040 + mapList.put("delList", qlbList_del);
  1041 + Map<String, Double> lcMap=new HashMap<String,Double>();
  1042 + for (int i = 0; i < listpbQc.size(); i++) {
  1043 + String cl=listpbQc.get(i).get("clZbh").toString();
  1044 + Double lc= listpbQc.get(i).get("totalKilometers") == null ? 0.0
  1045 + : Double.parseDouble(listpbQc.get(i).get("totalKilometers").toString());
  1046 + if(lcMap.get(cl)==null){
  1047 + lcMap.put(cl, lc);
  1048 + }else{
  1049 + double lc_=lcMap.get(cl);
  1050 + lcMap.remove(cl);
  1051 + lcMap.put(cl, Arith.add(lc, lc_));
  1052 + }
  1053 + }
  1054 + Map<String, Double> shMap=new HashMap<String,Double>();
  1055 + for (int i = 0; i < qlbList_upd.size(); i++) {
  1056 + Qlb qlb=qlbList_upd.get(i);
  1057 + String cl=qlb.getNbbm();
  1058 + if(shMap.get(cl)==null){
  1059 + shMap.put(cl, qlb.getSh());
  1060 + }else{
  1061 + double sh=shMap.get(cl);
  1062 + shMap.remove(cl);
  1063 + shMap.put(cl, Arith.add(sh, qlb.getSh()));
  1064 + }
  1065 + }
  1066 + List<Jql> jqlList=jqlRepository.JqlList(date);
  1067 + List<Ylxxb> ylxxList = ylxxbRepository.obtainYlxx(date, 0, gsdm);
  1068 + Map<String, Object> newMap_=new HashMap<String,Object>();
  1069 + Map<String, Object> cMap=new HashMap<String, Object>();
  1070 + List<Map<String, Object>> listpb_=listpbQc;
  1071 + Collections.sort(listpbQc,new NbbmJcsxMap2());
  1072 + List<Qlb> updateQlb=new ArrayList<Qlb>();
  1073 + for (int x = 0; x < listpb_.size(); x++) {
  1074 + String type = "add";
  1075 + Map<String, Object> map_ = listpb_.get(x);
  1076 + if(newMap_.get(map_.get("clZbh").toString())==null){
  1077 + newMap_.put(map_.get("clZbh").toString(), map_.get("clZbh").toString());
  1078 + //车辆总里程
  1079 + double zlc =lcMap.get(map_.get("clZbh").toString());
  1080 + //车辆总加氢量
  1081 + double zjzl = 0.0;
  1082 +// for (int j = 0; j < ylxxList.size(); j++) {
  1083 +// Ylxxb ylxxb = ylxxList.get(j);
  1084 +// if (map_.get("clZbh").toString().equals(ylxxb.getNbbm())
  1085 +// && map_.get("company").toString().equals(ylxxb.getGsdm())) {
  1086 +// zjzl = Arith.add(zjzl, ylxxb.getJzl());
  1087 +// }
  1088 +// }
  1089 + for (int i = 0; i < jqlList.size(); i++) {
  1090 + Jql jql=jqlList.get(i);
  1091 + if(map_.get("clZbh").toString().equals(jql.getNbbm())
  1092 + &&map_.get("company").toString().equals(jql.getGsBm())
  1093 + &&map_.get("bCompany").toString().equals(jql.getFgsBm())){
  1094 + zjzl = Arith.add(zjzl,jql.getJql());
  1095 + }
  1096 + }
  1097 + double clsh=0.0;
  1098 + if(shMap.get(map_.get("clZbh").toString())==null){
  1099 + clsh=0.0;
  1100 + }else{
  1101 + clsh=shMap.get(map_.get("clZbh").toString());
  1102 + }
  1103 + zjzl =Arith.sub(zjzl, clsh);
  1104 + Double nextJzyl = 0.0;
  1105 + for (int i = 0; i < listpbQc.size(); i++) {
  1106 + Map<String, Object> map = listpbQc.get(i);
  1107 + if(map_.get("clZbh").toString().equals(map.get("clZbh").toString())){
  1108 + // 判断驾驶员驾驶的该车辆是否已经存入了(查出的结果集中日期是相同的,根据驾驶员、内部编号、线路编码判断)
  1109 + Qlb t = new Qlb();
  1110 + for (int k = 0; k < qlbList_upd.size(); k++) {
  1111 + Qlb t1 = qlbList_upd.get(k);
  1112 + if (t1.getNbbm().equals(map.get("clZbh").toString())
  1113 + && t1.getJsy().equals(map.get("jGh").toString())
  1114 + && t1.getXlbm().equals(map.get("xlBm").toString())
  1115 + && t1.getLp().equals(map.get("lpName").toString())) {
  1116 + t = t1;
  1117 + type = "update";
  1118 + }
  1119 +
  1120 + }
  1121 + Double lc= Double.parseDouble(map.get("totalKilometers").toString());
  1122 + if(map.get("seqNumber").toString().equals("1")){
  1123 + // 当日的第一个班次,出场油量等于前一天的最后一个班次的进场油量
  1124 + Double dh=0.0;
  1125 + if(zlc>0){
  1126 + dh = Double.parseDouble(df.format(zjzl * (lc / zlc)));
  1127 + }
  1128 + nextJzyl =Arith.sub(zjzl,dh);
  1129 + if(zlc>0){
  1130 +// long l=Math.round(nextJzyl);
  1131 + double ylxs=nextJzyl;
  1132 + dh=Arith.add(dh, Arith.sub(nextJzyl,ylxs));
  1133 + if(dh<0){
  1134 + t.setHn(0.0);
  1135 + t.setJql(0.0);
  1136 + nextJzyl=Arith.add(ylxs, dh);
  1137 + }else{
  1138 + t.setHn(dh);
  1139 + t.setJql(dh);
  1140 + nextJzyl=ylxs;
  1141 + }
  1142 + }else{
  1143 + t.setHn(0.0);
  1144 + t.setJql(0.0);
  1145 + }
  1146 + }else{
  1147 + Double dh=0.0;
  1148 + if(zlc>0){
  1149 + dh = Double.parseDouble(df.format(zjzl * (lc / zlc)));
  1150 + }
  1151 + nextJzyl =Arith.sub( nextJzyl,dh);
  1152 + if(zlc>0){
  1153 +// long l=0l;
  1154 + double ylxs=0.0;
  1155 + if(i==listpbQc.size()-1){
  1156 +// ylxs=czyl;
  1157 + }else{
  1158 + if(listpbQc.get(i+1).get("clZbh").toString().equals(map.get("clZbh").toString())){
  1159 +// l=Math.round(nextJzyl);
  1160 + ylxs=nextJzyl;
  1161 + }
  1162 +
  1163 + }
  1164 + dh=Arith.add(dh, Arith.sub(nextJzyl,ylxs));
  1165 + if(dh<0){
  1166 + t.setHn(0.0);
  1167 + t.setJql(0.0);
  1168 + nextJzyl=Arith.add(ylxs, dh);
  1169 + }else{
  1170 + t.setHn(dh);
  1171 + t.setJql(dh);
  1172 + nextJzyl=ylxs;
  1173 + }
  1174 + }else{
  1175 + t.setHn(0.0);
  1176 + t.setJql(0.0);
  1177 + }
  1178 + }
  1179 + t.setCzcl(100.0);
  1180 + t.setJzcl(100.0);
  1181 + t.setNbbm(map.get("clZbh").toString());
  1182 + t.setJsy(map.get("jGh") == null ? "" : map.get("jGh").toString());
  1183 + t.setZlc(map.get("totalKilometers") == null ? 0.0
  1184 + : Double.parseDouble(map.get("totalKilometers").toString()));
  1185 + t.setXlbm(map.get("xlBm") == null ? "" : map.get("xlBm").toString());
  1186 + t.setJcsx(Integer.parseInt(map.get("seqNumber").toString()));
  1187 + t.setSsgsdm(map.get("company") == null ? "" : map.get("company").toString());
  1188 + t.setFgsdm(map.get("bCompany") == null ? "" : map.get("bCompany").toString());
  1189 + t.setJhsj(map.get("fcsj")==null?"":map.get("fcsj").toString());
  1190 + t.setRq(sdf.parse(date));
  1191 + t.setLp(map.get("lpName").toString());
  1192 + t.setJql(Arith.add(t.getJql(), t.getSh()));
  1193 + if(!(t.getSsgsdm().equals("") || t.getFgsdm().equals(""))){
  1194 + if(type.equals("add")){
  1195 + t.setCreatetime(new Date());
  1196 + }else{
  1197 + t.setUpdatetime(new Date());
  1198 + }
  1199 + }
  1200 +
  1201 + if(t.getHn()<0){
  1202 + t.setHn(0.0);
  1203 + }
  1204 + if(t.getJql()<0){
  1205 + t.setJql(0.0);
  1206 + }
  1207 + updateQlb.add(t);
  1208 + }
  1209 + }
  1210 + }
  1211 + }
  1212 + mapList.put("updList", updateQlb);
  1213 + }catch(Exception e){
  1214 + logger.error("save erro.", e);
  1215 + }
  1216 + return mapList;
  1217 + }
  1218 +
  1219 + @Override
  1220 + public Map<String, Object> update(Map<String, Object> map) {
  1221 + if(map.get("id")!=null){
  1222 + if(map.get("id").toString().length()>0){
  1223 + Integer id=Integer.parseInt(map.get("id").toString());
  1224 + String jsy=map.get("jsy").toString();
  1225 + Qlb t=repository.findById(id);
  1226 + t.setJsy(jsy);
  1227 + repository.save(t);
  1228 + map.put("status", ResponseCode.SUCCESS);
  1229 + }
  1230 + }
  1231 + return map;
  1232 + }
  1233 +
  1234 +}
  1235 +
  1236 +class NbbmJcsxMap2 implements Comparator<Map<String, Object>>{
  1237 + @Override
  1238 + public int compare(Map<String, Object> o1, Map<String, Object> o2) {
  1239 + // TODO Auto-generated method stub
  1240 + return (o1.get("clZbh").toString()+o1.get("seqNumber").toString()).compareTo((o2.get("clZbh").toString()+o1.get("seqNumber").toString()));
  1241 + }
  1242 +}
src/main/java/com/bsth/service/oil/impl/YlxxbServiceImpl.java
1 package com.bsth.service.oil.impl; 1 package com.bsth.service.oil.impl;
2 2
  3 +import java.io.File;
  4 +import java.io.FileInputStream;
3 import java.sql.ResultSet; 5 import java.sql.ResultSet;
4 import java.sql.SQLException; 6 import java.sql.SQLException;
5 import java.text.DecimalFormat; 7 import java.text.DecimalFormat;
6 import java.text.ParseException; 8 import java.text.ParseException;
7 import java.text.SimpleDateFormat; 9 import java.text.SimpleDateFormat;
8 -import java.util.ArrayList;  
9 -import java.util.Date;  
10 -import java.util.HashMap;  
11 -import java.util.List;  
12 -import java.util.Map; 10 +import java.util.*;
13 11
14 import javax.transaction.Transactional; 12 import javax.transaction.Transactional;
15 13
  14 +import com.bsth.entity.oil.Jdl;
  15 +import com.bsth.util.ReportUtils;
16 import org.apache.commons.lang3.StringEscapeUtils; 16 import org.apache.commons.lang3.StringEscapeUtils;
  17 +import org.apache.poi.hssf.usermodel.HSSFCell;
  18 +import org.apache.poi.hssf.usermodel.HSSFRow;
  19 +import org.apache.poi.hssf.usermodel.HSSFSheet;
  20 +import org.apache.poi.hssf.usermodel.HSSFWorkbook;
  21 +import org.apache.poi.poifs.filesystem.POIFSFileSystem;
17 import org.slf4j.Logger; 22 import org.slf4j.Logger;
18 import org.slf4j.LoggerFactory; 23 import org.slf4j.LoggerFactory;
19 import org.springframework.beans.factory.annotation.Autowired; 24 import org.springframework.beans.factory.annotation.Autowired;
  25 +import org.springframework.jdbc.core.BeanPropertyRowMapper;
20 import org.springframework.jdbc.core.JdbcTemplate; 26 import org.springframework.jdbc.core.JdbcTemplate;
21 import org.springframework.jdbc.core.RowMapper; 27 import org.springframework.jdbc.core.RowMapper;
22 import org.springframework.stereotype.Service; 28 import org.springframework.stereotype.Service;
@@ -49,6 +55,10 @@ public class YlxxbServiceImpl extends BaseServiceImpl&lt;Ylxxb,Integer&gt; implements @@ -49,6 +55,10 @@ public class YlxxbServiceImpl extends BaseServiceImpl&lt;Ylxxb,Integer&gt; implements
49 YlbRepository ylbRepository; 55 YlbRepository ylbRepository;
50 @Autowired 56 @Autowired
51 JdbcTemplate jdbcTemplate; 57 JdbcTemplate jdbcTemplate;
  58 +
  59 + @Autowired
  60 + YlxxbRepository ylxxbRepository;
  61 +
52 @Override 62 @Override
53 public PageObject<Ylxxb> Pagequery(Map<String, Object> map) { 63 public PageObject<Ylxxb> Pagequery(Map<String, Object> map) {
54 64
@@ -287,4 +297,139 @@ public class YlxxbServiceImpl extends BaseServiceImpl&lt;Ylxxb,Integer&gt; implements @@ -287,4 +297,139 @@ public class YlxxbServiceImpl extends BaseServiceImpl&lt;Ylxxb,Integer&gt; implements
287 } 297 }
288 return newMap; 298 return newMap;
289 } 299 }
  300 +
  301 + @Override
  302 + public String importExcel(File file) {
  303 + String gsbm="100";
  304 + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
  305 + SimpleDateFormat sd = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
  306 + DecimalFormat df = new DecimalFormat("######0.00");
  307 + List<String> textList = new ArrayList<String>();
  308 + try {
  309 + POIFSFileSystem fs = new POIFSFileSystem(new FileInputStream(file));
  310 + HSSFWorkbook wb = new HSSFWorkbook(fs);
  311 + HSSFSheet sheet = wb.getSheetAt(0);
  312 + // 取得总行数
  313 + int rowNum = sheet.getLastRowNum() + 1;
  314 + // 取得总列数
  315 + int cellNum = sheet.getRow(0).getLastCellNum();
  316 + HSSFRow row = null;
  317 + HSSFCell cell = null;
  318 + for(int i = 2; i < rowNum; i++){
  319 + row = sheet.getRow(i);
  320 + if (row == null){
  321 + continue;
  322 + }
  323 + String text = "";
  324 + for(int j = 0; j < cellNum; j++){
  325 + cell = row.getCell(j);
  326 + if(cell == null){
  327 + text += ",";
  328 + continue;
  329 + }
  330 + text += String.valueOf(cell) + ",";
  331 + }
  332 + String[] split = (text+";").split(",");
  333 + String str = "";
  334 + for(int j = 0; j < split.length && j < 5; j++){
  335 + str += split[j];
  336 + }
  337 + if(str.trim().length() == 0){
  338 + continue;
  339 + }
  340 + textList.add(text + ";");
  341 + }
  342 + for(int i = 0; i < textList.size(); i++){
  343 + String text = textList.get(i);
  344 + System.out.println(text);
  345 + String[] split = text.split(",");
  346 + String rq = split[0].trim();//日期
  347 + String nbbm = split[1].trim();//内部编号
  348 + /*String jsy = split[2].trim();//驾驶员工号*/
  349 + String jsy ="";//
  350 + double jzl = Double.valueOf(split[2].trim().length()!=0?split[2]:"0");//加注量
  351 + String jyz = split[3].trim();//能源站
  352 + String plate = split[4].trim();//车牌号
  353 + String remarks = split[5].trim();//备注
  354 + String yh = split[6].trim();//油号
  355 + if(rq.trim().length() == 0){
  356 + rq = sdf.format(new Date());
  357 + }
  358 + /* System.out.println(jsy);
  359 + if(jsy != null && jsy.length() > 0 && !(jsy.equals(jsy.replaceAll("\\p{P}", "")))){
  360 + return "加油:驾驶员工号错误,请检查是否导入错误excel";
  361 + }*/
  362 +
  363 + List<Double> jzl_ = ylxxbRepository.import_queryBySame(gsbm, rq, nbbm);
  364 +//
  365 + if(jzl_.size() == 0){
  366 + ylxxbRepository.import_insertData(gsbm, rq, nbbm, jsy,
  367 + df.format(jzl), jyz, remarks, sd.format(new Date()),plate,yh);
  368 + }else{
  369 + ylxxbRepository.import_UpdateJzl(df.format(jzl), jsy, jyz, remarks, gsbm, rq, nbbm,plate,yh);
  370 + }
  371 + }
  372 +
  373 + wb.close();
  374 + fs.close();
  375 + } catch (Exception e) {
  376 + // TODO Auto-generated catch block
  377 + e.printStackTrace();
  378 + return "文件导入失败";
  379 + } finally {
  380 + file.delete();
  381 + }
  382 + return "文件导入成功";
  383 + }
  384 +
  385 + @Override
  386 + public Map<String, Object> query(Map<String, Object> map) {
  387 + Map<String, Object> modelMap = new HashMap<String, Object>();
  388 + Integer page = Integer.valueOf(map.containsKey("page")?map.get("page").toString():"0");
  389 + StringBuffer sql=new StringBuffer("SELECT * FROM bsth_c_ylxxb where 1=1 ");
  390 + if(map.get("rq")!=null && !"".equals(map.get("rq").toString())){
  391 + sql.append("and yyrq>='"+map.get("rq")+"'");
  392 + }
  393 + if(map.get("nbbm")!=null && !"".equals(map.get("nbbm").toString())){
  394 + sql.append("and nbbm='"+map.get("nbbm")+"'");
  395 + }
  396 + List<Ylxxb> query = jdbcTemplate.query(sql.toString(), BeanPropertyRowMapper.newInstance(Ylxxb.class));
  397 +
  398 + if(!map.containsKey("type")){
  399 +
  400 + int end = (page+1)*10>query.size()?query.size():(page+1)*10;
  401 + modelMap.put("dataList", query.subList(page*10, end));
  402 + modelMap.put("totalPages", query.size()%10>0?query.size()/10+1:query.size()/10);
  403 +
  404 + } else if(map.get("type").toString().equals("export")){
  405 + SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"),
  406 + sdfSimple = new SimpleDateFormat("yyyyMMdd");
  407 +
  408 + List<Map<String, Object>> list = new ArrayList<Map<String, Object>>();
  409 + for(Ylxxb jdl : query){
  410 + Map<String, Object> m = new HashMap<String, Object>();
  411 + m.put("rq", sdfMonth.format(jdl.getYyrq()));
  412 + m.put("nbbm", jdl.getNbbm());
  413 + m.put("jyl", jdl.getJzl());
  414 + m.put("jyz", jdl.getStationid());
  415 + m.put("remarks", jdl.getBz());
  416 + m.put("yh", jdl.getYh());
  417 + list.add(m);
  418 + }
  419 +/*
  420 + List<Iterator<?>> listI = new ArrayList<Iterator<?>>();
  421 + Map<String, Object> m = new HashMap<String, Object>();
  422 + ReportUtils ee = new ReportUtils();
  423 + try {
  424 + listI.add(list.iterator());
  425 + String path = this.getClass().getResource("/").getPath()+"static/pages/forms/";
  426 + ee.excelReplace(listI, new Object[] { m }, path+"mould/export_Jdl.xls",
  427 + path+"export/车辆充电量" + sdfSimple.format(sdfMonth.parse(rq)) + ".xls");
  428 + } catch (Exception e) {
  429 + // TODO: handle exception
  430 + e.printStackTrace();
  431 + }*/
  432 + }
  433 + return modelMap;
  434 + }
290 } 435 }
src/main/java/com/bsth/service/report/XlybtbService.java 0 → 100644
  1 +package com.bsth.service.report;
  2 +
  3 +import java.util.Map;
  4 +
  5 +public interface XlybtbService {
  6 + Map<String, Object> query(Map<String, Object> map);
  7 +}
  8 +
src/main/java/com/bsth/service/report/XlybtzService.java 0 → 100644
  1 +package com.bsth.service.report;
  2 +
  3 +import java.io.File;
  4 +import java.util.Map;
  5 +
  6 +public interface XlybtzService {
  7 +
  8 + String imporPWExcel(File file,String date);
  9 +
  10 + String importQRCordExcel(File file,String date);
  11 +
  12 + String importCardExcel(File file,String date,String type);
  13 +
  14 + String importExcel(File file);
  15 +
  16 + Map<String, Object> query(Map<String, Object> map);
  17 +}
  18 +
src/main/java/com/bsth/service/report/impl/XlybtbServiceImpl.java 0 → 100644
  1 +package com.bsth.service.report.impl;
  2 +
  3 +
  4 +
  5 +import com.bsth.entity.LineInformation;
  6 +import com.bsth.entity.realcontrol.Xlybtb;
  7 +import com.bsth.entity.report.Ticket;
  8 +import com.bsth.repository.LineInformationRepository;
  9 +import com.bsth.repository.calc.CalcWaybillRepository;
  10 +import com.bsth.repository.oil.JdlRepository;
  11 +import com.bsth.repository.oil.JqlRepository;
  12 +import com.bsth.repository.oil.YlxxbRepository;
  13 +import com.bsth.repository.schedule.CarConfigInfoRepository;
  14 +import com.bsth.service.report.XlybtbService;
  15 +import com.bsth.util.ReportUtils;
  16 +import com.google.common.collect.ArrayListMultimap;
  17 +import com.google.common.collect.ListMultimap;
  18 +import org.slf4j.Logger;
  19 +import org.slf4j.LoggerFactory;
  20 +import org.springframework.beans.factory.annotation.Autowired;
  21 +import org.springframework.jdbc.core.BeanPropertyRowMapper;
  22 +import org.springframework.jdbc.core.JdbcTemplate;
  23 +import org.springframework.stereotype.Service;
  24 +
  25 +import java.text.Collator;
  26 +import java.text.DecimalFormat;
  27 +import java.time.LocalDate;
  28 +import java.time.format.DateTimeFormatter;
  29 +import java.util.*;
  30 +import java.util.stream.Collectors;
  31 +
  32 +
  33 +@Service
  34 +public class XlybtbServiceImpl implements XlybtbService {
  35 +
  36 + Logger logger = LoggerFactory.getLogger(this.getClass());
  37 +
  38 + @Autowired
  39 + JdbcTemplate jdbcTemplate;
  40 +
  41 + @Autowired
  42 + LineInformationRepository lineInformationRepository;
  43 +
  44 + @Autowired
  45 + JdlRepository jdlRepository;
  46 +
  47 + @Autowired
  48 + JqlRepository jqlRepository;
  49 +
  50 + @Autowired
  51 + YlxxbRepository ylxxbRepository;
  52 +
  53 + @Autowired
  54 + CalcWaybillRepository calcWaybillRepository;
  55 +
  56 + @Autowired
  57 + CarConfigInfoRepository carConfigInfoRepository;
  58 +
  59 +
  60 + private static DecimalFormat df = new DecimalFormat("#.00");
  61 + @Override
  62 + public Map<String, Object> query(Map<String, Object> map) {
  63 + Map<String, Object> modelMap = new HashMap<>();
  64 + String dateS = map.get("dateS").toString().trim();
  65 + String dateE = map.get("dateE").toString().trim();
  66 + String date=dateS.substring(0,7)+"~"+dateE.substring(0,7);
  67 + StringBuffer sql=new StringBuffer("SELECT sum(amount) amount,max(convoy) convoy,sum(count) count,line_code,max(line_id) line_id," +
  68 + "max(line_name) line_name FROM `ticket_info` where pay_type != '保通卡' ");
  69 + if(dateS!=null && !"".equals(dateS)){
  70 + sql.append("and date>='"+dateS+"'");
  71 + }
  72 + if(dateE!=null && !"".equals(dateE)){
  73 + sql.append("and date<='"+dateE+"'");
  74 + }
  75 + sql.append("GROUP BY line_code");
  76 + DateTimeFormatter dtf=DateTimeFormatter.ofPattern("yyyy-MM-dd");
  77 + LocalDate ds=LocalDate.parse(dateS,dtf);
  78 + ds=ds.minusYears(1);
  79 + String dateSo=ds.format(dtf);
  80 + LocalDate de=LocalDate.parse(dateE,dtf);
  81 + de=de.minusYears(1);
  82 + String dateEo=de.format(dtf);
  83 + StringBuffer sql2=new StringBuffer("SELECT sum(amount) amount,max(convoy) convoy,sum(count) count,line_code,max(line_id) line_id," +
  84 + "max(line_name) line_name FROM `ticket_info` where pay_type != '保通卡' ");
  85 + if(dateS!=null && !"".equals(dateS)){
  86 + sql2.append("and date>='"+dateSo+"'");
  87 + }
  88 + if(dateE!=null && !"".equals(dateE)){
  89 + sql2.append("and date<='"+dateEo+"'");
  90 + }
  91 + sql2.append("GROUP BY line_code");
  92 + List<Ticket> query = jdbcTemplate.query(sql.toString(), BeanPropertyRowMapper.newInstance(Ticket.class));
  93 + List<Ticket> query2 = jdbcTemplate.query(sql2.toString(), BeanPropertyRowMapper.newInstance(Ticket.class));
  94 + //查询线路信息
  95 + List<LineInformation> lineList=lineInformationRepository.findAll();
  96 + Map<String,LineInformation> lines=new HashMap<>();
  97 + for (LineInformation line : lineList) {
  98 + lines.put(line.getLine().getLineCode(),line);
  99 + }
  100 +
  101 + //查询1对多线路 用于后续合并线路数据
  102 + List<Map<String,Object>> lineCompare =jdbcTemplate.queryForList("SELECT line_code,line_code2,name_pw,convoy FROM `bsth_c_line_compare` where line_code is not null");
  103 + Map<String,String> compareMap=new HashMap<>();
  104 + for (Map<String, Object> m : lineCompare) {
  105 + if(m.get("line_code2")!=null){
  106 + compareMap.put(m.get("line_code2").toString(),m.get("line_code").toString());
  107 + }
  108 + }
  109 +
  110 + //查询路单数据
  111 + List<Map<String,Object>> ldList =jdbcTemplate.queryForList(
  112 + "SELECT c.sfdc d,c.sfmix h,c.hydrogen q,b.xl lineCode,b.cl nbbm,b.jhyybc,b.sjyybc,b.jhyylc,b.sjyylc,b.sjfyylc,b.rq_str rq,b.j_gh jgh from calc_waybill b LEFT JOIN " +
  113 + "bsth_c_cars c on c.inside_code=b.cl where b.rq_str>='"+dateS+"' and b.rq_str<='"+dateE+"'");
  114 + if(ldList.size()==0){
  115 + modelMap.put("code","500");
  116 + modelMap.put("msg","缺少路单统计数据");
  117 + return modelMap;
  118 + }
  119 +
  120 + //线路里程、班次、车次计算
  121 + Map<String,Integer> bcMap=new HashMap<>();
  122 + Map<String,Double> lcMap=new HashMap<>();
  123 + Map<String,Integer> ccMap=new HashMap<>();
  124 + for (Map<String, Object> m : ldList) {
  125 + String lineCode= (String) m.get("lineCode");
  126 + if(compareMap.get(lineCode)!=null){
  127 + lineCode=compareMap.get(lineCode);
  128 + }
  129 + //各类型车实际里程
  130 + if(m.get("d")!=null&&(boolean)m.get("d")){//电车
  131 + Double lc=lcMap.get(lineCode+"_d")==null?0d:lcMap.get(lineCode+"_d");
  132 + lcMap.put(lineCode+"_d",lc+(double)m.get("sjyylc"));
  133 + }else if(m.get("h")!=null&&(boolean)m.get("h")){//混动
  134 + Double lc=lcMap.get(lineCode+"_h")==null?0d:lcMap.get(lineCode+"_h");
  135 + lcMap.put(lineCode+"_h",lc+(double)m.get("sjyylc"));
  136 + }else if(m.get("q")!=null&&(boolean)m.get("q")){//氢能
  137 + Double lc=lcMap.get(lineCode+"_q")==null?0d:lcMap.get(lineCode+"_q");
  138 + lcMap.put(lineCode+"_q",lc+(double)m.get("sjyylc"));
  139 + }else {//油车
  140 + Double lc=lcMap.get(lineCode+"_y")==null?0d:lcMap.get(lineCode+"_y");
  141 + lcMap.put(lineCode+"_y",lc+(double)m.get("sjyylc"));
  142 + }
  143 + //计划运营里程
  144 + double jhyylc=lcMap.get(lineCode+"_jhyylc")==null?0d:lcMap.get(lineCode+"_jhyylc");
  145 + lcMap.put(lineCode+"_jhyylc",jhyylc+(double)m.get("jhyylc"));
  146 + //实际运营里程
  147 + double sjyylc=lcMap.get(lineCode+"_sjyylc")==null?0d:lcMap.get(lineCode+"_sjyylc");
  148 + lcMap.put(lineCode+"_sjyylc",sjyylc+(double)m.get("sjyylc"));
  149 + //实际非运营里程
  150 + double sjfyylc=lcMap.get(lineCode+"_sjfyylc")==null?0d:lcMap.get(lineCode+"_sjfyylc");
  151 + lcMap.put(lineCode+"_sjfyylc",sjfyylc+(double)m.get("sjfyylc"));
  152 + //计划班次数
  153 + int jhyybc=bcMap.get(lineCode+"_jhyybc")==null?0:bcMap.get(lineCode+"_jhyybc");
  154 + bcMap.put(lineCode+"_jhyybc",jhyybc+(int)m.get("jhyybc"));
  155 + //实际班次数
  156 + int sjyybc=bcMap.get(lineCode+"_sjyybc")==null?0:bcMap.get(lineCode+"_sjyybc");
  157 + bcMap.put(lineCode+"_sjyybc",sjyybc+(int)m.get("sjyybc"));
  158 + //车次
  159 + int cc=ccMap.get(lineCode)==null?0:ccMap.get(lineCode);
  160 + ccMap.put(lineCode,cc+=1);
  161 + }
  162 +
  163 + //查询历史路单数据
  164 + List<Map<String,Object>> ldOldList =jdbcTemplate.queryForList(
  165 + "SELECT xl,sum(sjyylc) sjyylc,sum(sjyybc) sjyybc,sum(sjfyylc) sjfyylc from calc_waybill " +
  166 + "where rq_str>='"+dateSo+"' and rq_str<='"+dateEo+"' GROUP BY xl ");
  167 + Map<String,Map<String,Object>> ldOlds=new HashMap<>();
  168 + for (Map<String, Object> m : ldOldList) {
  169 + ldOlds.put(m.get("xl").toString(),m);
  170 + }
  171 +
  172 + //查询票务数据
  173 + if(query.size()==0){
  174 + modelMap.put("code","500");
  175 + modelMap.put("msg","缺少票务数据");
  176 + return modelMap;
  177 + }
  178 + //历史票务数据
  179 + Map<String,Ticket> ticketMap=new HashMap<>();
  180 + for (Ticket ticket : query2) {
  181 + ticketMap.put(ticket.getLineCode(),ticket);
  182 + }
  183 +
  184 + Map<String,Ticket> ticketsMap = new HashMap<>();
  185 + Map<String,List<Ticket>> ticketGroup= query.stream().collect(Collectors.groupingBy(Ticket::getLineCode));
  186 + for (Ticket ticket : query) {
  187 + ticketsMap.put(ticket.getLineCode(),ticket);
  188 + }
  189 + ListMultimap<String, Xlybtb> list = ArrayListMultimap.create();
  190 +
  191 + for (Map<String, Object> m : lineCompare) {
  192 + String lineCode=m.get("line_code").toString();
  193 + String lineName=m.get("name_pw").toString();
  194 + String convoy=m.get("convoy").toString();
  195 + Ticket ticket = ticketsMap.get(lineCode);
  196 + Map<String,Object> old=ldOlds.get(lineCode);
  197 + Ticket ticketOld=ticketMap.get(lineCode);
  198 + Xlybtb xlybtb=new Xlybtb();
  199 + xlybtb.setXl(lineName);//路线
  200 + xlybtb.setXlcd((lines.get(lineCode).getUpMileage()+lines.get(lineCode).getDownMileage())/2);//线路长度
  201 + xlybtb.setRcjh(0);//人次计划
  202 + int rcsj=ticket==null?0:ticket.getCount();
  203 + xlybtb.setRcsj(rcsj);//人次实际
  204 + int rctq=ticketOld==null?0:ticketOld.getCount();
  205 + xlybtb.setRctq(rctq);//人次同期
  206 + xlybtb.setRctb(rctq==0?null:Double.parseDouble(df.format((0-((double)(rctq-rcsj)/rctq))*100)));//人次同比
  207 + xlybtb.setRcjhwc(null);//人次计划完成
  208 +
  209 + xlybtb.setYsjh(0);//营收计划
  210 + double yssj=ticket==null?0:ticket.getAmount();
  211 + xlybtb.setYssj(yssj);//营收实际
  212 + double ystq=ticketOld==null?0:ticketOld.getAmount();
  213 + xlybtb.setYstq(ystq);//营收同期
  214 + xlybtb.setYstb(ystq==0?null:Double.parseDouble(df.format((0-((double)(ystq-yssj)/ystq))*100)));//营收同比
  215 + double sjyylc=lcMap.get(lineCode+"_sjyylc")==null?0:lcMap.get(lineCode+"_sjyylc");
  216 + xlybtb.setLcsj(sjyylc);//实际实际
  217 + xlybtb.setYsybgl(sjyylc==0?null:Double.parseDouble(df.format(yssj/sjyylc*100)));//营收 元/百公里
  218 + xlybtb.setYsjhwc(null);//营收计划完成
  219 +
  220 + double jhyylc=lcMap.get(lineCode+"_jhyylc")==null?0:lcMap.get(lineCode+"_jhyylc");
  221 + double sjyylcOld=(old==null||old.get("sjyylc")==null)?0:(double)old.get("sjyylc");
  222 + xlybtb.setLcjh(Double.parseDouble(df.format(jhyylc)));//里程计划
  223 + double hy=lcMap.get(lineCode+"_h")==null?0:lcMap.get(lineCode+"_h");//混动
  224 + double yy=lcMap.get(lineCode+"_y")==null?0:lcMap.get(lineCode+"_y");//油车
  225 + xlybtb.setLccy(Double.parseDouble(df.format(hy+yy))); //里程柴油
  226 + double d=lcMap.get(lineCode+"_d")==null?0:lcMap.get(lineCode+"_d");
  227 + xlybtb.setLccd(Double.parseDouble(df.format(d)));//里程纯电
  228 + double q=lcMap.get(lineCode+"_q")==null?0:lcMap.get(lineCode+"_q");
  229 + xlybtb.setLcqrl(Double.parseDouble(df.format(q)));//里程氢燃料
  230 + xlybtb.setLctq(Double.parseDouble(df.format(sjyylcOld)));//里程去年同期
  231 + xlybtb.setLctb(sjyylcOld==0?null:Double.parseDouble(df.format((0-((sjyylcOld-sjyylc)/sjyylcOld))*100)));//里程同比
  232 + xlybtb.setLcjhwc(jhyylc==0?null:Double.parseDouble(df.format(sjyylc/jhyylc*100)));//里程计划完成
  233 +
  234 + int sjyybc=bcMap.get(lineCode+"_sjyybc")==null?0:bcMap.get(lineCode+"_sjyybc");
  235 + int jhyybc=bcMap.get(lineCode+"_jhyybc")==null?0:bcMap.get(lineCode+"_jhyybc");
  236 + int sjyybcOld=(old==null||old.get("sjyybc")==null)?0:Integer.parseInt(old.get("sjyybc").toString());
  237 + xlybtb.setBcjh(jhyybc);//班次计划
  238 + xlybtb.setBcsj(sjyybc);//班次实际
  239 + xlybtb.setBctq(sjyybcOld);//班次同期
  240 + xlybtb.setBctb(sjyybcOld==0?null:Double.parseDouble(df.format(0-((double)(sjyybcOld-sjyybc)/sjyybcOld)*100)));//班次同比
  241 + xlybtb.setBcjhwc(jhyybc==0?null:Double.parseDouble(df.format((double)sjyybc/jhyybc*100)));//班次计划完成
  242 + double sjfyylc=lcMap.get(lineCode+"_sjfyylc")==null?0:lcMap.get(lineCode+"_sjfyylc");
  243 + double sjfyylcOld=(old==null||old.get("sjfyylc")==null)?0:(double)old.get("sjfyylc");
  244 + xlybtb.setKssj(Double.parseDouble(df.format(sjfyylc)));//空驶实际
  245 + xlybtb.setKstq(Double.parseDouble(df.format(sjfyylcOld)));//空驶同期
  246 + xlybtb.setKstb(sjfyylcOld==0?null:Double.parseDouble(df.format((0-((sjfyylcOld-sjfyylc)/sjfyylcOld))*100)));//空驶同比
  247 + list.put(convoy,xlybtb);
  248 + }
  249 +
  250 + Set<String> keys=list.keySet();
  251 + List<String>keyList=keys.stream().sorted(Collator.getInstance(Locale.TRADITIONAL_CHINESE)).collect(Collectors.toList());//车队名排序
  252 + List<Xlybtb> xlybtbList=new ArrayList<>();//含合计数据集
  253 + List<Xlybtb> xlybtbListAll=new ArrayList<>();//不含合计数据集
  254 + for (String s : keyList) {
  255 + List<Xlybtb> xlybtbs=list.get(s);//车队
  256 + xlybtbList.addAll(list.get(s));
  257 + xlybtbList.add(Xlybtb.getTotal(xlybtbs,s));//车队合计
  258 + xlybtbListAll.addAll(list.get(s));
  259 + }
  260 + xlybtbList.add(Xlybtb.getTotal(xlybtbListAll,"公司合计:"));//公司合计
  261 + if(!map.containsKey("type")){
  262 + Integer page = Integer.valueOf(map.containsKey("page")?map.get("page").toString():"0");
  263 + int end = (page+1)*10>xlybtbList.size()?xlybtbList.size():(page+1)*10;
  264 + modelMap.put("dataList", xlybtbList.subList(page*10, end));
  265 + modelMap.put("totalPages", xlybtbList.size()%10>0?xlybtbList.size()/10+1:xlybtbList.size()/10);
  266 + } else if(map.get("type").toString().equals("export")){
  267 + List<Iterator<?>> listI = new ArrayList<>();
  268 + Map<String, Object> m = new HashMap<>();
  269 + m.put("date",date);
  270 + ReportUtils ee = new ReportUtils();
  271 + try {
  272 + listI.add(xlybtbList.iterator());
  273 + String path = this.getClass().getResource("/").getPath()+"static/pages/forms/";
  274 + ee.excelReplace(listI, new Object[] { m }, path+"mould/路线生产月报同比表.xls",
  275 + path+"export/路线生产月报同比表.xls");
  276 + } catch (Exception e) {
  277 + // TODO: handle exception
  278 + e.printStackTrace();
  279 + }
  280 + }
  281 + modelMap.put("code","00");
  282 + return modelMap;
  283 + }
  284 +
  285 +}
src/main/java/com/bsth/service/report/impl/XlybtzServiceImpl.java 0 → 100644
  1 +package com.bsth.service.report.impl;
  2 +
  3 +
  4 +import com.bsth.data.BasicData;
  5 +import com.bsth.entity.Cars;
  6 +import com.bsth.entity.LineInformation;
  7 +import com.bsth.entity.report.*;
  8 +import com.bsth.entity.oil.Jdl;
  9 +import com.bsth.entity.oil.Jql;
  10 +import com.bsth.entity.oil.Ylxxb;
  11 +import com.bsth.entity.realcontrol.Xlybtz;
  12 +import com.bsth.entity.schedule.CarConfigInfo;
  13 +import com.bsth.repository.CarsRepository;
  14 +import com.bsth.repository.LineInformationRepository;
  15 +import com.bsth.repository.calc.CalcWaybillRepository;
  16 +import com.bsth.repository.oil.JdlRepository;
  17 +import com.bsth.repository.oil.JqlRepository;
  18 +import com.bsth.repository.oil.YlxxbRepository;
  19 +import com.bsth.repository.schedule.CarConfigInfoRepository;
  20 +import com.bsth.service.report.XlybtzService;
  21 +import com.bsth.service.schedule.utils.PoiUtils;
  22 +import com.bsth.util.ReportUtils;
  23 +import com.google.common.collect.ArrayListMultimap;
  24 +import com.google.common.collect.ListMultimap;
  25 +import org.slf4j.Logger;
  26 +import org.slf4j.LoggerFactory;
  27 +import org.springframework.beans.factory.annotation.Autowired;
  28 +import org.springframework.jdbc.core.BatchPreparedStatementSetter;
  29 +import org.springframework.jdbc.core.BeanPropertyRowMapper;
  30 +import org.springframework.jdbc.core.JdbcTemplate;
  31 +import org.springframework.stereotype.Service;
  32 +import org.springframework.transaction.TransactionException;
  33 +import org.springframework.transaction.TransactionStatus;
  34 +import org.springframework.transaction.support.TransactionCallbackWithoutResult;
  35 +import org.springframework.transaction.support.TransactionTemplate;
  36 +import java.io.File;
  37 +import java.sql.PreparedStatement;
  38 +import java.sql.SQLException;
  39 +import java.text.Collator;
  40 +import java.text.DecimalFormat;
  41 +import java.time.YearMonth;
  42 +import java.util.*;
  43 +import java.util.concurrent.atomic.AtomicReference;
  44 +import java.util.stream.Collectors;
  45 +
  46 +
  47 +@Service
  48 +public class XlybtzServiceImpl implements XlybtzService {
  49 +
  50 + Logger logger = LoggerFactory.getLogger(this.getClass());
  51 +
  52 + @Autowired
  53 + JdbcTemplate jdbcTemplate;
  54 +
  55 + @Autowired
  56 + private TransactionTemplate transactionTemplate;
  57 +
  58 + @Autowired
  59 + LineInformationRepository lineInformationRepository;
  60 +
  61 + @Autowired
  62 + JdlRepository jdlRepository;
  63 +
  64 + @Autowired
  65 + JqlRepository jqlRepository;
  66 +
  67 + @Autowired
  68 + YlxxbRepository ylxxbRepository;
  69 +
  70 + @Autowired
  71 + CalcWaybillRepository calcWaybillRepository;
  72 +
  73 + @Autowired
  74 + CarConfigInfoRepository carConfigInfoRepository;
  75 +
  76 + @Autowired
  77 + CarsRepository carsRepository;
  78 +
  79 +
  80 + public String imporPWExcel(File file,String date) {
  81 + List<PWExcel> list = PoiUtils.importFromExcel2(file, 4, PWExcel.columns, PWExcel.class);
  82 + List<PWExcel> pwList = new ArrayList<>();
  83 + for (PWExcel pw : list) {
  84 + if(pw.getXl()!=null && !"小计".equals(pw.getXl()) && !"合计".equals(pw.getXl())){
  85 + pwList.add(pw);
  86 + }
  87 + }
  88 + List<Ticket> ticketList = new ArrayList<>();
  89 + for (int i = 0; i < pwList.size(); i++) {
  90 + PWExcel pw = pwList.get(i);
  91 + LineCompare lineCompare=BasicData.namePWOut2LineCodeMap.get(pw.getXl());
  92 + if(lineCompare==null){
  93 + return pw.getXl()+"未找到对应线路编码,请确认数据!";
  94 + }
  95 + if(lineCompare.getLineCode()==null){
  96 + continue;
  97 + }
  98 + Ticket ticket=new Ticket();
  99 + ticket.setDate(date);
  100 + ticket.setConvoy(lineCompare.getConvoy());
  101 + ticket.setLineName(BasicData.lineCode2NameMap.get(lineCompare.getLineCode()));
  102 + ticket.setLineCode(lineCompare.getLineCode());
  103 + ticket.setLineId(BasicData.lineId2CodeMap.inverse().get(lineCompare.getLineCode()));
  104 + ticket.setCount(pw.getDtrc());
  105 + ticket.setAmount(pw.getDtje());
  106 + ticket.setPayType("票务");
  107 + ticketList.add(ticket);
  108 + }
  109 + try {
  110 + transactionTemplate.execute(new TransactionCallbackWithoutResult() {
  111 + @Override
  112 + public void doInTransactionWithoutResult(TransactionStatus status) {
  113 + String date="";
  114 + for (Ticket ticket : ticketList) {
  115 + if(!date.contains(ticket.getDate())){
  116 + date+=("'"+ ticket.getDate()+"',");
  117 + }
  118 + }
  119 + //删除
  120 + jdbcTemplate.update("delete from ticket_info where pay_type='票务' and date in ("+date.substring(0,date.length()-1)+")");
  121 + //重新写入
  122 + jdbcTemplate.batchUpdate("insert into ticket_info(date,convoy,line_name,count,amount,pay_type,line_code,line_id)" +
  123 + " VALUES (?, ?, ?, ?, ?, ?, ?, ?)", new BatchPreparedStatementSetter() {
  124 + @Override
  125 + public void setValues(PreparedStatement ps, int i) throws SQLException {
  126 + Ticket ticket = ticketList.get(i);
  127 + ps.setString(1, ticket.getDate());
  128 + ps.setString(2, ticket.getConvoy());
  129 + ps.setString(3, ticket.getLineName());
  130 + ps.setInt(4, ticket.getCount());
  131 + ps.setDouble(5, ticket.getAmount());
  132 + ps.setString(6, ticket.getPayType());
  133 + ps.setString(7, ticket.getLineCode());
  134 + ps.setInt(8, ticket.getLineId());
  135 + }
  136 + @Override
  137 + public int getBatchSize() {
  138 + return ticketList.size();
  139 + }
  140 + });
  141 + }
  142 + });
  143 + } catch (TransactionException e) {
  144 + e.printStackTrace();
  145 + return "文件导入失败";
  146 + }finally {
  147 + file.delete();
  148 + }
  149 + return "文件导入成功";
  150 + }
  151 +
  152 + public String importQRCordExcel(File file,String date) {
  153 + List<QRCodeExcel> list = PoiUtils.importFromExcel2(file, 6, QRCodeExcel.columns, QRCodeExcel.class);
  154 + List<QRCodeExcel> qrList = new ArrayList<>();
  155 + for (QRCodeExcel qrCode : list) {
  156 + if(qrCode.getJylx()!=null && "小计".equals(qrCode.getJylx().trim())){
  157 + qrList.add(qrCode);
  158 + }
  159 + }
  160 + List<Ticket> ticketList = new ArrayList<>();
  161 + for (int i = 0; i < qrList.size(); i++) {
  162 + QRCodeExcel qrCode = qrList.get(i);
  163 + LineCompare lineCompare=BasicData.lineCodeOut2LineCodeMap.get(qrCode.getXl());
  164 + if(lineCompare==null){
  165 + return qrCode.getXl()+"未找到对应线路编码,请确认数据!";
  166 + }
  167 + Ticket ticket=new Ticket();
  168 + ticket.setDate(date);
  169 + ticket.setConvoy(lineCompare.getConvoy());
  170 + ticket.setLineName(BasicData.lineCode2NameMap.get(lineCompare.getLineCode()));
  171 + ticket.setLineCode(lineCompare.getLineCode());
  172 + ticket.setLineId(BasicData.lineId2CodeMap.inverse().get(lineCompare.getLineCode()));
  173 + ticket.setCount(qrCode.getSjbs());
  174 + ticket.setAmount(qrCode.getSjje());
  175 + ticket.setPayType("二维码");
  176 + ticketList.add(ticket);
  177 + }
  178 + try {
  179 + transactionTemplate.execute(new TransactionCallbackWithoutResult() {
  180 + @Override
  181 + public void doInTransactionWithoutResult(TransactionStatus status) {
  182 + String date="";
  183 + for (Ticket ticket : ticketList) {
  184 + if(!date.contains(ticket.getDate())){
  185 + date+=("'"+ ticket.getDate()+"',");
  186 + }
  187 + }
  188 + //删除
  189 + jdbcTemplate.update("delete from ticket_info where pay_type='二维码' and date in ("+date.substring(0,date.length()-1)+")");
  190 + //重新写入
  191 + jdbcTemplate.batchUpdate("insert into ticket_info(date,convoy,line_name,count,amount,pay_type,line_code,line_id)" +
  192 + " VALUES (?, ?, ?, ?, ?, ?, ?, ?)", new BatchPreparedStatementSetter() {
  193 + @Override
  194 + public void setValues(PreparedStatement ps, int i) throws SQLException {
  195 + Ticket ticket = ticketList.get(i);
  196 + ps.setString(1, ticket.getDate());
  197 + ps.setString(2, ticket.getConvoy());
  198 + ps.setString(3, ticket.getLineName());
  199 + ps.setInt(4, ticket.getCount());
  200 + ps.setDouble(5, ticket.getAmount());
  201 + ps.setString(6, ticket.getPayType());
  202 + ps.setString(7, ticket.getLineCode());
  203 + ps.setInt(8, ticket.getLineId());
  204 + }
  205 + @Override
  206 + public int getBatchSize() {
  207 + return ticketList.size();
  208 + }
  209 + });
  210 + }
  211 + });
  212 + } catch (TransactionException e) {
  213 + e.printStackTrace();
  214 + return "文件导入失败";
  215 + }finally {
  216 + file.delete();
  217 + }
  218 + return "文件导入成功";
  219 + }
  220 +
  221 + public String importCardExcel(File file,String date,String type) {
  222 + List< CardExcel > list = PoiUtils.importFromExcel2(file, 6, CardExcel.columns, CardExcel.class);
  223 + List<CardExcel> cardList = new ArrayList<>();
  224 + for (CardExcel card : list) {
  225 + if(card.getJylx()!=null && "小计".equals(card.getJylx().trim())){
  226 + cardList.add(card);
  227 + }
  228 + }
  229 + List<Ticket> ticketList = new ArrayList<>();
  230 + for (int i = 0; i < cardList.size(); i++) {
  231 + CardExcel card = cardList.get(i);
  232 + LineCompare lineCompare=BasicData.lineCodeOut2LineCodeMap.get(card.getXl());
  233 + if(lineCompare==null){
  234 + return card.getXl()+"未找到对应线路编码,请确认数据!";
  235 + }
  236 + Ticket ticket=new Ticket();
  237 + ticket.setDate(date);
  238 + ticket.setConvoy(lineCompare.getConvoy());
  239 + ticket.setLineName(BasicData.lineCode2NameMap.get(lineCompare.getLineCode()));
  240 + ticket.setLineCode(lineCompare.getLineCode());
  241 + ticket.setLineId(BasicData.lineId2CodeMap.inverse().get(lineCompare.getLineCode()));
  242 + ticket.setCount(card.getSjbs());
  243 + ticket.setAmount(card.getSjje());
  244 + ticket.setPayType(type);
  245 + ticketList.add(ticket);
  246 + }
  247 + try {
  248 + transactionTemplate.execute(new TransactionCallbackWithoutResult() {
  249 + @Override
  250 + public void doInTransactionWithoutResult(TransactionStatus status) {
  251 + String date="";
  252 + for (Ticket ticket : ticketList) {
  253 + if(!date.contains(ticket.getDate())){
  254 + date+=("'"+ ticket.getDate()+"',");
  255 + }
  256 + }
  257 + //删除
  258 + jdbcTemplate.update("delete from ticket_info where pay_type='"+type+"' and date in ("+date.substring(0,date.length()-1)+")");
  259 + //重新写入
  260 + jdbcTemplate.batchUpdate("insert into ticket_info(date,convoy,line_name,count,amount,pay_type,line_code,line_id)" +
  261 + " VALUES (?, ?, ?, ?, ?, ?, ?, ?)", new BatchPreparedStatementSetter() {
  262 + @Override
  263 + public void setValues(PreparedStatement ps, int i) throws SQLException {
  264 + Ticket ticket = ticketList.get(i);
  265 + ps.setString(1, ticket.getDate());
  266 + ps.setString(2, ticket.getConvoy());
  267 + ps.setString(3, ticket.getLineName());
  268 + ps.setInt(4, ticket.getCount());
  269 + ps.setDouble(5, ticket.getAmount());
  270 + ps.setString(6, ticket.getPayType());
  271 + ps.setString(7, ticket.getLineCode());
  272 + ps.setInt(8, ticket.getLineId());
  273 + }
  274 + @Override
  275 + public int getBatchSize() {
  276 + return ticketList.size();
  277 + }
  278 + });
  279 + }
  280 + });
  281 + } catch (TransactionException e) {
  282 + e.printStackTrace();
  283 + return "文件导入失败";
  284 + }finally {
  285 + file.delete();
  286 + }
  287 + return "文件导入成功";
  288 + }
  289 +
  290 + public String importExcel(File file) {
  291 + String[] columns = new String[]{"date","convoy","lineName","count","amount","payType"};
  292 + final List<Ticket> ticketList = PoiUtils.importFromExcel(file, 1, columns, Ticket.class);
  293 + for (int i = 0; i < ticketList.size(); i++) {
  294 + Ticket ticket = ticketList.get(i);
  295 + String lineCode=BasicData.Name2LineCodeMap.get(ticket.getLineName());
  296 + if(lineCode==null){
  297 + return "第"+(i+2)+"行数据有误,请确认数据!";
  298 + }
  299 + ticket.setLineCode(lineCode);
  300 + ticket.setLineId(BasicData.lineId2CodeMap.inverse().get(lineCode));
  301 + }
  302 + try {
  303 + transactionTemplate.execute(new TransactionCallbackWithoutResult() {
  304 + @Override
  305 + public void doInTransactionWithoutResult(TransactionStatus status) {
  306 + String date="";
  307 + for (Ticket ticket : ticketList) {
  308 + if(!date.contains(ticket.getDate())){
  309 + date+=("'"+ ticket.getDate()+"',");
  310 + }
  311 + }
  312 + //删除
  313 + jdbcTemplate.update("delete from ticket_info where date in ("+date.substring(0,date.length()-1)+")");
  314 + //重新写入
  315 + jdbcTemplate.batchUpdate("insert into ticket_info(date,convoy,line_name,count,amount,pay_type,line_code,line_id)" +
  316 + " VALUES (?, ?, ?, ?, ?, ?, ?, ?)", new BatchPreparedStatementSetter() {
  317 + @Override
  318 + public void setValues(PreparedStatement ps, int i) throws SQLException {
  319 + Ticket ticket = ticketList.get(i);
  320 + ps.setString(1, ticket.getDate());
  321 + ps.setString(2, ticket.getConvoy());
  322 + ps.setString(3, ticket.getLineName());
  323 + ps.setInt(4, ticket.getCount());
  324 + ps.setDouble(5, ticket.getAmount());
  325 + ps.setString(6, ticket.getPayType());
  326 + ps.setString(7, ticket.getLineCode());
  327 + ps.setInt(8, ticket.getLineId());
  328 + }
  329 + @Override
  330 + public int getBatchSize() {
  331 + return ticketList.size();
  332 + }
  333 + });
  334 + }
  335 + });
  336 + } catch (TransactionException e) {
  337 + e.printStackTrace();
  338 + return "文件导入失败";
  339 + }finally {
  340 + file.delete();
  341 + }
  342 + return "文件导入成功";
  343 + }
  344 + private static DecimalFormat df = new DecimalFormat("#.00");
  345 + @Override
  346 + public Map<String, Object> query(Map<String, Object> map) {
  347 + Map<String, Object> modelMap = new HashMap<>();
  348 + String dateS = map.get("dateS").toString().trim();
  349 + String dateE = map.get("dateE").toString().trim();
  350 +
  351 + int dayCount = getDayCount(dateS,dateE);
  352 +
  353 +
  354 + String date=dateS.substring(0,7)+"~"+dateE.substring(0,7);
  355 + StringBuffer sql=new StringBuffer("SELECT * FROM ticket_info where 1=1 ");
  356 + if(dateS!=null && !"".equals(dateS)){
  357 + sql.append("and date>='"+dateS+"'");
  358 + }
  359 + if(dateE!=null && !"".equals(dateE)){
  360 + sql.append("and date<='"+dateE+"'");
  361 + }
  362 + List<Ticket> query = jdbcTemplate.query(sql.toString(), BeanPropertyRowMapper.newInstance(Ticket.class));
  363 + Integer page = Integer.valueOf(map.containsKey("page")?map.get("page").toString():"0");
  364 + if(!map.containsKey("type")){
  365 + int end = (page+1)*10>query.size()?query.size():(page+1)*10;
  366 + modelMap.put("dataList", query.subList(page*10, end));
  367 + modelMap.put("totalPages", query.size()%10>0?query.size()/10+1:query.size()/10);
  368 + } else if(map.get("type").toString().equals("export")){
  369 + //查询线路信息
  370 + List<LineInformation> lineList=lineInformationRepository.findAll();
  371 + Map<String,LineInformation> lines=new HashMap<>();
  372 + for (LineInformation line : lineList) {
  373 + lines.put(line.getLine().getLineCode(),line);
  374 + }
  375 + //查询车辆数
  376 + List<Map<String,Object>> carCountList =jdbcTemplate.queryForList("SELECT xl,count(*) c FROM `bsth_c_s_ccinfo` where is_cancel=0 GROUP BY xl");
  377 + Map<String,Integer> carCounts=new HashMap<>();
  378 + for (Map<String, Object> stringObjectMap : carCountList) {
  379 + carCounts.put(stringObjectMap.get("xl").toString(),Integer.valueOf(stringObjectMap.get("c").toString()));
  380 + }
  381 + //查询1对多线路 用于后续合并线路数据
  382 + List<Map<String,Object>> lineCompare =jdbcTemplate.queryForList("SELECT line_code,line_code2,name_pw,convoy FROM `bsth_c_line_compare` where line_code is not null");
  383 + Map<String,String> compareMap=new HashMap<>();
  384 + for (Map<String, Object> m : lineCompare) {
  385 + if(m.get("line_code2")!=null){
  386 + compareMap.put(m.get("line_code2").toString(),m.get("line_code").toString());
  387 + }
  388 + }
  389 +
  390 + //查询路单数据
  391 + List<Map<String,Object>> ldList =jdbcTemplate.queryForList(
  392 + "SELECT c.sfdc d,c.sfmix h,c.hydrogen q,b.xl lineCode,b.cl nbbm,b.jhyybc,b.sjyybc,b.jhyylc,b.sjyylc,b.sjfyylc,b.rq_str rq,b.j_gh jgh from calc_waybill b LEFT JOIN " +
  393 + "bsth_c_cars c on c.inside_code=b.cl where b.rq_str>='"+dateS+"' and b.rq_str<='"+dateE+"'");
  394 + if(ldList.size()==0){
  395 + modelMap.put("code","500");
  396 + modelMap.put("msg","缺少路单统计数据");
  397 + return modelMap;
  398 + }
  399 + //查询车辆配置
  400 + List<CarConfigInfo> carConfigInfoList = carConfigInfoRepository.findAll();
  401 + List<Cars> carList=carsRepository.findCars();
  402 + Map<String,Map<String,Object>> ccinfos=new HashMap<>();
  403 + for (Cars cars : carList) {
  404 + Map<String,Object> ccinfo=new HashMap<>();
  405 + ccinfo.put("d",cars.getSfdc());
  406 + ccinfo.put("h",cars.getSfmix());
  407 + ccinfo.put("q",cars.getHydrogen());
  408 + ccinfos.put(cars.getInsideCode().replace("-",""),ccinfo);
  409 + }
  410 + for (CarConfigInfo carConfigInfo : carConfigInfoList) {
  411 + Map<String,Object> ccinfo=new HashMap<>();
  412 + ccinfo.put("lineCode",carConfigInfo.getXl().getLineCode());
  413 + ccinfo.put("d",carConfigInfo.getCl().getSfdc());
  414 + ccinfo.put("h",carConfigInfo.getCl().getSfmix());
  415 + ccinfo.put("q",carConfigInfo.getCl().getHydrogen());
  416 + ccinfos.put(carConfigInfo.getCl().getInsideCode().replace("-",""),ccinfo);
  417 + }
  418 + //线路里程、班次、车次计算
  419 + Map<String,Integer> bcMap=new HashMap<>();
  420 + Map<String,Double> lcMap=new HashMap<>();
  421 + Map<String,Integer> ccMap=new HashMap<>();
  422 + Map<String,Map<String,Double>> clxllcMap=new HashMap<>();
  423 + for (Map<String, Object> m : ldList) {
  424 + String lineCode= (String) m.get("lineCode");
  425 + if(compareMap.get(lineCode)!=null){
  426 + lineCode=compareMap.get(lineCode);
  427 + }
  428 + //各类型车实际里程
  429 + if(m.get("d")!=null&&(boolean)m.get("d")){//电车
  430 + Double lc=lcMap.get(lineCode+"_d")==null?0d:lcMap.get(lineCode+"_d");
  431 + lcMap.put(lineCode+"_d",lc+(double)m.get("sjyylc"));
  432 + }else if(m.get("h")!=null&&(boolean)m.get("h")){//混动
  433 + Double lc=lcMap.get(lineCode+"_h")==null?0d:lcMap.get(lineCode+"_h");
  434 + lcMap.put(lineCode+"_h",lc+(double)m.get("sjyylc"));
  435 + }else if(m.get("q")!=null&&(boolean)m.get("q")){//氢能
  436 + Double lc=lcMap.get(lineCode+"_q")==null?0d:lcMap.get(lineCode+"_q");
  437 + lcMap.put(lineCode+"_q",lc+(double)m.get("sjyylc"));
  438 + }else {//油车
  439 + Double lc=lcMap.get(lineCode+"_y")==null?0d:lcMap.get(lineCode+"_y");
  440 + lcMap.put(lineCode+"_y",lc+(double)m.get("sjyylc"));
  441 + }
  442 + //计划运营里程
  443 + double jhyylc=lcMap.get(lineCode+"_jhyylc")==null?0d:lcMap.get(lineCode+"_jhyylc");
  444 + lcMap.put(lineCode+"_jhyylc",jhyylc+(double)m.get("jhyylc"));
  445 + //实际运营里程
  446 + double sjyylc=lcMap.get(lineCode+"_sjyylc")==null?0d:lcMap.get(lineCode+"_sjyylc");
  447 + lcMap.put(lineCode+"_sjyylc",sjyylc+(double)m.get("sjyylc"));
  448 + //实际非运营里程
  449 + double sjfyylc=lcMap.get(lineCode+"_sjfyylc")==null?0d:lcMap.get(lineCode+"_sjfyylc");
  450 + lcMap.put(lineCode+"_sjfyylc",sjfyylc+(double)m.get("sjfyylc"));
  451 + //计划班次数
  452 + int jhyybc=bcMap.get(lineCode+"_jhyybc")==null?0:bcMap.get(lineCode+"_jhyybc");
  453 + bcMap.put(lineCode+"_jhyybc",jhyybc+(int)m.get("jhyybc"));
  454 + //实际班次数
  455 + int sjyybc=bcMap.get(lineCode+"_sjyybc")==null?0:bcMap.get(lineCode+"_sjyybc");
  456 + bcMap.put(lineCode+"_sjyybc",sjyybc+(int)m.get("sjyybc"));
  457 + //车次
  458 + int cc=ccMap.get(lineCode)==null?0:ccMap.get(lineCode);
  459 + ccMap.put(lineCode,cc+=1);
  460 + String nbbm= m.get("nbbm").toString().replace("-","");
  461 + Map<String,Double> lclcMap=clxllcMap.get(nbbm);
  462 + if(lclcMap==null){
  463 + Map<String,Double> lclcMap2=new HashMap<>();
  464 + lclcMap2.put(lineCode,(double)m.get("sjyylc"));
  465 + lclcMap2.put("sum",(double)m.get("sjyylc"));
  466 + clxllcMap.put(nbbm,lclcMap2);
  467 + }else {
  468 + Double lcxlcl=lclcMap.get(lineCode)==null?0d:lclcMap.get(lineCode);
  469 + lclcMap.put(lineCode,lcxlcl+(double)m.get("sjyylc"));
  470 + Double lcxlclSum=lclcMap.get("sum")==null?0d:lclcMap.get("sum");
  471 + lclcMap.put("sum",lcxlclSum+(double)m.get("sjyylc"));
  472 + }
  473 + }
  474 +
  475 + Map<String,Map<String,Object>> clMap=new HashMap<>();
  476 + for (Map<String, Object> m : ldList) {
  477 + clMap.put(m.get("rq")+"_"+m.get("nbbm").toString().replace("-","")/*+"_"+m.get("jgh")*/,m);
  478 + }
  479 + //线路燃料计算
  480 + Map<String,Double> rlMap=new HashMap<>();
  481 + dateS+=" 00:00:00";
  482 + dateE+=" 23:59:59";
  483 + //计算加油数据(包含油车和混动)
  484 + List<Ylxxb> jyList = ylxxbRepository.ylxxbList(dateS,dateE);
  485 + for (Ylxxb y : jyList) {
  486 + Map<String,Object> m=clMap.get(y.getRqStr()+"_"+y.getNbbm().replace("-","")/*+"_"+y.getJsy()*/);
  487 + if(m==null){//找不到路单以车辆配置表为准
  488 + m=ccinfos.get(y.getNbbm().replace("-",""));
  489 + logger.info("未查询到路单:"+y.getRqStr()+"_"+y.getNbbm()+" 使用默认配置线路:"+m.get("lineCode"));
  490 + }
  491 + String lineCode= (String) m.get("lineCode");
  492 + if(compareMap.get(lineCode)!=null){
  493 + lineCode=compareMap.get(lineCode);
  494 + }
  495 + if(m.get("h")!=null&&(boolean)m.get("h")){//混动
  496 + Double jyl=rlMap.get(lineCode+"_h_y")==null?0d:rlMap.get(lineCode+"_h_y");
  497 + rlMap.put(lineCode+"_h_y",jyl+y.getJzl());//线路混动车加油量
  498 + Double jylSum=rlMap.get(lineCode+"_y")==null?0d:rlMap.get(lineCode+"_y");
  499 + rlMap.put(lineCode+"_y",jylSum+y.getJzl());//线路加油量
  500 + }else if((m.get("h")==null||!(boolean)m.get("h")) && (m.get("d")==null||!(boolean)m.get("d")) &&
  501 + (m.get("q")==null||!(boolean)m.get("q"))) {//油车
  502 + Double jyl=rlMap.get(lineCode+"_y_y")==null?0d:rlMap.get(lineCode+"_y_y");
  503 + rlMap.put(lineCode+"_y_y",jyl+y.getJzl());//线路油车加油量
  504 + Double jylSum=rlMap.get(lineCode+"_y")==null?0d:rlMap.get(lineCode+"_y");
  505 + rlMap.put(lineCode+"_y",jylSum+y.getJzl());//线路加油量
  506 + }
  507 + }
  508 +
  509 + //计算充电数据(包含电车和氢能)
  510 + List<Jdl> jdList = jdlRepository.JdlList(dateS,dateE);
  511 + for (Jdl d : jdList) {
  512 + Map<String,Double> lclcMap=clxllcMap.get(d.getNbbm().replace("-",""));
  513 + Map<String,Object> m=ccinfos.get(d.getNbbm().replace("-",""));
  514 + double cljdlSum=d.getJdl();
  515 + if(lclcMap==null){//找不到路单以车辆配置表为准
  516 + logger.info("未查询到路单:"+d.getNbbm());
  517 + if(m==null){
  518 + logger.info("车辆不存在:"+d.getNbbm());
  519 + modelMap.put("code","500");
  520 + modelMap.put("msg","车辆不存在:"+d.getNbbm());
  521 + return modelMap;
  522 +
  523 + }
  524 + else if(m.get("lineCode")==null){
  525 + logger.info("车辆线路未配置:"+d.getNbbm());
  526 + modelMap.put("code","500");
  527 + modelMap.put("msg","车辆未配置:"+d.getNbbm());
  528 + return modelMap;
  529 + }
  530 + String lineCode=m.get("lineCode").toString();
  531 + if(compareMap.get(lineCode)!=null){
  532 + lineCode=compareMap.get(lineCode);
  533 + }
  534 + if((boolean)m.get("d")){//电车
  535 + Double jdl=rlMap.get(lineCode+"_d_d")==null?0d:rlMap.get(lineCode+"_d_d");
  536 + rlMap.put(lineCode+"_d_d",jdl+cljdlSum);//线路电车加电量
  537 + Double jdlSum=rlMap.get(lineCode+"_d")==null?0d:rlMap.get(lineCode+"_d");
  538 + rlMap.put(lineCode+"_d",jdlSum+cljdlSum);//线路加电量
  539 + }else if((boolean)m.get("q")){//氢能车
  540 + Double jdl=rlMap.get(lineCode+"_q_d")==null?0d:rlMap.get(lineCode+"_q_d");
  541 + rlMap.put(lineCode+"_q_d",jdl+cljdlSum);//线路氢能车加电量
  542 + Double jdlSum=rlMap.get(lineCode+"_d")==null?0d:rlMap.get(lineCode+"_d");
  543 + rlMap.put(lineCode+"_d",jdlSum+cljdlSum);//线路加电量
  544 + }
  545 + }else{
  546 + double sum=lclcMap.get("sum");
  547 + Set<String>keys=lclcMap.keySet();
  548 + for (String lineCode : keys) {
  549 + if(compareMap.get(lineCode)!=null){
  550 + lineCode=compareMap.get(lineCode);
  551 + }
  552 + double lc=lclcMap.get(lineCode);
  553 + if(!lineCode.equals("sum")){
  554 + double sjjdl=cljdlSum;
  555 + if(sum!=0){
  556 + sjjdl=cljdlSum*lc/sum;
  557 + }
  558 + if((boolean)m.get("d")){//电车
  559 + Double jdl=rlMap.get(lineCode+"_d_d")==null?0d:rlMap.get(lineCode+"_d_d");
  560 + rlMap.put(lineCode+"_d_d",jdl+sjjdl);//线路电车加电量
  561 + Double jdlSum=rlMap.get(lineCode+"_d")==null?0d:rlMap.get(lineCode+"_d");
  562 + rlMap.put(lineCode+"_d",jdlSum+sjjdl);//线路加电量
  563 + }else if((boolean)m.get("q")){//氢能车
  564 + Double jdl=rlMap.get(lineCode+"_q_d")==null?0d:rlMap.get(lineCode+"_q_d");
  565 + rlMap.put(lineCode+"_q_d",jdl+sjjdl);//线路氢能车加电量
  566 + Double jdlSum=rlMap.get(lineCode+"_d")==null?0d:rlMap.get(lineCode+"_d");
  567 + rlMap.put(lineCode+"_d",jdlSum+sjjdl);//线路加电量
  568 + }
  569 + }
  570 + }
  571 + }
  572 + }
  573 + //查询加氢数据
  574 + List<Jql> jqList = jqlRepository.JqlList(dateS,dateE);
  575 + for (Jql q : jqList) {
  576 + Map<String,Object> m=clMap.get(q.getRqStr()+"_"+q.getNbbm().toString().replace("-","")/*+"_"+q.getJsy()*/);
  577 + if(m==null){//找不到路单以车辆配置表为准
  578 + m=ccinfos.get(q.getNbbm());
  579 + logger.info("未查询到路单:"+q.getRqStr()+"_"+q.getNbbm()+" 使用默认配置线路:"+m.get("lineCode"));
  580 + }
  581 + String lineCode= (String) m.get("lineCode");
  582 + if(compareMap.get(lineCode)!=null){
  583 + lineCode=compareMap.get(lineCode);
  584 + }
  585 + if((boolean)m.get("q")){//氢能车
  586 + Double jql=rlMap.get(lineCode+"_q_q")==null?0d:rlMap.get(lineCode+"_q_q");
  587 + rlMap.put(lineCode+"_q_q",jql+q.getJql());//线路氢能车加氢量
  588 + Double jdlSum=rlMap.get(lineCode+"_q")==null?0d:rlMap.get(lineCode+"_q");
  589 + rlMap.put(lineCode+"_q",jdlSum+q.getJql());//线路加氢量
  590 + }
  591 + }
  592 + //查询票务数据
  593 + if(query.size()==0){
  594 + modelMap.put("code","500");
  595 + modelMap.put("msg","缺少票务数据");
  596 + return modelMap;
  597 + }
  598 +
  599 + ListMultimap<String, Xlybtz> list = ArrayListMultimap.create();
  600 + Map<String,List<Ticket>> ticketGroup= query.stream().collect(Collectors.groupingBy(Ticket::getLineCode));
  601 + for (Map<String, Object> m : lineCompare) {
  602 + String lineCode=m.get("line_code").toString();
  603 + String lineName=m.get("name_pw").toString();
  604 + String convoy=m.get("convoy").toString();
  605 + List<Ticket> tickets=ticketGroup.get(lineCode);
  606 + int rcpw=0;//人次票务
  607 + int rcpos=0;//人次POS
  608 + int yspw=0;//营收票务
  609 + int yspos=0;//营收POS
  610 + int rcbtk=0;//人次保通卡
  611 +
  612 + if(tickets!=null){
  613 + for (Ticket ticket : tickets) {
  614 + if("申城通".equals(ticket.getPayType())||"二维码".equals(ticket.getPayType())||"实体卡".equals(ticket.getPayType())){
  615 + rcpos+= ticket.getCount();
  616 + yspos+= ticket.getAmount();
  617 + }
  618 + if ("票务".equals(ticket.getPayType())){
  619 + rcpw+= ticket.getCount();
  620 + yspw+= ticket.getAmount();
  621 + }
  622 + if ("保通卡".equals(ticket.getPayType())){
  623 + rcbtk+= ticket.getCount();
  624 + }
  625 + }
  626 + }
  627 + Xlybtz xlybtz=new Xlybtz();
  628 + xlybtz.setXl(lineName);// 路线
  629 + xlybtz.setXlcd((lines.get(lineCode).getUpMileage()+lines.get(lineCode).getDownMileage())/2);// 线路长度
  630 + if(carCounts.get(BasicData.lineId2CodeMap.inverse().get(lineCode))==null){
  631 + System.out.println(BasicData.lineId2CodeMap.inverse().get(lineCode));
  632 + }
  633 + int clsdx=carCounts.get(BasicData.lineId2CodeMap.inverse().get(lineCode).toString());
  634 + xlybtz.setCldx(clsdx);// 车辆数大型
  635 + xlybtz.setClzx(0);// 31中型
  636 + xlybtz.setRcpw(rcpw);// 人次票务
  637 + xlybtz.setRcpos(rcpos);// 人次POS
  638 + xlybtz.setRchj(rcpw+rcpos);//人次合计
  639 + int sjyybc=bcMap.get(lineCode+"_sjyybc")==null?0:bcMap.get(lineCode+"_sjyybc");
  640 + xlybtz.setRcrjdc(xlybtz.getRchj()/( xlybtz.getCldx()+xlybtz.getClzx())/dayCount);// 人次日均单车
  641 + xlybtz.setYspw(yspw);// 营收票务
  642 + xlybtz.setYspos(yspos);// 营收POS
  643 + xlybtz.setYsyhhc(0);// 营收优惠换乘
  644 + xlybtz.setYsbtk(0);// 营收保通卡
  645 + xlybtz.setYshj(yspw+yspos);//营收合计
  646 + xlybtz.setYsrjdc(xlybtz.getYshj()/( xlybtz.getCldx()+xlybtz.getClzx())/dayCount);// 营收日均单车
  647 +
  648 + double cygl=lcMap.get(lineCode+"_y")==null?0d:lcMap.get(lineCode+"_y");
  649 + double ydgl=lcMap.get(lineCode+"_h")==null?0d:lcMap.get(lineCode+"_h");
  650 + double cdgl=lcMap.get(lineCode+"_d")==null?0d:lcMap.get(lineCode+"_d");
  651 + double qrlgl=lcMap.get(lineCode+"_q")==null?0d:lcMap.get(lineCode+"_q");
  652 + double zlc=cygl+ydgl+cdgl+qrlgl;
  653 + if(zlc!=0){
  654 + xlybtz.setBglys(Double.parseDouble(df.format((yspw+yspos)/zlc*100)));// 百公里营收(元)
  655 + }
  656 + xlybtz.setCygl(Double.parseDouble(df.format(cygl)));// 柴油(公里)
  657 + xlybtz.setYdgl(Double.parseDouble(df.format(ydgl)));// 油电(公里)
  658 + xlybtz.setCdgl(Double.parseDouble(df.format(cdgl)));// 纯电(公里)
  659 + xlybtz.setQrlgl(Double.parseDouble(df.format(qrlgl)));// 氢燃料(公里)
  660 + double cys=rlMap.get(lineCode+"_y_y")==null?0d:rlMap.get(lineCode+"_y_y");
  661 + double yds=rlMap.get(lineCode+"_h_y")==null?0d:rlMap.get(lineCode+"_h_y");
  662 + double dhd=rlMap.get(lineCode+"_d")==null?0d:rlMap.get(lineCode+"_d");
  663 + /*rlMap.remove(lineCode+"_d");*/
  664 + double qrlqk=rlMap.get(lineCode+"_q")==null?0d:rlMap.get(lineCode+"_q");
  665 + double cddh=rlMap.get(lineCode+"_d_d")==null?0d:rlMap.get(lineCode+"_d_d");
  666 + xlybtz.setCys(Double.parseDouble(df.format(cys)));// 柴油(升)
  667 + xlybtz.setYds(Double.parseDouble(df.format(yds)));// 油电(升)
  668 + xlybtz.setDhd(Double.parseDouble(df.format(dhd)));// 电耗(度)
  669 + xlybtz.setCddh(Double.parseDouble(df.format(cddh)));// 纯度电耗(度)
  670 + xlybtz.setQrlqk(Double.parseDouble(df.format(qrlqk)));// 氢燃料(千克)
  671 + if(cygl!=0){
  672 + xlybtz.setCysbgl(Double.parseDouble(df.format((cys/cygl*100))));// 柴油升/百公里
  673 + }
  674 + if(ydgl!=0){
  675 + xlybtz.setYdsbgl(Double.parseDouble(df.format((yds/ydgl*100))));// 油电升/百公里
  676 + }
  677 + if(cdgl!=0){
  678 + xlybtz.setCddbgl(Double.parseDouble(df.format((cddh/cdgl*100))));// 纯电度/百公里
  679 + }
  680 + xlybtz.setBtkrc(rcbtk);// 保通卡(人次)
  681 + int jhyybc=bcMap.get(lineCode+"_jhyybc")==null?0:bcMap.get(lineCode+"_jhyybc");
  682 + xlybtz.setJhbc(jhyybc);// 计划班次
  683 + xlybtz.setSjbc(sjyybc);// 实际班次
  684 + double jhyylc=lcMap.get(lineCode+"_jhyylc")==null?0:Double.parseDouble(df.format(lcMap.get(lineCode+"_jhyylc")));
  685 + xlybtz.setJhgl(jhyylc);// 计划公里
  686 + double sjyylc=lcMap.get(lineCode+"_sjyylc")==null?0:Double.parseDouble(df.format(lcMap.get(lineCode+"_sjyylc")));
  687 + xlybtz.setSjgl(sjyylc);// 实际公里
  688 + if(jhyylc!=0){
  689 + xlybtz.setGlwc(Double.parseDouble(df.format( sjyylc/jhyylc*100)));// 公里完成%
  690 + }
  691 + if(jhyybc!=0){
  692 + xlybtz.setBcwc(Double.parseDouble(df.format((double)sjyybc/jhyybc*100)));// 班次完成%
  693 + }
  694 + xlybtz.setCr(ccMap.get(lineCode)==null?0:ccMap.get(lineCode));// 车日
  695 + double sjfyylc=lcMap.get(lineCode+"_sjfyylc")==null?0:Double.parseDouble(df.format(lcMap.get(lineCode+"_sjfyylc")));
  696 + xlybtz.setKsgl(sjfyylc);// 其中:空驶公里
  697 + if(rcpw+rcpos!=0){
  698 + xlybtz.setPjpj(Double.parseDouble(df.format((double)(yspw+yspos)/(rcpw+rcpos))));// 平均票价
  699 + }
  700 + list.put(convoy,xlybtz);
  701 + }
  702 +
  703 + /*rlMap.forEach((k,v)->{
  704 + if(k.contains("_d")&&k.split("_").length==2){
  705 + System.out.println(k+"_"+v);
  706 + }
  707 + });*/
  708 + Set<String> keys=list.keySet();
  709 + List<String>keyList=keys.stream().sorted(Collator.getInstance(Locale.TRADITIONAL_CHINESE)).collect(Collectors.toList());//车队名排序
  710 + List<Xlybtz> xlybtzList=new ArrayList<>();//含合计数据集
  711 + List<Xlybtz> xlybtzListAll=new ArrayList<>();//不含合计数据集
  712 + for (String s : keyList) {
  713 + List<Xlybtz> xlybtzs=list.get(s);//车队
  714 + xlybtzList.addAll(list.get(s));
  715 + xlybtzList.add(Xlybtz.getTotal(xlybtzs,s,dayCount));//车队合计
  716 + xlybtzListAll.addAll(list.get(s));
  717 + }
  718 + xlybtzList.add(Xlybtz.getTotal(xlybtzListAll,"公司合计:",dayCount));///公司合计
  719 + List<Iterator<?>> listI = new ArrayList<>();
  720 + Map<String, Object> m = new HashMap<>();
  721 + m.put("date",date);
  722 + ReportUtils ee = new ReportUtils();
  723 + try {
  724 + listI.add(xlybtzList.iterator());
  725 + String path = this.getClass().getResource("/").getPath()+"static/pages/forms/";
  726 + ee.excelReplace(listI, new Object[] { m }, path+"mould/路线生产月报台账.xls",
  727 + path+"export/路线生产月报台账.xls");
  728 + } catch (Exception e) {
  729 + // TODO: handle exception
  730 + e.printStackTrace();
  731 + }
  732 + }
  733 + modelMap.put("code","00");
  734 + return modelMap;
  735 + }
  736 +
  737 +
  738 +
  739 + public static int getDayCount(String start, String end) {
  740 + YearMonth startYearMonth = YearMonth.of(Integer.parseInt(start.substring(0,4)), Integer.parseInt(start.substring(5,7))); // 起始年月
  741 + YearMonth endYearMonth = YearMonth.of(Integer.parseInt(end.substring(0,4)), Integer.parseInt(end.substring(6,7))); // 结束年月
  742 + List<YearMonth> yearMonthsBetween = getYearMonthsBetween(startYearMonth, endYearMonth);
  743 + int count = yearMonthsBetween.stream().mapToInt(yearMonth -> YearMonth.of(yearMonth.getYear(), yearMonth.getMonth()).lengthOfMonth()).sum();
  744 + return count;
  745 + }
  746 + //计算间隔月
  747 + public static List<YearMonth> getYearMonthsBetween(YearMonth start, YearMonth end) {
  748 + List<YearMonth> months = new ArrayList<>();
  749 + YearMonth current = start;
  750 + while (current.isBefore(end) || current.equals(end)) {
  751 + months.add(current);
  752 + current = current.plusMonths(1);
  753 + }
  754 + return months;
  755 + }
  756 +}
src/main/java/com/bsth/service/schedule/utils/PoiUtils.java
@@ -274,25 +274,27 @@ public class PoiUtils { @@ -274,25 +274,27 @@ public class PoiUtils {
274 Object value = null; 274 Object value = null;
275 if (cell != null) { 275 if (cell != null) {
276 CellValue cellValue = evaluator.evaluate(cell); 276 CellValue cellValue = evaluator.evaluate(cell);
277 - switch (cellValue.getCellType()) {  
278 - case Cell.CELL_TYPE_NUMERIC:  
279 - value = cellValue.getNumberValue();  
280 - if (HSSFDateUtil.isCellDateFormatted(cell)) {  
281 - value = cell.getDateCellValue();  
282 - }  
283 - break;  
284 - case Cell.CELL_TYPE_STRING:  
285 - value = cellValue.getStringValue();  
286 - break;  
287 - case Cell.CELL_TYPE_BOOLEAN:  
288 - value = cellValue.getBooleanValue();  
289 - break;  
290 - case Cell.CELL_TYPE_BLANK:  
291 - case Cell.CELL_TYPE_ERROR:  
292 - value = "";  
293 - break;  
294 - default:  
295 - break; 277 + if(cellValue!=null){
  278 + switch (cellValue.getCellType()) {
  279 + case Cell.CELL_TYPE_NUMERIC:
  280 + value = cellValue.getNumberValue();
  281 + if (HSSFDateUtil.isCellDateFormatted(cell)) {
  282 + value = cell.getDateCellValue();
  283 + }
  284 + break;
  285 + case Cell.CELL_TYPE_STRING:
  286 + value = cellValue.getStringValue();
  287 + break;
  288 + case Cell.CELL_TYPE_BOOLEAN:
  289 + value = cellValue.getBooleanValue();
  290 + break;
  291 + case Cell.CELL_TYPE_BLANK:
  292 + case Cell.CELL_TYPE_ERROR:
  293 + value = "";
  294 + break;
  295 + default:
  296 + break;
  297 + }
296 } 298 }
297 } 299 }
298 300
@@ -307,5 +309,44 @@ public class PoiUtils { @@ -307,5 +309,44 @@ public class PoiUtils {
307 List<Energy> energies = importFromExcel(new File("C:\\Users\\Hill\\Downloads\\充电数据.xls"), 2, columns, Energy.class); 309 List<Energy> energies = importFromExcel(new File("C:\\Users\\Hill\\Downloads\\充电数据.xls"), 2, columns, Energy.class);
308 System.out.println(energies); 310 System.out.println(energies);
309 } 311 }
  312 +
  313 + /**
  314 + * 导入数据
  315 + * @param file 文件
  316 + * @param skipRows 跳过行数
  317 + * @param columns 对应的字段列信息
  318 + * @param cls 对象类型class
  319 + * @param <T> 对象类型
  320 + * @return
  321 + */
  322 + public static <T> List<T> importFromExcel2(File file, int skipRows, String[] columns, Class<T> cls) {
  323 + List<T> list = new ArrayList<>();
  324 + try {
  325 + POIFSFileSystem fs = new POIFSFileSystem(new FileInputStream(file));
  326 + HSSFWorkbook wb = new HSSFWorkbook(fs);
  327 + HSSFFormulaEvaluator evaluator = wb.getCreationHelper().createFormulaEvaluator();
  328 + HSSFSheet sheet = wb.getSheetAt(0);
  329 + int rows = sheet.getLastRowNum() + 1;
  330 +
  331 + List<Map<String, Object>> data = new ArrayList<>();
  332 + for (int i = skipRows;i < rows;i++) {
  333 + HSSFRow row = sheet.getRow(i);
  334 + Map<String, Object> map = new HashMap<>();
  335 + int cols = columns.length;
  336 + for (int j = 0;j < cols;j++) {
  337 + String column = columns[j];
  338 + if (column != null) {
  339 + map.put(columns[j], getCellValue(evaluator, row.getCell(j)));
  340 + }
  341 + }
  342 + data.add(map);
  343 + }
  344 + list = mapper.convertValue(data, mapper.getTypeFactory().constructParametrizedType(ArrayList.class, List.class, cls));
  345 + } catch (IOException e) {
  346 + e.printStackTrace();
  347 + }
  348 +
  349 + return list;
  350 + }
310 } 351 }
311 352
src/main/resources/static/pages/electricity/jdl/list.html
1 -<style>  
2 -.blue{  
3 - background-color: #87CEFF  
4 -} 1 +<style>
  2 +.blue{
  3 + background-color: #87CEFF
  4 +}
5 </style> 5 </style>
6 <div class="page-head"> 6 <div class="page-head">
7 <div class="page-title"> 7 <div class="page-title">
@@ -27,56 +27,46 @@ @@ -27,56 +27,46 @@
27 <button type="button" class="btn btn-circle blue" id="upload"><i class="fa fa-file-excel-o"></i> 27 <button type="button" class="btn btn-circle blue" id="upload"><i class="fa fa-file-excel-o"></i>
28 导入Excel 28 导入Excel
29 </button> 29 </button>
30 - <button type="button" class="btn btn-circle blue" id="export"><i class="fa fa-file-excel-o"></i> 30 + <!--<button type="button" class="btn btn-circle blue" id="export"><i class="fa fa-file-excel-o"></i>
31 导出Excel 31 导出Excel
32 - </button> 32 + </button>-->
33 </div> 33 </div>
34 </div> 34 </div>
35 <div class="portlet-body"> 35 <div class="portlet-body">
36 <div class="table-container" style="margin-top: 0px"> 36 <div class="table-container" style="margin-top: 0px">
37 - <table  
38 - class="table table-striped table-bordered table-hover table-checkable"  
39 - id="datatable_dlb"> 37 + <table class="table table-striped table-bordered table-hover table-checkable" id="datatable_dlb">
40 <thead> 38 <thead>
  39 + <tr role="row" class="heading">
  40 + <th width="5%">#</th>
  41 + <th width="20%">日期</th>
  42 + <th width="20%">内部编码</th>
  43 + <th width="20%">车牌</th>
  44 + <th width="20%">充电量</th>
  45 + <th width="15%">备注</th>
  46 + </tr>
41 <tr role="row" class="filter"> 47 <tr role="row" class="filter">
42 - <td>公司:</td> 48 + <td></td>
43 <td> 49 <td>
44 - <select class="form-control" id="gsbm" ></select>  
45 - </td>  
46 - <td>分公司:</td>  
47 - <td>  
48 - <select class="form-control" id="fgsbm" ></select>  
49 - </td>  
50 - <td>日期:</td>  
51 - <td width="86px">  
52 - <input type="text" style="width: 80px" name="rq" id="rq"/> 50 + <input type="text" style="width: 100px" name="rq" id="rq"/>
53 </td> 51 </td>
54 - <td>内部编码:</td>  
55 - <td> 52 + <!--<td>
56 <select class="form-control" name="nbbm" id="nbbm" style="width: 120px;"></select> 53 <select class="form-control" name="nbbm" id="nbbm" style="width: 120px;"></select>
57 - </td>  
58 -  
59 - <td width="20%"> 54 + </td>-->
  55 + <td></td>
  56 + <td></td>
  57 + <td></td>
  58 + <td>
60 <button class="btn btn-sm green btn-outline filter-submit margin-bottom" style="margin-right:0px"> 59 <button class="btn btn-sm green btn-outline filter-submit margin-bottom" style="margin-right:0px">
61 <i class="fa fa-search"></i> 搜索 60 <i class="fa fa-search"></i> 搜索
62 </button> 61 </button>
63 <button class="btn btn-sm red btn-outline filter-cancel" style="margin-right:0px"> 62 <button class="btn btn-sm red btn-outline filter-cancel" style="margin-right:0px">
64 <i class="fa fa-times"></i> 重置 63 <i class="fa fa-times"></i> 重置
65 </button> 64 </button>
66 -<!-- <button class="btn btn-danger btn-sm red" id="del" style="margin-right:0px"> -->  
67 -<!-- <i class="fa fa-times"></i> 删除 -->  
68 -<!-- </button> --> 65 + <!-- <button class="btn btn-danger btn-sm red" id="del" style="margin-right:0px"> -->
  66 + <!-- <i class="fa fa-times"></i> 删除 -->
  67 + <!-- </button> -->
69 </td> 68 </td>
70 </tr> 69 </tr>
71 - <tr role="row" class="heading">  
72 - <th>#</th>  
73 - <th>日期</th>  
74 - <th colspan="2">内部编码</th>  
75 - <th colspan="2">充电量</th>  
76 - <th colspan="2">充电站</th>  
77 - <th colspan="2">备注</th>  
78 -<!-- <td>操作</td> -->  
79 - </tr>  
80 </thead> 70 </thead>
81 <tbody></tbody> 71 <tbody></tbody>
82 </table> 72 </table>
@@ -105,7 +95,16 @@ @@ -105,7 +95,16 @@
105 format: 'YYYY-MM-DD', 95 format: 'YYYY-MM-DD',
106 locale: 'zh-cn' 96 locale: 'zh-cn'
107 }); 97 });
108 - 98 + var d = new Date();
  99 + d.setTime(d.getTime() - 1*1000*60*60*24);
  100 + var year = d.getFullYear();
  101 + var month = d.getMonth() + 1;
  102 + var day = d.getDate();
  103 + if(month < 10)
  104 + month = "0" + month;
  105 + if(day < 10)
  106 + day = "0" + day;
  107 + $("#rq").val(year + "-" + month + "-" + day);
109 var page = 0, initPagination; 108 var page = 0, initPagination;
110 var icheckOptions = { 109 var icheckOptions = {
111 radioClass: 'iradio_square-blue icheck', 110 radioClass: 'iradio_square-blue icheck',
@@ -118,14 +117,14 @@ @@ -118,14 +117,14 @@
118 }); 117 });
119 118
120 //提交 119 //提交
121 - $('tr.filter .filter-submit').on('click', function () {  
122 - var gsbm = $('#gsbm').val();  
123 - var fgsbm = $('#fgsbm').val(); 120 + $('tr.filter .filter-submit').on('click', function () {
  121 + /* var gsbm = $('#gsbm').val();
  122 + var fgsbm = $('#fgsbm').val();*/
124 if ($("#rq").val() == "" || $("#rq").val() ==null){ 123 if ($("#rq").val() == "" || $("#rq").val() ==null){
125 layer.msg('请选择日期.'); 124 layer.msg('请选择日期.');
126 - }else if(gsbm=="" || gsbm==null || fgsbm=="" ||fgsbm==null){ 125 + }/*else if(gsbm=="" || gsbm==null || fgsbm=="" ||fgsbm==null){
127 layer.msg('请选择公司和分公司.'); 126 layer.msg('请选择公司和分公司.');
128 - }else { 127 + }*/else {
129 128
130 var params = getParams(); 129 var params = getParams();
131 130
@@ -348,13 +347,13 @@ @@ -348,13 +347,13 @@
348 }); 347 });
349 348
350 function getParams(){ 349 function getParams(){
351 - var gsbm=$("#gsbm").val();  
352 - var fgsbm=$("#fgsbm").val(); 350 + /*var gsbm=$("#gsbm").val();
  351 + var fgsbm=$("#fgsbm").val();*/
353 var cells = $('tr.filter')[0].cells 352 var cells = $('tr.filter')[0].cells
354 , params = {} 353 , params = {}
355 , name; 354 , name;
356 - params["gsbm"] = gsbm;  
357 - params["fgsbm"] = fgsbm; 355 + /*params["gsbm"] = gsbm;
  356 + params["fgsbm"] = fgsbm;*/
358 $.each(cells, function (i, cell) { 357 $.each(cells, function (i, cell) {
359 var items = $('input,select', cell); 358 var items = $('input,select', cell);
360 for (var j = 0, item; item = items[j++];) { 359 for (var j = 0, item; item = items[j++];) {
@@ -379,11 +378,10 @@ @@ -379,11 +378,10 @@
379 {{i + 1}} 378 {{i + 1}}
380 </td> 379 </td>
381 <td>{{obj.rq}}</td> 380 <td>{{obj.rq}}</td>
382 - <td colspan="2">{{obj.nbbm}}</td>  
383 -  
384 - <td colspan="2">{{obj.jdl}}</td>  
385 - <td colspan="2">{{obj.jdz}}</td>  
386 - <td>{{obj.remarks}}</td> 381 + <td>{{obj.nbbm}}</td>
  382 + <td>{{obj.plate}}</td>
  383 + <td>{{obj.jdl}}</td>
  384 + <td>{{obj.remarks}}</td>
387 <!-- <td> 385 <!-- <td>
388 <button class="btn btn-info btn-sm"> 386 <button class="btn btn-info btn-sm">
389 <i class="fa fa-search"></i> 修改 387 <i class="fa fa-search"></i> 修改
src/main/resources/static/pages/electricity/jdl/upload.html
@@ -31,7 +31,7 @@ @@ -31,7 +31,7 @@
31 </form> 31 </form>
32 </div> 32 </div>
33 <div class="modal-footer"> 33 <div class="modal-footer">
34 - <button type="button" class="btn default" id="downLoad">下载模板</button> 34 + <!--<button type="button" class="btn default" id="downLoad">下载模板</button>-->
35 <button type="button" class="btn default" data-dismiss="modal">取消</button> 35 <button type="button" class="btn default" data-dismiss="modal">取消</button>
36 <button type="button" class="btn btn-primary" id="submit">确认导入</button> 36 <button type="button" class="btn btn-primary" id="submit">确认导入</button>
37 </div> 37 </div>
@@ -89,9 +89,9 @@ @@ -89,9 +89,9 @@
89 }) 89 })
90 }); 90 });
91 91
92 - $('#downLoad').on('click', function(){  
93 - window.open("/downloadFile/downloadModel?fileName=import_Jdl");  
94 - }); 92 + /*$('#downLoad').on('click', function(){
  93 + window.open("/downloadFile/downloadModel?fileName=车辆充电");
  94 + });*/
95 95
96 function getCurrSelNode(){ 96 function getCurrSelNode(){
97 return $.jstree.reference("#modules_tree").get_selected(true); 97 return $.jstree.reference("#modules_tree").get_selected(true);
src/main/resources/static/pages/forms/export/票务数据导入模板.xls 0 → 100644
No preview for this file type
src/main/resources/static/pages/forms/export/车辆加氢.xls 0 → 100644
No preview for this file type
src/main/resources/static/pages/forms/export/车辆加油.xls 0 → 100644
No preview for this file type
src/main/resources/static/pages/forms/mould/路线生产月报台账.xls 0 → 100644
No preview for this file type
src/main/resources/static/pages/forms/mould/路线生产月报同比表.xls 0 → 100644
No preview for this file type
src/main/resources/static/pages/hydrogen/jql/list.html 0 → 100644
  1 +<style>
  2 +.blue{
  3 + background-color: #87CEFF
  4 +}
  5 +</style>
  6 +<div class="page-head">
  7 + <div class="page-title">
  8 + <h1>车辆加氢量</h1>
  9 + </div>
  10 +</div>
  11 +<ul class="page-breadcrumb breadcrumb">
  12 + <li><a href="/pages/home.html" data-pjax>首页</a> <i class="fa fa-circle"></i></li>
  13 + <li><span class="active">用氢管理</span> <i class="fa fa-circle"></i></li>
  14 + <li><span class="active">车辆加氢管理</span></li>
  15 +</ul>
  16 +
  17 +<div class="row" id="ll_oil_list">
  18 + <div class="col-md-12">
  19 + <!-- Begin: life time stats -->
  20 + <div class="portlet light portlet-fit portlet-datatable bordered">
  21 + <div class="portlet-title">
  22 + <div class="caption">
  23 + <i class="fa fa-fire-extinguisher"></i> <span
  24 + class="caption-subject font-dark sbold uppercase">车辆加氢量</span>
  25 + </div>
  26 + <div class="actions">
  27 + <button type="button" class="btn btn-circle blue" id="upload"><i class="fa fa-file-excel-o"></i>
  28 + 导入Excel
  29 + </button>
  30 + <!--<button type="button" class="btn btn-circle blue" id="export"><i class="fa fa-file-excel-o"></i>
  31 + 导出Excel
  32 + </button>-->
  33 + </div>
  34 + </div>
  35 + <div class="portlet-body">
  36 + <div class="table-container" style="margin-top: 0px">
  37 + <table class="table table-striped table-bordered table-hover table-checkable" id="datatable_qlb">
  38 + <thead>
  39 + <tr role="row" class="heading">
  40 + <th width="5%">#</th>
  41 + <th width="15%">日期</th>
  42 + <th width="15%">内部编码</th>
  43 + <th width="15%">车牌</th>
  44 + <th width="15%">加氢量</th>
  45 + <th width="20%">加氢站</th>
  46 + <th width="15%">备注</th>
  47 + </tr>
  48 + <tr role="row" class="filter">
  49 + <td></td>
  50 + <td>
  51 + <input type="text" style="width: 100px" name="rq" id="rq"/>
  52 + </td>
  53 + <td></td>
  54 + <td></td>
  55 + <td></td>
  56 + <td></td>
  57 + <!--<td colspan="2">内部编码:</td>
  58 + <td colspan="2">
  59 + <select class="form-control" name="nbbm" id="nbbm" style="width: 120px;"></select>
  60 + </td>-->
  61 +
  62 + <td width="24%">
  63 + <button class="btn btn-sm green btn-outline filter-submit margin-bottom" style="margin-right:0px">
  64 + <i class="fa fa-search"></i> 搜索
  65 + </button>
  66 + <button class="btn btn-sm red btn-outline filter-cancel" style="margin-right:0px">
  67 + <i class="fa fa-times"></i> 重置
  68 + </button>
  69 + <!-- <button class="btn btn-danger btn-sm red" id="del" style="margin-right:0px"> -->
  70 + <!-- <i class="fa fa-times"></i> 删除 -->
  71 + <!-- </button> -->
  72 + </td>
  73 + </tr>
  74 + </thead>
  75 + <tbody></tbody>
  76 + </table>
  77 + <div style="text-align: right;">
  78 + <ul id="pagination" class="pagination"></ul>
  79 + </div>
  80 + </div>
  81 + </div>
  82 + <div class="portlet-body">
  83 + <div id="modules_tree"></div>
  84 + </div>
  85 + </div>
  86 + </div>
  87 +</div>
  88 +
  89 +
  90 +<script src="/assets/js/ajaxfileupload/ajaxfileupload.js"></script>
  91 +<script>
  92 + $(function () {
  93 +
  94 + // 关闭左侧栏
  95 + if (!$('body').hasClass('page-sidebar-closed'))
  96 + $('.menu-toggler.sidebar-toggler').click();
  97 +
  98 + $("#rq").datetimepicker({
  99 + format: 'YYYY-MM-DD',
  100 + locale: 'zh-cn'
  101 + });
  102 + var d = new Date();
  103 + d.setTime(d.getTime() - 1*1000*60*60*24);
  104 + var year = d.getFullYear();
  105 + var month = d.getMonth() + 1;
  106 + var day = d.getDate();
  107 + if(month < 10)
  108 + month = "0" + month;
  109 + if(day < 10)
  110 + day = "0" + day;
  111 + $("#rq").val(year + "-" + month + "-" + day);
  112 +
  113 + var page = 0, initPagination;
  114 + var icheckOptions = {
  115 + radioClass: 'iradio_square-blue icheck',
  116 + increaseArea: '20%'
  117 + }
  118 +
  119 + //重置
  120 + $('tr.filter .filter-cancel').on('click', function () {
  121 + $('tr.filter input, select').val('').change();
  122 + });
  123 +
  124 + //提交
  125 + $('tr.filter .filter-submit').on('click', function () {
  126 +
  127 + if ($("#rq").val() == "" || $("#rq").val() ==null){
  128 + layer.msg('请选择日期.');
  129 + }else {
  130 + var params = getParams();
  131 + page = 0;
  132 + jsDoQuery(params, true);
  133 + }
  134 + });
  135 +
  136 +
  137 + $.get('/user/companyData', function(result){
  138 + obj = result;
  139 + var options="";
  140 +// = '<option value="">请选择</option>';
  141 + for(var i = 0; i < obj.length; i++){
  142 + options += '<option value="'+obj[i].companyCode+'">'+obj[i].companyName+'</option>';
  143 +// setFgsqx(obj[i].companyCode);
  144 + }
  145 + $('#gsbm').html(options);
  146 + updateCompany();
  147 + });
  148 +
  149 + $("#gsbm").on("change",updateCompany);
  150 + function updateCompany(){
  151 + var company = $('#gsbm').val();
  152 + var options ="";
  153 +// = '<option value="">请选择</option>';
  154 + for(var i = 0; i < obj.length; i++){
  155 + if(obj[i].companyCode == company){
  156 + var children = obj[i].children;
  157 + for(var j = 0; j < children.length; j++){
  158 + options += '<option value="'+children[j].code+'">'+children[j].name+'</option>';
  159 + }
  160 + }
  161 + }
  162 + $('#fgsbm').html(options);
  163 + }
  164 + /*
  165 + * 获取数据 p: 要提交的参数, pagination: 是否重新分页
  166 + */
  167 + function jsDoQuery(p, pagination) {
  168 + var params = {};
  169 + if (p)
  170 + params = p;
  171 + params['order'] = 'nbbm';
  172 + params['page'] = page;
  173 + params['rq'] = $("#rq").val();
  174 +
  175 + var j = layer.load(2);
  176 + $get('/jql/query', params, function (data) {
  177 + $.each(data.dataList, function (i, obj) {
  178 + obj.rq = moment(obj.rq).format("YYYY-MM-DD");
  179 + });
  180 + var bodyHtm = template('jql_list', {list:data.dataList});
  181 +
  182 + $('#datatable_qlb tbody').html(bodyHtm)
  183 + .find('.icheck').iCheck(icheckOptions)
  184 + .on('ifChanged', iCheckChange);
  185 + if (pagination && data.dataList.length > 0) {
  186 + //重新分页
  187 + initPagination = true;
  188 + showPagination(data);
  189 + $('#pagination').show();
  190 + } else if(data.dataList.length == 0){
  191 + $('#pagination').hide();
  192 + }
  193 +
  194 + layer.close(j);
  195 +
  196 + startOptJzylLink($('#ll_oil_list .in_carpark_jzyl'));
  197 + });
  198 + }
  199 +
  200 + //改变状态
  201 + function startOptJzylLink(es) {
  202 + es.editable({
  203 + type: 'text',
  204 + placement: 'right',
  205 + width: 100,
  206 + display: false,
  207 + validate: function (value) {
  208 + if (!value)
  209 + return '值不能为空!';
  210 + if (isNaN(value))
  211 + return '只能为数字!';
  212 + if (value < 0)
  213 + return '值不能小于0!';
  214 + },
  215 + inputclass: 'form-control input-medium input-edtable-sm'
  216 + }).on('save', function (e, params) {
  217 + $(this).text(params.newValue);
  218 + });
  219 + }
  220 +
  221 + function iCheckChange() {
  222 + var tr = $(this).parents('tr');
  223 + if (this.checked)
  224 + tr.addClass('row-active');
  225 + else
  226 + tr.removeClass('row-active');
  227 +
  228 + /* if($('#datatable_resource input.icheck:checked').length == 1)
  229 + $('#removeButton').removeAttr('disabled');
  230 + else
  231 + $('#removeButton').attr('disabled', 'disabled'); */
  232 + }
  233 +
  234 + function showPagination(data) {
  235 + //分页
  236 + $('#pagination').jqPaginator({
  237 + totalPages: data.totalPages,
  238 + visiblePages: 6,
  239 + currentPage: page + 1,
  240 + first: '<li class="first"><a href="javascript:void(0);">首页<\/a><\/li>',
  241 + prev: '<li class="prev"><a href="javascript:void(0);">上一页<\/a><\/li>',
  242 + next: '<li class="next"><a href="javascript:void(0);">下一页<\/a><\/li>',
  243 + last: '<li class="last"><a href="javascript:void(0);">尾页<\/a><\/li>',
  244 + page: '<li class="page"><a href="javascript:void(0);">{{page}}<\/a><\/li>',
  245 + onPageChange: function (num, type) {
  246 + if (initPagination) {
  247 + initPagination = false;
  248 + return;
  249 + }
  250 +
  251 + var params = getParams();
  252 +
  253 + page = num - 1;
  254 + jsDoQuery(params, true);
  255 + }
  256 + });
  257 + }
  258 +
  259 +
  260 + //删除
  261 + $('#del').on('click', function () {
  262 + if ($(this).attr('disabled'))
  263 + return;
  264 +
  265 + var id = $('input.icheck:checked').data('id');
  266 + removeConfirm('确定要删除选中的数据?', '/resource/' + id, function () {
  267 + $('tr.filter .filter-submit').click();
  268 + });
  269 + });
  270 +
  271 + //搜索线路
  272 + $.get('/basic/lineCode2Name',function(result){
  273 + var data=[];
  274 +
  275 + for(var code in result){
  276 + data.push({id: code, text: result[code]});
  277 + }
  278 + initPinYinSelect2('#xlbm',data,'');
  279 +
  280 + });
  281 +
  282 + $('#nbbm').select2({
  283 + placeholder: '搜索车辆...',
  284 + ajax: {
  285 + url: '/realSchedule/sreachVehic',
  286 + dataType: 'json',
  287 + delay: 150,
  288 + data: function (params) {
  289 + return {nbbm: params.term};
  290 + },
  291 + processResults: function (data) {
  292 + return {
  293 + results: data
  294 + };
  295 + },
  296 + cache: true
  297 + },
  298 + templateResult: function (repo) {
  299 + if (repo.loading) return repo.text;
  300 + var h = '<span>' + repo.text + '</span>';
  301 + h += (repo.lineName ? '&nbsp;<span class="select2-desc">' + repo.lineName + '</span>' : '');
  302 + return h;
  303 + },
  304 + escapeMarkup: function (markup) {
  305 + return markup;
  306 + },
  307 + minimumInputLength: 1,
  308 + templateSelection: function (repo) {
  309 + return repo.text;
  310 + },
  311 + language: {
  312 + noResults: function () {
  313 + return '<span style="color:red;font-size: 12px;">没有搜索到车辆!</span>';
  314 + },
  315 + inputTooShort: function (e) {
  316 + return '<span style="color:gray;font-size: 12px;"><i class="fa fa-search"></i> 输入自编号搜索车辆</span>';
  317 + },
  318 + searching: function () {
  319 + return '<span style="color:gray;font-size: 12px;"> 正在搜索车辆...</span>';
  320 + }
  321 + }
  322 + })
  323 +
  324 + //导入
  325 + $("#upload").on("click", function(){
  326 + $.get('upload.html', function(m){$(pjaxContainer).append(m);});
  327 + });
  328 +
  329 + //导出
  330 + $("#export").on("click", function () {
  331 + if ($("#rq").val() != "") {
  332 + var params = getParams();
  333 +
  334 + params["type"] = "export";
  335 + $get('/jql/query', params, function (result) {
  336 + window.open("/downloadFile/download?fileName=车辆加氢量" + moment($("#rq").val()).format("YYYYMMDD"));
  337 + });
  338 + } else {
  339 + layer.msg('请选择日期.');
  340 + }
  341 + });
  342 +
  343 + function getParams(){
  344 + var cells = $('tr.filter')[0].cells
  345 + , params = {}
  346 + , name;
  347 + $.each(cells, function (i, cell) {
  348 + var items = $('input,select', cell);
  349 + for (var j = 0, item; item = items[j++];) {
  350 + name = $(item).attr('name');
  351 + if (name) {
  352 + params[name] = $(item).val();
  353 + }
  354 + }
  355 + });
  356 + return params;
  357 + };
  358 +
  359 + });
  360 +
  361 +</script>
  362 +
  363 +<script id="jql_list" type="text/html">
  364 + {{each list as obj i}}
  365 + <tr>
  366 + <td style="vertical-align: middle;">
  367 + <!-- <input type="radio" name="id" class="group-checkable icheck" data-id="{{obj.id}}"> -->
  368 + {{i + 1}}
  369 + </td>
  370 + <td>{{obj.rq}}</td>
  371 + <td>{{obj.nbbm}}</td>
  372 + <td>{{obj.plate}}</td>
  373 + <td>{{obj.jql}}</td>
  374 + <td>{{obj.jqz}}</td>
  375 + <td>{{obj.remarks}}</td>
  376 + <!-- <td>
  377 + <button class="btn btn-info btn-sm">
  378 + <i class="fa fa-search"></i> 修改
  379 + </button>
  380 + <button class="btn btn-danger btn-sm">
  381 + <i class="fa fa-trash-o"></i> 删除
  382 + </button>
  383 + </td> -->
  384 + </tr>
  385 + {{/each}}
  386 + {{if list.length == 0}}
  387 + <tr>
  388 + <td colspan=9><h6 class="muted">没有找到相关数据</h6></td>
  389 + </tr>
  390 + {{/if}}
  391 +</script>
0 \ No newline at end of file 392 \ No newline at end of file
src/main/resources/static/pages/hydrogen/jql/upload.html 0 → 100644
  1 +<div class="modal fade" id="uploadFile" tabindex="-1" role="basic"
  2 + aria-hidden="true">
  3 + <div class="modal-dialog">
  4 + <div class="modal-content">
  5 + <div class="modal-header">
  6 + <button type="button" class="close" data-dismiss="modal"
  7 + aria-hidden="true"></button>
  8 + <h4 class="modal-title">导入Excel</h4>
  9 + </div>
  10 + <div class="modal-body">
  11 + <form class="form-horizontal" role="form" id="excelFile" method="post"
  12 + action="" enctype="multipart/form-data">
  13 + <input type="hidden" name="groupType" value="3">
  14 + <div class="alert alert-danger display-hide">
  15 + <button class="close" data-close="alert"></button>
  16 + 您的输入有误,请检查下面的输入项
  17 + </div>
  18 + <div class="form-body">
  19 + <div class="form-group">
  20 + <label class="col-md-3 control-label">选择文件</label>
  21 + <div class="col-md-9">
  22 + <input type="file" name="file" id="file"
  23 + accept="application/vnd.ms-excel"/>
  24 + <input type="hidden" name="gsbm_" id="gsbm_">
  25 + <input type="hidden" name="gsName" id="gsName">
  26 + <input type="hidden" name="fgsbm_" id="fgsbm_">
  27 + <input type="hidden" name="fgsName" id="fgsName">
  28 + </div>
  29 + </div>
  30 + </div>
  31 + </form>
  32 + </div>
  33 + <div class="modal-footer">
  34 + <button type="button" class="btn default" id="downLoad">下载模板</button>
  35 + <button type="button" class="btn default" data-dismiss="modal">取消</button>
  36 + <button type="button" class="btn btn-primary" id="submit">确认导入</button>
  37 + </div>
  38 + </div>
  39 + </div>
  40 +</div>
  41 +<script id="res_tbody_temp" type="text/html">
  42 +
  43 +</script>
  44 +<script data-exclude=1>
  45 + $(function() {
  46 + var form = $('#excelFile');
  47 + var error = $('.alert-danger', form);
  48 +
  49 + $('#gsbm_').val($("#gsbm").val());
  50 + $('#gsName').val($("#gsbm").find("option:selected").text());
  51 +// $('#fgsbm_').val($("#fgsbm").val());
  52 +// $('#fgsName').val($("#fgsbm").find("option:selected").text());
  53 + $('#fgsbm_').val('-1');
  54 + $('#fgsName').val('全部车队');
  55 +
  56 + //modal 显示事件
  57 + $('#uploadFile').on('show.bs.modal', function(){
  58 + })
  59 + .modal('show');
  60 +
  61 + $('#submit').on('click', function() {
  62 + var j = layer.load(2);
  63 + var param = {};
  64 + param.uploadDir = 'upload';
  65 + param["gsbm_"] = $('#gsbm_').val();
  66 + param["gsName"] = $('#gsName').val();
  67 + param["fgsbm_"] = $('#fgsbm_').val();
  68 + param["fgsName"] = $('#fgsName').val();
  69 + $.ajaxFileUpload({
  70 + url : '/jql/uploadFile',
  71 + secureuri : false,
  72 + fileElementId : 'file',
  73 + dataType : 'json',
  74 + data : param,
  75 + success : function(data) {
  76 + layer.close(j);
  77 + alert(data.result);
  78 +// alert("文件导入成功");
  79 + $('#uploadFile').modal('hide');
  80 + $('tr.filter .filter-submit').click();
  81 + },
  82 + error : function(data, status, e) {
  83 + layer.close(j);
  84 + alert("文件导入失败");
  85 + }
  86 + })
  87 + });
  88 +
  89 + $('#downLoad').on('click', function(){
  90 + window.open("/downloadFile/downloadModel?fileName=车辆加氢");
  91 + });
  92 +
  93 + function getCurrSelNode(){
  94 + return $.jstree.reference("#modules_tree").get_selected(true);
  95 + }
  96 + });
  97 +</script>
0 \ No newline at end of file 98 \ No newline at end of file
src/main/resources/static/pages/hydrogen/list/add.html 0 → 100644
  1 +<div class="page-head">
  2 + <div class="page-title">
  3 + <h1>进出站氢量量信息编辑</h1>
  4 + </div>
  5 +</div>
  6 +
  7 +<ul class="page-breadcrumb breadcrumb">
  8 + <li><a href="/pages/home.html" data-pjax>首页</a> <i class="fa fa-circle"></i></li>
  9 + <li><span class="active">用氢管理</span> <i class="fa fa-circle"></i></li>
  10 + <li><a href="list.html" data-pjax>进出场氢量</a> <i class="fa fa-circle"></i></li>
  11 + <li><span class="active">进出站氢量信息编辑</span></li>
  12 +</ul>
  13 +
  14 +<div class="portlet light bordered">
  15 + <div class="portlet-title">
  16 + <div class="caption">
  17 + <i class="icon-equalizer font-red-sunglo"></i> <span
  18 + class="caption-subject font-red-sunglo bold uppercase">表单</span>
  19 + </div>
  20 + </div>
  21 + <div class="portlet-body form">
  22 + <form class="form-horizontal" id="qlb_add_form" >
  23 +
  24 + <div class="alert alert-danger display-hide">
  25 + <button class="close" data-close="alert"></button>
  26 + 您的输入有误,请检查下面的输入项
  27 + </div>
  28 + <input type="hidden" value="0" name="yhlx" />
  29 + <div class="form-body">
  30 + <div class="form-group">
  31 + <label class="col-md-3 control-label">公司</label>
  32 + <div class="col-md-4">
  33 + <select class="form-control" name="ssgsdm" id="ssgsdm" ></select>
  34 + </div>
  35 + </div>
  36 + <div class="form-group">
  37 + <label class="col-md-3 control-label">分公司</label>
  38 + <div class="col-md-4">
  39 + <select class="form-control" name="fgsdm" id="fgsdm" ></select>
  40 + </div>
  41 + </div>
  42 + <div class="form-group">
  43 + <label class="col-md-3 control-label">线路</label>
  44 + <div class="col-md-4">
  45 + <select class="form-control" name="xlbm" id="xlbm" ></select>
  46 + </div>
  47 + </div>
  48 + <div class="form-group">
  49 + <label class="col-md-3 control-label">内部编码</label>
  50 + <div class="col-md-4">
  51 + <select class="form-control" name="nbbm" id="nbbm" ></select>
  52 + </div>
  53 + </div>
  54 + <div class="form-group">
  55 + <label class="col-md-3 control-label">日期</label>
  56 + <div class="col-md-4">
  57 + <input type="text" class="form-control" name="rq" id="date">
  58 + <label>跨天营运</label>
  59 + <select id="sfkt" name="sfkt">
  60 + <option value="0">否</option>
  61 + <option value="1">是</option>
  62 + </select>
  63 + </div>
  64 + </div>
  65 + <div class="form-group">
  66 + <label class="col-md-3 control-label">开始营运时间</label>
  67 + <div class="col-md-4">
  68 + <input type="time" class="form-control" name="jhsj" >
  69 + <span class="help-block"> 如:12:12</span>
  70 + </div>
  71 + </div>
  72 + <div class="form-group">
  73 + <label class="col-md-3 control-label">驾驶员</label>
  74 + <div class="col-md-4">
  75 + <select class="form-control" name="jsy" id="jsy"> </select>
  76 + </div>
  77 + </div>
  78 +
  79 + <div class="form-group">
  80 + <label class="col-md-3 control-label">出场里程</label>
  81 + <div class="col-md-4">
  82 + <input type="text" value="0" class="form-control" name="czlc" onkeyup="this.value=this.value.replace(/[^(\d||/.)]/g,'').replace('.','$#$').replace(/\./g,'').replace('$#$','.')"
  83 + onafterpaste="this.value=this.value.replace(/[^(\d||/.)]/g,'').replace('.','$#$').replace(/\./g,'').replace('$#$','.')">
  84 + </div>
  85 + </div>
  86 +
  87 + <div class="form-group">
  88 + <label class="col-md-3 control-label">出场氢量</label>
  89 + <div class="col-md-4">
  90 + <input type="text" value="100" class="form-control" name="czcl" onkeyup="this.value=this.value.replace(/[^(\d||/.)]/g,'').replace('.','$#$').replace(/\./g,'').replace('$#$','.')"
  91 + onafterpaste="this.value=this.value.replace(/[^(\d||/.)]/g,'').replace('.','$#$').replace(/\./g,'').replace('$#$','.')">
  92 + </div>
  93 + </div>
  94 +
  95 + <div class="form-group">
  96 + <label class="col-md-3 control-label">充氢量</label>
  97 + <div class="col-md-4">
  98 + <input type="text" value="0" class="form-control" name="jql" onkeyup="this.value=this.value.replace(/[^(\d||/.)]/g,'').replace('.','$#$').replace(/\./g,'').replace('$#$','.')"
  99 + onafterpaste="this.value=this.value.replace(/[^(\d||/.)]/g,'').replace('.','$#$').replace(/\./g,'').replace('$#$','.')">
  100 + </div>
  101 + </div>
  102 +
  103 + <div class="form-group">
  104 + <label class="col-md-3 control-label">进场氢量</label>
  105 + <div class="col-md-4">
  106 + <input type="text" value="100" class="form-control" name="jzcl" onkeyup="this.value=this.value.replace(/[^(\d||/.)]/g,'').replace('.','$#$').replace(/\./g,'').replace('$#$','.')"
  107 + onafterpaste="this.value=this.value.replace(/[^(\d||/.)]/g,'').replace('.','$#$').replace(/\./g,'').replace('$#$','.')">
  108 + </div>
  109 + </div>
  110 +
  111 + <div class="form-group">
  112 + <label class="col-md-3 control-label">耗氢量</label>
  113 + <div class="col-md-4">
  114 + <input type="text" value="0" class="form-control" name="hn" onkeyup="this.value=this.value.replace(/[^(\d||/.)]/g,'').replace('.','$#$').replace(/\./g,'').replace('$#$','.')"
  115 + onafterpaste="this.value=this.value.replace(/[^(\d||/.)]/g,'').replace('.','$#$').replace(/\./g,'').replace('$#$','.')">
  116 + </div>
  117 + </div>
  118 +
  119 + <div class="form-group">
  120 + <label class="col-md-3 control-label">尿素</label>
  121 + <div class="col-md-4">
  122 + <input type="text" value="0" class="form-control" name="ns" onkeyup="this.value=this.value.replace(/[^(\d||/.)]/g,'').replace('.','$#$').replace(/\./g,'').replace('$#$','.')"
  123 + onafterpaste="this.value=this.value.replace(/[^(\d||/.)]/g,'').replace('.','$#$').replace(/\./g,'').replace('$#$','.')">
  124 + </div>
  125 + </div>
  126 +
  127 + <div class="form-group">
  128 + <label class="col-md-3 control-label">进场里程</label>
  129 + <div class="col-md-4">
  130 + <input type="text" value="0" class="form-control" name="jzlc" onkeyup="this.value=this.value.replace(/[^(\d||/.)]/g,'').replace('.','$#$').replace(/\./g,'').replace('$#$','.')"
  131 + onafterpaste="this.value=this.value.replace(/[^(\d||/.)]/g,'').replace('.','$#$').replace(/\./g,'').replace('$#$','.')">
  132 + </div>
  133 + </div>
  134 + <div class="form-group">
  135 + <label class="col-md-3 control-label">损耗原因</label>
  136 + <div class="col-md-4">
  137 + <select class="form-control" name="shyy">
  138 + <option value='0'>请选择</option>
  139 + <option value='1'>票务用</option>
  140 + <option value='2'>保养用</option>
  141 + <option value='3'>报废车用</option>
  142 + <option value='4'>其它用</option>
  143 + <option value='5'>人保部</option>
  144 + <option value='6'>车队</option>
  145 + <option value='7'>车间(高保)</option>
  146 + <option value='8'>车间(小修)</option>
  147 + </select>
  148 + </div>
  149 + </div>
  150 + <div class="form-group">
  151 + <label class="col-md-3 control-label">损耗氢量</label>
  152 + <div class="col-md-4">
  153 + <input type="text" value="0" class="form-control" name="sh" onkeyup="this.value=this.value.replace(/[^(\d||/.)]/g,'').replace('.','$#$').replace(/\./g,'').replace('$#$','.')"
  154 + onafterpaste="this.value=this.value.replace(/[^(\d||/.)]/g,'').replace('.','$#$').replace(/\./g,'').replace('$#$','.')">
  155 + </div>
  156 + </div>
  157 + <div class="form-group">
  158 + <label class="col-md-3 control-label">行驶总里程</label>
  159 + <div class="col-md-4">
  160 + <input type="text" value="0" class="form-control" name="zlc" onkeyup="this.value=this.value.replace(/[^(\d||/.)]/g,'').replace('.','$#$').replace(/\./g,'').replace('$#$','.')"
  161 + onafterpaste="this.value=this.value.replace(/[^(\d||/.)]/g,'').replace('.','$#$').replace(/\./g,'').replace('$#$','.')">
  162 + </div>
  163 + </div>
  164 +
  165 +
  166 + </div>
  167 + <div class="form-actions">
  168 + <div class="row">
  169 + <div class="col-md-offset-3 col-md-4">
  170 + <button type="submit" class="btn green" ><i class="fa fa-check"></i> 提交</button>
  171 + <a type="button" class="btn default" href="list.html" data-pjax><i class="fa fa-times"></i> 取消</a>
  172 + </div>
  173 + </div>
  174 + </div>
  175 + </form>
  176 + <!-- END FORM-->
  177 + </div>
  178 +</div>
  179 +<script>
  180 +(function(){
  181 + var fage=false;
  182 + var obj = [];
  183 + var xlList;
  184 + $.get('/report/lineList',function(result){
  185 + xlList=result;
  186 + $.get('/user/companyData', function(result){
  187 + obj = result;
  188 + var options = '';
  189 + for(var i = 0; i < obj.length; i++){
  190 + options += '<option value="'+obj[i].companyCode+'">'+obj[i].companyName+'</option>';
  191 + }
  192 + $('#ssgsdm').html(options);
  193 +
  194 + updateCompany();
  195 + });
  196 + });
  197 +
  198 + $("#ssgsdm").on("change",updateCompany);
  199 + function updateCompany(){
  200 + var company = $('#ssgsdm').val();
  201 + var options = '';
  202 + for(var i = 0; i < obj.length; i++){
  203 + if(obj[i].companyCode == company){
  204 + var children = obj[i].children;
  205 + for(var j = 0; j < children.length; j++){
  206 + options += '<option value="'+children[j].code+'">'+children[j].name+'</option>';
  207 + }
  208 + }
  209 + }
  210 + $('#fgsdm').html(options);
  211 + initXl();
  212 + selectNbbm();
  213 + selectJsy();
  214 + }
  215 + $("#fgsdm").on("change",initXl);
  216 + function initXl(){
  217 + var data=[];
  218 + if(fage){
  219 + $("#xlbm").select2("destroy").html('');
  220 + }
  221 + var fgs=$('#fgsdm').val();
  222 + var gs=$('#ssgsdm').val();
  223 + for(var i=0;i<xlList.length;i++){
  224 + if(gs!=""){
  225 + if(fgs!=""){
  226 + if(xlList[i]["fgsbm"]==fgs && xlList[i]["gsbm"]==gs){
  227 + data.push({id: xlList[i]["xlbm"], text: xlList[i]["xlname"]});
  228 + }
  229 + }else{
  230 + if(xlList[i]["gsbm"]==gs){
  231 + data.push({id: xlList[i]["xlbm"], text: xlList[i]["xlname"]});
  232 + }
  233 + }
  234 + }
  235 + }
  236 + initPinYinSelect2('#xlbm',data,'');
  237 + fage=true;
  238 + selectNbbm();
  239 + selectJsy();
  240 + }
  241 + $("#date").datetimepicker({
  242 + format : 'YYYY-MM-DD',
  243 + locale : 'zh-cn'
  244 + });
  245 +
  246 + function selectNbbm(){
  247 + $('#nbbm').select2({
  248 + placeholder: '搜索车辆...',
  249 + ajax: {
  250 + url: '/report/carList',
  251 + dataType: 'json',
  252 + delay: 150,
  253 + data: function(params){
  254 + return{nbbm: params.term,
  255 + gsbm:$('#ssgsdm').val(),
  256 + fgsbm:$('#fgsdm').val(),
  257 + xlbm:""
  258 + };
  259 + },
  260 + processResults: function (data) {
  261 + return {
  262 + results: data
  263 + };
  264 + },
  265 + cache: true
  266 + },
  267 + templateResult: function(repo){
  268 + if (repo.loading) return repo.text;
  269 + var h = '<span>'+repo.text+'</span>';
  270 + h += (repo.lineName?'&nbsp;<span class="select2-desc">'+repo.lineName+'</span>':'');
  271 + return h;
  272 + },
  273 + escapeMarkup: function (markup) { return markup; },
  274 + minimumInputLength: 1,
  275 + templateSelection: function(repo){
  276 + return repo.text;
  277 + },
  278 + language: {
  279 + noResults: function(){
  280 + return '<span style="color:red;font-size: 12px;">没有搜索到车辆!</span>';
  281 + },
  282 + inputTooShort : function(e) {
  283 + return '<span style="color:gray;font-size: 12px;"><i class="fa fa-search"></i> 输入自编号搜索车辆</span>';
  284 + },
  285 + searching : function() {
  286 + return '<span style="color:gray;font-size: 12px;"> 正在搜索车辆...</span>';
  287 + }
  288 + }
  289 + })
  290 + }
  291 +
  292 +
  293 + function selectJsy(){
  294 + $('#jsy').select2({
  295 + placeholder: '搜索驾驶员...',
  296 + ajax: {
  297 + url: '/report/userList',
  298 + dataType: 'json',
  299 + delay: 150,
  300 + data: function(params){
  301 + return{jsy: params.term,gsbm:$('#ssgsdm').val()};
  302 + },
  303 + processResults: function (data) {
  304 + return {
  305 + results: data
  306 + };
  307 + },
  308 + cache: true
  309 + },
  310 + templateResult: function(repo){
  311 + if (repo.loading) return repo.text;
  312 + var h = '<span>'+repo.text+'</span>';
  313 + return h;
  314 + },
  315 + escapeMarkup: function (markup) { return markup; },
  316 + minimumInputLength: 1,
  317 + templateSelection: function(repo){
  318 + return repo.text;
  319 + },
  320 + language: {
  321 + noResults: function(){
  322 + return '<span style="color:red;font-size: 12px;">没有搜索到驾驶员!</span>';
  323 + },
  324 + inputTooShort : function(e) {
  325 + return '<span style="color:gray;font-size: 12px;"><i class="fa fa-search"></i> 输入工号搜索驾驶员</span>';
  326 + },
  327 + searching : function() {
  328 + return '<span style="color:gray;font-size: 12px;"> 正在搜索驾驶员...</span>';
  329 + }
  330 + }
  331 + });
  332 + }
  333 + $(function(){
  334 + /* $get('/role/all',null,function(result){
  335 + $.each(result,function(i,obj){
  336 + $("#role").append("<option value='"+obj.id+"'>"+obj.roleName+"</option>");
  337 + });
  338 + }); */
  339 +
  340 + var form = $('#qlb_add_form');
  341 + var error = $('.alert-danger', form);
  342 +
  343 + //表单 validate
  344 + form.validate({
  345 + errorElement : 'span',
  346 + errorClass : 'help-block help-block-error',
  347 + focusInvalid : false,
  348 + rules : {
  349 + 'xlbm' : {
  350 + required : true,
  351 + maxlength: 25
  352 + },
  353 + 'nbbm' : {
  354 + required : true,
  355 + maxlength: 25
  356 + },
  357 + 'rq' : {
  358 + required : true,
  359 + maxlength: 25
  360 + },
  361 + 'jsy' : {
  362 + required : true,
  363 + maxlength: 20
  364 + }
  365 + },
  366 + invalidHandler : function(event, validator) {
  367 + error.show();
  368 + App.scrollTo(error, -200);
  369 + },
  370 +
  371 + highlight : function(element) {
  372 + $(element).closest('.form-group').addClass('has-error');
  373 + },
  374 +
  375 + unhighlight : function(element) {
  376 + $(element).closest('.form-group').removeClass('has-error');
  377 + },
  378 +
  379 + success : function(label) {
  380 + label.closest('.form-group').removeClass('has-error');
  381 + },
  382 +
  383 + submitHandler : function(f) {
  384 + var params = form.serializeJSON();
  385 + error.hide();
  386 + var nbbm=$("#nbbm").val();
  387 + var date=$("#date").val();
  388 + var jsy=$("#jsy").val();
  389 + var xlbm=$("#xlbm").val();
  390 + var gsdm=$("#ssgsdm").val();
  391 + var map={};
  392 + map["nbbm"]=nbbm;
  393 + map["date"]=date;
  394 + map["jsy"]=jsy;
  395 + map["xlbm"]=xlbm;
  396 + map["rq"]=date;
  397 + map["ssgsdm_like"]=gsdm;
  398 + //检查一下用户是否存在
  399 + var i = layer.load(2);
  400 + $get('/ylb/checkDate', map, function(fage){
  401 + if(fage=="2"){
  402 + layer.msg('只能操作三天内数据.');
  403 + layer.close(i);
  404 + }else{
  405 + $get('/qlb/checkJsy', map, function(fage){
  406 + if(fage=="0"){
  407 + layer.msg('该驾驶员当天已存在.');
  408 + layer.close(i);
  409 + }else{
  410 + $post('/qlb/saveQlb', params, function(){
  411 + layer.close(i);
  412 + layer.msg('添加信息成功.');
  413 + loadPage('list.html');
  414 + });
  415 + }
  416 + });
  417 + }
  418 + })
  419 + }
  420 + });
  421 + });
  422 +})();
  423 +</script>
0 \ No newline at end of file 424 \ No newline at end of file
src/main/resources/static/pages/hydrogen/list/list.html 0 → 100644
  1 +<div class="page-head">
  2 + <div class="page-title">
  3 + <h1>进出场存氢量</h1>
  4 + </div>
  5 +</div>
  6 +
  7 +<ul class="page-breadcrumb breadcrumb">
  8 + <li><a href="/pages/home.html" data-pjax>首页</a> <i class="fa fa-circle"></i></li>
  9 + <li><span class="active">用氢管理</span> <i class="fa fa-circle"></i></li>
  10 + <li><span class="active">进出场存氢量</span></li>
  11 +</ul>
  12 +
  13 +<div class="row" id="dl_oil_list">
  14 + <div class="col-md-12">
  15 + <!-- Begin: life time stats -->
  16 + <div class="portlet light portlet-fit portlet-datatable bordered">
  17 + <div class="portlet-title">
  18 + <div class="caption">
  19 + <i class="fa fa-fire-extinguisher"></i>
  20 + <span class="caption-subject font-dark sbold uppercase">进出场存氢量表</span>
  21 + </div>
  22 + <div class="actions">
  23 + <button type="button" class="btn btn-circle blue" id="saveButton"><i class="fa fa-minus-square"></i>
  24 + 保存
  25 + </button>
  26 + <a class="btn btn-circle blue" href="add.html" data-pjax><i class="fa fa-plus"></i> 添加</a>
  27 + <button type="button" class="btn btn-circle blue" id="removeButton"><i class="fa fa-trash-o"></i> 删除</button>
  28 +
  29 + <button type="button" class="btn btn-circle blue" id="obtain"><i class="fa fa-hourglass-half"></i>
  30 + 获取加/存氢信息
  31 + </button>
  32 + <button type="button" class="btn btn-circle blue" id="checkQl"><i class="fa fa-gg-circle"></i>
  33 + 核对加注量(有加氢无里程)
  34 + </button>
  35 + <button class="btn btn-circle blue"
  36 + id="export"> <i class="fa fa-file-excel-o"></i>
  37 + 导出Excel
  38 + </button>
  39 + </div>
  40 + </div>
  41 + <div class="portlet-body">
  42 + <div class="table-container" style="margin-top: 10px">
  43 + <table
  44 + class="table table-striped table-bordered table-hover table-checkable"
  45 + id="datatable_qlb">
  46 + <thead >
  47 + <tr role="row" class="filter">
  48 + <td colspan="2">
  49 + <div style="float: right; " >&nbsp;公司</div>
  50 + </td>
  51 + <td colspan="3">
  52 + <div style="float: left;width: 150px">
  53 + <select class="form-control" name="ssgsdm_like"
  54 + id="ylbListGsdmId"></select>
  55 + </div>
  56 + </td>
  57 + <td colspan="2">
  58 + <div style="float: right; " >&nbsp;分公司</div>
  59 + </td>
  60 + <td colspan="3">
  61 + <div style="float: left;">
  62 + <select class="form-control" name="fgsdm_like"
  63 + id="ylbListFgsdmId" style="width: 150px"></select>
  64 + </div>
  65 + </td>
  66 + <td >
  67 + <div style="float: right; ">日期</div>
  68 + </td>
  69 + <td colspan="2">
  70 + <div style="float: left;">
  71 + <input type="text" style="width: 120px" name="rq" id="rq" />
  72 + </div>
  73 + </td>
  74 + <td rowspan="2" colspan="2">
  75 + <div style="float: left;">
  76 + &nbsp;<button
  77 + class="btn btn-sm green btn-outline filter-submit margin-bottom"
  78 + style="margin-right: 0px">
  79 + <i class="fa fa-search"></i> 搜索
  80 + </button> <!-- <button class="btn btn-sm red btn-outline filter-cancel" style="margin-right:0px"> -->
  81 + <!-- <i class="fa fa-times"></i> 重置 -->
  82 + <!-- </button> -->
  83 +
  84 + </div>
  85 + </td>
  86 + </tr>
  87 + <tr class="filter2">
  88 + <td colspan="2">
  89 + <div style="float: right; ">&nbsp;线路</div>
  90 + </td>
  91 + <td colspan="3">
  92 + <div style="float: left;">
  93 + <select class="form-control" name="xlbm_like" id="xlbm"
  94 + style="width: 150px;"></select>
  95 + </div>
  96 + </td>
  97 + <td colspan="2">
  98 + <div style="float: right;">&nbsp;内部编码</div>
  99 + </td>
  100 + <td colspan="3">
  101 + <div style="float: left;">
  102 + <select class="form-control" name="nbbm_eq" id="nbbm"
  103 + style="width: 120px;"></select>
  104 + </div>
  105 + <div style="float: left;">
  106 + <button class="btn btn-sm #000 btn-outline filter-cancel"
  107 + style="margin-right: 0px">
  108 + <i class="fa fa-times"></i>
  109 + </button>
  110 + </div>
  111 + </td>
  112 + <td >
  113 + <div style="float: right;">
  114 + 类型
  115 + </div>
  116 + </td>
  117 + <td colspan="2">
  118 + <div style="float: left;">
  119 + <select class="form-control" name="sxtj">
  120 + <option value="0">全部</option>
  121 + <option value="1">一车一单</option>
  122 + <option value="2">一车多单</option>
  123 + <option value="3">有充氢没里程</option>
  124 + <option value="4">有里程没充氢</option>
  125 + </select>
  126 + </div>
  127 +
  128 + </td>
  129 + </tr>
  130 + <tr>
  131 + <td colspan="17">
  132 + <div style="float: left;">
  133 + 总计
  134 + &nbsp;&nbsp;
  135 + 充氢量:&nbsp;<label id="sumJzl"></label>
  136 + &nbsp;&nbsp;
  137 + 耗氢量:&nbsp;<label id="sumYh"></label>
  138 + &nbsp;&nbsp;
  139 + 损耗氢量:&nbsp;<label id="sumSh"></label>
  140 + </div>
  141 + </td>
  142 + </tr>
  143 + <tr role="row" class="heading">
  144 + <th width="2%">#</th>
  145 + <th width="8%">日期</th>
  146 + <th width="5%">公司</th>
  147 + <th width="8%">线路</th>
  148 + <th width="5%">自编号</th>
  149 + <th width="6%">驾驶员</th>
  150 + <th width="4%">充氢量</th>
  151 + <th width="6%">出场存氢</th>
  152 + <th width="6%">进场存氢</th>
  153 + <th width="5%">耗氢</th>
  154 + <th width="5%">耗损原因</th>
  155 + <th width="4%">耗损氢量</th>
  156 + <th width="4%">当日总里程</th>
  157 + <th width="4%">数据类型</th>
  158 + <th width="4%">百公里氢耗</th>
  159 +<!-- <th width="5%">操作</th> -->
  160 + </tr>
  161 + </thead>
  162 + <tbody></tbody>
  163 + </table>
  164 + <div style="text-align: right;">
  165 + <ul id="pagination" class="pagination"></ul>
  166 + </div>
  167 + </div>
  168 + </div>
  169 + </div>
  170 + </div>
  171 +</div>
  172 +
  173 +<script id="qlb_list_temp" type="text/html">
  174 + {{each list as obj i}}
  175 + <tr>
  176 + <td style="vertical-align: middle;">
  177 + <input type="checkbox" name="id" class="group-checkable icheck" data-id="{{obj.id}}">
  178 + </td>
  179 + <td>
  180 + {{obj.rq}}
  181 + </td>
  182 + <td>
  183 + {{obj.gsname}}
  184 + </td>
  185 + <td>
  186 + {{if obj.linename=='' || obj.linename==null}}
  187 + {{obj.xlname}}
  188 + {{else}}
  189 + {{obj.linename}}
  190 + {{/if}}
  191 + </td>
  192 + <td>
  193 + <lable data-id="{{obj.id}}" class="in_carpark_nbbm">{{obj.nbbm}}</lable>
  194 +
  195 + </td>
  196 + <td>
  197 + {{if obj.jsy=='' || obj.jsy==null }}
  198 + <input data-id="{{obj.id}}" style=" width:100%" type="text" class="in_carpark_jsy" ></input>
  199 + <button class="btn btn-sm blue btn-jsyUpdate" style=" width:100%" data-id="{{obj.id}}">填写工号</button>
  200 + {{else}}
  201 + {{if obj.jname=='' || obj.jname==null}}
  202 + {{obj.jsy}}/{{obj.name}}
  203 + {{else}}
  204 + {{obj.jsy}}/{{obj.jname}}
  205 + {{/if}}
  206 + {{/if}}
  207 + </td>
  208 + <td>
  209 +
  210 + <lable data-id="{{obj.id}}" class="in_carpark_jql"> {{obj.jql}}</lable>
  211 + </td>
  212 + <td>
  213 +
  214 + <input data-id="{{obj.id}}" href="javascript:;" class="in_carpark_czcl"
  215 + type="text" value=" {{obj.czcl}}" style=" width:40px;float:left"
  216 +onkeyup="this.value=this.value.replace(/[^(\d||/.)]/g,'').replace('.','$#$').replace(/\./g,'').replace('$#$','.')"
  217 + onafterpaste="this.value=this.value.replace(/[^(\d||/.)]/g,'').replace('.','$#$').replace(/\./g,'').replace('$#$','.')" />
  218 + <lable style="float:left">%<lable>
  219 + </td>
  220 + <td>
  221 + <input data-id="{{obj.id}}" href="javascript:;" class="in_carpark_jzcl"
  222 + type="text" value=" {{obj.jzcl}}" style=" width:40px;float:left"
  223 +onkeyup="this.value=this.value.replace(/[^(\d||/.)]/g,'').replace('.','$#$').replace(/\./g,'').replace('$#$','.')"
  224 + onafterpaste="this.value=this.value.replace(/[^(\d||/.)]/g,'').replace('.','$#$').replace(/\./g,'').replace('$#$','.')" />
  225 + <lable style="float:left">%<lable>
  226 + </td>
  227 + <td>
  228 +<input data-id="{{obj.id}}" href="javascript:;" class="in_carpark_hn" readOnly="true"
  229 + type="text" value=" {{obj.hn}}" style=" width:45px;float:left"
  230 +onkeyup="this.value=this.value.replace(/[^(\d||/.)]/g,'').replace('.','$#$').replace(/\./g,'').replace('$#$','.')"
  231 + onafterpaste="this.value=this.value.replace(/[^(\d||/.)]/g,'').replace('.','$#$').replace(/\./g,'').replace('$#$','.')" />
  232 + </td>
  233 + <td>
  234 + <select data-id="{{obj.id}}" class="in_carpark_shyy" style=" width:80px">
  235 + <option value='0' {{if obj.shyy==0}} selected = 'selected' {{/if}}>请选择</option>
  236 + <option value='1' {{if obj.shyy==1}} selected = 'selected' {{/if}}>票务用</option>
  237 + <option value='2' {{if obj.shyy==2}} selected = 'selected' {{/if}}>保养用</option>
  238 + <option value='3' {{if obj.shyy==3}} selected = 'selected' {{/if}}>报废车用</option>
  239 + <option value='4' {{if obj.shyy==4}} selected = 'selected' {{/if}}>其它用</option>
  240 + <option value='5' {{if obj.shyy==5}} selected = 'selected' {{/if}}>人保部</option>
  241 + <option value='6' {{if obj.shyy==6}} selected = 'selected' {{/if}}>车队</option>
  242 + <option value='7' {{if obj.shyy==7}} selected = 'selected' {{/if}}>车间(高保)</option>
  243 + <option value='8' {{if obj.shyy==8}} selected = 'selected' {{/if}}>车间(小修)</option>
  244 + </select>
  245 + </td>
  246 + <td>
  247 + <input data-id="{{obj.id}}" href="javascript:;" class="in_carpark_shyl"
  248 + value={{obj.sh}} style=" width:40px" type="text"
  249 +onkeyup="this.value=this.value.replace(/[^(\d||/.)]/g,'').replace('.','$#$').replace(/\./g,'').replace('$#$','.')"
  250 + onafterpaste="this.value=this.value.replace(/[^(\d||/.)]/g,'').replace('.','$#$').replace(/\./g,'').replace('$#$','.')" />
  251 +
  252 +</td>
  253 + <td>
  254 + {{obj.zlc}}
  255 + </td>
  256 + <td>
  257 + <select data-id="{{obj.id}}" class="in_carpark_nhlx">
  258 + <option value='0' {{if obj.nhlx==0}} selected = 'selected' {{/if}}>手录</option>
  259 + <option value='1' {{if obj.nhlx==1}} selected = 'selected' {{/if}}>拆分</option>
  260 + </select>
  261 + </td>
  262 + <td>
  263 + {{obj.bglhn}}
  264 + </td>
  265 + </tr>
  266 + {{/each}}
  267 + {{if list.length == 0}}
  268 + <tr>
  269 + <td colspan=15><h6 class="muted">没有找到相关数据</h6></td>
  270 + </tr>
  271 + {{/if}}
  272 +</script>
  273 +
  274 +<script>
  275 + $(function () {
  276 + var fage=false;
  277 +
  278 + $("#rq").datetimepicker({
  279 + format: 'YYYY-MM-DD',
  280 + locale: 'zh-cn'
  281 + });
  282 + var d = new Date();
  283 + d.setTime(d.getTime() - 1*1000*60*60*24);
  284 + var year = d.getFullYear();
  285 + var month = d.getMonth() + 1;
  286 + var day = d.getDate();
  287 + if(month < 10)
  288 + month = "0" + month;
  289 + if(day < 10)
  290 + day = "0" + day;
  291 + $("#rq").val(year + "-" + month + "-" + day);
  292 +
  293 + $("#checkQl").on('click', function () {
  294 + if ($("#rq").val() != "") {
  295 + var ylbGsdm=$("#ylbListGsdmId").val();
  296 + var ylbFgsdm=$("#ylbListFgsdmId").val();
  297 + if(ylbGsdm=="" || ylbGsdm==null || ylbFgsdm=="" ||ylbFgsdm==null){
  298 + layer.msg('请选择公司和分公司.');
  299 + } else {
  300 + var params=getParamsList();
  301 + var par={};
  302 + par["rq"] = moment($("#rq").val()).subtract(2, 'days').format("YYYY-MM-DD");
  303 + par["ssgsdm_like"] = $("#ylbListGsdmId").val();
  304 + $get('/ylb/checkDate',par,function(status){
  305 + if(status=='2'){
  306 + layer.msg('只能操作三天内数据.');
  307 + }else{
  308 + var i = layer.load(2);
  309 + $get('/qlb/checkQl', params, function () {
  310 + layer.close(i);
  311 + jsDoQuery(params, true);
  312 + });
  313 + }
  314 + });
  315 + }
  316 + } else {
  317 + layer.msg('请选择日期.');
  318 + }
  319 + })
  320 +
  321 + //进场等于出场
  322 + $("#outAndIn").on('click', function () {
  323 + console.log("进场氢量等于出场氢量");
  324 + if ($("#rq").val() != "") {
  325 + var params=getParamsList();
  326 + var par={};
  327 + par["rq"] = moment($("#rq").val()).subtract(2, 'days').format("YYYY-MM-DD");
  328 + par["ssgsdm_like"] = $("#ylbListGsdmId").val();
  329 + $get('/ylb/checkDate',par,function(status){
  330 + if(status=='2'){
  331 + layer.msg('只能操作三天内数据.');
  332 + }else{
  333 + var i = layer.load(2);
  334 + $get('/ylb/outAndIn', params, function () {
  335 + layer.close(i);
  336 + jsDoQuery(params, true);
  337 + });
  338 + }
  339 + })
  340 + } else {
  341 + layer.msg('请选择日期.');
  342 + }
  343 + });
  344 +
  345 +
  346 + //保存
  347 + $("#saveButton").on('click',function(){
  348 + var params_=getParamsList();
  349 + var par={};
  350 + par["rq"] = moment($("#rq").val()).subtract(2, 'days').format("YYYY-MM-DD");
  351 + par["ssgsdm_like"] = $("#ylbListGsdmId").val();
  352 + $get('/ylb/checkDate',par,function(status){
  353 + if(status=='2'){
  354 + layer.msg('只能操作三天内数据.');
  355 + }else{
  356 + var ylArray = [];
  357 + $('input.icheck').each(function(){
  358 + var map = {};
  359 + var id=$(this).data('id');
  360 + var nbbm =$('.in_carpark_nbbm[data-id='+id+']', '#dl_oil_list').html();
  361 + var jql =$('.in_carpark_jql[data-id='+id+']', '#dl_oil_list').html();
  362 + if(jql=="" || jql ==null){
  363 + jql=0;
  364 + }
  365 + var czcl=$('.in_carpark_czcl[data-id='+id+']', '#dl_oil_list').val();
  366 + if(czcl=="" || czcl==null){
  367 + czcl=0;
  368 + }
  369 + var jzcl=$('.in_carpark_jzcl[data-id='+id+']', '#dl_oil_list').val();
  370 + if(jzcl=="" || jzcl==null){
  371 + jzcl=0;
  372 + }
  373 +
  374 + var sh = $('.in_carpark_shyl[data-id='+id+']', '#dl_oil_list').val();
  375 + if(sh=="" || sh==null){
  376 + sh=0;
  377 + }
  378 +
  379 + var shyy = $('.in_carpark_shyy[data-id='+id+']', '#dl_oil_list').val();
  380 + var hn = $('.in_carpark_hn[data-id='+id+']', '#dl_oil_list').val();
  381 + if(hn=="" || hn==null){
  382 + hn=0;
  383 + }
  384 + var nhlx = $('.in_carpark_nhlx[data-id='+id+']', '#dl_oil_list').val();
  385 +
  386 + map['id']=id;
  387 + map['jql']=jql;
  388 + map['czcl']=czcl;
  389 + map['jzcl']=jzcl;
  390 + map['sh']=sh;
  391 + map['shyy']=shyy;
  392 + map['nhlx']=nhlx;
  393 + map['nbbm']=nbbm;
  394 + map['hn']=hn;
  395 + map['rq']=$("#rq").val();
  396 + ylArray.push(map);
  397 + })
  398 + var params = {};
  399 + params['qlbList']=JSON.stringify(ylArray);
  400 + var i = layer.load(2);
  401 + $post('/qlb/saveQlbList', params, function () {
  402 + layer.close(i);
  403 + var params1 =getParamsList();
  404 + jsDoQuery(params1, true);
  405 + });
  406 + }
  407 + })
  408 + })
  409 + //获取加存信息
  410 + $("#obtain").on('click', function () {
  411 + if ($("#rq").val() != "") {
  412 + var ylbGsdm=$("#ylbListGsdmId").val();
  413 + var ylbFgsdm=$("#ylbListFgsdmId").val();
  414 +// if(ylbGsdm=="" || ylbGsdm==null || ylbFgsdm=="" ||ylbFgsdm==null){
  415 +// layer.msg('请选择公司和分公司.');
  416 + if(ylbGsdm=="" || ylbGsdm==null){
  417 + layer.msg('请选择公司.');
  418 + } else {
  419 + var params=getParamsList();
  420 + var par={};
  421 + par["rq"] = moment($("#rq").val()).subtract(2, 'days').format("YYYY-MM-DD");
  422 + par["ssgsdm_like"] = $("#ylbListGsdmId").val();
  423 + $get('/ylb/checkDate',par,function(status){
  424 + if(status=='2'){
  425 + layer.msg('只能操作三天内数据.');
  426 + }else{
  427 + var i = layer.load(2);
  428 + params["fgsdm_like"] = '';
  429 + $get('/qlb/obtain', params, function () {
  430 + layer.close(i);
  431 + params["fgsdm_like"] = ylbFgsdm;
  432 + jsDoQuery(params, true);
  433 + });
  434 + }
  435 + });
  436 + }
  437 + } else {
  438 + layer.msg('请选择日期.');
  439 + }
  440 +
  441 + })
  442 +
  443 + var page = 0, initPagination;
  444 + var icheckOptions = {
  445 + radioClass: 'icheckbox_flat-blue',
  446 + increaseArea: '20%'
  447 + }
  448 +
  449 + //重置
  450 + $('tr.filter2 .filter-cancel').on('click', function () {
  451 + $('tr.filter2 , #nbbm').val('').change();
  452 + });
  453 +
  454 + //提交
  455 + $('tr.filter .filter-submit').on('click', function () {
  456 + var ylbGsdm=$("#ylbListGsdmId").val();
  457 + var ylbFgsdm=$("#ylbListFgsdmId").val();
  458 + if ($("#rq").val() == "" || $("#rq").val() ==null){
  459 + layer.msg('请选择日期.');
  460 + }else if(ylbGsdm=="" || ylbGsdm==null){
  461 + layer.msg('请选择公司和分公司.');
  462 + }else {
  463 + var params = getParamsList();
  464 +
  465 + page = 0;
  466 + jsDoQuery(params, true);
  467 + }
  468 + });
  469 +
  470 + function getParamsList(){
  471 + var cells = $('tr.filter')[0].cells
  472 + , cells1 = $('tr.filter2')[0].cells,params = {}
  473 + , name;
  474 + $.each(cells, function (i, cell) {
  475 + var items = $('input,select', cell);
  476 + for (var j = 0, item; item = items[j++];) {
  477 + name = $(item).attr('name');
  478 + if (name) {
  479 + params[name] = $(item).val();
  480 + }
  481 + }
  482 + });
  483 + $.each(cells1, function (i, cell) {
  484 + var items = $('input,select', cell);
  485 + for (var j = 0, item; item = items[j++];) {
  486 + name = $(item).attr('name');
  487 + if (name) {
  488 + params[name] = $(item).val();
  489 + }
  490 + }
  491 + });
  492 +
  493 + return params;
  494 + }
  495 +
  496 +
  497 + var xlList;
  498 + var obj=[];
  499 + $.get('/report/lineList',function(result){
  500 + xlList=result;
  501 + $.get('/user/companyData', function(result){
  502 + obj = result;
  503 + var options="";
  504 + // = '<option value="">请选择</option>';
  505 + for(var i = 0; i < obj.length; i++){
  506 + options += '<option value="'+obj[i].companyCode+'">'+obj[i].companyName+'</option>';
  507 + // setFgsqx(obj[i].companyCode);
  508 + }
  509 + $('#ylbListGsdmId').html(options);
  510 + updateCompany();
  511 + });
  512 + })
  513 + $("#ylbListGsdmId").on("change",updateCompany);
  514 + function updateCompany(){
  515 + var company = $('#ylbListGsdmId').val();
  516 + var options = '<option value="">全部分公司</option>';
  517 +// = '<option value="">请选择</option>';
  518 + for(var i = 0; i < obj.length; i++){
  519 + if(obj[i].companyCode == company){
  520 + var children = obj[i].children;
  521 + for(var j = 0; j < children.length; j++){
  522 + options += '<option value="'+children[j].code+'">'+children[j].name+'</option>';
  523 + }
  524 + }
  525 + }
  526 + $('#ylbListFgsdmId').html(options);
  527 + initXl();
  528 + initCl();
  529 + }
  530 + /*
  531 + * 获取数据 p: 要提交的参数, pagination: 是否重新分页
  532 + */
  533 + function jsDoQuery(p, pagination) {
  534 + var params = {};
  535 + if (p)
  536 + params = p;
  537 + //更新时间排序
  538 + params['order'] = 'nbbm';
  539 + params['page'] = page;
  540 + params['rq'] = $("#rq").val();
  541 + params['type'] = '2';
  542 +
  543 +
  544 + var l = layer.load(2);
  545 + $get('/qlb/qlbList', params, function (data) {
  546 +
  547 + $.each(data, function (i, obj) {
  548 + obj.rq = moment(obj.rq).format("YYYY-MM-DD");
  549 + });
  550 + var bodyHtm = template('qlb_list_temp', {list:data});
  551 + $('#datatable_qlb tbody').html(bodyHtm);
  552 + $('.btn-jsyUpdate').on('click', jsyUpdate);
  553 + layer.close(l);
  554 + $get('/qlb/sumQlb',params,function(returns){
  555 + $("#sumJzl").html(returns.jzl);
  556 + $("#sumYh").html(returns.yh);
  557 + $("#sumSh").html(returns.sh);
  558 + });
  559 +
  560 + });
  561 + }
  562 +
  563 + function jsyUpdate(){
  564 + var params=getParamsList();
  565 + var id = $(this).data('id');
  566 + var par={};
  567 + par["rq"] = moment($("#rq").val()).subtract(2, 'days').format("YYYY-MM-DD");
  568 + par["ssgsdm_like"] = $("#ylbListGsdmId").val();
  569 + $get('/ylb/checkDate',par,function(status){
  570 + if(status=='2'){
  571 + layer.msg('只能操作三天内数据.');
  572 + }else{
  573 + var jsy=$('.in_carpark_jsy[data-id='+id+']', '#dl_oil_list').val();
  574 + console.log(id+"修改驾驶员:"+jsy);
  575 + $get('/qlb/updateJsy',{id:id,jsy:jsy}, function(result){
  576 + layer.msg('修改成功.');
  577 + page = 0;
  578 + jsDoQuery(params, true);
  579 + });
  580 + }
  581 + })
  582 + }
  583 + //页面计算防止精度丢失
  584 + var accAdd = function (a, b) {
  585 + var c, d, e;
  586 + try {
  587 + c = a.toString().split(".")[1].length;
  588 + } catch (f) {
  589 + c = 0;
  590 + }
  591 + try {
  592 + d = b.toString().split(".")[1].length;
  593 + } catch (f) {
  594 + d = 0;
  595 + }
  596 + return e = Math.pow(10, Math.max(c, d)), (mul(a, e) + mul(b, e)) / e;
  597 + };
  598 +
  599 + var numSubtr = function (a, b) {
  600 + var c, d, e;
  601 + try {
  602 + c = a.toString().split(".")[1].length;
  603 + } catch (f) {
  604 + c = 0;
  605 + }
  606 + try {
  607 + d = b.toString().split(".")[1].length;
  608 + } catch (f) {
  609 + d = 0;
  610 + }
  611 + return e = Math.pow(10, Math.max(c, d)), (a * e - b * e) / e;
  612 + };
  613 +
  614 + function mul(a, b) {
  615 + var c = 0,
  616 + d = a.toString(),
  617 + e = b.toString();
  618 + try {
  619 + c += d.split(".")[1].length;
  620 + } catch (f) {
  621 + }
  622 + try {
  623 + c += e.split(".")[1].length;
  624 + } catch (f) {
  625 + }
  626 + return Number(d.replace(".", "")) * Number(e.replace(".", "")) / Math.pow(10, c);
  627 + }
  628 +
  629 + //改变状态
  630 + function startOptJzylLink(es) {
  631 + es.editable({
  632 + type: 'text',
  633 + placement: 'right',
  634 + width: 100,
  635 + display: false,
  636 + validate: function (value) {
  637 + if (!value)
  638 + return '值不能为空!';
  639 + if (isNaN(value))
  640 + return '只能为数字!';
  641 + if (value < 0)
  642 + return '值不能小于0!';
  643 + },
  644 + inputclass: 'form-control input-medium input-edtable-sm'
  645 + })
  646 + .on('save', function (e, params) {
  647 + $(this).text(params.newValue);
  648 + });
  649 + }
  650 +
  651 + //改变状态
  652 + function startOptShylLink(es) {
  653 + es.editable({
  654 + type: 'text',
  655 + placement: 'right',
  656 + width: 100,
  657 + display: false,
  658 + validate: function (value) {
  659 + if (!value)
  660 + return '值不能为空!';
  661 + if (isNaN(value))
  662 + return '只能为数字!';
  663 + if (value < 0)
  664 + return '值不能小于0!';
  665 + },
  666 + inputclass: 'form-control input-medium input-edtable-sm'
  667 + })
  668 + .on('save', function (e, params) {
  669 + $(this).text(params.newValue);
  670 + });
  671 + }
  672 + function iCheckChange() {
  673 + var tr = $(this).parents('tr');
  674 + if (this.checked)
  675 + tr.addClass('row-active');
  676 + else
  677 + tr.removeClass('row-active');
  678 +
  679 + /* if($('#datatable_resource input.icheck:checked').length == 1)
  680 + $('#removeButton').removeAttr('disabled');
  681 + else
  682 + $('#removeButton').attr('disabled', 'disabled'); */
  683 + }
  684 +
  685 + function showPagination(data) {
  686 + //分页
  687 + $('#pagination').jqPaginator({
  688 + totalPages: data.totalPages,
  689 + visiblePages: 6,
  690 + currentPage: page + 1,
  691 + first: '<li class="first"><a href="javascript:void(0);">首页<\/a><\/li>',
  692 + prev: '<li class="prev"><a href="javascript:void(0);">上一页<\/a><\/li>',
  693 + next: '<li class="next"><a href="javascript:void(0);">下一页<\/a><\/li>',
  694 + last: '<li class="last"><a href="javascript:void(0);">尾页<\/a><\/li>',
  695 + page: '<li class="page"><a href="javascript:void(0);">{{page}}<\/a><\/li>',
  696 + onPageChange: function (num, type) {
  697 + if (initPagination) {
  698 + initPagination = false;
  699 + return;
  700 + }
  701 +
  702 + var params=getParamsList();
  703 + page = num - 1;
  704 + jsDoQuery(params, true);
  705 + }
  706 + });
  707 + }
  708 +
  709 +
  710 + //删除
  711 + $('#removeButton').on('click', function () {
  712 + var params_=getParamsList();
  713 + var par={};
  714 + par["rq"] = moment($("#rq").val()).subtract(2, 'days').format("YYYY-MM-DD");
  715 + par["ssgsdm_like"] = $("#ylbListGsdmId").val();
  716 + $get('/ylb/checkDate',par,function(status){
  717 + if(status=='2'){
  718 + layer.msg('只能操作三天内数据.');
  719 + }else{
  720 + var idArray = [];
  721 + var x=0;
  722 + $('input.icheck:checked').each(function(){
  723 + x++;
  724 + var map ={};
  725 + var id=$(this).data('id');
  726 + map['id']=id;
  727 + idArray.push(map);
  728 +
  729 + })
  730 + var params = {};
  731 + params['ids']=JSON.stringify(idArray);
  732 + if (x==0) {
  733 + layer.msg("请选择要删除的数据");
  734 + }else{
  735 + if(confirm('确定要删除选中的数据?'))
  736 + {
  737 + var i = layer.load(2);
  738 + $post('/qlb/deleteIds', params, function (result) {
  739 + layer.close(i);
  740 + var params=getParamsList();
  741 + jsDoQuery(params, true);
  742 + });
  743 + }
  744 + }
  745 + }
  746 + })
  747 + });
  748 +
  749 +
  750 + $("#ylbListFgsdmId").on("change",initXl);
  751 + function initXl(){
  752 + var data=[];
  753 + data.push({id: " ", text: "全部线路"});
  754 + if(fage){
  755 + $("#xlbm").select2("destroy").html('');
  756 + }
  757 + var fgs=$('#ylbListFgsdmId').val();
  758 + var gs=$('#ylbListGsdmId').val();
  759 + for(var i=0;i<xlList.length;i++){
  760 + if(gs!=""){
  761 + if(fgs!=""){
  762 + if(xlList[i]["fgsbm"]==fgs && xlList[i]["gsbm"]==gs){
  763 + data.push({id: xlList[i]["xlbm"], text: xlList[i]["xlname"]});
  764 + }
  765 + }else{
  766 + if(xlList[i]["gsbm"]==gs){
  767 + data.push({id: xlList[i]["xlbm"], text: xlList[i]["xlname"]});
  768 + }
  769 + }
  770 + }
  771 + }
  772 + initPinYinSelect2('#xlbm',data,'');
  773 + fage=true;
  774 + }
  775 + $("#xlbm").on("change",initCl);
  776 + function initCl(){
  777 + $('#nbbm').select2({
  778 + placeholder: '搜索车辆...',
  779 + ajax: {
  780 + url: '/report/carList',
  781 + dataType: 'json',
  782 + delay: 150,
  783 + data: function (params) {
  784 + return {nbbm: params.term,
  785 + gsbm:$('#ylbListGsdmId').val(),
  786 + fgsbm:$('#ylbListFgsdmId').val(),
  787 + xlbm:$('#xlbm').val()};
  788 + },
  789 + processResults: function (data) {
  790 + return {
  791 + results: data
  792 + };
  793 + },
  794 + cache: true
  795 + },
  796 + templateResult: function (repo) {
  797 + if (repo.loading) return repo.text;
  798 + var h = '<span>' + repo.text + '</span>';
  799 + h += (repo.lineName ? '&nbsp;<span class="select2-desc">' + repo.lineName + '</span>' : '');
  800 + return h;
  801 + },
  802 + escapeMarkup: function (markup) {
  803 + return markup;
  804 + },
  805 + minimumInputLength: 1,
  806 + templateSelection: function (repo) {
  807 + return repo.text;
  808 + },
  809 + language: {
  810 + noResults: function () {
  811 + return '<span style="color:red;font-size: 12px;">没有搜索到车辆!</span>';
  812 + },
  813 + inputTooShort: function (e) {
  814 + return '<span style="color:gray;font-size: 12px;"><i class="fa fa-search"></i> 输入自编号搜索车辆</span>';
  815 + },
  816 + searching: function () {
  817 + return '<span style="color:gray;font-size: 12px;"> 正在搜索车辆...</span>';
  818 + }
  819 + }
  820 + });
  821 + }
  822 +// }
  823 +
  824 +
  825 +//导出
  826 +
  827 + $("#export").on("click", function () {
  828 + if ($("#rq").val() != "") {
  829 + var params=getParamsList();
  830 + params['type']='2';
  831 + $post('/qlb/listExport', params, function (result) {
  832 + window.open("/downloadFile/download?fileName="+$("#rq").val()+"进出场存氢量" );
  833 + });
  834 + } else {
  835 + layer.msg('请选择日期.');
  836 + }
  837 + });
  838 +
  839 + });
  840 +</script>
0 \ No newline at end of file 841 \ No newline at end of file
src/main/resources/static/pages/oil/jylList.html 0 → 100644
  1 +<style>
  2 +.blue{
  3 + background-color: #87CEFF
  4 +}
  5 +</style>
  6 +<div class="page-head">
  7 + <div class="page-title">
  8 + <h1>车辆加油量</h1>
  9 + </div>
  10 +</div>
  11 +<ul class="page-breadcrumb breadcrumb">
  12 + <li><a href="/pages/home.html" data-pjax>首页</a> <i class="fa fa-circle"></i></li>
  13 + <li><span class="active">油量信息查询</span> <i class="fa fa-circle"></i></li>
  14 + <li><span class="active">车辆加油量</span></li>
  15 +</ul>
  16 +
  17 +<div class="row" id="ll_oil_list">
  18 + <div class="col-md-12">
  19 + <!-- Begin: life time stats -->
  20 + <div class="portlet light portlet-fit portlet-datatable bordered">
  21 + <div class="portlet-title">
  22 + <div class="caption">
  23 + <i class="fa fa-fire-extinguisher"></i> <span
  24 + class="caption-subject font-dark sbold uppercase">车辆加油量</span>
  25 + </div>
  26 + <div class="actions">
  27 + <button type="button" class="btn btn-circle blue" id="upload"><i class="fa fa-file-excel-o"></i>
  28 + 导入Excel
  29 + </button>
  30 + <!--<button type="button" class="btn btn-circle blue" id="export"><i class="fa fa-file-excel-o"></i>
  31 + 导出Excel
  32 + </button>-->
  33 + </div>
  34 + </div>
  35 + <div class="portlet-body">
  36 + <div class="table-container" style="margin-top: 0px">
  37 + <table
  38 + class="table table-striped table-bordered table-hover table-checkable"
  39 + id="datatable_dlb">
  40 + <thead>
  41 +
  42 + <tr role="row" class="heading">
  43 + <th width="5%">#</th>
  44 + <th width="15%">日期</th>
  45 + <th width="15%">内部编码</th>
  46 + <th width="15%">加油量</th>
  47 + <th width="15%">加油站</th>
  48 + <th width="15%">油号</th>
  49 + <th width="20%">备注</th>
  50 + </tr>
  51 + <tr role="row" class="filter">
  52 + <td></td>
  53 + <td>
  54 + <input type="text" style="width: 100px" name="rq" id="rq"/>
  55 + </td>
  56 + <!--<td>
  57 + <select class="form-control" name="nbbm" id="nbbm" style="width: 120px;"></select>
  58 + </td>-->
  59 + <td></td>
  60 + <td></td>
  61 + <td></td>
  62 + <td></td>
  63 + <td>
  64 + <button class="btn btn-sm green btn-outline filter-submit margin-bottom" style="margin-right:0px">
  65 + <i class="fa fa-search"></i> 搜索
  66 + </button>
  67 + <button class="btn btn-sm red btn-outline filter-cancel" style="margin-right:0px">
  68 + <i class="fa fa-times"></i> 重置
  69 + </button>
  70 + <!-- <button class="btn btn-danger btn-sm red" id="del" style="margin-right:0px"> -->
  71 + <!-- <i class="fa fa-times"></i> 删除 -->
  72 + <!-- </button> -->
  73 + </td>
  74 + </tr>
  75 + </thead>
  76 + <tbody></tbody>
  77 + </table>
  78 + <div style="text-align: right;">
  79 + <ul id="pagination" class="pagination"></ul>
  80 + </div>
  81 + </div>
  82 + </div>
  83 + <div class="portlet-body">
  84 + <div id="modules_tree"></div>
  85 + </div>
  86 + </div>
  87 + </div>
  88 +</div>
  89 +
  90 +
  91 +<script src="/assets/js/ajaxfileupload/ajaxfileupload.js"></script>
  92 +<script>
  93 + $(function () {
  94 +
  95 + // 关闭左侧栏
  96 + if (!$('body').hasClass('page-sidebar-closed'))
  97 + $('.menu-toggler.sidebar-toggler').click();
  98 +
  99 + $("#rq").datetimepicker({
  100 + format: 'YYYY-MM-DD',
  101 + locale: 'zh-cn'
  102 + });
  103 + var d = new Date();
  104 + d.setTime(d.getTime() - 1*1000*60*60*24);
  105 + var year = d.getFullYear();
  106 + var month = d.getMonth() + 1;
  107 + var day = d.getDate();
  108 + if(month < 10)
  109 + month = "0" + month;
  110 + if(day < 10)
  111 + day = "0" + day;
  112 + $("#rq").val(year + "-" + month + "-" + day);
  113 + var page = 0, initPagination;
  114 + var icheckOptions = {
  115 + radioClass: 'iradio_square-blue icheck',
  116 + increaseArea: '20%'
  117 + }
  118 +
  119 + //重置
  120 + $('tr.filter .filter-cancel').on('click', function () {
  121 + $('tr.filter input, select').val('').change();
  122 + });
  123 +
  124 + //提交
  125 + $('tr.filter .filter-submit').on('click', function () {
  126 + if ($("#rq").val() == "" || $("#rq").val() ==null){
  127 + layer.msg('请选择日期.');
  128 + }else {
  129 +
  130 + var params = getParams();
  131 +
  132 + page = 0;
  133 + jsDoQuery(params, true);
  134 + }
  135 + });
  136 +
  137 +
  138 + $.get('/user/companyData', function(result){
  139 + obj = result;
  140 + var options="";
  141 +// = '<option value="">请选择</option>';
  142 + for(var i = 0; i < obj.length; i++){
  143 + options += '<option value="'+obj[i].companyCode+'">'+obj[i].companyName+'</option>';
  144 +// setFgsqx(obj[i].companyCode);
  145 + }
  146 + $('#gsbm').html(options);
  147 + updateCompany();
  148 + });
  149 +
  150 + $("#gsbm").on("change",updateCompany);
  151 + function updateCompany(){
  152 + var company = $('#gsbm').val();
  153 + var options ="";
  154 +// = '<option value="">请选择</option>';
  155 + for(var i = 0; i < obj.length; i++){
  156 + if(obj[i].companyCode == company){
  157 + var children = obj[i].children;
  158 + for(var j = 0; j < children.length; j++){
  159 + options += '<option value="'+children[j].code+'">'+children[j].name+'</option>';
  160 + }
  161 + }
  162 + }
  163 + $('#fgsbm').html(options);
  164 + }
  165 + /*
  166 + * 获取数据 p: 要提交的参数, pagination: 是否重新分页
  167 + */
  168 + function jsDoQuery(p, pagination) {
  169 + var params = {};
  170 + if (p)
  171 + params = p;
  172 + params['order'] = 'nbbm';
  173 + params['page'] = page;
  174 + params['rq'] = $("#rq").val();
  175 +
  176 + var j = layer.load(2);
  177 + $get('/ylxxb/query', params, function (data) {
  178 + $.each(data.dataList, function (i, obj) {
  179 + obj.rq = moment(obj.rq).format("YYYY-MM-DD");
  180 + });
  181 + var bodyHtm = template('jyl_list', {list:data.dataList});
  182 +
  183 + $('#datatable_dlb tbody').html(bodyHtm)
  184 + .find('.icheck').iCheck(icheckOptions)
  185 + .on('ifChanged', iCheckChange);
  186 + if (pagination && data.dataList.length > 0) {
  187 + //重新分页
  188 + initPagination = true;
  189 + showPagination(data);
  190 + $('#pagination').show();
  191 + } else if(data.dataList.length == 0){
  192 + $('#pagination').hide();
  193 + }
  194 +
  195 + layer.close(j);
  196 +
  197 + startOptJzylLink($('#ll_oil_list .in_carpark_jzyl'));
  198 + });
  199 + }
  200 +
  201 + //改变状态
  202 + function startOptJzylLink(es) {
  203 + es.editable({
  204 + type: 'text',
  205 + placement: 'right',
  206 + width: 100,
  207 + display: false,
  208 + validate: function (value) {
  209 + if (!value)
  210 + return '值不能为空!';
  211 + if (isNaN(value))
  212 + return '只能为数字!';
  213 + if (value < 0)
  214 + return '值不能小于0!';
  215 + },
  216 + inputclass: 'form-control input-medium input-edtable-sm'
  217 + }).on('save', function (e, params) {
  218 + $(this).text(params.newValue);
  219 + });
  220 + }
  221 +
  222 + function iCheckChange() {
  223 + var tr = $(this).parents('tr');
  224 + if (this.checked)
  225 + tr.addClass('row-active');
  226 + else
  227 + tr.removeClass('row-active');
  228 +
  229 + /* if($('#datatable_resource input.icheck:checked').length == 1)
  230 + $('#removeButton').removeAttr('disabled');
  231 + else
  232 + $('#removeButton').attr('disabled', 'disabled'); */
  233 + }
  234 +
  235 + function showPagination(data) {
  236 + //分页
  237 + $('#pagination').jqPaginator({
  238 + totalPages: data.totalPages,
  239 + visiblePages: 6,
  240 + currentPage: page + 1,
  241 + first: '<li class="first"><a href="javascript:void(0);">首页<\/a><\/li>',
  242 + prev: '<li class="prev"><a href="javascript:void(0);">上一页<\/a><\/li>',
  243 + next: '<li class="next"><a href="javascript:void(0);">下一页<\/a><\/li>',
  244 + last: '<li class="last"><a href="javascript:void(0);">尾页<\/a><\/li>',
  245 + page: '<li class="page"><a href="javascript:void(0);">{{page}}<\/a><\/li>',
  246 + onPageChange: function (num, type) {
  247 + if (initPagination) {
  248 + initPagination = false;
  249 + return;
  250 + }
  251 +
  252 + var params = getParams();
  253 +
  254 + page = num - 1;
  255 + jsDoQuery(params, true);
  256 + }
  257 + });
  258 + }
  259 +
  260 +
  261 + //删除
  262 + $('#del').on('click', function () {
  263 + if ($(this).attr('disabled'))
  264 + return;
  265 +
  266 + var id = $('input.icheck:checked').data('id');
  267 + removeConfirm('确定要删除选中的数据?', '/resource/' + id, function () {
  268 + $('tr.filter .filter-submit').click();
  269 + });
  270 + });
  271 +
  272 + //搜索线路
  273 + $.get('/basic/lineCode2Name',function(result){
  274 + var data=[];
  275 +
  276 + for(var code in result){
  277 + data.push({id: code, text: result[code]});
  278 + }
  279 + initPinYinSelect2('#xlbm',data,'');
  280 +
  281 + });
  282 +
  283 + $('#nbbm').select2({
  284 + placeholder: '搜索车辆...',
  285 + ajax: {
  286 + url: '/realSchedule/sreachVehic',
  287 + dataType: 'json',
  288 + delay: 150,
  289 + data: function (params) {
  290 + return {nbbm: params.term};
  291 + },
  292 + processResults: function (data) {
  293 + return {
  294 + results: data
  295 + };
  296 + },
  297 + cache: true
  298 + },
  299 + templateResult: function (repo) {
  300 + if (repo.loading) return repo.text;
  301 + var h = '<span>' + repo.text + '</span>';
  302 + h += (repo.lineName ? '&nbsp;<span class="select2-desc">' + repo.lineName + '</span>' : '');
  303 + return h;
  304 + },
  305 + escapeMarkup: function (markup) {
  306 + return markup;
  307 + },
  308 + minimumInputLength: 1,
  309 + templateSelection: function (repo) {
  310 + return repo.text;
  311 + },
  312 + language: {
  313 + noResults: function () {
  314 + return '<span style="color:red;font-size: 12px;">没有搜索到车辆!</span>';
  315 + },
  316 + inputTooShort: function (e) {
  317 + return '<span style="color:gray;font-size: 12px;"><i class="fa fa-search"></i> 输入自编号搜索车辆</span>';
  318 + },
  319 + searching: function () {
  320 + return '<span style="color:gray;font-size: 12px;"> 正在搜索车辆...</span>';
  321 + }
  322 + }
  323 + })
  324 +
  325 + //导入
  326 + $("#upload").on("click", function(){
  327 + $.get('upload.html', function(m){$(pjaxContainer).append(m);});
  328 + });
  329 +
  330 + //导出
  331 + $("#export").on("click", function () {
  332 + if ($("#rq").val() != "") {
  333 + var gsbm=$("#gsbm").val();
  334 + var fgsbm=$("#fgsbm").val();
  335 + if(gsbm=="" || gsbm==null || fgsbm=="" ||fgsbm==null){
  336 + layer.msg('请选择公司和分公司.');
  337 + return;
  338 + }
  339 + var params = getParams();
  340 +
  341 + params["type"] = "export";
  342 + $get('/jdl/query', params, function (result) {
  343 + window.open("/downloadFile/download?fileName=车辆充电量" + moment($("#rq").val()).format("YYYYMMDD"));
  344 + });
  345 + } else {
  346 + layer.msg('请选择日期.');
  347 + }
  348 + });
  349 +
  350 + function getParams(){
  351 + var cells = $('tr.filter')[0].cells
  352 + , params = {}
  353 + , name;
  354 + $.each(cells, function (i, cell) {
  355 + var items = $('input,select', cell);
  356 + for (var j = 0, item; item = items[j++];) {
  357 + name = $(item).attr('name');
  358 + if (name) {
  359 + params[name] = $(item).val();
  360 + }
  361 + }
  362 + });
  363 + return params;
  364 + };
  365 +
  366 + });
  367 +
  368 +</script>
  369 +
  370 +<script id="jyl_list" type="text/html">
  371 + {{each list as obj i}}
  372 + <tr>
  373 + <td style="vertical-align: middle;">
  374 + <!-- <input type="radio" name="id" class="group-checkable icheck" data-id="{{obj.id}}"> -->
  375 + {{i + 1}}
  376 + </td>
  377 + <td>{{obj.rq}}</td>
  378 + <td>{{obj.nbbm}}</td>
  379 + <td>{{obj.jzl}}</td>
  380 + <td>{{obj.stationid}}</td>
  381 + <td>{{obj.yh}}</td>
  382 + <td>{{obj.bz}}</td>
  383 + </tr>
  384 + {{/each}}
  385 + {{if list.length == 0}}
  386 + <tr>
  387 + <td colspan=9><h6 class="muted">没有找到相关数据</h6></td>
  388 + </tr>
  389 + {{/if}}
  390 +</script>
0 \ No newline at end of file 391 \ No newline at end of file
src/main/resources/static/pages/oil/upload.html 0 → 100644
  1 +<div class="modal fade" id="uploadFile" tabindex="-1" role="basic"
  2 + aria-hidden="true">
  3 + <div class="modal-dialog">
  4 + <div class="modal-content">
  5 + <div class="modal-header">
  6 + <button type="button" class="close" data-dismiss="modal"
  7 + aria-hidden="true"></button>
  8 + <h4 class="modal-title">导入Excel</h4>
  9 + </div>
  10 + <div class="modal-body">
  11 + <form class="form-horizontal" role="form" id="excelFile" method="post"
  12 + action="" enctype="multipart/form-data">
  13 + <input type="hidden" name="groupType" value="3">
  14 + <div class="alert alert-danger display-hide">
  15 + <button class="close" data-close="alert"></button>
  16 + 您的输入有误,请检查下面的输入项
  17 + </div>
  18 + <div class="form-body">
  19 + <div class="form-group">
  20 + <label class="col-md-3 control-label">选择文件</label>
  21 + <div class="col-md-9">
  22 + <input type="file" name="file" id="file"
  23 + accept="application/vnd.ms-excel"/>
  24 + <input type=hidden name="gsbm_" id="gsbm_">
  25 + <input type="hidden" name="gsName" id="gsName">
  26 +<!-- <input type="hidden" name="fgsbm_" id="fgsbm_"> -->
  27 +<!-- <input type="hidden" name="fgsName" id="fgsName"> -->
  28 + </div>
  29 + </div>
  30 + </div>
  31 + </form>
  32 + </div>
  33 + <div class="modal-footer">
  34 + <button type="button" class="btn default" id="downLoad">下载模板</button>
  35 + <button type="button" class="btn default" data-dismiss="modal">取消</button>
  36 + <button type="button" class="btn btn-primary" id="submit">确认导入</button>
  37 + </div>
  38 + </div>
  39 + </div>
  40 +</div>
  41 +<script id="res_tbody_temp" type="text/html">
  42 +
  43 +</script>
  44 +<script data-exclude=1>
  45 + $(function() {
  46 + var form = $('#excelFile');
  47 + var error = $('.alert-danger', form);
  48 +
  49 + $('#gsbm_').val($("select[name=gsdm_like]").val());
  50 + $('#gsName').val($("select[name=gsdm_like]").find("option:selected").text());
  51 +// $('#fgsbm_').val($("#fgsbm").val());
  52 +// $('#fgsName').val($("#fgsbm").find("option:selected").text());
  53 +
  54 + //modal 显示事件
  55 + $('#uploadFile').on('show.bs.modal', function(){
  56 + })
  57 + .modal('show');
  58 +
  59 + //提交
  60 +// $('#submit').on('click', function() {
  61 +// form.submit();
  62 +// });
  63 +
  64 + $('#submit').on('click', function() {
  65 + var j = layer.load(2);
  66 + var param = {};
  67 + param.uploadDir = 'upload';
  68 + param["gsbm_"] = $('#gsbm_').val();
  69 + param["gsName"] = $('#gsName').val();
  70 +// param["fgsbm_"] = $('#fgsbm_').val();
  71 +// param["fgsName"] = $('#fgsName').val();
  72 + $.ajaxFileUpload({
  73 + url : '/ylxxb/uploadFile',
  74 + secureuri : false,
  75 + fileElementId : 'file',
  76 + dataType : 'json',
  77 + data : param,
  78 + success : function(data) {
  79 + layer.close(j);
  80 + alert(data.result);
  81 +// alert("文件导入成功");
  82 + $('#uploadFile').modal('hide');
  83 + $('tr.filter .filter-submit').click();
  84 + },
  85 + error : function(data, status, e) {
  86 + layer.close(j);
  87 + alert("文件导入失败");
  88 + }
  89 + })
  90 + });
  91 +
  92 + $('#downLoad').on('click', function(){
  93 + window.open("/downloadFile/downloadModel?fileName=车辆加油");
  94 + });
  95 +
  96 + function getCurrSelNode(){
  97 + return $.jstree.reference("#modules_tree").get_selected(true);
  98 + }
  99 + });
  100 +</script>
0 \ No newline at end of file 101 \ No newline at end of file
src/main/resources/static/pages/report/xlybtb/list.html 0 → 100644
  1 +<style>
  2 +.blue{
  3 + background-color: #87CEFF
  4 +}
  5 +.table-bordered {
  6 + border: 1px solid; }
  7 +.table-bordered > thead > tr > th,
  8 +.table-bordered > thead > tr > td,
  9 +.table-bordered > tbody > tr > th,
  10 +.table-bordered > tbody > tr > td,
  11 +.table-bordered > tfoot > tr > th,
  12 +.table-bordered > tfoot > tr > td {
  13 + border: 1px solid; }
  14 +.table-bordered > thead > tr > th,
  15 +.table-bordered > thead > tr > td {
  16 + border-bottom-width: 2px; }
  17 +
  18 +.table > tbody + tbody {
  19 + border-top: 1px solid; }
  20 +</style>
  21 +<div class="page-head">
  22 + <div class="page-title">
  23 + <h1>路线生产月报同比</h1>
  24 + </div>
  25 +</div>
  26 +<ul class="page-breadcrumb breadcrumb">
  27 + <li><a href="/pages/home.html" data-pjax>首页</a> <i class="fa fa-circle"></i></li>
  28 + <li><span class="active">报表管理</span> <i class="fa fa-circle"></i></li>
  29 + <li><span class="active">路线生产月报同比</span></li>
  30 +</ul>
  31 +
  32 +<div class="row">
  33 + <div class="col-md-12">
  34 + <div class="portlet light porttlet-fit bordered">
  35 + <div class="portlet-title">
  36 + <form class="form-inline" action="">
  37 + <!-- <div style="display: inline-block;">
  38 + <span class="item-label" style="width: 80px;">线路: </span>
  39 + <select class="form-control" name="line" id="line" style="width: 180px;"></select>
  40 + </div>-->
  41 + <div style="display: inline-block;margin-left: 15px;">
  42 + <span class="item-label" style="width: 80px;">开始时间: </span>
  43 + <input class="form-control" type="text" id="dateS" style="width: 180px;"/>
  44 + <span class="item-label" style="width: 80px;">结束时间: </span>
  45 + <input class="form-control" type="text" id="dateE" style="width: 180px;"/>
  46 + <!-- <input class="btn btn-default" type="button" id="czcl" value="X"/>-->
  47 + </div>
  48 + <div class="form-group">
  49 + <input class="btn btn-default" type="button" id="query" value="筛选"/>
  50 + </div>
  51 + <div class="form-group" style="float:right;">
  52 + <button type="button" class="btn btn-circle blue" id="export"><i class="fa fa-file-excel-o"></i>
  53 + 导出Excel
  54 + </button>
  55 + </div>
  56 + </form>
  57 + </div>
  58 + <div class="portlet-body">
  59 + <div class="table-container" style="margin-top: 10px;overflow:auto;min-width: 906px">
  60 + <table class="table table-striped table-bordered table-hover table-checkable" id="datatable_xlybtb">
  61 + <thead>
  62 + <tr>
  63 + <th colspan="40">线路生产月报同比</th>
  64 + </tr>
  65 + <tr>
  66 + <td rowspan="2">线路</td>
  67 + <td rowspan="2">线路长度</td>
  68 + <td colspan="5">线路营运人次(次)</td>
  69 + <td colspan="6">线路营业收入(元)</td>
  70 + <td colspan="7">线路行驶公里(公里)</td>
  71 + <td colspan="5">班次</td>
  72 + <td colspan="3">空驶公里</td>
  73 + </tr>
  74 + <tr>
  75 + <td >计划</td>
  76 + <td>实际</td>
  77 + <td rowspan="2">去年同期</td>
  78 + <td rowspan="2">同比%(+,-)</td>
  79 + <td rowspan="2">计划完成%</td>
  80 + <td rowspan="2">计划</td>
  81 + <td rowspan="2">实际</td>
  82 + <td rowspan="2">去年同期</td>
  83 + <td rowspan="2">同比%(+,-)</td>
  84 + <td rowspan="2">元/百公里</td>
  85 + <td rowspan="2">计划完成%</td>
  86 + <td rowspan="2">计划</td>
  87 + <td rowspan="2">柴油</td>
  88 + <td rowspan="2">纯电</td>
  89 + <td rowspan="2">氢燃料</td>
  90 + <td rowspan="2">去年同期</td>
  91 + <td rowspan="2">同比%(+,-)</td>
  92 + <td rowspan="2">计划完成%</td>
  93 + <td rowspan="2">计划</td>
  94 + <td rowspan="2">实际</td>
  95 + <td rowspan="2">去年同期</td>
  96 + <td rowspan="2">同比%(+,-)</td>
  97 + <td rowspan="2">计划完成%</td>
  98 + <td rowspan="2">实际</td>
  99 + <td rowspan="2">去年同期</td>
  100 + <td rowspan="2">同比%(+,-)</td>
  101 + </tr>
  102 + </thead>
  103 + <tbody>
  104 + </tbody>
  105 + </table>
  106 + <div style="text-align: right;">
  107 + <ul id="pagination" class="pagination"></ul>
  108 + </div>
  109 + </div>
  110 + </div>
  111 + </div>
  112 + </div>
  113 +</div>
  114 +
  115 +<script src="/assets/js/ajaxfileupload/ajaxfileupload.js"></script>
  116 +<script>
  117 + $(function () {
  118 + //日期插件
  119 + $("#dateS").datetimepicker({
  120 + format : 'YYYY-MM',
  121 + locale : 'zh-cn'
  122 + });
  123 + $("#dateE").datetimepicker({
  124 + format : 'YYYY-MM',
  125 + locale : 'zh-cn'
  126 + });
  127 + //线路下拉列表
  128 + $.get('/report/lineList',function(xlList){
  129 + var data = [];
  130 + data.push({id: " ", text: "全部线路"});
  131 + $.get('/user/companyData', function(result){
  132 + for(var i = 0; i < result.length; i++){
  133 + var companyCode = result[i].companyCode;
  134 + var children = result[i].children;
  135 + for(var j = 0; j < children.length; j++){
  136 + var code = children[j].code;
  137 + for(var k=0;k < xlList.length;k++ ){
  138 + if(xlList[k]["fgsbm"]==code && xlList[k]["gsbm"]==companyCode){
  139 + data.push({id: xlList[k]["xlbm"], text: xlList[k]["xlname"]});
  140 + }
  141 + }
  142 + }
  143 + }
  144 + initPinYinSelect2('#line',data,'');
  145 + });
  146 + });
  147 + //重置
  148 +/* $('#czcl').on('click', function () {
  149 + $('#code').val('').change();
  150 + });*/
  151 +
  152 + $("#query").on("click",function(){
  153 +
  154 + var params =getParams();
  155 + page = 0;
  156 + jsDoQuery(params, true);
  157 + });
  158 +
  159 +
  160 + // 关闭左侧栏
  161 + if (!$('body').hasClass('page-sidebar-closed'))
  162 + $('.menu-toggler.sidebar-toggler').click();
  163 +
  164 + var icheckOptions = {
  165 + radioClass: 'iradio_square-blue icheck',
  166 + increaseArea: '20%'
  167 + }
  168 +
  169 + /*
  170 + * 获取数据 p: 要提交的参数, pagination: 是否重新分页
  171 + */
  172 + function jsDoQuery(params, pagination) {
  173 + params['page'] = page;
  174 +
  175 + var j = layer.load(2);
  176 + $get('/xlybtb/query', params, function (data) {
  177 + $.each(data.dataList, function (i, obj) {
  178 + obj.date = moment(obj.date).format("YYYY-MM-DD");
  179 + });
  180 + var bodyHtm = template('xlybtb_list', {list:data.dataList});
  181 + $('#datatable_xlybtb tbody').html(bodyHtm)
  182 + .find('.icheck').iCheck(icheckOptions)
  183 + .on('ifChanged', iCheckChange);
  184 + if (pagination && data.dataList.length > 0) {
  185 + //重新分页
  186 + initPagination = true;
  187 + showPagination(data);
  188 + $('#pagination').show();
  189 + } else if(data.dataList.length == 0){
  190 + $('#pagination').hide();
  191 + }
  192 +
  193 + layer.close(j);
  194 +
  195 + });
  196 + }
  197 +
  198 + function getParams(){
  199 + var dateS = $("#dateS").val();
  200 + var dateE = $("#dateE").val();
  201 + if(dateS==""||dateS==null||dateE==""||dateE==null){
  202 + layer.msg('请选择日期.');
  203 + return;
  204 + }
  205 + dateS+="-01"
  206 + dateE+="-31"
  207 + var params = {'dateS':dateS,'dateE':dateE};
  208 + return params;
  209 + };
  210 +
  211 + //分页插件
  212 + var page = 0, initPagination;
  213 + function showPagination(data) {
  214 + console.log(data.totalPages);
  215 + //分页
  216 + $('#pagination').jqPaginator({
  217 + totalPages: data.totalPages,
  218 + visiblePages: 6,
  219 + currentPage: page + 1,
  220 + first: '<li class="first"><a href="javascript:void(0);">首页<\/a><\/li>',
  221 + prev: '<li class="prev"><a href="javascript:void(0);">上一页<\/a><\/li>',
  222 + next: '<li class="next"><a href="javascript:void(0);">下一页<\/a><\/li>',
  223 + last: '<li class="last"><a href="javascript:void(0);">尾页<\/a><\/li>',
  224 + page: '<li class="page"><a href="javascript:void(0);">{{page}}<\/a><\/li>',
  225 + onPageChange: function (num, type) {
  226 + if (initPagination) {
  227 + initPagination = false;
  228 + return;
  229 + }
  230 +
  231 + var params = getParams();
  232 +
  233 + page = num - 1;
  234 + jsDoQuery(params, true);
  235 + }
  236 + });
  237 + }
  238 +
  239 + function iCheckChange() {
  240 + var tr = $(this).parents('tr');
  241 + if (this.checked)
  242 + tr.addClass('row-active');
  243 + else
  244 + tr.removeClass('row-active');
  245 + }
  246 +
  247 +
  248 + //导入
  249 + $("#upload").on("click", function(){
  250 + $.get('upload.html', function(m){$(pjaxContainer).append(m);});
  251 + });
  252 +
  253 + //导出
  254 + $("#export").on("click", function () {
  255 + var params = getParams();
  256 + params["type"] = "export";
  257 + $get('/xlybtb/query', params, function (result) {
  258 + console.log(result);
  259 + if(result.code=='00'){
  260 + window.open("/downloadFile/download?fileName=路线生产月报同比表" /*+ moment($("#rq").val()).format("YYYYMMDD")*/);
  261 + }else {
  262 + alert(result.msg);
  263 + }
  264 +
  265 + });
  266 + });
  267 +
  268 +
  269 +
  270 + });
  271 +
  272 +</script>
  273 +
  274 +<script id="xlybtb_list" type="text/html">
  275 + {{each list as obj i}}
  276 + <tr>
  277 + <td>{{obj.xl}}</td>
  278 + <td>{{obj.xlcd}}</td>
  279 +
  280 + <td>{{obj.rcjh}}</td>
  281 + <td>{{obj.rcsj}}</td>
  282 + <td>{{obj.rctq}}</td>
  283 + <td>{{obj.rctb}}</td>
  284 + <td>{{obj.rcjhwc}}</td>
  285 +
  286 + <td>{{obj.ysjh}}</td>
  287 + <td>{{obj.yssj}}</td>
  288 + <td>{{obj.ystq}}</td>
  289 + <td>{{obj.ystb}}</td>
  290 + <td>{{obj.ysybgl}}</td>
  291 + <td>{{obj.ysjhwc}}</td>
  292 +
  293 + <td>{{obj.lcjh}}</td>
  294 + <td>{{obj.lccy}}</td>
  295 + <td>{{obj.lccd}}</td>
  296 + <td>{{obj.lcqrl}}</td>
  297 + <td>{{obj.lctq}}</td>
  298 + <td>{{obj.lctb}}</td>
  299 + <td>{{obj.lcjhwc}}</td>
  300 +
  301 + <td>{{obj.bcjh}}</td>
  302 + <td>{{obj.bcsj}}</td>
  303 + <td>{{obj.bctq}}</td>
  304 + <td>{{obj.bctb}}</td>
  305 + <td>{{obj.bcjhwc}}</td>
  306 +
  307 + <td>{{obj.kssj}}</td>
  308 + <td>{{obj.kstq}}</td>
  309 + <td>{{obj.kstb}}</td>
  310 + </tr>
  311 + {{/each}}
  312 + {{if list.length == 0}}
  313 + <tr>
  314 + <td colspan=9><h6 class="muted">没有找到相关数据</h6></td>
  315 + </tr>
  316 + {{/if}}
  317 +</script>
0 \ No newline at end of file 318 \ No newline at end of file
src/main/resources/static/pages/report/xlybtz/list.html 0 → 100644
  1 +<style>
  2 +.blue{
  3 + background-color: #87CEFF
  4 +}
  5 +</style>
  6 +<div class="page-head">
  7 + <div class="page-title">
  8 + <h1>路线生产月报台账</h1>
  9 + </div>
  10 +</div>
  11 +<ul class="page-breadcrumb breadcrumb">
  12 + <li><a href="/pages/home.html" data-pjax>首页</a> <i class="fa fa-circle"></i></li>
  13 + <li><span class="active">报表管理</span> <i class="fa fa-circle"></i></li>
  14 + <li><span class="active">路线生产月报台账</span></li>
  15 +</ul>
  16 +
  17 +<div class="row">
  18 + <div class="col-md-12">
  19 + <div class="portlet light porttlet-fit bordered">
  20 + <div class="portlet-title">
  21 + <form class="form-inline" action="">
  22 + <!-- <div style="display: inline-block;">
  23 + <span class="item-label" style="width: 80px;">线路: </span>
  24 + <select class="form-control" name="line" id="line" style="width: 180px;"></select>
  25 + </div>-->
  26 + <div style="display: inline-block;margin-left: 15px;">
  27 + <span class="item-label" style="width: 80px;">开始时间: </span>
  28 + <input class="form-control" type="text" id="dateS" style="width: 180px;"/>
  29 + <span class="item-label" style="width: 80px;">结束时间: </span>
  30 + <input class="form-control" type="text" id="dateE" style="width: 180px;"/>
  31 + <!--<input class="btn btn-default" type="button" id="czcl" value="X"/>-->
  32 + </div>
  33 + <div class="form-group">
  34 + <input class="btn btn-default" type="button" id="query" value="筛选"/>
  35 + </div>
  36 + <div class="form-group" style="float:right;">
  37 + <button type="button" class="btn btn-circle blue" id="upload"><i class="fa fa-file-excel-o"></i>
  38 + 导入Excel
  39 + </button>
  40 + <button type="button" class="btn btn-circle blue" id="export"><i class="fa fa-file-excel-o"></i>
  41 + 生成台账
  42 + </button>
  43 + </div>
  44 + </form>
  45 + </div>
  46 + <div class="portlet-body">
  47 + <div class="table-container" style="margin-top: 10px;overflow:auto;min-width: 906px">
  48 + <table class="table table-striped table-bordered table-hover table-checkable" id="datatable_xlybtz">
  49 + <thead>
  50 + <tr>
  51 + <th>序号</th>
  52 + <th>日期</th>
  53 + <th>车队</th>
  54 + <th>线路名</th>
  55 + <th>人次</th>
  56 + <th>金额</th>
  57 + <th>支付方式</th>
  58 + </tr>
  59 + </thead>
  60 + <tbody>
  61 + </tbody>
  62 + </table>
  63 + <div style="text-align: right;">
  64 + <ul id="pagination" class="pagination"></ul>
  65 + </div>
  66 + </div>
  67 + </div>
  68 + </div>
  69 + </div>
  70 +</div>
  71 +
  72 +<script src="/assets/js/ajaxfileupload/ajaxfileupload.js"></script>
  73 +<script>
  74 + $(function () {
  75 + //日期插件
  76 + $("#dateS").datetimepicker({
  77 + format : 'YYYY-MM',
  78 + locale : 'zh-cn'
  79 + });
  80 + $("#dateE").datetimepicker({
  81 + format : 'YYYY-MM',
  82 + locale : 'zh-cn'
  83 + });
  84 + //线路下拉列表
  85 + $.get('/report/lineList',function(xlList){
  86 + var data = [];
  87 + data.push({id: " ", text: "全部线路"});
  88 + $.get('/user/companyData', function(result){
  89 + for(var i = 0; i < result.length; i++){
  90 + var companyCode = result[i].companyCode;
  91 + var children = result[i].children;
  92 + for(var j = 0; j < children.length; j++){
  93 + var code = children[j].code;
  94 + for(var k=0;k < xlList.length;k++ ){
  95 + if(xlList[k]["fgsbm"]==code && xlList[k]["gsbm"]==companyCode){
  96 + data.push({id: xlList[k]["xlbm"], text: xlList[k]["xlname"]});
  97 + }
  98 + }
  99 + }
  100 + }
  101 + initPinYinSelect2('#line',data,'');
  102 + });
  103 + });
  104 + //重置
  105 + $('#czcl').on('click', function () {
  106 + $('#code').val('').change();
  107 + });
  108 +
  109 + $("#query").on("click",function(){
  110 +
  111 + var params =getParams();
  112 + page = 0;
  113 + jsDoQuery(params, true);
  114 + });
  115 +
  116 +
  117 + // 关闭左侧栏
  118 + if (!$('body').hasClass('page-sidebar-closed'))
  119 + $('.menu-toggler.sidebar-toggler').click();
  120 +
  121 + var icheckOptions = {
  122 + radioClass: 'iradio_square-blue icheck',
  123 + increaseArea: '20%'
  124 + }
  125 +
  126 + /*
  127 + * 获取数据 p: 要提交的参数, pagination: 是否重新分页
  128 + */
  129 + function jsDoQuery(params, pagination) {
  130 + params['page'] = page;
  131 +
  132 + var j = layer.load(2);
  133 + $get('/xlybtz/query', params, function (data) {
  134 + $.each(data.dataList, function (i, obj) {
  135 + obj.date = moment(obj.date).format("YYYY-MM-DD");
  136 + });
  137 + var bodyHtm = template('xlybtz_list', {list:data.dataList});
  138 + $('#datatable_xlybtz tbody').html(bodyHtm)
  139 + .find('.icheck').iCheck(icheckOptions)
  140 + .on('ifChanged', iCheckChange);
  141 + if (pagination && data.dataList.length > 0) {
  142 + //重新分页
  143 + initPagination = true;
  144 + showPagination(data);
  145 + $('#pagination').show();
  146 + } else if(data.dataList.length == 0){
  147 + $('#pagination').hide();
  148 + }
  149 +
  150 + layer.close(j);
  151 +
  152 + /*startOptJzylLink($('#ll_oil_list .in_carpark_jzyl'));*/
  153 + });
  154 + }
  155 +
  156 + function getParams(){
  157 + var dateS = $("#dateS").val();
  158 + var dateE = $("#dateE").val();
  159 + if(dateS==""||dateS==null||dateE==""||dateE==null){
  160 + layer.msg('请选择日期.');
  161 + return;
  162 + }
  163 + dateS+="-01"
  164 + dateE+="-31"
  165 + var params = {'dateS':dateS,'dateE':dateE};
  166 + return params;
  167 + };
  168 +
  169 + //分页插件
  170 + var page = 0, initPagination;
  171 + function showPagination(data) {
  172 + console.log(data.totalPages);
  173 + //分页
  174 + $('#pagination').jqPaginator({
  175 + totalPages: data.totalPages,
  176 + visiblePages: 6,
  177 + currentPage: page + 1,
  178 + first: '<li class="first"><a href="javascript:void(0);">首页<\/a><\/li>',
  179 + prev: '<li class="prev"><a href="javascript:void(0);">上一页<\/a><\/li>',
  180 + next: '<li class="next"><a href="javascript:void(0);">下一页<\/a><\/li>',
  181 + last: '<li class="last"><a href="javascript:void(0);">尾页<\/a><\/li>',
  182 + page: '<li class="page"><a href="javascript:void(0);">{{page}}<\/a><\/li>',
  183 + onPageChange: function (num, type) {
  184 + if (initPagination) {
  185 + initPagination = false;
  186 + return;
  187 + }
  188 +
  189 + var params = getParams();
  190 +
  191 + page = num - 1;
  192 + jsDoQuery(params, true);
  193 + }
  194 + });
  195 + }
  196 +
  197 + function iCheckChange() {
  198 + var tr = $(this).parents('tr');
  199 + if (this.checked)
  200 + tr.addClass('row-active');
  201 + else
  202 + tr.removeClass('row-active');
  203 + }
  204 +
  205 + /* $("#export").on("click",function(){
  206 + var type = "export";
  207 + $get('/realSchedule/account', {line:line,date:date,code:code,xlName:xlName,type:type}, function(result){
  208 + window.open("/downloadFile/download?fileName="
  209 + +moment(date).format("YYYYMMDD")
  210 + +"-"+xlName+"-驾驶员请求台账");
  211 + });
  212 + });*/
  213 +
  214 + //导入
  215 + $("#upload").on("click", function(){
  216 + $.get('upload.html', function(m){$(pjaxContainer).append(m);});
  217 + });
  218 +
  219 + //导出
  220 + $("#export").on("click", function () {
  221 + var params = getParams();
  222 + params["type"] = "export";
  223 + $get('/xlybtz/query', params, function (result) {
  224 + console.log(result);
  225 + if(result.code=='00'){
  226 + window.open("/downloadFile/download?fileName=路线生产月报台账" /*+ moment($("#rq").val()).format("YYYYMMDD")*/);
  227 + }else {
  228 + alert(result.msg);
  229 + }
  230 +
  231 + });
  232 + });
  233 +
  234 +
  235 +
  236 + });
  237 +
  238 +</script>
  239 +
  240 +<script id="xlybtz_list" type="text/html">
  241 + {{each list as obj i}}
  242 + <tr>
  243 + <td style="vertical-align: middle;">
  244 + {{i + 1}}
  245 + </td>
  246 + <td>{{obj.date}}</td>
  247 + <td>{{obj.convoy}}</td>
  248 + <td>{{obj.lineName}}</td>
  249 + <td>{{obj.count}}</td>
  250 + <td>{{obj.amount}}</td>
  251 + <td>{{obj.payType}}</td>
  252 + </tr>
  253 + {{/each}}
  254 + {{if list.length == 0}}
  255 + <tr>
  256 + <td colspan=9><h6 class="muted">没有找到相关数据</h6></td>
  257 + </tr>
  258 + {{/if}}
  259 +</script>
0 \ No newline at end of file 260 \ No newline at end of file
src/main/resources/static/pages/report/xlybtz/upload.html 0 → 100644
  1 +<div class="modal fade" id="uploadFile" tabindex="-1" role="basic"
  2 + aria-hidden="true">
  3 + <div class="modal-dialog">
  4 + <div class="modal-content">
  5 + <div class="modal-header">
  6 + <button type="button" class="close" data-dismiss="modal"
  7 + aria-hidden="true"></button>
  8 + <h4 class="modal-title">导入Excel</h4>
  9 + </div>
  10 + <div class="modal-body">
  11 + <form class="form-horizontal" role="form" id="excelFile" method="post"
  12 + action="" enctype="multipart/form-data">
  13 + <input type="hidden" name="groupType" value="3">
  14 + <div class="alert alert-danger display-hide">
  15 + <button class="close" data-close="alert"></button>
  16 + 您的输入有误,请检查下面的输入项
  17 + </div>
  18 + <div class="form-body">
  19 + <div class="form-group">
  20 + <label class="col-md-3 control-label">选择日期</label>
  21 + <div class="col-md-3">
  22 + <input class="form-control" type="text" id="date" style="width: 180px;"/>
  23 + </div>
  24 + </div>
  25 + <div class="form-group">
  26 + <label class="col-md-3 control-label">选择类型</label>
  27 + <div class="col-md-3">
  28 + <select class="form-control" name="reportType" id="reportType" >
  29 + <option value="1">票务</option>
  30 + <option value="2">二维码</option>
  31 + <option value="3">申城通</option>
  32 + <option value="4">实体卡</option>
  33 + <option value="5">保通卡</option>
  34 + </select>
  35 + </div>
  36 + </div>
  37 + <div class="form-group">
  38 + <label class="col-md-3 control-label">选择文件</label>
  39 + <div class="col-md-9">
  40 + <input type="file" name="file" id="file" accept="application/vnd.ms-excel"/>
  41 + </div>
  42 + </div>
  43 + </div>
  44 + </form>
  45 + </div>
  46 + <div class="modal-footer">
  47 + <!--<button type="button" class="btn default" id="downLoad">下载模板</button>-->
  48 + <button type="button" class="btn default" data-dismiss="modal">取消</button>
  49 + <button type="button" class="btn btn-primary" id="submit">确认导入</button>
  50 + </div>
  51 + </div>
  52 + </div>
  53 +</div>
  54 +<script id="res_tbody_temp" type="text/html">
  55 +
  56 +</script>
  57 +<script data-exclude=1>
  58 + $(function() {
  59 + //日期插件
  60 + var d = new Date();
  61 + var year = d.getFullYear();
  62 + var month = d.getMonth() + 1;
  63 + var day = d.getDate();
  64 + if(month < 10)
  65 + month = "0" + month;
  66 + if(day < 10)
  67 + day = "0" + day;
  68 + var dateTime = year + "-" + month + "-" + day;
  69 + $("#date").datetimepicker({
  70 + format : 'YYYY-MM-DD',
  71 + locale : 'zh-cn',
  72 + maxDate : dateTime
  73 + });
  74 + $("#date").val(dateTime);
  75 + //modal 显示事件
  76 + $('#uploadFile').on('show.bs.modal', function(){}).modal('show');
  77 + $('#submit').on('click', function() {
  78 + layer.confirm('若已导入将覆盖原数据!', {
  79 + btn : [ '确认提交', '取消' ]
  80 + },function () {
  81 + layer.close(layer.index);
  82 + var j = layer.load(2);
  83 + var reportType=$('#reportType').val();
  84 + var date = $("#date").val();
  85 + if(date==""||date==null){
  86 + layer.msg('请选择日期.');
  87 + return;
  88 + }
  89 + var param = {'reportType':reportType,'date':date};
  90 + param.uploadDir = 'upload';
  91 + $.ajaxFileUpload({
  92 + url : '/xlybtz/uploadFile',
  93 + secureuri : false,
  94 + fileElementId : 'file',
  95 + dataType : 'json',
  96 + data : param,
  97 + success : function(data) {
  98 + layer.close(j);
  99 + alert(data.result);
  100 + $('#uploadFile').modal('hide');
  101 + $('tr.filter .filter-submit').click();
  102 + },
  103 + error : function(data, status, e) {
  104 + console.log(data);
  105 + layer.close(j);
  106 + alert("文件导入失败");
  107 + }
  108 + })
  109 + });
  110 + });
  111 +
  112 + $('#downLoad').on('click', function(){
  113 + window.open("/downloadFile/downloadModel?fileName=票务数据导入模板");
  114 + });
  115 + });
  116 +</script>
0 \ No newline at end of file 117 \ No newline at end of file
src/main/resources/static/pages/scheduleApp/module/basicInfo/busInfoManage/detail.html
@@ -283,6 +283,20 @@ @@ -283,6 +283,20 @@
283 </div> 283 </div>
284 </div> 284 </div>
285 285
  286 + <div class="form-group">
  287 + <label class="col-md-2 control-label">是否混合电车:</label>
  288 + <div class="col-md-3">
  289 + <sa-Radiogroup model="ctrl.busInfoForDetail.sfmix" disabled="true" dicgroup="truefalseType" name="sfmix"></sa-Radiogroup>
  290 + </div>
  291 + </div>
  292 +
  293 + <div class="form-group">
  294 + <label class="col-md-2 control-label">是否氢能源车:</label>
  295 + <div class="col-md-3">
  296 + <sa-Radiogroup model="ctrl.busInfoForDetail.hydrogen" disabled="true" dicgroup="truefalseType" name="hydrogen"></sa-Radiogroup>
  297 + </div>
  298 + </div>
  299 +
286 300
287 <div class="form-group"> 301 <div class="form-group">
288 <label class="col-md-2 control-label">备注:</label> 302 <label class="col-md-2 control-label">备注:</label>
src/main/resources/static/pages/scheduleApp/module/basicInfo/busInfoManage/edit.html
@@ -456,6 +456,13 @@ @@ -456,6 +456,13 @@
456 </div> 456 </div>
457 457
458 <div class="form-group"> 458 <div class="form-group">
  459 + <label class="col-md-2 control-label">是否氢能源车:</label>
  460 + <div class="col-md-3">
  461 + <sa-Radiogroup model="ctrl.busInfoForSave.hydrogen" dicgroup="truefalseType" name="hydrogen"></sa-Radiogroup>
  462 + </div>
  463 + </div>
  464 +
  465 + <div class="form-group">
459 <label class="col-md-2 control-label">备注:</label> 466 <label class="col-md-2 control-label">备注:</label>
460 <div class="col-md-10"> 467 <div class="col-md-10">
461 <textarea rows="3" class="form-control" name="descriptions" 468 <textarea rows="3" class="form-control" name="descriptions"
src/main/resources/static/pages/scheduleApp/module/basicInfo/busInfoManage/form.html
@@ -448,6 +448,13 @@ @@ -448,6 +448,13 @@
448 </div> 448 </div>
449 449
450 <div class="form-group"> 450 <div class="form-group">
  451 + <label class="col-md-2 control-label">是否氢能源车:</label>
  452 + <div class="col-md-3">
  453 + <sa-Radiogroup model="ctrl.busInfoForSave.hydrogen" dicgroup="truefalseType" name="hydrogen"></sa-Radiogroup>
  454 + </div>
  455 + </div>
  456 +
  457 + <div class="form-group">
451 <label class="col-md-2 control-label">备注:</label> 458 <label class="col-md-2 control-label">备注:</label>
452 <div class="col-md-10"> 459 <div class="col-md-10">
453 <textarea rows="3" class="form-control" name="descriptions" 460 <textarea rows="3" class="form-control" name="descriptions"