修改报文查询bug 修改进出口查询接口
This commit is contained in:
+3
@@ -50,6 +50,9 @@ public class GwLogApplicationService {
|
||||
GwLog gwLog =new GwLog();
|
||||
BeanUtils.copyProperties(gwLogDTO,gwLog);
|
||||
List<GwLogPO> po1 = gwLogMapper.selectByTypeAndId(gwLog);
|
||||
if(po1.isEmpty()){
|
||||
return null;
|
||||
}
|
||||
GwLogPO po = po1.get(0);
|
||||
return po;
|
||||
}
|
||||
|
||||
@@ -37,6 +37,10 @@ public class GwLogApi extends BaseController {
|
||||
@PostMapping("/selectByTypeAndId")
|
||||
public AjaxResult selectByTypeAndId(@RequestBody GwLogDTO gwLogDTO){
|
||||
GwLogPO po = gwLogApplicationService.selectByTypeAndId(gwLogDTO);
|
||||
if (po == null)
|
||||
{
|
||||
return AjaxResult.error(500,"该项数据未推送过/数据错误");
|
||||
}
|
||||
AjaxResult ajaxResult = new AjaxResult();
|
||||
ajaxResult.put("code",200);
|
||||
ajaxResult.put("data",po);
|
||||
|
||||
+4
-112
@@ -47,8 +47,8 @@ public class OriginalImportExportDocumentApi extends BaseController {
|
||||
private WmsServiceFeign wmsServiceFeign;
|
||||
|
||||
@ApiOperation("进出口原始单证查询列表")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(BusinessDocumentOrderDTO businessDocumentOrderDTO,
|
||||
@GetMapping("/list1")
|
||||
public TableDataInfo list1(BusinessDocumentOrderDTO businessDocumentOrderDTO,
|
||||
@RequestParam(value = "pageNo", required = false, defaultValue = "1") Integer pageNo,
|
||||
@RequestParam(value = "pageSize", required = false, defaultValue = "10") Integer pageSize) {
|
||||
BusinessDocumentOrderDO businessDocumentOrderDO = businessDocumentOrderAssembler.toDO(businessDocumentOrderDTO);
|
||||
@@ -58,8 +58,6 @@ public class OriginalImportExportDocumentApi extends BaseController {
|
||||
Page<BusinessDocumentOrderPO> page = (Page<BusinessDocumentOrderPO>) orderList;
|
||||
List<OrderWithMaterialDTO> resultList = convertToOrderWithMaterialList(orderList);
|
||||
|
||||
fillMaterialInfo(resultList);
|
||||
|
||||
TableDataInfo tableDataInfo = new TableDataInfo();
|
||||
tableDataInfo.setData(resultList);
|
||||
tableDataInfo.setTotal(page.getTotal());
|
||||
@@ -88,118 +86,12 @@ public class OriginalImportExportDocumentApi extends BaseController {
|
||||
}
|
||||
|
||||
|
||||
// private List<OrderWithMaterialDTO> convertToOrderWithMaterialList(List<BusinessDocumentOrderPO> orderList) {
|
||||
// List<OrderWithMaterialDTO> resultList = new ArrayList<>();
|
||||
// for (BusinessDocumentOrderPO order : orderList) {
|
||||
// OrderWithMaterialDTO orderWithMaterialDTO = new OrderWithMaterialDTO();
|
||||
// orderWithMaterialDTO.setMaterialCode(order.getMaterialCode());
|
||||
// orderWithMaterialDTO.setIeType(order.getIeType());
|
||||
// BeanUtils.copyProperties(order, orderWithMaterialDTO);
|
||||
// resultList.add(orderWithMaterialDTO);
|
||||
// }
|
||||
//
|
||||
// return resultList;
|
||||
// }
|
||||
|
||||
/**
|
||||
* 调用WMS接口获取物料详细信息
|
||||
* 根据materialCode查询,获取goodsType、grossWeight等字段
|
||||
*/
|
||||
private void fillMaterialInfo(List<OrderWithMaterialDTO> resultList) {
|
||||
|
||||
List<String> materialCodeList = resultList.stream()
|
||||
.map(OrderWithMaterialDTO::getMaterialCode)
|
||||
.filter(StringUtils::hasText)
|
||||
.distinct()
|
||||
.collect(Collectors.toList());
|
||||
|
||||
if (materialCodeList.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
// 2. 批量查询物料信息(一次查询所有物料)
|
||||
try {
|
||||
MaterialInfoDTO queryDTO = new MaterialInfoDTO();
|
||||
// 传入物料编码列表(逗号分隔或用其他方式)
|
||||
queryDTO.setMaterialCode(String.join(",", materialCodeList));
|
||||
|
||||
TableDataInfo tableDataInfo = wmsServiceFeign.getMaterialBaseInfoList(queryDTO);
|
||||
|
||||
if (tableDataInfo != null && tableDataInfo.getCode() == 200) {
|
||||
List<?> materialList = tableDataInfo.getData();
|
||||
|
||||
// 3. 把物料列表转成 Map(key = materialCode)
|
||||
Map<String, Map<?, ?>> materialMap = new HashMap<>();
|
||||
for (Object material : materialList) {
|
||||
Map<?, ?> m = (Map<?, ?>) material;
|
||||
String code = (String) m.get("materialCode");
|
||||
materialMap.put(code, m);
|
||||
}
|
||||
|
||||
// 4. 遍历订单,匹配物料信息
|
||||
for (OrderWithMaterialDTO dto : resultList) {
|
||||
if (StringUtils.hasText(dto.getMaterialCode())) {
|
||||
Map<?, ?> material = materialMap.get(dto.getMaterialCode());
|
||||
if (material != null) {
|
||||
dto.setMaterialName((String) material.get("materialName"));
|
||||
dto.setGoodsType((Integer) material.get("goodsType"));
|
||||
dto.setGrossWeight((BigDecimal) material.get("grossWeight"));
|
||||
dto.setDeclarationUnit((String) material.get("declarationUnit"));
|
||||
dto.setOriginCountry((String) material.get("originCountry"));
|
||||
dto.setUnitPrice((BigDecimal) material.get("unitPrice"));
|
||||
dto.setWeightLimit((BigDecimal) material.get("weightLimit"));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
// 查询失败不影响主流程
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
// for (OrderWithMaterialDTO dto : resultList) {
|
||||
// // 只查询有物料编码的订单
|
||||
// if (StringUtils.hasText(dto.getMaterialCode())) {
|
||||
// try {
|
||||
// // 构建查询参数
|
||||
// MaterialInfoDTO queryDTO = new MaterialInfoDTO();
|
||||
// queryDTO.setMaterialCode(dto.getMaterialCode());
|
||||
//
|
||||
// // 调用WMS接口查询物料详情
|
||||
// AjaxResult ajaxResult = wmsServiceFeign.getMaterialBaseInfoList(queryDTO);
|
||||
//
|
||||
// // 判断返回是否成功
|
||||
// if ("200".equals(String.valueOf(ajaxResult.get("code")))) {
|
||||
// List<?> materialList = (List<?>) ajaxResult.get("data");
|
||||
// if (materialList != null && !materialList.isEmpty()) {
|
||||
// // 取第一条物料记录
|
||||
// Map<?, ?> materialMap = (Map<?, ?>) materialList.get(0);
|
||||
//
|
||||
// // 从WMS返回的Map中取值,填充到DTO
|
||||
// dto.setMaterialName((String) materialMap.get("materialName")); // 物料名称
|
||||
// dto.setGoodsType((Integer) materialMap.get("goodsType")); // 货物类型
|
||||
// dto.setGrossWeight((java.math.BigDecimal) materialMap.get("grossWeight")); // 毛重
|
||||
// dto.setDeclarationUnit((String) materialMap.get("declarationUnit")); // 申报单位
|
||||
// dto.setOriginCountry((String) materialMap.get("originCountry")); // 原产国
|
||||
// dto.setUnitPrice((BigDecimal) materialMap.get("unitPrice")); //单价
|
||||
// dto.setWeightLimit((BigDecimal) materialMap.get("weightLimit")); //净重
|
||||
// }
|
||||
// }
|
||||
// } catch (Exception e) {
|
||||
// // 查询失败不影响主流程,打印日志
|
||||
// e.printStackTrace();
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// }
|
||||
//}
|
||||
|
||||
|
||||
|
||||
@ApiOperation("进出口原始单证查询列表")
|
||||
@GetMapping("/list1")
|
||||
public TableDataInfo list1(BusinessDocumentOrderDTO businessDocumentOrderDTO,
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(BusinessDocumentOrderDTO businessDocumentOrderDTO,
|
||||
@RequestParam(value = "pageNo", required = false, defaultValue = "1") Integer pageNo,
|
||||
@RequestParam(value = "pageSize", required = false, defaultValue = "10") Integer pageSize) {
|
||||
BusinessDocumentOrderDO businessDocumentOrderDO = businessDocumentOrderAssembler.toDO(businessDocumentOrderDTO);
|
||||
|
||||
Reference in New Issue
Block a user