fix:系统用户表实现通过部门关联ai_user
This commit is contained in:
parent
f98ceb5785
commit
c7334ab7d9
|
|
@ -24,7 +24,7 @@ import java.util.List;
|
|||
* @date 2025-11-13
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/ai/order")
|
||||
@RequestMapping("/ai/video/order")
|
||||
public class AiOrderController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
|
|
|
|||
|
|
@ -59,6 +59,9 @@ public class AiOrderServiceImpl implements IAiOrderService {
|
|||
@Autowired
|
||||
private IByteDeptApiKeyService byteDeptApiKeyService;
|
||||
|
||||
@Autowired
|
||||
private IAiVideoReportDataService aiVideoReportDataService;
|
||||
|
||||
// 流水表:任务成功时回补
|
||||
private static final String TASK_SUCCESS_BACK_FILL_REMARK = "order.number.generation.successbackfill";
|
||||
|
||||
|
|
@ -244,6 +247,7 @@ public class AiOrderServiceImpl implements IAiOrderService {
|
|||
public void orderSuccess(AiOrder aiOrder) {
|
||||
aiOrder.setStatus(1);
|
||||
aiOrderMapper.updateById(aiOrder);
|
||||
syncVideoReportData(aiOrder);
|
||||
AiStatistics aiStatistics = new AiStatistics();
|
||||
aiStatistics.setSource(aiOrder.getSource());
|
||||
aiStatistics.setGenerateCount(1L);
|
||||
|
|
@ -349,4 +353,18 @@ public class AiOrderServiceImpl implements IAiOrderService {
|
|||
// BalanceChangerConstants.QUICK_VIDEO_GENERATION, TASK_SUCCESS_BALANCE_REMARK);
|
||||
return AjaxResult.success("callback success");
|
||||
}
|
||||
|
||||
/**
|
||||
* 任务成功后按“提交时间”写入团队消耗统计来源表。
|
||||
*
|
||||
* @param aiOrder 已成功订单
|
||||
*/
|
||||
private void syncVideoReportData(AiOrder aiOrder) {
|
||||
if (aiOrder == null || aiOrder.getCreateTime() == null || aiOrder.getDeptId() == null || aiOrder.getUserId() == null) {
|
||||
return;
|
||||
}
|
||||
BigDecimal score = aiOrder.getAmount() != null ? aiOrder.getAmount() : BigDecimal.ZERO;
|
||||
Long useTokens = aiOrder.getTotalUsage() != null ? aiOrder.getTotalUsage().longValue() : 0L;
|
||||
aiVideoReportDataService.syncVideoConsumeIncrement(aiOrder.getCreateTime(), aiOrder.getDeptId(), aiOrder.getUserId(), score, useTokens);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -303,7 +303,7 @@ public class AiUserServiceImpl implements IAiUserService {
|
|||
private AiUser getUserByInvitationCode(String invitationCode) {
|
||||
LambdaQueryWrapper<AiUser> query = Wrappers.lambdaQuery();
|
||||
query.eq(AiUser::getInvitationCode, invitationCode);
|
||||
query.eq(AiUser::getDelFlag, 0);
|
||||
query.eq(AiUser::getDelFlag, "0");
|
||||
return aiUserMapper.selectOne(query);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue