更新统计数据
This commit is contained in:
parent
8f05d5882f
commit
957d8494a6
1
.vscode/settings.json
vendored
1
.vscode/settings.json
vendored
|
@ -1,5 +1,4 @@
|
|||
{
|
||||
"java.compile.nullAnalysis.mode": "automatic",
|
||||
"java.configuration.updateBuildConfiguration": "interactive",
|
||||
"java.format.settings.url": "eclipse-formatter.xml"
|
||||
}
|
|
@ -1,7 +1,10 @@
|
|||
package com.ruoyi.bst.model.domain;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.util.List;
|
||||
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
|
@ -13,4 +16,9 @@ public class ModelQuery extends ModelVO {
|
|||
|
||||
@ApiModelProperty("关键词")
|
||||
private String keyword;
|
||||
|
||||
@ApiModelProperty("创建日期范围")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd")
|
||||
private List<LocalDate> createDateRange;
|
||||
|
||||
}
|
||||
|
|
|
@ -42,6 +42,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
#{item}
|
||||
</foreach>
|
||||
</if>
|
||||
<if test="query.createDateRange != null and query.createDateRange.size() >= 2">
|
||||
and date(bm.create_time) >= #{query.createDateRange[0]}
|
||||
and date(bm.create_time) <= #{query.createDateRange[1]}
|
||||
</if>
|
||||
<if test="query.keyword != null and query.keyword != ''">
|
||||
and (
|
||||
bm.name like concat('%', #{query.keyword}, '%')
|
||||
|
|
|
@ -13,5 +13,12 @@ public interface ModelDashboard {
|
|||
* @return
|
||||
*/
|
||||
ModelStatVO selectStat(ModelQuery query, List<String> keys);
|
||||
|
||||
/**
|
||||
* 查询型号数量
|
||||
* @param modelQuery
|
||||
* @return
|
||||
*/
|
||||
Integer selectCount(ModelQuery modelQuery);
|
||||
|
||||
}
|
||||
|
|
|
@ -22,9 +22,14 @@ public class ModelDashboardImpl implements ModelDashboard {
|
|||
public ModelStatVO selectStat(ModelQuery query, List<String> keys) {
|
||||
ModelStatVO vo = new ModelStatVO();
|
||||
if (keys.contains(StatKeys.MODEL_COUNT)) {
|
||||
vo.setCount(MathUtils.dv(modelMapper.selectCount(query)));
|
||||
vo.setCount(this.selectCount(query));
|
||||
}
|
||||
return vo;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer selectCount(ModelQuery query) {
|
||||
return MathUtils.dv(modelMapper.selectCount(query));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,30 @@
|
|||
package com.ruoyi.bst.snapshot.domain;
|
||||
|
||||
import com.ruoyi.common.annotation.Excel;
|
||||
import com.ruoyi.common.core.domain.BaseEntity;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 快照对象 bst_snapshot
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2025-05-08
|
||||
*/
|
||||
@Data
|
||||
public class Snapshot extends BaseEntity
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private Long id;
|
||||
|
||||
@Excel(name = "类型")
|
||||
@ApiModelProperty("类型")
|
||||
private String type;
|
||||
|
||||
@Excel(name = "值")
|
||||
@ApiModelProperty("值")
|
||||
private String value;
|
||||
|
||||
}
|
|
@ -0,0 +1,18 @@
|
|||
package com.ruoyi.bst.snapshot.domain;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.util.List;
|
||||
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class SnapshotQuery extends SnapshotVO {
|
||||
|
||||
@ApiModelProperty("创建日期范围")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd")
|
||||
private List<LocalDate> createDateRange;
|
||||
|
||||
}
|
|
@ -0,0 +1,9 @@
|
|||
package com.ruoyi.bst.snapshot.domain;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class SnapshotVO extends Snapshot {
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,15 @@
|
|||
package com.ruoyi.bst.snapshot.domain.enums;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
@Getter
|
||||
@AllArgsConstructor
|
||||
public enum SnapshotType {
|
||||
|
||||
USER_BALANCE("user_balance", "用户余额");
|
||||
|
||||
private String code;
|
||||
private String name;
|
||||
|
||||
}
|
|
@ -0,0 +1,17 @@
|
|||
package com.ruoyi.bst.snapshot.domain.vo;
|
||||
|
||||
import java.time.LocalDate;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class SnapshotDateVO {
|
||||
|
||||
@ApiModelProperty("日期")
|
||||
private LocalDate date;
|
||||
|
||||
@ApiModelProperty("值")
|
||||
private String value;
|
||||
|
||||
}
|
|
@ -0,0 +1,84 @@
|
|||
package com.ruoyi.bst.snapshot.mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import com.ruoyi.bst.snapshot.domain.Snapshot;
|
||||
import com.ruoyi.bst.snapshot.domain.SnapshotQuery;
|
||||
import com.ruoyi.bst.snapshot.domain.SnapshotVO;
|
||||
import com.ruoyi.bst.snapshot.domain.vo.SnapshotDateVO;
|
||||
|
||||
/**
|
||||
* 快照Mapper接口
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2025-05-08
|
||||
*/
|
||||
public interface SnapshotMapper
|
||||
{
|
||||
/**
|
||||
* 查询快照
|
||||
*
|
||||
* @param id 快照主键
|
||||
* @return 快照
|
||||
*/
|
||||
SnapshotVO selectSnapshotById(Long id);
|
||||
|
||||
/**
|
||||
* 查询快照列表
|
||||
*
|
||||
* @param query 快照
|
||||
* @return 快照集合
|
||||
*/
|
||||
List<SnapshotVO> selectSnapshotList(@Param("query")SnapshotQuery query);
|
||||
|
||||
/**
|
||||
* 新增快照
|
||||
*
|
||||
* @param snapshot 快照
|
||||
* @return 结果
|
||||
*/
|
||||
int insertSnapshot(Snapshot snapshot);
|
||||
|
||||
/**
|
||||
* 批量新增快照
|
||||
*/
|
||||
int batchInsert(@Param("list") List<? extends Snapshot> list);
|
||||
|
||||
/**
|
||||
* 批量修改快照
|
||||
*/
|
||||
int batchUpdate(@Param("list") List<? extends Snapshot> list);
|
||||
|
||||
/**
|
||||
* 修改快照
|
||||
*
|
||||
* @param snapshot 快照
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateSnapshot(@Param("data") Snapshot snapshot);
|
||||
|
||||
/**
|
||||
* 删除快照
|
||||
*
|
||||
* @param id 快照主键
|
||||
* @return 结果
|
||||
*/
|
||||
int deleteSnapshotById(Long id);
|
||||
|
||||
/**
|
||||
* 批量删除快照
|
||||
*
|
||||
* @param ids 需要删除的数据主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteSnapshotByIds(Long[] ids);
|
||||
|
||||
/**
|
||||
* 查询日期快照
|
||||
* @param query
|
||||
* @return
|
||||
*/
|
||||
List<SnapshotDateVO> selectSimpleForDate(@Param("query") SnapshotQuery query);
|
||||
}
|
|
@ -0,0 +1,161 @@
|
|||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.ruoyi.bst.snapshot.mapper.SnapshotMapper">
|
||||
|
||||
<resultMap type="SnapshotVO" id="SnapshotResult" autoMapping="true"/>
|
||||
|
||||
<sql id="selectSnapshotVo">
|
||||
select
|
||||
bs.id,
|
||||
bs.create_time,
|
||||
bs.type,
|
||||
bs.value
|
||||
from bst_snapshot bs
|
||||
</sql>
|
||||
|
||||
<sql id="searchCondition">
|
||||
<if test="query.type != null and query.type != ''"> and bs.type = #{query.type}</if>
|
||||
${query.params.dataScope}
|
||||
</sql>
|
||||
|
||||
<select id="selectSnapshotList" parameterType="SnapshotQuery" resultMap="SnapshotResult">
|
||||
<include refid="selectSnapshotVo"/>
|
||||
<where>
|
||||
<include refid="searchCondition"/>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="selectSnapshotById" parameterType="Long" resultMap="SnapshotResult">
|
||||
<include refid="selectSnapshotVo"/>
|
||||
where bs.id = #{id}
|
||||
</select>
|
||||
|
||||
<insert id="insertSnapshot" parameterType="Snapshot" useGeneratedKeys="true" keyProperty="id">
|
||||
insert into bst_snapshot
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="id != null">id,</if>
|
||||
<if test="createTime != null">create_time,</if>
|
||||
<if test="type != null and type != ''">type,</if>
|
||||
<if test="value != null and value != ''">value,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="id != null">#{id},</if>
|
||||
<if test="createTime != null">#{createTime},</if>
|
||||
<if test="type != null and type != ''">#{type},</if>
|
||||
<if test="value != null and value != ''">#{value},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<insert id="batchInsert" parameterType="Snapshot">
|
||||
insert into bst_snapshot
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
id,
|
||||
create_time,
|
||||
type,
|
||||
value,
|
||||
</trim>
|
||||
values
|
||||
<foreach collection="list" item="i" separator=",">
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="i.id != null ">#{i.id},</if>
|
||||
<if test="i.id == null ">default,</if>
|
||||
<if test="i.createTime != null ">#{i.createTime},</if>
|
||||
<if test="i.createTime == null ">default,</if>
|
||||
<if test="i.type != null and i.type != ''">#{i.type},</if>
|
||||
<if test="i.type == null or i.type == ''">default,</if>
|
||||
<if test="i.value != null and i.value != ''">#{i.value},</if>
|
||||
<if test="i.value == null or i.value == ''">default,</if>
|
||||
</trim>
|
||||
</foreach>
|
||||
</insert>
|
||||
|
||||
<update id="batchUpdate">
|
||||
update bst_snapshot
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<foreach open="id = CASE id" collection="list" item="item" close="END,">
|
||||
<choose>
|
||||
<when test="item.id != null ">
|
||||
WHEN #{item.id} THEN #{item.id}
|
||||
</when>
|
||||
<otherwise>
|
||||
WHEN #{item.id} THEN `id`
|
||||
</otherwise>
|
||||
</choose>
|
||||
</foreach>
|
||||
<foreach open="create_time = CASE id" collection="list" item="item" close="END,">
|
||||
<choose>
|
||||
<when test="item.createTime != null ">
|
||||
WHEN #{item.id} THEN #{item.createTime}
|
||||
</when>
|
||||
<otherwise>
|
||||
WHEN #{item.id} THEN `create_time`
|
||||
</otherwise>
|
||||
</choose>
|
||||
</foreach>
|
||||
<foreach open="type = CASE id" collection="list" item="item" close="END,">
|
||||
<choose>
|
||||
<when test="item.type != null and item.type != ''">
|
||||
WHEN #{item.id} THEN #{item.type}
|
||||
</when>
|
||||
<otherwise>
|
||||
WHEN #{item.id} THEN `type`
|
||||
</otherwise>
|
||||
</choose>
|
||||
</foreach>
|
||||
<foreach open="value = CASE id" collection="list" item="item" close="END,">
|
||||
<choose>
|
||||
<when test="item.value != null and item.value != ''">
|
||||
WHEN #{item.id} THEN #{item.value}
|
||||
</when>
|
||||
<otherwise>
|
||||
WHEN #{item.id} THEN `value`
|
||||
</otherwise>
|
||||
</choose>
|
||||
</foreach>
|
||||
</trim>
|
||||
where id in
|
||||
<foreach item="item" collection="list" open="(" separator="," close=")">
|
||||
#{item.id}
|
||||
</foreach>
|
||||
</update>
|
||||
|
||||
<update id="updateSnapshot" parameterType="Snapshot">
|
||||
update bst_snapshot
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<include refid="updateColumns"/>
|
||||
</trim>
|
||||
where id = #{data.id}
|
||||
</update>
|
||||
|
||||
<sql id="updateColumns">
|
||||
<if test="data.createTime != null">create_time = #{data.createTime},</if>
|
||||
<if test="data.type != null and data.type != ''">type = #{data.type},</if>
|
||||
<if test="data.value != null and data.value != ''">value = #{data.value},</if>
|
||||
</sql>
|
||||
|
||||
<delete id="deleteSnapshotById" parameterType="Long">
|
||||
delete from bst_snapshot where id = #{id}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteSnapshotByIds" parameterType="String">
|
||||
delete from bst_snapshot where id in
|
||||
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
|
||||
<!-- selectSimpleForDate -->
|
||||
|
||||
<select id="selectSimpleForDate" parameterType="SnapshotQuery" resultType="SnapshotDateVO">
|
||||
select
|
||||
date(bs.create_time) as `date`,
|
||||
bs.value
|
||||
from bst_snapshot bs
|
||||
<where>
|
||||
<include refid="searchCondition"/>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
</mapper>
|
|
@ -0,0 +1,81 @@
|
|||
package com.ruoyi.bst.snapshot.service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.ruoyi.bst.snapshot.domain.Snapshot;
|
||||
import com.ruoyi.bst.snapshot.domain.SnapshotQuery;
|
||||
import com.ruoyi.bst.snapshot.domain.SnapshotVO;
|
||||
import com.ruoyi.bst.snapshot.domain.enums.SnapshotType;
|
||||
import com.ruoyi.bst.snapshot.domain.vo.SnapshotDateVO;
|
||||
|
||||
/**
|
||||
* 快照Service接口
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2025-05-08
|
||||
*/
|
||||
public interface SnapshotService
|
||||
{
|
||||
/**
|
||||
* 查询快照
|
||||
*
|
||||
* @param id 快照主键
|
||||
* @return 快照
|
||||
*/
|
||||
public SnapshotVO selectSnapshotById(Long id);
|
||||
|
||||
/**
|
||||
* 查询快照列表
|
||||
*
|
||||
* @param snapshot 快照
|
||||
* @return 快照集合
|
||||
*/
|
||||
public List<SnapshotVO> selectSnapshotList(SnapshotQuery snapshot);
|
||||
|
||||
/**
|
||||
* 新增快照
|
||||
*
|
||||
* @param snapshot 快照
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertSnapshot(Snapshot snapshot);
|
||||
|
||||
/**
|
||||
* 修改快照
|
||||
*
|
||||
* @param snapshot 快照
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateSnapshot(Snapshot snapshot);
|
||||
|
||||
/**
|
||||
* 批量删除快照
|
||||
*
|
||||
* @param ids 需要删除的快照主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteSnapshotByIds(Long[] ids);
|
||||
|
||||
/**
|
||||
* 删除快照信息
|
||||
*
|
||||
* @param id 快照主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteSnapshotById(Long id);
|
||||
|
||||
/**
|
||||
* 记录值
|
||||
* @param type
|
||||
* @param value
|
||||
* @return
|
||||
*/
|
||||
public int record(SnapshotType type, String value);
|
||||
|
||||
/**
|
||||
* 查询日期快照
|
||||
* @param query
|
||||
* @return
|
||||
*/
|
||||
public List<SnapshotDateVO> selectSimpleForDate(SnapshotQuery query);
|
||||
}
|
|
@ -0,0 +1,117 @@
|
|||
package com.ruoyi.bst.snapshot.service.impl;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import com.ruoyi.bst.snapshot.domain.Snapshot;
|
||||
import com.ruoyi.bst.snapshot.domain.SnapshotQuery;
|
||||
import com.ruoyi.bst.snapshot.domain.SnapshotVO;
|
||||
import com.ruoyi.bst.snapshot.domain.enums.SnapshotType;
|
||||
import com.ruoyi.bst.snapshot.domain.vo.SnapshotDateVO;
|
||||
import com.ruoyi.bst.snapshot.mapper.SnapshotMapper;
|
||||
import com.ruoyi.bst.snapshot.service.SnapshotService;
|
||||
import com.ruoyi.common.utils.DateUtils;
|
||||
|
||||
/**
|
||||
* 快照Service业务层处理
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2025-05-08
|
||||
*/
|
||||
@Service
|
||||
public class SnapshotServiceImpl implements SnapshotService
|
||||
{
|
||||
@Autowired
|
||||
private SnapshotMapper snapshotMapper;
|
||||
|
||||
/**
|
||||
* 查询快照
|
||||
*
|
||||
* @param id 快照主键
|
||||
* @return 快照
|
||||
*/
|
||||
@Override
|
||||
public SnapshotVO selectSnapshotById(Long id)
|
||||
{
|
||||
return snapshotMapper.selectSnapshotById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询快照列表
|
||||
*
|
||||
* @param snapshot 快照
|
||||
* @return 快照
|
||||
*/
|
||||
@Override
|
||||
public List<SnapshotVO> selectSnapshotList(SnapshotQuery snapshot)
|
||||
{
|
||||
return snapshotMapper.selectSnapshotList(snapshot);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增快照
|
||||
*
|
||||
* @param snapshot 快照
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int insertSnapshot(Snapshot snapshot)
|
||||
{
|
||||
snapshot.setCreateTime(DateUtils.getNowDate());
|
||||
return snapshotMapper.insertSnapshot(snapshot);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改快照
|
||||
*
|
||||
* @param snapshot 快照
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int updateSnapshot(Snapshot snapshot)
|
||||
{
|
||||
return snapshotMapper.updateSnapshot(snapshot);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除快照
|
||||
*
|
||||
* @param ids 需要删除的快照主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteSnapshotByIds(Long[] ids)
|
||||
{
|
||||
return snapshotMapper.deleteSnapshotByIds(ids);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除快照信息
|
||||
*
|
||||
* @param id 快照主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteSnapshotById(Long id)
|
||||
{
|
||||
return snapshotMapper.deleteSnapshotById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int record(SnapshotType type, String value) {
|
||||
if (type == null) {
|
||||
return 0;
|
||||
}
|
||||
Snapshot po = new Snapshot();
|
||||
po.setType(type.getCode());
|
||||
po.setValue(value);
|
||||
return this.insertSnapshot(po);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<SnapshotDateVO> selectSimpleForDate(SnapshotQuery query) {
|
||||
return snapshotMapper.selectSimpleForDate(query);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,19 @@
|
|||
package com.ruoyi.bst.withdraw.constants;
|
||||
|
||||
public class WithdrawDailyKeys {
|
||||
// 创建日期
|
||||
public static final String CREATE_DATE = "date(bw.create_time) as `date`";
|
||||
|
||||
// 提现总数量
|
||||
public static final String WITHDRAW_COUNT = "count(bw.id) as `count`";
|
||||
|
||||
// 提现总金额
|
||||
public static final String WITHDRAW_AMOUNT = "sum(bw.amount) as `amount`";
|
||||
|
||||
// 提现成功金额
|
||||
public static final String WITHDRAW_SUCCESS_AMOUNT = "sum(if (bw.status = 'SUCCESS', bw.arrival_amount, 0)) as `success_amount`";
|
||||
|
||||
// 提现手续费
|
||||
public static final String WITHDRAW_SERVICE_CHARGE = "sum(if (bw.status = 'SUCCESS', bw.service_charge, 0)) as `service_charge`";
|
||||
|
||||
}
|
|
@ -0,0 +1,27 @@
|
|||
package com.ruoyi.bst.withdraw.domain.vo;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDate;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class WithdrawDailyStatVO {
|
||||
|
||||
@ApiModelProperty("日期")
|
||||
private LocalDate date;
|
||||
|
||||
@ApiModelProperty("数量")
|
||||
private Integer count;
|
||||
|
||||
@ApiModelProperty("总金额")
|
||||
private BigDecimal amount;
|
||||
|
||||
@ApiModelProperty("成功金额")
|
||||
private BigDecimal successAmount;
|
||||
|
||||
@ApiModelProperty("手续费")
|
||||
private BigDecimal serviceCharge;
|
||||
|
||||
}
|
|
@ -8,6 +8,7 @@ import org.apache.ibatis.annotations.Param;
|
|||
import com.ruoyi.bst.withdraw.domain.Withdraw;
|
||||
import com.ruoyi.bst.withdraw.domain.WithdrawQuery;
|
||||
import com.ruoyi.bst.withdraw.domain.WithdrawVO;
|
||||
import com.ruoyi.bst.withdraw.domain.vo.WithdrawDailyStatVO;
|
||||
|
||||
/**
|
||||
* 提现Mapper接口
|
||||
|
@ -80,4 +81,19 @@ public interface WithdrawMapper
|
|||
* 根据条件查询数量
|
||||
*/
|
||||
int selectCount(@Param("query") WithdrawQuery query);
|
||||
|
||||
/**
|
||||
* 根据条件查询每日提现统计
|
||||
*/
|
||||
List<WithdrawDailyStatVO> selectDailyStat(@Param("query") WithdrawQuery query, @Param("keys") List<String> keys);
|
||||
|
||||
/**
|
||||
* 根据条件查询到账金额
|
||||
*/
|
||||
BigDecimal selectSumOfArrivalAmount(@Param("query") WithdrawQuery query);
|
||||
|
||||
/**
|
||||
* 根据条件查询手续费
|
||||
*/
|
||||
BigDecimal selectSumOfServiceCharge(@Param("query") WithdrawQuery query);
|
||||
}
|
||||
|
|
|
@ -195,7 +195,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
</foreach>
|
||||
</delete>
|
||||
|
||||
<!-- selectSumOfAmount -->
|
||||
<!-- selectSumOfAmount -->
|
||||
|
||||
<select id="selectSumOfAmount" parameterType="WithdrawQuery" resultType="BigDecimal">
|
||||
select sum(bw.amount)
|
||||
|
@ -205,7 +205,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
</where>
|
||||
</select>
|
||||
|
||||
<!-- selectCount -->
|
||||
<!-- selectCount -->
|
||||
|
||||
<select id="selectCount" parameterType="WithdrawQuery" resultType="int">
|
||||
select count(bw.id)
|
||||
|
@ -213,5 +213,46 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<where>
|
||||
<include refid="searchCondition"/>
|
||||
</where>
|
||||
</select>
|
||||
</select>
|
||||
|
||||
<!-- selectDailyWithdraw -->
|
||||
|
||||
<resultMap type="WithdrawDailyStatVO" id="WithdrawDailyResult" autoMapping="true">
|
||||
<result column="count" property="count" typeHandler="com.ruoyi.common.mybatis.typehandler.NonNullIntegerTyperHandler"/>
|
||||
<result column="amount" property="amount" typeHandler="com.ruoyi.common.mybatis.typehandler.NonNullDecimalTypeHandler"/>
|
||||
<result column="success_amount" property="successAmount" typeHandler="com.ruoyi.common.mybatis.typehandler.NonNullDecimalTypeHandler"/>
|
||||
<result column="service_charge" property="serviceCharge" typeHandler="com.ruoyi.common.mybatis.typehandler.NonNullDecimalTypeHandler"/>
|
||||
</resultMap>
|
||||
|
||||
<select id="selectDailyStat" parameterType="WithdrawQuery" resultMap="WithdrawDailyResult">
|
||||
select
|
||||
<foreach item="item" collection="keys" separator=",">
|
||||
${item}
|
||||
</foreach>
|
||||
from <include refid="searchTables"/>
|
||||
<where>
|
||||
<include refid="searchCondition"/>
|
||||
</where>
|
||||
group by `date`
|
||||
</select>
|
||||
|
||||
<!-- selectSumOfArrivalAmount -->
|
||||
|
||||
<select id="selectSumOfArrivalAmount" parameterType="WithdrawQuery" resultType="BigDecimal">
|
||||
select sum(bw.arrival_amount)
|
||||
from <include refid="searchTables"/>
|
||||
<where>
|
||||
<include refid="searchCondition"/>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<!-- selectSumOfServiceCharge -->
|
||||
|
||||
<select id="selectSumOfServiceCharge" parameterType="WithdrawQuery" resultType="BigDecimal">
|
||||
select sum(bw.service_charge)
|
||||
from <include refid="searchTables"/>
|
||||
<where>
|
||||
<include refid="searchCondition"/>
|
||||
</where>
|
||||
</select>
|
||||
</mapper>
|
||||
|
|
|
@ -4,6 +4,7 @@ import java.math.BigDecimal;
|
|||
import java.util.List;
|
||||
|
||||
import com.ruoyi.bst.withdraw.domain.WithdrawQuery;
|
||||
import com.ruoyi.bst.withdraw.domain.vo.WithdrawDailyStatVO;
|
||||
import com.ruoyi.bst.withdraw.domain.vo.WithdrawStatVO;
|
||||
|
||||
public interface WithdrawDashboard {
|
||||
|
@ -28,4 +29,18 @@ public interface WithdrawDashboard {
|
|||
* @return
|
||||
*/
|
||||
Integer selectWaitVerifyCount(WithdrawQuery query);
|
||||
|
||||
/**
|
||||
* 查询每日提现统计
|
||||
* @param query
|
||||
* @return
|
||||
*/
|
||||
List<WithdrawDailyStatVO> selectDailyStat(WithdrawQuery query, List<String> keys);
|
||||
|
||||
/**
|
||||
* 查询提现手续费
|
||||
* @param query
|
||||
* @return
|
||||
*/
|
||||
BigDecimal selectSuccessServiceCharge(WithdrawQuery query);
|
||||
}
|
||||
|
|
|
@ -8,6 +8,7 @@ import org.springframework.stereotype.Service;
|
|||
|
||||
import com.ruoyi.bst.withdraw.domain.WithdrawQuery;
|
||||
import com.ruoyi.bst.withdraw.domain.enums.WithdrawStatus;
|
||||
import com.ruoyi.bst.withdraw.domain.vo.WithdrawDailyStatVO;
|
||||
import com.ruoyi.bst.withdraw.domain.vo.WithdrawStatVO;
|
||||
import com.ruoyi.bst.withdraw.mapper.WithdrawMapper;
|
||||
import com.ruoyi.bst.withdraw.service.WithdrawDashboard;
|
||||
|
@ -38,7 +39,7 @@ public class WithdrawDashboardImpl implements WithdrawDashboard {
|
|||
WithdrawQuery successQuery = new WithdrawQuery();
|
||||
BeanUtils.copyProperties(query, successQuery);
|
||||
successQuery.setStatus(WithdrawStatus.SUCCESS.getCode());
|
||||
return MathUtils.dv(withdrawMapper.selectSumOfAmount(successQuery));
|
||||
return MathUtils.dv(withdrawMapper.selectSumOfArrivalAmount(successQuery));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -48,4 +49,17 @@ public class WithdrawDashboardImpl implements WithdrawDashboard {
|
|||
waitVerifyQuery.setStatus(WithdrawStatus.WAIT_VERIFY.getCode());
|
||||
return MathUtils.dv(withdrawMapper.selectCount(waitVerifyQuery));
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<WithdrawDailyStatVO> selectDailyStat(WithdrawQuery query, List<String> keys) {
|
||||
return withdrawMapper.selectDailyStat(query, keys);
|
||||
}
|
||||
|
||||
@Override
|
||||
public BigDecimal selectSuccessServiceCharge(WithdrawQuery query) {
|
||||
WithdrawQuery successQuery = new WithdrawQuery();
|
||||
BeanUtils.copyProperties(query, successQuery);
|
||||
successQuery.setStatus(WithdrawStatus.SUCCESS.getCode());
|
||||
return MathUtils.dv(withdrawMapper.selectSumOfServiceCharge(successQuery));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -43,6 +43,13 @@ public class StatKeys {
|
|||
// 分成实收金额
|
||||
public static final String BONUS_ACTUAL_AMOUNT = "bonus_actual_amount";
|
||||
|
||||
// 平台分成金额
|
||||
public static final String PLATFORM_BONUS_AMOUNT = "platform_bonus_amount";
|
||||
// 平台分成退款
|
||||
public static final String PLATFORM_BONUS_REFUND_AMOUNT = "platform_bonus_refund_amount";
|
||||
// 平台分成实收金额
|
||||
public static final String PLATFORM_BONUS_ACTUAL_AMOUNT = "platform_bonus_actual_amount";
|
||||
|
||||
// 用户数量
|
||||
public static final String USER_COUNT = "user_count";
|
||||
// 今日新增用户数量
|
||||
|
@ -78,6 +85,8 @@ public class StatKeys {
|
|||
public static final String WITHDRAW_SUCCESS_AMOUNT = "withdraw_success_amount";
|
||||
// 待审核的提现数量
|
||||
public static final String WITHDRAW_WAIT_VERIFY_COUNT = "withdraw_wait_verify_count";
|
||||
// 提现手续费
|
||||
public static final String WITHDRAW_SERVICE_CHARGE = "withdraw_service_charge";
|
||||
|
||||
// 待审核的加盟商申请数量
|
||||
public static final String MCH_APPLY_APPROVING_COUNT = "mch_apply_approving_count";
|
||||
|
|
|
@ -0,0 +1,48 @@
|
|||
package com.ruoyi.dashboard.domain.platformIncomeDaily;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.util.List;
|
||||
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import com.ruoyi.bst.bonus.domain.BonusQuery;
|
||||
import com.ruoyi.bst.bonus.domain.enums.BonusArrivalType;
|
||||
import com.ruoyi.bst.bonus.domain.enums.BonusStatus;
|
||||
import com.ruoyi.bst.bonusRefund.domain.BonusRefundQuery;
|
||||
import com.ruoyi.bst.withdraw.domain.WithdrawQuery;
|
||||
import com.ruoyi.bst.withdraw.domain.enums.WithdrawStatus;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class PlatformDailyIncomeQuery {
|
||||
|
||||
@ApiModelProperty("日期范围")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd")
|
||||
private List<LocalDate> dateRange;
|
||||
|
||||
public BonusQuery toBonusQuery() {
|
||||
BonusQuery query = new BonusQuery();
|
||||
query.setCreateDateRange(dateRange);
|
||||
query.setStatusList(BonusStatus.valid());
|
||||
query.setArrivalTypes(BonusArrivalType.platformList());
|
||||
return query;
|
||||
}
|
||||
|
||||
public BonusRefundQuery toBonusRefundQuery() {
|
||||
BonusRefundQuery query = new BonusRefundQuery();
|
||||
query.setCreateDateRange(dateRange);
|
||||
query.setBonusStatusList(BonusStatus.valid());
|
||||
query.setBonusArrivalTypes(BonusArrivalType.platformList());
|
||||
return query;
|
||||
}
|
||||
|
||||
public WithdrawQuery toWithdrawQuery() {
|
||||
WithdrawQuery query = new WithdrawQuery();
|
||||
query.setCreateDateRange(dateRange);
|
||||
query.setStatus(WithdrawStatus.SUCCESS.getCode());
|
||||
return query;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,31 @@
|
|||
package com.ruoyi.dashboard.domain.platformIncomeDaily;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDate;
|
||||
|
||||
import com.ruoyi.common.utils.MathUtils;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class PlatformDailyIncomeVO {
|
||||
|
||||
@ApiModelProperty("日期")
|
||||
private LocalDate date;
|
||||
|
||||
@ApiModelProperty("分成金额")
|
||||
private BigDecimal bonusAmount;
|
||||
|
||||
@ApiModelProperty("分成退款金额")
|
||||
private BigDecimal bonusRefundAmount;
|
||||
|
||||
@ApiModelProperty("分成实收")
|
||||
public BigDecimal getBonusActualAmount() {
|
||||
return MathUtils.subtractDecimal(bonusAmount, bonusRefundAmount);
|
||||
}
|
||||
|
||||
@ApiModelProperty("提现服务费")
|
||||
private BigDecimal withdrawServiceCharge;
|
||||
|
||||
}
|
|
@ -9,16 +9,19 @@ import com.ruoyi.bst.area.domain.AreaQuery;
|
|||
import com.ruoyi.bst.areaJoin.domain.AreaJoinQuery;
|
||||
import com.ruoyi.bst.areaJoin.domain.enums.AreaJoinPermission;
|
||||
import com.ruoyi.bst.bonus.domain.BonusQuery;
|
||||
import com.ruoyi.bst.bonus.domain.enums.BonusArrivalType;
|
||||
import com.ruoyi.bst.bonus.domain.enums.BonusStatus;
|
||||
import com.ruoyi.bst.bonusRefund.domain.BonusRefundQuery;
|
||||
import com.ruoyi.bst.device.domain.DeviceQuery;
|
||||
import com.ruoyi.bst.fault.domain.FaultQuery;
|
||||
import com.ruoyi.bst.mchApply.domain.MchApplyQuery;
|
||||
import com.ruoyi.bst.model.domain.ModelQuery;
|
||||
import com.ruoyi.bst.order.domain.OrderQuery;
|
||||
import com.ruoyi.bst.order.domain.enums.OrderStatus;
|
||||
import com.ruoyi.bst.order.domain.query.OrderRefundQuery;
|
||||
import com.ruoyi.bst.refund.domain.enums.RefundStatus;
|
||||
import com.ruoyi.bst.withdraw.domain.WithdrawQuery;
|
||||
import com.ruoyi.system.user.domain.UserQuery;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
@ -41,7 +44,7 @@ public class RevenueStatQuery {
|
|||
@ApiModelProperty("数据隔离")
|
||||
private Boolean scope;
|
||||
|
||||
|
||||
// 基础订单查询
|
||||
private OrderQuery baseOrderQuery() {
|
||||
OrderQuery query = new OrderQuery();
|
||||
query.setStatusList(OrderStatus.valid());
|
||||
|
@ -52,30 +55,30 @@ public class RevenueStatQuery {
|
|||
return query;
|
||||
}
|
||||
|
||||
// 基础分成查询
|
||||
private BonusQuery baseBonusQuery() {
|
||||
BonusQuery query = new BonusQuery();
|
||||
query.setStatusList(BonusStatus.valid());
|
||||
query.setArrivalId(userId);
|
||||
query.setAreaId(areaId);
|
||||
query.setScope(scope);
|
||||
return query;
|
||||
}
|
||||
|
||||
// 基础分成退款查询
|
||||
private BonusRefundQuery baseBonusRefundQuery() {
|
||||
BonusRefundQuery query = new BonusRefundQuery();
|
||||
query.setBonusStatusList(BonusStatus.valid());
|
||||
query.setBonusArrivalId(userId);
|
||||
query.setBonusAreaId(areaId);
|
||||
query.setScope(scope);
|
||||
return query;
|
||||
}
|
||||
|
||||
// 订单查询
|
||||
public OrderQuery toOrderQuery() {
|
||||
OrderQuery query = baseOrderQuery();
|
||||
query.setCreateDateRange(dateRange);
|
||||
return query;
|
||||
}
|
||||
|
||||
// 订单查询(完成订单)
|
||||
public OrderQuery toOrderQueryForEnd() {
|
||||
OrderQuery query = baseOrderQuery();
|
||||
query.setEndDateRange(dateRange);
|
||||
|
@ -83,18 +86,42 @@ public class RevenueStatQuery {
|
|||
return query;
|
||||
}
|
||||
|
||||
// 用户分成查询
|
||||
public BonusQuery toBonusQuery() {
|
||||
BonusQuery query = baseBonusQuery();
|
||||
query.setArrivalId(userId);
|
||||
query.setAreaId(areaId);
|
||||
query.setCreateDateRange(dateRange);
|
||||
return query;
|
||||
}
|
||||
|
||||
// 平台分成查询
|
||||
public BonusQuery toPlatformBonusQuery() {
|
||||
BonusQuery query = new BonusQuery();
|
||||
query.setCreateDateRange(dateRange);
|
||||
query.setArrivalTypes(BonusArrivalType.platformList());
|
||||
query.setStatusList(BonusStatus.valid());
|
||||
return query;
|
||||
}
|
||||
|
||||
// 用户分成退款查询
|
||||
public BonusRefundQuery toBonusRefundQuery() {
|
||||
BonusRefundQuery query = baseBonusRefundQuery();
|
||||
query.setBonusArrivalId(userId);
|
||||
query.setBonusAreaId(areaId);
|
||||
query.setCreateDateRange(dateRange);
|
||||
return query;
|
||||
}
|
||||
|
||||
// 平台分成退款查询
|
||||
public BonusRefundQuery toPlatformBonusRefundQuery() {
|
||||
BonusRefundQuery query = baseBonusRefundQuery();
|
||||
query.setCreateDateRange(dateRange);
|
||||
query.setBonusArrivalTypes(BonusArrivalType.platformList());
|
||||
return query;
|
||||
}
|
||||
|
||||
// 运营区查询
|
||||
public AreaQuery toAreaQuery() {
|
||||
AreaQuery query = new AreaQuery();
|
||||
query.setCreateDateRange(dateRange);
|
||||
|
@ -105,6 +132,7 @@ public class RevenueStatQuery {
|
|||
return query;
|
||||
}
|
||||
|
||||
// 运营区加盟商查询
|
||||
public AreaJoinQuery toAreaJoinQuery() {
|
||||
AreaJoinQuery query = new AreaJoinQuery();
|
||||
query.setCreateDateRange(dateRange);
|
||||
|
@ -114,6 +142,7 @@ public class RevenueStatQuery {
|
|||
return query;
|
||||
}
|
||||
|
||||
// 设备查询
|
||||
public DeviceQuery toDeviceQuery() {
|
||||
DeviceQuery query = new DeviceQuery();
|
||||
query.setCreateDateRange(dateRange);
|
||||
|
@ -124,6 +153,7 @@ public class RevenueStatQuery {
|
|||
return query;
|
||||
}
|
||||
|
||||
// 提现查询
|
||||
public WithdrawQuery toWithdrawQuery() {
|
||||
WithdrawQuery query = new WithdrawQuery();
|
||||
query.setCreateDateRange(dateRange);
|
||||
|
@ -132,6 +162,7 @@ public class RevenueStatQuery {
|
|||
return query;
|
||||
}
|
||||
|
||||
// 加盟商申请查询
|
||||
public MchApplyQuery toMchApplyQuery() {
|
||||
MchApplyQuery query = new MchApplyQuery();
|
||||
query.setCreateDateRange(dateRange);
|
||||
|
@ -140,6 +171,7 @@ public class RevenueStatQuery {
|
|||
return query;
|
||||
}
|
||||
|
||||
// 故障查询
|
||||
public FaultQuery toFaultQuery() {
|
||||
FaultQuery query = new FaultQuery();
|
||||
query.setCreateDateRange(dateRange);
|
||||
|
@ -150,6 +182,7 @@ public class RevenueStatQuery {
|
|||
return query;
|
||||
}
|
||||
|
||||
// 订单退款查询
|
||||
public OrderRefundQuery toOrderRefundQuery() {
|
||||
OrderRefundQuery query = new OrderRefundQuery();
|
||||
query.setStatusList(OrderStatus.valid());
|
||||
|
@ -161,4 +194,22 @@ public class RevenueStatQuery {
|
|||
query.addAreaPermission(AreaJoinPermission.ORDER_VIEW.getCode());
|
||||
return query;
|
||||
}
|
||||
|
||||
// 用户查询
|
||||
public UserQuery toUserQuery() {
|
||||
UserQuery query = new UserQuery();
|
||||
query.setCreateDateRange(dateRange);
|
||||
query.setUserId(userId);
|
||||
query.setScope(scope);
|
||||
return query;
|
||||
}
|
||||
|
||||
// 车型查询
|
||||
public ModelQuery toModelQuery() {
|
||||
ModelQuery query = new ModelQuery();
|
||||
query.setCreateDateRange(dateRange);
|
||||
query.setUserId(userId);
|
||||
query.setScope(scope);
|
||||
return query;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -63,6 +63,15 @@ public class RevenueStatVO {
|
|||
return MathUtils.subtractDecimal(bonusAmount, bonusRefundAmount);
|
||||
}
|
||||
|
||||
@ApiModelProperty("平台分成金额")
|
||||
private BigDecimal platformBonusAmount;
|
||||
@ApiModelProperty("平台分成退款金额")
|
||||
private BigDecimal platformBonusRefundAmount;
|
||||
@ApiModelProperty("平台分成实收金额")
|
||||
public BigDecimal getPlatformBonusActualAmount() {
|
||||
return MathUtils.subtractDecimal(platformBonusAmount, platformBonusRefundAmount);
|
||||
}
|
||||
|
||||
@ApiModelProperty("运营区数量")
|
||||
private Integer areaCount;
|
||||
@ApiModelProperty("运营区加盟数量")
|
||||
|
@ -83,10 +92,20 @@ public class RevenueStatVO {
|
|||
private BigDecimal withdrawSuccessAmount;
|
||||
@ApiModelProperty("待审核的提现数量")
|
||||
private Integer withdrawWaitVerifyCount;
|
||||
@ApiModelProperty("提现手续费")
|
||||
private BigDecimal withdrawServiceCharge;
|
||||
|
||||
@ApiModelProperty("待审核的加盟商申请数量")
|
||||
private Integer mchApplyApprovingCount;
|
||||
|
||||
@ApiModelProperty("待处理的故障数量")
|
||||
private Integer faultPendingCount;
|
||||
|
||||
@ApiModelProperty("用户余额")
|
||||
private BigDecimal userBalance;
|
||||
@ApiModelProperty("运营商数量")
|
||||
private Integer userMchCount;
|
||||
|
||||
@ApiModelProperty("车型数量")
|
||||
private Integer modelCount;
|
||||
}
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package com.ruoyi.dashboard.service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
@ -8,8 +9,10 @@ import org.springframework.stereotype.Service;
|
|||
|
||||
import com.ruoyi.bst.area.service.AreaDashboard;
|
||||
import com.ruoyi.bst.areaJoin.service.AreaJoinDashboard;
|
||||
import com.ruoyi.bst.bonus.constants.BonusDailyKeys;
|
||||
import com.ruoyi.bst.bonus.domain.vo.BonusDailyStatVO;
|
||||
import com.ruoyi.bst.bonus.service.BonusDashboard;
|
||||
import com.ruoyi.bst.bonusRefund.constants.BonusRefundDailyKeys;
|
||||
import com.ruoyi.bst.bonusRefund.domain.vo.BonusRefundDailyStatVO;
|
||||
import com.ruoyi.bst.bonusRefund.service.BonusRefundDashboard;
|
||||
import com.ruoyi.bst.device.service.DeviceDashboard;
|
||||
|
@ -21,12 +24,16 @@ import com.ruoyi.bst.order.domain.vo.OrderDailyRefundStatVO;
|
|||
import com.ruoyi.bst.order.domain.vo.OrderDailyStatVO;
|
||||
import com.ruoyi.bst.order.service.OrderDashboard;
|
||||
import com.ruoyi.bst.refund.domain.enums.RefundType;
|
||||
import com.ruoyi.bst.withdraw.constants.WithdrawDailyKeys;
|
||||
import com.ruoyi.bst.withdraw.domain.vo.WithdrawDailyStatVO;
|
||||
import com.ruoyi.bst.withdraw.service.WithdrawDashboard;
|
||||
import com.ruoyi.common.utils.MathUtils;
|
||||
import com.ruoyi.common.utils.collection.CollectionUtils;
|
||||
import com.ruoyi.dashboard.constants.StatKeys;
|
||||
import com.ruoyi.dashboard.domain.dailyStat.DailyStatQuery;
|
||||
import com.ruoyi.dashboard.domain.dailyStat.DailyStatVO;
|
||||
import com.ruoyi.dashboard.domain.platformIncomeDaily.PlatformDailyIncomeQuery;
|
||||
import com.ruoyi.dashboard.domain.platformIncomeDaily.PlatformDailyIncomeVO;
|
||||
import com.ruoyi.dashboard.domain.revenueStat.RevenueStatQuery;
|
||||
import com.ruoyi.dashboard.domain.revenueStat.RevenueStatVO;
|
||||
import com.ruoyi.dashboard.domain.stat.StatQuery;
|
||||
|
@ -201,6 +208,15 @@ public class DashboardService {
|
|||
vo.setBonusCount(bonusDashboard.selectCount(query.toBonusQuery()));
|
||||
}
|
||||
|
||||
// 平台分成金额
|
||||
if (keys.contains(StatKeys.PLATFORM_BONUS_AMOUNT) || keys.contains(StatKeys.PLATFORM_BONUS_ACTUAL_AMOUNT)) {
|
||||
vo.setPlatformBonusAmount(bonusDashboard.selectSumOfAmount(query.toPlatformBonusQuery()));
|
||||
}
|
||||
// 平台分成退款金额
|
||||
if (keys.contains(StatKeys.PLATFORM_BONUS_REFUND_AMOUNT) || keys.contains(StatKeys.PLATFORM_BONUS_ACTUAL_AMOUNT)) {
|
||||
vo.setPlatformBonusRefundAmount(bonusRefundDashboard.selectSumOfPlatformBonusRefund(query.toPlatformBonusRefundQuery()));
|
||||
}
|
||||
|
||||
// 运营区数量
|
||||
if (keys.contains(StatKeys.AREA_COUNT)) {
|
||||
vo.setAreaCount(areaDashboard.selectCount(query.toAreaQuery()));
|
||||
|
@ -218,7 +234,7 @@ public class DashboardService {
|
|||
if (keys.contains(StatKeys.AREA_JOIN_OPERATION_COUNT)) {
|
||||
vo.setAreaOperationCount(areaJoinDashboard.selectOperationCount(query.toAreaJoinQuery()));
|
||||
}
|
||||
|
||||
|
||||
// 设备数量
|
||||
if (keys.contains(StatKeys.DEVICE_COUNT)) {
|
||||
vo.setDeviceCount(deviceDashboard.selectCount(query.toDeviceQuery()));
|
||||
|
@ -240,6 +256,10 @@ public class DashboardService {
|
|||
if (keys.contains(StatKeys.WITHDRAW_WAIT_VERIFY_COUNT)) {
|
||||
vo.setWithdrawWaitVerifyCount(withdrawDashboard.selectWaitVerifyCount(query.toWithdrawQuery()));
|
||||
}
|
||||
// 提现手续费
|
||||
if (keys.contains(StatKeys.WITHDRAW_SERVICE_CHARGE)) {
|
||||
vo.setWithdrawServiceCharge(withdrawDashboard.selectSuccessServiceCharge(query.toWithdrawQuery()));
|
||||
}
|
||||
|
||||
// 待审核的加盟商申请数量
|
||||
if (keys.contains(StatKeys.MCH_APPLY_APPROVING_COUNT)) {
|
||||
|
@ -251,6 +271,74 @@ public class DashboardService {
|
|||
vo.setFaultPendingCount(faultDashboard.selectPendingCount(query.toFaultQuery()));
|
||||
}
|
||||
|
||||
// 用户余额
|
||||
if (keys.contains(StatKeys.USER_BALANCE)) {
|
||||
vo.setUserBalance(userDashboard.selectSumOfBalance(query.toUserQuery()));
|
||||
}
|
||||
// 运营商数量
|
||||
if (keys.contains(StatKeys.USER_MCH_COUNT)) {
|
||||
vo.setUserMchCount(userDashboard.selectMchCount(query.toUserQuery()));
|
||||
}
|
||||
|
||||
// 车型数量
|
||||
if (keys.contains(StatKeys.MODEL_COUNT)) {
|
||||
vo.setModelCount(modelDashboard.selectCount(query.toModelQuery()));
|
||||
}
|
||||
|
||||
return vo;
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询平台每日收益
|
||||
*/
|
||||
public List<PlatformDailyIncomeVO> selectPlatformDailyIncome(PlatformDailyIncomeQuery query) {
|
||||
List<PlatformDailyIncomeVO> result = new ArrayList<>();
|
||||
|
||||
// 查询分成金额
|
||||
List<BonusDailyStatVO> bonusList = bonusDashboard.selectDailyStat(
|
||||
query.toBonusQuery(),
|
||||
Arrays.asList(BonusDailyKeys.CREATE_DATE, BonusDailyKeys.BONUS_AMOUNT)
|
||||
);
|
||||
|
||||
// 查询分成退款金额
|
||||
List<BonusRefundDailyStatVO> bonusRefundList = bonusRefundDashboard.selectDailyStat(
|
||||
query.toBonusRefundQuery(),
|
||||
Arrays.asList(BonusRefundDailyKeys.CREATE_DATE, BonusRefundDailyKeys.BONUS_REFUND_AMOUNT)
|
||||
);
|
||||
|
||||
// 查询每日提现金额
|
||||
List<WithdrawDailyStatVO> withdrawList = withdrawDashboard.selectDailyStat(
|
||||
query.toWithdrawQuery(),
|
||||
Arrays.asList(WithdrawDailyKeys.CREATE_DATE, WithdrawDailyKeys.WITHDRAW_SERVICE_CHARGE)
|
||||
);
|
||||
|
||||
if (query.getDateRange() != null && query.getDateRange().size() >= 2) {
|
||||
result = CollectionUtils.fillVoids(result, PlatformDailyIncomeVO::getDate, (date) -> {
|
||||
PlatformDailyIncomeVO vo = new PlatformDailyIncomeVO();
|
||||
vo.setDate(date);
|
||||
|
||||
// 分成金额
|
||||
BonusDailyStatVO bonus = bonusList.stream()
|
||||
.filter(item -> item.getDate() != null && item.getDate().isEqual(date))
|
||||
.findFirst().orElse(new BonusDailyStatVO());
|
||||
vo.setBonusAmount(MathUtils.dv(bonus.getAmount()));
|
||||
|
||||
// 分成退款金额
|
||||
BonusRefundDailyStatVO bonusRefund = bonusRefundList.stream()
|
||||
.filter(item -> item.getDate() != null && item.getDate().isEqual(date))
|
||||
.findFirst().orElse(new BonusRefundDailyStatVO());
|
||||
vo.setBonusRefundAmount(MathUtils.dv(bonusRefund.getAmount()));
|
||||
|
||||
// 提现手续费
|
||||
WithdrawDailyStatVO withdraw = withdrawList.stream()
|
||||
.filter(item -> item.getDate() != null && item.getDate().isEqual(date))
|
||||
.findFirst().orElse(new WithdrawDailyStatVO());
|
||||
vo.setWithdrawServiceCharge(MathUtils.dv(withdraw.getServiceCharge()));
|
||||
|
||||
return vo;
|
||||
}, query.getDateRange().get(0), query.getDateRange().get(1));
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -24,4 +24,19 @@ public interface UserDashboard {
|
|||
*/
|
||||
UserAgentStatVO selectAgentStat(UserQuery query, List<String> keys);
|
||||
|
||||
/**
|
||||
* 查询用户余额
|
||||
*/
|
||||
BigDecimal selectSumOfBalance(UserQuery query);
|
||||
|
||||
/**
|
||||
* 查询运营商数量
|
||||
*/
|
||||
Integer selectMchCount(UserQuery query);
|
||||
|
||||
/**
|
||||
* 查询用户数量
|
||||
*/
|
||||
Integer selectCount(UserQuery query);
|
||||
|
||||
}
|
||||
|
|
|
@ -32,7 +32,7 @@ public class UserDashboardImpl implements UserDashboard {
|
|||
public UserStatVO selectStat(UserQuery query, List<String> keys) {
|
||||
UserStatVO vo = new UserStatVO();
|
||||
if (keys.contains(StatKeys.USER_BALANCE)) {
|
||||
vo.setBalance(MathUtils.dv(userMapper.selectSumOfBalance(query)));
|
||||
vo.setBalance(userMapper.selectSumOfBalance(query));
|
||||
}
|
||||
return vo;
|
||||
}
|
||||
|
@ -52,18 +52,19 @@ public class UserDashboardImpl implements UserDashboard {
|
|||
return vo;
|
||||
}
|
||||
|
||||
private Integer selectMchCount(UserQuery query) {
|
||||
@Override
|
||||
public Integer selectMchCount(UserQuery query) {
|
||||
UserQuery mchQuery = new UserQuery();
|
||||
BeanUtils.copyProperties(query, mchQuery);
|
||||
mchQuery.setRoleKey(RoleConstants.MCH);
|
||||
return userMapper.selectCount(mchQuery);
|
||||
return this.selectCount(mchQuery);
|
||||
}
|
||||
|
||||
private Integer selectAgentCount(UserQuery query) {
|
||||
UserQuery agentQuery = new UserQuery();
|
||||
BeanUtils.copyProperties(query, agentQuery);
|
||||
agentQuery.setRoleKey(RoleConstants.AGENT);
|
||||
return userMapper.selectCount(agentQuery);
|
||||
return this.selectCount(agentQuery);
|
||||
}
|
||||
|
||||
// 获取普通用户的数量
|
||||
|
@ -71,7 +72,16 @@ public class UserDashboardImpl implements UserDashboard {
|
|||
UserQuery normalQuery = new UserQuery();
|
||||
BeanUtils.copyProperties(query, normalQuery);
|
||||
normalQuery.setUserType(UserType.USER.getCode());
|
||||
return MathUtils.dv(userMapper.selectCount(normalQuery));
|
||||
return this.selectCount(normalQuery);
|
||||
}
|
||||
|
||||
@Override
|
||||
public BigDecimal selectSumOfBalance(UserQuery query) {
|
||||
return MathUtils.dv(userMapper.selectSumOfBalance(query));
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer selectCount(UserQuery query) {
|
||||
return MathUtils.dv(userMapper.selectCount(query));
|
||||
}
|
||||
}
|
|
@ -0,0 +1,35 @@
|
|||
package com.ruoyi.task.snapshot;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import com.ruoyi.bst.snapshot.domain.enums.SnapshotType;
|
||||
import com.ruoyi.bst.snapshot.service.SnapshotService;
|
||||
import com.ruoyi.common.utils.ServiceUtil;
|
||||
import com.ruoyi.system.user.domain.UserQuery;
|
||||
import com.ruoyi.system.user.service.UserDashboard;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
@Component
|
||||
@Slf4j
|
||||
public class SnapshotTask {
|
||||
|
||||
@Autowired
|
||||
private SnapshotService snapshotService;
|
||||
|
||||
@Autowired
|
||||
private UserDashboard userDashboard;
|
||||
|
||||
/**
|
||||
* 记录用户余额
|
||||
*/
|
||||
public void snapshotUserBalance() {
|
||||
BigDecimal balance = userDashboard.selectSumOfBalance(new UserQuery());
|
||||
int rows = snapshotService.record(SnapshotType.USER_BALANCE, balance.toString());
|
||||
ServiceUtil.assertion(rows != 1, "记录用户余额失败");
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,110 @@
|
|||
package com.ruoyi.web.bst;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.PutMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import com.ruoyi.bst.snapshot.domain.Snapshot;
|
||||
import com.ruoyi.bst.snapshot.domain.SnapshotQuery;
|
||||
import com.ruoyi.bst.snapshot.domain.SnapshotVO;
|
||||
import com.ruoyi.bst.snapshot.service.SnapshotService;
|
||||
import com.ruoyi.common.annotation.Log;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
import com.ruoyi.common.enums.BusinessType;
|
||||
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||
|
||||
/**
|
||||
* 快照Controller
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2025-05-08
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/bst/snapshot")
|
||||
public class SnapshotController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
private SnapshotService snapshotService;
|
||||
|
||||
/**
|
||||
* 查询快照列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('bst:snapshot:list')")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(SnapshotQuery query)
|
||||
{
|
||||
startPage();
|
||||
startOrderBy();
|
||||
List<SnapshotVO> list = snapshotService.selectSnapshotList(query);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出快照列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('bst:snapshot:export')")
|
||||
@Log(title = "快照", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, SnapshotQuery query)
|
||||
{
|
||||
List<SnapshotVO> list = snapshotService.selectSnapshotList(query);
|
||||
ExcelUtil<SnapshotVO> util = new ExcelUtil<SnapshotVO>(SnapshotVO.class);
|
||||
util.exportExcel(response, list, "快照数据");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取快照详细信息
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('bst:snapshot:query')")
|
||||
@GetMapping(value = "/{id}")
|
||||
public AjaxResult getInfo(@PathVariable("id") Long id)
|
||||
{
|
||||
return success(snapshotService.selectSnapshotById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增快照
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('bst:snapshot:add')")
|
||||
@Log(title = "快照", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody Snapshot snapshot)
|
||||
{
|
||||
return toAjax(snapshotService.insertSnapshot(snapshot));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改快照
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('bst:snapshot:edit')")
|
||||
@Log(title = "快照", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@RequestBody Snapshot snapshot)
|
||||
{
|
||||
return toAjax(snapshotService.updateSnapshot(snapshot));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除快照
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('bst:snapshot:remove')")
|
||||
@Log(title = "快照", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{ids}")
|
||||
public AjaxResult remove(@PathVariable Long[] ids)
|
||||
{
|
||||
return toAjax(snapshotService.deleteSnapshotByIds(ids));
|
||||
}
|
||||
}
|
|
@ -17,6 +17,7 @@ import com.ruoyi.bst.refund.domain.enums.RefundStatus;
|
|||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.dashboard.domain.dailyStat.DailyStatQuery;
|
||||
import com.ruoyi.dashboard.domain.platformIncomeDaily.PlatformDailyIncomeQuery;
|
||||
import com.ruoyi.dashboard.domain.revenueStat.RevenueStatQuery;
|
||||
import com.ruoyi.dashboard.domain.stat.StatQuery;
|
||||
import com.ruoyi.dashboard.service.DashboardService;
|
||||
|
@ -67,4 +68,12 @@ public class DashboardController extends BaseController {
|
|||
query.setScope(true);
|
||||
return success(dashboardService.selectRevenueStat(query));
|
||||
}
|
||||
|
||||
@ApiOperation("获取平台每日收益统计")
|
||||
@PreAuthorize("@ss.hasAnyPermi('dashboard:platformDailyIncome')")
|
||||
@GetMapping("/platformDailyIncome")
|
||||
public AjaxResult getPlatformDailyIncome(PlatformDailyIncomeQuery query) {
|
||||
return success(dashboardService.selectPlatformDailyIncome(query));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,46 @@
|
|||
package com.ruoyi.web.dashboard;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import com.ruoyi.bst.snapshot.domain.SnapshotQuery;
|
||||
import com.ruoyi.bst.snapshot.domain.enums.SnapshotType;
|
||||
import com.ruoyi.bst.snapshot.domain.vo.SnapshotDateVO;
|
||||
import com.ruoyi.bst.snapshot.service.SnapshotService;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.utils.collection.CollectionUtils;
|
||||
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/dashboard/snapshot")
|
||||
public class DashboardSnapshotController extends BaseController {
|
||||
|
||||
@Autowired
|
||||
private SnapshotService snapshotService;
|
||||
|
||||
/**
|
||||
* 查询每日用户余额
|
||||
* @param param
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/dailyUserBalance")
|
||||
public AjaxResult dailyUserBalance(SnapshotQuery query) {
|
||||
query.setType(SnapshotType.USER_BALANCE.getCode());
|
||||
List<SnapshotDateVO> list = snapshotService.selectSimpleForDate(query);
|
||||
if (query.getCreateDateRange() != null && query.getCreateDateRange().size() >= 2) {
|
||||
list = CollectionUtils.fillVoids(list, SnapshotDateVO::getDate, (date) -> {
|
||||
SnapshotDateVO vo = new SnapshotDateVO();
|
||||
vo.setDate(date);
|
||||
vo.setValue("0");
|
||||
return vo;
|
||||
},query.getCreateDateRange().get(0), query.getCreateDateRange().get(1));
|
||||
}
|
||||
return success(list);
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,61 @@
|
|||
package com.ruoyi.web.dashboard;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import com.ruoyi.bst.withdraw.constants.WithdrawDailyKeys;
|
||||
import com.ruoyi.bst.withdraw.domain.WithdrawQuery;
|
||||
import com.ruoyi.bst.withdraw.domain.vo.WithdrawDailyStatVO;
|
||||
import com.ruoyi.bst.withdraw.service.WithdrawDashboard;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.utils.collection.CollectionUtils;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/dashboard/withdraw")
|
||||
public class DashboardWithdrawController extends BaseController {
|
||||
|
||||
@Autowired
|
||||
private WithdrawDashboard withdrawDashboard;
|
||||
|
||||
|
||||
@ApiModelProperty("获取每日提现统计")
|
||||
@PreAuthorize("@ss.hasAnyPermi('dashboard:withdraw:daily')")
|
||||
@GetMapping("/dailyWithdraw")
|
||||
public AjaxResult getDailyWithdraw(WithdrawQuery query) {
|
||||
query.setScope(true);
|
||||
List<WithdrawDailyStatVO> list = withdrawDashboard.selectDailyStat(
|
||||
query,
|
||||
Arrays.asList(
|
||||
WithdrawDailyKeys.CREATE_DATE,
|
||||
WithdrawDailyKeys.WITHDRAW_SERVICE_CHARGE,
|
||||
WithdrawDailyKeys.WITHDRAW_COUNT,
|
||||
WithdrawDailyKeys.WITHDRAW_AMOUNT,
|
||||
WithdrawDailyKeys.WITHDRAW_SUCCESS_AMOUNT
|
||||
)
|
||||
);
|
||||
|
||||
if (query.getCreateDateRange() != null && query.getCreateDateRange().size() >= 2) {
|
||||
list = CollectionUtils.fillVoids(list, WithdrawDailyStatVO::getDate, (date) -> {
|
||||
WithdrawDailyStatVO vo = new WithdrawDailyStatVO();
|
||||
vo.setDate(date);
|
||||
vo.setAmount(BigDecimal.ZERO);
|
||||
vo.setSuccessAmount(BigDecimal.ZERO);
|
||||
vo.setServiceCharge(BigDecimal.ZERO);
|
||||
vo.setCount(0);
|
||||
return vo;
|
||||
}, query.getCreateDateRange().get(0), query.getCreateDateRange().get(1));
|
||||
}
|
||||
|
||||
return success(list);
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user