Commit d57e2278 by liyanlin

1、增加Shopify销量计算;

2、修复已知bug。
parent 2841bd08
...@@ -464,10 +464,12 @@ public class OrderSyncJob extends PointJob { ...@@ -464,10 +464,12 @@ public class OrderSyncJob extends PointJob {
dcBaseOmsSku.setCostTotal(rmbCost); dcBaseOmsSku.setCostTotal(rmbCost);
//利润都转为人民币计算 //利润都转为人民币计算
BigDecimal unitSkuProfit = BigDecimal.ZERO; BigDecimal unitSkuProfit = BigDecimal.ZERO;
if (dcBaseOmsOrder.getPlatformType().toUpperCase().equals(PlatformType.Amazon.value())) { if(bailunSkuQuantityShippedDecimal.compareTo(BigDecimal.ZERO) > 0) {
unitSkuProfit = unitSkuAmountSalesRMB.add(unitSkuAmountTaxRMB).subtract(dcBaseOmsSku.getCostTotal()); if (dcBaseOmsOrder.getPlatformType().toUpperCase().equals(PlatformType.Amazon.value())) {
} else { unitSkuProfit = unitSkuAmountSalesRMB.add(unitSkuAmountTaxRMB).subtract(dcBaseOmsSku.getCostTotal());
unitSkuProfit = unitSkuAmountSalesRMB.subtract(dcBaseOmsSku.getCostTotal()); } else {
unitSkuProfit = unitSkuAmountSalesRMB.subtract(dcBaseOmsSku.getCostTotal());
}
} }
//只有发货的SKU才去算订单维度利润 //只有发货的SKU才去算订单维度利润
BigDecimal skuShippedProfit = unitSkuProfit.multiply(bailunSkuQuantityShippedDecimal); BigDecimal skuShippedProfit = unitSkuProfit.multiply(bailunSkuQuantityShippedDecimal);
......
...@@ -853,6 +853,21 @@ public class DcAutoTurnover { ...@@ -853,6 +853,21 @@ public class DcAutoTurnover {
private BigDecimal historyThirtydaySalesWalmart; private BigDecimal historyThirtydaySalesWalmart;
/** /**
* shopify 过去7日销量(日均)
*/
private BigDecimal historySevendaySalesShopify;
/**
* shopify 过去14日销量(日均)
*/
private BigDecimal historyFourteendaySalesShopify;
/**
* shopify 过去30日销量(日均)
*/
private BigDecimal historyThirtydaySalesShopify;
/**
* This method was generated by MyBatis Generator. * This method was generated by MyBatis Generator.
* This method corresponds to the database table dc_auto_turnover * This method corresponds to the database table dc_auto_turnover
* *
...@@ -958,6 +973,9 @@ public class DcAutoTurnover { ...@@ -958,6 +973,9 @@ public class DcAutoTurnover {
sb.append(", historySevendaySalesWalmart=").append(historySevendaySalesWalmart); sb.append(", historySevendaySalesWalmart=").append(historySevendaySalesWalmart);
sb.append(", historyFourteendaySalesWalmart=").append(historyFourteendaySalesWalmart); sb.append(", historyFourteendaySalesWalmart=").append(historyFourteendaySalesWalmart);
sb.append(", historyThirtydaySalesWalmart=").append(historyThirtydaySalesWalmart); sb.append(", historyThirtydaySalesWalmart=").append(historyThirtydaySalesWalmart);
sb.append(", historySevendaySalesShopify=").append(historySevendaySalesShopify);
sb.append(", historyFourteendaySalesShopify=").append(historyFourteendaySalesShopify);
sb.append(", historyThirtydaySalesShopify=").append(historyThirtydaySalesShopify);
sb.append("]"); sb.append("]");
return sb.toString(); return sb.toString();
} }
...@@ -1073,7 +1091,10 @@ public class DcAutoTurnover { ...@@ -1073,7 +1091,10 @@ public class DcAutoTurnover {
&& (this.getBailunSkuWarehouseCode() == null ? other.getBailunSkuWarehouseCode() == null : this.getBailunSkuWarehouseCode().equals(other.getBailunSkuWarehouseCode())) && (this.getBailunSkuWarehouseCode() == null ? other.getBailunSkuWarehouseCode() == null : this.getBailunSkuWarehouseCode().equals(other.getBailunSkuWarehouseCode()))
&& (this.getHistorySevendaySalesWalmart() == null ? other.getHistorySevendaySalesWalmart() == null : this.getHistorySevendaySalesWalmart().equals(other.getHistorySevendaySalesWalmart())) && (this.getHistorySevendaySalesWalmart() == null ? other.getHistorySevendaySalesWalmart() == null : this.getHistorySevendaySalesWalmart().equals(other.getHistorySevendaySalesWalmart()))
&& (this.getHistoryFourteendaySalesWalmart() == null ? other.getHistoryFourteendaySalesWalmart() == null : this.getHistoryFourteendaySalesWalmart().equals(other.getHistoryFourteendaySalesWalmart())) && (this.getHistoryFourteendaySalesWalmart() == null ? other.getHistoryFourteendaySalesWalmart() == null : this.getHistoryFourteendaySalesWalmart().equals(other.getHistoryFourteendaySalesWalmart()))
&& (this.getHistoryThirtydaySalesWalmart() == null ? other.getHistoryThirtydaySalesWalmart() == null : this.getHistoryThirtydaySalesWalmart().equals(other.getHistoryThirtydaySalesWalmart())); && (this.getHistoryThirtydaySalesWalmart() == null ? other.getHistoryThirtydaySalesWalmart() == null : this.getHistoryThirtydaySalesWalmart().equals(other.getHistoryThirtydaySalesWalmart()))
&& (this.getHistorySevendaySalesShopify() == null ? other.getHistorySevendaySalesShopify() == null : this.getHistorySevendaySalesShopify().equals(other.getHistorySevendaySalesShopify()))
&& (this.getHistoryFourteendaySalesShopify() == null ? other.getHistoryFourteendaySalesShopify() == null : this.getHistoryFourteendaySalesShopify().equals(other.getHistoryFourteendaySalesShopify()))
&& (this.getHistoryThirtydaySalesShopify() == null ? other.getHistoryThirtydaySalesShopify() == null : this.getHistoryThirtydaySalesShopify().equals(other.getHistoryThirtydaySalesShopify()));
} }
/** /**
...@@ -1180,6 +1201,9 @@ public class DcAutoTurnover { ...@@ -1180,6 +1201,9 @@ public class DcAutoTurnover {
result = prime * result + ((getHistorySevendaySalesWalmart() == null) ? 0 : getHistorySevendaySalesWalmart().hashCode()); result = prime * result + ((getHistorySevendaySalesWalmart() == null) ? 0 : getHistorySevendaySalesWalmart().hashCode());
result = prime * result + ((getHistoryFourteendaySalesWalmart() == null) ? 0 : getHistoryFourteendaySalesWalmart().hashCode()); result = prime * result + ((getHistoryFourteendaySalesWalmart() == null) ? 0 : getHistoryFourteendaySalesWalmart().hashCode());
result = prime * result + ((getHistoryThirtydaySalesWalmart() == null) ? 0 : getHistoryThirtydaySalesWalmart().hashCode()); result = prime * result + ((getHistoryThirtydaySalesWalmart() == null) ? 0 : getHistoryThirtydaySalesWalmart().hashCode());
result = prime * result + ((getHistorySevendaySalesShopify() == null) ? 0 : getHistorySevendaySalesShopify().hashCode());
result = prime * result + ((getHistoryFourteendaySalesShopify() == null) ? 0 : getHistoryFourteendaySalesShopify().hashCode());
result = prime * result + ((getHistoryThirtydaySalesShopify() == null) ? 0 : getHistoryThirtydaySalesShopify().hashCode());
return result; return result;
} }
} }
\ No newline at end of file
...@@ -20,8 +20,9 @@ public enum PlatformType { ...@@ -20,8 +20,9 @@ public enum PlatformType {
Walmart(13,"WALMART"), Walmart(13,"WALMART"),
PriceMinister(14,"PRICEMINISTER"), PriceMinister(14,"PRICEMINISTER"),
wwFnac(15,"WWFNAC"), wwFnac(15,"WWFNAC"),
Marketing(16, "MARKETING"); Marketing(16, "MARKETING"),
Shopify(21, "SHOPIFY");
private final int code; private final int code;
private final String value; private final String value;
......
...@@ -682,6 +682,15 @@ ...@@ -682,6 +682,15 @@
<if test="salesDetailsFormula != null"> <if test="salesDetailsFormula != null">
sales_details_formula, sales_details_formula,
</if> </if>
<if test="historySevendaySalesShopify != null">
history_sevenday_sales_shopify,
</if>
<if test="historyFourteendaySalesShopify != null">
history_fourteenday_sales_shopify,
</if>
<if test="historyThirtydaySalesShopify != null">
history_thirtyday_sales_shopify,
</if>
</trim> </trim>
<trim prefix="values (" suffix=")" suffixOverrides=","> <trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null"> <if test="id != null">
...@@ -975,6 +984,15 @@ ...@@ -975,6 +984,15 @@
<if test="salesDetailsFormula != null"> <if test="salesDetailsFormula != null">
#{salesDetailsFormula,jdbcType=LONGVARCHAR}, #{salesDetailsFormula,jdbcType=LONGVARCHAR},
</if> </if>
<if test="historySevendaySalesShopify != null">
#{historySevendaySalesShopify,jdbcType=DECIMAL},
</if>
<if test="historyFourteendaySalesShopify != null">
#{historyFourteendaySalesShopify,jdbcType=DECIMAL},
</if>
<if test="historyThirtydaySalesShopify != null">
#{historyThirtydaySalesShopify,jdbcType=DECIMAL},
</if>
</trim> </trim>
</insert> </insert>
<select id="countByExample" parameterType="com.bailuntec.domain.example.DcAutoTurnoverExample" resultType="java.lang.Long"> <select id="countByExample" parameterType="com.bailuntec.domain.example.DcAutoTurnoverExample" resultType="java.lang.Long">
......
...@@ -951,6 +951,17 @@ public class AutoTurnoverJob extends PointJob { ...@@ -951,6 +951,17 @@ public class AutoTurnoverJob extends PointJob {
dcAutoTurnover.setHistoryThirtydaySalesWalmart(BigDecimal.valueOf(walmartAvgSales.getThirtydaySales()).divide(Constant.BIGDECIMAL_THIRTY, 3, RoundingMode.HALF_EVEN)); dcAutoTurnover.setHistoryThirtydaySalesWalmart(BigDecimal.valueOf(walmartAvgSales.getThirtydaySales()).divide(Constant.BIGDECIMAL_THIRTY, 3, RoundingMode.HALF_EVEN));
} }
//Shopify
SalesVolumeAvgDTO shopifyAvgSales = mapper.getPlatformHistorySales(dcAutoTurnover.getBailunSku(), dcAutoTurnover.getWarehouseCode(), PlatformType.Shopify.value());
dcAutoTurnover.setHistorySevendaySalesShopify(BigDecimal.ZERO);
dcAutoTurnover.setHistoryFourteendaySalesShopify(BigDecimal.ZERO);
dcAutoTurnover.setHistoryThirtydaySalesShopify(BigDecimal.ZERO);
if (shopifyAvgSales != null) {
dcAutoTurnover.setHistorySevendaySalesShopify(BigDecimal.valueOf(shopifyAvgSales.getSevendaySales()).divide(Constant.BIGDECIMAL_SEVEN, 3, RoundingMode.HALF_EVEN));
dcAutoTurnover.setHistoryFourteendaySalesShopify(BigDecimal.valueOf(shopifyAvgSales.getFourteendaySales()).divide(Constant.BIGDECIMAL_FOURTEEN, 3, RoundingMode.HALF_EVEN));
dcAutoTurnover.setHistoryThirtydaySalesShopify(BigDecimal.valueOf(shopifyAvgSales.getThirtydaySales()).divide(Constant.BIGDECIMAL_THIRTY, 3, RoundingMode.HALF_EVEN));
}
} catch (Exception e) { } catch (Exception e) {
throw new RuntimeException("计算平台的平均销量失败", e); throw new RuntimeException("计算平台的平均销量失败", e);
} finally { } finally {
......
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