Commit 107a24e7427ab48045e424eddfcd6430711722e5

Authored by 廖磊
1 parent 9044b857

油量管理

src/main/java/com/bsth/controller/oil/YlbController.java
... ... @@ -16,6 +16,7 @@ import org.springframework.data.domain.Page;
16 16 import org.springframework.data.domain.PageRequest;
17 17 import org.springframework.data.domain.Sort;
18 18 import org.springframework.data.domain.Sort.Direction;
  19 +import org.springframework.web.bind.annotation.PathVariable;
19 20 import org.springframework.web.bind.annotation.RequestMapping;
20 21 import org.springframework.web.bind.annotation.RequestMethod;
21 22 import org.springframework.web.bind.annotation.RequestParam;
... ... @@ -196,6 +197,17 @@ public class YlbController extends BaseController<Ylb, Integer>{
196 197 return ylbList;
197 198 }
198 199  
  200 + @RequestMapping(value = "/deleteIds", method = RequestMethod.POST)
  201 + public Map<String, Object> deleteIds(@RequestParam Map<String, Object> map) {
  202 + Map<String, Object> maps=new HashMap<String, Object>();
  203 + try {
  204 + maps= yblService.deleteIds(map);
  205 + } catch (Exception e) {
  206 + // TODO Auto-generated catch block
  207 + e.printStackTrace();
  208 + }
  209 + return maps;
  210 + }
