Commit 995d98c70fe6bf3bc6ec0ef2d569d26f0d797155
1 parent
d8faa0a6
update...
Showing
12 changed files
with
591 additions
and
8 deletions
src/main/java/com/bsth/CXFConfig.java
| @@ -6,6 +6,7 @@ import com.bsth.server_rs.base_info.line.LineRestService; | @@ -6,6 +6,7 @@ import com.bsth.server_rs.base_info.line.LineRestService; | ||
| 6 | import com.bsth.server_rs.base_info.person.PersonRestService; | 6 | import com.bsth.server_rs.base_info.person.PersonRestService; |
| 7 | import com.bsth.server_rs.exception.AesExceptionMapper; | 7 | import com.bsth.server_rs.exception.AesExceptionMapper; |
| 8 | import com.bsth.server_rs.gps.GpsRestService; | 8 | import com.bsth.server_rs.gps.GpsRestService; |
| 9 | +import com.bsth.server_rs.schedule.real.ScheduleRealService; | ||
| 9 | import com.bsth.server_ws.attendance.AttendanceServiceSoap; | 10 | import com.bsth.server_ws.attendance.AttendanceServiceSoap; |
| 10 | import com.bsth.server_ws.park_station.CompanyServiceSoap; | 11 | import com.bsth.server_ws.park_station.CompanyServiceSoap; |
| 11 | import com.bsth.server_ws.waybill.LD_ServiceSoap; | 12 | import com.bsth.server_ws.waybill.LD_ServiceSoap; |
| @@ -16,6 +17,7 @@ import org.apache.cxf.endpoint.Server; | @@ -16,6 +17,7 @@ import org.apache.cxf.endpoint.Server; | ||
| 16 | import org.apache.cxf.jaxrs.JAXRSServerFactoryBean; | 17 | import org.apache.cxf.jaxrs.JAXRSServerFactoryBean; |
| 17 | import org.apache.cxf.jaxws.EndpointImpl; | 18 | import org.apache.cxf.jaxws.EndpointImpl; |
| 18 | import org.apache.cxf.transport.servlet.CXFServlet; | 19 | import org.apache.cxf.transport.servlet.CXFServlet; |
| 20 | +import org.springframework.beans.factory.annotation.Autowired; | ||
| 19 | import org.springframework.boot.web.servlet.ServletRegistrationBean; | 21 | import org.springframework.boot.web.servlet.ServletRegistrationBean; |
| 20 | import org.springframework.context.annotation.Bean; | 22 | import org.springframework.context.annotation.Bean; |
| 21 | import org.springframework.context.annotation.Configuration; | 23 | import org.springframework.context.annotation.Configuration; |
| @@ -68,12 +70,20 @@ public class CXFConfig { | @@ -68,12 +70,20 @@ public class CXFConfig { | ||
| 68 | return endpoint; | 70 | return endpoint; |
| 69 | }*/ | 71 | }*/ |
| 70 | 72 | ||
| 73 | + @Autowired | ||
| 74 | + ScheduleRealService scheduleRealService; | ||
| 75 | + | ||
| 71 | @Bean | 76 | @Bean |
| 72 | public Server rsServer() { | 77 | public Server rsServer() { |
| 73 | JAXRSServerFactoryBean endpoint = new JAXRSServerFactoryBean(); | 78 | JAXRSServerFactoryBean endpoint = new JAXRSServerFactoryBean(); |
| 74 | endpoint.setBus(springBus()); | 79 | endpoint.setBus(springBus()); |
| 75 | endpoint.setAddress("/rest"); | 80 | endpoint.setAddress("/rest"); |
| 76 | - endpoint.setServiceBeans(Arrays.<Object>asList(new LineRestService(), new CarRestService(), new PersonRestService(), new GpsRestService())); | 81 | + endpoint.setServiceBeans(Arrays.<Object>asList( |
| 82 | + new LineRestService(), | ||
| 83 | + new CarRestService(), | ||
| 84 | + new PersonRestService(), | ||
| 85 | + new GpsRestService(), | ||
| 86 | + scheduleRealService)); | ||
| 77 | endpoint.setProviders(Arrays.asList(new JacksonJsonProvider(), new AesExceptionMapper())); | 87 | endpoint.setProviders(Arrays.asList(new JacksonJsonProvider(), new AesExceptionMapper())); |
| 78 | //endpoint.setFeatures(Arrays.asList(new Swagger2Feature())); | 88 | //endpoint.setFeatures(Arrays.asList(new Swagger2Feature())); |
| 79 | endpoint.getInInterceptors().add(new AuthorizeInterceptor_IN()); | 89 | endpoint.getInInterceptors().add(new AuthorizeInterceptor_IN()); |
src/main/java/com/bsth/common/BasicData.java
0 → 100644
| 1 | +package com.bsth.common; | ||
| 2 | + | ||
| 3 | +import com.bsth.Application; | ||
| 4 | +import org.springframework.beans.factory.annotation.Autowired; | ||
| 5 | +import org.springframework.boot.CommandLineRunner; | ||
| 6 | +import org.springframework.jdbc.core.JdbcTemplate; | ||
| 7 | +import org.springframework.stereotype.Component; | ||
| 8 | + | ||
| 9 | +import java.util.HashMap; | ||
| 10 | +import java.util.List; | ||
| 11 | +import java.util.Map; | ||
| 12 | +import java.util.concurrent.TimeUnit; | ||
| 13 | + | ||
| 14 | +/** | ||
| 15 | + * 一些基础数据缓存 | ||
| 16 | + * Created by panzhao on 2017/8/24. | ||
| 17 | + */ | ||
| 18 | +@Component | ||
| 19 | +public class BasicData implements CommandLineRunner { | ||
| 20 | + | ||
| 21 | + /** | ||
| 22 | + * 线路编码和在执行的班次日期 | ||
| 23 | + * code ——> yyyy-MM-dd | ||
| 24 | + */ | ||
| 25 | + public static Map<String, String> lineDateMap; | ||
| 26 | + | ||
| 27 | + @Autowired | ||
| 28 | + BasicDataLoader basicDataLoader; | ||
| 29 | + | ||
| 30 | + @Override | ||
| 31 | + public void run(String... strings) throws Exception { | ||
| 32 | + Application.mainServices.scheduleWithFixedDelay(basicDataLoader, 10, 60 * 10, TimeUnit.SECONDS); | ||
| 33 | + } | ||
| 34 | + | ||
| 35 | + | ||
| 36 | + @Component | ||
| 37 | + public static class BasicDataLoader extends Thread { | ||
| 38 | + | ||
| 39 | + @Autowired | ||
| 40 | + JdbcTemplate jdbcTemplate; | ||
| 41 | + | ||
| 42 | + @Override | ||
| 43 | + public void run() { | ||
| 44 | + loadLineDateMap(); | ||
| 45 | + } | ||
| 46 | + | ||
| 47 | + private void loadLineDateMap(){ | ||
| 48 | + Map<String, String> lineDateMapCopy = new HashMap<>(); | ||
| 49 | + String sql = "select START_OPT,t2.LINE_CODE from bsth_c_line_config t1 INNER JOIN bsth_c_line t2 on t1.line=t2.id where t2.line_code is not null"; | ||
| 50 | + | ||
| 51 | + List<Map<String, Object>> list = jdbcTemplate.queryForList(sql); | ||
| 52 | + for(Map<String, Object> map : list){ | ||
| 53 | + lineDateMapCopy.put(map.get("LINE_CODE").toString(), calcScheduleDate(map.get("START_OPT"))); | ||
| 54 | + } | ||
| 55 | + | ||
| 56 | + lineDateMap = lineDateMapCopy; | ||
| 57 | + } | ||
| 58 | + | ||
| 59 | + private String calcScheduleDate(Object startDate){ | ||
| 60 | + return "20170828"; | ||
| 61 | + } | ||
| 62 | + } | ||
| 63 | +} |
src/main/java/com/bsth/server_rs/base_info/car/Car.java
| @@ -64,6 +64,7 @@ public class Car implements Serializable { | @@ -64,6 +64,7 @@ public class Car implements Serializable { | ||
| 64 | 64 | ||
| 65 | private String lineName; | 65 | private String lineName; |
| 66 | 66 | ||
| 67 | + private String remark; | ||
| 67 | 68 | ||
| 68 | public String getBrancheCompanyCode() { | 69 | public String getBrancheCompanyCode() { |
| 69 | return brancheCompanyCode; | 70 | return brancheCompanyCode; |
| @@ -168,4 +169,12 @@ public class Car implements Serializable { | @@ -168,4 +169,12 @@ public class Car implements Serializable { | ||
| 168 | public void setNbbm(String nbbm) { | 169 | public void setNbbm(String nbbm) { |
| 169 | this.nbbm = nbbm; | 170 | this.nbbm = nbbm; |
| 170 | } | 171 | } |
| 172 | + | ||
| 173 | + public String getRemark() { | ||
| 174 | + return remark; | ||
| 175 | + } | ||
| 176 | + | ||
| 177 | + public void setRemark(String remark) { | ||
| 178 | + this.remark = remark; | ||
| 179 | + } | ||
| 171 | } | 180 | } |
src/main/java/com/bsth/server_rs/base_info/car/CarRestService.java
| 1 | package com.bsth.server_rs.base_info.car; | 1 | package com.bsth.server_rs.base_info.car; |
| 2 | 2 | ||
| 3 | +import com.alibaba.fastjson.JSON; | ||
| 4 | +import com.alibaba.fastjson.TypeReference; | ||
| 3 | import com.bsth.server_rs.base_info.car.buffer.CarBufferData; | 5 | import com.bsth.server_rs.base_info.car.buffer.CarBufferData; |
| 6 | +import com.bsth.server_rs.base_info.dto.BusCardDto; | ||
| 7 | +import org.apache.commons.lang3.StringEscapeUtils; | ||
| 4 | 8 | ||
| 5 | -import javax.ws.rs.GET; | ||
| 6 | -import javax.ws.rs.Path; | ||
| 7 | -import javax.ws.rs.PathParam; | ||
| 8 | -import javax.ws.rs.Produces; | 9 | +import javax.ws.rs.*; |
| 9 | import javax.ws.rs.core.MediaType; | 10 | import javax.ws.rs.core.MediaType; |
| 10 | import java.util.List; | 11 | import java.util.List; |
| 12 | +import java.util.Map; | ||
| 11 | 13 | ||
| 12 | /** | 14 | /** |
| 13 | * Created by panzhao on 2017/3/30. | 15 | * Created by panzhao on 2017/3/30. |
| @@ -33,4 +35,12 @@ public class CarRestService { | @@ -33,4 +35,12 @@ public class CarRestService { | ||
| 33 | public Car findOne(@PathParam("nbbm") String nbbm) { | 35 | public Car findOne(@PathParam("nbbm") String nbbm) { |
| 34 | return CarBufferData.findOne(nbbm); | 36 | return CarBufferData.findOne(nbbm); |
| 35 | } | 37 | } |
| 38 | + | ||
| 39 | + @POST | ||
| 40 | + @Path("/setCards") | ||
| 41 | + public Map<String, Object> multiPostCards(String bodyStr){ | ||
| 42 | + bodyStr = StringEscapeUtils.unescapeHtml4(bodyStr); | ||
| 43 | + List<BusCardDto> list = JSON.parseObject(bodyStr, new TypeReference<List<BusCardDto>>() {}); | ||
| 44 | + return CarBufferData.multiSaveCards(list); | ||
| 45 | + } | ||
| 36 | } | 46 | } |
src/main/java/com/bsth/server_rs/base_info/car/buffer/CarBufferData.java
| @@ -2,12 +2,14 @@ package com.bsth.server_rs.base_info.car.buffer; | @@ -2,12 +2,14 @@ package com.bsth.server_rs.base_info.car.buffer; | ||
| 2 | 2 | ||
| 3 | import com.bsth.Application; | 3 | import com.bsth.Application; |
| 4 | import com.bsth.server_rs.base_info.car.Car; | 4 | import com.bsth.server_rs.base_info.car.Car; |
| 5 | +import com.bsth.server_rs.base_info.dto.BusCardDto; | ||
| 5 | import com.google.common.collect.ArrayListMultimap; | 6 | import com.google.common.collect.ArrayListMultimap; |
| 6 | import org.springframework.beans.factory.annotation.Autowired; | 7 | import org.springframework.beans.factory.annotation.Autowired; |
| 7 | import org.springframework.boot.CommandLineRunner; | 8 | import org.springframework.boot.CommandLineRunner; |
| 8 | import org.springframework.core.annotation.Order; | 9 | import org.springframework.core.annotation.Order; |
| 9 | import org.springframework.stereotype.Component; | 10 | import org.springframework.stereotype.Component; |
| 10 | 11 | ||
| 12 | +import java.util.ArrayList; | ||
| 11 | import java.util.HashMap; | 13 | import java.util.HashMap; |
| 12 | import java.util.List; | 14 | import java.util.List; |
| 13 | import java.util.Map; | 15 | import java.util.Map; |
| @@ -25,6 +27,11 @@ public class CarBufferData implements CommandLineRunner { | @@ -25,6 +27,11 @@ public class CarBufferData implements CommandLineRunner { | ||
| 25 | private static Map<String, Car> idMap; | 27 | private static Map<String, Car> idMap; |
| 26 | private static ArrayListMultimap<String, Car> companyListMap; | 28 | private static ArrayListMultimap<String, Car> companyListMap; |
| 27 | 29 | ||
| 30 | + /** | ||
| 31 | + * 待入库的bus car | ||
| 32 | + */ | ||
| 33 | + private static List<Car> pstList = new ArrayList<>(); | ||
| 34 | + | ||
| 28 | @Autowired | 35 | @Autowired |
| 29 | CarRefreshThread carRefreshThread; | 36 | CarRefreshThread carRefreshThread; |
| 30 | 37 | ||
| @@ -58,4 +65,32 @@ public class CarBufferData implements CommandLineRunner { | @@ -58,4 +65,32 @@ public class CarBufferData implements CommandLineRunner { | ||
| 58 | public void run(String... strings) throws Exception { | 65 | public void run(String... strings) throws Exception { |
| 59 | Application.mainServices.scheduleWithFixedDelay(carRefreshThread, 10, 60 * 60, TimeUnit.SECONDS); | 66 | Application.mainServices.scheduleWithFixedDelay(carRefreshThread, 10, 60 * 60, TimeUnit.SECONDS); |
| 60 | } | 67 | } |
| 68 | + | ||
| 69 | + public static Map<String, Object> multiSaveCards(List<BusCardDto> list) { | ||
| 70 | + int success=0,error=0; | ||
| 71 | + //返回写入成功的卡数据 | ||
| 72 | + List<BusCardDto> rsList = new ArrayList<>(); | ||
| 73 | + | ||
| 74 | + Car c; | ||
| 75 | + for(BusCardDto bcd : list){ | ||
| 76 | + c = idMap.get(bcd.getNbbm()); | ||
| 77 | + if(c == null) | ||
| 78 | + error ++; | ||
| 79 | + else{ | ||
| 80 | + c.setIdRfid(bcd.getIdCard()); | ||
| 81 | + c.setTagRfid(bcd.getTagCard()); | ||
| 82 | + c.setRemark(bcd.getRemark()); | ||
| 83 | + success ++; | ||
| 84 | + | ||
| 85 | + pstList.add(c); | ||
| 86 | + rsList.add(bcd); | ||
| 87 | + } | ||
| 88 | + } | ||
| 89 | + | ||
| 90 | + Map<String, Object> rs = new HashMap<>(); | ||
| 91 | + rs.put("success", success); | ||
| 92 | + rs.put("successList", rsList); | ||
| 93 | + rs.put("error", error); | ||
| 94 | + return rs; | ||
| 95 | + } | ||
| 61 | } | 96 | } |
src/main/java/com/bsth/server_rs/base_info/dto/BusCardDto.java
0 → 100644
| 1 | +package com.bsth.server_rs.base_info.dto; | ||
| 2 | + | ||
| 3 | +/** | ||
| 4 | + * Created by panzhao on 2017/8/11. | ||
| 5 | + */ | ||
| 6 | +public class BusCardDto { | ||
| 7 | + | ||
| 8 | + /** | ||
| 9 | + * 16进制ID卡号 | ||
| 10 | + */ | ||
| 11 | + private String idCard; | ||
| 12 | + | ||
| 13 | + /** | ||
| 14 | + * 车辆自编号 | ||
| 15 | + */ | ||
| 16 | + private String nbbm; | ||
| 17 | + | ||
| 18 | + /** | ||
| 19 | + * 标签号 | ||
| 20 | + */ | ||
| 21 | + private String tagCard; | ||
| 22 | + | ||
| 23 | + /** | ||
| 24 | + * 备注 | ||
| 25 | + */ | ||
| 26 | + private String remark; | ||
| 27 | + | ||
| 28 | + public String getIdCard() { | ||
| 29 | + return idCard; | ||
| 30 | + } | ||
| 31 | + | ||
| 32 | + public void setIdCard(String idCard) { | ||
| 33 | + this.idCard = idCard; | ||
| 34 | + } | ||
| 35 | + | ||
| 36 | + public String getTagCard() { | ||
| 37 | + return tagCard; | ||
| 38 | + } | ||
| 39 | + | ||
| 40 | + public void setTagCard(String tagCard) { | ||
| 41 | + this.tagCard = tagCard; | ||
| 42 | + } | ||
| 43 | + | ||
| 44 | + public String getRemark() { | ||
| 45 | + return remark; | ||
| 46 | + } | ||
| 47 | + | ||
| 48 | + public void setRemark(String remark) { | ||
| 49 | + this.remark = remark; | ||
| 50 | + } | ||
| 51 | + | ||
| 52 | + public String getNbbm() { | ||
| 53 | + return nbbm; | ||
| 54 | + } | ||
| 55 | + | ||
| 56 | + public void setNbbm(String nbbm) { | ||
| 57 | + this.nbbm = nbbm; | ||
| 58 | + } | ||
| 59 | +} |
src/main/java/com/bsth/server_rs/base_info/dto/PersonCardDto.java
| @@ -25,6 +25,11 @@ public class PersonCardDto { | @@ -25,6 +25,11 @@ public class PersonCardDto { | ||
| 25 | */ | 25 | */ |
| 26 | private String tagCard; | 26 | private String tagCard; |
| 27 | 27 | ||
| 28 | + /** | ||
| 29 | + * 备注 | ||
| 30 | + */ | ||
| 31 | + private String remark; | ||
| 32 | + | ||
| 28 | public String getIdCard() { | 33 | public String getIdCard() { |
| 29 | return idCard; | 34 | return idCard; |
| 30 | } | 35 | } |
| @@ -56,4 +61,12 @@ public class PersonCardDto { | @@ -56,4 +61,12 @@ public class PersonCardDto { | ||
| 56 | public void setTagCard(String tagCard) { | 61 | public void setTagCard(String tagCard) { |
| 57 | this.tagCard = tagCard; | 62 | this.tagCard = tagCard; |
| 58 | } | 63 | } |
| 64 | + | ||
| 65 | + public String getRemark() { | ||
| 66 | + return remark; | ||
| 67 | + } | ||
| 68 | + | ||
| 69 | + public void setRemark(String remark) { | ||
| 70 | + this.remark = remark; | ||
| 71 | + } | ||
| 59 | } | 72 | } |
src/main/java/com/bsth/server_rs/base_info/person/PersonRestService.java
| 1 | package com.bsth.server_rs.base_info.person; | 1 | package com.bsth.server_rs.base_info.person; |
| 2 | 2 | ||
| 3 | +import com.alibaba.fastjson.JSON; | ||
| 4 | +import com.alibaba.fastjson.TypeReference; | ||
| 3 | import com.bsth.server_rs.base_info.dto.PersonCardDto; | 5 | import com.bsth.server_rs.base_info.dto.PersonCardDto; |
| 4 | import com.bsth.server_rs.base_info.person.buffer.PersonBufferData; | 6 | import com.bsth.server_rs.base_info.person.buffer.PersonBufferData; |
| 7 | +import org.apache.commons.lang3.StringEscapeUtils; | ||
| 5 | 8 | ||
| 6 | import javax.ws.rs.*; | 9 | import javax.ws.rs.*; |
| 7 | import javax.ws.rs.core.MediaType; | 10 | import javax.ws.rs.core.MediaType; |
| @@ -34,8 +37,10 @@ public class PersonRestService { | @@ -34,8 +37,10 @@ public class PersonRestService { | ||
| 34 | } | 37 | } |
| 35 | 38 | ||
| 36 | @POST | 39 | @POST |
| 37 | - public Map<String, Object> multiPostCards(List<PersonCardDto> list){ | ||
| 38 | - System.out.println(list); | ||
| 39 | - return null; | 40 | + @Path("/setCards") |
| 41 | + public Map<String, Object> multiPostCards(String bodyStr){ | ||
| 42 | + bodyStr = StringEscapeUtils.unescapeHtml4(bodyStr); | ||
| 43 | + List<PersonCardDto> list = JSON.parseObject(bodyStr, new TypeReference<List<PersonCardDto>>() {}); | ||
| 44 | + return PersonBufferData.multiSaveCards(list); | ||
| 40 | } | 45 | } |
| 41 | } | 46 | } |
src/main/java/com/bsth/server_rs/base_info/person/Personnel.java
| @@ -83,6 +83,11 @@ public class Personnel implements Serializable { | @@ -83,6 +83,11 @@ public class Personnel implements Serializable { | ||
| 83 | private String tagRfid; | 83 | private String tagRfid; |
| 84 | 84 | ||
| 85 | /** | 85 | /** |
| 86 | + * 备注 | ||
| 87 | + */ | ||
| 88 | + private String remark; | ||
| 89 | + | ||
| 90 | + /** | ||
| 86 | * 线路名称 | 91 | * 线路名称 |
| 87 | */ | 92 | */ |
| 88 | private String lineName; | 93 | private String lineName; |
| @@ -203,4 +208,12 @@ public class Personnel implements Serializable { | @@ -203,4 +208,12 @@ public class Personnel implements Serializable { | ||
| 203 | public void setLineCode(String lineCode) { | 208 | public void setLineCode(String lineCode) { |
| 204 | this.lineCode = lineCode; | 209 | this.lineCode = lineCode; |
| 205 | } | 210 | } |
| 211 | + | ||
| 212 | + public String getRemark() { | ||
| 213 | + return remark; | ||
| 214 | + } | ||
| 215 | + | ||
| 216 | + public void setRemark(String remark) { | ||
| 217 | + this.remark = remark; | ||
| 218 | + } | ||
| 206 | } | 219 | } |
src/main/java/com/bsth/server_rs/base_info/person/buffer/PersonBufferData.java
| 1 | package com.bsth.server_rs.base_info.person.buffer; | 1 | package com.bsth.server_rs.base_info.person.buffer; |
| 2 | 2 | ||
| 3 | import com.bsth.Application; | 3 | import com.bsth.Application; |
| 4 | +import com.bsth.server_rs.base_info.dto.PersonCardDto; | ||
| 4 | import com.bsth.server_rs.base_info.person.Personnel; | 5 | import com.bsth.server_rs.base_info.person.Personnel; |
| 5 | import com.google.common.collect.ArrayListMultimap; | 6 | import com.google.common.collect.ArrayListMultimap; |
| 6 | import org.springframework.beans.factory.annotation.Autowired; | 7 | import org.springframework.beans.factory.annotation.Autowired; |
| @@ -8,6 +9,7 @@ import org.springframework.boot.CommandLineRunner; | @@ -8,6 +9,7 @@ import org.springframework.boot.CommandLineRunner; | ||
| 8 | import org.springframework.core.annotation.Order; | 9 | import org.springframework.core.annotation.Order; |
| 9 | import org.springframework.stereotype.Component; | 10 | import org.springframework.stereotype.Component; |
| 10 | 11 | ||
| 12 | +import java.util.ArrayList; | ||
| 11 | import java.util.HashMap; | 13 | import java.util.HashMap; |
| 12 | import java.util.List; | 14 | import java.util.List; |
| 13 | import java.util.Map; | 15 | import java.util.Map; |
| @@ -27,6 +29,10 @@ public class PersonBufferData implements CommandLineRunner { | @@ -27,6 +29,10 @@ public class PersonBufferData implements CommandLineRunner { | ||
| 27 | private static Map<String, Personnel> idMap; | 29 | private static Map<String, Personnel> idMap; |
| 28 | private static ArrayListMultimap<String, Personnel> companyListMap; | 30 | private static ArrayListMultimap<String, Personnel> companyListMap; |
| 29 | 31 | ||
| 32 | + /** | ||
| 33 | + * 待入库的personnel | ||
| 34 | + */ | ||
| 35 | + private static List<Personnel> pstList = new ArrayList<>(); | ||
| 30 | public static List<Personnel> findAll() { | 36 | public static List<Personnel> findAll() { |
| 31 | return data; | 37 | return data; |
| 32 | } | 38 | } |
| @@ -53,6 +59,35 @@ public class PersonBufferData implements CommandLineRunner { | @@ -53,6 +59,35 @@ public class PersonBufferData implements CommandLineRunner { | ||
| 53 | companyListMap = listMap; | 59 | companyListMap = listMap; |
| 54 | } | 60 | } |
| 55 | 61 | ||
| 62 | + /** | ||
| 63 | + * 批量设置人卡数据 | ||
| 64 | + * @param list | ||
| 65 | + * @return | ||
| 66 | + */ | ||
| 67 | + public static Map<String, Object> multiSaveCards(List<PersonCardDto> list){ | ||
| 68 | + int success=0,error=0; | ||
| 69 | + | ||
| 70 | + Personnel p; | ||
| 71 | + for(PersonCardDto pcd : list){ | ||
| 72 | + p = idMap.get(pcd.getCompany() + "-" + pcd.getJobCode()); | ||
| 73 | + if(p == null) | ||
| 74 | + error ++; | ||
| 75 | + else{ | ||
| 76 | + p.setIdRfid(pcd.getIdCard()); | ||
| 77 | + p.setTagRfid(pcd.getTagCard()); | ||
| 78 | + p.setRemark(pcd.getRemark()); | ||
| 79 | + success ++; | ||
| 80 | + | ||
| 81 | + pstList.add(p); | ||
| 82 | + } | ||
| 83 | + } | ||
| 84 | + | ||
| 85 | + Map<String, Object> rs = new HashMap<>(); | ||
| 86 | + rs.put("success", success); | ||
| 87 | + rs.put("error", error); | ||
| 88 | + return rs; | ||
| 89 | + } | ||
| 90 | + | ||
| 56 | @Override | 91 | @Override |
| 57 | public void run(String... strings) throws Exception { | 92 | public void run(String... strings) throws Exception { |
| 58 | Application.mainServices.scheduleWithFixedDelay(personRefreshThread, 10, 60 * 30, TimeUnit.SECONDS); | 93 | Application.mainServices.scheduleWithFixedDelay(personRefreshThread, 10, 60 * 30, TimeUnit.SECONDS); |
src/main/java/com/bsth/server_rs/schedule/dto/ScheduleInOut.java
0 → 100644
| 1 | +package com.bsth.server_rs.schedule.dto; | ||
| 2 | + | ||
| 3 | +import com.alibaba.fastjson.JSON; | ||
| 4 | +import com.alibaba.fastjson.JSONObject; | ||
| 5 | +import com.bsth.entity.ScheduleRealInfo; | ||
| 6 | + | ||
| 7 | +import java.util.ArrayList; | ||
| 8 | +import java.util.List; | ||
| 9 | + | ||
| 10 | +/** | ||
| 11 | + * 进出场班次数据 ---给停车场用的 | ||
| 12 | + * Created by panzhao on 2017/8/24. | ||
| 13 | + */ | ||
| 14 | +public class ScheduleInOut { | ||
| 15 | + | ||
| 16 | + public static List<ScheduleInOut> getMultiInstance(List<ScheduleRealInfo> list, String tccCode){ | ||
| 17 | + List<ScheduleInOut> rs = new ArrayList<>(); | ||
| 18 | + | ||
| 19 | + for(ScheduleRealInfo sch : list){ | ||
| 20 | + if(!sch.getBcType().equals("in") && !sch.getBcType().equals("out")) | ||
| 21 | + continue; | ||
| 22 | + | ||
| 23 | + if(!sch.getQdzCode().equals(tccCode) && !sch.getZdzCode().equals(tccCode)) | ||
| 24 | + continue; | ||
| 25 | + | ||
| 26 | + rs.add(getInstance(sch)); | ||
| 27 | + } | ||
| 28 | + return rs; | ||
| 29 | + } | ||
| 30 | + | ||
| 31 | + public static ScheduleInOut getInstance(ScheduleRealInfo sch){ | ||
| 32 | + return JSONObject.parseObject(JSON.toJSONString(sch), ScheduleInOut.class); | ||
| 33 | + } | ||
| 34 | + | ||
| 35 | + private Long id; | ||
| 36 | + private String scheduleDateStr; | ||
| 37 | + private String realExecDate; | ||
| 38 | + private String xlName; | ||
| 39 | + private String xlBm; | ||
| 40 | + private String lpName; | ||
| 41 | + private String clZbh; | ||
| 42 | + private String jGh; | ||
| 43 | + private String jName; | ||
| 44 | + private String sGh; | ||
| 45 | + private String sName; | ||
| 46 | + private String xlDir; | ||
| 47 | + private String qdzCode; | ||
| 48 | + private String qdzName; | ||
| 49 | + private String zdzCode; | ||
| 50 | + private String zdzName; | ||
| 51 | + private String dfsj; | ||
| 52 | + private Long dfsjT; | ||
| 53 | + private String zdsj; | ||
| 54 | + private Long zdsjT; | ||
| 55 | + private String fcsjActual; | ||
| 56 | + private String zdsjActual; | ||
| 57 | + private boolean sflj; | ||
| 58 | + private String remarks; | ||
| 59 | + private String gsName; | ||
| 60 | + private String gsBm; | ||
| 61 | + private String fgsName; | ||
| 62 | + private String fgsBm; | ||
| 63 | + | ||
| 64 | + public Long getId() { | ||
| 65 | + return id; | ||
| 66 | + } | ||
| 67 | + | ||
| 68 | + public void setId(Long id) { | ||
| 69 | + this.id = id; | ||
| 70 | + } | ||
| 71 | + | ||
| 72 | + public String getScheduleDateStr() { | ||
| 73 | + return scheduleDateStr; | ||
| 74 | + } | ||
| 75 | + | ||
| 76 | + public void setScheduleDateStr(String scheduleDateStr) { | ||
| 77 | + this.scheduleDateStr = scheduleDateStr; | ||
| 78 | + } | ||
| 79 | + | ||
| 80 | + public String getRealExecDate() { | ||
| 81 | + return realExecDate; | ||
| 82 | + } | ||
| 83 | + | ||
| 84 | + public void setRealExecDate(String realExecDate) { | ||
| 85 | + this.realExecDate = realExecDate; | ||
| 86 | + } | ||
| 87 | + | ||
| 88 | + public String getXlName() { | ||
| 89 | + return xlName; | ||
| 90 | + } | ||
| 91 | + | ||
| 92 | + public void setXlName(String xlName) { | ||
| 93 | + this.xlName = xlName; | ||
| 94 | + } | ||
| 95 | + | ||
| 96 | + public String getXlBm() { | ||
| 97 | + return xlBm; | ||
| 98 | + } | ||
| 99 | + | ||
| 100 | + public void setXlBm(String xlBm) { | ||
| 101 | + this.xlBm = xlBm; | ||
| 102 | + } | ||
| 103 | + | ||
| 104 | + public String getLpName() { | ||
| 105 | + return lpName; | ||
| 106 | + } | ||
| 107 | + | ||
| 108 | + public void setLpName(String lpName) { | ||
| 109 | + this.lpName = lpName; | ||
| 110 | + } | ||
| 111 | + | ||
| 112 | + public String getClZbh() { | ||
| 113 | + return clZbh; | ||
| 114 | + } | ||
| 115 | + | ||
| 116 | + public void setClZbh(String clZbh) { | ||
| 117 | + this.clZbh = clZbh; | ||
| 118 | + } | ||
| 119 | + | ||
| 120 | + public String getjGh() { | ||
| 121 | + return jGh; | ||
| 122 | + } | ||
| 123 | + | ||
| 124 | + public void setjGh(String jGh) { | ||
| 125 | + this.jGh = jGh; | ||
| 126 | + } | ||
| 127 | + | ||
| 128 | + public String getjName() { | ||
| 129 | + return jName; | ||
| 130 | + } | ||
| 131 | + | ||
| 132 | + public void setjName(String jName) { | ||
| 133 | + this.jName = jName; | ||
| 134 | + } | ||
| 135 | + | ||
| 136 | + public String getsGh() { | ||
| 137 | + return sGh; | ||
| 138 | + } | ||
| 139 | + | ||
| 140 | + public void setsGh(String sGh) { | ||
| 141 | + this.sGh = sGh; | ||
| 142 | + } | ||
| 143 | + | ||
| 144 | + public String getsName() { | ||
| 145 | + return sName; | ||
| 146 | + } | ||
| 147 | + | ||
| 148 | + public void setsName(String sName) { | ||
| 149 | + this.sName = sName; | ||
| 150 | + } | ||
| 151 | + | ||
| 152 | + public String getXlDir() { | ||
| 153 | + return xlDir; | ||
| 154 | + } | ||
| 155 | + | ||
| 156 | + public void setXlDir(String xlDir) { | ||
| 157 | + this.xlDir = xlDir; | ||
| 158 | + } | ||
| 159 | + | ||
| 160 | + public String getQdzCode() { | ||
| 161 | + return qdzCode; | ||
| 162 | + } | ||
| 163 | + | ||
| 164 | + public void setQdzCode(String qdzCode) { | ||
| 165 | + this.qdzCode = qdzCode; | ||
| 166 | + } | ||
| 167 | + | ||
| 168 | + public String getQdzName() { | ||
| 169 | + return qdzName; | ||
| 170 | + } | ||
| 171 | + | ||
| 172 | + public void setQdzName(String qdzName) { | ||
| 173 | + this.qdzName = qdzName; | ||
| 174 | + } | ||
| 175 | + | ||
| 176 | + public String getZdzCode() { | ||
| 177 | + return zdzCode; | ||
| 178 | + } | ||
| 179 | + | ||
| 180 | + public void setZdzCode(String zdzCode) { | ||
| 181 | + this.zdzCode = zdzCode; | ||
| 182 | + } | ||
| 183 | + | ||
| 184 | + public String getZdzName() { | ||
| 185 | + return zdzName; | ||
| 186 | + } | ||
| 187 | + | ||
| 188 | + public void setZdzName(String zdzName) { | ||
| 189 | + this.zdzName = zdzName; | ||
| 190 | + } | ||
| 191 | + | ||
| 192 | + public String getDfsj() { | ||
| 193 | + return dfsj; | ||
| 194 | + } | ||
| 195 | + | ||
| 196 | + public void setDfsj(String dfsj) { | ||
| 197 | + this.dfsj = dfsj; | ||
| 198 | + } | ||
| 199 | + | ||
| 200 | + public Long getDfsjT() { | ||
| 201 | + return dfsjT; | ||
| 202 | + } | ||
| 203 | + | ||
| 204 | + public void setDfsjT(Long dfsjT) { | ||
| 205 | + this.dfsjT = dfsjT; | ||
| 206 | + } | ||
| 207 | + | ||
| 208 | + public String getZdsj() { | ||
| 209 | + return zdsj; | ||
| 210 | + } | ||
| 211 | + | ||
| 212 | + public void setZdsj(String zdsj) { | ||
| 213 | + this.zdsj = zdsj; | ||
| 214 | + } | ||
| 215 | + | ||
| 216 | + public Long getZdsjT() { | ||
| 217 | + return zdsjT; | ||
| 218 | + } | ||
| 219 | + | ||
| 220 | + public void setZdsjT(Long zdsjT) { | ||
| 221 | + this.zdsjT = zdsjT; | ||
| 222 | + } | ||
| 223 | + | ||
| 224 | + public String getFcsjActual() { | ||
| 225 | + return fcsjActual; | ||
| 226 | + } | ||
| 227 | + | ||
| 228 | + public void setFcsjActual(String fcsjActual) { | ||
| 229 | + this.fcsjActual = fcsjActual; | ||
| 230 | + } | ||
| 231 | + | ||
| 232 | + public String getZdsjActual() { | ||
| 233 | + return zdsjActual; | ||
| 234 | + } | ||
| 235 | + | ||
| 236 | + public void setZdsjActual(String zdsjActual) { | ||
| 237 | + this.zdsjActual = zdsjActual; | ||
| 238 | + } | ||
| 239 | + | ||
| 240 | + public boolean isSflj() { | ||
| 241 | + return sflj; | ||
| 242 | + } | ||
| 243 | + | ||
| 244 | + public void setSflj(boolean sflj) { | ||
| 245 | + this.sflj = sflj; | ||
| 246 | + } | ||
| 247 | + | ||
| 248 | + public String getRemarks() { | ||
| 249 | + return remarks; | ||
| 250 | + } | ||
| 251 | + | ||
| 252 | + public void setRemarks(String remarks) { | ||
| 253 | + this.remarks = remarks; | ||
| 254 | + } | ||
| 255 | + | ||
| 256 | + public String getGsName() { | ||
| 257 | + return gsName; | ||
| 258 | + } | ||
| 259 | + | ||
| 260 | + public void setGsName(String gsName) { | ||
| 261 | + this.gsName = gsName; | ||
| 262 | + } | ||
| 263 | + | ||
| 264 | + public String getGsBm() { | ||
| 265 | + return gsBm; | ||
| 266 | + } | ||
| 267 | + | ||
| 268 | + public void setGsBm(String gsBm) { | ||
| 269 | + this.gsBm = gsBm; | ||
| 270 | + } | ||
| 271 | + | ||
| 272 | + public String getFgsName() { | ||
| 273 | + return fgsName; | ||
| 274 | + } | ||
| 275 | + | ||
| 276 | + public void setFgsName(String fgsName) { | ||
| 277 | + this.fgsName = fgsName; | ||
| 278 | + } | ||
| 279 | + | ||
| 280 | + public String getFgsBm() { | ||
| 281 | + return fgsBm; | ||
| 282 | + } | ||
| 283 | + | ||
| 284 | + public void setFgsBm(String fgsBm) { | ||
| 285 | + this.fgsBm = fgsBm; | ||
| 286 | + } | ||
| 287 | +} |
src/main/java/com/bsth/server_rs/schedule/real/ScheduleRealService.java
0 → 100644
| 1 | +package com.bsth.server_rs.schedule.real; | ||
| 2 | + | ||
| 3 | +import com.bsth.common.BasicData; | ||
| 4 | +import com.bsth.redis.ScheduleRedisService; | ||
| 5 | +import com.bsth.server_rs.schedule.dto.ScheduleInOut; | ||
| 6 | +import org.springframework.beans.factory.annotation.Autowired; | ||
| 7 | +import org.springframework.stereotype.Component; | ||
| 8 | + | ||
| 9 | +import javax.ws.rs.GET; | ||
| 10 | +import javax.ws.rs.Path; | ||
| 11 | +import javax.ws.rs.PathParam; | ||
| 12 | +import javax.ws.rs.Produces; | ||
| 13 | +import javax.ws.rs.core.MediaType; | ||
| 14 | +import java.util.ArrayList; | ||
| 15 | +import java.util.List; | ||
| 16 | +import java.util.Set; | ||
| 17 | + | ||
| 18 | +/** | ||
| 19 | + * Created by panzhao on 2017/8/24. | ||
| 20 | + */ | ||
| 21 | +@Component | ||
| 22 | +@Path("/schedule_real") | ||
| 23 | +@Produces({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML}) | ||
| 24 | +public class ScheduleRealService { | ||
| 25 | + | ||
| 26 | + @Autowired | ||
| 27 | + ScheduleRedisService redisService; | ||
| 28 | + | ||
| 29 | + /** | ||
| 30 | + * 获取当天指定停车场的进出场排班数据 | ||
| 31 | + * @return | ||
| 32 | + */ | ||
| 33 | + @GET | ||
| 34 | + @Path("/in_out/{code}") | ||
| 35 | + public List<ScheduleInOut> findInOut(@PathParam("code") String code){ | ||
| 36 | + Set<String> lineArray = BasicData.lineDateMap.keySet(); | ||
| 37 | + | ||
| 38 | + List<ScheduleInOut> all = new ArrayList<>(); | ||
| 39 | + for(String lineCode : lineArray){ | ||
| 40 | + all.addAll(ScheduleInOut.getMultiInstance(redisService.read(BasicData.lineDateMap.get(lineCode), lineCode), code)); | ||
| 41 | + } | ||
| 42 | + return all; | ||
| 43 | + } | ||
| 44 | +} |