feat:
1. 后台首页统计看板,用户积分,福利积分,现金券,用户积分总产出/消耗 平台线上/线下总消费,每日线上/线下消费新增
This commit is contained in:
5
doc/sql/pending/20260530.sql
Normal file
5
doc/sql/pending/20260530.sql
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
-- 可选:加速正数查询
|
||||||
|
CREATE INDEX idx_user_point_log_amount_positive ON user_point_log (amount) WHERE amount > 0;
|
||||||
|
|
||||||
|
-- 可选:加速负数查询
|
||||||
|
CREATE INDEX idx_user_point_log_amount_negative ON user_point_log (amount) WHERE amount < 0;
|
||||||
@@ -5,6 +5,7 @@ import org.springblade.modules.common.pojo.entity.CommonUserPointLogEntity;
|
|||||||
import org.springblade.modules.common.pojo.vo.CommonUserPointLogVO;
|
import org.springblade.modules.common.pojo.vo.CommonUserPointLogVO;
|
||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
|
import org.springblade.modules.market.pojo.vo.MarketUserPointSummaryVO;
|
||||||
|
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@@ -28,4 +29,7 @@ public interface CommonUserPointLogMapper extends BaseMapper<CommonUserPointLogE
|
|||||||
|
|
||||||
|
|
||||||
List<CommonUserPointLogExcel> exportUserPointLog(String account, Date startTime, Date endTime);
|
List<CommonUserPointLogExcel> exportUserPointLog(String account, Date startTime, Date endTime);
|
||||||
|
|
||||||
|
MarketUserPointSummaryVO userPointSummary();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -49,5 +49,12 @@
|
|||||||
order by upl.id desc
|
order by upl.id desc
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<select id="userPointSummary" resultType="org.springblade.modules.market.pojo.vo.MarketUserPointSummaryVO">
|
||||||
|
SELECT
|
||||||
|
SUM(amount) FILTER (WHERE amount > 0) AS added,
|
||||||
|
ABS(SUM(amount) FILTER (WHERE amount < 0)) AS deducted
|
||||||
|
FROM user_point_log where is_deleted = 0
|
||||||
|
</select>
|
||||||
|
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|||||||
@@ -29,4 +29,7 @@ public interface CommonUserPointMapper extends BaseMapper<CommonUserPointEntity>
|
|||||||
int addUserPoint(Long userId, BigDecimal amount, Integer version);
|
int addUserPoint(Long userId, BigDecimal amount, Integer version);
|
||||||
|
|
||||||
int deductUserPoint(Long userId, BigDecimal amount, Integer version);
|
int deductUserPoint(Long userId, BigDecimal amount, Integer version);
|
||||||
|
|
||||||
|
BigDecimal selectTotal();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -31,6 +31,12 @@
|
|||||||
order by up.id desc
|
order by up.id desc
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<select id="selectTotal" resultType="java.math.BigDecimal">
|
||||||
|
SELECT COALESCE(SUM(amount), 0)
|
||||||
|
FROM user_point
|
||||||
|
where is_deleted = 0
|
||||||
|
</select>
|
||||||
|
|
||||||
<update id="addUserPoint">
|
<update id="addUserPoint">
|
||||||
update
|
update
|
||||||
user_point
|
user_point
|
||||||
|
|||||||
@@ -31,6 +31,7 @@ import org.springblade.modules.common.pojo.entity.CommonUserPointLogEntity;
|
|||||||
import org.springblade.modules.common.pojo.vo.CommonUserPointLogVO;
|
import org.springblade.modules.common.pojo.vo.CommonUserPointLogVO;
|
||||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
import org.springblade.core.mp.base.BaseService;
|
import org.springblade.core.mp.base.BaseService;
|
||||||
|
import org.springblade.modules.market.pojo.vo.MarketUserPointSummaryVO;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@@ -55,4 +56,5 @@ public interface ICommonUserPointLogService extends BaseService<CommonUserPointL
|
|||||||
|
|
||||||
List<CommonUserPointLogExcel> exportUserPointLog(String account, List<String> searchDateRange);
|
List<CommonUserPointLogExcel> exportUserPointLog(String account, List<String> searchDateRange);
|
||||||
|
|
||||||
|
MarketUserPointSummaryVO userPointSummaryByLog();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ import org.springblade.modules.common.pojo.entity.CommonUserPointLogEntity;
|
|||||||
import org.springblade.modules.common.pojo.vo.CommonUserPointVO;
|
import org.springblade.modules.common.pojo.vo.CommonUserPointVO;
|
||||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
import org.springblade.core.mp.base.BaseService;
|
import org.springblade.core.mp.base.BaseService;
|
||||||
|
import org.springblade.modules.market.pojo.vo.MarketUserPointSummaryVO;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@@ -36,4 +37,8 @@ public interface ICommonUserPointService extends BaseService<CommonUserPointEnti
|
|||||||
void spendPointForOrder(CommonUserOrderEntity order);
|
void spendPointForOrder(CommonUserOrderEntity order);
|
||||||
|
|
||||||
List<CommonUserPointLogEntity> queryLogsByUserId(Long userId, Integer size);
|
List<CommonUserPointLogEntity> queryLogsByUserId(Long userId, Integer size);
|
||||||
|
|
||||||
|
BigDecimal selectTotal();
|
||||||
|
|
||||||
|
MarketUserPointSummaryVO userPointSummary();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ import org.springblade.modules.common.pojo.vo.CommonUserPointLogVO;
|
|||||||
import org.springblade.modules.common.mapper.CommonUserPointLogMapper;
|
import org.springblade.modules.common.mapper.CommonUserPointLogMapper;
|
||||||
import org.springblade.modules.common.service.ICommonUserPointLogService;
|
import org.springblade.modules.common.service.ICommonUserPointLogService;
|
||||||
import org.springblade.modules.market.eums.MarketLogType;
|
import org.springblade.modules.market.eums.MarketLogType;
|
||||||
|
import org.springblade.modules.market.pojo.vo.MarketUserPointSummaryVO;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
import org.springblade.core.mp.base.BaseServiceImpl;
|
import org.springblade.core.mp.base.BaseServiceImpl;
|
||||||
@@ -65,5 +66,10 @@ public class CommonUserPointLogServiceImpl extends BaseServiceImpl<CommonUserPoi
|
|||||||
return logExcelList;
|
return logExcelList;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public MarketUserPointSummaryVO userPointSummaryByLog() {
|
||||||
|
return baseMapper.userPointSummary();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,6 +17,7 @@ import org.springblade.modules.common.pojo.vo.CommonUserPointVO;
|
|||||||
import org.springblade.modules.common.mapper.CommonUserPointMapper;
|
import org.springblade.modules.common.mapper.CommonUserPointMapper;
|
||||||
import org.springblade.modules.common.service.ICommonUserPointLogService;
|
import org.springblade.modules.common.service.ICommonUserPointLogService;
|
||||||
import org.springblade.modules.common.service.ICommonUserPointService;
|
import org.springblade.modules.common.service.ICommonUserPointService;
|
||||||
|
import org.springblade.modules.market.pojo.vo.MarketUserPointSummaryVO;
|
||||||
import org.springframework.context.ApplicationEventPublisher;
|
import org.springframework.context.ApplicationEventPublisher;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
@@ -132,5 +133,13 @@ public class CommonUserPointServiceImpl extends BaseServiceImpl<CommonUserPointM
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public BigDecimal selectTotal() {
|
||||||
|
return baseMapper.selectTotal();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public MarketUserPointSummaryVO userPointSummary() {
|
||||||
|
return userPointLogService.userPointSummaryByLog();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -78,6 +78,7 @@ public class MarketInfoController extends BladeController {
|
|||||||
MarketInfoEntity detail = marketInfoService.getOne(Condition.getQueryWrapper(marketInfo));
|
MarketInfoEntity detail = marketInfoService.getOne(Condition.getQueryWrapper(marketInfo));
|
||||||
return R.data(MarketInfoWrapper.build().entityVO(detail));
|
return R.data(MarketInfoWrapper.build().entityVO(detail));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 用户拓展信息表 分页
|
* 用户拓展信息表 分页
|
||||||
*/
|
*/
|
||||||
@@ -192,4 +193,25 @@ public class MarketInfoController extends BladeController {
|
|||||||
return R.data(marketInfoService.userFlowList(id, type));
|
return R.data(marketInfoService.userFlowList(id, type));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@GetMapping("/data-summary")
|
||||||
|
@ApiOperationSupport(order = 15)
|
||||||
|
@Operation(summary = "面板数据统计")
|
||||||
|
public R<MarketDataSummaryVO> dataSummary() {
|
||||||
|
return R.data(marketInfoService.dataSummary());
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/user-point-summary")
|
||||||
|
@ApiOperationSupport(order = 16)
|
||||||
|
@Operation(summary = "面板用户积分数据统计")
|
||||||
|
public R<MarketUserPointSummaryVO> userPointSummary() {
|
||||||
|
return R.data(marketInfoService.userPointSummary());
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/user-order-summary")
|
||||||
|
@ApiOperationSupport(order = 17)
|
||||||
|
@Operation(summary = "面板用户消费数据统计")
|
||||||
|
public R<MarketUserOrderSummaryVO> userOrderSummary() {
|
||||||
|
return R.data(summaryService.userOrderSummary());
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -32,4 +32,5 @@ public interface MarketBenefitPointMapper extends BaseMapper<MarketBenefitPointE
|
|||||||
|
|
||||||
int addBenefitPointBatch(@Param("teamBenefitPointList") List<MarketBenefitPointEntity> teamBenefitPointList);
|
int addBenefitPointBatch(@Param("teamBenefitPointList") List<MarketBenefitPointEntity> teamBenefitPointList);
|
||||||
|
|
||||||
|
BigDecimal selectTotal();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -32,6 +32,12 @@
|
|||||||
|
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<select id="selectTotal" resultType="java.math.BigDecimal">
|
||||||
|
SELECT COALESCE(SUM(amount), 0)
|
||||||
|
FROM benefit_point
|
||||||
|
where is_deleted = 0
|
||||||
|
</select>
|
||||||
|
|
||||||
<update id="addBenefitPoint">
|
<update id="addBenefitPoint">
|
||||||
update
|
update
|
||||||
benefit_point
|
benefit_point
|
||||||
|
|||||||
@@ -29,4 +29,6 @@ public interface MarketCashCouponMapper extends BaseMapper<MarketCashCouponEntit
|
|||||||
int addCashCoupon(Long userId, BigDecimal amount, Integer version);
|
int addCashCoupon(Long userId, BigDecimal amount, Integer version);
|
||||||
|
|
||||||
int deductCashCoupon(Long userId, BigDecimal amount, Integer version);
|
int deductCashCoupon(Long userId, BigDecimal amount, Integer version);
|
||||||
|
|
||||||
|
BigDecimal selectTotal();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -31,6 +31,11 @@
|
|||||||
order by cc.id desc
|
order by cc.id desc
|
||||||
|
|
||||||
</select>
|
</select>
|
||||||
|
<select id="selectTotal" resultType="java.math.BigDecimal">
|
||||||
|
SELECT COALESCE(SUM(amount), 0)
|
||||||
|
FROM cash_coupon
|
||||||
|
where is_deleted = 0
|
||||||
|
</select>
|
||||||
|
|
||||||
<update id="addCashCoupon">
|
<update id="addCashCoupon">
|
||||||
update
|
update
|
||||||
|
|||||||
@@ -60,4 +60,6 @@ public interface MarketInfoMapper extends BaseMapper<MarketInfoEntity> {
|
|||||||
MarketDirectInfoApiVO selectParent(Long pid);
|
MarketDirectInfoApiVO selectParent(Long pid);
|
||||||
|
|
||||||
List<Long> selectIdsByPid(Long pid);
|
List<Long> selectIdsByPid(Long pid);
|
||||||
|
|
||||||
|
List<Long> selectTopUsersIds();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -96,4 +96,9 @@
|
|||||||
from user_market_info where is_deleted = 0 and pid = #{pid}
|
from user_market_info where is_deleted = 0 and pid = #{pid}
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<select id="selectTopUsersIds" resultType="java.lang.Long">
|
||||||
|
select id
|
||||||
|
from user_market_info where is_deleted = 0 and pid is null
|
||||||
|
</select>
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|||||||
@@ -52,4 +52,6 @@ public interface MarketUserCommissionMapper extends BaseMapper<MarketUserCommiss
|
|||||||
|
|
||||||
|
|
||||||
int addUserCommission(Long userId, BigDecimal amount, Integer version);
|
int addUserCommission(Long userId, BigDecimal amount, Integer version);
|
||||||
|
|
||||||
|
BigDecimal selectTotal();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -30,6 +30,12 @@
|
|||||||
order by uc.id desc
|
order by uc.id desc
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<select id="selectTotal" resultType="java.math.BigDecimal">
|
||||||
|
SELECT COALESCE(SUM(amount), 0)
|
||||||
|
FROM user_commission
|
||||||
|
where is_deleted = 0
|
||||||
|
</select>
|
||||||
|
|
||||||
<update id="addUserCommission">
|
<update id="addUserCommission">
|
||||||
update
|
update
|
||||||
user_commission
|
user_commission
|
||||||
|
|||||||
@@ -0,0 +1,23 @@
|
|||||||
|
package org.springblade.modules.market.pojo.vo;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.io.Serial;
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class MarketDataSummaryVO implements Serializable {
|
||||||
|
|
||||||
|
@Serial
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
private BigDecimal userPoints;
|
||||||
|
|
||||||
|
private BigDecimal benefitPoints;
|
||||||
|
|
||||||
|
private BigDecimal cashCoupons;
|
||||||
|
|
||||||
|
private BigDecimal commissions;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,27 @@
|
|||||||
|
package org.springblade.modules.market.pojo.vo;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.io.Serial;
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class MarketUserOrderSummaryVO implements Serializable {
|
||||||
|
|
||||||
|
@Serial
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
private BigDecimal onlineTotal;
|
||||||
|
|
||||||
|
private BigDecimal offlineTotal;
|
||||||
|
|
||||||
|
private BigDecimal otherTotal;
|
||||||
|
|
||||||
|
private BigDecimal increaseOnline;
|
||||||
|
|
||||||
|
private BigDecimal increaseOffline;
|
||||||
|
|
||||||
|
private BigDecimal increaseOther;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
package org.springblade.modules.market.pojo.vo;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.io.Serial;
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class MarketUserPointSummaryVO implements Serializable {
|
||||||
|
|
||||||
|
@Serial
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
private BigDecimal added;
|
||||||
|
|
||||||
|
private BigDecimal deducted;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -54,5 +54,5 @@ public interface IMarketBenefitPointService extends BaseService<MarketBenefitPoi
|
|||||||
|
|
||||||
List<MarketBenefitPointLogEntity> queryLogsByUserId(Long userId, Integer size);
|
List<MarketBenefitPointLogEntity> queryLogsByUserId(Long userId, Integer size);
|
||||||
|
|
||||||
|
BigDecimal selectTotal();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ import org.springblade.modules.market.pojo.vo.MarketCashCouponVO;
|
|||||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
import org.springblade.core.mp.base.BaseService;
|
import org.springblade.core.mp.base.BaseService;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -47,4 +48,5 @@ public interface IMarketCashCouponService extends BaseService<MarketCashCouponEn
|
|||||||
List<MarketCashCouponLogEntity> queryLogsByUserId(Long userId, Integer size);
|
List<MarketCashCouponLogEntity> queryLogsByUserId(Long userId, Integer size);
|
||||||
|
|
||||||
|
|
||||||
|
BigDecimal selectTotal();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -33,6 +33,8 @@ import org.springblade.modules.market.pojo.vo.MarketDailySummaryVO;
|
|||||||
import org.springblade.modules.market.excel.MarketDailySummaryExcel;
|
import org.springblade.modules.market.excel.MarketDailySummaryExcel;
|
||||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
import org.springblade.core.mp.base.BaseService;
|
import org.springblade.core.mp.base.BaseService;
|
||||||
|
import org.springblade.modules.market.pojo.vo.MarketUserOrderSummaryVO;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -58,4 +60,7 @@ public interface IMarketDailySummaryService extends BaseService<MarketDailySumma
|
|||||||
List<MarketDailySummaryEntity> selectListByUserId(Long userId);
|
List<MarketDailySummaryEntity> selectListByUserId(Long userId);
|
||||||
|
|
||||||
MarketKPIApiVO userSelfKpi(Long userId);
|
MarketKPIApiVO userSelfKpi(Long userId);
|
||||||
|
|
||||||
|
MarketUserOrderSummaryVO userOrderSummary();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -28,10 +28,12 @@ package org.springblade.modules.market.service;
|
|||||||
import org.springblade.modules.api.vo.MarketDirectInfoApiVO;
|
import org.springblade.modules.api.vo.MarketDirectInfoApiVO;
|
||||||
import org.springblade.modules.market.pojo.dto.MarketInfoSummaryDTO;
|
import org.springblade.modules.market.pojo.dto.MarketInfoSummaryDTO;
|
||||||
import org.springblade.modules.market.pojo.entity.MarketInfoEntity;
|
import org.springblade.modules.market.pojo.entity.MarketInfoEntity;
|
||||||
|
import org.springblade.modules.market.pojo.vo.MarketDataSummaryVO;
|
||||||
import org.springblade.modules.market.pojo.vo.MarketInfoVO;
|
import org.springblade.modules.market.pojo.vo.MarketInfoVO;
|
||||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
import org.springblade.core.mp.base.BaseService;
|
import org.springblade.core.mp.base.BaseService;
|
||||||
import org.springblade.modules.market.pojo.vo.MarketUserFlowVO;
|
import org.springblade.modules.market.pojo.vo.MarketUserFlowVO;
|
||||||
|
import org.springblade.modules.market.pojo.vo.MarketUserPointSummaryVO;
|
||||||
import org.springblade.modules.system.pojo.entity.User;
|
import org.springblade.modules.system.pojo.entity.User;
|
||||||
|
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
@@ -70,4 +72,10 @@ public interface IMarketInfoService extends BaseService<MarketInfoEntity> {
|
|||||||
List<Long> selectIdsByPid(Long pid);
|
List<Long> selectIdsByPid(Long pid);
|
||||||
|
|
||||||
List<MarketUserFlowVO> userFlowList(Long id, Integer type);
|
List<MarketUserFlowVO> userFlowList(Long id, Integer type);
|
||||||
|
|
||||||
|
MarketDataSummaryVO dataSummary();
|
||||||
|
|
||||||
|
MarketUserPointSummaryVO userPointSummary();
|
||||||
|
|
||||||
|
List<Long> selectTopUsersIds();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -32,6 +32,7 @@ import org.springblade.modules.market.pojo.vo.MarketUserCommissionVO;
|
|||||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
import org.springblade.core.mp.base.BaseService;
|
import org.springblade.core.mp.base.BaseService;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -54,4 +55,7 @@ public interface IMarketUserCommissionService extends BaseService<MarketUserComm
|
|||||||
void earnedCommissionByUserOrder(CommonUserOrderEntity order, Long userId);
|
void earnedCommissionByUserOrder(CommonUserOrderEntity order, Long userId);
|
||||||
|
|
||||||
List<MarketUserCommissionLogEntity> queryLogsByUserId(Long userId, Integer size);
|
List<MarketUserCommissionLogEntity> queryLogsByUserId(Long userId, Integer size);
|
||||||
|
|
||||||
|
BigDecimal selectTotal();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -199,7 +199,8 @@ public class MarketBenefitPointServiceImpl extends BaseServiceImpl<MarketBenefit
|
|||||||
throw new RuntimeException("请稍后重试");
|
throw new RuntimeException("请稍后重试");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public BigDecimal selectTotal() {
|
||||||
|
return baseMapper.selectTotal();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -123,5 +123,10 @@ public class MarketCashCouponServiceImpl extends BaseServiceImpl<MarketCashCoupo
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public BigDecimal selectTotal() {
|
||||||
|
return baseMapper.selectTotal();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -25,6 +25,7 @@
|
|||||||
*/
|
*/
|
||||||
package org.springblade.modules.market.service.impl;
|
package org.springblade.modules.market.service.impl;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
@@ -40,6 +41,7 @@ import org.springblade.modules.market.pojo.entity.MarketInfoEntity;
|
|||||||
import org.springblade.modules.market.pojo.vo.MarketDailySummaryVO;
|
import org.springblade.modules.market.pojo.vo.MarketDailySummaryVO;
|
||||||
import org.springblade.modules.market.excel.MarketDailySummaryExcel;
|
import org.springblade.modules.market.excel.MarketDailySummaryExcel;
|
||||||
import org.springblade.modules.market.mapper.MarketDailySummaryMapper;
|
import org.springblade.modules.market.mapper.MarketDailySummaryMapper;
|
||||||
|
import org.springblade.modules.market.pojo.vo.MarketUserOrderSummaryVO;
|
||||||
import org.springblade.modules.market.service.IMarketDailySummaryService;
|
import org.springblade.modules.market.service.IMarketDailySummaryService;
|
||||||
import org.springblade.modules.market.service.IMarketInfoService;
|
import org.springblade.modules.market.service.IMarketInfoService;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
@@ -48,6 +50,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
|
|||||||
import org.springblade.core.mp.base.BaseServiceImpl;
|
import org.springblade.core.mp.base.BaseServiceImpl;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@@ -146,6 +149,36 @@ public class MarketDailySummaryServiceImpl extends BaseServiceImpl<MarketDailySu
|
|||||||
return vo;
|
return vo;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public MarketUserOrderSummaryVO userOrderSummary() {
|
||||||
|
List<Long> ids = marketInfoService.selectTopUsersIds();
|
||||||
|
MarketUserOrderSummaryVO vo = new MarketUserOrderSummaryVO();
|
||||||
|
MarketDailySummaryEntity summary = getOne(Wrappers.lambdaQuery(MarketDailySummaryEntity.class).eq(MarketDailySummaryEntity::getIsDeleted, 0).orderByDesc(MarketDailySummaryEntity::getId).last("limit 1"));
|
||||||
|
List<MarketDailySummaryEntity> list = list(Wrappers.lambdaQuery(MarketDailySummaryEntity.class).eq(MarketDailySummaryEntity::getIsDeleted, 0).eq(MarketDailySummaryEntity::getStatDate, summary.getStatDate()).in(MarketDailySummaryEntity::getUserId, ids));
|
||||||
|
BigDecimal onlineTotal = BigDecimal.ZERO;
|
||||||
|
BigDecimal offlineTotal = BigDecimal.ZERO;
|
||||||
|
BigDecimal otherTotal = BigDecimal.ZERO;
|
||||||
|
BigDecimal increaseOnline = BigDecimal.ZERO;
|
||||||
|
BigDecimal increaseOffline = BigDecimal.ZERO;
|
||||||
|
BigDecimal increaseOther = BigDecimal.ZERO;
|
||||||
|
|
||||||
|
for (MarketDailySummaryEntity m : list) {
|
||||||
|
onlineTotal = onlineTotal.add(m.getPersonalOnlineAmount()).add(m.getTeamOnlineAmount());
|
||||||
|
offlineTotal = offlineTotal.add(m.getPersonalOfflineAmount()).add(m.getTeamOfflineAmount());
|
||||||
|
otherTotal = otherTotal.add(m.getPersonalOtherAmount()).add(m.getTeamOtherAmount());
|
||||||
|
increaseOnline = increaseOnline.add(m.getPersonalIncreaseOnlineAmount()).add(m.getTeamIncreaseOnlineAmount());
|
||||||
|
increaseOffline = increaseOffline.add(m.getPersonalIncreaseOfflineAmount()).add(m.getTeamIncreaseOfflineAmount());
|
||||||
|
increaseOther = increaseOther.add(m.getPersonalIncreaseOtherAmount()).add(m.getTeamIncreaseOtherAmount());
|
||||||
|
}
|
||||||
|
vo.setOnlineTotal(onlineTotal);
|
||||||
|
vo.setOfflineTotal(offlineTotal);
|
||||||
|
vo.setOtherTotal(otherTotal);
|
||||||
|
vo.setIncreaseOnline(increaseOnline);
|
||||||
|
vo.setIncreaseOffline(increaseOffline);
|
||||||
|
vo.setIncreaseOther(increaseOther);
|
||||||
|
return vo;
|
||||||
|
}
|
||||||
|
|
||||||
private String desensitizationByName(String name) {
|
private String desensitizationByName(String name) {
|
||||||
return name.replaceAll("^(.).*$", "$1" + "*".repeat(name.length() - 1));
|
return name.replaceAll("^(.).*$", "$1" + "*".repeat(name.length() - 1));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -51,9 +51,11 @@ import org.springblade.modules.common.service.ICommonUserPointService;
|
|||||||
import org.springblade.modules.market.eums.UserFlowType;
|
import org.springblade.modules.market.eums.UserFlowType;
|
||||||
import org.springblade.modules.market.pojo.dto.MarketInfoSummaryDTO;
|
import org.springblade.modules.market.pojo.dto.MarketInfoSummaryDTO;
|
||||||
import org.springblade.modules.market.pojo.entity.*;
|
import org.springblade.modules.market.pojo.entity.*;
|
||||||
|
import org.springblade.modules.market.pojo.vo.MarketDataSummaryVO;
|
||||||
import org.springblade.modules.market.pojo.vo.MarketInfoVO;
|
import org.springblade.modules.market.pojo.vo.MarketInfoVO;
|
||||||
import org.springblade.modules.market.mapper.MarketInfoMapper;
|
import org.springblade.modules.market.mapper.MarketInfoMapper;
|
||||||
import org.springblade.modules.market.pojo.vo.MarketUserFlowVO;
|
import org.springblade.modules.market.pojo.vo.MarketUserFlowVO;
|
||||||
|
import org.springblade.modules.market.pojo.vo.MarketUserPointSummaryVO;
|
||||||
import org.springblade.modules.market.service.*;
|
import org.springblade.modules.market.service.*;
|
||||||
import org.springblade.modules.system.pojo.entity.User;
|
import org.springblade.modules.system.pojo.entity.User;
|
||||||
import org.springblade.modules.system.service.IUserService;
|
import org.springblade.modules.system.service.IUserService;
|
||||||
@@ -63,6 +65,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
|
|||||||
import org.springblade.core.mp.base.BaseServiceImpl;
|
import org.springblade.core.mp.base.BaseServiceImpl;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
@@ -251,5 +254,23 @@ public class MarketInfoServiceImpl extends BaseServiceImpl<MarketInfoMapper, Mar
|
|||||||
return voList;
|
return voList;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public MarketDataSummaryVO dataSummary() {
|
||||||
|
MarketDataSummaryVO vo = new MarketDataSummaryVO();
|
||||||
|
vo.setUserPoints(userPointService.selectTotal());
|
||||||
|
vo.setBenefitPoints(benefitPointService.selectTotal());
|
||||||
|
vo.setCashCoupons(cashCouponService.selectTotal());
|
||||||
|
vo.setCommissions(commissionService.selectTotal());
|
||||||
|
return vo;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public MarketUserPointSummaryVO userPointSummary() {
|
||||||
|
return userPointService.userPointSummary();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<Long> selectTopUsersIds() {
|
||||||
|
return baseMapper.selectTopUsersIds();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -101,6 +101,9 @@ public class MarketUserCommissionServiceImpl extends BaseServiceImpl<MarketUserC
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public BigDecimal selectTotal() {
|
||||||
|
return baseMapper.selectTotal();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user