Commit 4d0370a6 by wutong

自动周转给指定平台加上三天平均销量

parent 3265627f
......@@ -548,6 +548,33 @@ public class DcAutoTurnover {
private String suppliersName;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column dc_auto_turnover.history_sevenday_sales_ebay
*
* @mbg.generated
*/
private BigDecimal historySevendaySalesEbay;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column dc_auto_turnover.history_fourteenday_sales_ebay
*
* @mbg.generated
*/
private BigDecimal historyFourteendaySalesEbay;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column dc_auto_turnover.history_thirtyday_sales_ebay
*
* @mbg.generated
*/
private BigDecimal historyThirtydaySalesEbay;
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table dc_auto_turnover
*
......@@ -619,6 +646,9 @@ public class DcAutoTurnover {
sb.append(", bailunCategoryId=").append(bailunCategoryId);
sb.append(", buyerName=").append(buyerName);
sb.append(", suppliersName=").append(suppliersName);
sb.append(", historySevendaySalesEbay=").append(historySevendaySalesEbay);
sb.append(", historyFourteendaySalesEbay=").append(historyFourteendaySalesEbay);
sb.append(", historyThirtydaySalesEbay=").append(historyThirtydaySalesEbay);
sb.append("]");
return sb.toString();
}
......@@ -700,7 +730,10 @@ public class DcAutoTurnover {
&& (this.getProductInnerCode() == null ? other.getProductInnerCode() == null : this.getProductInnerCode().equals(other.getProductInnerCode()))
&& (this.getBailunCategoryId() == null ? other.getBailunCategoryId() == null : this.getBailunCategoryId().equals(other.getBailunCategoryId()))
&& (this.getBuyerName() == null ? other.getBuyerName() == null : this.getBuyerName().equals(other.getBuyerName()))
&& (this.getSuppliersName() == null ? other.getSuppliersName() == null : this.getSuppliersName().equals(other.getSuppliersName()));
&& (this.getSuppliersName() == null ? other.getSuppliersName() == null : this.getSuppliersName().equals(other.getSuppliersName()))
&& (this.getHistorySevendaySalesEbay() == null ? other.getHistorySevendaySalesEbay() == null : this.getHistorySevendaySalesEbay().equals(other.getHistorySevendaySalesEbay()))
&& (this.getHistoryFourteendaySalesEbay() == null ? other.getHistoryFourteendaySalesEbay() == null : this.getHistoryFourteendaySalesEbay().equals(other.getHistoryFourteendaySalesEbay()))
&& (this.getHistoryThirtydaySalesEbay() == null ? other.getHistoryThirtydaySalesEbay() == null : this.getHistoryThirtydaySalesEbay().equals(other.getHistoryThirtydaySalesEbay()));
}
/**
......@@ -773,6 +806,9 @@ public class DcAutoTurnover {
result = prime * result + ((getBailunCategoryId() == null) ? 0 : getBailunCategoryId().hashCode());
result = prime * result + ((getBuyerName() == null) ? 0 : getBuyerName().hashCode());
result = prime * result + ((getSuppliersName() == null) ? 0 : getSuppliersName().hashCode());
result = prime * result + ((getHistorySevendaySalesEbay() == null) ? 0 : getHistorySevendaySalesEbay().hashCode());
result = prime * result + ((getHistoryFourteendaySalesEbay() == null) ? 0 : getHistoryFourteendaySalesEbay().hashCode());
result = prime * result + ((getHistoryThirtydaySalesEbay() == null) ? 0 : getHistoryThirtydaySalesEbay().hashCode());
return result;
}
}
\ No newline at end of file
......@@ -4140,6 +4140,186 @@ public class DcAutoTurnoverExample {
addCriterion("suppliers_name not between", value1, value2, "suppliersName");
return (Criteria) this;
}
public Criteria andHistorySevendaySalesEbayIsNull() {
addCriterion("history_sevenday_sales_ebay is null");
return (Criteria) this;
}
public Criteria andHistorySevendaySalesEbayIsNotNull() {
addCriterion("history_sevenday_sales_ebay is not null");
return (Criteria) this;
}
public Criteria andHistorySevendaySalesEbayEqualTo(BigDecimal value) {
addCriterion("history_sevenday_sales_ebay =", value, "historySevendaySalesEbay");
return (Criteria) this;
}
public Criteria andHistorySevendaySalesEbayNotEqualTo(BigDecimal value) {
addCriterion("history_sevenday_sales_ebay <>", value, "historySevendaySalesEbay");
return (Criteria) this;
}
public Criteria andHistorySevendaySalesEbayGreaterThan(BigDecimal value) {
addCriterion("history_sevenday_sales_ebay >", value, "historySevendaySalesEbay");
return (Criteria) this;
}
public Criteria andHistorySevendaySalesEbayGreaterThanOrEqualTo(BigDecimal value) {
addCriterion("history_sevenday_sales_ebay >=", value, "historySevendaySalesEbay");
return (Criteria) this;
}
public Criteria andHistorySevendaySalesEbayLessThan(BigDecimal value) {
addCriterion("history_sevenday_sales_ebay <", value, "historySevendaySalesEbay");
return (Criteria) this;
}
public Criteria andHistorySevendaySalesEbayLessThanOrEqualTo(BigDecimal value) {
addCriterion("history_sevenday_sales_ebay <=", value, "historySevendaySalesEbay");
return (Criteria) this;
}
public Criteria andHistorySevendaySalesEbayIn(List<BigDecimal> values) {
addCriterion("history_sevenday_sales_ebay in", values, "historySevendaySalesEbay");
return (Criteria) this;
}
public Criteria andHistorySevendaySalesEbayNotIn(List<BigDecimal> values) {
addCriterion("history_sevenday_sales_ebay not in", values, "historySevendaySalesEbay");
return (Criteria) this;
}
public Criteria andHistorySevendaySalesEbayBetween(BigDecimal value1, BigDecimal value2) {
addCriterion("history_sevenday_sales_ebay between", value1, value2, "historySevendaySalesEbay");
return (Criteria) this;
}
public Criteria andHistorySevendaySalesEbayNotBetween(BigDecimal value1, BigDecimal value2) {
addCriterion("history_sevenday_sales_ebay not between", value1, value2, "historySevendaySalesEbay");
return (Criteria) this;
}
public Criteria andHistoryFourteendaySalesEbayIsNull() {
addCriterion("history_fourteenday_sales_ebay is null");
return (Criteria) this;
}
public Criteria andHistoryFourteendaySalesEbayIsNotNull() {
addCriterion("history_fourteenday_sales_ebay is not null");
return (Criteria) this;
}
public Criteria andHistoryFourteendaySalesEbayEqualTo(BigDecimal value) {
addCriterion("history_fourteenday_sales_ebay =", value, "historyFourteendaySalesEbay");
return (Criteria) this;
}
public Criteria andHistoryFourteendaySalesEbayNotEqualTo(BigDecimal value) {
addCriterion("history_fourteenday_sales_ebay <>", value, "historyFourteendaySalesEbay");
return (Criteria) this;
}
public Criteria andHistoryFourteendaySalesEbayGreaterThan(BigDecimal value) {
addCriterion("history_fourteenday_sales_ebay >", value, "historyFourteendaySalesEbay");
return (Criteria) this;
}
public Criteria andHistoryFourteendaySalesEbayGreaterThanOrEqualTo(BigDecimal value) {
addCriterion("history_fourteenday_sales_ebay >=", value, "historyFourteendaySalesEbay");
return (Criteria) this;
}
public Criteria andHistoryFourteendaySalesEbayLessThan(BigDecimal value) {
addCriterion("history_fourteenday_sales_ebay <", value, "historyFourteendaySalesEbay");
return (Criteria) this;
}
public Criteria andHistoryFourteendaySalesEbayLessThanOrEqualTo(BigDecimal value) {
addCriterion("history_fourteenday_sales_ebay <=", value, "historyFourteendaySalesEbay");
return (Criteria) this;
}
public Criteria andHistoryFourteendaySalesEbayIn(List<BigDecimal> values) {
addCriterion("history_fourteenday_sales_ebay in", values, "historyFourteendaySalesEbay");
return (Criteria) this;
}
public Criteria andHistoryFourteendaySalesEbayNotIn(List<BigDecimal> values) {
addCriterion("history_fourteenday_sales_ebay not in", values, "historyFourteendaySalesEbay");
return (Criteria) this;
}
public Criteria andHistoryFourteendaySalesEbayBetween(BigDecimal value1, BigDecimal value2) {
addCriterion("history_fourteenday_sales_ebay between", value1, value2, "historyFourteendaySalesEbay");
return (Criteria) this;
}
public Criteria andHistoryFourteendaySalesEbayNotBetween(BigDecimal value1, BigDecimal value2) {
addCriterion("history_fourteenday_sales_ebay not between", value1, value2, "historyFourteendaySalesEbay");
return (Criteria) this;
}
public Criteria andHistoryThirtydaySalesEbayIsNull() {
addCriterion("history_thirtyday_sales_ebay is null");
return (Criteria) this;
}
public Criteria andHistoryThirtydaySalesEbayIsNotNull() {
addCriterion("history_thirtyday_sales_ebay is not null");
return (Criteria) this;
}
public Criteria andHistoryThirtydaySalesEbayEqualTo(BigDecimal value) {
addCriterion("history_thirtyday_sales_ebay =", value, "historyThirtydaySalesEbay");
return (Criteria) this;
}
public Criteria andHistoryThirtydaySalesEbayNotEqualTo(BigDecimal value) {
addCriterion("history_thirtyday_sales_ebay <>", value, "historyThirtydaySalesEbay");
return (Criteria) this;
}
public Criteria andHistoryThirtydaySalesEbayGreaterThan(BigDecimal value) {
addCriterion("history_thirtyday_sales_ebay >", value, "historyThirtydaySalesEbay");
return (Criteria) this;
}
public Criteria andHistoryThirtydaySalesEbayGreaterThanOrEqualTo(BigDecimal value) {
addCriterion("history_thirtyday_sales_ebay >=", value, "historyThirtydaySalesEbay");
return (Criteria) this;
}
public Criteria andHistoryThirtydaySalesEbayLessThan(BigDecimal value) {
addCriterion("history_thirtyday_sales_ebay <", value, "historyThirtydaySalesEbay");
return (Criteria) this;
}
public Criteria andHistoryThirtydaySalesEbayLessThanOrEqualTo(BigDecimal value) {
addCriterion("history_thirtyday_sales_ebay <=", value, "historyThirtydaySalesEbay");
return (Criteria) this;
}
public Criteria andHistoryThirtydaySalesEbayIn(List<BigDecimal> values) {
addCriterion("history_thirtyday_sales_ebay in", values, "historyThirtydaySalesEbay");
return (Criteria) this;
}
public Criteria andHistoryThirtydaySalesEbayNotIn(List<BigDecimal> values) {
addCriterion("history_thirtyday_sales_ebay not in", values, "historyThirtydaySalesEbay");
return (Criteria) this;
}
public Criteria andHistoryThirtydaySalesEbayBetween(BigDecimal value1, BigDecimal value2) {
addCriterion("history_thirtyday_sales_ebay between", value1, value2, "historyThirtydaySalesEbay");
return (Criteria) this;
}
public Criteria andHistoryThirtydaySalesEbayNotBetween(BigDecimal value1, BigDecimal value2) {
addCriterion("history_thirtyday_sales_ebay not between", value1, value2, "historyThirtydaySalesEbay");
return (Criteria) this;
}
}
/**
......
package com.bailuntec.domain.dto;
import lombok.Data;
import java.util.Date;
@Data
public class CatagoryDTO {
private Integer c_id;
private Integer c_parentid;
......@@ -23,155 +26,5 @@ public class CatagoryDTO {
private String c_updateuser;
private Date c_updatetime;
public Integer getC_id() {
return c_id;
}
public void setC_id(Integer c_id) {
this.c_id = c_id;
}
public Integer getC_parentid() {
return c_parentid;
}
public void setC_parentid(Integer c_parentid) {
this.c_parentid = c_parentid;
}
public String getC_ename() {
return c_ename;
}
public void setC_ename(String c_ename) {
this.c_ename = c_ename;
}
public String getC_cname() {
return c_cname;
}
public void setC_cname(String c_cname) {
this.c_cname = c_cname;
}
public Integer getC_level() {
return c_level;
}
public void setC_level(Integer c_level) {
this.c_level = c_level;
}
public Integer getC_groupid() {
return c_groupid;
}
public void setC_groupid(Integer c_groupid) {
this.c_groupid = c_groupid;
}
public Integer getC_sort() {
return c_sort;
}
public void setC_sort(Integer c_sort) {
this.c_sort = c_sort;
}
public Integer getC_charger_spec() {
return c_charger_spec;
}
public void setC_charger_spec(Integer c_charger_spec) {
this.c_charger_spec = c_charger_spec;
}
public String getC_product_character() {
return c_product_character;
}
public void setC_product_character(String c_product_character) {
this.c_product_character = c_product_character;
}
public String getC_bailun_character() {
return c_bailun_character;
}
public void setC_bailun_character(String c_bailun_character) {
this.c_bailun_character = c_bailun_character;
}
public String getC_cpeihuo() {
return c_cpeihuo;
}
public void setC_cpeihuo(String c_cpeihuo) {
this.c_cpeihuo = c_cpeihuo;
}
public String getC_epeihuo() {
return c_epeihuo;
}
public void setC_epeihuo(String c_epeihuo) {
this.c_epeihuo = c_epeihuo;
}
public String getC_cbaoguan() {
return c_cbaoguan;
}
public void setC_cbaoguan(String c_cbaoguan) {
this.c_cbaoguan = c_cbaoguan;
}
public String getC_ebaoguan() {
return c_ebaoguan;
}
public void setC_ebaoguan(String c_ebaoguan) {
this.c_ebaoguan = c_ebaoguan;
}
public String getC_hscode() {
return c_hscode;
}
public void setC_hscode(String c_hscode) {
this.c_hscode = c_hscode;
}
public String getC_createuser() {
return c_createuser;
}
public void setC_createuser(String c_createuser) {
this.c_createuser = c_createuser;
}
public Date getC_createtime() {
return c_createtime;
}
public void setC_createtime(Date c_createtime) {
this.c_createtime = c_createtime;
}
public String getC_updateuser() {
return c_updateuser;
}
public void setC_updateuser(String c_updateuser) {
this.c_updateuser = c_updateuser;
}
public Date getC_updatetime() {
return c_updatetime;
}
public void setC_updatetime(Date c_updatetime) {
this.c_updatetime = c_updatetime;
}
}
package com.bailuntec.domain.dto;
import lombok.Data;
@Data
public class SalesVolumeAvgDTO {
private Integer sevendaySales;
private Integer fourteendaySales;
private Integer thirtydaySales;
public SalesVolumeAvgDTO() {
}
public SalesVolumeAvgDTO(String bailunSku, String warehouseCode) {
this.thirtydaySales = 0;
this.sevendaySales = 0;
this.fourteendaySales = 0;
}
}
package com.bailuntec.domain.dto;
import lombok.Data;
@Data
public class SalesVolumeDTO {
private String bailunSku;
private String warehouseCode;
......@@ -80,291 +83,4 @@ public class SalesVolumeDTO {
this.historySales = "0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0";
}
public String getHistorySales() {
return historySales;
}
public void setHistorySales(String historySales) {
this.historySales = historySales;
}
public String getCategoryId() {
return categoryId;
}
public void setCategoryId(String categoryId) {
this.categoryId = categoryId;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public String getBailunSku() {
return bailunSku;
}
public void setBailunSku(String bailunSku) {
this.bailunSku = bailunSku;
}
public String getWarehouseCode() {
return warehouseCode;
}
public void setWarehouseCode(String warehouseCode) {
this.warehouseCode = warehouseCode;
}
public String getWarehouseName() {
return warehouseName;
}
public void setWarehouseName(String warehouseName) {
this.warehouseName = warehouseName;
}
public Integer getOnedaySales() {
return onedaySales;
}
public void setOnedaySales(Integer onedaySales) {
this.onedaySales = onedaySales;
}
public Integer getTwodaySales() {
return twodaySales;
}
public void setTwodaySales(Integer twodaySales) {
this.twodaySales = twodaySales;
}
public Integer getThreedaySales() {
return threedaySales;
}
public void setThreedaySales(Integer threedaySales) {
this.threedaySales = threedaySales;
}
public Integer getFourthdaySales() {
return fourthdaySales;
}
public void setFourthdaySales(Integer fourthdaySales) {
this.fourthdaySales = fourthdaySales;
}
public Integer getFivedaySales() {
return fivedaySales;
}
public void setFivedaySales(Integer fivedaySales) {
this.fivedaySales = fivedaySales;
}
public Integer getSixdaySales() {
return sixdaySales;
}
public void setSixdaySales(Integer sixdaySales) {
this.sixdaySales = sixdaySales;
}
public Integer getSevendaySales() {
return sevendaySales;
}
public void setSevendaySales(Integer sevendaySales) {
this.sevendaySales = sevendaySales;
}
public Integer getEightdaySales() {
return eightdaySales;
}
public void setEightdaySales(Integer eightdaySales) {
this.eightdaySales = eightdaySales;
}
public Integer getNinedaySales() {
return ninedaySales;
}
public void setNinedaySales(Integer ninedaySales) {
this.ninedaySales = ninedaySales;
}
public Integer getTendaySales() {
return tendaySales;
}
public void setTendaySales(Integer tendaySales) {
this.tendaySales = tendaySales;
}
public Integer getElevendaySales() {
return elevendaySales;
}
public void setElevendaySales(Integer elevendaySales) {
this.elevendaySales = elevendaySales;
}
public Integer getTwelvedaySales() {
return twelvedaySales;
}
public void setTwelvedaySales(Integer twelvedaySales) {
this.twelvedaySales = twelvedaySales;
}
public Integer getThridteendaySales() {
return thridteendaySales;
}
public void setThridteendaySales(Integer thridteendaySales) {
this.thridteendaySales = thridteendaySales;
}
public Integer getFourteendaySales() {
return fourteendaySales;
}
public void setFourteendaySales(Integer fourteendaySales) {
this.fourteendaySales = fourteendaySales;
}
public Integer getFifteendaySales() {
return fifteendaySales;
}
public void setFifteendaySales(Integer fifteendaySales) {
this.fifteendaySales = fifteendaySales;
}
public Integer getSixteendaySales() {
return sixteendaySales;
}
public void setSixteendaySales(Integer sixteendaySales) {
this.sixteendaySales = sixteendaySales;
}
public Integer getSeventeendaySales() {
return seventeendaySales;
}
public void setSeventeendaySales(Integer seventeendaySales) {
this.seventeendaySales = seventeendaySales;
}
public Integer getEighteendaySales() {
return eighteendaySales;
}
public void setEighteendaySales(Integer eighteendaySales) {
this.eighteendaySales = eighteendaySales;
}
public Integer getNineteendaySales() {
return nineteendaySales;
}
public void setNineteendaySales(Integer nineteendaySales) {
this.nineteendaySales = nineteendaySales;
}
public Integer getTwentydaySales() {
return twentydaySales;
}
public void setTwentydaySales(Integer twentydaySales) {
this.twentydaySales = twentydaySales;
}
public Integer getTwentyOnedaySales() {
return twentyOnedaySales;
}
public void setTwentyOnedaySales(Integer twentyOnedaySales) {
this.twentyOnedaySales = twentyOnedaySales;
}
public Integer getTwentyTwodaySales() {
return twentyTwodaySales;
}
public void setTwentyTwodaySales(Integer twentyTwodaySales) {
this.twentyTwodaySales = twentyTwodaySales;
}
public Integer getTwentyThreedaySales() {
return twentyThreedaySales;
}
public void setTwentyThreedaySales(Integer twentyThreedaySales) {
this.twentyThreedaySales = twentyThreedaySales;
}
public Integer getTwentyFourthdaySales() {
return twentyFourthdaySales;
}
public void setTwentyFourthdaySales(Integer twentyFourthdaySales) {
this.twentyFourthdaySales = twentyFourthdaySales;
}
public Integer getTwentyFivedaySales() {
return twentyFivedaySales;
}
public void setTwentyFivedaySales(Integer twentyFivedaySales) {
this.twentyFivedaySales = twentyFivedaySales;
}
public Integer getTwentySixdaySales() {
return twentySixdaySales;
}
public void setTwentySixdaySales(Integer twentySixdaySales) {
this.twentySixdaySales = twentySixdaySales;
}
public Integer getTwentySevenedaySales() {
return twentySevenedaySales;
}
public void setTwentySevenedaySales(Integer twentySevenedaySales) {
this.twentySevenedaySales = twentySevenedaySales;
}
public Integer getTwentyEightdaySales() {
return twentyEightdaySales;
}
public void setTwentyEightdaySales(Integer twentyEightdaySales) {
this.twentyEightdaySales = twentyEightdaySales;
}
public Integer getTwentyNinedaySales() {
return twentyNinedaySales;
}
public void setTwentyNinedaySales(Integer twentyNinedaySales) {
this.twentyNinedaySales = twentyNinedaySales;
}
public Integer getThirtydaySales() {
return thirtydaySales;
}
public void setThirtydaySales(Integer thirtydaySales) {
this.thirtydaySales = thirtydaySales;
}
}
......@@ -6,6 +6,7 @@ import com.alibaba.fastjson.TypeReference;
import com.bailuntec.domain.constant.CommonConstant;
import com.bailuntec.domain.constant.Constant;
import com.bailuntec.domain.dto.CatagoryDTO;
import com.bailuntec.domain.dto.SalesVolumeAvgDTO;
import com.bailuntec.domain.dto.SalesVolumeDTO;
import com.bailuntec.domain.dto.TurnoverSkuDTO;
import com.bailuntec.domain.entity.*;
......@@ -436,6 +437,10 @@ public class AutoTurnoverJob extends PointJob {
}
}
/*
* dcAutoTurnover这个表单独给指定平台加上三天平均销量
*/
caculatePlatformAvgSales(dcAutoTurnover);
dcAutoTurnover.setSuppliersName(turnoverSku.getSuppliersName());
dcAutoTurnover.setBuyerName(turnoverSku.getBuyerName());
dcAutoTurnover.setBailunCategoryId(turnoverSku.getBailunCategoryId());
......@@ -501,6 +506,21 @@ public class AutoTurnoverJob extends PointJob {
}
}
private void caculatePlatformAvgSales(DcAutoTurnover dcAutoTurnover) {
try {
DcAutoSalesMapper mapper = SessionUtil.getSession().getMapper(DcAutoSalesMapper.class);
SalesVolumeAvgDTO ebayAvgSales = mapper.getPlatformHistorySales(dcAutoTurnover.getBailunSku(), dcAutoTurnover.getWarehouseCode(),PlatformType.Ebay.value());
dcAutoTurnover.setHistorySevendaySalesEbay(BigDecimal.valueOf(ebayAvgSales.getSevendaySales()).divide(Constant.BIGDECIMAL_SEVEN, 3 , RoundingMode.HALF_EVEN));
dcAutoTurnover.setHistoryFourteendaySalesEbay(BigDecimal.valueOf(ebayAvgSales.getFourteendaySales()).divide(Constant.BIGDECIMAL_FOURTEEN, 3 , RoundingMode.HALF_EVEN));
dcAutoTurnover.setHistoryThirtydaySalesEbay(BigDecimal.valueOf(ebayAvgSales.getThirtydaySales()).divide(Constant.BIGDECIMAL_THIRTY, 3 , RoundingMode.HALF_EVEN));
} catch (Exception e) {
throw new RuntimeException("计算平台的平均销量失败", e);
} finally {
SessionUtil.closeSession();
}
}
private Integer getStockUpDays(String warehouseCode) {
DcAutoConfigStockUpDaysMapper mapper = SessionUtil.getSession().getMapper(DcAutoConfigStockUpDaysMapper.class);
DcAutoConfigStockUpDays dcAutoConfigStockUpDays = mapper.selectOneByExample(DcAutoConfigStockUpDaysExample.newAndCreateCriteria().andWarehouseCodeEqualTo(warehouseCode).example());
......
package com.bailuntec.mapper;
import com.bailuntec.domain.dto.SalesVolumeAvgDTO;
import com.bailuntec.domain.dto.SalesVolumeDTO;
import com.bailuntec.domain.entity.DcAutoSales;
import com.bailuntec.domain.entity.DcAutoTurnover;
import com.bailuntec.domain.example.DcAutoSalesExample;
import org.apache.ibatis.annotations.Param;
......@@ -124,4 +126,6 @@ public interface DcAutoSalesMapper {
int upsertSelective(DcAutoSales record);
SalesVolumeDTO getSalesVolumeDTO(@Param("queryTime") String queryTime, @Param("bailunSku") String bailunSku, @Param("warehouseCode") String warehouseCode);
SalesVolumeAvgDTO getPlatformHistorySales( @Param("bailunSku") String bailunSku,@Param("warehouseCode") String warehouseCode,@Param("platform") String platform);
}
\ No newline at end of file
......@@ -2437,4 +2437,21 @@
and bailun_sku = #{bailunSku}
and warehouse_code = #{warehouseCode}) sales_table
</select>
<select id="getPlatformHistorySales" resultType="com.bailuntec.domain.dto.SalesVolumeAvgDTO">
SELECT
sum( CASE WHEN ( paid_time >= DATE_SUB( CURDATE( ), INTERVAL 7 DAY ) ) THEN bailun_sku_quantity_ordered ELSE 0 END ) AS 'sevenday_sales',
sum( CASE WHEN ( paid_time >= DATE_SUB( CURDATE( ), INTERVAL 14 DAY ) ) THEN bailun_sku_quantity_ordered ELSE 0 END ) AS 'fourteenday_sales',
sum( CASE WHEN ( paid_time >= DATE_SUB( CURDATE( ), INTERVAL 30 DAY ) ) THEN bailun_sku_quantity_ordered ELSE 0 END ) AS 'thirtyday_sales'
FROM
`dc_base_oms_sku`
WHERE
platform_type = #{platform}
AND bailun_sku = #{bailunSku,jdbcType=VARCHAR}
AND warehouse_code= #{warehouseCode,jdbcType=VARCHAR}
AND paid_time >= DATE_SUB( CURDATE( ), INTERVAL 30 DAY )
AND paid_time &lt; CURDATE( )
AND bailun_order_status IN ( 'Handling', 'Finished' )
AND has_delete = 0
AND has_scalp = 0
</select>
</mapper>
\ No newline at end of file
......@@ -51,7 +51,7 @@ public class AutoTurnoverTest {
DcBaseStockMapper mapper = SessionUtil.getSession().getMapper(DcBaseStockMapper.class);
// dcBaseStock = mapper.selectOneByExample(DcBaseStockExample.newAndCreateCriteria().andBailunSkuEqualTo("322572421").andWarehouseCodeEqualTo("QYBLZZ").example());
// dcBaseStock = mapper.selectOneByExample(DcBaseStockExample.newAndCreateCriteria().andBailunSkuEqualTo("232232601").andWarehouseCodeEqualTo("CHUKFBA").example());
dcBaseStock = mapper.selectOneByExample(DcBaseStockExample.newAndCreateCriteria().andBailunSkuEqualTo("227290401").andWarehouseCodeEqualTo("GZBLWH").example());
dcBaseStock = mapper.selectOneByExample(DcBaseStockExample.newAndCreateCriteria().andBailunSkuEqualTo("204912701").andWarehouseCodeEqualTo("GZBLWH").example());
} catch (Exception e) {
e.printStackTrace();
} finally {
......
table-name=dc_base_stock
table-name=dc_auto_turnover
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