Commit 3cf54dff461ea78f438e06f1afaa4df3a0f5d939
1 parent
a59c6716
车载上报停靠站查询 表在21上
Showing
1 changed file
with
15 additions
and
15 deletions
src/main/java/com/bsth/service/traffic/impl/VehicleInoutStopServiceImpl.java
| ... | ... | @@ -4,6 +4,7 @@ import com.bsth.entity.traffic.VehicleInoutStop; |
| 4 | 4 | import com.bsth.service.impl.BaseServiceImpl; |
| 5 | 5 | import com.bsth.service.traffic.VehicleInoutStopService; |
| 6 | 6 | import com.bsth.util.DateUtils; |
| 7 | +import com.bsth.util.db.DBUtils_MS; | |
| 7 | 8 | import org.springframework.beans.factory.annotation.Autowired; |
| 8 | 9 | import org.springframework.jdbc.core.JdbcTemplate; |
| 9 | 10 | import org.springframework.stereotype.Service; |
| ... | ... | @@ -51,17 +52,16 @@ public class VehicleInoutStopServiceImpl extends BaseServiceImpl<VehicleInoutSto |
| 51 | 52 | String order = " order by report_date asc"+ " LIMIT "+page*size+","+size; |
| 52 | 53 | int dayNum = DateUtils.calcDaynumberInYear(reportDate_start.substring(0,8)) -1; |
| 53 | 54 | if(!lineId.equals("")){ |
| 54 | - sql.append(" and l.id = ").append(lineId); | |
| 55 | + sql.append(" and line_id = ").append(lineId); | |
| 55 | 56 | } |
| 56 | 57 | if(!insideCode.equals("")){ |
| 57 | - sql.append(" and c.inside_code = ").append("'").append(insideCode.toUpperCase()).append("'"); | |
| 58 | + sql.append(" and inside_code = ").append("'").append(insideCode.toUpperCase()).append("'"); | |
| 58 | 59 | } |
| 59 | 60 | if(!carPlate.equals("")){ |
| 60 | - sql.append(" and c.car_plate = ").append("'").append("沪").append(carPlate.substring(0,1)).append("-") | |
| 61 | - .append(carPlate.substring(1)).append("'"); | |
| 61 | + sql.append(" and car_plate = ").append("'").append(carPlate).append("'"); | |
| 62 | 62 | } |
| 63 | 63 | sql.append(" and FROM_UNIXTIME(REPORT_DATE/1000,'%Y%m%d%H') between '").append(reportDate_start). |
| 64 | - append("' and '").append(reportDate_end).append("'").append(" and r.day_year = ").append(dayNum); | |
| 64 | + append("' and '").append(reportDate_end).append("'").append(" and day_year = ").append(dayNum); | |
| 65 | 65 | if(flag.equals("count")){ |
| 66 | 66 | return sql.toString(); |
| 67 | 67 | }else{ |
| ... | ... | @@ -75,13 +75,13 @@ public class VehicleInoutStopServiceImpl extends BaseServiceImpl<VehicleInoutSto |
| 75 | 75 | * @return |
| 76 | 76 | */ |
| 77 | 77 | public List<Map<String, Object>> getVehicleInoutStopByParam(Map<String,Object> map){ |
| 78 | - String sql = "SELECT c.branche_company,c.company,l.name,l.shanghai_linecode,inside_code,equipment_code,car_plate," + | |
| 79 | - "if( r.service_state= 0,'营运','停运') as service_state ," + | |
| 80 | - "if( r.up_down= 0,'上行','下行') as up_down ," + | |
| 81 | - "if( r.in_out_stop= 0,'站内','站外') as in_out_stop , " + | |
| 82 | - "r.stop,r.report_date FROM bsth_c_shreal r LEFT JOIN bsth_c_cars c on r.cars = c.id " + | |
| 83 | - "LEFT JOIN bsth_c_line l on r.line = l.id" + packageParam(map,"") ; | |
| 84 | - List<Map<String, Object>> result = jdbcTemplate.queryForList(sql); | |
| 78 | + JdbcTemplate jdbcTemp = new JdbcTemplate(DBUtils_MS.getDataSource()); | |
| 79 | + String sql = "SELECT branche_company,company,name,shanghai_linecode,inside_code,equipment_code,car_plate," + | |
| 80 | + "if( service_state= 0,'营运','停运') as service_state ," + | |
| 81 | + "if( up_down= 0,'上行','下行') as up_down ," + | |
| 82 | + "if( in_out_stop= 0,'站内','站外') as in_out_stop , " + | |
| 83 | + "stop,report_date FROM bsth_c_shreal " + packageParam(map,"") ; | |
| 84 | + List<Map<String, Object>> result = jdbcTemp.queryForList(sql); | |
| 85 | 85 | return result; |
| 86 | 86 | } |
| 87 | 87 | |
| ... | ... | @@ -91,9 +91,9 @@ public class VehicleInoutStopServiceImpl extends BaseServiceImpl<VehicleInoutSto |
| 91 | 91 | * @return |
| 92 | 92 | */ |
| 93 | 93 | public long getVehicleInoutStopCountByParam(Map<String,Object> map){ |
| 94 | - String sql = "SELECT count(1) COUNT FROM bsth_c_shreal r LEFT JOIN bsth_c_cars c on r.cars = c.id " + | |
| 95 | - "LEFT JOIN bsth_c_line l on r.line = l.id" + packageParam(map,"count"); | |
| 96 | - long result = Long.valueOf(jdbcTemplate.queryForMap(sql).get("COUNT")+""); | |
| 94 | + JdbcTemplate jdbcTemp = new JdbcTemplate(DBUtils_MS.getDataSource()); | |
| 95 | + String sql = "SELECT count(1) COUNT FROM bsth_c_shreal" + packageParam(map,"count"); | |
| 96 | + long result = Long.valueOf(jdbcTemp.queryForMap(sql).get("COUNT")+""); | |
| 97 | 97 | return result; |
| 98 | 98 | } |
| 99 | 99 | } | ... | ... |