Commit 3756d5fe4b47b4a2b8c92b0a1c60a09448fce9d8

Authored by 廖磊
1 parent b650a337

班次到离站的站点搜索,油耗计算带上线路条件,添加场外加油设置时候验证车辆重复,路单

数据查询所有时候公里计算
src/main/java/com/bsth/controller/oil/CwjyController.java
... ... @@ -33,6 +33,11 @@ public class CwjyController extends BaseController<Cwjy, Integer>{
33 33 return service.save(t);
34 34 }
35 35  
  36 + @RequestMapping(value = "/checkNbbm",method = RequestMethod.GET)
  37 + public int checkNbbm(Cwjy t){
  38 + return service.checkNbbm(t.getNbbm().trim());
  39 + }
  40 +
36 41 @RequestMapping(value = "/queryList",method = RequestMethod.GET)
37 42 public List<Ylxxb> queryList(@RequestParam Map<String, Object> map){
38 43 List<Ylxxb> pagequery=null;
... ...
src/main/java/com/bsth/controller/report/ReportController.java
... ... @@ -185,8 +185,8 @@ public class ReportController {
185 185 return new ArrayList<Map<String, Object>>();
186 186 }
187 187 @RequestMapping(value = "/sreachZd", method = RequestMethod.GET)
188   - public List<Map<String, String>> sreachPersonnel(@RequestParam String line,@RequestParam int zdlx,@RequestParam String zd) {
189   - return service.sreachZd(line,zdlx, zd);
  188 + public List<Map<String, String>> sreachPersonnel(@RequestParam String line,@RequestParam int zdlx) {
  189 + return service.sreachZd(line,zdlx);
190 190 }
191 191  
192 192  
... ...
src/main/java/com/bsth/repository/oil/YlbRepository.java
... ... @@ -56,6 +56,11 @@ public interface YlbRepository extends BaseRepository&lt;Ylb, Integer&gt;{
56 56 + " and xlbm like %?4% and nbbm like %?5% order by ?6 asc ",nativeQuery=true)
57 57 List<Ylb> obtainYl(String rq,String gsdm,String fgsdm,String xlbm,String nbbm,String px);
58 58  
  59 + @Query(value="SELECT * FROM bsth_c_ylb where to_days(?1)=to_days(rq) and ssgsdm like %?2% "
  60 + + " and fgsdm like %?3%"
  61 + + " and xlbm = ?4 and nbbm like %?5% order by ?6 asc ",nativeQuery=true)
  62 + List<Ylb> obtainYl_eq(String rq,String gsdm,String fgsdm,String xlbm,String nbbm,String px);
  63 +
59 64  
60 65 @Query(value="SELECT * FROM bsth_c_ylb where to_days(?1)=to_days(rq) and nbbm =?2 and jsy=?3 ",nativeQuery=true)
61 66 List<Ylb> queryListYlb(String rq,String nbbm,String jgh);
... ...
src/main/java/com/bsth/repository/realcontrol/ScheduleRealInfoRepository.java
... ... @@ -170,9 +170,12 @@ public interface ScheduleRealInfoRepository extends BaseRepository&lt;ScheduleRealI
170 170 List<ScheduleRealInfo> scheduleByDateAndLineYbb(String line,String date,String date2);
171 171  
172 172  
173   - @Query(value="select new map(s.scheduleDate as scheduleDate,s.xlBm as xlBm,s.clZbh as clZbh,s.jGh as jGh,min(s.fcsj) as fcsj ) from ScheduleRealInfo s where s.xlBm like %?1% and DATE_FORMAT(s.scheduleDate,'%Y-%m-%d') = ?2 and s.gsBm like %?3% and s.fgsBm like %?4% and s.clZbh like %?5% GROUP BY xlBm,clZbh,jGh,scheduleDate,jGh ORDER BY clZbh,fcsj")
  173 + @Query(value="select new map(s.scheduleDate as scheduleDate,s.xlBm as xlBm,s.clZbh as clZbh,s.jGh as jGh,min(s.fcsj) as fcsj ) from ScheduleRealInfo s where s.xlBm like %?1% and DATE_FORMAT(s.scheduleDate,'%Y-%m-%d') = ?2 and s.gsBm like %?3% and s.fgsBm like %?4% and s.clZbh like %?5% GROUP BY xlBm,clZbh,jGh,scheduleDate ORDER BY clZbh,fcsj")
174 174 List<Map<String,Object>> yesterdayDataList(String line,String date,String gsbm,String fgsbm,String nbbm);
175 175  
  176 + @Query(value="select new map(s.scheduleDate as scheduleDate,s.xlBm as xlBm,s.clZbh as clZbh,s.jGh as jGh,min(s.fcsj) as fcsj ) from ScheduleRealInfo s where s.xlBm =?1 and DATE_FORMAT(s.scheduleDate,'%Y-%m-%d') = ?2 and s.gsBm like %?3% and s.fgsBm like %?4% and s.clZbh like %?5% GROUP BY xlBm,clZbh,jGh,scheduleDate ORDER BY clZbh,fcsj")
  177 + List<Map<String,Object>> yesterdayDataList_eq(String line,String date,String gsbm,String fgsbm,String nbbm);
  178 +
176 179 @Query(value="select s from ScheduleRealInfo s where DATE_FORMAT(s.scheduleDate,'%Y-%m-%d') = ?1 ORDER BY xlBm,lpName,clZbh,xlDir")
177 180 List<ScheduleRealInfo> setLD(String date);
178 181  
... ...
src/main/java/com/bsth/service/forms/impl/FormsServiceImpl.java
... ... @@ -547,16 +547,18 @@ public class FormsServiceImpl implements FormsService {
547 547 });
548 548  
549 549 List<Ylb> listYlb= ylbRepository.obtainYl(startDate, gsdm, fgsdm, xlbm, "", "xlbm");
550   - List<ScheduleRealInfo> listReal=scheduleRealInfoRepository.scheduleByDateAndLineTjrb(xlbm, startDate);
  550 + List<ScheduleRealInfo> listReal=scheduleRealInfoRepository.scheduleByDateAndLine(xlbm, startDate);
551 551 for (int i = 0; i < list.size(); i++) {
552 552 List<ScheduleRealInfo> newList=new ArrayList<ScheduleRealInfo>();
553 553 Singledata sin=list.get(i);
554   - sin.setxL(BasicData.lineCode2NameMap.get(sin.getxL()));
  554 +
555 555 String jsy=sin.getJsy();
556 556 String clzbh=sin.getClzbh();
  557 + String xl=sin.getxL();
  558 + sin.setxL(BasicData.lineCode2NameMap.get(xl));
557 559 for (int j = 0; j < listReal.size(); j++) {
558 560 ScheduleRealInfo s=listReal.get(j);
559   - if(s.getjGh().equals(jsy) && s.getClZbh().equals(clzbh)){
  561 + if(s.getjGh().equals(jsy) && s.getClZbh().equals(clzbh)&&s.getXlBm().equals(xl)){
560 562 newList.add(s);
561 563 }
562 564 }
... ...
src/main/java/com/bsth/service/oil/CwjyService.java
... ... @@ -14,4 +14,6 @@ public interface CwjyService extends BaseService&lt;Cwjy, Integer&gt;{
14 14 Ylxxb bynbbm(Map<String, Object> map);
15 15  
16 16 Map<String, Object> savejzl(Map<String, Object> map) throws Exception ;
  17 +
  18 + int checkNbbm(String nbbm);
17 19 }
... ...
src/main/java/com/bsth/service/oil/impl/CwjyServiceImpl.java
... ... @@ -317,4 +317,13 @@ public class CwjyServiceImpl extends BaseServiceImpl&lt;Cwjy,Integer&gt; implements Cw
317 317 return yList;
318 318 }
319 319  
  320 + @Override
  321 + public int checkNbbm(String nbbm) {
  322 + // TODO Auto-generated method stub
  323 + String sql="select count(*) from bsth_c_cwjy where nbbm ='"+nbbm+"'";
  324 + int cs=jdbcTemplate.queryForObject(sql, Integer.class);
  325 +
  326 + return cs;
  327 + }
  328 +
320 329 }
... ...
src/main/java/com/bsth/service/oil/impl/YlbServiceImpl.java
... ... @@ -270,6 +270,7 @@ public class YlbServiceImpl extends BaseServiceImpl&lt;Ylb,Integer&gt; implements YlbS
270 270 List<Ylb> addList = new ArrayList<Ylb>();
271 271 List<Ylb> updateList = new ArrayList<Ylb>();
272 272 String ins="";
  273 + Map<String, Object> ylMap=new HashMap<String, Object>();
273 274 for (int x = 0; x < listpb.size(); x++) {
274 275 String type = "add";
275 276 boolean sfdc = true;
... ... @@ -332,17 +333,23 @@ public class YlbServiceImpl extends BaseServiceImpl&lt;Ylb,Integer&gt; implements YlbS
332 333 t.setCzyl(0.0);
333 334 }
334 335 }
335   -
  336 +
