|
|
package com.sunyo.wlpt.cgoasm.provide.controller;
|
|
|
|
|
|
import com.sunyo.wlpt.cgoasm.provide.common.ResultExitData;
|
|
|
import com.sunyo.wlpt.cgoasm.provide.domain.*;
|
|
|
import com.sunyo.wlpt.cgoasm.provide.service.*;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
import java.util.List;
|
|
|
|
|
|
/**
|
|
|
* @author 子诚
|
|
|
* Description:获取 代理人服务 的相关信息
|
|
|
* 时间:2020/5/21 14:39
|
|
|
*/
|
|
|
@CrossOrigin
|
|
|
@RequestMapping("cgoasm")
|
|
|
@RestController
|
|
|
public class CgoAsmController {
|
|
|
|
|
|
@Resource
|
|
|
private HzWaybillInfoService hzWaybillInfoService;
|
|
|
|
|
|
@Resource
|
|
|
private HzShipperInformationService hzShipperInformationService;
|
|
|
|
|
|
@Resource
|
|
|
private SdCargoNameService sdCargoNameService;
|
|
|
|
|
|
@Resource
|
|
|
private SdTwoTypeService sdTwoTypeService;
|
|
|
|
|
|
@Resource
|
|
|
private SdBigTypeService sdBigTypeService;
|
|
|
|
|
|
/**
|
|
|
* 根据运单号,获取,代理人服务中的相关数据
|
|
|
*
|
|
|
* @param resultList {@link ResultExitData}
|
|
|
* @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());
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
/**
|
|
|
* 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;
|
|
|
}
|
|
|
} |
...
|
...
|
|