报表更新
This commit is contained in:
parent
7f02aa43a8
commit
2a8851feda
|
@ -0,0 +1,18 @@
|
||||||
|
package com.ruoyi.common.domain.vo;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.time.LocalDate;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author wjh
|
||||||
|
* 2024/12/2
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class LocalDateDecimalVO {
|
||||||
|
|
||||||
|
private LocalDate key;
|
||||||
|
|
||||||
|
private BigDecimal value;
|
||||||
|
}
|
|
@ -2,6 +2,7 @@ package com.ruoyi.ss.bonus.mapper;
|
||||||
|
|
||||||
import com.ruoyi.common.domain.vo.CommonCountVO;
|
import com.ruoyi.common.domain.vo.CommonCountVO;
|
||||||
import com.ruoyi.common.domain.vo.CommonSumVO;
|
import com.ruoyi.common.domain.vo.CommonSumVO;
|
||||||
|
import com.ruoyi.common.domain.vo.LocalDateDecimalVO;
|
||||||
import com.ruoyi.common.domain.vo.LongDecimalVO;
|
import com.ruoyi.common.domain.vo.LongDecimalVO;
|
||||||
import com.ruoyi.ss.bonus.domain.Bonus;
|
import com.ruoyi.ss.bonus.domain.Bonus;
|
||||||
import com.ruoyi.ss.bonus.domain.BonusProvideQuery;
|
import com.ruoyi.ss.bonus.domain.BonusProvideQuery;
|
||||||
|
@ -110,7 +111,7 @@ public interface BonusMapper
|
||||||
/**
|
/**
|
||||||
* 按月查询
|
* 按月查询
|
||||||
*/
|
*/
|
||||||
List<BonusMonthAmountVO> selectMonthAmount(@Param("query") BonusQuery query);
|
List<BonusMonthAmountVO> selectMonthPayedAmount(@Param("query") BonusQuery query);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 按日查询
|
* 按日查询
|
||||||
|
@ -136,4 +137,14 @@ public interface BonusMapper
|
||||||
* 查询未分成金额,并以到账方分组
|
* 查询未分成金额,并以到账方分组
|
||||||
*/
|
*/
|
||||||
List<LongDecimalVO> selectWaitAmountGroupByArrival(@Param("query") BonusQuery query);
|
List<LongDecimalVO> selectWaitAmountGroupByArrival(@Param("query") BonusQuery query);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 按日查询已分成金额
|
||||||
|
*/
|
||||||
|
List<LocalDateDecimalVO> selectDailyPayedAmount(@Param("query") BonusQuery query);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询已分成金额
|
||||||
|
*/
|
||||||
|
BigDecimal selectSumOfPayedAmount(@Param("query") BonusQuery query);
|
||||||
}
|
}
|
||||||
|
|
|
@ -145,11 +145,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
<result property="amount" column="amount" typeHandler="com.ruoyi.system.mapper.typehandler.NonNullDecimalTypeHandler"/>
|
<result property="amount" column="amount" typeHandler="com.ruoyi.system.mapper.typehandler.NonNullDecimalTypeHandler"/>
|
||||||
</resultMap>
|
</resultMap>
|
||||||
|
|
||||||
<select id="selectMonthAmount" resultMap="BonusMonthAmountVO">
|
<select id="selectMonthPayedAmount" resultMap="BonusMonthAmountVO">
|
||||||
select
|
select
|
||||||
year(sb.pay_time) as `year`,
|
year(sb.pay_time) as `year`,
|
||||||
month(sb.pay_time) as `month`,
|
month(sb.pay_time) as `month`,
|
||||||
sum(amount) as amount
|
sum(payed_amount) as amount
|
||||||
<include refid="searchTables"/>
|
<include refid="searchTables"/>
|
||||||
<where>
|
<where>
|
||||||
<include refid="searchCondition"/>
|
<include refid="searchCondition"/>
|
||||||
|
@ -193,6 +193,29 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
group by `key`
|
group by `key`
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<resultMap id="LocalDateDecimalVO" type="LocalDateDecimalVO" autoMapping="true">
|
||||||
|
<result column="value" property="value" typeHandler="com.ruoyi.system.mapper.typehandler.NonNullDecimalTypeHandler"/>
|
||||||
|
</resultMap>
|
||||||
|
<select id="selectDailyPayedAmount" resultMap="LocalDateDecimalVO">
|
||||||
|
select
|
||||||
|
date(sb.pay_time) as `key`,
|
||||||
|
sum(sb.payed_amount) as `value`
|
||||||
|
<include refid="searchTables"/>
|
||||||
|
<where>
|
||||||
|
<include refid="searchCondition"/>
|
||||||
|
</where>
|
||||||
|
group by `key`
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="selectSumOfPayedAmount" resultType="java.math.BigDecimal">
|
||||||
|
select
|
||||||
|
sum(sb.payed_amount)
|
||||||
|
<include refid="searchTables"/>
|
||||||
|
<where>
|
||||||
|
<include refid="searchCondition"/>
|
||||||
|
</where>
|
||||||
|
</select>
|
||||||
|
|
||||||
<insert id="insertBonus" parameterType="Bonus" useGeneratedKeys="true" keyProperty="id">
|
<insert id="insertBonus" parameterType="Bonus" useGeneratedKeys="true" keyProperty="id">
|
||||||
insert into ss_bonus
|
insert into ss_bonus
|
||||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||||
|
|
|
@ -2,6 +2,7 @@ package com.ruoyi.ss.bonus.service;
|
||||||
|
|
||||||
import com.ruoyi.common.domain.vo.CommonCountVO;
|
import com.ruoyi.common.domain.vo.CommonCountVO;
|
||||||
import com.ruoyi.common.domain.vo.CommonSumVO;
|
import com.ruoyi.common.domain.vo.CommonSumVO;
|
||||||
|
import com.ruoyi.common.domain.vo.LocalDateDecimalVO;
|
||||||
import com.ruoyi.common.domain.vo.LongDecimalVO;
|
import com.ruoyi.common.domain.vo.LongDecimalVO;
|
||||||
import com.ruoyi.ss.bonus.domain.Bonus;
|
import com.ruoyi.ss.bonus.domain.Bonus;
|
||||||
import com.ruoyi.ss.bonus.domain.BonusProvideQuery;
|
import com.ruoyi.ss.bonus.domain.BonusProvideQuery;
|
||||||
|
@ -130,7 +131,7 @@ public interface BonusService
|
||||||
/**
|
/**
|
||||||
* 按月查询分成金额
|
* 按月查询分成金额
|
||||||
*/
|
*/
|
||||||
List<BonusMonthAmountVO> selectMonthAmount(BonusQuery query);
|
List<BonusMonthAmountVO> selectMonthPayedAmount(BonusQuery query);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 按日查询分成
|
* 按日查询分成
|
||||||
|
@ -158,4 +159,14 @@ public interface BonusService
|
||||||
* 根据ID支付分成
|
* 根据ID支付分成
|
||||||
*/
|
*/
|
||||||
int payBonusById(Long id);
|
int payBonusById(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 按日查询已分成金额
|
||||||
|
*/
|
||||||
|
List<LocalDateDecimalVO> selectDailyPayedAmount(BonusQuery query);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询已分成金额总和
|
||||||
|
*/
|
||||||
|
BigDecimal selectSumOfPayedAmount(BonusQuery query);
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,6 +3,7 @@ package com.ruoyi.ss.bonus.service.impl;
|
||||||
import com.ruoyi.common.core.domain.model.LoginUser;
|
import com.ruoyi.common.core.domain.model.LoginUser;
|
||||||
import com.ruoyi.common.domain.vo.CommonCountVO;
|
import com.ruoyi.common.domain.vo.CommonCountVO;
|
||||||
import com.ruoyi.common.domain.vo.CommonSumVO;
|
import com.ruoyi.common.domain.vo.CommonSumVO;
|
||||||
|
import com.ruoyi.common.domain.vo.LocalDateDecimalVO;
|
||||||
import com.ruoyi.common.domain.vo.LongDecimalVO;
|
import com.ruoyi.common.domain.vo.LongDecimalVO;
|
||||||
import com.ruoyi.common.enums.LoginType;
|
import com.ruoyi.common.enums.LoginType;
|
||||||
import com.ruoyi.common.utils.DateUtils;
|
import com.ruoyi.common.utils.DateUtils;
|
||||||
|
@ -372,8 +373,8 @@ public class BonusServiceImpl implements BonusService
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<BonusMonthAmountVO> selectMonthAmount(BonusQuery query) {
|
public List<BonusMonthAmountVO> selectMonthPayedAmount(BonusQuery query) {
|
||||||
return bonusMapper.selectMonthAmount(query);
|
return bonusMapper.selectMonthPayedAmount(query);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -422,6 +423,16 @@ public class BonusServiceImpl implements BonusService
|
||||||
return this.payBonus(bonus);
|
return this.payBonus(bonus);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<LocalDateDecimalVO> selectDailyPayedAmount(BonusQuery query) {
|
||||||
|
return bonusMapper.selectDailyPayedAmount(query);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public BigDecimal selectSumOfPayedAmount(BonusQuery query) {
|
||||||
|
return bonusMapper.selectSumOfPayedAmount(query);
|
||||||
|
}
|
||||||
|
|
||||||
private int batchUpdateAmount(List<BonusVO> list) {
|
private int batchUpdateAmount(List<BonusVO> list) {
|
||||||
if (CollectionUtils.isEmptyElement(list)) {
|
if (CollectionUtils.isEmptyElement(list)) {
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -17,6 +17,7 @@ import lombok.Data;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.math.RoundingMode;
|
import java.math.RoundingMode;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -48,6 +49,10 @@ public class TransactionBillVO extends TransactionBill implements IotDevice {
|
||||||
@JsonView(JsonViewProfile.App.class)
|
@JsonView(JsonViewProfile.App.class)
|
||||||
private BigDecimal deviceTotalEle;
|
private BigDecimal deviceTotalEle;
|
||||||
|
|
||||||
|
@ApiModelProperty("设备结束时间")
|
||||||
|
@JsonView(JsonViewProfile.App.class)
|
||||||
|
private LocalDateTime deviceExpireTime;
|
||||||
|
|
||||||
@ApiModelProperty("是否使用中")
|
@ApiModelProperty("是否使用中")
|
||||||
@JsonView(JsonViewProfile.App.class)
|
@JsonView(JsonViewProfile.App.class)
|
||||||
private Boolean isUsing;
|
private Boolean isUsing;
|
||||||
|
|
|
@ -94,6 +94,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
su1.phonenumber as mch_mobile,
|
su1.phonenumber as mch_mobile,
|
||||||
sd.device_no as device_no,
|
sd.device_no as device_no,
|
||||||
sd.total_electri_quantity as device_total_ele,
|
sd.total_electri_quantity as device_total_ele,
|
||||||
|
sd.expire_time as device_expire_time,
|
||||||
su.phonenumber as user_mobile
|
su.phonenumber as user_mobile
|
||||||
from <include refid="rechargeTables"/>
|
from <include refid="rechargeTables"/>
|
||||||
</sql>
|
</sql>
|
||||||
|
|
|
@ -1,11 +1,25 @@
|
||||||
package com.ruoyi.web.controller.app;
|
package com.ruoyi.web.controller.app;
|
||||||
|
|
||||||
import com.ruoyi.common.core.controller.BaseController;
|
import com.ruoyi.common.core.controller.BaseController;
|
||||||
|
import com.ruoyi.common.core.domain.AjaxResult;
|
||||||
|
import com.ruoyi.common.domain.vo.LocalDateDecimalVO;
|
||||||
|
import com.ruoyi.common.utils.collection.CollectionUtils;
|
||||||
import com.ruoyi.dashboard.service.DashboardService;
|
import com.ruoyi.dashboard.service.DashboardService;
|
||||||
|
import com.ruoyi.ss.bonus.domain.BonusQuery;
|
||||||
|
import com.ruoyi.ss.bonus.domain.enums.BonusArrivalType;
|
||||||
|
import com.ruoyi.ss.bonus.domain.vo.BonusDailyAmountVO;
|
||||||
|
import com.ruoyi.ss.bonus.service.BonusService;
|
||||||
|
import io.swagger.annotations.ApiOperation;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
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.RequestMapping;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Objects;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author wjh
|
* @author wjh
|
||||||
* 2024/11/28
|
* 2024/11/28
|
||||||
|
@ -15,12 +29,31 @@ import org.springframework.web.bind.annotation.RestController;
|
||||||
public class AppDashboardController extends BaseController {
|
public class AppDashboardController extends BaseController {
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private DashboardService dashboardService;
|
private BonusService bonusService;
|
||||||
|
|
||||||
// @ApiOperation("按日查询分成列表")
|
@ApiOperation("按日查询本人分成列表")
|
||||||
// @GetMapping("/bonusSumOfDaily")
|
@GetMapping("/bonusDailyAmount")
|
||||||
// public AjaxResult bonusDaily() {
|
public AjaxResult bonusDailyAmount(BonusQuery query) {
|
||||||
// return success(dashboardService.selectBonusDaily());
|
query.setArrivalId(getUserId());
|
||||||
// }
|
query.setArrivalTypes(BonusArrivalType.userList());
|
||||||
|
List<LocalDateDecimalVO> list = bonusService.selectDailyPayedAmount(query);
|
||||||
|
list = list.stream().filter(item -> Objects.nonNull(item.getKey())).collect(Collectors.toList());
|
||||||
|
if (query.getPayDateStart() != null && query.getPayDateEnd() != null) {
|
||||||
|
list = CollectionUtils.fillVoids(list, LocalDateDecimalVO::getKey, (date) -> {
|
||||||
|
LocalDateDecimalVO vo = new LocalDateDecimalVO();
|
||||||
|
vo.setKey(date);
|
||||||
|
vo.setValue(BigDecimal.ZERO);
|
||||||
|
return vo;
|
||||||
|
}, query.getPayDateStart(), query.getPayDateEnd());
|
||||||
|
}
|
||||||
|
AjaxResult ajax = AjaxResult.success(list);
|
||||||
|
|
||||||
|
BonusQuery totalQuery = new BonusQuery();
|
||||||
|
totalQuery.setArrivalId(getUserId());
|
||||||
|
totalQuery.setArrivalTypes(BonusArrivalType.userList());
|
||||||
|
ajax.put("total", bonusService.selectSumOfPayedAmount(totalQuery));
|
||||||
|
|
||||||
|
return ajax;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,13 +3,13 @@ package com.ruoyi.web.controller.ss;
|
||||||
import com.ruoyi.common.core.controller.BaseController;
|
import com.ruoyi.common.core.controller.BaseController;
|
||||||
import com.ruoyi.common.core.domain.AjaxResult;
|
import com.ruoyi.common.core.domain.AjaxResult;
|
||||||
import com.ruoyi.common.core.domain.ValidGroup;
|
import com.ruoyi.common.core.domain.ValidGroup;
|
||||||
|
import com.ruoyi.common.domain.vo.LocalDateDecimalVO;
|
||||||
import com.ruoyi.common.utils.DateUtils;
|
import com.ruoyi.common.utils.DateUtils;
|
||||||
import com.ruoyi.common.utils.collection.CollectionUtils;
|
import com.ruoyi.common.utils.collection.CollectionUtils;
|
||||||
import com.ruoyi.dashboard.service.DashboardService;
|
import com.ruoyi.dashboard.service.DashboardService;
|
||||||
import com.ruoyi.ss.balancePeriod.domain.SmBalancePeriodQuery;
|
import com.ruoyi.ss.balancePeriod.domain.SmBalancePeriodQuery;
|
||||||
import com.ruoyi.ss.balancePeriod.service.ISmBalancePeriodService;
|
import com.ruoyi.ss.balancePeriod.service.ISmBalancePeriodService;
|
||||||
import com.ruoyi.ss.bonus.domain.BonusQuery;
|
import com.ruoyi.ss.bonus.domain.BonusQuery;
|
||||||
import com.ruoyi.ss.bonus.domain.vo.BonusDailyAmountVO;
|
|
||||||
import com.ruoyi.ss.bonus.service.BonusService;
|
import com.ruoyi.ss.bonus.service.BonusService;
|
||||||
import com.ruoyi.ss.businessRecord.service.ISmBusinessRecordService;
|
import com.ruoyi.ss.businessRecord.service.ISmBusinessRecordService;
|
||||||
import com.ruoyi.dashboard.domain.dto.ServiceIncomeQuery;
|
import com.ruoyi.dashboard.domain.dto.ServiceIncomeQuery;
|
||||||
|
@ -114,7 +114,7 @@ public class SmDashboardController extends BaseController {
|
||||||
*/
|
*/
|
||||||
@GetMapping("/bonusMonthAmount")
|
@GetMapping("/bonusMonthAmount")
|
||||||
public AjaxResult getBonusMonthAmount(BonusQuery query) {
|
public AjaxResult getBonusMonthAmount(BonusQuery query) {
|
||||||
return success(bonusService.selectMonthAmount(query));
|
return success(bonusService.selectMonthPayedAmount(query));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -122,13 +122,13 @@ public class SmDashboardController extends BaseController {
|
||||||
*/
|
*/
|
||||||
@GetMapping("/bonusDailyAmount")
|
@GetMapping("/bonusDailyAmount")
|
||||||
public AjaxResult getBonusDailyAmount(BonusQuery query) {
|
public AjaxResult getBonusDailyAmount(BonusQuery query) {
|
||||||
List<BonusDailyAmountVO> list = bonusService.selectDailyAmount(query);
|
List<LocalDateDecimalVO> list = bonusService.selectDailyPayedAmount(query);
|
||||||
// 若开始和结束日期不为空,则补全缺失的日期
|
// 若开始和结束日期不为空,则补全缺失的日期
|
||||||
if (query.getPayDateStart() != null && query.getPayDateEnd() != null) {
|
if (query.getPayDateStart() != null && query.getPayDateEnd() != null) {
|
||||||
list = CollectionUtils.fillVoids(list, BonusDailyAmountVO::getKey, (date) -> {
|
list = CollectionUtils.fillVoids(list, LocalDateDecimalVO::getKey, (date) -> {
|
||||||
BonusDailyAmountVO vo = new BonusDailyAmountVO();
|
LocalDateDecimalVO vo = new LocalDateDecimalVO();
|
||||||
vo.setKey(date);
|
vo.setKey(date);
|
||||||
vo.setSum(BigDecimal.ZERO);
|
vo.setValue(BigDecimal.ZERO);
|
||||||
return vo;
|
return vo;
|
||||||
}, query.getPayDateStart(), query.getPayDateEnd());
|
}, query.getPayDateStart(), query.getPayDateEnd());
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user