Commit 14ff74a287f3e99ea7d25a531d738e17d6bbbf48
1 parent
06608209
车载上报停靠站添加查询日志
Showing
2 changed files
with
21 additions
and
8 deletions
src/main/java/com/bsth/controller/traffic/VehicleInoutStopController.java
| ... | ... | @@ -2,7 +2,10 @@ package com.bsth.controller.traffic; |
| 2 | 2 | |
| 3 | 3 | import com.bsth.controller.BaseController; |
| 4 | 4 | import com.bsth.entity.traffic.VehicleInoutStop; |
| 5 | +import com.bsth.service.impl.TrafficManageServiceImpl; | |
| 5 | 6 | import com.bsth.service.traffic.VehicleInoutStopService; |
| 7 | +import org.slf4j.Logger; | |
| 8 | +import org.slf4j.LoggerFactory; | |
| 6 | 9 | import org.springframework.beans.factory.annotation.Autowired; |
| 7 | 10 | import org.springframework.data.domain.Page; |
| 8 | 11 | import org.springframework.data.domain.PageImpl; |
| ... | ... | @@ -21,6 +24,7 @@ import java.util.Map; |
| 21 | 24 | @RestController |
| 22 | 25 | @RequestMapping("vehicle_stop") |
| 23 | 26 | public class VehicleInoutStopController extends BaseController<VehicleInoutStop,Integer> { |
| 27 | + Logger logger = LoggerFactory.getLogger(TrafficManageServiceImpl.class); | |
| 24 | 28 | |
| 25 | 29 | @Autowired |
| 26 | 30 | VehicleInoutStopService vehicleInoutStopService; |
| ... | ... | @@ -36,11 +40,18 @@ public class VehicleInoutStopController extends BaseController<VehicleInoutStop, |
| 36 | 40 | public Page<Map<String, Object>> getVehicleInoutStopByParam(@RequestParam Map<String, Object> map, |
| 37 | 41 | @RequestParam(defaultValue = "0") int page, |
| 38 | 42 | @RequestParam(defaultValue = "10") int size) { |
| 39 | - map.put("page",page); | |
| 40 | - map.put("size",size); | |
| 41 | - long total = vehicleInoutStopService.getVehicleInoutStopCountByParam(map); | |
| 42 | - Page<Map<String, Object>> result = new PageImpl<>(vehicleInoutStopService.getVehicleInoutStopByParam(map), | |
| 43 | - new PageRequest(page, size, null),total); | |
| 43 | + Page<Map<String, Object>> result = null; | |
| 44 | + try { | |
| 45 | + map.put("page",page); | |
| 46 | + map.put("size",size); | |
| 47 | + long total = vehicleInoutStopService.getVehicleInoutStopCountByParam(map); | |
| 48 | + result = new PageImpl<>(vehicleInoutStopService.getVehicleInoutStopByParam(map), | |
| 49 | + new PageRequest(page, size, null),total); | |
| 50 | + }catch (Exception e){ | |
| 51 | + logger.error("车载上报停靠站查询出错:",e); | |
| 52 | + e.printStackTrace(); | |
| 53 | + } | |
| 54 | + | |
| 44 | 55 | return result; |
| 45 | 56 | } |
| 46 | 57 | } | ... | ... |
src/main/java/com/bsth/service/traffic/impl/VehicleInoutStopServiceImpl.java
| ... | ... | @@ -2,9 +2,12 @@ package com.bsth.service.traffic.impl; |
| 2 | 2 | |
| 3 | 3 | import com.bsth.entity.traffic.VehicleInoutStop; |
| 4 | 4 | import com.bsth.service.impl.BaseServiceImpl; |
| 5 | +import com.bsth.service.impl.TrafficManageServiceImpl; | |
| 5 | 6 | import com.bsth.service.traffic.VehicleInoutStopService; |
| 6 | 7 | import com.bsth.util.DateUtils; |
| 7 | 8 | import com.bsth.util.db.DBUtils_MS; |
| 9 | +import org.slf4j.Logger; | |
| 10 | +import org.slf4j.LoggerFactory; | |
| 8 | 11 | import org.springframework.beans.factory.annotation.Autowired; |
| 9 | 12 | import org.springframework.jdbc.core.JdbcTemplate; |
| 10 | 13 | import org.springframework.stereotype.Service; |
| ... | ... | @@ -30,9 +33,7 @@ import java.util.Map; |
| 30 | 33 | |
| 31 | 34 | @Service |
| 32 | 35 | public class VehicleInoutStopServiceImpl extends BaseServiceImpl<VehicleInoutStop,Integer> implements VehicleInoutStopService { |
| 33 | - | |
| 34 | - @Autowired | |
| 35 | - JdbcTemplate jdbcTemplate; | |
| 36 | + Logger logger = LoggerFactory.getLogger(TrafficManageServiceImpl.class); | |
| 36 | 37 | |
| 37 | 38 | /** |
| 38 | 39 | * 拼装sql |
| ... | ... | @@ -81,6 +82,7 @@ public class VehicleInoutStopServiceImpl extends BaseServiceImpl<VehicleInoutSto |
| 81 | 82 | "if( up_down= 0,'上行','下行') as up_down ," + |
| 82 | 83 | "if( in_out_stop= 0,'站内','站外') as in_out_stop , " + |
| 83 | 84 | "stop,report_date FROM bsth_c_shreal " + packageParam(map,"") ; |
| 85 | + logger.info("车载上报停靠站查询sql:",sql); | |
| 84 | 86 | List<Map<String, Object>> result = jdbcTemp.queryForList(sql); |
| 85 | 87 | return result; |
| 86 | 88 | } | ... | ... |