Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
0245a7b6d0
|
|
@ -73,7 +73,6 @@ public class DataSummaryController {
|
||||||
AssertUtil.isNull(day, "天数不能为空");
|
AssertUtil.isNull(day, "天数不能为空");
|
||||||
Long shopId = StpKit.USER.getShopId(0L);
|
Long shopId = StpKit.USER.getShopId(0L);
|
||||||
DataSummaryDateAmountVo data = dataSummaryService.getSummaryAmountData(shopId, day);
|
DataSummaryDateAmountVo data = dataSummaryService.getSummaryAmountData(shopId, day);
|
||||||
|
|
||||||
return CzgResult.success(data);
|
return CzgResult.success(data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,6 @@ package com.czg.controller.admin;
|
||||||
import com.czg.log.annotation.OperationLog;
|
import com.czg.log.annotation.OperationLog;
|
||||||
import com.czg.order.param.TableSummaryParam;
|
import com.czg.order.param.TableSummaryParam;
|
||||||
import com.czg.order.service.TableSummaryService;
|
import com.czg.order.service.TableSummaryService;
|
||||||
import com.czg.order.vo.TableSummaryExportVo;
|
|
||||||
import com.czg.order.vo.TableSummaryInfoVo;
|
import com.czg.order.vo.TableSummaryInfoVo;
|
||||||
import com.czg.resp.CzgResult;
|
import com.czg.resp.CzgResult;
|
||||||
import com.czg.sa.StpKit;
|
import com.czg.sa.StpKit;
|
||||||
|
|
@ -47,8 +46,10 @@ public class TableSummaryController {
|
||||||
@GetMapping("export")
|
@GetMapping("export")
|
||||||
@OperationLog("导出")
|
@OperationLog("导出")
|
||||||
//@SaAdminCheckPermission("tableSummary:export")
|
//@SaAdminCheckPermission("tableSummary:export")
|
||||||
public List<TableSummaryExportVo> summaryExport(TableSummaryParam param) {
|
public List<TableSummaryInfoVo> summaryExport(TableSummaryParam param) {
|
||||||
return tableSummaryService.summaryExport(param);
|
Long shopId = StpKit.USER.getShopId(0L);
|
||||||
|
param.setShopId(shopId);
|
||||||
|
return tableSummaryService.summaryList(param);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -24,12 +24,12 @@ public class DataSummaryTradeParam implements Serializable {
|
||||||
* 开始时间 格式:yyyy-MM-dd
|
* 开始时间 格式:yyyy-MM-dd
|
||||||
*/
|
*/
|
||||||
@NotBlank(message = "开始日期不能为空", groups = DefaultGroup.class)
|
@NotBlank(message = "开始日期不能为空", groups = DefaultGroup.class)
|
||||||
private String beginTime;
|
private String beginDate;
|
||||||
/**
|
/**
|
||||||
* 结束时间 格式:yyyy-MM-dd
|
* 结束时间 格式:yyyy-MM-dd
|
||||||
*/
|
*/
|
||||||
@NotBlank(message = "结束日期不能为空", groups = DefaultGroup.class)
|
@NotBlank(message = "结束日期不能为空", groups = DefaultGroup.class)
|
||||||
private String endTime;
|
private String endDate;
|
||||||
/**
|
/**
|
||||||
* 店铺id
|
* 店铺id
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -21,11 +21,11 @@ public class TableSummaryParam implements Serializable {
|
||||||
/**
|
/**
|
||||||
* 开始时间 格式:yyyy-MM-dd
|
* 开始时间 格式:yyyy-MM-dd
|
||||||
*/
|
*/
|
||||||
private String beginTime;
|
private String beginDate;
|
||||||
/**
|
/**
|
||||||
* 结束时间 格式:yyyy-MM-dd
|
* 结束时间 格式:yyyy-MM-dd
|
||||||
*/
|
*/
|
||||||
private String endTime;
|
private String endDate;
|
||||||
/**
|
/**
|
||||||
* 店铺id
|
* 店铺id
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,6 @@
|
||||||
package com.czg.order.service;
|
package com.czg.order.service;
|
||||||
|
|
||||||
import com.czg.order.param.TableSummaryParam;
|
import com.czg.order.param.TableSummaryParam;
|
||||||
import com.czg.order.vo.TableSummaryExportVo;
|
|
||||||
import com.czg.order.vo.TableSummaryInfoVo;
|
import com.czg.order.vo.TableSummaryInfoVo;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
@ -15,7 +14,6 @@ import java.util.List;
|
||||||
public interface TableSummaryService {
|
public interface TableSummaryService {
|
||||||
|
|
||||||
List<TableSummaryInfoVo> summaryList(TableSummaryParam param);
|
List<TableSummaryInfoVo> summaryList(TableSummaryParam param);
|
||||||
List<TableSummaryExportVo> summaryExport(TableSummaryParam param);
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,10 @@
|
||||||
package com.czg.order.vo;
|
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.Data;
|
||||||
import lombok.NoArgsConstructor;
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
|
@ -14,61 +19,47 @@ import java.math.BigDecimal;
|
||||||
*/
|
*/
|
||||||
@NoArgsConstructor
|
@NoArgsConstructor
|
||||||
@Data
|
@Data
|
||||||
|
@ColumnWidth(30)
|
||||||
public class TableSummaryInfoVo implements Serializable {
|
public class TableSummaryInfoVo implements Serializable {
|
||||||
|
|
||||||
@Serial
|
@Serial
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 台桌
|
* 导入时候回显行号
|
||||||
*/
|
*/
|
||||||
|
@ExcelLine
|
||||||
|
@ExcelIgnore
|
||||||
|
@JSONField(serialize = false)
|
||||||
|
private Long lineNum;
|
||||||
|
/**
|
||||||
|
* 区域名称
|
||||||
|
*/
|
||||||
|
@ExcelProperty("区域名称")
|
||||||
|
private String areaName;
|
||||||
|
/**
|
||||||
|
* 台桌号
|
||||||
|
*/
|
||||||
|
@ExcelProperty("台桌号")
|
||||||
private String tableName;
|
private String tableName;
|
||||||
/**
|
/**
|
||||||
* 日期
|
* 订单数量
|
||||||
*/
|
*/
|
||||||
private String date;
|
@ExcelProperty("订单数量")
|
||||||
|
private Long orderCount;
|
||||||
/**
|
/**
|
||||||
* 商品分类
|
* 订单金额
|
||||||
*/
|
*/
|
||||||
private String categoryName;
|
@ExcelProperty("订单金额")
|
||||||
|
private BigDecimal orderAmount;
|
||||||
/**
|
/**
|
||||||
* 商品名称
|
* 退款数量
|
||||||
*/
|
*/
|
||||||
private String productName;
|
@ExcelProperty("退款数量")
|
||||||
|
private Long refundCount;
|
||||||
/**
|
/**
|
||||||
* 单位
|
* 退款金额
|
||||||
*/
|
|
||||||
private String unitName;
|
|
||||||
/**
|
|
||||||
* 商品规格
|
|
||||||
*/
|
|
||||||
private String specName;
|
|
||||||
/**
|
|
||||||
* 销量
|
|
||||||
*/
|
|
||||||
private BigDecimal salesNum;
|
|
||||||
/**
|
|
||||||
* 单价
|
|
||||||
*/
|
|
||||||
private BigDecimal price;
|
|
||||||
/**
|
|
||||||
* 金额
|
|
||||||
*/
|
|
||||||
private BigDecimal amount;
|
|
||||||
/**
|
|
||||||
* 销售额
|
|
||||||
*/
|
|
||||||
private BigDecimal salesAmount;
|
|
||||||
/**
|
|
||||||
* 总销售额
|
|
||||||
*/
|
|
||||||
private BigDecimal totalSalesAmount;
|
|
||||||
/**
|
|
||||||
* 退单量
|
|
||||||
*/
|
|
||||||
private Integer refundNum;
|
|
||||||
/**
|
|
||||||
* 退单额
|
|
||||||
*/
|
*/
|
||||||
|
@ExcelProperty("退款金额")
|
||||||
private BigDecimal refundAmount;
|
private BigDecimal refundAmount;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,9 @@
|
||||||
package com.czg.service.order.mapper;
|
package com.czg.service.order.mapper;
|
||||||
|
|
||||||
import com.mybatisflex.core.BaseMapper;
|
|
||||||
import com.czg.order.entity.ShopTableOrderStatistic;
|
import com.czg.order.entity.ShopTableOrderStatistic;
|
||||||
|
import com.czg.order.param.TableSummaryParam;
|
||||||
|
import com.czg.order.vo.TableSummaryInfoVo;
|
||||||
|
import com.mybatisflex.core.BaseMapper;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
@ -18,4 +20,5 @@ public interface ShopTableOrderStatisticMapper extends BaseMapper<ShopTableOrder
|
||||||
|
|
||||||
boolean incrInfo(long shopId, long tableId, long count, BigDecimal amount, String dateStr);
|
boolean incrInfo(long shopId, long tableId, long count, BigDecimal amount, String dateStr);
|
||||||
|
|
||||||
|
List<TableSummaryInfoVo> findSummaryList(TableSummaryParam param);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -48,6 +48,8 @@ public class DataSummaryServiceImpl implements DataSummaryService {
|
||||||
if (shopOrderStatistic == null) {
|
if (shopOrderStatistic == null) {
|
||||||
shopOrderStatistic = new ShopOrderStatistic();
|
shopOrderStatistic = new ShopOrderStatistic();
|
||||||
}
|
}
|
||||||
|
shopOrderStatistic.setCustomerUnitPrice(shopOrderStatistic.getCustomerUnitPrice().setScale(2, java.math.RoundingMode.HALF_UP));
|
||||||
|
shopOrderStatistic.setTableTurnoverRate(shopOrderStatistic.getTableTurnoverRate().setScale(2, java.math.RoundingMode.HALF_UP));
|
||||||
return shopOrderStatistic;
|
return shopOrderStatistic;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -13,6 +13,7 @@ import com.mybatisflex.spring.service.impl.ServiceImpl;
|
||||||
import jakarta.annotation.Resource;
|
import jakarta.annotation.Resource;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
import java.time.LocalDate;
|
import java.time.LocalDate;
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
|
@ -93,8 +94,14 @@ public class ShopOrderStatisticServiceImpl extends ServiceImpl<ShopOrderStatisti
|
||||||
statistic = new ShopOrderStatistic();
|
statistic = new ShopOrderStatistic();
|
||||||
statistic.setShopId(shopId);
|
statistic.setShopId(shopId);
|
||||||
statistic.setCreateDay(LocalDate.now());
|
statistic.setCreateDay(LocalDate.now());
|
||||||
statistic.setUpdateTime(LocalDateTime.now());
|
|
||||||
}
|
}
|
||||||
|
//TODO 充值金额
|
||||||
|
statistic.setRechargeAmount(BigDecimal.ZERO);
|
||||||
|
//TODO 客单价
|
||||||
|
statistic.setCustomerUnitPrice(BigDecimal.ZERO);
|
||||||
|
//TODO 翻台率
|
||||||
|
statistic.setTableTurnoverRate(BigDecimal.ZERO);
|
||||||
|
statistic.setUpdateTime(LocalDateTime.now());
|
||||||
BeanUtil.copyProperties(info, statistic);
|
BeanUtil.copyProperties(info, statistic);
|
||||||
saveOrUpdate(statistic);
|
saveOrUpdate(statistic);
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -2,8 +2,9 @@ package com.czg.service.order.service.impl;
|
||||||
|
|
||||||
import com.czg.order.param.TableSummaryParam;
|
import com.czg.order.param.TableSummaryParam;
|
||||||
import com.czg.order.service.TableSummaryService;
|
import com.czg.order.service.TableSummaryService;
|
||||||
import com.czg.order.vo.TableSummaryExportVo;
|
|
||||||
import com.czg.order.vo.TableSummaryInfoVo;
|
import com.czg.order.vo.TableSummaryInfoVo;
|
||||||
|
import com.czg.service.order.mapper.ShopTableOrderStatisticMapper;
|
||||||
|
import jakarta.annotation.Resource;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
@ -17,14 +18,12 @@ import java.util.List;
|
||||||
@Service
|
@Service
|
||||||
public class TableSummaryServiceImpl implements TableSummaryService {
|
public class TableSummaryServiceImpl implements TableSummaryService {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private ShopTableOrderStatisticMapper shopTableOrderStatisticMapper;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<TableSummaryInfoVo> summaryList(TableSummaryParam param) {
|
public List<TableSummaryInfoVo> summaryList(TableSummaryParam param) {
|
||||||
return List.of();
|
return shopTableOrderStatisticMapper.findSummaryList(param);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public List<TableSummaryExportVo> summaryExport(TableSummaryParam param) {
|
|
||||||
return List.of();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -30,12 +30,12 @@
|
||||||
max(update_time) as update_time
|
max(update_time) as update_time
|
||||||
from tb_shop_order_statistic
|
from tb_shop_order_statistic
|
||||||
where shop_id = #{shopId}
|
where shop_id = #{shopId}
|
||||||
<if test="beginTime != null">
|
<if test="beginDate != null and endDate != ''">
|
||||||
and create_day >= str_to_date(#{beginTime}, '%Y-%m-%d')
|
and create_day >= str_to_date(#{beginDate}, '%Y-%m-%d')
|
||||||
</if>
|
</if>
|
||||||
<if test="endTime != null">
|
<if test="endDate != null and endDate != ''">
|
||||||
<![CDATA[
|
<![CDATA[
|
||||||
and create_day <= str_to_date(#{endTime}, '%Y-%m-%d')
|
and create_day <= str_to_date(#{endDate}, '%Y-%m-%d')
|
||||||
]]>
|
]]>
|
||||||
</if>
|
</if>
|
||||||
group by shop_id
|
group by shop_id
|
||||||
|
|
|
||||||
|
|
@ -26,4 +26,26 @@
|
||||||
a.table_id
|
a.table_id
|
||||||
order by a.id desc
|
order by a.id desc
|
||||||
</select>
|
</select>
|
||||||
|
<select id="findSummaryList" resultType="com.czg.order.vo.TableSummaryInfoVo">
|
||||||
|
select
|
||||||
|
t1.table_id,
|
||||||
|
ifnull(t3.name,'N/A') as area_name,
|
||||||
|
ifnull(t2.name,'N/A') as table_name,
|
||||||
|
sum(t1.order_count) as order_count,
|
||||||
|
sum(t1.order_amount) as order_amount,
|
||||||
|
ifnull(sum(t1.refund_count),0) as refund_count,
|
||||||
|
ifnull(sum(t1.refund_amount),0) as refund_amount
|
||||||
|
from tb_shop_table_order_statistic t1
|
||||||
|
left join tb_shop_table t2 on t1.table_id = t2.id
|
||||||
|
left join tb_shop_table_area t3 on t2.area_id = t3.id
|
||||||
|
where t1.shop_id = #{shopId}
|
||||||
|
<if test="beginDate != null and beginDate != ''">
|
||||||
|
AND t1.create_day >= str_to_date(#{beginDate}, '%Y-%m-%d')
|
||||||
|
</if>
|
||||||
|
<if test="endDate != null and endDate != ''">
|
||||||
|
and t2.create_day <= str_to_date(#{endDate}, '%Y-%m-%d')
|
||||||
|
</if>
|
||||||
|
group by t1.table_id
|
||||||
|
order by sum(t1.order_count) desc,max(t1.id) desc
|
||||||
|
</select>
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue