作者 王勇

逻辑修改,减少for循环

... ... @@ -34,37 +34,38 @@ public class TransportController {
* 根据承运人二字码、航班号、航班日期,获取,运输工具服务中的相关数据
* 航空公司、机型、机号、实际起飞时间、计划起飞时间
*
* @param resultList {@link ResultExitData}
* @param flightNo 航班号
* @param flightDate 航班日期
* @return
*/
@PutMapping("/getInfo")
public List<ResultExitData> getInfo(@RequestBody List<ResultExitData> resultList) {
@GetMapping("/getInfo")
public ResultExitData getInfo(@RequestParam(value = "flightNo", required = false) String flightNo,
@RequestParam(value = "flightDate", required = false) Date flightDate) {
ResultExitData result = new ResultExitData();
System.out.println("开始调用:运输工具服务");
System.out.println("长度为" + resultList.size());
for (int i = 0, resultSize = resultList.size(); i < resultSize; i++) {
ResultExitData result = resultList.get(i);
System.out.println(i + "运单号" + result.getWaybillNoMaster());
List<FlightDfDl> fd = flightDfDlService.getFlightDfDlInfo(result);
if (fd != null && fd.size() > 0) {
//机型
result.setCfTp(fd.get(0).getCfTp());
//机号
result.setCfNo(fd.get(0).getCfNo());
//航班计划日期,直接设置为航班日期的值
result.setFlightPlanDate(result.getFlightDate());
List<DePeAir> dePeAirs = dePeAirService.getDePeAirInfo(fd.get(0).getFlId());
if (dePeAirs != null && dePeAirs.size() > 0) {
//航班公司
result.setAirCompany(dePeAirs.get(0).getFfId().substring(0, 2));
//航班实际起飞时间(航班时间)
result.setFlightTime(dePeAirs.get(0).getFrTt());
//航班计划时间,直接设置为航班时间
result.setFlightPlanTime(dePeAirs.get(0).getFrTt());
}
ResultExitData params = new ResultExitData();
params.setCarrier(flightNo.substring(0, 2));
params.setFlightDate(flightDate);
params.setFlightNo(flightNo);
List<FlightDfDl> fd = flightDfDlService.getFlightDfDlInfo(params);
if (fd != null && fd.size() > 0) {
//机型
result.setCfTp(fd.get(0).getCfTp());
//机号
result.setCfNo(fd.get(0).getCfNo());
//航班计划日期,直接设置为航班日期的值
result.setFlightPlanDate(flightDate);
List<DePeAir> dePeAirs = dePeAirService.getDePeAirInfo(fd.get(0).getFlId());
if (dePeAirs != null && dePeAirs.size() > 0) {
//航班公司
result.setAirCompany(dePeAirs.get(0).getFfId().substring(0, 2));
//航班实际起飞时间(航班时间)
result.setFlightTime(dePeAirs.get(0).getFrTt());
//航班计划时间,直接设置为航班时间
result.setFlightPlanTime(dePeAirs.get(0).getFrTt());
}
}
System.out.println("完成调用:运输工具服务");
return resultList;
return result;
}
}
... ...