Commit abb80d72be6d60d8df72e983957e2ba00a42fa0b

Authored by yiming
1 parent 7f44aa98

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

Showing 34 changed files with 4414 additions and 52 deletions

Too many changes to show.

To preserve performance only 34 of 56 files are displayed.

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 1 package com.bsth.controller.oil;
2 2  
  3 +import java.io.File;
3 4 import java.util.HashMap;
4 5 import java.util.List;
5 6 import java.util.Map;
6 7  
  8 +import com.google.common.io.Files;
7 9 import org.springframework.beans.factory.annotation.Autowired;
8 10 import org.springframework.web.bind.annotation.RequestMapping;
9 11 import org.springframework.web.bind.annotation.RequestMethod;
... ... @@ -14,6 +16,7 @@ import com.bsth.controller.BaseController;
14 16 import com.bsth.entity.oil.Ylxxb;
15 17 import com.bsth.service.oil.YlxxbService;
16 18 import com.bsth.util.PageObject;
  19 +import org.springframework.web.multipart.MultipartFile;
17 20  
18 21 @RestController
19 22 @RequestMapping("ylxxb")
... ... @@ -76,5 +79,24 @@ public class YlxxbController extends BaseController&lt;Ylxxb, Integer&gt;{
76 79 }
77 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 3 import com.bsth.data.gpsdata_v2.cache.GeoCacheData;
4 4 import com.bsth.data.pinyin.PersionPinYinBuffer;
5 5 import com.bsth.entity.*;
  6 +import com.bsth.entity.report.LineCompare;
6 7 import com.bsth.entity.schedule.CarConfigInfo;
7 8 import com.bsth.repository.*;
8 9 import com.bsth.repository.schedule.CarConfigInfoRepository;
  10 +import com.bsth.repository.ticket.LineCompareRepository;
