|
@@ -64,6 +64,13 @@ public class CmsGptCarController {
|
|
|
String gptSession = chatGptAccountService.getGptSession(dbChatSession.getEmail(), dbChatSession.getPassword());
|
|
String gptSession = chatGptAccountService.getGptSession(dbChatSession.getEmail(), dbChatSession.getPassword());
|
|
|
chatgptSession.setOfficialSession(gptSession);
|
|
chatgptSession.setOfficialSession(gptSession);
|
|
|
}
|
|
}
|
|
|
|
|
+ Integer selectCount = chatgptSessionMapper.selectCount(Wrappers.lambdaQuery(ChatgptSession.class)
|
|
|
|
|
+ .and(e -> e.eq(ChatgptSession::getEmail, chatgptSession.getEmail())
|
|
|
|
|
+ .or().eq(ChatgptSession::getCarId, chatgptSession.getCarId()))
|
|
|
|
|
+ .ne(ChatgptSession::getId, chatgptSession.getId()));
|
|
|
|
|
+ if (selectCount > 0) {
|
|
|
|
|
+ throw BusinessRuntimeException.getInstance("请检验车队ID或账号是否已存在");
|
|
|
|
|
+ }
|
|
|
chatgptSessionMapper.updateById(chatgptSession);
|
|
chatgptSessionMapper.updateById(chatgptSession);
|
|
|
return GatewayResponse.SUCCESS.newBuilder().toResult();
|
|
return GatewayResponse.SUCCESS.newBuilder().toResult();
|
|
|
}
|
|
}
|
|
@@ -99,9 +106,9 @@ public class CmsGptCarController {
|
|
|
@PostMapping("/post/mirror/car/session")
|
|
@PostMapping("/post/mirror/car/session")
|
|
|
public Result<String> postMirrorCarSession(@RequestBody ChatgptSession chatgptSession) {
|
|
public Result<String> postMirrorCarSession(@RequestBody ChatgptSession chatgptSession) {
|
|
|
Integer selectCount = chatgptSessionMapper.selectCount(Wrappers.lambdaQuery(ChatgptSession.class)
|
|
Integer selectCount = chatgptSessionMapper.selectCount(Wrappers.lambdaQuery(ChatgptSession.class)
|
|
|
- .eq(ChatgptSession::getCarId, chatgptSession.getCarId()));
|
|
|
|
|
|
|
+ .eq(ChatgptSession::getCarId, chatgptSession.getCarId()).or().eq(ChatgptSession::getEmail, chatgptSession.getEmail()));
|
|
|
if (selectCount > 0) {
|
|
if (selectCount > 0) {
|
|
|
- throw BusinessRuntimeException.getInstance("输入的车队id已存在");
|
|
|
|
|
|
|
+ throw BusinessRuntimeException.getInstance("请检验车队ID或账号是否已存在");
|
|
|
}
|
|
}
|
|
|
String gptSession = chatGptAccountService.getGptSession(chatgptSession.getEmail(), chatgptSession.getPassword());
|
|
String gptSession = chatGptAccountService.getGptSession(chatgptSession.getEmail(), chatgptSession.getPassword());
|
|
|
chatgptSession.setIsCar(true);
|
|
chatgptSession.setIsCar(true);
|