作者 王勇

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

@@ -37,49 +37,41 @@ public class CgoAsmController { @@ -37,49 +37,41 @@ 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());  
50 - /**  
51 - * 2.根据运单号,获取品名,二级品类,一级品类  
52 - */  
53 - System.out.println(i + "品名");  
54 - List<SdCargoName> sd = sdCargoNameService.getSdCargoName(result.getWaybillNoMaster());  
55 - if (sd != null && sd.size() > 0) {  
56 - // 品名  
57 - result.setSdCargoName(sd.get(0).getSdCargoName());  
58 - System.out.println(i + "二级品类");  
59 - List<SdTwoType> twoType = sdTwoTypeService.getSdTwoTypeInfo(sd.get(0).getSdCargoName());  
60 - if (twoType != null && twoType.size() > 0) {  
61 - // 二级品类名称  
62 - result.setTwoTypeName(twoType.get(0).getTwoTypeName());  
63 - System.out.println(i + "一级品类");  
64 - List<SdBigType> big = sdBigTypeService.getSdBigTypeInfo(twoType.get(0).getBigTypeId());  
65 - if (big != null && big.size() > 0) {  
66 - // 一级品类  
67 - result.setTypeName(big.get(0).getTypeName());  
68 - } 43 + @GetMapping("/getInfo")
  44 + public ResultExitData getInfo(@RequestParam(value = "waybillNoMaster", required = false)String waybillNoMaster) {
  45 + ResultExitData result = new ResultExitData();
  46 + /**
  47 + * 2.根据运单号,获取品名,二级品类,一级品类
  48 + */
  49 + List<SdCargoName> sd = sdCargoNameService.getSdCargoName(waybillNoMaster);
  50 + if (sd != null && sd.size() > 0) {
  51 + // 品名
  52 + result.setSdCargoName(sd.get(0).getSdCargoName());
  53 + List<SdTwoType> twoType = sdTwoTypeService.getSdTwoTypeInfo(sd.get(0).getSdCargoName());
  54 + if (twoType != null && twoType.size() > 0) {
  55 + // 二级品类名称
  56 + result.setTwoTypeName(twoType.get(0).getTwoTypeName());
  57 + List<SdBigType> big = sdBigTypeService.getSdBigTypeInfo(twoType.get(0).getBigTypeId());
  58 + if (big != null && big.size() > 0) {
  59 + // 一级品类
  60 + result.setTypeName(big.get(0).getTypeName());
69 } 61 }
70 } 62 }
71 - /**  
72 - * 1.根据运单号,获取货主信息表ID,最终获取:代理人名称,代理人类型  
73 - */  
74 - List<HzWaybillInfo> hz = hzWaybillInfoService.getHzWaybillInfo(result.getWaybillNoMaster());  
75 - if (hz != null && hz.size() > 0) {  
76 - HzShipperInformation hzInfo = hzShipperInformationService.getHzInfo(hz.get(0).getHzInforId());  
77 - //设置代理人名称  
78 - result.setFullName(hzInfo.getFullName());  
79 - //设置代理人类型  
80 - result.setTheShipperType(hzInfo.getTheShipperType());  
81 - }  
82 } 63 }
83 - return resultList; 64 + /**
  65 + * 1.根据运单号,获取货主信息表ID,最终获取:代理人名称,代理人类型
  66 + */
  67 + List<HzWaybillInfo> hz = hzWaybillInfoService.getHzWaybillInfo(waybillNoMaster);
  68 + if (hz != null && hz.size() > 0) {
  69 + HzShipperInformation hzInfo = hzShipperInformationService.getHzInfo(hz.get(0).getHzInforId());
  70 + //设置代理人名称
  71 + result.setFullName(hzInfo.getFullName());
  72 + //设置代理人类型
  73 + result.setTheShipperType(hzInfo.getTheShipperType());
  74 + }
  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 /**