Commit dde6ff42d90e866150615bc88b8617487478f658

Authored by 游瑞烽
1 parent 68765248

1.录单明细月年报表修改

2.线路版本修改增加版本名称
src/main/java/com/bsth/XDApplication.java
... ... @@ -71,6 +71,8 @@ public class XDApplication implements CommandLineRunner {
71 71  
72 72 @Autowired
73 73 GpsDataLoaderThread gpsDataLoader;
  74 + @Autowired
  75 + RfidDataLoaderThread rfidDataLoader;
74 76  
75 77 @Autowired
76 78 RfidDataLoaderThread rfidDataLoader;
... ...
src/main/java/com/bsth/repository/LineVersionsRepository.java
... ... @@ -36,9 +36,9 @@ public interface LineVersionsRepository extends BaseRepository<LineVersions, Int
36 36 @Transactional
37 37 @Modifying
38 38 @Query(value = "UPDATE LineVersions lv set lv.line=?2, lv.lineCode=?3, lv.startDate=?4, lv.endDate=?5, "
39   - + "lv.versions=?6, lv.status=?7, lv.remark=?8 where lv.id=?1")
  39 + + "lv.versions=?6, lv.status=?7, lv.remark=?8, lv.name=?9 where lv.id=?1")
40 40 public int update(Integer id, Line line, String lineCode, Date startDate, Date endDate, Integer versions, Integer status,
41   - String remark);
  41 + String remark,String name);
42 42  
43 43 /**
44 44 * 查询待更新线路的线路版本
... ...
src/main/java/com/bsth/repository/calc/CalcWaybillRepository.java
... ... @@ -74,17 +74,17 @@ public interface CalcWaybillRepository extends BaseRepository<CalcWaybill, Integ
74 74  
75 75  
76 76 //按照时间段统计,公司下线路 (驾驶员)
77   - @Query(value="select DISTINCT c from CalcWaybill c where c.xl like %?1% and c.rqStr between ?2 and ?3 and c.gsdm like %?4% and c.fgsdm like %?5% order by c.jGh,c.xl,c.rq")
78   - List<CalcWaybill> scheduleByJsy2(String line,String date,String date2,String gsdm,String fgsdm);
  77 + @Query(value="select DISTINCT c from CalcWaybill c where c.xl in(?1) and c.rqStr between ?2 and ?3 and c.gsdm in(?4) and c.fgsdm in(?5) order by c.jGh,c.fgsdm,c.xl,c.rq")
  78 + List<CalcWaybill> scheduleByJsy2(List<String> line,String date,String date2,List<String> gsdm,List<String> fgsdm);
79 79 //按照时间段统计,公司下线路 (售票员) coalesce(c.sGh,'')
80   - @Query(value="select DISTINCT c from CalcWaybill c where c.xl like %?1% and c.rqStr between ?2 and ?3 and c.gsdm like %?4% and c.fgsdm like %?5% and c.sGh <> null and c.sGh <> '' order by c.sGh,c.xl,c.rq")
81   - List<CalcWaybill> scheduleBySpy2(String line,String date,String date2,String gsdm,String fgsdm);
  80 + @Query(value="select DISTINCT c from CalcWaybill c where c.xl in(?1) and c.rqStr between ?2 and ?3 and c.gsdm in(?4) and c.fgsdm in(?5) and c.sGh <> null and c.sGh <> '' order by c.sGh,c.fgsdm,c.xl,c.rq")
  81 + List<CalcWaybill> scheduleBySpy2(List<String> line,String date,String date2,List<String> gsdm,List<String> fgsdm);
82 82 //按照时间段统计,公司下线路 (车辆自编号)
83   - @Query(value="select DISTINCT c from CalcWaybill c where c.xl like %?1% and c.rqStr between ?2 and ?3 and c.gsdm like %?4% and c.fgsdm like %?5% order by c.cl,c.xl,c.rq")
84   - List<CalcWaybill> scheduleByZbh2(String line,String date,String date2,String gsdm,String fgsdm);
  83 + @Query(value="select DISTINCT c from CalcWaybill c where c.xl in(?1) and c.rqStr between ?2 and ?3 and c.gsdm in(?4) and c.fgsdm in(?5) order by c.cl,c.fgsdm,c.xl,c.rq")
  84 + List<CalcWaybill> scheduleByZbh2(List<String> line,String date,String date2,List<String> gsdm,List<String> fgsdm);
85 85 //按照时间段统计,公司下线路 排序不同
86   - @Query(value="select DISTINCT c from CalcWaybill c where c.xl like %?1% and c.rqStr between ?2 and ?3 and c.gsdm like %?4% and c.fgsdm like %?5% order by c.xl,c.rq")
87   - List<CalcWaybill> scheduleByDateAndLineTjPx(String line,String date,String date2,String gsdm,String fgsdm);
  86 + @Query(value="select DISTINCT c from CalcWaybill c where c.xl in(?1) and c.rqStr between ?2 and ?3 and c.gsdm in(?4) and c.fgsdm in(?5) order by c.fgsdm,c.xl,c.rq")
  87 + List<CalcWaybill> scheduleByDateAndLineTjPx(List<String> line,String date,String date2,List<String> gsdm,List<String> fgsdm);
88 88 //按照时间段统计,单条线路 排序不同
89 89 @Query(value="select DISTINCT c from CalcWaybill c where c.xl = ?1 and c.rqStr between ?2 and ?3 order by c.xl,c.rq")
90 90 List<CalcWaybill> scheduleByDateAndLineTjPx2(String line,String date,String date2);
... ...
src/main/java/com/bsth/service/calc/impl/CalcWaybillServiceImpl.java
1 1 package com.bsth.service.calc.impl;
2 2  
3   -import java.sql.ResultSet;
4   -import java.sql.SQLException;
5   -import java.text.DecimalFormat;
6   -import java.text.ParseException;
7   -import java.text.SimpleDateFormat;
8   -import java.util.*;
9   -import java.util.Map.Entry;
10   -
11   -import javax.transaction.Transactional;
12   -
13 3 import com.alibaba.fastjson.JSON;
14 4 import com.alibaba.fastjson.JSONArray;
15 5 import com.bsth.common.ResponseCode;
... ... @@ -21,7 +11,6 @@ import com.bsth.entity.calc.CalcLineMileage;
21 11 import com.bsth.entity.calc.CalcStatistics;
22 12 import com.bsth.entity.calc.CalcWaybill;
23 13 import com.bsth.entity.calc.CalcWaybillDetail;
24   -import com.bsth.entity.mcy_forms.Singledata;
25 14 import com.bsth.entity.oil.Dlb;
26 15 import com.bsth.entity.oil.Ylb;
27 16 import com.bsth.entity.realcontrol.ChildTaskPlan;
... ... @@ -42,12 +31,10 @@ import com.bsth.service.realcontrol.ScheduleRealInfoService;
42 31 import com.bsth.service.report.CulateMileageService;
43 32 import com.bsth.service.report.ReportService;
44 33 import com.bsth.util.Arith;
45   -import com.bsth.util.BatchSaveUtils;
46 34 import com.bsth.util.ReportUtils;
47 35 import com.github.stuxuhai.jpinyin.PinyinException;
48 36 import com.github.stuxuhai.jpinyin.PinyinFormat;
49 37 import com.github.stuxuhai.jpinyin.PinyinHelper;
50   -
51 38 import org.apache.commons.lang3.StringUtils;
52 39 import org.slf4j.Logger;
53 40 import org.slf4j.LoggerFactory;
... ... @@ -57,6 +44,14 @@ import org.springframework.jdbc.core.JdbcTemplate;
57 44 import org.springframework.jdbc.core.RowMapper;
58 45 import org.springframework.stereotype.Service;
59 46  
  47 +import javax.transaction.Transactional;
  48 +import java.sql.ResultSet;
  49 +import java.sql.SQLException;
  50 +import java.text.DecimalFormat;
  51 +import java.text.ParseException;
  52 +import java.text.SimpleDateFormat;
  53 +import java.util.*;
  54 +
60 55 /**
61 56 * Created by 17/11/16.
62 57 */
... ... @@ -1817,17 +1812,41 @@ public class CalcWaybillServiceImpl extends BaseServiceImpl&lt;CalcWaybill, Integer
1817 1812  
1818 1813 @Override
1819 1814 public List<List<String>> calcDetailMonthly(Map<String, Object> map) {
1820   - String gsdm="";
  1815 +// String gsdm="";
  1816 +// if(map.get("gsdm")!=null){
  1817 +// gsdm=map.get("gsdm").toString().trim();
  1818 +// }
  1819 +// String fgsdm="";
  1820 +// if(map.get("fgsdm")!=null){
  1821 +// fgsdm=map.get("fgsdm").toString().trim();
  1822 +// }
  1823 + List<String> gsdm= new ArrayList<>();
  1824 + String gsdmStr = "";
1821 1825 if(map.get("gsdm")!=null){
1822   - gsdm=map.get("gsdm").toString().trim();
  1826 + gsdmStr = map.get("gsdm").toString().trim();
  1827 + String[] gsdms = gsdmStr.split(",");
  1828 + for (int i = 0; i < gsdms.length; i++){
  1829 + gsdm.add(gsdms[i]);
  1830 + }
1823 1831 }
1824   - String fgsdm="";
  1832 + List<String> fgsdm= new ArrayList<>();
  1833 + String fgsdmStr = "";
1825 1834 if(map.get("fgsdm")!=null){
1826   - fgsdm=map.get("fgsdm").toString().trim();
  1835 + fgsdmStr = map.get("fgsdm").toString().trim();
  1836 + String[] fgsdms = fgsdmStr.split(",");
  1837 + for (int i = 0; i < fgsdms.length; i++){
  1838 + fgsdm.add(fgsdms[i]);
  1839 + }
1827 1840 }
1828   - String line="";
  1841 +// String line= null;
  1842 + List<String> line= new ArrayList<>();
  1843 + String lineStr = "";
1829 1844 if(map.get("lineCode")!=null){
1830   - line=map.get("lineCode").toString().trim();
  1845 + lineStr = map.get("lineCode").toString().trim();
  1846 + String[] lines = lineStr.split(",");
  1847 + for (int i = 0; i < lines.length; i++){
  1848 + line.add(lines[i]);
  1849 + }
1831 1850 }
1832 1851 String startDate="";
1833 1852 if(map.get("startDate")!=null){
... ... @@ -1837,10 +1856,6 @@ public class CalcWaybillServiceImpl extends BaseServiceImpl&lt;CalcWaybill, Integer
1837 1856 if(map.get("endDate")!=null){
1838 1857 endDate=map.get("endDate").toString().trim();
1839 1858 }
1840   - String xlName="";
1841   - if(map.get("xlName")!=null){
1842   - xlName=map.get("xlName").toString().trim();
1843   - }
1844 1859 String type="";
1845 1860 if(map.get("type")!=null){
1846 1861 type=map.get("type").toString().trim();
... ... @@ -1853,6 +1868,18 @@ public class CalcWaybillServiceImpl extends BaseServiceImpl&lt;CalcWaybill, Integer
1853 1868 if(map.get("itemDetails")!=null){
1854 1869 itemDetails=map.get("itemDetails").toString().trim();
1855 1870 }
  1871 +// Boolean item=false;
  1872 + /*String item="";
  1873 + if(map.get("item")!=null){
  1874 + if("dh".equals(map.get("item").toString().trim()))
  1875 + item=" where c.sfdc = 1";
  1876 +// item=false;
  1877 + else if ("dh".equals(map.get("item").toString().trim()))
  1878 + item=" where c.sfdc = 0";
  1879 +// item=true;
  1880 + else
  1881 + item="";
  1882 + }*/
1856 1883 String timeType=map.get("timeType").toString().trim();
1857 1884  
1858 1885 List<List<String>> resList = new ArrayList<>();
... ... @@ -1878,7 +1905,7 @@ public class CalcWaybillServiceImpl extends BaseServiceImpl&lt;CalcWaybill, Integer
1878 1905 day2 = Integer.parseInt(endDate.substring(5,7));
1879 1906 for(int i=day; i<=day2; i++){
1880 1907 Map<String, CalcWaybillDetail> daym = new HashMap<>();
1881   - daym.put(startDate.substring(0,7),this.initCalcWaybillDetail());
  1908 + daym.put(startDate.substring(0,5)+(i<10?"0"+i:i),this.initCalcWaybillDetail());
1882 1909 dayList.add(daym);
1883 1910 }
1884 1911 startDate += "-01";
... ... @@ -1924,14 +1951,14 @@ public class CalcWaybillServiceImpl extends BaseServiceImpl&lt;CalcWaybill, Integer
1924 1951 // 把油量和电量数据查出来,封装成Map,计算时直接取
1925 1952 if(flag != 2 ){
1926 1953 String linesql="";
1927   - if(!line.equals("")){
1928   - linesql +=" and xlbm ='"+line+"' ";
  1954 + if(!lineStr.equals("")){
  1955 + linesql +=" and xlbm in("+lineStr+") ";
1929 1956 }
1930   - if(!gsdm.equals("")){
1931   - linesql +=" and ssgsdm ='"+gsdm+"' ";
  1957 + if(!gsdmStr.equals("")){
  1958 + linesql +=" and ssgsdm in("+gsdmStr+") ";
1932 1959 }
1933   - if(!fgsdm.equals("")){
1934   - linesql +=" and fgsdm ='"+fgsdm+"' ";
  1960 + if(!fgsdmStr.equals("")){
  1961 + linesql +=" and fgsdm in("+fgsdmStr+") ";
1935 1962 }
1936 1963 String ylsql="SELECT * FROM bsth_c_ylb"
1937 1964 // String ylsql="SELECT id,xlbm,nbbm,jsy,jzl,czyl,jzyl,yh,sh,fgsdm FROM bsth_c_ylb"
... ... @@ -2028,11 +2055,11 @@ public class CalcWaybillServiceImpl extends BaseServiceImpl&lt;CalcWaybill, Integer
2028 2055 // 横向数据的第几天下标
2029 2056 int dayIndex = 0;
2030 2057 int dayIndexPrev = -1;
2031   - CalcWaybillDetail cwNext = null;
2032 2058 // 报表纵向列数据生成
2033 2059 for (int i = 0; listNew.size() > i; i++) {
2034 2060 CalcWaybillDetail cw = listNew.get(i);
2035 2061  
  2062 + CalcWaybillDetail cwNext = new CalcWaybillDetail();
2036 2063 if(i<listNew.size()-1){
2037 2064 cwNext = listNew.get(i+1);
2038 2065 }
... ... @@ -2041,53 +2068,16 @@ public class CalcWaybillServiceImpl extends BaseServiceImpl&lt;CalcWaybill, Integer
2041 2068 String cwy = cw.getsGh();
2042 2069 String cl = cw.getCl();
2043 2070  
2044   - String key = "",keyNext = "";
2045   - if(flag == 1){
2046   - if(cw.getjGh() != null && cw.getjName() != null)
2047   - key += cw.getjGh() + "/" + cw.getjName();
2048   - if(cwNext.getjGh() != null && cwNext.getjName() != null)
2049   - keyNext += cwNext.getjGh() + "/" + cwNext.getjName();
2050   - } else if(flag == 2){
2051   - if(cw.getsGh() != null && cw.getsName() != null)
2052   - key += cw.getsGh() + "/" + cw.getsName();
2053   - if(cwNext.getsGh() != null && cwNext.getsName() != null)
2054   - keyNext += cwNext.getsGh() + "/" + cwNext.getsName();
2055   - } else if(flag == 3){
2056   - if(cw.getCl() != null)
2057   - key += cw.getCl();
2058   - if(cwNext.getCl() != null)
2059   - keyNext += cwNext.getCl();
2060   - }
2061   - key = cw.getXl() + "/" + key;
2062   - keyNext = cwNext.getXl() + "/" + keyNext;
2063   - CalcWaybillDetail calc = new CalcWaybillDetail();
2064   - List<CalcWaybillDetail> calcList = new ArrayList<>();
2065   - // 是否一行数据的第一个、生成key,calc为刚添加,不去和cw相加
2066   - boolean ifFirst = false;
2067   - if(keyMapList.containsKey(key)){
2068   - calc = keyMap.get(key);
2069   - calcList = keyMapList.get(key);
2070   - } else {
2071   -// calc = this.initCalcWaybillDetail();
2072   - // 深度拷贝对象
2073   - BeanUtils.copyProperties(cw,calc);
2074   - keyMap.put(key, calc);
2075   - dayIndex = 0;
2076   - ifFirst = true;
2077   - }
2078   -
2079   -
2080 2071 Ylb y = new Ylb();
2081 2072 Dlb d = new Dlb();
2082 2073 // 统计类型不同统计的左边列不同
  2074 + // 赋值油、电量
2083 2075 if(flag != 2){
2084 2076 // 取了之后删除,防止重复取,应为添加的时候已经合并了
2085 2077 y = ylbMap.get(cw.getRq().getTime()+"_"+cw.getXl()+"_"+cw.getjGh()+"_"+cw.getCl());
2086 2078 ylbMap.remove(cw.getRq().getTime()+"_"+cw.getXl()+"_"+cw.getjGh()+"_"+cw.getCl());
2087 2079 d = dlbMap.get(cw.getRq().getTime()+"_"+cw.getXl()+"_"+cw.getjGh()+"_"+cw.getCl());
2088 2080 dlbMap.remove(cw.getRq().getTime()+"_"+cw.getXl()+"_"+cw.getjGh()+"_"+cw.getCl());
2089   -// y = ylbMap.get(cw.getRq().getTime()+"_"+cw.getXl()+"_"+cw.getjGh()+"_"+cw.getjName()+"_"+cw.getCl());
2090   -// d = dlbMap.get(cw.getRq().getTime()+"_"+cw.getXl()+"_"+cw.getjGh()+"_"+cw.getjName()+"_"+cw.getCl());
2091 2081 if(y != null){
2092 2082 cw.setZlc(y.getZlc());
2093 2083 cw.setYh(y.getYh());
... ... @@ -2110,11 +2100,41 @@ public class CalcWaybillServiceImpl extends BaseServiceImpl&lt;CalcWaybill, Integer
2110 2100 cw.setCdl(d.getCdl());
2111 2101 cw.setBglyh((d.getZlc()==0? 0:100*d.getHd()/d.getZlc()));
2112 2102 }
  2103 + }
2113 2104  
2114   - }/* else if(flag == 3){
2115   - y = ylbCLMap.get(cw.getRq().getTime()+"_"+cw.getXl()+"_"+cw.getCl());
2116   - d = dlbCLMap.get(cw.getRq().getTime()+"_"+cw.getXl()+"_"+cw.getCl());
2117   - }*/
  2105 + String key = "",keyNext = "";
  2106 + if(flag == 1){
  2107 + if(cw.getjGh() != null && cw.getjName() != null)
  2108 + key += cw.getjGh() + "/" + cw.getjName();
  2109 + if(cwNext.getjGh() != null && cwNext.getjName() != null)
  2110 + keyNext += cwNext.getjGh() + "/" + cwNext.getjName();
  2111 + } else if(flag == 2){
  2112 + if(cw.getsGh() != null && cw.getsName() != null)
  2113 + key += cw.getsGh() + "/" + cw.getsName();
  2114 + if(cwNext.getsGh() != null && cwNext.getsName() != null)
  2115 + keyNext += cwNext.getsGh() + "/" + cwNext.getsName();
  2116 + } else if(flag == 3){
  2117 + if(cw.getCl() != null)
  2118 + key += cw.getCl();
  2119 + if(cwNext.getCl() != null)
  2120 + keyNext += cwNext.getCl();
  2121 + }
  2122 + key = cw.getFgsdm()+"/"+cw.getXl() + "/" + key;
  2123 + keyNext = cw.getFgsdm()+"/"+cwNext.getXl() + "/" + keyNext;
  2124 + CalcWaybillDetail calc = new CalcWaybillDetail();
  2125 + List<CalcWaybillDetail> calcList = new ArrayList<>();
  2126 + // 是否一行数据的第一个、生成key,calc为刚添加,不去和cw相加
  2127 + boolean ifFirst = false;
  2128 + if(keyMapList.containsKey(key)){
  2129 + calc = keyMap.get(key);
  2130 + calcList = keyMapList.get(key);
  2131 + } else {
  2132 + // 深度拷贝对象
  2133 + BeanUtils.copyProperties(cw,calc);
  2134 + keyMap.put(key, calc);
  2135 + dayIndex = 0;
  2136 + ifFirst = true;
  2137 + }
2118 2138  
2119 2139 CalcWaybillDetail dayc = null;
2120 2140 if("m".equals(timeType)){
... ... @@ -2155,13 +2175,6 @@ public class CalcWaybillServiceImpl extends BaseServiceImpl&lt;CalcWaybill, Integer
2155 2175  
2156 2176 // 把下标
2157 2177 dayIndexPrev = dayIndex;
2158   -
2159   -// if(cw.getjGh().equals("007951") && cw.getXlName().equals("浦东40路")){
2160   -// System.out.println();
2161   -// }
2162   - /*if(cw.getCl().equals("W0F-058") || cw.getCl().equals("W2F-051") || cw.getCl().equals("S2E-029") || cw.getCl().equals("W1G-058")){
2163   - System.out.println();
2164   - }*/
2165 2178 // timeType 为m 月报表时,日期不一样就换列,为y 年报表是,月份不一样换列
2166 2179 if("m".equals(timeType) && cwNext != null && key.equals(keyNext) && !cw.getRqStr().equals(cwNext.getRqStr())){
2167 2180 dayIndex++;
... ... @@ -2173,8 +2186,8 @@ public class CalcWaybillServiceImpl extends BaseServiceImpl&lt;CalcWaybill, Integer
2173 2186 calcList.add(new CalcWaybillDetail());
2174 2187 dayIndex++;
2175 2188 }
  2189 + // 换列了从头开始,上一个下标赋值为初始
2176 2190 dayIndexPrev = -1;
2177   -// dayIndexPrev = dayIndex = 0;
2178 2191 }
2179 2192 // 右边可变列添加数据
2180 2193 keyMapList.put(key,calcList);
... ... @@ -2203,14 +2216,17 @@ public class CalcWaybillServiceImpl extends BaseServiceImpl&lt;CalcWaybill, Integer
2203 2216 for(int i=day; i<=day2; i++){
2204 2217 list1.add((i<10?"0"+i:i)+("m".equals(timeType)?"日":"月"));
2205 2218 }
  2219 + if("bgldh".equals(itemDetails) || "bglyh".equals(itemDetails)){
  2220 + list1.add("平均");
  2221 + } else
  2222 + list1.add("合计");
2206 2223 resList.add(list1);
2207 2224  
2208 2225 int i=1;
2209 2226  
2210 2227 DecimalFormat df = new DecimalFormat("0.00");//格式化小数
  2228 + double allNum = 0.0;
2211 2229 while (iter.hasNext()) {
2212   -// List list = new ArrayList();
2213   -
2214 2230 Map.Entry entry = (Map.Entry) iter.next();
2215 2231 // 获取key
2216 2232 String key = (String) entry.getKey();
... ... @@ -2243,6 +2259,10 @@ public class CalcWaybillServiceImpl extends BaseServiceImpl&lt;CalcWaybill, Integer
2243 2259 listStr.add(df.format(c.getLjyylc()+c.getLjfyylc()));
2244 2260 listStr.add(df.format(c.getLblc()));
2245 2261 listStr.add(c.getTs()+"");
  2262 + c.setBglhd(c.getBglhd()/c.getTs());
  2263 + c.setBglyh(c.getBglyh()/c.getTs());
  2264 + // 把列合计的数添加到最后一个
  2265 + cList.add(c);
2246 2266 // DecimalFormat df = new DecimalFormat("0.00");//格式化小数
2247 2267 for (CalcWaybillDetail c1:cList) {
2248 2268 if(StringUtils.isEmpty(c1.getXl())) {
... ... @@ -2261,7 +2281,8 @@ public class CalcWaybillServiceImpl extends BaseServiceImpl&lt;CalcWaybill, Integer
2261 2281 } else if("cccy".equals(itemDetails)){
2262 2282 listStr.add(df.format(c1.getCzyl()));
2263 2283 } else if("bglyh".equals(itemDetails)){
2264   - listStr.add(df.format(c1.getBglyh()));
  2284 +// listStr.add(df.format(c1.getBglyh()));
  2285 + listStr.add(df.format(c1.getZlc()==0? 0:100*c1.getYh()/c1.getZlc()));
2265 2286 } else if("dh".equals(itemDetails)){
2266 2287 listStr.add(df.format(c1.getHd()));
2267 2288 } else if("cdl".equals(itemDetails)){
... ... @@ -2271,7 +2292,8 @@ public class CalcWaybillServiceImpl extends BaseServiceImpl&lt;CalcWaybill, Integer
2271 2292 } else if("jccd".equals(itemDetails)){
2272 2293 listStr.add(df.format(c1.getJzcd()));
2273 2294 } else if("bgldh".equals(itemDetails)){
2274   - listStr.add(df.format(c1.getBglhd()));
  2295 + listStr.add(df.format(c1.getZlc()==0? 0:100*c1.getHd()/c1.getZlc()));
  2296 +// listStr.add(df.format(c1.getBglhd()));
2275 2297 } else if("zgl".equals(itemDetails)){
2276 2298 listStr.add(df.format((c1.getSjyylc()+c1.getSjfyylc()+c1.getLjfyylc()+c1.getLjyylc())));
2277 2299 } else if("jhgl".equals(itemDetails)){
... ... @@ -2283,6 +2305,7 @@ public class CalcWaybillServiceImpl extends BaseServiceImpl&lt;CalcWaybill, Integer
2283 2305 }
2284 2306 }
2285 2307 }
  2308 + allNum = allNum + Double.parseDouble(listStr.get(listStr.size()-1));
2286 2309 resList.add(listStr);
2287 2310 }
2288 2311  
... ... @@ -2296,6 +2319,7 @@ public class CalcWaybillServiceImpl extends BaseServiceImpl&lt;CalcWaybill, Integer
2296 2319 listEnd.add(df.format(zjCalc.getLjfyylc()+zjCalc.getLjyylc()));
2297 2320 listEnd.add(df.format(zjCalc.getLblc()));
2298 2321 listEnd.add(zjCalc.getTs()+"");
  2322 + double all = 0.0;
2299 2323 for (Map<String, CalcWaybillDetail> cmap:dayList) {
2300 2324 for (Map.Entry<String, CalcWaybillDetail> cw : cmap.entrySet()) {
2301 2325 // System.out.println("key = " + cw.getKey() + ", value = " + cw.getValue());
... ... @@ -2313,7 +2337,8 @@ public class CalcWaybillServiceImpl extends BaseServiceImpl&lt;CalcWaybill, Integer
2313 2337 } else if("cccy".equals(itemDetails)){
2314 2338 listEnd.add(df.format(c1.getCzyl()));
2315 2339 } else if("bglyh".equals(itemDetails)){
2316   - listEnd.add(df.format(c1.getBglyh()));
  2340 +// listEnd.add(df.format(c1.getBglyh()));
  2341 + listEnd.add(df.format(c1.getZlc()==0? 0:100*c1.getYh()/c1.getZlc()));
2317 2342 } else if("dh".equals(itemDetails)){
2318 2343 listEnd.add(df.format(c1.getHd()));
2319 2344 } else if("cdl".equals(itemDetails)){
... ... @@ -2323,7 +2348,8 @@ public class CalcWaybillServiceImpl extends BaseServiceImpl&lt;CalcWaybill, Integer
2323 2348 } else if("jccd".equals(itemDetails)){
2324 2349 listEnd.add(df.format(c1.getJzcd()));
2325 2350 } else if("bgldh".equals(itemDetails)){
2326   - listEnd.add(df.format(c1.getBglhd()));
  2351 +// listEnd.add(df.format(c1.getBglhd()));
  2352 + listEnd.add(df.format(c1.getZlc()==0? 0:100*c1.getHd()/c1.getZlc()));
2327 2353 } else if("zgl".equals(itemDetails)){
2328 2354 listEnd.add((df.format(c1.getSjyylc()+c1.getSjfyylc()+c1.getLjfyylc()+c1.getLjyylc())));
2329 2355 } else if("jhgl".equals(itemDetails)){
... ... @@ -2332,10 +2358,18 @@ public class CalcWaybillServiceImpl extends BaseServiceImpl&lt;CalcWaybill, Integer
2332 2358 listEnd.add(c1.getSjyybc()+c1.getSjfyybc()+"");
2333 2359 } else if("jhbc".equals(itemDetails)){
2334 2360 listEnd.add((c1.getJhyybc()+c1.getJhfyybc())+"");
2335   -
2336 2361 }
2337 2362 }
  2363 + all = all + Double.parseDouble(listEnd.get(listEnd.size()-1));
  2364 + }
  2365 +
  2366 + // 百公里电油耗时为平均数
  2367 + if("bgldh".equals(itemDetails) || "bglyh".equals(itemDetails)){
  2368 + allNum = allNum/keyMap.size();
  2369 + all = all/dayList.size();
2338 2370 }
  2371 +// listEnd.add(df.format(allNum)+"/"+df.format(all));
  2372 + listEnd.add(df.format(all));
2339 2373 resList.add(listEnd);
2340 2374  
2341 2375 return resList;
... ...
src/main/java/com/bsth/service/impl/LineVersionsServiceImpl.java
... ... @@ -89,12 +89,13 @@ public class LineVersionsServiceImpl extends BaseServiceImpl&lt;LineVersions, Integ
89 89 String lineCode = map.get("lineCode").toString();
90 90 Integer versions = Integer.valueOf(map.get("versions").toString());
91 91 Integer status = Integer.valueOf(map.get("status").toString());
  92 + String name = map.get("name").toString();
92 93 String remark = map.get("remark").toString();
93   -
  94 +
94 95 Line line = lineRepository.findOne(lineid);
95 96  
96 97 int statu = repository.update(id,line,lineCode,new java.sql.Date(startDate.getTime()),
97   - new java.sql.Date(endDate.getTime()),versions,status,remark);
  98 + new java.sql.Date(endDate.getTime()),versions,status,remark,name);
98 99 LineVersions upLineVersions = repository.findBylineIdAndVersions(line.getId(),versions);
99 100 if(upLineVersions != null){
100 101 upLineVersions.setEndDate(new java.sql.Date(startDate.getTime()));
... ...
src/main/resources/static/pages/base/lineversions/edit.html
... ... @@ -47,7 +47,16 @@
47 47 <input type="hidden" name="status" id="statusInput" />
48 48 <input type="hidden" name="Id" id="IdInput" />
49 49 <!-- 表单分组组件 form-group END -->
50   -
  50 +
  51 + <div class="form-group">
  52 + <label class="control-label col-md-5">
  53 + <span class="required"> * </span>线路版本名称&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:
  54 + </label>
  55 + <div class="col-md-4">
  56 + <input name="name" class="form-control" style="width:100%" id="nameInput" placeholder="请填写更换版本原因,方便排班人员操作!" />
  57 + </div>
  58 + </div>
  59 +
51 60 <!-- 表单分组组件 form-group START -->
52 61 <div class="form-group">
53 62 <label class="control-label col-md-5">
... ... @@ -110,7 +119,7 @@
110 119 <div class="form-group">
111 120 <label class="control-label col-md-5"> 描述/说明&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;: </label>
112 121 <div class="col-md-4">
113   - <textarea class="form-control" rows="3" name="remark" id="remarkTextarea" placeholder="请填写更换版本原因,方便排班人员操作!"></textarea>
  122 + <textarea class="form-control" rows="3" name="remark" id="remarkTextarea" ></textarea>
114 123 </div>
115 124 </div>
116 125 <!-- 表单分组组件 form-group END -->
... ...
src/main/resources/static/pages/base/lineversions/js/lineversions-edit-from.js
... ... @@ -90,6 +90,7 @@
90 90 $("#endDateInput").val(moment(result.endDate).format('YYYY-MM-DD HH:mm:ss'));
91 91 $("#versionsInput").val(result.versions);
92 92 $("#statusInput").val(result.status);
  93 + $("#nameInput").val(result.name);
93 94 $("#remarkTextarea").val(result.remark);
94 95 }
95 96  
... ... @@ -144,6 +145,7 @@
144 145 'line' : {required : true,maxlength: 30},// 线路名称 必填项、最大长度.
145 146 'startDate' : {required : true},// 启用时间 不为空.
146 147 'endDate' : {required : true},// 结束时间.
  148 + 'name' : {required : true},// 版本名称.
147 149 'versions' : {required : true, digits : true, maxlength: 10},// 版本号 必填项、数字、最大长度10.
148 150 'status' : {required : true, digits : true, maxlength: 10},// 版本状态 必填项、数字、最大长度10.
149 151 },
... ...
src/main/resources/static/pages/forms/calc/calcDetailMonthly.html
... ... @@ -76,10 +76,10 @@
76 76  
77 77 <div style="display: inline-block;margin-left: 33px;" class="date-picker">
78 78 <span class="item-label" style="width: 80px;">&#12288;&#12288;时间: </span>
79   - <!--<input class="form-control" type="text" id="startDate" style="width: 180px;" /> - -->
80   - <!--<input class="form-control" type="text" id="endDate" style="width: 180px;" />-->
81   - <input class="form-control" type="text" id="startDate" style="width: 180px;" value="2020-10-01"/> -
82   - <input class="form-control" type="text" id="endDate" style="width: 180px;" value="2020-10-10"/>
  79 + <input class="form-control" type="text" id="startDate" style="width: 180px;" /> -
  80 + <input class="form-control" type="text" id="endDate" style="width: 180px;" />
  81 + <!--<input class="form-control" type="text" id="startDate" style="width: 180px;" value="2020-10-01"/> - -->
  82 + <!--<input class="form-control" type="text" id="endDate" style="width: 180px;" value="2020-10-10"/>-->
83 83 </div>
84 84 <div style="margin-top: 2px"></div>
85 85  
... ... @@ -130,6 +130,7 @@
130 130 </div>
131 131 <script >
132 132 $(function(){
  133 + $('#export').attr('disabled', "true");
133 134 // 关闭左侧栏
134 135 if (!$('body').hasClass('page-sidebar-closed'))
135 136 $('.menu-toggler.sidebar-toggler').click();
... ... @@ -150,72 +151,45 @@
150 151 day = "0" + day;
151 152 //时间
152 153 var dateTime=year + "-" + month + "-" + day;
153   - // $("#startDate").val(dateTime);
154   - // $("#endDate").val(dateTime);
  154 + $("#startDate").val(dateTime);
  155 + $("#endDate").val(dateTime);
155 156  
156   - // $("#endDate").datetimepicker({
157   - // format : 'YYYY-MM-DD',
158   - // locale : 'zh-cn',
159   - // maxDate : dateTime
160   - // });
161   - // $("#startDate").datetimepicker({
162   - // format : 'YYYY-MM-DD',
163   - // locale : 'zh-cn',
164   - // maxDate : dateTime
165   - // });
  157 + $("#endDate").datetimepicker({
  158 + format : 'YYYY-MM-DD',
  159 + locale : 'zh-cn',
  160 + maxDate : dateTime
  161 + });
  162 + $("#startDate").datetimepicker({
  163 + format : 'YYYY-MM-DD',
  164 + locale : 'zh-cn',
  165 + maxDate : dateTime
  166 + });
166 167  
167   - var fage=false;
168   - var xlList;
169   - var obj = [];
  168 + var lineAll="";
170 169 var datas = {}; //查询条件
171 170  
172   - var tempData = {};
173   -
174   - $.get('/report/lineList',function(result){
175   - xlList=result;
176   - $.get('/user/companyData', function(result){
177   - obj = result;
178   - var options = '<option value="">所有分公司</option>';
179   - for(var i = 0; i < obj.length; i++){
180   - if(obj[i].companyCode == "26"){
181   - var children = obj[i].children;
182   - for(var j = 0; j < children.length; j++){
183   - options += '<option value="'+children[j].code+'">'+children[j].name+'</option>';
184   - }
185   - }
186   - }
187   - $('#fgsdm').html(options);
188   - });
  171 + /**用户分配的线路*/
  172 + $.get('/realControAuthority/findByCurrentUser', function (userAuthor) {
  173 + lineAll = userAuthor.lineCodeStr.substring(0,userAuthor.lineCodeStr.length-1);
189 174 });
190 175  
  176 + var tempData = {};
191 177  
192   - // $("#gsdm").on("change",updateCompany);
193   - function updateCompany(){
194   - // var company = $('#gsdm').val();
195   - var options = '<option value="">所有分公司</option>';
196   - for(var i = 0; i < obj.length; i++){
197   - if(obj[i].companyCode == "26"){
  178 + $.get('/user/companyData', function(obj) {
  179 + var option = '';
  180 + var allC = "";
  181 + for (var i = 0; i < obj.length; i++) {
  182 + if (obj[i].companyCode == "26") {
198 183 var children = obj[i].children;
199   - for(var j = 0; j < children.length; j++){
200   - options += '<option value="'+children[j].code+'">'+children[j].name+'</option>';
  184 + for (var j = 0; j < children.length; j++) {
  185 + allC += children[j].code+",";
  186 + option += '<option value="' + children[j].code + '">' + children[j].name + '</option>';
201 187 }
202 188 }
203 189 }
204   - $('#fgsdm').html(options);
205   - }
206 190  
207   - $("#line").on("change", function(){
208   - if($("#line").val() == " "){
209   - $("#gsdm").attr("disabled", false);
210   - $("#fgsdm").attr("disabled", false);
211   - } else {
212   - var temp = tempData[$("#line").val()].split(":");
213   - $("#gsdm").val(temp[0]);
214   - updateCompany();
215   - $("#fgsdm").val(temp[1]);
216   - $("#gsdm").attr("disabled", true);
217   - $("#fgsdm").attr("disabled", true);
218   - }
  191 + var options = '<option value="'+allC.substring(0,allC.length-1)+'">所有分公司</option>'+option;
  192 + $('#fgsdm').html(options);
219 193 });
220 194  
221 195 // 项目明细选项列
... ... @@ -256,11 +230,9 @@
256 230 $("#query").on("click",function(){
257 231 var gsdm = "26";
258 232 var fgsdm = $("#fgsdm").val();
259   - var lineCode = $("#line").val();
260 233 var startDate = $("#startDate").val();
261 234 var endDate = $("#endDate").val();
262 235 var statisticalObj = $("#statisticalObj").val();
263   - lineName=$("#line option:selected").text();
264 236 //开始和结束时间
265 237 var startTime = Date.parse(new Date(startDate));
266 238 var endTime = Date.parse(new Date(endDate));
... ... @@ -268,16 +240,12 @@
268 240 datas = {}; // 清空之前数据
269 241 datas.gsdm = gsdm;
270 242 datas.fgsdm = fgsdm;
271   - datas.lineCode = lineCode;
272   - datas.lineName = lineName;
273   - datas.startDate = startDate;
  243 + datas.lineCode = lineAll;
274 244 datas.timeType = "m";
275   - // datas.startDate = "2020-10-01";
  245 + datas.startDate = startDate;
276 246 datas.endDate = endDate;
277   - // datas.endDate = "2020-10-10";
278 247 datas.statisticalObj = $("#statisticalObj").val();
279 248 datas.itemDetails = $("#itemDetails").val();
280   -
281 249 if(startDate==null || startDate =="" ||endDate==null || endDate ==""){
282 250 layer.msg('请选择时间段!');
283 251 }else if(endTime<startTime){
... ... @@ -295,8 +263,10 @@
295 263 title: '提示'
296 264 , content: '没有您要查询的数据,请重新选择参数!'
297 265 });
  266 + $("#export").attr('disabled',"true");
298 267 return;
299   - }
  268 + }else
  269 + $("#export").removeAttr("disabled");
300 270 var htmlHead = "", htmlBody = "";
301 271 var rsLength = rs.length;
302 272 rs.forEach(function (o, i) {
... ... @@ -323,7 +293,6 @@
323 293 });
324 294  
325 295 $("#export").on("click",function(){
326   - datas.timeType = "m";
327 296 var itemDetails = datas.itemDetails,
328 297 type = "加注量[全部]";
329 298 if(itemDetails=="jzl0"){
... ...
src/main/resources/static/pages/forms/calc/calcDetailYear.html
... ... @@ -130,6 +130,7 @@
130 130 </div>
131 131 <script >
132 132 $(function(){
  133 + $('#export').attr('disabled', "true");
133 134 // 关闭左侧栏
134 135 if (!$('body').hasClass('page-sidebar-closed'))
135 136 $('.menu-toggler.sidebar-toggler').click();
... ... @@ -161,66 +162,42 @@
161 162 maxDate : dateTime
162 163 });
163 164  
164   - var fage=false;
165   - var xlList;
166   - var obj = [];
  165 +
  166 + var lineAll="";
167 167 var datas = {}; //查询条件
168 168  
169   - var tempData = {};
170 169  
171   - $.get('/report/lineList',function(result){
172   - xlList=result;
173   - $.get('/user/companyData', function(result){
174   - obj = result;
175   - var options = '<option value="">所有分公司</option>';
176   - for(var i = 0; i < obj.length; i++){
177   - if(obj[i].companyCode == "26"){
178   - var children = obj[i].children;
179   - for(var j = 0; j < children.length; j++){
180   - options += '<option value="'+children[j].code+'">'+children[j].name+'</option>';
181   - }
182   - }
183   - }
184   - $('#fgsdm').html(options);
185   - });
  170 + /**用户分配的线路*/
  171 + $.get('/realControAuthority/findByCurrentUser', function (userAuthor) {
  172 + lineAll = userAuthor.lineCodeStr.substring(0,userAuthor.lineCodeStr.length-1);
186 173 });
187 174  
  175 + var tempData = {};
188 176  
189   - // $("#gsdm").on("change",updateCompany);
190   - function updateCompany(){
191   - // var company = $('#gsdm').val();
192   - var options = '<option value="">所有分公司</option>';
193   - for(var i = 0; i < obj.length; i++){
194   - if(obj[i].companyCode == "26"){
  177 + $.get('/user/companyData', function(obj) {
  178 + var option = '';
  179 + var allC = "";
  180 + for (var i = 0; i < obj.length; i++) {
  181 + if (obj[i].companyCode == "26") {
195 182 var children = obj[i].children;
196   - for(var j = 0; j < children.length; j++){
197   - options += '<option value="'+children[j].code+'">'+children[j].name+'</option>';
  183 + for (var j = 0; j < children.length; j++) {
  184 + allC += children[j].code+",";
  185 + option += '<option value="' + children[j].code + '">' + children[j].name + '</option>';
198 186 }
199 187 }
200 188 }
201   - $('#fgsdm').html(options);
202   - }
203 189  
204   - $("#line").on("change", function(){
205   - if($("#line").val() == " "){
206   - $("#gsdm").attr("disabled", false);
207   - $("#fgsdm").attr("disabled", false);
208   - } else {
209   - var temp = tempData[$("#line").val()].split(":");
210   - $("#gsdm").val(temp[0]);
211   - updateCompany();
212   - $("#fgsdm").val(temp[1]);
213   - $("#gsdm").attr("disabled", true);
214   - $("#fgsdm").attr("disabled", true);
215   - }
  190 + var options = '<option value="'+allC.substring(0,allC.length-1)+'">所有分公司</option>'+option;
  191 + $('#fgsdm').html(options);
216 192 });
217 193  
218 194 // 项目明细选项列
219 195 // 触发默认选项
220 196 updateItem();
221 197 $("#statisticalItem").on("change",updateItem);
  198 + var item ="";
222 199 function updateItem() {
223   - var item = $('#statisticalItem').val();
  200 + item = $('#statisticalItem').val();
224 201 var options = '';
225 202 if(item == "yh"){
226 203 options += '<option value="jzlAll">加注量[全部]</option>' +
... ... @@ -253,11 +230,9 @@
253 230 $("#query").on("click",function(){
254 231 var gsdm = "26";
255 232 var fgsdm = $("#fgsdm").val();
256   - var lineCode = $("#line").val();
257 233 var startDate = $("#startDate").val();
258 234 var endDate = $("#endDate").val();
259 235 var statisticalObj = $("#statisticalObj").val();
260   - lineName=$("#line option:selected").text();
261 236 //开始和结束时间
262 237 var startTime = Date.parse(new Date(startDate));
263 238 var endTime = Date.parse(new Date(endDate));
... ... @@ -266,14 +241,12 @@
266 241 datas.timeType = "y";
267 242 datas.gsdm = gsdm;
268 243 datas.fgsdm = fgsdm;
269   - datas.lineCode = lineCode;
270   - datas.lineName = lineName;
  244 + datas.lineCode = lineAll;
271 245 datas.startDate = startDate;
272   - // datas.startDate = "2020-10-01";
273 246 datas.endDate = endDate;
274   - // datas.endDate = "2020-10-10";
275 247 datas.statisticalObj = $("#statisticalObj").val();
276 248 datas.itemDetails = $("#itemDetails").val();
  249 + datas.item = item;
277 250  
278 251 if(startDate==null || startDate =="" ||endDate==null || endDate ==""){
279 252 layer.msg('请选择时间段!');
... ... @@ -292,8 +265,10 @@
292 265 title: '提示'
293 266 , content: '没有您要查询的数据,请重新选择参数!'
294 267 });
  268 + $("#export").attr('disabled',"true");
295 269 return;
296   - }
  270 + }else
  271 + $("#export").removeAttr("disabled");
297 272 var htmlHead = "", htmlBody = "";
298 273 var rsLength = rs.length;
299 274 rs.forEach(function (o, i) {
... ... @@ -320,7 +295,6 @@
320 295 });
321 296  
322 297 $("#export").on("click",function(){
323   - datas.timeType = "y";
324 298 var itemDetails = datas.itemDetails,
325 299 type = "加注量[全部]";
326 300 if(itemDetails=="jzl0"){
... ...