This commit is contained in:
张良(004796)
2024-01-22 15:53:08 +08:00
parent 73a8977676
commit 1f7dc94398
7 changed files with 55 additions and 31 deletions

View File

@@ -20,6 +20,7 @@ import org.springframework.web.bind.annotation.*;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import java.time.LocalDate;
import java.util.Arrays;
/**
@@ -42,7 +43,8 @@ public class DayIncomeStatisticsController extends BaseController {
@SaCheckPermission("cai:dayIncomeStatistics:list")
@GetMapping("/list")
public TableDataInfo<DayIncomeStatistics> list(DayIncomeStatistics bo, PageQuery pageQuery) {
Page<DayIncomeStatistics> page = dayIncomeStatisticsService.page(pageQuery.build(), Wrappers.lambdaQuery(bo));
Page<DayIncomeStatistics> page = dayIncomeStatisticsService.page(pageQuery.build(),
Wrappers.lambdaQuery(bo).orderByDesc(DayIncomeStatistics::getDate));
return TableDataInfo.build(page);
}
@@ -58,6 +60,22 @@ public class DayIncomeStatisticsController extends BaseController {
return R.ok(dayIncomeStatisticsService.getById(id));
}
@Log(title = "刷新单天统计", businessType = BusinessType.INSERT)
@RepeatSubmit()
@PostMapping("/refreshToday")
public R<Void> refreshToday() {
dayIncomeStatisticsService.refreshByDate(LocalDate.now());
return R.ok();
}
@Log(title = "刷新昨日统计", businessType = BusinessType.INSERT)
@RepeatSubmit()
@PostMapping("/refreshLastDay")
public R<Void> refreshLastDay() {
dayIncomeStatisticsService.refreshByDate(LocalDate.now().plusDays(-1));
return R.ok();
}
/**
* 新增每日账单统计
*/

View File

@@ -28,4 +28,6 @@ public class LowHeightRiskAdminVo extends LowHeightRisk {
* 性别 0 未知 1 女 2 男
*/
private Integer gender;
private String lastLoginIp;
}

View File

@@ -13,7 +13,7 @@ import java.time.LocalDate;
public class IncomeStatisticsJob {
@Autowired
private DayIncomeStatisticsService dayIncomeStatisticsService;
@Scheduled(cron = "0 0/6 * * * ? *")
@Scheduled(cron = "0 0/6 * * * ?")
public void persistentDb() {
try {
dayIncomeStatisticsService.refreshByDate(LocalDate.now());

View File

@@ -58,18 +58,26 @@ public class DayIncomeStatisticsServiceImpl extends ServiceImpl<DayIncomeStatist
RechargeOrderCountDTO recharge = rechargeOrderMapper.incomeStatistics(startTime,endTime);
VipOrderCountDTO vip = vipOrderMapper.incomeStatistics(startTime,endTime);
AccountCashCountDTO cash = accountCashMapper.incomeStatistics(startTime,endTime);
one = new DayIncomeStatistics();
one.setExpInMoney(recharge.getExpInMoney()==null? BigDecimal.ZERO:recharge.getExpInMoney());
one.setOrderCount(recharge.getOrderCount()==null?0:recharge.getOrderCount());
one.setOutMoney(cash.getCashMoney()==null?BigDecimal.ZERO:cash.getCashMoney());
one.setCashCount(cash.getCashCount()==null?0:cash.getCashCount());
one.setVipInMoney(vip.getVipMoney()==null?BigDecimal.ZERO:vip.getVipMoney());
one.setVipCount(vip.getVipCount()==null?0:vip.getVipCount());
one.setModifyCoinAdd(recharge.getModifyCoinAdd()==null?0:recharge.getModifyCoinAdd());
one.setModifyCoinSub(recharge.getModifyCoinSub()==null?0:recharge.getModifyCoinSub());
one.setModifyIncomeAdd(recharge.getModifyIncomeAdd()==null?0:recharge.getModifyIncomeAdd());
one.setModifyIncomeSub(recharge.getModifyIncomeSub()==null?0:recharge.getModifyIncomeSub());
this.updateById(one);
DayIncomeStatistics update = new DayIncomeStatistics();
update.setId(one.getId());
if(recharge != null){
update.setExpInMoney(recharge.getExpInMoney()==null? BigDecimal.ZERO:recharge.getExpInMoney());
update.setOrderCount(recharge.getOrderCount()==null?0:recharge.getOrderCount());
update.setModifyCoinAdd(recharge.getModifyCoinAdd()==null?0:recharge.getModifyCoinAdd());
update.setModifyCoinSub(recharge.getModifyCoinSub()==null?0:recharge.getModifyCoinSub());
update.setModifyIncomeAdd(recharge.getModifyIncomeAdd()==null?0:recharge.getModifyIncomeAdd());
update.setModifyIncomeSub(recharge.getModifyIncomeSub()==null?0:recharge.getModifyIncomeSub());
}
if(cash != null){
update.setOutMoney(cash.getCashMoney()==null?BigDecimal.ZERO:cash.getCashMoney());
update.setCashCount(cash.getCashCount()==null?0:cash.getCashCount());
}
if(vip != null){
update.setVipInMoney(vip.getVipMoney()==null?BigDecimal.ZERO:vip.getVipMoney());
update.setVipCount(vip.getVipCount()==null?0:vip.getVipCount());
}
update.setUpdateTime(LocalDateTime.now());
this.updateById(update);
}
}

View File

@@ -24,9 +24,18 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</update>
<select id="pageAdmin" resultType="com.ruoyi.cai.dto.admin.vo.LowHeightRiskAdminVo">
select
t1.*,t2.age,t2.avatar,t2.usercode,t2.nickname,t2.mobile,t2.gender
t1.*,t2.age,t2.avatar,t2.usercode,t2.nickname,t2.mobile,t2.gender,t3.last_login_ip
from cai_low_height_risk t1
left join cai_user t2 on t1.user_id = t2.id
left join cai_user_info t3 on t1.user_id = t3.user_id
<where>
<if test="bo.mobile != null and bo.mobile != ''">
and t2.mobile = #{bo.mobile}
</if>
<if test="bo.usercode != null and bo.usercode != ''">
and t2.usercode = #{bo.usercode}
</if>
</where>
order by t1.create_time desc
</select>

View File

@@ -28,6 +28,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="bo.homeIndex != null">
and t1.home_index = #{bo.homeIndex}
</if>
<if test="bo.userId != null">
and t1.user_id = #{bo.userId}
</if>
</where>
order by t1.create_time desc
</select>

View File

@@ -1,16 +0,0 @@
<?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.system.mapper.CaiUserErrorLogMapper">
<resultMap type="com.ruoyi.system.domain.CaiUserErrorLog" id="CaiUserErrorLogResult">
<result property="id" column="id"/>
<result property="type" column="type"/>
<result property="userId" column="user_id"/>
<result property="homeIndex" column="home_index"/>
<result property="createTime" column="create_time"/>
</resultMap>
</mapper>