作者 王勇

提交,做备份

... ... @@ -6,9 +6,12 @@ import com.sunyo.wlpt.cgonms.provide.domain.*;
import com.sunyo.wlpt.cgonms.provide.feign.GetCgoAsmFeign;
import com.sunyo.wlpt.cgonms.provide.feign.GetDataWareHouseFeign;
import com.sunyo.wlpt.cgonms.provide.feign.GetTransportFeign;
import com.sunyo.wlpt.cgonms.provide.response.ResultJson;
import com.sunyo.wlpt.cgonms.provide.service.*;
import com.sunyo.wlpt.cgonms.provide.thread.ExitThreadPoolFactory;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.propertyeditors.CustomDateEditor;
import org.springframework.web.bind.WebDataBinder;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
... ... @@ -76,13 +79,15 @@ public class NmsController {
* @return {@link ResultExitData}
*/
@GetMapping("/getInfo")
public List<ResultExitData> getData(
public ResultJson getData(
@RequestParam(value = "flightDate", required = false) Date flightDate,
@RequestParam(value = "flightNo", required = false) String flightNo) {
final String startTime = sdf.format(new Date());
System.out.println("开始时间:" + startTime);
System.out.println("出港数据,开始获取");
ResultJson resultJson = new ResultJson();
/**
* 查询出新舱单里面回执表里面的数据条件
*/
... ... @@ -145,7 +150,9 @@ public class NmsController {
System.out.println("结束时间:" + endTime);
System.out.println("出港信息,获取完毕");
System.out.println("index的值为:" + index);
return resultList;
resultJson.setCode("200");
resultJson.setData(resultList);
return resultJson;
}
/**
... ... @@ -265,5 +272,10 @@ public class NmsController {
return result;
}
@InitBinder
public void initBinder(WebDataBinder binder) {
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
dateFormat.setLenient(false);
binder.registerCustomEditor(Date.class, new CustomDateEditor(dateFormat, true));
}
}
... ...
package com.sunyo.wlpt.cgonms.provide.response;
import lombok.Data;
import java.io.Serializable;
import java.util.List;
/**
* @author 子诚
* Description:返回结果封装类
* 时间:2020/4/24 10:06
*/
@Data
public class ResultJson<T> implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 响应业务状态,默认为200
*/
private String code = "200";
/**
* 响应消息
*/
private String msg = "";
private String error;
/**
* 响应数据
*/
private T data;
/**
* JWT令牌
*/
private String jwtToken;
/**
* 无参,构造方法
*/
public ResultJson() {
}
/**
* 有参,构造方法;
* 重载
*/
public ResultJson(String code) {
this.code = code;
}
public ResultJson(T data) {
this.data = data;
}
public ResultJson(String code, String msg) {
this.code = code;
this.msg = msg;
}
public ResultJson(String code, String msg, T data) {
this.code = code;
this.msg = msg;
this.data = data;
}
}
... ...