Commit f6fc32427d5126e2d4db3e7c95fe834e169940ca
1 parent
da0d597f
1.master_base
Showing
2 changed files
with
50 additions
and
0 deletions
src/main/java/com/bsth/CXFConfig.java
| @@ -13,6 +13,7 @@ import com.bsth.server_rs.base_info.station.StationRestService; | @@ -13,6 +13,7 @@ import com.bsth.server_rs.base_info.station.StationRestService; | ||
| 13 | import com.bsth.server_rs.departure.DepartureRestService; | 13 | import com.bsth.server_rs.departure.DepartureRestService; |
| 14 | import com.bsth.server_rs.destroy.DestroyDetailRestService; | 14 | import com.bsth.server_rs.destroy.DestroyDetailRestService; |
| 15 | import com.bsth.server_rs.directive.DirectiveRestService; | 15 | import com.bsth.server_rs.directive.DirectiveRestService; |
| 16 | +import com.bsth.server_rs.electric.ElectricService; | ||
| 16 | import com.bsth.server_rs.exception.AesExceptionMapper; | 17 | import com.bsth.server_rs.exception.AesExceptionMapper; |
| 17 | import com.bsth.server_rs.gps.GpsRestService; | 18 | import com.bsth.server_rs.gps.GpsRestService; |
| 18 | import com.bsth.server_rs.logs.RealLogRestService; | 19 | import com.bsth.server_rs.logs.RealLogRestService; |
| @@ -114,6 +115,8 @@ public class CXFConfig { | @@ -114,6 +115,8 @@ public class CXFConfig { | ||
| 114 | @Autowired | 115 | @Autowired |
| 115 | LD_RoadSpeedRestService ld_roadSpeedRestService; | 116 | LD_RoadSpeedRestService ld_roadSpeedRestService; |
| 116 | @Autowired | 117 | @Autowired |
| 118 | + ElectricService electricService; | ||
| 119 | + @Autowired | ||
| 117 | StaffViewRealService staffViewRealService; | 120 | StaffViewRealService staffViewRealService; |
| 118 | @Autowired | 121 | @Autowired |
| 119 | RateService rateService; | 122 | RateService rateService; |
| @@ -148,6 +151,7 @@ public class CXFConfig { | @@ -148,6 +151,7 @@ public class CXFConfig { | ||
| 148 | realLogRestService, | 151 | realLogRestService, |
| 149 | directiveRestService, | 152 | directiveRestService, |
| 150 | ld_roadSpeedRestService, | 153 | ld_roadSpeedRestService, |
| 154 | + electricService, | ||
| 151 | staffViewRealService, | 155 | staffViewRealService, |
| 152 | rateService, | 156 | rateService, |
| 153 | destroyDetailRestService, | 157 | destroyDetailRestService, |
src/main/java/com/bsth/server_rs/electric/ElectricService.java
0 → 100644
| 1 | +package com.bsth.server_rs.electric; | ||
| 2 | + | ||
| 3 | +import com.bsth.server_ws.electric_oil.entity.Electric; | ||
| 4 | +import org.slf4j.Logger; | ||
| 5 | +import org.slf4j.LoggerFactory; | ||
| 6 | +import org.springframework.beans.factory.annotation.Autowired; | ||
| 7 | +import org.springframework.jdbc.core.BeanPropertyRowMapper; | ||
| 8 | +import org.springframework.jdbc.core.JdbcTemplate; | ||
| 9 | +import org.springframework.stereotype.Component; | ||
| 10 | + | ||
| 11 | +import javax.ws.rs.GET; | ||
| 12 | +import javax.ws.rs.Path; | ||
| 13 | +import javax.ws.rs.PathParam; | ||
| 14 | +import javax.ws.rs.Produces; | ||
| 15 | +import javax.ws.rs.core.MediaType; | ||
| 16 | +import java.util.List; | ||
| 17 | + | ||
| 18 | +/** | ||
| 19 | + * Created by panzhao on 2018/3/27. | ||
| 20 | + */ | ||
| 21 | +@Component | ||
| 22 | +@Path("/electric") | ||
| 23 | +@Produces({MediaType.APPLICATION_JSON}) | ||
| 24 | +public class ElectricService { | ||
| 25 | + | ||
| 26 | + Logger logger = LoggerFactory.getLogger(this.getClass()); | ||
| 27 | + | ||
| 28 | + @Autowired | ||
| 29 | + JdbcTemplate jdbcTemplate; | ||
| 30 | + | ||
| 31 | + @GET | ||
| 32 | + @Path("/{company}/{rq}") | ||
| 33 | + public List<Electric> list(@PathParam("company") String company, @PathParam("rq") String rq){ | ||
| 34 | + List<Electric> list = null; | ||
| 35 | + try { | ||
| 36 | + //从数据库查询 | ||
| 37 | + //list = jdbcTemplate.query("select fgs_bm,fgs_name,gs_bm,gs_name,jdl,jdz,remarks,rq,creater_date,nbbm,jsy from bsth_c_jdl where gs_bm="+company+" and rq='"+rq+"'" | ||
| 38 | + // , BeanPropertyRowMapper.newInstance(Electric.class)); | ||
| 39 | + list = jdbcTemplate.query("select fgsdm as fgs_bm,c.business_name as fgs_name,ssgsdm as gs_bm,b.business_name as gs_name,cdl as jdl,'' as jdz,'' as remarks,rq,createtime as create_date,nbbm,'' as jsy from (select fgsdm,ssgsdm,sum(cdl * 1000) / 1000 as cdl,rq,max(createtime) as createtime,nbbm from bsth_c_dlb where rq = '" + rq + "' GROUP BY fgsdm,ssgsdm,rq,nbbm) a left join bsth_c_business b on a.ssgsdm = b.business_code LEFT JOIN bsth_c_business c on concat(a.ssgsdm, '_', a.fgsdm) = concat(c.up_code, '_', c.business_code) where ssgsdm="+company | ||
| 40 | + , BeanPropertyRowMapper.newInstance(Electric.class)); | ||
| 41 | + }catch (Exception e){ | ||
| 42 | + logger.error("", e); | ||
| 43 | + } | ||
| 44 | + return list; | ||
| 45 | + } | ||
| 46 | +} |