199 211 @RequestMapping(value="/oilListMonth")
200 212 public List<Ylb> oilListMonth(@RequestParam String line,@RequestParam String date){
201 213 return yblService.oilListMonth(line, date);
... ... @@ -219,17 +231,7 @@ public class YlbController extends BaseController&lt;Ylb, Integer&gt;{
219 231 sdfSimple = new SimpleDateFormat("yyyyMMdd");
220 232 List<Iterator<?>> listI = new ArrayList<Iterator<?>>();
221 233 ReportUtils ee = new ReportUtils();
222   - String rq=map.get("rq").toString();
223   - if(!(rq=="")){
224   - SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd");
225   - try {
226   - map.put("rq_eq", sdfMonth.parse(rq));
227   - } catch (ParseException e) {
228   - // TODO Auto-generated catch block
229   - e.printStackTrace();
230   - }
231   - }
232   - List<Ylb> ylb= (List<Ylb>)yblService.list(map);
  234 + List<Ylb> ylb= yblService.listYlb(map);
233 235 // (new CustomerSpecs<Ylb>(map)).iterator();
234 236 List<Map<String, Object>> resList = new ArrayList<Map<String, Object>>();
235 237 for (Ylb y : ylb) {
... ... @@ -245,12 +247,28 @@ public class YlbController extends BaseController&lt;Ylb, Integer&gt;{
245 247 m.put("czyl", y.getCzyl());
246 248 m.put("jzyl", y.getJzyl());
247 249 m.put("yh", y.getYh());
248   - m.put("rylx", y.getRylx());
  250 + String rylx="";
  251 + if(y.getRylx()!=null){
  252 + if(y.getRylx().equals("0")){rylx="0号柴油";}
  253 + if(y.getRylx().equals("1")){rylx="负10号柴油";}
  254 + }
  255 + m.put("rylx", rylx);
249 256 m.put("ns", y.getNs());
250   - m.put("shyy", y.getShyy());
  257 + String shyy ="无";
  258 + if(y.getShyy()!=null){
  259 + if(shyy.equals("1")){shyy="票务用油";}
  260 + else if(shyy.equals("2")){shyy="保养用油";}
  261 + else if(shyy.equals("3")){shyy="报废车用油";}
  262 + else if(shyy.equals("4")){shyy="其它用油";}
  263 + else if(shyy.equals("5")){shyy="人保部";}
  264 + else if(shyy.equals("6")){shyy="车队";}
  265 + else if(shyy.equals("7")){shyy="车间(高保)";}
  266 + else if(shyy.equals("8")){shyy="车间(小修)";}
  267 + else{shyy ="无";}
  268 + }
  269 + m.put("shyy", shyy);
251 270 m.put("sh", y.getSh());
252 271 m.put("zlc", y.getZlc());
253   - m.put("yhlx", y.getYhlx());
254 272 m.put("bglyh", y.getBglyh());
255 273 resList.add(m);
256 274 }
... ... @@ -258,7 +276,7 @@ public class YlbController extends BaseController&lt;Ylb, Integer&gt;{
258 276 listI.add(resList.iterator());
259 277 String path = this.getClass().getResource("/").getPath()+"static/pages/forms/";
260 278 ee.excelReplace(listI, new Object[] { map }, path+"mould/list.xls",
261   - path+"export/进出场存油量" + sdfSimple.format(sdfMonth.parse(map.get("rq").toString())) + ".xls");
  279 + path+"export/"+map.get("rq").toString()+ "进出场存油量.xls");
262 280 } catch (Exception e) {
263 281 e.printStackTrace();
264 282 }
... ...
src/main/java/com/bsth/repository/oil/YlbRepository.java
... ... @@ -76,6 +76,23 @@ public interface YlbRepository extends BaseRepository&lt;Ylb, Integer&gt;{
76 76 List<Object[]> checkNbmmNum(String rq, String gsbm,String fgsbm,String xlbm,String nbbm);
77 77  
78 78  
  79 + /**
  80 + *
  81 + * @param nbbm
  82 + * @param rq
  83 + * @param xlbm
  84 + * @return
  85 + */
  86 + @Transactional
  87 + @Modifying
  88 + @Query(value="select nbbm,sum(jzl*100) as jzl ,sum(zlc*100) as zlc from bsth_c_ylb where to_days(?1)=to_days(rq) and "
  89 + + " ssgsdm like %?2% "
  90 + + " and fgsdm like %?3%"
  91 + + " and xlbm like %?4% and nbbm like %?5% "
  92 + + " group by nbbm,rq,ssgsdm,fgsdm,xlbm",nativeQuery=true)
  93 + List<Object[]> checkNbmmYl(String rq, String gsbm,String fgsbm,String xlbm,String nbbm);
  94 +
  95 +
79 96 @Query(value="select jzl,yh,sh from Ylb s "
80 97 + " where to_days(?1)=to_days(s.rq) "
81 98 + " and s.ssgsdm like %?2% "
... ...
src/main/java/com/bsth/service/oil/YlbService.java
... ... @@ -23,4 +23,6 @@ public interface YlbService extends BaseService&lt;Ylb, Integer&gt;{
23 23 List<Ylb> listYlb(Map<String, Object> map);
24 24 StringBuffer checkNbmmNum(String rq, String gsbm,String fgsbm,String xlbm,String nbbm,int lx);
25 25  
  26 + Map<String, Object> deleteIds(Map<String, Object> map) throws Exception;
  27 +
26 28 }
... ...
src/main/java/com/bsth/service/oil/impl/YlbServiceImpl.java
... ... @@ -30,6 +30,7 @@ import com.alibaba.fastjson.JSONObject;
30 30 import com.bsth.common.ResponseCode;
31 31 import com.bsth.data.BasicData;
32 32 import com.bsth.entity.Cars;
  33 +import com.bsth.entity.Line;
33 34 import com.bsth.entity.oil.Cyl;
34 35 import com.bsth.entity.oil.Ylb;
35 36 import com.bsth.entity.oil.Ylxxb;
... ... @@ -178,6 +179,7 @@ public class YlbServiceImpl extends BaseServiceImpl&lt;Ylb,Integer&gt; implements YlbS
178 179 t.setFgsdm(map.get("bCompany")==null?"":map.get("bCompany").toString());
179 180 t.setJhsj(map.get("fcsj")==null?"":map.get("fcsj").toString());
180 181 t.setRq(sdf.parse(rq));
  182 + t.setCreatetime(dNow);
181 183 repository.save(t);
182 184  
183 185 }
... ... @@ -202,6 +204,7 @@ public class YlbServiceImpl extends BaseServiceImpl&lt;Ylb,Integer&gt; implements YlbS
202 204 public Map<String, Object> obtain(Map<String, Object> map2) throws Exception{
203 205 Map<String, Object> newMap = new HashMap<String, Object>();
204 206 try {
  207 + Date date=new Date();
205 208 List<Cars> carsList = carsRepository.findCars();
206 209 Map<String, Boolean> carsMap = new HashMap<String, Boolean>();
207 210 for (int i = 0; i < carsList.size(); i++) {
... ... @@ -312,12 +315,7 @@ public class YlbServiceImpl extends BaseServiceImpl&lt;Ylb,Integer&gt; implements YlbS
312 315 jzl =Arith.add(jzl, ylxxb.getJzl());
313 316 }
314 317 }
315   - if(map.get("clZbh").toString().equals("W0A-212")){
316   - System.out.println();
317   - }
318   - if(map.get("clZbh").toString().equals("W0A-211")){
319   - System.out.println();
320   - }
  318 +
321 319 t.setJzl(jzl);
322 320 t.setNbbm(map.get("clZbh").toString());
323 321 t.setJsy(map.get("jGh") == null ? "" : map.get("jGh").toString());
... ... @@ -329,6 +327,7 @@ public class YlbServiceImpl extends BaseServiceImpl&lt;Ylb,Integer&gt; implements YlbS
329 327 t.setFgsdm(map.get("bCompany") == null ? "" : map.get("bCompany").toString());
330 328 t.setJhsj(map.get("fcsj")==null?"":map.get("fcsj").toString());
331 329 t.setRq(sdf.parse(rq));
  330 + t.setCreatetime(date);
332 331 if(type.equals("add")){
333 332 addList.add(t);
334 333 }else{
... ... @@ -385,8 +384,6 @@ public class YlbServiceImpl extends BaseServiceImpl&lt;Ylb,Integer&gt; implements YlbS
385 384 nbbm=map.get("nbbm_eq").toString();
386 385 }
387 386  
388   - List<Cyl> cylListAdd=new ArrayList<Cyl>();
389   - Map<String, Object> cylMapAdd=new HashMap<String,Object>();
390 387 Map<String, Object> newMap=new HashMap<String,Object>();
391 388 Map<String, Object> map2=new HashMap<String,Object>();
392 389 try {
... ... @@ -456,7 +453,10 @@ public class YlbServiceImpl extends BaseServiceImpl&lt;Ylb,Integer&gt; implements YlbS
456 453 nextJzyl=ylxs;
457 454 } else {
458 455 t.setCzyl(nextJzyl);
459   - Double yh = Double.parseDouble(df.format(zyl * (t.getZlc() / zlc)));
  456 + Double yh=0.0;
  457 + if(zlc>0){
  458 + yh= Double.parseDouble(df.format(zyl * (t.getZlc() / zlc)));
  459 + }
460 460 nextJzyl =Arith.sub( Arith.add(t.getJzl(),nextJzyl),yh);
461 461 long l=Math.round(nextJzyl);
462 462 double ylxs=l*100/100;
... ... @@ -466,16 +466,21 @@ public class YlbServiceImpl extends BaseServiceImpl&lt;Ylb,Integer&gt; implements YlbS
466 466 t.setJzyl(ylxs);
467 467 nextJzyl= ylxs;
468 468 }
469   -
470 469 repository.save(t);
  470 + for (int z = 0; z < cylList.size(); z++) {
  471 + Cyl cyl = cylList.get(z);
  472 + if (t.getNbbm().equals(cyl.getNbbm())) {
  473 + cyl.setCyl(t.getJzyl());
  474 + cyl.setUpdatetime(t.getRq());
  475 + break;
  476 + }
  477 + cylRepository.save(cyl);
  478 + }
471 479 }
472 480 map2.put("status", ResponseCode.SUCCESS);
473 481 }
474 482 }
475 483 }
476   - for (int i = 0; i < cylListAdd.size(); i++) {
477   - cylRepository.save(cylListAdd.get(i));
478   - }
479 484 } catch (Exception e) {
480 485 map2.put("status", ResponseCode.ERROR);
481 486 logger.error("save erro.", e);
... ... @@ -647,9 +652,17 @@ public class YlbServiceImpl extends BaseServiceImpl&lt;Ylb,Integer&gt; implements YlbS
647 652 // xlbm=map.get("xlbm_like").toString();
648 653 // }
649 654 // TODO Auto-generated method stub
  655 +
  656 + List<Cars> carsList = carsRepository.findCars();
  657 + Map<String, String> carsMap = new HashMap<String, String>();
  658 + for (int i = 0; i < carsList.size(); i++) {
  659 + Cars c = carsList.get(i);
  660 + carsMap.put(c.getInsideCode(), c.getBrancheCompanyCode()==null?"":c.getBrancheCompanyCode());
  661 + }
  662 +
650 663 try{
651 664 //获取车辆存油信息
652   - List<Cyl> cylList=cylRepository.findAll(new CustomerSpecs<Cyl>(newMap));
  665 +
653 666 String rq=map.get("rq").toString();
654 667 String xlbm="";
655 668 if(map.get("xlbm_like")!=null){
... ... @@ -667,6 +680,8 @@ public class YlbServiceImpl extends BaseServiceImpl&lt;Ylb,Integer&gt; implements YlbS
667 680 if(map.get("nbbm_eq")!=null){
668 681 nbbm=map.get("nbbm_eq").toString();
669 682 }
  683 + List<Ylb> ylListBe=repository.obtainYlbefore(rq, gsbm, fgsbm, xlbm, nbbm);
  684 + List<Cyl> cylList=cylRepository.obtainCyl(nbbm, gsbm);
670 685 List<Ylb> ylbList=repository.obtainYl(rq,gsbm,fgsbm,xlbm,nbbm,"nbbm");
671 686 List<Ylxxb> ylxxbList=ylxxbRepository.obtainYlxx(rq,0,gsbm);
672 687 for (int i = 0; i < ylxxbList.size(); i++) {
... ... @@ -681,14 +696,49 @@ public class YlbServiceImpl extends BaseServiceImpl&lt;Ylb,Integer&gt; implements YlbS
681 696 }
682 697  
683 698 if(fage){
  699 + Cyl cyl=null;
684 700 Ylb t=new Ylb();
685 701 t.setNbbm(y1.getNbbm());
686 702 t.setRq(y1.getYyrq());
687 703 t.setJsy(y1.getJsy());
688 704 t.setJzl(y1.getJzl());
689 705 t.setSsgsdm(y1.getGsdm());
690   - t.setXlbm(xlbm);
  706 + t.setFgsdm(carsMap.get(y1.getNbbm()));
  707 + Line line= BasicData.nbbm2LineMap.get(y1.getNbbm());
  708 + if(null !=line)
  709 + t.setXlbm(line.getLineCode());
  710 + t.setJcsx(1);
  711 + boolean status=true;
  712 + for (int j = 0; j < ylListBe.size(); j++) {
  713 + Ylb b=ylListBe.get(j);
  714 + if(b.getNbbm().equals(y1.getNbbm())){
  715 + t.setCzyl(b.getJzyl());
  716 + status=false;
  717 + break;
  718 + }
  719 + }
  720 + if(status){
  721 + for (int j = 0; j < cylList.size(); j++) {
  722 + Cyl c=cylList.get(j);
  723 + if(c.getNbbm().equals(y1.getNbbm())){
  724 + t.setCzyl(c.getCyl());
  725 + cyl=c;
  726 + status=false;
  727 + break;
  728 + }
  729 + }
  730 + }
  731 + if(status){
  732 + t.setCzyl(0.0);
  733 + }
  734 +// double jzyl=Arith.add(t.getJzl(), t.getCzyl());
  735 + t.setJzyl(Arith.add(t.getJzl(), t.getCzyl()));
  736 + t.setYh(0.0);
691 737 repository.save(t);
  738 + if(null!=cyl){
  739 + cyl.setCyl(Arith.add(t.getJzl(), t.getCzyl()));
  740 + cylRepository.save(cyl);
  741 + }
692 742 }
693 743 }
694 744 newMap.put("status", ResponseCode.SUCCESS);
... ... @@ -862,23 +912,52 @@ public class YlbServiceImpl extends BaseServiceImpl&lt;Ylb,Integer&gt; implements YlbS
862 912 listYlb=repository.listYlb(rq, gsbm, fgsbm, xlbm, stringList);
863 913 }
864 914 }else{
865   - List<Object[]> objectLists=repository.checkNbmmNum(rq, gsbm, fgsbm, xlbm,nbbm);
866   - for (int i = 0; i < objectLists.size(); i++) {
867   - String clbm=objectLists.get(i)[0].toString();
868   - int cs=Integer.parseInt(objectLists.get(i)[1].toString());
869   - //一车一单
870   - if(sxtj.equals("1")){
871   - if(cs==1){
  915 + List<Object[]> objectLists;
  916 + if(sxtj.equals("3")){
  917 + //有加油没里程
  918 + objectLists=repository.checkNbmmYl(rq, gsbm, fgsbm, xlbm, nbbm);
  919 + for (int i = 0; i < objectLists.size(); i++) {
  920 + String clbm=objectLists.get(i)[0].toString();
  921 + double jzl=Double.parseDouble(objectLists.get(i)[1].toString());
  922 + double zlc=Double.parseDouble(objectLists.get(i)[2].toString());
  923 + if(jzl>0 && zlc<=0){
872 924 stringList.add(clbm);
873 925 }
874   - }
875   - //一车多单
876   - if(sxtj.equals("2")){
877   - if(cs>1){
  926 +
  927 + }
  928 +
  929 + }else if(sxtj.equals("4")){
  930 + //有里程没加油
  931 + objectLists=repository.checkNbmmYl(rq, gsbm, fgsbm, xlbm, nbbm);
  932 + for (int i = 0; i < objectLists.size(); i++) {
  933 + String clbm=objectLists.get(i)[0].toString();
  934 + double jzl=Double.parseDouble(objectLists.get(i)[1].toString());
  935 + double zlc=Double.parseDouble(objectLists.get(i)[2].toString());
  936 + if(zlc>0 && jzl<=0){
878 937 stringList.add(clbm);
879 938 }
  939 +
  940 + }
  941 + }else{
  942 + objectLists=repository.checkNbmmNum(rq, gsbm, fgsbm, xlbm,nbbm);
  943 + for (int i = 0; i < objectLists.size(); i++) {
  944 + String clbm=objectLists.get(i)[0].toString();
  945 + int cs=Integer.parseInt(objectLists.get(i)[1].toString());
  946 + //一车一单
  947 + if(sxtj.equals("1")){
  948 + if(cs==1){
  949 + stringList.add(clbm);
  950 + }
  951 + }
  952 + //一车多单
  953 + if(sxtj.equals("2")){
  954 + if(cs>1){
  955 + stringList.add(clbm);
  956 + }
  957 + }
880 958 }
881 959 }
  960 +
882 961 if(stringList.size()>0){
883 962 listYlb=repository.listYlb(rq, gsbm, fgsbm, xlbm, stringList);
884 963 }
... ... @@ -894,10 +973,12 @@ public class YlbServiceImpl extends BaseServiceImpl&lt;Ylb,Integer&gt; implements YlbS
894 973 // TODO Auto-generated method stub
895 974 Map<String, Object> newMap=new HashMap<String,Object>();
896 975 try{
  976 + SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd");
897 977 String json =StringEscapeUtils.unescapeHtml4(map.get("ylbList").toString());
898 978 JSONArray jsonArray=JSONArray.parseArray(json);
899 979 JSONObject jsonObject;
900   -
  980 + // 获取车辆存油信息
  981 + List<Cyl> cylList = cylRepository.obtainCyl("","");
901 982 for (int i = 0; i < jsonArray.size(); i++) {
902 983 // Ylb t=new Ylb();
903 984 jsonObject=jsonArray.getJSONObject(i);
... ... @@ -910,6 +991,8 @@ public class YlbServiceImpl extends BaseServiceImpl&lt;Ylb,Integer&gt; implements YlbS
910 991 String rylx =jsonObject.getString("rylx");
911 992 int yhlx =jsonObject.getIntValue("yhlx");
912 993 Integer id =jsonObject.getInteger("id");
  994 + String nbbm =jsonObject.getString("nbbm");
  995 + String rq=jsonObject.getString("rq");
913 996 double yh = Arith.sub(Arith.add(czyl, jzl), jzyl);
914 997 /*t.setJzyl(jzyl);
915 998 t.setSh(sh);
... ... @@ -918,6 +1001,15 @@ public class YlbServiceImpl extends BaseServiceImpl&lt;Ylb,Integer&gt; implements YlbS
918 1001 t.setRylx(rylx);
919 1002 t.setId(jsonObject.getInteger("id"));*/
920 1003 repository.ylbUpdate(id, czyl, jzyl, yh, sh, shyy, ns, rylx,yhlx);
  1004 + for (int z = 0; z < cylList.size(); z++) {
  1005 + Cyl cyl = cylList.get(z);
  1006 + if (nbbm.equals(cyl.getNbbm())) {
  1007 + cyl.setCyl(jzyl);
  1008 + cyl.setUpdatetime(sdf.parse(rq));
  1009 + break;
  1010 + }
  1011 + cylRepository.save(cyl);
  1012 + }
921 1013 }
922 1014 // List<Map<String, Object>> list=(List<Map<String, Object>>) map.get("ylbList");
923 1015  
... ... @@ -986,8 +1078,6 @@ public class YlbServiceImpl extends BaseServiceImpl&lt;Ylb,Integer&gt; implements YlbS
986 1078 Double zyl = 0.0;
987 1079 Double nextJzyl = 0.0;
988 1080 // 车的,进,出油量及耗油
989   - Map<String, Object> cylMapAdd=new HashMap<String,Object>();
990   - List<Cyl> cylListAdd=new ArrayList<Cyl>();
991 1081 for (int i = 0; i < iterator2.size(); i++) {
992 1082 Ylb t = iterator2.get(i);
993 1083 if (t.getJcsx() == 1) {
... ... @@ -1029,9 +1119,15 @@ public class YlbServiceImpl extends BaseServiceImpl&lt;Ylb,Integer&gt; implements YlbS
1029 1119 nextJzyl=ylxs;
1030 1120 }
1031 1121 repository.save(t);
1032   - }
1033   - for (int i = 0; i < cylListAdd.size(); i++) {
1034   - cylRepository.save(cylListAdd.get(i));
  1122 + for (int z = 0; z < cylList.size(); z++) {
  1123 + Cyl cyl = cylList.get(z);
  1124 + if (t.getNbbm().equals(cyl.getNbbm())) {
  1125 + cyl.setCyl(t.getJzyl());
  1126 + cyl.setUpdatetime(t.getRq());
  1127 + break;
  1128 + }
  1129 + cylRepository.save(cyl);
  1130 + }
1035 1131 }
1036 1132 newMap.put("status", ResponseCode.SUCCESS);
1037 1133 }
... ... @@ -1052,9 +1148,9 @@ public class YlbServiceImpl extends BaseServiceImpl&lt;Ylb,Integer&gt; implements YlbS
1052 1148 String jsy =map.get("jsy").toString();
1053 1149 String xlbm=map.get("xlbm").toString();
1054 1150 List<Ylb> list= repository.checkYlb(rq, nbbm, jsy,xlbm,"nbbm");
1055   - String type="";
  1151 + String type="1";
1056 1152 if(list.size()>0){
1057   - type="cunzai";
  1153 + type="0";
1058 1154 }
1059 1155 return type;
1060 1156 }
... ... @@ -1070,17 +1166,51 @@ public class YlbServiceImpl extends BaseServiceImpl&lt;Ylb,Integer&gt; implements YlbS
1070 1166 String jhsj=t.getJhsj();
1071 1167 String jsy=t.getJsy();
1072 1168 String nbbm=t.getNbbm();
1073   - List<Ylb> list=repository.checkYlb(rq, nbbm, jsy, xlbm,"jhsj");
  1169 + t.setCreatetime(new Date());
  1170 + String[] jhsjStr = jhsj.split(":");
  1171 + long fcsjL= Long.parseLong(jhsjStr[0])*60+Long.parseLong(jhsjStr[1]);
  1172 + List<Ylb> list=repository.obtainYl(rq, gsdm, fgsdm, xlbm, nbbm, "jhsj");
  1173 + int jcsx=1;
1074 1174 if(list.size()>0){
1075 1175 for (int i = 0; i < list.size(); i++) {
1076 1176 Ylb y=list.get(i);
1077   - String jhsj2=y.getJhsj();
  1177 + String[] fcsjStr = y.getJhsj().split(":");
  1178 + long fcsj=Long.parseLong(fcsjStr[0])*60+Long.parseLong(fcsjStr[1]);
  1179 + if(fcsjL>fcsj){
  1180 + jcsx=jcsx+y.getJcsx();
  1181 + }else{
  1182 + y.setJcsx(y.getJcsx()+1);
  1183 + repository.save(y);
  1184 + }
1078 1185 }
1079   - }else{
1080   - t.setJcsx(1);
  1186 +
1081 1187 }
  1188 + t.setJcsx(jcsx);
  1189 + repository.save(t);
1082 1190 map.put("status", ResponseCode.SUCCESS);
1083 1191 map.put("t", t);
1084   - return null;
  1192 + return map;
  1193 + }
  1194 + @Transactional
  1195 + @Override
  1196 + public Map<String, Object> deleteIds(Map<String, Object> map) throws Exception{
  1197 + // TODO Auto-generated method stub
  1198 + Map<String, Object> maps = new HashMap<>();
  1199 + try{
  1200 + String json =StringEscapeUtils.unescapeHtml4(map.get("ids").toString());
  1201 + JSONArray jsonArray=JSONArray.parseArray(json);
  1202 + JSONObject jsonObject;
  1203 + for (int x = 0; x < jsonArray.size(); x++) {
  1204 + jsonObject=jsonArray.getJSONObject(x);
  1205 + Integer id =jsonObject.getInteger("id");
  1206 + repository.delete(id);
  1207 + }
  1208 + maps.put("status", ResponseCode.SUCCESS);
  1209 + } catch (Exception e) {
  1210 + maps.put("status", ResponseCode.ERROR);
  1211 + logger.error("save erro.", e);
  1212 + throw e;
  1213 + }
  1214 + return maps;
1085 1215 }
1086 1216 }
... ...
src/main/java/com/bsth/service/realcontrol/impl/ScheduleRealInfoServiceImpl.java
... ... @@ -89,6 +89,9 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
89 89  
90 90 @Autowired
91 91 SectionRouteService sectionRouteService;
  92 +
  93 + @Autowired
  94 + CulateMileageService culateMieageService;
92 95  
93 96 /*@Autowired
94 97 BorrowCenter borrowCenter;*/
... ... @@ -3045,12 +3048,13 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
3045 3048 String jName = yesterdayDataList.get(x).get("jGh").toString();
3046 3049 String clZbh = yesterdayDataList.get(x).get("clZbh").toString();
3047 3050  
3048   - double jhlc = 0, yygl = 0, ksgl = 0, tempJhlc = 0, jcclc = 0;
  3051 +// double jhlc = 0, yygl = 0, ksgl = 0, tempJhlc = 0, jcclc = 0;
3049 3052 double addMileage = 0, remMileage = 0;
3050 3053 Map<String, Object> map = new HashMap<String, Object>();
3051 3054 boolean fage = true;
3052 3055 String company="";
3053 3056 String bCompany="";
  3057 + List<ScheduleRealInfo> listS=new ArrayList<ScheduleRealInfo>();
3054 3058 for (ScheduleRealInfo scheduleRealInfo : lists) {
3055 3059 if(scheduleRealInfo.getjGh().equals(jName) && scheduleRealInfo.getClZbh().equals(clZbh)){
3056 3060 if (fage) {
... ... @@ -3059,7 +3063,9 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
3059 3063 bCompany=scheduleRealInfo.getFgsBm();
3060 3064 fage = false;
3061 3065 }
3062   - if (scheduleRealInfo != null) {
  3066 + listS.add(scheduleRealInfo);
  3067 +
  3068 + /* if (scheduleRealInfo != null) {
3063 3069 //计划里程(主任务过滤掉临加班次),
3064 3070 //烂班里程(主任务烂班),
3065 3071 //临加里程(主任务临加),
... ... @@ -3118,16 +3124,22 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
3118 3124 }
3119 3125 }
3120 3126 }
3121   - }
  3127 + }*/
3122 3128 }
3123 3129 }
  3130 +
3124 3131 yesterdayDataList.get(x).put("company", company);
3125 3132 yesterdayDataList.get(x).put("bCompany", bCompany);
3126   - Double zgl=Arith.add(yygl,ksgl);
3127   - yesterdayDataList.get(x).put("totalKilometers", Arith.add(zgl, jcclc));
  3133 +// Double zgl=Arith.add(yygl,ksgl);
  3134 + Double ljgl=culateMieageService.culateLjgl(listS);
  3135 + Double sjgl=culateMieageService.culateSjgl(listS);
  3136 + Double ksgl=culateMieageService.culateKsgl(listS);
  3137 + Double jccgl=culateMieageService.culateJccgl(listS);
  3138 + Double zyygl=Arith.add(sjgl, ljgl);
  3139 + Double zksgl=Arith.add(ksgl, jccgl);
  3140 + yesterdayDataList.get(x).put("totalKilometers", Arith.add(zyygl, zksgl));
3128 3141  
3129 3142 }
3130   - System.out.println();
3131 3143 //增加顺序号
3132 3144 for (int i = 0; i < yesterdayDataList.size(); i++) {
3133 3145 if (i == 0) {
... ...
src/main/resources/static/pages/forms/mould/list.xls
No preview for this file type
src/main/resources/static/pages/oil/add.html
... ... @@ -20,10 +20,12 @@
20 20 </div>
21 21 <div class="portlet-body form">
22 22 <form action="/addYlb" class="form-horizontal" id="ylb_add_form" >
  23 +
23 24 <div class="alert alert-danger display-hide">
24 25 <button class="close" data-close="alert"></button>
25 26 您的输入有误,请检查下面的输入项
26 27 </div>
  28 + <input type="hidden" value="0" name="yhlx" />
27 29 <div class="form-body">
28 30 <div class="form-group">
29 31 <label class="col-md-3 control-label">公司</label>
... ... @@ -66,81 +68,102 @@
66 68 <label class="col-md-3 control-label">驾驶员</label>
67 69 <div class="col-md-4">
68 70 <select class="form-control" name="jsy" id="jsy"> </select>
69   - <input type="hidden" name="ssgsdm" id="ssgsdm" />
70 71 </div>
71 72 </div>
72 73  
73 74 <div class="form-group">
74 75 <label class="col-md-3 control-label">出场里程</label>
75 76 <div class="col-md-4">
76   - <input type="text" class="form-control" name="czlc" >
  77 + <input type="text" class="form-control" name="czlc" onkeyup="this.value=this.value.replace(/[^(\d||/.)]/g,'').replace('.','$#$').replace(/\./g,'').replace('$#$','.')"
  78 + onafterpaste="this.value=this.value.replace(/[^(\d||/.)]/g,'').replace('.','$#$').replace(/\./g,'').replace('$#$','.')">
77 79 </div>
78 80 </div>
79 81  
80 82 <div class="form-group">
81 83 <label class="col-md-3 control-label">出场油量</label>
82 84 <div class="col-md-4">
83   - <input type="text" class="form-control" name="czyl" >
  85 + <input type="text" class="form-control" name="czyl" onkeyup="this.value=this.value.replace(/[^(\d||/.)]/g,'').replace('.','$#$').replace(/\./g,'').replace('$#$','.')"
  86 + onafterpaste="this.value=this.value.replace(/[^(\d||/.)]/g,'').replace('.','$#$').replace(/\./g,'').replace('$#$','.')">
84 87 </div>
85 88 </div>
86 89  
87 90 <div class="form-group">
88 91 <label class="col-md-3 control-label">加油量</label>
89 92 <div class="col-md-4">
90   - <input type="text" class="form-control" name="jzl" >
  93 + <input type="text" class="form-control" name="jzl" onkeyup="this.value=this.value.replace(/[^(\d||/.)]/g,'').replace('.','$#$').replace(/\./g,'').replace('$#$','.')"
  94 + onafterpaste="this.value=this.value.replace(/[^(\d||/.)]/g,'').replace('.','$#$').replace(/\./g,'').replace('$#$','.')">
91 95 </div>
92 96 </div>
93 97  
94 98 <div class="form-group">
95 99 <label class="col-md-3 control-label">进场油量</label>
96 100 <div class="col-md-4">
97   - <input type="text" class="form-control" name="jzyl" >
  101 + <input type="text" class="form-control" name="jzyl" onkeyup="this.value=this.value.replace(/[^(\d||/.)]/g,'').replace('.','$#$').replace(/\./g,'').replace('$#$','.')"
  102 + onafterpaste="this.value=this.value.replace(/[^(\d||/.)]/g,'').replace('.','$#$').replace(/\./g,'').replace('$#$','.')">
98 103 </div>
99 104 </div>
100 105  
101 106 <div class="form-group">
102 107 <label class="col-md-3 control-label">油耗</label>
103 108 <div class="col-md-4">
104   - <input type="text" class="form-control" name="yh" >
  109 + <input type="text" class="form-control" name="yh" onkeyup="this.value=this.value.replace(/[^(\d||/.)]/g,'').replace('.','$#$').replace(/\./g,'').replace('$#$','.')"
  110 + onafterpaste="this.value=this.value.replace(/[^(\d||/.)]/g,'').replace('.','$#$').replace(/\./g,'').replace('$#$','.')">
105 111 </div>
106 112 </div>
107 113  
108 114 <div class="form-group">
109 115 <label class="col-md-3 control-label">燃油类型</label>
110 116 <div class="col-md-4">
111   - <input type="text" class="form-control" name="rylx" >
  117 + <select name="rylx" class="form-control">
  118 + <option value='0'>0号柴油</option>
  119 + <option value='1'>负10号柴油</option>
  120 + </select>
112 121 </div>
113 122 </div>
114 123  
115 124 <div class="form-group">
116 125 <label class="col-md-3 control-label">尿素</label>
117 126 <div class="col-md-4">
118   - <input type="text" class="form-control" name="ns" >
  127 + <input type="text" class="form-control" name="ns" onkeyup="this.value=this.value.replace(/[^(\d||/.)]/g,'').replace('.','$#$').replace(/\./g,'').replace('$#$','.')"
  128 + onafterpaste="this.value=this.value.replace(/[^(\d||/.)]/g,'').replace('.','$#$').replace(/\./g,'').replace('$#$','.')">
119 129 </div>
120 130 </div>
121 131  
122 132 <div class="form-group">
123 133 <label class="col-md-3 control-label">进场里程</label>
124 134 <div class="col-md-4">
125   - <input type="text" class="form-control" name="jzlc" >
  135 + <input type="text" class="form-control" name="jzlc" onkeyup="this.value=this.value.replace(/[^(\d||/.)]/g,'').replace('.','$#$').replace(/\./g,'').replace('$#$','.')"
  136 + onafterpaste="this.value=this.value.replace(/[^(\d||/.)]/g,'').replace('.','$#$').replace(/\./g,'').replace('$#$','.')">
126 137 </div>
127 138 </div>
128 139 <div class="form-group">
129 140 <label class="col-md-3 control-label">损耗原因</label>
130 141 <div class="col-md-4">
131   - <input type="text" class="form-control" name="shyy" >
  142 + <select class="form-control" name="shyy">
  143 + <option value='0'>请选择</option>
  144 + <option value='1'>票务用油</option>
  145 + <option value='2'>保养用油</option>
  146 + <option value='3'>报废车用油</option>
  147 + <option value='4'>其它用油</option>
  148 + <option value='5'>人保部</option>
  149 + <option value='6'>车队</option>
  150 + <option value='7'>车间(高保)</option>
  151 + <option value='8'>车间(小修)</option>
  152 + </select>
132 153 </div>
133 154 </div>
134 155 <div class="form-group">
135 156 <label class="col-md-3 control-label">损耗油量</label>
136 157 <div class="col-md-4">
137   - <input type="text" class="form-control" name="sh" >
  158 + <input type="text" class="form-control" name="sh" onkeyup="this.value=this.value.replace(/[^(\d||/.)]/g,'').replace('.','$#$').replace(/\./g,'').replace('$#$','.')"
  159 + onafterpaste="this.value=this.value.replace(/[^(\d||/.)]/g,'').replace('.','$#$').replace(/\./g,'').replace('$#$','.')">
138 160 </div>
139 161 </div>
140 162 <div class="form-group">
141 163 <label class="col-md-3 control-label">行驶总里程</label>
142 164 <div class="col-md-4">
143   - <input type="text" class="form-control" name="zlc" >
  165 + <input type="text" class="form-control" name="zlc" onkeyup="this.value=this.value.replace(/[^(\d||/.)]/g,'').replace('.','$#$').replace(/\./g,'').replace('$#$','.')"
  166 + onafterpaste="this.value=this.value.replace(/[^(\d||/.)]/g,'').replace('.','$#$').replace(/\./g,'').replace('$#$','.')">
144 167 </div>
145 168 </div>
146 169  
... ... @@ -165,10 +188,8 @@
165 188 var xlList;
166 189 $.get('/report/lineList',function(result){
167 190 xlList=result;
168   -
169 191 $.get('/user/companyData', function(result){
170 192 obj = result;
171   - console.log(obj);
172 193 var options = '';
173 194 for(var i = 0; i < obj.length; i++){
174 195 options += '<option value="'+obj[i].companyCode+'">'+obj[i].companyName+'</option>';
... ... @@ -291,7 +312,6 @@
291 312 escapeMarkup: function (markup) { return markup; },
292 313 minimumInputLength: 1,
293 314 templateSelection: function(repo){
294   - $("#ssgsdm").val(repo.gs);
295 315 return repo.text;
296 316 },
297 317 language: {
... ... @@ -369,17 +389,15 @@
369 389 map["jsy"]=jsy;
370 390 map["xlbm"]=xlbm;
371 391 //检查一下用户是否存在
372   - $get('/ylb/checkYl', map, function(fage){
373   - console.log(fage);
374   - if(fage!=""){
375   - layer.msg('该驾驶员当天已存在.');
376   - }else{
377   - $post('/ylb/saveYlb', params, function(){
378   - layer.msg('添加信息成功.');
379   - loadPage('list.html');
380   - });
381   - }
382   -
  392 + $get('/ylb/checkJsy', map, function(fage){
  393 + if(fage=="0"){
  394 + layer.msg('该驾驶员当天已存在.');
  395 + }else{
  396 + $post('/ylb/saveYlb', params, function(){
  397 + layer.msg('添加信息成功.');
  398 + loadPage('list_ph.html');
  399 + });
  400 + }
383 401 });
384 402 }
385 403 });
... ...
src/main/resources/static/pages/oil/list_ph.html
... ... @@ -136,6 +136,8 @@
136 136 <option value="0">全部</option>
137 137 <option value="1">一车一单</option>
138 138 <option value="2">一车多单</option>
  139 + <option value="3">有加油没里程</option>
  140 + <option value="4">有里程没加油</option>
139 141 </select>
140 142 </div>
141 143  
... ... @@ -324,6 +326,7 @@ onkeyup=&quot;this.value=this.value.replace(/[^(\d||/.)]/g,&#39;&#39;).replace(&#39;.&#39;,&#39;$#$&#39;).rep
324 326 $('input.icheck').each(function(){
325 327 var map = {};
326 328 var id=$(this).data('id');
  329 + var nbbm =$('.in_carpark_nbbm[data-id='+id+']', '#ll_oil_list').html();
327 330 var jzl =$('.in_carpark_jzl[data-id='+id+']', '#ll_oil_list').html();
328 331 if(jzl=="" || jzl ==null){
329 332 jzl=0;
... ... @@ -360,11 +363,12 @@ onkeyup=&quot;this.value=this.value.replace(/[^(\d||/.)]/g,&#39;&#39;).replace(&#39;.&#39;,&#39;$#$&#39;).rep
360 363 map['ns']=ns;
361 364 map['rylx']=rylx;
362 365 map['yhlx']=yhlx;
  366 + map['nbbm']=nbbm;
  367 + map['rq']=$("#rq").val();
363 368 ylArray.push(map);
364 369 })
365 370 var params = {};
366 371 params['ylbList']=JSON.stringify(ylArray);
367   - console.log(JSON.stringify(ylArray));
368 372 var i = layer.load(2);
369 373 $post('/ylb/saveYlbList', params, function () {
370 374 layer.close(i);
... ... @@ -708,14 +712,30 @@ onkeyup=&quot;this.value=this.value.replace(/[^(\d||/.)]/g,&#39;&#39;).replace(&#39;.&#39;,&#39;$#$&#39;).rep
708 712  
709 713 //删除
710 714 $('#removeButton').on('click', function () {
711   - var id = $('input.icheck:checked').data('id');
712   - if (typeof(id) == 'undefined') {
  715 + var idArray = [];
  716 + var x=0;
  717 + $('input.icheck:checked').each(function(){
  718 + x++;
  719 + var map ={};
  720 + var id=$(this).data('id');
  721 + map['id']=id;
  722 + idArray.push(map);
  723 +
  724 + })
  725 + var params = {};
  726 + params['ids']=JSON.stringify(idArray);
  727 + if (x==0) {
713 728 layer.msg("请选择要删除的数据");
714 729 }else{
715   - removeConfirm('确定要删除选中的数据?', '/ylb/' + id, function () {
716   - var params=getParamsList();
717   - jsDoQuery(params, true);
718   - });
  730 + if(confirm('确定要删除选中的数据?'))
  731 + {
  732 + var i = layer.load(2);
  733 + $post('/ylb/deleteIds', params, function (result) {
  734 + layer.close(i);
  735 + var params=getParamsList();
  736 + jsDoQuery(params, true);
  737 + });
  738 + }
719 739 }
720 740 });
721 741  
... ... @@ -817,7 +837,7 @@ onkeyup=&quot;this.value=this.value.replace(/[^(\d||/.)]/g,&#39;&#39;).replace(&#39;.&#39;,&#39;$#$&#39;).rep
817 837 if ($("#rq").val() != "") {
818 838 var params=getParamsList();
819 839 $post('/ylb/listExport', params, function (result) {
820   - window.open("/downloadFile/download?fileName=进出场存油量" + moment($("#rq").val()).format("YYYYMMDD"));
  840 + window.open("/downloadFile/download?fileName="+$("#rq").val()+"进出场存油量" );
821 841 });
822 842 } else {
823 843 layer.msg('请选择日期.');
... ...
src/main/resources/static/pages/report/inoutstation.html
... ... @@ -69,9 +69,9 @@
69 69 <div class="form-group" style="display: inline-block;margin-left: 15px;">
70 70 <input class="btn btn-default" type="button" id="query" value="查询"/>
71 71 <input class="btn btn-default" type="button" style="display: none;" id="query2" value="查询"/>
72   - <input class="btn btn-default" type="button" id="export" value="导出"/>
73   - <input class="btn btn-default" type="button" id="print" value="打印"/>
74   - <input class="btn btn-default" type="button" id="exportMore" value="批量导出"/>
  72 +<!-- <input class="btn btn-default" type="button" id="export" value="导出"/> -->
  73 +<!-- <input class="btn btn-default" type="button" id="print" value="打印"/> -->
  74 +<!-- <input class="btn btn-default" type="button" id="exportMore" value="批量导出"/> -->
75 75 </div>
76 76 </div>
77 77 </form>
... ...