Commit d6b411f484f8e707064bcc72030db84fa3df0db1

Authored by 廖磊
1 parent 1cb69210

油量查询 电量查询优化

src/main/java/com/bsth/repository/oil/DlbRepository.java
1 1 package com.bsth.repository.oil;
2 2  
  3 +import java.util.Date;
3 4 import java.util.List;
4 5  
5 6 import org.springframework.data.jpa.repository.Modifying;
... ... @@ -41,6 +42,14 @@ public interface DlbRepository extends BaseRepository<Dlb, Integer>{
41 42 + " and s.nbbm in ?5 order by nbbm,jcsx")
42 43 List<Dlb> listDlb(String rq, String gsbm,String fgsbm,String xlbm,List<String> listNbbm);
43 44  
  45 + @Query(value="select s from Dlb s "
  46 + + " where s.rq=?1 "
  47 + + " and s.ssgsdm like %?2% "
  48 + + " and s.fgsdm like %?3%"
  49 + + " and s.xlbm like %?4% "
  50 + + " and s.nbbm in ?5 order by nbbm,jcsx")
  51 + List<Dlb> listDlb_s(Date rq, String gsbm,String fgsbm,String xlbm,List<String> listNbbm);
  52 +
44 53  
45 54 /**
46 55 *
... ... @@ -73,6 +82,15 @@ public interface DlbRepository extends BaseRepository&lt;Dlb, Integer&gt;{
73 82 + " and s.nbbm in ?5 ")
74 83 List<Object[]> sumDlb(String rq, String gsbm,String fgsbm,String xlbm,List<String> listNbbm);
75 84  
  85 + @Query(value="select cdl,hd,sh from Dlb s "
  86 + + " where s.rq=?1"
  87 + + " and s.ssgsdm like %?2% "
  88 + + " and s.fgsdm like %?3%"
  89 + + " and s.xlbm like %?4% "
  90 + + " and s.nbbm in ?5 ")
  91 + List<Object[]> sumDlb_s(Date rq, String gsbm,String fgsbm,String xlbm,List<String> listNbbm);
  92 +
  93 +
76 94 @Query(value="select ifnull(cdl,0),ifnull(hd,0),ifnull(sh,0) from bsth_c_dlb "
77 95 + " where rq=?1 "
78 96 + " and ssgsdm like %?2% "
... ...
src/main/java/com/bsth/repository/oil/YlbRepository.java
... ... @@ -133,6 +133,15 @@ public interface YlbRepository extends BaseRepository&lt;Ylb, Integer&gt;{
133 133 + " and s.nbbm in ?5 ")
134 134 List<Object[]> sumYlb(String rq, String gsbm,String fgsbm,String xlbm,List<String> listNbbm);
135 135  
  136 + @Query(value="select jzl,yh,sh from Ylb s "
  137 + + " where s.rq=?1 "
  138 + + " and s.ssgsdm like %?2% "
  139 + + " and s.fgsdm like %?3%"
  140 + + " and s.xlbm like %?4% "
  141 + + " and s.nbbm in ?5 ")
  142 + List<Object[]> sumYlb_s(Date rq, String gsbm,String fgsbm,String xlbm,List<String> listNbbm);
  143 +
  144 +
136 145 @Query(value="select ifnull(jzl,0),ifnull(yh,0),ifnull(sh,0) from bsth_c_ylb "
137 146 + " where rq=?1 "
138 147 + " and ssgsdm like %?2% "
... ... @@ -151,6 +160,14 @@ public interface YlbRepository extends BaseRepository&lt;Ylb, Integer&gt;{
151 160 + " and s.nbbm in ?5 order by nbbm,jcsx")
152 161 List<Ylb> listYlb(String rq, String gsbm,String fgsbm,String xlbm,List<String> listNbbm);
153 162  
  163 + @Query(value="select s from Ylb s "
  164 + + " where s.rq=?1 "
  165 + + " and s.ssgsdm =?2 "
  166 + + " and s.fgsdm =?3 "
  167 + + " and s.xlbm like %?4% "
  168 + + " and s.nbbm in ?5 order by nbbm,jcsx")
  169 + List<Ylb> listYlb_s(Date rq, String gsbm,String fgsbm,String xlbm,List<String> listNbbm);
  170 +
154 171  
155 172 @Transactional
156 173 @Modifying
... ...
src/main/java/com/bsth/service/oil/impl/DlbServiceImpl.java
... ... @@ -662,82 +662,97 @@ public class DlbServiceImpl extends BaseServiceImpl&lt;Dlb,Integer&gt; implements DlbS
662 662 @Override
663 663 public List<Dlb> listDlb(Map<String, Object> map) {
664 664 // TODO Auto-generated method stub
665   - List<Dlb> listDlb=new ArrayList<Dlb>();
666   - List<String> stringList=new ArrayList<String>();
667   - String rq=map.get("rq").toString();
668   - String gsbm=map.get("ssgsdm_like").toString();
669   - String fgsbm=map.get("fgsdm_like").toString();
670   - String xlbm=map.get("xlbm_like").toString().trim();
671   - String nbbm=map.get("nbbm_eq").toString();
672   - String sxtj=map.get("sxtj").toString();
673   -
674   - if(nbbm.trim()!=""){
675   - stringList.add(nbbm);
676   - listDlb=repository.listDlb(rq, gsbm, fgsbm, xlbm, stringList);
677   - }else{
678   - //全部
679   - if(sxtj.equals("0")){
680   - List<Object[]> objectLists=repository.checkNbmmNum(rq, gsbm, fgsbm, xlbm,nbbm);
681   - for (int i = 0; i < objectLists.size(); i++) {
682   - String clbm=objectLists.get(i)[0].toString();
683   - stringList.add(clbm);
684   - }
685   - if(stringList.size()>0){
686   - listDlb=repository.listDlb(rq, gsbm, fgsbm, xlbm, stringList);
687   - }
688   - }else{
689   - List<Object[]> objectLists;
690   - if(sxtj.equals("3")){
691   - //有加油没里程
692   - objectLists=repository.checkNbmmDl(rq, gsbm, fgsbm, xlbm, nbbm);
  665 + List<Dlb> listDlb = new ArrayList<Dlb>();
  666 + List<String> stringList = new ArrayList<String>();
  667 + String rq = map.get("rq").toString();
  668 + String gsbm = map.get("ssgsdm_like").toString();
  669 + String fgsbm = map.get("fgsdm_like").toString();
  670 + String xlbm = map.get("xlbm_like").toString().trim();
  671 + String nbbm = map.get("nbbm_eq").toString();
  672 + String sxtj = map.get("sxtj").toString();
  673 + String type = map.get("type").toString();
  674 + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
  675 + try {
  676 + if (nbbm.trim() != "") {
  677 + stringList.add(nbbm);
  678 + if (type.equals("1"))
  679 + listDlb = repository.listDlb(rq, gsbm, fgsbm, xlbm, stringList);
  680 + else
  681 + listDlb = repository.listDlb_s(sdf.parse(rq + " 00:00:00"), gsbm, fgsbm, xlbm, stringList);
  682 +
  683 + } else {
  684 + // 全部
  685 + if (sxtj.equals("0")) {
  686 + List<Object[]> objectLists = repository.checkNbmmNum(rq, gsbm, fgsbm, xlbm, nbbm);
693 687 for (int i = 0; i < objectLists.size(); i++) {
694   - String clbm=objectLists.get(i)[0].toString();
695   - double jzl=Double.parseDouble(objectLists.get(i)[1].toString());
696   - double zlc=Double.parseDouble(objectLists.get(i)[2].toString());
697   - if(jzl>0 && zlc<=0){
698   - stringList.add(clbm);
699   - }
700   -
  688 + String clbm = objectLists.get(i)[0].toString();
  689 + stringList.add(clbm);
701 690 }
702   -
703   - }else if(sxtj.equals("4")){
704   - //有里程没加油
705   - objectLists=repository.checkNbmmDl(rq, gsbm, fgsbm, xlbm, nbbm);
706   - for (int i = 0; i < objectLists.size(); i++) {
707   - String clbm=objectLists.get(i)[0].toString();
708   - double jzl=Double.parseDouble(objectLists.get(i)[1].toString());
709   - double zlc=Double.parseDouble(objectLists.get(i)[2].toString());
710   - if(zlc>0 && jzl<=0){
711   - stringList.add(clbm);
712   - }
713   -
  691 + if (stringList.size() > 0) {
  692 + if (type.equals("1"))
  693 + listDlb = repository.listDlb(rq, gsbm, fgsbm, xlbm, stringList);
  694 + else
  695 + listDlb = repository.listDlb_s(sdf.parse(rq + " 00:00:00"), gsbm, fgsbm, xlbm, stringList);
714 696 }
715   - }else{
716   - objectLists=repository.checkNbmmNum(rq, gsbm, fgsbm, xlbm,nbbm);
717   - for (int i = 0; i < objectLists.size(); i++) {
718   - String clbm=objectLists.get(i)[0].toString();
719   - int cs=Integer.parseInt(objectLists.get(i)[1].toString());
720   - //一车一单
721   - if(sxtj.equals("1")){
722   - if(cs==1){
  697 + } else {
  698 + List<Object[]> objectLists;
  699 + if (sxtj.equals("3")) {
  700 + // 有加油没里程
  701 + objectLists = repository.checkNbmmDl(rq, gsbm, fgsbm, xlbm, nbbm);
  702 + for (int i = 0; i < objectLists.size(); i++) {
  703 + String clbm = objectLists.get(i)[0].toString();
  704 + double jzl = Double.parseDouble(objectLists.get(i)[1].toString());
  705 + double zlc = Double.parseDouble(objectLists.get(i)[2].toString());
  706 + if (jzl > 0 && zlc <= 0) {
723 707 stringList.add(clbm);
724 708 }
725   - }
726   - //一车多单
727   - if(sxtj.equals("2")){
728   - if(cs>1){
  709 +
  710 + }
  711 +
  712 + } else if (sxtj.equals("4")) {
  713 + // 有里程没加油
  714 + objectLists = repository.checkNbmmDl(rq, gsbm, fgsbm, xlbm, nbbm);
  715 + for (int i = 0; i < objectLists.size(); i++) {
  716 + String clbm = objectLists.get(i)[0].toString();
  717 + double jzl = Double.parseDouble(objectLists.get(i)[1].toString());
  718 + double zlc = Double.parseDouble(objectLists.get(i)[2].toString());
  719 + if (zlc > 0 && jzl <= 0) {
729 720 stringList.add(clbm);
730 721 }
  722 +
  723 + }
  724 + } else {
  725 + objectLists = repository.checkNbmmNum(rq, gsbm, fgsbm, xlbm, nbbm);
  726 + for (int i = 0; i < objectLists.size(); i++) {
  727 + String clbm = objectLists.get(i)[0].toString();
  728 + int cs = Integer.parseInt(objectLists.get(i)[1].toString());
  729 + // 一车一单
  730 + if (sxtj.equals("1")) {
  731 + if (cs == 1) {
  732 + stringList.add(clbm);
  733 + }
  734 + }
  735 + // 一车多单
  736 + if (sxtj.equals("2")) {
  737 + if (cs > 1) {
  738 + stringList.add(clbm);
  739 + }
  740 + }
731 741 }
732 742 }
733   - }
734   -
735   - if(stringList.size()>0){
736   - listDlb=repository.listDlb(rq, gsbm, fgsbm, xlbm, stringList);
  743 +
  744 + if (stringList.size() > 0) {
  745 + if (type.equals("1"))
  746 + listDlb = repository.listDlb(rq, gsbm, fgsbm, xlbm, stringList);
  747 + else
  748 + listDlb = repository.listDlb_s(sdf.parse(rq + " 00:00:00"), gsbm, fgsbm, xlbm, stringList);
  749 + }
737 750 }
738 751 }
  752 + } catch (ParseException e) {
  753 + // TODO Auto-generated catch block
  754 + e.printStackTrace();
739 755 }
740   -
741 756 return listDlb;
742 757 }
743 758  
... ... @@ -751,86 +766,97 @@ public class DlbServiceImpl extends BaseServiceImpl&lt;Dlb,Integer&gt; implements DlbS
751 766 String xlbm = map.get("xlbm_like").toString().trim();
752 767 String nbbm = map.get("nbbm_eq").toString();
753 768 String sxtj = map.get("sxtj").toString();
754   - if (nbbm.trim() != "") {
755   - stringList.add(nbbm);
756   - } else {
757   - if (!sxtj.equals("0")) {
758   - List<Object[]> objectLists;
759   - if (sxtj.equals("3")) {
760   - // 有加油没里程
761   - objectLists = repository.checkNbmmDl(rq, gsbm, fgsbm, xlbm, nbbm);
762   - for (int i = 0; i < objectLists.size(); i++) {
763   - String clbm = objectLists.get(i)[0].toString();
764   - double jzl = Double.parseDouble(objectLists.get(i)[1].toString());
765   - double zlc = Double.parseDouble(objectLists.get(i)[2].toString());
766   - if (jzl > 0 && zlc <= 0) {
767   - stringList.add(clbm);
768   - }
769   -
770   - }
  769 + String type = map.get("type").toString();
  770 + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
  771 + List<Object[]> sumYlbList = new ArrayList<Object[]>();
  772 + try {
  773 + if (nbbm.trim() != "") {
  774 + stringList.add(nbbm);
  775 + } else {
  776 + if (!sxtj.equals("0")) {
  777 + List<Object[]> objectLists;
  778 + if (sxtj.equals("3")) {
  779 + // 有加油没里程
  780 + objectLists = repository.checkNbmmDl(rq, gsbm, fgsbm, xlbm, nbbm);
  781 + for (int i = 0; i < objectLists.size(); i++) {
  782 + String clbm = objectLists.get(i)[0].toString();
  783 + double jzl = Double.parseDouble(objectLists.get(i)[1].toString());
  784 + double zlc = Double.parseDouble(objectLists.get(i)[2].toString());
  785 + if (jzl > 0 && zlc <= 0) {
  786 + stringList.add(clbm);
  787 + }
771 788  
772   - } else if (sxtj.equals("4")) {
773   - // 有里程没加油
774   - objectLists = repository.checkNbmmDl(rq, gsbm, fgsbm, xlbm, nbbm);
775   - for (int i = 0; i < objectLists.size(); i++) {
776   - String clbm = objectLists.get(i)[0].toString();
777   - double jzl = Double.parseDouble(objectLists.get(i)[1].toString());
778   - double zlc = Double.parseDouble(objectLists.get(i)[2].toString());
779   - if (zlc > 0 && jzl <= 0) {
780   - stringList.add(clbm);
781 789 }
782 790  
783   - }
784   - } else {
785   - objectLists = repository.checkNbmmNum(rq, gsbm, fgsbm, xlbm, nbbm);
786   - for (int i = 0; i < objectLists.size(); i++) {
787   - String clbm = objectLists.get(i)[0].toString();
788   - int cs = Integer.parseInt(objectLists.get(i)[1].toString());
789   - // 一车一单
790   -
791   - if (sxtj.equals("1")) {
792   - if (cs == 1) {
  791 + } else if (sxtj.equals("4")) {
  792 + // 有里程没加油
  793 + objectLists = repository.checkNbmmDl(rq, gsbm, fgsbm, xlbm, nbbm);
  794 + for (int i = 0; i < objectLists.size(); i++) {
  795 + String clbm = objectLists.get(i)[0].toString();
  796 + double jzl = Double.parseDouble(objectLists.get(i)[1].toString());
  797 + double zlc = Double.parseDouble(objectLists.get(i)[2].toString());
  798 + if (zlc > 0 && jzl <= 0) {
793 799 stringList.add(clbm);
794 800 }
  801 +
795 802 }
796   - // 一车多单
797   - if (sxtj.equals("2")) {
798   - if (cs > 1) {
799   - stringList.add(clbm);
  803 + } else {
  804 + objectLists = repository.checkNbmmNum(rq, gsbm, fgsbm, xlbm, nbbm);
  805 + for (int i = 0; i < objectLists.size(); i++) {
  806 + String clbm = objectLists.get(i)[0].toString();
  807 + int cs = Integer.parseInt(objectLists.get(i)[1].toString());
  808 + // 一车一单
  809 +
  810 + if (sxtj.equals("1")) {
  811 + if (cs == 1) {
  812 + stringList.add(clbm);
  813 + }
  814 + }
  815 + // 一车多单
  816 + if (sxtj.equals("2")) {
  817 + if (cs > 1) {
  818 + stringList.add(clbm);
  819 + }
800 820 }
801 821 }
802 822 }
803 823 }
804 824 }
805   - }
806   - List<Object[]> sumYlbList = new ArrayList<Object[]>();
807 825 if (sxtj.equals("0")) {
808 826 sumYlbList = repository.sumDlb2(rq, gsbm, fgsbm, xlbm, nbbm);
809 827 } else {
810 828 if (stringList.size() > 0) {
811   -
  829 +
812 830 // String strings[]=new String[stringList.size()];
813 831 // for(int i=0;i<stringList.size();i++){
814 832 // strings[i]=stringList.get(i);
815 833 // }
816   - sumYlbList = repository.sumDlb(rq, gsbm, fgsbm, xlbm, stringList);
817   - }
818   -// else {
819   -// sumYlbList = repository.sumDlb2(rq, gsbm, fgsbm, xlbm, nbbm);
820   -// }
821   - }
822   - Double jzl = 0.0, yh = 0.0, sh = 0.0;
823   - for (int i = 0; i < sumYlbList.size(); i++) {
824   - jzl = Arith.add(jzl, Double.valueOf(sumYlbList.get(i)[0].toString()));
825   - yh = Arith.add(yh, Double.valueOf(sumYlbList.get(i)[1].toString()));
826   - sh = Arith.add(sh, Double.valueOf(sumYlbList.get(i)[2].toString()));
  834 + if (type.equals("1"))
  835 + sumYlbList = repository.sumDlb(rq, gsbm, fgsbm, xlbm, stringList);
  836 + else
  837 + sumYlbList = repository.sumDlb_s(sdf.parse(rq + " 00:00:00"), gsbm, fgsbm, xlbm, stringList);
  838 +
  839 + }
  840 + // else {
  841 + // sumYlbList = repository.sumDlb2(rq, gsbm, fgsbm, xlbm, nbbm);
  842 + // }
827 843 }
828   -
829   - Map<String, Object> sumMap = new HashMap<String, Object>();
830   - sumMap.put("jzl", jzl);
831   - sumMap.put("yh", yh);
832   - sumMap.put("sh", sh);
833   - return sumMap;
  844 + } catch (ParseException e) {
  845 + // TODO Auto-generated catch block
  846 + e.printStackTrace();
  847 + }
  848 + Double jzl = 0.0, yh = 0.0, sh = 0.0;
  849 + for (int i = 0; i < sumYlbList.size(); i++) {
  850 + jzl = Arith.add(jzl, Double.valueOf(sumYlbList.get(i)[0].toString()));
  851 + yh = Arith.add(yh, Double.valueOf(sumYlbList.get(i)[1].toString()));
  852 + sh = Arith.add(sh, Double.valueOf(sumYlbList.get(i)[2].toString()));
  853 + }
  854 +
  855 + Map<String, Object> sumMap = new HashMap<String, Object>();
  856 + sumMap.put("jzl", jzl);
  857 + sumMap.put("yh", yh);
  858 + sumMap.put("sh", sh);
  859 + return sumMap;
834 860 }
835 861  
836 862  
... ...
src/main/java/com/bsth/service/oil/impl/YlbServiceImpl.java
... ... @@ -1108,6 +1108,10 @@ public class YlbServiceImpl extends BaseServiceImpl&lt;Ylb,Integer&gt; implements YlbS
1108 1108 String xlbm=map.get("xlbm_like").toString().trim();
1109 1109 String nbbm=map.get("nbbm_eq").toString();
1110 1110 String sxtj=map.get("sxtj").toString();
  1111 + String type=map.get("type").toString();
  1112 + SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
  1113 + List<Object[]> sumYlbList=new ArrayList<Object[]>();
  1114 + try {
1111 1115 if(nbbm.trim()!=""){
1112 1116 stringList.add(nbbm);
1113 1117 }else{
... ... @@ -1160,7 +1164,6 @@ public class YlbServiceImpl extends BaseServiceImpl&lt;Ylb,Integer&gt; implements YlbS
1160 1164 }
1161 1165 }
1162 1166 }
1163   - List<Object[]> sumYlbList=new ArrayList<Object[]>();
1164 1167 if(sxtj.equals("0")){
1165 1168 sumYlbList=repository.sumYlb2(rq, gsbm, fgsbm, xlbm,nbbm);
1166 1169 }else{
... ... @@ -1170,14 +1173,20 @@ public class YlbServiceImpl extends BaseServiceImpl&lt;Ylb,Integer&gt; implements YlbS
1170 1173 // for(int i=0;i<stringList.size();i++){
1171 1174 // strings[i]=stringList.get(i);
1172 1175 // }
1173   - sumYlbList=repository.sumYlb(rq, gsbm, fgsbm, xlbm, stringList);
  1176 + if (type.equals("1"))
  1177 + sumYlbList=repository.sumYlb(rq, gsbm, fgsbm, xlbm, stringList);
  1178 + else
  1179 + sumYlbList=repository.sumYlb_s(sdf.parse(rq+" 00:00:00"), gsbm, fgsbm, xlbm, stringList);
1174 1180 }
1175 1181 // else{
1176 1182 // sumYlbList=repository.sumYlb2(rq, gsbm, fgsbm, xlbm, nbbm);
1177 1183 // }
1178 1184  
1179 1185 }
1180   -
  1186 + } catch (ParseException e) {
  1187 + // TODO Auto-generated catch block
  1188 + e.printStackTrace();
  1189 + }
1181 1190 Double jzl=0.0,yh=0.0,sh=0.0;
1182 1191 for (int i = 0; i < sumYlbList.size(); i++) {
1183 1192 jzl = Arith.add(jzl, Double.valueOf(sumYlbList.get(i)[0].toString()));
... ... @@ -1189,6 +1198,7 @@ public class YlbServiceImpl extends BaseServiceImpl&lt;Ylb,Integer&gt; implements YlbS
1189 1198 sumMap.put("jzl", jzl);
1190 1199 sumMap.put("yh", yh);
1191 1200 sumMap.put("sh", sh);
  1201 +
1192 1202 // String sql="select sum(jzl),sum(yh),sum(sh) from bsth_c_ylb "
1193 1203 // + " where to_days('"+map.get("rq").toString()+"')=to_days(rq) "
1194 1204 // + " and ssgsdm like '%"+map.get("ssgsdm_like").toString()+"%' "
... ... @@ -1206,96 +1216,118 @@ public class YlbServiceImpl extends BaseServiceImpl&lt;Ylb,Integer&gt; implements YlbS
1206 1216 @Override
1207 1217 public List<Ylb> listYlb(Map<String, Object> map) {
1208 1218 // TODO Auto-generated method stub
1209   - List<Ylb> listYlb=new ArrayList<Ylb>();
1210   - List<String> stringList=new ArrayList<String>();
1211   - String rq=map.get("rq").toString();
1212   - String gsbm=map.get("ssgsdm_like").toString();
1213   - String fgsbm=map.get("fgsdm_like").toString();
1214   - String xlbm=map.get("xlbm_like").toString().trim();
1215   - String nbbm=map.get("nbbm_eq").toString();
1216   - String sxtj=map.get("sxtj").toString();
1217   - if(nbbm.trim()!=""){
1218   - stringList.add(nbbm);
1219   - List<Object[]> objectLists=repository.checkNbmmNum(rq, gsbm, fgsbm, xlbm,nbbm);
1220   - if(objectLists.size()>0){
1221   - int cs=Integer.parseInt(objectLists.get(0)[1].toString());
1222   - if(sxtj.equals("1")){
1223   - if(cs==1){
1224   - listYlb=repository.listYlb(rq, gsbm, fgsbm, xlbm, stringList);
1225   - }
1226   - }else if(sxtj.equals("2")){
1227   - if(cs>1){
1228   - listYlb=repository.listYlb(rq, gsbm, fgsbm, xlbm, stringList);
  1219 + List<Ylb> listYlb = new ArrayList<Ylb>();
  1220 + try {
  1221 + List<String> stringList = new ArrayList<String>();
  1222 + String rq = map.get("rq").toString();
  1223 + String gsbm = map.get("ssgsdm_like").toString();
  1224 + String fgsbm = map.get("fgsdm_like").toString();
  1225 + String xlbm = map.get("xlbm_like").toString().trim();
  1226 + String nbbm = map.get("nbbm_eq").toString();
  1227 + String sxtj = map.get("sxtj").toString();
  1228 + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
  1229 + String type = map.get("type").toString();
  1230 + if (nbbm.trim() != "") {
  1231 + stringList.add(nbbm);
  1232 + List<Object[]> objectLists = repository.checkNbmmNum(rq, gsbm, fgsbm, xlbm, nbbm);
  1233 + if (objectLists.size() > 0) {
  1234 + int cs = Integer.parseInt(objectLists.get(0)[1].toString());
  1235 + if (sxtj.equals("1")) {
  1236 + if (cs == 1) {
  1237 + if (type.equals("1"))
  1238 + listYlb = repository.listYlb(rq, gsbm, fgsbm, xlbm, stringList);
  1239 + else
  1240 + listYlb = repository.listYlb_s(sdf.parse(rq+" 00:00:00"), gsbm, fgsbm, xlbm, stringList);
  1241 +
  1242 + }
  1243 + } else if (sxtj.equals("2")) {
  1244 + if (cs > 1) {
  1245 + if (type.equals("1"))
  1246 + listYlb = repository.listYlb(rq, gsbm, fgsbm, xlbm, stringList);
  1247 + else
  1248 + listYlb = repository.listYlb_s(sdf.parse(rq+" 00:00:00"), gsbm, fgsbm, xlbm, stringList);
  1249 + }
  1250 + } else {
  1251 + if (type.equals("1"))
  1252 + listYlb = repository.listYlb(rq, gsbm, fgsbm, xlbm, stringList);
  1253 + else
  1254 + listYlb = repository.listYlb_s(sdf.parse(rq+" 00:00:00"), gsbm, fgsbm, xlbm, stringList);
1229 1255 }
1230   - }else{
1231   - listYlb=repository.listYlb(rq, gsbm, fgsbm, xlbm, stringList);
1232   - }
1233   - }
1234   -
1235   - }else{
1236   - //全部
1237   - if(sxtj.equals("0")){
1238   - List<Object[]> objectLists=repository.checkNbmmNum(rq, gsbm, fgsbm, xlbm,nbbm);
1239   - for (int i = 0; i < objectLists.size(); i++) {
1240   - String clbm=objectLists.get(i)[0].toString();
1241   - stringList.add(clbm);
1242   - }
1243   - if(stringList.size()>0){
1244   - listYlb=repository.listYlb(rq, gsbm, fgsbm, xlbm, stringList);
1245 1256 }
1246   - }else{
1247   - List<Object[]> objectLists;
1248   - if(sxtj.equals("3")){
1249   - //有加油没里程
1250   - objectLists=repository.checkNbmmYl(rq, gsbm, fgsbm, xlbm, nbbm);
  1257 +
  1258 + } else {
  1259 + // 全部
  1260 + if (sxtj.equals("0")) {
  1261 + List<Object[]> objectLists = repository.checkNbmmNum(rq, gsbm, fgsbm, xlbm, nbbm);
1251 1262 for (int i = 0; i < objectLists.size(); i++) {
1252   - String clbm=objectLists.get(i)[0].toString();
1253   - double jzl=Double.parseDouble(objectLists.get(i)[1].toString());
1254   - double zlc=Double.parseDouble(objectLists.get(i)[2].toString());
1255   - if(jzl>0 && zlc<=0){
1256   - stringList.add(clbm);
1257   - }
1258   -
  1263 + String clbm = objectLists.get(i)[0].toString();
  1264 + stringList.add(clbm);
1259 1265 }
1260   -
1261   - }else if(sxtj.equals("4")){
1262   - //有里程没加油
1263   - objectLists=repository.checkNbmmYl(rq, gsbm, fgsbm, xlbm, nbbm);
1264   - for (int i = 0; i < objectLists.size(); i++) {
1265   - String clbm=objectLists.get(i)[0].toString();
1266   - double jzl=Double.parseDouble(objectLists.get(i)[1].toString());
1267   - double zlc=Double.parseDouble(objectLists.get(i)[2].toString());
1268   - if(zlc>0 && jzl<=0){
1269   - stringList.add(clbm);
1270   - }
1271   -
  1266 + if (stringList.size() > 0) {
  1267 + if (type.equals("1"))
  1268 + listYlb = repository.listYlb(rq, gsbm, fgsbm, xlbm, stringList);
  1269 + else
  1270 + listYlb = repository.listYlb_s(sdf.parse(rq+" 00:00:00"), gsbm, fgsbm, xlbm, stringList);
1272 1271 }
1273   - }else{
1274   - objectLists=repository.checkNbmmNum(rq, gsbm, fgsbm, xlbm,nbbm);
1275   - for (int i = 0; i < objectLists.size(); i++) {
1276   - String clbm=objectLists.get(i)[0].toString();
1277   - int cs=Integer.parseInt(objectLists.get(i)[1].toString());
1278   - //一车一单
1279   - if(sxtj.equals("1")){
1280   - if(cs==1){
  1272 + } else {
  1273 + List<Object[]> objectLists;
  1274 + if (sxtj.equals("3")) {
  1275 + // 有加油没里程
  1276 + objectLists = repository.checkNbmmYl(rq, gsbm, fgsbm, xlbm, nbbm);
  1277 + for (int i = 0; i < objectLists.size(); i++) {
  1278 + String clbm = objectLists.get(i)[0].toString();
  1279 + double jzl = Double.parseDouble(objectLists.get(i)[1].toString());
  1280 + double zlc = Double.parseDouble(objectLists.get(i)[2].toString());
  1281 + if (jzl > 0 && zlc <= 0) {
1281 1282 stringList.add(clbm);
1282 1283 }
1283   - }
1284   - //一车多单
1285   - if(sxtj.equals("2")){
1286   - if(cs>1){
  1284 +
  1285 + }
  1286 +
  1287 + } else if (sxtj.equals("4")) {
  1288 + // 有里程没加油
  1289 + objectLists = repository.checkNbmmYl(rq, gsbm, fgsbm, xlbm, nbbm);
  1290 + for (int i = 0; i < objectLists.size(); i++) {
  1291 + String clbm = objectLists.get(i)[0].toString();
  1292 + double jzl = Double.parseDouble(objectLists.get(i)[1].toString());
  1293 + double zlc = Double.parseDouble(objectLists.get(i)[2].toString());
  1294 + if (zlc > 0 && jzl <= 0) {
1287 1295 stringList.add(clbm);
1288 1296 }
  1297 +
  1298 + }
  1299 + } else {
  1300 + objectLists = repository.checkNbmmNum(rq, gsbm, fgsbm, xlbm, nbbm);
  1301 + for (int i = 0; i < objectLists.size(); i++) {
  1302 + String clbm = objectLists.get(i)[0].toString();
  1303 + int cs = Integer.parseInt(objectLists.get(i)[1].toString());
  1304 + // 一车一单
  1305 + if (sxtj.equals("1")) {
  1306 + if (cs == 1) {
  1307 + stringList.add(clbm);
  1308 + }
  1309 + }
  1310 + // 一车多单
  1311 + if (sxtj.equals("2")) {
  1312 + if (cs > 1) {
  1313 + stringList.add(clbm);
  1314 + }
  1315 + }
1289 1316 }
1290 1317 }
1291   - }
1292   -
1293   - if(stringList.size()>0){
1294   - listYlb=repository.listYlb(rq, gsbm, fgsbm, xlbm, stringList);
  1318 +
  1319 + if (stringList.size() > 0) {
  1320 + if (type.equals("1"))
  1321 + listYlb = repository.listYlb(rq, gsbm, fgsbm, xlbm, stringList);
  1322 + else
  1323 + listYlb = repository.listYlb_s(sdf.parse(rq+" 00:00:00"), gsbm, fgsbm, xlbm, stringList);
  1324 + }
1295 1325 }
1296 1326 }
  1327 + } catch (ParseException e) {
  1328 + // TODO Auto-generated catch block
  1329 + e.printStackTrace();
1297 1330 }
1298   -
1299 1331 return listYlb;
1300 1332 }
1301 1333  
... ...
src/main/resources/static/pages/electricity/list/list.html
... ... @@ -554,7 +554,8 @@ onkeyup=&quot;this.value=this.value.replace(/[^(\d||/.)]/g,&#39;&#39;).replace(&#39;.&#39;,&#39;$#$&#39;).rep
554 554 params['order'] = 'nbbm';
555 555 params['page'] = page;
556 556 params['rq'] = $("#rq").val();
557   -
  557 + params['type'] = '2';
  558 +
558 559  
559 560 var l = layer.load(2);
560 561 $get('/dlb/dlbList', params, function (data) {
... ... @@ -855,6 +856,7 @@ onkeyup=&quot;this.value=this.value.replace(/[^(\d||/.)]/g,&#39;&#39;).replace(&#39;.&#39;,&#39;$#$&#39;).rep
855 856 $("#export").on("click", function () {
856 857 if ($("#rq").val() != "") {
857 858 var params=getParamsList();
  859 + params['type']='2';
858 860 $post('/dlb/listExport', params, function (result) {
859 861 window.open("/downloadFile/download?fileName="+$("#rq").val()+"进出场存电量" );
860 862 });
... ...
src/main/resources/static/pages/oil/list_ph.html
... ... @@ -713,7 +713,7 @@ onkeyup=&quot;this.value=this.value.replace(/[^(\d||/.)]/g,&#39;&#39;).replace(&#39;.&#39;,&#39;$#$&#39;).rep
713 713 params['order'] = 'nbbm';
714 714 params['page'] = page;
715 715 params['rq'] = $("#rq").val();
716   -
  716 + params['type']='2';
717 717 var l = layer.load(2);
718 718 $get('/ylb/ylbList', params, function (data) {
719 719 for(var i=1;i<data.length;i++){
... ... @@ -1035,6 +1035,7 @@ onkeyup=&quot;this.value=this.value.replace(/[^(\d||/.)]/g,&#39;&#39;).replace(&#39;.&#39;,&#39;$#$&#39;).rep
1035 1035 $("#export").on("click", function () {
1036 1036 if ($("#rq").val() != "") {
1037 1037 var params=getParamsList();
  1038 + params['type']='2';
1038 1039 $post('/ylb/listExport', params, function (result) {
1039 1040 window.open("/downloadFile/download?fileName="+$("#rq").val()+"进出场存油量" );
1040 1041 });
... ...