记得上下班打卡 | git大法好,push需谨慎

Commit e0aece96 authored by 胡佳晨's avatar 胡佳晨

提交 周焕导出

parent ecba5c8a
package com.liquidnet.service.goblin.service; package com.liquidnet.service.goblin.service;
import com.liquidnet.service.base.ResponseDto; import com.liquidnet.service.base.ResponseDto;
import com.liquidnet.service.goblin.dto.GoblinMarketGoodsExcelDto;
import com.liquidnet.service.goblin.dto.GoblinMarketGoodsUnDateExcelDto;
import com.liquidnet.service.goblin.dto.GoblinZhengzaiMarketOrderExcelDto; import com.liquidnet.service.goblin.dto.GoblinZhengzaiMarketOrderExcelDto;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
...@@ -11,6 +13,13 @@ public interface IGoblinExportService { ...@@ -11,6 +13,13 @@ public interface IGoblinExportService {
List<GoblinZhengzaiMarketOrderExcelDto> exportZhengzaiMarketOrder(Map<String, Object> paramMap); List<GoblinZhengzaiMarketOrderExcelDto> exportZhengzaiMarketOrder(Map<String, Object> paramMap);
List<GoblinMarketGoodsExcelDto> exportMarketGoods(Map<String, Object> paramMap);
List<GoblinMarketGoodsUnDateExcelDto> exportMarketGoodsUnDate(Map<String, Object> paramMap);
//导出商城订单信息 //导出商城订单信息
ResponseDto<String> exportMallOrder(HttpServletResponse response, String beginTime, String endTime, String state, Integer mailType,String storeId); ResponseDto<String> exportMallOrder(HttpServletResponse response, String beginTime, String endTime, String state, Integer mailType,String storeId);
} }
package com.liquidnet.service.goblin.dto;
import com.alibaba.excel.annotation.ExcelProperty;
import lombok.Getter;
import lombok.Setter;
import java.io.Serializable;
import java.math.BigDecimal;
import java.time.LocalDateTime;
/**
*日汇总的数据:
*
* SELECT
* c.name AS '活动名称',
* c.store_name AS '店铺名称',
* DATE_FORMAT(c.created_at,'%Y-%m-%d') as 日期,
* spu_no AS '商品编号' ,
* b.sku_bar_code AS '商品条码' ,
* a.`name` AS '商品名称' ,
* b.`name` AS '款式名称' ,
* gg.cate1_name AS '一级分类' ,
* gg.cate2_name AS '二级分类' ,
* gg.cate3_name AS '三级分类' ,
* b.price AS '款式价格' ,
* sum(CASE WHEN c. STATUS not IN(0 , 5) THEN c.num ELSE 0 END) AS '销售数量' ,
* sum(case when c.status in (6,7) then c.num else 0 end) '退款数量',
* sum(CASE WHEN c. STATUS not IN(0 , 5) THEN c.sku_price_actual ELSE 0 END ) AS '销售金额' ,
* sum(CASE WHEN c. STATUS IN(6 , 7) THEN c.sku_price_actual ELSE 0 END) AS '退款金额' ,
* sum(CASE WHEN c. STATUS IN(2 , 3 , 4) THEN c.price_voucher ELSE 0 END ) AS '优惠金额',
* sum(CASE WHEN c. STATUS IN(2 , 3 , 4) THEN c.num ELSE 0 END ) AS '小计数量' ,
* sum(CASE WHEN c. STATUS IN(2 , 3 , 4) THEN c.sku_price_actual ELSE 0 END) AS '小计金额'
* FROM
* goblin_goods AS a
* INNER JOIN goblin_goods_sku AS b ON a.spu_id = b.spu_id
* LEFT JOIN(
* SELECT
* c.sku_id ,
* d.market_id ,
* c. STATUS ,
* c.num ,
* c.sku_price_actual ,
* c.price_voucher,
* c.created_at,
* gsi.store_name,
* gsm.name
* FROM
* goblin_order_sku AS c
* INNER JOIN goblin_store_order AS d ON d.order_id = c.order_id
* inner join goblin_store_info gsi on gsi.store_id = d.store_id
* inner join goblin_self_marketing gsm on gsm.self_market_id = SUBSTRING_INDEX(d.market_id, 'ZZ', -1)
* ) AS c ON SUBSTRING_INDEX(c.sku_id, 'ZZ', 1) = b.sku_id
* INNER JOIN(
* SELECT
* spu_id ,
* gg. NAME ,
* gsgc1. NAME AS cate1_name ,
* gsgc2. NAME AS cate2_name,
* gsgc3. NAME AS cate3_name
* FROM
* goblin_goods AS gg
* LEFT JOIN goblin_self_goods_category AS gsgc1 ON gsgc1.cate_id = gg.cate_fid
* LEFT JOIN goblin_self_goods_category AS gsgc2 ON gsgc2.cate_id = gg.cate_sid
* LEFT JOIN goblin_self_goods_category AS gsgc3 ON gsgc3.cate_id = gg.cate_tid
* ) AS gg ON a.spu_id = gg.spu_id
* where c.market_id = 'ZZ222981107161997155345' and a.store_id = '1314c10a2b400c355dde0d060ba83afe'
* and c.created_at >='2022-11-18' and c.created_at <'2022-11-21'
* GROUP BY
* 日期,
* b.sku_id;
*
*/
@Getter
@Setter
public class GoblinMarketGoodsExcelDto implements Serializable, Cloneable {
private static final long serialVersionUID = -2804101458736599181L;
@ExcelProperty("活动名称")
private String marketName;
@ExcelProperty("店铺名称")
private String storeName;
@ExcelProperty("日期")
private String date;
@ExcelProperty("商品编号")
private String spuNo;
@ExcelProperty("商品条码")
private String skuBarCode;
@ExcelProperty("商品名称")
private String spuName;
@ExcelProperty("款式名称")
private String skuName;
@ExcelProperty("一级分类")
private String gg1;
@ExcelProperty("二级分类")
private String gg2;
@ExcelProperty("三级分类")
private String gg3;
@ExcelProperty("款式价格")
private BigDecimal skuPrice;
@ExcelProperty("销售数量")
private int saleCount;
@ExcelProperty("退款数量")
private int refundCount;
@ExcelProperty("销售金额")
private BigDecimal salePrice;
@ExcelProperty("退款金额")
private BigDecimal refundPrice;
@ExcelProperty("优惠金额")
private BigDecimal voucherPrice;
@ExcelProperty("小计数量")
private int count;
@ExcelProperty("小计金额")
private BigDecimal price;
}
package com.liquidnet.service.goblin.dto;
import com.alibaba.excel.annotation.ExcelProperty;
import lombok.Getter;
import lombok.Setter;
import java.io.Serializable;
import java.math.BigDecimal;
/**
* 商品明细数据:
* <p>
* SELECT
* c.name AS '活动名称',
* c.store_name AS '店铺名称',
* # DATE_FORMAT(c.created_at,'%Y-%m-%d') as 日期,
* spu_no AS '商品编号' ,
* b.sku_bar_code AS '商品条码' ,
* a.`name` AS '商品名称' ,
* b.`name` AS '款式名称' ,
* gg.cate1_name AS '一级分类' ,
* gg.cate2_name AS '二级分类' ,
* gg.cate3_name AS '三级分类' ,
* b.price AS '款式价格' ,
* sum(CASE WHEN c. STATUS not IN(0 , 5) THEN c.num ELSE 0 END) AS '销售数量' ,
* sum(case when c.status in (6,7) then c.num else 0 end) '退款数量',
* sum(CASE WHEN c. STATUS not IN(0 , 5) THEN c.sku_price_actual ELSE 0 END ) AS '销售金额' ,
* sum(CASE WHEN c. STATUS IN(6 , 7) THEN c.sku_price_actual ELSE 0 END) AS '退款金额' ,
* sum(CASE WHEN c. STATUS IN(2 , 3 , 4) THEN c.price_voucher ELSE 0 END ) AS '优惠金额',
* sum(CASE WHEN c. STATUS IN(2 , 3 , 4) THEN c.num ELSE 0 END ) AS '小计数量' ,
* sum(CASE WHEN c. STATUS IN(2 , 3 , 4) THEN c.sku_price_actual ELSE 0 END) AS '小计金额'
* FROM
* goblin_goods AS a
* INNER JOIN goblin_goods_sku AS b ON a.spu_id = b.spu_id
* LEFT JOIN(
* SELECT
* c.sku_id ,
* d.market_id ,
* c. STATUS ,
* c.num ,
* c.sku_price_actual ,
* c.price_voucher,
* c.created_at,
* gsi.store_name,
* gsm.name
* FROM
* goblin_order_sku AS c
* INNER JOIN goblin_store_order AS d ON d.order_id = c.order_id
* inner join goblin_store_info gsi on gsi.store_id = d.store_id
* inner join goblin_self_marketing gsm on gsm.self_market_id = SUBSTRING_INDEX(d.market_id, 'ZZ', -1)
* ) AS c ON SUBSTRING_INDEX(c.sku_id, 'ZZ', 1) = b.sku_id
* INNER JOIN(
* SELECT
* spu_id ,
* gg. NAME ,
* gsgc1. NAME AS cate1_name ,
* gsgc2. NAME AS cate2_name,
* gsgc3. NAME AS cate3_name
* FROM
* goblin_goods AS gg
* LEFT JOIN goblin_self_goods_category AS gsgc1 ON gsgc1.cate_id = gg.cate_fid
* LEFT JOIN goblin_self_goods_category AS gsgc2 ON gsgc2.cate_id = gg.cate_sid
* LEFT JOIN goblin_self_goods_category AS gsgc3 ON gsgc3.cate_id = gg.cate_tid
* ) AS gg ON a.spu_id = gg.spu_id
* where c.market_id = 'ZZ222981107161997155345' and a.store_id = '1314c10a2b400c355dde0d060ba83afe'
* # where c.market_id = 'ZZ223161701266386447667' and a.store_id = '3a8440d3f0aa49a084ff3cf0310ebae2'
* # and c.created_at >='2022-11-18' and c.created_at <'2022-11-21'
* GROUP BY
* # 日期,
* b.sku_id;
*/
@Getter
@Setter
public class GoblinMarketGoodsUnDateExcelDto implements Serializable, Cloneable {
private static final long serialVersionUID = -2804101458736599181L;
@ExcelProperty("活动名称")
private String marketName;
@ExcelProperty("店铺名称")
private String storeName;
@ExcelProperty("商品编号")
private String spuNo;
@ExcelProperty("商品条码")
private String sku_bar_code;
@ExcelProperty("商品名称")
private String spuName;
@ExcelProperty("款式名称")
private String skuName;
@ExcelProperty("一级分类")
private String gg1;
@ExcelProperty("二级分类")
private String gg2;
@ExcelProperty("三级分类")
private String gg3;
@ExcelProperty("款式价格")
private BigDecimal skuPrice;
@ExcelProperty("销售数量")
private int saleCount;
@ExcelProperty("退款数量")
private int refundCount;
@ExcelProperty("销售金额")
private BigDecimal salePrice;
@ExcelProperty("退款金额")
private BigDecimal refundPrice;
@ExcelProperty("优惠金额")
private BigDecimal voucherPrice;
@ExcelProperty("小计数量")
private int count;
@ExcelProperty("小计金额")
private BigDecimal price;
}
package com.liquidnet.service.goblin.mapper; package com.liquidnet.service.goblin.mapper;
import com.liquidnet.service.goblin.dto.GoblinMarketGoodsExcelDto;
import com.liquidnet.service.goblin.dto.GoblinMarketGoodsUnDateExcelDto;
import com.liquidnet.service.goblin.dto.GoblinZhengzaiMarketOrderExcelDto; import com.liquidnet.service.goblin.dto.GoblinZhengzaiMarketOrderExcelDto;
import com.liquidnet.service.goblin.dto.MallOrdertDao; import com.liquidnet.service.goblin.dto.MallOrdertDao;
import com.liquidnet.service.goblin.entity.GoblinStoreOrder; import com.liquidnet.service.goblin.entity.GoblinStoreOrder;
...@@ -24,4 +26,9 @@ public interface GoblinStoreOrderMapper extends BaseMapper<GoblinStoreOrder> { ...@@ -24,4 +26,9 @@ public interface GoblinStoreOrderMapper extends BaseMapper<GoblinStoreOrder> {
states, @Param("mailType") Integer mailType, @Param("storeId") String storeId); states, @Param("mailType") Integer mailType, @Param("storeId") String storeId);
List<GoblinZhengzaiMarketOrderExcelDto> exportZhengzaiMarketOrder(Map<String, Object> paramMap); List<GoblinZhengzaiMarketOrderExcelDto> exportZhengzaiMarketOrder(Map<String, Object> paramMap);
List<GoblinMarketGoodsExcelDto> exportMarketGoods(Map<String, Object> paramMap);
List<GoblinMarketGoodsUnDateExcelDto> exportMarketGoodsUnDate(Map<String, Object> paramMap);
} }
...@@ -30,29 +30,29 @@ ...@@ -30,29 +30,29 @@
<select id="exportMallOrder" resultMap="exportMallOrderDaoResult"> <select id="exportMallOrder" resultMap="exportMallOrderDaoResult">
select select
gso.order_id as order_id, gso.order_id as order_id,
gso.order_code as order_code, gso.order_code as order_code,
gso.user_mobile as user_mobile, gso.user_mobile as user_mobile,
gso.price_express as price_express, gso.price_express as price_express,
gso.price_coupon as price_coupon, gso.price_coupon as price_coupon,
gso.store_price_coupon as store_price_coupon, gso.store_price_coupon as store_price_coupon,
goa.express_contacts as express_contacts, goa.express_contacts as express_contacts,
goa.express_phone as express_phone, goa.express_phone as express_phone,
CONCAT(goa.express_address,' ',goa.express_address_detail) as express_detail_address, CONCAT(goa.express_address,' ',goa.express_address_detail) as express_detail_address,
gso.pay_type as pay_type, gso.pay_type as pay_type,
gso.pay_time as pay_time, gso.pay_time as pay_time,
gso.created_at as created_at, gso.created_at as created_at,
gm.logistics_company as logistics_company, gm.logistics_company as logistics_company,
gm.mail_no as mail_no, gm.mail_no as mail_no,
gos.spu_id as spu_id, gos.spu_id as spu_id,
gg.name as name, gg.name as name,
gg.cate1_name as cate1_name, gg.cate1_name as cate1_name,
gg.cate2_name as cate2_name, gg.cate2_name as cate2_name,
gos.sku_name as sku_name, gos.sku_name as sku_name,
gos.num as num, gos.num as num,
gos.sku_price as sku_price, gos.sku_price as sku_price,
gos.sku_price_actual as sku_price_actual, gos.sku_price_actual as sku_price_actual,
gos.order_sku_id as order_sku_id gos.order_sku_id as order_sku_id
from goblin_store_order as gso from goblin_store_order as gso
inner join goblin_order_sku as gos on gos.order_id = gso.order_id inner join goblin_order_sku as gos on gos.order_id = gso.order_id
inner join (select spu_id, gg.name, gsgc1.name as cate1_name, gsgc2.name as cate2_name inner join (select spu_id, gg.name, gsgc1.name as cate1_name, gsgc2.name as cate2_name
...@@ -63,7 +63,7 @@ ...@@ -63,7 +63,7 @@
inner join goblin_order_attr as goa on goa.order_id = gso.order_id inner join goblin_order_attr as goa on goa.order_id = gso.order_id
left join goblin_mail as gm on gm.order_id = gso.order_id left join goblin_mail as gm on gm.order_id = gso.order_id
<where> <where>
and gso.store_id = #{storeId} and gso.store_id = #{storeId}
<if test="beginTime != null and endTime != null"> <if test="beginTime != null and endTime != null">
and gso.created_at between #{beginTime} and #{endTime} and gso.created_at between #{beginTime} and #{endTime}
</if> </if>
...@@ -82,33 +82,35 @@ ...@@ -82,33 +82,35 @@
</where> </where>
group by gos.order_sku_id group by gos.order_sku_id
</select> </select>
<select id="exportZhengzaiMarketOrder" resultType="com.liquidnet.service.goblin.dto.GoblinZhengzaiMarketOrderExcelDto"> <select id="exportZhengzaiMarketOrder"
select gos.spu_name spuName, resultType="com.liquidnet.service.goblin.dto.GoblinZhengzaiMarketOrderExcelDto">
gsm.name marketName, select gos.spu_name spuName,
gsi.store_name storeName, gsm.name marketName,
gso.order_code orderCode, gsi.store_name storeName,
gso.pay_code payCode, gso.order_code orderCode,
if(gso.status in (2, 3, 4), '已付款', '已退款') orderStatus, gso.pay_code payCode,
gso.created_at createdAt, if(gso.status in (2, 3, 4), '已付款', '已退款') orderStatus,
gos.push_time pushTime, gso.created_at createdAt,
if(gso.device_from = 'micropay', 'pos机订单', '线上订单') deviceFrom, gos.push_time pushTime,
(case gso.pay_type if(gso.device_from = 'micropay', 'pos机订单', '线上订单') deviceFrom,
when 'wepay' then '微信支付' (case gso.pay_type
when 'alipay' then '支付宝支付' when 'wepay' then '微信支付'
when 'huifu' then '汇付' when 'alipay' then '支付宝支付'
when 'unionpay' then '云闪付' when 'huifu' then '汇付'
when 'pos_crash' then '现金支付' when 'unionpay' then '云闪付'
else '0元付' end) payType, when 'pos_crash' then '现金支付'
gos.num nums, else '0元付' end) payType,
gos.sku_price skuPrice, gos.num nums,
gos.sku_price_actual priceActual, gos.sku_price skuPrice,
gos.price_voucher priceVoucher gos.sku_price_actual priceActual,
gos.price_voucher priceVoucher
from goblin_store_order gso from goblin_store_order gso
inner join goblin_order_sku gos on gos.order_id = gso.order_id inner join goblin_order_sku gos on gos.order_id = gso.order_id
inner join goblin_store_info gsi on gsi.store_id = gso.store_id inner join goblin_store_info gsi on gsi.store_id = gso.store_id
inner join goblin_self_marketing gsm on gsm.self_market_id = SUBSTRING_INDEX(gso.market_id, 'ZZ', -1) inner join goblin_self_marketing gsm on gsm.self_market_id = SUBSTRING_INDEX(gso.market_id, 'ZZ', -1)
<where> <where>
gso.status not in (0, 5) and gso.store_id = #{storeId,jdbcType=VARCHAR} and gso.market_id = #{marketId,jdbcType=VARCHAR} gso.status not in (0, 5) and gso.store_id = #{storeId,jdbcType=VARCHAR} and gso.market_id =
#{marketId,jdbcType=VARCHAR}
<if test="beginTime != null"> <if test="beginTime != null">
and gso.created_at <![CDATA[>=]]> #{beginTime,jdbcType=TIMESTAMP} and gso.created_at <![CDATA[>=]]> #{beginTime,jdbcType=TIMESTAMP}
</if> </if>
...@@ -119,4 +121,131 @@ ...@@ -119,4 +121,131 @@
order by gso.created_at desc order by gso.created_at desc
</select> </select>
<select id="exportMarketGoods" resultType="com.liquidnet.service.goblin.dto.GoblinMarketGoodsExcelDto">
SELECT
c.name AS 'marketName',
c.store_name AS 'storeName',
DATE_FORMAT(c.created_at,'%Y-%m-%d') as 'date',
spu_no AS 'spuNo' ,
b.sku_bar_code AS 'skuBarCode' ,
a.`name` AS 'spuName' ,
b.`name` AS 'skuName' ,
gg.cate1_name AS 'gg1' ,
gg.cate2_name AS 'gg2' ,
gg.cate3_name AS 'gg3' ,
b.price AS 'skuPrice' ,
sum(CASE WHEN c. STATUS not IN(0 , 5) THEN c.num ELSE 0 END) AS 'saleCount' ,
sum(case when c.status in (6,7) then c.num else 0 end) 'refundCount',
sum(CASE WHEN c. STATUS not IN(0 , 5) THEN c.sku_price_actual ELSE 0 END ) AS 'salePrice' ,
sum(CASE WHEN c. STATUS IN(6 , 7) THEN c.sku_price_actual ELSE 0 END) AS 'refundPrice' ,
sum(CASE WHEN c. STATUS IN(2 , 3 , 4) THEN c.price_voucher ELSE 0 END ) AS 'voucherPrice',
sum(CASE WHEN c. STATUS IN(2 , 3 , 4) THEN c.num ELSE 0 END ) AS 'count' ,
sum(CASE WHEN c. STATUS IN(2 , 3 , 4) THEN c.sku_price_actual ELSE 0 END) AS 'price'
FROM
goblin_goods AS a
INNER JOIN goblin_goods_sku AS b ON a.spu_id = b.spu_id
LEFT JOIN(
SELECT
c.sku_id ,
d.market_id ,
c. STATUS ,
c.num ,
c.sku_price_actual ,
c.price_voucher,
c.created_at,
gsi.store_name,
gsm.name
FROM
goblin_order_sku AS c
INNER JOIN goblin_store_order AS d ON d.order_id = c.order_id
inner join goblin_store_info gsi on gsi.store_id = d.store_id
inner join goblin_self_marketing gsm on gsm.self_market_id = SUBSTRING_INDEX(d.market_id, 'ZZ', -1)
) AS c ON SUBSTRING_INDEX(c.sku_id, 'ZZ', 1) = b.sku_id
INNER JOIN(
SELECT
spu_id ,
gg. NAME ,
gsgc1. NAME AS cate1_name ,
gsgc2. NAME AS cate2_name,
gsgc3. NAME AS cate3_name
FROM
goblin_goods AS gg
LEFT JOIN goblin_self_goods_category AS gsgc1 ON gsgc1.cate_id = gg.cate_fid
LEFT JOIN goblin_self_goods_category AS gsgc2 ON gsgc2.cate_id = gg.cate_sid
LEFT JOIN goblin_self_goods_category AS gsgc3 ON gsgc3.cate_id = gg.cate_tid
) AS gg ON a.spu_id = gg.spu_id
<where>
c.market_id = #{marketId,jdbcType=VARCHAR}
and a.store_id = #{storeId,jdbcType=VARCHAR}
and c.created_at <![CDATA[>=]]> #{beginTime,jdbcType=TIMESTAMP}
and c.created_at <![CDATA[<]]> #{endTime,jdbcType=TIMESTAMP}
</where>
GROUP BY
date,
b.sku_id;
</select>
<select id="exportMarketGoodsUnDate" resultType="com.liquidnet.service.goblin.dto.GoblinMarketGoodsUnDateExcelDto">
SELECT
c.name AS 'marketName',
c.store_name AS 'storeName',
spu_no AS 'spuNo' ,
b.sku_bar_code AS 'skuBarCode' ,
a.`name` AS 'spuName' ,
b.`name` AS 'skuName' ,
gg.cate1_name AS 'gg1' ,
gg.cate2_name AS 'gg2' ,
gg.cate3_name AS 'gg3' ,
b.price AS 'skuPrice' ,
sum(CASE WHEN c. STATUS not IN(0 , 5) THEN c.num ELSE 0 END) AS 'saleCount' ,
sum(case when c.status in (6,7) then c.num else 0 end) 'refundCount',
sum(CASE WHEN c. STATUS not IN(0 , 5) THEN c.sku_price_actual ELSE 0 END ) AS 'salePrice' ,
sum(CASE WHEN c. STATUS IN(6 , 7) THEN c.sku_price_actual ELSE 0 END) AS 'refundPrice' ,
sum(CASE WHEN c. STATUS IN(2 , 3 , 4) THEN c.price_voucher ELSE 0 END ) AS 'voucherPrice',
sum(CASE WHEN c. STATUS IN(2 , 3 , 4) THEN c.num ELSE 0 END ) AS 'count' ,
sum(CASE WHEN c. STATUS IN(2 , 3 , 4) THEN c.sku_price_actual ELSE 0 END) AS 'price'
FROM
goblin_goods AS a
INNER JOIN goblin_goods_sku AS b ON a.spu_id = b.spu_id
LEFT JOIN(
SELECT
c.sku_id ,
d.market_id ,
c. STATUS ,
c.num ,
c.sku_price_actual ,
c.price_voucher,
c.created_at,
gsi.store_name,
gsm.name
FROM
goblin_order_sku AS c
INNER JOIN goblin_store_order AS d ON d.order_id = c.order_id
inner join goblin_store_info gsi on gsi.store_id = d.store_id
inner join goblin_self_marketing gsm on gsm.self_market_id = SUBSTRING_INDEX(d.market_id, 'ZZ', -1)
) AS c ON SUBSTRING_INDEX(c.sku_id, 'ZZ', 1) = b.sku_id
INNER JOIN(
SELECT
spu_id ,
gg. NAME ,
gsgc1. NAME AS cate1_name ,
gsgc2. NAME AS cate2_name,
gsgc3. NAME AS cate3_name
FROM
goblin_goods AS gg
LEFT JOIN goblin_self_goods_category AS gsgc1 ON gsgc1.cate_id = gg.cate_fid
LEFT JOIN goblin_self_goods_category AS gsgc2 ON gsgc2.cate_id = gg.cate_sid
LEFT JOIN goblin_self_goods_category AS gsgc3 ON gsgc3.cate_id = gg.cate_tid
) AS gg ON a.spu_id = gg.spu_id
<where>
c.market_id = #{marketId,jdbcType=VARCHAR}
and a.store_id = #{storeId,jdbcType=VARCHAR}
and c.created_at <![CDATA[>=]]> #{beginTime,jdbcType=TIMESTAMP}
and c.created_at <![CDATA[<]]> #{endTime,jdbcType=TIMESTAMP}
</where>
GROUP BY
b.sku_id;
</select>
</mapper> </mapper>
...@@ -10,6 +10,8 @@ import com.liquidnet.commons.lang.util.DateUtil; ...@@ -10,6 +10,8 @@ import com.liquidnet.commons.lang.util.DateUtil;
import com.liquidnet.commons.lang.util.JsonUtils; import com.liquidnet.commons.lang.util.JsonUtils;
import com.liquidnet.service.base.ResponseDto; import com.liquidnet.service.base.ResponseDto;
import com.liquidnet.service.goblin.constant.GoblinStatusConst; import com.liquidnet.service.goblin.constant.GoblinStatusConst;
import com.liquidnet.service.goblin.dto.GoblinMarketGoodsExcelDto;
import com.liquidnet.service.goblin.dto.GoblinMarketGoodsUnDateExcelDto;
import com.liquidnet.service.goblin.dto.GoblinZhengzaiMarketOrderExcelDto; import com.liquidnet.service.goblin.dto.GoblinZhengzaiMarketOrderExcelDto;
import com.liquidnet.service.goblin.service.IGoblinExportService; import com.liquidnet.service.goblin.service.IGoblinExportService;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
...@@ -67,10 +69,126 @@ public class GoblinExportDataController { ...@@ -67,10 +69,126 @@ public class GoblinExportDataController {
@ApiImplicitParam(type = "form", required = true, dataType = "String", name = "mailType", value = "快递状态[0-全部|1-未发货|2-已发货]"), @ApiImplicitParam(type = "form", required = true, dataType = "String", name = "mailType", value = "快递状态[0-全部|1-未发货|2-已发货]"),
}) })
public ResponseDto<String> exportMallOrder(HttpServletResponse response, @RequestParam("beginTime") String beginTime, @RequestParam("endTime") String endTime, public ResponseDto<String> exportMallOrder(HttpServletResponse response, @RequestParam("beginTime") String beginTime, @RequestParam("endTime") String endTime,
@RequestParam("state") String state, @RequestParam("mailType") Integer mailType, @RequestParam("storeId") String storeId) { @RequestParam("state") String state, @RequestParam("mailType") Integer mailType, @RequestParam("storeId") String storeId) {
return iGoblinExportService.exportMallOrder(response, beginTime, endTime, state, mailType, storeId); return iGoblinExportService.exportMallOrder(response, beginTime, endTime, state, mailType, storeId);
} }
/**
* excel正在下单根据日期导出
*
* @return
*/
@GetMapping("/exportMarketGoods")
@ApiOperation(value = "正在下单-商品根据日期")
@ResponseBody
@ApiImplicitParams({
@ApiImplicitParam(type = "form", required = true, dataType = "String", name = "storeId", value = "店铺ID"),
@ApiImplicitParam(type = "form", required = true, dataType = "String", name = "marketId", value = "活动ID"),
@ApiImplicitParam(type = "form", required = true, dataType = "String", name = "bDate", value = "开始时间[yyyy-MM-dd]"),
@ApiImplicitParam(type = "form", required = true, dataType = "String", name = "eDate", value = "结束时间[yyyy-MM-dd]"),
})
public void exportMarketGoods(@RequestParam(required = true, name = "bDate") @Pattern(regexp = LnsRegex.Valid.DATETIME_YMD, message = "开始日期格式有误") String beginDate,
@RequestParam(required = true, name = "eDate") @Pattern(regexp = LnsRegex.Valid.DATETIME_YMD, message = "结束日期格式有误") String endDate,
@RequestParam String marketId, @RequestParam String storeId, HttpServletResponse response) {
String currentUid = CurrentUtil.getCurrentUid();
ServletOutputStream servletOutputStream = null;
try {
log.debug("数据导出:正在下单-商品根据日期导出:[uid:{},storeId:{},marketId:{},date:{}~{}]", currentUid, storeId, marketId, beginDate, endDate);
String fileName = DateUtil.Formatter.yyyyMMddHHmmssTrim.format(LocalDateTime.now())
.concat(new String(("正在下单-商品根据日期导出").getBytes("gb2312"), StandardCharsets.ISO_8859_1));
response.setHeader(HttpHeaders.CONTENT_DISPOSITION, "attachment;filename=".concat(fileName).concat(ExcelTypeEnum.XLSX.getValue()));
response.setContentType(MediaType.MULTIPART_FORM_DATA_VALUE);
response.setCharacterEncoding(StandardCharsets.UTF_8.name());
servletOutputStream = response.getOutputStream();
HashMap<String, Object> paramMap = CollectionUtil.mapStringObject();
paramMap.put("storeId", storeId);
paramMap.put("marketId", GoblinStatusConst.MarketPreStatus.MARKET_PRE_ZHENGZAI.getValue() + marketId);
LocalDate beginLocalDate = DateUtil.Formatter.yyyy_MM_dd.parse2LocalDate(beginDate);
LocalDate endLocalDate = DateUtil.Formatter.yyyy_MM_dd.parse2LocalDate(endDate);
paramMap.put("beginTime", null == beginLocalDate ? beginLocalDate : LocalDateTime.of(beginLocalDate, LocalTime.MIN));
paramMap.put("endTime", null == endLocalDate ? endLocalDate : LocalDateTime.of(endLocalDate, LocalTime.MAX));
if (log.isDebugEnabled()) {
log.debug("数据导出:正在下单-商品根据日期导出:[uid:{},paramMap:{}]", currentUid, JsonUtils.toJson(paramMap));
}
List<GoblinMarketGoodsExcelDto> excelDtos = iGoblinExportService.exportMarketGoods(paramMap);
if (CollectionUtils.isEmpty(excelDtos)) {
log.warn("数据导出:正在下单-商品根据日期导出:无数据,请核实:[uid:{},paramMap:{}]", currentUid, JsonUtils.toJson(paramMap));
return;
}
EasyExcel.write(servletOutputStream, GoblinMarketGoodsExcelDto.class).sheet("销售数据").doWrite(excelDtos);
} catch (IOException e) {
log.error("数据导出:正在下单-商品根据日期导出:异常[uid:{},storeId:{},marketId:{},date:{}~{},ex.msg={}]",
currentUid, storeId, marketId, beginDate, endDate, e.getLocalizedMessage());
throw new LiquidnetServiceException("-1", "导出失败,请联系网站管理员");
} finally {
if (null != servletOutputStream) {
try {
servletOutputStream.close();
} catch (Exception ignored) {
}
}
}
}
/**
* excel正在下单根据导出
*/
@GetMapping("/exportMarketGoodsUnDate")
@ApiOperation(value = "正在下单-商品导出")
@ResponseBody
@ApiImplicitParams({
@ApiImplicitParam(type = "form", required = true, dataType = "String", name = "storeId", value = "店铺ID"),
@ApiImplicitParam(type = "form", required = true, dataType = "String", name = "marketId", value = "活动ID"),
@ApiImplicitParam(type = "form", required = true, dataType = "String", name = "bDate", value = "开始时间[yyyy-MM-dd]"),
@ApiImplicitParam(type = "form", required = true, dataType = "String", name = "eDate", value = "结束时间[yyyy-MM-dd]"),
})
public void exportMarketGoodsUnDate(@RequestParam(required = true, name = "bDate") @Pattern(regexp = LnsRegex.Valid.DATETIME_FULL, message = "开始日期格式有误") String beginDate,
@RequestParam(required = true, name = "eDate") @Pattern(regexp = LnsRegex.Valid.DATETIME_FULL, message = "结束日期格式有误") String endDate,
@RequestParam String marketId, @RequestParam String storeId, HttpServletResponse response) {
String currentUid = CurrentUtil.getCurrentUid();
ServletOutputStream servletOutputStream = null;
try {
log.debug("数据导出:正在下单-商品导出:[uid:{},storeId:{},marketId:{},date:{}~{}]", currentUid, storeId, marketId, beginDate, endDate);
String fileName = DateUtil.Formatter.yyyyMMddHHmmssTrim.format(LocalDateTime.now())
.concat(new String(("正在下单-商品导出").getBytes("gb2312"), StandardCharsets.ISO_8859_1));
response.setHeader(HttpHeaders.CONTENT_DISPOSITION, "attachment;filename=".concat(fileName).concat(ExcelTypeEnum.XLSX.getValue()));
response.setContentType(MediaType.MULTIPART_FORM_DATA_VALUE);
response.setCharacterEncoding(StandardCharsets.UTF_8.name());
servletOutputStream = response.getOutputStream();
HashMap<String, Object> paramMap = CollectionUtil.mapStringObject();
paramMap.put("storeId", storeId);
paramMap.put("marketId", GoblinStatusConst.MarketPreStatus.MARKET_PRE_ZHENGZAI.getValue() + marketId);
LocalDate beginLocalDate = DateUtil.Formatter.yyyyMMddHHmmss.parse2LocalDate(beginDate);
LocalDate endLocalDate = DateUtil.Formatter.yyyyMMddHHmmss.parse2LocalDate(endDate);
paramMap.put("beginTime", null == beginLocalDate ? beginLocalDate : LocalDateTime.of(beginLocalDate, LocalTime.MIN));
paramMap.put("endTime", null == endLocalDate ? endLocalDate : LocalDateTime.of(endLocalDate, LocalTime.MAX));
if (log.isDebugEnabled()) {
log.debug("数据导出:正在下单-商品导出:[uid:{},paramMap:{}]", currentUid, JsonUtils.toJson(paramMap));
}
List<GoblinMarketGoodsUnDateExcelDto> excelDtos = iGoblinExportService.exportMarketGoodsUnDate(paramMap);
if (CollectionUtils.isEmpty(excelDtos)) {
log.warn("数据导出:正在下单-商品导出:无数据,请核实:[uid:{},paramMap:{}]", currentUid, JsonUtils.toJson(paramMap));
return;
}
EasyExcel.write(servletOutputStream, GoblinMarketGoodsUnDateExcelDto.class).sheet("销售数据").doWrite(excelDtos);
} catch (IOException e) {
log.error("数据导出:正在下单-商品导出:异常[uid:{},storeId:{},marketId:{},date:{}~{},ex.msg={}]",
currentUid, storeId, marketId, beginDate, endDate, e.getLocalizedMessage());
throw new LiquidnetServiceException("-1", "导出失败,请联系网站管理员");
} finally {
if (null != servletOutputStream) {
try {
servletOutputStream.close();
} catch (Exception ignored) {
}
}
}
}
@GetMapping("zzMarketOrder") @GetMapping("zzMarketOrder")
@ApiOperation(value = "正在下单-销售数据") @ApiOperation(value = "正在下单-销售数据")
@ResponseBody @ResponseBody
...@@ -80,9 +198,9 @@ public class GoblinExportDataController { ...@@ -80,9 +198,9 @@ public class GoblinExportDataController {
@ApiImplicitParam(type = "form", required = false, dataType = "String", name = "bDate", value = "开始时间[yyyy-MM-dd]"), @ApiImplicitParam(type = "form", required = false, dataType = "String", name = "bDate", value = "开始时间[yyyy-MM-dd]"),
@ApiImplicitParam(type = "form", required = false, dataType = "String", name = "eDate", value = "结束时间[yyyy-MM-dd]"), @ApiImplicitParam(type = "form", required = false, dataType = "String", name = "eDate", value = "结束时间[yyyy-MM-dd]"),
}) })
public void exportZhengzaiMarketOrder(@RequestParam(required = false, name = "bDate") @Pattern(regexp = LnsRegex.Valid.DATETIME_YMD, message = "开始日期格式有误") String beginDate, public void exportZhengzaiMarketOrder(@RequestParam(required = false, name = "bDate") @Pattern(regexp = LnsRegex.Valid.DATETIME_FULL, message = "开始日期格式有误") String beginDate,
@RequestParam(required = false, name = "eDate") @Pattern(regexp = LnsRegex.Valid.DATETIME_YMD, message = "结束日期格式有误") String endDate, @RequestParam(required = false, name = "eDate") @Pattern(regexp = LnsRegex.Valid.DATETIME_FULL, message = "结束日期格式有误") String endDate,
@RequestParam String marketId, @RequestParam String storeId, HttpServletResponse response) { @RequestParam String marketId, @RequestParam String storeId, HttpServletResponse response) {
String currentUid = CurrentUtil.getCurrentUid(); String currentUid = CurrentUtil.getCurrentUid();
ServletOutputStream servletOutputStream = null; ServletOutputStream servletOutputStream = null;
try { try {
...@@ -97,8 +215,8 @@ public class GoblinExportDataController { ...@@ -97,8 +215,8 @@ public class GoblinExportDataController {
HashMap<String, Object> paramMap = CollectionUtil.mapStringObject(); HashMap<String, Object> paramMap = CollectionUtil.mapStringObject();
paramMap.put("storeId", storeId); paramMap.put("storeId", storeId);
paramMap.put("marketId", GoblinStatusConst.MarketPreStatus.MARKET_PRE_ZHENGZAI.getValue() + marketId); paramMap.put("marketId", GoblinStatusConst.MarketPreStatus.MARKET_PRE_ZHENGZAI.getValue() + marketId);
LocalDate beginLocalDate = DateUtil.Formatter.yyyy_MM_dd.parse2LocalDate(beginDate); LocalDate beginLocalDate = DateUtil.Formatter.yyyyMMddHHmmss.parse2LocalDate(beginDate);
LocalDate endLocalDate = DateUtil.Formatter.yyyy_MM_dd.parse2LocalDate(endDate); LocalDate endLocalDate = DateUtil.Formatter.yyyyMMddHHmmss.parse2LocalDate(endDate);
paramMap.put("beginTime", null == beginLocalDate ? beginLocalDate : LocalDateTime.of(beginLocalDate, LocalTime.MIN)); paramMap.put("beginTime", null == beginLocalDate ? beginLocalDate : LocalDateTime.of(beginLocalDate, LocalTime.MIN));
paramMap.put("endTime", null == endLocalDate ? endLocalDate : LocalDateTime.of(endLocalDate, LocalTime.MAX)); paramMap.put("endTime", null == endLocalDate ? endLocalDate : LocalDateTime.of(endLocalDate, LocalTime.MAX));
if (log.isDebugEnabled()) { if (log.isDebugEnabled()) {
...@@ -114,7 +232,7 @@ public class GoblinExportDataController { ...@@ -114,7 +232,7 @@ public class GoblinExportDataController {
} catch (IOException e) { } catch (IOException e) {
log.error("数据导出:正在下单-销售数据:异常[uid:{},storeId:{},marketId:{},date:{}~{},ex.msg={}]", log.error("数据导出:正在下单-销售数据:异常[uid:{},storeId:{},marketId:{},date:{}~{},ex.msg={}]",
currentUid, storeId, marketId, beginDate, endDate, e.getLocalizedMessage()); currentUid, storeId, marketId, beginDate, endDate, e.getLocalizedMessage());
throw new LiquidnetServiceException("-1","导出失败,请联系网站管理员"); throw new LiquidnetServiceException("-1", "导出失败,请联系网站管理员");
} finally { } finally {
if (null != servletOutputStream) { if (null != servletOutputStream) {
try { try {
......
...@@ -7,6 +7,8 @@ import com.alibaba.excel.write.style.HorizontalCellStyleStrategy; ...@@ -7,6 +7,8 @@ import com.alibaba.excel.write.style.HorizontalCellStyleStrategy;
import com.alibaba.excel.write.style.column.SimpleColumnWidthStyleStrategy; import com.alibaba.excel.write.style.column.SimpleColumnWidthStyleStrategy;
import com.liquidnet.commons.lang.util.CollectionUtil; import com.liquidnet.commons.lang.util.CollectionUtil;
import com.liquidnet.service.base.ResponseDto; import com.liquidnet.service.base.ResponseDto;
import com.liquidnet.service.goblin.dto.GoblinMarketGoodsExcelDto;
import com.liquidnet.service.goblin.dto.GoblinMarketGoodsUnDateExcelDto;
import com.liquidnet.service.goblin.dto.GoblinZhengzaiMarketOrderExcelDto; import com.liquidnet.service.goblin.dto.GoblinZhengzaiMarketOrderExcelDto;
import com.liquidnet.service.goblin.dto.MallOrdertDao; import com.liquidnet.service.goblin.dto.MallOrdertDao;
import com.liquidnet.service.goblin.mapper.GoblinStoreOrderMapper; import com.liquidnet.service.goblin.mapper.GoblinStoreOrderMapper;
...@@ -35,6 +37,16 @@ public class GoblinExportServiceImpl implements IGoblinExportService { ...@@ -35,6 +37,16 @@ public class GoblinExportServiceImpl implements IGoblinExportService {
return goblinStoreOrderMapper.exportZhengzaiMarketOrder(paramMap); return goblinStoreOrderMapper.exportZhengzaiMarketOrder(paramMap);
} }
@Override
public List<GoblinMarketGoodsExcelDto> exportMarketGoods(Map<String, Object> paramMap) {
return goblinStoreOrderMapper.exportMarketGoods(paramMap);
}
@Override
public List<GoblinMarketGoodsUnDateExcelDto> exportMarketGoodsUnDate(Map<String, Object> paramMap) {
return goblinStoreOrderMapper.exportMarketGoodsUnDate(paramMap);
}
@Override @Override
public ResponseDto<String> exportMallOrder(HttpServletResponse response, String beginTime, String endTime, String state, Integer mailType, String storeId) { public ResponseDto<String> exportMallOrder(HttpServletResponse response, String beginTime, String endTime, String state, Integer mailType, String storeId) {
if (!timeIsNotNull(beginTime, endTime)) { if (!timeIsNotNull(beginTime, endTime)) {
......
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