Commit d26340437fc4666e02640bc5dedbf64ff09eb430
Merge branch 'pudong' of 192.168.168.201:panzhaov5/bsth_control into pudong
Showing
9 changed files
with
124 additions
and
1 deletions
Too many changes to show.
To preserve performance only 9 of 19 files are displayed.
src/main/java/com/bsth/controller/oil/YlbController.java
| ... | ... | @@ -229,6 +229,12 @@ public class YlbController extends BaseController<Ylb, Integer>{ |
| 229 | 229 | return list; |
| 230 | 230 | } |
| 231 | 231 | |
| 232 | + @RequestMapping(value = "/checkDate",method = RequestMethod.GET) | |
| 233 | + public String checkDate(@RequestParam Map<String, Object> map){ | |
| 234 | + String list=ylbService.checkDate(map); | |
| 235 | + return list; | |
| 236 | + } | |
| 237 | + | |
| 232 | 238 | @RequestMapping(value = "/sumYlb",method = RequestMethod.GET) |
| 233 | 239 | public Map<String, Object> sumYlb(@RequestParam Map<String, Object> map){ |
| 234 | 240 | Map<String, Object> list=ylbService.sumYlb(map); | ... | ... |
src/main/java/com/bsth/controller/report/ReportController.java
| ... | ... | @@ -209,6 +209,12 @@ public class ReportController { |
| 209 | 209 | return service.historyMessageCount(line, date, code); |
| 210 | 210 | } |
| 211 | 211 | |
| 212 | + @RequestMapping(value = "/historyMessageList", method = RequestMethod.GET) | |
| 213 | + public List<Object[]> historyMessageList(@RequestParam String line, @RequestParam String date, | |
| 214 | + @RequestParam String code,@RequestParam String type) { | |
| 215 | + return service.historyMessageList(line, date, code, type); | |
| 216 | + } | |
| 217 | + | |
| 212 | 218 | @RequestMapping(value = "/tbodyTime1", method = RequestMethod.GET) |
| 213 | 219 | public Map<String, Object> tbodyTime1(@RequestParam String line,@RequestParam String ttinfo) { |
| 214 | 220 | return service.tbodyTime1(line, ttinfo); | ... | ... |
src/main/java/com/bsth/repository/CarDeviceRepository.java
| 1 | 1 | package com.bsth.repository; |
| 2 | 2 | |
| 3 | 3 | import com.bsth.entity.CarDevice; |
| 4 | + | |
| 5 | +import java.util.Date; | |
| 6 | +import java.util.List; | |
| 7 | + | |
| 8 | +import org.springframework.data.jpa.repository.Query; | |
| 4 | 9 | import org.springframework.stereotype.Repository; |
| 5 | 10 | |
| 6 | 11 | /** |
| ... | ... | @@ -8,4 +13,6 @@ import org.springframework.stereotype.Repository; |
| 8 | 13 | */ |
| 9 | 14 | @Repository |
| 10 | 15 | public interface CarDeviceRepository extends BaseRepository<CarDevice, Long> { |
| 16 | + @Query(value="select s from CarDevice s where s.oldDeviceNo=?1 and s.qyrq>=?2 ") | |
| 17 | + List<CarDevice> findCarDevice(String device,Date date ); | |
| 11 | 18 | } | ... | ... |
src/main/java/com/bsth/repository/realcontrol/ScheduleRealInfoRepository.java
| ... | ... | @@ -58,6 +58,12 @@ public interface ScheduleRealInfoRepository extends BaseRepository<ScheduleRealI |
| 58 | 58 | + " lp_name,xl_name,cl_zbh",nativeQuery=true) |
| 59 | 59 | List<Object[]> historyMessageCount(String line,String date,String code); |
| 60 | 60 | |
| 61 | + @Query(value="SELECT r.xl_name,r.cl_zbh,d.sender,d.timestamp,d.txt_content " | |
| 62 | + + " FROM bsth_c_s_sp_info_real r RIGHT JOIN bsth_v_directive_60 d " | |
| 63 | + + " ON r.id = d.sch WHERE d.is_dispatch = 1 AND r.xl_bm like %?1% AND " | |
| 64 | + + " r.schedule_date_str = ?2 and r.cl_zbh =?3 ",nativeQuery=true) | |
| 65 | + List<Object[]> historyMessageList(String line,String date,String code); | |
| 66 | + | |
| 61 | 67 | @Query(value = "select max(id) from ScheduleRealInfo") |
| 62 | 68 | Long getMaxId(); |
| 63 | 69 | ... | ... |
src/main/java/com/bsth/service/oil/YlbService.java
| ... | ... | @@ -19,6 +19,8 @@ public interface YlbService extends BaseService<Ylb, Integer>{ |
| 19 | 19 | |
| 20 | 20 | Map<String, Object> sumYlb(Map<String, Object> map); |
| 21 | 21 | String checkJsy(Map<String, Object> map); |
| 22 | + String checkDate(Map<String, Object> map); | |
| 23 | + | |
| 22 | 24 | List<Map<String, Object>> oilListMonth(Map<String, Object> map); |
| 23 | 25 | List<Ylb> listYlb(Map<String, Object> map); |
| 24 | 26 | StringBuffer checkNbmmNum(String rq, String gsbm,String fgsbm,String xlbm,String nbbm,int lx); | ... | ... |
src/main/java/com/bsth/service/oil/impl/YlbServiceImpl.java
| ... | ... | @@ -1442,6 +1442,35 @@ public class YlbServiceImpl extends BaseServiceImpl<Ylb,Integer> implements YlbS |
| 1442 | 1442 | } |
| 1443 | 1443 | return type; |
| 1444 | 1444 | } |
| 1445 | + | |
| 1446 | + @Override | |
| 1447 | + public String checkDate(Map<String, Object> map) { | |
| 1448 | + // TODO Auto-generated method stub | |
| 1449 | + SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd"); | |
| 1450 | + String rq=map.get("rq").toString(); | |
| 1451 | + String gsbm=map.get("ssgsdm_like").toString(); | |
| 1452 | + String type="1"; | |
| 1453 | + if(gsbm.equals("26")){ | |
| 1454 | + Date date=new Date(); | |
| 1455 | + Calendar aCalendar = Calendar.getInstance(); | |
| 1456 | + aCalendar.setTime(date); | |
| 1457 | + int day1 = aCalendar.get(Calendar.DAY_OF_YEAR); | |
| 1458 | + try { | |
| 1459 | + aCalendar.setTime(sdf.parse(rq)); | |
| 1460 | + } catch (ParseException e) { | |
| 1461 | + // TODO Auto-generated catch block | |
| 1462 | + e.printStackTrace(); | |
| 1463 | + } | |
| 1464 | + int day2 = aCalendar.get(Calendar.DAY_OF_YEAR); | |
| 1465 | + int days=day1-day2; | |
| 1466 | + if(days>3){ | |
| 1467 | + type="2"; | |
| 1468 | + } | |
| 1469 | + } | |
| 1470 | + return type; | |
| 1471 | + } | |
| 1472 | + | |
| 1473 | + | |
| 1445 | 1474 | |
| 1446 | 1475 | @Override |
| 1447 | 1476 | public Map<String, Object> saveYlb(Ylb t) { | ... | ... |
src/main/java/com/bsth/service/realcontrol/impl/ScheduleRealInfoServiceImpl.java
| ... | ... | @@ -21,6 +21,7 @@ import com.bsth.data.schedule.edit_logs.loggers.FcxxwtLogger; |
| 21 | 21 | import com.bsth.data.schedule.edit_logs.service.dto.SchEditInfoDto; |
| 22 | 22 | import com.bsth.data.schedule.late_adjust.LateAdjustHandle; |
| 23 | 23 | import com.bsth.data.utils.CustomStringUtils; |
| 24 | +import com.bsth.entity.CarDevice; | |
| 24 | 25 | import com.bsth.entity.Cars; |
| 25 | 26 | import com.bsth.entity.Line; |
| 26 | 27 | import com.bsth.entity.Personnel; |
| ... | ... | @@ -39,6 +40,7 @@ import com.bsth.entity.schedule.GuideboardInfo; |
| 39 | 40 | import com.bsth.entity.schedule.SchedulePlanInfo; |
| 40 | 41 | import com.bsth.entity.sys.DutyEmployee; |
| 41 | 42 | import com.bsth.entity.sys.SysUser; |
| 43 | +import com.bsth.repository.CarDeviceRepository; | |
| 42 | 44 | import com.bsth.repository.LineRepository; |
| 43 | 45 | import com.bsth.repository.oil.DlbRepository; |
| 44 | 46 | import com.bsth.repository.oil.YlbRepository; |
| ... | ... | @@ -153,6 +155,9 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl<ScheduleRealInf |
| 153 | 155 | |
| 154 | 156 | @Autowired |
| 155 | 157 | DirectiveService directiveService; |
| 158 | + | |
| 159 | + @Autowired | |
| 160 | + CarDeviceRepository carDeviceRepository; | |
| 156 | 161 | |
| 157 | 162 | Logger logger = LoggerFactory.getLogger(this.getClass()); |
| 158 | 163 | |
| ... | ... | @@ -1097,6 +1102,7 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl<ScheduleRealInf |
| 1097 | 1102 | @Override |
| 1098 | 1103 | public List<Object[]> historyMessage(String line, String date, String code, String type) { |
| 1099 | 1104 | SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); |
| 1105 | + | |
| 1100 | 1106 | long d = 0; |
| 1101 | 1107 | long t = 0; |
| 1102 | 1108 | if (date.length() > 0) { |
| ... | ... | @@ -1116,7 +1122,23 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl<ScheduleRealInf |
| 1116 | 1122 | List<Object[]> list = scheduleRealInfoRepository.historyMessage(line, d, t, device); |
| 1117 | 1123 | for (Object[] obj : list) { |
| 1118 | 1124 | if (obj != null) { |
| 1119 | - obj[0] =BasicData.deviceId2NbbmMap.get(obj[0].toString()); | |
| 1125 | + | |
| 1126 | + if(BasicData.deviceId2NbbmMap.get(obj[0].toString())==null){ | |
| 1127 | + List<CarDevice> carDeviceList=new ArrayList<CarDevice>(); | |
| 1128 | + try { | |
| 1129 | + carDeviceList = carDeviceRepository.findCarDevice(obj[0].toString(), sdf.parse(date + " 00:00:00")); | |
| 1130 | + } catch (ParseException e) { | |
| 1131 | + // TODO Auto-generated catch block | |
| 1132 | + e.printStackTrace(); | |
| 1133 | + } | |
| 1134 | + if(carDeviceList.size()>0){ | |
| 1135 | + obj[0] =carDeviceList.get(0).getClZbh(); | |
| 1136 | + }else{ | |
| 1137 | + obj[0] =BasicData.deviceId2NbbmMap.get(obj[0].toString()); | |
| 1138 | + } | |
| 1139 | + }else{ | |
| 1140 | + obj[0] =BasicData.deviceId2NbbmMap.get(obj[0].toString()); | |
| 1141 | + } | |
| 1120 | 1142 | obj[3] = sdf.format(new Date(Long.parseLong(obj[3].toString()))); |
| 1121 | 1143 | obj[4] = BasicData.lineCode2NameMap.get(line); |
| 1122 | 1144 | } | ... | ... |
src/main/java/com/bsth/service/report/ReportService.java
| ... | ... | @@ -22,6 +22,8 @@ public interface ReportService { |
| 22 | 22 | List<Map<String, String>> sreachZd(String line,int zdlx); |
| 23 | 23 | |
| 24 | 24 | List<Object[]> historyMessageCount(String line, String date, String code); |
| 25 | + List<Object[]> historyMessageList(String line, String date, String code,String type); | |
| 26 | + | |
| 25 | 27 | |
| 26 | 28 | Map<String, Object> tbodyTime1(String line ,String ttinfo); |
| 27 | 29 | ... | ... |
src/main/java/com/bsth/service/report/impl/ReportServiceImpl.java
| 1 | 1 | package com.bsth.service.report.impl; |
| 2 | 2 | import com.bsth.data.BasicData; |
| 3 | +import com.bsth.entity.CarDevice; | |
| 3 | 4 | import com.bsth.entity.Line; |
| 4 | 5 | import com.bsth.entity.Personnel; |
| 5 | 6 | import com.bsth.entity.StationRoute; |
| ... | ... | @@ -278,6 +279,48 @@ public class ReportServiceImpl implements ReportService{ |
| 278 | 279 | return list; |
| 279 | 280 | } |
| 280 | 281 | @Override |
| 282 | + public List<Object[]> historyMessageList(String line, String date, String code,String type) { | |
| 283 | + // TODO Auto-generated method stub | |
| 284 | + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); | |
| 285 | + | |
| 286 | + List<Object[]> list = scheduleRealInfoRepository.historyMessageList(line, date, code); | |
| 287 | + for (Object[] obj : list) { | |
| 288 | + if (obj != null) { | |
| 289 | + obj[3] = sdf.format(new Date(Long.parseLong(obj[3].toString()))); | |
| 290 | + } | |
| 291 | + } | |
| 292 | + | |
| 293 | + if (type != null && type.length() != 0 && type.equals("export_msg")) { | |
| 294 | + SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"), | |
| 295 | + sdfSimple = new SimpleDateFormat("yyyyMMdd"); | |
| 296 | + List<Iterator<?>> listI = new ArrayList<Iterator<?>>(); | |
| 297 | + Map<String, Object> m = new HashMap<String, Object>(); | |
| 298 | + ReportUtils ee = new ReportUtils(); | |
| 299 | + List<Map<String, Object>> newList = new ArrayList<Map<String, Object>>(); | |
| 300 | + for (int i = 0; i < list.size(); i++) { | |
| 301 | + Map<String, Object> map = new HashMap<String, Object>(); | |
| 302 | + Object[] obj = list.get(i); | |
| 303 | + map.put("num", i + 1); | |
| 304 | + map.put("line", obj[0]); | |
| 305 | + map.put("clZbh", obj[1]); | |
| 306 | + map.put("sender", obj[2]); | |
| 307 | + map.put("date", obj[3]); | |
| 308 | + map.put("text", obj[4]); | |
| 309 | + newList.add(map); | |
| 310 | + } | |
| 311 | + try { | |
| 312 | + listI.add(newList.iterator()); | |
| 313 | + String path = this.getClass().getResource("/").getPath() + "static/pages/forms/"; | |
| 314 | + ee.excelReplace(listI, new Object[]{m}, path + "mould/message.xls", | |
| 315 | + path + "export/调度消息分析" + sdfSimple.format(sdfMonth.parse(date)) + ".xls"); | |
| 316 | + } catch (Exception e) { | |
| 317 | + // TODO: handle exception | |
| 318 | + e.printStackTrace(); | |
| 319 | + } | |
| 320 | + } | |
| 321 | + return list; | |
| 322 | + } | |
| 323 | + @Override | |
| 281 | 324 | public Map<String, Object> tbodyTime1(String line, String ttinfo) { |
| 282 | 325 | DecimalFormat df = new DecimalFormat("#0.00"); |
| 283 | 326 | // TODO Auto-generated method stub | ... | ... |