Commit 170562b91225e7e045ab8e9f329ffa9fea8ef8bb
1 parent
1a94506d
报表-营运线路出车率统计表 添加功能:导出单日4家公司合计excel(仅浦交层级使用)
Showing
4 changed files
with
125 additions
and
13 deletions
src/main/java/com/bsth/service/report/impl/CalcSheetServiceImpl.java
| ... | ... | @@ -1048,21 +1048,30 @@ public class CalcSheetServiceImpl extends BaseServiceImpl<CalcSheet, Integer> im |
| 1048 | 1048 | String type=map.get("type").toString(); |
| 1049 | 1049 | final String dates=date; |
| 1050 | 1050 | String sql_=""; |
| 1051 | - if(line.equals("")){ | |
| 1052 | - sql_= " and gsdm ='"+gs+"' and fgsdm like '%"+fgs+"%'"; | |
| 1051 | + List<String> objList = new ArrayList<String>(); | |
| 1052 | + objList.add(startDate); | |
| 1053 | + objList.add(endDate); | |
| 1054 | + if("".equals(gs.trim()) && "".equals(fgs.trim()) && "".equals(line.trim())){ | |
| 1055 | + | |
| 1056 | + } else if(line.equals("")){ | |
| 1057 | + sql_= " and gsdm = ? and fgsdm like CONCAT('%',?,'%') "; | |
| 1058 | + objList.add(gs); | |
| 1059 | + objList.add(fgs); | |
| 1053 | 1060 | }else{ |
| 1054 | - sql_=" and xl='"+line+"'"; | |
| 1061 | + sql_=" and xl = ? "; | |
| 1062 | + objList.add(line); | |
| 1055 | 1063 | } |
| 1056 | 1064 | String sql="select t.*,y.warrant_car as qzpcs from (" |
| 1057 | 1065 | + " select gsdm,fgsdm,xl,xl_name,sum(jhcc) as jhcc,sum(sjcc) as sjcc," |
| 1058 | 1066 | + " sum(sjcczgf) as sjcczgf,sum(jhbcs) as jhbcs,sum(sjbcs) as sjbcs " |
| 1059 | - + " from bsth_c_calc_sheet where date >='"+startDate+"' and date <='"+endDate+"'" | |
| 1067 | + + " from bsth_c_calc_sheet where date >= ? and date <= ? " | |
| 1060 | 1068 | + sql_ |
| 1061 | 1069 | + " group by gsdm,fgsdm,xl,xl_name ) " |
| 1062 | 1070 | + " t LEFT JOIN bsth_c_line y " |
| 1063 | - + " on t.xl=y.line_code order by fgsdm,xl_name"; | |
| 1064 | - List<Map<String, Object>> lists=jdbcTemplate.query(sql, | |
| 1065 | - new RowMapper<Map<String, Object>>(){ | |
| 1071 | + + " on t.xl=y.line_code order by gsdm,fgsdm,xl_name"; | |
| 1072 | + List<Map<String, Object>> lists=jdbcTemplate.query(sql, | |
| 1073 | + objList.toArray(), | |
| 1074 | + new RowMapper<Map<String, Object>>(){ | |
| 1066 | 1075 | @Override |
| 1067 | 1076 | public Map<String, Object> mapRow(ResultSet rs, int rowNum) throws SQLException { |
| 1068 | 1077 | Map<String, Object> s=new HashMap<String,Object>(); |
| ... | ... | @@ -1151,7 +1160,7 @@ public class CalcSheetServiceImpl extends BaseServiceImpl<CalcSheet, Integer> im |
| 1151 | 1160 | Map<String, Object> tempMap=new HashMap<String,Object>(); |
| 1152 | 1161 | tempMap.put("rq", "分类汇总"); |
| 1153 | 1162 | tempMap.put("line_", "共" + list.size() + "条线路"); |
| 1154 | - tempMap.put("xlName", "共" +count + "条线路"); | |
| 1163 | + tempMap.put("xlName", "共" + count + "条线路"); | |
| 1155 | 1164 | tempMap.put("jhcc", jhcc); |
| 1156 | 1165 | tempMap.put("sjcc", sjcc); |
| 1157 | 1166 | tempMap.put("sjcczgf", sjcczgf); |
| ... | ... | @@ -1171,6 +1180,7 @@ public class CalcSheetServiceImpl extends BaseServiceImpl<CalcSheet, Integer> im |
| 1171 | 1180 | }else{ |
| 1172 | 1181 | tempMap.put("zxl", "0.00%"); |
| 1173 | 1182 | } |
| 1183 | + | |
| 1174 | 1184 | if (type.equals("export")) { |
| 1175 | 1185 | String lineName=map.get("lineName").toString(); |
| 1176 | 1186 | ReportUtils ee = new ReportUtils(); |
| ... | ... | @@ -1179,6 +1189,72 @@ public class CalcSheetServiceImpl extends BaseServiceImpl<CalcSheet, Integer> im |
| 1179 | 1189 | ee.excelReplace(listI, new Object[] { tempMap }, path + "mould/calcTurnoutrate.xls", path + "export/" |
| 1180 | 1190 | + dates + "-" + lineName + "-营运线路出车率统计表.xls"); |
| 1181 | 1191 | } |
| 1192 | + | |
| 1193 | + if (type.equals("exportAll")) { | |
| 1194 | + List<Map<String, Object>> tempList = new ArrayList<Map<String, Object>>(); | |
| 1195 | + Map<String, Map<String, Object>> tempKeyMap = new HashMap<String, Map<String, Object>>(); | |
| 1196 | + for(Map<String, Object> m : list){ | |
| 1197 | + if(m.get("gsName")!=null && m.get("gsName").toString().trim().length() > 0){ | |
| 1198 | + Map<String, Object> temp = new HashMap<String, Object>(); | |
| 1199 | + String gsName = m.get("gsName").toString().trim(); | |
| 1200 | + if(tempKeyMap.containsKey(gsName)){ | |
| 1201 | + temp = tempKeyMap.get(gsName); | |
| 1202 | + temp.put("count", Long.valueOf(temp.get("count").toString()) + 1); | |
| 1203 | + temp.put("jhcc", Long.valueOf(m.get("jhcc")!=null?m.get("jhcc").toString():"0") | |
| 1204 | + + Long.valueOf(temp.get("jhcc")!=null?temp.get("jhcc").toString():"0")); | |
| 1205 | + temp.put("sjcc", Long.valueOf(m.get("sjcc")!=null?m.get("sjcc").toString():"0") | |
| 1206 | + + Long.valueOf(temp.get("sjcc")!=null?temp.get("sjcc").toString():"0")); | |
| 1207 | + temp.put("sjcczgf", Long.valueOf(m.get("sjcczgf")!=null?m.get("sjcczgf").toString():"0") | |
| 1208 | + + Long.valueOf(temp.get("sjcczgf")!=null?temp.get("sjcczgf").toString():"0")); | |
| 1209 | + temp.put("jhbc", Long.valueOf(m.get("jhbc")!=null?m.get("jhbc").toString():"0") | |
| 1210 | + + Long.valueOf(temp.get("jhbc")!=null?temp.get("jhbc").toString():"0")); | |
| 1211 | + temp.put("sjbc", Long.valueOf(m.get("sjbc")!=null?m.get("sjbc").toString():"0") | |
| 1212 | + + Long.valueOf(temp.get("sjbc")!=null?temp.get("sjbc").toString():"0")); | |
| 1213 | + temp.put("qzpcs", Long.valueOf(m.get("qzpcs")!=null?m.get("qzpcs").toString():"0") | |
| 1214 | + + Long.valueOf(temp.get("qzpcs")!=null?temp.get("qzpcs").toString():"0")); | |
| 1215 | + } else { | |
| 1216 | + temp.put("rq", ""); | |
| 1217 | + temp.put("gsName", gsName); | |
| 1218 | + temp.put("fgsName", "小计"); | |
| 1219 | + temp.put("count", 1); | |
| 1220 | + temp.put("jhcc", m.get("jhcc")!=null?m.get("jhcc").toString()+"":"0"); | |
| 1221 | + temp.put("sjcc", m.get("sjcc")!=null?m.get("sjcc").toString()+"":"0"); | |
| 1222 | + temp.put("sjcczgf", m.get("sjcczgf")!=null?m.get("sjcczgf").toString()+"":"0"); | |
| 1223 | + temp.put("jhbc", m.get("jhbc")!=null?m.get("jhbc").toString()+"":"0"); | |
| 1224 | + temp.put("sjbc", m.get("sjbc")!=null?m.get("sjbc").toString()+"":"0"); | |
| 1225 | + temp.put("qzpcs", m.get("qzpcs")!=null?m.get("qzpcs").toString()+"":"0"); | |
| 1226 | + temp.put("sm", ""); | |
| 1227 | + tempList.add(temp); | |
| 1228 | + tempKeyMap.put(gsName, temp); | |
| 1229 | + } | |
| 1230 | + } | |
| 1231 | + } | |
| 1232 | + | |
| 1233 | + for(Map<String, Object> m : tempList){ | |
| 1234 | + m.put("line_", "共" + m.get("count").toString() + "条线路"); | |
| 1235 | + m.put("xlName", "共" + m.get("count").toString() + "条线路"); | |
| 1236 | + if(m.get("jhcc")!=null && Long.valueOf(m.get("jhcc").toString()) > 0l){ | |
| 1237 | + m.put("ccl", df.format((Float.valueOf(m.get("sjcc").toString()) / Long.valueOf(m.get("jhcc").toString()))*100)+"%"); | |
| 1238 | + m.put("cclzgf", df.format((Float.valueOf(m.get("sjcczgf").toString()) / Long.valueOf(m.get("jhcc").toString()))*100)+"%"); | |
| 1239 | + }else{ | |
| 1240 | + m.put("ccl", "0.00%"); | |
| 1241 | + m.put("cclzgf", "0.00%"); | |
| 1242 | + } | |
| 1243 | + if(m.get("jhbc")!=null && Long.valueOf(m.get("jhbc").toString()) > 0l){ | |
| 1244 | + m.put("zxl", df.format((Float.valueOf(m.get("sjbc").toString()) / Long.valueOf(m.get("jhbc").toString()))*100)+"%"); | |
| 1245 | + }else{ | |
| 1246 | + m.put("zxl", "0.00%"); | |
| 1247 | + } | |
| 1248 | + list.add(m); | |
| 1249 | + } | |
| 1250 | + | |
| 1251 | + ReportUtils ee = new ReportUtils(); | |
| 1252 | + listI.add(list.iterator()); | |
| 1253 | + String path = this.getClass().getResource("/").getPath() + "static/pages/forms/"; | |
| 1254 | + ee.excelReplace(listI, new Object[] { tempMap }, path + "mould/calcTurnoutrate.xls", path + "export/" | |
| 1255 | + + dates + "-全部公司-营运线路出车率统计表.xls"); | |
| 1256 | + } | |
| 1257 | + | |
| 1182 | 1258 | list.add(tempMap); |
| 1183 | 1259 | return list; |
| 1184 | 1260 | } | ... | ... |
src/main/resources/static/pages/forms/statement/statisticsDaily.html
| ... | ... | @@ -385,7 +385,8 @@ |
| 385 | 385 | $("#exportAll").on("click",function(){ |
| 386 | 386 | var params = {}; |
| 387 | 387 | date = $("#date").val(); |
| 388 | - date2 =$("#date2").val(); | |
| 388 | + date2 = $("#date2").val(); | |
| 389 | + nature = $("#nature").val(); | |
| 389 | 390 | params['date'] = date; |
| 390 | 391 | params['date2'] = date2; |
| 391 | 392 | params['nature'] = nature; | ... | ... |
src/main/resources/static/pages/forms/statement/statisticsDailyCalc2.html
| ... | ... | @@ -368,7 +368,8 @@ |
| 368 | 368 | $("#exportAll").on("click",function(){ |
| 369 | 369 | var params = {}; |
| 370 | 370 | date = $("#date").val(); |
| 371 | - date2 =$("#date2").val(); | |
| 371 | + date2 = $("#date2").val(); | |
| 372 | + nature = $("#nature").val(); | |
| 372 | 373 | params['date'] = date; |
| 373 | 374 | params['date2'] = date2; |
| 374 | 375 | params['nature'] = nature; | ... | ... |
src/main/resources/static/pages/mforms/turnoutrates/calcTurnoutrate.html
| ... | ... | @@ -50,7 +50,7 @@ |
| 50 | 50 | <select class="form-control" name="line" id="line" style="width: 140px;"></select> |
| 51 | 51 | </div> |
| 52 | 52 | <div style="margin-top: 10px"></div> |
| 53 | - <div style="display: inline-block;"> | |
| 53 | + <div style="display: inline-block;margin-left: 3px;"> | |
| 54 | 54 | <span class="item-label" style="width: 80px;">线路性质: </span> <select |
| 55 | 55 | class="form-control" name="nature" id="nature" |
| 56 | 56 | style="width: 140px;"> |
| ... | ... | @@ -59,17 +59,18 @@ |
| 59 | 59 | <option value="2">非营运线路</option> |
| 60 | 60 | </select> |
| 61 | 61 | </div> |
| 62 | - <div style="display: inline-block;margin-left: 15px;"> | |
| 62 | + <div style="display: inline-block;margin-left: 11px;"> | |
| 63 | 63 | <span class="item-label" style="width: 80px;">开始时间: </span> |
| 64 | 64 | <input class="form-control" type="text" id="startDate" style="width: 140px;"/> |
| 65 | 65 | </div> |
| 66 | - <div style="display: inline-block;margin-left: 15px;"> | |
| 66 | + <div style="display: inline-block;margin-left: 16px;"> | |
| 67 | 67 | <span class="item-label" style="width: 80px;">结束时间: </span> |
| 68 | 68 | <input class="form-control" type="text" id="endDate" style="width: 140px;"/> |
| 69 | 69 | </div> |
| 70 | 70 | <div class="form-group"> |
| 71 | 71 | <input class="btn btn-default" type="button" id="query" value="筛选"/> |
| 72 | 72 | <input class="btn btn-default" type="button" id="export" value="导出"/> |
| 73 | + <input class="btn btn-default" type="button" id="exportAll" value="导出全部公司" style="display: none;"/> | |
| 73 | 74 | </div> |
| 74 | 75 | </form> |
| 75 | 76 | </div> |
| ... | ... | @@ -294,6 +295,39 @@ |
| 294 | 295 | layer.close(i); |
| 295 | 296 | }); |
| 296 | 297 | }); |
| 298 | + | |
| 299 | + | |
| 300 | + $.get('/user/getCurrentUser', function(result){ | |
| 301 | + var roleName = ""; | |
| 302 | + $(result.roles).each(function(i, e){ | |
| 303 | + roleName += e.roleName + "、"; | |
| 304 | + }); | |
| 305 | + if(roleName.indexOf("浦交") > -1 || roleName.indexOf("拓华") > -1){ | |
| 306 | + $("#exportAll").show(); | |
| 307 | + } | |
| 308 | + }); | |
| 309 | + $("#exportAll").on("click",function(){ | |
| 310 | + var params = {}; | |
| 311 | + startDate=$("#startDate").val(); | |
| 312 | + endDate=$("#endDate").val(); | |
| 313 | + params['startDate'] = startDate; | |
| 314 | + params['endDate'] = endDate; | |
| 315 | + params['nature'] = $("#nature").val(); | |
| 316 | + params['type'] = "exportAll"; | |
| 317 | + var i = layer.load(2); | |
| 318 | + $get('/calcSheet/calcTurnoutrate',params,function(result){ | |
| 319 | + var dateTime = ""; | |
| 320 | + if(startDate == endDate){ | |
| 321 | + dateTime = startDate; | |
| 322 | + } else { | |
| 323 | + dateTime = startDate+"-"+endDate; | |
| 324 | + } | |
| 325 | + window.open("/downloadFile/download?fileName=" | |
| 326 | + +dateTime+"-全部公司-营运线路出车率统计表"); | |
| 327 | + layer.close(i); | |
| 328 | + }); | |
| 329 | + }); | |
| 330 | + | |
| 297 | 331 | }); |
| 298 | 332 | </script> |
| 299 | 333 | <script type="text/html" id="calcTurnoutrate"> | ... | ... |