数据统计
This commit is contained in:
parent
1c6055dd7c
commit
577f370cb4
|
|
@ -15,7 +15,7 @@ import java.time.LocalDate;
|
|||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* 实体类。
|
||||
* 实体类。
|
||||
*
|
||||
* @author zs
|
||||
* @since 2025-03-07
|
||||
|
|
@ -133,14 +133,19 @@ public class ShopOrderStatistic implements Serializable {
|
|||
* 翻台率
|
||||
*/
|
||||
private BigDecimal tableTurnoverRate = BigDecimal.ZERO;
|
||||
/**
|
||||
* 新增会员数
|
||||
*/
|
||||
private Long newMemberCount = 0L;
|
||||
/**
|
||||
* 店铺id
|
||||
*/
|
||||
@JSONField(serialize = false)
|
||||
private Long shopId;
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@JSONField(format = "yyyy-MM-dd")
|
||||
@JSONField(serialize = false, format = "yyyy-MM-dd")
|
||||
private LocalDate createDay;
|
||||
/**
|
||||
* 最近一次统计时间
|
||||
|
|
|
|||
|
|
@ -13,5 +13,6 @@ import com.mybatisflex.core.BaseMapper;
|
|||
public interface ShopOrderStatisticMapper extends BaseMapper<ShopOrderStatistic> {
|
||||
|
||||
ShopOrderStatistic getTradeData(DataSummaryTradeParam param);
|
||||
long getNewMemberCount(DataSummaryTradeParam param);
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -50,6 +50,8 @@ public class DataSummaryServiceImpl implements DataSummaryService {
|
|||
}
|
||||
shopOrderStatistic.setCustomerUnitPrice(shopOrderStatistic.getCustomerUnitPrice().setScale(2, java.math.RoundingMode.HALF_UP));
|
||||
shopOrderStatistic.setTableTurnoverRate(shopOrderStatistic.getTableTurnoverRate().setScale(2, java.math.RoundingMode.HALF_UP));
|
||||
long newMemberCount = shopOrderStatisticMapper.getNewMemberCount(param);
|
||||
shopOrderStatistic.setNewMemberCount(newMemberCount);
|
||||
return shopOrderStatistic;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -3,7 +3,6 @@
|
|||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.czg.service.order.mapper.ShopOrderStatisticMapper">
|
||||
|
||||
<select id="getTradeData" resultType="com.czg.order.entity.ShopOrderStatistic">
|
||||
select
|
||||
sum(sale_amount) as sale_amount,
|
||||
|
|
@ -30,7 +29,7 @@
|
|||
max(update_time) as update_time
|
||||
from tb_shop_order_statistic
|
||||
where shop_id = #{shopId}
|
||||
<if test="beginDate != null and endDate != ''">
|
||||
<if test="beginDate != null and beginDate != ''">
|
||||
and create_day >= str_to_date(#{beginDate}, '%Y-%m-%d')
|
||||
</if>
|
||||
<if test="endDate != null and endDate != ''">
|
||||
|
|
@ -40,4 +39,15 @@
|
|||
</if>
|
||||
group by shop_id
|
||||
</select>
|
||||
<select id="getNewMemberCount" resultType="java.lang.Long">
|
||||
select count(1) from tb_shop_user where shop_id = #{shopId}
|
||||
<if test="beginDate != null and beginDate != ''">
|
||||
and create_time >= str_to_date(concat(#{beginDate},' 00:00:00'), '%Y-%m-%d %H:%i:%s')
|
||||
</if>
|
||||
<if test="endDate != null and endDate != ''">
|
||||
<![CDATA[
|
||||
and create_time <= str_to_date(concat(#{endDate},' 23:59:59'), '%Y-%m-%d %H:%i:%s')
|
||||
]]>
|
||||
</if>
|
||||
</select>
|
||||
</mapper>
|
||||
|
|
|
|||
Loading…
Reference in New Issue