Compare commits
No commits in common. "b2f1bc8439691fd9bfbceb664cbc19e4401b6392" and "d1b27c42cdf625016de6671ab744703ec73a4645" have entirely different histories.
b2f1bc8439
...
d1b27c42cd
|
|
@ -4,11 +4,9 @@ import java.util.List;
|
|||
import java.math.BigDecimal;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.ruoyi.ai.domain.AiOrder;
|
||||
import com.ruoyi.ai.domain.AiVideoReportData;
|
||||
import com.ruoyi.system.domain.subteam.SubteamVideoMetrics;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.apache.ibatis.annotations.Update;
|
||||
|
||||
/**
|
||||
* AI视频生成统计数据,作为其他统计报的数据源Mapper接口
|
||||
|
|
@ -69,6 +67,4 @@ public interface AiVideoReportDataMapper extends BaseMapper<AiVideoReportData> {
|
|||
int upsertRechargeScoreIncrement(@Param("dateKey") String dateKey,
|
||||
@Param("deptId") Long deptId,
|
||||
@Param("rechargeScore") BigDecimal rechargeScore);
|
||||
|
||||
void addNewOrderReportData(AiOrder aiOrder);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,9 +8,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|||
import com.ruoyi.ai.domain.AiManager;
|
||||
import com.ruoyi.ai.domain.AiOrder;
|
||||
import com.ruoyi.ai.domain.AiStatistics;
|
||||
import com.ruoyi.ai.domain.AiVideoReportData;
|
||||
import com.ruoyi.ai.mapper.AiOrderMapper;
|
||||
import com.ruoyi.ai.mapper.AiVideoReportDataMapper;
|
||||
import com.ruoyi.ai.service.*;
|
||||
import com.ruoyi.common.constant.BalanceChangerConstants;
|
||||
import com.ruoyi.common.constant.HttpStatus;
|
||||
|
|
@ -48,8 +46,6 @@ public class AiOrderServiceImpl implements IAiOrderService {
|
|||
|
||||
@Autowired
|
||||
private AiOrderMapper aiOrderMapper;
|
||||
@Autowired
|
||||
private AiVideoReportDataMapper aiVideoReportDataMapper;
|
||||
|
||||
@Autowired
|
||||
private IAiManagerService aiManagerService;
|
||||
|
|
@ -257,9 +253,6 @@ public class AiOrderServiceImpl implements IAiOrderService {
|
|||
aiStatistics.setGenerateCount(1L);
|
||||
// 新增生成数量
|
||||
aiStatisticsService.saveOrUpdateData(aiStatistics);
|
||||
|
||||
// 统计数据
|
||||
aiVideoReportDataMapper.addNewOrderReportData(aiOrder);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -1,27 +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.ai.mapper.AiVideoReportDataMapper">
|
||||
|
||||
<!--
|
||||
按订单 create_time 聚合到小时(yyyy-MM-dd HH)+ dept_id + user_id 维表。
|
||||
不存在则插入,存在则累加 score、order_count、use_tokens(单条语句,InnoDB 原子)。
|
||||
-->
|
||||
<insert id="addNewOrderReportData">
|
||||
INSERT INTO ai_video_report_data (date_key, dept_id, user_id, score, order_count, use_tokens)
|
||||
VALUES (
|
||||
DATE_FORMAT(#{createTime}, '%Y-%m-%d %H'),
|
||||
#{deptId},
|
||||
#{userId},
|
||||
IFNULL(#{amount}, 0),
|
||||
1,
|
||||
IFNULL(#{totalUsage}, 0)
|
||||
)
|
||||
ON DUPLICATE KEY UPDATE
|
||||
score = score + VALUES(score),
|
||||
order_count = order_count + VALUES(order_count),
|
||||
use_tokens = use_tokens + VALUES(use_tokens)
|
||||
</insert>
|
||||
|
||||
</mapper>
|
||||
Loading…
Reference in New Issue