进出口单证推送数据修改

This commit is contained in:
zhaoqing
2026-06-08 17:35:05 +08:00
parent 289c64be2f
commit 59acf6ec4c
4 changed files with 48 additions and 6 deletions
@@ -14,6 +14,8 @@ import com.mhd.oms.domain.businessDocumentOrder.repository.mapper.BusinessDocume
import com.mhd.oms.domain.businessDocumentOrder.repository.po.BusinessDocumentOrderPO;
import com.mhd.oms.domain.businessDocumentOrder.repository.todo.BusinessDocumentOrderDO;
import com.mhd.oms.domain.businessDocumentOrder.service.BusinessDocumentOrderDomainService;
import com.mhd.oms.domain.reservationStockInOrder.repository.mapper.ReservationStockInOrderMapper;
import com.mhd.oms.domain.reservationStockInOrder.repository.po.MaterialBaseInfoPO;
import com.mhd.common.security.utils.SecurityUtils;
import com.mhd.oms.domain.businessOrderAccount.BusinessOrderAccount;
import com.mhd.oms.domain.businessOrderAccount.repository.mapper.BusinessOrderAccountMapper;
@@ -73,6 +75,8 @@ public class BusinessDocumentOrderApplicationService {
private GwLogMapper gwLogMapper;
@Resource
private BusinessDocumentCargoMultiMapper businessDocumentCargoMultiMapper;
@Resource
private ReservationStockInOrderMapper reservationStockInOrderMapper;
@Autowired
private BusinessDeliveryDetailsLinkMapper businessDeliveryDetailsLinkMapper;
@Resource
@@ -196,15 +200,29 @@ public class BusinessDocumentOrderApplicationService {
List<BusinessDocumentCargoMulti> cargoList = businessDocumentCargoMultiMapper.selectList(
new LambdaQueryWrapper<BusinessDocumentCargoMulti>()
.eq(BusinessDocumentCargoMulti::getOrderId, id)
.eq(BusinessDocumentCargoMulti::getDelFlag, 1)
);
// 3. 构建推送数据
// 3. 查询委托方NC编码
String corpCode = null;
if (order.getAppointShipperId() != null) {
try {
corpCode = businessDocumentOrderMapper.getShipperNcCode(
Long.valueOf(order.getAppointShipperId()));
} catch (NumberFormatException e) {
log.warn("appointShipperId格式异常: {}", order.getAppointShipperId());
}
}
// 4. 构建推送数据
Map<String, Object> body = new HashMap<>();
body.put("erpBillNo", String.valueOf(order.getId()));
body.put("billDate", order.getDocumentDate());
body.put("goodsType", order.getGoodsType());
// 商品类型取第一个cargo的productType0料件,1半成品,2成品)
Integer goodsType = (cargoList != null && !cargoList.isEmpty()) ? cargoList.get(0).getProductType() : null;
body.put("goodsType", goodsType);
body.put("ieFlag", order.getIeType() != null ? order.getIeType() : null);
body.put("corpCode", order.getAppointShipperId() != null ? order.getAppointShipperId() : null);
body.put("corpCode", corpCode);
List<Map<String, Object>> billList = new ArrayList<>();
if (cargoList != null && !cargoList.isEmpty()) {
@@ -215,6 +233,19 @@ public class BusinessDocumentOrderApplicationService {
billMap.put("goodsCode", cargo.getMaterialCode() != null ? cargo.getMaterialCode() : null);
billMap.put("packNo", cargo.getCargoNum());
billMap.put("erpQty", cargo.getCargoNum());
// 查询物料基础信息,计算净重和毛重
if (cargo.getMaterialBaseInfoId() != null) {
MaterialBaseInfoPO material = reservationStockInOrderMapper.getinfo(cargo.getMaterialBaseInfoId());
if (material != null && cargo.getCargoNum() != null) {
if (material.getWeightLimit() != null) {
billMap.put("netWt", material.getWeightLimit().multiply(cargo.getCargoNum()));
}
if (material.getGrossWeight() != null) {
billMap.put("grossWt", material.getGrossWeight().multiply(cargo.getCargoNum()));
}
}
}
billList.add(billMap);
}
}
@@ -222,10 +253,10 @@ public class BusinessDocumentOrderApplicationService {
List<Map<String, Object>> bodyList = new ArrayList<>();
bodyList.add(body);
// 4. 更新推送状态为推送中
// 5. 更新推送状态为推送中
updatePushStatus(order.getId(), 2, null, String.valueOf(pushBy), pushByName);
// 5. 记录日志
// 6. 记录日志
GwLog gwLog = new GwLog();
gwLog.setType("进出口原始单证");
gwLog.setBusinessId(order.getId());
@@ -241,7 +272,7 @@ public class BusinessDocumentOrderApplicationService {
gwLog.setDelFlag(1);
gwLogMapper.insert(gwLog);
// 6. 调用推送接口
// 7. 调用推送接口
try {
CloseableHttpClient httpClient = HttpClients.createDefault();
HttpPost httpPost = new HttpPost(PUSH_API_URL);
@@ -28,6 +28,8 @@ public interface BusinessDocumentOrderMapper extends BaseMapper<BusinessDocument
List<BusinessDocumentOrderPO> queryListAndMaterial(BusinessDocumentOrderDO businessDocumentOrderDO);
String getShipperNcCode(@Param("id") Long id);
UserPo getAddressByUserAccount(@Param("customerNumber") String customerNumber);
String getTmsOrderInfo(@Param("goodsNumber") String goodsNumber);
@@ -127,6 +127,10 @@ public class MaterialBaseInfoPO extends BaseVOEntity {
@Excel(name = "净重 单位:千克")
private BigDecimal weightLimit;
@ApiModelProperty("毛重 单位:千克")
@Excel(name = "毛重 单位:千克")
private BigDecimal grossWeight;
@ApiModelProperty("体积 单位:立方米")
@Excel(name = "体积 单位:立方米")
private BigDecimal volumeLimit;
@@ -712,6 +712,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="selectByMakerCodeNc1" resultType="java.lang.String" parameterType="java.lang.String">
select SALESPERSON_NC_CODE from NGWL_TEST_USER."USER" where USER_ID = #{salesmanCodeNc}</select>
<select id="getShipperNcCode" parameterType="java.lang.Long" resultType="java.lang.String">
select CUSTOMER_NC_CODE from "NGWL_TEST_USER".USER_SHIPPER
where DEL_FLAG = 1 and USER_ID = #{id} limit 1
</select>
<select id="queryListAndMaterial" parameterType="com.mhd.oms.domain.businessDocumentOrder.repository.todo.BusinessDocumentOrderDO" resultMap="BusinessDocumentOrderResult">
select o.*,a.material_code , a.material_base_info_id ,a.product_type,a.cargo_num
from business_document_order as o