Commit 2415089c by huluobin

update

parent 19303a6b
...@@ -31,20 +31,26 @@ public class Application { ...@@ -31,20 +31,26 @@ public class Application {
} }
private static CoordinatorRegistryCenter createRegistryCenter() { private static CoordinatorRegistryCenter createRegistryCenter() {
CoordinatorRegistryCenter regCenter = new ZookeeperRegistryCenter(new ZookeeperConfiguration(propertiesUtil.getPropertyAsString("ZOOKEEPER_SERVER"), propertiesUtil.getPropertyAsString("NAME_SPACE"))); CoordinatorRegistryCenter regCenter = new ZookeeperRegistryCenter(new ZookeeperConfiguration(
propertiesUtil.getPropertyAsString("ZOOKEEPER_SERVER"), propertiesUtil.getPropertyAsString("NAME_SPACE")));
regCenter.init(); regCenter.init();
return regCenter; return regCenter;
} }
private static LiteJobConfiguration createJobConfiguration() { private static LiteJobConfiguration createJobConfiguration() {
JobCoreConfiguration simpleCoreConfig = JobCoreConfiguration.newBuilder(propertiesUtil.getPropertyAsString("JOB_NAME"), propertiesUtil.getPropertyAsString("JOB_CRON"), propertiesUtil.getPropertyAsInt("SHARDING_TOTAL_COUNT")).build(); JobCoreConfiguration simpleCoreConfig = JobCoreConfiguration.newBuilder(
propertiesUtil.getPropertyAsString("JOB_NAME"), propertiesUtil.getPropertyAsString("JOB_CRON"),
propertiesUtil.getPropertyAsInt("SHARDING_TOTAL_COUNT")).build();
SimpleJobConfiguration simpleJobConfig = new SimpleJobConfiguration(simpleCoreConfig, OrderSyncJob.class.getCanonicalName()); SimpleJobConfiguration simpleJobConfig = new SimpleJobConfiguration(simpleCoreConfig, OrderSyncJob.class.getCanonicalName());
LiteJobConfiguration simpleJobRootConfig = LiteJobConfiguration.newBuilder(simpleJobConfig).build(); LiteJobConfiguration simpleJobRootConfig = LiteJobConfiguration.newBuilder(simpleJobConfig).build();
return simpleJobRootConfig; return simpleJobRootConfig;
} }
private static LiteJobConfiguration createJobConfiguration1() { private static LiteJobConfiguration createJobConfiguration1() {
JobCoreConfiguration simpleCoreConfig = JobCoreConfiguration.newBuilder(propertiesUtil.getPropertyAsString("JOB_NAME30"), propertiesUtil.getPropertyAsString("JOB_CRON30"), propertiesUtil.getPropertyAsInt("SHARDING_TOTAL_COUNT")).build(); JobCoreConfiguration simpleCoreConfig = JobCoreConfiguration.newBuilder(
propertiesUtil.getPropertyAsString("JOB_NAME30"),
propertiesUtil.getPropertyAsString("JOB_CRON30"),
propertiesUtil.getPropertyAsInt("SHARDING_TOTAL_COUNT")).build();
SimpleJobConfiguration simpleJobConfig = new SimpleJobConfiguration(simpleCoreConfig, OrderSyncJob30.class.getCanonicalName()); SimpleJobConfiguration simpleJobConfig = new SimpleJobConfiguration(simpleCoreConfig, OrderSyncJob30.class.getCanonicalName());
LiteJobConfiguration simpleJobRootConfig = LiteJobConfiguration.newBuilder(simpleJobConfig).build(); LiteJobConfiguration simpleJobRootConfig = LiteJobConfiguration.newBuilder(simpleJobConfig).build();
return simpleJobRootConfig; return simpleJobRootConfig;
......
...@@ -30,6 +30,7 @@ import java.math.BigDecimal; ...@@ -30,6 +30,7 @@ import java.math.BigDecimal;
import java.math.RoundingMode; import java.math.RoundingMode;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.time.ZoneId; import java.time.ZoneId;
import java.time.format.DateTimeFormatter;
import java.util.HashMap; import java.util.HashMap;
import java.util.LinkedHashMap; import java.util.LinkedHashMap;
import java.util.List; import java.util.List;
...@@ -50,11 +51,11 @@ public class OrderSyncJob extends PointJob { ...@@ -50,11 +51,11 @@ public class OrderSyncJob extends PointJob {
/*map.put("TimeFrom", DateTimeFormatter.ofPattern(CommonConstant.TIME_FORMAT).format(jobPointLog.getStartTime().minusMinutes(3))); /*map.put("TimeFrom", DateTimeFormatter.ofPattern(CommonConstant.TIME_FORMAT).format(jobPointLog.getStartTime().minusMinutes(3)));
map.put("TimeTo", DateTimeFormatter.ofPattern(CommonConstant.TIME_FORMAT).format(jobPointLog.getEndTime())); map.put("TimeTo", DateTimeFormatter.ofPattern(CommonConstant.TIME_FORMAT).format(jobPointLog.getEndTime()));
map.put("DateType", "purchaseTime");*/ map.put("DateType", "purchaseTime");*/
// map.put("BailunLastUpdateTimeFrom", DateTimeFormatter.ofPattern(CommonConstant.TIME_FORMAT).format(jobPointLog.getStartTime().minusMinutes(3))); map.put("BailunLastUpdateTimeFrom", DateTimeFormatter.ofPattern(CommonConstant.TIME_FORMAT).format(jobPointLog.getStartTime().minusMinutes(3)));
// map.put("BailunLastUpdateTimeTo", DateTimeFormatter.ofPattern(CommonConstant.TIME_FORMAT).format(jobPointLog.getEndTime())); map.put("BailunLastUpdateTimeTo", DateTimeFormatter.ofPattern(CommonConstant.TIME_FORMAT).format(jobPointLog.getEndTime()));
map.put("BailunLastUpdateTimeFrom", "2020-07-24 00:00:00"); // map.put("BailunLastUpdateTimeFrom", "2020-07-24 00:00:00");
map.put("BailunLastUpdateTimeTo", "2020-07-25 00:00:00"); // map.put("BailunLastUpdateTimeTo", "2020-07-25 00:00:00");
do { do {
map.put("pageIndex", jobPointLog.getPageIndex().equals(0) ? "1" : jobPointLog.getPageIndex().toString()); map.put("pageIndex", jobPointLog.getPageIndex().equals(0) ? "1" : jobPointLog.getPageIndex().toString());
Response response = null; Response response = null;
......
...@@ -55,14 +55,15 @@ public class OmsOrderTest { ...@@ -55,14 +55,15 @@ public class OmsOrderTest {
} }
} }
} }
@Test @Test
public void test4() { public void test4() {
OrderSyncJob orderSyncJob = new OrderSyncJob(); OrderSyncJob orderSyncJob = new OrderSyncJob();
JobPointLog jobPointLog = new JobPointLog(); JobPointLog jobPointLog = new JobPointLog();
jobPointLog.setPageIndex(0); jobPointLog.setPageIndex(0);
jobPointLog.setPageSize(100); jobPointLog.setPageSize(100);
jobPointLog.setStartTime(LocalDateTime.of(2019,04,01,0,0)); jobPointLog.setStartTime(LocalDateTime.of(2020, 8, 1, 0, 0));
jobPointLog.setEndTime(LocalDateTime.of(2019,04,02,0,0)); jobPointLog.setEndTime(LocalDateTime.of(2020, 9, 3, 0, 0));
jobPointLog.setIntervalTime(1); jobPointLog.setIntervalTime(1);
orderSyncJob.executeJob(null, jobPointLog); orderSyncJob.executeJob(null, jobPointLog);
} }
......
...@@ -121,5 +121,7 @@ public interface DcDailySalesMapper { ...@@ -121,5 +121,7 @@ public interface DcDailySalesMapper {
* @project https://github.com/itfsw/mybatis-generator-plugin * @project https://github.com/itfsw/mybatis-generator-plugin
*/ */
int upsertSelective(DcDailySales record); int upsertSelective(DcDailySales record);
void calculateSales(); void calculateSales();
} }
...@@ -6,27 +6,27 @@ ...@@ -6,27 +6,27 @@
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="bailun_sku" jdbcType="VARCHAR" property="bailunSku" /> <result column="bailun_sku" jdbcType="VARCHAR" property="bailunSku"/>
<result column="bailun_sku_title_cn" jdbcType="VARCHAR" property="bailunSkuTitleCn" /> <result column="bailun_sku_title_cn" jdbcType="VARCHAR" property="bailunSkuTitleCn"/>
<result column="warehouse_name" jdbcType="VARCHAR" property="warehouseName" /> <result column="warehouse_name" jdbcType="VARCHAR" property="warehouseName"/>
<result column="warehouse_code" jdbcType="VARCHAR" property="warehouseCode" /> <result column="warehouse_code" jdbcType="VARCHAR" property="warehouseCode"/>
<result column="bailun_category_id" jdbcType="INTEGER" property="bailunCategoryId" /> <result column="bailun_category_id" jdbcType="INTEGER" property="bailunCategoryId"/>
<result column="oneday_total_sales" jdbcType="INTEGER" property="onedayTotalSales" /> <result column="oneday_total_sales" jdbcType="INTEGER" property="onedayTotalSales"/>
<result column="threeday_total_sales" jdbcType="INTEGER" property="threedayTotalSales" /> <result column="threeday_total_sales" jdbcType="INTEGER" property="threedayTotalSales"/>
<result column="sevenday_total_sales" jdbcType="INTEGER" property="sevendayTotalSales" /> <result column="sevenday_total_sales" jdbcType="INTEGER" property="sevendayTotalSales"/>
<result column="fourteenday_total_sales" jdbcType="INTEGER" property="fourteendayTotalSales" /> <result column="fourteenday_total_sales" jdbcType="INTEGER" property="fourteendayTotalSales"/>
<result column="thirtyday_total_sales" jdbcType="INTEGER" property="thirtydayTotalSales" /> <result column="thirtyday_total_sales" jdbcType="INTEGER" property="thirtydayTotalSales"/>
<result column="threeday_average_sales" jdbcType="INTEGER" property="threedayAverageSales" /> <result column="threeday_average_sales" jdbcType="INTEGER" property="threedayAverageSales"/>
<result column="sevenday_average_sales" jdbcType="DECIMAL" property="sevendayAverageSales" /> <result column="sevenday_average_sales" jdbcType="DECIMAL" property="sevendayAverageSales"/>
<result column="fourteenday_average_sales" jdbcType="DECIMAL" property="fourteendayAverageSales" /> <result column="fourteenday_average_sales" jdbcType="DECIMAL" property="fourteendayAverageSales"/>
<result column="thirtyday_average_sales" jdbcType="DECIMAL" property="thirtydayAverageSales" /> <result column="thirtyday_average_sales" jdbcType="DECIMAL" property="thirtydayAverageSales"/>
<result column="gmt_create" jdbcType="TIMESTAMP" property="gmtCreate" /> <result column="gmt_create" jdbcType="TIMESTAMP" property="gmtCreate"/>
<result column="gmt_modified" jdbcType="TIMESTAMP" property="gmtModified" /> <result column="gmt_modified" jdbcType="TIMESTAMP" property="gmtModified"/>
<result column="global_company_id" jdbcType="INTEGER" property="globalCompanyId" /> <result column="global_company_id" jdbcType="INTEGER" property="globalCompanyId"/>
<result column="global_company_code" jdbcType="VARCHAR" property="globalCompanyCode" /> <result column="global_company_code" jdbcType="VARCHAR" property="globalCompanyCode"/>
<result column="global_company_name" jdbcType="VARCHAR" property="globalCompanyName" /> <result column="global_company_name" jdbcType="VARCHAR" property="globalCompanyName"/>
<result column="record_date" jdbcType="DATE" property="recordDate" /> <result column="record_date" jdbcType="DATE" property="recordDate"/>
</resultMap> </resultMap>
<sql id="Example_Where_Clause"> <sql id="Example_Where_Clause">
<!-- <!--
...@@ -50,7 +50,8 @@ ...@@ -50,7 +50,8 @@
</when> </when>
<when test="criterion.listValue"> <when test="criterion.listValue">
and ${criterion.condition} and ${criterion.condition}
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=","> <foreach close=")" collection="criterion.value" item="listItem" open="("
separator=",">
#{listItem} #{listItem}
</foreach> </foreach>
</when> </when>
...@@ -83,7 +84,8 @@ ...@@ -83,7 +84,8 @@
</when> </when>
<when test="criterion.listValue"> <when test="criterion.listValue">
and ${criterion.condition} and ${criterion.condition}
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=","> <foreach close=")" collection="criterion.value" item="listItem" open="("
separator=",">
#{listItem} #{listItem}
</foreach> </foreach>
</when> </when>
...@@ -105,7 +107,8 @@ ...@@ -105,7 +107,8 @@
thirtyday_average_sales, gmt_create, gmt_modified, global_company_id, global_company_code, thirtyday_average_sales, gmt_create, gmt_modified, global_company_id, global_company_code,
global_company_name, record_date global_company_name, record_date
</sql> </sql>
<select id="selectByExample" parameterType="com.bailuntec.domain.example.DcDailySalesExample" resultMap="BaseResultMap"> <select id="selectByExample" parameterType="com.bailuntec.domain.example.DcDailySalesExample"
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.
...@@ -114,10 +117,10 @@ ...@@ -114,10 +117,10 @@
<if test="distinct"> <if test="distinct">
distinct distinct
</if> </if>
<include refid="Base_Column_List" /> <include refid="Base_Column_List"/>
from dc_daily_sales from dc_daily_sales
<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}
...@@ -137,7 +140,7 @@ ...@@ -137,7 +140,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_daily_sales from dc_daily_sales
where id = #{id,jdbcType=INTEGER} where id = #{id,jdbcType=INTEGER}
</select> </select>
...@@ -156,7 +159,7 @@ ...@@ -156,7 +159,7 @@
--> -->
delete from dc_daily_sales delete from dc_daily_sales
<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.DcDailySales"> <insert id="insert" parameterType="com.bailuntec.domain.entity.DcDailySales">
...@@ -175,7 +178,8 @@ ...@@ -175,7 +178,8 @@
) )
values (#{id,jdbcType=INTEGER}, #{bailunSku,jdbcType=VARCHAR}, #{bailunSkuTitleCn,jdbcType=VARCHAR}, values (#{id,jdbcType=INTEGER}, #{bailunSku,jdbcType=VARCHAR}, #{bailunSkuTitleCn,jdbcType=VARCHAR},
#{warehouseName,jdbcType=VARCHAR}, #{warehouseCode,jdbcType=VARCHAR}, #{bailunCategoryId,jdbcType=INTEGER}, #{warehouseName,jdbcType=VARCHAR}, #{warehouseCode,jdbcType=VARCHAR}, #{bailunCategoryId,jdbcType=INTEGER},
#{onedayTotalSales,jdbcType=INTEGER}, #{threedayTotalSales,jdbcType=INTEGER}, #{sevendayTotalSales,jdbcType=INTEGER}, #{onedayTotalSales,jdbcType=INTEGER}, #{threedayTotalSales,jdbcType=INTEGER},
#{sevendayTotalSales,jdbcType=INTEGER},
#{fourteendayTotalSales,jdbcType=INTEGER}, #{thirtydayTotalSales,jdbcType=INTEGER}, #{fourteendayTotalSales,jdbcType=INTEGER}, #{thirtydayTotalSales,jdbcType=INTEGER},
#{threedayAverageSales,jdbcType=INTEGER}, #{sevendayAverageSales,jdbcType=DECIMAL}, #{threedayAverageSales,jdbcType=INTEGER}, #{sevendayAverageSales,jdbcType=DECIMAL},
#{fourteendayAverageSales,jdbcType=DECIMAL}, #{thirtydayAverageSales,jdbcType=DECIMAL}, #{fourteendayAverageSales,jdbcType=DECIMAL}, #{thirtydayAverageSales,jdbcType=DECIMAL},
...@@ -320,14 +324,15 @@ ...@@ -320,14 +324,15 @@
</if> </if>
</trim> </trim>
</insert> </insert>
<select id="countByExample" parameterType="com.bailuntec.domain.example.DcDailySalesExample" resultType="java.lang.Long"> <select id="countByExample" parameterType="com.bailuntec.domain.example.DcDailySalesExample"
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_daily_sales select count(*) from dc_daily_sales
<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">
...@@ -402,7 +407,7 @@ ...@@ -402,7 +407,7 @@
</if> </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">
...@@ -433,7 +438,7 @@ ...@@ -433,7 +438,7 @@
global_company_name = #{record.globalCompanyName,jdbcType=VARCHAR}, global_company_name = #{record.globalCompanyName,jdbcType=VARCHAR},
record_date = #{record.recordDate,jdbcType=DATE} record_date = #{record.recordDate,jdbcType=DATE}
<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.DcDailySales"> <update id="updateByPrimaryKeySelective" parameterType="com.bailuntec.domain.entity.DcDailySales">
...@@ -754,7 +759,8 @@ ...@@ -754,7 +759,8 @@
values values
(#{id,jdbcType=INTEGER}, #{bailunSku,jdbcType=VARCHAR}, #{bailunSkuTitleCn,jdbcType=VARCHAR}, (#{id,jdbcType=INTEGER}, #{bailunSku,jdbcType=VARCHAR}, #{bailunSkuTitleCn,jdbcType=VARCHAR},
#{warehouseName,jdbcType=VARCHAR}, #{warehouseCode,jdbcType=VARCHAR}, #{bailunCategoryId,jdbcType=INTEGER}, #{warehouseName,jdbcType=VARCHAR}, #{warehouseCode,jdbcType=VARCHAR}, #{bailunCategoryId,jdbcType=INTEGER},
#{onedayTotalSales,jdbcType=INTEGER}, #{threedayTotalSales,jdbcType=INTEGER}, #{sevendayTotalSales,jdbcType=INTEGER}, #{onedayTotalSales,jdbcType=INTEGER}, #{threedayTotalSales,jdbcType=INTEGER},
#{sevendayTotalSales,jdbcType=INTEGER},
#{fourteendayTotalSales,jdbcType=INTEGER}, #{thirtydayTotalSales,jdbcType=INTEGER}, #{fourteendayTotalSales,jdbcType=INTEGER}, #{thirtydayTotalSales,jdbcType=INTEGER},
#{threedayAverageSales,jdbcType=INTEGER}, #{sevendayAverageSales,jdbcType=DECIMAL}, #{threedayAverageSales,jdbcType=INTEGER}, #{sevendayAverageSales,jdbcType=DECIMAL},
#{fourteendayAverageSales,jdbcType=DECIMAL}, #{thirtydayAverageSales,jdbcType=DECIMAL}, #{fourteendayAverageSales,jdbcType=DECIMAL}, #{thirtydayAverageSales,jdbcType=DECIMAL},
...@@ -784,30 +790,31 @@ ...@@ -784,30 +790,31 @@
global_company_name = #{globalCompanyName,jdbcType=VARCHAR}, global_company_name = #{globalCompanyName,jdbcType=VARCHAR},
record_date = #{recordDate,jdbcType=DATE} record_date = #{recordDate,jdbcType=DATE}
</insert> </insert>
<select id="selectOneByExample" parameterType="com.bailuntec.domain.example.DcDailySalesExample" resultMap="BaseResultMap"> <select id="selectOneByExample" parameterType="com.bailuntec.domain.example.DcDailySalesExample"
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_daily_sales from dc_daily_sales
<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>
<insert id="calculateSales" >
INSERT `dc_daily_sales` ( <insert id="calculateSales">
`bailun_sku` , INSERT `dc_daily_sales` (`bailun_sku`,
`warehouse_code` , `warehouse_code`,
`warehouse_name` , `warehouse_name`,
`bailun_sku_title_cn` , `bailun_sku_title_cn`,
`bailun_category_id` , `bailun_category_id`,
`oneday_total_sales`, `oneday_total_sales`,
`threeday_total_sales`, `threeday_total_sales`,
`sevenday_total_sales`, `sevenday_total_sales`,
...@@ -818,8 +825,7 @@ ...@@ -818,8 +825,7 @@
`fourteenday_average_sales`, `fourteenday_average_sales`,
`thirtyday_average_sales`, `thirtyday_average_sales`,
`record_date`) `record_date`)
SELECT SELECT bailun_sku,
bailun_sku,
warehouse_code, warehouse_code,
warehouse_name, warehouse_name,
bailun_sku_title_cn, bailun_sku_title_cn,
...@@ -833,23 +839,32 @@ ...@@ -833,23 +839,32 @@
ROUND(sevenday_sales / 7, 2), ROUND(sevenday_sales / 7, 2),
ROUND(fourteenday_sales / 14, 2), ROUND(fourteenday_sales / 14, 2),
ROUND(thirtyday_sales / 30, 2), ROUND(thirtyday_sales / 30, 2),
DATE_SUB(CURDATE(),INTERVAL 1 day) DATE_SUB(CURDATE(), INTERVAL 1 day)
FROM ( FROM (
SELECT SELECT bailun_sku,
bailun_sku,
warehouse_code, warehouse_code,
warehouse_name, warehouse_name,
bailun_sku_title_cn, bailun_sku_title_cn,
bailun_category_id, bailun_category_id,
sum( CASE WHEN ( paid_time >= DATE_SUB( CURDATE(), INTERVAL 1 DAY ) ) THEN bailun_sku_quantity_ordered ELSE 0 END ) AS 'oneday_sales', sum(CASE
sum( CASE WHEN ( paid_time >= DATE_SUB( CURDATE(), INTERVAL 3 DAY ) ) THEN bailun_sku_quantity_ordered ELSE 0 END ) AS 'threeday_sales', WHEN (paid_time >= DATE_SUB(CURDATE(), INTERVAL 1 DAY)) THEN bailun_sku_quantity_ordered
sum( CASE WHEN ( paid_time >= DATE_SUB( CURDATE(), INTERVAL 7 DAY ) ) THEN bailun_sku_quantity_ordered ELSE 0 END ) AS 'sevenday_sales', ELSE 0 END) AS 'oneday_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
sum( CASE WHEN ( paid_time >= DATE_SUB( CURDATE(), INTERVAL 30 DAY ) ) THEN bailun_sku_quantity_ordered ELSE 0 END ) AS 'thirtyday_sales' WHEN (paid_time >= DATE_SUB(CURDATE(), INTERVAL 3 DAY)) THEN bailun_sku_quantity_ordered
FROM ELSE 0 END) AS 'threeday_sales',
`dc_base_oms_sku` sum(CASE
WHERE WHEN (paid_time >= DATE_SUB(CURDATE(), INTERVAL 7 DAY)) THEN bailun_sku_quantity_ordered
paid_time >= DATE_SUB(CURDATE(), INTERVAL 30 DAY ) 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 paid_time >= DATE_SUB(CURDATE(), INTERVAL 30 DAY)
AND paid_time &lt; CURDATE() AND paid_time &lt; CURDATE()
AND bailun_order_status != 'Canceled' AND bailun_order_status != 'Canceled'
AND has_delete = 0 AND has_delete = 0
...@@ -858,8 +873,7 @@ ...@@ -858,8 +873,7 @@
AND has_platsku_remark = 0 AND has_platsku_remark = 0
AND has_innersale = 0 AND has_innersale = 0
AND has_fba_s = 0 AND has_fba_s = 0
GROUP BY GROUP BY bailun_sku,
bailun_sku,
warehouse_code warehouse_code
) t ) t
</insert> </insert>
......
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