Commit 041c7d4a by yinyong

头程费用逻辑修改

parent 9efba868
...@@ -97,6 +97,15 @@ public class DcMidCostFirstOrder { ...@@ -97,6 +97,15 @@ public class DcMidCostFirstOrder {
private Boolean hasCalculation; private Boolean hasCalculation;
/** /**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column dc_mid_cost_first_order.box_id
*
* @mbg.generated
*/
private String boxId;
/**
* 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
* *
...@@ -118,6 +127,7 @@ public class DcMidCostFirstOrder { ...@@ -118,6 +127,7 @@ public class DcMidCostFirstOrder {
sb.append(", transferOrderId=").append(transferOrderId); sb.append(", transferOrderId=").append(transferOrderId);
sb.append(", companyId=").append(companyId); sb.append(", companyId=").append(companyId);
sb.append(", hasCalculation=").append(hasCalculation); sb.append(", hasCalculation=").append(hasCalculation);
sb.append(", boxId=").append(boxId);
sb.append("]"); sb.append("]");
return sb.toString(); return sb.toString();
} }
...@@ -149,7 +159,8 @@ public class DcMidCostFirstOrder { ...@@ -149,7 +159,8 @@ public class DcMidCostFirstOrder {
&& (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())) && (this.getTransferOrderId() == null ? other.getTransferOrderId() == null : this.getTransferOrderId().equals(other.getTransferOrderId()))
&& (this.getCompanyId() == null ? other.getCompanyId() == null : this.getCompanyId().equals(other.getCompanyId())) && (this.getCompanyId() == null ? other.getCompanyId() == null : this.getCompanyId().equals(other.getCompanyId()))
&& (this.getHasCalculation() == null ? other.getHasCalculation() == null : this.getHasCalculation().equals(other.getHasCalculation())); && (this.getHasCalculation() == null ? other.getHasCalculation() == null : this.getHasCalculation().equals(other.getHasCalculation()))
&& (this.getBoxId() == null ? other.getBoxId() == null : this.getBoxId().equals(other.getBoxId()));
} }
/** /**
...@@ -172,6 +183,7 @@ public class DcMidCostFirstOrder { ...@@ -172,6 +183,7 @@ public class DcMidCostFirstOrder {
result = prime * result + ((getTransferOrderId() == null) ? 0 : getTransferOrderId().hashCode()); result = prime * result + ((getTransferOrderId() == null) ? 0 : getTransferOrderId().hashCode());
result = prime * result + ((getCompanyId() == null) ? 0 : getCompanyId().hashCode()); result = prime * result + ((getCompanyId() == null) ? 0 : getCompanyId().hashCode());
result = prime * result + ((getHasCalculation() == null) ? 0 : getHasCalculation().hashCode()); result = prime * result + ((getHasCalculation() == null) ? 0 : getHasCalculation().hashCode());
result = prime * result + ((getBoxId() == null) ? 0 : getBoxId().hashCode());
return result; return result;
} }
} }
\ No newline at end of file
...@@ -1009,6 +1009,76 @@ public class DcMidCostFirstOrderExample { ...@@ -1009,6 +1009,76 @@ public class DcMidCostFirstOrderExample {
addCriterion("has_calculation not between", value1, value2, "hasCalculation"); addCriterion("has_calculation not between", value1, value2, "hasCalculation");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andBoxIdIsNull() {
addCriterion("box_id is null");
return (Criteria) this;
}
public Criteria andBoxIdIsNotNull() {
addCriterion("box_id is not null");
return (Criteria) this;
}
public Criteria andBoxIdEqualTo(String value) {
addCriterion("box_id =", value, "boxId");
return (Criteria) this;
}
public Criteria andBoxIdNotEqualTo(String value) {
addCriterion("box_id <>", value, "boxId");
return (Criteria) this;
}
public Criteria andBoxIdGreaterThan(String value) {
addCriterion("box_id >", value, "boxId");
return (Criteria) this;
}
public Criteria andBoxIdGreaterThanOrEqualTo(String value) {
addCriterion("box_id >=", value, "boxId");
return (Criteria) this;
}
public Criteria andBoxIdLessThan(String value) {
addCriterion("box_id <", value, "boxId");
return (Criteria) this;
}
public Criteria andBoxIdLessThanOrEqualTo(String value) {
addCriterion("box_id <=", value, "boxId");
return (Criteria) this;
}
public Criteria andBoxIdLike(String value) {
addCriterion("box_id like", value, "boxId");
return (Criteria) this;
}
public Criteria andBoxIdNotLike(String value) {
addCriterion("box_id not like", value, "boxId");
return (Criteria) this;
}
public Criteria andBoxIdIn(List<String> values) {
addCriterion("box_id in", values, "boxId");
return (Criteria) this;
}
public Criteria andBoxIdNotIn(List<String> values) {
addCriterion("box_id not in", values, "boxId");
return (Criteria) this;
}
public Criteria andBoxIdBetween(String value1, String value2) {
addCriterion("box_id between", value1, value2, "boxId");
return (Criteria) this;
}
public Criteria andBoxIdNotBetween(String value1, String value2) {
addCriterion("box_id not between", value1, value2, "boxId");
return (Criteria) this;
}
} }
/** /**
......
...@@ -6,4 +6,6 @@ import lombok.Data; ...@@ -6,4 +6,6 @@ import lombok.Data;
public class CostFirstOrder { public class CostFirstOrder {
private String channelOrderId; private String channelOrderId;
private String transferOrderId; private String transferOrderId;
private String boxId;
private String warehouseCode;
} }
...@@ -743,15 +743,15 @@ ...@@ -743,15 +743,15 @@
limit 1 limit 1
</select> </select>
<select id="listChannelOrderId" resultType="com.bailuntec.domain.pojo.CostFirstOrder"> <select id="listChannelOrderId" resultType="com.bailuntec.domain.pojo.CostFirstOrder">
SELECT channel_order_id,transfer_order_id FROM `dc_base_cost_first` WHERE cost_first>0 and has_calculation = 0 GROUP BY channel_order_id,transfer_order_id ORDER BY transfer_order_id asc limit #{v1}, #{v2}; SELECT channel_order_id,transfer_order_id, box_id, warehouse_code FROM `dc_base_cost_first` WHERE cost_first>0 and has_calculation = 0 GROUP BY channel_order_id,transfer_order_id, box_id, warehouse_code 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,transfer_order_id FROM `dc_base_cost_first` WHERE cost_first>0 and has_calculation = 0 GROUP BY channel_order_id,transfer_order_id) tb; SELECT COUNT(*) FROM (SELECT channel_order_id,transfer_order_id, box_id, warehouse_code FROM `dc_base_cost_first` WHERE cost_first>0 and has_calculation = 0 GROUP BY channel_order_id,transfer_order_id, box_id, warehouse_code) tb;
</select> </select>
<update id="updateHasCalculation"> <update id="updateHasCalculation">
update dc_base_cost_first set has_calculation = 1 where channel_order_id = #{channelOrderId} and transfer_order_id = #{transferOrderId} and has_calculation = 0 update dc_base_cost_first set has_calculation = 1 where channel_order_id = #{channelOrderId} and transfer_order_id = #{transferOrderId} and box_id = #{boxId} and warehouse_code = #{warehouseCode} and has_calculation = 0
</update> </update>
</mapper> </mapper>
\ No newline at end of file
...@@ -16,6 +16,7 @@ ...@@ -16,6 +16,7 @@
<result column="transfer_order_id" jdbcType="VARCHAR" property="transferOrderId" /> <result column="transfer_order_id" jdbcType="VARCHAR" property="transferOrderId" />
<result column="company_id" jdbcType="INTEGER" property="companyId" /> <result column="company_id" jdbcType="INTEGER" property="companyId" />
<result column="has_calculation" jdbcType="BIT" property="hasCalculation" /> <result column="has_calculation" jdbcType="BIT" property="hasCalculation" />
<result column="box_id" jdbcType="VARCHAR" property="boxId" />
</resultMap> </resultMap>
<sql id="Example_Where_Clause"> <sql id="Example_Where_Clause">
<!-- <!--
...@@ -89,7 +90,7 @@ ...@@ -89,7 +90,7 @@
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, company_id, has_calculation transfer_order_id, company_id, has_calculation, box_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">
<!-- <!--
...@@ -153,11 +154,11 @@ ...@@ -153,11 +154,11 @@
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, transfer_order_id, company_id, quantity, transfer_order_id, company_id,
has_calculation) has_calculation, box_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}, #{transferOrderId,jdbcType=VARCHAR}, #{companyId,jdbcType=INTEGER}, #{quantity,jdbcType=INTEGER}, #{transferOrderId,jdbcType=VARCHAR}, #{companyId,jdbcType=INTEGER},
#{hasCalculation,jdbcType=BIT}) #{hasCalculation,jdbcType=BIT}, #{boxId,jdbcType=VARCHAR})
</insert> </insert>
<insert id="insertSelective" parameterType="com.bailuntec.domain.entity.DcMidCostFirstOrder"> <insert id="insertSelective" parameterType="com.bailuntec.domain.entity.DcMidCostFirstOrder">
<!-- <!--
...@@ -196,6 +197,9 @@ ...@@ -196,6 +197,9 @@
<if test="hasCalculation != null"> <if test="hasCalculation != null">
has_calculation, has_calculation,
</if> </if>
<if test="boxId != null">
box_id,
</if>
</trim> </trim>
<trim prefix="values (" suffix=")" suffixOverrides=","> <trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null"> <if test="id != null">
...@@ -228,6 +232,9 @@ ...@@ -228,6 +232,9 @@
<if test="hasCalculation != null"> <if test="hasCalculation != null">
#{hasCalculation,jdbcType=BIT}, #{hasCalculation,jdbcType=BIT},
</if> </if>
<if test="boxId != null">
#{boxId,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">
...@@ -277,6 +284,9 @@ ...@@ -277,6 +284,9 @@
<if test="record.hasCalculation != null"> <if test="record.hasCalculation != null">
has_calculation = #{record.hasCalculation,jdbcType=BIT}, has_calculation = #{record.hasCalculation,jdbcType=BIT},
</if> </if>
<if test="record.boxId != null">
box_id = #{record.boxId,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" />
...@@ -297,7 +307,8 @@ ...@@ -297,7 +307,8 @@
quantity = #{record.quantity,jdbcType=INTEGER}, quantity = #{record.quantity,jdbcType=INTEGER},
transfer_order_id = #{record.transferOrderId,jdbcType=VARCHAR}, transfer_order_id = #{record.transferOrderId,jdbcType=VARCHAR},
company_id = #{record.companyId,jdbcType=INTEGER}, company_id = #{record.companyId,jdbcType=INTEGER},
has_calculation = #{record.hasCalculation,jdbcType=BIT} has_calculation = #{record.hasCalculation,jdbcType=BIT},
box_id = #{record.boxId,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>
...@@ -336,6 +347,9 @@ ...@@ -336,6 +347,9 @@
<if test="hasCalculation != null"> <if test="hasCalculation != null">
has_calculation = #{hasCalculation,jdbcType=BIT}, has_calculation = #{hasCalculation,jdbcType=BIT},
</if> </if>
<if test="boxId != null">
box_id = #{boxId,jdbcType=VARCHAR},
</if>
</set> </set>
where id = #{id,jdbcType=INTEGER} where id = #{id,jdbcType=INTEGER}
</update> </update>
...@@ -353,7 +367,8 @@ ...@@ -353,7 +367,8 @@
quantity = #{quantity,jdbcType=INTEGER}, quantity = #{quantity,jdbcType=INTEGER},
transfer_order_id = #{transferOrderId,jdbcType=VARCHAR}, transfer_order_id = #{transferOrderId,jdbcType=VARCHAR},
company_id = #{companyId,jdbcType=INTEGER}, company_id = #{companyId,jdbcType=INTEGER},
has_calculation = #{hasCalculation,jdbcType=BIT} has_calculation = #{hasCalculation,jdbcType=BIT},
box_id = #{boxId,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">
...@@ -394,6 +409,9 @@ ...@@ -394,6 +409,9 @@
<if test="hasCalculation != null"> <if test="hasCalculation != null">
has_calculation, has_calculation,
</if> </if>
<if test="boxId != null">
box_id,
</if>
</trim> </trim>
values values
<trim prefix="(" suffix=")" suffixOverrides=","> <trim prefix="(" suffix=")" suffixOverrides=",">
...@@ -427,6 +445,9 @@ ...@@ -427,6 +445,9 @@
<if test="hasCalculation != null"> <if test="hasCalculation != null">
#{hasCalculation,jdbcType=BIT}, #{hasCalculation,jdbcType=BIT},
</if> </if>
<if test="boxId != null">
#{boxId,jdbcType=VARCHAR},
</if>
</trim> </trim>
on duplicate key update on duplicate key update
<trim suffixOverrides=","> <trim suffixOverrides=",">
...@@ -460,6 +481,9 @@ ...@@ -460,6 +481,9 @@
<if test="hasCalculation != null"> <if test="hasCalculation != null">
has_calculation = #{hasCalculation,jdbcType=BIT}, has_calculation = #{hasCalculation,jdbcType=BIT},
</if> </if>
<if test="boxId != null">
box_id = #{boxId,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">
...@@ -470,12 +494,12 @@ ...@@ -470,12 +494,12 @@
--> -->
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, company_id, has_calculation) transfer_order_id, company_id, has_calculation, box_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}, #{transferOrderId,jdbcType=VARCHAR}, #{companyId,jdbcType=INTEGER}, #{quantity,jdbcType=INTEGER}, #{transferOrderId,jdbcType=VARCHAR}, #{companyId,jdbcType=INTEGER},
#{hasCalculation,jdbcType=BIT}) #{hasCalculation,jdbcType=BIT}, #{boxId,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},
...@@ -486,7 +510,8 @@ ...@@ -486,7 +510,8 @@
quantity = #{quantity,jdbcType=INTEGER}, quantity = #{quantity,jdbcType=INTEGER},
transfer_order_id = #{transferOrderId,jdbcType=VARCHAR}, transfer_order_id = #{transferOrderId,jdbcType=VARCHAR},
company_id = #{companyId,jdbcType=INTEGER}, company_id = #{companyId,jdbcType=INTEGER},
has_calculation = #{hasCalculation,jdbcType=BIT} has_calculation = #{hasCalculation,jdbcType=BIT},
box_id = #{boxId,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">
<!-- <!--
......
...@@ -51,7 +51,7 @@ public class CalculateCostFirstJob extends PointJob { ...@@ -51,7 +51,7 @@ public class CalculateCostFirstJob extends PointJob {
if (channelOrderIdList != null && channelOrderIdList.size() > 0) { if (channelOrderIdList != null && channelOrderIdList.size() > 0) {
for (CostFirstOrder costFirstOrder : 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(costFirstOrder.getChannelOrderId()).andTransferOrderIdEqualTo(costFirstOrder.getTransferOrderId()).andHasCalculationEqualTo(false).example()); List<DcBaseCostFirst> dcBaseCostFirsts = dcBaseCostFirstMapperFor.selectByExample(DcBaseCostFirstExample.newAndCreateCriteria().andChannelOrderIdEqualTo(costFirstOrder.getChannelOrderId()).andTransferOrderIdEqualTo(costFirstOrder.getTransferOrderId()).andBoxIdEqualTo(costFirstOrder.getBoxId()).andWarehouseCodeEqualTo(costFirstOrder.getWarehouseCode()).andHasCalculationEqualTo(false).example());
handleChannelOrderSku(dcBaseCostFirsts); handleChannelOrderSku(dcBaseCostFirsts);
dcBaseCostFirstMapperFor = SessionUtil.getSession().getMapper(DcBaseCostFirstMapper.class); dcBaseCostFirstMapperFor = SessionUtil.getSession().getMapper(DcBaseCostFirstMapper.class);
dcBaseCostFirstMapperFor.updateHasCalculation(costFirstOrder); dcBaseCostFirstMapperFor.updateHasCalculation(costFirstOrder);
...@@ -119,7 +119,7 @@ public class CalculateCostFirstJob extends PointJob { ...@@ -119,7 +119,7 @@ public class CalculateCostFirstJob extends PointJob {
//物流单的总重量 //物流单的总重量
BigDecimal totalWeight = BigDecimal.ZERO; BigDecimal totalWeight = BigDecimal.ZERO;
for (DcBaseCostFirst dcBaseCostFirst : dcBaseCostFirsts) { for (DcBaseCostFirst dcBaseCostFirst : dcBaseCostFirsts) {
log.warn(dcBaseCostFirst.getBailunSku()+"---" +dcBaseCostFirst.getChannelOrderId()+"---" +dcBaseCostFirst.getTransferOrderId()); log.warn(dcBaseCostFirst.getBailunSku()+"---" +dcBaseCostFirst.getChannelOrderId()+"---" +dcBaseCostFirst.getTransferOrderId()+"---"+dcBaseCostFirst.getBoxId()+"---"+dcBaseCostFirst.getWarehouseCode());
DcBaseSku dcBaseSku = null; DcBaseSku dcBaseSku = null;
try { try {
DcBaseSkuMapper dcBaseSkuMapper = SessionUtil.getSession().getMapper(DcBaseSkuMapper.class); DcBaseSkuMapper dcBaseSkuMapper = SessionUtil.getSession().getMapper(DcBaseSkuMapper.class);
...@@ -160,6 +160,7 @@ public class CalculateCostFirstJob extends PointJob { ...@@ -160,6 +160,7 @@ public class CalculateCostFirstJob extends PointJob {
dcMidCostFirstOrder.setChannelOrderId(dcBaseCostFirst.getChannelOrderId()); dcMidCostFirstOrder.setChannelOrderId(dcBaseCostFirst.getChannelOrderId());
dcMidCostFirstOrder.setTransferOrderId(dcBaseCostFirst.getTransferOrderId()); dcMidCostFirstOrder.setTransferOrderId(dcBaseCostFirst.getTransferOrderId());
dcMidCostFirstOrder.setQuantity(dcBaseCostFirst.getQuantity()); dcMidCostFirstOrder.setQuantity(dcBaseCostFirst.getQuantity());
dcMidCostFirstOrder.setBoxId(dcBaseCostFirst.getBoxId());
dcMidCostFirstOrder.setWeightRatio(skuWeightRatio); dcMidCostFirstOrder.setWeightRatio(skuWeightRatio);
//将费用放到SKU上 //将费用放到SKU上
dcMidCostFirstOrder.setCostFirst(skuCostFirst); dcMidCostFirstOrder.setCostFirst(skuCostFirst);
......
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