Commit 4ad572b4 by jianshuqin

oms订单数据新增wms实际运费

parent d5bdc1d1
......@@ -329,4 +329,6 @@ public class OmsResult {
@JSONField(name = "shippingDeadlineReal")
private LocalDateTime shippingDeadlineReal;
@JSONField(name = "pickingDataVariances")
private List<PickingVariances> pickingVariances;
}
package com.bailuntec.domain.pojo;
import com.alibaba.fastjson.annotation.JSONField;
import lombok.Data;
import java.math.BigDecimal;
@Data
public class PickingVariances {
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column dc_base_oms_pick_variances.bailun_order_id
*
* @mbg.generated
*/
@JSONField(name = "bailunOrderId")
private String bailunOrderId;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column dc_base_oms_pick_variances.pick_order_id
*
* @mbg.generated
*/
@JSONField(name = "pickingNo")
private String pickOrderId;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column dc_base_oms_pick_variances.old_weight
*
* @mbg.generated
*/
@JSONField(name = "oldWeight")
private BigDecimal oldWeight;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column dc_base_oms_pick_variances.old_cost
*
* @mbg.generated
*/
@JSONField(name = "oldCost")
private BigDecimal oldCost;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column dc_base_oms_pick_variances.new_weight
*
* @mbg.generated
*/
@JSONField(name = "newWeight")
private BigDecimal newWeight;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column dc_base_oms_pick_variances.new_cost
*
* @mbg.generated
*/
@JSONField(name = "newCost")
private BigDecimal newCost;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column dc_base_oms_pick_variances.bill_weight
*
* @mbg.generated
*/
@JSONField(name = "billWeight")
private BigDecimal billWeight;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column dc_base_oms_pick_variances.bill_cost
*
* @mbg.generated
*/
@JSONField(name = "billCost")
private BigDecimal billCost;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column dc_base_oms_pick_variances.weight_difference
*
* @mbg.generated
*/
@JSONField(name = "weightDifference")
private BigDecimal weightDifference;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column dc_base_oms_pick_variances.cost_difference
*
* @mbg.generated
*/
@JSONField(name = "costDifference")
private BigDecimal costDifference;
}
......@@ -288,6 +288,10 @@ public class OrderSyncJob extends PointJob {
* 配货单处理,
*/
handPickingOrder(dcBaseOmsOrder, omsResult, bailunSkuInfoMap);
/*
* 配货数据差异
*/
handPickingVariances(dcBaseOmsOrder, omsResult);
/**
* Order费用处理
* 费用计算都从这里开始
......@@ -428,6 +432,7 @@ public class OrderSyncJob extends PointJob {
dcBaseOmsSku.setCostHandlePlatform(dcBaseOmsSku.getCostHandlePlatform().divide(quantityOrderdDecimal, 5, RoundingMode.HALF_EVEN));
dcBaseOmsSku.setCostFbaFee(dcBaseOmsSku.getCostFbaFee().divide(quantityOrderdDecimal, 5, RoundingMode.HALF_EVEN));
dcBaseOmsSku.setCostTail(dcBaseOmsSku.getCostTail().divide(quantityOrderdDecimal, 5, RoundingMode.HALF_EVEN));
dcBaseOmsSku.setCostBill(dcBaseOmsOrder.getCostBill().divide(quantityOrderdDecimal, 5, RoundingMode.HALF_EVEN));
if (dcBaseOmsOrder.getPlatformType().toUpperCase().equals(PlatformType.Marketing.value()) && ((dcBaseWarehouse != null && Constant.CONSUMABLES_WAREHOUSE.equals(dcBaseWarehouse.getHqType())) || dcBaseOmsOrder.getHasTransferOrder())) {
dcBaseOmsSku.setCostProduct(BigDecimal.ZERO);
} else {
......@@ -459,7 +464,7 @@ public class OrderSyncJob extends PointJob {
.add(dcBaseOmsSku.getCostHandlePlatform())//第三方仓操作费
.add(skuCostFbaFeeRMB.divide(quantityOrderdDecimal, 5, RoundingMode.HALF_EVEN))//FBA费
.add(dcBaseOmsSku.getCostFirst())//头程费
.add(dcBaseOmsSku.getCostLogistics())//百伦LMS物流费
.add(dcBaseOmsSku.getCostBill().compareTo(BigDecimal.ZERO) != 0 ? dcBaseOmsSku.getCostBill() : dcBaseOmsSku.getCostLogistics())//百伦LMS物流费
.add(dcBaseOmsSku.getCostProduct())//采购成本
.add(skuPaypalFeeRmb.divide(quantityOrderdDecimal, 5, RoundingMode.HALF_EVEN))//Paypal费
.setScale(5, RoundingMode.HALF_EVEN);
......@@ -517,7 +522,7 @@ public class OrderSyncJob extends PointJob {
.add(dcBaseOmsOrder.getCostHandlePlatform())//第三方仓操作费
.add(totalCostFbaFeeRMB)//FBA操作费
.add(dcBaseOmsOrder.getCostFirst()) //头程费
.add(dcBaseOmsOrder.getCostLogistics())//LMS物流费用
.add(dcBaseOmsOrder.getCostBill().compareTo(BigDecimal.ZERO) != 0 ? dcBaseOmsOrder.getCostBill() : dcBaseOmsOrder.getCostLogistics())//百伦LMS物流费
.add(dcBaseOmsOrder.getCostProduct())//采购成本
.add(totalCostPaypalFeeRMB)//Paypal费
.setScale(5, RoundingMode.HALF_EVEN);
......@@ -1117,6 +1122,38 @@ public class OrderSyncJob extends PointJob {
}
/**
* 处理配货数据差异
*/
public void handPickingVariances(DcBaseOmsOrder dcBaseOmsOrder, OmsResult omsResult) {
List<PickingVariances> pickingVariancesList = omsResult.getPickingVariances();
BigDecimal totalCostBill = BigDecimal.ZERO;
if (pickingVariancesList != null && pickingVariancesList.size() > 0) {
/*
* 遍历配货数据差异
*/
DcBaseOmsPickVariancesMapper dcBaseOmsPickVariancesMapper = SessionUtil.getSession().getMapper(DcBaseOmsPickVariancesMapper.class);
for (PickingVariances pickingVariances : pickingVariancesList) {
DcBaseOmsPickVariances dcBaseOmsPickVariances = new DcBaseOmsPickVariances();
dcBaseOmsPickVariances.setBailunOrderId(dcBaseOmsOrder.getBailunOrderId());
dcBaseOmsPickVariances.setPickOrderId(pickingVariances.getPickOrderId());
dcBaseOmsPickVariances.setOldWeight(pickingVariances.getOldWeight() != null ? pickingVariances.getOldWeight() : BigDecimal.ZERO);
dcBaseOmsPickVariances.setOldCost(pickingVariances.getOldCost() != null ? pickingVariances.getOldCost() : BigDecimal.ZERO);
dcBaseOmsPickVariances.setNewWeight(pickingVariances.getNewWeight() != null ? pickingVariances.getNewWeight() : BigDecimal.ZERO);
dcBaseOmsPickVariances.setNewCost(pickingVariances.getNewCost() != null ? pickingVariances.getNewCost() : BigDecimal.ZERO);
dcBaseOmsPickVariances.setBillWeight(pickingVariances.getBillWeight() != null ? pickingVariances.getBillWeight() : BigDecimal.ZERO);
dcBaseOmsPickVariances.setBillCost(pickingVariances.getBillCost() != null ? pickingVariances.getBillCost() : BigDecimal.ZERO);
dcBaseOmsPickVariances.setWeightDifference(pickingVariances.getWeightDifference() != null ? pickingVariances.getWeightDifference() : BigDecimal.ZERO);
dcBaseOmsPickVariances.setCostDifference(pickingVariances.getCostDifference() != null ? pickingVariances.getCostDifference() : BigDecimal.ZERO);
dcBaseOmsPickVariances.setGmtCreate(LocalDateTime.now());
dcBaseOmsPickVariances.setGmtModified(LocalDateTime.now());
totalCostBill = totalCostBill.add(dcBaseOmsPickVariances.getBillCost());
dcBaseOmsPickVariancesMapper.upsert(dcBaseOmsPickVariances);
}
}
dcBaseOmsOrder.setCostBill(totalCostBill);
}
/**
* 检查订单平台费用是否异常
*
* @param dcBaseOmsOrder
......@@ -1286,6 +1323,8 @@ public class OrderSyncJob extends PointJob {
dcBaseOmsOrder.setAmountRefund(BigDecimal.ZERO);
//销售额 - 需要计算的费用给个默认值
dcBaseOmsOrder.setAmountSales(BigDecimal.ZERO);
//账单费用
dcBaseOmsOrder.setCostBill(BigDecimal.ZERO);
//最后发货时间(真实)
dcBaseOmsOrder.setShippingDeadlineReal(omsResult.getShippingDeadlineReal());
//RMA状态
......@@ -1401,6 +1440,7 @@ public class OrderSyncJob extends PointJob {
dcBaseOmsSku.setCostPaypalFee(BigDecimal.ZERO);
dcBaseOmsSku.setAmountPrepaid(BigDecimal.ZERO);//更新旧数据中都已经发货,但是预付费>0的情况
dcBaseOmsSku.setCostLogistics(BigDecimal.ZERO);
dcBaseOmsSku.setCostBill(BigDecimal.ZERO);
//如果是 FBA订单1.检查FBA费用是否异常 2.
dcBaseOmsSku.setBailunSkuQuantityShipped(0);
dcBaseOmsSku.setHasFbaS(dcBaseOmsOrder.getHasFbaS());
......
......@@ -502,6 +502,14 @@ public class DcBaseOmsOrder {
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database column dc_base_oms_order.cost_bill
*
* @mbg.generated
*/
private BigDecimal costBill;
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database column dc_base_oms_order.cost_first
*
* @mbg.generated
......
package com.bailuntec.domain.entity;
import lombok.Data;
import java.math.BigDecimal;
import java.time.LocalDateTime;
@Data
public class DcBaseOmsPickVariances {
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column dc_base_oms_pick_variances.id
*
* @mbg.generated
*/
private Integer id;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column dc_base_oms_pick_variances.bailun_order_id
*
* @mbg.generated
*/
private String bailunOrderId;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column dc_base_oms_pick_variances.pick_order_id
*
* @mbg.generated
*/
private String pickOrderId;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column dc_base_oms_pick_variances.old_weight
*
* @mbg.generated
*/
private BigDecimal oldWeight;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column dc_base_oms_pick_variances.old_cost
*
* @mbg.generated
*/
private BigDecimal oldCost;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column dc_base_oms_pick_variances.new_weight
*
* @mbg.generated
*/
private BigDecimal newWeight;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column dc_base_oms_pick_variances.new_cost
*
* @mbg.generated
*/
private BigDecimal newCost;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column dc_base_oms_pick_variances.bill_weight
*
* @mbg.generated
*/
private BigDecimal billWeight;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column dc_base_oms_pick_variances.bill_cost
*
* @mbg.generated
*/
private BigDecimal billCost;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column dc_base_oms_pick_variances.weight_difference
*
* @mbg.generated
*/
private BigDecimal weightDifference;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column dc_base_oms_pick_variances.cost_difference
*
* @mbg.generated
*/
private BigDecimal costDifference;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column dc_base_oms_pick_variances.gmt_create
*
* @mbg.generated
*/
private LocalDateTime gmtCreate;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column dc_base_oms_pick_variances.gmt_modified
*
* @mbg.generated
*/
private LocalDateTime gmtModified;
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table dc_base_oms_pick_variances
*
* @mbg.generated
*/
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append(getClass().getSimpleName());
sb.append(" [");
sb.append("Hash = ").append(hashCode());
sb.append(", id=").append(id);
sb.append(", bailunOrderId=").append(bailunOrderId);
sb.append(", pickOrderId=").append(pickOrderId);
sb.append(", oldWeight=").append(oldWeight);
sb.append(", oldCost=").append(oldCost);
sb.append(", newWeight=").append(newWeight);
sb.append(", newCost=").append(newCost);
sb.append(", billWeight=").append(billWeight);
sb.append(", billCost=").append(billCost);
sb.append(", weightDifference=").append(weightDifference);
sb.append(", costDifference=").append(costDifference);
sb.append(", gmtCreate=").append(gmtCreate);
sb.append(", gmtModified=").append(gmtModified);
sb.append("]");
return sb.toString();
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table dc_base_oms_pick_variances
*
* @mbg.generated
*/
@Override
public boolean equals(Object that) {
if (this == that) {
return true;
}
if (that == null) {
return false;
}
if (getClass() != that.getClass()) {
return false;
}
DcBaseOmsPickVariances other = (DcBaseOmsPickVariances) that;
return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId()))
&& (this.getBailunOrderId() == null ? other.getBailunOrderId() == null : this.getBailunOrderId().equals(other.getBailunOrderId()))
&& (this.getPickOrderId() == null ? other.getPickOrderId() == null : this.getPickOrderId().equals(other.getPickOrderId()))
&& (this.getOldWeight() == null ? other.getOldWeight() == null : this.getOldWeight().equals(other.getOldWeight()))
&& (this.getOldCost() == null ? other.getOldCost() == null : this.getOldCost().equals(other.getOldCost()))
&& (this.getNewWeight() == null ? other.getNewWeight() == null : this.getNewWeight().equals(other.getNewWeight()))
&& (this.getNewCost() == null ? other.getNewCost() == null : this.getNewCost().equals(other.getNewCost()))
&& (this.getBillWeight() == null ? other.getBillWeight() == null : this.getBillWeight().equals(other.getBillWeight()))
&& (this.getBillCost() == null ? other.getBillCost() == null : this.getBillCost().equals(other.getBillCost()))
&& (this.getWeightDifference() == null ? other.getWeightDifference() == null : this.getWeightDifference().equals(other.getWeightDifference()))
&& (this.getCostDifference() == null ? other.getCostDifference() == null : this.getCostDifference().equals(other.getCostDifference()))
&& (this.getGmtCreate() == null ? other.getGmtCreate() == null : this.getGmtCreate().equals(other.getGmtCreate()))
&& (this.getGmtModified() == null ? other.getGmtModified() == null : this.getGmtModified().equals(other.getGmtModified()));
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table dc_base_oms_pick_variances
*
* @mbg.generated
*/
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((getId() == null) ? 0 : getId().hashCode());
result = prime * result + ((getBailunOrderId() == null) ? 0 : getBailunOrderId().hashCode());
result = prime * result + ((getPickOrderId() == null) ? 0 : getPickOrderId().hashCode());
result = prime * result + ((getOldWeight() == null) ? 0 : getOldWeight().hashCode());
result = prime * result + ((getOldCost() == null) ? 0 : getOldCost().hashCode());
result = prime * result + ((getNewWeight() == null) ? 0 : getNewWeight().hashCode());
result = prime * result + ((getNewCost() == null) ? 0 : getNewCost().hashCode());
result = prime * result + ((getBillWeight() == null) ? 0 : getBillWeight().hashCode());
result = prime * result + ((getBillCost() == null) ? 0 : getBillCost().hashCode());
result = prime * result + ((getWeightDifference() == null) ? 0 : getWeightDifference().hashCode());
result = prime * result + ((getCostDifference() == null) ? 0 : getCostDifference().hashCode());
result = prime * result + ((getGmtCreate() == null) ? 0 : getGmtCreate().hashCode());
result = prime * result + ((getGmtModified() == null) ? 0 : getGmtModified().hashCode());
return result;
}
}
\ No newline at end of file
......@@ -666,6 +666,15 @@ public class DcBaseOmsSku {
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column dc_base_oms_sku.cost_bill
*
* @mbg.generated
*/
private BigDecimal costBill;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column dc_base_oms_sku.cost_first
*
* @mbg.generated
......
......@@ -754,6 +754,9 @@
<if test="buyerName != null">
buyer_name,
</if>
<if test="costBill != null">
cost_bill,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">
......@@ -1101,6 +1104,9 @@
<if test="buyerName != null">
#{buyerName,jdbcType=LONGVARCHAR},
</if>
<if test="costBill != null">
#{costBill,jdbcType=DECIMAL},
</if>
</trim>
</insert>
<select id="countByExample" parameterType="com.bailuntec.domain.example.DcBaseOmsOrderExample" resultType="java.lang.Long">
......@@ -1465,6 +1471,9 @@
<if test="record.buyerName != null">
buyer_name = #{record.buyerName,jdbcType=LONGVARCHAR},
</if>
<if test="record.costBill != null">
cost_bill = #{record.costBill,jdbcType=DECIMAL},
</if>
</set>
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
......
package com.bailuntec.mapper;
import com.bailuntec.domain.entity.DcBaseOmsPickVariances;
public interface DcBaseOmsPickVariancesMapper {
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table dc_base_oms_pick_variances
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
int upsert(DcBaseOmsPickVariances record);
}
\ No newline at end of file
<?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.bailuntec.mapper.DcBaseOmsPickVariancesMapper">
<resultMap id="BaseResultMap" type="com.bailuntec.domain.entity.DcBaseOmsPickVariances">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
-->
<id column="id" jdbcType="INTEGER" property="id" />
<result column="bailun_order_id" jdbcType="VARCHAR" property="bailunOrderId" />
<result column="pick_order_id" jdbcType="VARCHAR" property="pickOrderId" />
<result column="old_weight" jdbcType="DECIMAL" property="oldWeight" />
<result column="old_cost" jdbcType="DECIMAL" property="oldCost" />
<result column="new_weight" jdbcType="DECIMAL" property="newWeight" />
<result column="new_cost" jdbcType="DECIMAL" property="newCost" />
<result column="bill_weight" jdbcType="DECIMAL" property="billWeight" />
<result column="bill_cost" jdbcType="DECIMAL" property="billCost" />
<result column="weight_difference" jdbcType="DECIMAL" property="weightDifference" />
<result column="cost_difference" jdbcType="DECIMAL" property="costDifference" />
<result column="gmt_create" jdbcType="TIMESTAMP" property="gmtCreate" />
<result column="gmt_modified" jdbcType="TIMESTAMP" property="gmtModified" />
</resultMap>
<insert id="upsert" parameterType="com.bailuntec.domain.entity.DcBaseOmsPickVariances">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
@project https://github.com/itfsw/mybatis-generator-plugin
-->
insert into dc_base_oms_pick_variances
(bailun_order_id, pick_order_id, old_weight, old_cost, new_weight, new_cost, bill_weight, bill_cost,
weight_difference, cost_difference, gmt_create, gmt_modified)
values
(#{bailunOrderId,jdbcType=VARCHAR}, #{pickOrderId,jdbcType=VARCHAR},
#{oldWeight,jdbcType=DECIMAL}, #{oldCost,jdbcType=DECIMAL},
#{newWeight,jdbcType=DECIMAL}, #{newCost,jdbcType=DECIMAL},
#{billWeight,jdbcType=DECIMAL}, #{billCost,jdbcType=DECIMAL},
#{weightDifference,jdbcType=DECIMAL}, #{costDifference,jdbcType=DECIMAL},
#{gmtCreate,jdbcType=TIMESTAMP}, #{gmtModified,jdbcType=TIMESTAMP})
on duplicate key update
bailun_order_id = #{bailunOrderId,jdbcType=VARCHAR},
pick_order_id = #{pickOrderId,jdbcType=VARCHAR},
old_weight = #{oldWeight,jdbcType=DECIMAL},
old_cost = #{oldCost,jdbcType=DECIMAL},
new_weight = #{newWeight,jdbcType=DECIMAL},
new_cost = #{newCost,jdbcType=DECIMAL},
bill_weight = #{billWeight,jdbcType=DECIMAL},
bill_Cost = #{billCost,jdbcType=DECIMAL},
weight_difference = #{weightDifference,jdbcType=DECIMAL},
cost_difference = #{costDifference,jdbcType=DECIMAL},
gmt_create = #{gmtCreate,jdbcType=TIMESTAMP},
gmt_modified = #{gmtModified,jdbcType=TIMESTAMP}
</insert>
</mapper>
\ No newline at end of file
......@@ -791,6 +791,9 @@
<if test="shippingDeadlineReal != null">
shipping_deadline_real,
</if>
<if test="costBill != null">
cost_bill,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">
......@@ -1183,6 +1186,9 @@
<if test="shippingDeadlineReal != null">
#{shippingDeadlineReal,jdbcType=TIMESTAMP},
</if>
<if test="costBill != null">
#{costBill,jdbcType=DECIMAL},
</if>
</trim>
</insert>
<select id="countByExample" parameterType="com.bailuntec.domain.example.DcBaseOmsSkuExample"
......@@ -1593,6 +1599,9 @@
<if test="record.shippingDeadlineReal != null">
shipping_deadline_real = #{record.shippingDeadlineReal,jdbcType=TIMESTAMP},
</if>
<if test="record.costBill != null">
cost_bill = #{record.costBill,jdbcType=DECIMAL},
</if>
</set>
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause"/>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment