Compare commits
3 Commits
082a6ad7be
...
7597188990
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7597188990 | ||
|
|
e000a148ee | ||
| 200dde370a |
@ -97,9 +97,21 @@ public class AdminActivityInfoCollectionResp {
|
||||
@Schema(description = "偏科(数学、英语等)")
|
||||
private String weakSubject;
|
||||
|
||||
/**
|
||||
* 弱点学科
|
||||
*/
|
||||
@Schema(description = "创建时间")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
/**
|
||||
* 更新时间
|
||||
*/
|
||||
@Schema(description = "更新时间")
|
||||
private LocalDateTime updateTime;
|
||||
|
||||
/**
|
||||
* 代理商拨打电话联系家长的次数
|
||||
*/
|
||||
@Schema(description = "代理商拨打电话联系家长的次数")
|
||||
private Integer contactCallCount = 0;
|
||||
}
|
||||
|
||||
@ -186,11 +186,31 @@ public class AppParentAgentActivityService implements IAppParentAgentActivitySer
|
||||
result = parseAiResponse(content);
|
||||
result.setConstellation(request.getConstellation());
|
||||
|
||||
// 先查询该家长是否已有性格测试记录,有则更新,无则新增
|
||||
MpTestChildCharacterEntity existingEntity = mpTestChildCharacterService
|
||||
.lambdaQuery()
|
||||
.eq(MpTestChildCharacterEntity::getParentId, parentId)
|
||||
.orderByDesc(MpTestChildCharacterEntity::getCreateTime)
|
||||
.last("LIMIT 1")
|
||||
.one();
|
||||
|
||||
// 如果AI调用成功则将测试结果保存到数据库中
|
||||
MpTestChildCharacterEntity entity = getCharacterEntity(request, parentId, result);
|
||||
boolean save = mpTestChildCharacterService.save(entity);
|
||||
if (save) {
|
||||
log.info("保存性格测试结果成功");
|
||||
|
||||
boolean saveOrUpdateResult;
|
||||
if (existingEntity != null) {
|
||||
// 如果存在记录,则更新
|
||||
entity.setId(existingEntity.getId());
|
||||
saveOrUpdateResult = mpTestChildCharacterService.updateById(entity);
|
||||
log.info("更新性格测试结果成功,家长ID: {}", parentId);
|
||||
} else {
|
||||
// 如果不存在记录,则新增
|
||||
saveOrUpdateResult = mpTestChildCharacterService.save(entity);
|
||||
log.info("保存性格测试结果成功,家长ID: {}", parentId);
|
||||
}
|
||||
|
||||
if (!saveOrUpdateResult) {
|
||||
log.error("保存或更新性格测试结果失败,家长ID: {}", parentId);
|
||||
}
|
||||
} else {
|
||||
// 如果AI调用失败,返回默认响应
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user