Commit 4d0b56757044b96f3b66d9dabd08a1527d91d6ef
1 parent
ce88def0
1.电科接口数据重生成变化
2.提供IP白名单服务
Showing
2 changed files
with
138 additions
and
0 deletions
src/main/java/com/bsth/entity/WhiteIp.java
0 → 100644
| 1 | +package com.bsth.entity; | |
| 2 | + | |
| 3 | +import com.fasterxml.jackson.annotation.JsonIgnore; | |
| 4 | + | |
| 5 | +import java.util.Date; | |
| 6 | + | |
| 7 | + | |
| 8 | +/** | |
| 9 | + * @author Hill | |
| 10 | + */ | |
| 11 | +public class WhiteIp { | |
| 12 | + | |
| 13 | + private Integer id; | |
| 14 | + | |
| 15 | + private String ip; | |
| 16 | + | |
| 17 | + private String commitCompany; | |
| 18 | + | |
| 19 | + private String commitBcompany; | |
| 20 | + | |
| 21 | + private String commitName; | |
| 22 | + | |
| 23 | + private Date validDate; | |
| 24 | + | |
| 25 | + @JsonIgnore | |
| 26 | + private Date createDate; | |
| 27 | + | |
| 28 | + @JsonIgnore | |
| 29 | + private Date updateDate; | |
| 30 | + | |
| 31 | + public Integer getId() { | |
| 32 | + return id; | |
| 33 | + } | |
| 34 | + | |
| 35 | + public void setId(Integer id) { | |
| 36 | + this.id = id; | |
| 37 | + } | |
| 38 | + | |
| 39 | + public String getIp() { | |
| 40 | + return ip; | |
| 41 | + } | |
| 42 | + | |
| 43 | + public void setIp(String ip) { | |
| 44 | + this.ip = ip; | |
| 45 | + } | |
| 46 | + | |
| 47 | + public String getCommitCompany() { | |
| 48 | + return commitCompany; | |
| 49 | + } | |
| 50 | + | |
| 51 | + public void setCommitCompany(String commitCompany) { | |
| 52 | + this.commitCompany = commitCompany; | |
| 53 | + } | |
| 54 | + | |
| 55 | + public String getCommitBcompany() { | |
| 56 | + return commitBcompany; | |
| 57 | + } | |
| 58 | + | |
| 59 | + public void setCommitBcompany(String commitBcompany) { | |
| 60 | + this.commitBcompany = commitBcompany; | |
| 61 | + } | |
| 62 | + | |
| 63 | + public String getCommitName() { | |
| 64 | + return commitName; | |
| 65 | + } | |
| 66 | + | |
| 67 | + public void setCommitName(String commitName) { | |
| 68 | + this.commitName = commitName; | |
| 69 | + } | |
| 70 | + | |
| 71 | + public Date getValidDate() { | |
| 72 | + return validDate; | |
| 73 | + } | |
| 74 | + | |
| 75 | + public void setValidDate(Date validDate) { | |
| 76 | + this.validDate = validDate; | |
| 77 | + } | |
| 78 | + | |
| 79 | + public Date getCreateDate() { | |
| 80 | + return createDate; | |
| 81 | + } | |
| 82 | + | |
| 83 | + public void setCreateDate(Date createDate) { | |
| 84 | + this.createDate = createDate; | |
| 85 | + } | |
| 86 | + | |
| 87 | + public Date getUpdateDate() { | |
| 88 | + return updateDate; | |
| 89 | + } | |
| 90 | + | |
| 91 | + public void setUpdateDate(Date updateDate) { | |
| 92 | + this.updateDate = updateDate; | |
| 93 | + } | |
| 94 | +} | ... | ... |
src/main/java/com/bsth/server_rs/white_ip/WhiteIpRestService.java
0 → 100644
| 1 | +package com.bsth.server_rs.white_ip; | |
| 2 | + | |
| 3 | +import com.bsth.entity.DestroySituation; | |
| 4 | +import com.bsth.entity.ScheduleRealInfo; | |
| 5 | +import com.bsth.entity.WhiteIp; | |
| 6 | +import com.bsth.repository.DestroySituationRepository; | |
| 7 | +import com.bsth.repository.ScheduleRealInfoRepository; | |
| 8 | +import com.bsth.server_rs.base_info.car.Car; | |
| 9 | +import com.bsth.server_rs.base_info.car.buffer.CarBufferData; | |
| 10 | +import org.springframework.beans.factory.annotation.Autowired; | |
| 11 | +import org.springframework.jdbc.core.BeanPropertyRowMapper; | |
| 12 | +import org.springframework.jdbc.core.JdbcTemplate; | |
| 13 | +import org.springframework.stereotype.Component; | |
| 14 | + | |
| 15 | +import javax.ws.rs.GET; | |
| 16 | +import javax.ws.rs.Path; | |
| 17 | +import javax.ws.rs.PathParam; | |
| 18 | +import javax.ws.rs.Produces; | |
| 19 | +import javax.ws.rs.core.MediaType; | |
| 20 | +import java.util.ArrayList; | |
| 21 | +import java.util.HashMap; | |
| 22 | +import java.util.List; | |
| 23 | +import java.util.Map; | |
| 24 | + | |
| 25 | +/** | |
| 26 | + * @author hill | |
| 27 | + * @date | |
| 28 | + */ | |
| 29 | +@Component | |
| 30 | +@Path("/whiteIp") | |
| 31 | +@Produces({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML}) | |
| 32 | +public class WhiteIpRestService { | |
| 33 | + | |
| 34 | + @Autowired | |
| 35 | + private JdbcTemplate jdbcTemplate; | |
| 36 | + | |
| 37 | + @GET | |
| 38 | + @Path("") | |
| 39 | + public List<WhiteIp> validIp() { | |
| 40 | + List<WhiteIp> result = jdbcTemplate.query("select * from control_interface.bsth_c_white_ip where valid_date > now()", BeanPropertyRowMapper.newInstance(WhiteIp.class)); | |
| 41 | + | |
| 42 | + return result; | |
| 43 | + } | |
| 44 | +} | ... | ... |