Commit 691786ffd5e2ae834ca26edd32e2435d69280819
1 parent
6d3367ca
场外加油 加油人员不符 调度日报导出修正
Showing
6 changed files
with
146 additions
and
46 deletions
src/main/java/com/bsth/repository/oil/CwjyRepository.java
| ... | ... | @@ -27,4 +27,8 @@ public interface CwjyRepository extends BaseRepository<Cwjy, Integer>{ |
| 27 | 27 | " ) c on a.nbbm=c.nbbm where a.nbbm like %?2% ",nativeQuery=true) |
| 28 | 28 | List<Object[]> obtainCwjycl(String rq,String nbbm); |
| 29 | 29 | |
| 30 | + @Query(value="select * from bsth_c_cwjy where nbbm like %?1% and gsdm like %?2% and fgsdm like %?3%",nativeQuery=true) | |
| 31 | + List<Cwjy> selectAll(String nbbm,String gsdm,String fgsdm); | |
| 32 | + | |
| 33 | + | |
| 30 | 34 | } | ... | ... |
src/main/java/com/bsth/service/oil/impl/CwjyServiceImpl.java
| ... | ... | @@ -26,6 +26,7 @@ import com.alibaba.fastjson.JSONObject; |
| 26 | 26 | import com.bsth.common.ResponseCode; |
| 27 | 27 | import com.bsth.entity.oil.Cwjy; |
| 28 | 28 | import com.bsth.entity.oil.Cyl; |
| 29 | +import com.bsth.entity.oil.Ylb; | |
| 29 | 30 | import com.bsth.entity.oil.Ylxxb; |
| 30 | 31 | import com.bsth.repository.oil.CwjyRepository; |
| 31 | 32 | import com.bsth.repository.oil.YlxxbRepository; |
| ... | ... | @@ -280,7 +281,7 @@ public class CwjyServiceImpl extends BaseServiceImpl<Cwjy,Integer> implements Cw |
| 280 | 281 | String gsdm=map.get("gsdm_like").toString(); |
| 281 | 282 | |
| 282 | 283 | String fgsdm=map.get("fgsdm_like").toString(); |
| 283 | - String sql="SELECT a.gsdm as gsdm,a.fgsdm as fgsdm,a.nbbm as nbbm," | |
| 284 | + /*String sql="SELECT a.gsdm as gsdm,a.fgsdm as fgsdm,a.nbbm as nbbm," | |
| 284 | 285 | + "b.jyggh as jyggh,b.jzl as jzl ,b.stationid as stationid,b.jsy as jsy," |
| 285 | 286 | + "b.nylx as nylx,b.yj as yj,b.bz as bz,b.id as id ,c.jsy as ldgh FROM bsth_c_cwjy a "+ |
| 286 | 287 | " left join (" |
| ... | ... | @@ -293,7 +294,10 @@ public class CwjyServiceImpl extends BaseServiceImpl<Cwjy,Integer> implements Cw |
| 293 | 294 | + " and ssgsdm='"+gsdm+"' and fgsdm ='"+fgsdm+"' group by nbbm "+ |
| 294 | 295 | " ) c on a.nbbm=c.nbbm " |
| 295 | 296 | + "where a.nbbm like '%"+nbbm+"%' and a.gsdm='"+gsdm+"' and a.fgsdm ='"+fgsdm+"'" |
| 296 | - + " order by a.nbbm"; | |
| 297 | + + " order by a.nbbm";*/ | |
| 298 | + String sql= " select * from bsth_c_ylxxb b " | |
| 299 | + + "where to_days(b.yyrq)=to_days('"+rq+"') and jylx=1 " | |
| 300 | + + " and gsdm = '"+gsdm+"'"; | |
| 297 | 301 | |
| 298 | 302 | List<Ylxxb> yList= jdbcTemplate.query(sql, |
| 299 | 303 | new RowMapper<Ylxxb>(){ |
| ... | ... | @@ -311,24 +315,67 @@ public class CwjyServiceImpl extends BaseServiceImpl<Cwjy,Integer> implements Cw |
| 311 | 315 | t.setNylx(rs.getInt("nylx")); |
| 312 | 316 | t.setYj(rs.getDouble("yj")); |
| 313 | 317 | t.setBz(rs.getString("bz")); |
| 314 | - t.setLdgh(rs.getString("ldgh")); | |
| 315 | 318 | return t; |
| 316 | 319 | } |
| 317 | 320 | }); |
| 318 | - /*List<Ylxxb> list= ylxxbRepository.checkYlxx(rq, gsdm); | |
| 319 | - for (int i = 0; i < yList.size(); i++) { | |
| 320 | - Ylxxb t=yList.get(i); | |
| 321 | - Double zjzl=0.0; | |
| 322 | - for (int j = 0; j < list.size(); j++) { | |
| 323 | - Ylxxb y=list.get(j); | |
| 324 | - if(t.getNbbm().equals(y.getNbbm())){ | |
| 325 | - zjzl=Arith.add(zjzl, y.getJzl()); | |
| 321 | + List<Cwjy> cwList=repository.selectAll(nbbm, gsdm, fgsdm); | |
| 322 | + String sql_ylb="SELECT nbbm,group_concat(jsy) AS jsy FROM bsth_c_ylb WHERE " | |
| 323 | + + " to_days(rq) = to_days('"+rq+"') AND ssgsdm = '"+gsdm+"' AND " | |
| 324 | + + " fgsdm = '"+fgsdm+"' GROUP BY nbbm"; | |
| 325 | + | |
| 326 | + List<Map<String, String>> ylbList= jdbcTemplate.query(sql_ylb, | |
| 327 | + new RowMapper<Map<String, String>>(){ | |
| 328 | + @Override | |
| 329 | + public Map<String, String> mapRow(ResultSet rs, int rowNum) throws SQLException { | |
| 330 | + Map<String, String> maps =new HashMap<String, String>(); | |
| 331 | + maps.put("nbbm", rs.getString("nbbm")); | |
| 332 | + maps.put("ldgh", rs.getString("jsy")); | |
| 333 | + return maps; | |
| 334 | + } | |
| 335 | + }); | |
| 336 | + | |
| 337 | + List<Ylxxb> ylxxbList= new ArrayList<Ylxxb>(); | |
| 338 | + Ylxxb y=null; | |
| 339 | + for (int i = 0; i < cwList.size(); i++) { | |
| 340 | + Cwjy cwjy=cwList.get(i); | |
| 341 | + if(cwjy.getNbbm().equals("W7B-092")){ | |
| 342 | + System.out.println(); | |
| 343 | + } | |
| 344 | + y=new Ylxxb(); | |
| 345 | + y.setNylx(0); | |
| 346 | + y.setId(0); | |
| 347 | + y.setJzl(0.0); | |
| 348 | + y.setGsdm(cwjy.getGsdm()); | |
| 349 | + y.setFgsdm(cwjy.getFgsdm()); | |
| 350 | + y.setNbbm(cwjy.getNbbm()); | |
| 351 | + for (int j = 0; j < yList.size(); j++) { | |
| 352 | + Ylxxb ylxxb=yList.get(j); | |
| 353 | + if(y.getNbbm().equals(ylxxb.getNbbm())){ | |
| 354 | + y.setId(ylxxb.getId()); | |
| 355 | + y.setJyggh(ylxxb.getJyggh()); | |
| 356 | + y.setJsy(ylxxb.getJsy()); | |
| 357 | + y.setJzl(ylxxb.getJzl()); | |
| 358 | + y.setStationid(ylxxb.getStationid()); | |
| 359 | + y.setNylx(ylxxb.getNylx()); | |
| 360 | + y.setYj(ylxxb.getYj()); | |
| 361 | + y.setBz(ylxxb.getBz()); | |
| 362 | + break; | |
| 363 | + } | |
| 364 | + } | |
| 365 | + for (int j = 0; j < ylbList.size(); j++) { | |
| 366 | + Map<String, String> m=ylbList.get(j); | |
| 367 | + if(m.get("nbbm").toString().equals(cwjy.getNbbm())){ | |
| 368 | + y.setLdgh(m.get("ldgh").toString()); | |
| 369 | + break; | |
| 326 | 370 | } |
| 327 | 371 | |
| 328 | 372 | } |
| 329 | - t.setZjzl(zjzl); | |
| 330 | - }*/ | |
| 331 | - return yList; | |
| 373 | + | |
| 374 | + ylxxbList.add(y); | |
| 375 | + | |
| 376 | + } | |
| 377 | + | |
| 378 | + return ylxxbList; | |
| 332 | 379 | } |
| 333 | 380 | |
| 334 | 381 | @Override | ... | ... |
src/main/java/com/bsth/service/oil/impl/YlbServiceImpl.java
| ... | ... | @@ -871,15 +871,48 @@ public class YlbServiceImpl extends BaseServiceImpl<Ylb,Integer> implements YlbS |
| 871 | 871 | List<Ylb> ylListBe=repository.listMaxRqJcsx(rq, gsbm, fgsbm, xlbm, nbbm); |
| 872 | 872 | List<Ylb> ylbList=this.listOrderBy(rq,gsbm,fgsbm,xlbm,nbbm,"nbbm"); |
| 873 | 873 | // repository.obtainYl(rq,gsbm,fgsbm,xlbm,nbbm,"nbbm"); |
| 874 | - List<Ylxxb> ylxxbList=ylxxbRepository.obtainYlxx(rq,0,gsbm); | |
| 874 | +// List<Ylxxb> ylxxbList=ylxxbRepository.obtainYlxx(rq,0,gsbm); | |
| 875 | + String sql="select * from bsth_c_ylxxb where yyrq='"+rq+"' " | |
| 876 | + + " and gsdm ='"+gsbm+"' and nylx ='0' and nbbm " | |
| 877 | + + " not in ( select nbbm from bsth_c_ylb " | |
| 878 | + + " where DATE_FORMAT(rq,'%Y-%m-%d')='"+rq+"' " | |
| 879 | + + " and ssgsdm='"+gsbm+"' and fgsdm ='"+fgsbm+"')" | |
| 880 | + + " and nbbm in (select inside_code from " | |
| 881 | + + " bsth_c_cars where business_code ='"+gsbm+"' " | |
| 882 | + + " and branche_company_code='"+fgsbm+"')"; | |
| 883 | + | |
| 884 | + List<Ylxxb> ylxxbList=jdbcTemplate.query(sql, | |
| 885 | + new RowMapper<Ylxxb>(){ | |
| 886 | + @Override | |
| 887 | + public Ylxxb mapRow(ResultSet rs, int rowNum) throws SQLException { | |
| 888 | + Ylxxb s = new Ylxxb(); | |
| 889 | + s.setId(rs.getInt("id")); | |
| 890 | + s.setYyrq(rs.getDate("yyrq")); | |
| 891 | + s.setNbbm(rs.getString("nbbm")); | |
| 892 | + s.setGsdm(rs.getString("gsdm")); | |
| 893 | + s.setFgsdm(rs.getString("fgsdm")); | |
| 894 | + s.setJsy(rs.getString("jsy")); | |
| 895 | + s.setJzl(rs.getDouble("jzl")); | |
| 896 | + s.setStationid(rs.getString("stationid")); | |
| 897 | + s.setNylx(rs.getInt("nylx")); | |
| 898 | + s.setJyggh(rs.getString("jyggh")); | |
| 899 | + s.setYj(rs.getDouble("yj")); | |
| 900 | +// s.setLdgh(rs.getString("ldgh")); | |
| 901 | + s.setBz(rs.getString("bz")); | |
| 902 | + return s; | |
| 903 | + } | |
| 904 | + }); | |
| 875 | 905 | for (int i = 0; i < ylxxbList.size(); i++) { |
| 876 | - Boolean fage=true; | |
| 906 | + Boolean fage=false; | |
| 877 | 907 | Ylxxb y1=ylxxbList.get(i); |
| 878 | - for(int y=0;y<ylbList.size();y++){ | |
| 879 | - Ylb y2=ylbList.get(y); | |
| 880 | - if(y1.getNbbm().equals(y2.getNbbm())){ | |
| 881 | - fage=false; | |
| 882 | - break; | |
| 908 | + Line line=BasicData.nbbm2LineMap.get(y1.getNbbm()); | |
| 909 | + if(null !=line){ | |
| 910 | + if(!xlbm.equals("")){ | |
| 911 | + if(line.getLineCode().equals(xlbm)){ | |
| 912 | + fage=true; | |
| 913 | + } | |
| 914 | + }else{ | |
| 915 | + fage=true; | |
| 883 | 916 | } |
| 884 | 917 | } |
| 885 | 918 | |
| ... | ... | @@ -896,7 +929,6 @@ public class YlbServiceImpl extends BaseServiceImpl<Ylb,Integer> implements YlbS |
| 896 | 929 | } |
| 897 | 930 | t.setFgsdm(fgsdm); |
| 898 | 931 | t.setJcsx(1); |
| 899 | - Line line= BasicData.nbbm2LineMap.get(y1.getNbbm()); | |
| 900 | 932 | if(null !=line){ |
| 901 | 933 | t.setXlbm(line.getLineCode()); |
| 902 | 934 | }else{ |
| ... | ... | @@ -929,12 +961,6 @@ public class YlbServiceImpl extends BaseServiceImpl<Ylb,Integer> implements YlbS |
| 929 | 961 | logger.info("核对有存油没里程:存在相同数据,数据已经过滤"); |
| 930 | 962 | } |
| 931 | 963 | } |
| 932 | - | |
| 933 | - /*if(null!=cyl){ | |
| 934 | - cyl.setCyl(Arith.add(t.getJzl(), t.getCzyl())); | |
| 935 | - cyl.setUpdatetime(y1.getYyrq()); | |
| 936 | - cylRepository.save(cyl); | |
| 937 | - }*/ | |
| 938 | 964 | } |
| 939 | 965 | } |
| 940 | 966 | } | ... | ... |
src/main/java/com/bsth/service/oil/impl/YlxxbServiceImpl.java
| ... | ... | @@ -49,14 +49,20 @@ public class YlxxbServiceImpl extends BaseServiceImpl<Ylxxb,Integer> implements |
| 49 | 49 | String rq=map.get("yyrq").toString(); |
| 50 | 50 | String gsdm=map.get("gsdm_like").toString(); |
| 51 | 51 | String fgsdm=map.get("fgsdm_like").toString(); |
| 52 | - /* | |
| 53 | - String sql=" select x.*,y.jsy as ldgh,y.fgsdm as fgsdm from bsth_c_ylxxb x " | |
| 54 | - + " left join bsth_c_ylb y on x.nbbm = y.nbbm and x.jsy !=y.jsy " | |
| 55 | - + " where DATE_FORMAT(y.rq,'%Y-%m-%d')='"+rq+"' and y.ssgsdm='"+gsdm+"' " | |
| 56 | - + " and y.fgsdm='"+fgsdm+"' and DATE_FORMAT(x.yyrq,'%Y-%m-%d')='"+rq+"' " | |
| 57 | - + " and x.gsdm='"+gsdm+"'";*/ | |
| 58 | 52 | |
| 59 | - String sql= "select v.*,u.jsy as ldgh from " | |
| 53 | + String sql=" select * from (" | |
| 54 | + + "select *,CONCAT(nbbm,jsy) as nj " | |
| 55 | + + " from bsth_c_ylxxb where yyrq='"+rq+"' " | |
| 56 | + + " and gsdm ='"+gsdm+"') x where x.nj not in (" | |
| 57 | + + " select CONCAT(nbbm,jsy) from bsth_c_ylb " | |
| 58 | + + " where DATE_FORMAT(rq,'%Y-%m-%d')='"+rq+"'" | |
| 59 | + + " and ssgsdm='"+gsdm+"' and fgsdm ='"+fgsdm+"')" | |
| 60 | + + " and x.nbbm in (select nbbm from bsth_c_ylb " | |
| 61 | + + " where DATE_FORMAT(rq,'%Y-%m-%d')='"+rq+"'" | |
| 62 | + + " and ssgsdm='"+gsdm+"' and fgsdm ='"+fgsdm+"')"; | |
| 63 | + | |
| 64 | + | |
| 65 | + /*String sql= "select v.*,u.jsy as ldgh from " | |
| 60 | 66 | + " ( select * from bsth_c_ylxxb x where " |
| 61 | 67 | + " DATE_FORMAT(x.yyrq,'%Y-%m-%d')='"+rq+"' and x.gsdm='"+gsdm+"'" |
| 62 | 68 | + " and x.jsy not in (" |
| ... | ... | @@ -69,7 +75,7 @@ public class YlxxbServiceImpl extends BaseServiceImpl<Ylxxb,Integer> implements |
| 69 | 75 | + " left join (select * from bsth_c_ylb " |
| 70 | 76 | + " where DATE_FORMAT(rq,'%Y-%m-%d')='"+rq+"'" |
| 71 | 77 | + " and ssgsdm='"+gsdm+"' and fgsdm='"+fgsdm+"' ) u " |
| 72 | - + " on v.nbbm=u.nbbm "; | |
| 78 | + + " on v.nbbm=u.nbbm ";*/ | |
| 73 | 79 | |
| 74 | 80 | //根具条件查询指定日期Ylxxb的数据 |
| 75 | 81 | // List<Ylxxb> iterator=repository.checkYlxx(rq,gsdm); |
| ... | ... | @@ -100,12 +106,28 @@ public class YlxxbServiceImpl extends BaseServiceImpl<Ylxxb,Integer> implements |
| 100 | 106 | s.setNylx(rs.getInt("nylx")); |
| 101 | 107 | s.setJyggh(rs.getString("jyggh")); |
| 102 | 108 | s.setYj(rs.getDouble("yj")); |
| 103 | - s.setLdgh(rs.getString("ldgh")); | |
| 109 | +// s.setLdgh(rs.getString("ldgh")); | |
| 104 | 110 | s.setBz(rs.getString("bz")); |
| 105 | 111 | return s; |
| 106 | 112 | } |
| 107 | 113 | }); |
| 108 | 114 | |
| 115 | + | |
| 116 | + List<Ylb> listylb=ylbRepository.obtainYl(rq, gsdm, fgsdm, "", "", "nbbm"); | |
| 117 | + for (int i = 0; i < list.size(); i++) { | |
| 118 | + String ldgh=""; | |
| 119 | + for (int j = 0; j < listylb.size(); j++) { | |
| 120 | + Ylb ylb =listylb.get(j); | |
| 121 | + if(list.get(i).getNbbm().equals(ylb.getNbbm())){ | |
| 122 | + if(ldgh.equals("")) | |
| 123 | + ldgh +=ylb.getJsy(); | |
| 124 | + else | |
| 125 | + ldgh += ","+ylb.getJsy(); | |
| 126 | + } | |
| 127 | + } | |
| 128 | + list.get(i).setLdgh(ldgh); | |
| 129 | + | |
| 130 | + } | |
| 109 | 131 | //正式使用用下面代码 |
| 110 | 132 | // for (int i = 0; i < iterator.size(); i++) { |
| 111 | 133 | // Ylxxb y1=iterator.get(i); | ... | ... |
src/main/java/com/bsth/service/realcontrol/impl/ScheduleRealInfoServiceImpl.java
| ... | ... | @@ -2783,6 +2783,8 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl<ScheduleRealInf |
| 2783 | 2783 | if(reamrks2.length()>5){ |
| 2784 | 2784 | t2.setRemarks(reamrks2.substring(0, 5)); |
| 2785 | 2785 | t2.setRemark(reamrks2); |
| 2786 | + }else{ | |
| 2787 | + t2.setRemark(reamrks2); | |
| 2786 | 2788 | } |
| 2787 | 2789 | if (t1.getId() == t2.getId()) { |
| 2788 | 2790 | t1 = t2; |
| ... | ... | @@ -4064,9 +4066,9 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl<ScheduleRealInf |
| 4064 | 4066 | Long zdsj_=Long.parseLong(zdsj_s[0])*60+Long.parseLong(zdsj_s[1]); |
| 4065 | 4067 | Long zdsjActual_=Long.parseLong(zdsjActual_s[0])*60+Long.parseLong(zdsjActual_s[1]); |
| 4066 | 4068 | if((zdsj_-zdsjActual_)>0){ |
| 4067 | - zdsjm =String.valueOf(zdsj_-zdsjActual_); | |
| 4068 | - }else{ | |
| 4069 | 4069 | zdsjk =String.valueOf(zdsj_-zdsjActual_); |
| 4070 | + }else{ | |
| 4071 | + zdsjm =String.valueOf(zdsj_-zdsjActual_); | |
| 4070 | 4072 | } |
| 4071 | 4073 | } |
| 4072 | 4074 | tempMap.put("zdsjk" + x, zdsjk); |
| ... | ... | @@ -4077,9 +4079,10 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl<ScheduleRealInf |
| 4077 | 4079 | String fcsjActuralstr=""; |
| 4078 | 4080 | if(bcType.equals("in")){ |
| 4079 | 4081 | fcsjActuralstr=fcsjActural+"(进)"; |
| 4080 | - } | |
| 4081 | - if(bcType.equals("out")){ | |
| 4082 | + }else if(bcType.equals("out")){ | |
| 4082 | 4083 | fcsjActuralstr=fcsjActural+"(出)"; |
| 4084 | + }else{ | |
| 4085 | + fcsjActuralstr=fcsjActural; | |
| 4083 | 4086 | } |
| 4084 | 4087 | tempMap.put("fcsjActual" + x, fcsjActuralstr); |
| 4085 | 4088 | String fcsjk=""; |
| ... | ... | @@ -4090,9 +4093,9 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl<ScheduleRealInf |
| 4090 | 4093 | Long zdsj_=Long.parseLong(zdsj_s[0])*60+Long.parseLong(zdsj_s[1]); |
| 4091 | 4094 | Long fcsjActural_=Long.parseLong(fcsjActural_s[0])*60+Long.parseLong(fcsjActural_s[1]); |
| 4092 | 4095 | if((zdsj_-fcsjActural_)>0){ |
| 4093 | - fcsjm =String.valueOf(zdsj_-fcsjActural_); | |
| 4094 | - }else{ | |
| 4095 | 4096 | fcsjk =String.valueOf(zdsj_-fcsjActural_); |
| 4097 | + }else{ | |
| 4098 | + fcsjm =String.valueOf(zdsj_-fcsjActural_); | |
| 4096 | 4099 | } |
| 4097 | 4100 | } |
| 4098 | 4101 | tempMap.put("fcsjk" + x, fcsjk); | ... | ... |
src/main/resources/static/pages/oil/checkJyryList.html
| ... | ... | @@ -168,7 +168,6 @@ $(function(){ |
| 168 | 168 | }) |
| 169 | 169 | var params = {}; |
| 170 | 170 | params['ylbList']=JSON.stringify(ylArray); |
| 171 | - console.log(params); | |
| 172 | 171 | var i = layer.load(2); |
| 173 | 172 | $post('/ylxxb/check', params, function(){ |
| 174 | 173 | layer.close(i); |
| ... | ... | @@ -287,7 +286,6 @@ $(function(){ |
| 287 | 286 | params['yyrq']=$("#yyrq").val(); |
| 288 | 287 | // var i = layer.load(2); |
| 289 | 288 | |
| 290 | - var i = 2; | |
| 291 | 289 | /* var jyryGsdm=$("#jyryListGsdmId").val(); |
| 292 | 290 | var jyryFgsdm=$("#jyryListFgsdmId").val(); |
| 293 | 291 | if(jyryGsdm=="" || jyryGsdm==null){ |
| ... | ... | @@ -307,7 +305,7 @@ $(function(){ |
| 307 | 305 | params['fgsdm_in']=fgsqx1; |
| 308 | 306 | } |
| 309 | 307 | } */ |
| 310 | - | |
| 308 | + var i = layer.load(2); | |
| 311 | 309 | $get('/ylxxb/pagequery' ,params, function(data){ |
| 312 | 310 | $.each(data.dataList, function(i, obj) { |
| 313 | 311 | obj.yyrq = moment(obj.yyrq).format("YYYY-MM-DD"); | ... | ... |