作者 王勇

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

... ... @@ -37,49 +37,41 @@ public class CgoAsmController {
/**
* 根据运单号,获取,代理人服务中的相关数据
*
* @param resultList {@link ResultExitData}
* @param waybillNoMaster 运单号
* @return
*/
@PutMapping("/getInfo")
public List<ResultExitData> getInfo(@RequestBody List<ResultExitData> resultList) {
System.out.println("开始调用代理人服务");
System.out.println("长度为" + resultList.size());
for (int i = 0, resultSize = resultList.size(); i < resultSize; i++) {
ResultExitData result = resultList.get(i);
System.out.println(i + "运单号" + result.getWaybillNoMaster());
/**
* 2.根据运单号,获取品名,二级品类,一级品类
*/
System.out.println(i + "品名");
List<SdCargoName> sd = sdCargoNameService.getSdCargoName(result.getWaybillNoMaster());
if (sd != null && sd.size() > 0) {
// 品名
result.setSdCargoName(sd.get(0).getSdCargoName());
System.out.println(i + "二级品类");
List<SdTwoType> twoType = sdTwoTypeService.getSdTwoTypeInfo(sd.get(0).getSdCargoName());
if (twoType != null && twoType.size() > 0) {
// 二级品类名称
result.setTwoTypeName(twoType.get(0).getTwoTypeName());
System.out.println(i + "一级品类");
List<SdBigType> big = sdBigTypeService.getSdBigTypeInfo(twoType.get(0).getBigTypeId());
if (big != null && big.size() > 0) {
// 一级品类
result.setTypeName(big.get(0).getTypeName());
}
@GetMapping("/getInfo")
public ResultExitData getInfo(@RequestParam(value = "waybillNoMaster", required = false)String waybillNoMaster) {
ResultExitData result = new ResultExitData();
/**
* 2.根据运单号,获取品名,二级品类,一级品类
*/
List<SdCargoName> sd = sdCargoNameService.getSdCargoName(waybillNoMaster);
if (sd != null && sd.size() > 0) {
// 品名
result.setSdCargoName(sd.get(0).getSdCargoName());
List<SdTwoType> twoType = sdTwoTypeService.getSdTwoTypeInfo(sd.get(0).getSdCargoName());
if (twoType != null && twoType.size() > 0) {
// 二级品类名称
result.setTwoTypeName(twoType.get(0).getTwoTypeName());
List<SdBigType> big = sdBigTypeService.getSdBigTypeInfo(twoType.get(0).getBigTypeId());
if (big != null && big.size() > 0) {
// 一级品类
result.setTypeName(big.get(0).getTypeName());
}
}
/**
* 1.根据运单号,获取货主信息表ID,最终获取:代理人名称,代理人类型
*/
List<HzWaybillInfo> hz = hzWaybillInfoService.getHzWaybillInfo(result.getWaybillNoMaster());
if (hz != null && hz.size() > 0) {
HzShipperInformation hzInfo = hzShipperInformationService.getHzInfo(hz.get(0).getHzInforId());
//设置代理人名称
result.setFullName(hzInfo.getFullName());
//设置代理人类型
result.setTheShipperType(hzInfo.getTheShipperType());
}
}
return resultList;
/**
* 1.根据运单号,获取货主信息表ID,最终获取:代理人名称,代理人类型
*/
List<HzWaybillInfo> hz = hzWaybillInfoService.getHzWaybillInfo(waybillNoMaster);
if (hz != null && hz.size() > 0) {
HzShipperInformation hzInfo = hzShipperInformationService.getHzInfo(hz.get(0).getHzInforId());
//设置代理人名称
result.setFullName(hzInfo.getFullName());
//设置代理人类型
result.setTheShipperType(hzInfo.getTheShipperType());
}
return result;
}
}
... ...
package com.sunyo.wlpt.cgoasm.provide.service;
import com.sunyo.wlpt.cgoasm.provide.domain.HzShipperInformation;
import org.springframework.transaction.annotation.Transactional;
/**
* @author 子诚
* Description:
* 时间:2020/5/21 12:04
*/
public interface HzShipperInformationService {
/**
... ...