9 11 import com.google.common.collect.BiMap;
10 12 import com.google.common.collect.HashBiMap;
11 13 import org.apache.commons.lang3.StringUtils;
... ... @@ -45,6 +47,9 @@ public class BasicData {
45 47 //车辆自编号和牌照号对照 (K: 车辆自编号 ,V:牌照号)
46 48 public static Map<String, String> nbbmCompanyPlateMap;
47 49  
  50 + //牌照号和车辆自编号对照 (K: 牌照号 ,V:车辆自编号)
  51 + public static Map<String, String> plate2NbbmMap;
  52 +
48 53 //站点编码和名称对照,包括停车场 (K: lineCode_updown_stationCode ,V:站点名称)
49 54 public static Map<String, String> stationCode2NameMap;
50 55  
... ... @@ -58,6 +63,8 @@ public class BasicData {
58 63 public static Map<String, String> lineCode2NameMap;
59 64  
60 65 public static Map<String, String> lineCodeAllNameMap;
  66 + //名称和线路编码对照
  67 + public static Map<String, String> Name2LineCodeMap;
61 68 //停车场
62 69 public static List<String> parkCodeList;
63 70  
... ... @@ -79,6 +86,12 @@ public class BasicData {
79 86 //站点名和运管处编号 对照
80 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 95 public static List<WhiteIp> whiteIpList;
83 96  
84 97 private static Map<String, SystemParam> key2param = new HashMap<>();
... ... @@ -141,6 +154,9 @@ public class BasicData {
141 154 @Autowired
142 155 private SystemParamRepository systemParamRepository;
143 156  
  157 + @Autowired
  158 + private LineCompareRepository lineCompareRepository;
  159 +
144 160 @Override
145 161 public void run() {
146 162 loadAllData();
... ... @@ -170,6 +186,7 @@ public class BasicData {
170 186 geoCacheData.loadData();
171 187 station2ParkBuffer.saveAll();
172 188 loadSystemParam();
  189 + loadLineCompare();
173 190 logger.info("加载基础数据成功!,");
174 191 } catch (Exception e) {
175 192 logger.error("加载基础数据时出现异常,", e);
... ... @@ -208,7 +225,8 @@ public class BasicData {
208 225  
209 226 //车辆自编号和拍照号对照
210 227 Map<String, String> nbbmCompanyPlate = new HashMap<>();
211   -
  228 + //车辆自编号和拍照号对照
  229 + Map<String, String> plate2nbbm = new HashMap<>();
212 230 Iterator<Cars> carIterator = carsRepository.findAll().iterator();
213 231 Cars car;
214 232 while (carIterator.hasNext()) {
... ... @@ -217,12 +235,14 @@ public class BasicData {
217 235 nbbm2CompanyCode.put(car.getInsideCode(), car.getBusinessCode());
218 236 nbbm2FgsCompanyCode.put(car.getInsideCode(), car.getBrancheCompanyCode() + "_" + car.getBusinessCode() );
219 237 nbbmCompanyPlate.put(car.getInsideCode(), car.getCarPlate());
  238 + plate2nbbm.put(car.getCarPlate(),car.getInsideCode());
220 239 }
221 240  
222 241 deviceId2NbbmMap = deviceId2Nbbm;
223 242 nbbm2CompanyCodeMap = nbbm2CompanyCode;
224 243 nbbm2FgsCompanyCodeMap = nbbm2FgsCompanyCode;
225 244 nbbmCompanyPlateMap =nbbmCompanyPlate;
  245 + plate2NbbmMap=plate2nbbm;
226 246 }
227 247  
228 248 /**
... ... @@ -285,7 +305,7 @@ public class BasicData {
285 305 Map<Integer, String> id2SHcode = new HashMap<Integer, String>();
286 306 Map<String, String> code2SHcode = new HashMap<String, String>();
287 307 Map<String, Integer> tempStationName2YgcNumber = new HashMap<String, Integer>();
288   -
  308 + Map<String, String> name2code = new HashMap<>();
289 309 /**
290 310 * 加载运管处的站点及序号
291 311 * 上行从1开始,下行顺序续编
... ... @@ -317,6 +337,7 @@ public class BasicData {
317 337 code2name.put(line.getLineCode(), line.getName());
318 338 id2SHcode.put(line.getId(), line.getShanghaiLinecode());
319 339 code2SHcode.put(line.getLineCode(), line.getShanghaiLinecode());
  340 + name2code.put(line.getName(), line.getLineCode());
320 341 }
321 342  
322 343 // 特殊线路ID为0的数据 (小模块轨迹)
... ... @@ -328,6 +349,7 @@ public class BasicData {
328 349 lineId2ShangHaiCodeMap = id2SHcode;
329 350 lineCode2ShangHaiCodeMap = code2SHcode;
330 351 stationName2YgcNumber = tempStationName2YgcNumber;
  352 + Name2LineCodeMap =name2code;
331 353  
332 354 Map<String, String> code2nameAll = new HashMap<>();
333 355 Iterator<Line> iteratorAll = lineRepository.findAll().iterator();
... ... @@ -393,6 +415,22 @@ public class BasicData {
393 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 436 @Component
... ...
src/main/java/com/bsth/entity/Cars.java
... ... @@ -128,6 +128,8 @@ public class Cars extends BEntity implements Serializable {
128 128 private Boolean sfdc;
129 129 /** 是否混合动力(TODO:在原系统里没有,这里暂时留着) */
130 130 private Boolean sfmix;
  131 + /** 是否氢能源车 */
  132 + private Boolean hydrogen;
131 133 /** 备注/描述 */
132 134 private String descriptions;
133 135  
... ... @@ -452,6 +454,9 @@ public class Cars extends BEntity implements Serializable {
452 454 }
453 455  
454 456 public Boolean getSfdc() {
  457 + if(sfdc==null){
  458 + sfdc=false;
  459 + }
455 460 return sfdc;
456 461 }
457 462  
... ... @@ -516,10 +521,24 @@ public class Cars extends BEntity implements Serializable {
516 521 }
517 522  
518 523 public Boolean getSfmix() {
  524 + if(sfmix==null){
  525 + sfmix=false;
  526 + }
519 527 return sfmix;
520 528 }
521 529  
522 530 public void setSfmix(Boolean sfmix) {
523 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 1 package com.bsth.entity.oil;
2 2  
  3 +import java.text.SimpleDateFormat;
3 4 import java.util.Date;
4 5  
5 6 import javax.persistence.Entity;
... ... @@ -28,7 +29,8 @@ public class Jdl {
28 29 private String remarks;
29 30 @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
30 31 private Date createrDate;
31   -
  32 + private String rqStr;
  33 + private String plate;
32 34  
33 35 public Integer getId() {
34 36 return id;
... ... @@ -102,7 +104,17 @@ public class Jdl {
102 104 public void setJsy(String jsy) {
103 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 1 package com.bsth.entity.oil;
2 2  
  3 +import java.text.SimpleDateFormat;
3 4 import java.util.Date;
4 5  
5 6 import javax.persistence.Entity;
... ... @@ -48,8 +49,10 @@ public class Ylxxb {
48 49 private String linename;
49 50 @Transient
50 51 private Double zjzl;
51   -
52   -
  52 +
  53 + private String yh;
  54 +
  55 +
53 56 public Integer getId() {
54 57 return id;
55 58 }
... ... @@ -200,7 +203,17 @@ public class Ylxxb {
200 203 public void setLinename(String linename) {
201 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 31 List<LineInformation> findByLine(List<String> lineCodes);
32 32  
33 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 17 @Transactional
18 18 @Modifying
19 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 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 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 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 35  
36 36 @Transactional
37 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 29 @Query(value="select * from bsth_c_ylxxb s where s.nbbm = ?1 and "
30 30 + "s.yyrq=?2",nativeQuery=true)
31 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 1 package com.bsth.service.oil;
2 2  
  3 +import java.io.File;
3 4 import java.util.List;
4 5 import java.util.Map;
5 6  
... ... @@ -17,4 +18,8 @@ public interface YlxxbService extends BaseService&lt;Ylxxb, Integer&gt;{
17 18  
18 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 2  
3 3 import java.io.File;
4 4 import java.io.FileInputStream;
  5 +import java.sql.PreparedStatement;
  6 +import java.sql.SQLException;
5 7 import java.text.DecimalFormat;
6 8 import java.text.SimpleDateFormat;
  9 +import java.time.LocalDate;
  10 +import java.time.format.DateTimeFormatter;
7 11 import java.util.ArrayList;
8 12 import java.util.Date;
9 13 import java.util.HashMap;
... ... @@ -11,12 +15,16 @@ import java.util.Iterator;
11 15 import java.util.List;
12 16 import java.util.Map;
13 17  
  18 +import com.bsth.entity.report.Ticket;
14 19 import org.apache.poi.hssf.usermodel.HSSFCell;
15 20 import org.apache.poi.hssf.usermodel.HSSFRow;
16 21 import org.apache.poi.hssf.usermodel.HSSFSheet;
17 22 import org.apache.poi.hssf.usermodel.HSSFWorkbook;
18 23 import org.apache.poi.poifs.filesystem.POIFSFileSystem;
19 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 28 import org.springframework.stereotype.Service;
21 29  
22 30 import com.bsth.entity.oil.Jdl;
... ... @@ -24,6 +32,10 @@ import com.bsth.repository.oil.JdlRepository;
24 32 import com.bsth.service.impl.BaseServiceImpl;
25 33 import com.bsth.service.oil.JdlService;
26 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 40 @Service
29 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 43 @Autowired
32 44 JdlRepository repository;
33 45  
  46 + @Autowired
  47 + JdbcTemplate jdbcTemplate;
  48 +
  49 + @Autowired
  50 + private TransactionTemplate transactionTemplate;
  51 +
34 52 @Override
35 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 58 SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
37 59 SimpleDateFormat sd = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
38 60 DecimalFormat df = new DecimalFormat("######0.00");
... ... @@ -41,6 +63,19 @@ public class JdlServiceImpl extends BaseServiceImpl&lt;Jdl, Integer&gt; implements Jdl
41 63 POIFSFileSystem fs = new POIFSFileSystem(new FileInputStream(file));
42 64 HSSFWorkbook wb = new HSSFWorkbook(fs);
43 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 80 int rowNum = sheet.getLastRowNum() + 1;
46 81 // 取得总列数
... ... @@ -59,7 +94,15 @@ public class JdlServiceImpl extends BaseServiceImpl&lt;Jdl, Integer&gt; implements Jdl
59 94 text += ",";
60 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 104 text += String.valueOf(cell) + ",";
  105 + }
63 106 }
64 107 String[] split = (text+";").split(",");
65 108 String str = "";
... ... @@ -70,29 +113,68 @@ public class JdlServiceImpl extends BaseServiceImpl&lt;Jdl, Integer&gt; implements Jdl
70 113 continue;
71 114 textList.add(text + ";");
72 115 }
  116 + String rq = y+"-"+m+"-"+"01";//日期
  117 + List<Jdl> jdlList=new ArrayList<>();
73 118 for(int i = 0; i < textList.size(); i++){
74 119 String text = textList.get(i);
75 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 178 wb.close();
97 179 fs.close();
98 180 } catch (Exception e) {
... ... @@ -108,13 +190,15 @@ public class JdlServiceImpl extends BaseServiceImpl&lt;Jdl, Integer&gt; implements Jdl
108 190 @Override
109 191 public Map<String, Object> query(Map<String, Object> map) {
110 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 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 203 if(!map.containsKey("type")){
120 204  
... ... @@ -133,11 +217,12 @@ public class JdlServiceImpl extends BaseServiceImpl&lt;Jdl, Integer&gt; implements Jdl
133 217 m.put("nbbm", jdl.getNbbm());
134 218 m.put("jdl", jdl.getJdl());
135 219 m.put("jdz", jdl.getJdz());
  220 + m.put("plate", jdl.getPlate());
136 221 m.put("remarks", jdl.getRemarks());
137 222 list.add(m);
138 223 }
139 224  
140   - List<Iterator<?>> listI = new ArrayList<Iterator<?>>();
  225 + /* List<Iterator<?>> listI = new ArrayList<Iterator<?>>();
141 226 Map<String, Object> m = new HashMap<String, Object>();
142 227 ReportUtils ee = new ReportUtils();
143 228 try {
... ... @@ -148,9 +233,9 @@ public class JdlServiceImpl extends BaseServiceImpl&lt;Jdl, Integer&gt; implements Jdl
148 233 } catch (Exception e) {
149 234 // TODO: handle exception
150 235 e.printStackTrace();
151   - }
  236 + }*/
152 237 }
153 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 1 package com.bsth.service.oil.impl;
2 2  
  3 +import java.io.File;
  4 +import java.io.FileInputStream;
3 5 import java.sql.ResultSet;
4 6 import java.sql.SQLException;
5 7 import java.text.DecimalFormat;
6 8 import java.text.ParseException;
7 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 12 import javax.transaction.Transactional;
15 13  
  14 +import com.bsth.entity.oil.Jdl;
  15 +import com.bsth.util.ReportUtils;
16 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 22 import org.slf4j.Logger;
18 23 import org.slf4j.LoggerFactory;
19 24 import org.springframework.beans.factory.annotation.Autowired;
  25 +import org.springframework.jdbc.core.BeanPropertyRowMapper;
20 26 import org.springframework.jdbc.core.JdbcTemplate;
21 27 import org.springframework.jdbc.core.RowMapper;
22 28 import org.springframework.stereotype.Service;
... ... @@ -49,6 +55,10 @@ public class YlxxbServiceImpl extends BaseServiceImpl&lt;Ylxxb,Integer&gt; implements
49 55 YlbRepository ylbRepository;
50 56 @Autowired
51 57 JdbcTemplate jdbcTemplate;
  58 +
  59 + @Autowired
  60 + YlxxbRepository ylxxbRepository;
  61 +
52 62 @Override
53 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 297 }
288 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 +
... ...