336 337 Double jzl = 0.0;
337   - // 把当天的YLXXB的加注量设置为当天YLB的加注量(根据车号,驾驶员判断)
338   - for (int j = 0; j < ylxxList.size(); j++) {
339   - Ylxxb ylxxb = ylxxList.get(j);
340   - if (map.get("clZbh").toString().equals(ylxxb.getNbbm())
341   - && map.get("jGh").toString().equals(ylxxb.getJsy())) {
342   -// jzl += ylxxb.getJzl();
343   - jzl =Arith.add(jzl, ylxxb.getJzl());
  338 + //一人一车加注量只匹配一次
  339 + if(ylMap.get(map.get("clZbh").toString()+"_"+ map.get("jGh").toString())!=null){
  340 +
  341 + }else{
  342 + // 把当天的YLXXB的加注量设置为当天YLB的加注量(根据车号,驾驶员判断)
  343 + for (int j = 0; j < ylxxList.size(); j++) {
  344 + Ylxxb ylxxb = ylxxList.get(j);
  345 + if (map.get("clZbh").toString().equals(ylxxb.getNbbm())
  346 + && map.get("jGh").toString().equals(ylxxb.getJsy())) {
  347 + jzl =Arith.add(jzl, ylxxb.getJzl());
  348 + }
344 349 }
  350 + ylMap.put(map.get("clZbh").toString()+"_"+ map.get("jGh").toString(),map.get("xlBm") == null ? "" : map.get("xlBm").toString());
345 351 }
  352 +
346 353  
347 354 t.setJzl(jzl);
348 355 t.setNbbm(map.get("clZbh").toString());
... ... @@ -435,8 +442,16 @@ public class YlbServiceImpl extends BaseServiceImpl&lt;Ylb,Integer&gt; implements YlbS
435 442 // 获取车辆存油信息
436 443 List<Cyl> cylList = cylRepository.obtainCyl(nbbm,gsbm);
437 444 // 指定日期YLB信息
438   - List<Ylb> ylbList =repository.obtainYl(rq,gsbm,fgsbm,"",nbbm,"nbbm,jcsx");
439   - List<Ylb> iterator2=repository.obtainYl(rq,gsbm,fgsbm,"",nbbm,"jcsx");
  445 + List<Ylb> ylbList =new ArrayList<Ylb>();
  446 + List<Ylb> iterator2=new ArrayList<Ylb>();
  447 + if(xlbm.equals("")){
  448 + ylbList=repository.obtainYl(rq,gsbm,fgsbm,xlbm,nbbm,"jcsx");
  449 + iterator2=repository.obtainYl(rq,gsbm,fgsbm,xlbm,nbbm,"nbbm,jcsx");
  450 + }else{
  451 + ylbList=repository.obtainYl_eq(rq,gsbm,fgsbm,xlbm,nbbm,"jcsx");
  452 + iterator2=repository.obtainYl_eq(rq,gsbm,fgsbm,xlbm,nbbm,"nbbm,jcsx");
  453 + }
  454 +
440 455 for (int i=0;i<ylbList.size();i++) {
441 456 Ylb ylb = ylbList.get(i);
442 457 // 判断是否已经计算过
... ... @@ -499,9 +514,6 @@ public class YlbServiceImpl extends BaseServiceImpl&lt;Ylb,Integer&gt; implements YlbS
499 514 t.setYh(yh);
500 515 t.setJzyl(nextJzyl);
501 516 }
502   -
503   -
504   -
505 517 } else {
506 518 t.setCzyl(nextJzyl);
507 519 Double yh=0.0;
... ...
src/main/java/com/bsth/service/realcontrol/impl/ScheduleRealInfoServiceImpl.java
... ... @@ -2983,16 +2983,22 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
2983 2983 // String date = sdfMonth.format(org.apache.commons.lang.time.DateUtils.addDays(new Date(), -1));
2984 2984 // String date = "2016-09-20";
2985 2985 // System.out.println("shijian1:"+new Date());
2986   - List<Map<String, Object>> yesterdayDataList = scheduleRealInfoRepository.yesterdayDataList(line, date,gsbm,fgsbm,nbbm);
  2986 +
  2987 + List<Map<String, Object>> yesterdayDataList = new ArrayList<Map<String, Object>>();
  2988 + if(line.equals("")){
  2989 + yesterdayDataList=scheduleRealInfoRepository.yesterdayDataList(line, date,gsbm,fgsbm,nbbm);
  2990 + }else{
  2991 + yesterdayDataList=scheduleRealInfoRepository.yesterdayDataList_eq(line, date,gsbm,fgsbm,nbbm);
  2992 + }
  2993 +
2987 2994 // System.out.println("shijian2:"+new Date());
2988 2995 // List<ScheduleRealInfo> list = scheduleRealInfoRepository.scheduleByDateAndLine(line, date);
2989 2996 List<ScheduleRealInfo> lists = scheduleRealInfoRepository.queryListWaybill3(jGh, nbbm, date,gsbm,fgsbm);
2990 2997 // System.out.println("shijian3:"+new Date());
2991 2998 for (int x = 0; x < yesterdayDataList.size(); x++) {
2992   -
2993 2999 String jName = yesterdayDataList.get(x).get("jGh").toString();
2994 3000 String clZbh = yesterdayDataList.get(x).get("clZbh").toString();
2995   -
  3001 + String xlbm = yesterdayDataList.get(x).get("xlBm").toString();
2996 3002 // double jhlc = 0, yygl = 0, ksgl = 0, tempJhlc = 0, jcclc = 0;
2997 3003 double addMileage = 0, remMileage = 0;
2998 3004 Map<String, Object> map = new HashMap<String, Object>();
... ... @@ -3001,7 +3007,8 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
3001 3007 String bCompany="";
3002 3008 List<ScheduleRealInfo> listS=new ArrayList<ScheduleRealInfo>();
3003 3009 for (ScheduleRealInfo scheduleRealInfo : lists) {
3004   - if(scheduleRealInfo.getjGh().equals(jName) && scheduleRealInfo.getClZbh().equals(clZbh)){
  3010 + if(scheduleRealInfo.getjGh().equals(jName) && scheduleRealInfo.getClZbh().equals(clZbh)
  3011 + && scheduleRealInfo.getXlBm().equals(xlbm)){
3005 3012 if (fage) {
3006 3013 //根据线路代码获取公司
3007 3014 company=scheduleRealInfo.getGsBm();
... ...
src/main/java/com/bsth/service/report/ReportService.java
... ... @@ -17,7 +17,7 @@ public interface ReportService {
17 17 List<ArrivalInfo> queryListClzd(String line,String zd,String zdlx,String fcsj,String ddsj);
18 18 List<StationRoute> queryStrinon(String line,int zd);
19 19 List<Map<String, Object>> queryInOutStrtion(String line,String date,int zd,String lzsj);
20   - List<Map<String, String>> sreachZd(String line,int zdlx,String zd);
  20 + List<Map<String, String>> sreachZd(String line,int zdlx);
21 21  
22 22 List<Object[]> historyMessageCount(String line, String date, String code);
23 23  
... ...
src/main/java/com/bsth/service/report/impl/ReportServiceImpl.java
... ... @@ -252,18 +252,16 @@ public class ReportServiceImpl implements ReportService{
252 252 return list;
253 253 }
254 254 @Override
255   - public List<Map<String, String>> sreachZd(String line, int zdlx,String zd) {
  255 + public List<Map<String, String>> sreachZd(String line, int zdlx) {
256 256 List<Map<String, String>> list = new ArrayList<>();
257 257 // TODO Auto-generated method stub
258 258 List<StationRoute> listSr=stationRoutRepository.findByLine(line,zdlx);
259 259 for (int i = 0; i < listSr.size(); i++) {
260 260 StationRoute t=listSr.get(i);
261   - if(t.getStationName().indexOf(zd)!=-1){
262   - Map<String, String> newMap=new HashMap<String,String>();
263   - newMap.put("id",t.getStationCode());
264   - newMap.put("text", t.getStationName());
265   - list.add(newMap);
266   - }
  261 + Map<String, String> newMap=new HashMap<String,String>();
  262 + newMap.put("id",t.getStationCode());
  263 + newMap.put("text", t.getStationName());
  264 + list.add(newMap);
267 265 }
268 266 return list;
269 267 }
... ...
src/main/resources/application-dev.properties
... ... @@ -11,7 +11,9 @@ spring.datasource.driver-class-name= com.mysql.jdbc.Driver
11 11 spring.datasource.url= jdbc:mysql://127.0.0.1/control?useUnicode=true&characterEncoding=utf-8&useSSL=false
12 12 spring.datasource.username= root
13 13 spring.datasource.password=
14   -
  14 +#spring.datasource.url= jdbc:mysql://192.168.168.117/pd_control?useUnicode=true&characterEncoding=utf-8&useSSL=false
  15 +#spring.datasource.username= root
  16 +#spring.datasource.password= root
15 17 #DATASOURCE
16 18 spring.datasource.max-active=100
17 19 spring.datasource.max-idle=8
... ... @@ -27,6 +29,7 @@ spring.datasource.validation-query=select 1
27 29 ##
28 30 #222.66.0.204:5555
29 31 ##\u5B9E\u65F6gps
  32 +http.gps.real.url= http://114.80.178.12:18080/transport_server/rtgps/
30 33 #http.gps.real.url= http://27.115.69.123:8800/transport_server/rtgps/
31 34 ##\u6D88\u606F\u4E0B\u53D1
32   -http.send.directive = http://192.168.168.201:9090/transport_server/message/
  35 +http.send.directive = http://192.168.168.201:9090/transport_server/message/
33 36 \ No newline at end of file
... ...
src/main/resources/static/pages/oil/jyszAdd.html
... ... @@ -123,11 +123,18 @@ $(function(){
123 123 submitHandler : function(f) {
124 124 var params = form.serializeJSON();
125 125 error.hide();
126   - $post('/cwjy', params, function(res){
127   - layer.msg('新增加油设置成功.');
128   - $('#add_jysz').modal('hide');
129   - refreshJsTree();
130   - });
  126 + $get('/cwjy/checkNbbm',params,function(result){
  127 + if(result>0){
  128 + layer.msg('该车辆已经添加.');
  129 + }else{
  130 + $post('/cwjy', params, function(result){
  131 + layer.msg('新增加油设置成功.');
  132 + $('#add_jysz').modal('hide');
  133 + refreshJsTree();
  134 + });
  135 + }
  136 + })
  137 +
131 138 }
132 139 });
133 140  
... ...
src/main/resources/static/pages/report/inoutstation.html
... ... @@ -66,7 +66,7 @@
66 66 <span class="item-label" style="width: 60px;margin-left: 19px;">至: </span>
67 67 <input class="form-control" type="text" id="date2" style="width: 180px;"/>
68 68 <span class="item-label" style="width: 80px;">站点: </span>
69   - <select class="form-control" id="zdlx" class="sreach-zd" >
  69 + <select class="form-control sreach-zd" id="zdlx" >
70 70 <option value="">请选择</option>
71 71 <option value="0">上行</option>
72 72 <option value="1">下行</option>
... ... @@ -426,55 +426,31 @@
426 426 });
427 427 }
428 428 })
  429 + $(".sreach-zd").on("change",initZd);
  430 + var status=false;
429 431  
430   - $(".sreach-zd").click(function(){
  432 + function initZd(){
431 433 var line = $("#line").val();
432 434 var zdlx = $("#zdlx").val();
  435 + console.log(line+"===="+zdlx);
433 436 if(line==null|| line =="" || zdlx ==null || zdlx==""){
434   -
435 437 }else{
436   - $('#zd').select2({
437   - placeholder: '搜索站点...',
438   - ajax: {
439   - url: '/report/sreachZd',
440   - dataType: 'json',
441   - delay: 150,
442   - data: function(params){
443   - return{line: line,zdlx:zdlx,zd:params.term};
444   - },
445   - processResults: function (data) {
446   - return {
447   - results: data
448   - };
449   - },
450   - cache: true
451   - },
452   - templateResult: function(repo){
453   - if (repo.loading) return repo.text;
454   - var h = '<span>'+repo.text+'</span>';
455   - return h;
456   - },
457   - escapeMarkup: function (markup) { return markup; },
458   - minimumInputLength: 1,
459   - templateSelection: function(repo){
460   - return repo.text;
461   - },
462   - language: {
463   - noResults: function(){
464   - return '<span style="color:red;font-size: 12px;">没有搜索到站点!</span>';
465   - },
466   - inputTooShort : function(e) {
467   - return '<span style="color:gray;font-size: 12px;"><i class="fa fa-search"></i> 输入站点名称</span>';
468   - },
469   - searching : function() {
470   - return '<span style="color:gray;font-size: 12px;"> 正在搜索站点...</span>';
471   - }
  438 + $.get('/report/sreachZd',{line: line,zdlx:zdlx},function(result){
  439 + var zdList=result;
  440 + if(status){
  441 + $("#zd").select2("destroy").html('');
472 442 }
473   - });
  443 + console.log(zdList[0]["id"]);
  444 + var datas=[];
  445 + datas.push({id:" ",text:"全部"});
  446 + for(var i=0;i<zdList.length;i++){
  447 + datas.push({id: zdList[i]["id"], text: zdList[i]["text"]});
  448 + }
  449 + initPinYinSelect2('#zd',datas,'');
  450 + status=true;
  451 + })
474 452 }
475   - })
476   -
477   -
  453 + }
478 454  
479 455 $("#export").on("click",function(){
480 456 var rq=$("#date").val();
... ...