Commit 3f77315e0bb98c0c4af2c85b5cd7259d22cbac65

Authored by 王通
1 parent 6dddcb0f

1.新增获取当天排班中变更过的排班数据接口

src/main/java/com/bsth/repository/ScheduleRealInfoRepository.java
1 -package com.bsth.repository;  
2 -  
3 -import com.bsth.entity.ScheduleRealInfo;  
4 -import org.springframework.data.jpa.repository.EntityGraph;  
5 -import org.springframework.data.jpa.repository.Query;  
6 -import org.springframework.data.repository.PagingAndSortingRepository;  
7 -import org.springframework.stereotype.Repository;  
8 -  
9 -import java.util.List;  
10 -  
11 -@Repository  
12 -public interface ScheduleRealInfoRepository extends PagingAndSortingRepository<ScheduleRealInfo, Long> {  
13 -  
14 - /**  
15 - * 根据日期获取班次信息  
16 - * @param schDate  
17 - * @return  
18 - */  
19 - @EntityGraph(value = "scheduleRealInfo_cTasks", type = EntityGraph.EntityGraphType.FETCH)  
20 - @Query("select DISTINCT s from ScheduleRealInfo s where s.scheduleDateStr=?1")  
21 - List<ScheduleRealInfo> findAll(String schDate);  
22 -  
23 - /**  
24 - * 根据日期和线路编码获取班次信息  
25 - * @param schDate  
26 - * @param lineCode  
27 - * @return  
28 - */  
29 - @EntityGraph(value = "scheduleRealInfo_cTasks", type = EntityGraph.EntityGraphType.FETCH)  
30 - @Query("select DISTINCT s from ScheduleRealInfo s where s.scheduleDateStr=?1 and s.xlBm=?2")  
31 - List<ScheduleRealInfo> findAll(String schDate, String lineCode);  
32 -  
33 - /**  
34 - * 获取大于指定日期的班次信息  
35 - * @param schDate  
36 - * @return  
37 - */  
38 - @EntityGraph(value = "scheduleRealInfo_cTasks", type = EntityGraph.EntityGraphType.FETCH)  
39 - @Query("select DISTINCT s from ScheduleRealInfo s where s.scheduleDateStr>?1")  
40 - List<ScheduleRealInfo> findByDateLT(String schDate);  
41 -} 1 +package com.bsth.repository;
  2 +
  3 +import com.bsth.entity.ScheduleRealInfo;
  4 +import org.springframework.data.jpa.repository.EntityGraph;
  5 +import org.springframework.data.jpa.repository.Query;
  6 +import org.springframework.data.repository.PagingAndSortingRepository;
  7 +import org.springframework.stereotype.Repository;
  8 +
  9 +import java.util.List;
  10 +
  11 +@Repository
  12 +public interface ScheduleRealInfoRepository extends PagingAndSortingRepository<ScheduleRealInfo, Long> {
  13 +
  14 + /**
  15 + * 根据日期获取班次信息
  16 + * @param schDate
  17 + * @return
  18 + */
  19 + @EntityGraph(value = "scheduleRealInfo_cTasks", type = EntityGraph.EntityGraphType.FETCH)
  20 + @Query("select DISTINCT s from ScheduleRealInfo s where s.scheduleDateStr=?1")
  21 + List<ScheduleRealInfo> findAll(String schDate);
  22 +
  23 + /**
  24 + * 根据日期和线路编码获取班次信息
  25 + * @param schDate
  26 + * @param lineCode
  27 + * @return
  28 + */
  29 + @EntityGraph(value = "scheduleRealInfo_cTasks", type = EntityGraph.EntityGraphType.FETCH)
  30 + @Query("select DISTINCT s from ScheduleRealInfo s where s.scheduleDateStr=?1 and s.xlBm=?2")
  31 + List<ScheduleRealInfo> findAll(String schDate, String lineCode);
  32 +
  33 + /**
  34 + * 获取大于指定日期的班次信息
  35 + * @param schDate
  36 + * @return
  37 + */
  38 + @EntityGraph(value = "scheduleRealInfo_cTasks", type = EntityGraph.EntityGraphType.FETCH)
  39 + @Query("select DISTINCT s from ScheduleRealInfo s where s.scheduleDateStr>?1")
  40 + List<ScheduleRealInfo> findByDateLT(String schDate);
  41 +
  42 + /**
  43 + * 根据日期和公司编码获取班次信息
  44 + * @param schDate
  45 + * @param companyCode
  46 + * @return
  47 + */
  48 + @EntityGraph(value = "scheduleRealInfo_cTasks", type = EntityGraph.EntityGraphType.FETCH)
  49 + @Query("select DISTINCT s from ScheduleRealInfo s where s.scheduleDateStr=?1 and s.gsBm=?2 and s.updateDate>=?3")
  50 + List<ScheduleRealInfo> findByDateAndCompany(String schDate, String companyCode, long timestamp);
  51 +}
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 - * 获取全部的 车辆 和班次对照信息  
168 - *  
169 - * @param  
170 - * @return  
171 - */  
172 - @GET  
173 - @Path("/execs")  
174 - public Collection<JSONObject> execs(){  
175 - return schRealDataBuffer.execs();  
176 - }  
177 -  
178 - /**  
179 - * 获取当天指定停车场的进出场排班数据(潘钊场站VIP特供版 -高实时)  
180 - *  
181 - * @return  
182 - */  
183 - @GET  
184 - @Path("/in_out/pz_vip/{code}")  
185 - public List<ScheduleInOut> findInOut_real(@PathParam("code") String code) {  
186 - logger.info("in_out -" + code);  
187 - return ScheduleInOut.getMultiInstance(schRealDataBuffer.findByParkCode(code));  
188 - }  
189 -  
190 - @GET  
191 - @Path("/sch_jk/{company}/{rq}")  
192 - public List<ScheduleRealInfoDTO_JK> find_JK(@PathParam("company") String company, @PathParam("rq") String rq) {  
193 - List<ScheduleRealInfoDTO_JK> all = new ArrayList<>();  
194 -  
195 - List<Line> lines = LineBufferData.findByCompany(company);  
196 - for (Line line : lines) {  
197 - all.addAll(ScheduleRealInfoDTO_JK.getMultiInstance(redisService.read(rq, line.getLineCode())));  
198 - }  
199 - return all;  
200 - }  
201 -  
202 - /**  
203 - * 读取指定日期的redis 数据,计算程序调用  
204 - *  
205 - * @param rqs  
206 - * @return  
207 - */  
208 - @GET  
209 - @Path("/pz_vip/read/{rqs}")  
210 - public List<ScheduleRealInfo> read(@PathParam("rqs") String rqs) {  
211 - List<ScheduleRealInfo> all = new ArrayList<>(), rs = new ArrayList<>();  
212 - List<Line> lines = LineBufferData.findAll();  
213 - List<String> rqArray = Splitter.on(",").splitToList(rqs);  
214 -  
215 - for (Line line : lines) {  
216 - for (String rq : rqArray)  
217 - all.addAll(redisService.read(rq, line.getLineCode()));  
218 - }  
219 -  
220 - for (ScheduleRealInfo sch : all) {  
221 - if (sch.getBcType().equals("in") || sch.getBcType().equals("out") || sch.getBcType().equals("ldks"))  
222 - continue;  
223 -  
224 - //烂班,临加,有子任务的  
225 - if (sch.getStatus() == -1 || sch.isSflj() || (sch.getcTasks() != null && sch.getcTasks().size() > 0))  
226 - rs.add(sch);  
227 - }  
228 - return rs;  
229 - }  
230 -  
231 - /**  
232 - * 读取指定日期线路的redis 数据,计算程序调用  
233 - *  
234 - * @param rq  
235 - * @return  
236 - */  
237 - @GET  
238 - @Path("/pz_vip/readByRqAndLine/{rq}/{lineCode}")  
239 - public List<ScheduleRealInfo> readByLine(@PathParam("rq") String rq, @PathParam("lineCode") String lineCode) {  
240 - List<ScheduleRealInfo> all = redisService.read(rq, lineCode), rs = new ArrayList<>();  
241 -  
242 - for (ScheduleRealInfo sch : all) {  
243 - if (sch.getBcType().equals("in") || sch.getBcType().equals("out") || sch.getBcType().equals("ldks"))  
244 - continue;  
245 -  
246 - //烂班,临加,有子任务的  
247 - if (sch.getStatus() == -1 || sch.isSflj() || (sch.getcTasks() != null && sch.getcTasks().size() > 0))  
248 - rs.add(sch);  
249 - }  
250 - return rs;  
251 - }  
252 -} 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.repository.ScheduleRealInfoRepository;
  11 +import com.bsth.server_rs.base_info.line.Line;
  12 +import com.bsth.server_rs.base_info.line.buffer.LineBufferData;
  13 +import com.bsth.server_rs.schedule.dto.ScheduleCcInfoConfig;
  14 +import com.bsth.server_rs.schedule.dto.ScheduleInOut;
  15 +import com.bsth.server_rs.schedule.dto.ScheduleRealInfoDTO_JK;
  16 +import com.bsth.util.ConfigUtil;
  17 +import com.bsth.util.HttpClientUtils;
  18 +import com.google.common.base.Splitter;
  19 +import org.apache.commons.lang3.StringUtils;
  20 +import org.slf4j.Logger;
  21 +import org.slf4j.LoggerFactory;
  22 +import org.springframework.beans.factory.annotation.Autowired;
  23 +import org.springframework.stereotype.Component;
  24 +
  25 +import javax.ws.rs.*;
  26 +import javax.ws.rs.core.MediaType;
  27 +import java.net.URLEncoder;
  28 +import java.util.*;
  29 +
  30 +/**
  31 + * Created by panzhao on 2017/8/24.
  32 + */
  33 +@Component
  34 +@Path("/schedule_real")
  35 +@Produces({MediaType.APPLICATION_JSON})
  36 +public class ScheduleRealService {
  37 +
  38 + private volatile long timestamp = 0L;
  39 +
  40 + @Autowired
  41 + ScheduleRedisService redisService;
  42 +
  43 + @Autowired
  44 + SchRealDataBuffer schRealDataBuffer;
  45 +
  46 + @Autowired
  47 + private ScheduleRealInfoRepository scheduleRealInfoRepository;
  48 +
  49 + Logger logger = LoggerFactory.getLogger(this.getClass());
  50 +
  51 + static String url;
  52 + static String secretKey;
  53 +
  54 + static {
  55 + secretKey = ConfigUtil.get("http.control.secret.key");
  56 + url = ConfigUtil.get("http.control.service_data_url");// + "/execSchList?secretKey=" + secretKey;
  57 + }
  58 +
  59 + @POST
  60 + @Path("tcc_tzrc")
  61 + public Map<String, Object> tccTzrc(String jsonStr) {
  62 + JSONObject rs = new JSONObject();
  63 + try {
  64 + StringBuilder sb = HttpClientUtils.post(url + "/tccHrhc?secretKey=" + secretKey, jsonStr);
  65 +
  66 + rs = JSONObject.parseObject(sb.toString());
  67 +
  68 + if ("SUCCESS".equals(rs.get("status"))) {
  69 + rs.put("list", ScheduleInOut.getMultiInstance(JSONArray.parseArray(rs.getJSONArray("list").toJSONString(), ScheduleRealInfo.class)));
  70 + }
  71 + } catch (Exception e) {
  72 + logger.error("", e);
  73 + rs.put("status", ResponseCode.ERROR);
  74 + rs.put("msg", "接口服务器出现异常!");
  75 + }
  76 + return rs;
  77 + }
  78 +
  79 + @POST
  80 + @Path("tcc_dftz")
  81 + public Map<String, Object> tccDftz(String jsonStr) {
  82 + JSONObject rs = new JSONObject();
  83 + try {
  84 + StringBuilder sb = HttpClientUtils.post(url + "/dftzAndDestroy?secretKey=" + secretKey, jsonStr);
  85 +
  86 + rs = JSON.parseObject(sb.toString());
  87 +
  88 + if ("SUCCESS".equals(rs.get("status"))) {
  89 + rs.put("t", new ScheduleInOut(JSON.toJavaObject(JSON.parseObject(rs.get("t").toString()), ScheduleRealInfo.class)));
  90 + }
  91 + //ScheduleInOut.getMultiInstance
  92 + } catch (Exception e) {
  93 + logger.error("", e);
  94 + rs.put("status", ResponseCode.ERROR);
  95 + rs.put("msg", "接口服务器出现异常!");
  96 + }
  97 + return rs;
  98 + }
  99 +
  100 + /**
  101 + * 获取路牌下的班次信息
  102 + *
  103 + * @param lineCode
  104 + * @param lpName
  105 + * @return
  106 + */
  107 + @GET
  108 + @Path("/findByLpName/{lineCode}/{lpName}")
  109 + public List<ScheduleRealInfo> findByLpName(@PathParam("lineCode") String lineCode, @PathParam("lpName") String lpName) {
  110 + List<ScheduleRealInfo> list = new ArrayList<>();
  111 + try {
  112 + if (StringUtils.isEmpty(lineCode) || StringUtils.isEmpty(lpName))
  113 + return list;
  114 +
  115 + lpName = URLEncoder.encode(lpName, "UTF-8");
  116 + StringBuilder sb = HttpClientUtils.get(url + "/findByLpName?secretKey=" + secretKey + "&lineCode=" + lineCode + "&lpName=" + lpName);
  117 + list = JSON.parseArray(sb.toString(), ScheduleRealInfo.class);
  118 + } catch (Exception e) {
  119 + logger.error("", e);
  120 + }
  121 + return list;
  122 + }
  123 +
  124 + /**
  125 + * 获取当天指定停车场的进出场排班数据
  126 + *
  127 + * @return
  128 + */
  129 + @GET
  130 + @Path("/in_out/{code}")
  131 + public List<ScheduleInOut> findInOut(@PathParam("code") String code) {
  132 + Set<String> lineArray = BasicData.lineDateMap.keySet();
  133 +
  134 + List<ScheduleInOut> all = new ArrayList<>();
  135 + for (String lineCode : lineArray) {
  136 + all.addAll(ScheduleInOut.getMultiInstance(redisService.read(BasicData.lineDateMap.get(lineCode), lineCode), code));
  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 + * 获取全部的 车辆 和班次对照信息
  174 + *
  175 + * @param
  176 + * @return
  177 + */
  178 + @GET
  179 + @Path("/execs")
  180 + public Collection<JSONObject> execs(){
  181 + return schRealDataBuffer.execs();
  182 + }
  183 +
  184 + /**
  185 + * 获取当天指定停车场的进出场排班数据(潘钊场站VIP特供版 -高实时)
  186 + *
  187 + * @return
  188 + */
  189 + @GET
  190 + @Path("/in_out/pz_vip/{code}")
  191 + public List<ScheduleInOut> findInOut_real(@PathParam("code") String code) {
  192 + logger.info("in_out -" + code);
  193 + return ScheduleInOut.getMultiInstance(schRealDataBuffer.findByParkCode(code));
  194 + }
  195 +
  196 + @GET
  197 + @Path("/sch_jk/{company}/{rq}")
  198 + public List<ScheduleRealInfoDTO_JK> find_JK(@PathParam("company") String company, @PathParam("rq") String rq) {
  199 + List<ScheduleRealInfoDTO_JK> all = new ArrayList<>();
  200 +
  201 + List<Line> lines = LineBufferData.findByCompany(company);
  202 + for (Line line : lines) {
  203 + all.addAll(ScheduleRealInfoDTO_JK.getMultiInstance(redisService.read(rq, line.getLineCode())));
  204 + }
  205 + return all;
  206 + }
  207 +
  208 + @GET
  209 + @Path("/sch_jk4modify/{company}/{rq}")
  210 + public List<ScheduleRealInfoDTO_JK> sch_jk4modify(@PathParam("company") String company, @PathParam("rq") String rq) {
  211 + List<ScheduleRealInfoDTO_JK> result = ScheduleRealInfoDTO_JK.getMultiInstance(scheduleRealInfoRepository.findByDateAndCompany(rq, company, timestamp));
  212 + timestamp = System.currentTimeMillis();
  213 +
  214 + return result;
  215 + }
  216 +
  217 + /**
  218 + * 读取指定日期的redis 数据,计算程序调用
  219 + *
  220 + * @param rqs
  221 + * @return
  222 + */
  223 + @GET
  224 + @Path("/pz_vip/read/{rqs}")
  225 + public List<ScheduleRealInfo> read(@PathParam("rqs") String rqs) {
  226 + List<ScheduleRealInfo> all = new ArrayList<>(), rs = new ArrayList<>();
  227 + List<Line> lines = LineBufferData.findAll();
  228 + List<String> rqArray = Splitter.on(",").splitToList(rqs);
  229 +
  230 + for (Line line : lines) {
  231 + for (String rq : rqArray)
  232 + all.addAll(redisService.read(rq, line.getLineCode()));
  233 + }
  234 +
  235 + for (ScheduleRealInfo sch : all) {
  236 + if (sch.getBcType().equals("in") || sch.getBcType().equals("out") || sch.getBcType().equals("ldks"))
  237 + continue;
  238 +
  239 + //烂班,临加,有子任务的
  240 + if (sch.getStatus() == -1 || sch.isSflj() || (sch.getcTasks() != null && sch.getcTasks().size() > 0))
  241 + rs.add(sch);
  242 + }
  243 + return rs;
  244 + }
  245 +
  246 + /**
  247 + * 读取指定日期线路的redis 数据,计算程序调用
  248 + *
  249 + * @param rq
  250 + * @return
  251 + */
  252 + @GET
  253 + @Path("/pz_vip/readByRqAndLine/{rq}/{lineCode}")
  254 + public List<ScheduleRealInfo> readByLine(@PathParam("rq") String rq, @PathParam("lineCode") String lineCode) {
  255 + List<ScheduleRealInfo> all = redisService.read(rq, lineCode), rs = new ArrayList<>();
  256 +
  257 + for (ScheduleRealInfo sch : all) {
  258 + if (sch.getBcType().equals("in") || sch.getBcType().equals("out") || sch.getBcType().equals("ldks"))
  259 + continue;
  260 +
  261 + //烂班,临加,有子任务的
  262 + if (sch.getStatus() == -1 || sch.isSflj() || (sch.getcTasks() != null && sch.getcTasks().size() > 0))
  263 + rs.add(sch);
  264 + }
  265 + return rs;
  266 + }
  267 +}