Commit c0c8ca98d9ea07e55ed4f0bf133936134898a164
1 parent
48bbb52b
线路首末班准点率汇总与时间区间
Showing
4 changed files
with
437 additions
and
307 deletions
src/main/java/com/bsth/service/schedule/impl/PeopleCarPlanServiceImpl.java
| ... | ... | @@ -1180,8 +1180,11 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService { |
| 1180 | 1180 | |
| 1181 | 1181 | @Override |
| 1182 | 1182 | public List<Map<String, Object>> firstAndLastBus(Map<String, Object> map) { |
| 1183 | + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); | |
| 1184 | + NumberFormat nf = NumberFormat.getNumberInstance(); | |
| 1185 | + nf.setMinimumFractionDigits(2); | |
| 1186 | + List<ScheduleRealInfo> list = new ArrayList<ScheduleRealInfo>(); | |
| 1183 | 1187 | List<Map<String, Object>> resList = new ArrayList<Map<String, Object>>(); |
| 1184 | - Map<String, List<ScheduleRealInfo>> keyMap = new HashMap<String, List<ScheduleRealInfo>>(); | |
| 1185 | 1188 | |
| 1186 | 1189 | String company = map.get("company").toString(); |
| 1187 | 1190 | String subCompany = map.get("subCompany").toString(); |
| ... | ... | @@ -1190,151 +1193,173 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService { |
| 1190 | 1193 | String type = map.get("type").toString(); |
| 1191 | 1194 | |
| 1192 | 1195 | if(date.length() == 0) |
| 1193 | - date = new SimpleDateFormat("yyyy-MM-dd").format(new Date()); | |
| 1196 | + date = sdf.format(new Date()); | |
| 1194 | 1197 | |
| 1195 | - List<ScheduleRealInfo> list = this.getSchedule(company, subCompany, line, date); | |
| 1198 | + try { | |
| 1199 | + String sql = "select a.schedule_date_Str, a.real_exec_date, a.xl_name, a.fcsj, a.fcsj_actual, a.zdsj, a.zdsj_actual, a.qdz_name, a.zdz_name, a.xl_dir, a.status, a.gs_name, a.fgs_name," | |
| 1200 | + + " b.start_opt from bsth_c_s_sp_info_real a left join (select line, start_opt from bsth_c_line_config order by id desc) b on a.xl_bm = b.line" | |
| 1201 | + + " where DATE_FORMAT(schedule_date,'%Y-%m-%d') = '"+date+"'" | |
| 1202 | + + " and fcsj_actual is not null and fcsj_actual != '' and bc_type != 'in' and bc_type != 'out' and bc_type != 'ldks'"; | |
| 1203 | + if(line.length() != 0) | |
| 1204 | + sql += " and xl_bm = '"+line+"'"; | |
| 1205 | + if(company.length() != 0) | |
| 1206 | + sql += " and gs_bm = '"+company+"' and fgs_bm = '"+subCompany+"'"; | |
| 1207 | + | |
| 1208 | + list = jdbcTemplate.query(sql, | |
| 1209 | + new RowMapper<ScheduleRealInfo>(){ | |
| 1210 | + @Override | |
| 1211 | + public ScheduleRealInfo mapRow(ResultSet rs, int rowNum) throws SQLException { | |
| 1212 | + ScheduleRealInfo schedule = new ScheduleRealInfo(); | |
| 1213 | + schedule.setScheduleDateStr(rs.getString("schedule_date_Str")); | |
| 1214 | + schedule.setRealExecDate(rs.getString("real_exec_date")); | |
| 1215 | + schedule.setXlName(rs.getString("xl_name")); | |
| 1216 | + schedule.setFcsj(rs.getString("fcsj")); | |
| 1217 | + schedule.setFcsjActual(rs.getString("fcsj_actual")); | |
| 1218 | + schedule.setZdsj(rs.getString("zdsj")); | |
| 1219 | + schedule.setZdsjActual(rs.getString("zdsj_actual")); | |
| 1220 | + schedule.setQdzName(rs.getString("qdz_name")); | |
| 1221 | + schedule.setZdzName(rs.getString("zdz_name")); | |
| 1222 | + schedule.setXlDir(rs.getString("xl_dir")); | |
| 1223 | + schedule.setStatus(rs.getInt("status")); | |
| 1224 | + schedule.setGsName(rs.getString("gs_name")); | |
| 1225 | + schedule.setFgsName(rs.getString("fgs_name")); | |
| 1226 | + | |
| 1227 | + int startOpt = 0; | |
| 1228 | + if(rs.getString("start_opt") != null && rs.getString("start_opt").trim().length() != 0){ | |
| 1229 | + String[] split = rs.getString("start_opt").split(":"); | |
| 1230 | + startOpt = Integer.valueOf(split[0])*60 + Integer.valueOf(split[1]); | |
| 1231 | + } | |
| 1232 | + | |
| 1233 | + if(schedule.getFcsjActual() != null && schedule.getFcsjActual().trim().length() == 0){ | |
| 1234 | + schedule.setFcsjActual(null); | |
| 1235 | + } | |
| 1236 | + if(schedule.getZdsjActual() != null && schedule.getZdsjActual().trim().length() == 0){ | |
| 1237 | + schedule.setZdsjActual(null); | |
| 1238 | + } | |
| 1239 | + if(schedule.getFcsj() != null){ | |
| 1240 | + String[] split = schedule.getFcsj().split(":"); | |
| 1241 | + int fcsj = Integer.valueOf(split[0]) * 60 + Integer.valueOf(split[1]); | |
| 1242 | + if(fcsj < startOpt) | |
| 1243 | + fcsj += 1440; | |
| 1244 | + schedule.setFcsjT((long)fcsj); | |
| 1245 | + } | |
| 1246 | + if(schedule.getFcsjActual() != null){ | |
| 1247 | + String[] split = schedule.getFcsjActual().split(":"); | |
| 1248 | + int fcsjA = Integer.valueOf(split[0]) * 60 + Integer.valueOf(split[1]); | |
| 1249 | + if(fcsjA < startOpt || !schedule.getRealExecDate().equals(schedule.getScheduleDateStr())) | |
| 1250 | + fcsjA += 1440; | |
| 1251 | + schedule.setFcsjActualTime((long)fcsjA); | |
| 1252 | + } | |
| 1253 | + | |
| 1254 | + return schedule; | |
| 1255 | + } | |
| 1256 | + }); | |
| 1257 | + | |
| 1258 | + } catch (Exception e) { | |
| 1259 | + // TODO: handle exception | |
| 1260 | + e.printStackTrace(); | |
| 1261 | + } | |
| 1196 | 1262 | |
| 1197 | - for(ScheduleRealInfo schedule : list){ | |
| 1198 | - if(schedule.getBcType().equals("in") || schedule.getBcType().equals("out") || schedule.getBcType().equals("ldks")) | |
| 1199 | - continue; | |
| 1200 | - if(schedule.getStatus() == -1){ | |
| 1201 | - continue; | |
| 1202 | - } | |
| 1203 | - String key = schedule.getXlName(); | |
| 1204 | - if(key == null || key.trim().length() == 0) | |
| 1205 | - continue; | |
| 1206 | - if(!keyMap.containsKey(key)) | |
| 1207 | - keyMap.put(key, new ArrayList<ScheduleRealInfo>()); | |
| 1208 | - keyMap.get(key).add(schedule); | |
| 1263 | + Map<String, List<ScheduleRealInfo>> keyMap = new HashMap<String, List<ScheduleRealInfo>>(); | |
| 1264 | + String companyName = "", subCompanyName = ""; | |
| 1265 | + | |
| 1266 | + for(ScheduleRealInfo s : list){ | |
| 1267 | + String xlName = s.getXlName(); | |
| 1268 | + if(!keyMap.containsKey(xlName)) | |
| 1269 | + keyMap.put(xlName, new ArrayList<ScheduleRealInfo>()); | |
| 1270 | + keyMap.get(xlName).add(s); | |
| 1271 | + if(companyName.length()==0&&s.getGsName()!=null&&s.getGsName().trim().length()!=0) | |
| 1272 | + companyName = s.getGsName(); | |
| 1273 | + if(subCompanyName.length()==0&&s.getFgsName()!=null&&s.getFgsName().trim().length()!=0) | |
| 1274 | + subCompanyName = s.getFgsName(); | |
| 1209 | 1275 | } |
| 1210 | - for(String key : keyMap.keySet()){ | |
| 1276 | + | |
| 1277 | + for(String xlName : keyMap.keySet()){ | |
| 1211 | 1278 | Map<String, Object> tempMap = new HashMap<String, Object>(); |
| 1212 | - Map<Long, ScheduleRealInfo> temp0 = new HashMap<Long, ScheduleRealInfo>(); | |
| 1213 | - List<Long> longList0 = new ArrayList<Long>(); | |
| 1214 | - Map<Long, ScheduleRealInfo> temp1 = new HashMap<Long, ScheduleRealInfo>(); | |
| 1215 | - List<Long> longList1 = new ArrayList<Long>(); | |
| 1216 | - String companyName = "", subCompanyName = ""; | |
| 1217 | - for(ScheduleRealInfo schedule : keyMap.get(key)){ | |
| 1218 | - if(schedule.getFcsjActual() == null || schedule.getFcsjActual().trim().length() == 0){ | |
| 1219 | - continue; | |
| 1220 | - } | |
| 1221 | - if(schedule.getGsName() != null && companyName.length() == 0) | |
| 1222 | - companyName = schedule.getGsName(); | |
| 1223 | - if(schedule.getFgsName() != null && subCompanyName.length() == 0) | |
| 1224 | - subCompanyName = schedule.getFgsName(); | |
| 1225 | - String[] split = schedule.getFcsj().split(":"); | |
| 1226 | - long min = Integer.valueOf(split[0])*60 + Integer.valueOf(split[1]); | |
| 1227 | - schedule.setFcsjT(min); | |
| 1228 | - if(schedule.getXlDir().equals("0")){ | |
| 1229 | - temp0.put(min, schedule); | |
| 1230 | - longList0.add(min); | |
| 1231 | - } else { | |
| 1232 | - temp1.put(min, schedule); | |
| 1233 | - longList1.add(min); | |
| 1279 | + tempMap.put("date", date.substring(5)); | |
| 1280 | + tempMap.put("line", xlName); | |
| 1281 | + List<Long> up1 = new ArrayList<Long>(); | |
| 1282 | + List<Long> up2 = new ArrayList<Long>();; | |
| 1283 | + List<Long> dn1 = new ArrayList<Long>(); | |
| 1284 | + List<Long> dn2 = new ArrayList<Long>(); | |
| 1285 | + Map<Long, ScheduleRealInfo> up1Map = new HashMap<Long, ScheduleRealInfo>(); | |
| 1286 | + Map<Long, ScheduleRealInfo> up2Map = new HashMap<Long, ScheduleRealInfo>(); | |
| 1287 | + Map<Long, ScheduleRealInfo> dn1Map = new HashMap<Long, ScheduleRealInfo>(); | |
| 1288 | + Map<Long, ScheduleRealInfo> dn2Map = new HashMap<Long, ScheduleRealInfo>(); | |
| 1289 | + for(ScheduleRealInfo s : keyMap.get(xlName)){ | |
| 1290 | + if(s.getXlDir().equals("0")){ | |
| 1291 | + up1.add(s.getFcsjT()); | |
| 1292 | + up2.add(s.getFcsjActualTime()); | |
| 1293 | + up1Map.put(s.getFcsjT(), s); | |
| 1294 | + up2Map.put(s.getFcsjActualTime(), s); | |
| 1295 | + } else if(s.getXlDir().equals("1")){ | |
| 1296 | + dn1.add(s.getFcsjT()); | |
| 1297 | + dn2.add(s.getFcsjActualTime()); | |
| 1298 | + dn1Map.put(s.getFcsjT(), s); | |
| 1299 | + dn2Map.put(s.getFcsjActualTime(), s); | |
| 1234 | 1300 | } |
| 1235 | 1301 | } |
| 1236 | - | |
| 1237 | - if(longList0.size() == 0 && longList1.size() == 0){ | |
| 1238 | - continue; | |
| 1239 | - } | |
| 1240 | - | |
| 1241 | - if(longList0.size() != 0){ | |
| 1242 | - Collections.sort(longList0); | |
| 1243 | - ScheduleRealInfo shouban0 = temp0.get(longList0.get(0)); | |
| 1244 | - ScheduleRealInfo moban0 = temp0.get(longList0.get(longList0.size() - 1)); | |
| 1245 | - tempMap.put("qdzFirst0", shouban0.getQdzName()); | |
| 1246 | - tempMap.put("jhfcFirst0", shouban0.getFcsj()); | |
| 1247 | - tempMap.put("qdzLast0", moban0.getQdzName()); | |
| 1248 | - tempMap.put("jhfcLast0", moban0.getFcsj()); | |
| 1249 | - if(shouban0.getFcsjActual() != null){ | |
| 1250 | - String[] split = shouban0.getFcsjActual().split(":"); | |
| 1251 | - long min = Integer.valueOf(split[0])*60 + Integer.valueOf(split[1]); | |
| 1252 | - long delay = shouban0.getFcsjT() - min; | |
| 1253 | - tempMap.put("sjfcFirst0", shouban0.getFcsjActual()); | |
| 1254 | - if(delay > 0) | |
| 1255 | - tempMap.put("delayFirst0", "+" + delay); | |
| 1256 | - else | |
| 1257 | - tempMap.put("delayFirst0", delay); | |
| 1258 | - } else { | |
| 1259 | - tempMap.put("sjfcFirst0", "/"); | |
| 1260 | - tempMap.put("delayFirst0", "/"); | |
| 1261 | - } | |
| 1262 | - if(moban0.getFcsjActual() != null){ | |
| 1263 | - String[] split = moban0.getFcsjActual().split(":"); | |
| 1264 | - long min = Integer.valueOf(split[0])*60 + Integer.valueOf(split[1]); | |
| 1265 | - long delay = moban0.getFcsjT() - min; | |
| 1266 | - tempMap.put("sjfcLast0", moban0.getFcsjActual()); | |
| 1267 | - if(delay > 0) | |
| 1268 | - tempMap.put("delayLast0", "+" + delay); | |
| 1269 | - else | |
| 1270 | - tempMap.put("delayLast0", delay); | |
| 1271 | - } else { | |
| 1272 | - tempMap.put("sjfcLast0", "/"); | |
| 1273 | - tempMap.put("delayLast0", "/"); | |
| 1274 | - } | |
| 1275 | - }else{ | |
| 1302 | + if(up1.size() > 0 && up2.size() > 0){ | |
| 1303 | + Collections.sort(up1); | |
| 1304 | + Collections.sort(up2); | |
| 1305 | + ScheduleRealInfo s1 = up1Map.get(up1.get(0)); | |
| 1306 | + ScheduleRealInfo s2 = up2Map.get(up2.get(0)); | |
| 1307 | + ScheduleRealInfo s3 = up1Map.get(up1.get(up1.size()-1)); | |
| 1308 | + ScheduleRealInfo s4 = up2Map.get(up2.get(up2.size()-1)); | |
| 1309 | + long delayFirst0 = up1.get(0) - up2.get(0); | |
| 1310 | + long delayLast0 = up1.get(up1.size()-1) - up2.get(up2.size()-1); | |
| 1311 | + tempMap.put("qdzFirst0", s1.getQdzName()); | |
| 1312 | + tempMap.put("jhfcFirst0", s1.getFcsj()); | |
| 1313 | + tempMap.put("sjfcFirst0", s2.getFcsjActual()); | |
| 1314 | + tempMap.put("delayFirst0", delayFirst0>0?"+"+delayFirst0:delayFirst0); | |
| 1315 | + tempMap.put("qdzLast0", s3.getQdzName()); | |
| 1316 | + tempMap.put("jhfcLast0", s3.getFcsj()); | |
| 1317 | + tempMap.put("sjfcLast0", s4.getFcsjActual()); | |
| 1318 | + tempMap.put("delayLast0", delayLast0>0?"+"+delayLast0:delayLast0); | |
| 1319 | + } else { | |
| 1276 | 1320 | tempMap.put("qdzFirst0", "--"); |
| 1277 | 1321 | tempMap.put("jhfcFirst0", "/"); |
| 1278 | - tempMap.put("qdzLast0", "--"); | |
| 1279 | - tempMap.put("jhfcLast0", "/"); | |
| 1280 | 1322 | tempMap.put("sjfcFirst0", "/"); |
| 1281 | 1323 | tempMap.put("delayFirst0", "/"); |
| 1324 | + tempMap.put("qdzLast0", "--"); | |
| 1325 | + tempMap.put("jhfcLast0", "/"); | |
| 1282 | 1326 | tempMap.put("sjfcLast0", "/"); |
| 1283 | 1327 | tempMap.put("delayLast0", "/"); |
| 1284 | 1328 | } |
| 1285 | - | |
| 1286 | - if(longList1.size() != 0){ | |
| 1287 | - Collections.sort(longList1); | |
| 1288 | - ScheduleRealInfo shouban1 = temp1.get(longList1.get(0)); | |
| 1289 | - ScheduleRealInfo moban1 = temp1.get(longList1.get(longList1.size() - 1)); | |
| 1290 | - tempMap.put("qdzFirst1", shouban1.getQdzName()); | |
| 1291 | - tempMap.put("jhfcFirst1", shouban1.getFcsj()); | |
| 1292 | - tempMap.put("qdzLast1", moban1.getQdzName()); | |
| 1293 | - tempMap.put("jhfcLast1", moban1.getFcsj()); | |
| 1294 | - if(shouban1.getFcsjActual() != null){ | |
| 1295 | - String[] split = shouban1.getFcsjActual().split(":"); | |
| 1296 | - long min = Integer.valueOf(split[0])*60 + Integer.valueOf(split[1]); | |
| 1297 | - long delay = shouban1.getFcsjT() - min; | |
| 1298 | - tempMap.put("sjfcFirst1", shouban1.getFcsjActual()); | |
| 1299 | - if(delay > 0) | |
| 1300 | - tempMap.put("delayFirst1", "+" + delay); | |
| 1301 | - else | |
| 1302 | - tempMap.put("delayFirst1", delay); | |
| 1303 | - } else { | |
| 1304 | - tempMap.put("sjfcFirst1", "/"); | |
| 1305 | - tempMap.put("delayFirst1", "/"); | |
| 1306 | - } | |
| 1307 | - if(moban1.getFcsjActual() != null){ | |
| 1308 | - String[] split = moban1.getFcsjActual().split(":"); | |
| 1309 | - long min = Integer.valueOf(split[0])*60 + Integer.valueOf(split[1]); | |
| 1310 | - long delay = moban1.getFcsjT() - min; | |
| 1311 | - tempMap.put("sjfcLast1", moban1.getFcsjActual()); | |
| 1312 | - if(delay > 0) | |
| 1313 | - tempMap.put("delayLast1", "+" + delay); | |
| 1314 | - else | |
| 1315 | - tempMap.put("delayLast1", delay); | |
| 1316 | - } else { | |
| 1317 | - tempMap.put("sjfcLast1", "/"); | |
| 1318 | - tempMap.put("delayLast1", "/"); | |
| 1319 | - } | |
| 1320 | - }else{ | |
| 1329 | + if(dn1.size() > 0 && dn2.size() > 0){ | |
| 1330 | + Collections.sort(dn1); | |
| 1331 | + Collections.sort(dn2); | |
| 1332 | + ScheduleRealInfo s1 = dn1Map.get(dn1.get(0)); | |
| 1333 | + ScheduleRealInfo s2 = dn2Map.get(dn2.get(0)); | |
| 1334 | + ScheduleRealInfo s3 = dn1Map.get(dn1.get(dn1.size()-1)); | |
| 1335 | + ScheduleRealInfo s4 = dn2Map.get(dn2.get(dn2.size()-1)); | |
| 1336 | + long delayFirst1 = dn1.get(0) - dn2.get(0); | |
| 1337 | + long delayLast1 = dn1.get(dn1.size()-1) - dn2.get(dn2.size()-1); | |
| 1338 | + tempMap.put("qdzFirst1", s1.getQdzName()); | |
| 1339 | + tempMap.put("jhfcFirst1", s1.getFcsj()); | |
| 1340 | + tempMap.put("sjfcFirst1", s2.getFcsjActual()); | |
| 1341 | + tempMap.put("delayFirst1", delayFirst1>0?"+"+delayFirst1:delayFirst1); | |
| 1342 | + tempMap.put("qdzLast1", s3.getQdzName()); | |
| 1343 | + tempMap.put("jhfcLast1", s3.getFcsj()); | |
| 1344 | + tempMap.put("sjfcLast1", s4.getFcsjActual()); | |
| 1345 | + tempMap.put("delayLast1", delayLast1>0?"+"+delayLast1:delayLast1); | |
| 1346 | + } else { | |
| 1321 | 1347 | tempMap.put("qdzFirst1", "--"); |
| 1322 | 1348 | tempMap.put("jhfcFirst1", "/"); |
| 1323 | - tempMap.put("qdzLast1", "--"); | |
| 1324 | - tempMap.put("jhfcLast1", "/"); | |
| 1325 | 1349 | tempMap.put("sjfcFirst1", "/"); |
| 1326 | 1350 | tempMap.put("delayFirst1", "/"); |
| 1351 | + tempMap.put("qdzLast1", "--"); | |
| 1352 | + tempMap.put("jhfcLast1", "/"); | |
| 1327 | 1353 | tempMap.put("sjfcLast1", "/"); |
| 1328 | 1354 | tempMap.put("delayLast1", "/"); |
| 1329 | 1355 | } |
| 1330 | - | |
| 1331 | - tempMap.put("date", date); | |
| 1332 | 1356 | tempMap.put("company", companyName); |
| 1333 | 1357 | tempMap.put("subCompany", subCompanyName); |
| 1334 | - tempMap.put("line", key); | |
| 1358 | + tempMap.put("date", date); | |
| 1359 | + tempMap.put("line", xlName); | |
| 1335 | 1360 | resList.add(tempMap); |
| 1336 | 1361 | } |
| 1337 | - | |
| 1362 | + | |
| 1338 | 1363 | if(type.equals("export")){ |
| 1339 | 1364 | SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"), |
| 1340 | 1365 | sdfSimple = new SimpleDateFormat("yyyyMMdd"); |
| ... | ... | @@ -1357,164 +1382,248 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService { |
| 1357 | 1382 | |
| 1358 | 1383 | @Override |
| 1359 | 1384 | public List<Map<String, Object>> firstAndLastBus_sum(Map<String, Object> map) { |
| 1385 | + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); | |
| 1360 | 1386 | NumberFormat nf = NumberFormat.getNumberInstance(); |
| 1361 | 1387 | nf.setMinimumFractionDigits(2); |
| 1388 | + List<ScheduleRealInfo> list = new ArrayList<ScheduleRealInfo>(); | |
| 1362 | 1389 | List<Map<String, Object>> resList = new ArrayList<Map<String, Object>>(); |
| 1363 | - Map<String, List<ScheduleRealInfo>> keyMap = new HashMap<String, List<ScheduleRealInfo>>(); | |
| 1364 | 1390 | |
| 1365 | 1391 | String company = map.get("company").toString(); |
| 1366 | 1392 | String subCompany = map.get("subCompany").toString(); |
| 1367 | 1393 | String line = map.get("line").toString(); |
| 1368 | - String date = map.get("date").toString(); | |
| 1394 | +// String date = map.get("date").toString(); | |
| 1395 | + String startDate = map.get("startDate").toString(); | |
| 1396 | + String endDate = map.get("endDate").toString(); | |
| 1369 | 1397 | String type = map.get("type").toString(); |
| 1370 | 1398 | |
| 1371 | - if(date.length() == 0) | |
| 1372 | - date = new SimpleDateFormat("yyyy-MM-dd").format(new Date()); | |
| 1373 | - | |
| 1374 | - List<ScheduleRealInfo> list = this.getSchedule(company, subCompany, line, date); | |
| 1399 | + if(startDate.length() == 0) | |
| 1400 | + startDate = sdf.format(new Date()); | |
| 1401 | + if(endDate.length() == 0) | |
| 1402 | + endDate = sdf.format(new Date()); | |
| 1375 | 1403 | |
| 1376 | - for(ScheduleRealInfo schedule : list){ | |
| 1377 | - if(schedule.getBcType().equals("in") || schedule.getBcType().equals("out") || schedule.getBcType().equals("ldks")) | |
| 1378 | - continue; | |
| 1379 | - if(schedule.getStatus() == -1){ | |
| 1380 | - continue; | |
| 1381 | - } | |
| 1382 | - String key = schedule.getXlName(); | |
| 1383 | - if(key == null || key.trim().length() == 0) | |
| 1384 | - continue; | |
| 1385 | - if(!keyMap.containsKey(key)) | |
| 1386 | - keyMap.put(key, new ArrayList<ScheduleRealInfo>()); | |
| 1387 | - keyMap.get(key).add(schedule); | |
| 1404 | + String dates = ""; | |
| 1405 | + if(startDate.equals(endDate)){ | |
| 1406 | + String[] split = startDate.split("-"); | |
| 1407 | + dates = split[0]+"年"+split[1]+"月"+split[2]+"日"; | |
| 1408 | + } else { | |
| 1409 | + String[] split1 = startDate.split("-"); | |
| 1410 | + String[] split2 = endDate.split("-"); | |
| 1411 | + dates = split1[0]+"年"+split1[1]+"月"+split1[2]+"日--" | |
| 1412 | + +split2[0]+"年"+split2[1]+"月"+split2[2]+"日"; | |
| 1388 | 1413 | } |
| 1389 | - for(String key : keyMap.keySet()){ | |
| 1390 | - Map<String, Object> tempMap = new HashMap<String, Object>(); | |
| 1391 | - Map<String, Object> m = new HashMap<String, Object>(); | |
| 1392 | - Map<Long, ScheduleRealInfo> temp0 = new HashMap<Long, ScheduleRealInfo>(); | |
| 1393 | - List<Long> longList0 = new ArrayList<Long>(); | |
| 1394 | - Map<Long, ScheduleRealInfo> temp1 = new HashMap<Long, ScheduleRealInfo>(); | |
| 1395 | - List<Long> longList1 = new ArrayList<Long>(); | |
| 1396 | - String companyName = "", subCompanyName = ""; | |
| 1397 | - for(ScheduleRealInfo schedule : keyMap.get(key)){ | |
| 1398 | - if(schedule.getFcsjActual() == null || schedule.getFcsjActual().trim().length() == 0){ | |
| 1399 | - continue; | |
| 1400 | - } | |
| 1401 | - if(schedule.getGsName() != null && companyName.length() == 0) | |
| 1402 | - companyName = schedule.getGsName(); | |
| 1403 | - if(schedule.getFgsName() != null && subCompanyName.length() == 0) | |
| 1404 | - subCompanyName = schedule.getFgsName(); | |
| 1405 | - String[] split = schedule.getFcsj().split(":"); | |
| 1406 | - long min = Integer.valueOf(split[0])*60 + Integer.valueOf(split[1]); | |
| 1407 | - schedule.setFcsjT(min); | |
| 1408 | - if(schedule.getXlDir().equals("0")){ | |
| 1409 | - temp0.put(min, schedule); | |
| 1410 | - longList0.add(min); | |
| 1411 | - } else { | |
| 1412 | - temp1.put(min, schedule); | |
| 1413 | - longList1.add(min); | |
| 1414 | + | |
| 1415 | + try { | |
| 1416 | + String sql = "select a.schedule_date_Str, a.real_exec_date, a.xl_name, a.fcsj, a.fcsj_actual, a.zdsj, a.zdsj_actual, a.qdz_name, a.zdz_name, a.xl_dir, a.status, a.gs_name, a.fgs_name," | |
| 1417 | + + " b.start_opt from bsth_c_s_sp_info_real a left join (select line, start_opt from bsth_c_line_config order by id desc) b on a.xl_bm = b.line" | |
| 1418 | + + " where DATE_FORMAT(schedule_date,'%Y-%m-%d') >= '"+startDate+"' and DATE_FORMAT(schedule_date,'%Y-%m-%d') <= '"+endDate+"'" | |
| 1419 | + + " and fcsj_actual is not null and fcsj_actual != '' and bc_type != 'in' and bc_type != 'out' and bc_type != 'ldks'"; | |
| 1420 | + if(line.length() != 0) | |
| 1421 | + sql += " and xl_bm = '"+line+"'"; | |
| 1422 | + if(company.length() != 0) | |
| 1423 | + sql += " and gs_bm = '"+company+"' and fgs_bm = '"+subCompany+"'"; | |
| 1424 | + | |
| 1425 | + list = jdbcTemplate.query(sql, | |
| 1426 | + new RowMapper<ScheduleRealInfo>(){ | |
| 1427 | + @Override | |
| 1428 | + public ScheduleRealInfo mapRow(ResultSet rs, int rowNum) throws SQLException { | |
| 1429 | + ScheduleRealInfo schedule = new ScheduleRealInfo(); | |
| 1430 | + schedule.setScheduleDateStr(rs.getString("schedule_date_Str")); | |
| 1431 | + schedule.setRealExecDate(rs.getString("real_exec_date")); | |
| 1432 | + schedule.setXlName(rs.getString("xl_name")); | |
| 1433 | + schedule.setFcsj(rs.getString("fcsj")); | |
| 1434 | + schedule.setFcsjActual(rs.getString("fcsj_actual")); | |
| 1435 | + schedule.setZdsj(rs.getString("zdsj")); | |
| 1436 | + schedule.setZdsjActual(rs.getString("zdsj_actual")); | |
| 1437 | + schedule.setQdzName(rs.getString("qdz_name")); | |
| 1438 | + schedule.setZdzName(rs.getString("zdz_name")); | |
| 1439 | + schedule.setXlDir(rs.getString("xl_dir")); | |
| 1440 | + schedule.setStatus(rs.getInt("status")); | |
| 1441 | + schedule.setGsName(rs.getString("gs_name")); | |
| 1442 | + schedule.setFgsName(rs.getString("fgs_name")); | |
| 1443 | + | |
| 1444 | + int startOpt = 0; | |
| 1445 | + if(rs.getString("start_opt") != null && rs.getString("start_opt").trim().length() != 0){ | |
| 1446 | + String[] split = rs.getString("start_opt").split(":"); | |
| 1447 | + startOpt = Integer.valueOf(split[0])*60 + Integer.valueOf(split[1]); | |
| 1448 | + } | |
| 1449 | + | |
| 1450 | + if(schedule.getFcsjActual() != null && schedule.getFcsjActual().trim().length() == 0){ | |
| 1451 | + schedule.setFcsjActual(null); | |
| 1452 | + } | |
| 1453 | + if(schedule.getZdsjActual() != null && schedule.getZdsjActual().trim().length() == 0){ | |
| 1454 | + schedule.setZdsjActual(null); | |
| 1455 | + } | |
| 1456 | + if(schedule.getFcsj() != null){ | |
| 1457 | + String[] split = schedule.getFcsj().split(":"); | |
| 1458 | + int fcsj = Integer.valueOf(split[0]) * 60 + Integer.valueOf(split[1]); | |
| 1459 | + if(fcsj < startOpt) | |
| 1460 | + fcsj += 1440; | |
| 1461 | + schedule.setFcsjT((long)fcsj); | |
| 1462 | + } | |
| 1463 | + if(schedule.getFcsjActual() != null){ | |
| 1464 | + String[] split = schedule.getFcsjActual().split(":"); | |
| 1465 | + int fcsjA = Integer.valueOf(split[0]) * 60 + Integer.valueOf(split[1]); | |
| 1466 | + if(fcsjA < startOpt || !schedule.getRealExecDate().equals(schedule.getScheduleDateStr())) | |
| 1467 | + fcsjA += 1440; | |
| 1468 | + schedule.setFcsjActualTime((long)fcsjA); | |
| 1469 | + } | |
| 1470 | + | |
| 1471 | + return schedule; | |
| 1414 | 1472 | } |
| 1415 | - } | |
| 1473 | + }); | |
| 1416 | 1474 | |
| 1417 | - if(longList0.size() == 0 && longList1.size() == 0){ | |
| 1418 | - continue; | |
| 1475 | + } catch (Exception e) { | |
| 1476 | + // TODO: handle exception | |
| 1477 | + e.printStackTrace(); | |
| 1478 | + } | |
| 1479 | + | |
| 1480 | + Map<String, Map<String, List<ScheduleRealInfo>>> keyMap = new HashMap<String, Map<String,List<ScheduleRealInfo>>>(); | |
| 1481 | + String companyName = "", subCompanyName = ""; | |
| 1482 | + | |
| 1483 | + for(ScheduleRealInfo s : list){ | |
| 1484 | + String xlName = s.getXlName(); | |
| 1485 | + String date = s.getScheduleDateStr(); | |
| 1486 | + if(!keyMap.containsKey(xlName)) | |
| 1487 | + keyMap.put(xlName, new HashMap<String, List<ScheduleRealInfo>>()); | |
| 1488 | + if(!keyMap.get(xlName).containsKey(date)) | |
| 1489 | + keyMap.get(xlName).put(date, new ArrayList<ScheduleRealInfo>()); | |
| 1490 | + keyMap.get(xlName).get(date).add(s); | |
| 1491 | + if(companyName.length()==0&&s.getGsName()!=null&&s.getGsName().trim().length()!=0) | |
| 1492 | + companyName = s.getGsName(); | |
| 1493 | + if(subCompanyName.length()==0&&s.getFgsName()!=null&&s.getFgsName().trim().length()!=0) | |
| 1494 | + subCompanyName = s.getFgsName(); | |
| 1495 | + } | |
| 1496 | + | |
| 1497 | + for(String xlName : keyMap.keySet()){ | |
| 1498 | + List<Map<String, Object>> tempList = new ArrayList<Map<String,Object>>(); | |
| 1499 | + Map<String, Object> tempMap = new HashMap<String, Object>(); | |
| 1500 | + Map<Long, String> dateMap = new HashMap<Long, String>(); | |
| 1501 | + List<Long> Longs = new ArrayList<Long>(); | |
| 1502 | + int jhbc = 0, sjbc = 0; | |
| 1503 | + for(String date : keyMap.get(xlName).keySet()){ | |
| 1504 | + String[] split = date.split("-"); | |
| 1505 | + long l = Long.valueOf(split[0])*10000 + Long.valueOf(split[1])*100 + Long.valueOf(split[2]); | |
| 1506 | + dateMap.put(l, date); | |
| 1507 | + Longs.add(l); | |
| 1419 | 1508 | } |
| 1420 | - int jhbc = 0; | |
| 1421 | - int sjbc = 0; | |
| 1422 | - | |
| 1423 | - if(longList0.size() != 0){ | |
| 1424 | - Collections.sort(longList0); | |
| 1425 | - ScheduleRealInfo shouban0 = temp0.get(longList0.get(0)); | |
| 1426 | - ScheduleRealInfo moban0 = temp0.get(longList0.get(longList0.size() - 1)); | |
| 1427 | - if(shouban0.getFcsjActual() != null){ | |
| 1428 | - jhbc++; | |
| 1429 | - String[] split = shouban0.getFcsjActual().split(":"); | |
| 1430 | - long min = Integer.valueOf(split[0])*60 + Integer.valueOf(split[1]); | |
| 1431 | - long delay = shouban0.getFcsjT() - min; | |
| 1432 | - if(delay >= -3 && delay <= 1){ | |
| 1433 | - sjbc++; | |
| 1509 | + Collections.sort(Longs); | |
| 1510 | + for(long l : Longs){ | |
| 1511 | + String date = dateMap.get(l); | |
| 1512 | + Map<String, Object> temp = new HashMap<String, Object>(); | |
| 1513 | + temp.put("date", date.substring(5)); | |
| 1514 | + temp.put("line", xlName); | |
| 1515 | + List<Long> up1 = new ArrayList<Long>(); | |
| 1516 | + List<Long> up2 = new ArrayList<Long>();; | |
| 1517 | + List<Long> dn1 = new ArrayList<Long>(); | |
| 1518 | + List<Long> dn2 = new ArrayList<Long>(); | |
| 1519 | + Map<Long, ScheduleRealInfo> up1Map = new HashMap<Long, ScheduleRealInfo>(); | |
| 1520 | + Map<Long, ScheduleRealInfo> up2Map = new HashMap<Long, ScheduleRealInfo>(); | |
| 1521 | + Map<Long, ScheduleRealInfo> dn1Map = new HashMap<Long, ScheduleRealInfo>(); | |
| 1522 | + Map<Long, ScheduleRealInfo> dn2Map = new HashMap<Long, ScheduleRealInfo>(); | |
| 1523 | + for(ScheduleRealInfo s : keyMap.get(xlName).get(date)){ | |
| 1524 | + if(s.getXlDir().equals("0")){ | |
| 1525 | + up1.add(s.getFcsjT()); | |
| 1526 | + up2.add(s.getFcsjActualTime()); | |
| 1527 | + up1Map.put(s.getFcsjT(), s); | |
| 1528 | + up2Map.put(s.getFcsjActualTime(), s); | |
| 1529 | + } else if(s.getXlDir().equals("1")){ | |
| 1530 | + dn1.add(s.getFcsjT()); | |
| 1531 | + dn2.add(s.getFcsjActualTime()); | |
| 1532 | + dn1Map.put(s.getFcsjT(), s); | |
| 1533 | + dn2Map.put(s.getFcsjActualTime(), s); | |
| 1434 | 1534 | } |
| 1435 | - m.put("qdzFirst0", shouban0.getQdzName()); | |
| 1436 | - m.put("jhfcFirst0", shouban0.getFcsj()); | |
| 1437 | - m.put("sjfcFirst0", shouban0.getFcsjActual()); | |
| 1438 | - m.put("delayFirst0", delay>0?"+"+delay:delay); | |
| 1439 | 1535 | } |
| 1440 | - | |
| 1441 | - if(moban0.getFcsjActual() != null){ | |
| 1442 | - jhbc++; | |
| 1443 | - String[] split = moban0.getFcsjActual().split(":"); | |
| 1444 | - long min = Integer.valueOf(split[0])*60 + Integer.valueOf(split[1]); | |
| 1445 | - long delay = moban0.getFcsjT() - min; | |
| 1446 | - if(delay >= -3 && delay <= 1){ | |
| 1536 | + if(up1.size() > 0 && up2.size() > 0){ | |
| 1537 | + Collections.sort(up1); | |
| 1538 | + Collections.sort(up2); | |
| 1539 | + ScheduleRealInfo s1 = up1Map.get(up1.get(0)); | |
| 1540 | + ScheduleRealInfo s2 = up2Map.get(up2.get(0)); | |
| 1541 | + ScheduleRealInfo s3 = up1Map.get(up1.get(up1.size()-1)); | |
| 1542 | + ScheduleRealInfo s4 = up2Map.get(up2.get(up2.size()-1)); | |
| 1543 | + long delayFirst0 = up1.get(0) - up2.get(0); | |
| 1544 | + long delayLast0 = up1.get(up1.size()-1) - up2.get(up2.size()-1); | |
| 1545 | + temp.put("qdzFirst0", s1.getQdzName()); | |
| 1546 | + temp.put("jhfcFirst0", s1.getFcsj()); | |
| 1547 | + temp.put("sjfcFirst0", s2.getFcsjActual()); | |
| 1548 | + temp.put("delayFirst0", delayFirst0>0?"+"+delayFirst0:delayFirst0); | |
| 1549 | + temp.put("qdzLast0", s3.getQdzName()); | |
| 1550 | + temp.put("jhfcLast0", s3.getFcsj()); | |
| 1551 | + temp.put("sjfcLast0", s4.getFcsjActual()); | |
| 1552 | + temp.put("delayLast0", delayLast0>0?"+"+delayLast0:delayLast0); | |
| 1553 | + jhbc += 2; | |
| 1554 | + if(delayFirst0 <= 1l && delayFirst0 >= -3l) | |
| 1447 | 1555 | sjbc++; |
| 1448 | - } | |
| 1449 | - m.put("qdzLast0", moban0.getQdzName()); | |
| 1450 | - m.put("jhfcLast0", moban0.getFcsj()); | |
| 1451 | - m.put("sjfcLast0", moban0.getFcsjActual()); | |
| 1452 | - m.put("delayLast0", delay>0?"+"+delay:delay); | |
| 1453 | - } | |
| 1454 | - } else { | |
| 1455 | - m.put("qdzFirst0", "--"); | |
| 1456 | - m.put("jhfcFirst0", "/"); | |
| 1457 | - m.put("sjfcFirst0", "/"); | |
| 1458 | - m.put("delayFirst0", "/"); | |
| 1459 | - m.put("qdzLast0", "--"); | |
| 1460 | - m.put("jhfcLast0", "/"); | |
| 1461 | - m.put("sjfcLast0", "/"); | |
| 1462 | - m.put("delayLast0", "/"); | |
| 1463 | - } | |
| 1464 | - | |
| 1465 | - if(longList1.size() != 0){ | |
| 1466 | - Collections.sort(longList1); | |
| 1467 | - ScheduleRealInfo shouban1 = temp1.get(longList1.get(0)); | |
| 1468 | - ScheduleRealInfo moban1 = temp1.get(longList1.get(longList1.size() - 1)); | |
| 1469 | - if(shouban1.getFcsjActual() != null){ | |
| 1470 | - jhbc++; | |
| 1471 | - String[] split = shouban1.getFcsjActual().split(":"); | |
| 1472 | - long min = Integer.valueOf(split[0])*60 + Integer.valueOf(split[1]); | |
| 1473 | - long delay = shouban1.getFcsjT() - min; | |
| 1474 | - if(delay >= -3 && delay <= 1){ | |
| 1556 | + if(delayLast0 <= 1l && delayLast0 >= -3l) | |
| 1475 | 1557 | sjbc++; |
| 1476 | - } | |
| 1477 | - m.put("qdzFirst1", shouban1.getQdzName()); | |
| 1478 | - m.put("jhfcFirst1", shouban1.getFcsj()); | |
| 1479 | - m.put("sjfcFirst1", shouban1.getFcsjActual()); | |
| 1480 | - m.put("delayFirst1", delay>0?"+"+delay:delay); | |
| 1558 | + } else { | |
| 1559 | + temp.put("qdzFirst0", "--"); | |
| 1560 | + temp.put("jhfcFirst0", "/"); | |
| 1561 | + temp.put("sjfcFirst0", "/"); | |
| 1562 | + temp.put("delayFirst0", "/"); | |
| 1563 | + temp.put("qdzLast0", "--"); | |
| 1564 | + temp.put("jhfcLast0", "/"); | |
| 1565 | + temp.put("sjfcLast0", "/"); | |
| 1566 | + temp.put("delayLast0", "/"); | |
| 1481 | 1567 | } |
| 1482 | - | |
| 1483 | - if(moban1.getFcsjActual() != null){ | |
| 1484 | - jhbc++; | |
| 1485 | - String[] split = moban1.getFcsjActual().split(":"); | |
| 1486 | - long min = Integer.valueOf(split[0])*60 + Integer.valueOf(split[1]); | |
| 1487 | - long delay = moban1.getFcsjT() - min; | |
| 1488 | - if(delay >= -3 && delay <= 1){ | |
| 1568 | + if(dn1.size() > 0 && dn2.size() > 0){ | |
| 1569 | + Collections.sort(dn1); | |
| 1570 | + Collections.sort(dn2); | |
| 1571 | + ScheduleRealInfo s1 = dn1Map.get(dn1.get(0)); | |
| 1572 | + ScheduleRealInfo s2 = dn2Map.get(dn2.get(0)); | |
| 1573 | + ScheduleRealInfo s3 = dn1Map.get(dn1.get(dn1.size()-1)); | |
| 1574 | + ScheduleRealInfo s4 = dn2Map.get(dn2.get(dn2.size()-1)); | |
| 1575 | + long delayFirst1 = dn1.get(0) - dn2.get(0); | |
| 1576 | + long delayLast1 = dn1.get(dn1.size()-1) - dn2.get(dn2.size()-1); | |
| 1577 | + temp.put("qdzFirst1", s1.getQdzName()); | |
| 1578 | + temp.put("jhfcFirst1", s1.getFcsj()); | |
| 1579 | + temp.put("sjfcFirst1", s2.getFcsjActual()); | |
| 1580 | + temp.put("delayFirst1", delayFirst1>0?"+"+delayFirst1:delayFirst1); | |
| 1581 | + temp.put("qdzLast1", s3.getQdzName()); | |
| 1582 | + temp.put("jhfcLast1", s3.getFcsj()); | |
| 1583 | + temp.put("sjfcLast1", s4.getFcsjActual()); | |
| 1584 | + temp.put("delayLast1", delayLast1>0?"+"+delayLast1:delayLast1); | |
| 1585 | + jhbc += 2; | |
| 1586 | + if(delayFirst1 <= 1l && delayFirst1 >= -3l) | |
| 1489 | 1587 | sjbc++; |
| 1490 | - } | |
| 1491 | - m.put("qdzLast1", moban1.getQdzName()); | |
| 1492 | - m.put("jhfcLast1", moban1.getFcsj()); | |
| 1493 | - m.put("sjfcLast1", moban1.getFcsjActual()); | |
| 1494 | - m.put("delayLast1", delay>0?"+"+delay:delay); | |
| 1588 | + if(delayLast1 <= 1l && delayLast1 >= -3l) | |
| 1589 | + sjbc++; | |
| 1590 | + } else { | |
| 1591 | + temp.put("qdzFirst1", "--"); | |
| 1592 | + temp.put("jhfcFirst1", "/"); | |
| 1593 | + temp.put("sjfcFirst1", "/"); | |
| 1594 | + temp.put("delayFirst1", "/"); | |
| 1595 | + temp.put("qdzLast1", "--"); | |
| 1596 | + temp.put("jhfcLast1", "/"); | |
| 1597 | + temp.put("sjfcLast1", "/"); | |
| 1598 | + temp.put("delayLast1", "/"); | |
| 1495 | 1599 | } |
| 1496 | - } else { | |
| 1497 | - m.put("qdzFirst1", "--"); | |
| 1498 | - m.put("jhfcFirst1", "/"); | |
| 1499 | - m.put("sjfcFirst1", "/"); | |
| 1500 | - m.put("delayFirst1", "/"); | |
| 1501 | - m.put("qdzLast1", "--"); | |
| 1502 | - m.put("jhfcLast1", "/"); | |
| 1503 | - m.put("sjfcLast1", "/"); | |
| 1504 | - m.put("delayLast1", "/"); | |
| 1600 | + tempList.add(temp); | |
| 1505 | 1601 | } |
| 1506 | - | |
| 1507 | - m.put("line", key); | |
| 1508 | - tempMap.put("map", m); | |
| 1602 | + tempMap.put("map", tempList); | |
| 1603 | + tempMap.put("company", companyName); | |
| 1604 | + tempMap.put("subCompany", subCompanyName); | |
| 1605 | + tempMap.put("date", dates); | |
| 1606 | + tempMap.put("line", xlName); | |
| 1509 | 1607 | tempMap.put("jhbc", jhbc); |
| 1510 | 1608 | tempMap.put("sjbc", sjbc); |
| 1511 | 1609 | tempMap.put("zdl", nf.format((float) sjbc / jhbc *100) + "%"); |
| 1512 | - tempMap.put("date", date); | |
| 1513 | - tempMap.put("company", companyName); | |
| 1514 | - tempMap.put("subCompany", subCompanyName); | |
| 1515 | - tempMap.put("line", key); | |
| 1516 | 1610 | resList.add(tempMap); |
| 1517 | 1611 | } |
| 1612 | + | |
| 1613 | + Map<String, Object> tempMap = new HashMap<String, Object>(); | |
| 1614 | + if(resList.size() > 0){ | |
| 1615 | + tempMap.put("date", "合计汇总"); | |
| 1616 | + int jhbc = 0, sjbc = 0; | |
| 1617 | + for(Map<String, Object> m : resList){ | |
| 1618 | + jhbc += Integer.valueOf(m.get("jhbc").toString()); | |
| 1619 | + sjbc += Integer.valueOf(m.get("sjbc").toString()); | |
| 1620 | + } | |
| 1621 | + tempMap.put("jhbc", jhbc); | |
| 1622 | + tempMap.put("sjbc", sjbc); | |
| 1623 | + tempMap.put("zdl", nf.format((float) sjbc / jhbc *100) + "%"); | |
| 1624 | + if(!type.equals("export")) | |
| 1625 | + resList.add(tempMap); | |
| 1626 | + } | |
| 1518 | 1627 | |
| 1519 | 1628 | if(type.equals("export")){ |
| 1520 | 1629 | SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"), |
| ... | ... | @@ -1525,8 +1634,9 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService { |
| 1525 | 1634 | try { |
| 1526 | 1635 | listI.add(resList.iterator()); |
| 1527 | 1636 | String path = this.getClass().getResource("/").getPath()+"static/pages/forms/"; |
| 1528 | - ee.excelReplace(listI, new Object[] { m }, path+"mould/firstAndLastBus_sum.xls", | |
| 1529 | - path+"export/线路首末班准点率" + sdfSimple.format(sdfMonth.parse(date)) + ".xls"); | |
| 1637 | + ee.excelReplace(listI, new Object[] { tempMap }, path+"mould/firstAndLastBus_sum.xls", | |
| 1638 | + path+"export/线路首末班准点率" + sdfSimple.format(sdfMonth.parse(startDate)) + | |
| 1639 | + (startDate.equals(endDate)?"":"-"+sdfSimple.format(sdfMonth.parse(endDate))) + ".xls"); | |
| 1530 | 1640 | } catch (Exception e) { |
| 1531 | 1641 | // TODO: handle exception |
| 1532 | 1642 | e.printStackTrace(); | ... | ... |
src/main/resources/static/pages/forms/mould/firstAndLastBus_sum.xls
No preview for this file type
src/main/resources/static/pages/forms/statement/firstAndLastBus.html
| ... | ... | @@ -7,7 +7,8 @@ |
| 7 | 7 | .table-bordered > tbody > tr > td, |
| 8 | 8 | .table-bordered > tfoot > tr > th, |
| 9 | 9 | .table-bordered > tfoot > tr > td { |
| 10 | - border: 1px solid; } | |
| 10 | + border: 1px solid; | |
| 11 | + text-align: center; } | |
| 11 | 12 | .table-bordered > thead > tr > th, |
| 12 | 13 | .table-bordered > thead > tr > td { |
| 13 | 14 | border-bottom-width: 2px; } |
| ... | ... | @@ -250,7 +251,7 @@ |
| 250 | 251 | <td>{{obj.company}}</td> |
| 251 | 252 | <td>{{obj.subCompany}}</td> |
| 252 | 253 | <td>{{obj.line}}</td> |
| 253 | - {{if obj.delayFirst0 != '/' && obj.delayFirst0 != '0'}} | |
| 254 | + {{if obj.delayFirst0 != '/' && (obj.delayFirst0 > 1 || obj.delayFirst0 < -2)}} | |
| 254 | 255 | <td style="background-color: #FF9999">{{obj.qdzFirst0}}</td> |
| 255 | 256 | <td style="background-color: #FF9999">{{obj.jhfcFirst0}}</td> |
| 256 | 257 | <td style="background-color: #FF9999">{{obj.sjfcFirst0}}</td> |
| ... | ... | @@ -261,7 +262,7 @@ |
| 261 | 262 | <td>{{obj.sjfcFirst0}}</td> |
| 262 | 263 | <td>{{obj.delayFirst0}}</td> |
| 263 | 264 | {{/if}} |
| 264 | - {{if obj.delayLast0 != '/' && obj.delayLast0 != '0'}} | |
| 265 | + {{if obj.delayLast0 != '/' && (obj.delayLast0 > 1 || obj.delayLast0 < -2)}} | |
| 265 | 266 | <td style="background-color: #FF9999">{{obj.qdzLast0}}</td> |
| 266 | 267 | <td style="background-color: #FF9999">{{obj.jhfcLast0}}</td> |
| 267 | 268 | <td style="background-color: #FF9999">{{obj.sjfcLast0}}</td> |
| ... | ... | @@ -272,7 +273,7 @@ |
| 272 | 273 | <td>{{obj.sjfcLast0}}</td> |
| 273 | 274 | <td>{{obj.delayLast0}}</td> |
| 274 | 275 | {{/if}} |
| 275 | - {{if obj.delayFirst1 != '/' && obj.delayFirst1 != '0'}} | |
| 276 | + {{if obj.delayFirst1 != '/' && (obj.delayFirst1 > 1 || obj.delayFirst1 < -2)}} | |
| 276 | 277 | <td style="background-color: #FF9999">{{obj.qdzFirst1}}</td> |
| 277 | 278 | <td style="background-color: #FF9999">{{obj.jhfcFirst1}}</td> |
| 278 | 279 | <td style="background-color: #FF9999">{{obj.sjfcFirst1}}</td> |
| ... | ... | @@ -283,7 +284,7 @@ |
| 283 | 284 | <td>{{obj.sjfcFirst1}}</td> |
| 284 | 285 | <td>{{obj.delayFirst1}}</td> |
| 285 | 286 | {{/if}} |
| 286 | - {{if obj.delayLast1 != '/' && obj.delayLast1 != '0'}} | |
| 287 | + {{if obj.delayLast1 != '/' && (obj.delayLast1 > 1 || obj.delayLast1 < -2)}} | |
| 287 | 288 | <td style="background-color: #FF9999">{{obj.qdzLast1}}</td> |
| 288 | 289 | <td style="background-color: #FF9999">{{obj.jhfcLast1}}</td> |
| 289 | 290 | <td style="background-color: #FF9999">{{obj.sjfcLast1}}</td> | ... | ... |
src/main/resources/static/pages/forms/statement/firstAndLastBus_sum.html
| ... | ... | @@ -7,7 +7,8 @@ |
| 7 | 7 | .table-bordered > tbody > tr > td, |
| 8 | 8 | .table-bordered > tfoot > tr > th, |
| 9 | 9 | .table-bordered > tfoot > tr > td { |
| 10 | - border: 1px solid; } | |
| 10 | + border: 1px solid; | |
| 11 | + text-align: center; } | |
| 11 | 12 | .table-bordered > thead > tr > th, |
| 12 | 13 | .table-bordered > thead > tr > td { |
| 13 | 14 | border-bottom-width: 2px; } |
| ... | ... | @@ -27,11 +28,11 @@ |
| 27 | 28 | <div class="portlet light porttlet-fit bordered"> |
| 28 | 29 | <div class="portlet-title"> |
| 29 | 30 | <form id="history" class="form-inline" action=""> |
| 30 | - <div style="display: inline-block;margin-left: 10px;" id="company1"> | |
| 31 | + <div style="display: inline-block;margin-left: 28px;" id="company1"> | |
| 31 | 32 | <span class="item-label" style="width: 80px;">公司: </span> |
| 32 | 33 | <select class="form-control" name="company" id="company" style="width: 160px;"></select> |
| 33 | 34 | </div> |
| 34 | - <div style="display: inline-block;margin-left: 10px;" id="subCompany1"> | |
| 35 | + <div style="display: inline-block;margin-left: 24px;" id="subCompany1"> | |
| 35 | 36 | <span class="item-label" style="width: 80px;">分公司: </span> |
| 36 | 37 | <select class="form-control" name="subCompany" id="subCompany" style="width: 160px;"></select> |
| 37 | 38 | </div> |
| ... | ... | @@ -39,11 +40,16 @@ |
| 39 | 40 | <span class="item-label" style="width: 80px;">线路: </span> |
| 40 | 41 | <select class="form-control" name="line" id="line" style="width: 160px;"></select> |
| 41 | 42 | </div> |
| 43 | + <div style="margin-top: 10px"></div> | |
| 44 | + <div style="display: inline-block;margin-left: 0px;"> | |
| 45 | + <span class="item-label" style="width: 80px;">开始时间: </span> | |
| 46 | + <input class="form-control" type="text" id="startDate" style="width: 160px;"/> | |
| 47 | + </div> | |
| 42 | 48 | <div style="display: inline-block;margin-left: 10px;"> |
| 43 | - <span class="item-label" style="width: 80px;">时间: </span> | |
| 44 | - <input class="form-control" type="text" id="date" style="width: 160px;"/> | |
| 49 | + <span class="item-label" style="width: 80px;">结束时间: </span> | |
| 50 | + <input class="form-control" type="text" id="endDate" style="width: 160px;"/> | |
| 45 | 51 | </div> |
| 46 | - <div class="form-group"> | |
| 52 | + <div class="form-group" style="margin-left: 10px;"> | |
| 47 | 53 | <input class="btn btn-default" type="button" id="query" value="筛选"/> |
| 48 | 54 | <input class="btn btn-default" type="button" id="export" value="导出"/> |
| 49 | 55 | </div> |
| ... | ... | @@ -54,7 +60,7 @@ |
| 54 | 60 | <table class="table table-bordered table-hover table-checkable" id="forms"> |
| 55 | 61 | <thead> |
| 56 | 62 | <tr class="hidden"> |
| 57 | - <th>日期</th> | |
| 63 | + <th width="240px">日期</th> | |
| 58 | 64 | <th>公司</th> |
| 59 | 65 | <th>分公司</th> |
| 60 | 66 | <th>线路</th> |
| ... | ... | @@ -73,6 +79,7 @@ |
| 73 | 79 | <thead> |
| 74 | 80 | <tr class="hidden"> |
| 75 | 81 | <th style="display: none;"></th> |
| 82 | + <th rowspan="2">日期</th> | |
| 76 | 83 | <th rowspan="2">线路</th> |
| 77 | 84 | <th colspan="4">上行首发</th> |
| 78 | 85 | <th colspan="4">上行末发</th> |
| ... | ... | @@ -116,12 +123,12 @@ |
| 116 | 123 | // 关闭左侧栏 |
| 117 | 124 | if (!$('body').hasClass('page-sidebar-closed')) |
| 118 | 125 | $('.menu-toggler.sidebar-toggler').click(); |
| 119 | - | |
| 120 | - $("#date").datetimepicker({ | |
| 126 | + | |
| 127 | + $("#startDate,#endDate").datetimepicker({ | |
| 121 | 128 | format : 'YYYY-MM-DD', |
| 122 | 129 | locale : 'zh-cn' |
| 123 | 130 | }); |
| 124 | - | |
| 131 | + | |
| 125 | 132 | var d = new Date(); |
| 126 | 133 | var year = d.getFullYear(); |
| 127 | 134 | var month = d.getMonth() + 1; |
| ... | ... | @@ -130,7 +137,7 @@ |
| 130 | 137 | month = "0" + month; |
| 131 | 138 | if(day < 10) |
| 132 | 139 | day = "0" + day; |
| 133 | - $("#date").val(year + "-" + month + "-" + day); | |
| 140 | + $("#startDate,#endDate").val(year + "-" + month + "-" + day); | |
| 134 | 141 | |
| 135 | 142 | var fage=false; |
| 136 | 143 | var xlList; |
| ... | ... | @@ -216,9 +223,14 @@ |
| 216 | 223 | var company = $("#company").val(); |
| 217 | 224 | var subCompany = $("#subCompany").val(); |
| 218 | 225 | var line = $("#line").val(); |
| 219 | - var date = $("#date").val(); | |
| 226 | + var startDate = $("#startDate").val(); | |
| 227 | + var endDate = $("#endDate").val(); | |
| 220 | 228 | function jsDoQuery(pagination){ |
| 221 | - if($("#date").val() == null || $("#date").val().trim().length == 0){ | |
| 229 | + if($("#startDate").val() == null || $("#startDate").val().trim().length == 0){ | |
| 230 | + layer.msg("请选择时间!"); | |
| 231 | + return; | |
| 232 | + } | |
| 233 | + if($("#endDate").val() == null || $("#endDate").val().trim().length == 0){ | |
| 222 | 234 | layer.msg("请选择时间!"); |
| 223 | 235 | return; |
| 224 | 236 | } |
| ... | ... | @@ -226,14 +238,15 @@ |
| 226 | 238 | company = $("#company").val(); |
| 227 | 239 | subCompany = $("#subCompany").val(); |
| 228 | 240 | line = $("#line").val(); |
| 229 | - date = $("#date").val(); | |
| 241 | + startDate = $("#startDate").val(); | |
| 242 | + endDate = $("#endDate").val(); | |
| 230 | 243 | if(line == " ") |
| 231 | 244 | line = ""; |
| 232 | 245 | params['company'] = company; |
| 233 | 246 | params['subCompany'] = subCompany; |
| 234 | 247 | params['line'] = line; |
| 235 | - params['line'] = line; | |
| 236 | - params['date'] = date; | |
| 248 | + params['startDate'] = startDate; | |
| 249 | + params['endDate'] = endDate; | |
| 237 | 250 | params['type'] = "query"; |
| 238 | 251 | $("#forms .hidden").removeClass("hidden"); |
| 239 | 252 | $("#map tr").addClass("hidden"); |
| ... | ... | @@ -253,19 +266,15 @@ |
| 253 | 266 | } |
| 254 | 267 | |
| 255 | 268 | $("#export").on("click",function(){ |
| 256 | - if($("#date").val() == null || $("#date").val().trim().length == 0){ | |
| 257 | - layer.msg("请选择时间!"); | |
| 258 | - return; | |
| 259 | - } | |
| 260 | 269 | var params = {}; |
| 261 | 270 | params['company'] = company; |
| 262 | 271 | params['subCompany'] = subCompany; |
| 263 | 272 | params['line'] = line; |
| 264 | - params['line'] = line; | |
| 265 | - params['date'] = date; | |
| 273 | + params['startDate'] = startDate; | |
| 274 | + params['endDate'] = endDate; | |
| 266 | 275 | params['type'] = "export"; |
| 267 | 276 | $get('/pcpc/firstAndLastBus_sum', params, function(result){ |
| 268 | - window.open("/downloadFile/download?fileName=线路首末班准点率"+moment(date).format("YYYYMMDD")); | |
| 277 | + window.open("/downloadFile/download?fileName=线路首末班准点率"+moment(startDate).format("YYYYMMDD")+(startDate==endDate?"":("-"+moment(endDate).format("YYYYMMDD")))); | |
| 269 | 278 | }); |
| 270 | 279 | }); |
| 271 | 280 | |
| ... | ... | @@ -276,13 +285,20 @@ |
| 276 | 285 | <script type="text/html" id="list_firstAndLastBus"> |
| 277 | 286 | {{each list as obj i}} |
| 278 | 287 | <tr> |
| 279 | - <td>{{obj.date}}</td> | |
| 280 | - <td>{{obj.company}}</td> | |
| 281 | - <td>{{obj.subCompany}}</td> | |
| 282 | - <td>{{obj.line}}</td> | |
| 283 | - <td>{{obj.jhbc}}</td> | |
| 284 | - <td>{{obj.sjbc}}</td> | |
| 285 | - <td><a id='delay'>{{obj.zdl}}</a></td> | |
| 288 | + {{if obj.date != '合计汇总'}} | |
| 289 | + <td>{{obj.date}}</td> | |
| 290 | + <td>{{obj.company}}</td> | |
| 291 | + <td>{{obj.subCompany}}</td> | |
| 292 | + <td>{{obj.line}}</td> | |
| 293 | + <td>{{obj.jhbc}}</td> | |
| 294 | + <td>{{obj.sjbc}}</td> | |
| 295 | + <td><a id='delay'>{{obj.zdl}}</a></td> | |
| 296 | + {{else}} | |
| 297 | + <td colspan='4'>{{obj.date}}</td> | |
| 298 | + <td>{{obj.jhbc}}</td> | |
| 299 | + <td>{{obj.sjbc}}</td> | |
| 300 | + <td>{{obj.zdl}}</td> | |
| 301 | + {{/if}} | |
| 286 | 302 | </tr> |
| 287 | 303 | {{/each}} |
| 288 | 304 | {{if list.length == 0}} |
| ... | ... | @@ -292,23 +308,26 @@ |
| 292 | 308 | {{/if}} |
| 293 | 309 | </script> |
| 294 | 310 | <script type="text/html" id="list_maps"> |
| 311 | + {{each list as obj i}} | |
| 295 | 312 | <tr> |
| 296 | - <td>{{list.line}}</td> | |
| 297 | - <td>{{list.qdzFirst0}}</td> | |
| 298 | - <td>{{list.jhfcFirst0}}</td> | |
| 299 | - <td>{{list.sjfcFirst0}}</td> | |
| 300 | - <td>{{list.delayFirst0}}</td> | |
| 301 | - <td>{{list.qdzLast0}}</td> | |
| 302 | - <td>{{list.jhfcLast0}}</td> | |
| 303 | - <td>{{list.sjfcLast0}}</td> | |
| 304 | - <td>{{list.delayLast0}}</td> | |
| 305 | - <td>{{list.qdzFirst1}}</td> | |
| 306 | - <td>{{list.jhfcFirst1}}</td> | |
| 307 | - <td>{{list.sjfcFirst1}}</td> | |
| 308 | - <td>{{list.delayFirst1}}</td> | |
| 309 | - <td>{{list.qdzLast1}}</td> | |
| 310 | - <td>{{list.jhfcLast1}}</td> | |
| 311 | - <td>{{list.sjfcLast1}}</td> | |
| 312 | - <td>{{list.delayLast1}}</td> | |
| 313 | + <td>{{obj.date}}</td> | |
| 314 | + <td>{{obj.line}}</td> | |
| 315 | + <td>{{obj.qdzFirst0}}</td> | |
| 316 | + <td>{{obj.jhfcFirst0}}</td> | |
| 317 | + <td>{{obj.sjfcFirst0}}</td> | |
| 318 | + <td>{{obj.delayFirst0}}</td> | |
| 319 | + <td>{{obj.qdzLast0}}</td> | |
| 320 | + <td>{{obj.jhfcLast0}}</td> | |
| 321 | + <td>{{obj.sjfcLast0}}</td> | |
| 322 | + <td>{{obj.delayLast0}}</td> | |
| 323 | + <td>{{obj.qdzFirst1}}</td> | |
| 324 | + <td>{{obj.jhfcFirst1}}</td> | |
| 325 | + <td>{{obj.sjfcFirst1}}</td> | |
| 326 | + <td>{{obj.delayFirst1}}</td> | |
| 327 | + <td>{{obj.qdzLast1}}</td> | |
| 328 | + <td>{{obj.jhfcLast1}}</td> | |
| 329 | + <td>{{obj.sjfcLast1}}</td> | |
| 330 | + <td>{{obj.delayLast1}}</td> | |
| 313 | 331 | </tr> |
| 332 | + {{/each}} | |
| 314 | 333 | </script> |
| 315 | 334 | \ No newline at end of file | ... | ... |