Commit 67a5fb69 by wutong

计算物流头程费从物流单维度改为物流-调拨单维度

parent 9b39ab6b
...@@ -70,6 +70,15 @@ public class DcMidCostFirstOrder { ...@@ -70,6 +70,15 @@ public class DcMidCostFirstOrder {
private Integer quantity; private Integer quantity;
/** /**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column dc_mid_cost_first_order.transfer_order_id
*
* @mbg.generated
*/
private String transferOrderId;
/**
* This method was generated by MyBatis Generator. * This method was generated by MyBatis Generator.
* This method corresponds to the database table dc_mid_cost_first_order * This method corresponds to the database table dc_mid_cost_first_order
* *
...@@ -88,6 +97,7 @@ public class DcMidCostFirstOrder { ...@@ -88,6 +97,7 @@ public class DcMidCostFirstOrder {
sb.append(", channelOrderId=").append(channelOrderId); sb.append(", channelOrderId=").append(channelOrderId);
sb.append(", weightRatio=").append(weightRatio); sb.append(", weightRatio=").append(weightRatio);
sb.append(", quantity=").append(quantity); sb.append(", quantity=").append(quantity);
sb.append(", transferOrderId=").append(transferOrderId);
sb.append("]"); sb.append("]");
return sb.toString(); return sb.toString();
} }
...@@ -116,7 +126,8 @@ public class DcMidCostFirstOrder { ...@@ -116,7 +126,8 @@ public class DcMidCostFirstOrder {
&& (this.getWarehouseCode() == null ? other.getWarehouseCode() == null : this.getWarehouseCode().equals(other.getWarehouseCode())) && (this.getWarehouseCode() == null ? other.getWarehouseCode() == null : this.getWarehouseCode().equals(other.getWarehouseCode()))
&& (this.getChannelOrderId() == null ? other.getChannelOrderId() == null : this.getChannelOrderId().equals(other.getChannelOrderId())) && (this.getChannelOrderId() == null ? other.getChannelOrderId() == null : this.getChannelOrderId().equals(other.getChannelOrderId()))
&& (this.getWeightRatio() == null ? other.getWeightRatio() == null : this.getWeightRatio().equals(other.getWeightRatio())) && (this.getWeightRatio() == null ? other.getWeightRatio() == null : this.getWeightRatio().equals(other.getWeightRatio()))
&& (this.getQuantity() == null ? other.getQuantity() == null : this.getQuantity().equals(other.getQuantity())); && (this.getQuantity() == null ? other.getQuantity() == null : this.getQuantity().equals(other.getQuantity()))
&& (this.getTransferOrderId() == null ? other.getTransferOrderId() == null : this.getTransferOrderId().equals(other.getTransferOrderId()));
} }
/** /**
...@@ -136,6 +147,7 @@ public class DcMidCostFirstOrder { ...@@ -136,6 +147,7 @@ public class DcMidCostFirstOrder {
result = prime * result + ((getChannelOrderId() == null) ? 0 : getChannelOrderId().hashCode()); result = prime * result + ((getChannelOrderId() == null) ? 0 : getChannelOrderId().hashCode());
result = prime * result + ((getWeightRatio() == null) ? 0 : getWeightRatio().hashCode()); result = prime * result + ((getWeightRatio() == null) ? 0 : getWeightRatio().hashCode());
result = prime * result + ((getQuantity() == null) ? 0 : getQuantity().hashCode()); result = prime * result + ((getQuantity() == null) ? 0 : getQuantity().hashCode());
result = prime * result + ((getTransferOrderId() == null) ? 0 : getTransferOrderId().hashCode());
return result; return result;
} }
} }
\ No newline at end of file
...@@ -819,6 +819,76 @@ public class DcMidCostFirstOrderExample { ...@@ -819,6 +819,76 @@ public class DcMidCostFirstOrderExample {
addCriterion("quantity not between", value1, value2, "quantity"); addCriterion("quantity not between", value1, value2, "quantity");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andTransferOrderIdIsNull() {
addCriterion("transfer_order_id is null");
return (Criteria) this;
}
public Criteria andTransferOrderIdIsNotNull() {
addCriterion("transfer_order_id is not null");
return (Criteria) this;
}
public Criteria andTransferOrderIdEqualTo(String value) {
addCriterion("transfer_order_id =", value, "transferOrderId");
return (Criteria) this;
}
public Criteria andTransferOrderIdNotEqualTo(String value) {
addCriterion("transfer_order_id <>", value, "transferOrderId");
return (Criteria) this;
}
public Criteria andTransferOrderIdGreaterThan(String value) {
addCriterion("transfer_order_id >", value, "transferOrderId");
return (Criteria) this;
}
public Criteria andTransferOrderIdGreaterThanOrEqualTo(String value) {
addCriterion("transfer_order_id >=", value, "transferOrderId");
return (Criteria) this;
}
public Criteria andTransferOrderIdLessThan(String value) {
addCriterion("transfer_order_id <", value, "transferOrderId");
return (Criteria) this;
}
public Criteria andTransferOrderIdLessThanOrEqualTo(String value) {
addCriterion("transfer_order_id <=", value, "transferOrderId");
return (Criteria) this;
}
public Criteria andTransferOrderIdLike(String value) {
addCriterion("transfer_order_id like", value, "transferOrderId");
return (Criteria) this;
}
public Criteria andTransferOrderIdNotLike(String value) {
addCriterion("transfer_order_id not like", value, "transferOrderId");
return (Criteria) this;
}
public Criteria andTransferOrderIdIn(List<String> values) {
addCriterion("transfer_order_id in", values, "transferOrderId");
return (Criteria) this;
}
public Criteria andTransferOrderIdNotIn(List<String> values) {
addCriterion("transfer_order_id not in", values, "transferOrderId");
return (Criteria) this;
}
public Criteria andTransferOrderIdBetween(String value1, String value2) {
addCriterion("transfer_order_id between", value1, value2, "transferOrderId");
return (Criteria) this;
}
public Criteria andTransferOrderIdNotBetween(String value1, String value2) {
addCriterion("transfer_order_id not between", value1, value2, "transferOrderId");
return (Criteria) this;
}
} }
/** /**
......
package com.bailuntec.domain.pojo;
import lombok.Data;
@Data
public class CostFirstOrder {
private String channelOrderId;
private String transferOrderId;
}
...@@ -6,6 +6,7 @@ import com.bailuntec.domain.example.DcBaseCostFirstExample; ...@@ -6,6 +6,7 @@ import com.bailuntec.domain.example.DcBaseCostFirstExample;
import com.bailuntec.domain.example.DcBaseSkuExample; import com.bailuntec.domain.example.DcBaseSkuExample;
import com.bailuntec.domain.example.DcMidCostFirstExample; import com.bailuntec.domain.example.DcMidCostFirstExample;
import com.bailuntec.domain.example.DcMidCostFirstOrderExample; import com.bailuntec.domain.example.DcMidCostFirstOrderExample;
import com.bailuntec.domain.pojo.CostFirstOrder;
import com.bailuntec.mapper.*; import com.bailuntec.mapper.*;
import com.bailuntec.support.PointJob; import com.bailuntec.support.PointJob;
import com.bailuntec.utils.SessionUtil; import com.bailuntec.utils.SessionUtil;
...@@ -35,12 +36,12 @@ public class CalculateCostFirstJob extends PointJob { ...@@ -35,12 +36,12 @@ public class CalculateCostFirstJob extends PointJob {
do { do {
try { try {
DcBaseCostFirstMapper dcBaseCostFirstMapper = SessionUtil.getSession().getMapper(DcBaseCostFirstMapper.class); DcBaseCostFirstMapper dcBaseCostFirstMapper = SessionUtil.getSession().getMapper(DcBaseCostFirstMapper.class);
//拿到物流单号, 将物流单中每个SKU的费用算出来 //拿到物流单号,调拨单号, 将物流单-调拨单中每个SKU的费用算出来
List<String> channelOrderIdList = dcBaseCostFirstMapper.listChannelOrderId(jobPointLog.getPageIndex() * jobPointLog.getPageSize(), jobPointLog.getPageSize()); List<CostFirstOrder> channelOrderIdList = dcBaseCostFirstMapper.listChannelOrderId(jobPointLog.getPageIndex() * jobPointLog.getPageSize(), jobPointLog.getPageSize());
if (channelOrderIdList != null && channelOrderIdList.size() > 0) { if (channelOrderIdList != null && channelOrderIdList.size() > 0) {
for (String channelOrderId : channelOrderIdList) { for (CostFirstOrder costFirstOrder : channelOrderIdList) {
DcBaseCostFirstMapper dcBaseCostFirstMapperFor = SessionUtil.getSession().getMapper(DcBaseCostFirstMapper.class); DcBaseCostFirstMapper dcBaseCostFirstMapperFor = SessionUtil.getSession().getMapper(DcBaseCostFirstMapper.class);
List<DcBaseCostFirst> dcBaseCostFirsts = dcBaseCostFirstMapperFor.selectByExample(DcBaseCostFirstExample.newAndCreateCriteria().andChannelOrderIdEqualTo(channelOrderId).example()); List<DcBaseCostFirst> dcBaseCostFirsts = dcBaseCostFirstMapperFor.selectByExample(DcBaseCostFirstExample.newAndCreateCriteria().andChannelOrderIdEqualTo(costFirstOrder.getChannelOrderId()).andTransferOrderIdEqualTo(costFirstOrder.getTransferOrderId()).example());
handleChannelOrderSku(dcBaseCostFirsts); handleChannelOrderSku(dcBaseCostFirsts);
} }
} }
...@@ -100,6 +101,7 @@ public class CalculateCostFirstJob extends PointJob { ...@@ -100,6 +101,7 @@ public class CalculateCostFirstJob extends PointJob {
dcMidCostFirstOrder.setBailunSku(dcBaseCostFirst.getBailunSku()); dcMidCostFirstOrder.setBailunSku(dcBaseCostFirst.getBailunSku());
dcMidCostFirstOrder.setWarehouseCode(dcBaseCostFirst.getWarehouseCode()); dcMidCostFirstOrder.setWarehouseCode(dcBaseCostFirst.getWarehouseCode());
dcMidCostFirstOrder.setChannelOrderId(dcBaseCostFirst.getChannelOrderId()); dcMidCostFirstOrder.setChannelOrderId(dcBaseCostFirst.getChannelOrderId());
dcMidCostFirstOrder.setTransferOrderId(dcBaseCostFirst.getTransferOrderId());
dcMidCostFirstOrder.setQuantity(dcBaseCostFirst.getQuantity()); dcMidCostFirstOrder.setQuantity(dcBaseCostFirst.getQuantity());
dcMidCostFirstOrder.setWeightRatio(skuWeightRatio); dcMidCostFirstOrder.setWeightRatio(skuWeightRatio);
//将费用算到单个SKU上 //将费用算到单个SKU上
......
...@@ -2,6 +2,7 @@ package com.bailuntec.mapper; ...@@ -2,6 +2,7 @@ package com.bailuntec.mapper;
import com.bailuntec.domain.entity.DcBaseCostFirst; import com.bailuntec.domain.entity.DcBaseCostFirst;
import com.bailuntec.domain.example.DcBaseCostFirstExample; import com.bailuntec.domain.example.DcBaseCostFirstExample;
import com.bailuntec.domain.pojo.CostFirstOrder;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import java.util.List; import java.util.List;
...@@ -122,7 +123,8 @@ public interface DcBaseCostFirstMapper { ...@@ -122,7 +123,8 @@ public interface DcBaseCostFirstMapper {
*/ */
int upsertSelective(DcBaseCostFirst record); int upsertSelective(DcBaseCostFirst record);
List<CostFirstOrder> listChannelOrderId(@Param("v1") Integer v1, @Param("v2") Integer v2);
int countChannelOrder(); int countChannelOrder();
List<String> listChannelOrderId(@Param("v1") Integer v1, @Param("v2") Integer v2);
} }
\ No newline at end of file
...@@ -6,20 +6,21 @@ ...@@ -6,20 +6,21 @@
WARNING - @mbg.generated WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify. This element is automatically generated by MyBatis Generator, do not modify.
--> -->
<id column="id" jdbcType="INTEGER" property="id"/> <id column="id" jdbcType="INTEGER" property="id" />
<result column="channel_order_id" jdbcType="VARCHAR" property="channelOrderId"/> <result column="channel_order_id" jdbcType="VARCHAR" property="channelOrderId" />
<result column="channel_id" jdbcType="INTEGER" property="channelId"/> <result column="channel_id" jdbcType="INTEGER" property="channelId" />
<result column="box_id" jdbcType="VARCHAR" property="boxId"/> <result column="box_id" jdbcType="VARCHAR" property="boxId" />
<result column="cost_first" jdbcType="DECIMAL" property="costFirst"/> <result column="cost_first" jdbcType="DECIMAL" property="costFirst" />
<result column="cost_goods_clearance" jdbcType="DECIMAL" property="costGoodsClearance"/> <result column="cost_goods_clearance" jdbcType="DECIMAL" property="costGoodsClearance" />
<result column="cost_duty" jdbcType="DECIMAL" property="costDuty"/> <result column="cost_duty" jdbcType="DECIMAL" property="costDuty" />
<result column="cost_customs_clearance" jdbcType="DECIMAL" property="costCustomsClearance"/> <result column="cost_customs_clearance" jdbcType="DECIMAL" property="costCustomsClearance" />
<result column="cost_weight" jdbcType="DECIMAL" property="costWeight"/> <result column="cost_weight" jdbcType="DECIMAL" property="costWeight" />
<result column="cost_fuel" jdbcType="DECIMAL" property="costFuel"/> <result column="cost_fuel" jdbcType="DECIMAL" property="costFuel" />
<result column="warehouse_code" jdbcType="VARCHAR" property="warehouseCode"/> <result column="warehouse_code" jdbcType="VARCHAR" property="warehouseCode" />
<result column="bailun_sku" jdbcType="VARCHAR" property="bailunSku"/> <result column="bailun_sku" jdbcType="VARCHAR" property="bailunSku" />
<result column="quantity" jdbcType="INTEGER" property="quantity"/> <result column="quantity" jdbcType="INTEGER" property="quantity" />
<result column="sku_weight" jdbcType="DECIMAL" property="skuWeight"/> <result column="sku_weight" jdbcType="DECIMAL" property="skuWeight" />
<result column="transfer_order_id" jdbcType="VARCHAR" property="transferOrderId" />
</resultMap> </resultMap>
<sql id="Example_Where_Clause"> <sql id="Example_Where_Clause">
<!-- <!--
...@@ -43,8 +44,7 @@ ...@@ -43,8 +44,7 @@
</when> </when>
<when test="criterion.listValue"> <when test="criterion.listValue">
and ${criterion.condition} and ${criterion.condition}
<foreach close=")" collection="criterion.value" item="listItem" open="(" <foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
separator=",">
#{listItem} #{listItem}
</foreach> </foreach>
</when> </when>
...@@ -77,8 +77,7 @@ ...@@ -77,8 +77,7 @@
</when> </when>
<when test="criterion.listValue"> <when test="criterion.listValue">
and ${criterion.condition} and ${criterion.condition}
<foreach close=")" collection="criterion.value" item="listItem" open="(" <foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
separator=",">
#{listItem} #{listItem}
</foreach> </foreach>
</when> </when>
...@@ -96,10 +95,9 @@ ...@@ -96,10 +95,9 @@
--> -->
id, channel_order_id, channel_id, box_id, cost_first, cost_goods_clearance, cost_duty, id, channel_order_id, channel_id, box_id, cost_first, cost_goods_clearance, cost_duty,
cost_customs_clearance, cost_weight, cost_fuel, warehouse_code, bailun_sku, quantity, cost_customs_clearance, cost_weight, cost_fuel, warehouse_code, bailun_sku, quantity,
sku_weight sku_weight, transfer_order_id
</sql> </sql>
<select id="selectByExample" parameterType="com.bailuntec.domain.example.DcBaseCostFirstExample" <select id="selectByExample" parameterType="com.bailuntec.domain.example.DcBaseCostFirstExample" resultMap="BaseResultMap">
resultMap="BaseResultMap">
<!-- <!--
WARNING - @mbg.generated WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify. This element is automatically generated by MyBatis Generator, do not modify.
...@@ -108,10 +106,10 @@ ...@@ -108,10 +106,10 @@
<if test="distinct"> <if test="distinct">
distinct distinct
</if> </if>
<include refid="Base_Column_List"/> <include refid="Base_Column_List" />
from dc_base_cost_first from dc_base_cost_first
<if test="_parameter != null"> <if test="_parameter != null">
<include refid="Example_Where_Clause"/> <include refid="Example_Where_Clause" />
</if> </if>
<if test="orderByClause != null"> <if test="orderByClause != null">
order by ${orderByClause} order by ${orderByClause}
...@@ -131,7 +129,7 @@ ...@@ -131,7 +129,7 @@
This element is automatically generated by MyBatis Generator, do not modify. This element is automatically generated by MyBatis Generator, do not modify.
--> -->
select select
<include refid="Base_Column_List"/> <include refid="Base_Column_List" />
from dc_base_cost_first from dc_base_cost_first
where id = #{id,jdbcType=INTEGER} where id = #{id,jdbcType=INTEGER}
</select> </select>
...@@ -150,7 +148,7 @@ ...@@ -150,7 +148,7 @@
--> -->
delete from dc_base_cost_first delete from dc_base_cost_first
<if test="_parameter != null"> <if test="_parameter != null">
<include refid="Example_Where_Clause"/> <include refid="Example_Where_Clause" />
</if> </if>
</delete> </delete>
<insert id="insert" parameterType="com.bailuntec.domain.entity.DcBaseCostFirst"> <insert id="insert" parameterType="com.bailuntec.domain.entity.DcBaseCostFirst">
...@@ -162,12 +160,14 @@ ...@@ -162,12 +160,14 @@
box_id, cost_first, cost_goods_clearance, box_id, cost_first, cost_goods_clearance,
cost_duty, cost_customs_clearance, cost_weight, cost_duty, cost_customs_clearance, cost_weight,
cost_fuel, warehouse_code, bailun_sku, cost_fuel, warehouse_code, bailun_sku,
quantity, sku_weight) quantity, sku_weight, transfer_order_id
)
values (#{id,jdbcType=INTEGER}, #{channelOrderId,jdbcType=VARCHAR}, #{channelId,jdbcType=INTEGER}, values (#{id,jdbcType=INTEGER}, #{channelOrderId,jdbcType=VARCHAR}, #{channelId,jdbcType=INTEGER},
#{boxId,jdbcType=VARCHAR}, #{costFirst,jdbcType=DECIMAL}, #{costGoodsClearance,jdbcType=DECIMAL}, #{boxId,jdbcType=VARCHAR}, #{costFirst,jdbcType=DECIMAL}, #{costGoodsClearance,jdbcType=DECIMAL},
#{costDuty,jdbcType=DECIMAL}, #{costCustomsClearance,jdbcType=DECIMAL}, #{costWeight,jdbcType=DECIMAL}, #{costDuty,jdbcType=DECIMAL}, #{costCustomsClearance,jdbcType=DECIMAL}, #{costWeight,jdbcType=DECIMAL},
#{costFuel,jdbcType=DECIMAL}, #{warehouseCode,jdbcType=VARCHAR}, #{bailunSku,jdbcType=VARCHAR}, #{costFuel,jdbcType=DECIMAL}, #{warehouseCode,jdbcType=VARCHAR}, #{bailunSku,jdbcType=VARCHAR},
#{quantity,jdbcType=INTEGER}, #{skuWeight,jdbcType=DECIMAL}) #{quantity,jdbcType=INTEGER}, #{skuWeight,jdbcType=DECIMAL}, #{transferOrderId,jdbcType=VARCHAR}
)
</insert> </insert>
<insert id="insertSelective" parameterType="com.bailuntec.domain.entity.DcBaseCostFirst"> <insert id="insertSelective" parameterType="com.bailuntec.domain.entity.DcBaseCostFirst">
<!-- <!--
...@@ -218,6 +218,9 @@ ...@@ -218,6 +218,9 @@
<if test="skuWeight != null"> <if test="skuWeight != null">
sku_weight, sku_weight,
</if> </if>
<if test="transferOrderId != null">
transfer_order_id,
</if>
</trim> </trim>
<trim prefix="values (" suffix=")" suffixOverrides=","> <trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null"> <if test="id != null">
...@@ -262,17 +265,19 @@ ...@@ -262,17 +265,19 @@
<if test="skuWeight != null"> <if test="skuWeight != null">
#{skuWeight,jdbcType=DECIMAL}, #{skuWeight,jdbcType=DECIMAL},
</if> </if>
<if test="transferOrderId != null">
#{transferOrderId,jdbcType=VARCHAR},
</if>
</trim> </trim>
</insert> </insert>
<select id="countByExample" parameterType="com.bailuntec.domain.example.DcBaseCostFirstExample" <select id="countByExample" parameterType="com.bailuntec.domain.example.DcBaseCostFirstExample" resultType="java.lang.Long">
resultType="java.lang.Long">
<!-- <!--
WARNING - @mbg.generated WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify. This element is automatically generated by MyBatis Generator, do not modify.
--> -->
select count(*) from dc_base_cost_first select count(*) from dc_base_cost_first
<if test="_parameter != null"> <if test="_parameter != null">
<include refid="Example_Where_Clause"/> <include refid="Example_Where_Clause" />
</if> </if>
</select> </select>
<update id="updateByExampleSelective" parameterType="map"> <update id="updateByExampleSelective" parameterType="map">
...@@ -324,9 +329,12 @@ ...@@ -324,9 +329,12 @@
<if test="record.skuWeight != null"> <if test="record.skuWeight != null">
sku_weight = #{record.skuWeight,jdbcType=DECIMAL}, sku_weight = #{record.skuWeight,jdbcType=DECIMAL},
</if> </if>
<if test="record.transferOrderId != null">
transfer_order_id = #{record.transferOrderId,jdbcType=VARCHAR},
</if>
</set> </set>
<if test="_parameter != null"> <if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause"/> <include refid="Update_By_Example_Where_Clause" />
</if> </if>
</update> </update>
<update id="updateByExample" parameterType="map"> <update id="updateByExample" parameterType="map">
...@@ -348,9 +356,10 @@ ...@@ -348,9 +356,10 @@
warehouse_code = #{record.warehouseCode,jdbcType=VARCHAR}, warehouse_code = #{record.warehouseCode,jdbcType=VARCHAR},
bailun_sku = #{record.bailunSku,jdbcType=VARCHAR}, bailun_sku = #{record.bailunSku,jdbcType=VARCHAR},
quantity = #{record.quantity,jdbcType=INTEGER}, quantity = #{record.quantity,jdbcType=INTEGER},
sku_weight = #{record.skuWeight,jdbcType=DECIMAL} sku_weight = #{record.skuWeight,jdbcType=DECIMAL},
transfer_order_id = #{record.transferOrderId,jdbcType=VARCHAR}
<if test="_parameter != null"> <if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause"/> <include refid="Update_By_Example_Where_Clause" />
</if> </if>
</update> </update>
<update id="updateByPrimaryKeySelective" parameterType="com.bailuntec.domain.entity.DcBaseCostFirst"> <update id="updateByPrimaryKeySelective" parameterType="com.bailuntec.domain.entity.DcBaseCostFirst">
...@@ -399,6 +408,9 @@ ...@@ -399,6 +408,9 @@
<if test="skuWeight != null"> <if test="skuWeight != null">
sku_weight = #{skuWeight,jdbcType=DECIMAL}, sku_weight = #{skuWeight,jdbcType=DECIMAL},
</if> </if>
<if test="transferOrderId != null">
transfer_order_id = #{transferOrderId,jdbcType=VARCHAR},
</if>
</set> </set>
where id = #{id,jdbcType=INTEGER} where id = #{id,jdbcType=INTEGER}
</update> </update>
...@@ -420,7 +432,8 @@ ...@@ -420,7 +432,8 @@
warehouse_code = #{warehouseCode,jdbcType=VARCHAR}, warehouse_code = #{warehouseCode,jdbcType=VARCHAR},
bailun_sku = #{bailunSku,jdbcType=VARCHAR}, bailun_sku = #{bailunSku,jdbcType=VARCHAR},
quantity = #{quantity,jdbcType=INTEGER}, quantity = #{quantity,jdbcType=INTEGER},
sku_weight = #{skuWeight,jdbcType=DECIMAL} sku_weight = #{skuWeight,jdbcType=DECIMAL},
transfer_order_id = #{transferOrderId,jdbcType=VARCHAR}
where id = #{id,jdbcType=INTEGER} where id = #{id,jdbcType=INTEGER}
</update> </update>
<insert id="upsertSelective" parameterType="com.bailuntec.domain.entity.DcBaseCostFirst"> <insert id="upsertSelective" parameterType="com.bailuntec.domain.entity.DcBaseCostFirst">
...@@ -473,6 +486,9 @@ ...@@ -473,6 +486,9 @@
<if test="skuWeight != null"> <if test="skuWeight != null">
sku_weight, sku_weight,
</if> </if>
<if test="transferOrderId != null">
transfer_order_id,
</if>
</trim> </trim>
values values
<trim prefix="(" suffix=")" suffixOverrides=","> <trim prefix="(" suffix=")" suffixOverrides=",">
...@@ -518,6 +534,9 @@ ...@@ -518,6 +534,9 @@
<if test="skuWeight != null"> <if test="skuWeight != null">
#{skuWeight,jdbcType=DECIMAL}, #{skuWeight,jdbcType=DECIMAL},
</if> </if>
<if test="transferOrderId != null">
#{transferOrderId,jdbcType=VARCHAR},
</if>
</trim> </trim>
on duplicate key update on duplicate key update
<trim suffixOverrides=","> <trim suffixOverrides=",">
...@@ -563,6 +582,9 @@ ...@@ -563,6 +582,9 @@
<if test="skuWeight != null"> <if test="skuWeight != null">
sku_weight = #{skuWeight,jdbcType=DECIMAL}, sku_weight = #{skuWeight,jdbcType=DECIMAL},
</if> </if>
<if test="transferOrderId != null">
transfer_order_id = #{transferOrderId,jdbcType=VARCHAR},
</if>
</trim> </trim>
</insert> </insert>
<insert id="upsert" parameterType="com.bailuntec.domain.entity.DcBaseCostFirst"> <insert id="upsert" parameterType="com.bailuntec.domain.entity.DcBaseCostFirst">
...@@ -574,13 +596,14 @@ ...@@ -574,13 +596,14 @@
insert into dc_base_cost_first insert into dc_base_cost_first
(id, channel_order_id, channel_id, box_id, cost_first, cost_goods_clearance, cost_duty, (id, channel_order_id, channel_id, box_id, cost_first, cost_goods_clearance, cost_duty,
cost_customs_clearance, cost_weight, cost_fuel, warehouse_code, bailun_sku, quantity, cost_customs_clearance, cost_weight, cost_fuel, warehouse_code, bailun_sku, quantity,
sku_weight) sku_weight, transfer_order_id)
values values
(#{id,jdbcType=INTEGER}, #{channelOrderId,jdbcType=VARCHAR}, #{channelId,jdbcType=INTEGER}, (#{id,jdbcType=INTEGER}, #{channelOrderId,jdbcType=VARCHAR}, #{channelId,jdbcType=INTEGER},
#{boxId,jdbcType=VARCHAR}, #{costFirst,jdbcType=DECIMAL}, #{costGoodsClearance,jdbcType=DECIMAL}, #{boxId,jdbcType=VARCHAR}, #{costFirst,jdbcType=DECIMAL}, #{costGoodsClearance,jdbcType=DECIMAL},
#{costDuty,jdbcType=DECIMAL}, #{costCustomsClearance,jdbcType=DECIMAL}, #{costWeight,jdbcType=DECIMAL}, #{costDuty,jdbcType=DECIMAL}, #{costCustomsClearance,jdbcType=DECIMAL}, #{costWeight,jdbcType=DECIMAL},
#{costFuel,jdbcType=DECIMAL}, #{warehouseCode,jdbcType=VARCHAR}, #{bailunSku,jdbcType=VARCHAR}, #{costFuel,jdbcType=DECIMAL}, #{warehouseCode,jdbcType=VARCHAR}, #{bailunSku,jdbcType=VARCHAR},
#{quantity,jdbcType=INTEGER}, #{skuWeight,jdbcType=DECIMAL}) #{quantity,jdbcType=INTEGER}, #{skuWeight,jdbcType=DECIMAL}, #{transferOrderId,jdbcType=VARCHAR}
)
on duplicate key update on duplicate key update
id = #{id,jdbcType=INTEGER}, id = #{id,jdbcType=INTEGER},
channel_order_id = #{channelOrderId,jdbcType=VARCHAR}, channel_order_id = #{channelOrderId,jdbcType=VARCHAR},
...@@ -595,31 +618,31 @@ ...@@ -595,31 +618,31 @@
warehouse_code = #{warehouseCode,jdbcType=VARCHAR}, warehouse_code = #{warehouseCode,jdbcType=VARCHAR},
bailun_sku = #{bailunSku,jdbcType=VARCHAR}, bailun_sku = #{bailunSku,jdbcType=VARCHAR},
quantity = #{quantity,jdbcType=INTEGER}, quantity = #{quantity,jdbcType=INTEGER},
sku_weight = #{skuWeight,jdbcType=DECIMAL} sku_weight = #{skuWeight,jdbcType=DECIMAL},
transfer_order_id = #{transferOrderId,jdbcType=VARCHAR}
</insert> </insert>
<select id="selectOneByExample" parameterType="com.bailuntec.domain.example.DcBaseCostFirstExample" <select id="selectOneByExample" parameterType="com.bailuntec.domain.example.DcBaseCostFirstExample" resultMap="BaseResultMap">
resultMap="BaseResultMap">
<!-- <!--
WARNING - @mbg.generated WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify. This element is automatically generated by MyBatis Generator, do not modify.
@project https://github.com/itfsw/mybatis-generator-plugin @project https://github.com/itfsw/mybatis-generator-plugin
--> -->
select select
<include refid="Base_Column_List"/> <include refid="Base_Column_List" />
from dc_base_cost_first from dc_base_cost_first
<if test="_parameter != null"> <if test="_parameter != null">
<include refid="Example_Where_Clause"/> <include refid="Example_Where_Clause" />
</if> </if>
<if test="orderByClause != null"> <if test="orderByClause != null">
order by ${orderByClause} order by ${orderByClause}
</if> </if>
limit 1 limit 1
</select> </select>
<select id="listChannelOrderId" resultType="string"> <select id="listChannelOrderId" resultType="com.bailuntec.domain.pojo.CostFirstOrder">
SELECT channel_order_id FROM `dc_base_cost_first` WHERE cost_first>0 GROUP BY channel_order_id ORDER BY channel_order_id asc limit #{v1}, #{v2}; SELECT channel_order_id,transfer_order_id FROM `dc_base_cost_first` WHERE cost_first>0 GROUP BY channel_order_id,transfer_order_id ORDER BY transfer_order_id asc limit #{v1}, #{v2};
</select> </select>
<select id="countChannelOrder" resultType="int"> <select id="countChannelOrder" resultType="int">
SELECT COUNT(*) FROM (SELECT channel_order_id FROM `dc_base_cost_first` WHERE cost_first>0 GROUP BY channel_order_id) tb; SELECT COUNT(*) FROM (SELECT channel_order_id,transfer_order_id FROM `dc_base_cost_first` WHERE cost_first>0 GROUP BY channel_order_id,transfer_order_id) tb;
</select> </select>
</mapper> </mapper>
\ No newline at end of file
...@@ -5,7 +5,6 @@ import com.bailuntec.domain.example.DcMidCostFirstOrderExample; ...@@ -5,7 +5,6 @@ import com.bailuntec.domain.example.DcMidCostFirstOrderExample;
import com.bailuntec.domain.pojo.MidCostFirst; import com.bailuntec.domain.pojo.MidCostFirst;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import java.math.BigDecimal;
import java.util.List; import java.util.List;
public interface DcMidCostFirstOrderMapper { public interface DcMidCostFirstOrderMapper {
...@@ -124,8 +123,7 @@ public interface DcMidCostFirstOrderMapper { ...@@ -124,8 +123,7 @@ public interface DcMidCostFirstOrderMapper {
*/ */
int upsertSelective(DcMidCostFirstOrder record); int upsertSelective(DcMidCostFirstOrder record);
int countSkuWarehouse(); int countSkuWarehouse();
List<MidCostFirst> listSkuWarehouse(@Param("v1")int v1, @Param("v2")int v2); List<MidCostFirst> listSkuWarehouse(@Param("v1") int v1, @Param("v2") int v2);
} }
\ No newline at end of file
...@@ -13,6 +13,7 @@ ...@@ -13,6 +13,7 @@
<result column="channel_order_id" jdbcType="VARCHAR" property="channelOrderId" /> <result column="channel_order_id" jdbcType="VARCHAR" property="channelOrderId" />
<result column="weight_ratio" jdbcType="DECIMAL" property="weightRatio" /> <result column="weight_ratio" jdbcType="DECIMAL" property="weightRatio" />
<result column="quantity" jdbcType="INTEGER" property="quantity" /> <result column="quantity" jdbcType="INTEGER" property="quantity" />
<result column="transfer_order_id" jdbcType="VARCHAR" property="transferOrderId" />
</resultMap> </resultMap>
<sql id="Example_Where_Clause"> <sql id="Example_Where_Clause">
<!-- <!--
...@@ -85,7 +86,8 @@ ...@@ -85,7 +86,8 @@
WARNING - @mbg.generated WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify. This element is automatically generated by MyBatis Generator, do not modify.
--> -->
id, cost_first, bailun_sku, warehouse_code, channel_order_id, weight_ratio, quantity id, cost_first, bailun_sku, warehouse_code, channel_order_id, weight_ratio, quantity,
transfer_order_id
</sql> </sql>
<select id="selectByExample" parameterType="com.bailuntec.domain.example.DcMidCostFirstOrderExample" resultMap="BaseResultMap"> <select id="selectByExample" parameterType="com.bailuntec.domain.example.DcMidCostFirstOrderExample" resultMap="BaseResultMap">
<!-- <!--
...@@ -148,10 +150,10 @@ ...@@ -148,10 +150,10 @@
--> -->
insert into dc_mid_cost_first_order (id, cost_first, bailun_sku, insert into dc_mid_cost_first_order (id, cost_first, bailun_sku,
warehouse_code, channel_order_id, weight_ratio, warehouse_code, channel_order_id, weight_ratio,
quantity) quantity, transfer_order_id)
values (#{id,jdbcType=INTEGER}, #{costFirst,jdbcType=DECIMAL}, #{bailunSku,jdbcType=VARCHAR}, values (#{id,jdbcType=INTEGER}, #{costFirst,jdbcType=DECIMAL}, #{bailunSku,jdbcType=VARCHAR},
#{warehouseCode,jdbcType=VARCHAR}, #{channelOrderId,jdbcType=VARCHAR}, #{weightRatio,jdbcType=DECIMAL}, #{warehouseCode,jdbcType=VARCHAR}, #{channelOrderId,jdbcType=VARCHAR}, #{weightRatio,jdbcType=DECIMAL},
#{quantity,jdbcType=INTEGER}) #{quantity,jdbcType=INTEGER}, #{transferOrderId,jdbcType=VARCHAR})
</insert> </insert>
<insert id="insertSelective" parameterType="com.bailuntec.domain.entity.DcMidCostFirstOrder"> <insert id="insertSelective" parameterType="com.bailuntec.domain.entity.DcMidCostFirstOrder">
<!-- <!--
...@@ -181,6 +183,9 @@ ...@@ -181,6 +183,9 @@
<if test="quantity != null"> <if test="quantity != null">
quantity, quantity,
</if> </if>
<if test="transferOrderId != null">
transfer_order_id,
</if>
</trim> </trim>
<trim prefix="values (" suffix=")" suffixOverrides=","> <trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null"> <if test="id != null">
...@@ -204,6 +209,9 @@ ...@@ -204,6 +209,9 @@
<if test="quantity != null"> <if test="quantity != null">
#{quantity,jdbcType=INTEGER}, #{quantity,jdbcType=INTEGER},
</if> </if>
<if test="transferOrderId != null">
#{transferOrderId,jdbcType=VARCHAR},
</if>
</trim> </trim>
</insert> </insert>
<select id="countByExample" parameterType="com.bailuntec.domain.example.DcMidCostFirstOrderExample" resultType="java.lang.Long"> <select id="countByExample" parameterType="com.bailuntec.domain.example.DcMidCostFirstOrderExample" resultType="java.lang.Long">
...@@ -244,6 +252,9 @@ ...@@ -244,6 +252,9 @@
<if test="record.quantity != null"> <if test="record.quantity != null">
quantity = #{record.quantity,jdbcType=INTEGER}, quantity = #{record.quantity,jdbcType=INTEGER},
</if> </if>
<if test="record.transferOrderId != null">
transfer_order_id = #{record.transferOrderId,jdbcType=VARCHAR},
</if>
</set> </set>
<if test="_parameter != null"> <if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" /> <include refid="Update_By_Example_Where_Clause" />
...@@ -261,7 +272,8 @@ ...@@ -261,7 +272,8 @@
warehouse_code = #{record.warehouseCode,jdbcType=VARCHAR}, warehouse_code = #{record.warehouseCode,jdbcType=VARCHAR},
channel_order_id = #{record.channelOrderId,jdbcType=VARCHAR}, channel_order_id = #{record.channelOrderId,jdbcType=VARCHAR},
weight_ratio = #{record.weightRatio,jdbcType=DECIMAL}, weight_ratio = #{record.weightRatio,jdbcType=DECIMAL},
quantity = #{record.quantity,jdbcType=INTEGER} quantity = #{record.quantity,jdbcType=INTEGER},
transfer_order_id = #{record.transferOrderId,jdbcType=VARCHAR}
<if test="_parameter != null"> <if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" /> <include refid="Update_By_Example_Where_Clause" />
</if> </if>
...@@ -291,6 +303,9 @@ ...@@ -291,6 +303,9 @@
<if test="quantity != null"> <if test="quantity != null">
quantity = #{quantity,jdbcType=INTEGER}, quantity = #{quantity,jdbcType=INTEGER},
</if> </if>
<if test="transferOrderId != null">
transfer_order_id = #{transferOrderId,jdbcType=VARCHAR},
</if>
</set> </set>
where id = #{id,jdbcType=INTEGER} where id = #{id,jdbcType=INTEGER}
</update> </update>
...@@ -305,7 +320,8 @@ ...@@ -305,7 +320,8 @@
warehouse_code = #{warehouseCode,jdbcType=VARCHAR}, warehouse_code = #{warehouseCode,jdbcType=VARCHAR},
channel_order_id = #{channelOrderId,jdbcType=VARCHAR}, channel_order_id = #{channelOrderId,jdbcType=VARCHAR},
weight_ratio = #{weightRatio,jdbcType=DECIMAL}, weight_ratio = #{weightRatio,jdbcType=DECIMAL},
quantity = #{quantity,jdbcType=INTEGER} quantity = #{quantity,jdbcType=INTEGER},
transfer_order_id = #{transferOrderId,jdbcType=VARCHAR}
where id = #{id,jdbcType=INTEGER} where id = #{id,jdbcType=INTEGER}
</update> </update>
<insert id="upsertSelective" parameterType="com.bailuntec.domain.entity.DcMidCostFirstOrder"> <insert id="upsertSelective" parameterType="com.bailuntec.domain.entity.DcMidCostFirstOrder">
...@@ -337,6 +353,9 @@ ...@@ -337,6 +353,9 @@
<if test="quantity != null"> <if test="quantity != null">
quantity, quantity,
</if> </if>
<if test="transferOrderId != null">
transfer_order_id,
</if>
</trim> </trim>
values values
<trim prefix="(" suffix=")" suffixOverrides=","> <trim prefix="(" suffix=")" suffixOverrides=",">
...@@ -361,6 +380,9 @@ ...@@ -361,6 +380,9 @@
<if test="quantity != null"> <if test="quantity != null">
#{quantity,jdbcType=INTEGER}, #{quantity,jdbcType=INTEGER},
</if> </if>
<if test="transferOrderId != null">
#{transferOrderId,jdbcType=VARCHAR},
</if>
</trim> </trim>
on duplicate key update on duplicate key update
<trim suffixOverrides=","> <trim suffixOverrides=",">
...@@ -385,6 +407,9 @@ ...@@ -385,6 +407,9 @@
<if test="quantity != null"> <if test="quantity != null">
quantity = #{quantity,jdbcType=INTEGER}, quantity = #{quantity,jdbcType=INTEGER},
</if> </if>
<if test="transferOrderId != null">
transfer_order_id = #{transferOrderId,jdbcType=VARCHAR},
</if>
</trim> </trim>
</insert> </insert>
<insert id="upsert" parameterType="com.bailuntec.domain.entity.DcMidCostFirstOrder"> <insert id="upsert" parameterType="com.bailuntec.domain.entity.DcMidCostFirstOrder">
...@@ -394,12 +419,12 @@ ...@@ -394,12 +419,12 @@
@project https://github.com/itfsw/mybatis-generator-plugin @project https://github.com/itfsw/mybatis-generator-plugin
--> -->
insert into dc_mid_cost_first_order insert into dc_mid_cost_first_order
(id, cost_first, bailun_sku, warehouse_code, channel_order_id, weight_ratio, quantity (id, cost_first, bailun_sku, warehouse_code, channel_order_id, weight_ratio, quantity,
) transfer_order_id)
values values
(#{id,jdbcType=INTEGER}, #{costFirst,jdbcType=DECIMAL}, #{bailunSku,jdbcType=VARCHAR}, (#{id,jdbcType=INTEGER}, #{costFirst,jdbcType=DECIMAL}, #{bailunSku,jdbcType=VARCHAR},
#{warehouseCode,jdbcType=VARCHAR}, #{channelOrderId,jdbcType=VARCHAR}, #{weightRatio,jdbcType=DECIMAL}, #{warehouseCode,jdbcType=VARCHAR}, #{channelOrderId,jdbcType=VARCHAR}, #{weightRatio,jdbcType=DECIMAL},
#{quantity,jdbcType=INTEGER}) #{quantity,jdbcType=INTEGER}, #{transferOrderId,jdbcType=VARCHAR})
on duplicate key update on duplicate key update
id = #{id,jdbcType=INTEGER}, id = #{id,jdbcType=INTEGER},
cost_first = #{costFirst,jdbcType=DECIMAL}, cost_first = #{costFirst,jdbcType=DECIMAL},
...@@ -407,7 +432,8 @@ ...@@ -407,7 +432,8 @@
warehouse_code = #{warehouseCode,jdbcType=VARCHAR}, warehouse_code = #{warehouseCode,jdbcType=VARCHAR},
channel_order_id = #{channelOrderId,jdbcType=VARCHAR}, channel_order_id = #{channelOrderId,jdbcType=VARCHAR},
weight_ratio = #{weightRatio,jdbcType=DECIMAL}, weight_ratio = #{weightRatio,jdbcType=DECIMAL},
quantity = #{quantity,jdbcType=INTEGER} quantity = #{quantity,jdbcType=INTEGER},
transfer_order_id = #{transferOrderId,jdbcType=VARCHAR}
</insert> </insert>
<select id="selectOneByExample" parameterType="com.bailuntec.domain.example.DcMidCostFirstOrderExample" resultMap="BaseResultMap"> <select id="selectOneByExample" parameterType="com.bailuntec.domain.example.DcMidCostFirstOrderExample" resultMap="BaseResultMap">
<!-- <!--
......
...@@ -10,5 +10,5 @@ EVENT_RDB_STORAGE_PASSWORD=#7kfnymAM$Y9-Ntf ...@@ -10,5 +10,5 @@ EVENT_RDB_STORAGE_PASSWORD=#7kfnymAM$Y9-Ntf
ZOOKEEPER_SERVER=172.31.255.120:2181 ZOOKEEPER_SERVER=172.31.255.120:2181
NAME_SPACE=data-center NAME_SPACE=data-center
JOB_NAME=mid-calculate-cost-first JOB_NAME=mid-calculate-cost-first
JOB_CRON=0 33 7,20 * * ? * JOB_CRON=0 33 7,12,20 * * ? *
SHARDING_TOTAL_COUNT=1 SHARDING_TOTAL_COUNT=1
\ No newline at end of file
import com.bailuntec.domain.entity.DcBaseCostFirst; import com.bailuntec.domain.entity.DcBaseCostFirst;
import com.bailuntec.domain.example.DcBaseCostFirstExample; import com.bailuntec.domain.example.DcBaseCostFirstExample;
import com.bailuntec.domain.pojo.CostFirstOrder;
import com.bailuntec.job.CalculateCostFirstJob; import com.bailuntec.job.CalculateCostFirstJob;
import com.bailuntec.listener.CalculateCostFirstListener; import com.bailuntec.listener.CalculateCostFirstListener;
import com.bailuntec.mapper.DcBaseCostFirstMapper; import com.bailuntec.mapper.DcBaseCostFirstMapper;
...@@ -16,11 +17,11 @@ public class CostFirstTest { ...@@ -16,11 +17,11 @@ public class CostFirstTest {
try { try {
DcBaseCostFirstMapper dcBaseCostFirstMapper = SessionUtil.getSession().getMapper(DcBaseCostFirstMapper.class); DcBaseCostFirstMapper dcBaseCostFirstMapper = SessionUtil.getSession().getMapper(DcBaseCostFirstMapper.class);
//拿到物流单号, 将物流单中每个SKU的费用算出来 //拿到物流单号, 将物流单中每个SKU的费用算出来
List<String> channelOrderIdList = dcBaseCostFirstMapper.listChannelOrderId(200, 2); List<CostFirstOrder> channelOrderIdList = dcBaseCostFirstMapper.listChannelOrderId(200, 2);
if (channelOrderIdList != null && channelOrderIdList.size() > 0) { if (channelOrderIdList != null && channelOrderIdList.size() > 0) {
for (String channelOrderId : channelOrderIdList) { for (CostFirstOrder costFirstOrder : channelOrderIdList) {
DcBaseCostFirstMapper dcBaseCostFirstMapperFor = SessionUtil.getSession().getMapper(DcBaseCostFirstMapper.class); DcBaseCostFirstMapper dcBaseCostFirstMapperFor = SessionUtil.getSession().getMapper(DcBaseCostFirstMapper.class);
List<DcBaseCostFirst> dcBaseCostFirsts = dcBaseCostFirstMapperFor.selectByExample(DcBaseCostFirstExample.newAndCreateCriteria().andChannelOrderIdEqualTo(channelOrderId).example()); List<DcBaseCostFirst> dcBaseCostFirsts = dcBaseCostFirstMapperFor.selectByExample(DcBaseCostFirstExample.newAndCreateCriteria().andChannelOrderIdEqualTo(costFirstOrder.getChannelOrderId()).andTransferOrderIdEqualTo(costFirstOrder.getTransferOrderId()).example());
costFirstJob.handleChannelOrderSku(dcBaseCostFirsts); costFirstJob.handleChannelOrderSku(dcBaseCostFirsts);
} }
} }
...@@ -30,7 +31,8 @@ public class CostFirstTest { ...@@ -30,7 +31,8 @@ public class CostFirstTest {
} finally { } finally {
SessionUtil.closeSession(); SessionUtil.closeSession();
} }
CalculateCostFirstListener calculateCostFirstListener = new CalculateCostFirstListener();
calculateCostFirstListener.afterJobExecuted(null);
} }
@Test @Test
public void test1() { public void test1() {
......
table-name=dc_base_oms_sku table-name=dc_mid_cost_first_order
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