Commit 954385520f4d46d909baa51c1b1aa62ab5d2db86
Committed by
娄高锋
1 parent
90b01276
油电添加同路牌排序
新增油电路单统计表
Showing
8 changed files
with
685 additions
and
4 deletions
src/main/java/com/bsth/controller/report/ReportController.java
| ... | ... | @@ -371,4 +371,10 @@ public class ReportController { |
| 371 | 371 | return service.singledatatj(map); |
| 372 | 372 | } |
| 373 | 373 | |
| 374 | + //单日统计路单公里与油量,电量合并 | |
| 375 | + @RequestMapping(value = "/singleEnergy", method = RequestMethod.GET) | |
| 376 | + public List<Map<String, Object>> singleEnergy(@RequestParam Map<String, Object> map) { | |
| 377 | + | |
| 378 | + return service.singleEnergy(map); | |
| 379 | + } | |
| 374 | 380 | } | ... | ... |
src/main/java/com/bsth/repository/realcontrol/ScheduleRealInfoRepository.java
| ... | ... | @@ -193,10 +193,10 @@ public interface ScheduleRealInfoRepository extends BaseRepository<ScheduleRealI |
| 193 | 193 | List<ScheduleRealInfo> scheduleByDateAndLineYbb(String line,String date,String date2); |
| 194 | 194 | |
| 195 | 195 | |
| 196 | - @Query(value="select new map(s.scheduleDate as scheduleDate,s.xlBm as xlBm,s.clZbh as clZbh,s.jGh as jGh,s.lpName as lpName,min(s.fcsj) as fcsj,min(s.realExecDate) as realExecDate ) from ScheduleRealInfo s where s.xlBm like %?1% and s.scheduleDateStr = ?2 and s.gsBm like %?3% and s.fgsBm like %?4% and s.clZbh like %?5% GROUP BY xlBm,clZbh,jGh,scheduleDate,lpName ORDER BY clZbh,realExecDate,fcsj") | |
| 196 | + @Query(value="select new map(s.scheduleDate as scheduleDate,s.xlBm as xlBm,s.clZbh as clZbh,s.jGh as jGh,s.lpName as lpName,min(CONCAT(s.realExecDate,' ',s.fcsj)) AS realExecDate ) from ScheduleRealInfo s where s.xlBm like %?1% and s.scheduleDateStr = ?2 and s.gsBm like %?3% and s.fgsBm like %?4% and s.clZbh like %?5% GROUP BY xlBm,clZbh,jGh,scheduleDate,lpName ORDER BY clZbh,realExecDate") | |
| 197 | 197 | List<Map<String,Object>> yesterdayDataList(String line,String date,String gsbm,String fgsbm,String nbbm); |
| 198 | 198 | |
| 199 | - @Query(value="select new map(s.scheduleDate as scheduleDate,s.xlBm as xlBm,s.clZbh as clZbh,s.jGh as jGh,s.lpName as lpName,min(s.fcsj) as fcsj,min(s.realExecDate) as realExecDate ) from ScheduleRealInfo s where s.xlBm =?1 and s.scheduleDateStr = ?2 and s.gsBm like %?3% and s.fgsBm like %?4% and s.clZbh like %?5% GROUP BY xlBm,clZbh,jGh,scheduleDate,lpName ORDER BY clZbh,realExecDate,fcsj") | |
| 199 | + @Query(value="select new map(s.scheduleDate as scheduleDate,s.xlBm as xlBm,s.clZbh as clZbh,s.jGh as jGh,s.lpName as lpName,min(CONCAT(s.realExecDate,' ',s.fcsj)) AS realExecDate ) from ScheduleRealInfo s where s.xlBm =?1 and s.scheduleDateStr = ?2 and s.gsBm like %?3% and s.fgsBm like %?4% and s.clZbh like %?5% GROUP BY xlBm,clZbh,jGh,scheduleDate,lpName ORDER BY clZbh,realExecDate") | |
| 200 | 200 | List<Map<String,Object>> yesterdayDataList_eq(String line,String date,String gsbm,String fgsbm,String nbbm); |
| 201 | 201 | |
| 202 | 202 | @Query(value="select s from ScheduleRealInfo s where s.scheduleDateStr = ?1 ORDER BY xlBm,lpName,clZbh,xlDir") | ... | ... |
src/main/java/com/bsth/service/realcontrol/impl/ScheduleRealInfoServiceImpl.java
| ... | ... | @@ -3961,6 +3961,10 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl<ScheduleRealInf |
| 3961 | 3961 | String clZbh = yesterdayDataList.get(x).get("clZbh").toString(); |
| 3962 | 3962 | String xlbm = yesterdayDataList.get(x).get("xlBm").toString(); |
| 3963 | 3963 | String lp = yesterdayDataList.get(x).get("lpName").toString(); |
| 3964 | + String realExecDate=yesterdayDataList.get(x).get("realExecDate").toString(); | |
| 3965 | + String fcsj[] =realExecDate.split(" "); | |
| 3966 | + //取出最小计划发车时间 | |
| 3967 | + yesterdayDataList.get(x).put("fcsj", fcsj[1]); | |
| 3964 | 3968 | Map<String, Object> map = new HashMap<String, Object>(); |
| 3965 | 3969 | boolean fage = true; |
| 3966 | 3970 | String company = ""; | ... | ... |
src/main/java/com/bsth/service/report/ReportService.java
src/main/java/com/bsth/service/report/impl/ReportServiceImpl.java
| ... | ... | @@ -11,12 +11,14 @@ import com.bsth.entity.oil.Dlb; |
| 11 | 11 | import com.bsth.entity.oil.Ylb; |
| 12 | 12 | import com.bsth.entity.realcontrol.ChildTaskPlan; |
| 13 | 13 | import com.bsth.entity.realcontrol.ScheduleRealInfo; |
| 14 | +import com.bsth.entity.sys.Dictionary; | |
| 14 | 15 | import com.bsth.entity.sys.Interval; |
| 15 | 16 | import com.bsth.repository.LineRepository; |
| 16 | 17 | import com.bsth.repository.StationRouteRepository; |
| 17 | 18 | import com.bsth.repository.realcontrol.ScheduleRealInfoRepository; |
| 18 | 19 | import com.bsth.service.report.CulateMileageService; |
| 19 | 20 | import com.bsth.service.report.ReportService; |
| 21 | +import com.bsth.service.sys.DictionaryService; | |
| 20 | 22 | import com.bsth.util.Arith; |
| 21 | 23 | import com.bsth.util.ComparableChild; |
| 22 | 24 | import com.bsth.util.ComparableJob; |
| ... | ... | @@ -71,7 +73,8 @@ public class ReportServiceImpl implements ReportService{ |
| 71 | 73 | StationRouteRepository stationRouteRepository; |
| 72 | 74 | @Autowired |
| 73 | 75 | CulateMileageService culateMileageService; |
| 74 | - | |
| 76 | + @Autowired | |
| 77 | + DictionaryService dictionaryService; | |
| 75 | 78 | |
| 76 | 79 | @Override |
| 77 | 80 | public List<ScheduleRealInfo> queryListBczx(String line, String date,String clzbh) { |
| ... | ... | @@ -3586,7 +3589,7 @@ public class ReportServiceImpl implements ReportService{ |
| 3586 | 3589 | if(fgsdm.length() != 0){ |
| 3587 | 3590 | sql += " and r.fgs_bm ='"+fgsdm+"'"; |
| 3588 | 3591 | } |
| 3589 | - sql += " group by r.j_gh,r.xl_bm,r.cl_zbh order by r.xl_bm,r.cl_zbh"; | |
| 3592 | + sql += " group by r.j_gh,r.xl_bm,r.cl_zbh,r.fgs_bm order by r.xl_bm,r.cl_zbh"; | |
| 3590 | 3593 | |
| 3591 | 3594 | list = jdbcTemplate.query(sql, new RowMapper<Singledata>() { |
| 3592 | 3595 | @Override |
| ... | ... | @@ -3927,8 +3930,312 @@ public class ReportServiceImpl implements ReportService{ |
| 3927 | 3930 | } |
| 3928 | 3931 | return list_; |
| 3929 | 3932 | } |
| 3933 | + | |
| 3934 | + @Override | |
| 3935 | + public List<Map<String, Object>> singleEnergy(Map<String, Object> map) { | |
| 3936 | + // TODO Auto-generated method stub | |
| 3937 | + Map<String, Map<String,Object>> mm=new HashMap<String, Map<String,Object>>(); | |
| 3938 | + | |
| 3939 | + String gsdm=""; | |
| 3940 | + if(map.get("gs")!=null){ | |
| 3941 | + gsdm=map.get("gs").toString(); | |
| 3942 | + } | |
| 3943 | + String fgsdm=""; | |
| 3944 | + if(map.get("fgs")!=null){ | |
| 3945 | + fgsdm=map.get("fgs").toString(); | |
| 3946 | + } | |
| 3947 | + String energy=""; | |
| 3948 | + if(map.get("energy")!=null){ | |
| 3949 | + energy=map.get("energy").toString(); | |
| 3950 | + } | |
| 3951 | + String xlbm=""; | |
| 3952 | + if(map.get("line")!=null){ | |
| 3953 | + xlbm=map.get("line").toString().trim(); | |
| 3954 | + } | |
| 3955 | + String date = map.get("date").toString(); | |
| 3930 | 3956 | |
| 3957 | + List<ScheduleRealInfo> listReal=new ArrayList<ScheduleRealInfo>(); | |
| 3958 | + if(xlbm.equals("")){ | |
| 3959 | + listReal=scheduleRealInfoRepository.scheduleByDateAndLineByGs_(gsdm, fgsdm,date); | |
| 3960 | + }else{ | |
| 3961 | + listReal=scheduleRealInfoRepository.scheduleByDateAndLineQp(xlbm, date); | |
| 3962 | + } | |
| 3963 | + | |
| 3964 | + String sql="select r.j_gh, r.xl_bm,r.cl_zbh,r.lp_name " | |
| 3965 | + + " from bsth_c_s_sp_info_real r where " | |
| 3966 | + + " r.schedule_date_str = '"+date+"'"; | |
| 3967 | + if(xlbm.length() != 0){ | |
| 3968 | + sql += " and r.xl_bm = '"+xlbm+"'"; | |
| 3969 | + } | |
| 3970 | + if(gsdm.length() != 0){ | |
| 3971 | + sql += " and r.gs_bm ='"+gsdm+"'"; | |
| 3972 | + } | |
| 3973 | + if(fgsdm.length() != 0){ | |
| 3974 | + sql += " and r.fgs_bm ='"+fgsdm+"'"; | |
| 3975 | + } | |
| 3976 | + sql += " group by r.j_gh,r.xl_bm,r.cl_zbh,r.lp_name order by r.xl_bm,r.cl_zbh,r.lp_name"; | |
| 3977 | + | |
| 3978 | + | |
| 3979 | + List<Map<String, Object>> list = jdbcTemplate.query(sql, new RowMapper<Map<String,Object>>() { | |
| 3980 | + @Override | |
| 3981 | + public Map<String, Object> mapRow(ResultSet arg0, int arg1) throws SQLException { | |
| 3982 | + Map<String, Object> m=new HashMap<String, Object>(); | |
| 3983 | + m.put("jGh", arg0.getString("j_gh")); | |
| 3984 | + m.put("xlBm", arg0.getString("xl_bm")); | |
| 3985 | + m.put("clZbh", arg0.getString("cl_zbh")); | |
| 3986 | + m.put("lpName", arg0.getString("lp_name")); | |
| 3987 | + return m; | |
| 3988 | + } | |
| 3989 | + }); | |
| 3990 | + | |
| 3991 | + for (int i = 0; i < list.size(); i++) { | |
| 3992 | + Map<String, Object> m=list.get(i); | |
| 3993 | + String jGh=m.get("jGh").toString(); | |
| 3994 | + String xlBm=m.get("xlBm").toString(); | |
| 3995 | + String clZbh=m.get("clZbh").toString(); | |
| 3996 | + String lpName=m.get("lpName").toString(); | |
| 3997 | + List<ScheduleRealInfo> newList=new ArrayList<ScheduleRealInfo>(); | |
| 3998 | + List<ScheduleRealInfo> newList_=new ArrayList<ScheduleRealInfo>(); | |
| 3999 | + String sGh=""; | |
| 4000 | + String sName=""; | |
| 4001 | + String jName=""; | |
| 4002 | + String xlName=""; | |
| 4003 | + for (int j = 0; j < listReal.size(); j++) { | |
| 4004 | + ScheduleRealInfo s=listReal.get(j); | |
| 4005 | + if(s.getjGh().equals(jGh) | |
| 4006 | + && s.getClZbh().equals(clZbh) | |
| 4007 | + &&s.getXlBm().equals(xlBm) | |
| 4008 | + &&s.getLpName().equals(lpName)){ | |
| 4009 | + newList.add(s); | |
| 4010 | + if(jName.equals("")){ | |
| 4011 | + jName=s.getjName(); | |
| 4012 | + xlName=s.getXlName(); | |
| 4013 | + } | |
| 4014 | + if(sGh.equals("")){ | |
| 4015 | + if(!StringUtils.isEmpty(s.getsGh())){ | |
| 4016 | + sGh=s.getsGh(); | |
| 4017 | + sName=s.getsName(); | |
| 4018 | + } | |
| 4019 | + } | |
| 4020 | + Set<ChildTaskPlan> cts = s.getcTasks(); | |
| 4021 | + if(cts != null && cts.size() > 0){ | |
| 4022 | + newList_.add(s); | |
| 4023 | + }else{ | |
| 4024 | + if(s.getZdsjActual()!=null && s.getFcsjActual()!=null){ | |
| 4025 | + newList_.add(s); | |
| 4026 | + } | |
| 4027 | + } | |
| 4028 | + } | |
| 4029 | + } | |
| 4030 | + double yygl=culateMileageService.culateSjgl(newList_); | |
| 4031 | + double ljgl=culateMileageService.culateLjgl(newList_); | |
| 4032 | + double ksgl=culateMileageService.culateKsgl(newList_); | |
| 4033 | + double jcgl=culateMileageService.culateJccgl(newList_); | |
| 4034 | + double zyygl=Arith.add(yygl, ljgl); | |
| 4035 | + double zksgl=Arith.add(ksgl, jcgl); | |
| 4036 | + double zlc=Arith.add(zyygl, zksgl); | |
| 4037 | + Map<String, Object> m_=new HashMap<String, Object>(); | |
| 4038 | + m_.put("zlc", zlc); | |
| 4039 | + m_.put("zksgl", zksgl); | |
| 4040 | + m_.put("sGh", sGh); | |
| 4041 | + m_.put("sName", sName); | |
| 4042 | + m_.put("jGh", jGh); | |
| 4043 | + m_.put("jName", jName); | |
| 4044 | + m_.put("xlName", xlName); | |
| 4045 | + mm.put(xlBm+jGh+clZbh+lpName, m_); | |
| 4046 | + } | |
| 4047 | + List<Map<String, Object>> listAll=new ArrayList<Map<String,Object>>(); | |
| 4048 | + if(energy.equals("1")){ | |
| 4049 | + //油统计 | |
| 4050 | + String ylbSql="select ssgsdm,fgsdm,xlbm,nbbm,jsy,ifnull(lp,'') as lp,czlc," | |
| 4051 | + + " czyl,jzl,jzlc,jzyl,yh,sh,shyy,rylx,ns,zlc,linename,jname " | |
| 4052 | + + " from bsth_c_ylb where rq='"+date+"'"; | |
| 4053 | + | |
| 4054 | + if(xlbm.length() != 0){ | |
| 4055 | + ylbSql += " and xlbm = '"+xlbm+"'"; | |
| 4056 | + } | |
| 4057 | + if(gsdm.length() != 0){ | |
| 4058 | + ylbSql += " and ssgsdm ='"+gsdm+"'"; | |
| 4059 | + } | |
| 4060 | + if(fgsdm.length() != 0){ | |
| 4061 | + ylbSql += " and fgsdm ='"+fgsdm+"'"; | |
| 4062 | + } | |
| 4063 | + ylbSql += " order by xlbm,nbbm,jcsx"; | |
| 4064 | + listAll = jdbcTemplate.query(ylbSql, new RowMapper<Map<String,Object>>() { | |
| 4065 | + @Override | |
| 4066 | + public Map<String, Object> mapRow(ResultSet arg0, int arg1) throws SQLException { | |
| 4067 | + Map<String, Object> m=new HashMap<String, Object>(); | |
| 4068 | + m.put("ssgsdm", arg0.getString("ssgsdm")); | |
| 4069 | + m.put("fgsdm", arg0.getString("fgsdm")); | |
| 4070 | + m.put("xlbm", arg0.getString("xlbm")); | |
| 4071 | + m.put("nbbm", arg0.getString("nbbm")); | |
| 4072 | + m.put("jsy", arg0.getString("jsy")); | |
| 4073 | + m.put("lp", arg0.getString("lp")); | |
| 4074 | + m.put("czlc", arg0.getDouble("czlc")); | |
| 4075 | + m.put("czyl", arg0.getDouble("czyl")); | |
| 4076 | + m.put("jzl", arg0.getDouble("jzl")); | |
| 4077 | + m.put("jzlc", arg0.getDouble("jzlc")); | |
| 4078 | + m.put("jzyl", arg0.getDouble("jzyl")); | |
| 4079 | + m.put("yh", arg0.getDouble("yh")); | |
| 4080 | + m.put("sh", arg0.getDouble("sh")); | |
| 4081 | + m.put("shyy", arg0.getString("shyy")); | |
| 4082 | + m.put("rylx", arg0.getString("rylx")); | |
| 4083 | + m.put("ns", arg0.getDouble("ns")); | |
| 4084 | + m.put("zlc", arg0.getDouble("zlc")); | |
| 4085 | + m.put("linename", arg0.getString("linename")); | |
| 4086 | + m.put("jname", arg0.getString("jname")); | |
| 4087 | + if(arg0.getDouble("zlc")==0){ | |
| 4088 | + m.put("bglyh", "0.00"); | |
| 4089 | + }else{ | |
| 4090 | + DecimalFormat df = new DecimalFormat("0.00"); | |
| 4091 | + m.put("bglyh", df.format(arg0.getDouble("yh")/arg0.getDouble("zlc")*100)); | |
| 4092 | + } | |
| 4093 | + m.put("gsName", BasicData.businessCodeNameMap.get(arg0.getString("ssgsdm"))); | |
| 4094 | + m.put("fgsName", BasicData.businessFgsCodeNameMap.get(arg0.getString("fgsdm")+"_"+arg0.getString("ssgsdm"))); | |
| 4095 | + return m; | |
| 4096 | + } | |
| 4097 | + }); | |
| 4098 | + | |
| 4099 | + }else{ | |
| 4100 | + //电统计 | |
| 4101 | + String dlbSql="select ssgsdm,fgsdm,xlbm,nbbm,jsy,ifnull(lp,'') as lp,czlc," | |
| 4102 | + + " czcd,cdl,jzlc,jzcd,hd,sh,shyy,ns,zlc,linename,jname " | |
| 4103 | + + " from bsth_c_dlb where rq='"+date+"'"; | |
| 4104 | + if(xlbm.length() != 0){ | |
| 4105 | + dlbSql += " and xlbm = '"+xlbm+"'"; | |
| 4106 | + } | |
| 4107 | + if(gsdm.length() != 0){ | |
| 4108 | + dlbSql += " and ssgsdm ='"+gsdm+"'"; | |
| 4109 | + } | |
| 4110 | + if(fgsdm.length() != 0){ | |
| 4111 | + dlbSql += " and fgsdm ='"+fgsdm+"'"; | |
| 4112 | + } | |
| 4113 | + dlbSql += " order by xlbm,nbbm,jcsx"; | |
| 4114 | + listAll = jdbcTemplate.query(dlbSql, new RowMapper<Map<String,Object>>() { | |
| 4115 | + @Override | |
| 4116 | + public Map<String, Object> mapRow(ResultSet arg0, int arg1) throws SQLException { | |
| 4117 | + Map<String, Object> m=new HashMap<String, Object>(); | |
| 4118 | + m.put("ssgsdm", arg0.getString("ssgsdm")); | |
| 4119 | + m.put("fgsdm", arg0.getString("fgsdm")); | |
| 4120 | + m.put("xlbm", arg0.getString("xlbm")); | |
| 4121 | + m.put("nbbm", arg0.getString("nbbm")); | |
| 4122 | + m.put("jsy", arg0.getString("jsy")); | |
| 4123 | + m.put("lp", arg0.getString("lp")); | |
| 4124 | + m.put("czlc", arg0.getDouble("czlc")); | |
| 4125 | + m.put("czcd", arg0.getDouble("czcd")); | |
| 4126 | + m.put("cdl", arg0.getDouble("cdl")); | |
| 4127 | + m.put("jzlc", arg0.getDouble("jzlc")); | |
| 4128 | + m.put("jzcd", arg0.getDouble("jzcd")); | |
| 4129 | + m.put("hd", arg0.getDouble("hd")); | |
| 4130 | + m.put("sh", arg0.getDouble("sh")); | |
| 4131 | + m.put("shyy", arg0.getString("shyy")); | |
| 4132 | + m.put("linename", arg0.getString("linename")); | |
| 4133 | + m.put("jname", arg0.getString("jname")); | |
| 4134 | + m.put("zlc", arg0.getDouble("zlc")); | |
| 4135 | + //电量统计中添加默认中 燃油类型,尿素,保证导出模板相同 | |
| 4136 | + m.put("rylx", ""); | |
| 4137 | + m.put("ns", "0"); | |
| 4138 | + if(arg0.getDouble("zlc")==0){ | |
| 4139 | + m.put("bglyh", "0.00"); | |
| 4140 | + }else{ | |
| 4141 | + DecimalFormat df = new DecimalFormat("0.00"); | |
| 4142 | + m.put("bglyh", df.format(arg0.getDouble("hd")/arg0.getDouble("zlc")*100)); | |
| 4143 | + } | |
| 4144 | + m.put("gsName", BasicData.businessCodeNameMap.get(arg0.getString("ssgsdm"))); | |
| 4145 | + m.put("fgsName", BasicData.businessFgsCodeNameMap.get(arg0.getString("fgsdm")+"_"+arg0.getString("ssgsdm"))); | |
| 4146 | + return m; | |
| 4147 | + } | |
| 4148 | + }); | |
| 4149 | + } | |
| 4150 | + | |
| 4151 | + Map<String, Object> dMap=new HashMap<>(); | |
| 4152 | + dMap.put("dGroup_eq", "oilType"); | |
| 4153 | + Iterator<Dictionary> it= dictionaryService.list(dMap).iterator(); | |
| 4154 | + while (it.hasNext()) { | |
| 4155 | + Dictionary d=it.next(); | |
| 4156 | + dMap.put(d.getdCode(), d.getdName()); | |
| 4157 | + } | |
| 4158 | + for (int i = 0; i < listAll.size(); i++) { | |
| 4159 | + Map<String, Object> m=listAll.get(i); | |
| 4160 | + String jGh=m.get("jsy").toString(); | |
| 4161 | + String xlBm=m.get("xlbm").toString(); | |
| 4162 | + String clZbh=m.get("nbbm").toString(); | |
| 4163 | + String lpName=m.get("lp")==null?"":m.get("lp").toString(); | |
| 4164 | + String shyy=m.get("shyy")==null?"":m.get("shyy").toString(); | |
| 4165 | + String rylx=m.get("rylx")==null?"":m.get("rylx").toString(); | |
| 4166 | + if(dMap.get(rylx)==null){ | |
| 4167 | + rylx=""; | |
| 4168 | + }else{ | |
| 4169 | + rylx=dMap.get(rylx).toString(); | |
| 4170 | + } | |
| 4171 | + m.put("rylx", rylx); | |
| 4172 | + m.put("shyy", getShyy(shyy)); | |
| 4173 | + m.put("date", date); | |
| 4174 | + | |
| 4175 | + if(mm.get(xlBm+jGh+clZbh+lpName)!=null){ | |
| 4176 | + Map<String, Object> m_=mm.get(xlBm+jGh+clZbh+lpName); | |
| 4177 | + m.put("zlcAll", m_.get("zlc")==null?"":m_.get("zlc").toString()); | |
| 4178 | + m.put("zksgl", m_.get("zksgl")==null?"":m_.get("zksgl").toString()); | |
| 4179 | + m.put("sGh", m_.get("sGh")==null?"":m_.get("sGh").toString()); | |
| 4180 | + m.put("sName", m_.get("sName")==null?"":m_.get("sName").toString()); | |
| 4181 | + m.put("jname", m_.get("jName")==null?"":m_.get("jName").toString()); | |
| 4182 | + m.put("linename", m_.get("xlName")==null?"":m_.get("xlName").toString()); | |
| 4183 | + }else{ | |
| 4184 | + m.put("zlcAll", ""); | |
| 4185 | + m.put("zksgl", ""); | |
| 4186 | + m.put("sGh", ""); | |
| 4187 | + m.put("sName", ""); | |
| 4188 | + //油量表中历史数据和手动添加数据没有储存线路名字与驾驶员名字,是null的字段则根据编号查找 | |
| 4189 | + if(m.get("linename")==null){ | |
| 4190 | + m.put("linename", BasicData.lineCode2NameMap.get(xlBm)); | |
| 4191 | + } | |
| 4192 | + if(m.get("jname")==null){ | |
| 4193 | + m.put("jname", BasicData.allPerson.get(m.get("ssgsdm")+"-"+jGh)); | |
| 4194 | + } | |
| 4195 | + } | |
| 4196 | + } | |
| 4197 | + | |
| 4198 | + if(map.get("type").toString().equals("export")){ | |
| 4199 | + List<Iterator<?>> listI = new ArrayList<Iterator<?>>(); | |
| 4200 | + Map<String, Object> m = new HashMap<String, Object>(); | |
| 4201 | + m.put("date", date); | |
| 4202 | + ReportUtils ee = new ReportUtils(); | |
| 4203 | + try { | |
| 4204 | + listI.add(listAll.iterator()); | |
| 4205 | + if(energy.equals("1")){ | |
| 4206 | + String path = this.getClass().getResource("/").getPath() + "static/pages/forms/"; | |
| 4207 | + ee.excelReplace(listI, new Object[]{m}, path + "mould/energy_ylb.xls", | |
| 4208 | + path + "export/"+date+"路单油量统计表.xls"); | |
| 4209 | + }else{ | |
| 4210 | + String path = this.getClass().getResource("/").getPath() + "static/pages/forms/"; | |
| 4211 | + ee.excelReplace(listI, new Object[]{m}, path + "mould/energy_dlb.xls", | |
| 4212 | + path + "export/"+date+"路单电量统计表.xls"); | |
| 4213 | + } | |
| 4214 | + | |
| 4215 | + } catch (Exception e) { | |
| 4216 | + // TODO: handle exception | |
| 4217 | + e.printStackTrace(); | |
| 4218 | + } | |
| 4219 | + } | |
| 4220 | + return listAll; | |
| 4221 | + } | |
| 3931 | 4222 | |
| 4223 | + private String getShyy(String node){ | |
| 4224 | + String shyy ="无"; | |
| 4225 | + if(!node.equals("")){ | |
| 4226 | + if(node.equals("1")){shyy="票务用油";} | |
| 4227 | + else if(node.equals("2")){shyy="保养用油";} | |
| 4228 | + else if(node.equals("3")){shyy="报废车用油";} | |
| 4229 | + else if(node.equals("4")){shyy="其它用油";} | |
| 4230 | + else if(node.equals("5")){shyy="人保部";} | |
| 4231 | + else if(node.equals("6")){shyy="车队";} | |
| 4232 | + else if(node.equals("7")){shyy="车间(高保)";} | |
| 4233 | + else if(node.equals("8")){shyy="车间(小修)";} | |
| 4234 | + else{shyy ="无";} | |
| 4235 | + } | |
| 4236 | + return shyy; | |
| 4237 | + } | |
| 4238 | + | |
| 3932 | 4239 | } |
| 3933 | 4240 | |
| 3934 | 4241 | class ComparableAcuals implements Comparator<ScheduleRealInfo>{ | ... | ... |
src/main/resources/static/pages/forms/mould/energy_dlb.xls
0 → 100644
No preview for this file type
src/main/resources/static/pages/forms/mould/energy_ylb.xls
0 → 100644
No preview for this file type
src/main/resources/static/pages/report/singleEnergy.html
0 → 100644
| 1 | +<style type="text/css"> | |
| 2 | + .table-bordered { | |
| 3 | + border: 1px solid; } | |
| 4 | + .table-bordered > thead > tr > th, | |
| 5 | + .table-bordered > thead > tr > td, | |
| 6 | + .table-bordered > tbody > tr > th, | |
| 7 | + .table-bordered > tbody > tr > td, | |
| 8 | + .table-bordered > tfoot > tr > th, | |
| 9 | + .table-bordered > tfoot > tr > td { | |
| 10 | + border: 1px solid; } | |
| 11 | + .table-bordered > thead > tr > th, | |
| 12 | + .table-bordered > thead > tr > td { | |
| 13 | + border-bottom-width: 2px; } | |
| 14 | + | |
| 15 | + .table > tbody + tbody { | |
| 16 | + border-top: 1px solid; } | |
| 17 | +</style> | |
| 18 | + | |
| 19 | +<div class="page-head"> | |
| 20 | + <div class="page-title"> | |
| 21 | + <h1>路单油电汇总表</h1> | |
| 22 | + </div> | |
| 23 | +</div> | |
| 24 | + | |
| 25 | +<div class="row"> | |
| 26 | + <div class="col-md-12"> | |
| 27 | + <div class="portlet light porttlet-fit bordered"> | |
| 28 | + <div class="portlet-title"> | |
| 29 | + <form class="form-inline" action=""> | |
| 30 | + <div style="display: inline-block; margin-left: 33px;" id="gsdmDiv"> | |
| 31 | + <span class="item-label" style="width: 80px;">公司: </span> | |
| 32 | + <select class="form-control" name="company" id="gsdmEnergy" style="width: 180px;"></select> | |
| 33 | + </div> | |
| 34 | + <div style="display: inline-block; margin-left: 38px;" id="fgsdmDiv"> | |
| 35 | + <span class="item-label" style="width: 80px;">分公司: </span> | |
| 36 | + <select class="form-control" name="subCompany" id="fgsdmEnergy" style="width: 180px;"></select> | |
| 37 | + </div> | |
| 38 | + <div style="display: inline-block;margin-left: 33px;"> | |
| 39 | + <span class="item-label" style="width: 80px;">线路: </span> | |
| 40 | + <select class="form-control" name="line" id="line" style="width: 180px;"></select> | |
| 41 | + </div> | |
| 42 | + <div style="margin-top: 10px"> | |
| 43 | + </div> | |
| 44 | + <div style="display: inline-block;margin-left: 33px;"> | |
| 45 | + <span class="item-label" style="width: 80px;">类型: </span> | |
| 46 | + <select class="form-control" style="width: 180px;" id="energy"> | |
| 47 | + <option value="1">油汇总</option> | |
| 48 | + <option value="2">电汇总</option> | |
| 49 | + </select> | |
| 50 | + </div> | |
| 51 | + <div style="display: inline-block;"> | |
| 52 | + <span class="item-label" style="width: 80px;margin-left: 24px;">时间: </span> | |
| 53 | + <input class="form-control" type="text" id="date" style="width: 180px;"/> | |
| 54 | + </div> | |
| 55 | + | |
| 56 | + <div class="form-group"> | |
| 57 | + <input type="hidden" id="id"/> | |
| 58 | + <input class="btn btn-default" type="button" id="query" value="查询"/> | |
| 59 | + <input class="btn btn-default" type="button" id="export" value="导出"/> | |
| 60 | + </div> | |
| 61 | + </form> | |
| 62 | + </div> | |
| 63 | + | |
| 64 | + <div class="portlet-body"> | |
| 65 | + <div class="table-container" style="margin-top: 10px;overflow:auto;min-width: 906px"> | |
| 66 | + <table class="table table-bordered table-hover table-checkable" id="forms"> | |
| 67 | + <thead> | |
| 68 | + <tr> | |
| 69 | + <td>日期</td> | |
| 70 | + <td>公司</td> | |
| 71 | + <td>分公司</td> | |
| 72 | + <td>线路</td> | |
| 73 | + <td>自编号</td> | |
| 74 | + <td>驾工号</td> | |
| 75 | + <td>驾姓名</td> | |
| 76 | + <td>售工号</td> | |
| 77 | + <td>售姓名</td> | |
| 78 | + <td>出场公里</td> | |
| 79 | + <td>出场存油</td> | |
| 80 | + <td>加油量</td> | |
| 81 | + <td>进场公里</td> | |
| 82 | + <td>进场存油</td> | |
| 83 | + <td>油耗</td> | |
| 84 | + <td>损耗油量</td> | |
| 85 | + <td>损耗原因</td> | |
| 86 | + <td>燃油类型</td> | |
| 87 | + <td>尿素</td> | |
| 88 | + <td>总里程</td> | |
| 89 | + <td>百公里油耗</td> | |
| 90 | + <td>行驶里程</td> | |
| 91 | + <td>空驶里程</td> | |
| 92 | + </tr> | |
| 93 | + </thead> | |
| 94 | + <tbody> | |
| 95 | + </tbody> | |
| 96 | + </table> | |
| 97 | + | |
| 98 | + <table class="table table-bordered table-hover table-checkable" style="display: none" id="forms_d"> | |
| 99 | + <thead> | |
| 100 | + <tr> | |
| 101 | + <td>日期</td> | |
| 102 | + <td>公司</td> | |
| 103 | + <td>分公司</td> | |
| 104 | + <td>线路</td> | |
| 105 | + <td>自编号</td> | |
| 106 | + <td>驾工号</td> | |
| 107 | + <td>驾姓名</td> | |
| 108 | + <td>售工号</td> | |
| 109 | + <td>售姓名</td> | |
| 110 | + <td>出场公里</td> | |
| 111 | + <td>出场存电</td> | |
| 112 | + <td>充电量</td> | |
| 113 | + <td>进场公里</td> | |
| 114 | + <td>进场存电</td> | |
| 115 | + <td>耗电</td> | |
| 116 | + <td>损耗电量</td> | |
| 117 | + <td>损耗原因</td> | |
| 118 | + <td>总里程</td> | |
| 119 | + <td>百公里电耗</td> | |
| 120 | + <td>行驶里程</td> | |
| 121 | + <td>空驶里程</td> | |
| 122 | + </tr> | |
| 123 | + </thead> | |
| 124 | + <tbody> | |
| 125 | + </tbody> | |
| 126 | + </table> | |
| 127 | + </div> | |
| 128 | + | |
| 129 | + </div> | |
| 130 | + </div> | |
| 131 | + </div> | |
| 132 | +</div> | |
| 133 | +<script> | |
| 134 | + $(function(){ | |
| 135 | + // 关闭左侧栏 | |
| 136 | + if (!$('body').hasClass('page-sidebar-closed')) | |
| 137 | + $('.menu-toggler.sidebar-toggler').click(); | |
| 138 | + | |
| 139 | + var d = new Date(); | |
| 140 | + d.setTime(d.getTime() - 1*1000*60*60*24); | |
| 141 | + var year = d.getFullYear(); | |
| 142 | + var month = d.getMonth() + 1; | |
| 143 | + var day = d.getDate(); | |
| 144 | + if(month < 10) | |
| 145 | + month = "0"+month; | |
| 146 | + if(day < 10) | |
| 147 | + day = "0"+day; | |
| 148 | + var dateTime = year + "-" + month + "-" + day; | |
| 149 | + $("#date").datetimepicker({ | |
| 150 | + format : 'YYYY-MM-DD', | |
| 151 | + locale : 'zh-cn', | |
| 152 | + maxDate : dateTime | |
| 153 | + }); | |
| 154 | + | |
| 155 | + $("#date").val(dateTime); | |
| 156 | + | |
| 157 | + var fage=false; | |
| 158 | + var obj = []; | |
| 159 | + var xlList; | |
| 160 | + $.get('/report/lineList',function(result){ | |
| 161 | + xlList=result; | |
| 162 | + | |
| 163 | + $.get('/user/companyData', function(result){ | |
| 164 | + obj = result; | |
| 165 | + var options = ''; | |
| 166 | + for(var i = 0; i < obj.length; i++){ | |
| 167 | + options += '<option value="'+obj[i].companyCode+'">'+obj[i].companyName+'</option>'; | |
| 168 | + } | |
| 169 | + if(obj.length ==0){ | |
| 170 | + $("#gsdmDiv").css('display','none'); | |
| 171 | + }else if(obj.length ==1){ | |
| 172 | + $("#gsdmDiv").css('display','none'); | |
| 173 | + if(obj[0].children.length == 1 || obj[0].children.length ==0) | |
| 174 | + $('#fgsdmDiv').css('display','none'); | |
| 175 | + } | |
| 176 | + $('#gsdmEnergy').html(options); | |
| 177 | + | |
| 178 | + updateCompany(); | |
| 179 | + }); | |
| 180 | + }); | |
| 181 | + | |
| 182 | + $("#gsdmEnergy").on("change",updateCompany); | |
| 183 | + function updateCompany(){ | |
| 184 | + var company = $('#gsdmEnergy').val(); | |
| 185 | + var options = ''; | |
| 186 | + for(var i = 0; i < obj.length; i++){ | |
| 187 | + if(obj[i].companyCode == company){ | |
| 188 | + var children = obj[i].children; | |
| 189 | + for(var j = 0; j < children.length; j++){ | |
| 190 | + options += '<option value="'+children[j].code+'">'+children[j].name+'</option>'; | |
| 191 | + } | |
| 192 | + } | |
| 193 | + } | |
| 194 | + $('#fgsdmEnergy').html(options); | |
| 195 | + } | |
| 196 | + | |
| 197 | + var tempData = {}; | |
| 198 | + $.get('/report/lineList',function(xlList){ | |
| 199 | + var data = []; | |
| 200 | + data.push({id: " ", text: "全部线路"}); | |
| 201 | + $.get('/user/companyData', function(result){ | |
| 202 | + for(var i = 0; i < result.length; i++){ | |
| 203 | + var companyCode = result[i].companyCode; | |
| 204 | + var children = result[i].children; | |
| 205 | + for(var j = 0; j < children.length; j++){ | |
| 206 | + var code = children[j].code; | |
| 207 | + for(var k=0;k < xlList.length;k++ ){ | |
| 208 | + if(xlList[k]["fgsbm"]==code && xlList[k]["gsbm"]==companyCode){ | |
| 209 | + data.push({id: xlList[k]["xlbm"], text: xlList[k]["xlname"]}); | |
| 210 | + tempData[xlList[k]["xlbm"]] = companyCode+":"+code; | |
| 211 | + } | |
| 212 | + } | |
| 213 | + } | |
| 214 | + } | |
| 215 | + initPinYinSelect2('#line',data,''); | |
| 216 | + | |
| 217 | + }); | |
| 218 | + }); | |
| 219 | + | |
| 220 | + $("#line").on("change", function(){ | |
| 221 | + if($("#line").val() == " "){ | |
| 222 | + $("#gsdmEnergy").attr("disabled", false); | |
| 223 | + $("#fgsdmEnergy").attr("disabled", false); | |
| 224 | + } else { | |
| 225 | + var temp = tempData[$("#line").val()].split(":"); | |
| 226 | + $("#gsdmEnergy").val(temp[0]); | |
| 227 | + updateCompany(); | |
| 228 | + $("#nature").val(0); | |
| 229 | + $("#fgsdmEnergy").val(temp[1]); | |
| 230 | + $("#gsdmEnergy").attr("disabled", true); | |
| 231 | + $("#fgsdmEnergy").attr("disabled", true); | |
| 232 | + } | |
| 233 | + }); | |
| 234 | + | |
| 235 | + $("#export").attr('disabled',"true"); | |
| 236 | + | |
| 237 | + //查询 | |
| 238 | + $("#query").on('click',function(){ | |
| 239 | + var line = $("#line").val(); | |
| 240 | + var date = $("#date").val(); | |
| 241 | + var fgs=$('#fgsdmEnergy').val(); | |
| 242 | + var gs=$('#gsdmEnergy').val(); | |
| 243 | + var energy=$('#energy').val(); | |
| 244 | + var i = layer.load(2); | |
| 245 | + $get('/report/singleEnergy',{line:line,date:date,gs:gs,fgs:fgs,energy:energy,type:"query"},function(result){ | |
| 246 | + if(energy=="2"){ | |
| 247 | + var singleEnergy_d = template('singleEnergy_d',{list:result}); | |
| 248 | + $('#forms_d tbody').html(singleEnergy_d); | |
| 249 | + $("#forms").hide(); | |
| 250 | + $("#forms_d").show(); | |
| 251 | + }else{ | |
| 252 | + var singleEnergy = template('singleEnergy',{list:result}); | |
| 253 | + $('#forms tbody').html(singleEnergy); | |
| 254 | + $("#forms_d").hide(); | |
| 255 | + $("#forms").show(); | |
| 256 | + } | |
| 257 | + layer.close(i); | |
| 258 | + if(result.length == 0) | |
| 259 | + $("#export").attr('disabled',"true"); | |
| 260 | + else | |
| 261 | + $("#export").removeAttr("disabled"); | |
| 262 | + }); | |
| 263 | + }); | |
| 264 | + | |
| 265 | + | |
| 266 | + $("#export").on("click",function(){ | |
| 267 | + var line = $("#line").val(); | |
| 268 | + var date = $("#date").val(); | |
| 269 | + var fgs=$('#fgsdmEnergy').val(); | |
| 270 | + var gs=$('#gsdmEnergy').val(); | |
| 271 | + var energy=$('#energy').val(); | |
| 272 | + var lineName = $('#line option:selected').text(); | |
| 273 | + if(lineName == "全部线路") | |
| 274 | + lineName = $('#fgsdm option:selected').text(); | |
| 275 | + if(lineName=="全部分公司") | |
| 276 | + lineName = $('#gsdm option:selected').text(); | |
| 277 | + | |
| 278 | + var i = layer.load(2); | |
| 279 | + $get('/report/singleEnergy',{line:line,date:date,gs:gs,fgs:fgs,energy:energy,type:"export",lineName:lineName},function(result){ | |
| 280 | + if(energy=="2"){ | |
| 281 | + window.open("/downloadFile/download?fileName=" | |
| 282 | + +date+"路单电量统计表"); | |
| 283 | + }else{ | |
| 284 | + window.open("/downloadFile/download?fileName=" | |
| 285 | + +date+"路单油量统计表"); | |
| 286 | + } | |
| 287 | + | |
| 288 | + layer.close(i); | |
| 289 | + }); | |
| 290 | + }); | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + }); | |
| 295 | +</script> | |
| 296 | +<script type="text/html" id="singleEnergy"> | |
| 297 | + {{each list as obj i}} | |
| 298 | + <tr> | |
| 299 | + <td>{{obj.date}}</td> | |
| 300 | + <td>{{obj.gsName}}</td> | |
| 301 | + <td>{{obj.fgsName}}</td> | |
| 302 | + <td>{{obj.linename}}</td> | |
| 303 | + <td>{{obj.nbbm}}</td> | |
| 304 | + <td>{{obj.jsy}}</td> | |
| 305 | + <td>{{obj.jname}}</td> | |
| 306 | + <td>{{obj.sGh}}</td> | |
| 307 | + <td>{{obj.sName}}</td> | |
| 308 | + <td>{{obj.czlc}}</td> | |
| 309 | + <td>{{obj.czyl}}</td> | |
| 310 | + <td>{{obj.jzl}}</td> | |
| 311 | + <td>{{obj.jzlc}}</td> | |
| 312 | + <td>{{obj.jzyl}}</td> | |
| 313 | + <td>{{obj.yh}}</td> | |
| 314 | + <td>{{obj.sh}}</td> | |
| 315 | + <td>{{obj.shyy}}</td> | |
| 316 | + <td>{{obj.rylx}}</td> | |
| 317 | + <td>{{obj.ns}}</td> | |
| 318 | + <td>{{obj.zlc}}</td> | |
| 319 | + <td>{{obj.bglyh}}</td> | |
| 320 | + <td>{{obj.zlcAll}}</td> | |
| 321 | + <td>{{obj.zksgl}}</td> | |
| 322 | + </tr> | |
| 323 | + {{/each}} | |
| 324 | + {{if list.length == 0}} | |
| 325 | + <tr> | |
| 326 | + <td colspan="23"><h6 class="muted">没有找到相关数据</h6></td> | |
| 327 | + </tr> | |
| 328 | + {{/if}} | |
| 329 | +</script> | |
| 330 | + | |
| 331 | +<script type="text/html" id="singleEnergy_d"> | |
| 332 | + {{each list as obj i}} | |
| 333 | + <tr> | |
| 334 | + <td>{{obj.date}}</td> | |
| 335 | + <td>{{obj.gsName}}</td> | |
| 336 | + <td>{{obj.fgsName}}</td> | |
| 337 | + <td>{{obj.linename}}</td> | |
| 338 | + <td>{{obj.nbbm}}</td> | |
| 339 | + <td>{{obj.jsy}}</td> | |
| 340 | + <td>{{obj.jname}}</td> | |
| 341 | + <td>{{obj.sGh}}</td> | |
| 342 | + <td>{{obj.sName}}</td> | |
| 343 | + <td>{{obj.czlc}}</td> | |
| 344 | + <td>{{obj.czcd}}</td> | |
| 345 | + <td>{{obj.cdl}}</td> | |
| 346 | + <td>{{obj.jzlc}}</td> | |
| 347 | + <td>{{obj.jzcd}}</td> | |
| 348 | + <td>{{obj.hd}}</td> | |
| 349 | + <td>{{obj.sh}}</td> | |
| 350 | + <td>{{obj.shyy}}</td> | |
| 351 | + <td>{{obj.zlc}}</td> | |
| 352 | + <td>{{obj.bglyh}}</td> | |
| 353 | + <td>{{obj.zlcAll}}</td> | |
| 354 | + <td>{{obj.zksgl}}</td> | |
| 355 | + </tr> | |
| 356 | + {{/each}} | |
| 357 | + {{if list.length == 0}} | |
| 358 | + <tr> | |
| 359 | + <td colspan="21"><h6 class="muted">没有找到相关数据</h6></td> | |
| 360 | + </tr> | |
| 361 | + {{/if}} | |
| 362 | +</script> | |
| 0 | 363 | \ No newline at end of file | ... | ... |