正在显示
5 个修改的文件
包含
108 行增加
和
76 行删除
| 1 | package com.sunyo.wlpt.cgonms.provide.controller; | 1 | package com.sunyo.wlpt.cgonms.provide.controller; | 
| 2 | 2 | ||
| 3 | import com.sunyo.wlpt.cgonms.provide.domain.*; | 3 | import com.sunyo.wlpt.cgonms.provide.domain.*; | 
| 4 | +import com.sunyo.wlpt.cgonms.provide.feign.GetCgoAsmFeign; | ||
| 4 | import com.sunyo.wlpt.cgonms.provide.service.*; | 5 | import com.sunyo.wlpt.cgonms.provide.service.*; | 
| 5 | import org.springframework.web.bind.annotation.*; | 6 | import org.springframework.web.bind.annotation.*; | 
| 6 | 7 | ||
| @@ -33,6 +34,9 @@ public class CgoNmsController { | @@ -33,6 +34,9 @@ public class CgoNmsController { | ||
| 33 | @Resource | 34 | @Resource | 
| 34 | private BasAreaService basAreaService; | 35 | private BasAreaService basAreaService; | 
| 35 | 36 | ||
| 37 | + @Resource | ||
| 38 | + private GetCgoAsmFeign getCgoAsmFeign; | ||
| 39 | + | ||
| 36 | /** | 40 | /** | 
| 37 | * 根据航班日期获取出新舱单服务中的响应数据 | 41 | * 根据航班日期获取出新舱单服务中的响应数据 | 
| 38 | * | 42 | * | 
| @@ -43,7 +47,6 @@ public class CgoNmsController { | @@ -43,7 +47,6 @@ public class CgoNmsController { | ||
| 43 | public List<ResultExitData> getData( | 47 | public List<ResultExitData> getData( | 
| 44 | @RequestParam(value = "flightDate", required = false) Date flightDate, | 48 | @RequestParam(value = "flightDate", required = false) Date flightDate, | 
| 45 | @RequestParam(value = "flightNo", required = false) String flightNo) { | 49 | @RequestParam(value = "flightNo", required = false) String flightNo) { | 
| 46 | - | ||
| 47 | //设置查询条件 | 50 | //设置查询条件 | 
| 48 | ResultExitData resultExitData = new ResultExitData(); | 51 | ResultExitData resultExitData = new ResultExitData(); | 
| 49 | resultExitData.setFlightDate(flightDate); | 52 | resultExitData.setFlightDate(flightDate); | 
| @@ -57,9 +60,6 @@ public class CgoNmsController { | @@ -57,9 +60,6 @@ public class CgoNmsController { | ||
| 57 | */ | 60 | */ | 
| 58 | 61 | ||
| 59 | List<ResultExitData> resultList = resultExitDataService.getResultExitDataInfo(resultExitData); | 62 | List<ResultExitData> resultList = resultExitDataService.getResultExitDataInfo(resultExitData); | 
| 60 | - //取出resultList的长度,不必每次都判断 | ||
| 61 | - Date startT=new Date(); | ||
| 62 | - //遍历获取出所有需要的信息 | ||
| 63 | for (int i = 0, resultSize = resultList.size(); i < resultSize; i++) { | 63 | for (int i = 0, resultSize = resultList.size(); i < resultSize; i++) { | 
| 64 | ResultExitData result = resultList.get(i); | 64 | ResultExitData result = resultList.get(i); | 
| 65 | //设置航班 | 65 | //设置航班 | 
| @@ -104,19 +104,18 @@ public class CgoNmsController { | @@ -104,19 +104,18 @@ public class CgoNmsController { | ||
| 104 | * 航班目的站 | 104 | * 航班目的站 | 
| 105 | */ | 105 | */ | 
| 106 | List<PrepareMaster> pm = prepareMasterService.getPrepareMasterInfo(result.getWaybillNoMaster()); | 106 | List<PrepareMaster> pm = prepareMasterService.getPrepareMasterInfo(result.getWaybillNoMaster()); | 
| 107 | - if (pm == null) { | ||
| 108 | - continue; | 107 | + if (pm != null && pm.size() > 0) { | 
| 108 | + //发货人名称 | ||
| 109 | + result.setShipperName(pm.get(0).getShipperName()); | ||
| 110 | + //收货人名称 | ||
| 111 | + result.setConsigneeName(pm.get(0).getConsigneeName()); | ||
| 112 | + //获取目的货物目的站 | ||
| 113 | + result.setAimStation(pm.get(0).getDestinationStation()); | ||
| 109 | } | 114 | } | 
| 110 | - //发货人名称 | ||
| 111 | - result.setShipperName(pm.get(0).getShipperName()); | ||
| 112 | - //收货人名称 | ||
| 113 | - result.setConsigneeName(pm.get(0).getConsigneeName()); | ||
| 114 | - //获取目的货物目的站 | ||
| 115 | - result.setAimStation(pm.get(0).getDestinationStation()); | ||
| 116 | } | 115 | } | 
| 117 | - Date endT=new Date(); | ||
| 118 | - System.out.println(startT); | ||
| 119 | - System.out.println(endT); | ||
| 120 | - return resultList; | 116 | + System.out.println("新舱单服务,获取完毕"); | 
| 117 | + List<ResultExitData> info = getCgoAsmFeign.getInfo(resultList); | ||
| 118 | + System.out.println("代理人服务,获取完毕"); | ||
| 119 | + return info; | ||
| 121 | } | 120 | } | 
| 122 | } | 121 | } | 
| 1 | package com.sunyo.wlpt.cgonms.provide.domain; | 1 | package com.sunyo.wlpt.cgonms.provide.domain; | 
| 2 | 2 | ||
| 3 | -import java.io.Serializable; | ||
| 4 | -import java.util.Date; | ||
| 5 | - | ||
| 6 | import com.fasterxml.jackson.annotation.JsonFormat; | 3 | import com.fasterxml.jackson.annotation.JsonFormat; | 
| 7 | import lombok.AllArgsConstructor; | 4 | import lombok.AllArgsConstructor; | 
| 8 | import lombok.Data; | 5 | import lombok.Data; | 
| 9 | import lombok.NoArgsConstructor; | 6 | import lombok.NoArgsConstructor; | 
| 10 | 7 | ||
| 8 | +import java.io.Serializable; | ||
| 9 | +import java.util.Date; | ||
| 10 | + | ||
| 11 | /** | 11 | /** | 
| 12 | * @author 子诚 | 12 | * @author 子诚 | 
| 13 | * Description:实体类:新舱单——理货信息.最终返回结果类 | 13 | * Description:实体类:新舱单——理货信息.最终返回结果类 | 
| @@ -21,120 +21,105 @@ public class ResultExitData implements Serializable { | @@ -21,120 +21,105 @@ public class ResultExitData implements Serializable { | ||
| 21 | private static final long serialVersionUID = -260680809813827352L; | 21 | private static final long serialVersionUID = -260680809813827352L; | 
| 22 | 22 | ||
| 23 | /** | 23 | /** | 
| 24 | - * id | 24 | + * 1.id | 
| 25 | */ | 25 | */ | 
| 26 | private String autoId; | 26 | private String autoId; | 
| 27 | 27 | ||
| 28 | /** | 28 | /** | 
| 29 | - * 运单号 | 29 | + * 2.运单号 | 
| 30 | */ | 30 | */ | 
| 31 | private String waybillNoMaster; | 31 | private String waybillNoMaster; | 
| 32 | 32 | ||
| 33 | /** | 33 | /** | 
| 34 | - * 航班号 | 34 | + * 3.航班号 | 
| 35 | */ | 35 | */ | 
| 36 | private String flightNo; | 36 | private String flightNo; | 
| 37 | 37 | ||
| 38 | /** | 38 | /** | 
| 39 | - * 航班日期 | 39 | + * 4.航班日期 | 
| 40 | */ | 40 | */ | 
| 41 | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") | 41 | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") | 
| 42 | private Date flightDate; | 42 | private Date flightDate; | 
| 43 | 43 | ||
| 44 | /** | 44 | /** | 
| 45 | - * 航段 | 45 | + * 5.航段 | 
| 46 | */ | 46 | */ | 
| 47 | private String segment; | 47 | private String segment; | 
| 48 | 48 | ||
| 49 | /** | 49 | /** | 
| 50 | - * 航班起始站 | 50 | + * 6.航班起始站 | 
| 51 | */ | 51 | */ | 
| 52 | private String originatingStation; | 52 | private String originatingStation; | 
| 53 | 53 | ||
| 54 | /** | 54 | /** | 
| 55 | - * 航班目的站 | 55 | + * 7.航班目的站 | 
| 56 | */ | 56 | */ | 
| 57 | private String destinationStation; | 57 | private String destinationStation; | 
| 58 | 58 | ||
| 59 | /** | 59 | /** | 
| 60 | - * 理货件数 | 60 | + * 8.理货件数 | 
| 61 | */ | 61 | */ | 
| 62 | private String tallyTotalPiece; | 62 | private String tallyTotalPiece; | 
| 63 | 63 | ||
| 64 | /** | 64 | /** | 
| 65 | - * 理货重量 | 65 | + * 9.理货重量 | 
| 66 | */ | 66 | */ | 
| 67 | private String tallyTotalWeight; | 67 | private String tallyTotalWeight; | 
| 68 | 68 | ||
| 69 | /** | 69 | /** | 
| 70 | - * 承运人二字码 | 70 | + * 10.承运人二字码 | 
| 71 | */ | 71 | */ | 
| 72 | private String carrier; | 72 | private String carrier; | 
| 73 | 73 | ||
| 74 | /** | 74 | /** | 
| 75 | - * 发货人名称 | 75 | + * 11.发货人名称 | 
| 76 | */ | 76 | */ | 
| 77 | private String shipperName; | 77 | private String shipperName; | 
| 78 | 78 | ||
| 79 | /** | 79 | /** | 
| 80 | - * 收货人名称 | 80 | + * 12.收货人名称 | 
| 81 | */ | 81 | */ | 
| 82 | private String consigneeName; | 82 | private String consigneeName; | 
| 83 | 83 | ||
| 84 | /** | 84 | /** | 
| 85 | - * 货物目的站 | 85 | + * 13.货物目的站 | 
| 86 | */ | 86 | */ | 
| 87 | private String aimStation; | 87 | private String aimStation; | 
| 88 | /** | 88 | /** | 
| 89 | - * 国家代码 | 89 | + * 14.国家代码 | 
| 90 | */ | 90 | */ | 
| 91 | private String country; | 91 | private String country; | 
| 92 | 92 | ||
| 93 | /** | 93 | /** | 
| 94 | - * 航班目的区域,中文描述,所属洲 | 94 | + * 15.航班目的区域,中文描述,所属洲 | 
| 95 | */ | 95 | */ | 
| 96 | private String areaDescChn; | 96 | private String areaDescChn; | 
| 97 | 97 | ||
| 98 | -// private String tcdName; | ||
| 99 | -// | ||
| 100 | -// private String tcdTypeCode; | ||
| 101 | -// | ||
| 102 | -// private String tallType; | ||
| 103 | -// | ||
| 104 | -// private String oName; | ||
| 105 | -// | ||
| 106 | -// private String fdName; | ||
| 107 | -// | ||
| 108 | -// private String totalWeight; | ||
| 109 | -// | ||
| 110 | -// private String totalGrossWeightMeasureuc; | ||
| 111 | -// | ||
| 112 | -// private String totalPiece; | ||
| 113 | -// | ||
| 114 | -// private String grossWeightMeasureuc; | ||
| 115 | -// | ||
| 116 | -// private Date loadStartTime; | ||
| 117 | -// | ||
| 118 | -// private Date loadEndTime; | ||
| 119 | -// | ||
| 120 | -// private String status; | ||
| 121 | -// | ||
| 122 | -// private String customsCode; | ||
| 123 | -// | ||
| 124 | -// private String productName; | ||
| 125 | -// | ||
| 126 | -// private String receiptInformation; | ||
| 127 | -// | ||
| 128 | -// private Date createDate; | ||
| 129 | -// | ||
| 130 | -// private String dealFlag; | ||
| 131 | -// | ||
| 132 | -// private String billTallyFlag; | ||
| 133 | -// | ||
| 134 | -// private Date dealTime; | ||
| 135 | -// | ||
| 136 | -// private Date dischargeDate; | ||
| 137 | -// | ||
| 138 | -// private String transportSplitDescription; | 98 | + /** | 
| 99 | + * 16.代理人全称 | ||
| 100 | + */ | ||
| 101 | + private String fullName; | ||
| 139 | 102 | ||
| 103 | + /** | ||
| 104 | + * 17.货主类型 | ||
| 105 | + * 111 = 发货代理 | ||
| 106 | + * 222 = 订舱代理 | ||
| 107 | + * 333 = 操作代理/结算代理 | ||
| 108 | + */ | ||
| 109 | + private String theShipperType; | ||
| 110 | + | ||
| 111 | + /** | ||
| 112 | + * 18.品名 | ||
| 113 | + */ | ||
| 114 | + private String sdCargoName; | ||
| 115 | + | ||
| 116 | + /** | ||
| 117 | + * 19.二级类名称 | ||
| 118 | + */ | ||
| 119 | + private String twoTypeName; | ||
| 120 | + | ||
| 121 | + /** | ||
| 122 | + * 20.一级类名称 | ||
| 123 | + */ | ||
| 124 | + private String typeName; | ||
| 140 | } | 125 | } | 
| 1 | +package com.sunyo.wlpt.cgonms.provide.feign; | ||
| 2 | + | ||
| 3 | +import com.sunyo.wlpt.cgonms.provide.domain.ResultExitData; | ||
| 4 | +import org.springframework.stereotype.Service; | ||
| 5 | + | ||
| 6 | +import java.util.List; | ||
| 7 | + | ||
| 8 | +/** | ||
| 9 | + * @author 子诚 | ||
| 10 | + * Description: | ||
| 11 | + * 时间:2020/5/22 9:14 | ||
| 12 | + */ | ||
| 13 | + | ||
| 14 | +@Service | ||
| 15 | +public class GetCgoAsmFeginHystrix implements GetCgoAsmFeign{ | ||
| 16 | + | ||
| 17 | + @Override | ||
| 18 | + public List<ResultExitData> getInfo(List<ResultExitData> resultList) { | ||
| 19 | + System.out.println("与代理人服务断开连接,获取代理人服务信息失败"); | ||
| 20 | + return null; | ||
| 21 | + } | ||
| 22 | +} | 
| 1 | +package com.sunyo.wlpt.cgonms.provide.feign; | ||
| 2 | + | ||
| 3 | +import com.sunyo.wlpt.cgonms.provide.domain.ResultExitData; | ||
| 4 | +import org.springframework.cloud.openfeign.FeignClient; | ||
| 5 | +import org.springframework.stereotype.Component; | ||
| 6 | +import org.springframework.web.bind.annotation.PutMapping; | ||
| 7 | +import org.springframework.web.bind.annotation.RequestBody; | ||
| 8 | + | ||
| 9 | +import java.util.List; | ||
| 10 | + | ||
| 11 | +/** | ||
| 12 | + * @author 子诚 | ||
| 13 | + * Description: | ||
| 14 | + * 时间:2020/5/21 17:43 | ||
| 15 | + */ | ||
| 16 | +@Component | ||
| 17 | +@FeignClient(value = "cgoasm-provide", fallback = GetCgoAsmFeginHystrix.class) | ||
| 18 | +public interface GetCgoAsmFeign { | ||
| 19 | + @PutMapping("/cgoasm/getInfo") | ||
| 20 | + List<ResultExitData> getInfo(@RequestBody List<ResultExitData> resultList); | ||
| 21 | +} | 
| @@ -62,7 +62,12 @@ eureka: | @@ -62,7 +62,12 @@ eureka: | ||
| 62 | 62 | ||
| 63 | feign: | 63 | feign: | 
| 64 | hystrix: | 64 | hystrix: | 
| 65 | - enabled: true | 65 | + enabled: false | 
| 66 | + client: | ||
| 67 | + config: | ||
| 68 | + default: | ||
| 69 | + connectTimeout: 300000 # feign 的超时设置 | ||
| 70 | + readTimeout: 180000 | ||
| 66 | # boot admin | 71 | # boot admin | 
| 67 | management: | 72 | management: | 
| 68 | endpoints: | 73 | endpoints: | 
- 
请 注册 或 登录 后发表评论
