Commit 854809d8a9db0762789240d00afc2c95fc959a1b

Authored by 王通
1 parent 1c918266

加入特殊停车场编号00000000可以获取全部进出场班次数据

src/main/java/com/bsth/server_rs/schedule/dto/ScheduleInOut.java
1 -package com.bsth.server_rs.schedule.dto;  
2 -  
3 -import com.bsth.entity.ScheduleRealInfo;  
4 -  
5 -import javax.xml.bind.annotation.XmlRootElement;  
6 -import java.io.Serializable;  
7 -import java.util.ArrayList;  
8 -import java.util.List;  
9 -  
10 -/**  
11 - * 进出场班次数据 ---给停车场用的  
12 - * Created by panzhao on 2017/8/24.  
13 - */  
14 -@XmlRootElement  
15 -public class ScheduleInOut implements Serializable {  
16 -  
17 - public static List<ScheduleInOut> getMultiInstance(List<ScheduleRealInfo> list, String tccCode){  
18 - List<ScheduleInOut> rs = new ArrayList<>();  
19 -  
20 - for(ScheduleRealInfo sch : list){  
21 - if(!sch.getBcType().equals("in") && !sch.getBcType().equals("out"))  
22 - continue;  
23 -  
24 - if(!sch.getQdzCode().equals(tccCode) && !sch.getZdzCode().equals(tccCode))  
25 - continue;  
26 -  
27 - rs.add(new ScheduleInOut(sch));  
28 - }  
29 - return rs;  
30 - }  
31 -  
32 - public static List<ScheduleInOut> getMultiInstance(List<ScheduleRealInfo> list){  
33 - List<ScheduleInOut> rs = new ArrayList<>();  
34 -  
35 - for(ScheduleRealInfo sch : list){  
36 - rs.add(new ScheduleInOut(sch));  
37 - }  
38 - return rs;  
39 - }  
40 -  
41 -  
42 - ScheduleInOut(){}  
43 -  
44 - public ScheduleInOut(ScheduleRealInfo sch){  
45 - this.id = sch.getId();  
46 - this.scheduleDateStr = sch.getScheduleDateStr();  
47 - this.lineCode = sch.getXlBm();  
48 - this.lineName = sch.getXlName();  
49 - this.lpName = sch.getLpName();  
50 - this.nbbm = sch.getClZbh();  
51 - this.jsy = sch.getjGh() + "/" + sch.getjName();  
52 - this.spy = sch.getsGh() + "/" + sch.getsName();  
53 - this.upDown = Integer.parseInt(sch.getXlDir());  
54 - this.qdzCode = sch.getQdzCode();  
55 - this.qdzName = sch.getQdzName();  
56 - this.zdzCode = sch.getZdzCode();  
57 - this.zdzName = sch.getZdzName();  
58 - this.dfsjT = sch.getDfsjT();  
59 - this.zdsjT = sch.getZdsjT();  
60 - this.fcsjActualTime = sch.getFcsjActualTime();  
61 - this.zdsjActualTime = sch.getZdsjActualTime();  
62 - this.sflj = sch.isSflj();  
63 - this.remarks = sch.getRemarks();  
64 - this.status = sch.getStatus();  
65 - }  
66 -  
67 - private Long id;  
68 - private String scheduleDateStr;  
69 - private String lineCode;  
70 - private String lineName;  
71 - private String lpName;  
72 - private String nbbm;  
73 - private String jsy;  
74 - private String spy;  
75 - private Integer upDown;  
76 - private String qdzCode;  
77 - private String qdzName;  
78 - private String zdzCode;  
79 - private String zdzName;  
80 - private Long dfsjT;  
81 - private Long zdsjT;  
82 - private Long fcsjActualTime;  
83 - private Long zdsjActualTime;  
84 - private boolean sflj;  
85 - private String remarks;  
86 - private int status;  
87 -  
88 - public Long getId() {  
89 - return id;  
90 - }  
91 -  
92 - public void setId(Long id) {  
93 - this.id = id;  
94 - }  
95 -  
96 - public String getScheduleDateStr() {  
97 - return scheduleDateStr;  
98 - }  
99 -  
100 - public void setScheduleDateStr(String scheduleDateStr) {  
101 - this.scheduleDateStr = scheduleDateStr;  
102 - }  
103 -  
104 - public String getLineCode() {  
105 - return lineCode;  
106 - }  
107 -  
108 - public void setLineCode(String lineCode) {  
109 - this.lineCode = lineCode;  
110 - }  
111 -  
112 - public String getLineName() {  
113 - return lineName;  
114 - }  
115 -  
116 - public void setLineName(String lineName) {  
117 - this.lineName = lineName;  
118 - }  
119 -  
120 - public String getLpName() {  
121 - return lpName;  
122 - }  
123 -  
124 - public void setLpName(String lpName) {  
125 - this.lpName = lpName;  
126 - }  
127 -  
128 - public String getNbbm() {  
129 - return nbbm;  
130 - }  
131 -  
132 - public void setNbbm(String nbbm) {  
133 - this.nbbm = nbbm;  
134 - }  
135 -  
136 - public String getJsy() {  
137 - return jsy;  
138 - }  
139 -  
140 - public void setJsy(String jsy) {  
141 - this.jsy = jsy;  
142 - }  
143 -  
144 - public String getSpy() {  
145 - return spy;  
146 - }  
147 -  
148 - public void setSpy(String spy) {  
149 - this.spy = spy;  
150 - }  
151 -  
152 - public Integer getUpDown() {  
153 - return upDown;  
154 - }  
155 -  
156 - public void setUpDown(Integer upDown) {  
157 - this.upDown = upDown;  
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 Long getDfsjT() {  
193 - return dfsjT;  
194 - }  
195 -  
196 - public void setDfsjT(Long dfsjT) {  
197 - this.dfsjT = dfsjT;  
198 - }  
199 -  
200 - public Long getZdsjT() {  
201 - return zdsjT;  
202 - }  
203 -  
204 - public void setZdsjT(Long zdsjT) {  
205 - this.zdsjT = zdsjT;  
206 - }  
207 -  
208 - public Long getFcsjActualTime() {  
209 - return fcsjActualTime;  
210 - }  
211 -  
212 - public void setFcsjActualTime(Long fcsjActualTime) {  
213 - this.fcsjActualTime = fcsjActualTime;  
214 - }  
215 -  
216 - public Long getZdsjActualTime() {  
217 - return zdsjActualTime;  
218 - }  
219 -  
220 - public void setZdsjActualTime(Long zdsjActualTime) {  
221 - this.zdsjActualTime = zdsjActualTime;  
222 - }  
223 -  
224 - public boolean isSflj() {  
225 - return sflj;  
226 - }  
227 -  
228 - public void setSflj(boolean sflj) {  
229 - this.sflj = sflj;  
230 - }  
231 -  
232 - public String getRemarks() {  
233 - return remarks;  
234 - }  
235 -  
236 - public void setRemarks(String remarks) {  
237 - this.remarks = remarks;  
238 - }  
239 -  
240 - public int getStatus() {  
241 - return status;  
242 - }  
243 -  
244 - public void setStatus(int status) {  
245 - this.status = status;  
246 - }  
247 -} 1 +package com.bsth.server_rs.schedule.dto;
  2 +
  3 +import com.bsth.entity.ScheduleRealInfo;
  4 +
  5 +import javax.xml.bind.annotation.XmlRootElement;
  6 +import java.io.Serializable;
  7 +import java.util.ArrayList;
  8 +import java.util.List;
  9 +
  10 +/**
  11 + * 进出场班次数据 ---给停车场用的
  12 + * Created by panzhao on 2017/8/24.
  13 + */
  14 +@XmlRootElement
  15 +public class ScheduleInOut implements Serializable {
  16 +
  17 + public static List<ScheduleInOut> getMultiInstance4Inout(List<ScheduleRealInfo> list){
  18 + List<ScheduleInOut> rs = new ArrayList<>();
  19 +
  20 + for(ScheduleRealInfo sch : list){
  21 + if(sch.getBcType().equals("in") || sch.getBcType().equals("out")){
  22 + rs.add(new ScheduleInOut(sch));
  23 + }
  24 + }
  25 + return rs;
  26 + }
  27 +
  28 + public static List<ScheduleInOut> getMultiInstance(List<ScheduleRealInfo> list, String tccCode){
  29 + List<ScheduleInOut> rs = new ArrayList<>();
  30 +
  31 + for(ScheduleRealInfo sch : list){
  32 + if(!sch.getBcType().equals("in") && !sch.getBcType().equals("out"))
  33 + continue;
  34 +
  35 + if(!sch.getQdzCode().equals(tccCode) && !sch.getZdzCode().equals(tccCode))
  36 + continue;
  37 +
  38 + rs.add(new ScheduleInOut(sch));
  39 + }
  40 + return rs;
  41 + }
  42 +
  43 + public static List<ScheduleInOut> getMultiInstance(List<ScheduleRealInfo> list){
  44 + List<ScheduleInOut> rs = new ArrayList<>();
  45 +
  46 + for(ScheduleRealInfo sch : list){
  47 + rs.add(new ScheduleInOut(sch));
  48 + }
  49 + return rs;
  50 + }
  51 +
  52 +
  53 + ScheduleInOut(){}
  54 +
  55 + public ScheduleInOut(ScheduleRealInfo sch){
  56 + this.id = sch.getId();
  57 + this.scheduleDateStr = sch.getScheduleDateStr();
  58 + this.lineCode = sch.getXlBm();
  59 + this.lineName = sch.getXlName();
  60 + this.lpName = sch.getLpName();
  61 + this.nbbm = sch.getClZbh();
  62 + this.jsy = sch.getjGh() + "/" + sch.getjName();
  63 + this.spy = sch.getsGh() + "/" + sch.getsName();
  64 + this.upDown = Integer.parseInt(sch.getXlDir());
  65 + this.qdzCode = sch.getQdzCode();
  66 + this.qdzName = sch.getQdzName();
  67 + this.zdzCode = sch.getZdzCode();
  68 + this.zdzName = sch.getZdzName();
  69 + this.dfsjT = sch.getDfsjT();
  70 + this.zdsjT = sch.getZdsjT();
  71 + this.fcsjActualTime = sch.getFcsjActualTime();
  72 + this.zdsjActualTime = sch.getZdsjActualTime();
  73 + this.sflj = sch.isSflj();
  74 + this.remarks = sch.getRemarks();
  75 + this.status = sch.getStatus();
  76 + }
  77 +
  78 + private Long id;
  79 + private String scheduleDateStr;
  80 + private String lineCode;
  81 + private String lineName;
  82 + private String lpName;
  83 + private String nbbm;
  84 + private String jsy;
  85 + private String spy;
  86 + private Integer upDown;
  87 + private String qdzCode;
  88 + private String qdzName;
  89 + private String zdzCode;
  90 + private String zdzName;
  91 + private Long dfsjT;
  92 + private Long zdsjT;
  93 + private Long fcsjActualTime;
  94 + private Long zdsjActualTime;
  95 + private boolean sflj;
  96 + private String remarks;
  97 + private int status;
  98 +
  99 + public Long getId() {
  100 + return id;
  101 + }
  102 +
  103 + public void setId(Long id) {
  104 + this.id = id;
  105 + }
  106 +
  107 + public String getScheduleDateStr() {
  108 + return scheduleDateStr;
  109 + }
  110 +
  111 + public void setScheduleDateStr(String scheduleDateStr) {
  112 + this.scheduleDateStr = scheduleDateStr;
  113 + }
  114 +
  115 + public String getLineCode() {
  116 + return lineCode;
  117 + }
  118 +
  119 + public void setLineCode(String lineCode) {
  120 + this.lineCode = lineCode;
  121 + }
  122 +
  123 + public String getLineName() {
  124 + return lineName;
  125 + }
  126 +
  127 + public void setLineName(String lineName) {
  128 + this.lineName = lineName;
  129 + }
  130 +
  131 + public String getLpName() {
  132 + return lpName;
  133 + }
  134 +
  135 + public void setLpName(String lpName) {
  136 + this.lpName = lpName;
  137 + }
  138 +
  139 + public String getNbbm() {
  140 + return nbbm;
  141 + }
  142 +
  143 + public void setNbbm(String nbbm) {
  144 + this.nbbm = nbbm;
  145 + }
  146 +
  147 + public String getJsy() {
  148 + return jsy;
  149 + }
  150 +
  151 + public void setJsy(String jsy) {
  152 + this.jsy = jsy;
  153 + }
  154 +
  155 + public String getSpy() {
  156 + return spy;
  157 + }
  158 +
  159 + public void setSpy(String spy) {
  160 + this.spy = spy;
  161 + }
  162 +
  163 + public Integer getUpDown() {
  164 + return upDown;
  165 + }
  166 +
  167 + public void setUpDown(Integer upDown) {
  168 + this.upDown = upDown;
  169 + }
  170 +
  171 + public String getQdzCode() {
  172 + return qdzCode;
  173 + }
  174 +
  175 + public void setQdzCode(String qdzCode) {
  176 + this.qdzCode = qdzCode;
  177 + }
  178 +
  179 + public String getQdzName() {
  180 + return qdzName;
  181 + }
  182 +
  183 + public void setQdzName(String qdzName) {
  184 + this.qdzName = qdzName;
  185 + }
  186 +
  187 + public String getZdzCode() {
  188 + return zdzCode;
  189 + }
  190 +
  191 + public void setZdzCode(String zdzCode) {
  192 + this.zdzCode = zdzCode;
  193 + }
  194 +
  195 + public String getZdzName() {
  196 + return zdzName;
  197 + }
  198 +
  199 + public void setZdzName(String zdzName) {
  200 + this.zdzName = zdzName;
  201 + }
  202 +
  203 + public Long getDfsjT() {
  204 + return dfsjT;
  205 + }
  206 +
  207 + public void setDfsjT(Long dfsjT) {
  208 + this.dfsjT = dfsjT;
  209 + }
  210 +
  211 + public Long getZdsjT() {
  212 + return zdsjT;
  213 + }
  214 +
  215 + public void setZdsjT(Long zdsjT) {
  216 + this.zdsjT = zdsjT;
  217 + }
  218 +
  219 + public Long getFcsjActualTime() {
  220 + return fcsjActualTime;
  221 + }
  222 +
  223 + public void setFcsjActualTime(Long fcsjActualTime) {
  224 + this.fcsjActualTime = fcsjActualTime;
  225 + }
  226 +
  227 + public Long getZdsjActualTime() {
  228 + return zdsjActualTime;
  229 + }
  230 +
  231 + public void setZdsjActualTime(Long zdsjActualTime) {
  232 + this.zdsjActualTime = zdsjActualTime;
  233 + }
  234 +
  235 + public boolean isSflj() {
  236 + return sflj;
  237 + }
  238 +
  239 + public void setSflj(boolean sflj) {
  240 + this.sflj = sflj;
  241 + }
  242 +
  243 + public String getRemarks() {
  244 + return remarks;
  245 + }
  246 +
  247 + public void setRemarks(String remarks) {
  248 + this.remarks = remarks;
  249 + }
  250 +
  251 + public int getStatus() {
  252 + return status;
  253 + }
  254 +
  255 + public void setStatus(int status) {
  256 + this.status = status;
  257 + }
  258 +}
src/main/java/com/bsth/server_rs/schedule/real/ScheduleRealService.java
1 -package com.bsth.server_rs.schedule.real;  
2 -  
3 -import com.alibaba.fastjson.JSON;  
4 -import com.alibaba.fastjson.JSONArray;  
5 -import com.alibaba.fastjson.JSONObject;  
6 -import com.bsth.common.BasicData;  
7 -import com.bsth.common.ResponseCode;  
8 -import com.bsth.entity.ScheduleRealInfo;  
9 -import com.bsth.redis.ScheduleRedisService;  
10 -import com.bsth.server_rs.base_info.line.Line;  
11 -import com.bsth.server_rs.base_info.line.buffer.LineBufferData;  
12 -import com.bsth.server_rs.schedule.dto.ScheduleCcInfoConfig;  
13 -import com.bsth.server_rs.schedule.dto.ScheduleInOut;  
14 -import com.bsth.server_rs.schedule.dto.ScheduleRealInfoDTO_JK;  
15 -import com.bsth.util.ConfigUtil;  
16 -import com.bsth.util.HttpClientUtils;  
17 -import com.google.common.base.Splitter;  
18 -import org.apache.commons.lang3.StringUtils;  
19 -import org.slf4j.Logger;  
20 -import org.slf4j.LoggerFactory;  
21 -import org.springframework.beans.factory.annotation.Autowired;  
22 -import org.springframework.stereotype.Component;  
23 -  
24 -import javax.ws.rs.*;  
25 -import javax.ws.rs.core.MediaType;  
26 -import java.net.URLEncoder;  
27 -import java.util.*;  
28 -  
29 -/**  
30 - * Created by panzhao on 2017/8/24.  
31 - */  
32 -@Component  
33 -@Path("/schedule_real")  
34 -@Produces({MediaType.APPLICATION_JSON})  
35 -public class ScheduleRealService {  
36 -  
37 - @Autowired  
38 - ScheduleRedisService redisService;  
39 -  
40 - @Autowired  
41 - SchRealDataBuffer schRealDataBuffer;  
42 -  
43 - Logger logger = LoggerFactory.getLogger(this.getClass());  
44 -  
45 - static String url;  
46 - static String secretKey;  
47 -  
48 - static {  
49 - secretKey = ConfigUtil.get("http.control.secret.key");  
50 - url = ConfigUtil.get("http.control.service_data_url");// + "/execSchList?secretKey=" + secretKey;  
51 - }  
52 -  
53 - @POST  
54 - @Path("tcc_tzrc")  
55 - public Map<String, Object> tccTzrc(String jsonStr) {  
56 - JSONObject rs = new JSONObject();  
57 - try {  
58 - StringBuilder sb = HttpClientUtils.post(url + "/tccHrhc?secretKey=" + secretKey, jsonStr);  
59 -  
60 - rs = JSONObject.parseObject(sb.toString());  
61 -  
62 - if ("SUCCESS".equals(rs.get("status"))) {  
63 - rs.put("list", ScheduleInOut.getMultiInstance(JSONArray.parseArray(rs.getJSONArray("list").toJSONString(), ScheduleRealInfo.class)));  
64 - }  
65 - } catch (Exception e) {  
66 - logger.error("", e);  
67 - rs.put("status", ResponseCode.ERROR);  
68 - rs.put("msg", "接口服务器出现异常!");  
69 - }  
70 - return rs;  
71 - }  
72 -  
73 - @POST  
74 - @Path("tcc_dftz")  
75 - public Map<String, Object> tccDftz(String jsonStr) {  
76 - JSONObject rs = new JSONObject();  
77 - try {  
78 - StringBuilder sb = HttpClientUtils.post(url + "/dftzAndDestroy?secretKey=" + secretKey, jsonStr);  
79 -  
80 - rs = JSON.parseObject(sb.toString());  
81 -  
82 - if ("SUCCESS".equals(rs.get("status"))) {  
83 - rs.put("t", new ScheduleInOut(JSON.toJavaObject(JSON.parseObject(rs.get("t").toString()), ScheduleRealInfo.class)));  
84 - }  
85 - //ScheduleInOut.getMultiInstance  
86 - } catch (Exception e) {  
87 - logger.error("", e);  
88 - rs.put("status", ResponseCode.ERROR);  
89 - rs.put("msg", "接口服务器出现异常!");  
90 - }  
91 - return rs;  
92 - }  
93 -  
94 - /**  
95 - * 获取路牌下的班次信息  
96 - *  
97 - * @param lineCode  
98 - * @param lpName  
99 - * @return  
100 - */  
101 - @GET  
102 - @Path("/findByLpName/{lineCode}/{lpName}")  
103 - public List<ScheduleRealInfo> findByLpName(@PathParam("lineCode") String lineCode, @PathParam("lpName") String lpName) {  
104 - List<ScheduleRealInfo> list = new ArrayList<>();  
105 - try {  
106 - if (StringUtils.isEmpty(lineCode) || StringUtils.isEmpty(lpName))  
107 - return list;  
108 -  
109 - lpName = URLEncoder.encode(lpName, "UTF-8");  
110 - StringBuilder sb = HttpClientUtils.get(url + "/findByLpName?secretKey=" + secretKey + "&lineCode=" + lineCode + "&lpName=" + lpName);  
111 - list = JSON.parseArray(sb.toString(), ScheduleRealInfo.class);  
112 - } catch (Exception e) {  
113 - logger.error("", e);  
114 - }  
115 - return list;  
116 - }  
117 -  
118 - /**  
119 - * 获取当天指定停车场的进出场排班数据  
120 - *  
121 - * @return  
122 - */  
123 - @GET  
124 - @Path("/in_out/{code}")  
125 - public List<ScheduleInOut> findInOut(@PathParam("code") String code) {  
126 - Set<String> lineArray = BasicData.lineDateMap.keySet();  
127 -  
128 - List<ScheduleInOut> all = new ArrayList<>();  
129 - for (String lineCode : lineArray) {  
130 - all.addAll(ScheduleInOut.getMultiInstance(redisService.read(BasicData.lineDateMap.get(lineCode), lineCode), code));  
131 - }  
132 - return all;  
133 - }  
134 -  
135 - /**  
136 - * 获取指定日期,指定公司的人员车辆配置情况(实际排班)  
137 - *  
138 - * @param company  
139 - * @param rq  
140 - * @return  
141 - */  
142 - @GET  
143 - @Path("/ccConfig/{company}/{rq}")  
144 - public List<ScheduleCcInfoConfig> ccInfoConfig(@PathParam("company") String company, @PathParam("rq") String rq) {  
145 - List<Line> lines = LineBufferData.findByCompany(company);  
146 -  
147 - List<ScheduleCcInfoConfig> all = new ArrayList<>();  
148 - for (Line line : lines) {  
149 - all.addAll(ScheduleCcInfoConfig.getMultiInstance(redisService.read(rq, line.getLineCode())));  
150 - }  
151 - return all;  
152 - }  
153 -  
154 - /**  
155 - * 根据车辆自编号获取对应执行的班次信息  
156 - *  
157 - * @param nbbm  
158 - * @return  
159 - */  
160 - @GET  
161 - @Path("/exec/{nbbm}")  
162 - public JSONObject getExecPlan(@PathParam("nbbm") String nbbm) {  
163 - return schRealDataBuffer.getExecPlan(nbbm);  
164 - }  
165 -  
166 - /**  
167 - * 获取当天指定停车场的进出场排班数据(潘钊场站VIP特供版 -高实时)  
168 - *  
169 - * @return  
170 - */  
171 - @GET  
172 - @Path("/in_out/pz_vip/{code}")  
173 - public List<ScheduleInOut> findInOut_real(@PathParam("code") String code) {  
174 - logger.info("in_out -" + code);  
175 - return ScheduleInOut.getMultiInstance(schRealDataBuffer.findByParkCode(code));  
176 - }  
177 -  
178 - @GET  
179 - @Path("/sch_jk/{company}/{rq}")  
180 - public List<ScheduleRealInfoDTO_JK> find_JK(@PathParam("company") String company, @PathParam("rq") String rq) {  
181 - List<ScheduleRealInfoDTO_JK> all = new ArrayList<>();  
182 -  
183 - List<Line> lines = LineBufferData.findByCompany(company);  
184 - for (Line line : lines) {  
185 - all.addAll(ScheduleRealInfoDTO_JK.getMultiInstance(redisService.read(rq, line.getLineCode())));  
186 - }  
187 - return all;  
188 - }  
189 -  
190 - /**  
191 - * 读取指定日期的redis 数据,计算程序调用  
192 - *  
193 - * @param rqs  
194 - * @return  
195 - */  
196 - @GET  
197 - @Path("/pz_vip/read/{rqs}")  
198 - public List<ScheduleRealInfo> read(@PathParam("rqs") String rqs) {  
199 - List<ScheduleRealInfo> all = new ArrayList<>(), rs = new ArrayList<>();  
200 - List<Line> lines = LineBufferData.findAll();  
201 - List<String> rqArray = Splitter.on(",").splitToList(rqs);  
202 -  
203 - for (Line line : lines) {  
204 - for (String rq : rqArray)  
205 - all.addAll(redisService.read(rq, line.getLineCode()));  
206 - }  
207 -  
208 - for (ScheduleRealInfo sch : all) {  
209 - if (sch.getBcType().equals("in") || sch.getBcType().equals("out") || sch.getBcType().equals("ldks"))  
210 - continue;  
211 -  
212 - //烂班,临加,有子任务的  
213 - if (sch.getStatus() == -1 || sch.isSflj() || (sch.getcTasks() != null && sch.getcTasks().size() > 0))  
214 - rs.add(sch);  
215 - }  
216 - return rs;  
217 - }  
218 -  
219 - /**  
220 - * 读取指定日期线路的redis 数据,计算程序调用  
221 - *  
222 - * @param rq  
223 - * @return  
224 - */  
225 - @GET  
226 - @Path("/pz_vip/readByRqAndLine/{rq}/{lineCode}")  
227 - public List<ScheduleRealInfo> readByLine(@PathParam("rq") String rq, @PathParam("lineCode") String lineCode) {  
228 - List<ScheduleRealInfo> all = redisService.read(rq, lineCode), rs = new ArrayList<>();  
229 -  
230 - for (ScheduleRealInfo sch : all) {  
231 - if (sch.getBcType().equals("in") || sch.getBcType().equals("out") || sch.getBcType().equals("ldks"))  
232 - continue;  
233 -  
234 - //烂班,临加,有子任务的  
235 - if (sch.getStatus() == -1 || sch.isSflj() || (sch.getcTasks() != null && sch.getcTasks().size() > 0))  
236 - rs.add(sch);  
237 - }  
238 - return rs;  
239 - }  
240 -} 1 +package com.bsth.server_rs.schedule.real;
  2 +
  3 +import com.alibaba.fastjson.JSON;
  4 +import com.alibaba.fastjson.JSONArray;
  5 +import com.alibaba.fastjson.JSONObject;
  6 +import com.bsth.common.BasicData;
  7 +import com.bsth.common.ResponseCode;
  8 +import com.bsth.entity.ScheduleRealInfo;
  9 +import com.bsth.redis.ScheduleRedisService;
  10 +import com.bsth.server_rs.base_info.line.Line;
  11 +import com.bsth.server_rs.base_info.line.buffer.LineBufferData;
  12 +import com.bsth.server_rs.schedule.dto.ScheduleCcInfoConfig;
  13 +import com.bsth.server_rs.schedule.dto.ScheduleInOut;
  14 +import com.bsth.server_rs.schedule.dto.ScheduleRealInfoDTO_JK;
  15 +import com.bsth.util.ConfigUtil;
  16 +import com.bsth.util.HttpClientUtils;
  17 +import com.google.common.base.Splitter;
  18 +import org.apache.commons.lang3.StringUtils;
  19 +import org.slf4j.Logger;
  20 +import org.slf4j.LoggerFactory;
  21 +import org.springframework.beans.factory.annotation.Autowired;
  22 +import org.springframework.stereotype.Component;
  23 +
  24 +import javax.ws.rs.*;
  25 +import javax.ws.rs.core.MediaType;
  26 +import java.net.URLEncoder;
  27 +import java.util.*;
  28 +
  29 +/**
  30 + * Created by panzhao on 2017/8/24.
  31 + */
  32 +@Component
  33 +@Path("/schedule_real")
  34 +@Produces({MediaType.APPLICATION_JSON})
  35 +public class ScheduleRealService {
  36 +
  37 + @Autowired
  38 + ScheduleRedisService redisService;
  39 +
  40 + @Autowired
  41 + SchRealDataBuffer schRealDataBuffer;
  42 +
  43 + Logger logger = LoggerFactory.getLogger(this.getClass());
  44 +
  45 + static String url;
  46 + static String secretKey;
  47 +
  48 + static {
  49 + secretKey = ConfigUtil.get("http.control.secret.key");
  50 + url = ConfigUtil.get("http.control.service_data_url");// + "/execSchList?secretKey=" + secretKey;
  51 + }
  52 +
  53 + @POST
  54 + @Path("tcc_tzrc")
  55 + public Map<String, Object> tccTzrc(String jsonStr) {
  56 + JSONObject rs = new JSONObject();
  57 + try {
  58 + StringBuilder sb = HttpClientUtils.post(url + "/tccHrhc?secretKey=" + secretKey, jsonStr);
  59 +
  60 + rs = JSONObject.parseObject(sb.toString());
  61 +
  62 + if ("SUCCESS".equals(rs.get("status"))) {
  63 + rs.put("list", ScheduleInOut.getMultiInstance(JSONArray.parseArray(rs.getJSONArray("list").toJSONString(), ScheduleRealInfo.class)));
  64 + }
  65 + } catch (Exception e) {
  66 + logger.error("", e);
  67 + rs.put("status", ResponseCode.ERROR);
  68 + rs.put("msg", "接口服务器出现异常!");
  69 + }
  70 + return rs;
  71 + }
  72 +
  73 + @POST
  74 + @Path("tcc_dftz")
  75 + public Map<String, Object> tccDftz(String jsonStr) {
  76 + JSONObject rs = new JSONObject();
  77 + try {
  78 + StringBuilder sb = HttpClientUtils.post(url + "/dftzAndDestroy?secretKey=" + secretKey, jsonStr);
  79 +
  80 + rs = JSON.parseObject(sb.toString());
  81 +
  82 + if ("SUCCESS".equals(rs.get("status"))) {
  83 + rs.put("t", new ScheduleInOut(JSON.toJavaObject(JSON.parseObject(rs.get("t").toString()), ScheduleRealInfo.class)));
  84 + }
  85 + //ScheduleInOut.getMultiInstance
  86 + } catch (Exception e) {
  87 + logger.error("", e);
  88 + rs.put("status", ResponseCode.ERROR);
  89 + rs.put("msg", "接口服务器出现异常!");
  90 + }
  91 + return rs;
  92 + }
  93 +
  94 + /**
  95 + * 获取路牌下的班次信息
  96 + *
  97 + * @param lineCode
  98 + * @param lpName
  99 + * @return
  100 + */
  101 + @GET
  102 + @Path("/findByLpName/{lineCode}/{lpName}")
  103 + public List<ScheduleRealInfo> findByLpName(@PathParam("lineCode") String lineCode, @PathParam("lpName") String lpName) {
  104 + List<ScheduleRealInfo> list = new ArrayList<>();
  105 + try {
  106 + if (StringUtils.isEmpty(lineCode) || StringUtils.isEmpty(lpName))
  107 + return list;
  108 +
  109 + lpName = URLEncoder.encode(lpName, "UTF-8");
  110 + StringBuilder sb = HttpClientUtils.get(url + "/findByLpName?secretKey=" + secretKey + "&lineCode=" + lineCode + "&lpName=" + lpName);
  111 + list = JSON.parseArray(sb.toString(), ScheduleRealInfo.class);
  112 + } catch (Exception e) {
  113 + logger.error("", e);
  114 + }
  115 + return list;
  116 + }
  117 +
  118 + /**
  119 + * 获取当天指定停车场的进出场排班数据
  120 + *
  121 + * @return
  122 + */
  123 + @GET
  124 + @Path("/in_out/{code}")
  125 + public List<ScheduleInOut> findInOut(@PathParam("code") String code) {
  126 + Set<String> lineArray = BasicData.lineDateMap.keySet();
  127 +
  128 + List<ScheduleInOut> all = new ArrayList<>();
  129 + if ("00000000".equals(code)) {
  130 + for (String lineCode : lineArray) {
  131 + all.addAll(ScheduleInOut.getMultiInstance4Inout(redisService.read(BasicData.lineDateMap.get(lineCode), lineCode)));
  132 + }
  133 + } else {
  134 + for (String lineCode : lineArray) {
  135 + all.addAll(ScheduleInOut.getMultiInstance(redisService.read(BasicData.lineDateMap.get(lineCode), lineCode), code));
  136 + }
  137 + }
  138 + return all;
  139 + }
  140 +
  141 + /**
  142 + * 获取指定日期,指定公司的人员车辆配置情况(实际排班)
  143 + *
  144 + * @param company
  145 + * @param rq
  146 + * @return
  147 + */
  148 + @GET
  149 + @Path("/ccConfig/{company}/{rq}")
  150 + public List<ScheduleCcInfoConfig> ccInfoConfig(@PathParam("company") String company, @PathParam("rq") String rq) {
  151 + List<Line> lines = LineBufferData.findByCompany(company);
  152 +
  153 + List<ScheduleCcInfoConfig> all = new ArrayList<>();
  154 + for (Line line : lines) {
  155 + all.addAll(ScheduleCcInfoConfig.getMultiInstance(redisService.read(rq, line.getLineCode())));
  156 + }
  157 + return all;
  158 + }
  159 +
  160 + /**
  161 + * 根据车辆自编号获取对应执行的班次信息
  162 + *
  163 + * @param nbbm
  164 + * @return
  165 + */
  166 + @GET
  167 + @Path("/exec/{nbbm}")
  168 + public JSONObject getExecPlan(@PathParam("nbbm") String nbbm) {
  169 + return schRealDataBuffer.getExecPlan(nbbm);
  170 + }
  171 +
  172 + /**
  173 + * 获取当天指定停车场的进出场排班数据(潘钊场站VIP特供版 -高实时)
  174 + *
  175 + * @return
  176 + */
  177 + @GET
  178 + @Path("/in_out/pz_vip/{code}")
  179 + public List<ScheduleInOut> findInOut_real(@PathParam("code") String code) {
  180 + logger.info("in_out -" + code);
  181 + return ScheduleInOut.getMultiInstance(schRealDataBuffer.findByParkCode(code));
  182 + }
  183 +
  184 + @GET
  185 + @Path("/sch_jk/{company}/{rq}")
  186 + public List<ScheduleRealInfoDTO_JK> find_JK(@PathParam("company") String company, @PathParam("rq") String rq) {
  187 + List<ScheduleRealInfoDTO_JK> all = new ArrayList<>();
  188 +
  189 + List<Line> lines = LineBufferData.findByCompany(company);
  190 + for (Line line : lines) {
  191 + all.addAll(ScheduleRealInfoDTO_JK.getMultiInstance(redisService.read(rq, line.getLineCode())));
  192 + }
  193 + return all;
  194 + }
  195 +
  196 + /**
  197 + * 读取指定日期的redis 数据,计算程序调用
  198 + *
  199 + * @param rqs
  200 + * @return
  201 + */
  202 + @GET
  203 + @Path("/pz_vip/read/{rqs}")
  204 + public List<ScheduleRealInfo> read(@PathParam("rqs") String rqs) {
  205 + List<ScheduleRealInfo> all = new ArrayList<>(), rs = new ArrayList<>();
  206 + List<Line> lines = LineBufferData.findAll();
  207 + List<String> rqArray = Splitter.on(",").splitToList(rqs);
  208 +
  209 + for (Line line : lines) {
  210 + for (String rq : rqArray)
  211 + all.addAll(redisService.read(rq, line.getLineCode()));
  212 + }
  213 +
  214 + for (ScheduleRealInfo sch : all) {
  215 + if (sch.getBcType().equals("in") || sch.getBcType().equals("out") || sch.getBcType().equals("ldks"))
  216 + continue;
  217 +
  218 + //烂班,临加,有子任务的
  219 + if (sch.getStatus() == -1 || sch.isSflj() || (sch.getcTasks() != null && sch.getcTasks().size() > 0))
  220 + rs.add(sch);
  221 + }
  222 + return rs;
  223 + }
  224 +
  225 + /**
  226 + * 读取指定日期线路的redis 数据,计算程序调用
  227 + *
  228 + * @param rq
  229 + * @return
  230 + */
  231 + @GET
  232 + @Path("/pz_vip/readByRqAndLine/{rq}/{lineCode}")
  233 + public List<ScheduleRealInfo> readByLine(@PathParam("rq") String rq, @PathParam("lineCode") String lineCode) {
  234 + List<ScheduleRealInfo> all = redisService.read(rq, lineCode), rs = new ArrayList<>();
  235 +
  236 + for (ScheduleRealInfo sch : all) {
  237 + if (sch.getBcType().equals("in") || sch.getBcType().equals("out") || sch.getBcType().equals("ldks"))
  238 + continue;
  239 +
  240 + //烂班,临加,有子任务的
  241 + if (sch.getStatus() == -1 || sch.isSflj() || (sch.getcTasks() != null && sch.getcTasks().size() > 0))
  242 + rs.add(sch);
  243 + }
  244 + return rs;
  245 + }
  246 +}