fix:系统用户表实现通过部门关联ai_user
This commit is contained in:
parent
f98ceb5785
commit
c7334ab7d9
|
|
@ -24,7 +24,7 @@ import java.util.List;
|
||||||
* @date 2025-11-13
|
* @date 2025-11-13
|
||||||
*/
|
*/
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/ai/order")
|
@RequestMapping("/ai/video/order")
|
||||||
public class AiOrderController extends BaseController
|
public class AiOrderController extends BaseController
|
||||||
{
|
{
|
||||||
@Autowired
|
@Autowired
|
||||||
|
|
|
||||||
|
|
@ -59,6 +59,9 @@ public class AiOrderServiceImpl implements IAiOrderService {
|
||||||
@Autowired
|
@Autowired
|
||||||
private IByteDeptApiKeyService byteDeptApiKeyService;
|
private IByteDeptApiKeyService byteDeptApiKeyService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private IAiVideoReportDataService aiVideoReportDataService;
|
||||||
|
|
||||||
// 流水表:任务成功时回补
|
// 流水表:任务成功时回补
|
||||||
private static final String TASK_SUCCESS_BACK_FILL_REMARK = "order.number.generation.successbackfill";
|
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) {
|
public void orderSuccess(AiOrder aiOrder) {
|
||||||
aiOrder.setStatus(1);
|
aiOrder.setStatus(1);
|
||||||
aiOrderMapper.updateById(aiOrder);
|
aiOrderMapper.updateById(aiOrder);
|
||||||
|
syncVideoReportData(aiOrder);
|
||||||
AiStatistics aiStatistics = new AiStatistics();
|
AiStatistics aiStatistics = new AiStatistics();
|
||||||
aiStatistics.setSource(aiOrder.getSource());
|
aiStatistics.setSource(aiOrder.getSource());
|
||||||
aiStatistics.setGenerateCount(1L);
|
aiStatistics.setGenerateCount(1L);
|
||||||
|
|
@ -349,4 +353,18 @@ public class AiOrderServiceImpl implements IAiOrderService {
|
||||||
// BalanceChangerConstants.QUICK_VIDEO_GENERATION, TASK_SUCCESS_BALANCE_REMARK);
|
// BalanceChangerConstants.QUICK_VIDEO_GENERATION, TASK_SUCCESS_BALANCE_REMARK);
|
||||||
return AjaxResult.success("callback success");
|
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) {
|
private AiUser getUserByInvitationCode(String invitationCode) {
|
||||||
LambdaQueryWrapper<AiUser> query = Wrappers.lambdaQuery();
|
LambdaQueryWrapper<AiUser> query = Wrappers.lambdaQuery();
|
||||||
query.eq(AiUser::getInvitationCode, invitationCode);
|
query.eq(AiUser::getInvitationCode, invitationCode);
|
||||||
query.eq(AiUser::getDelFlag, 0);
|
query.eq(AiUser::getDelFlag, "0");
|
||||||
return aiUserMapper.selectOne(query);
|
return aiUserMapper.selectOne(query);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue