作者 王勇

逻辑修改,减少for循环。关闭熔断器与超时

@@ -37,30 +37,23 @@ public class CgoAsmController { @@ -37,30 +37,23 @@ public class CgoAsmController {
37 /** 37 /**
38 * 根据运单号,获取,代理人服务中的相关数据 38 * 根据运单号,获取,代理人服务中的相关数据
39 * 39 *
40 - * @param resultList {@link ResultExitData} 40 + * @param waybillNoMaster 运单号
41 * @return 41 * @return
42 */ 42 */
43 - @PutMapping("/getInfo")  
44 - public List<ResultExitData> getInfo(@RequestBody List<ResultExitData> resultList) {  
45 - System.out.println("开始调用代理人服务");  
46 - System.out.println("长度为" + resultList.size());  
47 - for (int i = 0, resultSize = resultList.size(); i < resultSize; i++) {  
48 - ResultExitData result = resultList.get(i);  
49 - System.out.println(i + "运单号" + result.getWaybillNoMaster()); 43 + @GetMapping("/getInfo")
  44 + public ResultExitData getInfo(@RequestParam(value = "waybillNoMaster", required = false)String waybillNoMaster) {
  45 + ResultExitData result = new ResultExitData();
50 /** 46 /**
51 * 2.根据运单号,获取品名,二级品类,一级品类 47 * 2.根据运单号,获取品名,二级品类,一级品类
52 */ 48 */
53 - System.out.println(i + "品名");  
54 - List<SdCargoName> sd = sdCargoNameService.getSdCargoName(result.getWaybillNoMaster()); 49 + List<SdCargoName> sd = sdCargoNameService.getSdCargoName(waybillNoMaster);
55 if (sd != null && sd.size() > 0) { 50 if (sd != null && sd.size() > 0) {
56 // 品名 51 // 品名
57 result.setSdCargoName(sd.get(0).getSdCargoName()); 52 result.setSdCargoName(sd.get(0).getSdCargoName());
58 - System.out.println(i + "二级品类");  
59 List<SdTwoType> twoType = sdTwoTypeService.getSdTwoTypeInfo(sd.get(0).getSdCargoName()); 53 List<SdTwoType> twoType = sdTwoTypeService.getSdTwoTypeInfo(sd.get(0).getSdCargoName());
60 if (twoType != null && twoType.size() > 0) { 54 if (twoType != null && twoType.size() > 0) {
61 // 二级品类名称 55 // 二级品类名称
62 result.setTwoTypeName(twoType.get(0).getTwoTypeName()); 56 result.setTwoTypeName(twoType.get(0).getTwoTypeName());
63 - System.out.println(i + "一级品类");  
64 List<SdBigType> big = sdBigTypeService.getSdBigTypeInfo(twoType.get(0).getBigTypeId()); 57 List<SdBigType> big = sdBigTypeService.getSdBigTypeInfo(twoType.get(0).getBigTypeId());
65 if (big != null && big.size() > 0) { 58 if (big != null && big.size() > 0) {
66 // 一级品类 59 // 一级品类
@@ -71,7 +64,7 @@ public class CgoAsmController { @@ -71,7 +64,7 @@ public class CgoAsmController {
71 /** 64 /**
72 * 1.根据运单号,获取货主信息表ID,最终获取:代理人名称,代理人类型 65 * 1.根据运单号,获取货主信息表ID,最终获取:代理人名称,代理人类型
73 */ 66 */
74 - List<HzWaybillInfo> hz = hzWaybillInfoService.getHzWaybillInfo(result.getWaybillNoMaster()); 67 + List<HzWaybillInfo> hz = hzWaybillInfoService.getHzWaybillInfo(waybillNoMaster);
75 if (hz != null && hz.size() > 0) { 68 if (hz != null && hz.size() > 0) {
76 HzShipperInformation hzInfo = hzShipperInformationService.getHzInfo(hz.get(0).getHzInforId()); 69 HzShipperInformation hzInfo = hzShipperInformationService.getHzInfo(hz.get(0).getHzInforId());
77 //设置代理人名称 70 //设置代理人名称
@@ -79,7 +72,6 @@ public class CgoAsmController { @@ -79,7 +72,6 @@ public class CgoAsmController {
79 //设置代理人类型 72 //设置代理人类型
80 result.setTheShipperType(hzInfo.getTheShipperType()); 73 result.setTheShipperType(hzInfo.getTheShipperType());
81 } 74 }
82 - }  
83 - return resultList; 75 + return result;
84 } 76 }
85 } 77 }
1 package com.sunyo.wlpt.cgoasm.provide.service; 1 package com.sunyo.wlpt.cgoasm.provide.service;
2 2
3 import com.sunyo.wlpt.cgoasm.provide.domain.HzShipperInformation; 3 import com.sunyo.wlpt.cgoasm.provide.domain.HzShipperInformation;
  4 +import org.springframework.transaction.annotation.Transactional;
4 5
5 /** 6 /**
6 * @author 子诚 7 * @author 子诚
7 * Description: 8 * Description:
8 * 时间:2020/5/21 12:04 9 * 时间:2020/5/21 12:04
9 */ 10 */
  11 +
10 public interface HzShipperInformationService { 12 public interface HzShipperInformationService {
11 13
12 /** 14 /**