回滚代码

This commit is contained in:
wuweihua
2026-10-16 20:28:49 +08:00
parent 9ff89e36ee
commit 52f714c760
29 changed files with 505 additions and 1413 deletions
@@ -1,68 +0,0 @@
package com.bms.price.domain;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.bms.common.core.domain.BaseEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
/** Order master prc_order (upstream TAB_ORDER core + billing status) */
@Data
@EqualsAndHashCode(callSuper = true)
public class PrcOrder extends BaseEntity
{
private static final long serialVersionUID = 1L;
private String orderId;
private String orderNo;
private List<String> orderNos;
private String trackingNo;
private List<String> trackingNos;
private String transferNo;
private List<String> transferNos;
private String trackId;
private String belongSaler;
private String belongSalerCode;
private String settlementMan;
private String settlementManCode;
private String serviceMan;
private String serviceManCode;
private String customerCode;
private String customerName;
private List<String> customerCodes;
private Integer pieces;
private BigDecimal actualWeight;
private BigDecimal weight;
private BigDecimal dimensionalWeightFactor;
private BigDecimal volume;
private BigDecimal volumeWeight;
private BigDecimal pkgLength;
private BigDecimal pkgWidth;
private BigDecimal pkgHeight;
private String shipperName;
private String consigneeName;
private String consigneePostcode;
private String warehouseCode;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date orderTime;
private String orderRemark;
private String productCode;
private String productName;
private List<String> productCodes;
private String productFloorCode;
private String countryCode;
private String countryName;
private Integer orderStatus;
/** 0 not received / 1 received (TAB_ORDER.BL_PICKUP) */
private Integer blPickup;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date pickupDate;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date bizDate;
/** WAITING / SUCCESS / FAILED */
private String successStatus;
private String failCode;
private List<String> failCodes;
}
@@ -4,6 +4,7 @@ import java.math.BigDecimal;
import java.util.Date;
import java.util.List;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.bms.common.core.domain.BaseEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
@@ -16,8 +17,6 @@ public class PrcOrderBill extends BaseEntity
private static final long serialVersionUID = 1L;
private String billId;
/** FK to prc_order.order_id (wired by parent). */
private String orderId;
/** 批量查询:多个账单ID精确匹配(仅查询用,非表字段) */
private List<String> billIds;
private String billKey;
@@ -63,8 +62,8 @@ public class PrcOrderBill extends BaseEntity
private String warehouseCode;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date orderTime;
/** 收货时间(TAB_ORDER.PICKUP_DATE) */
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
/** 应收来源查询专用:从 prc_order_bill_ext.pickup_date 读取的收件时间。 */
@JsonIgnore
private Date pickupDate;
private String orderRemark;
private String productCode;
@@ -6,13 +6,13 @@ import java.math.BigDecimal;
import java.util.Date;
import lombok.Data;
/** Order ext leftover TAB_ORDER fields on prc_order_ext */
/** 计费订单扩展表:TAB_ORDER 剩余字段 + 同步请求快照 */
@Data
public class PrcOrderExt implements Serializable
public class PrcOrderBillExt implements Serializable
{
private static final long serialVersionUID = 1L;
private String orderId;
private String billId;
private String orderNo;
private String upstreamId;
private String lineNo;
@@ -70,6 +70,7 @@ public class PrcOrderExt implements Serializable
private String importState;
private String importCountry;
private String buyerid;
private Integer orderStatus;
private String createAt;
private Integer payType;
private String lineCode;
@@ -77,6 +78,7 @@ public class PrcOrderExt implements Serializable
private String productType;
private String lineType;
private String cargoName;
private String productFloorCode;
private BigDecimal orderInsurance;
private BigDecimal productSumPrice;
private BigDecimal productSum;
@@ -86,7 +88,10 @@ public class PrcOrderExt implements Serializable
private String productFloor;
private String latestTrajectory;
private String wayBill;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date pickupDate;
private Integer blBaging;
private Integer blPickup;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date bagDate;
private Integer orgOrderStatus;
@@ -169,6 +174,7 @@ public class PrcOrderExt implements Serializable
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date airConfirmTime;
private Integer packageType;
private BigDecimal dimensionalWeightFactor;
private String updateBy;
private String customerPickupSite;
private String barcodeNumber;
@@ -20,9 +20,6 @@ public class TmsPriceBillRequest extends TmsPriceQuoteRequest
@NotBlank(message = "orderNo is required")
private String orderNo;
/** FK to prc_order.order_id when order master already upserted */
private String orderId;
private String trackingNo;
/** transfer order no */
private String transferNo;
@@ -53,11 +50,8 @@ public class TmsPriceBillRequest extends TmsPriceQuoteRequest
private String warehouseCode;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date orderTime;
/** TAB_ORDER.PICKUP_DATE */
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date pickupDate;
private String orderRemark;
/** 上游 TAB_ORDER 整行,用于写入 prc_order_ext 扩展字段 */
/** 上游 TAB_ORDER 整行,用于写入 prc_order_bill_ext 扩展字段 */
private Map<String, Object> upstreamRow;
@JsonIgnore
@@ -12,9 +12,6 @@ public interface PrcBillingTaskMapper
int insertPrcBillingTask(PrcBillingTask task);
/** Delete queue rows by unique transfer_no after prc_order upsert. */
int deleteByTransferNo(@Param("transferNo") String transferNo);
int updatePrcBillingTask(PrcBillingTask task);
/** CAS: WAITING -> processing claim not needed; writeback SUCCESS/FAILED */
@@ -0,0 +1,15 @@
package com.bms.price.mapper;
import com.bms.price.domain.PrcOrderBillExt;
/** prc_order_bill_ext mapper */
public interface PrcOrderBillExtMapper
{
public PrcOrderBillExt selectByBillId(String billId);
public PrcOrderBillExt selectByOrderNo(String orderNo);
public int insertPrcOrderBillExt(PrcOrderBillExt ext);
public int upsertPrcOrderBillExt(PrcOrderBillExt ext);
}
@@ -1,15 +0,0 @@
package com.bms.price.mapper;
import com.bms.price.domain.PrcOrderExt;
/** prc_order_ext mapper */
public interface PrcOrderExtMapper
{
public PrcOrderExt selectByOrderId(String orderId);
public PrcOrderExt selectByOrderNo(String orderNo);
public int insertPrcOrderExt(PrcOrderExt ext);
public int upsertPrcOrderExt(PrcOrderExt ext);
}
@@ -1,28 +0,0 @@
package com.bms.price.mapper;
import java.util.List;
import com.bms.price.domain.PrcOrder;
import org.apache.ibatis.annotations.Param;
/** prc_order mapper */
public interface PrcOrderMapper
{
PrcOrder selectPrcOrderById(String orderId);
PrcOrder selectPrcOrderByTransferNo(String transferNo);
PrcOrder selectPrcOrderByOrderNo(String orderNo);
List<PrcOrder> selectPrcOrderList(PrcOrder query);
int insertPrcOrder(PrcOrder order);
int updatePrcOrder(PrcOrder order);
int upsertPrcOrderByTransferNo(PrcOrder order);
int updateBillingStatus(@Param("orderId") String orderId,
@Param("successStatus") String successStatus,
@Param("failCode") String failCode,
@Param("updateBy") String updateBy);
}
@@ -5,16 +5,16 @@ import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Locale;
import java.util.Map;
import com.bms.price.domain.PrcOrderExt;
import com.bms.price.domain.PrcOrderBillExt;
/**
* 从 Oracle TAB_ORDER 行填充 prc_order_ext(仅包含未落在 prc_order_bill 的字段)。
* 从 Oracle TAB_ORDER 行填充 prc_order_bill_ext(仅包含未落在 prc_order_bill 的字段)。
*/
public final class OracleOrderExtFiller
public final class OracleOrderBillExtFiller
{
private OracleOrderExtFiller() {}
private OracleOrderBillExtFiller() {}
public static void fillFromRow(PrcOrderExt ext, Map<String, Object> row)
public static void fillFromRow(PrcOrderBillExt ext, Map<String, Object> row)
{
if (ext == null || row == null || row.isEmpty())
{
@@ -76,6 +76,7 @@ public final class OracleOrderExtFiller
ext.setImportState(str(row, "IMPORT_STATE"));
ext.setImportCountry(str(row, "IMPORT_COUNTRY"));
ext.setBuyerid(str(row, "BUYERID"));
ext.setOrderStatus(integer(row, "ORDER_STATUS"));
ext.setCreateAt(str(row, "CREATE_AT"));
ext.setPayType(integer(row, "PAY_TYPE"));
ext.setLineCode(str(row, "LINE_CODE"));
@@ -83,6 +84,7 @@ public final class OracleOrderExtFiller
ext.setProductType(str(row, "PRODUCT_TYPE"));
ext.setLineType(str(row, "LINE_TYPE"));
ext.setCargoName(str(row, "CARGO_NAME"));
ext.setProductFloorCode(str(row, "PRODUCT_FLOOR_CODE"));
ext.setOrderInsurance(decimal(row, "ORDER_INSURANCE"));
ext.setProductSumPrice(decimal(row, "PRODUCT_SUM_PRICE"));
ext.setProductSum(decimal(row, "PRODUCT_SUM"));
@@ -92,7 +94,9 @@ public final class OracleOrderExtFiller
ext.setProductFloor(str(row, "PRODUCT_FLOOR"));
ext.setLatestTrajectory(str(row, "LATEST_TRAJECTORY"));
ext.setWayBill(str(row, "WAY_BILL"));
ext.setPickupDate(date(row, "PICKUP_DATE"));
ext.setBlBaging(integer(row, "BL_BAGING"));
ext.setBlPickup(integer(row, "BL_PICKUP"));
ext.setBagDate(date(row, "BAG_DATE"));
ext.setOrgOrderStatus(integer(row, "ORG_ORDER_STATUS"));
ext.setStatusDescription(str(row, "STATUS_DESCRIPTION"));
@@ -158,6 +162,7 @@ public final class OracleOrderExtFiller
ext.setTrackQueryTime(date(row, "TRACK_QUERY_TIME"));
ext.setAirConfirmTime(date(row, "AIR_CONFIRM_TIME"));
ext.setPackageType(integer(row, "PACKAGE_TYPE"));
ext.setDimensionalWeightFactor(decimal(row, "DIMENSIONAL_WEIGHT_FACTOR"));
ext.setUpdateBy(str(row, "UPDATE_BY"));
ext.setCustomerPickupSite(str(row, "CUSTOMER_PICKUP_SITE"));
ext.setBarcodeNumber(str(row, "BARCODE_NUMBER"));
@@ -68,7 +68,6 @@ public class OracleOrderBillMapper
{
req.setOrderTime(createDate);
}
req.setPickupDate(firstDate(row, "PICKUP_DATE"));
return req;
}
@@ -1,202 +0,0 @@
package com.bms.price.oracle;
import java.math.BigDecimal;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Locale;
import java.util.Map;
import com.bms.common.utils.StringUtils;
import com.bms.price.domain.PrcOrder;
import com.bms.price.domain.vo.TmsPriceBillRequest;
import com.bms.price.enums.BillTaskSuccessStatus;
/**
* Fill prc_order core fields from upstream TAB_ORDER row (+ bill request overlay).
*/
public final class OracleOrderFiller
{
private OracleOrderFiller() {}
public static void fillFromRow(PrcOrder order, Map<String, Object> row, TmsPriceBillRequest req, Date bizDate)
{
if (order == null || row == null || row.isEmpty())
{
return;
}
if (req != null)
{
if (StringUtils.isNotEmpty(req.getOrderNo()))
{
order.setOrderNo(req.getOrderNo());
}
if (StringUtils.isNotEmpty(req.getTrackingNo()))
{
order.setTrackingNo(req.getTrackingNo());
}
if (StringUtils.isNotEmpty(req.getTransferNo()))
{
order.setTransferNo(req.getTransferNo());
}
order.setBelongSaler(req.getBelongSaler());
order.setBelongSalerCode(req.getBelongSalerCode());
order.setSettlementMan(req.getSettlementMan());
order.setSettlementManCode(req.getSettlementManCode());
order.setServiceMan(req.getServiceMan());
order.setServiceManCode(req.getServiceManCode());
order.setCustomerCode(req.getCustomerCode());
order.setCustomerName(req.getCustomerName());
order.setPieces(req.getPieces());
order.setActualWeight(req.getActualWeight());
order.setWeight(req.getReceiveWeight());
order.setDimensionalWeightFactor(req.getWeight());
order.setVolume(req.getVolume());
order.setVolumeWeight(req.getVolumeWeight());
order.setPkgLength(req.getPkgLength());
order.setPkgWidth(req.getPkgWidth());
order.setPkgHeight(req.getPkgHeight());
order.setShipperName(req.getShipperName());
order.setConsigneeName(req.getConsigneeName());
order.setConsigneePostcode(req.getDestPostcode());
order.setWarehouseCode(req.getWarehouseCode());
order.setOrderTime(req.getOrderTime());
order.setOrderRemark(req.getOrderRemark());
order.setProductCode(req.getProductCode());
order.setCountryCode(req.getCountryCode());
order.setCountryName(req.getCountryName());
}
if (StringUtils.isEmpty(order.getOrderNo()))
{
order.setOrderNo(str(row, "ORDER_ID"));
}
if (StringUtils.isEmpty(order.getTrackingNo()))
{
order.setTrackingNo(str(row, "ORG_ORDER_ID"));
}
if (StringUtils.isEmpty(order.getTransferNo()))
{
order.setTransferNo(str(row, "TRANSFER_ORDER_ID"));
}
order.setTrackId(str(row, "TRACK_ID"));
order.setProductFloorCode(str(row, "PRODUCT_FLOOR_CODE"));
if (StringUtils.isEmpty(order.getProductName()))
{
order.setProductName(str(row, "PRODUCT_NAME"));
}
order.setOrderStatus(integer(row, "ORDER_STATUS"));
order.setBlPickup(integer(row, "BL_PICKUP"));
order.setPickupDate(date(row, "PICKUP_DATE"));
if (order.getDimensionalWeightFactor() == null)
{
order.setDimensionalWeightFactor(decimal(row, "DIMENSIONAL_WEIGHT_FACTOR"));
}
if (order.getWeight() == null)
{
order.setWeight(decimal(row, "WEIGHT"));
}
if (order.getVolumeWeight() == null)
{
order.setVolumeWeight(decimal(row, "VOLUME_WEIGHT"));
}
if (order.getConsigneePostcode() == null)
{
order.setConsigneePostcode(str(row, "CONSIGNEE_POSTCODE"));
}
order.setBizDate(bizDate);
if (StringUtils.isEmpty(order.getSuccessStatus()))
{
order.setSuccessStatus(BillTaskSuccessStatus.WAITING.getCode());
}
}
private static String str(Map<String, Object> row, String key)
{
Object v = get(row, key);
if (v == null)
{
return null;
}
String s = String.valueOf(v).trim();
return s.isEmpty() ? null : s;
}
private static Integer integer(Map<String, Object> row, String key)
{
BigDecimal d = decimal(row, key);
return d == null ? null : Integer.valueOf(d.intValue());
}
private static BigDecimal decimal(Map<String, Object> row, String key)
{
Object v = get(row, key);
if (v == null || "".equals(String.valueOf(v).trim()))
{
return null;
}
if (v instanceof BigDecimal)
{
return (BigDecimal) v;
}
if (v instanceof Number)
{
return BigDecimal.valueOf(((Number) v).doubleValue());
}
try
{
return new BigDecimal(String.valueOf(v).trim());
}
catch (Exception e)
{
return null;
}
}
private static Date date(Map<String, Object> row, String key)
{
Object v = get(row, key);
if (v == null)
{
return null;
}
if (v instanceof Date)
{
return (Date) v;
}
String s = String.valueOf(v).trim();
String[] formats = {
"dd/MM/yyyy HH:mm:ss", "dd/MM/yyyy HH:mm", "yyyy-MM-dd HH:mm:ss",
"yyyy-MM-dd'T'HH:mm:ss", "yyyy-MM-dd"
};
for (String fmt : formats)
{
try
{
return new SimpleDateFormat(fmt, Locale.ENGLISH).parse(s);
}
catch (Exception ignored)
{
}
}
return null;
}
private static Object get(Map<String, Object> row, String key)
{
if (row.containsKey(key))
{
return row.get(key);
}
String upper = key.toUpperCase(Locale.ROOT);
if (row.containsKey(upper))
{
return row.get(upper);
}
for (Map.Entry<String, Object> e : row.entrySet())
{
if (e.getKey() != null && e.getKey().equalsIgnoreCase(key))
{
return e.getValue();
}
}
return null;
}
}
@@ -35,12 +35,6 @@ public interface IPrcBillingTaskService
*/
PrcBillingTask retryTask(Long taskId);
/**
* Manual resync by prc_order.order_id (task queue row may already be deleted).
* @return order after retry
*/
com.bms.price.domain.PrcOrder retryByOrderId(String orderId);
/**
* Start async filter retry (customer + bill_time). Returns async task id for progress poll.
*/
@@ -1,25 +0,0 @@
package com.bms.price.service;
import java.util.Date;
import java.util.List;
import java.util.Map;
import com.bms.price.domain.PrcOrder;
import com.bms.price.domain.vo.TmsPriceBillRequest;
/** prc_order service */
public interface IPrcOrderService
{
PrcOrder selectPrcOrderById(String orderId);
PrcOrder selectPrcOrderByTransferNo(String transferNo);
List<PrcOrder> selectPrcOrderList(PrcOrder query);
/**
* Upsert prc_order + prc_order_ext by transfer_no (overwrite upstream fields when exists).
* @return persisted order (stable orderId)
*/
PrcOrder upsertFromUpstream(Map<String, Object> upstreamRow, TmsPriceBillRequest billReq, Date bizDate);
void updateBillingStatus(String orderId, String successStatus, String failCode);
}
@@ -15,7 +15,6 @@ import com.bms.common.utils.StringUtils;
import com.bms.price.config.BillingProperties;
import com.bms.price.domain.PrcBillingTask;
import com.bms.price.domain.PrcBillingTaskRetryTask;
import com.bms.price.domain.PrcOrder;
import com.bms.price.domain.PrcOrderBill;
import com.bms.price.domain.vo.BillingTaskRetryByFilterRequest;
import com.bms.price.domain.vo.BillingTaskSubmitRequest;
@@ -33,7 +32,6 @@ import com.bms.price.oracle.OracleOrderBillMapper;
import com.bms.price.oracle.OracleUpstreamOrderService;
import com.bms.price.service.IPrcBillingTaskService;
import com.bms.price.service.IPrcOrderBillService;
import com.bms.price.service.IPrcOrderService;
import com.bms.price.task.PrcBillingTaskRetryAsyncRunner;
@Service
@@ -59,9 +57,6 @@ public class PrcBillingTaskServiceImpl implements IPrcBillingTaskService
@Autowired
private IPrcOrderBillService prcOrderBillService;
@Autowired
private IPrcOrderService prcOrderService;
@Autowired
private BillingProperties billingProperties;
@@ -254,17 +249,29 @@ public class PrcBillingTaskServiceImpl implements IPrcBillingTaskService
}
/**
* Map upstream row -> upsert prc_order(+ext) -> delete billing task by transfer_no -> bill
* -> write success_status/fail_code onto prc_order (task is already gone).
* 用上游 Oracle 全行数据映射并计费(公共逻辑:MQ 处理与订单列表同步复用)。
* 订单列表同步时行数据已由分页查询拉回,避免每单再走 findMainOrder 的公网往返。
*/
private void billFromUpstreamRow(PrcBillingTask task, Map<String, Object> row)
{
Long taskId = task.getTaskId();
TmsPriceBillRequest billReq = oracleOrderBillMapper.toBillRequest(row,
billingProperties.getOracle().getDefaultProductCode());
if (billReq == null)
if (billReq == null || StringUtils.isEmpty(billReq.getOrderNo()))
{
throw new ServiceException("Oracle order mapped empty");
throw new ServiceException("Oracle order mapped orderNo empty");
}
if (StringUtils.isEmpty(billReq.getCustomerCode()))
{
throw new ServiceException("Oracle order mapped customerCode empty");
}
if (StringUtils.isEmpty(billReq.getProductCode()))
{
throw new ServiceException("Oracle order mapped productCode empty");
}
if (billReq.getWeight() == null || billReq.getWeight().signum() <= 0)
{
throw new ServiceException("Oracle order mapped weight invalid");
}
// Identity keys from mobile inbound are source of truth; do not replace with Oracle remap.
if (StringUtils.isNotEmpty(task.getTransferNo()))
@@ -283,55 +290,21 @@ public class PrcBillingTaskServiceImpl implements IPrcBillingTaskService
billReq.setBizDate(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(task.getBillTime()));
task.setCustomerCode(billReq.getCustomerCode());
// Always persist upstream onto prc_order first (even if later billing validation fails).
PrcOrder order = prcOrderService.upsertFromUpstream(row, billReq, task.getBillTime());
billReq.setOrderId(order.getOrderId());
String transferNo = order.getTransferNo();
if (StringUtils.isNotEmpty(transferNo))
TmsPriceQuoteResult result = billWithDbRetry(taskId, billReq);
// Soft-fail (product/country/weight miss): order bill already persisted with zero amounts;
// still mark task FAILED so it appears in abnormal-task list for retry/ops.
if (result != null && BillBillingFailStatus.isFail(result.getBillingFailStatus()))
{
billingTaskMapper.deleteByTransferNo(transferNo);
String err = StringUtils.isNotEmpty(result.getMatchMessage())
? result.getMatchMessage()
: ("billingFailStatus=" + result.getBillingFailStatus());
writeback(task, BillTaskSuccessStatus.FAILED, result.getBillId(), cut(err, 900),
BillBillingFailStatus.toTaskFailCode(result.getBillingFailStatus()));
}
try
else
{
if (StringUtils.isEmpty(billReq.getOrderNo()))
{
throw new ServiceException("Oracle order mapped orderNo empty");
}
if (StringUtils.isEmpty(billReq.getCustomerCode()))
{
throw new ServiceException("Oracle order mapped customerCode empty");
}
if (StringUtils.isEmpty(billReq.getProductCode()))
{
throw new ServiceException("Oracle order mapped productCode empty");
}
if (billReq.getWeight() == null || billReq.getWeight().signum() <= 0)
{
throw new ServiceException("Oracle order mapped weight invalid");
}
TmsPriceQuoteResult result = billWithDbRetry(taskId, billReq);
if (result != null && BillBillingFailStatus.isFail(result.getBillingFailStatus()))
{
String failCode = BillBillingFailStatus.toTaskFailCode(result.getBillingFailStatus());
prcOrderService.updateBillingStatus(order.getOrderId(),
BillTaskSuccessStatus.FAILED.getCode(), failCode);
}
else
{
prcOrderService.updateBillingStatus(order.getOrderId(),
BillTaskSuccessStatus.SUCCESS.getCode(), null);
}
}
catch (RuntimeException e)
{
// Task row already deleted; persist fail on prc_order only (do not rethrow for writeback).
String failCode = BillTaskFailCode.resolveCode(e.getMessage());
prcOrderService.updateBillingStatus(order.getOrderId(),
BillTaskSuccessStatus.FAILED.getCode(), failCode);
log.error("billing failed after prc_order upsert orderId={} transferNo={}",
order.getOrderId(), transferNo, e);
writeback(task, BillTaskSuccessStatus.SUCCESS, result == null ? null : result.getBillId(),
null, null);
}
}
@@ -478,41 +451,6 @@ public class PrcBillingTaskServiceImpl implements IPrcBillingTaskService
return billingTaskMapper.selectPrcBillingTaskList(query);
}
@Override
public PrcOrder retryByOrderId(String orderId)
{
if (StringUtils.isEmpty(orderId))
{
throw new ServiceException("orderId required");
}
PrcOrder order = prcOrderService.selectPrcOrderById(orderId.trim());
if (order == null)
{
throw new ServiceException("prc_order not found");
}
if (order.getBizDate() == null)
{
throw new ServiceException("prc_order bizDate empty (billing time required)");
}
Map<String, Object> row = oracleUpstreamOrderService.findMainOrder(
order.getTransferNo(), order.getOrderNo(), order.getTrackingNo());
if (row == null || row.isEmpty())
{
prcOrderService.updateBillingStatus(order.getOrderId(),
BillTaskSuccessStatus.FAILED.getCode(), BillTaskFailCode.ORACLE_ORDER_NOT_FOUND.getCode());
return prcOrderService.selectPrcOrderById(order.getOrderId());
}
PrcBillingTask transientTask = new PrcBillingTask();
transientTask.setTransferNo(order.getTransferNo());
transientTask.setTrackingNo(order.getTrackingNo());
transientTask.setOrderNo(order.getOrderNo());
transientTask.setCustomerCode(order.getCustomerCode());
transientTask.setBillTime(order.getBizDate());
transientTask.setBillType(BillTaskType.REBILL.getCode());
billFromUpstreamRow(transientTask, row);
return prcOrderService.selectPrcOrderById(order.getOrderId());
}
@Override
public PrcBillingTask retryTask(Long taskId)
{
@@ -39,7 +39,7 @@ import com.bms.system.service.IBmsBizRuleService;
import com.bms.price.domain.PrcIncomeBill;
import com.bms.price.domain.PrcIncomeBillFee;
import com.bms.price.domain.PrcOrderBill;
import com.bms.price.domain.PrcOrderExt;
import com.bms.price.domain.PrcOrderBillExt;
import com.bms.price.domain.PrcPayBill;
import com.bms.price.domain.PrcPayBillFee;
import com.bms.price.domain.PrcSurcharge;
@@ -67,11 +67,11 @@ import com.bms.price.enums.BillBillingFailStatus;
import com.bms.price.enums.TmsOrderBillMatchType;
import com.bms.price.mapper.PrcIncomeBillFeeMapper;
import com.bms.price.mapper.PrcIncomeBillMapper;
import com.bms.price.mapper.PrcOrderExtMapper;
import com.bms.price.mapper.PrcOrderBillExtMapper;
import com.bms.price.mapper.PrcOrderBillMapper;
import com.bms.price.mapper.PrcPayBillFeeMapper;
import com.bms.price.mapper.PrcPayBillMapper;
import com.bms.price.oracle.OracleOrderExtFiller;
import com.bms.price.oracle.OracleOrderBillExtFiller;
import com.bms.price.search.EsBizLogSupport;
import com.bms.price.search.EsLogType;
import com.bms.price.search.IBillSearchStore;
@@ -108,7 +108,7 @@ public class PrcOrderBillServiceImpl implements IPrcOrderBillService
private SysUserMapper sysUserMapper;
@Autowired
private PrcOrderExtMapper orderExtMapper;
private PrcOrderBillExtMapper orderBillExtMapper;
@Autowired
private PrcIncomeBillFeeMapper incomeBillFeeMapper;
@@ -1255,10 +1255,6 @@ public class PrcOrderBillServiceImpl implements IPrcOrderBillService
}
bill.setBillKey(billKey);
bill.setOrderNo(orderNo);
if (StringUtils.isNotEmpty(request.getOrderId()))
{
bill.setOrderId(request.getOrderId());
}
Long customerId = request.getCustomerId();
if (customerId == null && result != null)
{
@@ -1301,7 +1297,6 @@ public class PrcOrderBillServiceImpl implements IPrcOrderBillService
bill.setDestPostcode(request.getDestPostcode());
bill.setWarehouseCode(request.getWarehouseCode());
bill.setOrderTime(request.getOrderTime());
bill.setPickupDate(request.getPickupDate());
bill.setOrderRemark(request.getOrderRemark());
bill.setProductCode(result.getProductCode());
bill.setProductName(result.getProductName());
@@ -1878,23 +1873,22 @@ public class PrcOrderBillServiceImpl implements IPrcOrderBillService
return r;
}
/** Persist prc_order_ext when upstream TAB_ORDER row exists. Requires bill.orderId (parent wires prc_order first). */
/** 仅在存在上游 TAB_ORDER 行时写入 prc_order_bill_ext。 */
private void persistBillExt(PrcOrderBill bill, java.util.Map<String, Object> upstreamRow)
{
if (bill == null || StringUtils.isEmpty(bill.getOrderId()))
if (bill == null || StringUtils.isEmpty(bill.getBillId()))
{
// skip ext persist until orderId is set (parent will wire order first)
return;
}
if (upstreamRow == null || upstreamRow.isEmpty())
{
return;
}
PrcOrderExt ext = new PrcOrderExt();
ext.setOrderId(bill.getOrderId());
PrcOrderBillExt ext = new PrcOrderBillExt();
ext.setBillId(bill.getBillId());
ext.setOrderNo(bill.getOrderNo());
OracleOrderExtFiller.fillFromRow(ext, upstreamRow);
orderExtMapper.upsertPrcOrderExt(ext);
OracleOrderBillExtFiller.fillFromRow(ext, upstreamRow);
orderBillExtMapper.upsertPrcOrderBillExt(ext);
}
private List<TmsPriceQuoteFeeLine> toIncomeFeeLines(List<PrcIncomeBillFee> fees)
@@ -1,108 +0,0 @@
package com.bms.price.service.impl;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.UUID;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import com.bms.common.exception.ServiceException;
import com.bms.common.utils.DateUtils;
import com.bms.common.utils.StringUtils;
import com.bms.price.domain.PrcOrder;
import com.bms.price.domain.PrcOrderExt;
import com.bms.price.domain.vo.TmsPriceBillRequest;
import com.bms.price.enums.BillTaskSuccessStatus;
import com.bms.price.mapper.PrcOrderExtMapper;
import com.bms.price.mapper.PrcOrderMapper;
import com.bms.price.oracle.OracleOrderExtFiller;
import com.bms.price.oracle.OracleOrderFiller;
import com.bms.price.service.IPrcOrderService;
@Service
public class PrcOrderServiceImpl implements IPrcOrderService
{
@Autowired
private PrcOrderMapper prcOrderMapper;
@Autowired
private PrcOrderExtMapper prcOrderExtMapper;
@Override
public PrcOrder selectPrcOrderById(String orderId)
{
return prcOrderMapper.selectPrcOrderById(orderId);
}
@Override
public PrcOrder selectPrcOrderByTransferNo(String transferNo)
{
return prcOrderMapper.selectPrcOrderByTransferNo(transferNo);
}
@Override
public List<PrcOrder> selectPrcOrderList(PrcOrder query)
{
return prcOrderMapper.selectPrcOrderList(query);
}
@Override
@Transactional(rollbackFor = Exception.class)
public PrcOrder upsertFromUpstream(Map<String, Object> upstreamRow, TmsPriceBillRequest billReq, Date bizDate)
{
if (upstreamRow == null || upstreamRow.isEmpty())
{
throw new ServiceException("upstream order row required");
}
PrcOrder order = new PrcOrder();
OracleOrderFiller.fillFromRow(order, upstreamRow, billReq, bizDate);
if (StringUtils.isEmpty(order.getTransferNo()))
{
throw new ServiceException("transferNo required for prc_order upsert");
}
if (StringUtils.isEmpty(order.getOrderNo()))
{
throw new ServiceException("orderNo required for prc_order upsert");
}
Date now = DateUtils.getNowDate();
PrcOrder existing = prcOrderMapper.selectPrcOrderByTransferNo(order.getTransferNo());
if (existing != null && StringUtils.isNotEmpty(existing.getOrderId()))
{
order.setOrderId(existing.getOrderId());
order.setUpdateTime(now);
// keep prior status unless caller resets; default WAITING on re-sync before bill
order.setSuccessStatus(BillTaskSuccessStatus.WAITING.getCode());
order.setFailCode(null);
prcOrderMapper.updatePrcOrder(order);
}
else
{
order.setOrderId(UUID.randomUUID().toString());
order.setSuccessStatus(BillTaskSuccessStatus.WAITING.getCode());
order.setFailCode(null);
order.setCreateTime(now);
order.setUpdateTime(now);
prcOrderMapper.insertPrcOrder(order);
}
PrcOrderExt ext = new PrcOrderExt();
ext.setOrderId(order.getOrderId());
ext.setOrderNo(order.getOrderNo());
OracleOrderExtFiller.fillFromRow(ext, upstreamRow);
ext.setCreateTime(now);
ext.setUpdateTime(now);
prcOrderExtMapper.upsertPrcOrderExt(ext);
return order;
}
@Override
public void updateBillingStatus(String orderId, String successStatus, String failCode)
{
if (StringUtils.isEmpty(orderId))
{
return;
}
prcOrderMapper.updateBillingStatus(orderId, successStatus, failCode, null);
}
}
@@ -108,10 +108,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
limit #{limit}
</select>
<delete id="deleteByTransferNo" parameterType="String">
delete from prc_billing_task where transfer_no = #{transferNo}
</delete>
<insert id="insertPrcBillingTask" parameterType="PrcBillingTask" useGeneratedKeys="true" keyProperty="taskId">
insert into prc_billing_task (
transfer_no, tracking_no, order_no, customer_code, bill_type, success_status,
@@ -2,10 +2,10 @@
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.bms.price.mapper.PrcOrderExtMapper">
<mapper namespace="com.bms.price.mapper.PrcOrderBillExtMapper">
<resultMap type="PrcOrderExt" id="PrcOrderExtResult">
<id property="orderId" column="order_id" />
<resultMap type="PrcOrderBillExt" id="PrcOrderBillExtResult">
<id property="billId" column="bill_id" />
<result property="orderNo" column="order_no" />
<result property="upstreamId" column="upstream_id" />
<result property="lineNo" column="line_no" />
@@ -63,6 +63,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="importState" column="import_state" />
<result property="importCountry" column="import_country" />
<result property="buyerid" column="buyerid" />
<result property="orderStatus" column="order_status" />
<result property="createAt" column="create_at" />
<result property="payType" column="pay_type" />
<result property="lineCode" column="line_code" />
@@ -70,6 +71,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="productType" column="product_type" />
<result property="lineType" column="line_type" />
<result property="cargoName" column="cargo_name" />
<result property="productFloorCode" column="product_floor_code" />
<result property="orderInsurance" column="order_insurance" />
<result property="productSumPrice" column="product_sum_price" />
<result property="productSum" column="product_sum" />
@@ -79,7 +81,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="productFloor" column="product_floor" />
<result property="latestTrajectory" column="latest_trajectory" />
<result property="wayBill" column="way_bill" />
<result property="pickupDate" column="pickup_date" />
<result property="blBaging" column="bl_baging" />
<result property="blPickup" column="bl_pickup" />
<result property="bagDate" column="bag_date" />
<result property="orgOrderStatus" column="org_order_status" />
<result property="statusDescription" column="status_description" />
@@ -145,6 +149,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="trackQueryTime" column="track_query_time" />
<result property="airConfirmTime" column="air_confirm_time" />
<result property="packageType" column="package_type" />
<result property="dimensionalWeightFactor" column="dimensional_weight_factor" />
<result property="updateBy" column="update_by" />
<result property="customerPickupSite" column="customer_pickup_site" />
<result property="barcodeNumber" column="barcode_number" />
@@ -176,26 +181,26 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="updateTime" column="update_time" />
</resultMap>
<sql id="selectPrcOrderExtVo">
select order_id, order_no, upstream_id, line_no, package_num, actual_volume, cp_type, consignee_mobile, order_returnsign, trade_type, duty_type, battery_type, consignee_companyname, consignee_address, consignee_telephone, consignee_state, consignee_city, consignee_suburb, consignee_passportno, consignee_email, consignee_taxno, consignee_taxnotype, consignee_taxnocountry, consignee_streetno, consignee_doorno, shipper_taxnotype, shipper_taxno, shipper_taxnocountry, customer_id, product_imagepath, order_transactionurl, order_cargoamount, cargo_type, shipper_companyname, shipper_address1, shipper_address2, shipper_address3, shipper_city, shipper_state, shipper_postcode, shipper_country, shipper_telephone, shipper_suburb, shipper_email, shipper_passportno, import_code, import_name, import_companyname, import_address, import_address2, import_address3, import_telephone, import_email, import_postcode, import_city, import_state, import_country, buyerid, create_at, pay_type, line_code, line_name, product_type, line_type, cargo_name, order_insurance, product_sum_price, product_sum, shipper_doorno, tariff_payment_account, topayment, product_floor, latest_trajectory, way_bill, bl_baging, bag_date, org_order_status, status_description, zz_date, shipping_date, order_type, receiving_photo, freight, is_receivable, is_meet, bill_no_receivable, bill_no_meet, country_eingth_name, is_receivable_fee, settlement_fee, product_id, service_freight, is_pay_fee, has_added_surcharge, yf_fee, yf_totail_fee, trajectory_status, cargo_type_name, service_code, three_code, volume_height_old, volume_length_old, volume_width_old, register_man_old, bag_no_old, air_no_old, box_sizi_old, baging_man_old, retrieval_man_old, invoice_amount_old, invoice_title_old, invoice_weight_old, sku_old, hs_code_old, register_date_old, invoice_currency_old, trajectory_sub_state, sign_in_time, warehouse_time, declaration_time, release_time, station_time, takeoff_time, landing_time, clearance_and_delivery_time, supplier_name, credit_code, other_id, platform_code, sync_shipment_status, update_weight, other_bag_no, bag_flag, online_time, outbound_time, air_confirm_date, shipment_type, track_query_time, air_confirm_time, package_type, update_by, customer_pickup_site, barcode_number, tracking_reflect_status, remote_postcode, clearance_time, arrive_stock_time, departure_time, first_deliver_time, hs_code_tax_count, hs_code_tax_amount, hs_code_tax_currency, invoice_url, clearance_no, push_weight, internal_check_time, air_delay_time, first_landing_time, second_takeoff_time, des_port_check_time, stay_remark, miss_box_remark, product_channel_id, customer_track_id, register_site, package_type_financial, mrn, create_time, update_time
from prc_order_ext
<sql id="selectPrcOrderBillExtVo">
select bill_id, order_no, upstream_id, line_no, package_num, actual_volume, cp_type, consignee_mobile, order_returnsign, trade_type, duty_type, battery_type, consignee_companyname, consignee_address, consignee_telephone, consignee_state, consignee_city, consignee_suburb, consignee_passportno, consignee_email, consignee_taxno, consignee_taxnotype, consignee_taxnocountry, consignee_streetno, consignee_doorno, shipper_taxnotype, shipper_taxno, shipper_taxnocountry, customer_id, product_imagepath, order_transactionurl, order_cargoamount, cargo_type, shipper_companyname, shipper_address1, shipper_address2, shipper_address3, shipper_city, shipper_state, shipper_postcode, shipper_country, shipper_telephone, shipper_suburb, shipper_email, shipper_passportno, import_code, import_name, import_companyname, import_address, import_address2, import_address3, import_telephone, import_email, import_postcode, import_city, import_state, import_country, buyerid, order_status, create_at, pay_type, line_code, line_name, product_type, line_type, cargo_name, product_floor_code, order_insurance, product_sum_price, product_sum, shipper_doorno, tariff_payment_account, topayment, product_floor, latest_trajectory, way_bill, pickup_date, bl_baging, bl_pickup, bag_date, org_order_status, status_description, zz_date, shipping_date, order_type, receiving_photo, freight, is_receivable, is_meet, bill_no_receivable, bill_no_meet, country_eingth_name, is_receivable_fee, settlement_fee, product_id, service_freight, is_pay_fee, has_added_surcharge, yf_fee, yf_totail_fee, trajectory_status, cargo_type_name, service_code, three_code, volume_height_old, volume_length_old, volume_width_old, register_man_old, bag_no_old, air_no_old, box_sizi_old, baging_man_old, retrieval_man_old, invoice_amount_old, invoice_title_old, invoice_weight_old, sku_old, hs_code_old, register_date_old, invoice_currency_old, trajectory_sub_state, sign_in_time, warehouse_time, declaration_time, release_time, station_time, takeoff_time, landing_time, clearance_and_delivery_time, supplier_name, credit_code, other_id, platform_code, sync_shipment_status, update_weight, other_bag_no, bag_flag, online_time, outbound_time, air_confirm_date, shipment_type, track_query_time, air_confirm_time, package_type, dimensional_weight_factor, update_by, customer_pickup_site, barcode_number, tracking_reflect_status, remote_postcode, clearance_time, arrive_stock_time, departure_time, first_deliver_time, hs_code_tax_count, hs_code_tax_amount, hs_code_tax_currency, invoice_url, clearance_no, push_weight, internal_check_time, air_delay_time, first_landing_time, second_takeoff_time, des_port_check_time, stay_remark, miss_box_remark, product_channel_id, customer_track_id, register_site, package_type_financial, mrn, create_time, update_time
from prc_order_bill_ext
</sql>
<select id="selectByOrderId" parameterType="String" resultMap="PrcOrderExtResult">
<include refid="selectPrcOrderExtVo"/>
where order_id = #{orderId}
<select id="selectByBillId" parameterType="String" resultMap="PrcOrderBillExtResult">
<include refid="selectPrcOrderBillExtVo"/>
where bill_id = #{billId}
</select>
<select id="selectByOrderNo" parameterType="String" resultMap="PrcOrderExtResult">
<include refid="selectPrcOrderExtVo"/>
<select id="selectByOrderNo" parameterType="String" resultMap="PrcOrderBillExtResult">
<include refid="selectPrcOrderBillExtVo"/>
where order_no = #{orderNo}
</select>
<insert id="insertPrcOrderExt" parameterType="PrcOrderExt">
insert into prc_order_ext (
order_id, order_no, upstream_id, line_no, package_num, actual_volume, cp_type, consignee_mobile, order_returnsign, trade_type, duty_type, battery_type, consignee_companyname, consignee_address, consignee_telephone, consignee_state, consignee_city, consignee_suburb, consignee_passportno, consignee_email, consignee_taxno, consignee_taxnotype, consignee_taxnocountry, consignee_streetno, consignee_doorno, shipper_taxnotype, shipper_taxno, shipper_taxnocountry, customer_id, product_imagepath, order_transactionurl, order_cargoamount, cargo_type, shipper_companyname, shipper_address1, shipper_address2, shipper_address3, shipper_city, shipper_state, shipper_postcode, shipper_country, shipper_telephone, shipper_suburb, shipper_email, shipper_passportno, import_code, import_name, import_companyname, import_address, import_address2, import_address3, import_telephone, import_email, import_postcode, import_city, import_state, import_country, buyerid, create_at, pay_type, line_code, line_name, product_type, line_type, cargo_name, order_insurance, product_sum_price, product_sum, shipper_doorno, tariff_payment_account, topayment, product_floor, latest_trajectory, way_bill, bl_baging, bag_date, org_order_status, status_description, zz_date, shipping_date, order_type, receiving_photo, freight, is_receivable, is_meet, bill_no_receivable, bill_no_meet, country_eingth_name, is_receivable_fee, settlement_fee, product_id, service_freight, is_pay_fee, has_added_surcharge, yf_fee, yf_totail_fee, trajectory_status, cargo_type_name, service_code, three_code, volume_height_old, volume_length_old, volume_width_old, register_man_old, bag_no_old, air_no_old, box_sizi_old, baging_man_old, retrieval_man_old, invoice_amount_old, invoice_title_old, invoice_weight_old, sku_old, hs_code_old, register_date_old, invoice_currency_old, trajectory_sub_state, sign_in_time, warehouse_time, declaration_time, release_time, station_time, takeoff_time, landing_time, clearance_and_delivery_time, supplier_name, credit_code, other_id, platform_code, sync_shipment_status, update_weight, other_bag_no, bag_flag, online_time, outbound_time, air_confirm_date, shipment_type, track_query_time, air_confirm_time, package_type, update_by, customer_pickup_site, barcode_number, tracking_reflect_status, remote_postcode, clearance_time, arrive_stock_time, departure_time, first_deliver_time, hs_code_tax_count, hs_code_tax_amount, hs_code_tax_currency, invoice_url, clearance_no, push_weight, internal_check_time, air_delay_time, first_landing_time, second_takeoff_time, des_port_check_time, stay_remark, miss_box_remark, product_channel_id, customer_track_id, register_site, package_type_financial, mrn, create_time
<insert id="insertPrcOrderBillExt" parameterType="PrcOrderBillExt">
insert into prc_order_bill_ext (
bill_id, order_no, upstream_id, line_no, package_num, actual_volume, cp_type, consignee_mobile, order_returnsign, trade_type, duty_type, battery_type, consignee_companyname, consignee_address, consignee_telephone, consignee_state, consignee_city, consignee_suburb, consignee_passportno, consignee_email, consignee_taxno, consignee_taxnotype, consignee_taxnocountry, consignee_streetno, consignee_doorno, shipper_taxnotype, shipper_taxno, shipper_taxnocountry, customer_id, product_imagepath, order_transactionurl, order_cargoamount, cargo_type, shipper_companyname, shipper_address1, shipper_address2, shipper_address3, shipper_city, shipper_state, shipper_postcode, shipper_country, shipper_telephone, shipper_suburb, shipper_email, shipper_passportno, import_code, import_name, import_companyname, import_address, import_address2, import_address3, import_telephone, import_email, import_postcode, import_city, import_state, import_country, buyerid, order_status, create_at, pay_type, line_code, line_name, product_type, line_type, cargo_name, product_floor_code, order_insurance, product_sum_price, product_sum, shipper_doorno, tariff_payment_account, topayment, product_floor, latest_trajectory, way_bill, pickup_date, bl_baging, bl_pickup, bag_date, org_order_status, status_description, zz_date, shipping_date, order_type, receiving_photo, freight, is_receivable, is_meet, bill_no_receivable, bill_no_meet, country_eingth_name, is_receivable_fee, settlement_fee, product_id, service_freight, is_pay_fee, has_added_surcharge, yf_fee, yf_totail_fee, trajectory_status, cargo_type_name, service_code, three_code, volume_height_old, volume_length_old, volume_width_old, register_man_old, bag_no_old, air_no_old, box_sizi_old, baging_man_old, retrieval_man_old, invoice_amount_old, invoice_title_old, invoice_weight_old, sku_old, hs_code_old, register_date_old, invoice_currency_old, trajectory_sub_state, sign_in_time, warehouse_time, declaration_time, release_time, station_time, takeoff_time, landing_time, clearance_and_delivery_time, supplier_name, credit_code, other_id, platform_code, sync_shipment_status, update_weight, other_bag_no, bag_flag, online_time, outbound_time, air_confirm_date, shipment_type, track_query_time, air_confirm_time, package_type, dimensional_weight_factor, update_by, customer_pickup_site, barcode_number, tracking_reflect_status, remote_postcode, clearance_time, arrive_stock_time, departure_time, first_deliver_time, hs_code_tax_count, hs_code_tax_amount, hs_code_tax_currency, invoice_url, clearance_no, push_weight, internal_check_time, air_delay_time, first_landing_time, second_takeoff_time, des_port_check_time, stay_remark, miss_box_remark, product_channel_id, customer_track_id, register_site, package_type_financial, mrn, create_time
) values (
#{orderId},
#{billId},
#{orderNo},
#{upstreamId},
#{lineNo},
@@ -253,6 +258,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
#{importState},
#{importCountry},
#{buyerid},
#{orderStatus},
#{createAt},
#{payType},
#{lineCode},
@@ -260,6 +266,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
#{productType},
#{lineType},
#{cargoName},
#{productFloorCode},
#{orderInsurance},
#{productSumPrice},
#{productSum},
@@ -269,7 +276,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
#{productFloor},
#{latestTrajectory},
#{wayBill},
#{pickupDate},
#{blBaging},
#{blPickup},
#{bagDate},
#{orgOrderStatus},
#{statusDescription},
@@ -335,6 +344,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
#{trackQueryTime},
#{airConfirmTime},
#{packageType},
#{dimensionalWeightFactor},
#{updateBy},
#{customerPickupSite},
#{barcodeNumber},
@@ -366,11 +376,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
)
</insert>
<insert id="upsertPrcOrderExt" parameterType="PrcOrderExt">
insert into prc_order_ext (
order_id, order_no, upstream_id, line_no, package_num, actual_volume, cp_type, consignee_mobile, order_returnsign, trade_type, duty_type, battery_type, consignee_companyname, consignee_address, consignee_telephone, consignee_state, consignee_city, consignee_suburb, consignee_passportno, consignee_email, consignee_taxno, consignee_taxnotype, consignee_taxnocountry, consignee_streetno, consignee_doorno, shipper_taxnotype, shipper_taxno, shipper_taxnocountry, customer_id, product_imagepath, order_transactionurl, order_cargoamount, cargo_type, shipper_companyname, shipper_address1, shipper_address2, shipper_address3, shipper_city, shipper_state, shipper_postcode, shipper_country, shipper_telephone, shipper_suburb, shipper_email, shipper_passportno, import_code, import_name, import_companyname, import_address, import_address2, import_address3, import_telephone, import_email, import_postcode, import_city, import_state, import_country, buyerid, create_at, pay_type, line_code, line_name, product_type, line_type, cargo_name, order_insurance, product_sum_price, product_sum, shipper_doorno, tariff_payment_account, topayment, product_floor, latest_trajectory, way_bill, bl_baging, bag_date, org_order_status, status_description, zz_date, shipping_date, order_type, receiving_photo, freight, is_receivable, is_meet, bill_no_receivable, bill_no_meet, country_eingth_name, is_receivable_fee, settlement_fee, product_id, service_freight, is_pay_fee, has_added_surcharge, yf_fee, yf_totail_fee, trajectory_status, cargo_type_name, service_code, three_code, volume_height_old, volume_length_old, volume_width_old, register_man_old, bag_no_old, air_no_old, box_sizi_old, baging_man_old, retrieval_man_old, invoice_amount_old, invoice_title_old, invoice_weight_old, sku_old, hs_code_old, register_date_old, invoice_currency_old, trajectory_sub_state, sign_in_time, warehouse_time, declaration_time, release_time, station_time, takeoff_time, landing_time, clearance_and_delivery_time, supplier_name, credit_code, other_id, platform_code, sync_shipment_status, update_weight, other_bag_no, bag_flag, online_time, outbound_time, air_confirm_date, shipment_type, track_query_time, air_confirm_time, package_type, update_by, customer_pickup_site, barcode_number, tracking_reflect_status, remote_postcode, clearance_time, arrive_stock_time, departure_time, first_deliver_time, hs_code_tax_count, hs_code_tax_amount, hs_code_tax_currency, invoice_url, clearance_no, push_weight, internal_check_time, air_delay_time, first_landing_time, second_takeoff_time, des_port_check_time, stay_remark, miss_box_remark, product_channel_id, customer_track_id, register_site, package_type_financial, mrn, create_time
<insert id="upsertPrcOrderBillExt" parameterType="PrcOrderBillExt">
insert into prc_order_bill_ext (
bill_id, order_no, upstream_id, line_no, package_num, actual_volume, cp_type, consignee_mobile, order_returnsign, trade_type, duty_type, battery_type, consignee_companyname, consignee_address, consignee_telephone, consignee_state, consignee_city, consignee_suburb, consignee_passportno, consignee_email, consignee_taxno, consignee_taxnotype, consignee_taxnocountry, consignee_streetno, consignee_doorno, shipper_taxnotype, shipper_taxno, shipper_taxnocountry, customer_id, product_imagepath, order_transactionurl, order_cargoamount, cargo_type, shipper_companyname, shipper_address1, shipper_address2, shipper_address3, shipper_city, shipper_state, shipper_postcode, shipper_country, shipper_telephone, shipper_suburb, shipper_email, shipper_passportno, import_code, import_name, import_companyname, import_address, import_address2, import_address3, import_telephone, import_email, import_postcode, import_city, import_state, import_country, buyerid, order_status, create_at, pay_type, line_code, line_name, product_type, line_type, cargo_name, product_floor_code, order_insurance, product_sum_price, product_sum, shipper_doorno, tariff_payment_account, topayment, product_floor, latest_trajectory, way_bill, pickup_date, bl_baging, bl_pickup, bag_date, org_order_status, status_description, zz_date, shipping_date, order_type, receiving_photo, freight, is_receivable, is_meet, bill_no_receivable, bill_no_meet, country_eingth_name, is_receivable_fee, settlement_fee, product_id, service_freight, is_pay_fee, has_added_surcharge, yf_fee, yf_totail_fee, trajectory_status, cargo_type_name, service_code, three_code, volume_height_old, volume_length_old, volume_width_old, register_man_old, bag_no_old, air_no_old, box_sizi_old, baging_man_old, retrieval_man_old, invoice_amount_old, invoice_title_old, invoice_weight_old, sku_old, hs_code_old, register_date_old, invoice_currency_old, trajectory_sub_state, sign_in_time, warehouse_time, declaration_time, release_time, station_time, takeoff_time, landing_time, clearance_and_delivery_time, supplier_name, credit_code, other_id, platform_code, sync_shipment_status, update_weight, other_bag_no, bag_flag, online_time, outbound_time, air_confirm_date, shipment_type, track_query_time, air_confirm_time, package_type, dimensional_weight_factor, update_by, customer_pickup_site, barcode_number, tracking_reflect_status, remote_postcode, clearance_time, arrive_stock_time, departure_time, first_deliver_time, hs_code_tax_count, hs_code_tax_amount, hs_code_tax_currency, invoice_url, clearance_no, push_weight, internal_check_time, air_delay_time, first_landing_time, second_takeoff_time, des_port_check_time, stay_remark, miss_box_remark, product_channel_id, customer_track_id, register_site, package_type_financial, mrn, create_time
) values (
#{orderId},
#{billId},
#{orderNo},
#{upstreamId},
#{lineNo},
@@ -428,6 +438,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
#{importState},
#{importCountry},
#{buyerid},
#{orderStatus},
#{createAt},
#{payType},
#{lineCode},
@@ -435,6 +446,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
#{productType},
#{lineType},
#{cargoName},
#{productFloorCode},
#{orderInsurance},
#{productSumPrice},
#{productSum},
@@ -444,7 +456,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
#{productFloor},
#{latestTrajectory},
#{wayBill},
#{pickupDate},
#{blBaging},
#{blPickup},
#{bagDate},
#{orgOrderStatus},
#{statusDescription},
@@ -510,6 +524,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
#{trackQueryTime},
#{airConfirmTime},
#{packageType},
#{dimensionalWeightFactor},
#{updateBy},
#{customerPickupSite},
#{barcodeNumber},
@@ -597,6 +612,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
import_state = values(import_state),
import_country = values(import_country),
buyerid = values(buyerid),
order_status = values(order_status),
create_at = values(create_at),
pay_type = values(pay_type),
line_code = values(line_code),
@@ -604,6 +620,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
product_type = values(product_type),
line_type = values(line_type),
cargo_name = values(cargo_name),
product_floor_code = values(product_floor_code),
order_insurance = values(order_insurance),
product_sum_price = values(product_sum_price),
product_sum = values(product_sum),
@@ -613,7 +630,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
product_floor = values(product_floor),
latest_trajectory = values(latest_trajectory),
way_bill = values(way_bill),
pickup_date = values(pickup_date),
bl_baging = values(bl_baging),
bl_pickup = values(bl_pickup),
bag_date = values(bag_date),
org_order_status = values(org_order_status),
status_description = values(status_description),
@@ -679,6 +698,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
track_query_time = values(track_query_time),
air_confirm_time = values(air_confirm_time),
package_type = values(package_type),
dimensional_weight_factor = values(dimensional_weight_factor),
update_by = values(update_by),
customer_pickup_site = values(customer_pickup_site),
barcode_number = values(barcode_number),
@@ -8,7 +8,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<resultMap type="PrcOrderBill" id="PrcOrderBillResult">
<id property="billId" column="bill_id" />
<result property="orderId" column="order_id" />
<result property="billKey" column="bill_key" />
<result property="orderNo" column="order_no" />
<result property="trackingNo" column="tracking_no" />
@@ -35,7 +34,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="destPostcode" column="dest_postcode" />
<result property="warehouseCode" column="warehouse_code" />
<result property="orderTime" column="order_time" />
<result property="pickupDate" column="pickup_date" />
<result property="orderRemark" column="order_remark" />
<result property="productCode" column="product_code" />
<result property="productName" column="product_name" />
@@ -82,14 +80,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</resultMap>
<resultMap type="PrcOrderBill" id="PrcOrderBillArSourceResult" extends="PrcOrderBillResult">
<result property="pickupDate" column="pickup_date"/>
</resultMap>
<sql id="selectPrcOrderBillVo">
select bill_id, order_id, bill_key, order_no, tracking_no, transfer_no,
select bill_id, bill_key, order_no, tracking_no, transfer_no,
belong_saler, belong_saler_code, settlement_man, settlement_man_code, service_man, service_man_code,
customer_id, customer_code, customer_name,
pieces, actual_weight, receive_weight, volume, volume_weight, pkg_length, pkg_width, pkg_height,
shipper_name, consignee_name, dest_postcode, warehouse_code, order_time, pickup_date, order_remark,
shipper_name, consignee_name, dest_postcode, warehouse_code, order_time, order_remark,
product_code, product_name, country_code, country_name, weight, biz_date, tms_id,
match_source, match_message, price_set_id, price_set_code, price_set_name,
set_type, bind_priority, customer_priceset_id, psv_id, psd_id, product_country_id,
@@ -103,11 +102,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<!-- 应收生成专用来源快照:income_total 只汇总当前仍未出账的费用。 -->
<sql id="selectArBillSourceVo">
select p.bill_id, p.order_id, p.bill_key, p.order_no, p.tracking_no, p.transfer_no,
select p.bill_id, p.bill_key, p.order_no, p.tracking_no, p.transfer_no,
p.belong_saler, p.belong_saler_code, p.settlement_man, p.settlement_man_code, p.service_man, p.service_man_code,
p.customer_id, p.customer_code, p.customer_name,
p.pieces, p.actual_weight, p.receive_weight, p.volume, p.volume_weight, p.pkg_length, p.pkg_width, p.pkg_height,
p.shipper_name, p.consignee_name, p.dest_postcode, p.warehouse_code, p.order_time, p.pickup_date, p.order_remark,
p.shipper_name, p.consignee_name, p.dest_postcode, p.warehouse_code, p.order_time, e.pickup_date, p.order_remark,
p.product_code, p.product_name, p.country_code, p.country_name, p.weight, p.biz_date, p.tms_id,
p.match_source, p.match_message, p.price_set_id, p.price_set_code, p.price_set_name,
p.set_type, p.bind_priority, p.customer_priceset_id, p.psv_id, p.psd_id, p.product_country_id,
@@ -122,6 +121,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
p.customer_active_status, p.credit_arrears_status, p.refund_status, p.billing_fail_status, p.round_mode,
p.created_by, p.create_time, p.updated_by, p.update_time
from prc_order_bill p
left join prc_order_bill_ext e on e.bill_id = p.bill_id
</sql>
<select id="selectPrcOrderBillByOrderNo" parameterType="String" resultMap="PrcOrderBillResult">
@@ -540,11 +540,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<insert id="insertPrcOrderBill" parameterType="PrcOrderBill">
insert into prc_order_bill (
bill_id, order_id, bill_key, order_no, tracking_no, transfer_no,
bill_id, bill_key, order_no, tracking_no, transfer_no,
belong_saler, belong_saler_code, settlement_man, settlement_man_code, service_man, service_man_code,
customer_id, customer_code, customer_name,
pieces, actual_weight, receive_weight, volume, volume_weight, pkg_length, pkg_width, pkg_height,
shipper_name, consignee_name, dest_postcode, warehouse_code, order_time, pickup_date, order_remark,
shipper_name, consignee_name, dest_postcode, warehouse_code, order_time, order_remark,
product_code, product_name, country_code, country_name, weight, biz_date, tms_id,
match_source, match_message, price_set_id, price_set_code, price_set_name,
set_type, bind_priority, customer_priceset_id, psv_id, psd_id, product_country_id,
@@ -554,11 +554,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
customer_active_status, credit_arrears_status, refund_status, billing_fail_status, round_mode,
create_time
) values (
#{billId}, #{orderId}, #{billKey}, #{orderNo}, #{trackingNo}, #{transferNo},
#{billId}, #{billKey}, #{orderNo}, #{trackingNo}, #{transferNo},
#{belongSaler}, #{belongSalerCode}, #{settlementMan}, #{settlementManCode}, #{serviceMan}, #{serviceManCode},
#{customerId}, #{customerCode}, #{customerName},
#{pieces}, #{actualWeight}, #{receiveWeight}, #{volume}, #{volumeWeight}, #{pkgLength}, #{pkgWidth}, #{pkgHeight},
#{shipperName}, #{consigneeName}, #{destPostcode}, #{warehouseCode}, #{orderTime}, #{pickupDate}, #{orderRemark},
#{shipperName}, #{consigneeName}, #{destPostcode}, #{warehouseCode}, #{orderTime}, #{orderRemark},
#{productCode}, #{productName}, #{countryCode}, #{countryName}, #{weight}, #{bizDate}, #{tmsId},
#{matchSource}, #{matchMessage}, #{priceSetId}, #{priceSetCode}, #{priceSetName},
#{setType}, #{bindPriority}, #{customerPricesetId}, #{psvId}, #{psdId}, #{productCountryId},
@@ -573,7 +573,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<update id="updatePrcOrderBill" parameterType="PrcOrderBill">
update prc_order_bill
set bill_key = #{billKey},
order_id = #{orderId},
tracking_no = #{trackingNo},
transfer_no = #{transferNo},
belong_saler = #{belongSaler},
@@ -598,7 +597,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
dest_postcode = #{destPostcode},
warehouse_code = #{warehouseCode},
order_time = #{orderTime},
pickup_date = #{pickupDate},
order_remark = #{orderRemark},
product_code = #{productCode},
product_name = #{productName},
@@ -1,259 +0,0 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.bms.price.mapper.PrcOrderMapper">
<resultMap type="PrcOrder" id="PrcOrderResult">
<id property="orderId" column="order_id" />
<result property="orderNo" column="order_no" />
<result property="trackingNo" column="tracking_no" />
<result property="transferNo" column="transfer_no" />
<result property="trackId" column="track_id" />
<result property="belongSaler" column="belong_saler" />
<result property="belongSalerCode" column="belong_saler_code" />
<result property="settlementMan" column="settlement_man" />
<result property="settlementManCode" column="settlement_man_code" />
<result property="serviceMan" column="service_man" />
<result property="serviceManCode" column="service_man_code" />
<result property="customerCode" column="customer_code" />
<result property="customerName" column="customer_name" />
<result property="pieces" column="pieces" />
<result property="actualWeight" column="actual_weight" />
<result property="weight" column="weight" />
<result property="dimensionalWeightFactor" column="dimensional_weight_factor" />
<result property="volume" column="volume" />
<result property="volumeWeight" column="volume_weight" />
<result property="pkgLength" column="pkg_length" />
<result property="pkgWidth" column="pkg_width" />
<result property="pkgHeight" column="pkg_height" />
<result property="shipperName" column="shipper_name" />
<result property="consigneeName" column="consignee_name" />
<result property="consigneePostcode" column="consignee_postcode" />
<result property="warehouseCode" column="warehouse_code" />
<result property="orderTime" column="order_time" />
<result property="orderRemark" column="order_remark" />
<result property="productCode" column="product_code" />
<result property="productName" column="product_name" />
<result property="productFloorCode" column="product_floor_code" />
<result property="countryCode" column="country_code" />
<result property="countryName" column="country_name" />
<result property="orderStatus" column="order_status" />
<result property="blPickup" column="bl_pickup" />
<result property="pickupDate" column="pickup_date" />
<result property="bizDate" column="biz_date" />
<result property="successStatus" column="success_status" />
<result property="failCode" column="fail_code" />
<result property="createBy" column="created_by" />
<result property="createTime" column="create_time" />
<result property="updateBy" column="updated_by" />
<result property="updateTime" column="update_time" />
</resultMap>
<sql id="selectPrcOrderVo">
select order_id, order_no, tracking_no, transfer_no, track_id,
belong_saler, belong_saler_code, settlement_man, settlement_man_code, service_man, service_man_code,
customer_code, customer_name, pieces, actual_weight, weight, dimensional_weight_factor,
volume, volume_weight, pkg_length, pkg_width, pkg_height,
shipper_name, consignee_name, consignee_postcode, warehouse_code,
order_time, order_remark, product_code, product_name, product_floor_code,
country_code, country_name, order_status, bl_pickup, pickup_date, biz_date,
success_status, fail_code, created_by, create_time, updated_by, update_time
from prc_order
</sql>
<select id="selectPrcOrderById" parameterType="String" resultMap="PrcOrderResult">
<include refid="selectPrcOrderVo"/>
where order_id = #{orderId}
</select>
<select id="selectPrcOrderByTransferNo" parameterType="String" resultMap="PrcOrderResult">
<include refid="selectPrcOrderVo"/>
where transfer_no = #{transferNo}
</select>
<select id="selectPrcOrderByOrderNo" parameterType="String" resultMap="PrcOrderResult">
<include refid="selectPrcOrderVo"/>
where order_no = #{orderNo}
</select>
<select id="selectPrcOrderList" parameterType="PrcOrder" resultMap="PrcOrderResult">
<include refid="selectPrcOrderVo"/>
<where>
<if test="transferNo != null and transferNo != ''">
AND transfer_no like concat('%', #{transferNo}, '%')
</if>
<if test="transferNos != null and transferNos.size() &gt; 0">
AND transfer_no in
<foreach collection="transferNos" item="n" open="(" separator="," close=")">#{n}</foreach>
</if>
<if test="trackingNo != null and trackingNo != ''">
AND tracking_no like concat('%', #{trackingNo}, '%')
</if>
<if test="orderNo != null and orderNo != ''">
AND order_no like concat('%', #{orderNo}, '%')
</if>
<if test="customerCode != null and customerCode != ''">
AND customer_code like concat('%', #{customerCode}, '%')
</if>
<if test="successStatus != null and successStatus != ''">
AND success_status = #{successStatus}
</if>
<if test="failCode != null and failCode != ''">
AND fail_code = #{failCode}
</if>
<if test="failCodes != null and failCodes.size() &gt; 0">
AND fail_code in
<foreach collection="failCodes" item="c" open="(" separator="," close=")">#{c}</foreach>
</if>
<if test="params.beginTime != null and params.beginTime != ''">
AND date_format(biz_date,'%Y%m%d') &gt;= date_format(#{params.beginTime},'%Y%m%d')
</if>
<if test="params.endTime != null and params.endTime != ''">
AND date_format(biz_date,'%Y%m%d') &lt;= date_format(#{params.endTime},'%Y%m%d')
</if>
</where>
order by create_time desc, order_id desc
</select>
<insert id="insertPrcOrder" parameterType="PrcOrder">
insert into prc_order (
order_id, order_no, tracking_no, transfer_no, track_id,
belong_saler, belong_saler_code, settlement_man, settlement_man_code, service_man, service_man_code,
customer_code, customer_name, pieces, actual_weight, weight, dimensional_weight_factor,
volume, volume_weight, pkg_length, pkg_width, pkg_height,
shipper_name, consignee_name, consignee_postcode, warehouse_code,
order_time, order_remark, product_code, product_name, product_floor_code,
country_code, country_name, order_status, bl_pickup, pickup_date, biz_date,
success_status, fail_code, created_by, create_time, updated_by, update_time
) values (
#{orderId}, #{orderNo}, #{trackingNo}, #{transferNo}, #{trackId},
#{belongSaler}, #{belongSalerCode}, #{settlementMan}, #{settlementManCode}, #{serviceMan}, #{serviceManCode},
#{customerCode}, #{customerName}, #{pieces}, #{actualWeight}, #{weight}, #{dimensionalWeightFactor},
#{volume}, #{volumeWeight}, #{pkgLength}, #{pkgWidth}, #{pkgHeight},
#{shipperName}, #{consigneeName}, #{consigneePostcode}, #{warehouseCode},
#{orderTime}, #{orderRemark}, #{productCode}, #{productName}, #{productFloorCode},
#{countryCode}, #{countryName}, #{orderStatus}, #{blPickup}, #{pickupDate}, #{bizDate},
#{successStatus}, #{failCode}, #{createBy}, #{createTime}, #{updateBy}, #{updateTime}
)
</insert>
<update id="updatePrcOrder" parameterType="PrcOrder">
update prc_order
<set>
order_no = #{orderNo},
tracking_no = #{trackingNo},
track_id = #{trackId},
belong_saler = #{belongSaler},
belong_saler_code = #{belongSalerCode},
settlement_man = #{settlementMan},
settlement_man_code = #{settlementManCode},
service_man = #{serviceMan},
service_man_code = #{serviceManCode},
customer_code = #{customerCode},
customer_name = #{customerName},
pieces = #{pieces},
actual_weight = #{actualWeight},
weight = #{weight},
dimensional_weight_factor = #{dimensionalWeightFactor},
volume = #{volume},
volume_weight = #{volumeWeight},
pkg_length = #{pkgLength},
pkg_width = #{pkgWidth},
pkg_height = #{pkgHeight},
shipper_name = #{shipperName},
consignee_name = #{consigneeName},
consignee_postcode = #{consigneePostcode},
warehouse_code = #{warehouseCode},
order_time = #{orderTime},
order_remark = #{orderRemark},
product_code = #{productCode},
product_name = #{productName},
product_floor_code = #{productFloorCode},
country_code = #{countryCode},
country_name = #{countryName},
order_status = #{orderStatus},
bl_pickup = #{blPickup},
pickup_date = #{pickupDate},
biz_date = #{bizDate},
success_status = #{successStatus},
fail_code = #{failCode},
updated_by = #{updateBy},
update_time = #{updateTime}
</set>
where order_id = #{orderId}
</update>
<!-- Upsert by unique transfer_no: insert new UUID or overwrite all upstream fields -->
<insert id="upsertPrcOrderByTransferNo" parameterType="PrcOrder">
insert into prc_order (
order_id, order_no, tracking_no, transfer_no, track_id,
belong_saler, belong_saler_code, settlement_man, settlement_man_code, service_man, service_man_code,
customer_code, customer_name, pieces, actual_weight, weight, dimensional_weight_factor,
volume, volume_weight, pkg_length, pkg_width, pkg_height,
shipper_name, consignee_name, consignee_postcode, warehouse_code,
order_time, order_remark, product_code, product_name, product_floor_code,
country_code, country_name, order_status, bl_pickup, pickup_date, biz_date,
success_status, fail_code, created_by, create_time, updated_by, update_time
) values (
#{orderId}, #{orderNo}, #{trackingNo}, #{transferNo}, #{trackId},
#{belongSaler}, #{belongSalerCode}, #{settlementMan}, #{settlementManCode}, #{serviceMan}, #{serviceManCode},
#{customerCode}, #{customerName}, #{pieces}, #{actualWeight}, #{weight}, #{dimensionalWeightFactor},
#{volume}, #{volumeWeight}, #{pkgLength}, #{pkgWidth}, #{pkgHeight},
#{shipperName}, #{consigneeName}, #{consigneePostcode}, #{warehouseCode},
#{orderTime}, #{orderRemark}, #{productCode}, #{productName}, #{productFloorCode},
#{countryCode}, #{countryName}, #{orderStatus}, #{blPickup}, #{pickupDate}, #{bizDate},
#{successStatus}, #{failCode}, #{createBy}, #{createTime}, #{updateBy}, #{updateTime}
)
on duplicate key update
order_id = values(order_id),
order_no = values(order_no),
tracking_no = values(tracking_no),
track_id = values(track_id),
belong_saler = values(belong_saler),
belong_saler_code = values(belong_saler_code),
settlement_man = values(settlement_man),
settlement_man_code = values(settlement_man_code),
service_man = values(service_man),
service_man_code = values(service_man_code),
customer_code = values(customer_code),
customer_name = values(customer_name),
pieces = values(pieces),
actual_weight = values(actual_weight),
weight = values(weight),
dimensional_weight_factor = values(dimensional_weight_factor),
volume = values(volume),
volume_weight = values(volume_weight),
pkg_length = values(pkg_length),
pkg_width = values(pkg_width),
pkg_height = values(pkg_height),
shipper_name = values(shipper_name),
consignee_name = values(consignee_name),
consignee_postcode = values(consignee_postcode),
warehouse_code = values(warehouse_code),
order_time = values(order_time),
order_remark = values(order_remark),
product_code = values(product_code),
product_name = values(product_name),
product_floor_code = values(product_floor_code),
country_code = values(country_code),
country_name = values(country_name),
order_status = values(order_status),
bl_pickup = values(bl_pickup),
pickup_date = values(pickup_date),
biz_date = values(biz_date),
success_status = values(success_status),
fail_code = values(fail_code),
updated_by = values(updated_by),
update_time = values(update_time)
</insert>
<update id="updateBillingStatus">
update prc_order
set success_status = #{successStatus},
fail_code = #{failCode},
updated_by = #{updateBy},
update_time = now()
where order_id = #{orderId}
</update>
</mapper>