作者 王勇

提交,做备份

@@ -6,9 +6,12 @@ import com.sunyo.wlpt.cgonms.provide.domain.*; @@ -6,9 +6,12 @@ import com.sunyo.wlpt.cgonms.provide.domain.*;
6 import com.sunyo.wlpt.cgonms.provide.feign.GetCgoAsmFeign; 6 import com.sunyo.wlpt.cgonms.provide.feign.GetCgoAsmFeign;
7 import com.sunyo.wlpt.cgonms.provide.feign.GetDataWareHouseFeign; 7 import com.sunyo.wlpt.cgonms.provide.feign.GetDataWareHouseFeign;
8 import com.sunyo.wlpt.cgonms.provide.feign.GetTransportFeign; 8 import com.sunyo.wlpt.cgonms.provide.feign.GetTransportFeign;
  9 +import com.sunyo.wlpt.cgonms.provide.response.ResultJson;
9 import com.sunyo.wlpt.cgonms.provide.service.*; 10 import com.sunyo.wlpt.cgonms.provide.service.*;
10 import com.sunyo.wlpt.cgonms.provide.thread.ExitThreadPoolFactory; 11 import com.sunyo.wlpt.cgonms.provide.thread.ExitThreadPoolFactory;
11 import lombok.extern.slf4j.Slf4j; 12 import lombok.extern.slf4j.Slf4j;
  13 +import org.springframework.beans.propertyeditors.CustomDateEditor;
  14 +import org.springframework.web.bind.WebDataBinder;
12 import org.springframework.web.bind.annotation.*; 15 import org.springframework.web.bind.annotation.*;
13 16
14 import javax.annotation.Resource; 17 import javax.annotation.Resource;
@@ -76,13 +79,15 @@ public class NmsController { @@ -76,13 +79,15 @@ public class NmsController {
76 * @return {@link ResultExitData} 79 * @return {@link ResultExitData}
77 */ 80 */
78 @GetMapping("/getInfo") 81 @GetMapping("/getInfo")
79 - public List<ResultExitData> getData( 82 + public ResultJson getData(
80 @RequestParam(value = "flightDate", required = false) Date flightDate, 83 @RequestParam(value = "flightDate", required = false) Date flightDate,
81 @RequestParam(value = "flightNo", required = false) String flightNo) { 84 @RequestParam(value = "flightNo", required = false) String flightNo) {
82 85
83 final String startTime = sdf.format(new Date()); 86 final String startTime = sdf.format(new Date());
84 System.out.println("开始时间:" + startTime); 87 System.out.println("开始时间:" + startTime);
85 System.out.println("出港数据,开始获取"); 88 System.out.println("出港数据,开始获取");
  89 + ResultJson resultJson = new ResultJson();
  90 +
86 /** 91 /**
87 * 查询出新舱单里面回执表里面的数据条件 92 * 查询出新舱单里面回执表里面的数据条件
88 */ 93 */
@@ -145,7 +150,9 @@ public class NmsController { @@ -145,7 +150,9 @@ public class NmsController {
145 System.out.println("结束时间:" + endTime); 150 System.out.println("结束时间:" + endTime);
146 System.out.println("出港信息,获取完毕"); 151 System.out.println("出港信息,获取完毕");
147 System.out.println("index的值为:" + index); 152 System.out.println("index的值为:" + index);
148 - return resultList; 153 + resultJson.setCode("200");
  154 + resultJson.setData(resultList);
  155 + return resultJson;
149 } 156 }
150 157
151 /** 158 /**
@@ -265,5 +272,10 @@ public class NmsController { @@ -265,5 +272,10 @@ public class NmsController {
265 return result; 272 return result;
266 } 273 }
267 274
268 - 275 + @InitBinder
  276 + public void initBinder(WebDataBinder binder) {
  277 + SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
  278 + dateFormat.setLenient(false);
  279 + binder.registerCustomEditor(Date.class, new CustomDateEditor(dateFormat, true));
  280 + }
269 } 281 }
  1 +package com.sunyo.wlpt.cgonms.provide.response;
  2 +
  3 +import lombok.Data;
  4 +
  5 +import java.io.Serializable;
  6 +import java.util.List;
  7 +
  8 +/**
  9 + * @author 子诚
  10 + * Description:返回结果封装类
  11 + * 时间:2020/4/24 10:06
  12 + */
  13 +@Data
  14 +public class ResultJson<T> implements Serializable {
  15 +
  16 + private static final long serialVersionUID = 1L;
  17 +
  18 + /**
  19 + * 响应业务状态,默认为200
  20 + */
  21 + private String code = "200";
  22 +
  23 + /**
  24 + * 响应消息
  25 + */
  26 + private String msg = "";
  27 +
  28 + private String error;
  29 +
  30 + /**
  31 + * 响应数据
  32 + */
  33 + private T data;
  34 +
  35 + /**
  36 + * JWT令牌
  37 + */
  38 + private String jwtToken;
  39 +
  40 + /**
  41 + * 无参,构造方法
  42 + */
  43 + public ResultJson() {
  44 + }
  45 +
  46 + /**
  47 + * 有参,构造方法;
  48 + * 重载
  49 + */
  50 + public ResultJson(String code) {
  51 + this.code = code;
  52 + }
  53 +
  54 + public ResultJson(T data) {
  55 + this.data = data;
  56 + }
  57 +
  58 + public ResultJson(String code, String msg) {
  59 + this.code = code;
  60 + this.msg = msg;
  61 + }
  62 +
  63 + public ResultJson(String code, String msg, T data) {
  64 + this.code = code;
  65 + this.msg = msg;
  66 + this.data = data;
  67 + }
  68 +}