Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
594245a022
|
|
@ -10,6 +10,7 @@ import com.czg.sa.StpKit;
|
|||
import com.mybatisflex.core.paginate.Page;
|
||||
import com.pig4cloud.plugin.excel.annotation.ResponseExcel;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
|
@ -22,6 +23,7 @@ import java.util.List;
|
|||
* @author tankaikai
|
||||
* @since 2025-03-07 15:25
|
||||
*/
|
||||
@Slf4j
|
||||
@AllArgsConstructor
|
||||
@RestController
|
||||
@RequestMapping("/admin/sale/summary")
|
||||
|
|
@ -62,6 +64,8 @@ public class SaleSummaryController {
|
|||
@OperationLog("导出")
|
||||
//@SaAdminCheckPermission("saleSummary:export")
|
||||
public List<SaleSummaryInfoVo> summaryExport(SaleSummaryCountParam param) {
|
||||
Long shopId = StpKit.USER.getShopId(0L);
|
||||
param.setShopId(shopId);
|
||||
return saleSummaryService.summaryList(param);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -32,5 +32,5 @@ public class SaleSummaryCountVo implements Serializable {
|
|||
/**
|
||||
* 退单量
|
||||
*/
|
||||
private Integer refundCount = 0;
|
||||
private BigDecimal refundCount = BigDecimal.ZERO;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ package com.czg.order.vo;
|
|||
|
||||
import cn.idev.excel.annotation.ExcelIgnore;
|
||||
import cn.idev.excel.annotation.ExcelProperty;
|
||||
import cn.idev.excel.annotation.write.style.ColumnWidth;
|
||||
import com.alibaba.fastjson2.annotation.JSONField;
|
||||
import com.pig4cloud.plugin.excel.annotation.ExcelLine;
|
||||
import lombok.Data;
|
||||
|
|
@ -17,6 +18,7 @@ import java.math.BigDecimal;
|
|||
* @since 2025-03-07 16:22
|
||||
*/
|
||||
@Data
|
||||
@ColumnWidth(30)
|
||||
public class SaleSummaryExportVo implements Serializable {
|
||||
|
||||
@Serial
|
||||
|
|
|
|||
|
|
@ -1,10 +1,16 @@
|
|||
package com.czg.order.vo;
|
||||
|
||||
import cn.idev.excel.annotation.ExcelIgnore;
|
||||
import cn.idev.excel.annotation.ExcelProperty;
|
||||
import cn.idev.excel.annotation.write.style.ColumnWidth;
|
||||
import com.alibaba.fastjson2.annotation.JSONField;
|
||||
import com.pig4cloud.plugin.excel.annotation.ExcelLine;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* 销量统计明细
|
||||
|
|
@ -13,42 +19,47 @@ import java.io.Serializable;
|
|||
*/
|
||||
@NoArgsConstructor
|
||||
@Data
|
||||
@ColumnWidth(30)
|
||||
public class SaleSummaryInfoVo implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
|
||||
/**
|
||||
* cateName
|
||||
* 导入时候回显行号
|
||||
*/
|
||||
private String cateName;
|
||||
@ExcelLine
|
||||
@ExcelIgnore
|
||||
@JSONField(serialize = false)
|
||||
private Long lineNum;
|
||||
/**
|
||||
* name
|
||||
* 商品分类
|
||||
*/
|
||||
private String name;
|
||||
@ExcelProperty("商品分类")
|
||||
private String categoryName;
|
||||
/**
|
||||
* productId
|
||||
* 商品名称
|
||||
*/
|
||||
private Integer productId;
|
||||
@ExcelProperty("商品名称")
|
||||
private String productName;
|
||||
/**
|
||||
* refAmount
|
||||
* 销量
|
||||
*/
|
||||
private Integer refAmount;
|
||||
@ExcelProperty("销量")
|
||||
private BigDecimal saleCount;
|
||||
/**
|
||||
* refNum
|
||||
* 销售金额
|
||||
*/
|
||||
private Integer refNum;
|
||||
@ExcelProperty("销售金额")
|
||||
private BigDecimal saleAmount;
|
||||
/**
|
||||
* salesAmount
|
||||
* 退单量
|
||||
*/
|
||||
private Integer salesAmount;
|
||||
@ExcelProperty("退单量")
|
||||
private BigDecimal refundCount;
|
||||
/**
|
||||
* salesNum
|
||||
* 退单金额
|
||||
*/
|
||||
private Integer salesNum;
|
||||
/**
|
||||
* typeEnum
|
||||
*/
|
||||
private String typeEnum;
|
||||
@ExcelProperty("退单金额")
|
||||
private BigDecimal refundAmount;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ package com.czg.order.vo;
|
|||
|
||||
import cn.idev.excel.annotation.ExcelIgnore;
|
||||
import cn.idev.excel.annotation.ExcelProperty;
|
||||
import cn.idev.excel.annotation.write.style.ColumnWidth;
|
||||
import com.alibaba.fastjson2.annotation.JSONField;
|
||||
import com.pig4cloud.plugin.excel.annotation.ExcelLine;
|
||||
import lombok.Data;
|
||||
|
|
@ -17,6 +18,7 @@ import java.math.BigDecimal;
|
|||
* @since 2025-03-07 16:22
|
||||
*/
|
||||
@Data
|
||||
@ColumnWidth(30)
|
||||
public class TableSummaryExportVo implements Serializable {
|
||||
|
||||
@Serial
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ import com.czg.order.param.DataSummaryProductSaleParam;
|
|||
import com.czg.order.param.SaleSummaryCountParam;
|
||||
import com.czg.order.vo.DataSummaryProductSaleRankingVo;
|
||||
import com.czg.order.vo.SaleSummaryCountVo;
|
||||
import com.czg.order.vo.SaleSummaryInfoVo;
|
||||
import com.mybatisflex.core.BaseMapper;
|
||||
|
||||
import java.util.List;
|
||||
|
|
@ -21,4 +22,6 @@ public interface ShopProdStatisticMapper extends BaseMapper<ShopProdStatistic> {
|
|||
|
||||
SaleSummaryCountVo getSaleSummaryCount(SaleSummaryCountParam param);
|
||||
|
||||
List<SaleSummaryInfoVo> findSaleSummaryList(SaleSummaryCountParam param);
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,11 +5,13 @@ import com.czg.order.service.SaleSummaryService;
|
|||
import com.czg.order.vo.SaleSummaryCountVo;
|
||||
import com.czg.order.vo.SaleSummaryInfoVo;
|
||||
import com.czg.service.order.mapper.ShopProdStatisticMapper;
|
||||
import com.czg.utils.PageUtil;
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import com.mybatisflex.core.paginate.Page;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
|
|
@ -34,13 +36,13 @@ public class SaleSummaryServiceImpl implements SaleSummaryService {
|
|||
|
||||
@Override
|
||||
public Page<SaleSummaryInfoVo> summaryPage(SaleSummaryCountParam param) {
|
||||
Page<SaleSummaryInfoVo> page = new Page<>();
|
||||
page.setRecords(new ArrayList<SaleSummaryInfoVo>());
|
||||
return page;
|
||||
PageHelper.startPage(PageUtil.buildPageHelp());
|
||||
PageInfo<SaleSummaryInfoVo> pageInfo = new PageInfo<>(shopProdStatisticMapper.findSaleSummaryList(param));
|
||||
return PageUtil.convert(pageInfo);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<SaleSummaryInfoVo> summaryList(SaleSummaryCountParam param) {
|
||||
return List.of();
|
||||
return shopProdStatisticMapper.findSaleSummaryList(param);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -43,4 +43,35 @@
|
|||
]]>
|
||||
</if>
|
||||
</select>
|
||||
<select id="findSaleSummaryList" resultType="com.czg.order.vo.SaleSummaryInfoVo">
|
||||
select
|
||||
t1.prod_id,
|
||||
max(t1.id) as id,
|
||||
t2.NAME AS product_name,
|
||||
t3.name as category_name,
|
||||
sum(t1.sale_count) as sale_count,
|
||||
sum(t1.sale_amount) as sale_amount,
|
||||
sum(t1.refund_count) as refund_count,
|
||||
sum(t1.refund_amount) as refund_amount
|
||||
from tb_shop_prod_statistic t1
|
||||
left join tb_product t2 on t1.prod_id = t2.id
|
||||
left join tb_shop_prod_category t3 on t2.category_id = t3.id
|
||||
where t1.shop_id = #{shopId}
|
||||
<if test="productName != null and productName != ''">
|
||||
and t2.name like concat('%', #{productName}, '%')
|
||||
</if>
|
||||
<if test="prodCategoryId != null">
|
||||
and t2.category_id = #{prodCategoryId}
|
||||
</if>
|
||||
<if test="beginDate != null and beginDate != ''">
|
||||
and t1.create_day >= str_to_date(#{beginDate}, '%Y-%m-%d')
|
||||
</if>
|
||||
<if test="endDate != null and endDate != ''">
|
||||
<![CDATA[
|
||||
and t1.create_day <= str_to_date(#{endDate}, '%Y-%m-%d')
|
||||
]]>
|
||||
</if>
|
||||
group by t1.prod_id
|
||||
ORDER BY sum( t1.sale_count ) DESC,max(t1.id) DESC
|
||||
</select>
|
||||
</mapper>
|
||||
|
|
|
|||
Loading…
Reference in New Issue